From 345542f130727f92150224a6e416f9b78d55db94 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 08 七月 2025 17:58:09 +0800
Subject: [PATCH] 首次提交,导入项目源代码与常用库:

---
 Lib/CHThreadPool/include/WorkThreadArray.h                                              |   29 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp                  |   48 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp                            |  468 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp                           |   48 
 ENRIT/UITool/General_Draw.h                                                             |  240 
 Common_Class/ExpireDay/ExpireDayDlg.cpp                                                 |  204 
 Common_Class/Matrox/lib/milwebclient.lib                                                |    0 
 Lib/EdgeInspect/include/NotchCut.h                                                      |  276 
 Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp                       |  132 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h                              |   94 
 Common_Class/Matrox/dll/RadientPfpga.dll                                                |    0 
 ENRIT/View/ViewInsInformation.cpp                                                       |  886 
 BlVisionPro/Vision/DistDotProcess.h                                                     |  105 
 ENRIT/View/ViewRecipeProfileView.h                                                      |   52 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp                   |  101 
 Common_Class/PLCConnector/stdafx.cpp                                                    |    8 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp                        |  631 
 Common_Class/SISAssem/ConvPixelVertMS.asm                                               | 1037 
 Common_Class/SISControls/Header/FontStatic.h                                            |   69 
 Lib/EdgeInspect/include/SISEdgeFind.h                                                   |  162 
 Common_Class/Mvsol/lib/mvenc852v3x64d.lib                                               |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/photo.hpp                                         |  870 
 Lib/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp                         |  306 
 ENRIT/res/ICON/gear_preferences.ico                                                     |    0 
 Common_Class/SISAssem/ConvPixel222.asm                                                  | 1079 
 Common_Class/SISAssem/Header/PairStorage.h                                              |   59 
 Lib/SISControls/include/WKButton.h                                                      |  119 
 ENRIT/Thread/PriorityThread.cpp                                                         |   43 
 BlVisionPro/View/RcutSetDLg.h                                                           |   90 
 ENRIT/res/ICON/arrow_right_blue.ico                                                     |    0 
 Common_Class/SISAssem/MathImpl.asm                                                      |  214 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp                                  |  365 
 Common_Class/Matrox/dll/Milsolios.dll                                                   |    0 
 Common_Class/Matrox/Include/Milsetup.h                                                  |  303 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp                                   |   48 
 ENRUTResources_zh-CN/res/icon/ico00001.ico                                              |    0 
 Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCheck.h             |   68 
 Common_Class/SISAssem/AssemDefect.cpp                                                   |  228 
 Common_Class/BlVisionPro/Vision/LocProcess.cpp                                          |  366 
 Lib/OpenCV/opencv_3.1/lib/opencv_videoio310.lib                                         |    0 
 Common_Class/EdgeInspect/Header/RANSAC_LineFittingAlgorithm.h                           |   20 
 Common_Class/Mvsol/lib/mvenc852v3d.lib                                                  |    0 
 Common_Class/SISControls/HeadCtrl.cpp                                                   |  293 
 ENRIT/UITool/font.cpp                                                                   |  111 
 Common_Class/BlVisionPro/Vision/InChipDotProcess.h                                      |   38 
 Lib/OpenCV/opencv_3.1/lib/opencv_objdetect310d.lib                                      |    0 
 Common_Class/BlVisionPro/Vision/CornerDistProcess.cpp                                   |  392 
 Lib/EuresysCam/Include/MCpp_ConfigurationImpl.h                                         |   28 
 Lib/Matrox/dll/MilGrabc.dll                                                             |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/superres.hpp                                      |  207 
 BlVisionPro/Vision/CornerRcutProcess.h                                                  |   34 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/private.hpp                                  |  425 
 SDK_AND_TEST/SDK_AND_TEST.rc                                                            |    0 
 Common_Class/SISAssem/ConvFloatVTD.asm                                                  |  989 
 Common_Class/SISAssem/ConvZgSpVtSkB2.asm                                                | 1230 
 Common_Class/SISControls/GridControl/GridMemDC.h                                        |  106 
 Lib/SISControls/GridControl/GridDropTarget.h                                            |   82 
 ENRIT/View/ViewMapSettings.h                                                            |   41 
 Lib/SISControls/include/InPlaceComboBox.h                                               |   51 
 Lib/ApiVisionSDK/include/IClsDisplay.h                                                  |  171 
 ENRIT/Light/ExternLightControl.h                                                        |   42 
 Common_Class/PLCConnector/UserImages.bmp                                                |    0 
 Lib/OpenCV/opencv_3.1/include/opencv/ml.h                                               |   47 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/any.h                                       |  323 
 Common_Class/SISAssem/ConvZoneVTDMS.asm                                                 | 1242 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp                        |  150 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/core.hpp                                     |   48 
 BlVisionPro/Header/BlVisionLib.h                                                        |   19 
 Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.cpp              |  305 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/general.h                                   |   50 
 Lib/OpenCV/opencv_3.1/lib/opencv_videostab310d.lib                                      |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cv.hpp                                    |   60 
 Common_Class/SISAssem/ConvZoneVert2.asm                                                 | 1102 
 Lib/EuresysCam/Include/MCpp_BoardImpl.h                                                 |   33 
 ENRIT/res/ICON/warning.ico                                                              |    0 
 Common_Class/EdgeInspect/RANSAC_LineFittingAlgorithm.cpp                                |    0 
 Common_Class/SISControls/GridControl/GridCtrl.h                                         | 1088 
 ENRIT/res/Load1_Push.bmp                                                                |    0 
 Lib/CHImageBuffer/include/ImageBuffer.h                                                 |  101 
 ENRIT/View/ViewHWSetting.cpp                                                            |  796 
 ENRIT/UITool/MImageStatic.h                                                             |   64 
 Common_Class/LogView/MainFrm.cpp                                                        |  212 
 Common_Class/SISAssem/AssemUtil.cpp                                                     |  275 
 BlVisionPro/Vision/KeyDistDotProcess.h                                                  |   70 
 BlVisionPro/stdafx.h                                                                    |   41 
 Lib/EuresysCam/Include/multicam.h                                                       |  155 
 Common_Class/SISControls/SISControls.rc                                                 |  133 
 Common_Class/SISAssem/.gitignore                                                        |   29 
 Common_Class/BlVisionPro/Vision/InChipDotProcess.cpp                                    |  157 
 Common_Class/BlGrabber/targetver.h                                                      |    8 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp                                |  652 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h                 |  186 
 Common_Class/Matrox/dll/milwebclient.dll                                                |    0 
 ENRUTResources_zh-CN/res/icon/ico00010.ico                                              |    0 
 Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.cpp                        |  519 
 Common_Class/SISAssem/ConvTrap.asm                                                      |  767 
 ENRIT/res/旃措霛_ico                                                                      |    0 
 Common_Class/SISAssem/ConvPixel.asm                                                     | 1102 
 Common_Class/SISControls/SISListBoxLog.cpp                                              |  518 
 BlVisionPro/Vision/BlVisionLib.cpp                                                      |   35 
 Common_Class/SISAssem/Header/Pad.h                                                      |  145 
 Common_Class/BlGrabber/stdafx.cpp                                                       |    7 
 BlVisionPro/BlVisionPro.h                                                               |   27 
 Common_Class/EdgeInspect/CornerCut.cpp                                                  | 1305 
 Common_Class/BlVisionPro/Vision/RcutDotProcess.h                                        |  147 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/timer.h                            |   94 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h                          |   74 
 Common_Class/ConfigFileManager/ConfigFileManager.def                                    |    6 
 Lib/OpenCV/opencv_3.1/include/opencv/highgui.h                                          |   48 
 Lib/SISBuffer/include/Broadcast.h                                                       |   41 
 Common_Class/BlVisionPro/res/navigate_left.ico                                          |    0 
 Common_Class/ExpireDay/res/ExpireDay.ico                                                |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp                 |  200 
 Common_Class/SISBuffer/MatchBuffer.cpp                                                  |  359 
 ENRUTResources_zh-CN/ENRUTResources_zh-CN.cpp                                           |   64 
 Lib/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h                                   |   74 
 Common_Class/SISControls/Header/XTabCtrl.h                                              |   90 
 Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.cpp               |   78 
 BlVisionPro/Vision/Serializer.cpp                                                       |  212 
 Common_Class/PLCConnector/res/PLCConnector.rc2                                          |   13 
 Common_Class/Matrox/dll/MilRadientUI.dll                                                |    0 
 ENRIT/res/ICON/icon4.ico                                                                |    0 
 Lib/OpenCV/opencv_3.1/lib/opencv_features2d310d.lib                                     |    0 
 Common_Class/MegaLock/lib/l_mega64.lib                                                  |    0 
 Common_Class/SISControls/CellCtrl.cpp                                                   | 1548 
 ENRIT/Process/ThreadControl.h                                                           |   95 
 Common_Class/BlVisionPro/Vision/Serializer.cpp                                          |  212 
 ENRIT/Data/ResultData.cpp                                                               |  526 
 Lib/SISControls/GridControl/GridCell.h                                                  |  143 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp                          |   72 
 Common_Class/BlVisionPro/Vision/Vec.h                                                   |  463 
 Common_Class/SISAssem/SISAssem.sln                                                      |   26 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp    |  225 
 BlVisionPro/Vision/VisionBufferPro.cpp                                                  | 1337 
 Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.cpp                   |   42 
 ENRIT/View/ViewPPIDNew.cpp                                                              |   90 
 Common_Class/SISBuffer/ConvInt1.cpp                                                     | 4303 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp                           |  132 
 ENRIT/Data/Glass_Data.h                                                                 |  392 
 ENRIT/res/buttons.bmp                                                                   |    0 
 Lib/Matrox/dll/MilMorphisQxt.dll                                                        |    0 
 Common_Class/BlVisionPro/IncludeVision.h                                                |  108 
 Common_Class/SharedMapDll/ReadMe.txt                                                    |   56 
 Lib/EuresysCam/Include/MCpp_ChannelImpl.h                                               |  139 
 SDK_AND_TEST/SDK_AND_TESTDlg.cpp                                                        |    0 
 Common_Class/BlVisionPro/BlVisionPro.cpp                                                |   65 
 Common_Class/CHImageBuffer/CHImageBuffer.vcxproj.filters                                |   74 
 Lib/Matrox/dll/MilGPU.dll                                                               |    0 
 ENRIT/PLC/Control_Interface.cpp                                                         |  991 
 ENRIT/UITool/btnenh.cpp                                                                 | 3065 
 ENRUTResources_zh-CN/res/icon/icon_war.ico                                              |    0 
 Common_Class/SISControls/SISFolderScheduling.cpp                                        |  284 
 Common_Class/CHThreadPool/dllmain.cpp                                                   |   51 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp                               |  158 
 Common_Class/SISControls/Header/SISFolderScheduling.h                                   |   92 
 Common_Class/Matrox/dll/libmfxsw64.dll                                                  |    0 
 Common_Class/SISAssem/ConvFloat2.asm                                                    |  755 
 BlVisionPro/View/VisionSetDlg.h                                                         |   94 
 Common_Class/BlVisionPro/View/KeyVisionSetDlg.cpp                                       |  355 
 Common_Class/BlVisionPro/res/navigate_up.ico                                            |    0 
 Common_Class/Matrox/Include/milstring.h                                                 | 1852 
 ENRIT/View/FrameImg.cpp                                                                 | 3427 
 Global_Include/FreeImage.h                                                              | 1102 
 Common_Class/EdgeInspect/Header/BLOB_Tool.h                                             |   82 
 Common_Class/LogView/resource.h                                                         |   53 
 ENRIT/ENRIT.h                                                                           |   39 
 Lib/CHImageBuffer/include/ImageViewer.h                                                 |  219 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp   |  274 
 Common_Class/PLCConnector/res/Toolbar.bmp                                               |    0 
 Common_Class/CHThreadPool/ReadMe.txt                                                    |   60 
 Common_Class/SISAssem/AssemUtil2E.asm                                                   |  276 
 Lib/SISControls/GridControl/GridInPlaceEdit.h                                           |   83 
 Common_Class/EuresysCam/Include/MCpp_Callback.h                                         |   47 
 BlVisionPro/View/GrindSetDlg.cpp                                                        |  386 
 Common_Class/ConfigFileManager/FileMap.cpp                                              |  692 
 BlVisionPro/Vision/CutDotProcess.cpp                                                    |  354 
 BlVisionPro/View/KDistSetDlg.cpp                                                        |  472 
 ENRUTResources_zh-CN/res/icon/led_off.ico                                               |    0 
 Common_Class/BlVisionPro/Vision/ConfigVision.cpp                                        |  127 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp              |  132 
 Lib/Matrox/lib/milfpga.lib                                                              |    0 
 SDK_AND_TEST/SDK_AND_TEST.h                                                             |    0 
 ENRIT/Thread/Thread_ViewRefresh.h                                                       |   47 
 .vs/ENRIT/v17/Browse.VC.db                                                              |    0 
 Common_Class/SharedMapDll/SharedMapDll.vcxproj.filters                                  |   62 
 ENRUTResources_zh-CN/res/icon/ico00012.ico                                              |    0 
 ENRIT/res/radio_on.bmp                                                                  |    0 
 Common_Class/VisionLib/SISControls/include/SISJogButton.h                               |   63 
 Common_Class/SISControls/GridControl/GridDropTarget.h                                   |   82 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h                      |  533 
 Common_Class/VisionLib/SISControls/GridControl/GridInPlaceEdit.h                        |   83 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp          |  165 
 Lib/SISControls/GridControl/NewCellTypes/GridCellCheck.h                                |   68 
 ENRIT/res/Save1_Nor.bmp                                                                 |    0 
 Common_Class/SISControls/SISControls.cpp                                                |   51 
 BlVisionPro/Header/IVisionRecipe.h                                                      |   67 
 Common_Class/Matrox/dll/MilRadientProUI.dll                                             |    0 
 Lib/SISControls/include/SISListCtrlExt.h                                                |  137 
 Common_Class/VisionLib/SISControls/include/InPlaceComboBox.h                            |   51 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/random.h                           |  133 
 Common_Class/BlVisionPro/Vision/GrindDotProcess.cpp                                     |  345 
 BlVisionPro/Vision/GrindProcess.cpp                                                     |  123 
 Common_Class/Matrox/dll/DigitizerController.dll                                         |    0 
 BlVisionPro/BlVisionPro.cpp                                                             |   65 
 Lib/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib                                         |    0 
 Common_Class/SISControls/SISControls.vcxproj                                            |  672 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp                          |  116 
 BlVisionPro/ReadMe.txt                                                                  |   45 
 ENRIT/UITool/font.h                                                                     |   48 
 Common_Class/CHImageBuffer/targetver.h                                                  |    8 
 Common_Class/VisionLib/LogSDK/include/ILogger.h                                         |   45 
 Common_Class/SISBuffer/SISBuffer.def                                                    |    7 
 ENRIT/Recipe/GlassRecipe.h                                                              | 1095 
 ENRIT/res/writelarge.bmp                                                                |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cv.h                                      |   73 
 Common_Class/SISControls/Header/CellCtrl.h                                              |  304 
 Lib/CHThreadPool/include/WaitThreadPool.h                                               |   25 
 Common_Class/BlVisionPro/View/VisionSetDlg.cpp                                          |  545 
 Common_Class/EuresysCam/Include/MCpp_globalImpl.h                                       |  136 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/general.h                          |   50 
 Common_Class/Matrox/Include/MilDSFCapture.h                                             |  618 
 Common_Class/SharedMapDll/SharedMapDll.cpp                                              |   10 
 ENRIT/View/ViewRecipeChamferView.cpp                                                    |  256 
 Common_Class/Matrox/Include/MILDyn/mil3dgeo.h                                           |  740 
 Lib/SISControls/include/FontStatic.h                                                    |   69 
 Common_Class/BlGrabber/ReadMe.txt                                                       |   45 
 ENRIT/UITool/textdescriptor.h                                                           |   76 
 Common_Class/LogView/Header/LogViewView.h                                               |  156 
 ENRUTResources_zh-CN/res/icon/ico00005.ico                                              |    0 
 ENRIT/res/radio_on32.bmp                                                                |    0 
 ENRIT/InterfaceManager.h                                                                |  180 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp                               |  135 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/config.h                           |   38 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_shape310.lib                                  |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp                               |   48 
 Common_Class/CHImageBuffer/CHImageBuffer.rc                                             |    0 
 Common_Class/EuresysCam/Include/MCpp_Exception.h                                        |   32 
 Lib/OpenCV/opencv_3.1/lib/opencv_highgui310.lib                                         |    0 
 Common_Class/EdgeInspect/Header/SISEdgeFind.h                                           |  162 
 Common_Class/SISBuffer/LeastSquare.h                                                    |   69 
 Lib/CHThreadPool/include/WorkThreadPool.h                                               |   37 
 Common_Class/SISAssem/SISAssem_Unuse.cpp                                                |  338 
 .vs/ENRIT/CopilotIndices/17.13.441.19478/SemanticSymbols.db                             |    0 
 ENRIT/stdafx.cpp                                                                        |    8 
 Lib/Matrox/dll/MilDSFCapture.dll                                                        |    0 
 Common_Class/EdgeInspect/ProfileCADProc.cpp                                             |  730 
 Common_Class/SISControls/LogCtrl.cpp                                                    |  544 
 ENRIT/View/ViewLiveCam.h                                                                |   55 
 Common_Class/PLCConnector/res/PLCConnectorDoc.ico                                       |    0 
 Common_Class/CHThreadPool/stdafx.h                                                      |   41 
 Common_Class/EuresysCam/Include/McDef.h                                                 |   72 
 ENRIT/targetver.h                                                                       |    8 
 ENRUTResources_zh-CN/res/led_on.bmp                                                     |    0 
 Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridURLCell.h               |   55 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h                      |  252 
 Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h                           |  165 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp                  |  174 
 Common_Class/SISControls/StdAfx.cpp                                                     |    8 
 ENRUTResources_zh-CN/res/icon/icon_can.ico                                              |    0 
 ENRIT/UITool/texture.h                                                                  |   42 
 Common_Class/SISControls/PropertyGridControl/DynDialogEx.cpp                            |  621 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp                          |  200 
 Common_Class/BlVisionPro/View/LockSetDlg.h                                              |   34 
 Common_Class/SISAssem/ConvZoneVert2S2b2.asm                                             | 1158 
 ENRIT/res/ICON/add2.ico                                                                 |    0 
 Lib/OpenCV/opencv_3.1/lib/opencv_superres310d.lib                                       |    0 
 Common_Class/Matrox/Include/MilDSFSequence.h                                            |  168 
 ENRIT/res/ICON/arrow_left_blue.ico                                                      |    0 
 ENRIT/View/DlgLicenseInfo.cpp                                                           |   88 
 Lib/BaseDisplaySDK/include/BaseDisplayLib.h                                             |   24 
 Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.cpp                 |  442 
 Common_Class/SISBuffer/Resource.h                                                       |   16 
 Common_Class/SISAssem/SISAssemD.def                                                     |    7 
 Lib/OpenCV/opencv_3.1/lib/opencv_photo310d.lib                                          |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp                      |   48 
 ENRUTResources_zh-CN/res/icon/ico00014.ico                                              |    0 
 Common_Class/BlVisionPro/res/BlVisionPro.rc2                                            |    0 
 Common_Class/BlVisionPro/targetver.h                                                    |    8 
 Lib/Matrox/dll/MilgigevisionUI.dll                                                      |    0 
 ENRUTResources_zh-CN/res/icon/icon_cop.ico                                              |    0 
 Common_Class/SISAssem/SISAssem.vcxproj                                                  |  912 
 Common_Class/BlVisionPro/View/ThresSetDlg.cpp                                           |  384 
 Lib/CHThreadPool/include/TimerThreadPool.h                                              |   27 
 Lib/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp                               |  111 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp                             | 3431 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h                     | 1169 
 Common_Class/Mvsol/include/xxEnc852Serial.h                                             |  223 
 Common_Class/EdgeInspect/Header/SplineInspect.h                                         |  251 
 Common_Class/CHThreadPool/Header/PriorityThread.h                                       |   41 
 Common_Class/Matrox/dll/mildig.dll                                                      |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp                          |   48 
 Lib/SISControls/include/CellCtrl.h                                                      |  304 
 Lib/Matrox/dll/MilClarityUHDUI.dll                                                      |    0 
 Common_Class/CHThreadPool/CHThreadPool.sln                                              |   26 
 Common_Class/SISAssem/ConvZoneVertMS.asm                                                | 1181 
 Lib/Matrox/dll/MilGPUd3d10.dll                                                          |    0 
 Common_Class/BlGrabber/BlGrabber.rc                                                     |    0 
 Common_Class/BlVisionPro/stdafx.h                                                       |   41 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp                 |  212 
 Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.h                       |   68 
 Common_Class/ConfigFileManager/ConfigFileManager.vcxproj.filters                        |  101 
 Common_Class/LogView/res/LogView.rc2                                                    |   13 
 Common_Class/BlVisionPro/Vision/SoftVisionApp.h                                         |  107 
 Common_Class/CHThreadPool/PriorityThread.cpp                                            |   43 
 Common_Class/Matrox/dll/Liberatus.dll                                                   |    0 
 ENRUTResources_zh-CN/res/bmp00011.bmp                                                   |    0 
 BlVisionPro/res/BlVisionPro.rc2                                                         |    0 
 ENRIT/View/ImgListView.cpp                                                              |  632 
 Lib/SISControls/include/SISButton.h                                                     |   82 
 ENRIT/UITool/StopWatch.cpp                                                              |   45 
 Common_Class/SISBuffer/SISMath_unuse.cpp                                                |   23 
 ENRIT/IncludeSDK.h                                                                      |  215 
 Common_Class/ConfigFileManager/Header/FileIOInterface.h                                 |   16 
 Common_Class/CHThreadPool/Header/WaitThreadPool.h                                       |   25 
 Lib/SharedMapDll/include/LogManager.h                                                   |   68 
 Common_Class/ConfigFileManager/FileList.cpp                                             |  716 
 Common_Class/SISAssem/targetver.h                                                       |   26 
 Common_Class/CHImageBuffer/CHImageBuffer.def                                            |    6 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp                       |  302 
 Common_Class/VisionLib/SISControls/GridControl/GridCellButton.h                         |   28 
 ENRIT/Data/ResultFile.cpp                                                               | 1265 
 Common_Class/BlGrabber/BlGrabber.cpp                                                    |   63 
 Common_Class/BlVisionPro/Vision/CutDotProcess.h                                         |   64 
 Common_Class/BlVisionPro/View/CutSetDlg.h                                               |   55 
 Common_Class/SISControls/res/SISControls.rc2                                            |   13 
 Common_Class/Matrox/dll/MILPerf.dll                                                     |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp                                |   48 
 BlVisionPro/Vision/HoleProcess.cpp                                                      |   82 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h                        |  492 
 Common_Class/VisionLib/BaseDisplaySDK/include/IClsShape.h                               |   40 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp                    |   86 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp                  |   48 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/cvconfig.h                               |  196 
 Lib/Matrox/dll/milpcie.dll                                                              |    0 
 Common_Class/BlVisionPro/Vision/CutProcess.cpp                                          |   97 
 ENRIT/MainFrm.h                                                                         |   82 
 Lib/Matrox/dll/MilAux.dll                                                               |    0 
 ENRIT/UITool/Splash.cpp                                                                 |  357 
 Common_Class/SISControls/Header/WKButton.h                                              |  119 
 ENRIT/UITool/SlimScrollView.cpp                                                         |  937 
 Common_Class/BlVisionPro/stdafx.cpp                                                     |    7 
 Lib/Matrox/dll/MilGPUd3d9.dll                                                           |    0 
 Lib/OpenCV/opencv_3.1/lib/opencv_highgui310d.lib                                        |    0 
 Common_Class/CHImageBuffer/stdafx.h                                                     |   39 
 Common_Class/CHThreadPool/CHThreadPool.vcxproj.filters                                  |   92 
 Common_Class/EdgeInspect/BLOB_Tool.cpp                                                  |  103 
 Common_Class/SISControls/Header/InPlaceEdit.h                                           |   59 
 ENRUTResources_zh-CN/res/bmp00025.bmp                                                   |    0 
 ENRUTResources_zh-CN/res/icon/icon_sav.ico                                              |    0 
 Common_Class/BlVisionPro/Vision/NccDotProcess.h                                         |   58 
 ENRIT/View/ViewScanImage.cpp                                                            | 1404 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp                            | 1407 
 Common_Class/SISAssem/res/SISAssem.rc2                                                  |   13 
 BlVisionPro/stdafx.cpp                                                                  |    7 
 Lib/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h                               |  425 
 Common_Class/SISBuffer/SISBuffer.cpp                                                    |   86 
 ENRIT/View/GlassMap.h                                                                   |  160 
 Lib/SISControls/include/InPlaceEdit.h                                                   |   59 
 Lib/Matrox/dll/MILIrisGTRFocusDelay.dll                                                 |    0 
 Common_Class/EuresysCam/Include/MCpp_BoardListImpl.h                                    |  145 
 ENRIT/View/ViewDefect.cpp                                                               |  583 
 Common_Class/SharedMapDll/stdafx.cpp                                                    |    7 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv.hpp                               |   58 
 ENRIT/Data/Transfer_Data.cpp                                                            |   84 
 ENRUTResources_zh-CN/res/icon/icon_cha.ico                                              |    0 
 BlVisionPro/res/navigate_down.ico                                                       |    0 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib                              |    0 
 Common_Class/Matrox/dll/Milim.dll                                                       |    0 
 ENRIT/res/radio_of32.bmp                                                                |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h                    |  318 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp                       |  299 
 Lib/Matrox/Include/Mil.h                                                                | 11819 +
 Lib/Matrox/Include/MilDSFCaptureGUID.h                                                  |   44 
 Common_Class/BlVisionPro/Vision/HoleDotProcess.cpp                                      |  494 
 Common_Class/LogView/InsertPathDlg.cpp                                                  |   86 
 Common_Class/SISAssem/ConvZoneVTD_ExThAIAu.asm                                          | 1202 
 Common_Class/VisionLib/ApiVisionSDK/include/ClsVision.h                                 |  419 
 Lib/Matrox/Include/Milerr.h                                                             | 2784 
 Common_Class/BlVisionPro/res/navigate_down.ico                                          |    0 
 Common_Class/SISAssem/stdafx.h                                                          |   39 
 BlVisionPro/Vision/ThresDotProcess.h                                                    |   65 
 ENRIT/res/ICON/gear_stop.ico                                                            |    0 
 Common_Class/BlVisionPro/View/GrindSetDlg.h                                             |   54 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/video/video.hpp                          |   48 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp         |  140 
 Lib/EuresysCam/Include/MCpp_globalImpl.h                                                |  136 
 ENRIT/res/ICON/replace248.ico                                                           |    0 
 Lib/BlGrabber/include/GrabberControl.h                                                  |   79 
 ENRIT/res/writesmall.bmp                                                                |    0 
 ENRIT/Data/Transfer_Data.h                                                              |   38 
 ENRIT/Grabber/MulticamControl.cpp                                                       |  656 
 ENRIT/res/BmpWarning.bmp                                                                |    0 
 Lib/SISAssem/include/ASGInspection.h                                                    |   43 
 Common_Class/SISBuffer/FrameSave.cpp                                                    |   63 
 Lib/Matrox/lib/milcom.lib                                                               |    0 
 Lib/EuresysCam/Include/McParamsCompat1x.h                                               |   14 
 Lib/Matrox/dll/MilOrionHd.dll                                                           |    0 
 Common_Class/PLCConnector/PLCConnectorDoc.cpp                                           |   79 
 Common_Class/SISAssem/Header/SISStrg.h                                                  |  163 
 Common_Class/Matrox/dll/MilGPUd3d10.dll                                                 |    0 
 Lib/Matrox/dll/Liberatus.dll                                                            |    0 
 ENRIT/Thread/PriorityThread.h                                                           |   39 
 ENRIT/res/bmp00003.bmp                                                                  |    0 
 Common_Class/VisionLib/SISControls/include/StaticMap.h                                  |  149 
 ENRIT/UITool/Singleton.h                                                                |  110 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp                                 |   80 
 Lib/Matrox/Include/MILDyn/mil3dgeo.h                                                    |  740 
 Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.cpp                      |  260 
 Lib/EuresysCam/Include/containers.h                                                     |  173 
 Common_Class/SISAssem/stdafx.cpp                                                        |    7 
 Lib/BlVisionPro/include/BlSideData.h                                                    |   91 
 Common_Class/ConfigFileManager/Header/FileVersionManager.h                              |   20 
 Lib/OpenCV/opencv_3.1/include/opencv2/shape.hpp                                         |   57 
 ENRIT/Thread/Thread_ViewRefresh.cpp                                                     |   96 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_features2d310.lib                             |    0 
 ENRIT/res/ICON/check1.ico                                                               |    0 
 ENRIT/res/btn_load.bmp                                                                  |    0 
 Lib/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp                                        |   48 
 ENRIT/res/ICON/view.ico                                                                 |    0 
 Common_Class/BlVisionPro/View/ScanSetDlg.h                                              |   55 
 Common_Class/SISControls/Header/SISListBoxLog.h                                         |   96 
 ENRIT/ENRITDoc.cpp                                                                      |  137 
 ENRUTResources_zh-CN/res/list_cel.bmp                                                   |    0 
 Common_Class/BlVisionPro/View/VisionSetDlg.h                                            |   94 
 BlVisionPro/View/OpRoiDlg.cpp                                                           |  142 
 ENRIT/View/ViewUserDefectArea.cpp                                                       |  437 
 Common_Class/Matrox/lib/Mil3d.lib                                                       |    0 
 ENRIT/Light/ExternLightControlAKPNV.cpp                                                 |  137 
 Common_Class/BlVisionPro/Vision/SoftVisionApp.cpp                                       |  794 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp              |  299 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp                              | 1195 
 BlVisionPro/View/CutSetDlg.cpp                                                          |  387 
 Common_Class/ConfigFileManager/Header/FileList.h                                        |  140 
 ENRIT.sln                                                                               |  266 
 Common_Class/PLCConnector/ReadMe.txt                                                    |  114 
 Common_Class/SISControls/DefectMap.cpp                                                  |  354 
 Common_Class/SISAssem/ConvVert2-DoubleCmp.asm                                           |  611 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann.hpp                                         |  561 
 BlVisionPro/View/GrindSetDlg.h                                                          |   54 
 Lib/OpenCV/opencv_3.1/lib/opencv_shape310.lib                                           |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h                       |  232 
 ENRIT/ReadMe.txt                                                                        |   89 
 Common_Class/SISControls/GridControl/TitleTip.h                                         |   87 
 Common_Class/SISAssem/ASGInspection.cpp                                                 |  278 
 ENRUTResources_zh-CN/res/bmp00015.bmp                                                   |    0 
 Lib/EuresysCam/Include/MultiCamCppInternal.h                                            |   38 
 Common_Class/Matrox/Include/Mil.h                                                       | 11819 +
 ENRUTResources_zh-CN/res/bmp00023.bmp                                                   |    0 
 SDK_AND_TEST/IncludeControl.h                                                           |   51 
 Common_Class/Matrox/dll/MilRadientCXPUI.dll                                             |    0 
 ENRUTResources_zh-CN/res/icon/icon_dow.ico                                              |    0 
 ENRIT/res/RecipeList_LinkArrow.bmp                                                      |    0 
 Lib/SISAssem/include/PixelStorage.h                                                     |   49 
 Lib/Matrox/Include/MilDSFSequence.h                                                     |  168 
 Common_Class/SharedMapDll/SharedMapDllD.def                                             |    7 
 Lib/Matrox/dll/milcacheinfo.dll                                                         |    0 
 BlVisionPro/res/navigate_right.ico                                                      |    0 
 SDK_AND_TEST/ReadMe.txt                                                                 |   71 
 ENRUTResources_zh-CN/resource.h                                                         | 1621 
 Common_Class/ConfigFileManager/FileIOInterface.cpp                                      |   12 
 Lib/Matrox/dll/Milsolios.dll                                                            |    0 
 Lib/Matrox/dll/milmp.dll                                                                |    0 
 .vs/ENRIT/v17/DocumentLayout.backup.json                                                |   88 
 BlVisionPro/BlVisionPro.def                                                             |    6 
 ENRUTResources_zh-CN/res/icon/ico00009.ico                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp                                     | 1407 
 Common_Class/SISBuffer/SISMatch.cpp                                                     |  446 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching.hpp                                     |  257 
 Lib/Matrox/Include/milvector.h                                                          | 2279 
 BlVisionPro/Vision/EiVisionType.h                                                       |  149 
 Common_Class/ExpireDay/ReadMe.txt                                                       |  100 
 Common_Class/SISBuffer/SISBuffer.vcxproj                                                |  416 
 ENRIT/res/ICON/view_previous.ico                                                        |    0 
 BlVisionPro/Vision/CutProcess.h                                                         |   27 
 Lib/Matrox/dll/MilConcordPoE.dll                                                        |    0 
 SDK_AND_TEST/SDK_AND_TEST.vcxproj.filters                                               |   66 
 Lib/OpenCV/opencv_3.1/lib/opencv_stitching310d.lib                                      |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp                               |   31 
 ENRIT/Light/ExternLightControlAKPNV.h                                                   |   23 
 Lib/EuresysCam/Include/MCpp_global.h                                                    |   65 
 ENRIT/View/DlgLogin.h                                                                   |   41 
 Common_Class/EuresysCam/Include/CCallbacks.h                                            |   46 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp              |   78 
 ENRUTResources_zh-CN/res/icon/icon_rig.ico                                              |    0 
 Common_Class/SISBuffer/Header/SISMatch.h                                                |   99 
 Common_Class/SISControls/SISListCtrlExt.cpp                                             |  874 
 ENRIT/res/main.bmp                                                                      |    0 
 Lib/ConfigFileManager/include/FileIOInterface.h                                         |   16 
 BlVisionPro/Vision/InChipDotProcess.cpp                                                 |  157 
 Common_Class/Matrox/dll/MilRadientevclUI.dll                                            |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp         |   91 
 Common_Class/BlVisionPro/Vision/VisionRecipe.h                                          |  234 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h                        |  176 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp                |   48 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp                |   72 
 ENRUTResources_zh-CN/res/bitmap_w.bmp                                                   |    0 
 Common_Class/SISBuffer/SISPitch.cpp                                                     |   84 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp                                  |  184 
 Common_Class/BlVisionPro/BlVisionPro.rc                                                 |    0 
 ENRIT/View/ImgListView.h                                                                |  126 
 Lib/EuresysCam/Include/MultiCamCppExternal.h                                            |   30 
 Lib/Matrox/dll/milcom.dll                                                               |    0 
 Common_Class/Matrox/dll/MilNetwork.dll                                                  |    0 
 ENRIT/res/filesmall.bmp                                                                 |    0 
 Common_Class/SISAssem/ConvPixelVertSBW_BOE.asm                                          | 1118 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp                      |  530 
 Common_Class/PLCConnector/res/Toolbar256.bmp                                            |    0 
 ENRIT/View/DlgLicenseInfo.h                                                             |   24 
 Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.h              |   15 
 Common_Class/Matrox/dll/mil.dll                                                         |    0 
 Common_Class/Matrox/Include/MILDyn/mildisplay.h                                         | 2036 
 Common_Class/Matrox/Include/MilDSFSequenceGUID.h                                        |   33 
 Lib/SISControls/include/StaticMap.h                                                     |  149 
 ENRIT/UITool/textdescriptor.cpp                                                         |  279 
 ENRUTResources_zh-CN/res/bmp00006.bmp                                                   |    0 
 Common_Class/SISAssem/ConvPixelVertSBW.asm                                              | 1114 
 ENRUTResources_zh-CN/res/btn_save.bmp                                                   |    0 
 Lib/OpenCV/opencv_3.1/lib/opencv_photo310.lib                                           |    0 
 Common_Class/LogView/res/LogViewDoc.ico                                                 |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core.hpp                            |   48 
 Common_Class/Mvsol/lib/mvenc852v3.lib                                                   |    0 
 Lib/ConfigFileManager/include/FileVersionManager.h                                      |   20 
 Lib/Matrox/dll/mildig.dll                                                               |    0 
 Common_Class/BlVisionPro/View/KeyVisionSetDlg.h                                         |   61 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h                      |  425 
 Common_Class/CHThreadPool/stdafx.cpp                                                    |    7 
 Lib/EdgeInspect/include/BLOB_Tool.h                                                     |   82 
 ENRIT/res/bitmap1.bmp                                                                   |    0 
 ENRIT/View/ViewHWSetting.h                                                              |   69 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h                                     |   16 
 Lib/Matrox/lib/Milim.lib                                                                |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h                              |  621 
 Common_Class/SISControls/PropertyGridControl/PropertyGrid.cpp                           | 2349 
 ENRIT/Data/TransDataManager.h                                                           |  142 
 BlVisionPro/Vision/TranformCoordinate.h                                                 |   62 
 Lib/SISControls/include/SISListBoxLog.h                                                 |   96 
 Common_Class/VisionLib/BaseDisplaySDK/include/IImageDisplay.h                           |   91 
 Lib/SISControls/include/LogCtrl.h                                                       |  213 
 ENRUTResources_zh-CN/res/icon/icon_up.ico                                               |    0 
 Common_Class/CHImageBuffer/stdafx.cpp                                                   |    7 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h                      |  155 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/dist.h                                      |  905 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab.hpp                            |   81 
 Common_Class/SISControls/InPlaceComboBox.cpp                                            |   70 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h                     |  132 
 Common_Class/VisionLib/SISControls/include/GradientStatic.h                             |  149 
 Lib/Matrox/dll/MilDisplay.dll                                                           |    0 
 Lib/EuresysCam/Include/MultiCam_DataTypes.h                                             |   45 
 Lib/SISAssem/include/AssemDefect.h                                                      |  467 
 Common_Class/ConfigFileManager/Config.cpp                                               |  281 
 ENRIT/res/Save1_Push.bmp                                                                |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp                       |  267 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp                      |  135 
 ENRIT/res/ICON/delete2.ico                                                              |    0 
 Lib/Matrox/dll/MilGigEVision.dll                                                        |    0 
 ENRIT/Thread/Thread_ControlIF.cpp                                                       |   38 
 Common_Class/VisionLib/SISControls/include/WKButton.h                                   |  119 
 ENRUTResources_zh-CN/res/icon/icon_chk.ico                                              |    0 
 Lib/EuresysCam/Lib/amd64/MultiCam.def                                                   |   35 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp                                       | 4330 
 ENRUTResources_zh-CN/framework.h                                                        |   35 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_ml310.lib                                     |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp                         |   48 
 Common_Class/ConfigFileManager/ConfigFileManager.vcxproj                                |  382 
 Lib/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp                                     |  468 
 Lib/Matrox/dll/libmfxsw64.dll                                                           |    0 
 Common_Class/Mvsol/include/Mvsencenum.h                                                 |  104 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/defines.h                          |  177 
 Common_Class/BlVisionPro/Vision/Bspline.h                                               |   35 
 ENRIT/res/ICON/navigate_right.ico                                                       |    0 
 Common_Class/BlVisionPro/View/MeasureSetDlg.cpp                                         |  269 
 Common_Class/SISAssem/ConvZoneVTD.asm                                                   | 1224 
 Common_Class/Matrox/dll/MILIrisGTRFocusDelay.dll                                        |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv/highgui.h                                 |   48 
 ENRUTResources_zh-CN/res/icon/ico00007.ico                                              |    0 
 Common_Class/SISControls/Header/DefectMap.h                                             |  125 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_flann310.lib                                  |    0 
 Common_Class/VisionLib/SISControls/include/HeadCtrl.h                                   |  104 
 ENRUTResources_zh-CN/res/bmp00013.bmp                                                   |    0 
 Common_Class/SISControls/Header/SortClass.h                                             |   40 
 ENRIT/Define/InspectionBase.cpp                                                         |  135 
 Lib/OpenCV/opencv_3.1/lib/opencv_core310.lib                                            |    0 
 Lib/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h                               |   58 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_stitching310.lib                              |    0 
 Lib/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib                                       |    0 
 Common_Class/EdgeInspect/Header/ChamferInspect.h                                        |  310 
 BlVisionPro/Vision/InChipDotProcess.h                                                   |   38 
 Common_Class/BlVisionPro/View/HoleSetDlg.h                                              |   64 
 Lib/Matrox/dll/milhttpserver.dll                                                        |    0 
 BlVisionPro/View/HoleSetDlg.h                                                           |   64 
 Common_Class/VisionLib/ApiVisionSDK/include/VisionLib.h                                 |   16 
 SDK_AND_TEST/stdafx.h                                                                   |    0 
 Lib/MegaLock/lib/l_mega64.lib                                                           |    0 
 Common_Class/EuresysCam/Include/MCpp_Channel.h                                          |   56 
 Common_Class/Matrox/dll/MilDSFCommon.dll                                                |    0 
 Common_Class/Matrox/dll/milshm.dll                                                      |    0 
 Common_Class/Matrox/Include/Milos.h                                                     | 1423 
 Common_Class/BlGrabber/BlGrabber.vcxproj.filters                                        |   67 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio.hpp                              |  680 
 Lib/OpenCV/opencv_3.1/lib/opencv_video310d.lib                                          |    0 
 Common_Class/SISControls/SISControls.sln                                                |   26 
 ENRIT/View/ViewRecipeSetting.cpp                                                        | 1734 
 Lib/JsoncppSDK/include/json.h                                                           |   15 
 Lib/Matrox/dll/MilGenTLUI.dll                                                           |    0 
 Common_Class/SISControls/Header/StaticMap.h                                             |  149 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp                              | 4330 
 ENRIT/Data/ResultData.h                                                                 |  108 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/types.hpp                                    | 2228 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h                           |  194 
 Lib/SISControls/GridControl/TitleTip.h                                                  |   87 
 ENRUTResources_zh-CN/res/bmp00021.bmp                                                   |    0 
 ENRIT/View/ViewRecipeList.cpp                                                           |  696 
 Lib/SISBuffer/include/NoiseLevel.h                                                      |  148 
 Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.cpp            |   81 
 Common_Class/LogView/LogViewDoc.cpp                                                     |   78 
 ENRIT/Data/History.h                                                                    |   68 
 Common_Class/Matrox/dll/MilSoliosUI.dll                                                 |    0 
 Common_Class/Matrox/dll/mil3d.dll                                                       |    0 
 Common_Class/SISAssem/StopWatch3.cpp                                                    |   43 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h                              |   69 
 Common_Class/SISAssem/SISAssem.vcxproj.filters                                          |  304 
 BlVisionPro/Vision/HoleDotProcess.h                                                     |   71 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.h                                  |   52 
 ENRIT/Thread/Thread_CheckSeq.cpp                                                        |  144 
 ENRIT/res/ICON/view_next.ico                                                            |    0 
 Lib/SISControls/include/SISJogButton.h                                                  |   63 
 Common_Class/SISAssem/ConvZoneDPC.asm                                                   | 1093 
 ENRUTResources_zh-CN/res/bmp00008.bmp                                                   |    0 
 Lib/EuresysCam/Include/McDef.h                                                          |   72 
 Common_Class/VisionLib/SISControls/include/SISListCtrlExt.h                             |  137 
 ENRIT/res/stop.bmp                                                                      |    0 
 Common_Class/SISBuffer/MatchImpl_unuse.cpp                                              |  129 
 ENRIT/Define/StatusMonitor.h                                                            |   42 
 ENRIT/View/ViewRecipeSetting.h                                                          |  157 
 Common_Class/EuresysCam/Include/McParams.h                                              | 20872 ++
 Common_Class/BlVisionPro/View/HoleSetDlg.cpp                                            |  483 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp            |   86 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp         |  774 
 ENRIT/License/LicenseChecker.h                                                          |   23 
 Lib/EdgeInspect/include/RANSAC_LineFittingAlgorithm.h                                   |   20 
 Common_Class/SISControls/Resource.h                                                     |   16 
 ENRIT/res/stop_hot.bmp                                                                  |    0 
 Common_Class/ConfigFileManager/ReadMe.txt                                               |   57 
 ENRIT/res/radio_of.bmp                                                                  |    0 
 Common_Class/SISAssem/ConvFloatVert.asm                                                 |  885 
 Common_Class/SISAssem/PixelStorage.cpp                                                  |   92 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h                   |   91 
 Common_Class/PLCConnector/acteasyif1.h                                                  |  247 
 Common_Class/Matrox/dll/MilClarityUHD.dll                                               |    0 
 Common_Class/VisionLib/SISControls/include/SISButton.h                                  |   82 
 Common_Class/BlVisionPro/View/LocSetDlg.h                                               |   73 
 Lib/MegaLock/lib/l_mega64__.lib                                                         |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/superres.hpp                             |  207 
 Common_Class/VisionLib/BlGrabber/include/FrameBufferController.h                        |  125 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp                          |  522 
 ENRIT/View/ImgDefect.cpp                                                                |  463 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h                        |  626 
 ENRIT/res/play.bmp                                                                      |    0 
 SDK_AND_TEST/SDK_AND_TEST.cpp                                                           |    0 
 Common_Class/SISControls/GridControl/GridCellBase.cpp                                   |  773 
 Lib/Matrox/Include/MilDSFSequenceGUID.h                                                 |   33 
 Common_Class/CHThreadPool/TimerThreadPool.cpp                                           |   79 
 Lib/OpenCV/opencv_3.1/lib/opencv_ts310.lib                                              |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp                     |  290 
 Lib/EuresysCam/Include/MCpp_Board.h                                                     |   35 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp                      |   48 
 Lib/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h                           |  142 
 Common_Class/EuresysCam/Lib/amd64/MultiCam.def                                          |   35 
 BlVisionPro/Vision/TranformCoordinate.cpp                                               |  352 
 Common_Class/EuresysCam/Include/MCpp_SignalInfoImpl.h                                   |   18 
 SDK_AND_TEST/stdafx.cpp                                                                 |    0 
 Lib/Matrox/lib/milwebclient.lib                                                         |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d.hpp                           | 1325 
 Common_Class/CHImageBuffer/ImageTracker.h                                               |   27 
 Common_Class/SISAssem/ConvZone.asm                                                      | 1067 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp                      |  586 
 Common_Class/ConfigFileManager/stdafx.h                                                 |   39 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h                                  |  177 
 BlVisionPro/Vision/HoleDotProcess.cpp                                                   |  494 
 Lib/OpenCV/opencv_3.1/include/opencv/cv.hpp                                             |   60 
 Lib/Matrox/Include/Milsetup.h                                                           |  303 
 BlVisionPro/Vision/LocProcess.cpp                                                       |  366 
 Common_Class/Matrox/Include/MilFunc.h                                                   |  455 
 Common_Class/BlVisionPro/Vision/TranformCoordinate.cpp                                  |  352 
 Lib/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp                               |   48 
 Common_Class/SISAssem/ConvFloatVTD_DPCAIAu.asm                                          |  830 
 Common_Class/EuresysCam/Include/McParamsCompat1x.h                                      |   14 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/version.hpp                         |   71 
 Lib/Matrox/dll/MilRadientCXPUI.dll                                                      |    0 
 BlVisionPro/Vision/Bspline.cpp                                                          |  132 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h                       |  543 
 Common_Class/SISControls/SISJogButton.cpp                                               |   60 
 Lib/EdgeInspect/include/EDGE_DIPM.h                                                     |  437 
 BlVisionPro/BlVisionPro.rc                                                              |    0 
 BlVisionPro/Vision/ThresDotProcess.cpp                                                  |  444 
 Lib/Matrox/dll/MilIrisGTRUI.dll                                                         |    0 
 Common_Class/Matrox/dll/milpcie.dll                                                     |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h                     |   94 
 SDK_AND_TEST/SDK_AND_TESTDlg.h                                                          |    0 
 Common_Class/BlGrabber/BlGrabber.h                                                      |   27 
 Common_Class/SharedMapDll/Resource.h                                                    |   16 
 ENRUTResources_zh-CN/res/bmp00019.bmp                                                   |    0 
 ENRIT/res/ICON/OK.ICO                                                                   |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann.hpp                                |  561 
 Lib/Matrox/Include/mbasictypes.h                                                        |   35 
 Common_Class/PLCConnector/targetver.h                                                   |    8 
 Lib/OpenCV/opencv_3.1/lib/opencv_ts310d.lib                                             |    0 
 ENRIT/UITool/cellsmanager.cpp                                                           |  498 
 ENRIT/ENRIT.cpp                                                                         |  311 
 Common_Class/LogView/PathSettingDlg.cpp                                                 |  155 
 Common_Class/SISAssem/ConvZoneVert2S_BOE.asm                                            | 1136 
 ENRUTResources_zh-CN/res/splash.bmp                                                     |    0 
 Lib/OpenCV/opencv_3.1/lib/opencv_superres310.lib                                        |    0 
 Common_Class/Matrox/dll/MilGenTL.dll                                                    |    0 
 Lib/EuresysCam/Dll/MultiCam.dll                                                         |    0 
 Common_Class/LogView/LogViewOption.cpp                                                  |   44 
 Common_Class/EdgeInspect/Header/EdgeFind.h                                              |  211 
 ENRIT/UITool/btnenh.h                                                                   |  526 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp                          |   48 
 Lib/ApiVisionSDK/include/VisionLib.h                                                    |   15 
 Common_Class/SISControls/GridControl/GridCell.h                                         |  143 
 Common_Class/Matrox/Include/MILDyn/mil3ddisp.h                                          |  524 
 Lib/BlGrabber/include/FrameBufferController.h                                           |  125 
 Lib/Matrox/Include/milweb.h                                                             |  735 
 Common_Class/Matrox/dll/Milusb3visionUI.dll                                             |    0 
 Common_Class/Matrox/Include/MilFunctionCode.h                                           |  737 
 Common_Class/Matrox/dll/MilRadientPro.dll                                               |    0 
 ENRIT/res/Defect Image.bmp                                                              |    0 
 Lib/Matrox/dll/McomController.dll                                                       |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp                                  |  218 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_core310.lib                                   |    0 
 Common_Class/SISBuffer/ReadMe.txt                                                       |   63 
 Common_Class/Matrox/dll/milhttpserver.dll                                               |    0 
 Common_Class/Matrox/Include/MILDyn/milim.h                                              | 3389 
 Common_Class/SharedMapDll/LogManager.cpp                                                |  213 
 ENRIT/res/ICON/arrow_down_blue.ico                                                      |    0 
 Common_Class/BlVisionPro/Vision/VisionRecipe.cpp                                        | 1214 
 ENRUTResources_zh-CN/res/bmp00004.bmp                                                   |    0 
 BlVisionPro/View/HoleSetDlg.cpp                                                         |  483 
 Common_Class/SISBuffer/Header/SISPitch.h                                                |  167 
 Lib/EuresysCam/Include/MCpp_BoardList.h                                                 |   53 
 Common_Class/EuresysCam/Lib/amd64/MultiCam.lib                                          |    0 
 Common_Class/SISAssem/ConvFloatDPC_BOE.asm                                              |  861 
 Common_Class/SISControls/Header/LogCtrl.h                                               |  213 
 Common_Class/EuresysCam/Include/MCpp_ExceptionImpl.h                                    |   41 
 Common_Class/Matrox/Include/MILDyn/PFNC.h                                               | 1183 
 BlVisionPro/Vision/CornerDistProcess.h                                                  |   74 
 Common_Class/Matrox/dll/MilRapixoCXPUI.dll                                              |    0 
 Common_Class/SISAssem/ConvFloatDPC6.asm                                                 |  842 
 Common_Class/Matrox/dll/MilDisplay.dll                                                  |    0 
 BlVisionPro/View/MeasureSetDlg.cpp                                                      |  269 
 Common_Class/SISAssem/dllmain.cpp                                                       |   51 
 ENRUTResources_zh-CN/res/ENRUTResources_zh-CN.rc2                                       |    0 
 ENRIT/Process/HoleInspector.cpp                                                         |  291 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp        |  285 
 Lib/OpenCV/opencv_3.1/include/opencv2/opencv.hpp                                        |   58 
 Common_Class/VisionLib/BlGrabber/include/GrabberControl.h                               |   79 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp                      |  320 
 Common_Class/BlVisionPro/Vision/EiVisionType.h                                          |  149 
 Common_Class/SISBuffer/StdAfx.cpp                                                       |    8 
 Common_Class/EuresysCam/Include/MCpp_ChannelImpl.h                                      |  139 
 Lib/Matrox/dll/MilNetwork.dll                                                           |    0 
 ENRUTResources_zh-CN/res/menu_bar.bmp                                                   |    0 
 Lib/JsoncppSDK/include/json_features.h                                                  |   62 
 Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.cpp             |  147 
 Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.cpp                |  194 
 Lib/OpenCV/opencv_3.1/include/opencv2/video/video.hpp                                   |   48 
 Common_Class/SISAssem/Header/PixelStorage.h                                             |   49 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp                 |  285 
 Lib/BlVisionPro/include/BlVisionLib.h                                                   |   19 
 Common_Class/BlVisionPro/Vision/CutDotProcess.cpp                                       |  354 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h             |  848 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h                          |  186 
 .vs/ENRIT/v17/DocumentLayout.json                                                       |   87 
 ENRIT/res/ICON/navigate_up.ico                                                          |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp                                   |  326 
 ENRUTResources_zh-CN/ENRUTResources_zh-CN.def                                           |    6 
 BlVisionPro/Vision/LocProcess.h                                                         |   61 
 ENRIT/res/ICON/check7.ico                                                               |    0 
 BlVisionPro/Vision/Bspline.h                                                            |   35 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp                           | 1738 
 Common_Class/BlVisionPro/BlVisionPro.vcxproj.filters                                    |  348 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp                  | 1738 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types_c.h                           | 1834 
 ENRUTResources_zh-CN/res/writesma.bmp                                                   |    0 
 Common_Class/BlVisionPro/View/ChipInspectDlg.h                                          |   52 
 Common_Class/BlVisionPro/Vision/ThresProcess.cpp                                        |  103 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dist.h                             |  905 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp                          |  864 
 BlVisionPro/res/navigate_left.ico                                                       |    0 
 ENRIT/res/play_hot.bmp                                                                  |    0 
 ENRUTResources_zh-CN/res/icon/icon_vie.ico                                              |    0 
 Common_Class/EdgeInspect/MosisProfiles.txt                                              |   41 
 BlVisionPro/Vision/VisionRecipe.h                                                       |  234 
 BlVisionPro/Header/ISoftVisionApp.h                                                     |  110 
 Lib/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h                               |  533 
 Common_Class/Matrox/dll/MilNetworkSlave.dll                                             |    0 
 Lib/Matrox/Include/MilFunctionCode.h                                                    |  737 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h                           |  116 
 Lib/CHThreadPool/include/ThreadPool.h                                                   |   42 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp                   |  165 
 Common_Class/BlVisionPro/BlVisionPro.h                                                  |   27 
 Lib/EuresysCam/Include/MCpp_Callback.h                                                  |   47 
 Common_Class/LogView/LogView.rc                                                         |  507 
 Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp                           |   48 
 ENRUTResources_zh-CN/res/bitmap_d.bmp                                                   |    0 
 Common_Class/CHImageBuffer/ImageTracker.cpp                                             |  316 
 Lib/ConfigFileManager/include/Config.h                                                  |   89 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp                                    |  302 
 Common_Class/SISControls/desktop.ini                                                    |    1 
 Common_Class/SISAssem/SISFloatIntrin.cpp                                                | 1463 
 Lib/OpenCV/opencv_3.1/lib/opencv_videoio310d.lib                                        |    0 
 Common_Class/LogView/Header/LogViewOption.h                                             |   30 
 ENRUTResources_zh-CN/res/propicon.bmp                                                   |    0 
 Common_Class/Mvsol/include/Mvsenc.h                                                     |  174 
 ENRUTResources_zh-CN/ENRUTResources_zh-CN.rc                                            |    0 
 Common_Class/SISAssem/Header/ASGInspection.h                                            |   43 
 Common_Class/EdgeInspect/Header/EDGE_DIPM.h                                             |  437 
 Common_Class/PLCConnector/stdafx.h                                                      |   66 
 Common_Class/BlGrabber/GrabberControl.cpp                                               |   12 
 Common_Class/LogView/res/Toolbar.bmp                                                    |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h                               | 1210 
 Common_Class/SharedMapDll/SharedMapDll.def                                              |    7 
 Common_Class/Matrox/Include/Mildec.h                                                    |   53 
 Common_Class/CHThreadPool/WorkThreadPool.cpp                                            |  112 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_video310.lib                                  |    0 
 Common_Class/BlGrabber/Header/FrameBufferController.h                                   |  125 
 运行环境/RCutProject.zip                                                                    |    0 
 BlVisionPro/View/LocSetDlg.cpp                                                          |  497 
 Lib/OpenCV/opencv_3.1/lib/opencv_flann310d.lib                                          |    0 
 Common_Class/EuresysCam/Include/MCpp_global.h                                           |   65 
 Common_Class/Matrox/dll/milfpga.dll                                                     |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp                                   |  522 
 Lib/SISControls/include/SISJogBtn2Parent.h                                              |   12 
 Common_Class/SISBuffer/SISBuffer.sln                                                    |   26 
 Common_Class/PLCConnector/SetOptionDlg.cpp                                              |  221 
 Common_Class/VisionLib/SISControls/include/XTabCtrl.h                                   |   90 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp                     | 1195 
 Lib/Matrox/Include/MilDSFCapture.h                                                      |  618 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp             |  586 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/params.h                                    |   99 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp                           | 1599 
 Common_Class/SISBuffer/FileBuffer.cpp                                                   |  114 
 ENRIT/res/ICON/ico00003.ico                                                             |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp                         |  365 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib                                |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp                                |  267 
 Common_Class/PLCConnector/PLCConnector.cpp                                              |  198 
 Common_Class/EuresysCam/Include/MCpp_BoardImpl.h                                        |   33 
 Common_Class/BlVisionPro/Vision/KeyDistDotProcess.cpp                                   |  596 
 Common_Class/CHImageBuffer/Header/ImageViewer.h                                         |  219 
 Common_Class/PLCConnector/res/PLCConnector.ico                                          |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/video.hpp                                |   63 
 Common_Class/SISAssem/AssemParam.cpp                                                    |    3 
 Common_Class/EuresysCam/Include/ESFilter.h                                              |  225 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp          |  101 
 Common_Class/VisionLib/SISControls/include/SISListBoxLog.h                              |   96 
 Common_Class/BlVisionPro/View/ThresSetDlg.h                                             |   59 
 Common_Class/SISAssem/ConvFloat9.asm                                                    |  819 
 Lib/Matrox/dll/MilDSFSequence.dll                                                       |    0 
 ENRUTResources_zh-CN/res/bmp00017.bmp                                                   |    0 
 ENRUTResources_zh-CN/res/icon/icon_add.ico                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h                                |  543 
 Common_Class/CHImageBuffer/CHImageBuffer.cpp                                            |    9 
 BlVisionPro/View/ChipInspectDlg.h                                                       |   52 
 Common_Class/PLCConnector/PLCConnector.vcxproj.filters                                  |   95 
 ENRIT/License/Worker_UpdateLicense.h                                                    |   64 
 Lib/JsoncppSDK/include/allocator.h                                                      |  100 
 Lib/EuresysCam/Lib/amd64/MultiCam.lib                                                   |    0 
 Common_Class/ExpireDay/ExpireDay.vcxproj.filters                                        |   59 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp                 |  864 
 ENRIT/UITool/surfacecolor.h                                                             |   42 
 Common_Class/CHImageBuffer/CHImageBufferD.def                                           |    6 
 ENRIT/Thread/Thread_Send.cpp                                                            |  175 
 Lib/OpenCV/opencv_3.1/lib/opencv_stitching310.lib                                       |    0 
 Common_Class/EdgeInspect/ChamferInspect.cpp                                             | 4132 
 Common_Class/VisionLib/SISControls/GridControl/GridCellBase.h                           |  172 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/base.hpp                                     |  689 
 Common_Class/Matrox/dll/MilOrionHd.dll                                                  |    0 
 Common_Class/LogView/res/LogViewer.ico                                                  |    0 
 Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.h                         |   55 
 Common_Class/EuresysCam/Include/MultiCamCppInternal.h                                   |   38 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h                  |  194 
 Common_Class/CHThreadPool/WorkThreadArray.cpp                                           |   33 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.h                                   |   57 
 ENRIT/Data/TransDataManager.cpp                                                         |  428 
 Common_Class/Matrox/lib/milcom.lib                                                      |    0 
 Lib/LogSDK/include/ILogger.h                                                            |   45 
 Lib/Matrox/dll/MilNetworkSlave.dll                                                      |    0 
 Lib/Matrox/dll/MilRapixoCXP.dll                                                         |    0 
 Common_Class/CHThreadPool/res/CHThreadPool.rc2                                          |    0 
 Lib/EuresysCam/Include/MCpp_SignalInfoImpl.h                                            |   18 
 Lib/EdgeInspect/include/EdgeProc.h                                                      |   75 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib                              |    0 
 Common_Class/SISAssem/ConvZone2.asm                                                     | 1081 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h                        |  392 
 ENRIT/res/bmpInfo.bmp                                                                   |    0 
 ENRIT/View/ViewRecipeNew.cpp                                                            |   97 
 Common_Class/BlGrabber/stdafx.h                                                         |   39 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp                                 |   77 
 Common_Class/Matrox/Include/MilDyn.h                                                    |   20 
 ENRIT/View/ViewException.cpp                                                            |  598 
 Common_Class/VisionLib/SISControls/include/SISLabel.h                                   |   77 
 ENRIT/View/ViewRecipeInspectionView.h                                                   |  132 
 Common_Class/OpenCV/opencv_3.1/include/opencv/ml.h                                      |   47 
 Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h                  |  142 
 Lib/Matrox/Include/milfuncll.h                                                          |   74 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp                               |  128 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp                       |  652 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp                         |  889 
 Common_Class/Matrox/dll/milwebserver.dll                                                |    0 
 .vs/ENRIT/FileContentIndex/2a67161d-eeaf-477b-9b1f-845d8fa24339.vsidx                   |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp                                   |   72 
 Common_Class/SISBuffer/Header/SISBuffer.h                                               |   14 
 ENRIT/Data/PostProcess.h                                                                |   73 
 Lib/Matrox/Include/MilFunc.h                                                            |  455 
 Common_Class/SISAssem/SISAssem.rc                                                       |  125 
 ENRIT/res/Load1_Nor.bmp                                                                 |    0 
 Common_Class/ExpireDay/res/ExpireDay.rc2                                                |    0 
 Common_Class/ExpireDay/stdafx.cpp                                                       |    8 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp                     |  275 
 Common_Class/BlVisionPro/Vision/RcutDotProcess.cpp                                      | 2118 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp                        |   80 
 Common_Class/SharedMapDll/SharedMapDll.vcxproj                                          |  276 
 ENRIT/res/image.bmp                                                                     |    0 
 Common_Class/SharedMapDll/SharedMapDll.vcproj                                           |  502 
 Common_Class/BlVisionPro/Vision/NccDotProcess.cpp                                       |  343 
 Common_Class/BlVisionPro/View/RcutSetDLg.cpp                                            | 1076 
 Common_Class/SISBuffer/MatchImpl.cpp                                                    | 1145 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp                                      |  743 
 Common_Class/SISAssem/ConvZoneDPC2.asm                                                  | 1098 
 Lib/OpenCV/opencv_3.1/include/opencv/cxmisc.h                                           |    8 
 Lib/Matrox/dll/milfpga.dll                                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv/cvaux.h                                            |   57 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp                       |   27 
 Lib/OpenCV/opencv_3.1/include/opencv2/world.hpp                                         |   58 
 Common_Class/SISAssem/ConvZoneVTDS.asm                                                  | 1231 
 Common_Class/PLCConnector/resource.h                                                    |   76 
 ENRIT/Data/Glass_Data.cpp                                                               |  358 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp                                  | 3668 
 Common_Class/EdgeInspect/Crystal.txt                                                    |    2 
 Lib/SISControls/include/HeadCtrl.h                                                      |  104 
 Common_Class/Matrox/dll/MilRadientevcl.dll                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/video.hpp                                         |   63 
 ENRIT/res/ICON/navigate_left.ico                                                        |    0 
 Common_Class/SISAssem/ConvZoneVert.asm                                                  | 1102 
 ENRIT/Light/ExternLightControlLCP.cpp                                                   |  138 
 Common_Class/BlVisionPro/Vision/GrindProcess.h                                          |   30 
 BlVisionPro/Vision/FileRecipe.cpp                                                       |  195 
 BlVisionPro/Vision/ThresProcess.cpp                                                     |  103 
 Lib/CHThreadPool/include/ThreadData.h                                                   |   20 
 Lib/Matrox/dll/MilConcordPoEUI.dll                                                      |    0 
 Common_Class/PLCConnector/PLCConnectorView.cpp                                          | 1358 
 Lib/ConfigFileManager/include/BasedConfig.h                                             |   67 
 ENRIT/Thread/Thread_Send.h                                                              |   79 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp                      |   48 
 Lib/Matrox/Include/miluniqueid.h                                                        |  554 
 Common_Class/BlVisionPro/Vision/BlSideData.cpp                                          |   71 
 ENRIT/res/ENRIT.ico                                                                     |    0 
 Common_Class/SISAssem/ConvPixelVTDSBW_BOE.asm                                           | 1174 
 Common_Class/BlVisionPro/Vision/LocProcess.h                                            |   61 
 Lib/SISAssem/include/SISStrg.h                                                          |  163 
 BlVisionPro/Vision/VisionRecipe.cpp                                                     | 1214 
 Common_Class/Matrox/dll/MilGPU.dll                                                      |    0 
 BlVisionPro/targetver.h                                                                 |    8 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp                               |   48 
 Common_Class/Matrox/dll/SoliosPFpga.dll                                                 |    0 
 Common_Class/SISAssem/20101008_ConvZone.asm                                             |  730 
 Common_Class/ConfigFileManager/ConfigFileManager.sln                                    |   26 
 Common_Class/Matrox/dll/MilGPUd3d11.dll                                                 |    0 
 Common_Class/SISControls/GridControl/GridDropTarget.cpp                                 |  156 
 Lib/JsoncppSDK/include/assertions.h                                                     |   61 
 Lib/SISControls/GridControl/NewCellTypes/GridCellCombo.h                                |  178 
 ENRIT/View/ViewMapSettings.cpp                                                          |  289 
 Common_Class/BlGrabber/res/BlGrabber.rc2                                                |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core_c.h                            | 3152 
 Common_Class/EdgeInspect/SISEdgeFind.cpp                                                |  762 
 Lib/EuresysCam/Include/MCpp_ExceptionImpl.h                                             |   41 
 ENRIT/Process/ThreadControl.cpp                                                         |  234 
 Common_Class/CHThreadPool/Header/ThreadData.h                                           |   20 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp                           |  280 
 SDK_AND_TEST/res/SDK_AND_TEST.ico                                                       |    0 
 Common_Class/EdgeInspect/NotchCut.cpp                                                   | 3196 
 Lib/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h                               |  252 
 Common_Class/SISAssem/SISAssem.def                                                      |    7 
 Common_Class/SharedMapDll/SharedMapDll.rc                                               |  125 
 ENRIT/Grabber/SapLineGrab.cpp                                                           |  713 
 Common_Class/SISControls/GridControl/TitleTip.cpp                                       |  341 
 Lib/JsoncppSDK/include/config.h                                                         |  150 
 BlVisionPro/View/ScanSetDlg.h                                                           |   55 
 BlVisionPro/View/LocSetDlg.h                                                            |   73 
 BlVisionPro/Vision/KeyDistDotProcess.cpp                                                |  596 
 Lib/Matrox/Include/Milproto.h                                                           | 9696 +
 Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib                                         |    0 
 Common_Class/EuresysCam/Include/MCpp_Configuration.h                                    |   61 
 Common_Class/SISControls/SISButton.cpp                                                  |  268 
 Common_Class/BlVisionPro/Vision/TranformCoordinate.h                                    |   62 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/shape.hpp                                |   57 
 ENRUTResources_zh-CN/res/icon/icon_arr.ico                                              |    0 
 BlVisionPro/Vision/GrindDotProcess.h                                                    |   72 
 ENRIT/res/ICON/navigate_down.ico                                                        |    0 
 ENRIT/res/ICON/CANCEL.ICO                                                               |    0 
 ENRIT/ENRITView.h                                                                       |   96 
 BlVisionPro/View/LockSetDlg.h                                                           |   34 
 Lib/SISControls/GridControl/CellRange.h                                                 |  156 
 Common_Class/SISBuffer/res/SISBuffer.rc2                                                |   13 
 Common_Class/EuresysCam/Include/MCpp_BoardList.h                                        |   53 
 ENRUTResources_zh-CN/res/icon/icon_pc.ico                                               |    0 
 Common_Class/Matrox/dll/MilGenTLUI.dll                                                  |    0 
 ENRUTResources_zh-CN/pch.h                                                              |   13 
 Common_Class/SISAssem/BinalizeInspection.cpp                                            |  129 
 Lib/Matrox/dll/MILPerf.dll                                                              |    0 
 Common_Class/EdgeInspect/SplineInspect.cpp                                              | 2734 
 Lib/BlVisionPro/include/IVisionRecipe.h                                                 |   67 
 ENRIT/Define/StatusMonitor.cpp                                                          |  246 
 Common_Class/BlVisionPro/View/ScanSetDlg.cpp                                            |  191 
 Common_Class/ConfigFileManager/ConfigFileManager.rc                                     |  125 
 ENRIT/PLC/Control_Interface.h                                                           |  187 
 Common_Class/LogView/LogView.cpp                                                        |  161 
 Lib/Matrox/dll/milnetworkserver.dll                                                     |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp                |  306 
 Common_Class/EdgeInspect/dllmain.cpp                                                    |   51 
 ENRIT/res/ICON/gear_run.ico                                                             |    0 
 Common_Class/BlVisionPro/resource.h                                                     |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/any.h                              |  323 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib                                |    0 
 Common_Class/BlVisionPro/Vision/Serializer.h                                            |   39 
 Common_Class/SISControls/Header/SISListCtrlExt.h                                        |  137 
 Common_Class/Mvsol/MVENC852v30_User Manual_V141.pdf                                     |    0 
 Lib/Matrox/dll/DigitizerController.dll                                                  |    0 
 Common_Class/EuresysCam/Include/MultiCam_DataTypes.h                                    |   45 
 Common_Class/BlVisionPro/Vision/GrindProcess.cpp                                        |  123 
 Common_Class/SISControls/StaticMap.cpp                                                  |  565 
 Lib/Matrox/dll/MilDirectX.dll                                                           |    0 
 Common_Class/SISBuffer/CrossCorr.cpp                                                    |  509 
 Common_Class/VisionLib/SISControls/GridControl/TitleTip.h                               |   87 
 Common_Class/LogView/stdafx.h                                                           |   58 
 Common_Class/VisionLib/SISControls/GridControl/CellRange.h                              |  156 
 ENRIT/res/SIS_Splash.bmp                                                                |    0 
 Lib/BlVisionPro/include/ISoftVisionApp.h                                                |  110 
 Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310d.lib                                        |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h                         |   81 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp            |  163 
 BlVisionPro/View/OpRoiDlg.h                                                             |   45 
 Common_Class/CHThreadPool/CHThreadPool.cpp                                              |   10 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp                                    | 1069 
 ENRUTResources_zh-CN/res/checkno3.bmp                                                   |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp                         |  184 
 Lib/EuresysCam/Lib/MultiCam.def                                                         |   35 
 Lib/Matrox/Include/MilDyn.h                                                             |   20 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp                                     |  267 
 Common_Class/SISControls/StdAfx.h                                                       |   43 
 ENRIT/UITool/texture.cpp                                                                |   75 
 Common_Class/ConfigFileManager/Resource.h                                               |   16 
 ENRIT/UITool/Server_MemDC.h                                                             |  104 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_ts310.lib                                     |    0 
 Common_Class/LogView/stdafx.cpp                                                         |    7 
 Common_Class/SISAssem/ConvFloatVert6.asm                                                |  936 
 Common_Class/BlVisionPro/Vision/Bspline.cpp                                             |  132 
 Lib/EuresysCam/Include/MCpp_CallbackImpl.h                                              |   15 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp                                   |  603 
 Common_Class/EdgeInspect/EdgeInspect.def                                                |    6 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_superres310.lib                               |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp                                     |  846 
 Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.h                  |   43 
 Common_Class/BlVisionPro/Vision/KDistProcess.cpp                                        |  112 
 Lib/Matrox/dll/mil.dll                                                                  |    0 
 ENRIT/UITool/StopWatch.h                                                                |   36 
 Lib/Matrox/Include/MILDyn/mil3ddisp.h                                                   |  524 
 Common_Class/BlVisionPro/Header/BlVisionLib.h                                           |   19 
 Lib/SISControls/GridControl/GridCtrl.h                                                  | 1088 
 Lib/Matrox/dll/milwebserver.dll                                                         |    0 
 ENRIT/UITool/DisplayMessage.cpp                                                         |  131 
 Common_Class/SISAssem/AssemPitch.asm                                                    |  318 
 Common_Class/ConfigFileManager/Header/BasedConfig.h                                     |   67 
 Common_Class/Matrox/lib/Milim.lib                                                       |    0 
 ENRUTResources_zh-CN/res/icon/ico00011.ico                                              |    0 
 ENRIT/Data/ResultFile.h                                                                 |   35 
 Common_Class/EdgeInspect/Resource.h                                                     |   16 
 Lib/Matrox/dll/MilRadientevcl.dll                                                       |    0 
 Common_Class/SISControls/SISControls.vcxproj.filters                                    |  293 
 Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp                                   |   48 
 ENRIT/res/ICON/save_as.ico                                                              |    0 
 Lib/Matrox/dll/MilRadientCXP.dll                                                        |    0 
 BlVisionPro/View/KDistSetDlg.h                                                          |   53 
 Common_Class/Matrox/dll/MilGrabc.dll                                                    |    0 
 Common_Class/BlVisionPro/View/GrindSetDlg.cpp                                           |  386 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/ml.hpp                                   | 1505 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types.hpp                           | 2228 
 Common_Class/SharedMapDll/res/SharedMapDll.rc2                                          |   13 
 ENRIT/View/ViewLampControl.cpp                                                          |  640 
 Lib/OpenCV/opencv_3.1/include/opencv/cxcore.hpp                                         |   53 
 Lib/OpenCV/opencv_3.1/lib/opencv_ml310.lib                                              |    0 
 Common_Class/SISBuffer/SISBufferD.def                                                   |    7 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h                                 |  626 
 Common_Class/SISControls/GridControl/GridCell.cpp                                       |  294 
 ENRIT/res/ICON/save1.ico                                                                |    0 
 Common_Class/ConfigFileManager/Registery.cpp                                            |  692 
 Common_Class/Matrox/lib/milfpga.lib                                                     |    0 
 Common_Class/Matrox/dll/MilCodec.dll                                                    |    0 
 BlVisionPro/Vision/RcutDotProcess.h                                                     |  147 
 Common_Class/Matrox/Include/milfpga.h                                                   |  518 
 Lib/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp                                |  515 
 Common_Class/SISAssem/StopWatch3.h                                                      |   28 
 Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib                                       |    0 
 Common_Class/SISAssem/Pad.cpp                                                           |  371 
 Common_Class/SharedMapDll/.gitignore                                                    |    7 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp         |  174 
 Common_Class/BlVisionPro/Vision/BlVisionLib.cpp                                         |   35 
 Common_Class/CHThreadPool/Header/ThreadPool.h                                           |   42 
 Common_Class/LogView/Header/MemoryManager.h                                             |   39 
 Common_Class/Matrox/dll/MilRapixoCXP.dll                                                |    0 
 ENRIT/res/ICON/icon3.ico                                                                |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h                            |   16 
 Lib/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp                                         |   48 
 Common_Class/EdgeInspect/EdgeInspect.vcxproj                                            |  315 
 Common_Class/BlVisionPro/View/KDistSetDlg.cpp                                           |  472 
 Common_Class/SISControls/GridControl/GridCellButton.h                                   |   28 
 Common_Class/Matrox/dll/MILQSVEngine.dll                                                |    0 
 ENRIT/UITool/surfacecolor.cpp                                                           |   75 
 Lib/Matrox/dll/mil3d.dll                                                                |    0 
 Lib/SISAssem/include/AssemUtil.h                                                        |   35 
 Common_Class/SISControls/Header/SISLabel.h                                              |   77 
 Lib/Matrox/dll/Milusb3visionUI.dll                                                      |    0 
 Common_Class/SISAssem/ConvZgSpVtSkB1.asm                                                | 1220 
 Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCombo.h             |  178 
 Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.h                    |   92 
 Common_Class/Matrox/dll/MilClarityUHDUI.dll                                             |    0 
 ENRUTResources_zh-CN/res/filesmal.bmp                                                   |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp           |   86 
 ENRIT/Thread/Thread_ControlIF.h                                                         |   24 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h                   |  159 
 ENRIT/View/ViewPPIDNew.h                                                                |   36 
 ENRIT/res/checkno.bmp                                                                   |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h                               |  155 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp                               |  320 
 Common_Class/BlVisionPro/View/OpRoiDlg.h                                                |   45 
 Common_Class/SISControls/Header/GradientStatic.h                                        |  149 
 Common_Class/SISControls/SISControlsD.def                                               |    7 
 Common_Class/Matrox/Include/MilDSFCaptureGUID.h                                         |   44 
 Common_Class/SISControls/XTabCtrl.cpp                                                   |  442 
 BlVisionPro/View/KeyVisionSetDlg.cpp                                                    |  355 
 ENRIT/View/ViewLiveCam.cpp                                                              |  379 
 Common_Class/BlVisionPro/View/RcutSetDLg.h                                              |   90 
 ENRIT/Light/ExternLightControl.cpp                                                      |   43 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h                                 |  392 
 Common_Class/Matrox/dll/MilRadient.dll                                                  |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/ml.hpp                                            | 1505 
 ENRIT/res/bmp00004.bmp                                                                  |    0 
 Common_Class/CHImageBuffer/Header/ImageBuffer.h                                         |  101 
 Lib/Matrox/dll/MilGenTL.dll                                                             |    0 
 Common_Class/CHThreadPool/CHThreadPool.rc                                               |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/defines.h                                   |  177 
 BlVisionPro/Vision/BlSideData.cpp                                                       |   71 
 Common_Class/SISControls/ReadMe.txt                                                     |   63 
 Common_Class/Matrox/dll/MilGigEVision.dll                                               |    0 
 BlVisionPro/Vision/FileRecipe.h                                                         |   53 
 ENRIT/Define/Global_Define.h                                                            |  841 
 Common_Class/BlVisionPro/Header/BlSideData.h                                            |   91 
 Lib/Matrox/dll/MilDSFCommon.dll                                                         |    0 
 Lib/Matrox/dll/MilClarityUHD.dll                                                        |    0 
 ENRIT/res/ICON/copy.ico                                                                 |    0 
 ENRUTResources_zh-CN/res/icon/ico00013.ico                                              |    0 
 Common_Class/EdgeInspect/EdgeInspect.rc                                                 |  125 
 ENRUTResources_zh-CN/res/filelarg.bmp                                                   |    0 
 Lib/ApiVisionSDK/include/ClsVision.h                                                    |  421 
 ENRIT/res/checkno32.bmp                                                                 |    0 
 Lib/SISControls/GridControl/GridCellButton.h                                            |   28 
 Common_Class/LogView/Header/LogViewDoc.h                                                |   40 
 Common_Class/EdgeInspect/EdgeInspect.vcxproj.filters                                    |  126 
 Common_Class/SISAssem/AssemPitch_BOE.asm                                                |  347 
 Lib/SISAssem/include/Pad.h                                                              |  145 
 Common_Class/SharedMapDll/stdafx.h                                                      |   39 
 Lib/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp                                   |   48 
 Common_Class/Matrox/dll/milusb3vision.dll                                               |    0 
 Lib/EuresysCam/Include/MCpp_Channel.h                                                   |   56 
 Common_Class/SISControls/PropertyGridControl/DynDialogEx.h                              |  151 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab.hpp                                     |   81 
 ENRIT/TriggerBoard/TriggerControl_Mvsol.cpp                                             |  323 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h                     |  621 
 ENRIT/resource.h                                                                        |    0 
 Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.h                 |   25 
 Common_Class/EuresysCam/Include/MCpp_CallbackImpl.h                                     |   15 
 Common_Class/PLCConnector/PLCConnector.h                                                |   41 
 Common_Class/SISAssem/ConvPixelVert.asm                                                 | 1321 
 Lib/Matrox/dll/MilSoliosUI.dll                                                          |    0 
 Common_Class/EuresysCam/Include/MCpp_Surface.h                                          |   33 
 Common_Class/BlVisionPro/Vision/DistDotProcess.h                                        |  105 
 Common_Class/VisionLib/BaseDisplaySDK/include/BaseVision.h                              |   90 
 Common_Class/SISAssem/ConvPixelEE.asm                                                   |  667 
 ENRIT/View/ViewRecipeChamferView.h                                                      |   50 
 Common_Class/VisionLib/SISControls/include/FontStatic.h                                 |   69 
 ENRUTResources_zh-CN/ENRUTResources_zh-CN.h                                             |   27 
 Common_Class/SISBuffer/SISBuffer.vcxproj.filters                                        |  126 
 Common_Class/BlVisionPro/Vision/CutProcess.h                                            |   27 
 Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.cpp                     |  186 
 Common_Class/VisionLib/SISControls/include/InPlaceEdit.h                                |   59 
 Lib/Matrox/dll/Milim.dll                                                                |    0 
 BlVisionPro/Vision/NccDotProcess.h                                                      |   58 
 Common_Class/BlVisionPro/View/CornerDistSetDlg.cpp                                      |  804 
 ENRIT/res/ICON/LedOff.ico                                                               |    0 
 Lib/EuresysCam/Include/MCpp_SignalInfo.h                                                |   30 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h                             |  231 
 Common_Class/Matrox/Include/Milproto.h                                                  | 9696 +
 ENRIT/res/ICON/icon5.ico                                                                |    0 
 ENRUTResources_zh-CN/res/bmp00026.bmp                                                   |    0 
 ENRIT/Process/HoleInspector.h                                                           |   23 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp               |   94 
 ENRUTResources_zh-CN/res/bmp00012.bmp                                                   |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/logger.h                                    |  130 
 Common_Class/SISControls/ColorButton.cpp                                                |  383 
 Lib/FreeImage/lib/FreeImage.lib                                                         |    0 
 ENRUTResources_zh-CN/res/bmp_info.bmp                                                   |    0 
 Common_Class/Matrox/Include/milweb.h                                                    |  735 
 Common_Class/SISControls/FontStatic.cpp                                                 |  197 
 Common_Class/SISControls/GradientStatic.cpp                                             |  341 
 Common_Class/Matrox/dll/MilDirectX.dll                                                  |    0 
 remove.bat                                                                              |   15 
 ENRIT/Process/InspectCamera.h                                                           |  257 
 ENRIT/License/LicenseChecker.cpp                                                        |   69 
 ENRIT/View/ViewSettingSpline.h                                                          |   94 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp                  | 1599 
 BlVisionPro/View/RcutSetDLg.cpp                                                         | 1076 
 Common_Class/EuresysCam/Include/MCpp_SurfaceImpl.h                                      |   77 
 ENRIT/Grabber/RadientControl.cpp                                                        |  634 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h                             |  318 
 Common_Class/BlVisionPro/Vision/CornerRcutProcess.h                                     |   34 
 Common_Class/SISAssem/ConvZoneMVert2S.asm                                               | 1245 
 Common_Class/SISBuffer/MatchBuffer.h                                                    |  162 
 BlVisionPro/Vision/GrindProcess.h                                                       |   30 
 Common_Class/SISAssem/SISAssem.cpp                                                      | 1988 
 Common_Class/Matrox/dll/milcacheinfo.dll                                                |    0 
 Common_Class/CHThreadPool/WaitThreadPool.cpp                                            |   67 
 Common_Class/EdgeInspect/Library/ImageHandlerM.lib                                      |    0 
 Common_Class/SISBuffer/SISBufferDll.cpp                                                 |   51 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/logger.h                           |  130 
 Common_Class/BlVisionPro/View/MeasureSetDlg.h                                           |   62 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core.hpp                                 | 3168 
 ENRIT/Grabber/MulticamControl.h                                                         |   92 
 ENRIT/View/ViewException.h                                                              |   79 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp                          |  729 
 Lib/SISControls/include/DefectMap.h                                                     |  125 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/config.h                                    |   38 
 Common_Class/SISAssem/ConvFloatVTD_BOE.asm                                              | 1057 
 Common_Class/BlGrabber/BlGrabber.vcxproj                                                |  229 
 ENRIT/Data/DefectStorage.cpp                                                            |  939 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp                         |  171 
 ENRUTResources_zh-CN/res/icon/icon_loa.ico                                              |    0 
 Common_Class/SISControls/PropertyGridControl/PropertyGrid.h                             |  314 
 Common_Class/VisionLib/SISControls/include/LogCtrl.h                                    |  213 
 Lib/OpenCV/opencv_3.1/lib/opencv_flann310.lib                                           |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp               |  150 
 SDK_AND_TEST/res/SDK_AND_TEST.rc2                                                       |    0 
 ENRUTResources_zh-CN/res/icon/icon_gea.ico                                              |    0 
 Common_Class/VisionLib/SISControls/GridControl/GridCell.h                               |  143 
 ENRIT/res/ICON/idisk.ico                                                                |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h                                      |  231 
 Lib/OpenCV/opencv_3.1/include/opencv2/videoio.hpp                                       |  680 
 Common_Class/EdgeInspect/Header/NotchCut.h                                              |  276 
 ENRIT/res/ICON/LedOn.ico                                                                |    0 
 Common_Class/EdgeInspect/Header/ProfileCADProc.h                                        |   68 
 Common_Class/SISControls/Header/HeadCtrl.h                                              |  104 
 ENRIT/View/ViewInsInformation.h                                                         |  140 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp                              |   64 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp                                      | 3431 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp                     |  131 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp                     |   86 
 Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.h                       |  178 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp                                 |  195 
 Common_Class/Matrox/dll/Milnetworkinfo.dll                                              |    0 
 ENRUTResources_zh-CN/res/icon/icon_lef.ico                                              |    0 
 Common_Class/Matrox/Include/mbasictypes.h                                               |   35 
 Common_Class/Matrox/dll/milmp.dll                                                       |    0 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_videoio310.lib                                |    0 
 ENRUTResources_zh-CN/res/icon/ico00015.ico                                              |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp                              | 2001 
 Common_Class/EdgeInspect/Library/FreeImage.lib                                          |    0 
 ENRIT/Recipe/HardwareSettings.h                                                         |  204 
 Lib/Matrox/dll/MilGPUd3d11.dll                                                          |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/heap.h                                      |  165 
 ENRIT/UITool/SlimScrollView.h                                                           |  195 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h                             |  515 
 ENRUTResources_zh-CN/ENRUTResources_zh-CN.vcxproj.filters                               |  291 
 Common_Class/SISControls/SortClass.cpp                                                  |  143 
 Common_Class/SISBuffer/SISBuffer.vcproj                                                 | 1121 
 BlVisionPro/View/CornerDistSetDlg.cpp                                                   |  804 
 Common_Class/BlVisionPro/Vision/FileRecipe.h                                            |   53 
 Common_Class/Matrox/Include/milvector.h                                                 | 2279 
 ENRIT/View/ViewDefect.h                                                                 |   74 
 Common_Class/BlVisionPro/Vision/CornerRcutProcess.cpp                                   |  103 
 ENRUTResources_zh-CN/res/icon/icon_ck_.ico                                              |    0 
 ENRIT/res/bmp00002.bmp                                                                  |    0 
 Common_Class/BlVisionPro/Header/ISoftVisionApp.h                                        |  110 
 Common_Class/ConfigFileManager/dllmain.cpp                                              |   51 
 Common_Class/SISAssem/Header/AssemParam.h                                               |  319 
 Common_Class/SharedMapDll/targetver.h                                                   |   26 
 ENRUTResources_zh-CN/targetver.h                                                        |    8 
 ENRIT/Data/InspectDefect.h                                                              |   92 
 ENRUTResources_zh-CN/res/icon/led_on.ico                                                |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h                           |  137 
 BlVisionPro/View/KeyVisionSetDlg.h                                                      |   61 
 Common_Class/BlVisionPro/View/CornerDistSetDlg.h                                        |  135 
 Common_Class/SISBuffer/Header/InspectionBuffer.h                                        |  498 
 Common_Class/Mvsol/lib/mvenc852v3x64.lib                                                |    0 
 ENRUTResources_zh-CN/res/bmp00010.bmp                                                   |    0 
 Lib/JsoncppSDK/include/forwards.h                                                       |   43 
 ENRIT/res/ICON/MYSL.ICO                                                                 |    0 
 Common_Class/BlVisionPro/Vision/DistDotProcess.cpp                                      |  569 
 Common_Class/EdgeInspect/Header/CornerCut.h                                             |   84 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp                        |   77 
 Common_Class/PLCConnector/MainFrm.cpp                                                   |  390 
 Common_Class/CHImageBuffer/dllmain.cpp                                                  |   36 
 ENRUTResources_zh-CN/res/writelar.bmp                                                   |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/photo.hpp                                |  870 
 ENRIT/Define/InspectionBase.h                                                           |   51 
 Lib/Matrox/Include/MILDyn/mildisplay.h                                                  | 2036 
 Common_Class/SISAssem/SISPixelIntrin.cpp                                                | 2000 
 BlVisionPro/Vision/GrindDotProcess.cpp                                                  |  345 
 Common_Class/CHThreadPool/CHThreadPool.def                                              |    6 
 Lib/JsoncppSDK/include/version.h                                                        |   27 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp                                 |  631 
 Lib/SISBuffer/include/InspectionBuffer.h                                                |  498 
 Lib/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp                                |   27 
 Lib/OpenCV/opencv_3.1/lib/opencv_ml310d.lib                                             |    0 
 Common_Class/LogView/ReadMe.txt                                                         |  113 
 ENRUTResources_zh-CN/res/bmp00024.bmp                                                   |    0 
 Common_Class/SISControls/GridControl/GridCellBase.h                                     |  172 
 ENRIT/UITool/PixelPtr.h                                                                 |   40 
 Common_Class/Matrox/dll/MilgigevisionUI.dll                                             |    0 
 Lib/EuresysCam/Include/McParams.h                                                       | 20872 ++
 Common_Class/VisionLib/SISControls/include/CellCtrl.h                                   |  304 
 Lib/EdgeInspect/include/EdgeFind.h                                                      |  211 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h    |  848 
 Common_Class/CHThreadPool/Header/WorkThreadArray.h                                      |   29 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/heap.h                             |  165 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp |  132 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h                                   |   57 
 BlVisionPro/Vision/Serializer.h                                                         |   39 
 Common_Class/BlVisionPro/Vision/ThresDotProcess.h                                       |   65 
 Lib/EuresysCam/Lib/MultiCam.lib                                                         |    0 
 Lib/SISAssem/include/PairStorage.h                                                      |   59 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.hpp                                 |   52 
 Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.h               |  148 
 Common_Class/BlVisionPro/Vision/HoleProcess.cpp                                         |   82 
 Common_Class/SISAssem/SISAssem.vcproj                                                   | 1844 
 Lib/Matrox/dll/MilMorphis.dll                                                           |    0 
 Lib/Matrox/Include/Mildec.h                                                             |   53 
 Common_Class/EdgeInspect/Header/EdgeProc.h                                              |   75 
 ENRIT/UITool/DisplayMessage.h                                                           |   42 
 Common_Class/BlVisionPro/Vision/FileRecipe.cpp                                          |  195 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp                     |  163 
 BlVisionPro/Header/BlSideData.h                                                         |   91 
 Lib/EuresysCam/Include/McIo.h                                                           |  231 
 ENRUTResources_zh-CN/res/icon/idr_enri.ico                                              |    0 
 ENRIT/Data/DefectStorage.h                                                              |  124 
 BlVisionPro/Vision/CutProcess.cpp                                                       |   97 
 Common_Class/ConfigFileManager/IniManager.cpp                                           |  484 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp                       |   78 
 Lib/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp                         |  203 
 ENRIT/Data/PostProcess.cpp                                                              | 1071 
 Common_Class/EdgeInspect/stdafx.cpp                                                     |    7 
 Common_Class/PLCConnector/PLCConnector.vcxproj                                          |  490 
 BlVisionPro/resource.h                                                                  |    0 
 Lib/SISBuffer/include/SISMatch.h                                                        |   99 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp                          |  326 
 ENRUTResources_zh-CN/res/icon/ico00002.ico                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/saving.h                                    |  187 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h                                      |  515 
 Common_Class/CHThreadPool/ThreadPool.cpp                                                |  102 
 Lib/OpenCV/opencv_3.1/lib/opencv_features2d310.lib                                      |    0 
 Common_Class/BlVisionPro/View/CutSetDlg.cpp                                             |  387 
 Common_Class/ConfigFileManager/stdafx.cpp                                               |    7 
 ENRIT/res/propicons.bmp                                                                 |    0 
 Common_Class/LogView/MemoryManager.cpp                                                  |  165 
 Lib/BaseDisplaySDK/include/IImageDisplay.h                                              |   91 
 BlVisionPro/Vision/SoftVisionApp.h                                                      |  107 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/saving.h                           |  187 
 Common_Class/BlVisionPro/View/ChipInspectDlg.cpp                                        |  185 
 BlVisionPro/Vision/CutDotProcess.h                                                      |   64 
 Common_Class/BlVisionPro/res/navigate_right.ico                                         |    0 
 ENRIT/res/listCell.bmp                                                                  |    0 
 Common_Class/CHImageBuffer/CHImageBuffer.sln                                            |   26 
 Common_Class/CHImageBuffer/ImageViewer.cpp                                              |  878 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp                  |  140 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h                            |   91 
 ENRIT/View/ViewLampControl.h                                                            |   97 
 Lib/JsoncppSDK/include/writer.h                                                         |  368 
 Common_Class/SISBuffer/StdAfx.h                                                         |   42 
 ENRIT/View/ImgDefect.h                                                                  |   69 
 ENRUTResources_zh-CN/res/bmp00007.bmp                                                   |    0 
 Common_Class/ConfigFileManager/targetver.h                                              |   26 
 Common_Class/SISAssem/AssemUtil2.asm                                                    |  634 
 Lib/SISAssem/include/BlobStorage.h                                                      |   67 
 Lib/SISControls/GridControl/GridCellBase.h                                              |  172 
 Common_Class/SISAssem/ConvPixelVTDSBW.asm                                               | 1170 
 ENRIT/CLanguageControl.h                                                                |   21 
 Lib/Matrox/dll/milirisgtr.dll                                                           |    0 
 Common_Class/BlVisionPro/View/LocSetDlg.cpp                                             |  497 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_videostab310.lib                              |    0 
 ENRIT/Data/InspectDefect.cpp                                                            |  274 
 Lib/EdgeInspect/include/CornerCut.h                                                     |   84 
 ENRIT/Light/ExternLightControlLCP.h                                                     |   23 
 Common_Class/SISControls/SISControls.dsw                                                |   29 
 Lib/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h                                |  232 
 Lib/OpenCV/opencv_3.1/include/opencv2/cvconfig.h                                        |  196 
 Common_Class/EuresysCam/Include/MCpp_Board.h                                            |   35 
 Lib/Matrox/Include/milfpga.h                                                            |  518 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp                  |   91 
 Common_Class/BlVisionPro/Vision/ThresDotProcess.cpp                                     |  444 
 BlVisionPro/View/ThresSetDlg.h                                                          |   59 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp                          |  212 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp                      |   48 
 Lib/Matrox/dll/MilRadientUI.dll                                                         |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp                                    |  280 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp                            |  846 
 Common_Class/VisionLib/ApiVisionSDK/include/IClsDisplay.h                               |  171 
 Common_Class/VisionLib/LogSDK/include/LogLib.h                                          |   39 
 .vs/ENRIT/v17/fileList.bin                                                              |    0 
 Lib/LogSDK/include/LogLib.h                                                             |   39 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h                                  |   81 
 ENRIT/UITool/General_Draw.cpp                                                           |   62 
 Common_Class/BlVisionPro/View/KDistSetDlg.h                                             |   53 
 Common_Class/ConfigFileManager/Header/Registery.h                                       |   89 
 Lib/Matrox/dll/MilRadientProUI.dll                                                      |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp                |  203 
 Common_Class/SharedMapDll/SharedMapDll.sln                                              |   26 
 Common_Class/SISBuffer/Header/NoiseLevel.h                                              |  148 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp                            |  267 
 Common_Class/SISAssem/Header/BlobStorage.h                                              |   67 
 ENRUTResources_zh-CN/res/icon/icon_up_.ico                                              |    0 
 ENRIT/res/MenuBar.bmp                                                                   |    0 
 Common_Class/BlVisionPro/Vision/ThresProcess.h                                          |   33 
 Lib/EuresysCam/Include/MCpp_SurfaceImpl.h                                               |   77 
 Lib/SISControls/include/SISFolderScheduling.h                                           |   92 
 Common_Class/EdgeInspect/targetver.h                                                    |   26 
 ENRIT/UITool/Splash.h                                                                   |  117 
 Lib/OpenCV/opencv_3.1/include/opencv/cvwimage.h                                         |   46 
 BlVisionPro/Vision/DistDotProcess.cpp                                                   |  569 
 Common_Class/SISAssem/Header/AssemDefect.h                                              |  467 
 Lib/Matrox/lib/Mil3d.lib                                                                |    0 
 ENRIT/View/FrameImg.h                                                                   |  187 
 Common_Class/ConfigFileManager/FileVersionManager.cpp                                   |   62 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp                                  |  889 
 Common_Class/SISBuffer/MatchImpl.h                                                      |  151 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp                             |  743 
 Common_Class/BlVisionPro/Vision/HoleDotProcess.h                                        |   71 
 ENRIT/res/ICON/edit.ico                                                                 |    0 
 Lib/JsoncppSDK/include/value.h                                                          |  967 
 Common_Class/SISAssem/AssemUtil2_1by1.asm                                               |  292 
 ENRIT/View/ViewRecipeProfileView.cpp                                                    |  366 
 Common_Class/VisionLib/SISControls/include/SISJogBtn2Parent.h                           |   12 
 Common_Class/VisionLib/SISControls/include/SortClass.h                                  |   40 
 ENRIT/UITool/MImageStatic.cpp                                                           |  261 
 BlVisionPro/Vision/CornerDistProcess.cpp                                                |  392 
 ENRUTResources_zh-CN/res/icon/ico00008.ico                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/highgui.hpp                                       |  754 
 ENRIT/Recipe/GlassRecipe.cpp                                                            | 4377 
 Common_Class/LogView/Header/LogView.h                                                   |   34 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cvwimage.h                                |   46 
 Common_Class/SISBuffer/LeastSquare.cpp                                                  |  736 
 ENRIT/res/bmp00001.bmp                                                                  |    0 
 Common_Class/BlGrabber/FrameBufferController.cpp                                        |   88 
 Lib/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp                                       | 2001 
 Common_Class/SISAssem/SISZoneIntrin.cpp                                                 | 2734 
 Common_Class/SISAssem/20101008_ConvPixel.asm                                            |  649 
 Common_Class/SISControls/Header/SISJogButton.h                                          |   63 
 Common_Class/EuresysCam/Include/MultiCamCppExternal.h                                   |   30 
 Lib/Matrox/dll/MILQSVEngine.dll                                                         |    0 
 Lib/EdgeInspect/include/SplineInspect.h                                                 |  251 
 Lib/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp                               |   48 
 Common_Class/SISBuffer/NoiseLevel.cpp                                                   |  333 
 BlVisionPro/Vision/SoftVisionApp.cpp                                                    |  794 
 ENRIT/Light/LightManager.cpp                                                            |  199 
 Global_Include/SharedMemoryDefine.h                                                     |   47 
 Common_Class/BlVisionPro/Vision/ConfigVision.h                                          |   39 
 Common_Class/EuresysCam/Dll/MultiCam.dll                                                |    0 
 Common_Class/Matrox/dll/MilIrisGTRUI.dll                                                |    0 
 BlVisionPro/Vision/KDistProcess.h                                                       |   36 
 ENRUTResources_zh-CN/res/icon/icon_app.ico                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp             |  225 
 Common_Class/Matrox/dll/MilMorphisQxt.dll                                               |    0 
 .vs/ENRIT/v17/Solution.VC.db                                                            |    0 
 Common_Class/EuresysCam/Lib/MultiCam.lib                                                |    0 
 Common_Class/ConfigFileManager/ConfigFileManager.cpp                                    |   10 
 BlVisionPro/View/ThresSetDlg.cpp                                                        |  384 
 ENRUTResources_zh-CN/res/bmp00022.bmp                                                   |    0 
 ENRIT/Process/InspectCamera.cpp                                                         | 5107 
 Common_Class/EdgeInspect/EdgeFind.cpp                                                   | 2007 
 ENRIT/res/ICON/SETUP1.ICO                                                               |    0 
 ENRUTResources_zh-CN/res/bmp00016.bmp                                                   |    0 
 Common_Class/SISAssem/ConvFloat_BOE.asm                                                 |  827 
 Common_Class/VisionLib/SISControls/GridControl/GridMemDC.h                              |  106 
 Common_Class/ExpireDay/ExpireDayDlg.h                                                   |   38 
 Common_Class/LogView/Header/PathData.h                                                  |   30 
 Common_Class/ExpireDay/ExpireDay.h                                                      |   32 
 BlVisionPro/View/LockSetDlg.cpp                                                         |   99 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp                           | 1069 
 Lib/SISAssem/include/SISAssem.h                                                         |  233 
 Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h                      |   58 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h                  |  588 
 ProjectClean.exe                                                                        |    0 
 ENRUTResources_zh-CN/res/bmp00009.bmp                                                   |    0 
 ENRIT/View/ViewUserDefectArea.h                                                         |   58 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp                         |   72 
 ENRIT/res/Right_Arrow.bmp                                                               |    0 
 Common_Class/BlVisionPro/Vision/VisionBufferPro.h                                       |   71 
 Lib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h                              |   26 
 Common_Class/EuresysCam/Include/containers.h                                            |  173 
 BlVisionPro/View/CornerDistSetDlg.h                                                     |  135 
 Common_Class/SharedMapDll/Header/LogManager.h                                           |   68 
 Lib/Matrox/dll/RadientPfpga.dll                                                         |    0 
 Common_Class/LogView/res/LogView.ico                                                    |    0 
 Lib/BaseDisplaySDK/include/BaseVision.h                                                 |   90 
 ENRIT/MainFrm.cpp                                                                       |  727 
 Common_Class/SISAssem/ConvFloat.asm                                                     |  760 
 Lib/OpenCV/opencv_3.1/lib/opencv_calib3d310d.lib                                        |    0 
 Lib/Matrox/dll/MilRadientPro.dll                                                        |    0 
 Lib/SISControls/include/SISLabel.h                                                      |   77 
 Lib/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h                                 |  176 
 ENRUTResources_zh-CN/ENRUTResources_zh-CN.vcxproj                                       |  292 
 ENRIT/View/ViewHoleRecipeSetting.cpp                                                    | 1076 
 Common_Class/Matrox/Include/MILDyn/milcom.h                                             |  326 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h                                 |  188 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h                  |  137 
 Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.h                        |   52 
 Lib/Matrox/Include/milstring.h                                                          | 1852 
 Lib/SISControls/GridControl/GridMemDC.h                                                 |  106 
 Common_Class/BlVisionPro/BlVisionPro.vcxproj                                            |  327 
 BlVisionPro/View/VisionSetDlg.cpp                                                       |  545 
 Common_Class/EuresysCam/Include/MCpp_MultiCamObjectImpl.h                               |  264 
 Common_Class/VisionLib/SISControls/GridControl/GridCtrl.h                               | 1088 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h                         |  177 
 Common_Class/ExpireDay/ExpireDay.vcxproj                                                |  215 
 Lib/EuresysCam/Include/MCpp_Surface.h                                                   |   33 
 Common_Class/VisionLib/BaseDisplaySDK/include/BaseDisplayLib.h                          |   24 
 Common_Class/CHImageBuffer/ReadMe.txt                                                   |   67 
 运行环境/驱动资料.zip                                                                           |    0 
 Common_Class/LogView/Header/MainFrm.h                                                   |   56 
 Lib/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp                                    |  132 
 Common_Class/EdgeInspect/ReadMe.txt                                                     |   56 
 BlVisionPro/Vision/HoleProcess.h                                                        |   31 
 Lib/Matrox/dll/milwebclient.dll                                                         |    0 
 Common_Class/PLCConnector/PLCConnectorView.h                                            |  208 
 Common_Class/SISControls/PropertyGridControl/CustomItem.h                               |   34 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp                                   |  729 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h                     |   69 
 ENRUTResources_zh-CN/res/icon/ico00006.ico                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h                              | 1169 
 Common_Class/PLCConnector/SetOptionDlg.h                                                |   55 
 Common_Class/EdgeInspect/res/EdgeInspect.rc2                                            |   13 
 ENRIT/Grabber/RadientControl.h                                                          |  107 
 Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp               |  123 
 Lib/EdgeInspect/include/ChamferInspect.h                                                |  310 
 BlVisionPro/Vision/ConfigVision.h                                                       |   39 
 ENRUTResources_zh-CN/res/led_off.bmp                                                    |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp                |  129 
 Lib/Matrox/dll/MilRadientevclUI.dll                                                     |    0 
 ENRIT/Light/LightManager.h                                                              |   39 
 Common_Class/SISControls/Header/SISJogBtn2Parent.h                                      |   12 
 Lib/OpenCV/opencv_3.1/lib/opencv_shape310d.lib                                          |    0 
 ENRUTResources_zh-CN/res/bmp00014.bmp                                                   |    0 
 Common_Class/BlVisionPro/Vision/HoleProcess.h                                           |   31 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp            |  275 
 ENRIT/View/DlgLogin.cpp                                                                 |  120 
 Common_Class/Matrox/dll/MilRadientCXP.dll                                               |    0 
 Common_Class/LogView/Header/PathSettingDlg.h                                            |   35 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/random.h                                    |  133 
 Common_Class/SISAssem/ConvFloatDPC.asm                                                  |  789 
 ENRIT/Grabber/SapControl.h                                                              |   89 
 ENRIT/Grabber/SapLineGrab.h                                                             |   89 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp                 |  116 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp                      |  111 
 Common_Class/SISBuffer/InspectionBuffer.cpp                                             |  514 
 Common_Class/Matrox/dll/MilDSFSequence.dll                                              |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h                        |  188 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_photo310.lib                                  |    0 
 ENRIT/InterfaceManager.cpp                                                              | 2391 
 Common_Class/ConfigFileManager/Header/Config.h                                          |   89 
 ENRIT/View/ViewRecipeInspectionView.cpp                                                 | 1026 
 Lib/OpenCV/opencv_3.1/lib/opencv_videostab310.lib                                       |    0 
 ENRIT/res/ICON/arrow_up_blue.ico                                                        |    0 
 Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.cpp                     |  511 
 BlVisionPro/IncludeVision.h                                                             |  108 
 ENRIT/stdafx.h                                                                          |   84 
 Lib/SISAssem/include/AssemParam.h                                                       |  319 
 ENRIT/ENRIT.rc                                                                          |    0 
 ENRIT/res/카메라.ico                                                                       |    0 
 Lib/Matrox/Include/MILDyn/PFNC.h                                                        | 1183 
 ENRUTResources_zh-CN/res/icon/icon_dis.ico                                              |    0 
 ENRIT/TriggerBoard/TriggerControl_Mvsol.h                                               |   30 
 ENRIT/View/ViewRecipeNew.h                                                              |   37 
 Common_Class/SISControls/SISControls.dsp                                                |  315 
 Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.h                     |   26 
 Common_Class/VisionLib/LogSDK/include/IDayLog.h                                         |   47 
 ENRUTResources_zh-CN/pch.cpp                                                            |    5 
 Common_Class/SISAssem/ReadMe.txt                                                        |   56 
 Common_Class/SISControls/GridControl/GridCtrl.cpp                                       | 8426 
 BlVisionPro/Vision/RcutDotProcess.cpp                                                   | 2118 
 Common_Class/SISAssem/ConvFloatVert_BOE.asm                                             |  953 
 BlVisionPro/Vision/CornerRcutProcess.cpp                                                |  103 
 Common_Class/EdgeInspect/EdgeInspectD.def                                               |    6 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp                  |  774 
 Common_Class/PLCConnector/MainFrm.h                                                     |   57 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.hpp                         |  425 
 Lib/SISControls/include/SortClass.h                                                     |   40 
 ENRUTResources_zh-CN/res/bmp00020.bmp                                                   |    0 
 Common_Class/SISAssem/ConvZoneVert2S.asm                                                | 1130 
 Lib/Matrox/dll/MilRadient.dll                                                           |    0 
 Common_Class/BlVisionPro/Vision/CornerDistProcess.h                                     |   74 
 Common_Class/EuresysCam/Include/MCpp_MultiCamObject.h                                   |   59 
 Common_Class/SISAssem/PairStorage.cpp                                                   | 1478 
 Common_Class/Mvsol/include/SerialEx.h                                                   |  118 
 Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.h                |  137 
 Common_Class/LogView/LogView.vcxproj.filters                                            |  110 
 Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.cpp                       |  212 
 ENRUTResources_zh-CN/res/icon/icon_edi.ico                                              |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp          |  132 
 Common_Class/SharedMapDll/dllmain.cpp                                                   |   51 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp                    |  183 
 Common_Class/SISAssem/ConvPixelD.asm                                                    | 1130 
 ENRIT/ENRIT.vcxproj.filters                                                             | 1027 
 Common_Class/CHThreadPool/targetver.h                                                   |    8 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp                             |  183 
 Lib/JsoncppSDK/include/reader.h                                                         |  437 
 Common_Class/SISAssem/20101008_ConvFloat.asm                                            |  995 
 Common_Class/BlVisionPro/Vision/KDistProcess.h                                          |   36 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp                               |   48 
 Common_Class/EdgeInspect/stdafx.h                                                       |   57 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp                          |  603 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp      |  123 
 Common_Class/Matrox/dll/MilAux.dll                                                      |    0 
 Common_Class/Matrox/lib/mil.lib                                                         |    0 
 Lib/Matrox/dll/Milnetworkinfo.dll                                                       |    0 
 Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h           |   26 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp                             |  172 
 ENRIT/View/ViewHoleRecipeSetting.h                                                      |   93 
 Lib/OpenCV/opencv_3.1/include/opencv2/features2d.hpp                                    | 1325 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp                 |  224 
 Common_Class/CHImageBuffer/ImageBuffer.cpp                                              |  909 
 ENRIT/UITool/cellsmanager.h                                                             |   88 
 Common_Class/VisionLib/SISControls/include/SISFolderScheduling.h                        |   92 
 SDK_AND_TEST/resource.h                                                                 |    0 
 Common_Class/Matrox/dll/milirisgtr.dll                                                  |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp                    |  172 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h                  |  165 
 Lib/OpenCV/opencv_3.1/include/opencv/cv.h                                               |   73 
 Common_Class/SISAssem/ConvPixelVTDS.asm                                                 | 1060 
 Common_Class/CHThreadPool/Header/WorkThreadPool.h                                       |   37 
 Lib/SISControls/GridControl/NewCellTypes/GridURLCell.h                                  |   55 
 Lib/Matrox/dll/milshm.dll                                                               |    0 
 ENRIT/View/ViewRecipeList.h                                                             |   72 
 ENRIT/View/ViewScanImage.h                                                              |  114 
 Common_Class/CHImageBuffer/CHImageBuffer.vcxproj                                        |  357 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp                              |  290 
 Lib/Matrox/Include/Milos.h                                                              | 1423 
 Common_Class/ExpireDay/stdafx.h                                                         |   58 
 Lib/EuresysCam/Include/MultiCamCpp.h                                                    |   13 
 Lib/OpenCV/opencv_3.1/lib/opencv_video310.lib                                           |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp                        |  195 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp                               |  530 
 Lib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h                             |   92 
 Common_Class/EuresysCam/Lib/MultiCam.def                                                |   35 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp                                |  302 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/timer.h                                     |   94 
 ENRIT/View/ViewSettingNotch.cpp                                                         | 1485 
 Common_Class/SISControls/SISControls.def                                                |    7 
 BlVisionPro/Vision/VisionBufferPro.h                                                    |   71 
 Common_Class/ConfigFileManager/Header/FileMap.h                                         |   97 
 Common_Class/Matrox/Include/Milerr.h                                                    | 2784 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp                |  171 
 Lib/SISControls/include/XTabCtrl.h                                                      |   90 
 Common_Class/VisionLib/SISControls/include/ColorButton.h                                |  101 
 Common_Class/ConfigFileManager/Header/IniManager.h                                      |   89 
 Lib/Matrox/dll/MilCodec.dll                                                             |    0 
 Common_Class/MegaLock/lib/l_mega64__.lib                                                |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp            |  131 
 Common_Class/BlVisionPro/Vision/GrindDotProcess.h                                       |   72 
 Common_Class/SISBuffer/SISBuffer.rc                                                     |  124 
 Common_Class/CHThreadPool/Resource.h                                                    |   16 
 ENRIT/res/ICON/check.ico                                                                |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp            |  274 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/base.hpp                            |  689 
 Lib/OpenCV/opencv_3.1/lib/opencv_core310d.lib                                           |    0 
 Common_Class/ExpireDay/ExpireDay.rc                                                     |    0 
 Common_Class/ExpireDay/targetver.h                                                      |    8 
 Lib/SISControls/include/GradientStatic.h                                                |  149 
 Common_Class/SISControls/Header/ColorButton.h                                           |  101 
 Common_Class/PLCConnector/PLCConnector.ini                                              |   17 
 Common_Class/EdgeInspect/EdgeInspect.cpp                                                |   10 
 Common_Class/Matrox/Include/milfuncll.h                                                 |   74 
 Common_Class/SISAssem/Header/AssemUtil.h                                                |   35 
 ENRIT/ENRITDoc.h                                                                        |   48 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp                         |  129 
 Common_Class/EuresysCam/Include/MultiCamCpp.h                                           |   13 
 Common_Class/SISAssem/ConvFloat6.asm                                                    |  808 
 Common_Class/EuresysCam/Include/multicam.h                                              |  155 
 ENRIT/res/filelarge.bmp                                                                 |    0 
 Common_Class/EdgeInspect/EdgeProc.cpp                                                   | 1087 
 Lib/SISBuffer/include/SISPitch.h                                                        |  167 
 Common_Class/LogView/targetver.h                                                        |    8 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp                      |   31 
 ENRIT/ENRITView.cpp                                                                     |  530 
 Common_Class/BlVisionPro/Vision/KeyDistDotProcess.h                                     |   70 
 Common_Class/SISControls/Header/InPlaceComboBox.h                                       |   51 
 Common_Class/SISControls/SISLabel.cpp                                                   |  272 
 Lib/EuresysCam/Include/ESFilter.h                                                       |  225 
 ENRIT/res/ICON/ico00004.ico                                                             |    0 
 ENRIT/res/check.bmp                                                                     |    0 
 BlVisionPro/Vision/ConfigVision.cpp                                                     |  127 
 Common_Class/SISAssem/Header/SISAssem.h                                                 |  233 
 BlVisionPro/View/MeasureSetDlg.h                                                        |   62 
 Common_Class/BlVisionPro/View/OpRoiDlg.cpp                                              |  142 
 Common_Class/SISAssem/ConvTrapFD.asm                                                    |  858 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h                                    |  116 
 Common_Class/SISBuffer/Header/SISMath.h                                                 |  169 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp                           |  302 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.hpp                                |   53 
 Lib/Matrox/dll/milusb3vision.dll                                                        |    0 
 Common_Class/PLCConnector/acteasyif1.cpp                                                |   19 
 ENRIT/License/Worker_UpdateLicense.cpp                                                  |  206 
 Lib/Matrox/Include/MILDyn/milcom.h                                                      |  326 
 Common_Class/Mvsol/include/Serial.h                                                     |  367 
 Common_Class/EdgeInspect/Header/Edge_Log.h                                              |   30 
 ENRIT/res/ENRIT.rc2                                                                     |    0 
 Common_Class/BlVisionPro/Header/IVisionRecipe.h                                         |   67 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp                         | 3668 
 BlVisionPro/BlVisionPro.vcxproj.filters                                                 |  348 
 ENRIT/View/ViewSettingSpline.cpp                                                        |  999 
 Common_Class/SISAssem/ConvPixelVertS.asm                                                | 1006 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp                         |  218 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h                      | 1210 
 Common_Class/SISAssem/Resource.h                                                        |   16 
 ENRUTResources_zh-CN/res/bmp00005.bmp                                                   |    0 
 Common_Class/Matrox/dll/MilConcordPoEUI.dll                                             |    0 
 Lib/EuresysCam/Include/MCpp_MultiCamObjectImpl.h                                        |  264 
 BlVisionPro/View/ChipInspectDlg.cpp                                                     |  185 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/types_c.h                                    | 1834 
 Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h          |   92 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp                      |  128 
 Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.cpp                  |  269 
 Common_Class/SISControls/GridControl/GridInPlaceEdit.cpp                                |  263 
 ENRUTResources_zh-CN/res/icon/idr_main.ico                                              |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h                          |   57 
 Common_Class/PLCConnector/PLCConnector.rc                                               |  540 
 Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310d.lib                                      |    0 
 Common_Class/SISBuffer/SISMath.cpp                                                      | 1003 
 Common_Class/Matrox/dll/MilDSFCapture.dll                                               |    0 
 Common_Class/BlVisionPro/ReadMe.txt                                                     |   45 
 Common_Class/ExpireDay/ExpireDay.cpp                                                    |   94 
 Common_Class/Matrox/Include/miluniqueid.h                                               |  554 
 ENRIT/Data/StopWatch.h                                                                  |   36 
 Lib/Matrox/Include/MILDyn/milim.h                                                       | 3389 
 BlVisionPro/Vision/KDistProcess.cpp                                                     |  112 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp                     |   64 
 Common_Class/VisionLib/BaseDisplaySDK/include/typesdef.h                                |  150 
 BlVisionPro/Vision/NccDotProcess.cpp                                                    |  343 
 Lib/Matrox/dll/SoliosPFpga.dll                                                          |    0 
 ENRIT/res/bitmap_r.bmp                                                                  |    0 
 Common_Class/EuresysCam/Include/MCpp_ConfigurationImpl.h                                |   28 
 Common_Class/SISControls/GridControl/GridCellButton.cpp                                 |   47 
 Common_Class/LogView/Header/InsertPathDlg.h                                             |   35 
 Lib/FreeImage/lib/FreeImage.dll                                                         |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h                            |  159 
 Lib/BaseDisplaySDK/include/IClsShape.h                                                  |   40 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h                           |  588 
 Common_Class/BlVisionPro/Vision/VisionBufferPro.cpp                                     | 1337 
 Common_Class/ConfigFileManager/BasedConfig.cpp                                          |   26 
 Lib/EuresysCam/Include/MCpp_MultiCamObject.h                                            |   59 
 ENRUTResources_zh-CN/res/icon/icon_del.ico                                              |    0 
 Common_Class/EuresysCam/Include/MCpp_SignalInfo.h                                       |   30 
 Common_Class/ConfigFileManager/res/ConfigFileManager.rc2                                |   13 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching.hpp                            |  257 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/params.h                           |   99 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/version.hpp                                  |   71 
 Common_Class/VisionLib/SISControls/GridControl/GridDropTarget.h                         |   82 
 Lib/EuresysCam/Include/MCpp_Configuration.h                                             |   61 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/world.hpp                                |   58 
 Lib/EdgeInspect/include/ProfileCADProc.h                                                |   68 
 Common_Class/SISAssem/ConvZoneVTD_BOE.asm                                               | 1230 
 Common_Class/BlGrabber/BlGrabber.def                                                    |    6 
 Lib/Matrox/dll/MilRapixoCXPUI.dll                                                       |    0 
 ENRIT/Recipe/HardwareSettings.cpp                                                       | 1813 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h                              |  132 
 Lib/LogSDK/include/IDayLog.h                                                            |   47 
 Common_Class/OpenCV/opencv_3.1/include/opencv/cxmisc.h                                  |    8 
 ENRIT/Grabber/SapControl.cpp                                                            |  798 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp                        |   94 
 BlVisionPro/Vision/Vec.h                                                                |  463 
 ENRIT/CLanguageControl.cpp                                                              |  100 
 Lib/OpenCV/opencv_3.1/include/opencv2/core.hpp                                          | 3168 
 Lib/OpenCV/opencv_3.1/include/opencv/cxcore.h                                           |   52 
 Lib/EuresysCam/Include/MCpp_BoardListImpl.h                                             |  145 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp                        |  150 
 Common_Class/OpenCV/opencv_3.1/lib/opencv_highgui310.lib                                |    0 
 Common_Class/Matrox/dll/MilMorphis.dll                                                  |    0 
 Common_Class/EdgeInspect/Edge_Log.cpp                                                   |  180 
 Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.h                   |   68 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h                       |  634 
 ENRIT/res/check32.bmp                                                                   |    0 
 Lib/BaseDisplaySDK/include/typesdef.h                                                   |  150 
 Common_Class/SISBuffer/CopyBuffer.cpp                                                   |   59 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp                                 |  150 
 .vs/ENRIT/CopilotIndices/17.13.441.19478/CodeChunks.db                                  |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp                          |   48 
 Common_Class/Matrox/dll/milcom.dll                                                      |    0 
 Common_Class/Matrox/dll/McomController.dll                                              |    0 
 Common_Class/PLCConnector/PLCConnectorDoc.h                                             |   41 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp                       |  515 
 Common_Class/SISControls/Header/SISButton.h                                             |   82 
 ENRIT/ENRIT.vcxproj                                                                     |  532 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp              |  121 
 ENRIT/res/ENRITDoc.ico                                                                  |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp                      |  158 
 ENRIT/res/ICON/load1.ico                                                                |    0 
 Lib/EuresysCam/Include/CCallbacks.h                                                     |   46 
 Common_Class/SISBuffer/SISMath_omp.cpp                                                  |  196 
 Common_Class/CHThreadPool/CHThreadPool.vcxproj                                          |  354 
 ENRIT/BICommon.h                                                                        |   16 
 Lib/Matrox/Include/MILDyn/mil3dgra.h                                                    |  908 
 Common_Class/CHImageBuffer/res/CHImageBuffer.rc2                                        |    0 
 ENRIT/View/ViewSettingNotch.h                                                           |  118 
 Common_Class/LogView/PathData.cpp                                                       |  164 
 ENRIT/View/GlassMap.cpp                                                                 | 2542 
 Common_Class/CHImageBuffer/Resource.h                                                   |   16 
 Common_Class/BlGrabber/Resource.h                                                       |   16 
 Common_Class/Matrox/dll/milnetworkserver.dll                                            |    0 
 SDK_AND_TEST/targetver.h                                                                |    0 
 Common_Class/SISControls/WKButton.cpp                                                   |  484 
 SDK_AND_TEST/SDK_AND_TEST.vcxproj                                                       |  226 
 Lib/Matrox/lib/mil.lib                                                                  |    0 
 Lib/SISControls/include/ColorButton.h                                                   |  101 
 Common_Class/ExpireDay/resource.h                                                       |    0 
 ENRIT/TriggerBoard/TriggerBoard.zip                                                     |    0 
 Common_Class/SISControls/GridControl/GridInPlaceEdit.h                                  |   83 
 Common_Class/LogView/LogViewView.cpp                                                    |  788 
 Common_Class/VisionLib/SISControls/include/DefectMap.h                                  |  125 
 ENRIT/Thread/Thread_CheckSeq.h                                                          |   79 
 BlVisionPro/View/ScanSetDlg.cpp                                                         |  191 
 BlVisionPro/View/CutSetDlg.h                                                            |   55 
 Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp                          |  224 
 Common_Class/Matrox/Include/MILDyn/mil3dgra.h                                           |  908 
 Global_Include/ExpireDayDefine.h                                                        |   18 
 Lib/SISBuffer/include/SISMath.h                                                         |  169 
 Common_Class/BlGrabber/Header/GrabberControl.h                                          |   79 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui.hpp                              |  754 
 Lib/OpenCV/opencv_3.1/include/opencv2/core/core_c.h                                     | 3152 
 Lib/EuresysCam/Include/MCpp_Exception.h                                                 |   32 
 Common_Class/SISAssem/ConvFloatVert9.asm                                                |  941 
 Common_Class/BlVisionPro/View/LockSetDlg.cpp                                            |   99 
 Common_Class/SISAssem/BlobStorage.cpp                                                   | 1445 
 Common_Class/SISBuffer/Header/Broadcast.h                                               |   41 
 ENRUTResources_zh-CN/res/bmp00018.bmp                                                   |    0 
 ENRIT/Data/StopWatch.cpp                                                                |   45 
 BlVisionPro/res/navigate_up.ico                                                         |    0 
 Common_Class/EuresysCam/Include/McIo.h                                                  |  231 
 Common_Class/CHThreadPool/Header/TimerThreadPool.h                                      |   27 
 Common_Class/SISAssem/ConvTrapVert.asm                                                  | 1118 
 Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.h                          |  103 
 BlVisionPro/BlVisionPro.vcxproj                                                         |  327 
 ENRUTResources_zh-CN/res/icon/icon_rep.ico                                              |    0 
 Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h              |  634 
 Common_Class/SISControls/GridControl/CellRange.h                                        |  156 
 Common_Class/ConfigFileManager/ConfigFileManagerD.def                                   |    6 
 Common_Class/EdgeInspect/EdgeInspect.vcproj                                             |  584 
 Common_Class/SISControls/InPlaceEdit.cpp                                                |  147 
 Lib/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h                                 |  492 
 Common_Class/BlVisionPro/BlVisionPro.def                                                |    6 
 Common_Class/Matrox/dll/MilGPUd3d9.dll                                                  |    0 
 BlVisionPro/Vision/ThresProcess.h                                                       |   33 
 Common_Class/LogView/LogView.vcxproj                                                    |  326 
 Common_Class/Matrox/dll/MilConcordPoE.dll                                               |    0 
 Lib/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp                       |  121 
 Lib/OpenCV/opencv_3.1/include/opencv/cvaux.hpp                                          |   52 
 1,873 files changed, 571,687 insertions(+), 0 deletions(-)

diff --git a/.vs/ENRIT/CopilotIndices/17.13.441.19478/CodeChunks.db b/.vs/ENRIT/CopilotIndices/17.13.441.19478/CodeChunks.db
new file mode 100644
index 0000000..aa2ece2
--- /dev/null
+++ b/.vs/ENRIT/CopilotIndices/17.13.441.19478/CodeChunks.db
Binary files differ
diff --git a/.vs/ENRIT/CopilotIndices/17.13.441.19478/SemanticSymbols.db b/.vs/ENRIT/CopilotIndices/17.13.441.19478/SemanticSymbols.db
new file mode 100644
index 0000000..4955d15
--- /dev/null
+++ b/.vs/ENRIT/CopilotIndices/17.13.441.19478/SemanticSymbols.db
Binary files differ
diff --git a/.vs/ENRIT/FileContentIndex/2a67161d-eeaf-477b-9b1f-845d8fa24339.vsidx b/.vs/ENRIT/FileContentIndex/2a67161d-eeaf-477b-9b1f-845d8fa24339.vsidx
new file mode 100644
index 0000000..f15a116
--- /dev/null
+++ b/.vs/ENRIT/FileContentIndex/2a67161d-eeaf-477b-9b1f-845d8fa24339.vsidx
Binary files differ
diff --git a/.vs/ENRIT/v17/Browse.VC.db b/.vs/ENRIT/v17/Browse.VC.db
new file mode 100644
index 0000000..8e7081b
--- /dev/null
+++ b/.vs/ENRIT/v17/Browse.VC.db
Binary files differ
diff --git a/.vs/ENRIT/v17/DocumentLayout.backup.json b/.vs/ENRIT/v17/DocumentLayout.backup.json
new file mode 100644
index 0000000..f2e523f
--- /dev/null
+++ b/.vs/ENRIT/v17/DocumentLayout.backup.json
@@ -0,0 +1,88 @@
+{
+  "Version": 1,
+  "WorkspaceRootPath": "D:\\WorkCode\\ENRIT\\",
+  "Documents": [
+    {
+      "AbsoluteMoniker": "D:0:0:{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}|BlVisionPro\\BlVisionPro.vcxproj|D:\\WorkCode\\ENRIT\\BlVisionPro\\BlVisionPro.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}|BlVisionPro\\BlVisionPro.vcxproj|solutionrelative:BlVisionPro\\BlVisionPro.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}|BlVisionPro\\BlVisionPro.vcxproj|D:\\WorkCode\\ENRIT\\BlVisionPro\\IncludeVision.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}|BlVisionPro\\BlVisionPro.vcxproj|solutionrelative:BlVisionPro\\IncludeVision.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    }
+  ],
+  "DocumentGroupContainers": [
+    {
+      "Orientation": 0,
+      "VerticalTabListWidth": 256,
+      "DocumentGroups": [
+        {
+          "DockedWidth": 200,
+          "SelectedChildIndex": 2,
+          "Children": [
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 0,
+              "Title": "BlVisionPro.h",
+              "DocumentMoniker": "D:\\WorkCode\\ENRIT\\BlVisionPro\\BlVisionPro.h",
+              "RelativeDocumentMoniker": "BlVisionPro\\BlVisionPro.h",
+              "ToolTip": "D:\\WorkCode\\ENRIT\\BlVisionPro\\BlVisionPro.h",
+              "RelativeToolTip": "BlVisionPro\\BlVisionPro.h",
+              "ViewState": "AgIAAAYAAAAAAAAAAAAiwAAAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-06-04T08:27:51.477Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 1,
+              "Title": "IncludeVision.h",
+              "DocumentMoniker": "D:\\WorkCode\\ENRIT\\BlVisionPro\\IncludeVision.h",
+              "RelativeDocumentMoniker": "BlVisionPro\\IncludeVision.h",
+              "ToolTip": "D:\\WorkCode\\ENRIT\\BlVisionPro\\IncludeVision.h",
+              "RelativeToolTip": "BlVisionPro\\IncludeVision.h",
+              "ViewState": "AgIAAGwAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-06-04T08:26:26.236Z",
+              "EditorCaption": ""
+            }
+          ]
+        },
+        {
+          "DockedWidth": 200,
+          "SelectedChildIndex": -1,
+          "Children": [
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{28836128-fc2c-11d2-a433-00c04f72d18a}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{68487888-204a-11d3-87eb-00c04f7971a5}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{004be353-6879-467c-9d1e-9ac23cdf6d49}"
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/.vs/ENRIT/v17/DocumentLayout.json b/.vs/ENRIT/v17/DocumentLayout.json
new file mode 100644
index 0000000..36d5c53
--- /dev/null
+++ b/.vs/ENRIT/v17/DocumentLayout.json
@@ -0,0 +1,87 @@
+{
+  "Version": 1,
+  "WorkspaceRootPath": "D:\\WorkCode\\ENRIT\\",
+  "Documents": [
+    {
+      "AbsoluteMoniker": "D:0:0:{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}|BlVisionPro\\BlVisionPro.vcxproj|D:\\WorkCode\\ENRIT\\BlVisionPro\\BlVisionPro.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}|BlVisionPro\\BlVisionPro.vcxproj|solutionrelative:BlVisionPro\\BlVisionPro.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}|BlVisionPro\\BlVisionPro.vcxproj|D:\\WorkCode\\ENRIT\\BlVisionPro\\IncludeVision.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}|BlVisionPro\\BlVisionPro.vcxproj|solutionrelative:BlVisionPro\\IncludeVision.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    }
+  ],
+  "DocumentGroupContainers": [
+    {
+      "Orientation": 0,
+      "VerticalTabListWidth": 256,
+      "DocumentGroups": [
+        {
+          "DockedWidth": 200,
+          "SelectedChildIndex": 2,
+          "Children": [
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{3ae79031-e1bc-11d0-8f78-00a0c9110057}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 0,
+              "Title": "BlVisionPro.h",
+              "DocumentMoniker": "D:\\WorkCode\\ENRIT\\BlVisionPro\\BlVisionPro.h",
+              "RelativeDocumentMoniker": "BlVisionPro\\BlVisionPro.h",
+              "ToolTip": "D:\\WorkCode\\ENRIT\\BlVisionPro\\BlVisionPro.h",
+              "RelativeToolTip": "BlVisionPro\\BlVisionPro.h",
+              "ViewState": "AgIAAAYAAAAAAAAAAAAiwAAAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-06-04T08:27:51.477Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 1,
+              "Title": "IncludeVision.h",
+              "DocumentMoniker": "D:\\WorkCode\\ENRIT\\BlVisionPro\\IncludeVision.h",
+              "RelativeDocumentMoniker": "BlVisionPro\\IncludeVision.h",
+              "ToolTip": "D:\\WorkCode\\ENRIT\\BlVisionPro\\IncludeVision.h",
+              "RelativeToolTip": "BlVisionPro\\IncludeVision.h",
+              "ViewState": "AgIAAGwAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-06-04T08:26:26.236Z"
+            }
+          ]
+        },
+        {
+          "DockedWidth": 200,
+          "SelectedChildIndex": -1,
+          "Children": [
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{28836128-fc2c-11d2-a433-00c04f72d18a}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{68487888-204a-11d3-87eb-00c04f7971a5}"
+            },
+            {
+              "$type": "Bookmark",
+              "Name": "ST:0:0:{004be353-6879-467c-9d1e-9ac23cdf6d49}"
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/.vs/ENRIT/v17/Solution.VC.db b/.vs/ENRIT/v17/Solution.VC.db
new file mode 100644
index 0000000..85ad330
--- /dev/null
+++ b/.vs/ENRIT/v17/Solution.VC.db
Binary files differ
diff --git a/.vs/ENRIT/v17/fileList.bin b/.vs/ENRIT/v17/fileList.bin
new file mode 100644
index 0000000..a65c655
--- /dev/null
+++ b/.vs/ENRIT/v17/fileList.bin
Binary files differ
diff --git a/BlVisionPro/BlVisionPro.cpp b/BlVisionPro/BlVisionPro.cpp
new file mode 100644
index 0000000..cf9b9e5
--- /dev/null
+++ b/BlVisionPro/BlVisionPro.cpp
@@ -0,0 +1,65 @@
+// BlVisionPro.cpp : 定义 DLL 的初始化例程。
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+//
+//TODO:  如果此 DLL 相对于 MFC DLL 是动态链接的,
+//		则从此 DLL 导出的任何调入
+//		MFC 的函数必须将 AFX_MANAGE_STATE 宏添加到
+//		该函数的最前面。
+//
+//		例如: 
+//
+//		extern "C" BOOL PASCAL EXPORT ExportedFunction()
+//		{
+//			AFX_MANAGE_STATE(AfxGetStaticModuleState());
+//			// 此处为普通函数体
+//		}
+//
+//		此宏先于任何 MFC 调用
+//		出现在每个函数中十分重要。  这意味着
+//		它必须作为函数中的第一个语句
+//		出现,甚至先于所有对象变量声明,
+//		这是因为它们的构造函数可能生成 MFC
+//		DLL 调用。
+//
+//		有关其他详细信息,
+//		请参阅 MFC 技术说明 33 和 58。
+//
+
+// CBlVisionProApp
+
+BEGIN_MESSAGE_MAP(CBlVisionProApp, CWinApp)
+END_MESSAGE_MAP()
+
+
+// CBlVisionProApp 构造
+
+CBlVisionProApp::CBlVisionProApp()
+{
+	// TODO:  在此处添加构造代码,
+	// 将所有重要的初始化放置在 InitInstance 中
+}
+
+
+// 唯一的一个 CBlVisionProApp 对象
+
+CBlVisionProApp theApp;
+
+
+// CBlVisionProApp 初始化
+
+BOOL CBlVisionProApp::InitInstance()
+{
+	CWinApp::InitInstance();
+
+	AfxEnableControlContainer();  //添加OCX
+
+	return TRUE;
+}
diff --git a/BlVisionPro/BlVisionPro.def b/BlVisionPro/BlVisionPro.def
new file mode 100644
index 0000000..e941bc8
--- /dev/null
+++ b/BlVisionPro/BlVisionPro.def
@@ -0,0 +1,6 @@
+; BlVisionPro.def : 声明 DLL 的模块参数。
+
+LIBRARY
+
+EXPORTS
+    ; 此处可以是显式导出
diff --git a/BlVisionPro/BlVisionPro.h b/BlVisionPro/BlVisionPro.h
new file mode 100644
index 0000000..b8832b4
--- /dev/null
+++ b/BlVisionPro/BlVisionPro.h
@@ -0,0 +1,27 @@
+// BlVisionPro.h : BlVisionPro DLL 的主头文件
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
+#endif
+
+#include "resource.h"		// 主符号
+
+
+// CBlVisionProApp
+// 有关此类实现的信息,请参阅 BlVisionPro.cpp
+//
+
+class CBlVisionProApp : public CWinApp
+{
+public:
+	CBlVisionProApp();
+
+// 重写
+public:
+	virtual BOOL InitInstance();
+
+	DECLARE_MESSAGE_MAP()
+};
diff --git a/BlVisionPro/BlVisionPro.rc b/BlVisionPro/BlVisionPro.rc
new file mode 100644
index 0000000..c1ef950
--- /dev/null
+++ b/BlVisionPro/BlVisionPro.rc
Binary files differ
diff --git a/BlVisionPro/BlVisionPro.vcxproj b/BlVisionPro/BlVisionPro.vcxproj
new file mode 100644
index 0000000..fdcc4d4
--- /dev/null
+++ b/BlVisionPro/BlVisionPro.vcxproj
@@ -0,0 +1,327 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}</ProjectGuid>
+    <RootNamespace>BlVisionPro</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+    <Keyword>MFCDLLProj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;EXPORT_BLVISION_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>./;./Vision;./View;./Header;$(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(HALCONROOT)\lib\$(HALCONARCH)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>halconcpp.lib</AdditionalDependencies>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)$(ProjectName)\Header\BlVisionLib.h" "$(SolutionDir)Lib\BlVisionPro\include\BlVisionLib.h"
+copy "$(SolutionDir)$(ProjectName)\Header\IVisionRecipe.h" "$(SolutionDir)Lib\BlVisionPro\include\IVisionRecipe.h"
+copy "$(SolutionDir)$(ProjectName)\Header\ISoftVisionApp.h" "$(SolutionDir)Lib\BlVisionPro\include\ISoftVisionApp.h"
+copy "$(SolutionDir)$(ProjectName)\Header\BlSideData.h" "$(SolutionDir)Lib\BlVisionPro\include\BlSideData.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="BlVisionPro.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="View\ChipInspectDlg.cpp" />
+    <ClCompile Include="View\CornerDistSetDlg.cpp" />
+    <ClCompile Include="View\CutSetDlg.cpp" />
+    <ClCompile Include="View\GrindSetDlg.cpp" />
+    <ClCompile Include="View\HoleSetDlg.cpp" />
+    <ClCompile Include="View\KDistSetDlg.cpp" />
+    <ClCompile Include="View\KeyVisionSetDlg.cpp" />
+    <ClCompile Include="View\LockSetDlg.cpp" />
+    <ClCompile Include="View\LocSetDlg.cpp" />
+    <ClCompile Include="View\MeasureSetDlg.cpp" />
+    <ClCompile Include="View\OpRoiDlg.cpp" />
+    <ClCompile Include="View\RcutSetDLg.cpp" />
+    <ClCompile Include="View\ScanSetDlg.cpp" />
+    <ClCompile Include="View\ThresSetDlg.cpp" />
+    <ClCompile Include="View\VisionSetDlg.cpp" />
+    <ClCompile Include="Vision\BlSideData.cpp" />
+    <ClCompile Include="Vision\BlVisionLib.cpp" />
+    <ClCompile Include="Vision\Bspline.cpp" />
+    <ClCompile Include="Vision\ConfigVision.cpp" />
+    <ClCompile Include="Vision\CornerDistProcess.cpp" />
+    <ClCompile Include="Vision\CornerRcutProcess.cpp" />
+    <ClCompile Include="Vision\CutDotProcess.cpp" />
+    <ClCompile Include="Vision\CutProcess.cpp" />
+    <ClCompile Include="Vision\DistDotProcess.cpp" />
+    <ClCompile Include="Vision\FileRecipe.cpp" />
+    <ClCompile Include="Vision\GrindDotProcess.cpp" />
+    <ClCompile Include="Vision\GrindProcess.cpp" />
+    <ClCompile Include="Vision\HoleDotProcess.cpp" />
+    <ClCompile Include="Vision\HoleProcess.cpp" />
+    <ClCompile Include="Vision\InChipDotProcess.cpp" />
+    <ClCompile Include="Vision\KDistProcess.cpp" />
+    <ClCompile Include="Vision\KeyDistDotProcess.cpp" />
+    <ClCompile Include="Vision\LocProcess.cpp" />
+    <ClCompile Include="Vision\NccDotProcess.cpp" />
+    <ClCompile Include="Vision\RcutDotProcess.cpp" />
+    <ClCompile Include="Vision\SoftVisionApp.cpp" />
+    <ClCompile Include="Vision\ThresDotProcess.cpp" />
+    <ClCompile Include="Vision\ThresProcess.cpp" />
+    <ClCompile Include="Vision\TranformCoordinate.cpp" />
+    <ClCompile Include="Vision\VisionBufferPro.cpp" />
+    <ClCompile Include="Vision\VisionRecipe.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="BlVisionPro.h" />
+    <ClInclude Include="Header\BlSideData.h" />
+    <ClInclude Include="Header\BlVisionLib.h" />
+    <ClInclude Include="Header\ISoftVisionApp.h" />
+    <ClInclude Include="Header\IVisionRecipe.h" />
+    <ClInclude Include="IncludeVision.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+    <ClInclude Include="View\ChipInspectDlg.h" />
+    <ClInclude Include="View\CornerDistSetDlg.h" />
+    <ClInclude Include="View\CutSetDlg.h" />
+    <ClInclude Include="View\GrindSetDlg.h" />
+    <ClInclude Include="View\HoleSetDlg.h" />
+    <ClInclude Include="View\KDistSetDlg.h" />
+    <ClInclude Include="View\KeyVisionSetDlg.h" />
+    <ClInclude Include="View\LockSetDlg.h" />
+    <ClInclude Include="View\LocSetDlg.h" />
+    <ClInclude Include="View\MeasureSetDlg.h" />
+    <ClInclude Include="View\OpRoiDlg.h" />
+    <ClInclude Include="View\RcutSetDLg.h" />
+    <ClInclude Include="View\ScanSetDlg.h" />
+    <ClInclude Include="View\ThresSetDlg.h" />
+    <ClInclude Include="View\VisionSetDlg.h" />
+    <ClInclude Include="Vision\Bspline.h" />
+    <ClInclude Include="Vision\ConfigVision.h" />
+    <ClInclude Include="Vision\CornerDistProcess.h" />
+    <ClInclude Include="Vision\CornerRcutProcess.h" />
+    <ClInclude Include="Vision\CutDotProcess.h" />
+    <ClInclude Include="Vision\CutProcess.h" />
+    <ClInclude Include="Vision\DistDotProcess.h" />
+    <ClInclude Include="Vision\EiVisionType.h" />
+    <ClInclude Include="Vision\FileRecipe.h" />
+    <ClInclude Include="Vision\GrindDotProcess.h" />
+    <ClInclude Include="Vision\GrindProcess.h" />
+    <ClInclude Include="Vision\HoleDotProcess.h" />
+    <ClInclude Include="Vision\HoleProcess.h" />
+    <ClInclude Include="Vision\InChipDotProcess.h" />
+    <ClInclude Include="Vision\KDistProcess.h" />
+    <ClInclude Include="Vision\KeyDistDotProcess.h" />
+    <ClInclude Include="Vision\LocProcess.h" />
+    <ClInclude Include="Vision\NccDotProcess.h" />
+    <ClInclude Include="Vision\RcutDotProcess.h" />
+    <ClInclude Include="Vision\SoftVisionApp.h" />
+    <ClInclude Include="Vision\ThresDotProcess.h" />
+    <ClInclude Include="Vision\ThresProcess.h" />
+    <ClInclude Include="Vision\TranformCoordinate.h" />
+    <ClInclude Include="Vision\Vec.h" />
+    <ClInclude Include="Vision\VisionBufferPro.h" />
+    <ClInclude Include="Vision\VisionRecipe.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="BlVisionPro.def" />
+    <None Include="res\BlVisionPro.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="BlVisionPro.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\navigate_down.ico" />
+    <Image Include="res\navigate_left.ico" />
+    <Image Include="res\navigate_right.ico" />
+    <Image Include="res\navigate_up.ico" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="BlVisionPro.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/BlVisionPro/BlVisionPro.vcxproj.filters b/BlVisionPro/BlVisionPro.vcxproj.filters
new file mode 100644
index 0000000..62bf707
--- /dev/null
+++ b/BlVisionPro/BlVisionPro.vcxproj.filters
@@ -0,0 +1,348 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="Header">
+      <UniqueIdentifier>{6b9df6fc-c6e1-4fc4-bac7-12afe3d62fe2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="View">
+      <UniqueIdentifier>{fa7ebfd5-c76a-4a48-abdc-2341ef5425fd}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Vision">
+      <UniqueIdentifier>{a50739ac-00f3-4d43-bb12-9c59ab37dc44}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="func">
+      <UniqueIdentifier>{b15b5c28-2ffd-4b93-9787-55d0c57ccbe2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Vision\Vision Model">
+      <UniqueIdentifier>{406a47d3-0b5d-4946-a872-5fa6c87fd860}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Vision\Vision Dot">
+      <UniqueIdentifier>{f2bdadec-a287-4bdd-8634-801d9c7d9261}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="BlVisionPro.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="View\CornerDistSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\VisionSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\KeyVisionSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\RcutSetDLg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ScanSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\VisionRecipe.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\SoftVisionApp.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\ConfigVision.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\BlVisionLib.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\BlSideData.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\VisionBufferPro.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\TranformCoordinate.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="View\OpRoiDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\LocSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\MeasureSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\CutSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\CornerRcutProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\CutDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\DistDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\GrindDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\GrindProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\LocProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\NccDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\RcutDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\CutProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\KDistProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="View\KDistSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\GrindSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\KeyDistDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\CornerDistProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\FileRecipe.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="View\LockSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\Bspline.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ChipInspectDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\InChipDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\ThresDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\ThresProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ThresSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\HoleSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\HoleDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\HoleProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\IVisionRecipe.h">
+      <Filter>Header</Filter>
+    </ClInclude>
+    <ClInclude Include="IncludeVision.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="BlVisionPro.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ISoftVisionApp.h">
+      <Filter>Header</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\BlVisionLib.h">
+      <Filter>Header</Filter>
+    </ClInclude>
+    <ClInclude Include="View\CornerDistSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\VisionSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\BlSideData.h">
+      <Filter>Header</Filter>
+    </ClInclude>
+    <ClInclude Include="View\KeyVisionSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\RcutSetDLg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ScanSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\VisionRecipe.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\SoftVisionApp.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\ConfigVision.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\VisionBufferPro.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\TranformCoordinate.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="View\OpRoiDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\LocSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\MeasureSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\CutSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\CornerRcutProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\CutDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\DistDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\EiVisionType.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\GrindDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\GrindProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\LocProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\NccDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\RcutDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\CutProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\KDistProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="View\KDistSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\GrindSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\KeyDistDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\CornerDistProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\FileRecipe.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="View\LockSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\Vec.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\Bspline.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ChipInspectDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\InChipDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\ThresDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\ThresProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ThresSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\HoleSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\HoleDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\HoleProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="BlVisionPro.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\BlVisionPro.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="BlVisionPro.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\navigate_down.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\navigate_left.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\navigate_right.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\navigate_up.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/BlVisionPro/Header/BlSideData.h b/BlVisionPro/Header/BlSideData.h
new file mode 100644
index 0000000..d884de5
--- /dev/null
+++ b/BlVisionPro/Header/BlSideData.h
@@ -0,0 +1,91 @@
+#ifndef BL_SIDE_DATA
+#define BL_SIDE_DATA
+
+#ifdef EXPORT_BLVISION_DLL
+#include "../Lib/BaseDisplaySDK/include/typesdef.h"
+#define EXPORTED_BLVISION _declspec(dllexport)
+#else
+#define EXPORTED_BLVISION _declspec(dllimport)
+#endif
+
+
+typedef struct _SideLineInf 
+{
+	int nSideLine;
+	int nThres;
+	int left;
+	int top;
+	int width;
+	int height;
+}SideLineInf;
+
+//检测结果
+typedef struct _DispVisionResult {
+	int eDir;     //面参数
+	int nType;     //0,Point;  1;表示Rect;   2,表示圆; 3, 直线; 4,文本
+	int eVision;  //视觉类型
+	int rectX1;  //矩形参数
+	int rectY1;  //矩形参数
+	int rectX2;  //矩形参数
+	int rectY2;  //矩形参数
+	int pointX;  //点参数
+	int pointY;  //点参数
+	int circleX;  //圆参数
+	int circleY;  //圆参数
+	int circleRadius;  //圆参数 
+	CString strName;   //名称
+	int showROI;       //0,表示NG; 1,表示ROI
+}DispVisionResult;
+
+
+class EXPORTED_BLVISION CBlSideData
+{
+public:
+	CBlSideData();
+	~CBlSideData();
+
+public:
+	//1. 重置
+	void Reset(void);
+
+	//2. 获取位置
+	Point2I getPose(int nType);
+
+public:
+	//1. 分辨率
+	double	m_dPixelSizeX;   //X方向的分辨率         
+	double	m_dPixelSizeY;   //Y方向的分辨率
+
+	//2. 检测结束
+	BOOL m_bInspection_Complete;   //是否检测结速
+
+	//3.Top Mark Info
+	BOOL m_bTopMark_Find;       //是否查找TopMark
+	Point2I m_mTopMark;         //TopMark的位置
+	Point2I m_mTopBzMark;		//TopBzMark的位置
+
+	//4. Bottom Mark Info
+	BOOL m_bBotMark_Find;       //是否查找BotMark
+	Point2I m_mBotMark;         //BotMark的位置
+	Point2I m_mBotBzMark;		//BotBzMark的位置
+
+	//5. 查找Top Point
+	BOOL m_bTopPoint_Find;
+	Point2I m_mTopPoint;       //TopPoint的位置
+	Point2I m_mTopBzPoint;     //TopBzPoint的位置
+
+	//6. 查找Bot Point
+	BOOL m_bBotPoint_Find;
+	Point2I m_mBotPoint;     //BotPoint的位置
+    Point2I m_mBotBzPoint;   //BotBzPoint的位置
+
+	//7. Edge
+	int m_nStartLine;
+	int m_nEndLine;
+
+	//8. 检测结果
+	std::map<int, SideLineInf> m_mapSideLineInf;
+	std::vector<DispVisionResult> m_vDispVisionResult;
+};
+
+#endif
diff --git a/BlVisionPro/Header/BlVisionLib.h b/BlVisionPro/Header/BlVisionLib.h
new file mode 100644
index 0000000..bd8ee6c
--- /dev/null
+++ b/BlVisionPro/Header/BlVisionLib.h
@@ -0,0 +1,19 @@
+#ifndef BL_VISION_H
+#define BL_VISION_H
+
+#include "IVisionRecipe.h"
+#include "ISoftVisionApp.h"
+
+#ifdef EXPORT_BLVISION_DLL
+#define EXPORTED_BLVISION _declspec(dllexport)
+#else
+#define EXPORTED_BLVISION _declspec(dllimport)
+#endif
+
+extern "C" EXPORTED_BLVISION int BlVision_GetVersion(char *pszVersion, int nBufferSize);
+extern "C" EXPORTED_BLVISION IVisionRecipe* BlVision_GetVisionRecipe(void);
+extern "C" EXPORTED_BLVISION ISoftVisionApp* BlVision_GetSoftVisionApp(void);
+
+
+
+#endif
diff --git a/BlVisionPro/Header/ISoftVisionApp.h b/BlVisionPro/Header/ISoftVisionApp.h
new file mode 100644
index 0000000..f4c5d84
--- /dev/null
+++ b/BlVisionPro/Header/ISoftVisionApp.h
@@ -0,0 +1,110 @@
+#ifndef ISOFT_VISION_APP_H
+#define ISOFT_VISION_APP_H
+
+#include <functional>
+#include <iostream>
+
+enum DefectNgType {
+	DefectNg_OK = 0,    //OK
+	DefectNg_Chip,      //Chip
+	DefectNg_Broken,    //破损
+	DefectNg_Grind,     //研磨
+	DefectNg_Dist_Cut,  //切割精度
+	DefectNg_Corner_Dist,    //角精度
+	DefectNg_Unknown          //指错误
+};
+
+#define NG_INF_TOTAL          1000
+typedef struct _NgInfo
+{
+	int eDir;                //检测面
+	int id;                  //检测ID
+	CString strName;        //名称
+	int xPosPxl;            //X位置
+	int yPosPxl;            //Y位置
+	double result;          //结果   Measure
+	double xResult;          //结果  Chip
+	double yResult;         //结果   Chip
+	double minValue;        //下限
+	double maxValue;        //限制
+	int ngType;             //缺陷类型
+	bool isRes;             //检测结果
+	int x1;                 //缺陷的最小矩形
+	int y1;                 //缺陷的最小矩形
+	int x2;                 //缺陷的最小矩形
+	int y2;                 //缺陷的最小矩形
+	int eVision;            //视觉算法
+}NgInfo;
+
+
+//typedef std::function<void(int msgEvent, int x, int y, double rate, int pixel)> ImageVisionEvent;
+//typedef std::function<void(int code, int eDir)> ImageVisionEvent;
+
+class IVisionEvent
+{
+public:
+	//1. 接收到数据事件
+	using MsgReceivedEvent = void(*)(int code, int eDir);
+
+	//2. 日志信息
+	using MsgLogEvent = void(*)(int level, std::string strText);
+
+
+public:
+	IVisionEvent(MsgReceivedEvent msgRcvCb = nullptr, MsgLogEvent msgLogEvent = nullptr) {
+		/* code */
+		m_msgRcvCb = msgRcvCb;
+		m_msgLogCb = msgLogEvent;
+	};
+
+	void clear() {
+		/* code */
+		m_msgRcvCb = NULL;
+		m_msgLogCb = NULL;
+	}
+public:
+	MsgReceivedEvent m_msgRcvCb = NULL;
+	MsgLogEvent m_msgLogCb = NULL;
+};
+
+class ISoftVisionApp
+{
+public:
+	virtual ~ISoftVisionApp() {};
+
+public:
+	//1. 打开视觉窗体
+	virtual int OpenVisionWindow(void) = 0;
+	virtual CDialogEx* CreateVisionWindow(void) = 0;
+	virtual int ReleaseWindow(CDialogEx *pDlg) = 0;
+	virtual void ChangeDimension(CDialogEx *pDlg, int nDir) = 0;
+	virtual void SetVisionOpen(BOOL isOpen) = 0;
+
+	//2. 设置屏蔽
+	virtual void OpenKeySetWindow(void) = 0;
+
+	//3. 坐标转换
+	virtual Point2I getPose(int eDir, int xPoxPxl, int yPosPxl) = 0;
+
+	//4. 执行视觉处理
+	virtual int Execute(int eDir, NgInfo *ngArray) = 0;
+
+	//5. 设置回调时间
+	virtual void setImageEventSignal(IVisionEvent *pEvent) = 0;
+
+	//6. 坐标转换,统一坐标系统
+	virtual bool transformToStandard(int eDir, Point2I point, Point2I &result,  Point2I &topResult, Point2I &botResult) = 0;
+
+	//7. 检测Cut线
+	virtual bool findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I &result) = 0;
+	virtual double DistancePL(Point2D pose, Line2D line) = 0;
+
+	//8. 检测Norch缺陷	
+	virtual int findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres,
+		int szType, int xFzSize, int yFzSize, CRect* aryResult) = 0;
+
+	//9. 设置平台,0是平台1, 1是平台2
+    virtual void setStage(int nStage) = 0;
+};
+
+#endif
diff --git a/BlVisionPro/Header/IVisionRecipe.h b/BlVisionPro/Header/IVisionRecipe.h
new file mode 100644
index 0000000..3824565
--- /dev/null
+++ b/BlVisionPro/Header/IVisionRecipe.h
@@ -0,0 +1,67 @@
+#ifndef IVISION_RECIPE_H
+#define IVISION_RECIPE_H
+
+#define EI_VISION_RECIPE    0
+#define RCUT_VISION_RECIPE  1
+#define NI_VISION_RECIPE    2
+
+#include "BlSideData.h"
+
+//配方数据管理
+class IVisionRecipe
+{
+public:
+	virtual ~IVisionRecipe() {};
+
+public:
+	//1. 设置配方路径
+	virtual int setWorkDir(const char *pszPath) = 0;
+
+	//2. 保存
+	virtual int save(void) = 0;
+
+	//3. 打开
+	virtual int open(void) = 0;
+
+	//4. 获取采集卡
+	virtual CGrabberControl* getGrabberControl(int iCam) = 0;
+
+	//5. 设置采集开
+	virtual int setGrabberControl(CGrabberControl *pGrabberControl, int iCam) = 0;
+
+	//6. 相机相机信息
+	virtual int setCameraSetting(DimensionDir eDir, int iCam, int iScan) = 0;
+
+	//7. 初始化
+	virtual int init(void) = 0;
+
+	//8. 获取SideData
+	virtual CBlSideData* getSideData(DimensionDir eDir) = 0;
+
+	//9. 设置配方类型
+	virtual int setRecipeType(int nType) = 0;
+
+	//10. 获取配方类型
+	virtual int getRecipeType(void) = 0;
+
+	//11. 获取信息
+	virtual bool getVisionUse(void) = 0;
+
+	//12. 设置区域
+	virtual void setFrame(int x1, int y1, int x2, int y2) = 0;
+
+	//13. 设置配方名称
+	virtual int setVisionName(const char* pszPath) = 0;
+	virtual int setProductNo(const char* pszNo) = 0;
+
+	//14. 获取配方名称
+	virtual std::string getVisionName(void) = 0;
+
+	//15. 设置屏幕尺寸
+	virtual void setGlassSize(int x, int y) = 0;
+
+	//16. 窗体是否打开
+	virtual BOOL getVisionSetOpen(void) = 0;
+};
+
+#endif
diff --git a/BlVisionPro/IncludeVision.h b/BlVisionPro/IncludeVision.h
new file mode 100644
index 0000000..59be8e1
--- /dev/null
+++ b/BlVisionPro/IncludeVision.h
@@ -0,0 +1,108 @@
+#ifndef INCLUDE_VISION_H
+#define INCLUDE_VISION_H
+
+#define KEY_EI_SOFT         0
+
+#if KEY_EI_SOFT
+#include "../../EdgeInspector_App/Define/Global_Define.h"
+#else
+#include "../../ENRIT/Define/Global_Define.h"
+#endif
+
+#include <HalconCpp.h>
+#include "EiVisionType.h"
+
+//1. 日志模块
+#include "../Lib/LogSDK/include/ILogger.h"
+#include "../Lib/LogSDK/include/LogLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/LogSDK/lib/x64/Release/Log.lib")
+#else
+#pragma comment(lib,"../Lib/LogSDK/lib/x64/Release/Log.lib")
+#endif
+
+//2. 显示模块
+#include "../Lib/BaseDisplaySDK/include/typesdef.h"
+#include "../Lib/BaseDisplaySDK/include/BaseVision.h"
+#include "../Lib/BaseDisplaySDK/include/IClsShape.h"
+#include "../Lib/BaseDisplaySDK/include/IImageDisplay.h"
+#include "../Lib/BaseDisplaySDK/include/BaseDisplayLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/BaseDisplaySDK/lib/x64/Debug/BaseDisplay.lib")
+#else
+#pragma comment(lib,"../Lib/BaseDisplaySDK/lib/x64/Release/BaseDisplay.lib")
+#endif
+
+//3. Halcon 显示模块
+#include "../Lib/ApiVisionSDK/include/ClsVision.h"
+#include "../Lib/ApiVisionSDK/include/IClsDisplay.h"
+#include "../Lib/ApiVisionSDK/include/VisionLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/ApiVisionSDK/lib/x64/Debug/ApiVisionLibrary.lib")
+#else
+#pragma comment(lib,"../Lib/ApiVisionSDK/lib/x64/Release/ApiVisionLibrary.lib")
+#endif
+
+//4. 采集卡信息
+//11. 采集模块
+#include "../Lib/BlGrabber/include/FrameBufferController.h"
+#include "../Lib/BlGrabber/include/GrabberControl.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/BlGrabber/lib/x64/Debug/BlGrabberD.lib")
+#else
+#pragma comment (lib, "../Lib/BlGrabber/lib/x64/Release/BlGrabber.lib")
+#endif
+
+//9.  SISControl
+#include "../Lib/SISControls/include/CellCtrl.h"
+#include "../Lib/SISControls/include/ColorButton.h"
+#include "../Lib/SISControls/include/DefectMap.h"
+#include "../Lib/SISControls/include/FontStatic.h"
+#include "../Lib/SISControls/include/GradientStatic.h"
+#include "../Lib/SISControls/include/HeadCtrl.h"
+#include "../Lib/SISControls/include/InPlaceComboBox.h"
+#include "../Lib/SISControls/include/InPlaceEdit.h"
+#include "../Lib/SISControls/include/LogCtrl.h"
+#include "../Lib/SISControls/include/SISButton.h"
+#include "../Lib/SISControls/include/SISFolderScheduling.h"
+#include "../Lib/SISControls/include/SISJogBtn2Parent.h"
+#include "../Lib/SISControls/include/SISJogButton.h"
+#include "../Lib/SISControls/include/SISLabel.h"
+#include "../Lib/SISControls/include/SISListBoxLog.h"
+#include "../Lib/SISControls/include/SISListCtrlExt.h"
+#include "../Lib/SISControls/include/SortClass.h"
+#include "../Lib/SISControls/include/StaticMap.h"
+#include "../Lib/SISControls/include/WKButton.h"
+#include "../Lib/SISControls/include/XTabCtrl.h"
+#include "../Lib/SISControls/GridControl/CellRange.h"
+#include "../Lib/SISControls/GridControl/GridCell.h"
+#include "../Lib/SISControls/GridControl/GridCellBase.h"
+#include "../Lib/SISControls/GridControl/GridCellButton.h"
+#include "../Lib/SISControls/GridControl/GridCtrl.h"
+#include "../Lib/SISControls/GridControl/GridDropTarget.h"
+#include "../Lib/SISControls/GridControl/GridInPlaceEdit.h"
+#include "../Lib/SISControls/GridControl/GridMemDC.h"
+#include "../Lib/SISControls/GridControl/TitleTip.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellCheck.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellCombo.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridURLCell.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/SISControls/lib/x64/Debug/SISControlsD.lib")
+#else
+#pragma comment (lib, "../Lib/SISControls/lib/x64/Release/SISControls.lib")
+#endif
+
+#include "../Lib/JsoncppSDK/include/json.h"
+#include "../Lib/JsoncppSDK/include/config.h"
+#include "../Lib/JsoncppSDK/include/reader.h"
+#include "../Lib/JsoncppSDK/include/value.h"
+#include "../Lib/JsoncppSDK/include/writer.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/JsoncppSDK/lib/x64/Debug/jsoncpp.lib")
+#else
+#pragma comment (lib, "../Lib/JsoncppSDK/lib/x64/Release/jsoncpp.lib")
+#endif
+
+#endif
diff --git a/BlVisionPro/ReadMe.txt b/BlVisionPro/ReadMe.txt
new file mode 100644
index 0000000..afe5c6c
--- /dev/null
+++ b/BlVisionPro/ReadMe.txt
@@ -0,0 +1,45 @@
+锘�========================================================================
+    MICROSOFT 鍩虹绫诲簱 : BlVisionPro 椤圭洰姒傝堪
+========================================================================
+
+
+搴旂敤绋嬪簭鍚戝宸蹭负鎮ㄥ垱寤轰簡姝� BlVisionPro DLL銆傛 DLL 涓嶄粎婕旂ず Microsoft 鍩虹绫荤殑鍩烘湰浣跨敤鏂规硶锛岃繕鍙綔涓烘偍缂栧啓 DLL 鐨勮捣鐐广��
+
+鏈枃浠舵瑕佷粙缁嶇粍鎴� BlVisionPro DLL 鐨勬瘡涓枃浠剁殑鍐呭銆�
+
+BlVisionPro.vcxproj
+    杩欐槸浣跨敤搴旂敤绋嬪簭鍚戝鐢熸垚鐨� VC++ 椤圭洰鐨勪富椤圭洰鏂囦欢锛屽叾涓寘鍚敓鎴愯鏂囦欢鐨� Visual C++ 鐨勭増鏈俊鎭紝浠ュ強鏈夊叧浣跨敤搴旂敤绋嬪簭鍚戝閫夋嫨鐨勫钩鍙般�侀厤缃拰椤圭洰鍔熻兘鐨勪俊鎭��
+
+BlVisionPro.vcxproj.filters
+    杩欐槸浣跨敤鈥滃簲鐢ㄧ▼搴忓悜瀵尖�濈敓鎴愮殑 VC++ 椤圭洰绛涢�夊櫒鏂囦欢銆傚畠鍖呭惈鏈夊叧椤圭洰鏂囦欢涓庣瓫閫夊櫒涔嬮棿鐨勫叧鑱斾俊鎭�傚湪 IDE 涓紝閫氳繃杩欑鍏宠仈锛屽湪鐗瑰畾鑺傜偣涓嬩互鍒嗙粍褰㈠紡鏄剧ず鍏锋湁鐩镐技鎵╁睍鍚嶇殑鏂囦欢銆備緥濡傦紝鈥�.cpp鈥濇枃浠朵笌鈥滄簮鏂囦欢鈥濈瓫閫夊櫒鍏宠仈銆�
+
+BlVisionPro.h
+    杩欐槸 DLL 鐨勪富澶存枃浠躲�傚畠澹版槑浜� CBlVisionProApp 绫汇��
+
+BlVisionPro.cpp
+    杩欐槸涓� DLL 婧愭枃浠躲�傚畠鍖呭惈 CBlVisionProApp 绫汇��
+
+BlVisionPro.rc
+    杩欐槸绋嬪簭浣跨敤鐨勬墍鏈� Microsoft Windows 璧勬簮鐨勫垪琛ㄣ�傚畠鍖呮嫭 RES 瀛愮洰褰曚腑瀛樺偍鐨勫浘鏍囥�佷綅鍥惧拰鍏夋爣銆傛鏂囦欢鍙互鐩存帴鍦� Microsoft Visual C++ 涓繘琛岀紪杈戙��
+
+res\BlVisionPro.rc2
+    姝ゆ枃浠跺寘鍚笉鍦� Microsoft Visual C++ 涓繘琛岀紪杈戠殑璧勬簮銆傛偍搴旇灏嗕笉鍙敱璧勬簮缂栬緫鍣ㄧ紪杈戠殑鎵�鏈夎祫婧愭斁鍦ㄦ鏂囦欢涓��
+
+BlVisionPro.def
+    姝ゆ枃浠跺寘鍚湪 Microsoft Windows 涓繍琛屾墍蹇呴渶鐨� DLL 鐨勬湁鍏充俊鎭�傚畠瀹氫箟浜� DLL 鐨勫悕绉板拰璇存槑绛夊弬鏁帮紝鑰屼笖杩樹粠 DLL 瀵煎嚭鍑芥暟銆�
+
+/////////////////////////////////////////////////////////////////////////////
+鍏朵粬鏍囧噯鏂囦欢:
+
+StdAfx.h, StdAfx.cpp
+    杩欎簺鏂囦欢鐢ㄤ簬鐢熸垚鍚嶄负 BlVisionPro.pch 鐨勯缂栬瘧澶� (PCH) 鏂囦欢鍜屽悕涓� StdAfx.obj 鐨勯缂栬瘧绫诲瀷鏂囦欢銆�
+
+Resource.h
+    杩欐槸鏍囧噯澶存枃浠讹紝鍙敤浜庡畾涔夋柊鐨勮祫婧� ID銆侻icrosoft Visual C++ 灏嗚鍙栧苟鏇存柊姝ゆ枃浠躲��
+
+/////////////////////////////////////////////////////////////////////////////
+鍏朵粬娉ㄩ噴:
+
+搴旂敤绋嬪簭鍚戝浣跨敤鈥淭ODO:鈥濇潵鎸囩ず搴旀坊鍔犳垨鑷畾涔夌殑婧愪唬鐮侀儴鍒嗐��
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/BlVisionPro/View/ChipInspectDlg.cpp b/BlVisionPro/View/ChipInspectDlg.cpp
new file mode 100644
index 0000000..8b2dc0c
--- /dev/null
+++ b/BlVisionPro/View/ChipInspectDlg.cpp
@@ -0,0 +1,185 @@
+// ChipInspectDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "ChipInspectDlg.h"
+#include "afxdialogex.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+#include "InChipDotProcess.h"
+
+// CChipInspectDlg 对话框
+
+IMPLEMENT_DYNAMIC(CChipInspectDlg, CDialogEx)
+
+CChipInspectDlg::CChipInspectDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_CHIP_INSPECT, pParent)
+	, m_imageIndex(1)
+	, m_nMinX(0)
+	, m_nMaxX(0)
+	, m_nEdgeChipThres(20)
+{
+	m_display = NULL;
+	m_ptMouseUp.x = 0;
+	m_ptMouseUp.y = 0;
+}
+
+CChipInspectDlg::~CChipInspectDlg()
+{
+	if (NULL != m_display) {
+		ClsDisplay_Free(m_display);
+		m_display = NULL;
+	}
+}
+
+void CChipInspectDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_COMBO_SIDE_INDEX_INCHIP, m_combSide);
+	DDX_Text(pDX, IDC_EDIT_IMAGE_INDEX_INCHIP, m_imageIndex);
+	DDX_Text(pDX, IDC_EDIT_INCHIP_MINX, m_nMinX);
+	DDX_Text(pDX, IDC_EDIT_INCHIP_MAXX, m_nMaxX);
+	DDX_Text(pDX, IDC_EDIT_EDGE_THRES_INCHIP, m_nEdgeChipThres);
+}
+
+
+BEGIN_MESSAGE_MAP(CChipInspectDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_GET_IMAGE_INCHIP, &CChipInspectDlg::OnBnClickedButtonGetImageInchip)
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_INCHIP, &CChipInspectDlg::OnBnClickedButtonProcessInchip)
+END_MESSAGE_MAP()
+
+
+// CChipInspectDlg 消息处理程序
+
+
+BOOL CChipInspectDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CChipInspectDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitDisplay();
+
+	InitUiParam();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+
+void CChipInspectDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+void CChipInspectDlg::InitDisplay(void) {
+	/* code */
+	m_display = ClsDisplay_Create();
+	if (nullptr != m_display) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_IMAGE_INCHIP);
+		pDispWnd->GetWindowRect(rect);
+		m_display->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_display->SetOperFlag(SELECT_OPER_FLAG);
+		m_display->SetDraw("fill", DISP_OBJECT);
+		m_display->SetColor("red", DISP_OBJECT);
+
+		m_display->SetDraw("fill", DISP_REGION);
+		m_display->SetColor("red", DISP_REGION);
+
+		m_display->SetDraw("fill", DISP_CROSS);
+		m_display->SetColor("green", DISP_CROSS);
+
+		m_display->SetDraw("fill", DISP_SELECT);
+		m_display->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_display->SetBackgroundColor(color);
+		m_display->SetOperatorCallback([&](int msgEvent, int x, int y, double rate, int pixel) ->void {
+			MouseEventProc(msgEvent, x, y);  //1. 表示扫描
+		});
+	}
+}
+
+void CChipInspectDlg::MouseEventProc(int msgEvent, int x, int y) {
+	/* code */
+	BOOL isChange = FALSE;
+	if (LEFT_MOUSE_BUTTON_UP == msgEvent) {
+		m_ptMouseUp.x = x;
+		m_ptMouseUp.y = y;
+		isChange = TRUE;
+	}
+
+	CString msg;
+	msg.Format(_T("Pose: (%d, %d)"), m_ptMouseUp.x, m_ptMouseUp.y);
+	std::string str = CFileRecipe::toString(msg);
+	if (isChange) {
+		m_display->ClearWindow();
+		m_display->DispImage();
+	}
+	m_display->DispMessage(30, 30, str, "blue", "false");
+}
+
+void CChipInspectDlg::OnBnClickedButtonGetImageInchip()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	UpdateData(TRUE);
+
+	int nSide = m_combSide.GetCurSel();
+	DimensionDir eDir = (DimensionDir)nSide;
+	if (!CVisionBufferPro::getIndexImage(eDir, &m_display->GetImage(), m_imageIndex)) return;
+
+	m_display->ClearWindow();
+	m_display->DispImage();
+}
+
+void CChipInspectDlg::InitUiParam(void) {
+	/* code */
+	m_combSide.InsertString(0, _T("TopA"));
+	m_combSide.InsertString(1, _T("TopB"));
+	m_combSide.InsertString(2, _T("TopC"));
+	m_combSide.InsertString(3, _T("TopD"));
+	m_combSide.InsertString(4, _T("DotA"));
+	m_combSide.InsertString(5, _T("DotB"));
+	m_combSide.InsertString(6, _T("DotC"));
+	m_combSide.InsertString(7, _T("DotD"));
+	m_combSide.SetCurSel(0);
+}
+
+
+void CChipInspectDlg::OnBnClickedButtonProcessInchip()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	UpdateData(TRUE);
+
+	int nSide = m_combSide.GetCurSel();
+	DimensionDir eDir = (DimensionDir)nSide;
+	CInChipDotProcess *dot = new CInChipDotProcess(eDir);
+
+	Point2I ptStart, ptEnd;
+	ptStart.x = m_nMinX;
+	ptStart.y = 0;
+	ptEnd.x = m_nMaxX;
+	ptEnd.y = 1023;
+	dot->m_threshold = m_nEdgeChipThres;
+	dot->Execute(eDir, m_imageIndex, ptStart, ptEnd);
+
+	delete dot;
+	dot = NULL;
+}
diff --git a/BlVisionPro/View/ChipInspectDlg.h b/BlVisionPro/View/ChipInspectDlg.h
new file mode 100644
index 0000000..069e71e
--- /dev/null
+++ b/BlVisionPro/View/ChipInspectDlg.h
@@ -0,0 +1,52 @@
+#pragma once
+#include "afxwin.h"
+
+
+// CChipInspectDlg 对话框
+
+class CChipInspectDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CChipInspectDlg)
+
+public:
+	CChipInspectDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CChipInspectDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_CHIP_INSPECT };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	afx_msg void OnBnClickedButtonGetImageInchip();
+
+private:
+	IClsDisplay *m_display;
+	CComboBox m_combSide;
+	int m_imageIndex;
+	Point2I m_ptMouseUp;
+
+	int m_nMinX;
+	int m_nMaxX;
+	int m_nEdgeChipThres;
+
+private:
+	//1. 初始化
+	void InitDisplay(void);
+
+	//2. 界面初始化
+	void InitUiParam(void);
+
+	//3. 执行
+	void MouseEventProc(int msgEvent, int x, int y);
+	
+public:
+	afx_msg void OnBnClickedButtonProcessInchip();
+};
diff --git a/BlVisionPro/View/CornerDistSetDlg.cpp b/BlVisionPro/View/CornerDistSetDlg.cpp
new file mode 100644
index 0000000..257001c
--- /dev/null
+++ b/BlVisionPro/View/CornerDistSetDlg.cpp
@@ -0,0 +1,804 @@
+// CornerDistSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "CornerDistSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionBufferPro.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "MeasureSetDlg.h"
+
+// CCornerDistSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CCornerDistSetDlg, CDialogEx)
+
+CCornerDistSetDlg::CCornerDistSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DLG_DIST_CORNER, pParent)
+	, m_id(0)
+	, m_strName(_T("NULL"))
+	, m_refer(100)
+	, m_refer_(100)
+	, m_minValue(0)
+	, m_maxValue(0)
+	, m_minValue2(0)
+	, m_maxValue2(0)
+	, m_incValue(0)
+	, m_incValue2(0)
+{
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+	m_topPoint.x = 0;
+	m_topPoint.y = 0;
+	m_botPoint.x = 0;
+	m_botPoint.y = 0;
+
+	m_pos.x = 0;
+	m_pos.y = 0;
+
+	m_eDir = DIMENSION_NONE;
+
+	m_dotDist = NULL;
+	m_dot = NULL;
+}
+
+CCornerDistSetDlg::~CCornerDistSetDlg()
+{
+	SaveDistCorner();
+	SaveDistDotProcess();
+}
+
+void CCornerDistSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_LIST_DIST_DOT, m_listCornerPoint);
+	DDX_Control(pDX, IDC_COMBOMK_FIRST_REFER_TYPE_DIST, m_combFrirtRefer);            //First Refer
+
+	DDX_Text(pDX, IDC_EDIT_TOP_MARK_X_DIST, m_topMark.x);  //Top Mark
+	DDX_Text(pDX, IDC_EDIT_TOP_MARK_Y_DIST, m_topMark.y);
+	DDX_Text(pDX, IDC_EDIT_BOT_MARK_X_DIST, m_botMark.x);    //Bot Mark
+	DDX_Text(pDX, IDC_EDIT_BOT_MARK_Y_DIST, m_botMark.y);
+	DDX_Text(pDX, IDC_EDIT_TOP_POINT_X_DIST, m_topPoint.x);   //Top Point
+	DDX_Text(pDX, IDC_EDIT_TOP_POINT_Y_DIST, m_topPoint.y);
+	DDX_Text(pDX, IDC_EDIT_BOT_POINT_X_DIST, m_botPoint.x);    //Bot Point
+	DDX_Text(pDX, IDC_EDIT_BOT_POINT_Y_DIST, m_botPoint.y);
+	
+	DDX_Text(pDX, IDC_EDIT_ID_DIST, m_id);
+	DDX_Text(pDX, IDC_EDIT_NAME_DIST, m_strName);
+
+	DDX_Text(pDX, IDC_EDIT_POS_X_DIST, m_pos.x);
+	DDX_Text(pDX, IDC_EDIT_POS_Y_DIST, m_pos.y);
+	DDX_Text(pDX, IDC_EDIT_INC_REFER_DIST, m_refer);
+	DDX_Text(pDX, IDC_EDIT_DEC_REFER_DIST, m_refer_);
+
+	DDX_Control(pDX, IDC_COMBO_DIST_MODE_DIST, m_combDistMode);           //DIST Mode
+	DDX_Text(pDX, IDC_EDIT_MIN_VAL_DIST, m_minValue);
+	DDX_Text(pDX, IDC_EDIT_MAX_VAL_DIST, m_maxValue);
+
+	DDX_Control(pDX, IDC_COMBO_DIST_MODE_DIST2, m_combDistMode2);           //DIST Mode
+	DDX_Text(pDX, IDC_EDIT_MIN_VAL_DIST2, m_minValue2);
+	DDX_Text(pDX, IDC_EDIT_MAX_VAL_DIST2, m_maxValue2);
+
+	DDX_Control(pDX, IDC_COMBO_NG_TYPE_DIST, m_combNgType);           //DIST Mode
+	DDX_Control(pDX, IDC_COMBO_NG_TYPE_DIST2, m_combNgType2);           //DIST Mode
+
+	DDX_Text(pDX, IDC_EDIT_INC_DIST, m_incValue);
+	DDX_Text(pDX, IDC_EDIT_INC_DIST2, m_incValue2);
+}
+
+
+BEGIN_MESSAGE_MAP(CCornerDistSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_NOTIFY(NM_CLICK, IDC_LIST_DIST_DOT, &CCornerDistSetDlg::OnNMClickListDistDot)
+	ON_BN_CLICKED(IDC_BUTTON_MODEL_ROI, &CCornerDistSetDlg::OnBnClickedButtonModelRoi)
+	ON_BN_CLICKED(IDC_BUTTON_MEASURE_ROI, &CCornerDistSetDlg::OnBnClickedButtonMeasureRoi)
+	ON_BN_CLICKED(IDC_BUTTON_DIST_TEST_ALL, &CCornerDistSetDlg::OnBnClickedButtonDistTestAll)
+	ON_BN_CLICKED(IDC_BUTTON_LOCK_MARK_DIST, &CCornerDistSetDlg::OnBnClickedButtonLockMarkDist)
+	ON_BN_CLICKED(IDC_BUTTON_COPY_TOP_MARK_DIST, &CCornerDistSetDlg::OnBnClickedButtonCopyTopMarkDist)
+	ON_NOTIFY(NM_RCLICK, IDC_LIST_DIST_DOT, &CCornerDistSetDlg::OnNMRClickListDistDot)
+	ON_COMMAND(ID_VISION_DELETE, &CCornerDistSetDlg::OnVisionDelete)
+	ON_COMMAND(ID_ADD_DIST, &CCornerDistSetDlg::OnAddDist)
+	ON_COMMAND(ID_Menu_Measure_Set, &CCornerDistSetDlg::OnMenuMeasureSet)
+	ON_COMMAND(ID_EDITROI_DRAWKEYROI, &CCornerDistSetDlg::OnEditroiDrawkeyroi)
+	ON_COMMAND(ID_EDITROI_DRAWMEASUREROI, &CCornerDistSetDlg::OnEditroiDrawmeasureroi)
+	ON_COMMAND(ID_EDITROI_DELETEALLROI, &CCornerDistSetDlg::OnEditroiDeleteallroi)
+END_MESSAGE_MAP()
+
+
+// CDistCornerSetDlg 消息处理程序
+
+
+BOOL CCornerDistSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	//1. 窗体UI
+	InitWindUi();
+
+	ChangeVisionType(DIMENSION_NONE);
+
+	m_eDotIndex = -1;
+	ChangeCornerDotIdx(-1);
+
+	//3. 显示所有的参数
+	dispListParam();
+
+	LockImage(-1);
+	m_isLockPoint = TRUE;
+	LockMark(m_isLockPoint);
+
+	InitMenu();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CCornerDistSetDlg::InitWindUi(void) {
+	/* code */
+	InitPointUi();
+
+	m_combFrirtRefer.InsertString(0, _T("First Type"));
+	m_combFrirtRefer.InsertString(1, _T("Second Type"));
+	m_combFrirtRefer.InsertString(2, _T("Thrid Type"));
+	m_combFrirtRefer.InsertString(3, _T("Fourth Type"));
+	m_combFrirtRefer.SetCurSel(0);
+
+	m_combDistMode.InsertString(0, _T("false"));
+	m_combDistMode.InsertString(1, _T("Grind Size"));
+	m_combDistMode.InsertString(2, _T("Top Point"));
+	m_combDistMode.InsertString(3, _T("Bot Point"));
+	m_combDistMode.InsertString(4, _T("Key Dist"));
+	m_combDistMode.InsertString(5, _T("Cut Dist"));
+	m_combDistMode.SetCurSel(0);
+
+	m_combDistMode2.InsertString(0, _T("false"));
+	m_combDistMode2.InsertString(1, _T("Grind Size"));
+	m_combDistMode2.InsertString(2, _T("Top Point"));
+	m_combDistMode2.InsertString(3, _T("Bot Point"));
+	m_combDistMode2.InsertString(4, _T("Key Dist"));
+	m_combDistMode2.InsertString(5, _T("Cut Dist"));
+	m_combDistMode2.SetCurSel(0);
+
+	const CString ng_array_type[] = {
+		_T("Chip"),
+		_T("Broken"),
+		_T("Grind"),
+		_T("Dist Cut"),
+		_T("Corner Dist"),
+		_T("Unkown NG")
+	};
+	int ngNum = 6;
+	for (int i = 0; i < ngNum; i++) {
+		m_combNgType.InsertString(i, ng_array_type[i]);
+		m_combNgType2.InsertString(i, ng_array_type[i]);
+	}
+	m_combNgType.SetCurSel(2);
+	m_combNgType2.SetCurSel(3);
+
+	CString strCaption = _T("");
+	GetDlgItem(IDC_STATIC_DIST_RESULT_DIST)->SetWindowText(strCaption);
+	GetDlgItem(IDC_STATIC_DIST_RESULT_DIST2)->SetWindowText(strCaption);
+}
+
+void CCornerDistSetDlg::InitPointUi(void) {
+	/* code */
+	CRect rect;
+	m_listCornerPoint.GetClientRect(&rect);
+
+	// 为列表视图控件添加全行选中和栅格风格   
+	m_listCornerPoint.SetExtendedStyle(m_listCornerPoint.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_DOUBLEBUFFER);
+
+	// 为列表视图控件添加三列   
+	int nCount = 13;
+	m_listCornerPoint.InsertColumn(0, _T("ID"), LVCFMT_CENTER, rect.Width() / nCount, 0);
+	m_listCornerPoint.InsertColumn(1, _T("Name"), LVCFMT_CENTER, rect.Width() / nCount, 1);
+	m_listCornerPoint.InsertColumn(2, _T("Refer Index"), LVCFMT_CENTER, rect.Width() / nCount, 2);
+	m_listCornerPoint.InsertColumn(3, _T("X"), LVCFMT_CENTER, rect.Width() / nCount, 3);
+	m_listCornerPoint.InsertColumn(4, _T("Y"), LVCFMT_CENTER, rect.Width() / nCount, 4);
+	m_listCornerPoint.InsertColumn(5, _T("Pos+"), LVCFMT_CENTER, rect.Width() / nCount, 5);
+	m_listCornerPoint.InsertColumn(6, _T("Pos-"), LVCFMT_CENTER, rect.Width() / nCount, 6);
+	m_listCornerPoint.InsertColumn(7, _T("First Judge"), LVCFMT_CENTER, rect.Width() / nCount, 7);
+	m_listCornerPoint.InsertColumn(8, _T("Min1"), LVCFMT_CENTER, rect.Width() / nCount, 8);
+	m_listCornerPoint.InsertColumn(9, _T("Max1"), LVCFMT_CENTER, rect.Width() / nCount, 9);
+	m_listCornerPoint.InsertColumn(10, _T("Second Judge"), LVCFMT_CENTER, rect.Width() / nCount, 10);
+	m_listCornerPoint.InsertColumn(11, _T("Min2"), LVCFMT_CENTER, rect.Width() / nCount, 11);
+	m_listCornerPoint.InsertColumn(12, _T("Max2"), LVCFMT_CENTER, rect.Width() / nCount, 12);
+}
+
+
+void CCornerDistSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CCornerDistSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CCornerDistSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveDistCorner();
+
+	//2. 显示当前的数据
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getCornerDistProcess(eDir);
+	ShowDistCornerParam();
+
+	ChangeCornerDotIdx(-1);
+	int curIndex = m_eDotIndex;
+	ChangeCornerDotIdx(curIndex);
+
+	LockMark(TRUE);
+}
+
+void CCornerDistSetDlg::ShowDistCornerParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	m_topMark = m_dot->getPoint(0);
+	m_botMark = m_dot->getPoint(1);
+	m_topPoint = m_dot->getPoint(2);
+	m_botPoint = m_dot->getPoint(3);
+
+	UpdateData(FALSE);
+}
+
+void CCornerDistSetDlg::SaveDistCorner(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+}
+
+void CCornerDistSetDlg::ChangeCornerDotIdx(int eIdx) {
+	/* code */
+	SaveDistDotProcess();
+
+	if (eIdx == m_eDotIndex) {
+		return;
+	}
+
+	m_eDotIndex = eIdx;
+	m_dotDist = m_dot->getDot(eIdx);
+
+	ShowDistDotParam();
+	LockImage(-1);
+}
+
+void CCornerDistSetDlg::ShowDistDotParam(void) {
+	/* code */
+	if (-1 == m_eDotIndex) return;
+	if (NULL == m_dotDist) return;
+
+	m_combFrirtRefer.SetCurSel(m_dotDist->m_idxRefer);
+	m_strName = m_dotDist->m_strName;
+	m_pos = m_dotDist->getPose();
+
+	m_id = m_dotDist->getID();
+	m_refer = m_dotDist->m_nRef;
+	m_refer_ = m_dotDist->m_nRef_;
+
+	m_combDistMode.SetCurSel(m_dotDist->m_distMode);
+	m_minValue = m_dotDist->m_minValue;
+	m_maxValue = m_dotDist->m_maxValue;
+	m_combNgType.SetCurSel(m_dotDist->m_ngType - 1);
+	m_incValue = m_dotDist->m_incValue;
+
+	m_combDistMode2.SetCurSel(m_dotDist->m_distMode2);
+	m_minValue2 = m_dotDist->m_minValue2;
+	m_maxValue2 = m_dotDist->m_maxValue2;
+	m_combNgType2.SetCurSel(m_dotDist->m_ngType2 - 1);
+	m_incValue2 = m_dotDist->m_incValue2;
+
+	//保存参数
+	dispRegion();
+
+	UpdateData(FALSE);
+}
+
+void CCornerDistSetDlg::dispRegion(void) {
+	/* code */
+}
+
+void CCornerDistSetDlg::SaveDistDotProcess(void) {
+	/* code */
+	if (NULL == m_dotDist) return;
+
+	UpdateData(TRUE);
+
+	SaveDistCorner();
+
+	m_dotDist->m_idxRefer = m_combFrirtRefer.GetCurSel();
+	m_dotDist->m_strName = m_strName;
+	m_dotDist->m_nRef = m_refer;
+	m_dotDist->m_nRef_ = m_refer_;
+
+	m_dotDist->m_distMode = m_combDistMode.GetCurSel();
+	m_dotDist->m_minValue = m_minValue;
+	m_dotDist->m_maxValue = m_maxValue;
+	m_dotDist->m_ngType = m_combNgType.GetCurSel() + 1;
+	m_dotDist->m_incValue = m_incValue;
+
+	m_dotDist->m_distMode2 = m_combDistMode2.GetCurSel();
+	m_dotDist->m_minValue2 = m_minValue2;
+	m_dotDist->m_maxValue2 = m_maxValue2;
+	m_dotDist->m_ngType2 = m_combNgType2.GetCurSel() + 1;
+	m_dotDist->m_incValue2 = m_incValue2;
+
+	int nCount = m_listCornerPoint.GetItemCount();
+	int id = m_dotDist->getID();
+	std::vector<CDistDotProcess*> vDots = m_dot->getDots();
+
+	int nNum = (int)(vDots.size());
+	if (nCount != nNum) return; 
+
+	Point2I pose;
+	for (int index = 0; index < nCount; index++){
+		CDistDotProcess *pSelectDot = vDots.at(index);
+		if (NULL == pSelectDot) continue;
+		if (pSelectDot->getID() != id)  continue;
+		CDistDotProcess *dot = m_dotDist;
+		if (NULL == dot) return;
+		CString strText;
+		int i = index;
+		//0. ID值
+		strText.Format(_T("%d"), dot->getID());
+		m_listCornerPoint.SetItemText(i, 0, strText);
+
+		//1. 名称
+		strText = dot->m_strName;
+		m_listCornerPoint.SetItemText(i, 1, strText);
+
+		//2. Refer Type
+		strText = _T("First Type");
+		if (1 == dot->m_idxRefer) {
+			strText = _T("Second Type");
+		}
+		else if (2 == dot->m_idxRefer) {
+			strText = _T("Third Type");
+		}
+		else if (3 == dot->m_idxRefer) {
+			strText = _T("Fourth Type");
+		}
+		m_listCornerPoint.SetItemText(i, 2, strText);
+
+		//3. X
+		pose  = dot->getPose();
+		strText.Format(_T("%d"), pose.x);
+		m_listCornerPoint.SetItemText(i, 3, strText);
+
+		//4. Y
+		strText.Format(_T("%d"), pose.y);
+		m_listCornerPoint.SetItemText(i, 4, strText);
+
+		//5.ref
+		strText.Format(_T("%d"), dot->m_nRef);
+		m_listCornerPoint.SetItemText(i, 5, strText);
+
+		//6. ref_
+		strText.Format(_T("%d"), dot->m_nRef_);
+		m_listCornerPoint.SetItemText(i, 6, strText);
+
+		//7. Dist Mode
+		strText = _T("false");
+		if (1 == dot->m_distMode) {
+			strText = _T("Grind Size");
+		}
+		else if (2 == dot->m_distMode) {
+			strText = _T("Top Point");
+		}
+		else if (3 == dot->m_distMode) {
+			strText = _T("Bot Point");
+		}
+		else if (4 == dot->m_distMode) {
+			strText = _T("Key Dist");
+		}
+		else if (5 == dot->m_distMode) {
+			strText = _T("Cut Dist");
+		}
+		m_listCornerPoint.SetItemText(i, 7, strText);
+
+		//8. 邻近距离最小值
+		strText.Format(_T("%d"), dot->m_minValue);
+		m_listCornerPoint.SetItemText(i, 8, strText);
+
+		//9. 邻近距离最大值
+		strText.Format(_T("%d"), dot->m_maxValue);
+		m_listCornerPoint.SetItemText(i, 9, strText);
+
+		//10. Dist Mode
+		strText = _T("false");
+		if (1 == dot->m_distMode2) {
+			strText = _T("Grind Size");
+		}
+		else if (2 == dot->m_distMode2) {
+			strText = _T("Top Point");
+		}
+		else if (3 == dot->m_distMode2) {
+			strText = _T("Bot Point");
+		}
+		else if (4 == dot->m_distMode2) {
+			strText = _T("Key Dist");
+		}
+		else if (5 == dot->m_distMode2) {
+			strText = _T("Cut Dist");
+		}
+		m_listCornerPoint.SetItemText(i, 10, strText);
+
+		//11. 邻近距离最小值
+		strText.Format(_T("%d"), dot->m_minValue2);
+		m_listCornerPoint.SetItemText(i, 11, strText);
+
+		//12. 邻近距离最大值
+		strText.Format(_T("%d"), dot->m_maxValue2);
+		m_listCornerPoint.SetItemText(i, 12, strText);
+
+		break;
+	}
+}
+
+
+int CCornerDistSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+	dispListParam();
+	return 0;
+}
+
+void CCornerDistSetDlg::dispListParam(void) {
+	/* code */
+	m_listCornerPoint.DeleteAllItems();
+	if (NULL == m_dot)  return;
+
+	//1. 获取数据
+	std::vector<CDistDotProcess*> &vDots = m_dot->getDots();
+	int nCount = (int)(vDots.size());
+	if (nCount < 1) return;
+
+	CString strText;
+	Point2I pose;
+	for (int i = 0; i < nCount; i++) {
+		CDistDotProcess *dot = vDots.at(i); 
+		if (NULL == dot) continue;
+		//0. ID值
+		strText.Format(_T("%d"), dot->getID());
+		m_listCornerPoint.InsertItem(i, strText);
+
+		//1. 名称
+		strText = dot->m_strName;
+		m_listCornerPoint.SetItemText(i, 1, strText);
+
+		//2. Refer Type
+		strText = _T("First Type");
+		if (1 == dot->m_idxRefer) {
+			strText = _T("Second Type");
+		}
+		else if (2 == dot->m_idxRefer) {
+			strText = _T("Third Type");
+		}
+		else if (3 == dot->m_idxRefer) {
+			strText = _T("Fourth Type");
+		}
+		m_listCornerPoint.SetItemText(i, 2, strText);
+
+		//3. X
+		pose = dot->getPose();
+		strText.Format(_T("%d"), pose.x);
+		m_listCornerPoint.SetItemText(i, 3, strText);
+
+		//4. Y
+		strText.Format(_T("%d"), pose.y);
+		m_listCornerPoint.SetItemText(i, 4, strText);
+
+		//5.ref
+		strText.Format(_T("%d"), dot->m_nRef);
+		m_listCornerPoint.SetItemText(i, 5, strText);
+
+		//6. ref_
+		strText.Format(_T("%d"), dot->m_nRef_);
+		m_listCornerPoint.SetItemText(i, 6, strText);
+
+		//7. Dist Mode
+		strText = _T("false");
+		if (1 == dot->m_distMode) {
+			strText = _T("Grind Size");
+		}
+		else if (2 == dot->m_distMode) {
+			strText = _T("Top Point");
+		}
+		else if (3 == dot->m_distMode) {
+			strText = _T("Bot Point");
+		}
+		else if (4 == dot->m_distMode) {
+			strText = _T("Key Dist");
+		}
+		else if (5 == dot->m_distMode) {
+			strText = _T("Cut Dist");
+		}
+		m_listCornerPoint.SetItemText(i, 7, strText);
+
+		//8. 邻近距离最小值
+		strText.Format(_T("%d"), dot->m_minValue);
+		m_listCornerPoint.SetItemText(i, 8, strText);
+
+		//9. 邻近距离最大值
+		strText.Format(_T("%d"), dot->m_maxValue);
+		m_listCornerPoint.SetItemText(i, 9, strText);
+
+		//10. Dist Mode
+		strText = _T("false");
+		if (1 == dot->m_distMode2) {
+			strText = _T("Grind Size");
+		}
+		else if (2 == dot->m_distMode2) {
+			strText = _T("Top Point");
+		}
+		else if (3 == dot->m_distMode2) {
+			strText = _T("Bot Point");
+		}
+		else if (4 == dot->m_distMode2) {
+			strText = _T("Key Dist");
+		}
+		else if (5 == dot->m_distMode2) {
+			strText = _T("Cut Dist");
+		}
+		m_listCornerPoint.SetItemText(i, 10, strText);
+
+		//11. 邻近距离最小值
+		strText.Format(_T("%d"), dot->m_minValue2);
+		m_listCornerPoint.SetItemText(i, 11, strText);
+
+		//12. 邻近距离最大值
+		strText.Format(_T("%d"), dot->m_maxValue2);
+		m_listCornerPoint.SetItemText(i, 12, strText);
+	}
+}
+
+
+void CCornerDistSetDlg::OnNMClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
+	// TODO: 在此添加控件通知处理程序代码
+	NM_LISTVIEW  *plisCtrl = (NM_LISTVIEW *)pNMHDR;
+	CString strID = m_listCornerPoint.GetItemText(plisCtrl->iItem, 0);
+	int id = atoi(CW2A(strID.GetString()));
+	int eIdx = id;
+	ChangeCornerDotIdx(eIdx);
+
+	*pResult = 0;
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonModelRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonMeasureRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+}
+
+void CCornerDistSetDlg::LockImage(int nType) {
+	/* code */
+	if (1 == nType) {
+		GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(TRUE);
+		GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(FALSE);
+	}
+	else if (2 == nType) {
+		GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(TRUE);
+	}
+	else{
+		GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(FALSE);
+	}
+}
+
+void CCornerDistSetDlg::LockMark(BOOL isLock) {
+	/* code */
+	m_isLockPoint = isLock;
+	if (isLock) {
+		GetDlgItem(IDC_BUTTON_COPY_TOP_MARK_DIST)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_LOCK_MARK_DIST)->SetWindowTextW(L"Unlock");
+	}
+	else {
+		GetDlgItem(IDC_BUTTON_COPY_TOP_MARK_DIST)->EnableWindow(TRUE);
+		GetDlgItem(IDC_BUTTON_LOCK_MARK_DIST)->SetWindowTextW(L"Lock");
+	}
+}
+
+void CCornerDistSetDlg::InitMenu(void) {
+	/* code */
+	m_visionMenu.LoadMenu(IDR_MENU1);
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonDistTestAll()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveDistCorner();
+	SaveDistDotProcess();
+	if (nullptr == m_dot) return;
+
+	CString strCaption = _T("");
+	GetDlgItem(IDC_STATIC_DIST_RESULT_DIST)->SetWindowText(strCaption);
+	GetDlgItem(IDC_STATIC_DIST_RESULT_DIST2)->SetWindowText(strCaption);
+
+	m_dot->execute(m_eDir);
+
+	dispAllPointResult();
+}
+
+void CCornerDistSetDlg::dispAllPointResult(void) {
+	/* code */
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonLockMarkDist()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (m_isLockPoint) {
+		m_isLockPoint = FALSE;
+	}
+	else {
+		m_isLockPoint = TRUE;
+	}
+	LockMark(m_isLockPoint);
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonCopyTopMarkDist()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return;
+
+	if (pSideData->m_bTopMark_Find) {
+		m_topMark.x = pSideData->m_mTopMark.x;
+		m_topMark.y = pSideData->m_mTopMark.y;
+		if (nullptr != m_dot) {
+			m_dot->setPoint(m_topMark, 0);
+		}
+	}
+
+	if (pSideData->m_bBotMark_Find) {
+		m_botMark.x = pSideData->m_mBotMark.x;
+		m_botMark.y = pSideData->m_mBotMark.y;
+		if (nullptr != m_dot) {
+			m_dot->setPoint(m_botMark, 1);
+		}
+	}
+
+	if (pSideData->m_bTopPoint_Find) {
+		m_topPoint = pSideData->m_mTopPoint;
+		if (nullptr != m_dot) {
+			m_dot->setPoint(m_topPoint, 2);
+		}
+	}
+
+	if (pSideData->m_bBotPoint_Find) {
+		m_botPoint = pSideData->m_mBotPoint;
+		if (nullptr != m_dot) {
+			m_dot->setPoint(m_botPoint, 3);
+		}
+	}
+
+	UpdateData(FALSE);
+}
+
+void CCornerDistSetDlg::OnNMRClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
+	// TODO: 在此添加控件通知处理程序代码
+
+	POINT pos; // pos1;
+	GetCursorPos(&pos);
+
+	CMenu *pDotMenu = m_visionMenu.GetSubMenu(0);
+	pDotMenu->TrackPopupMenu(TPM_LEFTALIGN, pos.x, pos.y, this);
+
+	*pResult = 0;
+}
+
+
+void CCornerDistSetDlg::OnVisionDelete()
+{
+	// TODO: 在此添加命令处理程序代码
+	if (NULL == m_dot) return;
+	if (NULL == m_dotDist) return;
+
+	int idDel = m_dotDist->getID();
+	int id = m_dot->delDot(idDel);
+	dispListParam();
+	//if (id < 0) {
+	//	m_dotDist = NULL;
+	//	return;
+	//}
+
+	//m_eCornerIndex = id;
+	//m_dotDist = m_dot->getDot((int)id);
+
+	//ShowDistDotParam();
+
+	//LockImage(TRUE);
+	//LocTop(TRUE);
+	//LockBot(TRUE);
+}
+
+
+void CCornerDistSetDlg::OnAddDist()
+{
+	// TODO: 在此添加命令处理程序代码
+	if (NULL == m_dot) return;
+
+	SaveDistCorner();
+	SaveDistDotProcess();
+
+	int id = m_dot->addDot();
+	dispListParam();
+	m_dotDist = m_dot->getDot(id);
+	m_eDotIndex = id;
+
+	ShowDistDotParam();
+	LockImage(-1);
+}
+
+void CCornerDistSetDlg::OnMenuMeasureSet()
+{
+	// TODO: 在此添加命令处理程序代码
+	if (NULL == m_dot) return;
+
+	CMeasureSetDlg dlg;
+	dlg.SetDot(m_dot);
+	dlg.DoModal();
+}
+
+
+void CCornerDistSetDlg::OnEditroiDrawkeyroi()
+{
+	// TODO: 在此添加命令处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+
+	LockImage(1);
+}
+
+
+void CCornerDistSetDlg::OnEditroiDrawmeasureroi()
+{
+	// TODO: 在此添加命令处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+
+	LockImage(2);
+}
+
+
+void CCornerDistSetDlg::OnEditroiDeleteallroi()
+{
+	// TODO: 在此添加命令处理程序代码
+	if (nullptr == m_dotDist)  return;
+
+	HalconCpp::HObject hRegion;
+	HalconCpp::GenEmptyObj(&hRegion);
+	m_dotDist->setRoiRegion(hRegion);
+	m_dotDist->setLineRegion(hRegion);
+
+	dispRegion();
+	dispListParam();
+	ShowDistDotParam();
+}
diff --git a/BlVisionPro/View/CornerDistSetDlg.h b/BlVisionPro/View/CornerDistSetDlg.h
new file mode 100644
index 0000000..3875c7b
--- /dev/null
+++ b/BlVisionPro/View/CornerDistSetDlg.h
@@ -0,0 +1,135 @@
+#pragma once
+
+
+// CCornerDistSetDlg 对话框
+#include "VisionRecipe.h"
+#include "afxwin.h"
+
+enum CORNER_IMAGE_TYPE { 
+	CORNER_IMAGE = 0, 
+	CORNER_MEASURE_REGION, 
+	CORNER_TOP_POINT,
+	CORNER_BOT_POINT
+};
+
+class CCornerDistSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CCornerDistSetDlg)
+
+public:
+	CCornerDistSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CCornerDistSetDlg();
+
+	// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DLG_DIST_CORNER };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	CListCtrl m_listCornerPoint;
+	CCornerDistProcess *m_dot;
+	CDistDotProcess *m_dotDist;
+
+
+	CComboBox m_combFrirtRefer;          //First Refer
+
+	Point2I m_topMark;
+	Point2I m_botMark;
+	Point2I m_topPoint;
+	Point2I m_botPoint;
+
+	int m_id;
+	CString m_strName;
+	Point2I m_pos;
+	int m_refer;
+	int m_refer_;
+
+	CComboBox m_combDistMode;
+	int m_minValue;
+	int m_maxValue;
+	int m_incValue;
+
+	CComboBox m_combDistMode2;
+	int m_minValue2;
+	int m_maxValue2;
+	int m_incValue2;
+
+	//
+	DimensionDir m_eDir;
+	int m_eDotIndex;
+
+	CMenu m_visionMenu;
+
+	CComboBox m_combNgType;
+	CComboBox m_combNgType2;
+
+private:
+	BOOL m_isLockPoint;
+
+private:
+	//1. 显示所有的参数
+	void dispListParam(void);
+
+	//2. 初始化点位界面
+	void InitPointUi(void);
+
+	//4. 初始化UI界面
+	void InitWindUi(void);
+
+	//5. 执行
+	void ChangeVisionType(DimensionDir eDir);
+
+	//6. 执行
+	void ChangeCornerDotIdx(int eIdx);
+
+	//7. 保存数据
+	void SaveDistCorner(void);
+
+	//8. 显示当前的数据
+	void ShowDistCornerParam(void);
+
+	//9. 保存数据
+	void SaveDistDotProcess(void);
+
+	//10. 显示当前的视觉参数
+	void ShowDistDotParam(void);
+
+	//11. 显示区域
+	void dispRegion(void);
+
+	//12. 锁操作
+	void LockImage(int nType);
+
+	//14. 显示所有的所有的视觉检测点
+	void dispAllPointResult(void);
+
+	//17. 枷锁MARK
+	void LockMark(BOOL isLock);
+
+	//18. 初始化菜单
+	void InitMenu(void);
+
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	int setDimensionDir(DimensionDir eDir);
+	afx_msg void OnNMClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnBnClickedButtonModelRoi();
+	afx_msg void OnBnClickedButtonMeasureRoi();
+	afx_msg void OnBnClickedButtonDistTestAll();
+	afx_msg void OnBnClickedButtonLockMarkDist();
+	afx_msg void OnBnClickedButtonCopyTopMarkDist();
+	afx_msg void OnNMRClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnVisionDelete();
+	afx_msg void OnAddDist();
+	afx_msg void OnMenuMeasureSet();
+	afx_msg void OnEditroiDrawkeyroi();
+	afx_msg void OnEditroiDrawmeasureroi();
+	afx_msg void OnEditroiDeleteallroi();
+};
diff --git a/BlVisionPro/View/CutSetDlg.cpp b/BlVisionPro/View/CutSetDlg.cpp
new file mode 100644
index 0000000..e643718
--- /dev/null
+++ b/BlVisionPro/View/CutSetDlg.cpp
@@ -0,0 +1,387 @@
+// CutSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "CutSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+
+
+// CCutSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CCutSetDlg, CDialogEx)
+
+CCutSetDlg::CCutSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_CUTLINE_SET, pParent)
+{
+	/* code */
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+}
+
+CCutSetDlg::~CCutSetDlg(){
+	/* code */
+	m_vParams.clear();
+}
+
+void CCutSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_PANEL_CUTLINE_INFO_CUT, m_PanelCutLine);
+}
+
+
+BEGIN_MESSAGE_MAP(CCutSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_CUT, &CCutSetDlg::OnBnClickedButtonProcessCut)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_CUT, &CCutSetDlg::OnBnClickedButtonSaveCut)
+END_MESSAGE_MAP()
+
+
+// CCutSetDlg 消息处理程序
+
+
+BOOL CCutSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	m_eDir = DIMENSION_NONE;
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CCutSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. Name
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. Use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. Pos Type
+	strText = _T("Pos Type");
+	m_vParams.push_back(strText);
+	//5. line thres
+	strText = _T("line thres");
+	m_vParams.push_back(strText);
+	//6. Pos Y
+	strText = _T("Top Y(um)");
+	m_vParams.push_back(strText);
+	//7. Pos X
+	strText = _T("Std Dist(um)");
+	m_vParams.push_back(strText);
+	// 8.Inc
+	strText = _T("Inc(um)");
+	m_vParams.push_back(strText);
+	// 9.Min
+	strText = _T("Min(um)");
+	m_vParams.push_back(strText);
+	// 10.Max
+	strText = _T("Max(um)");
+	m_vParams.push_back(strText);
+	// 11.Result
+	strText = _T("Result(um)");
+	m_vParams.push_back(strText);
+
+	int nRows = 51;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelCutLine.DeleteAllItems();
+	m_PanelCutLine.SetVirtualMode(FALSE);
+	m_PanelCutLine.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelCutLine.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelCutLine.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelCutLine.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelCutLine.SetRowCount(nRows);
+	m_PanelCutLine.SetColumnCount(nCols);
+	m_PanelCutLine.SetFixedRowCount(nFixRows);
+	m_PanelCutLine.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelCutLine.GetFont();
+	if (pFont){
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelCutLine.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelCutLine.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelCutLine.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelCutLine.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelCutLine.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelCutLine.SetColumnWidth(nColIdx, 50);
+		}
+		else {
+			m_PanelCutLine.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelCutLine.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++)
+	{
+		m_PanelCutLine.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+
+void CCutSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CCutSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CCutSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveCutLineParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getCutProcess(eDir);
+
+	ShowCutLineParam();
+}
+
+void CCutSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+}
+
+
+void CCutSetDlg::OnBnClickedButtonProcessCut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveCutLineParam();
+
+	if (NULL == m_dot) return;
+
+	m_dot->Execute(m_eDir);
+
+	DispAllResult();
+}
+
+void CCutSetDlg::DispAllResult(void) {
+	/* code */
+	int nCount = 50;
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelCutLine.SetItemText(id, 10, _T("NAN"));
+		}
+		else{   //显示结果
+			CString strResult;
+			strResult.Format(_T("%.1f"), dot->m_distResult);
+			int id = dot->getID();
+			m_PanelCutLine.SetItemText(id, 10, strResult);
+		}
+	}
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	m_PanelCutLine.Invalidate(FALSE);
+}
+
+void CCutSetDlg::SaveCutLineParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+	{   
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_CUT));
+		int iUse = pBtnUse->GetCheck();
+		m_dot->m_isUse = (1 == iUse);
+	}
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		idx += 1;
+		
+		//2. Use Name
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. ID
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_poseType = _wtoi(strText);
+		idx += 1;
+
+		//5. line thres
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nEdgeThres = _wtoi(strText);
+		idx += 1;
+
+		//6. Pos Y
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nPosY = _wtoi(strText);
+		idx += 1;
+
+		//7. Pos X
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nPosX = _wtoi(strText);
+		idx += 1;
+
+		//8. Inc
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nInc = _wtoi(strText);
+		idx += 1;
+
+		//9. Min
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nMin = _wtoi(strText);
+		idx += 1;
+
+		//10. Max
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nMax = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+void CCutSetDlg::ShowCutLineParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_CUT));
+		int iUse = 0;
+		if (m_dot->m_isUse)  iUse = 1;
+		pBtnUse->SetCheck(iUse);
+	}
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Pose Type
+		strText.Format(_T("%d"), dot->m_poseType);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. line thres
+		strText.Format(_T("%d"), dot->m_nEdgeThres);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Pos Y
+		strText.Format(_T("%d"), dot->m_nPosY);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+		
+		//7. Pos X
+		strText.Format(_T("%d"), dot->m_nPosX);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Inc
+		strText.Format(_T("%d"), dot->m_nInc);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Min
+		strText.Format(_T("%d"), dot->m_nMin);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Max
+		strText.Format(_T("%d"), dot->m_nMax);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//11. Result
+		strText.Format(_T("%.1f"), dot->m_distResult);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+void CCutSetDlg::OnBnClickedButtonSaveCut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveCutLineParam();
+}
\ No newline at end of file
diff --git a/BlVisionPro/View/CutSetDlg.h b/BlVisionPro/View/CutSetDlg.h
new file mode 100644
index 0000000..0cb39e8
--- /dev/null
+++ b/BlVisionPro/View/CutSetDlg.h
@@ -0,0 +1,55 @@
+#pragma once
+
+#include "CutProcess.h"
+// CCutSetDlg 对话框
+
+class CCutSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CCutSetDlg)
+
+public:
+	CCutSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CCutSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum {
+		IDD = IDD_DIALOG_CUTLINE_SET
+};
+#endif
+
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	DimensionDir m_eDir;
+	CGridCtrl	m_PanelCutLine;
+	std::vector<CString> m_vParams;
+	CCutProcess *m_dot;
+
+private:
+	//1. 初始化
+	void InitPanel(void);
+
+	//2. 保存数据
+	void SaveCutLineParam(void);
+
+	//3. 显示参数
+	void ShowCutLineParam(void);
+
+	//4. 显示结果
+	void DispAllResult(void);
+
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	void ChangeVisionType(DimensionDir eDir);
+	void setDimensionDir(DimensionDir eDir);
+
+	afx_msg void OnBnClickedButtonProcessCut();
+	afx_msg void OnBnClickedButtonSaveCut();
+};
diff --git a/BlVisionPro/View/GrindSetDlg.cpp b/BlVisionPro/View/GrindSetDlg.cpp
new file mode 100644
index 0000000..82da2f9
--- /dev/null
+++ b/BlVisionPro/View/GrindSetDlg.cpp
@@ -0,0 +1,386 @@
+// GrindSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "GrindSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+
+
+// CGrindSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CGrindSetDlg, CDialogEx)
+
+CGrindSetDlg::CGrindSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_GRIND_SET, pParent)
+	, m_nLeftLineDist(0)
+	, m_nLeftThres(20)
+{
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+}
+
+CGrindSetDlg::~CGrindSetDlg()
+{
+}
+
+void CGrindSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_PANEL_GRIND_INFO, m_PanelGrind);
+
+	DDX_Text(pDX, IDC_EDIT_LEFT_LINE_DISTANCE, m_nLeftLineDist);
+	DDX_Text(pDX, IDC_EDIT_LEFT_LINE_THRES_GRIND, m_nLeftThres);
+}
+
+
+BEGIN_MESSAGE_MAP(CGrindSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_GRIND, &CGrindSetDlg::OnBnClickedButtonProcessGrind)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_GRIND, &CGrindSetDlg::OnBnClickedButtonSaveGrind)
+END_MESSAGE_MAP()
+
+
+// CGrindSetDlg 消息处理程序
+
+
+BOOL CGrindSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+void CGrindSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+//	SaveGrindParam();
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CGrindSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	m_eDir = DIMENSION_NONE;
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CGrindSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. Name
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. Pose Type
+	strText = _T("Pos Type");
+	m_vParams.push_back(strText);
+	//5. Pose Y
+	strText = _T("Top Y(um)");
+	m_vParams.push_back(strText);
+	//6. End Thres
+	strText = _T("End Thres");
+	m_vParams.push_back(strText);
+	// 7. Inc
+	strText = _T("Inc(um)");
+	m_vParams.push_back(strText);
+	// 8.Min
+	strText = _T("Min(um)");
+	m_vParams.push_back(strText);
+	// 9.Min
+	strText = _T("Max(um)");
+	m_vParams.push_back(strText);
+	// 10.Result
+	strText = _T("Result(um)");
+	m_vParams.push_back(strText);
+
+	int nRows = 51;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelGrind.DeleteAllItems();
+	m_PanelGrind.SetVirtualMode(FALSE);
+	m_PanelGrind.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelGrind.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelGrind.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelGrind.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelGrind.SetRowCount(nRows);
+	m_PanelGrind.SetColumnCount(nCols);
+	m_PanelGrind.SetFixedRowCount(nFixRows);
+	m_PanelGrind.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelGrind.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelGrind.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelGrind.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelGrind.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelGrind.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelGrind.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelGrind.SetColumnWidth(nColIdx, 50);
+		}
+		else {
+			m_PanelGrind.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelGrind.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++){
+		m_PanelGrind.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CGrindSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+}
+
+void CGrindSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveGrindParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getGrindProcess(eDir);
+
+	ShowGrindParam();
+}
+
+void CGrindSetDlg::SaveGrindParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_GRIND));
+		int iUse = pBtnUse->GetCheck();
+		m_dot->m_isUse = (1 == iUse);
+	}
+
+	m_dot->m_nLeftLineDist = m_nLeftLineDist;
+	m_dot->m_nLeftThres = m_nLeftThres;
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. Use
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_poseType = _wtoi(strText);
+		idx += 1;
+
+		//5. Pose Y
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nPosY = _wtoi(strText);
+		idx += 1;
+
+		//6. Edge Pose
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nEdgeThres = _wtoi(strText);
+		idx += 1;
+
+		//7. Inc
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nInc = _wtoi(strText);
+		idx += 1;
+
+		//8. Min
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nMin = _wtoi(strText);
+		idx += 1;
+
+		//9. Max
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nMax = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+
+void CGrindSetDlg::ShowGrindParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_GRIND));
+		int iUse = 0;
+		if (m_dot->m_isUse)  iUse = 1;
+		pBtnUse->SetCheck(iUse);
+	}
+
+	m_nLeftLineDist = m_dot->m_nLeftLineDist;
+	m_nLeftThres = m_dot->m_nLeftThres;
+
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText.Format(_T("%d"), dot->m_poseType);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Pose Y
+		strText.Format(_T("%d"), dot->m_nPosY);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Edge Pose
+		strText.Format(_T("%d"), dot->m_nEdgeThres);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. Inc
+		strText.Format(_T("%d"), dot->m_nInc);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Min
+		strText.Format(_T("%d"), dot->m_nMin);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Max
+		strText.Format(_T("%d"), dot->m_nMax);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Result
+		strText.Format(_T("%.1f"), dot->m_distResult);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+void CGrindSetDlg::OnBnClickedButtonProcessGrind()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveGrindParam();
+
+	if (NULL == m_dot) return;
+
+	m_dot->Execute(m_eDir);
+
+	DispAllResult();
+}
+
+void CGrindSetDlg::DispAllResult(void) {
+	/* code */
+	int nCount = 50;
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelGrind.SetItemText(id, 9, _T("NAN"));
+		}
+		else{   //显示结果
+			CString strResult;
+			strResult.Format(_T("%.1f"), dot->m_distResult);
+			int id = dot->getID();
+			m_PanelGrind.SetItemText(id, 9, strResult);
+		}
+	}
+
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	m_PanelGrind.Invalidate(FALSE);
+}
+
+
+void CGrindSetDlg::OnBnClickedButtonSaveGrind()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveGrindParam(); 
+}
\ No newline at end of file
diff --git a/BlVisionPro/View/GrindSetDlg.h b/BlVisionPro/View/GrindSetDlg.h
new file mode 100644
index 0000000..6a92871
--- /dev/null
+++ b/BlVisionPro/View/GrindSetDlg.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include "GrindProcess.h"
+// CGrindSetDlg 对话框
+
+class CGrindSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CGrindSetDlg)
+
+public:
+	CGrindSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CGrindSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_GRIND_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	DimensionDir m_eDir;
+	CGridCtrl	m_PanelGrind;
+	std::vector<CString> m_vParams;
+	CGrindProcess *m_dot;
+
+	int m_nLeftLineDist;
+	int m_nLeftThres;
+
+private:
+	void InitPanel(void);
+
+	//2. 保存数据
+	void SaveGrindParam(void);
+
+	//3. 显示参数
+	void ShowGrindParam(void);
+
+	//4. 显示区域
+	void DispAllResult(void);
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnClose();
+	virtual BOOL OnInitDialog();
+	void ChangeVisionType(DimensionDir eDir);
+	void setDimensionDir(DimensionDir eDir);
+
+	afx_msg void OnBnClickedButtonProcessGrind();
+	afx_msg void OnBnClickedButtonSaveGrind();
+};
diff --git a/BlVisionPro/View/HoleSetDlg.cpp b/BlVisionPro/View/HoleSetDlg.cpp
new file mode 100644
index 0000000..94b211f
--- /dev/null
+++ b/BlVisionPro/View/HoleSetDlg.cpp
@@ -0,0 +1,483 @@
+// HoleSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "HoleSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+
+// CHoleSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CHoleSetDlg, CDialogEx)
+
+CHoleSetDlg::CHoleSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_HOLE_INSPECT, pParent)
+{
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+	m_display = NULL;
+}
+
+CHoleSetDlg::~CHoleSetDlg()
+{
+}
+
+void CHoleSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_PANEL_HOLE_INFO, m_PanelHole);
+}
+
+
+BEGIN_MESSAGE_MAP(CHoleSetDlg, CDialogEx)
+	ON_WM_DESTROY()
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_PROCESS, &CHoleSetDlg::OnBnClickedButtonHoleProcess)
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_SAVE, &CHoleSetDlg::OnBnClickedButtonHoleSave)
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_UP_IMAGE, &CHoleSetDlg::OnBnClickedButtonHoleUpImage)
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_CHANGE_SHOW, &CHoleSetDlg::OnBnClickedButtonHoleChangeShow)
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_DEL_IMAGE, &CHoleSetDlg::OnBnClickedButtonHoleDelImage)
+END_MESSAGE_MAP()
+
+
+// CHoleSetDlg 消息处理程序
+
+
+void CHoleSetDlg::OnDestroy()
+{
+	CDialogEx::OnDestroy();
+
+	// TODO: 在此处添加消息处理程序代码
+	if (nullptr != m_display) {
+		m_display->CloseWindow();
+		ClsDisplay_Free(m_display);
+		m_display = nullptr;
+	}
+}
+
+
+BOOL CHoleSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	InitDisplay();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+
+BOOL CHoleSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CHoleSetDlg::InitDisplay(void) {
+	/* code */
+	m_display = ClsDisplay_Create();
+	if (nullptr != m_display) {
+		CRect rect;
+		CWnd* pDispWnd = GetDlgItem(IDC_STATIC_HOLE_IMG);
+		pDispWnd->GetWindowRect(rect);
+		m_display->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_display->SetOperFlag(DEFAULT_OPER_FLAG);
+		m_display->SetDraw("fill", DISP_OBJECT);
+		m_display->SetColor("red", DISP_OBJECT);
+
+		m_display->SetDraw("margin", DISP_REGION);
+		std::string color = ClsVision::Rgb2Color(0, 255, 0);
+		m_display->SetColor(color, DISP_REGION);
+
+		m_display->SetDraw("margin", DISP_CROSS);
+		color = ClsVision::Rgb2Color(255, 0, 0);
+		m_display->SetColor(color, DISP_CROSS);
+
+		m_display->SetDraw("fill", DISP_SELECT);
+		m_display->SetColor("yellow", DISP_SELECT);
+		color = ClsVision::Rgb2Color(0, 0, 100);
+		m_display->SetBackgroundColor(color);
+	}
+}
+
+int CHoleSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+	return 0;
+}
+
+void CHoleSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveHoleParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getHoleProcess(m_eDir);
+
+	ShowHoleParam();
+}
+
+void CHoleSetDlg::ShowHoleParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	CString strText;
+	for (int i = 0; i < 4; i++) {
+		CHoleDotProcess* dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->GetID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->GetID());
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText.Format(_T("%d"), dot->m_nPoseType);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Shape Type
+		strText.Format(_T("%d"), dot->m_nShapeType);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Bright Type
+		strText.Format(_T("%d"), dot->m_nBrightType);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. Thres
+		strText.Format(_T("%d"), dot->m_nThres);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Smooth Size
+		strText.Format(_T("%d"), dot->m_nSmoothSize);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Defect Size
+		strText.Format(_T("%d"), dot->m_nDefectSize);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Result
+		int ngNum = (int)(dot->m_nNgInfo.size());
+		strText.Format(_T("%d"), ngNum);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+
+	ShowHoleImage();
+}
+
+void CHoleSetDlg::SaveHoleParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+	CString strText;
+	for (int i = 0; i < 4; i++) {
+		CHoleDotProcess* dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->GetID();
+		int idx = 0;
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. Use
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4.Pos Type
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nPoseType = _wtoi(strText);
+		idx += 1;
+
+		//5. Shape Type
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nShapeType = _wtoi(strText);
+		idx += 1;
+
+		//6. Bright Type
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nBrightType = _wtoi(strText);
+		idx += 1;
+
+		//7. Thres
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nThres = _wtoi(strText);
+		idx += 1;
+
+		//8. Smooth Size
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nSmoothSize = _wtoi(strText);
+		idx += 1;
+
+		//9. Defect Size
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nDefectSize = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+void CHoleSetDlg::OnBnClickedButtonHoleProcess()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (nullptr == m_dot)  return;
+
+	m_dot->Execute(m_eDir);
+}
+
+void CHoleSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. useName
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. useName
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. Pos Type
+	strText = _T("Pos Type");
+	m_vParams.push_back(strText);
+	//5. Shape Type
+	strText = _T("Shape Type");
+	m_vParams.push_back(strText);
+	//6. Bright Type
+	strText = _T("Bright Type");
+	m_vParams.push_back(strText);
+	//7. Thres
+	strText = _T("Thres");
+	m_vParams.push_back(strText);
+	//8. Smooth
+	strText = _T("Smooth Size");
+	m_vParams.push_back(strText);
+	// 9. Defect Size
+	strText = _T("Defect Size");
+	m_vParams.push_back(strText);
+	// 10.Result
+	strText = _T("Result");
+	m_vParams.push_back(strText);
+
+	int nRows = 5;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelHole.DeleteAllItems();
+	m_PanelHole.SetVirtualMode(FALSE);
+	m_PanelHole.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelHole.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelHole.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelHole.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelHole.SetRowCount(nRows);
+	m_PanelHole.SetColumnCount(nCols);
+	m_PanelHole.SetFixedRowCount(nFixRows);
+	m_PanelHole.SetFixedColumnCount(nFixCols);
+
+	CFont* pFont = m_PanelHole.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelHole.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelHole.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelHole.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelHole.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelHole.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelHole.SetColumnWidth(nColIdx, 50);
+		}
+		else {
+			m_PanelHole.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelHole.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++) {
+		m_PanelHole.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+
+void CHoleSetDlg::OnBnClickedButtonHoleSave()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveHoleParam();
+	ShowHoleImage();
+}
+
+
+void CHoleSetDlg::OnBnClickedButtonHoleUpImage()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CCellID selCell = m_PanelHole.GetFocusCell();
+	int id = 1;
+	if (selCell.IsValid()) {
+		id = selCell.row;
+	}
+	if (id < 1 || id > 4) return;
+	CHoleDotProcess * dot = m_dot->m_dots[id - 1];
+	if (nullptr == dot) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	//截图
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	Point2I ptCenter;
+	ptCenter.x = (int)(1.0f * (x1 + x2) / 2 + 0.5f);
+	ptCenter.y = (int)(1.0f * (y1 + y2) / 2 + 0.5f);
+	Point2I ptStd, ptTop, ptBot;
+	if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir, ptCenter, ptStd, ptTop, ptBot)) return;
+
+	dot->SetPose(ptStd.x, ptStd.y);
+	dot->SetImage(hImage);
+
+	ShowHoleImage();
+}
+
+void CHoleSetDlg::ShowHoleImage(void) {
+	/* code */
+	if (nullptr == m_dot)  return;
+
+	CCellID selCell = m_PanelHole.GetFocusCell();
+	int id = 1;
+	if (selCell.IsValid()) {
+		id = selCell.row;
+	}
+	if (id < 1 || id > 4) return;
+	CHoleDotProcess* dot = m_dot->m_dots[id - 1];
+	if (nullptr == dot) return;
+
+	HalconCpp::HObject& hImage = dot->GetImage();
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) {
+		HalconCpp::GenEmptyObj(&m_display->GetImage());
+		HalconCpp::GenEmptyObj(&m_display->GetRegion());
+		HalconCpp::GenEmptyObj(&m_display->GetCross());
+		m_display->ClearWindow();
+		m_display->DispImage();
+		return;
+	}
+
+	HalconCpp::HObject hRegion, hRoiRegion;
+	int offset = dot->m_nSmoothSize;
+	HalconCpp::GenEllipse(&hRegion, 0.5 * (height-1), 0.5 * (width-1), 0, 0.5 * width, 0.5 * height);
+	HalconCpp::GenEllipse(&hRoiRegion, 0.5 * (height - 1), 0.5 * (width - 1), 0, 0.5 * width - offset, 0.5 * height - offset);
+	m_display->SetRegion(hRoiRegion);
+	m_display->SetCross(hRegion);
+
+	m_display->AutoWindowSize(width, height);
+	m_display->SetImage(hImage);
+	m_display->DispImage();
+	m_display->DispCross();
+	m_display->DispRegion();
+}
+
+
+
+void CHoleSetDlg::OnBnClickedButtonHoleChangeShow()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	ShowHoleImage();
+}
+
+
+void CHoleSetDlg::OnBnClickedButtonHoleDelImage()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (nullptr == m_dot)  return;
+
+	CCellID selCell = m_PanelHole.GetFocusCell();
+	if (!selCell.IsValid()) return;
+	int id = selCell.row;
+	if (id < 1 || id > 4) return;
+	CHoleDotProcess* dot = m_dot->m_dots[id - 1];
+	if (nullptr == dot) return;
+
+	HalconCpp::HObject& hImage = dot->GetImage();
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	HalconCpp::HObject hNilImage;
+	HalconCpp::GenEmptyObj(&hNilImage);
+	dot->SetImage(hNilImage);
+
+	ShowHoleImage();
+}
diff --git a/BlVisionPro/View/HoleSetDlg.h b/BlVisionPro/View/HoleSetDlg.h
new file mode 100644
index 0000000..7770dfa
--- /dev/null
+++ b/BlVisionPro/View/HoleSetDlg.h
@@ -0,0 +1,64 @@
+#pragma once
+
+
+// CHoleSetDlg 对话框
+#include "HoleProcess.h"
+
+class CHoleSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CHoleSetDlg)
+
+public:
+	CHoleSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CHoleSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_HOLE_INSPECT };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnDestroy();
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnBnClickedButtonHoleProcess();
+
+	//1. 设置edir
+	int setDimensionDir(DimensionDir eDir);
+
+private:
+	CGridCtrl m_PanelHole;
+	std::vector<CString> m_vParams;
+	DimensionDir m_eDir;
+	CHoleProcess* m_dot;
+	IClsDisplay* m_display;
+
+private:
+	//1. 初始化Panel
+    void InitPanel(void);
+
+	//2. 修改算法
+	void ChangeVisionType(DimensionDir eDir);
+
+	//3. 保存参数
+	void SaveHoleParam(void);
+
+	//4. 显示参数
+	void ShowHoleParam(void);
+
+	//5. 初始化
+	void InitDisplay(void);
+
+	//6. 显示图像
+	void ShowHoleImage(void);
+	
+public:
+	afx_msg void OnBnClickedButtonHoleSave();
+	afx_msg void OnBnClickedButtonHoleUpImage();
+	afx_msg void OnBnClickedButtonHoleChangeShow();
+	afx_msg void OnBnClickedButtonHoleDelImage();
+};
diff --git a/BlVisionPro/View/KDistSetDlg.cpp b/BlVisionPro/View/KDistSetDlg.cpp
new file mode 100644
index 0000000..8dd20d3
--- /dev/null
+++ b/BlVisionPro/View/KDistSetDlg.cpp
@@ -0,0 +1,472 @@
+// KDistSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "KDistSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+
+
+// CKDistSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CKDistSetDlg, CDialogEx)
+
+CKDistSetDlg::CKDistSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_DIST_SET, pParent)
+{
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+	m_nStage = -1;
+}
+
+CKDistSetDlg::~CKDistSetDlg()
+{
+	/* code */
+}
+
+void CKDistSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_PANEL_CUT_INFO, m_PanelKeyDist);
+	DDX_Text(pDX, IDC_EDIT_STAGE, m_nStage);
+}
+
+
+BEGIN_MESSAGE_MAP(CKDistSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_KDIST, &CKDistSetDlg::OnBnClickedButtonProcessKdist)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_KDIST, &CKDistSetDlg::OnBnClickedButtonSaveKdist)
+	ON_BN_CLICKED(IDC_BUTTON_SET_STAGE, &CKDistSetDlg::OnBnClickedButtonSetStage)
+END_MESSAGE_MAP()
+
+
+// CKDistSetDlg 消息处理程序
+
+
+BOOL CKDistSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+void CKDistSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CKDistSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	if (nullptr != pRecipe) {
+		m_nStage = pRecipe->getStage();
+	}
+	SetDlgItemInt(IDC_EDIT_STAGE, m_nStage);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CKDistSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. useName
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. useName
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. Pos Type
+	strText = _T("Pos Type");
+	m_vParams.push_back(strText);
+	//5. Key X
+	strText = _T("Key X(um)");
+	m_vParams.push_back(strText);
+	//6. Key Y
+	strText = _T("Key Y(um)");
+	m_vParams.push_back(strText);
+	//7. Pos X
+	strText = _T("Pos X(um)");
+	m_vParams.push_back(strText);
+	//8. Pos Y
+	strText = _T("Pos Y(um)");
+	m_vParams.push_back(strText);
+	//9. End Type
+	strText = _T("Edge Thres");
+	m_vParams.push_back(strText);
+	//10. ROI Width
+	strText = _T("Std(um)");
+	m_vParams.push_back(strText);
+	// 11. Inc
+	strText = _T("Inc(um)");
+	m_vParams.push_back(strText);
+	//12. Inc1
+	strText = _T("Inc1(um)");
+	m_vParams.push_back(strText);
+	// 13.Min
+	strText = _T("Min(um)");
+	m_vParams.push_back(strText);
+	// 14.MAX
+	strText = _T("Max(um)");
+	m_vParams.push_back(strText);
+	// 15.Result
+	strText = _T("Result(um)");
+	m_vParams.push_back(strText);
+
+	int nRows = 51;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelKeyDist.DeleteAllItems();
+	m_PanelKeyDist.SetVirtualMode(FALSE);
+	m_PanelKeyDist.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelKeyDist.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelKeyDist.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelKeyDist.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelKeyDist.SetRowCount(nRows);
+	m_PanelKeyDist.SetColumnCount(nCols);
+	m_PanelKeyDist.SetFixedRowCount(nFixRows);
+	m_PanelKeyDist.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelKeyDist.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelKeyDist.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelKeyDist.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelKeyDist.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelKeyDist.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelKeyDist.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelKeyDist.SetColumnWidth(nColIdx, 50);
+		}
+		else {
+			m_PanelKeyDist.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelKeyDist.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++){
+		m_PanelKeyDist.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CKDistSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+}
+
+void CKDistSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveKDistParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getKDistProcess(eDir);
+
+	ShowKDistParam();
+}
+
+void CKDistSetDlg::SaveKDistParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_KDIST));
+		int iUse = pBtnUse->GetCheck();
+		m_dot->m_isUse = (1 == iUse);
+
+		int nValue = GetDlgItemInt(IDC_EDIT_ROI_LENGTH_SIZE_DIST);
+        m_dot->m_nRoiSize = nValue;
+	}
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. Use
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4.Pos Type
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_poseType = _wtoi(strText);
+		idx += 1;
+
+		//5. Key X
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_keyPoseX = _wtoi(strText);
+		idx += 1;
+
+		//6. Key Y
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_keyPoseY = _wtoi(strText);
+		idx += 1;
+
+		//7. Pos X
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nPosX = _wtoi(strText);
+		idx += 1;
+
+		//8. Pos Y
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nPosY = _wtoi(strText);
+		idx += 1;
+
+		//9. End Type
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nEndThres = _wtoi(strText);
+		idx += 1;
+
+		//10. ROI Width
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nStdDist = _wtoi(strText);
+		idx += 1;
+
+		//11. Inc
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nInc = _wtoi(strText);
+		idx += 1;
+
+		//12. Inc1
+        strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nInc1 = _wtoi(strText);
+		idx += 1;
+
+		//13. Min
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nMin = _wtoi(strText);
+		idx += 1;
+
+		//14. Max
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nMax = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+void CKDistSetDlg::ShowKDistParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_KDIST));
+		int iUse = 0;
+		if (m_dot->m_isUse)  iUse = 1;
+		pBtnUse->SetCheck(iUse);
+
+		SetDlgItemInt(IDC_EDIT_ROI_LENGTH_SIZE_DIST, m_dot->m_nRoiSize);
+	}
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText.Format(_T("%d"), dot->m_poseType);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Key X
+		strText.Format(_T("%d"), dot->m_keyPoseX);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Key Y
+		strText.Format(_T("%d"), dot->m_keyPoseY);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. Pos X
+		strText.Format(_T("%d"), dot->m_nPosX);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Pos Y
+		strText.Format(_T("%d"), dot->m_nPosY);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. End Type
+		strText.Format(_T("%d"), dot->m_nEndThres);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Std
+		strText.Format(_T("%d"), dot->m_nStdDist);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//11. Inc
+		strText.Format(_T("%d"), dot->m_nInc);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//12. Inc1
+        strText.Format(_T("%d"), dot->m_nInc1);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//13. Min
+		strText.Format(_T("%d"), dot->m_nMin);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//14. Max
+		strText.Format(_T("%d"), dot->m_nMax);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//15. Result
+		strText.Format(_T("%.1f"), dot->m_distResult);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+
+void CKDistSetDlg::OnBnClickedButtonProcessKdist()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveKDistParam();
+
+	if (NULL == m_dot) return;
+
+	CLocProcess *pLoc = CVisionRecipe::getInstance()->getLocProcess(m_eDir);
+	if (NULL != pLoc) {
+		pLoc->execute(m_eDir);
+	}
+
+
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	if (nullptr != pRecipe) {
+		int nStage = pRecipe->getStage();
+		m_dot->SetStage(nStage);
+	}
+	m_dot->Execute(m_eDir);
+
+	DispAllResult();
+
+}
+
+void CKDistSetDlg::DispAllResult(void) {
+	/* code */
+	int nCount = 50;
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelKeyDist.SetItemText(id, 14, _T("NAN"));
+		}
+		else{   //显示结果
+			CString strResult;
+			strResult.Format(_T("%.1f"), dot->m_distResult);
+			int id = dot->getID();
+			m_PanelKeyDist.SetItemText(id, 14, strResult);
+		}
+	}
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	m_PanelKeyDist.Invalidate(FALSE);
+}
+
+void CKDistSetDlg::OnBnClickedButtonSaveKdist()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveKDistParam();
+}
+
+void CKDistSetDlg::OnBnClickedButtonSetStage()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CVisionRecipe* pRecipe = CVisionRecipe::getInstance();
+	if (nullptr == pRecipe) return;
+
+	m_nStage = GetDlgItemInt(IDC_EDIT_STAGE);
+	pRecipe->setStage(m_nStage);
+}
diff --git a/BlVisionPro/View/KDistSetDlg.h b/BlVisionPro/View/KDistSetDlg.h
new file mode 100644
index 0000000..acad056
--- /dev/null
+++ b/BlVisionPro/View/KDistSetDlg.h
@@ -0,0 +1,53 @@
+#pragma once
+
+#include "KDistProcess.h"
+// CKDistSetDlg 对话框
+
+class CKDistSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CKDistSetDlg)
+
+public:
+	CKDistSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CKDistSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_DIST_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	DimensionDir m_eDir;
+	CGridCtrl	m_PanelKeyDist;
+	std::vector<CString> m_vParams;
+	CKDistProcess *m_dot;
+	int m_nStage;
+
+private:
+	//1. 初始化
+	void InitPanel(void);
+
+	//2. 初始化
+	void SaveKDistParam(void);
+
+	//3. 显示距离
+	void ShowKDistParam(void);
+
+	//4. 显示结果
+	void DispAllResult(void);
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnClose();
+	virtual BOOL OnInitDialog();
+	void ChangeVisionType(DimensionDir eDir);
+	void setDimensionDir(DimensionDir eDir);
+	afx_msg void OnBnClickedButtonProcessKdist();
+	afx_msg void OnBnClickedButtonSaveKdist();
+	afx_msg void OnBnClickedButtonSetStage();
+};
diff --git a/BlVisionPro/View/KeyVisionSetDlg.cpp b/BlVisionPro/View/KeyVisionSetDlg.cpp
new file mode 100644
index 0000000..9a73da1
--- /dev/null
+++ b/BlVisionPro/View/KeyVisionSetDlg.cpp
@@ -0,0 +1,355 @@
+// KeyVisionSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "KeyVisionSetDlg.h"
+#include "afxdialogex.h"
+#include "ScanSetDlg.h"
+#include "SoftVisionApp.h"
+#include "FileRecipe.h"
+#include "VisionBufferPro.h"
+
+// CKeyVisionSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CKeyVisionSetDlg, CDialogEx)
+
+CKeyVisionSetDlg::CKeyVisionSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG1, pParent)
+	, m_strPassword(_T(""))
+{
+
+}
+
+CKeyVisionSetDlg::~CKeyVisionSetDlg()
+{
+}
+
+void CKeyVisionSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_CHECK_VISION_DISPLAY, m_btnVisionDisplay);
+
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE, m_btnVisionUse[0]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE2, m_btnVisionUse[1]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE3, m_btnVisionUse[2]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE4, m_btnVisionUse[3]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE5, m_btnVisionUse[4]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE6, m_btnVisionUse[5]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE7, m_btnVisionUse[6]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE8, m_btnVisionUse[7]);
+
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE, m_btnLocUse[0]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE2, m_btnLocUse[1]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE3, m_btnLocUse[2]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE4, m_btnLocUse[3]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE5, m_btnLocUse[4]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE6, m_btnLocUse[5]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE7, m_btnLocUse[6]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE8, m_btnLocUse[7]);
+
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE, m_btnDistUse[0]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE2, m_btnDistUse[1]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE3, m_btnDistUse[2]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE4, m_btnDistUse[3]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE5, m_btnDistUse[4]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE6, m_btnDistUse[5]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE7, m_btnDistUse[6]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE8, m_btnDistUse[7]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE9, m_btnDistUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE, m_btnRcutUse[0]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE2, m_btnRcutUse[1]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE3, m_btnRcutUse[2]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE4, m_btnRcutUse[3]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE5, m_btnRcutUse[4]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE6, m_btnRcutUse[5]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE7, m_btnRcutUse[6]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE8, m_btnRcutUse[7]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE9, m_btnRcutUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE, m_btnGrindUse[0]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE2, m_btnGrindUse[1]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE3, m_btnGrindUse[2]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE4, m_btnGrindUse[3]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE5, m_btnGrindUse[4]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE6, m_btnGrindUse[5]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE7, m_btnGrindUse[6]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE8, m_btnGrindUse[7]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE9, m_btnGrindUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE, m_btnCutUse[0]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE2, m_btnCutUse[1]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE3, m_btnCutUse[2]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE4, m_btnCutUse[3]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE5, m_btnCutUse[4]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE6, m_btnCutUse[5]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE7, m_btnCutUse[6]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE8, m_btnCutUse[7]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE9, m_btnCutUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE, m_btnThresUse[0]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE2, m_btnThresUse[1]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE3, m_btnThresUse[2]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE4, m_btnThresUse[3]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE5, m_btnThresUse[4]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE6, m_btnThresUse[5]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE7, m_btnThresUse[6]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE8, m_btnThresUse[7]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE9, m_btnThresUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE, m_btnHoleUse[0]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE2, m_btnHoleUse[1]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE3, m_btnHoleUse[2]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE4, m_btnHoleUse[3]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE5, m_btnHoleUse[4]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE6, m_btnHoleUse[5]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE7, m_btnHoleUse[6]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE8, m_btnHoleUse[7]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE9, m_btnHoleUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_DEBUG_TOOL_KEY, m_btnDebugKey[0]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY, m_btnDebugKey[1]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY2, m_btnDebugKey[2]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY3, m_btnDebugKey[3]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY4, m_btnDebugKey[4]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY5, m_btnDebugKey[5]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY6, m_btnDebugKey[6]);
+
+	DDX_Text(pDX, IDC_EDIT_PWD_KEY, m_strPassword);
+}
+
+
+BEGIN_MESSAGE_MAP(CKeyVisionSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_RECIPE, &CKeyVisionSetDlg::OnBnClickedButtonSaveRecipe)
+	ON_BN_CLICKED(IDC_BUTTON_LOAD_RECIPE, &CKeyVisionSetDlg::OnBnClickedButtonLoadRecipe)
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_KEY, &CKeyVisionSetDlg::OnBnClickedButtonProcessKey)
+	ON_BN_CLICKED(IDC_CHECK_DEBUG_TOOL_KEY, &CKeyVisionSetDlg::OnBnClickedCheckDebugToolKey)
+	ON_BN_CLICKED(IDC_BUTTON_DEBUG_MODE_KEY, &CKeyVisionSetDlg::OnBnClickedButtonDebugModeKey)
+END_MESSAGE_MAP()
+
+
+// CKeyVisionSetDlg 消息处理程序
+
+
+BOOL CKeyVisionSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	LockBtn(TRUE);
+
+	ShowUiParams();
+
+	this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CKeyVisionSetDlg::ShowUiParams(void) {
+	/* code */
+	CVisionRecipe* pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance)  return;
+
+	VisionDisplayInfo infDisplay = pInstance->getVisionDisplay();
+	m_btnVisionDisplay.SetCheck(infDisplay.isVisionDisplay);
+	m_btnDistUse[8].SetCheck(infDisplay.isDistDisplay);
+	m_btnRcutUse[8].SetCheck(infDisplay.isRcutDisplay);
+	m_btnGrindUse[8].SetCheck(infDisplay.isGrindDisplay);
+	m_btnCutUse[8].SetCheck(infDisplay.isCutDisplay);
+	m_btnThresUse[8].SetCheck(infDisplay.isThresDisplay);
+	m_btnHoleUse[8].SetCheck(infDisplay.isHoleDisplay);
+
+	for (int i = 0; i < 8; i++) {
+		VisionUseInfo inf = pInstance->getVisionUse((DimensionDir)i);
+		m_btnVisionUse[i].SetCheck(inf.isVisionUse);
+		m_btnLocUse[i].SetCheck(inf.isLocUse);
+		m_btnDistUse[i].SetCheck(inf.isDistUse);
+		m_btnRcutUse[i].SetCheck(inf.isRcutUse);
+		m_btnGrindUse[i].SetCheck(inf.isGrindUse);
+		m_btnCutUse[i].SetCheck(inf.isCutUse);
+		m_btnThresUse[i].SetCheck(inf.isThresUse);
+		m_btnHoleUse[i].SetCheck(inf.isHoleUse);
+	}
+
+	KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo();
+	m_btnDebugKey[0].SetCheck(info.isDebugTool);
+	m_btnDebugKey[1].SetCheck(info.isInspectKey);
+	m_btnDebugKey[2].SetCheck(info.isLocKey);
+	m_btnDebugKey[3].SetCheck(info.isGrindKey);
+	m_btnDebugKey[4].SetCheck(info.isDistKey);
+	m_btnDebugKey[5].SetCheck(info.isCutLineKey);
+	m_btnDebugKey[6].SetCheck(info.isRcutKey);
+
+	LockBtn(!m_btnDebugKey[0].GetCheck());
+}
+
+
+void CKeyVisionSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	SaveUiParam();
+
+	CDialogEx::OnClose();
+}
+
+void CKeyVisionSetDlg::SaveUiParam(void) {
+	/* code */
+	CVisionRecipe* pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance)  return;
+
+	VisionDisplayInfo infDisplay;
+	infDisplay.isVisionDisplay = (1 == m_btnVisionDisplay.GetCheck());
+	infDisplay.isDistDisplay = (1 == m_btnDistUse[8].GetCheck());
+	infDisplay.isRcutDisplay = (1 == m_btnRcutUse[8].GetCheck());
+	infDisplay.isGrindDisplay = (1 == m_btnGrindUse[8].GetCheck());
+	infDisplay.isCutDisplay = (1 == m_btnCutUse[8].GetCheck());
+	infDisplay.isThresDisplay = (1 == m_btnThresUse[8].GetCheck());
+	infDisplay.isHoleDisplay = (1 == m_btnHoleUse[8].GetCheck());
+	pInstance->setVisionDisplay(infDisplay);
+
+	for (int i = 0; i < 8; i++) {
+		VisionUseInfo inf;
+		inf.isVisionUse = (1 == m_btnVisionUse[i].GetCheck());
+		inf.isLocUse = (1 == m_btnLocUse[i].GetCheck());
+		inf.isDistUse = (1 == m_btnDistUse[i].GetCheck());
+		inf.isRcutUse = (1 == m_btnRcutUse[i].GetCheck());
+		inf.isGrindUse = (1 == m_btnGrindUse[i].GetCheck());
+		inf.isCutUse = (1 == m_btnCutUse[i].GetCheck());
+		inf.isThresUse = (1 == m_btnThresUse[i].GetCheck());
+		inf.isHoleUse = (1 == m_btnHoleUse[i].GetCheck());
+		pInstance->setVisionUse(inf, (DimensionDir)i);
+	}
+
+	KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo();
+	info.isDebugTool = (1 == m_btnDebugKey[0].GetCheck());
+	info.isInspectKey = (1 == m_btnDebugKey[1].GetCheck());
+	info.isLocKey = (1 == m_btnDebugKey[2].GetCheck());
+	info.isGrindKey = (1 == m_btnDebugKey[3].GetCheck());
+	info.isDistKey = (1 == m_btnDebugKey[4].GetCheck());
+	info.isCutLineKey = (1 == m_btnDebugKey[5].GetCheck());
+	info.isRcutKey = (1 == m_btnDebugKey[6].GetCheck());
+	pInstance->setKeyInfo(info);
+
+	pInstance->saveVisionConfig();
+}
+
+
+BOOL CKeyVisionSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CKeyVisionSetDlg::OnBnClickedButtonSaveRecipe()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	//std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\";
+	//CVisionRecipe::getInstance()->setWorkDir(filePath.c_str());
+	//std::string strName = "Test";
+	//CVisionRecipe::getInstance()->setVisionName(strName.c_str());
+	CVisionRecipe::getInstance()->save();
+}
+
+
+void CKeyVisionSetDlg::OnBnClickedButtonLoadRecipe()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	//std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\";
+	//CVisionRecipe::getInstance()->setWorkDir(filePath.c_str());
+	//std::string strName = "Test";
+	//CVisionRecipe::getInstance()->setVisionName(strName.c_str());
+	CVisionRecipe::getInstance()->open();
+}
+
+
+void CKeyVisionSetDlg::OnBnClickedButtonProcessKey()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	for (int i = 0; i < 1000; i++) {
+		Log_GetDebug()->TraceInfo("Start Save Recipe %d: %d", i, __LINE__);
+		{
+			//std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\";
+			//CVisionRecipe::getInstance()->setWorkDir(filePath.c_str());
+			//std::string strName = "Test";
+			//CVisionRecipe::getInstance()->setVisionName(strName.c_str());
+			CVisionRecipe::getInstance()->save();
+		}
+		Log_GetDebug()->TraceInfo("End Save Recipe %d: %d", i, __LINE__);
+		Sleep(1000);
+
+		Log_GetDebug()->TraceInfo("Start Load Recipe %d: %d", i, __LINE__);
+		{
+			//std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\";
+			//CVisionRecipe::getInstance()->setWorkDir(filePath.c_str());
+			//std::string strName = "Test";
+			//CVisionRecipe::getInstance()->setVisionName(strName.c_str());
+			CVisionRecipe::getInstance()->open();
+		}
+		Log_GetDebug()->TraceInfo("Start End Recipe  %d: %d", i, __LINE__);
+		Sleep(1000);
+
+		Log_GetDebug()->TraceInfo("Start Vision Inspect  %d: %d", i, __LINE__);
+		for (int i = 0; i < 8; i++) {
+			NgInfo ngInf[NG_INF_NUM];
+			CSoftVisionApp::getInstance()->Execute(i, ngInf);
+		}
+		Log_GetDebug()->TraceInfo("End Vision Inspect  %d: %d", i, __LINE__);
+		Sleep(1000);
+	}
+}
+
+
+void CKeyVisionSetDlg::OnBnClickedCheckDebugToolKey()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	UpdateData(TRUE);
+	SaveUiParam();
+
+	LockBtn(!m_btnDebugKey[0].GetCheck());
+}
+
+void CKeyVisionSetDlg::LockBtn(BOOL isLock) {
+	/* code */
+	if (isLock) {
+		for (int i = 1; i < 7; i++) {
+			m_btnDebugKey[i].ShowWindow(SW_HIDE);
+		}
+		GetDlgItem(IDC_BUTTON_SAVE_RECIPE)->ShowWindow(SW_HIDE);
+		GetDlgItem(IDC_BUTTON_LOAD_RECIPE)->ShowWindow(SW_HIDE);
+		GetDlgItem(IDC_BUTTON_PROCESS_KEY)->ShowWindow(SW_HIDE);
+		GetDlgItem(IDC_STATIC_DEBUG_GROUND)->ShowWindow(SW_HIDE);
+		
+	}
+	else {
+		for (int i = 1; i < 7; i++) {
+			m_btnDebugKey[i].ShowWindow(SW_SHOW);
+		}
+		GetDlgItem(IDC_BUTTON_SAVE_RECIPE)->ShowWindow(SW_SHOW);
+		GetDlgItem(IDC_BUTTON_LOAD_RECIPE)->ShowWindow(SW_SHOW);
+		GetDlgItem(IDC_BUTTON_PROCESS_KEY)->ShowWindow(SW_SHOW);
+		GetDlgItem(IDC_STATIC_DEBUG_GROUND)->ShowWindow(SW_SHOW);
+	}
+}
+
+
+void CKeyVisionSetDlg::OnBnClickedButtonDebugModeKey()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	UpdateData(TRUE);
+	if (m_strPassword != _T("31415926535")) {
+		GetDlgItem(IDC_CHECK_DEBUG_TOOL_KEY)->ShowWindow(SW_HIDE);
+		return;
+	}
+
+	GetDlgItem(IDC_CHECK_DEBUG_TOOL_KEY)->ShowWindow(SW_SHOW);
+}
diff --git a/BlVisionPro/View/KeyVisionSetDlg.h b/BlVisionPro/View/KeyVisionSetDlg.h
new file mode 100644
index 0000000..ded07ba
--- /dev/null
+++ b/BlVisionPro/View/KeyVisionSetDlg.h
@@ -0,0 +1,61 @@
+#pragma once
+
+
+// CKeyVisionSetDlg 对话框
+#include "VisionRecipe.h"
+
+class CKeyVisionSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CKeyVisionSetDlg)
+
+public:
+	CKeyVisionSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CKeyVisionSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum {
+		IDD = IDD_DIALOG_KEY_SET
+	};
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	//1. 初始化显示
+	void ShowUiParams(void);
+
+	//2. 获取信息
+	void SaveUiParam(void);
+
+	//3. 加锁
+	void LockBtn(BOOL isLock);
+
+private:
+	CButton m_btnVisionUse[8];
+	CButton m_btnLocUse[8];
+	CButton m_btnDistUse[9];
+	CButton m_btnRcutUse[9];
+	CButton m_btnGrindUse[9];
+	CButton m_btnCutUse[9];
+	CButton m_btnVisionDisplay;
+	CButton m_btnThresUse[9];
+	CButton m_btnHoleUse[9];
+
+	CButton m_btnDebugKey[7];
+
+	CString m_strPassword;
+
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnBnClickedButtonSaveRecipe();
+	afx_msg void OnBnClickedButtonLoadRecipe();
+	afx_msg void OnBnClickedButtonProcessKey();
+	afx_msg void OnBnClickedCheckDebugToolKey();
+	afx_msg void OnBnClickedButtonDebugModeKey();
+};
diff --git a/BlVisionPro/View/LocSetDlg.cpp b/BlVisionPro/View/LocSetDlg.cpp
new file mode 100644
index 0000000..7e759cf
--- /dev/null
+++ b/BlVisionPro/View/LocSetDlg.cpp
@@ -0,0 +1,497 @@
+// LocSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "LocSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+#include "Bspline.h"
+
+
+// CLocSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CLocSetDlg, CDialogEx)
+
+CLocSetDlg::CLocSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_LOC_SET, pParent)
+	, m_topScore(0.5)
+	, m_botScore(0.5)
+{
+	m_dot = NULL;
+	m_dotTop = nullptr;
+	m_dotBot = nullptr;
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+	m_topPoint.x = 0;
+    m_topPoint.y = 0;
+	m_botPoint.x = 0;
+	m_botPoint.y = 0;
+
+	HalconCpp::GenEmptyObj(&m_dispResultObject.hDispObject);
+	HalconCpp::GenEmptyObj(&m_dispResultObject.hDispObject);
+}
+
+CLocSetDlg::~CLocSetDlg()
+{
+	m_dispResultObject.hDispObject.Clear();
+	m_dispResultObject.hDispRegion.Clear();
+}
+
+void CLocSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Text(pDX, IDC_EDIT_TOP_MARK_X_LOC, m_topMark.x);
+	DDX_Text(pDX, IDC_EDIT_TOP_MARK_Y_LOC, m_topMark.y);
+	DDX_Text(pDX, IDC_EDIT_BOT_MARK_X_LOC, m_botMark.x);
+	DDX_Text(pDX, IDC_EDIT_BOT_MARK_Y_LOC, m_botMark.y);
+
+	DDX_Text(pDX, IDC_EDIT_TOP_POINT_X_LOC, m_topPoint.x);
+	DDX_Text(pDX, IDC_EDIT_TOP_POINT_Y_LOC, m_topPoint.y);
+	DDX_Text(pDX, IDC_EDIT_BOT_POINT_X_LOC, m_botPoint.x);
+	DDX_Text(pDX, IDC_EDIT_BOT_POINT_Y_LOC, m_botPoint.y);
+
+	DDX_Text(pDX, IDC_EDIT_TOP_SCORE_LOC, m_topScore);
+	DDX_Text(pDX, IDC_EDIT_BOT_SCORE_LOC, m_botScore);
+}
+
+
+BEGIN_MESSAGE_MAP(CLocSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_TOP_REFRESH_LOC, &CLocSetDlg::OnBnClickedButtonTopRefreshLoc)
+	ON_BN_CLICKED(IDC_BUTTON_BOT_REFRESH_LOC, &CLocSetDlg::OnBnClickedButtonBotRefreshLoc)
+	ON_BN_CLICKED(IDC_BUTTON_TOP_DELETE_LOC, &CLocSetDlg::OnBnClickedButtonTopDeleteLoc)
+	ON_BN_CLICKED(IDC_BUTTON_BOT_DELETE_LOC, &CLocSetDlg::OnBnClickedButtonBotDeleteLoc)
+	ON_BN_CLICKED(IDC_BUTTON_EXECUTE_LOC, &CLocSetDlg::OnBnClickedButtonExecuteLoc)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_LOC, &CLocSetDlg::OnBnClickedButtonSaveLoc)
+	ON_BN_CLICKED(IDC_BUTTON_NORCH, &CLocSetDlg::OnBnClickedButtonNorch)
+END_MESSAGE_MAP()
+
+
+// CLocSetDlg 消息处理程序
+
+
+void CLocSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	if (nullptr != m_displayTop) {
+		ClsDisplay_Free(m_displayTop);
+		m_displayTop = nullptr;
+	}
+
+	if (nullptr != m_displayBot) {
+		ClsDisplay_Free(m_displayBot);
+		m_displayBot = nullptr;
+	}
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CLocSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitDisplay();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+int CLocSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+	return 0;
+}
+
+void CLocSetDlg::InitDisplay(void) {
+	/* code */
+	m_displayTop = ClsDisplay_Create();
+	if (nullptr != m_displayTop) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_IMAGE_LOC);
+		pDispWnd->GetWindowRect(rect);
+		m_displayTop->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayTop->SetOperFlag(DEFAULT_OPER_FLAG);
+		m_displayTop->SetDraw("fill", DISP_OBJECT);
+		m_displayTop->SetColor("red", DISP_OBJECT);
+
+		m_displayTop->SetDraw("fill", DISP_REGION);
+		std::string color = ClsVision::Rgb2Color(255, 0, 0);
+		m_displayTop->SetColor(color, DISP_REGION);
+
+		m_displayTop->SetDraw("fill", DISP_CROSS);
+		color = ClsVision::Rgb2Color(224, 224, 224);
+		m_displayTop->SetColor(color, DISP_CROSS);
+
+		m_displayTop->SetDraw("fill", DISP_SELECT);
+		m_displayTop->SetColor("yellow", DISP_SELECT);
+		color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayTop->SetBackgroundColor(color);
+	}
+
+	m_displayBot = ClsDisplay_Create();
+	if (nullptr != m_displayBot) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_IMAGE_LOC);
+		pDispWnd->GetWindowRect(rect);
+		m_displayBot->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayBot->SetOperFlag(DEFAULT_OPER_FLAG);
+		m_displayBot->SetDraw("fill", DISP_OBJECT);
+		m_displayBot->SetColor("red", DISP_OBJECT);
+
+		m_displayBot->SetDraw("fill", DISP_REGION);
+		std::string color = ClsVision::Rgb2Color(255, 0, 0);
+		m_displayBot->SetColor(color, DISP_REGION);
+
+		m_displayBot->SetDraw("fill", DISP_CROSS);
+		color = ClsVision::Rgb2Color(224, 224, 224);
+		m_displayBot->SetColor(color, DISP_CROSS);
+
+		m_displayBot->SetDraw("fill", DISP_SELECT);
+		m_displayBot->SetColor("yellow", DISP_SELECT);
+		color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayBot->SetBackgroundColor(color);
+	}
+}
+
+void CLocSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveLocParams();
+
+	//显示当前的参数
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getLocProcess(eDir);
+	ShowLocParams();
+
+	SaveNccDotProcess();
+	
+	if (NULL != m_dot) {
+		m_dotTop = m_dot->getDot(0);
+		m_dotBot = m_dot->getDot(1);
+	}
+	ShowNccDotProcess();
+}
+
+void CLocSetDlg::ShowNccDotProcess(void) {
+	/* code */
+	if (NULL != m_dotTop) {
+		m_topScore = m_dotTop->m_score;
+
+		ClsVision::GenEmptyObject(m_displayTop->GetImage());
+		m_displayTop->SetImage(m_dotTop->getImage());
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_displayTop->GetImage(), width, height);
+		if (width >= 1 && height >= 1) {
+			m_displayTop->AutoWindowSize(width, height);
+		}
+
+		if (width >= 1 && height >= 1) {
+			HalconCpp::GenEmptyObj(&m_displayTop->GetRegion());
+			HalconCpp::HObject hRegion, hRegion1, hRegion2;
+			HalconCpp::GenRegionLine(&hRegion1, 0, 0.5 * (width - 1), height - 1, 0.5 * (width - 1));
+			HalconCpp::GenRegionLine(&hRegion2, 0.5 * (height - 1), 0, 0.5 * (height - 1), width - 1);
+			HalconCpp::ConcatObj(hRegion1, hRegion2, &hRegion);
+			m_displayTop->SetRegion(hRegion);
+		}
+
+		m_displayTop->ClearWindow();
+		m_displayTop->DispImage();
+		m_displayTop->DispRegion();
+	}
+
+	if (NULL != m_dotBot) {
+		m_botScore = m_dotBot->m_score;
+
+		ClsVision::GenEmptyObject(m_displayBot->GetImage());
+		m_displayBot->SetImage(m_dotBot->getImage());
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_displayBot->GetImage(), width, height);
+		if (width >= 1 && height >= 1) {
+			m_displayBot->AutoWindowSize(width, height);
+		}
+
+		if (width >= 1 && height >= 1) {
+			HalconCpp::GenEmptyObj(&m_displayBot->GetRegion());
+			HalconCpp::HObject hRegion, hRegion1, hRegion2;
+			HalconCpp::GenRegionLine(&hRegion1, 0, 0.5 * (width - 1), height - 1, 0.5 * (width - 1));
+			HalconCpp::GenRegionLine(&hRegion2, 0.5 * (height - 1), 0, 0.5 * (height - 1), width - 1);
+			HalconCpp::ConcatObj(hRegion1, hRegion2, &hRegion);
+			m_displayBot->SetRegion(hRegion);
+		}
+
+		m_displayBot->ClearWindow();
+		m_displayBot->DispImage();
+		m_displayBot->DispRegion();
+	}
+
+	UpdateData(FALSE);
+}
+
+void CLocSetDlg::SaveNccDotProcess(void) {
+	/* code */
+	UpdateData(TRUE);
+	if (NULL != m_dotTop) {
+		m_dotTop->m_score = m_topScore;
+	}
+
+	if (NULL != m_dotBot) {
+		m_dotBot->m_score = m_botScore;
+	}
+}
+
+void CLocSetDlg::ShowLocParams(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	m_topMark = m_dot->getPose(0);
+	m_botMark = m_dot->getPose(1);
+	m_topPoint = m_dot->getPose(2);
+    m_botPoint = m_dot->getPose(3);
+
+	UpdateData(FALSE);
+}
+
+void CLocSetDlg::SaveLocParams(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot)   return;
+
+	UpdateData(TRUE);
+//	m_dot->setPose(m_topMark, 0);
+//	m_dot->setPose(m_botMark, 1);
+}
+
+void CLocSetDlg::OnBnClickedButtonTopRefreshLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dotTop) return;
+	
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	//截图
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	Point2I pose;
+	pose.x = (int)(0.5 * (x1 + x2));
+	pose.y = (int)(0.5 * (y1 + y2));
+	m_dotTop->setPose(pose);
+	m_dotTop->setImage(hImage);
+
+	//计算位置信息
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		Point2I stdPoint = pose;
+		m_topPoint = stdPoint;
+		m_dot->setPose(stdPoint, 2);
+		if (pSideData->m_bTopMark_Find) {
+			stdPoint = pSideData->m_mTopMark;
+			m_topMark = stdPoint;
+			m_dot->setPose(stdPoint, 0);
+		}
+	}
+
+	if (NULL == m_displayTop)  return;
+
+	ShowLocParams();
+
+	ShowNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonBotRefreshLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dotBot) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	//截图
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	Point2I pose;
+	pose.x = (int)(0.5 * (x1 + x2));
+	pose.y = (int)(0.5 * (y1 + y2));
+	m_dotBot->setPose(pose);
+	m_dotBot->setImage(hImage);
+
+	//计算位置信息
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		Point2I stdPoint = pose;
+        m_botPoint = stdPoint;
+		m_dot->setPose(stdPoint, 3);
+		if (pSideData->m_bBotMark_Find) {
+			stdPoint = pSideData->m_mBotMark;
+			m_botMark = stdPoint;
+			m_dot->setPose(stdPoint, 1);
+		}
+	}
+
+	if (NULL == m_displayBot)  return;
+
+	ShowLocParams();
+
+	ShowNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonTopDeleteLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dotTop) return;
+
+	HalconCpp::HObject hImage;
+	HalconCpp::GenEmptyObj(&hImage);
+
+	m_dotTop->setImage(hImage);
+
+	ShowNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonBotDeleteLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dotBot) return;
+
+	HalconCpp::HObject hImage;
+	HalconCpp::GenEmptyObj(&hImage);
+
+	m_dotBot->setImage(hImage);
+
+	ShowNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonExecuteLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveLocParams();
+	SaveNccDotProcess();
+	if (NULL == m_dot) return;
+
+	m_dot->execute(m_eDir);
+
+	DispAllResult();
+}
+
+void CLocSetDlg::DispAllResult(void) {
+	/* code */
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+}
+
+
+BOOL CLocSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CLocSetDlg::OnBnClickedButtonSaveLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveLocParams();
+	SaveNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonNorch()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	//[INFO]	11 : 21 : 43 : 701 Norch 0 : (1414, 3577), (1358, 3588), (1370, 3586)
+	//[INFO]	11 : 21 : 43 : 701 Norch 1 : (1506, 4215), (1448, 4219), (1460, 4218)
+	//[INFO]	11 : 21 : 43 : 701 Norch 2 : (1521, 4461), (1463, 4464), (1476, 4463)
+	//[INFO]	11 : 21 : 43 : 701 Norch 3 : (1526, 4584), (1468, 4584), (1480, 4584)
+	//[INFO]	11 : 21 : 43 : 701 Norch 4 : (1547, 4668), (1469, 4636), (1482, 4642)
+	//[INFO]	11 : 21 : 43 : 701 Norch 5 : (1546, 4748), (1474, 4740), (1488, 4741)
+	//[INFO]	11 : 21 : 43 : 701 Norch 6 : (1528, 4831), (1469, 4869), (1482, 4860)
+	//[INFO]	11 : 21 : 43 : 701 Norch 7 : (1525, 4951), (1468, 4925), (1481, 4931)
+	//[INFO]	11 : 21 : 43 : 701 Norch 8 : (1511, 5176), (1454, 5171), (1466, 5172)
+	//[INFO]	11 : 21 : 43 : 701 Norch 9 : (1415, 5856), (1359, 5845), (1371, 5847)
+	return;
+#if 0
+	Point2D aryPoints[10];
+	aryPoints[0].x = 1370;
+    aryPoints[0].y = 3586;
+    aryPoints[1].x = 1460;
+	aryPoints[1].y = 4218;
+    aryPoints[2].x = 1476;
+    aryPoints[2].y = 4463;
+    aryPoints[3].x = 1480;
+	aryPoints[3].y = 4584;
+    aryPoints[4].x = 1482;
+    aryPoints[4].y = 4668;
+    aryPoints[5].x = 1488;
+    aryPoints[5].y = 4741;
+    aryPoints[6].x = 1482;
+    aryPoints[6].y = 4831;
+    aryPoints[7].x = 1481;
+    aryPoints[7].y = 4951;
+    aryPoints[8].x = 1466;
+    aryPoints[8].y = 5172;
+    aryPoints[9].x = 1371;
+    aryPoints[9].y = 5847;
+	CRect roiRect;
+    roiRect.left = 1017;
+    roiRect.top = 3456;
+	roiRect.right = 1573;
+	roiRect.bottom = 5970;
+	std::vector<Point2D> vPoints;
+	for (int i = 0; i < 10; i++) {
+		Point2D point = aryPoints[i];
+		vPoints.push_back(point);
+	}
+	CRect rectResult[100];
+	int nRet = CVisionBufferPro::findNorchDefect(m_eDir, vPoints, roiRect, 30, 5, 45, 1, 10, 10, rectResult);
+#endif
+}
diff --git a/BlVisionPro/View/LocSetDlg.h b/BlVisionPro/View/LocSetDlg.h
new file mode 100644
index 0000000..a6e3cc2
--- /dev/null
+++ b/BlVisionPro/View/LocSetDlg.h
@@ -0,0 +1,73 @@
+#pragma once
+#include "LocProcess.h"
+
+// CLocSetDlg 对话框
+
+class CLocSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CLocSetDlg)
+
+public:
+	CLocSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CLocSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_LOC_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	IClsDisplay *m_displayTop;
+	IClsDisplay *m_displayBot;
+
+	CLocProcess *m_dot;
+	CNccDotProcess *m_dotTop;
+	CNccDotProcess *m_dotBot;
+
+	Point2I m_topMark;
+	Point2I m_botMark;
+	Point2I m_topPoint;
+	Point2I m_botPoint;
+	double m_topScore;
+	double m_botScore;
+
+private:
+	//1. 初始化
+	void InitDisplay(void);
+
+	//2. 执行
+	void ChangeVisionType(DimensionDir eDir);
+
+	//3. 保存当前的数据
+	void SaveLocParams(void);
+	void ShowLocParams(void);
+
+	//3. 保存当前状态
+	void SaveNccDotProcess(void);
+	void ShowNccDotProcess(void);
+
+	//4. 显示效果
+	void DispAllResult(void);
+
+public:
+	DimensionDir m_eDir;
+	DispResultObject m_dispResultObject;
+
+public:
+	afx_msg void OnClose();
+	virtual BOOL OnInitDialog();
+	int setDimensionDir(DimensionDir eDir);
+	afx_msg void OnBnClickedButtonTopRefreshLoc();
+	afx_msg void OnBnClickedButtonBotRefreshLoc();
+	afx_msg void OnBnClickedButtonTopDeleteLoc();
+	afx_msg void OnBnClickedButtonBotDeleteLoc();
+	afx_msg void OnBnClickedButtonExecuteLoc();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnBnClickedButtonSaveLoc();;
+	afx_msg void OnBnClickedButtonNorch();
+};
diff --git a/BlVisionPro/View/LockSetDlg.cpp b/BlVisionPro/View/LockSetDlg.cpp
new file mode 100644
index 0000000..15dd7d4
--- /dev/null
+++ b/BlVisionPro/View/LockSetDlg.cpp
@@ -0,0 +1,99 @@
+// LockSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "LockSetDlg.h"
+#include "afxdialogex.h"
+
+
+#define  TIMER_ID_LOCK_ID            6001
+// CLockSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CLockSetDlg, CDialogEx)
+
+CLockSetDlg::CLockSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_LOCK_SET, pParent)
+{
+
+}
+
+CLockSetDlg::~CLockSetDlg()
+{
+}
+
+void CLockSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CLockSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+
+// CLockSetDlg 消息处理程序
+
+
+BOOL CLockSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CLockSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+	m_nLockTime = 0;
+
+	// TODO:  在此添加额外的初始化
+	this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+	SetTimer(TIMER_ID_LOCK_ID, 1000, NULL);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CLockSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	KillTimer(TIMER_ID_LOCK_ID);
+
+	CDialogEx::OnClose();
+}
+
+
+void CLockSetDlg::OnTimer(UINT_PTR nIDEvent)
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	switch (nIDEvent)
+	{
+	case TIMER_ID_LOCK_ID:
+		ShowLockTime();
+		break;
+
+	default:
+		break;
+	}
+
+	CDialogEx::OnTimer(nIDEvent);
+}
+
+void CLockSetDlg::ShowLockTime(void) {
+	/* code */
+	CString strTime;
+	strTime.Format(_T("Lock: %d sec"), m_nLockTime);
+	GetDlgItem(IDC_STATIC_LOCK_TIME)->SetWindowText(strTime);
+
+	m_nLockTime += 1;
+}
diff --git a/BlVisionPro/View/LockSetDlg.h b/BlVisionPro/View/LockSetDlg.h
new file mode 100644
index 0000000..cb0d16f
--- /dev/null
+++ b/BlVisionPro/View/LockSetDlg.h
@@ -0,0 +1,34 @@
+#pragma once
+
+
+// CLockSetDlg 对话框
+
+class CLockSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CLockSetDlg)
+
+public:
+	CLockSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CLockSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_LOCK_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+
+private:
+	int m_nLockTime;
+
+private:
+	void ShowLockTime(void);
+};
diff --git a/BlVisionPro/View/MeasureSetDlg.cpp b/BlVisionPro/View/MeasureSetDlg.cpp
new file mode 100644
index 0000000..b996353
--- /dev/null
+++ b/BlVisionPro/View/MeasureSetDlg.cpp
@@ -0,0 +1,269 @@
+// MeasureSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "MeasureSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+
+
+// CMeasureSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CMeasureSetDlg, CDialogEx)
+
+CMeasureSetDlg::CMeasureSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_MEASURE_SET, pParent)
+{
+	m_dot = NULL;
+	for (int i = 0; i < 4; i++) {
+		m_inf[i].idxRefer = 0;
+		m_inf[i].typePoint = 0;
+		m_inf[i].modePoint = 0;
+		m_inf[i].pointThres = 30;
+		m_inf[i].modeNear = 0;
+		m_inf[i].nearThres = 30;
+	}
+
+	m_firstPoint.x = 0;
+	m_firstPoint.y = 0;
+
+	m_secondPoint.x = 0;
+	m_secondPoint.y = 0;
+}
+
+CMeasureSetDlg::~CMeasureSetDlg()
+{
+}
+
+void CMeasureSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE, m_combPointRefer[0]);
+	DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE, m_combPointType[0]);
+	DDX_Control(pDX, IDC_COMBO_START_MODE, m_combStartMode[0]);
+	DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE, m_combEndMode[0]);
+
+	DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE2, m_combPointRefer[1]);
+	DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE2, m_combPointType[1]);
+	DDX_Control(pDX, IDC_COMBO_START_MODE2, m_combStartMode[1]);
+	DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE2, m_combEndMode[1]);
+
+	DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE3, m_combPointRefer[2]);
+	DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE3, m_combPointType[2]);
+	DDX_Control(pDX, IDC_COMBO_START_MODE3, m_combStartMode[2]);
+	DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE3, m_combEndMode[2]);
+
+	DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE4, m_combPointRefer[3]);
+	DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE4, m_combPointType[3]);
+	DDX_Control(pDX, IDC_COMBO_START_MODE4, m_combStartMode[3]);
+	DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE4, m_combEndMode[3]);
+
+	DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE, m_inf[0].pointThres);
+	DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE, m_inf[0].nearThres);
+
+	DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE2, m_inf[1].pointThres);
+	DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE2, m_inf[1].nearThres);
+
+	DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE3, m_inf[2].pointThres);
+	DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE3, m_inf[2].nearThres);
+
+	DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE4, m_inf[3].pointThres);
+	DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE4, m_inf[3].nearThres);
+
+	DDX_Text(pDX, IDC_EDIT_POSE_X_MEASURE, m_firstPoint.x);
+	DDX_Text(pDX, IDC_EDIT_POSE_Y_MEASURE, m_firstPoint.y);
+
+	DDX_Text(pDX, IDC_EDIT_BOT_X_MEASURE, m_secondPoint.x);
+	DDX_Text(pDX, IDC_EDIT_BOT_Y_MEASURE, m_secondPoint.y);
+}
+
+
+BEGIN_MESSAGE_MAP(CMeasureSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_SET_TOP_MEASURE, &CMeasureSetDlg::OnBnClickedButtonSetTopMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_DEL_TOP_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDelTopMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_SET_BOT_MEASURE, &CMeasureSetDlg::OnBnClickedButtonSetBotMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_DEL_BOT_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDelBotMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_DRAW_ROI_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_DRAW_ROI_MEASURE2, &CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure2)
+END_MESSAGE_MAP()
+
+
+// CMeasureSetDlg 消息处理程序
+
+
+BOOL CMeasureSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CMeasureSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitControl();
+
+	ShowParamUi();
+
+	LockROI(-1);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CMeasureSetDlg::SetDot(CCornerDistProcess *dot) {
+	/* code */
+	m_dot = dot;
+}
+
+void CMeasureSetDlg::InitControl(void) {
+	/* code */
+	for (int i = 0; i < 4; i++) {
+		m_combPointRefer[i].InsertString(0, _T("Affine"));
+		m_combPointRefer[i].InsertString(1, _T("Top Point"));
+		m_combPointRefer[i].InsertString(2, _T("Bot Point"));
+		m_combPointRefer[i].SetCurSel(0);
+
+		m_combPointType[i].InsertString(0, _T("Start Point"));
+		m_combPointType[i].InsertString(1, _T("End Point"));
+		m_combPointType[i].SetCurSel(0);
+
+		m_combStartMode[i].InsertString(0, _T("All"));
+		m_combStartMode[i].InsertString(1, _T("W_T_B"));
+		m_combStartMode[i].InsertString(2, _T("B_T_W"));
+		m_combStartMode[i].SetCurSel(0);
+
+		m_combEndMode[i].InsertString(0, _T("All"));
+		m_combEndMode[i].InsertString(1, _T("W_T_B"));
+		m_combEndMode[i].InsertString(2, _T("B_T_W"));
+		m_combEndMode[i].SetCurSel(0);
+	}
+}
+
+void CMeasureSetDlg::ShowParamUi(void) {
+	/* code */
+	if (NULL == m_dot) return;
+
+	m_firstPoint = m_dot->getPoint(4);
+	m_secondPoint = m_dot->getPoint(5);
+
+	MeasureInfo inf;
+	for (int i = 0; i < 4; i++) {
+		inf = m_dot->getMeasureInfo(i);
+		m_inf[i] = inf;
+
+		m_combPointRefer[i].SetCurSel(inf.idxRefer);
+		m_combPointType[i].SetCurSel(inf.typePoint);
+		m_combStartMode[i].SetCurSel(inf.modePoint);
+		m_combEndMode[i].SetCurSel(inf.modeNear);
+	}
+
+	UpdateData(FALSE);
+}
+
+void CMeasureSetDlg::SaveCornerParam(void) {
+	/* code */
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+	m_dot->setPoint(m_firstPoint, 4);
+	m_dot->setPoint(m_secondPoint, 5);
+
+	MeasureInfo inf;
+	for (int i = 0; i < 4; i++) {
+		inf = m_inf[i];
+		inf.idxRefer = m_combPointRefer[i].GetCurSel();
+		inf.typePoint = m_combPointType[i].GetCurSel();
+		inf.modePoint = m_combStartMode[i].GetCurSel();
+		inf.modeNear = m_combEndMode[i].GetCurSel();
+		m_dot->setMeasureInfo(inf, i);
+	}
+}
+
+void CMeasureSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	SaveCornerParam();
+
+	CDialogEx::OnClose();
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonSetTopMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonDelTopMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	m_firstPoint.x = 0;
+	m_firstPoint.y = 0;
+	m_dot->setPoint(m_firstPoint, 4);
+
+	UpdateData(FALSE);
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonSetBotMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonDelBotMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	m_secondPoint.x = 0;
+	m_secondPoint.y = 0;
+	m_dot->setPoint(m_secondPoint, 5);
+	UpdateData(FALSE);
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+
+	LockROI(1);
+}
+
+void CMeasureSetDlg::LockROI(int nType) {
+	/* code */
+	if (1 == nType) {
+		GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(TRUE);
+		GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(FALSE);
+	}
+	else if (2 == nType) {
+		GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(TRUE);
+	}
+	else {
+		GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(FALSE);
+	}
+}
+
+void CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure2()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+
+	LockROI(2);
+}
diff --git a/BlVisionPro/View/MeasureSetDlg.h b/BlVisionPro/View/MeasureSetDlg.h
new file mode 100644
index 0000000..eb8d463
--- /dev/null
+++ b/BlVisionPro/View/MeasureSetDlg.h
@@ -0,0 +1,62 @@
+#pragma once
+
+// CMeasureSetDlg 对话框
+#include "CornerDistProcess.h"
+#include "afxwin.h"
+
+class CMeasureSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CMeasureSetDlg)
+
+public:
+	CMeasureSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CMeasureSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_MEASURE_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	CCornerDistProcess *m_dot;
+
+	MeasureInfo m_inf[4];
+
+	CComboBox m_combPointRefer[4];
+	CComboBox m_combPointType[4];
+	CComboBox m_combStartMode[4];
+	CComboBox m_combEndMode[4];
+
+	Point2I m_firstPoint;
+	Point2I m_secondPoint;
+
+private:
+	//1. 初始化空间
+	void InitControl(void);
+
+	//2. 显示参数
+	void ShowParamUi(void);
+
+	//3. 保存参数
+	void SaveCornerParam(void);
+
+	void LockROI(int nType);
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	void SetDot(CCornerDistProcess *dot);
+	
+	afx_msg void OnClose();
+	afx_msg void OnBnClickedButtonSetTopMeasure();
+	afx_msg void OnBnClickedButtonDelTopMeasure();
+	afx_msg void OnBnClickedButtonSetBotMeasure();
+	afx_msg void OnBnClickedButtonDelBotMeasure();
+	afx_msg void OnBnClickedButtonDrawRoiMeasure();
+	afx_msg void OnBnClickedButtonDrawRoiMeasure2();
+};
diff --git a/BlVisionPro/View/OpRoiDlg.cpp b/BlVisionPro/View/OpRoiDlg.cpp
new file mode 100644
index 0000000..d53d6fd
--- /dev/null
+++ b/BlVisionPro/View/OpRoiDlg.cpp
@@ -0,0 +1,142 @@
+// OpRoiDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "OpRoiDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+
+
+// COpRoiDlg 对话框
+
+IMPLEMENT_DYNAMIC(COpRoiDlg, CDialogEx)
+
+COpRoiDlg::COpRoiDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_ROI_SET, pParent)
+	, m_stepX(2)
+	, m_stepY(2)
+{
+	m_isLock = TRUE;
+}
+
+COpRoiDlg::~COpRoiDlg()
+{
+}
+
+void COpRoiDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Text(pDX, IDC_EDIT_X_STEP_ROI, m_stepX);
+	DDX_Text(pDX, IDC_EDIT_Y_STEP_ROI, m_stepY);
+}
+
+
+BEGIN_MESSAGE_MAP(COpRoiDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_MOVE_RIGHT_ROI, &COpRoiDlg::OnBnClickedButtonMoveRightRoi)
+	ON_BN_CLICKED(IDC_BUTTON_MOVE_UP_ROI, &COpRoiDlg::OnBnClickedButtonMoveUpRoi)
+	ON_BN_CLICKED(IDC_BUTTON_MOVE_LEFT_ROI, &COpRoiDlg::OnBnClickedButtonMoveLeftRoi)
+	ON_BN_CLICKED(IDC_BUTTON_MOVE_DOWN_ROI, &COpRoiDlg::OnBnClickedButtonMoveDownRoi)
+END_MESSAGE_MAP()
+
+
+// COpRoiDlg 消息处理程序
+
+
+void COpRoiDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	m_isLock = TRUE;
+	CDialogEx::OnClose();
+}
+
+
+BOOL COpRoiDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL COpRoiDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitBitICON();
+
+	::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 1200, 200, 0, 0, SWP_NOSIZE);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void COpRoiDlg::InitBitICON(void) {
+	/* code */
+	{
+		CButton *pTop = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_UP_ROI));
+		HICON iconTop = AfxGetApp()->LoadIcon(IDI_ICON_UP);
+		pTop->SetIcon(iconTop);
+	}
+
+	{
+		CButton *pDown = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_DOWN_ROI));
+		HICON iconDown = AfxGetApp()->LoadIcon(IDI_ICON_DOWN);
+		pDown->SetIcon(iconDown);
+	}
+	
+	{
+		CButton *pBtnRight = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_RIGHT_ROI));
+		HICON iconRight = AfxGetApp()->LoadIcon(IDI_ICON_RIGHT);
+		pBtnRight->SetIcon(iconRight);
+	}
+
+	{
+		CButton *pBtnLeft = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_LEFT_ROI));
+		HICON iconLeft = AfxGetApp()->LoadIcon(IDI_ICON_LEFT);
+		pBtnLeft->SetIcon(iconLeft);
+	}
+}
+
+void COpRoiDlg::MoveRegion(int nType) {
+	/* code */
+}
+
+
+void COpRoiDlg::OnBnClickedButtonMoveRightRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	MoveRegion(0);
+}
+
+
+void COpRoiDlg::OnBnClickedButtonMoveUpRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	MoveRegion(1);
+}
+
+
+void COpRoiDlg::OnBnClickedButtonMoveLeftRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	MoveRegion(2);
+}
+
+
+void COpRoiDlg::OnBnClickedButtonMoveDownRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	MoveRegion(3);
+}
+
+
diff --git a/BlVisionPro/View/OpRoiDlg.h b/BlVisionPro/View/OpRoiDlg.h
new file mode 100644
index 0000000..ba27b7b
--- /dev/null
+++ b/BlVisionPro/View/OpRoiDlg.h
@@ -0,0 +1,45 @@
+#pragma once
+
+
+// COpRoiDlg 对话框
+
+class COpRoiDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(COpRoiDlg)
+
+public:
+	COpRoiDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~COpRoiDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_ROI_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	int m_stepX;
+	int m_stepY;
+
+	BOOL m_isLock;
+
+private:
+	//区域
+	void MoveRegion(int nType);
+
+	//
+	void InitBitICON(void);
+
+public:
+	afx_msg void OnClose();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnBnClickedButtonMoveRightRoi();
+	afx_msg void OnBnClickedButtonMoveUpRoi();
+	afx_msg void OnBnClickedButtonMoveLeftRoi();
+	afx_msg void OnBnClickedButtonMoveDownRoi();
+};
diff --git a/BlVisionPro/View/RcutSetDLg.cpp b/BlVisionPro/View/RcutSetDLg.cpp
new file mode 100644
index 0000000..52b7ef4
--- /dev/null
+++ b/BlVisionPro/View/RcutSetDLg.cpp
@@ -0,0 +1,1076 @@
+// RcutSetDLg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "RcutSetDLg.h"
+#include "afxdialogex.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "VisionRecipe.h"
+#include "SoftVisionApp.h"
+
+// CRcutSetDLg 对话框
+
+IMPLEMENT_DYNAMIC(CRcutSetDLg, CDialogEx)
+
+CRcutSetDLg::CRcutSetDLg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_RCUT_SET, pParent)
+{
+	/* code */
+	m_dotTop = NULL;
+	m_dotBot = NULL;
+}
+
+CRcutSetDLg::~CRcutSetDLg()
+{
+}
+
+void CRcutSetDLg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_PANEL_KDIST_INFO, m_PanelRcut);
+	DDX_Control(pDX, IDC_PANEL_BRK_INFO, m_PanelBroken);
+}
+
+
+BEGIN_MESSAGE_MAP(CRcutSetDLg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_RCUT, &CRcutSetDLg::OnBnClickedButtonProcessRcut)
+	ON_COMMAND(ID_EDITROI_IMAGEROI, &CRcutSetDLg::OnEditroiImageroi)
+	ON_BN_CLICKED(IDC_BUTTON_SET_IMAGE_RCUT, &CRcutSetDLg::OnBnClickedButtonSetImageRcut)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_RCUT, &CRcutSetDLg::OnBnClickedButtonSaveRcut)
+	ON_BN_CLICKED(IDC_BUTTON_SET_IMAGE_RCUT2, &CRcutSetDLg::OnBnClickedButtonSetImageRcut2)
+	ON_BN_CLICKED(IDC_BUTTON_TOP_TRAIN, &CRcutSetDLg::OnBnClickedButtonTopTrain)
+	ON_BN_CLICKED(IDC_BUTTON_TOP_TRAIN2, &CRcutSetDLg::OnBnClickedButtonTopTrain2)
+	ON_BN_CLICKED(IDC_BTN_TOP_SET_STD, &CRcutSetDLg::OnBnClickedBtnTopSetStd)
+	ON_BN_CLICKED(IDC_BTN_BOT_SET_STD, &CRcutSetDLg::OnBnClickedBtnBotSetStd)
+END_MESSAGE_MAP()
+
+
+// CRcutSetDLg 消息处理程序
+
+
+void CRcutSetDLg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	if (NULL != m_displayTop1) {
+		ClsDisplay_Free(m_displayTop1);
+		m_displayTop1 = NULL;
+	}
+
+	if (NULL != m_displayTop2) {
+		ClsDisplay_Free(m_displayTop2);
+		m_displayTop2 = NULL;
+	}
+	if (NULL != m_displayTop3) {
+		ClsDisplay_Free(m_displayTop3);
+		m_displayTop3 = NULL;
+	}
+
+
+	if (NULL != m_displayBot1) {
+		ClsDisplay_Free(m_displayBot1);
+		m_displayBot1 = NULL;
+	}
+	if (NULL != m_displayBot2) {
+		ClsDisplay_Free(m_displayBot2);
+		m_displayBot2 = NULL;
+	}
+	if (NULL != m_displayBot3) {
+		ClsDisplay_Free(m_displayBot3);
+		m_displayBot3 = NULL;
+	}
+	
+	CDialogEx::OnClose();
+}
+
+int CRcutSetDLg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+	return 0;
+}
+
+BOOL CRcutSetDLg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitDisplay();
+
+	InitMenu();
+
+	InitPanel();
+
+	InitPanel_BRK();
+
+	m_eDir = DIMENSION_NONE;
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CRcutSetDLg::InitDisplay(void) {
+	/* code */
+	m_displayTop1 = ClsDisplay_Create();
+	if (nullptr != m_displayTop1) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT);
+		pDispWnd->GetWindowRect(rect);
+		m_displayTop1->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayTop1->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayTop1->SetDraw("fill", DISP_OBJECT);
+		m_displayTop1->SetColor("red", DISP_OBJECT);
+
+		m_displayTop1->SetDraw("fill", DISP_REGION);
+		m_displayTop1->SetColor("red", DISP_REGION);
+
+		m_displayTop1->SetDraw("fill", DISP_CROSS);
+		m_displayTop1->SetColor("green", DISP_CROSS);
+
+		m_displayTop1->SetDraw("fill", DISP_SELECT);
+		m_displayTop1->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayTop1->SetBackgroundColor(color);
+	}
+
+	m_displayTop2 = ClsDisplay_Create();
+	if (nullptr != m_displayTop2) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT_CHIP);
+		pDispWnd->GetWindowRect(rect);
+		m_displayTop2->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayTop2->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayTop2->SetDraw("fill", DISP_OBJECT);
+		m_displayTop2->SetColor("red", DISP_OBJECT);
+
+		m_displayTop2->SetDraw("fill", DISP_REGION);
+		m_displayTop2->SetColor("red", DISP_REGION);
+
+		m_displayTop2->SetDraw("fill", DISP_CROSS);
+		m_displayTop2->SetColor("green", DISP_CROSS);
+
+		m_displayTop2->SetDraw("fill", DISP_SELECT);
+		m_displayTop2->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayTop2->SetBackgroundColor(color);
+	}
+
+	m_displayTop3 = ClsDisplay_Create();
+	if (nullptr != m_displayTop3) {
+		CRect rect;
+		CWnd* pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT_BRK);
+		pDispWnd->GetWindowRect(rect);
+		m_displayTop3->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayTop3->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayTop3->SetDraw("fill", DISP_OBJECT);
+		m_displayTop3->SetColor("red", DISP_OBJECT);
+
+		m_displayTop3->SetDraw("fill", DISP_REGION);
+		m_displayTop3->SetColor("red", DISP_REGION);
+
+		m_displayTop3->SetDraw("fill", DISP_CROSS);
+		m_displayTop3->SetColor("green", DISP_CROSS);
+
+		m_displayTop3->SetDraw("fill", DISP_SELECT);
+		m_displayTop3->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayTop3->SetBackgroundColor(color);
+	}
+
+	m_displayBot1 = ClsDisplay_Create();
+	if (nullptr != m_displayBot1) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT2);
+		pDispWnd->GetWindowRect(rect);
+		m_displayBot1->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayBot1->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayBot1->SetDraw("fill", DISP_OBJECT);
+		m_displayBot1->SetColor("red", DISP_OBJECT);
+
+		m_displayBot1->SetDraw("fill", DISP_REGION);
+		m_displayBot1->SetColor("red", DISP_REGION);
+
+		m_displayBot1->SetDraw("fill", DISP_CROSS);
+		m_displayBot1->SetColor("green", DISP_CROSS);
+
+		m_displayBot1->SetDraw("fill", DISP_SELECT);
+		m_displayBot1->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayBot1->SetBackgroundColor(color);
+	}
+
+	m_displayBot2 = ClsDisplay_Create();
+	if (nullptr != m_displayBot2) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT_CHIP);
+		pDispWnd->GetWindowRect(rect);
+		m_displayBot2->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayBot2->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayBot2->SetDraw("fill", DISP_OBJECT);
+		m_displayBot2->SetColor("red", DISP_OBJECT);
+
+		m_displayBot2->SetDraw("fill", DISP_REGION);
+		m_displayBot2->SetColor("red", DISP_REGION);
+
+		m_displayBot2->SetDraw("fill", DISP_CROSS);
+		m_displayBot2->SetColor("green", DISP_CROSS);
+
+		m_displayBot2->SetDraw("fill", DISP_SELECT);
+		m_displayBot2->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayBot2->SetBackgroundColor(color);
+	}
+
+	m_displayBot3 = ClsDisplay_Create();
+	if (nullptr != m_displayBot3) {
+		CRect rect;
+		CWnd* pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT_BRK);
+		pDispWnd->GetWindowRect(rect);
+		m_displayBot3->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayBot3->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayBot3->SetDraw("fill", DISP_OBJECT);
+		m_displayBot3->SetColor("red", DISP_OBJECT);
+
+		m_displayBot3->SetDraw("fill", DISP_REGION);
+		m_displayBot3->SetColor("red", DISP_REGION);
+
+		m_displayBot3->SetDraw("fill", DISP_CROSS);
+		m_displayBot3->SetColor("green", DISP_CROSS);
+
+		m_displayBot3->SetDraw("fill", DISP_SELECT);
+		m_displayBot3->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayBot3->SetBackgroundColor(color);
+	}
+}
+
+void CRcutSetDLg::InitMenu(void) {
+	/* code */
+	m_visionMenu.LoadMenu(IDR_MENU1);
+}
+
+BOOL CRcutSetDLg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CRcutSetDLg::OnBnClickedButtonProcessRcut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveRcutParam();
+	if (NULL == m_dot) return;
+
+//	Log_GetDebug()->TraceInfo("Start: %d", __LINE__);
+	m_dot->execute(m_eDir);
+//	Log_GetDebug()->TraceInfo("End: %d", __LINE__);
+
+	ShowRcutImage();
+
+	DispResult();
+}
+
+void CRcutSetDLg::DispResult(void) {
+	/* code */
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	DispAllResult();
+}
+
+void CRcutSetDLg::DispAllResult(void) {
+	/* code */
+	int nCount = 2;
+	for (int i = 0; i < nCount; i++) {
+		CRcutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelRcut.SetItemText(id, 12, _T("NAN"));
+		}
+		else {   //显示结果
+			CString strResult;
+			strResult.Format(_T("%d"), (int)dot->m_nNgInfo.size());
+			int id = dot->getID();
+			m_PanelRcut.SetItemText(id, 12, strResult);
+		}
+	}
+
+	m_PanelRcut.Invalidate(FALSE);
+}
+
+void CRcutSetDLg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. name
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+
+	//4. Chamfer Size
+	strText = _T("Chamber Size");
+	m_vParams.push_back(strText);
+	//5. Bin Thres
+	strText = _T("Edge Thres");
+	m_vParams.push_back(strText);
+
+	//6. Chip Range
+	strText = _T("Chip Range");
+	m_vParams.push_back(strText);
+	//7. Chip Thres
+	strText = _T("Chip Thres");
+	m_vParams.push_back(strText);
+	//8. Chip Smooth
+	strText = _T("Chip Smooth");
+	m_vParams.push_back(strText);
+
+	//9. Start Da
+	strText = _T("Start Da");
+	m_vParams.push_back(strText);
+	//10.End Da
+	strText = _T("End Da");
+	m_vParams.push_back(strText);
+
+	// 11.Dx
+	strText = _T("Dx(um)");
+	m_vParams.push_back(strText);
+	// 12.Dy
+	strText = _T("Dy(um)");
+	m_vParams.push_back(strText);
+
+	// 13.Result
+	strText = _T("Result");
+	m_vParams.push_back(strText);
+
+	int nRows = 3;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelRcut.DeleteAllItems();
+	m_PanelRcut.SetVirtualMode(FALSE);
+	m_PanelRcut.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelRcut.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelRcut.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelRcut.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelRcut.SetRowCount(nRows);
+	m_PanelRcut.SetColumnCount(nCols);
+	m_PanelRcut.SetFixedRowCount(nFixRows);
+	m_PanelRcut.SetFixedColumnCount(1);
+	m_PanelRcut.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelRcut.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelRcut.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelRcut.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelRcut.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelRcut.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelRcut.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelRcut.SetColumnWidth(nColIdx, 50);
+		}
+		else if (2 == i) {
+			m_PanelRcut.SetColumnWidth(nColIdx, 60);
+		}
+		else {
+			m_PanelRcut.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelRcut.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++) {
+		m_PanelRcut.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CRcutSetDLg::InitPanel_BRK(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//3. Sigma
+	strText = _T("Auto Sigma");
+	m_vParams.push_back(strText);
+	//4. Noise Size
+	strText = _T("Noise Size");
+	m_vParams.push_back(strText);
+	//5. Dist Thres
+	strText = _T("Dist Thres");
+	m_vParams.push_back(strText);
+	//6. Smooth
+	strText = _T("Smooth");
+	m_vParams.push_back(strText);
+	//7. Start Da
+	strText = _T("Start Da");
+	m_vParams.push_back(strText);
+	//8. End Da
+	strText = _T("End Da");
+	m_vParams.push_back(strText);
+	//9. Area
+	strText = _T("Area Thres");
+	m_vParams.push_back(strText);
+	//10.Tech use
+	strText = _T("Tech use");
+	m_vParams.push_back(strText);
+
+	int nRows = 3;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelBroken.DeleteAllItems();
+	m_PanelBroken.SetVirtualMode(FALSE);
+	m_PanelBroken.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelBroken.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelBroken.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelBroken.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelBroken.SetRowCount(nRows);
+	m_PanelBroken.SetColumnCount(nCols);
+	m_PanelBroken.SetFixedRowCount(nFixRows);
+	m_PanelBroken.SetFixedColumnCount(1);
+	m_PanelBroken.SetFixedColumnCount(nFixCols);
+
+	CFont* pFont = m_PanelRcut.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelBroken.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelBroken.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelBroken.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelBroken.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		m_PanelBroken.SetColumnWidth(nColIdx, 75);
+		strText = m_vParams[i];
+		m_PanelBroken.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++) {
+		m_PanelBroken.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CRcutSetDLg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveRcutParam();
+
+	//m_dotRCUT = NULL;
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getCornerRcutProcess(eDir);
+	m_dotTop = m_dot->m_dots[0];
+	m_dotBot = m_dot->m_dots[1];
+
+	ShowRcutParam();
+	ShowRcutImage();
+}
+
+void CRcutSetDLg::SaveRcutParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+	CString strText;
+	for (int i = 0; i < 2; i++) {
+		CRcutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		//USE
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+        dot->m_nBrokenUse = _wtoi(strText);
+		idx += 1;
+
+		//3. USE
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		//Sigma
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+        dot->m_fSigmaThres = _wtof(strText);
+		idx += 1;
+
+		//4.  Chamfer Size
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nChamferSize = _wtoi(strText);
+		//Noise Size
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_fOpenPara = _wtof(strText);
+		idx += 1;
+
+		//5. bin Thres
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nBinThres = _wtoi(strText);
+		//Dist Thres
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nDistThres = _wtoi(strText);
+		idx += 1;
+
+		//6. Chip Range
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nChipRange = _wtoi(strText);
+		//Broke Smooth
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nBrokenSmooth = _wtoi(strText);
+		idx += 1;
+
+		//7. Chip Thres
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nChipThres = _wtoi(strText);
+		//Start Da
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+        dot->m_nStartDa = _wtoi(strText);
+		idx += 1;
+
+		//8. Smooth
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nEdgeSmooth = _wtoi(strText);
+		//End Da
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nEndDa = _wtoi(strText);
+		idx += 1;
+
+		//9.Start Da
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nStartAngle = _wtoi(strText);
+		//Broken Area
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nBrokenArea = _wtoi(strText);
+		idx += 1;
+
+		//10.End Da
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nEndAngle = _wtoi(strText);
+		//Tech Area
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nTech = _wtoi(strText);
+		idx += 1;
+
+		//11. Dx
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nDx = _wtoi(strText);
+		idx += 1;
+
+		//12. Dy
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nDy = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+void CRcutSetDLg::ShowRcutParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	CString strText;
+	for (int i = 0; i < 2; i++) {
+		CRcutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//ID
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//USE
+		strText.Format(_T("%d"), dot->m_nBrokenUse);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Sigma
+        strText.Format(_T("%.1f"), dot->m_fSigmaThres);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Chamfer Size
+		strText.Format(_T("%d"), dot->m_nChamferSize);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Noise Size
+		strText.Format(_T("%.1f"), dot->m_fOpenPara);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Edge Thres
+		strText.Format(_T("%d"), dot->m_nBinThres);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Dist Thres
+		strText.Format(_T("%d"), dot->m_nDistThres);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Chip Range
+		strText.Format(_T("%d"), dot->m_nChipRange);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Broken Smooth
+		strText.Format(_T("%d"), dot->m_nBrokenSmooth);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. Chip Thres
+		strText.Format(_T("%d"), dot->m_nChipThres);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Start Da
+		strText.Format(_T("%d"), dot->m_nStartDa);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Chip Smooth
+		strText.Format(_T("%d"), dot->m_nEdgeSmooth);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//End Da
+		strText.Format(_T("%d"), dot->m_nEndDa);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Start Da
+		strText.Format(_T("%d"), dot->m_nStartAngle);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Break Area
+		strText.Format(_T("%d"), dot->m_nBrokenArea);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. End Da
+		strText.Format(_T("%d"), dot->m_nEndAngle);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Tech Use
+		strText.Format(_T("%d"), dot->m_nTech);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//11. Dx
+		strText.Format(_T("%d"), dot->m_nDx);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//12. Dy
+		strText.Format(_T("%d"), dot->m_nDy);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//13. Result
+		strText.Format(_T("%d"), (int)(dot->m_nNgInfo.size()));
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+void CRcutSetDLg::OnEditroiImageroi()
+{
+	// TODO: 在此添加命令处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+}
+
+void CRcutSetDLg::ShowRcutImage(void) {
+	/* code */
+	if (NULL != m_dotTop) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_dotTop->getImage(), width, height);
+
+		if (NULL != m_displayTop1 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayTop1->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayTop1->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayTop1->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayTop1->GetSelect());
+
+			m_displayTop1->UnableFlush();
+			m_displayTop1->ClearWindow();
+			m_displayTop1->AutoWindowSize(width, height);
+			m_displayTop1->SetImage(m_dotTop->getImage());
+			m_displayTop1->SetRegion(m_dotTop->getRoiRegion());
+			m_displayTop1->DispImage();
+			m_displayTop1->DispRegion();
+			m_displayTop1->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayTop1) {
+				m_displayTop1->UnableFlush();
+				m_displayTop1->ClearWindow();
+				m_displayTop1->DispImage();
+				m_displayTop1->DispRegion();;
+				m_displayTop1->AbleFlush();
+			}
+		}
+
+
+		if (NULL != m_displayTop2 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayTop2->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayTop2->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayTop2->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayTop2->GetSelect());
+
+			m_displayTop2->UnableFlush();
+			m_displayTop2->ClearWindow();
+			m_displayTop2->AutoWindowSize(width, height);
+			m_displayTop2->SetImage(m_dotTop->getImage());
+			m_displayTop2->SetRegion(m_dotTop->getChipRegion());
+			m_displayTop2->DispImage();
+			m_displayTop2->DispRegion();
+			m_displayTop2->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayTop2) {
+				m_displayTop2->UnableFlush();
+				m_displayTop2->ClearWindow();
+				m_displayTop2->DispImage();
+				m_displayTop2->DispRegion();;
+				m_displayTop2->AbleFlush();
+			}
+		}
+
+
+		CString strChamber;
+		strChamber.Format(_T("Chamber: %.0f, (%.0f, %.0f)"), m_dotTop->m_fAvgChamber, m_dotTop->m_fMinChamber, m_dotTop->m_fMaxChamber);
+		GetDlgItem(IDC_STATIC_TOP_CHAMBER_RCUT)->SetWindowText(strChamber);
+	}
+
+	if (NULL != m_dotTop) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_dotTop->getImage(), width, height);
+
+		if (NULL != m_displayTop3 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayTop3->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayTop3->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayTop3->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayTop3->GetSelect());
+
+			m_displayTop3->UnableFlush();
+			m_displayTop3->ClearWindow();
+			m_displayTop3->AutoWindowSize(width, height);
+			m_displayTop3->SetImage(m_dotTop->getImage());
+			m_displayTop3->SetRegion(m_dotTop->getBRKRoiRegion());
+			m_displayTop3->DispImage();
+			m_displayTop3->DispRegion();
+			m_displayTop3->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayTop3) {
+				m_displayTop3->UnableFlush();
+				m_displayTop3->ClearWindow();
+				m_displayTop3->DispImage();
+				m_displayTop3->DispRegion();;
+				m_displayTop3->AbleFlush();
+			}
+		}
+	}
+
+	if (NULL != m_dotBot) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_dotBot->getImage(), width, height);
+
+
+		if (NULL != m_displayBot1 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayBot1->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayBot1->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayBot1->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayBot1->GetSelect());
+
+			m_displayBot1->UnableFlush();
+			m_displayBot1->ClearWindow();
+			m_displayBot1->AutoWindowSize(width, height);
+			m_displayBot1->SetImage(m_dotBot->getImage());
+			m_displayBot1->SetRegion(m_dotBot->getRoiRegion());
+			m_displayBot1->DispImage();
+			m_displayBot1->DispRegion();
+			m_displayBot1->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayBot1) {
+				m_displayBot1->UnableFlush();
+				m_displayBot1->ClearWindow();
+				m_displayBot1->DispImage();
+				m_displayBot1->DispRegion();;
+				m_displayBot1->AbleFlush();
+			}
+		}
+
+		if (NULL != m_displayBot2 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayBot2->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayBot2->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayBot2->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayBot2->GetSelect());
+
+			m_displayBot2->UnableFlush();
+			m_displayBot2->ClearWindow();
+			m_displayBot2->AutoWindowSize(width, height);
+			m_displayBot2->SetImage(m_dotBot->getImage());
+			m_displayBot2->SetRegion(m_dotBot->getChipRegion());
+			m_displayBot2->DispImage();
+			m_displayBot2->DispRegion();
+			m_displayBot2->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayBot2) {
+				m_displayBot2->UnableFlush();
+				m_displayBot2->ClearWindow();
+				m_displayBot2->DispImage();
+				m_displayBot2->DispRegion();;
+				m_displayBot2->AbleFlush();
+			}
+		}
+
+		CString strChamber;
+		strChamber.Format(_T("Chamber: %.0f, (%.0f, %.0f)"), m_dotBot->m_fAvgChamber,  m_dotBot->m_fMinChamber, m_dotBot->m_fMaxChamber);
+		GetDlgItem(IDC_STATIC_BOT_CHAMBER_RCUT)->SetWindowText(strChamber);
+	}
+
+	if (NULL != m_dotBot) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_dotBot->getImage(), width, height);
+
+
+		if (NULL != m_displayBot3 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayBot3->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayBot3->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayBot3->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayBot3->GetSelect());
+
+			m_displayBot3->UnableFlush();
+			m_displayBot3->ClearWindow();
+			m_displayBot3->AutoWindowSize(width, height);
+			m_displayBot3->SetImage(m_dotBot->getImage());
+			m_displayBot3->SetRegion(m_dotBot->getBRKRoiRegion());
+			m_displayBot3->DispImage();
+			m_displayBot3->DispRegion();
+			m_displayBot3->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayBot3) {
+				m_displayBot3->UnableFlush();
+				m_displayBot3->ClearWindow();
+				m_displayBot3->DispImage();
+				m_displayBot3->DispRegion();;
+				m_displayBot3->AbleFlush();
+			}
+		}
+	}
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonSetImageRcut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+	if (NULL == m_dot) return;
+	if (NULL == m_dotTop) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	m_dotTop->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+
+	m_dotTop->TechImage();
+
+	ShowRcutImage();
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonSaveRcut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonSetImageRcut2()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+	if (NULL == m_dot) return;
+	if (NULL == m_dotBot) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	m_dotBot->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+
+	m_dotBot->TechImage();
+
+	ShowRcutImage();
+
+#if 0
+	int nPosX = (int)(0.5 * (x1 + x2));
+	int nPosY = (int)(0.5 * (y1 + y2));
+	Point2I pose;
+	pose.x = nPosX;
+	pose.y = nPosY;
+	Point2I ptResult, ptTop, ptBot;
+	CSoftVisionApp::getInstance()->transformToStandard(m_eDir, pose, ptResult, ptTop, ptBot);
+
+	Point2I point = ptBot;
+	int width = x2 - x1 + 1;
+	int height = y2 - y1 + 1;
+	m_dotBot->setRegion(point.x, point.y, width, height);
+	m_dotBot->TechImage();
+
+	ShowRcutImage();
+#endif
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonTopTrain()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+	if (NULL == m_dot) return;
+	if (NULL == m_dotTop) return;
+
+	Point2I offset;
+	offset.x = 0;
+	offset.y = 0;
+//	Log_GetDebug()->TraceInfo("Start Inspect: %d", __LINE__);
+	m_dotTop->Execute(m_eDir, offset);
+//	Log_GetDebug()->TraceInfo("End Inspect: %d", __LINE__);
+	ShowRcutImage();
+
+	DispResult();
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonTopTrain2()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+
+	if (NULL == m_dot) return;
+	if (NULL == m_dotBot) return;
+	Point2I offset;
+	offset.x = 0;
+	offset.y = 0;
+
+	m_dotBot->Execute(m_eDir, offset);
+
+	ShowRcutImage();
+
+	DispResult();
+}
+
+void CRcutSetDLg::OnBnClickedBtnTopSetStd()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (nullptr == m_dotTop) return;
+	SaveRcutParam();
+	if (1 != m_dotTop->m_nTech) {
+		GetDlgItem(IDC_STATIC_TOP_TECH)->SetWindowTextW(_T("Set Standard Failed!"));
+		return;
+	}
+
+	m_dotTop->SetStandardPoint();
+	GetDlgItem(IDC_STATIC_TOP_TECH)->SetWindowTextW(_T("Set Standard Success!"));
+}
+
+
+void CRcutSetDLg::OnBnClickedBtnBotSetStd()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (nullptr == m_dotBot) return;
+	SaveRcutParam();
+	if (1 != m_dotBot->m_nTech) {
+		GetDlgItem(IDC_STATIC_BOT_TECH)->SetWindowTextW(_T("Set Standard Failed!"));
+		return;
+	}
+
+	m_dotBot->SetStandardPoint();
+	GetDlgItem(IDC_STATIC_BOT_TECH)->SetWindowTextW(_T("Set Standard Success!"));
+}
diff --git a/BlVisionPro/View/RcutSetDLg.h b/BlVisionPro/View/RcutSetDLg.h
new file mode 100644
index 0000000..bb564ad
--- /dev/null
+++ b/BlVisionPro/View/RcutSetDLg.h
@@ -0,0 +1,90 @@
+#pragma once
+
+
+// CRcutSetDLg 对话框
+#include "VisionRecipe.h"
+#include "afxwin.h"
+
+#include "CornerRcutProcess.h"
+#include "RcutDotProcess.h"
+#include "afxcmn.h"
+
+class CRcutSetDLg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CRcutSetDLg)
+
+public:
+	CRcutSetDLg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CRcutSetDLg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_RCUT_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	DimensionDir m_eDir;
+	CMenu m_visionMenu;
+	IClsDisplay *m_displayTop1;
+	IClsDisplay *m_displayTop2;
+	IClsDisplay *m_displayTop3;
+
+	IClsDisplay *m_displayBot1;
+	IClsDisplay *m_displayBot2;
+    IClsDisplay *m_displayBot3;
+
+	CGridCtrl	m_PanelRcut;
+	CGridCtrl	m_PanelBroken;
+	CCornerRcutProcess *m_dot;
+	CRcutDotProcess *m_dotTop;
+	CRcutDotProcess *m_dotBot;
+
+	std::vector<CString> m_vParams;
+
+private:
+	//1. 初始化
+	void InitDisplay(void);
+
+	//2. 初始化菜单
+	void InitMenu(void);
+
+	//3. 初始化
+	void InitPanel(void);
+	void InitPanel_BRK(void);
+
+	//4. //保存数据
+	void SaveRcutParam(void);
+
+	//6. 显示参数
+	void ShowRcutParam(void);
+
+	//7. 显示画面
+	void ShowRcutImage(void);
+
+	//8. 显示结果
+	void DispResult(void);
+
+	//4. 显示区域
+	void DispAllResult(void);
+
+public:
+	afx_msg void OnClose();
+	int setDimensionDir(DimensionDir eDir);
+	void ChangeVisionType(DimensionDir eDir);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnBnClickedButtonProcessRcut();
+	afx_msg void OnEditroiImageroi();
+	afx_msg void OnBnClickedButtonSetImageRcut();;
+	afx_msg void OnBnClickedButtonSaveRcut();
+	afx_msg void OnBnClickedButtonSetImageRcut2();
+	afx_msg void OnBnClickedButtonTopTrain();
+	afx_msg void OnBnClickedButtonTopTrain2();
+	afx_msg void OnBnClickedBtnTopSetStd();
+	afx_msg void OnBnClickedBtnBotSetStd();
+};
diff --git a/BlVisionPro/View/ScanSetDlg.cpp b/BlVisionPro/View/ScanSetDlg.cpp
new file mode 100644
index 0000000..c42e24d
--- /dev/null
+++ b/BlVisionPro/View/ScanSetDlg.cpp
@@ -0,0 +1,191 @@
+// ScanSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "ScanSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "TranformCoordinate.h"
+
+
+// CScanSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CScanSetDlg, CDialogEx)
+
+CScanSetDlg::CScanSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_SCAN_SET, pParent)
+{
+
+}
+
+CScanSetDlg::~CScanSetDlg()
+{
+}
+
+void CScanSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_COMBO_STD_POINT_SCAN, m_combStdPoint);
+	DDX_Control(pDX, IDC_COMBO_POINT1_SCAN, m_combScanPoint1);
+	DDX_Control(pDX, IDC_COMBO_POINT2_SCAN, m_combScanPoint2);
+	DDX_Control(pDX, IDC_COMBO_POINT3_SCAN, m_combScanPoint3);
+	DDX_Control(pDX, IDC_COMBO_POINT4_SCAN, m_combScanPoint4);
+	DDX_Control(pDX, IDC_COMBO_LENTH_SCAN, m_combLengthScan);
+	DDX_Control(pDX, IDC_COMBO_SHORT_SCAN, m_combShortScan);
+	DDX_Control(pDX, IDC_COMBO1, m_combScanEdge);
+}
+
+
+BEGIN_MESSAGE_MAP(CScanSetDlg, CDialogEx)
+	ON_BN_CLICKED(IDC_BUTTON_CANCEL_SCAN, &CScanSetDlg::OnBnClickedButtonCancelScan)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_SCAN, &CScanSetDlg::OnBnClickedButtonSaveScan)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_TEST_SCAN, &CScanSetDlg::OnBnClickedButtonTestScan)
+END_MESSAGE_MAP()
+
+
+// CScanSetDlg 消息处理程序
+
+
+BOOL CScanSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CScanSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitWindowUi();
+
+	SetParamsUi();
+
+	this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CScanSetDlg::InitWindowUi(void) {
+	/* code */
+	m_combStdPoint.InsertString(0, _T("C1"));
+	m_combStdPoint.InsertString(1, _T("C2"));
+	m_combStdPoint.InsertString(2, _T("C3"));
+	m_combStdPoint.InsertString(3, _T("C4"));
+
+	m_combScanPoint1.InsertString(0, _T("C1"));
+	m_combScanPoint1.InsertString(1, _T("C2"));
+	m_combScanPoint1.InsertString(2, _T("C3"));
+	m_combScanPoint1.InsertString(3, _T("C4"));
+
+	m_combScanPoint2.InsertString(0, _T("C1"));
+	m_combScanPoint2.InsertString(1, _T("C2"));
+	m_combScanPoint2.InsertString(2, _T("C3"));
+	m_combScanPoint2.InsertString(3, _T("C4"));
+
+	m_combScanPoint3.InsertString(0, _T("C1"));
+	m_combScanPoint3.InsertString(1, _T("C2"));
+	m_combScanPoint3.InsertString(2, _T("C3"));
+	m_combScanPoint3.InsertString(3, _T("C4"));
+
+	m_combScanPoint4.InsertString(0, _T("C1"));
+	m_combScanPoint4.InsertString(1, _T("C2"));
+	m_combScanPoint4.InsertString(2, _T("C3"));
+	m_combScanPoint4.InsertString(3, _T("C4"));
+
+	m_combLengthScan.InsertString(0, _T("Move Left"));
+	m_combLengthScan.InsertString(1, _T("Move Right"));
+
+	m_combShortScan.InsertString(0, _T("Move Down"));
+	m_combShortScan.InsertString(1, _T("Move Up"));
+
+	m_combScanEdge.InsertString(0, _T("TopA"));
+	m_combScanEdge.InsertString(1, _T("TopB"));
+	m_combScanEdge.InsertString(2, _T("TopC"));
+	m_combScanEdge.InsertString(3, _T("TopD"));
+	m_combScanEdge.InsertString(4, _T("BotA"));
+	m_combScanEdge.InsertString(5, _T("BotB"));
+	m_combScanEdge.InsertString(6, _T("BotC"));
+	m_combScanEdge.InsertString(7, _T("BotD"));
+	m_combScanEdge.SetCurSel(1);
+	SetDlgItemInt(IDC_EDIT_POSX_SCAN, 100);
+	SetDlgItemInt(IDC_EDIT_POSY_SCAN, 50);
+}
+
+void CScanSetDlg::SetParamsUi(void) {
+	/* code */
+	ScanSetting inf = CVisionRecipe::getInstance()->getScanSetting();
+
+	m_combStdPoint.SetCurSel(inf.nStdIndex);
+	m_combScanPoint1.SetCurSel(inf.nIndex0);
+	m_combScanPoint2.SetCurSel(inf.nIndex1);
+	m_combScanPoint3.SetCurSel(inf.nIndex2);
+	m_combScanPoint4.SetCurSel(inf.nIndex3);
+	m_combLengthScan.SetCurSel(inf.nLengthScan);
+	m_combShortScan.SetCurSel(inf.nShortScan);
+	SetDlgItemInt(IDC_EDIT_LENGTH_PRODUCT, inf.lengthSize);
+	SetDlgItemInt(IDC_EDIT_SHORT_PRODUCT, inf.shortSize);
+}
+
+
+void CScanSetDlg::OnBnClickedButtonCancelScan()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SetParamsUi();
+}
+
+void CScanSetDlg::SaveParams(void) {
+	/* code */
+	ScanSetting inf;
+	inf.nStdIndex = m_combStdPoint.GetCurSel();
+	inf.nIndex0 = m_combScanPoint1.GetCurSel();
+	inf.nIndex1 = m_combScanPoint2.GetCurSel();
+	inf.nIndex2 = m_combScanPoint3.GetCurSel();
+	inf.nIndex3 = m_combScanPoint4.GetCurSel();
+	inf.nLengthScan = m_combLengthScan.GetCurSel();
+	inf.nShortScan = m_combShortScan.GetCurSel();
+	inf.lengthSize = GetDlgItemInt(IDC_EDIT_LENGTH_PRODUCT);
+	inf.shortSize = GetDlgItemInt(IDC_EDIT_SHORT_PRODUCT);
+	CVisionRecipe::getInstance()->setScanSetting(inf);
+}
+
+
+void CScanSetDlg::OnBnClickedButtonSaveScan()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveParams();
+
+	CVisionRecipe::getInstance()->saveVisionConfig();
+}
+
+
+void CScanSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+
+void CScanSetDlg::OnBnClickedButtonTestScan()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveParams();
+	Point2I pose;
+	pose.x = GetDlgItemInt(IDC_EDIT_POSX_SCAN);
+	pose.y = GetDlgItemInt(IDC_EDIT_POSY_SCAN);
+	CTranformCoordinate tf;
+	Point2I result = tf.tfPose((DimensionDir)m_combScanEdge.GetCurSel(), pose);
+	Log_GetDebug()->TraceInfo("Result %d: (%d, %d), %d", m_combScanEdge.GetCurSel(), result.x, result.y, __LINE__);
+
+}
diff --git a/BlVisionPro/View/ScanSetDlg.h b/BlVisionPro/View/ScanSetDlg.h
new file mode 100644
index 0000000..4347a05
--- /dev/null
+++ b/BlVisionPro/View/ScanSetDlg.h
@@ -0,0 +1,55 @@
+#pragma once
+#include "afxwin.h"
+
+
+// CScanSetDlg 对话框
+
+class CScanSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CScanSetDlg)
+
+public:
+	CScanSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CScanSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_SCAN_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	CComboBox m_combStdPoint;
+	CComboBox m_combScanPoint1;
+	CComboBox m_combScanPoint2;
+	CComboBox m_combScanPoint3;
+	CComboBox m_combScanPoint4;
+	CComboBox m_combLengthScan;
+	CComboBox m_combShortScan;
+
+
+	CComboBox m_combScanEdge;
+
+private:
+	//1. 初始化窗体
+	void InitWindowUi(void);
+
+	//2. 设置参数
+	void SetParamsUi(void);
+
+	//3. 保存参数
+	void SaveParams(void);
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+
+	afx_msg void OnBnClickedButtonCancelScan();
+	afx_msg void OnBnClickedButtonSaveScan();
+	afx_msg void OnClose();
+	afx_msg void OnBnClickedButtonTestScan();
+};
diff --git a/BlVisionPro/View/ThresSetDlg.cpp b/BlVisionPro/View/ThresSetDlg.cpp
new file mode 100644
index 0000000..71e5da4
--- /dev/null
+++ b/BlVisionPro/View/ThresSetDlg.cpp
@@ -0,0 +1,384 @@
+// ThresSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "ThresSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "SoftVisionApp.h"
+
+
+// CThresSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CThresSetDlg, CDialogEx)
+
+CThresSetDlg::CThresSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_THRES_SET, pParent)
+{
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+}
+
+CThresSetDlg::~CThresSetDlg()
+{
+}
+
+void CThresSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_PANEL_THRES_INFO, m_PanelThres);
+}
+
+
+BEGIN_MESSAGE_MAP(CThresSetDlg, CDialogEx)
+	ON_WM_DESTROY()
+	ON_BN_CLICKED(IDC_BUTTON_THRES_SAVE, &CThresSetDlg::OnBnClickedButtonThresSave)
+	ON_BN_CLICKED(IDC_BUTTON_THRES_ROI_SET, &CThresSetDlg::OnBnClickedButtonThresRoiSet)
+	ON_BN_CLICKED(IDC_BUTTON_THRES_PROCESS, &CThresSetDlg::OnBnClickedButtonThresProcess)
+END_MESSAGE_MAP()
+
+
+// CThresSetDlg 消息处理程序
+
+
+BOOL CThresSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+
+BOOL CThresSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+void CThresSetDlg::OnDestroy()
+{
+	CDialogEx::OnDestroy();
+
+	// TODO: 在此处添加消息处理程序代码
+}
+
+int CThresSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+
+	return 0;
+}
+
+void CThresSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. Name
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. use
+	strText = _T("Pos type");
+	m_vParams.push_back(strText);
+	//5. Min Thres
+	strText = _T("Min Thres");
+	m_vParams.push_back(strText);
+	//6. Max Thres
+	strText = _T("Max Thres");
+	m_vParams.push_back(strText);
+	//7. Max Thres
+	strText = _T("Smooth");
+	m_vParams.push_back(strText);
+	//8. Pos X
+	strText = _T("X Size(um)");
+	m_vParams.push_back(strText);
+	//9. Pos Y
+	strText = _T("Y Size(um)");
+	m_vParams.push_back(strText);
+	//10.Result
+	strText = _T("Result");
+	m_vParams.push_back(strText);
+
+	int nRows = 13;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelThres.DeleteAllItems();
+	m_PanelThres.SetVirtualMode(FALSE);
+	m_PanelThres.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelThres.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelThres.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelThres.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelThres.SetRowCount(nRows);
+	m_PanelThres.SetColumnCount(nCols);
+	m_PanelThres.SetFixedRowCount(nFixRows);
+	m_PanelThres.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelThres.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelThres.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelThres.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelThres.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelThres.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelThres.SetColumnWidth(nColIdx, 115);
+		}
+		else {
+			m_PanelThres.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelThres.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++) {
+		m_PanelThres.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CThresSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveThresParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getThresProcess(eDir);
+
+	ShowThresParam();
+}
+
+void CThresSetDlg::ShowThresParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	CString strText;
+	for (int i = 0; i < 12; i++) {
+		CThresDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. pose type
+		strText.Format(_T("%d"), dot->m_poseType);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Min Thres
+		strText.Format(_T("%d"), dot->m_minThres);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Max Thres
+		strText.Format(_T("%d"), dot->m_maxThres);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. smooth
+		strText.Format(_T("%d"), dot->m_nSmoothSize);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Min SizeX
+		strText.Format(_T("%d"), dot->m_minSizeX);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Min SizeY
+		strText.Format(_T("%d"), dot->m_minSizeY);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Result
+		strText.Format(_T("%.1f"), (int)(dot->m_nNgInfo.size()));
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+void CThresSetDlg::SaveThresParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	CString strText;
+	for (int i = 0; i < 12; i++) {
+		CThresDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. Use
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4. pose type
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_poseType = _wtoi(strText);
+		idx += 1;
+
+		//5.Min Thres
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_minThres = _wtoi(strText);
+		idx += 1;
+
+		//6. Max Thres
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_maxThres = _wtoi(strText);
+		idx += 1;
+
+		//7.smooth
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_nSmoothSize = _wtoi(strText);
+		idx += 1;
+
+		//8. Min SizeX
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_minSizeX = _wtoi(strText);
+		idx += 1;
+
+		//9. Max SizeX
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_minSizeY = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+
+void CThresSetDlg::OnBnClickedButtonThresSave()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveThresParam();
+}
+
+
+void CThresSetDlg::OnBnClickedButtonThresRoiSet()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dot) return;
+
+	CCellID selCell = m_PanelThres.GetFocusCell();
+	int id = selCell.row;
+	if (id < 1) return;
+
+	CThresDotProcess *dot = m_dot->m_dots[id - 1];
+	if (nullptr == dot) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	dot->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+}
+
+
+void CThresSetDlg::OnBnClickedButtonThresProcess()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveThresParam();
+	if (nullptr == m_dot) return;
+
+	m_dot->execute(m_eDir);
+
+	DispResult();
+}
+
+void CThresSetDlg::DispResult(void) {
+	/* code */
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	DispAllResult();
+}
+
+void CThresSetDlg::DispAllResult(void) {
+	/* code */
+	int nCount = 12;
+	for (int i = 0; i < nCount; i++) {
+		CThresDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelThres.SetItemText(id, 9, _T("NAN"));
+		}
+		else {   //显示结果
+			CString strResult;
+			strResult.Format(_T("%d"), (int)dot->m_nNgInfo.size());
+			int id = dot->getID();
+			m_PanelThres.SetItemText(id, 9, strResult);
+		}
+	}
+
+	m_PanelThres.Invalidate(FALSE);
+}
diff --git a/BlVisionPro/View/ThresSetDlg.h b/BlVisionPro/View/ThresSetDlg.h
new file mode 100644
index 0000000..eb88876
--- /dev/null
+++ b/BlVisionPro/View/ThresSetDlg.h
@@ -0,0 +1,59 @@
+#pragma once
+
+
+// CThresSetDlg 对话框
+#include "ThresProcess.h"
+
+class CThresSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CThresSetDlg)
+
+public:
+	CThresSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CThresSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_THRES_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+public:
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnDestroy();
+
+	int setDimensionDir(DimensionDir eDir);
+	void ChangeVisionType(DimensionDir eDir);
+
+private:
+	CGridCtrl	m_PanelThres;
+	std::vector<CString> m_vParams;
+	CThresProcess *m_dot;
+	DimensionDir m_eDir;
+
+private:
+	//1. 初始化Panel
+	void InitPanel(void);
+
+	//2. 保存数据
+	void SaveThresParam(void);
+
+	//3. 显示数据
+	void ShowThresParam(void);
+
+	//4. 显示结果
+	void DispResult(void);
+
+	//5. 显示所有的结果
+	void DispAllResult(void);
+
+public:
+	afx_msg void OnBnClickedButtonThresSave();
+	afx_msg void OnBnClickedButtonThresRoiSet();
+	afx_msg void OnBnClickedButtonThresProcess();
+};
diff --git a/BlVisionPro/View/VisionSetDlg.cpp b/BlVisionPro/View/VisionSetDlg.cpp
new file mode 100644
index 0000000..46508bf
--- /dev/null
+++ b/BlVisionPro/View/VisionSetDlg.cpp
@@ -0,0 +1,545 @@
+// VisionSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "VisionSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionBufferPro.h"
+#include "CornerDistSetDlg.h"
+#include "RcutSetDLg.h"
+#include "ScanSetDlg.h"
+#include "KeyVisionSetDlg.h"
+#include "LocSetDlg.h"
+#include "CutSetDlg.h"
+#include "KDistSetDlg.h"
+#include <WinUser.h>
+#include "GrindSetDlg.h"
+#include "LockSetDlg.h"
+#include "ChipInspectDlg.h"
+#include "ThresSetDlg.h"
+#include "HoleSetDlg.h"
+
+// CVisionSetDlg 对话框
+#define BUTTON_WIDTH 100  // 按钮的宽度
+#define BUTTON_HEIGHT 30  // 按钮的高度
+#define BUTTON_PADDING 1  // 按钮之间的间距
+
+IMPLEMENT_DYNAMIC(CVisionSetDlg, CDialogEx)
+
+CVisionSetDlg::CVisionSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_VISION_SET, pParent)
+{
+	m_pOpRoiDlg = NULL;
+	m_drawOperator.isDrawing = false;
+}
+
+CVisionSetDlg::~CVisionSetDlg()
+{
+	/* code */
+	int sz = (int)(m_pages.size());
+	for (int i = 0; i < sz; i++) {
+		delete m_pages[i];
+		m_pages[i] = nullptr;
+	}
+	m_pages.clear();
+
+	if (m_pOpRoiDlg != NULL) {
+		m_pOpRoiDlg->DestroyWindow();
+		delete m_pOpRoiDlg;
+		m_pOpRoiDlg = NULL;
+	}
+}
+
+void CVisionSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CVisionSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_WM_MOVE()
+	ON_WM_CTLCOLOR()
+END_MESSAGE_MAP()
+
+
+// CVisionSetDlg 消息处理程序
+
+
+void CVisionSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	int sz = (int)(m_pages.size());
+	for (int i = 0; i < sz; i++) {
+		m_pages[i]->ShowWindow(SW_HIDE);
+	}
+
+	CVisionRecipe::getInstance()->setVisionSetOpen(FALSE);
+
+	CDialogEx::OnClose();
+}
+
+void CVisionSetDlg::InitCreateWnd(void) {
+	/* code */
+	CStatic *pMainPanel = (CStatic *)GetDlgItem(IDC_STATIC_UI_V);
+
+	CVisionRecipe::getInstance()->SetMainDlg(this);
+
+	//1. 创建LOC
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CLocSetDlg *pDlg = new CLocSetDlg();
+		pDlg->Create(IDD_DIALOG_LOC_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//2. Grind
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CGrindSetDlg *pDlg = new CGrindSetDlg();
+		pDlg->Create(IDD_DIALOG_GRIND_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//3. KDist
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CKDistSetDlg *pDlg = new CKDistSetDlg();
+		pDlg->Create(IDD_DIALOG_DIST_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//4. CCUT
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CCutSetDlg *pDlg = new CCutSetDlg();
+		pDlg->Create(IDD_DIALOG_CUTLINE_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//5. RCUT
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CRcutSetDLg *pDlg = new CRcutSetDLg();
+		pDlg->Create(IDD_DIALOG_RCUT_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//6. 创建ThresSet
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CThresSetDlg *pDlg = new CThresSetDlg();
+		pDlg->Create(IDD_DIALOG_THRES_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//7. 创建Hole
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CHoleSetDlg* pDlg = new CHoleSetDlg();
+		pDlg->Create(IDD_DIALOG_HOLE_INSPECT, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	Resize();
+}
+
+#define PAGE_MARGIN_LEFT	12
+#define PAGE_MARGIN_TOP		0
+#define PAGE_MARGIN_RIGHT	12
+#define PAGE_MARGIN_BOTTOM	12
+void CVisionSetDlg::Resize(void) {
+	/* code */
+	CStatic *pMainPanel = (CStatic *)GetDlgItem(IDC_STATIC_UI_V);
+	if (NULL == pMainPanel) return;
+
+	CRect rcRect;
+	pMainPanel->GetWindowRect(rcRect);
+
+	for (auto item : m_pages) {
+		if (NULL == item) continue;
+
+		item->MoveWindow(rcRect.left + PAGE_MARGIN_LEFT, rcRect.top + PAGE_MARGIN_TOP,
+			rcRect.Width() - PAGE_MARGIN_LEFT - PAGE_MARGIN_RIGHT,
+			rcRect.Height() - PAGE_MARGIN_TOP - PAGE_MARGIN_BOTTOM);
+	}
+}
+
+void CVisionSetDlg::SetButtonsSize(std::vector<CButton*>& buttons)
+{
+	for (CButton* pButton : buttons)
+	{
+		if (pButton)
+		{
+			CRect rect;
+			pButton->GetWindowRect(&rect);
+			ScreenToClient(&rect);
+
+			pButton->MoveWindow(rect.left, rect.top, BUTTON_WIDTH, BUTTON_HEIGHT);
+		}
+	}
+}
+
+void CVisionSetDlg::UpdateButtonsLayout(std::vector<CButton*>& buttons, const std::vector<bool>& states)
+{
+	if (buttons.empty() || states.empty() || buttons.size() != states.size()) return;  // 确保按钮数组非空
+
+	// 获取第一个按钮的初始位置
+	CRect initialRect;
+	buttons[0]->GetWindowRect(&initialRect);
+	ScreenToClient(&initialRect); // 将屏幕坐标转换为客户区坐标
+
+	int currentX = initialRect.left;  // 以第一个按钮的X位置为起点
+	int currentY = initialRect.top;   // 以第一个按钮的Y位置为起点
+
+	// 遍历按钮,根据状态显示或隐藏
+	for (size_t i = 0; i < buttons.size(); ++i)
+	{
+		CButton* pButton = buttons[i];
+		if (pButton)
+		{
+			if (states[i]) // 如果状态为 true,显示按钮
+			{
+				// 显示按钮并调整它的位置
+				pButton->ShowWindow(SW_SHOW);
+				pButton->MoveWindow(currentX, currentY, BUTTON_WIDTH, BUTTON_HEIGHT);
+
+				// 更新下一按钮的位置
+				currentX += BUTTON_WIDTH + BUTTON_PADDING;
+			}
+			else // 如果状态为 false,隐藏按钮
+			{
+				pButton->ShowWindow(SW_HIDE);
+			}
+		}
+	}
+}
+
+BOOL CVisionSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitCreateWnd();
+
+	m_eDir = DIMENSION_NONE;
+	m_eVisionType = VISION_NONE;
+	ChangeVisionPro(DIMENSION_A, VISION_LOC);
+
+	CButton* pMain = (CButton*)GetDlgItem(IDC_RDO_SIDE_A_TOP);
+	if (pMain && pMain->GetSafeHwnd())
+		pMain->SetCheck(1);
+
+	CButton* pVision = (CButton*)GetDlgItem(IDC_RDO_INSTYPE_LOC);
+	if (pVision && pVision->GetSafeHwnd())
+		pVision->SetCheck(1);
+
+	// 添加按钮组
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_LOC));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_GRIND));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_KDIST));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_CUT));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_RCUT));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_THRES));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_HOLE));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_IN_CHAMFER));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_TOP_CORNER));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_BOT_CORNER));
+
+	// 设置一组按钮的大小
+	SetButtonsSize(m_buttons);
+
+	ShowVisionType();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CVisionSetDlg::ShowVisionType(void) {
+	/* code */
+	VisionDisplayInfo inf = CVisionRecipe::getInstance()->getVisionDisplay();
+	if (inf.isGrindDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_GRIND)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_GRIND)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isDistDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_KDIST)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_KDIST)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isCutDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_CUT)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_CUT)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isRcutDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_RCUT)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_RCUT)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isThresDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_THRES)->ShowWindow(SW_SHOW);
+}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_THRES)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isHoleDisplay) {
+        GetDlgItem(IDC_RDO_INSTYPE_HOLE)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_HOLE)->ShowWindow(SW_HIDE);
+	}
+
+	/*
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_IN_CHAMFER));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_TOP_CORNER));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_BOT_CORNER));*/
+
+	std::vector<bool> states;
+	states.push_back(true);
+	states.push_back(inf.isGrindDisplay);
+	states.push_back(inf.isDistDisplay);
+	states.push_back(inf.isCutDisplay);
+	states.push_back(inf.isRcutDisplay);
+	states.push_back(inf.isThresDisplay);
+	states.push_back(inf.isHoleDisplay);
+	states.push_back(false);
+	states.push_back(false);
+	states.push_back(false);
+	UpdateButtonsLayout(m_buttons, states);
+}
+
+void CVisionSetDlg::OnMove(int x, int y)
+{
+	CDialogEx::OnMove(x, y);
+
+	// TODO: 在此处添加消息处理程序代码
+	Resize();
+}
+
+void CVisionSetDlg::ChangeDimension(DimensionDir eDir) {
+	/* code */
+	ChangeVisionPro(eDir, m_eVisionType);
+}
+
+void CVisionSetDlg::ChangeVisionPro(DimensionDir eDir, VISION_TYPE eVision) {
+	/* code */
+	ChangeImage(eDir);
+
+	ChangeVisionType(eVision);
+}
+
+void CVisionSetDlg::ChangeImage(DimensionDir eDir) {
+	/* code */
+	if (eDir == m_eDir) {
+		return;
+	}
+
+	m_eDir = eDir;
+}
+
+void CVisionSetDlg::ChangeVisionType(VISION_TYPE eVision) {
+	/* code */
+	int sz = (int)(m_pages.size());
+	if (sz < 1) return;
+	for (int i = 0; i < sz; i++) {
+		m_pages[i]->ShowWindow(SW_HIDE);
+	}
+	
+
+	m_eVisionType = eVision;
+	switch (eVision) {
+	case VISION_LOC: {
+		CLocSetDlg *pDlg = (CLocSetDlg *)(m_pages[0]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_GRIND: {
+		CGrindSetDlg *pDlg = (CGrindSetDlg *)(m_pages[1]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_KDIST: {
+		CKDistSetDlg *pDlg = (CKDistSetDlg *)(m_pages[2]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_CUT: {
+		CCutSetDlg *pDlg = (CCutSetDlg *)(m_pages[3]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_RCUT: {
+		CRcutSetDLg *pDlg = (CRcutSetDLg *)(m_pages[4]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_THRES: {
+		CThresSetDlg* pDlg = (CThresSetDlg *)(m_pages[5]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_HOLE: {
+        CHoleSetDlg* pDlg = (CHoleSetDlg *)(m_pages[6]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_NONE:
+		break;
+
+	default:
+		break;
+	}
+}
+
+HBRUSH CVisionSetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	// TODO:  在此更改 DC 的任何特性
+
+	// TODO:  如果默认的不是所需画笔,则返回另一个画笔
+	return hbr;
+}
+BEGIN_EVENTSINK_MAP(CVisionSetDlg, CDialogEx)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_LOC, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeLoc, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_RCUT, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeRcut, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_SCAN_SET, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionScanSet, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_KEY_SET, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionKeySet, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_OP_ROI, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionOpRoi, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_CUT, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeCut, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_KDIST, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeKdist, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_GRIND, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeGrind, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_THRES, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeThres, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_HOLE, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeHole, VTS_NONE)
+END_EVENTSINK_MAP()
+
+
+void CVisionSetDlg::ClickRdoInstypeLoc()
+{
+	// TODO: 在此处添加消息处理程序代码
+	/* code */
+	ChangeVisionPro(m_eDir, VISION_LOC);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeRcut()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_RCUT);
+}
+
+void CVisionSetDlg::ClickButtonVisionScanSet()
+{
+	// TODO: 在此处添加消息处理程序代码
+	CScanSetDlg dlg;
+	dlg.DoModal();
+
+	ShowVisionType();
+}
+
+
+void CVisionSetDlg::ClickButtonVisionKeySet()
+{
+	// TODO: 在此处添加消息处理程序代码
+	CKeyVisionSetDlg dlg;
+	dlg.DoModal();
+
+	ShowVisionType();
+}
+
+
+void CVisionSetDlg::ClickButtonVisionOpRoi()
+{
+	// TODO: 在此处添加消息处理程序代码
+	//if (m_pOpRoiDlg == NULL) {
+	//	m_pOpRoiDlg = new COpRoiDlg(this);
+	//	m_pOpRoiDlg->Create(IDD_DIALOG_ROI_SET, this);
+	//	m_pOpRoiDlg->ShowWindow(SW_SHOW);
+	//}
+	//else {
+	//	m_pOpRoiDlg->ShowWindow(SW_SHOW);
+	//}
+	CLockSetDlg dlg;
+	dlg.DoModal();
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeCut()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_CUT);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeKdist()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_KDIST);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeGrind()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_GRIND);
+}
+
+
+BOOL CVisionSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeThres()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_THRES);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeHole()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_HOLE);
+}
diff --git a/BlVisionPro/View/VisionSetDlg.h b/BlVisionPro/View/VisionSetDlg.h
new file mode 100644
index 0000000..abf8eb2
--- /dev/null
+++ b/BlVisionPro/View/VisionSetDlg.h
@@ -0,0 +1,94 @@
+#pragma once
+#include "afxwin.h"
+#include "EiVisionType.h"
+
+// CVisionSetDlg 对话框
+#include "VisionRecipe.h"
+#include "OpRoiDlg.h"
+
+class CVisionSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CVisionSetDlg)
+
+	typedef struct _DrawOperator {
+		DimensionDir eDir;                //模式
+		VISION_TYPE eVisionType;          //算法类型  
+		int nID;                          //ID
+		int nType;                        //类型
+		bool isDrawing;                   //是否
+	}DrawOperator;
+
+public:
+	CVisionSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CVisionSetDlg();
+
+	// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum {
+		IDD = IDD_DIALOG_VISION_SET
+	};
+#endif
+
+private:
+	std::vector<CDialogEx*> m_pages;
+	DimensionDir m_eDir;
+	VISION_TYPE m_eVisionType;
+	DrawOperator m_drawOperator;
+	COpRoiDlg *m_pOpRoiDlg;
+	CMenu m_visionMenu;
+	std::vector<CButton*> m_buttons;
+
+private:
+	//2. 初始化窗体
+	void InitCreateWnd(void);
+
+	//3. 位置移动
+	void Resize(void);
+
+	//4. 设置按钮大小
+	void SetButtonsSize(std::vector<CButton*>& buttons);
+
+	//5. 设置按钮位置
+	void UpdateButtonsLayout(std::vector<CButton*>& buttons, const std::vector<bool>& states);
+
+	//6. 刷新图像 
+	void ChangeImage(DimensionDir eDir);
+
+	//7. 图像算法
+	void ChangeVisionType(VISION_TYPE eVision);
+
+	//8. 改变视觉处理
+	void ChangeVisionPro(DimensionDir eDir, VISION_TYPE eVision);
+
+	//9. 显示算法类型
+	void ShowVisionType(void);
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void ChangeDimension(DimensionDir eDir);
+
+
+
+public:
+	afx_msg void OnClose();
+	virtual BOOL OnInitDialog();
+	afx_msg void OnMove(int x, int y);
+	
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	DECLARE_EVENTSINK_MAP()
+	void ClickRdoInstypeLoc();
+	void ClickRdoInstypeRcut();
+	void ClickButtonVisionScanSet();
+	void ClickButtonVisionKeySet();
+	void ClickButtonVisionOpRoi();
+	void ClickRdoInstypeCut();
+	void ClickRdoInstypeKdist();
+	void ClickRdoInstypeGrind();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	void ClickRdoInstypeThres();
+	void ClickRdoInstypeHole();
+};
diff --git a/BlVisionPro/Vision/BlSideData.cpp b/BlVisionPro/Vision/BlSideData.cpp
new file mode 100644
index 0000000..59a1d1f
--- /dev/null
+++ b/BlVisionPro/Vision/BlSideData.cpp
@@ -0,0 +1,71 @@
+#include "stdafx.h"
+#include "BlSideData.h"
+
+CBlSideData::CBlSideData()
+{
+	m_dPixelSizeX = 0.0f;
+	m_dPixelSizeY = 0.0f;
+	m_bBotMark_Find = FALSE;
+	m_bTopMark_Find = FALSE;
+	m_mTopMark.x = 0;
+	m_mTopMark.y = 0;
+	m_mBotMark.x = 0;
+	m_mBotMark.y = 0;
+
+	m_bTopPoint_Find = FALSE;
+	m_mTopPoint.x = 0;
+	m_mTopPoint.y = 0;
+	m_bBotPoint_Find = FALSE;
+	m_mBotPoint.x = 0;
+	m_mBotPoint.y = 0;
+
+	m_mapSideLineInf.clear();
+	m_vDispVisionResult.clear();
+}
+
+CBlSideData::~CBlSideData()
+{
+	m_mapSideLineInf.clear();
+	m_vDispVisionResult.clear();
+}
+
+void CBlSideData::Reset(void) {
+	/* code */
+	m_bInspection_Complete = FALSE;
+	m_bBotMark_Find = FALSE;
+	m_bTopMark_Find = FALSE;
+	m_mTopMark.x = 0;
+	m_mTopMark.y = 0;
+	m_mBotMark.x = 0;
+	m_mBotMark.y = 0;
+}
+
+Point2I CBlSideData::getPose(int nType) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+
+	if (0 == nType) {
+		if (m_bTopMark_Find) {
+			result = m_mTopMark;
+		}
+	}
+	else if (1 == nType) {
+		if (m_bBotMark_Find) {
+			result = m_mBotMark;
+		}
+	}
+	else if (2 == nType) {
+		if (m_bTopPoint_Find) {
+			result = m_mTopPoint;
+		}
+	}
+	else if (3 == nType) {
+		if (m_bBotPoint_Find) {
+			result = m_mBotPoint;
+		}
+	}
+
+	return result;
+}
diff --git a/BlVisionPro/Vision/BlVisionLib.cpp b/BlVisionPro/Vision/BlVisionLib.cpp
new file mode 100644
index 0000000..eb807c8
--- /dev/null
+++ b/BlVisionPro/Vision/BlVisionLib.cpp
@@ -0,0 +1,35 @@
+#include "stdafx.h"
+#include "BlVisionLib.h"
+#include "VisionRecipe.h"
+#include "SoftVisionApp.h"
+
+#define BLVISION_VERSION    _T("1.0.1.1")
+int BlVision_GetVersion(char *pszVersion, int nBufferSize) {
+	/* code */
+	// 将ANSI字符串转换为宽字符串
+	CString cStr = BLVISION_VERSION;
+	// 获取CString长度(以字符为单位)
+	int len = cStr.GetLength();
+
+	// 使用CW2A宏进行宽字符到多字节字符集的转换
+	// CW2A默认使用当前系统的ANSI代码页进行转换
+	CW2A pszConvertedAnsiString(cStr);
+
+	// 使用strncpy确保不会超出charArray的大小
+	// -1 确保字符串末尾有空字符
+	strncpy_s(pszVersion, nBufferSize, pszConvertedAnsiString, _TRUNCATE);
+
+	return 0;
+}
+
+IVisionRecipe* BlVision_GetVisionRecipe(void) {
+	/* code */
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	return pRecipe;
+}
+
+ISoftVisionApp* BlVision_GetSoftVisionApp(void) {
+	/* code */
+	CSoftVisionApp *pApp = CSoftVisionApp::getInstance();
+	return pApp;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/Bspline.cpp b/BlVisionPro/Vision/Bspline.cpp
new file mode 100644
index 0000000..388d3a9
--- /dev/null
+++ b/BlVisionPro/Vision/Bspline.cpp
@@ -0,0 +1,132 @@
+#include "stdafx.h"
+#include "Bspline.h"
+
+
+CBspline::CBspline() {
+	/* code */
+
+}
+
+CBspline::CBspline(std::vector<vec>pt) {
+	/* code */
+	int num = (int)(pt.size());
+	m_nPoints = num - 1;
+
+	if (num < 4) {
+		m_nNumber = num - 1;
+	}
+	else {
+		m_nNumber = 3;
+	}
+
+	m_vControlpoint.resize(num);
+	memcpy(&m_vControlpoint[0], &pt[0], num * sizeof(vec));
+	m_uData.resize(m_nPoints + m_nNumber + 2);
+}
+
+CBspline::~CBspline(void) {
+	/* code */
+}
+
+void CBspline::execute(void) {
+	/* code */
+	m_vPtResults.clear();
+	getNode();
+
+	std::vector<vec>relevantPoint;
+	std::vector<float>relevantU;
+	relevantPoint.resize(m_nNumber + 1);//相关控制顶点
+	relevantU.resize(2 * m_nNumber);//相关节点矢量
+
+	//相关控制顶点拷贝
+	float u = 0;
+	int i = m_nNumber; //m表示u值所在的节点,则控制顶点为m_controlpoint[i-k]\m_controlpoint[i]
+	float a = 0.0f;
+	int m = 0;
+	int n = 0;
+	int num = 0;
+	int sz = (int)(m_nNumber);
+	for (int j = 0; j < 500; j++) {
+		n = 0;
+		m = 0;
+		u = (float)(1.0f * j / 500);
+
+		if (u > m_uData[i + 1]) {
+			i++;
+		}
+
+		for (m = i - sz; m <= i; m++) {
+			relevantPoint[n] = m_vControlpoint[m];
+			n++;
+		}
+
+		//相关节点矢量拷贝
+		n = 0;
+		for (m = i - sz + 1; m <= i + sz; m++) {
+			relevantU[n] = m_uData[m];
+			n++;
+		}
+		//开始插值计
+		num = (int)(relevantPoint.size());
+		for (n = 1; n < num; n++) {
+			for (m = 0; m < num - n; m++) {
+				a = relevantU[sz + m] - relevantU[m + n - 1];
+				if (fabs(a) < 1e-5) {
+					a = 0.0;
+				}
+				else {
+					a = (u - relevantU[m + n - 1]) / a;
+				}
+				relevantPoint[m] = (1 - a)*relevantPoint[m] + a*relevantPoint[m + 1];
+			}
+		}
+		m_vPtResults.push_back(relevantPoint[0]);
+	}
+}
+
+void CBspline::getNode(void) {
+	/* code */
+	int sz = (int)(m_nNumber);
+	for (int i = 0; i <= sz; i++) {
+		m_uData[i] = 0;
+	}
+
+	for (int i = 1; i <= sz + 1; i++) {
+		m_uData[i + m_nPoints] = 1;
+	}
+
+	hartley();
+}
+
+void CBspline::hartley(void) {
+	/* code */
+	std::vector<float> vLength(m_nPoints);
+	std::vector<float> vData;
+	vData.push_back(0.0);
+
+	vec fValue;
+	int fzNum = (int)(m_nPoints);
+	for (int i = 0; i < fzNum; i++) {
+		fValue = m_vControlpoint[i + 1] - m_vControlpoint[i];
+		vLength[i] = len(fValue);
+	}
+
+	float sum = 0.0f;
+	float fTemp = 0.0f;
+	int num = (int)(vLength.size());
+	int szNum = (int)(m_nNumber);
+	for (int i = 0; i <= num - szNum; i++) {
+		fTemp = 0;
+		for (int j = 0; j < szNum; j++) {
+			fTemp += vLength[i + j];
+		}
+		sum += fTemp;
+		vData.push_back(fTemp);
+	}
+
+	int count = (int)(vData.size());
+	for (int i = 1; i < count; i++) {
+		vData[i] = vData[i - 1] + vData[i];
+		m_uData[i + szNum] = vData[i] / sum;
+	}
+}
diff --git a/BlVisionPro/Vision/Bspline.h b/BlVisionPro/Vision/Bspline.h
new file mode 100644
index 0000000..cc025ab
--- /dev/null
+++ b/BlVisionPro/Vision/Bspline.h
@@ -0,0 +1,35 @@
+#ifndef BSP_LINE_H
+#define BSP_LINE_H
+
+#include "Vec.h"
+#include <vector>
+
+class CBspline
+{
+public:
+	CBspline();
+	CBspline(std::vector<vec>pt);
+	virtual ~CBspline();
+	
+
+public:
+	//1 测试
+	void execute(void);
+
+	std::vector<vec> m_vPtResults;
+private:
+	unsigned int m_nNumber;//次数、控制顶点个数
+
+	unsigned int m_nPoints;     //控制顶点数
+	std::vector<vec> m_vControlpoint;//控制顶点
+	std::vector<float> m_uData;//节点矢量
+
+public:
+	void hartley(void);
+
+	//1. 计算节点矢量
+	void getNode(void);
+};
+
+#endif
+
diff --git a/BlVisionPro/Vision/ConfigVision.cpp b/BlVisionPro/Vision/ConfigVision.cpp
new file mode 100644
index 0000000..f916c3e
--- /dev/null
+++ b/BlVisionPro/Vision/ConfigVision.cpp
@@ -0,0 +1,127 @@
+#include "stdafx.h"
+#include "ConfigVision.h"
+#include <iostream>
+#include <atlstr.h> // 包含CString头文件
+#include <time.h>
+#include <stdarg.h>
+#include <direct.h>
+#include <vector>
+#include <Dbghelp.h>
+#include "FileRecipe.h"
+#pragma comment(lib,"Dbghelp.lib")
+
+CConfigVision::CConfigVision(){
+	/* code */
+}
+
+CConfigVision::~CConfigVision(){
+	/* code */
+}
+
+void CConfigVision::SetWorkDir(const char *pszPath, const char *pszName) {
+	/* code */
+	std::string filePath = pszPath;
+	std::string strName = pszName;
+	init(filePath, pszName);
+}
+
+void CConfigVision::init(std::string filePath, std::string strName) {
+	/* code */
+	std::string fileName = filePath + "\\" + strName;
+	if (!CFileRecipe::fileIsExist(fileName)) {
+		MakeSureDirectoryPathExists(fileName.c_str());
+	}
+
+	std::string str = fileName + "\\Config.ini";
+	m_strFileName = CA2T(str.c_str());
+	CStdioFile file;
+	if (!file.Open(m_strFileName, CFile::modeCreate | CFile::modeReadWrite | CFile::modeNoTruncate)) return;
+	file.Close();
+}
+
+bool CConfigVision::WriteText(const char *pszSection, const char *pszName, const char *pszValue) {
+	/* code */
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strValue = CString(pszValue);
+	BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName);
+	if (!isRes) return false;
+
+	return true;
+}
+
+std::string CConfigVision::ReadText(const char *pszSection, const char *pszName, const char *pszDefault) {
+	/* code */
+	std::string strRes = pszDefault;
+	CString strValue;
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strDefault = CString(pszName);
+	GetPrivateProfileString(strSection, strName, strDefault, strValue.GetBuffer(MAX_PATH), MAX_PATH, m_strFileName);
+	strRes = CT2A(strValue);
+	return strRes;
+}
+
+bool CConfigVision::WriteInt(const char *pszSection, const char *pszName, int intValue) {
+	/* code */
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strValue;
+	strValue.Format(_T("%d"), intValue);
+	BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName);
+	if (!isRes) return false;
+
+	return true;
+}
+
+int CConfigVision::ReadInt(const char *pszSection, const char *pszName, int defaultValue) {
+	/* code */
+	int intRes = defaultValue;
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	intRes = GetPrivateProfileInt(strSection, strName, defaultValue, m_strFileName);
+	return intRes;
+}
+
+bool CConfigVision::WriteBool(const char *pszSection, const char *pszName, int bValue) {
+	/* code */
+	int iValue = 0;
+	if (bValue) iValue = 1;
+	
+	return WriteInt(pszSection, pszName, iValue);
+}
+
+bool CConfigVision::ReadBool(const char *pszSection, const char *pszName, bool deaultBool) {
+	/* code */
+	int defaultInt = 0;
+	if (deaultBool)  defaultInt = 1;
+	int nRet = ReadInt(pszSection, pszName, defaultInt);
+	
+	bool res = (1 == nRet);
+	return res;
+}
+
+bool CConfigVision::WriteFloat(const char *pszSection, const char *pszName, double fValue) {
+	/* code */
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strValue;
+	strValue.Format(_T("%.6f"), fValue);
+	BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName);
+	if (!isRes) return false;
+
+	return true;
+}
+
+double CConfigVision::ReadFloat(const char *pszSection, const char *pszName, double defaultValue) {
+	/* code */
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strDefault;
+	strDefault.Format(_T("%.6f"), defaultValue);
+	CString strValue;
+	GetPrivateProfileString(strSection, strName, strDefault, strValue.GetBuffer(MAX_PATH), MAX_PATH, m_strFileName);
+	std::string strRes = CT2A(strValue);
+	double fValue = atof(strRes.c_str());
+	return fValue;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/ConfigVision.h b/BlVisionPro/Vision/ConfigVision.h
new file mode 100644
index 0000000..e802337
--- /dev/null
+++ b/BlVisionPro/Vision/ConfigVision.h
@@ -0,0 +1,39 @@
+#ifndef CONFIG_VISION_H
+#define CONFIG_VISION_H
+
+class CConfigVision
+{
+public:
+	CConfigVision();
+	~CConfigVision();
+
+public:
+	//1. 设置工作路径
+	void SetWorkDir(const char *pszPath, const char *pszName);
+	
+	//2. 写入读取参数
+	bool WriteText(const char *pszSection, const char *pszName, const char *pszValue);
+	std::string ReadText(const char *pszSection, const char *pszName, const char *pszDefault);
+	
+	//3. 写入读取参数
+	bool WriteInt(const char *pszSection, const char *pszName, int intValue);
+	int ReadInt(const char *pszSection, const char *pszName, int defaultValue);
+
+	//4. 写入读取参数
+	bool WriteBool(const char *pszSection, const char *pszName, int bValue);
+	bool ReadBool(const char *pszSection, const char *pszName, bool deaultBool);
+
+	//5. 写入读取参数
+	bool WriteFloat(const char *pszSection, const char *pszName, double fValue);
+	double ReadFloat(const char *pszSection, const char *pszName, double defaultValue);
+
+private:
+	CString m_strFileName;
+
+private:
+	//1. 初始化创建文件
+	void init(std::string filePath, std::string strName);
+};
+
+
+#endif
diff --git a/BlVisionPro/Vision/CornerDistProcess.cpp b/BlVisionPro/Vision/CornerDistProcess.cpp
new file mode 100644
index 0000000..1b5e471
--- /dev/null
+++ b/BlVisionPro/Vision/CornerDistProcess.cpp
@@ -0,0 +1,392 @@
+#include "stdafx.h"
+#include "CornerDistProcess.h"
+#include "VisionBufferPro.h"
+#include "VisionRecipe.h"
+
+CCornerDistProcess::CCornerDistProcess(){
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	init();
+}
+
+CCornerDistProcess::~CCornerDistProcess(){
+	/* code */
+	release();
+}
+
+int CCornerDistProcess::init(void) {
+	/* code */
+	release();
+
+	m_isTfConvert = FALSE;
+
+	for (int i = 0; i < 6; i++) {
+		m_stdPoint[i].x = 0;
+		m_stdPoint[i].y = 0;
+	}
+
+	for (int i = 0; i < 4; i++) {
+		m_aryMeasure[i].idxRefer = 0;
+		m_aryMeasure[i].typePoint = 0;
+		m_aryMeasure[i].modePoint = 0;
+		m_aryMeasure[i].pointThres = 30;
+		m_aryMeasure[i].modeNear = 0;
+		m_aryMeasure[i].nearThres = 30;
+	}
+
+	return 0;
+}
+
+void CCornerDistProcess::release(void) {
+	/* code */
+	int nCount = (int)(m_vDosts.size());
+	if (nCount > 0) {
+		for (int i = 0; i < nCount; i++) {
+			CDistDotProcess *dot = m_vDosts.at(i);
+			if (NULL == dot) continue;
+			delete dot;
+			dot = NULL;
+		}
+	}
+	m_vDosts.clear();
+}
+
+CDistDotProcess* CCornerDistProcess::getDot(int index) {
+	/* code */
+	int nCount = (int)(m_vDosts.size());
+	if (index < 0 || index > nCount - 1) return nullptr;
+
+	CDistDotProcess *dot = m_vDosts.at(index);
+	return dot;
+}
+
+int CCornerDistProcess::addDot(void) {
+	/* code */
+	int nCount = (int)(m_vDosts.size());
+	int id = -MAXINT;
+	if (nCount < 1) {
+		id = 0;
+	}
+	else {
+		for (int i = 0; i < nCount; i++) {
+			CDistDotProcess *dot = m_vDosts.at(i);
+			if (NULL == dot) continue;
+			if (dot->getID() <= id) continue;
+			id = dot->getID();
+		}
+		id += 1;
+	}
+
+	CDistDotProcess *dot = new CDistDotProcess(m_eDir, id);
+	m_vDosts.push_back(dot);
+	return id;
+}
+
+Point2I CCornerDistProcess::getPoint(int nType) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+	if (nType < 0 || nType > 5) return result;
+
+	result = m_stdPoint[nType];
+	return result;
+}
+
+void CCornerDistProcess::setPoint(Point2I pos, int nType) {
+	/* code */
+	if (nType < 0 || nType > 5) return;
+
+	m_stdPoint[nType] = pos;
+}
+
+int CCornerDistProcess::execute(DimensionDir eDir) {
+	/* code */
+	m_isTfConvert = FALSE;
+	if (m_eDir != eDir) return -1;
+
+	int nCount = (int)(m_vDosts.size());
+	if (nCount < 1) return 0;
+
+	Point2I offset;
+	Point2I pose;
+	int idxType = 0;
+	MeasureInfo inf;
+	for (int i = 0; i < nCount; i++) {
+		CDistDotProcess *dot = m_vDosts.at(i);
+		if (NULL == dot) continue;
+
+		idxType = dot->m_idxRefer;
+		if (idxType < 0 || idxType > 3) continue;
+		inf = m_aryMeasure[idxType];
+
+		pose = dot->getPose();
+		offset = getOffset(inf.idxRefer, pose);
+
+		dot->setPoint(m_stdPoint[0], 0);
+		dot->setPoint(m_stdPoint[1], 1);
+		dot->setPoint(tfCoordinate(m_stdPoint[4]), 2);
+		dot->setPoint(tfCoordinate(m_stdPoint[5]), 3);
+		dot->Execute(m_eDir, inf, offset);
+	}
+
+	return 0;
+}
+
+int CCornerDistProcess::Serialized(void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+	int useSize = 0;
+	int nRet = 0;
+
+#if 0
+	//1. 保存mark
+	int iValue = (int)(m_eDir);
+	SERIALIZER_INT_32(iValue, pTemp, remainSize, useSize);   //Type
+
+	for (int i = 0; i < 6; i++) {
+		SERIALIZER_INT_32(m_stdPoint[i].x, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_stdPoint[i].y, pTemp, remainSize, useSize);
+	}
+
+	for (int i = 0; i < 4; i++) {
+		SERIALIZER_INT_32(m_aryMeasure[i].idxRefer, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].typePoint, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].modePoint, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].pointThres, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].modeNear, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].nearThres, pTemp, remainSize, useSize);
+	}
+
+	//2. 保存点的数量
+	int nCount = (int)(m_vDosts.size());
+	SERIALIZER_INT_32(nCount, pTemp, remainSize, useSize);
+
+	if (nCount > 0) {
+		for (int i = 0; i < nCount; i++) {
+			CDistDotProcess *pDot = m_vDosts.at(i);
+			if (NULL == pDot) continue;
+			nRet = pDot->Serialized(pTemp, remainSize);
+			if (nRet < 0) continue;
+			pTemp += nRet;
+			remainSize -= nRet;
+			useSize += nRet;
+		}
+	}
+#endif
+
+	return useSize;
+}
+
+int CCornerDistProcess::Deserialized(void* pBuffer, int size) {
+	/* code */
+	release();
+
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+	int useSize = 0;
+	int nRet = 0;
+
+#if 0
+	//1. 加载Mark
+	int iValue = 0;
+	DESERIALIZER_INT_32(iValue, pTemp, remainSize, useSize);   //Type
+	m_eDir = (DimensionDir)(iValue);
+	
+	for (int i = 0; i < 6; i++) {
+		DESERIALIZER_INT_32(m_stdPoint[i].x, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_stdPoint[i].y, pTemp, remainSize, useSize);
+	}
+
+	for (int i = 0; i < 4; i++) {
+		DESERIALIZER_INT_32(m_aryMeasure[i].idxRefer, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].typePoint, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].modePoint, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].pointThres, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].modeNear, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].nearThres, pTemp, remainSize, useSize);
+	}
+
+	//2. 保存点的数量
+	int nCount = 0;
+	DESERIALIZER_INT_32(nCount, pTemp, remainSize, useSize);
+
+	for (int i = 0; i < nCount; i++) {
+		CDistDotProcess *dot = new CDistDotProcess();
+		nRet = dot->Deserialized(pTemp, remainSize);
+		if (nRet < 0) continue;
+		m_vDosts.push_back(dot);
+
+		pTemp += nRet;
+		remainSize -= nRet;
+		useSize += nRet;
+	}
+
+#endif
+
+
+	return useSize;
+}
+
+std::vector<CDistDotProcess*>& CCornerDistProcess::getDots(void) {
+	/* code */
+	return m_vDosts;
+}
+
+int CCornerDistProcess::delDot(int id) {
+	/* code */
+	int nCount = (int)(m_vDosts.size());
+	if (nCount < 1) return -1;
+	bool isFind = false;
+	for (auto iter = m_vDosts.begin(); iter != m_vDosts.end(); iter++) {
+		CDistDotProcess *dot = (*iter);
+		if (id == (*iter)->getID()) {
+			isFind = true;
+			m_vDosts.erase(iter);
+			break;
+		}
+	}
+	if (!isFind) return -1;
+
+	nCount = (int)(m_vDosts.size());
+	if (nCount < 1) return -1;
+
+	CDistDotProcess *dot = m_vDosts.at(0);
+	return dot->getID();
+}
+
+Point2I CCornerDistProcess::getOffset(int nType, Point2I pt) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+
+	switch (nType){
+	case 1:
+		result = getTopPointOffset(pt);
+		break;
+
+	case 2:
+		result = getBotPointOffset(pt);
+		break;
+
+	default:
+		result = getAffineOffset(pt);
+		break;
+	}
+
+	return result;
+}
+
+MeasureInfo CCornerDistProcess::getMeasureInfo(int index) {
+	/* code */
+	MeasureInfo inf;
+	inf.idxRefer = 0;
+	inf.typePoint = 0;
+	inf.modePoint = 0;
+	inf.pointThres = 30;
+	inf.modeNear = 0;
+	inf.nearThres = 30;
+	if (index < 0 || index > 3) return inf;
+
+	inf = m_aryMeasure[index];
+	return inf;
+}
+
+void CCornerDistProcess::setMeasureInfo(MeasureInfo inf, int index) {
+	/* code */
+	if (index < 0 || index > 3) return;
+
+	m_aryMeasure[index] = inf;
+}
+
+Point2I CCornerDistProcess::getAffineOffset(Point2I pt) {
+	/* code */
+	Point2I result;
+	Point2I ptTarget = tfCoordinate(pt);
+
+	result.x = (int)(ptTarget.x - pt.x);
+	result.y = (int)(ptTarget.y - pt.y);
+
+	return result;
+}
+
+Point2I CCornerDistProcess::tfCoordinate(Point2I pt) {
+	/* code */
+	tfProcess();
+
+	Point2D pose;
+	pose.x = pt.x;
+	pose.y = pt.y;
+	Point2D ptTarget = ClsVision::CoordinateTransform(pose, m_affine);
+	Point2I result;
+	result.x = (int)(ptTarget.x);
+	result.y = (int)(ptTarget.y);
+	return result;
+}
+
+void CCornerDistProcess::tfProcess(void){
+	/* code */
+	if (m_isTfConvert) return;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) {
+		Point2D pose;
+		pose.x = 0.0f;
+		pose.y = 0.0f;
+		m_affine = ClsVision::VectorAngleToRigid(pose, 0.0f, pose, 0.0f);
+		return;
+	}
+
+	std::vector<Point2D> vPtOrg, vPtTgt;
+	Point2D pose;
+	pose.x = m_stdPoint[0].x;
+	pose.y = m_stdPoint[0].y;
+	vPtOrg.push_back(pose);
+	pose.x = m_stdPoint[1].x;
+	pose.y = m_stdPoint[1].y;
+	vPtOrg.push_back(pose);
+
+	pose.x = pSideData->m_mTopMark.x;
+	pose.y = pSideData->m_mTopMark.y;
+	vPtTgt.push_back(pose);
+	pose.x = pSideData->m_mBotMark.x;
+	pose.y = pSideData->m_mBotMark.y;
+	vPtTgt.push_back(pose);
+
+	m_affine = ClsVision::VectorToSimilarity(vPtOrg, vPtTgt);
+	m_isTfConvert = TRUE;
+}
+
+Point2I CCornerDistProcess::getTopPointOffset(Point2I pt) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return result;
+
+	if (!pSideData->m_bTopPoint_Find) return result;
+
+	result.x = pSideData->m_mTopPoint.x - m_stdPoint[2].x;
+	result.y = pSideData->m_mTopPoint.y - m_stdPoint[2].y;
+
+	return result;
+}
+
+Point2I CCornerDistProcess::getBotPointOffset(Point2I pt) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return result;
+
+	if (!pSideData->m_bBotPoint_Find) return result;
+
+	result.x = pSideData->m_mBotPoint.x - m_stdPoint[3].x;
+	result.y = pSideData->m_mBotPoint.y - m_stdPoint[3].y;
+
+	return result;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/CornerDistProcess.h b/BlVisionPro/Vision/CornerDistProcess.h
new file mode 100644
index 0000000..3150d32
--- /dev/null
+++ b/BlVisionPro/Vision/CornerDistProcess.h
@@ -0,0 +1,74 @@
+#ifndef CORNER_DIST_PROCESS_H
+#define CORNER_DIST_PROCESS_H
+
+#include "DistDotProcess.h"
+
+class CVisionRecipe;
+
+class CCornerDistProcess
+{
+public:
+	CCornerDistProcess();
+	~CCornerDistProcess();
+
+public:
+	DimensionDir m_eDir;
+	
+public:
+	//1. get set dot
+	CDistDotProcess* getDot(int index);
+	std::vector<CDistDotProcess*>& getDots(void);
+	int addDot(void);
+	int delDot(int id);
+
+	//2. get/set UpMark
+	Point2I getPoint(int nType);
+	void setPoint(Point2I pos, int nType);
+	
+	//3. 执行
+	int execute(DimensionDir eDir);
+
+	//4. 序列化参数和反序列号参数
+	int Serialized(void* pBuffer, int size);
+	int Deserialized(void* pBuffer, int size);
+
+	//5. 获取偏移值
+	Point2I getOffset(int nType, Point2I pt);
+
+	//6. 获取测量数据
+	MeasureInfo getMeasureInfo(int index);
+	void setMeasureInfo(MeasureInfo inf, int index);
+
+private:
+	std::vector<CDistDotProcess*> m_vDosts;
+
+	Point2I m_stdPoint[6];
+	MeasureInfo m_aryMeasure[4];
+	BOOL m_isTfConvert;
+	ParaAffine2D m_affine;
+
+private:
+	//1. 初始化
+	int init(void);
+
+	//2. 释放
+	void release(void);
+
+	//3. 获取偏移
+	Point2I getAffineOffset(Point2I pt);
+
+	//4. 获取TopMark
+	Point2I getTopPointOffset(Point2I pt);
+
+	//5. 获取BotMark
+	Point2I getBotPointOffset(Point2I pt);
+
+	//6. 坐标转换
+	Point2I tfCoordinate(Point2I pt);
+
+	//7. 坐标转换
+	void tfProcess(void);
+};
+
+
+#endif
diff --git a/BlVisionPro/Vision/CornerRcutProcess.cpp b/BlVisionPro/Vision/CornerRcutProcess.cpp
new file mode 100644
index 0000000..03c3b02
--- /dev/null
+++ b/BlVisionPro/Vision/CornerRcutProcess.cpp
@@ -0,0 +1,103 @@
+#include "stdafx.h"
+#include "CornerRcutProcess.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CCornerRcutProcess::CCornerRcutProcess(){
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		m_dots[i] = NULL;
+	}
+	m_eDir = DIMENSION_NONE;
+	init();
+}
+
+CCornerRcutProcess::CCornerRcutProcess(DimensionDir eDir) {
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		m_dots[i] = NULL;
+	}
+	m_eDir = eDir;
+	init();
+}
+
+CCornerRcutProcess::~CCornerRcutProcess(){
+	/* code */
+	release();
+}
+
+int CCornerRcutProcess::init(void) {
+	/* code */
+	release();
+
+	for (int i = 0; i < 2; i++) {
+		m_dots[i] = new CRcutDotProcess(m_eDir, i + 1);
+	}
+
+	return 0;
+}
+
+void CCornerRcutProcess::release(void) {
+	/* code */
+	int nCount = 2;
+	for (int i = 0; i < nCount; i++) {
+		CRcutDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+int CCornerRcutProcess::execute(DimensionDir eDir) {
+	/* code */
+	if (m_eDir != eDir) return -1;
+
+	int nCount = 2;
+	Point2I offset;
+	for (int i = 0; i < nCount; i++) {
+		CRcutDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse)  continue;
+
+		offset.x = i;
+		offset.y = i;
+		dot->Execute(m_eDir, offset);
+	}
+
+	return 0;
+}
+
+Json::Value CCornerRcutProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = RCUT_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+
+	for (int i = 0; i < 2; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CCornerRcutProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	for (int i = 0; i < 2; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/CornerRcutProcess.h b/BlVisionPro/Vision/CornerRcutProcess.h
new file mode 100644
index 0000000..ce88823
--- /dev/null
+++ b/BlVisionPro/Vision/CornerRcutProcess.h
@@ -0,0 +1,34 @@
+#ifndef CORNER_RCUT_PROCESS
+#define CORNER_RCUT_PROCESS
+
+#include "RcutDotProcess.h"
+
+class CCornerRcutProcess
+{
+public:
+	CCornerRcutProcess();
+	CCornerRcutProcess(DimensionDir eDir);
+	~CCornerRcutProcess();
+
+public:
+	DimensionDir m_eDir;
+	CRcutDotProcess *m_dots[2];
+
+public:
+	//1. 执行
+	int execute(DimensionDir eDir);
+
+	//2. 保存数据 
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+private:
+	//1. 初始化
+	int init(void);
+
+	//2. 释放
+	void release(void);
+};
+
+
+#endif
diff --git a/BlVisionPro/Vision/CutDotProcess.cpp b/BlVisionPro/Vision/CutDotProcess.cpp
new file mode 100644
index 0000000..aeb04a3
--- /dev/null
+++ b/BlVisionPro/Vision/CutDotProcess.cpp
@@ -0,0 +1,354 @@
+#include "stdafx.h"
+#include "CutDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+
+CCutDotProcess::CCutDotProcess(){
+	/* code */
+	m_poseType = 0;
+	m_eDir = DIMENSION_NONE;
+	m_id = 0;
+
+	m_nUse = 0;
+	m_strName.Format(_T("P%d"), m_id);
+
+	m_nPosX = 0;
+	m_nPosY = 0;
+	m_nEdgeThres = 120;
+
+	m_nInc = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_distResult = 0.0f;
+}
+
+CCutDotProcess::CCutDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_poseType = 0;
+	m_eDir = eDir;
+	m_id = id;
+
+	m_nUse = 0;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_L%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_Cut_Dot%d"), m_id);
+		break;
+	}
+
+	m_nPosX = 0;
+	m_nPosY = 0;
+	m_nEdgeThres = 120;
+
+	m_nInc = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+
+	m_distResult = 0.0f;
+}
+
+CCutDotProcess::~CCutDotProcess(){
+	/* code */
+}
+
+int CCutDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	m_ptNearResult.x = 0.0f;
+	m_ptNearResult.y = 0.0f;
+	m_ptMeasureResult.x = 0.0f;
+	m_ptMeasureResult.y = 0.0f;
+	m_distResult = 0.0f;
+	if (1 != m_nUse) return 0;
+	if (0 == m_nPosX && 0 == m_nPosY)  return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 查找left
+	if (!FindLeftLine(eDir, offset)) return -1;
+
+	//3. 结果判断
+	judgeResult();
+
+	return 0;
+}
+
+bool CCutDotProcess::FindLeftLine(DimensionDir eDir, Point2I offset) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return false;
+	if (0 == m_poseType) {
+		if (!pSideData->m_bTopMark_Find)  return false;
+		if (!pSideData->m_bBotMark_Find)  return false;
+	}
+	else {
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	Point2I ptOffset;
+	ptOffset.x = -1 * m_nPosX;
+	ptOffset.y = m_nPosY;
+	Point2I result;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result))  return false;
+	m_locPointResult = result;
+
+	double fzSearchRange = 500.0f;
+	int nSearchRange = (int)(fzSearchRange / pSideData->m_dPixelSizeX);
+
+	Point2I cutResult;
+	if (!CVisionBufferPro::findCutLine(m_eDir, result, nSearchRange, m_nEdgeThres, cutResult)) return false;
+
+	m_ptMeasureResult.x = cutResult.x;
+	m_ptMeasureResult.y = cutResult.y;
+	m_ptNearResult = m_ptMeasureResult;
+
+	Line2D line;
+	line.pt0.x = m_xMmvsp * m_Points[0].x; // 0.0f;  // m_Points[0].x;
+	line.pt0.y = m_yMmvsp * m_Points[0].y; // 0.0f;  // m_Points[0].y;
+	line.pt1.x = m_xMmvsp * m_Points[1].x; //(m_Points[1].x - m_Points[0].x);
+	line.pt1.y = m_yMmvsp * m_Points[1].y; //(m_Points[1].y - m_Points[0].y);
+	Point2D ptEdge;
+	ptEdge.x = m_xMmvsp * m_ptMeasureResult.x; // (m_ptMeasureResult.x - m_Points[0].x);
+	ptEdge.y = m_yMmvsp * m_ptMeasureResult.y; // (m_ptMeasureResult.y - m_Points[0].y);
+
+	Point2D pose = ClsVision::ProjectionPL(ptEdge, line);
+	Point2D posProject;
+	posProject.x = pose.x / pSideData->m_dPixelSizeX; //m_Points[0].x + pose.x / pSideData->m_dPixelSizeX;
+	posProject.y = pose.y / pSideData->m_dPixelSizeY;  //m_Points[0].y + pose.y / pSideData->m_dPixelSizeY;
+
+	if (nullptr != pSideData) {  //区域的显示结果
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_CUT);
+		inf.rectX1 = (int)(cutResult.x - 15);
+		inf.rectY1 = (int)(cutResult.y - 15);
+		inf.rectX2 = (int)(cutResult.x + 15);
+		inf.rectY2 = (int)(cutResult.y + 15);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 3;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_CUT);
+		inf.rectX1 = (int)(cutResult.x);
+		inf.rectY1 = (int)(cutResult.y);
+		inf.rectX2 = (int)(posProject.x);
+		inf.rectY2 = (int)(posProject.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	return true;
+}
+
+int CCutDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+void CCutDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+void CCutDotProcess::judgeResult(void) {
+	/* code */
+	m_nNgInfo.clear();
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return;
+	if (NULL != pSideData) {
+		DispVisionResult inf;
+		inf.nType = 4;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_CUT);
+		inf.pointX = (int)(m_ptMeasureResult.x);
+		inf.pointY = (int)(m_ptMeasureResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_nMin;
+	ng.maxValue = m_nMax;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_KDIST;
+
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+
+	ng.ngType = DefectLoc_Dist_Cut;
+	Line2D line;
+	line.pt0.x = m_xMmvsp * m_Points[0].x; // 0.0f;  // m_Points[0].x;
+	line.pt0.y = m_yMmvsp * m_Points[0].y; // 0.0f;  // m_Points[0].y;
+	line.pt1.x = m_xMmvsp * m_Points[1].x; //(m_Points[1].x - m_Points[0].x);
+	line.pt1.y = m_yMmvsp * m_Points[1].y; //(m_Points[1].y - m_Points[0].y);
+	Point2D ptEdge;
+	ptEdge.x = m_xMmvsp * m_ptMeasureResult.x; // (m_ptMeasureResult.x - m_Points[0].x);
+	ptEdge.y = m_yMmvsp * m_ptMeasureResult.y; // (m_ptMeasureResult.y - m_Points[0].y);
+
+	Point2D pose = ClsVision::ProjectionPL(ptEdge, line);
+	double dx = (ptEdge.x - pose.x);
+	double dy = (ptEdge.y - pose.y);
+	m_distResult = sqrt(dx * dx + dy * dy);
+
+	m_distResult += m_nInc;
+	ng.result = m_distResult;
+
+	if (m_nMax < 0.5) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	double dDist = m_distResult - abs(m_nPosX);
+	if (dDist < m_nMin || dDist > m_nMax) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+void CCutDotProcess::setPoint(Point2I pose, int nType) {
+	/* code */
+	if (0 == nType) {
+		m_Points[0] = pose;
+	}
+	else if (1 == nType) {
+		m_Points[1] = pose;
+	}
+}
+
+Json::Value CCutDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+	Json::Value jsValue;
+	jsValue["alg type"] = CUT_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["use"] = m_nUse;
+	jsValue["pos x"] = m_nPosX;
+	jsValue["pos y"] = m_nPosY;
+	jsValue["inc"] = m_nInc;
+	jsValue["min"] = m_nMin;
+	jsValue["max"] = m_nMax;
+	jsValue["pos type"] = m_poseType;
+	jsValue["line thres"] = m_nEdgeThres;
+
+	return jsValue;
+}
+
+void CCutDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosX = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosY = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. inc
+	strName = "inc";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nInc = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. min
+	strName = "min";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMin = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. max
+	strName = "max";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMax = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. pos type
+	strName = "pos type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_poseType = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. line width
+	strName = "line thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEdgeThres = jsValue[strName.c_str()].asInt();
+	}
+}
diff --git a/BlVisionPro/Vision/CutDotProcess.h b/BlVisionPro/Vision/CutDotProcess.h
new file mode 100644
index 0000000..a07fdc0
--- /dev/null
+++ b/BlVisionPro/Vision/CutDotProcess.h
@@ -0,0 +1,64 @@
+#ifndef CUT_DOT_PROCESS_H
+#define CUT_DOT_PROCESS_H
+
+#include "IncludeVision.h"
+
+class CCutDotProcess
+{
+public:
+	CCutDotProcess();
+	CCutDotProcess(DimensionDir eDir, int id);
+	~CCutDotProcess();
+
+public:
+	//1. 执行
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//2. 获取ID
+	int getID(void);
+	void setPoint(Point2I pose, int nType);
+
+	//3. 保存文件
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	int m_nUse;
+	CString m_strName;
+	int m_nPosY;
+	int m_nPosX;
+	int m_poseType;
+	int m_nEdgeThres;
+
+	int m_nInc;
+	int m_nMin;
+	int m_nMax;
+
+	Point2D m_ptMeasureResult;
+	Point2D m_ptNearResult;
+	Point2I m_locPointResult;
+	double m_distResult;
+
+	std::vector<NgDotInfo> m_nNgInfo;
+
+private:
+	DimensionDir m_eDir;
+	int m_id;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+	Point2I m_Points[2];
+
+private:
+	//1. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+
+	//1. 判断结果
+	void judgeResult(void);
+
+	//2. 查找边界
+	bool FindLeftLine(DimensionDir eDir, Point2I offset);
+};
+
+#endif
+
diff --git a/BlVisionPro/Vision/CutProcess.cpp b/BlVisionPro/Vision/CutProcess.cpp
new file mode 100644
index 0000000..e72b7c0
--- /dev/null
+++ b/BlVisionPro/Vision/CutProcess.cpp
@@ -0,0 +1,97 @@
+#include "stdafx.h"
+#include "CutProcess.h"
+#include "BlSideData.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CCutProcess::CCutProcess() {
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CCutDotProcess(m_eDir, i + 1);
+	}
+	m_isUse = false;
+}
+
+CCutProcess::CCutProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	m_isUse = false;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CCutDotProcess(m_eDir, i + 1);
+	}
+}
+
+CCutProcess::~CCutProcess() {
+	/* code */
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+void CCutProcess::Execute(DimensionDir eDir) {
+	/* code */
+	if (!m_isUse) return;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return;
+
+	Point2I offset;
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		offset.x = i;
+		offset.y = i;
+
+		dot->setPoint(pSideData->m_mTopMark, 0);
+		dot->setPoint(pSideData->m_mBotMark, 1);
+
+		dot->Execute(m_eDir, offset);
+	}
+}
+
+Json::Value CCutProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = CUT_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["use"] = m_isUse;
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CCutProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) {
+		m_isUse = jsValue[strName.c_str()].asBool();
+	}
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/CutProcess.h b/BlVisionPro/Vision/CutProcess.h
new file mode 100644
index 0000000..782ba11
--- /dev/null
+++ b/BlVisionPro/Vision/CutProcess.h
@@ -0,0 +1,27 @@
+#ifndef CUT_PROCESS_H
+#define CUT_PROCESS_H
+
+#include "CutDotProcess.h"
+
+class CCutProcess
+{
+public:
+	CCutProcess();
+	CCutProcess(DimensionDir eDir);
+	~CCutProcess();
+
+public:
+	DimensionDir m_eDir;
+	bool m_isUse;   //是否启用
+	CCutDotProcess *m_dots[50];
+
+public:
+	//1. 执行检测
+	void Execute(DimensionDir eDir);
+
+	//2. 写入文件
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+};
+
+#endif
diff --git a/BlVisionPro/Vision/DistDotProcess.cpp b/BlVisionPro/Vision/DistDotProcess.cpp
new file mode 100644
index 0000000..33e82cb
--- /dev/null
+++ b/BlVisionPro/Vision/DistDotProcess.cpp
@@ -0,0 +1,569 @@
+#include "stdafx.h"
+#include "DistDotProcess.h"
+#include "VisionBufferPro.h"
+
+CDistDotProcess::CDistDotProcess(){
+	/* code */
+	m_id = 0;
+	m_eDir = DIMENSION_A;
+	m_strName.Format(_T("P%d"), m_id);
+
+	m_idxRefer = 0;
+	m_nRef = 100;
+	m_nRef_ = 100;
+
+	m_distMode = 1;
+	m_minValue = 0;
+	m_maxValue = 0;
+
+	m_distMode2 = 5;
+	m_minValue2 = 0;
+	m_maxValue2 = 0;
+
+	m_xPos = 0.0f;
+	m_yPos = 0.0f;
+	m_cx = 0.0f;
+	m_cy = 0.0f;
+	m_angle = 0.0f;
+	m_len1 = 0.0f;
+	m_len2 = 0.0f;
+
+	m_xMmvsp = 0.0f;
+	m_yMmvsp = 0.0f;
+	m_ngType = DefectLoc_Grind;
+	m_ngType2 = DefectLoc_Dist_Cut;
+	m_incValue = 0;
+	m_incValue2 = 0;
+
+	ClsVision::GenEmptyObject(m_hRegion);
+	ClsVision::GenEmptyObject(m_hLineRegion);
+}
+
+CDistDotProcess::~CDistDotProcess(){
+	/* code */
+}
+
+CDistDotProcess::CDistDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_id = id;
+	m_eDir = eDir;
+	switch (eDir){
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P%d"), m_id);
+		break;
+	}
+
+	m_idxRefer = 0;
+	m_nRef = 100;
+	m_nRef_ = 100;
+
+	m_distMode = 1;
+	m_minValue = 0;
+	m_maxValue = 0;
+
+	m_distMode2 = 5;
+	m_minValue2 = 0;
+	m_maxValue2 = 0;
+
+	m_xPos = 0.0f;
+	m_yPos = 0.0f;
+	m_cx = 0.0f;
+	m_cy = 0.0f;
+	m_angle = 0.0f;
+	m_len1 = 0.0f;
+	m_len2 = 0.0f;
+
+	m_xMmvsp = 0.0f;
+	m_yMmvsp = 0.0f;
+	m_incValue = 0;
+	m_incValue2 = 0;
+
+	ClsVision::GenEmptyObject(m_hRegion);
+	ClsVision::GenEmptyObject(m_hLineRegion);
+
+	m_ngType = DefectLoc_Grind;
+	m_ngType2 = DefectLoc_Dist_Cut;
+}
+
+int CDistDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+int CDistDotProcess::Execute(DimensionDir eDir, MeasureInfo inf, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	m_ptMatchResult.x = 0.0f;
+	m_ptMatchResult.y = 0.0f;
+	m_ptNearResult.x = 0.0f;
+	m_ptNearResult.y = 0.0f;
+	m_ptMeasureResult.x = 0.0f;
+	m_ptMeasureResult.y = 0.0f;
+	m_locPointResult.x = 0;
+	m_locPointResult.y = 0;
+
+	getMmvsp(eDir);
+
+	getKeyPose(offset);
+
+	//查找边界
+	int nRet = findPairEdge(eDir, inf, offset);
+//	if (0 != nRet) return nRet;
+
+	JudgeResult();
+
+	return nRet;
+}
+
+void CDistDotProcess::JudgeResult(void) {
+	/* code */
+	JudgeFirstResult();
+
+	JudgeSecondResult();
+}
+
+void CDistDotProcess::JudgeFirstResult(void) {
+	/* code */
+	if (0 == m_distMode) return;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_minValue;
+	ng.maxValue = m_maxValue;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_NONE; // VISION_DIST;
+
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+	
+	if (1 == m_distMode) {          //Grind Size
+		ng.ngType = m_ngType;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (2 == m_distMode) {     //Top Point
+		ng.ngType = m_ngType;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_topPoint.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_topPoint.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (3 == m_distMode) {     //Bot Point
+		ng.ngType = m_ngType;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_botPoint.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_botPoint.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (4 == m_distMode) {     //Key Dist
+		ng.ngType = m_ngType;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptMatchResult.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptMatchResult.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (5 == m_distMode) {     //Mark Line
+		Line2D line;
+		line.pt0.x = m_topMark.x;
+		line.pt0.y = m_topMark.y;
+		line.pt1.x = m_botMark.x;
+		line.pt1.y = m_botMark.y;
+		Point2D pose = ClsVision::ProjectionPL(m_ptMeasureResult, line);
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - pose.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - pose.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+		ng.ngType = m_ngType;
+	}
+	if (ng.result + m_incValue > 0.0f) {
+		ng.result += m_incValue;
+	}
+	if (m_maxValue < 0.01f || m_maxValue <= m_minValue + 0.001) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	if (ng.result < m_minValue || ng.result > m_maxValue) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+void CDistDotProcess::JudgeSecondResult(void) {
+	/* code */
+	if (0 == m_distMode2) return;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_minValue2;
+	ng.maxValue = m_maxValue2;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_NONE;   // VISION_DIST;
+
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+
+	if (1 == m_distMode2) {          //Grind Size
+		ng.ngType = m_ngType2;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (2 == m_distMode2) {     //Top Point
+		ng.ngType = m_ngType2;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_topPoint.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_topPoint.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (3 == m_distMode2) {     //Bot Point
+		ng.ngType = m_ngType2;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_botPoint.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_botPoint.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (4 == m_distMode2) {     //Key Dist
+		ng.ngType = m_ngType2;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptMatchResult.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptMatchResult.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (5 == m_distMode2) {     //Mark Line
+		Line2D line;
+		line.pt0.x = m_topMark.x;
+		line.pt0.y = m_topMark.y;
+		line.pt1.x = m_botMark.x;
+		line.pt1.y = m_botMark.y;
+		Point2D pose = ClsVision::ProjectionPL(m_ptMeasureResult, line);
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - pose.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - pose.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+		ng.ngType = m_ngType2;
+	}
+
+	if (ng.result + m_incValue2 > 0.0f) {
+		ng.result += m_incValue2;
+	}
+	if (m_maxValue2 < 0.01f || m_maxValue2 <= m_minValue2 + 0.001) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	if (ng.result < m_minValue2 || ng.result > m_maxValue2) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+
+void CDistDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+int CDistDotProcess::getKeyPose(Point2I offset) {
+	/* code */
+	if (fabs(m_xPos) < 0.01 || fabs(m_yPos) < 0.01) return -1;
+
+	m_ptMatchResult.x = m_xPos + offset.x;
+	m_ptMatchResult.y = m_yPos + offset.y;
+	return 0;
+}
+
+int CDistDotProcess::findPairEdge(DimensionDir eDir, MeasureInfo infMeasure, Point2I offset) {
+	/* code */
+	//1. 图像预处理
+	if (m_len1 < 0.01 || m_len2 < 0.01) return -3;
+
+	Line2D line = GetTargeLine();
+	line.pt0.x += offset.x;
+	line.pt0.y += offset.y;
+	line.pt1.x += offset.x;
+	line.pt1.y += offset.y;
+
+	int x1 = (int)(line.pt0.x - 30);
+	if (line.pt0.x > line.pt1.x)  x1 = (int)(line.pt1.x - 30);
+	int x2 = (int)(line.pt0.x + 30);
+	if (line.pt0.x < line.pt1.x)  x2 = (int)(line.pt1.x + 30);
+	int y1 = (int)(line.pt0.y - 30);
+	if (line.pt0.y > line.pt1.y)  y1 = (int)(line.pt1.y - 30);
+	int y2 = (int)(line.pt0.y + 30);
+	if (line.pt0.y < line.pt1.y)  y2 = (int)(line.pt1.y + 30);
+	int leftPos = x1;
+	int topPos = y1;
+
+	m_locPointResult.x = (int)(m_cx + offset.x);
+	m_locPointResult.y = (int)(m_cy + offset.y);
+
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return -3;
+	line.pt0.x -= leftPos;
+	line.pt0.y -= topPos;
+	line.pt1.x -= leftPos;
+	line.pt1.y -= topPos;
+
+//	HalconCpp::HObject hProcImage;
+//	HalconCpp::MedianImage(hImage, &hProcImage, "circle", 1, "mirrored");
+	bool valid = false;
+	if (0 == infMeasure.typePoint) {
+		//valid = CVisionBufferPro::GetMeasurePos(hImage, line,
+		//	infMeasure.typePoint,
+		//	infMeasure.pointThres, infMeasure.modePoint,
+		//	infMeasure.nearThres, infMeasure.modeNear, 
+		//	5, m_ptMeasureResult, m_ptNearResult);
+	}
+	else {
+		//valid = CVisionBufferPro::GetMeasurePos(hImage, line,
+		//	infMeasure.typePoint,
+		//	infMeasure.pointThres, infMeasure.modePoint,
+		//	infMeasure.nearThres, infMeasure.modeNear,
+		//	5, m_ptNearResult, m_ptMeasureResult);
+	}
+	if (!valid) {
+		m_ptMeasureResult.x = 0.0f;
+		m_ptMeasureResult.y = 0.0f;
+		m_ptNearResult.x = 0.0f;
+		m_ptNearResult.y = 0.0f;
+	}
+	else {
+		m_ptMeasureResult.x += leftPos;
+		m_ptMeasureResult.y += topPos;
+		m_ptNearResult.x += leftPos;
+		m_ptNearResult.y += topPos;
+	}
+
+	if (!valid) {
+		return -4;
+	}
+
+	m_locPointResult.x = (int)(m_ptMeasureResult.x);
+	m_locPointResult.y = (int)(m_ptMeasureResult.y);
+
+	return 0;
+}
+
+Line2D CDistDotProcess::GetTargeLine(void) {
+	/* code */
+	Line2D lineResult;
+	double angle = m_angle;
+	double xa = m_len1;
+	double xb = m_len2;
+	double x = m_cx;
+	double y = m_cy;
+	Point2D ptCenter;
+	ptCenter.x = x;
+	ptCenter.y = y;
+
+	double phi = ClsVision::DegreeToRad(angle);
+	double cosx = ClsVision::GetCos(phi);
+	double sinx = ClsVision::GetSin(phi);
+
+	lineResult.pt0.x = ptCenter.x + xa * cosx;
+	lineResult.pt0.y = ptCenter.y - xa * sinx;
+	lineResult.pt1.x = 2 * ptCenter.x - lineResult.pt0.x;
+	lineResult.pt1.y = 2 * ptCenter.y - lineResult.pt0.y;
+	return lineResult;
+}
+
+int CDistDotProcess::Serialized(void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+	int useSize = 0;
+	int nRet = 0;
+
+#if 0
+	//1. 保存ID和名称
+	int iValue = (int)(m_eDir);
+	SERIALIZER_INT_32(iValue, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_id, pTemp, remainSize, useSize);
+	std::string strName(CT2A(m_strName.GetString()));
+	SERIALIZER_STRING(strName, pTemp, remainSize, useSize);
+
+	//2. 保存区域范围
+	SERIALIZER_DOUBLE(m_xPos, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_yPos, pTemp, remainSize, useSize);
+
+	SERIALIZER_DOUBLE(m_cx, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_cy, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_angle, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_len1, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_len2, pTemp, remainSize, useSize);
+
+	SERIALIZER_INT_32(m_idxRefer, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_nRef, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_nRef_, pTemp, remainSize, useSize);
+
+	SERIALIZER_INT_32(m_distMode, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_minValue, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_maxValue, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_ngType, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_incValue, pTemp, remainSize, useSize);
+
+	SERIALIZER_INT_32(m_distMode2, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_minValue2, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_maxValue2, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_ngType2, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_incValue2, pTemp, remainSize, useSize);
+#endif
+
+	return useSize;
+}
+
+int CDistDotProcess::Deserialized(void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+	int useSize = 0;
+	int nRet = 0;
+
+#if 0
+	//1. 保存ID和名称
+	int iValue = 0;
+	DESERIALIZER_INT_32(iValue, pTemp, remainSize, useSize);
+	m_eDir = (DimensionDir)(iValue);
+	DESERIALIZER_INT_32(m_id, pTemp, remainSize, useSize);
+	std::string strName; 
+	DESERIALIZER_STRING(strName, pTemp, remainSize, useSize);
+	m_strName = CA2T(strName.c_str());
+
+	//2. 保存区域范围
+	DESERIALIZER_DOUBLE(m_xPos, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_yPos, pTemp, remainSize, useSize);
+
+	DESERIALIZER_DOUBLE(m_cx, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_cy, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_angle, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_len1, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_len2, pTemp, remainSize, useSize);
+
+	DESERIALIZER_INT_32(m_idxRefer, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_nRef, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_nRef_, pTemp, remainSize, useSize);
+
+	DESERIALIZER_INT_32(m_distMode, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_minValue, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_maxValue, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_ngType, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_incValue, pTemp, remainSize, useSize);
+
+	DESERIALIZER_INT_32(m_distMode2, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_minValue2, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_maxValue2, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_ngType2, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_incValue2, pTemp, remainSize, useSize);
+
+	if (m_xPos <= 0.001 && m_yPos <= 0.001) {
+		HalconCpp::GenEmptyObj(&m_hRegion);
+	}
+	else {
+		HalconCpp::GenCircle(&m_hRegion, m_yPos, m_xPos, 25);
+	}
+
+	if (m_len1 < 0.01 || m_len2 < 0.01) {
+		HalconCpp::GenEmptyObj(&m_hRegion);
+	}
+	else {
+		HalconCpp::GenRectangle2(&m_hLineRegion, m_cy, m_cx, ClsVision::DegreeToRad(m_angle), m_len1, m_len2);
+	}
+#endif
+	
+	return useSize;
+}
+
+void CDistDotProcess::setRoiRegion(HalconCpp::HObject &hRegion) {
+	/* code */
+	m_xPos = 0.0f;
+	m_yPos = 0.0f;
+	if (!ClsVision::RegionExist(hRegion)){
+		HalconCpp::GenEmptyObj(&m_hRegion);
+		return;
+	}
+
+	int nArea = 0;
+	ClsVision::AreaCenter(hRegion, nArea, m_xPos, m_yPos);
+	m_hRegion = hRegion;
+}
+
+void CDistDotProcess::setLineRegion(HalconCpp::HObject &hRegion) {
+	/* code */
+	m_cx = 0.0f;
+	m_cy = 0.0f;
+	m_angle = 0.0f;
+	m_len1 = 0.0f;
+	m_len2 = 0.0f;
+	if (!ClsVision::RegionExist(hRegion)) {
+		HalconCpp::GenEmptyObj(&m_hLineRegion);
+		return;
+	}
+
+	ClsVision::SmallestRectangle2(hRegion, m_cx, m_cy, m_angle, m_len1, m_len2);
+	m_hLineRegion = hRegion;
+}
+
+Point2I CDistDotProcess::getPose(void) {
+	/* code */
+	Point2I result;
+	result.x = (int)(m_cx);
+	result.y = (int)(m_cy);
+	return result;
+}
+
+void CDistDotProcess::setPoint(Point2I pt, int nType) {
+	/* code */
+	if (0 == nType) {
+		m_topMark = pt;
+	}
+	else if (1 == nType) {
+		m_botMark = pt;
+	}
+	else if (2 == nType) {
+		m_topPoint = pt;
+	}
+	else if (3 == nType) {
+		m_botPoint = pt;
+	}
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/DistDotProcess.h b/BlVisionPro/Vision/DistDotProcess.h
new file mode 100644
index 0000000..c73258e
--- /dev/null
+++ b/BlVisionPro/Vision/DistDotProcess.h
@@ -0,0 +1,105 @@
+#ifndef DIST_DOT_PROCESS
+#define DIST_DOT_PROCESS
+
+class CDistDotProcess
+{
+public:
+	CDistDotProcess();
+	CDistDotProcess(DimensionDir eDir, int id);
+	~CDistDotProcess();
+
+public:
+	//1. get id
+	int getID(void);
+
+	//2. 执行检测
+	int Execute(DimensionDir eDir, MeasureInfo inf, Point2I offset);
+
+	//3. 序列化参数和反序列号参数
+	int Serialized(void* pBuffer, int size);
+	int Deserialized(void* pBuffer, int size);
+
+	//4. 设置ROI区域
+	void setRoiRegion(HalconCpp::HObject &hRegion);
+
+	//5. 设置测量直线
+	void setLineRegion(HalconCpp::HObject &hRegion);
+
+	//6. 获取位置
+	Point2I getPose(void);
+
+	//7. 设置位置
+	void setPoint(Point2I pt, int nType);
+
+public:
+	DimensionDir m_eDir;                 //
+	CString m_strName;                   //Name
+	int m_idxRefer;                      //index
+	int m_nRef;                          //Pos+
+	int m_nRef_;                         //Pos-
+
+	int m_distMode;
+	int m_minValue;
+	int m_maxValue;
+	int m_ngType;
+	int m_incValue;
+
+	int m_distMode2;
+	int m_minValue2;
+	int m_maxValue2;
+	int m_ngType2;
+	int m_incValue2;
+
+	Point2D m_ptMeasureResult;
+	Point2D m_ptNearResult;
+	Point2D m_ptMatchResult;
+	Point2I m_locPointResult;
+
+	HalconCpp::HObject m_hRegion;
+	HalconCpp::HObject m_hLineRegion;
+
+	std::vector<NgDotInfo> m_nNgInfo;
+
+private:
+	int m_id;            //ID
+
+	double m_xPos;
+	double m_yPos;
+	
+	double m_cx;
+	double m_cy;
+	double m_angle;
+	double m_len1;
+	double m_len2;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+	Point2I m_topPoint;
+	Point2I m_botPoint;
+	Point2I m_topMark;
+	Point2I m_botMark;
+
+private:
+	//1. 查找查找
+	int findPairEdge(DimensionDir eDir, MeasureInfo infMeasure, Point2I offset);
+
+	//2. 分析区域
+	Line2D GetTargeLine(void);
+
+	//3. 获取目标点的位置
+	int getKeyPose(Point2I offset);
+
+	//4. 结果判断
+	void JudgeResult(void);
+
+	//5. 检测第一个判断
+	void JudgeFirstResult(void);
+
+	//6. 检测第二个缺陷
+	void JudgeSecondResult(void);
+
+	//7. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+};
+
+#endif
diff --git a/BlVisionPro/Vision/EiVisionType.h b/BlVisionPro/Vision/EiVisionType.h
new file mode 100644
index 0000000..867a2b8
--- /dev/null
+++ b/BlVisionPro/Vision/EiVisionType.h
@@ -0,0 +1,149 @@
+#ifndef EI_VISION_TYPE
+#define EI_VISION_TYPE
+
+enum VISION_RECIPE_TYPE {
+	LOC_VISION_TYPE = 0,
+	LOC_VISION_PROCESS,
+	GRIND_VISION_TYPE,
+	GRIND_VISION_PROCESS,
+	CUT_VISION_TYPE,
+	CUT_VISION_PROCESS,
+	KDIST_VISION_TYPE,
+	KDIST_VISION_PROCESS,
+	RCUT_VISION_TYPE,
+	RCUT_VISION_PROCESS,
+	THRES_VISION_TYPE,
+	THRES_VISION_PROCESS,
+	HOLE_VISION_TYPE,
+	HOLE_VISION_PROCESS
+};
+
+enum    VISION_TYPE { 
+	VISION_LOC = 0,               //DIST算法
+	VISION_CUT,                   //CUT距离
+	VISION_GRIND,
+	VISION_KDIST,
+	VISION_RCUT,                  //RCUT算法
+	VISION_THRES,
+	VISION_HOLE,
+	VISION_NONE };
+
+#define NG_INF_NUM          1000
+
+enum DefectNgLoc {
+	DefectLoc_OK = 0,    //OK
+	DefectLoc_Chip,      //Chip
+	DefectLoc_Broken,    //破损
+	DefectLoc_Grind,     //研磨
+	DefectLoc_Dist_Cut,  //切割精度
+	DefectLoc_Corner_Dist, //角精度
+	DefectLoc_HOLE,			//Hole
+	DefectLoc_Unknown       //指错误
+};
+
+static UINT _gGridFixCellColor = RGB(144, 200, 246);
+static UINT _gGridFixFontColor = RGB(0, 0, 0);
+static UINT _gGridCellColor = RGB(255, 255, 255);
+static UINT _gGridCellColor_NonSelect = RGB(150, 150, 150);
+static UINT _gGridCellReadyColor = RGB(255, 255, 0);
+static UINT _gGridCellOnColor = RGB(255, 69, 0);
+static UINT _gGridCellOffColor = RGB(128, 191, 255);
+static UINT _gPropertyGridFixCellColor = RGB(150, 150, 150);
+static UINT _gPropertyGridFixFontColor = RGB(0, 0, 0);
+static UINT _gSequenceOffColor = RGB(0, 0, 0);
+static UINT _gSequenceOnColor = RGB(0, 180, 0);
+
+typedef struct _NgDotInfo
+{
+	int eDir;                //检测面
+	int id;                  //检测ID
+	CString strName;        //名称
+	int xPosPxl;            //X位置
+	int yPosPxl;            //Y位置
+	double result;          //结果
+	double xResult;          //X结果
+	double yResult;          //Y结果
+	double minValue;        //下限
+	double maxValue;        //限制
+	bool isRes;             //检测结果
+	int x1;                 //缺陷的最小矩形
+	int y1;                 //缺陷的最小矩形
+	int x2;                 //缺陷的最小矩形
+	int y2;                 //缺陷的最小矩形
+	int ngType;             //缺陷类型
+	int eVision;            //视觉算法
+}NgDotInfo;
+
+typedef struct _MeasureInfo
+{
+	int idxRefer;
+	int typePoint;
+	int modePoint;
+	int pointThres;
+	int modeNear;
+	int nearThres;
+}MeasureInfo;
+
+typedef struct _ScanSetting
+{
+	int lengthSize;
+	int shortSize;
+	int nStdIndex;
+	int nIndex0;
+	int nIndex1;
+	int nIndex2;
+	int nIndex3;
+	int nLengthScan;
+	int nShortScan;
+}ScanSetting;
+
+typedef struct _VisionDisplayInfo
+{
+	bool isVisionDisplay;
+	bool isGrindDisplay;
+	bool isDistDisplay;
+	bool isCutDisplay;
+	bool isRcutDisplay;
+	bool isThresDisplay;
+	bool isHoleDisplay;
+}VisionDisplayInfo;
+
+typedef struct _VisionUseInfo
+{
+	bool isVisionUse;         //视觉
+	bool isLocUse;            //定位
+	bool isDistUse;           //距离
+	bool isCutUse;            //切割线
+	bool isGrindUse;          //研磨量          
+	bool isRcutUse;           //RCUT
+	bool isThresUse;          //Thres
+	bool isHoleUse;            //Hole
+}VisionUseInfo;
+
+typedef struct _DistIncInfo
+{
+	int incGrind;
+	int incTop;
+	int incBot;
+	int incKey;
+	int incCut;
+}DistIncInfo;
+
+typedef struct _DispResultObject
+{
+	HalconCpp::HObject hDispRegion;
+	HalconCpp::HObject hDispObject;
+}DispResultObject;
+
+typedef struct _KeyDebugInfo
+{
+	bool isDebugTool; 
+	bool isInspectKey;
+	bool isLocKey;
+	bool isGrindKey;
+	bool isCutLineKey;
+	bool isDistKey;
+	bool isRcutKey;
+}KeyDebugInfo;
+
+#endif
diff --git a/BlVisionPro/Vision/FileRecipe.cpp b/BlVisionPro/Vision/FileRecipe.cpp
new file mode 100644
index 0000000..86a3643
--- /dev/null
+++ b/BlVisionPro/Vision/FileRecipe.cpp
@@ -0,0 +1,195 @@
+#include "stdafx.h"
+#include <io.h>
+#include "FileRecipe.h"
+#include <time.h>
+#include <stdarg.h>
+#include <direct.h>
+#include <vector>
+#include <Dbghelp.h>
+#pragma comment(lib,"Dbghelp.lib")
+
+CFileRecipe::CFileRecipe()
+{
+}
+
+CFileRecipe::~CFileRecipe()
+{
+}
+
+bool CFileRecipe::fileIsExist(std::string fileName) {
+	/* code */
+	if (-1 != _access(fileName.c_str(), 0)) return true;
+
+	return false;
+}
+
+void CFileRecipe::removeDir(std::string dirPath) {
+	/* code */
+	struct _finddata_t fb;   // 查找相同属性文件的存储结构体
+	string path;
+	long long  handle; // 注意此处需要long*2
+	int   noFile;            // 对系统隐藏文件的处理标记
+
+	noFile = 0;
+	handle = 0;
+
+	struct stat s;
+	if (stat(dirPath.c_str(), &s) == 0) {
+		if (s.st_mode & S_IFDIR) {
+			std::cout << "it's a directory" << std::endl;
+		}
+		else if (s.st_mode & S_IFREG) {
+			std::cout << "it's a file" << std::endl;
+		}
+		else {
+			std::cout << "not file not directory" << std::endl;
+		}
+	}
+	else {
+		std::cout << "error, doesn't exist" << std::endl;
+		return;
+	}
+
+	path = dirPath + "/*";
+
+	handle = _findfirst(path.c_str(), &fb);
+	// 找到第一个匹配的文件
+	if (handle != 0){
+		// 当可以继续找到匹配的文件,继续执行
+		while (0 == _findnext(handle, &fb)){
+			// windows下,常有个系统文件,名为“..”,对它不做处理
+			noFile = strcmp(fb.name, "..");
+
+			if (0 != noFile){
+				path = dirPath + "/" + fb.name;
+
+				// 属性值为16,则说明是文件夹,迭代
+				if (fb.attrib == 16){
+					removeDir(path);
+				}
+				// 非文件夹的文件,直接删除。对文件属性值的情况没做详细调查,可能还有其他情况。
+				else{
+					remove(path.c_str());
+				}
+			}
+		}
+		//删除空目录
+//		_rmdir(dirPath.c_str());
+		// 关闭文件夹,只有关闭了才能删除。找这个函数找了很久,标准c中用的是closedir
+		// 经验介绍:一般产生Handle的函数执行后,都要进行关闭的动作。
+		_findclose(handle);
+	}
+}
+
+void CFileRecipe::makeDir(std::string dirName) {
+	/* code */
+	MakeSureDirectoryPathExists(dirName.c_str());
+}
+
+bool CFileRecipe::openRecipeFile(CStdioFile &fileRecipe, CString fileName) {
+	/* code */
+	if (!fileRecipe.Open(fileName, CFile::modeCreate | CFile::modeReadWrite)) return false;
+
+	return true;
+}
+
+bool CFileRecipe::readRecileFile(CStdioFile &fileRecipe, CString fileName) {
+	/* code */
+	if (!fileRecipe.Open(fileName, CFile::modeRead)) return false;
+
+	return true;
+}
+
+CString CFileRecipe::toCString(std::string str) {
+	/* code */
+	CString strRes = CA2T(str.c_str());
+	return strRes;
+}
+
+std::string CFileRecipe::toString(CString str) {
+	/* code */
+	std::string strRes(CT2A(str.GetString()));
+	return strRes;
+}
+
+void CFileRecipe::WriteString(CStdioFile &fileRecipe, std::string strText) {
+	/* code */
+	CString str = toCString(strText);
+	fileRecipe.WriteString(str);
+}
+
+void CFileRecipe::WriteCString(CStdioFile &fileRecipe, CString strText) {
+	/* code */
+	fileRecipe.WriteString(strText);
+}
+
+BOOL CFileRecipe::ReadString(CStdioFile &fileRecipe, CString &strRes) {
+	/* code */
+	return fileRecipe.ReadString(strRes);
+}
+
+void StringTrim(std::string& s) {
+	/* code */
+	if (!s.empty()) {
+		s.erase(0, s.find_first_not_of(" "));
+		s.erase(s.find_last_not_of(" ") + 1);
+	}
+}
+
+int CFileRecipe::StringSplit(const std::string& strScr, const std::string& delim, std::vector<std::string>& strings) {
+	/* code */
+	strings.clear();
+	size_t pos = 0;
+	size_t len = strScr.length();
+	size_t delim_len = delim.length();
+	if (delim_len == 0) {
+		return 0;
+	}
+
+	while (pos < len) {
+		size_t find_pos = strScr.find(delim, pos);
+		if (find_pos == strScr.npos) {
+			std::string str2 = strScr.substr(pos, len - pos);
+			StringTrim(str2);
+			strings.push_back(str2);
+			break;
+		}
+
+		std::string str2 = strScr.substr(pos, find_pos - pos);
+		StringTrim(str2);
+		strings.push_back(str2);
+		pos = find_pos + delim_len;
+	}
+
+	return (int)strings.size();
+}
+
+int CFileRecipe::CStringSplit(const CString& strText, const std::string& delim, std::vector<std::string>& strings) {
+	/* code */
+	std::string str = toString(strText);
+	return StringSplit(str, delim, strings);
+}
+
+int CFileRecipe::CStringToInt(CString strText) {
+	/* code */
+	int result = _wtoi(strText);
+	return result;
+}
+
+int CFileRecipe::StringToInt(std::string str) {
+	/* code */
+	CString strText = toCString(str);
+	return CStringToInt(strText);
+}
+
+double CFileRecipe::CStringToF(CString strText) {
+	/* code */
+	double result = _wtof(strText);
+	return result;
+}
+
+double CFileRecipe::StringToF(std::string str) {
+	/* code */
+	CString strText = toCString(str);
+	return CStringToF(strText);
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/FileRecipe.h b/BlVisionPro/Vision/FileRecipe.h
new file mode 100644
index 0000000..fb65054
--- /dev/null
+++ b/BlVisionPro/Vision/FileRecipe.h
@@ -0,0 +1,53 @@
+#ifndef FILE_RECIPE_H
+#define FILE_RECIPE_H
+
+#include "LocProcess.h"
+
+class CFileRecipe
+{
+public:
+	CFileRecipe();
+	~CFileRecipe();
+
+public:
+	//1. 文件是否存在
+   static bool fileIsExist(std::string fileName);
+
+	//2. 删除文件下的所有文件
+   static void removeDir(std::string dirPath);
+
+   //3. 创建目录
+   static void makeDir(std::string dirName);
+
+   //4. 打开和创建CSV文件
+   static bool openRecipeFile(CStdioFile &fileRecipe, CString fileName);
+   static bool readRecileFile(CStdioFile &fileRecipe, CString fileName);
+
+   //5. 格式转换
+   static CString toCString(std::string str);
+
+   //6. 格式转换
+   static std::string toString(CString str);
+
+   //7. 写入CSV文件
+   static void WriteString(CStdioFile &fileRecipe, std::string strText);
+   static void WriteCString(CStdioFile &fileRecipe, CString strText);
+
+   //8. 读取文件
+   static BOOL ReadString(CStdioFile &fileRecipe, CString &strRes);
+   //9. 字符分割
+   static int StringSplit(const std::string& strScr, const std::string& delim, std::vector<std::string>& strings);
+   static int CStringSplit(const CString& strText, const std::string& delim, std::vector<std::string>& strings);
+
+   //10. 数据转换
+   static int CStringToInt(CString strText);
+   static int StringToInt(std::string str);
+   static double CStringToF(CString strText);
+   static double StringToF(std::string str);
+
+private:
+
+};
+
+#endif
+
diff --git a/BlVisionPro/Vision/GrindDotProcess.cpp b/BlVisionPro/Vision/GrindDotProcess.cpp
new file mode 100644
index 0000000..5cdb38a
--- /dev/null
+++ b/BlVisionPro/Vision/GrindDotProcess.cpp
@@ -0,0 +1,345 @@
+#include "stdafx.h"
+#include "GrindDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+
+CGrindDotProcess::CGrindDotProcess()
+{
+	/* code */
+	m_poseType = 0;
+	m_eDir = DIMENSION_NONE;
+	m_id = 0;
+
+	m_nUse = 0;
+	m_strName.Format(_T("P%d"), m_id);
+
+	m_nPosY = 0;
+
+	m_nInc = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_distResult = 0.0f;
+
+	m_nEdgeThres = 20;
+	m_nLeftLineDist = 0;
+}
+
+CGrindDotProcess::CGrindDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_poseType = 0;
+	m_eDir = eDir;
+	m_id = id;
+	m_nLeftLineDist = 0;
+
+	m_nUse = 0;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_G%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_G%d"), m_id);
+		break;
+	}
+
+	m_nPosY = 0;
+
+	m_nInc = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_distResult = 0.0f;
+	m_nEdgeThres = 20;
+}
+
+CGrindDotProcess::~CGrindDotProcess(){
+	/* code */
+}
+
+int CGrindDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	m_ptNearResult.x = 0.0f;
+	m_ptNearResult.y = 0.0f;
+	m_ptMeasureResult.x = 0.0f;
+	m_ptMeasureResult.y = 0.0f;
+	m_ptLeftResult.x = 0;
+	m_ptLeftResult.y = 0;
+	m_leftLineResult = 0;
+	if (1 != m_nUse) return 0;
+	if (0 == m_nLeftLineDist)  return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 查找left
+	if (!FindLeftLine(eDir, offset)) return -1;
+
+	//3. 结果判断
+	judgeResult();
+
+	return 0;
+}
+
+bool CGrindDotProcess::FindLeftLine(DimensionDir eDir, Point2I offset) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return false;
+	if (0 == m_poseType) {
+		if (!pSideData->m_bTopMark_Find)  return false;
+		if (!pSideData->m_bBotMark_Find)  return false;
+	}
+	else {
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	Point2I ptOffset;
+	ptOffset.x = m_nLeftLineDist;
+	ptOffset.y = m_nPosY;
+	Point2I result;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result))  return false;
+	m_locPointResult = result;
+
+	int x1 = result.x - 200;
+	int y1 = result.y - 31;
+	int x2 = result.x + 200;
+	int y2 = result.y + 31;
+	Point2I leftTop;
+	leftTop.x = x1;
+	leftTop.y = y1;
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return false;
+
+	HalconCpp::HObject hMeanImage;
+	HalconCpp::MeanImage(hImage, &hMeanImage, 1, 20);
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 10 || height < 25)  return false;
+
+	Line2D line;
+	line.pt0.x = 5;
+	line.pt0.y = 0.5 * height - 1;
+	line.pt1.x = width - 6;
+	line.pt1.y = 0.5 * height - 1;
+	Point2D ptStart, ptEnd;
+	if (!CVisionBufferPro::GetMeasureNearPos(hMeanImage, line, m_nEdgeThres, 0, 10, ptStart, ptEnd)) return false;
+
+	m_ptMeasureResult = ptStart;
+	m_ptMeasureResult.x += leftTop.x;
+	m_ptMeasureResult.y += leftTop.y;
+	m_ptNearResult = ptEnd;
+	m_ptNearResult.x += leftTop.x;
+	m_ptNearResult.y += leftTop.y;
+	
+	m_ptLeftResult.x = (int)(m_ptMeasureResult.x);
+	m_ptLeftResult.y = (int)(m_ptMeasureResult.y);
+
+	return true;
+}
+
+void CGrindDotProcess::setLeftLine(int nLeftDist, int leftThres) {
+	/* code */
+	m_nLeftLineDist = nLeftDist;
+	m_nLeftThres = leftThres;
+}
+
+int CGrindDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+void CGrindDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+void CGrindDotProcess::judgeResult(void) {
+	/* code */
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return;
+	if (nullptr != pSideData) {  //区域的显示结果
+		//1. 输出边界点1
+        DispVisionResult inf;
+		inf.nType = 0;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_GRIND);
+		inf.pointX = (int)(m_ptMeasureResult.x);
+		inf.pointY = (int)(m_ptMeasureResult.y);
+		inf.showROI = 0;
+        pSideData->m_vDispVisionResult.push_back(inf);
+
+		//2. 输出直线
+		inf.nType = 3;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_GRIND);
+		inf.rectX1 = (int)(m_ptMeasureResult.x);
+		inf.rectY1 = (int)(m_ptMeasureResult.y);
+		inf.rectX2 = (int)(m_ptNearResult.x);
+		inf.rectY2 = (int)(m_ptNearResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		//4. 输出位置
+		inf.nType = 4;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_GRIND);
+		inf.pointX = (int)(m_ptMeasureResult.x);
+		inf.pointY = (int)(m_ptMeasureResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	m_nNgInfo.clear();
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_nMin;
+	ng.maxValue = m_nMax;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_KDIST;
+
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+
+	ng.ngType = DefectLoc_Grind;
+	double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x);
+	double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y);
+	m_distResult = sqrt(dx * dx + dy * dy);
+	m_distResult += m_nInc;
+	ng.result = m_distResult;
+
+	if (m_nMax < 0.5) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	if (ng.result < m_nMin || ng.result > m_nMax) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+Json::Value CGrindDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+
+	Json::Value jsValue;
+	jsValue["alg type"] = GRIND_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["use"] = m_nUse;
+	jsValue["pos y"] = m_nPosY;
+	jsValue["end Thres"] = m_nEdgeThres;
+	jsValue["inc"] = m_nInc;
+	jsValue["min"] = m_nMin;
+	jsValue["max"] = m_nMax;
+	jsValue["pos type"] = m_poseType;
+
+	return jsValue;
+}
+
+void CGrindDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosY = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. end Thres
+	strName = "end Thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEdgeThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. inc
+	strName = "inc";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nInc = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. min
+	strName = "min";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMin = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. max
+	strName = "max";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMax = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. pos type
+	strName = "pos type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_poseType = jsValue[strName.c_str()].asInt();
+	}
+}
diff --git a/BlVisionPro/Vision/GrindDotProcess.h b/BlVisionPro/Vision/GrindDotProcess.h
new file mode 100644
index 0000000..d707fb4
--- /dev/null
+++ b/BlVisionPro/Vision/GrindDotProcess.h
@@ -0,0 +1,72 @@
+#ifndef GRIND_DOT_PROCESS_H
+#define GRIND_DOT_PROCESS_H
+
+#include "IncludeVision.h"
+
+class CGrindDotProcess
+{
+public:
+	CGrindDotProcess();
+	CGrindDotProcess(DimensionDir eDir, int id);
+	~CGrindDotProcess();
+
+public:
+	//1. 设置测量
+	void setLeftLine(int nLeftDist, int leftThres);
+
+	//2. 执行
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//3. 获取ID
+	int getID(void);
+
+	//6. 保存数据
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	int m_nUse;
+	CString m_strName;
+
+	int m_poseType;             //位置信息
+	int m_nPosY;                //Y方向的距离
+
+	int m_nLeftThres;           //左边界亮度阈值
+	int m_nLeftLineDist;        //左边界的距离
+	int m_nEdgeThres;           //研磨边阈值
+//	int m_nLineWidth;           //分析距离
+
+	int m_nInc;                //INC补偿值
+	int m_nMin;                //判定阈值
+	int m_nMax;                //判定阈值
+
+	Point2D m_ptMeasureResult;
+	Point2D m_ptNearResult;
+	Point2I m_locPointResult;
+
+	Point2I m_ptLeftResult;             //左边界的点
+	double m_distResult;
+	int m_leftLineResult;
+
+	std::vector<NgDotInfo> m_nNgInfo;
+	
+
+private:
+	DimensionDir m_eDir; 
+	int m_id;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+
+private:
+	//1. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+
+	//2. 判断结果
+	void judgeResult(void);
+
+	//3. 查找边界
+	bool FindLeftLine(DimensionDir eDir, Point2I offset);
+};
+
+#endif
diff --git a/BlVisionPro/Vision/GrindProcess.cpp b/BlVisionPro/Vision/GrindProcess.cpp
new file mode 100644
index 0000000..2848c50
--- /dev/null
+++ b/BlVisionPro/Vision/GrindProcess.cpp
@@ -0,0 +1,123 @@
+#include "stdafx.h"
+#include "GrindProcess.h"
+#include "BlSideData.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CGrindProcess::CGrindProcess() {
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CGrindDotProcess(m_eDir, i + 1);
+	}
+	m_isUse = false;
+
+	m_nLeftLineDist = 0;
+	m_nLeftThres = 20;
+}
+
+CGrindProcess::CGrindProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	m_isUse = false;
+	m_nLeftLineDist = 0;
+	m_nLeftThres = 20;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CGrindDotProcess(m_eDir, i + 1);
+	}
+
+}
+
+CGrindProcess::~CGrindProcess() {
+	/* code */
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+void CGrindProcess::Execute(DimensionDir eDir) {
+	/* code */
+	if (!m_isUse) return;
+
+	MeasureInfo m_info;
+
+	m_info.idxRefer = 10;
+	m_info.modePoint = 0;
+	m_info.modeNear = 0;
+	m_info.typePoint = 0;
+	m_info.pointThres = 15;
+	m_info.nearThres = 30;
+
+	Point2I offset;
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse)   continue;
+
+		offset.x = i;
+		offset.y = i;
+
+		dot->setLeftLine(m_nLeftLineDist, m_nLeftThres);
+		dot->Execute(m_eDir, offset);
+	}
+}
+
+Json::Value CGrindProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = GRIND_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["use"] = m_isUse;
+	jsValue["toMark"] = m_nLeftLineDist;
+	jsValue["leftThres"] = m_nLeftThres;
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CGrindProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) {
+		m_isUse = jsValue[strName.c_str()].asBool();
+	}
+
+	//3. idxRefer
+	strName = "toMark";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nLeftLineDist = jsValue[strName.c_str()].asInt();
+	}
+
+	//4. typePoint
+	strName = "leftThres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nLeftThres = jsValue[strName.c_str()].asInt();
+	}
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/GrindProcess.h b/BlVisionPro/Vision/GrindProcess.h
new file mode 100644
index 0000000..51a25fd
--- /dev/null
+++ b/BlVisionPro/Vision/GrindProcess.h
@@ -0,0 +1,30 @@
+#ifndef GRIND_PROCESS_H
+#define GRIND_PROCESS_H
+
+#include "GrindDotProcess.h"
+
+class CGrindProcess
+{
+public:
+	CGrindProcess();
+	CGrindProcess(DimensionDir eDir);
+	~CGrindProcess();
+
+public:
+	bool m_isUse;   //是否启用
+	DimensionDir m_eDir;
+	int m_nLeftLineDist;
+	int m_nLeftThres;
+
+	CGrindDotProcess *m_dots[50];
+
+public:
+	//1. 执行检测
+	void Execute(DimensionDir eDir);
+
+	//2. 保存文件
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+};
+
+#endif
diff --git a/BlVisionPro/Vision/HoleDotProcess.cpp b/BlVisionPro/Vision/HoleDotProcess.cpp
new file mode 100644
index 0000000..e29b162
--- /dev/null
+++ b/BlVisionPro/Vision/HoleDotProcess.cpp
@@ -0,0 +1,494 @@
+#include "stdafx.h"
+#include "HoleDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+
+CHoleDotProcess::CHoleDotProcess(){
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	m_id = 0;
+	m_strName.Format(_T("P%d"), m_id);
+    m_nUse = 0;
+	m_nPoseType = 0;
+	m_nShapeType = 2;
+	m_nSmoothSize = 8;
+	m_nBrightType = 1;
+	m_nDefectSize = 3;
+	m_nThres = 45;
+
+
+	m_xScale = 1.0f;
+	m_yScale = 1.0f;
+	m_isScale = false;
+	m_nPoseX = 0;
+	m_nPoseX = 0;
+	m_score = 0.5f;
+	m_idModel = HalconCpp::HTuple();
+	m_nNgInfo.clear();
+
+	HalconCpp::GenEmptyObj(&m_hImage);
+	HalconCpp::GenEmptyObj(&m_hImageResult);
+}
+
+CHoleDotProcess::CHoleDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_eDir = eDir;
+	m_id = id;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_H%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_H%d"), m_id);
+		break;
+	}
+	m_nUse = 0;
+	m_nPoseType = 0;
+	m_nShapeType = 2;
+	m_nSmoothSize = 8;
+	m_nBrightType = 1;
+	m_nDefectSize = 3;
+	m_nThres = 45;
+
+
+	m_xScale = 1.0f;
+	m_yScale = 1.0f;
+	m_isScale = false;
+	m_nPoseX = 0;
+	m_nPoseX = 0;
+	m_score = 0.5f;
+	m_idModel = HalconCpp::HTuple();
+	m_nNgInfo.clear();
+
+	HalconCpp::GenEmptyObj(&m_hImage);
+	HalconCpp::GenEmptyObj(&m_hImageResult);
+}
+
+CHoleDotProcess::~CHoleDotProcess(){
+	/* code */
+
+}
+
+Json::Value CHoleDotProcess::WriteToJson(std::string& strDir) {
+	/* code */
+	int iValue = 0;
+	if (ClsVision::ObjectExist(m_hImage)) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_hImage, width, height);
+		if (width > 0 && height > 0) {
+			iValue = 1;
+		}
+	}
+	std::string strImage = "NULL";
+	if (1 == iValue) {
+		strImage = ClsVision::FormatString("%d_%d_hole", m_eDir, m_id);
+	}
+
+	Json::Value jsValue;
+	std::string strName = CFileRecipe::toString(m_strName);
+	jsValue["alg type"] = HOLE_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+    jsValue["use"] = m_nUse;
+	jsValue["Pos Type"] = m_nPoseType;
+	jsValue["Shape Type"] = m_nShapeType;
+	jsValue["Bright Type"] = m_nBrightType;
+	jsValue["Thres"] = m_nThres;
+    jsValue["Smooth Size"] = m_nSmoothSize;
+	jsValue["Defect Size"] = m_nDefectSize;
+	jsValue["Pose X"] = m_nPoseX;
+    jsValue["Pose Y"] = m_nPoseY;
+	jsValue["image file"] = strImage;
+
+	std::string imageDir = strDir + "Image\\";
+	if (!CFileRecipe::fileIsExist(imageDir)) {
+		CFileRecipe::makeDir(imageDir);
+	}
+	if (0 == iValue) return jsValue;
+
+
+	std::string fileName = imageDir + strImage + ".jpg";
+	HalconCpp::WriteImage(m_hImage, "jpeg", 0, fileName.c_str());
+	return jsValue;
+}
+
+void CHoleDotProcess::DecodeJson(std::string& strDir, Json::Value& jsValue) {
+	/* code */
+	if (strDir.empty()) return;
+
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. Pose Type
+	strName = "Pos Type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseType = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. Shape Type
+	strName = "Shape Type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nShapeType = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. Bright Type
+    strName = "Bright Type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nBrightType = jsValue[strName.c_str()].asInt();
+	}
+   
+	//8. Thres
+	strName = "Thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. Smooth Size
+	strName = "Smooth Size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nSmoothSize = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. Defect Size
+	strName = "Defect Size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nDefectSize = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. Pose X
+	strName = "Pose X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseX = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. Pose Y
+	strName = "Pose Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseY = jsValue[strName.c_str()].asInt();
+	}
+
+	//13. image file
+	strName = "image file";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		std::string imgFile = jsValue[strName.c_str()].asString();
+		if (0 != imgFile.compare("NULL")) {
+			std::string fileName = strDir + "Image\\" + imgFile + ".jpg";
+			if (CFileRecipe::fileIsExist(fileName)) {
+				HalconCpp::ReadImage(&m_hImage, fileName.c_str());
+				CreateMatchModel();
+			}
+		}
+		else {
+			HalconCpp::GenEmptyObj(&m_hImage);
+			CreateMatchModel();
+		}
+	}
+}
+
+int CHoleDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_ptLocResult.x = 0.0f;
+    m_ptLocResult.y = 0.0f;
+	m_nNgInfo.clear();
+	HalconCpp::GenEmptyObj(&m_hImageResult);
+	if (1 != m_nUse) return 0;
+	if (ClsVision::TupleNil(m_idModel)) {
+		CreateMatchModel();
+	}
+	if (ClsVision::TupleNil(m_idModel)) return 0;
+
+	//查找目标位置,截取分析图像
+	if (!FindTargetPos(eDir, offset)) return 0;
+
+	FindDefectInfo();
+
+	int nRet = (int)(m_nNgInfo.size());
+	return nRet;
+}
+
+bool CHoleDotProcess::FindDefectInfo(void) {
+	/* code */
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return false;
+
+	if (nullptr != pSideData) {
+		DispVisionResult inf;
+		inf.nType = 4;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_THRES);
+		inf.strName = m_strName;
+		inf.pointX = (int)(m_ptLocResult.x);
+		inf.pointY = (int)(m_ptLocResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+
+	int x1 = (int)(m_ptLocResult.x - 0.5 * width);
+	int y1 = (int)(m_ptLocResult.y - 0.5 * height);
+	int x2 = x1 + width - 1;
+	int y2 = y1 + height - 1;
+
+	if (nullptr != pSideData) {
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_THRES);
+		inf.strName = m_strName;
+		inf.rectX1 = x1;
+		inf.rectY1 = y1;
+        inf.rectX2 = x2;
+        inf.rectY2 = y2;
+		inf.showROI = 1;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	if (!CVisionBufferPro::getImageROI(m_eDir, m_hImageResult, x1, y1, x2, y2)) return false;
+
+    //查找缺陷信息
+	HalconCpp::HObject hRoiRegion;
+	if (0 == m_nShapeType) {
+		return false;
+	}
+	else if (1 == m_nShapeType) {
+		HalconCpp::GenRectangle1(&hRoiRegion, m_nSmoothSize, m_nSmoothSize, height - 1 - m_nSmoothSize, width - 1 - m_nSmoothSize);
+	}
+	else {
+		HalconCpp::GenEllipse(&hRoiRegion, 0.5 * (height-1), 0.5 * (width-1),  0, 0.5 * width - m_nSmoothSize, 0.5 * height - m_nSmoothSize);
+	}
+
+	//HalconCpp::HWindow hDispWin(0, 0, width, height);
+	//hDispWin.SetPart(0, 0, height - 1, width - 1);
+	//hDispWin.DispObj(m_hImageResult);
+	//hDispWin.SetDraw("margin");
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hRoiRegion);
+	//hDispWin.Click();
+
+
+	HalconCpp::HObject hProcImage;
+	HalconCpp::ReduceDomain(m_hImageResult, hRoiRegion, &hProcImage);
+	HalconCpp::HObject hRegion, hConnectedRegion, hSelectedRegion;
+	if (1 == m_nBrightType) {
+		HalconCpp::Threshold(hProcImage, &hRegion, 0, m_nThres);
+	}
+	else {
+		HalconCpp::Threshold(hProcImage, &hRegion, m_nThres, 255);
+	}
+	HalconCpp::Connection(hRegion, &hConnectedRegion);
+	HalconCpp::SelectShape(hConnectedRegion, &hSelectedRegion, "area", "and", 10, MAXINT);
+	//hDispWin.SetDraw("fill");
+	//hDispWin.DispObj(hSelectedRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HTuple hvNum;
+	HalconCpp::CountObj(hSelectedRegion, &hvNum);
+	int nCount = hvNum[0].I();
+	if (nCount <1) return false;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = false;
+	ng.minValue = m_nDefectSize;
+	ng.maxValue = m_nDefectSize;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_HOLE;   //缺陷类型
+	ng.eVision = VISION_HOLE;
+
+	double xMmvsp = pSideData->m_dPixelSizeX;
+	double yMmvsp = pSideData->m_dPixelSizeY;
+	HalconCpp::HTuple hvArea, hvY, hvX;
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::AreaCenter(hSelectedRegion, &hvArea, &hvY, &hvX);
+	HalconCpp::SmallestRectangle1(hSelectedRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	for (int i = 0; i < nCount; i++) {
+		int wTmp = hvX2[i].I() - hvX1[i].I() + 1;
+		int hTmp = hvY2[i].I() - hvY1[i].I() + 1;
+		if (wTmp > m_nDefectSize || hTmp > m_nDefectSize) {
+			ng.result = hvArea[i].I();
+			ng.xResult = (int)(xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1));
+			ng.yResult = (int)(yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1));
+			ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + x1;
+			ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + y1;
+
+			ng.x1 = hvX1[i].I() + x1 - 1;
+			ng.y1 = hvY1[i].I() + y1 - 1;
+			ng.x2 = hvX2[i].I() + x1 + 1;
+			ng.y2 = hvY2[i].I() + y1 + 1;
+
+			if (nullptr != pSideData) {  //区域的显示结果
+				DispVisionResult inf;
+				inf.nType = 1;
+				inf.eDir = (int)(m_eDir);
+				inf.strName = m_strName;
+				inf.eVision = (int)(VISION_THRES);
+				inf.rectX1 = ng.x1;
+				inf.rectY1 = ng.y1;
+				inf.rectX2 = ng.x2;
+				inf.rectY2 = ng.y2;
+				inf.showROI = 0;
+				pSideData->m_vDispVisionResult.push_back(inf);
+			}
+
+			m_nNgInfo.push_back(ng);
+		}
+	}
+
+	return true;
+}
+
+bool CHoleDotProcess::FindTargetPos(DimensionDir eDir, Point2I offset) {
+	/* code */
+	if (ClsVision::TupleNil(m_idModel)) return false;
+
+	//获取指定方向的侧边数据
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	//如果侧边数据为空,则返回false
+	if (nullptr == pSideData)  return false;
+	if (0 == m_nPoseType) {
+		//如果侧边数据中没有找到上点,则返回false
+		if (!pSideData->m_bBotMark_Find)  return false;
+		//如果侧边数据中没有找到下点,则返回false
+		if (!pSideData->m_bTopMark_Find)  return false;
+	}
+	else {
+		//如果侧边数据中没有找到上点,则返回false
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		//如果侧边数据中没有找到下点,则返回false
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	//1. 首先计算Key的位置
+	Point2I ptOffset;
+	ptOffset.x = m_nPoseX;
+	ptOffset.y = m_nPoseY;
+	Point2I result;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_nPoseType, result))  return false;
+
+    //2. 计算Image的ROI
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+	int x1 = (int)(result.x - 0.5 * width - 200);
+	int y1 = (int)(result.y - 0.5 * height - 200);
+	int x2 = (int)(result.x + 0.5 * width + 200);
+	int y2 = (int)(result.y + 0.5 * height + 200);
+	HalconCpp::HObject hSearchImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hSearchImage, x1, y1, x2, y2)) return false;
+
+    //3. 查找模板
+	std::vector<ParaMatch> vResult;
+	if (m_isScale) {
+		HalconCpp::HObject hZoomImage;
+		HalconCpp::ZoomImageFactor(hSearchImage, &hZoomImage, m_xScale, m_yScale, "constant");
+		ClsVision::FindNccModel(hZoomImage, m_idModel, m_score, 1, vResult);
+		int sz = (int)(vResult.size());
+		for (int i = 0; i < sz; i++) {
+			vResult[i].pt.x = vResult[i].pt.x / m_xScale;
+			vResult[i].pt.y = vResult[i].pt.y / m_yScale;
+		}
+	}
+	else {
+		ClsVision::FindNccModel(hSearchImage, m_idModel, m_score, 1, vResult);
+	}
+	int nCount = (int)(vResult.size());
+	if (nCount < 1) return false;
+
+	m_ptLocResult = vResult[0].pt;
+	m_ptLocResult.x += x1;
+	m_ptLocResult.y += y1;
+
+	return true;
+}
+
+int CHoleDotProcess::CreateMatchModel(void) {
+	/* code */
+	if (!ClsVision::TupleNil(m_idModel)) {
+		ClsVision::ClearNccModel(m_idModel);
+		m_idModel = HalconCpp::HTuple();
+	}
+	if (!ClsVision::ObjectExist(m_hImage)) return -1;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+	if (width < 1 || height < 1) return -1;
+
+	m_isScale = false;
+	if (width > 120 || height > 120) {
+		m_isScale = true;
+		m_xScale = 1.0f;
+		m_yScale = 1.0f;
+		if (width > 120) {
+			m_xScale = 120.0f / width;
+		}
+		if (height > 120) {
+			m_yScale = 120.0f / height;
+		}
+		HalconCpp::HObject hZoomImage;
+		HalconCpp::ZoomImageFactor(m_hImage, &hZoomImage, m_xScale, m_yScale, "constant");
+		m_idModel = ClsVision::CreateNccModel(hZoomImage, -15, 15, 0, 2000);
+	}
+	else {
+		m_xScale = 1.0f;
+		m_yScale = 1.0f;
+		m_idModel = ClsVision::CreateNccModel(m_hImage, -15, 15, 0, 2000);
+	}
+
+	return 0;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/HoleDotProcess.h b/BlVisionPro/Vision/HoleDotProcess.h
new file mode 100644
index 0000000..72d5899
--- /dev/null
+++ b/BlVisionPro/Vision/HoleDotProcess.h
@@ -0,0 +1,71 @@
+#ifndef HOLE_DOT_PROCESS
+#define HOLE_DOT_PROCESS
+
+class CHoleDotProcess
+{
+public:
+	CHoleDotProcess();
+	CHoleDotProcess(DimensionDir eDir, int id);
+	~CHoleDotProcess();
+
+public:
+	//1. 获取ID
+    int GetID() { return m_id; }
+
+	//2. 获取图像
+    HalconCpp::HObject& GetImage() { return m_hImage; }
+    void SetImage(HalconCpp::HObject& image) { m_hImage = image;  CreateMatchModel(); }
+
+	//3. 设置位置
+    void SetPose(int x, int y) { m_nPoseX = x; m_nPoseY = y; }
+	void GetPose(int& x, int& y) { x = m_nPoseX; y = m_nPoseY; };
+
+	//4. 保存数据
+	Json::Value WriteToJson(std::string& strDir);
+	void DecodeJson(std::string& strDir, Json::Value& jsValue);
+
+	//7. 执行
+	int Execute(DimensionDir eDir, Point2I offset);
+
+public:
+	DimensionDir m_eDir;                 //Side
+	CString m_strName;                   //Name
+	int m_nUse;                          //Use
+
+	int m_nPoseType;                  //PoseType
+	int m_nShapeType;                 //ShapeType
+	int m_nBrightType;                //BrightType
+	int m_nSmoothSize;                //SmoothSize
+	int m_nThres;                     //Thres
+	int m_nDefectSize;              //DefectSize
+
+	Point2D m_ptLocResult;              //定位结果
+	std::vector<NgDotInfo> m_nNgInfo;
+
+private:
+	HalconCpp::HObject m_hImage;   //Hole图像
+	HalconCpp::HObject m_hImageResult;   //截取图像
+	int m_id;  //Hole编号
+	double m_score; //Hole得分
+
+	int m_nPoseX; //Hole中心点X
+	int m_nPoseY; //Hole中心点Y
+
+	HalconCpp::HTuple m_idModel;   //模板ID
+	double m_xScale; //模板X缩放
+	double m_yScale; //模板Y缩放
+	bool m_isScale;	 //是否缩放
+
+private:
+	//1. 创建模版
+    int CreateMatchModel(void);
+
+	//2. 查找目标位置
+	bool FindTargetPos(DimensionDir eDir, Point2I offset);
+
+	//3. 获取缺陷信息
+	bool FindDefectInfo(void);
+};
+
+#endif // !HOLE_DOT_PROCESS
+
diff --git a/BlVisionPro/Vision/HoleProcess.cpp b/BlVisionPro/Vision/HoleProcess.cpp
new file mode 100644
index 0000000..f03f5f4
--- /dev/null
+++ b/BlVisionPro/Vision/HoleProcess.cpp
@@ -0,0 +1,82 @@
+#include "stdafx.h"
+#include "HoleProcess.h"
+#include "BlSideData.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CHoleProcess::CHoleProcess(){
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	for (int i = 0; i < 4; i++) {
+		m_dots[i] = new CHoleDotProcess(m_eDir, i + 1);
+	}
+}
+
+CHoleProcess::CHoleProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	for (int i = 0; i < 4; i++) {
+		m_dots[i] = new CHoleDotProcess(m_eDir, i + 1);
+	}
+}
+
+CHoleProcess::~CHoleProcess(){
+	/* code */
+	for (int i = 0; i < 4; i++) {
+		CHoleDotProcess* dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+void CHoleProcess::Execute(DimensionDir eDir) {
+	/* code */
+	Point2I offset;
+	for (int i = 0; i < 4; i++) {
+		CHoleDotProcess* dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse) continue;
+
+		offset.x = i;
+		offset.y = i;
+		dot->Execute(eDir, offset);
+	}
+}
+
+Json::Value CHoleProcess::WriteToJson(std::string& strDir) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = HOLE_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+
+	for (int i = 0; i < 4; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson(strDir);
+	}
+	return jsValue;
+}
+
+void CHoleProcess::DecodeJson(Json::Value& jsValue, std::string& strDir) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	for (int i = 0; i < 4; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(strDir, jsData);
+		}
+	}
+
+	return;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/HoleProcess.h b/BlVisionPro/Vision/HoleProcess.h
new file mode 100644
index 0000000..79a9a94
--- /dev/null
+++ b/BlVisionPro/Vision/HoleProcess.h
@@ -0,0 +1,31 @@
+#ifndef HOLE_PROCESS_H
+#define HOLE_PROCESS_H
+
+#include "HoleDotProcess.h"
+
+class CHoleProcess
+{
+public:
+	CHoleProcess();
+	CHoleProcess(DimensionDir eDir);
+	~CHoleProcess();
+
+public:
+	DimensionDir m_eDir;
+	CHoleDotProcess* m_dots[4];
+
+public:
+	//1. 执行检测
+	void Execute(DimensionDir eDir);
+
+	//2. 保存文件
+	Json::Value WriteToJson(std::string &strDir);
+	void DecodeJson(Json::Value& jsValue, std::string& strDir);
+
+};
+
+
+
+
+#endif // !HOLE_PROCESS_H
+
diff --git a/BlVisionPro/Vision/InChipDotProcess.cpp b/BlVisionPro/Vision/InChipDotProcess.cpp
new file mode 100644
index 0000000..6a800a4
--- /dev/null
+++ b/BlVisionPro/Vision/InChipDotProcess.cpp
@@ -0,0 +1,157 @@
+#include "stdafx.h"
+#include "InChipDotProcess.h"
+#include "VisionBufferPro.h"
+#include "Bspline.h"
+
+CInChipDotProcess::CInChipDotProcess(){
+	/* code */
+	m_nSampleNumber = 16;
+	m_nLineWidth = 50;
+	m_nChipOffset = -32;
+	m_nChipRange = 30;
+	m_threshold = 20;
+	m_nPointType = 1;
+	m_nPointMode = 2;
+	m_eDir = DIMENSION_NONE;
+	CVisionBufferPro::getLineFrameSize(m_eDir, m_nFrameWidth, m_nFrameHeight);
+	ClsVision::GenEmptyObject(m_hRoiRegion);
+}
+
+CInChipDotProcess::CInChipDotProcess(DimensionDir eDir) {
+	/* code */
+	m_nSampleNumber = 16;
+	m_nLineWidth = 100;
+	m_nChipOffset = -32;
+	m_nChipRange = 30;
+	m_threshold = 20;
+	m_nPointType = 1;
+	m_nPointMode = 2;
+	m_eDir = eDir;
+	CVisionBufferPro::getLineFrameSize(m_eDir, m_nFrameWidth, m_nFrameHeight);
+	ClsVision::GenEmptyObject(m_hRoiRegion);
+}
+
+CInChipDotProcess::~CInChipDotProcess()
+{
+}
+
+int CInChipDotProcess::Execute(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd) {
+	/* code */
+	if (index < 0) return 0;
+
+	return ExeInChip(eDir, index, ptStart, ptEnd);
+}
+
+int CInChipDotProcess::ExeInChip(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd) {
+	/* code */
+	if (m_nFrameWidth < 1 || m_nFrameHeight < 1) return 0;
+
+	int y1 = index * m_nFrameHeight;
+	int y2 = index * m_nFrameHeight + m_nFrameHeight - 1;
+	int x1 = ptStart.x - m_nLineWidth;
+	int x2 = ptEnd.x + m_nLineWidth;
+	if (ptStart.x > ptEnd.x) {
+		x1 = ptEnd.x - m_nLineWidth;
+		x2 = ptStart.x + m_nLineWidth;
+	}
+	x1 -= 30;
+	x2 += 30;
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2))  return 0;
+	int leftPos = x1;
+	int topPos = y1;
+
+	int width = 0; 
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	//HalconCpp::HWindow hDispWin(0, 0, width, height);
+	//hDispWin.SetPart(0, 0, height - 1, width - 1);
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hImage);
+
+	std::vector<Point2D> vEdgePoints;
+	int step = (int)(1.0 * (y2 - y1) / (m_nSampleNumber - 1));
+	for (int i = 0; i < m_nSampleNumber; i++) {
+		int yTarget = y1 + i * step;
+		if (0 == i) {
+			yTarget = y1 + 15;
+		}
+		else if (m_nSampleNumber - 1 == i) {
+			yTarget = y2 - 15;
+		}
+
+		Line2D line;
+		line.pt0.x = 30;
+		line.pt0.y = yTarget - topPos;
+		line.pt1.x = x2 - leftPos - 31;
+		line.pt1.y = yTarget - topPos;
+		Point2D ptStart, ptEnd;
+		if (!CVisionBufferPro::GetMeasurePos(hImage, line, m_threshold, m_nPointMode, 10, ptStart, ptEnd)) continue;
+		if (0 == i) {
+			ptStart.y = 0;
+			ptEnd.y = 0;
+		}
+		else if (m_nSampleNumber - 1 == i) {
+			ptStart.y = height - 1;
+			ptEnd.y = height - 1;
+		}
+
+		if (0 == m_nPointType) {
+			vEdgePoints.push_back(ptStart);
+		}
+		else {
+			vEdgePoints.push_back(ptEnd);
+		}
+	}
+
+	int num = (int)(vEdgePoints.size());
+	if (num < 0.5 * m_nSampleNumber) return 0;
+
+	//1. 获取点阵
+	std::vector<vec> vStartCtrlPoint;
+	for (int i = 0; i < num; i++) {
+		float x0 = (float)vEdgePoints[i].x;
+		float y0 = (float)vEdgePoints[i].y;
+		vec p0(x0, y0, 0);
+		vStartCtrlPoint.push_back(p0);
+	}
+
+	//2. 执行样条插值
+	CBspline bcurve(vStartCtrlPoint);
+	bcurve.execute();
+
+	int sz = (int)(bcurve.m_vPtResults.size());
+	if (sz < 1) return 0;
+	HalconCpp::HTuple hvY, hvX;
+	for (int i = 0; i < sz; i++) {
+		hvX[i] = bcurve.m_vPtResults[i][0] + m_nChipOffset;
+		hvY[i] = bcurve.m_vPtResults[i][1];
+	}
+	int idx = sz;
+	hvX[idx] = bcurve.m_vPtResults[sz - 1][0] + m_nChipOffset;
+	hvY[idx] = bcurve.m_vPtResults[sz - 1][1];
+	idx += 1;
+	hvX[idx] = bcurve.m_vPtResults[sz - 1][0] + m_nChipOffset + m_nChipRange;
+	hvY[idx] = bcurve.m_vPtResults[sz - 1][1];
+	idx += 1;
+	for (int i = sz - 1; i >= 0; i--) {
+		hvX[idx] = bcurve.m_vPtResults[i][0] + m_nChipOffset + m_nChipRange;
+		hvY[idx] = bcurve.m_vPtResults[i][1];
+		idx += 1;
+	}
+
+	HalconCpp::GenRegionPolygonFilled(&m_hRoiRegion, hvY, hvX);
+	//hDispWin.DispObj(m_hRoiRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HObject hProObject, hRegion, hConnectRegion;
+	HalconCpp::ReduceDomain(hImage, m_hRoiRegion, &hProObject);
+	HalconCpp::Threshold(hProObject, &hRegion, 0, 60);
+	HalconCpp::Connection(hRegion, &hConnectRegion);
+	//hDispWin.ClearWindow();
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hConnectRegion);
+	//hDispWin.Click();
+
+	return 0;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/InChipDotProcess.h b/BlVisionPro/Vision/InChipDotProcess.h
new file mode 100644
index 0000000..dcc1382
--- /dev/null
+++ b/BlVisionPro/Vision/InChipDotProcess.h
@@ -0,0 +1,38 @@
+#ifndef INCHIP_DOT_PROCESS_H
+#define INCHIP_DOT_PROCESS_H
+
+class CInChipDotProcess
+{
+public:
+	CInChipDotProcess();
+	CInChipDotProcess(DimensionDir eDir);
+	~CInChipDotProcess();
+
+public:
+	//1. 执行
+	int Execute(DimensionDir eDir,  int index, Point2I ptStart, Point2I ptEnd);
+
+public:
+	int m_nChipOffset;
+	int m_nChipRange;
+	
+	int m_nLineWidth;             //ROI的宽度
+	int m_nPointType;
+	int m_nPointMode;
+	int m_threshold;   //边界
+	int m_nSampleNumber;          //采样点数量
+	
+	HalconCpp::HObject m_hRoiRegion;
+
+private:
+	DimensionDir m_eDir;
+	int m_nFrameWidth;
+	int m_nFrameHeight;
+
+private:
+	//1. 执行检测
+	int ExeInChip(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd);
+
+};
+
+#endif
diff --git a/BlVisionPro/Vision/KDistProcess.cpp b/BlVisionPro/Vision/KDistProcess.cpp
new file mode 100644
index 0000000..dcc926e
--- /dev/null
+++ b/BlVisionPro/Vision/KDistProcess.cpp
@@ -0,0 +1,112 @@
+#include "stdafx.h"
+#include "KDistProcess.h"
+#include "BlSideData.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+#include "SoftVisionApp.h"
+
+CKDistProcess::CKDistProcess() {
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CKeyDistDotProcess(m_eDir, i + 1);
+	}
+	m_nRoiSize = 100;
+	m_isUse = false;
+
+	m_nStage = 0;
+}
+
+CKDistProcess::CKDistProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	m_isUse = false;
+	m_nRoiSize = 100;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CKeyDistDotProcess(m_eDir, i + 1);
+	}
+}
+
+CKDistProcess::~CKDistProcess() {
+	/* code */
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+void CKDistProcess::SetStage(int nStage) {
+	/* code */
+	m_nStage = nStage;
+}
+
+void CKDistProcess::Execute(DimensionDir eDir) {
+	/* code */
+	if (!m_isUse) return;
+
+	Point2I offset;
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse)  continue;
+
+		offset.x = i;
+		offset.y = i;
+
+		dot->m_nStage = m_nStage;
+		dot->setRoiSize(m_nRoiSize);
+		dot->Execute(m_eDir, offset);
+	}
+}
+
+Json::Value CKDistProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = KDIST_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["use"] = m_isUse;
+	jsValue["roi size"] = m_nRoiSize;
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CKDistProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) {
+		m_isUse = jsValue[strName.c_str()].asBool();
+	}
+
+	//3. roi size
+	strName = "roi size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nRoiSize = jsValue[strName.c_str()].asInt();
+	}
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/KDistProcess.h b/BlVisionPro/Vision/KDistProcess.h
new file mode 100644
index 0000000..23f1dcb
--- /dev/null
+++ b/BlVisionPro/Vision/KDistProcess.h
@@ -0,0 +1,36 @@
+#ifndef KDIST_PROCESS_H
+#define KDIST_PROCESS_H
+
+#include "KeyDistDotProcess.h"
+
+class CKDistProcess
+{
+public:
+	CKDistProcess();
+	CKDistProcess(DimensionDir eDir);
+	~CKDistProcess();
+
+public:
+	DimensionDir m_eDir;
+	bool m_isUse;   //是否启用
+	int m_nRoiSize;
+	CKeyDistDotProcess *m_dots[50];
+
+private:
+	int m_nStage;  //当前的平台
+
+
+public:
+	//1. 执行检测
+	void Execute(DimensionDir eDir);
+
+	//3. 保存文件 
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+	//3. 设置平台
+	void SetStage(int nStage);
+};
+
+#endif
+
diff --git a/BlVisionPro/Vision/KeyDistDotProcess.cpp b/BlVisionPro/Vision/KeyDistDotProcess.cpp
new file mode 100644
index 0000000..1ff43cf
--- /dev/null
+++ b/BlVisionPro/Vision/KeyDistDotProcess.cpp
@@ -0,0 +1,596 @@
+#include "stdafx.h"
+#include "KeyDistDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+#include "SoftVisionApp.h"
+
+CKeyDistDotProcess::CKeyDistDotProcess() {
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	m_id = 0;
+	m_nStdDist = 0;
+
+	m_nUse = 0;
+	m_strName.Format(_T("P%d"), m_id);
+
+	m_poseType = 0;
+	m_keyPoseX = 0;
+	m_keyPoseY = 0;
+	m_nPosX = 0;
+	m_nPosY = 0;
+	m_nEndThres = 0;
+//	m_nLineWidth = 200;
+
+	m_nInc = 0;
+	m_nInc1 = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_nRoiSize = 100;
+	m_distResult = 0.0f;
+	m_nStage = -1;
+}
+
+CKeyDistDotProcess::CKeyDistDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_eDir = eDir;
+	m_id = id;
+
+	m_nUse = 0;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_D%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_D%d"), m_id);
+		break;
+	}
+
+	m_poseType = 0;
+	m_keyPoseX = 0;
+	m_keyPoseY = 0;
+	m_nPosX = 0;
+	m_nPosY = 0;
+	m_nEndThres = 0;
+//	m_nLineWidth = 200;
+	m_nStdDist = 0;
+
+	m_nInc = 0;
+	m_nInc1 = -1;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_nRoiSize = 100;
+	m_distResult = 0.0f;
+	m_nStage = -1;
+}
+
+CKeyDistDotProcess::~CKeyDistDotProcess() {
+	/* code */
+}
+
+int CKeyDistDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	m_ptNearResult.x = 0.0f;
+	m_ptNearResult.y = 0.0f;
+	m_ptMeasureResult.x = 0.0f;
+	m_ptMeasureResult.y = 0.0f;
+	if (1 != m_nUse) return 0;
+	if (0 == m_keyPoseY && 0 == m_keyPoseX) return 0;
+	if (0 == m_nPosX  && 0 == m_nPosY) return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 查找结果
+	if (!findEndPoint(eDir)) return  -1;
+
+	//3. 结果判断
+	judgeResult();
+
+	return 0;
+}
+
+bool CKeyDistDotProcess::getImageROI(HalconCpp::HObject &hImage, Point2I &result) {
+	/* code */
+	// 定义两个vector,分别存储标准点和实际点的坐标
+	std::vector<Point2D> vStdPoint, vRealPoint;
+	// 计算标准点与实际点之间的距离
+	double dx = m_locPointResult.x - m_ptMeasureResult.x;
+	double dy = m_locPointResult.y - m_ptMeasureResult.y;
+	double dist = sqrt(dx * dx + dy * dy);
+
+	// 创建一个pose点,用于存储标准点
+	Point2D pose;
+	pose.x = m_nRoiSize + 10;    //尺寸大小 2 * m_nRoiSize + 20   // 110;
+	pose.y = 40;
+	vStdPoint.push_back(pose);
+	// 将标准点沿着距离移动
+	pose.x = m_nRoiSize + 10 + dist;//110.0 + dist;
+	vStdPoint.push_back(pose);
+
+	// 将实际点存入vRealPoint
+	pose.x = m_locPointResult.x;
+	pose.y = m_locPointResult.y;
+	vRealPoint.push_back(pose);
+	vRealPoint.push_back(m_ptMeasureResult);
+
+	// 将vStdPoint和vRealPoint转换为仿射矩阵
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint);
+
+	//4个点
+	// 设置x和y的值为0
+	pose.x = 0.0;
+	pose.y = 0.0;
+	// 将pose坐标转换为point坐标
+	Point2D point = ClsVision::CoordinateTransform(pose, affine);
+	// 将point坐标转换为整数
+	int x1 = (int)(point.x);
+	int y1 = (int)(point.y);
+	int x2 = (int)(point.x);
+	int y2 = (int)(point.y);
+
+	// 设置x和y的值为0
+	pose.x = 0.0;
+	pose.y = 79.0;
+	// 将pose坐标转换为point坐标
+	point = ClsVision::CoordinateTransform(pose, affine);
+	// 如果x1大于point.x,则将x1设置为point.x
+	if (x1 > point.x)  x1 = (int)(point.x);
+	// 如果y1大于point.y,则将y1设置为point.y
+	if (y1 > point.y)  y1 = (int)(point.y);
+	// 如果x2小于point.x,则将x2设置为point.x
+	if (x2 < point.x)  x2 = (int)(point.x);
+	// 如果y2小于point.y,则将y2设置为point.y
+	if (y2 < point.y)  y2 = (int)(point.y);
+
+	// 设置x和y的值为219.0
+	pose.x = 2 * (m_nRoiSize + 10) - 1;  //219.0;
+	pose.y = 79.0;
+	// 将pose坐标转换为point坐标
+	point = ClsVision::CoordinateTransform(pose, affine);
+	// 如果x1大于point.x,则将x1设置为point.x
+	if (x1 > point.x)  x1 = (int)(point.x);
+	// 如果y1大于point.y,则将y1设置为point.y
+	if (y1 > point.y)  y1 = (int)(point.y);
+	// 如果x2小于point.x,则将x2设置为point.x
+	if (x2 < point.x)  x2 = (int)(point.x);
+	// 如果y2小于point.y,则将y2设置为point.y
+	if (y2 < point.y)  y2 = (int)(point.y);
+
+	// 设置x和y的值为219.0
+	pose.x = 2 * (m_nRoiSize + 10) - 1;  //219.0;
+	pose.y = 0.0;
+	// 将pose坐标转换为point坐标
+	point = ClsVision::CoordinateTransform(pose, affine);
+	// 如果x1大于point.x,则将x1设置为point.x
+	if (x1 > point.x)  x1 = (int)(point.x);
+	// 如果y1大于point.y,则将y1设置为point.y
+	if (y1 > point.y)  y1 = (int)(point.y);
+	// 如果x2小于point.x,则将x2设置为point.x
+	if (x2 < point.x)  x2 = (int)(point.x);
+	// 如果y2小于point.y,则将y2设置为point.y
+	if (y2 < point.y)  y2 = (int)(point.y);
+
+	// 计算宽度
+	int dWidth = x2 - x1 + 1;
+	// 如果宽度小于220,则将x1和x2设置为110的偏移量
+	if (dWidth <= 2 * (m_nRoiSize + 10)) {
+		x1 = m_locPointResult.x - (m_nRoiSize + 10);
+		x2 = m_locPointResult.x + (m_nRoiSize + 10);
+	}
+	// 否则,计算x1和x2的偏移量,并将它们设置为x1和x2的中间值
+	else {
+		int dd = (int)((dWidth + 2) / 2);
+		x1 = m_locPointResult.x - dd;
+		x2 = m_locPointResult.x + dd;
+	}
+	// 计算高度
+	int dHeight = y2 - y1 + 1;
+	// 如果高度小于80,则将y1和y2设置为40的偏移量
+	if (dHeight <= 80) {
+		y1 = m_locPointResult.y - 40;
+		y2 = m_locPointResult.y + 40;
+	}
+	// 否则,计算y1和y2的偏移量,并将它们设置为y1和y2的中间值
+	else {
+		int dd = (int)((dHeight + 2) / 2);
+		y1 = m_locPointResult.y - dd;
+		y2 = m_locPointResult.y + dd;
+	}
+
+	HalconCpp::HObject hTmpObject;
+	// 如果获取ROI失败,则返回false
+	if (!CVisionBufferPro::getImageROI(m_eDir, hTmpObject, x1, y1, x2, y2)) return false;
+	// 将结果的x和y设置为x1和y1
+	result.x = x1;
+	result.y = y1;
+
+	// 获取图像大小
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hTmpObject, width, height);
+	if (width < 1 || height < 1) return false;
+
+	// 清除之前记录的点
+	vStdPoint.clear();
+	// 将点转换为标准坐标系
+	pose.x = 0.5 * (width - 1);
+	pose.y = 0.5 * (height - 1);
+	vStdPoint.push_back(pose);
+	// 将点转换为实际坐标系
+	pose.x += (m_ptMeasureResult.x - m_locPointResult.x);
+	pose.y += (m_ptMeasureResult.y - m_locPointResult.y);
+	vStdPoint.push_back(pose);
+
+	// 将点转换为实际坐标系
+	vRealPoint.clear();
+	pose.x = m_nRoiSize + 10;   //110;
+	pose.y = 40;
+	vRealPoint.push_back(pose);
+	pose.x = m_nRoiSize + 10 + dist;// 110.0 + dist;
+	vRealPoint.push_back(pose);
+
+	// 将标准点和实际点转换为相似度
+	affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint);
+	// 对图像进行仿射变换
+	ClsVision::AffineTransImage(hTmpObject, affine, hImage);
+
+	return true;
+}
+
+bool CKeyDistDotProcess::findEndPoint(DimensionDir eDir) {
+	/* code */
+	//获取指定方向的侧边数据
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	//如果侧边数据为空,则返回false
+	if (nullptr == pSideData)  return false;
+
+	if (0 == m_poseType) {
+		//如果侧边数据中没有找到上点,则返回false
+		if (!pSideData->m_bBotMark_Find)  return false;
+		//如果侧边数据中没有找到下点,则返回false
+		if (!pSideData->m_bTopMark_Find)  return false;
+	}
+	else {
+		//如果侧边数据中没有找到上点,则返回false
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		//如果侧边数据中没有找到下点,则返回false
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	//1. 首先计算Key的位置
+	Point2I ptOffset;
+	ptOffset.x = m_keyPoseX;
+	ptOffset.y = m_keyPoseY;
+	Point2I result;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result))  return false;
+
+	m_ptMeasureResult.x = result.x;
+	m_ptMeasureResult.y = result.y;
+
+	ptOffset.x = m_nPosX;
+	ptOffset.y = m_nPosY;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result))  return false;
+	m_locPointResult = result;
+
+	HalconCpp::HObject hImage;
+	Point2I leftTop;
+	if (!getImageROI(hImage, leftTop)) return false;
+
+	// 定义HObject类型的变量
+	HalconCpp::HObject hMeanObject, hRoiRegion, hTmpObj, hProcObject;
+	// 使用MeanImage函数计算图像的平均值,并将结果存储在hMeanObject中
+	HalconCpp::MeanImage(hImage, &hMeanObject, 1, 15);
+	// 定义一个矩形区域,左上角坐标为(10, 10),右下角坐标为(69, 219)
+	HalconCpp::GenRectangle1(&hRoiRegion, 10, 10, 69, 2 * (m_nRoiSize + 10)- 1 /* 219 */ );
+	// 使用ReduceDomain函数将hMeanObject的值减去hRoiRegion的值,并将结果存储在hTmpObj中
+	HalconCpp::ReduceDomain(hMeanObject, hRoiRegion, &hTmpObj);
+	// 使用CropDomain函数裁剪hTmpObj,并将结果存储在hProcObject中
+	HalconCpp::CropDomain(hTmpObj, &hProcObject);
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hProcObject, width, height);
+	if (width < 1 || height < 1) return false;
+
+	Line2D line;
+	line.pt0.x = 5;
+	line.pt0.y = 0.5 * height - 1;
+	line.pt1.x = width - 6;
+	line.pt1.y = 0.5 * height - 1;
+	int nThreshold = 10;
+	if (m_nEndThres > 3) nThreshold = m_nEndThres;
+	Point2D ptStart, ptEnd;
+	if (!CVisionBufferPro::GetMeasureNearPos(hProcObject, line, nThreshold, 0, 10, ptStart, ptEnd)) return false;
+
+	Point2D posLeftPoint;
+	posLeftPoint.x = ptStart.x + 10;
+	posLeftPoint.y = 0.5 * (height - 1) + 10;
+	
+
+	std::vector<Point2D> vStdPoint, vRealPoint;
+	// 计算标准点与实际点之间的距离
+	double dx = m_locPointResult.x - m_ptMeasureResult.x;
+	double dy = m_locPointResult.y - m_ptMeasureResult.y;
+	double dist = sqrt(dx * dx + dy * dy);
+
+	// 创建一个pose点,用于存储标准点
+	Point2D pose;
+	pose.x = 10 + m_nRoiSize; // 110;
+	pose.y = 40;
+	vStdPoint.push_back(pose);
+	// 将标准点沿着距离移动
+	pose.x = 10 + m_nRoiSize + dist; // 110.0 + dist;
+	vStdPoint.push_back(pose);
+
+	// 将实际点存入vRealPoint
+	pose.x = m_locPointResult.x;
+	pose.y = m_locPointResult.y;
+	vRealPoint.push_back(pose);
+	vRealPoint.push_back(m_ptMeasureResult);
+
+	// 将vStdPoint和vRealPoint转换为仿射矩阵
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint);
+	m_ptNearResult = ClsVision::CoordinateTransform(posLeftPoint, affine);
+
+	if (m_nEndThres > 3) {
+		Point2D posEndPoint;
+        posEndPoint.x = ptEnd.x + 10;
+        posEndPoint.y = 0.5 * (height - 1) + 10;
+		m_ptMeasureResult = ClsVision::CoordinateTransform(posEndPoint, affine);
+	}
+
+	//
+	return true;
+}
+
+int CKeyDistDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+void CKeyDistDotProcess::setRoiSize(int sz) {
+	/* code */
+    m_nRoiSize = sz;
+}
+
+void CKeyDistDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+void CKeyDistDotProcess::judgeResult(void) {
+	/* code */
+	m_nNgInfo.clear();
+	if (fabs(m_ptMeasureResult.x) < 0.1 && fabs(m_ptMeasureResult.y) < 0.1f) return;
+
+	//创建缺陷dot信息
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_nMin;
+	ng.maxValue = m_nMax;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_KDIST; 
+
+	//计算缺陷位置
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+
+	//计算缺陷类型
+	ng.ngType = DefectLoc_Corner_Dist;
+	double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x);
+	double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y);
+	m_distResult = sqrt(dx * dx + dy * dy);
+
+	//输出显示数据
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {  //区域的显示结果
+		DispVisionResult inf;
+		inf.nType = 3;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_KDIST);
+		inf.rectX1 = (int)(m_ptMeasureResult.x);
+		inf.rectY1 = (int)(m_ptMeasureResult.y);
+		inf.rectX2 = (int)(m_ptNearResult.x);
+		inf.rectY2 = (int)(m_ptNearResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 0;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_KDIST);
+		inf.pointX = (int)(m_ptNearResult.x);
+		inf.pointY = (int)(m_ptNearResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 4;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_KDIST);
+		inf.pointX = (int)(m_ptNearResult.x);
+		inf.pointY = (int)(m_ptNearResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	//计算缺陷距离
+	if (1 == m_nStage) {
+		m_distResult += m_nInc1;
+	}
+	else {
+		m_distResult += m_nInc;
+	}
+	ng.result = m_distResult;
+
+	//判断缺陷是否符合标准
+	if (m_nMax < 0.5) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	double dDist = m_distResult - m_nStdDist;
+	if (dDist < m_nMin || dDist > m_nMax) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+Json::Value CKeyDistDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+
+	Json::Value jsValue;
+	jsValue["alg type"] = KDIST_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["use"] = m_nUse;
+	jsValue["pos type"] = m_poseType;
+	jsValue["key pos x"] = m_keyPoseX;
+	jsValue["key pos y"] = m_keyPoseY;
+	jsValue["pos x"] = m_nPosX;
+	jsValue["pos y"] = m_nPosY;
+	jsValue["inc"] = m_nInc;
+	jsValue["inc1"] = m_nInc1;
+	jsValue["min"] = m_nMin;
+	jsValue["max"] = m_nMax;
+	jsValue["end thres"] = m_nEndThres;
+	jsValue["std dist"] = m_nStdDist;
+
+	return jsValue;
+}
+
+void CKeyDistDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. pos type
+	strName = "pos type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_poseType = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. key pos x
+	strName = "key pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_keyPoseX = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. key pos y
+	strName = "key pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_keyPoseY = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosX = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosY = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. inc
+	strName = "inc";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nInc = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. inc
+	strName = "inc1";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nInc1 = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. min
+	strName = "min";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMin = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. max
+	strName = "max";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMax = jsValue[strName.c_str()].asInt();
+	}
+
+	//14. end thres
+	strName = "end thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEndThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//15. std dist
+	strName = "std dist";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nStdDist = jsValue[strName.c_str()].asInt();
+	}
+}
diff --git a/BlVisionPro/Vision/KeyDistDotProcess.h b/BlVisionPro/Vision/KeyDistDotProcess.h
new file mode 100644
index 0000000..276f6be
--- /dev/null
+++ b/BlVisionPro/Vision/KeyDistDotProcess.h
@@ -0,0 +1,70 @@
+#ifndef KEY_DIST_DOT_PROCESS_H
+#define KEY_DIST_DOT_PROCESS_H
+
+class CKeyDistDotProcess
+{
+public:
+	CKeyDistDotProcess();
+	CKeyDistDotProcess(DimensionDir eDir, int id);
+	~CKeyDistDotProcess();
+
+public:
+	//1. 执行
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//2. 获取ID
+	int getID(void);
+	void setRoiSize(int sz);
+
+	//3. 保存数据
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	int m_nUse;
+	CString m_strName;
+	
+	int m_poseType;
+	int m_keyPoseX;
+	int m_keyPoseY;
+	int m_nPosX;
+	int m_nPosY;
+	int m_nEndThres;
+	int m_nStdDist;
+	int m_nInc;
+	int m_nMin;
+	int m_nMax;
+	int m_nInc1;
+
+	Point2D m_ptMeasureResult;
+	Point2D m_ptNearResult;
+	Point2I m_locPointResult;
+	double m_distResult;
+
+	std::vector<NgDotInfo> m_nNgInfo;
+	int m_nStage;
+
+private:
+	DimensionDir m_eDir;
+	int m_id;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+	int m_nRoiSize;
+
+private:
+	//1. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+
+	//2. 查找结果
+	bool findEndPoint(DimensionDir eDir);
+
+	//3. 判断结果
+	void judgeResult(void);
+
+	//4. 截图ROI图
+	bool getImageROI(HalconCpp::HObject &hImage, Point2I &result);
+};
+
+#endif
+
diff --git a/BlVisionPro/Vision/LocProcess.cpp b/BlVisionPro/Vision/LocProcess.cpp
new file mode 100644
index 0000000..843e029
--- /dev/null
+++ b/BlVisionPro/Vision/LocProcess.cpp
@@ -0,0 +1,366 @@
+#include "stdafx.h"
+#include "LocProcess.h"
+#include "VisionRecipe.h"
+#include "BlSideData.h"
+#include "FileRecipe.h"
+
+CLocProcess::CLocProcess(){
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		m_dot[i] = NULL;
+	}
+
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+	m_botPoint.x = 0;
+    m_botPoint.y = 0;
+	m_topPoint.x = 0;
+    m_topPoint.y = 0;
+}
+
+CLocProcess::CLocProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	for (int i = 0; i < 2; i++) {
+		CNccDotProcess *dot = new CNccDotProcess(m_eDir, i);
+		m_dot[i] = dot;
+	}
+
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+	m_botPoint.x = 0;
+	m_botPoint.y = 0;
+	m_topPoint.x = 0;
+	m_topPoint.y = 0;
+}
+
+CLocProcess::~CLocProcess(){
+	/* code */
+	Release();
+}
+
+void CLocProcess::Release(void) {
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		CNccDotProcess *dot = m_dot[i];
+		if (NULL == dot) continue;
+		delete dot;
+		dot = NULL;
+		m_dot[i] = NULL;
+	}
+}
+
+void CLocProcess::Init(void) {
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		CNccDotProcess *dot = new CNccDotProcess(m_eDir, i);
+		m_dot[i] = dot;
+	}
+
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+}
+
+CNccDotProcess* CLocProcess::getDot(int index) {
+	/* code */
+	if (index < 0 || index > 1) return NULL;
+
+	CNccDotProcess *dot = m_dot[index];
+	return dot;
+}
+
+void CLocProcess::setPose(Point2I pose, int nType) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	double dMmvspX = pSideData->m_dPixelSizeX;   //X方向的像素大小
+	double dMmvspY = pSideData->m_dPixelSizeY;   //Y方向的像素大小
+
+	Point2I point;
+	point.x = (int)(pose.x * dMmvspX);
+    point.y = (int)(pose.y * dMmvspY);
+	if (0 == nType) {
+		m_topMark = point;
+        pSideData->m_mTopBzMark = point;
+	}
+	else if (1 == nType){
+		m_botMark = point;
+		pSideData->m_mBotBzMark = point;
+	}
+	else if (2 == nType) {
+		m_topPoint = point;
+		pSideData->m_mTopBzPoint = point;
+	}
+	else if (3 == nType) {
+        m_botPoint = point;
+        pSideData->m_mBotBzPoint = point;
+	}
+}
+
+Point2I CLocProcess::getPose(int nType) {
+	/* code */
+	if (0 == nType) {
+		return m_topMark;
+	}
+	else if (1 == nType) {
+		return m_botMark;
+	}
+	else if (2 == nType) {
+        return m_topPoint;
+	}
+	else if (3 == nType) {
+        return m_botPoint;
+	}
+
+	return m_topMark;
+}
+
+int CLocProcess::execute(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return 0;
+
+	pSideData->m_bTopPoint_Find = FALSE;
+	pSideData->m_bBotPoint_Find = FALSE;
+//	Point2I offset, pose;
+	Point2I offset;
+	for (int i = 0; i < 2; i++) {
+		CNccDotProcess *dot = m_dot[i];
+		if (NULL == dot) continue;
+
+		SetPos(dot);
+//		pose = dot->getPose();
+//		offset = getOffset(pose);
+		offset.x = 0;
+        offset.y = 0;
+
+		dot->execute(eDir, offset);
+
+		SetResult(dot);
+	}
+	return 0;
+}
+
+void CLocProcess::SetPos(CNccDotProcess* dot) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return;
+    if (NULL == dot) return;
+
+	Point2I pose = GetPos(dot);
+	if (0 == pose.x && 0 == pose.y) return;
+
+	double dx = pose.x - m_topMark.x;
+	double dy = pose.y - m_topMark.y;
+	double dist0 = sqrt(dx * dx + dy * dy);
+	dx = pose.x - m_botMark.x;
+    dy = pose.y - m_botMark.y;
+    double dist1 = sqrt(dx * dx + dy * dy);
+
+	double dMmvspX = pSideData->m_dPixelSizeX;   //X方向的像素大小
+	double dMmvspY = pSideData->m_dPixelSizeY;   //Y方向的像素大小
+
+	if (dist0 < dist1) {
+		if (!pSideData->m_bTopMark_Find)  return;
+
+		Point2I topMark = pSideData->m_mTopMark;
+
+		Point2D offset;
+		offset.x = dMmvspX * topMark.x - m_topMark.x;
+		offset.y = dMmvspY * topMark.y - m_topMark.y;
+
+		Point2I locPose;
+		locPose.x = (int)((pose.x + offset.x) / dMmvspX);
+        locPose.y = (int)((pose.y + offset.y) / dMmvspY);
+		dot->setPose(locPose);
+	}
+	else {
+		if (!pSideData->m_bBotMark_Find) return;
+		Point2I botMark = pSideData->m_mBotMark;
+
+        Point2D offset;
+		offset.x = dMmvspX * botMark.x - m_botMark.x;
+        offset.y = dMmvspY * botMark.y - m_botMark.y;
+
+		Point2I locPose;
+		locPose.x = (int)((pose.x + offset.x) / dMmvspX);
+		locPose.y = (int)((pose.y + offset.y) / dMmvspY);
+		dot->setPose(locPose);
+	}
+}
+
+Point2I CLocProcess::GetPos(CNccDotProcess* dot) {
+	/* code */
+	Point2I pose;
+	pose.x = 0;
+    pose.y = 0;
+	if (0 == dot->getID()) {
+		pose = m_topPoint;
+	}
+	else {
+		pose = m_botPoint;
+	}
+
+	return pose;
+}
+
+void CLocProcess::SetResult(CNccDotProcess *dot) {
+	/* code */
+	if (NULL == m_dot) return;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return;
+
+	int id = dot->getID();
+	if (0 == id) {
+		if (fabs(dot->m_ptResult.x) < 0.01 && fabs(dot->m_ptResult.y) < 0.01) return;
+
+		pSideData->m_bTopPoint_Find = TRUE;
+		pSideData->m_mTopPoint.x = (int)(dot->m_ptResult.x);
+		pSideData->m_mTopPoint.y = (int)(dot->m_ptResult.y);
+	}
+	else if (1 == id) {
+		if (fabs(dot->m_ptResult.x) < 0.01 && fabs(dot->m_ptResult.y) < 0.01) return;
+
+		pSideData->m_bBotPoint_Find = TRUE;
+		pSideData->m_mBotPoint.x = (int)(dot->m_ptResult.x);
+		pSideData->m_mBotPoint.y = (int)(dot->m_ptResult.y);
+	}
+}
+
+Point2I CLocProcess::getOffset(Point2I pose) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return result;
+	if (0 == pose.x && 0 == pose.y) return result;
+
+	double dx = pose.x - m_topMark.x;
+	double dy = pose.y - m_topMark.y;
+	double dist0 = sqrt(dx * dx + dy * dy);
+	dx = pose.x - m_botMark.x;
+	dy = pose.y - m_botMark.y;
+	double dist1 = sqrt(dx * dx + dy * dy);
+
+	if (dist0 < dist1) {
+		if (pSideData->m_bTopMark_Find) {
+			result.x = pSideData->m_mTopMark.x - m_topMark.x;
+			result.y = pSideData->m_mTopMark.y - m_topMark.y;
+		}
+		else if (pSideData->m_bBotMark_Find) {
+			result.x = pSideData->m_mBotMark.x - m_botMark.x;
+			result.y = pSideData->m_mBotMark.y - m_botMark.y;
+		}
+	}
+	else {
+		if (pSideData->m_bBotMark_Find) {
+			result.x = pSideData->m_mBotMark.x - m_botMark.x;
+			result.y = pSideData->m_mBotMark.y - m_botMark.y;
+		}
+		else if(pSideData->m_bTopMark_Find) {
+			result.x = pSideData->m_mTopMark.x - m_topMark.x;
+			result.y = pSideData->m_mTopMark.y - m_topMark.y;
+		}
+	}
+
+	return result;
+}
+
+Json::Value CLocProcess::WriteToJson(std::string &strDir) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = LOC_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["TopMark X"] = m_topMark.x;
+	jsValue["TopMark Y"] = m_topMark.y;
+	jsValue["BotMark X"] = m_botMark.x;
+	jsValue["BotMark Y"] = m_botMark.y;
+	jsValue["TopPoint X"] = m_topPoint.x;
+    jsValue["TopPoint Y"] = m_topPoint.y;
+    jsValue["BotPoint X"] = m_botPoint.x;
+	jsValue["BotPoint Y"] = m_botPoint.y;
+
+
+	for (int i = 0; i < 2; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dot[i]->WriteToJson(strDir);
+	}
+	return jsValue;
+}
+
+int CLocProcess::DecodeJson(std::string &strDir, Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return -1;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return -1;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. TopMark X,//3. TopMark Y
+	strName = "TopMark X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_topMark.x = jsValue[strName.c_str()].asInt();
+		pSideData->m_mTopBzMark.x = m_topMark.x;
+	}
+	strName = "TopMark Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_topMark.y = jsValue[strName.c_str()].asInt();
+		pSideData->m_mTopBzMark.y = m_topMark.y;
+	}
+	strName = "BotMark X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_botMark.x = jsValue[strName.c_str()].asInt();
+		pSideData->m_mBotBzMark.x = m_botMark.x;
+	}
+	strName = "BotMark Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_botMark.y = jsValue[strName.c_str()].asInt();
+		pSideData->m_mBotBzMark.y = m_botMark.y;
+	}
+
+	strName = "TopPoint X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_topPoint.x = jsValue[strName.c_str()].asInt();
+		pSideData->m_mTopBzPoint.x = m_topPoint.x;
+	}
+	strName = "TopPoint Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_topPoint.y = jsValue[strName.c_str()].asInt();
+        pSideData->m_mTopBzPoint.y = m_topPoint.y;
+	}
+	strName = "BotPoint X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_botPoint.x = jsValue[strName.c_str()].asInt();
+        pSideData->m_mBotBzPoint.x = m_botPoint.x;
+	}
+	strName = "BotPoint Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_botPoint.y = jsValue[strName.c_str()].asInt();
+        pSideData->m_mBotBzPoint.y = m_botPoint.y;
+	}
+
+	for (int i = 0; i < 2; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dot[i]->DecodeJson(strDir, jsData);
+		}
+	}
+
+	return 0;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/LocProcess.h b/BlVisionPro/Vision/LocProcess.h
new file mode 100644
index 0000000..205eff9
--- /dev/null
+++ b/BlVisionPro/Vision/LocProcess.h
@@ -0,0 +1,61 @@
+#ifndef LOC_PROCESS_H
+#define LOC_PROCESS_H
+
+#include "NccDotProcess.h"
+
+class CLocProcess
+{
+public:
+	CLocProcess();
+	CLocProcess(DimensionDir eDir);
+	~CLocProcess();
+
+public:
+	//1. 初始化
+	void Init(void);
+
+	//2. 获取数据
+	CNccDotProcess* getDot(int index);
+
+	//3. 设置数据 
+	void setPose(Point2I pose, int nType);
+	Point2I getPose(int nType);
+
+	//4. 执行
+	int execute(DimensionDir eDir);
+
+	//5. 写入文件
+	Json::Value WriteToJson(std::string &strDir);
+	int DecodeJson(std::string &strDir, Json::Value &jsValue);
+
+public:
+	DimensionDir m_eDir;
+
+private:
+	Point2I m_topMark;   //Top Mark
+	Point2I m_botMark;   //Bot Mark
+	Point2I m_topPoint;  //Top Point
+	Point2I m_botPoint;  //Bot Point
+
+private:
+	CNccDotProcess *m_dot[2];
+
+private:
+	//1. 释放
+	void Release(void);
+
+	//2. 获取偏移
+	Point2I getOffset(Point2I pose);
+
+	//3. 设置结果
+	void SetResult(CNccDotProcess *dot);
+
+	//4. 获取位置
+	Point2I GetPos(CNccDotProcess *dot);
+
+	//5. 设置位置
+	void SetPos(CNccDotProcess* dot);
+
+};
+
+#endif
diff --git a/BlVisionPro/Vision/NccDotProcess.cpp b/BlVisionPro/Vision/NccDotProcess.cpp
new file mode 100644
index 0000000..bb26583
--- /dev/null
+++ b/BlVisionPro/Vision/NccDotProcess.cpp
@@ -0,0 +1,343 @@
+#include "stdafx.h"
+#include "NccDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+
+CNccDotProcess::CNccDotProcess(){
+	/* code */
+	m_id = 0;
+	m_pos.x = 0;
+	m_pos.y = 0;
+	m_strName = _T("P0");
+	HalconCpp::GenEmptyObj(&m_hImage);
+	m_idModel = -1;
+	m_eDir = DIMENSION_NONE;
+	m_score = 0.5f;
+
+	m_ptResult.x = 0.0f;
+	m_ptResult.y = 0.0f;
+
+	m_xScale = 1.0f;
+	m_yScale = 1.0f;
+	m_isScale = false;
+
+	m_idModel = HalconCpp::HTuple();
+}
+
+CNccDotProcess::~CNccDotProcess(){
+	/* code */
+	if (!ClsVision::TupleNil(m_idModel)) {
+		ClsVision::ClearNccModel(m_idModel);
+		m_idModel = HalconCpp::HTuple();
+	}
+}
+
+CNccDotProcess::CNccDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_id = id;
+	m_eDir = eDir;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P%d"), m_id);
+		break;
+	}
+
+	m_pos.x = 0;
+	m_pos.y = 0;
+	HalconCpp::GenEmptyObj(&m_hImage);
+	m_idModel = HalconCpp::HTuple();
+	m_score = 0.5f;
+	m_ptResult.x = 0.0f;
+	m_ptResult.y = 0.0f;
+	m_xScale = 1.0f;
+	m_yScale = 1.0f;
+	m_isScale = false;
+}
+
+int CNccDotProcess::execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_ptResult.x = 0.0f;
+	m_ptResult.y = 0.0f;
+	if (ClsVision::TupleNil(m_idModel)) {
+		CreateMatchModel();
+	}
+	if (ClsVision::TupleNil(m_idModel)) return -1;
+
+	findTargetPoint(eDir, offset);
+
+	return 0;
+}
+
+void CNccDotProcess::findTargetPoint(DimensionDir eDir, Point2I offset) {
+	/* code */
+	if (ClsVision::TupleNil(m_idModel)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+	int x1 = (int)(m_pos.x - 0.5 * width - 200);
+	int y1 = (int)(m_pos.y - 0.5 * height - 200);
+	int x2 = (int)(m_pos.x + 0.5 * width + 200);
+	int y2 = (int)(m_pos.y + 0.5 * height + 200);
+	x1 += offset.x;
+	y1 += offset.y;
+	x2 += offset.x;
+	y2 += offset.y;
+
+	HalconCpp::HObject hSearchImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hSearchImage, x1, y1, x2, y2)) return;
+
+	std::vector<ParaMatch> vResult;
+	if (m_isScale) {
+		HalconCpp::HObject hZoomImage;
+		HalconCpp::ZoomImageFactor(hSearchImage, &hZoomImage, m_xScale, m_yScale, "constant");
+		ClsVision::FindNccModel(hZoomImage, m_idModel, m_score, 1, vResult);
+		int sz = (int)(vResult.size());
+		for (int i = 0; i < sz; i++) {
+			vResult[i].pt.x = vResult[i].pt.x / m_xScale;
+			vResult[i].pt.y = vResult[i].pt.y / m_yScale;
+		}
+	}
+	else {
+		ClsVision::FindNccModel(hSearchImage, m_idModel, m_score, 1, vResult);
+	}
+	int nCount = (int)(vResult.size());
+	if (nCount < 1) return;
+
+	m_ptResult = vResult[0].pt;
+
+	m_ptResult.x += x1;
+	m_ptResult.y += y1;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {  //区域的显示结果
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_LOC);
+		inf.rectX1 = (int)(m_ptResult.x - 0.5 * width - 1);
+		inf.rectY1 = (int)(m_ptResult.y - 0.5 * height - 1);
+		inf.rectX2 = (int)(m_ptResult.x + 0.5 * width + 1);
+		inf.rectY2 = (int)(m_ptResult.y + 0.5 * height + 1);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+
+	//if (nullptr != pSideData) {   //输出点的显示结果
+	//	DispVisionResult inf;
+	//	inf.nType = 0;
+	//	inf.eDir = (int)(m_eDir);
+	//	inf.eVision = (int)(VISION_LOC);
+	//	inf.pointX = (int)(m_ptResult.x);
+	//	inf.pointY = (int)(m_ptResult.y);
+	//	pSideData->m_vDispVisionResult.push_back(inf);
+	//}
+
+	KeyDebugInfo inf = CVisionRecipe::getInstance()->getKeyInfo();
+	if (inf.isDebugTool && inf.isLocKey) {
+		Log_GetDebug()->TraceInfo("Trace Ncc Result %d: %d, (%.0f,%.0f), %d",
+			(int)m_eDir, m_id, m_ptResult.x, m_ptResult.y, __LINE__);
+	}
+}
+
+void CNccDotProcess::CreateMatchModel(void) {
+	/* code */
+	if (!ClsVision::TupleNil(m_idModel)) {
+		ClsVision::ClearNccModel(m_idModel);
+		m_idModel = HalconCpp::HTuple();
+	}
+	if (!ClsVision::ObjectExist(m_hImage)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	m_isScale = false;
+	if (width > 120 || height > 120) {
+		m_isScale = true;
+		m_xScale = 1.0f;
+		m_yScale = 1.0f;
+		if (width > 120) {
+			m_xScale = 120.0f / width;
+		}
+		if (height > 120) {
+			m_yScale = 120.0f / height;
+		}
+		HalconCpp::HObject hZoomImage;
+		HalconCpp::ZoomImageFactor(m_hImage, &hZoomImage, m_xScale, m_yScale, "constant");
+		m_idModel = ClsVision::CreateNccModel(hZoomImage, -15, 15, 0, 2000);
+	}
+	else {
+		m_xScale = 1.0f;
+		m_yScale = 1.0f;
+		m_idModel = ClsVision::CreateNccModel(m_hImage, -15, 15, 0, 2000);
+	}
+}
+
+void CNccDotProcess::setPose(Point2I pose) {
+	/* code */
+	m_pos = pose;
+}
+
+Point2I CNccDotProcess::getPose(void) {
+	/* code */
+	return m_pos;
+}
+
+void CNccDotProcess::setImage(HalconCpp::HObject &hImage) {
+	/* code */
+	m_hImage = hImage;
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) {
+		m_pos.x = 0;
+		m_pos.y = 0;
+		if (!ClsVision::TupleNil(m_idModel)) {
+			ClsVision::ClearNccModel(m_idModel);
+			m_idModel = HalconCpp::HTuple();
+		}
+	}
+	else {
+		CreateMatchModel();
+	}
+}
+
+HalconCpp::HObject& CNccDotProcess::getImage(void) {
+	/* code */
+	return m_hImage;
+}
+
+int CNccDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+Json::Value CNccDotProcess::WriteToJson(std::string &strDir) {
+	/* code */
+	int iValue = 0;
+	if (ClsVision::ObjectExist(m_hImage)) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_hImage, width, height);
+		if (width > 0 && height > 0) {
+			iValue = 1;
+		}
+	}
+	std::string strImage = "NULL";
+	if (1 == iValue) {
+		strImage = ClsVision::FormatString("%d_%d_loc", m_eDir, m_id);
+	}
+
+	std::string strName = CFileRecipe::toString(m_strName);
+	Json::Value jsValue;
+	jsValue["alg type"] = LOC_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["score"] = m_score;
+	jsValue["pos x"] = m_pos.x;
+	jsValue["pos y"] = m_pos.y;
+	jsValue["image file"] = strImage;
+
+	std::string imageDir = strDir + "Image\\";
+	if (!CFileRecipe::fileIsExist(imageDir)) {
+		CFileRecipe::makeDir(imageDir);
+	}
+	if (0 == iValue) return jsValue;
+
+	std::string fileName = imageDir + strImage + ".jpg";
+	HalconCpp::WriteImage(m_hImage, "jpeg", 0, fileName.c_str());
+	return jsValue;
+}
+
+void CNccDotProcess::DecodeJson(std::string &strDir, Json::Value &jsValue) {
+	/* code */
+	if (strDir.empty()) return;
+
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id =jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. score
+	strName = "score";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+		m_score = jsValue[strName.c_str()].asDouble();
+	}
+
+	//5. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_pos.x = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_pos.y = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. image file
+	strName = "image file";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		std::string imgFile = jsValue[strName.c_str()].asString();
+		if (0 != imgFile.compare("NULL")) {
+			std::string fileName = strDir + "Image\\" + imgFile + ".jpg";
+			if (CFileRecipe::fileIsExist(fileName)) {
+				HalconCpp::ReadImage(&m_hImage, fileName.c_str());
+				CreateMatchModel();
+			}
+		}
+		else {
+			HalconCpp::GenEmptyObj(&m_hImage);
+			CreateMatchModel();
+		}
+	}
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/NccDotProcess.h b/BlVisionPro/Vision/NccDotProcess.h
new file mode 100644
index 0000000..628ce24
--- /dev/null
+++ b/BlVisionPro/Vision/NccDotProcess.h
@@ -0,0 +1,58 @@
+#ifndef NCC_DOT_PROCESS_H
+#define NCC_DOT_PROCESS_H
+
+class CNccDotProcess
+{
+public:
+	CNccDotProcess();
+	CNccDotProcess(DimensionDir eDir, int id);
+	~CNccDotProcess();
+
+public:
+	//1. 执行
+	int execute(DimensionDir eDir, Point2I offset);
+
+	//2. 设置位置
+	void setPose(Point2I pose);
+	Point2I getPose(void);
+
+	//3. 设置图像
+	void setImage(HalconCpp::HObject &hImage);
+	HalconCpp::HObject& getImage(void);
+
+	//4. 获取ID
+	int getID(void);
+
+	//5. 保存数据
+	Json::Value WriteToJson(std::string &strDir);
+	void DecodeJson(std::string &strDir, Json::Value &jsValue);
+
+
+public:
+	DimensionDir m_eDir;
+	double m_score;
+	CString m_strName;
+
+	Point2D m_ptResult;
+	
+
+private:
+	Point2I m_pos;
+	HalconCpp::HTuple m_idModel;
+	int m_id;
+	HalconCpp::HObject m_hImage;
+
+	double m_xScale;   //x轴缩放比例
+	double m_yScale;   //y轴缩放比例
+	bool m_isScale;   //是否缩放
+
+private:
+	//1. 创建模板
+	void CreateMatchModel(void);
+
+	//2. 查找位置
+	void findTargetPoint(DimensionDir eDir, Point2I offset);
+
+
+};
+#endif
diff --git a/BlVisionPro/Vision/RcutDotProcess.cpp b/BlVisionPro/Vision/RcutDotProcess.cpp
new file mode 100644
index 0000000..3a9ea19
--- /dev/null
+++ b/BlVisionPro/Vision/RcutDotProcess.cpp
@@ -0,0 +1,2118 @@
+#include "stdafx.h"
+#include "RcutDotProcess.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+#include "Bspline.h"
+#include "SoftVisionApp.h"
+
+#define RCUT_DEBUG_CODE  0
+
+CRcutDotProcess::CRcutDotProcess(){
+	/* code */
+	m_id = 0;
+	m_strName.Format(_T("Point%d"), m_id);
+	m_nPoseX = 0;
+	m_nPoseY = 0;
+	m_width = 0;
+	m_height = 0;
+
+	m_nUse = 0;
+	m_nChamferSize = 25;
+	m_nChipRange = 30;
+	m_nChipThres = 50;
+
+	m_nStartAngle = 8;
+	m_nEndAngle = 82;
+	m_nDx = 50;
+	m_nDy = 50;
+
+	m_nBinThres = 20;
+	m_nEdgeSmooth = 1;
+
+	m_x1 = -1;
+	m_y1 = -1;
+	m_xMmvsp = 0.0f;
+	m_yMmvsp = 0.0f;
+
+	m_nBrokenUse = 0;
+	m_fSigmaThres = 5.0f;
+	m_nTech = 0;
+	m_nDistThres = 3;
+	m_nBrokenSmooth = 5;
+	m_nBrokenArea = 60;
+	m_fOpenPara = 3.5;
+	for (int i = 0; i < 16; i++) {
+		m_ptArrayResult[i].x = 0.0f;
+		m_ptArrayResult[i].y = 0.0f;
+		m_ptArrayStd[i].x = 0.0f;
+		m_ptArrayStd[i].y = 0.0f;
+	}
+	m_fAvgChamber = 0.0f;
+	m_nStartDa = 0;
+	m_nEndDa = 0;
+
+	HalconCpp::GenEmptyObj(&m_hImage);
+	HalconCpp::GenEmptyObj(&m_hRoiRegion);
+	HalconCpp::GenEmptyObj(&m_hChipRegion);
+	HalconCpp::GenEmptyObj(&m_hBrkRoiRegion);
+}
+
+CRcutDotProcess::CRcutDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_eDir = eDir;
+	m_id = id;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_R%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_R%d"), m_id);
+		break;
+	}
+	m_nPoseX = 0;
+	m_nPoseY = 0;
+	m_width = 0;
+	m_height = 0;
+
+	m_nUse = 0;
+	m_nChamferSize = 25;
+	m_nChipRange = 30;
+	m_nChipThres = 50;
+
+	m_nStartAngle = 8;
+	m_nEndAngle = 82;
+	m_nDx = 50;
+	m_nDy = 50;
+
+	m_nBinThres = 20;
+	m_nEdgeSmooth = 1;
+
+	m_x1 = -1;
+	m_y1 = -1;
+	m_xMmvsp = 0.0f;
+	m_yMmvsp = 0.0f;
+
+	m_nBrokenUse = 0;
+	m_fSigmaThres = 5.0f;
+	m_nTech = 0;
+	m_nDistThres = 3;
+	m_nBrokenSmooth = 5;
+	m_nBrokenArea = 60;
+	m_fOpenPara = 3.5;
+	for (int i = 0; i < 16; i++) {
+		m_ptArrayResult[i].x = 0.0f;
+		m_ptArrayResult[i].y = 0.0f;
+		m_ptArrayStd[i].x = 0.0f;
+        m_ptArrayStd[i].y = 0.0f;
+	}
+
+	HalconCpp::GenEmptyObj(&m_hImage);
+	HalconCpp::GenEmptyObj(&m_hRoiRegion);
+	HalconCpp::GenEmptyObj(&m_hChipRegion);
+
+	m_fAvgChamber = 0.0f;
+	m_nStartDa = 0;
+	m_nEndDa = 0;
+
+	HalconCpp::GenEmptyObj(&m_hBrkRoiRegion);
+}
+
+CRcutDotProcess::~CRcutDotProcess(){
+	/* code */
+}
+
+void CRcutDotProcess::getRegion(int &xPos, int &yPos, int &width, int &height){
+	/* code */
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	//进行坐标转换
+	Point2I offset;
+	offset.x = m_nPoseX;
+	offset.y = m_nPoseY;
+	Point2I result;
+
+	int nType = 1;
+	if (1 != m_id) {
+		nType = 2;
+	}
+	if (!CVisionBufferPro::TransformToReal(m_eDir, offset, nType, result)) return;
+
+	int dWidth = (int)(m_width / pSideData->m_dPixelSizeX + 0.5f);
+	int dHeight = (int)(m_height / pSideData->m_dPixelSizeY + 0.5f);
+
+	if (1 == m_id) {   //Top RCut)
+		xPos = result.x - dWidth + 1;
+		yPos = result.y - dHeight + 1;
+		width = dWidth;
+		height = dHeight;
+	}
+	else {
+		xPos = result.x - dWidth + 1;
+		yPos = result.y;
+		width = dWidth;
+		height = dHeight;
+	}
+}
+
+void CRcutDotProcess::setRegion(int xPos, int yPos, int width, int height) {
+	/* code */
+	//获取侧光数据
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	//设置图像的区域
+	int x1 = xPos;
+	int y1 = yPos;
+	int x2 = xPos + width - 1;
+	int y2 = yPos + height - 1;
+//	Log_GetDebug()->TraceInfo("Trace Set ROI: %d, %d, %d, %d, %d, %d, %d", (int)m_eDir, m_id, x1, y1, x2, y2, __LINE__);
+
+	//记录右下左边
+	Point2I point;
+	if (1 == m_id) {   //Top RCut
+		point.x = x2;
+		point.y = y2;
+	}
+	else {            //Bot RCut
+		point.x = x2;
+		point.y = y1;
+	}
+	Point2I pose, ptTop, ptBot;
+	if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir, point, pose, ptTop, ptBot)) return;
+
+	//设置pose和宽高
+	if (1 == m_id) {   //Top RCut
+		m_nPoseX = ptTop.x;
+		m_nPoseY = ptTop.y;
+	}
+	else {
+		m_nPoseX = ptBot.x;
+		m_nPoseY = ptBot.y;
+	}
+	m_width = (int)(pSideData->m_dPixelSizeX * width);
+	m_height = (int)(pSideData->m_dPixelSizeY * height);	
+
+#if 0
+	int x = 0;
+	int y = 0;
+	int w = 0;
+	int h = 0;
+	getRegion(x, y, w, h);
+
+	Log_GetDebug()->TraceInfo("Trace Input Info: %d, %d, %d, %d, %d", xPos, yPos, width, height, __LINE__);
+	Log_GetDebug()->TraceInfo("Trace Input Info: %d, %d, %d, %d, %d", x, y, w, h, __LINE__);
+#endif
+}
+
+int CRcutDotProcess::getID(void) {
+	/* code*/
+	return m_id;
+}
+
+void CRcutDotProcess::setID(int id) {
+	/* code */
+	m_id = id;
+}
+
+int CRcutDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_fMaxChamber = 0.0f;
+	m_nNgInfo.clear();
+	HalconCpp::GenEmptyObj(&m_hResultRegion);
+	HalconCpp::GenEmptyObj(&m_hBrkRoiRegion);
+	for (int i = 0; i < 16; i++) {
+		m_ptArrayResult[i].x = 0;
+        m_ptArrayResult[i].y = 0;
+	}
+	if (1 != m_nUse)  return 0;
+	if (m_width < 1 || m_height < 1) return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 获取图像
+	if (!getProcImage(eDir, offset, m_hImage)) return 0;
+
+	//3. Chip检测
+	InspectChip(m_hImage);
+
+	//5. 获取结果
+	getResult();
+
+	//5. 打印数据
+	int nRet = (int)(m_nNgInfo.size());
+	//KeyDebugInfo inf = CVisionRecipe::getInstance()->getKeyInfo();
+	//if (inf.isDebugTool && inf.isCutLineKey) {
+	//	for (int i = 0; i < nRet; i++) {
+	//		Log_GetDebug()->TraceInfo("Trace CutLine Result %d: %d, %d, (%.1f, %.1f), %d",
+	//			(int)m_eDir, m_id, i, m_nNgInfo[i].xResult, m_nNgInfo[i].yResult, __LINE__);
+	//	}
+	//}
+	
+	return nRet;
+}
+
+void CRcutDotProcess::getResult(void) {
+	/* code */
+	int nCount = ClsVision::ObjectNumber(m_hResultRegion);
+	if (nCount < 1) return;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = false;
+	ng.minValue = m_nDx;
+	ng.maxValue = m_nDy;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_Chip;   //缺陷类型
+	ng.eVision = VISION_RCUT;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	HalconCpp::HTuple hvArea, hvY, hvX;
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::AreaCenter(m_hResultRegion, &hvArea, &hvY, &hvX);
+	HalconCpp::SmallestRectangle1(m_hResultRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	for (int i = 0; i < nCount; i++) {
+		ng.result = hvArea[i].I();
+		ng.xResult = (int)(m_xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1));
+		ng.yResult = (int)(m_yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1));
+		ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + m_x1;
+		ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + m_y1;
+		ng.x1 = hvX1[i].I() + m_x1 - 1;
+		ng.y1 = hvY1[i].I() + m_y1 - 1;
+		ng.x2 = hvX2[i].I() + m_x1 + 1;
+		ng.y2 = hvY2[i].I() + m_y1 + 1;
+
+		if (nullptr != pSideData) {  //区域的显示结果
+			DispVisionResult inf;
+			inf.nType = 1;
+			inf.eDir = (int)(m_eDir);
+			inf.eVision = (int)(VISION_RCUT);
+			inf.rectX1 = ng.x1;
+			inf.rectY1 = ng.y1;
+			inf.rectX2 = ng.x2;
+			inf.rectY2 = ng.y2;
+			inf.showROI = 0;
+			pSideData->m_vDispVisionResult.push_back(inf);
+		}
+
+		m_nNgInfo.push_back(ng);
+	}
+}
+
+void CRcutDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+bool CRcutDotProcess::getProcImage(DimensionDir eDir, Point2I offset, HalconCpp::HObject &hImage) {
+	/* code */
+	m_eDir = eDir;
+	if (m_width < 1 && m_height < 1) return false;
+	if (0 == m_nPoseX && 0 == m_nPoseY)  return false;
+
+	int left = 0;
+	int top = 0;
+	int width = 0;
+	int height = 0;
+	getRegion(left, top, width, height);
+
+	int x1 = left;
+	int y1 = top;
+	int x2 = left + width - 1;
+	int y2 = top + height - 1;
+	
+	m_x1 = x1;
+	m_y1 = y1;
+	bool bRes = CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2);
+
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_RCUT);
+		inf.rectX1 = x1;
+		inf.rectY1 = y1;
+		inf.rectX2 = x2;
+		inf.rectY2 = y2;
+		inf.showROI = 1;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 4;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_RCUT);
+		inf.pointX = x1;
+		inf.pointY = y1;
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+//	Log_GetDebug()->TraceInfo("Trace ROI: %d, %d, %d, %d, %d, %d", (int)m_eDir, m_id, x1, y1, x2, y2);
+
+	return bRes;
+}
+
+void CRcutDotProcess::TechImage(void) {
+	/* code */
+	ClsVision::GenEmptyObject(m_hChipRegion);
+	ClsVision::GenEmptyObject(m_hRoiRegion);
+
+	Point2I offset;
+	offset.x = 0;
+	offset.y = 0;
+
+	Execute(m_eDir, offset); 
+}
+
+void CRcutDotProcess::InspectChip(HalconCpp::HObject &hImage) {
+	/* code */
+	if (1 == m_id) {
+		InspectTopChip(hImage);
+		return;
+	}
+
+	InspectBotChip(hImage);
+}
+
+bool CRcutDotProcess::getRcutEdgePoints(HalconCpp::HObject &hImage, std::vector<Point2D> &vStartPoints, std::vector<Point2D> &vEndPoints, std::vector<Point2D> &vResPoints, double &maxDist, double &minDist) {
+	/* code */
+	int width = 0;
+	int height = 0;
+	minDist = 0.0f;
+	maxDist = 0.0f;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return false;
+
+	//提取空旷的区域
+//	int nRet = CheckBroken(hImage, m_hBrkRoiRegion);
+	double xTargetCenter = 1;
+	double yTargetCenter = 1;
+
+#if  RCUT_DEBUG_CODE    
+	HalconCpp::HWindow hDispWin(0, 0, width, height);
+	hDispWin.SetPart(0, 0, height - 1, width - 1);
+	hDispWin.SetColored(6);
+	hDispWin.DispObj(hImage);
+	hDispWin.Click();
+#endif
+
+	std::vector<Point2D> vStartResults;
+	std::vector<Point2D> vEndResuts;
+	std::vector<bool> vFindRes;
+	maxDist = 0;
+	minDist = MAXINT;
+	if (1 == m_id) {
+		double radius = sqrt(1.0 * width * width + 1.0 * height * height);
+		double centerX = width - 1;
+		double centerY = height - 1;
+		xTargetCenter = centerX;
+        yTargetCenter = centerY;
+		double angle0 = m_nStartAngle;
+		double angle1 = m_nEndAngle;
+		double step = 1.0 * (m_nEndAngle - m_nStartAngle) / 15;
+		std::vector<Line2D> vLines;
+
+		for (int i = 0; i < 16; i++) {
+			double angle = angle0 + i * step - 90;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 5, -100, 5, 100, &hvRow, &hvColumn, &hvIsOverlapping);
+			HalconCpp::TupleLength(hvRow, &hvLength);
+			if (hvLength[0].I() < 1) continue;
+			double x1 = hvColumn[0].D();
+			double y1 = hvRow[0].D();
+			if (x1 < 0) {
+				HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping);
+				HalconCpp::TupleLength(hvRow, &hvLength);
+				if (hvLength[0].I() < 1) continue;
+				x1 = hvColumn[0].D();
+				y1 = hvRow[0].D();
+			}
+			Line2D line;
+			line.pt0.x = x1;
+			line.pt0.y = y1;
+			line.pt1.x = centerX;
+			line.pt1.y = centerY;
+			Point2D ptStart, ptEnd;
+			bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, -1.0f, ptStart, ptEnd);
+			vLines.push_back(line);
+			vStartResults.push_back(ptStart);
+			vEndResuts.push_back(ptEnd);
+			vFindRes.push_back(isFind);
+
+			//if (1 == m_nBrokenUse && 1 == nRet) {    //如果检测到有破损,则使用破损的坐标
+			//	HalconCpp::HObject hLineRg, hIntersectRg;
+   //             HalconCpp::GenRegionLine(&hLineRg, y1, x1, centerY, centerX);
+			//	HalconCpp::Intersection(hLineRg, m_hBrkRoiRegion, &hIntersectRg);
+			//	HalconCpp::HTuple hvY, hvX, hvLength;
+			//	HalconCpp::GetRegionPoints(hIntersectRg, &hvY, &hvX);
+   //             HalconCpp::TupleLength(hvY, &hvLength);
+			//	int N0 = hvLength[0].I();
+			//	int loopNumber = 0;
+			//	if (N0 > 0) {
+			//		loopNumber = hvLength[0].I();
+			//	}
+			//	double minDist = MAXINT;
+			//	for (int j = 0; j < loopNumber; j++) {
+			//		double dx = hvX[j].I() - centerX;
+			//		double dy = hvY[j].I() - centerY;
+			//		double dist = sqrt(dx * dx + dy * dy);
+			//		if (dist < minDist) {
+			//			minDist = dist;
+			//			m_ptArrayResult[i].x = hvX[j].I();
+			//			m_ptArrayResult[i].y = hvY[j].I();
+			//		}
+			//	}
+			//}
+			
+			//HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2;
+			//HalconCpp::GenRegionLine(&hDispRegion, y1, x1, centerY, centerX);
+			//if (!isFind) {
+			//	hDispWin.SetColor("blue");
+			//	hDispWin.DispObj(hDispRegion);
+			//	hDispWin.Click();
+			//}
+			if (!isFind) 	continue;
+
+			//HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0);
+			//HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0);
+			//hDispWin.SetColor("blue");
+			//hDispWin.DispObj(hDispRegion);
+			//hDispWin.SetColor("green");
+			//hDispWin.DispObj(hDispObj1);
+			//hDispWin.DispObj(hDispObj2);
+			//hDispWin.Click();
+		}
+
+		double avg = 0.0f;
+		double nCount = 0;
+		for (int i = 0; i < 16; i++) {
+			if (!vFindRes[i])   continue;
+
+			double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]);
+			avg += dist;
+			nCount += 1;
+		}
+		if (nCount < 3) {
+			avg = 0.8 * m_nChamferSize;
+		}
+		else {
+			avg = avg / nCount;
+		}
+		
+		for (int i = 0; i < 16; i++) {
+			if (vFindRes[i])   continue;
+
+			Line2D line = vLines[i];
+			Point2D ptStart, ptEnd;
+//			Log_GetDebug()->TraceInfo("Line %d: %.2f, %.2f, %.2f, %.2f", i, line.pt0.x, line.pt0.y, line.pt1.x, line.pt1.y);
+			bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, avg, ptStart, ptEnd);
+
+			//HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2;
+			//HalconCpp::GenRegionLine(&hDispRegion, line.pt0.y, line.pt0.x, line.pt1.y, line.pt1.x);
+			//if (!isFind) {
+			//	hDispWin.SetColor("blue");
+			//	hDispWin.DispObj(hDispRegion);
+			//	hDispWin.Click();
+			//}
+			if (!isFind) continue;
+
+			vFindRes[i] = isFind;
+			vStartResults[i] = ptStart;
+			vEndResuts[i] = ptEnd;
+
+			//HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0);
+			//HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0);
+			//hDispWin.SetColor("blue");
+			//hDispWin.DispObj(hDispRegion);
+			//hDispWin.SetColor("green");
+			//hDispWin.DispObj(hDispObj1);
+			//hDispWin.DispObj(hDispObj2);
+			//hDispWin.Click();
+		}
+
+		for (int i = 0; i < 16; i++) {
+			if (!vFindRes[i])   continue;
+
+			double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]);
+			if (dist > maxDist)  maxDist = dist;
+			if (dist < minDist)  minDist = dist;
+			vStartPoints.push_back(vStartResults[i]);
+			vEndPoints.push_back(vEndResuts[i]);
+			Point2D midPoint;
+			midPoint.x = 0.5 * (vStartResults[i].x + vEndResuts[i].x);
+			midPoint.y = 0.5 * (vStartResults[i].y + vEndResuts[i].y);
+			vResPoints.push_back(midPoint);
+		}
+
+	}
+	else {
+		double radius = sqrt(1.0 * width * width + 1.0 * height * height);
+		double centerX = width - 1;
+		double centerY = 0;
+		xTargetCenter = centerX;
+		yTargetCenter = centerY;
+		double angle0 = m_nStartAngle;
+		double angle1 = m_nEndAngle;
+		double step = 1.0 * (m_nEndAngle - m_nStartAngle) / 15;
+
+		std::vector<Line2D> vLines;
+		//std::vector<Point2D> vStartResults;
+		//std::vector<Point2D> vEndResuts;
+		//std::vector<bool> vFindRes;
+
+		for (int i = 0; i < 16; i++) {
+			double angle = angle0 + i * step;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, height - 6, -100, height - 6, 100, &hvRow, &hvColumn, &hvIsOverlapping);
+			HalconCpp::TupleLength(hvRow, &hvLength);
+			if (hvLength[0].I() < 1) continue;
+			double x1 = hvColumn[0].D();
+			double y1 = hvRow[0].D();
+			if (x1 < 0) {
+				HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping);
+				HalconCpp::TupleLength(hvRow, &hvLength);
+				if (hvLength[0].I() < 1) continue;
+				x1 = hvColumn[0].D();
+				y1 = hvRow[0].D();
+			}
+			Line2D line;
+			line.pt0.x = x1;
+			line.pt0.y = y1;
+			line.pt1.x = centerX;
+			line.pt1.y = centerY;
+			Point2D ptStart, ptEnd;
+			bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, -1.0f, ptStart, ptEnd);
+			vLines.push_back(line);
+			vStartResults.push_back(ptStart);
+			vEndResuts.push_back(ptEnd);
+			vFindRes.push_back(isFind);
+
+			//if (1 == m_nBrokenUse && 1 == nRet) {    //如果检测到有破损,则使用破损的坐标
+			//	HalconCpp::HObject hLineRg, hIntersectRg;
+			//	HalconCpp::GenRegionLine(&hLineRg, y1, x1, centerY, centerX);
+			//	HalconCpp::Intersection(hLineRg, m_hBrkRoiRegion, &hIntersectRg);
+			//	HalconCpp::HTuple hvY, hvX, hvLength;
+			//	HalconCpp::GetRegionPoints(hIntersectRg, &hvY, &hvX);
+			//	HalconCpp::TupleLength(hvY, &hvLength);
+			//	int N0 = hvLength[0].I();
+			//	int loopNumber = 0;
+			//	if (N0 > 0) {
+			//		loopNumber = hvLength[0].I();
+			//	}
+			//	double minDist = MAXINT;
+			//	for (int j = 0; j < loopNumber; j++) {
+			//		double dx = hvX[j].I() - centerX;
+			//		double dy = hvY[j].I() - centerY;
+			//		double dist = sqrt(dx * dx + dy * dy);
+			//		if (dist < minDist) {
+   //                     minDist = dist;
+			//			m_ptArrayResult[i].x = hvX[j].I();
+			//			m_ptArrayResult[i].y = hvY[j].I();
+			//		}
+			//	}
+			//}
+
+			//HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2;
+			//HalconCpp::GenRegionLine(&hDispRegion, y1, x1, centerY, centerX);
+			//if (!isFind) {
+			//	hDispWin.SetColor("blue");
+			//	hDispWin.DispObj(hDispRegion);
+			//	hDispWin.Click();
+			//}
+			if (!isFind) 	continue;
+
+			//HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0);
+			//HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0);
+			//hDispWin.SetColor("blue");
+			//hDispWin.DispObj(hDispRegion);
+			//hDispWin.SetColor("green");
+			//hDispWin.DispObj(hDispObj1);
+			//hDispWin.DispObj(hDispObj2);
+			//hDispWin.Click();
+		}
+
+		double avg = 0.0f;
+		double nCount = 0;
+		for (int i = 0; i < 16; i++) {
+			if (!vFindRes[i])   continue;
+
+			double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]);
+			avg += dist;
+			nCount += 1;
+		}
+		if (nCount < 3) {
+			avg = 0.8 * m_nChamferSize;
+		}
+		else {
+			avg = avg / nCount;
+		}
+
+		for (int i = 0; i < 16; i++) {
+			if (vFindRes[i])   continue;
+
+			Line2D line = vLines[i];
+			Point2D ptStart, ptEnd;
+			bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, avg, ptStart, ptEnd);
+
+			//HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2;
+			//HalconCpp::GenRegionLine(&hDispRegion, line.pt0.y, line.pt0.x, line.pt1.y, line.pt1.x);
+			//if (!isFind) {
+			//	hDispWin.SetColor("blue");
+			//	hDispWin.DispObj(hDispRegion);
+			//	hDispWin.Click();
+			//}
+			if (!isFind) continue;
+
+			vFindRes[i] = isFind;
+			vStartResults[i] = ptStart;
+			vEndResuts[i] = ptEnd;
+
+			//HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0);
+			//HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0);
+			//hDispWin.SetColor("blue");
+			//hDispWin.DispObj(hDispRegion);
+			//hDispWin.SetColor("green");
+			//hDispWin.DispObj(hDispObj1);
+			//hDispWin.DispObj(hDispObj2);
+			//hDispWin.Click();
+		}
+
+		for (int i = 0; i < 16; i++) {
+			if (!vFindRes[i])   continue;
+
+			double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]);
+			if (dist > maxDist)  maxDist = dist;
+			if (dist < minDist)  minDist = dist;
+			vStartPoints.push_back(vStartResults[i]);
+			vEndPoints.push_back(vEndResuts[i]);
+			Point2D midPoint;
+			midPoint.x = 0.5 * (vStartResults[i].x + vEndResuts[i].x);
+			midPoint.y = 0.5 * (vStartResults[i].y + vEndResuts[i].y);
+			vResPoints.push_back(midPoint);
+		}
+	}
+
+#if  RCUT_DEBUG_CODE  
+	HalconCpp::HTuple hvYY, hvXX;
+	for (int i = 0; i < 16; i++) {
+		hvXX[i] = m_ptArrayResult[i].x;
+        hvYY[i] = m_ptArrayResult[i].y;
+	}
+	HalconCpp::HObject hDispRg;
+	HalconCpp::GenCrossContourXld(&hDispRg, hvYY, hvXX, 21, 0.0);
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hDispRg);
+	hDispWin.Click();
+#endif
+
+	AnalysisBroken(hImage);
+
+//	if (1 == m_nBrokenUse && 1 == nRet) {
+//		double aryDx[16], aryDy[16];
+//		for (int i = 0; i < 16; i++) {
+//			aryDx[i] = m_ptArrayResult[i].x - m_ptArrayStd[i].x;
+//			aryDy[i] = m_ptArrayResult[i].y - m_ptArrayStd[i].y;
+//		}
+//		//进行排序
+//		for (int i = 0; i < 15; i++) {
+//			for (int j = i + 1; j < 16; j++) {
+//				if (aryDx[i] > aryDx[j]) {
+//					double temp = aryDx[i];
+//					aryDx[i] = aryDx[j];
+//					aryDx[j] = temp;
+//				}
+//				if (aryDy[i] > aryDy[j]) {
+//					double temp = aryDy[i];
+//					aryDy[i] = aryDy[j];
+//					aryDy[j] = temp;
+//				}
+//			}
+//		}
+//		//计算均值
+//		double avgDx = 0.0f;
+//		double avgDy = 0.0f;
+//		for (int i = 3; i <= 12; i++) {
+//			avgDx += aryDx[i];
+//			avgDy += aryDy[i];
+//		}
+//		avgDx = avgDx / 10;
+//		avgDy = avgDy / 10;
+//		Log_GetDebug()->TraceInfo("Avg Info: (%.1f, %.1f), %d", avgDx, avgDy, __LINE__);
+//
+//		Point2D aryPt[16];
+//		if (0 == m_nTech) {
+//			for (int i = 0; i < 16; i++) {
+//				if (fabs(avgDx) < 15 && fabs(avgDy) < 15) {
+//					double dx = m_ptArrayResult[i].x - (m_ptArrayStd[i].x + avgDx);
+//					double dy = m_ptArrayResult[i].y - (m_ptArrayStd[i].y + avgDy);
+//					if (fabs(dx) < m_nDistThres && fabs(dy) < m_nDistThres) {
+//						aryPt[i] = m_ptArrayResult[i];
+//					}
+//					else {
+//						aryPt[i] = m_ptArrayStd[i];
+//						aryPt[i].x += avgDx;
+//						aryPt[i].y += avgDy;
+//					}
+//				}
+//				else {
+//
+//					aryPt[i] = m_ptArrayStd[i];
+//					aryPt[i].x += avgDx;
+//					aryPt[i].y += avgDy;
+//				}
+//			}
+//		}
+//		else {
+//			for (int i = 0; i < 16; i++) {
+//				aryPt[i] = m_ptArrayResult[i];
+//			}
+//		}
+//
+//		//1. 获取点阵
+//		std::vector<vec> vecPoints;
+//		for (int i = 0; i < 16; i++) {
+//			float x0 = (float)aryPt[i].x;
+//			float y0 = (float)aryPt[i].y;
+//			vec p0(x0, y0, 0);
+//			vecPoints.push_back(p0);
+//		}
+//
+//		//2. 执行样条插值
+//		CBspline bcurve(vecPoints);
+//		bcurve.execute();
+//
+//		//3. 获取样条差值轮廓点
+//		int sz = (int)(bcurve.m_vPtResults.size());
+//		if (sz < 1) return false;
+//		HalconCpp::HTuple hvY, hvX;
+//		for (int i = 0; i < sz; i++) {
+//			hvX[i] = bcurve.m_vPtResults[i][0];
+//			hvY[i] = bcurve.m_vPtResults[i][1];
+//		}
+//		int idx = sz;
+//		hvX[idx] = xTargetCenter;
+//		hvY[idx] = yTargetCenter;
+//		//4. 生产区域
+//		HalconCpp::HObject hRegion0, hBrokenRg;
+//		HalconCpp::GenRegionPolygonFilled(&hRegion0, hvY, hvX);
+//		HalconCpp::ErosionCircle(hRegion0, &hBrokenRg, m_nBrokenSmooth);
+//
+//#if  RCUT_DEBUG_CODE  
+//		for (int i = 0; i < 16; i++) {
+//			Log_GetDebug()->TraceInfo("Offset %d: (%.1f, %.1f),(%.1f, %.1f),(%.1f, %.1f),(%.1f, %.1f), %d",
+//				i, m_ptArrayResult[i].x, m_ptArrayResult[i].y,
+//				m_ptArrayStd[i].x, m_ptArrayStd[i].y,
+//				m_ptArrayResult[i].x - aryPt[i].x, m_ptArrayResult[i].y - aryPt[i].y,
+//				m_ptArrayResult[i].x - m_ptArrayStd[i].x, m_ptArrayResult[i].y - m_ptArrayStd[i].y,
+//				__LINE__);
+//		}
+//
+//		hDispWin.DispObj(hImage);
+//		hDispWin.SetColor("red");
+//		hDispWin.DispObj(m_hBrkRoiRegion);
+//		hDispWin.Click();
+//
+//		hDispWin.DispObj(hImage);
+//		hDispWin.SetColor("green");
+//		hDispWin.DispObj(hBrokenRg);
+//		hDispWin.Click();
+//#endif
+//
+//		HalconCpp::HObject hIntersectRg, hConnectRg, hSelectRg;
+//		HalconCpp::Intersection(hBrokenRg, m_hBrkRoiRegion, &hIntersectRg);
+//		HalconCpp::Connection(hIntersectRg, &hConnectRg);
+//
+//#if  RCUT_DEBUG_CODE
+//		hDispWin.DispObj(hImage);
+//		hDispWin.SetColored(6);
+//		hDispWin.DispObj(hConnectRg);
+//		hDispWin.Click();
+//#endif
+//
+//
+//		HalconCpp::SelectShape(hConnectRg, &hSelectRg, "area", "and", m_nBrokenArea, MAXINT);
+//		int ngNum = ClsVision::ObjectNumber(hSelectRg);
+//		if (ngNum > 0) {
+//			NgDotInfo ng;
+//			ng.eDir = m_eDir;
+//			ng.id = m_id;
+//			ng.isRes = false;
+//			ng.minValue = m_nDx;
+//			ng.maxValue = m_nDy;
+//			ng.strName = m_strName;
+//			ng.ngType = DefectLoc_Chip;   //缺陷类型
+//			ng.eVision = VISION_RCUT;
+//
+//			CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+//			HalconCpp::HTuple hvArea, hvYY, hvXX;
+//			HalconCpp::HTuple hvYY1, hvXX1, hvYY2, hvXX2;
+//			HalconCpp::AreaCenter(hSelectRg, &hvArea, &hvYY, &hvXX);
+//			HalconCpp::SmallestRectangle1(hSelectRg, &hvYY1, &hvXX1, &hvYY2, &hvXX2);
+//			for (int i = 0; i < ngNum; i++) {
+//				ng.result = hvArea[i].I();
+//				ng.xResult = (int)(m_xMmvsp * (hvXX2[i].I() - hvXX1[i].I() + 1));
+//				ng.yResult = (int)(m_yMmvsp * (hvYY2[i].I() - hvYY1[i].I() + 1));
+//				ng.xPosPxl = (int)(0.5 * (hvXX2[i].I() + hvXX1[i].I())) + m_x1;
+//				ng.yPosPxl = (int)(0.5 * (hvYY1[i].I() + hvYY2[i].I())) + m_y1;
+//				ng.x1 = hvXX1[i].I() + m_x1 - 1;
+//				ng.y1 = hvYY1[i].I() + m_y1 - 1;
+//				ng.x2 = hvXX2[i].I() + m_x1 + 1;
+//				ng.y2 = hvYY2[i].I() + m_y1 + 1;
+//
+//				if (nullptr != pSideData) {  //区域的显示结果
+//					DispVisionResult inf;
+//					inf.nType = 1;
+//					inf.eDir = (int)(m_eDir);
+//					inf.eVision = (int)(VISION_RCUT);
+//					inf.rectX1 = ng.x1;
+//					inf.rectY1 = ng.y1;
+//					inf.rectX2 = ng.x2;
+//					inf.rectY2 = ng.y2;
+//					inf.showROI = 0;
+//					pSideData->m_vDispVisionResult.push_back(inf);
+//				}
+//
+//				m_nNgInfo.push_back(ng);
+//			}
+//		}
+//#if  RCUT_DEBUG_CODE  
+//		hDispWin.DispObj(hImage);
+//		hDispWin.DispObj(hSelectRg);
+//		hDispWin.Click();
+//#endif
+//	}
+
+	int num = (int)(vStartPoints.size());
+	if (num < 3) return false;
+
+	return true;
+}
+
+void CRcutDotProcess::AnalysisBroken(HalconCpp::HObject& hImage) {
+	/* code */
+	if (1 != m_nBrokenUse)  return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	//提取空旷的区域
+	int nRet = CheckBroken(hImage, m_hBrkRoiRegion);
+	if (1 != nRet) return;
+
+	double xTargetCenter = 1;
+	double yTargetCenter = 1;
+
+#if  RCUT_DEBUG_CODE   
+//#if 1
+	HalconCpp::HWindow hDispWin(0, 0, width, height);
+	hDispWin.SetPart(0, 0, height - 1, width - 1);
+	hDispWin.SetColored(6);
+	hDispWin.DispObj(hImage);
+	hDispWin.Click();
+#endif
+
+	if (1 == m_id) {
+		double radius = sqrt(1.0 * width * width + 1.0 * height * height);
+		double centerX = width - 1;
+		double centerY = height - 1;
+		xTargetCenter = centerX;
+		yTargetCenter = centerY;
+		double angle0 = m_nStartDa;
+		double angle1 = m_nEndDa;
+		double step = 1.0 * (m_nEndDa - m_nStartDa) / 15;
+
+		for (int i = 0; i < 16; i++) {
+			double angle = angle0 + i * step - 90;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 5, -100, 5, 100, &hvRow, &hvColumn, &hvIsOverlapping);
+			HalconCpp::TupleLength(hvRow, &hvLength);
+			if (hvLength[0].I() < 1) continue;
+			double x1 = hvColumn[0].D();
+			double y1 = hvRow[0].D();
+			if (x1 < 0) {
+				HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping);
+				HalconCpp::TupleLength(hvRow, &hvLength);
+				if (hvLength[0].I() < 1) continue;
+				x1 = hvColumn[0].D();
+				y1 = hvRow[0].D();
+			}
+
+			if (1 == m_nBrokenUse && 1 == nRet) {    //如果检测到有破损,则使用破损的坐标
+				HalconCpp::HObject hLineRg, hIntersectRg;
+				HalconCpp::GenRegionLine(&hLineRg, y1, x1, centerY, centerX);
+				HalconCpp::Intersection(hLineRg, m_hBrkRoiRegion, &hIntersectRg);
+				HalconCpp::HTuple hvY, hvX, hvLength;
+				HalconCpp::GetRegionPoints(hIntersectRg, &hvY, &hvX);
+				HalconCpp::TupleLength(hvY, &hvLength);
+				int N0 = hvLength[0].I();
+				int loopNumber = 0;
+				if (N0 > 0) {
+					loopNumber = hvLength[0].I();
+				}
+				double minDist = MAXINT;
+				for (int j = 0; j < loopNumber; j++) {
+					double dx = hvX[j].I() - centerX;
+					double dy = hvY[j].I() - centerY;
+					double dist = sqrt(dx * dx + dy * dy);
+					if (dist < minDist) {
+						minDist = dist;
+						m_ptArrayResult[i].x = hvX[j].I();
+						m_ptArrayResult[i].y = hvY[j].I();
+					}
+				}
+			}
+		}
+	}
+	else {
+		double radius = sqrt(1.0 * width * width + 1.0 * height * height);
+		double centerX = width - 1;
+		double centerY = 0;
+		xTargetCenter = centerX;
+		yTargetCenter = centerY;
+		double angle0 = m_nStartDa;
+		double angle1 = m_nEndDa;
+		double step = 1.0 * (m_nEndDa - m_nStartDa) / 15;
+
+		for (int i = 0; i < 16; i++) {
+			double angle = angle0 + i * step;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, height - 6, -100, height - 6, 100, &hvRow, &hvColumn, &hvIsOverlapping);
+			HalconCpp::TupleLength(hvRow, &hvLength);
+			if (hvLength[0].I() < 1) continue;
+			double x1 = hvColumn[0].D();
+			double y1 = hvRow[0].D();
+			if (x1 < 0) {
+				HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping);
+				HalconCpp::TupleLength(hvRow, &hvLength);
+				if (hvLength[0].I() < 1) continue;
+				x1 = hvColumn[0].D();
+				y1 = hvRow[0].D();
+			}
+
+			if (1 == m_nBrokenUse && 1 == nRet) {    //如果检测到有破损,则使用破损的坐标
+				HalconCpp::HObject hLineRg, hIntersectRg;
+				HalconCpp::GenRegionLine(&hLineRg, y1, x1, centerY, centerX);
+				HalconCpp::Intersection(hLineRg, m_hBrkRoiRegion, &hIntersectRg);
+				HalconCpp::HTuple hvY, hvX, hvLength;
+				HalconCpp::GetRegionPoints(hIntersectRg, &hvY, &hvX);
+				HalconCpp::TupleLength(hvY, &hvLength);
+				int N0 = hvLength[0].I();
+				int loopNumber = 0;
+				if (N0 > 0) {
+					loopNumber = hvLength[0].I();
+				}
+				double minDist = MAXINT;
+				for (int j = 0; j < loopNumber; j++) {
+					double dx = hvX[j].I() - centerX;
+					double dy = hvY[j].I() - centerY;
+					double dist = sqrt(dx * dx + dy * dy);
+					if (dist < minDist) {
+						minDist = dist;
+						m_ptArrayResult[i].x = hvX[j].I();
+						m_ptArrayResult[i].y = hvY[j].I();
+					}
+				}
+			}
+		}
+	}
+
+#if  RCUT_DEBUG_CODE 
+//#if  1 
+	HalconCpp::HTuple hvYY, hvXX;
+	for (int i = 0; i < 16; i++) {
+		hvXX[i] = m_ptArrayResult[i].x;
+		hvYY[i] = m_ptArrayResult[i].y;
+	}
+	HalconCpp::HObject hDispRg;
+	HalconCpp::GenCrossContourXld(&hDispRg, hvYY, hvXX, 21, 0.0);
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hDispRg);
+	hDispWin.Click();
+#endif
+
+	if (1 == m_nBrokenUse && 1 == nRet) {
+		double aryDx[16], aryDy[16];
+		for (int i = 0; i < 16; i++) {
+			aryDx[i] = m_ptArrayResult[i].x - m_ptArrayStd[i].x;
+			aryDy[i] = m_ptArrayResult[i].y - m_ptArrayStd[i].y;
+		}
+		//进行排序
+		for (int i = 0; i < 15; i++) {
+			for (int j = i + 1; j < 16; j++) {
+				if (aryDx[i] > aryDx[j]) {
+					double temp = aryDx[i];
+					aryDx[i] = aryDx[j];
+					aryDx[j] = temp;
+				}
+				if (aryDy[i] > aryDy[j]) {
+					double temp = aryDy[i];
+					aryDy[i] = aryDy[j];
+					aryDy[j] = temp;
+				}
+			}
+		}
+		//计算均值
+		double avgDx = 0.0f;
+		double avgDy = 0.0f;
+		for (int i = 3; i <= 12; i++) {
+			avgDx += aryDx[i];
+			avgDy += aryDy[i];
+		}
+		avgDx = avgDx / 10;
+		avgDy = avgDy / 10;
+		Log_GetDebug()->TraceInfo("Avg Info: (%.1f, %.1f), %d", avgDx, avgDy, __LINE__);
+
+		Point2D aryPt[16];
+		for (int i = 0; i < 16; i++) {
+			if (fabs(avgDx) < 15 && fabs(avgDy) < 15) {
+				double dx = m_ptArrayResult[i].x - (m_ptArrayStd[i].x + avgDx);
+				double dy = m_ptArrayResult[i].y - (m_ptArrayStd[i].y + avgDy);
+				if (fabs(dx) < m_nDistThres || fabs(dy) < m_nDistThres) {
+					aryPt[i] = m_ptArrayResult[i];
+				}
+				else {
+					aryPt[i] = m_ptArrayStd[i];
+					aryPt[i].x += avgDx;
+					aryPt[i].y += avgDy;
+				}
+			}
+			else {
+				aryPt[i] = m_ptArrayStd[i];
+				aryPt[i].x += avgDx;
+				aryPt[i].y += avgDy;
+			}
+		}
+
+		//if (1 == m_nTech) {
+		//	for (int i = 0; i < 16; i++) {
+		//		aryPt[i] = m_ptArrayResult[i];
+		//	}
+		//}
+
+
+		//1. 获取点阵
+		std::vector<vec> vecPoints;
+		for (int i = 0; i < 16; i++) {
+			float x0 = (float)aryPt[i].x;
+			float y0 = (float)aryPt[i].y;
+			vec p0(x0, y0, 0);
+			vecPoints.push_back(p0);
+		}
+
+		//2. 执行样条插值
+		CBspline bcurve(vecPoints);
+		bcurve.execute();
+
+		//3. 获取样条差值轮廓点
+		int sz = (int)(bcurve.m_vPtResults.size());
+		if (sz < 1) return;
+		HalconCpp::HTuple hvY, hvX;
+		for (int i = 0; i < sz; i++) {
+			hvX[i] = bcurve.m_vPtResults[i][0];
+			hvY[i] = bcurve.m_vPtResults[i][1];
+		}
+		int idx = sz;
+		hvX[idx] = xTargetCenter;
+		hvY[idx] = yTargetCenter;
+		//4. 生产区域
+		HalconCpp::HObject hRegion0, hBrokenRg;
+		HalconCpp::GenRegionPolygonFilled(&hRegion0, hvY, hvX);
+		HalconCpp::ErosionCircle(hRegion0, &hBrokenRg, m_nBrokenSmooth);
+
+#if  RCUT_DEBUG_CODE  
+//#if  1  
+		for (int i = 0; i < 16; i++) {
+			Log_GetDebug()->TraceInfo("Offset %d: (%.1f, %.1f),(%.1f, %.1f),(%.1f, %.1f),(%.1f, %.1f), %d",
+				i, m_ptArrayResult[i].x, m_ptArrayResult[i].y,
+				m_ptArrayStd[i].x, m_ptArrayStd[i].y,
+				m_ptArrayResult[i].x - aryPt[i].x, m_ptArrayResult[i].y - aryPt[i].y,
+				m_ptArrayResult[i].x - m_ptArrayStd[i].x, m_ptArrayResult[i].y - m_ptArrayStd[i].y,
+				__LINE__);
+		}
+
+		hDispWin.DispObj(hImage);
+		hDispWin.SetColor("red");
+		hDispWin.DispObj(m_hBrkRoiRegion);
+		hDispWin.Click();
+
+		hDispWin.DispObj(hImage);
+		hDispWin.SetColor("green");
+		hDispWin.DispObj(hBrokenRg);
+		hDispWin.Click();
+#endif
+
+		HalconCpp::HObject hIntersectRg, hConnectRg, hSelectRg;
+		HalconCpp::Intersection(hBrokenRg, m_hBrkRoiRegion, &hIntersectRg);
+		HalconCpp::Connection(hIntersectRg, &hConnectRg);
+
+#if  RCUT_DEBUG_CODE
+//#if  1
+		hDispWin.DispObj(hImage);
+		hDispWin.SetColored(6);
+		hDispWin.DispObj(hConnectRg);
+		hDispWin.Click();
+#endif
+
+
+		HalconCpp::SelectShape(hConnectRg, &hSelectRg, "area", "and", m_nBrokenArea, MAXINT);
+		int ngNum = ClsVision::ObjectNumber(hSelectRg);
+		if (ngNum > 0) {
+			NgDotInfo ng;
+			ng.eDir = m_eDir;
+			ng.id = m_id;
+			ng.isRes = false;
+			ng.minValue = m_nDx;
+			ng.maxValue = m_nDy;
+			ng.strName = m_strName;
+			ng.ngType = DefectLoc_Chip;   //缺陷类型
+			ng.eVision = VISION_RCUT;
+
+			CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+			HalconCpp::HTuple hvArea, hvYY, hvXX;
+			HalconCpp::HTuple hvYY1, hvXX1, hvYY2, hvXX2;
+			HalconCpp::AreaCenter(hSelectRg, &hvArea, &hvYY, &hvXX);
+			HalconCpp::SmallestRectangle1(hSelectRg, &hvYY1, &hvXX1, &hvYY2, &hvXX2);
+			for (int i = 0; i < ngNum; i++) {
+				ng.result = hvArea[i].I();
+				ng.xResult = (int)(m_xMmvsp * (hvXX2[i].I() - hvXX1[i].I() + 1));
+				ng.yResult = (int)(m_yMmvsp * (hvYY2[i].I() - hvYY1[i].I() + 1));
+				ng.xPosPxl = (int)(0.5 * (hvXX2[i].I() + hvXX1[i].I())) + m_x1;
+				ng.yPosPxl = (int)(0.5 * (hvYY1[i].I() + hvYY2[i].I())) + m_y1;
+				ng.x1 = hvXX1[i].I() + m_x1 - 1;
+				ng.y1 = hvYY1[i].I() + m_y1 - 1;
+				ng.x2 = hvXX2[i].I() + m_x1 + 1;
+				ng.y2 = hvYY2[i].I() + m_y1 + 1;
+
+				if (nullptr != pSideData) {  //区域的显示结果
+					DispVisionResult inf;
+					inf.nType = 1;
+					inf.eDir = (int)(m_eDir);
+					inf.eVision = (int)(VISION_RCUT);
+					inf.rectX1 = ng.x1;
+					inf.rectY1 = ng.y1;
+					inf.rectX2 = ng.x2;
+					inf.rectY2 = ng.y2;
+					inf.showROI = 0;
+					pSideData->m_vDispVisionResult.push_back(inf);
+				}
+
+				m_nNgInfo.push_back(ng);
+			}
+		}
+#if  RCUT_DEBUG_CODE  
+//#if  1
+		hDispWin.DispObj(hImage);
+		hDispWin.DispObj(hSelectRg);
+		hDispWin.Click();
+#endif
+	}
+}
+
+void CRcutDotProcess::InspectBotChip(HalconCpp::HObject &hImage) {
+	/* code */
+	if (2 != m_id) return;
+
+	double maxDist = 0.0f;
+	double minDist = 0.0f;
+	std::vector<Point2D> vStartPoints;
+	std::vector<Point2D> vEndPoints;
+	std::vector<Point2D> vResPoints;
+	if (!getRcutEdgePoints(hImage, vStartPoints, vEndPoints, vResPoints, maxDist, minDist)) return;
+	m_fMaxChamber = maxDist;
+	m_fMinChamber = minDist;
+
+	//int width = 0;
+	//int height = 0;
+	//ClsVision::GetImageSize(hImage, width, height);
+	//HalconCpp::HWindow hDispWin(0, 0, width, height);
+	//hDispWin.SetPart(0, 0, height - 1, width - 1);
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hImage);
+
+	//int sz = (int)(vStartPoints.size());
+	//for (int i = 0; i < sz; i++) {
+	//	HalconCpp::HObject dispObject1, dispObject2;
+	//	HalconCpp::GenCrossContourXld(&dispObject1, vStartPoints[i].y, vStartPoints[i].x, 15, 0);
+	//	HalconCpp::GenCrossContourXld(&dispObject2, vEndPoints[i].y, vEndPoints[i].x, 15, 0);
+	//	hDispWin.DispObj(dispObject1);
+	//	hDispWin.DispObj(dispObject2);
+	//}
+	//hDispWin.Click();
+
+
+	HalconCpp::HObject hContourRegion, hChipRegion;
+	if (!getRCutRegion(vStartPoints, vEndPoints, hContourRegion, hChipRegion)) return;
+	m_hRoiRegion = hContourRegion;
+	m_hChipRegion = hChipRegion;
+
+	//hDispWin.SetDraw("fill");
+	//hDispWin.DispObj(hContourRegion);
+	//hDispWin.Click();
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hChipRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HObject hRectRegion, hSelectRegion;
+	genRectangeRegion(hRectRegion);
+	ImageBinThreshold(hImage, hRectRegion, hContourRegion, hSelectRegion);
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hSelectRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HObject hRealRegion;
+	if (!getRCutRealRegion(hSelectRegion, vResPoints, hRealRegion)) return;
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hRealRegion);
+	//hDispWin.Click();
+
+	InpsectChipRegion(hRealRegion, hChipRegion);
+}
+
+bool CRcutDotProcess::getRCutRegion(std::vector<Point2D> vStartPoints, std::vector<Point2D> vEndPoints, HalconCpp::HObject &hTargetRegion, HalconCpp::HObject &hRoiRegion) {
+	/* code */
+	int num = (int)(vStartPoints.size());
+	if (num < 1) return false;
+
+	//1. 获取点阵
+	std::vector<vec> vStartCtrlPoint;
+	std::vector<vec> vEndCtrlPoint;
+	for (int i = 0; i < num; i++) {
+		float x0 = (float)vStartPoints[i].x;
+		float y0 = (float)vStartPoints[i].y;
+		vec p0(x0, y0, 0);
+		vStartCtrlPoint.push_back(p0);
+		float x1 = (float)vEndPoints[i].x;
+		float y1 = (float)vEndPoints[i].y;
+		vec p1(x1, y1, 0);
+		vEndCtrlPoint.push_back(p1);
+	}
+
+	//2. 执行样条插值
+	CBspline bcurve(vStartCtrlPoint);
+	bcurve.execute();
+	CBspline endBcurve(vEndCtrlPoint);
+	endBcurve.execute();
+
+	//3. 获取样条差值轮廓点
+	int sz = (int)(bcurve.m_vPtResults.size());
+	if (sz < 1) return false;
+	HalconCpp::HTuple hvY, hvX;
+	for (int i = 0; i < sz; i++) {
+		hvX[i] = bcurve.m_vPtResults[i][0];
+		hvY[i] = bcurve.m_vPtResults[i][1];
+	}
+	int idx = sz;
+	sz = (int)(endBcurve.m_vPtResults.size());
+	if (sz > 0) {
+		for (int i = sz - 1; i >= 0; i--) {
+			hvX[idx] = endBcurve.m_vPtResults[i][0];
+			hvY[idx] = endBcurve.m_vPtResults[i][1];
+			idx += 1;
+		}
+	}
+
+	if (idx < 3) return false;
+
+	//4. 生产区域
+	HalconCpp::GenRegionPolygonFilled(&hTargetRegion, hvY, hvX);
+
+	HalconCpp::HTuple hvY0, hvX0;
+	for (int i = 0; i < sz; i++) {
+		hvX0[i] = endBcurve.m_vPtResults[i][0];
+		hvY0[i] = endBcurve.m_vPtResults[i][1];
+	}
+	if (1 == m_id) {
+		hvX0[sz] = m_width - 1;
+		hvY0[sz] = m_height - 1;
+	}
+	else {
+		hvX0[sz] = m_width - 1;
+		hvY0[sz] = 0;
+	}
+	HalconCpp::HObject hRegion1;
+	HalconCpp::GenRegionPolygonFilled(&hRegion1, hvY0, hvX0);
+
+	HalconCpp::HObject hTempRegion, hTempRegio2, hTempRegio3;
+	HalconCpp::DilationCircle(hTargetRegion, &hTempRegion, 2.5);
+	HalconCpp::DilationCircle(hTempRegion, &hTempRegio2, m_nChipRange);
+	HalconCpp::Difference(hTempRegio2, hTempRegion, &hTempRegio3);
+	HalconCpp::Intersection(hTempRegio3, hRegion1, &hRoiRegion);
+
+	return true;
+}
+
+void CRcutDotProcess::genRectangeRegion(HalconCpp::HObject &hRectRegion) {
+	/* code */
+	if (!ClsVision::RegionExist(m_hRoiRegion)) {
+		int x1 = 5;
+		int x2 = m_width - 6;
+		if (x2 < x1) {
+			x1 = 0;
+			x2 = 1;
+		}
+		int y1 = 5;
+		int y2 = m_height - 6;
+		if (y2 < y1) {
+			y1 = 0;
+            y2 = 1;
+		}
+		HalconCpp::GenRectangle1(&hRectRegion, y1, x1, y2, x2);
+		return;
+	}
+
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::SmallestRectangle1(m_hRoiRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	int y1 = hvY1[0].I();
+	if (y1 < 0) y1 = 5;
+	if (y1 > m_height - 1)  y1 = 5;
+	if (y1 > m_height - 1)  y1 = 0;
+	int y2 = hvY2[0].I();
+	if (y2 < 0) y2 = m_height - 6;
+	if (y2 > m_height - 1)  y2 = m_height - 6;
+	if (y2 < y1) y2 = y1;
+
+	int x1 = hvX1[0].I();
+	if (x1 < 0) x1 = 5;
+    if (x1 > m_width - 1)  x1 = 5;
+	if (x1 > m_width - 1)  x1 = 0;
+	int x2 = hvX2[0].I();
+	if (x2 < 0) x2 = m_width - 6;
+	if (x2 > m_width - 1)  x2 = m_width - 6;
+	if (x2 < x1) x2 = x1;
+	HalconCpp::GenRectangle1(&hRectRegion, y1, x1, y2, x2);
+#if 0 
+	if (1 == m_id) {
+		double centerX = m_width - 1;
+		double centerY = m_height - 1;
+		double radius = sqrt(1.0 * m_width * m_width + 1.0 * m_height * m_height);
+
+		double x1 = 0.0f;
+		double y1 = 0.0f;
+		if (true) {   //直线
+			double angle = m_nStartAngle - 90.0f;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvY, hvX, hvIsOverlapping;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 0, -100, 0, 100, &hvY, &hvX, &hvIsOverlapping);
+			x1 = hvX[0].D();
+			y1 = hvY[0].D();
+		}
+
+		double x2 = 0.0f;
+		double y2 = 0.0f;
+		if (true) {   //直线
+			double angle = m_nEndAngle - 90.0f;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvY, hvX, hvIsOverlapping;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 0, 100, 0, &hvY, &hvX, &hvIsOverlapping);
+			x2 = hvX[0].D();
+			y2 = hvY[0].D();
+		}
+
+		HalconCpp::GenRectangle1(&hRectRegion, 0, 0, y2, x1);
+	}
+	else {
+		double centerX = m_width - 1;
+		double centerY = 0;
+		double radius = sqrt(1.0 * m_width * m_width + 1.0 * m_height * m_height);
+
+		double x1 = 0.0f;
+		double y1 = 0.0f;
+		if (true) {   //直线
+			double angle = m_nStartAngle;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvY, hvX, hvIsOverlapping;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 0, 0, m_height-1, 0, &hvY, &hvX, &hvIsOverlapping);
+			y1 = hvY[0].D();
+		}
+
+		double x2 = 0.0f;
+		double y2 = 0.0f;
+		if (true) {   //直线
+			double angle = m_nEndAngle;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvY, hvX, hvIsOverlapping;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, m_height - 1, -100, m_height - 1, 100, &hvY, &hvX, &hvIsOverlapping);
+			x2 = hvX[0].D();
+			y2 = m_height - 1;
+		}
+
+		HalconCpp::GenRectangle1(&hRectRegion, y1, x1, y2, x2);
+	}
+#endif   
+}
+
+void CRcutDotProcess::ImageBinThreshold(HalconCpp::HObject &hImage, HalconCpp::HObject &hRectRegion, HalconCpp::HObject &hRcutRegion, HalconCpp::HObject &hTarget) {
+	/* code */
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) {
+		HalconCpp::GenEmptyObj(&hTarget);
+		return;
+	}
+
+	//1. 图像分割
+	HalconCpp::HObject hProcObject, hBinRegion;
+	HalconCpp::ReduceDomain(hImage, hRectRegion, &hProcObject);
+	HalconCpp::Threshold(hProcObject, &hBinRegion, 0, m_nChipThres);
+
+	//2. 图像合并
+	HalconCpp::HObject hTempRegion, hUionRegion, hConRegion;
+	HalconCpp::ConcatObj(hRcutRegion, hBinRegion, &hTempRegion);
+	HalconCpp::Union1(hTempRegion, &hUionRegion);
+	HalconCpp::Connection(hUionRegion, &hConRegion);
+	HalconCpp::SelectShape(hConRegion, &hTarget, "area", "and", 500, MAXINT);
+}
+
+bool CRcutDotProcess::getRCutRealRegion(HalconCpp::HObject &hSelectRegion, std::vector<Point2D> vPoints, HalconCpp::HObject &hTarget) {
+	/* code */
+	int num = (int)(vPoints.size());
+	if (num < 3) return false;
+
+	HalconCpp::HObject hSelRegion;
+	HalconCpp::HTuple hvIndex, hvLength;
+	HalconCpp::GenEmptyObj(&hSelRegion);
+
+	//1. 第一个点
+	HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[1].y, (int)vPoints[1].x, &hvIndex);
+	HalconCpp::TupleLength(hvIndex, &hvLength);
+	if (hvLength[0].I() > 0) {
+		if (hvIndex[0].I() >= 1) {
+			HalconCpp::SelectObj(hSelectRegion, &hSelRegion, hvIndex[0].I());
+		}
+	}
+
+	//2. 中间点
+	int idx = (int)((num - 1) / 2);
+	HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[idx].y, (int)vPoints[idx].x, &hvIndex);
+	HalconCpp::TupleLength(hvIndex, &hvLength);
+	if (hvLength[0].I() > 0) {
+		if (hvIndex[0].I() >= 1) {
+			HalconCpp::HObject hTempRegion, hTempRegion1;
+			HalconCpp::SelectObj(hSelectRegion, &hTempRegion, hvIndex[0].I());
+			HalconCpp::ConcatObj(hTempRegion, hSelRegion, &hTempRegion1);
+			hSelRegion.Clear();
+			hSelRegion = hTempRegion1;
+		}
+	}
+
+	//3. 最后一个
+	HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[num - 2].y, (int)vPoints[num - 2].x, &hvIndex);
+	HalconCpp::TupleLength(hvIndex, &hvLength);
+	if (hvLength[0].I() > 0) {
+		if (hvIndex[0].I() >= 1) {
+			HalconCpp::HObject hTempRegion, hTempRegion1;
+			HalconCpp::SelectObj(hSelectRegion, &hTempRegion, hvIndex[0].I());
+			HalconCpp::ConcatObj(hTempRegion, hSelRegion, &hTempRegion1);
+			hSelRegion.Clear();
+			hSelRegion = hTempRegion1;
+		}
+	}
+	HalconCpp::Union1(hSelRegion, &hTarget);
+	return true;
+}
+
+void CRcutDotProcess::AnalysisStartEndPoints(std::vector<Point2D>& vStartPoints, std::vector<Point2D>& vEndPoints, std::vector<Point2D>& vResPoints) {
+	/* code */
+	int sz = (int)(vStartPoints.size());
+	if (sz < 3) return;
+
+	//1. 计算平均距离
+	double fAvgDist = 0.0f;
+	for (int i = 0; i < sz; i++) {
+		double dx = vEndPoints[i].x - vStartPoints[i].x;
+		double dy = vEndPoints[i].y - vStartPoints[i].y;
+		double dist = sqrt(dx * dx + dy * dy);
+		fAvgDist += dist;
+	}
+	fAvgDist = fAvgDist / sz;
+
+#if 0
+	//2. 输出打印数据
+	Log_GetDebug()->TraceInfo("RCut Avg: %.1f, %d", fAvgDist, __LINE__);
+	for (int i = 0; i < sz; i++) {
+		double dx = vEndPoints[i].x - vStartPoints[i].x;
+		double dy = vEndPoints[i].y - vStartPoints[i].y;
+		double dist = sqrt(dx * dx + dy * dy);
+		Log_GetDebug()->TraceInfo("RCut %d: (%.1f, %d), (%.1f, %.1f), (%.1f, %.1f), %d",
+			i + 1, dist, m_nChamferSize,
+			vStartPoints[i].x, vStartPoints[i].y, vEndPoints[i].x, vEndPoints[i].y,
+			__LINE__);
+	}
+#endif
+
+	//3. 对于均值
+	for (int i = 0; i < sz; i++) {
+		double dx = vEndPoints[i].x - vStartPoints[i].x;
+		double dy = vEndPoints[i].y - vStartPoints[i].y;
+		double dist = sqrt(dx * dx + dy * dy);
+		if (dist > 1.2 * fAvgDist) continue;
+
+		Point2D ptStart = vStartPoints[i];
+		Point2D ptEnd = vEndPoints[i];
+		Point2D ptResult = ptEnd;
+		if (dist < fAvgDist) {
+			//+2.5
+			ptResult = ReflectPoint(ptStart, ptEnd, 3.0f);
+		}
+		else {
+			//+1
+            ptResult = ReflectPoint(ptStart, ptEnd, 2.0f);
+		}
+		vEndPoints[i] = ptResult;
+		Point2D ptRes;
+		ptRes.x = (ptStart.x + ptEnd.x) / 2;
+		ptRes.y = (ptStart.y + ptEnd.y) / 2;
+		vResPoints[i] = ptRes;
+	}
+
+	double fSumDist = 0.0f;
+	for (int i = 0; i < sz; i++) {
+		double dx = vEndPoints[i].x - vStartPoints[i].x;
+		double dy = vEndPoints[i].y - vStartPoints[i].y;
+		double dist = sqrt(dx * dx + dy * dy);
+		fSumDist += dist;
+	}
+	m_fAvgChamber = fSumDist / sz;
+}
+
+Point2D CRcutDotProcess::ReflectPoint(Point2D ptStart, Point2D ptEnd, double offset) {
+	/* code */
+	Point2D ptResult = ptEnd;
+	double dx = ptEnd.x - ptStart.x;
+	double dy = ptEnd.y - ptStart.y;
+	double dist = sqrt(dx * dx + dy * dy);
+	Point2D pose;
+	std::vector<Point2D> vPtStd, vPtReal;
+	pose.x = 0.0f;
+	pose.y = 0.0f;
+	vPtStd.push_back(pose);
+	pose.x = dist;
+	pose.y = 0.0f;
+	vPtStd.push_back(pose);
+	vPtReal.push_back(ptStart);
+	vPtReal.push_back(ptEnd);
+
+	ParaAffine2D affine = ClsVision::VectorToRigid(vPtStd, vPtReal);
+	pose.x = dist + offset;
+	pose.y = 0.0f;
+	ptResult = ClsVision::CoordinateTransform(pose, affine);
+
+	return ptResult;
+}
+
+void CRcutDotProcess::InspectTopChip(HalconCpp::HObject &hImage) {
+	/* code */
+	if (1 != m_id) return;
+
+	double maxDist = 0.0f;
+	double minDist = 0.0f;
+	std::vector<Point2D> vStartPoints;
+	std::vector<Point2D> vEndPoints;
+	std::vector<Point2D> vResPoints;
+	if (!getRcutEdgePoints(hImage, vStartPoints, vEndPoints, vResPoints, maxDist, minDist)) return;
+	m_fMaxChamber = maxDist;
+	m_fMinChamber = minDist;
+
+	AnalysisStartEndPoints(vStartPoints, vEndPoints, vResPoints);
+
+	//int width = 0;
+	//int height = 0;
+	//ClsVision::GetImageSize(hImage, width, height);
+	//HalconCpp::HWindow hDispWin(0, 0, width, height);
+	//hDispWin.SetPart(0, 0, height - 1, width - 1);
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hImage);
+
+	//int sz = (int)(vStartPoints.size());
+	//for (int i = 0; i < sz; i++) {
+	//	HalconCpp::HObject dispObject1, dispObject2;
+	//	HalconCpp::GenCrossContourXld(&dispObject1, vStartPoints[i].y, vStartPoints[i].x, 15, 0);
+	//	HalconCpp::GenCrossContourXld(&dispObject2, vEndPoints[i].y, vEndPoints[i].x, 15, 0);
+	//	hDispWin.DispObj(dispObject1);
+	//	hDispWin.DispObj(dispObject2);
+	//}
+	//hDispWin.Click();
+
+	HalconCpp::HObject hContourRegion, hChipRegion;
+	if (!getRCutRegion(vStartPoints, vEndPoints, hContourRegion, hChipRegion)) return;
+	m_hRoiRegion = hContourRegion;
+	m_hChipRegion = hChipRegion;
+
+	//hDispWin.SetDraw("fill");
+	//hDispWin.DispObj(hContourRegion);
+	//hDispWin.Click();
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hChipRegion);
+	//hDispWin.Click();
+	
+	HalconCpp::HObject hRectRegion, hSelectRegion;
+	genRectangeRegion(hRectRegion);
+	ImageBinThreshold(hImage, hRectRegion, hContourRegion, hSelectRegion);
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hSelectRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HObject hRealRegion;
+	if (!getRCutRealRegion(hSelectRegion, vResPoints, hRealRegion)) return;
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hRealRegion);
+	//hDispWin.Click();
+
+	InpsectChipRegion(hRealRegion, hChipRegion);
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(m_hResultRegion);
+	//hDispWin.Click();
+}
+
+void CRcutDotProcess::InpsectChipRegion(HalconCpp::HObject &hChipRegion, HalconCpp::HObject &hRoiRegion) {
+	/* code */
+	if (m_xMmvsp < 0.001 || m_yMmvsp < 0.001) return;
+
+	int fzX = (int)(m_nDx / m_xMmvsp + 0.5f);
+	int fzY = (int)(m_nDy / m_yMmvsp + 0.5f);
+
+	HalconCpp::HObject hTempRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hUionRegion, hResRegion, hOpenRegion;
+	HalconCpp::Intersection(hChipRegion, hRoiRegion, &hTempRegion);
+	if (m_nEdgeSmooth > 0) {
+		HalconCpp::OpeningCircle(hTempRegion, &hOpenRegion, m_nEdgeSmooth + 0.5);
+	}
+	else {
+		hOpenRegion = hTempRegion;
+	}	
+	HalconCpp::Connection(hOpenRegion, &hConRegion);
+	HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT);
+	HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT);
+	HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion);
+
+	HalconCpp::Union1(hConcatRegion, &hUionRegion);
+	HalconCpp::Connection(hUionRegion, &hResRegion);
+	int num = ClsVision::ObjectNumber(hResRegion);
+	if (num < 1) return;
+
+	m_hResultRegion = hResRegion;
+}
+
+HalconCpp::HObject& CRcutDotProcess::getImage(void) {
+	/* code */
+	return m_hImage;
+}
+
+HalconCpp::HObject& CRcutDotProcess::getChipRegion(void) {
+	/* code */
+	return m_hChipRegion;
+}
+
+HalconCpp::HObject& CRcutDotProcess::getRoiRegion(void) {
+	/* code */
+	return m_hRoiRegion;
+}
+
+HalconCpp::HObject& CRcutDotProcess::getBRKRoiRegion(void) {
+	/* code */
+    return m_hBrkRoiRegion;
+}
+
+void CRcutDotProcess::SetStandardPoint(void) {
+	/* code */
+	if (1 != m_nTech) return;
+
+	for (int i = 0; i < 16; i++) {
+		m_ptArrayStd[i] = m_ptArrayResult[i];
+	}
+}
+
+Json::Value CRcutDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+	Json::Value jsValue;
+	jsValue["alg type"] = RCUT_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["use"] = m_nUse;
+	jsValue["pos x"] = m_nPoseX;
+	jsValue["pos y"] = m_nPoseY;
+	jsValue["width"] = m_width;
+	jsValue["height"] = m_height;
+	jsValue["chamber size"] = m_nChamferSize;
+	jsValue["chamber range"] = m_nChipRange;
+	jsValue["chamber thres"] = m_nChipThres;
+	jsValue["start angle"] = m_nStartAngle;
+	jsValue["end angle"] = m_nEndAngle;
+	jsValue["dx"] = m_nDx;
+	jsValue["dy"] = m_nDy;
+	jsValue["bin thres"] = m_nBinThres;
+	jsValue["edge smooth"] = m_nEdgeSmooth;
+
+	jsValue["Broken use"] = m_nBrokenUse;
+    jsValue["Auto sigma"] = m_fSigmaThres;
+    jsValue["Tech Para"] = m_nTech;
+    jsValue["Dist thres"] = m_nDistThres;
+    jsValue["Broken smooth"] = m_nBrokenSmooth;
+    jsValue["Broken area"] = m_nBrokenArea;
+	jsValue["Noise Size"] = m_fOpenPara;
+
+	jsValue["Start Da"] = m_nStartDa;
+	jsValue["End Da"] = m_nEndDa;
+
+	for (int i = 0; i < 16; i++) {
+		std::string str = ClsVision::FormatString("PosX%d", i);
+		jsValue[str.c_str()] = m_ptArrayStd[i].x;
+		str = ClsVision::FormatString("PosY%d", i);
+		jsValue[str.c_str()] = m_ptArrayStd[i].y;
+	}
+
+	return jsValue;
+}
+
+void CRcutDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseX = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseY = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. width
+	strName = "width";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_width = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. height
+	strName = "height";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_height = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. chamber size
+	strName = "chamber size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nChamferSize = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. chamber range
+	strName = "chamber range";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nChipRange = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. chamber thres
+	strName = "chamber thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nChipThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. start angle
+	strName = "start angle";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nStartAngle = jsValue[strName.c_str()].asInt();
+	}
+
+	//13. end angle
+	strName = "end angle";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEndAngle = jsValue[strName.c_str()].asInt();
+	}
+
+	//14. dx
+	strName = "dx";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nDx = jsValue[strName.c_str()].asInt();
+	}
+
+	//15. dy
+	strName = "dy";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nDy = jsValue[strName.c_str()].asInt();
+	}
+
+	//16. bin thres
+	strName = "bin thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nBinThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//17. edge smooth
+	strName = "edge smooth";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEdgeSmooth = jsValue[strName.c_str()].asInt();
+	}
+
+	//18. Broken use
+    strName = "Broken use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nBrokenUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//19. Auto Sigma
+    strName = "Auto sigma";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+        m_fSigmaThres = jsValue[strName.c_str()].asDouble();
+	}
+
+	//20. Gray thres
+    strName = "Tech Para";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+        m_nTech = jsValue[strName.c_str()].asInt();
+	}
+
+	//21. Dist thres
+    strName = "Dist thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+        m_nDistThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//22. Broken smooth
+    strName = "Broken smooth";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+        m_nBrokenSmooth = jsValue[strName.c_str()].asInt();
+	}
+
+	//23. Broken area
+    strName = "Broken area";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+        m_nBrokenArea = jsValue[strName.c_str()].asInt();
+	}
+
+	//24. Noise Size
+	strName = "Noise Size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+		m_fOpenPara = jsValue[strName.c_str()].asDouble();
+	}
+
+	//25. Start Da
+	strName = "Start Da";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nStartDa = jsValue[strName.c_str()].asInt();
+	}
+
+	//26. End Da
+	strName = "End Da";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEndDa = jsValue[strName.c_str()].asInt();
+	}
+
+	for (int i = 0; i < 16; i++) {
+		strName = ClsVision::FormatString("PosX%d", i);
+		if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+			m_ptArrayStd[i].x = jsValue[strName.c_str()].asDouble();
+
+		}
+		
+		strName = ClsVision::FormatString("PosY%d", i);
+		if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+			m_ptArrayStd[i].y = jsValue[strName.c_str()].asDouble();
+		}
+	}
+
+	if (abs(m_nStartDa) < 1) {
+		m_nStartDa = m_nStartAngle;
+	}
+	if (abs(m_nEndDa) < 1) {
+		m_nEndDa = m_nEndAngle;
+	}
+}
+
+int CRcutDotProcess::CheckBroken(HalconCpp::HObject& hImage, HalconCpp::HObject& hRoiRegion) {
+	/* code */
+	if (1 != m_nBrokenUse) return 0;
+	if (!ClsVision::ObjectExist(hImage)) return 0;
+
+	int minSize = (int)(m_fOpenPara + 0.5f);
+	if (minSize < 3) {
+		minSize = 3;
+	}
+
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return -1;
+
+#if RCUT_DEBUG_CODE
+	int hWidth = (int)(0.5 * width);
+	int hHeight = (int)(0.5 * height);
+	HalconCpp::HWindow hDispWin(0, 0, hWidth, hHeight);
+	hDispWin.SetPart(0, 0, height - 1, width - 1);
+	hDispWin.SetColored(6);
+#endif
+
+	//第一步,进行分割,获取目标点的有效区域
+	int xTarget = minSize;
+	int yTarget = minSize;
+	if (1 != m_id)  yTarget = height - (minSize+1);
+    HalconCpp::HObject hRegions;
+	HalconCpp::AutoThreshold(hImage, &hRegions, m_fSigmaThres);
+
+#if RCUT_DEBUG_CODE
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hRegions);
+	hDispWin.Click();
+#endif
+
+	HalconCpp::HTuple hvIndex, hvNum;
+	HalconCpp::GetRegionIndex(hRegions, yTarget, xTarget, &hvIndex);
+	hvNum = hvIndex.TupleLength();
+	int nNum = hvNum[0].I();
+	if (nNum < 1) return 0;
+	nNum = ClsVision::ObjectNumber(hRegions);
+
+	//备份序号,后面分析进行屏蔽
+	int idxSelect = hvIndex[0].I();
+	if (idxSelect < 1) return 0;
+	HalconCpp::HObject hSelectRegion, hConnectRegion, hSelRg, hSelROI;
+	HalconCpp::SelectObj(hRegions, &hSelectRegion, idxSelect);
+
+#if RCUT_DEBUG_CODE
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hSelectRegion);
+	hDispWin.Click();
+#endif
+
+	HalconCpp::Connection(hSelectRegion, &hConnectRegion);
+	HalconCpp::GetRegionIndex(hConnectRegion, yTarget, xTarget, &hvIndex);
+	hvNum = hvIndex.TupleLength();
+	if (hvNum[0].I() < 1) return 0;
+
+	//消除赛选区域的毛刺,避免影响处理
+	HalconCpp::SelectObj(hConnectRegion, &hSelRg, hvIndex[0].I());
+	if (m_fOpenPara < 1.0f) {
+		hRoiRegion = hSelRg;
+		return 1;
+	}
+
+	HalconCpp::HObject hOpenRg,hConRg;
+	HalconCpp::OpeningCircle(hSelRg, &hOpenRg, m_fOpenPara);
+
+#if RCUT_DEBUG_CODE
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hOpenRg);
+	hDispWin.Click();
+#endif
+
+	HalconCpp::Connection(hOpenRg, &hConRg);
+	HalconCpp::GetRegionIndex(hConRg, yTarget, xTarget, &hvIndex);
+	hvNum = hvIndex.TupleLength();
+	if (hvNum[0].I() < 1) return 0;
+
+
+    HalconCpp::SelectObj(hConRg, &hRoiRegion, hvIndex[0].I());
+
+#if RCUT_DEBUG_CODE
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hRoiRegion);
+	hDispWin.Click();
+#endif
+	
+	return 1;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/RcutDotProcess.h b/BlVisionPro/Vision/RcutDotProcess.h
new file mode 100644
index 0000000..7eab196
--- /dev/null
+++ b/BlVisionPro/Vision/RcutDotProcess.h
@@ -0,0 +1,147 @@
+#ifndef RCUT_DOT_PROCESS_H
+#define RCUT_DOT_PROCESS_H
+
+class CRcutDotProcess
+{
+public:
+	CRcutDotProcess();
+	CRcutDotProcess(DimensionDir eDir, int id);
+	~CRcutDotProcess();
+
+public:
+	//1. 获取区域
+	void getRegion(int &xPos, int &yPos, int &width, int &height);
+	void setRegion(int xPos, int yPos, int width, int height);
+
+	//2. 获取ID
+	int getID(void);
+	void setID(int id);
+
+	//3. 获取区域
+	HalconCpp::HObject& getImage(void);
+	HalconCpp::HObject& getChipRegion(void);
+	HalconCpp::HObject& getRoiRegion(void);
+	HalconCpp::HObject& getBRKRoiRegion(void);
+	void SetStandardPoint(void);
+
+	//4. 执行检测
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//5. 区域示教
+	void TechImage(void);
+
+	//6. 保存数据
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+
+public:
+	int m_nUse;
+	CString m_strName;
+
+	int m_nChamferSize;            //研磨量
+	int m_nChipRange;           //Chip Range     
+	int m_nChipThres;           //Chip阈值
+
+	int m_nStartAngle;         //开始角度
+	int m_nEndAngle;           //结束角度
+
+	int m_nBinThres;         //边界阈值
+	int m_nEdgeSmooth;        //边界阈值
+
+	//Judge XY
+	int m_nDx;
+	int m_nDy;
+
+
+	std::vector<NgDotInfo> m_nNgInfo;
+	double m_fMaxChamber;
+	double m_fMinChamber;
+	double m_fAvgChamber;
+
+	//Broken区域的检测
+	int m_nBrokenUse;
+	double m_fSigmaThres;   //Sigma阈值
+	double m_fOpenPara;     //噪音参数
+	int m_nDistThres;       //距离阈值
+	int m_nBrokenSmooth;    //破损平滑阈值
+	int m_nBrokenArea;      //破损区域
+	int m_nTech;           //示教参数
+	int m_nStartDa;
+	int m_nEndDa;
+	
+	Point2D m_ptArrayResult[16];
+	Point2D m_ptArrayStd[16];
+
+private:
+	int m_id;
+	int m_nPoseX;
+	int m_nPoseY;
+	int m_width;
+	int m_height;
+
+	HalconCpp::HObject m_hImage;
+	HalconCpp::HObject m_hRoiRegion;
+	HalconCpp::HObject m_hChipRegion;
+
+	HalconCpp::HObject m_hBrkRoiRegion;
+	
+	DimensionDir m_eDir;
+	int m_x1;
+	int m_y1;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+	HalconCpp::HObject m_hResultRegion;
+
+private:
+	//1. 获取图像
+	bool getProcImage(DimensionDir eDir, Point2I offset, HalconCpp::HObject &hImage);
+
+	//2. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+
+	//3. 获取结果
+	void getResult(void);
+
+	//4. 获取廓形
+	void InspectChip(HalconCpp::HObject &hImage);
+
+	//5. Top检测
+	void InspectTopChip(HalconCpp::HObject &hImage);
+
+	//6. Bot检测
+	void InspectBotChip(HalconCpp::HObject &hImage);
+
+	//7. 获取R角度的尺寸轮廓
+	bool getRCutRegion(std::vector<Point2D> vStartPoints, std::vector<Point2D> vEndPoints, HalconCpp::HObject &hTargetRegion, HalconCpp::HObject &hRoiRegion);
+
+	//8. 生产区域
+	void genRectangeRegion(HalconCpp::HObject &hRectRegion);
+
+	//9. 图像分割
+	void ImageBinThreshold(HalconCpp::HObject &hImage, HalconCpp::HObject &hRectRegion, HalconCpp::HObject &hRcutRegion, HalconCpp::HObject &hTarget);
+
+	//10. 获取真实的RCUT框
+	bool getRCutRealRegion(HalconCpp::HObject &hSelectRegion, std::vector<Point2D> vPoints, HalconCpp::HObject &hTarget);
+
+	//11. 获取点阵序列
+	bool getRcutEdgePoints(HalconCpp::HObject &hImage, std::vector<Point2D> &vStartPoints, std::vector<Point2D> &vEndPoints, std::vector<Point2D> &vResPoints, double &maxDist, double &minDist);
+
+	//12. 执行区域
+	void InpsectChipRegion(HalconCpp::HObject &hChipRegion, HalconCpp::HObject &hRoiRegion);
+
+	//13. 检查Broken
+	int CheckBroken(HalconCpp::HObject& hImage, HalconCpp::HObject &hRoiRegion);
+
+	//14. 分析起始点和结束点
+	void AnalysisStartEndPoints(std::vector<Point2D>& vStartPoints, std::vector<Point2D>& vEndPoints, std::vector<Point2D>& vResPoints);
+
+	//15. 反射变换点
+	Point2D ReflectPoint(Point2D ptStart, Point2D ptEnd, double offset);
+
+	//16. 分析破片
+	void AnalysisBroken(HalconCpp::HObject& hImage);
+};
+
+#endif
diff --git a/BlVisionPro/Vision/Serializer.cpp b/BlVisionPro/Vision/Serializer.cpp
new file mode 100644
index 0000000..eff4c41
--- /dev/null
+++ b/BlVisionPro/Vision/Serializer.cpp
@@ -0,0 +1,212 @@
+#include "stdafx.h"
+#include "Serializer.h"
+
+
+CSerializer::CSerializer() {
+	/* code */
+}
+
+
+CSerializer::~CSerializer() {
+	/* code */
+}
+
+int CSerializer::SerializedInt32(int& i, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(int)) {
+		return -1;
+	}
+
+	memcpy(pBuffer, &i, sizeof(int));
+	return sizeof(int);
+}
+
+int CSerializer::SerializedInt64(__int64& i, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(__int64)) {
+		return -1;
+	}
+
+	memcpy(pBuffer, &i, sizeof(__int64));
+	return sizeof(__int64);
+}
+
+int CSerializer::SerializedFloat(float& f, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(float)) {
+		return -1;
+	}
+
+	memcpy(pBuffer, &f, sizeof(float));
+	return sizeof(float);
+}
+
+int CSerializer::SerializedDouble(double& d, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(double)) {
+		return -1;
+	}
+
+	memcpy(pBuffer, &d, sizeof(double));
+	return sizeof(double);
+}
+
+int CSerializer::SerializedBuffer(void*pScrBuffer, int scrSize, void* pBuffer, int size) {
+	/* code */
+	if (size < scrSize) {
+		return -1;
+	}
+
+	memcpy(pBuffer, pScrBuffer, scrSize);
+	return scrSize;
+}
+
+int CSerializer::SerializedString(std::string& str, void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+
+	int len = (int)(str.length());
+	int nRet1 = SerializedInt32(len, pTemp, remainSize);
+	if (nRet1 < 0) {
+		return nRet1;
+	}
+	pTemp += nRet1;
+	remainSize -= nRet1;
+
+	int nRet2 = SerializedBuffer((void*)str.c_str(), len, pTemp, remainSize);
+	if (nRet2 < 0) {
+		return nRet2;
+	}
+
+	return nRet1 + nRet2;
+}
+
+int CSerializer::SerializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size) {
+	/*code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+
+	HalconCpp::HTuple hPoint, hSize;
+	HalconCpp::HTuple hSerializedItem;
+	HalconCpp::SerializeObject(hObject, &hSerializedItem);
+	HalconCpp::GetSerializedItemPtr(hSerializedItem, &hPoint, &hSize);
+
+	int len = hSize[0].I();
+	int nRet1 = SerializedInt32(len, pTemp, remainSize);
+	if (nRet1 < 0) {
+		HalconCpp::ClearSerializedItem(hSerializedItem);
+		return nRet1;
+	}
+	pTemp += nRet1;
+	remainSize -= nRet1;
+
+	if (remainSize < hSize[0].I()) {
+		HalconCpp::ClearSerializedItem(hSerializedItem);
+		return -1;
+	}
+
+	memcpy(pTemp, (void*)hPoint.L(), hSize[0].I());
+	return nRet1 + hSize[0].I();
+}
+
+int CSerializer::DeserializedInt32(int& i, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(int)) {
+		return -1;
+	}
+
+	memcpy(&i, pBuffer, sizeof(int));
+	return sizeof(int);
+}
+
+int CSerializer::DeserializedInt64(__int64& i, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(__int64)) {
+		return -1;
+	}
+
+	memcpy(&i, pBuffer, sizeof(__int64));
+	return sizeof(__int64);
+}
+
+int CSerializer::DeserializedFloat(float& f, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(float)) {
+		return -1;
+	}
+
+	memcpy(&f, pBuffer, sizeof(float));
+	return sizeof(float);
+}
+
+int CSerializer::DeserializedDouble(double& d, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(double)) {
+		return -1;
+	}
+
+	memcpy(&d, pBuffer, sizeof(double));
+	return sizeof(double);
+}
+
+int CSerializer::DeserializedBuffer(void*pTarBuffer, int tarSize, void* pBuffer, int size) {
+	/*code */
+	if (size < tarSize) {
+		return -1;
+	}
+
+	memcpy(pTarBuffer, pBuffer, tarSize);
+	return tarSize;
+}
+
+int CSerializer::DeserializedString(std::string& str, void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+
+	int len = 0;
+	int nRet1 = DeserializedInt32(len, pTemp, remainSize);
+	if (nRet1 < 0) {
+		return nRet1;
+	}
+	pTemp += nRet1;
+	remainSize -= nRet1;
+
+	char* pszTemp = new char[len];
+	int nRet2 = DeserializedBuffer(pszTemp, len, pTemp, remainSize);
+	if (nRet2 < 0) {
+		delete[] pszTemp;
+		return nRet2;
+	}
+	str.clear();
+	str.append(pszTemp, len);
+	delete[] pszTemp;
+
+	return nRet1 + nRet2;
+}
+
+int CSerializer::DeserializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+
+	int len = 0;
+	int nRet1 = DeserializedInt32(len, pTemp, remainSize);
+	if (nRet1 < 0) {
+		return nRet1;
+	}
+	pTemp += nRet1;
+	remainSize -= nRet1;
+
+
+	if (remainSize < len) {
+		return nRet1;
+	}
+
+	HalconCpp::HTuple hSerializedItem;
+	HalconCpp::CreateSerializedItemPtr((__int64)pTemp, len, "false", &hSerializedItem);
+	HalconCpp::DeserializeObject(&hObject, hSerializedItem);
+
+	return nRet1 + len;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/Serializer.h b/BlVisionPro/Vision/Serializer.h
new file mode 100644
index 0000000..5091abb
--- /dev/null
+++ b/BlVisionPro/Vision/Serializer.h
@@ -0,0 +1,39 @@
+#ifndef SERIALIZER_H
+#define SERIALIZER_H
+
+#define SERIALIZER_INT_32(i, p, r, uu) nRet = CSerializer::SerializedInt32(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define SERIALIZER_INT_64(i, p, r, uu) nRet = CSerializer::SerializedInt64(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define SERIALIZER_DOUBLE(d, p, r, uu) nRet = CSerializer::SerializedDouble(d, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define SERIALIZER_H_OBJECT(h, p, r, uu) nRet = CSerializer::SerializedHobject(h, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define SERIALIZER_STRING(s, p, r, uu) nRet = CSerializer::SerializedString(s, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_INT_32(i, p, r, uu) nRet = CSerializer::DeserializedInt32(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_INT_64(i, p, r, uu) nRet = CSerializer::DeserializedInt64(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_DOUBLE(d, p, r, uu) nRet = CSerializer::DeserializedDouble(d, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_STRING(s, p, r, uu) nRet = CSerializer::DeserializedString(s, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_H_OBJECT(h, p, r, uu) nRet = CSerializer::DeserializedHobject(h, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+
+class CSerializer
+{
+public:
+	CSerializer();
+	~CSerializer();
+
+public:
+	static int SerializedInt32(int& i, void* pBuffer, int size);
+	static int SerializedInt64(__int64& i, void* pBuffer, int size);
+	static int SerializedFloat(float& f, void* pBuffer, int size);
+	static int SerializedDouble(double& d, void* pBuffer, int size);
+	static int SerializedBuffer(void*pScrBuffer, int scrSize, void* pBuffer, int size);
+	static int SerializedString(std::string& str, void* pBuffer, int size);
+	static int SerializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size);
+	static int DeserializedInt32(int& i, void* pBuffer, int size);
+	static int DeserializedInt64(__int64& i, void* pBuffer, int size);
+	static int DeserializedFloat(float& f, void* pBuffer, int size);
+	static int DeserializedDouble(double& d, void* pBuffer, int size);
+	static int DeserializedBuffer(void*pTarBuffer, int tarSize, void* pBuffer, int size);
+	static int DeserializedString(std::string& str, void* pBuffer, int size);
+	static int DeserializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size);
+};
+
+#endif
+
diff --git a/BlVisionPro/Vision/SoftVisionApp.cpp b/BlVisionPro/Vision/SoftVisionApp.cpp
new file mode 100644
index 0000000..221828f
--- /dev/null
+++ b/BlVisionPro/Vision/SoftVisionApp.cpp
@@ -0,0 +1,794 @@
+#include "stdafx.h"
+#include "SoftVisionApp.h"
+#include "VisionSetDlg.h"
+#include "VisionRecipe.h"
+#include "BlSideData.h"
+#include "VisionBufferPro.h"
+#include "KeyVisionSetDlg.h"
+#include "TranformCoordinate.h"
+#include "CornerRcutProcess.h"
+#include "FileRecipe.h"
+#include "resource.h"
+#include "BlVisionPro.h"
+#include "ThresProcess.h"
+
+CSoftVisionApp::CSoftVisionApp(){
+	/* code */
+	m_pEvent = nullptr;
+	InitializeCriticalSection(&m_criticalSection);
+}
+
+CSoftVisionApp::~CSoftVisionApp(){
+	/* code */
+	DeleteCriticalSection(&m_criticalSection);
+}
+
+static CSoftVisionApp _gSoftVisionApp;
+CSoftVisionApp* CSoftVisionApp::getInstance(void) {
+	/* code */
+	return &_gSoftVisionApp;
+}
+
+int CSoftVisionApp::OpenVisionWindow(void) {
+	/* code */
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+	CVisionSetDlg dlg;
+	dlg.DoModal();
+	int nRet = (int)(::GetLastError());
+	return nRet;
+}
+
+CDialogEx* CSoftVisionApp::CreateVisionWindow(void) {
+	/* code */
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+	CVisionSetDlg *pDlg = new CVisionSetDlg();
+	pDlg->Create(IDD_DIALOG_VISION_SET, NULL);
+
+	return (CDialogEx*)(pDlg);
+}
+
+int CSoftVisionApp::ReleaseWindow(CDialogEx *pDlg) {
+	/* code */
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+	CVisionSetDlg *pVisionSetDlg = (CVisionSetDlg *)(pDlg);
+	if (NULL == pVisionSetDlg) {
+		pVisionSetDlg->DestroyWindow();
+		delete pVisionSetDlg;
+		pVisionSetDlg = nullptr;
+	}
+	return 0;
+}
+
+void CSoftVisionApp::ChangeDimension(CDialogEx *pDlg, int nDir) {
+	/* code */
+	if (!CVisionRecipe::getInstance()->getVisionSetOpen()) return;
+
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+	CVisionSetDlg *pVisionSetDlg = (CVisionSetDlg *)(pDlg);
+	if (NULL == pVisionSetDlg) return;
+	if (!CVisionRecipe::getInstance()->getVisionSetOpen()) return;
+
+	DimensionDir eDir = (DimensionDir)(nDir);
+	pVisionSetDlg->ChangeDimension(eDir);
+}
+
+void CSoftVisionApp::SetVisionOpen(BOOL isOpen) {
+	/* code */
+	CVisionRecipe::getInstance()->setVisionSetOpen(isOpen);
+}
+
+void CSoftVisionApp::OpenKeySetWindow(void) {
+	/* code */
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+	CKeyVisionSetDlg dlg;
+	dlg.DoModal();
+}
+
+Point2I CSoftVisionApp::getPose(int eDir, int xPoxPxl, int yPosPxl) {
+	/* code */
+	CTranformCoordinate tranform;
+	Point2I pose;
+	pose.x = xPoxPxl;
+	pose.y = yPosPxl;
+
+	return tranform.Execute((DimensionDir)eDir, pose);
+}
+
+int CSoftVisionApp::Execute(int eDir, NgInfo *ngArray) {
+	/* code */
+	DimensionDir nDir = (DimensionDir)(eDir);
+	KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo();
+	int nRet = 0;
+
+	//1. 视觉定位
+	if (0 != ExecuteLoc(nDir)) {
+		return nRet;
+	}
+
+	//2. GrindSize
+	if (0 == ExecuteGrind(nDir)) {
+		nRet = getGrindResult(nDir ,ngArray);
+	}
+
+
+	//3. Dist
+	if (0 == ExecuteDist(nDir)) {            //获取数据缺陷的数据
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getDistResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	//4. CutLine
+	if (0 == ExecuteCut(nDir)) {
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getCutResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	//5. Rcut
+	if (0 == ExecuteRCUT(nDir)){
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getRcutResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	//6. Thres
+	if (0 == ExecuteThres(nDir)) {
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getThresResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	//7. Hole
+	if (0 == ExecuteHole(nDir)) {
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getHoleResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	return nRet;
+}
+
+//5. 设置回调时间
+void CSoftVisionApp::setImageEventSignal(IVisionEvent *pEvent) {
+	/* code */
+	m_pEvent = pEvent;
+}
+
+Point2I CSoftVisionApp::getPointCoor(DimensionDir dir, Point2I point, Point2I ptTop, Point2I ptBot, Point2I bzTopPoint, Point2I bzBotPoint, int nType) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(dir);
+	double xMmvsp = pSideData->m_dPixelSizeX;
+	double yMmvsp = pSideData->m_dPixelSizeY;
+	std::vector<Point2D> vPtOrigine, vPtReal;
+	Point2D pose;
+	pose.x = ptTop.x * xMmvsp;
+	pose.y = ptTop.y * yMmvsp;
+	vPtReal.push_back(pose);
+    pose.x = ptBot.x * xMmvsp;
+    pose.y = ptBot.y * yMmvsp;
+	vPtReal.push_back(pose);
+
+	pose.x = bzTopPoint.x;
+	pose.y = bzTopPoint.y;
+	vPtOrigine.push_back(pose);
+    pose.x = bzBotPoint.x;
+	pose.y = bzBotPoint.y;
+    vPtOrigine.push_back(pose);
+
+	Point2D poseReal;
+    poseReal.x = point.x * xMmvsp;
+	poseReal.y = point.y * yMmvsp;
+
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtReal, vPtOrigine);
+	Point2D ptResult = ClsVision::CoordinateTransform(poseReal, affine);
+	Point2I result;
+	if (0 == nType) {
+		result.x = (int)(ptResult.x - bzTopPoint.x);
+		result.y = (int)(ptResult.y - bzTopPoint.y);
+	}
+	else {
+		result.x = (int)(ptResult.x - bzBotPoint.x);
+		result.y = (int)(ptResult.y - bzBotPoint.y);
+	}
+
+	return result;
+
+#if 0
+	Point2D posTop, posBot, pose;
+	posTop.x = 0.0f;
+	posTop.y = 0.0f;
+	posBot.x = xMmvsp * (ptBot.x - ptTop.x);
+	posBot.y = yMmvsp * (ptBot.y - ptTop.y);
+	pose.x = xMmvsp * (point.x - ptTop.x);
+	pose.y = yMmvsp * (point.y - ptTop.y);
+
+	double dx = xMmvsp * (ptBot.x - ptTop.x);
+	double dy = yMmvsp * (ptBot.y - ptTop.y);
+	double dist = sqrt(dx * dx + dy * dy);
+	std::vector<Point2D> vPtOrigine, vPtReal;
+	vPtOrigine.push_back(posTop);
+	vPtOrigine.push_back(posBot);
+
+	Point2D pt;
+	pt.x = 0.0f;
+	pt.y = 0.0f;
+	vPtReal.push_back(pt);
+	pt.x = 0.0f;
+	pt.y = dist;
+	vPtReal.push_back(pt);
+
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtOrigine, vPtReal);
+	Point2D ptResult = ClsVision::CoordinateTransform(pose, affine);
+	Point2I result;
+	if (0 == nType) {
+		result.x = (int)(ptResult.x);
+		result.y = (int)(ptResult.y);
+	}
+	else {
+		result.x = (int)(ptResult.x - vPtReal[1].x);
+		result.y = (int)(ptResult.y - vPtReal[1].y);
+	}
+	return result;
+#endif
+}
+
+bool CSoftVisionApp::transformToStandard(int eDir, Point2I point, Point2I &result, Point2I &topResult, Point2I &botResult) {
+	/* code */
+	topResult.x = 0;
+	topResult.y = 0;
+	botResult.x = 0;
+	botResult.y = 0;
+	result.x = 0;
+	result.y = 0;
+	DimensionDir eCurDir = (DimensionDir)(eDir);
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eCurDir);
+	if (NULL == pSideData) return false;
+
+	//1. 首先计算mark line
+	if (pSideData->m_bTopMark_Find && pSideData->m_bBotMark_Find){    //计算
+		Point2I ptTop = pSideData->getPose(0);
+		Point2I ptBot = pSideData->getPose(1);
+		Point2I bzTop = pSideData->m_mTopBzMark;
+		Point2I bzBot = pSideData->m_mBotBzMark;
+		result = getPointCoor(eCurDir, point, ptTop, ptBot, bzTop, bzBot, 0);
+	}
+
+	//2. 计算 Top Point
+	if (pSideData->m_bTopPoint_Find && pSideData->m_bBotPoint_Find) {    //计算
+		Point2I ptTop = pSideData->getPose(2);
+		Point2I ptBot = pSideData->getPose(3);
+		Point2I bzTop = pSideData->m_mTopBzPoint;
+		Point2I bzBot = pSideData->m_mBotBzPoint;
+		topResult = getPointCoor(eCurDir, point, ptTop, ptBot, bzTop, bzBot, 0);
+	}
+
+	//3. 计算Bot Point
+	if (pSideData->m_bTopPoint_Find && pSideData->m_bBotPoint_Find) {    //计算
+		Point2I ptTop = pSideData->getPose(2);
+		Point2I ptBot = pSideData->getPose(3);
+		Point2I bzTop = pSideData->m_mTopBzPoint;
+		Point2I bzBot = pSideData->m_mBotBzPoint;
+		botResult = getPointCoor(eCurDir, point, ptTop, ptBot, bzTop, bzBot, 1);
+	}
+
+	return true;
+}
+
+bool CSoftVisionApp::findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I& result) {
+	/* code */
+	if (toLineDist > 0) return false;
+	if (nEndThres < 1) return false;
+	DimensionDir eDirReal = (DimensionDir)eDir;
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(eDirReal);
+	if (nullptr == pSideData)  return false;
+	if (!pSideData->m_bTopMark_Find)  return false;
+	if (!pSideData->m_bBotMark_Find)  return false;
+	
+	Point2I ptOffset;
+	ptOffset.x = -1 * toLineDist;
+	ptOffset.y = toTopY;
+	Point2I leftPoint;
+	if (!CVisionBufferPro::TransformToReal(eDirReal, ptOffset, 0, leftPoint))  return false;
+
+	double fzSearchRange = 500.0f;
+	int nSearchRange = (int)(fzSearchRange / pSideData->m_dPixelSizeX);
+	Point2I cutResult;
+	if (!CVisionBufferPro::findCutLine(eDirReal, leftPoint, nSearchRange, nEndThres, cutResult)) return false;
+
+	result = cutResult;
+
+	return true;
+}
+
+double CSoftVisionApp::DistancePL(Point2D pose, Line2D line) {
+	/* code */
+	return ClsVision::DistancePL(pose, line);
+}
+
+int CSoftVisionApp::findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres,
+	int szType, int xFzSize, int yFzSize, CRect* aryResult) {
+	/* code */
+	DimensionDir eCurDir = (DimensionDir)eDir;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eCurDir);
+	if (nullptr == pSideData) return 0;
+
+	int xDefectSize = (int)(1.0f * xFzSize / pSideData->m_dPixelSizeX + 0.5f);
+    int yDefectSize = (int)(1.0f * yFzSize / pSideData->m_dPixelSizeY + 0.5f);
+
+	int nRet = CVisionBufferPro::findNorchDefect(eCurDir, vPoints, roiRect, nThres, nOffset, nBinThres, szType, xDefectSize, yDefectSize, aryResult);
+	return nRet;
+}
+
+int CSoftVisionApp::ExecuteLoc(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isLocUse) return -1;
+
+	CLocProcess *dot = pInstance->getLocProcess(eDir);
+	if (NULL == dot) return -1;
+	dot->execute(eDir);
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteGrind(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isGrindUse) return -1;
+
+	CGrindProcess *dot = pInstance->getGrindProcess(eDir);
+	if (NULL == dot) return -1;
+
+	dot->Execute(eDir);
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteDist(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isDistUse) return -1;
+
+	CKDistProcess *dot = pInstance->getKDistProcess(eDir);
+	if (NULL == dot) return -1;
+
+	//设置平台
+	int nStage = pInstance->getStage();
+	int iValue = 0;
+	if (1 == nStage) iValue = 1;
+	dot->SetStage(iValue);
+
+	dot->Execute(eDir);
+
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteCut(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isCutUse) return -1;
+
+	CCutProcess *dot = pInstance->getCutProcess(eDir);
+	if (NULL == dot) return -1;
+
+	dot->Execute(eDir);
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteRCUT(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isRcutUse) return -1;
+
+	CCornerRcutProcess *dot = pInstance->getCornerRcutProcess(eDir);
+	dot->execute(eDir);
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteThres(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isThresUse) return -1;
+
+	CThresProcess *dot = pInstance->getThresProcess(eDir);
+	dot->execute(eDir);
+
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteHole(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isHoleUse) return -1;
+
+	CHoleProcess *dot = pInstance->getHoleProcess(eDir);
+	dot->Execute(eDir);
+
+	return 0;
+}
+
+int CSoftVisionApp::getGrindResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isGrindUse) return 0;
+
+	CGrindProcess *dot = pInstance->getGrindProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 50;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CGrindDotProcess *distDot = dot->m_dots[i];
+		if (NULL == distDot) continue;
+		if (1 != distDot->m_nUse) continue;
+
+		int ngNum = (int)(distDot->m_nNgInfo.size());
+		if (ngNum < 1) continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = distDot->m_nNgInfo[j].eDir;
+			ng.eVision = distDot->m_nNgInfo[j].eVision;
+			ng.isRes = distDot->m_nNgInfo[j].isRes;
+			ng.id = distDot->m_nNgInfo[j].id;
+			ng.minValue = distDot->m_nNgInfo[j].minValue;
+			ng.maxValue = distDot->m_nNgInfo[j].maxValue;
+			ng.result = distDot->m_nNgInfo[j].result;
+			ng.xResult = distDot->m_nNgInfo[j].xResult;
+			ng.yResult = distDot->m_nNgInfo[j].yResult;
+			ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl;
+			ng.x1 = distDot->m_nNgInfo[j].x1;
+			ng.y1 = distDot->m_nNgInfo[j].y1;
+			ng.x2 = distDot->m_nNgInfo[j].x2;
+			ng.y2 = distDot->m_nNgInfo[j].y2;
+			ng.ngType = distDot->m_nNgInfo[j].ngType;
+			ng.strName = distDot->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::getDistResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isDistUse) return 0;
+
+	CKDistProcess *dot = pInstance->getKDistProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 50;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CKeyDistDotProcess *distDot = dot->m_dots[i];
+		if (NULL == distDot) continue;
+		if (1 != distDot->m_nUse) continue;
+
+		int ngNum = (int)(distDot->m_nNgInfo.size());
+		if (ngNum < 1) continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if(idx > NG_INF_NUM-1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = distDot->m_nNgInfo[j].eDir;
+			ng.eVision = distDot->m_nNgInfo[j].eVision;
+			ng.isRes = distDot->m_nNgInfo[j].isRes;
+			ng.id = distDot->m_nNgInfo[j].id;
+			ng.minValue = distDot->m_nNgInfo[j].minValue;
+			ng.maxValue = distDot->m_nNgInfo[j].maxValue;
+			ng.result = distDot->m_nNgInfo[j].result;
+			ng.xResult = distDot->m_nNgInfo[j].xResult;
+			ng.yResult = distDot->m_nNgInfo[j].yResult;
+			ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl;
+			ng.x1 = distDot->m_nNgInfo[j].x1;
+			ng.y1 = distDot->m_nNgInfo[j].y1;
+			ng.x2 = distDot->m_nNgInfo[j].x2;
+			ng.y2 = distDot->m_nNgInfo[j].y2;
+			ng.ngType = distDot->m_nNgInfo[j].ngType;
+			ng.strName = distDot->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::getCutResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isCutUse) return 0;
+
+	CCutProcess *dot = pInstance->getCutProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 50;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CCutDotProcess *distDot = dot->m_dots[i];
+		if (NULL == distDot) continue;
+		if (1 != distDot->m_nUse) continue;
+
+		int ngNum = (int)(distDot->m_nNgInfo.size());
+		if (ngNum < 1) continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = distDot->m_nNgInfo[j].eDir;
+			ng.eVision = distDot->m_nNgInfo[j].eVision;
+			ng.isRes = distDot->m_nNgInfo[j].isRes;
+			ng.id = distDot->m_nNgInfo[j].id;
+			ng.minValue = distDot->m_nNgInfo[j].minValue;
+			ng.maxValue = distDot->m_nNgInfo[j].maxValue;
+			ng.result = distDot->m_nNgInfo[j].result;
+			ng.xResult = distDot->m_nNgInfo[j].xResult;
+			ng.yResult = distDot->m_nNgInfo[j].yResult;
+			ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl;
+			ng.x1 = distDot->m_nNgInfo[j].x1;
+			ng.y1 = distDot->m_nNgInfo[j].y1;
+			ng.x2 = distDot->m_nNgInfo[j].x2;
+			ng.y2 = distDot->m_nNgInfo[j].y2;
+			ng.ngType = distDot->m_nNgInfo[j].ngType;
+			ng.strName = distDot->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::getRcutResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isRcutUse) return 0;
+
+	CCornerRcutProcess *dot = pInstance->getCornerRcutProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 2;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CRcutDotProcess *pRcut = dot->m_dots[i];
+		if (NULL == pRcut) continue;
+		if (1 != pRcut->m_nUse) continue;
+
+		int ngNum = (int)(pRcut->m_nNgInfo.size());
+		if (ngNum < 1)  continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = pRcut->m_nNgInfo[j].eDir;
+			ng.eVision = pRcut->m_nNgInfo[j].eVision;
+			ng.isRes = pRcut->m_nNgInfo[j].isRes;
+			ng.id = pRcut->m_nNgInfo[j].id;
+			ng.minValue = pRcut->m_nNgInfo[j].minValue;
+			ng.maxValue = pRcut->m_nNgInfo[j].maxValue;
+			ng.result = pRcut->m_nNgInfo[j].result;
+			ng.xResult = pRcut->m_nNgInfo[j].xResult;
+			ng.yResult = pRcut->m_nNgInfo[j].yResult;
+			ng.xPosPxl = pRcut->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = pRcut->m_nNgInfo[j].yPosPxl;
+			ng.x1 = pRcut->m_nNgInfo[j].x1;
+			ng.y1 = pRcut->m_nNgInfo[j].y1;
+			ng.x2 = pRcut->m_nNgInfo[j].x2;
+			ng.y2 = pRcut->m_nNgInfo[j].y2;
+			ng.ngType = pRcut->m_nNgInfo[j].ngType;
+			ng.strName = pRcut->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+	
+	return idx;
+}
+
+int CSoftVisionApp::getThresResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isThresUse) return 0;
+
+	CThresProcess *dot = pInstance->getThresProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 12;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CThresDotProcess *pThres = dot->m_dots[i];
+		if (NULL == pThres) continue;
+		if (1 != pThres->m_nUse) continue;
+
+		int ngNum = (int)(pThres->m_nNgInfo.size());
+		if (ngNum < 1)  continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = pThres->m_nNgInfo[j].eDir;
+			ng.eVision = pThres->m_nNgInfo[j].eVision;
+			ng.isRes = pThres->m_nNgInfo[j].isRes;
+			ng.id = pThres->m_nNgInfo[j].id;
+			ng.minValue = pThres->m_nNgInfo[j].minValue;
+			ng.maxValue = pThres->m_nNgInfo[j].maxValue;
+			ng.result = pThres->m_nNgInfo[j].result;
+			ng.xResult = pThres->m_nNgInfo[j].xResult;
+			ng.yResult = pThres->m_nNgInfo[j].yResult;
+			ng.xPosPxl = pThres->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = pThres->m_nNgInfo[j].yPosPxl;
+			ng.x1 = pThres->m_nNgInfo[j].x1;
+			ng.y1 = pThres->m_nNgInfo[j].y1;
+			ng.x2 = pThres->m_nNgInfo[j].x2;
+			ng.y2 = pThres->m_nNgInfo[j].y2;
+			ng.ngType = pThres->m_nNgInfo[j].ngType;
+			ng.strName = pThres->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::getHoleResult(DimensionDir eDir, NgInfo* ngResult) {
+	/* code */
+	CVisionRecipe* pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isHoleUse) return 0;
+
+	CHoleProcess* dot = pInstance->getHoleProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 4;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CHoleDotProcess* pThres = dot->m_dots[i];
+		if (NULL == pThres) continue;
+		if (1 != pThres->m_nUse) continue;
+
+		int ngNum = (int)(pThres->m_nNgInfo.size());
+		if (ngNum < 1)  continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = pThres->m_nNgInfo[j].eDir;
+			ng.eVision = pThres->m_nNgInfo[j].eVision;
+			ng.isRes = pThres->m_nNgInfo[j].isRes;
+			ng.id = pThres->m_nNgInfo[j].id;
+			ng.minValue = pThres->m_nNgInfo[j].minValue;
+			ng.maxValue = pThres->m_nNgInfo[j].maxValue;
+			ng.result = pThres->m_nNgInfo[j].result;
+			ng.xResult = pThres->m_nNgInfo[j].xResult;
+			ng.yResult = pThres->m_nNgInfo[j].yResult;
+			ng.xPosPxl = pThres->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = pThres->m_nNgInfo[j].yPosPxl;
+			ng.x1 = pThres->m_nNgInfo[j].x1;
+			ng.y1 = pThres->m_nNgInfo[j].y1;
+			ng.x2 = pThres->m_nNgInfo[j].x2;
+			ng.y2 = pThres->m_nNgInfo[j].y2;
+			ng.ngType = pThres->m_nNgInfo[j].ngType;
+			ng.strName = pThres->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::addResultToTotal(NgInfo *ngInfo, int nCount, NgInfo *ngTotal, int nTotal) {
+	/* code */
+	int ngRes = nTotal;
+	if (nCount < 1) return ngRes;
+
+	int fzNum = NG_INF_NUM - 1;
+	for (int i = 0; i < nCount; i++) {
+		if (ngRes > fzNum) continue;
+		NgInfo ng = ngInfo[i];
+		ngTotal[ngRes] = ng;
+		ngRes += 1;
+	}
+
+	return ngRes;
+}
+
+void CSoftVisionApp::sendMessage(int code, int eDir) {
+	/* code */
+	if (nullptr == m_pEvent) return;
+	if (NULL == m_pEvent->m_msgRcvCb)  return;
+
+	m_pEvent->m_msgRcvCb(code, eDir);
+}
+
+void CSoftVisionApp::Log(int level, std::string strText) {
+	/* code */
+	if (nullptr == m_pEvent) return;
+	if (NULL == m_pEvent->m_msgLogCb) return;
+
+	Lock();
+	m_pEvent->m_msgLogCb(level, strText);
+	Unlock();
+}
+
+void CSoftVisionApp::setStage(int nStage) {
+	/* code */
+	CVisionRecipe* pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return;
+
+	pInstance->setStage(nStage);
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/SoftVisionApp.h b/BlVisionPro/Vision/SoftVisionApp.h
new file mode 100644
index 0000000..ba37dd0
--- /dev/null
+++ b/BlVisionPro/Vision/SoftVisionApp.h
@@ -0,0 +1,107 @@
+#ifndef SOFT_VISION_APP_H
+#define SOFT_VISION_APP_H
+
+#include <iostream>
+#include <stdio.h>
+#include "ISoftVisionApp.h"
+class CSoftVisionApp : public ISoftVisionApp
+{
+public:
+	CSoftVisionApp();
+	~CSoftVisionApp();
+
+	static CSoftVisionApp* getInstance(void);
+
+public:
+	//1. 打开视觉窗体
+	virtual int OpenVisionWindow(void);
+	virtual CDialogEx* CreateVisionWindow(void);
+	virtual int ReleaseWindow(CDialogEx *pDlg);
+	virtual void ChangeDimension(CDialogEx *pDlg, int nDir);
+	virtual void SetVisionOpen(BOOL isOpen);
+
+	//2. 设置屏蔽
+	virtual void OpenKeySetWindow(void);
+
+	//3. 坐标转换
+	virtual Point2I getPose(int eDir, int xPoxPxl, int yPosPxl);
+
+	//4. 执行视觉处理
+	virtual int Execute(int eDir, NgInfo *ngArray);
+	//5. 设置回调时间
+	virtual void setImageEventSignal(IVisionEvent *pEvent);
+	//6. 坐标系转换
+	virtual bool transformToStandard(int eDir, Point2I point, Point2I &result, Point2I &topResult, Point2I &botResult);
+	//7. 检测Cut线
+	virtual bool findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I& result);
+	virtual double DistancePL(Point2D pose, Line2D line);
+
+	//8. 检测Norch缺陷	
+	virtual int findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres,
+		int szType, int xFzSize, int yFzSize, CRect* aryResult);
+
+	//9. 设置平台,0是平台1, 1是平台2
+	virtual void setStage(int nStage);
+
+	//5. 获取距离的结果
+	int getDistResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//6. 获取RCUT的缺陷
+	int getRcutResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//6.1 获取THres结果
+	int getThresResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//6. 获取Hole结果
+	int getHoleResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//7. 获取Grind结果
+	int getGrindResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//8. 获取Cut结果
+	int getCutResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//9 设置回调信息 
+	void sendMessage(int code, int eDir);
+
+	//10. 打印日志
+	void Log(int level, std::string strText);
+
+private:
+	IVisionEvent *m_pEvent;
+	CRITICAL_SECTION m_criticalSection;
+
+private:
+	inline void Lock() { EnterCriticalSection(&m_criticalSection); }
+	inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
+
+	//1. 执行视觉定位
+	int ExecuteLoc(DimensionDir eDir);
+
+	//2. GrendSize
+	int ExecuteGrind(DimensionDir eDir);
+
+	//3. 视觉定位
+	int ExecuteDist(DimensionDir eDir);
+
+	//4. Cut检测
+	int ExecuteCut(DimensionDir eDir);
+
+	//5. RCUT检测
+	int ExecuteRCUT(DimensionDir eDir);
+
+	//6. 视觉检测
+	int ExecuteThres(DimensionDir eDir);
+
+	//7. Hole检测
+    int ExecuteHole(DimensionDir eDir);
+
+	//6. 数据结果合并
+	int addResultToTotal(NgInfo *ngInfo, int nCount, NgInfo *ngTotal, int nTotal);
+
+	//7. 获取距离
+	Point2I getPointCoor(DimensionDir dir, Point2I point, Point2I ptTop, Point2I ptBot,  Point2I bzTopPoint, Point2I bzBotPoint, int nType);
+
+};
+
+#endif
diff --git a/BlVisionPro/Vision/ThresDotProcess.cpp b/BlVisionPro/Vision/ThresDotProcess.cpp
new file mode 100644
index 0000000..649f7ed
--- /dev/null
+++ b/BlVisionPro/Vision/ThresDotProcess.cpp
@@ -0,0 +1,444 @@
+#include "stdafx.h"
+#include "ThresDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+#include "SoftVisionApp.h"
+
+CThresDotProcess::CThresDotProcess(){
+	/* code */
+	m_nUse = 0;
+	m_id = 0;
+	m_strName.Format(_T("Point%d"), m_id);
+
+	m_minThres = 60;
+	m_maxThres = 255;
+
+	m_minSizeX = 50;
+	m_minSizeY = 50;
+	m_eDir = DIMENSION_NONE;
+	m_nPoseX = 0;
+	m_nPoseY = 0;
+	m_width = 0;
+	m_height = 0;
+	m_nSmoothSize = 2;
+	m_poseType = 0;
+}
+
+CThresDotProcess::CThresDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_eDir = eDir;
+	m_nUse = 0;
+	m_id = id;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_T%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_T%d"), m_id);
+		break;
+	}
+
+	m_minThres = 60;
+	m_maxThres = 255;
+	m_nSmoothSize = 2;
+
+	m_minSizeX = 50;
+	m_minSizeY = 50;
+	m_nPoseX = 0;
+	m_nPoseY = 0;
+	m_width = 0;
+	m_height = 0;
+	m_poseType = 0;
+}
+
+CThresDotProcess::~CThresDotProcess(){
+	/* code */
+	m_nNgInfo.clear();
+}
+
+bool CThresDotProcess::ExecChip(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return false;
+	if (0 == m_poseType) {
+		if (!pSideData->m_bTopMark_Find)  return false;
+		if (!pSideData->m_bBotMark_Find)  return false;
+	}
+	else {
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	int x = 0;
+	int y = 0;
+	int width = 0;
+	int height = 0;
+	getRegion(x, y, width, height);
+
+	int x1 = x;
+	int y1 = y;
+	int x2 = x1 + width - 1;
+	int y2 = y1 + height - 1;
+	m_ptLeftTop.x = x1;
+	m_ptLeftTop.y = y1;
+//	Log_GetDebug()->TraceInfo("Trace ROI: (%d, %d, %d, %d), %d", x1, y1, x2, y2, __LINE__);
+
+	if (nullptr != pSideData) {  //区域的显示结果
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_THRES);
+		inf.rectX1 = x1;
+		inf.rectY1 = y1;
+		inf.rectX2 = x2;
+		inf.rectY2 = y2;
+		inf.showROI = 1;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 4;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_THRES);
+		inf.pointX = x1;
+		inf.pointY = y1;
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return false;
+
+	//HalconCpp::HWindow hDispWin(0, 0, m_width, m_height);
+	//hDispWin.SetPart(0, 0, m_height - 1, m_width - 1);
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hImage);
+	//hDispWin.Click();
+
+
+	int fzX = (int)(m_minSizeX / m_xMmvsp + 0.5f);
+	int fzY = (int)(m_minSizeY / m_yMmvsp + 0.5f);
+
+	HalconCpp::HObject hResultRegion;
+	HalconCpp::GenEmptyObj(&hResultRegion);
+	if (m_minThres > 0) {
+		HalconCpp::HObject hRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hOpenRegion;
+		HalconCpp::Threshold(hImage, &hRegion, 0, m_minThres);
+		if (m_nSmoothSize > 0) {
+			double fSmoothSize = m_nSmoothSize + 0.5;
+			HalconCpp::OpeningCircle(hRegion, &hOpenRegion, fSmoothSize);
+		}
+		else {
+			hOpenRegion = hRegion;
+		}
+		HalconCpp::Connection(hOpenRegion, &hConRegion);
+		HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT);
+		HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT);
+		HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion);
+		HalconCpp::Union1(hConcatRegion, &hResultRegion);
+	}
+
+	if (m_maxThres < 255) {
+		HalconCpp::HObject hRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hOpenRegion, hUnionRegion;
+		HalconCpp::Threshold(hImage, &hRegion, m_maxThres, 255);
+		if (m_nSmoothSize > 0) {
+			double fSmoothSize = m_nSmoothSize + 0.5;
+			HalconCpp::OpeningCircle(hRegion, &hOpenRegion, fSmoothSize);
+		}
+		else {
+			hOpenRegion = hRegion;
+		}
+		HalconCpp::Connection(hOpenRegion, &hConRegion);
+		HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT);
+		HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT);
+		HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion);
+		HalconCpp::Union1(hConcatRegion, &hUnionRegion);
+		HalconCpp::GenEmptyObj(&hResultRegion);
+		hResultRegion.Clear();
+		hResultRegion = hUnionRegion;
+	}
+	
+	HalconCpp::HObject hConRegion;
+	HalconCpp::Connection(hResultRegion, &hConRegion);
+	//hDispWin.DispObj(hConRegion);
+	//hDispWin.Click();
+
+	int nCount = ClsVision::ObjectNumber(hConRegion);
+	if (nCount < 1) return false;
+
+	getResult(hConRegion);
+
+	return true;
+}
+
+void CThresDotProcess::getResult(HalconCpp::HObject &hResultRegion) {
+	/* code */
+	int nCount = ClsVision::ObjectNumber(hResultRegion);
+	if (nCount < 1) return;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = false;
+	ng.minValue = m_minSizeX;
+	ng.maxValue = m_minSizeY;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_Chip;   //缺陷类型
+	ng.eVision = VISION_THRES;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	HalconCpp::HTuple hvArea, hvY, hvX;
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::AreaCenter(hResultRegion, &hvArea, &hvY, &hvX);
+	HalconCpp::SmallestRectangle1(hResultRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	for (int i = 0; i < nCount; i++) {
+		ng.result = hvArea[i].I();
+		ng.xResult = (int)(m_xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1));
+		ng.yResult = (int)(m_yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1));
+		ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + m_ptLeftTop.x;
+		ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + m_ptLeftTop.y;
+		ng.x1 = hvX1[i].I() + m_ptLeftTop.x - 1;
+		ng.y1 = hvY1[i].I() + m_ptLeftTop.y - 1;
+		ng.x2 = hvX2[i].I() + m_ptLeftTop.x + 1;
+		ng.y2 = hvY2[i].I() + m_ptLeftTop.y + 1;
+
+		if (nullptr != pSideData) {  //区域的显示结果
+			DispVisionResult inf;
+			inf.nType = 1;
+			inf.strName = m_strName;
+			inf.eDir = (int)(m_eDir);
+			inf.eVision = (int)(VISION_THRES);
+			inf.rectX1 = ng.x1;
+			inf.rectY1 = ng.y1;
+			inf.rectX2 = ng.x2;
+			inf.rectY2 = ng.y2;
+			inf.showROI = 0;
+			pSideData->m_vDispVisionResult.push_back(inf);
+		}
+
+		m_nNgInfo.push_back(ng);
+	}
+}
+
+void CThresDotProcess::getRegion(int &xPos, int &yPos, int &width, int &height) {
+	/* code */
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	//获取坐标
+	Point2I offset, result;
+	offset.x = m_nPoseX;
+	offset.y = m_nPoseY;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, offset, m_poseType, result)) return;
+
+	xPos = result.x;
+	yPos = result.y;
+	width = (int)(m_width / pSideData->m_dPixelSizeX);
+	height = (int)(m_height / pSideData->m_dPixelSizeY);
+}
+
+void CThresDotProcess::setRegion(int xPos, int yPos, int width, int height) {
+	/* code */
+	//设置图像的ROI区域
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	//设置图像的区域
+	int x1 = xPos;
+	int y1 = yPos;
+	int x2 = xPos + width - 1;
+	int y2 = yPos + height - 1;
+//	Log_GetDebug()->TraceInfo("Trace Set ROI: (%d, %d, %d, %d), %d", x1, y1, x2, y2, __LINE__);
+	Point2I point;
+    point.x = x1;
+	point.y = y1;
+
+	Point2I pose, ptTop, ptBot;
+	if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir, point, pose, ptTop, ptBot)) return;
+
+	if (0 == m_poseType) {
+		m_nPoseX = pose.x;
+		m_nPoseY = pose.y;
+	}
+	else if (1 == m_poseType) {
+		m_nPoseX = ptTop.x;
+		m_nPoseY = ptTop.y;
+	}
+	else if (2 == m_poseType) {
+		m_nPoseX = ptBot.x;
+		m_nPoseY = ptBot.y;
+	}
+	m_width = (int)(pSideData->m_dPixelSizeX * width);
+	m_height = (int)(pSideData->m_dPixelSizeY * height);
+}
+
+int CThresDotProcess::getID(void) {
+	/* code*/
+	return m_id;
+}
+
+void CThresDotProcess::setID(int id) {
+	/* code */
+	m_id = id;
+}
+
+void CThresDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+int CThresDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	if (1 != m_nUse)  return 0;
+	if (m_width < 1 || m_height < 1) return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 执行检测
+	ExecChip(eDir);
+
+	int nRet = (int)(m_nNgInfo.size());
+	return nRet;
+}
+
+Json::Value CThresDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+	Json::Value jsValue;
+	jsValue["alg type"] = THRES_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["pos x"] = m_nPoseX;
+	jsValue["pos y"] = m_nPoseY;
+	jsValue["width"] = m_width;
+	jsValue["height"] = m_height;
+	jsValue["use"] = m_nUse;
+	jsValue["min thres"] = m_minThres;
+	jsValue["max thres"] = m_maxThres;
+	jsValue["min size x"] = m_minSizeX;
+	jsValue["min size y"] = m_minSizeY;
+	jsValue["smooth size"] = m_nSmoothSize;
+	jsValue["pose type"] = m_poseType;
+
+	return jsValue;
+}
+
+void CThresDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseX = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseY = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. width
+	strName = "width";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_width = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. height
+	strName = "height";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_height = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. min thres
+	strName = "min thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_minThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. min
+	strName = "max thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_maxThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. min size x
+	strName = "min size x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_minSizeX = jsValue[strName.c_str()].asInt();
+	}
+
+	//13. min size y
+	strName = "min size y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_minSizeY = jsValue[strName.c_str()].asInt();
+	}
+
+	//14. smooth size
+	strName = "smooth size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nSmoothSize = jsValue[strName.c_str()].asInt();
+	}
+
+	//15. smooth size
+	strName = "pose type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nSmoothSize = jsValue[strName.c_str()].asInt();
+	}
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/ThresDotProcess.h b/BlVisionPro/Vision/ThresDotProcess.h
new file mode 100644
index 0000000..2b500ae
--- /dev/null
+++ b/BlVisionPro/Vision/ThresDotProcess.h
@@ -0,0 +1,65 @@
+#ifndef THRES_DOT_PROCRSS_H
+#define THRES_DOT_PROCRSS_H
+
+class CThresDotProcess
+{
+public:
+	CThresDotProcess();
+	CThresDotProcess(DimensionDir eDir, int id);
+	~CThresDotProcess();
+
+public:
+	//1. 获取区域
+	void getRegion(int &xPos, int &yPos, int &width, int &height);
+	void setRegion(int xPos, int yPos, int width, int height);
+
+	//2. 获取ID
+	int getID(void);
+	void setID(int id);
+
+	//3. 执行检测
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//5. 保存文件
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	int m_nUse;
+	CString m_strName;
+
+	int m_poseType;
+	int m_minThres;
+	int m_maxThres;
+	int m_nSmoothSize;
+
+	int m_minSizeX;
+	int m_minSizeY;
+	std::vector<NgDotInfo> m_nNgInfo;
+
+private:
+	int m_id;
+	DimensionDir m_eDir;
+	int m_nPoseX;
+	int m_nPoseY;
+	int m_width;
+	int m_height;
+	Point2I m_ptLeftTop;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+
+private:
+	//1. 检测
+	bool ExecChip(DimensionDir eDir);
+
+	//2. 获取结果
+	void getResult(HalconCpp::HObject &hResultRegion);
+
+	//3. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+};
+
+
+
+#endif
diff --git a/BlVisionPro/Vision/ThresProcess.cpp b/BlVisionPro/Vision/ThresProcess.cpp
new file mode 100644
index 0000000..d5a91b8
--- /dev/null
+++ b/BlVisionPro/Vision/ThresProcess.cpp
@@ -0,0 +1,103 @@
+#include "stdafx.h"
+#include "ThresProcess.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CThresProcess::CThresProcess(){
+	/* code */
+	for (int i = 0; i < 12; i++) {
+		m_dots[i] = NULL;
+	}
+	m_eDir = DIMENSION_NONE;
+	init();
+}
+
+CThresProcess::CThresProcess(DimensionDir eDir) {
+	/* code */
+	for (int i = 0; i < 12; i++) {
+		m_dots[i] = NULL;
+	}
+	m_eDir = eDir;
+	init();
+}
+
+CThresProcess::~CThresProcess(){
+	/* code */
+	release();
+}
+
+int CThresProcess::init(void) {
+	/* code */
+	release();
+
+	for (int i = 0; i < 12; i++) {
+		m_dots[i] = new CThresDotProcess(m_eDir, i + 1);
+	}
+
+	return 0;
+}
+
+void CThresProcess::release(void) {
+	/* code */
+	int nCount = 12;
+	for (int i = 0; i < nCount; i++) {
+		CThresDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+int CThresProcess::execute(DimensionDir eDir) {
+	/* code */
+	if (m_eDir != eDir) return -1;
+
+	int nCount = 12;
+	Point2I offset;
+	for (int i = 0; i < nCount; i++) {
+		CThresDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse)  continue;
+
+		offset.x = i;
+		offset.y = i;
+		dot->Execute(m_eDir, offset);
+	}
+
+	return 0;
+}
+
+Json::Value CThresProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["alg type"] = THRES_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+
+	for (int i = 0; i < 12; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CThresProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	for (int i = 0; i < 12; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/ThresProcess.h b/BlVisionPro/Vision/ThresProcess.h
new file mode 100644
index 0000000..1b351d1
--- /dev/null
+++ b/BlVisionPro/Vision/ThresProcess.h
@@ -0,0 +1,33 @@
+#ifndef THRES_PROCRSS_H
+#define THRES_PROCRSS_H
+
+#include "ThresDotProcess.h"
+
+class CThresProcess
+{
+public:
+	CThresProcess();
+	CThresProcess(DimensionDir eDir);
+	~CThresProcess();
+
+public:
+	//1. 执行
+	int execute(DimensionDir eDir);
+
+	//6. 保存
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	DimensionDir m_eDir;
+	CThresDotProcess *m_dots[12];
+
+private:
+	//1. 初始化
+	int init(void);
+
+	//2. 释放
+	void release(void);
+};
+
+#endif
diff --git a/BlVisionPro/Vision/TranformCoordinate.cpp b/BlVisionPro/Vision/TranformCoordinate.cpp
new file mode 100644
index 0000000..a6c1118
--- /dev/null
+++ b/BlVisionPro/Vision/TranformCoordinate.cpp
@@ -0,0 +1,352 @@
+#include "stdafx.h"
+#include "TranformCoordinate.h"
+
+CTranformCoordinate::CTranformCoordinate()
+{
+	/* code */
+}
+
+CTranformCoordinate::~CTranformCoordinate()
+{
+	/* code */
+}
+
+Point2I CTranformCoordinate::Execute(DimensionDir eDir, Point2I pose) {
+	/* code */
+	Point2I ptResult = getPose(eDir, pose);
+
+	Point2I result = TranformPose(eDir, ptResult);
+
+	if (result.x < 0 || result.y < 0) {
+		Print(eDir, pose);
+	}
+
+	return result;
+}
+
+void CTranformCoordinate::Print(DimensionDir eDir, Point2I pose) {
+	/* code */
+	ILogger *pLogger = Log_GetDebug();
+	if (NULL == pLogger) return;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData) return;
+
+	pLogger->TraceInfo("Trace Tf %d: (%d, %d), %d", (int)eDir, pose.x, pose.y, __LINE__);
+	Point2I ptResult = getPose(eDir, pose);
+	pLogger->TraceInfo("Trace Tf %d: (%d, %d), %d", (int)eDir, ptResult.x, ptResult.y, __LINE__);
+
+	for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.begin(); iter++) {
+		pLogger->TraceInfo("Trace Tf %d:  %d, (%d, %d), %d", 
+			(int)eDir, iter->first, 
+			iter->second.nSideLine, iter->second.top, __LINE__);
+	}
+
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	pLogger->TraceInfo("Trace Tf %d: (%d, %d, %d, %d, %d, %d, %d, %d, %d), %d", 
+		(int)eDir, 
+		scanSetting.lengthSize, scanSetting.shortSize, scanSetting.nStdIndex,
+		scanSetting.nIndex0, scanSetting.nIndex1, scanSetting.nIndex2, scanSetting.nIndex3,
+		scanSetting.nLengthScan, scanSetting.nShortScan, 
+		__LINE__);
+}
+
+Point2I CTranformCoordinate::tfPose(DimensionDir eDir, Point2I pose) {
+	/* code */
+	return TranformPose(eDir, pose);
+}
+
+Point2I CTranformCoordinate::TranformPose(DimensionDir eDir, Point2I pose) {
+	/* code */
+	Point2I result = pose;
+	switch (eDir)
+	{
+	case GLOBAL_DEFINE::DIMENSION_A:
+		result = TransformPoseTopA(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_B:
+		result = TransformPoseTopB(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_C:
+		result = TransformPoseTopC(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_D:
+		result = TransformPoseTopD(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		result = TransformPoseBotA(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		result = TransformPoseBotB(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		result = TransformPoseBotC(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		result = TransformPoseBotD(pose);
+		break;
+
+	default:
+		break;
+	}
+
+	return result;
+}
+
+Point2I CTranformCoordinate::TransformPoseTopA(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex0;
+	if (1 == scanSetting.nLengthScan)  idx0 = scanSetting.nIndex1;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return TransformResult(pose, true, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseTopB(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex2;
+	if (1 == scanSetting.nShortScan)  idx0 = scanSetting.nIndex1;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return  TransformResult(pose, false, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseTopC(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex3;
+	if (1 == scanSetting.nLengthScan)  idx0 = scanSetting.nIndex2;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return TransformResult(pose, true, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseTopD(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex3;
+	if (1 == scanSetting.nShortScan)  idx0 = scanSetting.nIndex0;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return  TransformResult(pose, false, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseBotA(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex0;
+	if (1 == scanSetting.nLengthScan)  idx0 = scanSetting.nIndex1;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return TransformResult(pose, true, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseBotB(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex2;
+	if (1 == scanSetting.nShortScan)  idx0 = scanSetting.nIndex1;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return  TransformResult(pose, false, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseBotC(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex3;
+	if (1 == scanSetting.nLengthScan)  idx0 = scanSetting.nIndex2;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return TransformResult(pose, true, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseBotD(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex3;
+	if (1 == scanSetting.nShortScan)  idx0 = scanSetting.nIndex0;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return  TransformResult(pose, false, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformResult(Point2I pose, bool isScanLength, int idx0, int idx1, ScanSetting scanSetting) {
+	/* code */
+	Point2I result = pose;
+	int id0 = getIndex(idx0, scanSetting);
+	int id1 = getIndex(idx1, scanSetting);
+	if (-1 == id0 || -1 == id1) return result;
+
+	Point2I pt = pose;
+	if (isScanLength) {
+		pt.x = pose.y;
+		pt.y = pose.x;
+	}
+
+	switch (id0){
+	case 0: {
+		if (0 == id1) {
+			result = pt;
+		}
+		else if (1 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = pt.y;
+		}
+		else if (2 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (3 == id1) {
+			result.x = pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		break;
+	}
+
+	case 1: {
+		if (0 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = pt.y;
+		}
+		else if (1 == id1) {
+			result = pt;
+		}
+		else if (2 == id1) {
+			result.x = pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (3 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		break;
+	}
+
+	case 2: {
+		if (0 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (1 == id1) {
+			result.x = pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (2 == id1) {
+			result = pt;
+		}
+		else if (3 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = pt.y;
+		}
+		break;
+	}
+
+	case 3: {
+		if (0 == id1) {
+			result.x = pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (1 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (2 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = pt.y;
+		}
+		else if (3 == id1) {
+			result = pt;
+		}
+		break;
+	}
+
+	default:
+		break;
+	}
+
+	return result;
+}
+
+int CTranformCoordinate::getIndex(int idx, ScanSetting scanSetting) {
+	/* code */
+	int id = -1;
+	if (idx == scanSetting.nIndex0) {
+		id = 0;
+	}
+	else if (idx == scanSetting.nIndex1) {
+		id = 1;
+	}
+	else if (idx == scanSetting.nIndex2) {
+		id = 2;
+	}
+	else if (idx == scanSetting.nIndex3) {
+		id = 3;
+	}
+
+	return id;
+}
+
+Point2I CTranformCoordinate::getPose(DimensionDir eDir, Point2I pose) {
+	/* code */
+	Point2I result = pose;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+
+	int nCount = (int)(pSideData->m_mapSideLineInf.size());
+	if (nCount < 1) return result;
+
+	SideLineInf inf;
+	bool isFind = false;
+	int minDist = MAXINT;
+	int dist = 0;
+	for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.end(); iter++) {
+		if (pose.y < iter->second.top) continue;
+
+		dist = abs(pose.y - iter->second.top);
+		if (dist > minDist) continue;
+
+		inf = iter->second;
+		isFind = true;
+		minDist = dist;
+	}
+
+	if (!isFind) {
+		for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.end(); iter++) {
+			dist = abs(pose.y - iter->second.top);
+			if (dist > minDist) continue;
+
+			inf = iter->second;
+			isFind = true;
+			minDist = dist;
+		}
+	}
+
+	if (!isFind)  return result;
+
+	result.x = (int)(pSideData->m_dPixelSizeX * (pose.x - inf.nSideLine));
+	result.y = (int)(pSideData->m_dPixelSizeY * (pose.y - pSideData->m_nStartLine));
+
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	if (result.y > scanSetting.lengthSize) {
+		result.y = scanSetting.lengthSize - (int)(pSideData->m_dPixelSizeY * abs(pSideData->m_nEndLine - pose.y));
+	}
+	
+	return result;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/TranformCoordinate.h b/BlVisionPro/Vision/TranformCoordinate.h
new file mode 100644
index 0000000..aa28dde
--- /dev/null
+++ b/BlVisionPro/Vision/TranformCoordinate.h
@@ -0,0 +1,62 @@
+#ifndef TRANFORM_COORDINATE_H
+#define TRANFORM_COORDINATE_H
+
+#include "VisionRecipe.h"
+
+class CTranformCoordinate
+{
+public:
+	CTranformCoordinate();
+	~CTranformCoordinate();
+
+public:
+	//1. 执行
+	Point2I Execute(DimensionDir eDir, Point2I pose);
+
+	//2. 获取相对位置
+	Point2I tfPose(DimensionDir eDir, Point2I pose);
+
+private:
+	//1. 获取位置
+	Point2I getPose(DimensionDir eDir, Point2I pose);
+
+	//2. 获取相对位置
+	Point2I TranformPose(DimensionDir eDir, Point2I pose);
+
+	//3. TopA转换
+	Point2I TransformPoseTopA(Point2I pose);
+
+	//4. TopB转换
+	Point2I TransformPoseTopB(Point2I pose);
+
+	//5. TopC转换
+	Point2I TransformPoseTopC(Point2I pose);
+
+	//6. TopD转换
+	Point2I TransformPoseTopD(Point2I pose);
+
+	//7. BotA转换
+	Point2I TransformPoseBotA(Point2I pose);
+
+	//8. BotB转换
+	Point2I TransformPoseBotB(Point2I pose);
+
+	//9. BotC转换
+	Point2I TransformPoseBotC(Point2I pose);
+
+	//10. BotD转换
+	Point2I TransformPoseBotD(Point2I pose);
+
+	//11. 转换
+	Point2I TransformResult(Point2I pose, bool isScanLength, int idx0, int idx1, ScanSetting scanSetting);
+
+	//12. 转换序号
+	int getIndex(int idx, ScanSetting scanSetting);
+
+	//13. 打印数据
+	void Print(DimensionDir eDir, Point2I pose);
+
+
+};
+
+#endif
diff --git a/BlVisionPro/Vision/Vec.h b/BlVisionPro/Vision/Vec.h
new file mode 100644
index 0000000..f69161d
--- /dev/null
+++ b/BlVisionPro/Vision/Vec.h
@@ -0,0 +1,463 @@
+#ifndef VEC_H
+#define VEC_H
+
+#undef min
+#undef max
+
+#include <cmath>
+#include <iostream>
+#include <algorithm>
+using namespace std;
+
+// Let gcc optimize conditional branches a bit better...
+#ifndef likely
+#  if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
+#    define likely(x) (x)
+#    define unlikely(x) (x)
+#  else
+#    define likely(x)   (__builtin_expect((x), 1))
+#    define unlikely(x) (__builtin_expect((x), 0))
+#  endif
+#endif
+
+
+// Boost-like compile-time assertion checking
+template <bool X> struct VEC_STATIC_ASSERTION_FAILURE;
+template <> struct VEC_STATIC_ASSERTION_FAILURE<true>
+{
+	void operator () () {}
+};
+#define VEC_STATIC_CHECK(expr) VEC_STATIC_ASSERTION_FAILURE<bool(expr)>()
+
+
+template <int D, class T = float>
+class Vec {
+private:
+	T v[D];
+
+public:
+
+	// Constructor for no arguments.  Everything initialized to 0.
+	Vec() { for (int i = 0; i < D; i++) v[i] = T(0); }
+
+	// Constructors for 2-4 arguments
+	Vec(T x, T y)
+	{
+		VEC_STATIC_CHECK(D == 2); v[0] = x; v[1] = y;
+	}
+	Vec(T x, T y, T z)
+	{
+		VEC_STATIC_CHECK(D == 3); v[0] = x; v[1] = y; v[2] = z;
+	}
+	Vec(T x, T y, T z, T w)
+	{
+		VEC_STATIC_CHECK(D == 4); v[0] = x; v[1] = y; v[2] = z; v[3] = w;
+	}
+
+	// Constructor from anything that can be accessed using []
+	// This one's pretty aggressive, so marked explicit
+	template <class S> explicit Vec(const S &x)
+	{
+		for (int i = 0; i < D; i++) v[i] = T(x[i]);
+	}
+
+	// No destructor or assignment operator needed
+
+	// Array reference and conversion to pointer - no bounds checking
+	const T &operator [] (int i) const
+	{
+		return v[i];
+	}
+	T &operator [] (int i)
+	{
+		return v[i];
+	}
+	operator const T * () const
+	{
+		return v;
+	}
+	operator const T * ()
+	{
+		return v;
+	}
+	operator T * ()
+	{
+		return v;
+	}
+
+	bool operator == (const Vec& d) const { return ((v[0] == d.v[0]) && (v[1] == d.v[1]) && (v[2] == d.v[2])); }
+	bool operator != (const Vec& d) const { return ((v[0] != d.v[0]) || (v[1] != d.v[1]) || (v[2] != d.v[2])); }
+
+	// Member operators
+	Vec<D, T> &operator += (const Vec<D, T> &x)
+	{
+		for (int i = 0; i < D; i++) v[i] += x[i];  return *this;
+	}
+	Vec<D, T> &operator -= (const Vec<D, T> &x)
+	{
+		for (int i = 0; i < D; i++) v[i] -= x[i];  return *this;
+	}
+	Vec<D, T> &operator *= (const Vec<D, T> &x)
+	{
+		for (int i = 0; i < D; i++) v[i] *= x[i];  return *this;
+	}
+	Vec<D, T> &operator *= (const T &x)
+	{
+		for (int i = 0; i < D; i++) v[i] *= x;     return *this;
+	}
+	Vec<D, T> &operator /= (const Vec<D, T> &x)
+	{
+		for (int i = 0; i < D; i++) v[i] /= x[i];  return *this;
+	}
+	Vec<D, T> &operator /= (const T &x)
+	{
+		for (int i = 0; i < D; i++) v[i] /= x;     return *this;
+	}
+
+	// Outside of class: + - * / % ^ << >>
+
+	// Some partial compatibility with valarrays and vectors
+	typedef T value_type;
+	size_t size() const
+	{
+		return D;
+	}
+	T sum() const
+	{
+		T total = v[0];
+		for (int i = 1; i < D; i++) total += v[i];
+		return total;
+	}
+	T avg() const
+	{
+		return sum() / D;
+	}
+	T product() const
+	{
+		T total = v[0];
+		for (int i = 1; i < D; i++) total *= v[i];
+		return total;
+	}
+	T min() const
+	{
+		T m = v[0];
+		for (int i = 0; i < D; i++)
+			if (v[i] < m)  m = v[i];
+		return m;
+	}
+	T max() const
+	{
+		T m = v[0];
+		for (int i = 1; i < D; i++)
+			if (v[i] > m)  m = v[i];
+		return m;
+	}
+	T *begin() { return &(v[0]); }
+	const T *begin() const { return &(v[0]); }
+	T *end() { return begin() + D; }
+	const T *end() const { return begin() + D; }
+	void clear() { for (int i = 0; i < D; i++) v[i] = T(0); }
+	bool empty() const
+	{
+		for (int i = 0; i < D; i++)
+			if (v[i]) return false;
+		return true;
+	}
+};
+
+typedef Vec<3, float> vec;
+typedef Vec<3, float> point;
+typedef Vec<2, float> vec2;
+typedef Vec<3, float> vec3;
+typedef Vec<4, float> vec4;
+typedef Vec<2, int> ivec2;
+typedef Vec<3, int> ivec3;
+typedef Vec<4, int> ivec4;
+
+
+// Nonmember operators that take two Vecs
+template <int D, class T>
+static inline const Vec<D, T> operator + (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return Vec<D, T>(v1) += v2;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator - (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return Vec<D, T>(v1) -= v2;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator * (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return Vec<D, T>(v1) *= v2;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator / (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return Vec<D, T>(v1) /= v2;
+}
+
+template <int D, class T>
+static inline const T operator ^ (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	T sum = v1[0] * v2[0];
+	for (int i = 1; i < D; i++)
+		sum += v1[i] * v2[i];
+	return sum;
+}
+#define DOT ^
+
+template <class T>
+static inline const Vec<3, T> operator % (const Vec<3, T> &v1, const Vec<3, T> &v2)
+{
+	return Vec<3, T>(v1[1] * v2[2] - v1[2] * v2[1],
+		v1[2] * v2[0] - v1[0] * v2[2],
+		v1[0] * v2[1] - v1[1] * v2[0]);
+}
+#define CROSS %
+
+
+// Component-wise equality and inequality (#include the usual caveats
+// about comparing floats for equality...)
+template <int D, class T>
+static inline bool operator == (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	for (int i = 0; i < D; i++)
+		if (v1[i] != v2[i])
+			return false;
+	return true;
+}
+
+template <int D, class T>
+static inline bool operator != (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	for (int i = 0; i < D; i++)
+		if (v1[i] != v2[i])
+			return true;
+	return false;
+}
+
+
+// Unary operators
+template <int D, class T>
+static inline const Vec<D, T> &operator + (const Vec<D, T> &v)
+{
+	return v;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator - (const Vec<D, T> &v)
+{
+	Vec<D, T> result(v);
+	for (int i = 0; i < D; i++)
+		result[i] = -result[i];
+	return result;
+}
+
+template <int D, class T>
+static inline bool operator ! (const Vec<D, T> &v)
+{
+	return v.empty();
+}
+
+
+// Vec/scalar operators
+template <int D, class T>
+static inline const Vec<D, T> operator * (const T &x, const Vec<D, T> &v)
+{
+	Vec<D, T> result(v);
+	for (int i = 0; i < D; i++)
+		result[i] = x * result[i];
+	return result;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator * (const Vec<D, T> &v, const T &x)
+{
+	return Vec<D, T>(v) *= x;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator / (const T &x, const Vec<D, T> &v)
+{
+	Vec<D, T> result(v);
+	for (int i = 0; i < D; i++)
+		result[i] = x / result[i];
+	return result;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator / (const Vec<D, T> &v, const T &x)
+{
+	return Vec<D, T>(v) /= x;
+}
+
+
+// iostream operators
+template <int D, class T>
+static inline std::ostream &operator << (std::ostream &os, const Vec<D, T> &v)
+
+{
+	os << "(";
+	for (int i = 0; i < D - 1; i++)
+		os << v[i] << ", ";
+	return os << v[D - 1] << ")";
+}
+
+template <int D, class T>
+static inline std::istream &operator >> (std::istream &is, Vec<D, T> &v)
+{
+	char c1 = 0, c2 = 0;
+
+	is >> c1;
+	if (c1 == '(' || c1 == '[') {
+		is >> v[0] >> std::ws >> c2;
+		for (int i = 1; i < D; i++) {
+			if (c2 == ',')
+				is >> v[i] >> std::ws >> c2;
+			else
+				is.setstate(std::ios::failbit);
+		}
+	}
+
+	if (c1 == '(' && c2 != ')')
+		is.setstate(std::ios::failbit);
+	else if (c1 == '[' && c2 != ']')
+		is.setstate(std::ios::failbit);
+
+	return is;
+}
+
+
+// Utility functions for square and cube, to go along with sqrt and cbrt
+template <class T>
+static inline T sqr(const T &x)
+{
+	return x*x;
+}
+
+template <class T>
+static inline T cube(const T &x)
+{
+	return x*x*x;
+}
+
+
+// Utility functions based on GLSL
+template <class T>
+static inline T fract(const T &x)
+{
+	return x - floor(x);
+}
+
+template <class T>
+static inline T clamp(const T &x, const T &a, const T &b)
+{
+	return x > a ? x < b ? x : b : a;  // returns a on NaN
+}
+
+template <class T, class S>
+static inline T mix(const T &x, const T &y, const S &a)
+{
+	return (S(1) - a) * x + a * y;
+}
+
+template <class T>
+static inline T step(const T &x, const T &a)
+{
+	return x < a ? T(0) : T(1);
+}
+
+template <class T>
+static inline T smoothstep(const T &x, const T &a, const T &b)
+{
+	if (b <= a) return step(x, a);
+	T t = (x - a) / (b - a);
+	return t <= T(0) ? T(0) : t >= T(1) ? T(1) : t * t * (T(3) - T(2) * t);
+}
+
+// Area-weighted triangle face normal
+template <class T>
+static inline T trinorm(const T &v0, const T &v1, const T &v2)
+{
+	return (typename T::value_type) 0.5 * ((v1 - v0) CROSS(v2 - v0));
+}
+
+// Sign of a scalar
+template <class T>
+static inline T sgn(const T &x)
+{
+	return (x < T(0)) ? T(-1) : T(1);
+}
+
+
+// Functions on Vecs
+template <int D, class T>
+static inline const T len2(const Vec<D, T> &v)
+{
+	T l2 = v[0] * v[0];
+	for (int i = 1; i < D; i++)
+		l2 += v[i] * v[i];
+	return l2;
+}
+
+template <int D, class T>
+static inline const T len(const Vec<D, T> &v)
+{
+	return sqrt(len2(v));
+}
+
+template <int D, class T>
+static inline const T dist2(const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	T d2 = sqr(v2[0] - v1[0]);
+	for (int i = 1; i < D; i++)
+		d2 += sqr(v2[i] - v1[i]);
+	return d2;
+}
+
+template <int D, class T>
+static inline const T dist(const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return sqrt(dist2(v1, v2));
+}
+
+template <int D, class T>
+static inline Vec<D, T> normalize(Vec<D, T> &v)
+{
+	T l = len(v);
+	if (unlikely(l <= T(0))) {
+		v[0] = T(1);
+		for (int i = 1; i < D; i++)
+			v[i] = T(0);
+		return v;
+	}
+
+	l = T(1) / l;
+	for (int i = 0; i < D; i++)
+		v[i] *= l;
+
+	return v;
+}
+
+template <int D, class T>
+static inline void swap(const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	for (int i = 0; i < D; i++)
+		swap(v1[i], v2[i]);
+}
+
+template <int D, class T>
+static inline Vec<D, T> fabs(const Vec<D, T> &v)
+{
+	Vec<D, T> result(v);
+	for (int i = 0; i < D; i++)
+		if (result[i] < T(0))
+			result[i] = -result[i];
+	return result;
+}
+
+#endif
diff --git a/BlVisionPro/Vision/VisionBufferPro.cpp b/BlVisionPro/Vision/VisionBufferPro.cpp
new file mode 100644
index 0000000..929e82a
--- /dev/null
+++ b/BlVisionPro/Vision/VisionBufferPro.cpp
@@ -0,0 +1,1337 @@
+#include "stdafx.h"
+#include "VisionBufferPro.h"
+#include "Bspline.h"
+
+#define  DEFAULTT_IMAGE_HEIGHT     100000
+
+CVisionBufferPro::CVisionBufferPro()
+{
+}
+
+CVisionBufferPro::~CVisionBufferPro(){
+	/* code */
+}
+
+bool CVisionBufferPro::bufferToObject(DimensionDir eDir, int height, HalconCpp::HObject &hImage) {
+	/* code */
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	int iCam = pRecipe->getCameraIndex(eDir);
+	int iScan = pRecipe->getCameraScan(eDir);
+	CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam);
+	if (NULL == pGrabCtrl) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer();
+	if (nullptr == pBuffer) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+	CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer();
+	if (NULL == pMultBuffer) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	int nFrameWidth = pMultBuffer->GetFrameWidth();
+	int nFrameHeight = pMultBuffer->GetFrameHeight();
+	int nFrameCount = pMultBuffer->GetFrameCount();
+	int nTotalLength = nFrameHeight * nFrameCount;
+	if (nTotalLength < 1){
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	try{
+		int imgWidth = nFrameWidth;
+		int imgHeight = nTotalLength;
+		if (imgHeight > DEFAULTT_IMAGE_HEIGHT) {
+			imgHeight = DEFAULTT_IMAGE_HEIGHT;
+		}
+		if (height > 0) {
+			if (imgHeight > height) {
+				imgHeight = height;
+			}
+		}
+
+		//图像转换
+		uchar *imgData = new uchar[imgWidth * imgHeight];
+		BYTE *lpImg = pBuffer->GetMultiBuffData(iScan);
+		std::memcpy(imgData, lpImg, imgWidth * imgHeight);
+		HalconCpp::GenImage1(&hImage, "byte", imgWidth, imgHeight, (Hlong)(imgData));
+		delete[] imgData;
+		imgData = NULL;
+
+		return true;
+	}
+	catch (...)
+	{
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+}
+
+bool CVisionBufferPro::getImageROI(DimensionDir eDir, HalconCpp::HObject &hImage, int x1, int y1, int x2, int y2) {
+	/* code */
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	int iCam = pRecipe->getCameraIndex(eDir);
+	int iScan = pRecipe->getCameraScan(eDir);
+	CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam);
+	if (NULL == pGrabCtrl) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer();
+	if (nullptr == pBuffer) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+	CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer();
+	if (NULL == pMultBuffer) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	int nFrameWidth = pMultBuffer->GetFrameWidth();
+	int nFrameHeight = pMultBuffer->GetFrameHeight();
+	int nFrameCount = pMultBuffer->GetFrameCount();
+	int nTotalLength = nFrameWidth * nFrameHeight * nFrameCount;
+	if (nTotalLength < 1) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	if (x1 < 0 || y1 < 0 || x2 > nFrameWidth - 1 || y2 > nTotalLength - 1) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	try{
+		int imgWidth = x2 - x1 + 1;
+		int imgHeight = y2 - y1 + 1;
+		if (imgWidth < 1 || imgHeight < 1) {
+			ClsVision::GenEmptyObject(hImage);
+			return false;
+		}
+
+		//图像转换
+		uchar *imgData = new uchar[imgWidth * imgHeight];
+		BYTE *lpImg = pBuffer->GetMultiBuffData(iScan);
+
+		for (int i = y1; i <= y2; i++) {
+			std::memcpy(imgData + (i - y1) * imgWidth, lpImg + (i * nFrameWidth) + x1, imgWidth);
+		}
+
+
+		HalconCpp::GenImage1(&hImage, "byte", imgWidth, imgHeight, (Hlong)(imgData));
+		delete[] imgData;
+		imgData = NULL;
+
+		return true;
+	}
+	catch (...)
+	{
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+}
+
+bool CVisionBufferPro::getIndexImage(DimensionDir eDir, HalconCpp::HObject *hImage, int index) {
+	/* code */
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	int iCam = pRecipe->getCameraIndex(eDir);
+	int iScan = pRecipe->getCameraScan(eDir);
+	CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam);
+	if (NULL == pGrabCtrl) {
+		HalconCpp::GenEmptyObj(hImage);
+		return false;
+	}
+
+	CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer();
+	if (nullptr == pBuffer) {
+		HalconCpp::GenEmptyObj(hImage);
+		return false;
+	}
+	CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer();
+	if (NULL == pMultBuffer) {
+		HalconCpp::GenEmptyObj(hImage);
+		return false;
+	}
+	int nFrameHeight = pMultBuffer->GetFrameHeight();
+	int nFrameWidth = pMultBuffer->GetFrameWidth();
+	if (nFrameHeight < 1 || nFrameWidth < 1) {
+		HalconCpp::GenEmptyObj(hImage);
+		return false;
+	}
+
+	int x1 = 0;
+	int x2 = nFrameWidth - 1;
+	int y1 = index * nFrameHeight;
+	int y2 = index * nFrameHeight + nFrameHeight - 1;
+
+	return getImageROI(eDir, *hImage, x1, y1, x2, y2);
+}
+
+void CVisionBufferPro::getLineFrameSize(DimensionDir eDir, int &nFrameWidth, int &nFrameHeight) {
+	/* code */
+	// 设置帧宽和高度为-1
+	nFrameWidth = -1;
+	nFrameHeight = -1;
+	// 获取CVisionRecipe实例
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	// 获取指定方向下的相机索引
+	int iCam = pRecipe->getCameraIndex(eDir);
+	// 获取指定方向下的相机扫描方向
+	int iScan = pRecipe->getCameraScan(eDir);
+	// 获取指定相机下的CGrabberControl实例
+	CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam);
+	// 如果pGrabCtrl为空,则返回
+	if (NULL == pGrabCtrl) return;
+
+	// 获取CFrameBufferController实例
+	CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer();
+	// 如果pBuffer为空,则返回
+	if (nullptr == pBuffer) return;
+	// 获取CMultiBuffer实例
+	CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer();
+	// 如果pMultBuffer为空,则返回
+	if (NULL == pMultBuffer)return;
+
+	// 获取帧高度
+	nFrameHeight = pMultBuffer->GetFrameHeight();
+	// 获取帧宽度
+	nFrameWidth = pMultBuffer->GetFrameWidth();
+}
+
+bool CVisionBufferPro::GetMeasurePos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int step, Point2D &ptStart, Point2D &ptEnd) {
+	/* code */
+	if (!ClsVision::ObjectExist(hObject))  return false;
+
+	try {
+		HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0;
+		LineRowStart_Measure_01_0 = line.pt0.y;
+		LineColumnStart_Measure_01_0 = line.pt0.x;
+		LineRowEnd_Measure_01_0 = line.pt1.y;
+		LineColumnEnd_Measure_01_0 = line.pt1.x;
+
+		HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2;
+		TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0);
+		TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0);
+		TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0;
+		TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0;
+
+		HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi);
+
+		HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1);
+		TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1;
+		TmpCtrl_Len2 = 0.5 * step;
+
+		HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0;
+		HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight);
+
+		HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple  Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0;
+		std::string strMode = "all";
+		if (0 == modeTrans) {
+			strMode = "all";
+		}
+		else if (1 == modeTrans) {
+			strMode = "positive";
+		}
+		else if (2 == modeTrans) {
+			strMode = "negative";
+		}
+		HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0);
+		HalconCpp::CloseMeasure(MsrHandle_Measure_01_0);
+
+		bool result = false;
+		HalconCpp::HTuple hvLenth;
+		HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth);
+		int iCount = hvLenth[0].I();
+		if (iCount > 0) {
+			double dx = abs(line.pt0.x - line.pt1.x);
+			bool isInit = false;
+
+			Point2D pt;
+			if (dx > 1.0f) {
+				for (int i = 0; i < iCount; i++) {
+					pt.x = Column_Measure_01_0[i].D();
+					pt.y = Row_Measure_01_0[i].D();
+					if (!isInit) {
+						ptStart.x = Column_Measure_01_0[i].D();
+						ptStart.y = Row_Measure_01_0[i].D();
+						ptEnd.x = Column_Measure_01_0[i].D();
+						ptEnd.y = Row_Measure_01_0[i].D();
+						isInit = true;
+					}
+
+					result = true;
+					if (pt.x < ptStart.x)  ptStart = pt;
+					if (pt.x > ptEnd.x)    ptEnd = pt;
+				}
+			}
+			else {
+				for (int i = 0; i < iCount; i++) {
+					pt.x = Column_Measure_01_0[i].D();
+					pt.y = Row_Measure_01_0[i].D();
+					if (!isInit) {
+						ptStart.x = Column_Measure_01_0[i].D();
+						ptStart.y = Row_Measure_01_0[i].D();
+						ptEnd.x = Column_Measure_01_0[i].D();
+						ptEnd.y = Row_Measure_01_0[i].D();
+						isInit = true;
+					}
+
+					result = true;
+					if (pt.y < ptStart.y)  ptStart = pt;
+					if (pt.y > ptEnd.y)    ptEnd = pt;
+				}
+			}
+		}
+		return result;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::GetMeasureNearPos(HalconCpp::HObject& hObject, Line2D line, int threshold, int modeTrans, int step, Point2D& ptStart, Point2D& ptEnd) {
+	/* code */
+	if (!ClsVision::ObjectExist(hObject))  return false;
+
+	try {
+		HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0;
+		LineRowStart_Measure_01_0 = line.pt0.y;
+		LineColumnStart_Measure_01_0 = line.pt0.x;
+		LineRowEnd_Measure_01_0 = line.pt1.y;
+		LineColumnEnd_Measure_01_0 = line.pt1.x;
+
+		HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2;
+		TmpCtrl_Row = 0.5 * (LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0);
+		TmpCtrl_Column = 0.5 * (LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0);
+		TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0;
+		TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0;
+
+		HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi);
+
+		HalconCpp::TupleSqrt(TmpCtrl_Dr * TmpCtrl_Dr + TmpCtrl_Dc * TmpCtrl_Dc, &TmpCtrl_Len1);
+		TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1;
+		TmpCtrl_Len2 = 0.5 * step;
+
+		HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0;
+		HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight);
+
+		HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple  Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0;
+		std::string strMode = "all";
+		if (0 == modeTrans) {
+			strMode = "all";
+		}
+		else if (1 == modeTrans) {
+			strMode = "positive";
+		}
+		else if (2 == modeTrans) {
+			strMode = "negative";
+		}
+		HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0);
+		HalconCpp::CloseMeasure(MsrHandle_Measure_01_0);
+
+		bool result = false;
+		HalconCpp::HTuple hvLenth;
+		HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth);
+		int iCount = hvLenth[0].I();
+		if (iCount > 0) {
+			ptStart.x = Column_Measure_01_0[0].D();
+			ptStart.y = Row_Measure_01_0[0].D();
+
+			if (1 == iCount) {
+				ptEnd = ptStart;
+				return true;
+			}
+
+			ptEnd.x = Column_Measure_01_0[1].D();
+			ptEnd.y = Row_Measure_01_0[1].D();
+			result = true;
+		}
+
+		return result;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::GetMeasureRCutPos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int chamberSize, double proDist, Point2D &ptStart, Point2D &ptEnd) {
+	/* code */
+	if (!ClsVision::ObjectExist(hObject))  return false;
+
+	try {
+		HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0;
+		LineRowStart_Measure_01_0 = line.pt0.y;
+		LineColumnStart_Measure_01_0 = line.pt0.x;
+		LineRowEnd_Measure_01_0 = line.pt1.y;
+		LineColumnEnd_Measure_01_0 = line.pt1.x;
+
+		HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2;
+		TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0);
+		TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0);
+		TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0;
+		TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0;
+
+		TmpCtrl_Phi = TmpCtrl_Dr.TupleAtan2(TmpCtrl_Dc);
+
+		HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1);
+		TmpCtrl_Len1 = 0.5 * (((TmpCtrl_Dr * TmpCtrl_Dr) + (TmpCtrl_Dc * TmpCtrl_Dc)).TupleSqrt()); 
+		TmpCtrl_Len2 = 5.0f;
+
+		HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0;
+		HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight);
+
+		HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple  Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0;
+		std::string strMode = "all";
+		if (0 == modeTrans) {
+			strMode = "all";
+		}
+		else if (1 == modeTrans) {
+			strMode = "positive";
+		}
+		else if (2 == modeTrans) {
+			strMode = "negative";
+		}
+		HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", 
+			&Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0);
+		HalconCpp::CloseMeasure(MsrHandle_Measure_01_0);
+
+		double fzMinDist = 0.25 * chamberSize;
+		if (proDist > 1.0f) {
+			double temp = 0.8 * proDist;
+			if (temp > fzMinDist) {
+				fzMinDist = temp;
+			}
+		}
+		if (fzMinDist < 8.0f) fzMinDist = 8.0f;
+
+		HalconCpp::HTuple hvLenth = Row_Measure_01_0.TupleLength();
+		int sz = hvLenth[0].I();
+		if (sz < 1) return false;
+		if (Amplitude_Measure_01_0[0].D() > 0) return false;
+		ptStart.x = Column_Measure_01_0[0].D();
+		ptStart.y = Row_Measure_01_0[0].D();
+
+		bool isFind = false;
+		double dist = 0.0f; 
+		if (sz > 1) {
+			for (int i = 1; i < sz; i++) {
+				if (Amplitude_Measure_01_0[i].D() < 0.0f) {
+					dist += Distance_Measure_01_0[i - 1].D();
+					continue;
+				}
+				ptEnd.x = Column_Measure_01_0[i].D();
+				ptEnd.y = Row_Measure_01_0[i].D();
+				dist += Distance_Measure_01_0[i - 1].D();
+				if (dist > fzMinDist && dist < chamberSize) {
+					isFind = true;
+					break;
+				}
+
+				if (dist > chamberSize) {
+					break;
+				}
+			}
+		}
+
+		if ((!isFind) && proDist > 1.0f) {
+			dist = ClsVision::DistancePP(ptStart, line.pt1);
+			Point2D pose;
+			std::vector<Point2D> vPtStd, vPtReal;
+			pose.x = 0.0f;
+			pose.y = 0.0f;
+			vPtStd.push_back(pose);
+			pose.x = dist;
+			pose.y = 0.0f;
+			vPtStd.push_back(pose);
+			vPtReal.push_back(ptStart);
+			vPtReal.push_back(line.pt1);
+
+			ParaAffine2D affine = ClsVision::VectorToRigid(vPtStd, vPtReal);
+			pose.x = proDist;
+			pose.y = 0.0f;
+			ptEnd = ClsVision::CoordinateTransform(pose, affine);
+			isFind = true;
+		}
+
+		return isFind;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::GetMeasurePosKeyLimit(HalconCpp::HObject &hObject, Line2D line, int nTypePoint, int threshold, int modeTrans, int step, int distLimit, Point2D &ptStart, Point2D &ptEnd) {
+	/* code */
+	if (!ClsVision::ObjectExist(hObject))  return false;
+
+	try {
+		HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0;
+		LineRowStart_Measure_01_0 = line.pt0.y;
+		LineColumnStart_Measure_01_0 = line.pt0.x;
+		LineRowEnd_Measure_01_0 = line.pt1.y;
+		LineColumnEnd_Measure_01_0 = line.pt1.x;
+
+		HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2;
+		TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0);
+		TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0);
+		TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0;
+		TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0;
+		HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi);
+		HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1);
+		TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1;
+		TmpCtrl_Len2 = 0.5 * step;
+
+		HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0;
+		HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight);
+
+		HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple  Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0;
+		std::string strMode = "all";
+		if (0 == modeTrans) {
+			strMode = "all";
+		}
+		else if (1 == modeTrans) {
+			strMode = "positive";
+		}
+		else if (2 == modeTrans) {
+			strMode = "negative";
+		}
+		HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0);
+		HalconCpp::CloseMeasure(MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple hvLenth;
+		HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth);
+		int nCount = hvLenth[0].I();
+		if (nCount < 1) return false;
+
+		ptStart.x = Column_Measure_01_0[0].D();
+		ptStart.y = Row_Measure_01_0[0].D();
+		ptEnd.x = Column_Measure_01_0[nCount - 1].D();
+		ptEnd.y = Row_Measure_01_0[nCount - 1].D();
+
+		Point2D point;
+		if (0 == nTypePoint) {
+			point = ptStart;
+		}
+		else {
+			point = ptEnd;
+		}
+
+		int idx = -1;
+		double maxDist = MININT;
+		Point2D pt;
+		for (int i = 0; i < nCount; i++) {
+			pt.x = Column_Measure_01_0[i].D();
+			pt.y = Row_Measure_01_0[i].D();
+			double dx = pt.x - point.x;
+			double dy = pt.y - point.y;
+			double dist = sqrt(dx * dx + dy * dy);
+			if (dist < distLimit && dist > maxDist) {
+				maxDist = dist;
+				idx = i;
+			}
+		}
+		if (idx < 0) return false;
+
+		point.x = Column_Measure_01_0[idx].D();
+		point.y = Row_Measure_01_0[idx].D();
+		if (0 == nTypePoint) {
+			ptStart = point;
+		}
+		else {
+			ptEnd = point;
+		}
+
+		return true;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &result, int &xPosPxl, int &yPosPxl) {
+	/* code */
+	xPosPxl = 0;
+	yPosPxl = 0;
+	result = 0.0f;
+	CCornerDistProcess *dotCorner = CVisionRecipe::getInstance()->getCornerDistProcess(eDir);
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData)  return true;
+	if (NULL == dotCorner) return true;
+	if (NULL == dot) return true;
+	
+
+	Point2D locResult = dot->m_ptMatchResult;
+	Point2D measureResult = dot->m_ptMeasureResult;
+	Point2D nearResult = dot->m_ptNearResult;
+
+	xPosPxl = dot->m_locPointResult.x;
+	yPosPxl = dot->m_locPointResult.y;
+
+	int distMode = dot->m_distMode;
+	if (0 == distMode) {
+		double dx = measureResult.x - nearResult.x;
+		result = fabs(pSideData->m_dPixelSizeX * dx);
+	}
+	else if (1 == distMode) {
+		Point2I topMark = pSideData->getPose(0);
+		Point2I botMark = pSideData->getPose(1);
+
+		Line2D line1, line2;
+		line1.pt0.x = topMark.x;
+		line1.pt0.y = topMark.y;
+		line1.pt1.x = botMark.x;
+		line1.pt1.y = botMark.y;
+
+		line2.pt0.x = measureResult.x;
+		line2.pt0.y = measureResult.y;
+		line2.pt1.x = measureResult.x + 1000.0f;
+		line2.pt1.y = measureResult.y;
+
+		Point2D pose = ClsVision::LineIntersection(line1, line2);
+		double dx = measureResult.x - pose.x;
+		result = fabs(pSideData->m_dPixelSizeX * dx);
+	}
+	else if (2 == distMode) {
+		Point2I pose = pSideData->getPose(0);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (3 == distMode) {
+		Point2I pose = pSideData->getPose(1);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (4 == distMode) {
+		Point2I pose = pSideData->getPose(2);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (5 == distMode) {
+		Point2I pose = pSideData->getPose(3);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (6 == distMode) {
+		Point2D pose = nearResult;
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (7 == distMode) {
+		Point2D pose = locResult;
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+
+	if (dot->m_maxValue < 0.1) return true;
+	if (dot->m_minValue > dot->m_maxValue) return true;
+
+	if (result < dot->m_minValue || result > dot->m_maxValue) return false;
+
+	return true;
+}
+
+int CVisionBufferPro::getDistResult(DimensionDir eDir,  CDistDotProcess *dot, double &distResult) {
+	/* code */
+	//1. 初始化结果
+	distResult = 0.0f;
+	int nRet = 0;
+	CCornerDistProcess *dotCorner = CVisionRecipe::getInstance()->getCornerDistProcess(eDir);
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData)  return nRet;
+	if (NULL == dotCorner) return nRet;
+	if (NULL == dot) return nRet;
+
+
+	Point2D locResult = dot->m_ptMatchResult;
+	Point2D measureResult = dot->m_ptMeasureResult;
+	Point2D nearResult = dot->m_ptNearResult;
+
+	int distMode = dot->m_distMode;
+	if (0 == distMode) {
+		double dx = measureResult.x - nearResult.x;
+		distResult = fabs(pSideData->m_dPixelSizeX * dx);
+	}
+	else if (1 == distMode) {
+		Point2I topMark = pSideData->getPose(0);
+		Point2I botMark = pSideData->getPose(1);
+
+		Line2D line1, line2;
+		line1.pt0.x = topMark.x;
+		line1.pt0.y = topMark.y;
+		line1.pt1.x = botMark.x;
+		line1.pt1.y = botMark.y;
+
+		line2.pt0.x = measureResult.x;
+		line2.pt0.y = measureResult.y;
+		line2.pt1.x = measureResult.x + 1000.0f;
+		line2.pt1.y = measureResult.y;
+
+		Point2D pose = ClsVision::LineIntersection(line1, line2);
+		double dx = measureResult.x - pose.x;
+		distResult = fabs(pSideData->m_dPixelSizeX * dx);
+	}
+	else if (2 == distMode) {
+		Point2I pose = pSideData->getPose(0);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (3 == distMode) {
+		Point2I pose = pSideData->getPose(1);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (4 == distMode) {
+		Point2I pose = pSideData->getPose(2);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (5 == distMode) {
+		Point2I pose = pSideData->getPose(3);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (6 == distMode){
+		Point2D pose = nearResult;
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (7 == distMode) {
+		Point2D pose = locResult;
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+
+	if (dot->m_maxValue < 0.1) return 0;
+	if (dot->m_minValue > dot->m_maxValue) return 0;
+
+	if (distResult < dot->m_minValue || distResult > dot->m_maxValue) return 1;
+
+	return 0;
+}
+
+bool CVisionBufferPro::TransformToReal(DimensionDir eDir, Point2I point, int nType, Point2I &result) {
+	/* code */
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData) return false;
+	if (0 == nType) {
+		if (!pSideData->m_bTopMark_Find) return false;
+		if (!pSideData->m_bBotMark_Find)  return false;
+	}
+	else {
+		if (!pSideData->m_bTopPoint_Find) return false;
+		if (!pSideData->m_bBotPoint_Find) return false;
+	}
+
+	double xMmvsp = pSideData->m_dPixelSizeX;
+	double yMmvsp = pSideData->m_dPixelSizeY;
+
+	Point2I ptTop, ptBot, bzTopPoint, bzBotPoint;
+	Point2D stdPoint;
+	if (0 == nType) {                    //Origine Mark Line
+		ptTop = pSideData->m_mTopMark;
+		ptBot = pSideData->m_mBotMark;
+		bzTopPoint = pSideData->m_mTopBzMark;
+        bzBotPoint = pSideData->m_mBotBzMark;
+		stdPoint.x = bzTopPoint.x + point.x;
+		stdPoint.y = bzTopPoint.y + point.y;
+	}
+	else if (1 == nType) {               //Top MarkPoint
+		ptTop = pSideData->m_mTopPoint;
+		ptBot = pSideData->m_mBotPoint;
+		bzTopPoint = pSideData->m_mTopBzPoint;
+        bzBotPoint = pSideData->m_mBotBzPoint;
+		stdPoint.x = bzTopPoint.x + point.x;
+        stdPoint.y = bzTopPoint.y + point.y;
+	}
+	else if (2 == nType) {               //Bot MarkLine
+		ptTop = pSideData->m_mTopPoint;
+		ptBot = pSideData->m_mBotPoint;
+		bzTopPoint = pSideData->m_mTopBzPoint;
+		bzBotPoint = pSideData->m_mBotBzPoint;
+		stdPoint.x = bzBotPoint.x + point.x;
+		stdPoint.y = bzBotPoint.y + point.y;
+	}
+
+	Point2D pose;
+	std::vector<Point2D> vPtOrigine, vPtReal;
+	pose.x = bzTopPoint.x;
+	pose.y = bzTopPoint.y;
+	vPtOrigine.push_back(pose);
+    pose.x = bzBotPoint.x;
+    pose.y = bzBotPoint.y;
+    vPtOrigine.push_back(pose);
+
+	pose.x = xMmvsp * ptTop.x;
+    pose.y = yMmvsp * ptTop.y;
+    vPtReal.push_back(pose);
+    pose.x = xMmvsp * ptBot.x;
+    pose.y = yMmvsp * ptBot.y;
+    vPtReal.push_back(pose);
+
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtOrigine, vPtReal);
+	Point2D ptResult = ClsVision::CoordinateTransform(stdPoint, affine);
+	result.x = (int)(ptResult.x / xMmvsp + 0.5);
+    result.y = (int)(ptResult.y / yMmvsp + 0.5);
+
+	return true;
+
+#if 0
+	double dx = xMmvsp * (ptBot.x - ptTop.x);
+	double dy = yMmvsp * (ptBot.y - ptTop.y);
+	double dist = sqrt(dx * dx + dy * dy);
+
+	Point2D posTopReal, posBotReal, poseReal;
+	posTopReal.x = 0.0f;
+	posTopReal.y = 0.0f;
+	posBotReal.x = 0.0f;
+	posBotReal.y = dist;
+	if (0 == nType) {
+		poseReal = posTopReal;
+		poseReal.x += point.x;
+		poseReal.y += point.y;
+	}
+	else if (1 == nType) {
+		poseReal = posTopReal;
+		poseReal.x += point.x;
+		poseReal.y += point.y;
+	}
+	else if (2 == nType) {
+		poseReal = posBotReal;
+		poseReal.x += point.x;
+		poseReal.y += point.y;
+	}
+
+	std::vector<Point2D> vPtOrigine, vPtReal;
+	vPtOrigine.push_back(posTopReal);
+	vPtOrigine.push_back(posBotReal);
+	Point2D pose;
+	pose.x = 0.0f;
+	pose.y = 0.0f;
+	vPtReal.push_back(pose);
+	pose.x = xMmvsp * (ptBot.x - ptTop.x);
+	pose.y = yMmvsp * (ptBot.y - ptTop.y);
+	vPtReal.push_back(pose);
+
+	double dist1 = sqrt(pose.x * pose.x + pose.y * pose.y);
+	printf("dist: %.0f", dist1);
+
+
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtOrigine, vPtReal);
+	Point2D ptResult = ClsVision::CoordinateTransform(poseReal, affine);
+	result.x = (int)(ptTop.x + ptResult.x / xMmvsp);
+	result.y = (int)(ptTop.y + ptResult.y / yMmvsp);
+
+	return true;
+#endif
+}
+
+void CVisionBufferPro::getRect2Point(Point2D rect2CenterPoint, double rect2Phi, double rect2Length1, double rect2Length2, Point2D *rect2Points) {
+	/* code */
+	double cosValue = cos(rect2Phi);
+	double sinValue = sin(rect2Phi);
+
+	double Row = rect2CenterPoint.y;
+	double Column = rect2CenterPoint.x;
+	double Length1 = rect2Length1;
+	double Length2 = rect2Length2;
+
+	//LeftTop Point
+	double TopLeft_X = -Length1*cosValue - Length2*sinValue;
+	double TopLeft_Y = -Length1*sinValue + Length2*cosValue;
+	rect2Points[0].x = Row - TopLeft_Y;
+	rect2Points[0].y = Column + TopLeft_X;
+
+	//RightTop Point
+	double TopRight_X = Length1*cosValue - Length2*sinValue;
+	double TopRight_Y = Length1*sinValue + Length2*cosValue;
+	rect2Points[1].x = Row - TopRight_Y;
+	rect2Points[1].y = Column + TopRight_X;
+
+	//RightDown Point
+	double LowerRight_X = Length1*cosValue + Length2*sinValue;
+	double LowerRight_Y = Length1*sinValue - Length2*cosValue;
+	rect2Points[2].x = Row - LowerRight_Y;
+	rect2Points[2].y = Column + LowerRight_X;
+
+	//LeftDown Point
+	double LowerLeft_X = -Length1*cosValue + Length2*sinValue;
+	double LowerLeft_Y = -Length1*sinValue - Length2*cosValue;
+	rect2Points[3].x = Row - LowerLeft_Y;
+	rect2Points[3].y = Column + LowerLeft_X;
+}
+
+Line2D CVisionBufferPro::getRect2Line(Point2D rect2CenterPoint, double rect2Phi, int rect2Length2) {
+	/* code */
+	Point2D rect2Points[4];
+	double rect2Length1 = 100.0f;
+	double length2 = rect2Length2;
+	getRect2Point(rect2CenterPoint, rect2Phi, rect2Length1, length2, rect2Points);
+	Line2D line;
+	line.pt0.x = 0.5 *(rect2Points[0].x + rect2Points[1].x);
+	line.pt0.y = 0.5 *(rect2Points[0].y + rect2Points[1].y);
+	line.pt1.x = 0.5 *(rect2Points[2].x + rect2Points[3].x);
+	line.pt1.y = 0.5 *(rect2Points[2].y + rect2Points[3].y);
+	return line;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+void SetMetrologyTransition(int hHandle, int iIndex, int getLineMode){
+	/* code */
+	if (hHandle < 0 || iIndex < 0) return;
+
+	if (0 == getLineMode){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "all");
+	}
+	else if (1 == getLineMode){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "positive");
+	}
+	else if (2 == getLineMode){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "negative");
+	}
+}
+
+void SetMetrologySelect(int hHandle, int iIndex, int getLineDirection){
+	/* code */
+	if (hHandle < 0 || iIndex < 0) return;
+
+	if (0 == getLineDirection){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "all");
+	}
+	else if (1 == getLineDirection){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "first");
+	}
+	else if (2 == getLineDirection){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "last");
+	}
+}
+
+bool CVisionBufferPro::LineMeasureByRuler(HalconCpp::HObject &hObject, Line2D line,
+	LineMetrologyPara shapeMetrologyPara, Line2D &lineResult)
+{
+	/* code */
+	lineResult = line;
+	if (!ClsVision::ObjectExist(hObject)){
+		return false;
+	}
+
+	try
+	{
+		//1. 图像尺寸
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(hObject, width, height);
+
+		//2. 创建测量句柄
+		HalconCpp::HTuple hvMetrologyHandle;
+		HalconCpp::CreateMetrologyModel(&hvMetrologyHandle);
+		HalconCpp::SetMetrologyModelImageSize(hvMetrologyHandle, width, height);
+
+		//3. 创建测直线的参数
+		HalconCpp::HTuple hvLineParams;
+		if (true){
+			Line2D curLine = line;
+			int lineDirection = shapeMetrologyPara.direction;
+			if (0 == lineDirection){
+				if (line.pt0.x < line.pt1.x) {
+					curLine = line;
+				}
+				else {
+					curLine.pt1 = line.pt0;
+					curLine.pt0 = line.pt1;
+				}
+			}
+			else if (1 == lineDirection){
+				if (line.pt0.y < line.pt1.y){
+					curLine = line;
+				}
+				else{
+					curLine.pt0 = line.pt1;
+					curLine.pt1 = line.pt0;
+				}
+			}
+			//直线方向
+			hvLineParams.Clear();
+			hvLineParams.Append(curLine.pt0.y);
+			hvLineParams.Append(curLine.pt0.x);
+			hvLineParams.Append(curLine.pt1.y);
+			hvLineParams.Append(curLine.pt1.x);
+		}
+
+		HalconCpp::HTuple hvIndex, hvLen;
+		double stepLength = shapeMetrologyPara.stepLength;
+		double stepDist = shapeMetrologyPara.stepDist;
+		int threshold = shapeMetrologyPara.threshold;
+		HalconCpp::AddMetrologyObjectGeneric(hvMetrologyHandle, "line", hvLineParams, stepLength, stepDist, 1, threshold,
+			HalconCpp::HTuple(), HalconCpp::HTuple(), &hvIndex);
+		int iHandle = hvMetrologyHandle[0].I();
+
+		HalconCpp::TupleLength(hvIndex, &hvLen);
+		if (hvLen[0].I() < 1){
+			HalconCpp::ClearMetrologyModel(iHandle);
+			return false;
+		}
+
+		int iIndex = hvIndex[0].I();
+		if (iIndex < 0){
+			HalconCpp::ClearMetrologyModel(iHandle);
+			return false;
+		}
+
+		//直线的边界点类型
+		int getLineMode = shapeMetrologyPara.getMode;
+		SetMetrologyTransition(iHandle, iIndex, getLineMode);
+
+		HalconCpp::SetMetrologyObjectParam(iHandle, iIndex, "num_measures", shapeMetrologyPara.numSample);
+		HalconCpp::SetMetrologyObjectParam(iHandle, iIndex, "min_score", shapeMetrologyPara.minScore);
+
+		//设置直线提取模式
+		SetMetrologySelect(iHandle, iIndex, shapeMetrologyPara.getDirection);
+		HalconCpp::ApplyMetrologyModel(hObject, iHandle);
+		HalconCpp::HTuple hvParameter, hvLength;
+		HalconCpp::GetMetrologyObjectResult(iHandle, iIndex, "all", "result_type", "all_param", &hvParameter);
+		HalconCpp::TupleLength(hvParameter, &hvLength);
+		if (hvLength[0].I() < 1){
+			HalconCpp::ClearMetrologyModel(iHandle);
+			return false;
+		}
+
+		lineResult.pt0.y = hvParameter[0].D();
+		lineResult.pt0.x = hvParameter[1].D();
+		lineResult.pt1.y = hvParameter[2].D();
+		lineResult.pt1.x = hvParameter[3].D();
+		HalconCpp::ClearMetrologyModel(iHandle);
+
+		return true;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::findCutLine(DimensionDir eDir, Point2I keyPoint, int keyRange, int keyThres, Point2I &result) {
+	/* code */
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData)  return false;
+	if (!pSideData->m_bTopMark_Find)  return false;
+	if (!pSideData->m_bBotMark_Find)  return false;
+
+	int x1 = keyPoint.x - keyRange;
+	int y1 = keyPoint.y - 31;
+	int x2 = keyPoint.x + keyRange;
+	int y2 = keyPoint.y + 31;
+	Point2I leftTop;
+	leftTop.x = x1;
+	leftTop.y = y1;
+	HalconCpp::HObject hImage;
+	if (!getImageROI(eDir, hImage, x1, y1, x2, y2)) return false;
+
+	HalconCpp::HObject hMeanImage;
+	HalconCpp::MeanImage(hImage, &hMeanImage, 1, 20);
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 10 || height < 25)  return false;
+
+	HalconCpp::HObject hLineRegionRoi;
+	HalconCpp::GenRegionLine(&hLineRegionRoi, 0.5 * height - 1, 0, 0.5 * height - 1, width - 1);
+	HalconCpp::HTuple hvY, hvX, hvGray;
+	HalconCpp::GetRegionPoints(hLineRegionRoi, &hvY, &hvX);
+	HalconCpp::GetGrayval(hMeanImage, hvY, hvX, &hvGray);
+	HalconCpp::HTuple hvLength = hvX.TupleLength();
+	int num = hvLength[0].I();
+	if (num < 10) return false;
+
+	HalconCpp::HTuple hvCyValue;
+	for (int i = 0; i < num; i++) {
+		if (hvGray[i].I() < keyThres) {
+			hvCyValue[i] = 255;
+		}
+		else {
+			hvCyValue[i] = 0;
+		}
+	}
+
+	bool isStart = false;
+	bool isFind = false;
+	int nEdgeLine = 0;
+	for (int i = 0; i < num - 1; i++) {
+		if (isFind) break;
+
+		if (hvCyValue[i].I() > 120 || hvCyValue[i + 1].I() > 120) {
+			isStart = true;
+			nEdgeLine = i;
+		}
+
+		if (isStart && hvCyValue[i].I() < 120 && hvCyValue[i + 1].I() < 120) {
+			isFind = true;
+		}
+	}
+	if (!isFind) return false;
+
+	result.x = leftTop.x + nEdgeLine;
+	result.y = leftTop.y + (int)(height / 2);
+	return true;
+}
+
+int CVisionBufferPro::findNorchDefect(DimensionDir eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, 
+	int szType, int xFzSize, int yFzSize, CRect* aryResult) {
+	/* code */
+	if (roiRect.Width() < 10 || roiRect.Height() < 10) return 0;
+	if (nThres < 5 || nBinThres < 5) return 0;
+	if (0 == szType)  return 0;
+
+	int sz = (int)(vPoints.size());
+	if (sz < 3) return 0;
+
+	std::vector<Point2D> vEdgePoints;
+	for (auto item : vPoints) {
+		Point2D point = item;
+		vEdgePoints.push_back(point);
+	}
+	//1. 进行自上而下的排序
+	for (int i = 0; i < sz - 1; i++) {
+		for (int j = i + 1; j < sz; j++) {
+			if (vEdgePoints[i].y > vEdgePoints[j].y) {
+                Point2D temp = vEdgePoints[i];
+				vEdgePoints[i] = vEdgePoints[j];
+				vEdgePoints[j] = temp;
+			}
+		}
+	}
+
+	//2. 截取ROI图像
+	int x1 = roiRect.left;
+	int y1 = roiRect.top;
+	int x2 = roiRect.right;
+	int y2 = roiRect.bottom;
+	HalconCpp::HObject hImage;
+	if (!getImageROI(eDir, hImage, x1, y1, x2, y2)) return 0;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 10 || height < 10) return 0;
+
+
+	//3. 点位偏移
+	for (int i = 0; i < sz; i++) {
+		vEdgePoints[i].x -= roiRect.left;
+        vEdgePoints[i].y -= roiRect.top;
+	}
+
+	int edgeThres = nThres;
+	if (nThres > 10) {
+		edgeThres = 10;
+	}
+
+	std::vector<vec> vEdgeCtrlPoint;
+	for (int i = 0; i < sz; i++) {
+		if (0 != i) {
+			double dy = vEdgePoints[i].y - vEdgePoints[i - 1].y;
+			double dx = vEdgePoints[i].x - vEdgePoints[i - 1].x;
+			if (dy > 450) {
+				for (int j = 0; j < 3; j++) {
+					Line2D line;
+					line.pt0.x = vEdgePoints[i - 1].x + (j + 1) * dx / 4 - 75;
+					line.pt0.y = vEdgePoints[i - 1].y + (j + 1) * dy / 4;
+					line.pt1.x = vEdgePoints[i - 1].x + (j + 1) * dx / 4 + 75;
+					line.pt1.y = vEdgePoints[i - 1].y + (j + 1) * dy / 4;
+					if (line.pt0.x < 0) line.pt0.x = 1;
+					if (line.pt0.x > width - 1) line.pt0.x = width - 2;
+					if (line.pt0.y < 0) line.pt0.y = 1;
+					if (line.pt0.y > height - 1) line.pt0.y = height - 2;
+					if (line.pt1.x < 0) line.pt1.x = 1;
+					if (line.pt1.x > width - 1) line.pt1.x = width - 2;
+					if (line.pt1.y < 0) line.pt1.y = 1;
+					if (line.pt1.y > height - 1) line.pt1.y = height - 2;
+					if (line.pt1.x > line.pt0.x) {
+						Point2D ptStart, ptEnd;
+						if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) {
+							float xPos = (float)(ptEnd.x);
+							float yPos = (float)(ptEnd.y);
+							vec p1(xPos, yPos, 0);
+							vEdgeCtrlPoint.push_back(p1);
+						}
+					}
+				}
+			}
+			else if (dy > 300) {
+				for (int j = 0; j < 2; j++) {
+					Line2D line;
+					line.pt0.x = vEdgePoints[i - 1].x + (j + 1) * dx / 3 - 75;
+					line.pt0.y = vEdgePoints[i - 1].y + (j + 1) * dy / 3;
+					line.pt1.x = vEdgePoints[i - 1].x + (j + 1) * dx / 3 + 75;
+					line.pt1.y = vEdgePoints[i - 1].y + (j + 1) * dy / 3;
+					if (line.pt0.x < 0) line.pt0.x = 1;
+					if (line.pt0.x > width - 1) line.pt0.x = width - 2;
+					if (line.pt0.y < 0) line.pt0.y = 1;
+					if (line.pt0.y > height - 1) line.pt0.y = height - 2;
+					if (line.pt1.x < 0) line.pt1.x = 1;
+					if (line.pt1.x > width - 1) line.pt1.x = width - 2;
+					if (line.pt1.y < 0) line.pt1.y = 1;
+					if (line.pt1.y > height - 1) line.pt1.y = height - 2;
+					if (line.pt1.x > line.pt0.x) {
+						Point2D ptStart, ptEnd;
+						if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) {
+							float xPos = (float)(ptEnd.x);
+							float yPos = (float)(ptEnd.y);
+							vec p1(xPos, yPos, 0);
+							vEdgeCtrlPoint.push_back(p1);
+						}
+					}
+				}
+			}
+			else {
+				Line2D line;
+				line.pt0.x = 0.5 * (vEdgePoints[i].x + vEdgePoints[i - 1].x) - 75;
+				line.pt0.y = 0.5 * (vEdgePoints[i].y + vEdgePoints[i - 1].y);
+				line.pt1.x = 0.5 * (vEdgePoints[i].x + vEdgePoints[i - 1].x) + 75;
+				line.pt1.y = 0.5 * (vEdgePoints[i].y + vEdgePoints[i - 1].y);
+				if (line.pt0.x < 0) line.pt0.x = 1;
+				if (line.pt0.x > width - 1) line.pt0.x = width - 2;
+				if (line.pt0.y < 0) line.pt0.y = 1;
+				if (line.pt0.y > height - 1) line.pt0.y = height - 2;
+				if (line.pt1.x < 0) line.pt1.x = 1;
+				if (line.pt1.x > width - 1) line.pt1.x = width - 2;
+				if (line.pt1.y < 0) line.pt1.y = 1;
+				if (line.pt1.y > height - 1) line.pt1.y = height - 2;
+				if (line.pt1.x > line.pt0.x) {
+					Point2D ptStart, ptEnd;
+					if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) {
+						float xPos = (float)(ptEnd.x);
+						float yPos = (float)(ptEnd.y);
+						vec p1(xPos, yPos, 0);
+						vEdgeCtrlPoint.push_back(p1);
+					}
+				}
+			}
+		}
+		Point2D point = vEdgePoints[i];
+		vec p0((float)point.x, (float)point.y, 0);
+		vEdgeCtrlPoint.push_back(p0);
+	}
+
+	CBspline bspline(vEdgeCtrlPoint);
+	bspline.execute();
+
+	int number = (int)(bspline.m_vPtResults.size());
+	if (number < 10) return 0;
+
+	std::vector<Point2D> vPointResults;
+	for (int i = 0; i < number; i++) {
+		Point2D point;
+		point.x = bspline.m_vPtResults[i][0] + nOffset;
+        point.y = bspline.m_vPtResults[i][1];
+        vPointResults.push_back(point);
+	}
+
+	HalconCpp::HTuple hvY, hvX;
+	int idx = 0;
+	for (auto item : vPointResults) {
+		hvX[idx] = item.x;
+		hvY[idx] = item.y;
+		idx += 1;
+	}
+
+	hvX[idx] = width - 5;
+	hvY[idx] = height - 5;
+	idx += 1;
+
+	hvX[idx] = width - 5;
+	hvY[idx] = 5;
+	idx += 1;
+
+	HalconCpp::HObject hRoiRegion;
+	HalconCpp::GenRegionPolygonFilled(&hRoiRegion, hvY, hvX);
+
+#if 0
+	HalconCpp::HWindow hDispWin(0, 0, 0.4 * width, 0.4 * height);
+	hDispWin.SetPart(0, 0, height-1, width-1);
+	hDispWin.SetColor("green");
+	hDispWin.SetDraw("margin");
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hRoiRegion);
+	hDispWin.Click();
+#endif
+
+	HalconCpp::HObject hBinRegion, hRegion, hConnectRegion, hSelectRegion;
+	HalconCpp::ReduceDomain(hImage, hRoiRegion, &hBinRegion);
+	HalconCpp::Threshold(hBinRegion, &hRegion, 0, nBinThres);
+	HalconCpp::Connection(hRegion, &hConnectRegion);
+	if (1 == szType) {
+		HalconCpp::HObject hSelectRegionX, hSelectRegionY, hConcatRegion, hUinonRegion, hClosngRegion;
+		HalconCpp::SelectShape(hConnectRegion, &hSelectRegionX, "width", "and", xFzSize, 99999999);
+		HalconCpp::SelectShape(hConnectRegion, &hSelectRegionY, "height", "and", yFzSize, 99999999);
+		HalconCpp::ConcatObj(hSelectRegionX, hSelectRegionY, &hConcatRegion);
+		HalconCpp::Union1(hConcatRegion, &hUinonRegion);
+		HalconCpp::ClosingCircle(hUinonRegion, &hClosngRegion, 7.5);
+		HalconCpp::Connection(hClosngRegion, &hSelectRegion);
+	}
+	else {
+		HalconCpp::HObject hSelectRegionX, hSelectRegionY, hConcatRegion, hUinonRegion, hClosngRegion;
+		HalconCpp::SelectShape(hConnectRegion, &hSelectRegionX, "width", "and", xFzSize, 99999999);
+		HalconCpp::SelectShape(hSelectRegionX, &hSelectRegion, "height", "and", yFzSize, 99999999);
+		HalconCpp::Union1(hSelectRegion, &hUinonRegion);
+		HalconCpp::ClosingCircle(hUinonRegion, &hClosngRegion, 7.5);
+		hSelectRegion.Clear();
+		HalconCpp::Connection(hClosngRegion, &hSelectRegion);
+	}
+#if 0
+	hDispWin.SetColored(6);
+	hDispWin.SetDraw("fill");
+	hDispWin.DispObj(hSelectRegion);
+	hDispWin.Click();
+#endif
+	int nRet = ClsVision::ObjectNumber(hSelectRegion);
+	if (nRet < 1) return 0;
+
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::SmallestRectangle1(hSelectRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	int nNumber = 0;
+	for (int i = 0; i < nRet; i++) {
+		aryResult[i].left = hvX1[i].I() + roiRect.left;
+		aryResult[i].top = hvY1[i].I() + roiRect.top;
+		aryResult[i].right = hvX2[i].I() + roiRect.left;
+		aryResult[i].bottom = hvY2[i].I() + roiRect.top;
+		nNumber += 1;
+		if (i > 99) break;
+	}
+
+	return nNumber;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/VisionBufferPro.h b/BlVisionPro/Vision/VisionBufferPro.h
new file mode 100644
index 0000000..84dcd2f
--- /dev/null
+++ b/BlVisionPro/Vision/VisionBufferPro.h
@@ -0,0 +1,71 @@
+#ifndef VISION_BUFFER_PRO
+#define VISION_BUFFER_PRO
+
+#include "VisionRecipe.h"
+
+typedef struct _LineMetrologyPara
+{
+	int direction;
+	int getMode;
+	int getDirection;
+	double stepLength;
+	double stepDist;
+	int threshold;
+	int numSample;
+	double minScore;
+}LineMetrologyPara;
+
+class CVisionBufferPro
+{
+public:
+	CVisionBufferPro();
+	~CVisionBufferPro();
+
+public:
+	//1. 图像转换
+	static bool bufferToObject(DimensionDir eDir, int height, HalconCpp::HObject &hImage);
+
+	//2. 截图图像
+	static bool getImageROI(DimensionDir eDir, HalconCpp::HObject &hImage, int x1, int y1, int x2, int y2);
+	static bool getIndexImage(DimensionDir eDir, HalconCpp::HObject *hImage, int index);
+
+	//3. 获取距离的检测结果
+	static bool getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &result, int &xPosPxl, int &yPosPxl);
+
+	//4. 查找点
+	static bool GetMeasurePos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int step, Point2D &ptStart, Point2D &ptEnd);
+	static bool GetMeasurePosKeyLimit(HalconCpp::HObject &hObject, Line2D line, int nTypePoint, int threshold, int modeTrans, int step, int distLimit, Point2D &ptStart, Point2D &ptEnd);
+	static bool GetMeasureRCutPos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int chamberSize, double proDist, Point2D &ptStart, Point2D &ptEnd);
+	static bool GetMeasureNearPos(HalconCpp::HObject& hObject, Line2D line, int threshold, int modeTrans, int step, Point2D& ptStart, Point2D& ptEnd);
+
+	//5. 获取距离的检测结果
+	static int getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &distResult);
+
+	//6. 坐标转换
+	static bool TransformToReal(DimensionDir eDir, Point2I point, int nType, Point2I &result);
+
+	//7. 获取坐标  坐上点坐标、右上点坐标,右下点坐标,左下点坐标
+	static void getRect2Point(Point2D rect2CenterPoint, double rect2Phi, double rect2Length1, double rect2Length2, Point2D *rect2Points);
+
+	//8. 获取矩形的斜直线
+	static Line2D getRect2Line(Point2D rect2CenterPoint, double rect2Phi, int rect2Length2);
+
+	//9. 查找直线
+	static bool LineMeasureByRuler(HalconCpp::HObject &hObject, Line2D line,
+		LineMetrologyPara shapeMetrologyPara, Line2D &lineResult);
+
+	//10. 获取线扫的图像帧的宽度和高度
+	static void getLineFrameSize(DimensionDir eDir, int &nFrameWidth, int &nFrameHeight);
+
+	//11. 查找切割
+	static bool findCutLine(DimensionDir eDir, Point2I keyPoint, int keyRange, int keyThres, Point2I &result);
+
+	//12. 查找Norch缺陷
+	static int findNorchDefect(DimensionDir eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, 
+		int szType, int xFzSize, int yFzSize,  CRect *aryResult);
+
+private:
+
+};
+
+#endif
diff --git a/BlVisionPro/Vision/VisionRecipe.cpp b/BlVisionPro/Vision/VisionRecipe.cpp
new file mode 100644
index 0000000..86cef88
--- /dev/null
+++ b/BlVisionPro/Vision/VisionRecipe.cpp
@@ -0,0 +1,1214 @@
+#include "stdafx.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+#include "SoftVisionApp.h"
+#include <fstream> // IO 操作
+
+CVisionRecipe::CVisionRecipe() {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		m_pCornerDistProcess[i] = NULL;
+		m_pCornerRcutProcess[i] = NULL;
+		m_pLocProcese[i] = NULL;
+		m_pBlSideData[i] = NULL;
+		m_pCutProcess[i] = NULL;
+		m_pKDistProcess[i] = NULL;
+		m_pThresProcess[i] = NULL;
+	}
+
+	m_mScanSetting.lengthSize = 0;
+	m_mScanSetting.shortSize = 0;
+	m_mScanSetting.nStdIndex = 0;
+	m_mScanSetting.nIndex0 = 0;
+	m_mScanSetting.nIndex1 = 1;
+	m_mScanSetting.nIndex2 = 2;
+	m_mScanSetting.nIndex3 = 3;
+	m_mScanSetting.nLengthScan = 0;
+	m_mScanSetting.nShortScan = 0;
+
+	m_isInit = false;
+	m_pMainDlg = NULL;
+
+	m_visionDisplayInfo.isVisionDisplay = false;
+	m_visionDisplayInfo.isDistDisplay = false;
+	m_visionDisplayInfo.isRcutDisplay = false;
+	m_strVisionName = "system";
+
+	for (int i = 0; i < 8; i++) {
+		m_visionUseInfo[i].isVisionUse = false;
+		m_visionUseInfo[i].isLocUse = false;
+		m_visionUseInfo[i].isDistUse = false;
+		m_visionUseInfo[i].isRcutUse = false;
+	}
+
+	m_keyInfo.isDebugTool = false;
+	m_keyInfo.isInspectKey = false;
+	m_keyInfo.isLocKey = false;
+	m_keyInfo.isGrindKey = false;
+	m_keyInfo.isDistKey = false;
+	m_keyInfo.isCutLineKey = false;
+	m_keyInfo.isRcutKey = false;
+
+	//默认一个配方数据
+	m_workDir = ClsVision::GetAppPathA() + "Recipe";
+	m_configVision.SetWorkDir(m_workDir.c_str(), m_strVisionName.c_str());
+	readVisionConfig();
+	m_isOpenVisionDlg = FALSE;
+
+	m_nFrameX1 = -1;
+	m_nFrameY1 = -1;
+	m_nFrameX1 = -1;
+	m_nFrameY2 = -1;
+
+	m_nStage = -1;
+	InitializeCriticalSection(&m_criticalSection);
+}
+
+CVisionRecipe::~CVisionRecipe() {
+	/* code */
+	release();
+	DeleteCriticalSection(&m_criticalSection);
+}
+
+static CVisionRecipe _gVisionRecipe;
+CVisionRecipe* CVisionRecipe::getInstance(void) {
+	/* code */
+	return &_gVisionRecipe;
+}
+
+int CVisionRecipe::setWorkDir(const char *pszPath) {
+	/* code */
+	m_workDir = pszPath;
+	return 0;
+}
+
+int CVisionRecipe::save(void) {
+	/* code */
+	std::string filePath = m_workDir;
+	int len = (int)(filePath.length());
+	if (len < 1)  return -1;
+	int pos = (int)(filePath.rfind(".dat"));
+	if (pos >= 0) return -1;
+
+	int nRet = saveRecipeFile(filePath);
+
+	return 0;
+}
+
+int CVisionRecipe::saveRecipeFile(std::string filePath) {
+	/* code */
+	//1. 首先创建文件目录
+	std::string strDir = filePath + "\\" + m_strVisionName + "\\";
+	CFileRecipe::makeDir(strDir);
+
+	//2. 清空目录下的所有文件
+	CFileRecipe::removeDir(strDir);
+
+	//3. 新建配方文件
+	//std::string fileName = strDir + "vision.csv";
+	//CString strFile = CFileRecipe::toCString(fileName);
+	//if (!CFileRecipe::openRecipeFile(m_recipeFile, strFile)) return -1;
+
+	CSoftVisionApp::getInstance()->Log(1, "Trace Save Vision Recipe!");
+
+	WriteRecipeVisionFile();
+
+	//if (CStdioFile::hFileNull != m_recipeFile.m_hFile) {
+	//	m_recipeFile.Close();
+	//}
+	return 0;
+}
+
+int CVisionRecipe::WriteRecipeVisionFile(void) {
+	/* code */
+//	if (CStdioFile::hFileNull == m_recipeFile.m_hFile) return -1;
+
+	saveVisionConfig();
+
+	std::string strDir = m_workDir + "\\" + m_strVisionName + "\\";
+	Json::Value root;
+
+	int nCount = (int)(DIMENSION_NONE);
+	for (int i = 0; i < nCount; i++) {
+		CLocProcess *dot = m_pLocProcese[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Loc%d", i);
+		root[name.c_str()] = dot->WriteToJson(strDir);                   //保存数据
+	}
+
+
+	for (int i = 0; i < nCount; i++) {
+		CGrindProcess *dot = m_pGrindProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Grind%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CCutProcess *dot = m_pCutProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Cut%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CKDistProcess *dot = m_pKDistProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("KDist%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CCornerRcutProcess *dot = m_pCornerRcutProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("RCut%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CThresProcess *dot = m_pThresProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Thres%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CHoleProcess* dot = m_pHoleProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Hole%d", i);
+		root[name.c_str()] = dot->WriteToJson(strDir);                       //保存数据
+	}
+
+	std::string fileName = strDir + "vision.json";
+	std::string strText = root.toStyledString();
+	ofstream ofs(fileName.c_str());
+	ofs << strText;
+	ofs.close();
+
+	return 0;
+}
+
+int CVisionRecipe::open(void) {
+	/* code */
+	std::string filePath = m_workDir;
+	if (!CFileRecipe::fileIsExist(filePath.c_str())) {
+		return -1;
+	}
+
+	CSoftVisionApp::getInstance()->Log(1, "Trace Load Vision Recipe!");
+	int nRet = openRecipeFile(filePath);
+	return 0;
+}
+
+int CVisionRecipe::openRecipeFile(std::string filePath) {
+	/* code */
+	readVisionConfig();
+
+#if 0
+	std::string strDir = filePath + "\\" + m_strVisionName + "\\";
+	std::string jsFile = strDir + "vision.json";
+	bool isExist = CFileRecipe::fileIsExist(jsFile.c_str());
+	if (!isExist) {
+		if (!CFileRecipe::fileIsExist(strDir)) return -1;
+
+		std::string fileName = strDir + "vision.csv";
+		CString strFile = CFileRecipe::toCString(fileName);
+		if (!CFileRecipe::readRecileFile(m_recipeFile, strFile)) {
+			return -1;
+		}
+	}
+
+	ReadRecipeFile(isExist);
+#endif
+
+	ReadRecipeFile();
+
+#if 0
+	if (!isExist) {
+		if (CStdioFile::hFileNull != m_recipeFile.m_hFile) {
+			m_recipeFile.Close();
+		}
+	}
+#endif
+
+	return 0;
+}
+
+void CVisionRecipe::ReadRecipeFile(void) {
+	/* code */
+	std::string strDir = m_workDir + "\\" + m_strVisionName + "\\";
+#if 0
+	if (!isExist) {
+		if (CStdioFile::hFileNull == m_recipeFile.m_hFile) return;
+
+		while (true) {
+			CString strReadText;
+			if (!CFileRecipe::ReadString(m_recipeFile, strReadText))  break;
+
+			DecodeRecipeText(strReadText);
+		}
+
+		return;
+	}
+#endif
+
+	std::string fileName = strDir + "vision.json";
+	if(!CFileRecipe::fileIsExist(fileName)) return;
+
+	Json::Value jsFileRoot;
+	std::ifstream ifFile(fileName.c_str());
+	Json::Reader jsReader;
+	jsReader.parse(ifFile, jsFileRoot);
+	ifFile.close();
+
+	DecodeJson(jsFileRoot);
+	jsFileRoot.clear();
+}
+
+void CVisionRecipe::DecodeJson(Json::Value jsFileRoot) {
+	/* code */
+	int num = (int)(jsFileRoot.size());
+	if (num < 1) return;
+
+	std::string strDir = m_workDir + "\\" + m_strVisionName + "\\";
+
+	//1. Loc
+	int nCount = (int)(DIMENSION_NONE);
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Loc%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CLocProcess *dot = m_pLocProcese[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(strDir, jsValue);
+	}
+
+	//2. Grind
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Grind%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CGrindProcess *dot = m_pGrindProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//3. Cut
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Cut%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CCutProcess *dot = m_pCutProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//6. KDist
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("KDist%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CKDistProcess *dot = m_pKDistProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//7. RCut
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("RCut%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CCornerRcutProcess *dot = m_pCornerRcutProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//8. Thres
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Thres%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CThresProcess *dot = m_pThresProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//9. Hole
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Hole%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CHoleProcess* dot = m_pHoleProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue, strDir);
+	}
+}
+
+#if 0
+void CVisionRecipe::DecodeRecipeText(CString strText) {
+	/* code */
+	std::string strDir = m_workDir + "\\" + m_strVisionName + "\\";
+	std::vector<std::string> vStrings;
+	int nRet = CFileRecipe::CStringSplit(strText, ",", vStrings);
+	if (nRet < 1) return;
+
+	int nVisionType = CFileRecipe::StringToInt(vStrings[0]);
+	int idx = CFileRecipe::StringToInt(vStrings[1]);
+	switch (nVisionType){
+	case LOC_VISION_TYPE: {
+		CLocProcess *dot = m_pLocProcese[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CNccDotProcess *pNccDot = dot->getDot(id);
+		if (NULL == pNccDot) return;
+		pNccDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case LOC_VISION_PROCESS: {
+		CLocProcess *dot = m_pLocProcese[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case GRIND_VISION_TYPE: {
+		CGrindProcess *dot = m_pGrindProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CGrindDotProcess *pGrindDot = dot->m_dots[id - 1];
+		if (NULL == pGrindDot)  return;
+		pGrindDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case  GRIND_VISION_PROCESS: {
+		CGrindProcess *dot = m_pGrindProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case CUT_VISION_TYPE: {
+		CCutProcess *dot = m_pCutProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CCutDotProcess *pCutDot = dot->m_dots[id - 1];
+		if (NULL == pCutDot)  return;
+		pCutDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case CUT_VISION_PROCESS: {
+		CCutProcess *dot = m_pCutProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case KDIST_VISION_TYPE: {
+		CKDistProcess *dot = m_pKDistProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CKeyDistDotProcess *pKDistDot = dot->m_dots[id - 1];
+		if (NULL == pKDistDot)  return;
+		pKDistDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case KDIST_VISION_PROCESS: {
+		CKDistProcess *dot = m_pKDistProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case RCUT_VISION_TYPE: {
+		CCornerRcutProcess *dot = m_pCornerRcutProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CRcutDotProcess *pRcutDot = dot->m_dots[id - 1];
+		if (NULL == pRcutDot)  return;
+		pRcutDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case RCUT_VISION_PROCESS: {
+		CCornerRcutProcess *dot = m_pCornerRcutProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case THRES_VISION_TYPE: {
+		CThresProcess *dot = m_pThresProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CThresDotProcess *pThresDot = dot->m_dots[id - 1];
+		if (NULL == pThresDot)  return;
+		pThresDot->ReadFile(strText, strDir);
+
+		break;
+	}
+
+	case THRES_VISION_PROCESS: {
+		CThresProcess *dot = m_pThresProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	default:
+		break;
+	}
+}
+#endif
+
+CGrabberControl* CVisionRecipe::getGrabberControl(int iCam) {
+	/* code */
+	if (iCam < 0 || iCam >= MAX_CAMERA_COUNT) return nullptr;
+
+	Lock();
+	CGrabberControl *pGrabberControl = m_pGrabberControl[iCam];
+	Unlock();
+
+	return pGrabberControl;
+}
+
+int CVisionRecipe::setGrabberControl(CGrabberControl *pGrabberControl, int iCam) {
+	/* code */
+	if (iCam < 0 || iCam >= MAX_CAMERA_COUNT) return -1;
+
+	Lock();
+	m_pGrabberControl[iCam] = pGrabberControl;
+	Unlock();
+
+	return 0;
+}
+
+int CVisionRecipe::setCameraSetting(DimensionDir eDir, int iCam, int iScan) {
+	/* code */
+	if (DIMENSION_NONE == eDir) return -1;
+
+	int idx = (int)(eDir);
+	auto iter = m_mapLineCameraSetting.find(idx);
+	if (iter == m_mapLineCameraSetting.end()) {
+		LineCameraSetting *p = new LineCameraSetting();
+		p->eDir = eDir;
+		p->nCam = iCam;
+		p->nScan = iScan;
+		m_mapLineCameraSetting[idx] = p;
+		return 0;
+	}
+
+	iter->second->eDir = eDir;
+	iter->second->nCam = iCam;
+	iter->second->nScan = iScan;
+	return 0;
+}
+
+int CVisionRecipe::init(void) {
+	/* code */
+	if (m_isInit) return 0;
+
+//	HalconCpp::SetSystem("temporary_mem_cache", "false");
+
+	//1. 创建SideData
+	createSideData();
+
+	//3. 创建RCUT数据
+	createAllCornerRcutProcess();
+
+	//4. 创建定位
+	createAllLocProcess();
+
+	//5. 创建切割线
+	createCutProcess();
+
+	//6. 创建KDist
+	createKDistProcess();
+
+	//7. 创建
+	createGrindProcess();
+
+	//8. 创建Thres
+	createThresProcess();
+
+	//9. 创建Hole
+    createHoleProcess();
+
+	m_isInit = true;
+
+	return 0;
+}
+
+
+void CVisionRecipe::createSideData(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CBlSideData *pSide = m_pBlSideData[i];
+		if (NULL != pSide) {
+			delete pSide;
+			pSide = NULL;
+			m_pBlSideData[i] = NULL;
+		}
+		m_pBlSideData[i] = new CBlSideData();
+	}
+}
+
+int CVisionRecipe::getCameraIndex(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	auto iter = m_mapLineCameraSetting.find(idx);
+	if (iter == m_mapLineCameraSetting.end()) return -1;
+
+	int nRet = iter->second->nCam;
+	return nRet;
+}
+
+int CVisionRecipe::getCameraScan(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	auto iter = m_mapLineCameraSetting.find(idx);
+	if (iter == m_mapLineCameraSetting.end()) return -1;
+
+	int nRet = iter->second->nScan;
+	return nRet;
+}
+
+void CVisionRecipe::release(void) {
+	/* code */
+	releaseLineCameraSetting();
+
+#if 0
+	releaaseAllCornerDistProcess();
+#endif
+
+	releaseAllCornerRcutProcess();
+
+	releaseAllLocProcess();
+
+	releaseAllCutProcess();
+
+	releaseAllKDistProcess();
+
+	releaseAllGrindProcess();
+
+	releaseAllThresProcess();
+
+	releaseAllHoleProcess();
+}
+
+void CVisionRecipe::releaseLineCameraSetting(void) {
+	/* code */
+	for (auto iter = m_mapLineCameraSetting.begin(); iter != m_mapLineCameraSetting.end(); iter++) {
+		if (NULL == iter->second) continue;
+		delete iter->second;
+		iter->second = NULL;
+	}
+
+	m_mapLineCameraSetting.clear();
+}
+
+void CVisionRecipe::createAllCornerDistProcess(void) {
+	/* code */
+	return;
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCornerDistProcess *pDot = m_pCornerDistProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCornerDistProcess[i] = NULL;
+		}
+		m_pCornerDistProcess[i] = new CCornerDistProcess();
+		m_pCornerDistProcess[i]->m_eDir = (DimensionDir)(i);
+	}
+}
+
+void CVisionRecipe::createAllLocProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CLocProcess *dot = m_pLocProcese[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pLocProcese[i] = NULL;
+		}
+		DimensionDir edir = (DimensionDir)(i);;
+		m_pLocProcese[i] = new CLocProcess(edir);
+	}
+}
+
+void CVisionRecipe::createCutProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCutProcess *dot = m_pCutProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pCutProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pCutProcess[i] = new CCutProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createKDistProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CKDistProcess *dot = m_pKDistProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pKDistProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pKDistProcess[i] = new CKDistProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createGrindProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CGrindProcess *dot = m_pGrindProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pGrindProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pGrindProcess[i] = new CGrindProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createThresProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CThresProcess *dot = m_pThresProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pThresProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pThresProcess[i] = new CThresProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createHoleProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CHoleProcess* dot = m_pHoleProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pHoleProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pHoleProcess[i] = new CHoleProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createAllCornerRcutProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCornerRcutProcess *pDot = m_pCornerRcutProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCornerRcutProcess[i] = NULL;
+		}
+
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pCornerRcutProcess[i] = new CCornerRcutProcess(eDir);
+	}
+}
+
+void CVisionRecipe::releaaseAllCornerDistProcess(void) {
+	/* code */
+	return;
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCornerDistProcess *pDot = m_pCornerDistProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCornerDistProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllCornerRcutProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCornerRcutProcess *pDot = m_pCornerRcutProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCornerRcutProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllLocProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CLocProcess *pDot = m_pLocProcese[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pLocProcese[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllCutProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCutProcess *pDot = m_pCutProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCutProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllKDistProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CKDistProcess *pDot = m_pKDistProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pKDistProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllGrindProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CGrindProcess *pDot = m_pGrindProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pGrindProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllThresProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CThresProcess *pDot = m_pThresProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pThresProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllHoleProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CHoleProcess* pDot = m_pHoleProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pThresProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaaseAllSideData(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CBlSideData *pSide = m_pBlSideData[i];
+		if (NULL != pSide) {
+			delete pSide;
+			pSide = NULL;
+			m_pBlSideData[i] = NULL;
+		}
+	}
+}
+
+CCornerDistProcess* CVisionRecipe::getCornerDistProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CCornerDistProcess *dot = m_pCornerDistProcess[idx];
+	Unlock();
+
+	return dot;
+}
+
+CBlSideData* CVisionRecipe::getSideData(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CBlSideData *pSideData = m_pBlSideData[idx];
+	Unlock();
+
+	return pSideData;
+}
+
+int CVisionRecipe::setRecipeType(int nType) {
+	/* code */
+	m_nRecipeType = nType;
+	return 0;
+}
+
+int CVisionRecipe::getRecipeType(void) {
+	/* code */
+	return m_nRecipeType;
+}
+
+bool CVisionRecipe::getVisionUse(void) {
+	/* code */
+	return m_visionDisplayInfo.isVisionDisplay;
+}
+
+int CVisionRecipe::setVisionName(const char* pszPath) {
+	/* code */
+	if (nullptr == pszPath || std::string(pszPath).length() < 1){
+		return -1;
+	}
+
+	m_strVisionName = pszPath;
+	m_configVision.SetWorkDir(m_workDir.c_str() , m_strVisionName.c_str());
+	return true;
+}
+
+int CVisionRecipe::setProductNo(const char* pszNo) {
+	/* code */
+	m_strProductNo = pszNo;
+	return 0;
+}
+
+//14. 获取配方名称
+std::string CVisionRecipe::getVisionName() {
+	/* code */
+	return m_strVisionName;
+}
+
+std::string CVisionRecipe::getProductNo(void) {
+	/* code */
+	return m_strProductNo;
+}
+
+void CVisionRecipe::setGlassSize(int x, int y) {
+	/* code */
+	m_mScanSetting.lengthSize = x;
+	m_mScanSetting.shortSize = y;
+}
+
+void CVisionRecipe::SetMainDlg(CDialogEx *pDlg) {
+	/* code */
+	m_pMainDlg = pDlg;
+}
+
+CDialogEx* CVisionRecipe::GetMainDlg(void) {
+	/* code */
+	return m_pMainDlg;
+}
+
+CCornerRcutProcess* CVisionRecipe::getCornerRcutProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CCornerRcutProcess *dot = m_pCornerRcutProcess[idx];
+	Unlock();
+	return dot;
+}
+
+CLocProcess* CVisionRecipe::getLocProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CLocProcess *dot = m_pLocProcese[idx];
+	Unlock();
+
+	return dot;
+}
+
+CCutProcess* CVisionRecipe::getCutProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CCutProcess *dot = m_pCutProcess[idx];
+	Unlock();
+
+	return dot;
+}
+
+CKDistProcess* CVisionRecipe::getKDistProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CKDistProcess *dot = m_pKDistProcess[idx];
+	Unlock();
+
+	return dot;
+}
+
+CGrindProcess* CVisionRecipe::getGrindProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CGrindProcess *dot = m_pGrindProcess[idx];
+	Unlock();
+	return dot;
+}
+
+CThresProcess* CVisionRecipe::getThresProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CThresProcess *dot = m_pThresProcess[idx];
+	Unlock();
+	return dot;
+}
+
+CHoleProcess* CVisionRecipe::getHoleProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CHoleProcess* dot = m_pHoleProcess[idx];
+	Unlock();
+	return dot;
+}
+
+ScanSetting CVisionRecipe::getScanSetting(void) {
+	/* code */
+	return m_mScanSetting;
+}
+
+void CVisionRecipe::setScanSetting(ScanSetting inf) {
+	/* code */
+	m_mScanSetting = inf;
+}
+
+void CVisionRecipe::saveVisionConfig(void) {
+	/* code */
+	//保存显示
+	std::string strSection = "Vision Display";
+	m_configVision.WriteBool(strSection.c_str(), "Vision Show", m_visionDisplayInfo.isVisionDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "Dist Show", m_visionDisplayInfo.isDistDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "RCUT Show", m_visionDisplayInfo.isRcutDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "Grind Show", m_visionDisplayInfo.isGrindDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "CUT Show", m_visionDisplayInfo.isCutDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "Thres Show", m_visionDisplayInfo.isThresDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "Hole Show", m_visionDisplayInfo.isHoleDisplay);
+
+	std::string array_dir_use[8] = { "A TOP","B TOP", "C TOP", "D TOP", "A BOT", "B BOT","C BOT", "D BOT" };
+	for (int i = 0; i < 8; i++) {
+		strSection = array_dir_use[i];
+		m_configVision.WriteBool(strSection.c_str(), "Vision Use", m_visionUseInfo[i].isVisionUse);
+		m_configVision.WriteBool(strSection.c_str(), "LOC Use", m_visionUseInfo[i].isLocUse);
+		m_configVision.WriteBool(strSection.c_str(), "Dist Use", m_visionUseInfo[i].isDistUse);
+		m_configVision.WriteBool(strSection.c_str(), "RCUT Use", m_visionUseInfo[i].isRcutUse);
+		m_configVision.WriteBool(strSection.c_str(), "Grind Use", m_visionUseInfo[i].isGrindUse);
+		m_configVision.WriteBool(strSection.c_str(), "Cut Use", m_visionUseInfo[i].isCutUse);
+		m_configVision.WriteBool(strSection.c_str(), "Thres Use", m_visionUseInfo[i].isThresUse);
+		m_configVision.WriteBool(strSection.c_str(), "Hole Use", m_visionUseInfo[i].isHoleUse);
+	}
+
+	strSection = "Scan";
+	m_configVision.WriteInt(strSection.c_str(), "Length Size", m_mScanSetting.lengthSize);
+	m_configVision.WriteInt(strSection.c_str(), "Short Size", m_mScanSetting.shortSize);
+	m_configVision.WriteInt(strSection.c_str(), "Standard Point", m_mScanSetting.nStdIndex);
+	m_configVision.WriteInt(strSection.c_str(), "First Point", m_mScanSetting.nIndex0);
+	m_configVision.WriteInt(strSection.c_str(), "Second Point", m_mScanSetting.nIndex1);
+	m_configVision.WriteInt(strSection.c_str(), "Third Point", m_mScanSetting.nIndex2);
+	m_configVision.WriteInt(strSection.c_str(), "Fourth Point", m_mScanSetting.nIndex3);
+	m_configVision.WriteInt(strSection.c_str(), "Length Scan", m_mScanSetting.nLengthScan);
+	m_configVision.WriteInt(strSection.c_str(), "Short Scan", m_mScanSetting.nShortScan);
+}
+
+void CVisionRecipe::readVisionConfig(void) {
+	/* code */
+	std::string strSection = "Vision Display";
+	m_visionDisplayInfo.isVisionDisplay = m_configVision.ReadBool(strSection.c_str(), "Vision Show", false);
+	m_visionDisplayInfo.isDistDisplay = m_configVision.ReadBool(strSection.c_str(), "Dist Show", false);
+	m_visionDisplayInfo.isRcutDisplay = m_configVision.ReadBool(strSection.c_str(), "RCUT Show", false);
+	m_visionDisplayInfo.isGrindDisplay = m_configVision.ReadBool(strSection.c_str(), "Grind Show", false);
+	m_visionDisplayInfo.isCutDisplay = m_configVision.ReadBool(strSection.c_str(), "CUT Show", false);
+	m_visionDisplayInfo.isThresDisplay = m_configVision.ReadBool(strSection.c_str(), "Thres Show", false);
+	m_visionDisplayInfo.isHoleDisplay = m_configVision.ReadBool(strSection.c_str(), "Hole Show", false);
+
+
+	std::string array_dir_use[8] = { "A TOP","B TOP", "C TOP", "D TOP", "A BOT", "B BOT","C BOT", "D BOT" };
+	for (int i = 0; i < 8; i++) {
+		strSection = array_dir_use[i];
+		m_visionUseInfo[i].isVisionUse = m_configVision.ReadBool(strSection.c_str(), "Vision Use", false);
+		m_visionUseInfo[i].isLocUse = m_configVision.ReadBool(strSection.c_str(), "LOC Use", false);
+		m_visionUseInfo[i].isDistUse = m_configVision.ReadBool(strSection.c_str(), "Dist Use", false);
+		m_visionUseInfo[i].isRcutUse = m_configVision.ReadBool(strSection.c_str(), "RCUT Use", false);
+		m_visionUseInfo[i].isGrindUse = m_configVision.ReadBool(strSection.c_str(), "Grind Use", false);
+		m_visionUseInfo[i].isCutUse = m_configVision.ReadBool(strSection.c_str(), "Cut Use", false);
+		m_visionUseInfo[i].isThresUse = m_configVision.ReadBool(strSection.c_str(), "Thres Use", false);
+		m_visionUseInfo[i].isHoleUse = m_configVision.ReadBool(strSection.c_str(), "Hole Use", false);
+	}
+
+	strSection = "Scan";
+	m_mScanSetting.lengthSize = m_configVision.ReadInt(strSection.c_str(), "Length Size", 0);
+	m_mScanSetting.shortSize = m_configVision.ReadInt(strSection.c_str(), "Short Size",0);
+	m_mScanSetting.nStdIndex = m_configVision.ReadInt(strSection.c_str(), "Standard Point", 0);
+	m_mScanSetting.nIndex0 = m_configVision.ReadInt(strSection.c_str(), "First Point", 0);
+	m_mScanSetting.nIndex1 = m_configVision.ReadInt(strSection.c_str(), "Second Point", 0);
+	m_mScanSetting.nIndex2 = m_configVision.ReadInt(strSection.c_str(), "Third Point", 0);
+	m_mScanSetting.nIndex3 = m_configVision.ReadInt(strSection.c_str(), "Fourth Point", 0);
+	m_mScanSetting.nLengthScan = m_configVision.ReadInt(strSection.c_str(), "Length Scan", 0);
+	m_mScanSetting.nShortScan = m_configVision.ReadInt(strSection.c_str(), "Short Scan", 0);
+}
+
+VisionUseInfo CVisionRecipe::getVisionUse(DimensionDir eDir) {
+	/* code */
+	VisionUseInfo inf;
+	inf.isVisionUse = false;
+	inf.isLocUse = false;
+	inf.isDistUse = false;
+	inf.isRcutUse = false;
+	int index = (int)(eDir);
+	if (index < 0 || index > 7) return inf;
+
+	inf = m_visionUseInfo[index];
+	return inf;
+}
+
+void CVisionRecipe::setVisionUse(VisionUseInfo inf, DimensionDir eDir) {
+	/* code */
+	int index = (int)(eDir);
+	if (index < 0 || index > 7) return;
+
+	m_visionUseInfo[index] = inf;
+}
+
+VisionDisplayInfo CVisionRecipe::getVisionDisplay(void) {
+	/* code */
+	return m_visionDisplayInfo;
+}
+
+void CVisionRecipe::setVisionDisplay(VisionDisplayInfo inf) {
+	/* code */
+	m_visionDisplayInfo = inf;
+}
+
+KeyDebugInfo CVisionRecipe::getKeyInfo(void) {
+	/* code */
+	return m_keyInfo;
+}
+
+void CVisionRecipe::setKeyInfo(KeyDebugInfo info) {
+	/* code */
+	m_keyInfo = info;
+}
+
+void CVisionRecipe::setVisionSetOpen(BOOL isOpen) {
+	/* code */
+	m_isOpenVisionDlg = isOpen;
+}
+
+void CVisionRecipe::setStage(int nStage) {
+	/* code */
+    m_nStage = nStage;
+}
+
+int CVisionRecipe::getStage(void) {
+	/* code */
+    return m_nStage;
+}
+
+BOOL CVisionRecipe::getVisionSetOpen(void) {
+	/* code */
+	return m_isOpenVisionDlg;
+}
+
+void CVisionRecipe::setFrame(int x1, int y1, int x2, int y2) {
+	/* code */
+	m_nFrameX1 = x1;
+	m_nFrameY1 = y1;
+	m_nFrameX2 = x2;
+	m_nFrameY2 = y2;
+}
+
+bool CVisionRecipe::getFrame(int &x1, int &y1, int &x2, int &y2) {
+	/* code */
+	x1 = m_nFrameX1;
+	y1 = m_nFrameY1;
+	x2 = m_nFrameX2;
+	y2 = m_nFrameY2;
+	bool result = false;
+	if (x1 >= 0 && y1 >= 0 && x2 > x1 && y2 > y1) result = true;
+	return true;
+}
\ No newline at end of file
diff --git a/BlVisionPro/Vision/VisionRecipe.h b/BlVisionPro/Vision/VisionRecipe.h
new file mode 100644
index 0000000..a562ef1
--- /dev/null
+++ b/BlVisionPro/Vision/VisionRecipe.h
@@ -0,0 +1,234 @@
+#ifndef VISION_RECIPE_H
+#define VISION_RECIPE_H
+
+#include "IVisionRecipe.h"
+#include "CornerDistProcess.h"
+#include "BlSideData.h"
+#include "CornerRcutProcess.h"
+#include "ConfigVision.h"
+#include "LocProcess.h"
+#include "CutProcess.h"
+#include "KDistProcess.h"
+#include "GrindProcess.h"
+#include "ThresProcess.h"
+#include "HoleProcess.h"
+
+typedef struct LineCameraSetting
+{
+	DimensionDir eDir;  //相机类型  
+	int nCam;           //相机序号
+	int nScan;          //扫描号
+}LineCameraSetting;
+
+//配方数据管理
+class CVisionRecipe : public IVisionRecipe
+{
+public:
+	CVisionRecipe();
+	virtual ~CVisionRecipe();
+
+	static CVisionRecipe* getInstance(void);
+
+public:
+	//1. 设置配方路径
+	virtual int setWorkDir(const char *pszPath);
+
+	//2. 保存
+	virtual int save(void);
+
+	//3. 打开
+	virtual int open(void);
+
+	//4. 获取采集卡
+	virtual CGrabberControl* getGrabberControl(int iCam);
+
+	//5. 设置采集开
+	virtual int setGrabberControl(CGrabberControl *pGrabberControl, int iCam);
+
+	//6. 相机相机信息
+	virtual int setCameraSetting(DimensionDir eDir, int iCam, int iScan);
+
+	//7. 初始化
+	virtual int init(void);
+
+	//8. 获取SideData
+	virtual CBlSideData* getSideData(DimensionDir eDir);
+
+	//9. 设置配方类型
+	virtual int setRecipeType(int nType);
+
+	//10. 获取配方类型
+	virtual int getRecipeType(void);
+
+	//11. 视觉启用
+	virtual bool getVisionUse(void);
+
+	//12.设置区域
+	virtual void setFrame(int x1, int y1, int x2, int y2);
+	bool getFrame(int &x1, int &y1, int &x2, int &y2);
+
+	//13. 设置配方名称
+	virtual int setVisionName(const char* pszPath);
+	virtual int setProductNo(const char* pszNo);
+
+	//14. 获取配方名称
+	virtual std::string getVisionName();
+	std::string getProductNo(void);
+
+	//15. 设置屏幕尺寸
+	virtual void setGlassSize(int x, int y);
+	virtual BOOL getVisionSetOpen(void);
+
+public:
+	//1. 获取采集相机的序号
+	int getCameraIndex(DimensionDir eDir);
+
+	//2. 获取采集的SCAN
+	int getCameraScan(DimensionDir eDir);
+
+	//3. 获取数据
+	CCornerDistProcess* getCornerDistProcess(DimensionDir eDir);
+
+	//4. 设置窗体
+	void SetMainDlg(CDialogEx *pDlg);
+
+	//5. 获取窗体
+	CDialogEx* GetMainDlg(void);
+
+	//6. 获取数据
+	CCornerRcutProcess* getCornerRcutProcess(DimensionDir eDir);
+	CLocProcess* getLocProcess(DimensionDir eDir);
+	CCutProcess* getCutProcess(DimensionDir eDir);
+	CKDistProcess* getKDistProcess(DimensionDir eDir);
+	CGrindProcess* getGrindProcess(DimensionDir eDir);
+	CThresProcess* getThresProcess(DimensionDir eDir);
+	CHoleProcess* getHoleProcess(DimensionDir eDir);
+	
+
+	//7. 获取参数
+	ScanSetting getScanSetting(void);
+	void setScanSetting(ScanSetting inf);
+
+	//8. 保存数据
+	void saveVisionConfig(void);
+	void readVisionConfig(void);
+
+	//9. 获取软件的使能
+	VisionUseInfo getVisionUse(DimensionDir eDir);
+	void setVisionUse(VisionUseInfo inf, DimensionDir eDir);
+
+	//10. 获取显示
+	VisionDisplayInfo getVisionDisplay(void);
+	void setVisionDisplay(VisionDisplayInfo inf);
+
+	//11. 获取Key
+	KeyDebugInfo getKeyInfo(void);
+	void setKeyInfo(KeyDebugInfo info);
+
+	//12. 打开
+	void setVisionSetOpen(BOOL isOpen);
+
+	//13. 设置/获取平台
+	void setStage(int nStage);
+	int getStage(void);
+
+private:
+	bool m_isInit;
+	std::string m_workDir;
+	CGrabberControl *m_pGrabberControl[MAX_CAMERA_COUNT];
+	std::map<int, LineCameraSetting*> m_mapLineCameraSetting;
+	CCornerDistProcess *m_pCornerDistProcess[DIMENSION_NONE];
+	CBlSideData *m_pBlSideData[DIMENSION_NONE];                       //检测结果
+	CCornerRcutProcess *m_pCornerRcutProcess[DIMENSION_NONE];
+	CLocProcess *m_pLocProcese[DIMENSION_NONE];
+
+	CCutProcess *m_pCutProcess[DIMENSION_NONE];
+	CKDistProcess *m_pKDistProcess[DIMENSION_NONE];
+	CGrindProcess *m_pGrindProcess[DIMENSION_NONE];
+	CThresProcess *m_pThresProcess[DIMENSION_NONE];
+
+	CHoleProcess *m_pHoleProcess[DIMENSION_NONE];
+	
+
+	int m_nRecipeType;
+	std::string m_strVisionName;
+	std::string m_strProductNo;
+
+	VisionDisplayInfo m_visionDisplayInfo;
+	VisionUseInfo m_visionUseInfo[DIMENSION_NONE];
+
+	CDialogEx *m_pMainDlg;
+
+	ScanSetting m_mScanSetting;
+	CConfigVision m_configVision;
+
+	CStdioFile m_recipeFile;
+	KeyDebugInfo m_keyInfo;
+
+	BOOL m_isOpenVisionDlg;
+
+	int m_nFrameX1;
+	int m_nFrameY1;
+	int m_nFrameX2;
+	int m_nFrameY2;
+
+	int m_nStage;      //平台
+
+	CRITICAL_SECTION m_criticalSection;
+
+private:
+	inline void Lock() { EnterCriticalSection(&m_criticalSection); }
+	inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
+
+	//1. 释放
+	void release(void);
+
+	//2. 释放数据
+	void releaseLineCameraSetting(void);
+
+	//3. 创建CornerDistProcess
+	void createAllCornerDistProcess(void);
+	void createAllCornerRcutProcess(void);
+	void createAllLocProcess(void);
+	void createCutProcess(void);
+	void createKDistProcess(void);
+	void createGrindProcess(void);
+	void createThresProcess(void);
+	void createHoleProcess(void);
+
+	//4. 释放数据
+	void releaaseAllCornerDistProcess(void);
+	void releaseAllCornerRcutProcess(void);
+	void releaseAllLocProcess(void);
+	void releaseAllCutProcess(void);
+	void releaseAllKDistProcess(void);
+	void releaseAllGrindProcess(void);
+	void releaseAllThresProcess(void);
+	void releaseAllHoleProcess(void);
+
+	//5. 保存数据
+	int saveRecipeFile(std::string filePath);
+
+	//6. 反序列化
+	int openRecipeFile(std::string filePath);
+
+	//7. 创建SideData数据
+	void createSideData(void);
+
+	//8. 释放数据
+	void releaaseAllSideData(void);
+
+	//9. 保存数据
+	int WriteRecipeVisionFile(void);
+
+	//10. 读取文件
+	void ReadRecipeFile(void);
+
+	//11. 解释数据
+//	void DecodeRecipeText(CString strText);
+
+	//12. 解释数据
+	void DecodeJson(Json::Value jsFileRoot);
+};
+
+#endif
\ No newline at end of file
diff --git a/BlVisionPro/res/BlVisionPro.rc2 b/BlVisionPro/res/BlVisionPro.rc2
new file mode 100644
index 0000000..26bcdf5
--- /dev/null
+++ b/BlVisionPro/res/BlVisionPro.rc2
Binary files differ
diff --git a/BlVisionPro/res/navigate_down.ico b/BlVisionPro/res/navigate_down.ico
new file mode 100644
index 0000000..438e0ca
--- /dev/null
+++ b/BlVisionPro/res/navigate_down.ico
Binary files differ
diff --git a/BlVisionPro/res/navigate_left.ico b/BlVisionPro/res/navigate_left.ico
new file mode 100644
index 0000000..f19c602
--- /dev/null
+++ b/BlVisionPro/res/navigate_left.ico
Binary files differ
diff --git a/BlVisionPro/res/navigate_right.ico b/BlVisionPro/res/navigate_right.ico
new file mode 100644
index 0000000..fe03c0d
--- /dev/null
+++ b/BlVisionPro/res/navigate_right.ico
Binary files differ
diff --git a/BlVisionPro/res/navigate_up.ico b/BlVisionPro/res/navigate_up.ico
new file mode 100644
index 0000000..d33d49f
--- /dev/null
+++ b/BlVisionPro/res/navigate_up.ico
Binary files differ
diff --git a/BlVisionPro/resource.h b/BlVisionPro/resource.h
new file mode 100644
index 0000000..ed11d66
--- /dev/null
+++ b/BlVisionPro/resource.h
Binary files differ
diff --git a/BlVisionPro/stdafx.cpp b/BlVisionPro/stdafx.cpp
new file mode 100644
index 0000000..1633746
--- /dev/null
+++ b/BlVisionPro/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : 只包括标准包含文件的源文件
+// BlVisionPro.pch 将作为预编译头
+// stdafx.obj 将包含预编译类型信息
+
+#include "stdafx.h"
+
+
diff --git a/BlVisionPro/stdafx.h b/BlVisionPro/stdafx.h
new file mode 100644
index 0000000..07aefc0
--- /dev/null
+++ b/BlVisionPro/stdafx.h
@@ -0,0 +1,41 @@
+// stdafx.h : 标准系统包含文件的包含文件,
+// 或是经常使用但不常更改的
+// 特定于项目的包含文件
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
+
+#include <afxwin.h>         // MFC 核心组件和标准组件
+#include <afxext.h>         // MFC 扩展
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE 类
+#include <afxodlgs.h>       // MFC OLE 对话框类
+#include <afxdisp.h>        // MFC 自动化类
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 数据库类
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 数据库类
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+#include "IncludeVision.h"
+#include <afxcontrolbars.h>
diff --git a/BlVisionPro/targetver.h b/BlVisionPro/targetver.h
new file mode 100644
index 0000000..416cebf
--- /dev/null
+++ b/BlVisionPro/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include <SDKDDKVer.h>
diff --git a/Common_Class/BlGrabber/BlGrabber.cpp b/Common_Class/BlGrabber/BlGrabber.cpp
new file mode 100644
index 0000000..eeffd33
--- /dev/null
+++ b/Common_Class/BlGrabber/BlGrabber.cpp
@@ -0,0 +1,63 @@
+// BlGrabber.cpp : 定义 DLL 的初始化例程。
+//
+
+#include "stdafx.h"
+#include "BlGrabber.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+//
+//TODO:  如果此 DLL 相对于 MFC DLL 是动态链接的,
+//		则从此 DLL 导出的任何调入
+//		MFC 的函数必须将 AFX_MANAGE_STATE 宏添加到
+//		该函数的最前面。
+//
+//		例如: 
+//
+//		extern "C" BOOL PASCAL EXPORT ExportedFunction()
+//		{
+//			AFX_MANAGE_STATE(AfxGetStaticModuleState());
+//			// 此处为普通函数体
+//		}
+//
+//		此宏先于任何 MFC 调用
+//		出现在每个函数中十分重要。  这意味着
+//		它必须作为函数中的第一个语句
+//		出现,甚至先于所有对象变量声明,
+//		这是因为它们的构造函数可能生成 MFC
+//		DLL 调用。
+//
+//		有关其他详细信息,
+//		请参阅 MFC 技术说明 33 和 58。
+//
+
+// CBlGrabberApp
+
+BEGIN_MESSAGE_MAP(CBlGrabberApp, CWinApp)
+END_MESSAGE_MAP()
+
+
+// CBlGrabberApp 构造
+
+CBlGrabberApp::CBlGrabberApp()
+{
+	// TODO:  在此处添加构造代码,
+	// 将所有重要的初始化放置在 InitInstance 中
+}
+
+
+// 唯一的一个 CBlGrabberApp 对象
+
+CBlGrabberApp theApp;
+
+
+// CBlGrabberApp 初始化
+
+BOOL CBlGrabberApp::InitInstance()
+{
+	CWinApp::InitInstance();
+
+	return TRUE;
+}
diff --git a/Common_Class/BlGrabber/BlGrabber.def b/Common_Class/BlGrabber/BlGrabber.def
new file mode 100644
index 0000000..a6cab9a
--- /dev/null
+++ b/Common_Class/BlGrabber/BlGrabber.def
@@ -0,0 +1,6 @@
+; BlGrabber.def : 声明 DLL 的模块参数。
+
+LIBRARY
+
+EXPORTS
+    ; 此处可以是显式导出
diff --git a/Common_Class/BlGrabber/BlGrabber.h b/Common_Class/BlGrabber/BlGrabber.h
new file mode 100644
index 0000000..9ec0887
--- /dev/null
+++ b/Common_Class/BlGrabber/BlGrabber.h
@@ -0,0 +1,27 @@
+// BlGrabber.h : BlGrabber DLL 的主头文件
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
+#endif
+
+#include "resource.h"		// 主符号
+
+
+// CBlGrabberApp
+// 有关此类实现的信息,请参阅 BlGrabber.cpp
+//
+
+class CBlGrabberApp : public CWinApp
+{
+public:
+	CBlGrabberApp();
+
+// 重写
+public:
+	virtual BOOL InitInstance();
+
+	DECLARE_MESSAGE_MAP()
+};
diff --git a/Common_Class/BlGrabber/BlGrabber.rc b/Common_Class/BlGrabber/BlGrabber.rc
new file mode 100644
index 0000000..31a4a47
--- /dev/null
+++ b/Common_Class/BlGrabber/BlGrabber.rc
Binary files differ
diff --git a/Common_Class/BlGrabber/BlGrabber.vcxproj b/Common_Class/BlGrabber/BlGrabber.vcxproj
new file mode 100644
index 0000000..69a127c
--- /dev/null
+++ b/Common_Class/BlGrabber/BlGrabber.vcxproj
@@ -0,0 +1,229 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{E5ADE862-9082-48F0-8210-A4F5CA9908AF}</ProjectGuid>
+    <RootNamespace>BlGrabber</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+    <Keyword>MFCDLLProj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\BlGrabber.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\BlGrabber.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\BlGrabber.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>./;./Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\BlGrabber.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\BlGrabber\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\BlGrabber\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\BlGrabber\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\FrameBufferController.h" "$(SolutionDir)Lib\BlGrabber\include\FrameBufferController.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\GrabberControl.h" "$(SolutionDir)Lib\BlGrabber\include\GrabberControl.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="BlGrabber.cpp" />
+    <ClCompile Include="FrameBufferController.cpp" />
+    <ClCompile Include="GrabberControl.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="BlGrabber.h" />
+    <ClInclude Include="Header\FrameBufferController.h" />
+    <ClInclude Include="Header\GrabberControl.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="BlGrabber.def" />
+    <None Include="res\BlGrabber.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="BlGrabber.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/BlGrabber/BlGrabber.vcxproj.filters b/Common_Class/BlGrabber/BlGrabber.vcxproj.filters
new file mode 100644
index 0000000..9cc3ca1
--- /dev/null
+++ b/Common_Class/BlGrabber/BlGrabber.vcxproj.filters
@@ -0,0 +1,67 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="BlGrabber.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="FrameBufferController.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="GrabberControl.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="BlGrabber.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\FrameBufferController.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\GrabberControl.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="BlGrabber.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\BlGrabber.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="BlGrabber.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/BlGrabber/FrameBufferController.cpp b/Common_Class/BlGrabber/FrameBufferController.cpp
new file mode 100644
index 0000000..ef42438
--- /dev/null
+++ b/Common_Class/BlGrabber/FrameBufferController.cpp
@@ -0,0 +1,88 @@
+#include "StdAfx.h"
+#include "FrameBufferController.h"
+
+
+CFrameBufferController::CFrameBufferController(void)
+{
+	m_nCameraIdx = 0;
+}
+
+CFrameBufferController::~CFrameBufferController(void)
+{
+}
+
+void CFrameBufferController::ClearBuffer()
+{
+	m_MultiBuffer.ClearBuffer();
+}
+
+BOOL CFrameBufferController::CreateBuffer(int iCamera, int nFrameWidth, int nFrameHeight, int nFrameCnt, int nBufferCnt)
+{
+	m_nCameraIdx = iCamera;
+	m_MultiBuffer.CreateMultiBuff(nBufferCnt, nFrameWidth, nFrameHeight, nFrameCnt);
+
+	return TRUE;
+}
+
+LPBYTE	CFrameBufferController::GetFrameBuferHeader(int iScan, int iFrame)
+{
+	if (CheckProcFrame(iFrame) == FALSE)
+	{
+		return NULL;
+	}
+	if (m_MultiBuffer.GetBuffCount() <= iScan)
+	{
+		return NULL;
+	}
+
+	return m_MultiBuffer.GetMultiBuffData(iScan) + (ULONG_PTR)(m_MultiBuffer.GetFrameSize()*iFrame);
+}
+
+BOOL CFrameBufferController::SetFrameBuffer(int iScan, int iFrame, LPBYTE lpBuffer)
+{
+	LPBYTE lpSource = GetFrameBuferHeader(iScan, iFrame);
+	if (lpSource == NULL)
+		return FALSE;
+
+	memcpy(lpSource, lpBuffer, m_MultiBuffer.GetFrameWidth() * m_MultiBuffer.GetFrameHeight());
+
+	return TRUE;
+}
+
+BOOL CFrameBufferController::CheckProcFrame(int iFrame)
+{
+	if (iFrame < 0 || iFrame >= m_MultiBuffer.GetFrameCount())
+		return FALSE;
+	return TRUE;
+}
+
+LPBYTE CFrameBufferController::GetFrameHeaderLine(int iScan, int nLine /*= 0*/)
+{
+	LPBYTE		lpBuf = NULL;
+
+	int			iStartLineInOrgFrame = nLine / GetFrameHeight();
+	int			iStartLinePositionInOrgFrame = nLine % GetFrameHeight();
+
+	lpBuf = GetFrameBuferHeader(iScan, iStartLineInOrgFrame);
+	if (lpBuf == NULL)
+		return NULL;
+
+	return lpBuf + (GetFrameWidth()*iStartLinePositionInOrgFrame);
+}
+
+LPBYTE CFrameBufferController::GetFrameHeader_Line_FromStartLine(int iScan, int iFrame, int nStartLine /*= 0*/)
+{
+	LPBYTE		lpBuf = NULL;
+
+	int			iStartLineInOrgFrame = nStartLine / GetFrameHeight();
+	int			iStartLinePositionInOrgFrame = nStartLine % GetFrameHeight();
+
+	//LogDisplayMessage(_T("GetFrameHeader_Line_FromStartLine: Frame %d, start line %d, org Frame %d, position in org frame %d"), iFrame, nStartLine, iStartLineInOrgFrame, iStartLinePositionInOrgFrame);
+	//Sleep(10);
+
+	lpBuf = GetFrameBuferHeader(iScan, iStartLineInOrgFrame);
+	if (lpBuf == NULL)
+		return NULL;
+
+	return lpBuf + (GetFrameWidth()*iStartLinePositionInOrgFrame);
+}
diff --git a/Common_Class/BlGrabber/GrabberControl.cpp b/Common_Class/BlGrabber/GrabberControl.cpp
new file mode 100644
index 0000000..19e27d0
--- /dev/null
+++ b/Common_Class/BlGrabber/GrabberControl.cpp
@@ -0,0 +1,12 @@
+#include "StdAfx.h"
+#include "GrabberControl.h"
+
+
+CGrabberControl::CGrabberControl(void)
+{
+}
+
+
+CGrabberControl::~CGrabberControl(void)
+{
+}
diff --git a/Common_Class/BlGrabber/Header/FrameBufferController.h b/Common_Class/BlGrabber/Header/FrameBufferController.h
new file mode 100644
index 0000000..46ee4fe
--- /dev/null
+++ b/Common_Class/BlGrabber/Header/FrameBufferController.h
@@ -0,0 +1,125 @@
+#pragma once
+
+#include <deque>
+#include "../../ENRIT/Define/Global_Define.h"
+
+class AFX_EXT_CLASS CMultiBuffer	// 促吝 滚欺 汲沥, m_nBuff 俺狼 滚欺甫 积己 棺 包府(咯矾 俺狼 胶牡 滚欺 历厘)
+{	
+	BYTE*	m_pTotalBuff;	// m_BuffCnt 俺荐 父怒狼 滚欺甫 茄波锅俊 且寸.
+	int		m_BuffCnt;		// 滚欺狼 俺荐
+	SIZE_T	m_BuffSize;		// 俺喊 滚欺狼 农扁 (frameWidth * frameHeight * frameCnt
+
+							// 滚欺绰 n俺狼 Frame 栏肺 积己 : Width * Height * Cnt
+	int		m_FrameWidth, m_FrameHeight;
+	int		m_FrameCnt;
+public:
+	int		GetFrameWidth() { return m_FrameWidth; }
+	int		GetFrameHeight() { return m_FrameHeight; }
+	int		GetFrameCount() { return m_FrameCnt; }
+	int		GetBuffCount() { return m_BuffCnt; }
+	SIZE_T	GetFrameSize() { return GetFrameWidth()*GetFrameHeight(); }
+
+public:
+	CMultiBuffer() { m_BuffCnt = 0; m_pTotalBuff = NULL; m_FrameWidth = m_FrameHeight = m_FrameCnt = 0; }
+	~CMultiBuffer()
+	{
+		if (m_pTotalBuff)
+		{
+			VirtualFree(m_pTotalBuff, 0, MEM_RELEASE);
+			m_pTotalBuff = NULL;
+		}
+	}
+	BYTE*	GetMultiBuffData(int id) { return m_pTotalBuff + m_BuffSize*id; }
+	int		CreateMultiBuff(int buffCnt, int frameWidth, int frameHeight, int frameCnt)
+	{
+		m_BuffCnt = buffCnt;
+		m_FrameWidth = frameWidth;
+		m_FrameHeight = frameHeight;
+		m_FrameCnt = frameCnt;
+		m_BuffSize = (SIZE_T)frameWidth*frameHeight*frameCnt;
+
+		SIZE_T frameSize = frameWidth* frameHeight;
+		SIZE_T TotalBufferSize = frameSize*frameCnt*buffCnt;
+
+		m_pTotalBuff = (BYTE*)VirtualAlloc(NULL, TotalBufferSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+		if (m_pTotalBuff == NULL)
+		{
+			return FALSE;
+		}
+
+		ZeroMemory(m_pTotalBuff, sizeof(BYTE)*TotalBufferSize);
+
+		return TRUE;
+	}
+
+	void	ClearBuffer()
+	{
+		SIZE_T frameSize = m_FrameWidth * m_FrameHeight;
+		SIZE_T TotalBufferSize = frameSize * m_FrameCnt*m_BuffCnt;
+
+		ZeroMemory(m_pTotalBuff, sizeof(BYTE)*TotalBufferSize);
+	}
+};
+
+class AFX_EXT_CLASS CFrameBufferController
+{
+public:
+	CFrameBufferController(void);
+	virtual ~CFrameBufferController(void);
+
+public:
+	void			ClearBuffer();
+	BOOL			CreateBuffer(int iCamera, int nFrameWidth, int nFrameHeight, int nFrameCnt, int nBufferCnt = 1);
+	CMultiBuffer*	GetMultiBuffer() { return &m_MultiBuffer; }
+	BYTE			*GetMultiBuffData(int id) { return m_MultiBuffer.GetMultiBuffData(id); }
+
+	void			SetMutualEx(BOOL bEnter)
+	{
+		if (bEnter == TRUE)
+			EnterCriticalSection(&m_csProcBuffer);
+		else
+			LeaveCriticalSection(&m_csProcBuffer);
+	}
+
+	int				GetCameraIdx() { return m_nCameraIdx; }
+	LPBYTE			GetFrameBuferHeader(int iScan, int iFrame);
+	BOOL			CheckProcFrame(int iFrame);
+	BOOL			SetFrameBuffer(int iScan, int iFrame, LPBYTE lpBuffer);
+	LPBYTE			GetFrameHeaderLine(int iScan, int nLine = 0);
+	LPBYTE			GetFrameHeader_Line_FromStartLine(int iScan, int iFrame, int nStartLine = 0);
+	int				GetFrameWidth() { return GetMultiBuffer()->GetFrameWidth(); }
+	int				GetFrameHeight() { return GetMultiBuffer()->GetFrameHeight(); }
+	int				GetFrameCount() { return GetMultiBuffer()->GetFrameCount(); }
+	int				GetFrameSize() { return (int)GetMultiBuffer()->GetFrameSize(); }
+
+protected:
+	CRITICAL_SECTION	m_csProcBuffer;	// Critical Section
+	CMultiBuffer	m_MultiBuffer;
+	int				m_nCameraIdx;
+};
+
+struct stFrameIndex
+{
+	stFrameIndex()
+	{
+		nScanIdx = -1;
+		nFrameIdx = -1;
+	}
+	stFrameIndex(const stFrameIndex &rhs)
+	{
+		this->nScanIdx = rhs.nScanIdx;
+		this->nFrameIdx = rhs.nFrameIdx;
+	}
+	stFrameIndex(int nScan, int nGrab)
+	{
+		nScanIdx = nScan;
+		nFrameIdx = nGrab;
+	}
+
+	int nScanIdx;
+	int nFrameIdx;
+};
+
+typedef deque<stFrameIndex> dqGrabIdx;
+typedef deque<stFrameIndex>::iterator dqGrabIdxIt;
+
diff --git a/Common_Class/BlGrabber/Header/GrabberControl.h b/Common_Class/BlGrabber/Header/GrabberControl.h
new file mode 100644
index 0000000..f4d8260
--- /dev/null
+++ b/Common_Class/BlGrabber/Header/GrabberControl.h
@@ -0,0 +1,79 @@
+#pragma once
+
+#include "FrameBufferController.h"
+#define INITX64_SUCCESS				0
+#define INITX64_FAIL_GETSERVER		11
+#define INITX64_FAIL_CREATEACQ		12
+#define INITX64_FAIL_TDIDIRECTION	13
+#define INITX64_FAIL_CAMNVIC		14
+#define INITX64_FAIL_CREATEBUFFER	15
+#define INITX64_FAIL_VIRTUALBUFFER	16
+#define INITX64_FAIL_CREATEXFER		17
+#define INITX64_FAIL_INVALID		18
+
+typedef enum { eMIL_GRAB_OFF = 0, eMIL_GRAB_ON, eMIL_SNAP_ON } _eGrabStatus_;
+
+#define MAX_DFC_PATH 1024
+typedef struct _tag_struct_Grabber_Intialize_Parameter_
+{
+	HWND hWnd;
+	BOOL bDemo;
+
+	int	 nScanCount;
+	int  nGrabBufCount;
+	int	 nGrabBufSize; // rcut 增加
+	int  nFrameWidth;
+	int  nFrameHeight;
+	int	 nConnectPort;
+	int	 nImgFlipX;
+	int	 nCameraIdx;
+	int	 nCameraScan;
+	int	 nBoardIdx;
+	int  nBoardCh;
+	char cDCFPath[MAX_DFC_PATH];
+	char cVICPath[MAX_DFC_PATH];
+	int	 nExposure;
+	int	 nExposureDelay;
+
+	_tag_struct_Grabber_Intialize_Parameter_()
+	{
+		ZeroMemory(this, sizeof(this));
+	}
+} _GRABBER_INIT_PARAM_;
+
+class AFX_EXT_CLASS CGrabberControl
+{
+public:
+	CGrabberControl(void);
+	virtual ~CGrabberControl(void);
+
+public:
+	virtual BOOL	Initialize(void *pParam, int *pErrorCode, int iBoard = 0) = 0;	// Grabber 檬扁拳
+	virtual BOOL	InitializeBuffer(void *pParam) = 0;
+	//////////////////////////////////////////////////////////////////////////
+	// Deinit
+	virtual BOOL	Deinitialize() = 0;
+
+	virtual BOOL	GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure = 10, BOOL bAuto = TRUE) = 0;
+	virtual BOOL	GrabLiveStart(int nExposure = 15) = 0;
+	virtual BOOL	GrabScanStop() = 0;
+
+	virtual BOOL	IsGrabbing() = 0;
+	virtual int		IsAcqFrame(int nFrameNo, int nThreadIdx = -1) = 0;
+
+	virtual LPBYTE	GetFrameHeader(int iScan, int nFrameNo, BOOL* bSuccess = NULL) = 0;
+	virtual LPBYTE	GetFrameHeaderLine(int iScan, int nLine, BOOL* bSuccess = NULL) = 0;
+	virtual BOOL	GetSmallImage(int iScan, LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping = TRUE) = 0;
+
+	virtual int		GetStartFrameIdx() { return 0; }
+	virtual int		GetEndFrameIdx() { return 0; }
+
+	virtual void	SetSimulFrame(int nFrame) = 0;
+	virtual int		GetGrabFrameCount() = 0;
+	virtual void	ClearGrabIdx() = 0;
+	virtual stFrameIndex	GetGrabFrame() = 0;
+	virtual stFrameIndex	GetGrabFrameNoRemove() = 0;
+	virtual CFrameBufferController	*GetFrameBuffer() = 0;
+	virtual BOOL	SetTriggerMode(BOOL bExTrigger) = 0;
+};
+
diff --git a/Common_Class/BlGrabber/ReadMe.txt b/Common_Class/BlGrabber/ReadMe.txt
new file mode 100644
index 0000000..8b4e729
--- /dev/null
+++ b/Common_Class/BlGrabber/ReadMe.txt
@@ -0,0 +1,45 @@
+锘�========================================================================
+    MICROSOFT 鍩虹绫诲簱 : BlGrabber 椤圭洰姒傝堪
+========================================================================
+
+
+搴旂敤绋嬪簭鍚戝宸蹭负鎮ㄥ垱寤轰簡姝� BlGrabber DLL銆傛 DLL 涓嶄粎婕旂ず Microsoft 鍩虹绫荤殑鍩烘湰浣跨敤鏂规硶锛岃繕鍙綔涓烘偍缂栧啓 DLL 鐨勮捣鐐广��
+
+鏈枃浠舵瑕佷粙缁嶇粍鎴� BlGrabber DLL 鐨勬瘡涓枃浠剁殑鍐呭銆�
+
+BlGrabber.vcxproj
+    杩欐槸浣跨敤搴旂敤绋嬪簭鍚戝鐢熸垚鐨� VC++ 椤圭洰鐨勪富椤圭洰鏂囦欢锛屽叾涓寘鍚敓鎴愯鏂囦欢鐨� Visual C++ 鐨勭増鏈俊鎭紝浠ュ強鏈夊叧浣跨敤搴旂敤绋嬪簭鍚戝閫夋嫨鐨勫钩鍙般�侀厤缃拰椤圭洰鍔熻兘鐨勪俊鎭��
+
+BlGrabber.vcxproj.filters
+    杩欐槸浣跨敤鈥滃簲鐢ㄧ▼搴忓悜瀵尖�濈敓鎴愮殑 VC++ 椤圭洰绛涢�夊櫒鏂囦欢銆傚畠鍖呭惈鏈夊叧椤圭洰鏂囦欢涓庣瓫閫夊櫒涔嬮棿鐨勫叧鑱斾俊鎭�傚湪 IDE 涓紝閫氳繃杩欑鍏宠仈锛屽湪鐗瑰畾鑺傜偣涓嬩互鍒嗙粍褰㈠紡鏄剧ず鍏锋湁鐩镐技鎵╁睍鍚嶇殑鏂囦欢銆備緥濡傦紝鈥�.cpp鈥濇枃浠朵笌鈥滄簮鏂囦欢鈥濈瓫閫夊櫒鍏宠仈銆�
+
+BlGrabber.h
+    杩欐槸 DLL 鐨勪富澶存枃浠躲�傚畠澹版槑浜� CBlGrabberApp 绫汇��
+
+BlGrabber.cpp
+    杩欐槸涓� DLL 婧愭枃浠躲�傚畠鍖呭惈 CBlGrabberApp 绫汇��
+
+BlGrabber.rc
+    杩欐槸绋嬪簭浣跨敤鐨勬墍鏈� Microsoft Windows 璧勬簮鐨勫垪琛ㄣ�傚畠鍖呮嫭 RES 瀛愮洰褰曚腑瀛樺偍鐨勫浘鏍囥�佷綅鍥惧拰鍏夋爣銆傛鏂囦欢鍙互鐩存帴鍦� Microsoft Visual C++ 涓繘琛岀紪杈戙��
+
+res\BlGrabber.rc2
+    姝ゆ枃浠跺寘鍚笉鍦� Microsoft Visual C++ 涓繘琛岀紪杈戠殑璧勬簮銆傛偍搴旇灏嗕笉鍙敱璧勬簮缂栬緫鍣ㄧ紪杈戠殑鎵�鏈夎祫婧愭斁鍦ㄦ鏂囦欢涓��
+
+BlGrabber.def
+    姝ゆ枃浠跺寘鍚湪 Microsoft Windows 涓繍琛屾墍蹇呴渶鐨� DLL 鐨勬湁鍏充俊鎭�傚畠瀹氫箟浜� DLL 鐨勫悕绉板拰璇存槑绛夊弬鏁帮紝鑰屼笖杩樹粠 DLL 瀵煎嚭鍑芥暟銆�
+
+/////////////////////////////////////////////////////////////////////////////
+鍏朵粬鏍囧噯鏂囦欢:
+
+StdAfx.h, StdAfx.cpp
+    杩欎簺鏂囦欢鐢ㄤ簬鐢熸垚鍚嶄负 BlGrabber.pch 鐨勯缂栬瘧澶� (PCH) 鏂囦欢鍜屽悕涓� StdAfx.obj 鐨勯缂栬瘧绫诲瀷鏂囦欢銆�
+
+Resource.h
+    杩欐槸鏍囧噯澶存枃浠讹紝鍙敤浜庡畾涔夋柊鐨勮祫婧� ID銆侻icrosoft Visual C++ 灏嗚鍙栧苟鏇存柊姝ゆ枃浠躲��
+
+/////////////////////////////////////////////////////////////////////////////
+鍏朵粬娉ㄩ噴:
+
+搴旂敤绋嬪簭鍚戝浣跨敤鈥淭ODO:鈥濇潵鎸囩ず搴旀坊鍔犳垨鑷畾涔夌殑婧愪唬鐮侀儴鍒嗐��
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/BlGrabber/Resource.h b/Common_Class/BlGrabber/Resource.h
new file mode 100644
index 0000000..2a75900
--- /dev/null
+++ b/Common_Class/BlGrabber/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by BlGrabber.rc
+//
+
+// 新对象的下一组默认值
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	3000
+#define _APS_NEXT_CONTROL_VALUE		3000
+#define _APS_NEXT_SYMED_VALUE		3000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/BlGrabber/res/BlGrabber.rc2 b/Common_Class/BlGrabber/res/BlGrabber.rc2
new file mode 100644
index 0000000..54a17c0
--- /dev/null
+++ b/Common_Class/BlGrabber/res/BlGrabber.rc2
Binary files differ
diff --git a/Common_Class/BlGrabber/stdafx.cpp b/Common_Class/BlGrabber/stdafx.cpp
new file mode 100644
index 0000000..777ad39
--- /dev/null
+++ b/Common_Class/BlGrabber/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : 只包括标准包含文件的源文件
+// BlGrabber.pch 将作为预编译头
+// stdafx.obj 将包含预编译类型信息
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/BlGrabber/stdafx.h b/Common_Class/BlGrabber/stdafx.h
new file mode 100644
index 0000000..bde7e92
--- /dev/null
+++ b/Common_Class/BlGrabber/stdafx.h
@@ -0,0 +1,39 @@
+// stdafx.h : 标准系统包含文件的包含文件,
+// 或是经常使用但不常更改的
+// 特定于项目的包含文件
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
+
+#include <afxwin.h>         // MFC 核心组件和标准组件
+#include <afxext.h>         // MFC 扩展
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE 类
+#include <afxodlgs.h>       // MFC OLE 对话框类
+#include <afxdisp.h>        // MFC 自动化类
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 数据库类
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 数据库类
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
diff --git a/Common_Class/BlGrabber/targetver.h b/Common_Class/BlGrabber/targetver.h
new file mode 100644
index 0000000..416cebf
--- /dev/null
+++ b/Common_Class/BlGrabber/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include <SDKDDKVer.h>
diff --git a/Common_Class/BlVisionPro/BlVisionPro.cpp b/Common_Class/BlVisionPro/BlVisionPro.cpp
new file mode 100644
index 0000000..cf9b9e5
--- /dev/null
+++ b/Common_Class/BlVisionPro/BlVisionPro.cpp
@@ -0,0 +1,65 @@
+// BlVisionPro.cpp : 定义 DLL 的初始化例程。
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+//
+//TODO:  如果此 DLL 相对于 MFC DLL 是动态链接的,
+//		则从此 DLL 导出的任何调入
+//		MFC 的函数必须将 AFX_MANAGE_STATE 宏添加到
+//		该函数的最前面。
+//
+//		例如: 
+//
+//		extern "C" BOOL PASCAL EXPORT ExportedFunction()
+//		{
+//			AFX_MANAGE_STATE(AfxGetStaticModuleState());
+//			// 此处为普通函数体
+//		}
+//
+//		此宏先于任何 MFC 调用
+//		出现在每个函数中十分重要。  这意味着
+//		它必须作为函数中的第一个语句
+//		出现,甚至先于所有对象变量声明,
+//		这是因为它们的构造函数可能生成 MFC
+//		DLL 调用。
+//
+//		有关其他详细信息,
+//		请参阅 MFC 技术说明 33 和 58。
+//
+
+// CBlVisionProApp
+
+BEGIN_MESSAGE_MAP(CBlVisionProApp, CWinApp)
+END_MESSAGE_MAP()
+
+
+// CBlVisionProApp 构造
+
+CBlVisionProApp::CBlVisionProApp()
+{
+	// TODO:  在此处添加构造代码,
+	// 将所有重要的初始化放置在 InitInstance 中
+}
+
+
+// 唯一的一个 CBlVisionProApp 对象
+
+CBlVisionProApp theApp;
+
+
+// CBlVisionProApp 初始化
+
+BOOL CBlVisionProApp::InitInstance()
+{
+	CWinApp::InitInstance();
+
+	AfxEnableControlContainer();  //添加OCX
+
+	return TRUE;
+}
diff --git a/Common_Class/BlVisionPro/BlVisionPro.def b/Common_Class/BlVisionPro/BlVisionPro.def
new file mode 100644
index 0000000..e941bc8
--- /dev/null
+++ b/Common_Class/BlVisionPro/BlVisionPro.def
@@ -0,0 +1,6 @@
+; BlVisionPro.def : 声明 DLL 的模块参数。
+
+LIBRARY
+
+EXPORTS
+    ; 此处可以是显式导出
diff --git a/Common_Class/BlVisionPro/BlVisionPro.h b/Common_Class/BlVisionPro/BlVisionPro.h
new file mode 100644
index 0000000..b8832b4
--- /dev/null
+++ b/Common_Class/BlVisionPro/BlVisionPro.h
@@ -0,0 +1,27 @@
+// BlVisionPro.h : BlVisionPro DLL 的主头文件
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
+#endif
+
+#include "resource.h"		// 主符号
+
+
+// CBlVisionProApp
+// 有关此类实现的信息,请参阅 BlVisionPro.cpp
+//
+
+class CBlVisionProApp : public CWinApp
+{
+public:
+	CBlVisionProApp();
+
+// 重写
+public:
+	virtual BOOL InitInstance();
+
+	DECLARE_MESSAGE_MAP()
+};
diff --git a/Common_Class/BlVisionPro/BlVisionPro.rc b/Common_Class/BlVisionPro/BlVisionPro.rc
new file mode 100644
index 0000000..c1ef950
--- /dev/null
+++ b/Common_Class/BlVisionPro/BlVisionPro.rc
Binary files differ
diff --git a/Common_Class/BlVisionPro/BlVisionPro.vcxproj b/Common_Class/BlVisionPro/BlVisionPro.vcxproj
new file mode 100644
index 0000000..fdcc4d4
--- /dev/null
+++ b/Common_Class/BlVisionPro/BlVisionPro.vcxproj
@@ -0,0 +1,327 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}</ProjectGuid>
+    <RootNamespace>BlVisionPro</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+    <Keyword>MFCDLLProj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;EXPORT_BLVISION_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>./;./Vision;./View;./Header;$(HALCONROOT)\include\halconcpp;$(HALCONROOT)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\BlVisionPro.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(HALCONROOT)\lib\$(HALCONARCH)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>halconcpp.lib</AdditionalDependencies>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\BlVisionPro\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)$(ProjectName)\Header\BlVisionLib.h" "$(SolutionDir)Lib\BlVisionPro\include\BlVisionLib.h"
+copy "$(SolutionDir)$(ProjectName)\Header\IVisionRecipe.h" "$(SolutionDir)Lib\BlVisionPro\include\IVisionRecipe.h"
+copy "$(SolutionDir)$(ProjectName)\Header\ISoftVisionApp.h" "$(SolutionDir)Lib\BlVisionPro\include\ISoftVisionApp.h"
+copy "$(SolutionDir)$(ProjectName)\Header\BlSideData.h" "$(SolutionDir)Lib\BlVisionPro\include\BlSideData.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="BlVisionPro.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="View\ChipInspectDlg.cpp" />
+    <ClCompile Include="View\CornerDistSetDlg.cpp" />
+    <ClCompile Include="View\CutSetDlg.cpp" />
+    <ClCompile Include="View\GrindSetDlg.cpp" />
+    <ClCompile Include="View\HoleSetDlg.cpp" />
+    <ClCompile Include="View\KDistSetDlg.cpp" />
+    <ClCompile Include="View\KeyVisionSetDlg.cpp" />
+    <ClCompile Include="View\LockSetDlg.cpp" />
+    <ClCompile Include="View\LocSetDlg.cpp" />
+    <ClCompile Include="View\MeasureSetDlg.cpp" />
+    <ClCompile Include="View\OpRoiDlg.cpp" />
+    <ClCompile Include="View\RcutSetDLg.cpp" />
+    <ClCompile Include="View\ScanSetDlg.cpp" />
+    <ClCompile Include="View\ThresSetDlg.cpp" />
+    <ClCompile Include="View\VisionSetDlg.cpp" />
+    <ClCompile Include="Vision\BlSideData.cpp" />
+    <ClCompile Include="Vision\BlVisionLib.cpp" />
+    <ClCompile Include="Vision\Bspline.cpp" />
+    <ClCompile Include="Vision\ConfigVision.cpp" />
+    <ClCompile Include="Vision\CornerDistProcess.cpp" />
+    <ClCompile Include="Vision\CornerRcutProcess.cpp" />
+    <ClCompile Include="Vision\CutDotProcess.cpp" />
+    <ClCompile Include="Vision\CutProcess.cpp" />
+    <ClCompile Include="Vision\DistDotProcess.cpp" />
+    <ClCompile Include="Vision\FileRecipe.cpp" />
+    <ClCompile Include="Vision\GrindDotProcess.cpp" />
+    <ClCompile Include="Vision\GrindProcess.cpp" />
+    <ClCompile Include="Vision\HoleDotProcess.cpp" />
+    <ClCompile Include="Vision\HoleProcess.cpp" />
+    <ClCompile Include="Vision\InChipDotProcess.cpp" />
+    <ClCompile Include="Vision\KDistProcess.cpp" />
+    <ClCompile Include="Vision\KeyDistDotProcess.cpp" />
+    <ClCompile Include="Vision\LocProcess.cpp" />
+    <ClCompile Include="Vision\NccDotProcess.cpp" />
+    <ClCompile Include="Vision\RcutDotProcess.cpp" />
+    <ClCompile Include="Vision\SoftVisionApp.cpp" />
+    <ClCompile Include="Vision\ThresDotProcess.cpp" />
+    <ClCompile Include="Vision\ThresProcess.cpp" />
+    <ClCompile Include="Vision\TranformCoordinate.cpp" />
+    <ClCompile Include="Vision\VisionBufferPro.cpp" />
+    <ClCompile Include="Vision\VisionRecipe.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="BlVisionPro.h" />
+    <ClInclude Include="Header\BlSideData.h" />
+    <ClInclude Include="Header\BlVisionLib.h" />
+    <ClInclude Include="Header\ISoftVisionApp.h" />
+    <ClInclude Include="Header\IVisionRecipe.h" />
+    <ClInclude Include="IncludeVision.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+    <ClInclude Include="View\ChipInspectDlg.h" />
+    <ClInclude Include="View\CornerDistSetDlg.h" />
+    <ClInclude Include="View\CutSetDlg.h" />
+    <ClInclude Include="View\GrindSetDlg.h" />
+    <ClInclude Include="View\HoleSetDlg.h" />
+    <ClInclude Include="View\KDistSetDlg.h" />
+    <ClInclude Include="View\KeyVisionSetDlg.h" />
+    <ClInclude Include="View\LockSetDlg.h" />
+    <ClInclude Include="View\LocSetDlg.h" />
+    <ClInclude Include="View\MeasureSetDlg.h" />
+    <ClInclude Include="View\OpRoiDlg.h" />
+    <ClInclude Include="View\RcutSetDLg.h" />
+    <ClInclude Include="View\ScanSetDlg.h" />
+    <ClInclude Include="View\ThresSetDlg.h" />
+    <ClInclude Include="View\VisionSetDlg.h" />
+    <ClInclude Include="Vision\Bspline.h" />
+    <ClInclude Include="Vision\ConfigVision.h" />
+    <ClInclude Include="Vision\CornerDistProcess.h" />
+    <ClInclude Include="Vision\CornerRcutProcess.h" />
+    <ClInclude Include="Vision\CutDotProcess.h" />
+    <ClInclude Include="Vision\CutProcess.h" />
+    <ClInclude Include="Vision\DistDotProcess.h" />
+    <ClInclude Include="Vision\EiVisionType.h" />
+    <ClInclude Include="Vision\FileRecipe.h" />
+    <ClInclude Include="Vision\GrindDotProcess.h" />
+    <ClInclude Include="Vision\GrindProcess.h" />
+    <ClInclude Include="Vision\HoleDotProcess.h" />
+    <ClInclude Include="Vision\HoleProcess.h" />
+    <ClInclude Include="Vision\InChipDotProcess.h" />
+    <ClInclude Include="Vision\KDistProcess.h" />
+    <ClInclude Include="Vision\KeyDistDotProcess.h" />
+    <ClInclude Include="Vision\LocProcess.h" />
+    <ClInclude Include="Vision\NccDotProcess.h" />
+    <ClInclude Include="Vision\RcutDotProcess.h" />
+    <ClInclude Include="Vision\SoftVisionApp.h" />
+    <ClInclude Include="Vision\ThresDotProcess.h" />
+    <ClInclude Include="Vision\ThresProcess.h" />
+    <ClInclude Include="Vision\TranformCoordinate.h" />
+    <ClInclude Include="Vision\Vec.h" />
+    <ClInclude Include="Vision\VisionBufferPro.h" />
+    <ClInclude Include="Vision\VisionRecipe.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="BlVisionPro.def" />
+    <None Include="res\BlVisionPro.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="BlVisionPro.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\navigate_down.ico" />
+    <Image Include="res\navigate_left.ico" />
+    <Image Include="res\navigate_right.ico" />
+    <Image Include="res\navigate_up.ico" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="BlVisionPro.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/BlVisionPro.vcxproj.filters b/Common_Class/BlVisionPro/BlVisionPro.vcxproj.filters
new file mode 100644
index 0000000..62bf707
--- /dev/null
+++ b/Common_Class/BlVisionPro/BlVisionPro.vcxproj.filters
@@ -0,0 +1,348 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="Header">
+      <UniqueIdentifier>{6b9df6fc-c6e1-4fc4-bac7-12afe3d62fe2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="View">
+      <UniqueIdentifier>{fa7ebfd5-c76a-4a48-abdc-2341ef5425fd}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Vision">
+      <UniqueIdentifier>{a50739ac-00f3-4d43-bb12-9c59ab37dc44}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="func">
+      <UniqueIdentifier>{b15b5c28-2ffd-4b93-9787-55d0c57ccbe2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Vision\Vision Model">
+      <UniqueIdentifier>{406a47d3-0b5d-4946-a872-5fa6c87fd860}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Vision\Vision Dot">
+      <UniqueIdentifier>{f2bdadec-a287-4bdd-8634-801d9c7d9261}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="BlVisionPro.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="View\CornerDistSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\VisionSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\KeyVisionSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\RcutSetDLg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ScanSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\VisionRecipe.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\SoftVisionApp.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\ConfigVision.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\BlVisionLib.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\BlSideData.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\VisionBufferPro.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\TranformCoordinate.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="View\OpRoiDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\LocSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\MeasureSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\CutSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\CornerRcutProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\CutDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\DistDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\GrindDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\GrindProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\LocProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\NccDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\RcutDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\CutProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\KDistProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="View\KDistSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\GrindSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\KeyDistDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\CornerDistProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\FileRecipe.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="View\LockSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\Bspline.cpp">
+      <Filter>func</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ChipInspectDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\InChipDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\ThresDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\ThresProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ThresSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\HoleSetDlg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\HoleDotProcess.cpp">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClCompile>
+    <ClCompile Include="Vision\HoleProcess.cpp">
+      <Filter>Vision\Vision Model</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\IVisionRecipe.h">
+      <Filter>Header</Filter>
+    </ClInclude>
+    <ClInclude Include="IncludeVision.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="BlVisionPro.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ISoftVisionApp.h">
+      <Filter>Header</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\BlVisionLib.h">
+      <Filter>Header</Filter>
+    </ClInclude>
+    <ClInclude Include="View\CornerDistSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\VisionSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\BlSideData.h">
+      <Filter>Header</Filter>
+    </ClInclude>
+    <ClInclude Include="View\KeyVisionSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\RcutSetDLg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ScanSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\VisionRecipe.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\SoftVisionApp.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\ConfigVision.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\VisionBufferPro.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\TranformCoordinate.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="View\OpRoiDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\LocSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\MeasureSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\CutSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\CornerRcutProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\CutDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\DistDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\EiVisionType.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\GrindDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\GrindProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\LocProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\NccDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\RcutDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\CutProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\KDistProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="View\KDistSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\GrindSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\KeyDistDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\CornerDistProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\FileRecipe.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="View\LockSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\Vec.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\Bspline.h">
+      <Filter>func</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ChipInspectDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\InChipDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\ThresDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\ThresProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ThresSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\HoleSetDlg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\HoleDotProcess.h">
+      <Filter>Vision\Vision Dot</Filter>
+    </ClInclude>
+    <ClInclude Include="Vision\HoleProcess.h">
+      <Filter>Vision\Vision Model</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="BlVisionPro.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\BlVisionPro.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="BlVisionPro.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\navigate_down.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\navigate_left.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\navigate_right.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\navigate_up.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Header/BlSideData.h b/Common_Class/BlVisionPro/Header/BlSideData.h
new file mode 100644
index 0000000..d884de5
--- /dev/null
+++ b/Common_Class/BlVisionPro/Header/BlSideData.h
@@ -0,0 +1,91 @@
+#ifndef BL_SIDE_DATA
+#define BL_SIDE_DATA
+
+#ifdef EXPORT_BLVISION_DLL
+#include "../Lib/BaseDisplaySDK/include/typesdef.h"
+#define EXPORTED_BLVISION _declspec(dllexport)
+#else
+#define EXPORTED_BLVISION _declspec(dllimport)
+#endif
+
+
+typedef struct _SideLineInf 
+{
+	int nSideLine;
+	int nThres;
+	int left;
+	int top;
+	int width;
+	int height;
+}SideLineInf;
+
+//检测结果
+typedef struct _DispVisionResult {
+	int eDir;     //面参数
+	int nType;     //0,Point;  1;表示Rect;   2,表示圆; 3, 直线; 4,文本
+	int eVision;  //视觉类型
+	int rectX1;  //矩形参数
+	int rectY1;  //矩形参数
+	int rectX2;  //矩形参数
+	int rectY2;  //矩形参数
+	int pointX;  //点参数
+	int pointY;  //点参数
+	int circleX;  //圆参数
+	int circleY;  //圆参数
+	int circleRadius;  //圆参数 
+	CString strName;   //名称
+	int showROI;       //0,表示NG; 1,表示ROI
+}DispVisionResult;
+
+
+class EXPORTED_BLVISION CBlSideData
+{
+public:
+	CBlSideData();
+	~CBlSideData();
+
+public:
+	//1. 重置
+	void Reset(void);
+
+	//2. 获取位置
+	Point2I getPose(int nType);
+
+public:
+	//1. 分辨率
+	double	m_dPixelSizeX;   //X方向的分辨率         
+	double	m_dPixelSizeY;   //Y方向的分辨率
+
+	//2. 检测结束
+	BOOL m_bInspection_Complete;   //是否检测结速
+
+	//3.Top Mark Info
+	BOOL m_bTopMark_Find;       //是否查找TopMark
+	Point2I m_mTopMark;         //TopMark的位置
+	Point2I m_mTopBzMark;		//TopBzMark的位置
+
+	//4. Bottom Mark Info
+	BOOL m_bBotMark_Find;       //是否查找BotMark
+	Point2I m_mBotMark;         //BotMark的位置
+	Point2I m_mBotBzMark;		//BotBzMark的位置
+
+	//5. 查找Top Point
+	BOOL m_bTopPoint_Find;
+	Point2I m_mTopPoint;       //TopPoint的位置
+	Point2I m_mTopBzPoint;     //TopBzPoint的位置
+
+	//6. 查找Bot Point
+	BOOL m_bBotPoint_Find;
+	Point2I m_mBotPoint;     //BotPoint的位置
+    Point2I m_mBotBzPoint;   //BotBzPoint的位置
+
+	//7. Edge
+	int m_nStartLine;
+	int m_nEndLine;
+
+	//8. 检测结果
+	std::map<int, SideLineInf> m_mapSideLineInf;
+	std::vector<DispVisionResult> m_vDispVisionResult;
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Header/BlVisionLib.h b/Common_Class/BlVisionPro/Header/BlVisionLib.h
new file mode 100644
index 0000000..bd8ee6c
--- /dev/null
+++ b/Common_Class/BlVisionPro/Header/BlVisionLib.h
@@ -0,0 +1,19 @@
+#ifndef BL_VISION_H
+#define BL_VISION_H
+
+#include "IVisionRecipe.h"
+#include "ISoftVisionApp.h"
+
+#ifdef EXPORT_BLVISION_DLL
+#define EXPORTED_BLVISION _declspec(dllexport)
+#else
+#define EXPORTED_BLVISION _declspec(dllimport)
+#endif
+
+extern "C" EXPORTED_BLVISION int BlVision_GetVersion(char *pszVersion, int nBufferSize);
+extern "C" EXPORTED_BLVISION IVisionRecipe* BlVision_GetVisionRecipe(void);
+extern "C" EXPORTED_BLVISION ISoftVisionApp* BlVision_GetSoftVisionApp(void);
+
+
+
+#endif
diff --git a/Common_Class/BlVisionPro/Header/ISoftVisionApp.h b/Common_Class/BlVisionPro/Header/ISoftVisionApp.h
new file mode 100644
index 0000000..f4c5d84
--- /dev/null
+++ b/Common_Class/BlVisionPro/Header/ISoftVisionApp.h
@@ -0,0 +1,110 @@
+#ifndef ISOFT_VISION_APP_H
+#define ISOFT_VISION_APP_H
+
+#include <functional>
+#include <iostream>
+
+enum DefectNgType {
+	DefectNg_OK = 0,    //OK
+	DefectNg_Chip,      //Chip
+	DefectNg_Broken,    //破损
+	DefectNg_Grind,     //研磨
+	DefectNg_Dist_Cut,  //切割精度
+	DefectNg_Corner_Dist,    //角精度
+	DefectNg_Unknown          //指错误
+};
+
+#define NG_INF_TOTAL          1000
+typedef struct _NgInfo
+{
+	int eDir;                //检测面
+	int id;                  //检测ID
+	CString strName;        //名称
+	int xPosPxl;            //X位置
+	int yPosPxl;            //Y位置
+	double result;          //结果   Measure
+	double xResult;          //结果  Chip
+	double yResult;         //结果   Chip
+	double minValue;        //下限
+	double maxValue;        //限制
+	int ngType;             //缺陷类型
+	bool isRes;             //检测结果
+	int x1;                 //缺陷的最小矩形
+	int y1;                 //缺陷的最小矩形
+	int x2;                 //缺陷的最小矩形
+	int y2;                 //缺陷的最小矩形
+	int eVision;            //视觉算法
+}NgInfo;
+
+
+//typedef std::function<void(int msgEvent, int x, int y, double rate, int pixel)> ImageVisionEvent;
+//typedef std::function<void(int code, int eDir)> ImageVisionEvent;
+
+class IVisionEvent
+{
+public:
+	//1. 接收到数据事件
+	using MsgReceivedEvent = void(*)(int code, int eDir);
+
+	//2. 日志信息
+	using MsgLogEvent = void(*)(int level, std::string strText);
+
+
+public:
+	IVisionEvent(MsgReceivedEvent msgRcvCb = nullptr, MsgLogEvent msgLogEvent = nullptr) {
+		/* code */
+		m_msgRcvCb = msgRcvCb;
+		m_msgLogCb = msgLogEvent;
+	};
+
+	void clear() {
+		/* code */
+		m_msgRcvCb = NULL;
+		m_msgLogCb = NULL;
+	}
+public:
+	MsgReceivedEvent m_msgRcvCb = NULL;
+	MsgLogEvent m_msgLogCb = NULL;
+};
+
+class ISoftVisionApp
+{
+public:
+	virtual ~ISoftVisionApp() {};
+
+public:
+	//1. 打开视觉窗体
+	virtual int OpenVisionWindow(void) = 0;
+	virtual CDialogEx* CreateVisionWindow(void) = 0;
+	virtual int ReleaseWindow(CDialogEx *pDlg) = 0;
+	virtual void ChangeDimension(CDialogEx *pDlg, int nDir) = 0;
+	virtual void SetVisionOpen(BOOL isOpen) = 0;
+
+	//2. 设置屏蔽
+	virtual void OpenKeySetWindow(void) = 0;
+
+	//3. 坐标转换
+	virtual Point2I getPose(int eDir, int xPoxPxl, int yPosPxl) = 0;
+
+	//4. 执行视觉处理
+	virtual int Execute(int eDir, NgInfo *ngArray) = 0;
+
+	//5. 设置回调时间
+	virtual void setImageEventSignal(IVisionEvent *pEvent) = 0;
+
+	//6. 坐标转换,统一坐标系统
+	virtual bool transformToStandard(int eDir, Point2I point, Point2I &result,  Point2I &topResult, Point2I &botResult) = 0;
+
+	//7. 检测Cut线
+	virtual bool findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I &result) = 0;
+	virtual double DistancePL(Point2D pose, Line2D line) = 0;
+
+	//8. 检测Norch缺陷	
+	virtual int findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres,
+		int szType, int xFzSize, int yFzSize, CRect* aryResult) = 0;
+
+	//9. 设置平台,0是平台1, 1是平台2
+    virtual void setStage(int nStage) = 0;
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Header/IVisionRecipe.h b/Common_Class/BlVisionPro/Header/IVisionRecipe.h
new file mode 100644
index 0000000..3824565
--- /dev/null
+++ b/Common_Class/BlVisionPro/Header/IVisionRecipe.h
@@ -0,0 +1,67 @@
+#ifndef IVISION_RECIPE_H
+#define IVISION_RECIPE_H
+
+#define EI_VISION_RECIPE    0
+#define RCUT_VISION_RECIPE  1
+#define NI_VISION_RECIPE    2
+
+#include "BlSideData.h"
+
+//配方数据管理
+class IVisionRecipe
+{
+public:
+	virtual ~IVisionRecipe() {};
+
+public:
+	//1. 设置配方路径
+	virtual int setWorkDir(const char *pszPath) = 0;
+
+	//2. 保存
+	virtual int save(void) = 0;
+
+	//3. 打开
+	virtual int open(void) = 0;
+
+	//4. 获取采集卡
+	virtual CGrabberControl* getGrabberControl(int iCam) = 0;
+
+	//5. 设置采集开
+	virtual int setGrabberControl(CGrabberControl *pGrabberControl, int iCam) = 0;
+
+	//6. 相机相机信息
+	virtual int setCameraSetting(DimensionDir eDir, int iCam, int iScan) = 0;
+
+	//7. 初始化
+	virtual int init(void) = 0;
+
+	//8. 获取SideData
+	virtual CBlSideData* getSideData(DimensionDir eDir) = 0;
+
+	//9. 设置配方类型
+	virtual int setRecipeType(int nType) = 0;
+
+	//10. 获取配方类型
+	virtual int getRecipeType(void) = 0;
+
+	//11. 获取信息
+	virtual bool getVisionUse(void) = 0;
+
+	//12. 设置区域
+	virtual void setFrame(int x1, int y1, int x2, int y2) = 0;
+
+	//13. 设置配方名称
+	virtual int setVisionName(const char* pszPath) = 0;
+	virtual int setProductNo(const char* pszNo) = 0;
+
+	//14. 获取配方名称
+	virtual std::string getVisionName(void) = 0;
+
+	//15. 设置屏幕尺寸
+	virtual void setGlassSize(int x, int y) = 0;
+
+	//16. 窗体是否打开
+	virtual BOOL getVisionSetOpen(void) = 0;
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/IncludeVision.h b/Common_Class/BlVisionPro/IncludeVision.h
new file mode 100644
index 0000000..59be8e1
--- /dev/null
+++ b/Common_Class/BlVisionPro/IncludeVision.h
@@ -0,0 +1,108 @@
+#ifndef INCLUDE_VISION_H
+#define INCLUDE_VISION_H
+
+#define KEY_EI_SOFT         0
+
+#if KEY_EI_SOFT
+#include "../../EdgeInspector_App/Define/Global_Define.h"
+#else
+#include "../../ENRIT/Define/Global_Define.h"
+#endif
+
+#include <HalconCpp.h>
+#include "EiVisionType.h"
+
+//1. 日志模块
+#include "../Lib/LogSDK/include/ILogger.h"
+#include "../Lib/LogSDK/include/LogLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/LogSDK/lib/x64/Release/Log.lib")
+#else
+#pragma comment(lib,"../Lib/LogSDK/lib/x64/Release/Log.lib")
+#endif
+
+//2. 显示模块
+#include "../Lib/BaseDisplaySDK/include/typesdef.h"
+#include "../Lib/BaseDisplaySDK/include/BaseVision.h"
+#include "../Lib/BaseDisplaySDK/include/IClsShape.h"
+#include "../Lib/BaseDisplaySDK/include/IImageDisplay.h"
+#include "../Lib/BaseDisplaySDK/include/BaseDisplayLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/BaseDisplaySDK/lib/x64/Debug/BaseDisplay.lib")
+#else
+#pragma comment(lib,"../Lib/BaseDisplaySDK/lib/x64/Release/BaseDisplay.lib")
+#endif
+
+//3. Halcon 显示模块
+#include "../Lib/ApiVisionSDK/include/ClsVision.h"
+#include "../Lib/ApiVisionSDK/include/IClsDisplay.h"
+#include "../Lib/ApiVisionSDK/include/VisionLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/ApiVisionSDK/lib/x64/Debug/ApiVisionLibrary.lib")
+#else
+#pragma comment(lib,"../Lib/ApiVisionSDK/lib/x64/Release/ApiVisionLibrary.lib")
+#endif
+
+//4. 采集卡信息
+//11. 采集模块
+#include "../Lib/BlGrabber/include/FrameBufferController.h"
+#include "../Lib/BlGrabber/include/GrabberControl.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/BlGrabber/lib/x64/Debug/BlGrabberD.lib")
+#else
+#pragma comment (lib, "../Lib/BlGrabber/lib/x64/Release/BlGrabber.lib")
+#endif
+
+//9.  SISControl
+#include "../Lib/SISControls/include/CellCtrl.h"
+#include "../Lib/SISControls/include/ColorButton.h"
+#include "../Lib/SISControls/include/DefectMap.h"
+#include "../Lib/SISControls/include/FontStatic.h"
+#include "../Lib/SISControls/include/GradientStatic.h"
+#include "../Lib/SISControls/include/HeadCtrl.h"
+#include "../Lib/SISControls/include/InPlaceComboBox.h"
+#include "../Lib/SISControls/include/InPlaceEdit.h"
+#include "../Lib/SISControls/include/LogCtrl.h"
+#include "../Lib/SISControls/include/SISButton.h"
+#include "../Lib/SISControls/include/SISFolderScheduling.h"
+#include "../Lib/SISControls/include/SISJogBtn2Parent.h"
+#include "../Lib/SISControls/include/SISJogButton.h"
+#include "../Lib/SISControls/include/SISLabel.h"
+#include "../Lib/SISControls/include/SISListBoxLog.h"
+#include "../Lib/SISControls/include/SISListCtrlExt.h"
+#include "../Lib/SISControls/include/SortClass.h"
+#include "../Lib/SISControls/include/StaticMap.h"
+#include "../Lib/SISControls/include/WKButton.h"
+#include "../Lib/SISControls/include/XTabCtrl.h"
+#include "../Lib/SISControls/GridControl/CellRange.h"
+#include "../Lib/SISControls/GridControl/GridCell.h"
+#include "../Lib/SISControls/GridControl/GridCellBase.h"
+#include "../Lib/SISControls/GridControl/GridCellButton.h"
+#include "../Lib/SISControls/GridControl/GridCtrl.h"
+#include "../Lib/SISControls/GridControl/GridDropTarget.h"
+#include "../Lib/SISControls/GridControl/GridInPlaceEdit.h"
+#include "../Lib/SISControls/GridControl/GridMemDC.h"
+#include "../Lib/SISControls/GridControl/TitleTip.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellCheck.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellCombo.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridURLCell.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/SISControls/lib/x64/Debug/SISControlsD.lib")
+#else
+#pragma comment (lib, "../Lib/SISControls/lib/x64/Release/SISControls.lib")
+#endif
+
+#include "../Lib/JsoncppSDK/include/json.h"
+#include "../Lib/JsoncppSDK/include/config.h"
+#include "../Lib/JsoncppSDK/include/reader.h"
+#include "../Lib/JsoncppSDK/include/value.h"
+#include "../Lib/JsoncppSDK/include/writer.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/JsoncppSDK/lib/x64/Debug/jsoncpp.lib")
+#else
+#pragma comment (lib, "../Lib/JsoncppSDK/lib/x64/Release/jsoncpp.lib")
+#endif
+
+#endif
diff --git a/Common_Class/BlVisionPro/ReadMe.txt b/Common_Class/BlVisionPro/ReadMe.txt
new file mode 100644
index 0000000..afe5c6c
--- /dev/null
+++ b/Common_Class/BlVisionPro/ReadMe.txt
@@ -0,0 +1,45 @@
+锘�========================================================================
+    MICROSOFT 鍩虹绫诲簱 : BlVisionPro 椤圭洰姒傝堪
+========================================================================
+
+
+搴旂敤绋嬪簭鍚戝宸蹭负鎮ㄥ垱寤轰簡姝� BlVisionPro DLL銆傛 DLL 涓嶄粎婕旂ず Microsoft 鍩虹绫荤殑鍩烘湰浣跨敤鏂规硶锛岃繕鍙綔涓烘偍缂栧啓 DLL 鐨勮捣鐐广��
+
+鏈枃浠舵瑕佷粙缁嶇粍鎴� BlVisionPro DLL 鐨勬瘡涓枃浠剁殑鍐呭銆�
+
+BlVisionPro.vcxproj
+    杩欐槸浣跨敤搴旂敤绋嬪簭鍚戝鐢熸垚鐨� VC++ 椤圭洰鐨勪富椤圭洰鏂囦欢锛屽叾涓寘鍚敓鎴愯鏂囦欢鐨� Visual C++ 鐨勭増鏈俊鎭紝浠ュ強鏈夊叧浣跨敤搴旂敤绋嬪簭鍚戝閫夋嫨鐨勫钩鍙般�侀厤缃拰椤圭洰鍔熻兘鐨勪俊鎭��
+
+BlVisionPro.vcxproj.filters
+    杩欐槸浣跨敤鈥滃簲鐢ㄧ▼搴忓悜瀵尖�濈敓鎴愮殑 VC++ 椤圭洰绛涢�夊櫒鏂囦欢銆傚畠鍖呭惈鏈夊叧椤圭洰鏂囦欢涓庣瓫閫夊櫒涔嬮棿鐨勫叧鑱斾俊鎭�傚湪 IDE 涓紝閫氳繃杩欑鍏宠仈锛屽湪鐗瑰畾鑺傜偣涓嬩互鍒嗙粍褰㈠紡鏄剧ず鍏锋湁鐩镐技鎵╁睍鍚嶇殑鏂囦欢銆備緥濡傦紝鈥�.cpp鈥濇枃浠朵笌鈥滄簮鏂囦欢鈥濈瓫閫夊櫒鍏宠仈銆�
+
+BlVisionPro.h
+    杩欐槸 DLL 鐨勪富澶存枃浠躲�傚畠澹版槑浜� CBlVisionProApp 绫汇��
+
+BlVisionPro.cpp
+    杩欐槸涓� DLL 婧愭枃浠躲�傚畠鍖呭惈 CBlVisionProApp 绫汇��
+
+BlVisionPro.rc
+    杩欐槸绋嬪簭浣跨敤鐨勬墍鏈� Microsoft Windows 璧勬簮鐨勫垪琛ㄣ�傚畠鍖呮嫭 RES 瀛愮洰褰曚腑瀛樺偍鐨勫浘鏍囥�佷綅鍥惧拰鍏夋爣銆傛鏂囦欢鍙互鐩存帴鍦� Microsoft Visual C++ 涓繘琛岀紪杈戙��
+
+res\BlVisionPro.rc2
+    姝ゆ枃浠跺寘鍚笉鍦� Microsoft Visual C++ 涓繘琛岀紪杈戠殑璧勬簮銆傛偍搴旇灏嗕笉鍙敱璧勬簮缂栬緫鍣ㄧ紪杈戠殑鎵�鏈夎祫婧愭斁鍦ㄦ鏂囦欢涓��
+
+BlVisionPro.def
+    姝ゆ枃浠跺寘鍚湪 Microsoft Windows 涓繍琛屾墍蹇呴渶鐨� DLL 鐨勬湁鍏充俊鎭�傚畠瀹氫箟浜� DLL 鐨勫悕绉板拰璇存槑绛夊弬鏁帮紝鑰屼笖杩樹粠 DLL 瀵煎嚭鍑芥暟銆�
+
+/////////////////////////////////////////////////////////////////////////////
+鍏朵粬鏍囧噯鏂囦欢:
+
+StdAfx.h, StdAfx.cpp
+    杩欎簺鏂囦欢鐢ㄤ簬鐢熸垚鍚嶄负 BlVisionPro.pch 鐨勯缂栬瘧澶� (PCH) 鏂囦欢鍜屽悕涓� StdAfx.obj 鐨勯缂栬瘧绫诲瀷鏂囦欢銆�
+
+Resource.h
+    杩欐槸鏍囧噯澶存枃浠讹紝鍙敤浜庡畾涔夋柊鐨勮祫婧� ID銆侻icrosoft Visual C++ 灏嗚鍙栧苟鏇存柊姝ゆ枃浠躲��
+
+/////////////////////////////////////////////////////////////////////////////
+鍏朵粬娉ㄩ噴:
+
+搴旂敤绋嬪簭鍚戝浣跨敤鈥淭ODO:鈥濇潵鎸囩ず搴旀坊鍔犳垨鑷畾涔夌殑婧愪唬鐮侀儴鍒嗐��
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/BlVisionPro/View/ChipInspectDlg.cpp b/Common_Class/BlVisionPro/View/ChipInspectDlg.cpp
new file mode 100644
index 0000000..8b2dc0c
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/ChipInspectDlg.cpp
@@ -0,0 +1,185 @@
+// ChipInspectDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "ChipInspectDlg.h"
+#include "afxdialogex.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+#include "InChipDotProcess.h"
+
+// CChipInspectDlg 对话框
+
+IMPLEMENT_DYNAMIC(CChipInspectDlg, CDialogEx)
+
+CChipInspectDlg::CChipInspectDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_CHIP_INSPECT, pParent)
+	, m_imageIndex(1)
+	, m_nMinX(0)
+	, m_nMaxX(0)
+	, m_nEdgeChipThres(20)
+{
+	m_display = NULL;
+	m_ptMouseUp.x = 0;
+	m_ptMouseUp.y = 0;
+}
+
+CChipInspectDlg::~CChipInspectDlg()
+{
+	if (NULL != m_display) {
+		ClsDisplay_Free(m_display);
+		m_display = NULL;
+	}
+}
+
+void CChipInspectDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_COMBO_SIDE_INDEX_INCHIP, m_combSide);
+	DDX_Text(pDX, IDC_EDIT_IMAGE_INDEX_INCHIP, m_imageIndex);
+	DDX_Text(pDX, IDC_EDIT_INCHIP_MINX, m_nMinX);
+	DDX_Text(pDX, IDC_EDIT_INCHIP_MAXX, m_nMaxX);
+	DDX_Text(pDX, IDC_EDIT_EDGE_THRES_INCHIP, m_nEdgeChipThres);
+}
+
+
+BEGIN_MESSAGE_MAP(CChipInspectDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_GET_IMAGE_INCHIP, &CChipInspectDlg::OnBnClickedButtonGetImageInchip)
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_INCHIP, &CChipInspectDlg::OnBnClickedButtonProcessInchip)
+END_MESSAGE_MAP()
+
+
+// CChipInspectDlg 消息处理程序
+
+
+BOOL CChipInspectDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CChipInspectDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitDisplay();
+
+	InitUiParam();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+
+void CChipInspectDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+void CChipInspectDlg::InitDisplay(void) {
+	/* code */
+	m_display = ClsDisplay_Create();
+	if (nullptr != m_display) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_IMAGE_INCHIP);
+		pDispWnd->GetWindowRect(rect);
+		m_display->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_display->SetOperFlag(SELECT_OPER_FLAG);
+		m_display->SetDraw("fill", DISP_OBJECT);
+		m_display->SetColor("red", DISP_OBJECT);
+
+		m_display->SetDraw("fill", DISP_REGION);
+		m_display->SetColor("red", DISP_REGION);
+
+		m_display->SetDraw("fill", DISP_CROSS);
+		m_display->SetColor("green", DISP_CROSS);
+
+		m_display->SetDraw("fill", DISP_SELECT);
+		m_display->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_display->SetBackgroundColor(color);
+		m_display->SetOperatorCallback([&](int msgEvent, int x, int y, double rate, int pixel) ->void {
+			MouseEventProc(msgEvent, x, y);  //1. 表示扫描
+		});
+	}
+}
+
+void CChipInspectDlg::MouseEventProc(int msgEvent, int x, int y) {
+	/* code */
+	BOOL isChange = FALSE;
+	if (LEFT_MOUSE_BUTTON_UP == msgEvent) {
+		m_ptMouseUp.x = x;
+		m_ptMouseUp.y = y;
+		isChange = TRUE;
+	}
+
+	CString msg;
+	msg.Format(_T("Pose: (%d, %d)"), m_ptMouseUp.x, m_ptMouseUp.y);
+	std::string str = CFileRecipe::toString(msg);
+	if (isChange) {
+		m_display->ClearWindow();
+		m_display->DispImage();
+	}
+	m_display->DispMessage(30, 30, str, "blue", "false");
+}
+
+void CChipInspectDlg::OnBnClickedButtonGetImageInchip()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	UpdateData(TRUE);
+
+	int nSide = m_combSide.GetCurSel();
+	DimensionDir eDir = (DimensionDir)nSide;
+	if (!CVisionBufferPro::getIndexImage(eDir, &m_display->GetImage(), m_imageIndex)) return;
+
+	m_display->ClearWindow();
+	m_display->DispImage();
+}
+
+void CChipInspectDlg::InitUiParam(void) {
+	/* code */
+	m_combSide.InsertString(0, _T("TopA"));
+	m_combSide.InsertString(1, _T("TopB"));
+	m_combSide.InsertString(2, _T("TopC"));
+	m_combSide.InsertString(3, _T("TopD"));
+	m_combSide.InsertString(4, _T("DotA"));
+	m_combSide.InsertString(5, _T("DotB"));
+	m_combSide.InsertString(6, _T("DotC"));
+	m_combSide.InsertString(7, _T("DotD"));
+	m_combSide.SetCurSel(0);
+}
+
+
+void CChipInspectDlg::OnBnClickedButtonProcessInchip()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	UpdateData(TRUE);
+
+	int nSide = m_combSide.GetCurSel();
+	DimensionDir eDir = (DimensionDir)nSide;
+	CInChipDotProcess *dot = new CInChipDotProcess(eDir);
+
+	Point2I ptStart, ptEnd;
+	ptStart.x = m_nMinX;
+	ptStart.y = 0;
+	ptEnd.x = m_nMaxX;
+	ptEnd.y = 1023;
+	dot->m_threshold = m_nEdgeChipThres;
+	dot->Execute(eDir, m_imageIndex, ptStart, ptEnd);
+
+	delete dot;
+	dot = NULL;
+}
diff --git a/Common_Class/BlVisionPro/View/ChipInspectDlg.h b/Common_Class/BlVisionPro/View/ChipInspectDlg.h
new file mode 100644
index 0000000..069e71e
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/ChipInspectDlg.h
@@ -0,0 +1,52 @@
+#pragma once
+#include "afxwin.h"
+
+
+// CChipInspectDlg 对话框
+
+class CChipInspectDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CChipInspectDlg)
+
+public:
+	CChipInspectDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CChipInspectDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_CHIP_INSPECT };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	afx_msg void OnBnClickedButtonGetImageInchip();
+
+private:
+	IClsDisplay *m_display;
+	CComboBox m_combSide;
+	int m_imageIndex;
+	Point2I m_ptMouseUp;
+
+	int m_nMinX;
+	int m_nMaxX;
+	int m_nEdgeChipThres;
+
+private:
+	//1. 初始化
+	void InitDisplay(void);
+
+	//2. 界面初始化
+	void InitUiParam(void);
+
+	//3. 执行
+	void MouseEventProc(int msgEvent, int x, int y);
+	
+public:
+	afx_msg void OnBnClickedButtonProcessInchip();
+};
diff --git a/Common_Class/BlVisionPro/View/CornerDistSetDlg.cpp b/Common_Class/BlVisionPro/View/CornerDistSetDlg.cpp
new file mode 100644
index 0000000..257001c
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/CornerDistSetDlg.cpp
@@ -0,0 +1,804 @@
+// CornerDistSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "CornerDistSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionBufferPro.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "MeasureSetDlg.h"
+
+// CCornerDistSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CCornerDistSetDlg, CDialogEx)
+
+CCornerDistSetDlg::CCornerDistSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DLG_DIST_CORNER, pParent)
+	, m_id(0)
+	, m_strName(_T("NULL"))
+	, m_refer(100)
+	, m_refer_(100)
+	, m_minValue(0)
+	, m_maxValue(0)
+	, m_minValue2(0)
+	, m_maxValue2(0)
+	, m_incValue(0)
+	, m_incValue2(0)
+{
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+	m_topPoint.x = 0;
+	m_topPoint.y = 0;
+	m_botPoint.x = 0;
+	m_botPoint.y = 0;
+
+	m_pos.x = 0;
+	m_pos.y = 0;
+
+	m_eDir = DIMENSION_NONE;
+
+	m_dotDist = NULL;
+	m_dot = NULL;
+}
+
+CCornerDistSetDlg::~CCornerDistSetDlg()
+{
+	SaveDistCorner();
+	SaveDistDotProcess();
+}
+
+void CCornerDistSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_LIST_DIST_DOT, m_listCornerPoint);
+	DDX_Control(pDX, IDC_COMBOMK_FIRST_REFER_TYPE_DIST, m_combFrirtRefer);            //First Refer
+
+	DDX_Text(pDX, IDC_EDIT_TOP_MARK_X_DIST, m_topMark.x);  //Top Mark
+	DDX_Text(pDX, IDC_EDIT_TOP_MARK_Y_DIST, m_topMark.y);
+	DDX_Text(pDX, IDC_EDIT_BOT_MARK_X_DIST, m_botMark.x);    //Bot Mark
+	DDX_Text(pDX, IDC_EDIT_BOT_MARK_Y_DIST, m_botMark.y);
+	DDX_Text(pDX, IDC_EDIT_TOP_POINT_X_DIST, m_topPoint.x);   //Top Point
+	DDX_Text(pDX, IDC_EDIT_TOP_POINT_Y_DIST, m_topPoint.y);
+	DDX_Text(pDX, IDC_EDIT_BOT_POINT_X_DIST, m_botPoint.x);    //Bot Point
+	DDX_Text(pDX, IDC_EDIT_BOT_POINT_Y_DIST, m_botPoint.y);
+	
+	DDX_Text(pDX, IDC_EDIT_ID_DIST, m_id);
+	DDX_Text(pDX, IDC_EDIT_NAME_DIST, m_strName);
+
+	DDX_Text(pDX, IDC_EDIT_POS_X_DIST, m_pos.x);
+	DDX_Text(pDX, IDC_EDIT_POS_Y_DIST, m_pos.y);
+	DDX_Text(pDX, IDC_EDIT_INC_REFER_DIST, m_refer);
+	DDX_Text(pDX, IDC_EDIT_DEC_REFER_DIST, m_refer_);
+
+	DDX_Control(pDX, IDC_COMBO_DIST_MODE_DIST, m_combDistMode);           //DIST Mode
+	DDX_Text(pDX, IDC_EDIT_MIN_VAL_DIST, m_minValue);
+	DDX_Text(pDX, IDC_EDIT_MAX_VAL_DIST, m_maxValue);
+
+	DDX_Control(pDX, IDC_COMBO_DIST_MODE_DIST2, m_combDistMode2);           //DIST Mode
+	DDX_Text(pDX, IDC_EDIT_MIN_VAL_DIST2, m_minValue2);
+	DDX_Text(pDX, IDC_EDIT_MAX_VAL_DIST2, m_maxValue2);
+
+	DDX_Control(pDX, IDC_COMBO_NG_TYPE_DIST, m_combNgType);           //DIST Mode
+	DDX_Control(pDX, IDC_COMBO_NG_TYPE_DIST2, m_combNgType2);           //DIST Mode
+
+	DDX_Text(pDX, IDC_EDIT_INC_DIST, m_incValue);
+	DDX_Text(pDX, IDC_EDIT_INC_DIST2, m_incValue2);
+}
+
+
+BEGIN_MESSAGE_MAP(CCornerDistSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_NOTIFY(NM_CLICK, IDC_LIST_DIST_DOT, &CCornerDistSetDlg::OnNMClickListDistDot)
+	ON_BN_CLICKED(IDC_BUTTON_MODEL_ROI, &CCornerDistSetDlg::OnBnClickedButtonModelRoi)
+	ON_BN_CLICKED(IDC_BUTTON_MEASURE_ROI, &CCornerDistSetDlg::OnBnClickedButtonMeasureRoi)
+	ON_BN_CLICKED(IDC_BUTTON_DIST_TEST_ALL, &CCornerDistSetDlg::OnBnClickedButtonDistTestAll)
+	ON_BN_CLICKED(IDC_BUTTON_LOCK_MARK_DIST, &CCornerDistSetDlg::OnBnClickedButtonLockMarkDist)
+	ON_BN_CLICKED(IDC_BUTTON_COPY_TOP_MARK_DIST, &CCornerDistSetDlg::OnBnClickedButtonCopyTopMarkDist)
+	ON_NOTIFY(NM_RCLICK, IDC_LIST_DIST_DOT, &CCornerDistSetDlg::OnNMRClickListDistDot)
+	ON_COMMAND(ID_VISION_DELETE, &CCornerDistSetDlg::OnVisionDelete)
+	ON_COMMAND(ID_ADD_DIST, &CCornerDistSetDlg::OnAddDist)
+	ON_COMMAND(ID_Menu_Measure_Set, &CCornerDistSetDlg::OnMenuMeasureSet)
+	ON_COMMAND(ID_EDITROI_DRAWKEYROI, &CCornerDistSetDlg::OnEditroiDrawkeyroi)
+	ON_COMMAND(ID_EDITROI_DRAWMEASUREROI, &CCornerDistSetDlg::OnEditroiDrawmeasureroi)
+	ON_COMMAND(ID_EDITROI_DELETEALLROI, &CCornerDistSetDlg::OnEditroiDeleteallroi)
+END_MESSAGE_MAP()
+
+
+// CDistCornerSetDlg 消息处理程序
+
+
+BOOL CCornerDistSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	//1. 窗体UI
+	InitWindUi();
+
+	ChangeVisionType(DIMENSION_NONE);
+
+	m_eDotIndex = -1;
+	ChangeCornerDotIdx(-1);
+
+	//3. 显示所有的参数
+	dispListParam();
+
+	LockImage(-1);
+	m_isLockPoint = TRUE;
+	LockMark(m_isLockPoint);
+
+	InitMenu();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CCornerDistSetDlg::InitWindUi(void) {
+	/* code */
+	InitPointUi();
+
+	m_combFrirtRefer.InsertString(0, _T("First Type"));
+	m_combFrirtRefer.InsertString(1, _T("Second Type"));
+	m_combFrirtRefer.InsertString(2, _T("Thrid Type"));
+	m_combFrirtRefer.InsertString(3, _T("Fourth Type"));
+	m_combFrirtRefer.SetCurSel(0);
+
+	m_combDistMode.InsertString(0, _T("false"));
+	m_combDistMode.InsertString(1, _T("Grind Size"));
+	m_combDistMode.InsertString(2, _T("Top Point"));
+	m_combDistMode.InsertString(3, _T("Bot Point"));
+	m_combDistMode.InsertString(4, _T("Key Dist"));
+	m_combDistMode.InsertString(5, _T("Cut Dist"));
+	m_combDistMode.SetCurSel(0);
+
+	m_combDistMode2.InsertString(0, _T("false"));
+	m_combDistMode2.InsertString(1, _T("Grind Size"));
+	m_combDistMode2.InsertString(2, _T("Top Point"));
+	m_combDistMode2.InsertString(3, _T("Bot Point"));
+	m_combDistMode2.InsertString(4, _T("Key Dist"));
+	m_combDistMode2.InsertString(5, _T("Cut Dist"));
+	m_combDistMode2.SetCurSel(0);
+
+	const CString ng_array_type[] = {
+		_T("Chip"),
+		_T("Broken"),
+		_T("Grind"),
+		_T("Dist Cut"),
+		_T("Corner Dist"),
+		_T("Unkown NG")
+	};
+	int ngNum = 6;
+	for (int i = 0; i < ngNum; i++) {
+		m_combNgType.InsertString(i, ng_array_type[i]);
+		m_combNgType2.InsertString(i, ng_array_type[i]);
+	}
+	m_combNgType.SetCurSel(2);
+	m_combNgType2.SetCurSel(3);
+
+	CString strCaption = _T("");
+	GetDlgItem(IDC_STATIC_DIST_RESULT_DIST)->SetWindowText(strCaption);
+	GetDlgItem(IDC_STATIC_DIST_RESULT_DIST2)->SetWindowText(strCaption);
+}
+
+void CCornerDistSetDlg::InitPointUi(void) {
+	/* code */
+	CRect rect;
+	m_listCornerPoint.GetClientRect(&rect);
+
+	// 为列表视图控件添加全行选中和栅格风格   
+	m_listCornerPoint.SetExtendedStyle(m_listCornerPoint.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_DOUBLEBUFFER);
+
+	// 为列表视图控件添加三列   
+	int nCount = 13;
+	m_listCornerPoint.InsertColumn(0, _T("ID"), LVCFMT_CENTER, rect.Width() / nCount, 0);
+	m_listCornerPoint.InsertColumn(1, _T("Name"), LVCFMT_CENTER, rect.Width() / nCount, 1);
+	m_listCornerPoint.InsertColumn(2, _T("Refer Index"), LVCFMT_CENTER, rect.Width() / nCount, 2);
+	m_listCornerPoint.InsertColumn(3, _T("X"), LVCFMT_CENTER, rect.Width() / nCount, 3);
+	m_listCornerPoint.InsertColumn(4, _T("Y"), LVCFMT_CENTER, rect.Width() / nCount, 4);
+	m_listCornerPoint.InsertColumn(5, _T("Pos+"), LVCFMT_CENTER, rect.Width() / nCount, 5);
+	m_listCornerPoint.InsertColumn(6, _T("Pos-"), LVCFMT_CENTER, rect.Width() / nCount, 6);
+	m_listCornerPoint.InsertColumn(7, _T("First Judge"), LVCFMT_CENTER, rect.Width() / nCount, 7);
+	m_listCornerPoint.InsertColumn(8, _T("Min1"), LVCFMT_CENTER, rect.Width() / nCount, 8);
+	m_listCornerPoint.InsertColumn(9, _T("Max1"), LVCFMT_CENTER, rect.Width() / nCount, 9);
+	m_listCornerPoint.InsertColumn(10, _T("Second Judge"), LVCFMT_CENTER, rect.Width() / nCount, 10);
+	m_listCornerPoint.InsertColumn(11, _T("Min2"), LVCFMT_CENTER, rect.Width() / nCount, 11);
+	m_listCornerPoint.InsertColumn(12, _T("Max2"), LVCFMT_CENTER, rect.Width() / nCount, 12);
+}
+
+
+void CCornerDistSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CCornerDistSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CCornerDistSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveDistCorner();
+
+	//2. 显示当前的数据
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getCornerDistProcess(eDir);
+	ShowDistCornerParam();
+
+	ChangeCornerDotIdx(-1);
+	int curIndex = m_eDotIndex;
+	ChangeCornerDotIdx(curIndex);
+
+	LockMark(TRUE);
+}
+
+void CCornerDistSetDlg::ShowDistCornerParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	m_topMark = m_dot->getPoint(0);
+	m_botMark = m_dot->getPoint(1);
+	m_topPoint = m_dot->getPoint(2);
+	m_botPoint = m_dot->getPoint(3);
+
+	UpdateData(FALSE);
+}
+
+void CCornerDistSetDlg::SaveDistCorner(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+}
+
+void CCornerDistSetDlg::ChangeCornerDotIdx(int eIdx) {
+	/* code */
+	SaveDistDotProcess();
+
+	if (eIdx == m_eDotIndex) {
+		return;
+	}
+
+	m_eDotIndex = eIdx;
+	m_dotDist = m_dot->getDot(eIdx);
+
+	ShowDistDotParam();
+	LockImage(-1);
+}
+
+void CCornerDistSetDlg::ShowDistDotParam(void) {
+	/* code */
+	if (-1 == m_eDotIndex) return;
+	if (NULL == m_dotDist) return;
+
+	m_combFrirtRefer.SetCurSel(m_dotDist->m_idxRefer);
+	m_strName = m_dotDist->m_strName;
+	m_pos = m_dotDist->getPose();
+
+	m_id = m_dotDist->getID();
+	m_refer = m_dotDist->m_nRef;
+	m_refer_ = m_dotDist->m_nRef_;
+
+	m_combDistMode.SetCurSel(m_dotDist->m_distMode);
+	m_minValue = m_dotDist->m_minValue;
+	m_maxValue = m_dotDist->m_maxValue;
+	m_combNgType.SetCurSel(m_dotDist->m_ngType - 1);
+	m_incValue = m_dotDist->m_incValue;
+
+	m_combDistMode2.SetCurSel(m_dotDist->m_distMode2);
+	m_minValue2 = m_dotDist->m_minValue2;
+	m_maxValue2 = m_dotDist->m_maxValue2;
+	m_combNgType2.SetCurSel(m_dotDist->m_ngType2 - 1);
+	m_incValue2 = m_dotDist->m_incValue2;
+
+	//保存参数
+	dispRegion();
+
+	UpdateData(FALSE);
+}
+
+void CCornerDistSetDlg::dispRegion(void) {
+	/* code */
+}
+
+void CCornerDistSetDlg::SaveDistDotProcess(void) {
+	/* code */
+	if (NULL == m_dotDist) return;
+
+	UpdateData(TRUE);
+
+	SaveDistCorner();
+
+	m_dotDist->m_idxRefer = m_combFrirtRefer.GetCurSel();
+	m_dotDist->m_strName = m_strName;
+	m_dotDist->m_nRef = m_refer;
+	m_dotDist->m_nRef_ = m_refer_;
+
+	m_dotDist->m_distMode = m_combDistMode.GetCurSel();
+	m_dotDist->m_minValue = m_minValue;
+	m_dotDist->m_maxValue = m_maxValue;
+	m_dotDist->m_ngType = m_combNgType.GetCurSel() + 1;
+	m_dotDist->m_incValue = m_incValue;
+
+	m_dotDist->m_distMode2 = m_combDistMode2.GetCurSel();
+	m_dotDist->m_minValue2 = m_minValue2;
+	m_dotDist->m_maxValue2 = m_maxValue2;
+	m_dotDist->m_ngType2 = m_combNgType2.GetCurSel() + 1;
+	m_dotDist->m_incValue2 = m_incValue2;
+
+	int nCount = m_listCornerPoint.GetItemCount();
+	int id = m_dotDist->getID();
+	std::vector<CDistDotProcess*> vDots = m_dot->getDots();
+
+	int nNum = (int)(vDots.size());
+	if (nCount != nNum) return; 
+
+	Point2I pose;
+	for (int index = 0; index < nCount; index++){
+		CDistDotProcess *pSelectDot = vDots.at(index);
+		if (NULL == pSelectDot) continue;
+		if (pSelectDot->getID() != id)  continue;
+		CDistDotProcess *dot = m_dotDist;
+		if (NULL == dot) return;
+		CString strText;
+		int i = index;
+		//0. ID值
+		strText.Format(_T("%d"), dot->getID());
+		m_listCornerPoint.SetItemText(i, 0, strText);
+
+		//1. 名称
+		strText = dot->m_strName;
+		m_listCornerPoint.SetItemText(i, 1, strText);
+
+		//2. Refer Type
+		strText = _T("First Type");
+		if (1 == dot->m_idxRefer) {
+			strText = _T("Second Type");
+		}
+		else if (2 == dot->m_idxRefer) {
+			strText = _T("Third Type");
+		}
+		else if (3 == dot->m_idxRefer) {
+			strText = _T("Fourth Type");
+		}
+		m_listCornerPoint.SetItemText(i, 2, strText);
+
+		//3. X
+		pose  = dot->getPose();
+		strText.Format(_T("%d"), pose.x);
+		m_listCornerPoint.SetItemText(i, 3, strText);
+
+		//4. Y
+		strText.Format(_T("%d"), pose.y);
+		m_listCornerPoint.SetItemText(i, 4, strText);
+
+		//5.ref
+		strText.Format(_T("%d"), dot->m_nRef);
+		m_listCornerPoint.SetItemText(i, 5, strText);
+
+		//6. ref_
+		strText.Format(_T("%d"), dot->m_nRef_);
+		m_listCornerPoint.SetItemText(i, 6, strText);
+
+		//7. Dist Mode
+		strText = _T("false");
+		if (1 == dot->m_distMode) {
+			strText = _T("Grind Size");
+		}
+		else if (2 == dot->m_distMode) {
+			strText = _T("Top Point");
+		}
+		else if (3 == dot->m_distMode) {
+			strText = _T("Bot Point");
+		}
+		else if (4 == dot->m_distMode) {
+			strText = _T("Key Dist");
+		}
+		else if (5 == dot->m_distMode) {
+			strText = _T("Cut Dist");
+		}
+		m_listCornerPoint.SetItemText(i, 7, strText);
+
+		//8. 邻近距离最小值
+		strText.Format(_T("%d"), dot->m_minValue);
+		m_listCornerPoint.SetItemText(i, 8, strText);
+
+		//9. 邻近距离最大值
+		strText.Format(_T("%d"), dot->m_maxValue);
+		m_listCornerPoint.SetItemText(i, 9, strText);
+
+		//10. Dist Mode
+		strText = _T("false");
+		if (1 == dot->m_distMode2) {
+			strText = _T("Grind Size");
+		}
+		else if (2 == dot->m_distMode2) {
+			strText = _T("Top Point");
+		}
+		else if (3 == dot->m_distMode2) {
+			strText = _T("Bot Point");
+		}
+		else if (4 == dot->m_distMode2) {
+			strText = _T("Key Dist");
+		}
+		else if (5 == dot->m_distMode2) {
+			strText = _T("Cut Dist");
+		}
+		m_listCornerPoint.SetItemText(i, 10, strText);
+
+		//11. 邻近距离最小值
+		strText.Format(_T("%d"), dot->m_minValue2);
+		m_listCornerPoint.SetItemText(i, 11, strText);
+
+		//12. 邻近距离最大值
+		strText.Format(_T("%d"), dot->m_maxValue2);
+		m_listCornerPoint.SetItemText(i, 12, strText);
+
+		break;
+	}
+}
+
+
+int CCornerDistSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+	dispListParam();
+	return 0;
+}
+
+void CCornerDistSetDlg::dispListParam(void) {
+	/* code */
+	m_listCornerPoint.DeleteAllItems();
+	if (NULL == m_dot)  return;
+
+	//1. 获取数据
+	std::vector<CDistDotProcess*> &vDots = m_dot->getDots();
+	int nCount = (int)(vDots.size());
+	if (nCount < 1) return;
+
+	CString strText;
+	Point2I pose;
+	for (int i = 0; i < nCount; i++) {
+		CDistDotProcess *dot = vDots.at(i); 
+		if (NULL == dot) continue;
+		//0. ID值
+		strText.Format(_T("%d"), dot->getID());
+		m_listCornerPoint.InsertItem(i, strText);
+
+		//1. 名称
+		strText = dot->m_strName;
+		m_listCornerPoint.SetItemText(i, 1, strText);
+
+		//2. Refer Type
+		strText = _T("First Type");
+		if (1 == dot->m_idxRefer) {
+			strText = _T("Second Type");
+		}
+		else if (2 == dot->m_idxRefer) {
+			strText = _T("Third Type");
+		}
+		else if (3 == dot->m_idxRefer) {
+			strText = _T("Fourth Type");
+		}
+		m_listCornerPoint.SetItemText(i, 2, strText);
+
+		//3. X
+		pose = dot->getPose();
+		strText.Format(_T("%d"), pose.x);
+		m_listCornerPoint.SetItemText(i, 3, strText);
+
+		//4. Y
+		strText.Format(_T("%d"), pose.y);
+		m_listCornerPoint.SetItemText(i, 4, strText);
+
+		//5.ref
+		strText.Format(_T("%d"), dot->m_nRef);
+		m_listCornerPoint.SetItemText(i, 5, strText);
+
+		//6. ref_
+		strText.Format(_T("%d"), dot->m_nRef_);
+		m_listCornerPoint.SetItemText(i, 6, strText);
+
+		//7. Dist Mode
+		strText = _T("false");
+		if (1 == dot->m_distMode) {
+			strText = _T("Grind Size");
+		}
+		else if (2 == dot->m_distMode) {
+			strText = _T("Top Point");
+		}
+		else if (3 == dot->m_distMode) {
+			strText = _T("Bot Point");
+		}
+		else if (4 == dot->m_distMode) {
+			strText = _T("Key Dist");
+		}
+		else if (5 == dot->m_distMode) {
+			strText = _T("Cut Dist");
+		}
+		m_listCornerPoint.SetItemText(i, 7, strText);
+
+		//8. 邻近距离最小值
+		strText.Format(_T("%d"), dot->m_minValue);
+		m_listCornerPoint.SetItemText(i, 8, strText);
+
+		//9. 邻近距离最大值
+		strText.Format(_T("%d"), dot->m_maxValue);
+		m_listCornerPoint.SetItemText(i, 9, strText);
+
+		//10. Dist Mode
+		strText = _T("false");
+		if (1 == dot->m_distMode2) {
+			strText = _T("Grind Size");
+		}
+		else if (2 == dot->m_distMode2) {
+			strText = _T("Top Point");
+		}
+		else if (3 == dot->m_distMode2) {
+			strText = _T("Bot Point");
+		}
+		else if (4 == dot->m_distMode2) {
+			strText = _T("Key Dist");
+		}
+		else if (5 == dot->m_distMode2) {
+			strText = _T("Cut Dist");
+		}
+		m_listCornerPoint.SetItemText(i, 10, strText);
+
+		//11. 邻近距离最小值
+		strText.Format(_T("%d"), dot->m_minValue2);
+		m_listCornerPoint.SetItemText(i, 11, strText);
+
+		//12. 邻近距离最大值
+		strText.Format(_T("%d"), dot->m_maxValue2);
+		m_listCornerPoint.SetItemText(i, 12, strText);
+	}
+}
+
+
+void CCornerDistSetDlg::OnNMClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
+	// TODO: 在此添加控件通知处理程序代码
+	NM_LISTVIEW  *plisCtrl = (NM_LISTVIEW *)pNMHDR;
+	CString strID = m_listCornerPoint.GetItemText(plisCtrl->iItem, 0);
+	int id = atoi(CW2A(strID.GetString()));
+	int eIdx = id;
+	ChangeCornerDotIdx(eIdx);
+
+	*pResult = 0;
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonModelRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonMeasureRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+}
+
+void CCornerDistSetDlg::LockImage(int nType) {
+	/* code */
+	if (1 == nType) {
+		GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(TRUE);
+		GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(FALSE);
+	}
+	else if (2 == nType) {
+		GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(TRUE);
+	}
+	else{
+		GetDlgItem(IDC_BUTTON_MODEL_ROI)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_MEASURE_ROI)->EnableWindow(FALSE);
+	}
+}
+
+void CCornerDistSetDlg::LockMark(BOOL isLock) {
+	/* code */
+	m_isLockPoint = isLock;
+	if (isLock) {
+		GetDlgItem(IDC_BUTTON_COPY_TOP_MARK_DIST)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_LOCK_MARK_DIST)->SetWindowTextW(L"Unlock");
+	}
+	else {
+		GetDlgItem(IDC_BUTTON_COPY_TOP_MARK_DIST)->EnableWindow(TRUE);
+		GetDlgItem(IDC_BUTTON_LOCK_MARK_DIST)->SetWindowTextW(L"Lock");
+	}
+}
+
+void CCornerDistSetDlg::InitMenu(void) {
+	/* code */
+	m_visionMenu.LoadMenu(IDR_MENU1);
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonDistTestAll()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveDistCorner();
+	SaveDistDotProcess();
+	if (nullptr == m_dot) return;
+
+	CString strCaption = _T("");
+	GetDlgItem(IDC_STATIC_DIST_RESULT_DIST)->SetWindowText(strCaption);
+	GetDlgItem(IDC_STATIC_DIST_RESULT_DIST2)->SetWindowText(strCaption);
+
+	m_dot->execute(m_eDir);
+
+	dispAllPointResult();
+}
+
+void CCornerDistSetDlg::dispAllPointResult(void) {
+	/* code */
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonLockMarkDist()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (m_isLockPoint) {
+		m_isLockPoint = FALSE;
+	}
+	else {
+		m_isLockPoint = TRUE;
+	}
+	LockMark(m_isLockPoint);
+}
+
+void CCornerDistSetDlg::OnBnClickedButtonCopyTopMarkDist()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return;
+
+	if (pSideData->m_bTopMark_Find) {
+		m_topMark.x = pSideData->m_mTopMark.x;
+		m_topMark.y = pSideData->m_mTopMark.y;
+		if (nullptr != m_dot) {
+			m_dot->setPoint(m_topMark, 0);
+		}
+	}
+
+	if (pSideData->m_bBotMark_Find) {
+		m_botMark.x = pSideData->m_mBotMark.x;
+		m_botMark.y = pSideData->m_mBotMark.y;
+		if (nullptr != m_dot) {
+			m_dot->setPoint(m_botMark, 1);
+		}
+	}
+
+	if (pSideData->m_bTopPoint_Find) {
+		m_topPoint = pSideData->m_mTopPoint;
+		if (nullptr != m_dot) {
+			m_dot->setPoint(m_topPoint, 2);
+		}
+	}
+
+	if (pSideData->m_bBotPoint_Find) {
+		m_botPoint = pSideData->m_mBotPoint;
+		if (nullptr != m_dot) {
+			m_dot->setPoint(m_botPoint, 3);
+		}
+	}
+
+	UpdateData(FALSE);
+}
+
+void CCornerDistSetDlg::OnNMRClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
+	// TODO: 在此添加控件通知处理程序代码
+
+	POINT pos; // pos1;
+	GetCursorPos(&pos);
+
+	CMenu *pDotMenu = m_visionMenu.GetSubMenu(0);
+	pDotMenu->TrackPopupMenu(TPM_LEFTALIGN, pos.x, pos.y, this);
+
+	*pResult = 0;
+}
+
+
+void CCornerDistSetDlg::OnVisionDelete()
+{
+	// TODO: 在此添加命令处理程序代码
+	if (NULL == m_dot) return;
+	if (NULL == m_dotDist) return;
+
+	int idDel = m_dotDist->getID();
+	int id = m_dot->delDot(idDel);
+	dispListParam();
+	//if (id < 0) {
+	//	m_dotDist = NULL;
+	//	return;
+	//}
+
+	//m_eCornerIndex = id;
+	//m_dotDist = m_dot->getDot((int)id);
+
+	//ShowDistDotParam();
+
+	//LockImage(TRUE);
+	//LocTop(TRUE);
+	//LockBot(TRUE);
+}
+
+
+void CCornerDistSetDlg::OnAddDist()
+{
+	// TODO: 在此添加命令处理程序代码
+	if (NULL == m_dot) return;
+
+	SaveDistCorner();
+	SaveDistDotProcess();
+
+	int id = m_dot->addDot();
+	dispListParam();
+	m_dotDist = m_dot->getDot(id);
+	m_eDotIndex = id;
+
+	ShowDistDotParam();
+	LockImage(-1);
+}
+
+void CCornerDistSetDlg::OnMenuMeasureSet()
+{
+	// TODO: 在此添加命令处理程序代码
+	if (NULL == m_dot) return;
+
+	CMeasureSetDlg dlg;
+	dlg.SetDot(m_dot);
+	dlg.DoModal();
+}
+
+
+void CCornerDistSetDlg::OnEditroiDrawkeyroi()
+{
+	// TODO: 在此添加命令处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+
+	LockImage(1);
+}
+
+
+void CCornerDistSetDlg::OnEditroiDrawmeasureroi()
+{
+	// TODO: 在此添加命令处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+
+	LockImage(2);
+}
+
+
+void CCornerDistSetDlg::OnEditroiDeleteallroi()
+{
+	// TODO: 在此添加命令处理程序代码
+	if (nullptr == m_dotDist)  return;
+
+	HalconCpp::HObject hRegion;
+	HalconCpp::GenEmptyObj(&hRegion);
+	m_dotDist->setRoiRegion(hRegion);
+	m_dotDist->setLineRegion(hRegion);
+
+	dispRegion();
+	dispListParam();
+	ShowDistDotParam();
+}
diff --git a/Common_Class/BlVisionPro/View/CornerDistSetDlg.h b/Common_Class/BlVisionPro/View/CornerDistSetDlg.h
new file mode 100644
index 0000000..3875c7b
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/CornerDistSetDlg.h
@@ -0,0 +1,135 @@
+#pragma once
+
+
+// CCornerDistSetDlg 对话框
+#include "VisionRecipe.h"
+#include "afxwin.h"
+
+enum CORNER_IMAGE_TYPE { 
+	CORNER_IMAGE = 0, 
+	CORNER_MEASURE_REGION, 
+	CORNER_TOP_POINT,
+	CORNER_BOT_POINT
+};
+
+class CCornerDistSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CCornerDistSetDlg)
+
+public:
+	CCornerDistSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CCornerDistSetDlg();
+
+	// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DLG_DIST_CORNER };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	CListCtrl m_listCornerPoint;
+	CCornerDistProcess *m_dot;
+	CDistDotProcess *m_dotDist;
+
+
+	CComboBox m_combFrirtRefer;          //First Refer
+
+	Point2I m_topMark;
+	Point2I m_botMark;
+	Point2I m_topPoint;
+	Point2I m_botPoint;
+
+	int m_id;
+	CString m_strName;
+	Point2I m_pos;
+	int m_refer;
+	int m_refer_;
+
+	CComboBox m_combDistMode;
+	int m_minValue;
+	int m_maxValue;
+	int m_incValue;
+
+	CComboBox m_combDistMode2;
+	int m_minValue2;
+	int m_maxValue2;
+	int m_incValue2;
+
+	//
+	DimensionDir m_eDir;
+	int m_eDotIndex;
+
+	CMenu m_visionMenu;
+
+	CComboBox m_combNgType;
+	CComboBox m_combNgType2;
+
+private:
+	BOOL m_isLockPoint;
+
+private:
+	//1. 显示所有的参数
+	void dispListParam(void);
+
+	//2. 初始化点位界面
+	void InitPointUi(void);
+
+	//4. 初始化UI界面
+	void InitWindUi(void);
+
+	//5. 执行
+	void ChangeVisionType(DimensionDir eDir);
+
+	//6. 执行
+	void ChangeCornerDotIdx(int eIdx);
+
+	//7. 保存数据
+	void SaveDistCorner(void);
+
+	//8. 显示当前的数据
+	void ShowDistCornerParam(void);
+
+	//9. 保存数据
+	void SaveDistDotProcess(void);
+
+	//10. 显示当前的视觉参数
+	void ShowDistDotParam(void);
+
+	//11. 显示区域
+	void dispRegion(void);
+
+	//12. 锁操作
+	void LockImage(int nType);
+
+	//14. 显示所有的所有的视觉检测点
+	void dispAllPointResult(void);
+
+	//17. 枷锁MARK
+	void LockMark(BOOL isLock);
+
+	//18. 初始化菜单
+	void InitMenu(void);
+
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	int setDimensionDir(DimensionDir eDir);
+	afx_msg void OnNMClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnBnClickedButtonModelRoi();
+	afx_msg void OnBnClickedButtonMeasureRoi();
+	afx_msg void OnBnClickedButtonDistTestAll();
+	afx_msg void OnBnClickedButtonLockMarkDist();
+	afx_msg void OnBnClickedButtonCopyTopMarkDist();
+	afx_msg void OnNMRClickListDistDot(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnVisionDelete();
+	afx_msg void OnAddDist();
+	afx_msg void OnMenuMeasureSet();
+	afx_msg void OnEditroiDrawkeyroi();
+	afx_msg void OnEditroiDrawmeasureroi();
+	afx_msg void OnEditroiDeleteallroi();
+};
diff --git a/Common_Class/BlVisionPro/View/CutSetDlg.cpp b/Common_Class/BlVisionPro/View/CutSetDlg.cpp
new file mode 100644
index 0000000..e643718
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/CutSetDlg.cpp
@@ -0,0 +1,387 @@
+// CutSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "CutSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+
+
+// CCutSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CCutSetDlg, CDialogEx)
+
+CCutSetDlg::CCutSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_CUTLINE_SET, pParent)
+{
+	/* code */
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+}
+
+CCutSetDlg::~CCutSetDlg(){
+	/* code */
+	m_vParams.clear();
+}
+
+void CCutSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_PANEL_CUTLINE_INFO_CUT, m_PanelCutLine);
+}
+
+
+BEGIN_MESSAGE_MAP(CCutSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_CUT, &CCutSetDlg::OnBnClickedButtonProcessCut)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_CUT, &CCutSetDlg::OnBnClickedButtonSaveCut)
+END_MESSAGE_MAP()
+
+
+// CCutSetDlg 消息处理程序
+
+
+BOOL CCutSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	m_eDir = DIMENSION_NONE;
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CCutSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. Name
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. Use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. Pos Type
+	strText = _T("Pos Type");
+	m_vParams.push_back(strText);
+	//5. line thres
+	strText = _T("line thres");
+	m_vParams.push_back(strText);
+	//6. Pos Y
+	strText = _T("Top Y(um)");
+	m_vParams.push_back(strText);
+	//7. Pos X
+	strText = _T("Std Dist(um)");
+	m_vParams.push_back(strText);
+	// 8.Inc
+	strText = _T("Inc(um)");
+	m_vParams.push_back(strText);
+	// 9.Min
+	strText = _T("Min(um)");
+	m_vParams.push_back(strText);
+	// 10.Max
+	strText = _T("Max(um)");
+	m_vParams.push_back(strText);
+	// 11.Result
+	strText = _T("Result(um)");
+	m_vParams.push_back(strText);
+
+	int nRows = 51;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelCutLine.DeleteAllItems();
+	m_PanelCutLine.SetVirtualMode(FALSE);
+	m_PanelCutLine.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelCutLine.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelCutLine.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelCutLine.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelCutLine.SetRowCount(nRows);
+	m_PanelCutLine.SetColumnCount(nCols);
+	m_PanelCutLine.SetFixedRowCount(nFixRows);
+	m_PanelCutLine.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelCutLine.GetFont();
+	if (pFont){
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelCutLine.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelCutLine.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelCutLine.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelCutLine.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelCutLine.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelCutLine.SetColumnWidth(nColIdx, 50);
+		}
+		else {
+			m_PanelCutLine.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelCutLine.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++)
+	{
+		m_PanelCutLine.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+
+void CCutSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CCutSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CCutSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveCutLineParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getCutProcess(eDir);
+
+	ShowCutLineParam();
+}
+
+void CCutSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+}
+
+
+void CCutSetDlg::OnBnClickedButtonProcessCut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveCutLineParam();
+
+	if (NULL == m_dot) return;
+
+	m_dot->Execute(m_eDir);
+
+	DispAllResult();
+}
+
+void CCutSetDlg::DispAllResult(void) {
+	/* code */
+	int nCount = 50;
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelCutLine.SetItemText(id, 10, _T("NAN"));
+		}
+		else{   //显示结果
+			CString strResult;
+			strResult.Format(_T("%.1f"), dot->m_distResult);
+			int id = dot->getID();
+			m_PanelCutLine.SetItemText(id, 10, strResult);
+		}
+	}
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	m_PanelCutLine.Invalidate(FALSE);
+}
+
+void CCutSetDlg::SaveCutLineParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+	{   
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_CUT));
+		int iUse = pBtnUse->GetCheck();
+		m_dot->m_isUse = (1 == iUse);
+	}
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		idx += 1;
+		
+		//2. Use Name
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. ID
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_poseType = _wtoi(strText);
+		idx += 1;
+
+		//5. line thres
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nEdgeThres = _wtoi(strText);
+		idx += 1;
+
+		//6. Pos Y
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nPosY = _wtoi(strText);
+		idx += 1;
+
+		//7. Pos X
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nPosX = _wtoi(strText);
+		idx += 1;
+
+		//8. Inc
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nInc = _wtoi(strText);
+		idx += 1;
+
+		//9. Min
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nMin = _wtoi(strText);
+		idx += 1;
+
+		//10. Max
+		strText = m_PanelCutLine.GetItemText(idRow, idx);
+		dot->m_nMax = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+void CCutSetDlg::ShowCutLineParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_CUT));
+		int iUse = 0;
+		if (m_dot->m_isUse)  iUse = 1;
+		pBtnUse->SetCheck(iUse);
+	}
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Pose Type
+		strText.Format(_T("%d"), dot->m_poseType);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. line thres
+		strText.Format(_T("%d"), dot->m_nEdgeThres);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Pos Y
+		strText.Format(_T("%d"), dot->m_nPosY);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+		
+		//7. Pos X
+		strText.Format(_T("%d"), dot->m_nPosX);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Inc
+		strText.Format(_T("%d"), dot->m_nInc);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Min
+		strText.Format(_T("%d"), dot->m_nMin);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Max
+		strText.Format(_T("%d"), dot->m_nMax);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//11. Result
+		strText.Format(_T("%.1f"), dot->m_distResult);
+		m_PanelCutLine.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+void CCutSetDlg::OnBnClickedButtonSaveCut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveCutLineParam();
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/View/CutSetDlg.h b/Common_Class/BlVisionPro/View/CutSetDlg.h
new file mode 100644
index 0000000..0cb39e8
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/CutSetDlg.h
@@ -0,0 +1,55 @@
+#pragma once
+
+#include "CutProcess.h"
+// CCutSetDlg 对话框
+
+class CCutSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CCutSetDlg)
+
+public:
+	CCutSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CCutSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum {
+		IDD = IDD_DIALOG_CUTLINE_SET
+};
+#endif
+
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	DimensionDir m_eDir;
+	CGridCtrl	m_PanelCutLine;
+	std::vector<CString> m_vParams;
+	CCutProcess *m_dot;
+
+private:
+	//1. 初始化
+	void InitPanel(void);
+
+	//2. 保存数据
+	void SaveCutLineParam(void);
+
+	//3. 显示参数
+	void ShowCutLineParam(void);
+
+	//4. 显示结果
+	void DispAllResult(void);
+
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	void ChangeVisionType(DimensionDir eDir);
+	void setDimensionDir(DimensionDir eDir);
+
+	afx_msg void OnBnClickedButtonProcessCut();
+	afx_msg void OnBnClickedButtonSaveCut();
+};
diff --git a/Common_Class/BlVisionPro/View/GrindSetDlg.cpp b/Common_Class/BlVisionPro/View/GrindSetDlg.cpp
new file mode 100644
index 0000000..82da2f9
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/GrindSetDlg.cpp
@@ -0,0 +1,386 @@
+// GrindSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "GrindSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+
+
+// CGrindSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CGrindSetDlg, CDialogEx)
+
+CGrindSetDlg::CGrindSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_GRIND_SET, pParent)
+	, m_nLeftLineDist(0)
+	, m_nLeftThres(20)
+{
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+}
+
+CGrindSetDlg::~CGrindSetDlg()
+{
+}
+
+void CGrindSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_PANEL_GRIND_INFO, m_PanelGrind);
+
+	DDX_Text(pDX, IDC_EDIT_LEFT_LINE_DISTANCE, m_nLeftLineDist);
+	DDX_Text(pDX, IDC_EDIT_LEFT_LINE_THRES_GRIND, m_nLeftThres);
+}
+
+
+BEGIN_MESSAGE_MAP(CGrindSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_GRIND, &CGrindSetDlg::OnBnClickedButtonProcessGrind)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_GRIND, &CGrindSetDlg::OnBnClickedButtonSaveGrind)
+END_MESSAGE_MAP()
+
+
+// CGrindSetDlg 消息处理程序
+
+
+BOOL CGrindSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+void CGrindSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+//	SaveGrindParam();
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CGrindSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	m_eDir = DIMENSION_NONE;
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CGrindSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. Name
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. Pose Type
+	strText = _T("Pos Type");
+	m_vParams.push_back(strText);
+	//5. Pose Y
+	strText = _T("Top Y(um)");
+	m_vParams.push_back(strText);
+	//6. End Thres
+	strText = _T("End Thres");
+	m_vParams.push_back(strText);
+	// 7. Inc
+	strText = _T("Inc(um)");
+	m_vParams.push_back(strText);
+	// 8.Min
+	strText = _T("Min(um)");
+	m_vParams.push_back(strText);
+	// 9.Min
+	strText = _T("Max(um)");
+	m_vParams.push_back(strText);
+	// 10.Result
+	strText = _T("Result(um)");
+	m_vParams.push_back(strText);
+
+	int nRows = 51;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelGrind.DeleteAllItems();
+	m_PanelGrind.SetVirtualMode(FALSE);
+	m_PanelGrind.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelGrind.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelGrind.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelGrind.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelGrind.SetRowCount(nRows);
+	m_PanelGrind.SetColumnCount(nCols);
+	m_PanelGrind.SetFixedRowCount(nFixRows);
+	m_PanelGrind.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelGrind.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelGrind.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelGrind.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelGrind.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelGrind.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelGrind.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelGrind.SetColumnWidth(nColIdx, 50);
+		}
+		else {
+			m_PanelGrind.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelGrind.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++){
+		m_PanelGrind.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CGrindSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+}
+
+void CGrindSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveGrindParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getGrindProcess(eDir);
+
+	ShowGrindParam();
+}
+
+void CGrindSetDlg::SaveGrindParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_GRIND));
+		int iUse = pBtnUse->GetCheck();
+		m_dot->m_isUse = (1 == iUse);
+	}
+
+	m_dot->m_nLeftLineDist = m_nLeftLineDist;
+	m_dot->m_nLeftThres = m_nLeftThres;
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. Use
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_poseType = _wtoi(strText);
+		idx += 1;
+
+		//5. Pose Y
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nPosY = _wtoi(strText);
+		idx += 1;
+
+		//6. Edge Pose
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nEdgeThres = _wtoi(strText);
+		idx += 1;
+
+		//7. Inc
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nInc = _wtoi(strText);
+		idx += 1;
+
+		//8. Min
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nMin = _wtoi(strText);
+		idx += 1;
+
+		//9. Max
+		strText = m_PanelGrind.GetItemText(idRow, idx);
+		dot->m_nMax = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+
+void CGrindSetDlg::ShowGrindParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_GRIND));
+		int iUse = 0;
+		if (m_dot->m_isUse)  iUse = 1;
+		pBtnUse->SetCheck(iUse);
+	}
+
+	m_nLeftLineDist = m_dot->m_nLeftLineDist;
+	m_nLeftThres = m_dot->m_nLeftThres;
+
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText.Format(_T("%d"), dot->m_poseType);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Pose Y
+		strText.Format(_T("%d"), dot->m_nPosY);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Edge Pose
+		strText.Format(_T("%d"), dot->m_nEdgeThres);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. Inc
+		strText.Format(_T("%d"), dot->m_nInc);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Min
+		strText.Format(_T("%d"), dot->m_nMin);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Max
+		strText.Format(_T("%d"), dot->m_nMax);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Result
+		strText.Format(_T("%.1f"), dot->m_distResult);
+		m_PanelGrind.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+void CGrindSetDlg::OnBnClickedButtonProcessGrind()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveGrindParam();
+
+	if (NULL == m_dot) return;
+
+	m_dot->Execute(m_eDir);
+
+	DispAllResult();
+}
+
+void CGrindSetDlg::DispAllResult(void) {
+	/* code */
+	int nCount = 50;
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelGrind.SetItemText(id, 9, _T("NAN"));
+		}
+		else{   //显示结果
+			CString strResult;
+			strResult.Format(_T("%.1f"), dot->m_distResult);
+			int id = dot->getID();
+			m_PanelGrind.SetItemText(id, 9, strResult);
+		}
+	}
+
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	m_PanelGrind.Invalidate(FALSE);
+}
+
+
+void CGrindSetDlg::OnBnClickedButtonSaveGrind()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveGrindParam(); 
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/View/GrindSetDlg.h b/Common_Class/BlVisionPro/View/GrindSetDlg.h
new file mode 100644
index 0000000..6a92871
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/GrindSetDlg.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include "GrindProcess.h"
+// CGrindSetDlg 对话框
+
+class CGrindSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CGrindSetDlg)
+
+public:
+	CGrindSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CGrindSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_GRIND_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	DimensionDir m_eDir;
+	CGridCtrl	m_PanelGrind;
+	std::vector<CString> m_vParams;
+	CGrindProcess *m_dot;
+
+	int m_nLeftLineDist;
+	int m_nLeftThres;
+
+private:
+	void InitPanel(void);
+
+	//2. 保存数据
+	void SaveGrindParam(void);
+
+	//3. 显示参数
+	void ShowGrindParam(void);
+
+	//4. 显示区域
+	void DispAllResult(void);
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnClose();
+	virtual BOOL OnInitDialog();
+	void ChangeVisionType(DimensionDir eDir);
+	void setDimensionDir(DimensionDir eDir);
+
+	afx_msg void OnBnClickedButtonProcessGrind();
+	afx_msg void OnBnClickedButtonSaveGrind();
+};
diff --git a/Common_Class/BlVisionPro/View/HoleSetDlg.cpp b/Common_Class/BlVisionPro/View/HoleSetDlg.cpp
new file mode 100644
index 0000000..94b211f
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/HoleSetDlg.cpp
@@ -0,0 +1,483 @@
+// HoleSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "HoleSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+
+// CHoleSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CHoleSetDlg, CDialogEx)
+
+CHoleSetDlg::CHoleSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_HOLE_INSPECT, pParent)
+{
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+	m_display = NULL;
+}
+
+CHoleSetDlg::~CHoleSetDlg()
+{
+}
+
+void CHoleSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_PANEL_HOLE_INFO, m_PanelHole);
+}
+
+
+BEGIN_MESSAGE_MAP(CHoleSetDlg, CDialogEx)
+	ON_WM_DESTROY()
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_PROCESS, &CHoleSetDlg::OnBnClickedButtonHoleProcess)
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_SAVE, &CHoleSetDlg::OnBnClickedButtonHoleSave)
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_UP_IMAGE, &CHoleSetDlg::OnBnClickedButtonHoleUpImage)
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_CHANGE_SHOW, &CHoleSetDlg::OnBnClickedButtonHoleChangeShow)
+	ON_BN_CLICKED(IDC_BUTTON_HOLE_DEL_IMAGE, &CHoleSetDlg::OnBnClickedButtonHoleDelImage)
+END_MESSAGE_MAP()
+
+
+// CHoleSetDlg 消息处理程序
+
+
+void CHoleSetDlg::OnDestroy()
+{
+	CDialogEx::OnDestroy();
+
+	// TODO: 在此处添加消息处理程序代码
+	if (nullptr != m_display) {
+		m_display->CloseWindow();
+		ClsDisplay_Free(m_display);
+		m_display = nullptr;
+	}
+}
+
+
+BOOL CHoleSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	InitDisplay();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+
+BOOL CHoleSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CHoleSetDlg::InitDisplay(void) {
+	/* code */
+	m_display = ClsDisplay_Create();
+	if (nullptr != m_display) {
+		CRect rect;
+		CWnd* pDispWnd = GetDlgItem(IDC_STATIC_HOLE_IMG);
+		pDispWnd->GetWindowRect(rect);
+		m_display->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_display->SetOperFlag(DEFAULT_OPER_FLAG);
+		m_display->SetDraw("fill", DISP_OBJECT);
+		m_display->SetColor("red", DISP_OBJECT);
+
+		m_display->SetDraw("margin", DISP_REGION);
+		std::string color = ClsVision::Rgb2Color(0, 255, 0);
+		m_display->SetColor(color, DISP_REGION);
+
+		m_display->SetDraw("margin", DISP_CROSS);
+		color = ClsVision::Rgb2Color(255, 0, 0);
+		m_display->SetColor(color, DISP_CROSS);
+
+		m_display->SetDraw("fill", DISP_SELECT);
+		m_display->SetColor("yellow", DISP_SELECT);
+		color = ClsVision::Rgb2Color(0, 0, 100);
+		m_display->SetBackgroundColor(color);
+	}
+}
+
+int CHoleSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+	return 0;
+}
+
+void CHoleSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveHoleParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getHoleProcess(m_eDir);
+
+	ShowHoleParam();
+}
+
+void CHoleSetDlg::ShowHoleParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	CString strText;
+	for (int i = 0; i < 4; i++) {
+		CHoleDotProcess* dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->GetID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->GetID());
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText.Format(_T("%d"), dot->m_nPoseType);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Shape Type
+		strText.Format(_T("%d"), dot->m_nShapeType);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Bright Type
+		strText.Format(_T("%d"), dot->m_nBrightType);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. Thres
+		strText.Format(_T("%d"), dot->m_nThres);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Smooth Size
+		strText.Format(_T("%d"), dot->m_nSmoothSize);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Defect Size
+		strText.Format(_T("%d"), dot->m_nDefectSize);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Result
+		int ngNum = (int)(dot->m_nNgInfo.size());
+		strText.Format(_T("%d"), ngNum);
+		m_PanelHole.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+
+	ShowHoleImage();
+}
+
+void CHoleSetDlg::SaveHoleParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+	CString strText;
+	for (int i = 0; i < 4; i++) {
+		CHoleDotProcess* dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->GetID();
+		int idx = 0;
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. Use
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4.Pos Type
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nPoseType = _wtoi(strText);
+		idx += 1;
+
+		//5. Shape Type
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nShapeType = _wtoi(strText);
+		idx += 1;
+
+		//6. Bright Type
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nBrightType = _wtoi(strText);
+		idx += 1;
+
+		//7. Thres
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nThres = _wtoi(strText);
+		idx += 1;
+
+		//8. Smooth Size
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nSmoothSize = _wtoi(strText);
+		idx += 1;
+
+		//9. Defect Size
+		strText = m_PanelHole.GetItemText(idRow, idx);
+		dot->m_nDefectSize = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+void CHoleSetDlg::OnBnClickedButtonHoleProcess()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (nullptr == m_dot)  return;
+
+	m_dot->Execute(m_eDir);
+}
+
+void CHoleSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. useName
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. useName
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. Pos Type
+	strText = _T("Pos Type");
+	m_vParams.push_back(strText);
+	//5. Shape Type
+	strText = _T("Shape Type");
+	m_vParams.push_back(strText);
+	//6. Bright Type
+	strText = _T("Bright Type");
+	m_vParams.push_back(strText);
+	//7. Thres
+	strText = _T("Thres");
+	m_vParams.push_back(strText);
+	//8. Smooth
+	strText = _T("Smooth Size");
+	m_vParams.push_back(strText);
+	// 9. Defect Size
+	strText = _T("Defect Size");
+	m_vParams.push_back(strText);
+	// 10.Result
+	strText = _T("Result");
+	m_vParams.push_back(strText);
+
+	int nRows = 5;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelHole.DeleteAllItems();
+	m_PanelHole.SetVirtualMode(FALSE);
+	m_PanelHole.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelHole.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelHole.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelHole.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelHole.SetRowCount(nRows);
+	m_PanelHole.SetColumnCount(nCols);
+	m_PanelHole.SetFixedRowCount(nFixRows);
+	m_PanelHole.SetFixedColumnCount(nFixCols);
+
+	CFont* pFont = m_PanelHole.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelHole.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelHole.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelHole.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelHole.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelHole.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelHole.SetColumnWidth(nColIdx, 50);
+		}
+		else {
+			m_PanelHole.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelHole.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++) {
+		m_PanelHole.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+
+void CHoleSetDlg::OnBnClickedButtonHoleSave()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveHoleParam();
+	ShowHoleImage();
+}
+
+
+void CHoleSetDlg::OnBnClickedButtonHoleUpImage()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CCellID selCell = m_PanelHole.GetFocusCell();
+	int id = 1;
+	if (selCell.IsValid()) {
+		id = selCell.row;
+	}
+	if (id < 1 || id > 4) return;
+	CHoleDotProcess * dot = m_dot->m_dots[id - 1];
+	if (nullptr == dot) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	//截图
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	Point2I ptCenter;
+	ptCenter.x = (int)(1.0f * (x1 + x2) / 2 + 0.5f);
+	ptCenter.y = (int)(1.0f * (y1 + y2) / 2 + 0.5f);
+	Point2I ptStd, ptTop, ptBot;
+	if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir, ptCenter, ptStd, ptTop, ptBot)) return;
+
+	dot->SetPose(ptStd.x, ptStd.y);
+	dot->SetImage(hImage);
+
+	ShowHoleImage();
+}
+
+void CHoleSetDlg::ShowHoleImage(void) {
+	/* code */
+	if (nullptr == m_dot)  return;
+
+	CCellID selCell = m_PanelHole.GetFocusCell();
+	int id = 1;
+	if (selCell.IsValid()) {
+		id = selCell.row;
+	}
+	if (id < 1 || id > 4) return;
+	CHoleDotProcess* dot = m_dot->m_dots[id - 1];
+	if (nullptr == dot) return;
+
+	HalconCpp::HObject& hImage = dot->GetImage();
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) {
+		HalconCpp::GenEmptyObj(&m_display->GetImage());
+		HalconCpp::GenEmptyObj(&m_display->GetRegion());
+		HalconCpp::GenEmptyObj(&m_display->GetCross());
+		m_display->ClearWindow();
+		m_display->DispImage();
+		return;
+	}
+
+	HalconCpp::HObject hRegion, hRoiRegion;
+	int offset = dot->m_nSmoothSize;
+	HalconCpp::GenEllipse(&hRegion, 0.5 * (height-1), 0.5 * (width-1), 0, 0.5 * width, 0.5 * height);
+	HalconCpp::GenEllipse(&hRoiRegion, 0.5 * (height - 1), 0.5 * (width - 1), 0, 0.5 * width - offset, 0.5 * height - offset);
+	m_display->SetRegion(hRoiRegion);
+	m_display->SetCross(hRegion);
+
+	m_display->AutoWindowSize(width, height);
+	m_display->SetImage(hImage);
+	m_display->DispImage();
+	m_display->DispCross();
+	m_display->DispRegion();
+}
+
+
+
+void CHoleSetDlg::OnBnClickedButtonHoleChangeShow()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	ShowHoleImage();
+}
+
+
+void CHoleSetDlg::OnBnClickedButtonHoleDelImage()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (nullptr == m_dot)  return;
+
+	CCellID selCell = m_PanelHole.GetFocusCell();
+	if (!selCell.IsValid()) return;
+	int id = selCell.row;
+	if (id < 1 || id > 4) return;
+	CHoleDotProcess* dot = m_dot->m_dots[id - 1];
+	if (nullptr == dot) return;
+
+	HalconCpp::HObject& hImage = dot->GetImage();
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	HalconCpp::HObject hNilImage;
+	HalconCpp::GenEmptyObj(&hNilImage);
+	dot->SetImage(hNilImage);
+
+	ShowHoleImage();
+}
diff --git a/Common_Class/BlVisionPro/View/HoleSetDlg.h b/Common_Class/BlVisionPro/View/HoleSetDlg.h
new file mode 100644
index 0000000..7770dfa
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/HoleSetDlg.h
@@ -0,0 +1,64 @@
+#pragma once
+
+
+// CHoleSetDlg 对话框
+#include "HoleProcess.h"
+
+class CHoleSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CHoleSetDlg)
+
+public:
+	CHoleSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CHoleSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_HOLE_INSPECT };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnDestroy();
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnBnClickedButtonHoleProcess();
+
+	//1. 设置edir
+	int setDimensionDir(DimensionDir eDir);
+
+private:
+	CGridCtrl m_PanelHole;
+	std::vector<CString> m_vParams;
+	DimensionDir m_eDir;
+	CHoleProcess* m_dot;
+	IClsDisplay* m_display;
+
+private:
+	//1. 初始化Panel
+    void InitPanel(void);
+
+	//2. 修改算法
+	void ChangeVisionType(DimensionDir eDir);
+
+	//3. 保存参数
+	void SaveHoleParam(void);
+
+	//4. 显示参数
+	void ShowHoleParam(void);
+
+	//5. 初始化
+	void InitDisplay(void);
+
+	//6. 显示图像
+	void ShowHoleImage(void);
+	
+public:
+	afx_msg void OnBnClickedButtonHoleSave();
+	afx_msg void OnBnClickedButtonHoleUpImage();
+	afx_msg void OnBnClickedButtonHoleChangeShow();
+	afx_msg void OnBnClickedButtonHoleDelImage();
+};
diff --git a/Common_Class/BlVisionPro/View/KDistSetDlg.cpp b/Common_Class/BlVisionPro/View/KDistSetDlg.cpp
new file mode 100644
index 0000000..8dd20d3
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/KDistSetDlg.cpp
@@ -0,0 +1,472 @@
+// KDistSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "KDistSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+
+
+// CKDistSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CKDistSetDlg, CDialogEx)
+
+CKDistSetDlg::CKDistSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_DIST_SET, pParent)
+{
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+	m_nStage = -1;
+}
+
+CKDistSetDlg::~CKDistSetDlg()
+{
+	/* code */
+}
+
+void CKDistSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_PANEL_CUT_INFO, m_PanelKeyDist);
+	DDX_Text(pDX, IDC_EDIT_STAGE, m_nStage);
+}
+
+
+BEGIN_MESSAGE_MAP(CKDistSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_KDIST, &CKDistSetDlg::OnBnClickedButtonProcessKdist)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_KDIST, &CKDistSetDlg::OnBnClickedButtonSaveKdist)
+	ON_BN_CLICKED(IDC_BUTTON_SET_STAGE, &CKDistSetDlg::OnBnClickedButtonSetStage)
+END_MESSAGE_MAP()
+
+
+// CKDistSetDlg 消息处理程序
+
+
+BOOL CKDistSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+void CKDistSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CKDistSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	if (nullptr != pRecipe) {
+		m_nStage = pRecipe->getStage();
+	}
+	SetDlgItemInt(IDC_EDIT_STAGE, m_nStage);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CKDistSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. useName
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. useName
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. Pos Type
+	strText = _T("Pos Type");
+	m_vParams.push_back(strText);
+	//5. Key X
+	strText = _T("Key X(um)");
+	m_vParams.push_back(strText);
+	//6. Key Y
+	strText = _T("Key Y(um)");
+	m_vParams.push_back(strText);
+	//7. Pos X
+	strText = _T("Pos X(um)");
+	m_vParams.push_back(strText);
+	//8. Pos Y
+	strText = _T("Pos Y(um)");
+	m_vParams.push_back(strText);
+	//9. End Type
+	strText = _T("Edge Thres");
+	m_vParams.push_back(strText);
+	//10. ROI Width
+	strText = _T("Std(um)");
+	m_vParams.push_back(strText);
+	// 11. Inc
+	strText = _T("Inc(um)");
+	m_vParams.push_back(strText);
+	//12. Inc1
+	strText = _T("Inc1(um)");
+	m_vParams.push_back(strText);
+	// 13.Min
+	strText = _T("Min(um)");
+	m_vParams.push_back(strText);
+	// 14.MAX
+	strText = _T("Max(um)");
+	m_vParams.push_back(strText);
+	// 15.Result
+	strText = _T("Result(um)");
+	m_vParams.push_back(strText);
+
+	int nRows = 51;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelKeyDist.DeleteAllItems();
+	m_PanelKeyDist.SetVirtualMode(FALSE);
+	m_PanelKeyDist.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelKeyDist.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelKeyDist.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelKeyDist.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelKeyDist.SetRowCount(nRows);
+	m_PanelKeyDist.SetColumnCount(nCols);
+	m_PanelKeyDist.SetFixedRowCount(nFixRows);
+	m_PanelKeyDist.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelKeyDist.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelKeyDist.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelKeyDist.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelKeyDist.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelKeyDist.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelKeyDist.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelKeyDist.SetColumnWidth(nColIdx, 50);
+		}
+		else {
+			m_PanelKeyDist.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelKeyDist.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++){
+		m_PanelKeyDist.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CKDistSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+}
+
+void CKDistSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveKDistParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getKDistProcess(eDir);
+
+	ShowKDistParam();
+}
+
+void CKDistSetDlg::SaveKDistParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_KDIST));
+		int iUse = pBtnUse->GetCheck();
+		m_dot->m_isUse = (1 == iUse);
+
+		int nValue = GetDlgItemInt(IDC_EDIT_ROI_LENGTH_SIZE_DIST);
+        m_dot->m_nRoiSize = nValue;
+	}
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. Use
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4.Pos Type
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_poseType = _wtoi(strText);
+		idx += 1;
+
+		//5. Key X
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_keyPoseX = _wtoi(strText);
+		idx += 1;
+
+		//6. Key Y
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_keyPoseY = _wtoi(strText);
+		idx += 1;
+
+		//7. Pos X
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nPosX = _wtoi(strText);
+		idx += 1;
+
+		//8. Pos Y
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nPosY = _wtoi(strText);
+		idx += 1;
+
+		//9. End Type
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nEndThres = _wtoi(strText);
+		idx += 1;
+
+		//10. ROI Width
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nStdDist = _wtoi(strText);
+		idx += 1;
+
+		//11. Inc
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nInc = _wtoi(strText);
+		idx += 1;
+
+		//12. Inc1
+        strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nInc1 = _wtoi(strText);
+		idx += 1;
+
+		//13. Min
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nMin = _wtoi(strText);
+		idx += 1;
+
+		//14. Max
+		strText = m_PanelKeyDist.GetItemText(idRow, idx);
+		dot->m_nMax = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+void CKDistSetDlg::ShowKDistParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	{
+		CButton *pBtnUse = (CButton*)(GetDlgItem(IDC_CHECK_USE_KDIST));
+		int iUse = 0;
+		if (m_dot->m_isUse)  iUse = 1;
+		pBtnUse->SetCheck(iUse);
+
+		SetDlgItemInt(IDC_EDIT_ROI_LENGTH_SIZE_DIST, m_dot->m_nRoiSize);
+	}
+
+	CString strText;
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Pos Type
+		strText.Format(_T("%d"), dot->m_poseType);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Key X
+		strText.Format(_T("%d"), dot->m_keyPoseX);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Key Y
+		strText.Format(_T("%d"), dot->m_keyPoseY);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. Pos X
+		strText.Format(_T("%d"), dot->m_nPosX);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Pos Y
+		strText.Format(_T("%d"), dot->m_nPosY);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. End Type
+		strText.Format(_T("%d"), dot->m_nEndThres);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Std
+		strText.Format(_T("%d"), dot->m_nStdDist);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//11. Inc
+		strText.Format(_T("%d"), dot->m_nInc);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//12. Inc1
+        strText.Format(_T("%d"), dot->m_nInc1);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//13. Min
+		strText.Format(_T("%d"), dot->m_nMin);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//14. Max
+		strText.Format(_T("%d"), dot->m_nMax);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//15. Result
+		strText.Format(_T("%.1f"), dot->m_distResult);
+		m_PanelKeyDist.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+
+void CKDistSetDlg::OnBnClickedButtonProcessKdist()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveKDistParam();
+
+	if (NULL == m_dot) return;
+
+	CLocProcess *pLoc = CVisionRecipe::getInstance()->getLocProcess(m_eDir);
+	if (NULL != pLoc) {
+		pLoc->execute(m_eDir);
+	}
+
+
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	if (nullptr != pRecipe) {
+		int nStage = pRecipe->getStage();
+		m_dot->SetStage(nStage);
+	}
+	m_dot->Execute(m_eDir);
+
+	DispAllResult();
+
+}
+
+void CKDistSetDlg::DispAllResult(void) {
+	/* code */
+	int nCount = 50;
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelKeyDist.SetItemText(id, 14, _T("NAN"));
+		}
+		else{   //显示结果
+			CString strResult;
+			strResult.Format(_T("%.1f"), dot->m_distResult);
+			int id = dot->getID();
+			m_PanelKeyDist.SetItemText(id, 14, strResult);
+		}
+	}
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	m_PanelKeyDist.Invalidate(FALSE);
+}
+
+void CKDistSetDlg::OnBnClickedButtonSaveKdist()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveKDistParam();
+}
+
+void CKDistSetDlg::OnBnClickedButtonSetStage()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CVisionRecipe* pRecipe = CVisionRecipe::getInstance();
+	if (nullptr == pRecipe) return;
+
+	m_nStage = GetDlgItemInt(IDC_EDIT_STAGE);
+	pRecipe->setStage(m_nStage);
+}
diff --git a/Common_Class/BlVisionPro/View/KDistSetDlg.h b/Common_Class/BlVisionPro/View/KDistSetDlg.h
new file mode 100644
index 0000000..acad056
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/KDistSetDlg.h
@@ -0,0 +1,53 @@
+#pragma once
+
+#include "KDistProcess.h"
+// CKDistSetDlg 对话框
+
+class CKDistSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CKDistSetDlg)
+
+public:
+	CKDistSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CKDistSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_DIST_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	DimensionDir m_eDir;
+	CGridCtrl	m_PanelKeyDist;
+	std::vector<CString> m_vParams;
+	CKDistProcess *m_dot;
+	int m_nStage;
+
+private:
+	//1. 初始化
+	void InitPanel(void);
+
+	//2. 初始化
+	void SaveKDistParam(void);
+
+	//3. 显示距离
+	void ShowKDistParam(void);
+
+	//4. 显示结果
+	void DispAllResult(void);
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnClose();
+	virtual BOOL OnInitDialog();
+	void ChangeVisionType(DimensionDir eDir);
+	void setDimensionDir(DimensionDir eDir);
+	afx_msg void OnBnClickedButtonProcessKdist();
+	afx_msg void OnBnClickedButtonSaveKdist();
+	afx_msg void OnBnClickedButtonSetStage();
+};
diff --git a/Common_Class/BlVisionPro/View/KeyVisionSetDlg.cpp b/Common_Class/BlVisionPro/View/KeyVisionSetDlg.cpp
new file mode 100644
index 0000000..9a73da1
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/KeyVisionSetDlg.cpp
@@ -0,0 +1,355 @@
+// KeyVisionSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "KeyVisionSetDlg.h"
+#include "afxdialogex.h"
+#include "ScanSetDlg.h"
+#include "SoftVisionApp.h"
+#include "FileRecipe.h"
+#include "VisionBufferPro.h"
+
+// CKeyVisionSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CKeyVisionSetDlg, CDialogEx)
+
+CKeyVisionSetDlg::CKeyVisionSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG1, pParent)
+	, m_strPassword(_T(""))
+{
+
+}
+
+CKeyVisionSetDlg::~CKeyVisionSetDlg()
+{
+}
+
+void CKeyVisionSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_CHECK_VISION_DISPLAY, m_btnVisionDisplay);
+
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE, m_btnVisionUse[0]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE2, m_btnVisionUse[1]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE3, m_btnVisionUse[2]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE4, m_btnVisionUse[3]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE5, m_btnVisionUse[4]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE6, m_btnVisionUse[5]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE7, m_btnVisionUse[6]);
+	DDX_Control(pDX, IDC_CHECK_VISION_TOP_USE8, m_btnVisionUse[7]);
+
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE, m_btnLocUse[0]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE2, m_btnLocUse[1]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE3, m_btnLocUse[2]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE4, m_btnLocUse[3]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE5, m_btnLocUse[4]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE6, m_btnLocUse[5]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE7, m_btnLocUse[6]);
+	DDX_Control(pDX, IDC_CHECK_LOC_TOP_USE8, m_btnLocUse[7]);
+
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE, m_btnDistUse[0]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE2, m_btnDistUse[1]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE3, m_btnDistUse[2]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE4, m_btnDistUse[3]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE5, m_btnDistUse[4]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE6, m_btnDistUse[5]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE7, m_btnDistUse[6]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE8, m_btnDistUse[7]);
+	DDX_Control(pDX, IDC_CHECK_DIST_TOP_USE9, m_btnDistUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE, m_btnRcutUse[0]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE2, m_btnRcutUse[1]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE3, m_btnRcutUse[2]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE4, m_btnRcutUse[3]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE5, m_btnRcutUse[4]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE6, m_btnRcutUse[5]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE7, m_btnRcutUse[6]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE8, m_btnRcutUse[7]);
+	DDX_Control(pDX, IDC_CHECK_RCUT_TOP_USE9, m_btnRcutUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE, m_btnGrindUse[0]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE2, m_btnGrindUse[1]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE3, m_btnGrindUse[2]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE4, m_btnGrindUse[3]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE5, m_btnGrindUse[4]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE6, m_btnGrindUse[5]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE7, m_btnGrindUse[6]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE8, m_btnGrindUse[7]);
+	DDX_Control(pDX, IDC_CHECK_GRIND_TOP_USE9, m_btnGrindUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE, m_btnCutUse[0]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE2, m_btnCutUse[1]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE3, m_btnCutUse[2]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE4, m_btnCutUse[3]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE5, m_btnCutUse[4]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE6, m_btnCutUse[5]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE7, m_btnCutUse[6]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE8, m_btnCutUse[7]);
+	DDX_Control(pDX, IDC_CHECK_CUT_TOP_USE9, m_btnCutUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE, m_btnThresUse[0]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE2, m_btnThresUse[1]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE3, m_btnThresUse[2]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE4, m_btnThresUse[3]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE5, m_btnThresUse[4]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE6, m_btnThresUse[5]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE7, m_btnThresUse[6]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE8, m_btnThresUse[7]);
+	DDX_Control(pDX, IDC_CHECK_THRES_TOP_USE9, m_btnThresUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE, m_btnHoleUse[0]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE2, m_btnHoleUse[1]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE3, m_btnHoleUse[2]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE4, m_btnHoleUse[3]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE5, m_btnHoleUse[4]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE6, m_btnHoleUse[5]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE7, m_btnHoleUse[6]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE8, m_btnHoleUse[7]);
+	DDX_Control(pDX, IDC_CHECK_HOLE_TOP_USE9, m_btnHoleUse[8]);
+
+	DDX_Control(pDX, IDC_CHECK_DEBUG_TOOL_KEY, m_btnDebugKey[0]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY, m_btnDebugKey[1]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY2, m_btnDebugKey[2]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY3, m_btnDebugKey[3]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY4, m_btnDebugKey[4]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY5, m_btnDebugKey[5]);
+	DDX_Control(pDX, IDC_CHECK_DEBUG_KEY6, m_btnDebugKey[6]);
+
+	DDX_Text(pDX, IDC_EDIT_PWD_KEY, m_strPassword);
+}
+
+
+BEGIN_MESSAGE_MAP(CKeyVisionSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_RECIPE, &CKeyVisionSetDlg::OnBnClickedButtonSaveRecipe)
+	ON_BN_CLICKED(IDC_BUTTON_LOAD_RECIPE, &CKeyVisionSetDlg::OnBnClickedButtonLoadRecipe)
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_KEY, &CKeyVisionSetDlg::OnBnClickedButtonProcessKey)
+	ON_BN_CLICKED(IDC_CHECK_DEBUG_TOOL_KEY, &CKeyVisionSetDlg::OnBnClickedCheckDebugToolKey)
+	ON_BN_CLICKED(IDC_BUTTON_DEBUG_MODE_KEY, &CKeyVisionSetDlg::OnBnClickedButtonDebugModeKey)
+END_MESSAGE_MAP()
+
+
+// CKeyVisionSetDlg 消息处理程序
+
+
+BOOL CKeyVisionSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	LockBtn(TRUE);
+
+	ShowUiParams();
+
+	this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CKeyVisionSetDlg::ShowUiParams(void) {
+	/* code */
+	CVisionRecipe* pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance)  return;
+
+	VisionDisplayInfo infDisplay = pInstance->getVisionDisplay();
+	m_btnVisionDisplay.SetCheck(infDisplay.isVisionDisplay);
+	m_btnDistUse[8].SetCheck(infDisplay.isDistDisplay);
+	m_btnRcutUse[8].SetCheck(infDisplay.isRcutDisplay);
+	m_btnGrindUse[8].SetCheck(infDisplay.isGrindDisplay);
+	m_btnCutUse[8].SetCheck(infDisplay.isCutDisplay);
+	m_btnThresUse[8].SetCheck(infDisplay.isThresDisplay);
+	m_btnHoleUse[8].SetCheck(infDisplay.isHoleDisplay);
+
+	for (int i = 0; i < 8; i++) {
+		VisionUseInfo inf = pInstance->getVisionUse((DimensionDir)i);
+		m_btnVisionUse[i].SetCheck(inf.isVisionUse);
+		m_btnLocUse[i].SetCheck(inf.isLocUse);
+		m_btnDistUse[i].SetCheck(inf.isDistUse);
+		m_btnRcutUse[i].SetCheck(inf.isRcutUse);
+		m_btnGrindUse[i].SetCheck(inf.isGrindUse);
+		m_btnCutUse[i].SetCheck(inf.isCutUse);
+		m_btnThresUse[i].SetCheck(inf.isThresUse);
+		m_btnHoleUse[i].SetCheck(inf.isHoleUse);
+	}
+
+	KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo();
+	m_btnDebugKey[0].SetCheck(info.isDebugTool);
+	m_btnDebugKey[1].SetCheck(info.isInspectKey);
+	m_btnDebugKey[2].SetCheck(info.isLocKey);
+	m_btnDebugKey[3].SetCheck(info.isGrindKey);
+	m_btnDebugKey[4].SetCheck(info.isDistKey);
+	m_btnDebugKey[5].SetCheck(info.isCutLineKey);
+	m_btnDebugKey[6].SetCheck(info.isRcutKey);
+
+	LockBtn(!m_btnDebugKey[0].GetCheck());
+}
+
+
+void CKeyVisionSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	SaveUiParam();
+
+	CDialogEx::OnClose();
+}
+
+void CKeyVisionSetDlg::SaveUiParam(void) {
+	/* code */
+	CVisionRecipe* pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance)  return;
+
+	VisionDisplayInfo infDisplay;
+	infDisplay.isVisionDisplay = (1 == m_btnVisionDisplay.GetCheck());
+	infDisplay.isDistDisplay = (1 == m_btnDistUse[8].GetCheck());
+	infDisplay.isRcutDisplay = (1 == m_btnRcutUse[8].GetCheck());
+	infDisplay.isGrindDisplay = (1 == m_btnGrindUse[8].GetCheck());
+	infDisplay.isCutDisplay = (1 == m_btnCutUse[8].GetCheck());
+	infDisplay.isThresDisplay = (1 == m_btnThresUse[8].GetCheck());
+	infDisplay.isHoleDisplay = (1 == m_btnHoleUse[8].GetCheck());
+	pInstance->setVisionDisplay(infDisplay);
+
+	for (int i = 0; i < 8; i++) {
+		VisionUseInfo inf;
+		inf.isVisionUse = (1 == m_btnVisionUse[i].GetCheck());
+		inf.isLocUse = (1 == m_btnLocUse[i].GetCheck());
+		inf.isDistUse = (1 == m_btnDistUse[i].GetCheck());
+		inf.isRcutUse = (1 == m_btnRcutUse[i].GetCheck());
+		inf.isGrindUse = (1 == m_btnGrindUse[i].GetCheck());
+		inf.isCutUse = (1 == m_btnCutUse[i].GetCheck());
+		inf.isThresUse = (1 == m_btnThresUse[i].GetCheck());
+		inf.isHoleUse = (1 == m_btnHoleUse[i].GetCheck());
+		pInstance->setVisionUse(inf, (DimensionDir)i);
+	}
+
+	KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo();
+	info.isDebugTool = (1 == m_btnDebugKey[0].GetCheck());
+	info.isInspectKey = (1 == m_btnDebugKey[1].GetCheck());
+	info.isLocKey = (1 == m_btnDebugKey[2].GetCheck());
+	info.isGrindKey = (1 == m_btnDebugKey[3].GetCheck());
+	info.isDistKey = (1 == m_btnDebugKey[4].GetCheck());
+	info.isCutLineKey = (1 == m_btnDebugKey[5].GetCheck());
+	info.isRcutKey = (1 == m_btnDebugKey[6].GetCheck());
+	pInstance->setKeyInfo(info);
+
+	pInstance->saveVisionConfig();
+}
+
+
+BOOL CKeyVisionSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CKeyVisionSetDlg::OnBnClickedButtonSaveRecipe()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	//std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\";
+	//CVisionRecipe::getInstance()->setWorkDir(filePath.c_str());
+	//std::string strName = "Test";
+	//CVisionRecipe::getInstance()->setVisionName(strName.c_str());
+	CVisionRecipe::getInstance()->save();
+}
+
+
+void CKeyVisionSetDlg::OnBnClickedButtonLoadRecipe()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	//std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\";
+	//CVisionRecipe::getInstance()->setWorkDir(filePath.c_str());
+	//std::string strName = "Test";
+	//CVisionRecipe::getInstance()->setVisionName(strName.c_str());
+	CVisionRecipe::getInstance()->open();
+}
+
+
+void CKeyVisionSetDlg::OnBnClickedButtonProcessKey()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	for (int i = 0; i < 1000; i++) {
+		Log_GetDebug()->TraceInfo("Start Save Recipe %d: %d", i, __LINE__);
+		{
+			//std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\";
+			//CVisionRecipe::getInstance()->setWorkDir(filePath.c_str());
+			//std::string strName = "Test";
+			//CVisionRecipe::getInstance()->setVisionName(strName.c_str());
+			CVisionRecipe::getInstance()->save();
+		}
+		Log_GetDebug()->TraceInfo("End Save Recipe %d: %d", i, __LINE__);
+		Sleep(1000);
+
+		Log_GetDebug()->TraceInfo("Start Load Recipe %d: %d", i, __LINE__);
+		{
+			//std::string filePath = "E:\\EI Workspace\\Recipe\\Test\\";
+			//CVisionRecipe::getInstance()->setWorkDir(filePath.c_str());
+			//std::string strName = "Test";
+			//CVisionRecipe::getInstance()->setVisionName(strName.c_str());
+			CVisionRecipe::getInstance()->open();
+		}
+		Log_GetDebug()->TraceInfo("Start End Recipe  %d: %d", i, __LINE__);
+		Sleep(1000);
+
+		Log_GetDebug()->TraceInfo("Start Vision Inspect  %d: %d", i, __LINE__);
+		for (int i = 0; i < 8; i++) {
+			NgInfo ngInf[NG_INF_NUM];
+			CSoftVisionApp::getInstance()->Execute(i, ngInf);
+		}
+		Log_GetDebug()->TraceInfo("End Vision Inspect  %d: %d", i, __LINE__);
+		Sleep(1000);
+	}
+}
+
+
+void CKeyVisionSetDlg::OnBnClickedCheckDebugToolKey()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	UpdateData(TRUE);
+	SaveUiParam();
+
+	LockBtn(!m_btnDebugKey[0].GetCheck());
+}
+
+void CKeyVisionSetDlg::LockBtn(BOOL isLock) {
+	/* code */
+	if (isLock) {
+		for (int i = 1; i < 7; i++) {
+			m_btnDebugKey[i].ShowWindow(SW_HIDE);
+		}
+		GetDlgItem(IDC_BUTTON_SAVE_RECIPE)->ShowWindow(SW_HIDE);
+		GetDlgItem(IDC_BUTTON_LOAD_RECIPE)->ShowWindow(SW_HIDE);
+		GetDlgItem(IDC_BUTTON_PROCESS_KEY)->ShowWindow(SW_HIDE);
+		GetDlgItem(IDC_STATIC_DEBUG_GROUND)->ShowWindow(SW_HIDE);
+		
+	}
+	else {
+		for (int i = 1; i < 7; i++) {
+			m_btnDebugKey[i].ShowWindow(SW_SHOW);
+		}
+		GetDlgItem(IDC_BUTTON_SAVE_RECIPE)->ShowWindow(SW_SHOW);
+		GetDlgItem(IDC_BUTTON_LOAD_RECIPE)->ShowWindow(SW_SHOW);
+		GetDlgItem(IDC_BUTTON_PROCESS_KEY)->ShowWindow(SW_SHOW);
+		GetDlgItem(IDC_STATIC_DEBUG_GROUND)->ShowWindow(SW_SHOW);
+	}
+}
+
+
+void CKeyVisionSetDlg::OnBnClickedButtonDebugModeKey()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	UpdateData(TRUE);
+	if (m_strPassword != _T("31415926535")) {
+		GetDlgItem(IDC_CHECK_DEBUG_TOOL_KEY)->ShowWindow(SW_HIDE);
+		return;
+	}
+
+	GetDlgItem(IDC_CHECK_DEBUG_TOOL_KEY)->ShowWindow(SW_SHOW);
+}
diff --git a/Common_Class/BlVisionPro/View/KeyVisionSetDlg.h b/Common_Class/BlVisionPro/View/KeyVisionSetDlg.h
new file mode 100644
index 0000000..ded07ba
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/KeyVisionSetDlg.h
@@ -0,0 +1,61 @@
+#pragma once
+
+
+// CKeyVisionSetDlg 对话框
+#include "VisionRecipe.h"
+
+class CKeyVisionSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CKeyVisionSetDlg)
+
+public:
+	CKeyVisionSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CKeyVisionSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum {
+		IDD = IDD_DIALOG_KEY_SET
+	};
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	//1. 初始化显示
+	void ShowUiParams(void);
+
+	//2. 获取信息
+	void SaveUiParam(void);
+
+	//3. 加锁
+	void LockBtn(BOOL isLock);
+
+private:
+	CButton m_btnVisionUse[8];
+	CButton m_btnLocUse[8];
+	CButton m_btnDistUse[9];
+	CButton m_btnRcutUse[9];
+	CButton m_btnGrindUse[9];
+	CButton m_btnCutUse[9];
+	CButton m_btnVisionDisplay;
+	CButton m_btnThresUse[9];
+	CButton m_btnHoleUse[9];
+
+	CButton m_btnDebugKey[7];
+
+	CString m_strPassword;
+
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnBnClickedButtonSaveRecipe();
+	afx_msg void OnBnClickedButtonLoadRecipe();
+	afx_msg void OnBnClickedButtonProcessKey();
+	afx_msg void OnBnClickedCheckDebugToolKey();
+	afx_msg void OnBnClickedButtonDebugModeKey();
+};
diff --git a/Common_Class/BlVisionPro/View/LocSetDlg.cpp b/Common_Class/BlVisionPro/View/LocSetDlg.cpp
new file mode 100644
index 0000000..7e759cf
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/LocSetDlg.cpp
@@ -0,0 +1,497 @@
+// LocSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "LocSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "SoftVisionApp.h"
+#include "Bspline.h"
+
+
+// CLocSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CLocSetDlg, CDialogEx)
+
+CLocSetDlg::CLocSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_LOC_SET, pParent)
+	, m_topScore(0.5)
+	, m_botScore(0.5)
+{
+	m_dot = NULL;
+	m_dotTop = nullptr;
+	m_dotBot = nullptr;
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+	m_topPoint.x = 0;
+    m_topPoint.y = 0;
+	m_botPoint.x = 0;
+	m_botPoint.y = 0;
+
+	HalconCpp::GenEmptyObj(&m_dispResultObject.hDispObject);
+	HalconCpp::GenEmptyObj(&m_dispResultObject.hDispObject);
+}
+
+CLocSetDlg::~CLocSetDlg()
+{
+	m_dispResultObject.hDispObject.Clear();
+	m_dispResultObject.hDispRegion.Clear();
+}
+
+void CLocSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Text(pDX, IDC_EDIT_TOP_MARK_X_LOC, m_topMark.x);
+	DDX_Text(pDX, IDC_EDIT_TOP_MARK_Y_LOC, m_topMark.y);
+	DDX_Text(pDX, IDC_EDIT_BOT_MARK_X_LOC, m_botMark.x);
+	DDX_Text(pDX, IDC_EDIT_BOT_MARK_Y_LOC, m_botMark.y);
+
+	DDX_Text(pDX, IDC_EDIT_TOP_POINT_X_LOC, m_topPoint.x);
+	DDX_Text(pDX, IDC_EDIT_TOP_POINT_Y_LOC, m_topPoint.y);
+	DDX_Text(pDX, IDC_EDIT_BOT_POINT_X_LOC, m_botPoint.x);
+	DDX_Text(pDX, IDC_EDIT_BOT_POINT_Y_LOC, m_botPoint.y);
+
+	DDX_Text(pDX, IDC_EDIT_TOP_SCORE_LOC, m_topScore);
+	DDX_Text(pDX, IDC_EDIT_BOT_SCORE_LOC, m_botScore);
+}
+
+
+BEGIN_MESSAGE_MAP(CLocSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_TOP_REFRESH_LOC, &CLocSetDlg::OnBnClickedButtonTopRefreshLoc)
+	ON_BN_CLICKED(IDC_BUTTON_BOT_REFRESH_LOC, &CLocSetDlg::OnBnClickedButtonBotRefreshLoc)
+	ON_BN_CLICKED(IDC_BUTTON_TOP_DELETE_LOC, &CLocSetDlg::OnBnClickedButtonTopDeleteLoc)
+	ON_BN_CLICKED(IDC_BUTTON_BOT_DELETE_LOC, &CLocSetDlg::OnBnClickedButtonBotDeleteLoc)
+	ON_BN_CLICKED(IDC_BUTTON_EXECUTE_LOC, &CLocSetDlg::OnBnClickedButtonExecuteLoc)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_LOC, &CLocSetDlg::OnBnClickedButtonSaveLoc)
+	ON_BN_CLICKED(IDC_BUTTON_NORCH, &CLocSetDlg::OnBnClickedButtonNorch)
+END_MESSAGE_MAP()
+
+
+// CLocSetDlg 消息处理程序
+
+
+void CLocSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	if (nullptr != m_displayTop) {
+		ClsDisplay_Free(m_displayTop);
+		m_displayTop = nullptr;
+	}
+
+	if (nullptr != m_displayBot) {
+		ClsDisplay_Free(m_displayBot);
+		m_displayBot = nullptr;
+	}
+
+	CDialogEx::OnClose();
+}
+
+
+BOOL CLocSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitDisplay();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+int CLocSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+	return 0;
+}
+
+void CLocSetDlg::InitDisplay(void) {
+	/* code */
+	m_displayTop = ClsDisplay_Create();
+	if (nullptr != m_displayTop) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_IMAGE_LOC);
+		pDispWnd->GetWindowRect(rect);
+		m_displayTop->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayTop->SetOperFlag(DEFAULT_OPER_FLAG);
+		m_displayTop->SetDraw("fill", DISP_OBJECT);
+		m_displayTop->SetColor("red", DISP_OBJECT);
+
+		m_displayTop->SetDraw("fill", DISP_REGION);
+		std::string color = ClsVision::Rgb2Color(255, 0, 0);
+		m_displayTop->SetColor(color, DISP_REGION);
+
+		m_displayTop->SetDraw("fill", DISP_CROSS);
+		color = ClsVision::Rgb2Color(224, 224, 224);
+		m_displayTop->SetColor(color, DISP_CROSS);
+
+		m_displayTop->SetDraw("fill", DISP_SELECT);
+		m_displayTop->SetColor("yellow", DISP_SELECT);
+		color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayTop->SetBackgroundColor(color);
+	}
+
+	m_displayBot = ClsDisplay_Create();
+	if (nullptr != m_displayBot) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_IMAGE_LOC);
+		pDispWnd->GetWindowRect(rect);
+		m_displayBot->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayBot->SetOperFlag(DEFAULT_OPER_FLAG);
+		m_displayBot->SetDraw("fill", DISP_OBJECT);
+		m_displayBot->SetColor("red", DISP_OBJECT);
+
+		m_displayBot->SetDraw("fill", DISP_REGION);
+		std::string color = ClsVision::Rgb2Color(255, 0, 0);
+		m_displayBot->SetColor(color, DISP_REGION);
+
+		m_displayBot->SetDraw("fill", DISP_CROSS);
+		color = ClsVision::Rgb2Color(224, 224, 224);
+		m_displayBot->SetColor(color, DISP_CROSS);
+
+		m_displayBot->SetDraw("fill", DISP_SELECT);
+		m_displayBot->SetColor("yellow", DISP_SELECT);
+		color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayBot->SetBackgroundColor(color);
+	}
+}
+
+void CLocSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveLocParams();
+
+	//显示当前的参数
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getLocProcess(eDir);
+	ShowLocParams();
+
+	SaveNccDotProcess();
+	
+	if (NULL != m_dot) {
+		m_dotTop = m_dot->getDot(0);
+		m_dotBot = m_dot->getDot(1);
+	}
+	ShowNccDotProcess();
+}
+
+void CLocSetDlg::ShowNccDotProcess(void) {
+	/* code */
+	if (NULL != m_dotTop) {
+		m_topScore = m_dotTop->m_score;
+
+		ClsVision::GenEmptyObject(m_displayTop->GetImage());
+		m_displayTop->SetImage(m_dotTop->getImage());
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_displayTop->GetImage(), width, height);
+		if (width >= 1 && height >= 1) {
+			m_displayTop->AutoWindowSize(width, height);
+		}
+
+		if (width >= 1 && height >= 1) {
+			HalconCpp::GenEmptyObj(&m_displayTop->GetRegion());
+			HalconCpp::HObject hRegion, hRegion1, hRegion2;
+			HalconCpp::GenRegionLine(&hRegion1, 0, 0.5 * (width - 1), height - 1, 0.5 * (width - 1));
+			HalconCpp::GenRegionLine(&hRegion2, 0.5 * (height - 1), 0, 0.5 * (height - 1), width - 1);
+			HalconCpp::ConcatObj(hRegion1, hRegion2, &hRegion);
+			m_displayTop->SetRegion(hRegion);
+		}
+
+		m_displayTop->ClearWindow();
+		m_displayTop->DispImage();
+		m_displayTop->DispRegion();
+	}
+
+	if (NULL != m_dotBot) {
+		m_botScore = m_dotBot->m_score;
+
+		ClsVision::GenEmptyObject(m_displayBot->GetImage());
+		m_displayBot->SetImage(m_dotBot->getImage());
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_displayBot->GetImage(), width, height);
+		if (width >= 1 && height >= 1) {
+			m_displayBot->AutoWindowSize(width, height);
+		}
+
+		if (width >= 1 && height >= 1) {
+			HalconCpp::GenEmptyObj(&m_displayBot->GetRegion());
+			HalconCpp::HObject hRegion, hRegion1, hRegion2;
+			HalconCpp::GenRegionLine(&hRegion1, 0, 0.5 * (width - 1), height - 1, 0.5 * (width - 1));
+			HalconCpp::GenRegionLine(&hRegion2, 0.5 * (height - 1), 0, 0.5 * (height - 1), width - 1);
+			HalconCpp::ConcatObj(hRegion1, hRegion2, &hRegion);
+			m_displayBot->SetRegion(hRegion);
+		}
+
+		m_displayBot->ClearWindow();
+		m_displayBot->DispImage();
+		m_displayBot->DispRegion();
+	}
+
+	UpdateData(FALSE);
+}
+
+void CLocSetDlg::SaveNccDotProcess(void) {
+	/* code */
+	UpdateData(TRUE);
+	if (NULL != m_dotTop) {
+		m_dotTop->m_score = m_topScore;
+	}
+
+	if (NULL != m_dotBot) {
+		m_dotBot->m_score = m_botScore;
+	}
+}
+
+void CLocSetDlg::ShowLocParams(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	m_topMark = m_dot->getPose(0);
+	m_botMark = m_dot->getPose(1);
+	m_topPoint = m_dot->getPose(2);
+    m_botPoint = m_dot->getPose(3);
+
+	UpdateData(FALSE);
+}
+
+void CLocSetDlg::SaveLocParams(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot)   return;
+
+	UpdateData(TRUE);
+//	m_dot->setPose(m_topMark, 0);
+//	m_dot->setPose(m_botMark, 1);
+}
+
+void CLocSetDlg::OnBnClickedButtonTopRefreshLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dotTop) return;
+	
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	//截图
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	Point2I pose;
+	pose.x = (int)(0.5 * (x1 + x2));
+	pose.y = (int)(0.5 * (y1 + y2));
+	m_dotTop->setPose(pose);
+	m_dotTop->setImage(hImage);
+
+	//计算位置信息
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		Point2I stdPoint = pose;
+		m_topPoint = stdPoint;
+		m_dot->setPose(stdPoint, 2);
+		if (pSideData->m_bTopMark_Find) {
+			stdPoint = pSideData->m_mTopMark;
+			m_topMark = stdPoint;
+			m_dot->setPose(stdPoint, 0);
+		}
+	}
+
+	if (NULL == m_displayTop)  return;
+
+	ShowLocParams();
+
+	ShowNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonBotRefreshLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dotBot) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	//截图
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	Point2I pose;
+	pose.x = (int)(0.5 * (x1 + x2));
+	pose.y = (int)(0.5 * (y1 + y2));
+	m_dotBot->setPose(pose);
+	m_dotBot->setImage(hImage);
+
+	//计算位置信息
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		Point2I stdPoint = pose;
+        m_botPoint = stdPoint;
+		m_dot->setPose(stdPoint, 3);
+		if (pSideData->m_bBotMark_Find) {
+			stdPoint = pSideData->m_mBotMark;
+			m_botMark = stdPoint;
+			m_dot->setPose(stdPoint, 1);
+		}
+	}
+
+	if (NULL == m_displayBot)  return;
+
+	ShowLocParams();
+
+	ShowNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonTopDeleteLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dotTop) return;
+
+	HalconCpp::HObject hImage;
+	HalconCpp::GenEmptyObj(&hImage);
+
+	m_dotTop->setImage(hImage);
+
+	ShowNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonBotDeleteLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dotBot) return;
+
+	HalconCpp::HObject hImage;
+	HalconCpp::GenEmptyObj(&hImage);
+
+	m_dotBot->setImage(hImage);
+
+	ShowNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonExecuteLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveLocParams();
+	SaveNccDotProcess();
+	if (NULL == m_dot) return;
+
+	m_dot->execute(m_eDir);
+
+	DispAllResult();
+}
+
+void CLocSetDlg::DispAllResult(void) {
+	/* code */
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+}
+
+
+BOOL CLocSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CLocSetDlg::OnBnClickedButtonSaveLoc()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveLocParams();
+	SaveNccDotProcess();
+}
+
+
+void CLocSetDlg::OnBnClickedButtonNorch()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	//[INFO]	11 : 21 : 43 : 701 Norch 0 : (1414, 3577), (1358, 3588), (1370, 3586)
+	//[INFO]	11 : 21 : 43 : 701 Norch 1 : (1506, 4215), (1448, 4219), (1460, 4218)
+	//[INFO]	11 : 21 : 43 : 701 Norch 2 : (1521, 4461), (1463, 4464), (1476, 4463)
+	//[INFO]	11 : 21 : 43 : 701 Norch 3 : (1526, 4584), (1468, 4584), (1480, 4584)
+	//[INFO]	11 : 21 : 43 : 701 Norch 4 : (1547, 4668), (1469, 4636), (1482, 4642)
+	//[INFO]	11 : 21 : 43 : 701 Norch 5 : (1546, 4748), (1474, 4740), (1488, 4741)
+	//[INFO]	11 : 21 : 43 : 701 Norch 6 : (1528, 4831), (1469, 4869), (1482, 4860)
+	//[INFO]	11 : 21 : 43 : 701 Norch 7 : (1525, 4951), (1468, 4925), (1481, 4931)
+	//[INFO]	11 : 21 : 43 : 701 Norch 8 : (1511, 5176), (1454, 5171), (1466, 5172)
+	//[INFO]	11 : 21 : 43 : 701 Norch 9 : (1415, 5856), (1359, 5845), (1371, 5847)
+	return;
+#if 0
+	Point2D aryPoints[10];
+	aryPoints[0].x = 1370;
+    aryPoints[0].y = 3586;
+    aryPoints[1].x = 1460;
+	aryPoints[1].y = 4218;
+    aryPoints[2].x = 1476;
+    aryPoints[2].y = 4463;
+    aryPoints[3].x = 1480;
+	aryPoints[3].y = 4584;
+    aryPoints[4].x = 1482;
+    aryPoints[4].y = 4668;
+    aryPoints[5].x = 1488;
+    aryPoints[5].y = 4741;
+    aryPoints[6].x = 1482;
+    aryPoints[6].y = 4831;
+    aryPoints[7].x = 1481;
+    aryPoints[7].y = 4951;
+    aryPoints[8].x = 1466;
+    aryPoints[8].y = 5172;
+    aryPoints[9].x = 1371;
+    aryPoints[9].y = 5847;
+	CRect roiRect;
+    roiRect.left = 1017;
+    roiRect.top = 3456;
+	roiRect.right = 1573;
+	roiRect.bottom = 5970;
+	std::vector<Point2D> vPoints;
+	for (int i = 0; i < 10; i++) {
+		Point2D point = aryPoints[i];
+		vPoints.push_back(point);
+	}
+	CRect rectResult[100];
+	int nRet = CVisionBufferPro::findNorchDefect(m_eDir, vPoints, roiRect, 30, 5, 45, 1, 10, 10, rectResult);
+#endif
+}
diff --git a/Common_Class/BlVisionPro/View/LocSetDlg.h b/Common_Class/BlVisionPro/View/LocSetDlg.h
new file mode 100644
index 0000000..a6e3cc2
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/LocSetDlg.h
@@ -0,0 +1,73 @@
+#pragma once
+#include "LocProcess.h"
+
+// CLocSetDlg 对话框
+
+class CLocSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CLocSetDlg)
+
+public:
+	CLocSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CLocSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_LOC_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	IClsDisplay *m_displayTop;
+	IClsDisplay *m_displayBot;
+
+	CLocProcess *m_dot;
+	CNccDotProcess *m_dotTop;
+	CNccDotProcess *m_dotBot;
+
+	Point2I m_topMark;
+	Point2I m_botMark;
+	Point2I m_topPoint;
+	Point2I m_botPoint;
+	double m_topScore;
+	double m_botScore;
+
+private:
+	//1. 初始化
+	void InitDisplay(void);
+
+	//2. 执行
+	void ChangeVisionType(DimensionDir eDir);
+
+	//3. 保存当前的数据
+	void SaveLocParams(void);
+	void ShowLocParams(void);
+
+	//3. 保存当前状态
+	void SaveNccDotProcess(void);
+	void ShowNccDotProcess(void);
+
+	//4. 显示效果
+	void DispAllResult(void);
+
+public:
+	DimensionDir m_eDir;
+	DispResultObject m_dispResultObject;
+
+public:
+	afx_msg void OnClose();
+	virtual BOOL OnInitDialog();
+	int setDimensionDir(DimensionDir eDir);
+	afx_msg void OnBnClickedButtonTopRefreshLoc();
+	afx_msg void OnBnClickedButtonBotRefreshLoc();
+	afx_msg void OnBnClickedButtonTopDeleteLoc();
+	afx_msg void OnBnClickedButtonBotDeleteLoc();
+	afx_msg void OnBnClickedButtonExecuteLoc();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnBnClickedButtonSaveLoc();;
+	afx_msg void OnBnClickedButtonNorch();
+};
diff --git a/Common_Class/BlVisionPro/View/LockSetDlg.cpp b/Common_Class/BlVisionPro/View/LockSetDlg.cpp
new file mode 100644
index 0000000..15dd7d4
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/LockSetDlg.cpp
@@ -0,0 +1,99 @@
+// LockSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "LockSetDlg.h"
+#include "afxdialogex.h"
+
+
+#define  TIMER_ID_LOCK_ID            6001
+// CLockSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CLockSetDlg, CDialogEx)
+
+CLockSetDlg::CLockSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_LOCK_SET, pParent)
+{
+
+}
+
+CLockSetDlg::~CLockSetDlg()
+{
+}
+
+void CLockSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CLockSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+
+// CLockSetDlg 消息处理程序
+
+
+BOOL CLockSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CLockSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+	m_nLockTime = 0;
+
+	// TODO:  在此添加额外的初始化
+	this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+	SetTimer(TIMER_ID_LOCK_ID, 1000, NULL);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CLockSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	KillTimer(TIMER_ID_LOCK_ID);
+
+	CDialogEx::OnClose();
+}
+
+
+void CLockSetDlg::OnTimer(UINT_PTR nIDEvent)
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	switch (nIDEvent)
+	{
+	case TIMER_ID_LOCK_ID:
+		ShowLockTime();
+		break;
+
+	default:
+		break;
+	}
+
+	CDialogEx::OnTimer(nIDEvent);
+}
+
+void CLockSetDlg::ShowLockTime(void) {
+	/* code */
+	CString strTime;
+	strTime.Format(_T("Lock: %d sec"), m_nLockTime);
+	GetDlgItem(IDC_STATIC_LOCK_TIME)->SetWindowText(strTime);
+
+	m_nLockTime += 1;
+}
diff --git a/Common_Class/BlVisionPro/View/LockSetDlg.h b/Common_Class/BlVisionPro/View/LockSetDlg.h
new file mode 100644
index 0000000..cb0d16f
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/LockSetDlg.h
@@ -0,0 +1,34 @@
+#pragma once
+
+
+// CLockSetDlg 对话框
+
+class CLockSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CLockSetDlg)
+
+public:
+	CLockSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CLockSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_LOCK_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnClose();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+
+private:
+	int m_nLockTime;
+
+private:
+	void ShowLockTime(void);
+};
diff --git a/Common_Class/BlVisionPro/View/MeasureSetDlg.cpp b/Common_Class/BlVisionPro/View/MeasureSetDlg.cpp
new file mode 100644
index 0000000..b996353
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/MeasureSetDlg.cpp
@@ -0,0 +1,269 @@
+// MeasureSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "MeasureSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+
+
+// CMeasureSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CMeasureSetDlg, CDialogEx)
+
+CMeasureSetDlg::CMeasureSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_MEASURE_SET, pParent)
+{
+	m_dot = NULL;
+	for (int i = 0; i < 4; i++) {
+		m_inf[i].idxRefer = 0;
+		m_inf[i].typePoint = 0;
+		m_inf[i].modePoint = 0;
+		m_inf[i].pointThres = 30;
+		m_inf[i].modeNear = 0;
+		m_inf[i].nearThres = 30;
+	}
+
+	m_firstPoint.x = 0;
+	m_firstPoint.y = 0;
+
+	m_secondPoint.x = 0;
+	m_secondPoint.y = 0;
+}
+
+CMeasureSetDlg::~CMeasureSetDlg()
+{
+}
+
+void CMeasureSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE, m_combPointRefer[0]);
+	DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE, m_combPointType[0]);
+	DDX_Control(pDX, IDC_COMBO_START_MODE, m_combStartMode[0]);
+	DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE, m_combEndMode[0]);
+
+	DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE2, m_combPointRefer[1]);
+	DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE2, m_combPointType[1]);
+	DDX_Control(pDX, IDC_COMBO_START_MODE2, m_combStartMode[1]);
+	DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE2, m_combEndMode[1]);
+
+	DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE3, m_combPointRefer[2]);
+	DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE3, m_combPointType[2]);
+	DDX_Control(pDX, IDC_COMBO_START_MODE3, m_combStartMode[2]);
+	DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE3, m_combEndMode[2]);
+
+	DDX_Control(pDX, IDC_COMBO_POINT_REFER_MEASURE4, m_combPointRefer[3]);
+	DDX_Control(pDX, IDC_COMBO_POINT_TYPE_MEASURE4, m_combPointType[3]);
+	DDX_Control(pDX, IDC_COMBO_START_MODE4, m_combStartMode[3]);
+	DDX_Control(pDX, IDC_COMBO_END_MODE_START_MODE4, m_combEndMode[3]);
+
+	DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE, m_inf[0].pointThres);
+	DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE, m_inf[0].nearThres);
+
+	DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE2, m_inf[1].pointThres);
+	DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE2, m_inf[1].nearThres);
+
+	DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE3, m_inf[2].pointThres);
+	DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE3, m_inf[2].nearThres);
+
+	DDX_Text(pDX, IDC_EDIT_START_THRES_MEASURE4, m_inf[3].pointThres);
+	DDX_Text(pDX, IDC_EDIT_END_THRES_MEASURE4, m_inf[3].nearThres);
+
+	DDX_Text(pDX, IDC_EDIT_POSE_X_MEASURE, m_firstPoint.x);
+	DDX_Text(pDX, IDC_EDIT_POSE_Y_MEASURE, m_firstPoint.y);
+
+	DDX_Text(pDX, IDC_EDIT_BOT_X_MEASURE, m_secondPoint.x);
+	DDX_Text(pDX, IDC_EDIT_BOT_Y_MEASURE, m_secondPoint.y);
+}
+
+
+BEGIN_MESSAGE_MAP(CMeasureSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_SET_TOP_MEASURE, &CMeasureSetDlg::OnBnClickedButtonSetTopMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_DEL_TOP_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDelTopMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_SET_BOT_MEASURE, &CMeasureSetDlg::OnBnClickedButtonSetBotMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_DEL_BOT_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDelBotMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_DRAW_ROI_MEASURE, &CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure)
+	ON_BN_CLICKED(IDC_BUTTON_DRAW_ROI_MEASURE2, &CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure2)
+END_MESSAGE_MAP()
+
+
+// CMeasureSetDlg 消息处理程序
+
+
+BOOL CMeasureSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CMeasureSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitControl();
+
+	ShowParamUi();
+
+	LockROI(-1);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CMeasureSetDlg::SetDot(CCornerDistProcess *dot) {
+	/* code */
+	m_dot = dot;
+}
+
+void CMeasureSetDlg::InitControl(void) {
+	/* code */
+	for (int i = 0; i < 4; i++) {
+		m_combPointRefer[i].InsertString(0, _T("Affine"));
+		m_combPointRefer[i].InsertString(1, _T("Top Point"));
+		m_combPointRefer[i].InsertString(2, _T("Bot Point"));
+		m_combPointRefer[i].SetCurSel(0);
+
+		m_combPointType[i].InsertString(0, _T("Start Point"));
+		m_combPointType[i].InsertString(1, _T("End Point"));
+		m_combPointType[i].SetCurSel(0);
+
+		m_combStartMode[i].InsertString(0, _T("All"));
+		m_combStartMode[i].InsertString(1, _T("W_T_B"));
+		m_combStartMode[i].InsertString(2, _T("B_T_W"));
+		m_combStartMode[i].SetCurSel(0);
+
+		m_combEndMode[i].InsertString(0, _T("All"));
+		m_combEndMode[i].InsertString(1, _T("W_T_B"));
+		m_combEndMode[i].InsertString(2, _T("B_T_W"));
+		m_combEndMode[i].SetCurSel(0);
+	}
+}
+
+void CMeasureSetDlg::ShowParamUi(void) {
+	/* code */
+	if (NULL == m_dot) return;
+
+	m_firstPoint = m_dot->getPoint(4);
+	m_secondPoint = m_dot->getPoint(5);
+
+	MeasureInfo inf;
+	for (int i = 0; i < 4; i++) {
+		inf = m_dot->getMeasureInfo(i);
+		m_inf[i] = inf;
+
+		m_combPointRefer[i].SetCurSel(inf.idxRefer);
+		m_combPointType[i].SetCurSel(inf.typePoint);
+		m_combStartMode[i].SetCurSel(inf.modePoint);
+		m_combEndMode[i].SetCurSel(inf.modeNear);
+	}
+
+	UpdateData(FALSE);
+}
+
+void CMeasureSetDlg::SaveCornerParam(void) {
+	/* code */
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+	m_dot->setPoint(m_firstPoint, 4);
+	m_dot->setPoint(m_secondPoint, 5);
+
+	MeasureInfo inf;
+	for (int i = 0; i < 4; i++) {
+		inf = m_inf[i];
+		inf.idxRefer = m_combPointRefer[i].GetCurSel();
+		inf.typePoint = m_combPointType[i].GetCurSel();
+		inf.modePoint = m_combStartMode[i].GetCurSel();
+		inf.modeNear = m_combEndMode[i].GetCurSel();
+		m_dot->setMeasureInfo(inf, i);
+	}
+}
+
+void CMeasureSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	SaveCornerParam();
+
+	CDialogEx::OnClose();
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonSetTopMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonDelTopMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	m_firstPoint.x = 0;
+	m_firstPoint.y = 0;
+	m_dot->setPoint(m_firstPoint, 4);
+
+	UpdateData(FALSE);
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonSetBotMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonDelBotMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	m_secondPoint.x = 0;
+	m_secondPoint.y = 0;
+	m_dot->setPoint(m_secondPoint, 5);
+	UpdateData(FALSE);
+}
+
+
+void CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+
+	LockROI(1);
+}
+
+void CMeasureSetDlg::LockROI(int nType) {
+	/* code */
+	if (1 == nType) {
+		GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(TRUE);
+		GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(FALSE);
+	}
+	else if (2 == nType) {
+		GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(TRUE);
+	}
+	else {
+		GetDlgItem(IDC_BUTTON_SET_TOP_MEASURE)->EnableWindow(FALSE);
+		GetDlgItem(IDC_BUTTON_SET_BOT_MEASURE)->EnableWindow(FALSE);
+	}
+}
+
+void CMeasureSetDlg::OnBnClickedButtonDrawRoiMeasure2()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+
+	LockROI(2);
+}
diff --git a/Common_Class/BlVisionPro/View/MeasureSetDlg.h b/Common_Class/BlVisionPro/View/MeasureSetDlg.h
new file mode 100644
index 0000000..eb8d463
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/MeasureSetDlg.h
@@ -0,0 +1,62 @@
+#pragma once
+
+// CMeasureSetDlg 对话框
+#include "CornerDistProcess.h"
+#include "afxwin.h"
+
+class CMeasureSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CMeasureSetDlg)
+
+public:
+	CMeasureSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CMeasureSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_MEASURE_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	CCornerDistProcess *m_dot;
+
+	MeasureInfo m_inf[4];
+
+	CComboBox m_combPointRefer[4];
+	CComboBox m_combPointType[4];
+	CComboBox m_combStartMode[4];
+	CComboBox m_combEndMode[4];
+
+	Point2I m_firstPoint;
+	Point2I m_secondPoint;
+
+private:
+	//1. 初始化空间
+	void InitControl(void);
+
+	//2. 显示参数
+	void ShowParamUi(void);
+
+	//3. 保存参数
+	void SaveCornerParam(void);
+
+	void LockROI(int nType);
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	void SetDot(CCornerDistProcess *dot);
+	
+	afx_msg void OnClose();
+	afx_msg void OnBnClickedButtonSetTopMeasure();
+	afx_msg void OnBnClickedButtonDelTopMeasure();
+	afx_msg void OnBnClickedButtonSetBotMeasure();
+	afx_msg void OnBnClickedButtonDelBotMeasure();
+	afx_msg void OnBnClickedButtonDrawRoiMeasure();
+	afx_msg void OnBnClickedButtonDrawRoiMeasure2();
+};
diff --git a/Common_Class/BlVisionPro/View/OpRoiDlg.cpp b/Common_Class/BlVisionPro/View/OpRoiDlg.cpp
new file mode 100644
index 0000000..d53d6fd
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/OpRoiDlg.cpp
@@ -0,0 +1,142 @@
+// OpRoiDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "OpRoiDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "VisionSetDlg.h"
+
+
+// COpRoiDlg 对话框
+
+IMPLEMENT_DYNAMIC(COpRoiDlg, CDialogEx)
+
+COpRoiDlg::COpRoiDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_ROI_SET, pParent)
+	, m_stepX(2)
+	, m_stepY(2)
+{
+	m_isLock = TRUE;
+}
+
+COpRoiDlg::~COpRoiDlg()
+{
+}
+
+void COpRoiDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Text(pDX, IDC_EDIT_X_STEP_ROI, m_stepX);
+	DDX_Text(pDX, IDC_EDIT_Y_STEP_ROI, m_stepY);
+}
+
+
+BEGIN_MESSAGE_MAP(COpRoiDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_MOVE_RIGHT_ROI, &COpRoiDlg::OnBnClickedButtonMoveRightRoi)
+	ON_BN_CLICKED(IDC_BUTTON_MOVE_UP_ROI, &COpRoiDlg::OnBnClickedButtonMoveUpRoi)
+	ON_BN_CLICKED(IDC_BUTTON_MOVE_LEFT_ROI, &COpRoiDlg::OnBnClickedButtonMoveLeftRoi)
+	ON_BN_CLICKED(IDC_BUTTON_MOVE_DOWN_ROI, &COpRoiDlg::OnBnClickedButtonMoveDownRoi)
+END_MESSAGE_MAP()
+
+
+// COpRoiDlg 消息处理程序
+
+
+void COpRoiDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	m_isLock = TRUE;
+	CDialogEx::OnClose();
+}
+
+
+BOOL COpRoiDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL COpRoiDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitBitICON();
+
+	::SetWindowPos(this->m_hWnd, HWND_TOPMOST, 1200, 200, 0, 0, SWP_NOSIZE);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void COpRoiDlg::InitBitICON(void) {
+	/* code */
+	{
+		CButton *pTop = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_UP_ROI));
+		HICON iconTop = AfxGetApp()->LoadIcon(IDI_ICON_UP);
+		pTop->SetIcon(iconTop);
+	}
+
+	{
+		CButton *pDown = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_DOWN_ROI));
+		HICON iconDown = AfxGetApp()->LoadIcon(IDI_ICON_DOWN);
+		pDown->SetIcon(iconDown);
+	}
+	
+	{
+		CButton *pBtnRight = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_RIGHT_ROI));
+		HICON iconRight = AfxGetApp()->LoadIcon(IDI_ICON_RIGHT);
+		pBtnRight->SetIcon(iconRight);
+	}
+
+	{
+		CButton *pBtnLeft = (CButton *)(GetDlgItem(IDC_BUTTON_MOVE_LEFT_ROI));
+		HICON iconLeft = AfxGetApp()->LoadIcon(IDI_ICON_LEFT);
+		pBtnLeft->SetIcon(iconLeft);
+	}
+}
+
+void COpRoiDlg::MoveRegion(int nType) {
+	/* code */
+}
+
+
+void COpRoiDlg::OnBnClickedButtonMoveRightRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	MoveRegion(0);
+}
+
+
+void COpRoiDlg::OnBnClickedButtonMoveUpRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	MoveRegion(1);
+}
+
+
+void COpRoiDlg::OnBnClickedButtonMoveLeftRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	MoveRegion(2);
+}
+
+
+void COpRoiDlg::OnBnClickedButtonMoveDownRoi()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	MoveRegion(3);
+}
+
+
diff --git a/Common_Class/BlVisionPro/View/OpRoiDlg.h b/Common_Class/BlVisionPro/View/OpRoiDlg.h
new file mode 100644
index 0000000..ba27b7b
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/OpRoiDlg.h
@@ -0,0 +1,45 @@
+#pragma once
+
+
+// COpRoiDlg 对话框
+
+class COpRoiDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(COpRoiDlg)
+
+public:
+	COpRoiDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~COpRoiDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_ROI_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	int m_stepX;
+	int m_stepY;
+
+	BOOL m_isLock;
+
+private:
+	//区域
+	void MoveRegion(int nType);
+
+	//
+	void InitBitICON(void);
+
+public:
+	afx_msg void OnClose();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnBnClickedButtonMoveRightRoi();
+	afx_msg void OnBnClickedButtonMoveUpRoi();
+	afx_msg void OnBnClickedButtonMoveLeftRoi();
+	afx_msg void OnBnClickedButtonMoveDownRoi();
+};
diff --git a/Common_Class/BlVisionPro/View/RcutSetDLg.cpp b/Common_Class/BlVisionPro/View/RcutSetDLg.cpp
new file mode 100644
index 0000000..52b7ef4
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/RcutSetDLg.cpp
@@ -0,0 +1,1076 @@
+// RcutSetDLg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "RcutSetDLg.h"
+#include "afxdialogex.h"
+#include "VisionSetDlg.h"
+#include "VisionBufferPro.h"
+#include "VisionRecipe.h"
+#include "SoftVisionApp.h"
+
+// CRcutSetDLg 对话框
+
+IMPLEMENT_DYNAMIC(CRcutSetDLg, CDialogEx)
+
+CRcutSetDLg::CRcutSetDLg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_RCUT_SET, pParent)
+{
+	/* code */
+	m_dotTop = NULL;
+	m_dotBot = NULL;
+}
+
+CRcutSetDLg::~CRcutSetDLg()
+{
+}
+
+void CRcutSetDLg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_PANEL_KDIST_INFO, m_PanelRcut);
+	DDX_Control(pDX, IDC_PANEL_BRK_INFO, m_PanelBroken);
+}
+
+
+BEGIN_MESSAGE_MAP(CRcutSetDLg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_PROCESS_RCUT, &CRcutSetDLg::OnBnClickedButtonProcessRcut)
+	ON_COMMAND(ID_EDITROI_IMAGEROI, &CRcutSetDLg::OnEditroiImageroi)
+	ON_BN_CLICKED(IDC_BUTTON_SET_IMAGE_RCUT, &CRcutSetDLg::OnBnClickedButtonSetImageRcut)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_RCUT, &CRcutSetDLg::OnBnClickedButtonSaveRcut)
+	ON_BN_CLICKED(IDC_BUTTON_SET_IMAGE_RCUT2, &CRcutSetDLg::OnBnClickedButtonSetImageRcut2)
+	ON_BN_CLICKED(IDC_BUTTON_TOP_TRAIN, &CRcutSetDLg::OnBnClickedButtonTopTrain)
+	ON_BN_CLICKED(IDC_BUTTON_TOP_TRAIN2, &CRcutSetDLg::OnBnClickedButtonTopTrain2)
+	ON_BN_CLICKED(IDC_BTN_TOP_SET_STD, &CRcutSetDLg::OnBnClickedBtnTopSetStd)
+	ON_BN_CLICKED(IDC_BTN_BOT_SET_STD, &CRcutSetDLg::OnBnClickedBtnBotSetStd)
+END_MESSAGE_MAP()
+
+
+// CRcutSetDLg 消息处理程序
+
+
+void CRcutSetDLg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	if (NULL != m_displayTop1) {
+		ClsDisplay_Free(m_displayTop1);
+		m_displayTop1 = NULL;
+	}
+
+	if (NULL != m_displayTop2) {
+		ClsDisplay_Free(m_displayTop2);
+		m_displayTop2 = NULL;
+	}
+	if (NULL != m_displayTop3) {
+		ClsDisplay_Free(m_displayTop3);
+		m_displayTop3 = NULL;
+	}
+
+
+	if (NULL != m_displayBot1) {
+		ClsDisplay_Free(m_displayBot1);
+		m_displayBot1 = NULL;
+	}
+	if (NULL != m_displayBot2) {
+		ClsDisplay_Free(m_displayBot2);
+		m_displayBot2 = NULL;
+	}
+	if (NULL != m_displayBot3) {
+		ClsDisplay_Free(m_displayBot3);
+		m_displayBot3 = NULL;
+	}
+	
+	CDialogEx::OnClose();
+}
+
+int CRcutSetDLg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+	return 0;
+}
+
+BOOL CRcutSetDLg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitDisplay();
+
+	InitMenu();
+
+	InitPanel();
+
+	InitPanel_BRK();
+
+	m_eDir = DIMENSION_NONE;
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CRcutSetDLg::InitDisplay(void) {
+	/* code */
+	m_displayTop1 = ClsDisplay_Create();
+	if (nullptr != m_displayTop1) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT);
+		pDispWnd->GetWindowRect(rect);
+		m_displayTop1->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayTop1->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayTop1->SetDraw("fill", DISP_OBJECT);
+		m_displayTop1->SetColor("red", DISP_OBJECT);
+
+		m_displayTop1->SetDraw("fill", DISP_REGION);
+		m_displayTop1->SetColor("red", DISP_REGION);
+
+		m_displayTop1->SetDraw("fill", DISP_CROSS);
+		m_displayTop1->SetColor("green", DISP_CROSS);
+
+		m_displayTop1->SetDraw("fill", DISP_SELECT);
+		m_displayTop1->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayTop1->SetBackgroundColor(color);
+	}
+
+	m_displayTop2 = ClsDisplay_Create();
+	if (nullptr != m_displayTop2) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT_CHIP);
+		pDispWnd->GetWindowRect(rect);
+		m_displayTop2->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayTop2->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayTop2->SetDraw("fill", DISP_OBJECT);
+		m_displayTop2->SetColor("red", DISP_OBJECT);
+
+		m_displayTop2->SetDraw("fill", DISP_REGION);
+		m_displayTop2->SetColor("red", DISP_REGION);
+
+		m_displayTop2->SetDraw("fill", DISP_CROSS);
+		m_displayTop2->SetColor("green", DISP_CROSS);
+
+		m_displayTop2->SetDraw("fill", DISP_SELECT);
+		m_displayTop2->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayTop2->SetBackgroundColor(color);
+	}
+
+	m_displayTop3 = ClsDisplay_Create();
+	if (nullptr != m_displayTop3) {
+		CRect rect;
+		CWnd* pDispWnd = GetDlgItem(IDC_STATIC_TOP_RCUT_BRK);
+		pDispWnd->GetWindowRect(rect);
+		m_displayTop3->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayTop3->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayTop3->SetDraw("fill", DISP_OBJECT);
+		m_displayTop3->SetColor("red", DISP_OBJECT);
+
+		m_displayTop3->SetDraw("fill", DISP_REGION);
+		m_displayTop3->SetColor("red", DISP_REGION);
+
+		m_displayTop3->SetDraw("fill", DISP_CROSS);
+		m_displayTop3->SetColor("green", DISP_CROSS);
+
+		m_displayTop3->SetDraw("fill", DISP_SELECT);
+		m_displayTop3->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayTop3->SetBackgroundColor(color);
+	}
+
+	m_displayBot1 = ClsDisplay_Create();
+	if (nullptr != m_displayBot1) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT2);
+		pDispWnd->GetWindowRect(rect);
+		m_displayBot1->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayBot1->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayBot1->SetDraw("fill", DISP_OBJECT);
+		m_displayBot1->SetColor("red", DISP_OBJECT);
+
+		m_displayBot1->SetDraw("fill", DISP_REGION);
+		m_displayBot1->SetColor("red", DISP_REGION);
+
+		m_displayBot1->SetDraw("fill", DISP_CROSS);
+		m_displayBot1->SetColor("green", DISP_CROSS);
+
+		m_displayBot1->SetDraw("fill", DISP_SELECT);
+		m_displayBot1->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayBot1->SetBackgroundColor(color);
+	}
+
+	m_displayBot2 = ClsDisplay_Create();
+	if (nullptr != m_displayBot2) {
+		CRect rect;
+		CWnd * pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT_CHIP);
+		pDispWnd->GetWindowRect(rect);
+		m_displayBot2->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayBot2->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayBot2->SetDraw("fill", DISP_OBJECT);
+		m_displayBot2->SetColor("red", DISP_OBJECT);
+
+		m_displayBot2->SetDraw("fill", DISP_REGION);
+		m_displayBot2->SetColor("red", DISP_REGION);
+
+		m_displayBot2->SetDraw("fill", DISP_CROSS);
+		m_displayBot2->SetColor("green", DISP_CROSS);
+
+		m_displayBot2->SetDraw("fill", DISP_SELECT);
+		m_displayBot2->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayBot2->SetBackgroundColor(color);
+	}
+
+	m_displayBot3 = ClsDisplay_Create();
+	if (nullptr != m_displayBot3) {
+		CRect rect;
+		CWnd* pDispWnd = GetDlgItem(IDC_STATIC_BOT_RCUT_BRK);
+		pDispWnd->GetWindowRect(rect);
+		m_displayBot3->OpenWindow((__int64)pDispWnd->m_hWnd, rect.Width(), rect.Height());
+		m_displayBot3->SetOperFlag(SELECT_OPER_FLAG);
+		m_displayBot3->SetDraw("fill", DISP_OBJECT);
+		m_displayBot3->SetColor("red", DISP_OBJECT);
+
+		m_displayBot3->SetDraw("fill", DISP_REGION);
+		m_displayBot3->SetColor("red", DISP_REGION);
+
+		m_displayBot3->SetDraw("fill", DISP_CROSS);
+		m_displayBot3->SetColor("green", DISP_CROSS);
+
+		m_displayBot3->SetDraw("fill", DISP_SELECT);
+		m_displayBot3->SetColor("red", DISP_SELECT);
+
+		std::string color = ClsVision::Rgb2Color(0, 0, 100);
+		m_displayBot3->SetBackgroundColor(color);
+	}
+}
+
+void CRcutSetDLg::InitMenu(void) {
+	/* code */
+	m_visionMenu.LoadMenu(IDR_MENU1);
+}
+
+BOOL CRcutSetDLg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CRcutSetDLg::OnBnClickedButtonProcessRcut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveRcutParam();
+	if (NULL == m_dot) return;
+
+//	Log_GetDebug()->TraceInfo("Start: %d", __LINE__);
+	m_dot->execute(m_eDir);
+//	Log_GetDebug()->TraceInfo("End: %d", __LINE__);
+
+	ShowRcutImage();
+
+	DispResult();
+}
+
+void CRcutSetDLg::DispResult(void) {
+	/* code */
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	DispAllResult();
+}
+
+void CRcutSetDLg::DispAllResult(void) {
+	/* code */
+	int nCount = 2;
+	for (int i = 0; i < nCount; i++) {
+		CRcutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelRcut.SetItemText(id, 12, _T("NAN"));
+		}
+		else {   //显示结果
+			CString strResult;
+			strResult.Format(_T("%d"), (int)dot->m_nNgInfo.size());
+			int id = dot->getID();
+			m_PanelRcut.SetItemText(id, 12, strResult);
+		}
+	}
+
+	m_PanelRcut.Invalidate(FALSE);
+}
+
+void CRcutSetDLg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. name
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+
+	//4. Chamfer Size
+	strText = _T("Chamber Size");
+	m_vParams.push_back(strText);
+	//5. Bin Thres
+	strText = _T("Edge Thres");
+	m_vParams.push_back(strText);
+
+	//6. Chip Range
+	strText = _T("Chip Range");
+	m_vParams.push_back(strText);
+	//7. Chip Thres
+	strText = _T("Chip Thres");
+	m_vParams.push_back(strText);
+	//8. Chip Smooth
+	strText = _T("Chip Smooth");
+	m_vParams.push_back(strText);
+
+	//9. Start Da
+	strText = _T("Start Da");
+	m_vParams.push_back(strText);
+	//10.End Da
+	strText = _T("End Da");
+	m_vParams.push_back(strText);
+
+	// 11.Dx
+	strText = _T("Dx(um)");
+	m_vParams.push_back(strText);
+	// 12.Dy
+	strText = _T("Dy(um)");
+	m_vParams.push_back(strText);
+
+	// 13.Result
+	strText = _T("Result");
+	m_vParams.push_back(strText);
+
+	int nRows = 3;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelRcut.DeleteAllItems();
+	m_PanelRcut.SetVirtualMode(FALSE);
+	m_PanelRcut.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelRcut.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelRcut.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelRcut.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelRcut.SetRowCount(nRows);
+	m_PanelRcut.SetColumnCount(nCols);
+	m_PanelRcut.SetFixedRowCount(nFixRows);
+	m_PanelRcut.SetFixedColumnCount(1);
+	m_PanelRcut.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelRcut.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelRcut.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelRcut.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelRcut.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelRcut.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelRcut.SetColumnWidth(nColIdx, 115);
+		}
+		else if (0 == i) {
+			m_PanelRcut.SetColumnWidth(nColIdx, 50);
+		}
+		else if (2 == i) {
+			m_PanelRcut.SetColumnWidth(nColIdx, 60);
+		}
+		else {
+			m_PanelRcut.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelRcut.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++) {
+		m_PanelRcut.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CRcutSetDLg::InitPanel_BRK(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//3. Sigma
+	strText = _T("Auto Sigma");
+	m_vParams.push_back(strText);
+	//4. Noise Size
+	strText = _T("Noise Size");
+	m_vParams.push_back(strText);
+	//5. Dist Thres
+	strText = _T("Dist Thres");
+	m_vParams.push_back(strText);
+	//6. Smooth
+	strText = _T("Smooth");
+	m_vParams.push_back(strText);
+	//7. Start Da
+	strText = _T("Start Da");
+	m_vParams.push_back(strText);
+	//8. End Da
+	strText = _T("End Da");
+	m_vParams.push_back(strText);
+	//9. Area
+	strText = _T("Area Thres");
+	m_vParams.push_back(strText);
+	//10.Tech use
+	strText = _T("Tech use");
+	m_vParams.push_back(strText);
+
+	int nRows = 3;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelBroken.DeleteAllItems();
+	m_PanelBroken.SetVirtualMode(FALSE);
+	m_PanelBroken.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelBroken.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelBroken.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelBroken.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelBroken.SetRowCount(nRows);
+	m_PanelBroken.SetColumnCount(nCols);
+	m_PanelBroken.SetFixedRowCount(nFixRows);
+	m_PanelBroken.SetFixedColumnCount(1);
+	m_PanelBroken.SetFixedColumnCount(nFixCols);
+
+	CFont* pFont = m_PanelRcut.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelBroken.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelBroken.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelBroken.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelBroken.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		m_PanelBroken.SetColumnWidth(nColIdx, 75);
+		strText = m_vParams[i];
+		m_PanelBroken.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++) {
+		m_PanelBroken.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CRcutSetDLg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveRcutParam();
+
+	//m_dotRCUT = NULL;
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getCornerRcutProcess(eDir);
+	m_dotTop = m_dot->m_dots[0];
+	m_dotBot = m_dot->m_dots[1];
+
+	ShowRcutParam();
+	ShowRcutImage();
+}
+
+void CRcutSetDLg::SaveRcutParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	UpdateData(TRUE);
+
+	CString strText;
+	for (int i = 0; i < 2; i++) {
+		CRcutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		//USE
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+        dot->m_nBrokenUse = _wtoi(strText);
+		idx += 1;
+
+		//3. USE
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		//Sigma
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+        dot->m_fSigmaThres = _wtof(strText);
+		idx += 1;
+
+		//4.  Chamfer Size
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nChamferSize = _wtoi(strText);
+		//Noise Size
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_fOpenPara = _wtof(strText);
+		idx += 1;
+
+		//5. bin Thres
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nBinThres = _wtoi(strText);
+		//Dist Thres
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nDistThres = _wtoi(strText);
+		idx += 1;
+
+		//6. Chip Range
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nChipRange = _wtoi(strText);
+		//Broke Smooth
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nBrokenSmooth = _wtoi(strText);
+		idx += 1;
+
+		//7. Chip Thres
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nChipThres = _wtoi(strText);
+		//Start Da
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+        dot->m_nStartDa = _wtoi(strText);
+		idx += 1;
+
+		//8. Smooth
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nEdgeSmooth = _wtoi(strText);
+		//End Da
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nEndDa = _wtoi(strText);
+		idx += 1;
+
+		//9.Start Da
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nStartAngle = _wtoi(strText);
+		//Broken Area
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nBrokenArea = _wtoi(strText);
+		idx += 1;
+
+		//10.End Da
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nEndAngle = _wtoi(strText);
+		//Tech Area
+		strText = m_PanelBroken.GetItemText(idRow, idx);
+		dot->m_nTech = _wtoi(strText);
+		idx += 1;
+
+		//11. Dx
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nDx = _wtoi(strText);
+		idx += 1;
+
+		//12. Dy
+		strText = m_PanelRcut.GetItemText(idRow, idx);
+		dot->m_nDy = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+void CRcutSetDLg::ShowRcutParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	CString strText;
+	for (int i = 0; i < 2; i++) {
+		CRcutDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//ID
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//USE
+		strText.Format(_T("%d"), dot->m_nBrokenUse);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Sigma
+        strText.Format(_T("%.1f"), dot->m_fSigmaThres);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. Chamfer Size
+		strText.Format(_T("%d"), dot->m_nChamferSize);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Noise Size
+		strText.Format(_T("%.1f"), dot->m_fOpenPara);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Edge Thres
+		strText.Format(_T("%d"), dot->m_nBinThres);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Dist Thres
+		strText.Format(_T("%d"), dot->m_nDistThres);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Chip Range
+		strText.Format(_T("%d"), dot->m_nChipRange);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Broken Smooth
+		strText.Format(_T("%d"), dot->m_nBrokenSmooth);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. Chip Thres
+		strText.Format(_T("%d"), dot->m_nChipThres);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Start Da
+		strText.Format(_T("%d"), dot->m_nStartDa);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Chip Smooth
+		strText.Format(_T("%d"), dot->m_nEdgeSmooth);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//End Da
+		strText.Format(_T("%d"), dot->m_nEndDa);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Start Da
+		strText.Format(_T("%d"), dot->m_nStartAngle);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Break Area
+		strText.Format(_T("%d"), dot->m_nBrokenArea);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. End Da
+		strText.Format(_T("%d"), dot->m_nEndAngle);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		//Tech Use
+		strText.Format(_T("%d"), dot->m_nTech);
+		m_PanelBroken.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//11. Dx
+		strText.Format(_T("%d"), dot->m_nDx);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//12. Dy
+		strText.Format(_T("%d"), dot->m_nDy);
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//13. Result
+		strText.Format(_T("%d"), (int)(dot->m_nNgInfo.size()));
+		m_PanelRcut.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+void CRcutSetDLg::OnEditroiImageroi()
+{
+	// TODO: 在此添加命令处理程序代码
+	CVisionSetDlg *pMainDlg = (CVisionSetDlg *)(CVisionRecipe::getInstance()->GetMainDlg());
+	if (NULL == pMainDlg) return;
+}
+
+void CRcutSetDLg::ShowRcutImage(void) {
+	/* code */
+	if (NULL != m_dotTop) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_dotTop->getImage(), width, height);
+
+		if (NULL != m_displayTop1 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayTop1->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayTop1->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayTop1->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayTop1->GetSelect());
+
+			m_displayTop1->UnableFlush();
+			m_displayTop1->ClearWindow();
+			m_displayTop1->AutoWindowSize(width, height);
+			m_displayTop1->SetImage(m_dotTop->getImage());
+			m_displayTop1->SetRegion(m_dotTop->getRoiRegion());
+			m_displayTop1->DispImage();
+			m_displayTop1->DispRegion();
+			m_displayTop1->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayTop1) {
+				m_displayTop1->UnableFlush();
+				m_displayTop1->ClearWindow();
+				m_displayTop1->DispImage();
+				m_displayTop1->DispRegion();;
+				m_displayTop1->AbleFlush();
+			}
+		}
+
+
+		if (NULL != m_displayTop2 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayTop2->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayTop2->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayTop2->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayTop2->GetSelect());
+
+			m_displayTop2->UnableFlush();
+			m_displayTop2->ClearWindow();
+			m_displayTop2->AutoWindowSize(width, height);
+			m_displayTop2->SetImage(m_dotTop->getImage());
+			m_displayTop2->SetRegion(m_dotTop->getChipRegion());
+			m_displayTop2->DispImage();
+			m_displayTop2->DispRegion();
+			m_displayTop2->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayTop2) {
+				m_displayTop2->UnableFlush();
+				m_displayTop2->ClearWindow();
+				m_displayTop2->DispImage();
+				m_displayTop2->DispRegion();;
+				m_displayTop2->AbleFlush();
+			}
+		}
+
+
+		CString strChamber;
+		strChamber.Format(_T("Chamber: %.0f, (%.0f, %.0f)"), m_dotTop->m_fAvgChamber, m_dotTop->m_fMinChamber, m_dotTop->m_fMaxChamber);
+		GetDlgItem(IDC_STATIC_TOP_CHAMBER_RCUT)->SetWindowText(strChamber);
+	}
+
+	if (NULL != m_dotTop) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_dotTop->getImage(), width, height);
+
+		if (NULL != m_displayTop3 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayTop3->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayTop3->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayTop3->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayTop3->GetSelect());
+
+			m_displayTop3->UnableFlush();
+			m_displayTop3->ClearWindow();
+			m_displayTop3->AutoWindowSize(width, height);
+			m_displayTop3->SetImage(m_dotTop->getImage());
+			m_displayTop3->SetRegion(m_dotTop->getBRKRoiRegion());
+			m_displayTop3->DispImage();
+			m_displayTop3->DispRegion();
+			m_displayTop3->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayTop3) {
+				m_displayTop3->UnableFlush();
+				m_displayTop3->ClearWindow();
+				m_displayTop3->DispImage();
+				m_displayTop3->DispRegion();;
+				m_displayTop3->AbleFlush();
+			}
+		}
+	}
+
+	if (NULL != m_dotBot) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_dotBot->getImage(), width, height);
+
+
+		if (NULL != m_displayBot1 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayBot1->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayBot1->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayBot1->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayBot1->GetSelect());
+
+			m_displayBot1->UnableFlush();
+			m_displayBot1->ClearWindow();
+			m_displayBot1->AutoWindowSize(width, height);
+			m_displayBot1->SetImage(m_dotBot->getImage());
+			m_displayBot1->SetRegion(m_dotBot->getRoiRegion());
+			m_displayBot1->DispImage();
+			m_displayBot1->DispRegion();
+			m_displayBot1->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayBot1) {
+				m_displayBot1->UnableFlush();
+				m_displayBot1->ClearWindow();
+				m_displayBot1->DispImage();
+				m_displayBot1->DispRegion();;
+				m_displayBot1->AbleFlush();
+			}
+		}
+
+		if (NULL != m_displayBot2 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayBot2->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayBot2->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayBot2->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayBot2->GetSelect());
+
+			m_displayBot2->UnableFlush();
+			m_displayBot2->ClearWindow();
+			m_displayBot2->AutoWindowSize(width, height);
+			m_displayBot2->SetImage(m_dotBot->getImage());
+			m_displayBot2->SetRegion(m_dotBot->getChipRegion());
+			m_displayBot2->DispImage();
+			m_displayBot2->DispRegion();
+			m_displayBot2->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayBot2) {
+				m_displayBot2->UnableFlush();
+				m_displayBot2->ClearWindow();
+				m_displayBot2->DispImage();
+				m_displayBot2->DispRegion();;
+				m_displayBot2->AbleFlush();
+			}
+		}
+
+		CString strChamber;
+		strChamber.Format(_T("Chamber: %.0f, (%.0f, %.0f)"), m_dotBot->m_fAvgChamber,  m_dotBot->m_fMinChamber, m_dotBot->m_fMaxChamber);
+		GetDlgItem(IDC_STATIC_BOT_CHAMBER_RCUT)->SetWindowText(strChamber);
+	}
+
+	if (NULL != m_dotBot) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_dotBot->getImage(), width, height);
+
+
+		if (NULL != m_displayBot3 && width > 1 && height > 1) {
+			HalconCpp::GenEmptyObj(&m_displayBot3->GetImage());
+			HalconCpp::GenEmptyObj(&m_displayBot3->GetRegion());
+			HalconCpp::GenEmptyObj(&m_displayBot3->GetCross());
+			HalconCpp::GenEmptyObj(&m_displayBot3->GetSelect());
+
+			m_displayBot3->UnableFlush();
+			m_displayBot3->ClearWindow();
+			m_displayBot3->AutoWindowSize(width, height);
+			m_displayBot3->SetImage(m_dotBot->getImage());
+			m_displayBot3->SetRegion(m_dotBot->getBRKRoiRegion());
+			m_displayBot3->DispImage();
+			m_displayBot3->DispRegion();
+			m_displayBot3->AbleFlush();
+		}
+		else {
+			if (NULL != m_displayBot3) {
+				m_displayBot3->UnableFlush();
+				m_displayBot3->ClearWindow();
+				m_displayBot3->DispImage();
+				m_displayBot3->DispRegion();;
+				m_displayBot3->AbleFlush();
+			}
+		}
+	}
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonSetImageRcut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+	if (NULL == m_dot) return;
+	if (NULL == m_dotTop) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	m_dotTop->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+
+	m_dotTop->TechImage();
+
+	ShowRcutImage();
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonSaveRcut()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonSetImageRcut2()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+	if (NULL == m_dot) return;
+	if (NULL == m_dotBot) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	m_dotBot->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+
+	m_dotBot->TechImage();
+
+	ShowRcutImage();
+
+#if 0
+	int nPosX = (int)(0.5 * (x1 + x2));
+	int nPosY = (int)(0.5 * (y1 + y2));
+	Point2I pose;
+	pose.x = nPosX;
+	pose.y = nPosY;
+	Point2I ptResult, ptTop, ptBot;
+	CSoftVisionApp::getInstance()->transformToStandard(m_eDir, pose, ptResult, ptTop, ptBot);
+
+	Point2I point = ptBot;
+	int width = x2 - x1 + 1;
+	int height = y2 - y1 + 1;
+	m_dotBot->setRegion(point.x, point.y, width, height);
+	m_dotBot->TechImage();
+
+	ShowRcutImage();
+#endif
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonTopTrain()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+	if (NULL == m_dot) return;
+	if (NULL == m_dotTop) return;
+
+	Point2I offset;
+	offset.x = 0;
+	offset.y = 0;
+//	Log_GetDebug()->TraceInfo("Start Inspect: %d", __LINE__);
+	m_dotTop->Execute(m_eDir, offset);
+//	Log_GetDebug()->TraceInfo("End Inspect: %d", __LINE__);
+	ShowRcutImage();
+
+	DispResult();
+}
+
+
+void CRcutSetDLg::OnBnClickedButtonTopTrain2()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveRcutParam();
+
+	if (NULL == m_dot) return;
+	if (NULL == m_dotBot) return;
+	Point2I offset;
+	offset.x = 0;
+	offset.y = 0;
+
+	m_dotBot->Execute(m_eDir, offset);
+
+	ShowRcutImage();
+
+	DispResult();
+}
+
+void CRcutSetDLg::OnBnClickedBtnTopSetStd()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (nullptr == m_dotTop) return;
+	SaveRcutParam();
+	if (1 != m_dotTop->m_nTech) {
+		GetDlgItem(IDC_STATIC_TOP_TECH)->SetWindowTextW(_T("Set Standard Failed!"));
+		return;
+	}
+
+	m_dotTop->SetStandardPoint();
+	GetDlgItem(IDC_STATIC_TOP_TECH)->SetWindowTextW(_T("Set Standard Success!"));
+}
+
+
+void CRcutSetDLg::OnBnClickedBtnBotSetStd()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (nullptr == m_dotBot) return;
+	SaveRcutParam();
+	if (1 != m_dotBot->m_nTech) {
+		GetDlgItem(IDC_STATIC_BOT_TECH)->SetWindowTextW(_T("Set Standard Failed!"));
+		return;
+	}
+
+	m_dotBot->SetStandardPoint();
+	GetDlgItem(IDC_STATIC_BOT_TECH)->SetWindowTextW(_T("Set Standard Success!"));
+}
diff --git a/Common_Class/BlVisionPro/View/RcutSetDLg.h b/Common_Class/BlVisionPro/View/RcutSetDLg.h
new file mode 100644
index 0000000..bb564ad
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/RcutSetDLg.h
@@ -0,0 +1,90 @@
+#pragma once
+
+
+// CRcutSetDLg 对话框
+#include "VisionRecipe.h"
+#include "afxwin.h"
+
+#include "CornerRcutProcess.h"
+#include "RcutDotProcess.h"
+#include "afxcmn.h"
+
+class CRcutSetDLg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CRcutSetDLg)
+
+public:
+	CRcutSetDLg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CRcutSetDLg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_RCUT_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	DimensionDir m_eDir;
+	CMenu m_visionMenu;
+	IClsDisplay *m_displayTop1;
+	IClsDisplay *m_displayTop2;
+	IClsDisplay *m_displayTop3;
+
+	IClsDisplay *m_displayBot1;
+	IClsDisplay *m_displayBot2;
+    IClsDisplay *m_displayBot3;
+
+	CGridCtrl	m_PanelRcut;
+	CGridCtrl	m_PanelBroken;
+	CCornerRcutProcess *m_dot;
+	CRcutDotProcess *m_dotTop;
+	CRcutDotProcess *m_dotBot;
+
+	std::vector<CString> m_vParams;
+
+private:
+	//1. 初始化
+	void InitDisplay(void);
+
+	//2. 初始化菜单
+	void InitMenu(void);
+
+	//3. 初始化
+	void InitPanel(void);
+	void InitPanel_BRK(void);
+
+	//4. //保存数据
+	void SaveRcutParam(void);
+
+	//6. 显示参数
+	void ShowRcutParam(void);
+
+	//7. 显示画面
+	void ShowRcutImage(void);
+
+	//8. 显示结果
+	void DispResult(void);
+
+	//4. 显示区域
+	void DispAllResult(void);
+
+public:
+	afx_msg void OnClose();
+	int setDimensionDir(DimensionDir eDir);
+	void ChangeVisionType(DimensionDir eDir);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnBnClickedButtonProcessRcut();
+	afx_msg void OnEditroiImageroi();
+	afx_msg void OnBnClickedButtonSetImageRcut();;
+	afx_msg void OnBnClickedButtonSaveRcut();
+	afx_msg void OnBnClickedButtonSetImageRcut2();
+	afx_msg void OnBnClickedButtonTopTrain();
+	afx_msg void OnBnClickedButtonTopTrain2();
+	afx_msg void OnBnClickedBtnTopSetStd();
+	afx_msg void OnBnClickedBtnBotSetStd();
+};
diff --git a/Common_Class/BlVisionPro/View/ScanSetDlg.cpp b/Common_Class/BlVisionPro/View/ScanSetDlg.cpp
new file mode 100644
index 0000000..c42e24d
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/ScanSetDlg.cpp
@@ -0,0 +1,191 @@
+// ScanSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "ScanSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "TranformCoordinate.h"
+
+
+// CScanSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CScanSetDlg, CDialogEx)
+
+CScanSetDlg::CScanSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_SCAN_SET, pParent)
+{
+
+}
+
+CScanSetDlg::~CScanSetDlg()
+{
+}
+
+void CScanSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_COMBO_STD_POINT_SCAN, m_combStdPoint);
+	DDX_Control(pDX, IDC_COMBO_POINT1_SCAN, m_combScanPoint1);
+	DDX_Control(pDX, IDC_COMBO_POINT2_SCAN, m_combScanPoint2);
+	DDX_Control(pDX, IDC_COMBO_POINT3_SCAN, m_combScanPoint3);
+	DDX_Control(pDX, IDC_COMBO_POINT4_SCAN, m_combScanPoint4);
+	DDX_Control(pDX, IDC_COMBO_LENTH_SCAN, m_combLengthScan);
+	DDX_Control(pDX, IDC_COMBO_SHORT_SCAN, m_combShortScan);
+	DDX_Control(pDX, IDC_COMBO1, m_combScanEdge);
+}
+
+
+BEGIN_MESSAGE_MAP(CScanSetDlg, CDialogEx)
+	ON_BN_CLICKED(IDC_BUTTON_CANCEL_SCAN, &CScanSetDlg::OnBnClickedButtonCancelScan)
+	ON_BN_CLICKED(IDC_BUTTON_SAVE_SCAN, &CScanSetDlg::OnBnClickedButtonSaveScan)
+	ON_WM_CLOSE()
+	ON_BN_CLICKED(IDC_BUTTON_TEST_SCAN, &CScanSetDlg::OnBnClickedButtonTestScan)
+END_MESSAGE_MAP()
+
+
+// CScanSetDlg 消息处理程序
+
+
+BOOL CScanSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CScanSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitWindowUi();
+
+	SetParamsUi();
+
+	this->SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CScanSetDlg::InitWindowUi(void) {
+	/* code */
+	m_combStdPoint.InsertString(0, _T("C1"));
+	m_combStdPoint.InsertString(1, _T("C2"));
+	m_combStdPoint.InsertString(2, _T("C3"));
+	m_combStdPoint.InsertString(3, _T("C4"));
+
+	m_combScanPoint1.InsertString(0, _T("C1"));
+	m_combScanPoint1.InsertString(1, _T("C2"));
+	m_combScanPoint1.InsertString(2, _T("C3"));
+	m_combScanPoint1.InsertString(3, _T("C4"));
+
+	m_combScanPoint2.InsertString(0, _T("C1"));
+	m_combScanPoint2.InsertString(1, _T("C2"));
+	m_combScanPoint2.InsertString(2, _T("C3"));
+	m_combScanPoint2.InsertString(3, _T("C4"));
+
+	m_combScanPoint3.InsertString(0, _T("C1"));
+	m_combScanPoint3.InsertString(1, _T("C2"));
+	m_combScanPoint3.InsertString(2, _T("C3"));
+	m_combScanPoint3.InsertString(3, _T("C4"));
+
+	m_combScanPoint4.InsertString(0, _T("C1"));
+	m_combScanPoint4.InsertString(1, _T("C2"));
+	m_combScanPoint4.InsertString(2, _T("C3"));
+	m_combScanPoint4.InsertString(3, _T("C4"));
+
+	m_combLengthScan.InsertString(0, _T("Move Left"));
+	m_combLengthScan.InsertString(1, _T("Move Right"));
+
+	m_combShortScan.InsertString(0, _T("Move Down"));
+	m_combShortScan.InsertString(1, _T("Move Up"));
+
+	m_combScanEdge.InsertString(0, _T("TopA"));
+	m_combScanEdge.InsertString(1, _T("TopB"));
+	m_combScanEdge.InsertString(2, _T("TopC"));
+	m_combScanEdge.InsertString(3, _T("TopD"));
+	m_combScanEdge.InsertString(4, _T("BotA"));
+	m_combScanEdge.InsertString(5, _T("BotB"));
+	m_combScanEdge.InsertString(6, _T("BotC"));
+	m_combScanEdge.InsertString(7, _T("BotD"));
+	m_combScanEdge.SetCurSel(1);
+	SetDlgItemInt(IDC_EDIT_POSX_SCAN, 100);
+	SetDlgItemInt(IDC_EDIT_POSY_SCAN, 50);
+}
+
+void CScanSetDlg::SetParamsUi(void) {
+	/* code */
+	ScanSetting inf = CVisionRecipe::getInstance()->getScanSetting();
+
+	m_combStdPoint.SetCurSel(inf.nStdIndex);
+	m_combScanPoint1.SetCurSel(inf.nIndex0);
+	m_combScanPoint2.SetCurSel(inf.nIndex1);
+	m_combScanPoint3.SetCurSel(inf.nIndex2);
+	m_combScanPoint4.SetCurSel(inf.nIndex3);
+	m_combLengthScan.SetCurSel(inf.nLengthScan);
+	m_combShortScan.SetCurSel(inf.nShortScan);
+	SetDlgItemInt(IDC_EDIT_LENGTH_PRODUCT, inf.lengthSize);
+	SetDlgItemInt(IDC_EDIT_SHORT_PRODUCT, inf.shortSize);
+}
+
+
+void CScanSetDlg::OnBnClickedButtonCancelScan()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SetParamsUi();
+}
+
+void CScanSetDlg::SaveParams(void) {
+	/* code */
+	ScanSetting inf;
+	inf.nStdIndex = m_combStdPoint.GetCurSel();
+	inf.nIndex0 = m_combScanPoint1.GetCurSel();
+	inf.nIndex1 = m_combScanPoint2.GetCurSel();
+	inf.nIndex2 = m_combScanPoint3.GetCurSel();
+	inf.nIndex3 = m_combScanPoint4.GetCurSel();
+	inf.nLengthScan = m_combLengthScan.GetCurSel();
+	inf.nShortScan = m_combShortScan.GetCurSel();
+	inf.lengthSize = GetDlgItemInt(IDC_EDIT_LENGTH_PRODUCT);
+	inf.shortSize = GetDlgItemInt(IDC_EDIT_SHORT_PRODUCT);
+	CVisionRecipe::getInstance()->setScanSetting(inf);
+}
+
+
+void CScanSetDlg::OnBnClickedButtonSaveScan()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveParams();
+
+	CVisionRecipe::getInstance()->saveVisionConfig();
+}
+
+
+void CScanSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+
+	CDialogEx::OnClose();
+}
+
+
+void CScanSetDlg::OnBnClickedButtonTestScan()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveParams();
+	Point2I pose;
+	pose.x = GetDlgItemInt(IDC_EDIT_POSX_SCAN);
+	pose.y = GetDlgItemInt(IDC_EDIT_POSY_SCAN);
+	CTranformCoordinate tf;
+	Point2I result = tf.tfPose((DimensionDir)m_combScanEdge.GetCurSel(), pose);
+	Log_GetDebug()->TraceInfo("Result %d: (%d, %d), %d", m_combScanEdge.GetCurSel(), result.x, result.y, __LINE__);
+
+}
diff --git a/Common_Class/BlVisionPro/View/ScanSetDlg.h b/Common_Class/BlVisionPro/View/ScanSetDlg.h
new file mode 100644
index 0000000..4347a05
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/ScanSetDlg.h
@@ -0,0 +1,55 @@
+#pragma once
+#include "afxwin.h"
+
+
+// CScanSetDlg 对话框
+
+class CScanSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CScanSetDlg)
+
+public:
+	CScanSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CScanSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_SCAN_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	CComboBox m_combStdPoint;
+	CComboBox m_combScanPoint1;
+	CComboBox m_combScanPoint2;
+	CComboBox m_combScanPoint3;
+	CComboBox m_combScanPoint4;
+	CComboBox m_combLengthScan;
+	CComboBox m_combShortScan;
+
+
+	CComboBox m_combScanEdge;
+
+private:
+	//1. 初始化窗体
+	void InitWindowUi(void);
+
+	//2. 设置参数
+	void SetParamsUi(void);
+
+	//3. 保存参数
+	void SaveParams(void);
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL OnInitDialog();
+
+	afx_msg void OnBnClickedButtonCancelScan();
+	afx_msg void OnBnClickedButtonSaveScan();
+	afx_msg void OnClose();
+	afx_msg void OnBnClickedButtonTestScan();
+};
diff --git a/Common_Class/BlVisionPro/View/ThresSetDlg.cpp b/Common_Class/BlVisionPro/View/ThresSetDlg.cpp
new file mode 100644
index 0000000..71e5da4
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/ThresSetDlg.cpp
@@ -0,0 +1,384 @@
+// ThresSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "ThresSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionRecipe.h"
+#include "SoftVisionApp.h"
+
+
+// CThresSetDlg 对话框
+
+IMPLEMENT_DYNAMIC(CThresSetDlg, CDialogEx)
+
+CThresSetDlg::CThresSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_THRES_SET, pParent)
+{
+	m_dot = NULL;
+	m_eDir = DIMENSION_NONE;
+}
+
+CThresSetDlg::~CThresSetDlg()
+{
+}
+
+void CThresSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_PANEL_THRES_INFO, m_PanelThres);
+}
+
+
+BEGIN_MESSAGE_MAP(CThresSetDlg, CDialogEx)
+	ON_WM_DESTROY()
+	ON_BN_CLICKED(IDC_BUTTON_THRES_SAVE, &CThresSetDlg::OnBnClickedButtonThresSave)
+	ON_BN_CLICKED(IDC_BUTTON_THRES_ROI_SET, &CThresSetDlg::OnBnClickedButtonThresRoiSet)
+	ON_BN_CLICKED(IDC_BUTTON_THRES_PROCESS, &CThresSetDlg::OnBnClickedButtonThresProcess)
+END_MESSAGE_MAP()
+
+
+// CThresSetDlg 消息处理程序
+
+
+BOOL CThresSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitPanel();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+
+BOOL CThresSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+void CThresSetDlg::OnDestroy()
+{
+	CDialogEx::OnDestroy();
+
+	// TODO: 在此处添加消息处理程序代码
+}
+
+int CThresSetDlg::setDimensionDir(DimensionDir eDir) {
+	/* code */
+	ChangeVisionType(eDir);
+
+	return 0;
+}
+
+void CThresSetDlg::InitPanel(void) {
+	/* code */
+	m_vParams.clear();
+
+	CString strText;
+	//1. ID
+	strText = _T("ID.");
+	m_vParams.push_back(strText);
+	//2. Name
+	strText = _T("Name");
+	m_vParams.push_back(strText);
+	//3. use
+	strText = _T("use");
+	m_vParams.push_back(strText);
+	//4. use
+	strText = _T("Pos type");
+	m_vParams.push_back(strText);
+	//5. Min Thres
+	strText = _T("Min Thres");
+	m_vParams.push_back(strText);
+	//6. Max Thres
+	strText = _T("Max Thres");
+	m_vParams.push_back(strText);
+	//7. Max Thres
+	strText = _T("Smooth");
+	m_vParams.push_back(strText);
+	//8. Pos X
+	strText = _T("X Size(um)");
+	m_vParams.push_back(strText);
+	//9. Pos Y
+	strText = _T("Y Size(um)");
+	m_vParams.push_back(strText);
+	//10.Result
+	strText = _T("Result");
+	m_vParams.push_back(strText);
+
+	int nRows = 13;
+	int nCols = (int)(m_vParams.size());
+	int nFixRows = 1;
+	int nFixCols = 0;
+	int nRowIdx = 0;
+	int nColIdx = 0;
+
+	m_PanelThres.DeleteAllItems();
+	m_PanelThres.SetVirtualMode(FALSE);
+	m_PanelThres.GetDefaultCell(TRUE, FALSE)->SetBackClr(_gGridFixCellColor);
+	m_PanelThres.GetDefaultCell(FALSE, TRUE)->SetBackClr(_gGridFixCellColor);
+	m_PanelThres.GetDefaultCell(FALSE, FALSE)->SetBackClr(_gGridCellColor);
+	m_PanelThres.SetFixedTextColor(_gGridFixFontColor);
+
+	m_PanelThres.SetRowCount(nRows);
+	m_PanelThres.SetColumnCount(nCols);
+	m_PanelThres.SetFixedRowCount(nFixRows);
+	m_PanelThres.SetFixedColumnCount(nFixCols);
+
+	CFont *pFont = m_PanelThres.GetFont();
+	if (pFont) {
+		LOGFONT lf;
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy_s(lf.lfFaceName, _T("Malgun Gothic"));
+
+		m_PanelThres.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_PanelThres.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_PanelThres.GetDefaultCell(FALSE, FALSE)->SetFont(&lf);
+		m_PanelThres.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);
+	}
+
+	// Col
+	for (int i = 0; i < nCols; i++) {
+		if (1 == i) {
+			m_PanelThres.SetColumnWidth(nColIdx, 115);
+		}
+		else {
+			m_PanelThres.SetColumnWidth(nColIdx, 75);
+		}
+		strText = m_vParams[i];
+		m_PanelThres.SetItemText(nRowIdx, nColIdx++, strText);
+	}
+
+	for (int i = 1; i < nRows; i++) {
+		m_PanelThres.GetCell(i, 0)->SetState(GVIS_READONLY);
+	}
+}
+
+void CThresSetDlg::ChangeVisionType(DimensionDir eDir) {
+	/* code */
+	SaveThresParam();
+
+	m_eDir = eDir;
+	m_dot = CVisionRecipe::getInstance()->getThresProcess(eDir);
+
+	ShowThresParam();
+}
+
+void CThresSetDlg::ShowThresParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	CString strText;
+	for (int i = 0; i < 12; i++) {
+		CThresDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText.Format(_T("%d"), dot->getID());
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//2. Name
+		strText = dot->m_strName;
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//3. USE
+		strText.Format(_T("%d"), dot->m_nUse);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//4. pose type
+		strText.Format(_T("%d"), dot->m_poseType);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//5. Min Thres
+		strText.Format(_T("%d"), dot->m_minThres);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//6. Max Thres
+		strText.Format(_T("%d"), dot->m_maxThres);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//7. smooth
+		strText.Format(_T("%d"), dot->m_nSmoothSize);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//8. Min SizeX
+		strText.Format(_T("%d"), dot->m_minSizeX);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//9. Min SizeY
+		strText.Format(_T("%d"), dot->m_minSizeY);
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+
+		//10. Result
+		strText.Format(_T("%.1f"), (int)(dot->m_nNgInfo.size()));
+		m_PanelThres.SetItemText(idRow, idx, strText);
+		idx += 1;
+	}
+
+	UpdateData(FALSE);
+}
+
+void CThresSetDlg::SaveThresParam(void) {
+	/* code */
+	if (DIMENSION_NONE == m_eDir) return;
+	if (NULL == m_dot) return;
+
+	CString strText;
+	for (int i = 0; i < 12; i++) {
+		CThresDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+
+		//1. ID
+		int idRow = dot->getID();
+		int idx = 0;
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		idx += 1;
+
+		//2. Name
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_strName = strText;
+		idx += 1;
+
+		//3. Use
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_nUse = _wtoi(strText);
+		idx += 1;
+
+		//4. pose type
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_poseType = _wtoi(strText);
+		idx += 1;
+
+		//5.Min Thres
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_minThres = _wtoi(strText);
+		idx += 1;
+
+		//6. Max Thres
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_maxThres = _wtoi(strText);
+		idx += 1;
+
+		//7.smooth
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_nSmoothSize = _wtoi(strText);
+		idx += 1;
+
+		//8. Min SizeX
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_minSizeX = _wtoi(strText);
+		idx += 1;
+
+		//9. Max SizeX
+		strText = m_PanelThres.GetItemText(idRow, idx);
+		dot->m_minSizeY = _wtoi(strText);
+		idx += 1;
+	}
+}
+
+
+void CThresSetDlg::OnBnClickedButtonThresSave()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	SaveThresParam();
+}
+
+
+void CThresSetDlg::OnBnClickedButtonThresRoiSet()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	if (NULL == m_dot) return;
+
+	CCellID selCell = m_PanelThres.GetFocusCell();
+	int id = selCell.row;
+	if (id < 1) return;
+
+	CThresDotProcess *dot = m_dot->m_dots[id - 1];
+	if (nullptr == dot) return;
+
+	//1. 发送信息
+	CSoftVisionApp::getInstance()->sendMessage(1, m_eDir);
+
+	//2. 获取位置信息
+	int x1 = 0;
+	int y1 = 0;
+	int x2 = 0;
+	int y2 = 0;
+	if (!CVisionRecipe::getInstance()->getFrame(x1, y1, x2, y2)) return;
+
+	dot->setRegion(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
+}
+
+
+void CThresSetDlg::OnBnClickedButtonThresProcess()
+{
+	// TODO: 在此添加控件通知处理程序代码
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		pSideData->m_vDispVisionResult.clear();
+	}
+
+	SaveThresParam();
+	if (nullptr == m_dot) return;
+
+	m_dot->execute(m_eDir);
+
+	DispResult();
+}
+
+void CThresSetDlg::DispResult(void) {
+	/* code */
+	CSoftVisionApp::getInstance()->sendMessage(2, m_eDir);
+
+	DispAllResult();
+}
+
+void CThresSetDlg::DispAllResult(void) {
+	/* code */
+	int nCount = 12;
+	for (int i = 0; i < nCount; i++) {
+		CThresDotProcess *dot = m_dot->m_dots[i];
+		if (NULL == dot) continue;
+		bool isDo = true;
+		if (1 != dot->m_nUse)  isDo = false;
+		if (!isDo) {
+			int id = dot->getID();
+			m_PanelThres.SetItemText(id, 9, _T("NAN"));
+		}
+		else {   //显示结果
+			CString strResult;
+			strResult.Format(_T("%d"), (int)dot->m_nNgInfo.size());
+			int id = dot->getID();
+			m_PanelThres.SetItemText(id, 9, strResult);
+		}
+	}
+
+	m_PanelThres.Invalidate(FALSE);
+}
diff --git a/Common_Class/BlVisionPro/View/ThresSetDlg.h b/Common_Class/BlVisionPro/View/ThresSetDlg.h
new file mode 100644
index 0000000..eb88876
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/ThresSetDlg.h
@@ -0,0 +1,59 @@
+#pragma once
+
+
+// CThresSetDlg 对话框
+#include "ThresProcess.h"
+
+class CThresSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CThresSetDlg)
+
+public:
+	CThresSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CThresSetDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_THRES_SET };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+public:
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnDestroy();
+
+	int setDimensionDir(DimensionDir eDir);
+	void ChangeVisionType(DimensionDir eDir);
+
+private:
+	CGridCtrl	m_PanelThres;
+	std::vector<CString> m_vParams;
+	CThresProcess *m_dot;
+	DimensionDir m_eDir;
+
+private:
+	//1. 初始化Panel
+	void InitPanel(void);
+
+	//2. 保存数据
+	void SaveThresParam(void);
+
+	//3. 显示数据
+	void ShowThresParam(void);
+
+	//4. 显示结果
+	void DispResult(void);
+
+	//5. 显示所有的结果
+	void DispAllResult(void);
+
+public:
+	afx_msg void OnBnClickedButtonThresSave();
+	afx_msg void OnBnClickedButtonThresRoiSet();
+	afx_msg void OnBnClickedButtonThresProcess();
+};
diff --git a/Common_Class/BlVisionPro/View/VisionSetDlg.cpp b/Common_Class/BlVisionPro/View/VisionSetDlg.cpp
new file mode 100644
index 0000000..46508bf
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/VisionSetDlg.cpp
@@ -0,0 +1,545 @@
+// VisionSetDlg.cpp : 实现文件
+//
+
+#include "stdafx.h"
+#include "BlVisionPro.h"
+#include "VisionSetDlg.h"
+#include "afxdialogex.h"
+#include "VisionBufferPro.h"
+#include "CornerDistSetDlg.h"
+#include "RcutSetDLg.h"
+#include "ScanSetDlg.h"
+#include "KeyVisionSetDlg.h"
+#include "LocSetDlg.h"
+#include "CutSetDlg.h"
+#include "KDistSetDlg.h"
+#include <WinUser.h>
+#include "GrindSetDlg.h"
+#include "LockSetDlg.h"
+#include "ChipInspectDlg.h"
+#include "ThresSetDlg.h"
+#include "HoleSetDlg.h"
+
+// CVisionSetDlg 对话框
+#define BUTTON_WIDTH 100  // 按钮的宽度
+#define BUTTON_HEIGHT 30  // 按钮的高度
+#define BUTTON_PADDING 1  // 按钮之间的间距
+
+IMPLEMENT_DYNAMIC(CVisionSetDlg, CDialogEx)
+
+CVisionSetDlg::CVisionSetDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(IDD_DIALOG_VISION_SET, pParent)
+{
+	m_pOpRoiDlg = NULL;
+	m_drawOperator.isDrawing = false;
+}
+
+CVisionSetDlg::~CVisionSetDlg()
+{
+	/* code */
+	int sz = (int)(m_pages.size());
+	for (int i = 0; i < sz; i++) {
+		delete m_pages[i];
+		m_pages[i] = nullptr;
+	}
+	m_pages.clear();
+
+	if (m_pOpRoiDlg != NULL) {
+		m_pOpRoiDlg->DestroyWindow();
+		delete m_pOpRoiDlg;
+		m_pOpRoiDlg = NULL;
+	}
+}
+
+void CVisionSetDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CVisionSetDlg, CDialogEx)
+	ON_WM_CLOSE()
+	ON_WM_MOVE()
+	ON_WM_CTLCOLOR()
+END_MESSAGE_MAP()
+
+
+// CVisionSetDlg 消息处理程序
+
+
+void CVisionSetDlg::OnClose()
+{
+	// TODO: 在此添加消息处理程序代码和/或调用默认值
+	int sz = (int)(m_pages.size());
+	for (int i = 0; i < sz; i++) {
+		m_pages[i]->ShowWindow(SW_HIDE);
+	}
+
+	CVisionRecipe::getInstance()->setVisionSetOpen(FALSE);
+
+	CDialogEx::OnClose();
+}
+
+void CVisionSetDlg::InitCreateWnd(void) {
+	/* code */
+	CStatic *pMainPanel = (CStatic *)GetDlgItem(IDC_STATIC_UI_V);
+
+	CVisionRecipe::getInstance()->SetMainDlg(this);
+
+	//1. 创建LOC
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CLocSetDlg *pDlg = new CLocSetDlg();
+		pDlg->Create(IDD_DIALOG_LOC_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//2. Grind
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CGrindSetDlg *pDlg = new CGrindSetDlg();
+		pDlg->Create(IDD_DIALOG_GRIND_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//3. KDist
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CKDistSetDlg *pDlg = new CKDistSetDlg();
+		pDlg->Create(IDD_DIALOG_DIST_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//4. CCUT
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CCutSetDlg *pDlg = new CCutSetDlg();
+		pDlg->Create(IDD_DIALOG_CUTLINE_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//5. RCUT
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CRcutSetDLg *pDlg = new CRcutSetDLg();
+		pDlg->Create(IDD_DIALOG_RCUT_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//6. 创建ThresSet
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CThresSetDlg *pDlg = new CThresSetDlg();
+		pDlg->Create(IDD_DIALOG_THRES_SET, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	//7. 创建Hole
+	{
+		AFX_MANAGE_STATE(AfxGetStaticModuleState());
+		CHoleSetDlg* pDlg = new CHoleSetDlg();
+		pDlg->Create(IDD_DIALOG_HOLE_INSPECT, pMainPanel);
+		m_pages.push_back((CDialogEx*)(pDlg));
+		pDlg->ShowWindow(SW_HIDE);
+	}
+
+	Resize();
+}
+
+#define PAGE_MARGIN_LEFT	12
+#define PAGE_MARGIN_TOP		0
+#define PAGE_MARGIN_RIGHT	12
+#define PAGE_MARGIN_BOTTOM	12
+void CVisionSetDlg::Resize(void) {
+	/* code */
+	CStatic *pMainPanel = (CStatic *)GetDlgItem(IDC_STATIC_UI_V);
+	if (NULL == pMainPanel) return;
+
+	CRect rcRect;
+	pMainPanel->GetWindowRect(rcRect);
+
+	for (auto item : m_pages) {
+		if (NULL == item) continue;
+
+		item->MoveWindow(rcRect.left + PAGE_MARGIN_LEFT, rcRect.top + PAGE_MARGIN_TOP,
+			rcRect.Width() - PAGE_MARGIN_LEFT - PAGE_MARGIN_RIGHT,
+			rcRect.Height() - PAGE_MARGIN_TOP - PAGE_MARGIN_BOTTOM);
+	}
+}
+
+void CVisionSetDlg::SetButtonsSize(std::vector<CButton*>& buttons)
+{
+	for (CButton* pButton : buttons)
+	{
+		if (pButton)
+		{
+			CRect rect;
+			pButton->GetWindowRect(&rect);
+			ScreenToClient(&rect);
+
+			pButton->MoveWindow(rect.left, rect.top, BUTTON_WIDTH, BUTTON_HEIGHT);
+		}
+	}
+}
+
+void CVisionSetDlg::UpdateButtonsLayout(std::vector<CButton*>& buttons, const std::vector<bool>& states)
+{
+	if (buttons.empty() || states.empty() || buttons.size() != states.size()) return;  // 确保按钮数组非空
+
+	// 获取第一个按钮的初始位置
+	CRect initialRect;
+	buttons[0]->GetWindowRect(&initialRect);
+	ScreenToClient(&initialRect); // 将屏幕坐标转换为客户区坐标
+
+	int currentX = initialRect.left;  // 以第一个按钮的X位置为起点
+	int currentY = initialRect.top;   // 以第一个按钮的Y位置为起点
+
+	// 遍历按钮,根据状态显示或隐藏
+	for (size_t i = 0; i < buttons.size(); ++i)
+	{
+		CButton* pButton = buttons[i];
+		if (pButton)
+		{
+			if (states[i]) // 如果状态为 true,显示按钮
+			{
+				// 显示按钮并调整它的位置
+				pButton->ShowWindow(SW_SHOW);
+				pButton->MoveWindow(currentX, currentY, BUTTON_WIDTH, BUTTON_HEIGHT);
+
+				// 更新下一按钮的位置
+				currentX += BUTTON_WIDTH + BUTTON_PADDING;
+			}
+			else // 如果状态为 false,隐藏按钮
+			{
+				pButton->ShowWindow(SW_HIDE);
+			}
+		}
+	}
+}
+
+BOOL CVisionSetDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  在此添加额外的初始化
+	InitCreateWnd();
+
+	m_eDir = DIMENSION_NONE;
+	m_eVisionType = VISION_NONE;
+	ChangeVisionPro(DIMENSION_A, VISION_LOC);
+
+	CButton* pMain = (CButton*)GetDlgItem(IDC_RDO_SIDE_A_TOP);
+	if (pMain && pMain->GetSafeHwnd())
+		pMain->SetCheck(1);
+
+	CButton* pVision = (CButton*)GetDlgItem(IDC_RDO_INSTYPE_LOC);
+	if (pVision && pVision->GetSafeHwnd())
+		pVision->SetCheck(1);
+
+	// 添加按钮组
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_LOC));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_GRIND));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_KDIST));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_CUT));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_RCUT));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_THRES));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_HOLE));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_IN_CHAMFER));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_TOP_CORNER));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_BOT_CORNER));
+
+	// 设置一组按钮的大小
+	SetButtonsSize(m_buttons);
+
+	ShowVisionType();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 异常: OCX 属性页应返回 FALSE
+}
+
+void CVisionSetDlg::ShowVisionType(void) {
+	/* code */
+	VisionDisplayInfo inf = CVisionRecipe::getInstance()->getVisionDisplay();
+	if (inf.isGrindDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_GRIND)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_GRIND)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isDistDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_KDIST)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_KDIST)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isCutDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_CUT)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_CUT)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isRcutDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_RCUT)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_RCUT)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isThresDisplay) {
+		GetDlgItem(IDC_RDO_INSTYPE_THRES)->ShowWindow(SW_SHOW);
+}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_THRES)->ShowWindow(SW_HIDE);
+	}
+
+	if (inf.isHoleDisplay) {
+        GetDlgItem(IDC_RDO_INSTYPE_HOLE)->ShowWindow(SW_SHOW);
+	}
+	else {
+		GetDlgItem(IDC_RDO_INSTYPE_HOLE)->ShowWindow(SW_HIDE);
+	}
+
+	/*
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_IN_CHAMFER));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_TOP_CORNER));
+	m_buttons.push_back((CButton*)GetDlgItem(IDC_RDO_INSTYPE_BOT_CORNER));*/
+
+	std::vector<bool> states;
+	states.push_back(true);
+	states.push_back(inf.isGrindDisplay);
+	states.push_back(inf.isDistDisplay);
+	states.push_back(inf.isCutDisplay);
+	states.push_back(inf.isRcutDisplay);
+	states.push_back(inf.isThresDisplay);
+	states.push_back(inf.isHoleDisplay);
+	states.push_back(false);
+	states.push_back(false);
+	states.push_back(false);
+	UpdateButtonsLayout(m_buttons, states);
+}
+
+void CVisionSetDlg::OnMove(int x, int y)
+{
+	CDialogEx::OnMove(x, y);
+
+	// TODO: 在此处添加消息处理程序代码
+	Resize();
+}
+
+void CVisionSetDlg::ChangeDimension(DimensionDir eDir) {
+	/* code */
+	ChangeVisionPro(eDir, m_eVisionType);
+}
+
+void CVisionSetDlg::ChangeVisionPro(DimensionDir eDir, VISION_TYPE eVision) {
+	/* code */
+	ChangeImage(eDir);
+
+	ChangeVisionType(eVision);
+}
+
+void CVisionSetDlg::ChangeImage(DimensionDir eDir) {
+	/* code */
+	if (eDir == m_eDir) {
+		return;
+	}
+
+	m_eDir = eDir;
+}
+
+void CVisionSetDlg::ChangeVisionType(VISION_TYPE eVision) {
+	/* code */
+	int sz = (int)(m_pages.size());
+	if (sz < 1) return;
+	for (int i = 0; i < sz; i++) {
+		m_pages[i]->ShowWindow(SW_HIDE);
+	}
+	
+
+	m_eVisionType = eVision;
+	switch (eVision) {
+	case VISION_LOC: {
+		CLocSetDlg *pDlg = (CLocSetDlg *)(m_pages[0]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_GRIND: {
+		CGrindSetDlg *pDlg = (CGrindSetDlg *)(m_pages[1]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_KDIST: {
+		CKDistSetDlg *pDlg = (CKDistSetDlg *)(m_pages[2]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_CUT: {
+		CCutSetDlg *pDlg = (CCutSetDlg *)(m_pages[3]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_RCUT: {
+		CRcutSetDLg *pDlg = (CRcutSetDLg *)(m_pages[4]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_THRES: {
+		CThresSetDlg* pDlg = (CThresSetDlg *)(m_pages[5]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_HOLE: {
+        CHoleSetDlg* pDlg = (CHoleSetDlg *)(m_pages[6]);
+		pDlg->setDimensionDir(m_eDir);
+		pDlg->ShowWindow(SW_SHOW);
+		break;
+	}
+
+	case VISION_NONE:
+		break;
+
+	default:
+		break;
+	}
+}
+
+HBRUSH CVisionSetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	// TODO:  在此更改 DC 的任何特性
+
+	// TODO:  如果默认的不是所需画笔,则返回另一个画笔
+	return hbr;
+}
+BEGIN_EVENTSINK_MAP(CVisionSetDlg, CDialogEx)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_LOC, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeLoc, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_RCUT, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeRcut, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_SCAN_SET, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionScanSet, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_KEY_SET, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionKeySet, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_BUTTON_VISION_OP_ROI, DISPID_CLICK, CVisionSetDlg::ClickButtonVisionOpRoi, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_CUT, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeCut, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_KDIST, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeKdist, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_GRIND, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeGrind, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_THRES, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeThres, VTS_NONE)
+	ON_EVENT(CVisionSetDlg, IDC_RDO_INSTYPE_HOLE, DISPID_CLICK, CVisionSetDlg::ClickRdoInstypeHole, VTS_NONE)
+END_EVENTSINK_MAP()
+
+
+void CVisionSetDlg::ClickRdoInstypeLoc()
+{
+	// TODO: 在此处添加消息处理程序代码
+	/* code */
+	ChangeVisionPro(m_eDir, VISION_LOC);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeRcut()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_RCUT);
+}
+
+void CVisionSetDlg::ClickButtonVisionScanSet()
+{
+	// TODO: 在此处添加消息处理程序代码
+	CScanSetDlg dlg;
+	dlg.DoModal();
+
+	ShowVisionType();
+}
+
+
+void CVisionSetDlg::ClickButtonVisionKeySet()
+{
+	// TODO: 在此处添加消息处理程序代码
+	CKeyVisionSetDlg dlg;
+	dlg.DoModal();
+
+	ShowVisionType();
+}
+
+
+void CVisionSetDlg::ClickButtonVisionOpRoi()
+{
+	// TODO: 在此处添加消息处理程序代码
+	//if (m_pOpRoiDlg == NULL) {
+	//	m_pOpRoiDlg = new COpRoiDlg(this);
+	//	m_pOpRoiDlg->Create(IDD_DIALOG_ROI_SET, this);
+	//	m_pOpRoiDlg->ShowWindow(SW_SHOW);
+	//}
+	//else {
+	//	m_pOpRoiDlg->ShowWindow(SW_SHOW);
+	//}
+	CLockSetDlg dlg;
+	dlg.DoModal();
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeCut()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_CUT);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeKdist()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_KDIST);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeGrind()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_GRIND);
+}
+
+
+BOOL CVisionSetDlg::PreTranslateMessage(MSG* pMsg)
+{
+	// TODO: 在此添加专用代码和/或调用基类
+	if (pMsg->message == WM_KEYDOWN) {
+		if ((pMsg->wParam == VK_RETURN) || (pMsg->wParam == VK_ESCAPE)) {
+			return TRUE;
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeThres()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_THRES);
+}
+
+
+void CVisionSetDlg::ClickRdoInstypeHole()
+{
+	// TODO: 在此处添加消息处理程序代码
+	ChangeVisionPro(m_eDir, VISION_HOLE);
+}
diff --git a/Common_Class/BlVisionPro/View/VisionSetDlg.h b/Common_Class/BlVisionPro/View/VisionSetDlg.h
new file mode 100644
index 0000000..abf8eb2
--- /dev/null
+++ b/Common_Class/BlVisionPro/View/VisionSetDlg.h
@@ -0,0 +1,94 @@
+#pragma once
+#include "afxwin.h"
+#include "EiVisionType.h"
+
+// CVisionSetDlg 对话框
+#include "VisionRecipe.h"
+#include "OpRoiDlg.h"
+
+class CVisionSetDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CVisionSetDlg)
+
+	typedef struct _DrawOperator {
+		DimensionDir eDir;                //模式
+		VISION_TYPE eVisionType;          //算法类型  
+		int nID;                          //ID
+		int nType;                        //类型
+		bool isDrawing;                   //是否
+	}DrawOperator;
+
+public:
+	CVisionSetDlg(CWnd* pParent = NULL);   // 标准构造函数
+	virtual ~CVisionSetDlg();
+
+	// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum {
+		IDD = IDD_DIALOG_VISION_SET
+	};
+#endif
+
+private:
+	std::vector<CDialogEx*> m_pages;
+	DimensionDir m_eDir;
+	VISION_TYPE m_eVisionType;
+	DrawOperator m_drawOperator;
+	COpRoiDlg *m_pOpRoiDlg;
+	CMenu m_visionMenu;
+	std::vector<CButton*> m_buttons;
+
+private:
+	//2. 初始化窗体
+	void InitCreateWnd(void);
+
+	//3. 位置移动
+	void Resize(void);
+
+	//4. 设置按钮大小
+	void SetButtonsSize(std::vector<CButton*>& buttons);
+
+	//5. 设置按钮位置
+	void UpdateButtonsLayout(std::vector<CButton*>& buttons, const std::vector<bool>& states);
+
+	//6. 刷新图像 
+	void ChangeImage(DimensionDir eDir);
+
+	//7. 图像算法
+	void ChangeVisionType(VISION_TYPE eVision);
+
+	//8. 改变视觉处理
+	void ChangeVisionPro(DimensionDir eDir, VISION_TYPE eVision);
+
+	//9. 显示算法类型
+	void ShowVisionType(void);
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void ChangeDimension(DimensionDir eDir);
+
+
+
+public:
+	afx_msg void OnClose();
+	virtual BOOL OnInitDialog();
+	afx_msg void OnMove(int x, int y);
+	
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	DECLARE_EVENTSINK_MAP()
+	void ClickRdoInstypeLoc();
+	void ClickRdoInstypeRcut();
+	void ClickButtonVisionScanSet();
+	void ClickButtonVisionKeySet();
+	void ClickButtonVisionOpRoi();
+	void ClickRdoInstypeCut();
+	void ClickRdoInstypeKdist();
+	void ClickRdoInstypeGrind();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	void ClickRdoInstypeThres();
+	void ClickRdoInstypeHole();
+};
diff --git a/Common_Class/BlVisionPro/Vision/BlSideData.cpp b/Common_Class/BlVisionPro/Vision/BlSideData.cpp
new file mode 100644
index 0000000..59a1d1f
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/BlSideData.cpp
@@ -0,0 +1,71 @@
+#include "stdafx.h"
+#include "BlSideData.h"
+
+CBlSideData::CBlSideData()
+{
+	m_dPixelSizeX = 0.0f;
+	m_dPixelSizeY = 0.0f;
+	m_bBotMark_Find = FALSE;
+	m_bTopMark_Find = FALSE;
+	m_mTopMark.x = 0;
+	m_mTopMark.y = 0;
+	m_mBotMark.x = 0;
+	m_mBotMark.y = 0;
+
+	m_bTopPoint_Find = FALSE;
+	m_mTopPoint.x = 0;
+	m_mTopPoint.y = 0;
+	m_bBotPoint_Find = FALSE;
+	m_mBotPoint.x = 0;
+	m_mBotPoint.y = 0;
+
+	m_mapSideLineInf.clear();
+	m_vDispVisionResult.clear();
+}
+
+CBlSideData::~CBlSideData()
+{
+	m_mapSideLineInf.clear();
+	m_vDispVisionResult.clear();
+}
+
+void CBlSideData::Reset(void) {
+	/* code */
+	m_bInspection_Complete = FALSE;
+	m_bBotMark_Find = FALSE;
+	m_bTopMark_Find = FALSE;
+	m_mTopMark.x = 0;
+	m_mTopMark.y = 0;
+	m_mBotMark.x = 0;
+	m_mBotMark.y = 0;
+}
+
+Point2I CBlSideData::getPose(int nType) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+
+	if (0 == nType) {
+		if (m_bTopMark_Find) {
+			result = m_mTopMark;
+		}
+	}
+	else if (1 == nType) {
+		if (m_bBotMark_Find) {
+			result = m_mBotMark;
+		}
+	}
+	else if (2 == nType) {
+		if (m_bTopPoint_Find) {
+			result = m_mTopPoint;
+		}
+	}
+	else if (3 == nType) {
+		if (m_bBotPoint_Find) {
+			result = m_mBotPoint;
+		}
+	}
+
+	return result;
+}
diff --git a/Common_Class/BlVisionPro/Vision/BlVisionLib.cpp b/Common_Class/BlVisionPro/Vision/BlVisionLib.cpp
new file mode 100644
index 0000000..eb807c8
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/BlVisionLib.cpp
@@ -0,0 +1,35 @@
+#include "stdafx.h"
+#include "BlVisionLib.h"
+#include "VisionRecipe.h"
+#include "SoftVisionApp.h"
+
+#define BLVISION_VERSION    _T("1.0.1.1")
+int BlVision_GetVersion(char *pszVersion, int nBufferSize) {
+	/* code */
+	// 将ANSI字符串转换为宽字符串
+	CString cStr = BLVISION_VERSION;
+	// 获取CString长度(以字符为单位)
+	int len = cStr.GetLength();
+
+	// 使用CW2A宏进行宽字符到多字节字符集的转换
+	// CW2A默认使用当前系统的ANSI代码页进行转换
+	CW2A pszConvertedAnsiString(cStr);
+
+	// 使用strncpy确保不会超出charArray的大小
+	// -1 确保字符串末尾有空字符
+	strncpy_s(pszVersion, nBufferSize, pszConvertedAnsiString, _TRUNCATE);
+
+	return 0;
+}
+
+IVisionRecipe* BlVision_GetVisionRecipe(void) {
+	/* code */
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	return pRecipe;
+}
+
+ISoftVisionApp* BlVision_GetSoftVisionApp(void) {
+	/* code */
+	CSoftVisionApp *pApp = CSoftVisionApp::getInstance();
+	return pApp;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/Bspline.cpp b/Common_Class/BlVisionPro/Vision/Bspline.cpp
new file mode 100644
index 0000000..388d3a9
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/Bspline.cpp
@@ -0,0 +1,132 @@
+#include "stdafx.h"
+#include "Bspline.h"
+
+
+CBspline::CBspline() {
+	/* code */
+
+}
+
+CBspline::CBspline(std::vector<vec>pt) {
+	/* code */
+	int num = (int)(pt.size());
+	m_nPoints = num - 1;
+
+	if (num < 4) {
+		m_nNumber = num - 1;
+	}
+	else {
+		m_nNumber = 3;
+	}
+
+	m_vControlpoint.resize(num);
+	memcpy(&m_vControlpoint[0], &pt[0], num * sizeof(vec));
+	m_uData.resize(m_nPoints + m_nNumber + 2);
+}
+
+CBspline::~CBspline(void) {
+	/* code */
+}
+
+void CBspline::execute(void) {
+	/* code */
+	m_vPtResults.clear();
+	getNode();
+
+	std::vector<vec>relevantPoint;
+	std::vector<float>relevantU;
+	relevantPoint.resize(m_nNumber + 1);//相关控制顶点
+	relevantU.resize(2 * m_nNumber);//相关节点矢量
+
+	//相关控制顶点拷贝
+	float u = 0;
+	int i = m_nNumber; //m表示u值所在的节点,则控制顶点为m_controlpoint[i-k]\m_controlpoint[i]
+	float a = 0.0f;
+	int m = 0;
+	int n = 0;
+	int num = 0;
+	int sz = (int)(m_nNumber);
+	for (int j = 0; j < 500; j++) {
+		n = 0;
+		m = 0;
+		u = (float)(1.0f * j / 500);
+
+		if (u > m_uData[i + 1]) {
+			i++;
+		}
+
+		for (m = i - sz; m <= i; m++) {
+			relevantPoint[n] = m_vControlpoint[m];
+			n++;
+		}
+
+		//相关节点矢量拷贝
+		n = 0;
+		for (m = i - sz + 1; m <= i + sz; m++) {
+			relevantU[n] = m_uData[m];
+			n++;
+		}
+		//开始插值计
+		num = (int)(relevantPoint.size());
+		for (n = 1; n < num; n++) {
+			for (m = 0; m < num - n; m++) {
+				a = relevantU[sz + m] - relevantU[m + n - 1];
+				if (fabs(a) < 1e-5) {
+					a = 0.0;
+				}
+				else {
+					a = (u - relevantU[m + n - 1]) / a;
+				}
+				relevantPoint[m] = (1 - a)*relevantPoint[m] + a*relevantPoint[m + 1];
+			}
+		}
+		m_vPtResults.push_back(relevantPoint[0]);
+	}
+}
+
+void CBspline::getNode(void) {
+	/* code */
+	int sz = (int)(m_nNumber);
+	for (int i = 0; i <= sz; i++) {
+		m_uData[i] = 0;
+	}
+
+	for (int i = 1; i <= sz + 1; i++) {
+		m_uData[i + m_nPoints] = 1;
+	}
+
+	hartley();
+}
+
+void CBspline::hartley(void) {
+	/* code */
+	std::vector<float> vLength(m_nPoints);
+	std::vector<float> vData;
+	vData.push_back(0.0);
+
+	vec fValue;
+	int fzNum = (int)(m_nPoints);
+	for (int i = 0; i < fzNum; i++) {
+		fValue = m_vControlpoint[i + 1] - m_vControlpoint[i];
+		vLength[i] = len(fValue);
+	}
+
+	float sum = 0.0f;
+	float fTemp = 0.0f;
+	int num = (int)(vLength.size());
+	int szNum = (int)(m_nNumber);
+	for (int i = 0; i <= num - szNum; i++) {
+		fTemp = 0;
+		for (int j = 0; j < szNum; j++) {
+			fTemp += vLength[i + j];
+		}
+		sum += fTemp;
+		vData.push_back(fTemp);
+	}
+
+	int count = (int)(vData.size());
+	for (int i = 1; i < count; i++) {
+		vData[i] = vData[i - 1] + vData[i];
+		m_uData[i + szNum] = vData[i] / sum;
+	}
+}
diff --git a/Common_Class/BlVisionPro/Vision/Bspline.h b/Common_Class/BlVisionPro/Vision/Bspline.h
new file mode 100644
index 0000000..cc025ab
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/Bspline.h
@@ -0,0 +1,35 @@
+#ifndef BSP_LINE_H
+#define BSP_LINE_H
+
+#include "Vec.h"
+#include <vector>
+
+class CBspline
+{
+public:
+	CBspline();
+	CBspline(std::vector<vec>pt);
+	virtual ~CBspline();
+	
+
+public:
+	//1 测试
+	void execute(void);
+
+	std::vector<vec> m_vPtResults;
+private:
+	unsigned int m_nNumber;//次数、控制顶点个数
+
+	unsigned int m_nPoints;     //控制顶点数
+	std::vector<vec> m_vControlpoint;//控制顶点
+	std::vector<float> m_uData;//节点矢量
+
+public:
+	void hartley(void);
+
+	//1. 计算节点矢量
+	void getNode(void);
+};
+
+#endif
+
diff --git a/Common_Class/BlVisionPro/Vision/ConfigVision.cpp b/Common_Class/BlVisionPro/Vision/ConfigVision.cpp
new file mode 100644
index 0000000..f916c3e
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/ConfigVision.cpp
@@ -0,0 +1,127 @@
+#include "stdafx.h"
+#include "ConfigVision.h"
+#include <iostream>
+#include <atlstr.h> // 包含CString头文件
+#include <time.h>
+#include <stdarg.h>
+#include <direct.h>
+#include <vector>
+#include <Dbghelp.h>
+#include "FileRecipe.h"
+#pragma comment(lib,"Dbghelp.lib")
+
+CConfigVision::CConfigVision(){
+	/* code */
+}
+
+CConfigVision::~CConfigVision(){
+	/* code */
+}
+
+void CConfigVision::SetWorkDir(const char *pszPath, const char *pszName) {
+	/* code */
+	std::string filePath = pszPath;
+	std::string strName = pszName;
+	init(filePath, pszName);
+}
+
+void CConfigVision::init(std::string filePath, std::string strName) {
+	/* code */
+	std::string fileName = filePath + "\\" + strName;
+	if (!CFileRecipe::fileIsExist(fileName)) {
+		MakeSureDirectoryPathExists(fileName.c_str());
+	}
+
+	std::string str = fileName + "\\Config.ini";
+	m_strFileName = CA2T(str.c_str());
+	CStdioFile file;
+	if (!file.Open(m_strFileName, CFile::modeCreate | CFile::modeReadWrite | CFile::modeNoTruncate)) return;
+	file.Close();
+}
+
+bool CConfigVision::WriteText(const char *pszSection, const char *pszName, const char *pszValue) {
+	/* code */
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strValue = CString(pszValue);
+	BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName);
+	if (!isRes) return false;
+
+	return true;
+}
+
+std::string CConfigVision::ReadText(const char *pszSection, const char *pszName, const char *pszDefault) {
+	/* code */
+	std::string strRes = pszDefault;
+	CString strValue;
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strDefault = CString(pszName);
+	GetPrivateProfileString(strSection, strName, strDefault, strValue.GetBuffer(MAX_PATH), MAX_PATH, m_strFileName);
+	strRes = CT2A(strValue);
+	return strRes;
+}
+
+bool CConfigVision::WriteInt(const char *pszSection, const char *pszName, int intValue) {
+	/* code */
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strValue;
+	strValue.Format(_T("%d"), intValue);
+	BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName);
+	if (!isRes) return false;
+
+	return true;
+}
+
+int CConfigVision::ReadInt(const char *pszSection, const char *pszName, int defaultValue) {
+	/* code */
+	int intRes = defaultValue;
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	intRes = GetPrivateProfileInt(strSection, strName, defaultValue, m_strFileName);
+	return intRes;
+}
+
+bool CConfigVision::WriteBool(const char *pszSection, const char *pszName, int bValue) {
+	/* code */
+	int iValue = 0;
+	if (bValue) iValue = 1;
+	
+	return WriteInt(pszSection, pszName, iValue);
+}
+
+bool CConfigVision::ReadBool(const char *pszSection, const char *pszName, bool deaultBool) {
+	/* code */
+	int defaultInt = 0;
+	if (deaultBool)  defaultInt = 1;
+	int nRet = ReadInt(pszSection, pszName, defaultInt);
+	
+	bool res = (1 == nRet);
+	return res;
+}
+
+bool CConfigVision::WriteFloat(const char *pszSection, const char *pszName, double fValue) {
+	/* code */
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strValue;
+	strValue.Format(_T("%.6f"), fValue);
+	BOOL isRes = WritePrivateProfileString(strSection, strName, strValue, m_strFileName);
+	if (!isRes) return false;
+
+	return true;
+}
+
+double CConfigVision::ReadFloat(const char *pszSection, const char *pszName, double defaultValue) {
+	/* code */
+	CString strSection = CString(pszSection);
+	CString strName = CString(pszName);
+	CString strDefault;
+	strDefault.Format(_T("%.6f"), defaultValue);
+	CString strValue;
+	GetPrivateProfileString(strSection, strName, strDefault, strValue.GetBuffer(MAX_PATH), MAX_PATH, m_strFileName);
+	std::string strRes = CT2A(strValue);
+	double fValue = atof(strRes.c_str());
+	return fValue;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/ConfigVision.h b/Common_Class/BlVisionPro/Vision/ConfigVision.h
new file mode 100644
index 0000000..e802337
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/ConfigVision.h
@@ -0,0 +1,39 @@
+#ifndef CONFIG_VISION_H
+#define CONFIG_VISION_H
+
+class CConfigVision
+{
+public:
+	CConfigVision();
+	~CConfigVision();
+
+public:
+	//1. 设置工作路径
+	void SetWorkDir(const char *pszPath, const char *pszName);
+	
+	//2. 写入读取参数
+	bool WriteText(const char *pszSection, const char *pszName, const char *pszValue);
+	std::string ReadText(const char *pszSection, const char *pszName, const char *pszDefault);
+	
+	//3. 写入读取参数
+	bool WriteInt(const char *pszSection, const char *pszName, int intValue);
+	int ReadInt(const char *pszSection, const char *pszName, int defaultValue);
+
+	//4. 写入读取参数
+	bool WriteBool(const char *pszSection, const char *pszName, int bValue);
+	bool ReadBool(const char *pszSection, const char *pszName, bool deaultBool);
+
+	//5. 写入读取参数
+	bool WriteFloat(const char *pszSection, const char *pszName, double fValue);
+	double ReadFloat(const char *pszSection, const char *pszName, double defaultValue);
+
+private:
+	CString m_strFileName;
+
+private:
+	//1. 初始化创建文件
+	void init(std::string filePath, std::string strName);
+};
+
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/CornerDistProcess.cpp b/Common_Class/BlVisionPro/Vision/CornerDistProcess.cpp
new file mode 100644
index 0000000..1b5e471
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/CornerDistProcess.cpp
@@ -0,0 +1,392 @@
+#include "stdafx.h"
+#include "CornerDistProcess.h"
+#include "VisionBufferPro.h"
+#include "VisionRecipe.h"
+
+CCornerDistProcess::CCornerDistProcess(){
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	init();
+}
+
+CCornerDistProcess::~CCornerDistProcess(){
+	/* code */
+	release();
+}
+
+int CCornerDistProcess::init(void) {
+	/* code */
+	release();
+
+	m_isTfConvert = FALSE;
+
+	for (int i = 0; i < 6; i++) {
+		m_stdPoint[i].x = 0;
+		m_stdPoint[i].y = 0;
+	}
+
+	for (int i = 0; i < 4; i++) {
+		m_aryMeasure[i].idxRefer = 0;
+		m_aryMeasure[i].typePoint = 0;
+		m_aryMeasure[i].modePoint = 0;
+		m_aryMeasure[i].pointThres = 30;
+		m_aryMeasure[i].modeNear = 0;
+		m_aryMeasure[i].nearThres = 30;
+	}
+
+	return 0;
+}
+
+void CCornerDistProcess::release(void) {
+	/* code */
+	int nCount = (int)(m_vDosts.size());
+	if (nCount > 0) {
+		for (int i = 0; i < nCount; i++) {
+			CDistDotProcess *dot = m_vDosts.at(i);
+			if (NULL == dot) continue;
+			delete dot;
+			dot = NULL;
+		}
+	}
+	m_vDosts.clear();
+}
+
+CDistDotProcess* CCornerDistProcess::getDot(int index) {
+	/* code */
+	int nCount = (int)(m_vDosts.size());
+	if (index < 0 || index > nCount - 1) return nullptr;
+
+	CDistDotProcess *dot = m_vDosts.at(index);
+	return dot;
+}
+
+int CCornerDistProcess::addDot(void) {
+	/* code */
+	int nCount = (int)(m_vDosts.size());
+	int id = -MAXINT;
+	if (nCount < 1) {
+		id = 0;
+	}
+	else {
+		for (int i = 0; i < nCount; i++) {
+			CDistDotProcess *dot = m_vDosts.at(i);
+			if (NULL == dot) continue;
+			if (dot->getID() <= id) continue;
+			id = dot->getID();
+		}
+		id += 1;
+	}
+
+	CDistDotProcess *dot = new CDistDotProcess(m_eDir, id);
+	m_vDosts.push_back(dot);
+	return id;
+}
+
+Point2I CCornerDistProcess::getPoint(int nType) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+	if (nType < 0 || nType > 5) return result;
+
+	result = m_stdPoint[nType];
+	return result;
+}
+
+void CCornerDistProcess::setPoint(Point2I pos, int nType) {
+	/* code */
+	if (nType < 0 || nType > 5) return;
+
+	m_stdPoint[nType] = pos;
+}
+
+int CCornerDistProcess::execute(DimensionDir eDir) {
+	/* code */
+	m_isTfConvert = FALSE;
+	if (m_eDir != eDir) return -1;
+
+	int nCount = (int)(m_vDosts.size());
+	if (nCount < 1) return 0;
+
+	Point2I offset;
+	Point2I pose;
+	int idxType = 0;
+	MeasureInfo inf;
+	for (int i = 0; i < nCount; i++) {
+		CDistDotProcess *dot = m_vDosts.at(i);
+		if (NULL == dot) continue;
+
+		idxType = dot->m_idxRefer;
+		if (idxType < 0 || idxType > 3) continue;
+		inf = m_aryMeasure[idxType];
+
+		pose = dot->getPose();
+		offset = getOffset(inf.idxRefer, pose);
+
+		dot->setPoint(m_stdPoint[0], 0);
+		dot->setPoint(m_stdPoint[1], 1);
+		dot->setPoint(tfCoordinate(m_stdPoint[4]), 2);
+		dot->setPoint(tfCoordinate(m_stdPoint[5]), 3);
+		dot->Execute(m_eDir, inf, offset);
+	}
+
+	return 0;
+}
+
+int CCornerDistProcess::Serialized(void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+	int useSize = 0;
+	int nRet = 0;
+
+#if 0
+	//1. 保存mark
+	int iValue = (int)(m_eDir);
+	SERIALIZER_INT_32(iValue, pTemp, remainSize, useSize);   //Type
+
+	for (int i = 0; i < 6; i++) {
+		SERIALIZER_INT_32(m_stdPoint[i].x, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_stdPoint[i].y, pTemp, remainSize, useSize);
+	}
+
+	for (int i = 0; i < 4; i++) {
+		SERIALIZER_INT_32(m_aryMeasure[i].idxRefer, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].typePoint, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].modePoint, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].pointThres, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].modeNear, pTemp, remainSize, useSize);
+		SERIALIZER_INT_32(m_aryMeasure[i].nearThres, pTemp, remainSize, useSize);
+	}
+
+	//2. 保存点的数量
+	int nCount = (int)(m_vDosts.size());
+	SERIALIZER_INT_32(nCount, pTemp, remainSize, useSize);
+
+	if (nCount > 0) {
+		for (int i = 0; i < nCount; i++) {
+			CDistDotProcess *pDot = m_vDosts.at(i);
+			if (NULL == pDot) continue;
+			nRet = pDot->Serialized(pTemp, remainSize);
+			if (nRet < 0) continue;
+			pTemp += nRet;
+			remainSize -= nRet;
+			useSize += nRet;
+		}
+	}
+#endif
+
+	return useSize;
+}
+
+int CCornerDistProcess::Deserialized(void* pBuffer, int size) {
+	/* code */
+	release();
+
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+	int useSize = 0;
+	int nRet = 0;
+
+#if 0
+	//1. 加载Mark
+	int iValue = 0;
+	DESERIALIZER_INT_32(iValue, pTemp, remainSize, useSize);   //Type
+	m_eDir = (DimensionDir)(iValue);
+	
+	for (int i = 0; i < 6; i++) {
+		DESERIALIZER_INT_32(m_stdPoint[i].x, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_stdPoint[i].y, pTemp, remainSize, useSize);
+	}
+
+	for (int i = 0; i < 4; i++) {
+		DESERIALIZER_INT_32(m_aryMeasure[i].idxRefer, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].typePoint, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].modePoint, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].pointThres, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].modeNear, pTemp, remainSize, useSize);
+		DESERIALIZER_INT_32(m_aryMeasure[i].nearThres, pTemp, remainSize, useSize);
+	}
+
+	//2. 保存点的数量
+	int nCount = 0;
+	DESERIALIZER_INT_32(nCount, pTemp, remainSize, useSize);
+
+	for (int i = 0; i < nCount; i++) {
+		CDistDotProcess *dot = new CDistDotProcess();
+		nRet = dot->Deserialized(pTemp, remainSize);
+		if (nRet < 0) continue;
+		m_vDosts.push_back(dot);
+
+		pTemp += nRet;
+		remainSize -= nRet;
+		useSize += nRet;
+	}
+
+#endif
+
+
+	return useSize;
+}
+
+std::vector<CDistDotProcess*>& CCornerDistProcess::getDots(void) {
+	/* code */
+	return m_vDosts;
+}
+
+int CCornerDistProcess::delDot(int id) {
+	/* code */
+	int nCount = (int)(m_vDosts.size());
+	if (nCount < 1) return -1;
+	bool isFind = false;
+	for (auto iter = m_vDosts.begin(); iter != m_vDosts.end(); iter++) {
+		CDistDotProcess *dot = (*iter);
+		if (id == (*iter)->getID()) {
+			isFind = true;
+			m_vDosts.erase(iter);
+			break;
+		}
+	}
+	if (!isFind) return -1;
+
+	nCount = (int)(m_vDosts.size());
+	if (nCount < 1) return -1;
+
+	CDistDotProcess *dot = m_vDosts.at(0);
+	return dot->getID();
+}
+
+Point2I CCornerDistProcess::getOffset(int nType, Point2I pt) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+
+	switch (nType){
+	case 1:
+		result = getTopPointOffset(pt);
+		break;
+
+	case 2:
+		result = getBotPointOffset(pt);
+		break;
+
+	default:
+		result = getAffineOffset(pt);
+		break;
+	}
+
+	return result;
+}
+
+MeasureInfo CCornerDistProcess::getMeasureInfo(int index) {
+	/* code */
+	MeasureInfo inf;
+	inf.idxRefer = 0;
+	inf.typePoint = 0;
+	inf.modePoint = 0;
+	inf.pointThres = 30;
+	inf.modeNear = 0;
+	inf.nearThres = 30;
+	if (index < 0 || index > 3) return inf;
+
+	inf = m_aryMeasure[index];
+	return inf;
+}
+
+void CCornerDistProcess::setMeasureInfo(MeasureInfo inf, int index) {
+	/* code */
+	if (index < 0 || index > 3) return;
+
+	m_aryMeasure[index] = inf;
+}
+
+Point2I CCornerDistProcess::getAffineOffset(Point2I pt) {
+	/* code */
+	Point2I result;
+	Point2I ptTarget = tfCoordinate(pt);
+
+	result.x = (int)(ptTarget.x - pt.x);
+	result.y = (int)(ptTarget.y - pt.y);
+
+	return result;
+}
+
+Point2I CCornerDistProcess::tfCoordinate(Point2I pt) {
+	/* code */
+	tfProcess();
+
+	Point2D pose;
+	pose.x = pt.x;
+	pose.y = pt.y;
+	Point2D ptTarget = ClsVision::CoordinateTransform(pose, m_affine);
+	Point2I result;
+	result.x = (int)(ptTarget.x);
+	result.y = (int)(ptTarget.y);
+	return result;
+}
+
+void CCornerDistProcess::tfProcess(void){
+	/* code */
+	if (m_isTfConvert) return;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) {
+		Point2D pose;
+		pose.x = 0.0f;
+		pose.y = 0.0f;
+		m_affine = ClsVision::VectorAngleToRigid(pose, 0.0f, pose, 0.0f);
+		return;
+	}
+
+	std::vector<Point2D> vPtOrg, vPtTgt;
+	Point2D pose;
+	pose.x = m_stdPoint[0].x;
+	pose.y = m_stdPoint[0].y;
+	vPtOrg.push_back(pose);
+	pose.x = m_stdPoint[1].x;
+	pose.y = m_stdPoint[1].y;
+	vPtOrg.push_back(pose);
+
+	pose.x = pSideData->m_mTopMark.x;
+	pose.y = pSideData->m_mTopMark.y;
+	vPtTgt.push_back(pose);
+	pose.x = pSideData->m_mBotMark.x;
+	pose.y = pSideData->m_mBotMark.y;
+	vPtTgt.push_back(pose);
+
+	m_affine = ClsVision::VectorToSimilarity(vPtOrg, vPtTgt);
+	m_isTfConvert = TRUE;
+}
+
+Point2I CCornerDistProcess::getTopPointOffset(Point2I pt) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return result;
+
+	if (!pSideData->m_bTopPoint_Find) return result;
+
+	result.x = pSideData->m_mTopPoint.x - m_stdPoint[2].x;
+	result.y = pSideData->m_mTopPoint.y - m_stdPoint[2].y;
+
+	return result;
+}
+
+Point2I CCornerDistProcess::getBotPointOffset(Point2I pt) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return result;
+
+	if (!pSideData->m_bBotPoint_Find) return result;
+
+	result.x = pSideData->m_mBotPoint.x - m_stdPoint[3].x;
+	result.y = pSideData->m_mBotPoint.y - m_stdPoint[3].y;
+
+	return result;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/CornerDistProcess.h b/Common_Class/BlVisionPro/Vision/CornerDistProcess.h
new file mode 100644
index 0000000..3150d32
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/CornerDistProcess.h
@@ -0,0 +1,74 @@
+#ifndef CORNER_DIST_PROCESS_H
+#define CORNER_DIST_PROCESS_H
+
+#include "DistDotProcess.h"
+
+class CVisionRecipe;
+
+class CCornerDistProcess
+{
+public:
+	CCornerDistProcess();
+	~CCornerDistProcess();
+
+public:
+	DimensionDir m_eDir;
+	
+public:
+	//1. get set dot
+	CDistDotProcess* getDot(int index);
+	std::vector<CDistDotProcess*>& getDots(void);
+	int addDot(void);
+	int delDot(int id);
+
+	//2. get/set UpMark
+	Point2I getPoint(int nType);
+	void setPoint(Point2I pos, int nType);
+	
+	//3. 执行
+	int execute(DimensionDir eDir);
+
+	//4. 序列化参数和反序列号参数
+	int Serialized(void* pBuffer, int size);
+	int Deserialized(void* pBuffer, int size);
+
+	//5. 获取偏移值
+	Point2I getOffset(int nType, Point2I pt);
+
+	//6. 获取测量数据
+	MeasureInfo getMeasureInfo(int index);
+	void setMeasureInfo(MeasureInfo inf, int index);
+
+private:
+	std::vector<CDistDotProcess*> m_vDosts;
+
+	Point2I m_stdPoint[6];
+	MeasureInfo m_aryMeasure[4];
+	BOOL m_isTfConvert;
+	ParaAffine2D m_affine;
+
+private:
+	//1. 初始化
+	int init(void);
+
+	//2. 释放
+	void release(void);
+
+	//3. 获取偏移
+	Point2I getAffineOffset(Point2I pt);
+
+	//4. 获取TopMark
+	Point2I getTopPointOffset(Point2I pt);
+
+	//5. 获取BotMark
+	Point2I getBotPointOffset(Point2I pt);
+
+	//6. 坐标转换
+	Point2I tfCoordinate(Point2I pt);
+
+	//7. 坐标转换
+	void tfProcess(void);
+};
+
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/CornerRcutProcess.cpp b/Common_Class/BlVisionPro/Vision/CornerRcutProcess.cpp
new file mode 100644
index 0000000..03c3b02
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/CornerRcutProcess.cpp
@@ -0,0 +1,103 @@
+#include "stdafx.h"
+#include "CornerRcutProcess.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CCornerRcutProcess::CCornerRcutProcess(){
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		m_dots[i] = NULL;
+	}
+	m_eDir = DIMENSION_NONE;
+	init();
+}
+
+CCornerRcutProcess::CCornerRcutProcess(DimensionDir eDir) {
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		m_dots[i] = NULL;
+	}
+	m_eDir = eDir;
+	init();
+}
+
+CCornerRcutProcess::~CCornerRcutProcess(){
+	/* code */
+	release();
+}
+
+int CCornerRcutProcess::init(void) {
+	/* code */
+	release();
+
+	for (int i = 0; i < 2; i++) {
+		m_dots[i] = new CRcutDotProcess(m_eDir, i + 1);
+	}
+
+	return 0;
+}
+
+void CCornerRcutProcess::release(void) {
+	/* code */
+	int nCount = 2;
+	for (int i = 0; i < nCount; i++) {
+		CRcutDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+int CCornerRcutProcess::execute(DimensionDir eDir) {
+	/* code */
+	if (m_eDir != eDir) return -1;
+
+	int nCount = 2;
+	Point2I offset;
+	for (int i = 0; i < nCount; i++) {
+		CRcutDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse)  continue;
+
+		offset.x = i;
+		offset.y = i;
+		dot->Execute(m_eDir, offset);
+	}
+
+	return 0;
+}
+
+Json::Value CCornerRcutProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = RCUT_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+
+	for (int i = 0; i < 2; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CCornerRcutProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	for (int i = 0; i < 2; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/CornerRcutProcess.h b/Common_Class/BlVisionPro/Vision/CornerRcutProcess.h
new file mode 100644
index 0000000..ce88823
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/CornerRcutProcess.h
@@ -0,0 +1,34 @@
+#ifndef CORNER_RCUT_PROCESS
+#define CORNER_RCUT_PROCESS
+
+#include "RcutDotProcess.h"
+
+class CCornerRcutProcess
+{
+public:
+	CCornerRcutProcess();
+	CCornerRcutProcess(DimensionDir eDir);
+	~CCornerRcutProcess();
+
+public:
+	DimensionDir m_eDir;
+	CRcutDotProcess *m_dots[2];
+
+public:
+	//1. 执行
+	int execute(DimensionDir eDir);
+
+	//2. 保存数据 
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+private:
+	//1. 初始化
+	int init(void);
+
+	//2. 释放
+	void release(void);
+};
+
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/CutDotProcess.cpp b/Common_Class/BlVisionPro/Vision/CutDotProcess.cpp
new file mode 100644
index 0000000..aeb04a3
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/CutDotProcess.cpp
@@ -0,0 +1,354 @@
+#include "stdafx.h"
+#include "CutDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+
+CCutDotProcess::CCutDotProcess(){
+	/* code */
+	m_poseType = 0;
+	m_eDir = DIMENSION_NONE;
+	m_id = 0;
+
+	m_nUse = 0;
+	m_strName.Format(_T("P%d"), m_id);
+
+	m_nPosX = 0;
+	m_nPosY = 0;
+	m_nEdgeThres = 120;
+
+	m_nInc = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_distResult = 0.0f;
+}
+
+CCutDotProcess::CCutDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_poseType = 0;
+	m_eDir = eDir;
+	m_id = id;
+
+	m_nUse = 0;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_L%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_L%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_Cut_Dot%d"), m_id);
+		break;
+	}
+
+	m_nPosX = 0;
+	m_nPosY = 0;
+	m_nEdgeThres = 120;
+
+	m_nInc = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+
+	m_distResult = 0.0f;
+}
+
+CCutDotProcess::~CCutDotProcess(){
+	/* code */
+}
+
+int CCutDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	m_ptNearResult.x = 0.0f;
+	m_ptNearResult.y = 0.0f;
+	m_ptMeasureResult.x = 0.0f;
+	m_ptMeasureResult.y = 0.0f;
+	m_distResult = 0.0f;
+	if (1 != m_nUse) return 0;
+	if (0 == m_nPosX && 0 == m_nPosY)  return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 查找left
+	if (!FindLeftLine(eDir, offset)) return -1;
+
+	//3. 结果判断
+	judgeResult();
+
+	return 0;
+}
+
+bool CCutDotProcess::FindLeftLine(DimensionDir eDir, Point2I offset) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return false;
+	if (0 == m_poseType) {
+		if (!pSideData->m_bTopMark_Find)  return false;
+		if (!pSideData->m_bBotMark_Find)  return false;
+	}
+	else {
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	Point2I ptOffset;
+	ptOffset.x = -1 * m_nPosX;
+	ptOffset.y = m_nPosY;
+	Point2I result;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result))  return false;
+	m_locPointResult = result;
+
+	double fzSearchRange = 500.0f;
+	int nSearchRange = (int)(fzSearchRange / pSideData->m_dPixelSizeX);
+
+	Point2I cutResult;
+	if (!CVisionBufferPro::findCutLine(m_eDir, result, nSearchRange, m_nEdgeThres, cutResult)) return false;
+
+	m_ptMeasureResult.x = cutResult.x;
+	m_ptMeasureResult.y = cutResult.y;
+	m_ptNearResult = m_ptMeasureResult;
+
+	Line2D line;
+	line.pt0.x = m_xMmvsp * m_Points[0].x; // 0.0f;  // m_Points[0].x;
+	line.pt0.y = m_yMmvsp * m_Points[0].y; // 0.0f;  // m_Points[0].y;
+	line.pt1.x = m_xMmvsp * m_Points[1].x; //(m_Points[1].x - m_Points[0].x);
+	line.pt1.y = m_yMmvsp * m_Points[1].y; //(m_Points[1].y - m_Points[0].y);
+	Point2D ptEdge;
+	ptEdge.x = m_xMmvsp * m_ptMeasureResult.x; // (m_ptMeasureResult.x - m_Points[0].x);
+	ptEdge.y = m_yMmvsp * m_ptMeasureResult.y; // (m_ptMeasureResult.y - m_Points[0].y);
+
+	Point2D pose = ClsVision::ProjectionPL(ptEdge, line);
+	Point2D posProject;
+	posProject.x = pose.x / pSideData->m_dPixelSizeX; //m_Points[0].x + pose.x / pSideData->m_dPixelSizeX;
+	posProject.y = pose.y / pSideData->m_dPixelSizeY;  //m_Points[0].y + pose.y / pSideData->m_dPixelSizeY;
+
+	if (nullptr != pSideData) {  //区域的显示结果
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_CUT);
+		inf.rectX1 = (int)(cutResult.x - 15);
+		inf.rectY1 = (int)(cutResult.y - 15);
+		inf.rectX2 = (int)(cutResult.x + 15);
+		inf.rectY2 = (int)(cutResult.y + 15);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 3;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_CUT);
+		inf.rectX1 = (int)(cutResult.x);
+		inf.rectY1 = (int)(cutResult.y);
+		inf.rectX2 = (int)(posProject.x);
+		inf.rectY2 = (int)(posProject.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	return true;
+}
+
+int CCutDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+void CCutDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+void CCutDotProcess::judgeResult(void) {
+	/* code */
+	m_nNgInfo.clear();
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return;
+	if (NULL != pSideData) {
+		DispVisionResult inf;
+		inf.nType = 4;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_CUT);
+		inf.pointX = (int)(m_ptMeasureResult.x);
+		inf.pointY = (int)(m_ptMeasureResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_nMin;
+	ng.maxValue = m_nMax;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_KDIST;
+
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+
+	ng.ngType = DefectLoc_Dist_Cut;
+	Line2D line;
+	line.pt0.x = m_xMmvsp * m_Points[0].x; // 0.0f;  // m_Points[0].x;
+	line.pt0.y = m_yMmvsp * m_Points[0].y; // 0.0f;  // m_Points[0].y;
+	line.pt1.x = m_xMmvsp * m_Points[1].x; //(m_Points[1].x - m_Points[0].x);
+	line.pt1.y = m_yMmvsp * m_Points[1].y; //(m_Points[1].y - m_Points[0].y);
+	Point2D ptEdge;
+	ptEdge.x = m_xMmvsp * m_ptMeasureResult.x; // (m_ptMeasureResult.x - m_Points[0].x);
+	ptEdge.y = m_yMmvsp * m_ptMeasureResult.y; // (m_ptMeasureResult.y - m_Points[0].y);
+
+	Point2D pose = ClsVision::ProjectionPL(ptEdge, line);
+	double dx = (ptEdge.x - pose.x);
+	double dy = (ptEdge.y - pose.y);
+	m_distResult = sqrt(dx * dx + dy * dy);
+
+	m_distResult += m_nInc;
+	ng.result = m_distResult;
+
+	if (m_nMax < 0.5) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	double dDist = m_distResult - abs(m_nPosX);
+	if (dDist < m_nMin || dDist > m_nMax) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+void CCutDotProcess::setPoint(Point2I pose, int nType) {
+	/* code */
+	if (0 == nType) {
+		m_Points[0] = pose;
+	}
+	else if (1 == nType) {
+		m_Points[1] = pose;
+	}
+}
+
+Json::Value CCutDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+	Json::Value jsValue;
+	jsValue["alg type"] = CUT_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["use"] = m_nUse;
+	jsValue["pos x"] = m_nPosX;
+	jsValue["pos y"] = m_nPosY;
+	jsValue["inc"] = m_nInc;
+	jsValue["min"] = m_nMin;
+	jsValue["max"] = m_nMax;
+	jsValue["pos type"] = m_poseType;
+	jsValue["line thres"] = m_nEdgeThres;
+
+	return jsValue;
+}
+
+void CCutDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosX = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosY = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. inc
+	strName = "inc";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nInc = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. min
+	strName = "min";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMin = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. max
+	strName = "max";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMax = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. pos type
+	strName = "pos type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_poseType = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. line width
+	strName = "line thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEdgeThres = jsValue[strName.c_str()].asInt();
+	}
+}
diff --git a/Common_Class/BlVisionPro/Vision/CutDotProcess.h b/Common_Class/BlVisionPro/Vision/CutDotProcess.h
new file mode 100644
index 0000000..a07fdc0
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/CutDotProcess.h
@@ -0,0 +1,64 @@
+#ifndef CUT_DOT_PROCESS_H
+#define CUT_DOT_PROCESS_H
+
+#include "IncludeVision.h"
+
+class CCutDotProcess
+{
+public:
+	CCutDotProcess();
+	CCutDotProcess(DimensionDir eDir, int id);
+	~CCutDotProcess();
+
+public:
+	//1. 执行
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//2. 获取ID
+	int getID(void);
+	void setPoint(Point2I pose, int nType);
+
+	//3. 保存文件
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	int m_nUse;
+	CString m_strName;
+	int m_nPosY;
+	int m_nPosX;
+	int m_poseType;
+	int m_nEdgeThres;
+
+	int m_nInc;
+	int m_nMin;
+	int m_nMax;
+
+	Point2D m_ptMeasureResult;
+	Point2D m_ptNearResult;
+	Point2I m_locPointResult;
+	double m_distResult;
+
+	std::vector<NgDotInfo> m_nNgInfo;
+
+private:
+	DimensionDir m_eDir;
+	int m_id;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+	Point2I m_Points[2];
+
+private:
+	//1. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+
+	//1. 判断结果
+	void judgeResult(void);
+
+	//2. 查找边界
+	bool FindLeftLine(DimensionDir eDir, Point2I offset);
+};
+
+#endif
+
diff --git a/Common_Class/BlVisionPro/Vision/CutProcess.cpp b/Common_Class/BlVisionPro/Vision/CutProcess.cpp
new file mode 100644
index 0000000..e72b7c0
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/CutProcess.cpp
@@ -0,0 +1,97 @@
+#include "stdafx.h"
+#include "CutProcess.h"
+#include "BlSideData.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CCutProcess::CCutProcess() {
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CCutDotProcess(m_eDir, i + 1);
+	}
+	m_isUse = false;
+}
+
+CCutProcess::CCutProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	m_isUse = false;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CCutDotProcess(m_eDir, i + 1);
+	}
+}
+
+CCutProcess::~CCutProcess() {
+	/* code */
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+void CCutProcess::Execute(DimensionDir eDir) {
+	/* code */
+	if (!m_isUse) return;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return;
+
+	Point2I offset;
+	for (int i = 0; i < 50; i++) {
+		CCutDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		offset.x = i;
+		offset.y = i;
+
+		dot->setPoint(pSideData->m_mTopMark, 0);
+		dot->setPoint(pSideData->m_mBotMark, 1);
+
+		dot->Execute(m_eDir, offset);
+	}
+}
+
+Json::Value CCutProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = CUT_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["use"] = m_isUse;
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CCutProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) {
+		m_isUse = jsValue[strName.c_str()].asBool();
+	}
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/CutProcess.h b/Common_Class/BlVisionPro/Vision/CutProcess.h
new file mode 100644
index 0000000..782ba11
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/CutProcess.h
@@ -0,0 +1,27 @@
+#ifndef CUT_PROCESS_H
+#define CUT_PROCESS_H
+
+#include "CutDotProcess.h"
+
+class CCutProcess
+{
+public:
+	CCutProcess();
+	CCutProcess(DimensionDir eDir);
+	~CCutProcess();
+
+public:
+	DimensionDir m_eDir;
+	bool m_isUse;   //是否启用
+	CCutDotProcess *m_dots[50];
+
+public:
+	//1. 执行检测
+	void Execute(DimensionDir eDir);
+
+	//2. 写入文件
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/DistDotProcess.cpp b/Common_Class/BlVisionPro/Vision/DistDotProcess.cpp
new file mode 100644
index 0000000..33e82cb
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/DistDotProcess.cpp
@@ -0,0 +1,569 @@
+#include "stdafx.h"
+#include "DistDotProcess.h"
+#include "VisionBufferPro.h"
+
+CDistDotProcess::CDistDotProcess(){
+	/* code */
+	m_id = 0;
+	m_eDir = DIMENSION_A;
+	m_strName.Format(_T("P%d"), m_id);
+
+	m_idxRefer = 0;
+	m_nRef = 100;
+	m_nRef_ = 100;
+
+	m_distMode = 1;
+	m_minValue = 0;
+	m_maxValue = 0;
+
+	m_distMode2 = 5;
+	m_minValue2 = 0;
+	m_maxValue2 = 0;
+
+	m_xPos = 0.0f;
+	m_yPos = 0.0f;
+	m_cx = 0.0f;
+	m_cy = 0.0f;
+	m_angle = 0.0f;
+	m_len1 = 0.0f;
+	m_len2 = 0.0f;
+
+	m_xMmvsp = 0.0f;
+	m_yMmvsp = 0.0f;
+	m_ngType = DefectLoc_Grind;
+	m_ngType2 = DefectLoc_Dist_Cut;
+	m_incValue = 0;
+	m_incValue2 = 0;
+
+	ClsVision::GenEmptyObject(m_hRegion);
+	ClsVision::GenEmptyObject(m_hLineRegion);
+}
+
+CDistDotProcess::~CDistDotProcess(){
+	/* code */
+}
+
+CDistDotProcess::CDistDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_id = id;
+	m_eDir = eDir;
+	switch (eDir){
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P%d"), m_id);
+		break;
+	}
+
+	m_idxRefer = 0;
+	m_nRef = 100;
+	m_nRef_ = 100;
+
+	m_distMode = 1;
+	m_minValue = 0;
+	m_maxValue = 0;
+
+	m_distMode2 = 5;
+	m_minValue2 = 0;
+	m_maxValue2 = 0;
+
+	m_xPos = 0.0f;
+	m_yPos = 0.0f;
+	m_cx = 0.0f;
+	m_cy = 0.0f;
+	m_angle = 0.0f;
+	m_len1 = 0.0f;
+	m_len2 = 0.0f;
+
+	m_xMmvsp = 0.0f;
+	m_yMmvsp = 0.0f;
+	m_incValue = 0;
+	m_incValue2 = 0;
+
+	ClsVision::GenEmptyObject(m_hRegion);
+	ClsVision::GenEmptyObject(m_hLineRegion);
+
+	m_ngType = DefectLoc_Grind;
+	m_ngType2 = DefectLoc_Dist_Cut;
+}
+
+int CDistDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+int CDistDotProcess::Execute(DimensionDir eDir, MeasureInfo inf, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	m_ptMatchResult.x = 0.0f;
+	m_ptMatchResult.y = 0.0f;
+	m_ptNearResult.x = 0.0f;
+	m_ptNearResult.y = 0.0f;
+	m_ptMeasureResult.x = 0.0f;
+	m_ptMeasureResult.y = 0.0f;
+	m_locPointResult.x = 0;
+	m_locPointResult.y = 0;
+
+	getMmvsp(eDir);
+
+	getKeyPose(offset);
+
+	//查找边界
+	int nRet = findPairEdge(eDir, inf, offset);
+//	if (0 != nRet) return nRet;
+
+	JudgeResult();
+
+	return nRet;
+}
+
+void CDistDotProcess::JudgeResult(void) {
+	/* code */
+	JudgeFirstResult();
+
+	JudgeSecondResult();
+}
+
+void CDistDotProcess::JudgeFirstResult(void) {
+	/* code */
+	if (0 == m_distMode) return;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_minValue;
+	ng.maxValue = m_maxValue;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_NONE; // VISION_DIST;
+
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+	
+	if (1 == m_distMode) {          //Grind Size
+		ng.ngType = m_ngType;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (2 == m_distMode) {     //Top Point
+		ng.ngType = m_ngType;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_topPoint.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_topPoint.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (3 == m_distMode) {     //Bot Point
+		ng.ngType = m_ngType;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_botPoint.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_botPoint.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (4 == m_distMode) {     //Key Dist
+		ng.ngType = m_ngType;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptMatchResult.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptMatchResult.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (5 == m_distMode) {     //Mark Line
+		Line2D line;
+		line.pt0.x = m_topMark.x;
+		line.pt0.y = m_topMark.y;
+		line.pt1.x = m_botMark.x;
+		line.pt1.y = m_botMark.y;
+		Point2D pose = ClsVision::ProjectionPL(m_ptMeasureResult, line);
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - pose.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - pose.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+		ng.ngType = m_ngType;
+	}
+	if (ng.result + m_incValue > 0.0f) {
+		ng.result += m_incValue;
+	}
+	if (m_maxValue < 0.01f || m_maxValue <= m_minValue + 0.001) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	if (ng.result < m_minValue || ng.result > m_maxValue) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+void CDistDotProcess::JudgeSecondResult(void) {
+	/* code */
+	if (0 == m_distMode2) return;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_minValue2;
+	ng.maxValue = m_maxValue2;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_NONE;   // VISION_DIST;
+
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+
+	if (1 == m_distMode2) {          //Grind Size
+		ng.ngType = m_ngType2;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (2 == m_distMode2) {     //Top Point
+		ng.ngType = m_ngType2;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_topPoint.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_topPoint.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (3 == m_distMode2) {     //Bot Point
+		ng.ngType = m_ngType2;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_botPoint.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_botPoint.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (4 == m_distMode2) {     //Key Dist
+		ng.ngType = m_ngType2;
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptMatchResult.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptMatchResult.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+	}
+	else if (5 == m_distMode2) {     //Mark Line
+		Line2D line;
+		line.pt0.x = m_topMark.x;
+		line.pt0.y = m_topMark.y;
+		line.pt1.x = m_botMark.x;
+		line.pt1.y = m_botMark.y;
+		Point2D pose = ClsVision::ProjectionPL(m_ptMeasureResult, line);
+		double dx = m_xMmvsp *(m_ptMeasureResult.x - pose.x);
+		double dy = m_yMmvsp *(m_ptMeasureResult.y - pose.y);
+		ng.result = sqrt(dx * dx + dy * dy);
+		ng.ngType = m_ngType2;
+	}
+
+	if (ng.result + m_incValue2 > 0.0f) {
+		ng.result += m_incValue2;
+	}
+	if (m_maxValue2 < 0.01f || m_maxValue2 <= m_minValue2 + 0.001) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	if (ng.result < m_minValue2 || ng.result > m_maxValue2) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+
+void CDistDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+int CDistDotProcess::getKeyPose(Point2I offset) {
+	/* code */
+	if (fabs(m_xPos) < 0.01 || fabs(m_yPos) < 0.01) return -1;
+
+	m_ptMatchResult.x = m_xPos + offset.x;
+	m_ptMatchResult.y = m_yPos + offset.y;
+	return 0;
+}
+
+int CDistDotProcess::findPairEdge(DimensionDir eDir, MeasureInfo infMeasure, Point2I offset) {
+	/* code */
+	//1. 图像预处理
+	if (m_len1 < 0.01 || m_len2 < 0.01) return -3;
+
+	Line2D line = GetTargeLine();
+	line.pt0.x += offset.x;
+	line.pt0.y += offset.y;
+	line.pt1.x += offset.x;
+	line.pt1.y += offset.y;
+
+	int x1 = (int)(line.pt0.x - 30);
+	if (line.pt0.x > line.pt1.x)  x1 = (int)(line.pt1.x - 30);
+	int x2 = (int)(line.pt0.x + 30);
+	if (line.pt0.x < line.pt1.x)  x2 = (int)(line.pt1.x + 30);
+	int y1 = (int)(line.pt0.y - 30);
+	if (line.pt0.y > line.pt1.y)  y1 = (int)(line.pt1.y - 30);
+	int y2 = (int)(line.pt0.y + 30);
+	if (line.pt0.y < line.pt1.y)  y2 = (int)(line.pt1.y + 30);
+	int leftPos = x1;
+	int topPos = y1;
+
+	m_locPointResult.x = (int)(m_cx + offset.x);
+	m_locPointResult.y = (int)(m_cy + offset.y);
+
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return -3;
+	line.pt0.x -= leftPos;
+	line.pt0.y -= topPos;
+	line.pt1.x -= leftPos;
+	line.pt1.y -= topPos;
+
+//	HalconCpp::HObject hProcImage;
+//	HalconCpp::MedianImage(hImage, &hProcImage, "circle", 1, "mirrored");
+	bool valid = false;
+	if (0 == infMeasure.typePoint) {
+		//valid = CVisionBufferPro::GetMeasurePos(hImage, line,
+		//	infMeasure.typePoint,
+		//	infMeasure.pointThres, infMeasure.modePoint,
+		//	infMeasure.nearThres, infMeasure.modeNear, 
+		//	5, m_ptMeasureResult, m_ptNearResult);
+	}
+	else {
+		//valid = CVisionBufferPro::GetMeasurePos(hImage, line,
+		//	infMeasure.typePoint,
+		//	infMeasure.pointThres, infMeasure.modePoint,
+		//	infMeasure.nearThres, infMeasure.modeNear,
+		//	5, m_ptNearResult, m_ptMeasureResult);
+	}
+	if (!valid) {
+		m_ptMeasureResult.x = 0.0f;
+		m_ptMeasureResult.y = 0.0f;
+		m_ptNearResult.x = 0.0f;
+		m_ptNearResult.y = 0.0f;
+	}
+	else {
+		m_ptMeasureResult.x += leftPos;
+		m_ptMeasureResult.y += topPos;
+		m_ptNearResult.x += leftPos;
+		m_ptNearResult.y += topPos;
+	}
+
+	if (!valid) {
+		return -4;
+	}
+
+	m_locPointResult.x = (int)(m_ptMeasureResult.x);
+	m_locPointResult.y = (int)(m_ptMeasureResult.y);
+
+	return 0;
+}
+
+Line2D CDistDotProcess::GetTargeLine(void) {
+	/* code */
+	Line2D lineResult;
+	double angle = m_angle;
+	double xa = m_len1;
+	double xb = m_len2;
+	double x = m_cx;
+	double y = m_cy;
+	Point2D ptCenter;
+	ptCenter.x = x;
+	ptCenter.y = y;
+
+	double phi = ClsVision::DegreeToRad(angle);
+	double cosx = ClsVision::GetCos(phi);
+	double sinx = ClsVision::GetSin(phi);
+
+	lineResult.pt0.x = ptCenter.x + xa * cosx;
+	lineResult.pt0.y = ptCenter.y - xa * sinx;
+	lineResult.pt1.x = 2 * ptCenter.x - lineResult.pt0.x;
+	lineResult.pt1.y = 2 * ptCenter.y - lineResult.pt0.y;
+	return lineResult;
+}
+
+int CDistDotProcess::Serialized(void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+	int useSize = 0;
+	int nRet = 0;
+
+#if 0
+	//1. 保存ID和名称
+	int iValue = (int)(m_eDir);
+	SERIALIZER_INT_32(iValue, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_id, pTemp, remainSize, useSize);
+	std::string strName(CT2A(m_strName.GetString()));
+	SERIALIZER_STRING(strName, pTemp, remainSize, useSize);
+
+	//2. 保存区域范围
+	SERIALIZER_DOUBLE(m_xPos, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_yPos, pTemp, remainSize, useSize);
+
+	SERIALIZER_DOUBLE(m_cx, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_cy, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_angle, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_len1, pTemp, remainSize, useSize);
+	SERIALIZER_DOUBLE(m_len2, pTemp, remainSize, useSize);
+
+	SERIALIZER_INT_32(m_idxRefer, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_nRef, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_nRef_, pTemp, remainSize, useSize);
+
+	SERIALIZER_INT_32(m_distMode, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_minValue, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_maxValue, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_ngType, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_incValue, pTemp, remainSize, useSize);
+
+	SERIALIZER_INT_32(m_distMode2, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_minValue2, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_maxValue2, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_ngType2, pTemp, remainSize, useSize);
+	SERIALIZER_INT_32(m_incValue2, pTemp, remainSize, useSize);
+#endif
+
+	return useSize;
+}
+
+int CDistDotProcess::Deserialized(void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+	int useSize = 0;
+	int nRet = 0;
+
+#if 0
+	//1. 保存ID和名称
+	int iValue = 0;
+	DESERIALIZER_INT_32(iValue, pTemp, remainSize, useSize);
+	m_eDir = (DimensionDir)(iValue);
+	DESERIALIZER_INT_32(m_id, pTemp, remainSize, useSize);
+	std::string strName; 
+	DESERIALIZER_STRING(strName, pTemp, remainSize, useSize);
+	m_strName = CA2T(strName.c_str());
+
+	//2. 保存区域范围
+	DESERIALIZER_DOUBLE(m_xPos, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_yPos, pTemp, remainSize, useSize);
+
+	DESERIALIZER_DOUBLE(m_cx, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_cy, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_angle, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_len1, pTemp, remainSize, useSize);
+	DESERIALIZER_DOUBLE(m_len2, pTemp, remainSize, useSize);
+
+	DESERIALIZER_INT_32(m_idxRefer, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_nRef, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_nRef_, pTemp, remainSize, useSize);
+
+	DESERIALIZER_INT_32(m_distMode, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_minValue, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_maxValue, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_ngType, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_incValue, pTemp, remainSize, useSize);
+
+	DESERIALIZER_INT_32(m_distMode2, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_minValue2, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_maxValue2, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_ngType2, pTemp, remainSize, useSize);
+	DESERIALIZER_INT_32(m_incValue2, pTemp, remainSize, useSize);
+
+	if (m_xPos <= 0.001 && m_yPos <= 0.001) {
+		HalconCpp::GenEmptyObj(&m_hRegion);
+	}
+	else {
+		HalconCpp::GenCircle(&m_hRegion, m_yPos, m_xPos, 25);
+	}
+
+	if (m_len1 < 0.01 || m_len2 < 0.01) {
+		HalconCpp::GenEmptyObj(&m_hRegion);
+	}
+	else {
+		HalconCpp::GenRectangle2(&m_hLineRegion, m_cy, m_cx, ClsVision::DegreeToRad(m_angle), m_len1, m_len2);
+	}
+#endif
+	
+	return useSize;
+}
+
+void CDistDotProcess::setRoiRegion(HalconCpp::HObject &hRegion) {
+	/* code */
+	m_xPos = 0.0f;
+	m_yPos = 0.0f;
+	if (!ClsVision::RegionExist(hRegion)){
+		HalconCpp::GenEmptyObj(&m_hRegion);
+		return;
+	}
+
+	int nArea = 0;
+	ClsVision::AreaCenter(hRegion, nArea, m_xPos, m_yPos);
+	m_hRegion = hRegion;
+}
+
+void CDistDotProcess::setLineRegion(HalconCpp::HObject &hRegion) {
+	/* code */
+	m_cx = 0.0f;
+	m_cy = 0.0f;
+	m_angle = 0.0f;
+	m_len1 = 0.0f;
+	m_len2 = 0.0f;
+	if (!ClsVision::RegionExist(hRegion)) {
+		HalconCpp::GenEmptyObj(&m_hLineRegion);
+		return;
+	}
+
+	ClsVision::SmallestRectangle2(hRegion, m_cx, m_cy, m_angle, m_len1, m_len2);
+	m_hLineRegion = hRegion;
+}
+
+Point2I CDistDotProcess::getPose(void) {
+	/* code */
+	Point2I result;
+	result.x = (int)(m_cx);
+	result.y = (int)(m_cy);
+	return result;
+}
+
+void CDistDotProcess::setPoint(Point2I pt, int nType) {
+	/* code */
+	if (0 == nType) {
+		m_topMark = pt;
+	}
+	else if (1 == nType) {
+		m_botMark = pt;
+	}
+	else if (2 == nType) {
+		m_topPoint = pt;
+	}
+	else if (3 == nType) {
+		m_botPoint = pt;
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/DistDotProcess.h b/Common_Class/BlVisionPro/Vision/DistDotProcess.h
new file mode 100644
index 0000000..c73258e
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/DistDotProcess.h
@@ -0,0 +1,105 @@
+#ifndef DIST_DOT_PROCESS
+#define DIST_DOT_PROCESS
+
+class CDistDotProcess
+{
+public:
+	CDistDotProcess();
+	CDistDotProcess(DimensionDir eDir, int id);
+	~CDistDotProcess();
+
+public:
+	//1. get id
+	int getID(void);
+
+	//2. 执行检测
+	int Execute(DimensionDir eDir, MeasureInfo inf, Point2I offset);
+
+	//3. 序列化参数和反序列号参数
+	int Serialized(void* pBuffer, int size);
+	int Deserialized(void* pBuffer, int size);
+
+	//4. 设置ROI区域
+	void setRoiRegion(HalconCpp::HObject &hRegion);
+
+	//5. 设置测量直线
+	void setLineRegion(HalconCpp::HObject &hRegion);
+
+	//6. 获取位置
+	Point2I getPose(void);
+
+	//7. 设置位置
+	void setPoint(Point2I pt, int nType);
+
+public:
+	DimensionDir m_eDir;                 //
+	CString m_strName;                   //Name
+	int m_idxRefer;                      //index
+	int m_nRef;                          //Pos+
+	int m_nRef_;                         //Pos-
+
+	int m_distMode;
+	int m_minValue;
+	int m_maxValue;
+	int m_ngType;
+	int m_incValue;
+
+	int m_distMode2;
+	int m_minValue2;
+	int m_maxValue2;
+	int m_ngType2;
+	int m_incValue2;
+
+	Point2D m_ptMeasureResult;
+	Point2D m_ptNearResult;
+	Point2D m_ptMatchResult;
+	Point2I m_locPointResult;
+
+	HalconCpp::HObject m_hRegion;
+	HalconCpp::HObject m_hLineRegion;
+
+	std::vector<NgDotInfo> m_nNgInfo;
+
+private:
+	int m_id;            //ID
+
+	double m_xPos;
+	double m_yPos;
+	
+	double m_cx;
+	double m_cy;
+	double m_angle;
+	double m_len1;
+	double m_len2;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+	Point2I m_topPoint;
+	Point2I m_botPoint;
+	Point2I m_topMark;
+	Point2I m_botMark;
+
+private:
+	//1. 查找查找
+	int findPairEdge(DimensionDir eDir, MeasureInfo infMeasure, Point2I offset);
+
+	//2. 分析区域
+	Line2D GetTargeLine(void);
+
+	//3. 获取目标点的位置
+	int getKeyPose(Point2I offset);
+
+	//4. 结果判断
+	void JudgeResult(void);
+
+	//5. 检测第一个判断
+	void JudgeFirstResult(void);
+
+	//6. 检测第二个缺陷
+	void JudgeSecondResult(void);
+
+	//7. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/EiVisionType.h b/Common_Class/BlVisionPro/Vision/EiVisionType.h
new file mode 100644
index 0000000..867a2b8
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/EiVisionType.h
@@ -0,0 +1,149 @@
+#ifndef EI_VISION_TYPE
+#define EI_VISION_TYPE
+
+enum VISION_RECIPE_TYPE {
+	LOC_VISION_TYPE = 0,
+	LOC_VISION_PROCESS,
+	GRIND_VISION_TYPE,
+	GRIND_VISION_PROCESS,
+	CUT_VISION_TYPE,
+	CUT_VISION_PROCESS,
+	KDIST_VISION_TYPE,
+	KDIST_VISION_PROCESS,
+	RCUT_VISION_TYPE,
+	RCUT_VISION_PROCESS,
+	THRES_VISION_TYPE,
+	THRES_VISION_PROCESS,
+	HOLE_VISION_TYPE,
+	HOLE_VISION_PROCESS
+};
+
+enum    VISION_TYPE { 
+	VISION_LOC = 0,               //DIST算法
+	VISION_CUT,                   //CUT距离
+	VISION_GRIND,
+	VISION_KDIST,
+	VISION_RCUT,                  //RCUT算法
+	VISION_THRES,
+	VISION_HOLE,
+	VISION_NONE };
+
+#define NG_INF_NUM          1000
+
+enum DefectNgLoc {
+	DefectLoc_OK = 0,    //OK
+	DefectLoc_Chip,      //Chip
+	DefectLoc_Broken,    //破损
+	DefectLoc_Grind,     //研磨
+	DefectLoc_Dist_Cut,  //切割精度
+	DefectLoc_Corner_Dist, //角精度
+	DefectLoc_HOLE,			//Hole
+	DefectLoc_Unknown       //指错误
+};
+
+static UINT _gGridFixCellColor = RGB(144, 200, 246);
+static UINT _gGridFixFontColor = RGB(0, 0, 0);
+static UINT _gGridCellColor = RGB(255, 255, 255);
+static UINT _gGridCellColor_NonSelect = RGB(150, 150, 150);
+static UINT _gGridCellReadyColor = RGB(255, 255, 0);
+static UINT _gGridCellOnColor = RGB(255, 69, 0);
+static UINT _gGridCellOffColor = RGB(128, 191, 255);
+static UINT _gPropertyGridFixCellColor = RGB(150, 150, 150);
+static UINT _gPropertyGridFixFontColor = RGB(0, 0, 0);
+static UINT _gSequenceOffColor = RGB(0, 0, 0);
+static UINT _gSequenceOnColor = RGB(0, 180, 0);
+
+typedef struct _NgDotInfo
+{
+	int eDir;                //检测面
+	int id;                  //检测ID
+	CString strName;        //名称
+	int xPosPxl;            //X位置
+	int yPosPxl;            //Y位置
+	double result;          //结果
+	double xResult;          //X结果
+	double yResult;          //Y结果
+	double minValue;        //下限
+	double maxValue;        //限制
+	bool isRes;             //检测结果
+	int x1;                 //缺陷的最小矩形
+	int y1;                 //缺陷的最小矩形
+	int x2;                 //缺陷的最小矩形
+	int y2;                 //缺陷的最小矩形
+	int ngType;             //缺陷类型
+	int eVision;            //视觉算法
+}NgDotInfo;
+
+typedef struct _MeasureInfo
+{
+	int idxRefer;
+	int typePoint;
+	int modePoint;
+	int pointThres;
+	int modeNear;
+	int nearThres;
+}MeasureInfo;
+
+typedef struct _ScanSetting
+{
+	int lengthSize;
+	int shortSize;
+	int nStdIndex;
+	int nIndex0;
+	int nIndex1;
+	int nIndex2;
+	int nIndex3;
+	int nLengthScan;
+	int nShortScan;
+}ScanSetting;
+
+typedef struct _VisionDisplayInfo
+{
+	bool isVisionDisplay;
+	bool isGrindDisplay;
+	bool isDistDisplay;
+	bool isCutDisplay;
+	bool isRcutDisplay;
+	bool isThresDisplay;
+	bool isHoleDisplay;
+}VisionDisplayInfo;
+
+typedef struct _VisionUseInfo
+{
+	bool isVisionUse;         //视觉
+	bool isLocUse;            //定位
+	bool isDistUse;           //距离
+	bool isCutUse;            //切割线
+	bool isGrindUse;          //研磨量          
+	bool isRcutUse;           //RCUT
+	bool isThresUse;          //Thres
+	bool isHoleUse;            //Hole
+}VisionUseInfo;
+
+typedef struct _DistIncInfo
+{
+	int incGrind;
+	int incTop;
+	int incBot;
+	int incKey;
+	int incCut;
+}DistIncInfo;
+
+typedef struct _DispResultObject
+{
+	HalconCpp::HObject hDispRegion;
+	HalconCpp::HObject hDispObject;
+}DispResultObject;
+
+typedef struct _KeyDebugInfo
+{
+	bool isDebugTool; 
+	bool isInspectKey;
+	bool isLocKey;
+	bool isGrindKey;
+	bool isCutLineKey;
+	bool isDistKey;
+	bool isRcutKey;
+}KeyDebugInfo;
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/FileRecipe.cpp b/Common_Class/BlVisionPro/Vision/FileRecipe.cpp
new file mode 100644
index 0000000..86a3643
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/FileRecipe.cpp
@@ -0,0 +1,195 @@
+#include "stdafx.h"
+#include <io.h>
+#include "FileRecipe.h"
+#include <time.h>
+#include <stdarg.h>
+#include <direct.h>
+#include <vector>
+#include <Dbghelp.h>
+#pragma comment(lib,"Dbghelp.lib")
+
+CFileRecipe::CFileRecipe()
+{
+}
+
+CFileRecipe::~CFileRecipe()
+{
+}
+
+bool CFileRecipe::fileIsExist(std::string fileName) {
+	/* code */
+	if (-1 != _access(fileName.c_str(), 0)) return true;
+
+	return false;
+}
+
+void CFileRecipe::removeDir(std::string dirPath) {
+	/* code */
+	struct _finddata_t fb;   // 查找相同属性文件的存储结构体
+	string path;
+	long long  handle; // 注意此处需要long*2
+	int   noFile;            // 对系统隐藏文件的处理标记
+
+	noFile = 0;
+	handle = 0;
+
+	struct stat s;
+	if (stat(dirPath.c_str(), &s) == 0) {
+		if (s.st_mode & S_IFDIR) {
+			std::cout << "it's a directory" << std::endl;
+		}
+		else if (s.st_mode & S_IFREG) {
+			std::cout << "it's a file" << std::endl;
+		}
+		else {
+			std::cout << "not file not directory" << std::endl;
+		}
+	}
+	else {
+		std::cout << "error, doesn't exist" << std::endl;
+		return;
+	}
+
+	path = dirPath + "/*";
+
+	handle = _findfirst(path.c_str(), &fb);
+	// 找到第一个匹配的文件
+	if (handle != 0){
+		// 当可以继续找到匹配的文件,继续执行
+		while (0 == _findnext(handle, &fb)){
+			// windows下,常有个系统文件,名为“..”,对它不做处理
+			noFile = strcmp(fb.name, "..");
+
+			if (0 != noFile){
+				path = dirPath + "/" + fb.name;
+
+				// 属性值为16,则说明是文件夹,迭代
+				if (fb.attrib == 16){
+					removeDir(path);
+				}
+				// 非文件夹的文件,直接删除。对文件属性值的情况没做详细调查,可能还有其他情况。
+				else{
+					remove(path.c_str());
+				}
+			}
+		}
+		//删除空目录
+//		_rmdir(dirPath.c_str());
+		// 关闭文件夹,只有关闭了才能删除。找这个函数找了很久,标准c中用的是closedir
+		// 经验介绍:一般产生Handle的函数执行后,都要进行关闭的动作。
+		_findclose(handle);
+	}
+}
+
+void CFileRecipe::makeDir(std::string dirName) {
+	/* code */
+	MakeSureDirectoryPathExists(dirName.c_str());
+}
+
+bool CFileRecipe::openRecipeFile(CStdioFile &fileRecipe, CString fileName) {
+	/* code */
+	if (!fileRecipe.Open(fileName, CFile::modeCreate | CFile::modeReadWrite)) return false;
+
+	return true;
+}
+
+bool CFileRecipe::readRecileFile(CStdioFile &fileRecipe, CString fileName) {
+	/* code */
+	if (!fileRecipe.Open(fileName, CFile::modeRead)) return false;
+
+	return true;
+}
+
+CString CFileRecipe::toCString(std::string str) {
+	/* code */
+	CString strRes = CA2T(str.c_str());
+	return strRes;
+}
+
+std::string CFileRecipe::toString(CString str) {
+	/* code */
+	std::string strRes(CT2A(str.GetString()));
+	return strRes;
+}
+
+void CFileRecipe::WriteString(CStdioFile &fileRecipe, std::string strText) {
+	/* code */
+	CString str = toCString(strText);
+	fileRecipe.WriteString(str);
+}
+
+void CFileRecipe::WriteCString(CStdioFile &fileRecipe, CString strText) {
+	/* code */
+	fileRecipe.WriteString(strText);
+}
+
+BOOL CFileRecipe::ReadString(CStdioFile &fileRecipe, CString &strRes) {
+	/* code */
+	return fileRecipe.ReadString(strRes);
+}
+
+void StringTrim(std::string& s) {
+	/* code */
+	if (!s.empty()) {
+		s.erase(0, s.find_first_not_of(" "));
+		s.erase(s.find_last_not_of(" ") + 1);
+	}
+}
+
+int CFileRecipe::StringSplit(const std::string& strScr, const std::string& delim, std::vector<std::string>& strings) {
+	/* code */
+	strings.clear();
+	size_t pos = 0;
+	size_t len = strScr.length();
+	size_t delim_len = delim.length();
+	if (delim_len == 0) {
+		return 0;
+	}
+
+	while (pos < len) {
+		size_t find_pos = strScr.find(delim, pos);
+		if (find_pos == strScr.npos) {
+			std::string str2 = strScr.substr(pos, len - pos);
+			StringTrim(str2);
+			strings.push_back(str2);
+			break;
+		}
+
+		std::string str2 = strScr.substr(pos, find_pos - pos);
+		StringTrim(str2);
+		strings.push_back(str2);
+		pos = find_pos + delim_len;
+	}
+
+	return (int)strings.size();
+}
+
+int CFileRecipe::CStringSplit(const CString& strText, const std::string& delim, std::vector<std::string>& strings) {
+	/* code */
+	std::string str = toString(strText);
+	return StringSplit(str, delim, strings);
+}
+
+int CFileRecipe::CStringToInt(CString strText) {
+	/* code */
+	int result = _wtoi(strText);
+	return result;
+}
+
+int CFileRecipe::StringToInt(std::string str) {
+	/* code */
+	CString strText = toCString(str);
+	return CStringToInt(strText);
+}
+
+double CFileRecipe::CStringToF(CString strText) {
+	/* code */
+	double result = _wtof(strText);
+	return result;
+}
+
+double CFileRecipe::StringToF(std::string str) {
+	/* code */
+	CString strText = toCString(str);
+	return CStringToF(strText);
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/FileRecipe.h b/Common_Class/BlVisionPro/Vision/FileRecipe.h
new file mode 100644
index 0000000..fb65054
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/FileRecipe.h
@@ -0,0 +1,53 @@
+#ifndef FILE_RECIPE_H
+#define FILE_RECIPE_H
+
+#include "LocProcess.h"
+
+class CFileRecipe
+{
+public:
+	CFileRecipe();
+	~CFileRecipe();
+
+public:
+	//1. 文件是否存在
+   static bool fileIsExist(std::string fileName);
+
+	//2. 删除文件下的所有文件
+   static void removeDir(std::string dirPath);
+
+   //3. 创建目录
+   static void makeDir(std::string dirName);
+
+   //4. 打开和创建CSV文件
+   static bool openRecipeFile(CStdioFile &fileRecipe, CString fileName);
+   static bool readRecileFile(CStdioFile &fileRecipe, CString fileName);
+
+   //5. 格式转换
+   static CString toCString(std::string str);
+
+   //6. 格式转换
+   static std::string toString(CString str);
+
+   //7. 写入CSV文件
+   static void WriteString(CStdioFile &fileRecipe, std::string strText);
+   static void WriteCString(CStdioFile &fileRecipe, CString strText);
+
+   //8. 读取文件
+   static BOOL ReadString(CStdioFile &fileRecipe, CString &strRes);
+   //9. 字符分割
+   static int StringSplit(const std::string& strScr, const std::string& delim, std::vector<std::string>& strings);
+   static int CStringSplit(const CString& strText, const std::string& delim, std::vector<std::string>& strings);
+
+   //10. 数据转换
+   static int CStringToInt(CString strText);
+   static int StringToInt(std::string str);
+   static double CStringToF(CString strText);
+   static double StringToF(std::string str);
+
+private:
+
+};
+
+#endif
+
diff --git a/Common_Class/BlVisionPro/Vision/GrindDotProcess.cpp b/Common_Class/BlVisionPro/Vision/GrindDotProcess.cpp
new file mode 100644
index 0000000..5cdb38a
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/GrindDotProcess.cpp
@@ -0,0 +1,345 @@
+#include "stdafx.h"
+#include "GrindDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+
+CGrindDotProcess::CGrindDotProcess()
+{
+	/* code */
+	m_poseType = 0;
+	m_eDir = DIMENSION_NONE;
+	m_id = 0;
+
+	m_nUse = 0;
+	m_strName.Format(_T("P%d"), m_id);
+
+	m_nPosY = 0;
+
+	m_nInc = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_distResult = 0.0f;
+
+	m_nEdgeThres = 20;
+	m_nLeftLineDist = 0;
+}
+
+CGrindDotProcess::CGrindDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_poseType = 0;
+	m_eDir = eDir;
+	m_id = id;
+	m_nLeftLineDist = 0;
+
+	m_nUse = 0;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_G%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_G%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_G%d"), m_id);
+		break;
+	}
+
+	m_nPosY = 0;
+
+	m_nInc = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_distResult = 0.0f;
+	m_nEdgeThres = 20;
+}
+
+CGrindDotProcess::~CGrindDotProcess(){
+	/* code */
+}
+
+int CGrindDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	m_ptNearResult.x = 0.0f;
+	m_ptNearResult.y = 0.0f;
+	m_ptMeasureResult.x = 0.0f;
+	m_ptMeasureResult.y = 0.0f;
+	m_ptLeftResult.x = 0;
+	m_ptLeftResult.y = 0;
+	m_leftLineResult = 0;
+	if (1 != m_nUse) return 0;
+	if (0 == m_nLeftLineDist)  return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 查找left
+	if (!FindLeftLine(eDir, offset)) return -1;
+
+	//3. 结果判断
+	judgeResult();
+
+	return 0;
+}
+
+bool CGrindDotProcess::FindLeftLine(DimensionDir eDir, Point2I offset) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return false;
+	if (0 == m_poseType) {
+		if (!pSideData->m_bTopMark_Find)  return false;
+		if (!pSideData->m_bBotMark_Find)  return false;
+	}
+	else {
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	Point2I ptOffset;
+	ptOffset.x = m_nLeftLineDist;
+	ptOffset.y = m_nPosY;
+	Point2I result;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result))  return false;
+	m_locPointResult = result;
+
+	int x1 = result.x - 200;
+	int y1 = result.y - 31;
+	int x2 = result.x + 200;
+	int y2 = result.y + 31;
+	Point2I leftTop;
+	leftTop.x = x1;
+	leftTop.y = y1;
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return false;
+
+	HalconCpp::HObject hMeanImage;
+	HalconCpp::MeanImage(hImage, &hMeanImage, 1, 20);
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 10 || height < 25)  return false;
+
+	Line2D line;
+	line.pt0.x = 5;
+	line.pt0.y = 0.5 * height - 1;
+	line.pt1.x = width - 6;
+	line.pt1.y = 0.5 * height - 1;
+	Point2D ptStart, ptEnd;
+	if (!CVisionBufferPro::GetMeasureNearPos(hMeanImage, line, m_nEdgeThres, 0, 10, ptStart, ptEnd)) return false;
+
+	m_ptMeasureResult = ptStart;
+	m_ptMeasureResult.x += leftTop.x;
+	m_ptMeasureResult.y += leftTop.y;
+	m_ptNearResult = ptEnd;
+	m_ptNearResult.x += leftTop.x;
+	m_ptNearResult.y += leftTop.y;
+	
+	m_ptLeftResult.x = (int)(m_ptMeasureResult.x);
+	m_ptLeftResult.y = (int)(m_ptMeasureResult.y);
+
+	return true;
+}
+
+void CGrindDotProcess::setLeftLine(int nLeftDist, int leftThres) {
+	/* code */
+	m_nLeftLineDist = nLeftDist;
+	m_nLeftThres = leftThres;
+}
+
+int CGrindDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+void CGrindDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+void CGrindDotProcess::judgeResult(void) {
+	/* code */
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return;
+	if (nullptr != pSideData) {  //区域的显示结果
+		//1. 输出边界点1
+        DispVisionResult inf;
+		inf.nType = 0;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_GRIND);
+		inf.pointX = (int)(m_ptMeasureResult.x);
+		inf.pointY = (int)(m_ptMeasureResult.y);
+		inf.showROI = 0;
+        pSideData->m_vDispVisionResult.push_back(inf);
+
+		//2. 输出直线
+		inf.nType = 3;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_GRIND);
+		inf.rectX1 = (int)(m_ptMeasureResult.x);
+		inf.rectY1 = (int)(m_ptMeasureResult.y);
+		inf.rectX2 = (int)(m_ptNearResult.x);
+		inf.rectY2 = (int)(m_ptNearResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		//4. 输出位置
+		inf.nType = 4;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_GRIND);
+		inf.pointX = (int)(m_ptMeasureResult.x);
+		inf.pointY = (int)(m_ptMeasureResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	m_nNgInfo.clear();
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_nMin;
+	ng.maxValue = m_nMax;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_KDIST;
+
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+
+	ng.ngType = DefectLoc_Grind;
+	double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x);
+	double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y);
+	m_distResult = sqrt(dx * dx + dy * dy);
+	m_distResult += m_nInc;
+	ng.result = m_distResult;
+
+	if (m_nMax < 0.5) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	if (ng.result < m_nMin || ng.result > m_nMax) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+Json::Value CGrindDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+
+	Json::Value jsValue;
+	jsValue["alg type"] = GRIND_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["use"] = m_nUse;
+	jsValue["pos y"] = m_nPosY;
+	jsValue["end Thres"] = m_nEdgeThres;
+	jsValue["inc"] = m_nInc;
+	jsValue["min"] = m_nMin;
+	jsValue["max"] = m_nMax;
+	jsValue["pos type"] = m_poseType;
+
+	return jsValue;
+}
+
+void CGrindDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosY = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. end Thres
+	strName = "end Thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEdgeThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. inc
+	strName = "inc";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nInc = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. min
+	strName = "min";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMin = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. max
+	strName = "max";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMax = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. pos type
+	strName = "pos type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_poseType = jsValue[strName.c_str()].asInt();
+	}
+}
diff --git a/Common_Class/BlVisionPro/Vision/GrindDotProcess.h b/Common_Class/BlVisionPro/Vision/GrindDotProcess.h
new file mode 100644
index 0000000..d707fb4
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/GrindDotProcess.h
@@ -0,0 +1,72 @@
+#ifndef GRIND_DOT_PROCESS_H
+#define GRIND_DOT_PROCESS_H
+
+#include "IncludeVision.h"
+
+class CGrindDotProcess
+{
+public:
+	CGrindDotProcess();
+	CGrindDotProcess(DimensionDir eDir, int id);
+	~CGrindDotProcess();
+
+public:
+	//1. 设置测量
+	void setLeftLine(int nLeftDist, int leftThres);
+
+	//2. 执行
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//3. 获取ID
+	int getID(void);
+
+	//6. 保存数据
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	int m_nUse;
+	CString m_strName;
+
+	int m_poseType;             //位置信息
+	int m_nPosY;                //Y方向的距离
+
+	int m_nLeftThres;           //左边界亮度阈值
+	int m_nLeftLineDist;        //左边界的距离
+	int m_nEdgeThres;           //研磨边阈值
+//	int m_nLineWidth;           //分析距离
+
+	int m_nInc;                //INC补偿值
+	int m_nMin;                //判定阈值
+	int m_nMax;                //判定阈值
+
+	Point2D m_ptMeasureResult;
+	Point2D m_ptNearResult;
+	Point2I m_locPointResult;
+
+	Point2I m_ptLeftResult;             //左边界的点
+	double m_distResult;
+	int m_leftLineResult;
+
+	std::vector<NgDotInfo> m_nNgInfo;
+	
+
+private:
+	DimensionDir m_eDir; 
+	int m_id;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+
+private:
+	//1. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+
+	//2. 判断结果
+	void judgeResult(void);
+
+	//3. 查找边界
+	bool FindLeftLine(DimensionDir eDir, Point2I offset);
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/GrindProcess.cpp b/Common_Class/BlVisionPro/Vision/GrindProcess.cpp
new file mode 100644
index 0000000..2848c50
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/GrindProcess.cpp
@@ -0,0 +1,123 @@
+#include "stdafx.h"
+#include "GrindProcess.h"
+#include "BlSideData.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CGrindProcess::CGrindProcess() {
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CGrindDotProcess(m_eDir, i + 1);
+	}
+	m_isUse = false;
+
+	m_nLeftLineDist = 0;
+	m_nLeftThres = 20;
+}
+
+CGrindProcess::CGrindProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	m_isUse = false;
+	m_nLeftLineDist = 0;
+	m_nLeftThres = 20;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CGrindDotProcess(m_eDir, i + 1);
+	}
+
+}
+
+CGrindProcess::~CGrindProcess() {
+	/* code */
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+void CGrindProcess::Execute(DimensionDir eDir) {
+	/* code */
+	if (!m_isUse) return;
+
+	MeasureInfo m_info;
+
+	m_info.idxRefer = 10;
+	m_info.modePoint = 0;
+	m_info.modeNear = 0;
+	m_info.typePoint = 0;
+	m_info.pointThres = 15;
+	m_info.nearThres = 30;
+
+	Point2I offset;
+	for (int i = 0; i < 50; i++) {
+		CGrindDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse)   continue;
+
+		offset.x = i;
+		offset.y = i;
+
+		dot->setLeftLine(m_nLeftLineDist, m_nLeftThres);
+		dot->Execute(m_eDir, offset);
+	}
+}
+
+Json::Value CGrindProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = GRIND_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["use"] = m_isUse;
+	jsValue["toMark"] = m_nLeftLineDist;
+	jsValue["leftThres"] = m_nLeftThres;
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CGrindProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) {
+		m_isUse = jsValue[strName.c_str()].asBool();
+	}
+
+	//3. idxRefer
+	strName = "toMark";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nLeftLineDist = jsValue[strName.c_str()].asInt();
+	}
+
+	//4. typePoint
+	strName = "leftThres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nLeftThres = jsValue[strName.c_str()].asInt();
+	}
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/GrindProcess.h b/Common_Class/BlVisionPro/Vision/GrindProcess.h
new file mode 100644
index 0000000..51a25fd
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/GrindProcess.h
@@ -0,0 +1,30 @@
+#ifndef GRIND_PROCESS_H
+#define GRIND_PROCESS_H
+
+#include "GrindDotProcess.h"
+
+class CGrindProcess
+{
+public:
+	CGrindProcess();
+	CGrindProcess(DimensionDir eDir);
+	~CGrindProcess();
+
+public:
+	bool m_isUse;   //是否启用
+	DimensionDir m_eDir;
+	int m_nLeftLineDist;
+	int m_nLeftThres;
+
+	CGrindDotProcess *m_dots[50];
+
+public:
+	//1. 执行检测
+	void Execute(DimensionDir eDir);
+
+	//2. 保存文件
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/HoleDotProcess.cpp b/Common_Class/BlVisionPro/Vision/HoleDotProcess.cpp
new file mode 100644
index 0000000..e29b162
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/HoleDotProcess.cpp
@@ -0,0 +1,494 @@
+#include "stdafx.h"
+#include "HoleDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+
+CHoleDotProcess::CHoleDotProcess(){
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	m_id = 0;
+	m_strName.Format(_T("P%d"), m_id);
+    m_nUse = 0;
+	m_nPoseType = 0;
+	m_nShapeType = 2;
+	m_nSmoothSize = 8;
+	m_nBrightType = 1;
+	m_nDefectSize = 3;
+	m_nThres = 45;
+
+
+	m_xScale = 1.0f;
+	m_yScale = 1.0f;
+	m_isScale = false;
+	m_nPoseX = 0;
+	m_nPoseX = 0;
+	m_score = 0.5f;
+	m_idModel = HalconCpp::HTuple();
+	m_nNgInfo.clear();
+
+	HalconCpp::GenEmptyObj(&m_hImage);
+	HalconCpp::GenEmptyObj(&m_hImageResult);
+}
+
+CHoleDotProcess::CHoleDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_eDir = eDir;
+	m_id = id;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_H%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_H%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_H%d"), m_id);
+		break;
+	}
+	m_nUse = 0;
+	m_nPoseType = 0;
+	m_nShapeType = 2;
+	m_nSmoothSize = 8;
+	m_nBrightType = 1;
+	m_nDefectSize = 3;
+	m_nThres = 45;
+
+
+	m_xScale = 1.0f;
+	m_yScale = 1.0f;
+	m_isScale = false;
+	m_nPoseX = 0;
+	m_nPoseX = 0;
+	m_score = 0.5f;
+	m_idModel = HalconCpp::HTuple();
+	m_nNgInfo.clear();
+
+	HalconCpp::GenEmptyObj(&m_hImage);
+	HalconCpp::GenEmptyObj(&m_hImageResult);
+}
+
+CHoleDotProcess::~CHoleDotProcess(){
+	/* code */
+
+}
+
+Json::Value CHoleDotProcess::WriteToJson(std::string& strDir) {
+	/* code */
+	int iValue = 0;
+	if (ClsVision::ObjectExist(m_hImage)) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_hImage, width, height);
+		if (width > 0 && height > 0) {
+			iValue = 1;
+		}
+	}
+	std::string strImage = "NULL";
+	if (1 == iValue) {
+		strImage = ClsVision::FormatString("%d_%d_hole", m_eDir, m_id);
+	}
+
+	Json::Value jsValue;
+	std::string strName = CFileRecipe::toString(m_strName);
+	jsValue["alg type"] = HOLE_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+    jsValue["use"] = m_nUse;
+	jsValue["Pos Type"] = m_nPoseType;
+	jsValue["Shape Type"] = m_nShapeType;
+	jsValue["Bright Type"] = m_nBrightType;
+	jsValue["Thres"] = m_nThres;
+    jsValue["Smooth Size"] = m_nSmoothSize;
+	jsValue["Defect Size"] = m_nDefectSize;
+	jsValue["Pose X"] = m_nPoseX;
+    jsValue["Pose Y"] = m_nPoseY;
+	jsValue["image file"] = strImage;
+
+	std::string imageDir = strDir + "Image\\";
+	if (!CFileRecipe::fileIsExist(imageDir)) {
+		CFileRecipe::makeDir(imageDir);
+	}
+	if (0 == iValue) return jsValue;
+
+
+	std::string fileName = imageDir + strImage + ".jpg";
+	HalconCpp::WriteImage(m_hImage, "jpeg", 0, fileName.c_str());
+	return jsValue;
+}
+
+void CHoleDotProcess::DecodeJson(std::string& strDir, Json::Value& jsValue) {
+	/* code */
+	if (strDir.empty()) return;
+
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. Pose Type
+	strName = "Pos Type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseType = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. Shape Type
+	strName = "Shape Type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nShapeType = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. Bright Type
+    strName = "Bright Type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nBrightType = jsValue[strName.c_str()].asInt();
+	}
+   
+	//8. Thres
+	strName = "Thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. Smooth Size
+	strName = "Smooth Size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nSmoothSize = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. Defect Size
+	strName = "Defect Size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nDefectSize = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. Pose X
+	strName = "Pose X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseX = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. Pose Y
+	strName = "Pose Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseY = jsValue[strName.c_str()].asInt();
+	}
+
+	//13. image file
+	strName = "image file";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		std::string imgFile = jsValue[strName.c_str()].asString();
+		if (0 != imgFile.compare("NULL")) {
+			std::string fileName = strDir + "Image\\" + imgFile + ".jpg";
+			if (CFileRecipe::fileIsExist(fileName)) {
+				HalconCpp::ReadImage(&m_hImage, fileName.c_str());
+				CreateMatchModel();
+			}
+		}
+		else {
+			HalconCpp::GenEmptyObj(&m_hImage);
+			CreateMatchModel();
+		}
+	}
+}
+
+int CHoleDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_ptLocResult.x = 0.0f;
+    m_ptLocResult.y = 0.0f;
+	m_nNgInfo.clear();
+	HalconCpp::GenEmptyObj(&m_hImageResult);
+	if (1 != m_nUse) return 0;
+	if (ClsVision::TupleNil(m_idModel)) {
+		CreateMatchModel();
+	}
+	if (ClsVision::TupleNil(m_idModel)) return 0;
+
+	//查找目标位置,截取分析图像
+	if (!FindTargetPos(eDir, offset)) return 0;
+
+	FindDefectInfo();
+
+	int nRet = (int)(m_nNgInfo.size());
+	return nRet;
+}
+
+bool CHoleDotProcess::FindDefectInfo(void) {
+	/* code */
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return false;
+
+	if (nullptr != pSideData) {
+		DispVisionResult inf;
+		inf.nType = 4;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_THRES);
+		inf.strName = m_strName;
+		inf.pointX = (int)(m_ptLocResult.x);
+		inf.pointY = (int)(m_ptLocResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+
+	int x1 = (int)(m_ptLocResult.x - 0.5 * width);
+	int y1 = (int)(m_ptLocResult.y - 0.5 * height);
+	int x2 = x1 + width - 1;
+	int y2 = y1 + height - 1;
+
+	if (nullptr != pSideData) {
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_THRES);
+		inf.strName = m_strName;
+		inf.rectX1 = x1;
+		inf.rectY1 = y1;
+        inf.rectX2 = x2;
+        inf.rectY2 = y2;
+		inf.showROI = 1;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	if (!CVisionBufferPro::getImageROI(m_eDir, m_hImageResult, x1, y1, x2, y2)) return false;
+
+    //查找缺陷信息
+	HalconCpp::HObject hRoiRegion;
+	if (0 == m_nShapeType) {
+		return false;
+	}
+	else if (1 == m_nShapeType) {
+		HalconCpp::GenRectangle1(&hRoiRegion, m_nSmoothSize, m_nSmoothSize, height - 1 - m_nSmoothSize, width - 1 - m_nSmoothSize);
+	}
+	else {
+		HalconCpp::GenEllipse(&hRoiRegion, 0.5 * (height-1), 0.5 * (width-1),  0, 0.5 * width - m_nSmoothSize, 0.5 * height - m_nSmoothSize);
+	}
+
+	//HalconCpp::HWindow hDispWin(0, 0, width, height);
+	//hDispWin.SetPart(0, 0, height - 1, width - 1);
+	//hDispWin.DispObj(m_hImageResult);
+	//hDispWin.SetDraw("margin");
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hRoiRegion);
+	//hDispWin.Click();
+
+
+	HalconCpp::HObject hProcImage;
+	HalconCpp::ReduceDomain(m_hImageResult, hRoiRegion, &hProcImage);
+	HalconCpp::HObject hRegion, hConnectedRegion, hSelectedRegion;
+	if (1 == m_nBrightType) {
+		HalconCpp::Threshold(hProcImage, &hRegion, 0, m_nThres);
+	}
+	else {
+		HalconCpp::Threshold(hProcImage, &hRegion, m_nThres, 255);
+	}
+	HalconCpp::Connection(hRegion, &hConnectedRegion);
+	HalconCpp::SelectShape(hConnectedRegion, &hSelectedRegion, "area", "and", 10, MAXINT);
+	//hDispWin.SetDraw("fill");
+	//hDispWin.DispObj(hSelectedRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HTuple hvNum;
+	HalconCpp::CountObj(hSelectedRegion, &hvNum);
+	int nCount = hvNum[0].I();
+	if (nCount <1) return false;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = false;
+	ng.minValue = m_nDefectSize;
+	ng.maxValue = m_nDefectSize;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_HOLE;   //缺陷类型
+	ng.eVision = VISION_HOLE;
+
+	double xMmvsp = pSideData->m_dPixelSizeX;
+	double yMmvsp = pSideData->m_dPixelSizeY;
+	HalconCpp::HTuple hvArea, hvY, hvX;
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::AreaCenter(hSelectedRegion, &hvArea, &hvY, &hvX);
+	HalconCpp::SmallestRectangle1(hSelectedRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	for (int i = 0; i < nCount; i++) {
+		int wTmp = hvX2[i].I() - hvX1[i].I() + 1;
+		int hTmp = hvY2[i].I() - hvY1[i].I() + 1;
+		if (wTmp > m_nDefectSize || hTmp > m_nDefectSize) {
+			ng.result = hvArea[i].I();
+			ng.xResult = (int)(xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1));
+			ng.yResult = (int)(yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1));
+			ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + x1;
+			ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + y1;
+
+			ng.x1 = hvX1[i].I() + x1 - 1;
+			ng.y1 = hvY1[i].I() + y1 - 1;
+			ng.x2 = hvX2[i].I() + x1 + 1;
+			ng.y2 = hvY2[i].I() + y1 + 1;
+
+			if (nullptr != pSideData) {  //区域的显示结果
+				DispVisionResult inf;
+				inf.nType = 1;
+				inf.eDir = (int)(m_eDir);
+				inf.strName = m_strName;
+				inf.eVision = (int)(VISION_THRES);
+				inf.rectX1 = ng.x1;
+				inf.rectY1 = ng.y1;
+				inf.rectX2 = ng.x2;
+				inf.rectY2 = ng.y2;
+				inf.showROI = 0;
+				pSideData->m_vDispVisionResult.push_back(inf);
+			}
+
+			m_nNgInfo.push_back(ng);
+		}
+	}
+
+	return true;
+}
+
+bool CHoleDotProcess::FindTargetPos(DimensionDir eDir, Point2I offset) {
+	/* code */
+	if (ClsVision::TupleNil(m_idModel)) return false;
+
+	//获取指定方向的侧边数据
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	//如果侧边数据为空,则返回false
+	if (nullptr == pSideData)  return false;
+	if (0 == m_nPoseType) {
+		//如果侧边数据中没有找到上点,则返回false
+		if (!pSideData->m_bBotMark_Find)  return false;
+		//如果侧边数据中没有找到下点,则返回false
+		if (!pSideData->m_bTopMark_Find)  return false;
+	}
+	else {
+		//如果侧边数据中没有找到上点,则返回false
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		//如果侧边数据中没有找到下点,则返回false
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	//1. 首先计算Key的位置
+	Point2I ptOffset;
+	ptOffset.x = m_nPoseX;
+	ptOffset.y = m_nPoseY;
+	Point2I result;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_nPoseType, result))  return false;
+
+    //2. 计算Image的ROI
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+	int x1 = (int)(result.x - 0.5 * width - 200);
+	int y1 = (int)(result.y - 0.5 * height - 200);
+	int x2 = (int)(result.x + 0.5 * width + 200);
+	int y2 = (int)(result.y + 0.5 * height + 200);
+	HalconCpp::HObject hSearchImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hSearchImage, x1, y1, x2, y2)) return false;
+
+    //3. 查找模板
+	std::vector<ParaMatch> vResult;
+	if (m_isScale) {
+		HalconCpp::HObject hZoomImage;
+		HalconCpp::ZoomImageFactor(hSearchImage, &hZoomImage, m_xScale, m_yScale, "constant");
+		ClsVision::FindNccModel(hZoomImage, m_idModel, m_score, 1, vResult);
+		int sz = (int)(vResult.size());
+		for (int i = 0; i < sz; i++) {
+			vResult[i].pt.x = vResult[i].pt.x / m_xScale;
+			vResult[i].pt.y = vResult[i].pt.y / m_yScale;
+		}
+	}
+	else {
+		ClsVision::FindNccModel(hSearchImage, m_idModel, m_score, 1, vResult);
+	}
+	int nCount = (int)(vResult.size());
+	if (nCount < 1) return false;
+
+	m_ptLocResult = vResult[0].pt;
+	m_ptLocResult.x += x1;
+	m_ptLocResult.y += y1;
+
+	return true;
+}
+
+int CHoleDotProcess::CreateMatchModel(void) {
+	/* code */
+	if (!ClsVision::TupleNil(m_idModel)) {
+		ClsVision::ClearNccModel(m_idModel);
+		m_idModel = HalconCpp::HTuple();
+	}
+	if (!ClsVision::ObjectExist(m_hImage)) return -1;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+	if (width < 1 || height < 1) return -1;
+
+	m_isScale = false;
+	if (width > 120 || height > 120) {
+		m_isScale = true;
+		m_xScale = 1.0f;
+		m_yScale = 1.0f;
+		if (width > 120) {
+			m_xScale = 120.0f / width;
+		}
+		if (height > 120) {
+			m_yScale = 120.0f / height;
+		}
+		HalconCpp::HObject hZoomImage;
+		HalconCpp::ZoomImageFactor(m_hImage, &hZoomImage, m_xScale, m_yScale, "constant");
+		m_idModel = ClsVision::CreateNccModel(hZoomImage, -15, 15, 0, 2000);
+	}
+	else {
+		m_xScale = 1.0f;
+		m_yScale = 1.0f;
+		m_idModel = ClsVision::CreateNccModel(m_hImage, -15, 15, 0, 2000);
+	}
+
+	return 0;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/HoleDotProcess.h b/Common_Class/BlVisionPro/Vision/HoleDotProcess.h
new file mode 100644
index 0000000..72d5899
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/HoleDotProcess.h
@@ -0,0 +1,71 @@
+#ifndef HOLE_DOT_PROCESS
+#define HOLE_DOT_PROCESS
+
+class CHoleDotProcess
+{
+public:
+	CHoleDotProcess();
+	CHoleDotProcess(DimensionDir eDir, int id);
+	~CHoleDotProcess();
+
+public:
+	//1. 获取ID
+    int GetID() { return m_id; }
+
+	//2. 获取图像
+    HalconCpp::HObject& GetImage() { return m_hImage; }
+    void SetImage(HalconCpp::HObject& image) { m_hImage = image;  CreateMatchModel(); }
+
+	//3. 设置位置
+    void SetPose(int x, int y) { m_nPoseX = x; m_nPoseY = y; }
+	void GetPose(int& x, int& y) { x = m_nPoseX; y = m_nPoseY; };
+
+	//4. 保存数据
+	Json::Value WriteToJson(std::string& strDir);
+	void DecodeJson(std::string& strDir, Json::Value& jsValue);
+
+	//7. 执行
+	int Execute(DimensionDir eDir, Point2I offset);
+
+public:
+	DimensionDir m_eDir;                 //Side
+	CString m_strName;                   //Name
+	int m_nUse;                          //Use
+
+	int m_nPoseType;                  //PoseType
+	int m_nShapeType;                 //ShapeType
+	int m_nBrightType;                //BrightType
+	int m_nSmoothSize;                //SmoothSize
+	int m_nThres;                     //Thres
+	int m_nDefectSize;              //DefectSize
+
+	Point2D m_ptLocResult;              //定位结果
+	std::vector<NgDotInfo> m_nNgInfo;
+
+private:
+	HalconCpp::HObject m_hImage;   //Hole图像
+	HalconCpp::HObject m_hImageResult;   //截取图像
+	int m_id;  //Hole编号
+	double m_score; //Hole得分
+
+	int m_nPoseX; //Hole中心点X
+	int m_nPoseY; //Hole中心点Y
+
+	HalconCpp::HTuple m_idModel;   //模板ID
+	double m_xScale; //模板X缩放
+	double m_yScale; //模板Y缩放
+	bool m_isScale;	 //是否缩放
+
+private:
+	//1. 创建模版
+    int CreateMatchModel(void);
+
+	//2. 查找目标位置
+	bool FindTargetPos(DimensionDir eDir, Point2I offset);
+
+	//3. 获取缺陷信息
+	bool FindDefectInfo(void);
+};
+
+#endif // !HOLE_DOT_PROCESS
+
diff --git a/Common_Class/BlVisionPro/Vision/HoleProcess.cpp b/Common_Class/BlVisionPro/Vision/HoleProcess.cpp
new file mode 100644
index 0000000..f03f5f4
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/HoleProcess.cpp
@@ -0,0 +1,82 @@
+#include "stdafx.h"
+#include "HoleProcess.h"
+#include "BlSideData.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CHoleProcess::CHoleProcess(){
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	for (int i = 0; i < 4; i++) {
+		m_dots[i] = new CHoleDotProcess(m_eDir, i + 1);
+	}
+}
+
+CHoleProcess::CHoleProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	for (int i = 0; i < 4; i++) {
+		m_dots[i] = new CHoleDotProcess(m_eDir, i + 1);
+	}
+}
+
+CHoleProcess::~CHoleProcess(){
+	/* code */
+	for (int i = 0; i < 4; i++) {
+		CHoleDotProcess* dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+void CHoleProcess::Execute(DimensionDir eDir) {
+	/* code */
+	Point2I offset;
+	for (int i = 0; i < 4; i++) {
+		CHoleDotProcess* dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse) continue;
+
+		offset.x = i;
+		offset.y = i;
+		dot->Execute(eDir, offset);
+	}
+}
+
+Json::Value CHoleProcess::WriteToJson(std::string& strDir) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = HOLE_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+
+	for (int i = 0; i < 4; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson(strDir);
+	}
+	return jsValue;
+}
+
+void CHoleProcess::DecodeJson(Json::Value& jsValue, std::string& strDir) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	for (int i = 0; i < 4; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(strDir, jsData);
+		}
+	}
+
+	return;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/HoleProcess.h b/Common_Class/BlVisionPro/Vision/HoleProcess.h
new file mode 100644
index 0000000..79a9a94
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/HoleProcess.h
@@ -0,0 +1,31 @@
+#ifndef HOLE_PROCESS_H
+#define HOLE_PROCESS_H
+
+#include "HoleDotProcess.h"
+
+class CHoleProcess
+{
+public:
+	CHoleProcess();
+	CHoleProcess(DimensionDir eDir);
+	~CHoleProcess();
+
+public:
+	DimensionDir m_eDir;
+	CHoleDotProcess* m_dots[4];
+
+public:
+	//1. 执行检测
+	void Execute(DimensionDir eDir);
+
+	//2. 保存文件
+	Json::Value WriteToJson(std::string &strDir);
+	void DecodeJson(Json::Value& jsValue, std::string& strDir);
+
+};
+
+
+
+
+#endif // !HOLE_PROCESS_H
+
diff --git a/Common_Class/BlVisionPro/Vision/InChipDotProcess.cpp b/Common_Class/BlVisionPro/Vision/InChipDotProcess.cpp
new file mode 100644
index 0000000..6a800a4
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/InChipDotProcess.cpp
@@ -0,0 +1,157 @@
+#include "stdafx.h"
+#include "InChipDotProcess.h"
+#include "VisionBufferPro.h"
+#include "Bspline.h"
+
+CInChipDotProcess::CInChipDotProcess(){
+	/* code */
+	m_nSampleNumber = 16;
+	m_nLineWidth = 50;
+	m_nChipOffset = -32;
+	m_nChipRange = 30;
+	m_threshold = 20;
+	m_nPointType = 1;
+	m_nPointMode = 2;
+	m_eDir = DIMENSION_NONE;
+	CVisionBufferPro::getLineFrameSize(m_eDir, m_nFrameWidth, m_nFrameHeight);
+	ClsVision::GenEmptyObject(m_hRoiRegion);
+}
+
+CInChipDotProcess::CInChipDotProcess(DimensionDir eDir) {
+	/* code */
+	m_nSampleNumber = 16;
+	m_nLineWidth = 100;
+	m_nChipOffset = -32;
+	m_nChipRange = 30;
+	m_threshold = 20;
+	m_nPointType = 1;
+	m_nPointMode = 2;
+	m_eDir = eDir;
+	CVisionBufferPro::getLineFrameSize(m_eDir, m_nFrameWidth, m_nFrameHeight);
+	ClsVision::GenEmptyObject(m_hRoiRegion);
+}
+
+CInChipDotProcess::~CInChipDotProcess()
+{
+}
+
+int CInChipDotProcess::Execute(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd) {
+	/* code */
+	if (index < 0) return 0;
+
+	return ExeInChip(eDir, index, ptStart, ptEnd);
+}
+
+int CInChipDotProcess::ExeInChip(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd) {
+	/* code */
+	if (m_nFrameWidth < 1 || m_nFrameHeight < 1) return 0;
+
+	int y1 = index * m_nFrameHeight;
+	int y2 = index * m_nFrameHeight + m_nFrameHeight - 1;
+	int x1 = ptStart.x - m_nLineWidth;
+	int x2 = ptEnd.x + m_nLineWidth;
+	if (ptStart.x > ptEnd.x) {
+		x1 = ptEnd.x - m_nLineWidth;
+		x2 = ptStart.x + m_nLineWidth;
+	}
+	x1 -= 30;
+	x2 += 30;
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hImage, x1, y1, x2, y2))  return 0;
+	int leftPos = x1;
+	int topPos = y1;
+
+	int width = 0; 
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	//HalconCpp::HWindow hDispWin(0, 0, width, height);
+	//hDispWin.SetPart(0, 0, height - 1, width - 1);
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hImage);
+
+	std::vector<Point2D> vEdgePoints;
+	int step = (int)(1.0 * (y2 - y1) / (m_nSampleNumber - 1));
+	for (int i = 0; i < m_nSampleNumber; i++) {
+		int yTarget = y1 + i * step;
+		if (0 == i) {
+			yTarget = y1 + 15;
+		}
+		else if (m_nSampleNumber - 1 == i) {
+			yTarget = y2 - 15;
+		}
+
+		Line2D line;
+		line.pt0.x = 30;
+		line.pt0.y = yTarget - topPos;
+		line.pt1.x = x2 - leftPos - 31;
+		line.pt1.y = yTarget - topPos;
+		Point2D ptStart, ptEnd;
+		if (!CVisionBufferPro::GetMeasurePos(hImage, line, m_threshold, m_nPointMode, 10, ptStart, ptEnd)) continue;
+		if (0 == i) {
+			ptStart.y = 0;
+			ptEnd.y = 0;
+		}
+		else if (m_nSampleNumber - 1 == i) {
+			ptStart.y = height - 1;
+			ptEnd.y = height - 1;
+		}
+
+		if (0 == m_nPointType) {
+			vEdgePoints.push_back(ptStart);
+		}
+		else {
+			vEdgePoints.push_back(ptEnd);
+		}
+	}
+
+	int num = (int)(vEdgePoints.size());
+	if (num < 0.5 * m_nSampleNumber) return 0;
+
+	//1. 获取点阵
+	std::vector<vec> vStartCtrlPoint;
+	for (int i = 0; i < num; i++) {
+		float x0 = (float)vEdgePoints[i].x;
+		float y0 = (float)vEdgePoints[i].y;
+		vec p0(x0, y0, 0);
+		vStartCtrlPoint.push_back(p0);
+	}
+
+	//2. 执行样条插值
+	CBspline bcurve(vStartCtrlPoint);
+	bcurve.execute();
+
+	int sz = (int)(bcurve.m_vPtResults.size());
+	if (sz < 1) return 0;
+	HalconCpp::HTuple hvY, hvX;
+	for (int i = 0; i < sz; i++) {
+		hvX[i] = bcurve.m_vPtResults[i][0] + m_nChipOffset;
+		hvY[i] = bcurve.m_vPtResults[i][1];
+	}
+	int idx = sz;
+	hvX[idx] = bcurve.m_vPtResults[sz - 1][0] + m_nChipOffset;
+	hvY[idx] = bcurve.m_vPtResults[sz - 1][1];
+	idx += 1;
+	hvX[idx] = bcurve.m_vPtResults[sz - 1][0] + m_nChipOffset + m_nChipRange;
+	hvY[idx] = bcurve.m_vPtResults[sz - 1][1];
+	idx += 1;
+	for (int i = sz - 1; i >= 0; i--) {
+		hvX[idx] = bcurve.m_vPtResults[i][0] + m_nChipOffset + m_nChipRange;
+		hvY[idx] = bcurve.m_vPtResults[i][1];
+		idx += 1;
+	}
+
+	HalconCpp::GenRegionPolygonFilled(&m_hRoiRegion, hvY, hvX);
+	//hDispWin.DispObj(m_hRoiRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HObject hProObject, hRegion, hConnectRegion;
+	HalconCpp::ReduceDomain(hImage, m_hRoiRegion, &hProObject);
+	HalconCpp::Threshold(hProObject, &hRegion, 0, 60);
+	HalconCpp::Connection(hRegion, &hConnectRegion);
+	//hDispWin.ClearWindow();
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hConnectRegion);
+	//hDispWin.Click();
+
+	return 0;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/InChipDotProcess.h b/Common_Class/BlVisionPro/Vision/InChipDotProcess.h
new file mode 100644
index 0000000..dcc1382
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/InChipDotProcess.h
@@ -0,0 +1,38 @@
+#ifndef INCHIP_DOT_PROCESS_H
+#define INCHIP_DOT_PROCESS_H
+
+class CInChipDotProcess
+{
+public:
+	CInChipDotProcess();
+	CInChipDotProcess(DimensionDir eDir);
+	~CInChipDotProcess();
+
+public:
+	//1. 执行
+	int Execute(DimensionDir eDir,  int index, Point2I ptStart, Point2I ptEnd);
+
+public:
+	int m_nChipOffset;
+	int m_nChipRange;
+	
+	int m_nLineWidth;             //ROI的宽度
+	int m_nPointType;
+	int m_nPointMode;
+	int m_threshold;   //边界
+	int m_nSampleNumber;          //采样点数量
+	
+	HalconCpp::HObject m_hRoiRegion;
+
+private:
+	DimensionDir m_eDir;
+	int m_nFrameWidth;
+	int m_nFrameHeight;
+
+private:
+	//1. 执行检测
+	int ExeInChip(DimensionDir eDir, int index, Point2I ptStart, Point2I ptEnd);
+
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/KDistProcess.cpp b/Common_Class/BlVisionPro/Vision/KDistProcess.cpp
new file mode 100644
index 0000000..dcc926e
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/KDistProcess.cpp
@@ -0,0 +1,112 @@
+#include "stdafx.h"
+#include "KDistProcess.h"
+#include "BlSideData.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+#include "SoftVisionApp.h"
+
+CKDistProcess::CKDistProcess() {
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CKeyDistDotProcess(m_eDir, i + 1);
+	}
+	m_nRoiSize = 100;
+	m_isUse = false;
+
+	m_nStage = 0;
+}
+
+CKDistProcess::CKDistProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	m_isUse = false;
+	m_nRoiSize = 100;
+	for (int i = 0; i < 50; i++) {
+		m_dots[i] = new CKeyDistDotProcess(m_eDir, i + 1);
+	}
+}
+
+CKDistProcess::~CKDistProcess() {
+	/* code */
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+void CKDistProcess::SetStage(int nStage) {
+	/* code */
+	m_nStage = nStage;
+}
+
+void CKDistProcess::Execute(DimensionDir eDir) {
+	/* code */
+	if (!m_isUse) return;
+
+	Point2I offset;
+	for (int i = 0; i < 50; i++) {
+		CKeyDistDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse)  continue;
+
+		offset.x = i;
+		offset.y = i;
+
+		dot->m_nStage = m_nStage;
+		dot->setRoiSize(m_nRoiSize);
+		dot->Execute(m_eDir, offset);
+	}
+}
+
+Json::Value CKDistProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = KDIST_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["use"] = m_isUse;
+	jsValue["roi size"] = m_nRoiSize;
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CKDistProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isBool()) {
+		m_isUse = jsValue[strName.c_str()].asBool();
+	}
+
+	//3. roi size
+	strName = "roi size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nRoiSize = jsValue[strName.c_str()].asInt();
+	}
+
+	for (int i = 0; i < 50; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/KDistProcess.h b/Common_Class/BlVisionPro/Vision/KDistProcess.h
new file mode 100644
index 0000000..23f1dcb
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/KDistProcess.h
@@ -0,0 +1,36 @@
+#ifndef KDIST_PROCESS_H
+#define KDIST_PROCESS_H
+
+#include "KeyDistDotProcess.h"
+
+class CKDistProcess
+{
+public:
+	CKDistProcess();
+	CKDistProcess(DimensionDir eDir);
+	~CKDistProcess();
+
+public:
+	DimensionDir m_eDir;
+	bool m_isUse;   //是否启用
+	int m_nRoiSize;
+	CKeyDistDotProcess *m_dots[50];
+
+private:
+	int m_nStage;  //当前的平台
+
+
+public:
+	//1. 执行检测
+	void Execute(DimensionDir eDir);
+
+	//3. 保存文件 
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+	//3. 设置平台
+	void SetStage(int nStage);
+};
+
+#endif
+
diff --git a/Common_Class/BlVisionPro/Vision/KeyDistDotProcess.cpp b/Common_Class/BlVisionPro/Vision/KeyDistDotProcess.cpp
new file mode 100644
index 0000000..1ff43cf
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/KeyDistDotProcess.cpp
@@ -0,0 +1,596 @@
+#include "stdafx.h"
+#include "KeyDistDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+#include "SoftVisionApp.h"
+
+CKeyDistDotProcess::CKeyDistDotProcess() {
+	/* code */
+	m_eDir = DIMENSION_NONE;
+	m_id = 0;
+	m_nStdDist = 0;
+
+	m_nUse = 0;
+	m_strName.Format(_T("P%d"), m_id);
+
+	m_poseType = 0;
+	m_keyPoseX = 0;
+	m_keyPoseY = 0;
+	m_nPosX = 0;
+	m_nPosY = 0;
+	m_nEndThres = 0;
+//	m_nLineWidth = 200;
+
+	m_nInc = 0;
+	m_nInc1 = 0;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_nRoiSize = 100;
+	m_distResult = 0.0f;
+	m_nStage = -1;
+}
+
+CKeyDistDotProcess::CKeyDistDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_eDir = eDir;
+	m_id = id;
+
+	m_nUse = 0;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_D%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_D%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_D%d"), m_id);
+		break;
+	}
+
+	m_poseType = 0;
+	m_keyPoseX = 0;
+	m_keyPoseY = 0;
+	m_nPosX = 0;
+	m_nPosY = 0;
+	m_nEndThres = 0;
+//	m_nLineWidth = 200;
+	m_nStdDist = 0;
+
+	m_nInc = 0;
+	m_nInc1 = -1;
+	m_nMin = 0;
+	m_nMax = 0;
+	m_nRoiSize = 100;
+	m_distResult = 0.0f;
+	m_nStage = -1;
+}
+
+CKeyDistDotProcess::~CKeyDistDotProcess() {
+	/* code */
+}
+
+int CKeyDistDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	m_ptNearResult.x = 0.0f;
+	m_ptNearResult.y = 0.0f;
+	m_ptMeasureResult.x = 0.0f;
+	m_ptMeasureResult.y = 0.0f;
+	if (1 != m_nUse) return 0;
+	if (0 == m_keyPoseY && 0 == m_keyPoseX) return 0;
+	if (0 == m_nPosX  && 0 == m_nPosY) return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 查找结果
+	if (!findEndPoint(eDir)) return  -1;
+
+	//3. 结果判断
+	judgeResult();
+
+	return 0;
+}
+
+bool CKeyDistDotProcess::getImageROI(HalconCpp::HObject &hImage, Point2I &result) {
+	/* code */
+	// 定义两个vector,分别存储标准点和实际点的坐标
+	std::vector<Point2D> vStdPoint, vRealPoint;
+	// 计算标准点与实际点之间的距离
+	double dx = m_locPointResult.x - m_ptMeasureResult.x;
+	double dy = m_locPointResult.y - m_ptMeasureResult.y;
+	double dist = sqrt(dx * dx + dy * dy);
+
+	// 创建一个pose点,用于存储标准点
+	Point2D pose;
+	pose.x = m_nRoiSize + 10;    //尺寸大小 2 * m_nRoiSize + 20   // 110;
+	pose.y = 40;
+	vStdPoint.push_back(pose);
+	// 将标准点沿着距离移动
+	pose.x = m_nRoiSize + 10 + dist;//110.0 + dist;
+	vStdPoint.push_back(pose);
+
+	// 将实际点存入vRealPoint
+	pose.x = m_locPointResult.x;
+	pose.y = m_locPointResult.y;
+	vRealPoint.push_back(pose);
+	vRealPoint.push_back(m_ptMeasureResult);
+
+	// 将vStdPoint和vRealPoint转换为仿射矩阵
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint);
+
+	//4个点
+	// 设置x和y的值为0
+	pose.x = 0.0;
+	pose.y = 0.0;
+	// 将pose坐标转换为point坐标
+	Point2D point = ClsVision::CoordinateTransform(pose, affine);
+	// 将point坐标转换为整数
+	int x1 = (int)(point.x);
+	int y1 = (int)(point.y);
+	int x2 = (int)(point.x);
+	int y2 = (int)(point.y);
+
+	// 设置x和y的值为0
+	pose.x = 0.0;
+	pose.y = 79.0;
+	// 将pose坐标转换为point坐标
+	point = ClsVision::CoordinateTransform(pose, affine);
+	// 如果x1大于point.x,则将x1设置为point.x
+	if (x1 > point.x)  x1 = (int)(point.x);
+	// 如果y1大于point.y,则将y1设置为point.y
+	if (y1 > point.y)  y1 = (int)(point.y);
+	// 如果x2小于point.x,则将x2设置为point.x
+	if (x2 < point.x)  x2 = (int)(point.x);
+	// 如果y2小于point.y,则将y2设置为point.y
+	if (y2 < point.y)  y2 = (int)(point.y);
+
+	// 设置x和y的值为219.0
+	pose.x = 2 * (m_nRoiSize + 10) - 1;  //219.0;
+	pose.y = 79.0;
+	// 将pose坐标转换为point坐标
+	point = ClsVision::CoordinateTransform(pose, affine);
+	// 如果x1大于point.x,则将x1设置为point.x
+	if (x1 > point.x)  x1 = (int)(point.x);
+	// 如果y1大于point.y,则将y1设置为point.y
+	if (y1 > point.y)  y1 = (int)(point.y);
+	// 如果x2小于point.x,则将x2设置为point.x
+	if (x2 < point.x)  x2 = (int)(point.x);
+	// 如果y2小于point.y,则将y2设置为point.y
+	if (y2 < point.y)  y2 = (int)(point.y);
+
+	// 设置x和y的值为219.0
+	pose.x = 2 * (m_nRoiSize + 10) - 1;  //219.0;
+	pose.y = 0.0;
+	// 将pose坐标转换为point坐标
+	point = ClsVision::CoordinateTransform(pose, affine);
+	// 如果x1大于point.x,则将x1设置为point.x
+	if (x1 > point.x)  x1 = (int)(point.x);
+	// 如果y1大于point.y,则将y1设置为point.y
+	if (y1 > point.y)  y1 = (int)(point.y);
+	// 如果x2小于point.x,则将x2设置为point.x
+	if (x2 < point.x)  x2 = (int)(point.x);
+	// 如果y2小于point.y,则将y2设置为point.y
+	if (y2 < point.y)  y2 = (int)(point.y);
+
+	// 计算宽度
+	int dWidth = x2 - x1 + 1;
+	// 如果宽度小于220,则将x1和x2设置为110的偏移量
+	if (dWidth <= 2 * (m_nRoiSize + 10)) {
+		x1 = m_locPointResult.x - (m_nRoiSize + 10);
+		x2 = m_locPointResult.x + (m_nRoiSize + 10);
+	}
+	// 否则,计算x1和x2的偏移量,并将它们设置为x1和x2的中间值
+	else {
+		int dd = (int)((dWidth + 2) / 2);
+		x1 = m_locPointResult.x - dd;
+		x2 = m_locPointResult.x + dd;
+	}
+	// 计算高度
+	int dHeight = y2 - y1 + 1;
+	// 如果高度小于80,则将y1和y2设置为40的偏移量
+	if (dHeight <= 80) {
+		y1 = m_locPointResult.y - 40;
+		y2 = m_locPointResult.y + 40;
+	}
+	// 否则,计算y1和y2的偏移量,并将它们设置为y1和y2的中间值
+	else {
+		int dd = (int)((dHeight + 2) / 2);
+		y1 = m_locPointResult.y - dd;
+		y2 = m_locPointResult.y + dd;
+	}
+
+	HalconCpp::HObject hTmpObject;
+	// 如果获取ROI失败,则返回false
+	if (!CVisionBufferPro::getImageROI(m_eDir, hTmpObject, x1, y1, x2, y2)) return false;
+	// 将结果的x和y设置为x1和y1
+	result.x = x1;
+	result.y = y1;
+
+	// 获取图像大小
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hTmpObject, width, height);
+	if (width < 1 || height < 1) return false;
+
+	// 清除之前记录的点
+	vStdPoint.clear();
+	// 将点转换为标准坐标系
+	pose.x = 0.5 * (width - 1);
+	pose.y = 0.5 * (height - 1);
+	vStdPoint.push_back(pose);
+	// 将点转换为实际坐标系
+	pose.x += (m_ptMeasureResult.x - m_locPointResult.x);
+	pose.y += (m_ptMeasureResult.y - m_locPointResult.y);
+	vStdPoint.push_back(pose);
+
+	// 将点转换为实际坐标系
+	vRealPoint.clear();
+	pose.x = m_nRoiSize + 10;   //110;
+	pose.y = 40;
+	vRealPoint.push_back(pose);
+	pose.x = m_nRoiSize + 10 + dist;// 110.0 + dist;
+	vRealPoint.push_back(pose);
+
+	// 将标准点和实际点转换为相似度
+	affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint);
+	// 对图像进行仿射变换
+	ClsVision::AffineTransImage(hTmpObject, affine, hImage);
+
+	return true;
+}
+
+bool CKeyDistDotProcess::findEndPoint(DimensionDir eDir) {
+	/* code */
+	//获取指定方向的侧边数据
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	//如果侧边数据为空,则返回false
+	if (nullptr == pSideData)  return false;
+
+	if (0 == m_poseType) {
+		//如果侧边数据中没有找到上点,则返回false
+		if (!pSideData->m_bBotMark_Find)  return false;
+		//如果侧边数据中没有找到下点,则返回false
+		if (!pSideData->m_bTopMark_Find)  return false;
+	}
+	else {
+		//如果侧边数据中没有找到上点,则返回false
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		//如果侧边数据中没有找到下点,则返回false
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	//1. 首先计算Key的位置
+	Point2I ptOffset;
+	ptOffset.x = m_keyPoseX;
+	ptOffset.y = m_keyPoseY;
+	Point2I result;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result))  return false;
+
+	m_ptMeasureResult.x = result.x;
+	m_ptMeasureResult.y = result.y;
+
+	ptOffset.x = m_nPosX;
+	ptOffset.y = m_nPosY;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, ptOffset, m_poseType, result))  return false;
+	m_locPointResult = result;
+
+	HalconCpp::HObject hImage;
+	Point2I leftTop;
+	if (!getImageROI(hImage, leftTop)) return false;
+
+	// 定义HObject类型的变量
+	HalconCpp::HObject hMeanObject, hRoiRegion, hTmpObj, hProcObject;
+	// 使用MeanImage函数计算图像的平均值,并将结果存储在hMeanObject中
+	HalconCpp::MeanImage(hImage, &hMeanObject, 1, 15);
+	// 定义一个矩形区域,左上角坐标为(10, 10),右下角坐标为(69, 219)
+	HalconCpp::GenRectangle1(&hRoiRegion, 10, 10, 69, 2 * (m_nRoiSize + 10)- 1 /* 219 */ );
+	// 使用ReduceDomain函数将hMeanObject的值减去hRoiRegion的值,并将结果存储在hTmpObj中
+	HalconCpp::ReduceDomain(hMeanObject, hRoiRegion, &hTmpObj);
+	// 使用CropDomain函数裁剪hTmpObj,并将结果存储在hProcObject中
+	HalconCpp::CropDomain(hTmpObj, &hProcObject);
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hProcObject, width, height);
+	if (width < 1 || height < 1) return false;
+
+	Line2D line;
+	line.pt0.x = 5;
+	line.pt0.y = 0.5 * height - 1;
+	line.pt1.x = width - 6;
+	line.pt1.y = 0.5 * height - 1;
+	int nThreshold = 10;
+	if (m_nEndThres > 3) nThreshold = m_nEndThres;
+	Point2D ptStart, ptEnd;
+	if (!CVisionBufferPro::GetMeasureNearPos(hProcObject, line, nThreshold, 0, 10, ptStart, ptEnd)) return false;
+
+	Point2D posLeftPoint;
+	posLeftPoint.x = ptStart.x + 10;
+	posLeftPoint.y = 0.5 * (height - 1) + 10;
+	
+
+	std::vector<Point2D> vStdPoint, vRealPoint;
+	// 计算标准点与实际点之间的距离
+	double dx = m_locPointResult.x - m_ptMeasureResult.x;
+	double dy = m_locPointResult.y - m_ptMeasureResult.y;
+	double dist = sqrt(dx * dx + dy * dy);
+
+	// 创建一个pose点,用于存储标准点
+	Point2D pose;
+	pose.x = 10 + m_nRoiSize; // 110;
+	pose.y = 40;
+	vStdPoint.push_back(pose);
+	// 将标准点沿着距离移动
+	pose.x = 10 + m_nRoiSize + dist; // 110.0 + dist;
+	vStdPoint.push_back(pose);
+
+	// 将实际点存入vRealPoint
+	pose.x = m_locPointResult.x;
+	pose.y = m_locPointResult.y;
+	vRealPoint.push_back(pose);
+	vRealPoint.push_back(m_ptMeasureResult);
+
+	// 将vStdPoint和vRealPoint转换为仿射矩阵
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vStdPoint, vRealPoint);
+	m_ptNearResult = ClsVision::CoordinateTransform(posLeftPoint, affine);
+
+	if (m_nEndThres > 3) {
+		Point2D posEndPoint;
+        posEndPoint.x = ptEnd.x + 10;
+        posEndPoint.y = 0.5 * (height - 1) + 10;
+		m_ptMeasureResult = ClsVision::CoordinateTransform(posEndPoint, affine);
+	}
+
+	//
+	return true;
+}
+
+int CKeyDistDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+void CKeyDistDotProcess::setRoiSize(int sz) {
+	/* code */
+    m_nRoiSize = sz;
+}
+
+void CKeyDistDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+void CKeyDistDotProcess::judgeResult(void) {
+	/* code */
+	m_nNgInfo.clear();
+	if (fabs(m_ptMeasureResult.x) < 0.1 && fabs(m_ptMeasureResult.y) < 0.1f) return;
+
+	//创建缺陷dot信息
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = true;
+	ng.minValue = m_nMin;
+	ng.maxValue = m_nMax;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_OK;   //缺陷类型
+	ng.eVision = VISION_KDIST; 
+
+	//计算缺陷位置
+	ng.xPosPxl = m_locPointResult.x;
+	ng.yPosPxl = m_locPointResult.y;
+	ng.xResult = 0.0f;
+	ng.yResult = 0.0f;
+	ng.x1 = m_locPointResult.x - 40;
+	ng.y1 = m_locPointResult.y - 20;
+	ng.x2 = m_locPointResult.x + 40;
+	ng.y2 = m_locPointResult.y + 20;
+
+	//计算缺陷类型
+	ng.ngType = DefectLoc_Corner_Dist;
+	double dx = m_xMmvsp *(m_ptMeasureResult.x - m_ptNearResult.x);
+	double dy = m_yMmvsp *(m_ptMeasureResult.y - m_ptNearResult.y);
+	m_distResult = sqrt(dx * dx + dy * dy);
+
+	//输出显示数据
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {  //区域的显示结果
+		DispVisionResult inf;
+		inf.nType = 3;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_KDIST);
+		inf.rectX1 = (int)(m_ptMeasureResult.x);
+		inf.rectY1 = (int)(m_ptMeasureResult.y);
+		inf.rectX2 = (int)(m_ptNearResult.x);
+		inf.rectY2 = (int)(m_ptNearResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 0;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_KDIST);
+		inf.pointX = (int)(m_ptNearResult.x);
+		inf.pointY = (int)(m_ptNearResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 4;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_KDIST);
+		inf.pointX = (int)(m_ptNearResult.x);
+		inf.pointY = (int)(m_ptNearResult.y);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	//计算缺陷距离
+	if (1 == m_nStage) {
+		m_distResult += m_nInc1;
+	}
+	else {
+		m_distResult += m_nInc;
+	}
+	ng.result = m_distResult;
+
+	//判断缺陷是否符合标准
+	if (m_nMax < 0.5) {
+		m_nNgInfo.push_back(ng);
+		return;
+	}
+
+	double dDist = m_distResult - m_nStdDist;
+	if (dDist < m_nMin || dDist > m_nMax) {
+		ng.isRes = false;
+	}
+	m_nNgInfo.push_back(ng);
+}
+
+Json::Value CKeyDistDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+
+	Json::Value jsValue;
+	jsValue["alg type"] = KDIST_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["use"] = m_nUse;
+	jsValue["pos type"] = m_poseType;
+	jsValue["key pos x"] = m_keyPoseX;
+	jsValue["key pos y"] = m_keyPoseY;
+	jsValue["pos x"] = m_nPosX;
+	jsValue["pos y"] = m_nPosY;
+	jsValue["inc"] = m_nInc;
+	jsValue["inc1"] = m_nInc1;
+	jsValue["min"] = m_nMin;
+	jsValue["max"] = m_nMax;
+	jsValue["end thres"] = m_nEndThres;
+	jsValue["std dist"] = m_nStdDist;
+
+	return jsValue;
+}
+
+void CKeyDistDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. pos type
+	strName = "pos type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_poseType = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. key pos x
+	strName = "key pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_keyPoseX = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. key pos y
+	strName = "key pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_keyPoseY = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosX = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPosY = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. inc
+	strName = "inc";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nInc = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. inc
+	strName = "inc1";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nInc1 = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. min
+	strName = "min";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMin = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. max
+	strName = "max";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nMax = jsValue[strName.c_str()].asInt();
+	}
+
+	//14. end thres
+	strName = "end thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEndThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//15. std dist
+	strName = "std dist";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nStdDist = jsValue[strName.c_str()].asInt();
+	}
+}
diff --git a/Common_Class/BlVisionPro/Vision/KeyDistDotProcess.h b/Common_Class/BlVisionPro/Vision/KeyDistDotProcess.h
new file mode 100644
index 0000000..276f6be
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/KeyDistDotProcess.h
@@ -0,0 +1,70 @@
+#ifndef KEY_DIST_DOT_PROCESS_H
+#define KEY_DIST_DOT_PROCESS_H
+
+class CKeyDistDotProcess
+{
+public:
+	CKeyDistDotProcess();
+	CKeyDistDotProcess(DimensionDir eDir, int id);
+	~CKeyDistDotProcess();
+
+public:
+	//1. 执行
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//2. 获取ID
+	int getID(void);
+	void setRoiSize(int sz);
+
+	//3. 保存数据
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	int m_nUse;
+	CString m_strName;
+	
+	int m_poseType;
+	int m_keyPoseX;
+	int m_keyPoseY;
+	int m_nPosX;
+	int m_nPosY;
+	int m_nEndThres;
+	int m_nStdDist;
+	int m_nInc;
+	int m_nMin;
+	int m_nMax;
+	int m_nInc1;
+
+	Point2D m_ptMeasureResult;
+	Point2D m_ptNearResult;
+	Point2I m_locPointResult;
+	double m_distResult;
+
+	std::vector<NgDotInfo> m_nNgInfo;
+	int m_nStage;
+
+private:
+	DimensionDir m_eDir;
+	int m_id;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+	int m_nRoiSize;
+
+private:
+	//1. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+
+	//2. 查找结果
+	bool findEndPoint(DimensionDir eDir);
+
+	//3. 判断结果
+	void judgeResult(void);
+
+	//4. 截图ROI图
+	bool getImageROI(HalconCpp::HObject &hImage, Point2I &result);
+};
+
+#endif
+
diff --git a/Common_Class/BlVisionPro/Vision/LocProcess.cpp b/Common_Class/BlVisionPro/Vision/LocProcess.cpp
new file mode 100644
index 0000000..843e029
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/LocProcess.cpp
@@ -0,0 +1,366 @@
+#include "stdafx.h"
+#include "LocProcess.h"
+#include "VisionRecipe.h"
+#include "BlSideData.h"
+#include "FileRecipe.h"
+
+CLocProcess::CLocProcess(){
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		m_dot[i] = NULL;
+	}
+
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+	m_botPoint.x = 0;
+    m_botPoint.y = 0;
+	m_topPoint.x = 0;
+    m_topPoint.y = 0;
+}
+
+CLocProcess::CLocProcess(DimensionDir eDir) {
+	/* code */
+	m_eDir = eDir;
+	for (int i = 0; i < 2; i++) {
+		CNccDotProcess *dot = new CNccDotProcess(m_eDir, i);
+		m_dot[i] = dot;
+	}
+
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+	m_botPoint.x = 0;
+	m_botPoint.y = 0;
+	m_topPoint.x = 0;
+	m_topPoint.y = 0;
+}
+
+CLocProcess::~CLocProcess(){
+	/* code */
+	Release();
+}
+
+void CLocProcess::Release(void) {
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		CNccDotProcess *dot = m_dot[i];
+		if (NULL == dot) continue;
+		delete dot;
+		dot = NULL;
+		m_dot[i] = NULL;
+	}
+}
+
+void CLocProcess::Init(void) {
+	/* code */
+	for (int i = 0; i < 2; i++) {
+		CNccDotProcess *dot = new CNccDotProcess(m_eDir, i);
+		m_dot[i] = dot;
+	}
+
+	m_topMark.x = 0;
+	m_topMark.y = 0;
+	m_botMark.x = 0;
+	m_botMark.y = 0;
+}
+
+CNccDotProcess* CLocProcess::getDot(int index) {
+	/* code */
+	if (index < 0 || index > 1) return NULL;
+
+	CNccDotProcess *dot = m_dot[index];
+	return dot;
+}
+
+void CLocProcess::setPose(Point2I pose, int nType) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	double dMmvspX = pSideData->m_dPixelSizeX;   //X方向的像素大小
+	double dMmvspY = pSideData->m_dPixelSizeY;   //Y方向的像素大小
+
+	Point2I point;
+	point.x = (int)(pose.x * dMmvspX);
+    point.y = (int)(pose.y * dMmvspY);
+	if (0 == nType) {
+		m_topMark = point;
+        pSideData->m_mTopBzMark = point;
+	}
+	else if (1 == nType){
+		m_botMark = point;
+		pSideData->m_mBotBzMark = point;
+	}
+	else if (2 == nType) {
+		m_topPoint = point;
+		pSideData->m_mTopBzPoint = point;
+	}
+	else if (3 == nType) {
+        m_botPoint = point;
+        pSideData->m_mBotBzPoint = point;
+	}
+}
+
+Point2I CLocProcess::getPose(int nType) {
+	/* code */
+	if (0 == nType) {
+		return m_topMark;
+	}
+	else if (1 == nType) {
+		return m_botMark;
+	}
+	else if (2 == nType) {
+        return m_topPoint;
+	}
+	else if (3 == nType) {
+        return m_botPoint;
+	}
+
+	return m_topMark;
+}
+
+int CLocProcess::execute(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return 0;
+
+	pSideData->m_bTopPoint_Find = FALSE;
+	pSideData->m_bBotPoint_Find = FALSE;
+//	Point2I offset, pose;
+	Point2I offset;
+	for (int i = 0; i < 2; i++) {
+		CNccDotProcess *dot = m_dot[i];
+		if (NULL == dot) continue;
+
+		SetPos(dot);
+//		pose = dot->getPose();
+//		offset = getOffset(pose);
+		offset.x = 0;
+        offset.y = 0;
+
+		dot->execute(eDir, offset);
+
+		SetResult(dot);
+	}
+	return 0;
+}
+
+void CLocProcess::SetPos(CNccDotProcess* dot) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return;
+    if (NULL == dot) return;
+
+	Point2I pose = GetPos(dot);
+	if (0 == pose.x && 0 == pose.y) return;
+
+	double dx = pose.x - m_topMark.x;
+	double dy = pose.y - m_topMark.y;
+	double dist0 = sqrt(dx * dx + dy * dy);
+	dx = pose.x - m_botMark.x;
+    dy = pose.y - m_botMark.y;
+    double dist1 = sqrt(dx * dx + dy * dy);
+
+	double dMmvspX = pSideData->m_dPixelSizeX;   //X方向的像素大小
+	double dMmvspY = pSideData->m_dPixelSizeY;   //Y方向的像素大小
+
+	if (dist0 < dist1) {
+		if (!pSideData->m_bTopMark_Find)  return;
+
+		Point2I topMark = pSideData->m_mTopMark;
+
+		Point2D offset;
+		offset.x = dMmvspX * topMark.x - m_topMark.x;
+		offset.y = dMmvspY * topMark.y - m_topMark.y;
+
+		Point2I locPose;
+		locPose.x = (int)((pose.x + offset.x) / dMmvspX);
+        locPose.y = (int)((pose.y + offset.y) / dMmvspY);
+		dot->setPose(locPose);
+	}
+	else {
+		if (!pSideData->m_bBotMark_Find) return;
+		Point2I botMark = pSideData->m_mBotMark;
+
+        Point2D offset;
+		offset.x = dMmvspX * botMark.x - m_botMark.x;
+        offset.y = dMmvspY * botMark.y - m_botMark.y;
+
+		Point2I locPose;
+		locPose.x = (int)((pose.x + offset.x) / dMmvspX);
+		locPose.y = (int)((pose.y + offset.y) / dMmvspY);
+		dot->setPose(locPose);
+	}
+}
+
+Point2I CLocProcess::GetPos(CNccDotProcess* dot) {
+	/* code */
+	Point2I pose;
+	pose.x = 0;
+    pose.y = 0;
+	if (0 == dot->getID()) {
+		pose = m_topPoint;
+	}
+	else {
+		pose = m_botPoint;
+	}
+
+	return pose;
+}
+
+void CLocProcess::SetResult(CNccDotProcess *dot) {
+	/* code */
+	if (NULL == m_dot) return;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return;
+
+	int id = dot->getID();
+	if (0 == id) {
+		if (fabs(dot->m_ptResult.x) < 0.01 && fabs(dot->m_ptResult.y) < 0.01) return;
+
+		pSideData->m_bTopPoint_Find = TRUE;
+		pSideData->m_mTopPoint.x = (int)(dot->m_ptResult.x);
+		pSideData->m_mTopPoint.y = (int)(dot->m_ptResult.y);
+	}
+	else if (1 == id) {
+		if (fabs(dot->m_ptResult.x) < 0.01 && fabs(dot->m_ptResult.y) < 0.01) return;
+
+		pSideData->m_bBotPoint_Find = TRUE;
+		pSideData->m_mBotPoint.x = (int)(dot->m_ptResult.x);
+		pSideData->m_mBotPoint.y = (int)(dot->m_ptResult.y);
+	}
+}
+
+Point2I CLocProcess::getOffset(Point2I pose) {
+	/* code */
+	Point2I result;
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData) return result;
+	if (0 == pose.x && 0 == pose.y) return result;
+
+	double dx = pose.x - m_topMark.x;
+	double dy = pose.y - m_topMark.y;
+	double dist0 = sqrt(dx * dx + dy * dy);
+	dx = pose.x - m_botMark.x;
+	dy = pose.y - m_botMark.y;
+	double dist1 = sqrt(dx * dx + dy * dy);
+
+	if (dist0 < dist1) {
+		if (pSideData->m_bTopMark_Find) {
+			result.x = pSideData->m_mTopMark.x - m_topMark.x;
+			result.y = pSideData->m_mTopMark.y - m_topMark.y;
+		}
+		else if (pSideData->m_bBotMark_Find) {
+			result.x = pSideData->m_mBotMark.x - m_botMark.x;
+			result.y = pSideData->m_mBotMark.y - m_botMark.y;
+		}
+	}
+	else {
+		if (pSideData->m_bBotMark_Find) {
+			result.x = pSideData->m_mBotMark.x - m_botMark.x;
+			result.y = pSideData->m_mBotMark.y - m_botMark.y;
+		}
+		else if(pSideData->m_bTopMark_Find) {
+			result.x = pSideData->m_mTopMark.x - m_topMark.x;
+			result.y = pSideData->m_mTopMark.y - m_topMark.y;
+		}
+	}
+
+	return result;
+}
+
+Json::Value CLocProcess::WriteToJson(std::string &strDir) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["type"] = LOC_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["TopMark X"] = m_topMark.x;
+	jsValue["TopMark Y"] = m_topMark.y;
+	jsValue["BotMark X"] = m_botMark.x;
+	jsValue["BotMark Y"] = m_botMark.y;
+	jsValue["TopPoint X"] = m_topPoint.x;
+    jsValue["TopPoint Y"] = m_topPoint.y;
+    jsValue["BotPoint X"] = m_botPoint.x;
+	jsValue["BotPoint Y"] = m_botPoint.y;
+
+
+	for (int i = 0; i < 2; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dot[i]->WriteToJson(strDir);
+	}
+	return jsValue;
+}
+
+int CLocProcess::DecodeJson(std::string &strDir, Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return -1;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return -1;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. TopMark X,//3. TopMark Y
+	strName = "TopMark X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_topMark.x = jsValue[strName.c_str()].asInt();
+		pSideData->m_mTopBzMark.x = m_topMark.x;
+	}
+	strName = "TopMark Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_topMark.y = jsValue[strName.c_str()].asInt();
+		pSideData->m_mTopBzMark.y = m_topMark.y;
+	}
+	strName = "BotMark X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_botMark.x = jsValue[strName.c_str()].asInt();
+		pSideData->m_mBotBzMark.x = m_botMark.x;
+	}
+	strName = "BotMark Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_botMark.y = jsValue[strName.c_str()].asInt();
+		pSideData->m_mBotBzMark.y = m_botMark.y;
+	}
+
+	strName = "TopPoint X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_topPoint.x = jsValue[strName.c_str()].asInt();
+		pSideData->m_mTopBzPoint.x = m_topPoint.x;
+	}
+	strName = "TopPoint Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_topPoint.y = jsValue[strName.c_str()].asInt();
+        pSideData->m_mTopBzPoint.y = m_topPoint.y;
+	}
+	strName = "BotPoint X";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_botPoint.x = jsValue[strName.c_str()].asInt();
+        pSideData->m_mBotBzPoint.x = m_botPoint.x;
+	}
+	strName = "BotPoint Y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_botPoint.y = jsValue[strName.c_str()].asInt();
+        pSideData->m_mBotBzPoint.y = m_botPoint.y;
+	}
+
+	for (int i = 0; i < 2; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dot[i]->DecodeJson(strDir, jsData);
+		}
+	}
+
+	return 0;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/LocProcess.h b/Common_Class/BlVisionPro/Vision/LocProcess.h
new file mode 100644
index 0000000..205eff9
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/LocProcess.h
@@ -0,0 +1,61 @@
+#ifndef LOC_PROCESS_H
+#define LOC_PROCESS_H
+
+#include "NccDotProcess.h"
+
+class CLocProcess
+{
+public:
+	CLocProcess();
+	CLocProcess(DimensionDir eDir);
+	~CLocProcess();
+
+public:
+	//1. 初始化
+	void Init(void);
+
+	//2. 获取数据
+	CNccDotProcess* getDot(int index);
+
+	//3. 设置数据 
+	void setPose(Point2I pose, int nType);
+	Point2I getPose(int nType);
+
+	//4. 执行
+	int execute(DimensionDir eDir);
+
+	//5. 写入文件
+	Json::Value WriteToJson(std::string &strDir);
+	int DecodeJson(std::string &strDir, Json::Value &jsValue);
+
+public:
+	DimensionDir m_eDir;
+
+private:
+	Point2I m_topMark;   //Top Mark
+	Point2I m_botMark;   //Bot Mark
+	Point2I m_topPoint;  //Top Point
+	Point2I m_botPoint;  //Bot Point
+
+private:
+	CNccDotProcess *m_dot[2];
+
+private:
+	//1. 释放
+	void Release(void);
+
+	//2. 获取偏移
+	Point2I getOffset(Point2I pose);
+
+	//3. 设置结果
+	void SetResult(CNccDotProcess *dot);
+
+	//4. 获取位置
+	Point2I GetPos(CNccDotProcess *dot);
+
+	//5. 设置位置
+	void SetPos(CNccDotProcess* dot);
+
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/NccDotProcess.cpp b/Common_Class/BlVisionPro/Vision/NccDotProcess.cpp
new file mode 100644
index 0000000..bb26583
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/NccDotProcess.cpp
@@ -0,0 +1,343 @@
+#include "stdafx.h"
+#include "NccDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+
+CNccDotProcess::CNccDotProcess(){
+	/* code */
+	m_id = 0;
+	m_pos.x = 0;
+	m_pos.y = 0;
+	m_strName = _T("P0");
+	HalconCpp::GenEmptyObj(&m_hImage);
+	m_idModel = -1;
+	m_eDir = DIMENSION_NONE;
+	m_score = 0.5f;
+
+	m_ptResult.x = 0.0f;
+	m_ptResult.y = 0.0f;
+
+	m_xScale = 1.0f;
+	m_yScale = 1.0f;
+	m_isScale = false;
+
+	m_idModel = HalconCpp::HTuple();
+}
+
+CNccDotProcess::~CNccDotProcess(){
+	/* code */
+	if (!ClsVision::TupleNil(m_idModel)) {
+		ClsVision::ClearNccModel(m_idModel);
+		m_idModel = HalconCpp::HTuple();
+	}
+}
+
+CNccDotProcess::CNccDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_id = id;
+	m_eDir = eDir;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P%d"), m_id);
+		break;
+	}
+
+	m_pos.x = 0;
+	m_pos.y = 0;
+	HalconCpp::GenEmptyObj(&m_hImage);
+	m_idModel = HalconCpp::HTuple();
+	m_score = 0.5f;
+	m_ptResult.x = 0.0f;
+	m_ptResult.y = 0.0f;
+	m_xScale = 1.0f;
+	m_yScale = 1.0f;
+	m_isScale = false;
+}
+
+int CNccDotProcess::execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_ptResult.x = 0.0f;
+	m_ptResult.y = 0.0f;
+	if (ClsVision::TupleNil(m_idModel)) {
+		CreateMatchModel();
+	}
+	if (ClsVision::TupleNil(m_idModel)) return -1;
+
+	findTargetPoint(eDir, offset);
+
+	return 0;
+}
+
+void CNccDotProcess::findTargetPoint(DimensionDir eDir, Point2I offset) {
+	/* code */
+	if (ClsVision::TupleNil(m_idModel)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+	int x1 = (int)(m_pos.x - 0.5 * width - 200);
+	int y1 = (int)(m_pos.y - 0.5 * height - 200);
+	int x2 = (int)(m_pos.x + 0.5 * width + 200);
+	int y2 = (int)(m_pos.y + 0.5 * height + 200);
+	x1 += offset.x;
+	y1 += offset.y;
+	x2 += offset.x;
+	y2 += offset.y;
+
+	HalconCpp::HObject hSearchImage;
+	if (!CVisionBufferPro::getImageROI(m_eDir, hSearchImage, x1, y1, x2, y2)) return;
+
+	std::vector<ParaMatch> vResult;
+	if (m_isScale) {
+		HalconCpp::HObject hZoomImage;
+		HalconCpp::ZoomImageFactor(hSearchImage, &hZoomImage, m_xScale, m_yScale, "constant");
+		ClsVision::FindNccModel(hZoomImage, m_idModel, m_score, 1, vResult);
+		int sz = (int)(vResult.size());
+		for (int i = 0; i < sz; i++) {
+			vResult[i].pt.x = vResult[i].pt.x / m_xScale;
+			vResult[i].pt.y = vResult[i].pt.y / m_yScale;
+		}
+	}
+	else {
+		ClsVision::FindNccModel(hSearchImage, m_idModel, m_score, 1, vResult);
+	}
+	int nCount = (int)(vResult.size());
+	if (nCount < 1) return;
+
+	m_ptResult = vResult[0].pt;
+
+	m_ptResult.x += x1;
+	m_ptResult.y += y1;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {  //区域的显示结果
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_LOC);
+		inf.rectX1 = (int)(m_ptResult.x - 0.5 * width - 1);
+		inf.rectY1 = (int)(m_ptResult.y - 0.5 * height - 1);
+		inf.rectX2 = (int)(m_ptResult.x + 0.5 * width + 1);
+		inf.rectY2 = (int)(m_ptResult.y + 0.5 * height + 1);
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+
+	//if (nullptr != pSideData) {   //输出点的显示结果
+	//	DispVisionResult inf;
+	//	inf.nType = 0;
+	//	inf.eDir = (int)(m_eDir);
+	//	inf.eVision = (int)(VISION_LOC);
+	//	inf.pointX = (int)(m_ptResult.x);
+	//	inf.pointY = (int)(m_ptResult.y);
+	//	pSideData->m_vDispVisionResult.push_back(inf);
+	//}
+
+	KeyDebugInfo inf = CVisionRecipe::getInstance()->getKeyInfo();
+	if (inf.isDebugTool && inf.isLocKey) {
+		Log_GetDebug()->TraceInfo("Trace Ncc Result %d: %d, (%.0f,%.0f), %d",
+			(int)m_eDir, m_id, m_ptResult.x, m_ptResult.y, __LINE__);
+	}
+}
+
+void CNccDotProcess::CreateMatchModel(void) {
+	/* code */
+	if (!ClsVision::TupleNil(m_idModel)) {
+		ClsVision::ClearNccModel(m_idModel);
+		m_idModel = HalconCpp::HTuple();
+	}
+	if (!ClsVision::ObjectExist(m_hImage)) return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(m_hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	m_isScale = false;
+	if (width > 120 || height > 120) {
+		m_isScale = true;
+		m_xScale = 1.0f;
+		m_yScale = 1.0f;
+		if (width > 120) {
+			m_xScale = 120.0f / width;
+		}
+		if (height > 120) {
+			m_yScale = 120.0f / height;
+		}
+		HalconCpp::HObject hZoomImage;
+		HalconCpp::ZoomImageFactor(m_hImage, &hZoomImage, m_xScale, m_yScale, "constant");
+		m_idModel = ClsVision::CreateNccModel(hZoomImage, -15, 15, 0, 2000);
+	}
+	else {
+		m_xScale = 1.0f;
+		m_yScale = 1.0f;
+		m_idModel = ClsVision::CreateNccModel(m_hImage, -15, 15, 0, 2000);
+	}
+}
+
+void CNccDotProcess::setPose(Point2I pose) {
+	/* code */
+	m_pos = pose;
+}
+
+Point2I CNccDotProcess::getPose(void) {
+	/* code */
+	return m_pos;
+}
+
+void CNccDotProcess::setImage(HalconCpp::HObject &hImage) {
+	/* code */
+	m_hImage = hImage;
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) {
+		m_pos.x = 0;
+		m_pos.y = 0;
+		if (!ClsVision::TupleNil(m_idModel)) {
+			ClsVision::ClearNccModel(m_idModel);
+			m_idModel = HalconCpp::HTuple();
+		}
+	}
+	else {
+		CreateMatchModel();
+	}
+}
+
+HalconCpp::HObject& CNccDotProcess::getImage(void) {
+	/* code */
+	return m_hImage;
+}
+
+int CNccDotProcess::getID(void) {
+	/* code */
+	return m_id;
+}
+
+Json::Value CNccDotProcess::WriteToJson(std::string &strDir) {
+	/* code */
+	int iValue = 0;
+	if (ClsVision::ObjectExist(m_hImage)) {
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(m_hImage, width, height);
+		if (width > 0 && height > 0) {
+			iValue = 1;
+		}
+	}
+	std::string strImage = "NULL";
+	if (1 == iValue) {
+		strImage = ClsVision::FormatString("%d_%d_loc", m_eDir, m_id);
+	}
+
+	std::string strName = CFileRecipe::toString(m_strName);
+	Json::Value jsValue;
+	jsValue["alg type"] = LOC_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["score"] = m_score;
+	jsValue["pos x"] = m_pos.x;
+	jsValue["pos y"] = m_pos.y;
+	jsValue["image file"] = strImage;
+
+	std::string imageDir = strDir + "Image\\";
+	if (!CFileRecipe::fileIsExist(imageDir)) {
+		CFileRecipe::makeDir(imageDir);
+	}
+	if (0 == iValue) return jsValue;
+
+	std::string fileName = imageDir + strImage + ".jpg";
+	HalconCpp::WriteImage(m_hImage, "jpeg", 0, fileName.c_str());
+	return jsValue;
+}
+
+void CNccDotProcess::DecodeJson(std::string &strDir, Json::Value &jsValue) {
+	/* code */
+	if (strDir.empty()) return;
+
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id =jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. score
+	strName = "score";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+		m_score = jsValue[strName.c_str()].asDouble();
+	}
+
+	//5. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_pos.x = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_pos.y = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. image file
+	strName = "image file";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		std::string imgFile = jsValue[strName.c_str()].asString();
+		if (0 != imgFile.compare("NULL")) {
+			std::string fileName = strDir + "Image\\" + imgFile + ".jpg";
+			if (CFileRecipe::fileIsExist(fileName)) {
+				HalconCpp::ReadImage(&m_hImage, fileName.c_str());
+				CreateMatchModel();
+			}
+		}
+		else {
+			HalconCpp::GenEmptyObj(&m_hImage);
+			CreateMatchModel();
+		}
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/NccDotProcess.h b/Common_Class/BlVisionPro/Vision/NccDotProcess.h
new file mode 100644
index 0000000..628ce24
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/NccDotProcess.h
@@ -0,0 +1,58 @@
+#ifndef NCC_DOT_PROCESS_H
+#define NCC_DOT_PROCESS_H
+
+class CNccDotProcess
+{
+public:
+	CNccDotProcess();
+	CNccDotProcess(DimensionDir eDir, int id);
+	~CNccDotProcess();
+
+public:
+	//1. 执行
+	int execute(DimensionDir eDir, Point2I offset);
+
+	//2. 设置位置
+	void setPose(Point2I pose);
+	Point2I getPose(void);
+
+	//3. 设置图像
+	void setImage(HalconCpp::HObject &hImage);
+	HalconCpp::HObject& getImage(void);
+
+	//4. 获取ID
+	int getID(void);
+
+	//5. 保存数据
+	Json::Value WriteToJson(std::string &strDir);
+	void DecodeJson(std::string &strDir, Json::Value &jsValue);
+
+
+public:
+	DimensionDir m_eDir;
+	double m_score;
+	CString m_strName;
+
+	Point2D m_ptResult;
+	
+
+private:
+	Point2I m_pos;
+	HalconCpp::HTuple m_idModel;
+	int m_id;
+	HalconCpp::HObject m_hImage;
+
+	double m_xScale;   //x轴缩放比例
+	double m_yScale;   //y轴缩放比例
+	bool m_isScale;   //是否缩放
+
+private:
+	//1. 创建模板
+	void CreateMatchModel(void);
+
+	//2. 查找位置
+	void findTargetPoint(DimensionDir eDir, Point2I offset);
+
+
+};
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/RcutDotProcess.cpp b/Common_Class/BlVisionPro/Vision/RcutDotProcess.cpp
new file mode 100644
index 0000000..3a9ea19
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/RcutDotProcess.cpp
@@ -0,0 +1,2118 @@
+#include "stdafx.h"
+#include "RcutDotProcess.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+#include "Bspline.h"
+#include "SoftVisionApp.h"
+
+#define RCUT_DEBUG_CODE  0
+
+CRcutDotProcess::CRcutDotProcess(){
+	/* code */
+	m_id = 0;
+	m_strName.Format(_T("Point%d"), m_id);
+	m_nPoseX = 0;
+	m_nPoseY = 0;
+	m_width = 0;
+	m_height = 0;
+
+	m_nUse = 0;
+	m_nChamferSize = 25;
+	m_nChipRange = 30;
+	m_nChipThres = 50;
+
+	m_nStartAngle = 8;
+	m_nEndAngle = 82;
+	m_nDx = 50;
+	m_nDy = 50;
+
+	m_nBinThres = 20;
+	m_nEdgeSmooth = 1;
+
+	m_x1 = -1;
+	m_y1 = -1;
+	m_xMmvsp = 0.0f;
+	m_yMmvsp = 0.0f;
+
+	m_nBrokenUse = 0;
+	m_fSigmaThres = 5.0f;
+	m_nTech = 0;
+	m_nDistThres = 3;
+	m_nBrokenSmooth = 5;
+	m_nBrokenArea = 60;
+	m_fOpenPara = 3.5;
+	for (int i = 0; i < 16; i++) {
+		m_ptArrayResult[i].x = 0.0f;
+		m_ptArrayResult[i].y = 0.0f;
+		m_ptArrayStd[i].x = 0.0f;
+		m_ptArrayStd[i].y = 0.0f;
+	}
+	m_fAvgChamber = 0.0f;
+	m_nStartDa = 0;
+	m_nEndDa = 0;
+
+	HalconCpp::GenEmptyObj(&m_hImage);
+	HalconCpp::GenEmptyObj(&m_hRoiRegion);
+	HalconCpp::GenEmptyObj(&m_hChipRegion);
+	HalconCpp::GenEmptyObj(&m_hBrkRoiRegion);
+}
+
+CRcutDotProcess::CRcutDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_eDir = eDir;
+	m_id = id;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_R%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_R%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_R%d"), m_id);
+		break;
+	}
+	m_nPoseX = 0;
+	m_nPoseY = 0;
+	m_width = 0;
+	m_height = 0;
+
+	m_nUse = 0;
+	m_nChamferSize = 25;
+	m_nChipRange = 30;
+	m_nChipThres = 50;
+
+	m_nStartAngle = 8;
+	m_nEndAngle = 82;
+	m_nDx = 50;
+	m_nDy = 50;
+
+	m_nBinThres = 20;
+	m_nEdgeSmooth = 1;
+
+	m_x1 = -1;
+	m_y1 = -1;
+	m_xMmvsp = 0.0f;
+	m_yMmvsp = 0.0f;
+
+	m_nBrokenUse = 0;
+	m_fSigmaThres = 5.0f;
+	m_nTech = 0;
+	m_nDistThres = 3;
+	m_nBrokenSmooth = 5;
+	m_nBrokenArea = 60;
+	m_fOpenPara = 3.5;
+	for (int i = 0; i < 16; i++) {
+		m_ptArrayResult[i].x = 0.0f;
+		m_ptArrayResult[i].y = 0.0f;
+		m_ptArrayStd[i].x = 0.0f;
+        m_ptArrayStd[i].y = 0.0f;
+	}
+
+	HalconCpp::GenEmptyObj(&m_hImage);
+	HalconCpp::GenEmptyObj(&m_hRoiRegion);
+	HalconCpp::GenEmptyObj(&m_hChipRegion);
+
+	m_fAvgChamber = 0.0f;
+	m_nStartDa = 0;
+	m_nEndDa = 0;
+
+	HalconCpp::GenEmptyObj(&m_hBrkRoiRegion);
+}
+
+CRcutDotProcess::~CRcutDotProcess(){
+	/* code */
+}
+
+void CRcutDotProcess::getRegion(int &xPos, int &yPos, int &width, int &height){
+	/* code */
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	//进行坐标转换
+	Point2I offset;
+	offset.x = m_nPoseX;
+	offset.y = m_nPoseY;
+	Point2I result;
+
+	int nType = 1;
+	if (1 != m_id) {
+		nType = 2;
+	}
+	if (!CVisionBufferPro::TransformToReal(m_eDir, offset, nType, result)) return;
+
+	int dWidth = (int)(m_width / pSideData->m_dPixelSizeX + 0.5f);
+	int dHeight = (int)(m_height / pSideData->m_dPixelSizeY + 0.5f);
+
+	if (1 == m_id) {   //Top RCut)
+		xPos = result.x - dWidth + 1;
+		yPos = result.y - dHeight + 1;
+		width = dWidth;
+		height = dHeight;
+	}
+	else {
+		xPos = result.x - dWidth + 1;
+		yPos = result.y;
+		width = dWidth;
+		height = dHeight;
+	}
+}
+
+void CRcutDotProcess::setRegion(int xPos, int yPos, int width, int height) {
+	/* code */
+	//获取侧光数据
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	//设置图像的区域
+	int x1 = xPos;
+	int y1 = yPos;
+	int x2 = xPos + width - 1;
+	int y2 = yPos + height - 1;
+//	Log_GetDebug()->TraceInfo("Trace Set ROI: %d, %d, %d, %d, %d, %d, %d", (int)m_eDir, m_id, x1, y1, x2, y2, __LINE__);
+
+	//记录右下左边
+	Point2I point;
+	if (1 == m_id) {   //Top RCut
+		point.x = x2;
+		point.y = y2;
+	}
+	else {            //Bot RCut
+		point.x = x2;
+		point.y = y1;
+	}
+	Point2I pose, ptTop, ptBot;
+	if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir, point, pose, ptTop, ptBot)) return;
+
+	//设置pose和宽高
+	if (1 == m_id) {   //Top RCut
+		m_nPoseX = ptTop.x;
+		m_nPoseY = ptTop.y;
+	}
+	else {
+		m_nPoseX = ptBot.x;
+		m_nPoseY = ptBot.y;
+	}
+	m_width = (int)(pSideData->m_dPixelSizeX * width);
+	m_height = (int)(pSideData->m_dPixelSizeY * height);	
+
+#if 0
+	int x = 0;
+	int y = 0;
+	int w = 0;
+	int h = 0;
+	getRegion(x, y, w, h);
+
+	Log_GetDebug()->TraceInfo("Trace Input Info: %d, %d, %d, %d, %d", xPos, yPos, width, height, __LINE__);
+	Log_GetDebug()->TraceInfo("Trace Input Info: %d, %d, %d, %d, %d", x, y, w, h, __LINE__);
+#endif
+}
+
+int CRcutDotProcess::getID(void) {
+	/* code*/
+	return m_id;
+}
+
+void CRcutDotProcess::setID(int id) {
+	/* code */
+	m_id = id;
+}
+
+int CRcutDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_fMaxChamber = 0.0f;
+	m_nNgInfo.clear();
+	HalconCpp::GenEmptyObj(&m_hResultRegion);
+	HalconCpp::GenEmptyObj(&m_hBrkRoiRegion);
+	for (int i = 0; i < 16; i++) {
+		m_ptArrayResult[i].x = 0;
+        m_ptArrayResult[i].y = 0;
+	}
+	if (1 != m_nUse)  return 0;
+	if (m_width < 1 || m_height < 1) return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 获取图像
+	if (!getProcImage(eDir, offset, m_hImage)) return 0;
+
+	//3. Chip检测
+	InspectChip(m_hImage);
+
+	//5. 获取结果
+	getResult();
+
+	//5. 打印数据
+	int nRet = (int)(m_nNgInfo.size());
+	//KeyDebugInfo inf = CVisionRecipe::getInstance()->getKeyInfo();
+	//if (inf.isDebugTool && inf.isCutLineKey) {
+	//	for (int i = 0; i < nRet; i++) {
+	//		Log_GetDebug()->TraceInfo("Trace CutLine Result %d: %d, %d, (%.1f, %.1f), %d",
+	//			(int)m_eDir, m_id, i, m_nNgInfo[i].xResult, m_nNgInfo[i].yResult, __LINE__);
+	//	}
+	//}
+	
+	return nRet;
+}
+
+void CRcutDotProcess::getResult(void) {
+	/* code */
+	int nCount = ClsVision::ObjectNumber(m_hResultRegion);
+	if (nCount < 1) return;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = false;
+	ng.minValue = m_nDx;
+	ng.maxValue = m_nDy;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_Chip;   //缺陷类型
+	ng.eVision = VISION_RCUT;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	HalconCpp::HTuple hvArea, hvY, hvX;
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::AreaCenter(m_hResultRegion, &hvArea, &hvY, &hvX);
+	HalconCpp::SmallestRectangle1(m_hResultRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	for (int i = 0; i < nCount; i++) {
+		ng.result = hvArea[i].I();
+		ng.xResult = (int)(m_xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1));
+		ng.yResult = (int)(m_yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1));
+		ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + m_x1;
+		ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + m_y1;
+		ng.x1 = hvX1[i].I() + m_x1 - 1;
+		ng.y1 = hvY1[i].I() + m_y1 - 1;
+		ng.x2 = hvX2[i].I() + m_x1 + 1;
+		ng.y2 = hvY2[i].I() + m_y1 + 1;
+
+		if (nullptr != pSideData) {  //区域的显示结果
+			DispVisionResult inf;
+			inf.nType = 1;
+			inf.eDir = (int)(m_eDir);
+			inf.eVision = (int)(VISION_RCUT);
+			inf.rectX1 = ng.x1;
+			inf.rectY1 = ng.y1;
+			inf.rectX2 = ng.x2;
+			inf.rectY2 = ng.y2;
+			inf.showROI = 0;
+			pSideData->m_vDispVisionResult.push_back(inf);
+		}
+
+		m_nNgInfo.push_back(ng);
+	}
+}
+
+void CRcutDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+bool CRcutDotProcess::getProcImage(DimensionDir eDir, Point2I offset, HalconCpp::HObject &hImage) {
+	/* code */
+	m_eDir = eDir;
+	if (m_width < 1 && m_height < 1) return false;
+	if (0 == m_nPoseX && 0 == m_nPoseY)  return false;
+
+	int left = 0;
+	int top = 0;
+	int width = 0;
+	int height = 0;
+	getRegion(left, top, width, height);
+
+	int x1 = left;
+	int y1 = top;
+	int x2 = left + width - 1;
+	int y2 = top + height - 1;
+	
+	m_x1 = x1;
+	m_y1 = y1;
+	bool bRes = CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2);
+
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr != pSideData) {
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_RCUT);
+		inf.rectX1 = x1;
+		inf.rectY1 = y1;
+		inf.rectX2 = x2;
+		inf.rectY2 = y2;
+		inf.showROI = 1;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 4;
+		inf.eDir = (int)(m_eDir);
+		inf.strName = m_strName;
+		inf.eVision = (int)(VISION_RCUT);
+		inf.pointX = x1;
+		inf.pointY = y1;
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+//	Log_GetDebug()->TraceInfo("Trace ROI: %d, %d, %d, %d, %d, %d", (int)m_eDir, m_id, x1, y1, x2, y2);
+
+	return bRes;
+}
+
+void CRcutDotProcess::TechImage(void) {
+	/* code */
+	ClsVision::GenEmptyObject(m_hChipRegion);
+	ClsVision::GenEmptyObject(m_hRoiRegion);
+
+	Point2I offset;
+	offset.x = 0;
+	offset.y = 0;
+
+	Execute(m_eDir, offset); 
+}
+
+void CRcutDotProcess::InspectChip(HalconCpp::HObject &hImage) {
+	/* code */
+	if (1 == m_id) {
+		InspectTopChip(hImage);
+		return;
+	}
+
+	InspectBotChip(hImage);
+}
+
+bool CRcutDotProcess::getRcutEdgePoints(HalconCpp::HObject &hImage, std::vector<Point2D> &vStartPoints, std::vector<Point2D> &vEndPoints, std::vector<Point2D> &vResPoints, double &maxDist, double &minDist) {
+	/* code */
+	int width = 0;
+	int height = 0;
+	minDist = 0.0f;
+	maxDist = 0.0f;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return false;
+
+	//提取空旷的区域
+//	int nRet = CheckBroken(hImage, m_hBrkRoiRegion);
+	double xTargetCenter = 1;
+	double yTargetCenter = 1;
+
+#if  RCUT_DEBUG_CODE    
+	HalconCpp::HWindow hDispWin(0, 0, width, height);
+	hDispWin.SetPart(0, 0, height - 1, width - 1);
+	hDispWin.SetColored(6);
+	hDispWin.DispObj(hImage);
+	hDispWin.Click();
+#endif
+
+	std::vector<Point2D> vStartResults;
+	std::vector<Point2D> vEndResuts;
+	std::vector<bool> vFindRes;
+	maxDist = 0;
+	minDist = MAXINT;
+	if (1 == m_id) {
+		double radius = sqrt(1.0 * width * width + 1.0 * height * height);
+		double centerX = width - 1;
+		double centerY = height - 1;
+		xTargetCenter = centerX;
+        yTargetCenter = centerY;
+		double angle0 = m_nStartAngle;
+		double angle1 = m_nEndAngle;
+		double step = 1.0 * (m_nEndAngle - m_nStartAngle) / 15;
+		std::vector<Line2D> vLines;
+
+		for (int i = 0; i < 16; i++) {
+			double angle = angle0 + i * step - 90;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 5, -100, 5, 100, &hvRow, &hvColumn, &hvIsOverlapping);
+			HalconCpp::TupleLength(hvRow, &hvLength);
+			if (hvLength[0].I() < 1) continue;
+			double x1 = hvColumn[0].D();
+			double y1 = hvRow[0].D();
+			if (x1 < 0) {
+				HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping);
+				HalconCpp::TupleLength(hvRow, &hvLength);
+				if (hvLength[0].I() < 1) continue;
+				x1 = hvColumn[0].D();
+				y1 = hvRow[0].D();
+			}
+			Line2D line;
+			line.pt0.x = x1;
+			line.pt0.y = y1;
+			line.pt1.x = centerX;
+			line.pt1.y = centerY;
+			Point2D ptStart, ptEnd;
+			bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, -1.0f, ptStart, ptEnd);
+			vLines.push_back(line);
+			vStartResults.push_back(ptStart);
+			vEndResuts.push_back(ptEnd);
+			vFindRes.push_back(isFind);
+
+			//if (1 == m_nBrokenUse && 1 == nRet) {    //如果检测到有破损,则使用破损的坐标
+			//	HalconCpp::HObject hLineRg, hIntersectRg;
+   //             HalconCpp::GenRegionLine(&hLineRg, y1, x1, centerY, centerX);
+			//	HalconCpp::Intersection(hLineRg, m_hBrkRoiRegion, &hIntersectRg);
+			//	HalconCpp::HTuple hvY, hvX, hvLength;
+			//	HalconCpp::GetRegionPoints(hIntersectRg, &hvY, &hvX);
+   //             HalconCpp::TupleLength(hvY, &hvLength);
+			//	int N0 = hvLength[0].I();
+			//	int loopNumber = 0;
+			//	if (N0 > 0) {
+			//		loopNumber = hvLength[0].I();
+			//	}
+			//	double minDist = MAXINT;
+			//	for (int j = 0; j < loopNumber; j++) {
+			//		double dx = hvX[j].I() - centerX;
+			//		double dy = hvY[j].I() - centerY;
+			//		double dist = sqrt(dx * dx + dy * dy);
+			//		if (dist < minDist) {
+			//			minDist = dist;
+			//			m_ptArrayResult[i].x = hvX[j].I();
+			//			m_ptArrayResult[i].y = hvY[j].I();
+			//		}
+			//	}
+			//}
+			
+			//HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2;
+			//HalconCpp::GenRegionLine(&hDispRegion, y1, x1, centerY, centerX);
+			//if (!isFind) {
+			//	hDispWin.SetColor("blue");
+			//	hDispWin.DispObj(hDispRegion);
+			//	hDispWin.Click();
+			//}
+			if (!isFind) 	continue;
+
+			//HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0);
+			//HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0);
+			//hDispWin.SetColor("blue");
+			//hDispWin.DispObj(hDispRegion);
+			//hDispWin.SetColor("green");
+			//hDispWin.DispObj(hDispObj1);
+			//hDispWin.DispObj(hDispObj2);
+			//hDispWin.Click();
+		}
+
+		double avg = 0.0f;
+		double nCount = 0;
+		for (int i = 0; i < 16; i++) {
+			if (!vFindRes[i])   continue;
+
+			double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]);
+			avg += dist;
+			nCount += 1;
+		}
+		if (nCount < 3) {
+			avg = 0.8 * m_nChamferSize;
+		}
+		else {
+			avg = avg / nCount;
+		}
+		
+		for (int i = 0; i < 16; i++) {
+			if (vFindRes[i])   continue;
+
+			Line2D line = vLines[i];
+			Point2D ptStart, ptEnd;
+//			Log_GetDebug()->TraceInfo("Line %d: %.2f, %.2f, %.2f, %.2f", i, line.pt0.x, line.pt0.y, line.pt1.x, line.pt1.y);
+			bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, avg, ptStart, ptEnd);
+
+			//HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2;
+			//HalconCpp::GenRegionLine(&hDispRegion, line.pt0.y, line.pt0.x, line.pt1.y, line.pt1.x);
+			//if (!isFind) {
+			//	hDispWin.SetColor("blue");
+			//	hDispWin.DispObj(hDispRegion);
+			//	hDispWin.Click();
+			//}
+			if (!isFind) continue;
+
+			vFindRes[i] = isFind;
+			vStartResults[i] = ptStart;
+			vEndResuts[i] = ptEnd;
+
+			//HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0);
+			//HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0);
+			//hDispWin.SetColor("blue");
+			//hDispWin.DispObj(hDispRegion);
+			//hDispWin.SetColor("green");
+			//hDispWin.DispObj(hDispObj1);
+			//hDispWin.DispObj(hDispObj2);
+			//hDispWin.Click();
+		}
+
+		for (int i = 0; i < 16; i++) {
+			if (!vFindRes[i])   continue;
+
+			double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]);
+			if (dist > maxDist)  maxDist = dist;
+			if (dist < minDist)  minDist = dist;
+			vStartPoints.push_back(vStartResults[i]);
+			vEndPoints.push_back(vEndResuts[i]);
+			Point2D midPoint;
+			midPoint.x = 0.5 * (vStartResults[i].x + vEndResuts[i].x);
+			midPoint.y = 0.5 * (vStartResults[i].y + vEndResuts[i].y);
+			vResPoints.push_back(midPoint);
+		}
+
+	}
+	else {
+		double radius = sqrt(1.0 * width * width + 1.0 * height * height);
+		double centerX = width - 1;
+		double centerY = 0;
+		xTargetCenter = centerX;
+		yTargetCenter = centerY;
+		double angle0 = m_nStartAngle;
+		double angle1 = m_nEndAngle;
+		double step = 1.0 * (m_nEndAngle - m_nStartAngle) / 15;
+
+		std::vector<Line2D> vLines;
+		//std::vector<Point2D> vStartResults;
+		//std::vector<Point2D> vEndResuts;
+		//std::vector<bool> vFindRes;
+
+		for (int i = 0; i < 16; i++) {
+			double angle = angle0 + i * step;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, height - 6, -100, height - 6, 100, &hvRow, &hvColumn, &hvIsOverlapping);
+			HalconCpp::TupleLength(hvRow, &hvLength);
+			if (hvLength[0].I() < 1) continue;
+			double x1 = hvColumn[0].D();
+			double y1 = hvRow[0].D();
+			if (x1 < 0) {
+				HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping);
+				HalconCpp::TupleLength(hvRow, &hvLength);
+				if (hvLength[0].I() < 1) continue;
+				x1 = hvColumn[0].D();
+				y1 = hvRow[0].D();
+			}
+			Line2D line;
+			line.pt0.x = x1;
+			line.pt0.y = y1;
+			line.pt1.x = centerX;
+			line.pt1.y = centerY;
+			Point2D ptStart, ptEnd;
+			bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, -1.0f, ptStart, ptEnd);
+			vLines.push_back(line);
+			vStartResults.push_back(ptStart);
+			vEndResuts.push_back(ptEnd);
+			vFindRes.push_back(isFind);
+
+			//if (1 == m_nBrokenUse && 1 == nRet) {    //如果检测到有破损,则使用破损的坐标
+			//	HalconCpp::HObject hLineRg, hIntersectRg;
+			//	HalconCpp::GenRegionLine(&hLineRg, y1, x1, centerY, centerX);
+			//	HalconCpp::Intersection(hLineRg, m_hBrkRoiRegion, &hIntersectRg);
+			//	HalconCpp::HTuple hvY, hvX, hvLength;
+			//	HalconCpp::GetRegionPoints(hIntersectRg, &hvY, &hvX);
+			//	HalconCpp::TupleLength(hvY, &hvLength);
+			//	int N0 = hvLength[0].I();
+			//	int loopNumber = 0;
+			//	if (N0 > 0) {
+			//		loopNumber = hvLength[0].I();
+			//	}
+			//	double minDist = MAXINT;
+			//	for (int j = 0; j < loopNumber; j++) {
+			//		double dx = hvX[j].I() - centerX;
+			//		double dy = hvY[j].I() - centerY;
+			//		double dist = sqrt(dx * dx + dy * dy);
+			//		if (dist < minDist) {
+   //                     minDist = dist;
+			//			m_ptArrayResult[i].x = hvX[j].I();
+			//			m_ptArrayResult[i].y = hvY[j].I();
+			//		}
+			//	}
+			//}
+
+			//HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2;
+			//HalconCpp::GenRegionLine(&hDispRegion, y1, x1, centerY, centerX);
+			//if (!isFind) {
+			//	hDispWin.SetColor("blue");
+			//	hDispWin.DispObj(hDispRegion);
+			//	hDispWin.Click();
+			//}
+			if (!isFind) 	continue;
+
+			//HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0);
+			//HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0);
+			//hDispWin.SetColor("blue");
+			//hDispWin.DispObj(hDispRegion);
+			//hDispWin.SetColor("green");
+			//hDispWin.DispObj(hDispObj1);
+			//hDispWin.DispObj(hDispObj2);
+			//hDispWin.Click();
+		}
+
+		double avg = 0.0f;
+		double nCount = 0;
+		for (int i = 0; i < 16; i++) {
+			if (!vFindRes[i])   continue;
+
+			double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]);
+			avg += dist;
+			nCount += 1;
+		}
+		if (nCount < 3) {
+			avg = 0.8 * m_nChamferSize;
+		}
+		else {
+			avg = avg / nCount;
+		}
+
+		for (int i = 0; i < 16; i++) {
+			if (vFindRes[i])   continue;
+
+			Line2D line = vLines[i];
+			Point2D ptStart, ptEnd;
+			bool isFind = CVisionBufferPro::GetMeasureRCutPos(hImage, line, m_nBinThres, 0, m_nChamferSize, avg, ptStart, ptEnd);
+
+			//HalconCpp::HObject hDispRegion, hDispObj1, hDispObj2;
+			//HalconCpp::GenRegionLine(&hDispRegion, line.pt0.y, line.pt0.x, line.pt1.y, line.pt1.x);
+			//if (!isFind) {
+			//	hDispWin.SetColor("blue");
+			//	hDispWin.DispObj(hDispRegion);
+			//	hDispWin.Click();
+			//}
+			if (!isFind) continue;
+
+			vFindRes[i] = isFind;
+			vStartResults[i] = ptStart;
+			vEndResuts[i] = ptEnd;
+
+			//HalconCpp::GenCrossContourXld(&hDispObj1, ptStart.y, ptStart.x, 15, 0);
+			//HalconCpp::GenCrossContourXld(&hDispObj2, ptEnd.y, ptEnd.x, 15, 0);
+			//hDispWin.SetColor("blue");
+			//hDispWin.DispObj(hDispRegion);
+			//hDispWin.SetColor("green");
+			//hDispWin.DispObj(hDispObj1);
+			//hDispWin.DispObj(hDispObj2);
+			//hDispWin.Click();
+		}
+
+		for (int i = 0; i < 16; i++) {
+			if (!vFindRes[i])   continue;
+
+			double dist = ClsVision::DistancePP(vStartResults[i], vEndResuts[i]);
+			if (dist > maxDist)  maxDist = dist;
+			if (dist < minDist)  minDist = dist;
+			vStartPoints.push_back(vStartResults[i]);
+			vEndPoints.push_back(vEndResuts[i]);
+			Point2D midPoint;
+			midPoint.x = 0.5 * (vStartResults[i].x + vEndResuts[i].x);
+			midPoint.y = 0.5 * (vStartResults[i].y + vEndResuts[i].y);
+			vResPoints.push_back(midPoint);
+		}
+	}
+
+#if  RCUT_DEBUG_CODE  
+	HalconCpp::HTuple hvYY, hvXX;
+	for (int i = 0; i < 16; i++) {
+		hvXX[i] = m_ptArrayResult[i].x;
+        hvYY[i] = m_ptArrayResult[i].y;
+	}
+	HalconCpp::HObject hDispRg;
+	HalconCpp::GenCrossContourXld(&hDispRg, hvYY, hvXX, 21, 0.0);
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hDispRg);
+	hDispWin.Click();
+#endif
+
+	AnalysisBroken(hImage);
+
+//	if (1 == m_nBrokenUse && 1 == nRet) {
+//		double aryDx[16], aryDy[16];
+//		for (int i = 0; i < 16; i++) {
+//			aryDx[i] = m_ptArrayResult[i].x - m_ptArrayStd[i].x;
+//			aryDy[i] = m_ptArrayResult[i].y - m_ptArrayStd[i].y;
+//		}
+//		//进行排序
+//		for (int i = 0; i < 15; i++) {
+//			for (int j = i + 1; j < 16; j++) {
+//				if (aryDx[i] > aryDx[j]) {
+//					double temp = aryDx[i];
+//					aryDx[i] = aryDx[j];
+//					aryDx[j] = temp;
+//				}
+//				if (aryDy[i] > aryDy[j]) {
+//					double temp = aryDy[i];
+//					aryDy[i] = aryDy[j];
+//					aryDy[j] = temp;
+//				}
+//			}
+//		}
+//		//计算均值
+//		double avgDx = 0.0f;
+//		double avgDy = 0.0f;
+//		for (int i = 3; i <= 12; i++) {
+//			avgDx += aryDx[i];
+//			avgDy += aryDy[i];
+//		}
+//		avgDx = avgDx / 10;
+//		avgDy = avgDy / 10;
+//		Log_GetDebug()->TraceInfo("Avg Info: (%.1f, %.1f), %d", avgDx, avgDy, __LINE__);
+//
+//		Point2D aryPt[16];
+//		if (0 == m_nTech) {
+//			for (int i = 0; i < 16; i++) {
+//				if (fabs(avgDx) < 15 && fabs(avgDy) < 15) {
+//					double dx = m_ptArrayResult[i].x - (m_ptArrayStd[i].x + avgDx);
+//					double dy = m_ptArrayResult[i].y - (m_ptArrayStd[i].y + avgDy);
+//					if (fabs(dx) < m_nDistThres && fabs(dy) < m_nDistThres) {
+//						aryPt[i] = m_ptArrayResult[i];
+//					}
+//					else {
+//						aryPt[i] = m_ptArrayStd[i];
+//						aryPt[i].x += avgDx;
+//						aryPt[i].y += avgDy;
+//					}
+//				}
+//				else {
+//
+//					aryPt[i] = m_ptArrayStd[i];
+//					aryPt[i].x += avgDx;
+//					aryPt[i].y += avgDy;
+//				}
+//			}
+//		}
+//		else {
+//			for (int i = 0; i < 16; i++) {
+//				aryPt[i] = m_ptArrayResult[i];
+//			}
+//		}
+//
+//		//1. 获取点阵
+//		std::vector<vec> vecPoints;
+//		for (int i = 0; i < 16; i++) {
+//			float x0 = (float)aryPt[i].x;
+//			float y0 = (float)aryPt[i].y;
+//			vec p0(x0, y0, 0);
+//			vecPoints.push_back(p0);
+//		}
+//
+//		//2. 执行样条插值
+//		CBspline bcurve(vecPoints);
+//		bcurve.execute();
+//
+//		//3. 获取样条差值轮廓点
+//		int sz = (int)(bcurve.m_vPtResults.size());
+//		if (sz < 1) return false;
+//		HalconCpp::HTuple hvY, hvX;
+//		for (int i = 0; i < sz; i++) {
+//			hvX[i] = bcurve.m_vPtResults[i][0];
+//			hvY[i] = bcurve.m_vPtResults[i][1];
+//		}
+//		int idx = sz;
+//		hvX[idx] = xTargetCenter;
+//		hvY[idx] = yTargetCenter;
+//		//4. 生产区域
+//		HalconCpp::HObject hRegion0, hBrokenRg;
+//		HalconCpp::GenRegionPolygonFilled(&hRegion0, hvY, hvX);
+//		HalconCpp::ErosionCircle(hRegion0, &hBrokenRg, m_nBrokenSmooth);
+//
+//#if  RCUT_DEBUG_CODE  
+//		for (int i = 0; i < 16; i++) {
+//			Log_GetDebug()->TraceInfo("Offset %d: (%.1f, %.1f),(%.1f, %.1f),(%.1f, %.1f),(%.1f, %.1f), %d",
+//				i, m_ptArrayResult[i].x, m_ptArrayResult[i].y,
+//				m_ptArrayStd[i].x, m_ptArrayStd[i].y,
+//				m_ptArrayResult[i].x - aryPt[i].x, m_ptArrayResult[i].y - aryPt[i].y,
+//				m_ptArrayResult[i].x - m_ptArrayStd[i].x, m_ptArrayResult[i].y - m_ptArrayStd[i].y,
+//				__LINE__);
+//		}
+//
+//		hDispWin.DispObj(hImage);
+//		hDispWin.SetColor("red");
+//		hDispWin.DispObj(m_hBrkRoiRegion);
+//		hDispWin.Click();
+//
+//		hDispWin.DispObj(hImage);
+//		hDispWin.SetColor("green");
+//		hDispWin.DispObj(hBrokenRg);
+//		hDispWin.Click();
+//#endif
+//
+//		HalconCpp::HObject hIntersectRg, hConnectRg, hSelectRg;
+//		HalconCpp::Intersection(hBrokenRg, m_hBrkRoiRegion, &hIntersectRg);
+//		HalconCpp::Connection(hIntersectRg, &hConnectRg);
+//
+//#if  RCUT_DEBUG_CODE
+//		hDispWin.DispObj(hImage);
+//		hDispWin.SetColored(6);
+//		hDispWin.DispObj(hConnectRg);
+//		hDispWin.Click();
+//#endif
+//
+//
+//		HalconCpp::SelectShape(hConnectRg, &hSelectRg, "area", "and", m_nBrokenArea, MAXINT);
+//		int ngNum = ClsVision::ObjectNumber(hSelectRg);
+//		if (ngNum > 0) {
+//			NgDotInfo ng;
+//			ng.eDir = m_eDir;
+//			ng.id = m_id;
+//			ng.isRes = false;
+//			ng.minValue = m_nDx;
+//			ng.maxValue = m_nDy;
+//			ng.strName = m_strName;
+//			ng.ngType = DefectLoc_Chip;   //缺陷类型
+//			ng.eVision = VISION_RCUT;
+//
+//			CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+//			HalconCpp::HTuple hvArea, hvYY, hvXX;
+//			HalconCpp::HTuple hvYY1, hvXX1, hvYY2, hvXX2;
+//			HalconCpp::AreaCenter(hSelectRg, &hvArea, &hvYY, &hvXX);
+//			HalconCpp::SmallestRectangle1(hSelectRg, &hvYY1, &hvXX1, &hvYY2, &hvXX2);
+//			for (int i = 0; i < ngNum; i++) {
+//				ng.result = hvArea[i].I();
+//				ng.xResult = (int)(m_xMmvsp * (hvXX2[i].I() - hvXX1[i].I() + 1));
+//				ng.yResult = (int)(m_yMmvsp * (hvYY2[i].I() - hvYY1[i].I() + 1));
+//				ng.xPosPxl = (int)(0.5 * (hvXX2[i].I() + hvXX1[i].I())) + m_x1;
+//				ng.yPosPxl = (int)(0.5 * (hvYY1[i].I() + hvYY2[i].I())) + m_y1;
+//				ng.x1 = hvXX1[i].I() + m_x1 - 1;
+//				ng.y1 = hvYY1[i].I() + m_y1 - 1;
+//				ng.x2 = hvXX2[i].I() + m_x1 + 1;
+//				ng.y2 = hvYY2[i].I() + m_y1 + 1;
+//
+//				if (nullptr != pSideData) {  //区域的显示结果
+//					DispVisionResult inf;
+//					inf.nType = 1;
+//					inf.eDir = (int)(m_eDir);
+//					inf.eVision = (int)(VISION_RCUT);
+//					inf.rectX1 = ng.x1;
+//					inf.rectY1 = ng.y1;
+//					inf.rectX2 = ng.x2;
+//					inf.rectY2 = ng.y2;
+//					inf.showROI = 0;
+//					pSideData->m_vDispVisionResult.push_back(inf);
+//				}
+//
+//				m_nNgInfo.push_back(ng);
+//			}
+//		}
+//#if  RCUT_DEBUG_CODE  
+//		hDispWin.DispObj(hImage);
+//		hDispWin.DispObj(hSelectRg);
+//		hDispWin.Click();
+//#endif
+//	}
+
+	int num = (int)(vStartPoints.size());
+	if (num < 3) return false;
+
+	return true;
+}
+
+void CRcutDotProcess::AnalysisBroken(HalconCpp::HObject& hImage) {
+	/* code */
+	if (1 != m_nBrokenUse)  return;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return;
+
+	//提取空旷的区域
+	int nRet = CheckBroken(hImage, m_hBrkRoiRegion);
+	if (1 != nRet) return;
+
+	double xTargetCenter = 1;
+	double yTargetCenter = 1;
+
+#if  RCUT_DEBUG_CODE   
+//#if 1
+	HalconCpp::HWindow hDispWin(0, 0, width, height);
+	hDispWin.SetPart(0, 0, height - 1, width - 1);
+	hDispWin.SetColored(6);
+	hDispWin.DispObj(hImage);
+	hDispWin.Click();
+#endif
+
+	if (1 == m_id) {
+		double radius = sqrt(1.0 * width * width + 1.0 * height * height);
+		double centerX = width - 1;
+		double centerY = height - 1;
+		xTargetCenter = centerX;
+		yTargetCenter = centerY;
+		double angle0 = m_nStartDa;
+		double angle1 = m_nEndDa;
+		double step = 1.0 * (m_nEndDa - m_nStartDa) / 15;
+
+		for (int i = 0; i < 16; i++) {
+			double angle = angle0 + i * step - 90;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 5, -100, 5, 100, &hvRow, &hvColumn, &hvIsOverlapping);
+			HalconCpp::TupleLength(hvRow, &hvLength);
+			if (hvLength[0].I() < 1) continue;
+			double x1 = hvColumn[0].D();
+			double y1 = hvRow[0].D();
+			if (x1 < 0) {
+				HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping);
+				HalconCpp::TupleLength(hvRow, &hvLength);
+				if (hvLength[0].I() < 1) continue;
+				x1 = hvColumn[0].D();
+				y1 = hvRow[0].D();
+			}
+
+			if (1 == m_nBrokenUse && 1 == nRet) {    //如果检测到有破损,则使用破损的坐标
+				HalconCpp::HObject hLineRg, hIntersectRg;
+				HalconCpp::GenRegionLine(&hLineRg, y1, x1, centerY, centerX);
+				HalconCpp::Intersection(hLineRg, m_hBrkRoiRegion, &hIntersectRg);
+				HalconCpp::HTuple hvY, hvX, hvLength;
+				HalconCpp::GetRegionPoints(hIntersectRg, &hvY, &hvX);
+				HalconCpp::TupleLength(hvY, &hvLength);
+				int N0 = hvLength[0].I();
+				int loopNumber = 0;
+				if (N0 > 0) {
+					loopNumber = hvLength[0].I();
+				}
+				double minDist = MAXINT;
+				for (int j = 0; j < loopNumber; j++) {
+					double dx = hvX[j].I() - centerX;
+					double dy = hvY[j].I() - centerY;
+					double dist = sqrt(dx * dx + dy * dy);
+					if (dist < minDist) {
+						minDist = dist;
+						m_ptArrayResult[i].x = hvX[j].I();
+						m_ptArrayResult[i].y = hvY[j].I();
+					}
+				}
+			}
+		}
+	}
+	else {
+		double radius = sqrt(1.0 * width * width + 1.0 * height * height);
+		double centerX = width - 1;
+		double centerY = 0;
+		xTargetCenter = centerX;
+		yTargetCenter = centerY;
+		double angle0 = m_nStartDa;
+		double angle1 = m_nEndDa;
+		double step = 1.0 * (m_nEndDa - m_nStartDa) / 15;
+
+		for (int i = 0; i < 16; i++) {
+			double angle = angle0 + i * step;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvRow, hvColumn, hvIsOverlapping, hvLength;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, height - 6, -100, height - 6, 100, &hvRow, &hvColumn, &hvIsOverlapping);
+			HalconCpp::TupleLength(hvRow, &hvLength);
+			if (hvLength[0].I() < 1) continue;
+			double x1 = hvColumn[0].D();
+			double y1 = hvRow[0].D();
+			if (x1 < 0) {
+				HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 5, 100, 5, &hvRow, &hvColumn, &hvIsOverlapping);
+				HalconCpp::TupleLength(hvRow, &hvLength);
+				if (hvLength[0].I() < 1) continue;
+				x1 = hvColumn[0].D();
+				y1 = hvRow[0].D();
+			}
+
+			if (1 == m_nBrokenUse && 1 == nRet) {    //如果检测到有破损,则使用破损的坐标
+				HalconCpp::HObject hLineRg, hIntersectRg;
+				HalconCpp::GenRegionLine(&hLineRg, y1, x1, centerY, centerX);
+				HalconCpp::Intersection(hLineRg, m_hBrkRoiRegion, &hIntersectRg);
+				HalconCpp::HTuple hvY, hvX, hvLength;
+				HalconCpp::GetRegionPoints(hIntersectRg, &hvY, &hvX);
+				HalconCpp::TupleLength(hvY, &hvLength);
+				int N0 = hvLength[0].I();
+				int loopNumber = 0;
+				if (N0 > 0) {
+					loopNumber = hvLength[0].I();
+				}
+				double minDist = MAXINT;
+				for (int j = 0; j < loopNumber; j++) {
+					double dx = hvX[j].I() - centerX;
+					double dy = hvY[j].I() - centerY;
+					double dist = sqrt(dx * dx + dy * dy);
+					if (dist < minDist) {
+						minDist = dist;
+						m_ptArrayResult[i].x = hvX[j].I();
+						m_ptArrayResult[i].y = hvY[j].I();
+					}
+				}
+			}
+		}
+	}
+
+#if  RCUT_DEBUG_CODE 
+//#if  1 
+	HalconCpp::HTuple hvYY, hvXX;
+	for (int i = 0; i < 16; i++) {
+		hvXX[i] = m_ptArrayResult[i].x;
+		hvYY[i] = m_ptArrayResult[i].y;
+	}
+	HalconCpp::HObject hDispRg;
+	HalconCpp::GenCrossContourXld(&hDispRg, hvYY, hvXX, 21, 0.0);
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hDispRg);
+	hDispWin.Click();
+#endif
+
+	if (1 == m_nBrokenUse && 1 == nRet) {
+		double aryDx[16], aryDy[16];
+		for (int i = 0; i < 16; i++) {
+			aryDx[i] = m_ptArrayResult[i].x - m_ptArrayStd[i].x;
+			aryDy[i] = m_ptArrayResult[i].y - m_ptArrayStd[i].y;
+		}
+		//进行排序
+		for (int i = 0; i < 15; i++) {
+			for (int j = i + 1; j < 16; j++) {
+				if (aryDx[i] > aryDx[j]) {
+					double temp = aryDx[i];
+					aryDx[i] = aryDx[j];
+					aryDx[j] = temp;
+				}
+				if (aryDy[i] > aryDy[j]) {
+					double temp = aryDy[i];
+					aryDy[i] = aryDy[j];
+					aryDy[j] = temp;
+				}
+			}
+		}
+		//计算均值
+		double avgDx = 0.0f;
+		double avgDy = 0.0f;
+		for (int i = 3; i <= 12; i++) {
+			avgDx += aryDx[i];
+			avgDy += aryDy[i];
+		}
+		avgDx = avgDx / 10;
+		avgDy = avgDy / 10;
+		Log_GetDebug()->TraceInfo("Avg Info: (%.1f, %.1f), %d", avgDx, avgDy, __LINE__);
+
+		Point2D aryPt[16];
+		for (int i = 0; i < 16; i++) {
+			if (fabs(avgDx) < 15 && fabs(avgDy) < 15) {
+				double dx = m_ptArrayResult[i].x - (m_ptArrayStd[i].x + avgDx);
+				double dy = m_ptArrayResult[i].y - (m_ptArrayStd[i].y + avgDy);
+				if (fabs(dx) < m_nDistThres || fabs(dy) < m_nDistThres) {
+					aryPt[i] = m_ptArrayResult[i];
+				}
+				else {
+					aryPt[i] = m_ptArrayStd[i];
+					aryPt[i].x += avgDx;
+					aryPt[i].y += avgDy;
+				}
+			}
+			else {
+				aryPt[i] = m_ptArrayStd[i];
+				aryPt[i].x += avgDx;
+				aryPt[i].y += avgDy;
+			}
+		}
+
+		//if (1 == m_nTech) {
+		//	for (int i = 0; i < 16; i++) {
+		//		aryPt[i] = m_ptArrayResult[i];
+		//	}
+		//}
+
+
+		//1. 获取点阵
+		std::vector<vec> vecPoints;
+		for (int i = 0; i < 16; i++) {
+			float x0 = (float)aryPt[i].x;
+			float y0 = (float)aryPt[i].y;
+			vec p0(x0, y0, 0);
+			vecPoints.push_back(p0);
+		}
+
+		//2. 执行样条插值
+		CBspline bcurve(vecPoints);
+		bcurve.execute();
+
+		//3. 获取样条差值轮廓点
+		int sz = (int)(bcurve.m_vPtResults.size());
+		if (sz < 1) return;
+		HalconCpp::HTuple hvY, hvX;
+		for (int i = 0; i < sz; i++) {
+			hvX[i] = bcurve.m_vPtResults[i][0];
+			hvY[i] = bcurve.m_vPtResults[i][1];
+		}
+		int idx = sz;
+		hvX[idx] = xTargetCenter;
+		hvY[idx] = yTargetCenter;
+		//4. 生产区域
+		HalconCpp::HObject hRegion0, hBrokenRg;
+		HalconCpp::GenRegionPolygonFilled(&hRegion0, hvY, hvX);
+		HalconCpp::ErosionCircle(hRegion0, &hBrokenRg, m_nBrokenSmooth);
+
+#if  RCUT_DEBUG_CODE  
+//#if  1  
+		for (int i = 0; i < 16; i++) {
+			Log_GetDebug()->TraceInfo("Offset %d: (%.1f, %.1f),(%.1f, %.1f),(%.1f, %.1f),(%.1f, %.1f), %d",
+				i, m_ptArrayResult[i].x, m_ptArrayResult[i].y,
+				m_ptArrayStd[i].x, m_ptArrayStd[i].y,
+				m_ptArrayResult[i].x - aryPt[i].x, m_ptArrayResult[i].y - aryPt[i].y,
+				m_ptArrayResult[i].x - m_ptArrayStd[i].x, m_ptArrayResult[i].y - m_ptArrayStd[i].y,
+				__LINE__);
+		}
+
+		hDispWin.DispObj(hImage);
+		hDispWin.SetColor("red");
+		hDispWin.DispObj(m_hBrkRoiRegion);
+		hDispWin.Click();
+
+		hDispWin.DispObj(hImage);
+		hDispWin.SetColor("green");
+		hDispWin.DispObj(hBrokenRg);
+		hDispWin.Click();
+#endif
+
+		HalconCpp::HObject hIntersectRg, hConnectRg, hSelectRg;
+		HalconCpp::Intersection(hBrokenRg, m_hBrkRoiRegion, &hIntersectRg);
+		HalconCpp::Connection(hIntersectRg, &hConnectRg);
+
+#if  RCUT_DEBUG_CODE
+//#if  1
+		hDispWin.DispObj(hImage);
+		hDispWin.SetColored(6);
+		hDispWin.DispObj(hConnectRg);
+		hDispWin.Click();
+#endif
+
+
+		HalconCpp::SelectShape(hConnectRg, &hSelectRg, "area", "and", m_nBrokenArea, MAXINT);
+		int ngNum = ClsVision::ObjectNumber(hSelectRg);
+		if (ngNum > 0) {
+			NgDotInfo ng;
+			ng.eDir = m_eDir;
+			ng.id = m_id;
+			ng.isRes = false;
+			ng.minValue = m_nDx;
+			ng.maxValue = m_nDy;
+			ng.strName = m_strName;
+			ng.ngType = DefectLoc_Chip;   //缺陷类型
+			ng.eVision = VISION_RCUT;
+
+			CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+			HalconCpp::HTuple hvArea, hvYY, hvXX;
+			HalconCpp::HTuple hvYY1, hvXX1, hvYY2, hvXX2;
+			HalconCpp::AreaCenter(hSelectRg, &hvArea, &hvYY, &hvXX);
+			HalconCpp::SmallestRectangle1(hSelectRg, &hvYY1, &hvXX1, &hvYY2, &hvXX2);
+			for (int i = 0; i < ngNum; i++) {
+				ng.result = hvArea[i].I();
+				ng.xResult = (int)(m_xMmvsp * (hvXX2[i].I() - hvXX1[i].I() + 1));
+				ng.yResult = (int)(m_yMmvsp * (hvYY2[i].I() - hvYY1[i].I() + 1));
+				ng.xPosPxl = (int)(0.5 * (hvXX2[i].I() + hvXX1[i].I())) + m_x1;
+				ng.yPosPxl = (int)(0.5 * (hvYY1[i].I() + hvYY2[i].I())) + m_y1;
+				ng.x1 = hvXX1[i].I() + m_x1 - 1;
+				ng.y1 = hvYY1[i].I() + m_y1 - 1;
+				ng.x2 = hvXX2[i].I() + m_x1 + 1;
+				ng.y2 = hvYY2[i].I() + m_y1 + 1;
+
+				if (nullptr != pSideData) {  //区域的显示结果
+					DispVisionResult inf;
+					inf.nType = 1;
+					inf.eDir = (int)(m_eDir);
+					inf.eVision = (int)(VISION_RCUT);
+					inf.rectX1 = ng.x1;
+					inf.rectY1 = ng.y1;
+					inf.rectX2 = ng.x2;
+					inf.rectY2 = ng.y2;
+					inf.showROI = 0;
+					pSideData->m_vDispVisionResult.push_back(inf);
+				}
+
+				m_nNgInfo.push_back(ng);
+			}
+		}
+#if  RCUT_DEBUG_CODE  
+//#if  1
+		hDispWin.DispObj(hImage);
+		hDispWin.DispObj(hSelectRg);
+		hDispWin.Click();
+#endif
+	}
+}
+
+void CRcutDotProcess::InspectBotChip(HalconCpp::HObject &hImage) {
+	/* code */
+	if (2 != m_id) return;
+
+	double maxDist = 0.0f;
+	double minDist = 0.0f;
+	std::vector<Point2D> vStartPoints;
+	std::vector<Point2D> vEndPoints;
+	std::vector<Point2D> vResPoints;
+	if (!getRcutEdgePoints(hImage, vStartPoints, vEndPoints, vResPoints, maxDist, minDist)) return;
+	m_fMaxChamber = maxDist;
+	m_fMinChamber = minDist;
+
+	//int width = 0;
+	//int height = 0;
+	//ClsVision::GetImageSize(hImage, width, height);
+	//HalconCpp::HWindow hDispWin(0, 0, width, height);
+	//hDispWin.SetPart(0, 0, height - 1, width - 1);
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hImage);
+
+	//int sz = (int)(vStartPoints.size());
+	//for (int i = 0; i < sz; i++) {
+	//	HalconCpp::HObject dispObject1, dispObject2;
+	//	HalconCpp::GenCrossContourXld(&dispObject1, vStartPoints[i].y, vStartPoints[i].x, 15, 0);
+	//	HalconCpp::GenCrossContourXld(&dispObject2, vEndPoints[i].y, vEndPoints[i].x, 15, 0);
+	//	hDispWin.DispObj(dispObject1);
+	//	hDispWin.DispObj(dispObject2);
+	//}
+	//hDispWin.Click();
+
+
+	HalconCpp::HObject hContourRegion, hChipRegion;
+	if (!getRCutRegion(vStartPoints, vEndPoints, hContourRegion, hChipRegion)) return;
+	m_hRoiRegion = hContourRegion;
+	m_hChipRegion = hChipRegion;
+
+	//hDispWin.SetDraw("fill");
+	//hDispWin.DispObj(hContourRegion);
+	//hDispWin.Click();
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hChipRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HObject hRectRegion, hSelectRegion;
+	genRectangeRegion(hRectRegion);
+	ImageBinThreshold(hImage, hRectRegion, hContourRegion, hSelectRegion);
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hSelectRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HObject hRealRegion;
+	if (!getRCutRealRegion(hSelectRegion, vResPoints, hRealRegion)) return;
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hRealRegion);
+	//hDispWin.Click();
+
+	InpsectChipRegion(hRealRegion, hChipRegion);
+}
+
+bool CRcutDotProcess::getRCutRegion(std::vector<Point2D> vStartPoints, std::vector<Point2D> vEndPoints, HalconCpp::HObject &hTargetRegion, HalconCpp::HObject &hRoiRegion) {
+	/* code */
+	int num = (int)(vStartPoints.size());
+	if (num < 1) return false;
+
+	//1. 获取点阵
+	std::vector<vec> vStartCtrlPoint;
+	std::vector<vec> vEndCtrlPoint;
+	for (int i = 0; i < num; i++) {
+		float x0 = (float)vStartPoints[i].x;
+		float y0 = (float)vStartPoints[i].y;
+		vec p0(x0, y0, 0);
+		vStartCtrlPoint.push_back(p0);
+		float x1 = (float)vEndPoints[i].x;
+		float y1 = (float)vEndPoints[i].y;
+		vec p1(x1, y1, 0);
+		vEndCtrlPoint.push_back(p1);
+	}
+
+	//2. 执行样条插值
+	CBspline bcurve(vStartCtrlPoint);
+	bcurve.execute();
+	CBspline endBcurve(vEndCtrlPoint);
+	endBcurve.execute();
+
+	//3. 获取样条差值轮廓点
+	int sz = (int)(bcurve.m_vPtResults.size());
+	if (sz < 1) return false;
+	HalconCpp::HTuple hvY, hvX;
+	for (int i = 0; i < sz; i++) {
+		hvX[i] = bcurve.m_vPtResults[i][0];
+		hvY[i] = bcurve.m_vPtResults[i][1];
+	}
+	int idx = sz;
+	sz = (int)(endBcurve.m_vPtResults.size());
+	if (sz > 0) {
+		for (int i = sz - 1; i >= 0; i--) {
+			hvX[idx] = endBcurve.m_vPtResults[i][0];
+			hvY[idx] = endBcurve.m_vPtResults[i][1];
+			idx += 1;
+		}
+	}
+
+	if (idx < 3) return false;
+
+	//4. 生产区域
+	HalconCpp::GenRegionPolygonFilled(&hTargetRegion, hvY, hvX);
+
+	HalconCpp::HTuple hvY0, hvX0;
+	for (int i = 0; i < sz; i++) {
+		hvX0[i] = endBcurve.m_vPtResults[i][0];
+		hvY0[i] = endBcurve.m_vPtResults[i][1];
+	}
+	if (1 == m_id) {
+		hvX0[sz] = m_width - 1;
+		hvY0[sz] = m_height - 1;
+	}
+	else {
+		hvX0[sz] = m_width - 1;
+		hvY0[sz] = 0;
+	}
+	HalconCpp::HObject hRegion1;
+	HalconCpp::GenRegionPolygonFilled(&hRegion1, hvY0, hvX0);
+
+	HalconCpp::HObject hTempRegion, hTempRegio2, hTempRegio3;
+	HalconCpp::DilationCircle(hTargetRegion, &hTempRegion, 2.5);
+	HalconCpp::DilationCircle(hTempRegion, &hTempRegio2, m_nChipRange);
+	HalconCpp::Difference(hTempRegio2, hTempRegion, &hTempRegio3);
+	HalconCpp::Intersection(hTempRegio3, hRegion1, &hRoiRegion);
+
+	return true;
+}
+
+void CRcutDotProcess::genRectangeRegion(HalconCpp::HObject &hRectRegion) {
+	/* code */
+	if (!ClsVision::RegionExist(m_hRoiRegion)) {
+		int x1 = 5;
+		int x2 = m_width - 6;
+		if (x2 < x1) {
+			x1 = 0;
+			x2 = 1;
+		}
+		int y1 = 5;
+		int y2 = m_height - 6;
+		if (y2 < y1) {
+			y1 = 0;
+            y2 = 1;
+		}
+		HalconCpp::GenRectangle1(&hRectRegion, y1, x1, y2, x2);
+		return;
+	}
+
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::SmallestRectangle1(m_hRoiRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	int y1 = hvY1[0].I();
+	if (y1 < 0) y1 = 5;
+	if (y1 > m_height - 1)  y1 = 5;
+	if (y1 > m_height - 1)  y1 = 0;
+	int y2 = hvY2[0].I();
+	if (y2 < 0) y2 = m_height - 6;
+	if (y2 > m_height - 1)  y2 = m_height - 6;
+	if (y2 < y1) y2 = y1;
+
+	int x1 = hvX1[0].I();
+	if (x1 < 0) x1 = 5;
+    if (x1 > m_width - 1)  x1 = 5;
+	if (x1 > m_width - 1)  x1 = 0;
+	int x2 = hvX2[0].I();
+	if (x2 < 0) x2 = m_width - 6;
+	if (x2 > m_width - 1)  x2 = m_width - 6;
+	if (x2 < x1) x2 = x1;
+	HalconCpp::GenRectangle1(&hRectRegion, y1, x1, y2, x2);
+#if 0 
+	if (1 == m_id) {
+		double centerX = m_width - 1;
+		double centerY = m_height - 1;
+		double radius = sqrt(1.0 * m_width * m_width + 1.0 * m_height * m_height);
+
+		double x1 = 0.0f;
+		double y1 = 0.0f;
+		if (true) {   //直线
+			double angle = m_nStartAngle - 90.0f;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvY, hvX, hvIsOverlapping;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 0, -100, 0, 100, &hvY, &hvX, &hvIsOverlapping);
+			x1 = hvX[0].D();
+			y1 = hvY[0].D();
+		}
+
+		double x2 = 0.0f;
+		double y2 = 0.0f;
+		if (true) {   //直线
+			double angle = m_nEndAngle - 90.0f;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvY, hvX, hvIsOverlapping;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, -100, 0, 100, 0, &hvY, &hvX, &hvIsOverlapping);
+			x2 = hvX[0].D();
+			y2 = hvY[0].D();
+		}
+
+		HalconCpp::GenRectangle1(&hRectRegion, 0, 0, y2, x1);
+	}
+	else {
+		double centerX = m_width - 1;
+		double centerY = 0;
+		double radius = sqrt(1.0 * m_width * m_width + 1.0 * m_height * m_height);
+
+		double x1 = 0.0f;
+		double y1 = 0.0f;
+		if (true) {   //直线
+			double angle = m_nStartAngle;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvY, hvX, hvIsOverlapping;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, 0, 0, m_height-1, 0, &hvY, &hvX, &hvIsOverlapping);
+			y1 = hvY[0].D();
+		}
+
+		double x2 = 0.0f;
+		double y2 = 0.0f;
+		if (true) {   //直线
+			double angle = m_nEndAngle;
+			double phi = DegToRad(angle);
+			double cosx = cos(phi);
+			double sinx = sin(phi);
+			double x0 = centerX - radius * cosx;
+			double y0 = centerY + radius * sinx;
+			HalconCpp::HTuple hvY, hvX, hvIsOverlapping;
+			HalconCpp::IntersectionLines(y0, x0, centerY, centerX, m_height - 1, -100, m_height - 1, 100, &hvY, &hvX, &hvIsOverlapping);
+			x2 = hvX[0].D();
+			y2 = m_height - 1;
+		}
+
+		HalconCpp::GenRectangle1(&hRectRegion, y1, x1, y2, x2);
+	}
+#endif   
+}
+
+void CRcutDotProcess::ImageBinThreshold(HalconCpp::HObject &hImage, HalconCpp::HObject &hRectRegion, HalconCpp::HObject &hRcutRegion, HalconCpp::HObject &hTarget) {
+	/* code */
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) {
+		HalconCpp::GenEmptyObj(&hTarget);
+		return;
+	}
+
+	//1. 图像分割
+	HalconCpp::HObject hProcObject, hBinRegion;
+	HalconCpp::ReduceDomain(hImage, hRectRegion, &hProcObject);
+	HalconCpp::Threshold(hProcObject, &hBinRegion, 0, m_nChipThres);
+
+	//2. 图像合并
+	HalconCpp::HObject hTempRegion, hUionRegion, hConRegion;
+	HalconCpp::ConcatObj(hRcutRegion, hBinRegion, &hTempRegion);
+	HalconCpp::Union1(hTempRegion, &hUionRegion);
+	HalconCpp::Connection(hUionRegion, &hConRegion);
+	HalconCpp::SelectShape(hConRegion, &hTarget, "area", "and", 500, MAXINT);
+}
+
+bool CRcutDotProcess::getRCutRealRegion(HalconCpp::HObject &hSelectRegion, std::vector<Point2D> vPoints, HalconCpp::HObject &hTarget) {
+	/* code */
+	int num = (int)(vPoints.size());
+	if (num < 3) return false;
+
+	HalconCpp::HObject hSelRegion;
+	HalconCpp::HTuple hvIndex, hvLength;
+	HalconCpp::GenEmptyObj(&hSelRegion);
+
+	//1. 第一个点
+	HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[1].y, (int)vPoints[1].x, &hvIndex);
+	HalconCpp::TupleLength(hvIndex, &hvLength);
+	if (hvLength[0].I() > 0) {
+		if (hvIndex[0].I() >= 1) {
+			HalconCpp::SelectObj(hSelectRegion, &hSelRegion, hvIndex[0].I());
+		}
+	}
+
+	//2. 中间点
+	int idx = (int)((num - 1) / 2);
+	HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[idx].y, (int)vPoints[idx].x, &hvIndex);
+	HalconCpp::TupleLength(hvIndex, &hvLength);
+	if (hvLength[0].I() > 0) {
+		if (hvIndex[0].I() >= 1) {
+			HalconCpp::HObject hTempRegion, hTempRegion1;
+			HalconCpp::SelectObj(hSelectRegion, &hTempRegion, hvIndex[0].I());
+			HalconCpp::ConcatObj(hTempRegion, hSelRegion, &hTempRegion1);
+			hSelRegion.Clear();
+			hSelRegion = hTempRegion1;
+		}
+	}
+
+	//3. 最后一个
+	HalconCpp::GetRegionIndex(hSelectRegion, (int)vPoints[num - 2].y, (int)vPoints[num - 2].x, &hvIndex);
+	HalconCpp::TupleLength(hvIndex, &hvLength);
+	if (hvLength[0].I() > 0) {
+		if (hvIndex[0].I() >= 1) {
+			HalconCpp::HObject hTempRegion, hTempRegion1;
+			HalconCpp::SelectObj(hSelectRegion, &hTempRegion, hvIndex[0].I());
+			HalconCpp::ConcatObj(hTempRegion, hSelRegion, &hTempRegion1);
+			hSelRegion.Clear();
+			hSelRegion = hTempRegion1;
+		}
+	}
+	HalconCpp::Union1(hSelRegion, &hTarget);
+	return true;
+}
+
+void CRcutDotProcess::AnalysisStartEndPoints(std::vector<Point2D>& vStartPoints, std::vector<Point2D>& vEndPoints, std::vector<Point2D>& vResPoints) {
+	/* code */
+	int sz = (int)(vStartPoints.size());
+	if (sz < 3) return;
+
+	//1. 计算平均距离
+	double fAvgDist = 0.0f;
+	for (int i = 0; i < sz; i++) {
+		double dx = vEndPoints[i].x - vStartPoints[i].x;
+		double dy = vEndPoints[i].y - vStartPoints[i].y;
+		double dist = sqrt(dx * dx + dy * dy);
+		fAvgDist += dist;
+	}
+	fAvgDist = fAvgDist / sz;
+
+#if 0
+	//2. 输出打印数据
+	Log_GetDebug()->TraceInfo("RCut Avg: %.1f, %d", fAvgDist, __LINE__);
+	for (int i = 0; i < sz; i++) {
+		double dx = vEndPoints[i].x - vStartPoints[i].x;
+		double dy = vEndPoints[i].y - vStartPoints[i].y;
+		double dist = sqrt(dx * dx + dy * dy);
+		Log_GetDebug()->TraceInfo("RCut %d: (%.1f, %d), (%.1f, %.1f), (%.1f, %.1f), %d",
+			i + 1, dist, m_nChamferSize,
+			vStartPoints[i].x, vStartPoints[i].y, vEndPoints[i].x, vEndPoints[i].y,
+			__LINE__);
+	}
+#endif
+
+	//3. 对于均值
+	for (int i = 0; i < sz; i++) {
+		double dx = vEndPoints[i].x - vStartPoints[i].x;
+		double dy = vEndPoints[i].y - vStartPoints[i].y;
+		double dist = sqrt(dx * dx + dy * dy);
+		if (dist > 1.2 * fAvgDist) continue;
+
+		Point2D ptStart = vStartPoints[i];
+		Point2D ptEnd = vEndPoints[i];
+		Point2D ptResult = ptEnd;
+		if (dist < fAvgDist) {
+			//+2.5
+			ptResult = ReflectPoint(ptStart, ptEnd, 3.0f);
+		}
+		else {
+			//+1
+            ptResult = ReflectPoint(ptStart, ptEnd, 2.0f);
+		}
+		vEndPoints[i] = ptResult;
+		Point2D ptRes;
+		ptRes.x = (ptStart.x + ptEnd.x) / 2;
+		ptRes.y = (ptStart.y + ptEnd.y) / 2;
+		vResPoints[i] = ptRes;
+	}
+
+	double fSumDist = 0.0f;
+	for (int i = 0; i < sz; i++) {
+		double dx = vEndPoints[i].x - vStartPoints[i].x;
+		double dy = vEndPoints[i].y - vStartPoints[i].y;
+		double dist = sqrt(dx * dx + dy * dy);
+		fSumDist += dist;
+	}
+	m_fAvgChamber = fSumDist / sz;
+}
+
+Point2D CRcutDotProcess::ReflectPoint(Point2D ptStart, Point2D ptEnd, double offset) {
+	/* code */
+	Point2D ptResult = ptEnd;
+	double dx = ptEnd.x - ptStart.x;
+	double dy = ptEnd.y - ptStart.y;
+	double dist = sqrt(dx * dx + dy * dy);
+	Point2D pose;
+	std::vector<Point2D> vPtStd, vPtReal;
+	pose.x = 0.0f;
+	pose.y = 0.0f;
+	vPtStd.push_back(pose);
+	pose.x = dist;
+	pose.y = 0.0f;
+	vPtStd.push_back(pose);
+	vPtReal.push_back(ptStart);
+	vPtReal.push_back(ptEnd);
+
+	ParaAffine2D affine = ClsVision::VectorToRigid(vPtStd, vPtReal);
+	pose.x = dist + offset;
+	pose.y = 0.0f;
+	ptResult = ClsVision::CoordinateTransform(pose, affine);
+
+	return ptResult;
+}
+
+void CRcutDotProcess::InspectTopChip(HalconCpp::HObject &hImage) {
+	/* code */
+	if (1 != m_id) return;
+
+	double maxDist = 0.0f;
+	double minDist = 0.0f;
+	std::vector<Point2D> vStartPoints;
+	std::vector<Point2D> vEndPoints;
+	std::vector<Point2D> vResPoints;
+	if (!getRcutEdgePoints(hImage, vStartPoints, vEndPoints, vResPoints, maxDist, minDist)) return;
+	m_fMaxChamber = maxDist;
+	m_fMinChamber = minDist;
+
+	AnalysisStartEndPoints(vStartPoints, vEndPoints, vResPoints);
+
+	//int width = 0;
+	//int height = 0;
+	//ClsVision::GetImageSize(hImage, width, height);
+	//HalconCpp::HWindow hDispWin(0, 0, width, height);
+	//hDispWin.SetPart(0, 0, height - 1, width - 1);
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hImage);
+
+	//int sz = (int)(vStartPoints.size());
+	//for (int i = 0; i < sz; i++) {
+	//	HalconCpp::HObject dispObject1, dispObject2;
+	//	HalconCpp::GenCrossContourXld(&dispObject1, vStartPoints[i].y, vStartPoints[i].x, 15, 0);
+	//	HalconCpp::GenCrossContourXld(&dispObject2, vEndPoints[i].y, vEndPoints[i].x, 15, 0);
+	//	hDispWin.DispObj(dispObject1);
+	//	hDispWin.DispObj(dispObject2);
+	//}
+	//hDispWin.Click();
+
+	HalconCpp::HObject hContourRegion, hChipRegion;
+	if (!getRCutRegion(vStartPoints, vEndPoints, hContourRegion, hChipRegion)) return;
+	m_hRoiRegion = hContourRegion;
+	m_hChipRegion = hChipRegion;
+
+	//hDispWin.SetDraw("fill");
+	//hDispWin.DispObj(hContourRegion);
+	//hDispWin.Click();
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hChipRegion);
+	//hDispWin.Click();
+	
+	HalconCpp::HObject hRectRegion, hSelectRegion;
+	genRectangeRegion(hRectRegion);
+	ImageBinThreshold(hImage, hRectRegion, hContourRegion, hSelectRegion);
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hSelectRegion);
+	//hDispWin.Click();
+
+	HalconCpp::HObject hRealRegion;
+	if (!getRCutRealRegion(hSelectRegion, vResPoints, hRealRegion)) return;
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(hRealRegion);
+	//hDispWin.Click();
+
+	InpsectChipRegion(hRealRegion, hChipRegion);
+
+	//hDispWin.DispObj(hImage);
+	//hDispWin.DispObj(m_hResultRegion);
+	//hDispWin.Click();
+}
+
+void CRcutDotProcess::InpsectChipRegion(HalconCpp::HObject &hChipRegion, HalconCpp::HObject &hRoiRegion) {
+	/* code */
+	if (m_xMmvsp < 0.001 || m_yMmvsp < 0.001) return;
+
+	int fzX = (int)(m_nDx / m_xMmvsp + 0.5f);
+	int fzY = (int)(m_nDy / m_yMmvsp + 0.5f);
+
+	HalconCpp::HObject hTempRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hUionRegion, hResRegion, hOpenRegion;
+	HalconCpp::Intersection(hChipRegion, hRoiRegion, &hTempRegion);
+	if (m_nEdgeSmooth > 0) {
+		HalconCpp::OpeningCircle(hTempRegion, &hOpenRegion, m_nEdgeSmooth + 0.5);
+	}
+	else {
+		hOpenRegion = hTempRegion;
+	}	
+	HalconCpp::Connection(hOpenRegion, &hConRegion);
+	HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT);
+	HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT);
+	HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion);
+
+	HalconCpp::Union1(hConcatRegion, &hUionRegion);
+	HalconCpp::Connection(hUionRegion, &hResRegion);
+	int num = ClsVision::ObjectNumber(hResRegion);
+	if (num < 1) return;
+
+	m_hResultRegion = hResRegion;
+}
+
+HalconCpp::HObject& CRcutDotProcess::getImage(void) {
+	/* code */
+	return m_hImage;
+}
+
+HalconCpp::HObject& CRcutDotProcess::getChipRegion(void) {
+	/* code */
+	return m_hChipRegion;
+}
+
+HalconCpp::HObject& CRcutDotProcess::getRoiRegion(void) {
+	/* code */
+	return m_hRoiRegion;
+}
+
+HalconCpp::HObject& CRcutDotProcess::getBRKRoiRegion(void) {
+	/* code */
+    return m_hBrkRoiRegion;
+}
+
+void CRcutDotProcess::SetStandardPoint(void) {
+	/* code */
+	if (1 != m_nTech) return;
+
+	for (int i = 0; i < 16; i++) {
+		m_ptArrayStd[i] = m_ptArrayResult[i];
+	}
+}
+
+Json::Value CRcutDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+	Json::Value jsValue;
+	jsValue["alg type"] = RCUT_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["use"] = m_nUse;
+	jsValue["pos x"] = m_nPoseX;
+	jsValue["pos y"] = m_nPoseY;
+	jsValue["width"] = m_width;
+	jsValue["height"] = m_height;
+	jsValue["chamber size"] = m_nChamferSize;
+	jsValue["chamber range"] = m_nChipRange;
+	jsValue["chamber thres"] = m_nChipThres;
+	jsValue["start angle"] = m_nStartAngle;
+	jsValue["end angle"] = m_nEndAngle;
+	jsValue["dx"] = m_nDx;
+	jsValue["dy"] = m_nDy;
+	jsValue["bin thres"] = m_nBinThres;
+	jsValue["edge smooth"] = m_nEdgeSmooth;
+
+	jsValue["Broken use"] = m_nBrokenUse;
+    jsValue["Auto sigma"] = m_fSigmaThres;
+    jsValue["Tech Para"] = m_nTech;
+    jsValue["Dist thres"] = m_nDistThres;
+    jsValue["Broken smooth"] = m_nBrokenSmooth;
+    jsValue["Broken area"] = m_nBrokenArea;
+	jsValue["Noise Size"] = m_fOpenPara;
+
+	jsValue["Start Da"] = m_nStartDa;
+	jsValue["End Da"] = m_nEndDa;
+
+	for (int i = 0; i < 16; i++) {
+		std::string str = ClsVision::FormatString("PosX%d", i);
+		jsValue[str.c_str()] = m_ptArrayStd[i].x;
+		str = ClsVision::FormatString("PosY%d", i);
+		jsValue[str.c_str()] = m_ptArrayStd[i].y;
+	}
+
+	return jsValue;
+}
+
+void CRcutDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseX = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseY = jsValue[strName.c_str()].asInt();
+	}
+
+	//7. width
+	strName = "width";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_width = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. height
+	strName = "height";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_height = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. chamber size
+	strName = "chamber size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nChamferSize = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. chamber range
+	strName = "chamber range";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nChipRange = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. chamber thres
+	strName = "chamber thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nChipThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. start angle
+	strName = "start angle";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nStartAngle = jsValue[strName.c_str()].asInt();
+	}
+
+	//13. end angle
+	strName = "end angle";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEndAngle = jsValue[strName.c_str()].asInt();
+	}
+
+	//14. dx
+	strName = "dx";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nDx = jsValue[strName.c_str()].asInt();
+	}
+
+	//15. dy
+	strName = "dy";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nDy = jsValue[strName.c_str()].asInt();
+	}
+
+	//16. bin thres
+	strName = "bin thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nBinThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//17. edge smooth
+	strName = "edge smooth";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEdgeSmooth = jsValue[strName.c_str()].asInt();
+	}
+
+	//18. Broken use
+    strName = "Broken use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nBrokenUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//19. Auto Sigma
+    strName = "Auto sigma";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+        m_fSigmaThres = jsValue[strName.c_str()].asDouble();
+	}
+
+	//20. Gray thres
+    strName = "Tech Para";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+        m_nTech = jsValue[strName.c_str()].asInt();
+	}
+
+	//21. Dist thres
+    strName = "Dist thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+        m_nDistThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//22. Broken smooth
+    strName = "Broken smooth";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+        m_nBrokenSmooth = jsValue[strName.c_str()].asInt();
+	}
+
+	//23. Broken area
+    strName = "Broken area";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+        m_nBrokenArea = jsValue[strName.c_str()].asInt();
+	}
+
+	//24. Noise Size
+	strName = "Noise Size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+		m_fOpenPara = jsValue[strName.c_str()].asDouble();
+	}
+
+	//25. Start Da
+	strName = "Start Da";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nStartDa = jsValue[strName.c_str()].asInt();
+	}
+
+	//26. End Da
+	strName = "End Da";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nEndDa = jsValue[strName.c_str()].asInt();
+	}
+
+	for (int i = 0; i < 16; i++) {
+		strName = ClsVision::FormatString("PosX%d", i);
+		if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+			m_ptArrayStd[i].x = jsValue[strName.c_str()].asDouble();
+
+		}
+		
+		strName = ClsVision::FormatString("PosY%d", i);
+		if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isDouble()) {
+			m_ptArrayStd[i].y = jsValue[strName.c_str()].asDouble();
+		}
+	}
+
+	if (abs(m_nStartDa) < 1) {
+		m_nStartDa = m_nStartAngle;
+	}
+	if (abs(m_nEndDa) < 1) {
+		m_nEndDa = m_nEndAngle;
+	}
+}
+
+int CRcutDotProcess::CheckBroken(HalconCpp::HObject& hImage, HalconCpp::HObject& hRoiRegion) {
+	/* code */
+	if (1 != m_nBrokenUse) return 0;
+	if (!ClsVision::ObjectExist(hImage)) return 0;
+
+	int minSize = (int)(m_fOpenPara + 0.5f);
+	if (minSize < 3) {
+		minSize = 3;
+	}
+
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 1 || height < 1) return -1;
+
+#if RCUT_DEBUG_CODE
+	int hWidth = (int)(0.5 * width);
+	int hHeight = (int)(0.5 * height);
+	HalconCpp::HWindow hDispWin(0, 0, hWidth, hHeight);
+	hDispWin.SetPart(0, 0, height - 1, width - 1);
+	hDispWin.SetColored(6);
+#endif
+
+	//第一步,进行分割,获取目标点的有效区域
+	int xTarget = minSize;
+	int yTarget = minSize;
+	if (1 != m_id)  yTarget = height - (minSize+1);
+    HalconCpp::HObject hRegions;
+	HalconCpp::AutoThreshold(hImage, &hRegions, m_fSigmaThres);
+
+#if RCUT_DEBUG_CODE
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hRegions);
+	hDispWin.Click();
+#endif
+
+	HalconCpp::HTuple hvIndex, hvNum;
+	HalconCpp::GetRegionIndex(hRegions, yTarget, xTarget, &hvIndex);
+	hvNum = hvIndex.TupleLength();
+	int nNum = hvNum[0].I();
+	if (nNum < 1) return 0;
+	nNum = ClsVision::ObjectNumber(hRegions);
+
+	//备份序号,后面分析进行屏蔽
+	int idxSelect = hvIndex[0].I();
+	if (idxSelect < 1) return 0;
+	HalconCpp::HObject hSelectRegion, hConnectRegion, hSelRg, hSelROI;
+	HalconCpp::SelectObj(hRegions, &hSelectRegion, idxSelect);
+
+#if RCUT_DEBUG_CODE
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hSelectRegion);
+	hDispWin.Click();
+#endif
+
+	HalconCpp::Connection(hSelectRegion, &hConnectRegion);
+	HalconCpp::GetRegionIndex(hConnectRegion, yTarget, xTarget, &hvIndex);
+	hvNum = hvIndex.TupleLength();
+	if (hvNum[0].I() < 1) return 0;
+
+	//消除赛选区域的毛刺,避免影响处理
+	HalconCpp::SelectObj(hConnectRegion, &hSelRg, hvIndex[0].I());
+	if (m_fOpenPara < 1.0f) {
+		hRoiRegion = hSelRg;
+		return 1;
+	}
+
+	HalconCpp::HObject hOpenRg,hConRg;
+	HalconCpp::OpeningCircle(hSelRg, &hOpenRg, m_fOpenPara);
+
+#if RCUT_DEBUG_CODE
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hOpenRg);
+	hDispWin.Click();
+#endif
+
+	HalconCpp::Connection(hOpenRg, &hConRg);
+	HalconCpp::GetRegionIndex(hConRg, yTarget, xTarget, &hvIndex);
+	hvNum = hvIndex.TupleLength();
+	if (hvNum[0].I() < 1) return 0;
+
+
+    HalconCpp::SelectObj(hConRg, &hRoiRegion, hvIndex[0].I());
+
+#if RCUT_DEBUG_CODE
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hRoiRegion);
+	hDispWin.Click();
+#endif
+	
+	return 1;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/RcutDotProcess.h b/Common_Class/BlVisionPro/Vision/RcutDotProcess.h
new file mode 100644
index 0000000..7eab196
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/RcutDotProcess.h
@@ -0,0 +1,147 @@
+#ifndef RCUT_DOT_PROCESS_H
+#define RCUT_DOT_PROCESS_H
+
+class CRcutDotProcess
+{
+public:
+	CRcutDotProcess();
+	CRcutDotProcess(DimensionDir eDir, int id);
+	~CRcutDotProcess();
+
+public:
+	//1. 获取区域
+	void getRegion(int &xPos, int &yPos, int &width, int &height);
+	void setRegion(int xPos, int yPos, int width, int height);
+
+	//2. 获取ID
+	int getID(void);
+	void setID(int id);
+
+	//3. 获取区域
+	HalconCpp::HObject& getImage(void);
+	HalconCpp::HObject& getChipRegion(void);
+	HalconCpp::HObject& getRoiRegion(void);
+	HalconCpp::HObject& getBRKRoiRegion(void);
+	void SetStandardPoint(void);
+
+	//4. 执行检测
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//5. 区域示教
+	void TechImage(void);
+
+	//6. 保存数据
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+
+public:
+	int m_nUse;
+	CString m_strName;
+
+	int m_nChamferSize;            //研磨量
+	int m_nChipRange;           //Chip Range     
+	int m_nChipThres;           //Chip阈值
+
+	int m_nStartAngle;         //开始角度
+	int m_nEndAngle;           //结束角度
+
+	int m_nBinThres;         //边界阈值
+	int m_nEdgeSmooth;        //边界阈值
+
+	//Judge XY
+	int m_nDx;
+	int m_nDy;
+
+
+	std::vector<NgDotInfo> m_nNgInfo;
+	double m_fMaxChamber;
+	double m_fMinChamber;
+	double m_fAvgChamber;
+
+	//Broken区域的检测
+	int m_nBrokenUse;
+	double m_fSigmaThres;   //Sigma阈值
+	double m_fOpenPara;     //噪音参数
+	int m_nDistThres;       //距离阈值
+	int m_nBrokenSmooth;    //破损平滑阈值
+	int m_nBrokenArea;      //破损区域
+	int m_nTech;           //示教参数
+	int m_nStartDa;
+	int m_nEndDa;
+	
+	Point2D m_ptArrayResult[16];
+	Point2D m_ptArrayStd[16];
+
+private:
+	int m_id;
+	int m_nPoseX;
+	int m_nPoseY;
+	int m_width;
+	int m_height;
+
+	HalconCpp::HObject m_hImage;
+	HalconCpp::HObject m_hRoiRegion;
+	HalconCpp::HObject m_hChipRegion;
+
+	HalconCpp::HObject m_hBrkRoiRegion;
+	
+	DimensionDir m_eDir;
+	int m_x1;
+	int m_y1;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+	HalconCpp::HObject m_hResultRegion;
+
+private:
+	//1. 获取图像
+	bool getProcImage(DimensionDir eDir, Point2I offset, HalconCpp::HObject &hImage);
+
+	//2. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+
+	//3. 获取结果
+	void getResult(void);
+
+	//4. 获取廓形
+	void InspectChip(HalconCpp::HObject &hImage);
+
+	//5. Top检测
+	void InspectTopChip(HalconCpp::HObject &hImage);
+
+	//6. Bot检测
+	void InspectBotChip(HalconCpp::HObject &hImage);
+
+	//7. 获取R角度的尺寸轮廓
+	bool getRCutRegion(std::vector<Point2D> vStartPoints, std::vector<Point2D> vEndPoints, HalconCpp::HObject &hTargetRegion, HalconCpp::HObject &hRoiRegion);
+
+	//8. 生产区域
+	void genRectangeRegion(HalconCpp::HObject &hRectRegion);
+
+	//9. 图像分割
+	void ImageBinThreshold(HalconCpp::HObject &hImage, HalconCpp::HObject &hRectRegion, HalconCpp::HObject &hRcutRegion, HalconCpp::HObject &hTarget);
+
+	//10. 获取真实的RCUT框
+	bool getRCutRealRegion(HalconCpp::HObject &hSelectRegion, std::vector<Point2D> vPoints, HalconCpp::HObject &hTarget);
+
+	//11. 获取点阵序列
+	bool getRcutEdgePoints(HalconCpp::HObject &hImage, std::vector<Point2D> &vStartPoints, std::vector<Point2D> &vEndPoints, std::vector<Point2D> &vResPoints, double &maxDist, double &minDist);
+
+	//12. 执行区域
+	void InpsectChipRegion(HalconCpp::HObject &hChipRegion, HalconCpp::HObject &hRoiRegion);
+
+	//13. 检查Broken
+	int CheckBroken(HalconCpp::HObject& hImage, HalconCpp::HObject &hRoiRegion);
+
+	//14. 分析起始点和结束点
+	void AnalysisStartEndPoints(std::vector<Point2D>& vStartPoints, std::vector<Point2D>& vEndPoints, std::vector<Point2D>& vResPoints);
+
+	//15. 反射变换点
+	Point2D ReflectPoint(Point2D ptStart, Point2D ptEnd, double offset);
+
+	//16. 分析破片
+	void AnalysisBroken(HalconCpp::HObject& hImage);
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/Serializer.cpp b/Common_Class/BlVisionPro/Vision/Serializer.cpp
new file mode 100644
index 0000000..eff4c41
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/Serializer.cpp
@@ -0,0 +1,212 @@
+#include "stdafx.h"
+#include "Serializer.h"
+
+
+CSerializer::CSerializer() {
+	/* code */
+}
+
+
+CSerializer::~CSerializer() {
+	/* code */
+}
+
+int CSerializer::SerializedInt32(int& i, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(int)) {
+		return -1;
+	}
+
+	memcpy(pBuffer, &i, sizeof(int));
+	return sizeof(int);
+}
+
+int CSerializer::SerializedInt64(__int64& i, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(__int64)) {
+		return -1;
+	}
+
+	memcpy(pBuffer, &i, sizeof(__int64));
+	return sizeof(__int64);
+}
+
+int CSerializer::SerializedFloat(float& f, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(float)) {
+		return -1;
+	}
+
+	memcpy(pBuffer, &f, sizeof(float));
+	return sizeof(float);
+}
+
+int CSerializer::SerializedDouble(double& d, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(double)) {
+		return -1;
+	}
+
+	memcpy(pBuffer, &d, sizeof(double));
+	return sizeof(double);
+}
+
+int CSerializer::SerializedBuffer(void*pScrBuffer, int scrSize, void* pBuffer, int size) {
+	/* code */
+	if (size < scrSize) {
+		return -1;
+	}
+
+	memcpy(pBuffer, pScrBuffer, scrSize);
+	return scrSize;
+}
+
+int CSerializer::SerializedString(std::string& str, void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+
+	int len = (int)(str.length());
+	int nRet1 = SerializedInt32(len, pTemp, remainSize);
+	if (nRet1 < 0) {
+		return nRet1;
+	}
+	pTemp += nRet1;
+	remainSize -= nRet1;
+
+	int nRet2 = SerializedBuffer((void*)str.c_str(), len, pTemp, remainSize);
+	if (nRet2 < 0) {
+		return nRet2;
+	}
+
+	return nRet1 + nRet2;
+}
+
+int CSerializer::SerializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size) {
+	/*code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+
+	HalconCpp::HTuple hPoint, hSize;
+	HalconCpp::HTuple hSerializedItem;
+	HalconCpp::SerializeObject(hObject, &hSerializedItem);
+	HalconCpp::GetSerializedItemPtr(hSerializedItem, &hPoint, &hSize);
+
+	int len = hSize[0].I();
+	int nRet1 = SerializedInt32(len, pTemp, remainSize);
+	if (nRet1 < 0) {
+		HalconCpp::ClearSerializedItem(hSerializedItem);
+		return nRet1;
+	}
+	pTemp += nRet1;
+	remainSize -= nRet1;
+
+	if (remainSize < hSize[0].I()) {
+		HalconCpp::ClearSerializedItem(hSerializedItem);
+		return -1;
+	}
+
+	memcpy(pTemp, (void*)hPoint.L(), hSize[0].I());
+	return nRet1 + hSize[0].I();
+}
+
+int CSerializer::DeserializedInt32(int& i, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(int)) {
+		return -1;
+	}
+
+	memcpy(&i, pBuffer, sizeof(int));
+	return sizeof(int);
+}
+
+int CSerializer::DeserializedInt64(__int64& i, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(__int64)) {
+		return -1;
+	}
+
+	memcpy(&i, pBuffer, sizeof(__int64));
+	return sizeof(__int64);
+}
+
+int CSerializer::DeserializedFloat(float& f, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(float)) {
+		return -1;
+	}
+
+	memcpy(&f, pBuffer, sizeof(float));
+	return sizeof(float);
+}
+
+int CSerializer::DeserializedDouble(double& d, void* pBuffer, int size) {
+	/* code */
+	if (size < sizeof(double)) {
+		return -1;
+	}
+
+	memcpy(&d, pBuffer, sizeof(double));
+	return sizeof(double);
+}
+
+int CSerializer::DeserializedBuffer(void*pTarBuffer, int tarSize, void* pBuffer, int size) {
+	/*code */
+	if (size < tarSize) {
+		return -1;
+	}
+
+	memcpy(pTarBuffer, pBuffer, tarSize);
+	return tarSize;
+}
+
+int CSerializer::DeserializedString(std::string& str, void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+
+	int len = 0;
+	int nRet1 = DeserializedInt32(len, pTemp, remainSize);
+	if (nRet1 < 0) {
+		return nRet1;
+	}
+	pTemp += nRet1;
+	remainSize -= nRet1;
+
+	char* pszTemp = new char[len];
+	int nRet2 = DeserializedBuffer(pszTemp, len, pTemp, remainSize);
+	if (nRet2 < 0) {
+		delete[] pszTemp;
+		return nRet2;
+	}
+	str.clear();
+	str.append(pszTemp, len);
+	delete[] pszTemp;
+
+	return nRet1 + nRet2;
+}
+
+int CSerializer::DeserializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size) {
+	/* code */
+	char* pTemp = (char*)pBuffer;
+	int remainSize = size;
+
+	int len = 0;
+	int nRet1 = DeserializedInt32(len, pTemp, remainSize);
+	if (nRet1 < 0) {
+		return nRet1;
+	}
+	pTemp += nRet1;
+	remainSize -= nRet1;
+
+
+	if (remainSize < len) {
+		return nRet1;
+	}
+
+	HalconCpp::HTuple hSerializedItem;
+	HalconCpp::CreateSerializedItemPtr((__int64)pTemp, len, "false", &hSerializedItem);
+	HalconCpp::DeserializeObject(&hObject, hSerializedItem);
+
+	return nRet1 + len;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/Serializer.h b/Common_Class/BlVisionPro/Vision/Serializer.h
new file mode 100644
index 0000000..5091abb
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/Serializer.h
@@ -0,0 +1,39 @@
+#ifndef SERIALIZER_H
+#define SERIALIZER_H
+
+#define SERIALIZER_INT_32(i, p, r, uu) nRet = CSerializer::SerializedInt32(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define SERIALIZER_INT_64(i, p, r, uu) nRet = CSerializer::SerializedInt64(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define SERIALIZER_DOUBLE(d, p, r, uu) nRet = CSerializer::SerializedDouble(d, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define SERIALIZER_H_OBJECT(h, p, r, uu) nRet = CSerializer::SerializedHobject(h, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define SERIALIZER_STRING(s, p, r, uu) nRet = CSerializer::SerializedString(s, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_INT_32(i, p, r, uu) nRet = CSerializer::DeserializedInt32(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_INT_64(i, p, r, uu) nRet = CSerializer::DeserializedInt64(i, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_DOUBLE(d, p, r, uu) nRet = CSerializer::DeserializedDouble(d, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_STRING(s, p, r, uu) nRet = CSerializer::DeserializedString(s, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+#define DESERIALIZER_H_OBJECT(h, p, r, uu) nRet = CSerializer::DeserializedHobject(h, p, r); if (nRet < 0) { return nRet; } p += nRet; r -= nRet; uu += nRet;
+
+class CSerializer
+{
+public:
+	CSerializer();
+	~CSerializer();
+
+public:
+	static int SerializedInt32(int& i, void* pBuffer, int size);
+	static int SerializedInt64(__int64& i, void* pBuffer, int size);
+	static int SerializedFloat(float& f, void* pBuffer, int size);
+	static int SerializedDouble(double& d, void* pBuffer, int size);
+	static int SerializedBuffer(void*pScrBuffer, int scrSize, void* pBuffer, int size);
+	static int SerializedString(std::string& str, void* pBuffer, int size);
+	static int SerializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size);
+	static int DeserializedInt32(int& i, void* pBuffer, int size);
+	static int DeserializedInt64(__int64& i, void* pBuffer, int size);
+	static int DeserializedFloat(float& f, void* pBuffer, int size);
+	static int DeserializedDouble(double& d, void* pBuffer, int size);
+	static int DeserializedBuffer(void*pTarBuffer, int tarSize, void* pBuffer, int size);
+	static int DeserializedString(std::string& str, void* pBuffer, int size);
+	static int DeserializedHobject(HalconCpp::HObject& hObject, void* pBuffer, int size);
+};
+
+#endif
+
diff --git a/Common_Class/BlVisionPro/Vision/SoftVisionApp.cpp b/Common_Class/BlVisionPro/Vision/SoftVisionApp.cpp
new file mode 100644
index 0000000..221828f
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/SoftVisionApp.cpp
@@ -0,0 +1,794 @@
+#include "stdafx.h"
+#include "SoftVisionApp.h"
+#include "VisionSetDlg.h"
+#include "VisionRecipe.h"
+#include "BlSideData.h"
+#include "VisionBufferPro.h"
+#include "KeyVisionSetDlg.h"
+#include "TranformCoordinate.h"
+#include "CornerRcutProcess.h"
+#include "FileRecipe.h"
+#include "resource.h"
+#include "BlVisionPro.h"
+#include "ThresProcess.h"
+
+CSoftVisionApp::CSoftVisionApp(){
+	/* code */
+	m_pEvent = nullptr;
+	InitializeCriticalSection(&m_criticalSection);
+}
+
+CSoftVisionApp::~CSoftVisionApp(){
+	/* code */
+	DeleteCriticalSection(&m_criticalSection);
+}
+
+static CSoftVisionApp _gSoftVisionApp;
+CSoftVisionApp* CSoftVisionApp::getInstance(void) {
+	/* code */
+	return &_gSoftVisionApp;
+}
+
+int CSoftVisionApp::OpenVisionWindow(void) {
+	/* code */
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+	CVisionSetDlg dlg;
+	dlg.DoModal();
+	int nRet = (int)(::GetLastError());
+	return nRet;
+}
+
+CDialogEx* CSoftVisionApp::CreateVisionWindow(void) {
+	/* code */
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+	CVisionSetDlg *pDlg = new CVisionSetDlg();
+	pDlg->Create(IDD_DIALOG_VISION_SET, NULL);
+
+	return (CDialogEx*)(pDlg);
+}
+
+int CSoftVisionApp::ReleaseWindow(CDialogEx *pDlg) {
+	/* code */
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+	CVisionSetDlg *pVisionSetDlg = (CVisionSetDlg *)(pDlg);
+	if (NULL == pVisionSetDlg) {
+		pVisionSetDlg->DestroyWindow();
+		delete pVisionSetDlg;
+		pVisionSetDlg = nullptr;
+	}
+	return 0;
+}
+
+void CSoftVisionApp::ChangeDimension(CDialogEx *pDlg, int nDir) {
+	/* code */
+	if (!CVisionRecipe::getInstance()->getVisionSetOpen()) return;
+
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+	CVisionSetDlg *pVisionSetDlg = (CVisionSetDlg *)(pDlg);
+	if (NULL == pVisionSetDlg) return;
+	if (!CVisionRecipe::getInstance()->getVisionSetOpen()) return;
+
+	DimensionDir eDir = (DimensionDir)(nDir);
+	pVisionSetDlg->ChangeDimension(eDir);
+}
+
+void CSoftVisionApp::SetVisionOpen(BOOL isOpen) {
+	/* code */
+	CVisionRecipe::getInstance()->setVisionSetOpen(isOpen);
+}
+
+void CSoftVisionApp::OpenKeySetWindow(void) {
+	/* code */
+	AFX_MANAGE_STATE(AfxGetStaticModuleState());
+	CKeyVisionSetDlg dlg;
+	dlg.DoModal();
+}
+
+Point2I CSoftVisionApp::getPose(int eDir, int xPoxPxl, int yPosPxl) {
+	/* code */
+	CTranformCoordinate tranform;
+	Point2I pose;
+	pose.x = xPoxPxl;
+	pose.y = yPosPxl;
+
+	return tranform.Execute((DimensionDir)eDir, pose);
+}
+
+int CSoftVisionApp::Execute(int eDir, NgInfo *ngArray) {
+	/* code */
+	DimensionDir nDir = (DimensionDir)(eDir);
+	KeyDebugInfo info = CVisionRecipe::getInstance()->getKeyInfo();
+	int nRet = 0;
+
+	//1. 视觉定位
+	if (0 != ExecuteLoc(nDir)) {
+		return nRet;
+	}
+
+	//2. GrindSize
+	if (0 == ExecuteGrind(nDir)) {
+		nRet = getGrindResult(nDir ,ngArray);
+	}
+
+
+	//3. Dist
+	if (0 == ExecuteDist(nDir)) {            //获取数据缺陷的数据
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getDistResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	//4. CutLine
+	if (0 == ExecuteCut(nDir)) {
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getCutResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	//5. Rcut
+	if (0 == ExecuteRCUT(nDir)){
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getRcutResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	//6. Thres
+	if (0 == ExecuteThres(nDir)) {
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getThresResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	//7. Hole
+	if (0 == ExecuteHole(nDir)) {
+		NgInfo ngRCUT[NG_INF_NUM];
+		int nCount = getHoleResult(nDir, ngRCUT);
+		if (nCount > 0) {
+			int nTotal = nRet;
+			nRet = addResultToTotal(ngRCUT, nCount, ngArray, nTotal);
+		}
+	}
+
+	return nRet;
+}
+
+//5. 设置回调时间
+void CSoftVisionApp::setImageEventSignal(IVisionEvent *pEvent) {
+	/* code */
+	m_pEvent = pEvent;
+}
+
+Point2I CSoftVisionApp::getPointCoor(DimensionDir dir, Point2I point, Point2I ptTop, Point2I ptBot, Point2I bzTopPoint, Point2I bzBotPoint, int nType) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(dir);
+	double xMmvsp = pSideData->m_dPixelSizeX;
+	double yMmvsp = pSideData->m_dPixelSizeY;
+	std::vector<Point2D> vPtOrigine, vPtReal;
+	Point2D pose;
+	pose.x = ptTop.x * xMmvsp;
+	pose.y = ptTop.y * yMmvsp;
+	vPtReal.push_back(pose);
+    pose.x = ptBot.x * xMmvsp;
+    pose.y = ptBot.y * yMmvsp;
+	vPtReal.push_back(pose);
+
+	pose.x = bzTopPoint.x;
+	pose.y = bzTopPoint.y;
+	vPtOrigine.push_back(pose);
+    pose.x = bzBotPoint.x;
+	pose.y = bzBotPoint.y;
+    vPtOrigine.push_back(pose);
+
+	Point2D poseReal;
+    poseReal.x = point.x * xMmvsp;
+	poseReal.y = point.y * yMmvsp;
+
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtReal, vPtOrigine);
+	Point2D ptResult = ClsVision::CoordinateTransform(poseReal, affine);
+	Point2I result;
+	if (0 == nType) {
+		result.x = (int)(ptResult.x - bzTopPoint.x);
+		result.y = (int)(ptResult.y - bzTopPoint.y);
+	}
+	else {
+		result.x = (int)(ptResult.x - bzBotPoint.x);
+		result.y = (int)(ptResult.y - bzBotPoint.y);
+	}
+
+	return result;
+
+#if 0
+	Point2D posTop, posBot, pose;
+	posTop.x = 0.0f;
+	posTop.y = 0.0f;
+	posBot.x = xMmvsp * (ptBot.x - ptTop.x);
+	posBot.y = yMmvsp * (ptBot.y - ptTop.y);
+	pose.x = xMmvsp * (point.x - ptTop.x);
+	pose.y = yMmvsp * (point.y - ptTop.y);
+
+	double dx = xMmvsp * (ptBot.x - ptTop.x);
+	double dy = yMmvsp * (ptBot.y - ptTop.y);
+	double dist = sqrt(dx * dx + dy * dy);
+	std::vector<Point2D> vPtOrigine, vPtReal;
+	vPtOrigine.push_back(posTop);
+	vPtOrigine.push_back(posBot);
+
+	Point2D pt;
+	pt.x = 0.0f;
+	pt.y = 0.0f;
+	vPtReal.push_back(pt);
+	pt.x = 0.0f;
+	pt.y = dist;
+	vPtReal.push_back(pt);
+
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtOrigine, vPtReal);
+	Point2D ptResult = ClsVision::CoordinateTransform(pose, affine);
+	Point2I result;
+	if (0 == nType) {
+		result.x = (int)(ptResult.x);
+		result.y = (int)(ptResult.y);
+	}
+	else {
+		result.x = (int)(ptResult.x - vPtReal[1].x);
+		result.y = (int)(ptResult.y - vPtReal[1].y);
+	}
+	return result;
+#endif
+}
+
+bool CSoftVisionApp::transformToStandard(int eDir, Point2I point, Point2I &result, Point2I &topResult, Point2I &botResult) {
+	/* code */
+	topResult.x = 0;
+	topResult.y = 0;
+	botResult.x = 0;
+	botResult.y = 0;
+	result.x = 0;
+	result.y = 0;
+	DimensionDir eCurDir = (DimensionDir)(eDir);
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eCurDir);
+	if (NULL == pSideData) return false;
+
+	//1. 首先计算mark line
+	if (pSideData->m_bTopMark_Find && pSideData->m_bBotMark_Find){    //计算
+		Point2I ptTop = pSideData->getPose(0);
+		Point2I ptBot = pSideData->getPose(1);
+		Point2I bzTop = pSideData->m_mTopBzMark;
+		Point2I bzBot = pSideData->m_mBotBzMark;
+		result = getPointCoor(eCurDir, point, ptTop, ptBot, bzTop, bzBot, 0);
+	}
+
+	//2. 计算 Top Point
+	if (pSideData->m_bTopPoint_Find && pSideData->m_bBotPoint_Find) {    //计算
+		Point2I ptTop = pSideData->getPose(2);
+		Point2I ptBot = pSideData->getPose(3);
+		Point2I bzTop = pSideData->m_mTopBzPoint;
+		Point2I bzBot = pSideData->m_mBotBzPoint;
+		topResult = getPointCoor(eCurDir, point, ptTop, ptBot, bzTop, bzBot, 0);
+	}
+
+	//3. 计算Bot Point
+	if (pSideData->m_bTopPoint_Find && pSideData->m_bBotPoint_Find) {    //计算
+		Point2I ptTop = pSideData->getPose(2);
+		Point2I ptBot = pSideData->getPose(3);
+		Point2I bzTop = pSideData->m_mTopBzPoint;
+		Point2I bzBot = pSideData->m_mBotBzPoint;
+		botResult = getPointCoor(eCurDir, point, ptTop, ptBot, bzTop, bzBot, 1);
+	}
+
+	return true;
+}
+
+bool CSoftVisionApp::findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I& result) {
+	/* code */
+	if (toLineDist > 0) return false;
+	if (nEndThres < 1) return false;
+	DimensionDir eDirReal = (DimensionDir)eDir;
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(eDirReal);
+	if (nullptr == pSideData)  return false;
+	if (!pSideData->m_bTopMark_Find)  return false;
+	if (!pSideData->m_bBotMark_Find)  return false;
+	
+	Point2I ptOffset;
+	ptOffset.x = -1 * toLineDist;
+	ptOffset.y = toTopY;
+	Point2I leftPoint;
+	if (!CVisionBufferPro::TransformToReal(eDirReal, ptOffset, 0, leftPoint))  return false;
+
+	double fzSearchRange = 500.0f;
+	int nSearchRange = (int)(fzSearchRange / pSideData->m_dPixelSizeX);
+	Point2I cutResult;
+	if (!CVisionBufferPro::findCutLine(eDirReal, leftPoint, nSearchRange, nEndThres, cutResult)) return false;
+
+	result = cutResult;
+
+	return true;
+}
+
+double CSoftVisionApp::DistancePL(Point2D pose, Line2D line) {
+	/* code */
+	return ClsVision::DistancePL(pose, line);
+}
+
+int CSoftVisionApp::findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres,
+	int szType, int xFzSize, int yFzSize, CRect* aryResult) {
+	/* code */
+	DimensionDir eCurDir = (DimensionDir)eDir;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eCurDir);
+	if (nullptr == pSideData) return 0;
+
+	int xDefectSize = (int)(1.0f * xFzSize / pSideData->m_dPixelSizeX + 0.5f);
+    int yDefectSize = (int)(1.0f * yFzSize / pSideData->m_dPixelSizeY + 0.5f);
+
+	int nRet = CVisionBufferPro::findNorchDefect(eCurDir, vPoints, roiRect, nThres, nOffset, nBinThres, szType, xDefectSize, yDefectSize, aryResult);
+	return nRet;
+}
+
+int CSoftVisionApp::ExecuteLoc(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isLocUse) return -1;
+
+	CLocProcess *dot = pInstance->getLocProcess(eDir);
+	if (NULL == dot) return -1;
+	dot->execute(eDir);
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteGrind(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isGrindUse) return -1;
+
+	CGrindProcess *dot = pInstance->getGrindProcess(eDir);
+	if (NULL == dot) return -1;
+
+	dot->Execute(eDir);
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteDist(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isDistUse) return -1;
+
+	CKDistProcess *dot = pInstance->getKDistProcess(eDir);
+	if (NULL == dot) return -1;
+
+	//设置平台
+	int nStage = pInstance->getStage();
+	int iValue = 0;
+	if (1 == nStage) iValue = 1;
+	dot->SetStage(iValue);
+
+	dot->Execute(eDir);
+
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteCut(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isCutUse) return -1;
+
+	CCutProcess *dot = pInstance->getCutProcess(eDir);
+	if (NULL == dot) return -1;
+
+	dot->Execute(eDir);
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteRCUT(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isRcutUse) return -1;
+
+	CCornerRcutProcess *dot = pInstance->getCornerRcutProcess(eDir);
+	dot->execute(eDir);
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteThres(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isThresUse) return -1;
+
+	CThresProcess *dot = pInstance->getThresProcess(eDir);
+	dot->execute(eDir);
+
+	return 0;
+}
+
+int CSoftVisionApp::ExecuteHole(DimensionDir eDir) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return -1;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return -1;
+	if (!inf.isHoleUse) return -1;
+
+	CHoleProcess *dot = pInstance->getHoleProcess(eDir);
+	dot->Execute(eDir);
+
+	return 0;
+}
+
+int CSoftVisionApp::getGrindResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isGrindUse) return 0;
+
+	CGrindProcess *dot = pInstance->getGrindProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 50;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CGrindDotProcess *distDot = dot->m_dots[i];
+		if (NULL == distDot) continue;
+		if (1 != distDot->m_nUse) continue;
+
+		int ngNum = (int)(distDot->m_nNgInfo.size());
+		if (ngNum < 1) continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = distDot->m_nNgInfo[j].eDir;
+			ng.eVision = distDot->m_nNgInfo[j].eVision;
+			ng.isRes = distDot->m_nNgInfo[j].isRes;
+			ng.id = distDot->m_nNgInfo[j].id;
+			ng.minValue = distDot->m_nNgInfo[j].minValue;
+			ng.maxValue = distDot->m_nNgInfo[j].maxValue;
+			ng.result = distDot->m_nNgInfo[j].result;
+			ng.xResult = distDot->m_nNgInfo[j].xResult;
+			ng.yResult = distDot->m_nNgInfo[j].yResult;
+			ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl;
+			ng.x1 = distDot->m_nNgInfo[j].x1;
+			ng.y1 = distDot->m_nNgInfo[j].y1;
+			ng.x2 = distDot->m_nNgInfo[j].x2;
+			ng.y2 = distDot->m_nNgInfo[j].y2;
+			ng.ngType = distDot->m_nNgInfo[j].ngType;
+			ng.strName = distDot->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::getDistResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isDistUse) return 0;
+
+	CKDistProcess *dot = pInstance->getKDistProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 50;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CKeyDistDotProcess *distDot = dot->m_dots[i];
+		if (NULL == distDot) continue;
+		if (1 != distDot->m_nUse) continue;
+
+		int ngNum = (int)(distDot->m_nNgInfo.size());
+		if (ngNum < 1) continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if(idx > NG_INF_NUM-1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = distDot->m_nNgInfo[j].eDir;
+			ng.eVision = distDot->m_nNgInfo[j].eVision;
+			ng.isRes = distDot->m_nNgInfo[j].isRes;
+			ng.id = distDot->m_nNgInfo[j].id;
+			ng.minValue = distDot->m_nNgInfo[j].minValue;
+			ng.maxValue = distDot->m_nNgInfo[j].maxValue;
+			ng.result = distDot->m_nNgInfo[j].result;
+			ng.xResult = distDot->m_nNgInfo[j].xResult;
+			ng.yResult = distDot->m_nNgInfo[j].yResult;
+			ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl;
+			ng.x1 = distDot->m_nNgInfo[j].x1;
+			ng.y1 = distDot->m_nNgInfo[j].y1;
+			ng.x2 = distDot->m_nNgInfo[j].x2;
+			ng.y2 = distDot->m_nNgInfo[j].y2;
+			ng.ngType = distDot->m_nNgInfo[j].ngType;
+			ng.strName = distDot->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::getCutResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isCutUse) return 0;
+
+	CCutProcess *dot = pInstance->getCutProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 50;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CCutDotProcess *distDot = dot->m_dots[i];
+		if (NULL == distDot) continue;
+		if (1 != distDot->m_nUse) continue;
+
+		int ngNum = (int)(distDot->m_nNgInfo.size());
+		if (ngNum < 1) continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = distDot->m_nNgInfo[j].eDir;
+			ng.eVision = distDot->m_nNgInfo[j].eVision;
+			ng.isRes = distDot->m_nNgInfo[j].isRes;
+			ng.id = distDot->m_nNgInfo[j].id;
+			ng.minValue = distDot->m_nNgInfo[j].minValue;
+			ng.maxValue = distDot->m_nNgInfo[j].maxValue;
+			ng.result = distDot->m_nNgInfo[j].result;
+			ng.xResult = distDot->m_nNgInfo[j].xResult;
+			ng.yResult = distDot->m_nNgInfo[j].yResult;
+			ng.xPosPxl = distDot->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = distDot->m_nNgInfo[j].yPosPxl;
+			ng.x1 = distDot->m_nNgInfo[j].x1;
+			ng.y1 = distDot->m_nNgInfo[j].y1;
+			ng.x2 = distDot->m_nNgInfo[j].x2;
+			ng.y2 = distDot->m_nNgInfo[j].y2;
+			ng.ngType = distDot->m_nNgInfo[j].ngType;
+			ng.strName = distDot->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::getRcutResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isRcutUse) return 0;
+
+	CCornerRcutProcess *dot = pInstance->getCornerRcutProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 2;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CRcutDotProcess *pRcut = dot->m_dots[i];
+		if (NULL == pRcut) continue;
+		if (1 != pRcut->m_nUse) continue;
+
+		int ngNum = (int)(pRcut->m_nNgInfo.size());
+		if (ngNum < 1)  continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = pRcut->m_nNgInfo[j].eDir;
+			ng.eVision = pRcut->m_nNgInfo[j].eVision;
+			ng.isRes = pRcut->m_nNgInfo[j].isRes;
+			ng.id = pRcut->m_nNgInfo[j].id;
+			ng.minValue = pRcut->m_nNgInfo[j].minValue;
+			ng.maxValue = pRcut->m_nNgInfo[j].maxValue;
+			ng.result = pRcut->m_nNgInfo[j].result;
+			ng.xResult = pRcut->m_nNgInfo[j].xResult;
+			ng.yResult = pRcut->m_nNgInfo[j].yResult;
+			ng.xPosPxl = pRcut->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = pRcut->m_nNgInfo[j].yPosPxl;
+			ng.x1 = pRcut->m_nNgInfo[j].x1;
+			ng.y1 = pRcut->m_nNgInfo[j].y1;
+			ng.x2 = pRcut->m_nNgInfo[j].x2;
+			ng.y2 = pRcut->m_nNgInfo[j].y2;
+			ng.ngType = pRcut->m_nNgInfo[j].ngType;
+			ng.strName = pRcut->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+	
+	return idx;
+}
+
+int CSoftVisionApp::getThresResult(DimensionDir eDir, NgInfo *ngResult) {
+	/* code */
+	CVisionRecipe *pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isThresUse) return 0;
+
+	CThresProcess *dot = pInstance->getThresProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 12;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CThresDotProcess *pThres = dot->m_dots[i];
+		if (NULL == pThres) continue;
+		if (1 != pThres->m_nUse) continue;
+
+		int ngNum = (int)(pThres->m_nNgInfo.size());
+		if (ngNum < 1)  continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = pThres->m_nNgInfo[j].eDir;
+			ng.eVision = pThres->m_nNgInfo[j].eVision;
+			ng.isRes = pThres->m_nNgInfo[j].isRes;
+			ng.id = pThres->m_nNgInfo[j].id;
+			ng.minValue = pThres->m_nNgInfo[j].minValue;
+			ng.maxValue = pThres->m_nNgInfo[j].maxValue;
+			ng.result = pThres->m_nNgInfo[j].result;
+			ng.xResult = pThres->m_nNgInfo[j].xResult;
+			ng.yResult = pThres->m_nNgInfo[j].yResult;
+			ng.xPosPxl = pThres->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = pThres->m_nNgInfo[j].yPosPxl;
+			ng.x1 = pThres->m_nNgInfo[j].x1;
+			ng.y1 = pThres->m_nNgInfo[j].y1;
+			ng.x2 = pThres->m_nNgInfo[j].x2;
+			ng.y2 = pThres->m_nNgInfo[j].y2;
+			ng.ngType = pThres->m_nNgInfo[j].ngType;
+			ng.strName = pThres->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::getHoleResult(DimensionDir eDir, NgInfo* ngResult) {
+	/* code */
+	CVisionRecipe* pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return 0;
+
+	VisionUseInfo inf = pInstance->getVisionUse(eDir);
+	if (!inf.isVisionUse)  return 0;
+	if (!inf.isHoleUse) return 0;
+
+	CHoleProcess* dot = pInstance->getHoleProcess(eDir);
+	if (NULL == dot) return 0;
+
+	int nCount = 4;
+	int idx = 0;
+	for (int i = 0; i < nCount; i++) {
+		CHoleDotProcess* pThres = dot->m_dots[i];
+		if (NULL == pThres) continue;
+		if (1 != pThres->m_nUse) continue;
+
+		int ngNum = (int)(pThres->m_nNgInfo.size());
+		if (ngNum < 1)  continue;
+
+		for (int j = 0; j < ngNum; j++) {
+			if (idx > NG_INF_NUM - 1) continue;    //缺陷数量过大
+			NgInfo ng;
+			ng.eDir = pThres->m_nNgInfo[j].eDir;
+			ng.eVision = pThres->m_nNgInfo[j].eVision;
+			ng.isRes = pThres->m_nNgInfo[j].isRes;
+			ng.id = pThres->m_nNgInfo[j].id;
+			ng.minValue = pThres->m_nNgInfo[j].minValue;
+			ng.maxValue = pThres->m_nNgInfo[j].maxValue;
+			ng.result = pThres->m_nNgInfo[j].result;
+			ng.xResult = pThres->m_nNgInfo[j].xResult;
+			ng.yResult = pThres->m_nNgInfo[j].yResult;
+			ng.xPosPxl = pThres->m_nNgInfo[j].xPosPxl;
+			ng.yPosPxl = pThres->m_nNgInfo[j].yPosPxl;
+			ng.x1 = pThres->m_nNgInfo[j].x1;
+			ng.y1 = pThres->m_nNgInfo[j].y1;
+			ng.x2 = pThres->m_nNgInfo[j].x2;
+			ng.y2 = pThres->m_nNgInfo[j].y2;
+			ng.ngType = pThres->m_nNgInfo[j].ngType;
+			ng.strName = pThres->m_nNgInfo[j].strName;
+			ngResult[idx] = ng;
+			idx += 1;
+		}
+	}
+
+	return idx;
+}
+
+int CSoftVisionApp::addResultToTotal(NgInfo *ngInfo, int nCount, NgInfo *ngTotal, int nTotal) {
+	/* code */
+	int ngRes = nTotal;
+	if (nCount < 1) return ngRes;
+
+	int fzNum = NG_INF_NUM - 1;
+	for (int i = 0; i < nCount; i++) {
+		if (ngRes > fzNum) continue;
+		NgInfo ng = ngInfo[i];
+		ngTotal[ngRes] = ng;
+		ngRes += 1;
+	}
+
+	return ngRes;
+}
+
+void CSoftVisionApp::sendMessage(int code, int eDir) {
+	/* code */
+	if (nullptr == m_pEvent) return;
+	if (NULL == m_pEvent->m_msgRcvCb)  return;
+
+	m_pEvent->m_msgRcvCb(code, eDir);
+}
+
+void CSoftVisionApp::Log(int level, std::string strText) {
+	/* code */
+	if (nullptr == m_pEvent) return;
+	if (NULL == m_pEvent->m_msgLogCb) return;
+
+	Lock();
+	m_pEvent->m_msgLogCb(level, strText);
+	Unlock();
+}
+
+void CSoftVisionApp::setStage(int nStage) {
+	/* code */
+	CVisionRecipe* pInstance = CVisionRecipe::getInstance();
+	if (NULL == pInstance) return;
+
+	pInstance->setStage(nStage);
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/SoftVisionApp.h b/Common_Class/BlVisionPro/Vision/SoftVisionApp.h
new file mode 100644
index 0000000..ba37dd0
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/SoftVisionApp.h
@@ -0,0 +1,107 @@
+#ifndef SOFT_VISION_APP_H
+#define SOFT_VISION_APP_H
+
+#include <iostream>
+#include <stdio.h>
+#include "ISoftVisionApp.h"
+class CSoftVisionApp : public ISoftVisionApp
+{
+public:
+	CSoftVisionApp();
+	~CSoftVisionApp();
+
+	static CSoftVisionApp* getInstance(void);
+
+public:
+	//1. 打开视觉窗体
+	virtual int OpenVisionWindow(void);
+	virtual CDialogEx* CreateVisionWindow(void);
+	virtual int ReleaseWindow(CDialogEx *pDlg);
+	virtual void ChangeDimension(CDialogEx *pDlg, int nDir);
+	virtual void SetVisionOpen(BOOL isOpen);
+
+	//2. 设置屏蔽
+	virtual void OpenKeySetWindow(void);
+
+	//3. 坐标转换
+	virtual Point2I getPose(int eDir, int xPoxPxl, int yPosPxl);
+
+	//4. 执行视觉处理
+	virtual int Execute(int eDir, NgInfo *ngArray);
+	//5. 设置回调时间
+	virtual void setImageEventSignal(IVisionEvent *pEvent);
+	//6. 坐标系转换
+	virtual bool transformToStandard(int eDir, Point2I point, Point2I &result, Point2I &topResult, Point2I &botResult);
+	//7. 检测Cut线
+	virtual bool findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I& result);
+	virtual double DistancePL(Point2D pose, Line2D line);
+
+	//8. 检测Norch缺陷	
+	virtual int findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres,
+		int szType, int xFzSize, int yFzSize, CRect* aryResult);
+
+	//9. 设置平台,0是平台1, 1是平台2
+	virtual void setStage(int nStage);
+
+	//5. 获取距离的结果
+	int getDistResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//6. 获取RCUT的缺陷
+	int getRcutResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//6.1 获取THres结果
+	int getThresResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//6. 获取Hole结果
+	int getHoleResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//7. 获取Grind结果
+	int getGrindResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//8. 获取Cut结果
+	int getCutResult(DimensionDir eDir, NgInfo *ngResult);
+
+	//9 设置回调信息 
+	void sendMessage(int code, int eDir);
+
+	//10. 打印日志
+	void Log(int level, std::string strText);
+
+private:
+	IVisionEvent *m_pEvent;
+	CRITICAL_SECTION m_criticalSection;
+
+private:
+	inline void Lock() { EnterCriticalSection(&m_criticalSection); }
+	inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
+
+	//1. 执行视觉定位
+	int ExecuteLoc(DimensionDir eDir);
+
+	//2. GrendSize
+	int ExecuteGrind(DimensionDir eDir);
+
+	//3. 视觉定位
+	int ExecuteDist(DimensionDir eDir);
+
+	//4. Cut检测
+	int ExecuteCut(DimensionDir eDir);
+
+	//5. RCUT检测
+	int ExecuteRCUT(DimensionDir eDir);
+
+	//6. 视觉检测
+	int ExecuteThres(DimensionDir eDir);
+
+	//7. Hole检测
+    int ExecuteHole(DimensionDir eDir);
+
+	//6. 数据结果合并
+	int addResultToTotal(NgInfo *ngInfo, int nCount, NgInfo *ngTotal, int nTotal);
+
+	//7. 获取距离
+	Point2I getPointCoor(DimensionDir dir, Point2I point, Point2I ptTop, Point2I ptBot,  Point2I bzTopPoint, Point2I bzBotPoint, int nType);
+
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/ThresDotProcess.cpp b/Common_Class/BlVisionPro/Vision/ThresDotProcess.cpp
new file mode 100644
index 0000000..649f7ed
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/ThresDotProcess.cpp
@@ -0,0 +1,444 @@
+#include "stdafx.h"
+#include "ThresDotProcess.h"
+#include "VisionRecipe.h"
+#include "VisionBufferPro.h"
+#include "FileRecipe.h"
+#include "SoftVisionApp.h"
+
+CThresDotProcess::CThresDotProcess(){
+	/* code */
+	m_nUse = 0;
+	m_id = 0;
+	m_strName.Format(_T("Point%d"), m_id);
+
+	m_minThres = 60;
+	m_maxThres = 255;
+
+	m_minSizeX = 50;
+	m_minSizeY = 50;
+	m_eDir = DIMENSION_NONE;
+	m_nPoseX = 0;
+	m_nPoseY = 0;
+	m_width = 0;
+	m_height = 0;
+	m_nSmoothSize = 2;
+	m_poseType = 0;
+}
+
+CThresDotProcess::CThresDotProcess(DimensionDir eDir, int id) {
+	/* code */
+	m_eDir = eDir;
+	m_nUse = 0;
+	m_id = id;
+	switch (eDir) {
+	case GLOBAL_DEFINE::DIMENSION_A:
+		m_strName.Format(_T("TopA_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B:
+		m_strName.Format(_T("TopB_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C:
+		m_strName.Format(_T("TopC_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D:
+		m_strName.Format(_T("TopD_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		m_strName.Format(_T("BotA_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		m_strName.Format(_T("BotB_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		m_strName.Format(_T("BotC_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		m_strName.Format(_T("BotD_T%d"), m_id);
+		break;
+	case GLOBAL_DEFINE::DIMENSION_NONE:
+		m_strName.Format(_T("P_T%d"), m_id);
+		break;
+	default:
+		m_strName.Format(_T("P_T%d"), m_id);
+		break;
+	}
+
+	m_minThres = 60;
+	m_maxThres = 255;
+	m_nSmoothSize = 2;
+
+	m_minSizeX = 50;
+	m_minSizeY = 50;
+	m_nPoseX = 0;
+	m_nPoseY = 0;
+	m_width = 0;
+	m_height = 0;
+	m_poseType = 0;
+}
+
+CThresDotProcess::~CThresDotProcess(){
+	/* code */
+	m_nNgInfo.clear();
+}
+
+bool CThresDotProcess::ExecChip(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (NULL == pSideData)  return false;
+	if (0 == m_poseType) {
+		if (!pSideData->m_bTopMark_Find)  return false;
+		if (!pSideData->m_bBotMark_Find)  return false;
+	}
+	else {
+		if (!pSideData->m_bTopPoint_Find)  return false;
+		if (!pSideData->m_bBotPoint_Find)  return false;
+	}
+
+	int x = 0;
+	int y = 0;
+	int width = 0;
+	int height = 0;
+	getRegion(x, y, width, height);
+
+	int x1 = x;
+	int y1 = y;
+	int x2 = x1 + width - 1;
+	int y2 = y1 + height - 1;
+	m_ptLeftTop.x = x1;
+	m_ptLeftTop.y = y1;
+//	Log_GetDebug()->TraceInfo("Trace ROI: (%d, %d, %d, %d), %d", x1, y1, x2, y2, __LINE__);
+
+	if (nullptr != pSideData) {  //区域的显示结果
+		DispVisionResult inf;
+		inf.nType = 1;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_THRES);
+		inf.rectX1 = x1;
+		inf.rectY1 = y1;
+		inf.rectX2 = x2;
+		inf.rectY2 = y2;
+		inf.showROI = 1;
+		pSideData->m_vDispVisionResult.push_back(inf);
+
+		inf.nType = 4;
+		inf.strName = m_strName;
+		inf.eDir = (int)(m_eDir);
+		inf.eVision = (int)(VISION_THRES);
+		inf.pointX = x1;
+		inf.pointY = y1;
+		inf.showROI = 0;
+		pSideData->m_vDispVisionResult.push_back(inf);
+	}
+
+	HalconCpp::HObject hImage;
+	if (!CVisionBufferPro::getImageROI(eDir, hImage, x1, y1, x2, y2)) return false;
+
+	//HalconCpp::HWindow hDispWin(0, 0, m_width, m_height);
+	//hDispWin.SetPart(0, 0, m_height - 1, m_width - 1);
+	//hDispWin.SetColored(6);
+	//hDispWin.DispObj(hImage);
+	//hDispWin.Click();
+
+
+	int fzX = (int)(m_minSizeX / m_xMmvsp + 0.5f);
+	int fzY = (int)(m_minSizeY / m_yMmvsp + 0.5f);
+
+	HalconCpp::HObject hResultRegion;
+	HalconCpp::GenEmptyObj(&hResultRegion);
+	if (m_minThres > 0) {
+		HalconCpp::HObject hRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hOpenRegion;
+		HalconCpp::Threshold(hImage, &hRegion, 0, m_minThres);
+		if (m_nSmoothSize > 0) {
+			double fSmoothSize = m_nSmoothSize + 0.5;
+			HalconCpp::OpeningCircle(hRegion, &hOpenRegion, fSmoothSize);
+		}
+		else {
+			hOpenRegion = hRegion;
+		}
+		HalconCpp::Connection(hOpenRegion, &hConRegion);
+		HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT);
+		HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT);
+		HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion);
+		HalconCpp::Union1(hConcatRegion, &hResultRegion);
+	}
+
+	if (m_maxThres < 255) {
+		HalconCpp::HObject hRegion, hConRegion, hSelRegionX, hSelRegionY, hConcatRegion, hOpenRegion, hUnionRegion;
+		HalconCpp::Threshold(hImage, &hRegion, m_maxThres, 255);
+		if (m_nSmoothSize > 0) {
+			double fSmoothSize = m_nSmoothSize + 0.5;
+			HalconCpp::OpeningCircle(hRegion, &hOpenRegion, fSmoothSize);
+		}
+		else {
+			hOpenRegion = hRegion;
+		}
+		HalconCpp::Connection(hOpenRegion, &hConRegion);
+		HalconCpp::SelectShape(hConRegion, &hSelRegionX, "width", "and", fzX, MAXINT);
+		HalconCpp::SelectShape(hConRegion, &hSelRegionY, "height", "and", fzY, MAXINT);
+		HalconCpp::ConcatObj(hSelRegionX, hSelRegionY, &hConcatRegion);
+		HalconCpp::Union1(hConcatRegion, &hUnionRegion);
+		HalconCpp::GenEmptyObj(&hResultRegion);
+		hResultRegion.Clear();
+		hResultRegion = hUnionRegion;
+	}
+	
+	HalconCpp::HObject hConRegion;
+	HalconCpp::Connection(hResultRegion, &hConRegion);
+	//hDispWin.DispObj(hConRegion);
+	//hDispWin.Click();
+
+	int nCount = ClsVision::ObjectNumber(hConRegion);
+	if (nCount < 1) return false;
+
+	getResult(hConRegion);
+
+	return true;
+}
+
+void CThresDotProcess::getResult(HalconCpp::HObject &hResultRegion) {
+	/* code */
+	int nCount = ClsVision::ObjectNumber(hResultRegion);
+	if (nCount < 1) return;
+
+	NgDotInfo ng;
+	ng.eDir = m_eDir;
+	ng.id = m_id;
+	ng.isRes = false;
+	ng.minValue = m_minSizeX;
+	ng.maxValue = m_minSizeY;
+	ng.strName = m_strName;
+	ng.ngType = DefectLoc_Chip;   //缺陷类型
+	ng.eVision = VISION_THRES;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	HalconCpp::HTuple hvArea, hvY, hvX;
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::AreaCenter(hResultRegion, &hvArea, &hvY, &hvX);
+	HalconCpp::SmallestRectangle1(hResultRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	for (int i = 0; i < nCount; i++) {
+		ng.result = hvArea[i].I();
+		ng.xResult = (int)(m_xMmvsp * (hvX2[i].I() - hvX1[i].I() + 1));
+		ng.yResult = (int)(m_yMmvsp * (hvY2[i].I() - hvY1[i].I() + 1));
+		ng.xPosPxl = (int)(0.5 * (hvX2[i].I() + hvX1[i].I())) + m_ptLeftTop.x;
+		ng.yPosPxl = (int)(0.5 * (hvY1[i].I() + hvY2[i].I())) + m_ptLeftTop.y;
+		ng.x1 = hvX1[i].I() + m_ptLeftTop.x - 1;
+		ng.y1 = hvY1[i].I() + m_ptLeftTop.y - 1;
+		ng.x2 = hvX2[i].I() + m_ptLeftTop.x + 1;
+		ng.y2 = hvY2[i].I() + m_ptLeftTop.y + 1;
+
+		if (nullptr != pSideData) {  //区域的显示结果
+			DispVisionResult inf;
+			inf.nType = 1;
+			inf.strName = m_strName;
+			inf.eDir = (int)(m_eDir);
+			inf.eVision = (int)(VISION_THRES);
+			inf.rectX1 = ng.x1;
+			inf.rectY1 = ng.y1;
+			inf.rectX2 = ng.x2;
+			inf.rectY2 = ng.y2;
+			inf.showROI = 0;
+			pSideData->m_vDispVisionResult.push_back(inf);
+		}
+
+		m_nNgInfo.push_back(ng);
+	}
+}
+
+void CThresDotProcess::getRegion(int &xPos, int &yPos, int &width, int &height) {
+	/* code */
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	//获取坐标
+	Point2I offset, result;
+	offset.x = m_nPoseX;
+	offset.y = m_nPoseY;
+	if (!CVisionBufferPro::TransformToReal(m_eDir, offset, m_poseType, result)) return;
+
+	xPos = result.x;
+	yPos = result.y;
+	width = (int)(m_width / pSideData->m_dPixelSizeX);
+	height = (int)(m_height / pSideData->m_dPixelSizeY);
+}
+
+void CThresDotProcess::setRegion(int xPos, int yPos, int width, int height) {
+	/* code */
+	//设置图像的ROI区域
+	CBlSideData* pSideData = CVisionRecipe::getInstance()->getSideData(m_eDir);
+	if (nullptr == pSideData) return;
+
+	//设置图像的区域
+	int x1 = xPos;
+	int y1 = yPos;
+	int x2 = xPos + width - 1;
+	int y2 = yPos + height - 1;
+//	Log_GetDebug()->TraceInfo("Trace Set ROI: (%d, %d, %d, %d), %d", x1, y1, x2, y2, __LINE__);
+	Point2I point;
+    point.x = x1;
+	point.y = y1;
+
+	Point2I pose, ptTop, ptBot;
+	if (!CSoftVisionApp::getInstance()->transformToStandard(m_eDir, point, pose, ptTop, ptBot)) return;
+
+	if (0 == m_poseType) {
+		m_nPoseX = pose.x;
+		m_nPoseY = pose.y;
+	}
+	else if (1 == m_poseType) {
+		m_nPoseX = ptTop.x;
+		m_nPoseY = ptTop.y;
+	}
+	else if (2 == m_poseType) {
+		m_nPoseX = ptBot.x;
+		m_nPoseY = ptBot.y;
+	}
+	m_width = (int)(pSideData->m_dPixelSizeX * width);
+	m_height = (int)(pSideData->m_dPixelSizeY * height);
+}
+
+int CThresDotProcess::getID(void) {
+	/* code*/
+	return m_id;
+}
+
+void CThresDotProcess::setID(int id) {
+	/* code */
+	m_id = id;
+}
+
+void CThresDotProcess::getMmvsp(DimensionDir eDir) {
+	/* code */
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	m_xMmvsp = pSideData->m_dPixelSizeX;
+	m_yMmvsp = pSideData->m_dPixelSizeY;
+}
+
+int CThresDotProcess::Execute(DimensionDir eDir, Point2I offset) {
+	/* code */
+	m_nNgInfo.clear();
+	if (1 != m_nUse)  return 0;
+	if (m_width < 1 || m_height < 1) return 0;
+
+	//1. 获取解释度
+	getMmvsp(eDir);
+
+	//2. 执行检测
+	ExecChip(eDir);
+
+	int nRet = (int)(m_nNgInfo.size());
+	return nRet;
+}
+
+Json::Value CThresDotProcess::WriteToJson(void) {
+	/* code */
+	std::string strName = CFileRecipe::toString(m_strName);
+	Json::Value jsValue;
+	jsValue["alg type"] = THRES_VISION_TYPE;
+	jsValue["side"] = (int)(m_eDir);
+	jsValue["id"] = m_id;
+	jsValue["name"] = strName;
+	jsValue["pos x"] = m_nPoseX;
+	jsValue["pos y"] = m_nPoseY;
+	jsValue["width"] = m_width;
+	jsValue["height"] = m_height;
+	jsValue["use"] = m_nUse;
+	jsValue["min thres"] = m_minThres;
+	jsValue["max thres"] = m_maxThres;
+	jsValue["min size x"] = m_minSizeX;
+	jsValue["min size y"] = m_minSizeY;
+	jsValue["smooth size"] = m_nSmoothSize;
+	jsValue["pose type"] = m_poseType;
+
+	return jsValue;
+}
+
+void CThresDotProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)(jsValue.size());
+	if (num < 1) return;
+
+	//1. side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	//2. id
+	strName = "id";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_id = jsValue[strName.c_str()].asInt();
+	}
+
+	//3. name
+	strName = "name";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isString()) {
+		m_strName = CFileRecipe::toCString(jsValue[strName.c_str()].asString());
+	}
+
+	//4. use
+	strName = "use";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nUse = jsValue[strName.c_str()].asInt();
+	}
+
+	//5. pos x
+	strName = "pos x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseX = jsValue[strName.c_str()].asInt();
+	}
+
+	//6. pos y
+	strName = "pos y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nPoseY = jsValue[strName.c_str()].asInt();
+	}
+
+	//8. width
+	strName = "width";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_width = jsValue[strName.c_str()].asInt();
+	}
+
+	//9. height
+	strName = "height";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_height = jsValue[strName.c_str()].asInt();
+	}
+
+	//10. min thres
+	strName = "min thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_minThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//11. min
+	strName = "max thres";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_maxThres = jsValue[strName.c_str()].asInt();
+	}
+
+	//12. min size x
+	strName = "min size x";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_minSizeX = jsValue[strName.c_str()].asInt();
+	}
+
+	//13. min size y
+	strName = "min size y";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_minSizeY = jsValue[strName.c_str()].asInt();
+	}
+
+	//14. smooth size
+	strName = "smooth size";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nSmoothSize = jsValue[strName.c_str()].asInt();
+	}
+
+	//15. smooth size
+	strName = "pose type";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_nSmoothSize = jsValue[strName.c_str()].asInt();
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/ThresDotProcess.h b/Common_Class/BlVisionPro/Vision/ThresDotProcess.h
new file mode 100644
index 0000000..2b500ae
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/ThresDotProcess.h
@@ -0,0 +1,65 @@
+#ifndef THRES_DOT_PROCRSS_H
+#define THRES_DOT_PROCRSS_H
+
+class CThresDotProcess
+{
+public:
+	CThresDotProcess();
+	CThresDotProcess(DimensionDir eDir, int id);
+	~CThresDotProcess();
+
+public:
+	//1. 获取区域
+	void getRegion(int &xPos, int &yPos, int &width, int &height);
+	void setRegion(int xPos, int yPos, int width, int height);
+
+	//2. 获取ID
+	int getID(void);
+	void setID(int id);
+
+	//3. 执行检测
+	int Execute(DimensionDir eDir, Point2I offset);
+
+	//5. 保存文件
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	int m_nUse;
+	CString m_strName;
+
+	int m_poseType;
+	int m_minThres;
+	int m_maxThres;
+	int m_nSmoothSize;
+
+	int m_minSizeX;
+	int m_minSizeY;
+	std::vector<NgDotInfo> m_nNgInfo;
+
+private:
+	int m_id;
+	DimensionDir m_eDir;
+	int m_nPoseX;
+	int m_nPoseY;
+	int m_width;
+	int m_height;
+	Point2I m_ptLeftTop;
+
+	double m_xMmvsp;
+	double m_yMmvsp;
+
+private:
+	//1. 检测
+	bool ExecChip(DimensionDir eDir);
+
+	//2. 获取结果
+	void getResult(HalconCpp::HObject &hResultRegion);
+
+	//3. 获取分辨率
+	void getMmvsp(DimensionDir eDir);
+};
+
+
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/ThresProcess.cpp b/Common_Class/BlVisionPro/Vision/ThresProcess.cpp
new file mode 100644
index 0000000..d5a91b8
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/ThresProcess.cpp
@@ -0,0 +1,103 @@
+#include "stdafx.h"
+#include "ThresProcess.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+
+CThresProcess::CThresProcess(){
+	/* code */
+	for (int i = 0; i < 12; i++) {
+		m_dots[i] = NULL;
+	}
+	m_eDir = DIMENSION_NONE;
+	init();
+}
+
+CThresProcess::CThresProcess(DimensionDir eDir) {
+	/* code */
+	for (int i = 0; i < 12; i++) {
+		m_dots[i] = NULL;
+	}
+	m_eDir = eDir;
+	init();
+}
+
+CThresProcess::~CThresProcess(){
+	/* code */
+	release();
+}
+
+int CThresProcess::init(void) {
+	/* code */
+	release();
+
+	for (int i = 0; i < 12; i++) {
+		m_dots[i] = new CThresDotProcess(m_eDir, i + 1);
+	}
+
+	return 0;
+}
+
+void CThresProcess::release(void) {
+	/* code */
+	int nCount = 12;
+	for (int i = 0; i < nCount; i++) {
+		CThresDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		delete dot;
+		dot = NULL;
+		m_dots[i] = NULL;
+	}
+}
+
+int CThresProcess::execute(DimensionDir eDir) {
+	/* code */
+	if (m_eDir != eDir) return -1;
+
+	int nCount = 12;
+	Point2I offset;
+	for (int i = 0; i < nCount; i++) {
+		CThresDotProcess *dot = m_dots[i];
+		if (NULL == dot) continue;
+		if (1 != dot->m_nUse)  continue;
+
+		offset.x = i;
+		offset.y = i;
+		dot->Execute(m_eDir, offset);
+	}
+
+	return 0;
+}
+
+Json::Value CThresProcess::WriteToJson(void) {
+	/* code */
+	Json::Value jsValue;
+	jsValue["alg type"] = THRES_VISION_PROCESS;
+	jsValue["side"] = (int)(m_eDir);
+
+	for (int i = 0; i < 12; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		jsValue[name.c_str()] = m_dots[i]->WriteToJson();
+	}
+
+	return jsValue;
+}
+
+void CThresProcess::DecodeJson(Json::Value &jsValue) {
+	/* code */
+	int num = (int)jsValue.size();
+	if (num < 1) return;
+
+	//1. Side
+	std::string strName = "side";
+	if (jsValue.isMember(strName.c_str()) && jsValue[strName.c_str()].isInt()) {
+		m_eDir = (DimensionDir)(jsValue[strName.c_str()].asInt());
+	}
+
+	for (int i = 0; i < 12; i++) {
+		std::string name = ClsVision::FormatString("Dot%d", i);
+		if (jsValue.isMember(name.c_str()) && jsValue[name.c_str()].isObject()) {
+			Json::Value jsData = jsValue[name.c_str()];
+			m_dots[i]->DecodeJson(jsData);
+		}
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/ThresProcess.h b/Common_Class/BlVisionPro/Vision/ThresProcess.h
new file mode 100644
index 0000000..1b351d1
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/ThresProcess.h
@@ -0,0 +1,33 @@
+#ifndef THRES_PROCRSS_H
+#define THRES_PROCRSS_H
+
+#include "ThresDotProcess.h"
+
+class CThresProcess
+{
+public:
+	CThresProcess();
+	CThresProcess(DimensionDir eDir);
+	~CThresProcess();
+
+public:
+	//1. 执行
+	int execute(DimensionDir eDir);
+
+	//6. 保存
+	Json::Value WriteToJson(void);
+	void DecodeJson(Json::Value &jsValue);
+
+public:
+	DimensionDir m_eDir;
+	CThresDotProcess *m_dots[12];
+
+private:
+	//1. 初始化
+	int init(void);
+
+	//2. 释放
+	void release(void);
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/TranformCoordinate.cpp b/Common_Class/BlVisionPro/Vision/TranformCoordinate.cpp
new file mode 100644
index 0000000..a6c1118
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/TranformCoordinate.cpp
@@ -0,0 +1,352 @@
+#include "stdafx.h"
+#include "TranformCoordinate.h"
+
+CTranformCoordinate::CTranformCoordinate()
+{
+	/* code */
+}
+
+CTranformCoordinate::~CTranformCoordinate()
+{
+	/* code */
+}
+
+Point2I CTranformCoordinate::Execute(DimensionDir eDir, Point2I pose) {
+	/* code */
+	Point2I ptResult = getPose(eDir, pose);
+
+	Point2I result = TranformPose(eDir, ptResult);
+
+	if (result.x < 0 || result.y < 0) {
+		Print(eDir, pose);
+	}
+
+	return result;
+}
+
+void CTranformCoordinate::Print(DimensionDir eDir, Point2I pose) {
+	/* code */
+	ILogger *pLogger = Log_GetDebug();
+	if (NULL == pLogger) return;
+
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData) return;
+
+	pLogger->TraceInfo("Trace Tf %d: (%d, %d), %d", (int)eDir, pose.x, pose.y, __LINE__);
+	Point2I ptResult = getPose(eDir, pose);
+	pLogger->TraceInfo("Trace Tf %d: (%d, %d), %d", (int)eDir, ptResult.x, ptResult.y, __LINE__);
+
+	for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.begin(); iter++) {
+		pLogger->TraceInfo("Trace Tf %d:  %d, (%d, %d), %d", 
+			(int)eDir, iter->first, 
+			iter->second.nSideLine, iter->second.top, __LINE__);
+	}
+
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	pLogger->TraceInfo("Trace Tf %d: (%d, %d, %d, %d, %d, %d, %d, %d, %d), %d", 
+		(int)eDir, 
+		scanSetting.lengthSize, scanSetting.shortSize, scanSetting.nStdIndex,
+		scanSetting.nIndex0, scanSetting.nIndex1, scanSetting.nIndex2, scanSetting.nIndex3,
+		scanSetting.nLengthScan, scanSetting.nShortScan, 
+		__LINE__);
+}
+
+Point2I CTranformCoordinate::tfPose(DimensionDir eDir, Point2I pose) {
+	/* code */
+	return TranformPose(eDir, pose);
+}
+
+Point2I CTranformCoordinate::TranformPose(DimensionDir eDir, Point2I pose) {
+	/* code */
+	Point2I result = pose;
+	switch (eDir)
+	{
+	case GLOBAL_DEFINE::DIMENSION_A:
+		result = TransformPoseTopA(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_B:
+		result = TransformPoseTopB(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_C:
+		result = TransformPoseTopC(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_D:
+		result = TransformPoseTopD(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_A_DN:
+		result = TransformPoseBotA(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_B_DN:
+		result = TransformPoseBotB(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_C_DN:
+		result = TransformPoseBotC(pose);
+		break;
+
+	case GLOBAL_DEFINE::DIMENSION_D_DN:
+		result = TransformPoseBotD(pose);
+		break;
+
+	default:
+		break;
+	}
+
+	return result;
+}
+
+Point2I CTranformCoordinate::TransformPoseTopA(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex0;
+	if (1 == scanSetting.nLengthScan)  idx0 = scanSetting.nIndex1;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return TransformResult(pose, true, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseTopB(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex2;
+	if (1 == scanSetting.nShortScan)  idx0 = scanSetting.nIndex1;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return  TransformResult(pose, false, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseTopC(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex3;
+	if (1 == scanSetting.nLengthScan)  idx0 = scanSetting.nIndex2;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return TransformResult(pose, true, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseTopD(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex3;
+	if (1 == scanSetting.nShortScan)  idx0 = scanSetting.nIndex0;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return  TransformResult(pose, false, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseBotA(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex0;
+	if (1 == scanSetting.nLengthScan)  idx0 = scanSetting.nIndex1;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return TransformResult(pose, true, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseBotB(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex2;
+	if (1 == scanSetting.nShortScan)  idx0 = scanSetting.nIndex1;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return  TransformResult(pose, false, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseBotC(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex3;
+	if (1 == scanSetting.nLengthScan)  idx0 = scanSetting.nIndex2;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return TransformResult(pose, true, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformPoseBotD(Point2I pose) {
+	/* code */
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	int idx0 = scanSetting.nIndex3;
+	if (1 == scanSetting.nShortScan)  idx0 = scanSetting.nIndex0;
+
+	int idx1 = scanSetting.nStdIndex;
+
+	return  TransformResult(pose, false, idx0, idx1, scanSetting);
+}
+
+Point2I CTranformCoordinate::TransformResult(Point2I pose, bool isScanLength, int idx0, int idx1, ScanSetting scanSetting) {
+	/* code */
+	Point2I result = pose;
+	int id0 = getIndex(idx0, scanSetting);
+	int id1 = getIndex(idx1, scanSetting);
+	if (-1 == id0 || -1 == id1) return result;
+
+	Point2I pt = pose;
+	if (isScanLength) {
+		pt.x = pose.y;
+		pt.y = pose.x;
+	}
+
+	switch (id0){
+	case 0: {
+		if (0 == id1) {
+			result = pt;
+		}
+		else if (1 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = pt.y;
+		}
+		else if (2 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (3 == id1) {
+			result.x = pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		break;
+	}
+
+	case 1: {
+		if (0 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = pt.y;
+		}
+		else if (1 == id1) {
+			result = pt;
+		}
+		else if (2 == id1) {
+			result.x = pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (3 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		break;
+	}
+
+	case 2: {
+		if (0 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (1 == id1) {
+			result.x = pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (2 == id1) {
+			result = pt;
+		}
+		else if (3 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = pt.y;
+		}
+		break;
+	}
+
+	case 3: {
+		if (0 == id1) {
+			result.x = pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (1 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = scanSetting.shortSize - pt.y;
+		}
+		else if (2 == id1) {
+			result.x = scanSetting.lengthSize - pt.x;
+			result.y = pt.y;
+		}
+		else if (3 == id1) {
+			result = pt;
+		}
+		break;
+	}
+
+	default:
+		break;
+	}
+
+	return result;
+}
+
+int CTranformCoordinate::getIndex(int idx, ScanSetting scanSetting) {
+	/* code */
+	int id = -1;
+	if (idx == scanSetting.nIndex0) {
+		id = 0;
+	}
+	else if (idx == scanSetting.nIndex1) {
+		id = 1;
+	}
+	else if (idx == scanSetting.nIndex2) {
+		id = 2;
+	}
+	else if (idx == scanSetting.nIndex3) {
+		id = 3;
+	}
+
+	return id;
+}
+
+Point2I CTranformCoordinate::getPose(DimensionDir eDir, Point2I pose) {
+	/* code */
+	Point2I result = pose;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+
+	int nCount = (int)(pSideData->m_mapSideLineInf.size());
+	if (nCount < 1) return result;
+
+	SideLineInf inf;
+	bool isFind = false;
+	int minDist = MAXINT;
+	int dist = 0;
+	for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.end(); iter++) {
+		if (pose.y < iter->second.top) continue;
+
+		dist = abs(pose.y - iter->second.top);
+		if (dist > minDist) continue;
+
+		inf = iter->second;
+		isFind = true;
+		minDist = dist;
+	}
+
+	if (!isFind) {
+		for (auto iter = pSideData->m_mapSideLineInf.begin(); iter != pSideData->m_mapSideLineInf.end(); iter++) {
+			dist = abs(pose.y - iter->second.top);
+			if (dist > minDist) continue;
+
+			inf = iter->second;
+			isFind = true;
+			minDist = dist;
+		}
+	}
+
+	if (!isFind)  return result;
+
+	result.x = (int)(pSideData->m_dPixelSizeX * (pose.x - inf.nSideLine));
+	result.y = (int)(pSideData->m_dPixelSizeY * (pose.y - pSideData->m_nStartLine));
+
+	ScanSetting scanSetting = CVisionRecipe::getInstance()->getScanSetting();
+	if (result.y > scanSetting.lengthSize) {
+		result.y = scanSetting.lengthSize - (int)(pSideData->m_dPixelSizeY * abs(pSideData->m_nEndLine - pose.y));
+	}
+	
+	return result;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/TranformCoordinate.h b/Common_Class/BlVisionPro/Vision/TranformCoordinate.h
new file mode 100644
index 0000000..aa28dde
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/TranformCoordinate.h
@@ -0,0 +1,62 @@
+#ifndef TRANFORM_COORDINATE_H
+#define TRANFORM_COORDINATE_H
+
+#include "VisionRecipe.h"
+
+class CTranformCoordinate
+{
+public:
+	CTranformCoordinate();
+	~CTranformCoordinate();
+
+public:
+	//1. 执行
+	Point2I Execute(DimensionDir eDir, Point2I pose);
+
+	//2. 获取相对位置
+	Point2I tfPose(DimensionDir eDir, Point2I pose);
+
+private:
+	//1. 获取位置
+	Point2I getPose(DimensionDir eDir, Point2I pose);
+
+	//2. 获取相对位置
+	Point2I TranformPose(DimensionDir eDir, Point2I pose);
+
+	//3. TopA转换
+	Point2I TransformPoseTopA(Point2I pose);
+
+	//4. TopB转换
+	Point2I TransformPoseTopB(Point2I pose);
+
+	//5. TopC转换
+	Point2I TransformPoseTopC(Point2I pose);
+
+	//6. TopD转换
+	Point2I TransformPoseTopD(Point2I pose);
+
+	//7. BotA转换
+	Point2I TransformPoseBotA(Point2I pose);
+
+	//8. BotB转换
+	Point2I TransformPoseBotB(Point2I pose);
+
+	//9. BotC转换
+	Point2I TransformPoseBotC(Point2I pose);
+
+	//10. BotD转换
+	Point2I TransformPoseBotD(Point2I pose);
+
+	//11. 转换
+	Point2I TransformResult(Point2I pose, bool isScanLength, int idx0, int idx1, ScanSetting scanSetting);
+
+	//12. 转换序号
+	int getIndex(int idx, ScanSetting scanSetting);
+
+	//13. 打印数据
+	void Print(DimensionDir eDir, Point2I pose);
+
+
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/Vec.h b/Common_Class/BlVisionPro/Vision/Vec.h
new file mode 100644
index 0000000..f69161d
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/Vec.h
@@ -0,0 +1,463 @@
+#ifndef VEC_H
+#define VEC_H
+
+#undef min
+#undef max
+
+#include <cmath>
+#include <iostream>
+#include <algorithm>
+using namespace std;
+
+// Let gcc optimize conditional branches a bit better...
+#ifndef likely
+#  if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
+#    define likely(x) (x)
+#    define unlikely(x) (x)
+#  else
+#    define likely(x)   (__builtin_expect((x), 1))
+#    define unlikely(x) (__builtin_expect((x), 0))
+#  endif
+#endif
+
+
+// Boost-like compile-time assertion checking
+template <bool X> struct VEC_STATIC_ASSERTION_FAILURE;
+template <> struct VEC_STATIC_ASSERTION_FAILURE<true>
+{
+	void operator () () {}
+};
+#define VEC_STATIC_CHECK(expr) VEC_STATIC_ASSERTION_FAILURE<bool(expr)>()
+
+
+template <int D, class T = float>
+class Vec {
+private:
+	T v[D];
+
+public:
+
+	// Constructor for no arguments.  Everything initialized to 0.
+	Vec() { for (int i = 0; i < D; i++) v[i] = T(0); }
+
+	// Constructors for 2-4 arguments
+	Vec(T x, T y)
+	{
+		VEC_STATIC_CHECK(D == 2); v[0] = x; v[1] = y;
+	}
+	Vec(T x, T y, T z)
+	{
+		VEC_STATIC_CHECK(D == 3); v[0] = x; v[1] = y; v[2] = z;
+	}
+	Vec(T x, T y, T z, T w)
+	{
+		VEC_STATIC_CHECK(D == 4); v[0] = x; v[1] = y; v[2] = z; v[3] = w;
+	}
+
+	// Constructor from anything that can be accessed using []
+	// This one's pretty aggressive, so marked explicit
+	template <class S> explicit Vec(const S &x)
+	{
+		for (int i = 0; i < D; i++) v[i] = T(x[i]);
+	}
+
+	// No destructor or assignment operator needed
+
+	// Array reference and conversion to pointer - no bounds checking
+	const T &operator [] (int i) const
+	{
+		return v[i];
+	}
+	T &operator [] (int i)
+	{
+		return v[i];
+	}
+	operator const T * () const
+	{
+		return v;
+	}
+	operator const T * ()
+	{
+		return v;
+	}
+	operator T * ()
+	{
+		return v;
+	}
+
+	bool operator == (const Vec& d) const { return ((v[0] == d.v[0]) && (v[1] == d.v[1]) && (v[2] == d.v[2])); }
+	bool operator != (const Vec& d) const { return ((v[0] != d.v[0]) || (v[1] != d.v[1]) || (v[2] != d.v[2])); }
+
+	// Member operators
+	Vec<D, T> &operator += (const Vec<D, T> &x)
+	{
+		for (int i = 0; i < D; i++) v[i] += x[i];  return *this;
+	}
+	Vec<D, T> &operator -= (const Vec<D, T> &x)
+	{
+		for (int i = 0; i < D; i++) v[i] -= x[i];  return *this;
+	}
+	Vec<D, T> &operator *= (const Vec<D, T> &x)
+	{
+		for (int i = 0; i < D; i++) v[i] *= x[i];  return *this;
+	}
+	Vec<D, T> &operator *= (const T &x)
+	{
+		for (int i = 0; i < D; i++) v[i] *= x;     return *this;
+	}
+	Vec<D, T> &operator /= (const Vec<D, T> &x)
+	{
+		for (int i = 0; i < D; i++) v[i] /= x[i];  return *this;
+	}
+	Vec<D, T> &operator /= (const T &x)
+	{
+		for (int i = 0; i < D; i++) v[i] /= x;     return *this;
+	}
+
+	// Outside of class: + - * / % ^ << >>
+
+	// Some partial compatibility with valarrays and vectors
+	typedef T value_type;
+	size_t size() const
+	{
+		return D;
+	}
+	T sum() const
+	{
+		T total = v[0];
+		for (int i = 1; i < D; i++) total += v[i];
+		return total;
+	}
+	T avg() const
+	{
+		return sum() / D;
+	}
+	T product() const
+	{
+		T total = v[0];
+		for (int i = 1; i < D; i++) total *= v[i];
+		return total;
+	}
+	T min() const
+	{
+		T m = v[0];
+		for (int i = 0; i < D; i++)
+			if (v[i] < m)  m = v[i];
+		return m;
+	}
+	T max() const
+	{
+		T m = v[0];
+		for (int i = 1; i < D; i++)
+			if (v[i] > m)  m = v[i];
+		return m;
+	}
+	T *begin() { return &(v[0]); }
+	const T *begin() const { return &(v[0]); }
+	T *end() { return begin() + D; }
+	const T *end() const { return begin() + D; }
+	void clear() { for (int i = 0; i < D; i++) v[i] = T(0); }
+	bool empty() const
+	{
+		for (int i = 0; i < D; i++)
+			if (v[i]) return false;
+		return true;
+	}
+};
+
+typedef Vec<3, float> vec;
+typedef Vec<3, float> point;
+typedef Vec<2, float> vec2;
+typedef Vec<3, float> vec3;
+typedef Vec<4, float> vec4;
+typedef Vec<2, int> ivec2;
+typedef Vec<3, int> ivec3;
+typedef Vec<4, int> ivec4;
+
+
+// Nonmember operators that take two Vecs
+template <int D, class T>
+static inline const Vec<D, T> operator + (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return Vec<D, T>(v1) += v2;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator - (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return Vec<D, T>(v1) -= v2;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator * (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return Vec<D, T>(v1) *= v2;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator / (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return Vec<D, T>(v1) /= v2;
+}
+
+template <int D, class T>
+static inline const T operator ^ (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	T sum = v1[0] * v2[0];
+	for (int i = 1; i < D; i++)
+		sum += v1[i] * v2[i];
+	return sum;
+}
+#define DOT ^
+
+template <class T>
+static inline const Vec<3, T> operator % (const Vec<3, T> &v1, const Vec<3, T> &v2)
+{
+	return Vec<3, T>(v1[1] * v2[2] - v1[2] * v2[1],
+		v1[2] * v2[0] - v1[0] * v2[2],
+		v1[0] * v2[1] - v1[1] * v2[0]);
+}
+#define CROSS %
+
+
+// Component-wise equality and inequality (#include the usual caveats
+// about comparing floats for equality...)
+template <int D, class T>
+static inline bool operator == (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	for (int i = 0; i < D; i++)
+		if (v1[i] != v2[i])
+			return false;
+	return true;
+}
+
+template <int D, class T>
+static inline bool operator != (const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	for (int i = 0; i < D; i++)
+		if (v1[i] != v2[i])
+			return true;
+	return false;
+}
+
+
+// Unary operators
+template <int D, class T>
+static inline const Vec<D, T> &operator + (const Vec<D, T> &v)
+{
+	return v;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator - (const Vec<D, T> &v)
+{
+	Vec<D, T> result(v);
+	for (int i = 0; i < D; i++)
+		result[i] = -result[i];
+	return result;
+}
+
+template <int D, class T>
+static inline bool operator ! (const Vec<D, T> &v)
+{
+	return v.empty();
+}
+
+
+// Vec/scalar operators
+template <int D, class T>
+static inline const Vec<D, T> operator * (const T &x, const Vec<D, T> &v)
+{
+	Vec<D, T> result(v);
+	for (int i = 0; i < D; i++)
+		result[i] = x * result[i];
+	return result;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator * (const Vec<D, T> &v, const T &x)
+{
+	return Vec<D, T>(v) *= x;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator / (const T &x, const Vec<D, T> &v)
+{
+	Vec<D, T> result(v);
+	for (int i = 0; i < D; i++)
+		result[i] = x / result[i];
+	return result;
+}
+
+template <int D, class T>
+static inline const Vec<D, T> operator / (const Vec<D, T> &v, const T &x)
+{
+	return Vec<D, T>(v) /= x;
+}
+
+
+// iostream operators
+template <int D, class T>
+static inline std::ostream &operator << (std::ostream &os, const Vec<D, T> &v)
+
+{
+	os << "(";
+	for (int i = 0; i < D - 1; i++)
+		os << v[i] << ", ";
+	return os << v[D - 1] << ")";
+}
+
+template <int D, class T>
+static inline std::istream &operator >> (std::istream &is, Vec<D, T> &v)
+{
+	char c1 = 0, c2 = 0;
+
+	is >> c1;
+	if (c1 == '(' || c1 == '[') {
+		is >> v[0] >> std::ws >> c2;
+		for (int i = 1; i < D; i++) {
+			if (c2 == ',')
+				is >> v[i] >> std::ws >> c2;
+			else
+				is.setstate(std::ios::failbit);
+		}
+	}
+
+	if (c1 == '(' && c2 != ')')
+		is.setstate(std::ios::failbit);
+	else if (c1 == '[' && c2 != ']')
+		is.setstate(std::ios::failbit);
+
+	return is;
+}
+
+
+// Utility functions for square and cube, to go along with sqrt and cbrt
+template <class T>
+static inline T sqr(const T &x)
+{
+	return x*x;
+}
+
+template <class T>
+static inline T cube(const T &x)
+{
+	return x*x*x;
+}
+
+
+// Utility functions based on GLSL
+template <class T>
+static inline T fract(const T &x)
+{
+	return x - floor(x);
+}
+
+template <class T>
+static inline T clamp(const T &x, const T &a, const T &b)
+{
+	return x > a ? x < b ? x : b : a;  // returns a on NaN
+}
+
+template <class T, class S>
+static inline T mix(const T &x, const T &y, const S &a)
+{
+	return (S(1) - a) * x + a * y;
+}
+
+template <class T>
+static inline T step(const T &x, const T &a)
+{
+	return x < a ? T(0) : T(1);
+}
+
+template <class T>
+static inline T smoothstep(const T &x, const T &a, const T &b)
+{
+	if (b <= a) return step(x, a);
+	T t = (x - a) / (b - a);
+	return t <= T(0) ? T(0) : t >= T(1) ? T(1) : t * t * (T(3) - T(2) * t);
+}
+
+// Area-weighted triangle face normal
+template <class T>
+static inline T trinorm(const T &v0, const T &v1, const T &v2)
+{
+	return (typename T::value_type) 0.5 * ((v1 - v0) CROSS(v2 - v0));
+}
+
+// Sign of a scalar
+template <class T>
+static inline T sgn(const T &x)
+{
+	return (x < T(0)) ? T(-1) : T(1);
+}
+
+
+// Functions on Vecs
+template <int D, class T>
+static inline const T len2(const Vec<D, T> &v)
+{
+	T l2 = v[0] * v[0];
+	for (int i = 1; i < D; i++)
+		l2 += v[i] * v[i];
+	return l2;
+}
+
+template <int D, class T>
+static inline const T len(const Vec<D, T> &v)
+{
+	return sqrt(len2(v));
+}
+
+template <int D, class T>
+static inline const T dist2(const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	T d2 = sqr(v2[0] - v1[0]);
+	for (int i = 1; i < D; i++)
+		d2 += sqr(v2[i] - v1[i]);
+	return d2;
+}
+
+template <int D, class T>
+static inline const T dist(const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	return sqrt(dist2(v1, v2));
+}
+
+template <int D, class T>
+static inline Vec<D, T> normalize(Vec<D, T> &v)
+{
+	T l = len(v);
+	if (unlikely(l <= T(0))) {
+		v[0] = T(1);
+		for (int i = 1; i < D; i++)
+			v[i] = T(0);
+		return v;
+	}
+
+	l = T(1) / l;
+	for (int i = 0; i < D; i++)
+		v[i] *= l;
+
+	return v;
+}
+
+template <int D, class T>
+static inline void swap(const Vec<D, T> &v1, const Vec<D, T> &v2)
+{
+	for (int i = 0; i < D; i++)
+		swap(v1[i], v2[i]);
+}
+
+template <int D, class T>
+static inline Vec<D, T> fabs(const Vec<D, T> &v)
+{
+	Vec<D, T> result(v);
+	for (int i = 0; i < D; i++)
+		if (result[i] < T(0))
+			result[i] = -result[i];
+	return result;
+}
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/VisionBufferPro.cpp b/Common_Class/BlVisionPro/Vision/VisionBufferPro.cpp
new file mode 100644
index 0000000..929e82a
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/VisionBufferPro.cpp
@@ -0,0 +1,1337 @@
+#include "stdafx.h"
+#include "VisionBufferPro.h"
+#include "Bspline.h"
+
+#define  DEFAULTT_IMAGE_HEIGHT     100000
+
+CVisionBufferPro::CVisionBufferPro()
+{
+}
+
+CVisionBufferPro::~CVisionBufferPro(){
+	/* code */
+}
+
+bool CVisionBufferPro::bufferToObject(DimensionDir eDir, int height, HalconCpp::HObject &hImage) {
+	/* code */
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	int iCam = pRecipe->getCameraIndex(eDir);
+	int iScan = pRecipe->getCameraScan(eDir);
+	CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam);
+	if (NULL == pGrabCtrl) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer();
+	if (nullptr == pBuffer) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+	CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer();
+	if (NULL == pMultBuffer) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	int nFrameWidth = pMultBuffer->GetFrameWidth();
+	int nFrameHeight = pMultBuffer->GetFrameHeight();
+	int nFrameCount = pMultBuffer->GetFrameCount();
+	int nTotalLength = nFrameHeight * nFrameCount;
+	if (nTotalLength < 1){
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	try{
+		int imgWidth = nFrameWidth;
+		int imgHeight = nTotalLength;
+		if (imgHeight > DEFAULTT_IMAGE_HEIGHT) {
+			imgHeight = DEFAULTT_IMAGE_HEIGHT;
+		}
+		if (height > 0) {
+			if (imgHeight > height) {
+				imgHeight = height;
+			}
+		}
+
+		//图像转换
+		uchar *imgData = new uchar[imgWidth * imgHeight];
+		BYTE *lpImg = pBuffer->GetMultiBuffData(iScan);
+		std::memcpy(imgData, lpImg, imgWidth * imgHeight);
+		HalconCpp::GenImage1(&hImage, "byte", imgWidth, imgHeight, (Hlong)(imgData));
+		delete[] imgData;
+		imgData = NULL;
+
+		return true;
+	}
+	catch (...)
+	{
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+}
+
+bool CVisionBufferPro::getImageROI(DimensionDir eDir, HalconCpp::HObject &hImage, int x1, int y1, int x2, int y2) {
+	/* code */
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	int iCam = pRecipe->getCameraIndex(eDir);
+	int iScan = pRecipe->getCameraScan(eDir);
+	CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam);
+	if (NULL == pGrabCtrl) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer();
+	if (nullptr == pBuffer) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+	CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer();
+	if (NULL == pMultBuffer) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	int nFrameWidth = pMultBuffer->GetFrameWidth();
+	int nFrameHeight = pMultBuffer->GetFrameHeight();
+	int nFrameCount = pMultBuffer->GetFrameCount();
+	int nTotalLength = nFrameWidth * nFrameHeight * nFrameCount;
+	if (nTotalLength < 1) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	if (x1 < 0 || y1 < 0 || x2 > nFrameWidth - 1 || y2 > nTotalLength - 1) {
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+
+	try{
+		int imgWidth = x2 - x1 + 1;
+		int imgHeight = y2 - y1 + 1;
+		if (imgWidth < 1 || imgHeight < 1) {
+			ClsVision::GenEmptyObject(hImage);
+			return false;
+		}
+
+		//图像转换
+		uchar *imgData = new uchar[imgWidth * imgHeight];
+		BYTE *lpImg = pBuffer->GetMultiBuffData(iScan);
+
+		for (int i = y1; i <= y2; i++) {
+			std::memcpy(imgData + (i - y1) * imgWidth, lpImg + (i * nFrameWidth) + x1, imgWidth);
+		}
+
+
+		HalconCpp::GenImage1(&hImage, "byte", imgWidth, imgHeight, (Hlong)(imgData));
+		delete[] imgData;
+		imgData = NULL;
+
+		return true;
+	}
+	catch (...)
+	{
+		ClsVision::GenEmptyObject(hImage);
+		return false;
+	}
+}
+
+bool CVisionBufferPro::getIndexImage(DimensionDir eDir, HalconCpp::HObject *hImage, int index) {
+	/* code */
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	int iCam = pRecipe->getCameraIndex(eDir);
+	int iScan = pRecipe->getCameraScan(eDir);
+	CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam);
+	if (NULL == pGrabCtrl) {
+		HalconCpp::GenEmptyObj(hImage);
+		return false;
+	}
+
+	CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer();
+	if (nullptr == pBuffer) {
+		HalconCpp::GenEmptyObj(hImage);
+		return false;
+	}
+	CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer();
+	if (NULL == pMultBuffer) {
+		HalconCpp::GenEmptyObj(hImage);
+		return false;
+	}
+	int nFrameHeight = pMultBuffer->GetFrameHeight();
+	int nFrameWidth = pMultBuffer->GetFrameWidth();
+	if (nFrameHeight < 1 || nFrameWidth < 1) {
+		HalconCpp::GenEmptyObj(hImage);
+		return false;
+	}
+
+	int x1 = 0;
+	int x2 = nFrameWidth - 1;
+	int y1 = index * nFrameHeight;
+	int y2 = index * nFrameHeight + nFrameHeight - 1;
+
+	return getImageROI(eDir, *hImage, x1, y1, x2, y2);
+}
+
+void CVisionBufferPro::getLineFrameSize(DimensionDir eDir, int &nFrameWidth, int &nFrameHeight) {
+	/* code */
+	// 设置帧宽和高度为-1
+	nFrameWidth = -1;
+	nFrameHeight = -1;
+	// 获取CVisionRecipe实例
+	CVisionRecipe *pRecipe = CVisionRecipe::getInstance();
+	// 获取指定方向下的相机索引
+	int iCam = pRecipe->getCameraIndex(eDir);
+	// 获取指定方向下的相机扫描方向
+	int iScan = pRecipe->getCameraScan(eDir);
+	// 获取指定相机下的CGrabberControl实例
+	CGrabberControl *pGrabCtrl = pRecipe->getGrabberControl(iCam);
+	// 如果pGrabCtrl为空,则返回
+	if (NULL == pGrabCtrl) return;
+
+	// 获取CFrameBufferController实例
+	CFrameBufferController *pBuffer = pGrabCtrl->GetFrameBuffer();
+	// 如果pBuffer为空,则返回
+	if (nullptr == pBuffer) return;
+	// 获取CMultiBuffer实例
+	CMultiBuffer *pMultBuffer = pBuffer->GetMultiBuffer();
+	// 如果pMultBuffer为空,则返回
+	if (NULL == pMultBuffer)return;
+
+	// 获取帧高度
+	nFrameHeight = pMultBuffer->GetFrameHeight();
+	// 获取帧宽度
+	nFrameWidth = pMultBuffer->GetFrameWidth();
+}
+
+bool CVisionBufferPro::GetMeasurePos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int step, Point2D &ptStart, Point2D &ptEnd) {
+	/* code */
+	if (!ClsVision::ObjectExist(hObject))  return false;
+
+	try {
+		HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0;
+		LineRowStart_Measure_01_0 = line.pt0.y;
+		LineColumnStart_Measure_01_0 = line.pt0.x;
+		LineRowEnd_Measure_01_0 = line.pt1.y;
+		LineColumnEnd_Measure_01_0 = line.pt1.x;
+
+		HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2;
+		TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0);
+		TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0);
+		TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0;
+		TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0;
+
+		HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi);
+
+		HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1);
+		TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1;
+		TmpCtrl_Len2 = 0.5 * step;
+
+		HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0;
+		HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight);
+
+		HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple  Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0;
+		std::string strMode = "all";
+		if (0 == modeTrans) {
+			strMode = "all";
+		}
+		else if (1 == modeTrans) {
+			strMode = "positive";
+		}
+		else if (2 == modeTrans) {
+			strMode = "negative";
+		}
+		HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0);
+		HalconCpp::CloseMeasure(MsrHandle_Measure_01_0);
+
+		bool result = false;
+		HalconCpp::HTuple hvLenth;
+		HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth);
+		int iCount = hvLenth[0].I();
+		if (iCount > 0) {
+			double dx = abs(line.pt0.x - line.pt1.x);
+			bool isInit = false;
+
+			Point2D pt;
+			if (dx > 1.0f) {
+				for (int i = 0; i < iCount; i++) {
+					pt.x = Column_Measure_01_0[i].D();
+					pt.y = Row_Measure_01_0[i].D();
+					if (!isInit) {
+						ptStart.x = Column_Measure_01_0[i].D();
+						ptStart.y = Row_Measure_01_0[i].D();
+						ptEnd.x = Column_Measure_01_0[i].D();
+						ptEnd.y = Row_Measure_01_0[i].D();
+						isInit = true;
+					}
+
+					result = true;
+					if (pt.x < ptStart.x)  ptStart = pt;
+					if (pt.x > ptEnd.x)    ptEnd = pt;
+				}
+			}
+			else {
+				for (int i = 0; i < iCount; i++) {
+					pt.x = Column_Measure_01_0[i].D();
+					pt.y = Row_Measure_01_0[i].D();
+					if (!isInit) {
+						ptStart.x = Column_Measure_01_0[i].D();
+						ptStart.y = Row_Measure_01_0[i].D();
+						ptEnd.x = Column_Measure_01_0[i].D();
+						ptEnd.y = Row_Measure_01_0[i].D();
+						isInit = true;
+					}
+
+					result = true;
+					if (pt.y < ptStart.y)  ptStart = pt;
+					if (pt.y > ptEnd.y)    ptEnd = pt;
+				}
+			}
+		}
+		return result;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::GetMeasureNearPos(HalconCpp::HObject& hObject, Line2D line, int threshold, int modeTrans, int step, Point2D& ptStart, Point2D& ptEnd) {
+	/* code */
+	if (!ClsVision::ObjectExist(hObject))  return false;
+
+	try {
+		HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0;
+		LineRowStart_Measure_01_0 = line.pt0.y;
+		LineColumnStart_Measure_01_0 = line.pt0.x;
+		LineRowEnd_Measure_01_0 = line.pt1.y;
+		LineColumnEnd_Measure_01_0 = line.pt1.x;
+
+		HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2;
+		TmpCtrl_Row = 0.5 * (LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0);
+		TmpCtrl_Column = 0.5 * (LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0);
+		TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0;
+		TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0;
+
+		HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi);
+
+		HalconCpp::TupleSqrt(TmpCtrl_Dr * TmpCtrl_Dr + TmpCtrl_Dc * TmpCtrl_Dc, &TmpCtrl_Len1);
+		TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1;
+		TmpCtrl_Len2 = 0.5 * step;
+
+		HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0;
+		HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight);
+
+		HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple  Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0;
+		std::string strMode = "all";
+		if (0 == modeTrans) {
+			strMode = "all";
+		}
+		else if (1 == modeTrans) {
+			strMode = "positive";
+		}
+		else if (2 == modeTrans) {
+			strMode = "negative";
+		}
+		HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0);
+		HalconCpp::CloseMeasure(MsrHandle_Measure_01_0);
+
+		bool result = false;
+		HalconCpp::HTuple hvLenth;
+		HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth);
+		int iCount = hvLenth[0].I();
+		if (iCount > 0) {
+			ptStart.x = Column_Measure_01_0[0].D();
+			ptStart.y = Row_Measure_01_0[0].D();
+
+			if (1 == iCount) {
+				ptEnd = ptStart;
+				return true;
+			}
+
+			ptEnd.x = Column_Measure_01_0[1].D();
+			ptEnd.y = Row_Measure_01_0[1].D();
+			result = true;
+		}
+
+		return result;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::GetMeasureRCutPos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int chamberSize, double proDist, Point2D &ptStart, Point2D &ptEnd) {
+	/* code */
+	if (!ClsVision::ObjectExist(hObject))  return false;
+
+	try {
+		HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0;
+		LineRowStart_Measure_01_0 = line.pt0.y;
+		LineColumnStart_Measure_01_0 = line.pt0.x;
+		LineRowEnd_Measure_01_0 = line.pt1.y;
+		LineColumnEnd_Measure_01_0 = line.pt1.x;
+
+		HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2;
+		TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0);
+		TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0);
+		TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0;
+		TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0;
+
+		TmpCtrl_Phi = TmpCtrl_Dr.TupleAtan2(TmpCtrl_Dc);
+
+		HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1);
+		TmpCtrl_Len1 = 0.5 * (((TmpCtrl_Dr * TmpCtrl_Dr) + (TmpCtrl_Dc * TmpCtrl_Dc)).TupleSqrt()); 
+		TmpCtrl_Len2 = 5.0f;
+
+		HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0;
+		HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight);
+
+		HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple  Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0;
+		std::string strMode = "all";
+		if (0 == modeTrans) {
+			strMode = "all";
+		}
+		else if (1 == modeTrans) {
+			strMode = "positive";
+		}
+		else if (2 == modeTrans) {
+			strMode = "negative";
+		}
+		HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", 
+			&Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0);
+		HalconCpp::CloseMeasure(MsrHandle_Measure_01_0);
+
+		double fzMinDist = 0.25 * chamberSize;
+		if (proDist > 1.0f) {
+			double temp = 0.8 * proDist;
+			if (temp > fzMinDist) {
+				fzMinDist = temp;
+			}
+		}
+		if (fzMinDist < 8.0f) fzMinDist = 8.0f;
+
+		HalconCpp::HTuple hvLenth = Row_Measure_01_0.TupleLength();
+		int sz = hvLenth[0].I();
+		if (sz < 1) return false;
+		if (Amplitude_Measure_01_0[0].D() > 0) return false;
+		ptStart.x = Column_Measure_01_0[0].D();
+		ptStart.y = Row_Measure_01_0[0].D();
+
+		bool isFind = false;
+		double dist = 0.0f; 
+		if (sz > 1) {
+			for (int i = 1; i < sz; i++) {
+				if (Amplitude_Measure_01_0[i].D() < 0.0f) {
+					dist += Distance_Measure_01_0[i - 1].D();
+					continue;
+				}
+				ptEnd.x = Column_Measure_01_0[i].D();
+				ptEnd.y = Row_Measure_01_0[i].D();
+				dist += Distance_Measure_01_0[i - 1].D();
+				if (dist > fzMinDist && dist < chamberSize) {
+					isFind = true;
+					break;
+				}
+
+				if (dist > chamberSize) {
+					break;
+				}
+			}
+		}
+
+		if ((!isFind) && proDist > 1.0f) {
+			dist = ClsVision::DistancePP(ptStart, line.pt1);
+			Point2D pose;
+			std::vector<Point2D> vPtStd, vPtReal;
+			pose.x = 0.0f;
+			pose.y = 0.0f;
+			vPtStd.push_back(pose);
+			pose.x = dist;
+			pose.y = 0.0f;
+			vPtStd.push_back(pose);
+			vPtReal.push_back(ptStart);
+			vPtReal.push_back(line.pt1);
+
+			ParaAffine2D affine = ClsVision::VectorToRigid(vPtStd, vPtReal);
+			pose.x = proDist;
+			pose.y = 0.0f;
+			ptEnd = ClsVision::CoordinateTransform(pose, affine);
+			isFind = true;
+		}
+
+		return isFind;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::GetMeasurePosKeyLimit(HalconCpp::HObject &hObject, Line2D line, int nTypePoint, int threshold, int modeTrans, int step, int distLimit, Point2D &ptStart, Point2D &ptEnd) {
+	/* code */
+	if (!ClsVision::ObjectExist(hObject))  return false;
+
+	try {
+		HalconCpp::HTuple LineRowStart_Measure_01_0, LineColumnStart_Measure_01_0, LineRowEnd_Measure_01_0, LineColumnEnd_Measure_01_0;
+		LineRowStart_Measure_01_0 = line.pt0.y;
+		LineColumnStart_Measure_01_0 = line.pt0.x;
+		LineRowEnd_Measure_01_0 = line.pt1.y;
+		LineColumnEnd_Measure_01_0 = line.pt1.x;
+
+		HalconCpp::HTuple TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Dr, TmpCtrl_Dc, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2;
+		TmpCtrl_Row = 0.5*(LineRowStart_Measure_01_0 + LineRowEnd_Measure_01_0);
+		TmpCtrl_Column = 0.5*(LineColumnStart_Measure_01_0 + LineColumnEnd_Measure_01_0);
+		TmpCtrl_Dr = LineRowStart_Measure_01_0 - LineRowEnd_Measure_01_0;
+		TmpCtrl_Dc = LineColumnEnd_Measure_01_0 - LineColumnStart_Measure_01_0;
+		HalconCpp::TupleAtan2(TmpCtrl_Dr, TmpCtrl_Dc, &TmpCtrl_Phi);
+		HalconCpp::TupleSqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc, &TmpCtrl_Len1);
+		TmpCtrl_Len1 = 0.5 * TmpCtrl_Len1;
+		TmpCtrl_Len2 = 0.5 * step;
+
+		HalconCpp::HTuple hvWidth, hvHeight, MsrHandle_Measure_01_0;
+		HalconCpp::GetImageSize(hObject, &hvWidth, &hvHeight);
+
+		HalconCpp::GenMeasureRectangle2(TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, hvWidth, hvHeight, "nearest_neighbor", &MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple  Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0;
+		std::string strMode = "all";
+		if (0 == modeTrans) {
+			strMode = "all";
+		}
+		else if (1 == modeTrans) {
+			strMode = "positive";
+		}
+		else if (2 == modeTrans) {
+			strMode = "negative";
+		}
+		HalconCpp::MeasurePos(hObject, MsrHandle_Measure_01_0, 1, threshold, strMode.c_str(), "all", &Row_Measure_01_0, &Column_Measure_01_0, &Amplitude_Measure_01_0, &Distance_Measure_01_0);
+		HalconCpp::CloseMeasure(MsrHandle_Measure_01_0);
+
+		HalconCpp::HTuple hvLenth;
+		HalconCpp::TupleLength(Row_Measure_01_0, &hvLenth);
+		int nCount = hvLenth[0].I();
+		if (nCount < 1) return false;
+
+		ptStart.x = Column_Measure_01_0[0].D();
+		ptStart.y = Row_Measure_01_0[0].D();
+		ptEnd.x = Column_Measure_01_0[nCount - 1].D();
+		ptEnd.y = Row_Measure_01_0[nCount - 1].D();
+
+		Point2D point;
+		if (0 == nTypePoint) {
+			point = ptStart;
+		}
+		else {
+			point = ptEnd;
+		}
+
+		int idx = -1;
+		double maxDist = MININT;
+		Point2D pt;
+		for (int i = 0; i < nCount; i++) {
+			pt.x = Column_Measure_01_0[i].D();
+			pt.y = Row_Measure_01_0[i].D();
+			double dx = pt.x - point.x;
+			double dy = pt.y - point.y;
+			double dist = sqrt(dx * dx + dy * dy);
+			if (dist < distLimit && dist > maxDist) {
+				maxDist = dist;
+				idx = i;
+			}
+		}
+		if (idx < 0) return false;
+
+		point.x = Column_Measure_01_0[idx].D();
+		point.y = Row_Measure_01_0[idx].D();
+		if (0 == nTypePoint) {
+			ptStart = point;
+		}
+		else {
+			ptEnd = point;
+		}
+
+		return true;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &result, int &xPosPxl, int &yPosPxl) {
+	/* code */
+	xPosPxl = 0;
+	yPosPxl = 0;
+	result = 0.0f;
+	CCornerDistProcess *dotCorner = CVisionRecipe::getInstance()->getCornerDistProcess(eDir);
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData)  return true;
+	if (NULL == dotCorner) return true;
+	if (NULL == dot) return true;
+	
+
+	Point2D locResult = dot->m_ptMatchResult;
+	Point2D measureResult = dot->m_ptMeasureResult;
+	Point2D nearResult = dot->m_ptNearResult;
+
+	xPosPxl = dot->m_locPointResult.x;
+	yPosPxl = dot->m_locPointResult.y;
+
+	int distMode = dot->m_distMode;
+	if (0 == distMode) {
+		double dx = measureResult.x - nearResult.x;
+		result = fabs(pSideData->m_dPixelSizeX * dx);
+	}
+	else if (1 == distMode) {
+		Point2I topMark = pSideData->getPose(0);
+		Point2I botMark = pSideData->getPose(1);
+
+		Line2D line1, line2;
+		line1.pt0.x = topMark.x;
+		line1.pt0.y = topMark.y;
+		line1.pt1.x = botMark.x;
+		line1.pt1.y = botMark.y;
+
+		line2.pt0.x = measureResult.x;
+		line2.pt0.y = measureResult.y;
+		line2.pt1.x = measureResult.x + 1000.0f;
+		line2.pt1.y = measureResult.y;
+
+		Point2D pose = ClsVision::LineIntersection(line1, line2);
+		double dx = measureResult.x - pose.x;
+		result = fabs(pSideData->m_dPixelSizeX * dx);
+	}
+	else if (2 == distMode) {
+		Point2I pose = pSideData->getPose(0);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (3 == distMode) {
+		Point2I pose = pSideData->getPose(1);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (4 == distMode) {
+		Point2I pose = pSideData->getPose(2);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (5 == distMode) {
+		Point2I pose = pSideData->getPose(3);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (6 == distMode) {
+		Point2D pose = nearResult;
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+	else if (7 == distMode) {
+		Point2D pose = locResult;
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		result = sqrt(dx * dx + dy * dy);
+	}
+
+	if (dot->m_maxValue < 0.1) return true;
+	if (dot->m_minValue > dot->m_maxValue) return true;
+
+	if (result < dot->m_minValue || result > dot->m_maxValue) return false;
+
+	return true;
+}
+
+int CVisionBufferPro::getDistResult(DimensionDir eDir,  CDistDotProcess *dot, double &distResult) {
+	/* code */
+	//1. 初始化结果
+	distResult = 0.0f;
+	int nRet = 0;
+	CCornerDistProcess *dotCorner = CVisionRecipe::getInstance()->getCornerDistProcess(eDir);
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData)  return nRet;
+	if (NULL == dotCorner) return nRet;
+	if (NULL == dot) return nRet;
+
+
+	Point2D locResult = dot->m_ptMatchResult;
+	Point2D measureResult = dot->m_ptMeasureResult;
+	Point2D nearResult = dot->m_ptNearResult;
+
+	int distMode = dot->m_distMode;
+	if (0 == distMode) {
+		double dx = measureResult.x - nearResult.x;
+		distResult = fabs(pSideData->m_dPixelSizeX * dx);
+	}
+	else if (1 == distMode) {
+		Point2I topMark = pSideData->getPose(0);
+		Point2I botMark = pSideData->getPose(1);
+
+		Line2D line1, line2;
+		line1.pt0.x = topMark.x;
+		line1.pt0.y = topMark.y;
+		line1.pt1.x = botMark.x;
+		line1.pt1.y = botMark.y;
+
+		line2.pt0.x = measureResult.x;
+		line2.pt0.y = measureResult.y;
+		line2.pt1.x = measureResult.x + 1000.0f;
+		line2.pt1.y = measureResult.y;
+
+		Point2D pose = ClsVision::LineIntersection(line1, line2);
+		double dx = measureResult.x - pose.x;
+		distResult = fabs(pSideData->m_dPixelSizeX * dx);
+	}
+	else if (2 == distMode) {
+		Point2I pose = pSideData->getPose(0);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (3 == distMode) {
+		Point2I pose = pSideData->getPose(1);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (4 == distMode) {
+		Point2I pose = pSideData->getPose(2);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (5 == distMode) {
+		Point2I pose = pSideData->getPose(3);
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (6 == distMode){
+		Point2D pose = nearResult;
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+	else if (7 == distMode) {
+		Point2D pose = locResult;
+		double dx = pSideData->m_dPixelSizeX *(measureResult.x - pose.x);
+		double dy = pSideData->m_dPixelSizeY *(measureResult.y - pose.y);
+		distResult = sqrt(dx * dx + dy * dy);
+	}
+
+	if (dot->m_maxValue < 0.1) return 0;
+	if (dot->m_minValue > dot->m_maxValue) return 0;
+
+	if (distResult < dot->m_minValue || distResult > dot->m_maxValue) return 1;
+
+	return 0;
+}
+
+bool CVisionBufferPro::TransformToReal(DimensionDir eDir, Point2I point, int nType, Point2I &result) {
+	/* code */
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData) return false;
+	if (0 == nType) {
+		if (!pSideData->m_bTopMark_Find) return false;
+		if (!pSideData->m_bBotMark_Find)  return false;
+	}
+	else {
+		if (!pSideData->m_bTopPoint_Find) return false;
+		if (!pSideData->m_bBotPoint_Find) return false;
+	}
+
+	double xMmvsp = pSideData->m_dPixelSizeX;
+	double yMmvsp = pSideData->m_dPixelSizeY;
+
+	Point2I ptTop, ptBot, bzTopPoint, bzBotPoint;
+	Point2D stdPoint;
+	if (0 == nType) {                    //Origine Mark Line
+		ptTop = pSideData->m_mTopMark;
+		ptBot = pSideData->m_mBotMark;
+		bzTopPoint = pSideData->m_mTopBzMark;
+        bzBotPoint = pSideData->m_mBotBzMark;
+		stdPoint.x = bzTopPoint.x + point.x;
+		stdPoint.y = bzTopPoint.y + point.y;
+	}
+	else if (1 == nType) {               //Top MarkPoint
+		ptTop = pSideData->m_mTopPoint;
+		ptBot = pSideData->m_mBotPoint;
+		bzTopPoint = pSideData->m_mTopBzPoint;
+        bzBotPoint = pSideData->m_mBotBzPoint;
+		stdPoint.x = bzTopPoint.x + point.x;
+        stdPoint.y = bzTopPoint.y + point.y;
+	}
+	else if (2 == nType) {               //Bot MarkLine
+		ptTop = pSideData->m_mTopPoint;
+		ptBot = pSideData->m_mBotPoint;
+		bzTopPoint = pSideData->m_mTopBzPoint;
+		bzBotPoint = pSideData->m_mBotBzPoint;
+		stdPoint.x = bzBotPoint.x + point.x;
+		stdPoint.y = bzBotPoint.y + point.y;
+	}
+
+	Point2D pose;
+	std::vector<Point2D> vPtOrigine, vPtReal;
+	pose.x = bzTopPoint.x;
+	pose.y = bzTopPoint.y;
+	vPtOrigine.push_back(pose);
+    pose.x = bzBotPoint.x;
+    pose.y = bzBotPoint.y;
+    vPtOrigine.push_back(pose);
+
+	pose.x = xMmvsp * ptTop.x;
+    pose.y = yMmvsp * ptTop.y;
+    vPtReal.push_back(pose);
+    pose.x = xMmvsp * ptBot.x;
+    pose.y = yMmvsp * ptBot.y;
+    vPtReal.push_back(pose);
+
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtOrigine, vPtReal);
+	Point2D ptResult = ClsVision::CoordinateTransform(stdPoint, affine);
+	result.x = (int)(ptResult.x / xMmvsp + 0.5);
+    result.y = (int)(ptResult.y / yMmvsp + 0.5);
+
+	return true;
+
+#if 0
+	double dx = xMmvsp * (ptBot.x - ptTop.x);
+	double dy = yMmvsp * (ptBot.y - ptTop.y);
+	double dist = sqrt(dx * dx + dy * dy);
+
+	Point2D posTopReal, posBotReal, poseReal;
+	posTopReal.x = 0.0f;
+	posTopReal.y = 0.0f;
+	posBotReal.x = 0.0f;
+	posBotReal.y = dist;
+	if (0 == nType) {
+		poseReal = posTopReal;
+		poseReal.x += point.x;
+		poseReal.y += point.y;
+	}
+	else if (1 == nType) {
+		poseReal = posTopReal;
+		poseReal.x += point.x;
+		poseReal.y += point.y;
+	}
+	else if (2 == nType) {
+		poseReal = posBotReal;
+		poseReal.x += point.x;
+		poseReal.y += point.y;
+	}
+
+	std::vector<Point2D> vPtOrigine, vPtReal;
+	vPtOrigine.push_back(posTopReal);
+	vPtOrigine.push_back(posBotReal);
+	Point2D pose;
+	pose.x = 0.0f;
+	pose.y = 0.0f;
+	vPtReal.push_back(pose);
+	pose.x = xMmvsp * (ptBot.x - ptTop.x);
+	pose.y = yMmvsp * (ptBot.y - ptTop.y);
+	vPtReal.push_back(pose);
+
+	double dist1 = sqrt(pose.x * pose.x + pose.y * pose.y);
+	printf("dist: %.0f", dist1);
+
+
+	ParaAffine2D affine = ClsVision::VectorToSimilarity(vPtOrigine, vPtReal);
+	Point2D ptResult = ClsVision::CoordinateTransform(poseReal, affine);
+	result.x = (int)(ptTop.x + ptResult.x / xMmvsp);
+	result.y = (int)(ptTop.y + ptResult.y / yMmvsp);
+
+	return true;
+#endif
+}
+
+void CVisionBufferPro::getRect2Point(Point2D rect2CenterPoint, double rect2Phi, double rect2Length1, double rect2Length2, Point2D *rect2Points) {
+	/* code */
+	double cosValue = cos(rect2Phi);
+	double sinValue = sin(rect2Phi);
+
+	double Row = rect2CenterPoint.y;
+	double Column = rect2CenterPoint.x;
+	double Length1 = rect2Length1;
+	double Length2 = rect2Length2;
+
+	//LeftTop Point
+	double TopLeft_X = -Length1*cosValue - Length2*sinValue;
+	double TopLeft_Y = -Length1*sinValue + Length2*cosValue;
+	rect2Points[0].x = Row - TopLeft_Y;
+	rect2Points[0].y = Column + TopLeft_X;
+
+	//RightTop Point
+	double TopRight_X = Length1*cosValue - Length2*sinValue;
+	double TopRight_Y = Length1*sinValue + Length2*cosValue;
+	rect2Points[1].x = Row - TopRight_Y;
+	rect2Points[1].y = Column + TopRight_X;
+
+	//RightDown Point
+	double LowerRight_X = Length1*cosValue + Length2*sinValue;
+	double LowerRight_Y = Length1*sinValue - Length2*cosValue;
+	rect2Points[2].x = Row - LowerRight_Y;
+	rect2Points[2].y = Column + LowerRight_X;
+
+	//LeftDown Point
+	double LowerLeft_X = -Length1*cosValue + Length2*sinValue;
+	double LowerLeft_Y = -Length1*sinValue - Length2*cosValue;
+	rect2Points[3].x = Row - LowerLeft_Y;
+	rect2Points[3].y = Column + LowerLeft_X;
+}
+
+Line2D CVisionBufferPro::getRect2Line(Point2D rect2CenterPoint, double rect2Phi, int rect2Length2) {
+	/* code */
+	Point2D rect2Points[4];
+	double rect2Length1 = 100.0f;
+	double length2 = rect2Length2;
+	getRect2Point(rect2CenterPoint, rect2Phi, rect2Length1, length2, rect2Points);
+	Line2D line;
+	line.pt0.x = 0.5 *(rect2Points[0].x + rect2Points[1].x);
+	line.pt0.y = 0.5 *(rect2Points[0].y + rect2Points[1].y);
+	line.pt1.x = 0.5 *(rect2Points[2].x + rect2Points[3].x);
+	line.pt1.y = 0.5 *(rect2Points[2].y + rect2Points[3].y);
+	return line;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+void SetMetrologyTransition(int hHandle, int iIndex, int getLineMode){
+	/* code */
+	if (hHandle < 0 || iIndex < 0) return;
+
+	if (0 == getLineMode){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "all");
+	}
+	else if (1 == getLineMode){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "positive");
+	}
+	else if (2 == getLineMode){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_transition", "negative");
+	}
+}
+
+void SetMetrologySelect(int hHandle, int iIndex, int getLineDirection){
+	/* code */
+	if (hHandle < 0 || iIndex < 0) return;
+
+	if (0 == getLineDirection){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "all");
+	}
+	else if (1 == getLineDirection){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "first");
+	}
+	else if (2 == getLineDirection){
+		HalconCpp::SetMetrologyObjectParam(hHandle, iIndex, "measure_select", "last");
+	}
+}
+
+bool CVisionBufferPro::LineMeasureByRuler(HalconCpp::HObject &hObject, Line2D line,
+	LineMetrologyPara shapeMetrologyPara, Line2D &lineResult)
+{
+	/* code */
+	lineResult = line;
+	if (!ClsVision::ObjectExist(hObject)){
+		return false;
+	}
+
+	try
+	{
+		//1. 图像尺寸
+		int width = 0;
+		int height = 0;
+		ClsVision::GetImageSize(hObject, width, height);
+
+		//2. 创建测量句柄
+		HalconCpp::HTuple hvMetrologyHandle;
+		HalconCpp::CreateMetrologyModel(&hvMetrologyHandle);
+		HalconCpp::SetMetrologyModelImageSize(hvMetrologyHandle, width, height);
+
+		//3. 创建测直线的参数
+		HalconCpp::HTuple hvLineParams;
+		if (true){
+			Line2D curLine = line;
+			int lineDirection = shapeMetrologyPara.direction;
+			if (0 == lineDirection){
+				if (line.pt0.x < line.pt1.x) {
+					curLine = line;
+				}
+				else {
+					curLine.pt1 = line.pt0;
+					curLine.pt0 = line.pt1;
+				}
+			}
+			else if (1 == lineDirection){
+				if (line.pt0.y < line.pt1.y){
+					curLine = line;
+				}
+				else{
+					curLine.pt0 = line.pt1;
+					curLine.pt1 = line.pt0;
+				}
+			}
+			//直线方向
+			hvLineParams.Clear();
+			hvLineParams.Append(curLine.pt0.y);
+			hvLineParams.Append(curLine.pt0.x);
+			hvLineParams.Append(curLine.pt1.y);
+			hvLineParams.Append(curLine.pt1.x);
+		}
+
+		HalconCpp::HTuple hvIndex, hvLen;
+		double stepLength = shapeMetrologyPara.stepLength;
+		double stepDist = shapeMetrologyPara.stepDist;
+		int threshold = shapeMetrologyPara.threshold;
+		HalconCpp::AddMetrologyObjectGeneric(hvMetrologyHandle, "line", hvLineParams, stepLength, stepDist, 1, threshold,
+			HalconCpp::HTuple(), HalconCpp::HTuple(), &hvIndex);
+		int iHandle = hvMetrologyHandle[0].I();
+
+		HalconCpp::TupleLength(hvIndex, &hvLen);
+		if (hvLen[0].I() < 1){
+			HalconCpp::ClearMetrologyModel(iHandle);
+			return false;
+		}
+
+		int iIndex = hvIndex[0].I();
+		if (iIndex < 0){
+			HalconCpp::ClearMetrologyModel(iHandle);
+			return false;
+		}
+
+		//直线的边界点类型
+		int getLineMode = shapeMetrologyPara.getMode;
+		SetMetrologyTransition(iHandle, iIndex, getLineMode);
+
+		HalconCpp::SetMetrologyObjectParam(iHandle, iIndex, "num_measures", shapeMetrologyPara.numSample);
+		HalconCpp::SetMetrologyObjectParam(iHandle, iIndex, "min_score", shapeMetrologyPara.minScore);
+
+		//设置直线提取模式
+		SetMetrologySelect(iHandle, iIndex, shapeMetrologyPara.getDirection);
+		HalconCpp::ApplyMetrologyModel(hObject, iHandle);
+		HalconCpp::HTuple hvParameter, hvLength;
+		HalconCpp::GetMetrologyObjectResult(iHandle, iIndex, "all", "result_type", "all_param", &hvParameter);
+		HalconCpp::TupleLength(hvParameter, &hvLength);
+		if (hvLength[0].I() < 1){
+			HalconCpp::ClearMetrologyModel(iHandle);
+			return false;
+		}
+
+		lineResult.pt0.y = hvParameter[0].D();
+		lineResult.pt0.x = hvParameter[1].D();
+		lineResult.pt1.y = hvParameter[2].D();
+		lineResult.pt1.x = hvParameter[3].D();
+		HalconCpp::ClearMetrologyModel(iHandle);
+
+		return true;
+	}
+	catch (...)
+	{
+		return false;
+	}
+}
+
+bool CVisionBufferPro::findCutLine(DimensionDir eDir, Point2I keyPoint, int keyRange, int keyThres, Point2I &result) {
+	/* code */
+	result.x = 0;
+	result.y = 0;
+	CBlSideData *pSideData = CVisionRecipe::getInstance()->getSideData(eDir);
+	if (NULL == pSideData)  return false;
+	if (!pSideData->m_bTopMark_Find)  return false;
+	if (!pSideData->m_bBotMark_Find)  return false;
+
+	int x1 = keyPoint.x - keyRange;
+	int y1 = keyPoint.y - 31;
+	int x2 = keyPoint.x + keyRange;
+	int y2 = keyPoint.y + 31;
+	Point2I leftTop;
+	leftTop.x = x1;
+	leftTop.y = y1;
+	HalconCpp::HObject hImage;
+	if (!getImageROI(eDir, hImage, x1, y1, x2, y2)) return false;
+
+	HalconCpp::HObject hMeanImage;
+	HalconCpp::MeanImage(hImage, &hMeanImage, 1, 20);
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 10 || height < 25)  return false;
+
+	HalconCpp::HObject hLineRegionRoi;
+	HalconCpp::GenRegionLine(&hLineRegionRoi, 0.5 * height - 1, 0, 0.5 * height - 1, width - 1);
+	HalconCpp::HTuple hvY, hvX, hvGray;
+	HalconCpp::GetRegionPoints(hLineRegionRoi, &hvY, &hvX);
+	HalconCpp::GetGrayval(hMeanImage, hvY, hvX, &hvGray);
+	HalconCpp::HTuple hvLength = hvX.TupleLength();
+	int num = hvLength[0].I();
+	if (num < 10) return false;
+
+	HalconCpp::HTuple hvCyValue;
+	for (int i = 0; i < num; i++) {
+		if (hvGray[i].I() < keyThres) {
+			hvCyValue[i] = 255;
+		}
+		else {
+			hvCyValue[i] = 0;
+		}
+	}
+
+	bool isStart = false;
+	bool isFind = false;
+	int nEdgeLine = 0;
+	for (int i = 0; i < num - 1; i++) {
+		if (isFind) break;
+
+		if (hvCyValue[i].I() > 120 || hvCyValue[i + 1].I() > 120) {
+			isStart = true;
+			nEdgeLine = i;
+		}
+
+		if (isStart && hvCyValue[i].I() < 120 && hvCyValue[i + 1].I() < 120) {
+			isFind = true;
+		}
+	}
+	if (!isFind) return false;
+
+	result.x = leftTop.x + nEdgeLine;
+	result.y = leftTop.y + (int)(height / 2);
+	return true;
+}
+
+int CVisionBufferPro::findNorchDefect(DimensionDir eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, 
+	int szType, int xFzSize, int yFzSize, CRect* aryResult) {
+	/* code */
+	if (roiRect.Width() < 10 || roiRect.Height() < 10) return 0;
+	if (nThres < 5 || nBinThres < 5) return 0;
+	if (0 == szType)  return 0;
+
+	int sz = (int)(vPoints.size());
+	if (sz < 3) return 0;
+
+	std::vector<Point2D> vEdgePoints;
+	for (auto item : vPoints) {
+		Point2D point = item;
+		vEdgePoints.push_back(point);
+	}
+	//1. 进行自上而下的排序
+	for (int i = 0; i < sz - 1; i++) {
+		for (int j = i + 1; j < sz; j++) {
+			if (vEdgePoints[i].y > vEdgePoints[j].y) {
+                Point2D temp = vEdgePoints[i];
+				vEdgePoints[i] = vEdgePoints[j];
+				vEdgePoints[j] = temp;
+			}
+		}
+	}
+
+	//2. 截取ROI图像
+	int x1 = roiRect.left;
+	int y1 = roiRect.top;
+	int x2 = roiRect.right;
+	int y2 = roiRect.bottom;
+	HalconCpp::HObject hImage;
+	if (!getImageROI(eDir, hImage, x1, y1, x2, y2)) return 0;
+
+	int width = 0;
+	int height = 0;
+	ClsVision::GetImageSize(hImage, width, height);
+	if (width < 10 || height < 10) return 0;
+
+
+	//3. 点位偏移
+	for (int i = 0; i < sz; i++) {
+		vEdgePoints[i].x -= roiRect.left;
+        vEdgePoints[i].y -= roiRect.top;
+	}
+
+	int edgeThres = nThres;
+	if (nThres > 10) {
+		edgeThres = 10;
+	}
+
+	std::vector<vec> vEdgeCtrlPoint;
+	for (int i = 0; i < sz; i++) {
+		if (0 != i) {
+			double dy = vEdgePoints[i].y - vEdgePoints[i - 1].y;
+			double dx = vEdgePoints[i].x - vEdgePoints[i - 1].x;
+			if (dy > 450) {
+				for (int j = 0; j < 3; j++) {
+					Line2D line;
+					line.pt0.x = vEdgePoints[i - 1].x + (j + 1) * dx / 4 - 75;
+					line.pt0.y = vEdgePoints[i - 1].y + (j + 1) * dy / 4;
+					line.pt1.x = vEdgePoints[i - 1].x + (j + 1) * dx / 4 + 75;
+					line.pt1.y = vEdgePoints[i - 1].y + (j + 1) * dy / 4;
+					if (line.pt0.x < 0) line.pt0.x = 1;
+					if (line.pt0.x > width - 1) line.pt0.x = width - 2;
+					if (line.pt0.y < 0) line.pt0.y = 1;
+					if (line.pt0.y > height - 1) line.pt0.y = height - 2;
+					if (line.pt1.x < 0) line.pt1.x = 1;
+					if (line.pt1.x > width - 1) line.pt1.x = width - 2;
+					if (line.pt1.y < 0) line.pt1.y = 1;
+					if (line.pt1.y > height - 1) line.pt1.y = height - 2;
+					if (line.pt1.x > line.pt0.x) {
+						Point2D ptStart, ptEnd;
+						if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) {
+							float xPos = (float)(ptEnd.x);
+							float yPos = (float)(ptEnd.y);
+							vec p1(xPos, yPos, 0);
+							vEdgeCtrlPoint.push_back(p1);
+						}
+					}
+				}
+			}
+			else if (dy > 300) {
+				for (int j = 0; j < 2; j++) {
+					Line2D line;
+					line.pt0.x = vEdgePoints[i - 1].x + (j + 1) * dx / 3 - 75;
+					line.pt0.y = vEdgePoints[i - 1].y + (j + 1) * dy / 3;
+					line.pt1.x = vEdgePoints[i - 1].x + (j + 1) * dx / 3 + 75;
+					line.pt1.y = vEdgePoints[i - 1].y + (j + 1) * dy / 3;
+					if (line.pt0.x < 0) line.pt0.x = 1;
+					if (line.pt0.x > width - 1) line.pt0.x = width - 2;
+					if (line.pt0.y < 0) line.pt0.y = 1;
+					if (line.pt0.y > height - 1) line.pt0.y = height - 2;
+					if (line.pt1.x < 0) line.pt1.x = 1;
+					if (line.pt1.x > width - 1) line.pt1.x = width - 2;
+					if (line.pt1.y < 0) line.pt1.y = 1;
+					if (line.pt1.y > height - 1) line.pt1.y = height - 2;
+					if (line.pt1.x > line.pt0.x) {
+						Point2D ptStart, ptEnd;
+						if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) {
+							float xPos = (float)(ptEnd.x);
+							float yPos = (float)(ptEnd.y);
+							vec p1(xPos, yPos, 0);
+							vEdgeCtrlPoint.push_back(p1);
+						}
+					}
+				}
+			}
+			else {
+				Line2D line;
+				line.pt0.x = 0.5 * (vEdgePoints[i].x + vEdgePoints[i - 1].x) - 75;
+				line.pt0.y = 0.5 * (vEdgePoints[i].y + vEdgePoints[i - 1].y);
+				line.pt1.x = 0.5 * (vEdgePoints[i].x + vEdgePoints[i - 1].x) + 75;
+				line.pt1.y = 0.5 * (vEdgePoints[i].y + vEdgePoints[i - 1].y);
+				if (line.pt0.x < 0) line.pt0.x = 1;
+				if (line.pt0.x > width - 1) line.pt0.x = width - 2;
+				if (line.pt0.y < 0) line.pt0.y = 1;
+				if (line.pt0.y > height - 1) line.pt0.y = height - 2;
+				if (line.pt1.x < 0) line.pt1.x = 1;
+				if (line.pt1.x > width - 1) line.pt1.x = width - 2;
+				if (line.pt1.y < 0) line.pt1.y = 1;
+				if (line.pt1.y > height - 1) line.pt1.y = height - 2;
+				if (line.pt1.x > line.pt0.x) {
+					Point2D ptStart, ptEnd;
+					if (CVisionBufferPro::GetMeasureNearPos(hImage, line, edgeThres, 0, 10, ptStart, ptEnd)) {
+						float xPos = (float)(ptEnd.x);
+						float yPos = (float)(ptEnd.y);
+						vec p1(xPos, yPos, 0);
+						vEdgeCtrlPoint.push_back(p1);
+					}
+				}
+			}
+		}
+		Point2D point = vEdgePoints[i];
+		vec p0((float)point.x, (float)point.y, 0);
+		vEdgeCtrlPoint.push_back(p0);
+	}
+
+	CBspline bspline(vEdgeCtrlPoint);
+	bspline.execute();
+
+	int number = (int)(bspline.m_vPtResults.size());
+	if (number < 10) return 0;
+
+	std::vector<Point2D> vPointResults;
+	for (int i = 0; i < number; i++) {
+		Point2D point;
+		point.x = bspline.m_vPtResults[i][0] + nOffset;
+        point.y = bspline.m_vPtResults[i][1];
+        vPointResults.push_back(point);
+	}
+
+	HalconCpp::HTuple hvY, hvX;
+	int idx = 0;
+	for (auto item : vPointResults) {
+		hvX[idx] = item.x;
+		hvY[idx] = item.y;
+		idx += 1;
+	}
+
+	hvX[idx] = width - 5;
+	hvY[idx] = height - 5;
+	idx += 1;
+
+	hvX[idx] = width - 5;
+	hvY[idx] = 5;
+	idx += 1;
+
+	HalconCpp::HObject hRoiRegion;
+	HalconCpp::GenRegionPolygonFilled(&hRoiRegion, hvY, hvX);
+
+#if 0
+	HalconCpp::HWindow hDispWin(0, 0, 0.4 * width, 0.4 * height);
+	hDispWin.SetPart(0, 0, height-1, width-1);
+	hDispWin.SetColor("green");
+	hDispWin.SetDraw("margin");
+	hDispWin.DispObj(hImage);
+	hDispWin.DispObj(hRoiRegion);
+	hDispWin.Click();
+#endif
+
+	HalconCpp::HObject hBinRegion, hRegion, hConnectRegion, hSelectRegion;
+	HalconCpp::ReduceDomain(hImage, hRoiRegion, &hBinRegion);
+	HalconCpp::Threshold(hBinRegion, &hRegion, 0, nBinThres);
+	HalconCpp::Connection(hRegion, &hConnectRegion);
+	if (1 == szType) {
+		HalconCpp::HObject hSelectRegionX, hSelectRegionY, hConcatRegion, hUinonRegion, hClosngRegion;
+		HalconCpp::SelectShape(hConnectRegion, &hSelectRegionX, "width", "and", xFzSize, 99999999);
+		HalconCpp::SelectShape(hConnectRegion, &hSelectRegionY, "height", "and", yFzSize, 99999999);
+		HalconCpp::ConcatObj(hSelectRegionX, hSelectRegionY, &hConcatRegion);
+		HalconCpp::Union1(hConcatRegion, &hUinonRegion);
+		HalconCpp::ClosingCircle(hUinonRegion, &hClosngRegion, 7.5);
+		HalconCpp::Connection(hClosngRegion, &hSelectRegion);
+	}
+	else {
+		HalconCpp::HObject hSelectRegionX, hSelectRegionY, hConcatRegion, hUinonRegion, hClosngRegion;
+		HalconCpp::SelectShape(hConnectRegion, &hSelectRegionX, "width", "and", xFzSize, 99999999);
+		HalconCpp::SelectShape(hSelectRegionX, &hSelectRegion, "height", "and", yFzSize, 99999999);
+		HalconCpp::Union1(hSelectRegion, &hUinonRegion);
+		HalconCpp::ClosingCircle(hUinonRegion, &hClosngRegion, 7.5);
+		hSelectRegion.Clear();
+		HalconCpp::Connection(hClosngRegion, &hSelectRegion);
+	}
+#if 0
+	hDispWin.SetColored(6);
+	hDispWin.SetDraw("fill");
+	hDispWin.DispObj(hSelectRegion);
+	hDispWin.Click();
+#endif
+	int nRet = ClsVision::ObjectNumber(hSelectRegion);
+	if (nRet < 1) return 0;
+
+	HalconCpp::HTuple hvY1, hvX1, hvY2, hvX2;
+	HalconCpp::SmallestRectangle1(hSelectRegion, &hvY1, &hvX1, &hvY2, &hvX2);
+	int nNumber = 0;
+	for (int i = 0; i < nRet; i++) {
+		aryResult[i].left = hvX1[i].I() + roiRect.left;
+		aryResult[i].top = hvY1[i].I() + roiRect.top;
+		aryResult[i].right = hvX2[i].I() + roiRect.left;
+		aryResult[i].bottom = hvY2[i].I() + roiRect.top;
+		nNumber += 1;
+		if (i > 99) break;
+	}
+
+	return nNumber;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/VisionBufferPro.h b/Common_Class/BlVisionPro/Vision/VisionBufferPro.h
new file mode 100644
index 0000000..84dcd2f
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/VisionBufferPro.h
@@ -0,0 +1,71 @@
+#ifndef VISION_BUFFER_PRO
+#define VISION_BUFFER_PRO
+
+#include "VisionRecipe.h"
+
+typedef struct _LineMetrologyPara
+{
+	int direction;
+	int getMode;
+	int getDirection;
+	double stepLength;
+	double stepDist;
+	int threshold;
+	int numSample;
+	double minScore;
+}LineMetrologyPara;
+
+class CVisionBufferPro
+{
+public:
+	CVisionBufferPro();
+	~CVisionBufferPro();
+
+public:
+	//1. 图像转换
+	static bool bufferToObject(DimensionDir eDir, int height, HalconCpp::HObject &hImage);
+
+	//2. 截图图像
+	static bool getImageROI(DimensionDir eDir, HalconCpp::HObject &hImage, int x1, int y1, int x2, int y2);
+	static bool getIndexImage(DimensionDir eDir, HalconCpp::HObject *hImage, int index);
+
+	//3. 获取距离的检测结果
+	static bool getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &result, int &xPosPxl, int &yPosPxl);
+
+	//4. 查找点
+	static bool GetMeasurePos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int step, Point2D &ptStart, Point2D &ptEnd);
+	static bool GetMeasurePosKeyLimit(HalconCpp::HObject &hObject, Line2D line, int nTypePoint, int threshold, int modeTrans, int step, int distLimit, Point2D &ptStart, Point2D &ptEnd);
+	static bool GetMeasureRCutPos(HalconCpp::HObject &hObject, Line2D line, int threshold, int modeTrans, int chamberSize, double proDist, Point2D &ptStart, Point2D &ptEnd);
+	static bool GetMeasureNearPos(HalconCpp::HObject& hObject, Line2D line, int threshold, int modeTrans, int step, Point2D& ptStart, Point2D& ptEnd);
+
+	//5. 获取距离的检测结果
+	static int getDistResult(DimensionDir eDir, CDistDotProcess *dot, double &distResult);
+
+	//6. 坐标转换
+	static bool TransformToReal(DimensionDir eDir, Point2I point, int nType, Point2I &result);
+
+	//7. 获取坐标  坐上点坐标、右上点坐标,右下点坐标,左下点坐标
+	static void getRect2Point(Point2D rect2CenterPoint, double rect2Phi, double rect2Length1, double rect2Length2, Point2D *rect2Points);
+
+	//8. 获取矩形的斜直线
+	static Line2D getRect2Line(Point2D rect2CenterPoint, double rect2Phi, int rect2Length2);
+
+	//9. 查找直线
+	static bool LineMeasureByRuler(HalconCpp::HObject &hObject, Line2D line,
+		LineMetrologyPara shapeMetrologyPara, Line2D &lineResult);
+
+	//10. 获取线扫的图像帧的宽度和高度
+	static void getLineFrameSize(DimensionDir eDir, int &nFrameWidth, int &nFrameHeight);
+
+	//11. 查找切割
+	static bool findCutLine(DimensionDir eDir, Point2I keyPoint, int keyRange, int keyThres, Point2I &result);
+
+	//12. 查找Norch缺陷
+	static int findNorchDefect(DimensionDir eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres, 
+		int szType, int xFzSize, int yFzSize,  CRect *aryResult);
+
+private:
+
+};
+
+#endif
diff --git a/Common_Class/BlVisionPro/Vision/VisionRecipe.cpp b/Common_Class/BlVisionPro/Vision/VisionRecipe.cpp
new file mode 100644
index 0000000..86cef88
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/VisionRecipe.cpp
@@ -0,0 +1,1214 @@
+#include "stdafx.h"
+#include "VisionRecipe.h"
+#include "FileRecipe.h"
+#include "SoftVisionApp.h"
+#include <fstream> // IO 操作
+
+CVisionRecipe::CVisionRecipe() {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		m_pCornerDistProcess[i] = NULL;
+		m_pCornerRcutProcess[i] = NULL;
+		m_pLocProcese[i] = NULL;
+		m_pBlSideData[i] = NULL;
+		m_pCutProcess[i] = NULL;
+		m_pKDistProcess[i] = NULL;
+		m_pThresProcess[i] = NULL;
+	}
+
+	m_mScanSetting.lengthSize = 0;
+	m_mScanSetting.shortSize = 0;
+	m_mScanSetting.nStdIndex = 0;
+	m_mScanSetting.nIndex0 = 0;
+	m_mScanSetting.nIndex1 = 1;
+	m_mScanSetting.nIndex2 = 2;
+	m_mScanSetting.nIndex3 = 3;
+	m_mScanSetting.nLengthScan = 0;
+	m_mScanSetting.nShortScan = 0;
+
+	m_isInit = false;
+	m_pMainDlg = NULL;
+
+	m_visionDisplayInfo.isVisionDisplay = false;
+	m_visionDisplayInfo.isDistDisplay = false;
+	m_visionDisplayInfo.isRcutDisplay = false;
+	m_strVisionName = "system";
+
+	for (int i = 0; i < 8; i++) {
+		m_visionUseInfo[i].isVisionUse = false;
+		m_visionUseInfo[i].isLocUse = false;
+		m_visionUseInfo[i].isDistUse = false;
+		m_visionUseInfo[i].isRcutUse = false;
+	}
+
+	m_keyInfo.isDebugTool = false;
+	m_keyInfo.isInspectKey = false;
+	m_keyInfo.isLocKey = false;
+	m_keyInfo.isGrindKey = false;
+	m_keyInfo.isDistKey = false;
+	m_keyInfo.isCutLineKey = false;
+	m_keyInfo.isRcutKey = false;
+
+	//默认一个配方数据
+	m_workDir = ClsVision::GetAppPathA() + "Recipe";
+	m_configVision.SetWorkDir(m_workDir.c_str(), m_strVisionName.c_str());
+	readVisionConfig();
+	m_isOpenVisionDlg = FALSE;
+
+	m_nFrameX1 = -1;
+	m_nFrameY1 = -1;
+	m_nFrameX1 = -1;
+	m_nFrameY2 = -1;
+
+	m_nStage = -1;
+	InitializeCriticalSection(&m_criticalSection);
+}
+
+CVisionRecipe::~CVisionRecipe() {
+	/* code */
+	release();
+	DeleteCriticalSection(&m_criticalSection);
+}
+
+static CVisionRecipe _gVisionRecipe;
+CVisionRecipe* CVisionRecipe::getInstance(void) {
+	/* code */
+	return &_gVisionRecipe;
+}
+
+int CVisionRecipe::setWorkDir(const char *pszPath) {
+	/* code */
+	m_workDir = pszPath;
+	return 0;
+}
+
+int CVisionRecipe::save(void) {
+	/* code */
+	std::string filePath = m_workDir;
+	int len = (int)(filePath.length());
+	if (len < 1)  return -1;
+	int pos = (int)(filePath.rfind(".dat"));
+	if (pos >= 0) return -1;
+
+	int nRet = saveRecipeFile(filePath);
+
+	return 0;
+}
+
+int CVisionRecipe::saveRecipeFile(std::string filePath) {
+	/* code */
+	//1. 首先创建文件目录
+	std::string strDir = filePath + "\\" + m_strVisionName + "\\";
+	CFileRecipe::makeDir(strDir);
+
+	//2. 清空目录下的所有文件
+	CFileRecipe::removeDir(strDir);
+
+	//3. 新建配方文件
+	//std::string fileName = strDir + "vision.csv";
+	//CString strFile = CFileRecipe::toCString(fileName);
+	//if (!CFileRecipe::openRecipeFile(m_recipeFile, strFile)) return -1;
+
+	CSoftVisionApp::getInstance()->Log(1, "Trace Save Vision Recipe!");
+
+	WriteRecipeVisionFile();
+
+	//if (CStdioFile::hFileNull != m_recipeFile.m_hFile) {
+	//	m_recipeFile.Close();
+	//}
+	return 0;
+}
+
+int CVisionRecipe::WriteRecipeVisionFile(void) {
+	/* code */
+//	if (CStdioFile::hFileNull == m_recipeFile.m_hFile) return -1;
+
+	saveVisionConfig();
+
+	std::string strDir = m_workDir + "\\" + m_strVisionName + "\\";
+	Json::Value root;
+
+	int nCount = (int)(DIMENSION_NONE);
+	for (int i = 0; i < nCount; i++) {
+		CLocProcess *dot = m_pLocProcese[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Loc%d", i);
+		root[name.c_str()] = dot->WriteToJson(strDir);                   //保存数据
+	}
+
+
+	for (int i = 0; i < nCount; i++) {
+		CGrindProcess *dot = m_pGrindProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Grind%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CCutProcess *dot = m_pCutProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Cut%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CKDistProcess *dot = m_pKDistProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("KDist%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CCornerRcutProcess *dot = m_pCornerRcutProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("RCut%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CThresProcess *dot = m_pThresProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Thres%d", i);
+		root[name.c_str()] = dot->WriteToJson();                       //保存数据
+	}
+
+	for (int i = 0; i < nCount; i++) {
+		CHoleProcess* dot = m_pHoleProcess[i];
+		if (NULL == dot) continue;
+
+//		dot->WriteToFile(m_recipeFile, strDir);
+
+		std::string name = ClsVision::FormatString("Hole%d", i);
+		root[name.c_str()] = dot->WriteToJson(strDir);                       //保存数据
+	}
+
+	std::string fileName = strDir + "vision.json";
+	std::string strText = root.toStyledString();
+	ofstream ofs(fileName.c_str());
+	ofs << strText;
+	ofs.close();
+
+	return 0;
+}
+
+int CVisionRecipe::open(void) {
+	/* code */
+	std::string filePath = m_workDir;
+	if (!CFileRecipe::fileIsExist(filePath.c_str())) {
+		return -1;
+	}
+
+	CSoftVisionApp::getInstance()->Log(1, "Trace Load Vision Recipe!");
+	int nRet = openRecipeFile(filePath);
+	return 0;
+}
+
+int CVisionRecipe::openRecipeFile(std::string filePath) {
+	/* code */
+	readVisionConfig();
+
+#if 0
+	std::string strDir = filePath + "\\" + m_strVisionName + "\\";
+	std::string jsFile = strDir + "vision.json";
+	bool isExist = CFileRecipe::fileIsExist(jsFile.c_str());
+	if (!isExist) {
+		if (!CFileRecipe::fileIsExist(strDir)) return -1;
+
+		std::string fileName = strDir + "vision.csv";
+		CString strFile = CFileRecipe::toCString(fileName);
+		if (!CFileRecipe::readRecileFile(m_recipeFile, strFile)) {
+			return -1;
+		}
+	}
+
+	ReadRecipeFile(isExist);
+#endif
+
+	ReadRecipeFile();
+
+#if 0
+	if (!isExist) {
+		if (CStdioFile::hFileNull != m_recipeFile.m_hFile) {
+			m_recipeFile.Close();
+		}
+	}
+#endif
+
+	return 0;
+}
+
+void CVisionRecipe::ReadRecipeFile(void) {
+	/* code */
+	std::string strDir = m_workDir + "\\" + m_strVisionName + "\\";
+#if 0
+	if (!isExist) {
+		if (CStdioFile::hFileNull == m_recipeFile.m_hFile) return;
+
+		while (true) {
+			CString strReadText;
+			if (!CFileRecipe::ReadString(m_recipeFile, strReadText))  break;
+
+			DecodeRecipeText(strReadText);
+		}
+
+		return;
+	}
+#endif
+
+	std::string fileName = strDir + "vision.json";
+	if(!CFileRecipe::fileIsExist(fileName)) return;
+
+	Json::Value jsFileRoot;
+	std::ifstream ifFile(fileName.c_str());
+	Json::Reader jsReader;
+	jsReader.parse(ifFile, jsFileRoot);
+	ifFile.close();
+
+	DecodeJson(jsFileRoot);
+	jsFileRoot.clear();
+}
+
+void CVisionRecipe::DecodeJson(Json::Value jsFileRoot) {
+	/* code */
+	int num = (int)(jsFileRoot.size());
+	if (num < 1) return;
+
+	std::string strDir = m_workDir + "\\" + m_strVisionName + "\\";
+
+	//1. Loc
+	int nCount = (int)(DIMENSION_NONE);
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Loc%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CLocProcess *dot = m_pLocProcese[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(strDir, jsValue);
+	}
+
+	//2. Grind
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Grind%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CGrindProcess *dot = m_pGrindProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//3. Cut
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Cut%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CCutProcess *dot = m_pCutProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//6. KDist
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("KDist%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CKDistProcess *dot = m_pKDistProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//7. RCut
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("RCut%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CCornerRcutProcess *dot = m_pCornerRcutProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//8. Thres
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Thres%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CThresProcess *dot = m_pThresProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue);
+	}
+
+	//9. Hole
+	for (int i = 0; i < nCount; i++) {
+		std::string name = ClsVision::FormatString("Hole%d", i);
+		if (!jsFileRoot.isMember(name.c_str()))   continue;
+
+		Json::Value jsValue = jsFileRoot[name.c_str()];
+		if (!jsValue.isObject())  continue;
+
+		CHoleProcess* dot = m_pHoleProcess[i];
+		if (NULL == dot) continue;
+		dot->DecodeJson(jsValue, strDir);
+	}
+}
+
+#if 0
+void CVisionRecipe::DecodeRecipeText(CString strText) {
+	/* code */
+	std::string strDir = m_workDir + "\\" + m_strVisionName + "\\";
+	std::vector<std::string> vStrings;
+	int nRet = CFileRecipe::CStringSplit(strText, ",", vStrings);
+	if (nRet < 1) return;
+
+	int nVisionType = CFileRecipe::StringToInt(vStrings[0]);
+	int idx = CFileRecipe::StringToInt(vStrings[1]);
+	switch (nVisionType){
+	case LOC_VISION_TYPE: {
+		CLocProcess *dot = m_pLocProcese[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CNccDotProcess *pNccDot = dot->getDot(id);
+		if (NULL == pNccDot) return;
+		pNccDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case LOC_VISION_PROCESS: {
+		CLocProcess *dot = m_pLocProcese[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case GRIND_VISION_TYPE: {
+		CGrindProcess *dot = m_pGrindProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CGrindDotProcess *pGrindDot = dot->m_dots[id - 1];
+		if (NULL == pGrindDot)  return;
+		pGrindDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case  GRIND_VISION_PROCESS: {
+		CGrindProcess *dot = m_pGrindProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case CUT_VISION_TYPE: {
+		CCutProcess *dot = m_pCutProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CCutDotProcess *pCutDot = dot->m_dots[id - 1];
+		if (NULL == pCutDot)  return;
+		pCutDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case CUT_VISION_PROCESS: {
+		CCutProcess *dot = m_pCutProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case KDIST_VISION_TYPE: {
+		CKDistProcess *dot = m_pKDistProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CKeyDistDotProcess *pKDistDot = dot->m_dots[id - 1];
+		if (NULL == pKDistDot)  return;
+		pKDistDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case KDIST_VISION_PROCESS: {
+		CKDistProcess *dot = m_pKDistProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case RCUT_VISION_TYPE: {
+		CCornerRcutProcess *dot = m_pCornerRcutProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CRcutDotProcess *pRcutDot = dot->m_dots[id - 1];
+		if (NULL == pRcutDot)  return;
+		pRcutDot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case RCUT_VISION_PROCESS: {
+		CCornerRcutProcess *dot = m_pCornerRcutProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	case THRES_VISION_TYPE: {
+		CThresProcess *dot = m_pThresProcess[idx];
+		if (NULL == dot) return;
+		int id = CFileRecipe::StringToInt(vStrings[2]);
+		CThresDotProcess *pThresDot = dot->m_dots[id - 1];
+		if (NULL == pThresDot)  return;
+		pThresDot->ReadFile(strText, strDir);
+
+		break;
+	}
+
+	case THRES_VISION_PROCESS: {
+		CThresProcess *dot = m_pThresProcess[idx];
+		if (NULL == dot) return;
+		dot->ReadFile(strText, strDir);
+		break;
+	}
+
+	default:
+		break;
+	}
+}
+#endif
+
+CGrabberControl* CVisionRecipe::getGrabberControl(int iCam) {
+	/* code */
+	if (iCam < 0 || iCam >= MAX_CAMERA_COUNT) return nullptr;
+
+	Lock();
+	CGrabberControl *pGrabberControl = m_pGrabberControl[iCam];
+	Unlock();
+
+	return pGrabberControl;
+}
+
+int CVisionRecipe::setGrabberControl(CGrabberControl *pGrabberControl, int iCam) {
+	/* code */
+	if (iCam < 0 || iCam >= MAX_CAMERA_COUNT) return -1;
+
+	Lock();
+	m_pGrabberControl[iCam] = pGrabberControl;
+	Unlock();
+
+	return 0;
+}
+
+int CVisionRecipe::setCameraSetting(DimensionDir eDir, int iCam, int iScan) {
+	/* code */
+	if (DIMENSION_NONE == eDir) return -1;
+
+	int idx = (int)(eDir);
+	auto iter = m_mapLineCameraSetting.find(idx);
+	if (iter == m_mapLineCameraSetting.end()) {
+		LineCameraSetting *p = new LineCameraSetting();
+		p->eDir = eDir;
+		p->nCam = iCam;
+		p->nScan = iScan;
+		m_mapLineCameraSetting[idx] = p;
+		return 0;
+	}
+
+	iter->second->eDir = eDir;
+	iter->second->nCam = iCam;
+	iter->second->nScan = iScan;
+	return 0;
+}
+
+int CVisionRecipe::init(void) {
+	/* code */
+	if (m_isInit) return 0;
+
+//	HalconCpp::SetSystem("temporary_mem_cache", "false");
+
+	//1. 创建SideData
+	createSideData();
+
+	//3. 创建RCUT数据
+	createAllCornerRcutProcess();
+
+	//4. 创建定位
+	createAllLocProcess();
+
+	//5. 创建切割线
+	createCutProcess();
+
+	//6. 创建KDist
+	createKDistProcess();
+
+	//7. 创建
+	createGrindProcess();
+
+	//8. 创建Thres
+	createThresProcess();
+
+	//9. 创建Hole
+    createHoleProcess();
+
+	m_isInit = true;
+
+	return 0;
+}
+
+
+void CVisionRecipe::createSideData(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CBlSideData *pSide = m_pBlSideData[i];
+		if (NULL != pSide) {
+			delete pSide;
+			pSide = NULL;
+			m_pBlSideData[i] = NULL;
+		}
+		m_pBlSideData[i] = new CBlSideData();
+	}
+}
+
+int CVisionRecipe::getCameraIndex(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	auto iter = m_mapLineCameraSetting.find(idx);
+	if (iter == m_mapLineCameraSetting.end()) return -1;
+
+	int nRet = iter->second->nCam;
+	return nRet;
+}
+
+int CVisionRecipe::getCameraScan(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	auto iter = m_mapLineCameraSetting.find(idx);
+	if (iter == m_mapLineCameraSetting.end()) return -1;
+
+	int nRet = iter->second->nScan;
+	return nRet;
+}
+
+void CVisionRecipe::release(void) {
+	/* code */
+	releaseLineCameraSetting();
+
+#if 0
+	releaaseAllCornerDistProcess();
+#endif
+
+	releaseAllCornerRcutProcess();
+
+	releaseAllLocProcess();
+
+	releaseAllCutProcess();
+
+	releaseAllKDistProcess();
+
+	releaseAllGrindProcess();
+
+	releaseAllThresProcess();
+
+	releaseAllHoleProcess();
+}
+
+void CVisionRecipe::releaseLineCameraSetting(void) {
+	/* code */
+	for (auto iter = m_mapLineCameraSetting.begin(); iter != m_mapLineCameraSetting.end(); iter++) {
+		if (NULL == iter->second) continue;
+		delete iter->second;
+		iter->second = NULL;
+	}
+
+	m_mapLineCameraSetting.clear();
+}
+
+void CVisionRecipe::createAllCornerDistProcess(void) {
+	/* code */
+	return;
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCornerDistProcess *pDot = m_pCornerDistProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCornerDistProcess[i] = NULL;
+		}
+		m_pCornerDistProcess[i] = new CCornerDistProcess();
+		m_pCornerDistProcess[i]->m_eDir = (DimensionDir)(i);
+	}
+}
+
+void CVisionRecipe::createAllLocProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CLocProcess *dot = m_pLocProcese[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pLocProcese[i] = NULL;
+		}
+		DimensionDir edir = (DimensionDir)(i);;
+		m_pLocProcese[i] = new CLocProcess(edir);
+	}
+}
+
+void CVisionRecipe::createCutProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCutProcess *dot = m_pCutProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pCutProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pCutProcess[i] = new CCutProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createKDistProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CKDistProcess *dot = m_pKDistProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pKDistProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pKDistProcess[i] = new CKDistProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createGrindProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CGrindProcess *dot = m_pGrindProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pGrindProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pGrindProcess[i] = new CGrindProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createThresProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CThresProcess *dot = m_pThresProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pThresProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pThresProcess[i] = new CThresProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createHoleProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CHoleProcess* dot = m_pHoleProcess[i];
+		if (NULL == dot) {
+			delete dot;
+			dot = NULL;
+			m_pHoleProcess[i] = NULL;
+		}
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pHoleProcess[i] = new CHoleProcess(eDir);
+	}
+}
+
+void CVisionRecipe::createAllCornerRcutProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCornerRcutProcess *pDot = m_pCornerRcutProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCornerRcutProcess[i] = NULL;
+		}
+
+		DimensionDir eDir = (DimensionDir)(i);
+		m_pCornerRcutProcess[i] = new CCornerRcutProcess(eDir);
+	}
+}
+
+void CVisionRecipe::releaaseAllCornerDistProcess(void) {
+	/* code */
+	return;
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCornerDistProcess *pDot = m_pCornerDistProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCornerDistProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllCornerRcutProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCornerRcutProcess *pDot = m_pCornerRcutProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCornerRcutProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllLocProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CLocProcess *pDot = m_pLocProcese[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pLocProcese[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllCutProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CCutProcess *pDot = m_pCutProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pCutProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllKDistProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CKDistProcess *pDot = m_pKDistProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pKDistProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllGrindProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CGrindProcess *pDot = m_pGrindProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pGrindProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllThresProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CThresProcess *pDot = m_pThresProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pThresProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaseAllHoleProcess(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CHoleProcess* pDot = m_pHoleProcess[i];
+		if (NULL != pDot) {
+			delete pDot;
+			pDot = NULL;
+			m_pThresProcess[i] = NULL;
+		}
+	}
+}
+
+void CVisionRecipe::releaaseAllSideData(void) {
+	/* code */
+	for (int i = 0; i < DIMENSION_NONE; i++) {
+		CBlSideData *pSide = m_pBlSideData[i];
+		if (NULL != pSide) {
+			delete pSide;
+			pSide = NULL;
+			m_pBlSideData[i] = NULL;
+		}
+	}
+}
+
+CCornerDistProcess* CVisionRecipe::getCornerDistProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CCornerDistProcess *dot = m_pCornerDistProcess[idx];
+	Unlock();
+
+	return dot;
+}
+
+CBlSideData* CVisionRecipe::getSideData(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CBlSideData *pSideData = m_pBlSideData[idx];
+	Unlock();
+
+	return pSideData;
+}
+
+int CVisionRecipe::setRecipeType(int nType) {
+	/* code */
+	m_nRecipeType = nType;
+	return 0;
+}
+
+int CVisionRecipe::getRecipeType(void) {
+	/* code */
+	return m_nRecipeType;
+}
+
+bool CVisionRecipe::getVisionUse(void) {
+	/* code */
+	return m_visionDisplayInfo.isVisionDisplay;
+}
+
+int CVisionRecipe::setVisionName(const char* pszPath) {
+	/* code */
+	if (nullptr == pszPath || std::string(pszPath).length() < 1){
+		return -1;
+	}
+
+	m_strVisionName = pszPath;
+	m_configVision.SetWorkDir(m_workDir.c_str() , m_strVisionName.c_str());
+	return true;
+}
+
+int CVisionRecipe::setProductNo(const char* pszNo) {
+	/* code */
+	m_strProductNo = pszNo;
+	return 0;
+}
+
+//14. 获取配方名称
+std::string CVisionRecipe::getVisionName() {
+	/* code */
+	return m_strVisionName;
+}
+
+std::string CVisionRecipe::getProductNo(void) {
+	/* code */
+	return m_strProductNo;
+}
+
+void CVisionRecipe::setGlassSize(int x, int y) {
+	/* code */
+	m_mScanSetting.lengthSize = x;
+	m_mScanSetting.shortSize = y;
+}
+
+void CVisionRecipe::SetMainDlg(CDialogEx *pDlg) {
+	/* code */
+	m_pMainDlg = pDlg;
+}
+
+CDialogEx* CVisionRecipe::GetMainDlg(void) {
+	/* code */
+	return m_pMainDlg;
+}
+
+CCornerRcutProcess* CVisionRecipe::getCornerRcutProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CCornerRcutProcess *dot = m_pCornerRcutProcess[idx];
+	Unlock();
+	return dot;
+}
+
+CLocProcess* CVisionRecipe::getLocProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CLocProcess *dot = m_pLocProcese[idx];
+	Unlock();
+
+	return dot;
+}
+
+CCutProcess* CVisionRecipe::getCutProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CCutProcess *dot = m_pCutProcess[idx];
+	Unlock();
+
+	return dot;
+}
+
+CKDistProcess* CVisionRecipe::getKDistProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CKDistProcess *dot = m_pKDistProcess[idx];
+	Unlock();
+
+	return dot;
+}
+
+CGrindProcess* CVisionRecipe::getGrindProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CGrindProcess *dot = m_pGrindProcess[idx];
+	Unlock();
+	return dot;
+}
+
+CThresProcess* CVisionRecipe::getThresProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CThresProcess *dot = m_pThresProcess[idx];
+	Unlock();
+	return dot;
+}
+
+CHoleProcess* CVisionRecipe::getHoleProcess(DimensionDir eDir) {
+	/* code */
+	int idx = (int)(eDir);
+	int fz = (int)(DIMENSION_NONE);
+	if (idx < 0 || idx >= fz) return NULL;
+
+	Lock();
+	CHoleProcess* dot = m_pHoleProcess[idx];
+	Unlock();
+	return dot;
+}
+
+ScanSetting CVisionRecipe::getScanSetting(void) {
+	/* code */
+	return m_mScanSetting;
+}
+
+void CVisionRecipe::setScanSetting(ScanSetting inf) {
+	/* code */
+	m_mScanSetting = inf;
+}
+
+void CVisionRecipe::saveVisionConfig(void) {
+	/* code */
+	//保存显示
+	std::string strSection = "Vision Display";
+	m_configVision.WriteBool(strSection.c_str(), "Vision Show", m_visionDisplayInfo.isVisionDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "Dist Show", m_visionDisplayInfo.isDistDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "RCUT Show", m_visionDisplayInfo.isRcutDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "Grind Show", m_visionDisplayInfo.isGrindDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "CUT Show", m_visionDisplayInfo.isCutDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "Thres Show", m_visionDisplayInfo.isThresDisplay);
+	m_configVision.WriteBool(strSection.c_str(), "Hole Show", m_visionDisplayInfo.isHoleDisplay);
+
+	std::string array_dir_use[8] = { "A TOP","B TOP", "C TOP", "D TOP", "A BOT", "B BOT","C BOT", "D BOT" };
+	for (int i = 0; i < 8; i++) {
+		strSection = array_dir_use[i];
+		m_configVision.WriteBool(strSection.c_str(), "Vision Use", m_visionUseInfo[i].isVisionUse);
+		m_configVision.WriteBool(strSection.c_str(), "LOC Use", m_visionUseInfo[i].isLocUse);
+		m_configVision.WriteBool(strSection.c_str(), "Dist Use", m_visionUseInfo[i].isDistUse);
+		m_configVision.WriteBool(strSection.c_str(), "RCUT Use", m_visionUseInfo[i].isRcutUse);
+		m_configVision.WriteBool(strSection.c_str(), "Grind Use", m_visionUseInfo[i].isGrindUse);
+		m_configVision.WriteBool(strSection.c_str(), "Cut Use", m_visionUseInfo[i].isCutUse);
+		m_configVision.WriteBool(strSection.c_str(), "Thres Use", m_visionUseInfo[i].isThresUse);
+		m_configVision.WriteBool(strSection.c_str(), "Hole Use", m_visionUseInfo[i].isHoleUse);
+	}
+
+	strSection = "Scan";
+	m_configVision.WriteInt(strSection.c_str(), "Length Size", m_mScanSetting.lengthSize);
+	m_configVision.WriteInt(strSection.c_str(), "Short Size", m_mScanSetting.shortSize);
+	m_configVision.WriteInt(strSection.c_str(), "Standard Point", m_mScanSetting.nStdIndex);
+	m_configVision.WriteInt(strSection.c_str(), "First Point", m_mScanSetting.nIndex0);
+	m_configVision.WriteInt(strSection.c_str(), "Second Point", m_mScanSetting.nIndex1);
+	m_configVision.WriteInt(strSection.c_str(), "Third Point", m_mScanSetting.nIndex2);
+	m_configVision.WriteInt(strSection.c_str(), "Fourth Point", m_mScanSetting.nIndex3);
+	m_configVision.WriteInt(strSection.c_str(), "Length Scan", m_mScanSetting.nLengthScan);
+	m_configVision.WriteInt(strSection.c_str(), "Short Scan", m_mScanSetting.nShortScan);
+}
+
+void CVisionRecipe::readVisionConfig(void) {
+	/* code */
+	std::string strSection = "Vision Display";
+	m_visionDisplayInfo.isVisionDisplay = m_configVision.ReadBool(strSection.c_str(), "Vision Show", false);
+	m_visionDisplayInfo.isDistDisplay = m_configVision.ReadBool(strSection.c_str(), "Dist Show", false);
+	m_visionDisplayInfo.isRcutDisplay = m_configVision.ReadBool(strSection.c_str(), "RCUT Show", false);
+	m_visionDisplayInfo.isGrindDisplay = m_configVision.ReadBool(strSection.c_str(), "Grind Show", false);
+	m_visionDisplayInfo.isCutDisplay = m_configVision.ReadBool(strSection.c_str(), "CUT Show", false);
+	m_visionDisplayInfo.isThresDisplay = m_configVision.ReadBool(strSection.c_str(), "Thres Show", false);
+	m_visionDisplayInfo.isHoleDisplay = m_configVision.ReadBool(strSection.c_str(), "Hole Show", false);
+
+
+	std::string array_dir_use[8] = { "A TOP","B TOP", "C TOP", "D TOP", "A BOT", "B BOT","C BOT", "D BOT" };
+	for (int i = 0; i < 8; i++) {
+		strSection = array_dir_use[i];
+		m_visionUseInfo[i].isVisionUse = m_configVision.ReadBool(strSection.c_str(), "Vision Use", false);
+		m_visionUseInfo[i].isLocUse = m_configVision.ReadBool(strSection.c_str(), "LOC Use", false);
+		m_visionUseInfo[i].isDistUse = m_configVision.ReadBool(strSection.c_str(), "Dist Use", false);
+		m_visionUseInfo[i].isRcutUse = m_configVision.ReadBool(strSection.c_str(), "RCUT Use", false);
+		m_visionUseInfo[i].isGrindUse = m_configVision.ReadBool(strSection.c_str(), "Grind Use", false);
+		m_visionUseInfo[i].isCutUse = m_configVision.ReadBool(strSection.c_str(), "Cut Use", false);
+		m_visionUseInfo[i].isThresUse = m_configVision.ReadBool(strSection.c_str(), "Thres Use", false);
+		m_visionUseInfo[i].isHoleUse = m_configVision.ReadBool(strSection.c_str(), "Hole Use", false);
+	}
+
+	strSection = "Scan";
+	m_mScanSetting.lengthSize = m_configVision.ReadInt(strSection.c_str(), "Length Size", 0);
+	m_mScanSetting.shortSize = m_configVision.ReadInt(strSection.c_str(), "Short Size",0);
+	m_mScanSetting.nStdIndex = m_configVision.ReadInt(strSection.c_str(), "Standard Point", 0);
+	m_mScanSetting.nIndex0 = m_configVision.ReadInt(strSection.c_str(), "First Point", 0);
+	m_mScanSetting.nIndex1 = m_configVision.ReadInt(strSection.c_str(), "Second Point", 0);
+	m_mScanSetting.nIndex2 = m_configVision.ReadInt(strSection.c_str(), "Third Point", 0);
+	m_mScanSetting.nIndex3 = m_configVision.ReadInt(strSection.c_str(), "Fourth Point", 0);
+	m_mScanSetting.nLengthScan = m_configVision.ReadInt(strSection.c_str(), "Length Scan", 0);
+	m_mScanSetting.nShortScan = m_configVision.ReadInt(strSection.c_str(), "Short Scan", 0);
+}
+
+VisionUseInfo CVisionRecipe::getVisionUse(DimensionDir eDir) {
+	/* code */
+	VisionUseInfo inf;
+	inf.isVisionUse = false;
+	inf.isLocUse = false;
+	inf.isDistUse = false;
+	inf.isRcutUse = false;
+	int index = (int)(eDir);
+	if (index < 0 || index > 7) return inf;
+
+	inf = m_visionUseInfo[index];
+	return inf;
+}
+
+void CVisionRecipe::setVisionUse(VisionUseInfo inf, DimensionDir eDir) {
+	/* code */
+	int index = (int)(eDir);
+	if (index < 0 || index > 7) return;
+
+	m_visionUseInfo[index] = inf;
+}
+
+VisionDisplayInfo CVisionRecipe::getVisionDisplay(void) {
+	/* code */
+	return m_visionDisplayInfo;
+}
+
+void CVisionRecipe::setVisionDisplay(VisionDisplayInfo inf) {
+	/* code */
+	m_visionDisplayInfo = inf;
+}
+
+KeyDebugInfo CVisionRecipe::getKeyInfo(void) {
+	/* code */
+	return m_keyInfo;
+}
+
+void CVisionRecipe::setKeyInfo(KeyDebugInfo info) {
+	/* code */
+	m_keyInfo = info;
+}
+
+void CVisionRecipe::setVisionSetOpen(BOOL isOpen) {
+	/* code */
+	m_isOpenVisionDlg = isOpen;
+}
+
+void CVisionRecipe::setStage(int nStage) {
+	/* code */
+    m_nStage = nStage;
+}
+
+int CVisionRecipe::getStage(void) {
+	/* code */
+    return m_nStage;
+}
+
+BOOL CVisionRecipe::getVisionSetOpen(void) {
+	/* code */
+	return m_isOpenVisionDlg;
+}
+
+void CVisionRecipe::setFrame(int x1, int y1, int x2, int y2) {
+	/* code */
+	m_nFrameX1 = x1;
+	m_nFrameY1 = y1;
+	m_nFrameX2 = x2;
+	m_nFrameY2 = y2;
+}
+
+bool CVisionRecipe::getFrame(int &x1, int &y1, int &x2, int &y2) {
+	/* code */
+	x1 = m_nFrameX1;
+	y1 = m_nFrameY1;
+	x2 = m_nFrameX2;
+	y2 = m_nFrameY2;
+	bool result = false;
+	if (x1 >= 0 && y1 >= 0 && x2 > x1 && y2 > y1) result = true;
+	return true;
+}
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/Vision/VisionRecipe.h b/Common_Class/BlVisionPro/Vision/VisionRecipe.h
new file mode 100644
index 0000000..a562ef1
--- /dev/null
+++ b/Common_Class/BlVisionPro/Vision/VisionRecipe.h
@@ -0,0 +1,234 @@
+#ifndef VISION_RECIPE_H
+#define VISION_RECIPE_H
+
+#include "IVisionRecipe.h"
+#include "CornerDistProcess.h"
+#include "BlSideData.h"
+#include "CornerRcutProcess.h"
+#include "ConfigVision.h"
+#include "LocProcess.h"
+#include "CutProcess.h"
+#include "KDistProcess.h"
+#include "GrindProcess.h"
+#include "ThresProcess.h"
+#include "HoleProcess.h"
+
+typedef struct LineCameraSetting
+{
+	DimensionDir eDir;  //相机类型  
+	int nCam;           //相机序号
+	int nScan;          //扫描号
+}LineCameraSetting;
+
+//配方数据管理
+class CVisionRecipe : public IVisionRecipe
+{
+public:
+	CVisionRecipe();
+	virtual ~CVisionRecipe();
+
+	static CVisionRecipe* getInstance(void);
+
+public:
+	//1. 设置配方路径
+	virtual int setWorkDir(const char *pszPath);
+
+	//2. 保存
+	virtual int save(void);
+
+	//3. 打开
+	virtual int open(void);
+
+	//4. 获取采集卡
+	virtual CGrabberControl* getGrabberControl(int iCam);
+
+	//5. 设置采集开
+	virtual int setGrabberControl(CGrabberControl *pGrabberControl, int iCam);
+
+	//6. 相机相机信息
+	virtual int setCameraSetting(DimensionDir eDir, int iCam, int iScan);
+
+	//7. 初始化
+	virtual int init(void);
+
+	//8. 获取SideData
+	virtual CBlSideData* getSideData(DimensionDir eDir);
+
+	//9. 设置配方类型
+	virtual int setRecipeType(int nType);
+
+	//10. 获取配方类型
+	virtual int getRecipeType(void);
+
+	//11. 视觉启用
+	virtual bool getVisionUse(void);
+
+	//12.设置区域
+	virtual void setFrame(int x1, int y1, int x2, int y2);
+	bool getFrame(int &x1, int &y1, int &x2, int &y2);
+
+	//13. 设置配方名称
+	virtual int setVisionName(const char* pszPath);
+	virtual int setProductNo(const char* pszNo);
+
+	//14. 获取配方名称
+	virtual std::string getVisionName();
+	std::string getProductNo(void);
+
+	//15. 设置屏幕尺寸
+	virtual void setGlassSize(int x, int y);
+	virtual BOOL getVisionSetOpen(void);
+
+public:
+	//1. 获取采集相机的序号
+	int getCameraIndex(DimensionDir eDir);
+
+	//2. 获取采集的SCAN
+	int getCameraScan(DimensionDir eDir);
+
+	//3. 获取数据
+	CCornerDistProcess* getCornerDistProcess(DimensionDir eDir);
+
+	//4. 设置窗体
+	void SetMainDlg(CDialogEx *pDlg);
+
+	//5. 获取窗体
+	CDialogEx* GetMainDlg(void);
+
+	//6. 获取数据
+	CCornerRcutProcess* getCornerRcutProcess(DimensionDir eDir);
+	CLocProcess* getLocProcess(DimensionDir eDir);
+	CCutProcess* getCutProcess(DimensionDir eDir);
+	CKDistProcess* getKDistProcess(DimensionDir eDir);
+	CGrindProcess* getGrindProcess(DimensionDir eDir);
+	CThresProcess* getThresProcess(DimensionDir eDir);
+	CHoleProcess* getHoleProcess(DimensionDir eDir);
+	
+
+	//7. 获取参数
+	ScanSetting getScanSetting(void);
+	void setScanSetting(ScanSetting inf);
+
+	//8. 保存数据
+	void saveVisionConfig(void);
+	void readVisionConfig(void);
+
+	//9. 获取软件的使能
+	VisionUseInfo getVisionUse(DimensionDir eDir);
+	void setVisionUse(VisionUseInfo inf, DimensionDir eDir);
+
+	//10. 获取显示
+	VisionDisplayInfo getVisionDisplay(void);
+	void setVisionDisplay(VisionDisplayInfo inf);
+
+	//11. 获取Key
+	KeyDebugInfo getKeyInfo(void);
+	void setKeyInfo(KeyDebugInfo info);
+
+	//12. 打开
+	void setVisionSetOpen(BOOL isOpen);
+
+	//13. 设置/获取平台
+	void setStage(int nStage);
+	int getStage(void);
+
+private:
+	bool m_isInit;
+	std::string m_workDir;
+	CGrabberControl *m_pGrabberControl[MAX_CAMERA_COUNT];
+	std::map<int, LineCameraSetting*> m_mapLineCameraSetting;
+	CCornerDistProcess *m_pCornerDistProcess[DIMENSION_NONE];
+	CBlSideData *m_pBlSideData[DIMENSION_NONE];                       //检测结果
+	CCornerRcutProcess *m_pCornerRcutProcess[DIMENSION_NONE];
+	CLocProcess *m_pLocProcese[DIMENSION_NONE];
+
+	CCutProcess *m_pCutProcess[DIMENSION_NONE];
+	CKDistProcess *m_pKDistProcess[DIMENSION_NONE];
+	CGrindProcess *m_pGrindProcess[DIMENSION_NONE];
+	CThresProcess *m_pThresProcess[DIMENSION_NONE];
+
+	CHoleProcess *m_pHoleProcess[DIMENSION_NONE];
+	
+
+	int m_nRecipeType;
+	std::string m_strVisionName;
+	std::string m_strProductNo;
+
+	VisionDisplayInfo m_visionDisplayInfo;
+	VisionUseInfo m_visionUseInfo[DIMENSION_NONE];
+
+	CDialogEx *m_pMainDlg;
+
+	ScanSetting m_mScanSetting;
+	CConfigVision m_configVision;
+
+	CStdioFile m_recipeFile;
+	KeyDebugInfo m_keyInfo;
+
+	BOOL m_isOpenVisionDlg;
+
+	int m_nFrameX1;
+	int m_nFrameY1;
+	int m_nFrameX2;
+	int m_nFrameY2;
+
+	int m_nStage;      //平台
+
+	CRITICAL_SECTION m_criticalSection;
+
+private:
+	inline void Lock() { EnterCriticalSection(&m_criticalSection); }
+	inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
+
+	//1. 释放
+	void release(void);
+
+	//2. 释放数据
+	void releaseLineCameraSetting(void);
+
+	//3. 创建CornerDistProcess
+	void createAllCornerDistProcess(void);
+	void createAllCornerRcutProcess(void);
+	void createAllLocProcess(void);
+	void createCutProcess(void);
+	void createKDistProcess(void);
+	void createGrindProcess(void);
+	void createThresProcess(void);
+	void createHoleProcess(void);
+
+	//4. 释放数据
+	void releaaseAllCornerDistProcess(void);
+	void releaseAllCornerRcutProcess(void);
+	void releaseAllLocProcess(void);
+	void releaseAllCutProcess(void);
+	void releaseAllKDistProcess(void);
+	void releaseAllGrindProcess(void);
+	void releaseAllThresProcess(void);
+	void releaseAllHoleProcess(void);
+
+	//5. 保存数据
+	int saveRecipeFile(std::string filePath);
+
+	//6. 反序列化
+	int openRecipeFile(std::string filePath);
+
+	//7. 创建SideData数据
+	void createSideData(void);
+
+	//8. 释放数据
+	void releaaseAllSideData(void);
+
+	//9. 保存数据
+	int WriteRecipeVisionFile(void);
+
+	//10. 读取文件
+	void ReadRecipeFile(void);
+
+	//11. 解释数据
+//	void DecodeRecipeText(CString strText);
+
+	//12. 解释数据
+	void DecodeJson(Json::Value jsFileRoot);
+};
+
+#endif
\ No newline at end of file
diff --git a/Common_Class/BlVisionPro/res/BlVisionPro.rc2 b/Common_Class/BlVisionPro/res/BlVisionPro.rc2
new file mode 100644
index 0000000..26bcdf5
--- /dev/null
+++ b/Common_Class/BlVisionPro/res/BlVisionPro.rc2
Binary files differ
diff --git a/Common_Class/BlVisionPro/res/navigate_down.ico b/Common_Class/BlVisionPro/res/navigate_down.ico
new file mode 100644
index 0000000..438e0ca
--- /dev/null
+++ b/Common_Class/BlVisionPro/res/navigate_down.ico
Binary files differ
diff --git a/Common_Class/BlVisionPro/res/navigate_left.ico b/Common_Class/BlVisionPro/res/navigate_left.ico
new file mode 100644
index 0000000..f19c602
--- /dev/null
+++ b/Common_Class/BlVisionPro/res/navigate_left.ico
Binary files differ
diff --git a/Common_Class/BlVisionPro/res/navigate_right.ico b/Common_Class/BlVisionPro/res/navigate_right.ico
new file mode 100644
index 0000000..fe03c0d
--- /dev/null
+++ b/Common_Class/BlVisionPro/res/navigate_right.ico
Binary files differ
diff --git a/Common_Class/BlVisionPro/res/navigate_up.ico b/Common_Class/BlVisionPro/res/navigate_up.ico
new file mode 100644
index 0000000..d33d49f
--- /dev/null
+++ b/Common_Class/BlVisionPro/res/navigate_up.ico
Binary files differ
diff --git a/Common_Class/BlVisionPro/resource.h b/Common_Class/BlVisionPro/resource.h
new file mode 100644
index 0000000..ed11d66
--- /dev/null
+++ b/Common_Class/BlVisionPro/resource.h
Binary files differ
diff --git a/Common_Class/BlVisionPro/stdafx.cpp b/Common_Class/BlVisionPro/stdafx.cpp
new file mode 100644
index 0000000..1633746
--- /dev/null
+++ b/Common_Class/BlVisionPro/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : 只包括标准包含文件的源文件
+// BlVisionPro.pch 将作为预编译头
+// stdafx.obj 将包含预编译类型信息
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/BlVisionPro/stdafx.h b/Common_Class/BlVisionPro/stdafx.h
new file mode 100644
index 0000000..07aefc0
--- /dev/null
+++ b/Common_Class/BlVisionPro/stdafx.h
@@ -0,0 +1,41 @@
+// stdafx.h : 标准系统包含文件的包含文件,
+// 或是经常使用但不常更改的
+// 特定于项目的包含文件
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
+
+#include <afxwin.h>         // MFC 核心组件和标准组件
+#include <afxext.h>         // MFC 扩展
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE 类
+#include <afxodlgs.h>       // MFC OLE 对话框类
+#include <afxdisp.h>        // MFC 自动化类
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 数据库类
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 数据库类
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+#include "IncludeVision.h"
+#include <afxcontrolbars.h>
diff --git a/Common_Class/BlVisionPro/targetver.h b/Common_Class/BlVisionPro/targetver.h
new file mode 100644
index 0000000..416cebf
--- /dev/null
+++ b/Common_Class/BlVisionPro/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include <SDKDDKVer.h>
diff --git a/Common_Class/CHImageBuffer/CHImageBuffer.cpp b/Common_Class/CHImageBuffer/CHImageBuffer.cpp
new file mode 100644
index 0000000..71baf20
--- /dev/null
+++ b/Common_Class/CHImageBuffer/CHImageBuffer.cpp
@@ -0,0 +1,9 @@
+// CHImageBuffer.cpp : 定义应用程序的类行为。
+
+#include "stdafx.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
diff --git a/Common_Class/CHImageBuffer/CHImageBuffer.def b/Common_Class/CHImageBuffer/CHImageBuffer.def
new file mode 100644
index 0000000..79821a8
--- /dev/null
+++ b/Common_Class/CHImageBuffer/CHImageBuffer.def
@@ -0,0 +1,6 @@
+; CHImageBuffer.def : 定义DLL的模块参数。
+
+LIBRARY      "CHImageBuffer"
+
+EXPORTS
+    ; 您可以在这里使用显式导出。
diff --git a/Common_Class/CHImageBuffer/CHImageBuffer.rc b/Common_Class/CHImageBuffer/CHImageBuffer.rc
new file mode 100644
index 0000000..680da37
--- /dev/null
+++ b/Common_Class/CHImageBuffer/CHImageBuffer.rc
Binary files differ
diff --git a/Common_Class/CHImageBuffer/CHImageBuffer.sln b/Common_Class/CHImageBuffer/CHImageBuffer.sln
new file mode 100644
index 0000000..0537951
--- /dev/null
+++ b/Common_Class/CHImageBuffer/CHImageBuffer.sln
@@ -0,0 +1,26 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CHImageBuffer", "CHImageBuffer.vcxproj", "{C7329FF2-46AB-447B-9761-EC4C45E33A7D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Debug|Win32.Build.0 = Debug|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Debug|x64.ActiveCfg = Debug|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Debug|x64.Build.0 = Debug|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Release|Win32.ActiveCfg = Release|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Release|Win32.Build.0 = Release|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Release|x64.ActiveCfg = Release|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/Common_Class/CHImageBuffer/CHImageBuffer.vcxproj b/Common_Class/CHImageBuffer/CHImageBuffer.vcxproj
new file mode 100644
index 0000000..a95d89c
--- /dev/null
+++ b/Common_Class/CHImageBuffer/CHImageBuffer.vcxproj
@@ -0,0 +1,357 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Simulation|Win32">
+      <Configuration>Simulation</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Simulation|x64">
+      <Configuration>Simulation</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{C7329FF2-46AB-447B-9761-EC4C45E33A7D}</ProjectGuid>
+    <RootNamespace>CHImageBuffer</RootNamespace>
+    <Keyword>MFCDLLProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <TargetName>$(ProjectName)D</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <TargetName>$(ProjectName)D</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <TargetName>$(ProjectName)D</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\OpenCV\opencv_3.1\include;..\OpenCV\opencv_3.1\include\opencv;..\OpenCV\opencv_3.1\include\opencv2;.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\CHImageBuffer.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);..\OpenCV\opencv_3.1\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>opencv_core310.lib;opencv_highgui310.lib;opencv_imgproc310.lib;opencv_imgcodecs310.lib;d2d1.lib;Windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\CHImageBuffer.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\OpenCV\opencv_3.1\include;..\OpenCV\opencv_3.1\include\opencv;..\OpenCV\opencv_3.1\include\opencv2;.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\CHImageBufferD.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);..\OpenCV\opencv_3.1\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>opencv_core310.lib;opencv_highgui310.lib;opencv_imgproc310.lib;opencv_imgcodecs310.lib;d2d1.lib;Windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <ImportLibrary>
+      </ImportLibrary>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>.\External_Library\opencv_3.1\include;.\External_Library\opencv_3.1\include\opencv;.\External_Library\opencv_3.1\include\opencv2;.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\CHImageBufferD.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);.\External_Library\opencv_3.1\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>opencv_core310.lib;opencv_highgui310.lib;opencv_imgproc310.lib;opencv_imgcodecs310.lib;d2d1.lib;Windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <ImportLibrary>..\Library\CommonLibs\$(TargetName).lib</ImportLibrary>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\CHImageBuffer.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>..\OpenCV\opencv_3.1\include;..\OpenCV\opencv_3.1\include\opencv;..\OpenCV\opencv_3.1\include\opencv2;.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\CHImageBuffer.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);..\OpenCV\opencv_3.1\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>opencv_core310.lib;opencv_highgui310.lib;opencv_imgproc310.lib;opencv_imgcodecs310.lib;d2d1.lib;Windowscodecs.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ImportLibrary>
+      </ImportLibrary>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <PreBuildEvent>
+      <Command>
+      </Command>
+    </PreBuildEvent>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\CHImageBuffer\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\CHImageBuffer\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\CHImageBuffer\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\ImageBuffer.h" "$(SolutionDir)Lib\CHImageBuffer\include\ImageBuffer.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\ImageViewer.h" "$(SolutionDir)Lib\CHImageBuffer\include\ImageViewer.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <None Include="CHImageBuffer.def" />
+    <None Include="CHImageBufferD.def" />
+    <None Include="ReadMe.txt" />
+    <None Include="res\CHImageBuffer.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="CHImageBuffer.cpp" />
+    <ClCompile Include="dllmain.cpp">
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="ImageBuffer.cpp" />
+    <ClCompile Include="ImageTracker.cpp" />
+    <ClCompile Include="ImageViewer.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\ImageBuffer.h" />
+    <ClInclude Include="Header\ImageViewer.h" />
+    <ClInclude Include="ImageTracker.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="CHImageBuffer.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="CHImageBuffer.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/CHImageBuffer/CHImageBuffer.vcxproj.filters b/Common_Class/CHImageBuffer/CHImageBuffer.vcxproj.filters
new file mode 100644
index 0000000..8d3f248
--- /dev/null
+++ b/Common_Class/CHImageBuffer/CHImageBuffer.vcxproj.filters
@@ -0,0 +1,74 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="CHImageBuffer.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\CHImageBuffer.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="CHImageBufferD.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="CHImageBuffer.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="dllmain.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ImageBuffer.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ImageViewer.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ImageTracker.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ImageBuffer.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ImageViewer.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="ImageTracker.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="CHImageBuffer.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/CHImageBuffer/CHImageBufferD.def b/Common_Class/CHImageBuffer/CHImageBufferD.def
new file mode 100644
index 0000000..48172fc
--- /dev/null
+++ b/Common_Class/CHImageBuffer/CHImageBufferD.def
@@ -0,0 +1,6 @@
+; CHImageBufferD.def : 定义DLL的模块参数。
+
+LIBRARY      "CHImageBufferD"
+
+EXPORTS
+    ; 您可以在这里使用显式导出。
diff --git a/Common_Class/CHImageBuffer/Header/ImageBuffer.h b/Common_Class/CHImageBuffer/Header/ImageBuffer.h
new file mode 100644
index 0000000..50e5ff3
--- /dev/null
+++ b/Common_Class/CHImageBuffer/Header/ImageBuffer.h
@@ -0,0 +1,101 @@
+#pragma once
+
+#include "cxcore.h"
+#include "cv.h"
+#include "highgui.h"
+
+enum ImageBandType	{ ImageBand_Red=0, ImageBand_Green, ImageBand_Blue, ImageBand_Gray, ImageBand_Color, ImageBand_Count };
+
+class AFX_EXT_CLASS CImageBuffer
+{
+public:
+	CImageBuffer(void);
+	CImageBuffer(int nWidth, int nHeight, int nDepth=8, int nChannels=1);
+	virtual ~CImageBuffer(void);
+
+public: // virtual functions
+	virtual BOOL	CreateImage(int nWidth, int nHeight, int nDepth=8, int nChannels=1);
+	virtual BOOL	CreateImageHeader(int nWidth, int nHeight, int nDepth=8, int nChannels=1);
+	virtual BOOL	GetImageExist(void) const;
+	virtual BOOL	GetAllocatedData(void) const;
+
+	virtual void	ReleaseImage(void);
+	virtual int		GetHeight(void) const;
+	virtual int		GetWidth(void) const;
+	virtual int		GetWidthStep(void) const;
+	virtual int		GetDepth(void) const;
+	virtual int		GetChannels(void) const;
+	virtual int		GetBpp(void) const;
+	virtual int		GetImageSize(void) const;
+
+	virtual char*	GetImageBuffer(void);
+	virtual char*	GetImageBufferOrigin(void);
+	virtual const char*	GetImageBuffer(void) const;
+	virtual const char*	GetImageBufferOrigin(void) const;
+	virtual int		GetPixelValue(int x, int y) const;
+	virtual int		SetPixelValue(int x, int y, int nR, int nG, int nB);
+	virtual int		SetPixelValue(int x, int y, int nR, int nG, int nB, int nA);
+
+	virtual BOOL	LoadImage(const CString& strFilename);
+	virtual BOOL	SaveImage(const CString& strFilename, int nQiality=95) const;
+
+public: // common functions
+	// clear
+	BOOL	ClearImage(int nValue);
+	BOOL	ClearImage(int nValue, int nA);
+
+	// copy func
+	BOOL	CopyImageTo(CImageBuffer *pToImage) const;
+	BOOL	CopyImageTo(IplImage *pToImage) const;
+	BOOL	CopyImageFrom(const CImageBuffer *pFromImage);
+	BOOL	CopyImageFrom(const IplImage *pFromImage);
+
+	// show func
+	void	ShowImage(HDC hDC, const CRect& dstRect);
+	void	ShowImage(HDC hDC, const CRect& srcRect, const CRect& dstRect);
+	void	ShowImage(HDC hDC, int nSx, int nSy, int nWidth, int nHeight, int nFromX, int nFromY);
+
+	// get image data
+	BOOL	GetSubImage(int nSx, int nSy, int nWidth, int nHeight, CImageBuffer *pGetImage);
+	BOOL	GetSubImage(int nSx, int nSy, int nWidth, int nHeight, int nChannels, BYTE *pGetBuffer);
+	BOOL	GetSubImage(const CRect& rtRect, CImageBuffer *pGetImage);
+	BOOL	GetSubImage(const CRect& rtRect, int nChannels, BYTE *pGetBuffer);
+
+	BOOL	GetBandImage(int nColorBand, CImageBuffer* pGetImage) const;
+	BOOL	GetBandImage(int nColorBand, int nSx, int nSy, int nWidth, int nHeight, CImageBuffer* pGetImage);
+	BOOL	GetBandImage(int nColorBand, int nSx, int nSy, int nWidth, int nHeight, BYTE* pGetBuffer);
+	BOOL	GetBandImage(int nColorBand, const CRect& rtRect, CImageBuffer* pGetImage);
+	BOOL	GetBandImage(int nColorBand, const CRect& rtRect, BYTE* pGetBuffer);
+
+	// set image data
+	BOOL	SetSubImage(int nSx, int nSy, int nWidth, int nHeight, CImageBuffer* pSetImage);
+	BOOL	SetSubImage(int nSx, int nSy, int nWidth, int nHeight, int nBpp, BYTE *pSetBuffer);
+	BOOL	SetSubImage(const CRect& rtRect, CImageBuffer *pSetImage);
+	BOOL	SetSubImage(const CRect& rtRect, int nChannels, BYTE *pSetBuffer);
+
+	// draw function
+	BOOL	DrawLine(CPoint ptPos1, CPoint ptPos2, DWORD nColor, int nThickness=1, int nLineType=8, int nShift=0 );
+	BOOL	DrawRectangle(CPoint ptPos1, CPoint ptPos2, DWORD nColor, int nThickness=1, int nLineType=8, int nShift=0 );
+	BOOL	DrawCircle(CPoint ptCenter, int nRadius, DWORD nColor, int nThickness=1, int nLineType=8, int nShift=0 );
+	BOOL	DrawEllipse(CPoint ptCenter, CPoint ptSize, double dAngle, DWORD nColor, int nThickness=1, int nLineType=8, int nShift=0);
+	BOOL	DrawText(CPoint ptPoint, DWORD nColor, const CString& strText);
+
+	// buffer access
+	IplImage*			GetIplImage(void);
+	BOOL				SetImageBufferPtr(char* pPtr);
+
+	BOOL			DIBtoIplImage(HBITMAP& hbmp, HDC hdc=NULL);
+	BOOL			DCtoIplImage(CDC* pDC, const CRect& rect);
+
+	// 4Ch Image..
+	CvScalar GetPixelScalar(int x, int y);
+
+protected:
+	static void		FillBitmapInfo(BITMAPINFO* bmi, int width, int height, int bpp, int origin);
+
+	BOOL		m_bAllocatedData;
+
+public:
+	IplImage	*m_pImageData;
+};
+
diff --git a/Common_Class/CHImageBuffer/Header/ImageViewer.h b/Common_Class/CHImageBuffer/Header/ImageViewer.h
new file mode 100644
index 0000000..a0ffaa1
--- /dev/null
+++ b/Common_Class/CHImageBuffer/Header/ImageViewer.h
@@ -0,0 +1,219 @@
+#pragma once
+
+
+// CImageViewer
+
+#include "ImageBuffer.h"
+#include <d2d1.h>
+#include <wincodec.h>
+#include <vector>
+#include <list>
+#include "afxmt.h"
+
+enum ViewScaleType			{ ViewScale_Origin=0, ViewScale_Zoom, ViewScale_Fit, ViewScale_Count };
+enum DrawObjectType			{ DrawObject_Line=0, DrawObject_Rectangle, DrawObject_Ellipse, DrawObject_Polygon, DrawObject_Count };
+enum ColorBandShiftValue	{ AlphaShiftValue = 24, RedShiftValue = 16, GreenShiftValue = 8, BlueShiftValue = 0 };
+
+#define SafeRelease(T)		if(T)	{T->Release(); T = 0; }
+#define SafeDelete(T)		if(T)	{delete T; T = 0; }
+
+static UINT MakeColor(BYTE a, BYTE r, BYTE g, BYTE b)
+{
+	return (((UINT) (b) <<  BlueShiftValue) |
+		((UINT) (g) <<	GreenShiftValue) |
+		((UINT) (r) <<  RedShiftValue) |
+		((UINT) (a) <<	AlphaShiftValue));
+}
+
+struct SDoublePos
+{
+	SDoublePos(double dX=0, double dY=0) 
+	{
+		dPosX = dX;
+		dPosY = dY;
+	}
+	double dPosX;
+	double dPosY;
+};
+typedef std::vector<SDoublePos>						VectorDoublePos;
+typedef std::vector<SDoublePos>::iterator			VectorDoublePosIt;
+typedef std::vector<SDoublePos>::const_iterator		constVectorDoublePosIt;
+
+struct SDrawObject
+{
+public:
+	SDrawObject()	{ Reset(); }
+	~SDrawObject()	{ Reset(); }
+
+	void Reset()
+	{
+		nIndex			= 0;
+		nType			= DrawObject_Line;
+		strName			= _T("");
+		nPenColor		= MakeColor(0,255,0,0);
+		nBrushColor		= MakeColor(0,0,0,0);
+		dPenOpacity		= 0.6;
+		dBrushOpacity	= 0.2;
+		dPenSize		= 1; // 1pixel
+
+		dPosX			= 0.0;			
+		dPosY			= 0.0;		
+		dSizeX			= 0.0;
+		dSizeY			= 0.0;
+
+		vecPolygon.clear();
+	}
+
+	double Left() const		{ return dPosX; }
+	double Top() const		{ return dPosY; }
+	double Right() const	{ return (dPosX+dSizeX); }
+	double Bottom() const	{ return (dPosY+dSizeY); }
+	double Width() const	{ return dSizeX; }
+	double Height() const	{ return dSizeY; }
+
+	int				nIndex;
+	int				nType;
+	CString			strName;
+	UINT			nPenColor;
+	double			dPenOpacity;	//(0~1)
+	UINT			nBrushColor;	//
+	double			dBrushOpacity;	//(0~1)
+
+	double			dPenSize;
+	double			dPosX;
+	double			dPosY;
+	double			dSizeX;
+	double			dSizeY;
+
+	VectorDoublePos	vecPolygon;
+};
+typedef std::list<SDrawObject>					ListDrawObject;
+typedef std::list<SDrawObject>::iterator		ListDrawObjectIt;
+typedef std::list<SDrawObject>::const_iterator	constListDrawObjectIt;
+
+class AFX_EXT_CLASS CImageViewer : public CWnd, public CImageBuffer
+{
+	DECLARE_DYNAMIC(CImageViewer)
+
+public:
+	CImageViewer(CWnd* pParentWnd=NULL);
+	virtual ~CImageViewer();
+
+	BOOL LoadImage(const CString& strFilename);
+
+protected:
+	DECLARE_MESSAGE_MAP()
+
+public:
+	// setter
+	void	SetViewType(int nType);
+	void	SetDrawViewName(BOOL bDraw);
+	void	SetDrawObject(BOOL bDraw);
+	void	SetDrawRoi(BOOL bDraw);
+	void	SetViewName(const CString& strValue);
+	void	SetRoiRect(const CRect& rtRect);
+
+	void	SetScale(double dScale);
+	void	SetWidthScale(double dScale);
+	void	SetHeightScale(double dScale);
+
+	// getter
+	int		GetViewType() const;
+	BOOL	GetDrawViewName() const;
+	BOOL	GetDrawObject() const;
+	BOOL	GetDrawRoi() const;
+	CString	GetViewName() const;
+	CRect	GetRoiRect() const;
+		
+	double	GetScale() const;
+	double	GetWidthScale(void) const;
+	double	GetHeightScale(void) const;
+	
+	int		GetHScrollPos(void) const;
+	int		GetVScrollPos(void) const;
+	int		GetScaleWidth(void);
+	int		GetScaleHeight(void);
+
+	// draw object
+	void	AddDrawObject(const SDrawObject& drawObject);
+	void	DeleteAllDrawObject(void);
+
+	// clear screen
+	void	ClearScreen();
+public:
+	afx_msg void OnPaint();
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+
+protected:
+	CWnd				*m_pParentWnd;
+	
+	// scroll pos
+	int					m_nVScroll;
+	int					m_nHScroll;
+
+	// max scroll pos
+	int					m_nMaxVScroll;
+	int					m_nMaxHScroll;
+
+	// image draw
+	int					m_nViewType;
+	int					m_nScaleWidth;
+	int					m_nScaleHeight;
+	double				m_dWidthScale; 
+	double				m_dHeightScale;
+
+	// draw view name
+	BOOL				m_bDrawViewName;
+	CString				m_strViewName;
+	
+	// draw roi
+	BOOL				m_bDrawRoi;
+	SDrawObject			m_rtRoiRect;
+
+	// draw object
+	BOOL				m_bDrawObject;
+	ListDrawObject		m_listDrawObject;
+	
+protected:
+	void DrawViewName();
+	void DrawRoi();
+	void DrawObject();
+	void DrawObject(const SDrawObject& object);
+	void CalculateRect();	
+
+protected:
+	BOOL CreateRenderTarget(const CRect& rtRect);
+	int CreateWicBitmap(int nWidthStep, int nHeight, int nChannels, BYTE* pBuffer);
+
+	static BOOL IntersectsWith(const D2D1_RECT_F& rect1, const D2D1_RECT_F& rect2)
+	{
+		return (	rect1.left		< rect2.right &&
+			rect1.top		< rect2.bottom &&
+			rect1.right		> rect2.left &&
+			rect1.bottom	> rect2.top);
+	}
+
+protected:
+	IWICImagingFactory		*m_pWICFactory;
+	IWICBitmap				*m_pWICBitmap;
+	IWICFormatConverter		*m_pWICFormatConverter;
+
+	ID2D1Factory			*m_pD2DFactory;
+	ID2D1HwndRenderTarget	*m_pD2DRenderTarget;
+	ID2D1Bitmap				*m_pD2DBitmap;
+	CCriticalSection		*m_pD2DCriticalSection;
+
+	int						m_nWicBitmapWidthStep;
+	int						m_nWicBitmapHeight;
+	int						m_nWicBitmapChannels;
+	CRect					m_rtViewRect;
+	CRect					m_rtOrgViewRect;
+	D2D1_RECT_F				m_rtSourceRect;
+	D2D1_RECT_F				m_rtDestRect;
+	D2D1_RECT_F				m_rtRenderRect;
+};
+
+
diff --git a/Common_Class/CHImageBuffer/ImageBuffer.cpp b/Common_Class/CHImageBuffer/ImageBuffer.cpp
new file mode 100644
index 0000000..613fd38
--- /dev/null
+++ b/Common_Class/CHImageBuffer/ImageBuffer.cpp
@@ -0,0 +1,909 @@
+#include "StdAfx.h"
+#include "ImageBuffer.h"
+
+CImageBuffer::CImageBuffer(void)
+{
+	m_bAllocatedData = FALSE;
+	m_pImageData = NULL;
+}
+
+CImageBuffer::CImageBuffer(int nWidth, int nHeight, int nDepth, int nChannels)
+{
+	/* depth info
+	IPL_DEPTH_8U - unsigned 8-bit integers
+	IPL_DEPTH_8S - signed 8-bit integers
+	IPL_DEPTH_16U - unsigned 16-bit integers
+	IPL_DEPTH_16S - signed 16-bit integers
+	IPL_DEPTH_32S - signed 32-bit integers
+	IPL_DEPTH_32F - single precision floating-point numbers
+	IPL_DEPTH_64F - double precision floating-point numbers
+	*/
+	m_pImageData = cvCreateImage(cvSize(nWidth, nHeight), nDepth, nChannels);
+	if (m_pImageData) m_bAllocatedData = TRUE;
+}
+
+CImageBuffer::~CImageBuffer(void)
+{
+	ReleaseImage();
+}
+
+BOOL CImageBuffer::GetImageExist(void) const	
+{ 
+	return m_pImageData ? TRUE: FALSE; 
+}
+
+BOOL CImageBuffer::GetAllocatedData( void ) const
+{
+	return m_bAllocatedData;
+}
+
+int CImageBuffer::GetHeight(void) const
+{ 
+	return GetImageExist() ? m_pImageData->height : 0; 
+}
+
+int CImageBuffer::GetWidth(void) const		
+{ 
+	return GetImageExist() ? m_pImageData->width : 0; 
+}
+
+int CImageBuffer::GetWidthStep(void) const	
+{ 
+	return GetImageExist() ? m_pImageData->widthStep : 0; 
+}
+
+int CImageBuffer::GetDepth(void) const		
+{ 
+	return GetImageExist() ? m_pImageData->depth : 0; 
+}
+
+int CImageBuffer::GetChannels(void) const	
+{ 
+	return GetImageExist() ? m_pImageData->nChannels : 0; 
+}
+
+int	CImageBuffer::GetBpp(void) const		
+{ 
+	return GetImageExist() ? (m_pImageData->depth & 255)*m_pImageData->nChannels : 0; 
+}
+
+int	CImageBuffer::GetImageSize(void) const
+{
+	return GetImageExist() ? m_pImageData->imageSize: 0; 
+}
+
+int	CImageBuffer::GetPixelValue(int x, int y) const
+{
+	if (!GetImageExist()) return -1;
+
+	if (GetDepth()!=IPL_DEPTH_8U) return -1;
+
+	if(GetWidth() <= x || x < 0 || GetHeight() <= y || y < 0)	return  -1;
+
+	CvScalar sValue = cvGet2D(m_pImageData, y, x);
+
+	return int(sValue.val[0]);
+}
+
+int	CImageBuffer::SetPixelValue(int x, int y, int nR, int nG, int nB)
+{
+	if (!GetImageExist()) return 0;
+
+	if (GetDepth()!=IPL_DEPTH_8U) return 0;
+
+	CvScalar sValue;
+	sValue.val[0] = nR;
+	sValue.val[1] = nG;
+	sValue.val[2] = nB;
+	
+	cvSet2D(m_pImageData, y, x, sValue);
+
+	return 1;
+}
+
+int CImageBuffer::SetPixelValue(int x, int y, int nR, int nG, int nB, int nA)
+{
+	if (!GetImageExist()) return 0;
+
+	if (GetDepth()!=IPL_DEPTH_8U) return 0;
+
+	CvScalar sValue;
+	sValue.val[0] = nR;
+	sValue.val[1] = nG;
+	sValue.val[2] = nB;
+	sValue.val[3] = nA;
+
+	cvSet2D(m_pImageData, y, x, sValue);
+
+	return 1;
+}
+
+
+BOOL CImageBuffer::LoadImage(const CString& strFilename)
+{
+	ReleaseImage();
+
+USES_CONVERSION;
+	char str_filename[200];
+	sprintf_s(str_filename, "%s", W2A(strFilename));
+
+	m_pImageData = cvLoadImage(str_filename, CV_LOAD_IMAGE_ANYCOLOR);
+
+	if (m_pImageData==NULL) return FALSE;
+	m_bAllocatedData = TRUE;
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::SaveImage(const CString& strFilename, int nQiality) const
+{
+	if (!GetImageExist()) return FALSE;
+
+	// ext check
+	int pos = strFilename.ReverseFind(_T('.'));
+	if (pos==-1) return FALSE;
+
+	CString extName = strFilename.Mid(pos+1, 3);
+
+USES_CONVERSION;
+	char str_filename[200];
+	sprintf_s(str_filename, "%s", W2A(strFilename));
+
+	int nReturnValue = 0;
+
+	if (extName.CompareNoCase(_T("bmp"))==0)
+	{
+		nReturnValue = cvSaveImage(str_filename, m_pImageData);
+	}
+	else if (extName.CompareNoCase(_T("jpg"))==0)
+	{
+		int param[3];
+		param[0] = CV_IMWRITE_JPEG_QUALITY;     
+		param[1] = nQiality;     
+		param[2] = 0; 
+		nReturnValue = cvSaveImage(str_filename, m_pImageData, param);
+	}
+	else	// PNG 保存…
+	{
+		nReturnValue = cvSaveImage(str_filename, m_pImageData);
+	}
+
+	if (nReturnValue==0) return FALSE;
+
+	return TRUE;
+}
+
+void CImageBuffer::ReleaseImage(void)
+{
+	if (m_pImageData!=NULL)
+	{
+		if (m_bAllocatedData)
+			cvReleaseImage(&m_pImageData);
+		else
+			cvReleaseImageHeader(&m_pImageData);
+	}
+	m_bAllocatedData = FALSE;
+	m_pImageData = NULL;
+}
+
+BOOL CImageBuffer::CreateImage(int nWidth, int nHeight, int nDepth, int nChannels)
+{
+	/* depth info
+	IPL_DEPTH_8U - unsigned 8-bit integers
+	IPL_DEPTH_8S - signed 8-bit integers
+	IPL_DEPTH_16U - unsigned 16-bit integers
+	IPL_DEPTH_16S - signed 16-bit integers
+	IPL_DEPTH_32S - signed 32-bit integers
+	IPL_DEPTH_32F - single precision floating-point numbers
+	IPL_DEPTH_64F - double precision floating-point numbers
+	*/
+
+	ReleaseImage();
+	m_pImageData = cvCreateImage(cvSize(nWidth, nHeight), nDepth, nChannels);
+	if (m_pImageData==NULL) return FALSE;
+	m_bAllocatedData = TRUE;
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::CreateImageHeader( int nWidth, int nHeight, int nDepth/*=8*/, int nChannels/*=1*/ )
+{
+	/* depth info
+	IPL_DEPTH_8U - unsigned 8-bit integers
+	IPL_DEPTH_8S - signed 8-bit integers
+	IPL_DEPTH_16U - unsigned 16-bit integers
+	IPL_DEPTH_16S - signed 16-bit integers
+	IPL_DEPTH_32S - signed 32-bit integers
+	IPL_DEPTH_32F - single precision floating-point numbers
+	IPL_DEPTH_64F - double precision floating-point numbers
+	*/
+
+	ReleaseImage();
+	m_pImageData = cvCreateImageHeader(cvSize(nWidth, nHeight), nDepth, nChannels);
+	if (m_pImageData==NULL) return FALSE;
+	m_bAllocatedData = FALSE;
+
+	return TRUE;
+}
+
+char* CImageBuffer::GetImageBuffer(void)	
+{ 
+	return (GetImageExist()) ? m_pImageData->imageData : NULL; 
+}
+
+char* CImageBuffer::GetImageBufferOrigin(void)	
+{ 
+	return (GetImageExist()) ? m_pImageData->imageDataOrigin : NULL; 
+}
+
+const char* CImageBuffer::GetImageBuffer(void) const
+{ 
+	return (GetImageExist()) ? m_pImageData->imageData : NULL; 
+}
+
+const char* CImageBuffer::GetImageBufferOrigin(void) const	
+{ 
+	return (GetImageExist()) ? m_pImageData->imageDataOrigin : NULL; 
+}
+
+
+void CImageBuffer::ShowImage(HDC hDC, const CRect& dstRect)
+{
+	if (!GetImageExist()) return;
+
+	if (GetDepth()!=IPL_DEPTH_8U) return;
+
+	if (m_pImageData->imageData==NULL) return;
+
+	uchar buffer[sizeof(BITMAPINFOHEADER) + 1024];
+	BITMAPINFO* bmi = (BITMAPINFO*)buffer;
+	int bmp_w = m_pImageData->width, bmp_h = m_pImageData->height;
+
+	SetStretchBltMode(hDC, COLORONCOLOR );
+
+	FillBitmapInfo(bmi, bmp_w, bmp_h, GetBpp(), m_pImageData->origin );
+
+	::StretchDIBits(
+		hDC,
+		dstRect.left, 
+		dstRect.top, 
+		dstRect.Width(), 
+		dstRect.Height(),
+		0, 
+		0, 
+		bmp_w, 
+		bmp_h,
+		m_pImageData->imageData, 
+		bmi, 
+		DIB_RGB_COLORS, 
+		SRCCOPY );
+}
+
+void CImageBuffer::ShowImage(HDC hDC, const CRect& srcRect, const CRect& dstRect)
+{
+	if (!GetImageExist()) return;
+
+	if (GetDepth()!=IPL_DEPTH_8U) return;
+
+	if (m_pImageData->imageData==NULL) return;
+
+	uchar buffer[sizeof(BITMAPINFOHEADER) + 1024];
+	BITMAPINFO* bmi = (BITMAPINFO*)buffer;
+	int bmp_w = m_pImageData->width, bmp_h = m_pImageData->height;
+
+	SetStretchBltMode(hDC, COLORONCOLOR);
+
+	FillBitmapInfo(bmi, bmp_w, bmp_h, GetBpp(), m_pImageData->origin );
+
+	::StretchDIBits(
+		hDC,
+		dstRect.left, 
+		dstRect.top, 
+		dstRect.Width(), 
+		dstRect.Height(),
+		srcRect.left, 
+		srcRect.top, 
+		srcRect.Width(), 
+		srcRect.Height(),
+		m_pImageData->imageData, 
+		bmi, 
+		DIB_RGB_COLORS, 
+		SRCCOPY );
+}
+
+void CImageBuffer::ShowImage(HDC hDC, int nSx, int nSy, int nWidth, int nHeight, int nFromX, int nFromY)
+{
+	if (!GetImageExist()) return;
+
+	if (GetDepth()!=IPL_DEPTH_8U) return;
+
+	uchar buffer[sizeof(BITMAPINFOHEADER) + 1024];
+	BITMAPINFO* bmi = (BITMAPINFO*)buffer;
+	int bmp_w = m_pImageData->width, bmp_h = m_pImageData->height;
+
+	FillBitmapInfo( bmi, bmp_w, bmp_h, GetBpp(), m_pImageData->origin );
+
+	nFromX = MIN( MAX( nFromX, 0 ), bmp_w - 1 );
+	nFromY = MIN( MAX( nFromY, 0 ), bmp_h - 1 );
+
+	int sw = MAX( MIN( bmp_w - nFromX, nWidth ), 0 );
+	int sh = MAX( MIN( bmp_h - nFromY, nHeight ), 0 );
+
+	SetDIBitsToDevice(
+		hDC, 
+		nSx, 
+		nSy, 
+		sw, 
+		sh, 
+		nFromX, 
+		nFromY, 
+		nFromY, 
+		sh,
+		m_pImageData->imageData + nFromY*m_pImageData->widthStep,
+		bmi, 
+		DIB_RGB_COLORS );
+}
+
+void CImageBuffer::FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin )
+{
+	assert( bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));
+
+	BITMAPINFOHEADER* bmih = &(bmi->bmiHeader);
+
+	memset( bmih, 0, sizeof(*bmih));
+	bmih->biSize = sizeof(BITMAPINFOHEADER);
+	bmih->biWidth = width;
+	bmih->biHeight = origin ? abs(height) : -abs(height);
+	bmih->biPlanes = 1;
+	bmih->biBitCount = (unsigned short)bpp;
+	bmih->biCompression = BI_RGB;
+
+	if( bpp == 8 )
+	{
+		RGBQUAD* palette = bmi->bmiColors;
+		int i;
+		for( i = 0; i < 256; i++ )
+		{
+			palette[i].rgbBlue = palette[i].rgbGreen = palette[i].rgbRed = (BYTE)i;
+			palette[i].rgbReserved = 0;
+		}
+	}
+}
+
+BOOL CImageBuffer::ClearImage(int nValue)
+{
+	if (!GetImageExist()) return FALSE;
+
+	cvSet(m_pImageData, CV_RGB(nValue, nValue, nValue));
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::ClearImage(int nValue, int nA)
+{
+	if (!GetImageExist()) return FALSE;
+
+	cvSet(m_pImageData, cvScalar(nValue, nValue, nValue, nA));
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::CopyImageTo(CImageBuffer *pToImage) const
+{
+	if (pToImage==NULL) return FALSE;
+
+	if (!GetImageExist()) return FALSE;
+
+	pToImage->ReleaseImage();
+
+	pToImage->m_pImageData = cvCloneImage(m_pImageData);
+	pToImage->m_bAllocatedData = TRUE;
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::CopyImageTo(IplImage *pToImage) const
+{
+	if (!GetImageExist()) return FALSE;
+
+	if (pToImage!=NULL) cvReleaseImage(&pToImage);
+
+	pToImage = cvCloneImage(m_pImageData);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::CopyImageFrom(const CImageBuffer *pFromImage)
+{
+	if (pFromImage==NULL) return FALSE;
+
+	if (!pFromImage->GetImageExist()) return FALSE;
+
+	ReleaseImage();
+
+	m_pImageData = cvCloneImage(pFromImage->m_pImageData);
+	m_bAllocatedData = TRUE;
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::CopyImageFrom(const IplImage *pFromImage)
+{
+	if (pFromImage==NULL) return FALSE;
+
+	ReleaseImage();
+
+	m_pImageData = cvCloneImage(pFromImage);
+	m_bAllocatedData = TRUE;
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::GetSubImage(int nSx, int nSy, int nWidth, int nHeight, CImageBuffer *pGetImage)
+{
+	if (pGetImage==NULL) return FALSE;
+	if (!GetImageExist()) return FALSE;
+	if (nSx < 0 || nSy < 0) return FALSE;
+	if ((nSx+nWidth) > GetWidth() || (nSy+nHeight) > GetHeight()) return FALSE;
+
+	// set roi
+	CvRect orgROI = cvGetImageROI(m_pImageData);
+	cvSetImageROI(m_pImageData, cvRect(nSx, nSy, nWidth, nHeight));
+
+	// create out image
+	pGetImage->ReleaseImage();
+	pGetImage->CreateImage(nWidth, nHeight, GetDepth(), GetChannels());
+
+	// copy roi image
+	cvCopy(m_pImageData, pGetImage->m_pImageData);
+
+	// set origin (mch)
+	pGetImage->m_pImageData->origin = m_pImageData->origin;
+
+	// set org roi
+	cvSetImageROI(m_pImageData, orgROI);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::GetSubImage(int nSx, int nSy, int nWidth, int nHeight, int nChannels, BYTE *pGetBuffer)
+{
+	if (pGetBuffer==NULL) return FALSE;
+	if (!GetImageExist()) return FALSE;
+	if (nChannels!=GetChannels()) return FALSE;
+	if (IPL_DEPTH_8U!=GetDepth()) return FALSE;
+	if (nSx < 0 || nSy < 0) return FALSE;
+	if ((nSx+nWidth) > GetWidth() || (nSy+nHeight) > GetHeight()) return FALSE;
+
+	// set roi
+	CvRect orgROI = cvGetImageROI(m_pImageData);
+	cvSetImageROI(m_pImageData, cvRect(nSx, nSy, nWidth, nHeight));
+
+	// create out image
+	IplImage* tmpImage;
+	tmpImage = cvCreateImage(cvSize(nWidth, nHeight), IPL_DEPTH_8U, nChannels);
+
+	// copy roi image
+	cvCopy(m_pImageData, tmpImage);
+
+	int nGetStep = nWidth * nChannels;
+	int nTmpStep = tmpImage->widthStep;	
+	if (nGetStep==nTmpStep)
+	{
+		memcpy(pGetBuffer, tmpImage->imageData, sizeof(char)*tmpImage->imageSize);
+	}
+	else
+	{
+		for (int i=0; i<tmpImage->height; i++)
+		{
+			memcpy(&pGetBuffer[i*nGetStep], &tmpImage->imageData[i*nTmpStep], sizeof(char)*nGetStep);
+		}
+	}
+
+	// set org roi
+	cvSetImageROI(m_pImageData, orgROI);
+	cvReleaseImage(&tmpImage);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::GetSubImage(const CRect& rtRect, CImageBuffer *pGetImage)		
+{ 
+	return GetSubImage(rtRect.left, rtRect.top, rtRect.Width(), rtRect.Height(), pGetImage); 
+}
+
+BOOL CImageBuffer::GetSubImage(const CRect& rtRect, int nBpp, BYTE *pGetBuffer)	
+{ 
+	return GetSubImage(rtRect.left, rtRect.top, rtRect.Width(), rtRect.Height(), nBpp, pGetBuffer); 
+}
+
+BOOL CImageBuffer::GetBandImage(int nColorBand, CImageBuffer* pGetImage) const
+{
+	if (pGetImage==NULL) return FALSE;
+	if (!GetImageExist()) return FALSE;
+	if (GetDepth()!=IPL_DEPTH_8U) return FALSE;
+
+	if (nColorBand==ImageBand_Color || m_pImageData->nChannels<3)
+	{
+		pGetImage->ReleaseImage();
+		pGetImage->m_pImageData		= cvCloneImage(m_pImageData);
+		pGetImage->m_bAllocatedData = TRUE;
+		return TRUE;
+	}
+
+	if (!pGetImage->CreateImage(GetWidth(), GetHeight(), IPL_DEPTH_8U, 1)) return FALSE;
+
+	int nChannelIndex = -1;
+	char cChannelName = _T('\0');
+
+	switch(nColorBand)
+	{
+	case ImageBand_Blue:
+		cChannelName = _T('B');
+		break;
+
+	case ImageBand_Green:
+		cChannelName = _T('G');
+		break;
+
+	case ImageBand_Red:
+		cChannelName = _T('R');
+		break;
+
+	case ImageBand_Gray:
+		cvCvtColor(m_pImageData, pGetImage->m_pImageData, CV_RGB2GRAY);
+
+		// set origin (mch)
+		pGetImage->m_pImageData->origin = m_pImageData->origin;
+		return TRUE;
+
+	default:
+		pGetImage->ReleaseImage();
+		return FALSE;
+	}
+
+	for (int i=0; i<m_pImageData->nChannels; i++)
+	{
+		if (m_pImageData->channelSeq[i]==cChannelName)
+		{
+			nChannelIndex = i;
+			break;
+		}
+	}
+
+	if (nChannelIndex==-1 || nChannelIndex>=m_pImageData->nChannels) return FALSE;
+
+	switch(nChannelIndex)
+	{
+	case 0:
+		cvSplit(m_pImageData, pGetImage->m_pImageData, NULL, NULL, NULL);
+		break;
+	case 1:
+		cvSplit(m_pImageData, NULL, pGetImage->m_pImageData, NULL, NULL);
+		break;
+	case 2:
+		cvSplit(m_pImageData, NULL, NULL, pGetImage->m_pImageData, NULL);
+		break;
+	case 3:
+		cvSplit(m_pImageData, NULL, NULL, NULL, pGetImage->m_pImageData);
+		break;
+	}
+
+	// set origin (mch)
+	pGetImage->m_pImageData->origin = m_pImageData->origin;
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::GetBandImage(int nColorBand, int nSx, int nSy, int nWidth, int nHeight, CImageBuffer* pGetImage)
+{
+	CImageBuffer tmpImage;
+
+	if (!GetSubImage(nSx, nSy, nWidth, nHeight, &tmpImage)) return FALSE;
+
+	if (!tmpImage.GetBandImage(nColorBand, pGetImage)) return FALSE;
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::GetBandImage(int nColorBand, int nSx, int nSy, int nWidth, int nHeight, BYTE* pGetBuffer)
+{
+	CImageBuffer tmpImage;
+
+	if (!GetBandImage(nColorBand, &tmpImage)) return FALSE;
+
+	if (!tmpImage.GetSubImage(nSx, nSy, nWidth, nHeight, 1, pGetBuffer)) return FALSE;
+
+	return TRUE;
+}
+
+
+BOOL CImageBuffer::GetBandImage(int nColorBand, const CRect& rtRect, CImageBuffer* pGetImage)	
+{ 
+	return GetBandImage(nColorBand, rtRect.left, rtRect.top, rtRect.Width(), rtRect.Height(), pGetImage); 
+}
+
+BOOL CImageBuffer::GetBandImage(int nColorBand, const CRect& rtRect, BYTE* pGetBuffer)			
+{ 
+	return GetBandImage(nColorBand, rtRect.left, rtRect.top, rtRect.Width(), rtRect.Height(), pGetBuffer); 
+}
+
+BOOL CImageBuffer::SetSubImage(int nSx, int nSy, int nWidth, int nHeight, CImageBuffer* pSetImage)
+{
+	if (pSetImage==NULL) return FALSE;
+	if (!GetImageExist() || !pSetImage->GetImageExist()) return FALSE;
+	if (GetDepth()!=pSetImage->GetDepth() || GetChannels()!=pSetImage->GetChannels()) return FALSE;
+	if (nWidth!=pSetImage->GetWidth() || nHeight!=pSetImage->GetHeight()) return FALSE;
+	if (nSx < 0 || nSy < 0) return FALSE;
+	if ((nSx+nWidth) > GetWidth() || (nSy+nHeight) > GetHeight()) return FALSE;
+
+	CvRect orgROI = cvGetImageROI(m_pImageData);
+	cvSetImageROI(m_pImageData, cvRect(nSx, nSy, nWidth, nHeight));
+
+	CvRect setROI = cvGetImageROI(pSetImage->m_pImageData);
+	cvResetImageROI(pSetImage->m_pImageData);
+
+	cvCopy(pSetImage->m_pImageData, m_pImageData);
+
+	// set origin (mch)
+	m_pImageData->origin = pSetImage->m_pImageData->origin;
+
+	cvSetImageROI(m_pImageData, orgROI);
+	cvSetImageROI(pSetImage->m_pImageData, setROI);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::SetSubImage(int nSx, int nSy, int nWidth, int nHeight, int nChannels, BYTE *pSetBuffer)
+{
+	if (pSetBuffer==NULL) return FALSE;
+	if (!GetImageExist()) return FALSE;
+	if (nChannels!=GetChannels()) return FALSE;
+	if (GetDepth()!=IPL_DEPTH_8U) return FALSE;
+	if (nSx < 0 || nSy < 0) return FALSE;
+	if ((nSx+nWidth) > GetWidth() || (nSy+nHeight) > GetHeight()) return FALSE;
+
+	IplImage *tmpImage;
+	tmpImage = cvCreateImage(cvSize(nWidth, nHeight), IPL_DEPTH_8U, nChannels);
+
+	int nSetStep = nWidth * nChannels;
+	int nTmpStep = tmpImage->widthStep;	
+	if (nSetStep==nTmpStep)
+	{
+		//memcpy(tmpImage, pSetBuffer, sizeof(char)*tmpImage->imageSize);
+		memcpy(tmpImage->imageData, pSetBuffer, sizeof(char)*tmpImage->imageSize);
+	}
+	else
+	{
+		for (int i=0; i<tmpImage->height; i++)
+		{
+			memcpy(&tmpImage->imageData[i*nTmpStep], &pSetBuffer[i*nSetStep], sizeof(char)*nSetStep);
+		}
+	}
+
+	// set roi
+	CvRect orgROI = cvGetImageROI(m_pImageData);
+	cvSetImageROI(m_pImageData, cvRect(nSx, nSy, nWidth, nHeight));
+
+	cvCopy(tmpImage, m_pImageData);
+
+	// set org roi
+	cvSetImageROI(m_pImageData, orgROI);
+	cvReleaseImage(&tmpImage);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::SetSubImage(const CRect& rtRect, CImageBuffer *pSetImage)
+{ 
+	return SetSubImage(rtRect.left, rtRect.top, rtRect.Width(), rtRect.Height(), pSetImage); 
+}
+
+BOOL CImageBuffer::SetSubImage(const CRect& rtRect, int nBpp, BYTE *pSetBuffer)	
+{ 
+	return SetSubImage(rtRect.left, rtRect.top, rtRect.Width(), rtRect.Height(), nBpp, pSetBuffer); 
+}
+
+IplImage* CImageBuffer::GetIplImage(void)
+{ 
+	return m_pImageData; 
+}
+
+BOOL CImageBuffer::DrawLine(CPoint ptPos1, CPoint ptPos2, DWORD nColor, int nThickness, int nLineType, int nShift )
+{
+	if (!GetImageExist()) return FALSE;
+
+	CvPoint pt1 = cvPoint(ptPos1.x, ptPos1.y);
+	CvPoint pt2 = cvPoint(ptPos2.x, ptPos2.y);
+	CvScalar color = cvScalar(GetBValue(nColor), GetGValue(nColor), GetRValue(nColor), 0);
+
+	cvLine(m_pImageData, pt1, pt2, color, nThickness, nLineType, nShift);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::DrawRectangle(CPoint ptPos1, CPoint ptPos2, DWORD nColor, int nThickness, int nLineType, int nShift )
+{
+	if (!GetImageExist()) return FALSE;
+
+	CvPoint pt1 = cvPoint(ptPos1.x, ptPos1.y);
+	CvPoint pt2 = cvPoint(ptPos2.x, ptPos2.y);
+	CvScalar color = cvScalar(GetBValue(nColor), GetGValue(nColor), GetRValue(nColor), 0);
+
+	cvRectangle(m_pImageData, pt1, pt2, color, nThickness, nLineType, nShift);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::DrawCircle(CPoint ptCenter, int nRadius, DWORD nColor, int nThickness, int nLineType, int nShift )
+{
+	if (!GetImageExist()) return FALSE;
+
+	if (nRadius<0) return FALSE;
+
+	CvPoint center = cvPoint(ptCenter.x, ptCenter.y);
+	CvScalar color = cvScalar(GetBValue(nColor), GetGValue(nColor), GetRValue(nColor), 0);
+
+	cvCircle(m_pImageData, center, nRadius, color, nThickness, nLineType, nShift);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::DrawEllipse(CPoint ptCenter, CPoint ptSize, double dAngle, DWORD nColor, int nThickness, int nLineType, int nShift )
+{
+	if (!GetImageExist()) return FALSE;
+
+	CvBox2D box;
+	box.center.x	= (float)ptCenter.x;
+	box.center.y	= (float)ptCenter.y;
+	box.size.width	= (float)ptSize.x;
+	box.size.height = (float)ptSize.y;
+	box.angle		= (float)dAngle;
+
+	CvScalar color = cvScalar(GetBValue(nColor), GetGValue(nColor), GetRValue(nColor), 0);
+	cvEllipseBox(m_pImageData, box, color, nThickness, nLineType, nShift);
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::DrawText(CPoint ptPoint, DWORD nColor, const CString& strText)
+{
+	if (!GetImageExist()) return FALSE;
+
+	CvPoint point = cvPoint(ptPoint.x, ptPoint.y);
+	CvScalar color = cvScalar(GetBValue(nColor), GetGValue(nColor), GetRValue(nColor), 0);
+	CvFont font;
+
+	cvInitFont(&font, CV_FONT_HERSHEY_PLAIN , 1.0, 1.0);// double shear=0, int thickness=1, int line_type=8 );
+
+USES_CONVERSION;
+	char str_text[200];
+	sprintf_s(str_text, "%s", W2A(strText));
+
+	if (str_text==NULL) return FALSE;
+
+	cvPutText(m_pImageData, str_text, point, &font, color );
+
+	return TRUE;
+}
+
+BOOL CImageBuffer::DCtoIplImage(CDC* pDC, const CRect& rect)  
+{
+	if (pDC==NULL) return FALSE;
+
+	int cx = rect.right - rect.left;  
+	int cy = rect.bottom - rect.top;  
+
+	if(cx <= 0 || cy <= 0) return FALSE;  
+
+	HDC hMemDC = CreateCompatibleDC(pDC->m_hDC);  
+
+	BITMAPINFO			bmi;  
+	BITMAPINFOHEADER*	bmih = &(bmi.bmiHeader);  
+
+	ZeroMemory(bmih, sizeof(BITMAPINFOHEADER));  
+	bmih->biSize        = sizeof(BITMAPINFOHEADER);  
+
+	bmih->biBitCount	= 24;  
+	bmih->biWidth       = cx;  
+	bmih->biHeight      = cy;  
+	bmih->biPlanes      = 1;  
+
+	LPVOID				pBits;  
+	HBITMAP hBitmap = CreateDIBSection(pDC->m_hDC, &bmi, DIB_RGB_COLORS, (LPVOID*)&pBits, NULL, 0);  
+
+	SelectObject(hMemDC, hBitmap);  
+
+	BitBlt(hMemDC, 0, 0, cx, cy, pDC->m_hDC, rect.left, rect.top, SRCCOPY);  
+
+	DeleteDC(hMemDC);  
+
+	BOOL bResult = DIBtoIplImage(hBitmap);
+
+	DeleteObject(hBitmap);
+
+	return bResult;
+}  
+
+
+BOOL CImageBuffer::DIBtoIplImage(HBITMAP& hbmp, HDC hdc)
+{
+	ReleaseImage();
+
+	bool mustrelease = false;
+	BITMAPINFO bmi;
+	BITMAPINFOHEADER* bmih = &(bmi.bmiHeader);
+
+	if (hdc == NULL) 
+	{
+		hdc = GetDC(NULL);
+		mustrelease = true;
+	}
+
+	ZeroMemory(bmih, sizeof(BITMAPINFOHEADER));
+	bmih->biSize = sizeof(BITMAPINFOHEADER);
+
+	if (GetDIBits(hdc, hbmp, 0, 0, NULL, &bmi, DIB_RGB_COLORS)) 
+	{
+		int height	= (bmih->biHeight > 0) ? bmih->biHeight : -bmih->biHeight;
+		int origin	= (bmih->biHeight > 0);
+
+		if (origin)
+		{
+			_IplImage *pTempImage	= cvCreateImage(cvSize(bmih->biWidth, height),IPL_DEPTH_8U, 3);
+			m_pImageData			= cvCreateImage(cvSize(bmih->biWidth, height),IPL_DEPTH_8U, 3);
+			m_bAllocatedData		= TRUE;
+			pTempImage->origin		= origin;
+			bmih->biBitCount		= 24;
+			bmih->biCompression		= BI_RGB;
+			GetDIBits(hdc, hbmp, 0, height, pTempImage->imageData, &bmi,	DIB_RGB_COLORS);
+
+			cvFlip(pTempImage, m_pImageData, 0);
+
+			cvReleaseImage(&pTempImage);
+		}
+		else
+		{
+			m_pImageData			= cvCreateImage(cvSize(bmih->biWidth, height),IPL_DEPTH_8U, 3);
+			m_bAllocatedData		= TRUE;
+			m_pImageData->origin	= origin;
+			bmih->biBitCount		= 24;
+			bmih->biCompression		= BI_RGB;
+
+			GetDIBits(hdc, hbmp, 0, height, m_pImageData->imageData, &bmi,	DIB_RGB_COLORS);
+		}
+	}
+
+	if (mustrelease)
+	{
+		ReleaseDC(NULL, hdc);
+	}
+
+	return TRUE;
+}
+
+
+BOOL CImageBuffer::SetImageBufferPtr( char* pPtr )
+{
+	if (m_pImageData==NULL) return FALSE;
+
+	if (m_pImageData->imageData) return FALSE;
+
+	if (m_pImageData->imageDataOrigin) return FALSE;
+
+	m_pImageData->imageData = m_pImageData->imageDataOrigin = pPtr;
+
+	return TRUE;
+}
+
+CvScalar CImageBuffer::GetPixelScalar(int x, int y)
+{
+	CvScalar sValue = cvScalar(-1, -1, -1);
+	if (!GetImageExist()) return sValue;
+
+	if (GetDepth()!=IPL_DEPTH_8U) return sValue;
+
+	sValue = cvGet2D(m_pImageData, y, x);
+
+	return sValue;
+}
\ No newline at end of file
diff --git a/Common_Class/CHImageBuffer/ImageTracker.cpp b/Common_Class/CHImageBuffer/ImageTracker.cpp
new file mode 100644
index 0000000..0696479
--- /dev/null
+++ b/Common_Class/CHImageBuffer/ImageTracker.cpp
@@ -0,0 +1,316 @@
+#include "StdAfx.h"
+#include "ImageTracker.h"
+
+AFX_STATIC_DATA HCURSOR _afxCursors[10] = { 0, };
+AFX_STATIC_DATA HBRUSH _afxHatchBrush = 0;
+AFX_STATIC_DATA HPEN _afxBlackDottedPen = 0;
+AFX_STATIC_DATA int _afxHandleSize = 0;
+
+CImageTracker::CImageTracker(void)
+{
+}
+
+CImageTracker::CImageTracker(LPCRECT lpSrcRect, UINT nStyle)
+{
+	CRectTracker(lpSrcRect, nStyle);
+}
+
+CImageTracker::~CImageTracker(void)
+{
+}
+
+BOOL CImageTracker::TrackRubberBand(CWnd* pWnd, CPoint point, BOOL bAllowInvert)
+{
+	// simply call helper function to track from bottom right handle
+	m_bAllowInvert = bAllowInvert;
+	m_rect.SetRect(point.x, point.y, point.x, point.y);
+
+	return TrackHandle(hitBottomRight, pWnd, point, NULL);
+}
+
+BOOL CImageTracker::Track(CWnd* pWnd, CPoint point, BOOL bAllowInvert, CWnd* pWndClipTo)
+{
+	// perform hit testing on the handles
+	int nHandle = HitTestHandles(point);
+	if (nHandle < 0)
+	{
+		// didn't hit a handle, so just return FALSE
+		return FALSE;
+	}
+
+	// otherwise, call helper function to do the tracking
+	m_bAllowInvert = bAllowInvert;
+
+	return TrackHandle(nHandle, pWnd, point, pWndClipTo);
+}
+
+void CImageTracker::Draw(CDC* pDC) const
+{
+	// set initial DC state
+	VERIFY(pDC->SaveDC() != 0);
+#ifndef _AFX_NO_GDITRANSFORM_SUPPORT
+	pDC->SetMapMode(MM_TEXT);
+	pDC->SetViewportOrg(0, 0);
+	pDC->SetWindowOrg(0, 0);
+#endif // !_AFX_NO_GDITRANSFORM_SUPPORT
+	// get normalized rectangle
+	CRect rect = m_rect;
+	rect.NormalizeRect();
+
+	CPen* pOldPen = NULL;
+	CBrush* pOldBrush = NULL;
+	CGdiObject* pTemp;
+	int nOldROP;
+
+	CPen pen;
+	//pen.CreatePen(PS_DOT, 1, RGB(255,255,255));
+	pen.CreatePen(PS_DOT, 1, RGB(255,0,0));
+
+	rect.InflateRect(+1, +1);   // borders are one pixel outside
+
+	// draw lines
+	if ((m_nStyle & (dottedLine|solidLine)) != 0)
+	{
+		if (m_nStyle & dottedLine)
+			pOldPen = pDC->SelectObject(&pen);
+		//pOldPen = (CPen*)pDC->SelectStockObject(WHITE_PEN);
+		else
+			pOldPen = (CPen*)pDC->SelectStockObject(BLACK_PEN);
+		pOldBrush = (CBrush*)pDC->SelectStockObject(NULL_BRUSH);
+		nOldROP = pDC->SetROP2(R2_COPYPEN);
+
+		// rect
+		pDC->Rectangle(rect.left, rect.top, rect.right, rect.bottom);
+
+		// cross line
+		if ((m_nStyle & (crossLine)) != 0)
+		{
+			pDC->MoveTo(rect.left+rect.Width()/2, rect.top);
+			pDC->LineTo(rect.left+rect.Width()/2, rect.bottom);
+			pDC->MoveTo(rect.left, rect.top+rect.Height()/2);
+			pDC->LineTo(rect.right, rect.top+rect.Height()/2);
+		}
+
+		// x line
+		if ((m_nStyle & (xLine)) != 0)
+		{
+			pDC->MoveTo(rect.left, rect.top);
+			pDC->LineTo(rect.right, rect.bottom);
+			pDC->MoveTo(rect.right, rect.top);
+			pDC->LineTo(rect.left, rect.bottom);
+		}
+
+		pDC->SetROP2(nOldROP);
+	}
+
+
+#ifndef _WIN32_WCE // unsupported win32 api call to UnrealizeObject
+	// if hatchBrush is going to be used, need to unrealize it
+	if ((m_nStyle & (hatchInside|hatchedBorder)) != 0)
+		UnrealizeObject(_afxHatchBrush);
+#endif // !_WIN32_WCE
+
+	// hatch inside
+	if ((m_nStyle & hatchInside) != 0)
+	{
+		pTemp = pDC->SelectStockObject(NULL_PEN);
+		if (pOldPen == NULL)
+			pOldPen = (CPen*)pTemp;
+		pTemp = pDC->SelectObject(CBrush::FromHandle(_afxHatchBrush));
+		if (pOldBrush == NULL)
+			pOldBrush = (CBrush*)pTemp;
+		pDC->SetBkMode(TRANSPARENT);
+		nOldROP = pDC->SetROP2(R2_MASKNOTPEN);
+		pDC->Rectangle(rect.left+1, rect.top+1, rect.right, rect.bottom);
+		pDC->SetROP2(nOldROP);
+	}
+
+	// draw hatched border
+	if ((m_nStyle & hatchedBorder) != 0)
+	{
+		pTemp = pDC->SelectObject(CBrush::FromHandle(_afxHatchBrush));
+		if (pOldBrush == NULL)
+			pOldBrush = (CBrush*)pTemp;
+		pDC->SetBkMode(OPAQUE);
+		CRect rectTrue;
+		GetTrueRect(&rectTrue);
+		pDC->PatBlt(rectTrue.left, rectTrue.top, rectTrue.Width(),
+			rect.top-rectTrue.top, 0x000F0001 /* Pn */);
+		pDC->PatBlt(rectTrue.left, rect.bottom,
+			rectTrue.Width(), rectTrue.bottom-rect.bottom, 0x000F0001 /* Pn */);
+		pDC->PatBlt(rectTrue.left, rect.top, rect.left-rectTrue.left,
+			rect.Height(), 0x000F0001 /* Pn */);
+		pDC->PatBlt(rect.right, rect.top, rectTrue.right-rect.right,
+			rect.Height(), 0x000F0001 /* Pn */);
+	}
+
+	// draw resize handles
+	if ((m_nStyle & (resizeInside|resizeOutside)) != 0)
+	{
+		UINT mask = GetHandleMask();
+		for (int i = 0; i < 8; ++i)
+		{
+			if (mask & (1<<i))
+			{
+				GetHandleRect((TrackerHit)i, &rect);
+				pDC->FillSolidRect(rect, RGB(255, 255, 255));
+			}
+		}
+	}
+
+	// cleanup pDC state
+	if (pOldPen != NULL)
+		pDC->SelectObject(pOldPen);
+	if (pOldBrush != NULL)
+		pDC->SelectObject(pOldBrush);
+	VERIFY(pDC->RestoreDC(-1));
+}
+
+BOOL CImageTracker::TrackHandle(int nHandle, CWnd* pWnd, CPoint point, CWnd* pWndClipTo)
+{
+	ASSERT(nHandle >= 0);
+	ASSERT(nHandle <= 8);   // handle 8 is inside the rect
+
+	// don't handle if capture already set
+	if (::GetCapture() != NULL)
+		return FALSE;
+
+	AfxLockTempMaps();  // protect maps while looping
+
+	ASSERT(!m_bFinalErase);
+
+	// save original width & height in pixels
+	int nWidth = m_rect.Width();
+	int nHeight = m_rect.Height();
+
+	// set capture to the window which received this message
+	pWnd->SetCapture();
+	ASSERT(pWnd == CWnd::GetCapture());
+	pWnd->UpdateWindow();
+	if (pWndClipTo != NULL)
+		pWndClipTo->UpdateWindow();
+	CRect rectSave = m_rect;
+
+	// find out what x/y coords we are supposed to modify
+	int *px, *py;
+	int xDiff, yDiff;
+	GetModifyPointers(nHandle, &px, &py, &xDiff, &yDiff);
+	xDiff = point.x - xDiff;
+	yDiff = point.y - yDiff;
+
+	// get DC for drawing
+	CDC* pDrawDC;
+	if (pWndClipTo != NULL)
+	{
+		// clip to arbitrary window by using adjusted Window DC
+		pDrawDC = pWndClipTo->GetDCEx(NULL, DCX_CACHE);
+	}
+	else
+	{
+		// otherwise, just use normal DC
+		pDrawDC = pWnd->GetDC();
+	}
+	ENSURE_VALID(pDrawDC);
+
+	CRect rectOld;
+	BOOL bMoved = FALSE;
+
+	// get messages until capture lost or cancelled/accepted
+	for (;;)
+	{
+		MSG msg;
+		VERIFY(::GetMessage(&msg, NULL, 0, 0));
+
+		if (CWnd::GetCapture() != pWnd)
+			break;
+
+		switch (msg.message)
+		{
+			// handle movement/accept messages
+		case WM_LBUTTONUP:
+			{
+				if (pWnd)
+					pWnd->SendMessage(WM_LBUTTONUP, static_cast<WPARAM>(0), MAKELPARAM(0, 0));
+			}
+		case WM_MOUSEMOVE:
+			rectOld = m_rect;
+			// handle resize cases (and part of move)
+			if (px != NULL)
+				*px = GET_X_LPARAM(msg.lParam) - xDiff;
+			if (py != NULL)
+				*py = GET_Y_LPARAM(msg.lParam) - yDiff;
+
+			// handle move case
+			if (nHandle == hitMiddle)
+			{
+				m_rect.right = m_rect.left + nWidth;
+				m_rect.bottom = m_rect.top + nHeight;
+			}
+			// allow caller to adjust the rectangle if necessary
+			AdjustRect(nHandle, &m_rect);
+
+			// only redraw and callback if the rect actually changed!
+			m_bFinalErase = (msg.message == WM_LBUTTONUP);
+			if (!rectOld.EqualRect(&m_rect) || m_bFinalErase)
+			{
+				if (bMoved)
+				{
+					m_bErase = TRUE;
+					DrawTrackerRect(&rectOld, pWndClipTo, pDrawDC, pWnd);
+				}
+				OnChangedRect(rectOld);
+				if (msg.message != WM_LBUTTONUP)
+					bMoved = TRUE;
+			}
+			if (m_bFinalErase)
+				goto ExitLoop;
+
+			if (!rectOld.EqualRect(&m_rect))
+			{
+				m_bErase = FALSE;
+				DrawTrackerRect(&m_rect, pWndClipTo, pDrawDC, pWnd);
+			}
+			break;
+
+			// handle cancel messages
+		case WM_KEYDOWN:
+			if (msg.wParam != VK_ESCAPE)
+				break;
+		case WM_RBUTTONDOWN:
+			if (bMoved)
+			{
+				m_bErase = m_bFinalErase = TRUE;
+				DrawTrackerRect(&m_rect, pWndClipTo, pDrawDC, pWnd);
+			}
+			m_rect = rectSave;
+			goto ExitLoop;
+
+		case WM_LBUTTONDBLCLK:
+			if (pWnd)
+				pWnd->SendMessage(WM_LBUTTONDBLCLK, static_cast<WPARAM>(0), MAKELPARAM(0, 0));
+			break;
+			// just dispatch rest of the messages
+		default:
+			DispatchMessage(&msg);
+			break;
+		}
+	}
+
+ExitLoop:
+	if (pWndClipTo != NULL)
+		pWndClipTo->ReleaseDC(pDrawDC);
+	else
+		pWnd->ReleaseDC(pDrawDC);
+	ReleaseCapture();
+
+	AfxUnlockTempMaps(FALSE);
+
+	// restore rect in case bMoved is still FALSE
+	if (!bMoved)
+		m_rect = rectSave;
+	m_bFinalErase = FALSE;
+	m_bErase = FALSE;
+
+	// return TRUE only if rect has changed
+	return !rectSave.EqualRect(&m_rect);
+}
\ No newline at end of file
diff --git a/Common_Class/CHImageBuffer/ImageTracker.h b/Common_Class/CHImageBuffer/ImageTracker.h
new file mode 100644
index 0000000..64278a6
--- /dev/null
+++ b/Common_Class/CHImageBuffer/ImageTracker.h
@@ -0,0 +1,27 @@
+#pragma once
+
+enum CStyleFlags
+{
+	//	solidLine = 1, dottedLine = 2, hatchedBorder = 4,
+	//	resizeInside = 8, resizeOutside = 16, hatchInside = 32,
+
+	crossLine = 64, xLine = 128,
+};
+
+
+class AFX_EXT_CLASS CImageTracker :  public CRectTracker
+{
+public:
+	CImageTracker(void);
+	CImageTracker(LPCRECT lpSrcRect, UINT nStyle);
+	virtual ~CImageTracker(void);
+
+	BOOL Track(CWnd* pWnd, CPoint point, BOOL bAllowInvert, CWnd* pWndClipTo=NULL);
+	BOOL TrackRubberBand(CWnd* pWnd, CPoint point, BOOL bAllowInvert);
+	void Draw(CDC* pDC) const;
+
+protected:
+	BOOL TrackHandle(int nHandle, CWnd* pWnd, CPoint point, CWnd* pWndClipTo);
+
+};
+
diff --git a/Common_Class/CHImageBuffer/ImageViewer.cpp b/Common_Class/CHImageBuffer/ImageViewer.cpp
new file mode 100644
index 0000000..25eec24
--- /dev/null
+++ b/Common_Class/CHImageBuffer/ImageViewer.cpp
@@ -0,0 +1,878 @@
+// ImageViewer.cpp : 实现文件。
+//
+#include "stdafx.h"
+#include "ImageViewer.h"
+
+IMPLEMENT_DYNAMIC(CImageViewer, CWnd)
+
+CImageViewer::CImageViewer(CWnd* pParentWnd)
+{
+	CoInitialize(0);
+
+	HRESULT hr = S_OK;
+
+	// create wic factory
+	hr = ::CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_pWICFactory));
+	if (hr!=S_OK)
+	{
+	}
+
+	// create d2d factory
+	hr = ::D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory);
+	if (hr!=S_OK) 
+	{
+	}
+
+	m_pWICBitmap			= nullptr;
+	m_pWICFormatConverter	= nullptr;
+	m_pD2DRenderTarget		= nullptr;
+	m_pD2DBitmap			= nullptr;
+
+	m_nWicBitmapWidthStep	= 0;
+	m_nWicBitmapHeight		= 0;
+	m_nWicBitmapChannels	= 0;
+	m_rtViewRect			= CRect(0,0,0,0);
+	m_rtOrgViewRect			= CRect(0,0,0,0);
+
+	m_pParentWnd			= pParentWnd;
+	m_strViewName			= _T("");
+
+	// scroll pos
+	m_nVScroll				= 0;
+	m_nHScroll				= 0;
+
+	// max scroll pos
+	m_nMaxVScroll			= 0;
+	m_nMaxHScroll			= 0;
+
+	// image draw
+	m_nViewType				= ViewScale_Fit;
+	m_nScaleWidth			= 0;
+	m_nScaleHeight			= 0;
+	m_dWidthScale			= 1.0;	 
+	m_dHeightScale			= 1.0;	
+
+	// draw view name
+	m_bDrawViewName			= FALSE;
+	m_strViewName			= _T("");
+
+	// draw roi
+	m_bDrawRoi				= FALSE;
+	m_rtRoiRect.Reset();
+
+	// draw object
+	m_bDrawObject			= FALSE;
+	m_listDrawObject.clear();
+
+	// d2d1 cs
+	m_pD2DCriticalSection	= new CCriticalSection();
+
+}
+
+CImageViewer::~CImageViewer()
+{
+	SafeDelete(m_pD2DCriticalSection);
+
+	SafeRelease(m_pD2DBitmap);
+	SafeRelease(m_pWICBitmap);
+	SafeRelease(m_pWICFormatConverter);
+	SafeRelease(m_pD2DRenderTarget);
+	SafeRelease(m_pD2DFactory);
+	SafeRelease(m_pWICFactory);
+
+	m_listDrawObject.clear();
+
+	CoUninitialize();
+}
+
+
+BEGIN_MESSAGE_MAP(CImageViewer, CWnd)
+	ON_WM_PAINT()
+	ON_WM_HSCROLL()
+	ON_WM_VSCROLL()
+	ON_WM_CREATE()
+	ON_WM_SIZE()
+	ON_WM_CREATE()
+END_MESSAGE_MAP()
+
+
+// CImageViewer 消息处理器。
+BOOL CImageViewer::CreateRenderTarget(const CRect& rtRect)
+{
+	CSingleLock myLock(m_pD2DCriticalSection);
+	myLock.Lock();
+
+	BOOL bSame = (rtRect == m_rtViewRect);
+	if (bSame && (m_pD2DRenderTarget!=nullptr)) return TRUE;
+
+	m_rtViewRect = rtRect;
+
+	// create hwnd render target
+	SafeRelease(m_pD2DRenderTarget);
+	HRESULT hr = m_pD2DFactory->CreateHwndRenderTarget(
+		D2D1::RenderTargetProperties(), 
+		D2D1::HwndRenderTargetProperties(this->GetSafeHwnd(), D2D1::SizeU(m_rtViewRect.Width(), m_rtViewRect.Height())),
+		&m_pD2DRenderTarget);
+
+	if (hr!=S_OK) 
+	{
+		return FALSE;
+	}
+
+	auto rtSize = m_pD2DRenderTarget->GetSize();
+	m_rtRenderRect = D2D1::RectF(0.0f, 0.0f, rtSize.width, rtSize.height);
+
+	return TRUE;
+}
+
+int CImageViewer::CreateWicBitmap(int nWidthStep, int nHeight, int nChannels, BYTE* pBuffer)
+{
+	CSingleLock myLock(m_pD2DCriticalSection);
+	myLock.Lock();
+
+	if (m_nWicBitmapWidthStep==nWidthStep && m_nWicBitmapHeight==nHeight && m_nWicBitmapChannels==nChannels && m_pWICBitmap!=nullptr) return 1;
+
+	m_nWicBitmapWidthStep	= nWidthStep;
+	m_nWicBitmapHeight		= nHeight;
+	m_nWicBitmapChannels	= nChannels;
+
+	GUID pixelFormat = GUID_WICPixelFormat32bppBGRA;
+	switch(nChannels)
+	{
+	case 1:
+		pixelFormat = GUID_WICPixelFormat8bppGray;
+		break;
+
+	case 3:
+		pixelFormat = GUID_WICPixelFormat24bppBGR;
+		break;
+
+	case 4:
+		pixelFormat = GUID_WICPixelFormat32bppBGRA;
+		break;
+	}
+
+	// create wic bitmap
+	SafeRelease(m_pWICBitmap);
+	HRESULT hr = m_pWICFactory->CreateBitmapFromMemory(
+		m_nWicBitmapWidthStep/m_nWicBitmapChannels, 
+		m_nWicBitmapHeight,
+		pixelFormat, 
+		m_nWicBitmapWidthStep,
+		m_nWicBitmapWidthStep*m_nWicBitmapHeight,
+		pBuffer,
+		&m_pWICBitmap);
+
+	if (hr!=S_OK) 
+	{
+		return 0;
+	}
+
+
+	// create format converter
+	SafeRelease(m_pWICFormatConverter);
+	hr = m_pWICFactory->CreateFormatConverter(&m_pWICFormatConverter);
+	if (hr!=S_OK) 
+	{
+		return 0;
+	}
+
+	// initialize format converter
+	hr = m_pWICFormatConverter->Initialize(
+		m_pWICBitmap,						// Input source to convert
+		GUID_WICPixelFormat32bppPBGRA,		// Destination pixel format
+		WICBitmapDitherTypeNone,			// Specified dither pattern
+		NULL,								// Specify a particular palette 
+		0.f,								// Alpha threshold
+		WICBitmapPaletteTypeCustom			// Palette translation type
+		);
+
+	if (hr!=S_OK) 
+	{
+		return 0;
+	}
+
+	return 2;
+}
+
+void CImageViewer::CalculateRect()
+{
+	switch(m_nViewType)
+	{
+	case ViewScale_Fit:
+		{
+			m_rtDestRect	= m_rtRenderRect;
+			m_rtSourceRect	= D2D1::RectF(0.0f, 0.0f, (float)GetWidth(), (float)GetHeight());
+		}
+		break;
+
+	case ViewScale_Origin:
+		{
+			int nImageWidth		= cv::min(GetWidth(), (int)m_rtRenderRect.right);
+			int nImageHeight	= cv::min(GetHeight(), (int)m_rtRenderRect.bottom);
+			m_rtDestRect		= D2D1::RectF(0.0f, 0.0f, (float)nImageWidth, (float)nImageHeight);
+			m_rtSourceRect		= D2D1::RectF((float)m_nHScroll, (float)m_nVScroll, float(m_nHScroll+nImageWidth), float(m_nVScroll+nImageHeight));
+		}
+		break;
+
+	case ViewScale_Zoom:
+		{
+			int nSrcWidth		= GetWidth();
+			int nSrcHeight		= GetHeight();
+			int nScaleWidth		= int(double(nSrcWidth) * m_dWidthScale + 0.5);
+			int nScaleHeight	= int(double(nSrcHeight) * m_dHeightScale + 0.5);
+			if (m_nScaleWidth!=nScaleWidth || m_nScaleHeight!=nScaleHeight) SetViewType(m_nViewType);
+
+			int nImageWidth		= cv::min(nScaleWidth, (int)m_rtRenderRect.right);
+			int nImageHeight	= cv::min(nScaleHeight, (int)m_rtRenderRect.bottom);
+			m_rtDestRect		= D2D1::RectF(0.0f, 0.0f, (float)nImageWidth, (float)nImageHeight);
+
+			if (m_rtViewRect.Width() < nScaleWidth)
+			{
+				m_rtSourceRect.left		= FLOAT(int(double(m_nHScroll) / m_dWidthScale));
+				m_rtSourceRect.right	= FLOAT(m_rtSourceRect.left + int(double(m_rtOrgViewRect.Width()) / m_dWidthScale));
+			}
+			else
+			{
+				m_rtSourceRect.left		= 0.f;
+				m_rtSourceRect.right	= FLOAT(nSrcWidth);
+			}
+
+			if (m_rtViewRect.Height() < nScaleHeight)
+			{
+				m_rtSourceRect.top		= FLOAT(int(double(m_nVScroll) / m_dHeightScale));
+				m_rtSourceRect.bottom	= FLOAT(m_rtSourceRect.top + int(double(m_rtOrgViewRect.Height()) / m_dHeightScale));
+			}
+			else
+			{
+				m_rtSourceRect.top		= 0;
+				m_rtSourceRect.bottom	= FLOAT(nSrcHeight);
+			}
+		}
+		break;
+	}
+
+}
+
+void CImageViewer::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+
+	CRect rect;
+	GetClientRect(rect);
+
+	// create render target
+	if (CreateRenderTarget(rect)==FALSE)
+	{
+		return;
+	}
+	
+	// image exist?
+	if (GetImageExist()==FALSE)
+	{
+		m_pD2DRenderTarget->BeginDraw();
+		m_pD2DRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::Gray));
+		m_pD2DRenderTarget->EndDraw();
+		return;
+	}
+
+	// create wic bitmap
+	int nCode = CreateWicBitmap(GetWidthStep(), GetHeight(), GetChannels(), (BYTE*)GetImageBuffer());
+	if (nCode==0)
+	{
+		return;
+	}
+
+	// create d2d bitmap
+	if (nCode==2 && m_pWICFormatConverter && m_pD2DRenderTarget)
+	{
+		SafeRelease(m_pD2DBitmap);
+		HRESULT hr = m_pD2DRenderTarget->CreateBitmapFromWicBitmap(m_pWICFormatConverter, 0, &m_pD2DBitmap);
+		if (hr!=S_OK)
+		{
+			return;
+		}
+	}
+
+	// draw
+	if (m_pD2DRenderTarget && m_pD2DBitmap)
+	{
+		// cal rect
+		CalculateRect();
+
+		m_pD2DRenderTarget->BeginDraw();
+		m_pD2DRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::Gray));
+
+		// set anti alias mode
+		if (m_pD2DRenderTarget->GetAntialiasMode() == D2D1_ANTIALIAS_MODE_ALIASED) 
+		{
+			m_pD2DRenderTarget->SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
+		}
+		
+		// draw image
+		m_pD2DRenderTarget->DrawBitmap(m_pD2DBitmap, m_rtDestRect, 1.0f, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, m_rtSourceRect);
+
+		// draw view name
+		if (m_bDrawViewName) DrawViewName();
+
+		// draw object
+		if (m_bDrawObject) DrawObject();
+
+		// draw roi
+		if (m_bDrawRoi) DrawRoi();
+
+		m_pD2DRenderTarget->EndDraw();
+	}
+
+	return;
+}
+
+void CImageViewer::DrawObject()
+{
+	if (m_pD2DRenderTarget==NULL) return;
+
+	for (ListDrawObjectIt it=m_listDrawObject.begin(); it!=m_listDrawObject.end(); it++)
+	{
+		DrawObject(*it);
+	}
+}
+
+void CImageViewer::DrawViewName()
+{
+
+}
+
+void CImageViewer::DrawRoi()
+{
+	D2D1_RECT_F rect = D2D1::RectF( FLOAT(m_rtRoiRect.Left()), FLOAT(m_rtRoiRect.Top()), FLOAT(m_rtRoiRect.Right()), FLOAT(m_rtRoiRect.Bottom()) );
+	if (IntersectsWith(m_rtSourceRect, rect)==FALSE) return;
+
+	float fPenSize = FLOAT(m_rtRoiRect.dPenSize * m_dWidthScale);
+
+	D2D1_RECT_F target;
+	target.left		= FLOAT(int(m_rtRoiRect.Left() * m_dWidthScale + 0.5) - m_nHScroll);
+	target.top		= FLOAT(int(m_rtRoiRect.Top() * m_dHeightScale + 0.5) - m_nVScroll);
+	target.right	= FLOAT(int(m_rtRoiRect.Right() * m_dWidthScale + 0.5) - m_nHScroll);
+	target.bottom	= FLOAT(int(m_rtRoiRect.Bottom() * m_dHeightScale + 0.5) - m_nVScroll);
+
+	ID2D1SolidColorBrush *pPen = NULL;
+	HRESULT hr = m_pD2DRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF(m_rtRoiRect.nPenColor, FLOAT(m_rtRoiRect.dPenOpacity))),&pPen);
+
+	ID2D1SolidColorBrush *pBrush = NULL;
+	hr = m_pD2DRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF(m_rtRoiRect.nBrushColor, FLOAT(m_rtRoiRect.dBrushOpacity))),&pBrush);
+
+	m_pD2DRenderTarget->FillRectangle(target, pBrush);
+	m_pD2DRenderTarget->DrawRectangle(target, pPen, fPenSize);
+
+	SafeRelease(pPen);
+	SafeRelease(pBrush);
+}
+
+void CImageViewer::DrawObject(const SDrawObject& object)
+{
+	D2D1_RECT_F rect = D2D1::RectF( FLOAT(object.Left()), FLOAT(object.Top()), FLOAT(object.Right()), FLOAT(object.Bottom()) );
+	if (IntersectsWith(m_rtSourceRect, rect)==FALSE) return;
+
+	//float fPenSize = FLOAT(object.dPenSize * m_dWidthScale);
+	float fPenSize = FLOAT(object.dPenSize);
+
+	D2D1_RECT_F target;
+	target.left		= FLOAT(int(object.Left() * m_dWidthScale + 0.5) - m_nHScroll);
+	target.top		= FLOAT(int(object.Top() * m_dHeightScale + 0.5) - m_nVScroll);
+	target.right	= FLOAT(int(object.Right() * m_dWidthScale + 0.5) - m_nHScroll);
+	target.bottom	= FLOAT(int(object.Bottom() * m_dHeightScale + 0.5) - m_nVScroll);
+
+	float fScaleWidth = FLOAT(GetScaleWidth());
+	float fScaleHeight = FLOAT(GetScaleHeight());
+
+	if (target.left > fScaleWidth)		target.left		= fScaleWidth;
+	if (target.top > fScaleHeight)		target.top		= fScaleHeight;
+	if (target.right > fScaleWidth)		target.right	= fScaleWidth;
+	if (target.bottom > fScaleHeight)	target.bottom	= fScaleHeight;
+
+	ID2D1SolidColorBrush *pPen = NULL;
+	HRESULT hr = m_pD2DRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF(object.nPenColor, FLOAT(object.dPenOpacity))),&pPen);
+
+	ID2D1SolidColorBrush *pBrush = NULL;
+	hr = m_pD2DRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF(object.nBrushColor, FLOAT(object.dBrushOpacity))),&pBrush);
+
+	switch(object.nType)
+	{
+	case DrawObject_Line:
+		{
+			m_pD2DRenderTarget->DrawLine(D2D1::Point2F(target.left, target.top), D2D1::Point2F(target.right, target.bottom), pPen, fPenSize);
+		}
+		break;
+
+	case DrawObject_Rectangle:
+		{
+			m_pD2DRenderTarget->FillRectangle(target, pBrush);
+			m_pD2DRenderTarget->DrawRectangle(target, pPen, fPenSize);
+		}
+		break;
+
+	case DrawObject_Ellipse:
+		{
+			D2D1_ELLIPSE  ellipse;
+			ellipse.radiusX = (target.right - target.left) / 2.0f;
+			ellipse.radiusY = (target.bottom - target.top) / 2.0f;
+			ellipse.point = D2D1::Point2F(FLOAT(target.left+ellipse.radiusX), FLOAT(target.top+ellipse.radiusY));
+			m_pD2DRenderTarget->FillEllipse(ellipse, pBrush);
+			m_pD2DRenderTarget->DrawEllipse(ellipse, pPen, fPenSize);
+		}
+		break;
+
+	case DrawObject_Polygon:
+		{
+			ID2D1PathGeometry* pPathGeometry = nullptr;
+			m_pD2DFactory->CreatePathGeometry(&pPathGeometry);
+
+			if (pPathGeometry)
+			{
+				ID2D1GeometrySink* pGeometrySink = nullptr;
+				pPathGeometry->Open(&pGeometrySink);
+				if (pGeometrySink)
+				{
+					D2D1_POINT_2F fb;
+					fb.x = FLOAT(object.vecPolygon[0].dPosX*m_dWidthScale) + target.left;
+					fb.y = FLOAT(object.vecPolygon[0].dPosY*m_dHeightScale) + target.top;
+
+					// Use D2D1_FIGURE_BEGIN_FILLED for filled
+					D2D1_FIGURE_BEGIN fg = D2D1_FIGURE_BEGIN_FILLED;
+					D2D1_FIGURE_END fe = D2D1_FIGURE_END_CLOSED;
+
+					pGeometrySink->BeginFigure(fb, fg);
+
+					int nCount = (int)object.vecPolygon.size();
+					for (int nIdx=1; nIdx<nCount; nIdx++)
+					{
+						D2D1_POINT_2F fu;
+						fu.x = FLOAT(object.vecPolygon[nIdx].dPosX*m_dWidthScale) + target.left;
+						fu.y = FLOAT(object.vecPolygon[nIdx].dPosY*m_dHeightScale) + target.top;
+						pGeometrySink->AddLine(fu);
+					}
+
+					pGeometrySink->EndFigure(fe);
+
+					pGeometrySink->Close();
+
+					SafeRelease(pGeometrySink);
+				}
+
+				m_pD2DRenderTarget->FillGeometry(pPathGeometry, pBrush);
+				m_pD2DRenderTarget->DrawGeometry(pPathGeometry, pPen, fPenSize);
+				SafeRelease(pPathGeometry);
+			}
+		}
+		break;
+	}
+
+	SafeRelease(pPen);
+	SafeRelease(pBrush);
+}
+
+BOOL CImageViewer::LoadImage(const CString& strFilename)
+{
+	if (CImageBuffer::LoadImage(strFilename)==FALSE)
+	{
+		return FALSE;
+	}
+
+	m_nWicBitmapWidthStep	= 0;
+	m_nWicBitmapHeight		= 0;
+	m_nWicBitmapChannels	= 0;
+
+	SetViewType(m_nViewType);
+
+	m_rtRoiRect.dPosX	= GetWidth() / 4;
+	m_rtRoiRect.dPosY	= GetHeight() / 4;
+	m_rtRoiRect.dSizeX	= m_rtRoiRect.dPosX * 2.0;
+	m_rtRoiRect.dSizeY	= m_rtRoiRect.dPosY * 2.0;
+	m_rtRoiRect.dPenOpacity = 1.0;
+	m_rtRoiRect.dPenSize = 2;
+	m_rtRoiRect.dBrushOpacity = 0.0;
+
+	return TRUE;
+}
+
+void CImageViewer::SetViewType(int nType)
+{
+	m_nViewType = nType; 
+
+	m_nScaleWidth = GetScaleWidth();
+	m_nScaleHeight = GetScaleHeight();
+
+	switch(m_nViewType)
+	{
+	case ViewScale_Origin:
+		if (m_rtOrgViewRect.Width() >= m_nScaleWidth)
+		{
+			m_nMaxHScroll = 0;
+		}
+		else
+		{
+			m_nMaxHScroll = m_nScaleWidth - (m_rtOrgViewRect.Width()+17);
+			if (m_nMaxHScroll < 0) 
+			{
+				m_nMaxHScroll = 0;
+			}
+			else
+			{
+				m_nMaxHScroll += 17;
+			}
+		}
+
+		if (m_rtOrgViewRect.Height() >= m_nScaleHeight)
+		{
+			m_nMaxVScroll = 0;
+		}
+		else
+		{
+			m_nMaxVScroll = m_nScaleHeight - (m_rtOrgViewRect.Height()+17);
+			if (m_nMaxVScroll < 0) 
+			{
+				m_nMaxVScroll = 0;
+			}
+			else
+			{
+				m_nMaxVScroll += 17;
+			}
+
+		}
+		break;
+
+	case ViewScale_Zoom:
+		m_nMaxHScroll = m_nScaleWidth - (m_rtOrgViewRect.Width()+17);
+		m_nMaxVScroll = m_nScaleHeight - (m_rtOrgViewRect.Height()+17);
+
+		if (m_nMaxVScroll < 0) 
+		{
+			m_nMaxVScroll = 0;
+		}
+		else
+		{
+			m_nMaxVScroll += 17;
+		}
+
+		if (m_nMaxHScroll < 0) 
+		{
+			m_nMaxHScroll = 0;
+		}
+		else
+		{
+			m_nMaxHScroll += 17;
+		}
+		break;
+
+	case ViewScale_Fit:
+		m_nMaxHScroll = m_nMaxVScroll = 0;	
+		break;
+	}
+
+	m_nHScroll = m_nVScroll = 0;
+
+	SetScrollRange(SB_HORZ, 0, m_nMaxHScroll);
+	SetScrollRange(SB_VERT, 0, m_nMaxVScroll);	
+	SetScrollPos(SB_HORZ, m_nHScroll);
+	SetScrollPos(SB_VERT, m_nVScroll);
+
+	// update view rect
+	GetClientRect(m_rtViewRect);
+
+	return;
+}
+
+int	CImageViewer::GetScaleWidth()
+{
+	CRect rect;
+	int nWidth = GetWidth();
+
+	switch(m_nViewType)
+	{
+	case ViewScale_Origin:
+		m_dWidthScale = 1.0;
+		return nWidth;
+
+	case ViewScale_Zoom:
+		return int(double(nWidth) * m_dWidthScale + 0.5);
+
+	case ViewScale_Fit:
+		if (nWidth!=0)
+			m_dWidthScale = double(m_rtOrgViewRect.Width()) / double(nWidth);
+		return int(double(nWidth) * m_dWidthScale + 0.5);
+	}
+
+	return 0;
+}
+
+int	CImageViewer::GetScaleHeight()
+{ 
+	CRect rect;
+	int nHeight = GetHeight();
+
+	switch(m_nViewType)
+	{
+	case ViewScale_Origin:
+		m_dHeightScale = 1.0;
+		return nHeight;
+
+	case ViewScale_Zoom:
+		return int(double(nHeight) * m_dHeightScale + 0.5);
+
+	case ViewScale_Fit:
+		if (nHeight!=0)
+			m_dHeightScale = double(m_rtOrgViewRect.Height()) / double(nHeight);
+		return int(double(nHeight) * m_dHeightScale + 0.5);
+	}
+
+	return 0;
+}
+
+void CImageViewer::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	switch (nSBCode)
+	{
+	case SB_LEFT:      // Scroll to far left.
+		break;
+	case SB_RIGHT:      // Scroll to far right.
+		break;
+	case SB_ENDSCROLL:   // End scroll.
+		break;
+	case SB_LINELEFT:      // Scroll left.
+		if (m_nHScroll > 0)
+			m_nHScroll -= 10; //m_nHScroll--;
+		break;
+	case SB_LINERIGHT:   // Scroll right.
+		if (m_nHScroll < m_nMaxHScroll)
+			m_nHScroll += 10; //m_nHScroll++;
+		break;
+	case SB_PAGELEFT:    // Scroll one page left.
+		if (5 < m_nMaxHScroll / 256)
+			m_nHScroll -= 40;//m_nHScroll -= 5;
+		else
+			m_nHScroll -= 20;//m_nHScroll -= m_nMaxHScroll / 256;
+
+		if (m_nHScroll < 0)
+			m_nHScroll = 0;
+		break;
+	case SB_PAGERIGHT:      // Scroll one page right.
+		if (5 < m_nMaxHScroll / 256)
+			m_nHScroll += 40;//m_nHScroll += 5;
+		else
+			m_nHScroll += 20;//m_nHScroll += m_nMaxHScroll / 256;
+
+		if (m_nHScroll > m_nMaxHScroll)
+			m_nHScroll = m_nMaxHScroll;
+		break;
+	case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position
+		break;
+	case SB_THUMBTRACK:   // Drag scroll box to specified position. nPos is the
+		m_nHScroll = nPos;
+		TRACE(_T("Horz SB_THUMBTRACK : %d\n"), nPos);
+		break;
+	}
+
+	// Set the new position of the thumb (scroll box).
+	SetScrollPos(SB_HORZ, m_nHScroll);
+
+	Invalidate(FALSE);
+
+	__super::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+
+void CImageViewer::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	switch (nSBCode)
+	{
+	case SB_BOTTOM:			// Scroll to bottom. 
+		break;
+	case SB_ENDSCROLL:		// End scroll.
+		break;
+	case SB_LINEDOWN:		// Scroll one line down.
+		if (m_nVScroll < m_nMaxVScroll)
+			m_nVScroll += 10; //m_nVScroll++;
+		break;
+	case SB_LINEUP:			// Scroll one line up. 
+		if (m_nVScroll > 0)
+			m_nVScroll -= 10; //m_nVScroll--;
+		break;
+	case SB_PAGEDOWN:		// Scroll one page down. 
+		if (5 < m_nMaxVScroll / 256)
+			m_nVScroll += 40;//m_nVScroll += 5;
+		else
+			m_nVScroll += 20;//m_nVScroll += (m_nMaxVScroll / 256);
+
+		if (m_nVScroll > m_nMaxVScroll)
+			m_nVScroll = m_nMaxVScroll;
+		break;
+	case SB_PAGEUP:			// Scroll one page up.
+		if (5 < m_nMaxVScroll / 256)
+			m_nVScroll -= 40;//m_nVScroll -= 5;
+		else
+			m_nVScroll -= 20;//m_nVScroll -= (m_nMaxVScroll / 256);
+
+		if (m_nVScroll < 0)
+			m_nVScroll = 0;
+		break;
+	case SB_THUMBPOSITION:	// Scroll to the absolute position. The current position is provided in nPos. 
+		break;
+	case SB_THUMBTRACK:		// Drag scroll box to specified position. The current position is provided in nPos. 
+		m_nVScroll = nPos;
+		TRACE(_T("Vert SB_THUMBTRACK : %d\n"), nPos);
+		break;
+	case SB_TOP:			// Scroll to top. 
+		break;
+	}
+
+	// Set the new position of the thumb (scroll box).
+	SetScrollPos(SB_VERT, m_nVScroll);
+
+	Invalidate(FALSE);
+
+	__super::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CImageViewer::SetDrawObject( BOOL bDraw )
+{
+	m_bDrawObject = bDraw;
+}
+
+void CImageViewer::SetDrawRoi( BOOL bDraw )
+{
+	m_bDrawRoi = bDraw;
+}
+
+void CImageViewer::SetWidthScale( double dScale )
+{
+	m_dWidthScale = dScale;
+}
+
+void CImageViewer::SetHeightScale( double dScale )
+{
+	m_dHeightScale = dScale;
+}
+
+void CImageViewer::SetScale( double dScale )
+{
+	m_dWidthScale = m_dHeightScale = dScale;
+}
+
+int CImageViewer::GetViewType() const
+{
+	return m_nViewType;
+}
+
+BOOL CImageViewer::GetDrawObject() const
+{
+	return m_bDrawObject;
+}
+
+BOOL CImageViewer::GetDrawRoi() const
+{
+	return m_bDrawRoi;
+}
+
+double CImageViewer::GetWidthScale( void ) const
+{
+	return m_dWidthScale;
+}
+
+double CImageViewer::GetHeightScale( void ) const
+{
+	return m_dHeightScale;
+}
+
+double CImageViewer::GetScale() const
+{
+	return (m_dWidthScale+m_dHeightScale) / 2.0;
+}
+
+int CImageViewer::GetHScrollPos( void ) const
+{
+	return m_nHScroll;
+}
+
+int CImageViewer::GetVScrollPos( void ) const
+{
+	return m_nVScroll;
+}
+
+void CImageViewer::AddDrawObject( const SDrawObject& drawObject )
+{
+	m_listDrawObject.push_back(drawObject);
+}
+
+void CImageViewer::DeleteAllDrawObject( void )
+{
+	m_listDrawObject.clear();
+}
+
+void CImageViewer::ClearScreen()
+{
+	CPaintDC dc(this); // device context for painting
+
+	m_pD2DRenderTarget->BeginDraw();
+	m_pD2DRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::Gray));
+	m_pD2DRenderTarget->EndDraw();
+	return;
+}
+
+void CImageViewer::OnSize(UINT nType, int cx, int cy)
+{
+	__super::OnSize(nType, cx, cy);
+
+
+
+	return;
+}
+
+
+int CImageViewer::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (__super::OnCreate(lpCreateStruct) == -1)
+		return -1;
+
+	GetClientRect(m_rtOrgViewRect);
+
+	return 0;
+}
+
+void CImageViewer::SetDrawViewName( BOOL bDraw )
+{
+	m_bDrawViewName = bDraw;
+}
+
+BOOL CImageViewer::GetDrawViewName() const
+{
+	return m_bDrawViewName;
+}
+
+void CImageViewer::SetViewName( const CString& strValue )
+{
+	m_strViewName = strValue;
+}
+
+void CImageViewer::SetRoiRect( const CRect& rtRect )
+{
+	m_rtRoiRect.dPosX	= rtRect.left;
+	m_rtRoiRect.dPosY	= rtRect.top;
+	m_rtRoiRect.dSizeX	= rtRect.Width();
+	m_rtRoiRect.dSizeY	= rtRect.Height();
+}
+
+CString CImageViewer::GetViewName() const
+{
+	return m_strViewName;
+}
+
+CRect CImageViewer::GetRoiRect() const
+{
+	CRect rect;
+	rect.left	= (int) (m_rtRoiRect.dPosX + 0.5);
+	rect.top	= (int) (m_rtRoiRect.dPosY + 0.5);
+	rect.right	= rect.left + (int) (m_rtRoiRect.dSizeX + 0.5);
+	rect.bottom	= rect.top + (int) (m_rtRoiRect.dSizeY + 0.5);
+	return rect;
+}
+
diff --git a/Common_Class/CHImageBuffer/ReadMe.txt b/Common_Class/CHImageBuffer/ReadMe.txt
new file mode 100644
index 0000000..c8fde8d
--- /dev/null
+++ b/Common_Class/CHImageBuffer/ReadMe.txt
@@ -0,0 +1,67 @@
+锘�================================================================================
+    MICROSOFT 鍩虹绫诲簱 : CHImageBuffer 椤圭洰姒傝堪
+===============================================================================
+
+搴旂敤绋嬪簭鍚戝宸蹭负鎮ㄥ垱寤轰簡姝� CHImageBuffer 搴旂敤绋嬪簭銆傛搴旂敤绋嬪簭涓嶄粎婕旂ず Microsoft 鍩虹绫荤殑鍩烘湰浣跨敤鏂规硶锛岃繕鍙綔涓烘偍缂栧啓搴旂敤绋嬪簭鐨勮捣鐐广��
+
+鏈枃浠舵瑕佷粙缁嶇粍鎴� CHImageBuffer 搴旂敤绋嬪簭鐨勬瘡涓枃浠剁殑鍐呭銆�
+
+CHImageBuffer.vcxproj
+    杩欐槸浣跨敤搴旂敤绋嬪簭鍚戝鐢熸垚鐨� VC++ 椤圭洰鐨勪富椤圭洰鏂囦欢锛屽叾涓寘鍚敓鎴愯鏂囦欢鐨� Visual C++ 鐨勭増鏈俊鎭紝浠ュ強鏈夊叧浣跨敤搴旂敤绋嬪簭鍚戝閫夋嫨鐨勫钩鍙般�侀厤缃拰椤圭洰鍔熻兘鐨勪俊鎭��
+
+CHImageBuffer.vcxproj.filters
+    杩欐槸浣跨敤鈥滃簲鐢ㄧ▼搴忓悜瀵尖�濈敓鎴愮殑 VC++ 椤圭洰绛涢�夊櫒鏂囦欢銆傚畠鍖呭惈鏈夊叧椤圭洰鏂囦欢涓庣瓫閫夊櫒涔嬮棿鐨勫叧鑱斾俊鎭�傚湪 IDE 涓紝閫氳繃杩欑鍏宠仈锛屽湪鐗瑰畾鑺傜偣涓嬩互鍒嗙粍褰㈠紡鏄剧ず鍏锋湁鐩镐技鎵╁睍鍚嶇殑鏂囦欢銆備緥濡傦紝鈥�.cpp鈥濇枃浠朵笌鈥滄簮鏂囦欢鈥濈瓫閫夊櫒鍏宠仈銆�
+
+CHImageBuffer.h
+    杩欐槸搴旂敤绋嬪簭鐨勪富澶存枃浠躲��
+    鍏朵腑鍖呮嫭鍏朵粬椤圭洰鐗瑰畾鐨勬爣澶达紙鍖呮嫭 Resource.h锛夛紝骞跺0鏄� CCHImageBufferApp 搴旂敤绋嬪簭绫汇��
+
+CHImageBuffer.cpp
+    杩欐槸鍖呭惈搴旂敤绋嬪簭绫� CCHImageBufferApp 鐨勪富搴旂敤绋嬪簭婧愭枃浠躲��
+
+CHImageBuffer.rc
+    杩欐槸绋嬪簭浣跨敤鐨勬墍鏈� Microsoft Windows 璧勬簮鐨勫垪琛ㄣ�傚畠鍖呮嫭 RES 瀛愮洰褰曚腑瀛樺偍鐨勫浘鏍囥�佷綅鍥惧拰鍏夋爣銆傛鏂囦欢鍙互鐩存帴鍦� Microsoft Visual C++ 涓繘琛岀紪杈戙�傞」鐩祫婧愬寘鍚湪 2052 涓��
+
+res\CHImageBuffer.ico
+    杩欐槸鐢ㄤ綔搴旂敤绋嬪簭鍥炬爣鐨勫浘鏍囨枃浠躲�傛鍥炬爣鍖呮嫭鍦ㄤ富璧勬簮鏂囦欢 CHImageBuffer.rc 涓��
+
+res\CHImageBuffer.rc2
+    姝ゆ枃浠跺寘鍚笉鍦� Microsoft Visual C++ 涓繘琛岀紪杈戠殑璧勬簮銆傛偍搴旇灏嗕笉鍙敱璧勬簮缂栬緫鍣ㄧ紪杈戠殑鎵�鏈夎祫婧愭斁鍦ㄦ鏂囦欢涓��
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+搴旂敤绋嬪簭鍚戝鍒涘缓涓�涓璇濇绫伙細
+
+CHImageBufferDlg.h銆丆HImageBufferDlg.cpp - 瀵硅瘽妗�
+    杩欎簺鏂囦欢鍖呭惈 CCHImageBufferDlg 绫汇�傛绫诲畾涔夊簲鐢ㄧ▼搴忕殑涓诲璇濇鐨勮涓恒�傚璇濇妯℃澘鍖呭惈鍦� CHImageBuffer.rc 涓紝璇ユ枃浠跺彲浠ュ湪 Microsoft Visual C++ 涓紪杈戙��
+
+/////////////////////////////////////////////////////////////////////////////
+
+鍏朵粬鍔熻兘锛�
+
+ActiveX 鎺т欢
+    璇ュ簲鐢ㄧ▼搴忓寘鍚浣跨敤 ActiveX 鎺т欢鐨勬敮鎸併��
+
+/////////////////////////////////////////////////////////////////////////////
+
+鍏朵粬鏍囧噯鏂囦欢:
+
+StdAfx.h, StdAfx.cpp
+    杩欎簺鏂囦欢鐢ㄤ簬鐢熸垚鍚嶄负 CHImageBuffer.pch 鐨勯缂栬瘧澶� (PCH) 鏂囦欢鍜屽悕涓� StdAfx.obj 鐨勯缂栬瘧绫诲瀷鏂囦欢銆�
+
+Resource.h
+    杩欐槸鏍囧噯澶存枃浠讹紝鍙敤浜庡畾涔夋柊鐨勮祫婧� ID銆侻icrosoft Visual C++ 灏嗚鍙栧苟鏇存柊姝ゆ枃浠躲��
+
+CHImageBuffer.manifest
+	Windows XP 浣跨敤搴旂敤绋嬪簭娓呭崟鏂囦欢鏉ユ弿杩扮壒瀹氱増鏈殑骞惰绋嬪簭闆嗙殑搴旂敤绋嬪簭渚濊禆椤广�傚姞杞界▼搴忎娇鐢ㄨ繖浜涗俊鎭潵浠庣▼搴忛泦缂撳瓨涓姞杞界浉搴旂殑绋嬪簭闆嗭紝骞朵繚鎶ゅ叾涓嶈搴旂敤绋嬪簭璁块棶銆傚簲鐢ㄧ▼搴忔竻鍗曞彲鑳戒細鍖呭惈鍦ㄥ唴锛屼互浣滀负涓庡簲鐢ㄧ▼搴忓彲鎵ц鏂囦欢瀹夎鍦ㄥ悓涓�鏂囦欢澶逛腑鐨勫閮� .manifest 鏂囦欢杩涜閲嶆柊鍒嗗彂锛屽畠杩樺彲鑳戒互璧勬簮鐨勫舰寮忓寘鍚湪鍙墽琛屾枃浠朵腑銆�
+/////////////////////////////////////////////////////////////////////////////
+
+鍏朵粬娉ㄩ噴:
+
+搴旂敤绋嬪簭鍚戝浣跨敤鈥淭ODO:鈥濇潵鎸囩ず搴旀坊鍔犳垨鑷畾涔夌殑婧愪唬鐮侀儴鍒嗐��
+
+濡傛灉搴旂敤绋嬪簭浣跨敤鍏变韩 DLL 涓殑 MFC锛屾偍灏嗛渶瑕侀噸鏂板垎鍙� MFC DLL銆傚鏋滃簲鐢ㄧ▼搴忔墍浣跨敤鐨勮瑷�涓庢搷浣滅郴缁熺殑鍖哄煙璁剧疆涓嶅悓锛屽垯杩橀渶瑕侀噸鏂板垎鍙戠浉搴旂殑鏈湴鍖栬祫婧� mfc110XXX.DLL銆�
+鏈夊叧涓婅堪璇濋鐨勬洿澶氫俊鎭紝璇峰弬瑙� MSDN 鏂囨。涓湁鍏抽噸鏂板垎鍙� Visual C++ 搴旂敤绋嬪簭鐨勯儴鍒嗐��
+
+/////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/Common_Class/CHImageBuffer/Resource.h b/Common_Class/CHImageBuffer/Resource.h
new file mode 100644
index 0000000..cf91ae0
--- /dev/null
+++ b/Common_Class/CHImageBuffer/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by CHImageBuffer.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	14000
+#define _APS_NEXT_CONTROL_VALUE		14000
+#define _APS_NEXT_SYMED_VALUE		14000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/CHImageBuffer/dllmain.cpp b/Common_Class/CHImageBuffer/dllmain.cpp
new file mode 100644
index 0000000..204f3da
--- /dev/null
+++ b/Common_Class/CHImageBuffer/dllmain.cpp
@@ -0,0 +1,36 @@
+// dllmain.cpp : 定义 DLL 应用程序的入口点。
+//
+
+#include "stdafx.h"
+#include <afxwin.h>
+#include <afxdllx.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+static AFX_EXTENSION_MODULE CHImageBufferDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+	UNREFERENCED_PARAMETER(lpReserved);
+
+	if (dwReason == DLL_PROCESS_ATTACH)
+	{
+		TRACE0("CHImageBuffer.DLL 应用程序的入口点。\n");
+
+		if (!AfxInitExtensionModule(CHImageBufferDLL, hInstance))
+			return 0;
+
+		new CDynLinkLibrary(CHImageBufferDLL);
+
+	}
+	else if (dwReason == DLL_PROCESS_DETACH)
+	{
+		TRACE0("CHImageBuffer.DLL 应用程序的入口点。\n");
+
+		AfxTermExtensionModule(CHImageBufferDLL);
+	}
+	return 1;
+}
diff --git a/Common_Class/CHImageBuffer/res/CHImageBuffer.rc2 b/Common_Class/CHImageBuffer/res/CHImageBuffer.rc2
new file mode 100644
index 0000000..f199448
--- /dev/null
+++ b/Common_Class/CHImageBuffer/res/CHImageBuffer.rc2
Binary files differ
diff --git a/Common_Class/CHImageBuffer/stdafx.cpp b/Common_Class/CHImageBuffer/stdafx.cpp
new file mode 100644
index 0000000..96fe070
--- /dev/null
+++ b/Common_Class/CHImageBuffer/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp:只有标准包含文件的源文件。
+// CHImageBuffer.pch是预先编译的头。
+// stdafx.obj包含预先编译的格式信息。
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/CHImageBuffer/stdafx.h b/Common_Class/CHImageBuffer/stdafx.h
new file mode 100644
index 0000000..92bfd67
--- /dev/null
+++ b/Common_Class/CHImageBuffer/stdafx.h
@@ -0,0 +1,39 @@
+// stdafx.h : 标准系统包含文件的包含文件,
+// 或是经常使用但不常更改的
+// 特定于项目的包含文件
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
+
+#include <afxwin.h>         // MFC 核心组件和标准组件
+#include <afxext.h>         // MFC 扩展
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE class
+#include <afxodlgs.h>       // MFC OLE is very clever
+#include <afxdisp.h>        // MFC 自动化类
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 数据库类。
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 数据库类。
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>             // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
diff --git a/Common_Class/CHImageBuffer/targetver.h b/Common_Class/CHImageBuffer/targetver.h
new file mode 100644
index 0000000..416cebf
--- /dev/null
+++ b/Common_Class/CHImageBuffer/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include <SDKDDKVer.h>
diff --git a/Common_Class/CHThreadPool/CHThreadPool.cpp b/Common_Class/CHThreadPool/CHThreadPool.cpp
new file mode 100644
index 0000000..80fd588
--- /dev/null
+++ b/Common_Class/CHThreadPool/CHThreadPool.cpp
@@ -0,0 +1,10 @@
+// CHThreadPool.cpp : 秦寸 DLL狼 檬扁拳 风凭阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
diff --git a/Common_Class/CHThreadPool/CHThreadPool.def b/Common_Class/CHThreadPool/CHThreadPool.def
new file mode 100644
index 0000000..316d433
--- /dev/null
+++ b/Common_Class/CHThreadPool/CHThreadPool.def
@@ -0,0 +1,6 @@
+; CHThreadPool.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
diff --git a/Common_Class/CHThreadPool/CHThreadPool.rc b/Common_Class/CHThreadPool/CHThreadPool.rc
new file mode 100644
index 0000000..4c53040
--- /dev/null
+++ b/Common_Class/CHThreadPool/CHThreadPool.rc
Binary files differ
diff --git a/Common_Class/CHThreadPool/CHThreadPool.sln b/Common_Class/CHThreadPool/CHThreadPool.sln
new file mode 100644
index 0000000..cd42af6
--- /dev/null
+++ b/Common_Class/CHThreadPool/CHThreadPool.sln
@@ -0,0 +1,26 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CHThreadPool", "CHThreadPool.vcxproj", "{A397C4E0-6CDE-411E-960B-FA381D6E612A}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Debug|Win32.Build.0 = Debug|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Debug|x64.ActiveCfg = Debug|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Debug|x64.Build.0 = Debug|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Release|Win32.ActiveCfg = Release|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Release|Win32.Build.0 = Release|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Release|x64.ActiveCfg = Release|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/Common_Class/CHThreadPool/CHThreadPool.vcxproj b/Common_Class/CHThreadPool/CHThreadPool.vcxproj
new file mode 100644
index 0000000..805d91b
--- /dev/null
+++ b/Common_Class/CHThreadPool/CHThreadPool.vcxproj
@@ -0,0 +1,354 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Simulation|Win32">
+      <Configuration>Simulation</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Simulation|x64">
+      <Configuration>Simulation</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{A397C4E0-6CDE-411E-960B-FA381D6E612A}</ProjectGuid>
+    <RootNamespace>CHThreadPool</RootNamespace>
+    <Keyword>MFCDLLProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <TargetName>$(ProjectName)D</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <TargetName>$(ProjectName)D</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <TargetName>$(ProjectName)D</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\CHThreadPool.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\CHThreadPool.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\CHThreadPool.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ImportLibrary>
+      </ImportLibrary>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\CHThreadPool.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ImportLibrary>..\Library\CommonLibs\$(TargetName).lib</ImportLibrary>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\CHThreadPool.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\CHThreadPool.def</ModuleDefinitionFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ImportLibrary>
+      </ImportLibrary>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\CHThreadPool\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\CHThreadPool\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\CHThreadPool\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\ThreadData.h" "$(SolutionDir)Lib\CHThreadPool\include\ThreadData.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\ThreadPool.h" "$(SolutionDir)Lib\CHThreadPool\include\ThreadPool.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\TimerThreadPool.h" "$(SolutionDir)Lib\CHThreadPool\include\TimerThreadPool.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\WaitThreadPool.h" "$(SolutionDir)Lib\CHThreadPool\include\WaitThreadPool.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\WorkThreadArray.h" "$(SolutionDir)Lib\CHThreadPool\include\WorkThreadArray.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\WorkThreadPool.h" "$(SolutionDir)Lib\CHThreadPool\include\WorkThreadPool.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <None Include="CHThreadPool.def" />
+    <None Include="ReadMe.txt" />
+    <None Include="res\CHThreadPool.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="CHThreadPool.cpp" />
+    <ClCompile Include="dllmain.cpp">
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="PriorityThread.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="ThreadPool.cpp" />
+    <ClCompile Include="TimerThreadPool.cpp" />
+    <ClCompile Include="WaitThreadPool.cpp" />
+    <ClCompile Include="WorkThreadArray.cpp" />
+    <ClCompile Include="WorkThreadPool.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="CHThreadPool.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\PriorityThread.h" />
+    <ClInclude Include="Header\ThreadData.h" />
+    <ClInclude Include="Header\ThreadPool.h" />
+    <ClInclude Include="Header\TimerThreadPool.h" />
+    <ClInclude Include="Header\WaitThreadPool.h" />
+    <ClInclude Include="Header\WorkThreadArray.h" />
+    <ClInclude Include="Header\WorkThreadPool.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/CHThreadPool/CHThreadPool.vcxproj.filters b/Common_Class/CHThreadPool/CHThreadPool.vcxproj.filters
new file mode 100644
index 0000000..10c3b07
--- /dev/null
+++ b/Common_Class/CHThreadPool/CHThreadPool.vcxproj.filters
@@ -0,0 +1,92 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="CHThreadPool.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\CHThreadPool.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="CHThreadPool.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="dllmain.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ThreadPool.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="TimerThreadPool.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="WaitThreadPool.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="WorkThreadPool.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="PriorityThread.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="WorkThreadArray.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="CHThreadPool.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\PriorityThread.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ThreadData.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ThreadPool.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\TimerThreadPool.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\WaitThreadPool.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\WorkThreadPool.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\WorkThreadArray.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/CHThreadPool/Header/PriorityThread.h b/Common_Class/CHThreadPool/Header/PriorityThread.h
new file mode 100644
index 0000000..b56aeab
--- /dev/null
+++ b/Common_Class/CHThreadPool/Header/PriorityThread.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "WorkThreadPool.h"
+
+class /* AFX_EXT_CLASS */ CPriorityThreadData : public CWorkThreadData
+{
+public:
+	CPriorityThreadData(PVOID pPtr) : CWorkThreadData(pPtr)
+	{
+		m_unMsg = 0;
+		m_WParam = NULL;
+		m_LParam = NULL;
+	}
+	virtual ~CPriorityThreadData()
+	{
+	}
+
+	UINT		m_unMsg;
+	WPARAM		m_WParam;
+	LPARAM		m_LParam;
+};
+
+interface IPriorityThread2Parent
+{
+	virtual void IPT2P_PriorityThread(CPriorityThreadData* pData) = 0;
+};
+
+class /* AFX_EXT_CLASS */ CPriorityThread : public CWorkThreadPool
+{
+public:
+	CPriorityThread(IPriorityThread2Parent* pFT2P, int nPriority);
+	virtual ~CPriorityThread(void);
+	BOOL AddPriorityThreadData(UINT msg, WPARAM wParam = NULL, LPARAM lParam = NULL);
+
+protected:
+	virtual void WorkThreadProcess(PVOID pParameter);
+
+protected:
+	IPriorityThread2Parent*		m_pPT2P;
+	int							m_nPriority;	
+};
diff --git a/Common_Class/CHThreadPool/Header/ThreadData.h b/Common_Class/CHThreadPool/Header/ThreadData.h
new file mode 100644
index 0000000..84fcb66
--- /dev/null
+++ b/Common_Class/CHThreadPool/Header/ThreadData.h
@@ -0,0 +1,20 @@
+#pragma once
+
+class CWorkThreadData
+{
+public:
+	CWorkThreadData(PVOID pPtr) 
+	{
+		pCallerPtr = pPtr;
+		bProcessed = false;
+	}
+
+	virtual ~CWorkThreadData()
+	{
+		pCallerPtr = NULL;
+		bProcessed = false;
+	}
+	PVOID	pCallerPtr;
+	bool	bProcessed;
+};
+
diff --git a/Common_Class/CHThreadPool/Header/ThreadPool.h b/Common_Class/CHThreadPool/Header/ThreadPool.h
new file mode 100644
index 0000000..8ec7fb5
--- /dev/null
+++ b/Common_Class/CHThreadPool/Header/ThreadPool.h
@@ -0,0 +1,42 @@
+#pragma once
+
+typedef struct _CH_TP_CALLBACK_ENVIRON 
+{
+	TP_VERSION                         Version;
+	PTP_POOL                           Pool;
+	PTP_CLEANUP_GROUP                  CleanupGroup;
+	PTP_CLEANUP_GROUP_CANCEL_CALLBACK  CleanupGroupCancelCallback;
+	PVOID                              RaceDll;
+	struct _ACTIVATION_CONTEXT        *ActivationContext;
+	PTP_SIMPLE_CALLBACK                FinalizationCallback;
+	union {
+		DWORD                          Flags;
+		struct {
+			DWORD                      LongFunction :  1;
+			DWORD                      Persistent   :  1;
+			DWORD                      Private      : 30;
+		} s;
+	} u;    
+	TP_CALLBACK_PRIORITY               CallbackPriority;
+	DWORD                              Size;
+} CH_TP_CALLBACK_ENVIRON;
+
+class AFX_EXT_CLASS CThreadPool
+{
+public:
+	CThreadPool(int nThreadCount=1);
+	virtual ~CThreadPool(void);
+	int	GetThreadCount() const;
+
+private:
+	void CreateThreadPools(int nThreadCount=1);
+	void CloseThreadPools();
+
+protected:
+	int						m_nThreadCount;
+	int						m_nRollback;
+	PTP_POOL				m_pPool;
+	CH_TP_CALLBACK_ENVIRON	m_CallBackEnviron;
+	PTP_CLEANUP_GROUP		m_pCleanupGroup;
+};
+
diff --git a/Common_Class/CHThreadPool/Header/TimerThreadPool.h b/Common_Class/CHThreadPool/Header/TimerThreadPool.h
new file mode 100644
index 0000000..11f92a2
--- /dev/null
+++ b/Common_Class/CHThreadPool/Header/TimerThreadPool.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "ThreadPool.h"
+
+class AFX_EXT_CLASS CTimerThreadPool : public CThreadPool
+{
+public:
+	CTimerThreadPool(DWORD dwPeriod=100, int nThreadCount=1);
+	virtual ~CTimerThreadPool(void);
+	DWORD GetPeriod() const;
+	virtual BOOL StartThread();
+	virtual void StopThread();
+
+protected:
+	virtual void TimerThreadProcess(PVOID pParameter) = 0;
+
+protected:
+	BOOL CreateTimerThread(PVOID pParameter);
+	void CloseTimerThread();
+	static VOID CALLBACK TimerCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_TIMER pTimer);
+
+protected:
+	DWORD					m_dwPeriod;
+	PTP_TIMER				m_pTimer;
+	PTP_TIMER_CALLBACK		m_pTimerCallback;
+};
+
diff --git a/Common_Class/CHThreadPool/Header/WaitThreadPool.h b/Common_Class/CHThreadPool/Header/WaitThreadPool.h
new file mode 100644
index 0000000..4ed47be
--- /dev/null
+++ b/Common_Class/CHThreadPool/Header/WaitThreadPool.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "ThreadPool.h"
+
+class AFX_EXT_CLASS CWaitThreadPool : public CThreadPool
+{
+public:
+	CWaitThreadPool(int nThreadCount=1);
+	virtual ~CWaitThreadPool(void);
+	virtual BOOL SetEvent1();
+	virtual BOOL ResetEvent1();
+		
+protected:
+	virtual void WaitThreadProcess(PVOID pParameter) = 0;
+
+protected:
+	BOOL CreateWaitThread(PVOID pParameter);
+	void CloseWaitThread();
+	static VOID CALLBACK WaitCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_WAIT pWait, TP_WAIT_RESULT WaitResult);
+
+protected:
+	HANDLE					m_hEvent;
+	PTP_WAIT				m_pWait;
+	PTP_WAIT_CALLBACK		m_pWaitCallback;
+};
\ No newline at end of file
diff --git a/Common_Class/CHThreadPool/Header/WorkThreadArray.h b/Common_Class/CHThreadPool/Header/WorkThreadArray.h
new file mode 100644
index 0000000..7cbe254
--- /dev/null
+++ b/Common_Class/CHThreadPool/Header/WorkThreadArray.h
@@ -0,0 +1,29 @@
+#pragma once
+#include "WorkThreadPool.h"
+
+interface IWorkThreadArray2Parent
+{
+	virtual void WorkThreadProcessArray(PVOID pParameter) = 0;
+};
+
+class AFX_EXT_CLASS CWorkThreadArray : public CWorkThreadPool
+{
+public:
+	CWorkThreadArray();
+	CWorkThreadArray(IWorkThreadArray2Parent* pInterface, int nThreadPool);
+	~CWorkThreadArray(void);
+
+	void			SetInterface(IWorkThreadArray2Parent* pInterface)	{m_pInterface = pInterface;};
+
+	BOOL			CreateWorkThread(PVOID pParameter);
+
+	virtual void	WorkThreadProcess(PVOID pParameter);
+
+	BOOL			GetComplete()	{return m_bComplete;};
+
+private:
+
+	IWorkThreadArray2Parent* m_pInterface;
+
+	BOOL					 m_bComplete;
+};
\ No newline at end of file
diff --git a/Common_Class/CHThreadPool/Header/WorkThreadPool.h b/Common_Class/CHThreadPool/Header/WorkThreadPool.h
new file mode 100644
index 0000000..025de09
--- /dev/null
+++ b/Common_Class/CHThreadPool/Header/WorkThreadPool.h
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "ThreadData.h"
+#include "ThreadPool.h"
+
+#include <deque>
+typedef std::deque<CWorkThreadData*>				DequeWorkThreadData;
+typedef std::deque<CWorkThreadData*>::iterator		DequeWorkThreadDataIt;
+
+class AFX_EXT_CLASS CWorkThreadPool : public CThreadPool
+{
+public:
+	CWorkThreadPool(int nThreadCount=1);
+	virtual ~CWorkThreadPool(void);
+	size_t GetThreadDataCount();
+
+protected:
+	virtual void WorkThreadProcess(PVOID pParameter) = 0;
+
+protected:
+	BOOL CreateWorkThread(PVOID pParameter);
+	void CloseWorkThread();
+	void ClearThreadData();
+	static VOID CALLBACK WorkCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_WORK pWork);
+
+private:
+	CWorkThreadData* AddThreadData(CWorkThreadData* pThreadData);
+
+protected:
+	PTP_WORK				m_pWork;
+	PTP_WORK_CALLBACK		m_pWorkCallback;
+
+private:
+	DequeWorkThreadData		m_deqThreadData;
+	CCriticalSection		m_csThreadData;
+};
+
diff --git a/Common_Class/CHThreadPool/PriorityThread.cpp b/Common_Class/CHThreadPool/PriorityThread.cpp
new file mode 100644
index 0000000..2969de9
--- /dev/null
+++ b/Common_Class/CHThreadPool/PriorityThread.cpp
@@ -0,0 +1,43 @@
+#include "StdAfx.h"
+#include "PriorityThread.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+CPriorityThread::CPriorityThread(IPriorityThread2Parent* pFT2P, int nPriority) : CWorkThreadPool(1), m_pPT2P(pFT2P)
+{
+	m_nPriority = nPriority;
+}
+
+CPriorityThread::~CPriorityThread(void)
+{
+
+}
+
+void CPriorityThread::WorkThreadProcess(PVOID pParameter)
+{
+	if (m_pPT2P==NULL) return;
+
+	CPriorityThreadData *pData = static_cast<CPriorityThreadData*>(pParameter);
+	if (pData==NULL) return;
+
+	HANDLE hThread = GetCurrentThread();
+	SetThreadPriority(hThread, m_nPriority);
+
+	m_pPT2P->IPT2P_PriorityThread(pData);	
+}
+
+BOOL CPriorityThread::AddPriorityThreadData(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+	CPriorityThreadData *pData = new CPriorityThreadData(this);
+	if (pData==NULL) return FALSE;
+
+	pData->m_unMsg = msg;
+	pData->m_WParam = wParam;
+	pData->m_LParam = lParam;
+
+	return CreateWorkThread(pData);
+}
\ No newline at end of file
diff --git a/Common_Class/CHThreadPool/ReadMe.txt b/Common_Class/CHThreadPool/ReadMe.txt
new file mode 100644
index 0000000..db27da1
--- /dev/null
+++ b/Common_Class/CHThreadPool/ReadMe.txt
@@ -0,0 +1,60 @@
+锘�========================================================================
+    MFC 霛检澊敫岆煬毽� : CHThreadPool 頂勲鞝濏姼 臧滌殧
+========================================================================
+
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 鞚� CHThreadPool DLL鞚� 毵岆摛鞐堨姷雼堧嫟.  鞚� DLL鞚�
+MFC鞚� 旮半掣 靷毄氩曥潉 氤挫棳 欷� 肟愲 鞎勲媹霛� DLL鞚� 鞛戩劚頃橁赴 鞙勴暅 旮半掣 甑“毳� 鞝滉车頃╇媹雼�.
+
+鞚� 韺岇澕鞐愲姅 CHThreadPool DLL鞚� 甑劚頃橂姅 臧� 韺岇澕鞐� 雽�頃�
+鞖旍暯 靹る獏鞚� 韽暔霅橃柎 鞛堨姷雼堧嫟.
+
+CHThreadPool.vcxproj
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靸濎劚頃� VC++ 頂勲鞝濏姼鞚� 旮半掣 頂勲鞝濏姼 韺岇澕鞛呺媹雼�.
+    韺岇澕鞚� 靸濎劚頃� Visual C++ 氩勳爠鞐� 雽�頃� 鞝曤炒鞕� 鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靹犿儩頃� 頂岆灚韽�,
+    甑劚 氚� 頂勲鞝濏姼 旮半姤鞐� 雽�頃� 鞝曤炒臧� 韽暔霅橃柎 鞛堨姷雼堧嫟.
+
+CHThreadPool.vcxproj.filters
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靸濎劚霅� VC++ 頂勲鞝濏姼鞚� 頃勴劙 韺岇澕鞛呺媹雼�. 
+    鞚� 韺岇澕鞐愲姅 頂勲鞝濏姼鞚� 韺岇澕瓿� 頃勴劙 臧勳潣 鞐瓣舶 鞝曤炒臧� 霌れ柎 鞛堨姷雼堧嫟.
+    鞚措煬頃� 鞐瓣舶鞚� 韸轨爼 雲鸽摐鞐愳劀 鞙犾偓頃� 頇曥灔氇呾溂搿� 攴鸽9頇旊悳 韺岇澕鞚� 響滌嫓頃橁赴 鞙勴暣 IDE鞐愳劀
+    靷毄霅╇媹雼�. 鞓堧ゼ 霌れ柎 ".cpp" 韺岇澕鞚� "靻岇姢 韺岇澕" 頃勴劙鞕� 鞐瓣舶霅橃柎 鞛堨姷雼堧嫟.
+
+CHThreadPool.cpp
+    鞚措姅 DllMain()鞚� 鞝曥潣霅橃柎 鞛堧姅 旮半掣 DLL 靻岇姢
+    韺岇澕鞛呺媹雼�.
+
+CHThreadPool.rc
+    頂勲攴鸽灗鞐愳劀 靷毄頃橂姅 氇摖 Microsoft Windows 毽唽鞀れ潣 氇╇鞛呺媹雼�.
+    鞐赴鞐愲姅 RES 頃橃渼 霐旊爥韯半Μ鞐� 鞝�鞛ル悳 鞎勳澊旖�, 牍勴姼毵� 氚� 旎れ劀臧�
+    韽暔霅╇媹雼�.  鞚� 韺岇澕鞚� Microsoft Visual C++鞐愳劀
+    歆侅爲 韼胳頃� 靾� 鞛堨姷雼堧嫟.
+
+res\CHThreadPool.rc2
+    鞚� 韺岇澕鞐愲姅 Microsoft Visual C++ 鞚挫櫢鞚� 雼るジ 霃勱惮鞐愳劀 韼胳頃� 毽唽鞀り皜
+    韽暔霅橃柎 鞛堨姷雼堧嫟.  毽唽鞀� 韼胳旮半 韼胳頃� 靾� 鞐嗠姅 氇摖 毽唽鞀る姅
+    鞚� 韺岇澕鞐� 雱l柎鞎� 頃╇媹雼�.
+
+CHThreadPool.def
+    鞚� 韺岇澕鞐愲姅 Microsoft Windows鞐愳劀 鞁ろ枆霅橁赴 鞙勴暣 鞝滉车頃挫暭 頃橂姅
+    DLL鞐� 雽�頃� 鞝曤炒臧� 韽暔霅橃柎 鞛堨溂氅�,  DLL鞚� 鞚措 氚� 靹る獏瓿� 臧欖潃
+    毵り皽 氤�靾橁皜 鞝曥潣霅橃柎 鞛堨姷雼堧嫟.  霕愴暅 DLL鞐愳劀 頃垬霃� 雮措炒雰呺媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
+旮绊儉 響滌 韺岇澕:
+
+StdAfx.h, StdAfx.cpp
+    鞚� 韺岇澕鞚� 氙鸽Μ 旎错寣鞚茧悳 項る崝(PCH) 韺岇澕 CHThreadPool.pch鞕�
+    氙鸽Μ 旎错寣鞚茧悳 順曥嫕(PCT) 韺岇澕 StdAfx.obj毳� 牍岆摐頃橂姅 雿� 靷毄霅╇媹雼�.
+
+Resource.h
+    靸� 毽唽鞀� ID毳� 鞝曥潣頃橂姅 響滌 項る崝 韺岇澕鞛呺媹雼�.
+    Microsoft Visual C++鞐愳劀 鞚� 韺岇澕鞚� 鞚疥碃 鞐呺嵃鞚错姼頃╇媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
+旮绊儉 彀戈碃:
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 靷毄頃橂姅 "TODO:" 欤检劃鞚� 靷毄鞛愱皜 於旉皜頃橁卑雮� 靷毄鞛� 歆�鞝曧暣鞎� 頃橂姅
+靻岇姢 旖旊摐 攵�攵勳潉 雮橅儉雰呺媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/CHThreadPool/Resource.h b/Common_Class/CHThreadPool/Resource.h
new file mode 100644
index 0000000..6b266f4
--- /dev/null
+++ b/Common_Class/CHThreadPool/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by CHThreadPool.rc
+//
+
+// 促澜篮 货 俺眉俊 荤侩且 扁夯蔼涝聪促.
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	8000
+#define _APS_NEXT_CONTROL_VALUE		8000
+#define _APS_NEXT_SYMED_VALUE		8000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/CHThreadPool/ThreadPool.cpp b/Common_Class/CHThreadPool/ThreadPool.cpp
new file mode 100644
index 0000000..085d685
--- /dev/null
+++ b/Common_Class/CHThreadPool/ThreadPool.cpp
@@ -0,0 +1,102 @@
+#include "StdAfx.h"
+#include "ThreadPool.h"
+
+
+CThreadPool::CThreadPool(int nThreadCount) : m_nThreadCount(nThreadCount)
+{
+	m_nRollback			= 0;
+	m_pPool				= NULL;
+	m_pCleanupGroup		= NULL;
+
+	CreateThreadPools(m_nThreadCount);
+}
+
+CThreadPool::~CThreadPool(void)
+{
+	CloseThreadPools();
+}
+
+int	CThreadPool::GetThreadCount() const
+{
+	return m_nThreadCount;
+}
+
+void CThreadPool::CreateThreadPools(int nThreadCount)
+{
+	BOOL bRet = FALSE;
+
+	TP_CALLBACK_ENVIRON* pCallBackEnviron = (TP_CALLBACK_ENVIRON*)&m_CallBackEnviron;
+
+	InitializeThreadpoolEnvironment(pCallBackEnviron);
+
+	// Create a custom, dedicated thread pool
+	m_pPool = CreateThreadpool(NULL);
+
+	if (NULL==m_pPool) 
+	{
+		CloseThreadPools();
+	}
+
+	m_nRollback = 1; // pool creation succeeded
+
+	// The thread pool is made persistent simply by setting
+	// both the minimum and maximum threads to 1.
+	SetThreadpoolThreadMaximum(m_pPool, nThreadCount);
+
+	bRet = SetThreadpoolThreadMinimum(m_pPool, 1);
+
+	if (FALSE==bRet) 
+	{
+		CloseThreadPools();
+	}
+
+	//Create a cleanup group for this thread pool
+	m_pCleanupGroup = CreateThreadpoolCleanupGroup();
+
+	if (NULL==m_pCleanupGroup) 
+	{
+		CloseThreadPools(); 
+	}
+
+	m_nRollback = 2;  // Cleanup group creation succeeded
+
+	// Associate the callback environment with our thread pool.
+	SetThreadpoolCallbackPool(pCallBackEnviron, m_pPool);
+
+	// Associate the cleanup group with our thread pool.
+	// Objects created with the same callback environment
+	// as the cleanup group become members of the cleanup group.
+	SetThreadpoolCallbackCleanupGroup(pCallBackEnviron, m_pCleanupGroup, NULL);
+
+	m_nRollback = 3;  // Creation of work succeeded
+
+}
+
+void CThreadPool::CloseThreadPools()
+{
+	switch (m_nRollback) 
+	{
+	case 4:
+	case 3:		
+		// Clean up the cleanup group members.
+		if(m_pCleanupGroup != NULL)
+			CloseThreadpoolCleanupGroupMembers(m_pCleanupGroup, FALSE, NULL);
+
+	case 2:
+		// Clean up the cleanup group.
+		if(m_pCleanupGroup != NULL)
+			CloseThreadpoolCleanupGroup(m_pCleanupGroup);
+
+		m_pCleanupGroup = NULL;
+
+	case 1:
+		// Clean up the pool.
+		if(m_pPool != NULL)
+			CloseThreadpool(m_pPool);
+
+		m_pPool = NULL;
+
+	default:
+		break;
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/CHThreadPool/TimerThreadPool.cpp b/Common_Class/CHThreadPool/TimerThreadPool.cpp
new file mode 100644
index 0000000..e33f59f
--- /dev/null
+++ b/Common_Class/CHThreadPool/TimerThreadPool.cpp
@@ -0,0 +1,79 @@
+#include "StdAfx.h"
+#include "TimerThreadPool.h"
+
+CTimerThreadPool::CTimerThreadPool(DWORD dwPeriod, int nThreadCount) : m_dwPeriod(dwPeriod), CThreadPool(nThreadCount)
+{
+	m_pTimer			= NULL;
+	m_pTimerCallback	= TimerCallback;
+}
+
+CTimerThreadPool::~CTimerThreadPool(void)
+{
+	StopThread();
+}
+
+DWORD CTimerThreadPool::GetPeriod() const
+{
+	return m_dwPeriod;
+}
+
+VOID CALLBACK CTimerThreadPool::TimerCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_TIMER pTimer)
+{
+	// Instance, Parameter, and Work not used in this example.
+	UNREFERENCED_PARAMETER(pInstance);
+	UNREFERENCED_PARAMETER(pParameter);
+	UNREFERENCED_PARAMETER(pTimer);
+
+	// Do something when the work callback is invoked.
+	CTimerThreadPool *pThreadPtr = static_cast<CTimerThreadPool*>(pParameter);
+	if (pThreadPtr)
+	{
+		pThreadPtr->TimerThreadProcess(pParameter);
+	}
+
+	return;
+}
+
+BOOL CTimerThreadPool::CreateTimerThread(PVOID pParameter)
+{
+	if (m_pTimer) return FALSE;
+
+	if (NULL==m_pPool || NULL==m_pCleanupGroup) return FALSE;
+	
+	TP_CALLBACK_ENVIRON* pCallBackEnviron = (TP_CALLBACK_ENVIRON*)&m_CallBackEnviron;
+
+	m_pTimer = CreateThreadpoolTimer((PTP_TIMER_CALLBACK)TimerCallback, pParameter, pCallBackEnviron);
+	if (NULL==m_pTimer) return FALSE;
+
+	ULARGE_INTEGER ulDueTime;
+	FILETIME FileDueTime;
+
+	ulDueTime.QuadPart = (ULONGLONG)-(1 * 10 * 1000 * 1000);
+	FileDueTime.dwHighDateTime = ulDueTime.HighPart;
+	FileDueTime.dwLowDateTime = ulDueTime.LowPart;
+
+	SetThreadpoolTimer(m_pTimer, &FileDueTime, m_dwPeriod, 0);
+
+	return TRUE;
+}
+
+void CTimerThreadPool::CloseTimerThread()
+{
+	if (NULL==m_pTimer) return;
+
+	WaitForThreadpoolTimerCallbacks(m_pTimer, TRUE);
+	
+	CloseThreadpoolTimer(m_pTimer);
+	
+	m_pTimer = NULL;
+}
+
+BOOL CTimerThreadPool::StartThread()
+{
+	return CreateTimerThread(this);
+}
+
+void CTimerThreadPool::StopThread()
+{
+	CloseTimerThread();
+}
\ No newline at end of file
diff --git a/Common_Class/CHThreadPool/WaitThreadPool.cpp b/Common_Class/CHThreadPool/WaitThreadPool.cpp
new file mode 100644
index 0000000..5a2f745
--- /dev/null
+++ b/Common_Class/CHThreadPool/WaitThreadPool.cpp
@@ -0,0 +1,67 @@
+#include "StdAfx.h"
+#include "WaitThreadPool.h"
+
+CWaitThreadPool::CWaitThreadPool(int nThreadCount) : CThreadPool(nThreadCount)
+{
+	m_pWait				= NULL;
+	m_pWaitCallback		= WaitCallback;
+
+	m_hEvent			= CreateEvent(NULL, FALSE, FALSE, NULL);
+}
+
+CWaitThreadPool::~CWaitThreadPool(void)
+{
+	CloseWaitThread();
+
+	CloseHandle(m_hEvent);
+}
+
+VOID CALLBACK CWaitThreadPool::WaitCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_WAIT pWait, TP_WAIT_RESULT WaitResult)
+{
+	// Instance, Parameter, and Work not used in this example.
+	UNREFERENCED_PARAMETER(pInstance);
+	UNREFERENCED_PARAMETER(pParameter);
+	UNREFERENCED_PARAMETER(pWait);
+	UNREFERENCED_PARAMETER(WaitResult);
+
+	return;
+}
+
+BOOL CWaitThreadPool::CreateWaitThread(PVOID pParameter)
+{
+	if (NULL==m_pPool || NULL==m_pCleanupGroup) return FALSE;
+
+	TP_CALLBACK_ENVIRON* pCallBackEnviron = (TP_CALLBACK_ENVIRON*)&m_CallBackEnviron;
+
+	PTP_WAIT pWait = CreateThreadpoolWait((PTP_WAIT_CALLBACK)WaitCallback, pParameter, pCallBackEnviron);
+	if (NULL==pWait) return FALSE;
+
+	SetThreadpoolWait(pWait, m_hEvent, NULL);
+
+	return TRUE;
+}
+
+void CWaitThreadPool::CloseWaitThread()
+{
+	if (NULL==m_pWait) return;
+
+	WaitForThreadpoolWaitCallbacks(m_pWait, TRUE);
+
+	CloseThreadpoolWait(m_pWait);
+
+	m_pWait = NULL;
+}
+
+BOOL CWaitThreadPool::SetEvent1()
+{
+	if (m_hEvent==NULL) return FALSE;
+
+	return SetEvent(m_hEvent);
+}
+
+BOOL CWaitThreadPool::ResetEvent1()
+{
+	if (m_hEvent==NULL) return FALSE;
+
+	return ResetEvent(m_hEvent);
+}
\ No newline at end of file
diff --git a/Common_Class/CHThreadPool/WorkThreadArray.cpp b/Common_Class/CHThreadPool/WorkThreadArray.cpp
new file mode 100644
index 0000000..007e1bb
--- /dev/null
+++ b/Common_Class/CHThreadPool/WorkThreadArray.cpp
@@ -0,0 +1,33 @@
+#include "StdAfx.h"
+#include "WorkThreadArray.h"
+
+CWorkThreadArray::CWorkThreadArray() : CWorkThreadPool(1)
+{
+	m_pInterface = NULL;
+}
+
+CWorkThreadArray::CWorkThreadArray(IWorkThreadArray2Parent* pInterface, int nThreadPool) : CWorkThreadPool(nThreadPool)
+{
+	m_pInterface = pInterface;
+
+	m_bComplete = FALSE;
+}
+
+CWorkThreadArray::~CWorkThreadArray(void)
+{
+}
+
+BOOL CWorkThreadArray::CreateWorkThread(PVOID pParameter)
+{
+	m_bComplete = FALSE;
+
+	return CWorkThreadPool::CreateWorkThread(pParameter);
+}
+
+void CWorkThreadArray::WorkThreadProcess(PVOID pParameter)
+{
+	if(m_pInterface != NULL)
+		m_pInterface->WorkThreadProcessArray(pParameter);
+
+	m_bComplete = TRUE;
+}
diff --git a/Common_Class/CHThreadPool/WorkThreadPool.cpp b/Common_Class/CHThreadPool/WorkThreadPool.cpp
new file mode 100644
index 0000000..255dde4
--- /dev/null
+++ b/Common_Class/CHThreadPool/WorkThreadPool.cpp
@@ -0,0 +1,112 @@
+#include "StdAfx.h"
+#include "WorkThreadPool.h"
+
+#include "ThreadData.h"
+
+CWorkThreadPool::CWorkThreadPool(int nThreadCount) : CThreadPool(nThreadCount)
+{
+	m_pWork				= NULL;
+	m_pWorkCallback		= WorkCallback;
+}
+
+CWorkThreadPool::~CWorkThreadPool(void)
+{
+	CloseWorkThread();
+
+	ClearThreadData();
+}
+
+VOID CALLBACK CWorkThreadPool::WorkCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_WORK pWork)
+{
+	// Instance, Parameter, and Work not used in this example.
+	UNREFERENCED_PARAMETER(pInstance);
+	UNREFERENCED_PARAMETER(pParameter);
+	UNREFERENCED_PARAMETER(pWork);
+
+	// Do something when the work callback is invoked.
+	CWorkThreadData *pDataPtr = static_cast<CWorkThreadData*>(pParameter);
+	if (pDataPtr)
+	{
+		CWorkThreadPool *pThreadPtr = static_cast<CWorkThreadPool*>(pDataPtr->pCallerPtr);
+		pThreadPtr->WorkThreadProcess(pDataPtr);
+		delete pDataPtr;
+	}
+
+	return;
+}
+
+BOOL CWorkThreadPool::CreateWorkThread(PVOID pParameter)
+{
+	if (NULL==pParameter || NULL==m_pPool || NULL==m_pCleanupGroup) return FALSE;
+
+	if(GetThreadDataCount()==0 && m_pWork)
+	{
+		CloseThreadpoolCleanupGroupMembers(m_pCleanupGroup, FALSE, NULL);
+	}	
+
+	TP_CALLBACK_ENVIRON* pCallBackEnviron = (TP_CALLBACK_ENVIRON*)&m_CallBackEnviron;
+
+	// add data
+	CWorkThreadData* pThreadData = AddThreadData(static_cast<CWorkThreadData*>(pParameter));
+
+	// create work
+	m_pWork = CreateThreadpoolWork((PTP_WORK_CALLBACK)WorkCallback, (PVOID)pThreadData, pCallBackEnviron);
+
+	// create work fail
+	if (NULL==m_pWork) 
+	{
+		delete pThreadData;
+		return FALSE;
+	}
+
+	// process work
+	SubmitThreadpoolWork(m_pWork);
+
+	return TRUE;
+}
+
+void CWorkThreadPool::CloseWorkThread()
+{
+	if (NULL==m_pWork) return;
+
+	WaitForThreadpoolWorkCallbacks(m_pWork, TRUE);
+
+	CloseThreadpoolWork(m_pWork);
+
+	m_pWork = NULL;
+}
+
+size_t CWorkThreadPool::GetThreadDataCount()
+{
+	CSingleLock MyLock(&m_csThreadData);
+	MyLock.Lock();
+
+	return m_deqThreadData.size();
+}
+
+CWorkThreadData* CWorkThreadPool::AddThreadData( CWorkThreadData* pThreadData )
+{
+	CSingleLock MyLock(&m_csThreadData);
+	MyLock.Lock();
+
+	// push
+	m_deqThreadData.push_back(pThreadData);
+
+	// pop
+	CWorkThreadData* pReturnData = static_cast<CWorkThreadData*>(m_deqThreadData.front());
+	m_deqThreadData.pop_front();
+	return pReturnData;
+}
+
+void CWorkThreadPool::ClearThreadData()
+{
+	CSingleLock MyLock(&m_csThreadData);
+	MyLock.Lock();
+
+	for (DequeWorkThreadDataIt it=m_deqThreadData.begin(); it!=m_deqThreadData.end(); it++)
+	{
+		CWorkThreadData *pNode = static_cast<CWorkThreadData*>(*it);
+		if (pNode) delete pNode;
+	}
+	m_deqThreadData.clear();
+}
diff --git a/Common_Class/CHThreadPool/dllmain.cpp b/Common_Class/CHThreadPool/dllmain.cpp
new file mode 100644
index 0000000..6e7095a
--- /dev/null
+++ b/Common_Class/CHThreadPool/dllmain.cpp
@@ -0,0 +1,51 @@
+// dllmain.cpp : DLL狼 檬扁拳 风凭阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+#include <afxwin.h>
+#include <afxdllx.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+static AFX_EXTENSION_MODULE CHThreadPoolDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+	// lpReserved甫 荤侩窍绰 版快 促澜阑 力芭窍绞矫坷.
+	UNREFERENCED_PARAMETER(lpReserved);
+
+	if (dwReason == DLL_PROCESS_ATTACH)
+	{
+		TRACE0("CHThreadPool.DLL阑 檬扁拳窍绊 乐嚼聪促.\n");
+		
+		// 犬厘 DLL阑 茄 锅父 檬扁拳钦聪促.
+		if (!AfxInitExtensionModule(CHThreadPoolDLL, hInstance))
+			return 0;
+
+		// 捞 DLL阑 府家胶 眉牢俊 火涝钦聪促.
+		// 曼绊: 捞 犬厘 DLL捞 MFC 览侩 橇肺弊伐捞
+		//  酒囱 ActiveX 牧飘费苞 鞍篮 MFC 扁夯 DLL俊
+		//  狼秦 疙矫利栏肺 傅农登绢 乐绰 版快俊绰
+		//  DllMain俊辑 捞 临阑 力芭窍绊, 力芭茄 临篮 捞 犬厘 DLL俊辑
+		//  郴焊辰 喊档狼 窃荐俊 眠啊钦聪促.
+		//  弊繁 促澜 捞 犬厘 DLL阑 荤侩窍绰 扁夯 DLL篮
+		//  秦寸 窃荐甫 疙矫利栏肺 龋免窍咯 捞 犬厘 DLL阑 眠啊秦具 钦聪促.
+		//  弊犯瘤 臼栏搁 CDynLinkLibrary 俺眉啊
+		//  扁夯 DLL狼 府家胶 眉牢俊 眠啊登瘤 臼栏骨肺
+		//  缴阿茄 巩力啊 惯积钦聪促.
+
+		new CDynLinkLibrary(CHThreadPoolDLL);
+
+	}
+	else if (dwReason == DLL_PROCESS_DETACH)
+	{
+		TRACE0("CHThreadPool.DLL阑 辆丰窍绊 乐嚼聪促.\n");
+
+		// 家戈磊啊 龋免登扁 傈俊 扼捞宏矾府甫 辆丰钦聪促.
+		AfxTermExtensionModule(CHThreadPoolDLL);
+	}
+	return 1;   // 犬牢
+}
diff --git a/Common_Class/CHThreadPool/res/CHThreadPool.rc2 b/Common_Class/CHThreadPool/res/CHThreadPool.rc2
new file mode 100644
index 0000000..6ce6781
--- /dev/null
+++ b/Common_Class/CHThreadPool/res/CHThreadPool.rc2
Binary files differ
diff --git a/Common_Class/CHThreadPool/stdafx.cpp b/Common_Class/CHThreadPool/stdafx.cpp
new file mode 100644
index 0000000..75a813e
--- /dev/null
+++ b/Common_Class/CHThreadPool/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : 钎霖 器窃 颇老父 甸绢 乐绰 家胶 颇老涝聪促.
+// CHThreadPool.pch绰 固府 哪颇老等 庆歹啊 邓聪促.
+// stdafx.obj俊绰 固府 哪颇老等 屈侥 沥焊啊 器窃邓聪促.
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/CHThreadPool/stdafx.h b/Common_Class/CHThreadPool/stdafx.h
new file mode 100644
index 0000000..38a3629
--- /dev/null
+++ b/Common_Class/CHThreadPool/stdafx.h
@@ -0,0 +1,41 @@
+// stdafx.h : 磊林 荤侩窍瘤父 磊林 函版登瘤绰 臼绰
+// 钎霖 矫胶袍 器窃 颇老 棺 橇肺璃飘 包访 器窃 颇老捞
+// 甸绢 乐绰 器窃 颇老涝聪促.
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 芭狼 荤侩登瘤 臼绰 郴侩篮 Windows 庆歹俊辑 力寇钦聪促.
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 老何 CString 积己磊绰 疙矫利栏肺 急攫邓聪促.
+
+#include <afxwin.h>         // MFC 琴缴 棺 钎霖 备己 夸家涝聪促.
+#include <afxext.h>         // MFC 犬厘涝聪促.
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE 努贰胶涝聪促.
+#include <afxodlgs.h>       // MFC OLE 措拳 惑磊 努贰胶涝聪促.
+#include <afxdisp.h>        // MFC 磊悼拳 努贰胶涝聪促.
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 单捞磐海捞胶 努贰胶涝聪促.
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 单捞磐海捞胶 努贰胶涝聪促.
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // Internet Explorer 4 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // Windows 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include "afxmt.h"
+
+
diff --git a/Common_Class/CHThreadPool/targetver.h b/Common_Class/CHThreadPool/targetver.h
new file mode 100644
index 0000000..3142091
--- /dev/null
+++ b/Common_Class/CHThreadPool/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// SDKDDKVer.h甫 器窃窍搁 弥绊 荐霖狼 啊侩己阑 啊柳 Windows 敲阀汽捞 沥狼邓聪促.
+
+// 捞傈 Windows 敲阀汽俊 措秦 览侩 橇肺弊伐阑 呼靛窍妨绰 版快俊绰 SDKDDKVer.h甫 器窃窍扁 傈俊
+// WinSDKVer.h甫 器窃窍绊 _WIN32_WINNT 概农肺甫 瘤盔窍妨绰 敲阀汽栏肺 汲沥窍绞矫坷.
+
+#include <SDKDDKVer.h>
diff --git a/Common_Class/ConfigFileManager/BasedConfig.cpp b/Common_Class/ConfigFileManager/BasedConfig.cpp
new file mode 100644
index 0000000..098c182
--- /dev/null
+++ b/Common_Class/ConfigFileManager/BasedConfig.cpp
@@ -0,0 +1,26 @@
+// BasedConfig.cpp: implementation of the CBasedConfig class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "BasedConfig.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CBasedConfig::CBasedConfig()
+{
+
+}
+
+CBasedConfig::~CBasedConfig()
+{
+
+}
diff --git a/Common_Class/ConfigFileManager/Config.cpp b/Common_Class/ConfigFileManager/Config.cpp
new file mode 100644
index 0000000..ac90d46
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Config.cpp
@@ -0,0 +1,281 @@
+// HMRegiConfig.cpp: implementation of the CConfig class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "Config.h"
+
+#include "FileList.h"
+#include "FileMap.h"
+#include "Registery.h"
+#include "IniManager.h"
+
+//#ifdef _DEBUG
+//#undef THIS_FILE
+//static char THIS_FILE[]=__FILE__;
+//#define new DEBUG_NEW
+//#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CConfig::CConfig()
+{
+	m_pConfig = NULL;
+	m_strFilePath = _T("");
+}
+
+CConfig::~CConfig()
+{
+	if(m_pConfig) {delete m_pConfig; m_pConfig = NULL; }
+}
+
+BOOL CConfig::SetLogWriteMode(BOOL bUse,CString strFilePath)
+{
+	if(strFilePath.IsEmpty() == TRUE)
+		return FALSE;
+	
+	if(m_Classification & FileMap_Mode)
+	{
+		m_pConfig->SetLogMode(bUse);
+		m_pConfig->SetLogFilePath(strFilePath);
+	}
+	else if(m_Classification & FileManager_Mode)
+	{
+		m_pConfig->SetLogMode(bUse);
+		m_pConfig->SetLogFilePath(strFilePath);
+	}
+
+	strFilePath.Empty();
+		
+	return TRUE;
+}
+
+BOOL CConfig::SetRegiConfig(HKEY hKey, CString strKey, TCHAR* szFilename, Grouping Select)
+{
+	BOOL bRet = TRUE;
+
+	if(m_pConfig) {delete m_pConfig; m_pConfig = NULL; }
+
+	switch(Select)
+	{
+	case Registery_mode:
+		m_pConfig = static_cast<CBasedConfig *>(new CRegistery);
+		break;
+	case FileMap_Mode:
+		m_pConfig = static_cast<CBasedConfig *>(new CFileMap);
+		break;
+	case FileManager_Mode:
+		m_pConfig = static_cast<CBasedConfig *>(new CFileList);
+		break;
+	case Ini_Mode:
+		m_pConfig = static_cast<CBasedConfig *>(new CIniManager);
+		break;
+	}
+
+	bRet = m_pConfig->Initialize(hKey, strKey, szFilename);
+	m_Classification = Select;
+
+	m_strFilePath = szFilename;
+
+
+	strKey.Empty();
+	return bRet;
+}
+
+BOOL CConfig::DeleteAllItem()
+{
+	if(m_pConfig == NULL)
+		return FALSE;
+
+	m_pConfig->RemoveAllItem();
+
+	return TRUE;
+}
+
+BOOL CConfig::DeleteValue(CString strvalue)
+{
+	BOOL bRet = FALSE;
+	
+	bRet = m_pConfig->RemoveItem(strvalue);
+
+	return bRet;
+}
+
+BOOL CConfig::DeleteValue(CString strvalue, int nIdx)
+{
+	BOOL bRet = FALSE;
+	
+	bRet = m_pConfig->RemoveItem(nIdx, strvalue);
+	
+	return bRet;
+
+}
+
+BOOL CConfig::SetItemValue(CString strName, CString strValue)
+{
+	BOOL b4 = TRUE;
+	
+	b4 = m_pConfig->SetItemValue(strName, strValue);
+
+	return b4;
+}
+//get 
+BOOL CConfig::SetItemValue(CString strName, int nValue)
+{
+	BOOL b4 = TRUE;
+	
+	b4 = m_pConfig->SetItemValue(strName, nValue);
+	
+	return b4;
+}
+
+BOOL CConfig::SetItemValue(CString strName, unsigned short sValue)
+{
+	BOOL b4 = TRUE;
+	
+	b4 = m_pConfig->SetItemValue(strName, sValue);
+	
+	return b4;
+}
+
+BOOL CConfig::SetItemValue(CString strName, double dValue)
+{
+	BOOL b4 = TRUE;
+	
+	b4 = m_pConfig->SetItemValue(strName, dValue);
+	
+	return b4;
+}
+
+BOOL CConfig::SetItemValue(int nIdx, CString strName, CString strValue)
+{ 
+	BOOL b4 = TRUE;
+	
+	b4 = m_pConfig->SetItemValue(nIdx, strName, strValue);
+	
+	return b4;
+
+}
+
+BOOL CConfig::SetItemValue(int nIdx, CString strName, int nValue)
+{
+	BOOL b4 = TRUE;
+	
+	b4 = m_pConfig->SetItemValue(nIdx, strName, nValue);
+	
+	return b4;
+}
+
+BOOL CConfig::SetItemValue(int nIdx, CString strName, unsigned short sValue)
+{
+	BOOL b4 = TRUE;
+	
+	b4 = m_pConfig->SetItemValue(nIdx, strName, sValue);
+	
+	return b4;
+}
+
+BOOL CConfig::SetItemValue(int nIdx, CString strName, double dValue)
+{
+	BOOL b4 = TRUE;
+	
+	b4 = m_pConfig->SetItemValue(nIdx, strName, dValue);
+	
+	return b4;
+}
+
+//////////////////////////////////////////////////////////////////////////
+int	CConfig::GetItemValue(CString strName, CString& strValue, CString strDefault)
+{
+	int nRet = -1;
+	char strTemp[1024] = {0, };
+
+	nRet = m_pConfig->GetItemValue(strName, strValue, strDefault);
+	
+	return nRet;
+}
+
+int	CConfig::GetItemValue(CString strName, int& nValue, int nDefault)
+{
+	int nRet = -1;
+
+	nRet = m_pConfig->GetItemValue(strName, nValue, nDefault);
+		
+	return nRet;
+}
+
+int	CConfig::GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault)
+{
+	int nRet = -1;
+
+	nRet = m_pConfig->GetItemValue(strName, nValue, sDefault);
+
+	return nRet;
+}
+
+int	CConfig::GetItemValue(CString strName, double& dValue, double dDefault)
+{
+	int nRet = -1;
+
+	nRet = m_pConfig->GetItemValue(strName, dValue, dDefault);
+
+	return nRet;
+}
+
+int	CConfig::GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault)
+{
+	int nRet = -1;
+	
+	nRet = m_pConfig->GetItemValue(nIdx, strName, strValue, strDefault);
+
+	return nRet;
+}
+
+int	CConfig::GetItemValue(int nIdx, CString strName, int& nValue, int nDefault)
+{
+	int nRet = -1;
+
+	nRet = m_pConfig->GetItemValue(nIdx, strName, nValue, nDefault);
+
+	return nRet;
+}
+
+int	 CConfig::GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault)
+{
+	int nRet = -1;
+	
+	nRet = m_pConfig->GetItemValue(nIdx, strName, nValue, sDefault);
+
+	return nRet;
+}
+
+int	 CConfig::GetItemValue(int nIdx, CString strName, double& dValue, double dDefault)
+{
+	int nRet = -1;
+
+	nRet = m_pConfig->GetItemValue(nIdx, strName, dValue, dDefault);
+
+	return nRet;
+}
+
+BOOL CConfig::WriteToFile()
+{
+	return m_pConfig->WriteToFile();
+}
+
+void CConfig::SetRewriteMode( BOOL bRewrite )
+{	
+	m_pConfig->SetRewriteMode(bRewrite);
+}
+
+BOOL CConfig::GetRewriteMode()
+{
+	return m_pConfig->GetRewriteMode();
+}
+
+CString CConfig::GetFilePath()
+{
+	return m_strFilePath;
+}
diff --git a/Common_Class/ConfigFileManager/ConfigFileManager.cpp b/Common_Class/ConfigFileManager/ConfigFileManager.cpp
new file mode 100644
index 0000000..af00261
--- /dev/null
+++ b/Common_Class/ConfigFileManager/ConfigFileManager.cpp
@@ -0,0 +1,10 @@
+// ConfigFileManager.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
diff --git a/Common_Class/ConfigFileManager/ConfigFileManager.def b/Common_Class/ConfigFileManager/ConfigFileManager.def
new file mode 100644
index 0000000..7dc40d0
--- /dev/null
+++ b/Common_Class/ConfigFileManager/ConfigFileManager.def
@@ -0,0 +1,6 @@
+; ConfigFileManager.def : Declares the module parameters for the DLL.
+
+LIBRARY
+
+EXPORTS
+    ; Explicit exports can go here
diff --git a/Common_Class/ConfigFileManager/ConfigFileManager.rc b/Common_Class/ConfigFileManager/ConfigFileManager.rc
new file mode 100644
index 0000000..6efe743
--- /dev/null
+++ b/Common_Class/ConfigFileManager/ConfigFileManager.rc
@@ -0,0 +1,125 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+	"#ifndef APSTUDIO_INVOKED\r\n"
+    "#include ""targetver.h""\r\n"
+    "#endif\r\n"
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+	"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+	"LANGUAGE 9, 1\r\n"
+	"#pragma code_page(949)\r\n"
+    "#include ""res\\ConfigFileManager.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
+#ifndef _AFXDLL
+    "#include ""afxres.rc""  	// Standard components\r\n"
+#endif
+    "#endif\r\n"
+    "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(949)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO     VERSIONINFO
+  FILEVERSION       1,0,0,1
+  PRODUCTVERSION    1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+	BLOCK "StringFileInfo"
+	BEGIN
+        BLOCK "040904e4"
+		BEGIN
+            VALUE "CompanyName", "TODO: <Company name>"
+            VALUE "FileDescription", "TODO: <File description>"
+			VALUE "FileVersion",     "1.0.0.1"
+			VALUE "InternalName",    "ConfigFileManager.dll"
+            VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."
+			VALUE "OriginalFilename","ConfigFileManager.dll"
+            VALUE "ProductName", "TODO: <Product name>"
+			VALUE "ProductVersion",  "1.0.0.1"
+		END
+	END
+	BLOCK "VarFileInfo"
+	BEGIN
+		VALUE "Translation", 0x0409, 1252
+    END
+END
+
+#endif
+#ifndef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(949)
+#include "res\\ConfigFileManager.rc2"  // non-Microsoft Visual C++ edited resources
+#ifndef _AFXDLL
+#include "afxres.rc"  	// Standard components
+#endif
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/Common_Class/ConfigFileManager/ConfigFileManager.sln b/Common_Class/ConfigFileManager/ConfigFileManager.sln
new file mode 100644
index 0000000..6e617b8
--- /dev/null
+++ b/Common_Class/ConfigFileManager/ConfigFileManager.sln
@@ -0,0 +1,26 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConfigFileManager", "ConfigFileManager.vcxproj", "{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Debug|Win32.Build.0 = Debug|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Debug|x64.ActiveCfg = Debug|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Debug|x64.Build.0 = Debug|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Release|Win32.ActiveCfg = Release|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Release|Win32.Build.0 = Release|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Release|x64.ActiveCfg = Release|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/Common_Class/ConfigFileManager/ConfigFileManager.vcxproj b/Common_Class/ConfigFileManager/ConfigFileManager.vcxproj
new file mode 100644
index 0000000..a767a80
--- /dev/null
+++ b/Common_Class/ConfigFileManager/ConfigFileManager.vcxproj
@@ -0,0 +1,382 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Simulation|Win32">
+      <Configuration>Simulation</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Simulation|x64">
+      <Configuration>Simulation</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}</ProjectGuid>
+    <RootNamespace>ConfigFileManager</RootNamespace>
+    <Keyword>MFCDLLProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CLRSupport>false</CLRSupport>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">$(SolutionDir)\Intermediate\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PreBuildEventUseInBuild>
+    <PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">true</PreBuildEventUseInBuild>
+    <PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PreLinkEventUseInBuild>
+    <PreLinkEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">true</PreLinkEventUseInBuild>
+    <PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PostBuildEventUseInBuild>
+    <PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">true</PostBuildEventUseInBuild>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)D</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">$(ProjectName)D</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)D</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+      <AdditionalIncludeDirectories>./Header</AdditionalIncludeDirectories>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\ConfigFileManager.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\ConfigFileManager.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalIncludeDirectories>./Header</AdditionalIncludeDirectories>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\ConfigFileManager.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX64</TargetMachine>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <ImportLibrary>
+      </ImportLibrary>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalIncludeDirectories>./Header</AdditionalIncludeDirectories>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\ConfigFileManager.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX64</TargetMachine>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <ImportLibrary>..\Library\CommonLibs\$(TargetName).lib</ImportLibrary>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\ConfigFileManager.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalIncludeDirectories>./Header</AdditionalIncludeDirectories>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\ConfigFileManager.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX64</TargetMachine>
+      <ImportLibrary>
+      </ImportLibrary>
+    </Link>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\ConfigFileManager\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\ConfigFileManager\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\ConfigFileManager\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\BasedConfig.h" "$(SolutionDir)Lib\ConfigFileManager\include\BasedConfig.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\Config.h" "$(SolutionDir)Lib\ConfigFileManager\include\Config.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\FileVersionManager.h" "$(SolutionDir)Lib\ConfigFileManager\include\FileVersionManager.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\FileIOInterface.h" "$(SolutionDir)Lib\ConfigFileManager\include\FileIOInterface.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="BasedConfig.cpp" />
+    <ClCompile Include="Config.cpp" />
+    <ClCompile Include="ConfigFileManager.cpp" />
+    <ClCompile Include="dllmain.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
+    </ClCompile>
+    <ClCompile Include="FileIOInterface.cpp" />
+    <ClCompile Include="FileList.cpp" />
+    <ClCompile Include="FileMap.cpp" />
+    <ClCompile Include="FileVersionManager.cpp" />
+    <ClCompile Include="IniManager.cpp" />
+    <ClCompile Include="Registery.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ConfigFileManager.def" />
+    <None Include="res\ConfigFileManager.rc2" />
+    <None Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\BasedConfig.h" />
+    <ClInclude Include="Header\Config.h" />
+    <ClInclude Include="Header\FileIOInterface.h" />
+    <ClInclude Include="Header\FileList.h" />
+    <ClInclude Include="Header\FileMap.h" />
+    <ClInclude Include="Header\FileVersionManager.h" />
+    <ClInclude Include="Header\IniManager.h" />
+    <ClInclude Include="Header\Registery.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="ConfigFileManager.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/ConfigFileManager/ConfigFileManager.vcxproj.filters b/Common_Class/ConfigFileManager/ConfigFileManager.vcxproj.filters
new file mode 100644
index 0000000..c337a3f
--- /dev/null
+++ b/Common_Class/ConfigFileManager/ConfigFileManager.vcxproj.filters
@@ -0,0 +1,101 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <ClCompile Include="BasedConfig.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="Config.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ConfigFileManager.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="dllmain.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="FileList.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="FileMap.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="IniManager.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="Registery.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="FileVersionManager.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="FileIOInterface.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\BasedConfig.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\Config.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\FileIOInterface.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\FileList.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\FileMap.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\FileVersionManager.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\IniManager.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\Registery.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="ConfigFileManager.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\ConfigFileManager.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{bb8b22b5-bf18-4efc-8837-9f576a8ea4b5}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{6de315a3-a203-4351-aec3-f2634b950f67}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{3303fac9-4c8d-4b25-b878-ec27a6b0f470}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="ConfigFileManager.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/ConfigFileManager/ConfigFileManagerD.def b/Common_Class/ConfigFileManager/ConfigFileManagerD.def
new file mode 100644
index 0000000..19843ee
--- /dev/null
+++ b/Common_Class/ConfigFileManager/ConfigFileManagerD.def
@@ -0,0 +1,6 @@
+; ConfigFileManager.def : Declares the module parameters for the DLL.
+
+LIBRARY      "ConfigFileManager"
+
+EXPORTS
+    ; Explicit exports can go here
diff --git a/Common_Class/ConfigFileManager/FileIOInterface.cpp b/Common_Class/ConfigFileManager/FileIOInterface.cpp
new file mode 100644
index 0000000..18f4cda
--- /dev/null
+++ b/Common_Class/ConfigFileManager/FileIOInterface.cpp
@@ -0,0 +1,12 @@
+#include "StdAfx.h"
+#include "FileIOInterface.h"
+
+
+CFileIOInterface::CFileIOInterface(void)
+{
+}
+
+
+CFileIOInterface::~CFileIOInterface(void)
+{
+}
diff --git a/Common_Class/ConfigFileManager/FileList.cpp b/Common_Class/ConfigFileManager/FileList.cpp
new file mode 100644
index 0000000..b1abc4e
--- /dev/null
+++ b/Common_Class/ConfigFileManager/FileList.cpp
@@ -0,0 +1,716 @@
+// HMConfigFile.cpp: implementation of the CFileList class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "FileList.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CFileList::CFileList()
+{
+	m_bRewrite = FALSE;
+	m_strLogFileName = _T("");
+	m_bLogMode = FALSE;
+	m_nItemCount = 0;
+	InitializeCriticalSection(&m_cs);
+}
+
+CFileList::~CFileList()
+{
+	RemoveAllItem();
+
+	DeleteCriticalSection(&m_cs);
+}
+/*
+CFileList::CFileList(char* szFileName)
+{
+	InitializeCriticalSection(&m_cs);
+	Initialize(NULL, NULL, szFileName);
+	m_strLogFileName = _T("");
+	m_bLogMode = FALSE;
+}
+*/
+BOOL CFileList::RemoveAllItem()
+{
+	FileListItem* pItem;
+	POSITION pos = m_ItemList.GetHeadPosition();
+	while (pos)
+	{
+		pItem = static_cast<FileListItem*>(m_ItemList.GetNext(pos));
+		if (pItem)
+			delete pItem;
+	}
+
+	m_ItemList.RemoveAll();
+
+	return TRUE;
+}
+
+/*!
+ * \brief
+ * 按眉 檬扁拳 窃荐(颇老 肺靛 -> 皋葛府 利犁)
+ * 
+ * \param hKey
+ * 荤侩登瘤 臼绰促.
+ * 
+ * \param strKey
+ * 荤侩登瘤 臼绰促.
+ * 
+ * \param strFilename
+ * 颇老 涝免仿 且 版快 颇老 菩胶
+ * 
+ * \returns
+ * 己傍 : TRUE \n
+ * 角菩 : FALSE
+ * 
+ * 
+ * CObList甫 捞侩茄 颇老 涝免仿栏肺 颇老阑 凯绢辑 葛电 单捞磐甫 CObList肺 包府茄促.
+ * 
+ */
+BOOL CFileList::Initialize(HKEY hKey, CString strKey, CString strFilename)
+{
+	m_strFileName.Empty();
+	if (strFilename.IsEmpty())
+		return FALSE;
+
+	m_strFileName = strFilename;
+	strFilename.Empty();
+
+	m_nItemCount = 0;
+
+	CFile FileI;
+	if (!FileI.Open((LPCTSTR)m_strFileName, CFile::modeReadWrite))
+		return FALSE;
+
+	// 颇老 佬扁.
+	CString strFile;
+	CStringA strFileAnsi;
+	DWORD  dwSize = (DWORD)FileI.GetLength();
+	if (dwSize > 0)
+	{
+		char* pstrTemp = new char[dwSize + 1];
+		ZeroMemory(pstrTemp, sizeof(char) * (dwSize + 1) );
+		if (0 == FileI.Read(pstrTemp, dwSize))
+		{
+			FileI.Close();
+			delete [] pstrTemp;
+			strFile.Empty();
+			strFileAnsi.Empty();
+			return FALSE;
+		}
+		FileI.Close();
+		strFileAnsi = pstrTemp;
+		strFile = static_cast<CString>(strFileAnsi);
+		delete [] pstrTemp;
+	}
+
+	// Line Parsing
+	RemoveAllItem();
+
+	CString strLine;
+	int nFindStart = 0;
+	int nFindEnd = 0;
+	dwSize = strFile.GetLength();
+	while ((DWORD)nFindEnd < dwSize)
+	{
+		nFindEnd = strFile.Find(_T("\r\n"), nFindStart);
+		if (nFindEnd == -1)					// 颇老狼 场俊 \r\n捞 绝绰 版快烙.
+			nFindEnd = strFile.GetLength();
+
+		strLine.Empty();
+		strLine = strFile.Mid(nFindStart, nFindEnd - nFindStart);
+
+		FileListItem* pItem = new FileListItem;
+		pItem->SetItem(strLine);
+		m_ItemList.AddTail(pItem);
+		nFindStart = nFindEnd + 2;
+		m_nItemCount++;
+	}
+
+	strFile.Empty();
+	strFileAnsi.Empty();
+	strLine.Empty();
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Item Read
+
+int CFileList::GetItemValue(CString strName, CString& strValue, CString strDefault)
+{
+	int nRet = 0;
+
+	BOOL bFind = FALSE;
+	FileListItem* pItem;
+	POSITION pos = m_ItemList.GetHeadPosition();
+	while (pos)
+	{
+		pItem = static_cast<FileListItem*>(m_ItemList.GetNext(pos));
+		if (pItem && strName == pItem->s_strName)
+		{
+			strValue = pItem->s_strValue;
+			bFind = TRUE;
+			break;
+		}
+		nRet++;
+	}
+
+	if (!bFind)
+	{
+		strValue = strDefault;
+		nRet = -1;
+	}
+
+	return nRet;
+}
+
+int CFileList::GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = GetItemValue(strFullName, strValue, strDefault);
+
+	strFullName.Empty();
+
+	return bRet;
+}
+
+int CFileList::GetItemValue(CString strName, int& nValue, int nDefault)
+{
+	CString strValue;
+	if (GetItemValue(strName, strValue) == -1)
+	{
+		nValue = nDefault;
+		return -1;
+	}
+
+	nValue = _tstoi((LPTSTR)(LPCTSTR)strValue);
+
+	return TRUE;
+}
+
+int CFileList::GetItemValue(int nIdx, CString strName, int& nValue, int nDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	if (GetItemValue(strFullName, strValue) == -1)
+	{
+		nValue = nDefault;
+		strFullName.Empty();
+		strValue.Empty();
+		return -1;
+	}
+
+	nValue = _tstoi((LPTSTR)(LPCTSTR)strValue);
+
+	strFullName.Empty();
+	strValue.Empty();
+
+	return TRUE;
+}
+
+int CFileList::GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault)
+{
+	CString strValue;
+	if (GetItemValue(strName, strValue) == -1)
+	{
+		nValue = sDefault;
+		return -1;
+	}
+
+	int nVal = _tstoi((LPTSTR)(LPCTSTR)strValue);
+	nValue = static_cast<unsigned short>(nVal);
+
+	return TRUE;
+}
+
+int CFileList::GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	if (GetItemValue(strFullName, strValue) == -1)
+	{
+		nValue = sDefault;
+
+		strFullName.Empty();
+		strValue.Empty();
+
+		return -1;
+	}
+
+	int nVal = _tstoi((LPTSTR)(LPCTSTR)strValue);
+	nValue = static_cast<unsigned short>(nVal);
+
+	strFullName.Empty();
+	strValue.Empty();
+
+	return TRUE;
+}
+
+int CFileList::GetItemValue(CString strName, double &dValue, double dDefault)
+{
+	CString strValue;
+	if (GetItemValue(strName, strValue) == -1)
+	{
+		dValue = dDefault;
+		strValue.Empty();
+		return -1;
+	}
+
+	TCHAR*	end ;
+	dValue = _tcstod((LPCTSTR)strValue, &end) ;
+
+	strValue.Empty();
+
+	return TRUE;
+}
+
+int CFileList::GetItemValue(int nIdx, CString strName, double &dValue, double dDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	if (GetItemValue(strFullName, strValue) == -1)
+	{
+		dValue = dDefault;
+
+		strFullName.Empty();
+		strValue.Empty();
+		return -1;
+	}
+
+	TCHAR*	end ;
+	dValue = _tcstod((LPCTSTR)strValue, &end) ;
+
+	strFullName.Empty();
+	strValue.Empty();
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Write Information
+BOOL CFileList::SetItemValue(CString strName, CString& strValue)
+{
+	if (strName.IsEmpty() || strValue.IsEmpty())
+		return FALSE;
+
+	EnterCriticalSection(&m_cs);
+
+	WriteLog(strName,strValue);
+
+	// Modify Value
+	BOOL bFind = FALSE;
+	CString strLine;
+	FileListItem* pItem;
+	POSITION pos = m_ItemList.GetHeadPosition();
+	while (pos)
+	{
+		pItem = static_cast<FileListItem*>(m_ItemList.GetNext(pos));
+		if (pItem && strName == pItem->s_strName)
+		{
+			pItem->s_strValue = strValue;
+			bFind = TRUE;
+			break;
+		}
+	}
+
+	// Add New Value
+	if (!bFind)
+	{
+		pItem = new FileListItem;
+		pItem->SetItem(strName, strValue);
+
+		m_ItemList.AddTail(pItem);
+		m_nItemCount++;
+	}
+
+	strLine.Empty();
+
+
+	LeaveCriticalSection(&m_cs);
+
+
+	if (m_bRewrite)
+		return WriteToFile();
+
+	return TRUE;
+}
+
+BOOL CFileList::SetItemValue(int nIdx, CString strName, CString& strValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = SetItemValue(strFullName, strValue);
+
+	strFullName.Empty();
+
+	return bRet;
+}
+
+BOOL CFileList::SetItemValue(CString strName, int& nValue)
+{
+	CString strValue;
+	strValue.Format(_T("%d"), nValue);
+
+	if (!SetItemValue(strName, strValue))
+	{
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileList::SetItemValue(int nIdx, CString strName, int& nValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	strValue.Format(_T("%d"), nValue);
+
+	if (!SetItemValue(strFullName, strValue))
+	{
+		strFullName.Empty();
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileList::SetItemValue(CString strName, unsigned short &nValue)
+{
+	CString strValue;
+	strValue.Format(_T("%d"), nValue);
+
+	if (!SetItemValue(strName, strValue))
+	{
+		strValue.Empty();
+		return FALSE;
+	}
+
+
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileList::SetItemValue(int nIdx, CString strName, unsigned short &nValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	strValue.Format(_T("%d"), nValue);
+
+	if (!SetItemValue(strFullName, strValue))
+	{
+		strFullName.Empty();
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileList::SetItemValue(CString strName, double& dValue)
+{
+	CString strValue;
+	strValue.Format(_T("%f"), dValue);
+
+	if (!SetItemValue(strName, strValue))
+	{
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileList::SetItemValue(int nIdx, CString strName, double& dValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	strValue.Format(_T("%f"), dValue);
+
+	if (!SetItemValue(strFullName, strValue))
+	{
+		strFullName.Empty();
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileList::RemoveItem(CString strName)
+{
+	EnterCriticalSection(&m_cs);
+
+	FileListItem* pItem;
+	POSITION pos = m_ItemList.GetHeadPosition();
+	while (pos)
+	{
+		pItem = static_cast<FileListItem*>(m_ItemList.GetNext(pos));
+		if (pItem && strName == pItem->s_strName)
+		{
+			delete pItem;
+			m_ItemList.GetPrev(pos); 
+			m_ItemList.RemoveAt(pos);
+		}
+	}
+
+	LeaveCriticalSection(&m_cs);
+
+	return TRUE;
+}
+
+BOOL CFileList::RemoveItem(int nIdx, CString strName)
+{
+	EnterCriticalSection(&m_cs);
+	
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+	
+	FileListItem* pItem;
+	POSITION pos = m_ItemList.GetHeadPosition();
+	while (pos)
+	{
+		pItem = static_cast<FileListItem*>(m_ItemList.GetNext(pos));
+		if (pItem && strFullName == pItem->s_strName)
+		{
+			delete pItem;
+			m_ItemList.GetPrev(pos); 
+			m_ItemList.RemoveAt(pos);
+		}
+	}
+	
+	strFullName.Empty();
+	LeaveCriticalSection(&m_cs);
+	
+	return TRUE;
+}
+
+BOOL CFileList::WriteToFile()
+{
+	CFile FileI;
+	CString strTemp;
+
+	if (!FileI.Open(m_strFileName, CFile::modeCreate | CFile::modeWrite))
+	{
+		if (!FileI.Open(m_strFileName, CFile::modeCreate | CFile::modeWrite))
+		{
+			return FALSE;
+		}
+	}
+
+	EnterCriticalSection(&m_cs);
+
+	// Write to File
+	FileListItem* pItem;
+	POSITION pos = m_ItemList.GetHeadPosition();
+	CStringA strName = "";
+	CStringA strData = "";
+	while (pos)
+	{
+		pItem = static_cast<FileListItem*>(m_ItemList.GetNext(pos));
+		if (pItem && !pItem->s_strName.IsEmpty() && !pItem->s_strValue.IsEmpty())
+		{
+			strName = static_cast<CStringA>(pItem->s_strName);
+			strData = static_cast<CStringA>(pItem->s_strValue);
+			FileI.Write(strName, strName.GetLength());
+			if (!pItem->s_strValue.IsEmpty())
+			{
+				FileI.Write("=`", 2);
+				FileI.Write(strData, strData.GetLength());
+				FileI.Write("`", 1);
+			}
+			FileI.Write("\r\n", 2);
+		}
+	}
+
+	FileI.Close();
+
+	strName.Empty();
+	strData.Empty();
+	LeaveCriticalSection(&m_cs);
+
+
+	strTemp.Empty();
+	return TRUE;
+}
+
+void CFileList::WriteLog( CString strName, CString strValue )
+{
+	if( m_bLogMode == FALSE )
+		return;
+	
+	if( m_strLogFileName.IsEmpty() == TRUE )
+		return;
+	
+	CString strTmp;
+
+	GetItemValue(strName,strTmp);
+	if( strTmp != strValue)
+	{
+		// Write Log
+		CTime cuTime = CTime::GetCurrentTime();
+		CString strContents;
+		strContents.Format(_T("%d-%d-%d:%d:%d:%d : [%s] : [%s] -> [%s]"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond(), strName, strTmp, strValue);
+		WriteToLogFile(strContents);
+		strContents.Empty();
+	}
+
+	strTmp.Empty();
+	return;
+}
+void CFileList::WriteLog( CString strName, int& nValue )
+{
+	if( m_bLogMode == FALSE )
+		return;
+	
+	if( m_strLogFileName.IsEmpty() == TRUE )
+		return;
+	
+	CString strTmp;
+	int nTmpValue;
+	GetItemValue(strName,nTmpValue);
+	if( nValue != nTmpValue)
+	{
+		// Write Log
+		CTime cuTime = CTime::GetCurrentTime();
+		CString strContents;
+		strContents.Format(_T("%d-%d-%d:%d:%d:%d : [%s] : [%d] -> [%d]"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond(), strName, nTmpValue, nValue);
+		WriteToLogFile(strContents);
+		strContents.Empty();
+	}	
+
+	strTmp.Empty();
+}
+void CFileList::WriteLog( CString strName, unsigned short &nValue )
+{
+	if( m_bLogMode == FALSE )
+		return;
+	
+	if( m_strLogFileName.IsEmpty() == TRUE )
+		return;
+	
+	CString strTmp;
+	unsigned short nTmpValue;
+	GetItemValue(strName,nTmpValue);
+	if( nValue != nTmpValue)
+	{
+		// Write Log
+		CTime cuTime = CTime::GetCurrentTime();
+		CString strContents;
+		strContents.Format(_T("%d-%d-%d:%d:%d:%d : [%s] : [%d] -> [%d]"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond(), strName, nTmpValue, nValue);
+		WriteToLogFile(strContents);
+		strContents.Empty();
+	}	
+	strTmp.Empty();
+}
+void CFileList::WriteLog( CString strName, double& dValue )
+{
+	if( m_bLogMode == FALSE )
+		return;
+	
+	if( m_strLogFileName.IsEmpty() == TRUE )
+		return;
+	
+	CString strTmp;
+	double dTmpValue;
+	GetItemValue(strName,dTmpValue);
+	if( dValue != dTmpValue)
+	{
+		// Write Log
+		CTime cuTime = CTime::GetCurrentTime();
+		CString strContents;
+		strContents.Format(_T("%d-%d-%d:%d:%d:%d : [%s] : [%f] -> [%f]"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond(), strName, dTmpValue, dValue);
+		WriteToLogFile(strContents);
+		strContents.Empty();
+	}
+	strTmp.Empty();
+}
+
+// Log File俊 静扁.
+BOOL CFileList::WriteToLogFile(CString& strContents)
+{
+	if(m_strLogFileName.IsEmpty() == TRUE || m_bLogMode == FALSE)
+		return FALSE;
+
+	CFile File;
+	if (!File.Open(m_strLogFileName, CFile::modeWrite))
+	{
+		if (!File.Open(m_strLogFileName, CFile::modeCreate | CFile::modeWrite))
+		{
+			return FALSE;
+		}
+	}
+
+	CStringA strBufA = (CStringA)strContents;
+
+	File.SeekToEnd();
+	File.Write(strBufA, strBufA.GetLength());
+	File.Write("\r\n", (UINT)strlen("\r\n"));
+	File.Close();
+	
+	return TRUE;
+}
+
+
+void	CFileList::SetLogMode(BOOL bMode)					
+{	
+	m_bLogMode = bMode;	
+}
+BOOL	CFileList::GetLogMode()							
+{	
+	return m_bLogMode;	
+}
+
+void	CFileList::SetLogFilePath(CString strLogFilePath)	
+{	
+	m_strLogFileName = strLogFilePath;
+}
+
+CString CFileList::GetLogFilePath()						
+{	
+	return m_strLogFileName;	
+}
+
+void	CFileList::SetRewriteMode(BOOL bRewrite) 
+{
+	m_bRewrite = bRewrite;
+}
+
+BOOL	CFileList::GetRewriteMode() 
+{ 
+	return m_bRewrite; 
+}
diff --git a/Common_Class/ConfigFileManager/FileMap.cpp b/Common_Class/ConfigFileManager/FileMap.cpp
new file mode 100644
index 0000000..ac87ba6
--- /dev/null
+++ b/Common_Class/ConfigFileManager/FileMap.cpp
@@ -0,0 +1,692 @@
+// FileManager.cpp: implementation of the CFileMap class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "Filemap.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CFileMap::CFileMap()
+{
+	m_bRewrite = FALSE;
+	m_strLogFileName = _T("");
+	m_bLogMode = FALSE;
+	m_nItemCount = 0;
+	m_ItemList.clear();
+	InitializeCriticalSection(&m_cs);
+}
+
+CFileMap::~CFileMap()
+{
+	m_ItemList.clear();
+
+	DeleteCriticalSection(&m_cs);
+}
+
+// CFileMap::CFileMap(char* szFileName)
+// {
+// 	InitializeCriticalSection(&m_cs);
+// 	Initialize(NULL, NULL, szFileName);
+// 	m_strLogFileName = _T("");
+// 	m_bLogMode = FALSE;
+// }
+
+BOOL CFileMap::RemoveAllItem()
+{
+	m_ItemList.clear();
+	
+	return TRUE;
+}
+
+/*!
+ * \brief
+ * 按眉 檬扁拳 窃荐(颇老 肺靛 -> 皋葛府 利犁)
+ * 
+ * \param hKey
+ * 荤侩登瘤 臼绰促.
+ * 
+ * \param strKey
+ * 荤侩登瘤 臼绰促.
+ * 
+ * \param strFilename
+ * 颇老 涝免仿 且 版快 颇老 菩胶
+ * 
+ * \returns
+ * 己傍 : TRUE \n
+ * 角菩 : FALSE
+ * 
+ * 
+ * STL Map甫 捞侩茄 颇老 涝免仿栏肺 颇老阑 凯绢辑 葛电 单捞磐甫 CObList肺 包府茄促.\n
+ * 贸澜 单捞磐狼 肺靛绰 蠢府瘤父 肺靛等 单捞磐俊 磊林 竣技胶 窍绰 版快 蜡侩
+ */
+BOOL CFileMap::Initialize(HKEY hKey, CString strKey, CString strFilename)
+{
+	m_strFileName.Empty();
+	if (strFilename.IsEmpty())
+		return FALSE;
+
+	m_strFileName = strFilename;
+	strFilename.Empty();
+
+	m_nItemCount = 0;
+	
+	CFile FileI;
+	if (!FileI.Open(m_strFileName, CFile::modeReadWrite))
+		return FALSE;
+
+	// 颇老 佬扁.
+	CString strFile;
+	CStringA strFileAnsi;
+	DWORD  dwSize = (DWORD)FileI.GetLength();
+	if (dwSize > 0)
+	{
+		char* pstrTemp = new char[dwSize + 1];
+		ZeroMemory(pstrTemp, sizeof(char) * (dwSize + 1) );
+		if (0 == FileI.Read(pstrTemp, dwSize))
+		{
+			FileI.Close();
+			delete [] pstrTemp;
+			strFile.Empty();
+			strFileAnsi.Empty();
+			return FALSE;
+		}
+		strFileAnsi = pstrTemp;
+		strFile = static_cast<CString>(strFileAnsi);
+		delete [] pstrTemp;
+	}
+	FileI.Close();
+	// Line Parsing
+	m_ItemList.clear();
+
+	CString strLine;
+	int nFindStart = 0;
+	int nFindEnd = 0;
+
+	CString strTitle;
+	CString strData;
+	dwSize = strFile.GetLength();
+	while ((DWORD)nFindEnd < dwSize)
+	{
+		nFindEnd = strFile.Find(_T("\r\n"), nFindStart);
+		if (nFindEnd == -1)					// 颇老狼 场俊 \r\n捞 绝绰 版快烙.
+			nFindEnd = strFile.GetLength();
+
+		strLine.Empty();
+		strLine = strFile.Mid(nFindStart, nFindEnd - nFindStart);
+
+		strTitle = _T("");
+		strData = _T("");
+
+		this->StringSeperate(strLine,&strTitle,&strData);
+		m_ItemList.insert(std::pair<CString,CString>(strTitle,strData));
+		nFindStart = nFindEnd + 2;
+		m_nItemCount++;
+	}
+
+	strFile.Empty();
+	strFileAnsi.Empty();
+	strLine.Empty();
+	strTitle.Empty();
+	strData.Empty();
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Item Read
+
+int CFileMap::GetItemValue(CString strName, CString& strValue, CString strDefault)
+{
+	int nRet = 0;
+
+	BOOL bFind = FALSE;
+
+	m_Iter = m_ItemList.find(strName);
+	if( m_Iter == m_ItemList.end())
+	{
+		strValue = strDefault;
+		return -1;
+	}
+
+	strValue = m_Iter->second;
+	return TRUE;
+
+}
+
+int CFileMap::GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = GetItemValue(strFullName, strValue, strDefault);
+
+	strFullName.Empty();
+
+	return bRet;
+}
+
+int CFileMap::GetItemValue(CString strName, int& nValue, int nDefault)
+{
+	CString strValue;
+
+	if (GetItemValue(strName, strValue) == -1)
+	{
+		nValue = nDefault;
+
+		strValue.Empty();
+		return -1;
+	}
+
+	nValue = _tstoi((LPTSTR)(LPCTSTR)strValue);
+
+	strValue.Empty();
+	return TRUE;
+}
+
+int CFileMap::GetItemValue(int nIdx, CString strName, int& nValue, int nDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	if (GetItemValue(strFullName, strValue) == -1)
+	{
+		nValue = nDefault;
+
+		strFullName.Empty();
+		strValue.Empty();
+		return -1;
+	}
+
+	nValue = _tstoi((LPTSTR)(LPCTSTR)strValue);
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+int CFileMap::GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault)
+{
+	CString strValue;
+	if (GetItemValue(strName, strValue) == -1)
+	{
+		nValue = sDefault;
+
+		strValue.Empty();
+		return -1;
+	}
+
+	int nVal = _tstoi((LPTSTR)(LPCTSTR)strValue);
+	nValue = static_cast<unsigned short>(nVal);
+
+	strValue.Empty();
+	return TRUE;
+}
+
+int CFileMap::GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	if (GetItemValue(strFullName, strValue) == -1)
+	{
+		nValue = sDefault;
+
+		strFullName.Empty();
+		strValue.Empty();
+		return -1;
+	}
+
+	int nVal = _tstoi((LPTSTR)(LPCTSTR)strValue);
+	nValue = static_cast<unsigned short>(nVal);
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+int CFileMap::GetItemValue(CString strName, double &dValue, double dDefault)
+{
+	CString strValue;
+	if (GetItemValue(strName, strValue) == -1)
+	{
+		dValue = dDefault;
+
+		strValue.Empty();
+		return -1;
+	}
+
+	TCHAR*	end ;
+	dValue = _tcstod((LPCTSTR)strValue, &end) ;
+
+
+	strValue.Empty();
+	return TRUE;
+}
+
+int CFileMap::GetItemValue(int nIdx, CString strName, double &dValue, double dDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	if (GetItemValue(strFullName, strValue) == -1)
+	{
+		dValue = dDefault;
+		
+		strFullName.Empty();
+		strValue.Empty();
+		return -1;
+	}
+
+	TCHAR*	end ;
+	dValue = _tcstod((LPCTSTR)strValue, &end) ;
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Write Information
+BOOL CFileMap::SetItemValue(CString strName, CString& strValue)
+{
+	if (strName.IsEmpty() || strValue.IsEmpty())
+		return FALSE;
+
+	EnterCriticalSection(&m_cs);
+
+	WriteLog(strName, strValue);
+
+	// Modify Value
+	BOOL bFind = FALSE;
+
+	
+	m_Iter = m_ItemList.find(strName);
+	if( m_Iter != m_ItemList.end())
+	{
+		m_Iter->second = strValue;
+		bFind = FALSE;
+	}	
+	
+	// Add New Value
+	if (!bFind)
+	{
+		m_ItemList.insert(std::pair<CString,CString>(strName,strValue));
+		m_nItemCount++;
+	}
+
+	LeaveCriticalSection(&m_cs);
+
+	if (m_bRewrite)
+		return WriteToFile();
+
+	return TRUE;
+}
+
+BOOL CFileMap::SetItemValue(int nIdx, CString strName, CString& strValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet =  SetItemValue(strFullName, strValue);
+	
+	strFullName.Empty();
+
+	return bRet;
+}
+
+BOOL CFileMap::SetItemValue(CString strName, int& nValue)
+{
+	CString strValue;
+	strValue.Format(_T("%d"), nValue);
+
+	if (!SetItemValue(strName, strValue))
+	{
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileMap::SetItemValue(int nIdx, CString strName, int& nValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	strValue.Format(_T("%d"), nValue);
+
+	if (!SetItemValue(strFullName, strValue))
+	{
+		strFullName.Empty();
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileMap::SetItemValue(CString strName, unsigned short &nValue)
+{
+	CString strValue;
+	strValue.Format(_T("%d"), nValue);
+
+	if (!SetItemValue(strName, strValue))
+	{
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileMap::SetItemValue(int nIdx, CString strName, unsigned short &nValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	strValue.Format(_T("%d"), nValue);
+
+	if (!SetItemValue(strFullName, strValue))
+	{
+		strFullName.Empty();
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileMap::SetItemValue(CString strName, double& dValue)
+{
+	CString strValue;
+	strValue.Format(_T("%f"), dValue);
+
+	if (!SetItemValue(strName, strValue))
+	{
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileMap::SetItemValue(int nIdx, CString strName, double& dValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	CString strValue;
+	strValue.Format(_T("%f"), dValue);
+
+	if (!SetItemValue(strFullName, strValue))
+	{
+		strFullName.Empty();
+		strValue.Empty();
+		return FALSE;
+	}
+
+	strFullName.Empty();
+	strValue.Empty();
+	return TRUE;
+}
+
+BOOL CFileMap::RemoveItem(CString strName)
+{
+	EnterCriticalSection(&m_cs);
+
+	m_Iter = m_ItemList.find(strName);
+	if( m_Iter != m_ItemList.end() )
+	{
+		m_Iter = m_ItemList.erase(m_Iter);
+		m_nItemCount--;
+	}
+
+	LeaveCriticalSection(&m_cs);
+
+	return TRUE;
+}
+
+BOOL CFileMap::RemoveItem(int nIdx, CString strName)
+{
+	EnterCriticalSection(&m_cs);
+	
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	m_Iter = m_ItemList.find(strFullName);
+
+	if( m_Iter != m_ItemList.end() )
+	{
+		m_Iter = m_ItemList.erase(m_Iter);
+		m_nItemCount--;
+	}
+	
+	strFullName.Empty();
+	LeaveCriticalSection(&m_cs);
+	
+	return TRUE;
+}
+
+BOOL CFileMap::WriteToFile()
+{
+	CFile FileI;
+	CString strTemp;
+
+	if (!FileI.Open(m_strFileName, CFile::modeCreate| CFile::modeWrite))
+	{
+		if (!FileI.Open(m_strFileName, CFile::modeCreate | CFile::modeWrite))
+			return FALSE;
+	}
+
+	DWORD dwTick = GetTickCount();
+
+	EnterCriticalSection(&m_cs);
+
+	// Write to File
+
+	CStringA strName = "";
+	CStringA strData = "";
+	for(m_Iter = m_ItemList.begin(); m_Iter != m_ItemList.end(); ++m_Iter)
+	{
+		strName = static_cast<CStringA>(m_Iter->first);
+		strData = static_cast<CStringA>(m_Iter->second);
+		if (!strName.IsEmpty() && !strData.IsEmpty())
+		{
+			FileI.Write(strName, strName.GetLength());
+			if (!strData.IsEmpty())
+			{
+				FileI.Write("=`", 2);
+				FileI.Write(strData, strData.GetLength());
+				FileI.Write("`", 1);
+			}
+			FileI.Write("\r\n", 2);
+		}
+	}
+	FileI.Close();
+
+	strName.Empty();
+	strData.Empty();
+	LeaveCriticalSection(&m_cs);
+
+	TRACE("[CFileMap][WriteToFile] Tick[%d] \n",GetTickCount() - dwTick);
+
+	strTemp.Empty();
+	return TRUE;
+}
+
+void CFileMap::WriteLog( CString strName, CString strValue )
+{
+	if( m_bLogMode == FALSE )
+		return;
+	
+	if( m_strLogFileName.IsEmpty() == TRUE )
+		return;
+	
+	CString strTmp;
+
+	GetItemValue(strName, strTmp);
+
+	if( strTmp != strValue)
+	{
+		// Write Log
+		CTime cuTime = CTime::GetCurrentTime();
+		CString strContents;
+		strContents.Format(_T("%d-%d-%d:%d:%d:%d : [%s] : [%s] -> [%s]"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond(), strName, strTmp, strValue);
+		WriteToLogFile(strContents);
+		strContents.Empty();
+	}
+
+	strTmp.Empty();
+	return;
+}
+void CFileMap::WriteLog( CString strName, int& nValue )
+{
+	if( m_bLogMode == FALSE )
+		return;
+	
+	if( m_strLogFileName.IsEmpty() == TRUE )
+		return;
+	
+	CString strTmp;
+	int nTmpValue;
+
+	GetItemValue(strName, nTmpValue);
+
+	if( nValue != nTmpValue)
+	{
+		// Write Log
+		CTime cuTime = CTime::GetCurrentTime();
+		CString strContents;
+		strContents.Format(_T("%d-%d-%d:%d:%d:%d : [%s] : [%d] -> [%d]"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond(), strName, nTmpValue, nValue);
+		WriteToLogFile(strContents);
+		strContents.Empty();
+	}	
+	strTmp.Empty();
+}
+void CFileMap::WriteLog( CString strName, unsigned short &nValue )
+{
+	if( m_bLogMode == FALSE )
+		return;
+	
+	if( m_strLogFileName.IsEmpty() == TRUE )
+		return;
+	
+	CString strTmp;
+	unsigned short nTmpValue;
+
+	GetItemValue(strName, nTmpValue);
+
+	if( nValue != nTmpValue)
+	{
+		// Write Log
+		CTime cuTime = CTime::GetCurrentTime();
+		CString strContents;
+		strContents.Format(_T("%d-%d-%d:%d:%d:%d : [%s] : [%d] -> [%d]"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond(), strName, nTmpValue, nValue);
+		WriteToLogFile(strContents);
+		strContents.Empty();
+	}	
+	strTmp.Empty();
+}
+void CFileMap::WriteLog( CString strName, double& dValue )
+{
+	if( m_bLogMode == FALSE )
+		return;
+	
+	if( m_strLogFileName.IsEmpty() == TRUE )
+		return;
+	
+	CString strTmp;
+	double dTmpValue;
+
+	GetItemValue(strName, dTmpValue);
+
+	if( dValue != dTmpValue)
+	{
+		// Write Log
+		CTime cuTime = CTime::GetCurrentTime();
+		CString strContents;
+		strContents.Format(_T("%d-%d-%d:%d:%d:%d : [%s] : [%f] -> [%f]"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond(), strName, dTmpValue, dValue);
+		WriteToLogFile(strContents);
+		strContents.Empty();
+	}
+	strTmp.Empty();
+}
+
+// Log File俊 静扁.
+BOOL CFileMap::WriteToLogFile(CString& strContents)
+{
+	if(m_strLogFileName.IsEmpty() == TRUE || m_bLogMode == FALSE)
+		return FALSE;
+
+	CFile File;
+	if (!File.Open(m_strLogFileName, CFile::modeWrite))
+	{
+		if (!File.Open(m_strLogFileName, CFile::modeCreate | CFile::modeWrite))
+		{
+			return FALSE;
+		}
+	}
+
+	CStringA strBufA = (CStringA)strContents;
+
+	File.SeekToEnd();
+	File.Write(strBufA, strBufA.GetLength());
+	File.Write("\r\n", (UINT)strlen("\r\n"));
+	File.Close();
+	
+	return TRUE;
+}
+void CFileMap::StringSeperate(CString& strLine, CString* pStrTitle, CString* pStrData)
+{
+	if (strLine.IsEmpty())
+		return;
+
+	int nTemp1 = 0, nTemp2 = 0, nTemp3 = 0;
+
+	nTemp1 = strLine.Find('=', 0);
+	nTemp2 = strLine.Find('`', 0);
+	nTemp3 = strLine.Find('`', nTemp2 + 1);
+	if (nTemp1 == -1 || nTemp2 == -1 || nTemp3 == -1)
+	{
+		*pStrTitle = strLine;
+		
+		pStrTitle->TrimRight(_T("\r"));
+		pStrTitle->TrimRight(_T("\n"));
+		
+		return;
+	}
+	
+	*pStrTitle = strLine.Left(nTemp1);
+	pStrTitle->TrimLeft(_T(" "));
+	pStrTitle->TrimRight(_T(" "));
+	pStrTitle->TrimRight(_T("\r"));
+	pStrTitle->TrimRight(_T("\n"));
+	
+	pStrData->Empty();
+	*pStrData = strLine.Mid(nTemp2 + 1, nTemp3 - nTemp2 - 1);
+	pStrData->TrimLeft(_T(" "));
+	pStrData->TrimRight(_T(" "));
+	pStrData->TrimRight(_T("\r"));
+	pStrData->TrimRight(_T("\n"));
+}
\ No newline at end of file
diff --git a/Common_Class/ConfigFileManager/FileVersionManager.cpp b/Common_Class/ConfigFileManager/FileVersionManager.cpp
new file mode 100644
index 0000000..688dbf0
--- /dev/null
+++ b/Common_Class/ConfigFileManager/FileVersionManager.cpp
@@ -0,0 +1,62 @@
+#include "StdAfx.h"
+#include "FileVersionManager.h"
+
+
+CFileVersionManager::CFileVersionManager(void)
+{
+	m_strVersion = _T("");
+	m_nSoftRev = 0;
+}
+
+
+CFileVersionManager::~CFileVersionManager(void)
+{
+	m_strVersion.Empty();
+}
+
+
+BOOL CFileVersionManager::LoadData( CConfig* pConfig )
+{
+	ASSERT(pConfig);
+
+	// Version Update ////////////////////////////////////////////////////////
+	pConfig->GetItemValue(_T("VERSION"),m_strVersion);
+	//////////////////////////////////////////////////////////////////////////
+
+	// SOFTREV
+	pConfig->GetItemValue(_T("SOFTREV"), m_nSoftRev);
+
+	return TRUE;
+}
+
+BOOL CFileVersionManager::SaveData( CConfig* pConfig )
+{
+	ASSERT(pConfig);
+
+	// Version Update ////////////////////////////////////////////////////////
+	CString strVersion = _T("");
+	CTime cuTime = CTime::GetCurrentTime();
+	strVersion.Format(_T("%04d%02d%02d%02d%02d%02d"),cuTime.GetYear(),cuTime.GetMonth(),cuTime.GetDay(),cuTime.GetHour(),cuTime.GetMinute(),cuTime.GetSecond());
+	pConfig->SetItemValue(_T("VERSION"),strVersion);
+	strVersion.Empty();
+	//////////////////////////////////////////////////////////////////////////
+
+	// SOFTREV
+	m_nSoftRev++;
+	if(m_nSoftRev >= INT_MAX)
+	{
+		m_nSoftRev = 0;
+	}
+	pConfig->SetItemValue(_T("SOFTREV"), m_nSoftRev);
+	return TRUE;
+}
+
+CString CFileVersionManager::GetVersion()
+{
+	return m_strVersion;
+}
+
+int CFileVersionManager::GetSoftRev()
+{
+	return m_nSoftRev;
+}
diff --git a/Common_Class/ConfigFileManager/Header/BasedConfig.h b/Common_Class/ConfigFileManager/Header/BasedConfig.h
new file mode 100644
index 0000000..917c802
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Header/BasedConfig.h
@@ -0,0 +1,67 @@
+// BasedConfig.h: interface for the CBasedConfig class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_BASEDCONFIG_H__90C1B236_E7C5_450C_9B90_52079419DA37__INCLUDED_)
+#define AFX_BASEDCONFIG_H__90C1B236_E7C5_450C_9B90_52079419DA37__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+/*!
+* \brief
+* 牢磐其捞胶 努贰胶 
+* 
+* 颇老 涝免仿 扼捞宏矾府狼 牢磐其捞胶 努贰胶
+* 
+*/
+class CBasedConfig  
+{
+public:
+	CBasedConfig();
+	virtual ~CBasedConfig();
+
+	virtual BOOL	Initialize(HKEY hKey, CString strKey, CString strFilename) = 0;									//!> 檬扁拳 窃荐 牢磐其捞胶
+	
+	//////////////////////////////////////////////////////////////////////////
+	virtual BOOL	SetItemValue(CString strName,  CString& strvalue) = 0;											//!> Set 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : CString屈  
+	virtual BOOL	SetItemValue(CString strName, int& nValue) = 0;													//!> Set 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : int屈  
+	virtual BOOL	SetItemValue(CString strName, unsigned short &sValue) = 0;										//!> Set 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	virtual BOOL	SetItemValue(CString strName, double& dValue) = 0;												//!> Set 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	virtual BOOL	SetItemValue(int nIdx, CString strName, CString& strvalue) = 0;									//!> Set 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : CString屈  
+	virtual BOOL	SetItemValue(int nIdx, CString strName, int& nValue) = 0;										//!> Set 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : int屈  
+	virtual BOOL	SetItemValue(int nIdx, CString strName, unsigned short &sValue) = 0;							//!> Set 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	virtual BOOL	SetItemValue(int nIdx, CString strName, double& dValue) = 0;									//!> Set 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	//////////////////////////////////////////////////////////////////////////
+	virtual int		GetItemValue(CString strName, CString& strValue, CString strDefault) = 0;						//!> Get 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : CString屈  
+	virtual int		GetItemValue(CString strName, int& nValue, int nDefault) = 0;									//!> Get 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : int屈  
+	virtual int		GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault) = 0;				//!> Get 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	virtual int		GetItemValue(CString strName, double& dValue, double dDefault) = 0;								//!> Get 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	virtual int		GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault) = 0;				//!> Get 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : CString屈  
+	virtual int		GetItemValue(int nIdx, CString strName, int& nValue, int nDefault) = 0;							//!> Get 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : int屈  
+	virtual int		GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault) = 0;	//!> Get 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : unsigned short屈 
+	virtual int		GetItemValue(int nIdx, CString strName, double& dValue, double dDefault) = 0;					//!> Get 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	virtual BOOL	RemoveAllItem() = 0;																			//!> 肺靛等 皋葛府狼 葛电 亲格阑 昏力
+	virtual BOOL	RemoveItem(CString strName) = 0;																//!> strName 捞抚阑 啊柳 亲格阑 昏力
+	virtual BOOL	RemoveItem(int nIdx, CString strName) = 0;														//!> 硅凯(nIdx), strName 捞抚阑 啊柳 亲格阑 昏力
+
+	
+	virtual BOOL	WriteToFile() = 0;																				//!> 颇老俊 亲格 静扁 ( 皋葛府 -> 颇老 )
+
+	virtual void	SetRewriteMode(BOOL bRewrite) = 0;																//!> ReWrite 葛靛狼 汲沥 ( TRUE老 版快 皋葛府客 颇老阑 角矫埃 悼扁拳 茄促)
+	virtual BOOL	GetRewriteMode() = 0;																			//!> ReWrite 葛靛 惑怕 罐扁
+	
+
+	// OhByungGil  Modify -> LogFile Write
+	virtual void	SetLogMode(BOOL bMode) = 0;																		//!> 肺弊 葛靛狼 汲沥 ( TRUE老 版快 亲格捞 函版瞪 矫俊 肺弊甫 免仿茄促. )
+	virtual BOOL	GetLogMode() = 0;																				//!> 肺弊 葛靛 惑怕 罐扁
+	virtual void	SetLogFilePath(CString strLogFilePath) = 0;														//!> 肺弊 颇老狼 版肺 汲沥
+	virtual CString GetLogFilePath() = 0;																			//!> 汲沥等 肺弊 颇老狼 版肺 罐扁
+};
+
+#endif // !defined(AFX_BASEDCONFIG_H__90C1B236_E7C5_450C_9B90_52079419DA37__INCLUDED_)
diff --git a/Common_Class/ConfigFileManager/Header/Config.h b/Common_Class/ConfigFileManager/Header/Config.h
new file mode 100644
index 0000000..93357ab
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Header/Config.h
@@ -0,0 +1,89 @@
+// HMRegiConfig.h: interface for the CConfig class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_)
+#define AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "BasedConfig.h"
+
+enum Grouping	//!> 颇老 包府 葛碘 弊缝
+{
+	FileMap_Mode = 1,		///> STL Map 捞侩 包府
+	FileManager_Mode = 2,	///> MFC COblist 捞侩 包府
+	Registery_mode = 4,		///> 饭瘤胶飘府 包府
+	Ini_Mode = 5			///> INI 颇老 捞侩 包府
+};
+
+#define SHLM	HKEY_LOCAL_MACHINE
+#define SHCU	HKEY_CURRENT_USER
+#define SHCR	HKEY_CLASSES_ROOT
+
+/*!
+* \brief
+* 单捞磐 包府 努贰胶 
+* 
+* 单捞磐 包府 努贰胶肺辑 (颇老 包府, 饭瘤胶飘府 包府甫 瘤盔茄促.) \n\n
+* 颇老 葛靛\n
+* SetRegiConfig 阑 捞侩窍咯 颇老 坷锹矫 皋葛府肺 颇老狼 郴侩阑 利犁 茄促. \n
+* 单捞磐 涝/免仿 饶 WriteToFile 窃荐甫 烹秦辑 悼扁拳 窍芭唱 ReWriteMode甫 捞侩窍咯 角矫埃 悼扁拳 且 荐 乐促.
+*/
+class AFX_EXT_CLASS CConfig  
+{
+public:
+	CConfig();
+	virtual ~CConfig();
+
+	BOOL	SetLogWriteMode(BOOL bUse,CString strFilePath);													//!> 肺弊 葛靛 汲沥
+	
+	BOOL	SetRegiConfig(HKEY hKey, CString strKey, TCHAR* szFilename, Grouping Select = FileMap_Mode);	//!> 颇老/饭瘤胶飘府 肺靛 
+
+	BOOL	DeleteAllItem();																				//!> 傈眉 单捞磐 昏力
+	BOOL	DeleteValue(CString strvalue);																	//!> 急琶 单捞磐 昏力
+	BOOL	DeleteValue(CString strvalue, int nIdx);														//!> 急琶 单捞磐 昏力
+
+	// File_Mode 父 利侩.
+	BOOL	WriteToFile();																					//!> FIle Mode 老 版快 皋葛府狼 郴侩阑 颇老俊 历厘茄促.
+	void	SetRewriteMode(BOOL bRewrite);																	//!> FIle Mode 老 版快 角矫埃 悼扁拳 葛靛甫 汲沥茄促.
+	BOOL	GetRewriteMode();																				//!> File Mode 老 版快 角矫埃 悼扁拳 葛靛 咯何甫 馆券茄促.
+
+	CString	GetFilePath();																					//!> File Mode 老 版快 包府窍绰 颇老狼 版肺甫 馆券茄促.
+
+	//////////////////////////////////////////////////////////////////////////
+	BOOL	SetItemValue(CString strName,  CString strvalue);												//!> Set strName : 亲格备盒磊 鸥涝 : CString屈  
+	BOOL	SetItemValue(CString strName, int nValue);														//!> Set strName : 亲格备盒磊 鸥涝 : int屈  
+	BOOL	SetItemValue(CString strName, unsigned short sValue);											//!> Set strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	BOOL	SetItemValue(CString strName, double dValue);													//!> Set strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	BOOL	SetItemValue(int nIdx, CString strName, CString strvalue);										//!> Set nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : CString屈  
+	BOOL	SetItemValue(int nIdx, CString strName, int nValue);											//!> Set nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : int屈  
+	BOOL	SetItemValue(int nIdx, CString strName, unsigned short sValue);									//!> Set nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : unsigned short屈
+	BOOL	SetItemValue(int nIdx, CString strName, double dValue);											//!> Set nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	//////////////////////////////////////////////////////////////////////////
+	int		GetItemValue(CString strName, CString& strValue, CString strDefault = _T(""));					//!> Get strName : 亲格备盒磊 鸥涝 : CString屈  
+	int		GetItemValue(CString strName, int& nValue, int nDefault = 0);									//!> Get strName : 亲格备盒磊 鸥涝 : int屈  
+	int		GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault = 0);				//!> Get strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	int		GetItemValue(CString strName, double& dValue, double dDefault = 0.0);							//!> Get strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	int		GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault = _T(""));		//!> Get nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : CString屈  
+	int		GetItemValue(int nIdx, CString strName, int& nValue, int nDefault = 0);							//!> Get nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : int屈  
+	int		GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault = 0);	//!> Get nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : unsigned short屈
+	int		GetItemValue(int nIdx, CString strName, double& dValue, double dDefault = 0.0);					//!> Get nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : double屈  
+
+public:
+	
+	Grouping		m_Classification;																		///> 颇老/饭瘤胶飘府 包府 鸥涝
+
+protected:
+	
+	CBasedConfig	*m_pConfig;																				///> 扁夯 按眉 器牢磐
+
+	CString			m_strFilePath;																			///> 颇老 版肺
+};
+
+#endif // !defined(AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_)
diff --git a/Common_Class/ConfigFileManager/Header/FileIOInterface.h b/Common_Class/ConfigFileManager/Header/FileIOInterface.h
new file mode 100644
index 0000000..d0c362a
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Header/FileIOInterface.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "Config.h"
+
+class AFX_EXT_CLASS CFileIOInterface
+{
+public:
+	CFileIOInterface(void);
+	virtual ~CFileIOInterface(void);
+
+#pragma region Interface Function
+	virtual BOOL LoadData(CConfig* pConfig) = 0;
+	virtual BOOL SaveData(CConfig* pConfig) = 0;
+#pragma endregion Interface Function
+};
+
diff --git a/Common_Class/ConfigFileManager/Header/FileList.h b/Common_Class/ConfigFileManager/Header/FileList.h
new file mode 100644
index 0000000..368e87e
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Header/FileList.h
@@ -0,0 +1,140 @@
+// HMConfigFile.h: interface for the CFileList class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FILELIST_H__9BD76395_D4EB_4173_A317_C040E5CF99AA__INCLUDED_)
+#define AFX_FILELIST_H__9BD76395_D4EB_4173_A317_C040E5CF99AA__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "BasedConfig.h"
+
+class FileListItem : public CObject
+{
+public:
+	CString s_strName;
+	CString s_strValue;
+
+	FileListItem()
+	{
+		Reset();
+	}
+
+	void Reset()
+	{
+		s_strName.Empty();
+		s_strValue.Empty();
+	}
+
+	void SetItem(CString& strName, CString& strValue)
+	{
+		s_strName = strName;
+		s_strValue = strValue;
+	}
+
+	void SetItem(CString& strItem)
+	{
+		if (strItem.IsEmpty())
+			return;
+
+		int nTemp1 = 0, nTemp2 = 0, nTemp3 = 0;
+
+		nTemp1 = strItem.Find('=', 0);
+		nTemp2 = strItem.Find('`', 0);
+		nTemp3 = strItem.Find('`', nTemp2 + 1);
+		if (nTemp1 == -1 || nTemp2 == -1 || nTemp3 == -1)
+		{
+			s_strName = strItem;
+
+			s_strName.TrimRight(_T("\r"));
+			s_strName.TrimRight(_T("\n"));
+
+			return;
+		}
+
+		s_strName = strItem.Left(nTemp1);
+		s_strName.TrimLeft(_T(" "));
+		s_strName.TrimRight(_T(" "));
+		s_strName.TrimRight(_T("\r"));
+		s_strName.TrimRight(_T("\n"));
+
+		s_strValue.Empty();
+		s_strValue = strItem.Mid(nTemp2 + 1, nTemp3 - nTemp2 - 1);
+		s_strValue.TrimLeft(_T(" "));
+		s_strValue.TrimRight(_T(" "));
+		s_strValue.TrimRight(_T("\r"));
+		s_strValue.TrimRight(_T("\n"));
+	}
+};
+
+class CFileList : public CBasedConfig 
+{
+public:
+	CFileList();
+//	CFileList(char* szFilename);	// 惑措版肺
+	virtual ~CFileList();
+	
+	BOOL	Initialize(HKEY hKey, CString strKey, CString strFilename);
+	
+	//////////////////////////////////////////////////////////////////////////
+	BOOL	SetItemValue(CString strName,  CString& strValue);
+	BOOL	SetItemValue(CString strName, int& nValue);
+	BOOL	SetItemValue(CString strName, unsigned short &sValue);
+	BOOL	SetItemValue(CString strName, double& dValue);
+	
+	BOOL	SetItemValue(int nIdx, CString strName, CString& strValue);
+	BOOL	SetItemValue(int nIdx, CString strName, int& nValue);
+	BOOL	SetItemValue(int nIdx, CString strName, unsigned short &sValue);
+	BOOL	SetItemValue(int nIdx, CString strName, double& dValue);
+	
+	//////////////////////////////////////////////////////////////////////////
+	int		GetItemValue(CString strName, CString& strValue, CString strDefault = _T(""));
+	int		GetItemValue(CString strName, int& nValue, int nDefault = 0);
+	int		GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault = 0);
+	int		GetItemValue(CString strName, double& dValue, double dDefault = 0);
+	
+	int		GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault = _T(""));
+	int		GetItemValue(int nIdx, CString strName, int& nValue, int nDefault = 0);
+	int		GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault = 0);
+	int		GetItemValue(int nIdx, CString strName, double& dValue, double dDefault = 0);
+	
+	BOOL	RemoveAllItem();
+	BOOL	RemoveItem(CString strName);
+	BOOL	RemoveItem(int nIdx, CString strName);
+
+	
+	BOOL	WriteToFile();
+
+	void	SetRewriteMode(BOOL bRewrite);
+	BOOL	GetRewriteMode();
+	
+
+	// OhByungGil  Modify -> LogFile Write
+	void	SetLogMode(BOOL bMode);
+	BOOL	GetLogMode();
+	void	SetLogFilePath(CString strLogFilePath);
+	CString GetLogFilePath();
+
+protected:
+	void	WriteLog( CString strName, CString strValue );
+	void	WriteLog( CString strName, int& nValue );
+	void	WriteLog( CString strName, unsigned short &nValue );
+	void	WriteLog( CString strName, double& dValue );
+
+	BOOL	WriteToLogFile(CString& strContents);
+
+private:
+	CString				m_strFileName;
+	CObList				m_ItemList;
+	int					m_nItemCount;
+	BOOL				m_bRewrite;
+
+	CString				m_strLogFileName;	// OhByungGil 100531
+	BOOL				m_bLogMode;
+
+	CRITICAL_SECTION	m_cs;
+};
+
+#endif // !defined(AFX_FILELIST_H__9BD76395_D4EB_4173_A317_C040E5CF99AA__INCLUDED_)
diff --git a/Common_Class/ConfigFileManager/Header/FileMap.h b/Common_Class/ConfigFileManager/Header/FileMap.h
new file mode 100644
index 0000000..68836ea
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Header/FileMap.h
@@ -0,0 +1,97 @@
+// FileMap.h: interface for the CFileMap class.
+// 110222 OhByungGil
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_FILEMAP_H__42CF4DC4_087E_4E66_9F2B_7764E7DDDF47__INCLUDED_)
+#define AFX_FILEMAP_H__42CF4DC4_087E_4E66_9F2B_7764E7DDDF47__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
+#include<map>
+
+#include "BasedConfig.h"
+
+class CFileMap : public CBasedConfig 
+{
+public:
+	CFileMap();
+//	CFileMap(char* szFileName);
+	virtual ~CFileMap();
+
+
+	BOOL	Initialize(HKEY hKey, CString strKey, CString strFilename);
+	
+	//////////////////////////////////////////////////////////////////////////
+	BOOL	SetItemValue(CString strName, CString& strValue);
+	BOOL	SetItemValue(CString strName, int& nValue);
+	BOOL	SetItemValue(CString strName, unsigned short &nValue);
+	BOOL	SetItemValue(CString strName, double& dValue);
+	
+	BOOL	SetItemValue(int nIdx, CString strName, CString& strValue);
+	BOOL	SetItemValue(int nIdx, CString strName, int& nValue);
+	BOOL	SetItemValue(int nIdx, CString strName, unsigned short &nValue);
+	BOOL	SetItemValue(int nIdx, CString strName, double& dValue);
+	//////////////////////////////////////////////////////////////////////////
+
+	//////////////////////////////////////////////////////////////////////////
+	int		GetItemValue(CString strName, CString& strValue, CString strDefault = _T(""));
+	int		GetItemValue(CString strName, int& nValue, int nDefault = 0);
+	int		GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault = 0);
+	int		GetItemValue(CString strName, double& dValue, double dDefault = 0.0);
+	
+	int		GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault = _T(""));
+	int		GetItemValue(int nIdx, CString strName, int& nValue, int nDefault = 0);
+	int		GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault = 0);
+	int		GetItemValue(int nIdx, CString strName, double& dValue, double dDefault = 0.0);
+	
+	//////////////////////////////////////////////////////////////////////////
+	
+	BOOL	RemoveAllItem();
+	BOOL	RemoveItem(CString strName);
+	BOOL	RemoveItem(int nIdx, CString strName);
+	
+	// OhByungGil  Modify -> LogFile Write
+	void	SetLogMode(BOOL bMode)					{	m_bLogMode = bMode;	}
+	BOOL	GetLogMode()							{	return m_bLogMode;	}
+	void	SetLogFilePath(CString strLogFilePath)	{	m_strLogFileName = strLogFilePath;}
+	CString GetLogFilePath()						{	return m_strLogFileName;	}
+	
+	BOOL	WriteToFile();
+	
+	void	SetRewriteMode(BOOL bRewrite)	{ m_bRewrite = bRewrite; }
+	BOOL	GetRewriteMode()				{ return m_bRewrite; }
+
+protected:
+	void	WriteLog( CString strName, CString strValue );
+	void	WriteLog( CString strName, int& nValue );
+	void	WriteLog( CString strName, unsigned short &nValue );
+	void	WriteLog( CString strName, double& dValue );
+
+	BOOL	WriteToLogFile(CString& strContents);
+	void	StringSeperate(CString& strLine, CString* pStrTitle, CString* pStrData);
+private:
+	CString				m_strFileName;
+	int					m_nItemCount;
+	BOOL				m_bRewrite;
+	
+	CString				m_strLogFileName;	// OhByungGil 100531
+	BOOL				m_bLogMode;
+	
+	CRITICAL_SECTION	m_cs;
+
+
+	std::map<CString,CString>					m_ItemList;
+	std::map<CString,CString>::iterator			m_Iter;
+
+
+
+
+};
+
+#endif // !defined(AFX_FILEMAP_H__42CF4DC4_087E_4E66_9F2B_7764E7DDDF47__INCLUDED_)
diff --git a/Common_Class/ConfigFileManager/Header/FileVersionManager.h b/Common_Class/ConfigFileManager/Header/FileVersionManager.h
new file mode 100644
index 0000000..cbb95d6
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Header/FileVersionManager.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "Config.h"
+
+class AFX_EXT_CLASS CFileVersionManager
+{
+public:
+	CFileVersionManager(void);
+	virtual ~CFileVersionManager(void);
+
+	BOOL	LoadData(CConfig* pConfig);
+	BOOL	SaveData(CConfig* pConfig);
+
+	CString			GetVersion();
+	int				GetSoftRev();
+private:
+	CString			m_strVersion;
+	int				m_nSoftRev;
+};
+
diff --git a/Common_Class/ConfigFileManager/Header/IniManager.h b/Common_Class/ConfigFileManager/Header/IniManager.h
new file mode 100644
index 0000000..c6c3a1c
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Header/IniManager.h
@@ -0,0 +1,89 @@
+// IniManager.h: interface for the CIniManager class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_INIMANAGER_H__B55A8610_4737_40C1_B31D_1B05446F5B1B__INCLUDED_)
+#define AFX_INIMANAGER_H__B55A8610_4737_40C1_B31D_1B05446F5B1B__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "BasedConfig.h"
+
+class CIniManager : public CBasedConfig
+{
+public:
+	CIniManager();
+	virtual ~CIniManager();
+
+	BOOL	Initialize(HKEY hKey, CString strKey, CString strFilename);
+
+	//////////////////////////////////////////////////////////////////////////
+	BOOL	SetItemValue(CString strName, int& nValue);
+	BOOL	SetItemValue(CString strName, unsigned short &usValue);
+	BOOL	SetItemValue(CString strName, double& dValue);
+	BOOL	SetItemValue(CString strName, CString& strValue);
+
+	BOOL	SetItemValue(int nIndex, CString strName, int& nValue);
+	BOOL	SetItemValue(int nIndex, CString strName, unsigned short &usValue);
+	BOOL	SetItemValue(int nIndex, CString strName, double& dValue);
+	BOOL	SetItemValue(int nIndex, CString strName, CString& strValue);
+	//////////////////////////////////////////////////////////////////////////
+	
+	//////////////////////////////////////////////////////////////////////////
+	int		GetItemValue(CString strName, CString& strValue, CString strDefault = _T(""));
+	int		GetItemValue(CString strName, int& nValue, int nDefault = 0);
+	int		GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault = 0);
+	int		GetItemValue(CString strName, double& dValue, double dDefault = 0);
+	
+	int		GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault = _T(""));
+	int		GetItemValue(int nIdx, CString strName, int& nValue, int nDefault = 0);
+	int		GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault = 0);
+	int		GetItemValue(int nIdx, CString strName, double& dValue, double dDefault = 0);
+	//////////////////////////////////////////////////////////////////////////
+
+	BOOL	RemoveAllItem();
+	BOOL	RemoveItem(CString strName);
+	BOOL	RemoveItem(int nIdx, CString strName);
+
+	BOOL	WriteToFile();
+
+	void	SetRewriteMode(BOOL bRewrite);
+	BOOL	GetRewriteMode();
+	
+
+	// OhByungGil  Modify -> LogFile Write
+	void	SetLogMode(BOOL bMode);
+	BOOL	GetLogMode();
+	void	SetLogFilePath(CString strLogFilePath);
+	CString GetLogFilePath();
+
+protected:
+	CString m_strApp;
+	CString m_strFileName;
+
+	BOOL CheckHeader();
+	BOOL CheckFileName();
+
+	int		StringToInteger(LPCTSTR strValue);
+	double	StringToDouble(LPCTSTR strValue);
+	long	StringToLong(LPCTSTR strValue);
+
+
+	int		WriteDataStringA(LPCSTR App, LPCSTR  Key, LPCSTR Data, LPCSTR filename);
+	int		ReadDataStringA(LPCSTR App, LPCSTR  Key, LPCSTR Default, char* Data, DWORD size, LPCSTR filename);
+	
+	int		WriteDataStringW(LPCWSTR App, LPCWSTR  Key, LPCWSTR Data, LPCWSTR filename);
+	int		ReadDataStringW(LPCWSTR lpAppName, LPCWSTR  lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName);
+
+#ifdef UNICODE
+#define WriteDataString  WriteDataStringW
+#define ReadDataString  ReadDataStringW
+#else
+#define WriteDataString  WriteDataStringA
+#define ReadDataString  ReadDataStringA
+#endif // !UNICODE
+};
+
+#endif // !defined(AFX_INIMANAGER_H__B55A8610_4737_40C1_B31D_1B05446F5B1B__INCLUDED_)
diff --git a/Common_Class/ConfigFileManager/Header/Registery.h b/Common_Class/ConfigFileManager/Header/Registery.h
new file mode 100644
index 0000000..b451d41
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Header/Registery.h
@@ -0,0 +1,89 @@
+// HMRegistery.h: interface for the CRegist class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_REGISTERY_H__BFF1B539_B69C_46E1_8575_A595F5AC4D29__INCLUDED_)
+#define AFX_REGISTERY_H__BFF1B539_B69C_46E1_8575_A595F5AC4D29__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "BasedConfig.h"
+
+class CRegistery : public CBasedConfig
+{
+public:
+	CRegistery();
+	virtual ~CRegistery();
+
+	// Setting 蔼 利侩 窃荐.
+	BOOL	Initialize(HKEY hKey = HKEY_CURRENT_USER, CString strKey = _T(""), CString strFilename = _T(""));
+
+	//////////////////////////////////////////////////////////////////////////
+	BOOL	SetItemValue(CString strName,  CString& strValue);
+	BOOL	SetItemValue(CString strName, int& nValue);
+	BOOL	SetItemValue(CString strName, unsigned short &sValue);
+	BOOL	SetItemValue(CString strName, double& dValue);
+	
+	BOOL	SetItemValue(int nIdx, CString strName, CString& strValue);
+	BOOL	SetItemValue(int nIdx, CString strName, int& nValue);
+	BOOL	SetItemValue(int nIdx, CString strName, unsigned short &sValue);
+	BOOL	SetItemValue(int nIdx, CString strName, double& dValue);
+	
+	//////////////////////////////////////////////////////////////////////////
+	int		GetItemValue(CString strName, CString& strValue, CString strDefault = _T(""));
+	int		GetItemValue(CString strName, int& nValue, int nDefault = 0);
+	int		GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault = 0);
+	int		GetItemValue(CString strName, double& dValue, double dDefault = 0);
+	
+	int		GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault = _T(""));
+	int		GetItemValue(int nIdx, CString strName, int& nValue, int nDefault = 0);
+	int		GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault = 0);
+	int		GetItemValue(int nIdx, CString strName, double& dValue, double dDefault = 0);
+	
+	BOOL	RemoveAllItem();
+	BOOL	RemoveItem(CString strName);
+	BOOL	RemoveItem(int nIdx, CString strName);
+
+	BOOL	WriteToFile();
+
+	void	SetRewriteMode(BOOL bRewrite);
+	BOOL	GetRewriteMode();
+	
+
+	// OhByungGil  Modify -> LogFile Write
+	void	SetLogMode(BOOL bMode);
+	BOOL	GetLogMode();
+	void	SetLogFilePath(CString strLogFilePath);
+	CString GetLogFilePath();
+
+protected:
+	HKEY		m_hKey;
+	CString		m_strKey;
+	
+/*	BOOL	DeleteKey(HKEY hKey, LPCTSTR lpKey);
+	
+	//////////////////////////////////////////////////////////////////////////
+	// 烙狼 荤侩 啊瓷 窃荐.
+	BOOL	WriteString(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, LPCTSTR lpData);
+	BOOL	WriteDouble(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, double dData);
+	BOOL	WriteInt(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nData);
+	BOOL	ReadString(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, LPTSTR lpRet, DWORD nSize);
+	BOOL	ReadDouble(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, double dDefault, double& dValue);
+	BOOL	ReadInt(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nDefault, int& nValue);
+	
+	BOOL	WriteString(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, LPCTSTR lpData);
+	BOOL	WriteDouble(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, double dData);
+	BOOL	WriteInt(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, UINT nData);
+	BOOL	ReadString(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, LPTSTR lpRet, DWORD nSize);
+	BOOL	ReadDouble(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, double dDefault, double& dValue);
+	BOOL	ReadInt(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, int nDefault, int& nValue);
+	
+	BOOL	DeleteValue(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValueName);
+	BOOL	DeleteValue(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValueName, int nIdx);
+*/
+	//////////////////////////////////////////////////////////////////////////
+};
+
+#endif // !defined(AFX_REGISTERY_H__BFF1B539_B69C_46E1_8575_A595F5AC4D29__INCLUDED_)
diff --git a/Common_Class/ConfigFileManager/IniManager.cpp b/Common_Class/ConfigFileManager/IniManager.cpp
new file mode 100644
index 0000000..bf0c723
--- /dev/null
+++ b/Common_Class/ConfigFileManager/IniManager.cpp
@@ -0,0 +1,484 @@
+// IniManager.cpp: implementation of the CIniManager class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "IniManager.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CIniManager::CIniManager()
+{
+	m_strApp.Empty();
+	m_strFileName.Empty();
+}
+
+CIniManager::~CIniManager()
+{
+
+}
+
+int CIniManager::ReadDataStringA(LPCSTR App, LPCSTR  Key, LPCSTR Default, char* Data, DWORD size, LPCSTR filename)
+{
+	DWORD MAXSIZE = 255;
+	DWORD ReturnSize;
+	char szGetStringValue[255] = {0, };
+
+//	ClearBuffer(szGetStringValue, MAXSIZE);
+//	ClearBuffer(Data, size);
+
+
+	ReturnSize = GetPrivateProfileStringA(App, Key, Default, szGetStringValue, size, filename);
+	
+	if((ReturnSize > MAXSIZE) ||  (ReturnSize <= 0))  return 1;
+	
+	memcpy(Data, szGetStringValue, size);
+	
+	return 0;
+}
+
+int CIniManager::WriteDataStringA(LPCSTR App, LPCSTR  Key, LPCSTR Data, LPCSTR filename)
+{
+	LPCSTR iniFile = filename;
+	
+	if(WritePrivateProfileStringA(App,Key,Data,iniFile) == 0)
+		return 1;
+	
+	return 0;
+}
+
+
+int CIniManager::ReadDataStringW(LPCWSTR lpAppName, LPCWSTR  lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName)
+{
+	DWORD ReturnSize;
+	WCHAR  wchGetStringValue[255] = {0, };
+	
+	//	ClearBuffer(lpGetStringValue, MAXSIZE);
+	//	ClearBuffer(lpReturnedString, nSize);
+	
+	//GetPrivateProfileStringW(
+	//	__in_opt LPCWSTR lpAppName,
+	//	__in_opt LPCWSTR lpKeyName,
+	//	__in_opt LPCWSTR lpDefault,
+	//	__out_ecount_part_opt(nSize, return + 1) LPWSTR lpReturnedString,
+	//	__in     DWORD nSize,
+	//	__in_opt LPCWSTR lpFileName
+	//	);
+	
+	ReturnSize = GetPrivateProfileStringW(lpAppName, lpKeyName, lpDefault, wchGetStringValue, nSize, lpFileName);
+	
+	if((ReturnSize > nSize) ||  (ReturnSize <= 0))  return 1;
+	
+	memcpy(lpReturnedString, wchGetStringValue, nSize*sizeof(WCHAR));
+	
+	return 0;
+}
+
+int CIniManager::WriteDataStringW(LPCWSTR lpAppName, LPCWSTR  lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName)
+{
+	//WritePrivateProfileStringW(
+	//	__in_opt LPCWSTR lpAppName,
+	//	__in_opt LPCWSTR lpKeyName,
+	//	__in_opt LPCWSTR lpString,
+	//	__in_opt LPCWSTR lpFileName
+	//	);
+	
+	if(WritePrivateProfileStringW(lpAppName, lpKeyName, lpString, lpFileName) == 0)
+		return 1;
+	
+	return 0;
+}
+
+int CIniManager::StringToInteger(LPCTSTR strValue)
+{
+	return _ttoi(strValue);
+}
+
+double CIniManager::StringToDouble(LPCTSTR strValue)
+{
+	return _tstof(strValue);
+}
+
+long CIniManager::StringToLong(LPCTSTR strValue)
+{
+	return _ttol(strValue);
+}
+
+int CIniManager::GetItemValue( CString strName, int& nValue, int nDefault )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	int		nMaxLength = 255;
+	TCHAR	wchTmpBuf[255] = {0, };
+
+	CString strDefault;
+	
+	strDefault.Format(_T("%d"), nDefault);
+	
+	ReadDataString(m_strApp, strName, strDefault, wchTmpBuf, nMaxLength, m_strFileName);
+
+	nValue = StringToInteger(wchTmpBuf);
+
+	strDefault.Empty();
+	return TRUE;
+}
+
+int CIniManager::GetItemValue( CString strName, unsigned short& usValue, unsigned short usDefault )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	int		nMaxLength = 255;
+	TCHAR	wchTmpBuf[255] = {0, };
+
+	CString strDefault;
+	
+	strDefault.Format(_T("%d"), usDefault);
+	
+	ReadDataString(m_strApp, strName, strDefault, wchTmpBuf, nMaxLength, m_strFileName);
+
+	usValue = static_cast<unsigned short>(StringToInteger(wchTmpBuf));
+
+	strDefault.Empty();
+	return TRUE;
+}
+
+int CIniManager::GetItemValue( CString strName, double& dValue, double dDefault )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	int		nMaxLength = 255;
+	TCHAR	wchTmpBuf[255] = {0, };
+
+	CString strDefault;
+	
+	strDefault.Format(_T("%d"), dDefault);
+	
+	ReadDataString(m_strApp, strName, strDefault, wchTmpBuf, nMaxLength, m_strFileName);
+
+	dValue = StringToDouble(wchTmpBuf);
+
+	strDefault.Empty();
+	return TRUE;
+}
+
+int CIniManager::GetItemValue( CString strName, CString& strValue, CString strDefault )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	int		nMaxLength = 255;
+	TCHAR	wchTmpBuf[255] = {0, };
+	
+	ReadDataString(m_strApp, strName, strDefault, wchTmpBuf, nMaxLength, m_strFileName);
+
+	strValue = wchTmpBuf;
+
+	return TRUE;
+}
+
+int CIniManager::GetItemValue( int nIndex, CString strName, int& nValue, int nDefault /*= 0*/ )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	int		nMaxLength = 255;
+	TCHAR	wchTmpBuf[255] = {0, };
+
+	CString strDefault, strKeyEx;
+	
+	strDefault.Format(_T("%d"), nDefault);
+	strKeyEx.Format(_T("%s_%d"), strName, nIndex);
+	
+	ReadDataString(m_strApp, strKeyEx, strDefault, wchTmpBuf, nMaxLength, m_strFileName);
+
+	nValue = StringToInteger(wchTmpBuf);
+
+
+	strDefault.Empty();
+	strKeyEx.Empty();
+
+	return TRUE;
+}
+
+int CIniManager::GetItemValue( int nIndex, CString strName, unsigned short& usValue, unsigned short usDefault /*= 0*/ )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	int		nMaxLength = 255;
+	TCHAR	wchTmpBuf[255] = {0, };
+
+	CString strDefault, strKeyEx;
+	
+	strDefault.Format(_T("%d"), usDefault);
+	strKeyEx.Format(_T("%s_%d"), strName, nIndex);
+	
+	ReadDataString(m_strApp, strKeyEx, strDefault, wchTmpBuf, nMaxLength, m_strFileName);
+
+	usValue = StringToInteger(wchTmpBuf);
+
+	strDefault.Empty();
+	strKeyEx.Empty();
+	return TRUE;
+}
+
+int CIniManager::GetItemValue( int nIndex, CString strName, double& dValue, double dDefault /*= 0*/ )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	int		nMaxLength = 255;
+	TCHAR	wchTmpBuf[255] = {0, };
+
+	CString strDefault, strKeyEx;
+	
+	strDefault.Format(_T("%f"), dDefault);
+	strKeyEx.Format(_T("%s_%d"), strName, nIndex);
+	
+	ReadDataString(m_strApp, strKeyEx, strDefault, wchTmpBuf, nMaxLength, m_strFileName);
+
+	dValue = StringToDouble(wchTmpBuf);
+
+	strDefault.Empty();
+	strKeyEx.Empty();
+
+	return TRUE;
+}
+
+int CIniManager::GetItemValue( int nIndex, CString strName, CString& strValue, CString strDefault /*= 0*/ )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	int		nMaxLength = 255;
+	TCHAR	wchTmpBuf[255] = {0, };
+
+	CString strKeyEx;
+	
+	strKeyEx.Format(_T("%s_%d"), strName, nIndex);
+	
+	ReadDataString(m_strApp, strKeyEx, strDefault, wchTmpBuf, nMaxLength, m_strFileName);
+
+	strValue = wchTmpBuf;
+
+	strKeyEx.Empty();
+	return TRUE;
+}
+
+BOOL CIniManager::SetItemValue( CString strName, int& nValue )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	CString strTmpBuff;
+	
+	strTmpBuff.Format(_T("%d"), nValue);
+	
+	WriteDataString(m_strApp, strName,(LPCTSTR)strTmpBuff, m_strFileName);
+
+	strTmpBuff.Empty();
+	return TRUE;
+}
+
+BOOL CIniManager::SetItemValue( CString strName, unsigned short &usValue )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	CString strTmpBuff;
+	
+	strTmpBuff.Format(_T("%d"), usValue);
+
+	WriteDataString(m_strApp, strName, (LPCTSTR)strTmpBuff, m_strFileName);
+
+	strTmpBuff.Empty();
+
+	return TRUE;
+}
+
+BOOL CIniManager::SetItemValue( CString strName, double& dValue )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	CString strTmpBuff;
+	
+	strTmpBuff.Format(_T("%f"), dValue);
+	
+	WriteDataString(m_strApp, strName, (LPCTSTR)strTmpBuff, m_strFileName);
+
+	strTmpBuff.Empty();
+
+	return TRUE;
+}
+
+BOOL CIniManager::SetItemValue( CString strName, CString& strValue )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	CString strTmpBuff;
+	
+	strTmpBuff.Format(_T("%s"), strValue);
+	
+	WriteDataString(m_strApp, strName, (LPCTSTR)strTmpBuff, m_strFileName);
+
+	strTmpBuff.Empty();
+
+	return TRUE;
+}
+
+BOOL CIniManager::SetItemValue( int nIndex, CString strName, int& nValue )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	CString strTmpBuff, strKeyEx;
+	
+	strTmpBuff.Format(_T("%d"), nValue);
+	strKeyEx.Format(_T("%s_%d"), strName, nIndex);
+	
+	WriteDataString(m_strApp, strKeyEx,(LPCTSTR)strTmpBuff, m_strFileName);
+
+	strTmpBuff.Empty();
+	strKeyEx.Empty();
+
+	return TRUE;
+}
+
+BOOL CIniManager::SetItemValue( int nIndex, CString strName, unsigned short &usValue )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	CString strTmpBuff, strKeyEx;
+	
+	strTmpBuff.Format(_T("%d"), usValue);
+	strKeyEx.Format(_T("%s_%d"), strName, nIndex);
+	
+	WriteDataString(m_strApp, strKeyEx, (LPCTSTR)strTmpBuff, m_strFileName);
+
+	strTmpBuff.Empty();
+	strKeyEx.Empty();
+	return TRUE;
+}
+
+BOOL CIniManager::SetItemValue( int nIndex, CString strName, double& dValue )
+{
+	CString strTmpBuff, strKeyEx;
+	
+	strTmpBuff.Format(_T("%f"), dValue);
+	strKeyEx.Format(_T("%s_%d"), strName, nIndex);
+	
+	WriteDataString(m_strApp, strKeyEx, (LPCTSTR)strTmpBuff, m_strFileName);
+
+	strTmpBuff.Empty();
+	strKeyEx.Empty();
+
+	return TRUE;
+}
+
+BOOL CIniManager::SetItemValue( int nIndex, CString strName, CString& strValue )
+{
+	if(!CheckHeader() || !CheckFileName()) return FALSE;
+
+	CString strTmpBuff, strKeyEx;
+	
+	strTmpBuff.Format(_T("%s"), strValue);
+	strKeyEx.Format(_T("%s_%d"), strName, nIndex);
+	
+	WriteDataString(m_strApp, strKeyEx, (LPCTSTR)strTmpBuff, m_strFileName);
+
+	strTmpBuff.Empty();
+	strKeyEx.Empty();
+
+	return TRUE;
+}
+/*!
+ * \brief
+ * 按眉 檬扁拳 窃荐(颇老 肺靛 -> 皋葛府 利犁)
+ * 
+ * \param hKey
+ * 冀记 蔼栏肺 荤侩等促.
+ * 
+ * \param strKey
+ * 荤侩登瘤 臼绰促.
+ * 
+ * \param strFilename
+ * 颇老 涝免仿 且 版快 颇老 菩胶
+ * 
+ * \returns
+ * 己傍 : TRUE \n
+ * 角菩 : FALSE
+ * 
+ * 
+ * INI 屈侥甫 捞侩茄 颇老 涝免仿栏肺 颇老阑 凯绢辑 葛电 单捞磐甫 CObList肺 包府茄促.\n
+ */
+BOOL CIniManager::Initialize(HKEY hKey, CString strKey, CString strFilename)
+{
+	m_strApp = strKey;	
+	m_strFileName = strFilename;
+
+	return TRUE;
+}
+
+BOOL CIniManager::CheckHeader()
+{
+	if(m_strApp.IsEmpty()) return FALSE;
+	
+	return TRUE;
+}
+
+BOOL CIniManager::CheckFileName()
+{
+	if(m_strFileName.IsEmpty()) return FALSE;
+	
+	return TRUE;
+}
+
+
+BOOL CIniManager::RemoveAllItem()
+{
+		return TRUE;
+}
+
+BOOL CIniManager::RemoveItem(CString strName)
+{
+	return TRUE;
+}
+
+BOOL CIniManager::RemoveItem(int nIdx, CString strName)
+{
+	return FALSE;
+}
+
+BOOL CIniManager::WriteToFile()
+{
+	return FALSE;
+}
+
+BOOL CIniManager::GetRewriteMode()
+{
+	return FALSE;
+}
+
+void CIniManager::SetLogMode( BOOL bMode )
+{
+	return;
+}
+void CIniManager::SetRewriteMode( BOOL bRewrite )
+{
+	return;
+}
+
+BOOL CIniManager::GetLogMode()
+{
+	return FALSE;	
+}
+
+void CIniManager::SetLogFilePath( CString strLogFilePath )
+{
+	return;
+}
+
+CString CIniManager::GetLogFilePath()
+{
+	return _T("");	
+}
\ No newline at end of file
diff --git a/Common_Class/ConfigFileManager/ReadMe.txt b/Common_Class/ConfigFileManager/ReadMe.txt
new file mode 100644
index 0000000..e4b795b
--- /dev/null
+++ b/Common_Class/ConfigFileManager/ReadMe.txt
@@ -0,0 +1,57 @@
+========================================================================
+    MICROSOFT FOUNDATION CLASS LIBRARY : ConfigFileManager Project Overview
+========================================================================
+
+
+AppWizard has created this ConfigFileManager DLL for you.  This DLL not only
+demonstrates the basics of using the Microsoft Foundation classes but
+is also a starting point for writing your DLL.
+
+This file contains a summary of what you will find in each of the files that
+make up your ConfigFileManager DLL.
+
+ConfigFileManager.vcproj
+    This is the main project file for VC++ projects generated using an Application Wizard.
+    It contains information about the version of Visual C++ that generated the file, and
+    information about the platforms, configurations, and project features selected with the
+    Application Wizard.
+
+ConfigFileManager.cpp
+    This is the main DLL source file that contains the definition of
+    DllMain().
+
+ConfigFileManager.rc
+    This is a listing of all of the Microsoft Windows resources that the
+    program uses.  It includes the icons, bitmaps, and cursors that are stored
+    in the RES subdirectory.  This file can be directly edited in Microsoft
+    Visual C++.
+
+res\ConfigFileManager.rc2
+    This file contains resources that are not edited by Microsoft
+    Visual C++.  You should place all resources not editable by
+    the resource editor in this file.
+
+ConfigFileManager.def
+    This file contains information about the DLL that must be
+    provided to run with Microsoft Windows.  It defines parameters
+    such as the name and description of the DLL.  It also exports
+    functions from the DLL.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named ConfigFileManager.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+    This is the standard header file, which defines new resource IDs.
+    Microsoft Visual C++ reads and updates this file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/ConfigFileManager/Registery.cpp b/Common_Class/ConfigFileManager/Registery.cpp
new file mode 100644
index 0000000..9640a76
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Registery.cpp
@@ -0,0 +1,692 @@
+// HMRegistery1.cpp: implementation of the CRegistery class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "Registery.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CRegistery::CRegistery()
+{
+	m_hKey		= NULL;
+	m_strKey	= _T("");
+}
+
+CRegistery::~CRegistery()
+{
+
+}
+/*!
+ * \brief
+ * 按眉 檬扁拳 窃荐(颇老 肺靛 -> 皋葛府 利犁)
+ * 
+ * \param hKey
+ * 皋牢 虐
+ * 
+ * \param strKey
+ * 辑宏 虐
+ * 
+ * \param strFilename
+ * 荤侩窍瘤 臼澜
+ * 
+ * \returns
+ * 己傍 : TRUE \n
+ * 角菩 : FALSE
+ * 
+ * 
+ */
+BOOL	CRegistery::Initialize(HKEY hKey, CString strKey, CString strFilename)
+{ 
+	m_hKey = hKey;	
+	m_strKey = strKey; 
+
+	return TRUE; 
+}
+
+//////////////////////////////////////////////////////////////////////////
+// 
+BOOL CRegistery::SetItemValue(CString strName, CString& strValue)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+
+	CStringA strValueA = (CStringA)strValue;
+	char str[255] = {0, };
+	sprintf_s(str,255, "%s", strValueA);
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+	{
+		strValueA.Empty();
+		return FALSE;
+	}
+
+	if (RegSetValueEx(key, (LPCTSTR)strName, 0, REG_SZ, (LPBYTE)str, DWORD(strlen(str) + 1) ) != ERROR_SUCCESS)
+	{
+		strValueA.Empty();
+		return FALSE;
+	}
+
+	RegCloseKey(key);
+
+	strValueA.Empty();
+	return TRUE;
+}
+
+BOOL CRegistery::SetItemValue(CString strName, double& dData)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	char str[255] = {0, };
+	sprintf_s(str,255, "%10.10f", dData);
+
+	if (RegSetValueEx(key, (LPCTSTR)strName, 0, REG_SZ, (LPBYTE)str, DWORD(strlen(str) + 1)) != ERROR_SUCCESS)
+		return FALSE;
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+BOOL CRegistery::SetItemValue(CString strName, int& nData)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+	UINT unData;
+
+	unData = static_cast<UINT>(nData);
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	if (RegSetValueEx(key, (LPCTSTR)strName, 0, REG_DWORD, (LPBYTE)&unData, sizeof(UINT)) != ERROR_SUCCESS)
+	{
+		return FALSE;
+	}
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+BOOL CRegistery::SetItemValue(CString strName, unsigned short &snData)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+	UINT unData;
+
+	unData = static_cast<UINT>(snData);
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	if (RegSetValueEx(key, (LPCTSTR)strName, 0, REG_DWORD, (LPBYTE)&unData, sizeof(UINT)) != ERROR_SUCCESS)
+	{
+		return FALSE;
+	}
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+BOOL CRegistery::SetItemValue(int nIdx, CString strName, CString& strValue)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = SetItemValue(strFullName, strValue);
+	strFullName.Empty();
+	return bRet;
+}
+
+BOOL CRegistery::SetItemValue(int nIdx, CString strName, double& dData)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = SetItemValue(strFullName, dData);
+	strFullName.Empty();
+	return bRet;
+}
+
+BOOL CRegistery::SetItemValue(int nIdx, CString strName, int& nData)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = SetItemValue(strFullName, nData);
+	strFullName.Empty();
+	return bRet;
+}
+
+BOOL CRegistery::SetItemValue(int nIdx, CString strName, unsigned short &usData)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = SetItemValue(strFullName, usData);
+	strFullName.Empty();
+	return bRet;
+}
+
+
+
+int CRegistery::GetItemValue(CString strName, CString& strValue, CString strDefault)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	char strTemp[1024] = {0, };
+	DWORD nSize = 1023;
+	HKEY key;
+	DWORD dwDisp;
+	DWORD Size;
+
+	strValue = strDefault;
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	Size = nSize;
+
+	if (RegQueryValueEx(key, (LPCTSTR)strName, 0, NULL, (LPBYTE)strTemp, &Size) != ERROR_SUCCESS)
+		return FALSE;
+
+
+	RegCloseKey(key);
+
+	strValue = strTemp;
+		
+	return TRUE;
+}
+
+int CRegistery::GetItemValue(CString strName, double& dValue, double dDefault)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+	DWORD Size;
+
+	dValue = dDefault;
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	Size = 255;
+	char str[255] = {0, };
+	if (RegQueryValueEx(key, (LPCTSTR)strName, 0, NULL, (LPBYTE)str, &Size) != ERROR_SUCCESS)
+		return FALSE;
+
+	RegCloseKey(key);
+
+	char* end;
+	dValue = strtod(str, &end);
+
+	return TRUE;
+}
+
+int CRegistery::GetItemValue(CString strName, int& nValue, int nDefault)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+	UINT Result;
+	DWORD Size;
+
+	nValue = nDefault;
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	Size = sizeof(LONG);
+
+	if (RegQueryValueEx(key, (LPCTSTR)strName, 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS)
+		return FALSE;
+
+	nValue = Result;
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+int CRegistery::GetItemValue(CString strName, unsigned short& nValue, unsigned short nDefault)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+	UINT Result;
+	DWORD Size;
+
+	nValue = nDefault;
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	Size = sizeof(LONG);
+
+	if (RegQueryValueEx(key, (LPCTSTR)strName, 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS)
+		return FALSE;
+
+	nValue = Result;
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+int CRegistery::GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = GetItemValue(strFullName, strValue, strDefault);
+	strFullName.Empty();
+	return bRet;
+}
+
+int CRegistery::GetItemValue(int nIdx, CString strName, double& dValue, double dDefault)
+{
+	double dResult;
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL dRet = GetItemValue(strFullName, dResult, dDefault);
+
+	dValue = dResult;
+	strFullName.Empty();
+	return dRet;
+}
+
+int CRegistery::GetItemValue(int nIdx, CString strName, int& nValue, int nDefault)
+{
+	int nResult;
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = GetItemValue(strFullName, nResult, nDefault);
+
+	nValue =  nResult;
+	strFullName.Empty();
+	return bRet;
+}
+
+int CRegistery::GetItemValue(int nIdx, CString strName, unsigned short& nValue, unsigned short nDefault)
+{
+	int nResult;
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = GetItemValue(strFullName, nResult, nDefault);
+	
+	nValue =  nResult;
+	strFullName.Empty();
+	return bRet;
+}
+//////////////////////////////////////////////////////////////////////////
+// 瘤快扁
+BOOL CRegistery::RemoveAllItem()
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	if (!RegDeleteKey(m_hKey, (LPCTSTR)m_strKey) != ERROR_SUCCESS)
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CRegistery::RemoveItem(CString strNameName)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+
+	if (RegCreateKeyEx(m_hKey, (LPCTSTR)m_strKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_SET_VALUE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	if (RegDeleteValue(key, (LPCTSTR)strNameName) != ERROR_SUCCESS)
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CRegistery::RemoveItem(int nIdx, CString strName)
+{
+	CString strFullName;
+	strFullName.Format(_T("%s_%d"), strName, nIdx);
+
+	BOOL bRet = RemoveItem(strFullName);
+	strFullName.Empty();
+	return bRet;
+}
+
+BOOL CRegistery::WriteToFile()
+{
+	return FALSE;
+}
+
+BOOL CRegistery::GetRewriteMode()
+{
+	return FALSE;
+}
+
+void CRegistery::SetLogMode( BOOL bMode )
+{
+	return;
+}
+void CRegistery::SetRewriteMode( BOOL bRewrite )
+{
+	return;
+}
+
+BOOL CRegistery::GetLogMode()
+{
+	return FALSE;	
+}
+
+void CRegistery::SetLogFilePath( CString strLogFilePath )
+{
+	return;
+}
+
+CString CRegistery::GetLogFilePath()
+{
+	return _T("");	
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* 镜 鞘夸啊 乐阑鳖? eugene
+BOOL CRegistery::ReadInt(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nDefault, int& nValue)
+{
+	HKEY key;
+	DWORD dwDisp;
+	UINT Result;
+	DWORD Size;
+
+	if (RegCreateKeyEx(hKey, lpKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	Size = sizeof(LONG);
+
+	if (RegQueryValueEx(key, lpValue, 0, NULL, (LPBYTE)&Result, &Size) != ERROR_SUCCESS)
+		Result = nDefault;
+		nValue = Result;
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+BOOL CRegistery::ReadDouble(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, double dDefault, double& dValue)
+{
+	HKEY key;
+	DWORD dwDisp;
+	DWORD Size;
+	dValue = dDefault;
+
+	if (RegCreateKeyEx(hKey, lpKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	Size = 255;
+
+	char lpRet[255] = {0, };
+	if (RegQueryValueEx(key, lpValue, 0, NULL, (LPBYTE)lpRet, &Size) != ERROR_SUCCESS)
+	{
+		return FALSE;
+	}
+	RegCloseKey(key);
+
+	char* end;
+	dValue = strtod(lpRet, &end);
+
+	return TRUE;
+}
+
+BOOL CRegistery::ReadString(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, LPTSTR lpRet, DWORD nSize)
+{
+	HKEY key;
+	DWORD dwDisp;
+	DWORD Size;
+
+	if (RegCreateKeyEx(hKey, lpKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	Size = nSize;
+
+	if (RegQueryValueEx(key, lpValue, 0, NULL, (LPBYTE)lpRet, &Size) != ERROR_SUCCESS)
+	{
+//		strcpy(lpRet, lpDefault);
+		return FALSE;
+	}
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+BOOL CRegistery::WriteInt(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nData)
+{
+	HKEY key;
+	DWORD dwDisp;
+
+	if (RegCreateKeyEx(hKey, lpKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	if (RegSetValueEx(key, lpValue, 0, REG_DWORD, (LPBYTE)&nData, sizeof(UINT)) != ERROR_SUCCESS)
+	{
+		return FALSE;
+	}
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+BOOL CRegistery::WriteDouble(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, double dData)
+{
+	HKEY key;
+	DWORD dwDisp;
+
+	char str[255] = {0, };
+	sprintf(str, "%10.10f", dData);
+	if (RegCreateKeyEx(hKey, lpKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	if (RegSetValueEx(key, lpValue, 0, REG_SZ, (LPBYTE)str, strlen(str) + 1) != ERROR_SUCCESS)
+		return FALSE;
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+BOOL CRegistery::WriteString(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, LPCTSTR lpData)
+{
+	HKEY key;
+	DWORD dwDisp;
+
+	if (RegCreateKeyEx(hKey, lpKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	if (RegSetValueEx(key, lpValue, 0, REG_SZ, (LPBYTE)lpData, strlen(lpData) + 1) != ERROR_SUCCESS)
+		return FALSE;
+
+	RegCloseKey(key);
+
+	return TRUE;
+}
+
+
+BOOL CRegistery::DeleteKey(HKEY hKey, LPCTSTR lpKey)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	if (!RegDeleteKey(hKey, lpKey) != ERROR_SUCCESS)
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CRegistery::DeleteValue(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValueName)
+{
+	if (m_hKey == NULL || m_strKey.IsEmpty())
+		return FALSE;
+
+	HKEY key;
+	DWORD dwDisp;
+
+	if (RegCreateKeyEx(hKey, lpKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_SET_VALUE, NULL, &key, &dwDisp) != ERROR_SUCCESS)
+		return FALSE;
+
+	if (RegDeleteValue(key, lpValueName) != ERROR_SUCCESS)
+		return FALSE;
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Index肺 累诀窍扁.
+BOOL CRegistery::WriteString(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, LPCTSTR lpData)
+{
+	char* lpName = new char[strlen(lpValue) + 10];
+	ZeroMemory(lpName, strlen(lpValue) + 10);
+	sprintf(lpName, "%s_%d", lpValue, nIdx);
+
+	BOOL bRet = WriteString(hKey, lpKey, lpName, lpData);
+	delete [] lpName;
+
+	return bRet;
+}
+
+BOOL CRegistery::WriteDouble(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, double dData)
+{
+	char* lpName = new char[strlen(lpValue) + 10];
+	ZeroMemory(lpName, strlen(lpValue) + 10);
+	sprintf(lpName, "%s_%d", lpValue, nIdx);
+
+	BOOL bRet = WriteDouble(hKey, lpKey, lpName, dData);
+	delete [] lpName;
+
+	return bRet;
+}
+
+BOOL CRegistery::WriteInt(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, UINT nData)
+{
+	char* lpName = new char[strlen(lpValue) + 10];
+	ZeroMemory(lpName, strlen(lpValue) + 10);
+	sprintf(lpName, "%s_%d", lpValue, nIdx);
+
+	BOOL bRet = WriteInt(hKey, lpKey, lpName, nData);
+	delete [] lpName;
+
+	return bRet;
+}
+
+BOOL CRegistery::ReadString(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, LPTSTR lpRet, DWORD nSize)
+{
+	char* lpName = new char[strlen(lpValue) + 10];
+	ZeroMemory(lpName, strlen(lpValue) + 10);
+	sprintf(lpName, "%s_%d", lpValue, nIdx);
+
+	BOOL bRet = ReadString(hKey, lpKey, lpName, lpRet, nSize);
+	delete [] lpName;
+
+	return bRet;
+}
+
+BOOL CRegistery::ReadDouble(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, double dDefault, double& dValue)
+{
+	double dResult;	
+	char* lpName = new char[strlen(lpValue) + 10];
+	ZeroMemory(lpName, strlen(lpValue) + 10);
+	sprintf(lpName, "%s_%d", lpValue, nIdx);
+
+	BOOL dRet = ReadDouble(hKey, lpKey, lpName, dDefault, dResult);
+	dValue = dResult;
+	
+	delete [] lpName;
+
+	return dRet;
+}
+
+BOOL CRegistery::ReadInt(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValue, int nIdx, int nDefault, int& nValue)
+{
+	int nResult;
+	char* lpName = new char[strlen(lpValue) + 10];
+	ZeroMemory(lpName, strlen(lpValue) + 10);
+	sprintf(lpName, "%s_%d", lpValue, nIdx);
+
+	ReadInt(hKey, lpKey, lpName, nDefault, nResult);
+	nValue = nResult;
+	delete [] lpName;
+	
+	return TRUE;
+}
+
+BOOL CRegistery::DeleteValue(HKEY hKey, LPCTSTR lpKey, LPCTSTR lpValueName, int nIdx)
+{
+	char* lpName = new char[strlen(lpValueName) + 10];
+	ZeroMemory(lpName, strlen(lpValueName) + 10);
+	sprintf(lpName, "%s_%d", lpValueName, nIdx);
+
+	BOOL bRet = DeleteValue(hKey, lpKey, lpName);
+
+	delete [] lpName;
+
+	return bRet;
+}
+
+*/
\ No newline at end of file
diff --git a/Common_Class/ConfigFileManager/Resource.h b/Common_Class/ConfigFileManager/Resource.h
new file mode 100644
index 0000000..ece22ed
--- /dev/null
+++ b/Common_Class/ConfigFileManager/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by ConfigFileManager.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	3000
+#define _APS_NEXT_CONTROL_VALUE		3000
+#define _APS_NEXT_SYMED_VALUE		3000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/ConfigFileManager/dllmain.cpp b/Common_Class/ConfigFileManager/dllmain.cpp
new file mode 100644
index 0000000..501caf4
--- /dev/null
+++ b/Common_Class/ConfigFileManager/dllmain.cpp
@@ -0,0 +1,51 @@
+// dllmain.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include <afxwin.h>
+#include <afxdllx.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+static AFX_EXTENSION_MODULE ConfigFileManagerDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+	// Remove this if you use lpReserved
+	UNREFERENCED_PARAMETER(lpReserved);
+
+	if (dwReason == DLL_PROCESS_ATTACH)
+	{
+		TRACE0("ConfigFileManager.DLL Initializing!\n");
+		
+		// Extension DLL one-time initialization
+		if (!AfxInitExtensionModule(ConfigFileManagerDLL, hInstance))
+			return 0;
+
+		// Insert this DLL into the resource chain
+		// NOTE: If this Extension DLL is being implicitly linked to by
+		//  an MFC Regular DLL (such as an ActiveX Control)
+		//  instead of an MFC application, then you will want to
+		//  remove this line from DllMain and put it in a separate
+		//  function exported from this Extension DLL.  The Regular DLL
+		//  that uses this Extension DLL should then explicitly call that
+		//  function to initialize this Extension DLL.  Otherwise,
+		//  the CDynLinkLibrary object will not be attached to the
+		//  Regular DLL's resource chain, and serious problems will
+		//  result.
+
+		new CDynLinkLibrary(ConfigFileManagerDLL);
+
+	}
+	else if (dwReason == DLL_PROCESS_DETACH)
+	{
+		TRACE0("ConfigFileManager.DLL Terminating!\n");
+
+		// Terminate the library before destructors are called
+		AfxTermExtensionModule(ConfigFileManagerDLL);
+	}
+	return 1;   // ok
+}
diff --git a/Common_Class/ConfigFileManager/res/ConfigFileManager.rc2 b/Common_Class/ConfigFileManager/res/ConfigFileManager.rc2
new file mode 100644
index 0000000..8f84b49
--- /dev/null
+++ b/Common_Class/ConfigFileManager/res/ConfigFileManager.rc2
@@ -0,0 +1,13 @@
+//
+// ConfigFileManager.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/ConfigFileManager/stdafx.cpp b/Common_Class/ConfigFileManager/stdafx.cpp
new file mode 100644
index 0000000..5f7caea
--- /dev/null
+++ b/Common_Class/ConfigFileManager/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : source file that includes just the standard includes
+// ConfigFileManager.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/ConfigFileManager/stdafx.h b/Common_Class/ConfigFileManager/stdafx.h
new file mode 100644
index 0000000..d3d296b
--- /dev/null
+++ b/Common_Class/ConfigFileManager/stdafx.h
@@ -0,0 +1,39 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit
+
+#include <afxwin.h>         // MFC core and standard components
+#include <afxext.h>         // MFC extensions
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE classes
+#include <afxodlgs.h>       // MFC OLE dialog classes
+#include <afxdisp.h>        // MFC Automation classes
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC database classes
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO database classes
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC support for Internet Explorer 4 Common Controls
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
diff --git a/Common_Class/ConfigFileManager/targetver.h b/Common_Class/ConfigFileManager/targetver.h
new file mode 100644
index 0000000..11730d5
--- /dev/null
+++ b/Common_Class/ConfigFileManager/targetver.h
@@ -0,0 +1,26 @@
+
+#pragma once
+
+// The following macros define the minimum required platform.  The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run 
+// your application.  The macros work by enabling all features available on platform versions up to and 
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER                          // Specifies that the minimum required platform is Windows Vista.
+#define WINVER 0x0600           // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS          // Specifies that the minimum required platform is Windows 98.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE                       // Specifies that the minimum required platform is Internet Explorer 7.0.
+#define _WIN32_IE 0x0700        // Change this to the appropriate value to target other versions of IE.
+#endif
+
diff --git a/Common_Class/EdgeInspect/BLOB_Tool.cpp b/Common_Class/EdgeInspect/BLOB_Tool.cpp
new file mode 100644
index 0000000..cb18768
--- /dev/null
+++ b/Common_Class/EdgeInspect/BLOB_Tool.cpp
@@ -0,0 +1,103 @@
+#include "stdafx.h"
+#include "BLOB_Tool.h"
+
+CBlobTool::CBlobTool()
+{
+	
+}
+
+
+CBlobTool::~CBlobTool()
+{
+
+}
+
+bool CBlobTool::BlobAnalysis(BYTE *pImageData, int nWidth, int nHeight, int nStep, ListEdgeBlobData &blobList, int nMergeRange)
+{
+	if (pImageData==NULL) return false;
+
+	int nIndex;
+	int i, j, y, x;
+	ListEdgeBlobData pixelList;
+
+	for (i=0; i<nHeight; i++)
+	{
+		for (j=0; j<nWidth; j++)
+		{
+			nIndex = (i*nStep)+j;
+			if (pImageData[nIndex] == 255)
+			{
+				// push pixel
+				CEdgeBlobData *pPos = new CEdgeBlobData(j, i);
+				pixelList.push_back(pPos);		
+				pImageData[nIndex] = 0;				
+
+				int nPixelCount = 0;
+				int nTotalX = 0;
+				int nTotalY = 0;
+				int	nMaxX, nMaxY;
+				int	nMinX, nMinY;
+
+				nMinX = nMinY = INT_MAX;
+				nMaxX = nMaxY = INT_MIN;
+
+				ListEdgeBlobDataIt it;
+				while (pixelList.size()!=0)
+				{
+					// pop pixel
+					it = pixelList.begin();
+					CEdgeBlobData *pCurPos = *it;
+
+					x = (int)pCurPos->fCenterX;
+					y = (int)pCurPos->fCenterY;
+
+					int nTmpIndex;
+					for (int sy=(-nMergeRange); sy<(nMergeRange+1); sy++)
+					{
+						for (int sx=(-nMergeRange); sx<(nMergeRange+1); sx++)
+						{
+							if (((sx+x) > nWidth-1) || ((sx+x) < 0)) continue;		
+							if (((sy+y) > nHeight-1) || ((sy+y) < 0)) continue;		
+							if ((sx==0 && sy==0) || sx==sy || sx==(-sy)) continue;	
+
+							nTmpIndex = ((y+sy)*nStep)+(x+sx);
+
+							if (pImageData[nTmpIndex] == 255)
+							{
+								// push pixel
+								CEdgeBlobData *pNode1 = new CEdgeBlobData(x+sx, y+sy);
+								pixelList.push_back(pNode1);	
+								pImageData[nTmpIndex] = 0;
+							} // end if	
+						} // end for sx
+					} // end for sy
+
+					// blob info
+					nMinX = (nMinX > x) ? x : nMinX;
+					nMinY = (nMinY > y) ? y : nMinY;
+					nMaxX = (nMaxX < x) ? x : nMaxX;
+					nMaxY = (nMaxY < y) ? y : nMaxY;
+					nTotalX		+= x;
+					nTotalY		+= y;
+					nPixelCount++;
+
+					// delete pixel
+					delete pCurPos;
+					pixelList.erase(it);
+
+				} // end while
+				pixelList.clear();
+
+				// push blob
+				CEdgeBlobData *pBlob = new CEdgeBlobData(nMinX, nMinY, nMaxX, nMaxY);
+				pBlob->fMassCenterX = float(nTotalX) / float(nPixelCount);
+				pBlob->fMassCenterY = float(nTotalY) / float(nPixelCount);
+				pBlob->nPixelCount = nPixelCount;
+				blobList.push_back(pBlob);
+
+			}
+		}
+	}
+
+	return true;
+}
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/ChamferInspect.cpp b/Common_Class/EdgeInspect/ChamferInspect.cpp
new file mode 100644
index 0000000..3f27285
--- /dev/null
+++ b/Common_Class/EdgeInspect/ChamferInspect.cpp
@@ -0,0 +1,4132 @@
+// ChamferInspect.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ChamferInspect.h"
+#include <math.h>
+#include <numeric>
+#include "EdgeFind.h"
+#include "EdgeProc.h"
+#include "BLOB_Tool.h"
+#include "Edge_Log.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#define	PATH_DEFECTFOLDER	_T("D:\\RCutProject_Data\\Defect")
+#define	PATH_DEBUGFOLDER	_T("D:\\Image\\CutArea")
+
+/////////////////////////////////////////////////////////////////////////////
+// CChamferInspect
+
+CChamferInspect::CChamferInspect()
+{		
+	m_dConvResolution = 0.;
+	m_nForeEdgeLine[0] = m_nForeEdgeLine[1] = 0;
+	m_pGlassEdgeLine = NULL;
+	m_nGlassEdgeLineCnt = 0;		
+	m_nSaveIndex = 0;
+	m_pCannyWidthCnt = NULL;
+	m_nDefectCnt = 0;
+		
+	m_DefectBlob = new CChipBlob[MAX_CHIP_DEFECT_COUNT];
+	m_pChipPairBuf = new CChipPair[MAX_CHIP_PAIR_DEFECT_COUNT];
+	m_bMerged = new BOOL[MAX_CHIP_PAIR_DEFECT_COUNT];
+	m_bTemp = new BOOL[MAX_CHIP_PAIR_DEFECT_COUNT];
+	m_lFirstIndex = new int[MAX_CHIP_PAIR_DEFECT_COUNT];
+}
+
+CChamferInspect::~CChamferInspect()
+{	
+	ReleaseBuffer();
+	ResetValue();
+
+	if(m_DefectBlob != NULL)
+		delete[] m_DefectBlob;
+	m_DefectBlob = NULL;
+
+	if(m_pChipPairBuf != NULL)
+		delete[] m_pChipPairBuf;
+	m_pChipPairBuf = NULL;
+
+	if(m_bMerged != NULL)
+		delete[] m_bMerged;
+	m_bMerged = NULL;
+
+	if(m_bTemp != NULL)
+		delete[] m_bTemp;
+	m_bTemp = NULL;
+
+	if(m_lFirstIndex != NULL)
+		delete[] m_lFirstIndex;
+	m_lFirstIndex = NULL;
+}
+
+CChipPair *CChamferInspect::GetPairDefect(int iIndex)
+{
+	if(iIndex < 0 || iIndex >= MAX_CHIP_PAIR_DEFECT_COUNT)
+		return NULL;
+	
+	return &m_pChipPairBuf[iIndex];
+}
+
+BOOL CChamferInspect::InsertPairing(int x, int y, int sub, int threshold, int graySrc, int grayRef,ChipResionType s_RegionType,DefectPosType s_DefectPos,BOOL bEdgeDefect, double dThick)
+{
+	if(GetPairDefectCount() >= MAX_CHIP_PAIR_DEFECT_COUNT)
+	{
+		return FALSE;
+	}
+
+	int				iPiar = GetPairDefectCount();
+	CChipPair		*pPair = GetPairDefect(iPiar);
+
+	if(pPair == NULL)
+		return FALSE;
+
+	pPair->s_DefectPair= CHIPDEFPAIR_PPAIR;
+	if(sub > 0)
+		pPair->s_DefectType= CHIPDEFTYPE_BLACK;
+	else
+		pPair->s_DefectType= CHIPDEFTYPE_WHITE;
+
+	pPair->s_RegionType = s_RegionType;
+	pPair->s_fDefectPeak= (float)abs(sub);
+	pPair->s_DefectPosType = s_DefectPos;
+
+	pPair->s_nDefectX= x;
+	pPair->s_nDefectY= y;
+	pPair->s_nGraySrc= graySrc;
+	pPair->s_nGrayRef= grayRef;
+	pPair->s_dThick = dThick;
+	pPair->s_bCornerChip = bEdgeDefect;
+
+	m_nChipPairIndex++;
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::BlobDefect_Pixel(std::vector<CChipBlob> &vecBlob,int nChipThres,int nMergeDist)
+{
+	if(GetPairDefectCount() <= 0)
+		return TRUE;
+
+	int			i, j;	
+	int			nPair = GetPairDefectCount();
+	int			nBlob = 0;
+
+	// Index 概扁扁.
+	ZeroMemory(m_bMerged, nPair * sizeof(BOOL));
+	ZeroMemory(m_bTemp, nPair * sizeof(BOOL));
+	for (i = 0; i < nPair; i++)
+	{
+		m_lFirstIndex[i] = i;		
+	}
+
+	CChipPair		*pPair,*pPairCom;
+
+	// 牢立 叼棋 赣瘤窍扁.
+	for(i = 0; i < nPair; i++)
+	{
+		pPair = GetPairDefect(i);
+		if(pPair == NULL)
+			continue;
+
+		for (j = i + 1; j < nPair; j++)
+		{
+			if (m_bMerged[j])// || vecPair[i].s_DefectType != vecPair[j].s_DefectType)
+				continue;
+			
+			pPairCom = GetPairDefect(j);
+			if(pPairCom == NULL)
+				continue;
+
+			if (abs(pPairCom->s_nDefectY - pPair->s_nDefectY) > nMergeDist)				// j绰 i焊促 农促.
+				continue;
+
+			if (abs(pPairCom->s_nDefectX - pPair->s_nDefectX) > nMergeDist)
+				continue;
+
+			m_lFirstIndex[j] = m_lFirstIndex[i];
+			m_bMerged[j] = TRUE;
+		}
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	int nStart = 0;
+	BOOL Ret = TRUE;
+
+	// 叼棋甸狼 荐父怒 贸府. - Blobing
+	int nBlobNum = 0;
+	int nDiffGray, nThres=nChipThres;
+	CChipBlob	chipBlob;
+
+	for (i = 0; i < nPair; i++)
+	{
+		pPair = GetPairDefect(i);
+		if(pPair == NULL)
+			continue;
+
+		if (pPair->s_DefectType == CHIPDEFTYPE_DELETE)
+		{			
+			continue;
+		}
+
+		if (!m_bTemp[m_lFirstIndex[i]])	// 贸澜 唱鸥抄 搬窃 贸府.
+		{
+			if (nBlob >= nPair || nBlobNum >= 1000)
+				continue;			
+
+			m_bTemp[m_lFirstIndex[i]] = TRUE;
+
+			chipBlob.Reset();
+			CheckDefectRect(chipBlob, pPair->s_nDefectX, pPair->s_nDefectY);
+
+			chipBlob.SetDefectPair(pPair->s_DefectPair);
+			chipBlob.s_nIndex			= m_lFirstIndex[i];
+			chipBlob.s_nDefectArea++;
+			chipBlob.s_nDefectX		+= pPair->s_nDefectX;
+			chipBlob.s_nDefectY		+= pPair->s_nDefectY;
+			chipBlob.s_DefectType		= pPair->s_DefectType;			//角力 归搬窃篮 1,孺搬窃篮 0
+			chipBlob.s_sThreshold		= nThres;
+			chipBlob.s_RegionType		= pPair->s_RegionType;
+			chipBlob.s_dThick			= pPair->s_dThick;
+			chipBlob.s_bCornerChip		|= pPair->s_bCornerChip;
+			chipBlob.s_DefectJudgeType  = pPair->s_DefectPosType;
+
+			// Gray 备窍扁
+			if (pPair->s_nGraySrc > chipBlob.s_sLevelSrcMax)
+			{
+				chipBlob.s_sLevelSrcMax = pPair->s_nGraySrc;
+				chipBlob.s_xLevelSrcMax = pPair->s_nDefectX;
+				chipBlob.s_yLevelSrcMax = pPair->s_nDefectY;
+			}
+			if (pPair->s_nGraySrc < chipBlob.s_sLevelSrcMin)
+				chipBlob.s_sLevelSrcMin = pPair->s_nGraySrc;
+			chipBlob.s_nLevelSrcSum += pPair->s_nGraySrc;
+
+			if (pPair->s_nGrayRef > chipBlob.s_sLevelRefMax)
+				chipBlob.s_sLevelRefMax = pPair->s_nGrayRef;
+			if (pPair->s_nGrayRef < chipBlob.s_sLevelRefMin)
+				chipBlob.s_sLevelRefMin = pPair->s_nGrayRef;
+			chipBlob.s_nLevelRefSum += pPair->s_nGrayRef;
+
+			nDiffGray = abs(pPair->s_nGraySrc - pPair->s_nGrayRef);
+			if (nDiffGray > chipBlob.s_sLevelDiffMax)
+			{
+				chipBlob.s_sLevelDiffMax = nDiffGray;
+				chipBlob.s_sDefectPeak = abs(chipBlob.s_sLevelDiffMax) - nThres;
+				//chipBlob.s_sDefectPeak = abs(chipBlob.s_sLevelDiffMax / 8) - nThres;
+			}
+			if (nDiffGray < chipBlob.s_sLevelDiffMin)
+				chipBlob.s_sLevelDiffMin = nDiffGray;
+			chipBlob.s_nLevelDiffSum += nDiffGray;
+
+			vecBlob.push_back(chipBlob);
+			nBlob++;
+			nBlobNum++;
+		}
+		else		// 唱吝俊 唱鸥抄 搬窃 贸府.
+		{
+			for(j = nBlob - 1; j >= 0; j--)
+			{
+				if (vecBlob[j].s_nIndex != m_lFirstIndex[i])
+					continue;								
+
+				CheckDefectRect(vecBlob[j], pPair->s_nDefectX, pPair->s_nDefectY);
+
+				if(vecBlob[j].s_DefectJudgeType == INS_DEFECT_CHIP)
+				{
+					if(pPair->s_DefectPosType == INS_DEFECT_CRACK || pPair->s_DefectPosType == INS_DEFECT_BROKEN)
+						vecBlob[j].s_DefectJudgeType = pPair->s_DefectPosType;
+				}
+				else if(vecBlob[j].s_DefectJudgeType == INS_DEFECT_CRACK)
+				{
+					if(pPair->s_DefectPosType == INS_DEFECT_BROKEN)
+						vecBlob[j].s_DefectJudgeType = pPair->s_DefectPosType;
+				}
+
+				vecBlob[j].SetDefectPair(pPair->s_DefectPair);
+				vecBlob[j].s_nDefectArea++;
+				vecBlob[j].s_nDefectX += pPair->s_nDefectX;
+				vecBlob[j].s_nDefectY += pPair->s_nDefectY;
+				vecBlob[j].s_bCornerChip |= pPair->s_bCornerChip;
+				if (nThres > vecBlob[j].s_sThreshold)
+					vecBlob[j].s_sThreshold = nThres;
+				
+				// Gray 备窍扁
+				if (pPair->s_nGraySrc > vecBlob[j].s_sLevelSrcMax)
+				{
+					vecBlob[j].s_sLevelSrcMax = pPair->s_nGraySrc;
+					vecBlob[j].s_xLevelSrcMax = pPair->s_nDefectX;
+					vecBlob[j].s_yLevelSrcMax = pPair->s_nDefectY;
+				}
+				if (pPair->s_nGraySrc < vecBlob[j].s_sLevelSrcMin)
+					vecBlob[j].s_sLevelSrcMin = pPair->s_nGraySrc;
+				vecBlob[j].s_nLevelSrcSum += pPair->s_nGraySrc;
+
+				if (pPair->s_nGrayRef > vecBlob[j].s_sLevelRefMax)
+					vecBlob[j].s_sLevelRefMax = pPair->s_nGrayRef;
+				if (pPair->s_nGrayRef < vecBlob[j].s_sLevelRefMin)
+					vecBlob[j].s_sLevelRefMin = pPair->s_nGrayRef;
+				vecBlob[j].s_nLevelRefSum += pPair->s_nGrayRef;
+
+				nDiffGray = abs(pPair->s_nGraySrc - pPair->s_nGrayRef);
+				if (nDiffGray > vecBlob[j].s_sLevelDiffMax)
+				{
+					vecBlob[j].s_sLevelDiffMax = nDiffGray;
+					vecBlob[j].s_sDefectPeak = abs(vecBlob[j].s_sLevelDiffMax) - nThres;
+					//vecBlob[j].s_sDefectPeak = abs(vecBlob[j].s_sLevelDiffMax / 8) - nThres;
+				}
+				if (nDiffGray < vecBlob[j].s_sLevelDiffMin)
+					vecBlob[j].s_sLevelDiffMin = nDiffGray;
+				vecBlob[j].s_nLevelDiffSum += nDiffGray;
+
+				if(vecBlob[j].s_dThick < pPair->s_dThick)
+					vecBlob[j].s_dThick = pPair->s_dThick;
+
+				break;
+			}
+		}
+	}
+
+	// 谅钎 焊沥.
+	for (i = nStart; i < nBlob; i++)
+	{
+		if (vecBlob[i].s_nDefectArea > 0)
+		{
+			vecBlob[i].s_nDefectX = vecBlob[i].s_nDefectX / vecBlob[i].s_nDefectArea;
+			vecBlob[i].s_nDefectY = vecBlob[i].s_nDefectY / vecBlob[i].s_nDefectArea;
+			vecBlob[i].s_sLevelSrcAvg = vecBlob[i].s_nLevelSrcSum / vecBlob[i].s_nDefectArea;
+			vecBlob[i].s_sLevelRefAvg = vecBlob[i].s_nLevelRefSum / vecBlob[i].s_nDefectArea;
+			vecBlob[i].s_sLevelDiffAvg = vecBlob[i].s_nLevelDiffSum / vecBlob[i].s_nDefectArea;		
+			vecBlob[i].s_nDefectRScale = CalcRScale(vecBlob[i].s_ptVertex);			
+		}
+		else
+			vecBlob[i].s_bRemoved = TRUE;
+	}
+	
+	MergeMix(vecBlob);
+
+	return Ret;
+}
+
+BOOL CChamferInspect::MergeDivision(std::vector<CChipBlob> &vecBlob, int nMergePixel)
+{
+	int i,j;
+
+	//叼棋泛飘肺 赣瘤
+	CChipBlob Blob;
+	CChipBlob BlobNext;
+
+	int nSize = (int)vecBlob.size();
+	for(i=0; i<nSize; i++)
+	{
+		Blob = vecBlob[i];
+		for(j=i+1; j<nSize; j++)
+		{
+			BlobNext = vecBlob[j];
+
+			//鸥涝捞 促福搁 赣瘤 救茄促.
+			if(Blob.s_DefectType != BlobNext.s_DefectType)
+				continue;
+
+			if(Blob.s_DefectRect.bottom + nMergePixel < BlobNext.s_DefectRect.top || Blob.s_DefectRect.top - nMergePixel > BlobNext.s_DefectRect.bottom)
+				continue;
+
+			if(Blob.s_DefectRect.right + nMergePixel < BlobNext.s_DefectRect.left || Blob.s_DefectRect.left - nMergePixel > BlobNext.s_DefectRect.right)
+				continue;
+
+			//牢立秦 乐栏骨肺 钦模促.
+			if(!Blob.s_bRemoved && !BlobNext.s_bRemoved)
+			{
+				vecBlob[i] = vecBlob[i] + vecBlob[j];
+				Blob=vecBlob[i];
+				vecBlob[j].s_bRemoved = TRUE;
+			}
+		}
+	}
+
+	//钦模扒 瘤况辑 犁备己
+	std::vector<CChipBlob>vecTemp;
+	for(i=0; i<nSize; i++)
+	{
+		if(!vecBlob[i].s_bRemoved)
+		{
+			vecTemp.push_back(vecBlob[i]);
+		}
+	}
+
+	vecBlob.clear();
+	vecBlob.resize(vecTemp.size());
+	copy(vecTemp.begin(),vecTemp.end(),vecBlob.begin());
+	nSize = (int)vecBlob.size();
+	for(i=0; i<nSize; i++)
+		vecBlob[i].s_nDefectRScale = CalcRScale(vecBlob[i].s_ptVertex);
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::MergeMix(std::vector<CChipBlob> &vecBlob, int nMergePixel)
+{
+	int i,j;
+
+	//叼棋泛飘肺 赣瘤
+	CChipBlob Blob;
+	CChipBlob BlobNext;
+
+	int nSize = (int)vecBlob.size();
+	for(i=0; i<nSize; i++)
+	{
+		Blob = vecBlob[i];
+		for(j=i+1; j<nSize; j++)
+		{
+			BlobNext = vecBlob[j];
+
+			if(Blob.s_DefectRect.bottom + nMergePixel < BlobNext.s_DefectRect.top || Blob.s_DefectRect.top - nMergePixel > BlobNext.s_DefectRect.bottom)
+				continue;
+
+			if(Blob.s_DefectRect.right + nMergePixel < BlobNext.s_DefectRect.left || Blob.s_DefectRect.left - nMergePixel > BlobNext.s_DefectRect.right)
+				continue;
+
+			//牢立秦 乐栏骨肺 钦模促.
+			if(!Blob.s_bRemoved && !BlobNext.s_bRemoved)
+			{
+				vecBlob[i] = vecBlob[i] + vecBlob[j];
+				if(Blob.s_DefectType != BlobNext.s_DefectType)
+					vecBlob[i].s_DefectType = CHIPDEFTYPE_BLACK;
+				Blob=vecBlob[i];
+				vecBlob[j].s_bRemoved = TRUE;
+			}
+		}
+	}
+
+	//钦模扒 瘤况辑 犁备己
+	std::vector<CChipBlob>vecTemp;
+	for(i=0; i<nSize; i++)
+	{
+		if(!vecBlob[i].s_bRemoved)
+		{
+			vecTemp.push_back(vecBlob[i]);
+		}
+	}
+
+	vecBlob.clear();
+	vecBlob.resize(vecTemp.size());
+	copy(vecTemp.begin(),vecTemp.end(),vecBlob.begin());
+	nSize = (int)vecBlob.size();
+	for(i=0; i<nSize; i++)
+		vecBlob[i].s_nDefectRScale = CalcRScale(vecBlob[i].s_ptVertex);
+
+	return TRUE;
+}
+
+void CChamferInspect::CheckDefectRect(CChipBlob& Defect, int nX, int nY)	// CPoint* pVertex, CRect* pRect, int nX, int nY)
+{
+	CPoint *points=  Defect.s_ptVertex;
+	if (nY <= Defect.s_DefectRect.top)
+	{
+		Defect.s_DefectRect.top = nY;
+		if (Defect.s_ptVertex[2].y == nY)	// Top Left
+		{
+			if (nX < Defect.s_ptVertex[2].x)
+			{
+				Defect.s_ptVertex[2].x = nX;
+				Defect.s_ptVertex[2].y = nY;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[2].x = nX;
+			Defect.s_ptVertex[2].y = nY;
+		}
+		if (Defect.s_ptVertex[3].y == nY)	// Top Right
+		{
+			if (nX + 1 > Defect.s_ptVertex[3].x)
+			{
+				Defect.s_ptVertex[3].x = nX + 1;
+				Defect.s_ptVertex[3].y = nY;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[3].x = nX + 1;
+			Defect.s_ptVertex[3].y = nY;
+		}
+	}
+	if (nY + 1 >= Defect.s_DefectRect.bottom)
+	{
+		Defect.s_DefectRect.bottom = nY + 1;
+		if (Defect.s_ptVertex[6].y == nY + 1)	// Bottom Left
+		{
+			if (nX < Defect.s_ptVertex[6].x)
+			{
+				Defect.s_ptVertex[6].x = nX;
+				Defect.s_ptVertex[6].y = nY + 1;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[6].x = nX;
+			Defect.s_ptVertex[6].y = nY + 1;
+		}
+		if (Defect.s_ptVertex[7].y == nY + 1)	// Bottom Right
+		{
+			if (nX + 1 > Defect.s_ptVertex[7].x)
+			{
+				Defect.s_ptVertex[7].x = nX + 1;
+				Defect.s_ptVertex[7].y = nY + 1;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[7].x = nX + 1;
+			Defect.s_ptVertex[7].y = nY + 1;
+		}
+	}
+	if (nX <= Defect.s_DefectRect.left)
+	{
+		Defect.s_DefectRect.left = nX;
+		if (Defect.s_ptVertex[1].x == nX)	// Left Bottom
+		{
+			if (nY + 1 > Defect.s_ptVertex[1].y)
+			{
+				Defect.s_ptVertex[1].x = nX;
+				Defect.s_ptVertex[1].y = nY + 1;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[1].x = nX;
+			Defect.s_ptVertex[1].y = nY + 1;
+		}
+		if (Defect.s_ptVertex[0].x == nX)	// Left Top
+		{
+			if (nY < Defect.s_ptVertex[0].y)
+			{
+				Defect.s_ptVertex[0].x = nX;
+				Defect.s_ptVertex[0].y = nY;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[0].x = nX;
+			Defect.s_ptVertex[0].y = nY;
+		}
+	}
+	if (nX + 1 >= Defect.s_DefectRect.right)
+	{
+		Defect.s_DefectRect.right = nX + 1;
+		if (Defect.s_ptVertex[5].x == nX + 1)	// Right Bottom
+		{
+			if (nY + 1 > Defect.s_ptVertex[5].y)
+			{
+				Defect.s_ptVertex[5].x = nX + 1;
+				Defect.s_ptVertex[5].y = nY + 1;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[5].x = nX + 1;
+			Defect.s_ptVertex[5].y = nY + 1;
+		}
+		if (Defect.s_ptVertex[4].x == nX + 1)	// Right Top
+		{
+			if (nY < Defect.s_ptVertex[4].y)
+			{
+				Defect.s_ptVertex[4].x = nX + 1;
+				Defect.s_ptVertex[4].y = nY;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[4].x = nX + 1;
+			Defect.s_ptVertex[4].y = nY;
+		}
+	}
+}
+
+int CChamferInspect::CalcRScale(CPoint* pVertex)
+{
+	double dDeltaX, dDeltaY;
+	double dTemp, dRScale = 0.0;
+	for (int i = 0; i < 8; i++)
+	{
+		for (int j = i; j < 8; j++)
+		{
+#ifdef MOSIS_DELETE_CalcRScale
+			if (pVertex[i].x == 0 || pVertex[i].x == 32760 || pVertex[i].y == 0 ||pVertex[i].y == 32760
+				|| pVertex[j].x == 0 || pVertex[j].x == 32760 || pVertex[j].y == 0 ||pVertex[j].y == 32760)
+				continue;
+#endif
+			dDeltaX = (pVertex[i].x - pVertex[j].x);// * m_dConvResolution;
+			dDeltaY = (pVertex[i].y - pVertex[j].y);// * m_dScanResolution;
+			dTemp = sqrt(dDeltaX * dDeltaX + dDeltaY * dDeltaY);
+			if (dRScale < dTemp)
+				dRScale = dTemp;
+		}
+	}
+	if (dRScale < 0.0)
+		dRScale = 0.0;
+
+	dRScale *= m_dConvResolution;
+
+	return static_cast<int>(dRScale + 0.5);
+}
+
+void CChamferInspect::ReleaseBuffer()
+{	
+	if(m_pGlassEdgeLine != NULL && m_nGlassEdgeLineCnt > 0)
+	{
+		for(int i=0;i<m_nGlassEdgeLineCnt;i++)
+		{
+			m_pGlassEdgeLine[i].Reset();
+		}
+		delete[] m_pGlassEdgeLine,m_pGlassEdgeLine=NULL;
+	}
+
+	if(m_pCannyWidthCnt != NULL)
+		delete[] m_pCannyWidthCnt, m_pCannyWidthCnt=NULL;
+}
+
+void CChamferInspect::ResetValue()
+{	
+	m_nForeEdgeLine[0] = m_nForeEdgeLine[1] = 0;
+	m_dAvgThick = 0;	
+	ReleaseChipBuffer();
+}
+
+void CChamferInspect::ReleaseChipBuffer()
+{
+	m_nDefectCnt = 0;
+}
+
+BOOL CChamferInspect::CopyBuffer(CSISBuffer &bufferOrg,COwnerBuffer &bufferTgt)
+{
+	if(bufferOrg.IsValidBuffer() == FALSE || bufferOrg.GetDataWidth() <= 0 || bufferOrg.GetHeight() <= 0)
+		return FALSE;
+
+	bufferTgt.ReleaseSpace();
+	bufferTgt.SetSize(bufferOrg.GetDataWidth(),bufferOrg.GetHeight());
+
+	if(bufferTgt.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	CopyMemory(bufferTgt.GetDataAddress(0,0),bufferOrg.GetDataAddress(0,0),bufferOrg.GetDataSize());
+
+	return TRUE;
+}
+
+double CChamferInspect::GetAreaAVG(LPBYTE pImg,CRect &rectIns,CRect &rect)
+{
+	double			dAvg,dSum,dCount;
+	int				i,j;
+
+	dAvg = dSum = dCount = 0.;
+	for(i=rect.left;i<rect.right;i++)
+	{
+		for(j=rect.top;j<rect.bottom;j++)
+		{
+			dSum += pImg[j*rectIns.Width()+i];
+			dCount++;
+		}
+	}
+
+	if(dCount > 0)
+		dAvg = dSum/dCount;
+
+	return dAvg;
+}
+
+#define CANNY_MIN_THRESHOLD		8
+BOOL CChamferInspect::PreProcessing(LPBYTE pImg,CRect &rectIns,COwnerBuffer &BufferCanny)
+{
+	if(pImg == NULL)
+		return FALSE;
+
+	const	int nAreaSize = 10;
+
+	BufferCanny.SetSize(rectIns.Width(),rectIns.Height());
+	if(BufferCanny.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	CopyMemory(BufferCanny.GetDataAddress(0,0),pImg,sizeof(BYTE)*rectIns.Width()*(rectIns.Height()));
+
+	CRect				rectBin(0,rectIns.top,nAreaSize,rectIns.bottom);
+
+	int		nThres = (int)GetAreaAVG(pImg,rectIns,rectBin)/2;
+	if(nThres < CANNY_MIN_THRESHOLD)
+		nThres = CANNY_MIN_THRESHOLD;
+
+	//int		nThres = OtsuoBinary(m_BufferCanny,rectBin);			
+
+	CEdgeProc		EdgeProc;
+	EdgeProc.CannyEdgeProcessing(pImg,rectIns,GM_Prewitt,(int)nThres,BufferCanny);	
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::FindEdgeLine(LPBYTE pImg,CRect &rectIns)
+{
+	if(pImg == NULL)
+		return FALSE;
+
+	int			u,v;
+	int			nValue,nPos;
+	int			nMin,nMax;
+	CArray<int,int> arrU;
+
+	nPos = rectIns.top+1;
+	for(v=1;v<rectIns.Height()-1;v++,nPos++)	
+	{
+		if(m_nGlassEdgeLineCnt <= nPos)
+			break;
+
+		m_pGlassEdgeLine[nPos].Reset();
+		nMin = INT_MAX;
+		nMax = INT_MIN;
+		arrU.RemoveAll();
+
+		for(u=1;u<rectIns.Width()-1;u++)
+		{
+			nValue = *(pImg+v*rectIns.Width()+u);
+			if(nValue == 255)
+			{
+				arrU.Add(u);			
+				if(u < nMin) nMin = u;
+				if(u > nMax) nMax = u;
+				m_pCannyWidthCnt[u]++;
+			}
+		}	
+
+		m_pGlassEdgeLine[nPos].nPosCnt = (int)arrU.GetCount();
+		if(m_pGlassEdgeLine[nPos].nPosCnt > 0)
+		{			
+			m_pGlassEdgeLine[nPos].pPos = new int[m_pGlassEdgeLine[nPos].nPosCnt];
+			ZeroMemory(m_pGlassEdgeLine[nPos].pPos,sizeof(int)*m_pGlassEdgeLine[nPos].nPosCnt);
+			for(u=0;u<m_pGlassEdgeLine[nPos].nPosCnt;u++)
+			{
+				m_pGlassEdgeLine[nPos].pPos[u] = arrU.GetAt(u);
+			}
+		}
+		if(nMax != INT_MIN && nMin != INT_MAX)
+			m_pGlassEdgeLine[nPos].nWidth = abs(nMax-nMin)+1;
+	}
+
+	return TRUE;
+}
+
+int CChamferInspect::FindForeCastLine(CSISBuffer &pBuffer,CRect &rectIns,int &nforecast_S,int &nforecast_E,BOOL bChamfer)
+{	
+	nforecast_S = nforecast_E = -1;
+
+	if(m_pGlassEdgeLine == NULL)
+		return nforecast_S;
+
+	int			u,v;
+	int			nValue;
+	int			*nPosCnt = NULL;	
+	int			nStart,nEnd;
+	int			iLoop,nDev;
+
+	nStart = nEnd = nDev = 0;
+
+	nPosCnt = new int[rectIns.Width()+1];
+	ZeroMemory(nPosCnt,sizeof(int)*(rectIns.Width()+1));
+
+	nStart = 3;
+	nEnd = rectIns.Width();			
+	for(v=rectIns.top;v<rectIns.bottom;v++)	
+	{				
+		if(m_nGlassEdgeLineCnt <= v)
+			break;
+
+		if(m_pGlassEdgeLine[v].nPosCnt > 0 && m_pGlassEdgeLine[v].pPos != NULL)
+		{
+			for(u=0;u<m_pGlassEdgeLine[v].nPosCnt;u++)
+			{
+				nValue = m_pGlassEdgeLine[v].pPos[u];
+				nPosCnt[nValue]++;
+			}			
+		}
+	}
+
+	if(nPosCnt != NULL)
+	{
+		EDGEPOS		edgePos;
+		std::vector<EDGEPOS>	vecPos;
+		std::vector<EDGEPOS>::iterator it;
+		CRect		rectLeft,rectRight;
+		int			nAreaSize = 4;
+		int			iDiv,nLoopCnt = 3;
+		int			nSkipH = (pBuffer.GetHeight()-(nAreaSize*4))/(nLoopCnt-1);
+		int			nVertical;
+		double		dSumLeft,dSumRight,dSumCnt;
+
+#define		EDGE_FORE_RATIO			0.15
+		nDev = (int)((double)rectIns.Height()*EDGE_FORE_RATIO);
+
+		for(iLoop=nStart;iLoop<nEnd;iLoop++)
+		{			
+			if(nDev <= nPosCnt[iLoop])
+			{
+				dSumLeft = dSumRight = dSumCnt = 0.;
+				for(iDiv=0;iDiv<nLoopCnt;iDiv++)
+				{
+					nVertical = nSkipH*iDiv+nAreaSize-nAreaSize/2;
+					rectLeft.SetRect(0,nVertical,0,nVertical+nAreaSize/2);
+					if(rectLeft.bottom >= pBuffer.GetHeight())
+						break;
+
+					rectRight = rectLeft;
+					rectLeft.right = iLoop-1;
+					rectLeft.left = rectLeft.right-nAreaSize;
+					if(rectLeft.left < 0)
+						continue;
+
+					rectRight.left = iLoop+1;
+					rectRight.right = rectRight.left+nAreaSize;						
+					if(rectRight.right >= pBuffer.GetWidth())
+						continue;
+
+					dSumLeft += GetAreaAVG(pBuffer.GetDataAddress(0,0),rectIns,rectLeft);
+					dSumRight += GetAreaAVG(pBuffer.GetDataAddress(0,0),rectIns,rectRight);
+					dSumCnt++;
+				}
+
+				if(dSumCnt <= 0)
+					continue;
+				edgePos.dLeft = dSumLeft/dSumCnt;
+				edgePos.dRight = dSumRight/dSumCnt;
+				edgePos.nPos = iLoop;
+
+				vecPos.push_back(edgePos);
+			}			
+		}				
+
+		double		dDiff,dMaxDiff = INT_MAX;		
+		for(it=vecPos.begin();it!=vecPos.end();it++)
+		{
+			edgePos = *it;			
+			dDiff = edgePos.dLeft-edgePos.dRight;
+
+			if(bChamfer == TRUE)
+			{
+				if(nforecast_S == -1 && dDiff > 0)
+				{
+					nforecast_S = edgePos.nPos;
+					continue;
+				}
+			}
+			else
+			{
+				//chamfer 八荤 救窍绰 版快
+				if(nforecast_S == -1 && dDiff < 0)
+				{
+					nforecast_S = edgePos.nPos;
+					continue;
+				}
+			}			
+
+			if(nforecast_S > 0)
+			{				
+				if(dMaxDiff > dDiff)
+				{
+					dMaxDiff = dDiff;
+					nforecast_E = edgePos.nPos;
+				}
+			}
+		}
+	}
+	else
+	{
+		nforecast_S = -2;
+	}
+
+ 	if(0 > nforecast_S)
+ 		nforecast_S = 0;
+	if(0 > nforecast_E)
+		nforecast_E = 0;
+
+	if(nPosCnt != NULL)
+		delete[] nPosCnt, nPosCnt=NULL;
+
+	return nforecast_S;
+}
+
+BOOL CChamferInspect::Binarization(CSISBuffer &pOrg,COwnerBuffer &pBin,int nSetThres)
+{
+	pBin.SetSize(pOrg.GetWidth(),pOrg.GetHeight());
+	CopyMemory(pBin.GetDataAddress(0,0),pOrg.GetDataAddress(0,0),pOrg.GetDataSize());
+
+	CSize		szImg = CSize(pBin.GetWidth(),pBin.GetHeight());
+	CEdgeProc	EdgeProc;
+	EdgeProc.ThresholdProcessing(pBin.GetDataAddress(0,0),szImg,nSetThres,0);
+
+	return TRUE;
+}
+
+// BOOL CChamferInspect::FindRightLine(CSISBuffer &pBuffer,int &nforecast_S,double &dRightLine)
+// {
+// 	int			nSumLine,nSumCnt;
+// 	int			u,v;
+// 	int			nBCnt,nContinCnt=3;
+// 	
+// 	dRightLine = -1;
+// 	nSumLine = nSumCnt = 0;	
+// 	for(v=0;v<pBuffer.GetHeight();v++)
+// 	{
+// 		nBCnt = 0;
+// 		for(u=nforecast_S+1;u<pBuffer.GetWidth();u++)
+// 		{
+// 			if(*pBuffer.GetDataAddress(u,v) == 0)		
+// 			{
+// 				nSumLine += u;
+// 				nSumCnt++;
+// 				break;
+// 			}
+// 			/*if(*pBuffer.GetDataAddress(u,v) == 0)			
+// 				nBCnt++;
+// 			else
+// 				nBCnt = 0;
+// 
+// 			if(nBCnt >= nContinCnt)
+// 			{
+// 				if(nMinRightEdge > (u-nContinCnt-1))
+// 					nMinRightEdge = (u-nContinCnt-1);
+// 				nSumLine += (u-(nContinCnt-1));
+// 				nSumCnt++;
+// 				break;
+// 			}*/
+// 		}
+// 	}
+// 
+// 	if(nSumCnt > 0)
+// 	{
+// 		dRightLine = (double)nSumLine/(double)nSumCnt;
+// 	}
+// 		
+// 	return TRUE;
+// }
+
+BOOL CChamferInspect::FindRightLine_Bin(CSISBuffer &pBuffer,int &nforecast_S,double &dRightLine)
+{
+	int			nSumLine,nSumCnt;
+	int			u,v;
+	int			nBCnt,nContinCnt=3;
+	int			nRightOffset = 10;
+	
+	dRightLine = -1;
+	nSumLine = nSumCnt = 0;	
+	for(v=0;v<pBuffer.GetHeight();v++)
+	{
+		nBCnt = 0;
+		for(u=nforecast_S+nRightOffset; u<pBuffer.GetWidth();u++)
+		{
+			if(*pBuffer.GetDataAddress(u,v) == 0)		
+			{
+				nBCnt++;
+			}
+			else
+			{
+				nBCnt = 0;
+			}
+
+			if(nBCnt >= nContinCnt)
+			{
+				nSumLine += (u-(nContinCnt-1));
+				nSumCnt++;
+				break;
+			}		
+			
+			/*if(*pBuffer.GetDataAddress(u,v) == 0)			
+				nBCnt++;
+			else
+				nBCnt = 0;
+
+			if(nBCnt >= nContinCnt)
+			{
+				if(nMinRightEdge > (u-nContinCnt-1))
+					nMinRightEdge = (u-nContinCnt-1);
+				nSumLine += (u-(nContinCnt-1));
+				nSumCnt++;
+				break;
+			}*/
+		}
+	}
+	if(nforecast_S+nRightOffset > dRightLine || nSumCnt < pBuffer.GetHeight() *0.5)
+		dRightLine = nforecast_S;
+
+	if(nSumCnt > 0)
+	{
+		dRightLine = (double)nSumLine/(double)nSumCnt;
+	}
+		
+	return TRUE;
+}
+
+BOOL CChamferInspect::FindRightLine(CSISBuffer &pBuffer,CRect &rtIns,double dLeftLine,double &dRightLine,int nThres)
+{
+	int			nSumLine,nSumCnt;
+	int			u,v;
+	int			nBCnt,nWCnt,nContinCnt=3;
+	int			nRightOffset = 3;
+	
+	dRightLine = -1;
+	nSumLine = nSumCnt = 0;	
+
+	int			uStart,uEnd;
+
+	uStart = (int)dLeftLine+1;
+	uEnd = rtIns.right-1;
+
+	for(v=rtIns.top;v<rtIns.bottom;v++)
+	{
+		nBCnt = 0;
+		for(u=uStart; u<uEnd;u++)
+		{
+			if(*pBuffer.GetDataAddress(u,v) <= nThres)		
+			{
+				nBCnt++;
+			}
+			else
+			{
+				nBCnt = 0;
+			}
+
+			if(nBCnt >= nContinCnt)
+			{
+				nWCnt = 0;
+				for(int u1=u+1; u1<uEnd;u1++)
+				{
+					if(*pBuffer.GetDataAddress(u1,v) > nThres)		
+					{
+						nWCnt++;
+					}
+					else
+					{
+						nWCnt = 0;
+					}
+
+					if(nWCnt >= nContinCnt)
+					{
+						nSumLine += (u1-nContinCnt);
+						nSumCnt++;
+						break;
+					}
+				}
+				break;
+			}					
+		}
+	}
+	if(dLeftLine+nRightOffset > dRightLine || nSumCnt < pBuffer.GetHeight() *0.5)
+		dRightLine = dLeftLine;
+
+	if(nSumCnt > 0)
+	{
+		dRightLine = (double)nSumLine/(double)nSumCnt;
+	}
+		
+	return TRUE;
+}
+
+#define SUBPIXEL_THRESHOLD			3
+double CChamferInspect::GetSubPixelThick(CSISBuffer &pBuffer,int nForecast_S,double dForecast_E,int nThres,double &dLeftEdge,double &dRightEdge)
+{
+	const	int nLoopCnt = 3;
+	CSize		szImg = CSize(pBuffer.GetWidth(),pBuffer.GetHeight());
+	int			nStartLine,nVertSize = szImg.cy/10;
+	CRect		rectSubPixel,rectArea;
+	int			i,nSubMargin = 4,nKernelSize=2;	
+	double		dSumValue,dSumCnt;
+	int			nDiv;
+
+	if(nVertSize < 10)
+		nVertSize = 10;
+
+	nDiv = (szImg.cy-nVertSize*2)/nLoopCnt;
+
+	CEdgeFind		EdgeFind;
+	dSumValue = dSumCnt = 0.;
+	for(i=0;i<nLoopCnt;i++)
+	{
+		nStartLine = i*nDiv-nVertSize/2+nVertSize/2;		
+		rectSubPixel = CRect(nForecast_S-nSubMargin,nStartLine,nForecast_S,nStartLine+nVertSize);
+
+// 		nThres = (int)GetAreaAVG(pBuffer.GetDataAddress(0,0),CRect(0,0,pBuffer.GetWidth(),pBuffer.GetHeight()),rectSubPixel)/4;
+// 		if(nThres <= SUBPIXEL_THRESHOLD)
+// 			nThres = SUBPIXEL_THRESHOLD;
+
+		nThres = SUBPIXEL_THRESHOLD;
+		rectSubPixel.right = nForecast_S+nSubMargin;
+		
+		dLeftEdge = EdgeFind.FindLineSubPixel(pBuffer.GetDataAddress(0,0),szImg,rectSubPixel,nThres,-1*nThres,DIR_HORIZONTAL,SearchTypeIn2Out,EdgeTypeNegative,nKernelSize);
+		if(dLeftEdge > 0)
+		{
+			dSumValue += dLeftEdge;
+			dSumCnt++;
+		}
+	}
+
+	if(dSumCnt > 0)
+		dLeftEdge = dSumValue/dSumCnt;
+	else
+		dLeftEdge = nForecast_S;
+	
+	//////////////////////////////////////////////////////////////////////////
+	// Right
+	dRightEdge = dForecast_E;
+
+	/*int		nRight = (int)dForecast_E;
+	dSumValue = dSumCnt = 0.;
+	for(i=0;i<nLoopCnt;i++)
+	{
+		nStartLine = i*nDiv-nVertSize/2+nVertSize/2;		
+		rectSubPixel = CRect(nRight-nSubMargin,nStartLine,nRight,nStartLine+nVertSize);
+
+		nThres = (int)GetAreaAVG(pBuffer.GetDataAddress(0,0),CRect(0,0,pBuffer.GetWidth(),pBuffer.GetHeight()),rectSubPixel)/2;
+		if(nThres <= SUBPIXEL_THRESHOLD)
+			nThres = SUBPIXEL_THRESHOLD;
+
+		rectSubPixel.right = nRight+nSubMargin;
+
+		dRightEdge = FindLineSubPixel(pBuffer.GetDataAddress(0,0),szImg,rectSubPixel,nThres,-1*nThres,DIR_HORIZONTAL,SearchTypeIn2Out,EdgeTypePositive,nKernelSize);
+		if(dRightEdge > 0)
+		{
+			dSumValue += dRightEdge;
+			dSumCnt++;
+		}
+	}
+
+	if(dSumCnt > 0)
+	{
+		dRightEdge = dSumValue/dSumCnt;
+		if(fabs(dRightEdge-dForecast_E) >= 2)
+			dRightEdge = dForecast_E;
+	}
+	else
+		dRightEdge = dForecast_E;*/
+
+	return (dRightEdge-dLeftEdge)+1;
+}
+
+void CChamferInspect::VConvolutionConvC(CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,int nSetPitch,CRect &rectInsReg)
+{
+	int sx, ex, sy, ey;
+	sx=	sy = 0;
+	sx = rectInsReg.left;
+	sy = rectInsReg.top;
+	ex= rectInsReg.right;	
+	ey= rectInsReg.bottom;
+
+	int		nPitch = nSetPitch;	
+	int		nPitch_p = nPitch+1;
+	CSize	szConv = CSize(1,1);	
+
+	ex -= szConv.cx;
+	ey -= szConv.cy;
+
+	if(ey < nSetPitch*3 || ex <= szConv.cx)
+		return;
+
+	CRect	rectIns;
+	int		nPitch2;
+
+	//0~pitch 芭府鳖瘤
+	nPitch2 = nPitch*2;
+	rectIns = CRect(sx,sy,ex,sy+ nPitch_p);
+	VertCalPitchConv(pImg,nThres,s_RegionType,s_DefectPos,rectIns,szConv,nPitch,nPitch2);
+
+	//pitch~pitch 芭府鳖瘤
+	nPitch2 = -1*nPitch;
+	rectIns = CRect(sx,sy+nPitch_p,ex,ey-nPitch_p);
+	VertCalPitchConv(pImg,nThres,s_RegionType,s_DefectPos,rectIns,szConv,nPitch,nPitch2);
+
+	//0~pitch 芭府鳖瘤
+	rectIns = CRect(sx,ey-nPitch_p,ex,ey);
+	nPitch = -1*nPitch;
+	nPitch2 = nPitch*2;
+	VertCalPitchConv(pImg,nThres,s_RegionType,s_DefectPos,rectIns,szConv,nPitch,nPitch2);
+}
+
+void CChamferInspect::BinalizeFind_Chip( CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectInsReg,CSISBuffer &pImgSave, BOOL bSaveImage,BOOL bPolar )
+{
+	int sx, ex, sy, ey;
+	sx=	sy = 0;
+	sx = rectInsReg.left;
+	sy = rectInsReg.top;
+	ex= rectInsReg.right;	
+	ey= rectInsReg.bottom;
+
+	int Threshold = nThres;
+
+	int		SrcValue = 0;	
+	int		i = 0;	
+	int		j;	
+
+	if(bPolar == TRUE)		// black
+	{
+		for( j = sy; j < ey; j++)
+		{
+			for( i = sx; i < ex; i++)	
+			{		
+				SrcValue = *pImg.GetDataAddress(i,j);
+
+				if (SrcValue < Threshold)					
+				{	
+					if(!InsertPairing(i,j,SrcValue,Threshold,SrcValue, SrcValue,s_RegionType,s_DefectPos))
+						return;
+
+					if(bSaveImage)
+					{				
+						pImgSave.SetPixel(i,j,0);
+					}
+				}
+			}
+		}	
+	}
+	else		// white
+	{
+		for( j = sy; j < ey; j++)
+		{
+			for( i = sx; i < ex; i++)	
+			{		
+				SrcValue = *pImg.GetDataAddress(i,j);
+
+				if (SrcValue > Threshold)					
+				{	
+					if(!InsertPairing(i,j,SrcValue,Threshold,SrcValue, SrcValue,s_RegionType,s_DefectPos))
+						return;
+
+					if(bSaveImage)
+					{				
+						pImgSave.SetPixel(i,j,0);
+					}
+				}
+			}
+		}	
+	}
+}
+
+BOOL CChamferInspect::VertCalPitchConv(CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectIns,CSize szConv,int nPitch,int nPitch2)
+{
+	if(pImg.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	if(pImg.GetWidth() <= rectIns.right)
+		rectIns.right = pImg.GetWidth()-1;
+	if(rectIns.left < 0)
+		rectIns.left = 0;
+	if(pImg.GetHeight() <= rectIns.bottom)
+		rectIns.bottom = pImg.GetHeight()-1;
+	if(rectIns.top < 0)
+		rectIns.top = 0;
+
+	int			u,v,iLoopX,iLoopY;
+	int			SubValue,SubValue2Pitch,SrcValue,DestValue1,DestValue2;	
+	int			NegThres = -1*nThres;
+
+	for( v = rectIns.top; v < rectIns.bottom; v++)
+	{
+		for( u = rectIns.left; u < rectIns.right; u++)	
+		{		
+			SrcValue = DestValue1 = DestValue2 = 0;			
+			for(iLoopX=u;iLoopX<u+szConv.cx;iLoopX++)
+			{
+				for(iLoopY=v;iLoopY<v+szConv.cy;iLoopY++)
+				{	
+					SrcValue +=	*pImg.GetDataAddress(iLoopX,iLoopY);
+					DestValue1 += *pImg.GetDataAddress(iLoopX,iLoopY+nPitch);
+					DestValue2 += *pImg.GetDataAddress(iLoopX,iLoopY+nPitch2);					
+				}
+			}
+
+			SubValue = DestValue1 - SrcValue;
+			SubValue2Pitch = DestValue2 - SrcValue;
+
+			//	if ((SubValue > nThres && SubValue2Pitch > nThres) ||
+			//		(SubValue < NegThres && SubValue2Pitch < NegThres))				
+			if (SubValue > nThres && SubValue2Pitch > nThres)				
+			{	
+
+				if(!InsertPairing(u,v,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,nThres,SrcValue, DestValue2,s_RegionType,s_DefectPos))
+					return FALSE;
+			}		
+		}
+	}
+
+	return TRUE;
+}
+
+void CChamferInspect::VConvolutionConvC_Com(COwnerBuffer &pRes,CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,int nSetPitch,CRect &rectInsReg)
+{
+	int sx, ex, sy, ey;
+	sx=	sy = 0;
+	sx = rectInsReg.left;
+	sy = rectInsReg.top;
+	ex= rectInsReg.right;	
+	ey= rectInsReg.bottom;
+
+	int		nPitch = nSetPitch;	
+	int		nPitch_p = nPitch+1;
+	CSize	szConv = CSize(1,1);	
+
+	ex -= szConv.cx;
+	ey -= szConv.cy;
+
+	if(ey < nSetPitch*3 || ex <= szConv.cx)
+		return;
+
+	CRect	rectIns;
+	int		nPitch2;
+
+	//0~pitch 芭府鳖瘤
+	nPitch2 = nPitch*2;
+	rectIns = CRect(sx,sy,ex,sy+ nPitch_p);
+	VertCalPitchConv_Com(pRes,pImg,nThres,s_RegionType,s_DefectPos,rectIns,szConv,nPitch,nPitch2);
+
+	//pitch~pitch 芭府鳖瘤
+	nPitch2 = -1*nPitch;
+	rectIns = CRect(sx,sy+nPitch_p,ex,ey-nPitch_p);
+	VertCalPitchConv_Com(pRes,pImg,nThres,s_RegionType,s_DefectPos,rectIns,szConv,nPitch,nPitch2);
+
+	//0~pitch 芭府鳖瘤
+	rectIns = CRect(sx,ey-nPitch_p,ex,ey);
+	nPitch = -1*nPitch;
+	nPitch2 = nPitch*2+1;
+	VertCalPitchConv_Com(pRes,pImg,nThres,s_RegionType,s_DefectPos,rectIns,szConv,nPitch,nPitch2);
+}
+
+BOOL CChamferInspect::VertCalPitchConv_Com(COwnerBuffer &pRes,CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectIns,CSize szConv,int nPitch,int nPitch2)
+{
+	if(pImg.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	if(pImg.GetWidth() <= rectIns.right)
+		rectIns.right = pImg.GetWidth()-1;
+	if(rectIns.left < 0)
+		rectIns.left = 0;
+	if(pImg.GetHeight() <= rectIns.bottom)
+		rectIns.bottom = pImg.GetHeight()-1;
+	if(rectIns.top < 0)
+		rectIns.top = 0;
+
+	int			u,v,iLoopX,iLoopY;
+	int			SubValue,SubValue2Pitch,SrcValue,DestValue1,DestValue2;	
+	int			NegThres = -1*nThres;
+
+	for( v = rectIns.top; v < rectIns.bottom; v++)
+	{
+		for( u = rectIns.left; u < rectIns.right; u++)	
+		{		
+			SrcValue = DestValue1 = DestValue2 = 0;			
+			for(iLoopX=u;iLoopX<u+szConv.cx;iLoopX++)
+			{
+				for(iLoopY=v;iLoopY<v+szConv.cy;iLoopY++)
+				{	
+					SrcValue +=	*pImg.GetDataAddress(iLoopX,iLoopY);
+					DestValue1 += *pImg.GetDataAddress(iLoopX,iLoopY+nPitch);
+					DestValue2 += *pImg.GetDataAddress(iLoopX,iLoopY+nPitch2);					
+				}
+			}
+
+			SubValue = DestValue1 - SrcValue;
+			SubValue2Pitch = DestValue2 - SrcValue;
+
+			//	if ((SubValue > nThres && SubValue2Pitch > nThres) ||
+			//		(SubValue < NegThres && SubValue2Pitch < NegThres))				
+			if (SubValue > nThres && SubValue2Pitch > nThres)				
+			{	
+				pRes.SetPixel(u,v,255);				
+			}		
+		}
+	}
+
+	return TRUE;
+}
+
+#define CHIP_INS_PITCH 10
+BOOL CChamferInspect::ChipInspection(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,int nChipThres,int nBurrThres,int nEdgeLeft,int nEdgeRight)
+{
+	if(lpHeader == NULL)
+		return FALSE;
+
+	ReleaseChipBuffer();	
+
+	std::vector<CChipBlob>		blobData;
+	
+	const int nImgMargin = 0;
+	const int nMergeMargin = 4;
+	CRect		rectIns,rectTmp;	
+
+	//if(CopyRectImg(lpHeader,imgbuf.GetDataAddress(),CSize(nFrameWidth,rectChamfer.Height()+2),rectChamfer) == FALSE)
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : Inspection Right",m_nCurCamId,m_nCurScanIdx);		
+
+	int			nInsPitch = (rectChip.Height()-(int)((double)rectChip.Height()*0.2))/3;
+	if(nInsPitch < CHIP_INS_PITCH)
+		nInsPitch = CHIP_INS_PITCH;
+
+	CSISBuffer		ChipBuffer(lpHeader,nFrameWidth,rectChip.Height()+1);
+
+	// Right Inspection
+	rectIns = CRect(0,rectChip.top,rectChip.Width(),rectChip.bottom);
+	rectIns.OffsetRect(nEdgeRight+nImgMargin,0);
+	VConvolutionConvC(ChipBuffer,nChipThres,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,nInsPitch,rectIns);
+
+	
+	// Left Inspection	
+ 	rectIns = CRect(0,rectChip.top,0,rectChip.bottom);
+ 	rectIns.OffsetRect(nEdgeLeft-nImgMargin,0);
+ 	rectIns.left -= rectChip.Width();	
+ 	VConvolutionConvC(ChipBuffer,nBurrThres,CHIPREGTYPE_LEFT,INS_DEFECT_BURR,nInsPitch,rectIns);		
+
+	BlobDefect_Pixel(blobData,nChipThres,nMergeMargin);	
+
+	FilteringEdgeBlob(blobData,nEdgeLeft,nEdgeRight,nImgMargin,0);	
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : End",m_nCurCamId,m_nCurScanIdx);	
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::AssertRect(CRect rect,CSize szImg)
+{
+	if(rect.left < 0 || rect.right >= szImg.cx || rect.left >= rect.right)
+		return FALSE;
+	if(rect.top < 0 || rect.top >= rect.bottom)
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::ChipInspection_Binarization(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,CRect &rectCrack,CRect &rectBroken,int nChipThres,int nChipDiffThres,int nCrackThres,int nBrokenThres
+	,int nBurrThres,int nEdgeLeft,int nEdgeRight,BOOL bSaveDebug,int iFrame)
+{
+	if(lpHeader == NULL)
+		return FALSE;
+
+	ReleaseChipBuffer();	
+
+	std::vector<CChipBlob>		blobData;
+	
+	const int nImgMargin = 2;
+	const int nImgBurrMargin = 2;
+	const int nFirstImgMargin = 4;
+	const int nMergeMargin = 4;
+	const int nTempSize = 10;
+	CRect		rectIns,rectTmp;	
+
+	//if(CopyRectImg(lpHeader,imgbuf.GetDataAddress(),CSize(nFrameWidth,rectChamfer.Height()+2),rectChamfer) == FALSE)
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : Inspection Right",m_nCurCamId,m_nCurScanIdx);		
+		
+	CSISBuffer		ChipBuffer(lpHeader,nFrameWidth,rectChip.Height()+1);
+	COwnerBuffer	ChipBufferSave;
+
+	if (bSaveDebug)
+	{
+		ChipBufferSave.SetSize(nFrameWidth,rectChip.Height()+1);
+
+		CRect			rectChamfer = CRect(0,0,nFrameWidth,rectChip.Height()+1);
+		if(CopyRectImg(lpHeader,ChipBufferSave.GetDataAddress(),CSize(nFrameWidth,rectChip.Height()+1),rectChamfer) == FALSE)
+			return ERR_CHIP_IMAGE_NULL_01;	
+	}
+	
+	const	int		nMinSize = 5;
+	//if((int)vecPairtemp.size() > 0)
+	{		
+		// Chip Inspection		
+		rectIns = CRect(0,0,rectChip.Width(),rectChip.Height());
+		rectIns.OffsetRect(nEdgeRight+nImgMargin,0);
+		if(AssertRect(rectIns,CSize(nFrameWidth,rectIns.Height())) == TRUE)
+		{
+			rectTmp = rectIns;
+			rectTmp.right = rectTmp.left + nTempSize;
+			if(nChipThres != 0)
+			{
+				if(rectTmp.Width() > nMinSize && rectTmp.Height() > nMinSize && rectTmp.right < rectIns.right)
+				{
+					BinalizeFind_Chip(ChipBuffer,nChipThres,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,rectTmp,ChipBufferSave,bSaveDebug);
+
+					if(GetPairDefectCount() > 0)
+					{
+						m_nChipPairIndex = 0;										
+						BinalizeFind_Chip(ChipBuffer,nChipThres,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,rectIns,ChipBufferSave,bSaveDebug);
+
+						BlobDefect_Pixel(blobData,nChipThres,nMergeMargin);								
+					}
+				}
+			}
+			
+			if(nChipDiffThres != 255)
+			{
+				int			nInsPitch = rectChip.Height()/5;
+				if(nInsPitch < CHIP_INS_PITCH)
+					nInsPitch = CHIP_INS_PITCH;					
+
+				if(rectTmp.Width() > nMinSize && rectTmp.Height() > nMinSize && rectTmp.right < rectIns.right)
+				{
+					m_nChipPairIndex = 0;
+
+					VConvolutionConvC(ChipBuffer,nChipDiffThres,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,nInsPitch,rectTmp);	
+
+					if(GetPairDefectCount() > 0)
+					{
+						m_nChipPairIndex = 0;										
+
+						VConvolutionConvC(ChipBuffer,nChipDiffThres,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,nInsPitch,rectIns);
+
+						BlobDefect_Pixel(blobData,nChipThres,nMergeMargin);								
+					}
+				}				
+			}
+		}
+		
+		// Crack Inspection
+		rectIns = CRect(0,0,rectCrack.Width(),rectCrack.Height());
+		rectIns.OffsetRect(nEdgeRight+nImgMargin,0);
+
+		if(AssertRect(rectIns,CSize(nFrameWidth,rectIns.Height())) == TRUE)
+		{			
+			rectTmp = rectIns;
+			rectTmp.right = rectTmp.left + nTempSize;
+			if(nCrackThres != 0)
+			{
+				if(rectTmp.Width() > nMinSize && rectTmp.Height() > nMinSize && rectTmp.right < rectIns.right)
+				{
+					m_nChipPairIndex = 0;
+					BinalizeFind_Chip(ChipBuffer,nChipThres,CHIPREGTYPE_RIGHT,INS_DEFECT_CRACK,rectTmp,ChipBufferSave,bSaveDebug);
+
+					if(GetPairDefectCount() > 0)
+					{	
+						m_nChipPairIndex = 0;
+						if(rectIns.Width() > nMinSize && rectCrack.Height() > nMinSize)
+						{							
+							BinalizeFind_Chip(ChipBuffer,nChipThres,CHIPREGTYPE_RIGHT,INS_DEFECT_CRACK,rectIns,ChipBufferSave,bSaveDebug);							
+						}												
+
+						BlobDefect_Pixel(blobData,nChipThres,nMergeMargin);		
+					}
+				}
+			}		
+		}
+
+		// Broken Inspection
+		rectIns = CRect(0,0,rectBroken.Width(),rectBroken.Height());
+		rectIns.OffsetRect(nEdgeRight+nImgMargin,0);
+		if(AssertRect(rectIns,CSize(nFrameWidth,rectIns.Height())) == TRUE)
+		{			
+			rectTmp = rectIns;
+			rectTmp.right = rectTmp.left + nTempSize;
+			if(nBrokenThres != 0)
+			{
+				if(rectTmp.Width() > nMinSize && rectTmp.Height() > nMinSize && rectTmp.right < rectIns.right)
+				{
+					m_nChipPairIndex = 0;
+					BinalizeFind_Chip(ChipBuffer,nChipThres,CHIPREGTYPE_RIGHT,INS_DEFECT_BROKEN,rectIns,ChipBufferSave,bSaveDebug);
+
+					if(GetPairDefectCount() > 0)
+					{
+						m_nChipPairIndex = 0;
+						if(rectIns.Width() > nMinSize && rectIns.Height() > nMinSize)
+						{							
+							BinalizeFind_Chip(ChipBuffer,nBrokenThres,CHIPREGTYPE_RIGHT,INS_DEFECT_BROKEN,rectIns,ChipBufferSave,bSaveDebug);
+						}
+
+						BlobDefect_Pixel(blobData,nChipThres,nMergeMargin);		
+					}
+				}
+			}		
+		}
+	}
+	
+	// Burr Inspection		
+	if(nBurrThres != 255)
+	{
+		rectIns = CRect(nEdgeLeft-rectChip.Width(),0,nEdgeLeft,rectChip.Height());
+		rectIns.OffsetRect(-nImgBurrMargin,0);	
+		if(rectIns.left < 0)
+			rectIns.left = 0;
+		if(rectIns.right >= nFrameWidth)
+			rectIns.right = nFrameWidth-1;
+		
+		if(AssertRect(rectIns,CSize(nFrameWidth,rectIns.Height())) == TRUE)
+		{
+			rectTmp = rectIns;
+			rectTmp.left = rectTmp.right - nTempSize;
+			if(rectTmp.Width() > nMinSize && rectTmp.Height() > nMinSize)
+			{
+				int			nInsPitch = rectIns.Height()/5;
+				if(nInsPitch < CHIP_INS_PITCH)
+					nInsPitch = CHIP_INS_PITCH;
+
+				m_nChipPairIndex = 0;
+				VConvolutionConvC(ChipBuffer,nBurrThres,CHIPREGTYPE_LEFT,INS_DEFECT_BURR,nInsPitch,rectTmp);	
+
+				if(GetPairDefectCount() > 0)
+				{
+					m_nChipPairIndex = 0;
+					if(rectIns.Width() > nMinSize && rectIns.Height() > nMinSize)
+					{					
+						VConvolutionConvC(ChipBuffer,nBurrThres,CHIPREGTYPE_LEFT,INS_DEFECT_BURR,nInsPitch,rectIns);	
+					}
+
+					BlobDefect_Pixel(blobData,nChipThres,nMergeMargin);		
+				}
+			}
+		}		
+
+	}
+
+	if (bSaveDebug)
+	{
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Chip.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach		attach(str);
+		attach.AttachToFile(ChipBufferSave);
+	}
+
+
+	FilteringEdgeBlob(blobData,nEdgeLeft,nEdgeRight,nImgMargin,nImgBurrMargin+1);	
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : End",m_nCurCamId,m_nCurScanIdx);	
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::ChipInspection_Binarization_OpenCV(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,CRect &rectCrack,CRect &rectBroken,InspectParam insParam,int nEdgeLeft,int nEdgeRight,BOOL bSaveDebug,int iFrame)
+{
+	if(lpHeader == NULL) 
+		return FALSE;
+
+	ReleaseChipBuffer();	
+
+	std::vector<CChipBlob>		blobData;
+
+	const int nImgMargin			= 2;
+	const int nImgBurrMargin		= 2;
+	const int nFirstImgMargin		= 4;
+	const int nMergeMargin			= 4;
+	CRect rectIns,rectTmp;	
+
+	CSISBuffer		ChipBuffer(lpHeader,nFrameWidth,rectChip.Height()+1);
+	COwnerBuffer	ChipBufferSave;
+
+	if (bSaveDebug)
+	{
+		ChipBufferSave.SetSize(nFrameWidth,rectChip.Height()+1);
+
+		CRect			rectChamfer = CRect(0,0,nFrameWidth,rectChip.Height()+1);
+		if(CopyRectImg(lpHeader,ChipBufferSave.GetDataAddress(),CSize(nFrameWidth,rectChip.Height()+1),rectChamfer) == FALSE)
+			return ERR_CHIP_IMAGE_NULL_01;	
+	}
+
+	// Chip Inspection
+	if(insParam.bUse_ChipIns)
+	{
+		rectIns = CRect(0,0,rectChip.Width(),rectChip.Height());
+		rectIns.OffsetRect(nEdgeRight+nImgMargin,0);
+		if(AssertRect(rectIns,CSize(nFrameWidth,rectIns.Height())) == TRUE)
+		{
+			int nInsPitch = rectChip.Height()/5;
+
+			if(nInsPitch < CHIP_INS_PITCH)
+				nInsPitch = CHIP_INS_PITCH;
+
+			int nChipThres			= insParam.nChipThres;
+			int nChipThres_white	= insParam.nChipThres_White;
+			int nChipDiffThres		= insParam.nChipDiffThres;
+			int nMinSize			= insParam.nChipMinSize;
+			int nSideFilterSize		= insParam.nChipSideFilterSize;
+
+			nChipThres = (nChipThres <= 0) ? 0 : (255 <= nChipThres ) ? 255 : nChipThres;
+			nChipThres_white = (nChipThres_white <= 0) ? 0 : (255 <= nChipThres_white ) ? 255 : nChipThres_white;
+			nChipDiffThres = (nChipDiffThres <= 0) ? 0 : (255 <= nChipDiffThres ) ? 255 : nChipDiffThres;
+			nMinSize = (nMinSize <= 0) ? 1 : nMinSize;
+			nSideFilterSize = (nSideFilterSize <= 0) ? 0 : nSideFilterSize;
+
+			if(nChipThres != 0)
+			{
+				COwnerBuffer binBuffer;
+
+				Binarization_OpenCV(&ChipBuffer, &binBuffer, rectIns, nChipThres, nChipThres_white, nChipDiffThres, nInsPitch,iFrame,bSaveDebug);
+
+				Blob_OpenCV(&ChipBuffer, &binBuffer, rectIns, &blobData, CHIPREGTYPE_RIGHT, INS_DEFECT_CHIP, nMinSize, nSideFilterSize);
+
+			if (bSaveDebug)
+			{
+				CString		str;
+				str.Format(_T("%s\\%03d_%03d_ChipBin.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+				CBufferAttach		attach(str);
+				attach.AttachToFile(binBuffer);
+			}
+
+				binBuffer.ReleaseSpace();
+			}
+
+			if(nChipDiffThres != 255)
+			{
+				COwnerBuffer binBuffer(rectIns.Width(), rectIns.Height());		
+				COwnerBuffer insBuffer(rectIns.Width(), rectIns.Height());	
+				ZeroMemory(binBuffer.GetDataAddress(), binBuffer.GetSize());
+				ZeroMemory(insBuffer.GetDataAddress(), binBuffer.GetSize());
+
+				CopyRectImg(ChipBuffer.GetDataAddress(),insBuffer.GetDataAddress(),CSize(ChipBuffer.GetWidth(),ChipBuffer.GetHeight()),rectIns);
+
+				CRect		rectTmp = CRect(0,0,rectIns.Width(), rectIns.Height());	
+
+				VConvolutionConvC_Com(binBuffer,insBuffer,nChipDiffThres,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,nInsPitch,rectTmp);
+
+			Blob_OpenCV(&ChipBuffer, &binBuffer, rectIns, &blobData, CHIPREGTYPE_RIGHT, INS_DEFECT_CHIP, nMinSize, nSideFilterSize);
+
+			binBuffer.ReleaseSpace();
+				insBuffer.ReleaseSpace();
+			}
+		}
+	}
+
+	// Crack Inspection
+	if(insParam.bUse_CrackIns)
+	{
+		rectIns = CRect(0,0,rectCrack.Width(),rectCrack.Height());
+		rectIns.OffsetRect(nEdgeRight+nImgMargin,0);
+
+		if(AssertRect(rectIns,CSize(nFrameWidth,rectIns.Height())) == TRUE)
+		{			
+			int nCrackThres		= insParam.nCrackThres;
+			int nMinSize		= insParam.nCrackMinSize;
+			int nSideFilterSize = insParam.nCrackSideFilterSize;
+
+			nCrackThres = (nCrackThres <= 0) ? 0 : (255 <= nCrackThres ) ? 255 : nCrackThres;
+			nMinSize = (nMinSize <= 0) ? 1 : nMinSize;
+			nSideFilterSize = (nSideFilterSize <= 0) ? 0 : nSideFilterSize;
+
+			if(nCrackThres != 0)
+			{
+				COwnerBuffer binBuffer;
+
+				Binarization_OpenCV(&ChipBuffer, &binBuffer, rectIns, nCrackThres, 255);
+
+				Blob_OpenCV(&ChipBuffer, &binBuffer, rectIns, &blobData, CHIPREGTYPE_RIGHT, INS_DEFECT_CRACK, nMinSize, nSideFilterSize);
+
+				binBuffer.ReleaseSpace();
+			}	
+		}
+	}
+
+	// Broken Inspection
+	if(insParam.bUse_BrokenIns)
+	{
+		rectIns = CRect(0,0,rectBroken.Width(),rectBroken.Height());
+		rectIns.OffsetRect(nEdgeRight+nImgMargin,0);
+		if(AssertRect(rectIns,CSize(nFrameWidth,rectIns.Height())) == TRUE)
+		{		
+			int nBrokenThres	= insParam.nBrokenThres;
+			int nMinSize		= insParam.nBrokenMinSize;
+			int nSideFilterSize = insParam.nBrokenSideFilterSize;
+
+			nBrokenThres = (nBrokenThres <= 0) ? 0 : (255 <= nBrokenThres ) ? 255 : nBrokenThres;
+			nMinSize = (nMinSize <= 0) ? 1 : nMinSize;
+			nSideFilterSize = (nSideFilterSize <= 0) ? 0 : nSideFilterSize;
+
+			if(nBrokenThres != 0)
+			{
+				nBrokenThres = (nBrokenThres <= 0) ? 0 : (255 <= nBrokenThres ) ? 255 : nBrokenThres;
+
+				COwnerBuffer binBuffer;
+
+				Binarization_OpenCV(&ChipBuffer, &binBuffer, rectIns, nBrokenThres, 255);
+
+				Blob_OpenCV(&ChipBuffer, &binBuffer, rectIns, &blobData, CHIPREGTYPE_RIGHT, INS_DEFECT_BROKEN, nMinSize, nSideFilterSize);
+
+				binBuffer.ReleaseSpace();
+			}	
+		}
+	}
+
+	// Burr Inspection
+	if(insParam.bUse_BurrIns)
+	{
+		rectIns = CRect(nEdgeLeft-rectChip.Width(),0,nEdgeLeft,rectChip.Height());
+		rectIns.OffsetRect(-nImgBurrMargin,0);	
+		if(rectIns.left < 0)
+			rectIns.left = 0;
+		if(rectIns.right >= nFrameWidth)
+			rectIns.right = nFrameWidth-1;
+
+		if(AssertRect(rectIns,CSize(nFrameWidth,rectIns.Height())) == TRUE)
+		{
+			int nBurrThres		= insParam.nBurrThres;
+			int nMinSize		= insParam.nBurrMinSize;
+			int nSideFilterSize = insParam.nBurrSideFilterSize;
+
+			nBurrThres = (nBurrThres <= 0) ? 0 : (255 <= nBurrThres ) ? 255 : nBurrThres;
+
+			int nInsPitch = rectChip.Height()/5;
+
+			if(nInsPitch < CHIP_INS_PITCH)
+				nInsPitch = CHIP_INS_PITCH;	
+
+			if(nBurrThres != 255)
+			{
+				COwnerBuffer binBuffer(rectIns.Width(), rectIns.Height());		
+				COwnerBuffer insBuffer(rectIns.Width(), rectIns.Height());	
+				ZeroMemory(binBuffer.GetDataAddress(), binBuffer.GetSize());
+				ZeroMemory(insBuffer.GetDataAddress(), binBuffer.GetSize());
+
+				CopyRectImg(ChipBuffer.GetDataAddress(),insBuffer.GetDataAddress(),CSize(ChipBuffer.GetWidth(),ChipBuffer.GetHeight()),rectIns);
+
+				CRect		rectTmp = CRect(0,0,rectIns.Width(), rectIns.Height());	
+
+				VConvolutionConvC_Com(binBuffer,insBuffer,nBurrThres,CHIPREGTYPE_LEFT,INS_DEFECT_BURR,nInsPitch,rectTmp);
+				
+				Blob_OpenCV(&ChipBuffer, &binBuffer, rectIns, &blobData, CHIPREGTYPE_LEFT, INS_DEFECT_BURR, nMinSize, nSideFilterSize);
+
+				if (bSaveDebug)
+				{
+					CString		str;
+					str.Format(_T("%s\\%03d_%03d_BurrRes.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+					CBufferAttach		attach(str);
+					attach.AttachToFile(binBuffer);
+				}
+
+				binBuffer.ReleaseSpace();
+				insBuffer.ReleaseSpace();
+			}
+		}
+	}
+
+	if (bSaveDebug)
+	{
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Chip.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach		attach(str);
+		attach.AttachToFile(ChipBufferSave);
+	}
+
+	InsertEdgeBlobToDefect(blobData);
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::FilteringEdgeBlob(std::vector<CChipBlob> &vecBlob,int nBaseLeft,int nBaseRight,int nDetMargin,int nImgBurrMargin)
+{
+	std::vector<CChipBlob>	vecTmp;
+	std::vector<CChipBlob>::iterator it;
+
+	for(it=vecBlob.begin();it!=vecBlob.end();it++)
+	{
+		if(it->s_RegionType == CHIPREGTYPE_LEFT)
+		{
+			if(abs(it->s_DefectRect.right-nBaseLeft) > nImgBurrMargin)
+				continue;
+		}
+		else if(it->s_RegionType == CHIPREGTYPE_RIGHT)
+		{
+			if(abs(it->s_DefectRect.left-nBaseRight) > nDetMargin)
+				continue;
+		}
+
+		if(m_nDefectCnt >= MAX_CHIP_DEFECT_COUNT)
+			return FALSE;
+
+		CChipBlob		*pBlob = &m_DefectBlob[m_nDefectCnt];
+		if(pBlob == NULL)
+			continue;
+
+		*pBlob = *it;			
+		m_nDefectCnt++;
+	}	
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::InsertEdgeBlobToDefect(std::vector<CChipBlob> &vecBlob)
+{
+	std::vector<CChipBlob>	vecTmp;
+	std::vector<CChipBlob>::iterator it;
+
+	for(it=vecBlob.begin();it!=vecBlob.end();it++)
+	{
+		if(m_nDefectCnt >= MAX_CHIP_DEFECT_COUNT)
+			return FALSE;
+
+		CChipBlob		*pBlob = &m_DefectBlob[m_nDefectCnt];
+		if(pBlob == NULL)
+			continue;
+
+		*pBlob = *it;			
+		m_nDefectCnt++;
+	}	
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::CopyRectImg(LPBYTE pOrg,LPBYTE pTgt,CSize szImg,CRect &rectIns)
+{
+	if(rectIns.Width() > szImg.cx || rectIns.top < 0 || rectIns.top > rectIns.bottom || rectIns.bottom < 0 || rectIns.bottom > szImg.cy)
+		return FALSE;
+	if(rectIns.left >= rectIns.right || rectIns.left < 0 || rectIns.right > szImg.cx)
+		return FALSE;
+
+	int			v;
+	int			dv = 0;
+
+	for(v=rectIns.top;v<rectIns.bottom;v++,dv++)
+	{
+		CopyMemory(pTgt+dv*rectIns.Width(),pOrg+v*szImg.cx+rectIns.left,rectIns.Width());
+	}
+
+	return TRUE;
+}
+
+double	CChamferInspect::FindTraceLine(CSISBuffer &CannyImg,int nStart)
+{
+	int			nCount = 0;
+	int			u,v,uS,uE;
+	double		dRatio = 0;
+
+	uS = nStart-1;
+	uE = nStart+1;
+	if(uS < 0)
+	{
+		uS = 0; 
+		uE = uS + 2;
+	}
+	if(uE >= CannyImg.GetWidth())
+	{
+		uE=CannyImg.GetWidth()-1; 
+		uS = uE-2;
+	}
+
+	for(v=1;v<CannyImg.GetHeight()-1;v++)
+	{
+		for(u=uS;u<=uE;u++)
+		{
+			if(*CannyImg.GetDataAddress(u,v) == 255)
+			{
+				nCount++;
+				break;
+			}
+		}
+	}
+
+	if(nCount > 0)
+	{
+		dRatio = (double)nCount/(double)(CannyImg.GetHeight()-2);
+	}
+
+	return dRatio;
+}
+
+BOOL CChamferInspect::FindAdptThres(CSISBuffer &pOrg,CSISBuffer &CannyImg,int &nSetThres,int nForecast_S,ChipThresMode emThresMode)
+{
+#define FIND_ADPT_LINE_RATIO 0.4
+#define RE_FIND_ADPT_LINE_RATIO 0.8
+	int			u;
+	double		dWidthRatio;	
+	EDGEPOS		EdgePos;
+	int			nWSize = 4;
+	CRect		rect,rectImg;		
+	int			nVSize = (CannyImg.GetHeight()/6)/2;
+	int			nVS = CannyImg.GetHeight()/2-nVSize;
+	int			nVE = CannyImg.GetHeight()/2+nVSize;
+	int			nStart,nEnd,nDiff;	
+	
+	nStart = nForecast_S+1;
+	nEnd = nStart + (CannyImg.GetWidth()-nWSize-nForecast_S)/2;
+	nDiff = 0;
+	for(u=nStart;u<nEnd;u++)	
+	{
+		dWidthRatio = (double)m_pCannyWidthCnt[u]/(double)(CannyImg.GetHeight()-2);
+		if(dWidthRatio >= FIND_ADPT_LINE_RATIO)
+		{	
+			rect = CRect(u+1,nVS,u+1+nWSize,nVE);
+			if(rect.right >= pOrg.GetWidth())
+				continue;
+			EdgePos.dRight = GetAreaAVG(pOrg.GetDataAddress(),rectImg,rect);
+
+			rect = CRect(u-nWSize-1,nVS,u-1,nVE);
+			if(rect.left < 0)
+				continue;
+			EdgePos.dLeft = GetAreaAVG(pOrg.GetDataAddress(),rectImg,rect);
+			
+			if(EdgePos.dRight < EdgePos.dLeft)
+				continue;
+
+			dWidthRatio = FindTraceLine(CannyImg,u);
+			if(dWidthRatio < RE_FIND_ADPT_LINE_RATIO)
+				continue;
+
+			if(emThresMode == THRESMODE_ADAPTIVE)
+			{				
+				nSetThres = (int)(EdgePos.dLeft*1.2+EdgePos.dRight)/2;				
+				break;
+			}
+			else
+			{				
+				if((int)(EdgePos.dRight-EdgePos.dLeft) > nDiff)
+				{
+					nDiff = (int)(EdgePos.dRight-EdgePos.dLeft);
+					nSetThres = (int)(EdgePos.dLeft*1.2+EdgePos.dRight)/2;
+				}
+			}
+		}		
+	}
+
+	return TRUE;
+}
+
+ChipErrCode CChamferInspect::Inspection(int *nResult, LPBYTE lpHeader,int nFrameWidth,CRect &rectChamfer,int nChamferThres,BOOL bChipIns,BOOL bChamfer,CRect &rectChip,CRect &rectCrack,CRect &rectBroken
+	,int nChipThres,int nChipIDiffThres,int nCrackThres,int nBrokenThres,int nBurrThres,BOOL bSaveDebug,int *nPreForeLine,ChipThresMode emThresMode,int iFrame)
+{	
+	ReleaseBuffer();
+	ResetValue();	
+
+	if(lpHeader == NULL)	
+		return ERR_CHIP_IMAGE_NULL_01;	
+
+	COwnerBuffer		imgbuf(rectChamfer.Width(),rectChamfer.Height());
+
+	if(CopyRectImg(lpHeader,imgbuf.GetDataAddress(),CSize(nFrameWidth,rectChamfer.Height()+2),rectChamfer) == FALSE)
+		return ERR_CHIP_IMAGE_NULL_02;	
+
+	if(bSaveDebug == TRUE)
+	{
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Org.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(imgbuf);
+
+		// 		CSISBuffer		bfrOrg(lpHeader,nFrameWidth,rectChamfer.Height()+1);
+		// 		str.Format(_T("%s\\%03d_OrgFull.bmp"),PATH_DEBUGFOLDER,m_nSaveIndex);
+		// 		CBufferAttach	attach2(str);
+		// 		attach2.AttachToFile(bfrOrg);
+	}
+
+	CRect				rectIns = CRect(0,0,rectChamfer.Width(),rectChamfer.Height());
+	COwnerBuffer		BufferCanny;
+	if(PreProcessing(imgbuf.GetDataAddress(),rectIns,BufferCanny) == FALSE)
+	{		
+		ReleaseBuffer();
+		//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass Find Inspection 角菩: PreProcess",m_nCurCamId,m_nCurScanIdx);
+		return ERR_CHIP_PREPROCESS;
+	}	
+
+	if(BufferCanny.IsValidBuffer() == FALSE)
+	{
+		return ERR_CHIP_IMAGE_NULL_03;
+	}
+
+	if(bSaveDebug == TRUE)
+	{
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Can.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(BufferCanny);
+	}
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass Find Inspection : Find Edge Line",m_nCurCamId,m_nCurScanIdx);
+
+	int			nForecast_S,nForecast_E;
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass Find Inspection : Find ForeCast Line",m_nCurCamId,m_nCurScanIdx);
+
+	m_pGlassEdgeLine = new GLASSFINDDATA[rectIns.Height()+1];	
+	m_nGlassEdgeLineCnt = rectIns.Height()+1;	
+	m_pCannyWidthCnt = new int[BufferCanny.GetWidth()];
+	ZeroMemory(m_pCannyWidthCnt,sizeof(int)*BufferCanny.GetWidth());
+
+	FindEdgeLine(BufferCanny.GetDataAddress(0,0),rectIns);
+	*nResult = FindForeCastLine(imgbuf,rectIns,nForecast_S,nForecast_E,bChamfer);
+
+	//	nForecast_S = (int)CalEdgetoBin(BufferCanny.GetDataAddress(0,0),CSize(BufferCanny.GetDataWidth(),BufferCanny.GetHeight()),0.5);
+
+	double		dLeftEdge=0,dRightEdge=0;
+
+	dLeftEdge = dRightEdge = m_nForeEdgeLine[0] = m_nForeEdgeLine[1] = nForecast_E = nForecast_S;
+	if(nForecast_S <= 0)
+	{
+		if(nPreForeLine != NULL)		
+			nForecast_S = nPreForeLine[0];			
+		else
+		{
+			ReleaseBuffer();
+			//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass Find ForeCastLine 角菩 : FilteringEdge s[%d],e[%d]",m_nCurCamId,m_nCurScanIdx,nForecast_S,nForecast_E);
+			return ERR_CHIP_FIND_FORELINE;
+		}
+	}	
+
+	if(bChamfer == TRUE)
+	{
+		if(emThresMode >= THRESMODE_ADAPTIVE)
+		{		
+			FindAdptThres(imgbuf,BufferCanny,nChamferThres,nForecast_S,emThresMode);
+		}
+
+		COwnerBuffer		pInsBin;	
+		Binarization(imgbuf,pInsBin,nChamferThres);
+		if(pInsBin.IsValidBuffer() == FALSE)
+		{
+			return ERR_CHIP_IMAGE_NULL_03;
+		}	
+
+		if(bSaveDebug == TRUE)
+		{
+			CString		str;
+			str.Format(_T("%s\\%03d_%03d_Bin.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+			CBufferAttach	attach(str);
+			attach.AttachToFile(pInsBin);
+		}			
+
+		FindRightLine_Bin(pInsBin,nForecast_S,dRightEdge);
+
+		nForecast_E = (int)dRightEdge;
+		dLeftEdge = m_nForeEdgeLine[0] = nForecast_S;
+		dRightEdge = m_nForeEdgeLine[1] = nForecast_E;
+		if(nForecast_S <= 0 || nForecast_E <= 0 || nForecast_S > nForecast_E)
+		{
+			if(nPreForeLine != NULL)
+			{
+				nForecast_E = nPreForeLine[1];
+				m_dAvgThick = nForecast_E - nForecast_S;
+			}
+			else
+			{
+				ReleaseBuffer();
+				//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass Find Inspection 角菩 : FindLine s[%d],e[%d]",m_nCurCamId,m_nCurScanIdx,nForecast_S,nForecast_E);
+				return ERR_CHIP_FIND_RIGHTLINE;
+			}	
+		}	
+		else
+		{
+			m_dAvgThick = GetSubPixelThick(imgbuf,nForecast_S,dRightEdge,nChamferThres,dLeftEdge,dRightEdge);
+
+			//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass Find Inspection : FilteringEdge s[%.3f],e[%.3f],Thick[%.3f]",m_nCurCamId,m_nCurScanIdx,dLeftEdge,dRightEdge,m_dAvgThick);
+			if(m_dAvgThick < 0 || dLeftEdge < 0 || dRightEdge < 0 || dLeftEdge > dRightEdge)
+			{
+				ReleaseBuffer();
+				//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass Find Inspection 角菩 : AvgThick is Minus s[%.3f],e[%.3f],Thick[%.3f]",m_nCurCamId,m_nCurScanIdx,dLeftEdge,dRightEdge,m_dAvgThick);
+				return ERR_CHIP_SUBPIXEL;
+			}
+		}	
+
+		m_nForeEdgeLine[0] = (int)dLeftEdge+rectChamfer.left;
+		m_nForeEdgeLine[1] = (int)dRightEdge+rectChamfer.left;			
+	}
+	else
+	{
+		m_nForeEdgeLine[0] += rectChamfer.left;
+		m_nForeEdgeLine[1] += rectChamfer.left;
+	}
+
+	if(bChipIns == TRUE)
+	{		
+		m_nChipPairIndex = 0;
+
+		ChipInspection_Binarization(lpHeader,nFrameWidth,rectChip,rectCrack,rectBroken,nChipThres,nChipIDiffThres,nCrackThres,nBrokenThres,nBurrThres,m_nForeEdgeLine[0],m_nForeEdgeLine[1],bSaveDebug,iFrame);//20140613
+
+	}
+
+	if(bSaveDebug == TRUE)
+	{
+		if(imgbuf.IsValidBuffer() == TRUE && (int)dLeftEdge >= 0 && (int)dLeftEdge < imgbuf.GetWidth() 
+			&& (int)dRightEdge >= 0 && (int)dRightEdge < imgbuf.GetWidth())
+		{
+			int		i;
+			for(i=0;i<imgbuf.GetHeight();i++)
+			{
+				//if(i%2 == 0)
+				//	continue;
+				imgbuf.SetPixel((int)dLeftEdge,i,255);
+				imgbuf.SetPixel((int)dRightEdge,i,0);
+			}
+		}
+
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Res.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(imgbuf);
+
+		m_nSaveIndex++;
+	}
+
+	return ERR_CHIP_SUCCESS;
+}
+
+ChipErrCode CChamferInspect::Inspection(int *nResult,LPBYTE lpHeader,int nFrameWidth,CRect &rectChamfer,int nChamferThres,BOOL bChipIns,BOOL bChamfer,CRect &rectChip,CRect &rectCrack,CRect &rectBroken, InspectParam insParam, BOOL bSaveDebug/*=FALSE*/,int *nPreForeLine/*=NULL*/,ChipThresMode emThresMode/*=THRESMODE_FIXED*/,int iFrame /*= 0*/)
+{
+	ResetValue();	
+
+	if(lpHeader == NULL)	
+		return ERR_CHIP_IMAGE_NULL_01;			
+	
+	double		dLeftEdge=0,dRightEdge=0;	
+	CSISBuffer	imgbuf(lpHeader,nFrameWidth,rectChamfer.Height());
+
+	//bSaveDebug = TRUE;
+
+	if(bSaveDebug == TRUE)
+	{
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Org.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(imgbuf);
+	}
+
+	dLeftEdge = dRightEdge = m_nForeEdgeLine[0] = m_nForeEdgeLine[1] = rectChamfer.CenterPoint().x;
+	
+	if(bChamfer == TRUE)
+	{		
+		FindRightLine(imgbuf,rectChamfer,dLeftEdge,dRightEdge,nChamferThres);		
+
+		m_dAvgThick = dRightEdge - dLeftEdge;		
+
+		m_nForeEdgeLine[0] = (int)dLeftEdge;
+		m_nForeEdgeLine[1] = (int)dRightEdge;			
+	}
+
+	if(bChipIns == TRUE)
+	{		
+		m_nChipPairIndex = 0;
+
+		ChipInspection_Binarization_OpenCV(lpHeader,nFrameWidth,rectChip,rectCrack,rectBroken,insParam,m_nForeEdgeLine[0],m_nForeEdgeLine[1],bSaveDebug,iFrame); //20201114
+	}
+
+	if(bSaveDebug == TRUE)
+	{
+		COwnerBuffer		dispbuf(imgbuf.GetWidth(),imgbuf.GetHeight());
+
+		CopyMemory(dispbuf.GetDataAddress(),imgbuf.GetDataAddress(),dispbuf.GetDataSize());
+
+		if(dispbuf.IsValidBuffer() == TRUE && (int)dLeftEdge >= 0 && (int)dLeftEdge < dispbuf.GetWidth() 
+			&& (int)dRightEdge >= 0 && (int)dRightEdge < dispbuf.GetWidth())
+		{
+			int		i;
+			for(i=0;i<dispbuf.GetHeight();i++)
+			{
+				//if(i%2 == 0)
+				//	continue;
+				dispbuf.SetPixel((int)dLeftEdge,i,255);
+				dispbuf.SetPixel((int)dRightEdge,i,0);
+			}
+		}
+
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Res.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(dispbuf);
+
+		m_nSaveIndex++;
+	}
+
+	return ERR_CHIP_SUCCESS;
+}
+
+/*
+ChipErrCode CChamferInspect::Inspection(int *nResult,LPBYTE lpHeader,int nFrameWidth,CRect &rectChamfer,int nChamferThres,BOOL bChipIns,BOOL bChamfer,CRect &rectChip,CRect &rectCrack,CRect &rectBroken, InspectParam insParam, BOOL bSaveDebug,int *nPreForeLine,ChipThresMode emThresMode,int iFrame)
+{
+	ReleaseBuffer();
+	ResetValue();	
+
+	if(lpHeader == NULL)	
+		return ERR_CHIP_IMAGE_NULL_01;	
+
+	COwnerBuffer		imgbuf(rectChamfer.Width(),rectChamfer.Height());
+
+	if(CopyRectImg(lpHeader,imgbuf.GetDataAddress(),CSize(nFrameWidth,rectChamfer.Height()+2),rectChamfer) == FALSE)
+		return ERR_CHIP_IMAGE_NULL_02;	
+
+	if(bSaveDebug == TRUE)
+	{
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Org.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(imgbuf);
+	}
+
+	CRect				rectIns = CRect(0,0,rectChamfer.Width(),rectChamfer.Height());
+	COwnerBuffer		BufferCanny;
+	if(PreProcessing(imgbuf.GetDataAddress(),rectIns,BufferCanny) == FALSE)
+	{		
+		ReleaseBuffer();
+		return ERR_CHIP_PREPROCESS;
+	}	
+
+	if(BufferCanny.IsValidBuffer() == FALSE)
+	{
+		return ERR_CHIP_IMAGE_NULL_03;
+	}
+
+	if(bSaveDebug == TRUE)
+	{
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Can.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(BufferCanny);
+	}
+
+	int			nForecast_S,nForecast_E;
+
+	m_pGlassEdgeLine = new GLASSFINDDATA[rectIns.Height()+1];
+
+	m_nGlassEdgeLineCnt = rectIns.Height()+1;
+
+	m_pCannyWidthCnt = new int[BufferCanny.GetWidth()];
+
+	ZeroMemory(m_pCannyWidthCnt,sizeof(int)*BufferCanny.GetWidth());
+
+	FindEdgeLine(BufferCanny.GetDataAddress(0,0),rectIns);
+	*nResult = FindForeCastLine(imgbuf,rectIns,nForecast_S,nForecast_E,bChamfer);
+
+	double		dLeftEdge=0,dRightEdge=0;
+
+	dLeftEdge = dRightEdge = m_nForeEdgeLine[0] = m_nForeEdgeLine[1] = nForecast_E = nForecast_S;
+	if(nForecast_S <= 0)
+	{
+		if(nPreForeLine != NULL)		
+			nForecast_S = nPreForeLine[0];			
+		else
+		{
+			ReleaseBuffer();
+
+			return ERR_CHIP_FIND_FORELINE;
+		}
+	}	
+
+	if(bChamfer == TRUE)
+	{
+		if(emThresMode >= THRESMODE_ADAPTIVE)
+		{		
+			FindAdptThres(imgbuf,BufferCanny,nChamferThres,nForecast_S,emThresMode);
+		}
+
+		COwnerBuffer		pInsBin;	
+		Binarization(imgbuf,pInsBin,nForecast_S,nChamferThres);
+		if(pInsBin.IsValidBuffer() == FALSE)
+		{
+			return ERR_CHIP_IMAGE_NULL_03;
+		}	
+
+		if(bSaveDebug == TRUE)
+		{
+			CString		str;
+			str.Format(_T("%s\\%03d_%03d_Bin.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+			CBufferAttach	attach(str);
+			attach.AttachToFile(pInsBin);
+		}			
+
+		FindRightLine(pInsBin,nForecast_S,dRightEdge);
+
+		nForecast_E = (int)dRightEdge;
+		dLeftEdge = m_nForeEdgeLine[0] = nForecast_S;
+		dRightEdge = m_nForeEdgeLine[1] = nForecast_E;
+		if(nForecast_S <= 0 || nForecast_E <= 0 || nForecast_S > nForecast_E)
+		{
+			if(nPreForeLine != NULL)
+			{
+				nForecast_E = nPreForeLine[1];
+				m_dAvgThick = nForecast_E - nForecast_S;
+			}
+			else
+			{
+				ReleaseBuffer();
+
+				return ERR_CHIP_FIND_RIGHTLINE;
+			}	
+		}	
+		else
+		{
+			m_dAvgThick = GetSubPixelThick(imgbuf,nForecast_S,dRightEdge,nChamferThres,dLeftEdge,dRightEdge);
+
+			if(m_dAvgThick < 0 || dLeftEdge < 0 || dRightEdge < 0 || dLeftEdge > dRightEdge)
+			{
+				ReleaseBuffer();
+
+				return ERR_CHIP_SUBPIXEL;
+			}
+		}	
+
+		m_nForeEdgeLine[0] = (int)dLeftEdge+rectChamfer.left;
+		m_nForeEdgeLine[1] = (int)dRightEdge+rectChamfer.left;			
+	}
+	else
+	{
+		m_nForeEdgeLine[0] += rectChamfer.left;
+		m_nForeEdgeLine[1] += rectChamfer.left;
+	}
+
+	if(bChipIns == TRUE)
+	{		
+		m_nChipPairIndex = 0;
+
+		ChipInspection_Binarization_OpenCV(lpHeader,nFrameWidth,rectChip,rectCrack,rectBroken,insParam,m_nForeEdgeLine[0],m_nForeEdgeLine[1],bSaveDebug,iFrame); //20201114
+	}
+
+	if(bSaveDebug == TRUE)
+	{
+		if(imgbuf.IsValidBuffer() == TRUE && (int)dLeftEdge >= 0 && (int)dLeftEdge < imgbuf.GetWidth() 
+			&& (int)dRightEdge >= 0 && (int)dRightEdge < imgbuf.GetWidth())
+		{
+			int		i;
+			for(i=0;i<imgbuf.GetHeight();i++)
+			{
+				//if(i%2 == 0)
+				//	continue;
+				imgbuf.SetPixel((int)dLeftEdge,i,255);
+				imgbuf.SetPixel((int)dRightEdge,i,0);
+			}
+		}
+
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_Res.bmp"),PATH_DEBUGFOLDER,iFrame,m_nSaveIndex);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(imgbuf);
+
+		m_nSaveIndex++;
+	}
+
+	return ERR_CHIP_SUCCESS;
+}
+*/
+
+#define DEFINE_MIN_BMPOSLINE 1
+double CChamferInspect::FindBPosLine(CSISBuffer &bufferOrg,int nThres)
+{	
+	if(bufferOrg.IsValidBuffer() == FALSE)
+		return -1;
+
+	COwnerBuffer pBin(bufferOrg.GetWidth(),bufferOrg.GetHeight());	
+	if(pBin.IsValidBuffer() == FALSE)
+		return -1;
+	CopyMemory(pBin.GetDataAddress(0,0),bufferOrg.GetDataAddress(0,0),bufferOrg.GetDataSize());
+
+	CRect		rectIns,rect;
+	int			nCropWidth = pBin.GetWidth()/10;
+
+	rectIns =  CRect(pBin.GetWidth()-nCropWidth-1,0,pBin.GetWidth()-1,pBin.GetHeight());
+	rect = CRect(0,0,pBin.GetDataWidth(),pBin.GetHeight());
+
+	//	int			nAreaValue = (int)GetAreaAVG(pBin.GetDataAddress(0,0),rectIns,rect);	
+	//	nThres = nAreaValue+10;	
+	//nThres = (int)AdaptiveThreshold(pBin.GetDataAddress(0,0),pBin.GetWidth(),pBin.GetHeight(),pBin.GetDataWidth(),nThres);		
+
+	CEdgeProc		EdgeProc;
+	EdgeProc.ThresholdProcessing(pBin.GetDataAddress(0,0),CSize(pBin.GetDataWidth(),pBin.GetHeight()),nThres,1);
+
+	ListEdgeBlobData blobResultList;
+	ListEdgeBlobDataIt		it;
+	CEdgeBlobData			*pBlob;
+
+	// 	 	CString		strImg;
+	// 	 	strImg.Format("D:\\Image\\TestOrg.bmp");
+	// 	 	CBufferAttach		attach1(strImg);
+	// 	 	attach1.AttachToFile(bufferOrg);		
+	// 	 
+	// 	 	strImg.Format("D:\\Image\\TestBin.bmp");
+	// 	 	CBufferAttach		attach2(strImg);
+	// 	 	attach2.AttachToFile(pBin);	
+
+	COwnerBuffer		pBlobImg(pBin.GetWidth(),pBin.GetHeight());
+	if(pBlobImg.IsValidBuffer() == FALSE)
+		return -1;
+
+	CopyMemory(pBlobImg.GetDataAddress(0,0),pBin.GetDataAddress(0,0),pBin.GetDataSize());
+
+	CBlobTool		BlobTool;
+	if (!BlobTool.BlobAnalysis(pBlobImg.GetDataAddress(0,0), pBlobImg.GetWidth(), pBlobImg.GetHeight(), pBlobImg.GetDataWidth(), blobResultList, 2)) 
+		return -1;
+
+	CRect			rectBlob,rectMax(0,0,0,0);
+	int				nMaxArea = 0;
+	for(it=blobResultList.begin();it!=blobResultList.end();it++)
+	{
+		pBlob = *it;
+		if(pBlob == NULL)
+			continue;
+
+		if(pBlob->nPixelCount > nMaxArea)
+		{
+			rectBlob = CRect(pBlob->nLeft,pBlob->nTop,pBlob->nRight,pBlob->nBottom);
+			rectMax = rectBlob;
+		}
+
+		delete pBlob;
+	}
+	blobResultList.clear();
+
+	if(rectMax.Width() < DEFINE_MIN_BMPOSLINE || rectMax.Height() < (int)((double)bufferOrg.GetHeight()*0.6))
+		return -1;
+
+	int					nPos = rectMax.right;
+	CRect				rectCon(nPos-4,bufferOrg.GetHeight()/2-5,nPos+4,bufferOrg.GetHeight()/2+5);		
+
+	CEdgeFind		EdgeFind;
+	double dAvgPos = EdgeFind.FindLineSubPixel(bufferOrg.GetDataAddress(0,0),CSize(bufferOrg.GetDataWidth(),bufferOrg.GetHeight()),rectCon,3,-3,DIR_HORIZONTAL,SearchTypeIn2Out,EdgeTypeNegative);
+	if(dAvgPos <= 0)		
+		dAvgPos = nPos;
+
+	return dAvgPos;
+}
+
+void CChamferInspect::VConvolutionConvC_Polygon(CSISBuffer &pSaveImg,BOOL bSaveImage,int nCamID,int iScan, int iFrame,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,int nSetPitch, double dGradient, double dIntercept, int nDetMargin, double dLeft, int nOffset, int nOffsetY)
+{
+	if(dGradient == 0)
+		return;
+
+	int sx, ex, sy, ey;
+	sx=	0;
+	sy = nOffsetY;
+
+	if(sx > pImg.GetWidth())
+		return;
+	
+	ex= pImg.GetWidth();	
+	ey= pImg.GetHeight();
+	
+	int nConvWidth = 1;
+	int nConvHeight = 1;
+
+	nSetPitch = pImg.GetHeight() / 4;
+
+	if(ey < nSetPitch*3 || ex <= nConvWidth)
+		return;
+
+	int nPitch = nSetPitch;	
+	
+	int Threshold = nThres*(nConvWidth*nConvHeight);	
+	int NegThres = Threshold*-1;
+
+	int n2Pitch = nSetPitch*2;	
+	
+	double dYBoundary = dGradient * dLeft + dIntercept;
+	double dXBoundary = dIntercept / dGradient * -1.;
+
+	int		SrcValue = 0;
+	int		DestValue = 0;
+	int		DestValue1 = 0;
+	int		DestValue2 = 0;
+	int		SubValue = 0;	
+	int		i = 0;
+	int		SubValue2Pitch = 0;	
+	int		j;
+
+	double x,y;
+	BOOL bEdgeDefect;
+	double dDist;
+
+	sx = (int)dLeft + nOffset;
+
+	//0~pitch 芭府鳖瘤
+	for( j = sy; j < ey-n2Pitch; j++)
+	{
+		if(j+nPitch >= ey || j+n2Pitch >= ey)
+			continue;
+
+		for( i = sx; i < ex; i++)	
+		{	
+			////////////////////////////////////////////////////////
+			//咯扁辑 傍康开(力寇康开)阑 吧矾辰促 -促阿八荤
+			//double dGradient : 扁匡扁
+			//double dIntercept : 例祈
+			//y = dGradient * x + dIntercept
+			//x = (y - dIntercept) / dGradient
+			// ΓΑΑΑΑΑΑΑΑΔ
+			// Β 傍康开    /    Β
+			// Β(力寇康开)/     Β
+			// Β		  /      Β
+			// Β		 /       Β
+			// Β       /  臂扼胶Β
+			// Β	   /         Β
+			// Β     /(八荤康开)Β
+			// Β	 /           Β
+			// Β   /            Β
+			// Β BΒ            Β
+			// Β uΒ            Β
+			// Β rΒ            Β
+			// Β rΒ            Β
+			// Β  Β            Β
+			// Β  Β            Β
+			// Β  Β            Β
+			// ΖΑΑΑΑΑΑΑΑΕ
+			y = dGradient * i + dIntercept;
+			x = (double)(j - dIntercept) / dGradient;
+			if(j < (y + nOffsetY)|| i < (x + nOffset))
+				continue;
+			////////////////////////////////////////////////////////
+
+			SrcValue = *pImg.GetDataAddress(i,j);
+
+			bEdgeDefect = FALSE;
+			if(SrcValue <= Threshold)
+			{
+				dDist = fabs(dGradient * i - j + dIntercept) / sqrt(dGradient*dGradient + 1);
+				if((nDetMargin + nOffset >= dDist && dYBoundary >= j && dXBoundary >= i)	//措阿急
+					|| (nDetMargin + nOffset + dLeft >= i && dYBoundary < j)				//荐流急
+					|| (nDetMargin + nOffsetY >= j && dXBoundary < i))						//荐乞急俊 嘿绢乐绰巴父 叼棋栏肺 牢沥
+					bEdgeDefect = TRUE;
+
+				if(!InsertPairing(i,j,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP, bEdgeDefect))
+					continue;
+				if(bSaveImage)				
+					pSaveImg.SetPixel(i,j,0);
+			}
+
+/*
+
+			DestValue1 = *pImg.GetDataAddress(i,j+nPitch);
+			DestValue2 = *pImg.GetDataAddress(i,j+n2Pitch);
+
+			SubValue = DestValue1 - SrcValue;
+			SubValue2Pitch = DestValue2 - SrcValue;
+
+			bEdgeDefect = FALSE;
+
+			//	if ((SubValue > Threshold && SubValue2Pitch > Threshold) ||
+			//		(SubValue < NegThres && SubValue2Pitch < NegThres))
+			if ((SubValue > Threshold && SubValue2Pitch > Threshold))
+			{	
+				//措阿急俊 牢立茄扒 漂喊秒鞭
+				//痢苞 急荤捞狼 芭府 = abs(ax + by + c) / squt(a*a+b*b)
+				//a = dGradient, b = -1, c = dIntercept
+				
+				dDist = fabs(dGradient * i - j + dIntercept) / sqrt(dGradient*dGradient + 1);
+				if((nDetMargin + nOffset >= dDist && dYBoundary >= j && dXBoundary >= i)	//措阿急
+					|| (nDetMargin + nOffset + dLeft >= i && dYBoundary < j)				//荐流急
+					|| (nDetMargin + nOffset >= j && dXBoundary < i))						//荐乞急俊 嘿绢乐绰巴父 叼棋栏肺 牢沥
+					bEdgeDefect = TRUE;
+
+				if(!InsertPairing(vecPair,i,j,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2,CHIPREGTYPE_RIGHT, bEdgeDefect))
+					return;
+				if(bSaveImage)				
+					pSaveImg.SetPixel(i,j,0);
+
+			}
+			//Burr 搬窃
+			else if(SubValue < NegThres && SubValue2Pitch < NegThres && i < dLeft - nOffset)
+			{
+				if(dLeft - nOffset - nDetMargin <= i)
+					bEdgeDefect = TRUE;
+				
+				if(!InsertPairing(vecPair,i,j,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2,CHIPREGTYPE_LEFT, bEdgeDefect))
+					return;
+				if(bSaveImage)	
+					pSaveImg.SetPixel(i,j,1);
+			}		
+			
+			*/
+		}
+
+	}
+
+	//0~pitch 芭府鳖瘤
+	for( j = ey-1; j >= ey-n2Pitch; j--)
+	{
+		if(j-nPitch < 0 || j-n2Pitch < 0)
+			continue;
+
+		for( i = sx; i < ex; i++)	
+		{
+
+			////////////////////////////////////////////////////////
+			//咯扁辑 傍康开(力寇康开)阑 吧矾辰促 -促阿八荤
+			//double dGradient : 扁匡扁
+			//double dIntercept : 例祈
+			//y = dGradient * x + dIntercept
+			//x = (y - dIntercept) / dGradient
+			// ΓΑΑΑΑΑΑΑΑΔ
+			// Β 傍康开    /    Β
+			// Β(力寇康开)/     Β
+			// Β		  /      Β
+			// Β		 /       Β
+			// Β       /  臂扼胶Β
+			// Β	   /         Β
+			// Β     /(八荤康开)Β
+			// Β	 /           Β
+			// Β   /            Β
+			// Β BΒ            Β
+			// Β uΒ            Β
+			// Β rΒ            Β
+			// Β rΒ            Β
+			// Β  Β            Β
+			// Β  Β            Β
+			// Β  Β            Β
+			// ΖΑΑΑΑΑΑΑΑΕ
+			y = dGradient * i + dIntercept;
+			x = (j - dIntercept) / dGradient;
+			if(j < (y + nOffsetY)|| i < (x + nOffset))
+				continue;
+			////////////////////////////////////////////////////////
+
+			SrcValue = *pImg.GetDataAddress(i,j);
+
+			bEdgeDefect = FALSE;
+			if(SrcValue <= Threshold)
+			{
+				dDist = fabs(dGradient * i - j + dIntercept) / sqrt(dGradient*dGradient + 1);
+				if((nDetMargin + nOffset >= dDist && dYBoundary >= j && dXBoundary >= i)	//措阿急
+					|| (nDetMargin + nOffset + dLeft >= i && dYBoundary < j)				//荐流急
+					|| (nDetMargin + nOffsetY >= j && dXBoundary < i))						//荐乞急俊 嘿绢乐绰巴父 叼棋栏肺 牢沥
+					bEdgeDefect = TRUE;
+
+				if(!InsertPairing(i,j,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP, bEdgeDefect))
+					continue;
+				if(bSaveImage)				
+					pSaveImg.SetPixel(i,j,0);
+			}
+
+			/*
+			DestValue1 = *pImg.GetDataAddress(i,j-nPitch);
+			DestValue2 = *pImg.GetDataAddress(i,j-n2Pitch);			
+
+			SubValue = DestValue1 - SrcValue;
+			SubValue2Pitch = DestValue2 - SrcValue;
+
+			//	if ((SubValue > Threshold && SubValue2Pitch > Threshold) ||
+			//		(SubValue < NegThres && SubValue2Pitch < NegThres))
+			if ((SubValue > Threshold && SubValue2Pitch > Threshold))
+			{	
+				//措阿急俊 牢立茄扒 漂喊秒鞭
+				//痢苞 急荤捞狼 芭府 = abs(ax + by + c) / squt(a*a+b*b)
+				//a = dGradient, b = -1, c = dIntercept
+				bEdgeDefect = FALSE;
+				dDist = fabs(dGradient * i - j + dIntercept) / sqrt(dGradient*dGradient + 1);
+				if((nDetMargin + nOffset >= dDist && dYBoundary >= j && dXBoundary >= i)	//措阿急
+					|| (nDetMargin + nOffset + dLeft >= i && dYBoundary < j)				//荐流急
+					|| (nDetMargin + nOffset >= j && dXBoundary < i))						//荐乞急俊 嘿绢乐绰巴父 叼棋栏肺 牢沥
+					bEdgeDefect = TRUE;
+
+				if(!InsertPairing(vecPair,i,j,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2, CHIPREGTYPE_RIGHT, bEdgeDefect))
+					return;
+				if(bSaveImage)	
+					pSaveImg.SetPixel(i,j,0);
+			}
+			//Burr 搬窃
+			else if(SubValue < NegThres && SubValue2Pitch < NegThres && i < dLeft - nOffset)
+			{
+				if(dLeft - nOffset - nDetMargin <= i)
+					bEdgeDefect = TRUE;
+
+				if(!InsertPairing(vecPair,i,j,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2,CHIPREGTYPE_LEFT, bEdgeDefect))
+					return;
+				if(bSaveImage)	
+					pSaveImg.SetPixel(i,j,1);
+			}	
+			*/
+		}
+	}
+	
+	if(bSaveImage)
+	{
+		CString strFileName;
+		CString strFolderName;
+		CString strPath;
+
+		strFileName.Format(_T("Diagonal_%d_%d_%d.bmp"), nCamID,iScan, iFrame);
+		strFolderName.Format(_T("D:\\Image\\Corner\\%s"), strHpanelID);
+		CreateDirectory(strFolderName,NULL);	
+		strPath.Format(_T("%s\\%s"),strFolderName,strFileName);	
+		CBufferAttach		attach(strPath);
+		attach.AttachToFile(pSaveImg);
+	}
+
+}
+
+BOOL CChamferInspect::BlobDefect_Pixel_TypeRegionFilter(std::vector<CChipBlob> &vecBlob,std::vector<CChipPair> &vecPair,int nChipThres,int nMergeDist)
+{
+	if((int)vecPair.size() <= 0)
+		return TRUE;
+
+	int i, j;
+	BOOL		*bMerged,*bTemp;
+	int			*lFirstIndex;
+	int			nPair = (int)vecPair.size();
+	int			nBlob = 0;
+
+	bMerged = new BOOL[nPair];
+	bTemp = new BOOL[nPair];
+	lFirstIndex = new int[nPair];
+
+	// Index 概扁扁.
+	ZeroMemory(bMerged, nPair * sizeof(BOOL));
+	ZeroMemory(bTemp, nPair * sizeof(BOOL));
+	for (i = 0; i < nPair; i++)
+	{
+		lFirstIndex[i] = i;		
+	}
+
+	// 牢立 叼棋 赣瘤窍扁.
+	for(i = 0; i < nPair; i++)
+	{
+		for (j = i + 1; j < nPair; j++)
+		{
+			if (bMerged[j])// || vecPair[i].s_DefectType != vecPair[j].s_DefectType || vecPair[i].s_RegionType != vecPair[j].s_RegionType)
+				continue;		
+
+			if (abs(vecPair[j].s_nDefectY - vecPair[i].s_nDefectY) > nMergeDist)				// j绰 i焊促 农促.
+				continue;
+
+			if (abs(vecPair[j].s_nDefectX - vecPair[i].s_nDefectX) > nMergeDist)
+				continue;
+
+			lFirstIndex[j] = lFirstIndex[i];
+			bMerged[j] = TRUE;
+		}
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	int nStart = 0;
+	BOOL Ret = TRUE;
+
+	// 叼棋甸狼 荐父怒 贸府. - Blobing
+	int nBlobNum = 0;
+	int nDiffGray, nThres=nChipThres;
+	CChipBlob	chipBlob;
+
+	for (i = 0; i < nPair; i++)
+	{
+		if (vecPair[i].s_DefectType == CHIPDEFTYPE_DELETE)
+		{			
+			continue;
+		}
+
+		if (!bTemp[lFirstIndex[i]])	// 贸澜 唱鸥抄 搬窃 贸府.
+		{
+			if (nBlob >= nPair || nBlobNum >= 1000)
+				continue;			
+
+			bTemp[lFirstIndex[i]] = TRUE;
+
+			chipBlob.Reset();
+			CheckDefectRect(chipBlob, vecPair[i].s_nDefectX, vecPair[i].s_nDefectY);
+
+			chipBlob.SetDefectPair(vecPair[i].s_DefectPair);
+			chipBlob.s_nIndex			= lFirstIndex[i];
+			chipBlob.s_nDefectArea++;
+			chipBlob.s_nDefectX		+= vecPair[i].s_nDefectX;
+			chipBlob.s_nDefectY		+= vecPair[i].s_nDefectY;
+			chipBlob.s_DefectType		= vecPair[i].s_DefectType;			//角力 归搬窃篮 1,孺搬窃篮 0
+			chipBlob.s_sThreshold		= nThres;
+			chipBlob.s_RegionType		= vecPair[i].s_RegionType;
+			chipBlob.s_dThick			= vecPair[i].s_dThick;
+			chipBlob.s_bCornerChip		|= vecPair[i].s_bCornerChip;
+
+			// Gray 备窍扁
+			if (vecPair[i].s_nGraySrc > chipBlob.s_sLevelSrcMax)
+			{
+				chipBlob.s_sLevelSrcMax = vecPair[i].s_nGraySrc;
+				chipBlob.s_xLevelSrcMax = vecPair[i].s_nDefectX;
+				chipBlob.s_yLevelSrcMax = vecPair[i].s_nDefectY;
+			}
+			if (vecPair[i].s_nGraySrc < chipBlob.s_sLevelSrcMin)
+				chipBlob.s_sLevelSrcMin = vecPair[i].s_nGraySrc;
+			chipBlob.s_nLevelSrcSum += vecPair[i].s_nGraySrc;
+
+			if (vecPair[i].s_nGrayRef > chipBlob.s_sLevelRefMax)
+				chipBlob.s_sLevelRefMax = vecPair[i].s_nGrayRef;
+			if (vecPair[i].s_nGrayRef < chipBlob.s_sLevelRefMin)
+				chipBlob.s_sLevelRefMin = vecPair[i].s_nGrayRef;
+			chipBlob.s_nLevelRefSum += vecPair[i].s_nGrayRef;
+
+			nDiffGray = abs(vecPair[i].s_nGraySrc - vecPair[i].s_nGrayRef);
+			if (nDiffGray > chipBlob.s_sLevelDiffMax)
+			{
+				chipBlob.s_sLevelDiffMax = nDiffGray;
+				chipBlob.s_sDefectPeak = abs(chipBlob.s_sLevelDiffMax) - nThres;
+				//chipBlob.s_sDefectPeak = abs(chipBlob.s_sLevelDiffMax / 8) - nThres;
+			}
+			if (nDiffGray < chipBlob.s_sLevelDiffMin)
+				chipBlob.s_sLevelDiffMin = nDiffGray;
+			chipBlob.s_nLevelDiffSum += nDiffGray;
+
+			vecBlob.push_back(chipBlob);
+			nBlob++;
+			nBlobNum++;
+		}
+		else		// 唱吝俊 唱鸥抄 搬窃 贸府.
+		{
+			for(j = nBlob - 1; j >= 0; j--)
+			{
+				if (vecBlob[j].s_nIndex != lFirstIndex[i])
+					continue;								
+
+				CheckDefectRect(vecBlob[j], vecPair[i].s_nDefectX, vecPair[i].s_nDefectY);
+
+				vecBlob[j].SetDefectPair(vecPair[i].s_DefectPair);
+				vecBlob[j].s_nDefectArea++;
+				vecBlob[j].s_nDefectX += vecPair[i].s_nDefectX;
+				vecBlob[j].s_nDefectY += vecPair[i].s_nDefectY;
+				vecBlob[j].s_bCornerChip |= vecPair[i].s_bCornerChip;
+				if (nThres > vecBlob[j].s_sThreshold)
+					vecBlob[j].s_sThreshold = nThres;
+
+				// Gray 备窍扁
+				if (vecPair[i].s_nGraySrc > vecBlob[j].s_sLevelSrcMax)
+				{
+					vecBlob[j].s_sLevelSrcMax = vecPair[i].s_nGraySrc;
+					vecBlob[j].s_xLevelSrcMax = vecPair[i].s_nDefectX;
+					vecBlob[j].s_yLevelSrcMax = vecPair[i].s_nDefectY;
+				}
+				if (vecPair[i].s_nGraySrc < vecBlob[j].s_sLevelSrcMin)
+					vecBlob[j].s_sLevelSrcMin = vecPair[i].s_nGraySrc;
+				vecBlob[j].s_nLevelSrcSum += vecPair[i].s_nGraySrc;
+
+				if (vecPair[i].s_nGrayRef > vecBlob[j].s_sLevelRefMax)
+					vecBlob[j].s_sLevelRefMax = vecPair[i].s_nGrayRef;
+				if (vecPair[i].s_nGrayRef < vecBlob[j].s_sLevelRefMin)
+					vecBlob[j].s_sLevelRefMin = vecPair[i].s_nGrayRef;
+				vecBlob[j].s_nLevelRefSum += vecPair[i].s_nGrayRef;
+
+				nDiffGray = abs(vecPair[i].s_nGraySrc - vecPair[i].s_nGrayRef);
+				if (nDiffGray > vecBlob[j].s_sLevelDiffMax)
+				{
+					vecBlob[j].s_sLevelDiffMax = nDiffGray;
+					vecBlob[j].s_sDefectPeak = abs(vecBlob[j].s_sLevelDiffMax) - nThres;
+					//vecBlob[j].s_sDefectPeak = abs(vecBlob[j].s_sLevelDiffMax / 8) - nThres;
+				}
+				if (nDiffGray < vecBlob[j].s_sLevelDiffMin)
+					vecBlob[j].s_sLevelDiffMin = nDiffGray;
+				vecBlob[j].s_nLevelDiffSum += nDiffGray;
+
+				if(vecBlob[j].s_dThick < vecPair[i].s_dThick)
+					vecBlob[j].s_dThick = vecPair[i].s_dThick;
+
+				break;
+			}
+		}
+	}
+
+	// 谅钎 焊沥.
+	for (i = nStart; i < nBlob; i++)
+	{
+		if (vecBlob[i].s_nDefectArea > 0)
+		{
+			//vecBlob[i].s_nDefectX = vecBlob[i].s_nDefectX / vecBlob[i].s_nDefectArea;
+			//vecBlob[i].s_nDefectY = vecBlob[i].s_nDefectY / vecBlob[i].s_nDefectArea;
+			vecBlob[i].s_nDefectX = vecBlob[i].s_DefectRect.CenterPoint().x;
+			vecBlob[i].s_nDefectY = vecBlob[i].s_DefectRect.CenterPoint().y;
+			vecBlob[i].s_sLevelSrcAvg = vecBlob[i].s_nLevelSrcSum / vecBlob[i].s_nDefectArea;
+			vecBlob[i].s_sLevelRefAvg = vecBlob[i].s_nLevelRefSum / vecBlob[i].s_nDefectArea;
+			vecBlob[i].s_sLevelDiffAvg = vecBlob[i].s_nLevelDiffSum / vecBlob[i].s_nDefectArea;		
+			vecBlob[i].s_nDefectRScale = CalcRScale(vecBlob[i].s_ptVertex);			
+		}
+		else
+			vecBlob[i].s_bRemoved = TRUE;
+	}
+
+	delete[] bMerged;
+	delete[] bTemp;
+	delete[] lFirstIndex;
+
+	MergeDivision(vecBlob);
+
+	return Ret;
+}
+
+BOOL CChamferInspect::FilteringDiagonalEdgeBlob(std::vector<CChipBlob> &vecBlob)
+{
+	std::vector<CChipBlob>	vecTmp;
+	std::vector<CChipBlob>::iterator it;
+
+	for(it=vecBlob.begin();it!=vecBlob.end();it++)
+	{
+		if(it->s_bCornerChip == FALSE)
+			continue;		
+
+		vecTmp.push_back(*it);
+	}
+
+	vecBlob.clear();
+	for(it=vecTmp.begin();it!=vecTmp.end();it++)
+		vecBlob.push_back(*it);
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::ChipInspection_Corner(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID,int iScan, int iThread,int iFrame,CSISBuffer &ChipBuffer,int nChipThres,int nChipInsWidth,int nEdgeRight, double dGradient, double dIntercept, int nDetMargin, int nMargin, int nMarginY)
+{
+	if(ChipBuffer.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	if(ChipBuffer.GetHeight() < CHIP_INS_PITCH * 4)
+		return FALSE;
+
+	CRect		rectIns;	
+	CString		strImg;
+	
+	nChipInsWidth= nEdgeRight + nChipInsWidth - (nEdgeRight + nChipInsWidth)%4;
+	if(nChipInsWidth <= 0)
+		return FALSE;
+
+	/*strImg.Format("D:\\Image\\CutArea\\ChipInsOrg.bmp");
+	CBufferAttach		attachOrg(strImg);
+	attachOrg.AttachToFile(ChipBuffer);*/
+
+	
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : MakeChipImage Right",m_nCurCamId,m_nCurScanIdx);	
+
+	COwnerBuffer	InsRightBuffer, InsRightSaveBuffer;
+	int				nBaseRight;
+	
+	InsRightBuffer.SetSize(nChipInsWidth,ChipBuffer.GetHeight());
+	InsRightSaveBuffer.SetSize(nChipInsWidth,ChipBuffer.GetHeight());
+	if(InsRightBuffer.IsValidBuffer() == FALSE)
+		return FALSE;
+	if(InsRightSaveBuffer.IsValidBuffer() == FALSE)
+		return FALSE;
+	
+	rectIns = CRect(0,0,nChipInsWidth,ChipBuffer.GetHeight());	
+
+	if(rectIns.left < 0) rectIns.left = 0;
+	if(rectIns.right >= ChipBuffer.GetWidth()) rectIns.right = ChipBuffer.GetWidth()-1;
+	if(rectIns.Width() <= 0 || rectIns.Height() <= 0 || rectIns.top > rectIns.bottom)
+		return FALSE;
+	CSISBuffer::CopyBtoA(InsRightBuffer,0,0,ChipBuffer,rectIns);
+	CSISBuffer::CopyBtoA(InsRightSaveBuffer,0,0,ChipBuffer,rectIns);
+
+	nBaseRight = rectIns.left;
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : MakeChipImage Right end[%d,%d]",m_nCurCamId,m_nCurScanIdx,InsRightBuffer.GetWidth(),InsRightBuffer.GetHeight());
+	
+	//CopyBuffer(InsRightBuffer,pChipRight);
+/*
+	strImg.Format("D:\\Image\\CutArea\\%d_%d_%d_%.0f_%.0f_%d_%d[%d %d %d %d].bmp",iThread,iFrame,nChipThres,dGradient, dIntercept, nDetMargin, nEdgeRight
+		,rectIns.left,rectIns.top,rectIns.right,rectIns.bottom);
+	CBufferAttach		attachPre(strImg);
+	attachPre.AttachToFile(InsRightBuffer);
+
+	strImg.Format("D:\\Image\\CutArea\\ChipInsLeft.bmp");
+	CBufferAttach		attachLeft(strImg);
+	attachLeft.AttachToFile(InsLeftBuffer);	*/
+
+	std::vector<CChipPair>		vecPair;			
+	std::vector<CChipBlob>		blobRight;
+	
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : Inspection Right",m_nCurCamId,m_nCurScanIdx);
+	VConvolutionConvC_Polygon(InsRightSaveBuffer,bSaveImage,nCamID,iScan,iFrame,strHpanelID, InsRightBuffer,nChipThres,vecPair,CHIP_INS_PITCH, dGradient, dIntercept, nDetMargin, nEdgeRight, nMargin,nMarginY);	
+	BlobDefect_Pixel_TypeRegionFilter(blobRight,vecPair,nChipThres,nMergeRange);	
+	FilteringDiagonalEdgeBlob(blobRight);	
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : Inspection Right End",m_nCurCamId,m_nCurScanIdx);
+
+	std::vector<CChipBlob>::iterator	itBlob;
+
+	ReleaseChipBuffer();	
+	if((int)blobRight.size() > 0)
+	{
+		for(itBlob=blobRight.begin();itBlob!=blobRight.end();itBlob++)
+		{
+			if(m_nDefectCnt >= MAX_CHIP_DEFECT_COUNT)
+				return FALSE;
+
+			CChipBlob		*pBlob = &m_DefectBlob[m_nDefectCnt];
+			if(pBlob == NULL)
+				continue;
+			
+			*pBlob = *itBlob;
+			pBlob->s_DefectRect.OffsetRect(nBaseRight,0);
+			pBlob->s_nDefectX += nBaseRight;				
+			m_nDefectCnt++;
+		}
+		blobRight.clear();
+	}
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : End",m_nCurCamId,m_nCurScanIdx);	
+
+	return TRUE;
+}
+
+void CChamferInspect::SetCutAreaExpPos(int nSide,int nPosY, int nSize, int nERType, int nPosX, int nSizeX)
+{
+	STU_CHIPPINGINS_EXP_POS expPos;
+
+	expPos.nSide  = nSide;
+	expPos.nPosY = nPosY;
+	expPos.nSize = nSize;	
+	expPos.nERType = nERType;
+	expPos.nPosX = nPosX;
+	expPos.nSizeX = nSizeX;
+
+	//m_Log.DisplayEdgeLog("SetCutAreaExpPos %d,%d,%d,%d,%d,%d",nSide,nPosY,nSize,nERType,nPosX,nSizeX);		
+
+	m_expInsArea.push_back(expPos);
+}
+
+void CChamferInspect::GetCutAreaExpPos(CRect rectInsOrg,int nEdgeLeft, int nGlassStartLine, CRect &rectExpRegion,int nChipInsWidth, double dFindLeft)
+{
+	CRect recttemp;
+	rectExpRegion=CRect(-1,-1,-1,-1);
+
+	std::vector<STU_CHIPPINGINS_EXP_POS>::iterator	it;
+	STU_CHIPPINGINS_EXP_POS				expPos;
+
+	for(it=m_expInsArea.begin();it!=m_expInsArea.end();it++)
+	{
+		expPos = *it;
+
+		recttemp.left = nEdgeLeft + expPos.nPosX;
+		recttemp.right = nEdgeLeft + expPos.nPosX + expPos.nSizeX;
+		recttemp.top = expPos.nPosY + nGlassStartLine;
+		recttemp.bottom = expPos.nPosY + expPos.nSize + nGlassStartLine;
+
+		if(rectInsOrg.top > recttemp.bottom )
+			continue;
+		if(rectInsOrg.bottom < recttemp.top)
+			continue;
+		if(nEdgeLeft+nChipInsWidth < recttemp.left)
+			continue;
+		if(nEdgeLeft > recttemp.right)
+			continue;
+
+		//m_Log.DisplayEdgeLog(" recttemp %d %d %d %d",recttemp.left,recttemp.top,recttemp.right,recttemp.bottom);		
+		//m_Log.DisplayEdgeLog(" rectInsOrg %f %d %f %d",dFindLeft,rectInsOrg.top,dFindLeft+nChipInsWidth,rectInsOrg.bottom);		
+		//m_Log.DisplayEdgeLog(" 矫累 rectExpRegion %d %d %d %d",rectExpRegion.left,rectExpRegion.top,rectExpRegion.right,rectExpRegion.bottom);		
+
+		if(rectInsOrg.top >= recttemp.top)
+			rectExpRegion.top = rectInsOrg.top;	
+		else if(rectInsOrg.top <= recttemp.top)
+			rectExpRegion.top = recttemp.top;	
+
+		if(rectInsOrg.bottom <= recttemp.bottom)
+			rectExpRegion.bottom = rectInsOrg.bottom;
+		else if(rectInsOrg.bottom >= recttemp.bottom)
+			rectExpRegion.bottom = recttemp.bottom;	
+
+		if(nEdgeLeft >= recttemp.left)
+			rectExpRegion.left = (long)dFindLeft;
+		else if(nEdgeLeft <= recttemp.left)
+			rectExpRegion.left = recttemp.left;	
+
+		if(nEdgeLeft+nChipInsWidth <= recttemp.right)
+			rectExpRegion.right = (long)(dFindLeft+nChipInsWidth);
+		else if(nEdgeLeft+nChipInsWidth >= recttemp.right)
+			rectExpRegion.right = recttemp.right;	
+
+		//m_Log.DisplayEdgeLog(" OffsetRect 傈 rectExpRegion %d %d %d %d",rectExpRegion.left,rectExpRegion.top,rectExpRegion.right,rectExpRegion.bottom);		
+
+		rectExpRegion.OffsetRect(-(int)dFindLeft,-rectInsOrg.top);
+
+		//m_Log.DisplayEdgeLog(" 场 rectExpRegion %d %d %d %d",rectExpRegion.left,rectExpRegion.top,rectExpRegion.right,rectExpRegion.bottom);		
+		break;
+	}
+}
+
+ChipErrCode CChamferInspect::InspectCorner_ExtraPoly(CSISBuffer &BufferIns,int nThres,int nTop,int nLeft,STU_EXTRA_POLY &stuPoly,BOOL bReset,int nMergeReange)
+{
+	if(BufferIns.IsValidBuffer() == FALSE)
+		return ERR_CHIP_IMAGE_NULL_01;
+
+	int				x,y,iIter;	
+	int				nXStart,nXEnd,nInsW,nData;
+	std::vector<CChipPair>		vecPair;			
+	std::vector<CChipBlob>		blobTmp;	
+	LPBYTE			pImg;
+
+//	COwnerBuffer		imgbuf(BufferIns.GetWidth(),BufferIns.GetHeight());
+
+//	CopyMemory(imgbuf.GetDataAddress(0,0),BufferIns.GetDataAddress(0,0),BufferIns.GetWidth()*BufferIns.GetHeight());
+
+	nInsW = (stuPoly.nEL-stuPoly.nSL);	
+	for(y=stuPoly.nST,iIter=stuPoly.nTheHeight;y<=stuPoly.nEB;y++,iIter++)
+	{		
+		nXStart = (int)(static_cast<double>(stuPoly.nSL) * cos(stuPoly.dTheta) - static_cast<double>(iIter) * sin(stuPoly.dTheta));
+		nXEnd = nXStart+nInsW;
+
+		pImg = BufferIns.GetDataAddress(nXStart,y);
+		for(x=nXStart;x<=nXEnd;x++,pImg++)
+		{
+			nData = *pImg;
+			if(nData <= nThres)
+			{
+//				imgbuf.SetPixel(x,y,0);
+
+				if(!InsertPairing(x,y,nData,nThres,nData,nData,CHIPREGTYPE_LEFT,INS_DEFECT_CHIP))
+					break;
+			}
+		}
+	}	
+	
+// 	CString		strImg;
+// 	strImg.Format("D:\\Image\\CornerChip\\result_nSL[%d]_nST[%d]_nEB[%d]_nEL[%d].bmp",stuPoly.nSL,stuPoly.nST,stuPoly.nEB,stuPoly.nEL);
+// 	CBufferAttach	attach(strImg);
+// 	attach.AttachToFile(imgbuf);
+
+	if(GetPairDefectCount() <= 0)
+		return ERR_CHIP_SUCCESS;
+
+	BlobDefect_Pixel(blobTmp,nThres,nMergeReange);
+
+	if((int)blobTmp.size() > 0)
+	{
+		std::vector<CChipBlob>::iterator	itBlob;
+
+		if(bReset == TRUE)
+			ReleaseChipBuffer();	
+
+		for(itBlob=blobTmp.begin();itBlob!=blobTmp.end();itBlob++)
+		{
+			if(m_nDefectCnt >= MAX_CHIP_DEFECT_COUNT)
+				return ERR_CHIP_SUCCESS;
+
+			CChipBlob		*pBlob = &m_DefectBlob[m_nDefectCnt];
+			if(pBlob == NULL)
+				continue;
+
+			*pBlob = *itBlob;
+
+			pBlob->s_DefectRect.OffsetRect(nLeft,nTop);
+
+			pBlob->s_nDefectX += nLeft;
+			pBlob->s_nDefectY += nTop;
+
+			m_nDefectCnt++;
+		}
+		blobTmp.clear();
+	}
+
+	return ERR_CHIP_SUCCESS;
+}
+
+BOOL CChamferInspect::Blob_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, std::vector<CChipBlob>* vecBlobList, ChipResionType s_RegionType,DefectPosType s_DefectPos, int nMinSize, int nSideFilter, BOOL bROIOffset)
+{
+	if (pOriginImg == NULL || pBinImage == NULL || vecBlobList == NULL)
+		return FALSE;
+
+	if (pOriginImg->GetWidth() == 0 || pOriginImg->GetHeight() == 0)
+		return FALSE;
+
+	if (rtInsRect.Width() != pBinImage->GetWidth() || rtInsRect.Height() != pBinImage->GetHeight())
+		return FALSE;
+
+	cv::Mat pBinMat = cv::Mat::zeros(pBinImage->GetHeight(), pBinImage->GetWidth(), CV_8UC1);
+
+	CopyMemory(pBinMat.data, pBinImage->GetDataAddress(), pBinImage->GetSize());
+
+	cv::Mat matLabel, matStats, matCentrois;
+
+	int numOfLables = connectedComponentsWithStats(pBinMat, matLabel, matStats, matCentrois, 8);
+
+	std::vector<int> vecMin, vecMax, vecSum, vecPixelCount;
+
+	vecMin.resize(numOfLables, 9999);
+	vecMax.resize(numOfLables, -9999);
+	vecSum.resize(numOfLables, 0);
+	vecPixelCount.resize(numOfLables, 0);
+
+	int nBackGroundIdx = 0;
+
+	for (int i = 0; i < matLabel.rows; i++)
+	{
+		int* label = matLabel.ptr<int>(i);
+
+		for (int j = 0; j < matLabel.cols; j++)
+		{
+			int nLabelIdx = (int)label[j];
+
+			int nPxlValue = (int)pOriginImg->GetPixel(rtInsRect.left + j, rtInsRect.top + i);
+
+			if (pBinImage->GetPixel(j, i) == 0)
+				nBackGroundIdx = nLabelIdx;
+
+			if (nPxlValue < vecMin[nLabelIdx])
+				vecMin[nLabelIdx] = nPxlValue;
+
+			if (nPxlValue > vecMax[nLabelIdx])
+				vecMax[nLabelIdx] = nPxlValue;
+
+			vecSum[nLabelIdx] = vecSum[nLabelIdx] + nPxlValue;
+
+			vecPixelCount[nLabelIdx] = vecPixelCount[nLabelIdx] + 1;
+		}
+	}
+
+	for (int nIdx = 0; nIdx < numOfLables; nIdx++)
+	{
+		int area = matStats.at<int>(nIdx, cv::CC_STAT_AREA);
+		int left = matStats.at<int>(nIdx, cv::CC_STAT_LEFT);
+		int top = matStats.at<int>(nIdx, cv::CC_STAT_TOP);
+		int width = matStats.at<int>(nIdx, cv::CC_STAT_WIDTH);
+		int height = matStats.at<int>(nIdx, cv::CC_STAT_HEIGHT);
+
+		int x = (int)matCentrois.at<double>(nIdx, 0);
+		int y = (int)matCentrois.at<double>(nIdx, 1);
+
+		if (nBackGroundIdx == nIdx)
+			continue;
+
+		if (vecPixelCount[nIdx] < nMinSize)
+			continue;
+
+		CRect rtDefectArea;
+		rtDefectArea.left = left;
+		rtDefectArea.top = top;
+		rtDefectArea.right = left + width;
+		rtDefectArea.bottom = top + height;
+
+		if(0 < nSideFilter && s_RegionType == CHIPREGTYPE_RIGHT && nSideFilter <= rtDefectArea.left)
+			continue;
+
+		if(0 < nSideFilter && s_RegionType == CHIPREGTYPE_LEFT && rtDefectArea.right <= rtInsRect.Width() - nSideFilter)
+			continue;
+
+		if(bROIOffset == TRUE)
+			rtDefectArea.OffsetRect(rtInsRect.left, rtInsRect.top);
+
+
+		CChipBlob chipBlob;
+		chipBlob.Reset();
+		// CheckDefectRect(chipBlob, pPair->s_nDefectX, pPair->s_nDefectY);
+		// chipBlob.SetDefectPair(pPair->s_DefectPair);
+		chipBlob.s_DefectRect		= rtDefectArea;
+		chipBlob.s_nDefectRScale    = rtDefectArea.Width()*rtDefectArea.Height();
+		chipBlob.s_nIndex			= (short) vecBlobList->size();
+		chipBlob.s_nDefectArea		= vecPixelCount[nIdx];
+
+		if(bROIOffset == TRUE)
+		{
+			chipBlob.s_nDefectX			= x + rtInsRect.left;
+			chipBlob.s_nDefectY			= y + rtInsRect.top;
+		}
+		else
+		{
+			chipBlob.s_nDefectX			= x;
+			chipBlob.s_nDefectY			= y;
+		}
+
+		chipBlob.s_DefectType		= CHIPDEFTYPE_MIXED;	//pPair->s_DefectType;			//角力 归搬窃篮 1,孺搬窃篮 0
+		chipBlob.s_sThreshold		= 0;
+		chipBlob.s_RegionType		= s_RegionType;
+		chipBlob.s_dThick			= 0.0;
+		chipBlob.s_bCornerChip		= FALSE;
+		chipBlob.s_DefectJudgeType  = s_DefectPos;
+		chipBlob.s_sLevelSrcMax		= (short) vecMax[nIdx];
+		chipBlob.s_xLevelSrcMax		= (short) chipBlob.s_nDefectX;
+		chipBlob.s_yLevelSrcMax		= (short) chipBlob.s_nDefectY;
+		chipBlob.s_sLevelSrcMin		= (short) vecMin[nIdx];
+		chipBlob.s_nLevelSrcSum		= vecSum[nIdx];
+
+		vecBlobList->push_back(chipBlob);
+	}
+
+	return TRUE;
+}
+
+ChipErrCode CChamferInspect::InspectCorner_Extra(CSISBuffer &BufferIns,int nThres,int nTop,int nLeft,BOOL bReset,int nMergeReange)
+{
+	if(BufferIns.IsValidBuffer() == FALSE)
+		return ERR_CHIP_IMAGE_NULL_01;
+	
+	std::vector<CChipBlob>		blobTmp;	
+	LPBYTE						pImg = BufferIns.GetDataAddress();
+
+	int			x,y,iLoop;
+	
+	for(iLoop=0;iLoop<BufferIns.GetDataSize();iLoop++,pImg++)
+	{
+		if(*pImg <= nThres)
+		{
+			y = iLoop/BufferIns.GetWidth();
+			x = iLoop%BufferIns.GetWidth();
+
+			if(!InsertPairing(x,y,*pImg,nThres,*pImg, *pImg,CHIPREGTYPE_LEFT,INS_DEFECT_CHIP))
+				break;
+		}
+	}
+
+	if(GetPairDefectCount() <= 0)
+		return ERR_CHIP_SUCCESS;
+
+	BlobDefect_Pixel(blobTmp,nThres,nMergeReange);
+
+	if((int)blobTmp.size() > 0)
+	{
+		std::vector<CChipBlob>::iterator	itBlob;
+
+		if(bReset == TRUE)
+			ReleaseChipBuffer();	
+
+		for(itBlob=blobTmp.begin();itBlob!=blobTmp.end();itBlob++)
+		{
+			if(m_nDefectCnt >= MAX_CHIP_DEFECT_COUNT)
+				return ERR_CHIP_SUCCESS;
+
+			CChipBlob		*pBlob = &m_DefectBlob[m_nDefectCnt];
+			if(pBlob == NULL)
+				continue;
+
+			*pBlob = *itBlob;
+
+			pBlob->s_DefectRect.OffsetRect(nLeft,nTop);
+
+			pBlob->s_nDefectX += nLeft;
+			pBlob->s_nDefectY += nTop;
+
+			m_nDefectCnt++;
+		}
+		blobTmp.clear();
+	}
+
+	return ERR_CHIP_SUCCESS;
+}
+
+void CChamferInspect::BinalizeFind_CornerChip(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch, CRect rectExpRegion, int iFrame, int nIndex, int nCamID, int iScan, int nChippingInsOffset)//130115
+{
+	int sx, ex, sy, ey;
+	sx = nChippingInsOffset;//130115
+	sy = 0;//130115
+	ex= pImg.GetWidth();	
+	ey= pImg.GetHeight();
+
+	int Threshold = nThres;//*(nConvWidth*nConvHeight);	
+
+	int		SrcValue = 0;	
+	int		i = 0;	
+	int		j;	
+
+// 	if(rectExpRegion.left != -1)
+// 	{
+// 		m_Log.DisplayEdgeLog(" BinalizeFind_CornerChip rectExpRegion %d %d %d %d",rectExpRegion.left,rectExpRegion.top,rectExpRegion.right,rectExpRegion.bottom);		
+// 		m_Log.DisplayEdgeLog(" BinalizeFind_CornerChip sy %d ey %d sx %d ex %d",sy,ey,sx,ex);		
+// 	}
+
+	//0~pitch 芭府鳖瘤
+// 	if(s_RegionType == CHIPREGTYPE_RIGHT)
+// 	{
+	for( j = sy; j < ey; j++)
+	{
+		for( i = sx; i < ex; i++)	
+		{		
+ 				if(j>=rectExpRegion.top && j<=rectExpRegion.bottom && i>=rectExpRegion.left && i<=rectExpRegion.right)
+ 				{
+// // 					bSaveImage = TRUE;
+// // 					pSaveImg.SetPixel(i,j,0);
+ 					continue;
+ 				}
+
+			SrcValue = *pImg.GetDataAddress(i,j);
+				if (SrcValue < Threshold)					
+				{	
+					if(!InsertPairing(i,j,SrcValue,Threshold,SrcValue, SrcValue,s_RegionType,INS_DEFECT_CHIP))
+						return;
+// 					if(bSaveImage)
+// 					{				
+// 						pSaveImg.SetPixel(i,j,0);
+// 					}
+					}
+				}
+			}
+// 	}
+// 	else
+// 	{
+// 		for( j = sy; j < ey; j++)
+// 		{
+// 			for( i = sx; i < ex; i++)	
+// 			{		
+// 				SrcValue = *pImg.GetDataAddress(i,j);				
+// 				if (SrcValue < Threshold)					
+// 				{	
+// 					if(!InsertPairing(vecPair,i,j,SrcValue,Threshold,SrcValue, SrcValue,s_RegionType))
+// 						return;
+// 					// 					if(bSaveImage)
+// 					// 					{				
+// 					// 						pSaveImg.SetPixel(i,j,0);
+// 					// 					}
+// 				}	
+// 			}
+// 		}
+// 	}
+				
+ 	if(bSaveImage)
+ 	{
+ 		CString strFileName;
+ 		CString strFolderName;
+ 		CString strPath;
+ 		strFileName.Format(_T("Straight_%d_%d_%d_%d_%d_PCnt[%d].bmp"), nCamID,iScan, iFrame, nIndex,s_RegionType,(int)vecPair.size());
+ 		strFolderName.Format(_T("D:\\%s"), strHpanelID);
+ 		CreateDirectory(strFolderName,NULL);	
+ 		strPath.Format(_T("%s\\%s"),strFolderName,strFileName);	
+ 		CBufferAttach		attach(strPath);
+ 		attach.AttachToFile(pSaveImg);
+ 	}
+}
+
+void CChamferInspect::BinalizeFind_CornerChip_White(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch, CRect rectInsOrg,int nGlassStartLine,int nGlassEndLine, int nFrameHeight,int nCPosXOffset, int nDPosXOffset, int	nCPosYOffsetStart, int nCPosYOffsetEnd, int nDPosYOffsetStart, int nDPosYOffsetEnd, CRect rectExpRegion, int iFrame, int nIndex, int nCamID, int iScan)
+{
+	int sx, ex, sy, ey;
+	
+	//sx=	RICHT_WHITECHIP_OFFSET;//C搁 扁霖
+	sy= 0;
+	ex= pImg.GetWidth();
+	ey= pImg.GetHeight();
+	
+// 	int nStartOffset_Y = 260;
+// 	int nEndOffset_Y = 0;
+// 
+// 	if(iScan == 1)
+// 		nEndOffset_Y = 18610;
+// 	else if(iScan == 2)
+// 		nEndOffset_Y = 29679;
+	
+	int nStartOffset_Y,nEndOffset_Y;
+
+	nStartOffset_Y = nEndOffset_Y = 0;
+	if(iScan == 3)//C搁
+	{
+		sx = nCPosXOffset;
+		nStartOffset_Y = nCPosYOffsetStart;
+		nEndOffset_Y = nCPosYOffsetEnd;
+	}
+	else if(iScan == 2)//D搁
+	{
+		sx = nDPosXOffset;
+		nStartOffset_Y = nDPosYOffsetEnd;
+		nEndOffset_Y = nDPosYOffsetStart;
+	}
+
+	if(rectInsOrg.top<(nGlassStartLine+nStartOffset_Y))
+		sy=nGlassStartLine+nStartOffset_Y - rectInsOrg.top;
+	
+	if(rectInsOrg.bottom > (nGlassStartLine+nEndOffset_Y))
+		ey=ey-(rectInsOrg.bottom-(nGlassStartLine+nEndOffset_Y));
+	
+	//m_Log.DisplayEdgeLog(" iFrame %d nIndex %d nCamID %d iScans %d sx %d ex %d sy %d ey %d left %d top %d right %d bottom %d nGlassStartLine %d nGlassEndLine %d nStartOffset_Y %d nEndOffset_Y %d",iFrame, nIndex, nCamID, iScan, sx, ex, sy, ey,rectInsOrg.left,rectInsOrg.top,rectInsOrg.right,rectInsOrg.bottom,nGlassStartLine,nGlassEndLine,nStartOffset_Y,nEndOffset_Y);
+
+	int Threshold = nThres;//*(nConvWidth*nConvHeight);	
+
+	int		SrcValue = 0;	
+	int		i = 0;	
+	int		j;	
+	
+// 	if(rectExpRegion.left != -1)
+// 	{
+// 		m_Log.DisplayEdgeLog(" BinalizeFind_CornerChip_White rectExpRegion %d %d %d %d",rectExpRegion.left,rectExpRegion.top,rectExpRegion.right,rectExpRegion.bottom);		
+// 		m_Log.DisplayEdgeLog(" BinalizeFind_CornerChip_White sy %d ey %d sx %d ex %d",sy,ey,sx,ex);		
+// 	}	
+
+	//0~pitch 芭府鳖瘤
+// 	if(s_RegionType == CHIPREGTYPE_RIGHT)
+// 	{
+		for( j = sy; j < ey; j++)
+		{
+			for( i = sx; i < ex; i++)	
+			{		
+ 				if(j>=rectExpRegion.top && j<=rectExpRegion.bottom && i>=rectExpRegion.left && i<=rectExpRegion.right)
+ 				{
+//  					bSaveImage = TRUE;
+//  					pSaveImg.SetPixel(i,j,0);
+ 					continue;
+ 				}
+	
+				SrcValue = *pImg.GetDataAddress(i,j);				
+				if (SrcValue > Threshold)					
+				{	
+					if(!InsertPairing(i,j,Threshold-SrcValue,Threshold,SrcValue, SrcValue,s_RegionType,INS_DEFECT_CHIP))
+						return;
+// 	if(bSaveImage)
+// 	{
+//  						pSaveImg.SetPixel(i,j,0);
+//  					}
+				}	
+			}
+		}
+// 	}
+// 	else
+// 	{
+// 		for( j = sy; j < ey; j++)
+// 		{
+// 			for( i = sx; i < ex; i++)	
+// 			{		
+// 				SrcValue = *pImg.GetDataAddress(i,j);				
+// 				if (SrcValue < Threshold)					
+// 				{	
+// 					if(!InsertPairing(vecPair,i,j,SrcValue,Threshold,SrcValue, SrcValue,s_RegionType))
+// 						return;
+// 					// 					if(bSaveImage)
+// 					// 					{				
+// 					// 						pSaveImg.SetPixel(i,j,0);
+// 					// 					}
+// 				}	
+// 			}
+// 		}
+// 	}
+	
+	
+	if(bSaveImage)
+	{
+		CString strFileName;
+		CString strFolderName;
+		CString strPath;
+
+		strFileName.Format(_T("Straight_White_%d_%d_%d_%d_%d.bmp"), nCamID,iScan, iFrame, nIndex,s_RegionType);
+		strFolderName.Format(_T("D:\\Image\\Corner\\%s"), strHpanelID);
+		CreateDirectory(strFolderName,NULL);	
+		strPath.Format(_T("%s\\%s"),strFolderName,strFileName);	
+		CBufferAttach		attach(strPath);
+		attach.AttachToFile(pSaveImg);
+	}
+}
+
+BOOL CChamferInspect::FilteringEdgeBlob_TypeFilter(std::vector<CChipBlob> &vecBlob,ChipResionType emSide,int nBaseLine,int nDetMargin)
+{
+	std::vector<CChipBlob>	vecTmp;
+	std::vector<CChipBlob>::iterator it;
+
+	for(it=vecBlob.begin();it!=vecBlob.end();it++)
+	{
+		if(emSide == CHIPREGTYPE_LEFT)
+		{
+			if(abs(it->s_DefectRect.right-nBaseLine) > nDetMargin)
+				continue;	
+		}
+		else if(emSide == CHIPREGTYPE_RIGHT)
+		{
+			if(abs(it->s_DefectRect.left-nBaseLine) > nDetMargin)
+				continue;
+		}		
+
+		vecTmp.push_back(*it);
+	}
+
+	vecBlob.clear();
+	for(it=vecTmp.begin();it!=vecTmp.end();it++)
+		vecBlob.push_back(*it);
+
+	return TRUE;
+}
+
+void CChamferInspect::VConvolutionConvC_CornerChip(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch,int iFrame, int nIndex, int nCamID, int iScan)
+{
+	int sx, ex, sy, ey;
+	sx=	sy = 0;
+	ex= pImg.GetWidth();	
+	ey= pImg.GetHeight();
+
+
+	int nConvWidth = 1;
+	int nConvHeight = 1;
+
+	if(ey < nSetPitch*4 || ex <= nConvWidth)
+		return;
+
+	nSetPitch = pImg.GetHeight() / 4;
+	int nPitch = nSetPitch;	
+
+	int Threshold = nThres*(nConvWidth*nConvHeight);	
+	int NegThres = Threshold*-1;
+
+	int n2Pitch = nSetPitch*2;	
+
+	int		SrcValue = 0;
+	int		DestValue = 0;
+	int		DestValue1 = 0;
+	int		DestValue2 = 0;
+	int		SubValue = 0;	
+	int		i = 0;
+	int		SubValue2Pitch;	
+	int		j;	
+
+	BOOL bDefect = FALSE; 
+
+	//0~pitch 芭府鳖瘤
+	for( j = sy; j < ey-n2Pitch; j++)
+	{
+		if(j+nPitch >= ey || j+n2Pitch >= ey)
+			continue;
+
+		for( i = sx; i < ex; i++)	
+		{		
+			SrcValue = *pImg.GetDataAddress(i,j);
+			DestValue1 = *pImg.GetDataAddress(i,j+nPitch);
+			DestValue2 = *pImg.GetDataAddress(i,j+n2Pitch);
+
+			SubValue = DestValue1 - SrcValue;
+			SubValue2Pitch = DestValue2 - SrcValue;
+
+			if ((SubValue > Threshold && SubValue2Pitch > Threshold) ||
+				(SubValue < NegThres && SubValue2Pitch < NegThres))
+				//if ((SubValue > Threshold && SubValue2Pitch > Threshold))
+			{	
+
+				if(!InsertPairing(i,j,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2,s_RegionType,INS_DEFECT_CHIP))
+					return;
+				if(bSaveImage)
+				{
+					if(s_RegionType == CHIPREGTYPE_RIGHT)
+						pSaveImg.SetPixel(i,j,0);
+					else
+						pSaveImg.SetPixel(i,j,1);
+				}
+				bDefect = TRUE;
+			}		
+		}
+	}
+
+	//0~pitch 芭府鳖瘤
+	for( j = ey-1; j >= ey-n2Pitch; j--)
+	{
+		if(j-nPitch < 0 || j-n2Pitch < 0)
+			continue;
+
+		for( i = sx; i < ex; i++)	
+		{
+			SrcValue = *pImg.GetDataAddress(i,j);
+			DestValue1 = *pImg.GetDataAddress(i,j-nPitch);
+			DestValue2 = *pImg.GetDataAddress(i,j-n2Pitch);			
+
+			SubValue = DestValue1 - SrcValue;
+			SubValue2Pitch = DestValue2 - SrcValue;
+
+			if ((SubValue > Threshold && SubValue2Pitch > Threshold) ||
+				(SubValue < NegThres && SubValue2Pitch < NegThres))
+				//if ((SubValue > Threshold && SubValue2Pitch > Threshold))
+			{	
+
+				if(!InsertPairing(i,j,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2,s_RegionType,INS_DEFECT_CHIP))
+					return;
+				if(bSaveImage)
+				{
+					if(s_RegionType == CHIPREGTYPE_RIGHT)
+						pSaveImg.SetPixel(i,j,0);
+					else
+						pSaveImg.SetPixel(i,j,1);
+				}
+				bDefect = TRUE;
+			}	
+		}	
+	}
+	if(bSaveImage && bDefect)
+	{
+		CString strFileName;
+		CString strFolderName;
+		CString strPath;
+
+		strFileName.Format(_T("Straight_%d_%d_%d_%d_%d.bmp"), nCamID,iScan, iFrame, nIndex,s_RegionType);
+		strFolderName.Format(_T("%s\\%s"),PATH_DEFECTFOLDER, strHpanelID);
+		CreateDirectory(strFolderName,NULL);	
+		strPath.Format(_T("%s\\%s"),strFolderName,strFileName);	
+		CBufferAttach		attach(strPath);
+		attach.AttachToFile(pSaveImg);
+	}
+}
+
+BOOL CChamferInspect::OnlyChipInspection(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID, int iScan,int iFrame, int nIndex,CSISBuffer &ChipBuffer,int nChipThres
+										 , int nChipThres_L,int nChipInsWidth,int nEdgeLeft,int nEdgeRight, CRect rectInsOrg, int nGlassStartLine,int nGlassEndLine, int nFrameHeight
+										 , int nCPosXOffset, int nDPosXOffset, int nCPosYOffsetStart, int nCPosYOffsetEnd, int nDPosYOffsetStart, int nDPosYOffsetEnd, int nDetMargin
+										 , int nChippingInsOffset, double dFindLeft,int nAirThres)
+{
+	if(ChipBuffer.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	CRect		rectIns, rectInsLeft, rectInsRight_White;	
+	CString		strImg;
+	
+	nChipInsWidth= nChipInsWidth- nChipInsWidth%4;
+	if(nChipInsWidth <= 0)
+		return FALSE;
+
+// 	strImg.Format("D:\\Image\\CutArea\\ChipInsOrg.bmp");
+// 	CBufferAttach		attachOrg(strImg);
+// 	attachOrg.AttachToFile(ChipBuffer);
+	
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : MakeChipImage Right",m_nCurCamId,m_nCurScanIdx);	
+
+	COwnerBuffer	InsRightBuffer, InsLeftBuffer,InsRightSaveBuffer, InsLeftSaveBuffer;
+	COwnerBuffer	InsRightSaveBuffer_White;		
+	InsRightBuffer.SetSize(nChipInsWidth,ChipBuffer.GetHeight());
+	InsLeftBuffer.SetSize(nChipInsWidth,ChipBuffer.GetHeight());
+	InsRightSaveBuffer.SetSize(nChipInsWidth,ChipBuffer.GetHeight());
+	InsLeftSaveBuffer.SetSize(nChipInsWidth,ChipBuffer.GetHeight());
+	InsRightSaveBuffer_White.SetSize(nChipInsWidth,ChipBuffer.GetHeight());	
+
+	if(InsRightBuffer.IsValidBuffer() == FALSE)
+		return FALSE;
+	if(InsLeftBuffer.IsValidBuffer() == FALSE)
+		return FALSE;
+	if(InsRightSaveBuffer.IsValidBuffer() == FALSE)
+		return FALSE;
+	if(InsLeftSaveBuffer.IsValidBuffer() == FALSE)
+		return FALSE;
+	if(InsRightSaveBuffer_White.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	rectIns = CRect(nEdgeRight,0,nEdgeRight+nChipInsWidth,ChipBuffer.GetHeight());	
+
+	if(rectIns.left < 0) rectIns.left = 0;
+	if(rectIns.right >= ChipBuffer.GetWidth()) rectIns.right = ChipBuffer.GetWidth()-1;
+	if(rectIns.Width() <= 0 || rectIns.Height() <= 0 || rectIns.top > rectIns.bottom)
+		return FALSE;
+	CSISBuffer::CopyBtoA(InsRightBuffer,0,0,ChipBuffer,rectIns);	
+	CSISBuffer::CopyBtoA(InsRightSaveBuffer,0,0,ChipBuffer,rectIns);	
+
+	//nBaseRight = rectIns.left;
+	
+	rectInsLeft = CRect(nEdgeLeft- nChipInsWidth,0,nEdgeLeft,ChipBuffer.GetHeight());	
+
+	if(rectInsLeft.left < 0) rectInsLeft.left = 0;
+	if(rectInsLeft.right >= ChipBuffer.GetWidth()) rectInsLeft.right = ChipBuffer.GetWidth()-1;
+	if(rectInsLeft.Width() <= 0 || rectInsLeft.Height() <= 0 || rectInsLeft.top > rectInsLeft.bottom)
+		return FALSE;
+	CSISBuffer::CopyBtoA(InsLeftBuffer,0,0,ChipBuffer,rectInsLeft);
+	CSISBuffer::CopyBtoA(InsLeftSaveBuffer,0,0,ChipBuffer,rectInsLeft);	
+
+	rectInsRight_White = CRect(nEdgeRight,0,nEdgeRight+nChipInsWidth,ChipBuffer.GetHeight());	
+
+	if(rectInsRight_White.left < 0) rectInsRight_White.left = 0;
+	if(rectInsRight_White.right >= ChipBuffer.GetWidth()) rectInsRight_White.right = ChipBuffer.GetWidth()-1;
+	if(rectInsRight_White.Width() <= 0 || rectInsRight_White.Height() <= 0 || rectInsRight_White.top > rectInsRight_White.bottom)
+		return FALSE;
+	CSISBuffer::CopyBtoA(InsRightSaveBuffer_White,0,0,ChipBuffer,rectInsRight_White);
+
+	//nBaseLeft = rectInsLeft.left;
+	
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : MakeChipImage Right end[%d,%d]",m_nCurCamId,m_nCurScanIdx,InsRightBuffer.GetWidth(),InsRightBuffer.GetHeight());
+	
+	//CopyBuffer(InsRightBuffer,pChipRight);
+
+	/*strImg.Format("D:\\Image\\CutArea\\ChipInsRight.bmp");
+	CBufferAttach		attachPre(strImg);
+	attachPre.AttachToFile(InsBuffer);
+
+	strImg.Format("D:\\Image\\CutArea\\ChipInsLeft.bmp");
+	CBufferAttach		attachLeft(strImg);
+	attachLeft.AttachToFile(InsLeftBuffer);	*/
+
+	std::vector<CChipPair>		vecPair;			
+	std::vector<CChipBlob>		blobRight,blobLeft;
+	std::vector<CChipBlob>		blobRight_White;
+	
+	CRect rectExpRegion;
+	GetCutAreaExpPos(rectInsOrg,nEdgeLeft,nGlassStartLine, rectExpRegion,nChipInsWidth, dFindLeft);
+	
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : Inspection Right",m_nCurCamId,m_nCurScanIdx);		
+#define FINDDEFECT_METHOD_BINALIZE
+//#undef FINDDEFECT_METHOD_BINALIZE
+#ifdef FINDDEFECT_METHOD_BINALIZE
+	BinalizeFind_CornerChip(InsRightSaveBuffer,bSaveImage,strHpanelID, InsRightBuffer,nChipThres,vecPair,CHIPREGTYPE_RIGHT,CHIP_INS_PITCH,rectExpRegion,iFrame, nIndex, nCamID, iScan, nChippingInsOffset);
+#else
+	VConvolutionConvC_CornerChip(InsRightSaveBuffer,bSaveImage,strHpanelID, InsRightBuffer,nChipThres,vecPair,CHIPREGTYPE_RIGHT,CHIP_INS_PITCH,iFrame, nIndex, nCamID, iScan);
+#endif
+	BlobDefect_Pixel_TypeRegionFilter(blobRight,vecPair,nChipThres,nMergeRange);	
+
+// 	if(bSaveImage)
+// 	{
+// 		CString strFileName;
+// 		CString strFolderName;
+// 		CString strPath;
+// 		strFileName.Format("Straight_%d_%d_%d_%d_BCnt_Pre[%d].bmp", nCamID,iScan, iFrame, nIndex,(int)blobRight.size());
+// 		strFolderName.Format("D:\\%s", strHpanelID);
+// 		CreateDirectory(strFolderName,NULL);	
+// 		strPath.Format("%s\\%s",strFolderName,strFileName);	
+// 		CBufferAttach		attach(strPath);
+// 		attach.AttachToFile(InsRightSaveBuffer);
+// 	}
+// 
+ 	FilteringEdgeBlob_TypeFilter(blobRight,CHIPREGTYPE_RIGHT,0,nDetMargin);//葛福摆促.
+// 
+// 	if(bSaveImage)
+// 	{
+// 		CString strFileName;
+// 		CString strFolderName;
+// 		CString strPath;
+// 		strFileName.Format("Straight_%d_%d_%d_%d_BCnt[%d].bmp", nCamID,iScan, iFrame, nIndex,(int)blobRight.size());
+// 		strFolderName.Format("D:\\%s", strHpanelID);
+// 		CreateDirectory(strFolderName,NULL);	
+// 		strPath.Format("%s\\%s",strFolderName,strFileName);	
+// 		CBufferAttach		attach(strPath);
+// 		attach.AttachToFile(InsRightSaveBuffer);
+// 	}
+	vecPair.clear();
+
+#ifdef FINDDEFECT_METHOD_BINALIZE
+	BinalizeFind_CornerChip(InsLeftSaveBuffer,bSaveImage,strHpanelID, InsLeftBuffer,nChipThres_L,vecPair,CHIPREGTYPE_LEFT,CHIP_INS_PITCH,rectExpRegion,iFrame, nIndex, nCamID, iScan);
+#else
+	VConvolutionConvC_CornerChip(InsLeftSaveBuffer,bSaveImage,strHpanelID, InsLeftBuffer,nChipThres_L,vecPair,CHIPREGTYPE_LEFT,CHIP_INS_PITCH,iFrame, nIndex, nCamID, iScan);	
+#endif
+	BlobDefect_Pixel_TypeRegionFilter(blobLeft,vecPair,nChipThres_L,nMergeRange);	
+	FilteringEdgeBlob_TypeFilter(blobLeft,CHIPREGTYPE_LEFT,rectInsLeft.right-rectInsLeft.left,nDetMargin);
+	vecPair.clear();
+
+#define  RICHT_WHITECHIP_OFFSET 28 
+	if(nCamID == 0 && (iScan == 2 || iScan == 3))
+	{
+		int nChipThres_White = nAirThres;
+		BinalizeFind_CornerChip_White(InsRightSaveBuffer_White,bSaveImage,strHpanelID, InsRightBuffer,nAirThres,vecPair,CHIPREGTYPE_RIGHT_WHITE,CHIP_INS_PITCH,rectInsOrg,nGlassStartLine,nGlassEndLine,nFrameHeight, nCPosXOffset, nDPosXOffset, nCPosYOffsetStart, nCPosYOffsetEnd, nDPosYOffsetStart, nDPosYOffsetEnd, rectExpRegion, iFrame, nIndex, nCamID, iScan);
+		BlobDefect_Pixel_TypeRegionFilter(blobRight_White,vecPair,nAirThres,nMergeRange);	
+		//FilteringEdgeBlob_TypeFilter(blobRight_White,CHIPREGTYPE_RIGHT,rectInsRight_White.left+RICHT_WHITECHIP_OFFSET,nDetMargin);
+	}
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : Inspection Right End",m_nCurCamId,m_nCurScanIdx);
+
+	std::vector<CChipBlob>::iterator	itBlob;
+
+	ReleaseChipBuffer();	
+	
+	for(itBlob=blobRight.begin();itBlob!=blobRight.end();itBlob++)
+	{
+		if(m_nDefectCnt >= MAX_CHIP_DEFECT_COUNT)
+			return FALSE;
+
+		CChipBlob		*pBlob = &m_DefectBlob[m_nDefectCnt];
+		if(pBlob == NULL)
+			continue;
+		
+		*pBlob = *itBlob;
+	
+		pBlob->s_DefectRect.OffsetRect(rectIns.left,0);
+	
+		pBlob->s_nDefectX += rectIns.left;
+		
+		m_nDefectCnt++;
+	}
+	blobRight.clear();
+
+	for(itBlob=blobLeft.begin();itBlob!=blobLeft.end();itBlob++)
+	{
+		if(m_nDefectCnt >= MAX_CHIP_DEFECT_COUNT)
+			return FALSE;
+
+		CChipBlob		*pBlob = &m_DefectBlob[m_nDefectCnt];
+		if(pBlob == NULL)
+			continue;
+
+		*pBlob = *itBlob;
+		
+		pBlob->s_DefectRect.OffsetRect(rectInsLeft.left,0);
+		pBlob->s_nDefectX += rectInsLeft.left;
+			
+		m_nDefectCnt++;
+	}
+	blobLeft.clear();
+	
+	for(itBlob=blobRight_White.begin();itBlob!=blobRight_White.end();itBlob++)
+	{
+		if(m_nDefectCnt >= MAX_CHIP_DEFECT_COUNT)
+			return FALSE;
+
+		CChipBlob		*pBlob = &m_DefectBlob[m_nDefectCnt];
+		if(pBlob == NULL)
+			continue;
+
+		*pBlob = *itBlob;
+
+		pBlob->s_DefectRect.OffsetRect(rectInsRight_White.left,0);
+
+		pBlob->s_nDefectX += rectInsRight_White.left;
+
+		m_nDefectCnt++;
+	}
+	blobRight_White.clear();
+
+	//m_Log.DisplayEdgeLog("Cam[%d] Scan[%d] Glass ChipInspection : End",m_nCurCamId,m_nCurScanIdx);	
+
+	return TRUE;
+}
+
+void CChamferInspect::SetBrokenDefect(CRect	rectDefect)
+{
+	CChipBlob	*pChipBlob = &m_DefectBlob[m_nDefectCnt];
+	if(pChipBlob != NULL)
+	{
+		pChipBlob->s_nDefectX = rectDefect.CenterPoint().x;
+		pChipBlob->s_nDefectY = rectDefect.CenterPoint().y;
+		pChipBlob->s_DefectType = CHIPDEFTYPE_BLACK;
+		pChipBlob->s_dThick = rectDefect.Width();
+		pChipBlob->s_nDefectArea = rectDefect.Width()*rectDefect.Height();			
+		pChipBlob->s_nDefectRScale = rectDefect.Width()*rectDefect.Height();
+		pChipBlob->s_DefectRect = rectDefect;
+
+		m_nDefectCnt++;
+	}	
+}
+
+ChipErrCode CChamferInspect::Inspection_OnlyChip(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID, int iScan,int iFrame
+											, int nIndex,CRect &rectIns,CSISBuffer &ChipBuffer,int nChipInsWidth,int nChipThres, int nChipThres_L
+											,BOOL bChipIns, int nDetMargin, double dLeftThres, CRect rectInsOrg
+											, int nGlassStartLine,int nGlassEndLine, int nFrameHeight,int nCPosXOffset, int nDPosXOffset, int nCPosYOffsetStart
+											, int nCPosYOffsetEnd, int nDPosYOffsetStart, int nDPosYOffsetEnd, int nChippingInsOffset, double dFindLeft, int nAirThres)
+{
+	ResetValue();
+
+	//哭率 咖瘤甫 茫绰促.
+	CRect EdgeRect;
+	EdgeRect = rectIns;
+
+	int			nForecast_S,nForecast_E;
+	CEdgeFind	EdgeFind;
+	int			nDist = rectIns.Width()/10;
+
+	if(nDist < 5)
+		nDist = 5;
+
+	nForecast_S = rectIns.CenterPoint().x;
+	double dLeft = EdgeFind.FindGlassHorizontalLine(ChipBuffer.GetDataAddress(),CSize(rectIns.Width(),rectIns.Height()),EdgeRect,(int)dLeftThres,TRUE, nDist);
+	if(dLeft > 0)
+		nForecast_S = (int)dLeft;	
+
+	double		dLeftEdge,dRightEdge;
+
+	dRightEdge = nForecast_S;
+
+	nForecast_E = (int)dRightEdge;
+	dLeftEdge = dRightEdge;
+	m_nForeEdgeLine[0] = nForecast_S;
+	m_nForeEdgeLine[1] = nForecast_E;
+
+	if(nForecast_S <= 0)
+	{
+		SetBrokenDefect(rectIns);
+		ReleaseBuffer();
+		return ERR_CHIP_FIND_RIGHTLINE;
+	}	
+
+	m_nForeEdgeLine[0] = (int)dLeftEdge;
+	m_nForeEdgeLine[1] = (int)dRightEdge;	
+
+	if(m_nForeEdgeLine[0]-nChipInsWidth < 0)
+	{
+		m_nForeEdgeLine[0] = nChipInsWidth+1;
+	}
+
+	if(m_nForeEdgeLine[1]+nChipInsWidth >= ChipBuffer.GetWidth())
+	{
+		m_nForeEdgeLine[1] = ChipBuffer.GetWidth()-nChipInsWidth-1;
+	}
+
+	if(m_nForeEdgeLine[0] <= 0 || m_nForeEdgeLine[1] <= 0)
+	{
+		SetBrokenDefect(rectIns);
+		ReleaseBuffer();
+		return ERR_CHIP_CHECK_CHIPRECT;
+	}
+
+	if(bChipIns == TRUE)
+	{
+		OnlyChipInspection(nMergeRange,bSaveImage,strHpanelID, nCamID,iScan,iFrame, nIndex,ChipBuffer,nChipThres, nChipThres_L,nChipInsWidth
+			,m_nForeEdgeLine[0],m_nForeEdgeLine[1],rectInsOrg,nGlassStartLine,nGlassEndLine,nFrameHeight, nCPosXOffset, nDPosXOffset, nCPosYOffsetStart, nCPosYOffsetEnd
+			, nDPosYOffsetStart, nDPosYOffsetEnd,nDetMargin,nChippingInsOffset,dFindLeft,nAirThres);
+	}
+
+	return ERR_CHIP_SUCCESS;
+}
+
+BOOL CChamferInspect::Binarization_OpenCV( CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, int nThresholdLow, int nThresholdHigh )
+{
+	if(pOriginImg == NULL || pBinImage == NULL || pOriginImg->IsValidBuffer() == FALSE || rtInsRect.IsRectEmpty() || rtInsRect.IsRectNull())
+		return FALSE;
+
+	if (pOriginImg->GetWidth() == 0 || pOriginImg->GetHeight() == 0)
+		return FALSE;
+
+	pBinImage->ReleaseSpace();
+
+	pBinImage->SetSize(rtInsRect.Width(), rtInsRect.Height());
+	ZeroMemory(pBinImage->GetDataAddress(), pBinImage->GetSize());
+
+	IplImage* pOriginImage = cvCreateImage(cvSize(pBinImage->GetWidth(), pBinImage->GetHeight()), 8, 1);
+
+	for(int i=0; i<pBinImage->GetHeight(); i++)
+	{
+		int nX = rtInsRect.left;
+		int nY = rtInsRect.top + i;
+		memcpy(&pOriginImage->imageData[i*pOriginImage->widthStep], pOriginImg->GetDataAddress(nX,nY), pBinImage->GetWidth());
+	}
+
+	IplImage* pBinImage_Low = cvCreateImage(cvSize(pBinImage->GetWidth(), pBinImage->GetHeight()), 8, 1);
+	IplImage* pBinImage_Hight = cvCreateImage(cvSize(pBinImage->GetWidth(), pBinImage->GetHeight()), 8, 1);
+
+	cvZero(pBinImage_Low);
+	cvZero(pBinImage_Hight);
+
+	cvThreshold(pOriginImage, pBinImage_Low, (double) nThresholdLow, 255.0, CV_THRESH_BINARY_INV);
+	cvThreshold(pOriginImage, pBinImage_Hight, (double) nThresholdHigh, 255.0, CV_THRESH_BINARY);
+
+	for (int i = 0; i < rtInsRect.Height(); i++)
+	{
+		for (int j = 0; j < rtInsRect.Width(); j++)
+		{
+			if(pBinImage_Low->imageData[i*pBinImage_Low->widthStep + j] == 0 &&
+				pBinImage_Hight->imageData[i*pBinImage_Hight->widthStep + j] == 0)
+				continue;
+
+			pBinImage->SetPixel(j,i,255);
+		}
+	}
+
+	cvReleaseImage(&pBinImage_Low);
+	cvReleaseImage(&pBinImage_Hight);
+	cvReleaseImage(&pOriginImage);
+
+	return TRUE;
+}
+
+BOOL CChamferInspect::Binarization_OpenCV( CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, int nThresholdLow, int nThresholdHigh, int nThresholdPitch, int nPitch ,int iFram, BOOL bSave)
+{
+	if(pOriginImg == NULL || pBinImage == NULL || pOriginImg->IsValidBuffer() == FALSE || rtInsRect.IsRectEmpty() || rtInsRect.IsRectNull())
+		return FALSE;
+
+	if (pOriginImg->GetWidth() == 0 || pOriginImg->GetHeight() == 0)
+		return FALSE;
+
+	pBinImage->ReleaseSpace();
+
+	pBinImage->SetSize(rtInsRect.Width(), rtInsRect.Height());
+	ZeroMemory(pBinImage->GetDataAddress(), pBinImage->GetSize());
+
+	IplImage* pOriginImage = cvCreateImage(cvSize(pBinImage->GetWidth(), pBinImage->GetHeight()), 8, 1);
+
+	for(int i=0; i<pBinImage->GetHeight(); i++)
+	{
+		int nX = rtInsRect.left;
+		int nY = rtInsRect.top + i;
+		memcpy(&pOriginImage->imageData[i*pOriginImage->widthStep], pOriginImg->GetDataAddress(nX,nY), pBinImage->GetWidth());
+	}
+
+	IplImage* pBinImage_Low = cvCreateImage(cvSize(pBinImage->GetWidth(), pBinImage->GetHeight()), 8, 1);
+	IplImage* pBinImage_Hight = cvCreateImage(cvSize(pBinImage->GetWidth(), pBinImage->GetHeight()), 8, 1);
+	IplImage* pBinImage_OR = cvCreateImage(cvSize(pBinImage->GetWidth(), pBinImage->GetHeight()), 8, 1);
+
+	cvZero(pBinImage_Low);
+	cvZero(pBinImage_Hight);
+	cvZero(pBinImage_OR);
+
+	if(nThresholdLow >= 0 && nThresholdLow <= 255)
+	{
+		cvThreshold(pOriginImage, pBinImage_Low, (double) nThresholdLow, 255.0, CV_THRESH_BINARY_INV);
+	}
+	if(nThresholdHigh >= 0 && nThresholdHigh <= 255)
+	{
+		cvThreshold(pOriginImage, pBinImage_Hight, (double) nThresholdHigh, 255.0, CV_THRESH_BINARY);
+	}
+
+	cvOr(pBinImage_Low, pBinImage_Hight, pBinImage_OR);
+	CopyMemory(pBinImage->GetDataAddress(),pBinImage_OR->imageData,sizeof(BYTE)*pBinImage_OR->width*pBinImage_OR->height);
+
+	if(bSave == TRUE)
+	{		
+		CString		str;
+		str.Format(_T("%s\\%03d_%03d_ChipBinLow.bmp"),PATH_DEBUGFOLDER,iFram,m_nSaveIndex);
+
+		COwnerBuffer		binBuffer(pBinImage_Low->width,pBinImage_Low->height);
+		CopyMemory(binBuffer.GetDataAddress(),pBinImage_Low->imageData,sizeof(BYTE)*pBinImage_Low->width*pBinImage_Low->height);
+
+		CBufferAttach		attach(str);
+		attach.AttachToFile(binBuffer);
+
+		COwnerBuffer		binBufferHigh(pBinImage_Hight->width,pBinImage_Hight->height);
+		CopyMemory(binBuffer.GetDataAddress(),pBinImage_Hight->imageData,sizeof(BYTE)*pBinImage_Hight->width*pBinImage_Hight->height);
+
+		str.Format(_T("%s\\%03d_%03d_ChipBinHigh.bmp"),PATH_DEBUGFOLDER,iFram,m_nSaveIndex);
+		CBufferAttach		attach2(str);
+		attach2.AttachToFile(binBufferHigh);
+	}
+
+	cvReleaseImage(&pBinImage_Low);
+	cvReleaseImage(&pBinImage_Hight);
+	cvReleaseImage(&pBinImage_OR);
+	cvReleaseImage(&pOriginImage);
+
+	return TRUE;
+}
diff --git a/Common_Class/EdgeInspect/CornerCut.cpp b/Common_Class/EdgeInspect/CornerCut.cpp
new file mode 100644
index 0000000..1d3d96e
--- /dev/null
+++ b/Common_Class/EdgeInspect/CornerCut.cpp
@@ -0,0 +1,1305 @@
+#include "StdAfx.h"
+#include <math.h>
+#include "CornerCut.h"
+#include "EdgeProc.h"
+#include "InspectionBuffer.h"
+
+#define CORNERIMAGE_PATEH			_T("D:\\Image\\LogCorner")
+#define USE_ADAPTIVETHRESHOLD	0
+#define SAVE_IMAGE
+
+const double g_dRatio = 0.2;
+const int	 g_nContiCnt = 2;
+
+CCornerCut::CCornerCut(void)
+{
+	ZeroMemory(m_nCornerPoint,sizeof(sCoPoint)*3);	
+	m_pInsImg = NULL;
+
+	m_pOuterLineH = m_pOuterLineV = NULL;
+	m_nOuterCountH = m_nOuterCountV = 0;
+}
+
+CCornerCut::~CCornerCut(void)
+{
+	if(m_pInsImg != NULL)
+		delete[] m_pInsImg, m_pInsImg=NULL;	
+	if(m_pOuterLineH != NULL)
+		delete[] m_pOuterLineH, m_pOuterLineH=NULL;
+	if(m_pOuterLineV != NULL)
+		delete[] m_pOuterLineV, m_pOuterLineV=NULL;
+}
+
+ERRCODE_CORNERCUT CCornerCut::Inspection(LPBYTE pImg,CSize szImg,CRect &rectIns,int iFrame,int nLowThres,int nHighThres,CORNERCUR_DIR nDir, CString strHPanelID,BOOL bSaveImage
+										 ,COwnerBuffer	&pOrg,double &dResWidth,double &dResHeight)
+{
+	
+	ZeroMemory(m_nCornerPoint,sizeof(CPoint)*3);
+	dResWidth = dResHeight = 0.;	
+
+	if(pImg == NULL)
+	{
+		return ERR_CO_IMAGENULL;
+	}
+
+	pOrg.SetSize(szImg.cx,szImg.cy);
+	CopyMemory(pOrg.GetDataAddress(),pImg,pOrg.GetDataSize());
+
+	AssertOnFrameRect(rectIns,szImg);
+	if(rectIns.Width()*rectIns.Height() <= 0)
+	{
+		return ERR_CO_INSRECTNULL;
+	}
+
+	if(bSaveImage == TRUE)
+	{
+		CreateDirectory(CORNERIMAGE_PATEH,NULL);
+
+		CString			strFile;
+		CSISBuffer	mosis1(pImg, rectIns.Width(), rectIns.Height());
+		strFile.Format(_T("%s\\%s_OrgImg_%d.bmp"),CORNERIMAGE_PATEH,strHPanelID, iFrame);
+		CBufferAttach		attch1(strFile);
+		if(mosis1.IsValidBuffer() == TRUE)
+			attch1.AttachToFile(mosis1);
+
+		/*CHMBitmap		BmpSave;
+		CString			strFile;
+		if(rectIns.Width() > 0 && rectIns.Height() > 0)
+		{
+			BmpSave.SetBitmap(pImg, rectIns.Width(), rectIns.Height());
+			strFile.Format("%s\\%s_OrgImg_%d.bmp",CORNERIMAGE_PATEH,strHPanelID, iFrame);	
+			LPBYTE		pBuffer = BmpSave.GetBuffer();
+			if(pBuffer != NULL)
+				BmpSave.SaveBitmapFile(strFile);
+		}*/
+	}
+	
+ 	CSISBuffer		pBuf(pImg,szImg.cx,szImg.cy);
+ 	ThresholdProcLowHigh(pBuf,nLowThres,nHighThres);	
+
+	//CEdgeProc			EdgeProc;	
+	
+	//EdgeProc.ThresholdByIntegralImage(pImg,szImg.cx,szImg.cy,szImg.cx,10,pImg);
+
+	//EdgeProc.Adaptive_Binarization(pImg,szImg.cx,szImg.cy,szImg.cx,10,0.2,pImg,rectIns);
+
+	
+	if(bSaveImage == TRUE)
+	{
+		CSISBuffer	mosis2(pImg, rectIns.Width(), rectIns.Height());
+		CString			strFile;
+		strFile.Format(_T("%s\\%s_ThresImg_%d.bmp"),CORNERIMAGE_PATEH,strHPanelID, iFrame);	
+		CBufferAttach		attch2(strFile);
+		if(mosis2.IsValidBuffer() == TRUE)
+			attch2.AttachToFile(mosis2);
+
+		/*CHMBitmap		BmpSave2;
+		if(rectIns.Width() > 0 && rectIns.Height() > 0)
+		{
+			BmpSave2.SetBitmap(pImg, rectIns.Width(), rectIns.Height());
+			strFile.Format("%s\\%s_ThresImg_%d.bmp",CORNERIMAGE_PATEH,strHPanelID, iFrame);	
+			LPBYTE		pBuffer = BmpSave2.GetBuffer();
+			if(pBuffer != NULL)
+				BmpSave2.SaveBitmapFile(strFile);
+		}*/
+	}
+
+	int			nVertLine,nHorLine;
+
+	if(FindVerticalLine(pImg,rectIns,nVertLine,nDir) == FALSE)
+	{		
+		return ERR_CO_FINDVERT;
+	}
+
+	if(FindHorizontalLine(pImg,rectIns,nHorLine,nDir) == FALSE)
+	{	
+		return ERR_CO_FINDHOR;
+	}
+
+	m_nCornerPoint[0].x = nVertLine;
+	m_nCornerPoint[0].y = nHorLine;
+
+	FindCornerPoint(pImg,rectIns,m_nCornerPoint[0],nDir);
+	
+	FindOuterLine(pImg,rectIns,nDir);
+
+	if(m_nOuterCountH >= 20 && m_nOuterCountV >= 20)
+	{
+		FindFirstPoint(rectIns);
+	}	
+
+	CalculateLenght(dResWidth,dResHeight);	
+
+	if(m_pOuterLineH != NULL)
+		delete[] m_pOuterLineH, m_pOuterLineH=NULL;
+	if(m_pOuterLineV != NULL)
+		delete[] m_pOuterLineV, m_pOuterLineV=NULL;
+
+
+	if(pOrg.IsValidBuffer() == TRUE)
+	{
+		CPoint			pointDraw[3];
+
+		pointDraw[0] = CPoint((int)m_nCornerPoint[0].x,(int)m_nCornerPoint[0].y);
+		pointDraw[1] = CPoint((int)m_nCornerPoint[1].x,(int)m_nCornerPoint[1].y);
+		pointDraw[2] = CPoint((int)m_nCornerPoint[2].x,(int)m_nCornerPoint[2].y);
+
+		bresenham_Line(&pOrg,pointDraw[0],pointDraw[1],0);
+		bresenham_Line(&pOrg,pointDraw[2],pointDraw[0],0);
+
+		SaveMarkImage(pOrg.GetDataAddress(0,0),rectIns);
+
+// 		LPBYTE		pBuffer = pOrg.GetDataAddress(0,0);
+// 		if(pBuffer != NULL)
+// 		{
+// 			//SaveMarkImage(pBuffer,rectIns);		
+// 		}
+	}
+	
+
+	return ERR_CO_SUCCESS;
+}
+
+void CCornerCut::SaveMarkImage(LPBYTE pBuffer,CRect &rectIns)
+{
+	int			nStartH,nStartV,nEndH,nEndV,x,y;
+	int			nDiv = 5,nBright = 128;			
+
+	// 0 Position
+	nStartH = (int)m_nCornerPoint[0].x-nDiv;
+	nEndH = (int)m_nCornerPoint[0].x+nDiv;		
+	if(nStartH < 0) nStartH = 0;
+	if(nEndH >= rectIns.Width()) nEndH = rectIns.Width()-1;
+	y=(int)m_nCornerPoint[0].y;
+	for(x=nStartH;x<=nEndH;x++)		
+		pBuffer[y*rectIns.Width()+x] = nBright;
+
+	nStartV = (int)m_nCornerPoint[0].y-nDiv;
+	nEndV = (int)m_nCornerPoint[0].y+nDiv;		
+	if(nStartV < 0) nStartV = 0;
+	if(nEndV >= rectIns.Height()) nEndV = rectIns.Height()-1;
+	x=(int)m_nCornerPoint[0].x;
+	for(y=nStartV;y<=nEndV;y++)		
+		pBuffer[y*rectIns.Width()+x] = nBright;
+
+	// 1 Position
+	nStartH = (int)m_nCornerPoint[1].x-nDiv;
+	nEndH = (int)m_nCornerPoint[1].x+nDiv;		
+	if(nStartH < 0) nStartH = 0;
+	if(nEndH >= rectIns.Width()) nEndH = rectIns.Width()-1;
+	y=(int)m_nCornerPoint[1].y;
+	for(x=nStartH;x<=nEndH;x++)		
+		pBuffer[y*rectIns.Width()+x] = nBright;
+
+	nStartV = (int)m_nCornerPoint[1].y-nDiv;
+	nEndV = (int)m_nCornerPoint[1].y+nDiv;		
+	if(nStartV < 0) nStartV = 0;
+	if(nEndV >= rectIns.Height()) nEndV = rectIns.Height()-1;
+	x=(int)m_nCornerPoint[1].x;
+	for(y=nStartV;y<=nEndV;y++)		
+		pBuffer[y*rectIns.Width()+x] = nBright;
+
+	// 2 Position
+	nStartH = (int)m_nCornerPoint[2].x-nDiv;
+	nEndH = (int)m_nCornerPoint[2].x+nDiv;		
+	if(nStartH < 0) nStartH = 0;
+	if(nEndH >= rectIns.Width()) nEndH = rectIns.Width()-1;
+	y=(int)m_nCornerPoint[2].y;
+	for(x=nStartH;x<=nEndH;x++)		
+		pBuffer[y*rectIns.Width()+x] = nBright;
+
+	nStartV = (int)m_nCornerPoint[2].y-nDiv;
+	nEndV = (int)m_nCornerPoint[2].y+nDiv;		
+	if(nStartV < 0) nStartV = 0;
+	if(nEndV >= rectIns.Height()) nEndV = rectIns.Height()-1;
+	x=(int)m_nCornerPoint[2].x;
+	for(y=nStartV;y<=nEndV;y++)		
+		pBuffer[y*rectIns.Width()+x] = nBright;
+}
+
+void CCornerCut::CalculateLenght(double &dResWidth,double &dResHeight)
+{
+	dResWidth = sqrt(pow((m_nCornerPoint[0].x-m_nCornerPoint[1].x),2)+pow((m_nCornerPoint[0].y-m_nCornerPoint[1].y),2));
+	dResHeight = sqrt(pow((m_nCornerPoint[0].x-m_nCornerPoint[2].x),2)+pow((m_nCornerPoint[0].y-m_nCornerPoint[2].y),2));
+
+//	dResWidth = fabs(m_nCornerPoint[1].x-m_nCornerPoint[2].x)+1;
+//	dResHeight = fabs(m_nCornerPoint[1].y-m_nCornerPoint[2].y)+1;
+}
+
+BOOL CCornerCut::FindOuterHori(LPBYTE pImg,CRect rectIns,double nYPos,double nStartX,CORNERCUR_DIR nDir)
+{
+	const int nMargin = 5;
+	BOOL		bReverse = FALSE;
+	int			nStartY,nEndY;
+
+	switch(nDir)
+	{
+	case CO_LT:
+	case CO_RT:
+		nStartY = (int)nYPos-nMargin;
+		nEndY = (int)nYPos+nMargin;	
+		if(nStartY < 0) nStartY = 0;
+		if(nEndY >= rectIns.Height()) nEndY = rectIns.Height()-1;
+		break;
+	case CO_LB:
+	case CO_RB:
+		bReverse = TRUE;		
+		nStartY = (int)nYPos+nMargin;
+		nEndY = (int)nYPos-nMargin;		
+		if(nEndY < 0) nEndY = 0;
+		if(nStartY >= rectIns.Height()) nStartY = rectIns.Height()-1;
+		break;
+	}
+
+	if(nStartX < 0) nStartX = 0;
+	
+	int		iX,iY;	
+	if(bReverse == FALSE)
+	{
+		switch(nDir)
+		{
+		case CO_LT:
+		case CO_LB:
+			for(iX=(int)nStartX;iX<rectIns.Width();iX++)
+			{
+				for(iY=nStartY;iY<=nEndY;iY++)
+				{
+					if(pImg[iY*rectIns.Width()+iX] == 255)
+					{
+						m_pOuterLineH[m_nOuterCountH].x = iX;
+						m_pOuterLineH[m_nOuterCountH].y = iY;
+						m_nOuterCountH++;
+						break;
+					}
+				}
+			}
+			break;
+		case CO_RT:
+		case CO_RB:
+			for(iX=0;iX<(int)nStartX;iX++)
+			{
+				for(iY=nStartY;iY<=nEndY;iY++)
+				{
+					if(pImg[iY*rectIns.Width()+iX] == 255)
+					{
+						m_pOuterLineH[m_nOuterCountH].x = iX;
+						m_pOuterLineH[m_nOuterCountH].y = iY;
+						m_nOuterCountH++;
+						break;
+					}
+				}
+			}
+			break;
+		}			
+	}
+	else
+	{
+		switch(nDir)
+		{
+		case CO_LT:
+		case CO_LB:
+			for(iX=(int)nStartX;iX<rectIns.Width();iX++)
+			{
+				for(iY=nStartY;iY>=nEndY;iY--)
+				{
+					if(pImg[iY*rectIns.Width()+iX] == 255)
+					{
+						m_pOuterLineH[m_nOuterCountH].x = iX;
+						m_pOuterLineH[m_nOuterCountH].y = iY;
+						m_nOuterCountH++;						
+						break;
+					}
+				}
+			}
+			break;
+		case CO_RT:
+		case CO_RB:
+			for(iX=0;iX<(int)nStartX;iX++)
+			{
+				for(iY=nStartY;iY>=nEndY;iY--)
+				{
+					if(pImg[iY*rectIns.Width()+iX] == 255)
+					{
+						m_pOuterLineH[m_nOuterCountH].x = iX;
+						m_pOuterLineH[m_nOuterCountH].y = iY;
+						m_nOuterCountH++;						
+						break;
+					}
+				}
+			}
+			break;
+		}		
+	}
+
+	return TRUE;
+}
+
+BOOL CCornerCut::FindOuterVert(LPBYTE pImg,CRect rectIns,double nYPos,double nXPos,CORNERCUR_DIR nDir)
+{
+	const int nMargin = 5;
+	BOOL		bReverse = FALSE;
+	int			nStartX,nEndX;
+
+	switch(nDir)
+	{
+	case CO_LT:
+	case CO_LB:
+		nStartX = (int)nXPos-nMargin;
+		nEndX = (int)nXPos+nMargin;	
+		if(nStartX < 0) nStartX = 0;
+		if(nEndX >= rectIns.Width()) nEndX = rectIns.Width()-1;
+		break;
+	case CO_RT:
+	case CO_RB:
+		bReverse = TRUE;		
+		nStartX = (int)nXPos+nMargin;
+		nEndX = (int)nXPos-nMargin;		
+		if(nEndX < 0) nEndX = 0;
+		if(nStartX >= rectIns.Width()) nStartX = rectIns.Width()-1;
+		break;
+	}
+
+	if(nYPos < 0) nYPos = 0;
+
+	int		iX,iY;	
+	if(bReverse == FALSE)
+	{
+		switch(nDir)
+		{
+		case CO_LT:
+		case CO_RT:		
+			for(iY=(int)nYPos;iY<rectIns.Height();iY++)
+			{
+				for(iX=nStartX;iX<=nEndX;iX++)
+				{
+					if(pImg[iY*rectIns.Width()+iX] == 255)
+					{
+						m_pOuterLineV[m_nOuterCountV].x = iX;
+						m_pOuterLineV[m_nOuterCountV].y = iY;
+						m_nOuterCountV++;				
+						break;
+					}
+				}
+			}
+			break;
+		case CO_LB:
+		case CO_RB:
+			for(iY=0;iY<(int)nYPos;iY++)
+			{
+				for(iX=nStartX;iX<=nEndX;iX++)
+				{
+					if(pImg[iY*rectIns.Width()+iX] == 255)
+					{
+						m_pOuterLineV[m_nOuterCountV].x = iX;
+						m_pOuterLineV[m_nOuterCountV].y = iY;
+						m_nOuterCountV++;				
+						break;
+					}
+				}
+			}
+			break;
+		}		
+	}
+	else
+	{
+		switch(nDir)
+		{
+		case CO_LT:
+		case CO_RT:		
+			for(iY=(int)nYPos;iY<rectIns.Height();iY++)
+			{
+				for(iX=nStartX;iX>=nEndX;iX--)
+				{
+					if(pImg[iY*rectIns.Width()+iX] == 255)
+					{
+						m_pOuterLineV[m_nOuterCountV].x = iX;
+						m_pOuterLineV[m_nOuterCountV].y = iY;
+						m_nOuterCountV++;					
+						break;
+					}
+				}
+			}
+			break;
+		case CO_LB:
+		case CO_RB:
+			for(iY=0;iY<(int)nYPos;iY++)
+			{
+				for(iX=nStartX;iX>=nEndX;iX--)
+				{
+					if(pImg[iY*rectIns.Width()+iX] == 255)
+					{
+						m_pOuterLineV[m_nOuterCountV].x = iX;
+						m_pOuterLineV[m_nOuterCountV].y = iY;
+						m_nOuterCountV++;					
+						break;
+					}
+				}
+			}
+			break;
+		}			
+	}
+
+	return TRUE;
+}
+
+BOOL CCornerCut::FindOuterLine(LPBYTE pImg,CRect rectIns,CORNERCUR_DIR nDir)
+{
+	if(m_pOuterLineH != NULL)
+		delete[] m_pOuterLineH, m_pOuterLineH=NULL;
+	if(m_pOuterLineV != NULL)
+		delete[] m_pOuterLineV, m_pOuterLineV=NULL;
+	m_nOuterCountH = m_nOuterCountV = 0;
+
+	if(pImg == NULL || rectIns.Width()*rectIns.Height() <= 0)
+		return FALSE;
+
+	m_pOuterLineH = new sCoPoint[rectIns.Width()+1];
+	m_pOuterLineV = new sCoPoint[rectIns.Height()+1];
+	
+	FindOuterHori(pImg,rectIns,m_nCornerPoint[1].y,m_nCornerPoint[1].x,nDir);
+
+	FindOuterVert(pImg,rectIns,m_nCornerPoint[2].y,m_nCornerPoint[2].x,nDir);
+
+	return TRUE;
+}
+
+BOOL CCornerCut::FindCornerPoint(LPBYTE pImg,CRect rectIns,sCoPoint point,CORNERCUR_DIR nDir)
+{	
+	switch(nDir)
+	{
+	case CO_LT:
+		DetectLine(pImg,rectIns,point,TRUE,FALSE,nDir,m_nCornerPoint[1]);
+		DetectLine(pImg,rectIns,point,FALSE,FALSE,nDir,m_nCornerPoint[2]);		
+		break;
+	case CO_LB:
+		DetectLine(pImg,rectIns,point,TRUE,FALSE,nDir,m_nCornerPoint[1]);
+		DetectLine(pImg,rectIns,point,FALSE,TRUE,nDir,m_nCornerPoint[2]);
+		break;
+	case CO_RT:
+		DetectLine(pImg,rectIns,point,TRUE,TRUE,nDir,m_nCornerPoint[1]);
+		DetectLine(pImg,rectIns,point,FALSE,FALSE,nDir,m_nCornerPoint[2]);
+		break;
+	case CO_RB:
+		DetectLine(pImg,rectIns,point,TRUE,TRUE,nDir,m_nCornerPoint[1]);		
+		DetectLine(pImg,rectIns,point,FALSE,TRUE,nDir,m_nCornerPoint[2]);
+		break;
+	}
+
+	return TRUE;
+}
+
+int CCornerCut::GetVertCount(LPBYTE pImg,int u,sCoPoint point,BOOL bDir,int nWidth,int nHeight,int nSetCount)
+{
+	int		nDetLine = -1;
+	int		nCount = 0;
+	int		v;
+
+	if(bDir == FALSE)
+	{		
+		for(v=(int)point.y;v<nHeight;v++)
+		{
+			if(*(pImg+v*nWidth+u) == 255)
+				nCount++;
+			else
+				nCount = 0;
+			if(nCount >= nSetCount)
+			{
+				nDetLine = v-nCount;					
+				break;
+			}
+		}
+	}
+	else
+	{
+		for(v=(int)point.y;v>=0;v--)
+		{
+			if(*(pImg+v*nWidth+u) == 255)
+				nCount++;
+			else
+				nCount = 0;
+			if(nCount >= nSetCount)
+			{
+				nDetLine = v+nCount;					
+				break;
+			}
+		}
+	}
+
+	return nDetLine;
+}
+
+int CCornerCut::GetHorCount(LPBYTE pImg,int v,sCoPoint point,BOOL bDir,int nWidth,int nSetCount)
+{
+	int		nDetLine = -1;
+	int		nCount = 0;
+	int		u;
+	
+	if(bDir == FALSE)
+	{		
+		for(u=(int)point.x;u<nWidth;u++)
+		{
+			if(*(pImg+v*nWidth+u) == 255)
+				nCount++;
+			else
+				nCount = 0;
+			if(nCount >= nSetCount)
+			{
+				nDetLine = u-nCount;					
+				break;
+			}
+		}
+	}
+	else
+	{
+		for(u=(int)point.x;u>=0;u--)
+		{
+			if(*(pImg+v*nWidth+u) == 255)
+				nCount++;
+			else
+				nCount = 0;
+			if(nCount >= nSetCount)
+			{
+				nDetLine = u+nCount;					
+				break;
+			}
+		}
+	}
+
+
+	return nDetLine;
+}
+
+void CCornerCut::GetRegionInfo(sCoPoint point,CORNERCUR_DIR nDir,BOOL bDir,int &nStart,int &nEnd,BOOL &bReverse,int nWidth,int nHeight)
+{
+	int			nSize = g_nContiCnt*2;
+	bReverse = FALSE;	
+	if(bDir == TRUE) // Horizontal
+	{
+		switch(nDir)
+		{
+		case CO_LT:
+		case CO_RT:
+			nStart = (int)point.y-nSize*2;
+			nEnd = (int)point.y+nSize;			
+			break;
+		case CO_LB:
+		case CO_RB:
+			bReverse = TRUE;
+			nStart = (int)point.y-nSize;
+			nEnd = (int)point.y+nSize*2;			
+			break;
+		}
+		if(nStart < 0)
+			nStart = 0;
+		if(nEnd >= nHeight)
+			nEnd = nHeight-1;
+	}
+	else
+	{
+		switch(nDir)
+		{
+		case CO_LT:
+		case CO_LB:
+			nStart = (int)point.x-nSize*2;
+			nEnd = (int)point.x+nSize;			
+			break;
+		case CO_RT:
+		case CO_RB:
+			bReverse = TRUE;
+			nStart = (int)point.x-nSize;
+			nEnd = (int)point.x+nSize*2;			
+			break;
+		}
+		if(nStart < 0)
+			nStart = 0;
+		if(nEnd >= nWidth)
+			nEnd = nWidth-1;
+	}
+}
+
+int CCornerCut::DetectLine(LPBYTE pImg,CRect rectIns,sCoPoint point,BOOL bDir,BOOL bReverse,CORNERCUR_DIR nDir,sCoPoint &pointResult)
+{
+	int			nWidth = rectIns.Width();
+	int			nHeight = rectIns.Height();
+	int			u,v;
+	int			nCount;
+	const int	nSetCount = 2;
+	const int	nSetDet = 8;
+	int			nStart,nEnd,nDetPos,iLoop;
+	BOOL		bConvert;
+	CPoint		pointDet,pointFirst;
+	CArray<CPoint,CPoint> nPos;
+
+
+	nCount = 0;	
+	GetRegionInfo(point,nDir,bDir,nStart,nEnd,bConvert,nWidth,nHeight);
+
+	if(bDir == TRUE)		// Horizontal
+	{	
+		if(nStart > nEnd) swapN(nStart,nEnd);
+		if(bConvert == FALSE)
+		{			
+			for(v=nEnd;v>=nStart;v--)			
+			{
+				nDetPos = GetHorCount(pImg,v,point,bReverse,nWidth,nSetCount);
+				nPos.Add(CPoint(nDetPos,v));				
+			}			
+		}
+		else
+		{			
+			for(v=nStart;v<nEnd;v++)			
+			{
+				nDetPos = GetHorCount(pImg,v,point,bReverse,nWidth,nSetCount);
+				nPos.Add(CPoint(nDetPos,v));
+			}
+		}		
+
+		for(iLoop=0;iLoop<nPos.GetCount();iLoop++)
+		{
+			pointDet = nPos.GetAt(iLoop);				
+			if(iLoop == 0)
+			{
+				pointFirst = pointDet;
+				continue;
+			}			
+			if(abs(pointDet.x-pointFirst.x) >= nSetDet)
+			{
+				pointResult.x = pointFirst.x;
+				pointResult.y = pointFirst.y;
+				break;
+			}
+			pointFirst = pointDet;
+		}
+	}
+	else
+	{	
+		if(nStart > nEnd) swapN(nStart,nEnd);
+		if(bConvert == FALSE)
+		{			
+			for(u=nEnd;u>=nStart;u--)
+			{
+				nDetPos = GetVertCount(pImg,u,point,bReverse,nWidth,nHeight,nSetCount);
+				nPos.Add(CPoint(u,nDetPos));
+			}
+		}
+		else
+		{
+			for(u=nStart;u<nEnd;u++)
+			{
+				nDetPos = GetVertCount(pImg,u,point,bReverse,nWidth,nHeight,nSetCount);
+				nPos.Add(CPoint(u,nDetPos));
+			}
+		}
+
+		for(iLoop=0;iLoop<nPos.GetCount();iLoop++)
+		{
+			pointDet = nPos.GetAt(iLoop);				
+			if(iLoop == 0)
+			{
+				pointFirst = pointDet;
+				continue;
+			}		
+			if(abs(pointDet.y-pointFirst.y) >= nSetDet)
+			{
+				pointResult.x = pointFirst.x;
+				pointResult.y = pointFirst.y;
+				break;
+			}
+			pointFirst = pointDet;
+		}
+	}	
+
+	return 0;
+}
+
+BOOL CCornerCut::FindHorizontalLine(LPBYTE pImg,CRect rectIns,int &nHorLine,CORNERCUR_DIR nDir)
+{
+	if(rectIns.Height() <= 0)
+		return FALSE;	
+
+	nHorLine = -1;
+
+	int			*pPoint;
+	int			u,v;
+	int			nMax,nLevel;
+	int			nWidth = rectIns.Width();
+	int			nHeight = rectIns.Height();
+	int			nCount;
+
+	//////////////////////////////////////////////////////////////////////////
+	// vertical	
+	pPoint = new int[nHeight];
+	ZeroMemory(pPoint,sizeof(int)*nHeight);
+
+	nMax = INT_MIN;
+	for(v=0;v<nHeight;v++)	
+	{
+		for(u=0;u<nWidth;u++)
+		{
+			if(*(pImg+v*nWidth+u) == 255)
+				pPoint[v]++;
+		}
+		if(nMax < pPoint[v]) nMax = pPoint[v];
+	}
+	nLevel = (int)((double)nMax * g_dRatio);
+
+	nCount = 0;
+
+	switch(nDir)
+	{
+	case CO_LT:
+	case CO_RT:
+		for(v=0;v<nHeight;v++)
+		{
+			if(pPoint[v] >= nLevel)
+				nCount++;
+			else
+				nCount = 0;
+
+			if(nCount >= g_nContiCnt)
+			{
+				nHorLine = v-nCount;
+				break;
+			}
+		}
+		break;
+	case CO_LB:
+	case CO_RB:
+		for(v=nHeight-1;v>=0;v--)
+		{
+			if(pPoint[v] >= nLevel)
+				nCount++;
+			else
+				nCount = 0;
+
+			if(nCount >= g_nContiCnt)
+			{
+				nHorLine = v+nCount;
+				break;
+			}
+		}
+		break;
+	}
+
+	delete[] pPoint, pPoint=NULL;
+
+	return TRUE;
+}
+
+BOOL CCornerCut::FindVerticalLine(LPBYTE pImg,CRect rectIns,int &nVertLine,CORNERCUR_DIR nDir)
+{
+	if(rectIns.Width() <= 0)
+		return FALSE;	
+
+	nVertLine = -1;
+	
+	int			*pPoint;
+	int			u,v;
+	int			nMax,nLevel;
+	int			nWidth = rectIns.Width();
+	int			nHeight = rectIns.Height();
+	int			nCount;
+
+	//////////////////////////////////////////////////////////////////////////
+	// vertical	
+	pPoint = new int[nWidth];
+	ZeroMemory(pPoint,sizeof(int)*nWidth);
+
+	nMax = INT_MIN;
+	for(u=0;u<nWidth;u++)
+	{
+		for(v=0;v<nHeight;v++)
+		{
+			if(*(pImg+v*nWidth+u) == 255)
+				pPoint[u]++;
+		}
+		if(nMax < pPoint[u]) nMax = pPoint[u];
+	}
+	nLevel = (int)((double)nMax * g_dRatio);
+	
+	nCount = 0;
+
+	switch(nDir)
+	{
+	case CO_LT:
+	case CO_LB:
+		for(u=0;u<nWidth;u++)
+		{
+			if(pPoint[u] >= nLevel)
+				nCount++;
+			else
+				nCount = 0;
+
+			if(nCount >= g_nContiCnt)
+			{
+				nVertLine = u-nCount;
+				break;
+			}
+		}
+		break;
+	case CO_RT:
+	case CO_RB:
+		for(u=nWidth-1;u>=0;u--)
+		{
+			if(pPoint[u] >= nLevel)
+				nCount++;
+			else
+				nCount = 0;
+
+			if(nCount >= g_nContiCnt)
+			{
+				nVertLine = u+nCount;
+				break;
+			}
+		}
+		break;
+	}
+	
+	delete[] pPoint, pPoint=NULL;
+
+	return TRUE;
+}
+
+BOOL CCornerCut::CopyEdgeImg(LPBYTE pImg,CSize szImg,CRect &rectIns)
+{
+	if(m_pInsImg != NULL)
+		delete[] m_pInsImg, m_pInsImg = NULL;
+	m_pInsImg = new BYTE[rectIns.Width()*(rectIns.Height()+1)];
+	ZeroMemory(m_pInsImg,sizeof(BYTE)*rectIns.Width()*(rectIns.Height()+1));
+
+	int			v;
+	int			dv = 0;
+
+	for(v=rectIns.top;v<rectIns.bottom;v++,dv++)
+	{
+		CopyMemory(m_pInsImg+dv*rectIns.Width(),pImg+v*szImg.cx+rectIns.left,rectIns.Width());
+	}
+
+	return TRUE;
+}
+
+void CCornerCut::AssertOnFrameRect(CRect &rect,CSize szImg)
+{
+	if(rect.left < 0) rect.left = 0;
+	if(rect.left > szImg.cx) rect.left = szImg.cx-1;	
+	if(rect.right < 0) rect.right = 0;
+	if(rect.right > szImg.cx) rect.right = szImg.cx-1;	
+	if(rect.left > rect.right) swapN(rect.left,rect.right);
+	if(rect.top < 0) rect.top = 0;
+	if(rect.top > szImg.cy) rect.top = szImg.cy-1;
+	if(rect.bottom < 0) rect.bottom = 0;
+	if(rect.bottom > szImg.cy) rect.bottom = szImg.cy-1;
+	if(rect.top > rect.bottom) swapN(rect.top,rect.bottom);
+}
+
+float CCornerCut::AdaptiveThreshold(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue)
+{
+	if (pImageData==NULL) return 0;
+
+	float fThresValue =(float) nThresValue;
+	float fNewThresValue = 0;
+
+	for (int i=0; i<1000; i++)
+	{
+		fNewThresValue = GetThresholdValue(pImageData, nWidth, nHeight, nStep, (int)fThresValue);
+
+		if (fNewThresValue==fThresValue) break;
+
+		fThresValue = fNewThresValue;
+	}
+
+	return fNewThresValue;
+}
+
+float CCornerCut::GetThresholdValue(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue)
+{
+	if (pImageData==NULL) return 0;
+
+	ULONG fore = 0;
+	int fore_cnt = 0;
+	ULONG back = 0;
+	int back_cnt = 0;
+
+	int nIndex;
+	for (int i=0; i<nHeight; i++)
+	{
+		for (int j=0; j<nWidth; j++)
+		{
+			nIndex = (i*nStep)+j;
+
+			if (pImageData[nIndex]==0) continue;
+
+			if (pImageData[nIndex] > nThresValue)
+			{
+				fore += pImageData[nIndex];
+				fore_cnt++;
+			}
+			else
+			{
+				back += pImageData[nIndex];
+				back_cnt++;
+			}
+		}
+	}
+
+	float fore_avg = 0.0f;
+	if (fore_cnt!=0) fore_avg = float(fore) / float(fore_cnt);
+
+	float back_avg = 0.0f;
+	if (back_cnt!=0) back_avg = float(back) / float(back_cnt);
+
+	if (fore_cnt==0 || back_cnt==0) 
+	{
+		if (nThresValue>=128)
+			return float(nThresValue)/2.0f;
+		else
+			return float(nThresValue)*2.0f;
+	}
+
+	return (fore_avg+back_avg)/2.0f;
+}
+
+void CCornerCut::ThresholdProcLowHigh(CSISBuffer &pImg,int nLowThres,int nHighThres)
+{	
+	LPBYTE		pBuf = pImg.GetDataAddress();
+	for (int i=0; i<pImg.GetDataSize(); i++,pBuf++)
+	{
+		if(*pBuf <= nLowThres || *pBuf >= nHighThres)
+			*pBuf = 255;
+		else
+			*pBuf = 0;
+	}	
+}
+
+void CCornerCut::ThresholdProcessing(LPBYTE pImg,CSize szImg,int nThres,int nDir)
+{
+
+	float fNewThresValue = float(nThres);	
+
+	// threshold and invert
+	int nIndex;	
+	int nFinThres = (int)(fNewThresValue);
+	for (int i=0; i<szImg.cy; i++)
+	{
+		for (int j=0; j<szImg.cx; j++)
+		{
+			nIndex = (i*szImg.cx)+j;		
+			if(nDir == 1)
+			{
+				if (pImg[nIndex] > nFinThres)
+				{
+					pImg[nIndex] = 255; 
+				}
+				else
+				{
+					pImg[nIndex] = 0;				
+				}
+			}
+			else
+			{
+				if (pImg[nIndex] < nFinThres)
+				{
+					pImg[nIndex] = 255; 
+				}
+				else
+				{
+					pImg[nIndex] = 0;				
+				}
+			}
+		}
+	}	
+}
+
+// 肺滚飘菩呈狼 背瞒痢 备窍扁扼绰单..
+BOOL CCornerCut::LineInterSection(CPoint p1,CPoint p2,CPoint p3,CPoint p4,double &dInterX,double &dInterY)
+{	
+	double x1 = p1.x; 
+	double y1 = p1.y;
+	double x4 = p4.x; 
+	double y4 = p4.y;
+
+	dInterX = dInterY = 0.;
+
+	double dx1 = p2.x - x1;
+	double dx2 = p3.x - x4;
+	if (!(dx1 || dx2)) return FALSE;
+
+	double m1 = (p2.y - y1) / dx1;
+	double m2 = (p3.y - y4) / dx2; 
+
+	if (!dx1) 
+	{
+		// infinity
+		dInterX = x1;
+		dInterY = m2 * (x1 - x4) + y4;
+		return FALSE;		
+	} 
+	else if (!dx2) 
+	{
+		// infinity
+		dInterX = x4;
+		dInterY = m1 * (x4 - x1) + y1;
+		return FALSE;
+	}
+
+	dInterX = (-m2 * x4 + y4 + m1 * x1 - y1) / (m1 - m2);
+	dInterY = m1 * (dInterX - x1) + y1;
+
+	return TRUE;
+}
+
+BOOL CCornerCut::FindFirstPoint(CRect &rectIns)
+{
+	CPoint		HPoint[2],VPoint[2];
+	int			iLoop;
+	int			nSetCount = 10;
+	int			nSumF,nSumS;
+	double		dslope,dAvgF,dAvgS;
+
+	nSumF = nSumS = 0;
+	for(iLoop=0;iLoop<nSetCount;iLoop++)
+		nSumF += (int)m_pOuterLineH[iLoop].y;
+
+	for(iLoop=m_nOuterCountH-nSetCount;iLoop<m_nOuterCountH;iLoop++)
+		nSumS += (int)m_pOuterLineH[iLoop].y;
+
+	dAvgF = (double)nSumF/(double)nSetCount;
+	dAvgS = (double)nSumS/(double)nSetCount;
+	dslope = (dAvgS-dAvgF)/(double)rectIns.Width();
+
+	HPoint[0].x = 0;
+	HPoint[0].y = (int)dAvgF;
+	HPoint[1].x = rectIns.right;
+	HPoint[1].y = (int)dAvgS;
+
+
+	nSumF = nSumS = 0;
+	for(iLoop=0;iLoop<nSetCount;iLoop++)
+		nSumF += (int)m_pOuterLineV[iLoop].x;
+
+	for(iLoop=m_nOuterCountV-nSetCount;iLoop<m_nOuterCountV;iLoop++)
+		nSumS += (int)m_pOuterLineV[iLoop].x;
+
+	dAvgF = (double)nSumF/(double)nSetCount;
+	dAvgS = (double)nSumS/(double)nSetCount;
+	dslope = (dAvgS-dAvgF)/(double)rectIns.Height();
+
+	VPoint[0].x = (int)dAvgF;
+	VPoint[0].y = 0;
+	VPoint[1].x = (int)dAvgS;
+	VPoint[1].y = rectIns.bottom;	
+
+	double		interX=0,interY=0;
+	if(LineInterSection(HPoint[0],HPoint[1],VPoint[0],VPoint[1],interX,interY) == TRUE)
+	{
+		m_nCornerPoint[0].x = interX;
+		m_nCornerPoint[0].y = interY;
+	}
+
+	/*
+	sCoLine		lineH,lineV;
+	double costH = ransac_line_fitting (m_pOuterLineH, m_nOuterCountH, lineH, 10);
+	double costV = ransac_line_fitting (m_pOuterLineV, m_nOuterCountV, lineV, 10);
+	
+	if (100. < costH && 100. < costV) 
+	{
+		HPoint[0].x = 0;
+		HPoint[0].y = (int)(lineH.sy-(double)rectIns.Height()*lineH.my);
+		HPoint[1].x = rectIns.right;
+		HPoint[1].y = (int)(lineH.sy+(double)rectIns.Height()*lineH.my);	
+
+		VPoint[0].x = (int)(lineV.sx-(double)rectIns.Width()*lineV.mx);
+		VPoint[0].y = 0;
+		VPoint[1].x = (int)(lineV.sx+(double)rectIns.Width()*lineV.mx);
+		VPoint[1].y = rectIns.bottom;	
+	}*/
+
+	return TRUE;
+}
+
+double CCornerCut::ransac_line_fitting(sCoPoint *data, int no_data, sCoLine &model, double distance_threshold)
+{
+	const int no_samples = 2;
+
+	if (no_data < no_samples) {
+		return 0.;
+	}
+
+	sCoPoint *samples = new sCoPoint[no_samples];
+
+	int no_inliers = 0;
+	sCoPoint *inliers = new sCoPoint[no_data];
+
+	sCoLine estimated_model;
+	double max_cost = 0.;
+
+	int max_iteration = (int)(1 + log(1. - 0.99)/log(1. - pow(0.5, no_samples)));
+
+	for (int i = 0; i<max_iteration; i++) {
+		// 1. hypothesis
+
+		// 盔夯 单捞磐俊辑 烙狼肺 N俺狼 祭敲 单捞磐甫 绊弗促.
+		get_samples (samples, no_samples, data, no_data);
+
+		// 捞 单捞磐甫 沥惑利牢 单捞磐肺 焊绊 葛胆 颇扼皋磐甫 抗螟茄促.
+		compute_model_parameter (samples, no_samples, estimated_model);
+
+		// 2. Verification
+
+		// 盔夯 单捞磐啊 抗螟等 葛胆俊 肋 嘎绰瘤 八荤茄促.
+		double cost = model_verification (inliers, &no_inliers, estimated_model, data, no_data, distance_threshold);
+
+		// 父老 抗螟等 葛胆捞 肋 嘎绰促搁, 捞 葛胆俊 措茄 蜡瓤茄 单捞磐肺 货肺款 葛胆阑 备茄促.
+		if (max_cost < cost) {
+			max_cost = cost;
+
+			compute_model_parameter (inliers, no_inliers, model);
+		}
+	}
+
+	delete [] samples;
+	delete [] inliers;
+
+	return max_cost;
+}
+
+bool CCornerCut::find_in_samples (sCoPoint *samples, int no_samples, sCoPoint *data)
+{
+	for (int i=0; i<no_samples; ++i) {
+		if (samples[i].x == data->x && samples[i].y == data->y) {
+			return true;
+		}
+	}
+	return false;
+}
+
+void CCornerCut::get_samples (sCoPoint *samples, int no_samples, sCoPoint *data, int no_data)
+{
+	// 单捞磐俊辑 吝汗登瘤 臼霸 N俺狼 公累困 祭敲阑 盲秒茄促.
+	for (int i=0; i<no_samples; ) {
+		int j = rand()%no_data;
+
+		if (!find_in_samples(samples, i, &data[j])) {
+			samples[i] = data[j];
+			++i;
+		}
+	};
+}
+
+int CCornerCut::compute_model_parameter(sCoPoint samples[], int no_samples, sCoLine &model)
+{
+	// PCA 规侥栏肺 流急 葛胆狼 颇扼皋磐甫 抗螟茄促.
+
+	double sx  = 0, sy  = 0;
+	double sxx = 0, syy = 0;
+	double sxy = 0, sw  = 0;
+
+	for(int i = 0; i<no_samples;++i)
+	{
+		double &x = samples[i].x;
+		double &y = samples[i].y;
+
+		sx  += x;	
+		sy  += y;
+		sxx += x*x; 
+		sxy += x*y;
+		syy += y*y;
+		sw  += 1;
+	}
+
+	//variance;
+	double vxx = (sxx - sx*sx/sw)/sw;
+	double vxy = (sxy - sx*sy/sw)/sw;
+	double vyy = (syy - sy*sy/sw)/sw;
+
+	//principal axis
+	double theta = atan2(2*vxy, vxx - vyy)/2;
+
+	model.mx = cos(theta);
+	model.my = sin(theta);
+
+	//center of mass(xc, yc)
+	model.sx = sx/sw;
+	model.sy = sy/sw;
+
+	//流急狼 规沥侥: sin(theta)*(x - sx) = cos(theta)*(y - sy);
+	return 1;
+}
+
+double CCornerCut::compute_distance(sCoLine &line, sCoPoint &x)
+{
+	// 茄 痢(x)肺何磐 流急(line)俊 郴赴 荐急狼 辨捞(distance)甫 拌魂茄促.
+
+	return fabs((x.x - line.sx)*line.my - (x.y - line.sy)*line.mx)/sqrt(line.mx*line.mx + line.my*line.my);
+}
+
+double CCornerCut::model_verification (sCoPoint *inliers, int *no_inliers, sCoLine &estimated_model, sCoPoint *data, int no_data, double distance_threshold)
+{
+	*no_inliers = 0;
+
+	double cost = 0.;
+
+	for(int i=0; i<no_data; i++){
+		// 流急俊 郴赴 荐急狼 辨捞甫 拌魂茄促.
+		double distance = compute_distance(estimated_model, data[i]);
+
+		// 抗螟等 葛胆俊辑 蜡瓤茄 单捞磐牢 版快, 蜡瓤茄 单捞磐 笼钦俊 歹茄促.
+		if (distance < distance_threshold) {
+			cost += 1.;
+
+			inliers[*no_inliers] = data[i];
+			++(*no_inliers);
+		}
+	}
+
+	return cost;
+}
+
+// Bresenham's line algorithm
+void CCornerCut::bresenham_Line(COwnerBuffer *pRes,CPoint posStart,CPoint posEnd,BYTE color)
+{	
+	if(posStart.x <= 0 || posStart.y <= 0 || posEnd.x <= 0 || posEnd.y <= 0)
+		return;
+
+	const bool steep = (abs(posEnd.y - posStart.y) > abs(posEnd.x - posStart.x));
+
+	if(steep)
+	{	
+		swapLong(posStart.x, posStart.y);
+		swapLong(posEnd.x, posEnd.y);
+	}
+
+	if(posStart.x > posEnd.x)
+	{
+		swapLong(posStart.x, posEnd.x);
+		swapLong(posStart.y, posEnd.y);
+	}
+
+	const int dx = posEnd.x - posStart.x;
+	const int dy = abs(posEnd.y - posStart.y);
+
+	float error = (float)dx / 2.0f;
+	const int ystep = (posStart.y < posEnd.y) ? 1 : -1;
+	int y = (int)posStart.y;
+
+	const int maxX = (int)posEnd.x;
+
+	for(int x=(int)posStart.x; x<maxX; x++)
+	{
+		if(steep)
+		{
+			pRes->SetPixel(y,x, color);
+		}
+		else
+		{
+			pRes->SetPixel(x,y, color);		
+		}
+
+		error -= dy;
+		if(error < 0)
+		{
+			y += ystep;
+			error += dx;
+		}
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/Crystal.txt b/Common_Class/EdgeInspect/Crystal.txt
new file mode 100644
index 0000000..2eda8ee
--- /dev/null
+++ b/Common_Class/EdgeInspect/Crystal.txt
@@ -0,0 +1,2 @@
+[SETTING]
+PATH0=./MosisProfiles.txt
diff --git a/Common_Class/EdgeInspect/EdgeFind.cpp b/Common_Class/EdgeInspect/EdgeFind.cpp
new file mode 100644
index 0000000..f2f24f2
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeFind.cpp
@@ -0,0 +1,2007 @@
+// EdgeFind.cpp: implementation of the CEdgeFind class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "EdgeFind.h"
+#include "SISBuffer.h"
+#include "EdgeProc.h"
+#include <numeric>
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+CEdgeFind::CEdgeFind()
+{
+	m_pHproj = NULL;
+	m_pVproj = NULL;
+}
+
+CEdgeFind::~CEdgeFind()
+{
+	if(m_pHproj != NULL)
+		delete[] m_pHproj, m_pHproj=NULL;
+	if(m_pVproj != NULL)
+		delete[] m_pVproj, m_pVproj=NULL;	
+}
+
+int CEdgeFind::Find_RightEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue)
+{
+	if(!pBuffer->IsValidBuffer())	return -1;
+
+	int x, y;
+	int width, height;
+	int iPitch= (int)(pitch);
+	
+	width= pBuffer->GetWidth()- iPitch- 6;
+	height= pBuffer->GetHeight()- 5;
+	
+	double pa, pb;
+	pb= pitch- iPitch;
+	pa= 1- pb;
+	
+	threshold*= 6;
+	
+	int cContinue= 0;
+	int count;
+//	int org, tar;
+	int nDefect= (int)(height*rDefect);
+	for(x= width- 1; x>= 0; x--)
+	{
+		count= 0;
+		for(y= 0; y< height; y++)
+		{			
+			/*
+			//2 by 1
+			org= pBuffer->GetPixel(x, y)+ pBuffer->GetPixel(x+ 1, y);
+			tar= (int)(pBuffer->GetPixel(x+ iPitch, y)*pa+ pBuffer->GetPixel(x+iPitch+ 1, y)+ pBuffer->GetPixel(x+iPitch+ 2, y)*pb);
+			*/
+
+			//3 by 2
+//			org= pBuffer->GetPixel(x, y)+ pBuffer->GetPixel(x+ 1, y)+ pBuffer->GetPixel(x+ 2, y);
+//			org+=pBuffer->GetPixel(x, y+1)+ pBuffer->GetPixel(x+ 1, y+1)+ pBuffer->GetPixel(x+ 2, y+1);
+//			tar= (int)(pBuffer->GetPixel(x+ iPitch, y)*pa+ pBuffer->GetPixel(x+iPitch+ 1, y)+ pBuffer->GetPixel(x+iPitch+ 2, y)+ pBuffer->GetPixel(x+iPitch+ 3, y)*pb);
+//			tar+=(int)(pBuffer->GetPixel(x+ iPitch, y+1)*pa+ pBuffer->GetPixel(x+iPitch+ 1, y+1)+ pBuffer->GetPixel(x+iPitch+ 2, y+1)+ pBuffer->GetPixel(x+iPitch+ 3, y+1)*pb);
+//			if(abs(org- tar) > threshold)
+			if(abs(pBuffer->GetDiff32(x, y, pitch)) > threshold)
+			{
+				count++;
+			}
+		}
+		if(count >= nDefect)
+		{
+			cContinue++;
+			if(cContinue >= nContinue)
+				return x+ nContinue;
+		}
+		else
+		{
+			cContinue= 0;
+		}
+	}
+	return -1;
+}
+
+int CEdgeFind::Find_LeftEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue)
+{
+	if(!pBuffer->IsValidBuffer())	return -1;
+	
+	int x, y;
+	int width, height;
+	int iPitch= (int)(pitch);
+	
+	width= pBuffer->GetWidth()- iPitch- 6;
+	height= pBuffer->GetHeight()- 5;
+	
+	double pa, pb;
+	pb= pitch- iPitch;
+	pa= 1- pb;
+	
+	threshold*= 6;
+	
+	int cContinue= 0;
+	int count;
+//	int org, tar;
+	int nDefect= (int)(height*rDefect);
+	for(x= 0; x< width; x++)
+	{
+		count= 0;
+		for(y= 0; y< height; y++)
+		{
+			/*
+			//2 by 1
+			org= pBuffer->GetPixel(x, y)+ pBuffer->GetPixel(x+ 1, y);
+			tar= (int)(pBuffer->GetPixel(x+ iPitch, y)*pa+ pBuffer->GetPixel(x+iPitch+ 1, y)+ pBuffer->GetPixel(x+iPitch+ 2, y)*pb);
+			*/
+			//3 by 2
+//			org= pBuffer->GetPixel(x, y)+ pBuffer->GetPixel(x+ 1, y)+ pBuffer->GetPixel(x+ 2, y);
+//			org+=pBuffer->GetPixel(x, y+1)+ pBuffer->GetPixel(x+ 1, y+1)+ pBuffer->GetPixel(x+ 2, y+1);
+//			tar= (int)(pBuffer->GetPixel(x+ iPitch, y)*pa+ pBuffer->GetPixel(x+iPitch+ 1, y)+ pBuffer->GetPixel(x+iPitch+ 2, y)+ pBuffer->GetPixel(x+iPitch+ 3, y)*pb);
+//			tar+=(int)(pBuffer->GetPixel(x+ iPitch, y+1)*pa+ pBuffer->GetPixel(x+iPitch+ 1, y+1)+ pBuffer->GetPixel(x+iPitch+ 2, y+1)+ pBuffer->GetPixel(x+iPitch+ 3, y+1)*pb);
+
+//			if(abs(org- tar) > threshold)
+			if(abs(pBuffer->GetDiff32(x, y, pitch)) > threshold)
+			{
+				count++;
+			}
+		}
+		if(count >= nDefect)
+		{
+			cContinue++;
+			if(cContinue >= nContinue)
+				return x+ 2+ iPitch- nContinue;
+		}
+		else
+		{
+			cContinue= 0;
+		}
+	}
+	return -1;
+}
+
+int	CEdgeFind::Find_LeftCanny(CSISBuffer *pBuffer,int nThres)
+{
+	LPBYTE		pImg = pBuffer->GetDataAddress();
+	CSize		szImg = CSize(pBuffer->GetWidth(),pBuffer->GetHeight());
+
+	if(pImg == NULL || szImg.cx <= 0 || szImg.cy <= 0)
+		return -1;
+
+	int			nLeftLine = -1;
+	const	int nFindLineRatio = (int)((double)szImg.cy*0.5);
+
+	LPBYTE		pTgt = new BYTE[szImg.cx*szImg.cy];
+	ZeroMemory(pTgt,sizeof(BYTE)*szImg.cx*szImg.cy);
+
+	CEdgeProc		EdgeProc;
+
+	CSISBuffer		mosisEdge(pTgt,szImg.cx,szImg.cy);	
+	if(EdgeProc.CannyEdgeProcessing(pImg,CRect(0,0,szImg.cx,szImg.cy),GM_Sobel,nThres,mosisEdge) == FALSE)
+	{
+		delete[] pTgt, pTgt=NULL;
+		return nLeftLine;
+	}
+
+// 	CString				str;
+// 	if(pImg != NULL)
+// 	{
+// 		CSISBuffer		mosis(pImg,szImg.cx,szImg.cy);
+// 		str.Format("D:\\Image\\Org.bmp");
+// 		CBufferAttach		attach(str);
+// 		attach.AttachToFile(mosis);
+// 	}
+// 
+// 	if(pTgt != NULL)
+// 	{
+// 		CSISBuffer		mosis(pTgt,szImg.cx,szImg.cy);
+// 		str.Format("D:\\Image\\Edge.bmp");
+// 		CBufferAttach		attach(str);
+// 		attach.AttachToFile(mosis);
+// 	}
+
+	int			u,v,nCount;
+
+	for(u=2;u<szImg.cx-2;u++)
+	{
+		nCount = 0;
+		for(v=2;v<szImg.cy-2;v++)
+		{
+			if(*(pTgt+v*szImg.cx+u) == 255)
+				nCount++;
+		}
+
+		if(nCount >= nFindLineRatio)
+		{
+			nLeftLine = u;
+			break;
+		}
+	}
+
+	delete[] pTgt, pTgt=NULL;
+
+	return nLeftLine;
+}
+
+double CEdgeFind::FindLine_H(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,EDGELINE_POLAR enDir,EdgeSignalType enSignalType,enEdgeFindType enFind)
+{
+	if(pImg ==  NULL || szImg.cx <= 0)
+		return -1;
+
+	if(enFind == EDGE_PROJECTION)
+		return FindGlassHorizontalLine(pImg,szImg,rectIns,nThres,TRUE);
+
+	if(m_pHproj != NULL)
+		delete[] m_pHproj, m_pHproj=NULL;	
+
+	m_pHproj = new IMPROJ[szImg.cx+1];
+	ZeroMemory(m_pHproj,sizeof(IMPROJ)*(szImg.cx+1));
+
+	CRect		rect = rectIns;
+	ULONG		nProjMax,nProjMin;	
+	int			nPos = -1;	
+	double		dAvgPos = 0;
+
+	AssertOnFrameRect(rect,szImg);
+
+	if(FV_ProjGet(pImg,szImg,rect,PROJECTION_VERTICAL,m_pHproj,&nProjMax,&nProjMin) == TRUE)
+	{		
+		switch(enFind)
+		{
+		case EDGE_MAXCONTRAST:
+			nPos = FindMaxContrastEx(m_pHproj,rect.left,rect.right,szImg.cx,rect.Height(),enDir,nThres);
+			break;
+		case EDGE_FIRSTEDGE:
+			nPos = FindFirstEdge(m_pHproj,rect.left,rect.right,szImg.cx,rect.Height(),enDir,nThres);
+			break;
+		default:
+			{
+				if(m_pHproj != NULL)
+					delete[] m_pHproj, m_pHproj=NULL;	
+				return dAvgPos;
+			}
+		}
+
+		if(nPos <= -1)
+		{			
+			CSISBuffer		buffer(pImg,szImg.cx,szImg.cy);		
+			int	nMaxVal;
+			nPos = FindMaxContrast(buffer,rect,TRUE,nMaxVal);
+			if(nPos == -1)
+			{
+				if(m_pHproj != NULL)
+					delete[] m_pHproj, m_pHproj=NULL;	
+				return dAvgPos;
+			}
+		}
+
+		dAvgPos = (double)nPos;
+
+		rect.left = nPos - 5;
+		rect.right = nPos + 5;
+		double dTmp = FindLineSubPixel(pImg,szImg,rect,nThres,-nThres,DIR_HORIZONTAL,SearchTypeIn2Out,enSignalType);
+		if(dTmp != -1)
+			dAvgPos = dTmp;
+
+		//dAvgPos = GetSubPixelPos(pImg,nPos,szImg,rect,dRatio,bLeft,DIR_HORIZONTAL,nNumber);
+	}
+
+	if(m_pHproj != NULL)
+		delete[] m_pHproj, m_pHproj=NULL;	
+
+	return dAvgPos;
+}
+
+BOOL CEdgeFind::FindGlssEdgeLine(int &nPos,CRect rect,LPIMPROJ pProj,BOOL bDir,PROJECTION_TYPE nType,int nThres,int nContiValue,int nDist)
+{	
+	if(pProj == NULL)
+		return FALSE;
+
+	int     nThreshold = nThres * rect.Width();
+	int		iX,nCountinueCount,nGab;
+
+	nPos = -1;
+	nCountinueCount = 0;
+	switch(nType)
+	{
+	case PROJECTION_VERTICAL:
+		{			
+			nThreshold = nThres * rect.Height();
+			if(bDir == TRUE)				// Left -> Right
+			{				
+				for(iX=rect.left;iX<rect.right-nDist;iX++)
+				{
+					nGab = abs(pProj[iX].f - pProj[iX+nDist].f);			
+					if (nGab > nThreshold)
+						nCountinueCount++;
+					else
+						nCountinueCount = 0;
+
+					if (nCountinueCount >= nContiValue)
+					{
+						nPos = pProj[iX+nDist].x-(nContiValue-1);
+						return TRUE;
+					}			
+				}				
+			}
+			else							// Right -> Left
+			{			
+				for(iX=rect.right-1;iX>=rect.left+nDist;iX--)
+				{
+					nGab = abs(pProj[iX].f - pProj[iX-nDist].f);			
+					if (nGab > nThreshold)
+						nCountinueCount++;
+					else
+						nCountinueCount = 0;
+
+					if (nCountinueCount >= nContiValue)
+					{
+						nPos = pProj[iX-nDist].x+(nContiValue-1);
+						return TRUE;
+					}			
+				}
+			}
+		}
+		break;
+	case PROJECTION_HORIZONTAL:
+		{			
+			nThreshold = nThres * rect.Width();
+			if(bDir == TRUE)			// Top -> Bottom
+			{				
+				for(iX=rect.top;iX<rect.bottom-nDist;iX++)
+				{
+					nGab = abs(pProj[iX].f - pProj[iX+nDist].f);			
+					if (nGab > nThreshold)
+						nCountinueCount++;
+					else
+						nCountinueCount = 0;
+
+					if (nCountinueCount >= nContiValue)
+					{
+						nPos = pProj[iX+nDist].x-(nContiValue-1);
+						return TRUE;
+					}			
+				}	
+			}
+			else						// Bottom -> Top
+			{
+				for(iX=rect.bottom-1;iX>=rect.top+nDist;iX--)
+				{
+					nGab = abs(pProj[iX].f - pProj[iX-nDist].f);			
+					if (nGab > nThreshold)
+						nCountinueCount++;
+					else
+						nCountinueCount = 0;
+
+					if (nCountinueCount >= nContiValue)
+					{
+						nPos = pProj[iX-nDist].x+(nContiValue-1);
+						return TRUE;
+					}			
+				}	
+			}
+		}
+		break;
+	}	
+
+	return FALSE;
+}
+
+double CEdgeFind::FindGlassHorizontalLine(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,BOOL bDir, int nDist)
+{
+	if(pImg ==  NULL || szImg.cx <= 0)
+		return -1;
+
+	if(m_pHproj != NULL)
+		delete[] m_pHproj, m_pHproj=NULL;	
+
+	m_pHproj = new IMPROJ[szImg.cx+1];
+	ZeroMemory(m_pHproj,sizeof(IMPROJ)*(szImg.cx+1));
+	
+	CRect		rect = rectIns;
+	ULONG		nProjMax,nProjMin;
+	BOOL		bRet = FALSE;	
+	int			nPos = -1;
+	const int	nContinueCnt = 2;
+	const int	nLevelDist = nDist;
+	double		dAvgPos = 0;
+
+	AssertOnFrameRect(rect,szImg);
+
+	if(FV_ProjGet(pImg,szImg,rect,PROJECTION_VERTICAL,m_pHproj,&nProjMax,&nProjMin) == TRUE)
+	{		
+		if(FindGlssEdgeLine(nPos,rect,m_pHproj,bDir,PROJECTION_VERTICAL,nThres,nContinueCnt,nLevelDist) == FALSE)
+		{
+			if(m_pHproj != NULL)
+				delete[] m_pHproj, m_pHproj=NULL;	
+			return -1;
+		}
+		else
+		{
+			dAvgPos = nPos;
+
+			/*
+			CRect				rectCon(nPos-2,rect.top,nPos+2,rect.bottom);
+			CSISBuffer		buffer(pImg,szImg.cx,szImg.cy);			
+
+			int nMaxVal;
+			int nMaxCon = FindMaxContrast(buffer,rectCon,TRUE,nMaxVal);
+			if(nMaxCon != -1)
+				nPos = nMaxCon;
+
+			double		cPos;
+			double		dPosVal[3];
+			int			nHorStart = nPos;
+			int			v;
+			double		dSumPos=0,dSumCnt=0;
+
+			for(v=rect.top;v<rect.bottom;v++)
+			{				
+				dPosVal[0] = *(pImg+v*szImg.cx+(nHorStart-1));
+				dPosVal[1] = *(pImg+v*szImg.cx+(nHorStart));
+				dPosVal[2] = *(pImg+v*szImg.cx+(nHorStart+1));				
+				
+				cPos = 0;
+				if(parabolicInterpolate(dPosVal[0],dPosVal[1],dPosVal[2],&cPos) == TRUE)
+				{
+					dSumPos += cPos;
+					dSumCnt++;
+				}				
+			}
+			
+			dAvgPos = 0;
+			if(dSumCnt > 0)
+				dAvgPos = dSumPos/dSumCnt;
+
+			dAvgPos += nPos;
+			*/
+
+		}
+	}
+
+	if(m_pHproj != NULL)
+		delete[] m_pHproj, m_pHproj=NULL;	
+	
+	return dAvgPos;
+}
+
+double CEdgeFind::FindGlassVerticalLine(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,BOOL bDir,int nDist)
+{
+	if(pImg == NULL || szImg.cy <= 0) 
+		return -1;
+
+	if(m_pVproj != NULL)
+		delete[] m_pVproj, m_pVproj=NULL;	
+
+	m_pVproj = new IMPROJ[szImg.cy+1];
+	ZeroMemory(m_pVproj,sizeof(IMPROJ)*(szImg.cy+1));
+
+	CRect		rect = rectIns;
+	ULONG		nProjMax,nProjMin;
+	BOOL		bRet = FALSE;
+	int			nVertical = -1;
+	const int	nContinueCnt = 3;
+	const int	nLevelDist = nDist;
+	double		dAvgPos;
+	
+	AssertOnFrameRect(rect,szImg);	
+
+	if(FV_ProjGet(pImg,szImg,rect,PROJECTION_HORIZONTAL,m_pVproj,&nProjMax,&nProjMin) == TRUE)
+	{
+		if(FindGlssEdgeLine(nVertical,rect,m_pVproj,bDir,PROJECTION_HORIZONTAL,nThres,nContinueCnt,nLevelDist) == FALSE)
+		{				
+			if(m_pVproj != NULL)
+				delete[] m_pVproj, m_pVproj=NULL;	
+			return -1;
+		}
+		else
+		{
+			dAvgPos = nVertical;
+			/*
+			CRect				rectCon(rect.left,nVertical-2,rect.right,nVertical+2);
+			CSISBuffer		buffer(pImg,szImg.cx,szImg.cy);			
+
+			int nMaxVal;
+			int nMaxCon = FindMaxContrast(buffer,rectCon,FALSE,nMaxVal,bDir);
+			if(nMaxCon != -1)
+				nVertical = nMaxCon;
+
+			double		cPos;
+			double		dPosVal[3];
+			int			nVertStart = nVertical;
+			int			u;
+			double		dSumPos=0,dSumCnt=0;
+
+			for(u=rect.left;u<rect.right;u++)
+			{
+				dPosVal[0] = *(pImg+(nVertStart-1)*szImg.cx+u);
+				dPosVal[1] = *(pImg+(nVertStart)*szImg.cx+u);
+				dPosVal[2] = *(pImg+(nVertStart+1)*szImg.cx+u);			
+
+				cPos = 0;
+				if(parabolicInterpolate(dPosVal[0],dPosVal[1],dPosVal[2],&cPos) == TRUE)
+				{
+					dSumPos += cPos;
+					dSumCnt++;
+				}				
+			}
+
+			dAvgPos = 0;
+			if(dSumCnt > 0)
+				dAvgPos = dSumPos/dSumCnt;
+
+			dAvgPos += nVertical;
+			*/
+		}
+	}
+
+	if(m_pVproj != NULL)
+		delete[] m_pVproj, m_pVproj=NULL;
+	
+	return dAvgPos;
+}
+
+double CEdgeFind::FindLine_V(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,EDGELINE_POLAR enDir,EdgeSignalType enSignalType,enEdgeFindType enFind,BOOL bTop)
+{
+	if(pImg ==  NULL || szImg.cy <= 0)
+		return -1;
+
+	if(enFind == EDGE_PROJECTION)
+	{
+		return FindGlassVerticalLine(pImg,szImg,rectIns,nThres,bTop);
+	}
+
+	if(m_pVproj != NULL)
+		delete[] m_pVproj, m_pVproj=NULL;	
+
+	m_pVproj = new IMPROJ[szImg.cy+1];
+	ZeroMemory(m_pVproj,sizeof(IMPROJ)*(szImg.cy+1));
+
+	CRect		rect = rectIns;
+	ULONG		nProjMax,nProjMin;	
+	int			nPos = -1;	
+	double		dAvgPos = 0;
+
+	AssertOnFrameRect(rect,szImg);
+
+	if(FV_ProjGet(pImg,szImg,rect,PROJECTION_HORIZONTAL,m_pVproj,&nProjMax,&nProjMin) == TRUE)
+	{		
+		switch(enFind)
+		{
+		case EDGE_MAXCONTRAST:
+			nPos = FindMaxContrastEx(m_pVproj,rect.top,rect.bottom,szImg.cy,rect.Width(),enDir,nThres,bTop);
+			break;
+		case EDGE_FIRSTEDGE:
+			nPos = FindFirstEdge(m_pVproj,rect.top,rect.bottom,szImg.cy,rect.Width(),enDir,nThres,bTop);
+			break;
+		default:
+			{
+				if(m_pVproj != NULL)
+					delete[] m_pVproj, m_pVproj=NULL;	
+				return dAvgPos;
+			}
+		}
+
+		if(nPos <= -1)
+		{			
+			CSISBuffer		buffer(pImg,szImg.cx,szImg.cy);		
+			int nMaxVal;			
+			nPos = FindMaxContrast(buffer,rect,FALSE,nMaxVal,bTop);
+			if(nPos == -1)
+			{
+				if(m_pVproj != NULL)
+					delete[] m_pVproj, m_pVproj=NULL;	
+				return dAvgPos;
+			}
+		}
+
+		dAvgPos = (double)nPos;
+
+		rect.top = nPos - 5;
+		rect.bottom = nPos + 5;
+		double dTmp = FindLineSubPixel(pImg,szImg,rect,nThres,-nThres,DIR_VERTICAL,SearchTypeIn2Out,enSignalType);
+		if(dTmp != -1)
+			dAvgPos = dTmp;
+
+		//dAvgPos = GetSubPixelPos(pImg,nPos,szImg,rect,dRatio,bTop,DIR_VERTICAL,nNumber);
+	}
+
+	if(m_pVproj != NULL)
+		delete[] m_pVproj, m_pVproj=NULL;	
+
+	return dAvgPos;
+}
+
+void CEdgeFind::AssertOnFrameRect(CRect &rect,CSize szImg)
+{
+	if(szImg.cx <= 0 || szImg.cy <= 0)
+		return;
+
+	if(rect.left < 0) rect.left = 0;
+	if(rect.left > szImg.cx) rect.left = szImg.cx-1;	
+	if(rect.right < 0) rect.right = 0;
+	if(rect.right > szImg.cx) rect.right = szImg.cx-1;	
+	if(rect.left > rect.right) std::swap(rect.left,rect.right);
+	if(rect.top < 0) rect.top = 0;
+	if(rect.top > szImg.cy) rect.top = szImg.cy-1;
+	if(rect.bottom < 0) rect.bottom = 0;
+	if(rect.bottom > szImg.cy) rect.bottom = szImg.cy-1;
+	if(rect.top > rect.bottom) std::swap(rect.top,rect.bottom);
+}
+
+// BOOL IMProjGet(IMAGE src, ROI roi, long type, IMPROJ* res, unsigned long* max, unsigned long* min)
+//  * Get the projected data
+//  * Parameters
+//    - src : image
+//    - rect : ROI
+//    - type : direction
+//    - res : projection data pointer
+//    - max : maximum value
+//    - min : minimum value
+//------------------------------------------------------------------------
+BOOL CEdgeFind::FV_ProjGet(LPBYTE src,CSize szImg, CRect &rect, PROJECTION_TYPE type, IMPROJ* res, ULONG* max, ULONG* min)
+{
+	if(res == NULL || src == NULL)
+		return FALSE;
+
+	long			cu = szImg.cx, cv = szImg.cy;
+	unsigned char	*buf = src;
+	long			u, v, i;
+	unsigned long	sum, *mx = max, *mn = min;
+
+	switch(type)
+	{
+	case PROJECTION_VERTICAL:
+		ZeroMemory(res,sizeof(IMPROJ)*rect.Width());
+
+		*mx = 0;
+		*mn = (rect.bottom-rect.top+1)*255;
+
+		for(i=0, u=rect.left; u<rect.right; u++)
+		{
+			sum = 0L;
+			for(v=rect.top; v<rect.bottom; v++) 
+				sum += *(buf+u+cu*v);
+
+			res[u].x = u; 
+			res[u].f = sum;
+
+			if(*mx < sum) *mx = sum;
+			if(*mn > sum) *mn = sum;			
+
+			i++;			
+		}		
+		return TRUE;		
+	case PROJECTION_HORIZONTAL:
+		ZeroMemory(res,sizeof(IMPROJ)*rect.Height());
+
+		*mx = 0;
+		*mn = (rect.right-rect.left+1)*255;
+
+		for(i=0, v=rect.top; v<rect.bottom; v++)
+		{
+			sum = 0L;
+			for(u=rect.left; u<rect.right; u++) 
+				sum += *(buf+u+cu*v);
+
+			res[v].x = v; 			
+			res[v].f = sum;
+
+			if(*mx < sum) *mx = sum;
+			if(*mn > sum) *mn = sum;
+			i++;
+		}
+		return TRUE;
+	}
+	return	FALSE;
+}
+
+int CEdgeFind::FindMaxContrastEx(IMPROJ* src, int nStart,int nEnd, long Width, long Height, EDGELINE_POLAR enDir, long Thresh,BOOL bForward)
+{
+	long		i, j, k;
+	long		*fvalue;
+	int			ret = -1;
+	long		sum, max = 0, min = 0;
+	long		val;	
+
+	fvalue = new long[Width];
+	ZeroMemory(fvalue,sizeof(long)*Width);	
+
+	int			filterWidth;
+	int			*mask;
+
+	filterWidth = 2;
+	mask = (int*)malloc( sizeof(int) * ((filterWidth*2)+1) );
+
+	for(i=0; i<(filterWidth*2)+1; i++)
+	{
+		if(i < filterWidth)
+		{
+			mask[i] = -1;
+		}
+		else if( i == filterWidth)
+		{
+			mask[i] = 0;
+		}
+		else
+		{
+			mask[i] = 1;
+		}
+	}
+
+	for(i=nStart+filterWidth; i<nEnd - filterWidth-1; i++)
+	{
+		sum = 0;
+		for(j=0, k=-filterWidth; j<(filterWidth*2)+1; j++, k++)
+		{
+			sum += src[i+k].f * mask[j];
+		}
+
+		fvalue[i] = sum / ((Height+1)*filterWidth);  		
+	}
+
+	if(bForward == TRUE)
+	{
+		for(i=nStart; i<nEnd; i++)
+		{
+			if(enDir == POLAR_BTOW)
+			{
+				if(fvalue[i] >= Thresh)
+				{
+					if(fvalue[i] >= max)
+					{
+						max = fvalue[i];
+						ret = src[i].x;
+					}
+
+				}
+			}
+			else if(enDir == POLAR_WTOB)
+			{
+				val = fvalue[i]*-1;
+
+				if(val >= Thresh)		
+				{
+					if(val >= max)
+					{
+						max = val;
+						ret = src[i].x;
+					}
+				}
+			}
+			else if(enDir == POLAR_ANY)
+			{
+				val = abs(fvalue[i]);
+
+				if(val >= Thresh)
+				{
+					if(val >= max)
+					{
+						max = val;
+						ret = src[i].x;
+					}
+
+				}
+			}
+		}
+	}
+	else
+	{
+		for(i=nEnd-1; i>=nStart; i--)
+		{
+			if(enDir == POLAR_BTOW)
+			{
+				if(fvalue[i] >= Thresh)
+				{
+					if(fvalue[i] >= max)
+					{
+						max = fvalue[i];
+						ret = src[i].x;
+					}
+
+				}
+			}
+			else if(enDir == POLAR_WTOB)
+			{
+				val = fvalue[i]*-1;
+
+				if(val >= Thresh)		
+				{
+					if(val >= max)
+					{
+						max = val;
+						ret = src[i].x;
+					}
+				}
+			}
+			else if(enDir == POLAR_ANY)
+			{
+				val = abs(fvalue[i]);
+
+				if(val >= Thresh)
+				{
+					if(val >= max)
+					{
+						max = val;
+						ret = src[i].x;
+					}
+
+				}
+			}
+		}
+	}
+
+	delete[] fvalue;
+	if(mask) free(mask);
+
+	return ret;
+}
+
+int CEdgeFind::FindMaxContrast(CSISBuffer &bufferOrg,CRect rect,BOOL bHor,int &nMaxDiff,BOOL bForward)
+{
+	int			nPos = -1;
+	int			i,j,nCnt,iLoop;
+	int			*pVal = NULL;	
+	int			nMaxVal = 0;
+	int			nDiff;
+
+	nMaxDiff = 0;
+	if(bHor == TRUE)
+	{
+		pVal = new int[rect.Width()+1];
+		nCnt = rect.Width()+1;
+		ZeroMemory(pVal,sizeof(int)*nCnt);
+		for(i=rect.top;i<rect.bottom;i++)
+		{
+			iLoop = 0;
+			for(j=rect.left;j<=rect.right-1;j++,iLoop++)
+			{
+				nDiff = abs(*bufferOrg.GetDataAddress(j,i)-*bufferOrg.GetDataAddress(j+1,i));
+				pVal[iLoop] += nDiff;
+				if(nDiff > nMaxDiff)
+					nMaxDiff = nDiff;
+			}
+		}
+
+		for(i=0;i<nCnt;i++)
+		{
+			if(nMaxVal < pVal[i])
+			{
+				nMaxVal = pVal[i];
+				nPos = i+rect.left+1;
+			}
+		}
+	}
+	else
+	{
+		pVal = new int[rect.Height()+1];
+		nCnt = rect.Height()+1;
+		ZeroMemory(pVal,sizeof(int)*nCnt);
+		if(bForward == TRUE)
+		{
+			for(i=rect.left;i<rect.right;i++)
+			{
+				iLoop = 0;			
+				for(j=rect.top;j<=rect.bottom-1;j++,iLoop++)
+				{
+					nDiff = abs(*bufferOrg.GetDataAddress(i,j)-*bufferOrg.GetDataAddress(i,j+1));;
+					pVal[iLoop] += nDiff;
+					if(nDiff > nMaxDiff)
+						nMaxDiff = nDiff;
+				}
+			}
+
+			for(i=0;i<nCnt;i++)
+			{
+				if(nMaxVal < pVal[i])
+				{
+					nMaxVal = pVal[i];
+					nPos = i+rect.top+1;
+				}
+			}
+		}
+		else
+		{
+			for(i=rect.left;i<rect.right;i++)
+			{
+				iLoop = 0;
+				for(j=rect.bottom;j>=rect.top+1;j--,iLoop++)
+				{
+					nDiff = abs(*bufferOrg.GetDataAddress(i,j)-*bufferOrg.GetDataAddress(i,j-1));
+					pVal[iLoop] += nDiff;
+					if(nDiff > nMaxDiff)
+						nMaxDiff = nDiff;
+				}
+			}	
+
+			for(i=0;i<nCnt;i++)
+			{
+				if(nMaxVal < pVal[i])
+				{
+					nMaxVal = pVal[i];
+					nPos = rect.bottom-i-1;
+				}
+			}
+		}	
+	}	
+
+	if(pVal != NULL)
+		delete[] pVal, pVal=NULL;
+
+	return nPos;
+}
+
+int CEdgeFind::FindFirstEdge(IMPROJ* src, int nStart,int nEnd, long Width, long Height, EDGELINE_POLAR enDir, long Thresh,BOOL bForward)
+{
+	long		i, j, k;
+	long		*fvalue;
+	int			ret = -1;
+	long		sum;
+	long		max=0, max_index=0;
+	int			filterWidth;
+	int			*mask;
+
+	filterWidth = 2;
+	mask = (int*)malloc( sizeof(int) * ((filterWidth*2)+1) );
+
+	for(i=0; i<(filterWidth*2)+1; i++)
+	{
+		if(i < filterWidth)
+		{
+			mask[i] = -1;
+		}
+		else if( i == filterWidth)
+		{
+			mask[i] = 0;
+		}
+		else
+		{
+			mask[i] = 1;
+		}
+	}
+
+	if(filterWidth == 0) return -2;
+
+	fvalue = new long[Width];
+	ZeroMemory(fvalue,sizeof(long)*Width);		
+
+	if(bForward == TRUE)
+	{
+		for(i=nStart+filterWidth; i<nEnd - filterWidth-1; i++)
+		{
+			sum = 0;
+			for(j=0, k=-filterWidth; j<(filterWidth*2)+1; j++, k++)
+			{
+				sum += src[i+k].f * mask[j];
+			}
+
+			fvalue[i] = sum / ((Height+1)*filterWidth);  		
+		}
+
+		for(i=nStart; i<nEnd; i++)
+		{
+			if(enDir == POLAR_BTOW)
+			{
+				if(fvalue[i] > Thresh)
+				{
+					for(int j=0; j<filterWidth+1; j++)
+					{
+						if(fvalue[i+j] > max)
+						{
+							max = fvalue[i+j];
+							max_index = j;
+						}
+					}
+
+					ret = src[i].x + max_index;
+					break;
+				}
+			}
+			else if(enDir == POLAR_WTOB)
+			{
+				if(fvalue[i]*-1 > Thresh)
+				{
+					for(int j=0; j<filterWidth+1; j++)
+					{
+						if(fvalue[i+j]*-1 > max)
+						{
+							max = fvalue[i+j];
+							max_index = j;
+						}
+					}
+
+					ret = src[i].x + max_index;
+					break;
+				}
+			}
+			else if(enDir == POLAR_ANY)
+			{
+				if(abs(fvalue[i]) > Thresh)
+				{
+					for(int j=0; j<filterWidth+1; j++)
+					{
+						if(abs(fvalue[i+j]) > max)
+						{
+							max = fvalue[i+j];
+							max_index = j;
+						}
+					}
+
+					ret = src[i].x + max_index;
+					break;
+				}
+			}
+		}
+	}
+	else
+	{
+		for(i=nEnd - filterWidth-1; i>=nStart+filterWidth; i--)
+		{
+			sum = 0;
+			for(j=0, k=filterWidth; j<(filterWidth*2)+1; j++, k--)
+			{
+				sum += src[i+k].f * mask[j];
+			}
+
+			fvalue[i] = sum / ((Height+1)*filterWidth);  		
+		}
+
+		for(i=nEnd-1; i>=nStart; i--)
+		{
+			if(enDir == POLAR_BTOW)
+			{
+				if(fvalue[i] > Thresh)
+				{
+					for(int j=0; j<filterWidth+1; j++)
+					{
+						if(fvalue[i+j] > max)
+						{
+							max = fvalue[i+j];
+							max_index = j;
+						}
+					}
+
+					ret = src[i].x + max_index;
+					break;
+				}
+			}
+			else if(enDir == POLAR_WTOB)
+			{
+				if(fvalue[i]*-1 > Thresh)
+				{
+					for(int j=0; j<filterWidth+1; j++)
+					{
+						if(fvalue[i+j]*-1 > max)
+						{
+							max = fvalue[i+j];
+							max_index = j;
+						}
+					}
+
+					ret = src[i].x + max_index;
+					break;
+				}
+			}
+			else if(enDir == POLAR_ANY)
+			{
+				if(abs(fvalue[i]) > Thresh)
+				{
+					for(int j=0; j<filterWidth+1; j++)
+					{
+						if(abs(fvalue[i+j]) > max)
+						{
+							max = fvalue[i+j];
+							max_index = j;
+						}
+					}
+
+					ret = src[i].x + max_index;
+					break;
+				}
+			}
+		}
+	}
+
+	delete[] fvalue;
+	if(mask) free(mask);
+
+	return ret;
+}
+
+double CEdgeFind::FindLineSubPixel(LPBYTE pImg,CSize szImg,CRect &rectIns,int nPosiThres,int nNegaThres,EDGELINE_DIR enDir,EdgeSearchType enSearchType,EdgeSignalType enSignalType,int nKernelSize)
+{
+	if(pImg ==  NULL)
+		return -1;
+
+	CRect		rect = rectIns;		
+	double		dAvgPos = -1;	
+
+	AssertOnFrameRect(rect,szImg);
+
+	if(CalculateImageValue(enDir,pImg,szImg.cx,szImg.cy,rect,szImg.cx,m_vectorImageData) == FALSE)
+		return dAvgPos;
+
+	if(CalculateEdgeValue(m_vectorImageData,m_vectorEdgeData,m_vectorEdgeType,nPosiThres,nNegaThres,nKernelSize) == FALSE)
+		return dAvgPos;
+
+	CalculateEdgePosition(SubPixelQuadratic, nPosiThres, nNegaThres);
+
+	// get left position
+	double dLeftPos = 9999.0;
+	if (!GetEdgeLeftPosition(enSignalType, enSearchType, 0, dLeftPos))
+	{
+		return dAvgPos;
+	}
+
+	if(enDir == DIR_HORIZONTAL)
+		dAvgPos = rect.left + dLeftPos;
+	else
+		dAvgPos = rect.top + dLeftPos;
+
+	return dAvgPos;
+}
+
+BOOL CEdgeFind::CalculateImageValue(EDGELINE_DIR nDirection, BYTE *pImage, int nWidth, int nHeight, CRect &rect, int nStep, VectorDouble& vectorImageData)
+{
+	vectorImageData.clear();
+
+	if (pImage==NULL) return FALSE;
+
+	double dValue = 0.0;
+
+	switch (nDirection)
+	{
+	case DIR_HORIZONTAL:
+		for (int j=rect.left; j<rect.right; j++)
+		{
+			dValue = 0.0;
+			for (int i=rect.top; i<rect.bottom; i++)
+			{
+				dValue += pImage[(i*nStep)+j];
+			}
+			dValue /= double(rect.Height());
+			vectorImageData.push_back(dValue);
+		}
+		break;
+
+	case DIR_VERTICAL:
+		for (int i=rect.top; i<rect.bottom; i++)
+		{	
+			dValue = 0.0;
+			for (int j=rect.left; j<rect.right; j++)
+			{
+				dValue += UCHAR(pImage[(i*nStep)+j]);
+			}
+			dValue /= double(rect.Width());
+			vectorImageData.push_back(dValue);
+		}
+		break;
+	}
+
+	return TRUE;
+}
+
+BOOL CEdgeFind::CalculateEdgeValue(EDGELINE_DIR nDirection, short *pImage, int nWidth, int nHeight, int nStep, VectorDouble& vectorEdgeData, VectorInteger& vectorEdgeType, double dPositiveThres, double dNegativeThres)
+{
+	vectorEdgeData.clear();
+	vectorEdgeType.clear();
+
+	if (pImage==NULL) return FALSE;
+
+	double dValue = 0.0;
+	int nType = EdgeTypeNone;
+
+	switch (nDirection)
+	{
+	case DIR_VERTICAL:
+		for (int j=0; j<nWidth; j++)
+		{
+			dValue = 0.0;
+			nType = EdgeTypeNone;
+
+			for (int i=0; i<nHeight; i++)
+			{
+				dValue += pImage[(i*nStep)+j];
+			}
+			dValue /= double(nHeight);
+
+			if (dValue >= dPositiveThres)
+			{
+				nType = EdgeTypePositive;
+			}
+			else if (dValue <= dNegativeThres )
+			{
+				nType = EdgeTypeNegative;
+			}
+
+			vectorEdgeType.push_back(nType);
+			vectorEdgeData.push_back(dValue);
+		}
+		break;
+
+	case DIR_HORIZONTAL:
+		for (int i=0; i<nHeight; i++)
+		{	
+			dValue = 0.0;
+			nType = EdgeTypeNone;
+
+			for (int j=0; j<nWidth; j++)
+			{
+				dValue += UCHAR(pImage[(i*nStep)+j]);
+			}
+			dValue /= double(nWidth);
+
+			if (dValue >= dPositiveThres)
+			{
+				nType = EdgeTypePositive;
+			}
+			else if (dValue <= dNegativeThres )
+			{
+				nType = EdgeTypeNegative;
+			}
+
+			vectorEdgeData.push_back(dValue);
+			vectorEdgeType.push_back(nType);
+		}
+		break;
+	}
+
+	return TRUE;
+}
+
+BOOL CEdgeFind::CalculateEdgeValue(const VectorDouble& vectorImageData, VectorDouble& vectorEdgeData, int nKernelSize)
+{	
+	if (nKernelSize<2 || (nKernelSize%2)!=0) return FALSE;
+
+	if (vectorImageData.size()<nKernelSize) return FALSE;
+
+	vectorEdgeData.clear();
+
+	double dLeft	= 0.0;
+	double dRight	= 0.0;
+	double dValue	= 0.0;
+
+	UINT nPitchSize = nKernelSize/2;
+
+	// push first pitch
+	for (UINT i=0; i<nPitchSize; i++)
+	{
+		vectorEdgeData.push_back(0.0);
+	}
+
+	// push center pitch
+	for (UINT i=0; i<vectorImageData.size()-(nKernelSize); i++)
+	{
+		dLeft = dRight = 0.0;
+		for (UINT j=0; j<nPitchSize; j++)
+		{
+			dLeft	+= vectorImageData[i+j];
+			dRight	+= vectorImageData[i+j+nPitchSize];
+		}
+		dLeft /= double(nPitchSize);
+		dRight /= double(nPitchSize);
+
+		dValue = dRight - dLeft;
+		vectorEdgeData.push_back(dValue);
+	}
+
+	// push last pitch
+	for (UINT i=0; i<nPitchSize; i++)
+	{
+		vectorEdgeData.push_back(0.0);
+	}
+
+	return TRUE;
+}
+
+BOOL CEdgeFind::CalculateEdgeValue(const VectorDouble& vectorImageData, VectorDouble& vectorEdgeData, VectorInteger& vectorEdgeType, double dPositiveThres, double dNegativeThres, int nKernelSize)
+{	
+	vectorEdgeData.clear();
+	vectorEdgeType.clear();
+
+	if (nKernelSize<2 || (nKernelSize%2)!=0) return FALSE;
+	if (vectorImageData.size()<nKernelSize) return FALSE;
+
+	int nType		= EdgeTypeNone;
+	double dLeft	= 0.0;
+	double dRight	= 0.0;
+	double dValue	= 0.0;
+
+	UINT nPitchSize = nKernelSize/2;
+
+	// push first pitch
+	for (UINT i=0; i<nPitchSize; i++)
+	{
+		vectorEdgeData.push_back(0.0);
+		vectorEdgeType.push_back(EdgeTypeNone);
+	}
+
+	// push center pitch
+	for (UINT i=0; i<vectorImageData.size()-(nKernelSize); i++)
+	{
+		dLeft = dRight = 0.0;
+		nType = EdgeTypeNone;
+
+		for (UINT j=0; j<nPitchSize; j++)
+		{
+			dLeft	+= vectorImageData[i+j];
+			dRight	+= vectorImageData[i+j+nPitchSize];
+		}
+		dLeft /= double(nPitchSize);
+		dRight /= double(nPitchSize);
+
+		dValue = dRight - dLeft;
+		if (dValue >= dPositiveThres)
+		{
+			nType = EdgeTypePositive;
+		}
+		else if (dValue <= dNegativeThres )
+		{
+			nType = EdgeTypeNegative;
+		}
+
+		vectorEdgeData.push_back(dValue);
+		vectorEdgeType.push_back(nType);
+	}
+
+	// push last pitch
+	for (UINT i=0; i<nPitchSize; i++)
+	{
+		vectorEdgeData.push_back(0.0);
+		vectorEdgeType.push_back(EdgeTypeNone);
+	}
+
+	return TRUE;
+}
+
+void CEdgeFind::CalculateEdgePosition(int nSubPixelType, double dPosiThres, double dNegaThres)
+{
+	m_vectorEdgeResult.clear();
+
+	int nEdgeIndex = 0;
+	int nEdgePosition = 0;
+	int nEdgeType = EdgeTypeNone;
+	double dEdgeValue = 0.0;
+	double dEdgeThres = 0.0;
+
+	if (nSubPixelType==SubPixelLinear)
+	{
+		for (UINT i=1; i<m_vectorEdgeType.size()-1; i++)
+		{
+			if (m_vectorEdgeType[i-1] == m_vectorEdgeType[i]) continue;
+
+			switch(m_vectorEdgeType[i])
+			{
+			case EdgeTypeNone:
+				nEdgePosition = i-1;
+				nEdgeType = m_vectorEdgeType[nEdgePosition];
+				dEdgeThres = (m_vectorEdgeType[nEdgePosition]==EdgeTypePositive) ? dPosiThres: dNegaThres;
+				dEdgeValue = m_vectorEdgeData[nEdgePosition];
+				break;
+			case EdgeTypeNegative:
+				nEdgePosition = i;
+				nEdgeType = EdgeTypeNegative;
+				dEdgeThres = dNegaThres;
+				dEdgeValue = m_vectorEdgeData[i];
+				break;
+			case EdgeTypePositive:
+				nEdgePosition = i;
+				nEdgeType = EdgeTypePositive;
+				dEdgeThres = dPosiThres;
+				dEdgeValue = m_vectorEdgeData[i];
+				break;
+			} // end switch
+
+			if (nEdgeType==EdgeTypeNone) continue;
+
+			CEdgeResult edgeResult(nEdgeIndex, nEdgeType, nEdgePosition, dEdgeValue);
+
+			if (CalculateInterpolateLinear(edgeResult, dEdgeThres))
+			{
+				if(edgeResult.dPosition >= 0 && edgeResult.dPosition <= m_vectorEdgeType.size()-1)
+				{
+					m_vectorEdgeResult.push_back(edgeResult);
+					nEdgeIndex++;
+				}
+			}
+
+		} // end for
+	}
+	else
+	{
+		for (UINT i=1; i<m_vectorEdgeType.size()-1; i++)
+		{
+			nEdgeType = EdgeTypeNone;
+
+			switch(m_vectorEdgeType[i])
+			{
+			case EdgeTypePositive:
+				{
+					nEdgeType		= EdgeTypePositive;
+					nEdgePosition	= i;
+					dEdgeValue		= m_vectorEdgeData[i];
+
+					for (UINT j=i+1; j<m_vectorEdgeType.size()-1; j++)
+					{
+						if (m_vectorEdgeType[j] != EdgeTypePositive) break;
+
+						if (dEdgeValue < m_vectorEdgeData[j])
+						{
+							nEdgePosition	= j;
+							dEdgeValue		= m_vectorEdgeData[j];
+						}
+						i = j;
+					}
+				}
+				break;
+
+			case EdgeTypeNegative:
+				{
+					nEdgeType		= EdgeTypeNegative;
+					nEdgePosition	= i;
+					dEdgeValue		= m_vectorEdgeData[i];
+
+					for (UINT j=i+1; j<m_vectorEdgeType.size()-1; j++)
+					{
+						if (m_vectorEdgeType[j] != EdgeTypeNegative) break;
+
+						if (dEdgeValue > m_vectorEdgeData[j])
+						{
+							nEdgePosition	= j;
+							dEdgeValue		= m_vectorEdgeData[j];
+						}
+						i = j;
+					}
+
+				}
+				break;
+			} // end switch
+
+			if (nEdgeType==EdgeTypeNone) continue;
+
+			CEdgeResult edgeResult(nEdgeIndex, nEdgeType, nEdgePosition, dEdgeValue);
+
+			switch(nSubPixelType)
+			{
+			case SubPixelQuadratic:
+				if (CalculateInterpolateQuadratic(edgeResult))
+				{
+					m_vectorEdgeResult.push_back(edgeResult);
+					nEdgeIndex++;
+				}
+				break;
+
+			case SubPixelRegression:
+				if (CalculateInterpolateRegression(edgeResult))
+				{
+					m_vectorEdgeResult.push_back(edgeResult);
+					nEdgeIndex++;
+				}
+				break;
+			} // end switch
+
+		} // end for 
+	}
+
+}
+
+BOOL CEdgeFind::CalculateInterpolateQuadratic(CEdgeResult& edgeResult)
+{
+	if (m_vectorEdgeData.size()<1) return FALSE;
+
+	UINT i = 0;
+
+	for (i=edgeResult.nEdgePosition-1; i>0; i--)
+	{
+		if (m_vectorEdgeType[i]!=edgeResult.nSignal) break;
+		edgeResult.nLeftPosition = i;
+	}
+
+	for (i=edgeResult.nEdgePosition+1; i<m_vectorEdgeType.size(); i++)
+	{
+		if (m_vectorEdgeType[i]!=edgeResult.nSignal) break;
+		edgeResult.nRightPosition = i;
+	}
+
+	// coef
+	if (edgeResult.nLeftPosition==edgeResult.nEdgePosition) 
+		edgeResult.nLeftPosition = edgeResult.nEdgePosition - 1;
+
+	if (edgeResult.nRightPosition==edgeResult.nEdgePosition) 
+		edgeResult.nRightPosition = edgeResult.nEdgePosition + 1;
+
+	edgeResult.nLeftPosition = edgeResult.nEdgePosition - 1;
+	edgeResult.nRightPosition = edgeResult.nEdgePosition + 1;
+
+	// set 3 point
+	VectorDouble vectorX; // x point
+	vectorX.push_back(double(edgeResult.nLeftPosition));
+	vectorX.push_back(double(edgeResult.nEdgePosition));
+	vectorX.push_back(double(edgeResult.nRightPosition));
+
+	VectorDouble vectorY; // y point
+	vectorY.push_back(m_vectorEdgeData[edgeResult.nLeftPosition]);
+	vectorY.push_back(m_vectorEdgeData[edgeResult.nEdgePosition]);
+	vectorY.push_back(m_vectorEdgeData[edgeResult.nRightPosition]);
+
+	// for debug
+	/*	double vect[3][2];
+	vect[0][0] = vectorX[0];
+	vect[1][0] = vectorX[1];
+	vect[2][0] = vectorX[2];
+	vect[0][1] = vectorY[0];
+	vect[1][1] = vectorY[1];
+	vect[2][1] = vectorY[2];
+	*/	
+	ListPolynomial listPolynomial; // result polynomial
+
+	// Lagrange equation
+	if (!CalculateLagrange(vectorX, vectorY, listPolynomial))
+	{
+		return FALSE;
+	}
+
+	// get coef
+	double a=0., b=0., c=0.;
+	for (ListPolynomialIt it=listPolynomial.begin(); it!=listPolynomial.end(); it++)
+	{
+		CPolynomial *pCurrent = *it;
+
+		if (pCurrent->dCoef!=0.0)
+		{
+			switch(pCurrent->nDegree)
+			{
+			case 2:
+				a = pCurrent->dCoef;
+				break;
+
+			case 1:
+				b = pCurrent->dCoef;
+				break;
+
+			case 0:
+				c = pCurrent->dCoef;
+				break;
+			}
+		}
+	}
+
+	//	PrintGraph(listPolynomial, edgeResult.nLeftPosition - edgeResult.nEdgePosition, edgeResult.nRightPosition - edgeResult.nEdgePosition);
+
+	// remove polynomial
+	RemovePolynomial(listPolynomial);
+
+	// 盔贰 困摹 汗蓖.
+	edgeResult.dPosition	= (-1.0 * b) / (2.0 * a);
+	edgeResult.dStrength	= -1.0 * ( ( (b*b) - (4.0 * a * c) ) / (4.0 * a) );
+
+	return TRUE;
+}
+
+BOOL CEdgeFind::CalculateInterpolateRegression(CEdgeResult& edgeResult)
+{
+	if (m_vectorEdgeData.size()<1) return FALSE;
+
+	UINT i = 0;
+
+	for (i=edgeResult.nEdgePosition-1; i>0; i--)
+	{
+		if (m_vectorEdgeType[i]!=edgeResult.nSignal) break;
+		edgeResult.nLeftPosition = i;
+	}
+
+	for (i=edgeResult.nEdgePosition+1; i<m_vectorEdgeType.size(); i++)
+	{
+		if (m_vectorEdgeType[i]!=edgeResult.nSignal) break;
+		edgeResult.nRightPosition = i;
+	}
+
+//	if ((edgeResult.nRightPosition-edgeResult.nLeftPosition)<2) return FALSE;
+
+	VectorDouble srcX, srcY;
+	for (i=(UINT)edgeResult.nLeftPosition; i<(UINT)edgeResult.nRightPosition+1; i++)
+	{
+		srcX.push_back(double(i));
+		srcY.push_back(m_vectorEdgeData[i]);
+	}
+
+	double c, b, a;
+	if (!QuadraticRegression(srcX, srcY, c, b, a))
+	{
+		return FALSE;
+	}
+
+	edgeResult.dPosition	= (-1.0 * b) / (2.0 * a);
+	edgeResult.dStrength	= -1.0 * ( ( (b*b) - (4.0 * a * c) ) / (4.0 * a) );
+
+	return TRUE;
+}
+
+BOOL CEdgeFind::CalculateInterpolateLinear(CEdgeResult& edgeResult, double dEdgeThreshold)
+{
+	UINT i = 0;
+
+	int nPosition = edgeResult.nEdgePosition-1;
+	double dPositionValue = m_vectorEdgeData[edgeResult.nEdgePosition-1];
+	double dValue = m_vectorEdgeData[edgeResult.nEdgePosition];
+
+	VectorDouble vectorX; // x point
+	vectorX.push_back(double(edgeResult.nEdgePosition-1));
+	vectorX.push_back(double(edgeResult.nEdgePosition));
+
+	VectorDouble vectorY; // y point
+	vectorY.push_back(m_vectorEdgeData[edgeResult.nEdgePosition-1]);
+	vectorY.push_back(m_vectorEdgeData[edgeResult.nEdgePosition]);
+
+	ListPolynomial listPolynomial; // result polynomial
+
+	// Lagrange equation
+	if (!CalculateLagrange(vectorX, vectorY, listPolynomial))
+	{
+		return FALSE;
+	}
+
+	// coef
+	double a=0., b=0.;
+	for (ListPolynomialIt it=listPolynomial.begin(); it!=listPolynomial.end(); it++)
+	{
+		CPolynomial *pCurrent = *it;
+
+		if (pCurrent->dCoef!=0.0)
+		{
+			switch(pCurrent->nDegree)
+			{
+			case 1:
+				a = pCurrent->dCoef;
+				break;
+
+			case 0:
+				b = pCurrent->dCoef;
+				break;
+			}
+		}
+	}
+
+	// remove polynomial
+	RemovePolynomial(listPolynomial);
+
+	if (edgeResult.nSignal==EdgeTypeNegative)
+	{
+		dEdgeThreshold *= -1.0;
+	}
+
+	edgeResult.dPosition	= (dEdgeThreshold-b) / a;
+	edgeResult.dStrength	= dEdgeThreshold;
+
+	return TRUE;
+}
+
+BOOL CEdgeFind::CalculateLagrange(VectorDouble& vectorX, VectorDouble& vectorY, ListPolynomial& listPolynomial)
+{
+	if (vectorX.size()<2) return FALSE;
+
+	if (vectorX.size()!=vectorY.size()) return FALSE;
+
+	int n = int(vectorX.size());
+
+	int i, j;
+
+	int sign;
+
+	double coef, temp;
+
+	for (i=0; i<n; i++)
+	{
+		if (!vectorY[i]) continue;
+
+		coef = vectorY[i];
+
+		for (j=0; j<n; j++)
+		{
+			if (i==j) continue;
+
+			if (vectorX[i]==vectorX[j])
+			{
+				RemovePolynomial(listPolynomial);
+				return FALSE;
+			}
+
+			coef /= vectorX[i] - vectorX[j];
+
+		}
+
+		temp = vectorX[i];
+		vectorX[i] = 0;
+
+		for (j=0; j<n; j++)
+		{
+			if (j%2)
+			{
+				sign = -1;
+			}
+			else
+			{
+				sign = 1;
+			}
+
+			InsertPolynomial(listPolynomial, n-j-1, sign*coef*Combi(vectorX, vectorY, n, j));
+		}
+
+		vectorX[i] = temp;
+	}
+
+	return TRUE;
+
+}
+
+void CEdgeFind::InsertPolynomial(ListPolynomial &listPolynomial, int degree, double coef)
+{
+	if (coef==0.0) return;
+
+	CPolynomial *pNewPoly = new CPolynomial(degree, coef);
+
+	BOOL bAdded = FALSE;
+
+	for(ListPolynomialIt it=listPolynomial.begin(); it!= listPolynomial.end(); it++)
+	{
+		CPolynomial *pCurrent = *it;
+
+		if (pCurrent->nDegree == pNewPoly->nDegree)
+		{
+			// 泅犁 畴靛客 瞒荐 鞍栏搁 泅犁 畴靛俊 拌荐甫 歹窍绊, 积己畴靛绰 昏力茄促.
+			pCurrent->dCoef += pNewPoly->dCoef;
+			delete pNewPoly;
+			bAdded = TRUE;
+			break;
+		}
+		else if (pCurrent->nDegree < pNewPoly->nDegree)
+		{
+			// 泅犁 菊俊 火涝茄促.
+			listPolynomial.push_front(pNewPoly);
+			bAdded = TRUE;
+			break;
+		}
+	}
+
+	// 菊俊辑 眠啊啊 救登菌栏搁, 盖第俊 火涝茄促.
+	if (!bAdded)
+	{
+		listPolynomial.push_back(pNewPoly);
+		return;
+	}
+}
+
+void CEdgeFind::RemovePolynomial(ListPolynomial& listPolynomial)
+{
+/*	for(ListPolynomialIt it=listPolynomial.begin(); it!= listPolynomial.end(); it++)
+	{
+		CPolynomial *pNode = *it;
+
+		//listPolynomial.erase(it);
+		delete pNode;
+	}
+	listPolynomial.clear();	
+*/
+
+	ListPolynomialIt it = listPolynomial.begin();
+	while (it != listPolynomial.end()) 
+	{
+		CPolynomial *pNode = *it;
+		delete pNode;
+		listPolynomial.erase(it++);
+	}
+	listPolynomial.clear();	
+}
+
+double CEdgeFind::Combi(VectorDouble& vectorX, VectorDouble& vectorY, int n, int r)
+{
+	int i;
+	double result = 1;
+
+	if (n<0 || r<0 || n<r) return 0.0;
+
+	if (n==r)
+	{
+		for(i=0; i<n; i++)
+		{
+			result *= vectorX[i];
+		}
+		return result;
+	}
+
+	if (r!=0) 
+	{
+		return vectorX[n-1]*Combi(vectorX, vectorY, n-1, r-1)+Combi(vectorX, vectorY, n-1, r);
+	}
+
+	return 1.0;
+}
+
+BOOL CEdgeFind::QuadraticRegression(VectorDouble& vectorX, VectorDouble& vectorY, double& a0, double& a1, double& a2)
+{
+	double Y = std::accumulate(vectorY.begin(), vectorY.end(), 0.0);
+	double X = std::accumulate(vectorX.begin(), vectorX.end(), 0.0);
+	double X2 = std::accumulate(vectorX.begin(), vectorX.end(), 0.0, Square);
+	double X3 = std::accumulate(vectorX.begin(), vectorX.end(), 0.0, Cubic);
+	double X4 = std::accumulate(vectorX.begin(), vectorX.end(), 0.0, ForthPower);
+
+	double K = 0.0;
+	double L = 0.0;
+
+	int i = 0;
+	int n = (int)vectorX.size();
+
+	for(i = 0; i<n; i++)
+	{
+		K += (vectorY[i] * vectorX[i] * vectorX[i]);
+		L += (vectorY[i] * vectorX[i]);
+	}
+
+	double denominator = -n*X4*X2 + X4*X*X + X2*X2*X2 + X3*X3*n - 2*X3*X*X2;
+	double b0p = -(Y*X4*X2 - Y*X3*X3 - X*L*X4 + X*X3*K - X2*X2*K + X2*X3*L);
+	double b1p = X*Y*X4 - X*K*X2 - L*n*X4 + X3*n*K - Y*X2*X3 + X2*X2*L;
+	double b2p = -(K*n*X2 - K*X*X - X2*X2*Y - X3*n*L + X3*X*Y + X*X2*L);
+
+	a0 = b0p/denominator;
+	a1 = b1p/denominator;
+	a2 = b2p/denominator;
+
+	return TRUE;
+}
+
+double CEdgeFind::Square(double init, double x)
+{
+	return init + x*x;
+}
+
+double CEdgeFind::Cubic(double init, double x)
+{
+	return init + x*x*x;
+}
+
+double CEdgeFind::ForthPower(double init, double x)
+{
+	return init + x*x*x*x;
+}
+
+double CEdgeFind::AbsSum(double init, double x)
+{
+	x = (x>0) ? x: -x;
+	return init + x;
+}
+
+double CEdgeFind::Sum(double init, double x)
+{
+	return init + x;
+}
+
+BOOL CEdgeFind::GetEdgeLeftPosition(int nEdgeType, int nSearchType, int nStartPos, double& dPosition)
+{
+	if (m_vectorEdgeResult.size()<1) return FALSE;
+
+	BOOL	bReturn		= FALSE;
+	UINT	nWidth		= (UINT)m_vectorImageData.size();
+	double	dValue		= -9999.0;
+	int		nIndex		= -1;
+
+	UINT i = 0;
+	switch(nSearchType)
+	{
+	case SearchTypeOut2In:
+		dPosition = 9999.;
+		for (i=0; i<m_vectorEdgeResult.size(); i++)
+		{
+			if (m_vectorEdgeResult[i].nSignal != nEdgeType) continue;
+			if (m_vectorEdgeResult[i].dPosition < nStartPos) continue;	
+
+			if (m_vectorEdgeResult[i].dPosition < dPosition)
+			{
+				dValue		= m_vectorEdgeResult[i].dStrength;
+				dPosition	= m_vectorEdgeResult[i].dPosition;
+				bReturn		= TRUE;
+				nIndex		= i;				
+			}
+		}
+		break;
+
+	case SearchTypeIn2Out:
+		dPosition = -9999.;
+		for (i=0; i<m_vectorEdgeResult.size(); i++)
+		{
+			if (m_vectorEdgeResult[i].nSignal != nEdgeType) continue;
+			if (m_vectorEdgeResult[i].dPosition < nStartPos) continue;	
+
+			if (m_vectorEdgeResult[i].dPosition > dPosition)
+			{
+				dValue		= m_vectorEdgeResult[i].dStrength;
+				dPosition	= m_vectorEdgeResult[i].dPosition;
+				bReturn		= TRUE;
+				nIndex		= i;				
+			}
+		}
+		break;
+
+	case SearchTypeMinMax:
+		dValue = 0.;
+		for (i=0; i<m_vectorEdgeResult.size(); i++)
+		{
+			if (m_vectorEdgeResult[i].nSignal != nEdgeType) continue;
+			if (m_vectorEdgeResult[i].dPosition < nStartPos) continue;	
+
+			if ( fabs(dValue) < fabs(m_vectorEdgeResult[i].dStrength))
+			{
+				dValue		= m_vectorEdgeResult[i].dStrength;
+				dPosition	= m_vectorEdgeResult[i].dPosition;
+				bReturn		= TRUE;
+				nIndex		= i;
+			}
+		}
+		break;
+
+	default:
+		return FALSE;
+	}
+
+	if (nIndex!=-1)
+		m_vectorEdgeResult[nIndex].nEdgeType = EdgeResultLeft;
+
+	return bReturn;
+}
+
+BOOL CEdgeFind::GetEdgeRightPosition(int nEdgeType, int nSearchType, int nStartPos, double& dPosition)
+{
+	if (m_vectorEdgeResult.size()<1) return FALSE;
+
+	BOOL	bReturn		= FALSE;
+	UINT	nWidth		= (UINT)m_vectorImageData.size();
+	double	dValue		= -9999.0;
+	int		nIndex		= -1;
+
+	UINT i = 0;
+	switch(nSearchType)
+	{
+	case SearchTypeOut2In:
+		dPosition = -9999.;
+		for (i=0; i<m_vectorEdgeResult.size(); i++)
+		{
+			if (m_vectorEdgeResult[i].nSignal != nEdgeType) continue;
+			if (m_vectorEdgeResult[i].dPosition < nStartPos) continue;	
+
+			if (m_vectorEdgeResult[i].dPosition > dPosition)
+			{
+				dValue		= m_vectorEdgeResult[i].dStrength;
+				dPosition	= m_vectorEdgeResult[i].dPosition;
+				bReturn		= TRUE;
+				nIndex		= i;
+			}
+		}
+		break;
+
+	case SearchTypeIn2Out:
+		dPosition = 9999.;
+		for (i=0; i<m_vectorEdgeResult.size(); i++)
+		{
+			if (m_vectorEdgeResult[i].nSignal != nEdgeType) continue;
+			if (m_vectorEdgeResult[i].dPosition < nStartPos) continue;	
+
+			if (m_vectorEdgeResult[i].dPosition < dPosition)
+			{
+				dValue		= m_vectorEdgeResult[i].dStrength;
+				dPosition	= m_vectorEdgeResult[i].dPosition;
+				bReturn		= TRUE;
+				nIndex		= i;
+			}
+		}
+		break;
+
+	case SearchTypeMinMax:
+		dValue = 0;
+		for (i=0; i<m_vectorEdgeResult.size(); i++)
+		{
+			if (m_vectorEdgeResult[i].nSignal != nEdgeType) continue;
+			if (m_vectorEdgeResult[i].dPosition < nStartPos) continue;	
+
+			if ( fabs(dValue) < fabs(m_vectorEdgeResult[i].dStrength))
+			{
+				dValue		= m_vectorEdgeResult[i].dStrength;
+				dPosition	= m_vectorEdgeResult[i].dPosition;
+				bReturn		= TRUE;
+				nIndex		= i;
+			}
+		}
+		break;
+
+	default:
+		return FALSE;
+	}
+
+	if (nIndex!=-1)
+		m_vectorEdgeResult[nIndex].nEdgeType = EdgeResultRight;
+
+	return bReturn;
+}
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/EdgeInspect.cpp b/Common_Class/EdgeInspect/EdgeInspect.cpp
new file mode 100644
index 0000000..b8f34d0
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeInspect.cpp
@@ -0,0 +1,10 @@
+// EdgeInspect.cpp : 秦寸 DLL狼 檬扁拳 风凭阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
diff --git a/Common_Class/EdgeInspect/EdgeInspect.def b/Common_Class/EdgeInspect/EdgeInspect.def
new file mode 100644
index 0000000..e555c8c
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeInspect.def
@@ -0,0 +1,6 @@
+; EdgeInspect.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY      "EdgeInspect"
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
diff --git a/Common_Class/EdgeInspect/EdgeInspect.rc b/Common_Class/EdgeInspect/EdgeInspect.rc
new file mode 100644
index 0000000..52a40ec
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeInspect.rc
@@ -0,0 +1,125 @@
+// Microsoft Visual C++俊辑 积己茄 府家胶 胶农赋飘涝聪促.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE 2 府家胶俊辑 积己登菌嚼聪促.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+	"#ifndef APSTUDIO_INVOKED\r\n"
+    "#include ""targetver.h""\r\n"
+    "#endif\r\n"
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+	"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
+	"LANGUAGE 18, 1\r\n"
+	"#pragma code_page(949)\r\n"
+    "#include ""res\\EdgeInspect.rc2""  // Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶涝聪促.\r\n"
+#ifndef _AFXDLL
+    "#include ""l.KOR\\afxres.rc""  	// 钎霖 备己 夸家涝聪促.\r\n"
+#endif
+    "#endif\r\n"
+    "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE 18, 1
+#pragma code_page(949)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 滚傈
+//
+
+VS_VERSION_INFO     VERSIONINFO
+  FILEVERSION       1,0,0,1
+  PRODUCTVERSION    1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+	BLOCK "StringFileInfo"
+	BEGIN
+        BLOCK "041203b5"
+		BEGIN
+            VALUE "CompanyName", "TODO: <雀荤 捞抚>"
+            VALUE "FileDescription", "TODO: <颇老 汲疙>"
+			VALUE "FileVersion",     "1.0.0.1"
+			VALUE "InternalName",    "EdgeInspect.dll"
+            VALUE "LegalCopyright", "TODO: (c) <雀荤 捞抚>.  All rights reserved."
+			VALUE "OriginalFilename","EdgeInspect.dll"
+            VALUE "ProductName", "TODO: <力前 捞抚>"
+			VALUE "ProductVersion",  "1.0.0.1"
+		END
+	END
+	BLOCK "VarFileInfo"
+	BEGIN
+		VALUE "Translation", 0x0412, 949
+    END
+END
+
+#endif
+#ifndef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE 3 府家胶俊辑 积己登菌嚼聪促.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE 18, 1
+#pragma code_page(949)
+#include "res\\EdgeInspect.rc2"  // Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶涝聪促.
+#ifndef _AFXDLL
+#include "l.KOR\\afxres.rc"  	// 钎霖 备己 夸家涝聪促.
+#endif
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED啊 酒凑聪促.
+
diff --git a/Common_Class/EdgeInspect/EdgeInspect.vcproj b/Common_Class/EdgeInspect/EdgeInspect.vcproj
new file mode 100644
index 0000000..90cb323
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeInspect.vcproj
@@ -0,0 +1,584 @@
+<?xml version="1.0" encoding="ks_c_5601-1987"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="EdgeInspect"
+	ProjectGUID="{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}"
+	RootNamespace="EdgeInspect"
+	Keyword="MFCDLLProj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="false"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_AFXEXT"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				ModuleDefinitionFile=".\EdgeInspect.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="false"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="./Header;../MosisAssem/Header;../MosisBuffer/Header"
+				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_AFXEXT"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile="..\Library\Debug\EdgeInspect.pch"
+				ProgramDataBaseFileName="..\Library\Debug\EdgeInspect.pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="MosisBuffer.lib"
+				OutputFile="..\..\角青颇老\Debug\$(ProjectName).dll"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="..\Library\Debug,.\Library"
+				ModuleDefinitionFile=".\EdgeInspect.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="..\Library\Debug\$(TargetName).pdb"
+				SubSystem="2"
+				ImportLibrary="..\Library\Debug\$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="false"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_AFXEXT"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				ModuleDefinitionFile=".\EdgeInspect.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="false"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="./Header;../MosisAssem/Header;../MosisBuffer/Header;./Include"
+				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_AFXEXT"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile="..\Library\Release\$(TargetName).pch"
+				ProgramDataBaseFileName="..\Library\Release\$(TargetName).pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="MosisBuffer.lib"
+				OutputFile="..\..\角青颇老\Release\$(ProjectName).dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\Library\Release"
+				ModuleDefinitionFile=".\EdgeInspect.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="..\Library\Release\$(TargetName).pdb"
+				GenerateMapFile="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="..\Library\Release\$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="家胶 颇老"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\BLOB_Tool.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ChamferInspect.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\CornerCut.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\dllmain.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\Edge_Log.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\EdgeFind.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\EdgeInspect.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\EdgeInspect.def"
+				>
+			</File>
+			<File
+				RelativePath=".\EdgeProc.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\NotchCut.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\RANSAC_LineFittingAlgorithm.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\SplineInspect.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="庆歹 颇老"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\Header\BLOB_Tool.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\ChamferInspect.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\CornerCut.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\EDGE_DIPM.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\Edge_Log.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\EdgeFind.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\EdgeProc.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\NotchCut.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\RANSAC_LineFittingAlgorithm.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Resource.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\SplineInspect.h"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="府家胶 颇老"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+			<File
+				RelativePath=".\EdgeInspect.rc"
+				>
+			</File>
+			<File
+				RelativePath=".\res\EdgeInspect.rc2"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/Common_Class/EdgeInspect/EdgeInspect.vcxproj b/Common_Class/EdgeInspect/EdgeInspect.vcxproj
new file mode 100644
index 0000000..68d5fc1
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeInspect.vcxproj
@@ -0,0 +1,315 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}</ProjectGuid>
+    <RootNamespace>EdgeInspect</RootNamespace>
+    <Keyword>MFCDLLProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\EdgeInspect.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>./;./Header;../../Global_Include;../SISBuffer/Header;../OpenCV/opencv_3.1/include;../OpenCV/opencv_3.1/include/opencv;../OpenCV/opencv_3.1/include/opencv2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>..\Library\Debug\EdgeInspect.pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>..\Library\Debug\EdgeInspect.pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName)D$(TargetExt)</OutputFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);../OpenCV/opencv_3.1/lib;./Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ModuleDefinitionFile>.\EdgeInspectD.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>..\Library\Debug\$(TargetName).pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <ImportLibrary>$(OutDir)$(TargetName)D.lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\EdgeInspect.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>./;./Header;../../Global_Include;../SISBuffer/Header;../OpenCV/opencv_3.1/include;../OpenCV/opencv_3.1/include/opencv;../OpenCV/opencv_3.1/include/opencv2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>..\Library\Release\$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>..\Library\Release\$(TargetName).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);../OpenCV/opencv_3.1/lib;./Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ModuleDefinitionFile>.\EdgeInspect.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>..\Library\Release\$(TargetName).pdb</ProgramDatabaseFile>
+      <GenerateMapFile>true</GenerateMapFile>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\EdgeInspect\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\EdgeInspect\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\EdgeInspect\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\BLOB_Tool.h" "$(SolutionDir)Lib\EdgeInspect\include\BLOB_Tool.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\EDGE_DIPM.h" "$(SolutionDir)Lib\EdgeInspect\include\EDGE_DIPM.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\ChamferInspect.h" "$(SolutionDir)Lib\EdgeInspect\include\ChamferInspect.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\CornerCut.h" "$(SolutionDir)Lib\EdgeInspect\include\CornerCut.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\EdgeFind.h" "$(SolutionDir)Lib\EdgeInspect\include\EdgeFind.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\EdgeProc.h" "$(SolutionDir)Lib\EdgeInspect\include\EdgeProc.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\NotchCut.h" "$(SolutionDir)Lib\EdgeInspect\include\NotchCut.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\ProfileCADProc.h" "$(SolutionDir)Lib\EdgeInspect\include\ProfileCADProc.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\RANSAC_LineFittingAlgorithm.h" "$(SolutionDir)Lib\EdgeInspect\include\RANSAC_LineFittingAlgorithm.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\SISEdgeFind.h" "$(SolutionDir)Lib\EdgeInspect\include\SISEdgeFind.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\SplineInspect.h" "$(SolutionDir)Lib\EdgeInspect\include\SplineInspect.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="BLOB_Tool.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="ChamferInspect.cpp" />
+    <ClCompile Include="CornerCut.cpp" />
+    <ClCompile Include="dllmain.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
+    </ClCompile>
+    <ClCompile Include="Edge_Log.cpp" />
+    <ClCompile Include="EdgeFind.cpp" />
+    <ClCompile Include="EdgeInspect.cpp" />
+    <ClCompile Include="EdgeProc.cpp" />
+    <ClCompile Include="NotchCut.cpp" />
+    <ClCompile Include="ProfileCADProc.cpp" />
+    <ClCompile Include="RANSAC_LineFittingAlgorithm.cpp" />
+    <ClCompile Include="SISEdgeFind.cpp" />
+    <ClCompile Include="SplineInspect.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="..\..\..\..\2019\05. RCut(BF)\氚涭潃韺岇澕\R-CUT_順勳灔氚涭潃韺岇澕\Code\B5RCut\RCutInspection\res\ribbon.mfcribbon-ms" />
+    <None Include="EdgeInspect.def" />
+    <None Include="EdgeInspectD.def" />
+    <None Include="res\EdgeInspect.rc2" />
+    <None Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\BLOB_Tool.h" />
+    <ClInclude Include="Header\ChamferInspect.h" />
+    <ClInclude Include="Header\CornerCut.h" />
+    <ClInclude Include="Header\EDGE_DIPM.h" />
+    <ClInclude Include="Header\Edge_Log.h" />
+    <ClInclude Include="Header\EdgeFind.h" />
+    <ClInclude Include="Header\EdgeProc.h" />
+    <ClInclude Include="Header\NotchCut.h" />
+    <ClInclude Include="Header\ProfileCADProc.h" />
+    <ClInclude Include="Header\RANSAC_LineFittingAlgorithm.h" />
+    <ClInclude Include="Header\SISEdgeFind.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="Header\SplineInspect.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="EdgeInspect.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/EdgeInspect.vcxproj.filters b/Common_Class/EdgeInspect/EdgeInspect.vcxproj.filters
new file mode 100644
index 0000000..12c0c42
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeInspect.vcxproj.filters
@@ -0,0 +1,126 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="BLOB_Tool.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ChamferInspect.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="CornerCut.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="dllmain.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="Edge_Log.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="EdgeFind.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="EdgeInspect.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="EdgeProc.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="NotchCut.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="RANSAC_LineFittingAlgorithm.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SplineInspect.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ProfileCADProc.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISEdgeFind.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="EdgeInspect.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\EdgeInspect.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="ReadMe.txt" />
+    <None Include="EdgeInspectD.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="..\..\..\..\2019\05. RCut(BF)\氚涭潃韺岇澕\R-CUT_順勳灔氚涭潃韺岇澕\Code\B5RCut\RCutInspection\res\ribbon.mfcribbon-ms" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\BLOB_Tool.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ChamferInspect.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\CornerCut.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\EDGE_DIPM.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\Edge_Log.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\EdgeFind.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\EdgeProc.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\NotchCut.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\RANSAC_LineFittingAlgorithm.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SplineInspect.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ProfileCADProc.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISEdgeFind.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="EdgeInspect.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/EdgeInspectD.def b/Common_Class/EdgeInspect/EdgeInspectD.def
new file mode 100644
index 0000000..78b4f2e
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeInspectD.def
@@ -0,0 +1,6 @@
+; EdgeInspectD.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY      "EdgeInspectD"
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
diff --git a/Common_Class/EdgeInspect/EdgeProc.cpp b/Common_Class/EdgeInspect/EdgeProc.cpp
new file mode 100644
index 0000000..4581127
--- /dev/null
+++ b/Common_Class/EdgeInspect/EdgeProc.cpp
@@ -0,0 +1,1087 @@
+// EdgeProc.cpp: implementation of the CEdgeProc class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "EdgeProc.h"
+#include "SISBuffer.h"
+#include <math.h>
+#include "RANSAC_LineFittingAlgorithm.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+CEdgeProc::CEdgeProc()
+{
+	m_btBackground = 0;
+	m_btWhite = 255;	
+	m_subthick = 3;
+}
+
+CEdgeProc::~CEdgeProc()
+{
+
+}
+
+BOOL CEdgeProc::CannyEdgeProcessing(LPBYTE pImageBuf,CRect &rectIns,enGradientMask enMask,int nThres,CSISBuffer &ptgt)
+{
+	if (!pImageBuf || ptgt.IsValidBuffer() == FALSE) return false;	
+	
+	if (enMask == GM_Sobel)
+	{
+		m_nGX[0][0] = -1;	m_nGX[0][1] = 0;	m_nGX[0][2] =  1; 
+		m_nGX[1][0] = -2;	m_nGX[1][1] = 0;	m_nGX[1][2] =  2; 
+		m_nGX[2][0] = -1;	m_nGX[2][1] = 0;	m_nGX[2][2] =  1; 
+		
+		m_nGY[0][0] = 1;	m_nGY[0][1] = 2;	m_nGY[0][2] = 1; 
+		m_nGY[1][0] = 0;	m_nGY[1][1] = 0;	m_nGY[1][2] = 0;
+		m_nGY[2][0] = -1;	m_nGY[2][1] = -2;	m_nGY[2][2] = -1; 
+	}
+	else if (enMask == GM_Prewitt)
+	{
+		m_nGX[0][0] = -1;	m_nGX[0][1] = 0;	m_nGX[0][2] = 1; 
+		m_nGX[1][0] = -1;	m_nGX[1][1] = 0;	m_nGX[1][2] = 1; 
+		m_nGX[2][0] = -1;	m_nGX[2][1] = 0;	m_nGX[2][2] = 1;
+		
+		m_nGY[0][0] = 1;	m_nGY[0][1] = 1;	m_nGY[0][2] = 1; 
+		m_nGY[1][0] = 0;	m_nGY[1][1] = 0;	m_nGY[1][2] = 0; 
+		m_nGY[2][0] = -1;	m_nGY[2][1] = -1;	m_nGY[2][2] = -1; 
+	}
+	else if (enMask == GM_Roberts)
+	{
+		m_nGX[0][0] = -1;	m_nGX[0][1] = 0;	m_nGX[0][2] = 0; 
+		m_nGX[1][0] = 0;	m_nGX[1][1] = 1;	m_nGX[1][2] = 0; 
+		m_nGX[2][0] = 0;	m_nGX[2][1] = 0;	m_nGX[2][2] = 0; 
+		
+		m_nGY[0][0] = 0;	m_nGY[0][1] = 0;	m_nGY[0][2] = -1; 
+		m_nGY[1][0] = 0;	m_nGY[1][1] = 1;	m_nGY[1][2] = 0; 
+		m_nGY[2][0] = 0;	m_nGY[2][1] = 0;	m_nGY[2][2] = 0; 
+	}
+	else return false;
+	
+	CSize szImageBuf = CSize(rectIns.Width(),rectIns.Height());	
+	register int x, y, xp, yp, posy, posyp;
+	int nSumX, nSumY, nEdgeDirection, nLeftPixel, nRightPixel;
+	int p1, p2, p3, p4, p5, p6, p7, p8;
+
+	int *img_mag = new int[szImageBuf.cx * szImageBuf.cy];
+	int *img_dir = new int[szImageBuf.cx * szImageBuf.cy];
+	float ORIENT;
+
+	/**************************************************************
+	*	    	SOBEL GRADIENT APPROXIMATION
+	***************************************************************/
+	int nMin = 100000, nMax = -100000;
+	for (y = 1; y < szImageBuf.cy - 1; y++)
+	{
+		posy = y * szImageBuf.cx;
+		for (x = 1; x < szImageBuf.cx - 1; x++)
+		{
+			nSumX = 0;
+			nSumY = 0;
+
+			/* Convolution starts here */
+			/****************************
+			* X,Y gradient approximation
+			*****************************/
+			for (yp = -1; yp <= 1; yp++)
+			{
+				posyp = (y + yp) * szImageBuf.cx;
+				for (xp = -1; xp <= 1; xp++)
+				{
+					nSumX += (int)(pImageBuf[posyp + x + xp] * m_nGX[yp + 1][xp + 1]);
+					nSumY += (int)(pImageBuf[posyp + x + xp] * m_nGY[yp + 1][xp + 1]);
+				}
+			}
+
+			img_mag[posy + x] = (int)sqrtf((float)nSumX * nSumX + (float)nSumY * nSumY);
+			
+			if (img_mag[posy + x] < nMin)
+				nMin = img_mag[posy + x];
+			if (img_mag[posy + x] > nMax)
+				nMax = img_mag[posy + x];		
+
+			/****************************
+			* Magnitude orientation
+			****************************/
+			if (nSumX == 0)	// Cannot divide by zero
+			{
+			    if (nSumY == 0) ORIENT = 0.0;
+			    else if (nSumY < 0)
+				{
+				   nSumY = -nSumY;
+				   ORIENT = 90.0;
+				}
+			    else ORIENT = 90.0;
+			}
+			else if (nSumX < 0 && nSumY > 0) // Can`t take invtan of angle in 2nd Quad
+			{
+				nSumX = -nSumX;
+				ORIENT = 180 - (float)atan((float)nSumY / (float)nSumX) * (float)(180 / 3.1415926535);
+			}
+			else if (nSumX > 0 && nSumY < 0)	// Can`t take invtan of angle in 4th Quad
+			{
+				nSumY = -nSumY;
+				ORIENT = 180 - (float)atan((float)nSumY / (float)nSumX) * (float)(180 / 3.1415926535);
+			}
+			else	// else angle is in 1st or 3rd Quad
+				ORIENT = (float)atan((float)nSumY / (float)nSumX) * (float)(180 / 3.1415926535);
+			
+			/*******************************************************************
+			* Find edgeDirection by assigning ORIENT a value of either 0, 45, 90
+			* or 135 degrees, depeding on which value ORIENT is closest to 
+			********************************************************************/
+			if (ORIENT < 22.5)			img_dir[posy + x] = 0;
+			else if (ORIENT < 67.5)		img_dir[posy + x] = 45;
+			else if (ORIENT < 112.5)	img_dir[posy + x] = 90;
+			else if (ORIENT < 157.5)	img_dir[posy + x] = 135;
+			else						img_dir[posy + x] = 0;
+		}
+	}
+// 	
+// 	CStdioFile file;
+// 	file.Open("C:\\Data.txt", CFile::modeCreate | CFile::modeWrite);
+// 	for (y = 1; y < szImageBuf.cy - 1; y++)
+// 	{
+// 		CString str;
+// 		posy = y * szImageBuf.cx;
+// 		for (x = 1; x < szImageBuf.cx - 1; x++)
+// 		{
+// 			CString str2;
+// 			str2.Format("(%d,%d)=(%d,%d)", x, y, img_mag[posy + x], img_dir[posy + x]);
+// 			str += str2;
+// 		}
+// 		str += "\n";
+// 		file.WriteString(str);
+// 	}
+// 	file.Close();
+
+	int nMag, nMinMax = nMax - nMin;
+	if (nMinMax == 0) nMinMax = 1;
+	BYTE btResult = m_btBackground;
+	for (y = 1; y < szImageBuf.cy - 1; y++)
+	{
+		posy = y * szImageBuf.cx;
+		for (x = 1; x < szImageBuf.cx - 1; x++)
+		{
+			/************************************************
+			* Obtain value of 2 adjacent pixels in edge
+			* direction.
+			*************************************************/
+			nMag = img_mag[posy + x];
+			nEdgeDirection = img_dir[posy + x];
+			if (nEdgeDirection == 0)
+			{
+				nLeftPixel  = img_mag[y * szImageBuf.cx + x - 1];
+				nRightPixel = img_mag[y * szImageBuf.cx + x + 1];
+			}
+			else if (nEdgeDirection == 45) 
+			{
+				nLeftPixel  = img_mag[(y + 1) * szImageBuf.cx + x - 1];
+				nRightPixel = img_mag[(y - 1) * szImageBuf.cx + x + 1];
+			}
+			else if (nEdgeDirection == 90)
+			{
+				nLeftPixel  = img_mag[(y - 1) * szImageBuf.cx + x];
+				nRightPixel = img_mag[(y + 1) * szImageBuf.cx + x];
+			}
+			else
+			{
+				nLeftPixel  = img_mag[(y - 1) * szImageBuf.cx + x - 1];
+				nRightPixel = img_mag[(y + 1) * szImageBuf.cx + x + 1];
+			}
+
+            /*********************************************************
+			* Compare current magnitude to both adjacent pixel values. 
+			* And if it is less than either of the 2 adjacent values -
+			* suppress it and make a nonedge
+			**********************************************************/
+			if (nMag < nLeftPixel || nMag < nRightPixel) btResult = m_btBackground;
+			else
+			{
+				/***************
+				*  Hysteresis
+				***************/				
+				// determine vaues of neighboring pixels
+				p1 = img_mag[(y - 1) * szImageBuf.cx + x - 1];
+				p2 = img_mag[(y - 1) * szImageBuf.cx + x];
+				p3 = img_mag[(y - 1) * szImageBuf.cx + x + 1];
+				p4 = img_mag[y * szImageBuf.cx + x - 1];
+				p5 = img_mag[y * szImageBuf.cx + x + 1];
+				p6 = img_mag[(y + 1) * szImageBuf.cx + x - 1];
+				p7 = img_mag[(y + 1) * szImageBuf.cx + x];
+				p8 = img_mag[(y + 1) * szImageBuf.cx + x + 1];
+
+				// Check to see if neighboring pixel values are edges
+				if (p1 > nThres || p2 > nThres
+					|| p3 > nThres || p4 > nThres
+					|| p5 > nThres || p6 > nThres
+					|| p7 > nThres || p8 > nThres)
+					btResult = m_btWhite;
+				else
+					btResult = m_btBackground;
+			}
+
+			ptgt.SetPixel(x,y,btResult);
+			//pImageBuf[y*szImageBuf.cx+x] = btResult;
+		}
+	}		
+	
+	delete[] img_mag;
+	delete[] img_dir;
+
+	return TRUE;
+}
+
+float CEdgeProc::catmullRomSpline(float x, float v0,float v1, float v2,float v3) 
+{   
+#define M11  0.0    
+#define M12  1.0   
+#define M13  0.0   
+#define M14  0.0   
+#define M21 -0.5   
+#define M22  0.0   
+#define M23  0.5   
+#define M24  0.0   
+#define M31  1.0   
+#define M32 -2.5   
+#define M33  2.0   
+#define M34 -0.5   
+#define M41 -0.5   
+#define M42  1.5   
+#define M43 -1.5   
+#define M44  0.5 
+
+	double c1,c2,c3,c4;   
+
+	c1 = M12*v1;   
+	c2 = M21*v0 + M23*v2;   
+	c3 = M31*v0 + M32*v1 + M33*v2 + M34*v3;   
+	c4 = M41*v0 + M42*v1 + M43*v2 + M44*v3;   
+
+	return(float)(((c4*x + c3)*x +c2)*x + c1);   
+}  
+
+
+
+void CEdgeProc::ThresholdProcessing(LPBYTE pImg,CSize szImg,int nThres,int nDir)
+{
+
+	float fNewThresValue = float(nThres);	
+
+	// threshold and invert
+	int nIndex;	
+	int nFinThres = (int)(fNewThresValue);
+	for (int i=0; i<szImg.cy; i++)
+	{
+		for (int j=0; j<szImg.cx; j++)
+		{
+			nIndex = (i*szImg.cx)+j;		
+			if(nDir == 1)
+			{
+				if (pImg[nIndex] > nFinThres)
+				{
+					pImg[nIndex] = 255; 
+				}
+				else
+				{
+					pImg[nIndex] = 0;				
+				}
+			}
+			else
+			{
+				if (pImg[nIndex] < nFinThres)
+				{
+					pImg[nIndex] = 255; 
+				}
+				else
+				{
+					pImg[nIndex] = 0;				
+				}
+			}
+		}
+	}	
+}
+
+int CEdgeProc::MaximizeDiscriminantFunction(double * p)
+{
+	double mi_255 = 0;
+	int k;
+	for (k=0; k<256; k++) 
+		mi_255 += k*p[k];
+
+	int index = 0;
+	double max = 0;
+	double mi_k = 0;
+	double w_k = 0;
+	double value;
+	for (k=0; k<256; k++) 
+	{
+		mi_k += k*p[k];
+		w_k += p[k];
+		value = ((w_k == 0) || (w_k == 1))? -1 : ((mi_255*w_k - mi_k)*(mi_255*w_k - mi_k))/(w_k*(1-w_k));
+		if (value >= max) 
+		{
+			index = k;
+			max = value;
+		}
+	}
+
+	return index;
+}
+
+void CEdgeProc::imCalcHistogram(LPBYTE pOrg, int nWidth,int nHeight, unsigned long* histo, int cumulative,CRect rect)
+{
+	int i,j;
+
+	memset(histo, 0, 256 * sizeof(unsigned long));
+
+	for (i = rect.top; i < rect.bottom; i++)
+	{
+		for(j=rect.left;j<rect.right;j++)
+			histo[*(pOrg+i*nWidth+j)]++;
+	}
+
+	if (cumulative)
+	{
+		/* make cumulative histogram */
+		for (i = 1; i < 256; i++)
+			histo[i] += histo[i-1];
+	}
+}
+
+unsigned char CEdgeProc::OtsuoBinary(CSISBuffer &pOrg,CRect rect,int nOpt)
+{
+	unsigned long histo[256];
+	imCalcHistogram(pOrg.GetDataAddress(0,0), pOrg.GetDataWidth(),pOrg.GetHeight(), histo, nOpt,rect);
+
+	double totalPixels = pOrg.GetDataWidth()*pOrg.GetHeight();
+	double p[256];
+	for (int i=0; i<256; i++) 
+		p[i] = histo[i]/totalPixels;
+
+	return (unsigned char)MaximizeDiscriminantFunction(p);
+}
+
+float CEdgeProc::AdaptiveThreshold(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue)
+{
+	if (pImageData==NULL) return 0;
+
+	float fThresValue =(float) nThresValue;
+	float fNewThresValue = 0;
+
+	for (int i=0; i<1000; i++)
+	{
+		fNewThresValue = GetThresholdValue(pImageData, nWidth, nHeight, nStep, (int)fThresValue);
+
+		if (fNewThresValue==fThresValue) break;
+
+		fThresValue = fNewThresValue;
+	}
+
+	return fNewThresValue;
+}
+
+float CEdgeProc::GetThresholdValue(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue)
+{
+	if (pImageData==NULL) return 0;
+
+	ULONG fore = 0;
+	int fore_cnt = 0;
+	ULONG back = 0;
+	int back_cnt = 0;
+
+	int nIndex;
+	for (int i=0; i<nHeight; i++)
+	{
+		for (int j=0; j<nWidth; j++)
+		{
+			nIndex = (i*nStep)+j;
+
+			if (pImageData[nIndex]==0) continue;
+
+			if (pImageData[nIndex] > nThresValue)
+			{
+				fore += pImageData[nIndex];
+				fore_cnt++;
+			}
+			else
+			{
+				back += pImageData[nIndex];
+				back_cnt++;
+			}
+		}
+	}
+
+	float fore_avg = 0.0f;
+	if (fore_cnt!=0) fore_avg = float(fore) / float(fore_cnt);
+
+	float back_avg = 0.0f;
+	if (back_cnt!=0) back_avg = float(back) / float(back_cnt);
+
+	if (fore_cnt==0 || back_cnt==0) 
+	{
+		if (nThresValue>=128)
+			return float(nThresValue)/2.0f;
+		else
+			return float(nThresValue)*2.0f;
+	}
+
+	return (fore_avg+back_avg)/2.0f;
+}
+
+BOOL CEdgeProc::VSobelBoundary(LPBYTE lpInImg, LPBYTE lpOutImg, int nWidth, int nBufWidth, int nHeight,int nThres)
+{
+	if (!lpInImg || !lpOutImg)
+		return FALSE;
+
+	int MaskBox[3][3] = {{-1, 0, 1}, {-1, 0, 1}, {-1, 0, 1}};
+	int nHeightm1 = nHeight - 1;
+	int nWidthm1 = nWidth - 1;
+	int mr, mc, newValue, i, j, min, max;
+	int* pTmpImg;
+	float constVal1, constVal2;
+	pTmpImg = new int[nHeight * nBufWidth];	// 沥荐蔼阑 爱绰 捞固瘤 悼利 皋葛府 且寸
+	ZeroMemory(pTmpImg, nHeight * nBufWidth * sizeof(int));
+
+	for (i = 1; i < nHeightm1; i++)
+	{
+		for (j= 1; j < nWidthm1; j++)
+		{
+			newValue = 0;
+			for (mr = 0; mr < 3; mr++)
+			{
+				for (mc = 0; mc < 3; mc++)
+					newValue += (MaskBox[mr][mc] * lpInImg[(i + mr - 1) * nBufWidth + (j + mc - 1)]);
+			}
+
+			// 蔼阑 剧荐肺 函券
+			if (newValue < 0)
+				newValue = -newValue;
+			pTmpImg[i * nBufWidth + j] = newValue;
+		}
+	}
+
+	// 叼胶敲饭捞甫 困秦 0俊辑 255荤捞肺 蔼狼 裹困甫 概俏
+	// 捞甫 困秦 刚历 弥措, 弥家蔼阑 茫篮 饶 捞甫 捞侩窍咯 概俏茄促.
+	min = 0x0fffffff;
+	max = -(0x0fffffff);
+
+	for (i = 1; i < nHeightm1; i++)
+	{
+		for (j = 1; j < nWidthm1; j++)
+		{
+			newValue = pTmpImg[i * nBufWidth + j];
+			if (newValue < min)
+				min = newValue;
+			if (newValue > max)
+				max = newValue;
+		}
+	}
+
+	// 函券矫 惑荐蔼阑 固府 拌魂
+	constVal1 = (float)(255.0 / (max - min));
+	constVal2 = (float)(-255.0 * min / (max - min));
+
+	for (i = 1; i < nHeightm1; i++)
+	{
+		for (j = 1; j < nWidthm1; j++)
+		{
+			// [min, max] 荤捞狼 蔼阑 [0, 255] 蔼栏肺 函券
+			newValue = pTmpImg[i * nBufWidth + j];
+			newValue = (int)(constVal1 * newValue + constVal2);
+
+			lpOutImg[i * nBufWidth + j] = (BYTE)newValue;
+		}
+	}
+
+	// Find Max Sum
+	for (i = 1; i < nWidthm1; i++)
+	{
+		for (j = 1; j < nHeightm1; j++)
+		{
+			if (lpOutImg[j * nBufWidth + i] > nThres)
+				lpOutImg[j * nBufWidth + i] = 255;
+			else
+				lpOutImg[j * nBufWidth + i] = 0;
+		}
+	}
+
+	delete [] pTmpImg;
+
+	return TRUE;
+}
+
+BOOL CEdgeProc::HSobelBoundary(LPBYTE lpInImg, LPBYTE lpOutImg, int nWidth, int nBufWidth, int nHeight,int nThres)
+{
+	if (!lpInImg || !lpOutImg)
+		return FALSE;
+
+	int MaskBox[3][3] = {{-1, -1, -1}, {0, 0, 0}, {1, 1, 1}};
+	int nHeightm1 = nHeight - 1;
+	int nWidthm1 = nWidth - 1;
+	int mr, mc, newValue, i, j, min, max;
+	int* pTmpImg;
+	float constVal1, constVal2;
+	pTmpImg = new int[nHeight * nBufWidth];	// 沥荐蔼阑 爱绰 捞固瘤 悼利 皋葛府 且寸
+	ZeroMemory(pTmpImg, nHeight * nBufWidth * sizeof(int));
+
+	for (i = 1; i < nHeightm1; i++)
+	{
+		for (j= 1; j < nWidthm1; j++)
+		{
+			newValue = 0;
+			for (mr = 0; mr < 3; mr++)
+			{
+				for (mc = 0; mc < 3; mc++)
+					newValue += (MaskBox[mr][mc] * lpInImg[(i + mr - 1) * nBufWidth + (j + mc - 1)]);
+			}
+
+			// 蔼阑 剧荐肺 函券
+			if (newValue < 0)
+				newValue = -newValue;
+			pTmpImg[i * nBufWidth + j] = newValue;
+		}
+	}
+
+	// 叼胶敲饭捞甫 困秦 0俊辑 255荤捞肺 蔼狼 裹困甫 概俏
+	// 捞甫 困秦 刚历 弥措, 弥家蔼阑 茫篮 饶 捞甫 捞侩窍咯 概俏茄促.
+	min = 0x0fffffff;
+	max = -(0x0fffffff);
+
+	for (i = 1; i < nHeightm1; i++)
+	{
+		for (j = 1; j < nWidthm1; j++)
+		{
+			newValue = pTmpImg[i * nBufWidth + j];
+			if (newValue < min)
+				min = newValue;
+			if (newValue > max)
+				max = newValue;
+		}
+	}
+
+	// 函券矫 惑荐蔼阑 固府 拌魂
+	constVal1 = (float)(255.0 / (max - min));
+	constVal2 = (float)(-255.0 * min / (max - min));
+
+	for (i = 1; i < nHeightm1; i++)
+	{
+		for (j = 1; j < nWidthm1; j++)
+		{
+			// [min, max] 荤捞狼 蔼阑 [0, 255] 蔼栏肺 函券
+			newValue = pTmpImg[i * nBufWidth + j];
+			newValue = (int)(constVal1 * newValue + constVal2);
+
+			lpOutImg[i * nBufWidth + j] = (BYTE)newValue;
+		}
+	}
+
+	// Find Max Sum
+	for (i = 1; i < nWidthm1; i++)
+	{
+		for (j = 1; j < nHeightm1; j++)
+		{
+			if (lpOutImg[j * nBufWidth + i] > nThres)
+				lpOutImg[j * nBufWidth + i] = 255;
+			else
+				lpOutImg[j * nBufWidth + i] = 0;
+		}
+	}
+
+	delete [] pTmpImg;
+
+	return TRUE;
+}
+
+void CEdgeProc::MakeIntegralImage(BYTE *image,int width,int height,int datawidth,int *intImage)
+{
+	int		x,y,offset,linesum;
+
+	intImage[0] = image[0];
+
+	for(x=1;x<width;++x)
+	{
+		intImage[x] = intImage[x-1] + image[x];
+	}
+
+	image += datawidth;
+	for(y=1,offset=y*datawidth;y<height;++y,offset+=datawidth)
+	{
+		linesum = 0;
+		for(x=0;x<width;++x)
+		{
+			linesum += image[x];
+			intImage[offset+x] = intImage[offset-datawidth+x] + linesum;
+		}
+		image += datawidth;
+	}
+}
+
+void CEdgeProc::ThresholdByIntegralImage(BYTE *image,int width,int height,int datawidth,int wsz,BYTE *matrix)
+{
+	std::vector<int> intImage(width*height);
+	MakeIntegralImage(image,width,height,datawidth,&intImage[0]);
+
+	const int winArea = wsz*wsz; 
+	/*const int wsz = 10;*/
+
+	int		x,y,offset,top,bottom,left,right;
+	int		sum1,sum2,sum3,graySum;
+
+	for(y=0,offset=0;y<height;y++,offset+=datawidth)
+	{
+		top = y-(wsz>>1);
+		if(top < 0) top = 0;
+		else if(top > height-wsz) top = height-wsz;
+
+		bottom = top + wsz - 1;
+		// y-range = [top,bottom];
+		for(x=0;x<width;x++)
+		{
+			left = x-(wsz>>1);
+			if(left < 0) left=0;
+			else if(left > width-wsz) left = width-wsz;
+			right = left+wsz-1;
+			// xrange = [left,right];
+
+			sum1 = (left>0 && top>0)?intImage[(top-1)*width+left-1]:0;
+			sum2 = (left>0)?intImage[bottom*width+left-1]:0;
+			sum3 = (top>0)?intImage[(top-1)*width+right]:0;
+
+			graySum = intImage[bottom*width+right] - sum3-sum2+sum1;
+
+			// Threshold T = (window_mean-3);
+			if((image[offset+x]+3)*winArea<=graySum)
+			{
+				matrix[offset+x] = 0xFF;
+			}
+			else
+			{
+				matrix[offset+x] = 0x00;
+			}
+		}
+	}
+}
+
+void CEdgeProc::Adaptive_Binarization(BYTE *gray,int width,int height,int datawidth,int w,double k,BYTE *bimage,CRect rect)
+{
+	int		whalf=w>>1;
+	int		diff,sqdiff;
+
+	int	*intimage = new int[width*height];
+	int	*intsqimg = new int[width*height];
+	ZeroMemory(intimage,width*height);
+	ZeroMemory(intsqimg,width*height);
+
+	int		i,j,x,y,a;
+	int		linesum=0,linesqsum=0;
+
+	intimage[0]=gray[0];
+	for(x=1;x<width;++x)
+	{
+		a=gray[x];
+		intimage[x] = intimage[x-1] + a;
+		intsqimg[x] = intimage[x-1] + a*a;
+	}
+
+	for(y=1;y<height;++y)
+	{
+		linesum = linesqsum = 0;
+		for(x=0;x<width;++x)
+		{
+			a= gray[y*datawidth+x];
+			linesum += a;
+			linesqsum += a*a;
+			intimage[y*width+x]=intimage[(y-1)*width+x]+linesum;
+			intsqimg[y*width+x]=intsqimg[(y-1)*width+x]+linesqsum;
+		}
+	}
+
+	int			xmin,ymin,xmax,ymax,area;
+	double		mean,std,threshold;
+	int			diagsum,idiagsum,sqdiagsum,sqidiagsum;
+
+	for(j=rect.top;j<rect.bottom;j++)
+	{
+		for(i=rect.left;i<rect.right;i++)
+		{
+			xmin = MAXIMUM(0,i-whalf);
+			ymin = MAXIMUM(0,j-whalf);
+			xmax = MINIMUM(width-1,i+whalf);
+			ymax = MINIMUM(height-1,j+whalf);
+			area = (xmax-xmin+1)*(ymax-ymin+1);
+
+			if(!xmin && !ymin)		// origin
+			{
+				diff =	intimage[ymax*width+xmax];
+				sqdiff = intsqimg[ymax*width+xmax];
+			}
+			else if(!xmin && ymin)		// first column
+			{	
+				diff = intimage[ymax*width+xmax] - intimage[(ymin-1)*width+xmax];
+				sqdiff = intsqimg[ymax*width+xmax] - intsqimg[(ymin-1)*width+xmax];
+			}
+			else if(xmin && !ymin)		// first row
+			{
+				diff = intimage[ymax*width+xmax] - intimage[ymax*width+(xmin-1)];
+				sqdiff = intsqimg[ymax*width+xmax] - intsqimg[ymax*width+(xmin-1)];
+			}
+			else
+			{
+				diagsum = intimage[ymax*width+xmax] + intimage[(ymin-1)*width+(xmin-1)];
+				idiagsum = intimage[(ymin-1)*width+xmax] + intimage[ymax*width+(xmin-1)];
+
+				diff = diagsum - idiagsum;
+
+				sqdiagsum = intsqimg[ymax*width+xmax] + intsqimg[(ymin-1)*width+(xmin-1)];
+				sqidiagsum = intsqimg[(ymin-1)*width+xmax] + intsqimg[ymax*width+(xmin-1)];
+
+				sqdiff = sqdiagsum - sqidiagsum;
+			}
+
+			// threshold = window_mean *(1 + factor * (std_dev/128.-1));
+			// 128 = max_allowed_std_deviation in the gray image;
+			mean = double(diff)/double(area);
+			std = sqrt((sqdiff-double(diff)*diff/double(area))/double(area-1));
+			threshold = mean*(1.0+k*((std/128.0)-1.));
+			if(gray[j*datawidth+i] > threshold)
+				bimage[j*datawidth+i] = 0;
+			else
+				bimage[j*datawidth+i] = 255;
+		}
+	}
+
+	delete[] intimage,intimage=NULL;
+	delete[] intsqimg,intsqimg=NULL;
+}
+
+void CEdgeProc::LocalHistogramEqualization(BYTE *image,int width,int height,int wsize,BYTE *out)
+{
+	int		hwsize=wsize >> 1;
+	wsize = (hwsize<<1)+1;
+	int topstop = height-wsize;
+	int leftstop=width-wsize;
+
+	for(int y=0,offset=0;y<height;y++,offset+=width)
+	{
+		int top = y-hwsize;
+		top = top<0?0:top>topstop?topstop:top;
+
+		BYTE	*imgrow = &image[offset];
+		BYTE *outrow=&out[offset];
+
+		for(int x=0;x<width;x++)
+		{
+			int left = x-hwsize;
+			left = left<0?0:left>leftstop?leftstop:left;
+
+			int histo[256];
+			memset(histo,0,sizeof(histo));
+			for(int yy=0,woffset=top*width+left;yy<wsize;yy++,woffset+=width)
+			{
+				BYTE *winrow=&image[woffset];
+				for(int xx=0;xx<wsize;xx++)
+				{
+					histo[winrow[xx]]++;
+				}
+			}
+
+			int level = imgrow[x];
+			int csum = 0;
+			if(level<128)
+			{
+				for(int k=0;k<=level;k++)
+					csum += histo[k];
+			}
+			else
+			{
+				csum = wsize*wsize;
+				for(int k=level+1;k<256;k++)
+					csum -= histo[k];
+			}
+
+			int a=int((255.*csum)/(wsize*wsize));
+			outrow[x] = (a&~255) == 0?a:a<0?0:255;
+		}
+	}
+}
+
+// transpose a point
+BOOL CEdgeProc::MovePoint(CPoint iPos, CPoint *oPos, CPoint B_P) 
+{
+	oPos->x = iPos.x + B_P.x;
+	oPos->y = iPos.y + B_P.y;
+	return TRUE;
+}
+
+// rotate a point based by (0,0)
+BOOL CEdgeProc::RotatePoint(CPoint iPos, CPoint *oPos, double sinRad, double cosRad) 
+{
+	// rotate transform(Rad)
+	oPos->x = (int)((double)iPos.x*cosRad + (double)iPos.y*(-sinRad));
+	oPos->y = (int)((double)iPos.x*sinRad + (double)iPos.y*cosRad);
+
+	return TRUE;
+}
+
+BOOL CEdgeProc::RotatePoint(CvPoint2D32f iPos, double &dXPos,double &dYPos, double sinRad, double cosRad)
+{
+	// rotate transform(Rad)
+
+	dXPos = ((double)iPos.x*cosRad + (double)iPos.y*(-sinRad));
+	dYPos = ((double)iPos.x*sinRad + (double)iPos.y*cosRad);
+
+	return TRUE;
+}
+
+BOOL CEdgeProc::RotatePoint(CPoint iPos, double &dXPos,double &dYPos, double sinRad, double cosRad) 
+{
+	// rotate transform(Rad)
+	dXPos = ((double)iPos.x*cosRad + (double)iPos.y*(-sinRad));
+	dYPos = ((double)iPos.x*sinRad + (double)iPos.y*cosRad);
+
+	return TRUE;
+}
+
+//rotate a point based by Base Point
+BOOL CEdgeProc::RotatePoint(CPoint iPos, CPoint *oPos, CPoint B_P, double sinRad, double cosRad) 
+{
+	CPoint		 MovePos1, MovePos2;
+	CPoint		 RotatePos;
+	CPoint		 inverseB_P;
+
+	inverseB_P.x = -B_P.x;
+	inverseB_P.y = -B_P.y;
+
+	MovePoint(iPos, &MovePos1, inverseB_P);
+	if(!RotatePoint(MovePos1 , &RotatePos, sinRad, cosRad)) return FALSE;
+	MovePoint(RotatePos, &MovePos2, B_P);
+
+	oPos->x = MovePos2.x;
+	oPos->y = MovePos2.y;
+
+	return TRUE;
+}
+
+BOOL CEdgeProc::RotatePoint(CvPoint2D32f  iPos, double &dXPos,double &dYPos, CvPoint2D32f  B_P, double sinRad, double cosRad)
+{
+	CvPoint2D32f		 MovePos1;	
+	CvPoint2D32f		 inverseB_P;
+	double				rotateX,rotateY;
+
+	inverseB_P.x = -B_P.x;
+	inverseB_P.y = -B_P.y;
+
+	MovePos1.x = iPos.x + inverseB_P.x;
+	MovePos1.y = iPos.y + inverseB_P.y;	
+	if(!RotatePoint(MovePos1 , rotateX,rotateY, sinRad, cosRad)) return FALSE;
+	dXPos = rotateX+B_P.x;
+	dYPos = rotateY+B_P.y;	
+
+	return TRUE;
+}
+
+BOOL CEdgeProc::RotatePoint(CPoint iPos, double &dXPos,double &dYPos, CPoint B_P, double sinRad, double cosRad) 
+{
+	CPoint		 MovePos1;	
+	CPoint		 inverseB_P;
+	double		 rotateX,rotateY;
+
+	inverseB_P.x = -B_P.x;
+	inverseB_P.y = -B_P.y;
+
+	MovePos1.x = iPos.x + inverseB_P.x;
+	MovePos1.y = iPos.y + inverseB_P.y;	
+	if(!RotatePoint(MovePos1 , rotateX,rotateY, sinRad, cosRad)) return FALSE;
+	dXPos = rotateX+B_P.x;
+	dYPos = rotateY+B_P.y;	
+
+	return TRUE;
+}
+
+double CEdgeProc::GetTheta(sPoint *pLinedata,int nLineCnt,int nRange)
+{
+	if(pLinedata == NULL || nLineCnt <= 0)
+		return 0.;
+
+	CLineFitting		lineFit;
+	double				dTheta = 0.;
+	double				dCost,dSlope;
+	sPoint				first,second;
+	sLine				line;	
+
+	dCost = lineFit.ransac_line_fitting(pLinedata, nLineCnt, line, nRange);	
+
+	first.x = pLinedata[0].x+((double)nLineCnt*line.mx);
+	first.y = pLinedata[0].y+((double)nLineCnt*line.my);	
+	second.x = pLinedata[0].x-((double)nLineCnt*line.mx);
+	second.y = pLinedata[0].y-((double)nLineCnt*line.my);				
+
+	dSlope = (second.y-first.y)/(second.x-first.x);	
+	dTheta = 90+M_DEGREE(atan(dSlope));		
+
+	return dTheta;
+}
+
+BOOL CEdgeProc::CvFindMark(CSISBuffer lpOrg,IplImage *IpMark,CRect rcIns,TEMP_RESULT &result, double  dRate)
+{
+	if(!IpMark)
+		return FALSE;
+
+	if(rcIns.Width() > lpOrg.GetWidth() || rcIns.top < 0 || rcIns.top > rcIns.bottom || rcIns.bottom < 0 || rcIns.bottom > lpOrg.GetHeight())
+		return FALSE;
+	if(rcIns.left >= rcIns.right || rcIns.left < 0 || rcIns.right >= lpOrg.GetWidth())
+		return FALSE;
+	
+	IplImage *scr = cvCreateImageHeader(cvSize(lpOrg.GetWidth(),lpOrg.GetHeight()),8,1);
+	cvSetData(scr,lpOrg.GetDataAddress(),lpOrg.GetWidth());	
+
+	int nDiv= 1;
+	CvRect roi = cvRect(rcIns.left,rcIns.top,rcIns.Width(),rcIns.Height());
+	CvRect roi2;
+
+	char cMaxPath[100] ={0,};
+	
+	nDiv = 2;
+
+	IplImage *sScr  = cvCreateImage(cvSize(roi.width/nDiv,roi.height/nDiv),8,1);
+	IplImage *sTemp = cvCreateImage(cvSize(IpMark->width/nDiv,IpMark->height/nDiv),8,1);
+	//cvSaveImage("D:\\test_img\\mark.bmp",scr);
+	cvSetImageROI(scr,roi);
+	cvResize(scr,sScr);
+	cvResize(IpMark,sTemp);
+	roi2 = cvGetImageROI(sScr);	
+	//cvSaveImage("D:\\2.bmp",sScr);
+
+	//sprintf(cMaxPath,"d:\\test_Img\\Mark_1%d.bmp",scr->imageData);
+	//cvSaveImage(cMaxPath,scr);	
+
+	TEMP_MATCH_DATA data1 = Cv_TempleateMath(roi2,sScr,sTemp);
+
+	cvResetImageROI(scr);
+	cvReleaseImage(&sScr);
+	cvReleaseImage(&sTemp);
+
+	if(data1.dMaxRate > dRate)
+	{		
+		roi.x		= roi.x  +  (int)data1.dPt_X * nDiv  - IpMark->width;
+		roi.y		= roi.y  +  (int)data1.dPt_Y * nDiv  - IpMark->height;
+
+		roi.width	= IpMark->width * 2;
+		roi.height	= IpMark->height *2;
+	}
+
+	TEMP_MATCH_DATA data = Cv_TempleateMath(roi,scr,IpMark);
+	
+	result.fRat  = (float)data.dMaxRate;
+	result.pt.x  = (float)data.dPt_X;
+	result.pt.y  = (float)data.dPt_Y;
+
+	cvReleaseImageHeader(&scr);
+	return TRUE;
+}
+
+TEMP_MATCH_DATA CEdgeProc::Cv_TempleateMath(CvRect roi,IplImage* IpSrc,IplImage* IpTem)
+{
+	TEMP_MATCH_DATA data;
+
+	cvSetImageROI(IpSrc,roi);
+
+	roi = cvRect(IpSrc->roi->xOffset, IpSrc->roi->yOffset, IpSrc->roi->width, IpSrc->roi->height);
+
+	IplImage *ftmp = cvCreateImage(cvSize(roi.width - IpTem->width+1, roi.height - IpTem->height+1 ),32,1);
+	int mathod;
+	//mathod = CV_TM_SQDIFF;      
+	//mathod = CV_TM_SQDIFF_NORMED;      
+	//mathod = CV_TM_CCORR      
+	//mathod = CV_TM_CCORR_NORMED;      
+	//mathod = CV_TM_CCOEFF      
+	mathod = CV_TM_CCOEFF_NORMED;
+
+	CvPoint ptMax;
+
+	cvMatchTemplate(IpSrc, IpTem, ftmp, mathod);
+	cvMinMaxLoc(ftmp,&data.dMinRate,&data.dMaxRate,NULL,&ptMax);
+
+	data.dPt_X = ptMax.x + roi.x + IpTem->width /2.0;
+	data.dPt_Y = ptMax.y + roi.y + IpTem->height/2.0;
+		
+	cvReleaseImage(&ftmp);
+	cvResetImageROI(IpSrc);
+	return data;
+}
+
+// rotate a point based by (0,0)
+BOOL CEdgeProc::IMRotatePoint(IMPOS2D iPos, IMPOS2D *oPos, double sinRad, double cosRad)
+{
+	// rotate transform(Rad)
+	oPos->u = (LONG)ROUND(iPos.u*cosRad + iPos.v*(-sinRad));
+	oPos->v = (LONG)ROUND(iPos.u*sinRad + iPos.v*cosRad);
+
+	return TRUE;
+}
+
+BOOL CEdgeProc::IMMovePoint(IMPOS2D iPos, IMPOS2D *oPos, IMPOS2D B_P)
+{
+	oPos->u = iPos.u + B_P.u;
+	oPos->v = iPos.v + B_P.v;
+	return TRUE;
+}
+
+//rotate a point based by Base Point
+BOOL CEdgeProc::IMRotatePoint(IMPOS2D iPos, IMPOS2D *oPos, IMPOS2D B_P, double sinRad, double cosRad)
+{
+	IMPOS2D		 MovePos1, MovePos2;
+	IMPOS2D		 RotatePos;
+	IMPOS2D		 inverseB_P;
+
+	inverseB_P.u = -B_P.u;
+	inverseB_P.v = -B_P.v;
+
+	IMMovePoint(iPos, &MovePos1, inverseB_P);
+	if (!IMRotatePoint(MovePos1, &RotatePos, sinRad, cosRad)) return FALSE;
+	IMMovePoint(RotatePos, &MovePos2, B_P);
+
+	oPos->u = MovePos2.u;
+	oPos->v = MovePos2.v;
+
+	return TRUE;
+}
+
+BOOL CEdgeProc::IMGetRotImg(ROI aoi, CSISBuffer Org, CSISBuffer Tgt, IMPOS2D pCen, double sinRad, double cosRad)
+{
+	unsigned char	brightness;
+	IMPOS2D		pIn, pOut;
+	int		u, v, ou, ov;
+	int		scu = Org.GetWidth();
+	int		ocu = Tgt.GetWidth();
+
+	for (ov = 0, v = aoi.v1; v <= aoi.v2; v++, ov++) {
+		for (ou = 0, u = aoi.u1; u < aoi.u2; u++, ou++) {
+			pIn.u = u;
+			pIn.v = v;
+			IMRotatePoint(pIn, &pOut, pCen, sinRad, cosRad); // rotate 1 point
+
+			//source assert
+			if (!RANGEIN(pOut.u, 0, Org.GetWidth())) return FALSE;
+			if (!RANGEIN(pOut.v, 0, Org.GetHeight())) return FALSE;
+
+			brightness = (unsigned char)Org.GetPixel((int)pOut.u, (int)pOut.v);
+
+			//target assert
+			if (!RANGEIN(ou, 0, Tgt.GetWidth())) return FALSE;
+			if (!RANGEIN(ov, 0, Tgt.GetHeight())) return FALSE;
+
+			Tgt.SetPixel(ou, ov, brightness);			
+		}
+	}
+
+	return TRUE;
+}
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/Edge_Log.cpp b/Common_Class/EdgeInspect/Edge_Log.cpp
new file mode 100644
index 0000000..eeb5499
--- /dev/null
+++ b/Common_Class/EdgeInspect/Edge_Log.cpp
@@ -0,0 +1,180 @@
+#include "StdAfx.h"
+#include "Edge_Log.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CEdge_Log
+
+CEdge_Log::CEdge_Log()
+{		
+	m_pFileLog = NULL;
+	m_strLogPath = _T("");
+	m_strLogFile = _T("");	
+
+	InitializeCriticalSection(&m_csLog);
+}
+
+CEdge_Log::~CEdge_Log()
+{
+	if (m_pFileLog)
+	{
+		delete m_pFileLog;
+		m_pFileLog = NULL;
+	}
+
+	DeleteCriticalSection(&m_csLog);
+}
+
+void CEdge_Log::SetPath(CString& strPath, CString& strName, BOOL bDelete, int nRemainCount)
+{
+	strPath.Replace(_T("/"), _T("\\"));
+	CString str = _T("");
+	str = strPath.Right(1);
+	if (str == _T("\\"))
+		m_strLogPath = strPath;
+	else
+		m_strLogPath = strPath + _T("\\");
+	
+	m_strLogPath += strName;
+
+	MakeLogFile();
+}
+
+BOOL CEdge_Log::MakeLogFile()
+{
+	// Log 贸府
+	if (m_strLogPath.IsEmpty())
+		return FALSE;
+
+	m_TimeLogFile = CTime::GetCurrentTime();
+	m_strLogFile.Format(_T("%s_%02d_%02d.log"), m_strLogPath, m_TimeLogFile.GetMonth(), m_TimeLogFile.GetDay());
+
+	if (m_pFileLog)
+		delete m_pFileLog;
+
+	m_pFileLog = new CFile();	
+
+	return TRUE;
+}
+
+BOOL CEdge_Log::WriteToFile(CTime& time, CString& strContents)
+{
+	// 朝楼啊 官差搁 颇老疙阑 盎脚秦辑 敬促.
+	if ((time.GetMonth() != m_TimeLogFile.GetMonth()) || (time.GetDay() != m_TimeLogFile.GetDay()) || !m_pFileLog)
+		MakeLogFile();
+
+	if (!m_pFileLog->Open(m_strLogFile, CFile::modeWrite))
+	{
+		CFileFind filefind;
+		if(filefind.FindFile(m_strLogFile) == FALSE)
+		{
+			if (!m_pFileLog->Open(m_strLogFile, CFile::modeCreate | CFile::modeWrite))
+			{
+				delete m_pFileLog;
+				m_pFileLog = NULL;
+			}
+		}
+
+		filefind.Close();
+	}
+
+	if (m_pFileLog)
+	{
+		m_pFileLog->SeekToEnd();
+		m_pFileLog->Write(strContents, strContents.GetLength());
+		m_pFileLog->Write("\r\n", static_cast<UINT>(strlen("\r\n")));
+		m_pFileLog->Close();
+	}
+
+	return TRUE;
+}
+
+BOOL CEdge_Log::WriteToFile(CTime& time, char* strContents)
+{
+	// 朝楼啊 官差搁 颇老疙阑 盎脚秦辑 敬促.
+	if ((time.GetMonth() != m_TimeLogFile.GetMonth()) || (time.GetDay() != m_TimeLogFile.GetDay()) || !m_pFileLog)
+		MakeLogFile();
+
+	if (!m_pFileLog->Open(m_strLogFile, CFile::modeWrite))
+	{
+		CFileFind filefind;
+		if(filefind.FindFile(m_strLogFile) == FALSE)
+		{
+			if (!m_pFileLog->Open(m_strLogFile, CFile::modeCreate | CFile::modeWrite))
+			{
+				delete m_pFileLog;
+				m_pFileLog = NULL;
+			}
+		}
+
+		filefind.Close();
+	}
+
+	if (m_pFileLog)
+	{
+		m_pFileLog->SeekToEnd();
+		m_pFileLog->Write(strContents, static_cast<UINT>(strlen(strContents)));
+		m_pFileLog->Write("\r\n", static_cast<UINT>(strlen("\r\n")));
+		m_pFileLog->Close();
+	}
+
+	return TRUE;
+}
+
+void CEdge_Log::DisplayEdgeLog(CString str)
+{
+	try
+	{
+		EnterCriticalSection(&m_csLog);	
+
+		// 涝仿且 巩磊凯 父甸扁.
+		CTime	time = CTime::GetCurrentTime();
+		char strTemp[512] = {0, };
+		sprintf_s(strTemp, 512, "%02d-%02d-%02d :%s", time.GetHour(), time.GetMinute(), time.GetSecond(), str);
+
+		WriteToFile(time, strTemp);	
+
+		LeaveCriticalSection(&m_csLog);
+	}
+	catch (...)
+	{
+		LeaveCriticalSection(&m_csLog);
+		return;
+	}
+}
+
+void CEdge_Log::DisplayEdgeLog(char* str, ...)
+{	
+	va_list list;
+	char strText[256] = {0, };
+
+	char strContents[512] = {0,};
+	va_start(list, str);
+	vsprintf_s(strContents, str, list);
+	va_end(list);
+
+	
+	try
+	{
+		EnterCriticalSection(&m_csLog);	
+
+		// 涝仿且 巩磊凯 父甸扁.
+		CTime	time = CTime::GetCurrentTime();
+		char strTemp[512] = {0, };
+		sprintf_s(strTemp, 512, "%02d-%02d-%02d :%s", time.GetHour(), time.GetMinute(), time.GetSecond(), strContents);
+
+		WriteToFile(time, strTemp);	
+
+		LeaveCriticalSection(&m_csLog);
+	}
+	catch (...)
+	{
+		LeaveCriticalSection(&m_csLog);
+		return;
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/Header/BLOB_Tool.h b/Common_Class/EdgeInspect/Header/BLOB_Tool.h
new file mode 100644
index 0000000..c225689
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/BLOB_Tool.h
@@ -0,0 +1,82 @@
+#if !defined(__FV_BLOB_INCLUDED__)
+#define __FV_BLOB_INCLUDED__
+
+#include <map>
+#include <list>
+#include <vector>
+
+
+class CEdgeBlobData  
+{
+public:
+	CEdgeBlobData()
+	{
+		Reset();
+	}
+
+	CEdgeBlobData(int x, int y)
+	{
+		Reset();
+		fCenterX = (float)x;
+		fCenterY = (float)y;
+	}
+
+	CEdgeBlobData(int left, int top, int right, int bottom)
+	{
+		Reset();
+
+		nLeft	= left;
+		nTop	= top;
+		nRight	= right;
+		nBottom	= bottom;
+		fCenterX = float(left) + float(right-left) / 2.f;
+		fCenterY = float(top) + float(bottom-top) / 2.f;
+	}
+
+	void Reset()
+	{
+		fCenterX		= 0;
+		fCenterY		= 0;
+		nLeft			= 0;
+		nTop			= 0;
+		nRight			= 0;
+		nBottom			= 0;
+		fMassCenterX	= 0;
+		fMassCenterY	= 0;
+		nPixelCount		= 0;
+		fMatchScore		= 0;
+		bFiltering		= FALSE;
+	}
+
+	int Width()		{ return nRight - nLeft + 1; }
+	int Height()	{ return nBottom - nTop + 1; }
+
+	float	fCenterX;
+	float	fCenterY;
+	int		nLeft;
+	int		nTop;
+	int		nRight;
+	int		nBottom;
+	int		nPixelCount;
+	float	fMassCenterX;
+	float	fMassCenterY;
+	float	fMatchScore;
+	BOOL	bFiltering;
+};
+
+typedef std::list<CEdgeBlobData*>					ListEdgeBlobData;
+typedef std::list<CEdgeBlobData*>::iterator			ListEdgeBlobDataIt;
+
+class AFX_EXT_CLASS CBlobTool
+{
+	// Construction
+public:
+	CBlobTool();
+	~CBlobTool();
+
+public:
+	bool				BlobAnalysis(BYTE *pImageData, int nWidth, int nHeight, int nStep, ListEdgeBlobData &blobList, int nMergeRange);		
+
+};
+
+#endif
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/Header/ChamferInspect.h b/Common_Class/EdgeInspect/Header/ChamferInspect.h
new file mode 100644
index 0000000..a5cbb4f
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/ChamferInspect.h
@@ -0,0 +1,310 @@
+#if !defined(AFX_CHAMFERINSPECT_H_INCLUDED_)
+#define AFX_CHAMFERINSPECT_H_INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ChamferInspect.h : header file
+//
+#include <list>
+#include <vector>
+#include "EDGE_DIPM.h"
+
+#include <opencv.hpp>
+#include <highgui.hpp>
+#include <core.hpp>
+#include <imgproc.hpp>
+
+
+//Search data
+#ifndef _GLASSFINDDATA_
+#define _GLASSFINDDATA_
+typedef struct GlassFindData{
+	int				*pPos;	
+	int				nPosCnt;
+	short			nWidth;	
+
+	GlassFindData()
+	{
+		pPos = NULL;
+		Reset();
+	}
+	void Reset()
+	{
+		nWidth = 0;		
+		nPosCnt = 0;
+		if(pPos != NULL)
+			delete[] pPos, pPos = NULL;
+	}
+	GlassFindData& operator=(const GlassFindData &rh)
+	{	
+		Reset();
+		nPosCnt = rh.nPosCnt;
+		nWidth = rh.nWidth;	
+
+		if(nPosCnt > 0)
+		{
+			pPos = new int[nPosCnt];
+			CopyMemory(pPos,rh.pPos,sizeof(int)*nPosCnt);
+		}				
+		return *this;
+	}
+	void GetMinMaxPos(int &nMin,int &nMax)
+	{
+		nMin = INT_MAX;
+		nMax = 0;
+
+		if(pPos == NULL || nPosCnt <= 0)
+			return;
+
+		int			iLoop,nValue;
+		for(iLoop=0;iLoop<nPosCnt;iLoop++)
+		{
+			nValue = pPos[iLoop];
+			if(nMin > nValue) nMin = nValue;
+			if(nMax < nValue) nMax = nValue;
+		}
+	}
+} GLASSFINDDATA, *LGLASSFINDDATA;
+#endif
+
+#ifndef _EDGE_POS_
+#define _EDGE_POS_
+typedef struct EdgePos{
+	double	dLeft;
+	double	dRight;
+	int		nPos;
+
+	void	Reset()
+	{
+		dLeft = dRight = 0;
+		nPos = 0;
+	}
+} EDGEPOS, *LEDGEPOS;
+#endif
+
+typedef struct _STU_CHIPPINGINS_EXP_POS
+{
+	int			nSide;
+	int			nPosY;
+	int			nSize;	
+	int			nERType;//130115
+	int			nPosX;//130115
+	int			nSizeX;//130115
+
+	_STU_CHIPPINGINS_EXP_POS()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		nSide = 4;
+		nPosY = nSize = 0;
+		nERType = 2;//130115
+		nPosX = nSizeX = 0;//130115
+	}
+
+} STU_CHIPPINGINS_EXP_POS, *pSTU_CHIPPINGINS_EXP_POS;
+
+typedef struct _STU_EXTRA_POLY
+{
+	int			nSL,nST;
+	int			nEL,nEB;
+	int			nTheHeight;
+	double		dTheta;
+
+	_STU_EXTRA_POLY()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		nSL = nST = nEL = nEB = nTheHeight = 0;
+		dTheta = 0.;
+	}
+
+} STU_EXTRA_POLY, *pSTU_EXTRA_POLY;
+
+/////////////////////////////////////////////////////////////////////////////
+// CChamferInspect window
+
+enum ChipErrCode	{ERR_CHIP_SUCCESS = 0, ERR_CHIP_IMAGE_NULL_01,ERR_CHIP_IMAGE_NULL_02,ERR_CHIP_IMAGE_NULL_03,ERR_CHIP_PREPROCESS,
+					ERR_CHIP_FIND_FORELINE, ERR_CHIP_FIND_RIGHTLINE,ERR_CHIP_SUBPIXEL,ERR_CHIP_CHECK_CHIPRECT};
+
+enum ChipThresMode	{THRESMODE_FIXED=0,THRESMODE_ADAPTIVE,THRESMODE_ADAPTIVE_MAX};
+
+#define		MAX_CHIP_DEFECT_COUNT			1000
+#define		MAX_CHIP_PAIR_DEFECT_COUNT		20000
+
+typedef struct _InspectParam
+{
+	BOOL bUse_ChipIns;
+	BOOL bUse_CrackIns;
+	BOOL bUse_BrokenIns;
+	BOOL bUse_BurrIns;
+
+	int nChipThres;
+	int nChipThres_White;
+	int nChipDiffThres;
+	int nCrackThres;
+	int nBrokenThres;
+	int nBurrThres;
+
+	int nChipMinSize;
+	int nCrackMinSize;
+	int nBrokenMinSize;
+	int nBurrMinSize;
+
+	int nChipSideFilterSize;
+	int nCrackSideFilterSize;
+	int nBrokenSideFilterSize;
+	int nBurrSideFilterSize;
+
+	_InspectParam()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bUse_ChipIns = bUse_CrackIns = bUse_BrokenIns = bUse_BurrIns = FALSE;
+
+		nChipThres = 15;
+		nChipThres_White = 255;
+		nChipDiffThres = 30;
+		nCrackThres = 15;
+		nBrokenThres = 15;
+		nBurrThres = 15;
+
+		nChipMinSize = nCrackMinSize = nBrokenMinSize = nBurrMinSize = 5;
+
+		nChipSideFilterSize = nCrackSideFilterSize = nBrokenSideFilterSize = nBurrSideFilterSize = 10;
+	}
+
+} InspectParam, *pInspectParam;
+
+class AFX_EXT_CLASS CChamferInspect
+{
+// Construction
+public:
+	CChamferInspect();
+	virtual ~CChamferInspect();
+
+// Chamfer & Chip
+public:
+	ChipErrCode			Inspection(int *nResult,LPBYTE lpHeader,int nFrameWidth,CRect &rectChamfer,int nChamferThres,BOOL bChipIns,BOOL bChamfer,CRect &rectChip,CRect &rectCrack,CRect &rectBroken
+		,int nChipThres,int nChipIDiffThres,int nCrackThres,int nBrokenThres,int nBurrThres,BOOL bSaveDebug=FALSE,int *nPreForeLine=NULL,ChipThresMode emThresMode=THRESMODE_FIXED,int iFrame = 0);	
+
+	ChipErrCode			Inspection(int *nResult,LPBYTE lpHeader,int nFrameWidth,CRect &rectChamfer,int nChamferThres,BOOL bChipIns,BOOL bChamfer,CRect &rectChip,CRect &rectCrack,CRect &rectBroken, 
+		InspectParam insParam, BOOL bSaveDebug=FALSE,int *nPreForeLine=NULL,ChipThresMode emThresMode=THRESMODE_FIXED,int iFrame = 0);
+	
+	BOOL				ChipInspection(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,int nChipThres,int nBurrThres,int nEdgeLeft,int nEdgeRight);
+	BOOL				ChipInspection_Binarization(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,CRect &rectCrack,CRect &rectBroken,int nChipThres,int nChipDiffThres,int nCrackThres,int nBrokenThres
+						,int nBurrThres,int nEdgeLeft,int nEdgeRight,BOOL bSaveDebug,int iFrame);
+
+	BOOL				ChipInspection_Binarization_OpenCV(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,CRect &rectCrack,CRect &rectBroken,InspectParam insParam,int nEdgeLeft,int nEdgeRight,BOOL bSaveDebug,int iFrame);
+
+	void				BinalizeFind_Chip(CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectInsReg,CSISBuffer &pImgSave,BOOL bSaveImage,BOOL bPolar=TRUE);
+	double				FindBPosLine(CSISBuffer &bufferOrg,int nThres);
+	int					GetForeEdgeLine(int iPos){return m_nForeEdgeLine[iPos];}	
+	CChipBlob			*GetDefectResult(){return m_DefectBlob;}	
+	int					GetDefectCount(){return m_nDefectCnt;}
+	double				GetAvgThick(){return m_dAvgThick;}
+	double				GetAreaAVG(LPBYTE pImg,CRect &rectIns,CRect &rect);
+	double				GetConvRes(){return m_dConvResolution;}
+
+	ChipErrCode			InspectCorner_Extra(CSISBuffer &BufferIns,int nThres,int nTop,int nLeft,BOOL bReset=TRUE,int nMergeReange=4);
+	ChipErrCode			InspectCorner_ExtraPoly(CSISBuffer &BufferIns,int nThres,int nTop,int nLeft,STU_EXTRA_POLY &stuPoly,BOOL bReset=TRUE,int nMergeReange=4);
+
+	// Binarization..
+	BOOL				Binarization_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, int nThresholdLow, int nThresholdHigh);
+	BOOL				Binarization_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, int nThresholdLow, int nThresholdHigh, int nThresholdPitch, int nPitch, int iFram=0, BOOL bSave=FALSE);
+	BOOL				Blob_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, std::vector<CChipBlob>* vecBlobList, ChipResionType s_RegionType,DefectPosType s_DefectPos, int nMinSize, int nSideFilter, BOOL bROIOffset=TRUE);
+
+
+protected:
+	void				ReleaseBuffer();
+	void				ResetValue();
+	void				ReleaseChipBuffer();
+	BOOL				CopyBuffer(CSISBuffer &bufferOrg,COwnerBuffer &bufferTgt);
+	BOOL				PreProcessing(LPBYTE pImg,CRect &rectIns,COwnerBuffer &BufferCanny);	
+	BOOL				FindEdgeLine(LPBYTE pImg,CRect &rectIns);
+	int					FindForeCastLine(CSISBuffer &pBuffer,CRect &rectIns,int &nforecast_S,int &nforecast_E,BOOL bChamfer);
+	BOOL				Binarization(CSISBuffer &pOrg,COwnerBuffer &pBin,int nSetThres);
+	BOOL				FindAdptThres(CSISBuffer &pOrg,CSISBuffer &CannyImg,int &nSetThres,int nForecast_S,ChipThresMode emThresMode);
+	double				FindTraceLine(CSISBuffer &CannyImg,int nStart);
+	BOOL				FindRightLine(CSISBuffer &pBuffer,CRect &rtIns,double dLeftLine,double &dRightLine,int nThres);
+	BOOL				FindRightLine_Bin(CSISBuffer &pBuffer,int &nforecast_S,double &dRightLine);
+	double				GetSubPixelThick(CSISBuffer &pBuffer,int nForecast_S,double dForecast_E,int nThres,double &dLeftEdge,double &dRightEdge);	
+
+	void				VConvolutionConvC(CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,int nSetPitch,CRect &rectInsReg);
+	BOOL				VertCalPitchConv(CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectIns,CSize szConv,int nPitch,int nPitch2);
+	BOOL				FilteringEdgeBlob(std::vector<CChipBlob> &vecBlob,int nBaseLeft,int nBaseRight,int nDetMargin,int nImgBurrMargin);
+	BOOL				InsertEdgeBlobToDefect(std::vector<CChipBlob> &vecBlob);
+
+	void				VConvolutionConvC_Com(COwnerBuffer &pRes,CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,int nSetPitch,CRect &rectInsReg);
+	BOOL				VertCalPitchConv_Com(COwnerBuffer &pRes,CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectIns,CSize szConv,int nPitch,int nPitch2);
+
+// Corner Chip
+public:
+	BOOL				ChipInspection_Corner(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID,int iScan, int iThread,int iFrame,CSISBuffer &ChipBuffer,int nChipThres,int nChipInsWidth,int nEdgeRight, double dGradient, double dIntercept, int nDetMargin = 1, int nMargin = 2, int nMarginY = 2);
+	void				SetCutAreaExpPos(int nSide,int nPosY, int nSize, int nERType, int nPosX, int nSizeX);
+	void				GetCutAreaExpPos(CRect rectInsOrg,int nEdgeLeft, int nGlassStartLine,CRect &rectExpRegion, int nChipInsWidth, double dFindLeft);
+	ChipErrCode			Inspection_OnlyChip(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID, int iScan,int iFrame, int nIndex
+											,CRect &rectIns,CSISBuffer &ChipBuffer,int nChipInsWidth,int nChipThres, int nChipThres_L,BOOL bChipIns, int nDetMargin, double dLeftThres, CRect rectInsOrg
+											,int nGlassStartLine,int nGlassEndLine, int nFrameHeight,int nCPosXOffset, int nDPosXOffset, int nCPosYOffsetStart, int nCPosYOffsetEnd, int nDPosYOffsetStart
+											, int nDPosYOffsetEnd, int nChippingInsOffset, double dFindLeft, int nAirThres);
+protected:
+	void				VConvolutionConvC_Polygon(CSISBuffer &pSaveImg,BOOL bSaveImage,int nCamID,int iScan,int iFrame,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,int nSetPitch, double dGradient, double dIntercept, int nDetMargin, double dLeft, int nOffset, int nOffsetY);
+	BOOL				BlobDefect_Pixel_TypeRegionFilter(std::vector<CChipBlob> &vecBlob,std::vector<CChipPair> &vecPair,int nChipThres,int nMergeDist=2);
+	BOOL				FilteringDiagonalEdgeBlob(std::vector<CChipBlob> &vecBlob);
+	BOOL				OnlyChipInspection(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID, int iScan,int iFrame, int nIndex,CSISBuffer &ChipBuffer
+											,int nChipThres, int nChipThres_L,int nChipInsWidth,int nEdgeLeft,int nEdgeRight, CRect rectInsOrg, int nGlassStartLine
+											,int nGlassEndLine, int nFrameHeight, int nCPosXOffset, int nDPosXOffset, int nCPosYOffsetStart, int nCPosYOffsetEnd, int nDPosYOffsetStart, int nDPosYOffsetEnd, int nDetMargin = 1, int nChippingInsOffset = 0 ,double dFindLeft=0,int nAirThres = 200);
+	void				BinalizeFind_CornerChip(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch,CRect rectExpRegion,int iFrame=0, int nIndex=0, int nCamID=0, int iScan=0, int nChippingInsOffset=0);
+	void				BinalizeFind_CornerChip_White(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch, CRect rectInsOrg,int nGlassStartLine,int nGlassEndLine, int nFrameHeight,int nCPosXOffset, int nDPosXOffset, int	nCPosYOffsetStart, int nCPosYOffsetEnd, int nDPosYOffsetStart, int nDPosYOffsetEnd, CRect rectExpRegion, int iFrame, int nIndex, int nCamID, int iScan);
+	BOOL				FilteringEdgeBlob_TypeFilter(std::vector<CChipBlob> &vecBlob,ChipResionType emSide,int nBaseLine,int nDetMargin);
+	void				VConvolutionConvC_CornerChip(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch,int iFrame=0, int nIndex=0, int nCamID=0, int iScan=0);
+
+// General
+public:
+	void				ResetPairDefect(){m_nChipPairIndex=0;}
+	int					GetPairDefectCount(){return m_nChipPairIndex;}
+	CChipPair			*GetPairDefect(int iIndex);	
+	BOOL				BlobDefect_Pixel(std::vector<CChipBlob> &vecBlob,int nChipThres,int nMergeDist=2);
+	BOOL				InsertPairing(int x, int y, int sub, int threshold, int graySrc, int grayRef,ChipResionType s_RegionType,DefectPosType s_DefectPos, BOOL bEdgeDefect = FALSE, double dThick=0.);		
+	void				SetConvResolution(double dRes){m_dConvResolution=dRes;}
+	void				ResetSaveIndex(){m_nSaveIndex = 0;}
+	BOOL				CopyRectImg(LPBYTE pOrg,LPBYTE pTgt,CSize szImg,CRect &rectIns);
+
+protected:
+	BOOL				MergeDivision(std::vector<CChipBlob> &vecBlob, int nMergePixel = 4);
+	BOOL				MergeMix(std::vector<CChipBlob> &vecBlob, int nMergePixel = 4);
+	void				CheckDefectRect(CChipBlob& Defect, int nX, int nY);
+	int					CalcRScale(CPoint* pVertex);
+	void				SetBrokenDefect(CRect rectDefect);
+	BOOL				AssertRect(CRect rect,CSize szImg);
+
+protected:
+	double				m_dConvResolution;
+	LGLASSFINDDATA		m_pGlassEdgeLine;
+	int					m_nGlassEdgeLineCnt;
+	int					*m_pCannyWidthCnt;
+	int					m_nForeEdgeLine[2];
+	double				m_dAvgThick;
+	CChipBlob			*m_DefectBlob;
+	int					m_nDefectCnt;
+	std::vector<STU_CHIPPINGINS_EXP_POS>	m_expInsArea;
+	int					m_nSaveIndex;	
+	CChipPair			*m_pChipPairBuf;
+	int					m_nChipPairIndex;
+	BOOL				*m_bMerged;
+	BOOL				*m_bTemp;
+	int					*m_lFirstIndex;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_CHAMFERINSPECT_H_INCLUDED_)
diff --git a/Common_Class/EdgeInspect/Header/CornerCut.h b/Common_Class/EdgeInspect/Header/CornerCut.h
new file mode 100644
index 0000000..7b89355
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/CornerCut.h
@@ -0,0 +1,84 @@
+#pragma once
+
+enum CORNERCUR_DIR{CO_LT=0,CO_LB,CO_RT,CO_RB};
+enum ERRCODE_CORNERCUT{ERR_CO_IMAGENULL=0,ERR_CO_INSRECTNULL,ERR_CO_FINDVERT,ERR_CO_FINDHOR,ERR_CO_SUCCESS};
+
+struct sCoPoint {
+	double x, y;
+};
+
+struct sCoLine {
+	double mx, my;
+	double sx, sy;
+};
+
+using namespace std;
+
+class AFX_EXT_CLASS CCornerCut
+{
+public:
+	CCornerCut(void);
+	~CCornerCut(void);
+
+public:
+	ERRCODE_CORNERCUT	Inspection(LPBYTE pImg,CSize szImg,CRect &rectIns,int iFrame,int nLowThres,int nHighThres,CORNERCUR_DIR nDir, CString strHPanelID,BOOL bSaveImage
+									,COwnerBuffer	&pOrg,double &dResWidth,double &dResHeight);
+	void		GetData(sCoPoint *pPoint){CopyMemory(pPoint,m_nCornerPoint,sizeof(sCoPoint)*3);}
+
+protected:
+	BOOL		FindOuterLine(LPBYTE pImg,CRect rectIns,CORNERCUR_DIR nDir);
+	BOOL		FindOuterHori(LPBYTE pImg,CRect rectIns,double nYPos,double nStartX,CORNERCUR_DIR nDir);
+	BOOL		FindOuterVert(LPBYTE pImg,CRect rectIns,double nYPos,double nStartX,CORNERCUR_DIR nDir);
+	void		SaveMarkImage(LPBYTE pBuffer,CRect &rectIns);
+
+	void		AssertOnFrameRect(CRect &rect,CSize szImg=CSize(0,0));
+	float		AdaptiveThreshold(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
+	float		GetThresholdValue(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
+	BOOL		CopyEdgeImg(LPBYTE pImg,CSize szImg,CRect &rectIns);
+	void		ThresholdProcessing(LPBYTE pImg,CSize szImg,int nThres,int nDir);
+	void		ThresholdProcLowHigh(CSISBuffer &pImg,int nLowThres,int nHighThres);
+
+	BOOL		FindVerticalLine(LPBYTE pImg,CRect rectIns,int &nVertLine,CORNERCUR_DIR nDir);
+	BOOL		FindHorizontalLine(LPBYTE pImg,CRect rectIns,int &nHorLine,CORNERCUR_DIR nDir);
+	BOOL		FindCornerPoint(LPBYTE pImg,CRect rectIns,sCoPoint point,CORNERCUR_DIR nDir);
+	int			DetectLine(LPBYTE pImg,CRect rectIns,sCoPoint point,BOOL bDir,BOOL bReverse,CORNERCUR_DIR nDir,sCoPoint &pointResult);
+	void		GetRegionInfo(sCoPoint point,CORNERCUR_DIR nDir,BOOL bDir,int &nStart,int &nEnd,BOOL &bReverse,int nWidth,int nHeight);
+	int			GetHorCount(LPBYTE pImg,int v,sCoPoint point,BOOL bDir,int nWidth,int nSetCount);
+	int			GetVertCount(LPBYTE pImg,int u,sCoPoint point,BOOL bDir,int nWidth,int nHeight,int nSetCount);
+	void		CalculateLenght(double &dResWidth,double &dResHeight);
+
+	template<typename T>
+	inline void swapN(T a,T b)
+	{
+		T	c;	
+		c = a;	
+		a = b;	
+		b = c;
+	}
+
+	inline void swapLong(LONG &a,LONG &b)
+	{
+		LONG	c;	
+		c = a;	
+		a = b;	
+		b = c;
+	}
+
+protected:
+	BOOL		FindFirstPoint(CRect &rectIns);
+	double		ransac_line_fitting(sCoPoint *data, int no_data, sCoLine &model, double distance_threshold);
+	bool		find_in_samples (sCoPoint *samples, int no_samples, sCoPoint *data);
+	void		get_samples (sCoPoint *samples, int no_samples, sCoPoint *data, int no_data);
+	int			compute_model_parameter(sCoPoint samples[], int no_samples, sCoLine &model);
+	double		compute_distance(sCoLine &line, sCoPoint &x);
+	double		model_verification (sCoPoint *inliers, int *no_inliers, sCoLine &estimated_model, sCoPoint *data, int no_data, double distance_threshold);
+	BOOL		LineInterSection(CPoint p1,CPoint p2,CPoint p3,CPoint p4,double &dInterX,double &dInterY);
+	void		bresenham_Line(COwnerBuffer *pRes,CPoint posStart,CPoint posEnd,BYTE color);
+	
+protected:	
+	LPBYTE		m_pInsImg;
+
+	sCoPoint		m_nCornerPoint[3];
+	sCoPoint		*m_pOuterLineH,*m_pOuterLineV;
+	int			m_nOuterCountH,m_nOuterCountV;
+};
diff --git a/Common_Class/EdgeInspect/Header/EDGE_DIPM.h b/Common_Class/EdgeInspect/Header/EDGE_DIPM.h
new file mode 100644
index 0000000..b28a7b4
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/EDGE_DIPM.h
@@ -0,0 +1,437 @@
+//==================================================================================
+// DIPM.h : Declaration of DIPM
+//==================================================================================
+
+#ifndef __EDGE_DIPM__
+#define __EDGE_DIPM__
+
+//#include "stdafx.h"
+#include "cv.h"
+#include "highgui.h"
+#include "opencv.hpp"
+#include "core.hpp"
+#include <math.h>
+#include <map>
+#include <list>
+#include <vector>
+
+//Define DLL IM/EXPORTs
+
+#ifndef DLLEXPORT
+#define DLLEXPORT		__declspec(dllexport)
+#endif
+
+#ifndef DLLIMPORT
+#define DLLIMPORT		__declspec(dllimport)
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////
+// MACRO definitions
+
+#define align_4byte(in) ((in + 3)/4)*4
+
+// Memory allocation MACRO for compatible with windows SDK
+#define memalloc(flags, cb)		(GlobalLock(GlobalAlloc((flags),(cb))))
+#define memfree(lp)	\
+		(GlobalUnlock((HGLOBAL)GlobalHandle(lp)),(BOOL)GlobalFree((HGLOBAL)GlobalHandle(lp)))
+
+////////////////////////////////////////////////////////////////////////////////////
+// Constant definitions
+
+#define ROUND(a)				(a+0.5)
+#define FLOOR(a)				(a)
+
+// Numerical MACRO's
+#define	M_PI					acos(-1.0)
+#define M_RADIAN(x)				(((M_PI)*(x))/180.0)
+#define M_DEGREE(x)				(((180.0)*(x))/M_PI)
+
+#ifndef RANGEIN
+#define RANGEIN(a, r1, r2)		(((a>=r1)&&(a<=r2)) ? (1) : (0))
+#endif
+
+// Logical MACRO's
+#define MINIMUM(a, b)			((a)<(b) ? (a) : (b))
+#define MAXIMUM(a, b)			((a)>(b) ? (a) : (b))
+#define MIDDLE(a, b, c)			(((a>b)&&(a<c)) ? (1) : (0))
+
+enum	enGradientMask{GM_Sobel, GM_Prewitt, GM_Roberts};
+
+struct sPoint {
+	double x, y;
+};
+
+struct sLine {
+	double mx, my;
+	double sx, sy;
+};
+
+typedef struct rtiTEMP_RESULT
+{
+	float		 fRat;
+	CvPoint2D32f pt;
+}TEMP_RESULT;
+
+typedef  struct _rtiTEMP_MATCH_DATA
+{
+	double dMaxRate;
+	double dMinRate;
+	double dPt_X;
+	double dPt_Y;
+
+	_rtiTEMP_MATCH_DATA(void)
+	{
+		dMaxRate = 0.0;
+		dMinRate = 0.0;
+		dPt_X = 0.0;
+		dPt_Y = 0.0;
+	}
+}TEMP_MATCH_DATA;
+
+enum ChipPair	{CHIPDEFPAIR_NOTDEFINE = 0, CHIPDEFPAIR_PPAIR, CHIPDEFPAIR_MPAIR, CHIPDEFPAIR_SIDE, CHIPDEFPAIR_LARGE, CHIPDEFPAIR_UNPAIR };
+enum ChipType	{CHIPDEFTYPE_BLACK = 0, CHIPDEFTYPE_WHITE, CHIPDEFTYPE_MIXED, CHIPDEFTYPE_NODEFECT, CHIPDEFTYPE_DELETE};
+enum ChipResionType	{CHIPREGTYPE_LEFT = 0, CHIPREGTYPE_RIGHT, CHIPREGTYPE_RIGHT_WHITE, CHIPREGTYPE_NONE};
+enum DefectPosType	{INS_DEFECT_CHIP = 0, INS_DEFECT_BURR, INS_DEFECT_CRACK, INS_DEFECT_BROKEN,INS_DEFECT_NONE};
+enum ChipPosType	{CHIPPOSTYPE_BIN = 0, CHIPPOSTYPE_CEN, CHIPPOSTYPE_SP,CHIPPOSTYPE_NONE};
+
+// Directional information
+#define IM_NEGATIVE				101
+#define IM_POSITIVE				102
+#define IM_HORIZONTAL			103
+#define IM_VERTICAL				104
+#define IM_LEFT					105
+#define IM_RIGHT				106
+
+//Gray level
+#define IM_BLACK				0
+#define IM_WHITE				255
+
+//Image
+#ifndef _IMAGE_
+#define _IMAGE_
+typedef struct ImImage {
+	unsigned char	*buf;
+	int	cu;
+	int	cv;
+} IMAGE;
+#endif
+
+//Position in 2D
+#ifndef _IMPOS2D_
+#define _IMPOS2D_
+typedef struct ImPos2D {
+	double		u;
+	double		v;
+} IMPOS2D;
+#endif
+
+//Region of interest (ROI)
+#ifndef _ROI_
+#define _ROI_
+typedef struct ImRoi {
+	int	u1;
+	int	v1;
+	int	u2;
+	int	v2;
+} ROI, *LPROI;
+#endif
+
+class CChipBlob
+{
+public:	
+	ChipResionType	s_RegionType;
+	ChipPair	s_DefectPair;
+	ChipType	s_DefectType;
+	ChipPosType	s_DefectPosType;
+	DefectPosType s_DefectJudgeType;
+	int			s_nIndex;
+	int			s_nDefectArea;
+	int			s_nDefectX;
+	int			s_nDefectY;
+	int			s_xLevelSrcMax;
+	int			s_yLevelSrcMax;
+	int			s_nDefectRScale;
+	CRect		s_DefectRect;
+	short		s_sDefectPeak;
+
+	short		s_sLevelSrcMin;
+	short		s_sLevelSrcMax;
+	short		s_sLevelSrcAvg;
+	short		s_sLevelRefMin;
+	short		s_sLevelRefMax;
+	short		s_sLevelRefAvg;
+	short		s_sLevelDiffMin;
+	short		s_sLevelDiffMax;
+	short		s_sLevelDiffAvg;
+	int			s_nLevelSrcSum;
+	int			s_nLevelRefSum;
+	int			s_nLevelDiffSum;
+	short		s_sThreshold;	
+	BOOL		s_bRemoved;
+	double		s_dThick;
+	BOOL		s_bCornerChip;
+
+	CPoint		s_ptVertex[8];
+
+	CChipBlob()
+	{
+		Reset();
+	}
+	void Reset()
+	{		
+		s_RegionType		= CHIPREGTYPE_NONE;
+		s_DefectPair		= CHIPDEFPAIR_NOTDEFINE;
+		s_DefectType		= CHIPDEFTYPE_NODEFECT;
+		s_DefectJudgeType   = INS_DEFECT_NONE;
+		s_nIndex			= 0;
+		s_nDefectArea		= 0;
+		s_nDefectX			= 0;
+		s_nDefectY			= 0;
+		s_nDefectRScale		= 0;
+		// 20080525 捞霖锐
+		s_DefectRect.SetRect(INT_MAX, INT_MAX, 0, 0);
+		s_sDefectPeak		= 0;
+
+		s_sLevelSrcMin		= 2048;
+		s_sLevelSrcMax		= 0;
+		s_xLevelSrcMax		= 0;
+		s_yLevelSrcMax		= 0;
+		s_sLevelSrcAvg		= 0;
+		s_sLevelRefMin		= 2048;
+		s_sLevelRefMax		= 0;
+		s_sLevelRefAvg		= 0;
+		s_sLevelDiffMin		= 2048;
+		s_sLevelDiffMax		= 0;
+		s_sLevelDiffAvg		= 0;
+		s_nLevelSrcSum		= 0;	
+		s_nLevelRefSum		= 0;
+		s_nLevelDiffSum		= 0;
+
+		s_sThreshold		= 0;
+		s_dThick			= 0.;
+		s_bCornerChip		= FALSE;
+
+		// 20080525 捞霖锐
+		s_ptVertex[0]		= MAKELONG(32760, 32760);
+		s_ptVertex[1]		= MAKELONG(32760, 0);
+		s_ptVertex[2]		= MAKELONG(32760, 32760);
+		s_ptVertex[3]		= MAKELONG(0, 32760);
+		s_ptVertex[4]		= MAKELONG(0, 32760);
+		s_ptVertex[5]		= MAKELONG(0, 0);
+		s_ptVertex[6]		= MAKELONG(32760, 0);
+		s_ptVertex[7]		= MAKELONG(0, 0);
+
+		s_bRemoved			= FALSE;
+	}
+
+	void SetDefectPair(ChipPair DP)
+	{
+		if (s_DefectPair < DP)
+			s_DefectPair = DP;
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+	CChipBlob& operator=(const CChipBlob& rhs)
+	{
+		if(this != &rhs)
+		{			
+			s_RegionType		= rhs.s_RegionType;
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_DefectJudgeType	= rhs.s_DefectJudgeType;
+			s_nIndex			= rhs.s_nIndex;
+			s_nDefectArea		= rhs.s_nDefectArea;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nDefectRScale		= rhs.s_nDefectRScale;
+			s_DefectRect		= rhs.s_DefectRect;
+			s_sDefectPeak		= rhs.s_sDefectPeak;
+
+			s_sLevelSrcMin		= rhs.s_sLevelSrcMin;
+			s_sLevelSrcMax		= rhs.s_sLevelSrcMax;
+			s_xLevelSrcMax		= rhs.s_xLevelSrcMax;
+			s_yLevelSrcMax		= rhs.s_yLevelSrcMax;
+			s_sLevelSrcAvg		= rhs.s_sLevelSrcAvg;
+			s_sLevelRefMin		= rhs.s_sLevelRefMin;
+			s_sLevelRefMax		= rhs.s_sLevelRefMax;
+			s_sLevelRefAvg		= rhs.s_sLevelRefAvg;
+			s_sLevelDiffMin		= rhs.s_sLevelDiffMin;
+			s_sLevelDiffMax		= rhs.s_sLevelDiffMax;
+			s_sLevelDiffAvg		= rhs.s_sLevelDiffAvg;
+			s_nLevelSrcSum		= rhs.s_nLevelSrcSum;
+			s_nLevelRefSum		= rhs.s_nLevelRefSum;
+			s_nLevelDiffSum		= rhs.s_nLevelDiffSum;
+
+			s_sThreshold		= rhs.s_sThreshold;
+			s_dThick			= rhs.s_dThick;
+			s_bCornerChip		= rhs.s_bCornerChip;
+
+			int i;
+			for(i= 0; i< 8; i++)
+			{
+				s_ptVertex[i]= rhs.s_ptVertex[i];
+			}		
+			s_bRemoved			= rhs.s_bRemoved;
+		}
+		return *this;
+	}
+
+	// + 楷魂磊 坷滚肺爹.
+	CChipBlob operator+(const CChipBlob& rhs)
+	{
+		if (s_DefectPair < rhs.s_DefectPair)
+			s_DefectPair = rhs.s_DefectPair;
+
+		s_nDefectArea += rhs.s_nDefectArea;
+
+		if (s_ptVertex[0].x >= rhs.s_ptVertex[0].x)	// LT
+			s_ptVertex[0] = rhs.s_ptVertex[0];
+		if (s_ptVertex[1].x >= rhs.s_ptVertex[1].x)	// LB
+			s_ptVertex[1] = rhs.s_ptVertex[1];
+		if (s_ptVertex[2].y >= rhs.s_ptVertex[2].y)	// TL
+			s_ptVertex[2] = rhs.s_ptVertex[2];
+		if (s_ptVertex[3].y >= rhs.s_ptVertex[3].y)	// TR
+			s_ptVertex[3] = rhs.s_ptVertex[3];
+		if (s_ptVertex[4].x <= rhs.s_ptVertex[4].x)	// RT
+			s_ptVertex[4] = rhs.s_ptVertex[4];
+		if (s_ptVertex[5].x <= rhs.s_ptVertex[5].x)	// RB
+			s_ptVertex[5] = rhs.s_ptVertex[5];
+		if (s_ptVertex[6].y <= rhs.s_ptVertex[6].y)	// BL
+			s_ptVertex[6] = rhs.s_ptVertex[6];
+		if (s_ptVertex[7].y <= rhs.s_ptVertex[7].y)	// BR
+			s_ptVertex[7] = rhs.s_ptVertex[7];
+
+		s_nDefectRScale = (s_nDefectRScale + rhs.s_nDefectRScale);
+		if (s_DefectRect.left > rhs.s_DefectRect.left)
+			s_DefectRect.left = rhs.s_DefectRect.left;
+		if (s_DefectRect.top > rhs.s_DefectRect.top)
+			s_DefectRect.top = rhs.s_DefectRect.top;
+		if (s_DefectRect.right < rhs.s_DefectRect.right)
+			s_DefectRect.right = rhs.s_DefectRect.right;
+		if (s_DefectRect.bottom < rhs.s_DefectRect.bottom)
+			s_DefectRect.bottom = rhs.s_DefectRect.bottom;
+		if (s_sDefectPeak < rhs.s_sDefectPeak)
+			s_sDefectPeak		= rhs.s_sDefectPeak;
+
+		s_nDefectX = (s_DefectRect.right + s_DefectRect.left) / 2;
+		s_nDefectY = (s_DefectRect.bottom + s_DefectRect.top) / 2;
+
+		if (s_sLevelSrcMin > rhs.s_sLevelSrcMin)
+			s_sLevelSrcMin		= rhs.s_sLevelSrcMin;
+		if (s_sLevelSrcMax < rhs.s_sLevelSrcMax)
+		{
+			s_sLevelSrcMax		= rhs.s_sLevelSrcMax;
+			s_xLevelSrcMax		= rhs.s_xLevelSrcMax;
+			s_yLevelSrcMax		= rhs.s_yLevelSrcMax;
+		}
+		s_sLevelSrcAvg			= (s_sLevelSrcAvg + rhs.s_sLevelSrcAvg) / 2;
+		if (s_sLevelRefMin > rhs.s_sLevelRefMin)
+			s_sLevelRefMin		= rhs.s_sLevelRefMin;
+		if (s_sLevelRefMax < rhs.s_sLevelRefMax)
+			s_sLevelRefMax		= rhs.s_sLevelRefMax;
+		s_sLevelRefAvg			= (s_sLevelRefAvg + rhs.s_sLevelRefAvg) / 2;
+		if (s_sLevelDiffMin > rhs.s_sLevelDiffMin)
+			s_sLevelDiffMin		= rhs.s_sLevelDiffMin;
+		if (s_sLevelDiffMax < rhs.s_sLevelDiffMax)
+			s_sLevelDiffMax		= rhs.s_sLevelDiffMax;
+		s_sLevelDiffAvg			= (s_sLevelDiffAvg + rhs.s_sLevelDiffAvg) / 2;
+		s_nLevelSrcSum		+= rhs.s_nLevelSrcSum;
+		s_nLevelRefSum		+= rhs.s_nLevelRefSum;
+		s_nLevelDiffSum		+= rhs.s_nLevelDiffSum;
+
+		if (s_sThreshold < rhs.s_sThreshold)
+			s_sThreshold		= rhs.s_sThreshold;
+
+		if(s_dThick < rhs.s_dThick)
+			s_dThick = rhs.s_dThick;
+
+		s_bCornerChip			|= rhs.s_bCornerChip;
+
+		return *this;
+	}
+
+};
+
+class CChipPair
+{
+public:		
+	ChipPair	s_DefectPair;
+	ChipType	s_DefectType;
+	ChipResionType	s_RegionType;
+	DefectPosType	s_DefectPosType;
+	float		s_fDefectPeak;
+	int			s_nDefectX;
+	int			s_nDefectY;
+	int			s_nGraySrc;
+	int			s_nGrayRef;	
+	double		s_dThick;
+	BOOL		s_bCornerChip;
+
+	CChipPair()
+	{
+		Reset();
+	}
+	void Reset()
+	{		
+		s_DefectPair = CHIPDEFPAIR_NOTDEFINE;
+		s_DefectType = CHIPDEFTYPE_NODEFECT;
+		s_RegionType = CHIPREGTYPE_NONE;
+		s_DefectPosType = INS_DEFECT_NONE;
+		s_fDefectPeak = 0.0;
+		s_nDefectX = 0;
+		s_nDefectY = 0;
+		s_nGraySrc = 0;
+		s_nGrayRef = 0;
+		s_dThick = 0.;
+		s_bCornerChip = FALSE;
+	}
+	void SetPeak(int nPeak, int nKernelThres, int nCalcPixel)
+	{
+		s_fDefectPeak= static_cast<float>(abs(nPeak));
+		s_fDefectPeak -= static_cast<float>(nKernelThres);
+		s_fDefectPeak /= static_cast<float>(nCalcPixel);
+	}
+
+	// 汗荤 积己磊.
+	CChipPair(const CChipPair& rhs)
+	{
+		if(this != &rhs)
+		{		
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_fDefectPeak		= rhs.s_fDefectPeak;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nGraySrc			= rhs.s_nGraySrc;
+			s_nGrayRef			= rhs.s_nGrayRef;	
+			s_RegionType		= rhs.s_RegionType;	
+			s_dThick			= rhs.s_dThick;	
+			s_bCornerChip		= rhs.s_bCornerChip;
+			s_DefectPosType		= rhs.s_DefectPosType;
+		}
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+	CChipPair& operator=(const CChipPair& rhs)
+	{
+		if(this != &rhs)
+		{		
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_fDefectPeak		= rhs.s_fDefectPeak;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nGraySrc			= rhs.s_nGraySrc;
+			s_nGrayRef			= rhs.s_nGrayRef;
+			s_RegionType		= rhs.s_RegionType;	
+			s_dThick			= rhs.s_dThick;
+			s_bCornerChip		= rhs.s_bCornerChip;
+		}
+		return *this;
+	}
+};
+
+#endif
+
+// End of FV_DIPM.h
+////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/Header/EdgeFind.h b/Common_Class/EdgeInspect/Header/EdgeFind.h
new file mode 100644
index 0000000..4399b10
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/EdgeFind.h
@@ -0,0 +1,211 @@
+// EdgeFind.h: interface for the CEdgeFind class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_EDGEFIND_H__390230EE_3748_47C9_B543_04276FAFACA4__INCLUDED_)
+#define AFX_EDGEFIND_H__390230EE_3748_47C9_B543_04276FAFACA4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "EDGE_DIPM.h"
+
+class CSISBuffer;
+class CEdgeProc;
+
+enum	EDGELINE_DIR{DIR_HORIZONTAL=0,DIR_VERTICAL};
+enum	EDGELINE_POLAR{POLAR_WTOB=0,POLAR_BTOW,POLAR_ANY};
+enum	enEdgeFindType{EDGE_MAXCONTRAST=0,EDGE_FIRSTEDGE,EDGE_PROJECTION,EDGE_NONE};
+enum	EdgeSearchType		{ SearchTypeMinMax, SearchTypeOut2In, SearchTypeIn2Out };
+enum	EdgeSignalType		{ EdgeTypeNegative=0, EdgeTypePositive, EdgeTypeNone };
+enum	EdgeResultType		{ EdgeResultMid=0, EdgeResultLeft, EdgeResultRight,  };
+enum	SubPixelType		{ SubPixelLinear=0, SubPixelQuadratic, SubPixelRegression };
+enum	PreProcessType		{ PreProcNone=0, PreProcSobel };
+enum    TriangleResult		{	ImageFailModel=-1, ImageFailSource=-2, ImageFailSub=-3, ImageFailBandModel=-4, ImageFailBandSource=-5,
+								RecipeFailModel=-6, RecipeFailMarker=-7, RecipeFailFormula=-8, 
+								ProcessFailModel=-9, ProcessFailMarker=-10, ProcessFailFormula=-11, 
+								ResultFailModel=-12, ResultFailMarker=-13, ResultFailFormula=-14, 
+								EdgeFailLeft=-15, EdgeFailRight=-16, PreProcessFail=-17,
+								ProcessSuccess=1, ProcessNone=0 };
+
+//Projection data
+#ifndef _IMPROJ_
+#define _IMPROJ_
+enum	PROJECTION_TYPE{PROJECTION_VERTICAL=0,PROJECTION_HORIZONTAL};
+typedef struct ImProj{
+	int		x;
+	int		f;
+} IMPROJ, *LPIMPROJ;
+#endif
+
+class CPolynomial
+{
+public:
+	CPolynomial()		{ Reset(); }
+	CPolynomial(int degree, double coef)
+	{
+		nDegree = degree;
+		dCoef	= coef;
+	}
+	~CPolynomial()		{ Reset(); }
+	void Reset()
+	{
+		nDegree = 0;
+		dCoef	= 0.0;
+	}
+	int		nDegree;
+	double	dCoef;
+};
+
+typedef std::list<CPolynomial*>				ListPolynomial;
+typedef std::list<CPolynomial*>::iterator	ListPolynomialIt;
+
+typedef std::vector<double>					VectorDouble;
+typedef std::vector<double>::iterator		VectorDoubleIt;
+
+typedef std::vector<int>					VectorInteger;
+typedef std::vector<int>::iterator			VectorIntegerIt;
+
+class AFX_EXT_CLASS CEdgeResult
+{
+public:
+	CEdgeResult()		{ Reset(); }
+
+	CEdgeResult(int indexValue, int signalValue, int positionValue, double edgeValue)
+	{
+
+		nIndex			= indexValue;
+		nSignal			= signalValue;
+		nEdgePosition	= positionValue;
+		dEdgeValue		= edgeValue;
+
+		nEdgeType		= EdgeResultMid;
+		dPosition		= 0.0;
+		dStrength		= 0.0;
+
+		nLeftPosition	= positionValue;
+		nRightPosition	= positionValue;
+	}
+
+	CEdgeResult(int indexValue, int signalValue, double positionValue, double strengthValue)
+	{
+
+		nIndex		= indexValue;
+		nSignal		= signalValue;
+		dPosition	= positionValue;
+		dStrength	= strengthValue;
+
+		nEdgeType		= EdgeResultMid;
+		nLeftPosition	= 0;
+		nRightPosition	= 0;
+	}
+
+	~CEdgeResult()	{ Reset(); }
+
+	void Reset()
+	{
+		nEdgeType		= EdgeResultMid;
+		nIndex			= -1;
+		nSignal			= EdgeTypeNone;
+		nEdgePosition	= 0;
+		dEdgeValue		= 0.0;
+		dPosition		= 0.0;
+		dStrength		= 0.0;
+
+		nLeftPosition	= 0;
+		nRightPosition	= 0;
+	}
+
+	int		nEdgeType;
+	int		nIndex;
+	int		nSignal;
+	int		nEdgePosition;
+	double	dEdgeValue;
+
+	int		nLeftPosition;
+	int		nRightPosition;
+
+	double	dPosition;
+	double	dStrength;
+};
+typedef std::vector<CEdgeResult>			VectorEdgeResult;
+typedef std::vector<CEdgeResult>::iterator	VectorEdgeResultIt;
+
+class AFX_EXT_CLASS CEdgeFind
+{
+	CSISBuffer		*m_Buffer;
+	LPIMPROJ			m_pHproj;	
+	LPIMPROJ			m_pVproj;
+	VectorDouble		m_vectorEdgeData;
+	VectorInteger		m_vectorEdgeType;
+	VectorDouble		m_vectorImageData;	
+	VectorEdgeResult	m_vectorEdgeResult;
+
+public:
+	CEdgeFind();
+	virtual ~CEdgeFind();
+
+public:
+	int Find_LeftEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+	int Find_RightEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+
+public:
+	int	Find_LeftCanny(CSISBuffer *pBuffer,int nThres);
+	double FindLine_H(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,EDGELINE_POLAR enDir,EdgeSignalType enSignalType,enEdgeFindType enFind);
+	double FindLine_V(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,EDGELINE_POLAR enDir,EdgeSignalType enSignalType,enEdgeFindType enFind,BOOL bTop);
+	double FindGlassHorizontalLine(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,BOOL bDir, int nDist = 20);	
+	double FindGlassVerticalLine(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,BOOL bDir,int nDist = 10);
+	double FindLineSubPixel(LPBYTE pImg,CSize szImg,CRect &rectIns,int nPosiThres,int nNegaThres,EDGELINE_DIR enDir,EdgeSearchType enSearchType,EdgeSignalType enSignalType,int nKernelSize=2);
+
+protected:
+	void AssertOnFrameRect(CRect &rect,CSize szImg=CSize(0,0));
+	BOOL FV_ProjGet(LPBYTE src,CSize szImg, CRect &rect, PROJECTION_TYPE type, IMPROJ* res, ULONG* max, ULONG* min);	
+	int	 FindMaxContrastEx(IMPROJ* src, int nStart,int nEnd, long Width, long Height, EDGELINE_POLAR enDir, long Thresh,BOOL bForward=TRUE);
+	int	 FindFirstEdge(IMPROJ* src, int nStart,int nEnd, long Width, long Height, EDGELINE_POLAR enDir, long Thresh,BOOL bForward=TRUE);	
+	int	 FindMaxContrast(CSISBuffer &bufferOrg,CRect rect,BOOL bHor,int &nMaxDiff,BOOL bForward=TRUE);		
+	BOOL QuadraticRegression(VectorDouble& vectorX, VectorDouble& vectorY, double& a0, double& a1, double& a2);
+	bool parabolicInterpolate(double hm, double h0, double hp, double *c);
+	BOOL FindGlssEdgeLine(int &nPos,CRect rect,LPIMPROJ pProj,BOOL bDir,PROJECTION_TYPE nType,int nThres,int nContiValue,int nDist);
+
+protected:
+	BOOL				CalculateInterpolateLinear(CEdgeResult& edgeResult, double dEdgeThreshold);
+	BOOL				CalculateInterpolateQuadratic(CEdgeResult& edgeResult);
+	BOOL				CalculateInterpolateRegression(CEdgeResult& edgeResult);
+	void				CalculateEdgePosition(int nSubPixelType, double dPosiThres, double dNegaThres);
+	BOOL				CalculateImageValue(EDGELINE_DIR nDirection, BYTE *pImage, int nWidth, int nHeight, CRect &rect,int nStep, VectorDouble& vectorImageData);
+	BOOL				CalculateEdgeValue(const VectorDouble& vectorImageData, VectorDouble& vectorEdgeData, int nKernelSize);
+	BOOL				CalculateEdgeValue(const VectorDouble& vectorImageData, VectorDouble& vectorEdgeData, VectorInteger& vectorEdgeType, double dPositiveThres, double dNegativeThres, int nKernelSize);
+	BOOL				CalculateEdgeValue(EDGELINE_DIR nDirection, short *pImage, int nWidth, int nHeight, int nStep, VectorDouble& vectorEdgeData, VectorInteger& vectorEdgeType, double dPositiveThres, double dNegativeThres);
+	BOOL				GetEdgeLeftPosition(int nEdgeType, int nSearchType, int nStartPos, double& dPosition);
+	BOOL				GetEdgeRightPosition(int nEdgeType, int nSearchType, int nStartPos, double& dPosition);
+
+	double				AbsSum(double init, double x);
+	double				Sum(double init, double x);
+	static double		Square(double init, double x);
+	static double		Cubic(double init, double x);
+	static double		ForthPower(double init, double x);
+	double				Combi(VectorDouble& vectorX, VectorDouble& vectorY, int n, int r);
+	void				InsertPolynomial(ListPolynomial &listPolynomial, int degree, double coef);
+	void				RemovePolynomial(ListPolynomial& listPolynomial);
+	BOOL				CalculateLagrange(VectorDouble& vectorX, VectorDouble& vectorY, ListPolynomial& listPolynomial);
+
+	template <class T> 
+	inline void imMinMax(const T *map, int count, T& min, T& max)
+	{
+		min = *map++;
+		max = min;
+		for (int i = 1; i < count; i++)
+		{
+			T value = *map++;
+
+			if (value > max)
+				max = value;
+			else if (value < min)
+				min = value;
+		}
+	}
+};
+
+
+#endif // !defined(AFX_EDGEFIND_H__390230EE_3748_47C9_B543_04276FAFACA4__INCLUDED_)
diff --git a/Common_Class/EdgeInspect/Header/EdgeProc.h b/Common_Class/EdgeInspect/Header/EdgeProc.h
new file mode 100644
index 0000000..7715bc1
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/EdgeProc.h
@@ -0,0 +1,75 @@
+// EdgeProc.h: interface for the CEdgeProc class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_EDGEPROC_H_INCLUDED_)
+#define AFX_EDGEPROC_H_INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+#include "EDGE_DIPM.h"
+#include <vector>
+
+class CSISBuffer;
+
+
+class AFX_EXT_CLASS CEdgeProc
+{
+	int		m_nGX[3][3], m_nGY[3][3];
+	BYTE	m_btBackground,m_btWhite;
+
+public:
+	CEdgeProc();
+	virtual ~CEdgeProc();
+
+public:
+	BOOL				CannyEdgeProcessing(LPBYTE pImageBuf,CRect &rectIns,enGradientMask enMask,int nThres,CSISBuffer &ptgt);	
+	float				catmullRomSpline(float x, float v0,float v1, float v2,float v3) ;	
+	void				ThresholdProcessing(LPBYTE pImg,CSize szImg,int nThres,int nDir);
+	unsigned char		OtsuoBinary(CSISBuffer &pOrg,CRect rect,int nOpt=1);
+	float				AdaptiveThreshold(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
+	BOOL				HSobelBoundary(LPBYTE lpInImg, LPBYTE lpOutImg, int nWidth, int nBufWidth, int nHeight,int nThres);
+	BOOL				VSobelBoundary(LPBYTE lpInImg, LPBYTE lpOutImg, int nWidth, int nBufWidth, int nHeight,int nThres);
+	void				LocalHistogramEqualization(BYTE *image,int width,int height,int wsize,BYTE *out);
+	void				Adaptive_Binarization(BYTE *gray,int width,int height,int datawidth,int w/*window Size=15*/,double k/*factor=0.2*/,BYTE *bimage,CRect rect);	
+	void				ThresholdByIntegralImage(BYTE *image,int width,int height,int datawidth,int wsz,BYTE *matrix);
+		
+	
+	BOOL				IMMovePoint(IMPOS2D iPos, IMPOS2D *oPos, IMPOS2D B_P);
+	BOOL				IMGetRotImg(ROI aoi, CSISBuffer Org, CSISBuffer Tgt, IMPOS2D pCen, double sinRad, double cosRad);
+	BOOL				IMRotatePoint(IMPOS2D iPos, IMPOS2D *oPos, IMPOS2D B_P, double sinRad, double cosRad);
+	BOOL				IMRotatePoint(IMPOS2D iPos, IMPOS2D *oPos, double sinRad, double cosRad);
+	int					IMROICenX(ROI roi) { return	(int)(roi.u1 + (roi.u2 - roi.u1) / 2 + 0.5); }
+	int					IMROICenY(ROI roi) { return	(int)(roi.v1 + (roi.v2 - roi.v1) / 2 + 0.5); }
+	int					IMROIWidth(ROI roi) { return	(int)(roi.u2 - roi.u1 + 1); }
+	int					IMROIHeight(ROI roi) { return	(int)(roi.v2 - roi.v1 + 1); }
+
+public:
+	BOOL				CvFindMark(CSISBuffer lpOrg,IplImage *IpMark,CRect rcIns,TEMP_RESULT &result, double  dRate);
+	TEMP_MATCH_DATA		Cv_TempleateMath(CvRect roi,IplImage* IpSrc	,IplImage* IpTem);
+
+public:
+	BOOL				RotatePoint(CPoint iPos, CPoint *oPos, CPoint B_P, double sinRad, double cosRad);
+	BOOL				RotatePoint(CPoint iPos, double &dXPos,double &dYPos, double sinRad, double cosRad);
+	BOOL				RotatePoint(CPoint iPos, double &dXPos,double &dYPos, CPoint B_P, double sinRad, double cosRad);
+	BOOL				RotatePoint(CvPoint2D32f  iPos, double &dXPos,double &dYPos, CvPoint2D32f  B_P, double sinRad, double cosRad);
+	BOOL				RotatePoint(CvPoint2D32f iPos, double &dXPos,double &dYPos, double sinRad, double cosRad);
+	BOOL				RotatePoint(CPoint iPos, CPoint *oPos, double sinRad, double cosRad);	
+	BOOL				MovePoint(CPoint iPos, CPoint *oPos, CPoint B_P);
+	double				GetTheta(sPoint *pLinedata,int nLineCnt,int nRange=20);
+
+protected:
+	int					MaximizeDiscriminantFunction(double * p);
+	void				imCalcHistogram(LPBYTE pOrg, int nWidth,int nHeight, unsigned long* histo, int cumulative,CRect rect);	
+	float				GetThresholdValue(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
+	void				MakeIntegralImage(BYTE *image,int width,int height,int datawidth,int *intImage);	
+
+protected:
+	int					m_subthick;			// sub-thickness
+};
+
+
+#endif // !defined(AFX_EDGEPROC_H_INCLUDED_)
diff --git a/Common_Class/EdgeInspect/Header/Edge_Log.h b/Common_Class/EdgeInspect/Header/Edge_Log.h
new file mode 100644
index 0000000..f629cc6
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/Edge_Log.h
@@ -0,0 +1,30 @@
+#if !defined(__EDGE_LOG_INCLUDED__)
+#define __EDGE_LOG_INCLUDED__
+
+class CEdge_Log
+{
+	// Construction
+public:
+	CEdge_Log();	
+	virtual ~CEdge_Log();
+
+public:
+	void		DisplayEdgeLog(char* str, ...);
+	void		DisplayEdgeLog(CString str);
+	BOOL		WriteToFile(CTime& time, CString& strContents);
+	BOOL		WriteToFile(CTime& time, char* strContents);
+	BOOL		MakeLogFile();
+	void		SetPath(CString& strPath, CString& strName, BOOL bDelete, int nRemainCount);
+
+protected:
+	CRITICAL_SECTION		m_csLog;
+	char					m_strBuffer[512];
+	CTime					m_TimeLogFile;
+	CFile					*m_pFileLog;
+	CString					m_strLogPath;	
+	CString					m_strLogFile;	
+	
+};
+
+
+#endif
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/Header/NotchCut.h b/Common_Class/EdgeInspect/Header/NotchCut.h
new file mode 100644
index 0000000..b284864
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/NotchCut.h
@@ -0,0 +1,276 @@
+#pragma once
+
+#include <map>
+#include <list>
+#include <vector>
+#include "SplineInspect.h"
+#include "ChamferInspect.h"
+#include "EDGE_DIPM.h"
+
+using namespace std;
+
+enum	EM_NOTCH_MSG_ERR{ERR_NO_MASTERIMG=0,ERR_NO_ORGIMG,ERR_FIND_POS,NORMAL_EXE};
+
+typedef struct  _NOTCH_Parm_STU
+{
+	BOOL		bChipIns;
+	BOOL		bSizeIns;
+	int			nChipDiff;	
+	int			nSizeDiff;
+	int			nDetThres;	
+	int			nEdgeThres;
+	int			nSizeThres;
+	int			nChipThres;
+	int			nSkipSize;
+	double		dBlank2EdgeRatio;
+	BOOL		bSplineChip[2];	
+	int			nSpInsSize[2];	
+	int			nChamferSize;
+	int			nChamferDiff;
+	int			nNoDetSkipSize;
+	int			nDetSkipSize;
+	double		dCamRes;
+	int			nPointInsAveCount;
+
+	_NOTCH_Parm_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bChipIns = bSizeIns = bSplineChip[0] = bSplineChip[1] = FALSE;
+		nChipDiff = nDetThres = nEdgeThres = nChipThres = nSkipSize = 0;
+		nSpInsSize[0] = nSpInsSize[1] = nSizeDiff = nChamferSize = nChamferDiff = nNoDetSkipSize = nDetSkipSize = 0;
+		dCamRes = dBlank2EdgeRatio = 0.;
+		nPointInsAveCount = 5;
+	}
+}NOTCH_Parm_STU;
+
+typedef struct  _NOTCH_Master_STU
+{
+	BOOL			bLoad;
+	COwnerBuffer	imgBuf;
+	int				nPosX;
+	int				nPosY;	
+	int				nMaxX;
+	int				nMaxY;
+
+	_NOTCH_Master_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bLoad = FALSE;
+		imgBuf.ReleaseSpace();		
+		nPosX = nPosY = nMaxX = nMaxY = 0;
+	}		
+}NOTCH_Master_STU;
+
+typedef struct  _PointD
+{
+	double		X,Y;
+
+	_PointD()
+	{
+		Reset();
+	}
+	_PointD(double dX,double dY)
+	{
+		X = dX;
+		Y = dY;
+	}
+	void Reset()
+	{
+		X = Y = 0.;
+	}		
+}PointD;
+
+typedef struct  _NOTCH_ObjFind_STU
+{
+	double		dMatPosX;
+	double		dMatPosY;
+	int			nEdgeTop;
+	int			nEdgeBot;
+
+	_NOTCH_ObjFind_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		dMatPosX = dMatPosY = 0.;
+		nEdgeTop = nEdgeBot = 0;
+	}
+}NOTCH_ObjFind_STU;
+
+typedef struct  _NOTCH_Merge_STU
+{
+	int			nStart;
+	int			nEnd;
+	int			nSize;
+
+	_NOTCH_Merge_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		nStart = nEnd = -1;
+		nSize = 0;
+	}
+}NOTCH_Merge_STU;
+
+typedef struct  _NOTCH_Circle_STU
+{
+	PointD		pointF;
+	PointD		pointS;
+
+	_NOTCH_Circle_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		pointF = pointS = PointD(0,0);
+	}
+}NOTCH_Circle_STU;
+
+typedef struct  _NOTCH_RangePos_STU
+{
+	CPoint		pointCAD;
+	CPoint		pointImg;
+	double		dDist;
+	int			nInsCount;//20140528
+
+	_NOTCH_RangePos_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		pointCAD = pointImg = CPoint(0,0);
+		dDist = 0.;
+		nInsCount = 0;//20140528
+	}
+}NOTCH_RangePos_STU,*pNOTCH_RangePos_STU;
+
+struct SortYPos : public std::binary_function<pair<int,CPoint>, pair<int,CPoint>, bool>
+{
+	bool operator()(const pair<int,CPoint> & lhs, const pair<int,CPoint> & rhs)
+	{
+		return lhs.second.y > rhs.second.y;
+	}
+};
+struct ResSortYPos : public std::binary_function<pair<int,CPoint>, pair<int,CPoint>, bool>
+{
+	bool operator()(const pair<int,CPoint> & lhs, const pair<int,CPoint> & rhs)
+	{
+		return lhs.second.y < rhs.second.y;
+	}
+};
+struct SortSPYPos : public std::binary_function<pair<int,CSplinePoint>, pair<int,CSplinePoint>, bool>
+{
+	bool operator()(const pair<int,CSplinePoint> & lhs, const pair<int,CSplinePoint> & rhs)
+	{
+		return lhs.second.rotate.y < rhs.second.rotate.y;
+	}
+};
+#define MAX_NOTCH_SCAN_COUNT 4
+#define MAX_NOTCH_DEFECT_COUNT	1000
+
+class CSISBuffer;
+
+class AFX_EXT_CLASS CNotchCut
+{
+public:
+	CNotchCut(void);	
+	virtual ~CNotchCut(void);
+
+public:
+	void		Reset();
+	BOOL		LoadData(CString strFile);	
+	BOOL		CopyModelData(CNotchCut *pNotch);
+	BOOL		AdjustTilt(int index,double dTheta,double baseCenY);
+	void		SetParm(NOTCH_Parm_STU &parm);
+	int			NotchExecute(CSISBuffer &pOrg,double *dResult,double *dResult_Dy,pNOTCH_RangePos_STU pRangeRes,pNOTCH_RangePos_STU pRangeRes_Dy,pNOTCH_RangePos_STU pRangeRes_Cham,int nRangeCnt,COwnerBuffer &pRes,COwnerBuffer &pRes_Dy,COwnerBuffer &pRes_Cham,double *dAvgThick,int iDimension
+		, double *dFeedbackXY, int icam,double *dGlassXY,double dAlign2GlassX,int iLeftLine,BOOL bSaveDebug,CString strSavePath,double dTheta);	//20140528
+	BOOL		WriteModelData(CString strFile,CString strRecipe,CString strCut,std::multimap<int, CSplinePoint> *pPoint);
+	BOOL		ReadModelData(CString strFile,int index);
+	CChipBlob	*GetResultDefect(){return m_ResultDefect;}
+	int			GetDefectCount(){return m_nDefectCount;}
+	void		SetNotchInsPoint(std::vector<CPoint> *InsPoint, int index);//20140528
+	void		FindCenterPos(CSISBuffer &pImg,int &nPosX,int &nPosY,int nSkipSize=10);//20140528
+
+protected:
+	BOOL		CalDiffXY(std::multimap<int,CSplinePoint>	*mapDist,double *dDx,double *dDy);
+	void		CalRangeVal(std::multimap<int,CSplinePoint>	*mapDist,double *dResDist,pNOTCH_RangePos_STU dRangeRes,int nRangeCnt,int nCenX,int nCenY,int nStartX,int nFirstY,int nLastY);
+	void		CalRangeVal_New(std::multimap<int,CSplinePoint>	*mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dResDist,double *dResDist_Dy,pNOTCH_RangePos_STU dRangeRes,pNOTCH_RangePos_STU dRangeRes_Dy,pNOTCH_RangePos_STU dRangeRes_Cham,int nRangeCnt,int nCenX,int nCenY,int nStartX,int nFirstY,int nLastY,std::multimap<int,CSplinePoint> *mapChamfer);//20140528
+	int			CropDataXY2(std::multimap<int,CSplinePoint> *mapCrop,std::multimap<int,CSplinePoint> *mapDist,int nStartX,int nFirstY,int nLastY,double *dResDist);
+	int			CropDataXY2_Chamfer(std::multimap<int,CSplinePoint> *mapCrop,std::multimap<int,CSplinePoint> *mapDist,int nStartX,int nFirstY,int nLastY);//20140528
+	CSplinePoint	FindCenter2Vec(std::multimap<int,CSplinePoint> *mapCrop,int nCenY,int *nPosition);
+	void		GetRangeAvgThick(std::multimap<int,CSplinePoint> *mapCrop,pNOTCH_RangePos_STU pReangeRes,CSplinePoint spCenter,int nRangeCnt);
+	void		GetRangeAvgThick_New(std::multimap<int,CSplinePoint> *mapCrop,pNOTCH_RangePos_STU pReangeRes,CPoint point,int nRangeCnt);//20140528
+	void		GetRangeAvgThick_New_Cham(std::multimap<int,CSplinePoint> *mapCropChamfer,pNOTCH_RangePos_STU pReangeRes,CPoint point,int nRangeCnt);//20140528
+	void		Inspection_Size(CSISBuffer &pOrg,COwnerBuffer &pRes,COwnerBuffer &pRes_Dy,COwnerBuffer &pRes_Cham,CSISBuffer &pBinEdge,CSISBuffer &pBin,double *dChamferAvgThick,double *dChipAvgThick,int nCenX,int nCenY,int nGlass2Edge,double *dFeedbackXY
+		,int iDimension, int icam, std::multimap<int,CSplinePoint> *mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dGlassXY,double *dResult,std::multimap<int,CSplinePoint> *mapChamfer,double dTheta);	//20140528
+	void		ThinImage(CSISBuffer &pBinThin,int iscan, int icam);	
+	BOOL		DistInspection(CSISBuffer &pTgt,CSISBuffer &pOrg,double *dResult,double *dRangeRes,double *dAvgThick,int nCenX,int nCenY,int nGlass2Edge, double *dFeedbackXY,int iscan, int icam);
+	BOOL		DistInspection_New(CSISBuffer &pBin,CSISBuffer &pOrg,double *dChamferThick,double *dChipAvgThick,int nCenX,int nCenY,int nGlass2Edge
+		, double *dFeedbackXY,int iDimension, int icam, std::multimap<int,CSplinePoint> *mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dGlassXY,int *nUpVPos,int *nDwVPos,std::multimap<int,CSplinePoint> *mapChamfer,double dTheta);	//20140528
+	BOOL		Inspection_SpChip(CSISBuffer &pBin,CSISBuffer &pOrg,int nGlass2Edge,int nUpVPos,int nDwVPos);
+	int			Defect_Analyze(std::multimap<double,CDetectPoint> *mapDist,double dAvgThick);
+	void		GetSpChipData(vector<pair<int,CPoint>> *pVec,CRect *rectIns);
+	double		Detect_Position(CSISBuffer &pBin,CSISBuffer &pOrg,std::multimap<double,CDetectPoint> *mapDist
+		,vector<pair<int,CPoint>> *vecData);
+	void		DrawImgRect(CSISBuffer &pOrg,double dX,double dY,int nValue=128);
+	int			AnalysisThick(CRect rectImg,double dRes,int nJudgeThick,double dAvgThick);
+	int			GetRangeDivThick(std::multimap<int, CSplinePoint> *mapCrop,CSplinePoint	spCenter,int nCenterPos,pNOTCH_RangePos_STU pRangeRes,int nRangeCnt,BOOL bOpt,int nDivRange);
+	void		SetBrokenDefect(CPoint pointBroken);
+
+protected:	
+	void		AssertRect(CRect &rect,CSISBuffer pOrg);	
+	int			FindLeftLine(CSISBuffer &pImg,CRect rect,int nThres);
+	int			FindLeftLineReal(CSISBuffer &pImg,CRect rect,int nThres);
+	void		SetNotchImgResPoint(COwnerBuffer *pRes,pNOTCH_RangePos_STU RangeVal,int nRangeCnt);
+	void		bresenham_Line(COwnerBuffer *pRes,CPoint posStart,CPoint posEnd,BYTE color);
+
+protected:
+	void		FindRealPos(CSISBuffer &pOrg,CSISBuffer &pBin,int iLeftLine,int &nCenX,int &nCenY
+		,int *nStartX,int *nFisrtY,int *nLastY,int iCam,int iDem,int nSkipSize=10);	
+	void		FindYPosMerge(std::vector<int> *vList,std::vector<NOTCH_Merge_STU> *vMergeList);
+	void		FindYPosPixel(CSISBuffer &pImg,CRect rect,std::vector<int> *vList,int nThres,int u,BOOL bDir=TRUE);
+	int			FindAccumYPos(CSISBuffer &pImg,CRect rect,int nThres);
+	void		FindRealAccumXY(CSISBuffer &pImg,CRect rect,int nThres,int *nStartX,int *nFirstY,int *nLastY);
+	double		FindRealAccumYPos(CSISBuffer &pImg,int nSkipSize,int nThres,int *iLeftLine);	
+	double		FindRealCenter(CSISBuffer &pImg,CRect rect,int nThres,int *nStartX,int *nFirstY,int *nLastY);	
+	void		FindRealYPosMerge(std::vector<int> *vList,std::vector<NOTCH_Merge_STU> *vMergeList);
+	void		MakeFoldImage(CSISBuffer &pImg,int nPosY);
+	void		MakeReal2Cad(CSISBuffer &pOrg,int nCenX,int nCenY,int iDimension=0, int icam=0);	
+	void		MakeReal2AlignCad(CSISBuffer &pOrg,int nCenY,int nForeX,int iDimension=0, int icam=0);	
+	void		MakeReal2Cad_Image(CSISBuffer &pOrg,COwnerBuffer &pRes,int nValue=128);
+	void		ResetData();
+	PointD		GetCenterPointFrom3Points(const PointD& S, const PointD& M, const PointD& E);
+	void		Exe_ChipInspect(CSISBuffer &pBin,CSISBuffer &pOrg,int iCam);
+	double		FindCenterThickness(CSISBuffer &pOrg,CSISBuffer &pBin,int nCenX,int nCenY,int icam,int iDimension);
+
+public:	
+	vector<pair<int,CPoint>> m_mapMaster;
+	std::multimap<int, CPoint> m_mapOrgMaster[MAX_NOTCH_SCAN_COUNT];
+	std::multimap<int, CPoint> m_mapAlignMaster[MAX_NOTCH_SCAN_COUNT];
+	vector<pair<int,CPoint>> m_mapMaster_InsPos;//20140528
+	std::multimap<int, CPoint> m_mapOrgMaster_InsPos[MAX_NOTCH_SCAN_COUNT];//20140528
+	std::multimap<int, CPoint> m_mapAlignMaster_InsPos[MAX_NOTCH_SCAN_COUNT];//20140528
+	vector<pair<int,CSplinePoint>> m_mapChipData;
+	CChipBlob		m_ResultDefect[MAX_NOTCH_DEFECT_COUNT];
+	int				m_nDefectCount;	
+
+public:
+	NOTCH_Parm_STU		m_InsParm;
+	NOTCH_Master_STU	m_MasterParm[MAX_NOTCH_SCAN_COUNT];
+	NOTCH_Master_STU	m_AlignMasterParm[MAX_NOTCH_SCAN_COUNT];
+	NOTCH_ObjFind_STU	m_ObjectInfo;	
+	BOOL				m_bSaveDebug;
+	CString				m_strSavePath;
+	int					m_nNoDetCount,m_nTotalCount;
+};
diff --git a/Common_Class/EdgeInspect/Header/ProfileCADProc.h b/Common_Class/EdgeInspect/Header/ProfileCADProc.h
new file mode 100644
index 0000000..17ccc86
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/ProfileCADProc.h
@@ -0,0 +1,68 @@
+#pragma once
+
+#include <map>
+#include <list>
+#include <vector>
+#include "cv.h"
+
+typedef struct STU_PROFILE_POSITION_
+{	
+	int			iSide;
+	int			iScan;
+	int			iIndex;
+	int			nMin;
+	int			nMax;
+	CPoint		point;
+	BOOL		bFindPos;	
+
+public:
+	STU_PROFILE_POSITION_()
+	{		
+		iSide = iScan = iIndex = 0;
+		nMin = nMax = 0;
+		point = CPoint(-1,-1);
+		bFindPos = FALSE;	
+	}	
+}STU_PROFILE_POSITION, *pSTU_PROFILE_POSITION;
+
+using namespace std;
+class AFX_EXT_CLASS CProfileCADProc
+{
+public:
+	CProfileCADProc(void);
+	virtual ~CProfileCADProc(void);
+
+public:
+	void		SetProfileData(std::multimap<int, CPoint*> *pmapProfile,std::multimap<int, CPoint*> *pmapAlignProfile);
+	void		SetProfileOrigin(CPoint ptOrigin);
+	int			MakeProfileCAD(int iSide,CString strFile);
+	BOOL		WriteProfileData(CString strFile,CString strImg=_T(""));
+	BOOL		ReadProfileData(CString strFile);	
+	BOOL		RotateProfileData(CvPoint2D32f ptFirst,CvPoint2D32f ptSecond,CvPoint2D32f ptOffset);
+	BOOL		GetProfilePosition(std::vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile);
+	CPoint		GetProfileOrigin(){return m_pointMasterMin;}
+	CPoint		GetProfileMax(){return m_pointMasterMax;}
+	CPoint		FindCADPoint(CvPoint2D32f ptCenter,double dTheta,int nRange);
+	CPoint		FindCADPoint(CvPoint2D32f ptCenter,double dTheta,int nRange,LPBYTE	lpImg,int nWidth,int nHeight,CPoint &ptGlass,CPoint &ptChamfer,int nGlassthres,int nChamferThres);
+	CPoint		FindCADPointY(int nX,BOOL bStart);
+	CPoint		FindCADPointY(int nX,BOOL bStart,LPBYTE	lpImg,int nWidth,int nHeight,CPoint &ptGlass,CPoint &ptChamfer,int nGlassthres,int nChamferThres);
+	BOOL		FindGlassLine(CPoint ptOrigin,int nRange,double dTheta,LPBYTE lpImg,int nWidth,int nHeight,int nGlassThres,int nChamferThres,CPoint &ptGlass,CPoint &ptChamfer);
+	void		Reset();
+
+protected:
+	int			FindProfileLine(CSISBuffer &BufCad);
+	BOOL		SaveImageJPG(CString strFile,CSISBuffer &buffer);
+
+protected:
+	BOOL		m_bLoadMaster;
+	std::multimap<int, CPoint*> *m_pmapProfile;		
+	std::multimap<int, CPoint*> *m_pmapAlignProfile;		
+	CPoint		m_ptOrigin;
+	CPoint		m_pointMasterMax;
+	CPoint		m_pointMasterMin;
+	double		m_dTheta;
+	CPoint		m_ptOffset;
+	CPoint		m_ptAlign;
+	CPoint		m_ptOriginOffset;
+};
+
diff --git a/Common_Class/EdgeInspect/Header/RANSAC_LineFittingAlgorithm.h b/Common_Class/EdgeInspect/Header/RANSAC_LineFittingAlgorithm.h
new file mode 100644
index 0000000..a4f33d3
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/RANSAC_LineFittingAlgorithm.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "EDGE_DIPM.h"
+
+class AFX_EXT_CLASS CLineFitting
+{
+public:
+	CLineFitting(void);	
+	virtual ~CLineFitting(void);
+	
+public:
+	double ransac_line_fitting(sPoint *data, int no_data, sLine &model, double distance_threshold);
+
+protected:
+	double	model_verification (sPoint *inliers, int *no_inliers, sLine &estimated_model, sPoint *data, int no_data, double distance_threshold);
+	double	compute_distance(sLine &line, sPoint &x);
+	int		compute_model_parameter(sPoint samples[], int no_samples, sLine &model);
+	void	get_samples (sPoint *samples, int no_samples, sPoint *data, int no_data);
+	bool	find_in_samples (sPoint *samples, int no_samples, sPoint *data);
+};
diff --git a/Common_Class/EdgeInspect/Header/SISEdgeFind.h b/Common_Class/EdgeInspect/Header/SISEdgeFind.h
new file mode 100644
index 0000000..6105ca8
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/SISEdgeFind.h
@@ -0,0 +1,162 @@
+// EdgeFind.h: interface for the CSISEdgeFind class.
+//
+//////////////////////////////////////////////////////////////////////
+#pragma once
+
+#include <map>
+
+class CSISBuffer;
+
+
+// defect count 扁馆栏肺 cutoff point 甫 茫酒 霖促.
+// AddCountData甫 烹茄 规过苞 FindCutoff_Continue甫 烹茄 规过 滴啊瘤啊 乐促.
+class AFX_EXT_CLASS CCutoffFind
+{
+	int m_nContinuousCutoff;
+	int *m_pCountData;
+public:
+	int	m_maxCount;
+	int m_nCountData;
+	CCutoffFind()
+	{
+		m_nCountData= 0;
+		m_pCountData= NULL;
+	}
+	virtual ~CCutoffFind()
+	{
+		if(m_pCountData)
+			delete m_pCountData;
+	}
+	BOOL SetSize(int nData)
+	{
+		m_nCountData= nData;
+		if(m_pCountData)
+			delete m_pCountData;
+		m_pCountData= new int[nData];
+		return TRUE;
+	}
+
+	// 鉴瞒利栏肺 龋免登搁 cutoff牢瘤甫 魄喊秦 楷加 cutoff count甫 府畔秦 霖促.
+	int AddCountData(int data, int nCutoff)
+	{
+		if(data >= nCutoff)
+		{
+			m_nContinuousCutoff++;
+			return m_nContinuousCutoff;
+		}
+		m_nContinuousCutoff= 0;
+		return 0;
+	}
+
+
+	void SetCountData(int iData, int data)
+	{
+		m_pCountData[iData]= data;
+	}
+	// 沥,开规氢栏肺 line by line 八荤窍哥 Cutoff_Continuous甫 茫酒 辰促.  Cutoff_Continuous啊 绝栏搁 false, Cutoff 困摹绰 沥规氢 扁霖狼 index捞促.
+	// nContinue俺荐 捞惑 瘤加利栏肺 cutoff啊 积败具 Cutoff_Continuous肺 埃林茄促.
+	BOOL FindCutoff_Continuous(BOOL bForwardScan, int nCutoff, int nContinue, int &iForwardResult,int nOffset=0)
+	{
+		int i;
+		int nOccur= 0;
+
+		if(bForwardScan)
+		{
+			for(i= nOffset; i< m_nCountData; i++)
+			{
+				if(m_pCountData[i] >= nCutoff)
+				{
+					nOccur++;
+					if(nOccur >= nContinue)
+					{
+						iForwardResult= i- nContinue+ 1;
+						return TRUE;
+					}
+				}else
+				{
+					nOccur= 0;
+				}
+			}
+			return FALSE;
+		}
+
+		for(i= m_nCountData-1; i >= nOffset; i--)
+		{
+			if(m_pCountData[i] >= nCutoff)
+			{
+				nOccur++;
+				if(nOccur >= nContinue)
+				{
+					iForwardResult= i+ nContinue;
+					return TRUE;
+				}
+			}else
+			{
+				nOccur= 0;
+			}
+		}
+		return FALSE;
+	}
+};
+
+enum SISEdgePos{eEP_LEFT, eEP_TOP, eEP_RIGHT, eEP_BOTTOM};
+
+struct stEdgeLRResult
+{
+	int iFrame;
+	int nPos;
+};
+
+typedef std::multimap<int, stEdgeLRResult> mapEdgeResult;
+typedef std::multimap<int, stEdgeLRResult>::iterator mapEdgeResultIt;
+
+class AFX_EXT_CLASS CSISEdgeFind
+{
+public:
+	CSISEdgeFind();
+	virtual ~CSISEdgeFind();
+
+protected:
+	CSISBuffer		*m_Buffer;
+
+	//Left Result
+	mapEdgeResult		m_mapLeftEdge;
+	//Right Result
+	mapEdgeResult		m_mapRightEdge;
+	//Top Result
+	int					m_nTopEdge;
+	//Bottom Result
+	int					m_nBottomEdge;
+
+public:
+	void				ResetEdge();
+
+	int					GetEdgeResult(SISEdgePos eEP, int iFrame = 0, BOOL bNearResult = FALSE);
+	BOOL				IsFindEdge(SISEdgePos eEP, int iFrame = 0);
+
+public:
+	BOOL FindEdge_ToTop(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect);
+	BOOL FindEdge_ToBottom(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect);
+	BOOL FindEdge_ToLeft(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset);
+	BOOL FindEdge_ToRight(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset);
+	BOOL FindEdge_ToRightROI(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset,CRect rtROI);
+
+public:
+	int Find_LeftEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+	int Find_RightEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+	int Find_TopEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+	int Find_GlassStart(CSISBuffer *pBuffer, double pitch);
+public:
+	void GetCount_X(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find,int nOffset);
+	void GetCount_XROI(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find,int nOffset,CRect rtROI);
+	void GetCount_Y(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find);
+
+	int ImageProjection(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist = 8, int nContinue = 2);
+	int	ImageProjection_R(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist = 8, int nContinue = 2);
+	int	ImageProjection_Vert(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist = 8, int nContinue = 2);
+	int	ImageProjection_Vert_R(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist = 8, int nContinue = 2);
+
+	int	FindEdge(CSISBuffer framebuffer, SISEdgePos eEP, CRect rtROI, int nThres);
+	int	FindEdgeVert(CSISBuffer framebuffer, SISEdgePos eEP, CRect rtROI, int nThres);
+};
+
diff --git a/Common_Class/EdgeInspect/Header/SplineInspect.h b/Common_Class/EdgeInspect/Header/SplineInspect.h
new file mode 100644
index 0000000..52c271b
--- /dev/null
+++ b/Common_Class/EdgeInspect/Header/SplineInspect.h
@@ -0,0 +1,251 @@
+#pragma once
+
+#include "RANSAC_LineFittingAlgorithm.h"
+#include "EdgeProc.h"
+#include "EdgeFind.h"
+#include "ChamferInspect.h"
+#include <map>
+#include <vector>
+
+using namespace std;
+
+enum	SPLINE_ERR_MSG{ERR_SPLINE_EMPTYMASTER=1,ERR_SPLINE_EDGEPROCESS,ERR_SPLINE_LABELPROCESS,ERR_SPLINE_LABELCOUNT,ERR_SPLINE_INDEXFIND
+,ERR_SPLINE_LABELPOSITION,ERR_SPLINE_POSITIONNULL,ERR_SPLINE_INS_CNT_SHORT,ERR_SPLINE_IMAGE_NULL,ERR_SPLINE_IMAGE_NULL_02
+,ERR_SPLINE_IMAGE_NULL_03,SPLINE_INS_SUCESS};
+
+#define MAX_SPLINE_DEFECT_COUNT		1000
+
+class CSplinePoint
+{
+public:
+	CSplinePoint()		{ Reset(); }	
+	void Reset()
+	{
+		origin = rotate = CPoint(0,0);		
+		dThick = dTheta = 0.;
+		bFind = FALSE;
+	}
+
+	CPoint	origin;
+	CPoint	rotate;
+	double	dThick;
+	double	dTheta;
+	BOOL	bFind;
+};
+
+class CImagePoint
+{
+public:
+	CImagePoint()		{ Reset(); }	
+	void Reset()
+	{
+		imgPos = originPos = CPoint(0,0);	
+		dTheta = 0.;
+		nInsWidth = 0;
+	}
+
+	CPoint	imgPos;
+	CPoint	originPos;
+	double	dTheta;
+	int		nInsWidth;
+};
+
+class CResultDefect
+{
+public:
+	CResultDefect()		{ Reset(); }	
+	void Reset()
+	{
+		dThick = 0.;
+		rectDefect = CRect(0,0,0,0);
+	}
+
+	CRect		rectDefect;
+	double		dThick;
+};
+
+class CDetectPoint
+{
+public:
+	CDetectPoint()		{ Reset(); }	
+	void Reset()
+	{
+		orgX = orgY = 0.;
+		imgX = imgY = 0.;
+		dTheta = dDist = 0.;
+		bFind = FALSE;
+	}
+
+	double	orgX,orgY;
+	double	imgX,imgY;
+	double	dTheta;
+	double	dDist;
+	BOOL    bFind;
+};
+
+struct SortOrginYPos : public std::binary_function<pair<int,CSplinePoint>, pair<int,CSplinePoint>, bool>
+{
+	bool operator()(const pair<int,CSplinePoint> & lhs, const pair<int,CSplinePoint> & rhs)
+	{
+		return lhs.second.origin.y > rhs.second.origin.y;
+	}
+};
+
+enum SPLINECHIP_INS_METHOD{METHOD_INS_LINE=0,METHOD_INT_ROUND};
+enum MAKE_IMAGE_METHOD{MAKE_METHOD_LINEAR=0,MAKE_METHOD_REGRESSION,MAKE_METHOD_NONE};
+enum SPLINE_INS_DIR{SPLINE_INS_DIRECTION_X=0,SPLINE_INS_DIRECTION_Y,SPLINE_INS_DIRECTION_NONE};
+
+typedef struct  _CHIP_INS_REGION
+{
+public:
+	_CHIP_INS_REGION()		{ Reset(); }	
+	void Reset()
+	{
+		bUse = FALSE;
+		nStartX = nEndX = nThres = nFindThres = nSkipDist = nInsRange = 0;
+		emMethod = MAKE_METHOD_NONE;
+		emDir = SPLINE_INS_DIRECTION_NONE;
+		nCornerYSize = -1;
+	}
+
+	BOOL		bUse;
+	int			nStartX;
+	int			nEndX;
+	int			nCornerYSize;
+	int			nThres;
+	int			nFindThres;
+	int			nSkipDist;
+	int			nInsRange;
+	MAKE_IMAGE_METHOD emMethod;
+	SPLINE_INS_DIR	emDir;
+}CHIP_INS_REGION;
+
+#define		SPLINE_RESULT_DATA_CNT  2
+#define		SPLINE_RANGE_RESULT_CNT 5
+
+class AFX_EXT_CLASS CSplineModel
+{
+public:
+	CSplineModel(void);		
+	virtual ~CSplineModel(void);
+
+public:
+	BOOL		CopyModelData(CSplineModel *pSpline);
+	BOOL		WriteModelData(CString strFile,CString strRecipe,CString strCut,std::multimap<int, CSplinePoint> *pPoint,CPoint pointOffset);
+	BOOL		WriteCSVData(CString strFile,CPoint *pPoint,int nCnt,CPoint pointOffset);
+	BOOL		ReadModelData(CString strFile,CString strRecipe);
+	BOOL		IsLoadMasterImg(){return m_bLoadMasterImg;}
+	CString		GetLoadModelRecipe(){return m_strLoadModel;}
+	CSize		GetMasterDataSize(){return CSize(m_pointMasterMax.x,m_pointMasterMax.y);}
+	std::multimap<int, CPoint> *GetMasterData(){return &m_mapMasterPos;}
+	CPoint		GetptMasterMax(){return m_pointMasterMax;}
+	CPoint		GetptMasterMin(){return m_pointMasterMin;}
+	void		ClearModelData();
+
+protected:
+	BOOL		AdjustTilt(std::multimap<int, CSplinePoint> *pPos);
+	double		GetTilt(std::multimap<int, CSplinePoint> *pPos,double &dCenX,double &dCenY);	
+
+protected:
+	BOOL		m_bLoadMasterImg;
+	CString		m_strLoadModel;
+	CPoint		m_pointMasterMax,m_pointMasterMin;	
+	std::multimap<int, CPoint> m_mapMasterPos;	
+};
+
+class CSISBuffer;
+class AFX_EXT_CLASS CSplineInspect
+{
+public:
+	CSplineInspect(void);	
+	CSplineInspect(CSISBuffer *lpBuffer);
+	virtual ~CSplineInspect(void);
+
+public:
+	SPLINE_ERR_MSG	InspectSpline(CSISBuffer &pImg,CRect &rectCrop,int nDetDist,int nThres,BOOL bFlip,BOOL bSaveImg,BOOL bSaveDebug);
+	double			InspectSplineChip(CSISBuffer pImg,int nPosLeft,CHIP_INS_REGION &insRegion,double dRes,int nJudgeThick,COwnerBuffer &pRes
+		,BOOL bFlip,int iReg,BOOL bSaveDebug,SPLINECHIP_INS_METHOD enOpt=METHOD_INT_ROUND);
+
+	// 荐沥 滚傈
+	double			InspectSplineChip_New(CSISBuffer pImg,int nPosLeft,CHIP_INS_REGION &insRegion,double dRes,int nJudgeThick
+		,BOOL bFlip,int iReg,BOOL bSaveDebug,SPLINECHIP_INS_METHOD enOpt=METHOD_INT_ROUND);
+	int			InspectChipBin_New(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns);
+	BOOL		Blob_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, std::vector<CChipBlob>* vecBlobList, ChipResionType s_RegionType,DefectPosType s_DefectPos, int nMinSize, int nSideFilter, BOOL bROIOffset=TRUE);
+	int			FilteringDefect_New(CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns,double dRes,int nJudge,CRect &insRect,BOOL bFlip);
+
+public:	
+	CChipBlob	*GetResultDefect(){return m_ResultDefect;}
+	int			GetResultDefectCount(){return m_nDefectCount;}
+	double		*GetResultData(){return m_dResultData;}	
+	double		*GetRangeData(){return m_dRangeResult;}
+	CSISBuffer	*GetSplineOrgImg(){return (CSISBuffer*)&m_insSplineOrg;}
+	CSISBuffer	*GetSplineResImg(){return (CSISBuffer*)&m_insSplineRes;}
+
+	BOOL		FindCADLine();
+	BOOL		LabelingProcess();
+	BOOL		LabelingCounting();
+	BOOL		LabelFiltering(int nFilterCnt);
+	int			GetRectInLabelMaxIndex(CRect &rect);
+	BOOL		GetLabelPosition(int nIdx);
+	std::multimap<int, CSplinePoint>	*GetSplinePos(){return &m_mapSplinePos;}
+	CPoint		GetSplineOffset(){return CPoint(m_nSplineOffsetX,m_nSplineOffsetY);}
+	BOOL		CheckBuffer();
+	BOOL		CheckRange(int x,int y,CSISBuffer *buffer);	
+	void		ContourTracing(int cy, int cx, int labelindex, int tracingdirection);
+	BOOL		CheckRectToBuffer(CRect &rect);
+	BOOL		Tracer(int *cy, int *cx, int *tracingdirection);
+	void		ReleaseBuffer();
+	BOOL		SetImage(CSISBuffer *lpBuffer);
+	void		SetMasterModelData(CSplineModel *pMaster){m_pSpModel=pMaster;}
+
+protected:
+	void		ReleaseBlob();
+	void		ResetValue();	
+	BOOL		FindForeLine(CSISBuffer &pBuffer,int *nForeLine,double &dTheta);
+	BOOL		ShiftNRotateImage(CSISBuffer pOrg,CSISBuffer pBin,COwnerBuffer &pProcess,COwnerBuffer &pProcImg,int *nForeLine,double dTheta,CPoint &pPosImg);
+	BOOL		DistInspection(CEdgeProc &EdgeProc,CSISBuffer &pTgt,double *dResult,double *dRangeRes);
+	int			GetSplineValue(CEdgeProc &glassFind,CSISBuffer pOrg,double dXPos,double dYPos);	
+	void		MakeSplineResultImage(COwnerBuffer &pRes,CSISBuffer &pProcess);
+	BOOL		AdjustTilt(std::multimap<int, CSplinePoint> *pPos);
+	double		GetTilt(std::multimap<int, CSplinePoint> *pPos,double &dCenX,double &dCenY);	
+
+protected:
+	BOOL		CopyRectImg(LPBYTE pOrg,LPBYTE pTgt,CSize szImg,CRect &rectIns);
+	BOOL		MakeCADLine(CHIP_INS_REGION & insRegion,std::multimap<int, CPoint> &mapData,CPoint &pointMin,CPoint &pointMax,SPLINECHIP_INS_METHOD enOpt=METHOD_INT_ROUND);
+	double		GetCAD2ImgOffset(std::multimap<int, CPoint> &mapData,CSISBuffer pBin,CPoint pointMin,CPoint pointMax,int nGap=30);
+	void		MakeInspectResultImage(CSISBuffer &pRes,std::multimap<int, CSplinePoint> &mapIns);
+	void		MakeInspectResultImage(CSISBuffer &pRes,std::multimap<int, CPoint> &mapIns);
+	void		MakeSplineDebugImg(COwnerBuffer &pRes,std::multimap<int, CPoint> *pMaster,std::multimap<int, CSplinePoint> *pData);	
+	BOOL		MakeInspectLine(std::multimap<int, CPoint> &mapData,std::multimap<int, CSplinePoint> &mapIns,double dYPos,SPLINECHIP_INS_METHOD enOpt=METHOD_INT_ROUND);	
+	double		InspectChip(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns);
+	int			InspectChipBin(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns);
+	int			InspectChipBin_Diagonal(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns);
+
+	int			FilteringDefect(CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns,double dRes,int nJudge,CRect &insRect,BOOL bFlip);
+	double		FindThick(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CPoint pointSet,CPoint &pointRotate,double dTheta,int nDetThres);
+	int			AnalysisThick(CEdgeProc &EdgeProc,CRect rectImg,double dRes,int nJudgeThick,double dAvgThick,BOOL bFlip,std::multimap<int, CSplinePoint> &mapIns);	
+
+public:		
+	double		m_dImageTheta;
+	CPoint		m_pointPosLeft;
+	CPoint		m_pointDiffImg;	
+	CSplineModel	*m_pSpModel;
+	std::multimap<int, CSplinePoint> m_mapSplinePos;
+	CChipBlob	m_ResultDefect[MAX_SPLINE_DEFECT_COUNT];
+	double		m_dRangeResult[SPLINE_RANGE_RESULT_CNT];
+	int			m_nDefectCount;
+	CSize			m_szImageOrg;
+	double		m_dResultData[SPLINE_RESULT_DATA_CNT];	
+	COwnerBuffer	m_insSplineOrg,m_insSplineRes;
+	CChamferInspect		m_ChamferIns;
+	
+	int				m_nSplineOffsetX;
+	int				m_nSplineOffsetY;
+	int				m_nCCCount;
+	CSISBuffer		*m_lpBuffer;	
+	int				**m_pLabelMap;
+	int				m_nMaxContourIdx;
+	int				m_nMaxContourCount;
+	int				**m_pContourMap;
+	int				*m_pContourCnt;
+};
diff --git a/Common_Class/EdgeInspect/Library/FreeImage.lib b/Common_Class/EdgeInspect/Library/FreeImage.lib
new file mode 100644
index 0000000..6755193
--- /dev/null
+++ b/Common_Class/EdgeInspect/Library/FreeImage.lib
Binary files differ
diff --git a/Common_Class/EdgeInspect/Library/ImageHandlerM.lib b/Common_Class/EdgeInspect/Library/ImageHandlerM.lib
new file mode 100644
index 0000000..5f86d03
--- /dev/null
+++ b/Common_Class/EdgeInspect/Library/ImageHandlerM.lib
Binary files differ
diff --git a/Common_Class/EdgeInspect/MosisProfiles.txt b/Common_Class/EdgeInspect/MosisProfiles.txt
new file mode 100644
index 0000000..8f68aac
--- /dev/null
+++ b/Common_Class/EdgeInspect/MosisProfiles.txt
@@ -0,0 +1,41 @@
+[DEFECT]
+MAX_DEFECT0=10000
+FILEPATH0=C:/DIT/Images/image.bmp
+ZONEPATH0=C:/八荤汲厚/ZoneData/320WL1RGB_R0
+[CONVMODE]
+DPC0=1
+ECHO0=1
+FLOAT0=1
+DPCDEBUG0=0
+ZONE0=0
+ZONEREVERSE0=0
+HORIZONTAL0=1
+CPC0=0
+[zone]
+THchange0=-5
+THchangemin0=15
+[INSPECT]
+THRESHOLD0=30
+SUPPRESS0=255
+CONV_WIDTH0=3
+CONV_HEIGHT0=2
+THREADCOUNT0=4
+FRAMETHREAD0=10
+[PITCH]
+CONV_PITCH0=75.100000
+CONV_CYCLE0=2
+SCAN_PITCH0=75.100000
+SCAN_CYCLE0=1
+[RECT]
+LEFT0=0
+TOP0=0
+RIGHT0=1500
+BOTTOM0=1024
+[DPC]
+INTERVAL0=16
+WIDTH0=128
+HEIGHT0=128
+SUPPRESS0=3
+[FILTER]
+ECHO0=1
+REVERSE0=1
diff --git a/Common_Class/EdgeInspect/NotchCut.cpp b/Common_Class/EdgeInspect/NotchCut.cpp
new file mode 100644
index 0000000..794c137
--- /dev/null
+++ b/Common_Class/EdgeInspect/NotchCut.cpp
@@ -0,0 +1,3196 @@
+#include "StdAfx.h"
+#include "NotchCut.h"
+#include "SISMatch.h"
+#include <math.h>
+#include <algorithm>
+#include "EdgeFind.h"
+#include "EdgeProc.h"
+
+#define	M_PI					acos(-1.0)
+#define M_RADIAN(x)				(((M_PI)*(x))/180.0)
+//#define		SAVE_NOTCH_DEBUG_IMAGE
+
+#define DETECT_BROKEN_COUNT		5
+#define DETECT_WHITE_CONTI_COUNT 3
+#define DETECT_CHIP_MULTI_RATIO 1.1
+
+CNotchCut::CNotchCut(void)
+{
+	m_nDefectCount = 0;
+	m_strSavePath = "";
+	m_bSaveDebug = FALSE;
+}
+
+CNotchCut::~CNotchCut(void)
+{
+
+}
+
+void CNotchCut::Reset()
+{
+	m_InsParm.Reset();	
+	for(int i=0; i<MAX_NOTCH_SCAN_COUNT; i++)
+	{
+		m_MasterParm[i].Reset();
+		m_AlignMasterParm[i].Reset();
+	}
+	m_ObjectInfo.Reset();
+	ResetData();
+}
+
+BOOL CNotchCut::CopyModelData(CNotchCut *pNotch)
+{
+	if(pNotch == NULL)
+		return FALSE;
+
+	int		iDim;
+	std::multimap<int, CPoint>::iterator	it;
+	CPoint	pointData,pointMove;
+
+	for (iDim=0; iDim<MAX_NOTCH_SCAN_COUNT; iDim++)
+	{
+		m_mapOrgMaster[iDim].clear();
+		m_mapAlignMaster[iDim].clear();
+
+		for(it=pNotch->m_mapOrgMaster[iDim].begin();it!=pNotch->m_mapOrgMaster[iDim].end();it++)
+		{
+			pointData = static_cast<CPoint>(it->second);
+			m_mapOrgMaster[iDim].insert(std::make_pair(pointData.y, pointData));
+		}
+		
+		if(pNotch->m_MasterParm[iDim].imgBuf.IsValidBuffer() == TRUE && pNotch->m_MasterParm[iDim].bLoad == TRUE)
+		{
+			m_MasterParm[iDim].imgBuf.SetSize(pNotch->m_MasterParm[iDim].imgBuf.GetDataWidth(),pNotch->m_MasterParm[iDim].imgBuf.GetHeight());
+			CopyMemory(m_MasterParm[iDim].imgBuf.GetDataAddress(),pNotch->m_MasterParm[iDim].imgBuf.GetDataAddress(),sizeof(BYTE)*pNotch->m_MasterParm[iDim].imgBuf.GetDataSize());
+
+			m_MasterParm[iDim].bLoad = pNotch->m_MasterParm[iDim].bLoad;
+			m_MasterParm[iDim].nPosX = pNotch->m_MasterParm[iDim].nPosX;
+			m_MasterParm[iDim].nPosY = pNotch->m_MasterParm[iDim].nPosY;			
+		}
+	}
+
+	return TRUE;
+}
+
+BOOL CNotchCut::AdjustTilt(int index,double dTheta,double baseCenY)
+{	
+	if(index < 0 || index >= MAX_NOTCH_SCAN_COUNT || (int)m_mapOrgMaster[index].size() <= 0 || (int)m_mapOrgMaster_InsPos[index].size() <= 0)//20140528
+		return FALSE;
+
+	m_mapAlignMaster[index].clear();
+	m_mapAlignMaster_InsPos[index].clear();//20140528
+
+	int		nStartY = (int)((double)baseCenY/m_InsParm.dCamRes-(double)(m_MasterParm[index].nPosY));
+	std::multimap<int, CPoint>::iterator	it;
+	CPoint	pointData,pointMove,pointMax;	
+		
+	pointMax = CPoint(0,0);
+	for(it=m_mapOrgMaster[index].begin();it!=m_mapOrgMaster[index].end();it++)
+	{
+		pointData = static_cast<CPoint>(it->second);
+
+		pointMove.x = static_cast<int>(static_cast<double>(pointData.x-m_MasterParm[index].nPosX) * cos(dTheta) - static_cast<double>(pointData.y+nStartY) * sin(dTheta));
+		pointMove.y = static_cast<int>(static_cast<double>(pointData.y+nStartY) * cos(dTheta) + static_cast<double>(pointData.x-m_MasterParm[index].nPosX) * sin(dTheta));
+
+		pointMove.Offset(m_MasterParm[index].nPosX,-nStartY);
+		m_mapAlignMaster[index].insert(std::make_pair(pointMove.y, pointMove));
+
+		if(pointMax.x < pointMove.x)
+			pointMax.x = pointMove.x;
+		if(pointMax.y < pointMove.y)
+			pointMax.y = pointMove.y;
+	}
+
+	for(it=m_mapOrgMaster_InsPos[index].begin();it!=m_mapOrgMaster_InsPos[index].end();it++)//20140528
+	{
+		pointData = static_cast<CPoint>(it->second);
+
+		pointMove.x = static_cast<int>(static_cast<double>(pointData.x-m_MasterParm[index].nPosX) * cos(dTheta) - static_cast<double>(pointData.y+nStartY) * sin(dTheta));
+		pointMove.y = static_cast<int>(static_cast<double>(pointData.y+nStartY) * cos(dTheta) + static_cast<double>(pointData.x-m_MasterParm[index].nPosX) * sin(dTheta));
+
+		pointMove.Offset(m_MasterParm[index].nPosX,-nStartY);
+		m_mapAlignMaster_InsPos[index].insert(std::make_pair(pointMove.y, pointMove));
+	}
+
+	if(m_bSaveDebug == TRUE)
+	{
+		COwnerBuffer		imgBuf(pointMax.x*2,pointMax.y*2);
+		ZeroMemory(imgBuf.GetDataAddress(),sizeof(BYTE)*imgBuf.GetDataSize());
+		for(it=m_mapAlignMaster[index].begin();it!=m_mapAlignMaster[index].end();it++)
+		{
+			pointData = static_cast<CPoint>(it->second);
+			if(pointData.x < 0 || pointData.y < 0 || pointData.x >= imgBuf.GetWidth() || pointData.y >= imgBuf.GetHeight())
+				continue;
+
+			imgBuf.SetPixel(pointData.x,pointData.y,255);
+		}
+
+		for(it=m_mapAlignMaster_InsPos[index].begin();it!=m_mapAlignMaster_InsPos[index].end();it++)//20140528
+		{
+			pointData = static_cast<CPoint>(it->second);
+			if(pointData.x < 0 || pointData.y < 0 || pointData.x >= imgBuf.GetWidth() || pointData.y >= imgBuf.GetHeight())
+				continue;
+
+			imgBuf.SetPixel(pointData.x,pointData.y,128);
+		}
+
+		{
+			CString		str;
+			str.Format(_T("D:\\Image\\TiltAlign.bmp"),m_strSavePath);//20140528
+			CBufferAttach	attach(str);
+			attach.AttachToFile(imgBuf);
+		}
+	}
+
+	m_AlignMasterParm[index].nPosX = static_cast<int>(static_cast<double>(m_MasterParm[index].nPosX) * cos(dTheta) - static_cast<double>(m_MasterParm[index].nPosY+nStartY) * sin(dTheta));
+	m_AlignMasterParm[index].nMaxX = static_cast<int>(static_cast<double>(m_MasterParm[index].nMaxX) * cos(dTheta) - static_cast<double>(m_MasterParm[index].nPosY+nStartY) * sin(dTheta));
+	m_AlignMasterParm[index].nPosY = static_cast<int>(static_cast<double>(m_MasterParm[index].nPosY+nStartY) * cos(dTheta) + static_cast<double>(m_MasterParm[index].nPosX) * sin(dTheta));
+	m_AlignMasterParm[index].nPosY -= nStartY;
+	m_AlignMasterParm[index].nMaxY = m_AlignMasterParm[index].nPosY;		
+
+	return TRUE;
+}
+
+BOOL CNotchCut::LoadData(CString strFile)
+{
+	BOOL			bLoad = FALSE;
+	CString			str;
+	CSISImageBuffer	imgFile;
+
+	for (int i=0; i<MAX_NOTCH_SCAN_COUNT; i++)
+	{	
+		str.Format(_T("%s_[%d].notch"),strFile,i);
+		bLoad |= ReadModelData(str,i);
+
+		str.Format(_T("%s_[%d]_notch.bmp"),strFile,i);
+		if(imgFile.ReadFromFile(str) == TRUE)
+		{
+			m_MasterParm[i].bLoad = TRUE;
+			m_MasterParm[i].imgBuf.SetSize(imgFile.GetDataWidth(),imgFile.GetHeight());
+			CopyMemory(m_MasterParm[i].imgBuf.GetDataAddress(),imgFile.GetDataAddress(),sizeof(BYTE)*imgFile.GetDataSize());
+			imgFile.ReleaseImage();
+		}		
+		if(m_MasterParm[i].bLoad == TRUE)
+		{
+			FindCenterPos(m_MasterParm[i].imgBuf,m_MasterParm[i].nPosX,m_MasterParm[i].nPosY);
+		}
+	}
+
+	return bLoad;
+}
+
+void CNotchCut::FindRealPos(CSISBuffer &pOrg,CSISBuffer &pBin,int iLeftLine,int &nCenX,int &nCenY
+							,int *nStartX,int *nFisrtY,int *nLastY,int iCam,int iDem,int nSkipSize)
+{
+	if(pBin.IsValidBuffer() == FALSE || pOrg.IsValidBuffer() == FALSE)
+		return;
+
+#define DEFECT_EDGE_AUTO_RATIO 0.3
+#define DEFECT_EDGE_AUTO_PITCH 15
+#define DEFECT_EDGE_CONTINUE 3
+#define DETECT_EDGE_HEIGHT 10
+
+	CEdgeFind		EdgeFind;
+	CRect		rect;
+	int			nCalSize = 50;
+	const int	nSkipLeft = 40;
+	const int	nVMargin = 10;
+	int			nLeftLine[2],nMaxLeft;
+	int			iStartU = iLeftLine-nSkipLeft;
+
+	if(iStartU < 0)
+		iStartU = 0;
+
+
+	rect = CRect(iStartU,nVMargin,pBin.GetWidth(),nCalSize+nVMargin);//+nSkipSize眠啊
+	nLeftLine[0] = FindLeftLineReal(pBin,rect,0);//50俺狼 Left 蔼 乞闭(10~60)
+	
+	rect = CRect(iStartU,pBin.GetHeight()-nCalSize-nVMargin,pBin.GetWidth(),pBin.GetHeight()-nVMargin);//50俺狼 Left 蔼 乞闭(pImg.GetHeight()-60~pImg.GetHeight()-10)
+	nLeftLine[1] = FindLeftLineReal(pBin,rect,0);
+
+	nMaxLeft = max(nLeftLine[0],nLeftLine[1]);
+//	nCenX = min(nLeftLine[0],nLeftLine[1]);
+
+	rect = CRect(nMaxLeft+nSkipSize,0,pBin.GetWidth()-1,pBin.GetHeight());
+	FindRealAccumXY(pBin,rect,255,nStartX,nFisrtY,nLastY);	
+	nCenY = (int)FindRealAccumYPos(pBin,nSkipSize,255,nLeftLine);	
+	if(nCenY <= 0)
+		return;
+
+	rect = CRect(nMaxLeft+nSkipSize,nCenY-DETECT_EDGE_HEIGHT,pOrg.GetWidth()-1,nCenY+DETECT_EDGE_HEIGHT);
+	CCropBuffer		cropBuf(pOrg,rect);	
+
+	int nRelLeft = EdgeFind.Find_LeftEdge(&cropBuf,DEFECT_EDGE_AUTO_PITCH,m_InsParm.nEdgeThres,DEFECT_EDGE_AUTO_RATIO,DEFECT_EDGE_CONTINUE);
+	if(nRelLeft > 0)
+		nCenX = nRelLeft+rect.left;
+	
+	if(m_bSaveDebug == TRUE)
+	{	
+		CString		strImg;
+		strImg.Format(_T("%s\\[%d,%d]EdgeCrop_%d_%d_[%d,%d]_s[%d]_[%d,%d].bmp"),m_strSavePath,iCam,iDem,nMaxLeft+nSkipSize,nCenY,nRelLeft,nCenX,nSkipSize,nLeftLine[0],nLeftLine[1]);
+		CBufferAttach	attach(strImg);
+		attach.AttachToFile(cropBuf);
+	}
+
+	//MakeFoldImage(pBin,nCenY);
+}
+
+void CNotchCut::FindCenterPos(CSISBuffer &pImg,int &nPosX,int &nPosY,int nSkipSize)
+{
+	if(pImg.IsValidBuffer() == FALSE)
+		return;
+
+	CRect		rect;
+	int			nCalSize = 50;
+	const int	nSkipLeft = 40;
+	int			nLeftLine[2],nMaxLeft;
+
+	rect = CRect(0,nSkipSize,pImg.GetWidth(),nCalSize);
+	nLeftLine[0] = FindLeftLine(pImg,rect,255);
+
+	rect = CRect(0,pImg.GetHeight()-nCalSize-nSkipSize,pImg.GetWidth(),pImg.GetHeight()-nSkipSize);
+	nLeftLine[1] = FindLeftLine(pImg,rect,255);
+
+	nMaxLeft = max(nLeftLine[0],nLeftLine[1]);
+	nPosX = nLeftLine[0];
+
+	rect = CRect(nMaxLeft+nSkipLeft,0,pImg.GetWidth()-1,pImg.GetHeight());
+	nPosY = FindAccumYPos(pImg,rect,255);	
+
+	//	MakeFoldImage(pImg,nPosY);
+}
+
+void CNotchCut::MakeFoldImage(CSISBuffer &pImg,int nPosY)
+{
+	if(nPosY <= 0)
+		return;
+
+	COwnerBuffer		pFoldImg(pImg.GetWidth(),nPosY+1);
+	ZeroMemory(pFoldImg.GetDataAddress(0,0),pFoldImg.GetDataSize());
+
+	int			u,v,vPos;	
+
+	for(v=0;v<=nPosY;v++)
+	{
+		CopyMemory(pFoldImg.GetDataAddress(0,v),pImg.GetDataAddress(0,v),sizeof(BYTE)*pImg.GetWidth());
+	}
+
+	CRect		rect;
+
+	vPos = nPosY+1;
+	for(v=nPosY-1;v>=0;v--,vPos++)
+	{
+		if(pImg.GetHeight() <= vPos)
+			break;
+
+		for(u=0;u<pImg.GetWidth();u++)
+		{
+			if(*pImg.GetDataAddress(u,vPos) == 0 && *pImg.GetDataAddress(u,v) == 0)
+			{
+				pFoldImg.SetPixel(u,v,180);
+			}		
+			else if(*pImg.GetDataAddress(u,v) == 0 && *pImg.GetDataAddress(u,vPos) != 0)
+				pFoldImg.SetPixel(u,v,0);
+			else
+				pFoldImg.SetPixel(u,v,80);
+		}
+	}
+
+	CString		str;
+	str = "D:\\Image\\NotchCut\\FoldImg.bmp";
+	CBufferAttach	attach(str);
+	attach.AttachToFile(pFoldImg);
+
+}
+
+void CNotchCut::FindYPosPixel(CSISBuffer &pImg,CRect rect,std::vector<int> *vList,int nThres,int u,BOOL bDir)
+{
+	int			v;
+
+	vList->clear();
+	for(v=rect.top;v<rect.bottom;v++)
+	{
+		if(bDir == TRUE)
+		{
+			if(*pImg.GetDataAddress(u,v) >= nThres)
+			{
+				vList->push_back(v);
+			}
+		}
+		else
+		{
+			if(*pImg.GetDataAddress(u,v) <= nThres)
+			{
+				vList->push_back(v);
+			}
+		}
+	}
+}
+
+void CNotchCut::FindYPosMerge(std::vector<int> *vList,std::vector<NOTCH_Merge_STU> *vMergeList)
+{
+	NOTCH_Merge_STU	stuMerge,stuMax;
+	std::vector<int>::iterator it;
+
+	vMergeList->clear();
+	stuMerge.Reset();
+	stuMax.Reset();
+	for(it=vList->begin();it!=vList->end();it++)
+	{
+		if(stuMerge.nStart == -1)
+			stuMerge.nStart = *it;
+		else
+		{				
+			if(stuMerge.nEnd == -1)
+			{
+				if(abs(stuMerge.nStart - *it) > 1)
+				{
+					stuMerge.nEnd = *it;					
+					stuMerge.nSize = abs(stuMerge.nEnd-stuMerge.nStart)+1;
+
+					if(stuMax.nSize < stuMerge.nSize)
+						stuMax = stuMerge;
+
+					stuMerge.Reset();					
+				}
+				else
+					stuMerge.nStart = *it;
+			}
+		}
+	}
+
+	vMergeList->push_back(stuMax);
+}
+
+void CNotchCut::FindRealYPosMerge(std::vector<int> *vList,std::vector<NOTCH_Merge_STU> *vMergeList)
+{
+	NOTCH_Merge_STU	stuMerge;
+	std::vector<int>::iterator it;
+
+	vMergeList->clear();
+	stuMerge.Reset();
+	for(it=vList->begin();it!=vList->end();it++)
+	{
+		if(stuMerge.nStart == -1)
+			stuMerge.nStart = *it;
+		else
+		{				
+			if(stuMerge.nEnd == -1)
+			{
+				if(abs(stuMerge.nStart - *it) > 1)
+				{
+					stuMerge.nEnd = stuMerge.nStart;
+					stuMerge.nSize = abs(stuMerge.nEnd-stuMerge.nStart)+1;
+					vMergeList->push_back(stuMerge);
+					stuMerge.Reset();
+					stuMerge.nStart = *it;
+				}
+				else
+					stuMerge.nEnd = *it;
+			}
+			else
+			{
+				if(abs(stuMerge.nEnd-*it) > 1)
+				{
+					stuMerge.nSize = abs(stuMerge.nEnd-stuMerge.nStart)+1;
+					vMergeList->push_back(stuMerge);
+					stuMerge.Reset();
+					stuMerge.nStart = *it;
+				}
+				else
+					stuMerge.nEnd = *it;
+			}
+		}
+	}
+
+	if(stuMerge.nStart != -1 && stuMerge.nEnd == -1)
+	{
+		stuMerge.nEnd = stuMerge.nStart;
+		stuMerge.nSize = abs(stuMerge.nEnd-stuMerge.nStart)+1;
+		vMergeList->push_back(stuMerge);
+	}
+	else if(stuMerge.nStart != -1 && stuMerge.nEnd != -1 )//&& (int)vMergeList->size() <= 0)//20140528
+	{
+		stuMerge.nSize = abs(stuMerge.nEnd-stuMerge.nStart)+1;
+		vMergeList->push_back(stuMerge);
+	}
+}
+
+/*
+double CNotchCut::FindRealAccumYPos(CSISBuffer &pImg,CRect rect,int nThres,int *nStartX,int *nFirstY,int *nLastY)
+{
+	int			u;
+	int			nYpos = 0,nCount = 0;
+	const	int nDetCnt = 20;
+	int			nNoDetCnt;	
+	const int	nBreakCnt = 2;		
+
+	std::vector<int> vList;		
+	NOTCH_Merge_STU		stuMerge,stuMax;
+	std::vector<NOTCH_Merge_STU> vMergeList;
+	std::vector<NOTCH_Merge_STU>::iterator it;
+
+	NOTCH_Circle_STU			*pPosList=NULL; 
+	int						iIndex = 0;
+	int						nVLineCnt = 0;
+
+	*nStartX = *nFirstY = *nLastY = 0;	
+	nNoDetCnt = 0;	
+
+	nVLineCnt = rect.Width()+1;
+	pPosList = new NOTCH_Circle_STU[nVLineCnt];
+	ZeroMemory(pPosList,sizeof(NOTCH_Circle_STU)*nVLineCnt);
+
+	for(u=rect.left;u<rect.right;u++)
+	{			
+		//FindYPosPixel(pImg,rect,&vList,nThres,u,FALSE);//捞柳拳等 康惑俊辑 灌扁啊 0牢 何盒狼 Y谅钎甫 茫绰促
+		FindYPosPixel(pImg,rect,&vList,nThres,u);
+
+		FindRealYPosMerge(&vList,&vMergeList);		
+
+		if((int)vMergeList.size() <= 0)
+		{
+			nNoDetCnt++;
+			if(nNoDetCnt >= nBreakCnt)
+				break;
+		}
+		else
+		{
+			stuMax.Reset();
+			for(it=vMergeList.begin();it!=vMergeList.end();it++)
+			{
+				stuMerge = *it;
+
+				if(stuMerge.nSize > stuMax.nSize)
+				{
+					stuMax = stuMerge;
+				}
+			}
+
+			if(stuMax.nSize <= 100)
+				continue;
+
+			pPosList[iIndex].pointF = PointD(u,stuMerge.nStart);
+			pPosList[iIndex].pointS = PointD(u,stuMerge.nEnd);
+			iIndex++;
+
+			if(*nFirstY <= 0 && *nLastY <= 0)
+			{
+				*nStartX = u;
+				*nFirstY = stuMax.nStart;
+				*nLastY = stuMax.nEnd;
+			}
+		}
+	}
+
+	if(iIndex <= 10)
+	{
+		delete[] pPosList, pPosList=NULL;
+		return 0;
+	}
+
+	// 醚 6Point俊 措茄 盔狼 吝缴备窍扁
+	int			i;
+	NOTCH_Circle_STU	nCenterPos[3],nLRPos[3];
+	const int   nPointCnt = 6;
+	PointD		pointCenter[nPointCnt];
+
+
+	nCenterPos[0] = pPosList[iIndex-1];
+	nCenterPos[1] = pPosList[iIndex-2];
+	nCenterPos[2] = pPosList[iIndex-3];
+
+	nLRPos[0] = pPosList[0];
+	nLRPos[1] = pPosList[1];
+	nLRPos[2] = pPosList[2];
+	
+	PointD		S,M,E;
+	ZeroMemory(pointCenter,sizeof(PointD)*nPointCnt);
+
+	int			iLoop = 0;
+	for(i=0;i<3;i++)
+	{
+		S = nLRPos[0].pointF;
+		M = nCenterPos[0].pointF;
+		E = nLRPos[0].pointS;		
+		pointCenter[iLoop] = GetCenterPointFrom3Points(S,M,E);
+		TRACE("Center %d = %.3f,%.3f\n",iLoop,pointCenter[iLoop].X,pointCenter[iLoop].Y);
+		iLoop++;
+		
+		M = nCenterPos[0].pointS;
+		pointCenter[iLoop] = GetCenterPointFrom3Points(S,M,E);
+		TRACE("Center %d = %.3f,%.3f\n",iLoop,pointCenter[iLoop].X,pointCenter[iLoop].Y);
+		iLoop++;
+	}
+
+	double		dSum,dCount,dAvg,dStd;
+
+	dAvg = dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nPointCnt;iIndex++)
+	{		
+		dSum += pointCenter[iIndex].Y;
+		dCount++;
+	}
+
+	if(dCount > 0)
+		dAvg = dSum/dCount;	
+
+	dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nPointCnt;iIndex++)
+	{
+		dSum += pow((dAvg-pointCenter[iIndex].Y),2);	
+		dCount++;				
+	}
+
+	dStd = dCount>0?sqrt(dSum/dCount):0.;
+
+	dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nPointCnt;iIndex++)
+	{			
+		if(fabs(pointCenter[iIndex].Y-dAvg) > dStd)
+			continue;
+
+		dSum+=pointCenter[iIndex].Y;
+		dCount++;
+	}
+
+	if(dCount > 0)
+		dAvg = dSum/dCount;	
+	
+	delete[] pPosList, pPosList=NULL;
+
+	return dAvg;
+}
+*/
+
+PointD CNotchCut::GetCenterPointFrom3Points(const PointD& S, const PointD& M, const PointD& E)
+{
+	double ma = (M.Y - S.Y) / (M.X - S.X);
+	double mb = (E.Y - M.Y) / (E.X - M.X);
+
+	if (ma >= INT_MAX || ma <= INT_MIN)    
+		ma = 1000000000000;
+
+	if (mb >= INT_MAX || mb <= INT_MIN)    
+		mb = 1000000000000;
+
+	if (ma == 0)
+		ma = 0.000000000001;
+
+	if (mb == 0)
+		mb = 0.000000000001;
+
+	double centerX = (ma * mb * (S.Y - E.Y) + mb * (S.X + M.X) - ma * (M.X + E.X)) / (2 * (mb - ma));
+	double centerY = (-1 * (centerX - (S.X + M.X) / 2) / ma) + ((S.Y + M.Y) / 2);
+
+	return PointD(centerX, centerY);            
+}
+
+double CNotchCut::FindRealCenter(CSISBuffer &pImg,CRect rect,int nThres,int *nStartX,int *nFirstY,int *nLastY)
+{
+	int			u;
+	int			nYpos = 0,nCount = 0;
+	const	int nDetCnt = 20;
+	int			nNoDetCnt;	
+	const int	nBreakCnt = 2;		
+	double		*dVLine = NULL;
+	int			iIndex = 0,nVLineCnt;
+
+	std::vector<int> vList;		
+	NOTCH_Merge_STU		stuMerge,stuMax;
+	std::vector<NOTCH_Merge_STU> vMergeList;
+	std::vector<NOTCH_Merge_STU>::iterator it;
+
+	*nStartX = *nFirstY = *nLastY = 0;	
+	nNoDetCnt = 0;
+
+	nVLineCnt = rect.Width()+1;
+	dVLine = new double[nVLineCnt];
+	ZeroMemory(dVLine,sizeof(double)*nVLineCnt);
+
+	for(u=rect.left;u<rect.right;u++,iIndex++)
+	{			
+		//FindYPosPixel(pImg,rect,&vList,nThres,u,FALSE);//捞柳拳等 康惑俊辑 灌扁啊 0牢 何盒狼 Y谅钎甫 茫绰促
+		FindYPosPixel(pImg,rect,&vList,nThres,u);
+
+		FindRealYPosMerge(&vList,&vMergeList);		
+
+		if((int)vMergeList.size() <= 0)
+		{
+			nNoDetCnt++;
+			if(nNoDetCnt >= nBreakCnt)
+				break;
+		}
+		else
+		{
+			stuMax.Reset();
+			for(it=vMergeList.begin();it!=vMergeList.end();it++)
+			{
+				stuMerge = *it;
+
+				if(stuMerge.nSize > stuMax.nSize)
+				{
+					stuMax = stuMerge;
+				}
+			}
+
+			if(stuMax.nSize <= 50)
+				continue;
+
+			nYpos = nCount = 0;			
+			for(int i=stuMax.nStart;i<=stuMax.nEnd;i++)
+			{
+				nYpos += i;
+				nCount++;
+			}	
+
+			if(nCount > 0)
+			{
+				if(iIndex < nVLineCnt)
+				{
+					dVLine[iIndex] = (double)nYpos/(double)nCount;		
+					TRACE("VLine : index %d, VLine %.2f\n",iIndex,dVLine[iIndex]);
+				}
+			}
+
+			if(*nFirstY <= 0 && *nLastY <= 0)
+			{
+				*nStartX = u;
+				*nFirstY = stuMax.nStart;
+				*nLastY = stuMax.nEnd;
+			}
+		}
+	}
+
+	double		dSum,dCount,dAvg,dStd;
+
+	dAvg = dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nVLineCnt;iIndex++)
+	{
+		if(dVLine[iIndex] <= 0)
+			continue;
+		dSum += dVLine[iIndex];
+		dCount++;
+	}
+
+	if(dCount > 0)
+		dAvg = dSum/dCount;	
+
+	dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nVLineCnt;iIndex++)
+	{
+		if(dVLine[iIndex] <= 0)
+			continue;
+
+		dSum += pow((dAvg-dVLine[iIndex]),2);	
+		dCount++;				
+	}
+
+	dStd = dCount>0?sqrt(dSum/dCount):0.;
+
+	dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nVLineCnt;iIndex++)
+	{		
+		if(dVLine[iIndex] <= 0)
+			continue;
+
+		if(fabs(dVLine[iIndex]-dAvg) > dStd)
+			continue;
+
+		dSum+=dVLine[iIndex];
+		dCount++;
+	}
+
+	if(dCount > 0)
+		dAvg = dSum/dCount;
+
+	delete[] dVLine, dVLine=NULL;
+
+	return dAvg;
+}
+
+void CNotchCut::FindRealAccumXY(CSISBuffer &pImg,CRect rect,int nThres,int *nStartX,int *nFirstY,int *nLastY)
+{
+	int			u;
+	std::vector<int> vList;		
+	NOTCH_Merge_STU		stuMerge,stuMax;
+	std::vector<NOTCH_Merge_STU> vMergeList;
+	std::vector<NOTCH_Merge_STU>::iterator it;
+
+	*nStartX = *nFirstY = *nLastY = 0;	
+	
+	for(u=rect.left;u<rect.right;u++)
+	{			
+		//FindYPosPixel(pImg,rect,&vList,nThres,u,FALSE);//捞柳拳等 康惑俊辑 灌扁啊 0牢 何盒狼 Y谅钎甫 茫绰促
+		FindYPosPixel(pImg,rect,&vList,nThres,u);
+
+		FindRealYPosMerge(&vList,&vMergeList);		
+
+		if((int)vMergeList.size() <= 0)
+		{
+			continue;
+		}
+		else
+		{
+			stuMax.Reset();
+			for(it=vMergeList.begin();it!=vMergeList.end();it++)
+			{
+				stuMerge = *it;
+
+				if(stuMerge.nSize > stuMax.nSize)
+				{
+					stuMax = stuMerge;
+				}
+			}
+
+			if(stuMax.nSize <= 100)
+				continue;		
+			
+			*nStartX = u;
+			*nFirstY = stuMax.nStart;
+			*nLastY = stuMax.nEnd;
+			break;			
+		}
+	}	
+}
+
+double CNotchCut::FindRealAccumYPos(CSISBuffer &pImg,int nSkipSize,int nThres,int *iLeftLine)
+{
+	if(iLeftLine[0] <= 0 || iLeftLine[1] <= 0)
+		return 0.;
+
+	int			u;
+	int			nYpos = 0,nCount = 0;
+	const	int nDetCnt = 20;
+	int			nNoDetCnt;	
+	const int	nBreakCnt = 4;		
+	double		*dVLine = NULL;
+	int			iIndex = 0,nVLineCnt;
+	int			nMinLeft = min(iLeftLine[0],iLeftLine[1]);
+	int			nLoopCnt = 100;
+	int			iUp,iDw;
+	CRect		rect;
+	const int	nSIZE_FILTER= 50;
+
+	std::vector<int>	vUpList,vDwList;		
+	NOTCH_Merge_STU		stuMerge,stuUpMax,stuDwMax;
+	std::vector<NOTCH_Merge_STU> vUpMergeList,vDwMergeList;
+	std::vector<NOTCH_Merge_STU>::iterator it;
+	
+	nNoDetCnt = 0;
+	
+	nVLineCnt = nLoopCnt+1;
+	dVLine = new double[nVLineCnt];
+	ZeroMemory(dVLine,sizeof(double)*nVLineCnt);
+
+	iUp = iLeftLine[0]+nSkipSize;
+	iDw = iLeftLine[1]+nSkipSize;
+
+	rect = CRect(0,0,0,pImg.GetHeight());
+
+	for(u=0;u<nLoopCnt;u++,iIndex++,iUp++,iDw++)
+	{	
+		if(nNoDetCnt >= nBreakCnt)
+			break;
+
+		FindYPosPixel(pImg,rect,&vUpList,nThres,iUp);
+		FindRealYPosMerge(&vUpList,&vUpMergeList);		
+
+		if((int)vUpMergeList.size() <= 0)
+		{
+			nNoDetCnt++;
+				continue;
+		}
+
+		stuUpMax.Reset();
+		for(it=vUpMergeList.begin();it!=vUpMergeList.end();it++)
+		{
+			stuMerge = *it;
+			if(stuMerge.nSize > stuUpMax.nSize)	
+				stuUpMax = stuMerge;	
+		}
+		if(stuUpMax.nSize <= nSIZE_FILTER)
+			{
+			nNoDetCnt++;
+			continue;
+			}	
+
+		FindYPosPixel(pImg,rect,&vDwList,nThres,iDw);
+		FindRealYPosMerge(&vDwList,&vDwMergeList);		
+
+		if((int)vDwMergeList.size() <= 0)
+			{
+			nNoDetCnt++;
+			continue;
+		}	
+		
+		stuDwMax.Reset();
+		for(it=vDwMergeList.begin();it!=vDwMergeList.end();it++)
+				{
+			stuMerge = *it;
+			if(stuMerge.nSize > stuDwMax.nSize)	
+				stuDwMax = stuMerge;	
+				}
+		if(stuDwMax.nSize <= nSIZE_FILTER)
+		{
+			nNoDetCnt++;
+			continue;
+			}
+
+		if(stuUpMax.nStart >= stuDwMax.nEnd)
+			{
+			nNoDetCnt++;
+			continue;
+			}
+
+		nYpos = nCount = 0;
+		for(int i=stuUpMax.nStart;i<=stuDwMax.nEnd;i++)
+		{
+			nYpos += i;
+			nCount++;
+		}
+
+		if(nCount > 0)
+			dVLine[iIndex] = ((double)nYpos/(double)nCount)+1;
+		TRACE("VLine : index %d, VLine Up[%d],Dw[%d] %.2f\n",iIndex,iUp,iDw,dVLine[iIndex]);	
+	}
+
+	double		dSum,dCount,dAvg,dStd;
+
+	dAvg = dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nVLineCnt;iIndex++)
+	{
+		if(dVLine[iIndex] <= 0)
+			continue;
+		dSum += dVLine[iIndex];
+		dCount++;
+	}
+
+	if(dCount > 0)
+		dAvg = dSum/dCount;	
+
+	dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nVLineCnt;iIndex++)
+	{
+		if(dVLine[iIndex] <= 0)
+			continue;
+
+		dSum += pow((dAvg-dVLine[iIndex]),2);	
+		dCount++;				
+	}
+
+	dStd = dCount>0?sqrt(dSum/dCount):0.;
+
+	dSum = dCount = 0.;
+	for(iIndex=0;iIndex<nVLineCnt;iIndex++)
+	{		
+		if(dVLine[iIndex] <= 0)
+			continue;
+
+		if(fabs(dVLine[iIndex]-dAvg) > dStd)
+			continue;
+		
+		dSum+=dVLine[iIndex];
+		dCount++;
+	}
+
+	if(dCount > 0)
+		dAvg = (dSum/dCount)+0.5;
+
+	delete[] dVLine, dVLine=NULL;
+
+	return dAvg;
+}
+
+
+int CNotchCut::FindAccumYPos(CSISBuffer &pImg,CRect rect,int nThres)
+{
+	int			u;
+	int			nYpos = 0,nCount = 0;
+	int			nNoDetCnt;	
+	const int	nBreakCnt = 5;		
+
+	std::vector<int> vList;		
+	std::vector<NOTCH_Merge_STU> vMergeList;
+	NOTCH_Merge_STU		stuMerge,stuMax;
+	std::vector<NOTCH_Merge_STU>::iterator it;	
+
+	nNoDetCnt = 0;
+	for(u=rect.left;u<rect.right;u++)
+	{			
+		FindYPosPixel(pImg,rect,&vList,nThres,u);
+
+		FindYPosMerge(&vList,&vMergeList);		
+
+		if((int)vMergeList.size() <= 0)
+		{
+			nNoDetCnt++;
+			if(nNoDetCnt >= nBreakCnt)
+				break;
+		}
+		else
+		{
+			stuMax.Reset();
+			for(it=vMergeList.begin();it!=vMergeList.end();it++)
+			{
+				stuMerge = *it;
+
+				if(stuMerge.nSize > stuMax.nSize)
+				{
+					stuMax = stuMerge;
+				}
+			}
+
+			if(stuMax.nSize <= 0)
+				continue;
+
+			for(int i=stuMax.nStart;i<=stuMax.nEnd;i++)
+			{
+				nYpos += i;
+				nCount++;
+			}	
+		}
+	}
+
+	return nCount>0?nYpos/nCount:-1;
+}
+
+int	 CNotchCut::FindLeftLine(CSISBuffer &pImg,CRect rect,int nThres)
+{
+	int			u,v;
+	int			nLeft = 0,nCount = 0;
+
+	for(v=rect.top;v<rect.bottom;v++)
+	{
+		for(u=rect.left;u<rect.right;u++)
+		{
+			if(*pImg.GetDataAddress(u,v) >= nThres)
+			{
+				nLeft += u;
+				nCount++;
+				break;
+			}
+		}
+	}
+
+	return nCount>0?nLeft/nCount:-1;
+}
+
+int	 CNotchCut::FindLeftLineReal(CSISBuffer &pImg,CRect rect,int nThres)
+{
+	int			u,v;
+	int			nLeft = 0,nCount = 0;
+
+	for(v=rect.top;v<rect.bottom;v++)
+	{
+		for(u=rect.left;u<rect.right;u++)
+		{
+			if(*pImg.GetDataAddress(u,v) <= nThres)
+			{
+				nLeft += u;
+				nCount++;
+				break;
+			}
+		}
+	}
+
+	return nCount>0?nLeft/nCount:-1;
+}
+
+void CNotchCut::SetParm(NOTCH_Parm_STU &parm)
+{
+	m_InsParm = parm;
+}
+
+void CNotchCut::AssertRect(CRect &rect,CSISBuffer pOrg)
+{
+	if(rect.left < 0) rect.left = 0;
+	if(rect.top < 0) rect.top = 0;
+	if(rect.right < 0) rect.right = 0;
+	if(rect.bottom < 0) rect.bottom = 0;
+
+	if(rect.left > rect.right) std::swap(rect.left,rect.right);
+	if(rect.top > rect.bottom) std::swap(rect.top,rect.bottom);
+}
+
+void CNotchCut::ResetData()
+{
+	m_mapMaster.clear();
+	m_mapMaster_InsPos.clear();//20140528
+	m_mapChipData.clear();
+	m_nDefectCount = 0;
+	m_bSaveDebug = FALSE;
+	m_nNoDetCount = m_nTotalCount = 0;
+}
+
+int CNotchCut::NotchExecute(CSISBuffer &pOrg,double *dResult,double *dResult_Dy,pNOTCH_RangePos_STU pRangeRes,pNOTCH_RangePos_STU pRangeRes_Dy,pNOTCH_RangePos_STU pRangeRes_Cham, int nRangeCnt,COwnerBuffer &pRes,COwnerBuffer &pRes_Dy, COwnerBuffer &pRes_Cham, double *dAvgThick, int iDimension
+							, double *dFeedbackXY, int icam,double *dGlassXY,double dAlign2GlassX,int iLeftLine,BOOL bSaveDebug,CString strSavePath, double dTheta)//20140528
+{
+	ResetData();
+
+	m_bSaveDebug = bSaveDebug;
+	ZeroMemory(pRangeRes,sizeof(NOTCH_RangePos_STU)*nRangeCnt);
+	ZeroMemory(pRangeRes_Dy,sizeof(NOTCH_RangePos_STU)*nRangeCnt);
+	ZeroMemory(pRangeRes_Cham,sizeof(NOTCH_RangePos_STU)*nRangeCnt);//20140528
+	ZeroMemory(dResult,sizeof(double)*2);
+	ZeroMemory(dResult_Dy,sizeof(double)*2);
+	ZeroMemory(dFeedbackXY,sizeof(double)*2);
+	ZeroMemory(dGlassXY,sizeof(double)*2);
+	*dAvgThick = 0.;
+
+
+	if(m_InsParm.bChipIns == FALSE && m_InsParm.bSizeIns == FALSE)
+		return NORMAL_EXE;
+
+	if(pOrg.IsValidBuffer() == FALSE)
+		return ERR_NO_ORGIMG;
+
+	int			nErrCode = NORMAL_EXE;	
+	CRect		rectOrg;
+
+	if(m_bSaveDebug == TRUE)
+	{
+		m_strSavePath.Format(_T("%s\\NotchCut"),strSavePath);
+		CString		str;	
+		CreateDirectory(m_strSavePath,NULL);
+		str.Format(_T("%s\\1.Notch_Org_%d_%d.bmp"),m_strSavePath,icam,iDimension);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(pOrg);
+	}
+
+	
+	CRect			rectEdge;	
+	CEdgeProc		EdgeProc;
+//	CEdgeFind		EdgeFind;
+
+// #define DEFECT_EDGE_AUTO_RATIO 0.3
+// #define DEFECT_EDGE_AUTO_PITCH 15
+// #define DEFECT_EDGE_CONTINUE 3
+// 	rectEdge = CRect(0,0,pOrg.GetWidth(),100);
+// 	CSISBuffer	EdgeBuf(pOrg.GetDataAddress(),pOrg.GetDataWidth(),100);
+// 	//m_ObjectInfo.nEdgeTop = (int)EdgeFind.FindGlassHorizontalLine(pOrg.GetDataAddress(0,0),CSize(pOrg.GetDataWidth(),pOrg.GetHeight()),rectEdge,m_InsParm.nEdgeThres,TRUE);
+// 	m_ObjectInfo.nEdgeTop = EdgeFind.Find_LeftEdge(&EdgeBuf,DEFECT_EDGE_AUTO_PITCH,m_InsParm.nEdgeThres,DEFECT_EDGE_AUTO_RATIO,DEFECT_EDGE_CONTINUE);
+
+	//	rectEdge = CRect(0,pOrg.GetHeight()-100,pOrg.GetWidth(),pOrg.GetHeight());
+	//	m_ObjectInfo.nEdgeBot = (int)m_EdgeFind.FindGlassHorizontalLine(pOrg.GetDataAddress(0,0),CSize(pOrg.GetDataWidth(),pOrg.GetHeight()),rectEdge,m_InsParm.nEdgeThres,TRUE);
+
+	COwnerBuffer		pBinImg(pOrg.GetWidth(),pOrg.GetHeight());	
+	ZeroMemory(pBinImg.GetDataAddress(0,0),pBinImg.GetDataSize());
+
+	rectEdge = CRect(10,pOrg.GetHeight()/2-20,52,pOrg.GetHeight()/2+20);
+	CChamferInspect		ChamferIns;
+
+	int		nBlankThres = (int)(ChamferIns.GetAreaAVG(pOrg.GetDataAddress(),CRect(0,0,pOrg.GetDataWidth(),pOrg.GetHeight()),rectEdge));
+
+	m_InsParm.nDetThres = (int)((double)nBlankThres * 1.4);
+
+	if(m_InsParm.dBlank2EdgeRatio <= 0)
+		m_InsParm.dBlank2EdgeRatio = 0.8;
+	m_InsParm.nSizeThres = (int)((double)nBlankThres * m_InsParm.dBlank2EdgeRatio);
+	//	EdgeFind.Adaptive_Binarization(pOrg.GetDataAddress(0,0),pOrg.GetWidth(),pOrg.GetHeight(),pOrg.GetDataWidth(),20,0.2,pBinImg.GetDataAddress(0,0),rectEdge);
+
+	rectEdge = CRect(0,0,pOrg.GetDataWidth(),pOrg.GetHeight());
+	CSISBuffer::CopyBtoA(pBinImg,0,0,pOrg,rectEdge);
+	EdgeProc.ThresholdProcessing(pBinImg.GetDataAddress(0,0),CSize(pBinImg.GetDataWidth(),pBinImg.GetHeight()),m_InsParm.nDetThres,0);
+
+	if(m_bSaveDebug == TRUE)
+	{
+		CString		str;	
+		str.Format(_T("%s\\2.Notch_Bin_%d_%d_[%d].bmp"),m_strSavePath,icam,iDimension,m_InsParm.nDetThres);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(pBinImg);
+	}
+
+	COwnerBuffer		pBin(pOrg.GetWidth(),pOrg.GetHeight());
+
+	CopyMemory(pBin.GetDataAddress(0,0),pOrg.GetDataAddress(0,0),pOrg.GetDataSize());
+	EdgeProc.ThresholdProcessing(pBin.GetDataAddress(0,0),CSize(pBin.GetDataWidth(),pBin.GetHeight()),m_InsParm.nSizeThres,0);
+
+	if(m_bSaveDebug == TRUE)
+	{
+		CString		str;	
+		str.Format(_T("%s\\3.Notch_Ins_Bin_%d_%d.bmp"),m_strSavePath,icam,iDimension);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(pBin);
+	}	
+
+	int			nCenX,nCenY;
+	int			nStartX,nFirstY,nLastY;
+
+	nCenX = nCenY = 0;	
+
+	FindRealPos(pOrg,pBinImg,iLeftLine,nCenX,nCenY,&nStartX,&nFirstY,&nLastY,icam,iDimension
+		,(int)((double)m_InsParm.nSkipSize/m_InsParm.dCamRes));
+
+//	nCenX = (int)dAlign2GlassX;//m_ObjectInfo.nEdgeTop;
+
+	MakeReal2AlignCad(pOrg,nCenY,(int)dAlign2GlassX,iDimension,icam);	
+
+	if(m_InsParm.bChipIns == TRUE)
+	{
+		Exe_ChipInspect(pBin,pOrg,icam);
+	}
+
+	double			dAvgThickTemp=0,dChamferThick;//Chamfer
+	
+	//if(m_InsParm.bSizeIns == TRUE)
+	{
+		std::multimap<int,CSplinePoint>	mapDist;
+		std::multimap<int,CSplinePoint>	mapDist_Dy;
+		std::multimap<int,CSplinePoint>	mapChamfer;//20140528
+
+		Inspection_Size(pOrg,pRes,pRes_Dy,pRes_Cham,pBinImg,pBin,&dChamferThick,&dAvgThickTemp,nCenX,nCenY,(int)dAlign2GlassX,dFeedbackXY,iDimension,icam,&mapDist,&mapDist_Dy,dGlassXY,dResult,&mapChamfer,dTheta);		//20140528
+
+		//CalRangeVal(&mapDist,dResult,pRangeRes,nRangeCnt,nCenX,nCenY,nStartX,nFirstY,nLastY);//20140528
+
+		CalRangeVal_New(&mapDist,&mapDist_Dy,dResult,dResult_Dy,pRangeRes,pRangeRes_Dy,pRangeRes_Cham,nRangeCnt,nCenX,nCenY,nStartX,nFirstY,nLastY,&mapChamfer);//20140528
+	}
+
+	if(m_InsParm.bChipIns == TRUE)
+	{
+		CRect		rectImg(0,0,pOrg.GetWidth(),pOrg.GetHeight());
+
+		AnalysisThick(rectImg,m_InsParm.dCamRes,m_InsParm.nChipDiff,dAvgThickTemp*m_InsParm.dCamRes);
+	}
+
+	*dAvgThick = dChamferThick;
+
+	if(m_nTotalCount > 0)
+	{
+		double		dRate = (double)m_nNoDetCount/(double)m_nTotalCount;
+
+		if(dRate >= 0.1)
+		{
+			dResult[1] += ((double)200*m_InsParm.dCamRes);
+		}
+	}
+
+	if(m_nTotalCount > 0)
+	{
+		double		dRate = (double)m_nNoDetCount/(double)m_nTotalCount;
+
+		if(dRate >= 0.1)
+		{
+			dResult_Dy[1] += ((double)200*m_InsParm.dCamRes);
+		}
+	}
+
+	SetNotchImgResPoint(&pRes,pRangeRes,nRangeCnt);
+	SetNotchImgResPoint(&pRes_Dy,pRangeRes_Dy,nRangeCnt);
+	SetNotchImgResPoint(&pRes_Cham,pRangeRes_Cham,nRangeCnt);//20140528
+
+	return nErrCode;
+}
+
+void CNotchCut::SetNotchImgResPoint(COwnerBuffer *pRes,pNOTCH_RangePos_STU RangeVal,int nRangeCnt)
+{
+	int			iPoint;	
+
+	for(iPoint=0;iPoint<nRangeCnt;iPoint++)
+	{
+		bresenham_Line(pRes,RangeVal[iPoint].pointCAD,RangeVal[iPoint].pointImg,255);
+	}
+}
+
+// Bresenham's line algorithm
+void CNotchCut::bresenham_Line(COwnerBuffer *pRes,CPoint posStart,CPoint posEnd,BYTE color)
+{	
+	if(posStart.x <= 0 || posStart.y <= 0 || posEnd.x <= 0 || posEnd.y <= 0)
+		return;
+
+	const bool steep = (abs(posEnd.y - posStart.y) > abs(posEnd.x - posStart.x));
+
+	if(steep)
+	{
+		std::swap(posStart.x, posStart.y);
+		std::swap(posEnd.x, posEnd.y);
+	}
+
+	if(posStart.x > posEnd.x)
+	{
+		std::swap(posStart.x, posEnd.x);
+		std::swap(posStart.y, posEnd.y);
+	}
+
+	const int dx = posEnd.x - posStart.x;
+	const int dy = abs(posEnd.y - posStart.y);
+
+	float error = (float)dx / 2.0f;
+	const int ystep = (posStart.y < posEnd.y) ? 1 : -1;
+	int y = (int)posStart.y;
+
+	const int maxX = (int)posEnd.x;
+
+	for(int x=(int)posStart.x; x<maxX; x++)
+	{
+		if(steep)
+		{
+			pRes->SetPixel(y,x, color);
+		}
+		else
+		{
+			pRes->SetPixel(x,y, color);		
+		}
+
+		error -= dy;
+		if(error < 0)
+		{
+			y += ystep;
+			error += dx;
+		}
+	}
+}
+
+int CNotchCut::AnalysisThick(CRect rectImg,double dRes,int nJudgeThick,double dAvgThick)
+{	
+	vector<pair<int,CSplinePoint>>::iterator	it;	
+	CSplinePoint		*splinePos;	
+	double				dThick;
+	std::vector<CChipPair>	vecPair;
+	vector<CChipBlob>::iterator	itData;
+	CChamferInspect		ChamferIns;
+	int					nChipSize = (int)((double)nJudgeThick*DETECT_CHIP_MULTI_RATIO);
+
+	for(it=m_mapChipData.begin();it!=m_mapChipData.end();it++)
+	{
+		splinePos = static_cast<CSplinePoint*>(&it->second);
+		if(splinePos == NULL || splinePos->dThick <= 0)
+			continue;		
+
+		dThick = fabs((splinePos->dThick*dRes)-dAvgThick);
+		if(dThick > nChipSize)		
+		{
+			ChamferIns.InsertPairing(splinePos->rotate.x,splinePos->rotate.y,1,0,0,0,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,FALSE,dAvgThick+dThick);			
+		}		
+	}	
+
+#define CONTINUE_DEFECT_CNT		3
+	if(ChamferIns.GetPairDefectCount() > 0)
+	{
+		std::vector<CChipBlob> vecBlob;
+		ChamferIns.BlobDefect_Pixel(vecBlob,0,5);
+
+		if((int)vecBlob.size() > 0)
+		{
+			std::vector<CChipBlob>::iterator itBlob;
+
+			for(itBlob=vecBlob.begin();itBlob!=vecBlob.end();itBlob++)
+			{
+				if(m_nDefectCount >= MAX_NOTCH_DEFECT_COUNT)
+					return m_nDefectCount;
+
+				if(itBlob->s_nDefectArea < CONTINUE_DEFECT_CNT)
+					continue;
+
+				CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+				if(pChipBlob == NULL)
+					continue;
+
+				*pChipBlob = *itBlob;
+
+				pChipBlob->s_DefectRect.OffsetRect(rectImg.left,rectImg.top);
+				pChipBlob->s_nDefectX += rectImg.left;
+				pChipBlob->s_nDefectY += rectImg.top;
+				pChipBlob->s_nDefectRScale = (int)pChipBlob->s_dThick;
+				pChipBlob->s_DefectPosType = CHIPPOSTYPE_CEN;
+				pChipBlob->s_DefectRect = CRect(pChipBlob->s_nDefectX,pChipBlob->s_nDefectY,pChipBlob->s_nDefectX,pChipBlob->s_nDefectY);
+				pChipBlob->s_DefectRect.InflateRect(pChipBlob->s_nDefectRScale/2,pChipBlob->s_nDefectRScale/2);
+
+				m_nDefectCount++;
+			}	
+		}
+	}
+
+	return m_nDefectCount;
+}
+
+void CNotchCut::Inspection_Size(CSISBuffer &pOrg,COwnerBuffer &pRes,COwnerBuffer &pRes_Dy,COwnerBuffer &pRes_Cham,CSISBuffer &pBinEdge,CSISBuffer &pBin,double *dChamferAvgThick,double *dChipAvgThick,int nCenX,int nCenY,int nGlass2Edge,double *dFeedbackXY
+								,int iDimension, int icam, std::multimap<int,CSplinePoint> *mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dGlassXY,double *dResult,std::multimap<int,CSplinePoint> *mapChamfer,double dTheta)//20140528
+{
+	int				nUpVPos,nDwVPos;
+
+	nUpVPos = 0;
+	nDwVPos = INT_MAX;
+	DistInspection_New(pBin,pOrg,dChamferAvgThick,dChipAvgThick,nCenX,nCenY,nGlass2Edge,dFeedbackXY,iDimension
+					,icam,mapDist,mapDist_Dy,dGlassXY,&nUpVPos,&nDwVPos,mapChamfer,dTheta);//20140528
+//	ZeroMemory(dResult,sizeof(double)*2);
+//	double		dRangeRes[5];
+//	DistInspection(pBin,pOrg,dResult,dRangeRes,dAvgThick,nCenX,nCenY,nGlass2Edge,dFeedbackXY,0,icam);
+
+	if(m_bSaveDebug == TRUE)
+	{
+		COwnerBuffer		pBin2(pOrg.GetWidth(),pOrg.GetHeight());
+		CEdgeProc EdgeProc;
+
+		CopyMemory(pBin2.GetDataAddress(0,0),pOrg.GetDataAddress(0,0),pOrg.GetDataSize());
+		EdgeProc.ThresholdProcessing(pBin2.GetDataAddress(0,0),CSize(pBin2.GetDataWidth(),pBin2.GetHeight()),m_InsParm.nChipThres,1);
+
+		CString		str;	
+		str.Format(_T("%s\\4.Notch_Ins_Bin_2_%d_%d.bmp"),m_strSavePath,icam,iDimension);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(pBin2);
+	}
+
+	double dThickness = FindCenterThickness(pOrg,pBin,nCenX,nCenY,icam,iDimension);
+	if(dThickness > 0)
+	{
+		*dChamferAvgThick = dThickness;
+	}
+	
+	Inspection_SpChip(pBin,pOrg,nGlass2Edge,nUpVPos,nDwVPos);
+	
+
+	MakeReal2Cad_Image(pOrg,pRes,128);
+	MakeReal2Cad_Image(pOrg,pRes_Dy,128);
+	MakeReal2Cad_Image(pOrg,pRes_Cham,128);//20140528
+}
+
+double CNotchCut::FindCenterThickness(CSISBuffer &pOrg,CSISBuffer &pBin,int nCenX,int nCenY,int icam,int iDimension)
+{
+	double		dThickness = -1;
+	CRect		rectCen;
+	int			nHorMargin = 400,nVerMargin = 60;
+	CChamferInspect		ChamferIns;
+	int			nWidth;
+
+	rectCen = CRect(nCenX-nHorMargin,nCenY-nVerMargin,nCenX+nHorMargin,nCenY+nVerMargin);
+	if(rectCen.left < 0)
+	{
+		rectCen.left = 0;
+		nWidth = align_4byte(rectCen.Width());
+		rectCen.right = rectCen.left+nWidth;
+	}	
+	if(rectCen.right >= pOrg.GetWidth())
+	{
+		rectCen.right = pOrg.GetWidth()-1;
+		nWidth = align_4byte(rectCen.Width());
+		rectCen.left = rectCen.right-nWidth;
+	}
+	if(rectCen.top < 0 || rectCen.bottom >= pOrg.GetHeight())
+	{
+		rectCen = CRect(nCenX-nHorMargin,pOrg.GetHeight()/2-nVerMargin,nCenX+nHorMargin,pOrg.GetHeight()/2+nVerMargin);
+	}	
+
+	if(m_bSaveDebug == TRUE)
+	{	
+		COwnerBuffer		pCenImg(rectCen.Width(),rectCen.Height());
+		ChamferIns.CopyRectImg(pOrg.GetDataAddress(),pCenImg.GetDataAddress(),CSize(pOrg.GetDataWidth(),pOrg.GetHeight()),rectCen);
+
+		CString		str;	
+		str.Format(_T("%s\\Notch_Cen_2_%d_%d.bmp"),m_strSavePath,icam,iDimension);
+		CBufferAttach	attach(str);
+		attach.AttachToFile(pCenImg);
+	}
+
+	CRect		rectChip(0,0,0,0);
+	int			nThres = m_InsParm.nChipThres;//(int)((double)m_InsParm.nSizeThres*1.2);
+	int		nResult;
+	ChipErrCode errCode = ChamferIns.Inspection(&nResult,pOrg.GetDataAddress(),pOrg.GetWidth(),rectCen,nThres,FALSE,TRUE,rectChip,rectChip,rectChip,0,0,0,0,0,m_bSaveDebug,NULL,THRESMODE_FIXED);
+	if(errCode == ERR_CHIP_SUCCESS)
+	{
+		dThickness = ChamferIns.GetAvgThick();
+	}	
+
+	return dThickness;
+}
+
+void CNotchCut::ThinImage(CSISBuffer &pBinThin,int iscan, int icam)
+{	
+	BOOL bThin = FALSE;
+	for(int y=0; y<pBinThin.GetHeight(); y++)
+	{	
+		bThin = FALSE;
+		for(int x=0; x<pBinThin.GetWidth(); x++)
+		{
+			if(*pBinThin.GetDataAddress(x,y)==255)
+			{
+				if(bThin == TRUE)
+					pBinThin.SetPixel(x,y,0);
+
+				bThin=TRUE;
+			}				
+		}
+	}
+
+	if(m_bSaveDebug == TRUE)
+	{
+		CString				str;
+		str.Format(_T("%s\\6.ThinImage_%d_%d.bmp"),m_strSavePath,icam,iscan);
+		CBufferAttach		attach(str);
+		attach.AttachToFile(pBinThin);
+	}
+}
+
+void CNotchCut::GetSpChipData(vector<pair<int,CPoint>> *pVec,CRect *rectIns)
+{
+	vector<pair<int,CPoint>>::iterator	it;
+	CPoint					pointOrg;
+
+	for(it=m_mapMaster.begin();it!=m_mapMaster.end();it++)//m_mapMaster绰 cad 档搁狼 吝缴阑 捞固瘤狼 吝缴栏肺 offset矫挪 Cad档搁
+	{		
+		pointOrg = static_cast<CPoint>(it->second);	
+
+		if(rectIns->PtInRect(pointOrg) == TRUE)
+		{
+			pVec->push_back(std::make_pair(pointOrg.y, pointOrg));
+		}
+	}
+}
+
+double CNotchCut::Detect_Position(CSISBuffer &pBin,CSISBuffer &pOrg,std::multimap<double,CDetectPoint> *mapDist
+								  ,vector<pair<int,CPoint>> *vecData)
+{
+	vector<pair<int,CPoint>>::iterator	it;
+	CPoint					pointOrg,pointSet;
+	int						nCount=0,nLineSampleDet = 10,nDetOffset=200;	
+	sPoint					*pLinedata = NULL;	
+	double					dAdjustTheta;
+	CEdgeProc				EdgeProc;	
+	int						iCnt,nValue,nOrgVal,nInterval;	
+	double					dOutX,dOutY,dDist;		
+	CSplinePoint			splinePos,spDist;	
+	CDetectPoint			DetPos;
+	double					dSumThick,dThickCnt;
+	int						nNoDetCount = 0;
+	int						nConti;
+	int						nWhiteThres = (int)((double)m_InsParm.nChipThres*1.5);
+
+	mapDist->clear();
+	dSumThick = dThickCnt = 0.;
+	pLinedata = new sPoint[nLineSampleDet];	
+	for(it=vecData->begin();it!=vecData->end();it++)//m_mapMaster绰 cad 档搁狼 吝缴阑 捞固瘤狼 吝缴栏肺 offset矫挪 Cad档搁
+	{		
+		pointOrg = static_cast<CPoint>(it->second);			
+
+		pLinedata[nCount].x = pointOrg.x;
+		pLinedata[nCount].y = pointOrg.y;
+		nCount++;
+		if(nCount >= nLineSampleDet)
+		{
+			dAdjustTheta = EdgeProc.GetTheta(pLinedata,nLineSampleDet,5);									
+			nCount = 0;		
+
+			//TRACE("X=%d Y=%d Theta=%.2f\n",pointOrg.x,pointOrg.y,dAdjustTheta);
+
+			for(iCnt=0;iCnt<nLineSampleDet;iCnt++)
+			{
+				pointOrg.x = pointSet.x = (int)pLinedata[iCnt].x;
+				pointOrg.y = pointSet.y = (int)pLinedata[iCnt].y;														
+				if(dAdjustTheta <= 90)
+				{
+					pointOrg.x -= nDetOffset;		
+					nInterval = 1;
+				}
+				else
+				{
+					pointOrg.x += nDetOffset;		
+					nInterval = -1;
+				}
+
+				spDist.Reset();
+				spDist.dThick = INT_MAX;
+				spDist.bFind = FALSE;
+				splinePos.Reset();
+				splinePos.dThick = INT_MAX;
+				splinePos.bFind = FALSE;
+				DetPos.Reset();
+
+				nConti = 0;
+				double		dOrgX,dOrgY;
+				for(int iU=-1*nDetOffset;iU<nDetOffset;iU++)
+				{	
+					EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dAdjustTheta)), cos(M_RADIAN(dAdjustTheta)));				
+
+					if(dOutX < 0 || dOutY < 0 || (int)dOutX >= pBin.GetWidth() || (int)dOutY >= pBin.GetHeight())
+						continue;
+
+					nValue = *pBin.GetDataAddress((int)dOutX,(int)dOutY);					
+
+					if(nValue > 0 && spDist.bFind == FALSE)
+					{			
+						if(nConti == 0)
+						{
+							dOrgX = dOutX;
+							dOrgY = dOutY;
+						}
+						nConti++;
+						if(nConti > DETECT_WHITE_CONTI_COUNT)
+						{
+							dDist = sqrt(pow(((double)pointSet.x-dOrgX),2)+pow(((double)pointSet.y-dOrgY),2));
+							spDist.rotate = CPoint((int)dOrgX,(int)dOrgY);
+							spDist.origin = pointSet;
+							spDist.dTheta = dAdjustTheta;
+							spDist.dThick = dDist;
+							spDist.bFind = TRUE;
+						}
+					}	
+					else
+						nConti = 0;
+					
+					nOrgVal = *pOrg.GetDataAddress((int)dOutX,(int)dOutY);
+					if(nOrgVal >= nWhiteThres && splinePos.bFind == FALSE)
+					{
+						dDist = sqrt(pow(((double)pointSet.x-dOutX),2)+pow(((double)pointSet.y-dOutY),2));
+							splinePos.dThick = dDist;
+							splinePos.origin = pointSet;
+							splinePos.rotate = CPoint((int)dOutX,(int)dOutY);
+							splinePos.dTheta = dAdjustTheta;
+							splinePos.bFind = TRUE;
+						}						
+
+					pointOrg.x += nInterval;
+				}	
+
+				if(spDist.bFind == TRUE && splinePos.bFind == TRUE)
+				{
+					DetPos.orgX = spDist.rotate.x;
+					DetPos.orgY = spDist.rotate.y;
+					DetPos.imgX = splinePos.rotate.x;
+					DetPos.imgY = splinePos.rotate.y;
+					DetPos.dTheta = dAdjustTheta;
+					DetPos.dDist = sqrt(pow(((double)spDist.rotate.x-(double)splinePos.rotate.x),2)+pow(((double)spDist.rotate.y-(double)splinePos.rotate.y),2));
+					mapDist->insert(std::make_pair(DetPos.orgY, DetPos));
+					dSumThick += DetPos.dDist;
+					dThickCnt++;	
+				}		
+
+				m_nTotalCount++;
+				if(spDist.bFind == FALSE)
+				{
+					nNoDetCount++;
+					if(m_nNoDetCount < nNoDetCount)
+						m_nNoDetCount = nNoDetCount;
+				}
+				else
+				{
+					nNoDetCount = 0;
+				}
+			}	
+		}
+	}
+
+	delete[] pLinedata, pLinedata=NULL;	
+
+	return dThickCnt>0?dSumThick/dThickCnt:0.;
+}
+
+void CNotchCut::SetBrokenDefect(CPoint pointBroken)
+{
+	CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+	if(pChipBlob != NULL)
+	{
+		pChipBlob->s_nDefectX = pointBroken.x;
+		pChipBlob->s_nDefectY = pointBroken.y;
+		pChipBlob->s_DefectType = CHIPDEFTYPE_BLACK;
+		pChipBlob->s_dThick = 100;
+		pChipBlob->s_nDefectArea = 100;			
+		pChipBlob->s_nDefectRScale = 50;
+		pChipBlob->s_DefectRect = CRect(pChipBlob->s_nDefectX,pChipBlob->s_nDefectY,pChipBlob->s_nDefectX,pChipBlob->s_nDefectY);
+		pChipBlob->s_DefectRect.InflateRect(pChipBlob->s_nDefectRScale/2,pChipBlob->s_nDefectRScale/2);
+
+		m_nDefectCount++;
+	}	
+}
+
+int CNotchCut::Defect_Analyze(std::multimap<double,CDetectPoint> *mapDist,double dAvgThick)
+{
+	if(dAvgThick <= 0 || (int)mapDist->size() <= 0)
+		return m_nDefectCount;
+
+	std::multimap<double,CDetectPoint>::iterator		it;
+	CDetectPoint		DetectPos;
+	CChamferInspect		ChamferIns;
+	double				dThick;
+	std::vector<CChipPair>	vecPair;
+	vector<CChipBlob>::iterator	itData;
+	int					nChipSize = (int)((double)m_InsParm.nChipDiff*DETECT_CHIP_MULTI_RATIO);
+
+	for(it=mapDist->begin();it!=mapDist->end();it++)
+	{
+		DetectPos = static_cast<CDetectPoint>(it->second);			
+
+		dThick = fabs((DetectPos.dDist*m_InsParm.dCamRes)-dAvgThick);
+		if(dThick > nChipSize)		
+		{		
+			ChamferIns.InsertPairing((int)DetectPos.orgX,(int)DetectPos.orgY,1,0,0,0,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,FALSE,dThick);			
+		}		
+	}	
+
+#define CONTINUE_DEFECT_CNT		3
+	if(ChamferIns.GetPairDefectCount() > 0)
+	{
+		std::vector<CChipBlob> vecBlob;
+		ChamferIns.BlobDefect_Pixel(vecBlob,0,3);
+
+		if((int)vecBlob.size() > 0)
+		{
+			std::vector<CChipBlob>::iterator itBlob;
+
+			for(itBlob=vecBlob.begin();itBlob!=vecBlob.end();itBlob++)
+			{
+				if(m_nDefectCount >= MAX_NOTCH_DEFECT_COUNT)
+					return m_nDefectCount;
+
+				if(itBlob->s_nDefectArea < CONTINUE_DEFECT_CNT)
+					continue;
+
+				CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+				if(pChipBlob == NULL)
+					continue;
+
+				*pChipBlob = *itBlob;
+
+				pChipBlob->s_nDefectRScale = (int)pChipBlob->s_dThick;
+				pChipBlob->s_DefectRect = CRect(pChipBlob->s_nDefectX,pChipBlob->s_nDefectY,pChipBlob->s_nDefectX,pChipBlob->s_nDefectY);
+				pChipBlob->s_DefectRect.InflateRect(pChipBlob->s_nDefectRScale/2,pChipBlob->s_nDefectRScale/2);
+				pChipBlob->s_DefectPosType = CHIPPOSTYPE_SP;
+
+				m_nDefectCount++;
+			}	
+		}
+	}
+	
+	return m_nDefectCount;
+}
+
+BOOL CNotchCut::Inspection_SpChip(CSISBuffer &pBin,CSISBuffer &pOrg,int nGlass2Edge,int nUpVPos,int nDwVPos)
+{
+	if(pBin.IsValidBuffer() == FALSE || pOrg.IsValidBuffer() == FALSE)
+		return FALSE;
+	
+	CRect					rectIns;
+	int						nSkipSize = (int)((double)m_InsParm.nSkipSize/m_InsParm.dCamRes);
+	int						nSPInsSize;
+	vector<pair<int,CPoint>>	vecData;
+	std::multimap<double,CDetectPoint> mapDist;
+	double					dAvgThick;
+
+	if(m_InsParm.bSplineChip[0] == TRUE && nUpVPos != 0)
+	{
+		nSPInsSize = (int)((double)m_InsParm.nSpInsSize[0]/m_InsParm.dCamRes);
+		rectIns = CRect(nGlass2Edge-nSkipSize,nUpVPos-nSPInsSize,nGlass2Edge+nSkipSize,nUpVPos);
+		
+		if(m_bSaveDebug == TRUE)
+		{
+			CString		str;
+			str.Format(_T("%s\\UpImg.bmp"),m_strSavePath);
+			CCropBuffer		cropBuf(pOrg,rectIns);
+			CBufferAttach	attach(str);
+			attach.AttachToFile(cropBuf);
+		}
+
+
+		GetSpChipData(&vecData,&rectIns);
+		if((int)vecData.size() > 0)
+		{
+			std::sort(vecData.begin(),vecData.end(),ResSortYPos());
+
+			dAvgThick = Detect_Position(pBin,pOrg,&mapDist,&vecData);
+
+			Defect_Analyze(&mapDist,dAvgThick*m_InsParm.dCamRes);		
+		}
+	}
+
+	if(m_InsParm.bSplineChip[1] == TRUE && nDwVPos != INT_MAX)
+	{
+		vecData.clear();
+		nSPInsSize = (int)((double)m_InsParm.nSpInsSize[1]/m_InsParm.dCamRes);
+		rectIns = CRect(nGlass2Edge-nSkipSize,nDwVPos,nGlass2Edge+nSkipSize,nDwVPos+nSPInsSize);
+
+		if(m_bSaveDebug == TRUE)
+		{
+			CString		str;
+			str.Format(_T("%s\\DwImg.bmp"),m_strSavePath);
+			CCropBuffer		cropBuf(pOrg,rectIns);
+			CBufferAttach	attach(str);
+			attach.AttachToFile(cropBuf);
+		}
+
+
+		GetSpChipData(&vecData,&rectIns);
+		if((int)vecData.size() > 0)
+		{
+			std::sort(vecData.begin(),vecData.end(),ResSortYPos());
+			
+			mapDist.clear();
+			dAvgThick = Detect_Position(pBin,pOrg,&mapDist,&vecData);
+
+			Defect_Analyze(&mapDist,dAvgThick*m_InsParm.dCamRes);	
+		}
+	}
+
+	return TRUE;
+}
+
+void CNotchCut::Exe_ChipInspect(CSISBuffer &pBin,CSISBuffer &pOrg,int iCam)
+{
+	if(pBin.IsValidBuffer() == FALSE || pOrg.IsValidBuffer() == FALSE)
+		return;
+
+	vector<pair<int,CPoint>>::iterator	it;
+	CPoint					pointOrg,pointSet,pointMax;
+	int						nCount=0,nLineSampleDet = 10;	
+	sPoint					*pLinedata = NULL;	
+	double					dAdjustTheta;	
+	int						nDetOffset = 80,nBlankSize=10;	
+	int						iCnt,nValue;							
+	double					dOutX,dOutY;	
+	CEdgeFind				EdgeFind;
+	CEdgeProc				EdgeProc;
+	int						nInterval,nSkipSize,nDetPos,nChipSize;
+	BOOL					bBlackFind;
+	int						nPreChipPos,nChipContiCnt,iTerCnt;	
+	std::vector<CChipPair>	vecPair;	
+	CChamferInspect		ChamferIns;
+	int						nConti = 0;
+
+	nSkipSize = (int)((double)(m_InsParm.nChamferSize+m_InsParm.nChamferDiff)/m_InsParm.dCamRes);
+	nChipSize = (int)(((double)(m_InsParm.nChipDiff)/m_InsParm.dCamRes)*2);
+
+
+	COwnerBuffer		pChip(pOrg.GetDataWidth(),pOrg.GetHeight());
+	if(m_bSaveDebug == TRUE)
+	{		
+		CopyMemory(pChip.GetDataAddress(),pOrg.GetDataAddress(),pOrg.GetDataSize());
+	}
+
+	nPreChipPos = -1;
+	nChipContiCnt = iTerCnt = 0;
+	pLinedata = new sPoint[nLineSampleDet];	
+	for(it=m_mapMaster.begin();it!=m_mapMaster.end();it++)//m_mapMaster绰 cad 档搁狼 吝缴阑 捞固瘤狼 吝缴栏肺 offset矫挪 Cad档搁
+	{		
+		pointOrg = static_cast<CPoint>(it->second);	
+
+		if(pointOrg.y <= nBlankSize || pointOrg.y >= pBin.GetHeight()-nBlankSize)
+			continue;
+
+		
+		pLinedata[nCount].x = pointOrg.x;
+		pLinedata[nCount].y = pointOrg.y;
+		nCount++;
+		if(nCount >= nLineSampleDet)
+		{
+			dAdjustTheta = EdgeProc.GetTheta(pLinedata,nLineSampleDet,5);									
+			nCount = 0;		
+
+			for(iCnt=0;iCnt<nLineSampleDet;iCnt++,iTerCnt++)
+			{
+				pointOrg.x = pointSet.x = (int)pLinedata[iCnt].x;
+				pointOrg.y = pointSet.y = (int)pLinedata[iCnt].y;														
+				if(dAdjustTheta <= 90)
+				{
+					pointOrg.x -= nDetOffset;		
+					nInterval = 1;
+				}
+				else
+				{
+					pointOrg.x += nDetOffset;		
+					nInterval = -1;
+				}			
+				
+				bBlackFind = FALSE;			
+				nDetPos = nConti = 0;
+				pointMax = pointOrg;
+				pointMax.x += (nInterval*(nDetOffset*2));
+
+				int		iU;
+				for(iU=-1*nDetOffset;iU<nDetOffset;iU++)
+				{	
+					EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dAdjustTheta)), cos(M_RADIAN(dAdjustTheta)));				
+
+					if(dOutX < 0 || dOutY < 0 || (int)dOutX >= pBin.GetWidth() || (int)dOutY >= pBin.GetHeight())
+						continue;
+
+					nValue = *pBin.GetDataAddress((int)dOutX,(int)dOutY);	
+
+					if(bBlackFind == FALSE && nValue > 0)
+					{
+						nConti++;
+						if(nConti > DETECT_WHITE_CONTI_COUNT)
+						{
+							nDetPos = iU-DETECT_WHITE_CONTI_COUNT;	
+							bBlackFind = TRUE;
+							break;
+						}
+					}		
+					else
+						nConti = 0;
+					pointOrg.x += nInterval;
+				}	
+								
+				if(bBlackFind == TRUE)
+				{
+					pointOrg.x += (nInterval*(nSkipSize+m_InsParm.nDetSkipSize));
+				}
+				else
+				{
+					pointOrg = pointSet;	
+					pointOrg.x += (nInterval*(nSkipSize+m_InsParm.nNoDetSkipSize));										
+					nDetPos = 0;
+				}				
+				
+				int		nLoopCnt = nDetPos + abs(pointMax.x-pointOrg.x);
+				for(iU=nDetPos;iU<nLoopCnt;iU++)
+				{	
+					EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dAdjustTheta)), cos(M_RADIAN(dAdjustTheta)));				
+
+					if(dOutX < 0 || dOutY < 0 || (int)dOutX >= pOrg.GetWidth() || (int)dOutY >= pOrg.GetHeight())
+						continue;
+
+					nValue = *pOrg.GetDataAddress((int)dOutX,(int)dOutY);					
+
+					if(nValue < m_InsParm.nChipThres)
+					{								
+						ChamferIns.InsertPairing((int)dOutX,(int)dOutY,1,0,0,0,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,FALSE,1);	
+						
+						if(m_bSaveDebug == TRUE)
+						{
+							pChip.SetPixel((int)dOutX,(int)dOutY,200);
+						}
+					}					
+
+					pointOrg.x += nInterval;
+				}					
+			}	
+		}
+	}
+
+	if(ChamferIns.GetPairDefectCount() > 0)		
+	{
+		std::vector<CChipBlob> vecBlob;
+		ChamferIns.BlobDefect_Pixel(vecBlob,0,3);
+
+		std::vector<CChipBlob>::iterator itBlob;
+
+		for(itBlob=vecBlob.begin();itBlob!=vecBlob.end();itBlob++)
+		{
+			if(m_nDefectCount >= MAX_NOTCH_DEFECT_COUNT)
+				return;
+
+			if(itBlob->s_DefectRect.Width() < nChipSize || itBlob->s_DefectRect.Height() <= 2)
+				continue;
+
+			CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+			if(pChipBlob == NULL)
+				continue;
+
+			*pChipBlob = *itBlob;	
+			pChipBlob->s_DefectPosType = CHIPPOSTYPE_BIN;
+
+			m_nDefectCount++;
+		}	
+	}
+
+	if(m_bSaveDebug == TRUE)
+	{
+		CString		str;
+		str.Format(_T("%s\\4.[%d]_ChipInsImg.bmp"),m_strSavePath,iCam);//20140528
+		CBufferAttach		attach(str);
+		attach.AttachToFile(pChip);
+	}
+}
+
+BOOL CNotchCut::DistInspection_New(CSISBuffer &pBin,CSISBuffer &pOrg,double *dChamferThick,double *dChipAvgThick,int nCenX,int nCenY,int nGlass2Edge
+							   , double *dFeedbackXY,int iDimension, int icam, std::multimap<int,CSplinePoint> *mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dGlassXY
+							   ,int *nUpVPos,int *nDwVPos,std::multimap<int,CSplinePoint> *mapChamfer,double dTheta)//20140528
+{	
+	ZeroMemory(dGlassXY,sizeof(double)*2);
+
+	if(pBin.IsValidBuffer() == FALSE || pOrg.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	vector<pair<int,CPoint>>::iterator	it;
+	CPoint					pointOrg,pointOrg_Dy,pointSet;
+	int						nCount=0,nLineSampleDet = 10;	
+	sPoint					*pLinedata = NULL;	
+	double					dAdjustTheta,dDist,dDist_Dy;	
+	const	int				nDetOffset = 200;	
+	int						iCnt,nValue,nOrgVal;							
+	double					dOutX,dOutY;		
+	CSplinePoint			splinePos,spDist,spDist_Dy,spDistBlack;	
+	int						nInterval,nInterval_Dy;
+	CEdgeFind				EdgeFind;
+	CEdgeProc				EdgeProc;
+	double					dSumThick,dThickCnt;
+	double					dChamferSumThick,dChamferThickCnt;
+	int						nNoDetCount,nConti,nConti_Dy,nWhiteConti;
+	int						nWhiteThres = (int)((double)m_InsParm.nChipThres*1.6);
+	int						nCenSkipRange[2],nSkipMargin=50;
+	int						nFeedbackYOffset = 100;
+	int						nCalFeedbackPosX = m_AlignMasterParm[iDimension].nPosX+nFeedbackYOffset;
+	BOOL					bFindFeedbackY[2];
+	int						nFeedbackYPos[2];
+	bFindFeedbackY[0] = bFindFeedbackY[1] = FALSE;
+	nFeedbackYPos[0] = nFeedbackYPos[1] = -9999;
+
+//	int		nStartY = (int)((double)baseCenY/m_InsParm.dCamRes-(double)(m_MasterParm[index].nPosY));
+	
+	if(nCenX > 0 && nCenY > 0)
+	{
+		dFeedbackXY[0] = nCenX - m_AlignMasterParm[iDimension].nMaxX;
+		dFeedbackXY[1] = nCenY - m_AlignMasterParm[iDimension].nMaxY;
+		dGlassXY[0] = nCenX;
+		dGlassXY[1] = nCenY;
+	}
+	else
+	{
+		dFeedbackXY[0] = -9999;
+		dFeedbackXY[1] = -9999;
+		dGlassXY[0] = m_AlignMasterParm[iDimension].nMaxX;
+		dGlassXY[1] = m_AlignMasterParm[iDimension].nMaxY;
+	}	
+
+	nCenSkipRange[0] = pOrg.GetHeight()/2-nSkipMargin;
+	nCenSkipRange[1] = pOrg.GetHeight()/2+nSkipMargin;
+
+	dSumThick = dThickCnt = dChamferSumThick = dChamferThickCnt = 0.;
+
+	*nUpVPos = 0;
+	*nDwVPos = INT_MAX;
+
+	nNoDetCount = 0;
+
+	if(m_bSaveDebug == TRUE)
+	{
+		CString		str;
+		str.Format(_T("%s\\[%d]_DistInspection_Bin.bmp"),m_strSavePath,icam);
+		CBufferAttach		attach(str);
+		attach.AttachToFile(pBin);
+	}
+
+	int			nSkipsize = (int)((double)m_InsParm.nSkipSize/m_InsParm.dCamRes);
+	const		int		nContinueBlackCnt = 20;
+	int			nConBlack;
+
+	pLinedata = new sPoint[nLineSampleDet];	
+	for(it=m_mapMaster.begin();it!=m_mapMaster.end();it++)//m_mapMaster绰 cad 档搁狼 吝缴阑 捞固瘤狼 吝缴栏肺 offset矫挪 Cad档搁
+	{		
+		pointOrg = static_cast<CPoint>(it->second);	
+
+		if(pointOrg.x < nGlass2Edge+nSkipsize)
+		{
+			if(pointOrg.y < nCenY)
+			{
+				if(*nUpVPos < pointOrg.y)
+					*nUpVPos = pointOrg.y;
+			}
+			else
+			{
+				if(*nDwVPos > pointOrg.y)
+					*nDwVPos = pointOrg.y;
+			}
+			continue;
+		}
+
+		//////////////////////////////////////////////////////////////////////////
+// 		if(pointOrg.x == nCalFeedbackPosX && pointOrg.y < m_AlignMasterParm[iDimension].nMaxY && bFindFeedbackY[0] == FALSE)
+// 		{
+// 			for (int i=m_AlignMasterParm[iDimension].nMaxY; i>0; i--)
+// 			{
+// 				nValue = *pBin.GetDataAddress(nCalFeedbackPosX,i);
+// 
+// 				if(nValue>0)
+// 				{
+// 					nFeedbackYPos[0] = i - pointOrg.y;
+// 					bFindFeedbackY[0] = TRUE;
+// 					break;
+// 				}
+// 			}
+// 		}
+// 
+// 		if(pointOrg.x == nCalFeedbackPosX && pointOrg.y > m_AlignMasterParm[iDimension].nMaxY && bFindFeedbackY[1] == FALSE)
+// 		{
+// 			for (int i=m_AlignMasterParm[iDimension].nMaxY; i<pBin.GetHeight(); i++)
+// 			{
+// 				nValue = *pBin.GetDataAddress(nCalFeedbackPosX,i);
+// 
+// 				if(nValue>0)
+// 				{
+// 					nFeedbackYPos[1] = i - pointOrg.y;
+// 					bFindFeedbackY[1] = TRUE;
+// 					break;
+// 				}
+// 			}
+// 		}
+		//////////////////////////////////////////////////////////////////////////
+		//notch 康惑 center吝埃 胶诺
+// 		if(nCenSkipRange[0] <= pointOrg.y && pointOrg.y <= nCenSkipRange[1])
+// 			continue;
+
+		pLinedata[nCount].x = pointOrg.x;
+		pLinedata[nCount].y = pointOrg.y;
+		nCount++;
+		if(nCount >= nLineSampleDet)
+		{
+			dAdjustTheta = EdgeProc.GetTheta(pLinedata,nLineSampleDet,5);									
+			nCount = 0;		
+
+			for(iCnt=0;iCnt<nLineSampleDet;iCnt++)
+			{
+				pointOrg.x = pointOrg_Dy.x = pointSet.x = (int)pLinedata[iCnt].x;
+				pointOrg.y = pointOrg_Dy.y = pointSet.y = (int)pLinedata[iCnt].y;			
+
+				if(dAdjustTheta <= 90)
+				{
+					pointOrg.x -= nDetOffset;		
+					nInterval = 1;
+				}
+				else
+				{
+					pointOrg.x += nDetOffset;		
+					nInterval = -1;
+				}
+
+				pointOrg_Dy.x -= nDetOffset;
+				nInterval_Dy = 1;
+				
+				spDist.Reset();
+				spDist.bFind = FALSE;
+				spDist.dThick = INT_MAX;
+				spDist_Dy.Reset();
+				spDist_Dy.bFind = FALSE;
+				spDist_Dy.dThick = INT_MAX;
+				splinePos.Reset();
+				splinePos.bFind = FALSE;
+				splinePos.dThick = INT_MAX;	
+				spDistBlack.Reset();
+				spDistBlack.bFind = FALSE;
+				spDistBlack.dThick = INT_MAX;
+				nConBlack = nConti = nConti_Dy = nWhiteConti = 0;
+
+				double		dOrgX,dOrgY,dOrgX_Dy,dOrgY_Dy,dWhiteX,dWhiteY;
+				int nOutX,nOutY;
+
+				dOrgX = dOrgY = dOrgX_Dy = dOrgY_Dy = dWhiteX = dWhiteY = 0.;
+				for(int iU=-1*nDetOffset;iU<nDetOffset;iU++)
+				{	
+					//////////////////////////////////////////////////////////////////////////
+					//EdgeProc.RotatePoint(pointOrg_Dy,dOutX,dOutY,sin((dTheta)), cos((dTheta)));
+					EdgeProc.RotatePoint(pointOrg_Dy,dOutX,dOutY,pointSet,sin(dTheta), cos(dTheta));
+					
+					nValue = *pBin.GetDataAddress((int)dOutX,(int)dOutY);
+					nOutX = (int)dOutX;
+					nOutY = (int)dOutY;
+					
+					if(spDist_Dy.bFind == FALSE && nValue > 0)
+					{				
+						if(nConti_Dy == 0)
+						{
+							dOrgX_Dy = dOutX;
+							dOrgY_Dy = dOutY;
+						}
+						nConti_Dy++;
+						if(nConti_Dy >DETECT_WHITE_CONTI_COUNT)
+						{
+							dDist_Dy = sqrt(pow(((double)pointSet.x-dOrgX_Dy),2)+pow(((double)pointSet.y-dOrgY_Dy),2));
+							if(pointSet.x < dOrgX_Dy)		//20140721
+								dDist_Dy *= -1;
+
+							spDist_Dy.rotate = CPoint((int)dOrgX_Dy,(int)dOrgY_Dy);
+							spDist_Dy.origin = pointSet;
+							spDist_Dy.dTheta = dAdjustTheta;
+							spDist_Dy.dThick = dDist_Dy;
+							spDist_Dy.bFind = TRUE;
+							//mapDist->insert(std::make_pair(spDist.rotate.y, spDist));//20140528
+							mapDist_Dy->insert(std::make_pair(spDist_Dy.origin.y, spDist_Dy));//20140528
+						}
+					}
+					else
+						nConti_Dy = 0;
+
+					dOutX = dOutY = 0.;
+					//////////////////////////////////////////////////////////////////////////
+
+					EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dAdjustTheta)), cos(M_RADIAN(dAdjustTheta)));				
+
+					if(dOutX < 0 || dOutY < 0 || (int)dOutX >= pBin.GetWidth() || (int)dOutY >= pBin.GetHeight())
+						continue;
+
+					nValue = *pBin.GetDataAddress((int)dOutX,(int)dOutY);					
+
+					if(spDist.bFind == FALSE && nValue > 0)
+					{				
+						if(nConti == 0)
+						{
+							dOrgX = dOutX;
+							dOrgY = dOutY;
+						}
+						nConti++;
+						if(nConti > DETECT_WHITE_CONTI_COUNT)
+						{
+							dDist = sqrt(pow(((double)pointSet.x-dOrgX),2)+pow(((double)pointSet.y-dOrgY),2));
+							if(pointSet.x < dOrgX)		//20140721
+								dDist *= -1;
+				
+							spDist.rotate = CPoint((int)dOrgX,(int)dOrgY);
+							spDist.origin = pointSet;
+							spDist.dTheta = dAdjustTheta;
+							spDist.dThick = dDist;
+							spDist.bFind = TRUE;
+							//mapDist->insert(std::make_pair(spDist.rotate.y, spDist));//20140528
+							mapDist->insert(std::make_pair(spDist.origin.y, spDist));//20140528
+						}
+					}
+					else
+						nConti = 0;
+
+					if(spDistBlack.bFind == FALSE)
+					{
+						if(spDist.bFind == TRUE && nValue == 0)
+						{
+							if(nConBlack == 0)
+							{
+								dDist = sqrt(pow(((double)spDist.rotate.x-dOutX),2)+pow(((double)spDist.rotate.y-dOutY),2));
+
+								spDistBlack.rotate = CPoint((int)dOutX,(int)dOutY);
+								//spDistBlack.origin = spDist.rotate;//20140528
+								spDistBlack.origin = spDist.origin;//20140528
+								spDistBlack.dTheta = dAdjustTheta;
+								spDistBlack.dThick = dDist;								
+							}
+
+							nConBlack++;
+							if(nConBlack >= nContinueBlackCnt)
+							{
+								spDistBlack.bFind = TRUE;
+								dChamferSumThick += spDistBlack.dThick;
+								dChamferThickCnt++;
+								mapChamfer->insert(std::make_pair(spDistBlack.origin.y, spDistBlack));//20140528
+							}
+						}
+						else
+						{
+							nConBlack = 0;
+							spDistBlack.Reset();
+							spDistBlack.bFind = FALSE;
+							spDistBlack.dThick = INT_MAX;
+						}						
+					}		
+					
+					if(splinePos.bFind == FALSE)
+					{
+						nOrgVal = *pOrg.GetDataAddress((int)dOutX,(int)dOutY);
+						if(nOrgVal >= nWhiteThres)
+						{
+							if(nWhiteConti == 0)
+							{
+								dWhiteX = dOutX;
+								dWhiteY = dOutY;
+							}
+							nWhiteConti++;
+							if(nWhiteConti > DETECT_WHITE_CONTI_COUNT)
+							{
+								dDist = sqrt(pow(((double)pointSet.x-dWhiteX),2)+pow(((double)pointSet.y-dWhiteY),2));								
+								splinePos.dThick = dDist;
+								splinePos.origin = pointSet;
+								splinePos.rotate = CPoint((int)dWhiteX,(int)dWhiteY);
+								splinePos.dTheta = dAdjustTheta;
+								splinePos.bFind = TRUE;									
+							}
+						}	
+						else
+							nWhiteConti = 0;
+					}
+					pointOrg.x += nInterval;
+					pointOrg_Dy.x += nInterval_Dy;
+				}	
+
+				if(splinePos.bFind == TRUE && spDist.bFind == TRUE)
+				{
+					splinePos.origin = spDist.rotate;
+					splinePos.dThick = sqrt(pow(((double)spDist.rotate.x-(double)splinePos.rotate.x),2)+pow(((double)spDist.rotate.y-(double)splinePos.rotate.y),2));
+					m_mapChipData.push_back(std::make_pair(splinePos.rotate.y, splinePos));			
+
+					dSumThick += splinePos.dThick;
+					dThickCnt++;
+				}				
+
+				m_nTotalCount++;
+				if(spDist.bFind == FALSE)
+				{
+					nNoDetCount++;
+					if(m_nNoDetCount < nNoDetCount)
+						m_nNoDetCount = nNoDetCount;
+				}
+				else
+				{
+					nNoDetCount = 0;
+				}
+			}	
+		}
+	}
+
+	if(dChamferThickCnt > 0)
+		*dChamferThick = dChamferSumThick/dChamferThickCnt;
+
+	if(dThickCnt > 0)
+		*dChipAvgThick = dSumThick/dThickCnt;
+
+// 	if(nFeedbackYPos[0] != -9999 && nFeedbackYPos[1] != -9999)
+// 		dFeedbackXY[1] = (nFeedbackYPos[0] + nFeedbackYPos[1]) / 2.;
+
+	return TRUE;
+}
+
+BOOL CNotchCut::DistInspection(CSISBuffer &pTgt,CSISBuffer &pOrg,double *dResult,double *dRangeRes,double *dAvgThick,int nCenX,int nCenY,int nGlass2Edge, double *dFeedbackXY,int iscan, int icam)
+{	
+	if(pTgt.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	vector<pair<int,CPoint>>::iterator	it;
+	CPoint					pointOrg,pointSet;
+	int						nCount=0,nLineSampleDet = 10;	
+	sPoint					*pLinedata = NULL;	
+	double					dAdjustTheta,dSumThick,dThickCnt;	
+	const	int				nDetOffset = 200;
+	const	int				nDEF_LINE_COUNT = nLineSampleDet/3;
+	int						iCnt,nValue,nOrgVal;	
+	CDetectPoint			*pDetPoint;	
+	CSplinePoint			pSpPoint;
+	double					dSumDist,dSumCnt,dMaxAvg;
+	double					dAvg=0.,dSum=0.,dDist=0.;				
+	double					dOutX,dOutY;	
+	std::vector<double>		vecDist;
+	CSplinePoint			splinePos;
+	double					dtemp[2];
+	int						nCountDy = 0;
+	CPoint					pointCadCenter;
+	CPoint					pointGlassCenter;
+	CRect					rectEdge;
+	int						nInterval;
+	int						nWhiteThres = (int)((double)m_InsParm.nChipThres*1.5);
+
+	ZeroMemory(dtemp,sizeof(double)*2);
+
+	for(it=m_mapMaster.begin();it!=m_mapMaster.end();it++)
+	{
+		pointOrg = static_cast<CPoint>(it->second);	
+		if(pointOrg.y == pOrg.GetHeight()/2)
+		{
+			pointCadCenter.x=pointOrg.x;
+			pointCadCenter.y=pointOrg.y;
+		}
+	}
+
+	rectEdge = CRect(0,nCenY-1,pOrg.GetWidth(),nCenY+1);
+
+	CEdgeFind		EdgeFind;
+	CEdgeProc		EdgeProc;
+
+	pointGlassCenter.x = (int)EdgeFind.FindGlassHorizontalLine(pOrg.GetDataAddress(0,0),CSize(pOrg.GetDataWidth(),pOrg.GetHeight()),rectEdge,m_InsParm.nEdgeThres,TRUE);
+	pointGlassCenter.y = nCenY;
+
+	dFeedbackXY[0] = pointGlassCenter.x - pointCadCenter.x;
+	dFeedbackXY[1] = pointGlassCenter.y - pointCadCenter.y;
+
+	TRACE("=====================================================================\r\n");
+	TRACE("Inspect Start\r\n");
+
+	//m_Log.DisplayEdgeLog("=====================================================================");
+	//m_Log.DisplayEdgeLog("Inspect Start icam [%d] iscan [%d]",icam,iscan);
+
+	*dAvgThick = dSumThick = dThickCnt = 0.;
+	dSumDist = dSumCnt = dMaxAvg = 0;	
+
+	pLinedata = new sPoint[nLineSampleDet];
+	pDetPoint = new CDetectPoint[nLineSampleDet];
+	for(it=m_mapMaster.begin();it!=m_mapMaster.end();it++)//m_mapMaster绰 cad 档搁狼 吝缴阑 捞固瘤狼 吝缴栏肺 offset矫挪 Cad档搁
+	{		
+		pointOrg = static_cast<CPoint>(it->second);	
+
+		if(pointOrg.x < nGlass2Edge+10)
+			continue;
+
+		pLinedata[nCount].x = pointOrg.x;
+		pLinedata[nCount].y = pointOrg.y;
+		nCount++;
+		if(nCount >= nLineSampleDet)
+		{
+			dAdjustTheta = EdgeProc.GetTheta(pLinedata,nLineSampleDet,5);						
+			ZeroMemory(pDetPoint,sizeof(CDetectPoint)*nLineSampleDet);
+			nCount = 0;		
+
+			TRACE("X=%d Y=%d Theta=%.2f\n",pointOrg.x,pointOrg.y,dAdjustTheta);
+
+			for(iCnt=0;iCnt<nLineSampleDet;iCnt++)
+			{
+				pointOrg.x = pointSet.x = (int)pLinedata[iCnt].x;
+				pointOrg.y = pointSet.y = (int)pLinedata[iCnt].y;														
+				if(dAdjustTheta <= 90)
+				{
+					pointOrg.x -= nDetOffset;		
+					nInterval = 1;
+				}
+				else
+				{
+					pointOrg.x += nDetOffset;		
+					nInterval = -1;
+				}
+
+				pDetPoint[iCnt].dDist = INT_MAX;
+				pDetPoint[iCnt].bFind = FALSE;
+
+				splinePos.Reset();
+				splinePos.dThick = INT_MAX;	
+
+				for(int iU=-1*nDetOffset;iU<nDetOffset;iU++)
+				{	
+					EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dAdjustTheta)), cos(M_RADIAN(dAdjustTheta)));				
+
+					if(dOutX < 0 || dOutY < 0 || (int)dOutX >= pTgt.GetWidth() || (int)dOutY >= pTgt.GetHeight())
+						continue;
+
+					//nValue = m_Labelling.GetSplineValue(m_EdgeFind,pTgt,dOutX,dOutY);
+
+					nValue = *pTgt.GetDataAddress((int)dOutX,(int)dOutY);					
+
+					if(pDetPoint[iCnt].bFind == FALSE)
+					{
+						if(nValue > 0)
+						{
+							dDist = sqrt(pow(((double)pointSet.x-dOutX),2)+pow(((double)pointSet.y-dOutY),2));
+
+							if(pDetPoint[iCnt].dDist > dDist)
+							{
+								pDetPoint[iCnt].orgX = pointSet.x;
+								pDetPoint[iCnt].orgY = pointSet.y;
+								pDetPoint[iCnt].imgX = dOutX;
+								pDetPoint[iCnt].imgY = dOutY;
+								pDetPoint[iCnt].dTheta = dAdjustTheta;
+								pDetPoint[iCnt].dDist = dDist;
+								pDetPoint[iCnt].bFind = TRUE;
+							}
+						}	
+					}		
+
+					if(splinePos.bFind == FALSE)
+					{
+					//	if(m_InsParm.bChipIns == TRUE)
+						{
+							nOrgVal = *pOrg.GetDataAddress((int)dOutX,(int)dOutY);
+							if(nOrgVal >= nWhiteThres)
+							{
+								dDist = sqrt(pow(((double)pointSet.x-dOutX),2)+pow(((double)pointSet.y-dOutY),2));
+								if(splinePos.dThick > dDist)
+								{
+									splinePos.dThick = dDist;
+									splinePos.origin = pointSet;
+									splinePos.rotate = CPoint((int)dOutX,(int)dOutY);
+									splinePos.dTheta = dAdjustTheta;
+									splinePos.bFind = TRUE;
+								}						
+							}						
+						}
+					}
+					//TRACE("pDetPoint[iCnt].orgX = %d pDetPoint[iCnt].orgY = %d pDetPoint[iCnt].imgX = %d pDetPoint[iCnt].imgY = %d pDetPoint[iCnt].dDist = %.2f splinePos.rotate.x = %d splinePos.rotate.y = %d splinePos.dThick = %.2f\n", (int)pDetPoint[iCnt].orgX,(int)pDetPoint[iCnt].orgY,(int)pDetPoint[iCnt].imgX,(int)pDetPoint[iCnt].imgY,pDetPoint[iCnt].dDist,splinePos.rotate.x,splinePos.rotate.y,splinePos.dThick);
+					//TRACE("pointSet.x %d pointSet.y %d pointOrg.x %d pointSet.y %d dOutX %d dOutY %d\n",pointSet.x,pointSet.y,pointOrg.x,pointSet.y,(int)dOutX,(int)dOutY);
+					pointOrg.x += nInterval;
+				}	
+
+				if(splinePos.dThick != INT_MAX && pDetPoint[iCnt].dDist != INT_MAX)
+				{
+					splinePos.dThick = sqrt(pow(((double)pDetPoint[iCnt].imgX-splinePos.rotate.x),2)+pow(((double)pDetPoint[iCnt].imgY-splinePos.rotate.y),2));
+					m_mapChipData.push_back(std::make_pair(splinePos.origin.y, splinePos));									
+
+					if(splinePos.dThick < 20)
+					{
+						dSumThick += splinePos.dThick;
+						dThickCnt++;
+					}
+
+					//TRACE("pDetPoint[iCnt].orgX = %d pDetPoint[iCnt].orgY = %d pDetPoint[iCnt].imgX = %d pDetPoint[iCnt].imgY = %d pDetPoint[iCnt].dDist = %.2f splinePos.rotate.x = %d splinePos.rotate.y = %d splinePos.dThick = %.2f\n", (int)pDetPoint[iCnt].orgX,(int)pDetPoint[iCnt].orgY,(int)pDetPoint[iCnt].imgX,(int)pDetPoint[iCnt].imgY,pDetPoint[iCnt].dDist,splinePos.rotate.x,splinePos.rotate.y,splinePos.dThick);
+				}
+
+				if(splinePos.dThick == INT_MAX)
+				{
+					while(!splinePos.bFind)
+					{
+						pointOrg.x += nInterval;
+
+						EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dAdjustTheta)), cos(M_RADIAN(dAdjustTheta)));				
+
+						if(dOutX < 0 || dOutY < 0 || (int)dOutX >= pTgt.GetWidth() || (int)dOutY >= pTgt.GetHeight())
+							break;
+
+						if(splinePos.bFind == FALSE)
+						{
+						//	if(m_InsParm.bChipIns == TRUE)
+							{
+								nOrgVal = *pOrg.GetDataAddress((int)dOutX,(int)dOutY);
+								if(nOrgVal >= m_InsParm.nChipThres)
+								{
+									dDist = sqrt(pow(((double)pointSet.x-dOutX),2)+pow(((double)pointSet.y-dOutY),2));
+									if(splinePos.dThick > dDist)
+									{
+										splinePos.dThick = dDist;
+										splinePos.origin = pointSet;
+										splinePos.rotate = CPoint((int)dOutX,(int)dOutY);
+										splinePos.dTheta = dAdjustTheta;
+										splinePos.bFind = TRUE;
+									}						
+								}						
+							}
+						}						
+					}
+					//TRACE("pDetPoint[iCnt].orgX = %d pDetPoint[iCnt].orgY = %d pDetPoint[iCnt].imgX = %d pDetPoint[iCnt].imgY = %d pDetPoint[iCnt].dDist = %.2f splinePos.rotate.x = %d splinePos.rotate.y = %d splinePos.dThick = %.2f\n", (int)pDetPoint[iCnt].orgX,(int)pDetPoint[iCnt].orgY,(int)pDetPoint[iCnt].imgX,(int)pDetPoint[iCnt].imgY,pDetPoint[iCnt].dDist,splinePos.rotate.x,splinePos.rotate.y,splinePos.dThick);
+
+					if(splinePos.dThick != INT_MAX)
+					{
+						splinePos.dThick = sqrt(pow(((double)pDetPoint[iCnt].imgX-splinePos.rotate.x),2)+pow(((double)pDetPoint[iCnt].imgY-splinePos.rotate.y),2));
+						m_mapChipData.push_back(std::make_pair(splinePos.origin.y, splinePos));									
+					}
+				}
+
+				//m_Log.DisplayEdgeLog("icam [%d] iscan [%d] pDetPoint[iCnt].orgX = %d pDetPoint[iCnt].orgY = %d pDetPoint[iCnt].imgX = %d pDetPoint[iCnt].imgY = %d pDetPoint[iCnt].dDist = %.2f splinePos.rotate.x = %d splinePos.rotate.y = %d splinePos.dThick = %.2f\n", icam,iscan,(int)pDetPoint[iCnt].orgX,(int)pDetPoint[iCnt].orgY,(int)pDetPoint[iCnt].imgX,(int)pDetPoint[iCnt].imgY,pDetPoint[iCnt].dDist,splinePos.rotate.x,splinePos.rotate.y,splinePos.dThick);
+			}	
+
+			int		iHorCnt,nDetCnt=0;
+			double  dSum=0;
+			dAvg = 0;
+			for(iHorCnt=0;iHorCnt<nLineSampleDet;iHorCnt++)
+			{
+				if(/*pDetPoint[iHorCnt].dDist > 1 && */pDetPoint[iHorCnt].bFind == TRUE)
+				{
+					dSum += pDetPoint[iHorCnt].dDist;
+					nDetCnt++;					
+				}
+			}
+
+			if(nDetCnt >= nDEF_LINE_COUNT)
+			{
+				if(dSum == 0)
+					dAvg = 0;
+				else
+					dAvg = dSum/(double)nDetCnt;
+			}			
+
+			if(dMaxAvg < dAvg)
+				dMaxAvg = dAvg;
+
+			/*if(dAvg > 1)*/
+			{				
+				//	DrawImgRect(pTgt,pDetPoint[nDetIdx].imgX,pDetPoint[nDetIdx].imgY,100);
+
+				dSumDist += dAvg;
+				dSumCnt++;				
+			}
+
+			vecDist.push_back(dAvg);
+		}
+	}
+
+	delete[] pLinedata, pLinedata=NULL;
+	delete[] pDetPoint, pDetPoint=NULL;
+
+	TRACE("=====================================================================\r\n");
+	//m_Log.DisplayEdgeLog("=====================================================================");
+
+	dResult[0] = dMaxAvg;
+	if(dSumCnt > 0)
+		dResult[1] = dSumDist/dSumCnt;
+	else
+		dResult[1] = 0;
+
+	if((int)vecDist.size() > 5)
+	{
+		int			nJumpVal = (int)vecDist.size()/5;
+		int			nIndex = 0;
+
+		if(nJumpVal <= 0)
+			return TRUE;
+
+		dSumDist = 0;
+		dSumCnt = 1;
+		for(std::vector<double>::iterator it=vecDist.begin();it!=vecDist.end();it++,dSumCnt++)
+		{
+			dSumDist += *it;
+
+			if(nIndex == 4)
+			{
+				if(dSumCnt >= (nJumpVal+vecDist.size()%5))
+				{			
+					if(nIndex >= 5)
+						break;
+
+					dRangeRes[nIndex] = dSumDist/dSumCnt;
+
+					dSumDist = dSumCnt = 0;
+					nIndex++;
+				}
+			}
+			else
+			{
+				if(dSumCnt >= nJumpVal)
+				{			
+					if(nIndex >= 5)
+						break;
+
+					dRangeRes[nIndex] = dSumDist/dSumCnt;
+
+					dSumDist = dSumCnt = 0;
+					nIndex++;
+				}
+			}
+		}
+	}
+
+	if(dThickCnt > 0)
+		*dAvgThick = dSumThick/dThickCnt;
+
+	TRACE("dAvgThick=%.2f, dSumThick=%.2f, dThickCnt=%.2f\n",*dAvgThick,dSumThick,dThickCnt);
+
+	return TRUE;
+}
+
+int	CNotchCut::CropDataXY2(std::multimap<int,CSplinePoint> *mapCrop,std::multimap<int,CSplinePoint> *mapDist,int nStartX,int nFirstY,int nLastY,double *dResDist)
+{
+	std::multimap<int,CSplinePoint>::iterator it;
+	CSplinePoint		spPoint;
+	double				dSum,dCnt;
+	int					nContiBrokenCnt = 0;
+	BOOL				bBroken = FALSE;
+// 	CPoint				pointBroken = CPoint(0,0);
+// 	int					nBrokenSize = (int)((double)m_InsParm.nSizeDiff/m_InsParm.dCamRes*2);
+
+	dSum = dCnt = 0;
+	dResDist[0] = dResDist[1] = -1;
+
+	for(it=mapDist->begin();it!=mapDist->end();it++)
+	{
+		spPoint = static_cast<CSplinePoint>(it->second);
+
+		if(spPoint.rotate.x < nStartX || spPoint.rotate.y < nFirstY || spPoint.rotate.y > nLastY)
+		{
+			TRACE("[%d,%d] [%d,%d] => [%.3f] nStartX[%d] nFirstY[%d] nLastY[%d]\n",spPoint.origin.x,spPoint.origin.y,spPoint.rotate.x,spPoint.rotate.y,spPoint.dThick,nStartX,nFirstY,nLastY);//20140528
+			continue;
+		}
+
+//		mapCrop->insert(std::make_pair(spPoint.rotate.y, spPoint));//20140528
+		mapCrop->insert(std::make_pair(spPoint.origin.y, spPoint));//20140528
+		dSum += fabs(spPoint.dThick);
+		dCnt++;
+		if(fabs(spPoint.dThick) > dResDist[0])
+			dResDist[0] = spPoint.dThick;
+
+// 		if(spPoint.dThick >= nBrokenSize && bBroken == FALSE)
+// 		{
+// 			if(nContiBrokenCnt == 0)
+// 			{
+// 				pointBroken = spPoint.origin;
+// 			}
+// 			nContiBrokenCnt++;
+// 			if(nContiBrokenCnt >= DETECT_BROKEN_COUNT)
+// 				bBroken = TRUE;
+// 		}
+// 		else
+// 		{
+// 			nContiBrokenCnt = 0;
+// 		}
+
+//		TRACE("[%d,%d] [%d,%d] => [%.3f]\n",spPoint.origin.x,spPoint.origin.y,spPoint.rotate.x,spPoint.rotate.y,spPoint.dThick);//20140528
+	}
+
+	if(dCnt > 0)
+		dResDist[1] = dSum/dCnt;
+
+// 	if(bBroken == TRUE)
+// 	{
+// 		SetBrokenDefect(pointBroken);
+// 	}
+
+	return (int)mapCrop->size();
+}
+
+int	CNotchCut::CropDataXY2_Chamfer(std::multimap<int,CSplinePoint> *mapCrop,std::multimap<int,CSplinePoint> *mapChamfer,int nStartX,int nFirstY,int nLastY)//20140528
+{
+	std::multimap<int,CSplinePoint>::iterator it;
+	CSplinePoint		spPoint;
+		
+	for(it=mapChamfer->begin();it!=mapChamfer->end();it++)
+	{
+		spPoint = static_cast<CSplinePoint>(it->second);
+
+		if(spPoint.rotate.x < nStartX || spPoint.rotate.y < nFirstY || spPoint.rotate.y > nLastY)
+		{
+			TRACE("[%d,%d] [%d,%d] => [%.3f] nStartX[%d] nFirstY[%d] nLastY[%d]\n",spPoint.origin.x,spPoint.origin.y,spPoint.rotate.x,spPoint.rotate.y,spPoint.dThick,nStartX,nFirstY,nLastY);
+			continue;
+		}
+
+		mapCrop->insert(std::make_pair(spPoint.origin.y, spPoint));
+	}
+
+	return (int)mapCrop->size();
+}
+
+CSplinePoint CNotchCut::FindCenter2Vec(std::multimap<int,CSplinePoint> *mapCrop,int nCenY,int *nPosition)
+{
+	CSplinePoint	spPoint,vecPoint;
+	int				nDist = INT_MAX,nLoop = 0;
+	std::multimap<int,CSplinePoint>::iterator it;
+	
+	spPoint.rotate = CPoint(INT_MAX,INT_MAX);
+	
+	*nPosition = -1;
+	for(it=mapCrop->begin();it!=mapCrop->end();it++,nLoop++)
+	{
+		vecPoint = static_cast<CSplinePoint>(it->second);
+		if(abs(vecPoint.rotate.y-nCenY) < nDist)
+		{
+			spPoint = vecPoint;
+			nDist = abs(vecPoint.rotate.y-nCenY);
+			*nPosition = nLoop;
+		}		
+	}
+
+	return spPoint;
+}
+
+void CNotchCut::GetRangeAvgThick(std::multimap<int,CSplinePoint> *mapCrop,pNOTCH_RangePos_STU pReangeRes,CSplinePoint spCenter,int nRangeCnt)
+{
+	double		dSum,dCnt;
+	int			nMin,nMax;
+	std::multimap<int,CSplinePoint>::iterator itFirst,itLast;
+
+	nMin = spCenter.rotate.y - nRangeCnt/2;
+	nMax = spCenter.rotate.y + nRangeCnt/2;
+
+	itFirst = mapCrop->lower_bound(nMin);
+	itLast = mapCrop->upper_bound(nMax);
+	
+	if(itFirst == mapCrop->end() || itLast == mapCrop->end())
+		return;
+
+	dSum = dCnt = 0;
+	CSplinePoint	vecPoint;
+	for(;itFirst!=itLast;itFirst++)
+	{
+		vecPoint = static_cast<CSplinePoint>(itFirst->second);
+
+		dSum += vecPoint.dThick;
+		dCnt++;
+		if(dCnt == (nRangeCnt/2+1))
+		{
+			pReangeRes->pointCAD = vecPoint.origin;
+			pReangeRes->pointImg = vecPoint.rotate;
+		}
+	}
+	
+	pReangeRes->dDist = dCnt>0?dSum/dCnt:0;
+}
+
+void CNotchCut::GetRangeAvgThick_New(std::multimap<int,CSplinePoint> *mapCrop,pNOTCH_RangePos_STU pReangeRes,CPoint point,int nRangeCnt)//20140528
+{
+	double		dSum,dCnt;
+	int			nMin,nMax;
+	std::multimap<int,CSplinePoint>::iterator itFirst,itLast;
+
+	nMin = point.y - nRangeCnt/2;
+	nMax = point.y + nRangeCnt/2;
+
+	itFirst = mapCrop->lower_bound(nMin);
+	itLast = mapCrop->upper_bound(nMax);
+
+	if(itFirst == mapCrop->end() || itLast == mapCrop->end())
+		return;
+
+	dSum = dCnt = 0;
+	CSplinePoint	vecPoint;
+	for(;itFirst!=itLast;itFirst++)
+	{
+		vecPoint = static_cast<CSplinePoint>(itFirst->second);
+
+		dSum += vecPoint.dThick;
+		dCnt++;
+		if(dCnt == (nRangeCnt/2+1))
+		{
+			pReangeRes->pointCAD = vecPoint.origin;
+			pReangeRes->pointImg = vecPoint.rotate;
+		}
+	}
+	
+	if(dCnt > 0)
+	{
+		pReangeRes->dDist = dSum/dCnt;
+		pReangeRes->nInsCount = (int)dCnt;
+	}
+	else
+	{
+		vecPoint = static_cast<CSplinePoint>(itFirst->second);
+		pReangeRes->pointCAD = vecPoint.origin;
+		pReangeRes->pointImg = vecPoint.rotate;
+		pReangeRes->dDist = vecPoint.dThick;
+		pReangeRes->nInsCount = 1;
+	}	
+}
+
+void CNotchCut::GetRangeAvgThick_New_Cham(std::multimap<int,CSplinePoint> *mapCropChamfer,pNOTCH_RangePos_STU pReangeRes,CPoint point,int nRangeCnt)
+{
+	double		dSum,dCnt;
+	int			nMin,nMax;
+	std::multimap<int,CSplinePoint>::iterator itFirst,itLast;
+
+	nMin = point.y - nRangeCnt/2;
+	nMax = point.y + nRangeCnt/2;
+
+	itFirst = mapCropChamfer->lower_bound(nMin);
+	itLast = mapCropChamfer->upper_bound(nMax);
+
+	if(itFirst == mapCropChamfer->end() || itLast == mapCropChamfer->end())
+		return;
+
+	dSum = dCnt = 0;
+	CSplinePoint	vecPoint;
+	for(;itFirst!=itLast;itFirst++)
+	{
+		vecPoint = static_cast<CSplinePoint>(itFirst->second);
+
+		dSum += vecPoint.dThick;
+		dCnt++;
+		if(dCnt == (nRangeCnt/2+1))
+		{
+			pReangeRes->pointCAD = vecPoint.origin;
+			pReangeRes->pointImg = vecPoint.rotate;
+		}
+	}
+
+	if(dCnt > 0)
+	{
+		pReangeRes->dDist = dSum/dCnt;
+		pReangeRes->nInsCount = (int)dCnt;
+	}
+	else
+	{
+		vecPoint = static_cast<CSplinePoint>(itFirst->second);
+		pReangeRes->pointCAD = vecPoint.origin;
+		pReangeRes->pointImg = vecPoint.rotate;
+		pReangeRes->dDist = vecPoint.dThick;
+		pReangeRes->nInsCount = 1;
+	}	
+}
+
+int CNotchCut::GetRangeDivThick(std::multimap<int, CSplinePoint> *mapCrop,CSplinePoint	spCenter,int nCenterPos,pNOTCH_RangePos_STU pRangeRes,int nRangeCnt,BOOL bOpt,int nDivRange)
+{
+	int		nDivCnt,iCnt,iIndex;
+	int		nHalfCnt = nRangeCnt/2;
+	std::multimap<int, CSplinePoint>::iterator it,itCenter;
+
+	itCenter = mapCrop->lower_bound(spCenter.rotate.y);
+	if(itCenter == mapCrop->end())
+		return 0;
+
+	CSplinePoint	spPoint;
+	double	dSum,dCnt;
+	if(bOpt == TRUE)
+	{
+		nDivCnt = nCenterPos/(nHalfCnt+1);
+		iCnt = iIndex = 0;
+		dSum = dCnt = 0.;
+		for(it=mapCrop->begin();it!=itCenter;it++,iCnt++)
+		{
+			if(iCnt >= nDivCnt-nDivRange)
+			{
+				spPoint = static_cast<CSplinePoint>(it->second);
+				dSum += spPoint.dThick;
+				dCnt++;
+
+				if(iCnt == nDivCnt)
+				{
+					if(iIndex >= nRangeCnt)
+						return iIndex;
+					pRangeRes[iIndex].pointCAD = spPoint.origin;
+					pRangeRes[iIndex].pointImg = spPoint.rotate;
+				}
+				else if(iCnt >= nDivCnt+nDivRange)				
+				{
+					iCnt = 0;						
+					pRangeRes[iIndex].dDist = dSum/dCnt;					
+					dSum = dCnt = 0.;
+					iIndex++;
+				}				
+			}
+		}
+	}
+	else
+	{
+		iIndex = nHalfCnt+1;
+
+		nDivCnt = (int)(mapCrop->size()-nCenterPos)/(nHalfCnt+1);
+		iCnt = 0;
+		dSum = dCnt = 0.;
+		for(it=itCenter;it!=mapCrop->end();it++,iCnt++)
+		{
+			if(iCnt >= nDivCnt-nDivRange)
+			{
+				spPoint = static_cast<CSplinePoint>(it->second);
+				dSum += spPoint.dThick;
+				dCnt++;
+
+				if(iCnt == nDivCnt)
+				{
+					if(iIndex >= nRangeCnt)
+						return iIndex;
+					pRangeRes[iIndex].pointCAD = spPoint.origin;
+					pRangeRes[iIndex].pointImg = spPoint.rotate;
+				}
+				else if(iCnt >= nDivCnt+nDivRange)				
+				{
+					iCnt = 0;						
+					pRangeRes[iIndex].dDist = dSum/dCnt;					
+					dSum = dCnt = 0.;
+					iIndex++;
+				}					
+			}
+		}
+	}
+
+	return iIndex;
+}
+
+void CNotchCut::CalRangeVal(std::multimap<int,CSplinePoint>	*mapDist,double *dResDist,pNOTCH_RangePos_STU dRangeRes,int nRangeCnt,int nCenX,int nCenY,int nStartX,int nFirstY,int nLastY)
+{
+	if(dRangeRes == NULL || nRangeCnt <= 0 || (int)mapDist->size() <= 0)
+	{
+		return;
+	}
+	
+	std::multimap<int, CSplinePoint> mapCrop;	
+
+	if(CropDataXY2(&mapCrop,mapDist,nStartX,nFirstY,nLastY,dResDist) <= 0)
+	{
+		return;
+	}
+
+	CSplinePoint	spCenter;
+	int				nCenterPosition;
+
+	spCenter = FindCenter2Vec(&mapCrop,nCenY,&nCenterPosition);	
+	if(nCenterPosition <= 0 || spCenter.rotate.x == INT_MAX || spCenter.rotate.y == INT_MAX)
+	{
+		return;
+	}
+
+	const int RANGE_AVG_COUNT = 5;
+	int			nHalfCnt = nRangeCnt/2;
+
+	GetRangeAvgThick(&mapCrop,&dRangeRes[nHalfCnt],spCenter,RANGE_AVG_COUNT);
+
+	if(nHalfCnt > 0)
+	{
+		GetRangeDivThick(&mapCrop,spCenter,nCenterPosition,dRangeRes,nRangeCnt,TRUE,RANGE_AVG_COUNT/2);
+		GetRangeDivThick(&mapCrop,spCenter,nCenterPosition,dRangeRes,nRangeCnt,FALSE,RANGE_AVG_COUNT/2);
+	}	
+}
+
+void CNotchCut::CalRangeVal_New(std::multimap<int,CSplinePoint>	*mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dResDist,double *dResDist_Dy,pNOTCH_RangePos_STU dRangeRes,pNOTCH_RangePos_STU dRangeRes_Dy,pNOTCH_RangePos_STU dRangeRes_Cham,int nRangeCnt,int nCenX,int nCenY,int nStartX,int nFirstY,int nLastY,std::multimap<int,CSplinePoint> *mapChamfer)//20140528
+{
+	if(dRangeRes == NULL || dRangeRes_Dy == NULL || dRangeRes_Cham == NULL || nRangeCnt <= 0 || (int)mapDist->size() <= 0 || (int)mapDist_Dy->size() <= 0)
+	{
+		return;
+	}
+
+	std::multimap<int, CSplinePoint> mapCrop;	
+	
+	if(CropDataXY2(&mapCrop,mapDist,nStartX,nFirstY,nLastY,dResDist) <= 0)
+	{
+		return;
+	}
+
+	std::multimap<int, CSplinePoint> mapCrop_Dy;	
+
+	if(CropDataXY2(&mapCrop_Dy,mapDist_Dy,nStartX,nFirstY,nLastY,dResDist_Dy) <= 0)
+	{
+		return;
+	}
+
+	std::multimap<int, CSplinePoint> mapCropChamfer;	
+
+	if(CropDataXY2_Chamfer(&mapCropChamfer,mapChamfer,nStartX,nFirstY,nLastY) <= 0)
+	{
+		return;
+	}
+
+	const int RANGE_AVG_COUNT = m_InsParm.nPointInsAveCount;
+	vector<pair<int,CPoint>>::iterator	it;
+	CPoint	pointData;
+	int nIndex;
+	
+	//for (int i=0; i<nRangeCnt; i++)
+	{
+		for(it=m_mapMaster_InsPos.begin();it!=m_mapMaster_InsPos.end();it++)
+		{
+			nIndex = static_cast<int>(it->first);
+			pointData = static_cast<CPoint>(it->second);
+
+			GetRangeAvgThick_New(&mapCrop,&dRangeRes[nIndex],pointData,RANGE_AVG_COUNT);
+			GetRangeAvgThick_New(&mapCrop_Dy,&dRangeRes_Dy[nIndex],pointData,RANGE_AVG_COUNT);
+			GetRangeAvgThick_New_Cham(&mapCropChamfer,&dRangeRes_Cham[nIndex],pointData,RANGE_AVG_COUNT);
+		}		
+	}
+}
+
+void CNotchCut::DrawImgRect(CSISBuffer &pOrg,double dX,double dY,int nValue)
+{
+	CRect		rect;
+	int			nRange = 5;
+	int			u,v;
+
+	rect.left = (int)dX - nRange;
+	rect.right = rect.left + nRange*2;
+	rect.top = (int)dY - nRange;
+	rect.bottom = rect.top + nRange*2;
+
+	AssertRect(rect,pOrg);
+
+	for(u=rect.left;u<=rect.right;u++)
+	{
+		pOrg.SetPixel(u,rect.top,nValue);
+		pOrg.SetPixel(u,rect.bottom,nValue);
+	}
+
+	for(v=rect.top;v<=rect.bottom;v++)
+	{
+		pOrg.SetPixel(rect.left,v,nValue);
+		pOrg.SetPixel(rect.right,v,nValue);
+	}
+}
+
+void CNotchCut::MakeReal2Cad_Image(CSISBuffer &pOrg,COwnerBuffer &pRes,int nValue)
+{
+	if((int)m_mapMaster.size() <= 0)
+		return;	
+
+	pRes.SetSize(pOrg.GetWidth(),pOrg.GetHeight());
+
+	CopyMemory(pRes.GetDataAddress(0,0),pOrg.GetDataAddress(0,0),pOrg.GetDataSize());	
+
+	vector<pair<int,CPoint>>::iterator	it;
+	CPoint	pointData;
+
+	for(it=m_mapMaster.begin();it!=m_mapMaster.end();it++)
+	{
+		pointData = static_cast<CPoint>(it->second);
+
+		if(pointData.x < 0 || pointData.y < 0 || pointData.x >= pOrg.GetWidth() || pointData.y >= pOrg.GetHeight())
+			continue;
+
+		pRes.SetPixel(pointData.x,pointData.y,nValue);
+	}
+}
+
+void CNotchCut::MakeReal2AlignCad(CSISBuffer &pOrg,int nCenY,int nForeX, int iDimension, int icam)
+{	
+	if(iDimension < 0 || iDimension >= MAX_NOTCH_SCAN_COUNT || (int)m_mapAlignMaster[iDimension].size() <= 0)
+		return;
+
+	COwnerBuffer		pTgt(pOrg.GetWidth(),pOrg.GetHeight());
+
+	CopyMemory(pTgt.GetDataAddress(0,0),pOrg.GetDataAddress(0,0),pOrg.GetDataSize());	
+
+	std::multimap<int, CPoint>::iterator	it;
+	CPoint	pointData,pointMove;
+
+	pointMove.x = nForeX-m_AlignMasterParm[iDimension].nPosX;
+	pointMove.y = pOrg.GetHeight()/2-m_AlignMasterParm[iDimension].nPosY;
+
+	m_AlignMasterParm[iDimension].nMaxX += pointMove.x;
+	m_AlignMasterParm[iDimension].nPosX += pointMove.x;
+	m_AlignMasterParm[iDimension].nMaxY += pointMove.y;
+
+	for(it=m_mapAlignMaster[iDimension].begin();it!=m_mapAlignMaster[iDimension].end();it++)
+	{
+		pointData = static_cast<CPoint>(it->second);
+
+		pointData.Offset(pointMove.x,pointMove.y);		
+
+		if(pointData.x < 0 || pointData.y < 0 || pointData.x >= pOrg.GetWidth() || pointData.y >= pOrg.GetHeight())
+			continue;
+
+		pTgt.SetPixel(pointData.x,pointData.y,200);
+
+		m_mapMaster.push_back(std::make_pair(pointData.y, pointData));
+	}
+
+	std::sort(m_mapMaster.begin(),m_mapMaster.end(),SortYPos());
+
+	int nIndex = 0;//20140528
+
+	for(it=m_mapAlignMaster_InsPos[iDimension].begin();it!=m_mapAlignMaster_InsPos[iDimension].end();it++)//20140528
+	{
+		pointData = static_cast<CPoint>(it->second);
+
+		pointData.Offset(pointMove.x,pointMove.y);		
+
+		if(pointData.x < 0 || pointData.y < 0 || pointData.x >= pOrg.GetWidth() || pointData.y >= pOrg.GetHeight())
+			continue;
+
+		pTgt.SetPixel(pointData.x,pointData.y,128);
+
+		m_mapMaster_InsPos.push_back(std::make_pair(nIndex++, pointData));
+	}
+
+	std::sort(m_mapMaster_InsPos.begin(),m_mapMaster_InsPos.end(),ResSortYPos());//20140528
+
+	if(m_bSaveDebug == TRUE)
+	{
+		CString				str;
+		str.Format(_T("%s\\5.Real2Cad_%d_%d_[%d,%d].bmp"),m_strSavePath,icam,iDimension,m_AlignMasterParm[iDimension].nMaxX,m_AlignMasterParm[iDimension].nMaxY);
+		CBufferAttach		attach(str);
+		attach.AttachToFile(pTgt);
+	}
+}
+
+void CNotchCut::MakeReal2Cad(CSISBuffer &pOrg,int nCenX,int nCenY, int iDimension, int icam)
+{	
+	if(iDimension < 0 || iDimension >= MAX_NOTCH_SCAN_COUNT || (int)m_mapOrgMaster[iDimension].size() <= 0)
+		return;
+
+	COwnerBuffer		pTgt(pOrg.GetWidth(),pOrg.GetHeight());
+
+	CopyMemory(pTgt.GetDataAddress(0,0),pOrg.GetDataAddress(0,0),pOrg.GetDataSize());	
+
+	std::multimap<int, CPoint>::iterator	it;
+	CPoint	pointData,pointMove;
+
+	pointMove.x = nCenX-m_MasterParm[iDimension].nPosX;
+	pointMove.y = pOrg.GetHeight()/2-m_MasterParm[iDimension].nPosY;
+	TRACE("盔夯 康惑 X=%d, Y=%d, 康惑 磊眉 Y=%d, CAD X=%d, Y=%d\n",nCenX,nCenY,pOrg.GetHeight()/2,m_MasterParm[iDimension].nPosX,m_MasterParm[iDimension].nPosY);
+	for(it=m_mapOrgMaster[iDimension].begin();it!=m_mapOrgMaster[iDimension].end();it++)
+	{
+		pointData = static_cast<CPoint>(it->second);
+
+		pointData.Offset(pointMove.x,pointMove.y);		
+
+		if(pointData.x < 0 || pointData.y < 0 || pointData.x >= pOrg.GetWidth() || pointData.y >= pOrg.GetHeight())
+			continue;
+
+		pTgt.SetPixel(pointData.x,pointData.y,200);
+
+		m_mapMaster.push_back(std::make_pair(pointData.y, pointData));
+	}
+
+	std::sort(m_mapMaster.begin(),m_mapMaster.end(),SortYPos());
+
+	if(m_bSaveDebug == TRUE)
+	{
+		CString				str;
+		str.Format(_T("%s\\5.Real2Cad_%d_%d.bmp"),m_strSavePath,icam,iDimension);
+		CBufferAttach		attach(str);
+		attach.AttachToFile(pTgt);
+	}
+}
+
+BOOL CNotchCut::ReadModelData(CString strFile, int index)
+{
+	if(index < 0 || index >= MAX_NOTCH_SCAN_COUNT)
+		return FALSE;
+
+	m_mapOrgMaster[index].clear();	
+	m_mapAlignMaster[index].clear();		
+
+	if(strFile.IsEmpty() == TRUE)
+		return FALSE;
+
+	CFileFind filefind;	
+	if(filefind.FindFile(strFile) == FALSE)
+		return FALSE;
+
+	CFile			file;
+
+	if(FALSE == file.Open(strFile, CFile::modeRead))
+		return FALSE;
+
+	int		nCnt,iLoop;
+	CPoint	point;
+
+	file.Read(&nCnt,sizeof(int));	
+	for(iLoop=0;iLoop<nCnt;iLoop++)
+	{
+		file.Read(&point,sizeof(CPoint));		
+		m_mapOrgMaster[index].insert(std::make_pair(point.y, point));		
+		if(m_MasterParm[index].nMaxX < point.x)
+			m_MasterParm[index].nMaxX = point.x;
+		if(m_MasterParm[index].nMaxY < point.y)
+			m_MasterParm[index].nMaxY = point.y;
+	}
+
+	file.Close();
+
+	return TRUE;
+}
+
+BOOL CNotchCut::WriteModelData(CString strFile,CString strRecipe,CString strCut,std::multimap<int, CSplinePoint> *pPoint)
+{
+	if(pPoint == NULL || (int)pPoint->size() <= 0)
+		return FALSE;
+	if(strFile.IsEmpty() == TRUE)
+		return FALSE;
+
+	DeleteFile(strFile);	
+
+	CFile			file;
+
+	if(FALSE == file.Open(strFile, CFile::modeCreate | CFile::modeWrite))
+		return FALSE;
+
+	int nCnt = (int)pPoint->size();
+	file.Write(&nCnt,sizeof(int));
+
+	CPoint		pointMax(0,0);
+
+	std::multimap<int, CSplinePoint>::iterator itData,itLoop;
+	CSplinePoint	*splinePos;
+
+	for(itData=pPoint->begin();itData!=pPoint->end();itData++)
+	{		
+		splinePos = static_cast<CSplinePoint*>(&itData->second);
+		if(splinePos == NULL)
+			continue;
+
+		file.Write(&splinePos->origin,sizeof(CPoint));	
+
+		if(pointMax.x < splinePos->origin.x) pointMax.x = splinePos->origin.x;
+		if(pointMax.y < splinePos->origin.y) pointMax.y = splinePos->origin.y;
+	}
+
+	file.Close();	
+
+	COwnerBuffer		ownerBuf(pointMax.x+10,pointMax.y+10);
+	for(itData=pPoint->begin();itData!=pPoint->end();itData++)
+	{		
+		splinePos = static_cast<CSplinePoint*>(&itData->second);
+		if(splinePos == NULL)
+			continue;
+
+		if(splinePos->origin.x < 0 || splinePos->origin.y < 0 
+			|| splinePos->origin.x >= ownerBuf.GetWidth() || splinePos->origin.y >= ownerBuf.GetHeight())
+			continue;
+
+		ownerBuf.SetPixel(splinePos->origin.x,splinePos->origin.y,255);
+	}
+
+	CString				strimg;
+	strimg.Format(_T("C:\\RCutProject\\Notch\\%s_%s_org.bmp"),strRecipe,strCut);
+	CBufferAttach		attach(strimg);
+	attach.AttachToFile(ownerBuf);
+
+	return TRUE;
+}
+
+void CNotchCut::SetNotchInsPoint( std::vector<CPoint> *InsPoint , int index)//20140528
+{
+	std::vector<CPoint>::iterator	it;
+	CPoint	point;
+
+	m_mapOrgMaster_InsPos[index].clear();	
+
+	for(it=InsPoint->begin();it!=InsPoint->end();it++)
+	{
+
+		point = *it;
+		
+		if(point.x < 0 || point.y < 0)
+			continue;
+
+		m_mapOrgMaster_InsPos[index].insert(std::make_pair(point.y, point));		
+	}	
+}
diff --git a/Common_Class/EdgeInspect/ProfileCADProc.cpp b/Common_Class/EdgeInspect/ProfileCADProc.cpp
new file mode 100644
index 0000000..04dc543
--- /dev/null
+++ b/Common_Class/EdgeInspect/ProfileCADProc.cpp
@@ -0,0 +1,730 @@
+#include "StdAfx.h"
+#include "ProfileCADProc.h"
+#include "FreeImage.h"
+#include "EdgeProc.h"
+
+#define JPEG_RATE			JPEG_QUALITYNORMAL|JPEG_OPTIMIZE
+#define	M_PI				acos(-1.0)
+#define M_RADIAN(x)			(((M_PI)*(x))/180.0)
+#define M_DEGREE(x)			(((180.0)*(x))/M_PI)
+
+CProfileCADProc::CProfileCADProc(void)
+{	
+	m_pmapProfile = NULL;
+	m_pmapAlignProfile = NULL;
+	m_pointMasterMax = CPoint(0,0);
+	m_pointMasterMin = CPoint(INT_MAX,INT_MAX);	
+	Reset();
+}
+
+
+CProfileCADProc::~CProfileCADProc(void)
+{
+}
+
+void CProfileCADProc::SetProfileOrigin(CPoint ptOrigin)
+{
+	m_pointMasterMin = ptOrigin;
+}
+
+void CProfileCADProc::SetProfileData(std::multimap<int, CPoint*> *pmapProfile,std::multimap<int, CPoint*> *pmapAlignProfile)
+{
+	Reset();
+	m_pmapProfile = pmapProfile;
+	m_pmapAlignProfile = pmapAlignProfile;
+	m_bLoadMaster = TRUE;
+}
+
+void CProfileCADProc::Reset()
+{
+	m_ptOrigin = m_ptOffset = m_ptAlign = CPoint(0,0);
+	m_dTheta = 0.;
+	m_bLoadMaster = FALSE;	
+}
+
+int CProfileCADProc::MakeProfileCAD(int iSide,CString strFile)
+{
+	int			nLineCnt = 0;
+
+	Reset();
+
+	if(strFile.IsEmpty() == TRUE)
+		return nLineCnt;
+
+	CSISImageBuffer			imgBuffer;
+
+	if(imgBuffer.ReadFromFile(strFile) == FALSE)
+		return nLineCnt;
+
+	//imgBuffer.FlipUpDown();
+
+	nLineCnt = FindProfileLine(imgBuffer);
+
+	return nLineCnt;
+}
+
+int CProfileCADProc::FindProfileLine(CSISBuffer &BufCad)
+{
+	if(m_pmapProfile == NULL)
+		return 0;
+
+	int			nLineCnt = 0;
+	int			x,y;	
+	LPBYTE		lpBuf;
+	const int	nOffsetImg = 5;	
+	
+	for(y=nOffsetImg;y<BufCad.GetHeight()-nOffsetImg;y++)
+	{
+		lpBuf = BufCad.GetDataAddress(nOffsetImg,y);
+		
+		for(x=nOffsetImg;x<BufCad.GetWidth()-nOffsetImg;x++,lpBuf++)
+		{
+			if(*lpBuf > 0)
+			{
+				CPoint		*pPoint = new CPoint(x,y);				
+				m_pmapProfile->insert(std::make_pair(pPoint->y, pPoint));
+			}
+		}
+	}
+	
+	return (int)m_pmapProfile->size();
+}
+
+BOOL CProfileCADProc::RotateProfileData(CvPoint2D32f ptFirst,CvPoint2D32f ptSecond,CvPoint2D32f ptOffset)
+{
+	if(m_pmapProfile == NULL || m_pmapAlignProfile == NULL)
+		return FALSE;
+
+	CPoint		*pointSet;
+	CvPoint2D32f		pointPre;
+
+	m_dTheta = -1*atan(static_cast<double>(ptSecond.x - ptFirst.x) / static_cast<double>((ptSecond.y - ptFirst.y)));
+		
+	std::multimap<int, CPoint*>::iterator	it;	
+	float		dResultX,dResultY;
+
+	m_pointMasterMin = CPoint(INT_MAX,INT_MAX);
+	m_pointMasterMax = CPoint(0,0);
+
+	for(it=m_pmapProfile->begin();it!=m_pmapProfile->end();it++)
+	{		
+		pointSet = static_cast<CPoint*>(it->second);	
+		if(pointSet == NULL)
+			continue;		
+
+		dResultX = (float)(static_cast<float>(pointSet->x) * cos(m_dTheta) - static_cast<float>(pointSet->y) * sin(m_dTheta));
+		dResultY = (float)(static_cast<float>(pointSet->y) * cos(m_dTheta) + static_cast<float>(pointSet->x) * sin(m_dTheta));
+		
+		pointPre.x = dResultX+ptFirst.x;
+		pointPre.y = dResultY+ptFirst.y;
+
+		pointPre.x += ptOffset.x;
+		pointPre.y += ptOffset.y;
+		
+		CPoint		*pPoint = new CPoint();
+		pPoint->x = (int)ROUND(pointPre.x);
+		pPoint->y = (int)ROUND(pointPre.y);
+
+		m_pmapAlignProfile->insert(std::make_pair(pPoint->y, pPoint));		
+
+		if(pPoint->x < m_pointMasterMin.x) m_pointMasterMin.x = pPoint->x;
+		if(pPoint->y < m_pointMasterMin.y) m_pointMasterMin.y = pPoint->y;
+		if(pPoint->x > m_pointMasterMax.x) m_pointMasterMax.x = pPoint->x;
+		if(pPoint->y > m_pointMasterMax.y) m_pointMasterMax.y = pPoint->y;
+	}
+
+	return TRUE;
+}
+
+CPoint CProfileCADProc::FindCADPointY(int nX,BOOL bStart)
+{
+	if(m_pmapAlignProfile == NULL)
+		return CPoint(0,0);
+
+	CPoint		ptPoint(0,0);
+
+	std::multimap<int, CPoint*>::iterator	it,itLast;
+
+	int			nFirstY;
+	int			nEndY;
+
+	if(bStart == TRUE)
+	{
+		nFirstY = m_pointMasterMin.y;
+		nEndY = nFirstY + 50;
+	}
+	else
+	{
+		nFirstY = m_pointMasterMax.y - 50;
+		nEndY = m_pointMasterMax.y;
+	}
+
+	it = m_pmapAlignProfile->lower_bound(nFirstY);	
+	itLast = m_pmapAlignProfile->upper_bound(nEndY);
+
+	if (it == m_pmapAlignProfile->end())
+		return CPoint(0,0);
+
+	CPoint		*pPt;
+	double		dDist,dMinDist = INT_MAX;
+	while (it != itLast)
+	{
+		if (it == m_pmapAlignProfile->end())
+			break;
+		if( it == itLast)
+			break;
+
+		pPt = static_cast<CPoint*>(it->second);	
+		if(pPt == NULL)
+		{
+			it++;
+			continue;
+		}
+
+		dDist = abs(nX-pPt->x);
+		if(dDist < dMinDist)
+		{
+			ptPoint = *pPt;
+			dMinDist = dDist;
+		}
+		it++;
+	}
+
+	return ptPoint;
+}
+
+CPoint CProfileCADProc::FindCADPointY(int nX,BOOL bStart,LPBYTE	lpImg,int nWidth,int nHeight,CPoint &ptGlass,CPoint &ptChamfer,int nGlassthres,int nChamferThres)
+{
+	if(m_pmapAlignProfile == NULL)
+		return CPoint(0,0);
+
+	CPoint		ptPoint(0,0);
+
+	std::multimap<int, CPoint*>::iterator	it,itLast;
+
+	int			nFirstY;
+	int			nEndY;
+
+	if(bStart == TRUE)
+	{
+		nFirstY = m_pointMasterMin.y;
+		nEndY = nFirstY + 50;
+	}
+	else
+	{
+		nFirstY = m_pointMasterMax.y - 50;
+		nEndY = m_pointMasterMax.y;
+	}
+
+	it = m_pmapAlignProfile->lower_bound(nFirstY);	
+	itLast = m_pmapAlignProfile->upper_bound(nEndY);
+
+	if (it == m_pmapAlignProfile->end())
+		return CPoint(0,0);
+
+	CPoint		*pPt;
+	double		dDist,dMinDist = INT_MAX;
+	while (it != itLast)
+	{
+		if (it == m_pmapAlignProfile->end())
+			break;
+		if( it == itLast)
+			break;
+
+		pPt = static_cast<CPoint*>(it->second);	
+		if(pPt == NULL)
+		{
+			it++;
+			continue;
+		}
+
+		dDist = abs(nX-pPt->x);
+		if(dDist < dMinDist)
+		{
+			ptPoint = *pPt;
+			dMinDist = dDist;
+		}
+		it++;
+	}
+
+	if(lpImg == NULL || nWidth <= 0 || nHeight <= 0)
+		return ptPoint;
+
+	int			nfindRange = 20;
+	int			nBright,v;
+
+	if(bStart == TRUE)
+	{
+		ptGlass = ptChamfer = CPoint(0,0);
+		for(v=ptPoint.y-nfindRange;v<ptPoint.y+nfindRange;v++)
+		{
+			nBright = *(lpImg + v*nWidth + ptPoint.x);
+			if(nBright <= nGlassthres)
+			{
+				ptGlass.x = ptPoint.x;
+				ptGlass.y = v;
+				break;
+			}
+		}
+
+		if(ptGlass.y > 0)
+		{
+			for(v=ptGlass.y+2;v<ptGlass.y+nfindRange*2;v++)
+			{
+				nBright = *(lpImg + v*nWidth + ptPoint.x);
+				if(nBright >= nGlassthres)
+				{
+					ptChamfer.x = ptGlass.x;
+					ptChamfer.y = v-1;
+					break;
+				}
+			}
+
+			if(ptChamfer.y <= 0)
+				ptChamfer = ptGlass;
+		}
+		else
+		{
+			ptGlass = ptPoint;
+			ptChamfer = ptPoint;
+		}
+	}
+	else
+	{
+		ptGlass = ptChamfer = CPoint(0,0);
+		for(v=ptPoint.y+nfindRange-1;v>=ptPoint.y-nfindRange;v--)
+		{
+			nBright = *(lpImg + v*nWidth + ptPoint.x);
+			if(nBright <= nGlassthres)
+			{
+				ptGlass.x = ptPoint.x;
+				ptGlass.y = v;
+				break;
+			}
+		}
+
+		if(ptGlass.y > 0)
+		{
+			for(v=ptGlass.y-2;v>=ptGlass.y-nfindRange*2;v--)
+			{
+				nBright = *(lpImg + v*nWidth + ptPoint.x);
+				if(nBright >= nGlassthres)
+				{
+					ptChamfer.x = ptGlass.x;
+					ptChamfer.y = v+1;
+					break;
+				}
+			}
+
+			if(ptChamfer.y <= 0)
+				ptChamfer = ptGlass;
+		}
+		else
+		{
+			ptGlass = ptPoint;
+			ptChamfer = ptPoint;
+		}
+	}
+	return ptPoint;
+}
+
+BOOL CProfileCADProc::FindGlassLine(CPoint ptOrigin,int nRange,double dTheta,LPBYTE lpImg,int nWidth,int nHeight,int nGlassThres,int nChamferThres,CPoint &ptGlass,CPoint &ptChamfer)
+{
+	CEdgeProc	EdgeProc;
+	double		dOutX,dOutY;
+	CPoint		pointOrg = CPoint((int)ptOrigin.x-nRange,(int)ptOrigin.y);
+	CPoint		pointSet = CPoint((int)ptOrigin.x,(int)ptOrigin.y);
+
+	int			nFindRange = 50;
+	int			x;
+	BOOL		bFindGlass = FALSE, bFindChamfer= FALSE;
+
+	for(x=ptOrigin.x-nRange-nFindRange;x<ptOrigin.x-nRange+nFindRange;x++)
+	{
+		pointOrg.x = x;
+		pointOrg.y = ptOrigin.y;
+		EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dTheta)), cos(M_RADIAN(dTheta)));	
+
+		if(dOutX <= 0 || dOutY <=0)
+			continue;
+
+		int		nFindX = (int)ROUND(dOutX);
+		int		nFindY = (int)ROUND(dOutY);
+
+		if(bFindGlass == TRUE && bFindChamfer == FALSE)// && x > ptGlass.x+2)		
+		{
+			if(*(lpImg + nFindY*nWidth + nFindX) >= nChamferThres)
+			{
+				ptChamfer.x = nFindX;
+				ptChamfer.y = nFindY;
+				bFindChamfer = TRUE;
+			}
+		}
+
+		if(bFindGlass == FALSE)
+		{
+			if(*(lpImg + nFindY*nWidth + nFindX) <= nGlassThres)
+			{
+				ptGlass.x = nFindX;
+				ptGlass.y = nFindY;
+				bFindGlass = TRUE;
+			}
+		}		
+
+		if(bFindGlass == TRUE && bFindChamfer == TRUE)
+			break;
+	}
+	
+	return TRUE;
+	
+}
+
+CPoint CProfileCADProc::FindCADPoint(CvPoint2D32f ptCenter,double dTheta,int nRange)
+{
+	if(m_pmapAlignProfile == NULL)
+		return CPoint(0,0);
+
+	CPoint		ptPoint(0,0);
+
+	CEdgeProc	EdgeProc;
+	double		dOutX,dOutY;
+	CPoint		pointOrg = CPoint((int)ptCenter.x-nRange,(int)ptCenter.y);
+	CPoint		pointSet = CPoint((int)ptCenter.x,(int)ptCenter.y);
+
+	EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dTheta)), cos(M_RADIAN(dTheta)));	
+
+	if(dOutX <= 0 || dOutY <=0)
+		return ptPoint;	
+
+	int			nFindRange = 1;
+
+	int			nFirstY = (int)dOutY;
+	int			nEndY = (int)dOutY + nFindRange;
+	std::multimap<int, CPoint*>::iterator	it,itLast;
+
+	it = m_pmapAlignProfile->lower_bound(nFirstY);	
+	itLast = m_pmapAlignProfile->upper_bound(nEndY);
+
+	if (it == m_pmapAlignProfile->end())
+		return FALSE;
+
+	CPoint		*pPt;
+	double		dDist,dMinDist = INT_MAX;
+	while (it != itLast)
+	{
+		if (it == m_pmapAlignProfile->end())
+			break;
+		if( it == itLast)
+			break;
+
+		pPt = static_cast<CPoint*>(it->second);	
+		if(pPt == NULL)
+		{
+			it++;
+			continue;
+		}
+
+		dDist = sqrt(pow(((double)pPt->x-dOutX),2)+pow(((double)pPt->y-dOutY),2));
+		if(dDist < dMinDist)
+		{
+			ptPoint = *pPt;
+			dMinDist = dDist;
+		}
+		it++;
+	}
+	
+	return ptPoint;
+}
+
+CPoint CProfileCADProc::FindCADPoint(CvPoint2D32f ptCenter,double dTheta,int nRange,LPBYTE	lpImg,int nWidth,int nHeight,CPoint &ptGlass,CPoint &ptChamfer,int nGlassthres,int nChamferThres)
+{
+	if(m_pmapAlignProfile == NULL)
+		return CPoint(0,0);
+
+	CPoint		ptPoint(0,0);
+
+	CEdgeProc	EdgeProc;
+	double		dOutX,dOutY;
+	CPoint		pointOrg = CPoint((int)ptCenter.x-nRange,(int)ptCenter.y);
+	CPoint		pointSet = CPoint((int)ptCenter.x,(int)ptCenter.y);
+
+	EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dTheta)), cos(M_RADIAN(dTheta)));	
+
+	if(dOutX <= 0 || dOutY <=0)
+		return ptPoint;	
+
+	int			nFindRange = 1;
+
+	int			nFirstY = (int)dOutY;
+	int			nEndY = (int)dOutY + nFindRange;
+	std::multimap<int, CPoint*>::iterator	it,itLast;
+
+	it = m_pmapAlignProfile->lower_bound(nFirstY);	
+	itLast = m_pmapAlignProfile->upper_bound(nEndY);
+
+	if (it == m_pmapAlignProfile->end())
+		return FALSE;
+
+	CPoint		*pPt;
+	double		dDist,dMinDist = INT_MAX;
+	while (it != itLast)
+	{
+		if (it == m_pmapAlignProfile->end())
+			break;
+		if( it == itLast)
+			break;
+
+		pPt = static_cast<CPoint*>(it->second);	
+		if(pPt == NULL)
+		{
+			it++;
+			continue;
+		}
+
+		dDist = sqrt(pow(((double)pPt->x-dOutX),2)+pow(((double)pPt->y-dOutY),2));
+		if(dDist < dMinDist)
+		{
+			ptPoint = *pPt;
+			dMinDist = dDist;
+		}
+		it++;
+	}
+
+	FindGlassLine(pointSet,nRange,dTheta,lpImg,nWidth,nHeight,nGlassthres,nChamferThres,ptGlass,ptChamfer);
+
+
+	return ptPoint;
+}
+
+BOOL CProfileCADProc::GetProfilePosition(std::vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile)
+{
+	if((int)vecProfile.size() <= 0 || m_pmapAlignProfile == NULL)
+		return FALSE;
+
+	CPoint		*pointSet;
+	CPoint		pointPre;
+
+	vector< pair<int,STU_PROFILE_POSITION*> >::iterator itProfile;	
+	std::multimap<int, CPoint*>::iterator	it,itEnd;
+	STU_PROFILE_POSITION	*pProfile;
+
+	itProfile = vecProfile.begin();
+
+	int		nMinY = (itProfile->second)->nMin;
+	BOOL	bContinue = FALSE;
+
+	it = m_pmapAlignProfile->lower_bound(nMinY);	
+	itEnd = m_pmapAlignProfile->end();
+
+	if (it == m_pmapAlignProfile->end())
+		return FALSE;
+
+	while (it != itEnd)
+	{
+		if (it == m_pmapAlignProfile->end())
+			break;
+
+		pointSet = static_cast<CPoint*>(it->second);	
+		pointPre = *pointSet;
+
+		if(bContinue == TRUE)
+			break;
+
+		bContinue = TRUE;
+		for(itProfile=vecProfile.begin();itProfile!=vecProfile.end();itProfile++)
+		{
+			pProfile = itProfile->second;
+
+			if(pProfile->bFindPos == TRUE)
+				continue;
+
+			bContinue = FALSE;
+			if(pProfile->nMin <= pointPre.y && pProfile->nMax >= pointPre.y)
+			{
+				pProfile->point = pointPre;
+				pProfile->bFindPos = TRUE;
+				break;
+			}
+		}
+
+		it++;
+	}
+
+	return TRUE;
+}
+
+BOOL CProfileCADProc::ReadProfileData(CString strFile)
+{
+	if(m_pmapProfile == NULL)
+		return FALSE;
+
+	Reset();	
+
+	const	int		MASTER_OFFSET = 0;		// Rotation 康开 犬焊甫 困秦辑.
+
+	if(strFile.IsEmpty() == TRUE)
+		return FALSE;
+
+	CFileFind filefind;	
+	if(filefind.FindFile(strFile) == FALSE)
+		return FALSE;
+
+	CFile			file;
+
+	if(FALSE == file.Open(strFile, CFile::modeRead))
+		return FALSE;
+
+	int		nCnt,iLoop;
+	CPoint	point;
+
+	m_pointMasterMax = CPoint(0,0);
+	m_pointMasterMin = CPoint(INT_MAX,INT_MAX);	
+
+	file.Read(&nCnt,sizeof(int));	
+	for(iLoop=0;iLoop<nCnt;iLoop++)
+	{
+		file.Read(&point,sizeof(CPoint));
+
+		CPoint		*pPoint = new CPoint(point.x,point.y);
+
+		pPoint->Offset(MASTER_OFFSET,MASTER_OFFSET);
+		m_pmapProfile->insert(std::make_pair(pPoint->y, pPoint));		
+
+		
+		if(point.x < m_pointMasterMin.x) m_pointMasterMin.x = point.x;
+		if(point.y < m_pointMasterMin.y) m_pointMasterMin.y = point.y;
+	}
+
+	file.Close();
+
+	std::multimap<int, CPoint *>::iterator		it;
+	CPoint		*pPoint;
+
+	for(it=m_pmapProfile->begin();it!=m_pmapProfile->end();it++)
+	{
+		pPoint = it->second;
+		if(pPoint == NULL)
+			continue;
+
+		pPoint->Offset(-m_pointMasterMin.x,-m_pointMasterMin.y);
+
+		if(pPoint->x > m_pointMasterMax.x) m_pointMasterMax.x = pPoint->x;
+		if(pPoint->y > m_pointMasterMax.y) m_pointMasterMax.y = pPoint->y;
+	}
+	
+	m_bLoadMaster = TRUE;	
+	
+	return TRUE;
+}
+
+BOOL CProfileCADProc::WriteProfileData(CString strFile,CString strImg)
+{	
+	if(strFile.IsEmpty() == TRUE)
+		return FALSE;
+
+	DeleteFile(strFile);	
+
+	CFileFind finder;
+	DWORD	nTick = GetTickCount();
+	do 
+	{		
+		if (finder.FindFile(strFile) == FALSE)
+			break;
+
+		if(GetTickCount()-nTick >= 2000)
+			break;
+
+	} while (TRUE);
+
+	CFile			file;
+
+	if(FALSE == file.Open(strFile, CFile::modeCreate | CFile::modeWrite))
+		return FALSE;
+	
+	int nCnt = (int)m_pmapProfile->size();
+	file.Write(&nCnt,sizeof(int));
+	
+	std::multimap<int, CPoint*>::iterator it;
+	CPoint		*pPoint;
+	CPoint		pointMax(0,0);
+	CPoint		pointMin(INT_MAX,INT_MAX);
+
+	for(it=m_pmapProfile->begin();it!=m_pmapProfile->end();it++)
+	{		
+		pPoint = static_cast<CPoint*>(it->second);
+		if(pPoint == NULL)
+			continue;
+		
+		file.Write(pPoint,sizeof(CPoint));	
+
+		if(pointMax.x < pPoint->x) pointMax.x = pPoint->x;
+		if(pointMax.y < pPoint->y) pointMax.y = pPoint->y;
+		if(pointMin.x > pPoint->x) pointMin.x = pPoint->x;
+		if(pointMin.y > pPoint->y) pointMin.y = pPoint->y;
+	}
+
+	file.Close();	
+
+#define SAVE_DEBUG_IMAGE
+#ifdef SAVE_DEBUG_IMAGE
+	if(strImg.IsEmpty() == TRUE)
+		return TRUE;
+
+	DeleteFile(strImg);
+
+	COwnerBuffer		ownerBuf(pointMax.x+10,pointMax.y+10);
+	ZeroMemory(ownerBuf.GetDataAddress(),ownerBuf.GetDataSize());
+
+	for(it=m_pmapProfile->begin();it!=m_pmapProfile->end();it++)
+	{		
+		pPoint = static_cast<CPoint*>(it->second);
+
+		if(pPoint->x < 0 || pPoint->y < 0 
+			|| pPoint->x >= ownerBuf.GetWidth() || pPoint->y >= ownerBuf.GetHeight())
+			continue;
+
+		ownerBuf.SetPixel(pPoint->x,pPoint->y,255);
+	}
+
+	SaveImageJPG(strImg,ownerBuf);
+#endif
+		
+	return TRUE;
+}
+
+BOOL CProfileCADProc::SaveImageJPG(CString strFile,CSISBuffer &buffer)
+{
+	FIBITMAP					*bitmap = NULL;	
+	BYTE						*pBitBuffer;
+
+	bitmap = FreeImage_Allocate(buffer.GetWidth(),buffer.GetHeight(),8);
+
+	pBitBuffer = FreeImage_GetBits(bitmap);
+	if(pBitBuffer == NULL)
+	{
+		FreeImage_Unload(bitmap);		
+		return FALSE;
+	}			
+
+	CopyMemory(pBitBuffer,buffer.GetDataAddress(),buffer.GetDataSize());
+
+	FIBITMAP *pBit24 = FreeImage_ConvertTo24Bits(bitmap);
+	if(pBit24 == NULL)
+		return FALSE;
+
+	char cFilePath[255];
+
+#ifdef _UNICODE
+	int		nSize = WideCharToMultiByte(CP_ACP, 0, strFile.GetBuffer(), -1, NULL, 0, NULL,NULL); 				
+	WideCharToMultiByte(CP_ACP, 0, strFile.GetBuffer(), -1, cFilePath, nSize, NULL, NULL); 
+#else				
+	sprintf_s(cFilePath,sizeof(char)*255,_T("%s"),(LPSTR)(LPCTSTR)strFile);	
+#endif	
+
+	FreeImage_Save(FIF_JPEG, pBit24, cFilePath,JPEG_RATE);	
+
+	FreeImage_Unload(bitmap);
+	FreeImage_Unload(pBit24);
+
+	return TRUE;
+}
diff --git a/Common_Class/EdgeInspect/RANSAC_LineFittingAlgorithm.cpp b/Common_Class/EdgeInspect/RANSAC_LineFittingAlgorithm.cpp
new file mode 100644
index 0000000..030c8e5
--- /dev/null
+++ b/Common_Class/EdgeInspect/RANSAC_LineFittingAlgorithm.cpp
Binary files differ
diff --git a/Common_Class/EdgeInspect/ReadMe.txt b/Common_Class/EdgeInspect/ReadMe.txt
new file mode 100644
index 0000000..69ce66a
--- /dev/null
+++ b/Common_Class/EdgeInspect/ReadMe.txt
@@ -0,0 +1,56 @@
+锘�========================================================================
+    MFC 霛检澊敫岆煬毽� : EdgeInspect 頂勲鞝濏姼 臧滌殧
+========================================================================
+
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 鞚� EdgeInspect DLL鞚� 毵岆摛鞐堨姷雼堧嫟.  鞚� DLL鞚�
+MFC鞚� 旮半掣 靷毄氩曥潉 氤挫棳 欷� 肟愲 鞎勲媹霛� DLL鞚� 鞛戩劚頃橁赴 鞙勴暅 旮半掣 甑“毳� 鞝滉车頃╇媹雼�.
+
+鞚� 韺岇澕鞐愲姅 EdgeInspect DLL鞚� 甑劚頃橂姅 臧� 韺岇澕鞐� 雽�頃�
+鞖旍暯 靹る獏鞚� 韽暔霅橃柎 鞛堨姷雼堧嫟.
+
+EdgeInspect.vcproj
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靸濎劚頃� VC++ 頂勲鞝濏姼鞚� 旮半掣 頂勲鞝濏姼 韺岇澕鞛呺媹雼�.
+    韺岇澕鞚� 靸濎劚頃� Visual C++ 氩勳爠鞐� 雽�頃� 鞝曤炒鞕�
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靹犿儩頃� 頂岆灚韽�, 甑劚 氚� 頂勲鞝濏姼 旮半姤鞐� 雽�頃�
+    鞝曤炒臧� 霌れ柎 鞛堨姷雼堧嫟.
+
+EdgeInspect.cpp
+    DllMain()鞚� 鞝曥潣霅橃柎 鞛堧姅 旮半掣 DLL 靻岇姢
+    韺岇澕鞛呺媹雼�.
+
+EdgeInspect.rc
+    頂勲攴鸽灗鞐愳劀 靷毄頃橂姅 氇摖 Microsoft Windows 毽唽鞀れ潣
+    氇╇鞛呺媹雼�.  鞐赴鞐愲姅 RES 頃橃渼 霐旊爥韯半Μ鞐� 鞝�鞛ル悳 鞎勳澊旖�, 牍勴姼毵� 氚� 旎れ劀臧�
+    韽暔霅╇媹雼�.  鞚� 韺岇澕鞚� Microsoft Visual C++鞐愳劀 歆侅爲 韼胳頃� 靾�
+    鞛堨姷雼堧嫟.
+
+res\EdgeInspect.rc2
+    鞚� 韺岇澕鞐愲姅 Microsoft Visual C++ 鞚挫櫢鞚� 雼るジ 霃勱惮鞐愳劀 韼胳頃� 毽唽鞀り皜
+    韽暔霅橃柎 鞛堨姷雼堧嫟.  毽唽鞀� 韼胳旮半 韼胳頃� 靾� 鞐嗠姅 毽唽鞀る姅
+    氇憪 鞚� 韺岇澕 鞎堨棎 氚办箻頃挫暭 頃╇媹雼�.
+
+EdgeInspect.def
+    鞚� 韺岇澕鞐愲姅 Microsoft Windows鞐愳劀 鞁ろ枆霅橁赴 鞙勴暣 鞝滉车頃挫暭 頃橂姅
+    DLL鞐� 雽�頃� 鞝曤炒臧� 韽暔霅橃柎 鞛堨溂氅�,  DLL鞚� 鞚措 氚� 靹る獏瓿� 臧欖潃
+    毵り皽 氤�靾橁皜 鞝曥潣霅橃柎 鞛堨姷雼堧嫟.  霕愴暅 DLL鞐愳劀
+    頃垬霃� 雮措炒雰呺媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
+旮绊儉 響滌 韺岇澕:
+
+StdAfx.h, StdAfx.cpp
+    鞚� 韺岇澕鞚� 氙鸽Μ 旎错寣鞚茧悳 項る崝(PCH) 韺岇澕鞚� EdgeInspect.pch鞕�
+    氙鸽Μ 旎错寣鞚茧悳 順曥嫕(PCT) 韺岇澕鞚� StdAfx.obj毳� 牍岆摐頃橂姅 雿� 靷毄霅╇媹雼�.
+
+Resource.h
+    靸� 毽唽鞀� ID毳� 鞝曥潣頃橂姅 響滌 項る崝 韺岇澕鞛呺媹雼�.
+    Microsoft Visual C++鞐愳劀 鞚� 韺岇澕鞚� 鞚疥碃 鞐呺嵃鞚错姼頃╇媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
+旮绊儉 彀戈碃:
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 靷毄頃橂姅 "TODO:" 欤检劃鞚� 靷毄鞛愱皜 於旉皜頃橁卑雮� 靷毄鞛� 歆�鞝曧暣鞎� 頃橂姅
+靻岇姢 旖旊摐 攵�攵勳潉 雮橅儉雰呺媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/EdgeInspect/Resource.h b/Common_Class/EdgeInspect/Resource.h
new file mode 100644
index 0000000..faca350
--- /dev/null
+++ b/Common_Class/EdgeInspect/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by EdgeInspect.rc
+//
+
+// 促澜篮 货 俺眉俊 荤侩且 扁夯蔼涝聪促.
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	7000
+#define _APS_NEXT_CONTROL_VALUE		7000
+#define _APS_NEXT_SYMED_VALUE		7000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/EdgeInspect/SISEdgeFind.cpp b/Common_Class/EdgeInspect/SISEdgeFind.cpp
new file mode 100644
index 0000000..6fb8bdb
--- /dev/null
+++ b/Common_Class/EdgeInspect/SISEdgeFind.cpp
@@ -0,0 +1,762 @@
+// EdgeFind.cpp: implementation of the CSISEdgeFind class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "SISEdgeFind.h"
+
+#include "SISBuffer.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+CSISEdgeFind::CSISEdgeFind()
+{
+	m_Buffer= NULL;
+}
+
+CSISEdgeFind::~CSISEdgeFind()
+{
+
+}
+
+int CSISEdgeFind::Find_LeftEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue)
+{
+	if(!pBuffer->IsValidBuffer())	return -1;
+
+	int x, y;
+	int width, height;
+	int iPitch= (int)(pitch);
+
+	width= pBuffer->GetWidth()- iPitch- 6;
+	height= pBuffer->GetHeight()- 5;
+
+	double pa, pb;
+	pb= pitch- iPitch;
+	pa= 1- pb;
+
+	threshold*= 6;
+
+	int cContinue= 0;
+	int count;
+//	int org, tar;
+	int nDefect= (int)(height*rDefect);
+	for(x= width- 1; x>= 0; x--)
+	{
+		count= 0;
+		for(y= 0; y< height; y++)
+		{
+			if(abs(pBuffer->GetDiff32(x, y, pitch)) > threshold)
+			{
+				count++;
+			}
+		}
+		if(count >= nDefect)
+		{
+			cContinue++;
+			if(cContinue >= nContinue)
+				return x+ nContinue;
+		}
+		else
+		{
+			cContinue= 0;
+		}
+	}
+	return -1;
+}
+
+int CSISEdgeFind::Find_RightEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue)
+{
+	if(!pBuffer->IsValidBuffer())	return -1;
+
+	int x, y;
+	int width, height;
+	int iPitch= (int)(pitch);
+
+	width= pBuffer->GetWidth()- iPitch- 6;
+	height= pBuffer->GetHeight()- 5;
+
+	threshold*= 6;
+
+	int cContinue= 0;
+	int count;
+	int nDefect= (int)(height*rDefect);
+	for(x= 0; x< width; x++)
+	{
+		count= 0;
+		for(y= 0; y< height; y++)
+		{
+			if(abs(pBuffer->GetDiff32(x, y, pitch)) > threshold)
+			{
+				count++;
+			}
+		}
+		if(count >= nDefect)
+		{
+			cContinue++;
+			if(cContinue >= nContinue)
+				return x+ 2+ iPitch- nContinue;
+		}
+		else
+		{
+			cContinue= 0;
+		}
+	}
+	return -1;
+}
+
+int CSISEdgeFind::Find_TopEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue)
+{
+	if(!pBuffer->IsValidBuffer())	return -1;
+
+	int x, y;
+	int width, height;
+	int iPitch= (int)(pitch);
+
+	width= pBuffer->GetWidth()- 5;
+	height= pBuffer->GetHeight()- iPitch- 6;
+
+	double pa, pb;
+	pb= pitch- iPitch;
+	pa= 1- pb;
+
+	threshold*= 6;
+
+	int cContinue= 0;
+	int count;
+//	int org, tar;
+	int nDefect= (int)(width*rDefect);
+	for(y= height- 1; y>= 0; y--)
+	{
+		count= 0;
+		for(x= 0; x< width; x++)
+		{
+			/*
+			//2 by 1
+			org= pBuffer->GetPixel(x, y)+ pBuffer->GetPixel(x, y+ 1);
+			tar= (int)(pBuffer->GetPixel(x, y+ iPitch)*pa+ pBuffer->GetPixel(x, y+iPitch+ 1)+ pBuffer->GetPixel(x, y+iPitch+ 2)*pb);
+			*/
+			//2 by 3
+//			org= pBuffer->GetPixel(x, y)+ pBuffer->GetPixel(x, y+ 1)+ pBuffer->GetPixel(x, y+ 2);
+//			org+=pBuffer->GetPixel(x+1, y)+ pBuffer->GetPixel(x+1, y+ 1)+ pBuffer->GetPixel(x+1, y+ 2);
+
+//			tar= (int)(pBuffer->GetPixel(x, y+ iPitch)*pa+ pBuffer->GetPixel(x, y+iPitch+ 1)+ pBuffer->GetPixel(x, y+iPitch+ 2)+ pBuffer->GetPixel(x, y+iPitch+ 3)*pb);
+//			tar+=(int)(pBuffer->GetPixel(x+1, y+ iPitch)*pa+ pBuffer->GetPixel(x+1, y+iPitch+ 1)+ pBuffer->GetPixel(x+1, y+iPitch+ 2)+ pBuffer->GetPixel(x+1, y+iPitch+ 3)*pb);
+
+			//if(abs(org- tar) > threshold)
+			if(abs(pBuffer->GetDiff23(x, y, pitch)) > threshold)
+			{
+				count++;
+			}
+		}
+		if(count >= nDefect)
+		{
+			cContinue++;
+			if(cContinue >= nContinue)
+				return y+ nContinue;
+		}
+		else
+		{
+			cContinue= 0;
+		}
+	}
+	return -1;
+}
+
+#include <math.h>
+int CSISEdgeFind::Find_GlassStart(CSISBuffer *pBuffer, double pitch)
+{
+	if(!pBuffer->IsValidBuffer())	return -1;
+
+
+
+
+/*	for(y= height- 1; y>= 0; y--)
+	{
+		unsigned int nResult = 0;
+		for(x= 0; x< width; x++)
+		{
+			//			org= pBuffer->GetPixel(x, y)+ pBuffer->GetPixel(x, y+ 1);
+			//			tar= (int)(pBuffer->GetPixel(x, y+ iPitch)*pa+ pBuffer->GetPixel(x, y+iPitch+ 1)+ pBuffer->GetPixel(x, y+iPitch+ 2)*pb);
+
+			org= pBuffer->GetPixel(x, y);
+			tar= (int)(pBuffer->GetPixel(x, y+ iPitch)*pa+ pBuffer->GetPixel(x, y+iPitch+ 1)*pb);
+
+			nResult += abs(org- tar);
+
+			// 			if(abs(org- tar) < 50)
+			// 			{
+			//
+			//			}
+		}
+
+		nResult = nResult/ width;
+		if(nResult > 50)
+		{
+			return -1;
+		}
+	}
+*/
+	/*TRACE("HEIGHT..[%d] WIDTH..[%d]",height,width);
+	for(y= height- 1; y>= 0; y--)
+	{
+		for(x= 0; x< width; x++)
+		{
+			org= pBuffer->GetPixel(x, y)+ pBuffer->GetPixel(x, y+ 1);
+			tar= (int)(pBuffer->GetPixel(x, y+ iPitch)*pa+ pBuffer->GetPixel(x, y+iPitch+ 1)+ pBuffer->GetPixel(x, y+iPitch+ 2)*pb);
+
+			if(abs(org- tar) > 20)
+			{
+				g_pLog->DisplayMessage(TRUE, "Start Line difference : %d",abs(org- tar));
+				return abs(org- tar);
+			}
+
+		}
+
+	}*/
+
+	const int width = pBuffer->GetWidth();
+	const int height = pBuffer->GetHeight();
+
+	int diffSum = 0;
+	const int Pitch = 2;
+
+	for(int i=0; i<width; i++)
+	{
+		double diff = pBuffer->GetPixel(i, height) - pBuffer->GetPixel(i+Pitch, height);
+
+		diffSum += (int)sqrt(diff*diff);
+	}
+
+	double per = diffSum / double(width*255);
+	
+
+	return (per < 0.1);
+}
+
+void CSISEdgeFind::GetCount_XROI(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find,int nOffset,CRect rtROI)
+{
+	if(!pBuffer->IsValidBuffer())	return ;
+	if(rtROI.right >= pBuffer->GetWidth()) return;
+
+	int x, y;
+	int nx, ny;
+	int org, tar;
+	int iPitch= (int)(pitch);
+
+	nx= (rtROI.Width()-nOffset)- iPitch- 1;
+	ny= rtROI.Height() - 1;
+
+	find.SetSize(rtROI.Width());
+	find.m_maxCount= ny;
+
+	double pa, pb;
+	pb= pitch- iPitch;
+	pa= 1- pb;
+
+	//threshold*= 2;
+
+	int count;
+	int ipos = 0;
+	for(x= rtROI.left; x< rtROI.left+nx; x++,ipos++)
+	{
+		count= 0;
+		for(y= rtROI.top; y< rtROI.bottom; y++)
+		{
+			org= pBuffer->GetPixel(x, y);
+			tar= (int)(pBuffer->GetPixel(x+ iPitch, y)*pa+ pBuffer->GetPixel(x+iPitch+ 1, y)*pb);
+			if(abs(org- tar) > threshold)
+			{
+				//	pBuffer->SetPixel(x, y, 0);
+				count++;
+			}
+		}
+		find.SetCountData(ipos, count);
+	}
+}
+
+void CSISEdgeFind::GetCount_X(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find,int nOffset)
+{
+	if(!pBuffer->IsValidBuffer())	return ;
+	if(nOffset >= pBuffer->GetWidth()) return;
+
+	int x, y;
+	int nx, ny;
+	int org, tar;
+	int iPitch= (int)(pitch);
+
+	nx= (pBuffer->GetWidth()-nOffset)- iPitch- 1;
+	ny= pBuffer->GetHeight() - 1;
+
+	find.SetSize(pBuffer->GetWidth());
+	find.m_maxCount= ny;
+
+	double pa, pb;
+	pb= pitch- iPitch;
+	pa= 1- pb;
+
+	//threshold*= 2;
+
+	int count;
+	for(x= nOffset; x< nOffset+nx; x++)
+	{
+		count= 0;
+		for(y= 0; y< ny; y++)
+		{
+			org= pBuffer->GetPixel(x, y);
+			tar= (int)(pBuffer->GetPixel(x+ iPitch, y)*pa+ pBuffer->GetPixel(x+iPitch+ 1, y)*pb);
+			if(abs(org- tar) > threshold)
+			{
+				//	pBuffer->SetPixel(x, y, 0);
+				count++;
+			}
+		}
+		find.SetCountData(x, count);
+	}
+}
+
+void CSISEdgeFind::GetCount_Y(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find)
+{
+	if(!pBuffer->IsValidBuffer())	return ;
+
+	int x, y;
+	int nx, ny;
+	int org, tar;
+	int iPitch= (int)(pitch);
+
+	nx= pBuffer->GetWidth()- 1;
+	ny= pBuffer->GetHeight()- iPitch- 1;
+
+	find.SetSize(ny);
+	find.m_maxCount= nx;
+
+	double pa, pb;
+	pb= pitch- iPitch;
+	pa= 1- pb;
+
+	//threshold*= 2;
+
+	int count;
+	for(y= 0; y< ny; y++)
+	{
+		count= 0;
+		for(x= 0; x< nx; x++)
+		{			
+			org= pBuffer->GetPixel(x, y);
+			tar= (int)(pBuffer->GetPixel(x, y+ iPitch)*pa+ pBuffer->GetPixel(x, y+iPitch+ 1)*pb);
+			if(abs(org- tar) > threshold)
+			{
+				//	pBuffer->SetPixel(x, y, 0);
+				count++;
+			}
+		}
+		find.SetCountData(y, count);
+	}
+}
+
+BOOL CSISEdgeFind::FindEdge_ToTop(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect)
+{
+	CCutoffFind find;
+	GetCount_Y(pBuffer, pitch, threshold, find);
+	return find.FindCutoff_Continuous(FALSE, int(find.m_maxCount*rDefect), 3, offset);
+}
+BOOL CSISEdgeFind::FindEdge_ToBottom(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect)
+{
+	CCutoffFind find;
+	GetCount_Y(pBuffer, pitch, threshold, find);
+	int diff= 0;
+	BOOL bRet= find.FindCutoff_Continuous(TRUE, int(find.m_maxCount*rDefect), 3, diff);
+	if(bRet)
+		offset= diff+ (int)(pitch);
+	return bRet;
+}
+
+BOOL CSISEdgeFind::FindEdge_ToLeft(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset)
+{
+	CCutoffFind find;
+	GetCount_X(pBuffer, pitch, threshold, find,nOffset);
+	return find.FindCutoff_Continuous(FALSE, int(find.m_maxCount*rDefect), 5, offset,nOffset);
+}
+BOOL CSISEdgeFind::FindEdge_ToRight(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset)
+{
+	CCutoffFind find;
+	GetCount_X(pBuffer, pitch, threshold, find,nOffset);
+	int diff= 0;
+	BOOL bRet= find.FindCutoff_Continuous(TRUE, int(find.m_maxCount*rDefect), 3, diff,nOffset);
+	if(bRet)
+		offset= diff+ (int)(pitch);
+	return bRet;
+}
+
+BOOL CSISEdgeFind::FindEdge_ToRightROI(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset,CRect rtROI)
+{
+	CCutoffFind find;
+	GetCount_XROI(pBuffer, pitch, threshold, find,nOffset,rtROI);
+	int diff= 0;
+	BOOL bRet= find.FindCutoff_Continuous(TRUE, int(find.m_maxCount*rDefect), 3, diff,nOffset);
+	if(bRet)
+		offset= diff+ (int)(pitch) + rtROI.left;
+	return bRet;
+}
+
+int CSISEdgeFind::ImageProjection(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist, int nContinue)
+{
+	//抗寇贸府
+	if(pBuff == NULL || nWidth <= 0 || nHeight <= 0)
+		return -1;
+
+	int nSumLength = ROI.Height();
+	int nProjectionLength = ROI.Width();
+	int nSumStart = ROI.top;
+	int nProjectionStart = ROI.left;
+	int nProjectionEnd = nProjectionStart + nProjectionLength;
+
+	if(nProjectionLength < 0 || nSumLength < 0)
+		return -1;
+
+	if(nWidth < ROI.Width() || nHeight < ROI.Height())
+		return -1;
+
+	int* pnSum = new int[nWidth + nDist];
+	nThres *= nSumLength;
+	ZeroMemory(pnSum, sizeof(int) * (nWidth + nDist));
+	int nSumLine, nProjectionLine;
+	int nGab;
+	int nContinueCount = 0;
+	int nLine = 0;
+	for (nProjectionLine = nProjectionStart; nProjectionLine < nProjectionEnd; nProjectionLine++)
+	{
+		for (nSumLine = nSumStart; nSumLine < nSumStart + nSumLength; nSumLine++)
+		{
+			pnSum[nProjectionLine] += *(pBuff + nProjectionLine + nSumLine * nWidth);
+		}
+
+		if (nProjectionLine - nProjectionStart >= nDist)
+		{
+			nGab = pnSum[nProjectionLine - nDist] - pnSum[nProjectionLine];
+			if (nGab < 0)
+				nGab *= -1;
+			if (nGab > nThres)
+				nContinueCount++;
+			else
+				nContinueCount = 0;
+
+			//楷加栏肺 nContinue 捞惑 唱坷搁
+			if (nContinueCount >= nContinue)
+			{
+				delete [] pnSum;
+				return nProjectionLine - (nContinue - 1);
+			}
+		}
+	}
+	delete [] pnSum;
+	return -1;
+}
+int CSISEdgeFind::ImageProjection_R(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist, int nContinue)
+{
+	//抗寇贸府
+	if(pBuff == NULL || nWidth <= 0 || nHeight <= 0)
+		return -1;
+
+	int nSumLength = ROI.Height();
+	int nProjectionLength = ROI.Width();
+	int nSumStart = ROI.top;
+	int nProjectionStart = ROI.right;
+	int nProjectionEnd = nProjectionStart - nProjectionLength;
+
+	if(nProjectionLength < 0 || nSumLength < 0)
+		return -1;
+
+	if(nWidth < ROI.Width() || nHeight < ROI.Height())
+		return -1;
+
+	int* pnSum = new int[nWidth + nDist];
+	nThres *= nSumLength;
+	ZeroMemory(pnSum, sizeof(int) * (nWidth + nDist));
+	int nSumLine, nProjectionLine;
+	int nGab;
+	int nContinueCount = 0;
+	int nLine = 0;
+	for (nProjectionLine = nProjectionStart - 1; nProjectionLine >= nProjectionEnd; nProjectionLine--)
+	{
+		for (nSumLine = nSumStart; nSumLine < nSumStart + nSumLength; nSumLine++)
+		{
+			pnSum[nProjectionLine] += *(pBuff + nProjectionLine + nSumLine * nWidth);
+		}
+
+		if (nProjectionLine <= nProjectionStart - 1 - nDist)
+		{
+			nGab = pnSum[nProjectionLine + nDist] - pnSum[nProjectionLine];
+			if (nGab < 0)
+				nGab *= -1;
+			if (nGab > nThres)
+				nContinueCount++;
+			else
+				nContinueCount = 0;
+
+			//楷加栏肺 nContinue 捞惑 唱坷搁
+			if (nContinueCount >= nContinue)
+			{
+				delete [] pnSum;
+				return nProjectionLine + (nContinue - 1);
+			}
+		}
+	}
+	delete [] pnSum;
+	return -1;
+}
+
+int CSISEdgeFind::ImageProjection_Vert(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist, int nContinue)
+{
+	//抗寇贸府
+	if(pBuff == NULL || nWidth <= 0 || nHeight <= 0)
+		return -1;
+
+	int nSumLength = ROI.Width();
+	int nProjectionLength = ROI.Height();
+	int nSumStart = ROI.left;
+	int nProjectionStart = ROI.top;
+	int nProjectionEnd = nProjectionStart + nProjectionLength;
+
+	if(nProjectionLength < 0 || nSumLength < 0)
+		return -1;
+
+	if(nWidth < ROI.Width() || nHeight < ROI.Height())
+		return -1;
+
+	int* pnSum = new int[nHeight + nDist];
+	nThres *= nSumLength;
+	ZeroMemory(pnSum, sizeof(int) * (nHeight + nDist));
+	int nSumLine, nProjectionLine;
+	int nGab;
+	int nContinueCount = 0;
+	int nLine = 0;
+	for (nProjectionLine = nProjectionStart; nProjectionLine < nProjectionEnd; nProjectionLine++)
+	{
+		for (nSumLine = nSumStart; nSumLine < nSumStart + nSumLength; nSumLine++)
+		{
+			pnSum[nProjectionLine] += *(pBuff + nSumLine + nProjectionLine * nWidth);
+		}
+
+		if (nProjectionLine - nProjectionStart >= nDist)
+		{
+			nGab = pnSum[nProjectionLine - nDist] - pnSum[nProjectionLine];
+			if (nGab < 0)
+				nGab *= -1;
+			if (nGab > nThres)
+				nContinueCount++;
+			else
+				nContinueCount = 0;
+
+			//楷加栏肺 nContinue 捞惑 唱坷搁
+			if (nContinueCount >= nContinue)
+			{
+				delete [] pnSum;
+				return nProjectionLine - (nContinue - 1);
+			}
+		}
+	}
+	delete [] pnSum;
+	return -1;
+}
+int CSISEdgeFind::ImageProjection_Vert_R(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist, int nContinue)
+{
+	//抗寇贸府
+	if(pBuff == NULL || nWidth <= 0 || nHeight <= 0)
+		return -1;
+
+	int nSumLength = ROI.Width();
+	int nProjectionLength = ROI.Height();
+	int nSumStart = ROI.left;
+	int nProjectionStart = ROI.bottom;
+	int nProjectionEnd = nProjectionStart - nProjectionLength;
+
+	if(nProjectionLength < 0 || nSumLength < 0)
+		return -1;
+
+	if(nWidth < ROI.Width() || nHeight < ROI.Height())
+		return -1;
+
+	int* pnSum = new int[nHeight + nDist];
+	nThres *= nSumLength;
+	ZeroMemory(pnSum, sizeof(int) * (nHeight + nDist));
+	int nSumLine, nProjectionLine;
+	int nGab;
+	int nContinueCount = 0;
+	int nLine = 0;
+	for (nProjectionLine = nProjectionStart - 1; nProjectionLine >= nProjectionEnd; nProjectionLine--)
+	{
+		for (nSumLine = nSumStart; nSumLine < nSumStart + nSumLength; nSumLine++)
+		{
+			pnSum[nProjectionLine] += *(pBuff + nSumLine + nProjectionLine * nWidth);
+		}
+
+		if (nProjectionLine <= nProjectionStart - 1 - nDist)
+		{
+			nGab = pnSum[nProjectionLine + nDist] - pnSum[nProjectionLine];
+			if (nGab < 0)
+				nGab *= -1;
+			if (nGab > nThres)
+				nContinueCount++;
+			else
+				nContinueCount = 0;
+
+			//楷加栏肺 nContinue 捞惑 唱坷搁
+			if (nContinueCount >= nContinue)
+			{
+				delete [] pnSum;
+				return nProjectionLine + (nContinue - 1);
+			}
+		}
+	}
+	delete [] pnSum;
+	return -1;
+}
+
+void CSISEdgeFind::ResetEdge()
+{
+	m_nTopEdge = INT_MAX;
+	m_nBottomEdge = INT_MIN;
+	m_mapLeftEdge.clear();
+	m_mapRightEdge.clear();
+}
+
+int CSISEdgeFind::GetEdgeResult(SISEdgePos eEP, int iFrame, BOOL bNearResult)
+{
+	switch(eEP)
+	{
+	case eEP_LEFT:		
+	case eEP_RIGHT:
+		{
+			mapEdgeResult* pMapEdge = &m_mapLeftEdge;
+			if(eEP == eEP_RIGHT)
+				pMapEdge = &m_mapRightEdge;
+			
+			mapEdgeResultIt it = pMapEdge->find(iFrame);
+			
+			//iFrame 焊促 累篮巴吝俊 啊厘 奴芭
+			if(bNearResult)			
+				it = pMapEdge->lower_bound(iFrame);
+			
+			if(it == pMapEdge->end())
+				return -1;
+
+			stEdgeLRResult stResult = it->second;
+			if(stResult.iFrame != iFrame)
+				return -1;
+
+			return stResult.nPos;
+		}
+	case eEP_TOP: return m_nTopEdge;
+	case eEP_BOTTOM: return m_nBottomEdge;
+	}
+
+	return -1;
+}
+
+BOOL CSISEdgeFind::IsFindEdge(SISEdgePos eEP, int iFrame)
+{
+	switch(eEP)
+	{
+	case eEP_LEFT:		
+	case eEP_RIGHT:
+		{
+			mapEdgeResult* pMapEdge = &m_mapLeftEdge;
+			if(eEP == eEP_RIGHT)
+				pMapEdge = &m_mapRightEdge;
+
+			mapEdgeResultIt it = pMapEdge->find(iFrame);			
+
+			if(it == pMapEdge->end())
+				return FALSE;
+
+			stEdgeLRResult stResult = it->second;
+			if(stResult.iFrame != iFrame)
+				return FALSE;
+
+			return TRUE;
+		}
+	case eEP_TOP: return m_nTopEdge != INT_MAX;
+	case eEP_BOTTOM: return m_nBottomEdge != INT_MIN;
+	}
+
+	return FALSE;
+}
+
+//3器牢飘吝俊辑 啊厘 弥寇胞阑 咖瘤肺 牢沥
+//臂扼胶俊辑 傍康开栏肺 茫绰促.
+#define FIND_EDGE_COUNT 3
+#define PROJECTION_SIZE 100
+int CSISEdgeFind::FindEdge(CSISBuffer framebuffer, SISEdgePos eEP, CRect rtROI, int nThres)
+{
+	if((int)eEP % 2 == 1)
+		return FindEdgeVert(framebuffer, eEP, rtROI, nThres);
+
+	int i;
+	int nResult = (eEP == eEP_RIGHT) ? INT_MIN : INT_MAX;
+	int nProjectionResult = 0;
+	int nDivide = PROJECTION_SIZE;	
+
+	for(i = 0; i < FIND_EDGE_COUNT; i++)
+	{
+		rtROI.top = framebuffer.GetHeight()/3 * i;
+		rtROI.bottom = rtROI.top + nDivide;
+
+		if (eEP == eEP_RIGHT)
+			nProjectionResult = ImageProjection(framebuffer.GetDataAddress(0,0), framebuffer.GetWidth(), framebuffer.GetHeight(), rtROI, nThres);
+		else
+			nProjectionResult = ImageProjection_R(framebuffer.GetDataAddress(0,0), framebuffer.GetWidth(), framebuffer.GetHeight(), rtROI, nThres);
+
+		if (nProjectionResult != -1)
+			nResult = (eEP == eEP_RIGHT) ? max(nResult, nProjectionResult) : min(nResult, nProjectionResult);
+	}
+	
+	if(nResult == INT_MAX || nResult == INT_MIN)
+	{
+		return -1;
+	}
+	else
+	{
+		return nResult;
+	}
+}
+
+int CSISEdgeFind::FindEdgeVert(CSISBuffer framebuffer, SISEdgePos eEP, CRect rtROI, int nThres)
+{
+	int i;
+	int nResult = (eEP == eEP_BOTTOM) ? INT_MIN : INT_MAX;
+	int nProjectionResult;
+	int nDivide = PROJECTION_SIZE;	
+	
+	int nEndRight = rtROI.right;
+	int nEndBottom = rtROI.bottom;
+	int nWidth = rtROI.Width();
+	int nHeight = rtROI.Height();
+
+	//(FIND_EDGE_COUNT - 1)俺 康开父 刚历 咖瘤甫 茫绊...
+	for(i = 0; i < FIND_EDGE_COUNT; i++)
+	{
+		rtROI.left = nWidth/FIND_EDGE_COUNT * i + nWidth/FIND_EDGE_COUNT/2;
+		rtROI.right = rtROI.left + nDivide;
+		if(eEP == eEP_BOTTOM)
+			nProjectionResult = ImageProjection_Vert(framebuffer.GetDataAddress(0,0), framebuffer.GetWidth(), framebuffer.GetHeight(), rtROI, nThres);
+		else
+			nProjectionResult = ImageProjection_Vert_R(framebuffer.GetDataAddress(0,0), framebuffer.GetWidth(), framebuffer.GetHeight(), rtROI, nThres);
+
+		if (nProjectionResult != -1)
+			nResult = (eEP == eEP_BOTTOM) ? max(nResult, nProjectionResult) : min(nResult, nProjectionResult);
+	}
+
+	if(nResult == INT_MAX || nResult == INT_MIN)
+	{
+		return -1;
+	}
+
+	return nResult;
+}
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/SplineInspect.cpp b/Common_Class/EdgeInspect/SplineInspect.cpp
new file mode 100644
index 0000000..0577e03
--- /dev/null
+++ b/Common_Class/EdgeInspect/SplineInspect.cpp
@@ -0,0 +1,2734 @@
+#include "StdAfx.h"
+#include "SplineInspect.h"
+#include <math.h>
+#include <algorithm>
+#include "ChamferInspect.h"
+#include "Edge_Log.h"
+
+const int g_SearchDirection[8][2] = {{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1},{-1,0},{-1,1}};
+
+CSplineModel::CSplineModel(void)
+{	
+	ClearModelData();	
+}
+
+CSplineModel::~CSplineModel(void)
+{	
+	ClearModelData();
+}
+
+void CSplineModel::ClearModelData()
+{
+	m_pointMasterMax = m_pointMasterMin =  CPoint(0,0);	
+	m_bLoadMasterImg = FALSE;			
+	m_strLoadModel = "";
+	m_mapMasterPos.clear();	
+}
+
+BOOL CSplineModel::CopyModelData(CSplineModel *pSpline)
+{
+	m_bLoadMasterImg = FALSE;
+	m_mapMasterPos.clear();
+	m_pointMasterMax = CPoint(0,0);
+	m_pointMasterMin = CPoint(INT_MAX,INT_MAX);
+
+	if(pSpline == NULL)
+		return FALSE;
+
+	m_strLoadModel = pSpline->m_strLoadModel;
+	m_bLoadMasterImg = pSpline->m_bLoadMasterImg;
+	m_pointMasterMax = pSpline->m_pointMasterMax;
+	m_pointMasterMin = pSpline->m_pointMasterMin;
+
+	CPoint		pointOrg;
+	std::multimap<int, CPoint>::iterator	it;
+	for(it=pSpline->m_mapMasterPos.begin();it!=pSpline->m_mapMasterPos.end();it++)
+	{		
+		pointOrg = static_cast<CPoint>(it->second);	
+		m_mapMasterPos.insert(std::make_pair(pointOrg.x, pointOrg));
+	}
+
+	return TRUE;
+}
+
+BOOL CSplineModel::ReadModelData(CString strFile,CString strRecipe)
+{	
+	m_bLoadMasterImg = FALSE;
+	m_mapMasterPos.clear();
+	m_pointMasterMax = CPoint(0,0);
+	m_pointMasterMin = CPoint(INT_MAX,INT_MAX);
+	const	int		MASTER_OFFSET = 100;		// Rotation 康开 犬焊甫 困秦辑.
+
+	if(strFile.IsEmpty() == TRUE)
+		return FALSE;
+
+	CFileFind filefind;	
+	if(filefind.FindFile(strFile) == FALSE)
+		return FALSE;
+
+	CFile			file;
+
+	if(FALSE == file.Open(strFile, CFile::modeRead))
+		return FALSE;
+
+	int		nCnt,iLoop;
+	CPoint	point;
+
+	file.Read(&nCnt,sizeof(int));	
+	for(iLoop=0;iLoop<nCnt;iLoop++)
+	{
+		file.Read(&point,sizeof(CPoint));
+		point.Offset(MASTER_OFFSET,MASTER_OFFSET);
+		m_mapMasterPos.insert(std::make_pair(point.x, point));		
+		if(point.x > m_pointMasterMax.x) m_pointMasterMax.x = point.x;
+		if(point.y > m_pointMasterMax.y) m_pointMasterMax.y = point.y;
+		if(point.x < m_pointMasterMin.x) m_pointMasterMin.x = point.x;
+		if(point.y < m_pointMasterMin.y) m_pointMasterMin.y = point.y;
+	}
+
+	file.Close();
+
+	int		*nPosCnt_X = new int[m_pointMasterMax.x+1];
+	int		*nPosCnt_Y = new int[m_pointMasterMax.y+1];
+	ZeroMemory(nPosCnt_X,sizeof(int)*(m_pointMasterMax.x+1));
+	ZeroMemory(nPosCnt_Y,sizeof(int)*(m_pointMasterMax.y+1));
+
+	CPoint	pointData;
+	std::multimap<int, CPoint>::iterator	it;	
+	for(it=m_mapMasterPos.begin();it!=m_mapMasterPos.end();it++)
+	{
+		pointData = static_cast<CPoint>(it->second);
+		if(RANGEIN(pointData.x,0,m_pointMasterMax.x) == TRUE)
+			nPosCnt_X[pointData.x]++;
+		if(RANGEIN(pointData.y,0,m_pointMasterMax.y) == TRUE)
+			nPosCnt_Y[pointData.y]++;
+	}
+
+	int		nMaxCnt = 0;
+
+	for(iLoop=0;iLoop<=m_pointMasterMax.x;iLoop++)
+	{
+		if(nPosCnt_X[iLoop] > nMaxCnt)
+		{
+			nMaxCnt = nPosCnt_X[iLoop];
+			m_pointMasterMin.x = iLoop;
+		}
+	}
+	nMaxCnt = 0;
+	for(iLoop=0;iLoop<=m_pointMasterMax.y;iLoop++)
+	{
+		if(nPosCnt_Y[iLoop] > nMaxCnt)
+		{
+			nMaxCnt = nPosCnt_Y[iLoop];
+			m_pointMasterMin.y = iLoop;
+		}
+	}
+
+	delete[] nPosCnt_X,nPosCnt_X=NULL;
+	delete[] nPosCnt_Y,nPosCnt_Y=NULL;
+	m_bLoadMasterImg = TRUE;	
+	m_strLoadModel = strRecipe;
+
+	return TRUE;
+}
+
+BOOL CSplineModel::WriteCSVData(CString strFile,CPoint *pPoint,int nCnt,CPoint pointOffset)
+{
+	CStdioFile		studioF;	
+	CFileException	ex;
+
+	int			iLoop;	
+	CPoint		point;
+	CString		strContents,str;
+
+	DeleteFile(strFile);
+
+	for(iLoop=0;iLoop<nCnt;iLoop++)
+	{
+		point = pPoint[iLoop];		
+		//point.Offset(-pointOffset.x,-pointOffset.y);
+		str.Format(_T("%d,%d,\n"),point.x,point.y);
+		strContents += str;
+	}
+
+	if(studioF.Open(strFile, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex) == FALSE)
+	{
+		return FALSE;
+	}
+
+	if(strContents.GetLength() > 0)
+		studioF.WriteString(strContents);
+
+	studioF.Close();
+
+	return TRUE;
+}
+
+BOOL CSplineModel::WriteModelData(CString strFile,CString strRecipe,CString strCut,std::multimap<int, CSplinePoint> *pPoint,CPoint pointOffset)
+{
+	if(pPoint == NULL || (int)pPoint->size() <= 0)
+		return FALSE; 
+	if(strFile.IsEmpty() == TRUE)
+		return FALSE;
+
+	DeleteFile(strFile);	
+
+	CFile			file;
+
+	if(FALSE == file.Open(strFile, CFile::modeCreate | CFile::modeWrite))
+		return FALSE;
+
+	AdjustTilt(pPoint);
+
+	int nCnt = (int)pPoint->size();
+	file.Write(&nCnt,sizeof(int));
+
+	CPoint		pointMax(0,0);
+
+	std::multimap<int, CSplinePoint>::iterator itData,itLoop;
+	CSplinePoint	*splinePos;
+
+	for(itData=pPoint->begin();itData!=pPoint->end();itData++)
+	{		
+		splinePos = static_cast<CSplinePoint*>(&itData->second);
+		if(splinePos == NULL)
+			continue;
+
+		file.Write(&splinePos->rotate,sizeof(CPoint));	
+
+		if(pointMax.x < splinePos->rotate.x) pointMax.x = splinePos->rotate.x;
+		if(pointMax.y < splinePos->rotate.y) pointMax.y = splinePos->rotate.y;
+	}
+
+	file.Close();	
+
+	COwnerBuffer		ownerBuf(pointMax.x+10,pointMax.y+10);
+	for(itData=pPoint->begin();itData!=pPoint->end();itData++)
+	{		
+		splinePos = static_cast<CSplinePoint*>(&itData->second);
+		if(splinePos == NULL)
+			continue;
+
+		if(splinePos->rotate.x < 0 || splinePos->rotate.y < 0 
+			|| splinePos->rotate.x >= ownerBuf.GetWidth() || splinePos->rotate.y >= ownerBuf.GetHeight())
+			continue;
+
+		ownerBuf.SetPixel(splinePos->rotate.x,splinePos->rotate.y,255);
+	}
+
+	CString				strimg;
+	strimg.Format(_T("C:\\RCutProject\\Spline\\%s_%s_org.bmp"),strRecipe,strCut);
+	CBufferAttach		attach(strimg);
+	attach.AttachToFile(ownerBuf);
+
+	return TRUE;
+}
+
+BOOL CSplineModel::AdjustTilt(std::multimap<int, CSplinePoint> *pPos)
+{
+	double		dAngle,dAdjustAngle;
+	double		dCenX,dCenY;
+	CEdgeProc	EdgeProc;
+
+	dAngle = GetTilt(pPos,dCenX,dCenY);
+
+	dAdjustAngle = -90-dAngle; 
+	/*if(dAdjustAngle == 0)
+		return TRUE;*/
+
+	CPoint		pointOut;
+	CPoint		pointMin(INT_MAX,INT_MAX);
+
+	std::multimap<int, CSplinePoint>::iterator itData,itLoop;
+	CSplinePoint	*splinePos;
+	
+
+	for(itData=pPos->begin();itData!=pPos->end();itData++)
+	{		
+		splinePos = static_cast<CSplinePoint*>(&itData->second);
+		if(splinePos == NULL)
+			continue;
+
+		EdgeProc.RotatePoint(splinePos->origin,&pointOut,CPoint((int)dCenX,(int)dCenY),sin(M_RADIAN(dAdjustAngle)), cos(M_RADIAN(dAdjustAngle)));
+		splinePos->rotate = pointOut;
+
+		if(splinePos->rotate.x < pointMin.x) pointMin.x = splinePos->rotate.x;
+		if(splinePos->rotate.y < pointMin.y) pointMin.y = splinePos->rotate.y;		
+	}
+
+	return TRUE;
+}
+
+double CSplineModel::GetTilt(std::multimap<int, CSplinePoint> *pPos,double &dCenX,double &dCenY)
+{
+	int			nRange = 10;
+	int			nDiffDist = 200;
+	CPoint		pointSum[2];
+
+	if((int)pPos->size() < nRange*2+nDiffDist)
+		return 0.;
+
+	std::multimap<int, CSplinePoint>::iterator it;
+	vector<pair<int,CSplinePoint>> vec;
+
+	for(it = pPos->begin(); it != pPos->end(); ++it)
+	{
+		vec.push_back(make_pair(it->second.origin.y,it->second));
+	}
+	std::sort(vec.begin(),vec.end(),SortOrginYPos());
+
+	ZeroMemory(pointSum,sizeof(CPoint)*2);
+	int			iPos;
+
+	iPos = 0;
+	CSplinePoint	splinePos;
+	for(iPos = 0; iPos < nRange; iPos++)
+	{
+		splinePos = vec[iPos].second;
+
+		pointSum[0].x += splinePos.origin.x;
+		pointSum[0].y += splinePos.origin.y;
+	}
+
+	iPos = 0;
+	for(iPos = nRange+nDiffDist; iPos < nRange+nDiffDist+nRange; iPos++)	
+	{
+		splinePos = vec[iPos].second;
+		pointSum[1].x += splinePos.origin.x;
+		pointSum[1].y += splinePos.origin.y;
+	}
+
+	double		dXPos[2],dYPos[2];
+
+	dXPos[0] = (double)pointSum[0].x/(double)nRange;
+	dYPos[0] = (double)pointSum[0].y/(double)nRange;
+	dXPos[1] = (double)pointSum[1].x/(double)nRange;
+	dYPos[1] = (double)pointSum[1].y/(double)nRange;
+
+	dCenX = dXPos[0];
+	dCenY = dYPos[0];
+
+	return M_DEGREE( atan2(dYPos[1] - dYPos[0], dXPos[1] - dXPos[0]) );
+}
+
+//////////////////////////////////////////////////////////////////////////
+CSplineInspect::CSplineInspect(void)
+{
+	m_pLabelMap = NULL;
+	m_lpBuffer = NULL;
+	m_pContourMap = NULL;
+	m_pContourCnt = NULL;
+	m_pSpModel = NULL;
+	m_nCCCount = 0;	
+	m_szImageOrg = CSize(0,0);	
+	m_nDefectCount = 0;	
+}
+
+CSplineInspect::CSplineInspect(CSISBuffer *lpBuffer)
+{
+	m_pLabelMap = NULL;
+	m_lpBuffer = NULL;
+	m_pContourMap = NULL;	
+	m_pContourCnt = NULL;
+	m_pSpModel = NULL;
+	m_nCCCount = 0;	
+	m_szImageOrg = CSize(0,0);	
+	SetImage(lpBuffer);
+}
+
+CSplineInspect::~CSplineInspect(void)
+{	
+	ReleaseBuffer();
+	ResetValue();
+}
+
+void CSplineInspect::ReleaseBuffer()
+{
+	int		i;
+
+	if(m_pLabelMap != NULL)
+	{
+		for(i = 0; i < m_szImageOrg.cy; i++)
+		{
+			if(m_pLabelMap[i] != NULL)
+			{
+				delete[] m_pLabelMap[i];
+				m_pLabelMap[i] = NULL;				
+			}
+		}
+		delete[] m_pLabelMap;
+		m_pLabelMap=NULL;
+	}
+
+	if(m_pContourMap != NULL)
+	{
+		for(i = 0; i < m_szImageOrg.cy; i++)
+		{
+			if(m_pContourMap[i] != NULL)
+			{
+				delete[] m_pContourMap[i];
+				m_pContourMap[i] = NULL;				
+			}
+		}
+		delete[] m_pContourMap;
+		m_pContourMap=NULL;
+	}
+	
+	m_nCCCount = 0;
+
+	if(m_pContourCnt != NULL)
+		delete[] m_pContourCnt, m_pContourCnt=NULL;
+
+	m_nSplineOffsetX = m_nSplineOffsetY = 0;
+	
+}
+
+
+void CSplineInspect::ResetValue()
+{
+	m_dImageTheta = 0.;
+	m_pointPosLeft = m_pointDiffImg = CPoint(0,0);
+	m_mapSplinePos.clear();		
+
+	ZeroMemory(m_dResultData,sizeof(double)*SPLINE_RESULT_DATA_CNT);
+
+	m_insSplineOrg.ReleaseSpace();
+	m_insSplineRes.ReleaseSpace();
+
+	ReleaseBlob();
+}
+
+void CSplineInspect::ReleaseBlob()
+{
+	m_nDefectCount = 0;
+}
+
+BOOL CSplineInspect::FindForeLine(CSISBuffer &pBuffer,int *nForeLine,double &dTheta)
+{
+	CRect		rectLine;
+	int			nSize = 50,nSkipSize=200;	
+	int			nVertSkipSize = 50;
+	int			u,v;	
+	int			nLineCnt;
+	CPoint		nLinePos[2];
+	int			nDetLine = (int)((double)nSize*0.3);
+	BOOL		bRet;		
+
+	nForeLine[0] = nForeLine[1] = -1;
+	nLinePos[0] = nLinePos[1] = -1;	
+
+	rectLine = CRect(pBuffer.GetWidth()-nSize-nVertSkipSize,0,pBuffer.GetWidth()-1-nVertSkipSize,pBuffer.GetHeight()-1);		
+
+	bRet = FALSE;
+	for(v=rectLine.top;v<rectLine.bottom;v++)	
+	{
+		if(nLinePos[0].y > 0 && nLinePos[1].y > 0)
+		{
+			bRet = TRUE;
+			break;
+		}
+
+		nLineCnt = 0;
+		for(u=rectLine.left;u<rectLine.right;u++)
+		{
+			if(*pBuffer.GetDataAddress(u,v) == 255)
+				nLineCnt++;
+		}
+		if(nLineCnt >= nDetLine)
+		{
+			nLinePos[0].y = v;
+			nLinePos[0].x = rectLine.right;
+		}
+
+		nLineCnt = 0;
+		for(u=rectLine.left-nSkipSize;u<rectLine.right-nSkipSize;u++)
+		{
+			if(*pBuffer.GetDataAddress(u,v) == 255)
+				nLineCnt++;
+		}
+		if(nLineCnt >= nDetLine)
+		{
+			nLinePos[1].y = v;
+			nLinePos[1].x = rectLine.left-nSkipSize;
+		}
+	}
+
+	if(bRet == TRUE)
+	{
+		nForeLine[1] = (nLinePos[0].y+nLinePos[1].y)/2;		
+	}	
+
+
+	bRet = FALSE;
+	nLinePos[0] = nLinePos[1] = -1;
+
+	rectLine = CRect(0,pBuffer.GetHeight()-nSize,pBuffer.GetWidth(),pBuffer.GetHeight()-1);			
+	for(u=rectLine.left;u<rectLine.right;u++)
+	{
+		if(nLinePos[0].x > 0 && nLinePos[1].x > 0)
+		{
+			bRet = TRUE;
+			break;
+		}
+
+		nLineCnt = 0;
+		for(v=rectLine.top;v<rectLine.bottom;v++)
+		{
+			if(*pBuffer.GetDataAddress(u,v) == 255)
+				nLineCnt++;
+		}
+		if(nLineCnt >= nDetLine)
+		{
+			nLinePos[0].x = u;
+			nLinePos[0].y = rectLine.top;
+		}
+
+		nLineCnt = 0;
+		for(v=rectLine.top-nSkipSize;v<rectLine.bottom-nSkipSize;v++)
+		{
+			if(*pBuffer.GetDataAddress(u,v) == 255)
+				nLineCnt++;
+		}
+		if(nLineCnt >= nDetLine)
+		{
+			nLinePos[1].x = u;			
+			nLinePos[1].y = rectLine.top-nSkipSize;
+		}
+	}
+
+	if(bRet == TRUE)
+	{
+		double		dXPos[2],dYPos[2];
+
+		nForeLine[0] = (nLinePos[0].x+nLinePos[1].x)/2;
+
+		dXPos[0] = (double)nLinePos[0].x;
+		dYPos[0] = (double)nLinePos[0].y;
+		dXPos[1] = (double)nLinePos[1].x;
+		dYPos[1] = (double)nLinePos[1].y;
+
+		dTheta = -90-M_DEGREE(atan2(dYPos[1] - dYPos[0], dXPos[1] - dXPos[0]));
+	}
+
+	if(dTheta <= 2)
+		dTheta = 0.;
+
+	return TRUE;
+}
+
+BOOL CSplineInspect::ShiftNRotateImage(CSISBuffer pOrg,CSISBuffer pBin,COwnerBuffer &pProcess,COwnerBuffer &pProcImg,int *nForeLine,double dTheta,CPoint &pPosImg)
+{
+	if(pOrg.IsValidBuffer() == FALSE || pBin.IsValidBuffer() == FALSE)
+		return FALSE;	
+	if(m_pSpModel == NULL)
+		return FALSE;
+	
+	CPoint		pointOut;	
+	int			v,nSize;
+	CPoint		pointOrg,pointTgt;
+
+	CPoint		ptMasterMin = m_pSpModel->GetptMasterMin();
+	CPoint		ptMasterMax = m_pSpModel->GetptMasterMax();
+
+	pointOrg = pointTgt = CPoint(0,0);
+
+	if(nForeLine[0] > ptMasterMin.x)		
+		pointOrg.x = nForeLine[0]-ptMasterMin.x;					
+	else		
+		pointTgt.x = ptMasterMin.x-nForeLine[0];
+
+	if(nForeLine[1] > ptMasterMin.y)
+		pointOrg.y = nForeLine[1]-ptMasterMin.y;
+	else
+		pointTgt.y = ptMasterMin.y-nForeLine[1];
+
+	int		nImgWidth = pBin.GetWidth();
+	nSize = align_4byte(pBin.GetWidth()-(pointOrg.x+pointTgt.x));	
+
+	pProcess.SetSize(nImgWidth,(int)((double)ptMasterMax.y+1));
+	pProcImg.SetSize(nImgWidth,(int)((double)ptMasterMax.y+1));
+	if(pProcess.IsValidBuffer() == FALSE || pProcImg.IsValidBuffer() == FALSE)
+		return FALSE;
+
+	ZeroMemory(pProcess.GetDataAddress(0,0),pProcess.GetDataSize());
+	ZeroMemory(pProcImg.GetDataAddress(0,0),pProcImg.GetDataSize());
+
+	//if(dTheta <= 0)		// Shift父
+	{					
+		for(v=pointOrg.y;v<pBin.GetHeight();v++,pointTgt.y++)	
+		{			
+			if(pointTgt.y >= pProcess.GetHeight())
+				break;
+
+			CopyMemory(pProcess.GetDataAddress(pointTgt.x,pointTgt.y),pBin.GetDataAddress(pointOrg.x,v),sizeof(BYTE)*nSize);
+			CopyMemory(pProcImg.GetDataAddress(pointTgt.x,pointTgt.y),pOrg.GetDataAddress(pointOrg.x,v),sizeof(BYTE)*nSize);
+		}		
+	}
+	/*else
+	{
+		int			u;
+		CPoint		pointOrg,pointBase;
+		
+		pointBase = CPoint(nForeLine[0],pOrg.GetHeight()-1);
+
+		for(v=pointOrg.y;v<pOrg.GetHeight();v++)	
+		{
+			for(u=pointOrg.x;u<nSize;u++)
+			{
+				pointOrg = CPoint(u,v);
+				RotatePoint(pointOrg,&pointOut,pointBase,sin(M_RADIAN(dTheta)), cos(M_RADIAN(dTheta)));
+
+				pointOut.x += pointTgt.x;
+				pointOut.y += pointTgt.y;
+				if(pointOut.x < 0 || pointOut.x >= pTgt.GetWidth() || pointOut.y < 0 || pointOut.y >= pTgt.GetHeight())
+					continue;
+
+				pTgt.SetPixel(pointOut.x,pointOut.y,*pOrg.GetDataAddress(u,v));
+			}
+		}
+	}*/
+
+	/*
+	if(pProcess.IsValidBuffer() == TRUE)
+	{
+		CString				str;
+
+		str.Format(_T("D:\\Image\\Spline\\RotateProc.bmp"));
+		CBufferAttach		attach(str);
+		attach.AttachToFile(pProcess);
+
+		str.Format(_T("D:\\Image\\Spline\\RotateProcImg.bmp"));
+		CBufferAttach		attach2(str);
+		attach2.AttachToFile(pProcImg);
+	}	
+	*/
+
+	return TRUE;
+}
+
+int CSplineInspect::GetSplineValue(CEdgeProc &EdgeProc,CSISBuffer pOrg,double dXPos,double dYPos)
+{	
+	if((int)dXPos >= pOrg.GetWidth()-3 || (int)dYPos >= pOrg.GetHeight()-3
+		|| (int)dXPos < 1 || (int)dYPos < 1 || pOrg.IsValidBuffer() == FALSE)
+		return 0;		
+
+	float			dMod,dXValue,dYValue;
+	int				nIntPosX,nIntPosY;	
+
+	nIntPosX = (int)dXPos;
+	nIntPosY = (int)dYPos;
+
+	LPBYTE			pImg = pOrg.GetDataAddress(nIntPosX-1,nIntPosY);
+
+	dMod = (float)dXPos-(float)nIntPosX;
+	dXValue = EdgeProc.catmullRomSpline(dMod,*pImg,*(pImg+1),*(pImg+2),*(pImg+3));
+
+	dMod = (float)dYPos-(float)nIntPosY;
+	pImg = pOrg.GetDataAddress(nIntPosX,nIntPosY-1);
+	dYValue = EdgeProc.catmullRomSpline(dMod,*pImg,*(pImg+pOrg.GetDataWidth()),*(pImg+pOrg.GetDataWidth()*2),*(pImg+pOrg.GetDataWidth()*3));
+
+	return (int)((dXValue+dYValue)/2.);
+}
+
+BOOL CSplineInspect::DistInspection(CEdgeProc &EdgeProc,CSISBuffer &pTgt,double *dResult,double *dRangeRes)
+{	
+	if(m_pSpModel == NULL)
+		return FALSE;
+
+	std::multimap<int, CPoint>::iterator	it;
+	CPoint					pointOrg,pointSet;
+	int						nCount=0,nLineSampleDet = 10;	
+	sPoint					*pLinedata = NULL;	
+	double					dAdjustTheta;	
+	const	int				nDetOffset = 50;
+	const	int				nDEF_LINE_COUNT = nLineSampleDet/3;
+	int						iCnt,nValue,nDetPointCnt,iHorCnt;	
+	CDetectPoint			*pDetPoint;
+	int						*pSampleHorCnt;
+	CSplinePoint			pSpPoint;
+	double					dSumDist,dSumCnt,dMaxAvg;
+	double					dAvg=0.,dSum=0.,dDist=0.;			
+	int						nDetRange = 5,nMargin=200;
+	double					dOutX,dOutY;	
+	std::vector<double>		vecDist;
+
+	TRACE("=====================================================================\r\n");
+	TRACE("Inspect Start\r\n");
+
+	//m_Log.DisplayEdgeLog("=====================================================================");
+	//m_Log.DisplayEdgeLog("Inspect Start");
+
+	dSumDist = dSumCnt = dMaxAvg = 0;
+	pDetPoint = new CDetectPoint[nDetOffset*2];	
+	pSampleHorCnt = new int[nDetOffset*2];
+
+	std::multimap<int, CPoint> *pMasterData = m_pSpModel->GetMasterData();
+	CPoint ptMasterMin = m_pSpModel->GetptMasterMin();
+
+	pLinedata = new sPoint[nLineSampleDet];
+	for(it=pMasterData->begin();it!=pMasterData->end();it++)
+	{		
+		pointOrg = static_cast<CPoint>(it->second);	
+
+		pLinedata[nCount].x = pointOrg.x;
+		pLinedata[nCount].y = pointOrg.y;
+		nCount++;
+		if(nCount >= nLineSampleDet)
+		{
+			dAdjustTheta = EdgeProc.GetTheta(pLinedata,nLineSampleDet,5);						
+			ZeroMemory(pDetPoint,sizeof(CDetectPoint)*(nDetOffset*2));
+			nDetPointCnt = nCount = 0;
+			ZeroMemory(pSampleHorCnt,sizeof(int)*(nDetOffset*2));
+
+			for(iCnt=0;iCnt<nLineSampleDet;iCnt++)
+			{
+				pointOrg.x = pointSet.x = (int)pLinedata[iCnt].x;
+				pointOrg.y = pointSet.y = (int)pLinedata[iCnt].y;														
+				pointOrg.x -= nDetOffset;														
+
+				iHorCnt = 0;
+				for(int iU=-1*nDetOffset;iU<nDetOffset;iU++,pointOrg.x++,iHorCnt++)
+				{	
+					EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dAdjustTheta)), cos(M_RADIAN(dAdjustTheta)));				
+					nValue = pTgt.GetPixel((int)dOutX,(int)dOutY);
+					//nValue = GetSplineValue(EdgeProc,pTgt,dOutX,dOutY);
+
+					if(nValue > 0)
+					{
+						pDetPoint[iHorCnt].orgX = pointSet.x;
+						pDetPoint[iHorCnt].orgY = pointSet.y;
+						pDetPoint[iHorCnt].imgX = dOutX;
+						pDetPoint[iHorCnt].imgY = dOutY;
+						pDetPoint[iHorCnt].dTheta = dAdjustTheta;		
+
+						pSampleHorCnt[iHorCnt]++;
+					}
+				}			
+			}			
+
+			int		nDetIdx = -1;
+			for(iHorCnt=0;iHorCnt<nDetOffset*2;iHorCnt++)
+			{
+				if(pSampleHorCnt[iHorCnt] >= nDEF_LINE_COUNT)
+				{
+					nDetIdx = iHorCnt;
+					break;
+				}
+			}
+
+			if(nDetIdx < 0)
+			{
+				// 茫扁 角菩 沁阑版快, Max 蔼阑 持绰促.
+				dAvg = nDetOffset;
+				vecDist.push_back(dAvg);
+				continue;
+			}
+
+			if(pDetPoint[nDetIdx].imgX > 0 && pDetPoint[nDetIdx].imgY > 0)
+			{
+				dDist = sqrt(pow((pDetPoint[nDetIdx].orgX-pDetPoint[nDetIdx].imgX),2)+pow((pDetPoint[nDetIdx].orgY-pDetPoint[nDetIdx].imgY),2));
+				dAvg = dDist;						
+
+				if(abs(ptMasterMin.x-(int)pDetPoint[nDetIdx].imgX) <= nDetRange)
+				{
+					if(m_pointPosLeft.y > (int)pDetPoint[nDetIdx].imgY)
+					{
+						m_pointPosLeft.x = (int)pDetPoint[nDetIdx].imgX;
+						m_pointPosLeft.y = (int)pDetPoint[nDetIdx].imgY;
+					}
+				}			
+			}
+
+			if(dAvg > 1)
+			{
+				if(dMaxAvg < dAvg)
+					dMaxAvg = dAvg;
+				dSumDist += dAvg;
+				dSumCnt++;
+
+				vecDist.push_back(dAvg);
+			}
+		}
+	}
+
+	if(m_pointPosLeft.x != INT_MAX && m_pointPosLeft.y != INT_MAX)
+	{
+		m_pointPosLeft.y += nMargin;	
+		m_pointPosLeft.Offset(m_pointDiffImg.x,m_pointDiffImg.y);
+	}
+	else
+		m_pointPosLeft = CPoint(0,0);
+
+	delete[] pLinedata, pLinedata=NULL;
+	delete[] pDetPoint, pDetPoint=NULL;
+	delete[] pSampleHorCnt, pSampleHorCnt = NULL;
+
+
+	TRACE("=====================================================================\r\n");
+	//m_Log.DisplayEdgeLog("=====================================================================");
+
+	dResult[0] = dMaxAvg;
+	if(dSumCnt > 0)
+		dResult[1] = dSumDist/dSumCnt;
+	//m_Log.DisplayEdgeLog("dResult = %f, dSumCnt = %f",dResult[1]*10.0816502900-10,dSumCnt);
+
+	int nMaxCount=0;
+	int nCurIndex=1;
+
+	if((int)vecDist.size() > 5)
+	{
+		int			nJumpVal = (int)dSumCnt/5;
+		int			nIndex = 0;
+		if(nJumpVal <= 0)
+			return TRUE;
+
+		double dAverage = 0;
+		double dCount = 0;
+		for(std::vector<double>::iterator it=vecDist.begin();it!=vecDist.end();it++,nCurIndex++)
+		{
+			double dtemp = *it;
+
+			if(dtemp != nDetOffset)
+			{
+				dAverage += dtemp;
+				dCount++;
+			}
+
+			if(nIndex == 4)
+			{
+				nMaxCount=nJumpVal+(int)dSumCnt%5;
+			}
+			else
+			{
+				nMaxCount=nJumpVal;
+			}
+
+			if(nCurIndex >= nMaxCount)
+			{			
+				if(nIndex >= 5)
+					break;
+				if(dSumCnt != 0)
+					dRangeRes[nIndex] = dAverage/dCount;
+				else
+					dRangeRes[nIndex] = 1;
+
+				dAverage = 0;
+				dCount = 0;
+				nIndex++;
+				nCurIndex=0;
+			}
+		}
+	}
+
+	return TRUE;
+}
+
+double CSplineInspect::GetTilt(std::multimap<int, CSplinePoint> *pPos,double &dCenX,double &dCenY)
+{
+	int			nRange = 10;
+	int			nDiffDist = 200;
+	CPoint		pointSum[2];
+
+	if((int)pPos->size() < nRange*2+nDiffDist)
+		return 0.;
+
+	std::multimap<int, CSplinePoint>::iterator it;
+	vector<pair<int,CSplinePoint>> vec;
+
+	for(it = pPos->begin(); it != pPos->end(); ++it)
+	{
+		vec.push_back(make_pair(it->second.origin.y,it->second));
+	}
+	std::sort(vec.begin(),vec.end(),SortOrginYPos());
+
+	ZeroMemory(pointSum,sizeof(CPoint)*2);
+	int			iPos;
+
+	iPos = 0;
+	CSplinePoint	splinePos;
+	for(iPos = 0; iPos < nRange; iPos++)
+	{
+		splinePos = vec[iPos].second;
+
+		pointSum[0].x += splinePos.origin.x;
+		pointSum[0].y += splinePos.origin.y;
+	}
+
+	iPos = 0;
+	for(iPos = nRange+nDiffDist; iPos < nRange+nDiffDist+nRange; iPos++)	
+	{
+		splinePos = vec[iPos].second;
+		pointSum[1].x += splinePos.origin.x;
+		pointSum[1].y += splinePos.origin.y;
+	}
+
+	double		dXPos[2],dYPos[2];
+
+	dXPos[0] = (double)pointSum[0].x/(double)nRange;
+	dYPos[0] = (double)pointSum[0].y/(double)nRange;
+	dXPos[1] = (double)pointSum[1].x/(double)nRange;
+	dYPos[1] = (double)pointSum[1].y/(double)nRange;
+
+	dCenX = dXPos[0];
+	dCenY = dYPos[0];
+
+	return M_DEGREE( atan2(dYPos[1] - dYPos[0], dXPos[1] - dXPos[0]) );
+}
+
+BOOL CSplineInspect::AdjustTilt(std::multimap<int, CSplinePoint> *pPos)
+{
+	double		dAngle,dAdjustAngle;
+	double		dCenX,dCenY;
+	CEdgeProc	EdgeProc;
+
+	dAngle = GetTilt(pPos,dCenX,dCenY);
+
+	dAdjustAngle = -90-dAngle; 
+	/*if(dAdjustAngle == 0)
+		return TRUE;*/
+
+	CPoint		pointOut;
+	CPoint		pointMin(INT_MAX,INT_MAX);
+
+	std::multimap<int, CSplinePoint>::iterator itData,itLoop;
+	CSplinePoint	*splinePos;
+	
+
+	for(itData=pPos->begin();itData!=pPos->end();itData++)
+	{		
+		splinePos = static_cast<CSplinePoint*>(&itData->second);
+		if(splinePos == NULL)
+			continue;
+
+		EdgeProc.RotatePoint(splinePos->origin,&pointOut,CPoint((int)dCenX,(int)dCenY),sin(M_RADIAN(dAdjustAngle)), cos(M_RADIAN(dAdjustAngle)));
+		splinePos->rotate = pointOut;
+
+		if(splinePos->rotate.x < pointMin.x) pointMin.x = splinePos->rotate.x;
+		if(splinePos->rotate.y < pointMin.y) pointMin.y = splinePos->rotate.y;		
+	}
+
+	for(itData=m_mapSplinePos.begin();itData!=m_mapSplinePos.end();itData++)
+	{		
+		splinePos = static_cast<CSplinePoint*>(&itData->second);
+		if(splinePos == NULL)
+			continue;
+
+		splinePos->rotate.Offset(-pointMin.x,-pointMin.y);		
+	}
+
+	return TRUE;
+}
+
+
+
+void CSplineInspect::MakeSplineResultImage(COwnerBuffer &pRes,CSISBuffer &pProcess)
+{
+	if(pProcess.IsValidBuffer() == FALSE)
+		return;
+	if(m_pSpModel == NULL)
+		return;
+
+	std::multimap<int, CPoint>::iterator	it;
+	CPoint				pointData;
+	int					nWidth = align_4byte(pProcess.GetWidth());
+
+	pRes.SetSize(nWidth,pProcess.GetHeight());
+	CopyMemory(pRes.GetDataAddress(0,0),pProcess.GetDataAddress(0,0),pProcess.GetDataSize());
+
+	std::multimap<int, CPoint> *pMasterData = m_pSpModel->GetMasterData();	
+
+	for(it=pMasterData->begin();it!=pMasterData->end();it++)
+	{	
+		pointData = static_cast<CPoint>(it->second);
+
+		if(pointData.x >= pRes.GetWidth() || pointData.y >= pRes.GetHeight()
+			|| pointData.x < 0 || pointData.y < 0)
+			continue;		
+
+		pRes.SetPixel(pointData.x,pointData.y,100);
+	}
+}
+
+SPLINE_ERR_MSG CSplineInspect::InspectSpline(CSISBuffer &pImg,CRect &rectCrop,int nDetDist,int nThres,BOOL bFlip,BOOL bSaveImg,BOOL bSaveDebug)
+{
+	ResetValue();
+
+	if(pImg.IsValidBuffer() == FALSE)
+		return ERR_SPLINE_IMAGE_NULL;		
+
+	bSaveDebug =FALSE;
+	
+	if(bSaveDebug == TRUE)
+	{
+		CString				strImg = _T("D:\\Image\\Spline\\CropImg_2.bmp");		
+		CBufferAttach		attachDefect(strImg);
+		attachDefect.AttachToFile(pImg);	
+	}
+
+	m_insSplineOrg.SetSize(rectCrop.Width(),rectCrop.Height());
+	CopyRectImg(pImg.GetDataAddress(),m_insSplineOrg.GetDataAddress(),CSize(pImg.GetDataWidth(),pImg.GetHeight()),rectCrop);	
+	if(bFlip == TRUE)	
+		m_insSplineOrg.FlipUpDown();		
+
+	return SPLINE_INS_SUCESS;
+
+	if(bSaveDebug == TRUE)
+	{
+		CString				strImg = _T("D:\\Image\\Spline\\CropImg_3.bmp");		
+		CBufferAttach		attachDefect(strImg);
+		attachDefect.AttachToFile(m_insSplineOrg);	
+	}
+
+	CEdgeProc		EdgeProc;
+	CRect			rect(0,0,m_insSplineOrg.GetWidth(),m_insSplineOrg.GetHeight());		
+	COwnerBuffer	BufferCanny(m_insSplineOrg.GetWidth(),m_insSplineOrg.GetHeight());	
+	if(BufferCanny.IsValidBuffer() == FALSE)
+		return ERR_SPLINE_IMAGE_NULL_02;
+
+	ZeroMemory(BufferCanny.GetDataAddress(),BufferCanny.GetDataSize());
+	EdgeProc.CannyEdgeProcessing(m_insSplineOrg.GetDataAddress(0,0),rect,GM_Sobel,nThres,BufferCanny);	
+
+	if(bSaveDebug == TRUE)
+	{
+		CString				strImg = _T("D:\\Image\\Spline\\Canny.bmp");		
+		CBufferAttach		attachDefect(strImg);
+		attachDefect.AttachToFile(BufferCanny);	
+	}
+
+	int			nForeLine[2];		
+	FindForeLine(BufferCanny,nForeLine,m_dImageTheta);
+	if(nForeLine[0] <= 0 || nForeLine[1] <= 0)		
+		return ERR_SPLINE_INDEXFIND;	
+
+	COwnerBuffer		pProcess,pProcImg;		
+
+	if(ShiftNRotateImage(m_insSplineOrg,BufferCanny,pProcess,pProcImg,nForeLine,m_dImageTheta,m_pointDiffImg) == FALSE)
+	{		
+		return ERR_SPLINE_INDEXFIND;
+	}
+
+	if(pProcess.IsValidBuffer() == FALSE || pProcImg.IsValidBuffer() == FALSE)
+		return ERR_SPLINE_IMAGE_NULL_03;		
+
+	DistInspection(EdgeProc,pProcess,m_dResultData,m_dRangeResult);
+
+	if(bSaveDebug == TRUE)
+	{
+		CString				strImg = _T("D:\\Image\\Spline\\Process.bmp");		
+		CBufferAttach		attachDefect(strImg);
+		attachDefect.AttachToFile(pProcess);	
+	}
+
+	if(bSaveImg == TRUE)
+		MakeSplineResultImage(m_insSplineRes,pProcess);	
+
+	if(bSaveDebug == TRUE)
+	{
+		CString				strImg = _T("D:\\Image\\Spline\\Res.bmp");		
+		CBufferAttach		attachDefect(strImg);
+		attachDefect.AttachToFile(m_insSplineRes);	
+	}
+
+	return SPLINE_INS_SUCESS;
+}
+
+BOOL CSplineInspect::CopyRectImg(LPBYTE pOrg,LPBYTE pTgt,CSize szImg,CRect &rectIns)
+{
+	if(pOrg == NULL || pTgt == NULL)
+		return FALSE;
+
+	int			v;
+	int			dv = 0;
+
+	for(v=rectIns.top;v<rectIns.bottom;v++,dv++)
+	{
+		CopyMemory(pTgt+dv*rectIns.Width(),pOrg+v*szImg.cx+rectIns.left,rectIns.Width());
+	}
+
+	return TRUE;
+}
+
+BOOL CSplineInspect::MakeCADLine(CHIP_INS_REGION & insRegion,std::multimap<int, CPoint> &mapData,CPoint &pointMin,CPoint &pointMax,SPLINECHIP_INS_METHOD enOpt)
+{
+	if(m_pSpModel == NULL)
+		return FALSE;
+
+	std::multimap<int, CPoint> *pMasterData = m_pSpModel->GetMasterData();
+	CPoint		ptMasterMin = m_pSpModel->GetptMasterMin();
+
+	if((int)pMasterData->size() <= 0)
+		return FALSE;
+
+	int		nStartX,nEndX;
+	CPoint	pointData;	
+	std::multimap<int, CPoint>::iterator	it;
+	std::multimap<int, CPoint>::iterator	lowerIter;
+	std::multimap<int, CPoint>::iterator	upperIter;
+
+	nStartX = insRegion.nStartX+ptMasterMin.x;
+	nEndX = insRegion.nEndX+ptMasterMin.x;
+
+	lowerIter = pMasterData->lower_bound(nStartX);
+	upperIter = pMasterData->upper_bound(nEndX);
+
+	switch(enOpt)
+	{
+	case METHOD_INS_LINE:
+		for(it = lowerIter; it != upperIter; it++)
+		{
+			pointData = static_cast<CPoint>(it->second);
+
+			if(pointData.x >= nStartX && pointData.x <= nEndX)
+			{
+				pointData.x -= nStartX;			
+				if(pointMin.y > pointData.y)									
+					pointMin = pointData;
+				if(pointMax.y < pointData.y)									
+					pointMax = pointData;
+				mapData.insert(std::make_pair(pointData.y, pointData));				
+			}
+		}
+		break;
+	case METHOD_INT_ROUND:		
+		for(it = lowerIter; it != upperIter; it++)
+		{
+			pointData = static_cast<CPoint>(it->second);
+
+			if(pointData.x >= nStartX && pointData.x <= nEndX)
+			{
+				pointData.x -= nStartX;			
+				if(pointMin.x > pointData.x)
+					pointMin = pointData;
+				if(pointMax.x < pointData.x)
+					pointMax = pointData;
+				mapData.insert(std::make_pair(pointData.x, pointData));				
+			}
+		}
+		break;
+	}
+
+	return TRUE;
+}
+
+double CSplineInspect::GetCAD2ImgOffset(std::multimap<int, CPoint> &mapData,CSISBuffer pBin,CPoint pointMin,CPoint pointMax,int nGap)
+{
+	double		dYPos = INT_MAX;	
+	int			u,v;	
+	int			*pImgPos = NULL;
+	int			*pCADPos = NULL;
+
+	int			nSampling = 4;
+
+	int			nWidth = pBin.GetWidth()/nSampling;
+
+	if(pointMin.x > pointMax.x)
+		return dYPos;
+
+	pImgPos = new int[nWidth];
+	pCADPos = new int[nWidth];
+
+	for(u=0;u<nWidth;u++)
+	{
+		pImgPos[u] = -1;
+		pCADPos[u] = -1;
+	}
+
+	BOOL bFirstFind = FALSE;
+	int nPreFind = 0;
+
+	int nFindStartY = nGap;
+	int nFindEndY = pBin.GetHeight();
+	
+	for(u=nWidth-1;u>=nWidth/2;u--)
+	{	
+// 		if(bFirstFind == TRUE)
+// 		{
+// 			nFindStartY = nPreFind - 8;
+// 			nFindEndY = nPreFind + 8;
+// 
+// 			nFindStartY = (nFindStartY < 0) ? 0 : nFindStartY;
+// 			nFindEndY = (pBin.GetHeight() <= nFindEndY) ? pBin.GetHeight()-1 : nFindEndY;
+// 		}
+
+		for(v=nFindStartY;v<nFindEndY;v++)
+		{
+			if(*pBin.GetDataAddress(u*nSampling,v) == 255)
+			{
+				pImgPos[u] = v;
+				bFirstFind = TRUE;
+				nPreFind = v;
+				break;
+			}
+		}
+		if(pImgPos[u] == 0)
+			pImgPos[u] = -1;
+	}
+
+	std::multimap<int, CPoint>::iterator it;
+	CPoint		pointData,pointDataMin;
+	int			iLoop;
+
+	int nStart = pointMin.x/nSampling;
+	int nEnd = pointMax.x/nSampling;
+
+	for(u=nStart,iLoop=0;u<=nEnd;u++,iLoop++)
+	{
+		int nX = u * nSampling;
+
+		if(iLoop >= nWidth)
+			break;
+
+		pointDataMin = CPoint(INT_MAX,INT_MAX);
+		for(it=mapData.begin();it!=mapData.end();it++)
+		{
+			pointData = static_cast<CPoint>(it->second);
+			if(pointData.x == nX && pointData.y < pointDataMin.y)
+			{
+				pointDataMin = pointData;				
+			}
+		}
+		if(iLoop < nWidth && pointDataMin.y != INT_MAX)
+			pCADPos[iLoop] = pointDataMin.y;
+
+		if(pCADPos[iLoop] == 0)
+			pCADPos[iLoop] = -1;
+	}
+
+	int			nOffsety,nOffsetCnt;
+
+	nOffsety = nOffsetCnt = 0;
+	for(u=0;u<nWidth;u++)
+	{
+		if(pCADPos[u] != -1 && pImgPos[u] != -1)
+		{
+			nOffsety += pImgPos[u]-pCADPos[u];
+			nOffsetCnt++;
+		}
+	}
+
+	if(nOffsetCnt > 0)
+		dYPos = (double)nOffsety/(double)nOffsetCnt;
+
+	delete[] pImgPos, pImgPos=NULL;
+	delete[] pCADPos, pCADPos=NULL;
+
+	return dYPos;
+}
+
+void CSplineInspect::MakeInspectResultImage(CSISBuffer &pRes,std::multimap<int, CSplinePoint> &mapIns)
+{
+	std::multimap<int, CSplinePoint>::iterator itData;
+	CSplinePoint	splinePos;
+
+	for(itData=mapIns.begin();itData!=mapIns.end();itData++)
+	{
+		splinePos = static_cast<CSplinePoint>(itData->second);		
+
+		if(splinePos.origin.x >= pRes.GetWidth() || splinePos.origin.y >= pRes.GetHeight()
+			|| splinePos.origin.x < 0 || splinePos.origin.y < 0)
+			continue;
+
+		pRes.SetPixel(splinePos.origin.x,splinePos.origin.y,255);
+	}	
+
+	int			nPair = m_ChamferIns.GetPairDefectCount();
+
+	CChipPair		*pPair;
+
+	for(int i = 0; i < nPair; i++)
+	{
+		pPair = m_ChamferIns.GetPairDefect(i);
+		if(pPair == NULL)
+			continue;
+
+		pRes.SetPixel(pPair->s_nDefectX,pPair->s_nDefectY,255);
+	}
+}
+
+void CSplineInspect::MakeInspectResultImage(CSISBuffer &pRes,std::multimap<int, CPoint> &mapIns)
+{
+	std::multimap<int, CPoint>::iterator itData;
+	CPoint	splinePos;
+
+	for(itData=mapIns.begin();itData!=mapIns.end();itData++)
+	{
+		splinePos = static_cast<CPoint>(itData->second);		
+
+		if(splinePos.x >= pRes.GetWidth() || splinePos.y >= pRes.GetHeight()
+			|| splinePos.y < 0 || splinePos.y < 0)
+			continue;
+
+		pRes.SetPixel(splinePos.x,splinePos.y,255);
+	}	
+}
+
+void CSplineInspect::MakeSplineDebugImg(COwnerBuffer &pRes,std::multimap<int, CPoint> *pMaster,std::multimap<int, CSplinePoint> *pData)
+{	
+	std::multimap<int, CPoint>::iterator	it;	
+	CPoint				pointData;	
+	int					nOffset = 20;
+
+	pRes.SetSize(m_szImageOrg.cx+nOffset,m_szImageOrg.cy+nOffset);	
+
+	if(pMaster != NULL)
+	{
+		for(it=pMaster->begin();it!=pMaster->end();it++)
+		{
+			pointData = static_cast<CPoint>(it->second);
+			pointData.Offset(nOffset,nOffset);
+			if(pointData.x >= pRes.GetWidth() || pointData.y >= pRes.GetHeight()
+				|| pointData.x < 0 || pointData.y < 0)
+				continue;						
+
+			pRes.SetPixel(pointData.x,pointData.y,200);
+		}
+	}
+
+	if(pData != NULL)
+	{
+		std::multimap<int, CSplinePoint>::iterator itData;
+		CSplinePoint	splinePos;
+
+		for(itData=pData->begin();itData!=pData->end();itData++)
+		{
+			splinePos = static_cast<CSplinePoint>(itData->second);
+			splinePos.rotate.Offset(nOffset,nOffset);
+
+			if(splinePos.rotate.x >= pRes.GetWidth() || splinePos.rotate.y >= pRes.GetHeight()
+				|| splinePos.rotate.x < 0 || splinePos.rotate.y < 0)
+				continue;
+
+			pRes.SetPixel(splinePos.rotate.x,splinePos.rotate.y,100);
+		}		
+	}
+}
+
+BOOL CSplineInspect::MakeInspectLine(std::multimap<int, CPoint> &mapData,std::multimap<int, CSplinePoint> &mapIns,double dYPos,SPLINECHIP_INS_METHOD enOpt)
+{	
+	if((int)mapData.size() <= 0)
+		return FALSE;
+
+	int			nOffsety = (int)dYPos;
+	std::multimap<int, CPoint>::iterator	it;		
+	CPoint		pointData;
+	CSplinePoint	splinePos;
+
+	switch(enOpt)
+	{
+	case METHOD_INS_LINE:	
+
+		break;
+	case METHOD_INT_ROUND:	
+		for(it=mapData.begin();it!=mapData.end();it++)
+		{
+			pointData = static_cast<CPoint>(it->second);
+
+			splinePos.Reset();
+			splinePos.origin = splinePos.rotate = pointData;		
+
+			splinePos.origin.Offset(0,nOffsety);
+			splinePos.rotate.Offset(0,nOffsety);
+			mapIns.insert(std::make_pair(pointData.x, splinePos));
+		}
+		break;
+	}	
+
+	return TRUE;
+}
+
+#define DEF_THICK_COUNT 3
+double CSplineInspect::FindThick(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CPoint pointSet,CPoint &pointRotate,double dTheta,int nDetThres)
+{
+	double			dThick = 0.;
+	double			dOutX,dOutY;
+	int				iU,nValue;
+	CPoint			pointOrg = pointSet;
+	const	int		nDetOffset = 100;	
+	int				nContiCnt;
+
+	nContiCnt = 0;
+	for(iU=0;iU<nDetOffset;iU++,pointOrg.x++)
+	{	
+		EdgeProc.RotatePoint(pointOrg,dOutX,dOutY,pointSet,sin(M_RADIAN(dTheta)), cos(M_RADIAN(dTheta)));					
+
+		nValue = pOrg.GetPixel((int)(dOutX+insRect.left),(int)(dOutY+insRect.top));
+		//nValue = GetSplineValue(EdgeProc,pOrg,dOutX+insRect.left,dOutY+insRect.top);
+
+		if(nValue >= nDetThres)
+			nContiCnt++;
+		else
+			nContiCnt = 0;
+
+		if(nContiCnt >= DEF_THICK_COUNT)
+		{
+			dThick = sqrt(pow(((double)pointSet.x-dOutX),2)+pow(((double)pointSet.y-dOutY),2))+1;
+			pointRotate = CPoint((int)dOutX,(int)dOutY);
+			break;
+		}
+	}
+
+	return dThick;
+}
+
+int	CSplineInspect::FilteringDefect(CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns,double dRes,int nJudge,CRect &insRect,BOOL bFlip)
+{
+	if(m_nDefectCount <= 0)
+		return m_nDefectCount;
+
+	int			i;
+	std::multimap<int, CSplinePoint>::iterator	it;
+	CSplinePoint		*splinePos;	
+	std::vector<CChipBlob> vecBlob;
+	int			nSize,nDist;
+	int			nRange = 2;
+	CPoint		ptIns;
+	CRect		rect;
+
+	for(i=0;i<m_nDefectCount;i++)
+	{
+		CChipBlob	*pChipBlob = &m_ResultDefect[i];
+
+		switch(insRegion.emDir)
+		{
+		case SPLINE_INS_DIRECTION_X:
+			nSize = (int)(pChipBlob->s_DefectRect.Width()*dRes);		
+			break;
+		case SPLINE_INS_DIRECTION_Y:			
+			nSize = (int)(pChipBlob->s_DefectRect.Height()*dRes);	
+			break;
+		}
+
+		if(nSize < nJudge)
+			continue;
+
+		for(it=mapIns.begin();it!=mapIns.end();it++)
+		{
+			splinePos = static_cast<CSplinePoint*>(&it->second);
+			if(splinePos == NULL)
+				continue;
+
+			switch(insRegion.emDir)
+			{
+			case SPLINE_INS_DIRECTION_X:
+				ptIns = splinePos->origin;
+				ptIns.Offset(insRegion.nSkipDist,0);
+
+				if(pChipBlob->s_DefectRect.top > ptIns.y || pChipBlob->s_DefectRect.bottom < ptIns.y)
+					continue;
+
+				if(pChipBlob->s_DefectRect.PtInRect(ptIns) == TRUE)
+					nDist = 0;
+				else
+					nDist = abs(ptIns.x-pChipBlob->s_DefectRect.left);
+				break;
+			case SPLINE_INS_DIRECTION_Y:
+				ptIns = splinePos->origin;
+				ptIns.Offset(0,insRegion.nSkipDist);
+				
+				if(pChipBlob->s_DefectRect.left > ptIns.x || pChipBlob->s_DefectRect.right < ptIns.x)
+					continue;
+
+				if(pChipBlob->s_DefectRect.PtInRect(ptIns) == TRUE)
+					nDist = 0;
+				else
+					nDist = abs(ptIns.y-pChipBlob->s_DefectRect.top);
+				break;
+			}
+
+			if(nDist < nRange)
+			{
+				vecBlob.push_back(*pChipBlob);
+				break;
+			}
+		}
+	}
+
+	m_nDefectCount = 0;
+
+	std::vector<CChipBlob>::iterator itBlob;
+
+	for(itBlob=vecBlob.begin();itBlob!=vecBlob.end();itBlob++)
+	{
+		if(m_nDefectCount >= MAX_SPLINE_DEFECT_COUNT)
+			return m_nDefectCount;				
+
+		CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+
+		*pChipBlob = *itBlob;
+
+		pChipBlob->s_DefectRect.OffsetRect(insRect.left,insRect.top);
+		pChipBlob->s_nDefectX += insRect.left;
+		pChipBlob->s_nDefectY += insRect.top;
+		pChipBlob->s_nDefectRScale = (int)pChipBlob->s_dThick;
+
+		if(bFlip == TRUE)
+		{
+			pChipBlob->s_DefectRect.top = insRect.Height()-pChipBlob->s_DefectRect.top;
+			pChipBlob->s_DefectRect.bottom = insRect.Height()-pChipBlob->s_DefectRect.bottom;
+			std::swap(pChipBlob->s_DefectRect.top,pChipBlob->s_DefectRect.bottom);
+			pChipBlob->s_nDefectY = insRect.Height()-pChipBlob->s_nDefectY;
+		}
+
+		m_nDefectCount++;
+	}
+
+	return m_nDefectCount;
+}
+
+int CSplineInspect::InspectChipBin(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns)
+{
+	std::multimap<int, CSplinePoint>::iterator	it;
+	CSplinePoint		*splinePos;	
+	CPoint				ptIns,ptEnd;
+	int					nValue,x,y;
+
+	m_ChamferIns.ResetPairDefect();
+
+	if(insRegion.emDir == SPLINE_INS_DIRECTION_X)
+	{
+		for(it=mapIns.begin();it!=mapIns.end();it++)
+		{
+			splinePos = static_cast<CSplinePoint*>(&it->second);
+			if(splinePos == NULL)
+				continue;
+
+			ptIns = splinePos->origin;
+			ptIns.Offset(insRegion.nSkipDist+insRect.left,insRect.top);
+			ptEnd = ptIns;
+			ptEnd.Offset(insRegion.nInsRange,0);
+
+			if(ptIns.x < 0 || ptIns.y < 0 || ptIns.x >= pOrg.GetWidth() || ptIns.y >= pOrg.GetHeight())
+				continue;
+			if(ptEnd.x < 0 || ptEnd.y < 0 || ptEnd.x >= pOrg.GetWidth() || ptEnd.y >= pOrg.GetHeight())
+				continue;
+			if(ptIns.x >= ptEnd.x)
+				continue;
+
+			for(x=ptIns.x ; x<ptEnd.x ; x++)
+			{
+				nValue = pOrg.GetPixel(x,ptIns.y);
+				if(nValue <= insRegion.nFindThres)
+				{
+					m_ChamferIns.InsertPairing(x-insRect.left,(int)ptIns.y-insRect.top,1,0,0,0,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,FALSE,0);	
+				}
+// 				else
+// 					break;
+			}
+		}
+	}
+	else
+	{
+		for(it=mapIns.begin();it!=mapIns.end();it++)
+		{
+			splinePos = static_cast<CSplinePoint*>(&it->second);
+			if(splinePos == NULL)
+				continue;
+
+			ptIns = splinePos->origin;
+			ptIns.Offset(insRect.left,insRegion.nSkipDist+insRect.top);
+			ptEnd = ptIns;
+			ptEnd.Offset(0,insRegion.nInsRange);
+
+			if(ptIns.x < 0 || ptIns.y < 0 || ptIns.x >= pOrg.GetWidth() || ptIns.y >= pOrg.GetHeight())
+				continue;
+			if(ptEnd.x < 0 || ptEnd.y < 0 || ptEnd.x >= pOrg.GetWidth() || ptEnd.y >= pOrg.GetHeight())
+				continue;
+			if(ptIns.y >= ptEnd.y)
+				continue;
+
+			for(y=ptIns.y ; y<ptEnd.y ; y++)
+			{
+				nValue = pOrg.GetPixel(ptIns.x,y);
+				if(nValue <= insRegion.nFindThres)
+				{
+					m_ChamferIns.InsertPairing((int)ptIns.x-insRect.left,y-insRect.top,1,0,0,0,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,FALSE,0);	
+				}
+// 				else
+// 					break;
+			}
+		}
+	}
+	
+	if(m_ChamferIns.GetPairDefectCount() > 0)
+	{
+		std::vector<CChipBlob> vecBlob;
+		m_ChamferIns.BlobDefect_Pixel(vecBlob,0,4);
+
+		if((int)vecBlob.size() > 0)
+		{
+			std::vector<CChipBlob>::iterator itBlob;
+
+			for(itBlob=vecBlob.begin();itBlob!=vecBlob.end();itBlob++)
+			{
+				if(m_nDefectCount >= MAX_SPLINE_DEFECT_COUNT)
+					return m_nDefectCount;				
+				
+				CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+
+				*pChipBlob = *itBlob;
+
+				pChipBlob->s_nDefectRScale = (int)pChipBlob->s_dThick;				
+
+				m_nDefectCount++;
+			}	
+		}
+	}
+
+
+	return m_nDefectCount;
+}
+
+int CSplineInspect::InspectChipBin_Diagonal(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns)
+{
+	std::multimap<int, CSplinePoint>::iterator	it;
+	CSplinePoint		*splinePos;	
+	CPoint				ptIns,ptEnd;
+	int					nValue,x,y;
+
+	m_ChamferIns.ResetPairDefect();
+
+	for(it=mapIns.begin();it!=mapIns.end();it++)
+	{
+		splinePos = static_cast<CSplinePoint*>(&it->second);
+		if(splinePos == NULL)
+			continue;
+
+		ptIns = splinePos->origin;
+		ptIns.Offset(insRegion.nSkipDist+insRect.left, insRegion.nSkipDist+insRect.top);
+		ptEnd = ptIns;
+		ptEnd.Offset(insRegion.nInsRange, insRegion.nInsRange);
+
+		if(ptIns.x < 0 || ptIns.y < 0 || ptIns.x >= pOrg.GetWidth() || ptIns.y >= pOrg.GetHeight())
+			continue;
+		if(ptEnd.x < 0 || ptEnd.y < 0 || ptEnd.x >= pOrg.GetWidth() || ptEnd.y >= pOrg.GetHeight())
+			continue;
+		if(ptIns.x >= ptEnd.x)
+			continue;
+
+		for(x=ptIns.x, y=ptIns.y; x<ptEnd.x && y<ptEnd.y ; x++)
+		{
+			nValue = pOrg.GetPixel(x, y);
+
+			if(nValue <= insRegion.nFindThres)
+			{
+				int nX = x - insRect.left;
+				int nY = y - insRect.top;
+
+				m_ChamferIns.InsertPairing(nX,nY,1,0,0,0,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,FALSE,0);
+			}
+		}
+
+		/*
+		for(y=ptIns.y ; y<ptEnd.y ; y++)
+		{
+			for(x=ptIns.x ; x<ptEnd.x ; x++)
+			{
+				nValue = pOrg.GetPixel(x, y);
+
+				if(nValue <= insRegion.nFindThres)
+				{
+					int nX = x - insRect.left;
+					int nY = y - insRect.top;
+
+					m_ChamferIns.InsertPairing(nX,nY,1,0,0,0,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,FALSE,0);
+				}
+			}
+		}
+		*/
+	}
+
+	if(m_ChamferIns.GetPairDefectCount() > 0)
+	{
+		std::vector<CChipBlob> vecBlob;
+		m_ChamferIns.BlobDefect_Pixel(vecBlob,0,2);
+
+		if((int)vecBlob.size() > 0)
+		{
+			std::vector<CChipBlob>::iterator itBlob;
+
+			for(itBlob=vecBlob.begin();itBlob!=vecBlob.end();itBlob++)
+			{
+				if(m_nDefectCount >= MAX_SPLINE_DEFECT_COUNT)
+					return m_nDefectCount;				
+
+				CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+
+				*pChipBlob = *itBlob;
+
+				pChipBlob->s_nDefectRScale = (int)pChipBlob->s_dThick;				
+
+				m_nDefectCount++;
+			}	
+		}
+	}
+
+
+	return m_nDefectCount;
+}
+
+double CSplineInspect::InspectChip(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns)
+{
+	sPoint				*pLinedata = NULL;
+	int					nLineCnt = 0;	
+	double				dAdjustTheta;			
+	std::multimap<int, CSplinePoint>::iterator	it;
+	CSplinePoint		*splinePos;	
+	double				dSumThick,dSumCnt;	
+
+	dSumThick = dSumCnt = 0.;
+	if(insRegion.emMethod == MAKE_METHOD_LINEAR)
+	{
+		pLinedata = new sPoint[(int)mapIns.size()+1];
+		for(it=mapIns.begin();it!=mapIns.end();it++)
+		{
+			splinePos = static_cast<CSplinePoint*>(&it->second);
+			if(splinePos == NULL)
+				continue;
+
+			pLinedata[nLineCnt].x = splinePos->origin.x;
+			pLinedata[nLineCnt].y = splinePos->origin.y;
+			nLineCnt++;
+		}
+
+		if(nLineCnt <= 0)
+		{
+			if(pLinedata != NULL)
+				delete[] pLinedata, pLinedata=NULL;
+			return TRUE;
+		}
+
+		dAdjustTheta = EdgeProc.GetTheta(pLinedata,nLineCnt,3);
+
+		for(it=mapIns.begin();it!=mapIns.end();it++)
+		{
+			splinePos = static_cast<CSplinePoint*>(&it->second);
+			if(splinePos == NULL)
+				continue;
+
+			splinePos->dTheta = dAdjustTheta;
+			splinePos->dThick =	FindThick(EdgeProc,pOrg,insRect,splinePos->origin,splinePos->rotate,dAdjustTheta,insRegion.nFindThres);		
+			TRACE("Thick Pos : org[%d,%d],roate[%d,%d],Thick[%.2f]\r\n",splinePos->origin.x,splinePos->origin.y,splinePos->rotate.x,splinePos->rotate.y,splinePos->dThick);
+			if(splinePos->dThick > 0)
+			{
+				dSumThick += splinePos->dThick;
+				dSumCnt++;
+			}
+		}
+	}
+	else
+	{
+		int				nCount=0,nLineSampleDet = 10;
+		CPoint			pointOrg,pointSet;
+		std::vector<CSplinePoint*> pvecSpPoint;
+		std::vector<CSplinePoint*>::iterator itData;
+
+		pLinedata = new sPoint[nLineSampleDet];
+		for(it=mapIns.begin();it!=mapIns.end();it++)
+		{		
+			splinePos = static_cast<CSplinePoint*>(&it->second);
+			if(splinePos == NULL)
+				continue;
+
+			pvecSpPoint.push_back(splinePos);
+			pLinedata[nCount].x = splinePos->origin.x;
+			pLinedata[nCount].y = splinePos->origin.y;
+			nCount++;
+			if(nCount >= nLineSampleDet)
+			{
+				dAdjustTheta = EdgeProc.GetTheta(pLinedata,nLineSampleDet,3);														
+
+				for(itData=pvecSpPoint.begin();itData!=pvecSpPoint.end();itData++)				
+				{
+					splinePos = *itData;		
+					if(splinePos == NULL)
+						continue;
+
+					splinePos->dTheta = dAdjustTheta;
+					splinePos->dThick =	FindThick(EdgeProc,pOrg,insRect,splinePos->origin,splinePos->rotate,dAdjustTheta,insRegion.nFindThres);	
+					TRACE("Thick Pos : org[%d,%d],roate[%d,%d],Thick[%.2f]\r\n",splinePos->origin.x,splinePos->origin.y,splinePos->rotate.x,splinePos->rotate.y,splinePos->dThick);
+					if(splinePos->dThick > 0)
+					{
+						dSumThick += splinePos->dThick;
+						dSumCnt++;
+					}		
+				}	
+				nCount = 0;
+				pvecSpPoint.clear();
+			}
+		}
+
+	}
+
+	delete[] pLinedata, pLinedata=NULL;	
+
+	return dSumCnt>0?dSumThick/dSumCnt:-1;
+}
+
+#define SP_CHIP_CONTI_COUNT	3
+
+int CSplineInspect::AnalysisThick(CEdgeProc &EdgeProc,CRect rectImg,double dRes,int nJudgeThick,double dAvgThick,BOOL bFlip,std::multimap<int, CSplinePoint> &mapIns)
+{	
+	std::multimap<int, CSplinePoint>::iterator	it;	
+	CSplinePoint		*splinePos;	
+	CResultDefect		resDefect;			
+	double				dOutX,dOutY,dThick;
+	CPoint				pointSet;	
+	std::vector<CChipPair>	vecPair;
+	vector<CChipBlob>::iterator	itData;
+	int					nDetCnt = 0;	
+
+	m_ChamferIns.ResetPairDefect();
+	for(it=mapIns.begin();it!=mapIns.end();it++)
+	{
+		splinePos = static_cast<CSplinePoint*>(&it->second);
+		if(splinePos == NULL)// || splinePos->dThick <= 0)
+			continue;			
+
+		dThick = fabs((splinePos->dThick*dRes)-dAvgThick);
+		if(dThick > nJudgeThick)		
+		{
+			nDetCnt++;
+			if(nDetCnt >= SP_CHIP_CONTI_COUNT)
+			{
+				pointSet = splinePos->origin;
+				pointSet.x += (int)(((dThick/dRes)/2)+(dAvgThick/dRes));
+				EdgeProc.RotatePoint(pointSet,dOutX,dOutY,splinePos->origin,sin(M_RADIAN(splinePos->dTheta)), cos(M_RADIAN(splinePos->dTheta)));
+				if(dOutX < 0 || dOutY < 0)
+					continue;
+
+				m_ChamferIns.InsertPairing((int)dOutX,(int)dOutY,1,0,0,0,CHIPREGTYPE_RIGHT,INS_DEFECT_CHIP,FALSE,dThick);	
+				nDetCnt = 0;
+			}	
+		}
+		else
+			nDetCnt=0;
+
+	}	
+
+	if(m_ChamferIns.GetPairDefectCount() > 0)
+	{
+		std::vector<CChipBlob> vecBlob;
+		m_ChamferIns.BlobDefect_Pixel(vecBlob,0,4);
+
+		if((int)vecBlob.size() > 0)
+		{
+			std::vector<CChipBlob>::iterator itBlob;
+
+			for(itBlob=vecBlob.begin();itBlob!=vecBlob.end();itBlob++)
+			{
+				if(m_nDefectCount >= MAX_SPLINE_DEFECT_COUNT)
+					return m_nDefectCount;
+
+				CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+
+				*pChipBlob = *itBlob;
+
+				pChipBlob->s_DefectRect.OffsetRect(rectImg.left,rectImg.top);
+				pChipBlob->s_nDefectX += rectImg.left;
+				pChipBlob->s_nDefectY += rectImg.top;
+				pChipBlob->s_nDefectRScale = (int)pChipBlob->s_dThick;
+
+				if(bFlip == TRUE)
+				{
+					pChipBlob->s_DefectRect.top = rectImg.Height()-pChipBlob->s_DefectRect.top;
+					pChipBlob->s_DefectRect.bottom = rectImg.Height()-pChipBlob->s_DefectRect.bottom;
+					std::swap(pChipBlob->s_DefectRect.top,pChipBlob->s_DefectRect.bottom);
+					pChipBlob->s_nDefectY = rectImg.Height()-pChipBlob->s_nDefectY;
+				}
+
+				m_nDefectCount++;
+			}	
+		}
+	}
+
+	return m_nDefectCount;
+}
+
+//#define SAVE_SPLINE_CHIP
+double CSplineInspect::InspectSplineChip(CSISBuffer pImg,int nPosLeft,CHIP_INS_REGION &insRegion,double dRes,int nJudgeThick,COwnerBuffer &pRes,BOOL bFlip
+	,int iReg,BOOL bSaveDebug,SPLINECHIP_INS_METHOD enOpt)
+{
+	double		dAvgThick = 0;
+
+	ReleaseBlob();
+
+	if(insRegion.bUse == FALSE || pImg.IsValidBuffer() == FALSE || nPosLeft <= 0)
+	{		
+		return dAvgThick;
+	}
+
+	CRect			insRect;		
+
+	insRect = CRect(nPosLeft+insRegion.nStartX,0,nPosLeft+insRegion.nEndX,pImg.GetHeight());
+	insRect.right= insRect.left + align_4byte(insRect.Width());
+	if(insRect.Width() <= 0 || insRect.Height() <= 0 || insRect.left < 0 || insRect.left >= pImg.GetWidth() || insRect.right <= 0 || insRect.right >= pImg.GetWidth())	
+		return dAvgThick;	
+
+	pRes.SetSize(insRect.Width(),insRect.Height());
+	ZeroMemory(pRes.GetDataAddress(0,0),pRes.GetDataSize());
+
+	CEdgeProc		EdgeProc;
+	CRect			rectBin(0,0,insRect.Width(),insRect.Height());
+	int				nAdpSize = 15;
+	COwnerBuffer	ProcBuf(insRect.Width(),insRect.Height());
+
+	if(CopyRectImg(pImg.GetDataAddress(0,0),ProcBuf.GetDataAddress(0,0),CSize(pImg.GetDataWidth(),pImg.GetHeight()),insRect) == FALSE)
+		return dAvgThick;
+	
+	if(bSaveDebug == TRUE)
+	{
+		if(ProcBuf.IsValidBuffer() == TRUE)
+		{
+			CString		str;
+			str.Format(_T("D:\\Image\\Spline\\[%d,%d]OrgImg.bmp"),bFlip,iReg);
+			CBufferAttach		attach(str);
+			attach.AttachToFile(ProcBuf);
+		}
+	}
+
+	int			nLineThres = insRegion.nThres;//(int)((double)insRegion.nFindThres - (double)insRegion.nFindThres*0.1);
+	EdgeProc.ThresholdProcessing(ProcBuf.GetDataAddress(0,0),CSize(ProcBuf.GetDataWidth(),ProcBuf.GetHeight()),nLineThres,0);
+
+	//EdgeProc.Adaptive_Binarization(ProcBuf.GetDataAddress(0,0),ProcBuf.GetWidth(),ProcBuf.GetHeight(),ProcBuf.GetDataWidth(),nAdpSize,0.2,ProcBuf.GetDataAddress(0,0),rectBin);
+
+	if(bSaveDebug == TRUE)
+	{
+		if(ProcBuf.IsValidBuffer() == TRUE)
+		{
+			CString		str;
+			str.Format(_T("D:\\Image\\Spline\\[%d,%d]Line_BinImg.bmp"),bFlip,iReg);
+			CBufferAttach		attach(str);
+			attach.AttachToFile(ProcBuf);
+
+			COwnerBuffer		pInsBin(insRect.Width(),insRect.Height());
+
+			if(CopyRectImg(pImg.GetDataAddress(0,0),pInsBin.GetDataAddress(0,0),CSize(pImg.GetDataWidth(),pImg.GetHeight()),insRect) == FALSE)
+				return dAvgThick;
+
+			EdgeProc.ThresholdProcessing(pInsBin.GetDataAddress(0,0),CSize(pInsBin.GetDataWidth(),pInsBin.GetHeight()),insRegion.nFindThres,0);
+
+			str.Format(_T("D:\\Image\\Spline\\[%d,%d]Defect_BinImg.bmp"),bFlip,iReg);
+			CBufferAttach		attach2(str);
+			attach2.AttachToFile(pInsBin);
+
+		}
+	}
+
+	std::multimap<int, CPoint>	mapData;
+	CPoint	 pointMin = CPoint(INT_MAX,INT_MAX);
+	CPoint	 pointMax = CPoint(0,0);
+	if(MakeCADLine(insRegion,mapData,pointMin,pointMax,enOpt) == FALSE)
+	{		
+		return dAvgThick;
+	}
+
+	if(bSaveDebug == TRUE)
+	{
+		COwnerBuffer		pCAD(insRect.Width(),insRect.Height());
+
+		ZeroMemory(pCAD.GetDataAddress(0,0),pCAD.GetDataSize());
+		MakeInspectResultImage(pCAD,mapData);
+
+		CString		strContour;
+		strContour.Format(_T("D:\\Image\\Spline\\[%d,%d]CADMap.bmp"),bFlip,iReg);
+		CBufferAttach	attach(strContour);
+		attach.AttachToFile(pCAD);
+
+	}
+
+	double dYPos = GetCAD2ImgOffset(mapData,ProcBuf,pointMin,pointMax);
+	if(dYPos == INT_MAX)
+		return dAvgThick;
+
+
+	std::multimap<int, CSplinePoint> mapIns;
+
+	if(MakeInspectLine(mapData,mapIns,dYPos,enOpt) == FALSE)
+	{
+		return dAvgThick;
+	}	
+
+	if((int)mapIns.size() <= 0)
+		return dAvgThick;
+
+	int		nDefect = InspectChipBin(EdgeProc,pImg,insRect,insRegion,mapIns);
+		
+	nDefect = FilteringDefect(insRegion,mapIns,dRes,nJudgeThick,insRect,bFlip);
+
+	/*
+	dAvgThick = InspectChip(EdgeProc,pImg,insRect,insRegion,mapIns);
+	dAvgThick *= dRes;
+
+	if(dAvgThick > 0)
+	{		
+		AnalysisThick(EdgeProc,insRect,dRes,nJudgeThick,dAvgThick,bFlip,mapIns);	
+	}
+	*/
+
+	if(bSaveDebug == TRUE)
+	{
+		if(pRes.IsValidBuffer() == TRUE)
+		{
+			if(CopyRectImg(pImg.GetDataAddress(0,0),pRes.GetDataAddress(0,0),CSize(pImg.GetDataWidth(),pImg.GetHeight()),insRect) == FALSE)
+				return dAvgThick;
+
+			MakeInspectResultImage(pRes,mapIns);
+
+			CString		strContour;
+			strContour.Format(_T("D:\\Image\\Spline\\[%d,%d]ResultMap.bmp"),bFlip,iReg);
+			CBufferAttach	attach(strContour);
+			attach.AttachToFile(pRes);
+		}
+	}
+
+	return nDefect;
+}
+
+double CSplineInspect::InspectSplineChip_New(CSISBuffer pImg,int nPosLeft,CHIP_INS_REGION &insRegion,double dRes,int nJudgeThick,BOOL bFlip,int iReg,BOOL bSaveDebug,SPLINECHIP_INS_METHOD enOpt/*=METHOD_INT_ROUND*/)
+{
+	double		dAvgThick = 0;
+
+	ReleaseBlob();
+
+	if(insRegion.bUse == FALSE || pImg.IsValidBuffer() == FALSE || nPosLeft <= 0)
+	{		
+		return dAvgThick;
+	}
+
+	CRect			insRect;		
+
+	insRect = CRect(nPosLeft+insRegion.nStartX,0,nPosLeft+insRegion.nEndX,pImg.GetHeight());
+	insRect.right= insRect.left + align_4byte(insRect.Width());
+	if(insRect.Width() <= 0 || insRect.Height() <= 0 || insRect.left < 0 || insRect.left >= pImg.GetWidth() || insRect.right <= 0 || insRect.right >= pImg.GetWidth())	
+		return dAvgThick;	
+
+	CEdgeProc		EdgeProc;
+	CRect			rectBin(0,0,insRect.Width(),insRect.Height());
+
+	COwnerBuffer	ProcBuf(insRect.Width(),insRect.Height());
+
+	if(CopyRectImg(pImg.GetDataAddress(0,0),ProcBuf.GetDataAddress(0,0),CSize(pImg.GetDataWidth(),pImg.GetHeight()),insRect) == FALSE)
+		return dAvgThick;
+
+	if(bSaveDebug == TRUE)
+	{
+		if(ProcBuf.IsValidBuffer() == TRUE)
+		{
+			CString		str;
+			str.Format(_T("D:\\Image\\Spline\\[%d]OrgImg.bmp"),iReg);
+			CBufferAttach		attach(str);
+			attach.AttachToFile(ProcBuf);
+		}
+	}
+
+	int			nLineThres = insRegion.nThres;//(int)((double)insRegion.nFindThres - (double)insRegion.nFindThres*0.1);
+	EdgeProc.ThresholdProcessing(ProcBuf.GetDataAddress(0,0),CSize(ProcBuf.GetDataWidth(),ProcBuf.GetHeight()),nLineThres,0);
+
+	if(bSaveDebug == TRUE)
+	{
+		if(ProcBuf.IsValidBuffer() == TRUE)
+		{
+			CString		str;
+			str.Format(_T("D:\\Image\\Spline\\[%d]BinImg.bmp"),iReg);
+			CBufferAttach		attach(str);
+			attach.AttachToFile(ProcBuf);
+		}
+	}
+
+	std::multimap<int, CPoint>	mapData;
+	CPoint	 pointMin = CPoint(INT_MAX,INT_MAX);
+	CPoint	 pointMax = CPoint(0,0);
+	if(MakeCADLine(insRegion,mapData,pointMin,pointMax,enOpt) == FALSE)
+	{		
+		return dAvgThick;
+	}
+
+	if(bSaveDebug == TRUE)
+	{
+		COwnerBuffer		pCAD(insRect.Width(),insRect.Height());
+
+		ZeroMemory(pCAD.GetDataAddress(0,0),pCAD.GetDataSize());
+		MakeInspectResultImage(pCAD,mapData);
+
+		CString		strContour;
+		strContour.Format(_T("D:\\Image\\Spline\\[%d]CADMap.bmp"),iReg);
+		CBufferAttach	attach(strContour);
+		attach.AttachToFile(pCAD);
+
+	}
+
+	double dYPos = GetCAD2ImgOffset(mapData,ProcBuf,pointMin,pointMax);
+	if(dYPos == INT_MAX)
+		return dAvgThick;
+
+
+	std::multimap<int, CSplinePoint> mapIns;
+
+	if(MakeInspectLine(mapData,mapIns,dYPos,enOpt) == FALSE)
+	{
+		return dAvgThick;
+	}	
+
+	if((int)mapIns.size() <= 0)
+		return dAvgThick;
+
+	int		nDefect = InspectChipBin_New(EdgeProc,pImg,insRect,insRegion,mapIns);
+		
+	nDefect = FilteringDefect_New(insRegion,mapIns,dRes,nJudgeThick,insRect,bFlip);
+
+	return nDefect;
+}
+
+int CSplineInspect::InspectChipBin_New(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns)
+{
+	std::multimap<int, CSplinePoint>::iterator	it;
+	CSplinePoint		*splinePos;	
+	CPoint				ptIns,ptEnd;
+	int					nValue,x,y;
+
+	m_ChamferIns.ResetPairDefect();
+
+	COwnerBuffer pBinBuffer(insRect.Width(), insRect.Height());
+
+	pBinBuffer.MemSet(0);
+
+	for(it=mapIns.begin();it!=mapIns.end();it++)
+	{
+		splinePos = static_cast<CSplinePoint*>(&it->second);
+		if(splinePos == NULL)
+			continue;
+
+		ptIns = splinePos->origin;
+		ptIns.Offset(insRegion.nSkipDist+insRect.left, insRegion.nSkipDist+insRect.top);
+		ptEnd = ptIns;
+		ptEnd.Offset(insRegion.nInsRange, insRegion.nInsRange);
+
+		if(ptIns.x < 0 || ptIns.y < 0 || ptIns.x >= pOrg.GetWidth() || ptIns.y >= pOrg.GetHeight())
+			continue;
+		if(ptEnd.x < 0 || ptEnd.y < 0 || ptEnd.x >= pOrg.GetWidth() || ptEnd.y >= pOrg.GetHeight())
+			continue;
+		if(ptIns.x >= ptEnd.x)
+			continue;
+
+		for(y=ptIns.y ; y<ptEnd.y ; y++)
+		{
+			for(x=ptIns.x ; x<ptEnd.x ; x++)
+			{
+				nValue = pOrg.GetPixel(x, y);
+
+				if(nValue <= insRegion.nFindThres)
+				{
+					int nX = x - insRect.left;
+					int nY = y - insRect.top;
+
+					if(nX < 0 || pBinBuffer.GetWidth() <= nX )
+						continue;
+
+					if(nY < 0 || pBinBuffer.GetHeight() <= nY )
+						continue;
+
+					pBinBuffer.SetPixel(nX, nY, 255);
+				}
+			}
+		}
+	}
+
+	std::vector<CChipBlob> blobData;
+
+	Blob_OpenCV(&pOrg, &pBinBuffer, insRect, &blobData, CHIPREGTYPE_RIGHT, INS_DEFECT_CHIP, 50, -1, FALSE);
+
+	if((int) blobData.size() > 0)
+	{
+		std::vector<CChipBlob>::iterator itBlob;
+
+		for(itBlob=blobData.begin();itBlob!=blobData.end();itBlob++)
+		{
+			if(m_nDefectCount >= MAX_SPLINE_DEFECT_COUNT)
+				return m_nDefectCount;				
+
+			CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+
+			*pChipBlob = *itBlob;
+
+			m_nDefectCount++;
+		}
+	}
+
+	return m_nDefectCount;
+}
+
+BOOL CSplineInspect::Blob_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, std::vector<CChipBlob>* vecBlobList, ChipResionType s_RegionType,DefectPosType s_DefectPos, int nMinSize, int nSideFilter, BOOL bROIOffset)
+{
+	if (pOriginImg == NULL || pBinImage == NULL || vecBlobList == NULL)
+		return FALSE;
+
+	if (pOriginImg->GetWidth() == 0 || pOriginImg->GetHeight() == 0)
+		return FALSE;
+
+	if (rtInsRect.Width() != pBinImage->GetWidth() || rtInsRect.Height() != pBinImage->GetHeight())
+		return FALSE;
+
+	cv::Mat pBinMat = cv::Mat::zeros(pBinImage->GetHeight(), pBinImage->GetWidth(), CV_8UC1);
+
+	CopyMemory(pBinMat.data, pBinImage->GetDataAddress(), pBinImage->GetSize());
+
+	cv::Mat matLabel, matStats, matCentrois;
+
+	int numOfLables = connectedComponentsWithStats(pBinMat, matLabel, matStats, matCentrois, 8);
+
+	std::vector<int> vecMin, vecMax, vecSum, vecPixelCount;
+
+	vecMin.resize(numOfLables, 9999);
+	vecMax.resize(numOfLables, -9999);
+	vecSum.resize(numOfLables, 0);
+	vecPixelCount.resize(numOfLables, 0);
+
+	int nBackGroundIdx = 0;
+
+	for (int i = 0; i < matLabel.rows; i++)
+	{
+		int* label = matLabel.ptr<int>(i);
+
+		for (int j = 0; j < matLabel.cols; j++)
+		{
+			int nLabelIdx = (int)label[j];
+
+			int nPxlValue = (int)pOriginImg->GetPixel(rtInsRect.left + j, rtInsRect.top + i);
+
+			if (pBinImage->GetPixel(j, i) == 0)
+				nBackGroundIdx = nLabelIdx;
+
+			if (nPxlValue < vecMin[nLabelIdx])
+				vecMin[nLabelIdx] = nPxlValue;
+
+			if (nPxlValue > vecMax[nLabelIdx])
+				vecMax[nLabelIdx] = nPxlValue;
+
+			vecSum[nLabelIdx] = vecSum[nLabelIdx] + nPxlValue;
+
+			vecPixelCount[nLabelIdx] = vecPixelCount[nLabelIdx] + 1;
+		}
+	}
+
+	for (int nIdx = 0; nIdx < numOfLables; nIdx++)
+	{
+		int area = matStats.at<int>(nIdx, cv::CC_STAT_AREA);
+		int left = matStats.at<int>(nIdx, cv::CC_STAT_LEFT);
+		int top = matStats.at<int>(nIdx, cv::CC_STAT_TOP);
+		int width = matStats.at<int>(nIdx, cv::CC_STAT_WIDTH);
+		int height = matStats.at<int>(nIdx, cv::CC_STAT_HEIGHT);
+
+		int x = (int)matCentrois.at<double>(nIdx, 0);
+		int y = (int)matCentrois.at<double>(nIdx, 1);
+
+		if (nBackGroundIdx == nIdx)
+			continue;
+
+		if (vecPixelCount[nIdx] < nMinSize)
+			continue;
+
+		CRect rtDefectArea;
+		rtDefectArea.left = left;
+		rtDefectArea.top = top;
+		rtDefectArea.right = left + width;
+		rtDefectArea.bottom = top + height;
+
+		if(0 < nSideFilter && s_RegionType == CHIPREGTYPE_RIGHT && nSideFilter <= rtDefectArea.left)
+			continue;
+
+		if(0 < nSideFilter && s_RegionType == CHIPREGTYPE_LEFT && rtDefectArea.right <= rtInsRect.Width() - nSideFilter)
+			continue;
+
+		if(bROIOffset == TRUE)
+			rtDefectArea.OffsetRect(rtInsRect.left, rtInsRect.top);
+
+
+		CChipBlob chipBlob;
+		chipBlob.Reset();
+		// CheckDefectRect(chipBlob, pPair->s_nDefectX, pPair->s_nDefectY);
+		// chipBlob.SetDefectPair(pPair->s_DefectPair);
+		chipBlob.s_DefectRect		= rtDefectArea;
+		chipBlob.s_nDefectRScale    = rtDefectArea.Width()*rtDefectArea.Height();
+		chipBlob.s_nIndex			= (short) vecBlobList->size();
+		chipBlob.s_nDefectArea		= vecPixelCount[nIdx];
+
+		if(bROIOffset == TRUE)
+		{
+			chipBlob.s_nDefectX			= x + rtInsRect.left;
+			chipBlob.s_nDefectY			= y + rtInsRect.top;
+		}
+		else
+		{
+			chipBlob.s_nDefectX			= x;
+			chipBlob.s_nDefectY			= y;
+		}
+
+		chipBlob.s_DefectType		= CHIPDEFTYPE_MIXED;	//pPair->s_DefectType;			//角力 归搬窃篮 1,孺搬窃篮 0
+		chipBlob.s_sThreshold		= 0;
+		chipBlob.s_RegionType		= s_RegionType;
+		chipBlob.s_dThick			= 0.0;
+		chipBlob.s_bCornerChip		= FALSE;
+		chipBlob.s_DefectJudgeType  = s_DefectPos;
+		chipBlob.s_sLevelSrcMax		= (short) vecMax[nIdx];
+		chipBlob.s_xLevelSrcMax		= (short) chipBlob.s_nDefectX;
+		chipBlob.s_yLevelSrcMax		= (short) chipBlob.s_nDefectY;
+		chipBlob.s_sLevelSrcMin		= (short) vecMin[nIdx];
+		chipBlob.s_nLevelSrcSum		= vecSum[nIdx];
+
+		vecBlobList->push_back(chipBlob);
+	}
+
+	return TRUE;
+}
+
+int CSplineInspect::FilteringDefect_New(CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns,double dRes,int nJudge,CRect &insRect,BOOL bFlip)
+{
+	if(m_nDefectCount <= 0)
+		return m_nDefectCount;
+
+	int			i;
+	CSplinePoint		*splinePos;	
+	std::vector<CChipBlob> vecBlob;
+	int			nSizeX, nSizeY;
+	int			nRange = 2;
+	CPoint		ptIns;
+	CRect		rect;
+
+	std::multimap<int, CSplinePoint>::iterator it;
+	std::multimap<int, CSplinePoint>::iterator lowerIter;
+	std::multimap<int, CSplinePoint>::iterator upperIter;
+
+	for(i=0;i<m_nDefectCount;i++)
+	{
+		CChipBlob	*pChipBlob = &m_ResultDefect[i];
+
+		nSizeX = (int)(pChipBlob->s_DefectRect.Width()*dRes);
+		nSizeY = (int)(pChipBlob->s_DefectRect.Height()*dRes);
+
+		if(nSizeX < nJudge && nSizeY < nJudge)
+			continue;
+
+		lowerIter = mapIns.lower_bound(pChipBlob->s_DefectRect.left - insRegion.nSkipDist - nRange);
+		upperIter = mapIns.upper_bound(pChipBlob->s_DefectRect.right - insRegion.nSkipDist - nRange);
+
+		for(it = lowerIter; it != upperIter; it++)
+		{
+			splinePos = static_cast<CSplinePoint*>(&it->second);
+
+			if(splinePos == NULL)
+				continue;
+
+			ptIns = splinePos->origin;
+			ptIns.Offset(insRegion.nSkipDist+nRange,insRegion.nSkipDist+nRange);
+
+			if(pChipBlob->s_DefectRect.PtInRect(ptIns) == TRUE)
+			{
+				vecBlob.push_back(*pChipBlob);
+				break;
+			}
+		}
+	}
+
+	m_nDefectCount = 0;
+
+	std::vector<CChipBlob>::iterator itBlob;
+
+	for(itBlob=vecBlob.begin();itBlob!=vecBlob.end();itBlob++)
+	{
+		if(m_nDefectCount >= MAX_SPLINE_DEFECT_COUNT)
+			return m_nDefectCount;				
+
+		CChipBlob	*pChipBlob = &m_ResultDefect[m_nDefectCount];
+
+		*pChipBlob = *itBlob;
+
+		pChipBlob->s_DefectRect.OffsetRect(insRect.left,insRect.top);
+		pChipBlob->s_nDefectX += insRect.left;
+		pChipBlob->s_nDefectY += insRect.top;
+		pChipBlob->s_nDefectRScale = (int)pChipBlob->s_dThick;
+
+		if(bFlip == TRUE)
+		{
+			pChipBlob->s_DefectRect.top = insRect.Height()-pChipBlob->s_DefectRect.top;
+			pChipBlob->s_DefectRect.bottom = insRect.Height()-pChipBlob->s_DefectRect.bottom;
+			std::swap(pChipBlob->s_DefectRect.top,pChipBlob->s_DefectRect.bottom);
+			pChipBlob->s_nDefectY = insRect.Height()-pChipBlob->s_nDefectY;
+		}
+
+		m_nDefectCount++;
+	}
+
+	return m_nDefectCount;
+}
+
+BOOL CSplineInspect::FindCADLine()
+{
+	if(m_lpBuffer == NULL || m_lpBuffer->GetHeight() <= 0 || m_lpBuffer->GetWidth() <= 0)
+		return FALSE;
+
+	int			ix,iy,iLoop;		
+	int			nImgOffset = 5;
+
+	m_mapSplinePos.clear();
+
+	CSplinePoint		splinePos;
+	m_nSplineOffsetX = m_nSplineOffsetY = INT_MAX;
+	iLoop = 0;
+	for(iy=m_lpBuffer->GetHeight()-nImgOffset;iy>=nImgOffset;iy--)
+	{
+		for(ix=nImgOffset;ix<m_lpBuffer->GetWidth()-nImgOffset;ix++)
+		{
+			if(m_lpBuffer->GetPixel(ix,iy) == 255)
+			{
+				splinePos.Reset();
+
+				if(m_nSplineOffsetX > ix) m_nSplineOffsetX = ix;
+				if(m_nSplineOffsetY > iy) m_nSplineOffsetY = iy;
+
+				splinePos.origin = splinePos.rotate = CPoint(ix,iy);
+				m_mapSplinePos.insert(std::make_pair(ix, splinePos));				
+			}
+		}		
+	}
+
+	return TRUE;
+}
+
+BOOL CSplineInspect::LabelingProcess()
+{
+	if(CheckBuffer() == FALSE)
+		return FALSE;
+
+	int			cx,cy;		
+	int			nLabelingIdx,nTracedir;
+	DWORD		dwStarttime = GetTickCount();
+	const int	MAX_DELAY_TIME = 1000;
+	BOOL		bBreak = FALSE;
+
+// 	CString		str = _T("D:\\Image\\Spline\\Recipe_org.bmp");
+// 	CBufferAttach	attach(str);
+// 	attach.AttachToFile(*m_lpBuffer);
+
+
+	nLabelingIdx = m_nCCCount = 0;
+	for(cy = 2; cy < m_lpBuffer->GetHeight() - 2; cy++)
+	{
+		for(cx = 2, nLabelingIdx = 0; cx < m_lpBuffer->GetWidth() - 2; cx++)
+		{
+			if((GetTickCount()-dwStarttime) >= MAX_DELAY_TIME)
+			{
+				bBreak = TRUE;
+				break;
+			}
+
+			if(CheckRange(cx,cy,m_lpBuffer) == FALSE)
+				break;
+
+			if(*m_lpBuffer->GetDataAddress(cx,cy) == 255)// black pixel
+			{
+				if(nLabelingIdx != 0)// use pre-pixel label
+				{
+					m_pLabelMap[cy][cx] = nLabelingIdx;
+				}
+				else
+				{
+					nLabelingIdx = m_pLabelMap[cy][cx];
+
+					if(nLabelingIdx == 0)
+					{
+						nLabelingIdx = ++m_nCCCount;
+						nTracedir = 0;
+						ContourTracing(cy, cx, nLabelingIdx, nTracedir);// external contour
+						m_pLabelMap[cy][cx] = nLabelingIdx;
+					}
+				}
+			}
+			else if(nLabelingIdx != 0)// white pixel & pre-pixel has been labeled
+			{
+				if(m_pLabelMap[cy][cx] == 0)
+				{
+					nTracedir = 1;
+					ContourTracing(cy, cx - 1, nLabelingIdx, nTracedir);// internal contour
+				}
+
+				nLabelingIdx = 0;
+			}		
+		}
+
+		if(bBreak == TRUE)
+			return TRUE;		
+	}
+
+	return TRUE;
+}
+
+BOOL CSplineInspect::LabelingCounting()
+{
+	if(CheckBuffer() == FALSE)
+		return FALSE;
+
+	int			ix,iy;
+
+	m_nMaxContourIdx = m_nMaxContourCount = 0;
+	ZeroMemory(m_pContourCnt,sizeof(int)*m_lpBuffer->GetHeight()*m_lpBuffer->GetWidth());
+	for(iy=0;iy<m_lpBuffer->GetHeight();iy++)
+	{
+		for(ix=0;ix<m_lpBuffer->GetWidth();ix++)
+		{
+			if(m_pContourMap[iy][ix] > 0)
+			{
+				m_pContourCnt[m_pContourMap[iy][ix]]++;
+
+				if(m_nMaxContourCount < m_pContourCnt[m_pContourMap[iy][ix]])
+				{
+					m_nMaxContourIdx = m_pContourMap[iy][ix];
+					m_nMaxContourCount = m_pContourCnt[m_pContourMap[iy][ix]];
+				}
+			}
+		}
+	}
+
+	return TRUE;
+}
+
+BOOL CSplineInspect::LabelFiltering( int nFilterCnt )
+{
+	if(CheckBuffer() == FALSE)
+		return FALSE;
+
+	int			iLoop;
+
+	for(iLoop=0;iLoop<m_lpBuffer->GetHeight()*m_lpBuffer->GetWidth();iLoop++)
+	{
+		if(m_pContourCnt[iLoop] > 0 && m_pContourCnt[iLoop] <= nFilterCnt)
+			m_pContourCnt[iLoop] = 0;
+	}
+
+	return TRUE;
+}
+
+int CSplineInspect::GetRectInLabelMaxIndex( CRect &rect )
+{
+	if(CheckBuffer() == FALSE)
+		return -1;
+	if(CheckRectToBuffer(rect) == FALSE)
+		return -1;
+
+	int					ix,iy,iLoop;
+	CArray<int,int>		arrIndex;
+	BOOL				bFind;
+
+	for(iy=rect.top;iy<=rect.bottom;iy++)
+	{
+		for(ix=rect.left;ix<=rect.right;ix++)
+		{
+			if(m_pContourMap[iy][ix] > 0)
+			{
+				bFind = FALSE;
+				for(iLoop=0;iLoop<arrIndex.GetSize();iLoop++)
+				{
+					if(m_pContourMap[iy][ix] == arrIndex.GetAt(iLoop))
+					{
+						bFind = TRUE;
+						break;
+					}
+				}
+				if(bFind == FALSE)
+					arrIndex.Add(m_pContourMap[iy][ix]);
+			}
+		}
+	}
+
+	int					nMaxIdx = 0,nMaxVal = 0,nIdx=0;
+	nMaxIdx = -1;
+	for(iLoop=0;iLoop<arrIndex.GetSize();iLoop++)
+	{
+		nIdx = arrIndex.GetAt(iLoop);		
+		if(m_pContourCnt[nIdx] > nMaxVal)
+		{
+			nMaxVal = m_pContourCnt[nIdx];
+			nMaxIdx = nIdx;
+		}
+	}
+
+	return nMaxIdx;	
+}
+
+BOOL CSplineInspect::GetLabelPosition( int nIdx )
+{
+	m_mapSplinePos.clear();
+
+	if(CheckBuffer() == FALSE)
+		return FALSE;
+
+	int			ix,iy,iLoop;		
+
+	CSplinePoint		splinePos;
+	m_nSplineOffsetX = m_nSplineOffsetY = INT_MAX;
+	iLoop = 0;
+	for(iy=m_lpBuffer->GetHeight()-1;iy>=0;iy--)
+	{
+		for(ix=0;ix<m_lpBuffer->GetWidth();ix++)
+		{
+			if(m_pContourMap[iy][ix] == nIdx)
+			{
+				splinePos.Reset();
+
+				if(m_nSplineOffsetX > ix) m_nSplineOffsetX = ix;
+				if(m_nSplineOffsetY > iy) m_nSplineOffsetY = iy;
+
+				splinePos.origin = splinePos.rotate = CPoint(ix,iy);
+				m_mapSplinePos.insert(std::make_pair(ix, splinePos));				
+			}
+		}		
+	}
+
+	return TRUE;
+}
+
+BOOL CSplineInspect::CheckBuffer()
+{
+	if(m_lpBuffer == NULL || m_lpBuffer->GetHeight() <= 0 || m_lpBuffer->GetWidth() <= 0)
+		return FALSE;
+	if(m_pLabelMap == NULL || m_pContourMap == NULL || m_pContourCnt == NULL)
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CSplineInspect::CheckRange( int x,int y,CSISBuffer *buffer )
+{
+	if(x < 0 || y < 0)
+		return FALSE;
+	if(x >= buffer->GetWidth() || y >= buffer->GetHeight())
+		return FALSE;
+
+	return TRUE;
+}
+
+void CSplineInspect::ContourTracing( int cy, int cx, int labelindex, int tracingdirection )
+{
+	char tracingstopflag = 0, SearchAgain = 1;
+	int fx, fy, sx = cx, sy = cy;
+
+	Tracer(&cy, &cx, &tracingdirection);
+	m_pContourMap[cy][cx] = labelindex;
+
+	DWORD		dwStarttime = GetTickCount();
+	const int	MAX_DELAY_TIME = 500;
+
+	if(cx != sx || cy != sy)
+	{
+		fx = cx;
+		fy = cy;
+
+		while(SearchAgain)
+		{
+			if((GetTickCount()-dwStarttime) >= MAX_DELAY_TIME)							
+				break;			
+
+			tracingdirection = (tracingdirection + 6) % 8;
+			m_pLabelMap[cy][cx] = labelindex;
+			Tracer(&cy, &cx, &tracingdirection);
+			m_pContourMap[cy][cx] = labelindex;
+
+			if(cx == sx && cy == sy)
+			{
+				tracingstopflag = 1;
+			}
+			else if(tracingstopflag)
+			{
+				if(cx == fx && cy == fy)
+				{
+					SearchAgain = 0;
+				}
+				else
+				{
+					tracingstopflag = 0;
+				}
+			}
+		}
+	}
+}
+
+BOOL CSplineInspect::CheckRectToBuffer( CRect &rect )
+{
+	if(rect.left < 0 || rect.right >= m_lpBuffer->GetWidth() 
+		|| rect.right < 0 || rect.right >= m_lpBuffer->GetWidth())
+		return FALSE;
+
+	if(rect.top < 0 || rect.top >= m_lpBuffer->GetHeight() 
+		|| rect.bottom < 0 || rect.bottom >= m_lpBuffer->GetHeight())
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CSplineInspect::Tracer( int *cy, int *cx, int *tracingdirection )
+{
+	int i, y, x;
+
+	for(i = 0; i < 7; i++)
+	{
+		y = *cy + g_SearchDirection[*tracingdirection][0];
+		x = *cx + g_SearchDirection[*tracingdirection][1];
+
+		if(CheckRange(x,y,m_lpBuffer) == FALSE)
+			return FALSE;
+
+		if(*m_lpBuffer->GetDataAddress(x,y) == 0)
+		{
+			m_pLabelMap[y][x] = -1;
+			*tracingdirection = (*tracingdirection + 1) % 8;
+		}
+		else
+		{
+			*cy = y;
+			*cx = x;
+			return TRUE;
+		}
+	}
+	return TRUE;
+}	
+
+BOOL CSplineInspect::SetImage( CSISBuffer *lpBuffer )
+{
+	if(lpBuffer == NULL || lpBuffer->IsValidBuffer() == FALSE)
+		return FALSE;
+
+	int			i;
+
+	ReleaseBuffer();
+	ReleaseBlob();
+	
+	m_lpBuffer = lpBuffer;
+	m_szImageOrg = CSize(m_lpBuffer->GetWidth(),m_lpBuffer->GetHeight());
+	
+	if(m_lpBuffer != NULL && m_lpBuffer->GetHeight() > 0 && m_lpBuffer->GetWidth() > 0)
+	{		
+		m_pLabelMap = new int*[m_lpBuffer->GetHeight()];	
+		m_pContourMap = new int*[m_lpBuffer->GetHeight()];
+		
+		for(i=0;i<m_lpBuffer->GetHeight();i++)
+		{
+			m_pLabelMap[i] = new int[m_lpBuffer->GetWidth()];			
+			m_pContourMap[i] = new int[m_lpBuffer->GetWidth()];
+
+			ZeroMemory(m_pLabelMap[i],sizeof(int)*m_lpBuffer->GetWidth());
+			ZeroMemory(m_pContourMap[i],sizeof(int)*m_lpBuffer->GetWidth());
+		}
+
+		m_pContourCnt = new int[m_lpBuffer->GetHeight()*m_lpBuffer->GetWidth()];
+		ZeroMemory(m_pContourCnt,sizeof(int)*m_lpBuffer->GetHeight()*m_lpBuffer->GetWidth());
+
+		return TRUE;
+	/*
+		CString				strFile = "D:\\Image\\Origin.bmp";
+		CBufferAttach		attach(strFile);
+		attach.AttachToFile(*m_lpBuffer);
+*/
+	}
+
+	return FALSE;
+}
+
diff --git a/Common_Class/EdgeInspect/dllmain.cpp b/Common_Class/EdgeInspect/dllmain.cpp
new file mode 100644
index 0000000..3821e47
--- /dev/null
+++ b/Common_Class/EdgeInspect/dllmain.cpp
@@ -0,0 +1,51 @@
+// dllmain.cpp : DLL狼 檬扁拳 风凭阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+#include <afxwin.h>
+#include <afxdllx.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+static AFX_EXTENSION_MODULE EdgeInspectDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+	// lpReserved甫 荤侩窍绰 版快 促澜阑 力芭窍绞矫坷.
+	UNREFERENCED_PARAMETER(lpReserved);
+
+	if (dwReason == DLL_PROCESS_ATTACH)
+	{
+		TRACE0("EdgeInspect.DLL阑 檬扁拳窍绊 乐嚼聪促.\n");
+		
+		// 犬厘 DLL阑 茄 锅父 檬扁拳钦聪促.
+		if (!AfxInitExtensionModule(EdgeInspectDLL, hInstance))
+			return 0;
+
+		// 捞 DLL阑 府家胶 眉牢俊 火涝钦聪促.
+		// 曼绊: 捞 犬厘 DLL捞 MFC 览侩 橇肺弊伐捞
+		//  酒囱 ActiveX 牧飘费苞 鞍篮 MFC 扁夯 DLL俊
+		//  狼秦 疙矫利栏肺 傅农登绢 乐绰 版快俊绰
+		//  DllMain俊辑 捞 临阑 力芭窍绊, 力芭茄 临篮 捞 犬厘 DLL俊辑
+		//  郴焊辰 喊档狼 窃荐俊 眠啊钦聪促.
+		//  弊繁 促澜 捞 犬厘 DLL阑 荤侩窍绰 扁夯 DLL篮
+		//  秦寸 窃荐甫 疙矫利栏肺 龋免窍咯 捞 犬厘 DLL阑 眠啊秦具 钦聪促.
+		//  弊犯瘤 臼栏搁 CDynLinkLibrary 俺眉啊
+		//  扁夯 DLL狼 府家胶 眉牢俊 眠啊登瘤 臼栏骨肺
+		//  缴阿茄 巩力啊 惯积钦聪促.
+
+		new CDynLinkLibrary(EdgeInspectDLL);
+
+	}
+	else if (dwReason == DLL_PROCESS_DETACH)
+	{
+		TRACE0("EdgeInspect.DLL阑 辆丰窍绊 乐嚼聪促.\n");
+
+		// 家戈磊啊 龋免登扁 傈俊 扼捞宏矾府甫 辆丰钦聪促.
+		AfxTermExtensionModule(EdgeInspectDLL);
+	}
+	return 1;   // 犬牢
+}
diff --git a/Common_Class/EdgeInspect/res/EdgeInspect.rc2 b/Common_Class/EdgeInspect/res/EdgeInspect.rc2
new file mode 100644
index 0000000..78e6a8c
--- /dev/null
+++ b/Common_Class/EdgeInspect/res/EdgeInspect.rc2
@@ -0,0 +1,13 @@
+//
+// EdgeInspect.RC2 - Microsoft Visual C++俊辑 流立 祈笼窍瘤 臼绰 府家胶
+//
+
+#ifdef APSTUDIO_INVOKED
+#error 捞 颇老篮 Microsoft Visual C++俊辑 祈笼且 荐 绝嚼聪促.
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// 咯扁俊 荐悼栏肺 祈笼茄 府家胶甫 眠啊钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/EdgeInspect/stdafx.cpp b/Common_Class/EdgeInspect/stdafx.cpp
new file mode 100644
index 0000000..97defe6
--- /dev/null
+++ b/Common_Class/EdgeInspect/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : 钎霖 器窃 颇老父 甸绢 乐绰 家胶 颇老涝聪促.
+// EdgeInspect.pch绰 固府 哪颇老等 庆歹啊 邓聪促.
+// stdafx.obj俊绰 固府 哪颇老等 屈侥 沥焊啊 器窃邓聪促.
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/EdgeInspect/stdafx.h b/Common_Class/EdgeInspect/stdafx.h
new file mode 100644
index 0000000..6b2c7aa
--- /dev/null
+++ b/Common_Class/EdgeInspect/stdafx.h
@@ -0,0 +1,57 @@
+// stdafx.h : 磊林 荤侩窍瘤父 磊林 函版登瘤绰 臼绰
+// 钎霖 矫胶袍 器窃 颇老 棺 橇肺璃飘 包访 器窃 颇老捞
+// 甸绢 乐绰 器窃 颇老涝聪促.
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 芭狼 荤侩登瘤 臼绰 郴侩篮 Windows 庆歹俊辑 力寇钦聪促.
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 老何 CString 积己磊绰 疙矫利栏肺 急攫邓聪促.
+
+#include <afxwin.h>         // MFC 琴缴 棺 钎霖 备己 夸家涝聪促.
+#include <afxext.h>         // MFC 犬厘涝聪促.
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE 努贰胶涝聪促.
+#include <afxodlgs.h>       // MFC OLE 措拳 惑磊 努贰胶涝聪促.
+#include <afxdisp.h>        // MFC 磊悼拳 努贰胶涝聪促.
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 单捞磐海捞胶 努贰胶涝聪促.
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 单捞磐海捞胶 努贰胶涝聪促.
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // Internet Explorer 4 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // Windows 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+#pragma warning(disable:4819)
+#pragma warning(disable:4996)
+
+
+#include "InspectionBuffer.h"
+#ifdef DEBUG
+	#pragma comment (lib, "SISBufferD.lib")
+	#pragma comment(lib, "opencv_highgui310.lib")
+	#pragma comment(lib, "opencv_imgproc310.lib")
+	#pragma comment(lib, "opencv_core310.lib")
+	#pragma comment (lib, "FreeImage.lib")
+#else
+	#pragma comment (lib, "SISBuffer.lib")
+	#pragma comment(lib, "opencv_highgui310.lib")
+	#pragma comment(lib, "opencv_imgproc310.lib")
+	#pragma comment(lib, "opencv_core310.lib")
+	#pragma comment (lib, "FreeImage.lib")
+#endif
\ No newline at end of file
diff --git a/Common_Class/EdgeInspect/targetver.h b/Common_Class/EdgeInspect/targetver.h
new file mode 100644
index 0000000..75a9f56
--- /dev/null
+++ b/Common_Class/EdgeInspect/targetver.h
@@ -0,0 +1,26 @@
+
+#pragma once
+
+// 促澜 概农肺绰 鞘夸茄 弥家 敲阀汽阑 沥狼钦聪促. 鞘夸茄 弥家 敲阀汽篮
+// 览侩 橇肺弊伐阑 角青窍绰 单 鞘夸茄 扁瓷捞 器窃等 啊厘 狐弗 滚傈狼 Windows, Internet Explorer
+// 殿涝聪促. 捞 概农肺绰 瘤沥等 滚傈 捞惑狼 敲阀汽 滚傈俊辑 荤侩 啊瓷茄 葛电 扁瓷阑 劝己拳秦具
+// 累悼钦聪促.
+
+// 酒贰 瘤沥等 敲阀汽俊 快急窍绰 敲阀汽阑 措惑栏肺 窍绰 版快 促澜 沥狼甫 荐沥窍绞矫坷.
+// 促弗 敲阀汽俊 荤侩登绰 秦寸 蔼狼 弥脚 沥焊绰 MSDN阑 曼炼窍绞矫坷.
+#ifndef WINVER                          // 鞘夸茄 弥家 敲阀汽阑 Windows Vista肺 瘤沥钦聪促.
+#define WINVER 0x0600           // 促弗 滚傈狼 Windows俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_WINNT            // 鞘夸茄 弥家 敲阀汽阑 Windows Vista肺 瘤沥钦聪促.
+#define _WIN32_WINNT 0x0600     // 促弗 滚傈狼 Windows俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_WINDOWS          // 鞘夸茄 弥家 敲阀汽阑 Windows 98肺 瘤沥钦聪促.
+#define _WIN32_WINDOWS 0x0410 // Windows Me 捞惑俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_IE                       // 鞘夸茄 弥家 敲阀汽阑 Internet Explorer 7.0栏肺 瘤沥钦聪促.
+#define _WIN32_IE 0x0700        // 促弗 滚傈狼 IE俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
diff --git a/Common_Class/EuresysCam/Dll/MultiCam.dll b/Common_Class/EuresysCam/Dll/MultiCam.dll
new file mode 100644
index 0000000..e2988fd
--- /dev/null
+++ b/Common_Class/EuresysCam/Dll/MultiCam.dll
Binary files differ
diff --git a/Common_Class/EuresysCam/Include/CCallbacks.h b/Common_Class/EuresysCam/Include/CCallbacks.h
new file mode 100644
index 0000000..e8ea96e
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/CCallbacks.h
@@ -0,0 +1,46 @@
+// CCALLBACKS.H - C CALLBACKS LAYER
+
+#if !defined(__CCALLBACKS_H__)
+#define __CCALLBACKS_H__
+
+typedef void (MCAPI *PMCPP_C_CALLBACK)(void *Context, void *Caller, void *Info);
+
+namespace Euresys
+{
+	namespace MultiCam
+	{
+		// ********************************************************************************************
+		// Callback class (continued)
+		// --------------------------
+
+		class CFunctionCallback : public Callback
+		{
+		private:
+			void *Context;
+			PMCPP_C_CALLBACK Function;
+
+		public:
+			CFunctionCallback(void *aContext, PMCPP_C_CALLBACK aFunction) :
+			Context(aContext),
+			Function(aFunction)
+			{
+			}
+			~CFunctionCallback()
+			{
+			}
+
+			void Run(MultiCamObjectWithSignaling &caller, SignalInfo &info)
+			{
+				Function(Context, &caller, &info);
+			}
+
+            void RunUntyped(MultiCamObjectWithSignaling *caller, SignalInfo &info)
+			{
+				Function(Context, caller, &info);
+			}
+		};
+	}
+}
+
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/ESFilter.h b/Common_Class/EuresysCam/Include/ESFilter.h
new file mode 100644
index 0000000..da41bbe
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/ESFilter.h
@@ -0,0 +1,225 @@
+//
+// Euresys DirectShow input filter
+//
+// public definitions & interfaces
+//
+
+#pragma once
+
+#include "multicam.h"
+
+typedef enum {
+	ESF_STANDARD_PAL = 0,
+	ESF_STANDARD_NTSC
+} ESF_VIDEO_STANDARD;
+
+typedef enum {
+  ESF_RESOLUTION_FRAME = 0,
+  ESF_RESOLUTION_FIELD,
+  ESF_RESOLUTION_CIF,
+  ESF_RESOLUTION_QCIF,
+  ESF_RESOLUTION_CUSTOM
+} ESF_RESOLUTION;
+
+typedef enum {
+  ESF_BITRATECONTROL_CBR = 0,
+  ESF_BITRATECONTROL_VBR
+} ESF_BITRATECONTROL;
+
+typedef enum {
+  ESF_GOPSTRUCTURE_IONLY = 0,
+  ESF_GOPSTRUCTURE_IPONLY,
+  ESF_GOPSTRUCTURE_IPB
+} ESF_GOPSTRUCTURE;
+// {C8D2D5D0-02DF-41d4-BD80-7681CD059B52}
+DEFINE_GUID(CLSID_ESFilter, 
+0xc8d2d5d0, 0x2df, 0x41d4, 0xbd, 0x80, 0x76, 0x81, 0xcd, 0x5, 0x9b, 0x52);
+
+//
+// IESFProperties Interface
+//
+// {EC67FA27-4176-4659-ADCF-944D0941667F}
+DEFINE_GUID(IID_IESFProperties, 
+0xec67fa27, 0x4176, 0x4659, 0xad, 0xcf, 0x94, 0x4d, 0x9, 0x41, 0x66, 0x7f);
+
+interface IESFProperties : public IUnknown
+{
+  // Capture rate control
+  STDMETHOD(GetCaptureRateRange)(double *plMinValue, double *plMaxValue, double *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetCaptureRate)(double lValue) = 0;
+  STDMETHOD(GetCaptureRate)(double *plValue) = 0;
+  // Resolution selection
+  STDMETHOD(SetResolution)(ESF_RESOLUTION Resolution, long lWidth = 0, long lHeight = 0) = 0; // Width and height are ignored if Resolution is not ESF_RESOLUTION_CUSTOM.
+  STDMETHOD(GetResolution)(ESF_RESOLUTION *pResolution, long *plWidth = NULL, long *plHeight = NULL) = 0;
+  STDMETHOD(GetCustomResolutionRange)(long *plMinWidth, long *plMaxWidth, long *plMinHeight, long *plMaxHeight) = 0;
+  // Brightness control
+  STDMETHOD(GetBrightnessRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetBrightness)(long lValue) = 0;
+  STDMETHOD(GetBrightness)(long *plValue) = 0;
+  // Contrast control
+  STDMETHOD(GetContrastRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetContrast)(long lValue) = 0;
+  STDMETHOD(GetContrast)(long *plValue) = 0;
+  // Saturation control
+  STDMETHOD(GetSaturationRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetSaturation)(long lValue) = 0;
+  STDMETHOD(GetSaturation)(long *plValue) = 0;
+  // Camera specification
+  STDMETHOD(GetVideoStandard)(ESF_VIDEO_STANDARD *pStandard, bool *pbMonochrome) = 0;
+  STDMETHOD(SetVideoStandard)(ESF_VIDEO_STANDARD Standard, bool bMonochrome) = 0;
+  // Source selection
+  STDMETHOD(GetBoardRange)(long *plMinValue, long *plMaxValue) = 0;
+  STDMETHOD(SetBoard)(long lBoardId) = 0;
+  STDMETHOD(GetBoard)(long *plBoardId) = 0;
+  STDMETHOD(GetConnectorRange)(long *plMinValue, long *plMaxValue) = 0;
+  STDMETHOD(SetConnector)(long lConnectorId) = 0;
+  STDMETHOD(GetConnector)(long *plConnectorId) = 0;
+  // Capture Region selection
+  STDMETHOD(GetCaptureRegionSizeRange)(long *plMinSizeX, long *plMaxSizeX, long *plMinSizeY, long *plMaxSizeY) = 0;
+  STDMETHOD(SetCaptureRegionSize)(long lSizeX, long lSizeY) = 0;
+  STDMETHOD(GetCaptureRegionSize)(long *plSizeX, long *plSizeY) = 0;
+  STDMETHOD(GetCaptureRegionPosRange)(long *plMinPositionX, long *plMaxPositionX, long *plMinPositionY, long *plMaxPositionY) = 0;
+  STDMETHOD(SetCaptureRegionPos)(long lPositionX, long lPositionY) = 0;
+  STDMETHOD(GetCaptureRegionPos)(long *plPositionX, long *plPositionY) = 0;
+  // Output Format selection
+  STDMETHOD(GetOutputFormatsList)(ULONG *pcElems, GUID **ppElems) = 0;
+  STDMETHOD(SetOutputFormat)(GUID Format) = 0;
+  STDMETHOD(GetOutputFormat)(GUID *pFormat) = 0;
+  // Individual Control
+  STDMETHOD(SetIndividualControl)(bool bActive) = 0;
+  STDMETHOD(GetIndividualControl)(bool *pbActive) = 0;
+  // Video Signal detection
+  STDMETHOD(IsVideoSignalPresent)(void) = 0;
+  // Camera specification with broadcast support
+  STDMETHOD(GetVideoStandardEx)(ESF_VIDEO_STANDARD *pStandard, bool *pbMonochrome, bool *pbBroadcast) = 0;
+  STDMETHOD(SetVideoStandardEx)(ESF_VIDEO_STANDARD Standard, bool bMonochrome, bool bBroadcast) = 0;
+};
+
+//
+// IESFCompression Interface
+//
+// {A41D0CDA-FE6D-46b7-BBF9-3FF677CDABB7}
+DEFINE_GUID(IID_IESFCompression, 
+0xa41d0cda, 0xfe6d, 0x46b7, 0xbb, 0xf9, 0x3f, 0xf6, 0x77, 0xcd, 0xab, 0xb7);
+
+interface IESFCompression : public IUnknown
+{
+  // Bitrate Control
+  STDMETHOD(SetBitrateControl)(ESF_BITRATECONTROL BitrateControl) = 0;
+  STDMETHOD(GetBitrateControl)(ESF_BITRATECONTROL *pBitrateControl) = 0;
+  // Average Bit Rate
+  STDMETHOD(GetAverageBitrateRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetAverageBitrate)(long lValue) = 0;
+  STDMETHOD(GetAverageBitrate)(long *plValue) = 0;
+  // Video Quality 
+  STDMETHOD(GetVideoQualityRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetVideoQuality)(long lValue) = 0;
+  STDMETHOD(GetVideoQuality)(long *plValue) = 0;
+  // Gop structure
+  STDMETHOD(SetGopStructure)(ESF_GOPSTRUCTURE GopStructure) = 0;
+  STDMETHOD(GetGopStructure)(ESF_GOPSTRUCTURE *pGopStructure) = 0;
+  STDMETHOD(GetGopSizeRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetGopSize)(long lValue) = 0;
+  STDMETHOD(GetGopSize)(long *plValue) = 0;
+};
+
+//
+// IMCBord Interface
+//
+// {A97BB8BD-9ABE-44e0-9F5A-E055A6B6FA36}
+DEFINE_GUID(IID_IMCBoard, 
+0xa97bb8bd, 0x9abe, 0x44e0, 0x9f, 0x5a, 0xe0, 0x55, 0xa6, 0xb6, 0xfa, 0x36);
+
+interface IMCBoard : public IUnknown
+{
+  STDMETHOD(GetParamFloat)(UINT32 unParamId, double *pdValue) = 0;
+  STDMETHOD(GetParamInt)(UINT32 unParamId, long *plValue) = 0;
+  STDMETHOD(GetParamStr)(UINT32 unParamId, PWSTR pszValue, long ccValue) = 0;
+  STDMETHOD(GetParamNmFloat)(PCWSTR pszName, double *pdValue) = 0;
+  STDMETHOD(GetParamNmInt)(PCWSTR pszName, long *plValue) = 0;
+  STDMETHOD(GetParamNmStr)(PCWSTR pszName, PWSTR pszValue, long ccValue) = 0;
+  STDMETHOD(SetParamFloat)(UINT32 unParamId, double dValue) = 0;
+  STDMETHOD(SetParamInt)(UINT32 unParamId, long lValue) = 0;
+  STDMETHOD(SetParamStr)(UINT32 unParamId, PCWSTR pszValue) = 0;
+  STDMETHOD(SetParamNmFloat)(PCWSTR pszName, double dValue) = 0;
+  STDMETHOD(SetParamNmInt)(PCWSTR pszName, long lValue) = 0;
+  STDMETHOD(SetParamNmStr)(PCWSTR pszName, PCWSTR pszValue) = 0;
+};
+
+//
+// IMCEnumBords Interface
+//
+// {C1A9226F-D740-439a-A8CC-FFB46977FBC3}
+DEFINE_GUID(IID_IMCEnumBoards, 
+0xc1a9226f, 0xd740, 0x439a, 0xa8, 0xcc, 0xff, 0xb4, 0x69, 0x77, 0xfb, 0xc3);
+
+interface IMCEnumBoards : public IUnknown
+{
+	STDMETHOD(Next)(ULONG celt, IMCBoard **ppEureCard, ULONG *pceltFetched) = 0;
+	STDMETHOD(Skip)(ULONG celt) = 0;
+	STDMETHOD(Reset)() = 0;
+	STDMETHOD(Clone)(IMCEnumBoards **ppEnumBoards) = 0;
+};
+
+//
+// IMCConfig Interface
+//
+// {7377EB18-82DE-43ff-8DB2-01FEA57EEA66}
+DEFINE_GUID(IID_IMCConfig, 
+0x7377eb18, 0x82de, 0x43ff, 0x8d, 0xb2, 0x1, 0xfe, 0xa5, 0x7e, 0xea, 0x66);
+
+interface IMCConfig : public IUnknown
+{
+  STDMETHOD(GetBoardEnum)(IMCEnumBoards **ppEnumBoards) = 0;
+};
+
+
+//
+// IESFAllocatorNegociation
+//
+// {3475FA59-2661-4d91-BA60-9FE92E180395}
+DEFINE_GUID(IID_IESFAllocatorNegociation, 
+0x3475fa59, 0x2661, 0x4d91, 0xba, 0x60, 0x9f, 0xe9, 0x2e, 0x18, 0x3, 0x95);
+
+interface IESFAllocatorNegociation : public IUnknown
+{
+  STDMETHOD(UseInputPinAllocator)(BOOL bUseInputPinAllocator) = 0;
+};
+
+//
+// Property Pages GUIDS
+//
+
+// Configuration Property page
+// {CE39B2A2-DF66-4D8B-93CD-DC6A1EADF09A}
+DEFINE_GUID(CLSID_ConfigPropPage, 
+0xCE39B2A2, 0xDF66, 0x4D8B, 0x93, 0xCD, 0xDC, 0x6A, 0x1E, 0xAD, 0xF0, 0x9A);
+
+// Adjustment Property page
+// {E873C3B6-950F-45CD-A184-95428036FB6A}
+DEFINE_GUID(CLSID_AdjustPropPage, 
+0xE873C3B6, 0x950F, 0x45CD, 0xA1, 0x84, 0x95, 0x42, 0x80, 0x36, 0xFB, 0x6A);
+
+// Compression Property page
+// {15CF19B6-1F28-4B06-A3D8-FC58B7A108C5}
+DEFINE_GUID(CLSID_CompressionPropPage, 
+0x15CF19B6, 0x1F28, 0x4B06, 0xA3, 0xD8, 0xFC, 0x58, 0xB7, 0xA1, 0x08, 0xC5);
+
+//
+// Filter Events
+//
+
+#define EC_ESF_SIGNAL_LOST            EC_USER + 0x00
+#define EC_ESF_SIGNAL_RESTORED        EC_USER + 0x01
+
+//
+// Error Codes
+//
+#define MCSTATUS_TO_HRESULT(status) \
+  MAKE_HRESULT((status == MC_OK)? SEVERITY_SUCCESS : SEVERITY_ERROR, FACILITY_ITF, (0x4000 - status))
+#define HRESULT_TO_MCSTATUS(hr) (MCSTATUS)(0x4000 - HRESULT_CODE(hr))
+
+#define E_ESF_BAD_PARAMETER   (MCSTATUS_TO_HRESULT(MC_BAD_PARAMETER))
+#define E_ESF_OUT_OF_BOUND    (MCSTATUS_TO_HRESULT(MC_OUT_OF_BOUND))
+#define E_ESF_INVALID_VALUE   (MCSTATUS_TO_HRESULT(MC_INVALID_VALUE))
+#define E_ESF_FATAL_ERROR	  (MCSTATUS_TO_HRESULT(MC_FATAL_ERROR))
diff --git a/Common_Class/EuresysCam/Include/MCpp_Board.h b/Common_Class/EuresysCam/Include/MCpp_Board.h
new file mode 100644
index 0000000..600e91b
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_Board.h
@@ -0,0 +1,35 @@
+// MCpp_Board.h - MULTICAM C++ API - Board
+#if !defined(__MCPP_BOARD_H__)
+#define __MCPP_BOARD_H__
+
+// ********************************************************************************************
+// Board class
+// -----------
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    class Board : public MultiCamObjectWithSignaling
+    {
+      WRAPPING_MEMBERS
+
+    public:
+      Board(int index);
+      ~Board();
+
+      template <class T>
+      void RegisterCallback(T *owner, void (T::*callbackMethod)(Board &, SignalInfo &), MCSIGNAL signal)
+      {
+        if (owner == NULL || callbackMethod == NULL)
+        {
+          ::Euresys::MultiCam::Exception e(MC_INTERNAL_ERROR, "Invalid callback object or function");
+          throw e;
+        }
+
+        Callback *cb = new UserCallback<T, Board>(owner, callbackMethod);
+        RegisterCallbackInternal(cb, signal);
+      }
+    };
+  }
+}
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_BoardImpl.h b/Common_Class/EuresysCam/Include/MCpp_BoardImpl.h
new file mode 100644
index 0000000..08b002a
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_BoardImpl.h
@@ -0,0 +1,33 @@
+// MCpp_BoardImpl.h - MULTICAM C++ API - BoardImpl
+#if !defined(__MCPP_BOARDIMPL_H__)
+#define __MCPP_BOARDIMPL_H__
+
+#include "MCpp_Board.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline Board::Board(int Index)
+    {
+      WRAPPING_MEMBERS_INIT
+
+      Handle = MC_BOARD + Index;
+
+      // Make sure the handle is valid (i.e., this object corresponds to a MultiCam Board object)
+      MCSTATUS status;
+      int ix;
+      status = McGetParamInt(Handle, MC_DriverIndex, &ix);
+      if (status != MC_OK || ix != Index)
+        ThrowMultiCamException(MC_NO_BOARD_FOUND);
+    }
+
+    inline Board::~Board()
+    {
+      WRAPPING_MEMBERS_UNINIT
+    }
+
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_BoardList.h b/Common_Class/EuresysCam/Include/MCpp_BoardList.h
new file mode 100644
index 0000000..cd5e6eb
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_BoardList.h
@@ -0,0 +1,53 @@
+// MCpp_Board.h - MULTICAM C++ API - BoardList
+#if !defined(__MCPP_BOARDLIST_H__)
+#define __MCPP_BOARDLIST_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // BoardList class
+    // ---------------
+    class BoardListImpl
+    {
+    private:
+      Board **List;
+      int Count;
+
+    public:
+      BoardListImpl();
+      ~BoardListImpl();
+      void Init();
+
+      Board *operator[] (int driverIndex) { return GetBoardByDriverIndex(driverIndex); }
+      Board *GetBoardByDriverIndex(int driverIndex);
+      Board *GetBoardByPciPosition(int pciPosition);
+      Board *GetBoardByBoardName(const char *boardName);
+      Board *GetBoardByBoardIdentifier(const char *boardIdentifier);
+      int GetCount();
+      void Clear();
+    };
+
+    inline BoardListImpl* GetBoardListImpl()
+    {
+      static BoardListImpl impl;
+      return &impl;
+    }
+
+    class BoardList
+    {
+    public:
+      void Init() { GetBoardListImpl()->Init(); }
+      Board *operator[] (int driverIndex) { return GetBoardListImpl()->GetBoardByDriverIndex(driverIndex); }
+      Board *GetBoardByDriverIndex(int driverIndex) { return GetBoardListImpl()->GetBoardByDriverIndex(driverIndex); }
+      Board *GetBoardByPciPosition(int pciPosition) { return GetBoardListImpl()->GetBoardByPciPosition(pciPosition); }
+      Board *GetBoardByBoardName(const char *boardName) { return GetBoardListImpl()->GetBoardByBoardName(boardName); }
+      Board *GetBoardByBoardIdentifier(const char *boardIdentifier) { return GetBoardListImpl()->GetBoardByBoardIdentifier(boardIdentifier); }
+      int GetCount() { return GetBoardListImpl()->GetCount(); }
+      void Clear() { GetBoardListImpl()->Clear(); }
+    };
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_BoardListImpl.h b/Common_Class/EuresysCam/Include/MCpp_BoardListImpl.h
new file mode 100644
index 0000000..289ca5e
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_BoardListImpl.h
@@ -0,0 +1,145 @@
+// MCpp_BoardImpl.h - MULTICAM C++ API - BoardListImpl
+#if !defined(__MCPP_BOARDLISTIMPL_H__)
+#define __MCPP_BOARDLISTIMPL_H__
+
+#include <cstring>
+#include "MCpp_BoardList.h"
+
+namespace
+{
+
+int mc_stricmp(const char *s1, const char *s2)
+{
+#if defined(__GNUC__)
+   return strcasecmp(s1, s2);
+#elif defined(_MSC_VER) && _MSC_VER >= 1400
+   // Visual Studio 8 or higher deprecate stricmp.
+   return _stricmp(s1, s2);
+#else
+   return stricmp(s1, s2);
+#endif
+}
+}
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+//    BoardListImpl* GetBoardListImpl()
+
+    inline BoardListImpl::BoardListImpl()
+    {
+      List = NULL;
+      Count = 0;
+    }
+
+    inline BoardListImpl::~BoardListImpl()
+    {
+      Clear();
+    }
+
+    inline void BoardListImpl::Clear()
+    {
+      int i;
+
+      if (List != NULL)
+      {
+        for (i = 0 ; i < Count ; i++)
+        {
+          if (List[i] != NULL)
+            delete List[i];
+        }
+        delete[] List;
+      }
+      List = NULL;
+      Count = 0;
+    }
+
+    // Initialization
+    inline void BoardListImpl::Init()
+    {
+      int i;
+
+      if (List != NULL) // Already initialized
+        return;
+
+      Config.GetParam(MC_BoardCount, Count);
+      if (Count > 0)
+      {
+        List = new Board *[Count];
+        for (i = 0 ; i < Count ; i++)
+          List[i] = NULL;
+        for (i = 0 ; i < Count ; i++)
+          List[i] = new Board(i);
+      }
+    }
+
+    // Accessors
+
+    inline Board *BoardListImpl::GetBoardByDriverIndex(int DriverIndex)
+    {
+      if (DriverIndex >= 0 && DriverIndex < Count)
+        return List[DriverIndex];
+      else
+      {
+        ThrowMultiCamException(MC_NO_BOARD_FOUND);
+        return NULL;
+      }
+    }
+
+    inline Board *BoardListImpl::GetBoardByPciPosition(int PciPosition)
+    {
+      int i;
+      int pos;
+
+      for (i = 0 ; i < Count ; i++)
+      {
+        List[i]->GetParam(MC_PciPosition, pos);
+        if (pos == PciPosition)
+          return List[i];
+      }
+
+      ThrowMultiCamException(MC_NO_BOARD_FOUND);
+      return NULL;
+    }
+
+    inline Board *BoardListImpl::GetBoardByBoardName(const char *BoardName)
+    {
+      int i;
+      char name[64];
+
+      for (i = 0 ; i < Count ; i++)
+      {
+        List[i]->GetParam(MC_BoardName, name, sizeof(name));
+        if (mc_stricmp(name, BoardName) == 0)
+          return List[i];
+      }
+
+      ThrowMultiCamException(MC_NO_BOARD_FOUND);
+      return NULL;
+    }
+
+    inline Board *BoardListImpl::GetBoardByBoardIdentifier(const char *BoardIdentifier)
+    {
+      int i;
+      char id[64];
+
+      for (i = 0 ; i < Count ; i++)
+      {
+        List[i]->GetParam(MC_BoardIdentifier, id, sizeof(id));
+        if (mc_stricmp(id, BoardIdentifier) == 0)
+          return List[i];
+      }
+
+      ThrowMultiCamException(MC_NO_BOARD_FOUND);
+      return NULL;
+    }
+
+    inline int BoardListImpl::GetCount()
+    {
+      return Count;
+    }
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_Callback.h b/Common_Class/EuresysCam/Include/MCpp_Callback.h
new file mode 100644
index 0000000..205d422
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_Callback.h
@@ -0,0 +1,47 @@
+// MCpp_Callback.h - MULTICAM C++ API - Callback
+#if !defined(__MCPP_CALLBACK_H__)
+#define __MCPP_CALLBACK_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // Callback class
+    // --------------
+    class Callback
+    {
+    public:
+      virtual ~Callback() = 0;
+      virtual void RunUntyped(MultiCamObjectWithSignaling *object, SignalInfo &info) = 0;
+    };
+
+    template <class T, class OwnerType> class UserCallback : public Callback
+    {
+    private:
+      T *Object;
+      void (T::*Function)(OwnerType &channel, SignalInfo &info);
+
+    public:
+      UserCallback(T *obj, void (T::*f)(OwnerType &channel, SignalInfo &info)) :
+          Object(obj),
+            Function(f)
+          {
+          }
+          inline ~UserCallback()
+          {
+          }
+
+          void Run(OwnerType &channel, SignalInfo &info)
+          {
+            (Object->*Function)(channel, info);
+          }
+          void RunUntyped(MultiCamObjectWithSignaling *caller, SignalInfo &info)
+          {
+            Run(*reinterpret_cast<OwnerType*>(caller), info);
+          }
+    };
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_CallbackImpl.h b/Common_Class/EuresysCam/Include/MCpp_CallbackImpl.h
new file mode 100644
index 0000000..6c4690b
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_CallbackImpl.h
@@ -0,0 +1,15 @@
+// MCpp_CallbackImpl.h - MULTICAM C++ API - CallbackImpl
+#if !defined(__MCPP_CALLBACKIMPL_H__)
+#define __MCPP_CALLBACKIMPL_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline Callback::~Callback()
+    {
+    }
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_Channel.h b/Common_Class/EuresysCam/Include/MCpp_Channel.h
new file mode 100644
index 0000000..832f66f
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_Channel.h
@@ -0,0 +1,56 @@
+// MCpp_Channel.h - MULTICAM C++ API - Channel
+#if !defined(__MCPP_CHANNEL_H__)
+#define __MCPP_CHANNEL_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+
+    // ********************************************************************************************
+    // Channel class
+    // -------------
+    class Channel : public MultiCamObjectWithSignaling
+    {
+      WRAPPING_MEMBERS
+
+    protected:
+      virtual Surface *GetSurface(MCHANDLE Handle);
+      Internal::Container<Surface*> *SurfaceList;
+      void InitChannel(Board *board);
+
+    public:
+      Channel(Board *board, int connector);
+      Channel(Board *board, const char *connector);
+      inline ~Channel();
+      operator MCHANDLE() { return Handle; }
+
+      void SetActive();
+      void SetIdle();
+      void Prepare();
+
+      template <class TT>
+      void RegisterCallback(TT *owner, void (TT::*callbackMethod)(Channel &, SignalInfo &), MCSIGNAL signal)
+      {
+        if (owner == NULL || callbackMethod == NULL)
+        {
+          ::Euresys::MultiCam::Exception e(MC_INTERNAL_ERROR, "Invalid callback object or function");
+          throw e;
+        }
+
+
+        Callback *cb = new UserCallback<TT, Channel>(owner, callbackMethod);
+        RegisterCallbackInternal(cb, signal);
+      }
+
+      Surface *GetSurfaceByIndex(unsigned int index)
+      {
+        Surface *surf;
+        GetParam(MC_Cluster + index, surf);
+        return surf;
+      }
+    };
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_ChannelImpl.h b/Common_Class/EuresysCam/Include/MCpp_ChannelImpl.h
new file mode 100644
index 0000000..ed4f369
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_ChannelImpl.h
@@ -0,0 +1,139 @@
+// MCpp_ChannelImpl.h - MULTICAM C++ API - ChannelImpl
+#if !defined(__MCPP_CHANNELIMPL_H__)
+#define __MCPP_CHANNELIMPL_H__
+
+#include "MCpp_Channel.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // Constructors
+    inline Channel::Channel(Board *b, int Connector) :
+    SurfaceList(NULL)
+    {
+      try {
+        InitChannel(b);
+        SetParam(MC_Connector, Connector);
+      } catch (...) {
+        if (Handle != 0)
+          McDelete(Handle);
+        delete SurfaceList;
+        throw;
+      }
+    }
+
+    inline Channel::Channel(Board *b, const char *Connector) :
+    SurfaceList(NULL)
+    {
+      try {
+        InitChannel(b);
+        SetParam(MC_Connector, Connector);
+      } catch (...) {
+        if (Handle != 0)
+          McDelete(Handle);
+        delete SurfaceList;
+        throw;
+      }
+    }
+
+    inline void Channel::InitChannel(Board *b)
+    {
+      WRAPPING_MEMBERS_INIT
+
+      MCSTATUS status;
+      MCHANDLE handle;
+      int boardIx;
+
+      status = McCreate(MC_CHANNEL, &handle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_CREATE, "Channel");
+      Handle = handle;
+
+      b->GetParam(MC_DriverIndex, boardIx);
+      SetParam(MC_DriverIndex, boardIx);
+
+      SurfaceList = new Internal::List<Surface *, 16>();
+    }
+
+    // Destructor
+    inline Channel::~Channel()
+    {
+      MCSTATUS status;
+      int i;
+
+      if (Handle != 0)
+      {
+        status = McDelete(Handle);
+        if (status != MC_OK)
+          ThrowMultiCamException(status, TYPE_DELETE, "Channel");
+      }
+
+      for (i = 0 ; i < SurfaceList->GetCount() ; i++)
+      {
+        if (SurfaceList->At(i) != NULL)
+          delete SurfaceList->At(i);
+      }
+      delete SurfaceList;
+
+      WRAPPING_MEMBERS_UNINIT
+    }
+
+    // Channel activation
+    inline void Channel::SetActive()
+    {
+      SetParam(MC_ChannelState, MC_ChannelState_ACTIVE);
+    }
+
+    // Channel deactivation
+    inline void Channel::SetIdle()
+    {
+      int state;
+
+      GetParam(MC_ChannelState, state);
+      if (state == MC_ChannelState_ACTIVE)
+        SetParam(MC_ChannelState, MC_ChannelState_IDLE);
+    }
+
+    // Channel preparation
+    inline void Channel::Prepare()
+    {
+      int state;
+
+      GetParam(MC_ChannelState, state);
+      if (state == MC_ChannelState_ORPHAN)
+        SetParam(MC_ChannelState, MC_ChannelState_IDLE);
+      else if (state != MC_ChannelState_ACTIVE)
+        SetParam(MC_ChannelState, MC_ChannelState_READY);
+    }
+
+    // Get Surface from handle
+    inline Surface *Channel::GetSurface(MCHANDLE sHandle)
+    {
+      MCSTATUS status;
+      void *address;
+      Surface *surface;
+
+      if ((sHandle & 0xF0000000) != (MC_DEFAULT_SURFACE_HANDLE & 0xF0000000))
+        ThrowMultiCamException(MC_INVALID_VALUE);
+      status = McGetParamPtr(sHandle, MC_sctxt, &address);
+      if (status != MC_OK)
+      {
+        Euresys::MultiCam::Exception e(status, "礐++ Internal Error");
+        throw e;
+      }
+
+      if (address != NULL)
+        surface = reinterpret_cast<Surface *>(address);
+      else
+      {
+        surface = new Surface(sHandle);
+        SurfaceList->Add(surface);
+      }
+
+      return surface;
+    }
+
+  }
+}
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_Configuration.h b/Common_Class/EuresysCam/Include/MCpp_Configuration.h
new file mode 100644
index 0000000..3d01a8d
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_Configuration.h
@@ -0,0 +1,61 @@
+// MCpp_Configuration.h - MULTICAM C++ API - Configuration
+#if !defined(__MCPP_CONFIGURATION_H__)
+#define __MCPP_CONFIGURATION_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // Configuration class
+    // -------------------
+    class ConfigurationImpl : public MultiCamObject
+    {
+    public:
+      ConfigurationImpl();
+      ~ConfigurationImpl();
+    };
+
+    ConfigurationImpl* GetConfigurationImpl();
+
+    class Configuration
+    {
+    public:
+      void SetParam(MCPARAMID param, int value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, unsigned int value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, INT64 value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, const char *value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, double value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, Surface &value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, void *value) { GetConfigurationImpl()->SetParam(param, value); }
+
+      void SetParam(const char *param, int value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, unsigned int value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, INT64 value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, const char *value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, double value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, Surface &value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, void *value) { GetConfigurationImpl()->SetParam(param, value); }
+
+      void GetParam(MCPARAMID param, int &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, unsigned int &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, INT64 &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, char *value, int maxLength) { GetConfigurationImpl()->GetParam(param, value, maxLength); }
+      void GetParam(MCPARAMID param, double &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, Surface *&value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, void *&value) { GetConfigurationImpl()->GetParam(param, value); }
+
+      void GetParam(const char *param, int &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, unsigned int &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, INT64 &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, char *value, int maxLength) { GetConfigurationImpl()->GetParam(param, value, maxLength); }
+      void GetParam(const char *param, double &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, Surface *&value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, void *&value) { GetConfigurationImpl()->GetParam(param, value); }
+
+      MCHANDLE GetHandle() { return GetConfigurationImpl()->GetHandle(); }
+    };
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_ConfigurationImpl.h b/Common_Class/EuresysCam/Include/MCpp_ConfigurationImpl.h
new file mode 100644
index 0000000..da95add
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_ConfigurationImpl.h
@@ -0,0 +1,28 @@
+// MCpp_ConfigurationImpl.h - MULTICAM C++ API - ConfigurationImpl
+#if !defined(__MCPP_CONFIGURATIONIMPL_H__)
+#define __MCPP_CONFIGURATIONIMPL_H__
+
+#include "MCpp_Configuration.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline ConfigurationImpl::ConfigurationImpl()
+    {
+      Handle = MC_CONFIGURATION;
+    }
+
+    inline ConfigurationImpl::~ConfigurationImpl()
+    {
+    }
+
+    inline ConfigurationImpl* GetConfigurationImpl()
+    {
+      static ConfigurationImpl impl;
+      return &impl;
+    }
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_Exception.h b/Common_Class/EuresysCam/Include/MCpp_Exception.h
new file mode 100644
index 0000000..dde3a43
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_Exception.h
@@ -0,0 +1,32 @@
+// MCpp_Exception.h - MULTICAM C++ API - Exception
+#if !defined(__MCPP_EXCEPTION_H__)
+#define __MCPP_EXCEPTION_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // Exceptions
+    // ----------
+#define MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE	1024
+    struct Exception
+    {
+    private:
+      char McDescription[MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE];
+
+    public:
+      Exception(int error, const char *desc);
+      Exception(Exception &e);
+      Exception& operator=(Exception &e);
+      inline ~Exception();
+
+      int Error;
+      const char *What();
+      MCSTATUS GetMcStatus() { return Error; }
+    };
+
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_ExceptionImpl.h b/Common_Class/EuresysCam/Include/MCpp_ExceptionImpl.h
new file mode 100644
index 0000000..d2e30e2
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_ExceptionImpl.h
@@ -0,0 +1,41 @@
+// MCpp_ExceptionImpl.h - MULTICAM C++ API - ExceptionImpl
+#if !defined(__MCPP_EXCEPTIONIMPL_H__)
+#define __MCPP_EXCEPTIONIMPL_H__
+
+#include <cstring>
+#include "MCpp_Exception.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline Exception::Exception(INT32 anError, const char *desc)
+    {
+      Error = anError ;
+      strncpy(McDescription, desc, MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE);
+    }
+
+    inline Exception::Exception(Exception &e)
+    {
+      Error = e.Error ;
+      strncpy(McDescription, e.What(), MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE);
+    }
+
+    inline Exception& Exception::operator=(Exception& e) 
+    { 
+      Error = e.Error ;
+      strncpy(McDescription, e.What(), MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE);
+      return *this; 
+    }
+
+    inline Exception::~Exception()
+    {
+    }
+
+    inline const char *Exception::What()
+    {
+      return McDescription;
+    }
+  }
+}
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_MultiCamObject.h b/Common_Class/EuresysCam/Include/MCpp_MultiCamObject.h
new file mode 100644
index 0000000..f13ed68
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_MultiCamObject.h
@@ -0,0 +1,59 @@
+// MCpp_MulticamObject.h - MULTICAM C++ API - MulticamObject
+#if !defined(__MCPP_MULTICAMOBJECT_H__)
+#define __MCPP_MULTICAMOBJECT_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // MultiCamObject: base class for Configuration, Board, Surface and Channel classes
+    // --------------------------------------------------------------------------------
+    struct Exception;
+    class Surface;
+    class MultiCamObject
+    {
+    protected:
+      MCHANDLE Handle;
+      virtual Surface *GetSurface(MCHANDLE handle);
+    public:
+      MultiCamObject();
+      virtual ~MultiCamObject() {}
+
+    public:
+      void SetParam(MCPARAMID param, int value);
+      void SetParam(MCPARAMID param, unsigned int value);
+      void SetParam(MCPARAMID param, INT64 value);
+      void SetParam(MCPARAMID param, const char *value);
+      void SetParam(MCPARAMID param, double value);
+      void SetParam(MCPARAMID param, Surface &value);
+      void SetParam(MCPARAMID param, void *value);
+      void SetParam(const char *param, int value);
+      void SetParam(const char *param, unsigned int value);
+      void SetParam(const char *param, INT64 value);
+      void SetParam(const char *param, const char *value);
+      void SetParam(const char *param, double value);
+      void SetParam(const char *param, Surface &value);
+      void SetParam(const char *param, void *value);
+
+      void GetParam(MCPARAMID param, int &value);
+      void GetParam(MCPARAMID param, unsigned int &value);
+      void GetParam(MCPARAMID param, INT64 &value);
+      void GetParam(MCPARAMID param, char *value, int maxLength);
+      void GetParam(MCPARAMID param, double &value);
+      void GetParam(MCPARAMID param, Surface *&value);
+      void GetParam(MCPARAMID param, void *&value);
+      void GetParam(const char *param, int &value);
+      void GetParam(const char *param, unsigned int &value);
+      void GetParam(const char *param, INT64 &value);
+      void GetParam(const char *param, char *value, int maxLength);
+      void GetParam(const char *param, double &value);
+      void GetParam(const char *param, Surface *&value);
+      void GetParam(const char *param, void *&value);
+
+      MCHANDLE GetHandle();
+    };
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectImpl.h b/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectImpl.h
new file mode 100644
index 0000000..17d3dd8
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectImpl.h
@@ -0,0 +1,264 @@
+// MCpp_MulticamObjectImpl.h - MULTICAM C++ API - MulticamObjectImpl
+#if !defined(__MCPP_MULTICAMOBJECTIMPL_H__)
+#define __MCPP_MULTICAMOBJECTIMPL_H__
+
+#include "MCpp_MultiCamObject.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline MultiCamObject::MultiCamObject() : Handle(0)
+    {
+    }
+
+    // Get Surface from handle
+    inline Surface *MultiCamObject::GetSurface(MCHANDLE )
+    {
+      ThrowMultiCamException(MC_BAD_PARAMETER);
+      return NULL;
+    }
+
+    // SetParam
+    inline void MultiCamObject::SetParam(MCPARAMID Param, int Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamInt(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, unsigned int Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamInt(Handle, Param, (INT32)Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, (int)Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, INT64 Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamInt64(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, const char *Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamStr(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, double Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamFloat(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, Surface &Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamInst(Handle, Param, Value.Handle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, (int)Value.Handle);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, void *Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamPtr(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, int Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmInt(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, unsigned int Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmInt(Handle, Param, (INT32)Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, (int)Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, INT64 Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmInt64(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, const char *Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmStr(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, double Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmFloat(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, Surface &Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmInst(Handle, Param, Value.Handle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, (int)Value.Handle);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, void *Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmPtr(Handle, Param, Value);
+      if (status != MC_OK)
+          ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+
+    // GetParam
+    inline void MultiCamObject::GetParam(MCPARAMID Param, int &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamInt(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, unsigned int &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamInt(Handle, Param, (PINT32)&Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, INT64 &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamInt64(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, char *Value, int MaxLength)
+    {
+      MCSTATUS status;
+
+      status = McGetParamStr(Handle, Param, Value, MaxLength);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, double &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamFloat(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, Surface *&Value)
+    {
+      MCSTATUS status;
+      MCHANDLE sHandle;
+
+      status = McGetParamInst(Handle, Param, &sHandle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+
+      Value = GetSurface(sHandle);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, void *&Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamPtr(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, int &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmInt(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, unsigned int &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmInt(Handle, Param, (PINT32)&Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, INT64 &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmInt64(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, char *Value, int MaxLength)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmStr(Handle, Param, Value, MaxLength);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, double &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmFloat(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, Surface *&Value)
+    {
+      MCSTATUS status;
+      MCHANDLE sHandle;
+
+      status = McGetParamNmInst(Handle, Param, &sHandle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+
+      Value = GetSurface(sHandle);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, void *&Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmPtr(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+
+    // GetHandle
+    inline MCHANDLE MultiCamObject::GetHandle()
+    {
+      return Handle;
+    }
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h b/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h
new file mode 100644
index 0000000..2685f3e
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h
@@ -0,0 +1,58 @@
+// MCpp_MulticamObjectWithSignaling.h - MULTICAM C++ API - MulticamObjectWithSignaling
+#if !defined(__MCPP_MULTICAMOBJECTWITHSIGNALING_H__)
+#define __MCPP_MULTICAMOBJECTWITHSIGNALING_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+
+    namespace Internal 
+    {
+      template<typename T>
+      class Container 
+      {
+      public:
+        Container() {}
+        virtual inline ~Container() {}
+        virtual T At(int Index) const = 0;
+        virtual int GetCount() const = 0;
+        virtual int Add(T &item) = 0;
+        virtual void Assign(int , T ) {}
+        virtual void DeleteAll() {}
+      };
+    }
+
+    class SignalInfo;
+    class Callback;
+    template <class T, class OwnerType> class UserCallback;
+
+    class MultiCamObjectWithSignaling : public MultiCamObject
+    {
+    private:
+      Internal::Container<Callback*> *Callbacks;
+      bool CbReg;
+
+      void GetSignalInfo(PMCSIGNALINFO mcInfo, SignalInfo *Info);
+
+    public:
+      void CbRoutine(PMCSIGNALINFO mcInfo);
+      void RegisterCallbackInternal(Callback *cb, MCSIGNAL Signal);
+
+      MultiCamObjectWithSignaling();
+      virtual ~MultiCamObjectWithSignaling();
+
+      void UnregisterCallback(MCSIGNAL signal);
+      void RegisterRawCallback(void *, void *, int);
+
+      void WaitSignal(MCSIGNAL signal, unsigned int timeout, SignalInfo &info) { WaitForSignal(signal, timeout, info); }
+      void WaitForSignal(MCSIGNAL signal, unsigned int timeout, SignalInfo &info);
+      void GetSignalInfo(MCSIGNAL signal, SignalInfo &info);
+
+    };
+
+
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h b/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h
new file mode 100644
index 0000000..774bdce
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h
@@ -0,0 +1,142 @@
+// MCpp_MulticamObjectWithSignalingImpl.h - MULTICAM C++ API - MulticamObjectWithSignalingImpl
+#if !defined(__MCPP_MULTICAMOBJECTWITHSIGNALINGIMPL_H__)
+#define __MCPP_MULTICAMOBJECTWITHSIGNALINGIMPL_H__
+
+#include "MCpp_MultiCamObjectWithSignaling.h"
+#include "containers.h"
+#include "CCallbacks.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline MultiCamObjectWithSignaling::MultiCamObjectWithSignaling() : CbReg(false)
+    {
+      Callbacks = new Euresys::MultiCam::Internal::AssociativeArray < Callback* > ();
+    }
+
+    inline MultiCamObjectWithSignaling::~MultiCamObjectWithSignaling()
+    {
+      if (Callbacks != NULL)
+      {
+        Callbacks->DeleteAll();
+        delete Callbacks;
+      }
+    }
+
+    // Callback dispatcher routine
+    inline void MultiCamObjectWithSignaling::CbRoutine(PMCSIGNALINFO mcInfo)
+    {
+      SignalInfo info;
+      Callback *cb = NULL;
+
+      GetSignalInfo(mcInfo, &info);
+
+      if (info.Signal <= 0 )
+        return;
+
+      cb = Callbacks->At(info.Signal);
+      if (cb == NULL)
+        cb = Callbacks->At(MC_SIG_ANY);
+
+      if (cb != NULL)
+        cb->RunUntyped(this, info);
+    }
+
+    // WaitSignal
+    inline void MultiCamObjectWithSignaling::WaitForSignal(MCSIGNAL Signal, unsigned int Timeout, SignalInfo &Info)
+    {
+      MCSTATUS status;
+      MCSIGNALINFO mcInfo;
+
+      status = McWaitSignal(Handle, Signal, Timeout, &mcInfo);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_WAIT_SIGNAL);
+      GetSignalInfo(&mcInfo, &Info);
+    }
+
+    // GetSignalInfo
+    inline void MultiCamObjectWithSignaling::GetSignalInfo(MCSIGNAL Signal, SignalInfo &Info)
+    {
+      MCSTATUS status;
+      MCSIGNALINFO mcInfo;
+
+      status = McGetSignalInfo(Handle, Signal, &mcInfo);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET_SIGNALINFO);
+      GetSignalInfo(&mcInfo, &Info);
+    }
+
+    // Convert MCSIGNALINFO to Euresys.MultiCam.SignalInfo
+    inline void MultiCamObjectWithSignaling::GetSignalInfo(PMCSIGNALINFO mcInfo, SignalInfo *Info)
+    {
+      Info->Signal = mcInfo->Signal;
+
+      if (Info->Signal == MC_SIG_SURFACE_FILLED ||
+        Info->Signal == MC_SIG_SURFACE_PROCESSING)
+        Info->Surf = GetSurface(mcInfo->SignalInfo);
+      else
+        Info->Surf = NULL;
+    }
+
+    inline void MultiCamObjectWithSignaling::RegisterCallbackInternal(Callback *cb, MCSIGNAL Signal)
+    {
+      if (Signal < 0)
+        ThrowMultiCamException(MC_OUT_OF_BOUND, TYPE_REGISTER_CB);
+
+      // Register the user callback
+      if (Callbacks->At(Signal) != NULL)
+        delete Callbacks->At(Signal);
+      Callbacks->Assign(Signal, cb);
+
+      // Register the global callback function (if necessary)
+      if (!CbReg)
+      {
+        MCSTATUS status = McRegisterCallback(Handle, GlobalCallbackFunction, this);
+        if (status != MC_OK)
+          ThrowMultiCamException(status, TYPE_REGISTER_CB);
+        CbReg = true;
+      }
+    }
+
+    inline void MultiCamObjectWithSignaling::RegisterRawCallback(void *CbFunction, void *CbContext, int Signal)
+    {
+      if (CbFunction == NULL)
+      {
+        Euresys::MultiCam::Exception e(MC_INTERNAL_ERROR, "Invalid callback function");
+        throw e;
+      }
+
+      Callback *cb = new Euresys::MultiCam::CFunctionCallback(CbContext, (PMCPP_C_CALLBACK)CbFunction);
+      RegisterCallbackInternal(cb, Signal);
+    }
+
+    inline void MultiCamObjectWithSignaling::UnregisterCallback(MCSIGNAL Signal)
+    {
+      if (Signal < 0)
+        ThrowMultiCamException(MC_OUT_OF_BOUND, TYPE_UNREGISTER_CB);
+
+      // Unregister the user callback
+      Callback *cb = Callbacks->At(Signal);
+      Callbacks->Assign(Signal, NULL);
+      delete cb;
+
+      // Unregister the global callback function (if necessary)
+      if (CbReg)
+      {
+        int i;
+        int count = Callbacks->GetCount();
+        for (i = 0 ; i <= count && Callbacks->At(i) == NULL ; i++);
+        if (i > Callbacks->GetCount())
+        {
+          MCSTATUS status = McRegisterCallback(Handle, NULL, NULL);
+          if (status != MC_OK)
+            ThrowMultiCamException(status, TYPE_UNREGISTER_CB);
+          CbReg = false;
+        }
+      }
+    }
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_SignalInfo.h b/Common_Class/EuresysCam/Include/MCpp_SignalInfo.h
new file mode 100644
index 0000000..877d20b
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_SignalInfo.h
@@ -0,0 +1,30 @@
+// MCpp_SignalInfo.h - MULTICAM C++ API - SignalInfo
+#if !defined(__MCPP_SIGNALINFO_H__)
+#define __MCPP_SIGNALINFO_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // SignalInfo class
+    // ----------------
+    class SignalInfo
+    {
+      WRAPPING_MEMBERS
+
+    public:
+      SignalInfo() 
+      {
+        WRAPPING_MEMBERS_INIT
+      };
+      ~SignalInfo();
+
+    public:
+      MCSIGNAL Signal;
+      Surface *Surf;
+    };
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_SignalInfoImpl.h b/Common_Class/EuresysCam/Include/MCpp_SignalInfoImpl.h
new file mode 100644
index 0000000..2333c20
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_SignalInfoImpl.h
@@ -0,0 +1,18 @@
+// MCpp_SignalInfoImpl.h - MULTICAM C++ API - SignalInfoImpl
+#if !defined(__MCPP_SIGNALINFOIMPL_H__)
+#define __MCPP_SIGNALINFOIMPL_H__
+
+#include "MCpp_SignalInfo.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline SignalInfo::~SignalInfo()
+    {
+      WRAPPING_MEMBERS_UNINIT
+    }
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_Surface.h b/Common_Class/EuresysCam/Include/MCpp_Surface.h
new file mode 100644
index 0000000..3a6afda
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_Surface.h
@@ -0,0 +1,33 @@
+// MCpp_Surface.h - MULTICAM C++ API - Surface
+#if !defined(__MCPP_SURFACE_H__)
+#define __MCPP_SURFACE_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // Surface class
+    // -------------
+
+    class Surface : public MultiCamObject
+    {
+      WRAPPING_MEMBERS
+
+    protected:
+      bool UserSurface;
+    public:
+      Surface(MCHANDLE aHandle);
+
+    public:
+      Surface();
+      inline ~Surface();
+      operator MCHANDLE() { return Handle; }
+
+      void Reserve();
+      void Free();
+    };
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_SurfaceImpl.h b/Common_Class/EuresysCam/Include/MCpp_SurfaceImpl.h
new file mode 100644
index 0000000..299578f
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_SurfaceImpl.h
@@ -0,0 +1,77 @@
+// MCpp_SurfaceImpl.h - MULTICAM C++ API - SurfaceImpl
+#if !defined(__MCPP_SURFACEIMPL_H__)
+#define __MCPP_SURFACEIMPL_H__
+
+#include "MCpp_Surface.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline Surface::Surface()
+    {
+      WRAPPING_MEMBERS_INIT
+
+      MCSTATUS status;
+      MCHANDLE handle;
+
+      status = McCreate(MC_DEFAULT_SURFACE_HANDLE, &handle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_CREATE, "Surface");
+      Handle = handle;
+      UserSurface = true;
+
+      // Link the MultiCam Surface to this object
+      SetParam(MC_sctxt, this);
+    }
+
+    inline Surface::Surface(MCHANDLE aHandle)
+    {
+      WRAPPING_MEMBERS_INIT
+
+      Handle = aHandle;
+      UserSurface = false;
+
+      // Link the MultiCam Surface to this object
+      SetParam(MC_sctxt, this);
+    }
+
+    inline Surface::~Surface()
+    {
+      MCSTATUS status;
+
+      if (Handle != 0)
+      {
+        if (UserSurface)
+        {
+          status = McDelete(Handle);
+          if (status != MC_OK)
+            ThrowMultiCamException(status, TYPE_DELETE, "Surface");
+        }
+        else
+        {
+          try {
+            SetParam(MC_sctxt, (void *)NULL);
+          }
+          catch (Euresys::MultiCam::Exception &) // MultiCam may already have deleted the surface
+          {
+          }
+        }
+      }
+      WRAPPING_MEMBERS_UNINIT
+    }
+
+    // Manual surface reservation
+    inline void Surface::Reserve()
+    {
+      SetParam(MC_SurfaceState, MC_SurfaceState_RESERVED);
+    }
+
+    inline void Surface::Free()
+    {
+      SetParam(MC_SurfaceState, MC_SurfaceState_FREE);
+    }
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_global.h b/Common_Class/EuresysCam/Include/MCpp_global.h
new file mode 100644
index 0000000..db0d786
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_global.h
@@ -0,0 +1,65 @@
+// MCpp_globalImpl.h - MULTICAM C++ API - GlobalsImpl
+#if !defined(__MCPP_GLOBAL_H__)
+#define __MCPP_GLOBAL_H__
+
+// ****************************************************************************************************
+// Exception description
+//
+//typedef
+typedef enum
+{
+  TYPE_NO_OP,
+  TYPE_SET,
+  TYPE_GET,
+  TYPE_CREATE,
+  TYPE_DELETE,
+  TYPE_WAIT_SIGNAL,
+  TYPE_GET_SIGNALINFO,
+  TYPE_REGISTER_CB,
+  TYPE_UNREGISTER_CB,
+  TYPE_OPENDRIVER,
+  TYPE_PARAMINFO,
+  TYPE_ENUMERATE
+} OperationType;
+
+static const char *OperationStr[] =
+{
+  "",
+  "Cannot set param",
+  "Cannot get param",
+  "Cannot create",
+  "Cannot delete",
+  "Wait Signal Error",
+  "Get Signal Information Error",
+  "Register Callback Error",
+  "Unregister Callback Error",
+  "Cannot open MultiCam driver",
+  "Cannot get parameter info",
+  "Enumerate parameters Error"
+};
+
+void MCAPI GlobalCallbackFunction(PMCSIGNALINFO CbInfo);
+void ThrowMultiCamException(MCSTATUS reportedStatus, OperationType Type = TYPE_NO_OP, const char *Name = NULL, const char *Value = NULL);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE , MCPARAMID ParamId, const char *Value = NULL);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, int Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, INT64 Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, double Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, void *Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, int Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, INT64 Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, double Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, void *Value);
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // MultiCam initialization and cleanup functions
+    // ---------------------------------------------
+    void Initialize();
+    void Terminate();
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MCpp_globalImpl.h b/Common_Class/EuresysCam/Include/MCpp_globalImpl.h
new file mode 100644
index 0000000..8d0e4ec
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MCpp_globalImpl.h
@@ -0,0 +1,136 @@
+// MCpp_globalImpl.h - MULTICAM C++ API - GlobalsImpl
+#if !defined(__MCPP_GLOBALIMPL_H__)
+#define __MCPP_GLOBALIMPL_H__
+
+#include "MCpp_global.h"
+#include <cstdio>
+
+// ****************************************************************************************************
+// Global callback function
+// ------------------------
+
+inline void MCAPI GlobalCallbackFunction(PMCSIGNALINFO CbInfo)
+{
+  Euresys::MultiCam::MultiCamObjectWithSignaling *signaler = reinterpret_cast<Euresys::MultiCam::MultiCamObjectWithSignaling *>(CbInfo->Context);
+  if (signaler != NULL)
+    signaler->CbRoutine(CbInfo);
+}
+
+
+inline void ThrowMultiCamException(MCSTATUS reportedStatus, OperationType Type, const char *Name, const char *Value)
+{
+  int aStatus = -reportedStatus;
+  char ErrorDesc[256];
+
+  char Description[MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE];
+
+  if (McGetParamStr(MC_CONFIGURATION, MC_ErrorDesc+aStatus, ErrorDesc, 256) != MC_OK)
+    sprintf(ErrorDesc, "Unknown error");
+
+  if (Type == TYPE_NO_OP)
+    sprintf(Description, "%s", ErrorDesc);
+
+  else if (Type == TYPE_SET)
+    sprintf(Description, "%s '%s' to value '%s': %s", OperationStr[Type], Name? Name:"Unknown parameter", Value? Value:"", ErrorDesc);
+
+  else if (Type == TYPE_GET)
+    sprintf(Description, "%s '%s': %s", OperationStr[Type], Name? Name:"unknown parameter", ErrorDesc);
+
+  else if (Type == TYPE_CREATE || Type == TYPE_DELETE)
+    sprintf(Description, "%s %s: %s", OperationStr[Type], Name? Name:"", ErrorDesc);
+
+  else
+    sprintf(Description, "%s: %s", OperationStr[Type], ErrorDesc);
+
+  Euresys::MultiCam::Exception e(reportedStatus, Description);
+  throw e;
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE , MCPARAMID ParamId, const char *Value)
+{
+  char paramStr[64];
+
+  sprintf(paramStr, "%i", ParamId);
+  ThrowMultiCamException(reportedStatus, Type, paramStr, Value);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, int Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%d", Value);
+  ThrowMultiCamException(reportedStatus, Type, Name, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, INT64 Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "0x%llx", Value);
+  ThrowMultiCamException(reportedStatus, Type, Name, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, double Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%f", Value);
+  ThrowMultiCamException(reportedStatus, Type, Name, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, void *Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%p", Value);
+  ThrowMultiCamException(reportedStatus, Type, Name, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, int Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%d", Value);
+  ThrowMultiCamException(reportedStatus, Type, Instance, ParamId, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, double Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%f", Value);
+  ThrowMultiCamException(reportedStatus, Type, Instance, ParamId, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, INT64 Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "0x%llx", Value);
+  ThrowMultiCamException(reportedStatus, Type, Instance, ParamId, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, void *Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%p", Value);
+  ThrowMultiCamException(reportedStatus, Type, Instance, ParamId, ValueStr);
+}
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // MultiCam initialization and cleanup functions
+    // ---------------------------------------------
+    inline void Initialize()
+    {
+      MCSTATUS status;
+      status = McOpenDriver(NULL);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_OPENDRIVER);
+      Boards.Init();
+    }
+
+    inline void Terminate()
+    {
+      McCloseDriver();
+    }
+  }
+}
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/McDef.h b/Common_Class/EuresysCam/Include/McDef.h
new file mode 100644
index 0000000..8539bf2
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/McDef.h
@@ -0,0 +1,72 @@
+
+// MCDEF.H -- MULTICAM DEFINITIONS
+
+#ifndef _MULTICAM_DEF_
+#define _MULTICAM_DEF_
+
+// CALLBACK REASONS
+#define MC_MAX_EVENTS                       12
+#define MC_SIG_ANY                          0
+#define MC_SIG_SURFACE_PROCESSING           1
+#define MC_SIG_SURFACE_FILLED               2
+#define MC_SIG_UNRECOVERABLE_OVERRUN        3
+#define MC_SIG_FRAMETRIGGER_VIOLATION       4
+#define MC_SIG_START_EXPOSURE               5
+#define MC_SIG_END_EXPOSURE                 6
+#define MC_SIG_ACQUISITION_FAILURE          7
+#define MC_SIG_CLUSTER_UNAVAILABLE          8
+#define MC_SIG_RELEASE                      9
+#define MC_SIG_END_ACQUISITION_SEQUENCE     10
+#define MC_SIG_START_ACQUISITION_SEQUENCE   11
+#define MC_SIG_END_CHANNEL_ACTIVITY         12
+
+#define MC_SIG_GOLOW            (1 << 12)
+#define MC_SIG_GOHIGH           (2 << 12)
+#define MC_SIG_GOOPEN           (3 << 12)
+
+#define MC_MAX_BOARD_EVENTS     (3 << 12)
+
+// STATUS CODE
+#define MC_MAX_ERRORS_STD               27
+#define MC_OK                           0
+#define MC_NO_BOARD_FOUND               -1
+#define MC_BAD_PARAMETER                -2
+#define MC_IO_ERROR                     -3
+#define MC_INTERNAL_ERROR               -4
+#define MC_NO_MORE_RESOURCES            -5
+#define MC_IN_USE                       -6
+#define MC_NOT_SUPPORTED                -7
+#define MC_DATABASE_ERROR               -8
+#define MC_OUT_OF_BOUND                 -9
+#define MC_INSTANCE_NOT_FOUND           -10
+#define MC_INVALID_HANDLE               -11
+#define MC_TIMEOUT                      -12
+#define MC_INVALID_VALUE                -13
+#define MC_RANGE_ERROR                  -14
+#define MC_BAD_HW_CONFIG                -15
+#define MC_NO_EVENT                     -16
+#define MC_LICENSE_NOT_GRANTED          -17
+#define MC_FATAL_ERROR                  -18
+#define MC_HW_EVENT_CONFLICT            -19
+#define MC_FILE_NOT_FOUND               -20
+#define MC_OVERFLOW                     -21
+#define MC_INVALID_PARAMETER_SETTING    -22
+#define MC_PARAMETER_ILLEGAL_ACCESS     -23
+#define MC_CLUSTER_BUSY                 -24
+#define MC_SERVICE_ERROR                -25
+#define MC_INVALID_SURFACE              -26
+
+#define MC_MAX_ERRORS_MPF               3
+#define MC_MPF_ERROR_BASE               -100
+#define MC_BAD_GRABBER_CONFIG           -101
+#define MC_ILLEGAL_PAGELENGTH_VALUE     -102
+
+// MULTICAM CONSTANTS
+#define MC_INFINITE         -1
+#define MC_INDETERMINATE    -1
+#define MC_LOW_PART         0
+#define MC_HIGH_PART        1
+#define MC_DISABLE          0
+#define MC_UNKNOWN          -2
+
+#endif // _MULTICAM_DEF_
diff --git a/Common_Class/EuresysCam/Include/McIo.h b/Common_Class/EuresysCam/Include/McIo.h
new file mode 100644
index 0000000..ec5b079
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/McIo.h
@@ -0,0 +1,231 @@
+
+// MCIO.H -- MULTICAM IO DEFINITIONS
+
+#ifndef _MULTICAM_IO_
+#define _MULTICAM_IO_
+
+// I/O ADDRESSING
+#define MC_A1IN         28
+#define MC_A1OUT        28
+#define MC_A2IN         29
+#define MC_A2OUT        29
+#define MC_ACC1         21
+#define MC_ACC2         22
+#define MC_ACC3         23
+#define MC_ACC4         24
+#define MC_ACK          27
+#define MC_ADVAL        23
+#define MC_AFVAL        22
+#define MC_ALVAL        21
+#define MC_ASPARE       24
+#define MC_B1IN         38
+#define MC_B1OUT        38
+#define MC_B2IN         39
+#define MC_B2OUT        39
+#define MC_BCC1         31
+#define MC_BCC2         32
+#define MC_BCC3         33
+#define MC_BCC4         34
+#define MC_BCK          37
+#define MC_BDVAL        33
+#define MC_BFVAL        32
+#define MC_BLVAL        31
+#define MC_BSPARE       34
+#define MC_CC1          21
+#define MC_CC2          22
+#define MC_CC3          23
+#define MC_CC4          24
+#define MC_CK           27
+#define MC_DVAL         23
+#define MC_FVAL         22
+#define MC_GRN          52
+#define MC_GRNA         52
+#define MC_GRNB         54
+#define MC_GRNX         52
+#define MC_GRNY         54
+#define MC_GRNZ         56
+#define MC_IN1          1
+#define MC_IN2          2
+#define MC_IN3          3
+#define MC_IN4          4
+#define MC_IN5          5
+#define MC_IN6          6
+#define MC_IN7          7
+#define MC_IN8          8
+#define MC_IN9          9
+#define MC_IN10         10
+#define MC_IN11         11
+#define MC_IN12         12
+#define MC_IN13         13
+#define MC_IN14         14
+#define MC_IN15         15
+#define MC_IN16         16
+#define MC_IN17         17
+#define MC_IN18         18
+#define MC_IN19         19
+#define MC_IN20         20
+#define MC_LVAL         21
+#define MC_OUT1         1
+#define MC_OUT2         2
+#define MC_OUT3         3
+#define MC_OUT4         4
+#define MC_OUT5         5
+#define MC_OUT6         6
+#define MC_OUT7         7
+#define MC_OUT8         8
+#define MC_OUT9         9
+#define MC_OUT10        10
+#define MC_OUT11        11
+#define MC_OUT12        12
+#define MC_OUT13        13
+#define MC_OUT14        14
+#define MC_OUT15        15
+#define MC_OUT16        16
+#define MC_OUT17        17
+#define MC_OUT18        18
+#define MC_OUT19        19
+#define MC_OUT20        20
+#define MC_RED          51
+#define MC_REDA         51
+#define MC_REDB         53
+#define MC_REDX         51
+#define MC_REDY         53
+#define MC_REDZ         55
+#define MC_SPARE        24
+#define MC_STR          17
+#define MC_STX          17
+#define MC_STY          18
+#define MC_STZ          19
+#define MC_TRG          17
+#define MC_TRX          17
+#define MC_TRY          18
+#define MC_TRZ          19
+#define MC_XCK          27
+#define MC_XEIN         26
+#define MC_XEOUT        26
+#define MC_XGIN         24
+#define MC_XGOUT        24
+#define MC_XHIN         23
+#define MC_XHOUT        23
+#define MC_XRIN         22
+#define MC_XROUT        22
+#define MC_XVIN         25
+#define MC_XVOUT        25
+#define MC_YCK          37
+#define MC_YEIN         36
+#define MC_YEOUT        36
+#define MC_YGIN         34
+#define MC_YGOUT        34
+#define MC_YHIN         33
+#define MC_YHOUT        33
+#define MC_YRIN         32
+#define MC_YROUT        32
+#define MC_YVIN         35
+#define MC_YVOUT        35
+#define MC_ZCK          47
+#define MC_ZEIN         46
+#define MC_ZEOUT        46
+#define MC_ZGIN         44
+#define MC_ZGOUT        44
+#define MC_ZHIN         43
+#define MC_ZHOUT        43
+#define MC_ZRIN         42
+#define MC_ZROUT        42
+#define MC_ZVIN         45
+#define MC_ZVOUT        45
+#define MC_MV0_IN1      21
+#define MC_MV0_IN2      22
+#define MC_MV0_IN3      23
+#define MC_MV0_IN4      24
+#define MC_MV0_IN5      25
+#define MC_MV1_IN1      26
+#define MC_MV1_IN2      27
+#define MC_MV1_IN3      28
+#define MC_MV1_IN4      29
+#define MC_MV1_IN5      30
+#define MC_MV2_IN1      31
+#define MC_MV2_IN2      32
+#define MC_MV2_IN3      33
+#define MC_MV2_IN4      34
+#define MC_MV2_IN5      35
+#define MC_MV3_IN1      36
+#define MC_MV3_IN2      37
+#define MC_MV3_IN3      38
+#define MC_MV3_IN4      39
+#define MC_MV3_IN5      40
+#define MC_MV0_OUT1     21
+#define MC_MV0_OUT2     22
+#define MC_MV0_OUT3     23
+#define MC_MV0_OUT4     24
+#define MC_MV0_OUT5     25
+#define MC_MV1_OUT1     26
+#define MC_MV1_OUT2     27
+#define MC_MV1_OUT3     28
+#define MC_MV1_OUT4     29
+#define MC_MV1_OUT5     30
+#define MC_MV2_OUT1     31
+#define MC_MV2_OUT2     32
+#define MC_MV2_OUT3     33
+#define MC_MV2_OUT4     34
+#define MC_MV2_OUT5     35
+#define MC_MV3_OUT1     36
+#define MC_MV3_OUT2     37
+#define MC_MV3_OUT3     38
+#define MC_MV3_OUT4     39
+#define MC_MV3_OUT5     40
+#define MC_MIO0_IN1     100
+#define MC_MIO0_IN2     101
+#define MC_MIO0_IN3     102
+#define MC_MIO0_IN4     103
+#define MC_MIO1_IN1     104
+#define MC_MIO1_IN2     105
+#define MC_MIO1_IN3     106
+#define MC_MIO1_IN4     107
+#define MC_MIO2_IN1     108
+#define MC_MIO2_IN2     109
+#define MC_MIO2_IN3     110
+#define MC_MIO2_IN4     111
+#define MC_MIO3_IN1     112
+#define MC_MIO3_IN2     113
+#define MC_MIO3_IN3     114
+#define MC_MIO3_IN4     115
+#define MC_MIO4_IN1     116
+#define MC_MIO4_IN2     117
+#define MC_MIO4_IN3     118
+#define MC_MIO4_IN4     119
+#define MC_MIOSB_IN1    120
+#define MC_MIOSB_IN2    121
+#define MC_MIOSB_IN3    122
+#define MC_MIOSB_IN4    123
+#define MC_MIOSB_IN5    124
+#define MC_MIOSB_IN6    125
+#define MC_MIO0_OUT1    100
+#define MC_MIO0_OUT2    101
+#define MC_MIO0_OUT3    102
+#define MC_MIO0_OUT4    103
+#define MC_MIO1_OUT1    104
+#define MC_MIO1_OUT2    105
+#define MC_MIO1_OUT3    106
+#define MC_MIO1_OUT4    107
+#define MC_MIO2_OUT1    108
+#define MC_MIO2_OUT2    109
+#define MC_MIO2_OUT3    110
+#define MC_MIO2_OUT4    111
+#define MC_MIO3_OUT1    112
+#define MC_MIO3_OUT2    113
+#define MC_MIO3_OUT3    114
+#define MC_MIO3_OUT4    115
+#define MC_MIO4_OUT1    116
+#define MC_MIO4_OUT2    117
+#define MC_MIO4_OUT3    118
+#define MC_MIO4_OUT4    119
+#define MC_MIOSB_OUT1   120
+#define MC_MIOSB_OUT2   121
+#define MC_MIOSB_OUT3   122
+#define MC_MIOSB_OUT4   123
+#define MC_MIOSB_OUT5   124
+#define MC_MIOSB_OUT6   125
+
+#define MC_MAX_IO_INDEX 125
+
+#endif // _MULTICAM_IO_
diff --git a/Common_Class/EuresysCam/Include/McParams.h b/Common_Class/EuresysCam/Include/McParams.h
new file mode 100644
index 0000000..42648bf
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/McParams.h
@@ -0,0 +1,20872 @@
+// McParams.h Parameter Identifier File
+// Created: 2018/04/23
+// This file has been generated automatically and should not be modified
+#ifndef _McParams_
+#define _McParams_
+
+
+#define MC_DriverIndex                           (MCPARAMID)(    0 << 14)
+#define MC_PciPosition                           (MCPARAMID)(    1 << 14)
+#define MC_BoardName                             (MCPARAMID)(    2 << 14)
+#define MC_BoardIdentifier                       (MCPARAMID)(    3 << 14)
+#define MC_NameBoard                             (MCPARAMID)(    4 << 14)
+#define MC_SerialNumber                          (MCPARAMID)(    5 << 14)
+#define MC_BoardType                             (MCPARAMID)(    6 << 14)
+#define MC_BoardType_MULTI                         1
+#define MC_BoardType_MULTIPLUS                     2
+#define MC_BoardType_MULTIEXPRESS                  3
+#define MC_BoardType_GAMMA                         4
+#define MC_BoardType_ALPHA                         5
+#define MC_BoardType_PRESTISSIMO                   6
+#define MC_BoardType_VALUE                         7
+#define MC_BoardType_EXPERT                        8
+#define MC_BoardType_STREAM                        9
+#define MC_BoardType_ALPHA_CPCI                   10
+#define MC_BoardType_IOTA                         11
+#define MC_BoardType_ALPHA_2                      12
+#define MC_BoardType_PICOLO                       13
+#define MC_BoardType_PICOLO_PRO2                  14
+#define MC_BoardType_PICOLO_PRO3I                 15
+#define MC_BoardType_PICOLO_PRO3E                 16
+#define MC_BoardType_PICOLO_TETRA                 17
+#define MC_BoardType_PICOLO_JETX                  18
+#define MC_BoardType_EXPERT_2                     19
+#define MC_BoardType_EXPERT_2_CPCI                20
+#define MC_BoardType_VALUE_CPCI                   21
+#define MC_BoardType_COLORSCAN                    22
+#define MC_BoardType_COLORSCAN_CPCI               23
+#define MC_BoardType_PICOLO_TETRAX                24
+#define MC_BoardType_JUNIOR_4                     25
+#define MC_BoardType_DOMINO_HARMONY               26
+#define MC_BoardType_DOMINO_MELODY                27
+#define MC_BoardType_DOMINO_SYMPHONY              28
+#define MC_BoardType_DOMINO_DELTA                 29
+#define MC_BoardType_GRABLINK_AVENUE              30
+#define MC_BoardType_PICOLO_ALERT                 31
+#define MC_BoardType_PICOLO_DILIGENT              32
+#define MC_BoardType_PICOLO_TYMO                  33
+#define MC_BoardType_PICOLO_FULL_ALERT            34
+#define MC_BoardType_PICOLO_ALERT_RC              35
+#define MC_BoardType_QUICKPACK_CFA                36
+#define MC_BoardType_PICOLO_ALERT_PCIe            37
+#define MC_BoardType_GRABLINK_EXPRESS_PCIe        38
+#define MC_BoardType_PICOLO_DILIGENT_PLUS_PCIe    39
+#define MC_BoardType_PICOLO_ALERT_RC_PCIe         40
+#define MC_BoardType_DOMINO_SYMPHONY_PCI          41
+#define MC_BoardType_DOMINO_SYMPHONY_PCIe         42
+#define MC_BoardType_GRABLINK_QUICKPACK_CFA_PCIe  43
+#define MC_BoardType_GRABLINK_FULL                44
+#define MC_BoardType_GRABLINK_DUALBASE            45
+#define MC_BoardType_GRABLINK_BASE                46
+#define MC_BoardType_GRABLINK_FULL_XR             47
+#define MC_ModuleType                            (MCPARAMID)(    7 << 14)
+#define MC_ModuleType_NONE                         1
+#define MC_ModuleType_DIG16                        2
+#define MC_ModuleType_DIG32                        3
+#define MC_ModuleType_DIG16_C_2K644                4
+#define MC_ModuleType_DIG16_C_2K422                5
+#define MC_ModuleType_DIG16_C_CUSTOM               6
+#define MC_ModuleType_DIG32_B_8K644                7
+#define MC_ModuleType_DIG32_B_2K422                8
+#define MC_ModuleType_DIG32_B_CUSTOM               9
+#define MC_ModuleType_DIG32_644                   10
+#define MC_ModuleType_DIG32_C_2K422               11
+#define MC_ModuleType_DIG32_C_CUSTOM              12
+#define MC_ModuleType_DIG16_644                   13
+#define MC_ModuleType_DIG16_422                   14
+#define MC_ModuleType_DIG32_422                   15
+#define MC_ModuleType_CAMERALINK                  16
+#define MC_OemSafetyLock                         (MCPARAMID)(    8 << 14)
+#define MC_OemSafetyKey                          (MCPARAMID)(    9 << 14)
+#define MC_EvolutionNumber                       (MCPARAMID)(   10 << 14)
+#define MC_CamFile                               (MCPARAMID)(   11 << 14)
+#define MC_Cluster                               (MCPARAMID)(   12 << 14)
+#define MC_ClusterMode                           (MCPARAMID)(   13 << 14)
+#define MC_ClusterMode_AUTO                        1
+#define MC_ClusterMode_MANUAL                      2
+#define MC_ClusterMask                           (MCPARAMID)(   14 << 14)
+#define MC_ClusterMask_NONE                        1
+#define MC_ClusterMask_SKIP                        2
+#define MC_ClusterMask_HOLD                        3
+#define MC_ClusterMask_DELAY                       4
+#define MC_ClusterMask_STOP                        5
+#define MC_ChannelState                          (MCPARAMID)(   15 << 14)
+#define MC_ChannelState_IDLE                       1
+#define MC_ChannelState_ACTIVE                     2
+#define MC_ChannelState_READY                      3
+#define MC_ChannelState_FREE                       4
+#define MC_ChannelState_ORPHAN                     5
+#define MC_LineIndex                             (MCPARAMID)(   16 << 14)
+#define MC_SurfaceIndex                          (MCPARAMID)(   17 << 14)
+#define MC_TriggerMode                           (MCPARAMID)(   18 << 14)
+#define MC_TriggerMode_TIMER                       1
+#define MC_TriggerMode_GRABBER                     2
+#define MC_InitialPause                          (MCPARAMID)(   19 << 14)
+#define MC_Pause                                 (MCPARAMID)(   20 << 14)
+#define MC_InitialTrigger                        (MCPARAMID)(   21 << 14)
+#define MC_Trigger                               (MCPARAMID)(   22 << 14)
+#define MC_Trigger_PAUSE                           1
+#define MC_Trigger_GOHIGH                          2
+#define MC_Trigger_GOLOW                           3
+#define MC_GrabCount                             (MCPARAMID)(   23 << 14)
+#define MC_SignalEnable                          (MCPARAMID)(   24 << 14)
+#define MC_SignalEnable_NONE                       1
+#define MC_SignalEnable_PROCESSING                 2
+#define MC_SignalEnable_FILLED                     3
+#define MC_SignalEnable_OFF                        4
+#define MC_SignalEnable_ON                         5
+#define MC_SignalEnable_AFTER_EAS                  6
+#define MC_SignalEvent                           (MCPARAMID)(   25 << 14)
+#define MC_Usage                                 (MCPARAMID)(   26 << 14)
+#define MC_SurfaceSize                           (MCPARAMID)(   27 << 14)
+#define MC_SurfaceAddr                           (MCPARAMID)(   28 << 14)
+#define MC_SurfacePitch                          (MCPARAMID)(   29 << 14)
+#define MC_PlaneCount                            (MCPARAMID)(   30 << 14)
+#define MC_SurfaceState                          (MCPARAMID)(   31 << 14)
+#define MC_SurfaceState_FREE                       1
+#define MC_SurfaceState_FILLING                    2
+#define MC_SurfaceState_FILLED                     3
+#define MC_SurfaceState_PROCESSING                 4
+#define MC_SurfaceState_RESERVED                   5
+#define MC_SurfaceContext                        (MCPARAMID)(   32 << 14)
+#define MC_DebugMode                             (MCPARAMID)(   33 << 14)
+#define MC_ResourceId                            (MCPARAMID)(   34 << 14)
+#define MC_ResourceId_DSP1                         1
+#define MC_ResourceId_DSP2                         2
+#define MC_ResourceId_DSP12                        3
+#define MC_ResourceId_DSP3                         3
+#define MC_ResourceId_DSP4                         4
+#define MC_Source                                (MCPARAMID)(   35 << 14)
+#define MC_ProcessFile                           (MCPARAMID)(   36 << 14)
+#define MC_Black                                 (MCPARAMID)(   37 << 14)
+#define MC_White                                 (MCPARAMID)(   38 << 14)
+#define MC_BlackProfile                          (MCPARAMID)(   39 << 14)
+#define MC_WhiteProfile                          (MCPARAMID)(   40 << 14)
+#define MC_ProcessType                           (MCPARAMID)(   41 << 14)
+#define MC_ProcessorState                        (MCPARAMID)(   42 << 14)
+#define MC_ProcessorState_OFF                      1
+#define MC_ProcessorState_ON                       2
+#define MC_FillCount                             (MCPARAMID)(   43 << 14)
+#define MC_Gain                                  (MCPARAMID)(   44 << 14)
+#define MC_PageDuration                          (MCPARAMID)(   45 << 14)
+#define MC_OverrunCount                          (MCPARAMID)(   46 << 14)
+#define MC_Level                                 (MCPARAMID)(   47 << 14)
+#define MC_SurfaceLocation                       (MCPARAMID)(   48 << 14)
+#define MC_SurfaceLocation_HOST                    1
+#define MC_SurfaceLocation_DSP                     2
+#define MC_SurfaceLocation_BOARD                   3
+#define MC_SurfaceLocation_PHYSICAL                4
+#define MC_ErrorHandling                         (MCPARAMID)(   49 << 14)
+#define MC_ErrorHandling_NONE                      1
+#define MC_ErrorHandling_MSGBOX                    2
+#define MC_ErrorHandling_EXCEPTION                 3
+#define MC_ErrorHandling_MSGEXCEPTION              4
+#define MC_ForceTrig                             (MCPARAMID)(   50 << 14)
+#define MC_ForceTrig_TRIG                          1
+#define MC_ParamBlock                            (MCPARAMID)(   51 << 14)
+#define MC_SurfaceFormat                         (MCPARAMID)(   52 << 14)
+#define MC_SurfaceFormat_RAW                       1
+#define MC_SurfaceFormat_RGB24                     2
+#define MC_SurfaceFormat_PLANAR24                  3
+#define MC_SurfaceFormat_SPLITX                    4
+#define MC_Lookup                                (MCPARAMID)(   53 << 14)
+#define MC_Flags                                 (MCPARAMID)(   54 << 14)
+#define MC_HardwareKey                           (MCPARAMID)(   55 << 14)
+#define MC_AcqTimeout_ms                         (MCPARAMID)(   56 << 14)
+#define MC_LineTriggerViolation                  (MCPARAMID)(   57 << 14)
+#define MC_FrameTriggerViolation                 (MCPARAMID)(   58 << 14)
+#define MC_BoardTopology                         (MCPARAMID)(   59 << 14)
+#define MC_BoardTopology_3_3_0                     1
+#define MC_BoardTopology_2_3_1                     2
+#define MC_BoardTopology_2_2_2                     3
+#define MC_BoardTopology_2_2_1                     4
+#define MC_BoardTopology_1_3_1                     5
+#define MC_BoardTopology_1_1_2                     6
+#define MC_BoardTopology_1_1_1                     7
+#define MC_BoardTopology_2_2_11                    8
+#define MC_BoardTopology_11_3_1                    9
+#define MC_BoardTopology_11_11_2                  10
+#define MC_BoardTopology_11_11_11                 11
+#define MC_BoardTopology_0_3_1                    12
+#define MC_BoardTopology_2_2_0                    13
+#define MC_BoardTopology_2_2                      14
+#define MC_BoardTopology_2_1                      15
+#define MC_BoardTopology_1_1                      16
+#define MC_BoardTopology_2_11                     17
+#define MC_BoardTopology_11_11                    18
+#define MC_BoardTopology_0_2                      19
+#define MC_BoardTopology_1_1_1_1                  20
+#define MC_GrabberConfig                         (MCPARAMID)(   60 << 14)
+#define MC_GrabberConfig_1_1_1                     1
+#define MC_GrabberConfig_1_1_2                     2
+#define MC_GrabberConfig_2_0                       3
+#define MC_GrabberConfig_1_1                       4
+#define MC_GrabberConfig_0_2                       5
+#define MC_GrabberConfig_2_2_0                     6
+#define MC_MPFRevision                           (MCPARAMID)(   61 << 14)
+#define MC_BoardCount                            (MCPARAMID)(   62 << 14)
+#define MC_RemainingGrab                         (MCPARAMID)(   63 << 14)
+#define MC_ElapsedGrab                           (MCPARAMID)(   64 << 14)
+#define MC_LineDelay                             (MCPARAMID)(   65 << 14)
+#define MC_LutIndex                              (MCPARAMID)(   66 << 14)
+#define MC_InputLut                              (MCPARAMID)(   67 << 14)
+#define MC_SurfaceInfo                           (MCPARAMID)(   68 << 14)
+#define MC_GrabDuration_us                       (MCPARAMID)(   69 << 14)
+#define MC_SerialControlA                        (MCPARAMID)(   70 << 14)
+#define MC_SerialControlB                        (MCPARAMID)(   71 << 14)
+#define MC_TimeCode                              (MCPARAMID)(   72 << 14)
+#define MC_GenerateSignal                        (MCPARAMID)(   73 << 14)
+#define MC_GenerateSignal_EACH_EVENT               1
+#define MC_GenerateSignal_LATEST_EVENT             2
+#define MC_SignalHandling                        (MCPARAMID)(   74 << 14)
+#define MC_SignalHandling_ANY                      1
+#define MC_SignalHandling_CALLBACK_SIGNALING       2
+#define MC_SignalHandling_WAITING_SIGNALING        3
+#define MC_SignalHandling_OS_EVENT_SIGNALING       4
+#define MC_Parity                                (MCPARAMID)(   75 << 14)
+#define MC_Parity_NA                               1
+#define MC_Parity_UP                               2
+#define MC_Parity_DOWN                             3
+#define MC_Parity_UPDW                             4
+#define MC_Parity_DWUP                             5
+#define MC_TimeAnsi                              (MCPARAMID)(   76 << 14)
+#define MC_TimeStamp_us                          (MCPARAMID)(   77 << 14)
+#define MC_WatchdogResetsCount                   (MCPARAMID)(   78 << 14)
+#define MC_StartupTimeout_s                      (MCPARAMID)(   79 << 14)
+#define MC_ApplicationTimeout_s                  (MCPARAMID)(   80 << 14)
+#define MC_ErrorLog                              (MCPARAMID)(   81 << 14)
+#define MC_SurfaceCount                          (MCPARAMID)(   82 << 14)
+#define MC_sctxt                                 (MCPARAMID)(   83 << 14)
+#define MC_SurfaceSizeX                          (MCPARAMID)(   84 << 14)
+#define MC_SurfaceSizeY                          (MCPARAMID)(   85 << 14)
+#define MC_SurfaceColorFormat                    (MCPARAMID)(   86 << 14)
+#define MC_FilledPlanes                          (MCPARAMID)(   87 << 14)
+#define MC_SAB                                   (MCPARAMID)(   88 << 14)
+#define MC_TransferReport                        (MCPARAMID)(   89 << 14)
+#define MC_TransferReport_OK                       1
+#define MC_TransferReport_FIFO_OVERRUN             2
+#define MC_BufferAddress                         (MCPARAMID)(   90 << 14)
+#define MC_FrameType                             (MCPARAMID)(   91 << 14)
+#define MC_FrameType_I                             1
+#define MC_FrameType_P                             2
+#define MC_FrameType_B                             3
+#define MC_LastInSequence                        (MCPARAMID)(   92 << 14)
+#define MC_LastInSequence_TRUE                     1
+#define MC_LastInSequence_FALSE                    2
+#define MC_SurfaceReserved6                      (MCPARAMID)(   93 << 14)
+#define MC_SurfaceReserved7                      (MCPARAMID)(   94 << 14)
+#define MC_SurfaceReserved8                      (MCPARAMID)(   95 << 14)
+#define MC_SurfaceReserved9                      (MCPARAMID)(   96 << 14)
+#define MC_ParamInfoStructSize                   (MCPARAMID)(   97 << 14)
+#define MC_ErrorDesc                             (MCPARAMID)(   98 << 14)
+#define MC_MaxEvents                             (MCPARAMID)(   99 << 14)
+#define MC_CallbackPriority                      (MCPARAMID)(  100 << 14)
+#define MC_CallbackPriority_LOWEST                 1
+#define MC_CallbackPriority_BELOW_NORMAL           2
+#define MC_CallbackPriority_NORMAL                 3
+#define MC_CallbackPriority_ABOVE_NORMAL           4
+#define MC_CallbackPriority_HIGHEST                5
+#define MC_CallbackPriority_TIME_CRITICAL          6
+#define MC_CurrentTime_us                        (MCPARAMID)(  101 << 14)
+#define MC_MementoCritical                       (MCPARAMID)(  102 << 14)
+#define MC_MementoError                          (MCPARAMID)(  103 << 14)
+#define MC_MementoWarning                        (MCPARAMID)(  104 << 14)
+#define MC_MementoNotice                         (MCPARAMID)(  105 << 14)
+#define MC_MementoInfo                           (MCPARAMID)(  106 << 14)
+#define MC_MementoDebug                          (MCPARAMID)(  107 << 14)
+#define MC_MementoVerbose                        (MCPARAMID)(  108 << 14)
+#define MC_TrigMode                              (MCPARAMID)(  512 << 14)
+#define MC_TrigMode_INT                            1
+#define MC_TrigMode_EXT                            2
+#define MC_TrigMode_SOFT                           3
+#define MC_TrigMode_ENC                            3
+#define MC_TrigMode_EXTRC                          4
+#define MC_TrigMode_AUTO                           5
+#define MC_TrigMode_IMMEDIATE                      6
+#define MC_TrigMode_HARD                           7
+#define MC_TrigMode_COMBINED                       8
+#define MC_TrigCtl                               (MCPARAMID)(  513 << 14)
+#define MC_TrigCtl_TGOLOW                          1
+#define MC_TrigCtl_TGOHIGH                         2
+#define MC_TrigCtl_VGOLOW                          3
+#define MC_TrigCtl_VGOHIGH                         4
+#define MC_TrigFlt                               (MCPARAMID)(  514 << 14)
+#define MC_ExpScl                                (MCPARAMID)(  515 << 14)
+#define MC_ExpTrm                                (MCPARAMID)(  516 << 14)
+#define MC_DataWidth                             (MCPARAMID)(  517 << 14)
+#define MC_LinePeriod                            (MCPARAMID)(  518 << 14)
+#define MC_ImagePixelSize                        (MCPARAMID)(  519 << 14)
+#define MC_FramePeriod                           (MCPARAMID)(  520 << 14)
+#define MC_SensorWidth                           (MCPARAMID)(  521 << 14)
+#define MC_SensorHeight                          (MCPARAMID)(  522 << 14)
+#define MC_ImageSizeX                            (MCPARAMID)(  523 << 14)
+#define MC_ImageSizeY                            (MCPARAMID)(  524 << 14)
+#define MC_ImageFlipY                            (MCPARAMID)(  525 << 14)
+#define MC_ImageFlipY_OFF                          1
+#define MC_ImageFlipY_ON                           2
+#define MC_CameraChannels                        (MCPARAMID)(  526 << 14)
+#define MC_AcqScl                                (MCPARAMID)(  527 << 14)
+#define MC_AcqCount                              (MCPARAMID)(  528 << 14)
+#define MC_AcqShift                              (MCPARAMID)(  529 << 14)
+#define MC_AcqSplit                              (MCPARAMID)(  530 << 14)
+#define MC_FrameShift                            (MCPARAMID)(  531 << 14)
+#define MC_VcamCount                             (MCPARAMID)(  532 << 14)
+#define MC_StrCtl                                (MCPARAMID)(  533 << 14)
+#define MC_StrCtl_LOW                              1
+#define MC_StrCtl_HIGH                             2
+#define MC_StrCtl_PLSLOW                           3
+#define MC_StrCtl_PLSHIGH                          4
+#define MC_StrLvl                                (MCPARAMID)(  534 << 14)
+#define MC_StrLvl_DIS                              1
+#define MC_StrLvl_TTL                              2
+#define MC_StrLvl_OC                               3
+#define MC_StrLvl_OE                               4
+#define MC_StrPos                                (MCPARAMID)(  535 << 14)
+#define MC_StrDur                                (MCPARAMID)(  536 << 14)
+#define MC_PendLines                             (MCPARAMID)(  537 << 14)
+#define MC_FrameRstCtl                           (MCPARAMID)(  538 << 14)
+#define MC_FrameRstCtl_TPLSLOW                     1
+#define MC_FrameRstCtl_TPLSHIGH                    2
+#define MC_FrameRstCtl_DPLSLOW                     3
+#define MC_FrameRstCtl_DPLSHIGH                    4
+#define MC_FrameRstPos                           (MCPARAMID)(  539 << 14)
+#define MC_FrameRstDur                           (MCPARAMID)(  540 << 14)
+#define MC_ExpMode                               (MCPARAMID)(  541 << 14)
+#define MC_ExpMode_Reset_Width                     1
+#define MC_ExpMode_Dual_Reset_Interval             2
+#define MC_ExpMode_Reset_To_Expose_interval        3
+#define MC_ExpDur                                (MCPARAMID)(  542 << 14)
+#define MC_LineValCtl                            (MCPARAMID)(  543 << 14)
+#define MC_LineValCtl_LOW                          1
+#define MC_LineValCtl_HIGH                         2
+#define MC_LineValCtl_TLOW                         3
+#define MC_LineValCtl_THIGH                        4
+#define MC_FrameValCtl                           (MCPARAMID)(  544 << 14)
+#define MC_FrameValCtl_LOW                         1
+#define MC_FrameValCtl_HIGH                        2
+#define MC_FrameValCtl_TLOW                        3
+#define MC_FrameValCtl_THIGH                       4
+#define MC_FrameValFlt                           (MCPARAMID)(  545 << 14)
+#define MC_FrameValFlt_0                           1
+#define MC_FrameValFlt_4                           2
+#define MC_FrameValFlt_16                          3
+#define MC_FrameValFlt_64                          4
+#define MC_ExpCtl                                (MCPARAMID)(  546 << 14)
+#define MC_ExpCtl_TPLSLOW                          1
+#define MC_ExpCtl_TPLSHIGH                         2
+#define MC_ExpCtl_DPLSLOW                          3
+#define MC_ExpCtl_DPLSHIGH                         4
+#define MC_ClockPhase                            (MCPARAMID)(  547 << 14)
+#define MC_ClockPhase_0                            1
+#define MC_ClockPhase_90                           2
+#define MC_ClockPhase_180                          3
+#define MC_ClockPhase_270                          4
+#define MC_DataDelay                             (MCPARAMID)(  548 << 14)
+#define MC_DataDelay_NONE                          1
+#define MC_DataDelay_SLIGHT                        2
+#define MC_TestPat                               (MCPARAMID)(  549 << 14)
+#define MC_TestPat_OFF                             1
+#define MC_TestPat_ON                              2
+#define MC_TestPat_LaneID                          3
+#define MC_Line3Ctl                              (MCPARAMID)(  550 << 14)
+#define MC_Line3Ctl_RESET                          1
+#define MC_Line3Ctl_DLOW                           2
+#define MC_Line3Ctl_DHIGH                          3
+#define MC_Line3Ctl_TLOW                           4
+#define MC_Line3Ctl_THIGH                          5
+#define MC_Line3Ctl_EXPOSE                         6
+#define MC_Line4Ctl                              (MCPARAMID)(  551 << 14)
+#define MC_Line4Ctl_LOW                            1
+#define MC_Line4Ctl_HIGH                           2
+#define MC_Line4Ctl_REFCKA                         3
+#define MC_Line5Ctl                              (MCPARAMID)(  552 << 14)
+#define MC_Line5Ctl_EXPOSE                         1
+#define MC_Line5Ctl_DLOW                           2
+#define MC_Line5Ctl_DHIGH                          3
+#define MC_Line5Ctl_TLOW                           4
+#define MC_Line5Ctl_THIGH                          5
+#define MC_Line5Ctl_RESET                          6
+#define MC_Line6Ctl                              (MCPARAMID)(  553 << 14)
+#define MC_Line6Ctl_LOW                            1
+#define MC_Line6Ctl_HIGH                           2
+#define MC_BitMask                               (MCPARAMID)(  554 << 14)
+#define MC_RdoutTrm                              (MCPARAMID)(  555 << 14)
+#define MC_SacqLoc                               (MCPARAMID)(  556 << 14)
+#define MC_EacqLoc                               (MCPARAMID)(  557 << 14)
+#define MC_ExpDurT                               (MCPARAMID)(  558 << 14)
+#define MC_ImageSizeXModulo                      (MCPARAMID)(  559 << 14)
+#define MC_PerScl                                (MCPARAMID)(  560 << 14)
+#define MC_PerCnt                                (MCPARAMID)(  561 << 14)
+#define MC_EncScl                                (MCPARAMID)(  562 << 14)
+#define MC_RateCode                              (MCPARAMID)(  563 << 14)
+#define MC_SensorLength                          (MCPARAMID)(  564 << 14)
+#define MC_PageLength                            (MCPARAMID)(  565 << 14)
+#define MC_LineForbidPos                         (MCPARAMID)(  566 << 14)
+#define MC_LineSkipHold                          (MCPARAMID)(  567 << 14)
+#define MC_LineSkipHold_SKIP                       1
+#define MC_LineSkipHold_HOLD                       2
+#define MC_LineRstCtl                            (MCPARAMID)(  568 << 14)
+#define MC_LineRstCtl_PLSLOW                       1
+#define MC_LineRstCtl_PLSHIGH                      2
+#define MC_ExpCtl_PLSLOW                           1
+#define MC_ExpCtl_PLSHIGH                          2
+#define MC_FifoDepth                             (MCPARAMID)(  569 << 14)
+#define MC_FifoWidth                             (MCPARAMID)(  570 << 14)
+#define MC_FifoLineSize                          (MCPARAMID)(  571 << 14)
+#define MC_BackendInterruptMask                  (MCPARAMID)(  572 << 14)
+#define MC_ColorInputFormat                      (MCPARAMID)(  573 << 14)
+#define MC_ColorInputFormat_SerialBGR              1
+#define MC_ColorInputFormat_SerialRGB              2
+#define MC_ColorInputFormat_ParallelRGB            3
+#define MC_ColorOutputFormat                     (MCPARAMID)(  574 << 14)
+#define MC_ColorOutputFormat_Packed24              1
+#define MC_ColorOutputFormat_Planar8               2
+#define MC_ColorOutputFormat_Planar16              3
+#define MC_PageTrigMode                          (MCPARAMID)(  575 << 14)
+#define MC_PageTrigMode_INT                        1
+#define MC_PageTrigMode_EXT                        2
+#define MC_PageTrigMode_DELAY                      3
+#define MC_PageTrigMode_FVAL                       4
+#define MC_PageTrigMode_SOFT                       5
+#define MC_PageTrigCtl                           (MCPARAMID)(  576 << 14)
+#define MC_PageTrigCtl_TGOLOW                      1
+#define MC_PageTrigCtl_TGOHIGH                     2
+#define MC_PageTrigCtl_VGOLOW                      3
+#define MC_PageTrigCtl_VGOHIGH                     4
+#define MC_PageTrigCtl_DGOLOW                      5
+#define MC_PageTrigCtl_DGOHIGH                     6
+#define MC_PageTrigFlt                           (MCPARAMID)(  577 << 14)
+#define MC_PageDelay                             (MCPARAMID)(  578 << 14)
+#define MC_FrameForbidPos                        (MCPARAMID)(  579 << 14)
+#define MC_FrameSkipHold                         (MCPARAMID)(  580 << 14)
+#define MC_FrameSkipHold_SKIP                      1
+#define MC_FrameSkipHold_HOLD                      2
+#define MC_PageSkipHold                          (MCPARAMID)(  581 << 14)
+#define MC_PageSkipHold_SKIP                       1
+#define MC_PageSkipHold_HOLD                       2
+#define MC_Block                                 (MCPARAMID)(  582 << 14)
+#define MC_Atom                                  (MCPARAMID)(  583 << 14)
+#define MC_ChannelTopology                       (MCPARAMID)(  584 << 14)
+#define MC_ChannelTopology_Single                  1
+#define MC_ChannelTopology_DualXPair               2
+#define MC_ChannelTopology_DualXTap                3
+#define MC_ChannelTopology_DualXEnd                4
+#define MC_ChannelTopology_DualYPair               5
+#define MC_ChannelTopology_DualYEnd                6
+#define MC_ChannelTopology_Triple                  7
+#define MC_ChannelTopology_QuadX                   8
+#define MC_CameraTimings                         (MCPARAMID)(  585 << 14)
+#define MC_CameraTimings_Mono                      1
+#define MC_CameraTimings_Duo                       2
+#define MC_XChannels                             (MCPARAMID)(  586 << 14)
+#define MC_YChannels                             (MCPARAMID)(  587 << 14)
+#define MC_BlockSize                             (MCPARAMID)(  588 << 14)
+#define MC_PixelComponents                       (MCPARAMID)(  589 << 14)
+#define MC_BackEndProg                           (MCPARAMID)(  590 << 14)
+#define MC_BackEndProg_AB12                        1
+#define MC_BackEndProg_CD12                        2
+#define MC_BackEndProg_AB24                        3
+#define MC_BackEndProg_CD24                        4
+#define MC_BackEndProg_ABCD22                      5
+#define MC_BackEndProg_BGR24                       6
+#define MC_BackEndProg_PLANAR8                     7
+#define MC_BackEndProg_ABCD11                      8
+#define MC_BackEndProg_X                           9
+#define MC_DesiredLinePitch                      (MCPARAMID)(  591 << 14)
+#define MC_EncoderPitch                          (MCPARAMID)(  592 << 14)
+#define MC_MaxLineFrequency                      (MCPARAMID)(  593 << 14)
+#define MC_PixelClockFrequency                   (MCPARAMID)(  594 << 14)
+#define MC_LinePitch                             (MCPARAMID)(  595 << 14)
+#define MC_MinLineFrequency                      (MCPARAMID)(  596 << 14)
+#define MC_DesiredVCLKFrequency                  (MCPARAMID)(  597 << 14)
+#define MC_EffectiveVCLKFrequency                (MCPARAMID)(  598 << 14)
+#define MC_VCLKFrequencyError                    (MCPARAMID)(  599 << 14)
+#define MC_Smin                                  (MCPARAMID)(  600 << 14)
+#define MC_FVR                                   (MCPARAMID)(  601 << 14)
+#define MC_Rmin                                  (MCPARAMID)(  602 << 14)
+#define MC_Rmax                                  (MCPARAMID)(  603 << 14)
+#define MC_MinEncoderFrequency                   (MCPARAMID)(  604 << 14)
+#define MC_FrameCount                            (MCPARAMID)(  605 << 14)
+#define MC_MoleculeSize                          (MCPARAMID)(  606 << 14)
+#define MC_ZChannels                             (MCPARAMID)(  607 << 14)
+#define MC_Alines                                (MCPARAMID)(  608 << 14)
+#define MC_StartReadout                          (MCPARAMID)(  609 << 14)
+#define MC_StartReadout_Auto                       1
+#define MC_StartReadout_LineSync                   2
+#define MC_StartReadout_Flex                       3
+#define MC_StartReadout_FlexD                      4
+#define MC_StartReadout_FlexU                      5
+#define MC_FifoCap4                              (MCPARAMID)(  610 << 14)
+#define MC_Exposure                              (MCPARAMID)(  611 << 14)
+#define MC_MinExpose                             (MCPARAMID)(  612 << 14)
+#define MC_ExpPscl                               (MCPARAMID)(  613 << 14)
+#define MC_ExpTerm                               (MCPARAMID)(  614 << 14)
+#define MC_PageCount                             (MCPARAMID)(  615 << 14)
+#define MC_MinLinePeriod                         (MCPARAMID)(  616 << 14)
+#define MC_MinResetWidth                         (MCPARAMID)(  617 << 14)
+#define MC_ExpWidth                              (MCPARAMID)(  618 << 14)
+#define MC_StrWidth                              (MCPARAMID)(  619 << 14)
+#define MC_RstWidth                              (MCPARAMID)(  620 << 14)
+#define MC_Str2Rst                               (MCPARAMID)(  621 << 14)
+#define MC_MinRstWidth                           (MCPARAMID)(  622 << 14)
+#define MC_ExpTrim                               (MCPARAMID)(  623 << 14)
+#define MC_ExpTrimFactor                         (MCPARAMID)(  624 << 14)
+#define MC_Periodic                              (MCPARAMID)(  625 << 14)
+#define MC_DacCmd                                (MCPARAMID)(  626 << 14)
+#define MC_DacCmd_DAC_A8                           1
+#define MC_DacCmd_DAC_A9                           2
+#define MC_DacCmd_DAC_B8                           3
+#define MC_DacCmd_DAC_B9                           4
+#define MC_DacData                               (MCPARAMID)(  627 << 14)
+#define MC_Destination                           (MCPARAMID)(  628 << 14)
+#define MC_Destination_PC                          1
+#define MC_Destination_DSP1                        2
+#define MC_Destination_DSP2                        3
+#define MC_REFCKA_Frequency                      (MCPARAMID)(  629 << 14)
+#define MC_Gating                                (MCPARAMID)(  630 << 14)
+#define MC_Gating_POST                             1
+#define MC_Gating_PRE                              2
+#define MC_DataClockPolarity                     (MCPARAMID)(  631 << 14)
+#define MC_DataClockPolarity_POS                   1
+#define MC_DataClockPolarity_NEG                   2
+#define MC_TimingClockSource                     (MCPARAMID)(  632 << 14)
+#define MC_TimingClockSource_EXT                   1
+#define MC_TimingClockSource_REFCKA                2
+#define MC_EncSvalue                             (MCPARAMID)(  633 << 14)
+#define MC_ReadoutTC                             (MCPARAMID)(  634 << 14)
+#define MC_USS                                   (MCPARAMID)(  635 << 14)
+#define MC_USOutM                                (MCPARAMID)(  636 << 14)
+#define MC_USOutM_ABCD4                            1
+#define MC_USOutM_ABCD2                            2
+#define MC_USOutM_BADC2                            3
+#define MC_USOutM_ACBD2                            4
+#define MC_USOutM_CADB2                            5
+#define MC_USOutM_BADC1                            6
+#define MC_USOutM_DCBA1                            7
+#define MC_USOutM_CBA1                             8
+#define MC_USOutM_CBA3                             9
+#define MC_USOutM_ABC3                            10
+#define MC_USOutM_X                               11
+#define MC_USOutM_ABCD1                           12
+#define MC_ChannelOrder                          (MCPARAMID)(  637 << 14)
+#define MC_ChannelOrder_Direct                     1
+#define MC_ChannelOrder_Invert                     2
+#define MC_DataLanes                             (MCPARAMID)(  638 << 14)
+#define MC_DataLanes_P                             1
+#define MC_DataLanes_R                             2
+#define MC_DataLanes_PQ                            3
+#define MC_DataLanes_PR                            4
+#define MC_DataLanes_RS                            5
+#define MC_DataLanes_PRS                           6
+#define MC_DataLanes_PQRS                          7
+#define MC_DataLanes_PQR                           8
+#define MC_DataLanes_PRQS                          9
+#define MC_DataLanes_PQS                          10
+#define MC_DataLanes_RSQ                          11
+#define MC_USOutD                                (MCPARAMID)(  639 << 14)
+#define MC_USOutD_AB2                              1
+#define MC_USOutD_AB1                              2
+#define MC_USOutD_BA1                              3
+#define MC_USOutD_CD2                              4
+#define MC_USOutD_CD1                              5
+#define MC_USOutD_DC1                              6
+#define MC_USOutD_X                                7
+#define MC_DualLaneComb                          (MCPARAMID)(  640 << 14)
+#define MC_DualLaneComb_PQ                         1
+#define MC_DualLaneComb_PR                         2
+#define MC_ModuleID                              (MCPARAMID)(  641 << 14)
+#define MC_FifoType                              (MCPARAMID)(  642 << 14)
+#define MC_FifoType_Unknown                        1
+#define MC_FifoType_TwoK                           2
+#define MC_FifoType_EightK                         3
+#define MC_ElectricalInterfaceType               (MCPARAMID)(  643 << 14)
+#define MC_ElectricalInterfaceType_Unknown         1
+#define MC_ElectricalInterfaceType_422             2
+#define MC_ElectricalInterfaceType_644             3
+#define MC_ElectricalInterfaceType_CameraLink      4
+#define MC_Period                                (MCPARAMID)(  644 << 14)
+#define MC_RGBLanes                              (MCPARAMID)(  645 << 14)
+#define MC_RGBLanes_PRS                            1
+#define MC_RGBLanes_PQR                            2
+#define MC_RGBLanes_PQS                            3
+#define MC_RGBLanes_RSQ                            4
+#define MC_SWAP16                                (MCPARAMID)(  646 << 14)
+#define MC_SWAP16_OFF                              1
+#define MC_SWAP16_ON                               2
+#define MC_Clanes                                (MCPARAMID)(  647 << 14)
+#define MC_Clanes_X                                1
+#define MC_Clanes_P                                2
+#define MC_Clanes_R                                3
+#define MC_Clanes_PQ                               4
+#define MC_Clanes_PR                               5
+#define MC_Clanes_RS                               6
+#define MC_Clanes_P_Q                              7
+#define MC_Clanes_P_R                              8
+#define MC_Clanes_R_S                              9
+#define MC_Clanes_PR_QS                           10
+#define MC_Clanes_PQ_RS                           11
+#define MC_Clanes_P_R_S                           12
+#define MC_Clanes_P_Q_R                           13
+#define MC_Clanes_P_Q_S                           14
+#define MC_Clanes_R_S_Q                           15
+#define MC_Clanes_P_Q_R_S                         16
+#define MC_USLanes                               (MCPARAMID)(  648 << 14)
+#define MC_USLanes_X                               1
+#define MC_USLanes_P                               2
+#define MC_USLanes_Q                               3
+#define MC_USLanes_R                               4
+#define MC_USLanes_S                               5
+#define MC_USLanes_PQ                              6
+#define MC_USLanes_PR                              7
+#define MC_USLanes_RS                              8
+#define MC_USLanes_PRS                             9
+#define MC_USLanes_PQR                            10
+#define MC_USLanes_PQS                            11
+#define MC_USLanes_RSQ                            12
+#define MC_USLanes_PRQS                           13
+#define MC_USLanes_PQRS                           14
+#define MC_CableAlign                            (MCPARAMID)(  649 << 14)
+#define MC_CableAlign_Left                         1
+#define MC_CableAlign_Right                        2
+#define MC_CameraWidth                           (MCPARAMID)(  650 << 14)
+#define MC_PortSize                              (MCPARAMID)(  651 << 14)
+#define MC_Ubit                                  (MCPARAMID)(  652 << 14)
+#define MC_Dbit                                  (MCPARAMID)(  653 << 14)
+#define MC_Umask                                 (MCPARAMID)(  654 << 14)
+#define MC_Dmask                                 (MCPARAMID)(  655 << 14)
+#define MC_MSmask                                (MCPARAMID)(  656 << 14)
+#define MC_LSmask                                (MCPARAMID)(  657 << 14)
+#define MC_Dwidth                                (MCPARAMID)(  658 << 14)
+#define MC_ALIGN                                 (MCPARAMID)(  659 << 14)
+#define MC_ImagePixelAlign                       (MCPARAMID)(  660 << 14)
+#define MC_ImagePixelAlign_Left                    1
+#define MC_ImagePixelAlign_Right                   2
+#define MC_CWidth                                (MCPARAMID)(  661 << 14)
+#define MC_ModType                               (MCPARAMID)(  662 << 14)
+#define MC_ModType_Unknown                         1
+#define MC_ModType_NoModule                        2
+#define MC_ModType_D16A                            3
+#define MC_ModType_D32AB                           4
+#define MC_ModType_D32B                            5
+#define MC_ModType_D16C                            6
+#define MC_ModType_D32C                            7
+#define MC_ModType_CameraLink                      8
+#define MC_NextTrigMode                          (MCPARAMID)(  663 << 14)
+#define MC_TrigEdge                              (MCPARAMID)(  664 << 14)
+#define MC_TrigEdge_GOHIGH                         1
+#define MC_TrigEdge_GOLOW                          2
+#define MC_TrigFilter                            (MCPARAMID)(  665 << 14)
+#define MC_TrigFilter_OFF                          1
+#define MC_TrigFilter_ON                           2
+#define MC_TrigLine                              (MCPARAMID)(  666 << 14)
+#define MC_TrigLine_NOM                            1
+#define MC_TrigLine_ALT1                           2
+#define MC_TrigLine_ALT2                           3
+#define MC_TrigLine_ALT3                           4
+#define MC_TrigLine_ALT4                           5
+#define MC_MapConTim                             (MCPARAMID)(  667 << 14)
+#define MC_MapConTim_XYZ                           1
+#define MC_MapConTim_ZYX                           2
+#define MC_MapConTim_YZX                           3
+#define MC_MapConTim_XZY                           4
+#define MC_MapConTim_ZXY                           5
+#define MC_MapConTim_YXZ                           6
+#define MC_MapDigTim                             (MCPARAMID)(  668 << 14)
+#define MC_MapDigTim_ABD                           1
+#define MC_MapDigTim_ACD                           2
+#define MC_MapDigTim_ABC                           3
+#define MC_MapDigTim_BCC                           4
+#define MC_MapDigTim_BBC                           5
+#define MC_MapDigTim_BCD                           6
+#define MC_MapDigTim_BBD                           7
+#define MC_MapTimCon                             (MCPARAMID)(  669 << 14)
+#define MC_MapTimCon_TXYZ                          1
+#define MC_MapTimCon_TZYX                          2
+#define MC_MapTimCon_TYZX                          3
+#define MC_MapTimCon_TXZY                          4
+#define MC_MapTimCon_TZXY                          5
+#define MC_MapTimCon_TYXZ                          6
+#define MC_MapTimDig                             (MCPARAMID)(  670 << 14)
+#define MC_MapTimDig_TXXZZ                         1
+#define MC_MapTimDig_TXXXZ                         2
+#define MC_MapTimDig_TXZZZ                         3
+#define MC_MapTimDig_TXYZZ                         4
+#define MC_MapTimDig_TXYYZ                         5
+#define MC_MapTimDig_TXXYZ                         6
+#define MC_MapLaneX1                             (MCPARAMID)(  671 << 14)
+#define MC_MapLaneX1_OFF                           1
+#define MC_MapLaneX1_A                             2
+#define MC_MapLaneX2                             (MCPARAMID)(  672 << 14)
+#define MC_MapLaneX2_OFF                           1
+#define MC_MapLaneX2_B                             2
+#define MC_MapLaneX3                             (MCPARAMID)(  673 << 14)
+#define MC_MapLaneX3_OFF                           1
+#define MC_MapLaneX3_A                             2
+#define MC_MapLaneX3_C                             3
+#define MC_MapLaneX3_CLK                           4
+#define MC_MapLaneY1                             (MCPARAMID)(  674 << 14)
+#define MC_MapLaneY1_OFF                           1
+#define MC_MapLaneY1_A                             2
+#define MC_MapLaneY1_C                             3
+#define MC_MapLaneY1_D                             4
+#define MC_MapLaneY2                             (MCPARAMID)(  675 << 14)
+#define MC_MapLaneY2_OFF                           1
+#define MC_MapLaneY2_B                             2
+#define MC_MapLaneY2_D                             3
+#define MC_MapLaneY3                             (MCPARAMID)(  676 << 14)
+#define MC_MapLaneY3_OFF                           1
+#define MC_MapLaneY3_B                             2
+#define MC_MapLaneY3_C                             3
+#define MC_MapLaneY3_D                             4
+#define MC_MapLaneY3_CLK                           5
+#define MC_MapLaneZ1                             (MCPARAMID)(  677 << 14)
+#define MC_MapLaneZ1_OFF                           1
+#define MC_MapLaneZ1_A                             2
+#define MC_MapLaneZ1_C                             3
+#define MC_MapLaneZ2                             (MCPARAMID)(  678 << 14)
+#define MC_MapLaneZ2_OFF                           1
+#define MC_MapLaneZ2_B                             2
+#define MC_MapLaneZ2_C                             3
+#define MC_MapLaneZ2_D                             4
+#define MC_MapLaneZ3                             (MCPARAMID)(  679 << 14)
+#define MC_MapLaneZ3_OFF                           1
+#define MC_MapLaneZ3_CLK                           2
+#define MC_ClkSynth1                             (MCPARAMID)(  680 << 14)
+#define MC_ClkSynth2                             (MCPARAMID)(  681 << 14)
+#define MC_Connector                             (MCPARAMID)(  682 << 14)
+#define MC_Connector_X                             1
+#define MC_Connector_Y                             2
+#define MC_Connector_Z                             3
+#define MC_Connector_XBIS                          4
+#define MC_Connector_YBIS                          5
+#define MC_Connector_ZBIS                          6
+#define MC_GrabWindow                            (MCPARAMID)(  683 << 14)
+#define MC_GrabWindow_STD                          1
+#define MC_GrabWindow_NOBLACK                      2
+#define MC_GrabWindow_NOLOSS                       3
+#define MC_GrabWindow_MAN                          4
+#define MC_GrbCount                              (MCPARAMID)(  684 << 14)
+#define MC_OffsetX_Tk                            (MCPARAMID)(  685 << 14)
+#define MC_OffsetY_Ln                            (MCPARAMID)(  686 << 14)
+#define MC_LineDurTrim                           (MCPARAMID)(  687 << 14)
+#define MC_CableComp                             (MCPARAMID)(  688 << 14)
+#define MC_Filter                                (MCPARAMID)(  689 << 14)
+#define MC_Filter_NONE                             1
+#define MC_Filter_10MHZ                            2
+#define MC_Filter_5MHZ                             3
+#define MC_Filter_5MHZ_PAL                         4
+#define MC_Filter_5MHZ_NTSC                        5
+#define MC_CalPat                                (MCPARAMID)(  690 << 14)
+#define MC_CalPat_NONE                             1
+#define MC_CalPat_CAL                              2
+#define MC_CalPat_TPG                              3
+#define MC_LutEn                                 (MCPARAMID)(  691 << 14)
+#define MC_LutEn_OFF                               1
+#define MC_LutEn_ON                                2
+#define MC_ImageBufLoc                           (MCPARAMID)(  692 << 14)
+#define MC_LutBufLoc                             (MCPARAMID)(  693 << 14)
+#define MC_ConnectLoc                            (MCPARAMID)(  694 << 14)
+#define MC_ConnectLoc_UPPER                        1
+#define MC_ConnectLoc_CENTER                       2
+#define MC_ConnectLoc_LOWER                        3
+#define MC_TimUnit                               (MCPARAMID)(  695 << 14)
+#define MC_TimUnit_TX                              1
+#define MC_TimUnit_TY                              2
+#define MC_TimUnit_TZ                              3
+#define MC_DigUnit1                              (MCPARAMID)(  696 << 14)
+#define MC_DigUnit1_A                              1
+#define MC_DigUnit1_B                              2
+#define MC_DigUnit1_C                              3
+#define MC_DigUnit1_D                              4
+#define MC_DigUnit2                              (MCPARAMID)(  697 << 14)
+#define MC_DigUnit2_NONE                           1
+#define MC_DigUnit2_A                              2
+#define MC_DigUnit2_B                              3
+#define MC_DigUnit2_C                              4
+#define MC_DigUnit2_D                              5
+#define MC_DigUnit3                              (MCPARAMID)(  698 << 14)
+#define MC_DigUnit3_NONE                           1
+#define MC_DigUnit3_A                              2
+#define MC_DigUnit3_B                              3
+#define MC_DigUnit3_C                              4
+#define MC_DigUnit3_D                              5
+#define MC_SelClkSynth                           (MCPARAMID)(  699 << 14)
+#define MC_SelClkSynth_NONE                        1
+#define MC_SelClkSynth_CLK1                        2
+#define MC_SelClkSynth_CLK2                        3
+#define MC_Camera                                (MCPARAMID)(  700 << 14)
+#define MC_Camera_CCIR                             1
+#define MC_Camera_EIA                              2
+#define MC_Camera_CV_M1                            3
+#define MC_Camera_CV_M10C                          4
+#define MC_Camera_CV_M10E                          5
+#define MC_Camera_CV_M50                           6
+#define MC_Camera_XC_55                            7
+#define MC_Camera_SIMUL                            8
+#define MC_Camera_CV_M40                           9
+#define MC_Camera_CUSTOM                          10
+#define MC_Camera_XC_HR300                        11
+#define MC_CamConfig                             (MCPARAMID)(  701 << 14)
+#define MC_CamConfig_STD                           1
+#define MC_CamConfig_TEST                          2
+#define MC_CamConfig_I50SA                         3
+#define MC_CamConfig_I60SA                         4
+#define MC_CamConfig_P25SA                         5
+#define MC_CamConfig_P30SA                         6
+#define MC_CamConfig_P50SA                         7
+#define MC_CamConfig_P60SA                         8
+#define MC_CamConfig_P25RA                         9
+#define MC_CamConfig_P30RA                        10
+#define MC_CamConfig_P50RA                        11
+#define MC_CamConfig_P60RA                        12
+#define MC_CamConfig_P12RD                        13
+#define MC_CamConfig_P60RD                        14
+#define MC_CamConfig_P100RA                       15
+#define MC_Scanning                              (MCPARAMID)(  702 << 14)
+#define MC_Scanning_PROGRESSIVE                    1
+#define MC_Scanning_INTERLACE                      2
+#define MC_Standard                              (MCPARAMID)(  703 << 14)
+#define MC_Standard_CCIR                           1
+#define MC_Standard_EIA                            2
+#define MC_PixelClk_Hz                           (MCPARAMID)(  704 << 14)
+#define MC_LineRate_Hz                           (MCPARAMID)(  705 << 14)
+#define MC_HCsyncDur_ns                          (MCPARAMID)(  706 << 14)
+#define MC_HCsyncBfr_ns                          (MCPARAMID)(  707 << 14)
+#define MC_HCSyncAft_ns                          (MCPARAMID)(  708 << 14)
+#define MC_Vtotal_Ln                             (MCPARAMID)(  709 << 14)
+#define MC_Vactive_Ln                            (MCPARAMID)(  710 << 14)
+#define MC_VCsyncAft_Ln                          (MCPARAMID)(  711 << 14)
+#define MC_VsyncAft_Ln                           (MCPARAMID)(  712 << 14)
+#define MC_HdriveDur_ns                          (MCPARAMID)(  713 << 14)
+#define MC_VdriveDur_Ln                          (MCPARAMID)(  714 << 14)
+#define MC_HsyncDly_ns                           (MCPARAMID)(  715 << 14)
+#define MC_HdriveDly_ns                          (MCPARAMID)(  716 << 14)
+#define MC_HVdriveCtl                            (MCPARAMID)(  717 << 14)
+#define MC_HVdriveCtl_NONE                         1
+#define MC_HVdriveCtl_TTL                          2
+#define MC_HVdriveCtl_DIFF                         3
+#define MC_HVdriveEdge                           (MCPARAMID)(  718 << 14)
+#define MC_HVdriveEdge_GOLOW                       1
+#define MC_HVdriveEdge_GOHIGH                      2
+#define MC_PixelClkCtl                           (MCPARAMID)(  719 << 14)
+#define MC_PixelClkCtl_NONE                        1
+#define MC_PixelClkCtl_TTL                         2
+#define MC_PixelClkCtl_DIFF                        3
+#define MC_PixelClkEdge                          (MCPARAMID)(  720 << 14)
+#define MC_PixelClkEdge_GOHIGH                     1
+#define MC_PixelClkEdge_GOLOW                      2
+#define MC_VsyncCtl                              (MCPARAMID)(  721 << 14)
+#define MC_VsyncCtl_NONE                           1
+#define MC_VsyncCtl_TTL                            2
+#define MC_VsyncCtl_DIFF                           3
+#define MC_HsyncCtl                              (MCPARAMID)(  722 << 14)
+#define MC_HsyncCtl_NONE                           1
+#define MC_HsyncCtl_TTL                            2
+#define MC_HsyncCtl_DIFF                           3
+#define MC_HsyncEdge                             (MCPARAMID)(  723 << 14)
+#define MC_HsyncEdge_GOLOW                         1
+#define MC_HsyncEdge_GOHIGH                        2
+#define MC_VsyncEdge                             (MCPARAMID)(  724 << 14)
+#define MC_VsyncEdge_GOLOW                         1
+#define MC_VsyncEdge_GOHIGH                        2
+#define MC_ICS9161Code                           (MCPARAMID)(  725 << 14)
+#define MC_SyncMode                              (MCPARAMID)(  726 << 14)
+#define MC_SyncMode_MASTER                         1
+#define MC_SyncMode_ANALOG                         2
+#define MC_SyncMode_DIGITAL                        3
+#define MC_VCgatePos_Ln                          (MCPARAMID)(  727 << 14)
+#define MC_Operation                             (MCPARAMID)(  728 << 14)
+#define MC_Operation_SYNC                          1
+#define MC_Operation_VCAM                          2
+#define MC_Operation_CTL                           3
+#define MC_Cable                                 (MCPARAMID)(  729 << 14)
+#define MC_Cable_A15_C01                           1
+#define MC_Cable_A15_C02                           2
+#define MC_Cable_A15_C03                           3
+#define MC_Cable_A15_C04                           4
+#define MC_Cable_A15_C05                           5
+#define MC_FrameRstEdge                          (MCPARAMID)(  730 << 14)
+#define MC_FrameRstEdge_GOLOW                      1
+#define MC_FrameRstEdge_GOHIGH                     2
+#define MC_LineDur_Tk                            (MCPARAMID)(  731 << 14)
+#define MC_LineDur_ns                            (MCPARAMID)(  732 << 14)
+#define MC_SampleClk_Hz                          (MCPARAMID)(  733 << 14)
+#define MC_TCU_ps                                (MCPARAMID)(  734 << 14)
+#define MC_Hactive_ns                            (MCPARAMID)(  735 << 14)
+#define MC_Hactive_Tk                            (MCPARAMID)(  736 << 14)
+#define MC_GrabSizeX_Tk                          (MCPARAMID)(  737 << 14)
+#define MC_GrabSizeX_ns                          (MCPARAMID)(  738 << 14)
+#define MC_GrabPosX_ns                           (MCPARAMID)(  739 << 14)
+#define MC_X_ACQOn                               (MCPARAMID)(  740 << 14)
+#define MC_X_ACQOff                              (MCPARAMID)(  741 << 14)
+#define MC_ClmDur_ns                             (MCPARAMID)(  742 << 14)
+#define MC_ClmPos_ns                             (MCPARAMID)(  743 << 14)
+#define MC_X_CLMOn                               (MCPARAMID)(  744 << 14)
+#define MC_X_CLMOff                              (MCPARAMID)(  745 << 14)
+#define MC_X_HPLL                                (MCPARAMID)(  746 << 14)
+#define MC_X_ENDR                                (MCPARAMID)(  747 << 14)
+#define MC_X_HOn                                 (MCPARAMID)(  748 << 14)
+#define MC_X_HOff                                (MCPARAMID)(  749 << 14)
+#define MC_X_MIDX                                (MCPARAMID)(  750 << 14)
+#define MC__VActive                              (MCPARAMID)(  751 << 14)
+#define MC_GrabSizeY_Ln                          (MCPARAMID)(  752 << 14)
+#define MC_GrabPosY_Ln                           (MCPARAMID)(  753 << 14)
+#define MC_ADelay1_ns                            (MCPARAMID)(  754 << 14)
+#define MC_ADelay2_ns                            (MCPARAMID)(  755 << 14)
+#define MC_ADelay3_ns                            (MCPARAMID)(  756 << 14)
+#define MC_DDelay2                               (MCPARAMID)(  757 << 14)
+#define MC_DDelay3                               (MCPARAMID)(  758 << 14)
+#define MC_AcqStep                               (MCPARAMID)(  759 << 14)
+#define MC__MIDXQ                                (MCPARAMID)(  760 << 14)
+#define MC__ASEL                                 (MCPARAMID)(  761 << 14)
+#define MC__BSEL                                 (MCPARAMID)(  762 << 14)
+#define MC__CSEL                                 (MCPARAMID)(  763 << 14)
+#define MC__DSEL                                 (MCPARAMID)(  764 << 14)
+#define MC__PShift1                              (MCPARAMID)(  765 << 14)
+#define MC__PShift2                              (MCPARAMID)(  766 << 14)
+#define MC__Dig321Mask                           (MCPARAMID)(  767 << 14)
+#define MC__VCODIV                               (MCPARAMID)(  768 << 14)
+#define MC__SELH                                 (MCPARAMID)(  769 << 14)
+#define MC__SELH_NONE                              1
+#define MC__SELH_HDS                               2
+#define MC__SELH_DETS                              3
+#define MC__SELH_QS                                4
+#define MC__SELV                                 (MCPARAMID)(  770 << 14)
+#define MC__SELV_NONE                              1
+#define MC__SELV_VDS                               2
+#define MC__SELV_DETV                              3
+#define MC__ASSY11                               (MCPARAMID)(  771 << 14)
+#define MC__ASSY12                               (MCPARAMID)(  772 << 14)
+#define MC__ASSY13                               (MCPARAMID)(  773 << 14)
+#define MC__ASSY14                               (MCPARAMID)(  774 << 14)
+#define MC__ASSY21                               (MCPARAMID)(  775 << 14)
+#define MC__ASSY22                               (MCPARAMID)(  776 << 14)
+#define MC__ASSY23                               (MCPARAMID)(  777 << 14)
+#define MC__ASSY24                               (MCPARAMID)(  778 << 14)
+#define MC__SIZX                                 (MCPARAMID)(  779 << 14)
+#define MC__SIZY                                 (MCPARAMID)(  780 << 14)
+#define MC__STARTU1                              (MCPARAMID)(  781 << 14)
+#define MC__STARTU2                              (MCPARAMID)(  782 << 14)
+#define MC__STARTD1                              (MCPARAMID)(  783 << 14)
+#define MC__STARTD2                              (MCPARAMID)(  784 << 14)
+#define MC__STEPX                                (MCPARAMID)(  785 << 14)
+#define MC__STEPY                                (MCPARAMID)(  786 << 14)
+#define MC__OFSU                                 (MCPARAMID)(  787 << 14)
+#define MC__OFSD                                 (MCPARAMID)(  788 << 14)
+#define MC__SELINC                               (MCPARAMID)(  789 << 14)
+#define MC__SELINC_EOL                             1
+#define MC__SELINC_EOF                             2
+#define MC__SELINC_EOL2                            3
+#define MC__SELINC_EOF2                            4
+#define MC__YChannels                            (MCPARAMID)(  790 << 14)
+#define MC__TFINC                                (MCPARAMID)(  791 << 14)
+#define MC_SWICodeMask                           (MCPARAMID)(  792 << 14)
+#define MC_SASCodeMask                           (MCPARAMID)(  793 << 14)
+#define MC_EAPCodeMask                           (MCPARAMID)(  794 << 14)
+#define MC_NOWCodeMask                           (MCPARAMID)(  795 << 14)
+#define MC_Gain1Ctl                              (MCPARAMID)(  796 << 14)
+#define MC_Gain1Ctl_LIN                            1
+#define MC_Gain1Ctl_p3DB                           2
+#define MC_Gain1Ctl_p2DB                           3
+#define MC_Gain1Ctl_p1DB                           4
+#define MC_Gain1Ctl_0DB                            5
+#define MC_Gain1Ctl_m1DB                           6
+#define MC_Gain1Ctl_m2DB                           7
+#define MC_Gain1Ctl_m3DB                           8
+#define MC_Gain1                                 (MCPARAMID)(  797 << 14)
+#define MC_Offset1                               (MCPARAMID)(  798 << 14)
+#define MC_Gain2Ctl                              (MCPARAMID)(  799 << 14)
+#define MC_Gain2Ctl_LIN                            1
+#define MC_Gain2Ctl_p3DB                           2
+#define MC_Gain2Ctl_p2DB                           3
+#define MC_Gain2Ctl_p1DB                           4
+#define MC_Gain2Ctl_0DB                            5
+#define MC_Gain2Ctl_m1DB                           6
+#define MC_Gain2Ctl_m2DB                           7
+#define MC_Gain2Ctl_m3DB                           8
+#define MC_Gain2                                 (MCPARAMID)(  800 << 14)
+#define MC_Offset2                               (MCPARAMID)(  801 << 14)
+#define MC_Gain3Ctl                              (MCPARAMID)(  802 << 14)
+#define MC_Gain3Ctl_LIN                            1
+#define MC_Gain3Ctl_p3DB                           2
+#define MC_Gain3Ctl_p2DB                           3
+#define MC_Gain3Ctl_p1DB                           4
+#define MC_Gain3Ctl_0DB                            5
+#define MC_Gain3Ctl_m1DB                           6
+#define MC_Gain3Ctl_m2DB                           7
+#define MC_Gain3Ctl_m3DB                           8
+#define MC_Gain3                                 (MCPARAMID)(  803 << 14)
+#define MC_Offset3                               (MCPARAMID)(  804 << 14)
+#define MC_NominalGainACode                      (MCPARAMID)(  805 << 14)
+#define MC_NominalGainBCode                      (MCPARAMID)(  806 << 14)
+#define MC_NominalGainCCode                      (MCPARAMID)(  807 << 14)
+#define MC_NominalGainDCode                      (MCPARAMID)(  808 << 14)
+#define MC__NominalGain1Code                     (MCPARAMID)(  809 << 14)
+#define MC__NominalGain2Code                     (MCPARAMID)(  810 << 14)
+#define MC__NominalGain3Code                     (MCPARAMID)(  811 << 14)
+#define MC__Gain1Code                            (MCPARAMID)(  812 << 14)
+#define MC__Gain2Code                            (MCPARAMID)(  813 << 14)
+#define MC__Gain3Code                            (MCPARAMID)(  814 << 14)
+#define MC_X_IPLLOn                              (MCPARAMID)(  815 << 14)
+#define MC_X_IPLLOff                             (MCPARAMID)(  816 << 14)
+#define MC_ModuleType_Unknown                      1
+#define MC_ModuleType_NoModule                     2
+#define MC_ModuleType_D16A                         3
+#define MC_ModuleType_D32AB                        4
+#define MC_ModuleType_D32B                         5
+#define MC_ModuleType_D16C                         6
+#define MC_ModuleType_D32C                         7
+#define MC_NextTrigMode_REPEAT                     1
+#define MC_NextTrigMode_HARD                       2
+#define MC_NextTrigMode_SOFT                       3
+#define MC_NextTrigMode_COMBINED                   4
+#define MC_AcqMode                               (MCPARAMID)(  817 << 14)
+#define MC_AcqMode_GRABBER                         1
+#define MC_AcqMode_TIMER                           2
+#define MC_AcqMode_SYSTEM                          3
+#define MC_TrigCtl_TTL                             1
+#define MC_JumperCK                              (MCPARAMID)(  818 << 14)
+#define MC_JumperCK_CKDPOS                         1
+#define MC_JumperCK_CKDNEG                         2
+#define MC_JumperCK_CKSPOS                         3
+#define MC_JumperCK_CKSNEG                         4
+#define MC_JumperCK_ZLANE                          5
+#define MC_JumperCK_EMPTY                          6
+#define MC_JumperL1                              (MCPARAMID)(  819 << 14)
+#define MC_JumperL1_DT                             1
+#define MC_JumperL1_DU                             2
+#define MC_JumperL1_ST                             3
+#define MC_JumperL1_SU                             4
+#define MC_JumperL2                              (MCPARAMID)(  820 << 14)
+#define MC_JumperL2_DT                             1
+#define MC_JumperL2_DU                             2
+#define MC_JumperL2_ST                             3
+#define MC_JumperL2_SU                             4
+#define MC_JumperH                               (MCPARAMID)(  821 << 14)
+#define MC_JumperH_TTL                             1
+#define MC_JumperH_DPOS                            2
+#define MC_JumperH_DNEG                            3
+#define MC_JumperV                               (MCPARAMID)(  822 << 14)
+#define MC_JumperV_TTL                             1
+#define MC_JumperV_DPOS                            2
+#define MC_JumperV_DNEG                            3
+#define MC_ADresolution                          (MCPARAMID)(  823 << 14)
+#define MC_ADresolution_8BIT                       1
+#define MC_ADresolution_10BIT                      2
+#define MC_LineDurTrimOK                         (MCPARAMID)(  824 << 14)
+#define MC_LineDurTrimOK_YES                       1
+#define MC_LineDurTrimOK_NO                        2
+#define MC_OffsetX_Px                            (MCPARAMID)(  825 << 14)
+#define MC_WindowX_Px                            (MCPARAMID)(  826 << 14)
+#define MC_WindowY_Ln                            (MCPARAMID)(  827 << 14)
+#define MC_WindowX_Tk                            (MCPARAMID)(  828 << 14)
+#define MC_VdriveDly_Ln                          (MCPARAMID)(  829 << 14)
+#define MC_Expose_us                             (MCPARAMID)(  830 << 14)
+#define MC_ExposeTrim                            (MCPARAMID)(  831 << 14)
+#define MC_TrueExp_us                            (MCPARAMID)(  832 << 14)
+#define MC_StrobeLevel                           (MCPARAMID)(  833 << 14)
+#define MC_StrobeLevel_PLSHIGH                     1
+#define MC_StrobeLevel_PLSLOW                      2
+#define MC_StrobeLevel_HIGH                        3
+#define MC_StrobeLevel_LOW                         4
+#define MC_StrobeDur                             (MCPARAMID)(  834 << 14)
+#define MC_StrobePos                             (MCPARAMID)(  835 << 14)
+#define MC_StrobeCtl                             (MCPARAMID)(  836 << 14)
+#define MC_StrobeCtl_NONE                          1
+#define MC_StrobeCtl_TTL                           2
+#define MC_StrobeLine                            (MCPARAMID)(  837 << 14)
+#define MC_StrobeLine_NOM                          1
+#define MC_StrobeLine_ALT1                         2
+#define MC_StrobeLine_ALT2                         3
+#define MC_StrobeLine_ALT3                         4
+#define MC_StrobeLine_ALT4                         5
+#define MC_GainCtl                               (MCPARAMID)(  838 << 14)
+#define MC_GainCtl_LIN                             1
+#define MC_GainCtl_p3DB                            2
+#define MC_GainCtl_p2DB                            3
+#define MC_GainCtl_p1DB                            4
+#define MC_GainCtl_0DB                             5
+#define MC_GainCtl_m1DB                            6
+#define MC_GainCtl_m2DB                            7
+#define MC_GainCtl_m3DB                            8
+#define MC_GainTrim1                             (MCPARAMID)(  839 << 14)
+#define MC_GainTrim2                             (MCPARAMID)(  840 << 14)
+#define MC_GainTrim3                             (MCPARAMID)(  841 << 14)
+#define MC_Offset                                (MCPARAMID)(  842 << 14)
+#define MC_OffsetTrim1                           (MCPARAMID)(  843 << 14)
+#define MC_OffsetTrim2                           (MCPARAMID)(  844 << 14)
+#define MC_OffsetTrim3                           (MCPARAMID)(  845 << 14)
+#define MC__Offset1Code                          (MCPARAMID)(  846 << 14)
+#define MC__Offset2Code                          (MCPARAMID)(  847 << 14)
+#define MC__Offset3Code                          (MCPARAMID)(  848 << 14)
+#define MC__Tk_Px                                (MCPARAMID)(  849 << 14)
+#define MC___MSFBuild                            (MCPARAMID)(  850 << 14)
+#define MC___MSFError                            (MCPARAMID)(  851 << 14)
+#define MC_PinGATE                               (MCPARAMID)(  852 << 14)
+#define MC_PinGATE_UNUSED                          1
+#define MC_PinGATE_VSYNC                           2
+#define MC_PinVIO                                (MCPARAMID)(  853 << 14)
+#define MC_PinVIO_UNUSED                           1
+#define MC_PinVIO_VSYNC                            2
+#define MC_Cable_A15_C06                           6
+#define MC_Cable_A15_C07                           7
+#define MC_Premier                               (MCPARAMID)(  854 << 14)
+#define MC_Premier_AA                              1
+#define MC_Premier_BB                              2
+#define MC_Premier_CC                              3
+#define MC_Premier_DD                              4
+#define MC_Premier_ZZ                              5
+#define MC_ParamIn2                              (MCPARAMID)(  855 << 14)
+#define MC_Auteur                                (MCPARAMID)(  856 << 14)
+#define MC_Auteur_TOI                              1
+#define MC_Auteur_MOI                              2
+#define MC_Auteur_EUX                              3
+#define MC_Auteur_NOUS                             4
+#define MC_Auteur_LUI                              5
+#define MC_Menteur                               (MCPARAMID)(  857 << 14)
+#define MC_ParamIn8                              (MCPARAMID)(  858 << 14)
+#define MC_ParamOut1                             (MCPARAMID)(  859 << 14)
+#define MC_ParamOut1_XX                            1
+#define MC_ParamOut1_YY                            2
+#define MC_ParamOut1_ZZ                            3
+#define MC_Carton                                (MCPARAMID)(  860 << 14)
+#define MC_Carton_ALPHA                            1
+#define MC_Carton_BETA                             2
+#define MC_Carton_GAMMA                            3
+#define MC_Carton_DELTA                            4
+#define MC_ParamOut4                             (MCPARAMID)(  861 << 14)
+#define MC_ParamOut5                             (MCPARAMID)(  862 << 14)
+#define MC_Arthur                                (MCPARAMID)(  863 << 14)
+#define MC_Arthur_X                                1
+#define MC_Arthur_Y                                2
+#define MC_Arthur_Z                                3
+#define MC_Acteur                                (MCPARAMID)(  864 << 14)
+#define MC_Acteur_JOE                              1
+#define MC__CFG                                  (MCPARAMID)(  865 << 14)
+#define MC__CFG_MONOCAM                            1
+#define MC__CFG_DUOCAMA                            2
+#define MC__CFG_DUOCAMB                            3
+#define MC_TapCount                              (MCPARAMID)(  866 << 14)
+#define MC__Bend16                               (MCPARAMID)(  867 << 14)
+#define MC__Bend15                               (MCPARAMID)(  868 << 14)
+#define MC__Bend14                               (MCPARAMID)(  869 << 14)
+#define MC__Bend13                               (MCPARAMID)(  870 << 14)
+#define MC__Bend12                               (MCPARAMID)(  871 << 14)
+#define MC__Bend11                               (MCPARAMID)(  872 << 14)
+#define MC__Bend10                               (MCPARAMID)(  873 << 14)
+#define MC__Bend9                                (MCPARAMID)(  874 << 14)
+#define MC__Bend8                                (MCPARAMID)(  875 << 14)
+#define MC__Bend7                                (MCPARAMID)(  876 << 14)
+#define MC__Bend6                                (MCPARAMID)(  877 << 14)
+#define MC__Bend5                                (MCPARAMID)(  878 << 14)
+#define MC__Bend4                                (MCPARAMID)(  879 << 14)
+#define MC__Bend3                                (MCPARAMID)(  880 << 14)
+#define MC__Bend2                                (MCPARAMID)(  881 << 14)
+#define MC__Bend1                                (MCPARAMID)(  882 << 14)
+#define MC_CamCount                              (MCPARAMID)(  883 << 14)
+#define MC_ChannelTopology_QUADXTAP                9
+#define MC_BackEndProg_ABC34                      10
+#define MC_BackEndProg_ABCD44                     11
+#define MC_BackEndOption                         (MCPARAMID)(  884 << 14)
+#define MC_TimingClockFrequency                  (MCPARAMID)(  885 << 14)
+#define MC_TapCount_ONE                            1
+#define MC_TapCount_TWO                            2
+#define MC_TapCount_THREE                          3
+#define MC_TapCount_FOUR                           4
+#define MC_TapCount_TWO_Y_END                      5
+#define MC_USOutM_ABC1                            13
+#define MC_BlockCount                            (MCPARAMID)(  886 << 14)
+#define MC_PlaneTopology                         (MCPARAMID)(  887 << 14)
+#define MC_PlaneTopology_SINGLE                    1
+#define MC_PlaneTopology_MULTIPLE                  2
+#define MC_Line1Cfg                              (MCPARAMID)(  888 << 14)
+#define MC_Line1Cfg_DIFF_IN_T                      1
+#define MC_Line1Cfg_TTL_IN_Z                       2
+#define MC_RX1                                   (MCPARAMID)(  889 << 14)
+#define MC_TX1                                   (MCPARAMID)(  890 << 14)
+#define MC_Line2Cfg                              (MCPARAMID)(  891 << 14)
+#define MC_Line2Cfg_DIFF_IN_T                      1
+#define MC_Line2Cfg_TTL_IN_Z                       2
+#define MC_RX2                                   (MCPARAMID)(  892 << 14)
+#define MC_TX2                                   (MCPARAMID)(  893 << 14)
+#define MC_SX12                                  (MCPARAMID)(  894 << 14)
+#define MC_Line3Cfg                              (MCPARAMID)(  895 << 14)
+#define MC_Line3Cfg_DIFF_OUT                       1
+#define MC_Line3Cfg_TTL_OUT                        2
+#define MC_Line4Cfg                              (MCPARAMID)(  896 << 14)
+#define MC_Line4Cfg_DIFF_OUT                       1
+#define MC_Line4Cfg_DIFF_IN_T                      2
+#define MC_Line4Cfg_TTL_IN_Z                       3
+#define MC_RX4                                   (MCPARAMID)(  897 << 14)
+#define MC_TX4                                   (MCPARAMID)(  898 << 14)
+#define MC_SX34                                  (MCPARAMID)(  899 << 14)
+#define MC_Line5Cfg                              (MCPARAMID)(  900 << 14)
+#define MC_Line5Cfg_DIFF_OUT                       1
+#define MC_Line5Cfg_TTL_OUT                        2
+#define MC_Line6Cfg                              (MCPARAMID)(  901 << 14)
+#define MC_Line6Cfg_DIFF_OUT                       1
+#define MC_Line6Cfg_TTL_OUT                        2
+#define MC_SX56                                  (MCPARAMID)(  902 << 14)
+#define MC_Line6Ctl_RESET                          3
+#define MC_Line6Ctl_EXPOSE                         4
+#define MC_Line4Ctl_DCLKIN                         4
+#define MC_TPFrequencyRatio                      (MCPARAMID)(  903 << 14)
+#define MC__DCGComb                              (MCPARAMID)(  904 << 14)
+#define MC__DCGComb_NO                             1
+#define MC__DCGComb_YES                            2
+#define MC_TimUnitN                              (MCPARAMID)(  905 << 14)
+#define MC_TimUnitN_UNKNOWN                        1
+#define MC_TimUnitN_FREE                           2
+#define MC_TimUnitN_USEDX                          3
+#define MC_TimUnitN_USEDY                          4
+#define MC_TimUnitN_CONFLICT                       5
+#define MC_MapConTim_XY                            7
+#define MC_MapDigTim_NONE                          8
+#define MC_MapTimCon_TXY                           7
+#define MC_MapTimDig_TXX                           7
+#define MC_MapTimDig_TXY                           8
+#define MC_MapLaneY1_B                             5
+#define MC_MapLaneX1_B                             3
+#define MC_MapLaneX2_A                             3
+#define MC_MapLaneY2_A                             4
+#define MC__BoardType                            (MCPARAMID)(  906 << 14)
+#define MC__BoardType__ALPHA                       1
+#define MC__BoardType__GAMMA                       2
+#define MC_MapConTim_YX                            8
+#define MC_MapTimCon_TYX                           8
+#define MC_VCSync                                (MCPARAMID)(  907 << 14)
+#define MC_VCSync_NO                               1
+#define MC_VCSync_YES                              2
+#define MC__Integer1                             (MCPARAMID)(  908 << 14)
+#define MC__SlowMode                             (MCPARAMID)(  909 << 14)
+#define MC__SlowMode_OFF                           1
+#define MC__SlowMode_ON                            2
+#define MC_Expose_Tk                             (MCPARAMID)(  910 << 14)
+#define MC__ST_StrxCtl                           (MCPARAMID)(  911 << 14)
+#define MC__ST_StrxCtl_High                        1
+#define MC__ST_StrxCtl_Low                         2
+#define MC__ST_StryCtl                           (MCPARAMID)(  912 << 14)
+#define MC__ST_StryCtl_High                        1
+#define MC__ST_StryCtl_Low                         2
+#define MC__ST_StrzCtl                           (MCPARAMID)(  913 << 14)
+#define MC__ST_StrzCtl_High                        1
+#define MC__ST_StrzCtl_Low                         2
+#define MC__ST_TVxCtl                            (MCPARAMID)(  914 << 14)
+#define MC__ST_TVxCtl_High                         1
+#define MC__ST_TVxCtl_Low                          2
+#define MC__ST_TVxCtl_Input                        3
+#define MC__ST_TVyCtl                            (MCPARAMID)(  915 << 14)
+#define MC__ST_TVyCtl_High                         1
+#define MC__ST_TVyCtl_Low                          2
+#define MC__ST_TVyCtl_Input                        3
+#define MC__ST_TVzCtl                            (MCPARAMID)(  916 << 14)
+#define MC__ST_TVzCtl_High                         1
+#define MC__ST_TVzCtl_Low                          2
+#define MC__ST_TVzCtl_Input                        3
+#define MC__ST_THxCtl                            (MCPARAMID)(  917 << 14)
+#define MC__ST_THxCtl_High                         1
+#define MC__ST_THxCtl_Low                          2
+#define MC__ST_THxCtl_Input                        3
+#define MC__ST_THyCtl                            (MCPARAMID)(  918 << 14)
+#define MC__ST_THyCtl_High                         1
+#define MC__ST_THyCtl_Low                          2
+#define MC__ST_THyCtl_Input                        3
+#define MC__ST_THzCtl                            (MCPARAMID)(  919 << 14)
+#define MC__ST_THzCtl_High                         1
+#define MC__ST_THzCtl_Low                          2
+#define MC__ST_THzCtl_Input                        3
+#define MC__ST_TExCtl                            (MCPARAMID)(  920 << 14)
+#define MC__ST_TExCtl_High                         1
+#define MC__ST_TExCtl_Low                          2
+#define MC__ST_TExCtl_Input                        3
+#define MC__ST_TEyCtl                            (MCPARAMID)(  921 << 14)
+#define MC__ST_TEyCtl_High                         1
+#define MC__ST_TEyCtl_Low                          2
+#define MC__ST_TEyCtl_Input                        3
+#define MC__ST_TEzCtl                            (MCPARAMID)(  922 << 14)
+#define MC__ST_TEzCtl_High                         1
+#define MC__ST_TEzCtl_Low                          2
+#define MC__ST_TEzCtl_Input                        3
+#define MC__ST_TGxCtl                            (MCPARAMID)(  923 << 14)
+#define MC__ST_TGxCtl_High                         1
+#define MC__ST_TGxCtl_Low                          2
+#define MC__ST_TGxCtl_Input                        3
+#define MC__ST_TGyCtl                            (MCPARAMID)(  924 << 14)
+#define MC__ST_TGyCtl_High                         1
+#define MC__ST_TGyCtl_Low                          2
+#define MC__ST_TGyCtl_Input                        3
+#define MC__ST_TGzCtl                            (MCPARAMID)(  925 << 14)
+#define MC__ST_TGzCtl_High                         1
+#define MC__ST_TGzCtl_Low                          2
+#define MC__ST_TGzCtl_Input                        3
+#define MC__ST_TRxCtl                            (MCPARAMID)(  926 << 14)
+#define MC__ST_TRxCtl_High                         1
+#define MC__ST_TRxCtl_Low                          2
+#define MC__ST_TRxCtl_Input                        3
+#define MC__ST_TRyCtl                            (MCPARAMID)(  927 << 14)
+#define MC__ST_TRyCtl_High                         1
+#define MC__ST_TRyCtl_Low                          2
+#define MC__ST_TRyCtl_Input                        3
+#define MC__ST_TRzCtl                            (MCPARAMID)(  928 << 14)
+#define MC__ST_TRzCtl_High                         1
+#define MC__ST_TRzCtl_Low                          2
+#define MC__ST_TRzCtl_Input                        3
+#define MC__ST_Out1Ctl                           (MCPARAMID)(  929 << 14)
+#define MC__ST_Out1Ctl_High                        1
+#define MC__ST_Out1Ctl_Low                         2
+#define MC__ST_Out2Ctl                           (MCPARAMID)(  930 << 14)
+#define MC__ST_Out2Ctl_High                        1
+#define MC__ST_Out2Ctl_Low                         2
+#define MC__ST_Out3Ctl                           (MCPARAMID)(  931 << 14)
+#define MC__ST_Out3Ctl_High                        1
+#define MC__ST_Out3Ctl_Low                         2
+#define MC__ST_Out4Ctl                           (MCPARAMID)(  932 << 14)
+#define MC__ST_Out4Ctl_High                        1
+#define MC__ST_Out4Ctl_Low                         2
+#define MC_Destination_DSP12                       4
+#define MC__ST_aFilter                           (MCPARAMID)(  933 << 14)
+#define MC__ST_aFilter_NONE                        1
+#define MC__ST_aFilter_10MHZ                       2
+#define MC__ST_aFilter_5MHZ                        3
+#define MC__ST_aFilter_5MHZ_PAL                    4
+#define MC__ST_aFilter_5MHZ_NTSC                   5
+#define MC__ST_bFilter                           (MCPARAMID)(  934 << 14)
+#define MC__ST_bFilter_NONE                        1
+#define MC__ST_bFilter_10MHZ                       2
+#define MC__ST_bFilter_5MHZ                        3
+#define MC__ST_bFilter_5MHZ_PAL                    4
+#define MC__ST_bFilter_5MHZ_NTSC                   5
+#define MC_CamConfig_P25RD                        16
+#define MC__TIMATIM                              (MCPARAMID)(  935 << 14)
+#define MC__DIGATIM                              (MCPARAMID)(  936 << 14)
+#define MC_CamConfig_P30RD                        17
+#define MC_Clanes_qP_QS                           17
+#define MC_Clanes_sR_SQ                           18
+#define MC_MMmask                                (MCPARAMID)(  937 << 14)
+#define MC_GrabberConfig_0_3_1                     7
+#define MC__ASSY31                               (MCPARAMID)(  938 << 14)
+#define MC__ASSY32                               (MCPARAMID)(  939 << 14)
+#define MC__ASSY33                               (MCPARAMID)(  940 << 14)
+#define MC__ASSY34                               (MCPARAMID)(  941 << 14)
+#define MC__PShiftA                              (MCPARAMID)(  942 << 14)
+#define MC__PShiftB                              (MCPARAMID)(  943 << 14)
+#define MC__PShiftC                              (MCPARAMID)(  944 << 14)
+#define MC__PShiftD                              (MCPARAMID)(  945 << 14)
+#define MC__PShift3                              (MCPARAMID)(  946 << 14)
+#define MC__CPHASE                               (MCPARAMID)(  947 << 14)
+#define MC__CPHASE_INDEPENDENT                     1
+#define MC__CPHASE_GROUPED                         2
+#define MC_Camera_HV_C20AEK                       12
+#define MC_Camera_XC_003                          13
+#define MC__RSTFIFO                              (MCPARAMID)(  948 << 14)
+#define MC__RSTFIFO_DISABLED                       1
+#define MC__RSTFIFO_ENABLED                        2
+#define MC__Fields                               (MCPARAMID)(  949 << 14)
+#define MC__UpField                              (MCPARAMID)(  950 << 14)
+#define MC__STARTU3                              (MCPARAMID)(  951 << 14)
+#define MC__STARTD3                              (MCPARAMID)(  952 << 14)
+#define MC_Cable_A15_C08                           8
+#define MC_Cable_A15_C09                           9
+#define MC_LutSelect1                            (MCPARAMID)(  953 << 14)
+#define MC_LutSelect2                            (MCPARAMID)(  954 << 14)
+#define MC_LutSelect3                            (MCPARAMID)(  955 << 14)
+#define MC_InputFilter                           (MCPARAMID)(  956 << 14)
+#define MC_InputFilter_NONE                        1
+#define MC_InputFilter_10MHZ                       2
+#define MC_InputFilter_5MHZ                        3
+#define MC_InputFilter_5MHZ_PAL                    4
+#define MC_InputFilter_5MHZ_NTSC                   5
+#define MC_VideoFilter                           (MCPARAMID)(  957 << 14)
+#define MC_VideoFilter_NONE                        1
+#define MC_VideoFilter_10MHZ                       2
+#define MC_VideoFilter_5MHZ                        3
+#define MC_VideoFilter_5MHZ_PAL                    4
+#define MC_VideoFilter_5MHZ_NTSC                   5
+#define MC_SYNCLoadSet                           (MCPARAMID)(  958 << 14)
+#define MC_VCAMLoadSet                           (MCPARAMID)(  959 << 14)
+#define MC_SWISet                                (MCPARAMID)(  960 << 14)
+#define MC_SASSet                                (MCPARAMID)(  961 << 14)
+#define MC_EAPSet                                (MCPARAMID)(  962 << 14)
+#define MC_NOWSet                                (MCPARAMID)(  963 << 14)
+#define MC___MSFError_Check                      (MCPARAMID)(  964 << 14)
+#define MC___MSFError_Check_PASS                   1
+#define MC___MSFError_Check_FAIL                   2
+#define MC___GrabberConfig_Check                 (MCPARAMID)(  965 << 14)
+#define MC___GrabberConfig_Check_PASS              1
+#define MC___GrabberConfig_Check_FAIL              2
+#define MC___Alpha_TimUnitN_Check                (MCPARAMID)(  966 << 14)
+#define MC___Alpha_TimUnitN_Check_PASS             1
+#define MC___Alpha_TimUnitN_Check_FAIL             2
+#define MC___Alpha_SyncMode_Check                (MCPARAMID)(  967 << 14)
+#define MC___Alpha_SyncMode_Check_PASS             1
+#define MC___Alpha_SyncMode_Check_FAIL             2
+#define MC___Alpha_ADresolution_Check            (MCPARAMID)(  968 << 14)
+#define MC___Alpha_ADresolution_Check_PASS         1
+#define MC___Alpha_ADresolution_Check_FAIL         2
+#define MC___Alpha_CalPat_Check                  (MCPARAMID)(  969 << 14)
+#define MC___Alpha_CalPat_Check_PASS               1
+#define MC___Alpha_CalPat_Check_FAIL               2
+#define MC_GrabberConfig_Filter                  (MCPARAMID)(  970 << 14)
+#define MC_TrigMode_Filter                       (MCPARAMID)(  971 << 14)
+#define MC_Connector_Filter                      (MCPARAMID)(  972 << 14)
+#define MC_ConnectLoc_Filter                     (MCPARAMID)(  973 << 14)
+#define MC_ADresolution_Filter                   (MCPARAMID)(  974 << 14)
+#define MC_CalPat_Filter                         (MCPARAMID)(  975 << 14)
+#define MC_ChannelTopology_Filter                (MCPARAMID)(  976 << 14)
+#define MC_SyncMode_Filter                       (MCPARAMID)(  977 << 14)
+#define MC_Cable_Filter                          (MCPARAMID)(  978 << 14)
+#define MC_Camera_KP_F3                           14
+#define MC_Camera_KP_F3W                          15
+#define MC_Camera_Generic                         16
+#define MC_Camera_Generic_RGB                     17
+#define MC_NextTrigMode_SAME                       5
+#define MC_CamConfig_I50RA                        18
+#define MC_Cable_A15_C10                          10
+#define MC_X_VRSTOn                              (MCPARAMID)(  979 << 14)
+#define MC_X_VRSTOff                             (MCPARAMID)(  980 << 14)
+#define MC__DeltaX_SIGEOL_RSTOn                  (MCPARAMID)(  981 << 14)
+#define MC__DeltaX_SIGEOL_RSTOff                 (MCPARAMID)(  982 << 14)
+#define MC_Camera_HV_C20AP                        12
+#define MC_Operation_SPECIAL                       4
+#define MC_HV_C20AP_AsyncLoadSet                 (MCPARAMID)(  983 << 14)
+#define MC_CamConfig_P100SA                       19
+#define MC_HReset                                (MCPARAMID)(  984 << 14)
+#define MC_HReset_NO                               1
+#define MC_HReset_YES                              2
+#define MC__ETimebase                            (MCPARAMID)(  985 << 14)
+#define MC__ETimebase_READOUT_TIMER                1
+#define MC__ETimebase_TIMING_CLOCK                 2
+#define MC__E_Tk                                 (MCPARAMID)(  986 << 14)
+#define MC__ESpan_us                             (MCPARAMID)(  987 << 14)
+#define MC__ESpan_Tk                             (MCPARAMID)(  988 << 14)
+#define MC__EXPOn_E                              (MCPARAMID)(  989 << 14)
+#define MC__EXPOff_E                             (MCPARAMID)(  990 << 14)
+#define MC__ExposeWidth_E                        (MCPARAMID)(  991 << 14)
+#define MC__StrobeWidth_E                        (MCPARAMID)(  992 << 14)
+#define MC__STROn_E                              (MCPARAMID)(  993 << 14)
+#define MC__STROff_E                             (MCPARAMID)(  994 << 14)
+#define MC__EXPWidth_E                           (MCPARAMID)(  995 << 14)
+#define MC__STRWidth_E                           (MCPARAMID)(  996 << 14)
+#define MC__ENDE_E                               (MCPARAMID)(  997 << 14)
+#define MC_ExpEdge                               (MCPARAMID)(  998 << 14)
+#define MC_ExpEdge_GOLOW                           1
+#define MC_ExpEdge_GOHIGH                          2
+#define MC__TrueExp_Tk                           (MCPARAMID)(  999 << 14)
+#define MC__ExposeTrim_pc                        (MCPARAMID)( 1000 << 14)
+#define MC_CamConfig_P100RA_G                     20
+#define MC_ExposeOverlap                         (MCPARAMID)( 1001 << 14)
+#define MC_ExposeOverlap_FORBID                    1
+#define MC_ExposeOverlap_ALLOW                     2
+#define MC__TrigLine                             (MCPARAMID)( 1002 << 14)
+#define MC_D4Input                               (MCPARAMID)( 1003 << 14)
+#define MC_D4Input_ON                              1
+#define MC_D4Input_OFF                             2
+#define MC__Category                             (MCPARAMID)( 1004 << 14)
+#define MC__Category_Camera_Specification          1
+#define MC__Category_Camera_Timing                 2
+#define MC__Category_Camera_Features               3
+#define MC__Category_Line_Scan_Features            4
+#define MC__Category_Trigger_Control               5
+#define MC__Category_Exposure_Control              6
+#define MC__Category_Strobe_Control                7
+#define MC__Category_Board_Linkage                 8
+#define MC__Category_Board_Configuration           9
+#define MC__Category_Grabber_Configuration        10
+#define MC__Category_Grabber_Timing               11
+#define MC__Category_Grabber_Conditioning         12
+#define MC__Category_Cluster_Linkage              13
+#define MC_CamConfig_FACTORY                      21
+#define MC_TapStructure                          (MCPARAMID)( 1005 << 14)
+#define MC_TapStructure_SINGLE_A                   1
+#define MC_TapStructure_DUAL_A                     2
+#define MC_TapStructure_TRIPLE_A                   3
+#define MC_Manufacturer                          (MCPARAMID)( 1006 << 14)
+#define MC_Manufacturer_NONE                       1
+#define MC_Manufacturer_HITACHI                    2
+#define MC_Manufacturer_JAI                        3
+#define MC_Manufacturer_SONY                       4
+#define MC_Imaging                               (MCPARAMID)( 1007 << 14)
+#define MC_Imaging_AREA                            1
+#define MC_Spectrum                              (MCPARAMID)( 1008 << 14)
+#define MC_Spectrum_BW                             1
+#define MC_Spectrum_COLOR                          2
+#define MC_Spectrum_IR                             3
+#define MC_DataLink                              (MCPARAMID)( 1009 << 14)
+#define MC_DataLink_ANALOG                         1
+#define MC_ColorMethod                           (MCPARAMID)( 1010 << 14)
+#define MC_ColorMethod_NONE                        1
+#define MC_ColorMethod_PRISM                       2
+#define MC_ColorMethod_RGB                         3
+#define MC_Expose                                (MCPARAMID)( 1011 << 14)
+#define MC_Expose_PLSTRG                           3
+#define MC_Expose_PLSCTL                           4
+#define MC_Expose_WIDTH                            5
+#define MC_Expose_INTCTL                           6
+#define MC_Expose_INTPRM                           7
+#define MC_Expose_EXTPRM                           8
+#define MC_Readout                               (MCPARAMID)( 1012 << 14)
+#define MC_Readout_PLSTRG                          1
+#define MC_Readout_WIDTH                           2
+#define MC_Readout_INTCTL                          3
+#define MC__Category_Channel_Management           14
+#define MC__Category_Exception_Management         15
+#define MC__Category_Board_Information            16
+#define MC__ScanMode                             (MCPARAMID)( 1013 << 14)
+#define MC__ScanMode_PROGRESSIVE                   1
+#define MC__ScanMode_INTERLACE                     2
+#define MC_ENDSet                                (MCPARAMID)( 1014 << 14)
+#define MC_EncoderTrim                           (MCPARAMID)( 1015 << 14)
+#define MC__BitCalcArg                           (MCPARAMID)( 1016 << 14)
+#define MC__XTALTrim                             (MCPARAMID)( 1017 << 14)
+#define MC__REFCKATrim                           (MCPARAMID)( 1018 << 14)
+#define MC__BoardType__VALUE                       3
+#define MC__BoardType__EXPERT                      4
+#define MC_Camera_Generic_Dual                    18
+#define MC_Camera_1000m                           19
+#define MC_TapStructure_SINGLE_B                   4
+#define MC_TapStructure_SINGLE_W                   5
+#define MC_TapStructure_DUAL_B                     6
+#define MC_TapStructure_DUAL_B2                    7
+#define MC_TapStructure_DUAL_W                     8
+#define MC_TapStructure_DUAL_W2                    9
+#define MC_TapStructure_TRIPLE_B                  10
+#define MC_TapStructure_TRIPLE_W                  11
+#define MC_TapStructure_QUAD_B                    12
+#define MC_TapStructure_QUAD_B2                   13
+#define MC_TapStructure_QUAD_B4                   14
+#define MC_TapStructure_OCTAL_B2                  15
+#define MC_TapStructure_Filter                   (MCPARAMID)( 1019 << 14)
+#define MC_Operation_PAGE                          5
+#define MC_Operation_WEB                           6
+#define MC_Manufacturer_ADIMEC                     5
+#define MC_DataLink_CAMERALINK                     2
+#define MC_DataClk_Hz                            (MCPARAMID)( 1020 << 14)
+#define MC_Hactive_Px                            (MCPARAMID)( 1021 << 14)
+#define MC_HsyncAft_ns                           (MCPARAMID)( 1022 << 14)
+#define MC_VsyncPst_Ln                           (MCPARAMID)( 1023 << 14)
+#define MC_HsyncPst_ns                           (MCPARAMID)( 1024 << 14)
+#define MC_VgatePos_Ln                           (MCPARAMID)( 1025 << 14)
+#define MC_CameraDataWidth                       (MCPARAMID)( 1026 << 14)
+#define MC_CameraDataWidth_8BIT                    1
+#define MC_CameraDataWidth_10BIT                   2
+#define MC_CameraDataWidth_12BIT                   3
+#define MC_CameraDataWidth_14BIT                   4
+#define MC_CameraDataWidth_16BIT                   5
+#define MC_PixelClkCtl_BUILTIN                     4
+#define MC_PixelClkEdge_BUILTIN                    3
+#define MC_HsyncCtl_BUILTIN                        4
+#define MC_VsyncCtl_BUILTIN                        4
+#define MC_ResetCtl                              (MCPARAMID)( 1027 << 14)
+#define MC_ResetCtl_NONE                           1
+#define MC_ResetCtl_TTL                            2
+#define MC_ResetCtl_DIFF                           3
+#define MC_ResetEdge                             (MCPARAMID)( 1028 << 14)
+#define MC_ResetEdge_GOHIGH                        1
+#define MC_ResetEdge_GOLOW                         2
+#define MC_AuxResetCtl                           (MCPARAMID)( 1029 << 14)
+#define MC_AuxResetCtl_NONE                        1
+#define MC_AuxResetCtl_TTL                         2
+#define MC_AuxResetCtl_DIFF                        3
+#define MC_AuxResetEdge                          (MCPARAMID)( 1030 << 14)
+#define MC_AuxResetEdge_GOHIGH                     1
+#define MC_AuxResetEdge_GOLOW                      2
+#define MC_ResetDur                              (MCPARAMID)( 1031 << 14)
+#define MC_ResetPos                              (MCPARAMID)( 1032 << 14)
+#define MC_ExposeMin_us                          (MCPARAMID)( 1033 << 14)
+#define MC_ExposeMax_us                          (MCPARAMID)( 1034 << 14)
+#define MC_FvalMode                              (MCPARAMID)( 1035 << 14)
+#define MC_FvalMode_FN                             1
+#define MC_FvalMode_FA                             2
+#define MC_FvalMode_FC                             3
+#define MC_FvalMode_PC                             4
+#define MC_LvalMode                              (MCPARAMID)( 1036 << 14)
+#define MC_LvalMode_LA                             1
+#define MC_LvalMode_LP                             2
+#define MC_LvalMode_LB                             3
+#define MC_LvalMode_LC                             4
+#define MC_DvalMode                              (MCPARAMID)( 1037 << 14)
+#define MC_DvalMode_DN                             1
+#define MC_DvalMode_DG                             2
+#define MC_DvalMode_DC                             3
+#define MC_Cable_CL_C01                           11
+#define MC__Category_Cable_Features               17
+#define MC__Category_Encoder_Control              18
+#define MC_PageDelay_Ln                          (MCPARAMID)( 1038 << 14)
+#define MC_PageLength_Ln                         (MCPARAMID)( 1039 << 14)
+#define MC_GrabberDataWidth                      (MCPARAMID)( 1040 << 14)
+#define MC_GrabberDataWidth_8BIT                   1
+#define MC_GrabberDataWidth_10BIT                  2
+#define MC_GrabberDataWidth_12BIT                  3
+#define MC_GrabberDataWidth_14BIT                  4
+#define MC_GrabberDataWidth_16BIT                  5
+#define MC__CDC_SRC                              (MCPARAMID)( 1041 << 14)
+#define MC__CDC_SRC_CAMERA                         1
+#define MC__CDC_SRC_TPG                            2
+#define MC__CDC_ISIZE                            (MCPARAMID)( 1042 << 14)
+#define MC__CDC_ISIZE_BASE8                        1
+#define MC__CDC_ISIZE_BASE10                       2
+#define MC__CDC_ISIZE_BASE12                       3
+#define MC__CDC_ISIZE_BASE14                       4
+#define MC__CDC_ISIZE_BASE16                       5
+#define MC__CDC_ALIGN                            (MCPARAMID)( 1043 << 14)
+#define MC__CDC_ALIGN_BYTE                         1
+#define MC__CDC_ALIGN_WORDMS                       2
+#define MC__CDC_ALIGN_WORDLS                       3
+#define MC__CDC_FALLOC1                          (MCPARAMID)( 1044 << 14)
+#define MC__CDC_FALLOC1_256_0                      1
+#define MC__CDC_FALLOC1_128_0                      2
+#define MC__CDC_FALLOC1_128_128                    3
+#define MC__CDC_FALLOC1_64_0                       4
+#define MC__CDC_FALLOC1_64_64                      5
+#define MC__CDC_FALLOC1_64_128                     6
+#define MC__CDC_FALLOC1_64_192                     7
+#define MC__CDC_FALLOC2                          (MCPARAMID)( 1045 << 14)
+#define MC__CDC_FALLOC2_256_0                      1
+#define MC__CDC_FALLOC2_128_0                      2
+#define MC__CDC_FALLOC2_128_128                    3
+#define MC__CDC_FALLOC2_64_0                       4
+#define MC__CDC_FALLOC2_64_64                      5
+#define MC__CDC_FALLOC2_64_128                     6
+#define MC__CDC_FALLOC2_64_192                     7
+#define MC__CDC_FALLOC3                          (MCPARAMID)( 1046 << 14)
+#define MC__CDC_FALLOC3_256_0                      1
+#define MC__CDC_FALLOC3_128_0                      2
+#define MC__CDC_FALLOC3_128_128                    3
+#define MC__CDC_FALLOC3_64_0                       4
+#define MC__CDC_FALLOC3_64_64                      5
+#define MC__CDC_FALLOC3_64_128                     6
+#define MC__CDC_FALLOC3_64_192                     7
+#define MC__CBA_FALLOC1                          (MCPARAMID)( 1047 << 14)
+#define MC__CBA_FALLOC1_256_0                      1
+#define MC__CBA_FALLOC1_128_0                      2
+#define MC__CBA_FALLOC1_128_128                    3
+#define MC__CBA_FALLOC1_64_0                       4
+#define MC__CBA_FALLOC1_64_64                      5
+#define MC__CBA_FALLOC1_64_128                     6
+#define MC__CBA_FALLOC1_64_192                     7
+#define MC__CBA_FALLOC2                          (MCPARAMID)( 1048 << 14)
+#define MC__CBA_FALLOC2_256_0                      1
+#define MC__CBA_FALLOC2_128_0                      2
+#define MC__CBA_FALLOC2_128_128                    3
+#define MC__CBA_FALLOC2_64_0                       4
+#define MC__CBA_FALLOC2_64_64                      5
+#define MC__CBA_FALLOC2_64_128                     6
+#define MC__CBA_FALLOC2_64_192                     7
+#define MC__CBA_FALLOC3                          (MCPARAMID)( 1049 << 14)
+#define MC__CBA_FALLOC3_256_0                      1
+#define MC__CBA_FALLOC3_128_0                      2
+#define MC__CBA_FALLOC3_128_128                    3
+#define MC__CBA_FALLOC3_64_0                       4
+#define MC__CBA_FALLOC3_64_64                      5
+#define MC__CBA_FALLOC3_64_128                     6
+#define MC__CBA_FALLOC3_64_192                     7
+#define MC__CBA_FALLOC4                          (MCPARAMID)( 1050 << 14)
+#define MC__CBA_FALLOC4_256_0                      1
+#define MC__CBA_FALLOC4_128_0                      2
+#define MC__CBA_FALLOC4_128_128                    3
+#define MC__CBA_FALLOC4_64_0                       4
+#define MC__CBA_FALLOC4_64_64                      5
+#define MC__CBA_FALLOC4_64_128                     6
+#define MC__CBA_FALLOC4_64_192                     7
+#define MC__WIC                                  (MCPARAMID)( 1051 << 14)
+#define MC__WIC_ONE                                1
+#define MC__WIC_TWO                                2
+#define MC__WIC_THREE                              3
+#define MC__WIC_FOUR                               4
+#define MC__CBA_SHIFT1                           (MCPARAMID)( 1052 << 14)
+#define MC__CBA_SHIFT2                           (MCPARAMID)( 1053 << 14)
+#define MC__CBA_SHIFT3                           (MCPARAMID)( 1054 << 14)
+#define MC__CBA_SHIFT4                           (MCPARAMID)( 1055 << 14)
+#define MC_Connector_X_Y                           7
+#define MC__CBA_GROUP1                           (MCPARAMID)( 1056 << 14)
+#define MC__ASSY                                 (MCPARAMID)( 1057 << 14)
+#define MC__ASSY_ONE                               1
+#define MC__ASSY_TWO                               2
+#define MC__ASSY_THREE                             3
+#define MC__ASSY_FOUR                              4
+#define MC__CBA_GROUP2                           (MCPARAMID)( 1058 << 14)
+#define MC__CBA_GROUP3                           (MCPARAMID)( 1059 << 14)
+#define MC__CDC_ISIZE_MEDIUM8                      6
+#define MC__CDC_ISIZE_MEDIUM10                     7
+#define MC__CDC_ISIZE_MEDIUM12                     8
+#define MC__CAM                                  (MCPARAMID)( 1060 << 14)
+#define MC__CAM_MONOCAM                            1
+#define MC__CAM_DUOCAM                             2
+#define MC__CTA_START01                          (MCPARAMID)( 1061 << 14)
+#define MC__CTA_START11                          (MCPARAMID)( 1062 << 14)
+#define MC__CTA_START02                          (MCPARAMID)( 1063 << 14)
+#define MC__CTA_START12                          (MCPARAMID)( 1064 << 14)
+#define MC__BW                                   (MCPARAMID)( 1065 << 14)
+#define MC__ISIZX                                (MCPARAMID)( 1066 << 14)
+#define MC__ISIZYF                               (MCPARAMID)( 1067 << 14)
+#define MC__ISIZY                                (MCPARAMID)( 1068 << 14)
+#define MC__WX                                   (MCPARAMID)( 1069 << 14)
+#define MC__WY                                   (MCPARAMID)( 1070 << 14)
+#define MC__DirX1                                (MCPARAMID)( 1071 << 14)
+#define MC__DirX2                                (MCPARAMID)( 1072 << 14)
+#define MC__DirX3                                (MCPARAMID)( 1073 << 14)
+#define MC__DirY1                                (MCPARAMID)( 1074 << 14)
+#define MC__DirY2                                (MCPARAMID)( 1075 << 14)
+#define MC__DirY3                                (MCPARAMID)( 1076 << 14)
+#define MC_ImagePitch                            (MCPARAMID)( 1077 << 14)
+#define MC__PITCH1                               (MCPARAMID)( 1078 << 14)
+#define MC__PITCH2                               (MCPARAMID)( 1079 << 14)
+#define MC__PITCH3                               (MCPARAMID)( 1080 << 14)
+#define MC__InterlaceFactor                      (MCPARAMID)( 1081 << 14)
+#define MC__CTA_STEPX1                           (MCPARAMID)( 1082 << 14)
+#define MC__CTA_STEPX2                           (MCPARAMID)( 1083 << 14)
+#define MC__CTA_STEPX3                           (MCPARAMID)( 1084 << 14)
+#define MC__CTA_STEPY1                           (MCPARAMID)( 1085 << 14)
+#define MC__CTA_STEPY2                           (MCPARAMID)( 1086 << 14)
+#define MC__CTA_STEPY3                           (MCPARAMID)( 1087 << 14)
+#define MC__OFSD1                                (MCPARAMID)( 1088 << 14)
+#define MC__OFSD2                                (MCPARAMID)( 1089 << 14)
+#define MC__OFSD3                                (MCPARAMID)( 1090 << 14)
+#define MC__OFSU1                                (MCPARAMID)( 1091 << 14)
+#define MC__OFSU2                                (MCPARAMID)( 1092 << 14)
+#define MC__OFSU3                                (MCPARAMID)( 1093 << 14)
+#define MC__CTA_OFSD1                            (MCPARAMID)( 1094 << 14)
+#define MC__CTA_OFSD2                            (MCPARAMID)( 1095 << 14)
+#define MC__CTA_OFSD3                            (MCPARAMID)( 1096 << 14)
+#define MC__CTA_OFSU1                            (MCPARAMID)( 1097 << 14)
+#define MC__CTA_OFSU2                            (MCPARAMID)( 1098 << 14)
+#define MC__CTA_OFSU3                            (MCPARAMID)( 1099 << 14)
+#define MC__CTA_SELINC                           (MCPARAMID)( 1100 << 14)
+#define MC__CTA_SELINC_EOL                         1
+#define MC__CTA_SELINC_EOF                         2
+#define MC__CTA_SELINC_EOL2                        3
+#define MC__CTA_SELINC_EOF2                        4
+#define MC__Xchannels                            (MCPARAMID)( 1101 << 14)
+#define MC__CTA_OFS01                            (MCPARAMID)( 1102 << 14)
+#define MC__CTA_OFS11                            (MCPARAMID)( 1103 << 14)
+#define MC__CTA_OFS02                            (MCPARAMID)( 1104 << 14)
+#define MC__CTA_OFS12                            (MCPARAMID)( 1105 << 14)
+#define MC__CTA_TFINC                            (MCPARAMID)( 1106 << 14)
+#define MC__CBA_PSHIFT1                          (MCPARAMID)( 1107 << 14)
+#define MC__CBA_PSHIFT2                          (MCPARAMID)( 1108 << 14)
+#define MC__CBA_PSHIFT3                          (MCPARAMID)( 1109 << 14)
+#define MC__CBA_PSHIFT4                          (MCPARAMID)( 1110 << 14)
+#define MC_CamConfig_P25SC_S8                     22
+#define MC_CamConfig_P25SC_S10                    23
+#define MC_CamConfig_P50SC_D8                     24
+#define MC_CamConfig_P50SC_D10                    25
+#define MC_HsyncAft_Tk                           (MCPARAMID)( 1111 << 14)
+#define MC_HsyncPst_Tk                           (MCPARAMID)( 1112 << 14)
+#define MC__PITCH1_mw                            (MCPARAMID)( 1113 << 14)
+#define MC__PITCH2_mw                            (MCPARAMID)( 1114 << 14)
+#define MC__PITCH3_mw                            (MCPARAMID)( 1115 << 14)
+#define MC__SIZX_mw                              (MCPARAMID)( 1116 << 14)
+#define MC__STARTU1_mw                           (MCPARAMID)( 1117 << 14)
+#define MC__STARTU2_mw                           (MCPARAMID)( 1118 << 14)
+#define MC__STARTU3_mw                           (MCPARAMID)( 1119 << 14)
+#define MC__STARTD1_mw                           (MCPARAMID)( 1120 << 14)
+#define MC__STARTD2_mw                           (MCPARAMID)( 1121 << 14)
+#define MC__STARTD3_mw                           (MCPARAMID)( 1122 << 14)
+#define MC__OFSU1_mw                             (MCPARAMID)( 1123 << 14)
+#define MC__OFSU2_mw                             (MCPARAMID)( 1124 << 14)
+#define MC__OFSU3_mw                             (MCPARAMID)( 1125 << 14)
+#define MC__OFSD1_mw                             (MCPARAMID)( 1126 << 14)
+#define MC__OFSD2_mw                             (MCPARAMID)( 1127 << 14)
+#define MC__OFSD3_mw                             (MCPARAMID)( 1128 << 14)
+#define MC__IPitch_mw                            (MCPARAMID)( 1129 << 14)
+#define MC__Pitch_mw                             (MCPARAMID)( 1130 << 14)
+#define MC_GrabSizeX_Px                          (MCPARAMID)( 1131 << 14)
+#define MC_CamConfig_P50SC                        26
+#define MC_GrabberDataWidth_Filter               (MCPARAMID)( 1132 << 14)
+#define MC_GrabSizeXStep_Px                      (MCPARAMID)( 1133 << 14)
+#define MC_CamConfig_Filter                      (MCPARAMID)( 1134 << 14)
+#define MC__VLC_LCNT                             (MCPARAMID)( 1135 << 14)
+#define MC__VLC_LBFR                             (MCPARAMID)( 1136 << 14)
+#define MC__VLC_LAFT                             (MCPARAMID)( 1137 << 14)
+#define MC__VLC_DCNT                             (MCPARAMID)( 1138 << 14)
+#define MC__VLC_DBFR                             (MCPARAMID)( 1139 << 14)
+#define MC__VLC_DAFT                             (MCPARAMID)( 1140 << 14)
+#define MC__x_INDEX                              (MCPARAMID)( 1141 << 14)
+#define MC__D1_INDEX                             (MCPARAMID)( 1142 << 14)
+#define MC__D2_INDEX                             (MCPARAMID)( 1143 << 14)
+#define MC__D3_INDEX                             (MCPARAMID)( 1144 << 14)
+#define MC__D4_INDEX                             (MCPARAMID)( 1145 << 14)
+#define MC_FutureUseLoadSet                      (MCPARAMID)( 1146 << 14)
+#define MC_DigUnit1_E                              5
+#define MC_DigUnit1_F                              6
+#define MC_DigUnit1_G                              7
+#define MC_DigUnit1_H                              8
+#define MC_Camera_A201b                           21
+#define MC_CamConfig_P30SC                        27
+#define MC_Manufacturer_BASLER                     6
+#define MC_Cable_CL_C02                           12
+#define MC_LinePitch_Filter                      (MCPARAMID)( 1147 << 14)
+#define MC_PageDelay_Ln_Filter                   (MCPARAMID)( 1148 << 14)
+#define MC_PageLength_Ln_Filter                  (MCPARAMID)( 1149 << 14)
+#define MC_EncoderPitch_Filter                   (MCPARAMID)( 1150 << 14)
+#define MC_Camera_Filter                         (MCPARAMID)( 1151 << 14)
+#define MC_Operation_Filter                      (MCPARAMID)( 1152 << 14)
+#define MC___Unsupported_Parameter_Filter        (MCPARAMID)( 1153 << 14)
+#define MC_MAN_GrabWindow_Filter                 (MCPARAMID)( 1154 << 14)
+#define MC_Camera_A202k                           22
+#define MC_Camera_Manufacturer_Filter            (MCPARAMID)( 1155 << 14)
+#define MC_CableName                             (MCPARAMID)( 1156 << 14)
+#define MC_CableName_CameraLink_Standard           1
+#define MC_CableName_Basler_Channel_Link           2
+#define MC___CamConfig_Check                     (MCPARAMID)( 1157 << 14)
+#define MC___CamConfig_Check_PASS                  1
+#define MC___CamConfig_Check_FAIL                  2
+#define MC_CamConfig_P48SC                        28
+#define MC_ResetLine                             (MCPARAMID)( 1158 << 14)
+#define MC_ResetLine_CC1                           1
+#define MC_ResetLine_CC2                           2
+#define MC_ResetLine_CC3                           3
+#define MC_ResetLine_CC4                           4
+#define MC_AuxresetLine                          (MCPARAMID)( 1159 << 14)
+#define MC_AuxresetLine_CC1                        1
+#define MC_AuxresetLine_CC2                        2
+#define MC_AuxresetLine_CC3                        3
+#define MC_AuxresetLine_CC4                        4
+#define MC_CamConfig_P50SM                        29
+#define MC__ClkSynthReq                          (MCPARAMID)( 1160 << 14)
+#define MC__ClkSynthReq_NONE                       1
+#define MC__ClkSynthReq_CS1                        2
+#define MC__ClkSynthReq_CS2                        3
+#define MC_ClkSynth1_UNKNOWN                       1
+#define MC_ClkSynth1_FREE                          2
+#define MC_ClkSynth1_USEDX                         3
+#define MC_ClkSynth1_USEDY                         4
+#define MC_ClkSynth1_USEDZ                         5
+#define MC_ClkSynth2_UNKNOWN                       1
+#define MC_ClkSynth2_FREE                          2
+#define MC_ClkSynth2_USEDX                         3
+#define MC_ClkSynth2_USEDY                         4
+#define MC_ClkSynth2_USEDZ                         5
+#define MC_ClkSynth1_XXX                           6
+#define MC_ClkSynth2_XXX                           6
+#define MC___Gamma_ClkSynth_Check                (MCPARAMID)( 1161 << 14)
+#define MC___Gamma_ClkSynth_Check_PASS             1
+#define MC___Gamma_ClkSynth_Check_FAIL             2
+#define MC_ClkSynth1_Hz                          (MCPARAMID)( 1162 << 14)
+#define MC_ClkSynth2_Hz                          (MCPARAMID)( 1163 << 14)
+#define MC__VerticalSyncMode                     (MCPARAMID)( 1164 << 14)
+#define MC__VerticalSyncMode_ANALOG                1
+#define MC__VerticalSyncMode_DIGITAL               2
+#define MC__VerticalSyncMode_MASTER                3
+#define MC__SYNC_Line1_Type                      (MCPARAMID)( 1165 << 14)
+#define MC_TimUnitN_XXX                            6
+#define MC__SSC                                  (MCPARAMID)( 1166 << 14)
+#define MC__SSC_CCIR                               1
+#define MC__SSC_EIA                                2
+#define MC__SSC_CCIR_2                             3
+#define MC__SSC_EIA_2                              4
+#define MC__SSC_OUTOFRANGE                         5
+#define MC__SELH_SSC                               5
+#define MC__SYNC_Line1_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line1_Type_BLANK_VRSTON           2
+#define MC__SYNC_Line1_Dur                       (MCPARAMID)( 1167 << 14)
+#define MC__SYNC_Line2_Type                      (MCPARAMID)( 1168 << 14)
+#define MC__SYNC_Line2_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line2_Dur                       (MCPARAMID)( 1169 << 14)
+#define MC__SYNC_Line3_Type                      (MCPARAMID)( 1170 << 14)
+#define MC__SYNC_Line3_Type_ACQ_VRSTOFF            1
+#define MC__SYNC_Line3_Dur                       (MCPARAMID)( 1171 << 14)
+#define MC__SYNC_Line4_Type                      (MCPARAMID)( 1172 << 14)
+#define MC__SYNC_Line4_Type_ACQ_VRSTOFF            1
+#define MC__SYNC_Line4_Type_ACQ_VRSTON             2
+#define MC__SYNC_Line4_Dur                       (MCPARAMID)( 1173 << 14)
+#define MC__SYNC_Line5_Type                      (MCPARAMID)( 1174 << 14)
+#define MC__SYNC_Line5_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line5_Type_BLANK_VRSTON           2
+#define MC__SYNC_Line5_Dur                       (MCPARAMID)( 1175 << 14)
+#define MC__SYNC_Acq_Dur                         (MCPARAMID)( 1176 << 14)
+#define MC__SYNC_Vrst_Dur                        (MCPARAMID)( 1177 << 14)
+#define MC__SYNC_RefV2Acq_Gap                    (MCPARAMID)( 1178 << 14)
+#define MC__SYNC_Field_Dur                       (MCPARAMID)( 1179 << 14)
+#define MC__SYNC_Eacq2Vrst_Gap                   (MCPARAMID)( 1180 << 14)
+#define MC__SYNC_Vrst2Bacq_Gap                   (MCPARAMID)( 1181 << 14)
+#define MC__SYNC_Vtotal_Check                    (MCPARAMID)( 1182 << 14)
+#define MC__SYNC_Eacq2Vrst_Phase                 (MCPARAMID)( 1183 << 14)
+#define MC__SYNC_Eacq2Vrst_Phase_BEFORE            1
+#define MC__SYNC_Eacq2Vrst_Phase_SAME              2
+#define MC__SYNC_Eacq2Vrst_Phase_AFTER             3
+#define MC_ClkSynth1_OFF                           7
+#define MC_ClkSynth1_TX                            8
+#define MC_ClkSynth1_TY                            9
+#define MC_ClkSynth1_TZ                           10
+#define MC_ClkSynth2_OFF                           7
+#define MC_ClkSynth2_TX                            8
+#define MC_ClkSynth2_TY                            9
+#define MC_ClkSynth2_TZ                           10
+#define MC__PllControl                           (MCPARAMID)( 1184 << 14)
+#define MC__PllControl_YES                         1
+#define MC__PllControl_NO                          2
+#define MC_CamConfig_P50RM_G                      30
+#define MC__DigUnit1                             (MCPARAMID)( 1185 << 14)
+#define MC__DigUnit2                             (MCPARAMID)( 1186 << 14)
+#define MC__DigUnit3                             (MCPARAMID)( 1187 << 14)
+#define MC__TimUnit                              (MCPARAMID)( 1188 << 14)
+#define MC_CSTSet                                (MCPARAMID)( 1189 << 14)
+#define MC_WSTSet                                (MCPARAMID)( 1190 << 14)
+#define MC_PixelClkLine                          (MCPARAMID)( 1191 << 14)
+#define MC_PixelClkLine_CK                         1
+#define MC_ResetLine_RST                           5
+#define MC_ResetLine_EXP                           6
+#define MC_ResetLine_GATE                          7
+#define MC_ResetLine_HIO                           8
+#define MC_ResetLine_VIO                           9
+#define MC_ResetLine_DUAL                         10
+#define MC_AuxResetLine_RST                        5
+#define MC_AuxResetLine_EXP                        6
+#define MC_AuxResetLine_GATE                       7
+#define MC_AuxResetLine_HIO                        8
+#define MC_AuxResetLine_VIO                        9
+#define MC_AuxResetLine_DUAL                      10
+#define MC_VsyncLine                             (MCPARAMID)( 1192 << 14)
+#define MC_VsyncLine_RST                           1
+#define MC_VsyncLine_EXP                           2
+#define MC_VsyncLine_GATE                          3
+#define MC_VsyncLine_HIO                           4
+#define MC_VsyncLine_VIO                           5
+#define MC_VsyncLine_DUAL                          6
+#define MC_HsyncLine                             (MCPARAMID)( 1193 << 14)
+#define MC_HsyncLine_RST                           1
+#define MC_HsyncLine_EXP                           2
+#define MC_HsyncLine_GATE                          3
+#define MC_HsyncLine_HIO                           4
+#define MC_HsyncLine_VIO                           5
+#define MC_HsyncLine_DUAL                          6
+#define MC_CableName_UNKNOWN                       3
+#define MC_CableName_Single_Channel_R              4
+#define MC_CableName_Single_Channel_RC             5
+#define MC_CableName_Single_Channel_RGC_2          6
+#define MC_CableName_Dual_Channel                  7
+#define MC_CableName_Dual_Channel_RG               8
+#define MC_CableName_Dual_Channel_RG_2             9
+#define MC_CableName_Triple_Channel_R             10
+#define MC_ColorMethod_Filter                    (MCPARAMID)( 1194 << 14)
+#define MC_GCE_Filter                            (MCPARAMID)( 1195 << 14)
+#define MC__TrueExp_us                           (MCPARAMID)( 1196 << 14)
+#define MC_StrobeMode                            (MCPARAMID)( 1197 << 14)
+#define MC_StrobeMode_Filter                     (MCPARAMID)( 1198 << 14)
+#define MC_StrobeMode_NONE                         1
+#define MC_StrobeMode_AUTO                         2
+#define MC_StrobeMode_MAN                          3
+#define MC_SampleTrim                            (MCPARAMID)( 1199 << 14)
+#define MC_DigUnit2_Filter                       (MCPARAMID)( 1200 << 14)
+#define MC_DigUnit3_Filter                       (MCPARAMID)( 1201 << 14)
+#define MC_SampleTrim_Filter                     (MCPARAMID)( 1202 << 14)
+#define MC_Manufacturer_MY_CAMERAS                 7
+#define MC___GrabberTiming_Check                 (MCPARAMID)( 1203 << 14)
+#define MC___GrabberTiming_Check_PASS              1
+#define MC___GrabberTiming_Check_FAIL              2
+#define MC__HDC_DCNT                             (MCPARAMID)( 1204 << 14)
+#define MC__HBC_HPRE                             (MCPARAMID)( 1205 << 14)
+#define MC__HBC_DBFR_Expected                    (MCPARAMID)( 1206 << 14)
+#define MC__HBC_DBFR                             (MCPARAMID)( 1207 << 14)
+#define MC__HBC_DBFR_Check                       (MCPARAMID)( 1208 << 14)
+#define MC__HBC_DBFR_Check_PASS                    1
+#define MC__HBC_DBFR_Check_FAIL                    2
+#define MC__HAC_DAFT                             (MCPARAMID)( 1209 << 14)
+#define MC__VBC_LBFR                             (MCPARAMID)( 1210 << 14)
+#define MC__VAC_LAFT                             (MCPARAMID)( 1211 << 14)
+#define MC__SCC_CC1                              (MCPARAMID)( 1212 << 14)
+#define MC__SCC_CC1_CTL1                           1
+#define MC__SCC_CC1_CTL2                           2
+#define MC__SCC_CC1_XCTL2                          3
+#define MC__SCC_CC1_LOW                            4
+#define MC__SCC_CC1_CTL1n                          5
+#define MC__SCC_CC1_CTL2n                          6
+#define MC__SCC_CC1_XCTL2n                         7
+#define MC__SCC_CC1_HIGH                           8
+#define MC__SCC_CC2                              (MCPARAMID)( 1213 << 14)
+#define MC__SCC_CC2_CTL1                           1
+#define MC__SCC_CC2_CTL2                           2
+#define MC__SCC_CC2_XCTL2                          3
+#define MC__SCC_CC2_LOW                            4
+#define MC__SCC_CC2_CTL1n                          5
+#define MC__SCC_CC2_CTL2n                          6
+#define MC__SCC_CC2_XCTL2n                         7
+#define MC__SCC_CC2_HIGH                           8
+#define MC__SCC_CC3                              (MCPARAMID)( 1214 << 14)
+#define MC__SCC_CC3_CTL1                           1
+#define MC__SCC_CC3_CTL2                           2
+#define MC__SCC_CC3_XCTL2                          3
+#define MC__SCC_CC3_LOW                            4
+#define MC__SCC_CC3_CTL1n                          5
+#define MC__SCC_CC3_CTL2n                          6
+#define MC__SCC_CC3_XCTL2n                         7
+#define MC__SCC_CC3_HIGH                           8
+#define MC__SCC_CC4                              (MCPARAMID)( 1215 << 14)
+#define MC__SCC_CC4_CTL1                           1
+#define MC__SCC_CC4_CTL2                           2
+#define MC__SCC_CC4_XCTL2                          3
+#define MC__SCC_CC4_LOW                            4
+#define MC__SCC_CC4_CTL1n                          5
+#define MC__SCC_CC4_CTL2n                          6
+#define MC__SCC_CC4_XCTL2n                         7
+#define MC__SCC_CC4_HIGH                           8
+#define MC_CC1Usage                              (MCPARAMID)( 1216 << 14)
+#define MC_CC1Usage_SOFT                           1
+#define MC_CC1Usage_LOW                            2
+#define MC_CC1Usage_HIGH                           3
+#define MC_CC1Usage_RESET                          4
+#define MC_CC1Usage_AUXRESET                       5
+#define MC_CC1Usage_ACQPHASE                       6
+#define MC_CC1Usage_ACQSEQUENCE                    7
+#define MC_CCxUsage_Filter                       (MCPARAMID)( 1217 << 14)
+#define MC_CC2Usage                              (MCPARAMID)( 1218 << 14)
+#define MC_CC2Usage_SOFT                           1
+#define MC_CC2Usage_LOW                            2
+#define MC_CC2Usage_HIGH                           3
+#define MC_CC2Usage_RESET                          4
+#define MC_CC2Usage_AUXRESET                       5
+#define MC_CC2Usage_ACQPHASE                       6
+#define MC_CC2Usage_ACQSEQUENCE                    7
+#define MC_CC3Usage                              (MCPARAMID)( 1219 << 14)
+#define MC_CC3Usage_SOFT                           1
+#define MC_CC3Usage_LOW                            2
+#define MC_CC3Usage_HIGH                           3
+#define MC_CC3Usage_RESET                          4
+#define MC_CC3Usage_AUXRESET                       5
+#define MC_CC3Usage_ACQPHASE                       6
+#define MC_CC3Usage_ACQSEQUENCE                    7
+#define MC_CC4Usage                              (MCPARAMID)( 1220 << 14)
+#define MC_CC4Usage_SOFT                           1
+#define MC_CC4Usage_LOW                            2
+#define MC_CC4Usage_HIGH                           3
+#define MC_CC4Usage_RESET                          4
+#define MC_CC4Usage_AUXRESET                       5
+#define MC_CC4Usage_ACQPHASE                       6
+#define MC_CC4Usage_ACQSEQUENCE                    7
+#define MC__STRB                                 (MCPARAMID)( 1221 << 14)
+#define MC__CID                                  (MCPARAMID)( 1222 << 14)
+#define MC__OUT1                                 (MCPARAMID)( 1223 << 14)
+#define MC__OUT2                                 (MCPARAMID)( 1224 << 14)
+#define MC__OUT3                                 (MCPARAMID)( 1225 << 14)
+#define MC__OUT4                                 (MCPARAMID)( 1226 << 14)
+#define MC__VBC_LBFR_Expected                    (MCPARAMID)( 1227 << 14)
+#define MC__VBC_LBFR_Check                       (MCPARAMID)( 1228 << 14)
+#define MC__VBC_LBFR_Check_PASS                    1
+#define MC__VBC_LBFR_Check_FAIL                    2
+#define MC__VBC_VPRE                             (MCPARAMID)( 1229 << 14)
+#define MC__VLC_LCINIT                           (MCPARAMID)( 1230 << 14)
+#define MC_Camera_TM_1020_15CL                    23
+#define MC_Camera_TM_1320_15CL                    24
+#define MC_Camera_SVS282CSCL                      25
+#define MC_Camera_SVS285MFCL                      26
+#define MC_Camera_SVS285MSCL                      27
+#define MC_CamConfig_P15SC                        31
+#define MC_CamConfig_I10SC                        32
+#define MC_CamConfig_P22SC                        33
+#define MC_Manufacturer_PULNIX                     8
+#define MC_Manufacturer_VISTEK                     9
+#define MC_ColorMethod_BAYER                       4
+#define MC__DRS_CPAR                             (MCPARAMID)( 1231 << 14)
+#define MC__DRS_CSAP                             (MCPARAMID)( 1232 << 14)
+#define MC__DRS_CFLD                             (MCPARAMID)( 1233 << 14)
+#define MC__TRG_FTPOL_SAS                        (MCPARAMID)( 1234 << 14)
+#define MC__TRG_FTPOL_SAS_NONE                     1
+#define MC__TRG_FTPOL_SAS_DIRECT                   2
+#define MC__TRG_FTPOL_SAS_INVERT                   3
+#define MC__TRG_FTPOL_SAP                        (MCPARAMID)( 1235 << 14)
+#define MC__TRG_FTPOL_SAP_NONE                     1
+#define MC__TRG_FTPOL_SAP_DIRECT                   2
+#define MC__TRG_FTPOL_SAP_INVERT                   3
+#define MC_TrigFilter_MEDIUM                       3
+#define MC_TrigFilter_STRONG                       4
+#define MC__TRG_FTFLT                            (MCPARAMID)( 1236 << 14)
+#define MC__TRG_FTFLT_NONE                         1
+#define MC__TRG_FTFLT_200ns                        2
+#define MC__TRG_FTFLT_3200ns                       3
+#define MC_TrigLine_CAM                            6
+#define MC__TRG_FTSEL_SAS                        (MCPARAMID)( 1237 << 14)
+#define MC__TRG_FTSEL_SAS_DA1                      1
+#define MC__TRG_FTSEL_SAS_DA2                      2
+#define MC__TRG_FTSEL_SAS_CAMSIG                   3
+#define MC__TRG_FTSEL_SAS_TRG                      4
+#define MC__TRG_FTSEL_SAS_FORCE                    5
+#define MC__TRG_FTSEL_SAP                        (MCPARAMID)( 1238 << 14)
+#define MC__TRG_FTSEL_SAP_KEEP                     1
+#define MC__TRG_FTSEL_SAP_FORCE                    2
+#define MC__STM1_T1CLK                           (MCPARAMID)( 1239 << 14)
+#define MC__STM1_T1CLK_PRESCALER                   1
+#define MC__STM1_T1CLK_LTRIGS                      2
+#define MC__STM1_T1CLK_PPLS                        3
+#define MC__STM1_T1SCAL                          (MCPARAMID)( 1240 << 14)
+#define MC__STM1_T1SCAL_100ns                      1
+#define MC__STM1_T1SCAL_1us                        2
+#define MC__STM1_T1SCAL_10us                       3
+#define MC__STM1_T1SCAL_100us                      4
+#define MC__STM1_T1SCAL_1ms                        5
+#define MC__PRM1_T1POS_CTL1On                    (MCPARAMID)( 1241 << 14)
+#define MC__PRM1_T1POS_CTL1Off                   (MCPARAMID)( 1242 << 14)
+#define MC__PRM1_T1POS_PulseSq                   (MCPARAMID)( 1243 << 14)
+#define MC__PRM1_T1POS_PulseEnd                  (MCPARAMID)( 1244 << 14)
+#define MC___Timer1_Check                        (MCPARAMID)( 1245 << 14)
+#define MC___Timer1_Check_PASS                     1
+#define MC___Timer1_Check_FAIL                     2
+#define MC__STM1_T1SCAL_OVER                       6
+#define MC_Camera_SVS084MFCL                      28
+#define MC_Camera_SVS084MSCL                      29
+#define MC_Camera_SVS085MFCL                      30
+#define MC_Camera_SVS085MSCL                      31
+#define MC_Camera_SVS204MFCL                      32
+#define MC_Camera_SVS204MSCL                      33
+#define MC_CamConfig_P21SC                        34
+#define MC_CamConfig_P42SC                        35
+#define MC_CamConfig_P13SC                        36
+#define MC_CamConfig_P25SC                        37
+#define MC_CamConfig_P64SC                        38
+#define MC_CamConfig_P94SC                        39
+#define MC__T1Span_10ns                          (MCPARAMID)( 1246 << 14)
+#define MC__T1_10ns                              (MCPARAMID)( 1247 << 14)
+#define MC__EXPWidth_10ns                        (MCPARAMID)( 1248 << 14)
+#define MC__EXPWidth_T1                          (MCPARAMID)( 1249 << 14)
+#define MC__TRG_FTSEL                            (MCPARAMID)( 1250 << 14)
+#define MC__TRG_FTSEL_DA1                          6
+#define MC__TRG_FTSEL_DA2                          7
+#define MC__TRG_FTSEL_CAMSIG                       8
+#define MC__TRG_FTSEL_TRG                          9
+#define MC__TRG_FTRIG_SAS                        (MCPARAMID)( 1251 << 14)
+#define MC__TRG_FTRIG_SAS_KEEP                     1
+#define MC__TRG_FTRIG_SAS_FORCE                    2
+#define MC__TRG_FTRIG_EAP                        (MCPARAMID)( 1252 << 14)
+#define MC__TRG_FTRIG_EAP_KEEP                     1
+#define MC__TRG_FTRIG_EAP_FORCE                    2
+#define MC__TRG_FTPOL_EAP                        (MCPARAMID)( 1253 << 14)
+#define MC__TRG_FTPOL_EAP_NONE                     1
+#define MC__TRG_FTPOL_EAP_DIRECT                   2
+#define MC__TRG_FTPOL_EAP_INVERT                   3
+#define MC_Camera_CV_A11                          34
+#define MC_CamConfig_P30SM                        40
+#define MC_CamConfig_P30RM_G                      41
+#define MC_Cable_A15_C11                          13
+#define MC_CableName_Single_Channel_RGC           11
+#define MC_EASQet                                (MCPARAMID)( 1254 << 14)
+#define MC_CamConfig_P30RG                        42
+#define MC_CamConfig_P50RG                        43
+#define MC__STM2_T2SCAL                          (MCPARAMID)( 1255 << 14)
+#define MC__STM2_T2SCAL_100ns                      1
+#define MC__STM2_T2SCAL_1us                        2
+#define MC__STM2_T2SCAL_10us                       3
+#define MC__STM2_T2SCAL_100us                      4
+#define MC__STM2_T2SCAL_1ms                        5
+#define MC__STM2_T2SCAL_OVER                       6
+#define MC__PRM2_T2POS_CTL2On                    (MCPARAMID)( 1256 << 14)
+#define MC__PRM2_T2POS_CTL2Off                   (MCPARAMID)( 1257 << 14)
+#define MC__PRM2_T2POS_PulseEnd                  (MCPARAMID)( 1258 << 14)
+#define MC__T2Span_10ns                          (MCPARAMID)( 1259 << 14)
+#define MC_StrobeCtl_ITTL                          3
+#define MC_StrobeCtl_IOC                           4
+#define MC_StrobeCtl_IOE                           5
+#define MC__EXPWidth_T2                          (MCPARAMID)( 1260 << 14)
+#define MC__STRWidth_T2                          (MCPARAMID)( 1261 << 14)
+#define MC__STROn_T2                             (MCPARAMID)( 1262 << 14)
+#define MC__STROff_T2                            (MCPARAMID)( 1263 << 14)
+#define MC_Imaging_LINE                            2
+#define MC_Imaging_TDI                             3
+#define MC_CamConfig_P15RG                        44
+#define MC_Camera_XC_HR50                         35
+#define MC_CamConfig_P60SM                        45
+#define MC_CamConfig_P60RM_G                      46
+#define MC_CamConfig_P60RA_G                      47
+#define MC_CamConfig_P22RG                        48
+#define MC__ACQV_Line1_Dur                       (MCPARAMID)( 1264 << 14)
+#define MC__IDLEV_Line2_Type                     (MCPARAMID)( 1265 << 14)
+#define MC__IDLEV_Line2_Type_BLANK_VRSTON          1
+#define MC__IDLEV_Line2_Type_BLANK_VRSTOFF         2
+#define MC__IDLEV_Line2_Dur                      (MCPARAMID)( 1266 << 14)
+#define MC__ACQV_Line2_Dur                       (MCPARAMID)( 1267 << 14)
+#define MC__ACQV_Line3_Dur                       (MCPARAMID)( 1268 << 14)
+#define MC__ACQV_Line4_Dur                       (MCPARAMID)( 1269 << 14)
+#define MC__ACQV_Acq_Dur                         (MCPARAMID)( 1270 << 14)
+#define MC__ACQV_PreAcq_Dur                      (MCPARAMID)( 1271 << 14)
+#define MC__ACQV_Total_Dur                       (MCPARAMID)( 1272 << 14)
+#define MC_Camera_CS8530                          36
+#define MC_Manufacturer_TELI                      10
+#define MC_CamConfig_P48RG                        49
+#define MC_Camera_CS8531                          37
+#define MC_Camera_CS8531D                         38
+#define MC_CamConfig_P120SM                       50
+#define MC_CamConfig_P120RM_G                     51
+#define MC_CamConfig_P30RA_G                      52
+#define MC_CamConfig_P50RM                        53
+#define MC_CamConfig_P60RM                        54
+#define MC_CamConfig_P120RM                       55
+#define MC_CamConfig_P30RM                        56
+#define MC_ColorRegistration                     (MCPARAMID)( 1273 << 14)
+#define MC_ColorRegistration_GB                    1
+#define MC_ColorRegistration_BG                    2
+#define MC_ColorRegistration_RG                    3
+#define MC_ColorRegistration_GR                    4
+#define MC_ImageColorRegistration                (MCPARAMID)( 1274 << 14)
+#define MC_ImageColorRegistration_GB               1
+#define MC_ImageColorRegistration_BG               2
+#define MC_ImageColorRegistration_RG               3
+#define MC_ImageColorRegistration_GR               4
+#define MC__OffsetX0                             (MCPARAMID)( 1275 << 14)
+#define MC__OffsetY0                             (MCPARAMID)( 1276 << 14)
+#define MC_CamConfig_P30SD                        57
+#define MC_VdriveLine                            (MCPARAMID)( 1277 << 14)
+#define MC_VdriveLine_RST                          1
+#define MC_VdriveLine_EXP                          2
+#define MC_VdriveLine_GATE                         3
+#define MC_VdriveLine_HIO                          4
+#define MC_VdriveLine_VIO                          5
+#define MC_VdriveLine_DUAL                         6
+#define MC_HdriveLine                            (MCPARAMID)( 1278 << 14)
+#define MC_HdriveLine_RST                          1
+#define MC_HdriveLine_EXP                          2
+#define MC_HdriveLine_GATE                         3
+#define MC_HdriveLine_HIO                          4
+#define MC_HdriveLine_VIO                          5
+#define MC_HdriveLine_DUAL                         6
+#define MC__TrimmedExpose_us                     (MCPARAMID)( 1279 << 14)
+#define MC_PixelClkLine_NC                         2
+#define MC_ResetLine_NC                           11
+#define MC_AuxResetLine_NC                        11
+#define MC_VsyncLine_NC                            7
+#define MC_HsyncLine_NC                            7
+#define MC_VdriveLine_NC                           7
+#define MC_HdriveLine_NC                           7
+#define MC_Cable_A15_C12                          14
+#define MC_CableName_Triple_Channel_RG            12
+#define MC__CDU_CAL                              (MCPARAMID)( 1280 << 14)
+#define MC_Camera_SKCm141TC                       39
+#define MC_CamConfig_P10SA                        58
+#define MC_CamConfig_P10SM                        59
+#define MC_CamConfig_P10RM                        60
+#define MC_CamConfig_P10RA                        61
+#define MC_Manufacturer_IKEGAMI                   11
+#define MC_CableName_Triple_Channel_RGC_3         13
+#define MC__PinUsed                              (MCPARAMID)( 1281 << 14)
+#define MC_Camera_SKC_141TC                       40
+#define MC_Camera_CV_M50C                         41
+#define MC_CamConfig_I25SA                        62
+#define MC_CamConfig_P50                          63
+#define MC_CamConfig_P50SD                        64
+#define MC_CamConfig_P50RD                        65
+#define MC_CamConfig_P10SD                        66
+#define MC_CamConfig_P10RD                        67
+#define MC_CamConfig_P25RG                        68
+#define MC_CamConfig_P64RG                        69
+#define MC_CamConfig_P42RG                        70
+#define MC_CamConfig_P94RG                        71
+#define MC_Camera_STC_1000                        42
+#define MC_CamConfig_P60SD                        72
+#define MC_Manufacturer_SENTECH                   12
+#define MC__DIS_FALT                             (MCPARAMID)( 1282 << 14)
+#define MC__DIS_FALT_NORMAL                        1
+#define MC__DIS_FALT_ALTERNATE                     2
+#define MC__DIS_SPOL                             (MCPARAMID)( 1283 << 14)
+#define MC__DIS_SPOL_DIRECT                        1
+#define MC__DIS_SPOL_INVERT                        2
+#define MC__DIS_FPOL                             (MCPARAMID)( 1284 << 14)
+#define MC__DIS_FPOL_DIRECT                        1
+#define MC__DIS_FPOL_INVERT                        2
+#define MC__DIS_LPOL                             (MCPARAMID)( 1285 << 14)
+#define MC__DIS_LPOL_DIRECT                        1
+#define MC__DIS_LPOL_INVERT                        2
+#define MC__DIS_DPOL                             (MCPARAMID)( 1286 << 14)
+#define MC__DIS_DPOL_DIRECT                        1
+#define MC__DIS_DPOL_INVERT                        2
+#define MC__DRS_CPAR_NONE                          1
+#define MC__DRS_CPAR_LVAL_AFT                      2
+#define MC__DRS_CPAR_LVAL_BFR                      3
+#define MC__DRS_CPAR_SPARE_AFT                     4
+#define MC__DRS_CPAR_SPARE_BFR                     5
+#define MC__DRS_CSAP_ONNEXTFVAL                    1
+#define MC__DRS_CSAP_ONNEXTFVAL_PAR0               2
+#define MC__DRS_CSAP_ONNEXTFVAL_PAR1               3
+#define MC__DRS_CFLD_ONEFIELD                      1
+#define MC__DRS_CFLD_TWOFIELDS                     2
+#define MC__DRS_CACQ                             (MCPARAMID)( 1287 << 14)
+#define MC__DRS_CACQ_LINE                          1
+#define MC__DRS_CACQ_LINEandVALD                   2
+#define MC__DRS_CEOL                             (MCPARAMID)( 1288 << 14)
+#define MC__DRS_CEOL_DLAST                         1
+#define MC__DRS_CEOL_DSTOP                         2
+#define MC__DRS_CEOL_LVALE                         3
+#define MC__DRS_CEOL_DVALE                         4
+#define MC__DRS_CSOL                             (MCPARAMID)( 1289 << 14)
+#define MC__DRS_CSOL_LVALS                         1
+#define MC__DRS_CSOL_FVALSorLVALE                  2
+#define MC__DRS_CSOL_FVALSorDLAST                  3
+#define MC_Camera_NoCamera                        43
+#define MC_LvalMode_LN                             5
+#define MC_Camera_TMC_1000                        44
+#define MC_Camera_TMC_6700                        45
+#define MC_Camera_A501k                           46
+#define MC_CamConfig_P60SC                        73
+#define MC_CamConfig_P60RG                        74
+#define MC_CamConfig_P74SC                        75
+#define MC_CamConfig_P74RG                        76
+#define MC_Cable_CL_C03                           15
+#define MC_CableName_Pulnix_Adapter               14
+#define MC_Camera_XC_8500CE                       47
+#define MC_Cable_A15_C13                          16
+#define MC_CableName_Dual_Channel_RG_2_A          15
+#define MC_StrobeLine_Filter                     (MCPARAMID)( 1290 << 14)
+#define MC_StrobeLine_STZ                          6
+#define MC__CBA_GROUP4                           (MCPARAMID)( 1291 << 14)
+#define MC__STB_STB_x                            (MCPARAMID)( 1292 << 14)
+#define MC__STB_STB_x_FromCTL1_x                   1
+#define MC__STB_STB_x_FromCTL2_x                   2
+#define MC__STB_STB_x_FromXCTL2_x                  3
+#define MC__STB_Qx1SRC                           (MCPARAMID)( 1293 << 14)
+#define MC__STB_Qx1SRC_LOW                         1
+#define MC__STB_Qx1SRC_HIGH                        2
+#define MC__STB_Qx1SRC_FromSTB_X                   3
+#define MC__STB_Qx1SRC_FromSTB_X_Inverted          4
+#define MC__STB_x1STYL                           (MCPARAMID)( 1294 << 14)
+#define MC__STB_x1STYL_TTLIN                       1
+#define MC__STB_x1STYL_12VIN                       2
+#define MC__STB_x1STYL_TTLOUT                      3
+#define MC__STB_x1STYL_OCOUT                       4
+#define MC__STB_x1STYL_OEOUT                       5
+#define MC__STB_Qx2SRC                           (MCPARAMID)( 1295 << 14)
+#define MC__STB_Qx2SRC_LOW                         1
+#define MC__STB_Qx2SRC_HIGH                        2
+#define MC__STB_Qx2SRC_FromSTB_X                   3
+#define MC__STB_Qx2SRC_FromSTB_X_Inverted          4
+#define MC__STB_x2STYL                           (MCPARAMID)( 1296 << 14)
+#define MC__STB_x2STYL_TTLIN                       1
+#define MC__STB_x2STYL_12VIN                       2
+#define MC__STB_x2STYL_TTLOUT                      3
+#define MC__STB_x2STYL_OCOUT                       4
+#define MC__STB_x2STYL_OEOUT                       5
+#define MC__STR_STR_X                            (MCPARAMID)( 1297 << 14)
+#define MC__STR_STR_X_LOW                          1
+#define MC__STR_STR_X_HIGH                         2
+#define MC__STR_STR_X_FromSTB_X                    3
+#define MC__STR_STR_X_FromSTB_X_Inverted           4
+#define MC___StrobeStyle_Check                   (MCPARAMID)( 1298 << 14)
+#define MC___StrobeStyle_Check_PASS                1
+#define MC___StrobeStyle_Check_FAIL                2
+#define MC_STRUsage                              (MCPARAMID)( 1299 << 14)
+#define MC_STRUsage_FREE                           1
+#define MC_STRUsage_STROBE                         2
+#define MC_A1Usage                               (MCPARAMID)( 1300 << 14)
+#define MC_A1Usage_FREE                            1
+#define MC_A1Usage_STROBE                          2
+#define MC_A2Usage                               (MCPARAMID)( 1301 << 14)
+#define MC_A2Usage_FREE                            1
+#define MC_A2Usage_STROBE                          2
+#define MC_DefaultLoadSet                        (MCPARAMID)( 1302 << 14)
+#define MC__TRG_FTMOD                            (MCPARAMID)( 1303 << 14)
+#define MC__TRG_FTMOD_SKIP                         1
+#define MC__TRG_FTMOD_HOLD                         2
+#define MC__TRG_FTRES_FB                         (MCPARAMID)( 1304 << 14)
+#define MC__TRG_FTRES_FB_NO                        1
+#define MC__TRG_FTRES_FB_YES                       2
+#define MC__TRG_FTRES_T1                         (MCPARAMID)( 1305 << 14)
+#define MC__TRG_FTRES_T1_NO                        1
+#define MC__TRG_FTRES_T1_YES                       2
+#define MC__TRG_FTRES_T2                         (MCPARAMID)( 1306 << 14)
+#define MC__TRG_FTRES_T2_NO                        1
+#define MC__TRG_FTRES_T2_YES                       2
+#define MC__TRG_FTPOL_TE                         (MCPARAMID)( 1307 << 14)
+#define MC__TRG_FTPOL_TE_NONE                      1
+#define MC__TRG_FTPOL_TE_DIRECT                    2
+#define MC__TRG_FTPOL_TE_INVERT                    3
+#define MC__TRG_FTRIG_TE                         (MCPARAMID)( 1308 << 14)
+#define MC__TRG_FTRIG_TE_KEEP                      1
+#define MC__TRG_FTRIG_TE_FORCE                     2
+#define MC_Camera_STC_1100b                       48
+#define MC__DRS_CSOL_FVALSorEOL                    4
+#define MC_TriggerSkipHold                       (MCPARAMID)( 1309 << 14)
+#define MC_TriggerSkipHold_SKIP                    1
+#define MC_TriggerSkipHold_HOLD                    2
+#define MC_LineScanOnly_Filter                   (MCPARAMID)( 1310 << 14)
+#define MC_ExposeRecovery_us                     (MCPARAMID)( 1311 << 14)
+#define MC_ReadoutRecovery_us                    (MCPARAMID)( 1312 << 14)
+#define MC__EXPOffWidthForbid_10ns               (MCPARAMID)( 1313 << 14)
+#define MC__EXPOffWidth_T1                       (MCPARAMID)( 1314 << 14)
+#define MC__LineDur_ns                           (MCPARAMID)( 1315 << 14)
+#define MC__ReadoutDur_10ns                      (MCPARAMID)( 1316 << 14)
+#define MC_Cable_A15_C14                          17
+#define MC_CableName_Single_Channel_RGC_A         16
+#define MC__EXPOffWidth_10ns                     (MCPARAMID)( 1317 << 14)
+#define MC__MaxReadoutRate_Hz                    (MCPARAMID)( 1318 << 14)
+#define MC__MaxTriggerRate_Hz                    (MCPARAMID)( 1319 << 14)
+#define MC_CableName_Triple_Channel_RG_3          17
+#define MC___IOLoopBack                          (MCPARAMID)( 1320 << 14)
+#define MC___IOLoopBack_DISABLE                    1
+#define MC___IOLoopBack_ENABLE                     2
+#define MC_Camera_ICD_FA41                        49
+#define MC_CableName_Single_Channel_R_A           18
+#define MC_Camera_SKC_131                         50
+#define MC_CamConfig_P12SA                        77
+#define MC_CamConfig_P12SD                        78
+#define MC_CamConfig_P12RA                        79
+#define MC_Operation_LONG_EXPOSURE                 7
+#define MC__Vtotal_Ln                            (MCPARAMID)( 1321 << 14)
+#define MC_CamConfig_P50SM_L                      80
+#define MC__VLC_LCSNS                            (MCPARAMID)( 1322 << 14)
+#define MC__VLC_LCSNS_NORMAL                       1
+#define MC__VLC_LCSNS_SENSE                        2
+#define MC__VAC_VPOST                            (MCPARAMID)( 1323 << 14)
+#define MC__VAC_VPOST_FVALE_Post                   1
+#define MC__VAC_VPOST_FVALE_NoPost                 2
+#define MC__VAC_VPOST_LVALE_NoPost                 3
+#define MC__VAC_VPOST_LLAST_NoPost                 4
+#define MC__CTA_SELFLH                           (MCPARAMID)( 1324 << 14)
+#define MC__CTA_SELFLH_EOI                         1
+#define MC__CTA_SELFLH_EOL                         2
+#define MC_Camera_CV_A50C                         51
+#define MC_CamConfig_P25SM_L                      81
+#define MC_Camera_iMVS157                         52
+#define MC_Manufacturer_FASTCOM                   13
+#define MC_CC3Usage_READOUTALLOWED                 8
+#define MC_CC4Usage_TRIGGERALLOWED                 8
+#define MC__SCC_CC3_ACQUIREALLOWED                 9
+#define MC__SCC_CC3_ACQUIREALLOWEDn               10
+#define MC__SCC_CC4_TRIGGERALLOWED                 9
+#define MC__SCC_CC4_TRIGGERALLOWEDn               10
+#define MC__SCC_CC3_READOUTALLOWED                11
+#define MC__SCC_CC3_READOUTALLOWEDn               12
+#define MC__VactiveMax_Ln                        (MCPARAMID)( 1325 << 14)
+#define MC_Camera_TM_6702                         53
+#define MC_Cable_A15_C15                          19
+#define MC_CableName_Single_Ch                    19
+#define MC_CableName_Single_Channel_R_B           20
+#define MC_Camera_VCC_870                         54
+#define MC_CamConfig_P12SM                        82
+#define MC_CamConfig_P12RM                        83
+#define MC_Manufacturer_CIS                       14
+#define MC_AreaScanOnly_Filter                   (MCPARAMID)( 1326 << 14)
+#define MC_TrigCtl_ITTL                            5
+#define MC_TrigCtl_I12V                            6
+#define MC_TrigLine_TRG                            7
+#define MC_TrigLine_Filter                       (MCPARAMID)( 1327 << 14)
+#define MC_ColorMethod_TRILINEAR                   5
+#define MC_LineRateMode                          (MCPARAMID)( 1328 << 14)
+#define MC_LineRateMode_CAMERA                     1
+#define MC_LineRateMode_PERIOD                     2
+#define MC_LineRateMode_PULSE                      3
+#define MC_LineRateMode_CONVERT                    4
+#define MC_Period_us                             (MCPARAMID)( 1329 << 14)
+#define MC_PeriodTrim                            (MCPARAMID)( 1330 << 14)
+#define MC_LineTrigCtl                           (MCPARAMID)( 1331 << 14)
+#define MC_LineTrigCtl_ITTL                        1
+#define MC_LineTrigCtl_I12V                        2
+#define MC_LineTrigCtl_TTL                         3
+#define MC_LineTrigEdge                          (MCPARAMID)( 1332 << 14)
+#define MC_LineTrigEdge_GOHIGH                     1
+#define MC_LineTrigEdge_GOLOW                      2
+#define MC_LineTrigFilter                        (MCPARAMID)( 1333 << 14)
+#define MC_LineTrigFilter_OFF                      1
+#define MC_LineTrigFilter_MEDIUM                   2
+#define MC_LineTrigFilter_STRONG                   3
+#define MC_LineTrigLine                          (MCPARAMID)( 1334 << 14)
+#define MC_LineTrigLine_NOM                        1
+#define MC_LineTrigLine_TRG                        2
+#define MC_LineTrigLine_CAM                        3
+#define MC_ConverterTrim                         (MCPARAMID)( 1335 << 14)
+#define MC_MaxSpeed                              (MCPARAMID)( 1336 << 14)
+#define MC_MinSpeed                              (MCPARAMID)( 1337 << 14)
+#define MC__TRG_FTRES_EOF                        (MCPARAMID)( 1338 << 14)
+#define MC__TRG_FTRES_EOF_NO                       1
+#define MC__TRG_FTRES_EOF_YES                      2
+#define MC_MAN_GrabWindowY_Filter                (MCPARAMID)( 1339 << 14)
+#define MC_ImageFlipX                            (MCPARAMID)( 1340 << 14)
+#define MC_ImageFlipX_OFF                          1
+#define MC_CS3920_AsyncLoadSet                   (MCPARAMID)( 1341 << 14)
+#define MC__Expose_us                            (MCPARAMID)( 1342 << 14)
+#define MC_Camera_CS3920                          55
+#define MC_CamConfig_I7SA                         84
+#define MC_CamConfig_I7RA                         85
+#define MC_Cable_A15_C16                          21
+#define MC_CableName_Single_Channel_R_C           21
+#define MC__CTA_SELFLH_EOI_S                       3
+#define MC_Camera_CV_M4CL                         56
+#define MC_CamConfig_P24SC                        86
+#define MC_CamConfig_P24RG                        87
+#define MC_CamConfig_I15SA                        88
+#define MC_CamConfig_I15RA                        89
+#define MC__TrimmedExpose_10ns                   (MCPARAMID)( 1343 << 14)
+#define MC_Camera_CV_M50E                         57
+#define MC_CamConfig_P60SM_L                      90
+#define MC_CamConfig_I30SA                        91
+#define MC_Camera_CV_A50E                         58
+#define MC_CamConfig_P30SM_L                      92
+#define MC_Camera_CV_M7CL                         59
+#define MC_Camera_ICD_FA41E                       60
+#define MC_CamConfig_P25RA_G                      93
+#define MC_CamConfig_P50RA_G                      94
+#define MC_StrobeCtl_Filter                      (MCPARAMID)( 1344 << 14)
+#define MC_CamConfig_I60RA                        95
+#define MC_CamConfig_I120SA                       96
+#define MC_CamConfig_I120RA                       97
+#define MC__HDC_DCADV                            (MCPARAMID)( 1345 << 14)
+#define MC__HDC_DCADV_PERMANENT                    1
+#define MC__HDC_DCADV_VALD                         2
+#define MC_ImageFlipX_ON                           2
+#define MC_MaxLineRate_Hz                        (MCPARAMID)( 1346 << 14)
+#define MC_LineRateMode_Filter                   (MCPARAMID)( 1347 << 14)
+#define MC__T2Span_T2                            (MCPARAMID)( 1348 << 14)
+#define MC__PRM2_T2POS_1                         (MCPARAMID)( 1349 << 14)
+#define MC__PRM2_T2PLS1_1                        (MCPARAMID)( 1350 << 14)
+#define MC__PRM2_T2PLS2_1                        (MCPARAMID)( 1351 << 14)
+#define MC__PRM2_T2POS_2                         (MCPARAMID)( 1352 << 14)
+#define MC__PRM2_T2PLS1_2                        (MCPARAMID)( 1353 << 14)
+#define MC__PRM2_T2PLS2_2                        (MCPARAMID)( 1354 << 14)
+#define MC__PRM2_T2POS_3                         (MCPARAMID)( 1355 << 14)
+#define MC__PRM2_T2PLS1_3                        (MCPARAMID)( 1356 << 14)
+#define MC__PRM2_T2PLS2_3                        (MCPARAMID)( 1357 << 14)
+#define MC__PRM2_T2POS_4                         (MCPARAMID)( 1358 << 14)
+#define MC__PRM2_T2PLS1_4                        (MCPARAMID)( 1359 << 14)
+#define MC__PRM2_T2PLS2_4                        (MCPARAMID)( 1360 << 14)
+#define MC__PRM2_T2POS_5                         (MCPARAMID)( 1361 << 14)
+#define MC__PRM2_T2PLS1_5                        (MCPARAMID)( 1362 << 14)
+#define MC__PRM2_T2PLS2_5                        (MCPARAMID)( 1363 << 14)
+#define MC__STM2_T2SEL                           (MCPARAMID)( 1364 << 14)
+#define MC__STM2_T2SEL_OFF                         1
+#define MC__STM2_T2SEL_OnLTRIGS                    2
+#define MC__STM2_T2SEL_OnLTRIGE                    3
+#define MC__STM2_T2SEL_OnPPLS                      4
+#define MC__STM2_T2SEL_OnGO1                       5
+#define MC__STM2_T2SEL_OnEND2                      6
+#define MC__T2_10ns                              (MCPARAMID)( 1365 << 14)
+#define MC__ResetDur_T2                          (MCPARAMID)( 1366 << 14)
+#define MC__ReadoutDur_T2                        (MCPARAMID)( 1367 << 14)
+#define MC__ExposureController                   (MCPARAMID)( 1368 << 14)
+#define MC__ExposureController_CAMERA              1
+#define MC__ExposureController_GRABBER             2
+#define MC__Category_Timer1_Control               19
+#define MC__Category_Timer2_Control               20
+#define MC__TRG_LTPOL                            (MCPARAMID)( 1369 << 14)
+#define MC__TRG_LTPOL_NONE                         1
+#define MC__TRG_LTPOL_DIRECT                       2
+#define MC__TRG_LTPOL_INVERT                       3
+#define MC__TRG_LTFLT                            (MCPARAMID)( 1370 << 14)
+#define MC__TRG_LTFLT_NONE                         1
+#define MC__TRG_LTFLT_200ns                        2
+#define MC__TRG_LTFLT_3200ns                       3
+#define MC__TRG_LTSEL                            (MCPARAMID)( 1371 << 14)
+#define MC__TRG_LTSEL_DA1                          1
+#define MC__TRG_LTSEL_DA2                          2
+#define MC__TRG_LTSEL_CAMSIG                       3
+#define MC__TRG_LTSEL_TRG                          4
+#define MC_Encoder_Filter                        (MCPARAMID)( 1372 << 14)
+#define MC_LineTrigCtl_Filter                    (MCPARAMID)( 1373 << 14)
+#define MC_LineTrig_Filter                       (MCPARAMID)( 1374 << 14)
+#define MC_Period_Filter                         (MCPARAMID)( 1375 << 14)
+#define MC_Perio_Filter                          (MCPARAMID)( 1376 << 14)
+#define MC_A1Usage_TRIGGER                         3
+#define MC_A1Usage_LINETRIGGER                     4
+#define MC_A2Usage_TRIGGER                         3
+#define MC_A2Usage_LINETRIGGER                     4
+#define MC__TrigLineNeeded                       (MCPARAMID)( 1377 << 14)
+#define MC__TrigLineNeeded_NO                      1
+#define MC__TrigLineNeeded_YES                     2
+#define MC__TrigLine_NONE                          3
+#define MC__TrigLine_DA1                           4
+#define MC__TrigLine_DA2                           5
+#define MC__TrigLine_CAMSIG                        6
+#define MC__TrigLine_TRG                           7
+#define MC__LineTrigLineNeeded                   (MCPARAMID)( 1378 << 14)
+#define MC__LineTrigLineNeeded_NO                  1
+#define MC__LineTrigLineNeeded_YES                 2
+#define MC__LineTrigLine                         (MCPARAMID)( 1379 << 14)
+#define MC__LineTrigLine_NONE                      3
+#define MC__LineTrigLine_DA1                       4
+#define MC__LineTrigLine_CAMSIG                    5
+#define MC__LineTrigLine_TRG                       6
+#define MC__StrobeLine                           (MCPARAMID)( 1380 << 14)
+#define MC__StrobeLine_NONE                        1
+#define MC__StrobeLine_QA1                         2
+#define MC__StrobeLine_QA2                         3
+#define MC__StrobeLine_STR                         4
+#define MC__Category_System_IO                    21
+#define MC_TRGUsage                              (MCPARAMID)( 1381 << 14)
+#define MC_TRGUsage_FREE                           1
+#define MC_TRGUsage_TRIGGER                        2
+#define MC_TRGUsage_LINETRIGGER                    3
+#define MC_TrigCtl_Filter                        (MCPARAMID)( 1382 << 14)
+#define MC__TrimmedPeriod_10ns                   (MCPARAMID)( 1383 << 14)
+#define MC__PG_10ns                              (MCPARAMID)( 1384 << 14)
+#define MC__TrimmedK_1000                        (MCPARAMID)( 1385 << 14)
+#define MC__SP_Ideal                             (MCPARAMID)( 1386 << 14)
+#define MC_GrabField                             (MCPARAMID)( 1387 << 14)
+#define MC_NextGrabField                         (MCPARAMID)( 1388 << 14)
+#define MC__PM_Criteria                          (MCPARAMID)( 1389 << 14)
+#define MC__PM_Criteria_NORMAL                     1
+#define MC__PM_Criteria_WIDERANGE                  2
+#define MC__PM_Criteria_HIGHRESOLUTION             3
+#define MC__K_Criteria                           (MCPARAMID)( 1390 << 14)
+#define MC__K_Criteria_NORMAL                      1
+#define MC__K_Criteria_FASTUPDATE                  2
+#define MC__K_Criteria_HIGHRESOLUTION              3
+#define MC__Nmin                                 (MCPARAMID)( 1391 << 14)
+#define MC__Mmin                                 (MCPARAMID)( 1392 << 14)
+#define MC__PSClockFrequency_MHz                 (MCPARAMID)( 1393 << 14)
+#define MC__TrimmedPeriod_PSC                    (MCPARAMID)( 1394 << 14)
+#define MC__SP_Desired                           (MCPARAMID)( 1395 << 14)
+#define MC__TrimmedK_10000                       (MCPARAMID)( 1396 << 14)
+#define MC__SEmin_Desired                        (MCPARAMID)( 1397 << 14)
+#define MC__Keff_10000                           (MCPARAMID)( 1398 << 14)
+#define MC__CPM_PMSDIV_Update                    (MCPARAMID)( 1399 << 14)
+#define MC__CPG_PGCNT_Update                     (MCPARAMID)( 1400 << 14)
+#define MC__Vactive_Ln                           (MCPARAMID)( 1401 << 14)
+#define MC__VCsyncAft_Ln                         (MCPARAMID)( 1402 << 14)
+#define MC_GrabField_FLD                           1
+#define MC_GrabField_UP                            2
+#define MC_GrabField_DOWN                          3
+#define MC_GrabField_FRAME                         4
+#define MC_GrabField_UPDW                          5
+#define MC_GrabField_DWUP                          6
+#define MC_GrabField_NONE                          7
+#define MC_NextGrabField_FLD                       1
+#define MC_NextGrabField_UP                        2
+#define MC_NextGrabField_DOWN                      3
+#define MC_NextGrabField_FRAME                     4
+#define MC_NextGrabField_UPDW                      5
+#define MC_NextGrabField_DWUP                      6
+#define MC_NextGrabField_KEEP                      7
+#define MC_NextGrabField_SAME                      8
+#define MC_NextGrabField_CHANGE                    9
+#define MC_INTLoadSet                            (MCPARAMID)( 1403 << 14)
+#define MC_MaxSpeed_Max                          (MCPARAMID)( 1404 << 14)
+#define MC_MaxSpeed_Min                          (MCPARAMID)( 1405 << 14)
+#define MC__RateConverterControl                 (MCPARAMID)( 1406 << 14)
+#define MC__RateConverterControl_STANDARD          1
+#define MC__RateConverterControl_EXTENDED          2
+#define MC___Encoder_Check                       (MCPARAMID)( 1407 << 14)
+#define MC___Encoder_Check_PASS                    1
+#define MC___Encoder_Check_FAIL                    2
+#define MC__CPG_PGSCAL_Key                       (MCPARAMID)( 1408 << 14)
+#define MC__CPG_PGSCAL_Key_Top_Check             (MCPARAMID)( 1409 << 14)
+#define MC__CPG_PGSCAL_Key_Top_Check_PASS          1
+#define MC__CPG_PGSCAL_Key_Top_Check_FAIL          2
+#define MC__CPM_PMISCAL_Key                      (MCPARAMID)( 1410 << 14)
+#define MC__CPM_PMISCAL_Key_Top_Check            (MCPARAMID)( 1411 << 14)
+#define MC__CPM_PMISCAL_Key_Top_Check_PASS         1
+#define MC__CPM_PMISCAL_Key_Top_Check_FAIL         2
+#define MC__CPM_PMSDIV_Top_Check                 (MCPARAMID)( 1412 << 14)
+#define MC__CPM_PMSDIV_Top_Check_PASS              1
+#define MC__CPM_PMSDIV_Top_Check_FAIL              2
+#define MC__CPG_PGMOD                            (MCPARAMID)( 1413 << 14)
+#define MC__CPG_PGMOD_OFF                          1
+#define MC__CPG_PGMOD_FREE_RUN                     2
+#define MC__CPG_PGMOD_PM_CONTROLLED                3
+#define MC__CPM_PMISCAL                          (MCPARAMID)( 1414 << 14)
+#define MC__CPM_PMSDIV                           (MCPARAMID)( 1415 << 14)
+#define MC__CPG_PGCNT                            (MCPARAMID)( 1416 << 14)
+#define MC__CPG_PGSCAL                           (MCPARAMID)( 1417 << 14)
+#define MC__TrimmedK_10000_MAX                   (MCPARAMID)( 1418 << 14)
+#define MC__TrimmedK_10000_MIN                   (MCPARAMID)( 1419 << 14)
+#define MC__TrimmedKeff_10000                    (MCPARAMID)( 1420 << 14)
+#define MC_MaxSpeedEffective                     (MCPARAMID)( 1421 << 14)
+#define MC_MaxSpeed_Check_Key                    (MCPARAMID)( 1422 << 14)
+#define MC_MaxSpeed_Check                        (MCPARAMID)( 1423 << 14)
+#define MC_MaxSpeed_Check_PASS                     1
+#define MC_MaxSpeed_Check_FAIL                     2
+#define MC__TrimmedK_Check_Key                   (MCPARAMID)( 1424 << 14)
+#define MC__TrimmedK_Check                       (MCPARAMID)( 1425 << 14)
+#define MC__TrimmedK_Check_PASS                    1
+#define MC__TrimmedK_Check_FAIL                    2
+#define MC__SE_Factor_Key                        (MCPARAMID)( 1426 << 14)
+#define MC__SE_Factor_Key_Top_Check              (MCPARAMID)( 1427 << 14)
+#define MC__SE_Factor_Key_Top_Check_PASS           1
+#define MC__SE_Factor_Key_Top_Check_FAIL           2
+#define MC__SE_Factor                            (MCPARAMID)( 1428 << 14)
+#define MC__M_Ratio                              (MCPARAMID)( 1429 << 14)
+#define MC__M_Ratio_Top_Check                    (MCPARAMID)( 1430 << 14)
+#define MC__M_Ratio_Top_Check_PASS                 1
+#define MC__M_Ratio_Top_Check_FAIL                 2
+#define MC__SP_Factor_Key                        (MCPARAMID)( 1431 << 14)
+#define MC__SP_Factor_Key_Top_Check              (MCPARAMID)( 1432 << 14)
+#define MC__SP_Factor_Key_Top_Check_PASS           1
+#define MC__SP_Factor_Key_Top_Check_FAIL           2
+#define MC__SP_Factor                            (MCPARAMID)( 1433 << 14)
+#define MC_NextTrigMode_Filter                   (MCPARAMID)( 1434 << 14)
+#define MC_MinSpeed_Check                        (MCPARAMID)( 1435 << 14)
+#define MC_MinSpeed_Check_PASS                     1
+#define MC_MinSpeed_Check_FAIL                     2
+#define MC___Encoder_Warning_Check               (MCPARAMID)( 1436 << 14)
+#define MC___Encoder_Warning_Check_PASS            1
+#define MC___Encoder_Warning_Check_FAIL            2
+#define MC__EncoderMaxSpeed                      (MCPARAMID)( 1437 << 14)
+#define MC__EncoderMaxSpeed_Check                (MCPARAMID)( 1438 << 14)
+#define MC__EncoderMaxSpeed_Check_PASS             1
+#define MC__EncoderMaxSpeed_Check_FAIL             2
+#define MC__EncoderMinSpeed                      (MCPARAMID)( 1439 << 14)
+#define MC__EncoderMinSpeed_Check                (MCPARAMID)( 1440 << 14)
+#define MC__EncoderMinSpeed_Check_PASS             1
+#define MC__EncoderMinSpeed_Check_FAIL             2
+#define MC_X_VRSTMID                             (MCPARAMID)( 1441 << 14)
+#define MC__SYNC_Line1_Type_BLANK_VRSTMID          3
+#define MC__SYNC_Line4_Type_ACQ_VRSTMID            3
+#define MC__SYNC_Line5_Type_BLANK_VRSTMID          3
+#define MC__SYNC_Line6_Type                      (MCPARAMID)( 1442 << 14)
+#define MC__SYNC_Line6_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line6_Type_BLANK_VRSTON           2
+#define MC__SYNC_Line6_Type_BLANK_VRSTMID          3
+#define MC__SYNC_Line6_Dur                       (MCPARAMID)( 1443 << 14)
+#define MC__SYNC_Line7_Type                      (MCPARAMID)( 1444 << 14)
+#define MC__SYNC_Line7_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line7_Dur                       (MCPARAMID)( 1445 << 14)
+#define MC__SYNC_Line8_Type                      (MCPARAMID)( 1446 << 14)
+#define MC__SYNC_Line8_Type_ACQ_VRSTOFF            1
+#define MC__SYNC_Line8_Type_ACQ_VRSTON             2
+#define MC__SYNC_Line8_Type_ACQ_VRSTMID            3
+#define MC__SYNC_Line8_Dur                       (MCPARAMID)( 1447 << 14)
+#define MC__SYNC_Line9_Type                      (MCPARAMID)( 1448 << 14)
+#define MC__SYNC_Line9_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line9_Type_BLANK_VRSTON           2
+#define MC__SYNC_Line9_Type_BLANK_VRSTMID          3
+#define MC__SYNC_Line9_Dur                       (MCPARAMID)( 1449 << 14)
+#define MC__MID_Eacq2Vrst_Gap                    (MCPARAMID)( 1450 << 14)
+#define MC__MID_Vrst2Bacq_Gap                    (MCPARAMID)( 1451 << 14)
+#define MC__SYNC_Line10_Type                     (MCPARAMID)( 1452 << 14)
+#define MC__SYNC_Line10_Type_ACQ_VRSTOFF           1
+#define MC__SYNC_Line10_Dur                      (MCPARAMID)( 1453 << 14)
+#define MC_MATLoadSet                            (MCPARAMID)( 1454 << 14)
+#define MC__K_SP                                 (MCPARAMID)( 1455 << 14)
+#define MC__M_SP                                 (MCPARAMID)( 1456 << 14)
+#define MC__M_SP_10                              (MCPARAMID)( 1457 << 14)
+#define MC__TrimmedK_16384                       (MCPARAMID)( 1458 << 14)
+#define MC__K_SP_16384                           (MCPARAMID)( 1459 << 14)
+#define MC__TrimmedK_131072                      (MCPARAMID)( 1460 << 14)
+#define MC_VCSYNC1                               (MCPARAMID)( 1461 << 14)
+#define MC_VCSYNC2                               (MCPARAMID)( 1462 << 14)
+#define MC_BACK1                                 (MCPARAMID)( 1463 << 14)
+#define MC_BACK2                                 (MCPARAMID)( 1464 << 14)
+#define MC__VdriveDur_Ln                         (MCPARAMID)( 1465 << 14)
+#define MC__VdriveDly_Ln                         (MCPARAMID)( 1466 << 14)
+#define MC__L_16384                              (MCPARAMID)( 1467 << 14)
+#define MC__INT_Eacq2Vrst_Gap                    (MCPARAMID)( 1468 << 14)
+#define MC__INT_Vrst2Bacq_Gap                    (MCPARAMID)( 1469 << 14)
+#define MC__SYNC_Line4_Type_BLANK_VRSTMID          4
+#define MC__INITD1_SELV1                         (MCPARAMID)( 1470 << 14)
+#define MC__INT_BEFORE                           (MCPARAMID)( 1471 << 14)
+#define MC__INT_CHOIX                            (MCPARAMID)( 1472 << 14)
+#define MC__Equalization                         (MCPARAMID)( 1473 << 14)
+#define MC_TrigFilter_Filter                     (MCPARAMID)( 1474 << 14)
+#define MC__TRG_FTFLT_100ns                        4
+#define MC__TRG_FTFLT_500ns                        5
+#define MC__TRG_FTFLT_2500ns                       6
+#define MC_LineTrigFilter_Filter                 (MCPARAMID)( 1475 << 14)
+#define MC__TRG_LTFLT_100ns                        4
+#define MC__TRG_LTFLT_500ns                        5
+#define MC__TRG_LTFLT_2500ns                       6
+#define MC__STM1_T1CLK_EOL                         4
+#define MC__EquaCCIR                             (MCPARAMID)( 1476 << 14)
+#define MC_PageModeOnly_Filter                   (MCPARAMID)( 1477 << 14)
+#define MC_AllButWebMode_Filter                  (MCPARAMID)( 1478 << 14)
+#define MC__IndexField                           (MCPARAMID)( 1479 << 14)
+#define MC_Camera_LD3521PGx                       61
+#define MC_Camera_LD3522PGx                       62
+#define MC_Camera_LD3523PGx                       63
+#define MC_Camera_LD3541PGx                       64
+#define MC_Camera_LD3542PGx                       65
+#define MC_Camera_LD3543PGx                       66
+#define MC_Camera_L101k                           67
+#define MC_Camera_L103k                           68
+#define MC_Camera_L104k                           69
+#define MC_Camera_A301bc                          70
+#define MC_CamConfig_L512SP                       98
+#define MC_CamConfig_L1024SP                      99
+#define MC_CamConfig_L2048SP                     100
+#define MC_CamConfig_L1024RC                     101
+#define MC_CamConfig_L1024RG                     102
+#define MC_CamConfig_L2048RG                     103
+#define MC_CamConfig_L2048RC                     104
+#define MC_CamConfig_P80SC                       105
+#define MC_CamConfig_P80RG                       106
+#define MC_Manufacturer_PERKINELMER               15
+#define MC_Camera_L301bc                          71
+#define MC_CamConfig_L2098SP                     107
+#define MC_CamConfig_L2098RC                     108
+#define MC_CamConfig_L2098RG                     109
+#define MC_Camera_L401k                           72
+#define MC_Camera_L402k                           73
+#define MC_Camera_L403k                           74
+#define MC_CamConfig_L4096SP                     110
+#define MC_CamConfig_L4096RC                     111
+#define MC_CamConfig_L4096RG                     112
+#define MC_Camera_P2_2x_06k40                     75
+#define MC_Camera_P2_2x_08k40                     76
+#define MC_CamConfig_L6144SP                     113
+#define MC_CamConfig_L6144RC                     114
+#define MC_CamConfig_L6144RG                     115
+#define MC_CamConfig_L8192SP                     116
+#define MC_CamConfig_L8192RC                     117
+#define MC_CamConfig_L8192RG                     118
+#define MC_Manufacturer_DALSA                     16
+#define MC_CamConfig_L512RG                      119
+#define MC_Camera_AVIIVA                          77
+#define MC_CamConfig_L512RC                      120
+#define MC_Manufacturer_ATMEL                     17
+#define MC_Camera_P2_2x_01k40                     78
+#define MC_Camera_P2_2x_02k40                     79
+#define MC_Camera_P2_2x_04k40                     80
+#define MC_Camera_AVIIVA0514                      81
+#define MC_Camera_AVIIVA1014                      82
+#define MC_Camera_AVIIVA2014                      83
+#define MC_Camera_AVIIVA4010                      84
+#define MC_ChannelTopology_DUALXMID               10
+#define MC_FvalMode_LA                             5
+#define MC_LvalMode_DG                             6
+#define MC__DIS_LALT                             (MCPARAMID)( 1480 << 14)
+#define MC__DIS_LALT_NORMAL                        1
+#define MC__DIS_LALT_ALTERNATE                     2
+#define MC__DIS_DALT                             (MCPARAMID)( 1481 << 14)
+#define MC__DIS_DALT_NORMAL                        1
+#define MC__DIS_DALT_ALTERNATE                     2
+#define MC_Camera_TI_324A                         85
+#define MC_CamConfig_I60SM                       121
+#define MC_Manufacturer_NEC                       18
+#define MC_CamConfig_P400SM                      122
+#define MC_Camera_CV_A1                           86
+#define MC_CamConfig_P16SA                       123
+#define MC_CamConfig_P16RA                       124
+#define MC_CamConfig_P16RA_G                     125
+#define MC_CamConfig_P16SM                       126
+#define MC_CamConfig_P16RM                       127
+#define MC_CamConfig_P16RM_G                     128
+#define MC_CamConfig_P16SD                       129
+#define MC_CamConfig_P16RD                       130
+#define MC_CamConfig_P16RD_G                     131
+#define MC_Camera_CV_M77                          87
+#define MC_Cable_A15_C17                          22
+#define MC_CableName_Triple_Channel_RG_2          22
+#define MC_CamConfig_P10RG                       132
+#define MC_CamConfig_P10RC                       133
+#define MC__CDC_ISIZE_8BIT                         9
+#define MC__CDC_ISIZE_10BIT                       10
+#define MC__CDC_ISIZE_12BIT                       11
+#define MC__CDC_ISIZE_14BIT                       12
+#define MC__CDC_ISIZE_16BIT                       13
+#define MC__CDC_CLCFG                            (MCPARAMID)( 1482 << 14)
+#define MC__CDC_CLCFG_BASE                         1
+#define MC__CDC_CLCFG_MEDIUM                       2
+#define MC__CDC_MTAP                             (MCPARAMID)( 1483 << 14)
+#define MC__CDC_MTAP_ONETAP                        1
+#define MC__CDC_MTAP_TWOTAPS                       2
+#define MC__CDC_FSLIC                            (MCPARAMID)( 1484 << 14)
+#define MC__CBA_DCEN1                            (MCPARAMID)( 1485 << 14)
+#define MC__CBA_DCEN1_ENABLED                      1
+#define MC__CBA_DCEN1_DISABLED                     2
+#define MC__CBA_DCEN2                            (MCPARAMID)( 1486 << 14)
+#define MC__CBA_DCEN2_ENABLED                      1
+#define MC__CBA_DCEN2_DISABLED                     2
+#define MC__CBA_DCEN3                            (MCPARAMID)( 1487 << 14)
+#define MC__CBA_DCEN3_ENABLED                      1
+#define MC__CBA_DCEN3_DISABLED                     2
+#define MC__CDC_FSLIC_ONE256                       1
+#define MC__CDC_FSLIC_TWO128                       2
+#define MC__CDC_FSLIC_FOUR64                       3
+#define MC__CDC_FSLIC_EIGHT32                      4
+#define MC_TapStructure_TRIPLE_W2                 16
+#define MC__W1_INDEX                             (MCPARAMID)( 1488 << 14)
+#define MC__W2_INDEX                             (MCPARAMID)( 1489 << 14)
+#define MC__W3_INDEX                             (MCPARAMID)( 1490 << 14)
+#define MC__W4_INDEX                             (MCPARAMID)( 1491 << 14)
+#define MC__GCL_CLCFG                            (MCPARAMID)( 1492 << 14)
+#define MC__GCL_CLCFG_BASE                         1
+#define MC__GCL_CLCFG_MEDIUM                       2
+#define MC__AllAssyMask                          (MCPARAMID)( 1493 << 14)
+#define MC__UsedAssyMask                         (MCPARAMID)( 1494 << 14)
+#define MC_TrigLine_TRX                            8
+#define MC_TrigLine_TRY                            9
+#define MC_TrigLine_TRZ                           10
+#define MC__StrobeLine_QB1                         5
+#define MC__StrobeLine_QB2                         6
+#define MC__StrobeLine_STX                         7
+#define MC__StrobeLine_STY                         8
+#define MC__StrobeLine_STZ                         9
+#define MC_LineTrigLine_TRX                        4
+#define MC_LineTrigLine_TRY                        5
+#define MC_LineTrigLine_TRZ                        6
+#define MC__LineTrigLine_DB1                       7
+#define MC__LineTrigLine_TRX                       8
+#define MC__LineTrigLine_TRY                       9
+#define MC__LineTrigLine_TRZ                      10
+#define MC__TRG_LTSEL_DB1                          5
+#define MC__TRG_LTSEL_TRX                          6
+#define MC__TRG_LTSEL_TRY                          7
+#define MC__TRG_LTSEL_TRZ                          8
+#define MC_TRXUsage                              (MCPARAMID)( 1495 << 14)
+#define MC_TRXUsage_FREE                           1
+#define MC_TRXUsage_TRIGGER                        2
+#define MC_TRXUsage_LINETRIGGER                    3
+#define MC_TRYUsage                              (MCPARAMID)( 1496 << 14)
+#define MC_TRYUsage_FREE                           1
+#define MC_TRYUsage_TRIGGER                        2
+#define MC_TRYUsage_LINETRIGGER                    3
+#define MC_TRZUsage                              (MCPARAMID)( 1497 << 14)
+#define MC_TRZUsage_FREE                           1
+#define MC_TRZUsage_TRIGGER                        2
+#define MC_TRZUsage_LINETRIGGER                    3
+#define MC_STXUsage                              (MCPARAMID)( 1498 << 14)
+#define MC_STXUsage_FREE                           1
+#define MC_STXUsage_STROBEX                        2
+#define MC_STXUsage_STROBEY                        3
+#define MC_STYUsage                              (MCPARAMID)( 1499 << 14)
+#define MC_STYUsage_FREE                           1
+#define MC_STYUsage_STROBEX                        2
+#define MC_STYUsage_STROBEY                        3
+#define MC_STZUsage                              (MCPARAMID)( 1500 << 14)
+#define MC_STZUsage_FREE                           1
+#define MC_STZUsage_STROBEX                        2
+#define MC_STZUsage_STROBEY                        3
+#define MC_B1Usage                               (MCPARAMID)( 1501 << 14)
+#define MC_B1Usage_FREE                            1
+#define MC_B1Usage_STROBE                          2
+#define MC_B2Usage                               (MCPARAMID)( 1502 << 14)
+#define MC_B2Usage_FREE                            1
+#define MC_B2Usage_STROBE                          2
+#define MC__STR_STR_X_FromSTB_Y                    5
+#define MC__STR_STR_X_FromSTB_Y_Inverted           6
+#define MC__STR_STR_Y                            (MCPARAMID)( 1503 << 14)
+#define MC__STR_STR_Y_LOW                          1
+#define MC__STR_STR_Y_HIGH                         2
+#define MC__STR_STR_Y_FromSTB_X                    3
+#define MC__STR_STR_Y_FromSTB_X_Inverted           4
+#define MC__STR_STR_Y_FromSTB_Y                    5
+#define MC__STR_STR_Y_FromSTB_Y_Inverted           6
+#define MC__STR_STR_Z                            (MCPARAMID)( 1504 << 14)
+#define MC__STR_STR_Z_LOW                          1
+#define MC__STR_STR_Z_HIGH                         2
+#define MC__STR_STR_Z_FromSTB_X                    3
+#define MC__STR_STR_Z_FromSTB_X_Inverted           4
+#define MC__STR_STR_Z_FromSTB_Y                    5
+#define MC__STR_STR_Z_FromSTB_Y_Inverted           6
+#define MC__TrigLine_CAMSIGA                       8
+#define MC__TrigLine_DB1                           9
+#define MC__TrigLine_DB2                          10
+#define MC__TrigLine_CAMSIGB                      11
+#define MC__TrigLine_TRGX                         12
+#define MC__TrigLine_TRGY                         13
+#define MC__TrigLine_TRGZ                         14
+#define MC__TrigLine_TRX                          15
+#define MC__TrigLine_TRY                          16
+#define MC__TrigLine_TRZ                          17
+#define MC__TRG_FTSEL_D1                          10
+#define MC__TRG_FTSEL_D2                          11
+#define MC__TRG_FTSEL_TRX                         12
+#define MC__TRG_FTSEL_TRY                         13
+#define MC__TRG_FTSEL_TRZ                         14
+#define MC__LineTrigLine_CAMSIGA                  11
+#define MC__LineTrigLine_CAMSIGB                  12
+#define MC__TRG_LTSEL_D1                           9
+#define MC__TRG_LTSEL_D2                          10
+#define MC__CWR_SFA01                            (MCPARAMID)( 1505 << 14)
+#define MC__CWR_SFA11                            (MCPARAMID)( 1506 << 14)
+#define MC__CWR_SFA02                            (MCPARAMID)( 1507 << 14)
+#define MC__CWR_SFA12                            (MCPARAMID)( 1508 << 14)
+#define MC__CWR_SFA03                            (MCPARAMID)( 1509 << 14)
+#define MC__CWR_SFA13                            (MCPARAMID)( 1510 << 14)
+#define MC__CWR_SFA04                            (MCPARAMID)( 1511 << 14)
+#define MC__CWR_SFA14                            (MCPARAMID)( 1512 << 14)
+#define MC__STARTU4_mw                           (MCPARAMID)( 1513 << 14)
+#define MC__STARTD4_mw                           (MCPARAMID)( 1514 << 14)
+#define MC__DirX4                                (MCPARAMID)( 1515 << 14)
+#define MC__DirY4                                (MCPARAMID)( 1516 << 14)
+#define MC__CTA_STEPX4                           (MCPARAMID)( 1517 << 14)
+#define MC__CTA_STEPY4                           (MCPARAMID)( 1518 << 14)
+#define MC__CWR_WXP1                             (MCPARAMID)( 1519 << 14)
+#define MC__CWR_WXP2                             (MCPARAMID)( 1520 << 14)
+#define MC__CWR_WXP3                             (MCPARAMID)( 1521 << 14)
+#define MC__CWR_WXP4                             (MCPARAMID)( 1522 << 14)
+#define MC__CWR_NLA01                            (MCPARAMID)( 1523 << 14)
+#define MC__CWR_NLA11                            (MCPARAMID)( 1524 << 14)
+#define MC__CWR_NLA02                            (MCPARAMID)( 1525 << 14)
+#define MC__CWR_NLA12                            (MCPARAMID)( 1526 << 14)
+#define MC__CWR_NLA03                            (MCPARAMID)( 1527 << 14)
+#define MC__CWR_NLA13                            (MCPARAMID)( 1528 << 14)
+#define MC__CWR_NLA04                            (MCPARAMID)( 1529 << 14)
+#define MC__CWR_NLA14                            (MCPARAMID)( 1530 << 14)
+#define MC__CWR_NPA01                            (MCPARAMID)( 1531 << 14)
+#define MC__CWR_NPA11                            (MCPARAMID)( 1532 << 14)
+#define MC__CWR_NPA02                            (MCPARAMID)( 1533 << 14)
+#define MC__CWR_NPA12                            (MCPARAMID)( 1534 << 14)
+#define MC__CWR_NPA03                            (MCPARAMID)( 1535 << 14)
+#define MC__CWR_NPA13                            (MCPARAMID)( 1536 << 14)
+#define MC__CWR_NPA04                            (MCPARAMID)( 1537 << 14)
+#define MC__CWR_NPA14                            (MCPARAMID)( 1538 << 14)
+#define MC__CWR_WYP1                             (MCPARAMID)( 1539 << 14)
+#define MC__CWR_WYP2                             (MCPARAMID)( 1540 << 14)
+#define MC__CWR_WYP3                             (MCPARAMID)( 1541 << 14)
+#define MC__CWR_WYP4                             (MCPARAMID)( 1542 << 14)
+#define MC__PITCH4_mw                            (MCPARAMID)( 1543 << 14)
+#define MC_Connector_M                             8
+#define MC_Connector_A                             9
+#define MC_Connector_B                            10
+#define MC_ConnectLoc_BOTH                         4
+#define MC___Connector_Check                     (MCPARAMID)( 1544 << 14)
+#define MC___Connector_Check_PASS                  1
+#define MC___Connector_Check_FAIL                  2
+#define MC__CDC_TPG                              (MCPARAMID)( 1545 << 14)
+#define MC__CDC_TPG_ENABLE                         1
+#define MC__CDC_TPG_DISABLE                        2
+#define MC__ASSYE11                              (MCPARAMID)( 1546 << 14)
+#define MC__ASSYE12                              (MCPARAMID)( 1547 << 14)
+#define MC__ASSYE13                              (MCPARAMID)( 1548 << 14)
+#define MC__ASSYE14                              (MCPARAMID)( 1549 << 14)
+#define MC__ASSYE15                              (MCPARAMID)( 1550 << 14)
+#define MC__ASSYE16                              (MCPARAMID)( 1551 << 14)
+#define MC__ASSYE17                              (MCPARAMID)( 1552 << 14)
+#define MC__ASSYE18                              (MCPARAMID)( 1553 << 14)
+#define MC__ASSYE21                              (MCPARAMID)( 1554 << 14)
+#define MC__ASSYE22                              (MCPARAMID)( 1555 << 14)
+#define MC__ASSYE23                              (MCPARAMID)( 1556 << 14)
+#define MC__ASSYE24                              (MCPARAMID)( 1557 << 14)
+#define MC__ASSYE25                              (MCPARAMID)( 1558 << 14)
+#define MC__ASSYE26                              (MCPARAMID)( 1559 << 14)
+#define MC__ASSYE27                              (MCPARAMID)( 1560 << 14)
+#define MC__ASSYE28                              (MCPARAMID)( 1561 << 14)
+#define MC__ASSYE31                              (MCPARAMID)( 1562 << 14)
+#define MC__ASSYE32                              (MCPARAMID)( 1563 << 14)
+#define MC__ASSYE33                              (MCPARAMID)( 1564 << 14)
+#define MC__ASSYE34                              (MCPARAMID)( 1565 << 14)
+#define MC__ASSYE35                              (MCPARAMID)( 1566 << 14)
+#define MC__ASSYE36                              (MCPARAMID)( 1567 << 14)
+#define MC__ASSYE37                              (MCPARAMID)( 1568 << 14)
+#define MC__ASSYE38                              (MCPARAMID)( 1569 << 14)
+#define MC__ASSYE41                              (MCPARAMID)( 1570 << 14)
+#define MC__ASSYE42                              (MCPARAMID)( 1571 << 14)
+#define MC__ASSYE43                              (MCPARAMID)( 1572 << 14)
+#define MC__ASSYE44                              (MCPARAMID)( 1573 << 14)
+#define MC__ASSYE45                              (MCPARAMID)( 1574 << 14)
+#define MC__ASSYE46                              (MCPARAMID)( 1575 << 14)
+#define MC__ASSYE47                              (MCPARAMID)( 1576 << 14)
+#define MC__ASSYE48                              (MCPARAMID)( 1577 << 14)
+#define MC__ASSY41                               (MCPARAMID)( 1578 << 14)
+#define MC__ASSY42                               (MCPARAMID)( 1579 << 14)
+#define MC__ASSY43                               (MCPARAMID)( 1580 << 14)
+#define MC__ASSY44                               (MCPARAMID)( 1581 << 14)
+#define MC__ASSYE51                              (MCPARAMID)( 1582 << 14)
+#define MC__ASSYE52                              (MCPARAMID)( 1583 << 14)
+#define MC__ASSYE53                              (MCPARAMID)( 1584 << 14)
+#define MC__ASSYE54                              (MCPARAMID)( 1585 << 14)
+#define MC__ASSYE55                              (MCPARAMID)( 1586 << 14)
+#define MC__ASSYE56                              (MCPARAMID)( 1587 << 14)
+#define MC__ASSYE57                              (MCPARAMID)( 1588 << 14)
+#define MC__ASSYE58                              (MCPARAMID)( 1589 << 14)
+#define MC__ASSYE61                              (MCPARAMID)( 1590 << 14)
+#define MC__ASSYE62                              (MCPARAMID)( 1591 << 14)
+#define MC__ASSYE63                              (MCPARAMID)( 1592 << 14)
+#define MC__ASSYE64                              (MCPARAMID)( 1593 << 14)
+#define MC__ASSYE65                              (MCPARAMID)( 1594 << 14)
+#define MC__ASSYE66                              (MCPARAMID)( 1595 << 14)
+#define MC__ASSYE67                              (MCPARAMID)( 1596 << 14)
+#define MC__ASSYE68                              (MCPARAMID)( 1597 << 14)
+#define MC__ASSYE71                              (MCPARAMID)( 1598 << 14)
+#define MC__ASSYE72                              (MCPARAMID)( 1599 << 14)
+#define MC__ASSYE73                              (MCPARAMID)( 1600 << 14)
+#define MC__ASSYE74                              (MCPARAMID)( 1601 << 14)
+#define MC__ASSYE75                              (MCPARAMID)( 1602 << 14)
+#define MC__ASSYE76                              (MCPARAMID)( 1603 << 14)
+#define MC__ASSYE77                              (MCPARAMID)( 1604 << 14)
+#define MC__ASSYE78                              (MCPARAMID)( 1605 << 14)
+#define MC__ASSYE81                              (MCPARAMID)( 1606 << 14)
+#define MC__ASSYE82                              (MCPARAMID)( 1607 << 14)
+#define MC__ASSYE83                              (MCPARAMID)( 1608 << 14)
+#define MC__ASSYE84                              (MCPARAMID)( 1609 << 14)
+#define MC__ASSYE85                              (MCPARAMID)( 1610 << 14)
+#define MC__ASSYE86                              (MCPARAMID)( 1611 << 14)
+#define MC__ASSYE87                              (MCPARAMID)( 1612 << 14)
+#define MC__ASSYE88                              (MCPARAMID)( 1613 << 14)
+#define MC__AllMyAssyMask                        (MCPARAMID)( 1614 << 14)
+#define MC__c_INDEX                              (MCPARAMID)( 1615 << 14)
+#define MC__D5_INDEX                             (MCPARAMID)( 1616 << 14)
+#define MC__D6_INDEX                             (MCPARAMID)( 1617 << 14)
+#define MC__D7_INDEX                             (MCPARAMID)( 1618 << 14)
+#define MC__D8_INDEX                             (MCPARAMID)( 1619 << 14)
+#define MC__W5_INDEX                             (MCPARAMID)( 1620 << 14)
+#define MC__W6_INDEX                             (MCPARAMID)( 1621 << 14)
+#define MC__W7_INDEX                             (MCPARAMID)( 1622 << 14)
+#define MC__W8_INDEX                             (MCPARAMID)( 1623 << 14)
+#define MC__CWR_SFA05                            (MCPARAMID)( 1624 << 14)
+#define MC__CWR_SFA06                            (MCPARAMID)( 1625 << 14)
+#define MC__CWR_SFA07                            (MCPARAMID)( 1626 << 14)
+#define MC__CWR_SFA08                            (MCPARAMID)( 1627 << 14)
+#define MC__CWR_NLA05                            (MCPARAMID)( 1628 << 14)
+#define MC__CWR_NLA06                            (MCPARAMID)( 1629 << 14)
+#define MC__CWR_NLA07                            (MCPARAMID)( 1630 << 14)
+#define MC__CWR_NLA08                            (MCPARAMID)( 1631 << 14)
+#define MC__CWR_WYP5                             (MCPARAMID)( 1632 << 14)
+#define MC__CWR_WYP6                             (MCPARAMID)( 1633 << 14)
+#define MC__CWR_WYP7                             (MCPARAMID)( 1634 << 14)
+#define MC__CWR_WYP8                             (MCPARAMID)( 1635 << 14)
+#define MC__PITCH5_mw                            (MCPARAMID)( 1636 << 14)
+#define MC__PITCH6_mw                            (MCPARAMID)( 1637 << 14)
+#define MC__PITCH7_mw                            (MCPARAMID)( 1638 << 14)
+#define MC__PITCH8_mw                            (MCPARAMID)( 1639 << 14)
+#define MC__STARTU5_mw                           (MCPARAMID)( 1640 << 14)
+#define MC__STARTU6_mw                           (MCPARAMID)( 1641 << 14)
+#define MC__STARTU7_mw                           (MCPARAMID)( 1642 << 14)
+#define MC__STARTU8_mw                           (MCPARAMID)( 1643 << 14)
+#define MC__DirX5                                (MCPARAMID)( 1644 << 14)
+#define MC__DirX6                                (MCPARAMID)( 1645 << 14)
+#define MC__DirX7                                (MCPARAMID)( 1646 << 14)
+#define MC__DirX8                                (MCPARAMID)( 1647 << 14)
+#define MC__DirY5                                (MCPARAMID)( 1648 << 14)
+#define MC__DirY6                                (MCPARAMID)( 1649 << 14)
+#define MC__DirY7                                (MCPARAMID)( 1650 << 14)
+#define MC__DirY8                                (MCPARAMID)( 1651 << 14)
+#define MC__CWR_NPA05                            (MCPARAMID)( 1652 << 14)
+#define MC__CWR_NPA06                            (MCPARAMID)( 1653 << 14)
+#define MC__CWR_NPA07                            (MCPARAMID)( 1654 << 14)
+#define MC__CWR_NPA08                            (MCPARAMID)( 1655 << 14)
+#define MC__CWR_WXP5                             (MCPARAMID)( 1656 << 14)
+#define MC__CWR_WXP6                             (MCPARAMID)( 1657 << 14)
+#define MC__CWR_WXP7                             (MCPARAMID)( 1658 << 14)
+#define MC__CWR_WXP8                             (MCPARAMID)( 1659 << 14)
+#define MC__CBA_PSHIFT5                          (MCPARAMID)( 1660 << 14)
+#define MC__CBA_PSHIFT6                          (MCPARAMID)( 1661 << 14)
+#define MC__CBA_PSHIFT7                          (MCPARAMID)( 1662 << 14)
+#define MC__CBA_PSHIFT8                          (MCPARAMID)( 1663 << 14)
+#define MC__PSHIFT                               (MCPARAMID)( 1664 << 14)
+#define MC__MTAP                                 (MCPARAMID)( 1665 << 14)
+#define MC_ChannelTopology_OCTALXTAP              11
+#define MC__ASSY_EIGHT                             5
+#define MC__WIC_EIGHT                              5
+#define MC_Camera_XC_ST50CE                       88
+#define MC_CamConfig_I50SM                       134
+#define MC_Camera_CS8550D                         89
+#define MC_CamConfig_I120SM                      135
+#define MC_Cable_A15_C18                          23
+#define MC_CableName_Single_Channel_RGC_B         23
+#define MC__W_STEP                               (MCPARAMID)( 1666 << 14)
+#define MC__WSTEP                                (MCPARAMID)( 1667 << 14)
+#define MC__FBL_FBLIMIT                          (MCPARAMID)( 1668 << 14)
+#define MC__FBSIZE                               (MCPARAMID)( 1669 << 14)
+#define MC_Camera_L301kc                          90
+#define MC_Camera_XC_ST70CE                       91
+#define MC_ChannelTopology_QUADXPAIRTAP           12
+#define MC_ChannelTopology_QUADXPAIREND           13
+#define MC_ChannelTopology_QUADXPAIRMID           14
+#define MC__Live                                 (MCPARAMID)( 1670 << 14)
+#define MC__CPHASE1                              (MCPARAMID)( 1671 << 14)
+#define MC__CPHASE2                              (MCPARAMID)( 1672 << 14)
+#define MC__CPHASE3                              (MCPARAMID)( 1673 << 14)
+#define MC__CPHASE4                              (MCPARAMID)( 1674 << 14)
+#define MC__CPHASE5                              (MCPARAMID)( 1675 << 14)
+#define MC__CPHASE6                              (MCPARAMID)( 1676 << 14)
+#define MC__CPHASE7                              (MCPARAMID)( 1677 << 14)
+#define MC__CPHASE8                              (MCPARAMID)( 1678 << 14)
+#define MC_TapStructure_QUAD_W2                   17
+#define MC__WMAX                                 (MCPARAMID)( 1679 << 14)
+#define MC__D1_WINDEX                            (MCPARAMID)( 1680 << 14)
+#define MC__D2_WINDEX                            (MCPARAMID)( 1681 << 14)
+#define MC__D3_WINDEX                            (MCPARAMID)( 1682 << 14)
+#define MC__D4_WINDEX                            (MCPARAMID)( 1683 << 14)
+#define MC__D5_WINDEX                            (MCPARAMID)( 1684 << 14)
+#define MC__D6_WINDEX                            (MCPARAMID)( 1685 << 14)
+#define MC__D7_WINDEX                            (MCPARAMID)( 1686 << 14)
+#define MC__D8_XINDEX                            (MCPARAMID)( 1687 << 14)
+#define MC__D8_WINDEX                            (MCPARAMID)( 1688 << 14)
+#define MC__VLC_OVRALIGN                         (MCPARAMID)( 1689 << 14)
+#define MC__VLC_OVRALIGN_ONELINE                   1
+#define MC__VLC_OVRALIGN_SIXTEENLINES              2
+#define MC_Camera_P2_4x_06k40                     92
+#define MC_Camera_P2_4x_04k40                     93
+#define MC_Camera_P2_4x_08k40                     94
+#define MC__Category_Board_Selection              22
+#define MC__Category_Input_Output_Control         23
+#define MC_InputConfig___17                      (MCPARAMID)( 1690 << 14)
+#define MC_InputFunction___17                    (MCPARAMID)( 1691 << 14)
+#define MC_InputState___17                       (MCPARAMID)( 1692 << 14)
+#define MC_InputStyle___17                       (MCPARAMID)( 1693 << 14)
+#define MC_OutputConfig___17                     (MCPARAMID)( 1694 << 14)
+#define MC_OutputFunction___17                   (MCPARAMID)( 1695 << 14)
+#define MC_OutputState___17                      (MCPARAMID)( 1696 << 14)
+#define MC_OutputStyle___17                      (MCPARAMID)( 1697 << 14)
+#define MC_InputOwner___17                       (MCPARAMID)( 1698 << 14)
+#define MC_OutputOwner___17                      (MCPARAMID)( 1699 << 14)
+#define MC_Camera_A102k                           95
+#define MC_TimUnitN_PLL                          (MCPARAMID)( 1700 << 14)
+#define MC_TimUnitN_PLL_NONE                       1
+#define MC_TimUnitN_PLL_NEEDED                     2
+#define MC_TimUnitN_DetV                         (MCPARAMID)( 1701 << 14)
+#define MC_TimUnitN_DetV_NONE                      1
+#define MC_TimUnitN_DetV_NEEDED                    2
+#define MC_TimUnitN_DetP                         (MCPARAMID)( 1702 << 14)
+#define MC_TimUnitN_DetP_NONE                      1
+#define MC_TimUnitN_DetP_NEEDED                    2
+#define MC_TimUnitN_ClockSynth                   (MCPARAMID)( 1703 << 14)
+#define MC_TimUnitN_ClockSynth_NONE                1
+#define MC_TimUnitN_ClockSynth_NEEDED              2
+#define MC_TimUnitNUsage                         (MCPARAMID)( 1704 << 14)
+#define MC_TimUnitNUsage_UNUSED                    1
+#define MC_TimUnitNUsage_EXCLUSIVE                 2
+#define MC_TimUnitNUsage_SHARED                    3
+#define MC__TRG_FTPOL                            (MCPARAMID)( 1705 << 14)
+#define MC__TRG_FTPOL_DIRECT                       4
+#define MC__TRG_FTPOL_INVERT                       5
+#define MC__TRG_FFTA                             (MCPARAMID)( 1706 << 14)
+#define MC__TRG_FFTA_YES                           1
+#define MC__TRG_FFTA_NO                            2
+#define MC__TRG_NFTA                             (MCPARAMID)( 1707 << 14)
+#define MC__TRG_NFTA_YES                           1
+#define MC__TRG_NFTA_NO                            2
+#define MC__TRG_FTSS                             (MCPARAMID)( 1708 << 14)
+#define MC__TRG_FTSS_YES                           1
+#define MC__TRG_FTSS_NO                            2
+#define MC_CamConfig_P60RD_G                     136
+#define MC__BoardType__STREAM                      5
+#define MC__BoardType__CLASSIC                     6
+#define MC_MY_PARAMETER                          (MCPARAMID)( 1709 << 14)
+#define MC_MY_PARAMETER_YES                        1
+#define MC_MY_PARAMETER_NO                         2
+#define MC_Camera_TM_9701                         96
+#define MC_Cable_A15_C19                          24
+#define MC_CableName_Single_Channel_R_D           24
+#define MC_Camera_KP_F2B                          97
+#define MC_Camera_DT4100                          98
+#define MC_CamConfig_P10SC                       137
+#define MC_Manufacturer_DUNCANTECH                19
+#define MC_Camera_SKC_141                         99
+#define MC_CamConfig_P15SA                       138
+#define MC_CamConfig_P15SM                       139
+#define MC_CamConfig_P15RA                       140
+#define MC_CamConfig_P15RM                       141
+#define MC_CamConfig_P15SD                       142
+#define MC_CamConfig_P15RD                       143
+#define MC_Camera_XC_7500                        100
+#define MC__VerticalSyncMode_MASTER_V              4
+#define MC__VerticalSyncMode_MASTER_R              5
+#define MC__VerticalSyncMode_MASTER_A              6
+#define MC__VerticalSyncMode_FAIL                  7
+#define MC___VerticalSyncMode_Check              (MCPARAMID)( 1710 << 14)
+#define MC___VerticalSyncMode_Check_PASS           1
+#define MC___VerticalSyncMode_Check_FAIL           2
+#define MC_CamConfig_P60RM_R                     144
+#define MC_Camera_Std_BW_CCIR                    101
+#define MC_Camera_Std_BW_EIA                     102
+#define MC_Camera_Std_RGB_CCIR                   103
+#define MC_Camera_Std_RGB_EIA                    104
+#define MC_Manufacturer_STANDARD_CAMERAS          20
+#define MC_Camera_KP_M32P                        105
+#define MC_Camera_CV_M7CLp                       106
+#define MC__MSP                                  (MCPARAMID)( 1711 << 14)
+#define MC__MSP_100                              (MCPARAMID)( 1712 << 14)
+#define MC_Camera_XC_ST50                        107
+#define MC_ColorStorage                          (MCPARAMID)( 1713 << 14)
+#define MC_ColorStorage_PACKED                     1
+#define MC_Expose_Fld                            (MCPARAMID)( 1714 << 14)
+#define MC__STR_STR_X_HOLD                         7
+#define MC__STR_STR_Y_HOLD                         7
+#define MC__STR_STR_Z_HOLD                         7
+#define MC_Camera_InterlaceFR                    108
+#define MC_Camera_ProgressiveFR                  109
+#define MC_Camera_LongExposeFR                   110
+#define MC_Camera_GrabberExposeAR                111
+#define MC_Camera_CameraExposeAR                 112
+#define MC_CamConfig_IxxSA                       145
+#define MC_CamConfig_IxxSM                       146
+#define MC_CamConfig_PxxSA                       147
+#define MC_CamConfig_PxxSD                       148
+#define MC_CamConfig_PxxSM                       149
+#define MC_CamConfig_IxxSM_L                     150
+#define MC_CamConfig_PxxSM_L                     151
+#define MC_CamConfig_PxxRA                       152
+#define MC_CamConfig_PxxRA_D                     153
+#define MC_CamConfig_PxxRA_M                     154
+#define MC_CamConfig_PxxRD                       155
+#define MC_CamConfig_PxxRM_A                     156
+#define MC_CamConfig_PxxRM_D                     157
+#define MC_CamConfig_PxxRM_1                     158
+#define MC_CamConfig_PxxRM_2                     159
+#define MC_Cable_A15_C00                          25
+#define MC_CableName_My_Cable                     25
+#define MC_VSyncMode                             (MCPARAMID)( 1715 << 14)
+#define MC_VSyncMode_UNKNOWN                       1
+#define MC_VSyncMode_MASTER                        2
+#define MC_VSyncMode_ANALOG                        3
+#define MC_VSyncMode_DIGITAL                       4
+#define MC___Individual_Check                    (MCPARAMID)( 1716 << 14)
+#define MC___Individual_Check_PASS                 1
+#define MC___Individual_Check_FAIL                 2
+#define MC_Camera_1600m                          113
+#define MC_CamConfig_P33SC                       160
+#define MC_CamConfig_P33RG                       161
+#define MC__DRS_PPOL                             (MCPARAMID)( 1717 << 14)
+#define MC__DRS_PPOL_DIRECT                        1
+#define MC__DRS_PPOL_INVERT                        2
+#define MC_ColorStorage_PLANAR                     2
+#define MC_ImagePlaneCount                       (MCPARAMID)( 1718 << 14)
+#define MC_FifoOrdering                          (MCPARAMID)( 1719 << 14)
+#define MC_FifoOrdering_PROGRESSIVE                1
+#define MC_FifoOrdering_INTERLACEDFIELD            2
+#define MC_FifoOrdering_DUALYEND                   3
+#define MC__DRS_PSRC                             (MCPARAMID)( 1720 << 14)
+#define MC__DRS_PSRC_SPARE                         1
+#define MC__DRS_PSRC_LVAL                          2
+#define MC__DRS_PSRC_DVAL                          3
+#define MC__DRS_PPOL_NONE                          3
+#define MC_ParityDetection                       (MCPARAMID)( 1721 << 14)
+#define MC_ParityDetection_NONE                    1
+#define MC_ParityDetection_FI_SPARE                2
+#define MC_ParityDetection_FI_SPARE_INV            3
+#define MC_ParityDetection_FIXEDFRAME              4
+#define MC_ParityDetection_FIXEDFRAME_INV          5
+#define MC__DRS_PSRC_NONE                          4
+#define MC_ParityDetection_FI_LVAL                 6
+#define MC_ParityDetection_FI_LVAL_INV             7
+#define MC_ParityDetection_FI_DVAL                 8
+#define MC_ParityDetection_FI_DVAL_INV             9
+#define MC__Category_Cluster                      24
+#define MC_GrabField_Filter                      (MCPARAMID)( 1722 << 14)
+#define MC__SSC_HR70                               6
+#define MC_Camera_XC_HR70                        114
+#define MC_CamConfig_P30RM_2                     162
+#define MC_CamConfig_P30RA_D                     163
+#define MC_PixelBurst                            (MCPARAMID)( 1723 << 14)
+#define MC_FifoSizeX                             (MCPARAMID)( 1724 << 14)
+#define MC_FifoSizeY                             (MCPARAMID)( 1725 << 14)
+#define MC_ImageSizingX                          (MCPARAMID)( 1726 << 14)
+#define MC_ImageSizingX_FIXED                      1
+#define MC_ImageSizingY                          (MCPARAMID)( 1727 << 14)
+#define MC_ImageSizingY_FIXED                      1
+#define MC_ImageSizingY_VARIABLE                   2
+#define MC_CamConfig_P60RA_D                     164
+#define MC_CamConfig_P60RM_D                     165
+#define MC_CamConfig_P120RM_D                    166
+#define MC_CamConfig_P106RM_D                    167
+#define MC_CableName_Single_Channel_RG            26
+#define MC__CWI_CWI                              (MCPARAMID)( 1728 << 14)
+#define MC_CamConfig_P106SM                      168
+#define MC__BoardType__ALPHA_cPCI                  7
+#define MC__BoardType__ALPHA_EV                    8
+#define MC__AssyType                             (MCPARAMID)( 1729 << 14)
+#define MC__AssyType__ALPHA                        1
+#define MC__AssyType__GAMMA                        2
+#define MC_GrabberConfig_0_0_1_1                   8
+#define MC_GrabberConfig_0_1_1_0                   9
+#define MC_GrabberConfig_1_0_0_1                  10
+#define MC_GrabberConfig_1_1_0_0                  11
+#define MC_MapTimCon_TXYXY                         9
+#define MC_Connector_CAM0                         11
+#define MC_Connector_CAM1                         12
+#define MC_Connector_CAM2                         13
+#define MC_Connector_CAM3                         14
+#define MC_ConnectLoc_RIGHTMOST                    5
+#define MC_ConnectLoc_MIDDLERIGHT                  6
+#define MC_ConnectLoc_MIDDLELEFT                   7
+#define MC_ConnectLoc_LEFTMOST                     8
+#define MC_TimUnit_DetP                          (MCPARAMID)( 1730 << 14)
+#define MC_TimUnit_DetP_NONE                       1
+#define MC_TimUnit_DetP_NEEDED                     2
+#define MC_TimUnit_PLL                           (MCPARAMID)( 1731 << 14)
+#define MC_TimUnit_PLL_NONE                        1
+#define MC_TimUnit_PLL_NEEDED                      2
+#define MC_TimUnit_DetV                          (MCPARAMID)( 1732 << 14)
+#define MC_TimUnit_DetV_NONE                       1
+#define MC_TimUnit_DetV_NEEDED                     2
+#define MC_Camera_TM_6710CL                      115
+#define MC_CamConfig_P120SC                      169
+#define MC_CamConfig_P120RG                      170
+#define MC_InputConfig                           (MCPARAMID)( 1733 << 14)
+#define MC_InputConfig_SOFT                        1
+#define MC_InputConfig_FREE                        2
+#define MC_InputFunction                         (MCPARAMID)( 1734 << 14)
+#define MC_InputState                            (MCPARAMID)( 1735 << 14)
+#define MC_InputStyle                            (MCPARAMID)( 1736 << 14)
+#define MC_NullSet_Enum_Filter                   (MCPARAMID)( 1737 << 14)
+#define MC_InputStyle_TTL_Only_Filter            (MCPARAMID)( 1738 << 14)
+#define MC_InputStyle_InsulatedIO_Filter         (MCPARAMID)( 1739 << 14)
+#define MC_OutputConfig                          (MCPARAMID)( 1740 << 14)
+#define MC_OutputFunction                        (MCPARAMID)( 1741 << 14)
+#define MC_OutputState                           (MCPARAMID)( 1742 << 14)
+#define MC_OutputState_NONE_Only_Filter          (MCPARAMID)( 1743 << 14)
+#define MC_FullSet_Enum_Filter                   (MCPARAMID)( 1744 << 14)
+#define MC_OutputState_STX                       (MCPARAMID)( 1745 << 14)
+#define MC_OutputState_STX_HOLD                    1
+#define MC_OutputState_STX_LOW                     2
+#define MC_OutputState_STX_HIGH                    3
+#define MC_OutputState_STY                       (MCPARAMID)( 1746 << 14)
+#define MC_OutputState_STY_HOLD                    1
+#define MC_OutputState_STY_LOW                     2
+#define MC_OutputState_STY_HIGH                    3
+#define MC_OutputState_STZ                       (MCPARAMID)( 1747 << 14)
+#define MC_OutputState_STZ_HOLD                    1
+#define MC_OutputState_STZ_LOW                     2
+#define MC_OutputState_STZ_HIGH                    3
+#define MC_OutputStyle                           (MCPARAMID)( 1748 << 14)
+#define MC_OutputStyle_TTL_Only_Filter           (MCPARAMID)( 1749 << 14)
+#define MC_OutputStyle_InsulatedIO_Filter        (MCPARAMID)( 1750 << 14)
+#define MC_OutputState_OUT1                      (MCPARAMID)( 1751 << 14)
+#define MC_OutputState_OUT1_HOLD                   1
+#define MC_OutputState_OUT1_LOW                    2
+#define MC_OutputState_OUT1_HIGH                   3
+#define MC_OutputState_OUT2                      (MCPARAMID)( 1752 << 14)
+#define MC_OutputState_OUT2_HOLD                   1
+#define MC_OutputState_OUT2_LOW                    2
+#define MC_OutputState_OUT2_HIGH                   3
+#define MC_OutputState_OUT3                      (MCPARAMID)( 1753 << 14)
+#define MC_OutputState_OUT3_HOLD                   1
+#define MC_OutputState_OUT3_LOW                    2
+#define MC_OutputState_OUT3_HIGH                   3
+#define MC_OutputState_OUT4                      (MCPARAMID)( 1754 << 14)
+#define MC_OutputState_OUT4_HOLD                   1
+#define MC_OutputState_OUT4_LOW                    2
+#define MC_OutputState_OUT4_HIGH                   3
+#define MC_OutputState_STR_X                     (MCPARAMID)( 1755 << 14)
+#define MC_OutputState_STR_X_HOLD                  1
+#define MC_OutputState_STR_X_LOW                   2
+#define MC_OutputState_STR_X_HIGH                  3
+#define MC_OutputState_InsulatedIO_Filter        (MCPARAMID)( 1756 << 14)
+#define MC_OutputState_A1                        (MCPARAMID)( 1757 << 14)
+#define MC_OutputState_A1_HOLD                     1
+#define MC_OutputState_A1_LOW                      2
+#define MC_OutputState_A1_HIGH                     3
+#define MC_OutputState_A2                        (MCPARAMID)( 1758 << 14)
+#define MC_OutputState_A2_HOLD                     1
+#define MC_OutputState_A2_LOW                      2
+#define MC_OutputState_A2_HIGH                     3
+#define MC_Camera_TM_2016_8CL                    116
+#define MC_CamConfig_P08SC                       171
+#define MC_CamConfig_P08RG                       172
+#define MC_CamConfig_P8SC                        173
+#define MC_CamConfig_P8RG                        174
+#define MC__INITD2_SELV2                         (MCPARAMID)( 1759 << 14)
+#define MC__INITD3_SELV3                         (MCPARAMID)( 1760 << 14)
+#define MC_GrabberConfig_2_00                     12
+#define MC_GrabberConfig_10_10                    13
+#define MC_GrabberConfig_10_01                    14
+#define MC_GrabberConfig_01_10                    15
+#define MC_GrabberConfig_11_00                    16
+#define MC_GrabberConfig_0_11                     17
+#define MC_GrabberConfig_00_11                    18
+#define MC_GrabberConfig_01_01                    19
+#define MC_NextInputState                        (MCPARAMID)( 1761 << 14)
+#define MC_NextInputState_LOW                      1
+#define MC_NextInputState_HIGH                     2
+#define MC_Camera_KP_F120CL                      117
+#define MC_Camera_KP120CL                        118
+#define MC_InputStyle_CMOS_Only_Filter           (MCPARAMID)( 1762 << 14)
+#define MC_InputStyle_CHANNELLINK_Filter         (MCPARAMID)( 1763 << 14)
+#define MC_OutputStyle_OC_Only_Filter            (MCPARAMID)( 1764 << 14)
+#define MC_OutputState_1                         (MCPARAMID)( 1765 << 14)
+#define MC_OutputState_1_HOLD                      1
+#define MC_OutputState_1_LOW                       2
+#define MC_OutputState_1_HIGH                      3
+#define MC_OutputState_2                         (MCPARAMID)( 1766 << 14)
+#define MC_OutputState_2_HOLD                      1
+#define MC_OutputState_2_LOW                       2
+#define MC_OutputState_2_HIGH                      3
+#define MC_OutputState_3                         (MCPARAMID)( 1767 << 14)
+#define MC_OutputState_3_HOLD                      1
+#define MC_OutputState_3_LOW                       2
+#define MC_OutputState_3_HIGH                      3
+#define MC_OutputState_4                         (MCPARAMID)( 1768 << 14)
+#define MC_OutputState_4_HOLD                      1
+#define MC_OutputState_4_LOW                       2
+#define MC_OutputState_4_HIGH                      3
+#define MC_OutputState_5                         (MCPARAMID)( 1769 << 14)
+#define MC_OutputState_5_HOLD                      1
+#define MC_OutputState_5_LOW                       2
+#define MC_OutputState_5_HIGH                      3
+#define MC_OutputState_6                         (MCPARAMID)( 1770 << 14)
+#define MC_OutputState_6_HOLD                      1
+#define MC_OutputState_6_LOW                       2
+#define MC_OutputState_6_HIGH                      3
+#define MC_OutputState_7                         (MCPARAMID)( 1771 << 14)
+#define MC_OutputState_7_HOLD                      1
+#define MC_OutputState_7_LOW                       2
+#define MC_OutputState_7_HIGH                      3
+#define MC_OutputState_8                         (MCPARAMID)( 1772 << 14)
+#define MC_OutputState_8_HOLD                      1
+#define MC_OutputState_8_LOW                       2
+#define MC_OutputState_8_HIGH                      3
+#define MC_OutputState_9                         (MCPARAMID)( 1773 << 14)
+#define MC_OutputState_9_HOLD                      1
+#define MC_OutputState_9_LOW                       2
+#define MC_OutputState_9_HIGH                      3
+#define MC_OutputState_10                        (MCPARAMID)( 1774 << 14)
+#define MC_OutputState_10_HOLD                     1
+#define MC_OutputState_10_LOW                      2
+#define MC_OutputState_10_HIGH                     3
+#define MC_OutputState_11                        (MCPARAMID)( 1775 << 14)
+#define MC_OutputState_11_HOLD                     1
+#define MC_OutputState_11_LOW                      2
+#define MC_OutputState_11_HIGH                     3
+#define MC_OutputState_12                        (MCPARAMID)( 1776 << 14)
+#define MC_OutputState_12_HOLD                     1
+#define MC_OutputState_12_LOW                      2
+#define MC_OutputState_12_HIGH                     3
+#define MC_OutputState_13                        (MCPARAMID)( 1777 << 14)
+#define MC_OutputState_13_HOLD                     1
+#define MC_OutputState_13_LOW                      2
+#define MC_OutputState_13_HIGH                     3
+#define MC_OutputState_14                        (MCPARAMID)( 1778 << 14)
+#define MC_OutputState_14_HOLD                     1
+#define MC_OutputState_14_LOW                      2
+#define MC_OutputState_14_HIGH                     3
+#define MC_OutputState_15                        (MCPARAMID)( 1779 << 14)
+#define MC_OutputState_15_HOLD                     1
+#define MC_OutputState_15_LOW                      2
+#define MC_OutputState_15_HIGH                     3
+#define MC_OutputState_16                        (MCPARAMID)( 1780 << 14)
+#define MC_OutputState_16_HOLD                     1
+#define MC_OutputState_16_LOW                      2
+#define MC_OutputState_16_HIGH                     3
+#define MC_OutputState_17                        (MCPARAMID)( 1781 << 14)
+#define MC_OutputState_17_HOLD                     1
+#define MC_OutputState_17_LOW                      2
+#define MC_OutputState_17_HIGH                     3
+#define MC_OutputState_18                        (MCPARAMID)( 1782 << 14)
+#define MC_OutputState_18_HOLD                     1
+#define MC_OutputState_18_LOW                      2
+#define MC_OutputState_18_HIGH                     3
+#define MC_OutputState_19                        (MCPARAMID)( 1783 << 14)
+#define MC_OutputState_19_HOLD                     1
+#define MC_OutputState_19_LOW                      2
+#define MC_OutputState_19_HIGH                     3
+#define MC_OutputState_28                        (MCPARAMID)( 1784 << 14)
+#define MC_OutputState_28_HOLD                     1
+#define MC_OutputState_28_LOW                      2
+#define MC_OutputState_28_HIGH                     3
+#define MC_OutputState_29                        (MCPARAMID)( 1785 << 14)
+#define MC_OutputState_29_HOLD                     1
+#define MC_OutputState_29_LOW                      2
+#define MC_OutputState_29_HIGH                     3
+#define MC_OutputState_38                        (MCPARAMID)( 1786 << 14)
+#define MC_OutputState_38_HOLD                     1
+#define MC_OutputState_38_LOW                      2
+#define MC_OutputState_38_HIGH                     3
+#define MC_OutputState_39                        (MCPARAMID)( 1787 << 14)
+#define MC_OutputState_39_HOLD                     1
+#define MC_OutputState_39_LOW                      2
+#define MC_OutputState_39_HIGH                     3
+#define MC_Camera_PAL                            119
+#define MC_Camera_NTSC                           120
+#define MC_TapStructure_SINGLE_C                  18
+#define MC_TapStructure_SINGLE_S                  19
+#define MC_DataLink_COMPOSITE                      3
+#define MC_Standard_PAL                            3
+#define MC_Standard_NTSC                           4
+#define MC_Standard_SECAM                          5
+#define MC_Hsquare_Px                            (MCPARAMID)( 1788 << 14)
+#define MC_TrigMode_PAUSE                          9
+#define MC_NextTrigMode_IMMEDIATE                  6
+#define MC_NextTrigMode_PAUSE                      7
+#define MC_NextTrigMode_TIMER                      8
+#define MC_Delay_ms                              (MCPARAMID)( 1789 << 14)
+#define MC_NextDelay_ms                          (MCPARAMID)( 1790 << 14)
+#define MC_TrigEdge_HIGH                           3
+#define MC_TrigEdge_LOW                            4
+#define MC_TrigLine_IO                            11
+#define MC_TrigIO                                (MCPARAMID)( 1791 << 14)
+#define MC_StrobeLine_IO                           7
+#define MC_StrobeIO                              (MCPARAMID)( 1792 << 14)
+#define MC_Connector_VID1_COMP                    15
+#define MC_Connector_VID2_COMP                    16
+#define MC_Connector_VID3_COMP                    17
+#define MC_Connector_VID4_COMP                    18
+#define MC_PixelFormat                           (MCPARAMID)( 1793 << 14)
+#define MC_PixelFormat_RGB32                       1
+#define MC_PixelFormat_RGB24                       2
+#define MC_PixelFormat_RGB16                       3
+#define MC_PixelFormat_RGB15                       4
+#define MC_PixelFormat_YUV2                        5
+#define MC_PixelFormat_Y8                          6
+#define MC_PixelFormat_TGB8                        7
+#define MC_PixelFormat_RAW8                        8
+#define MC_OutputState__xx_                      (MCPARAMID)( 1794 << 14)
+#define MC_OutputState__xx__HOLD                   1
+#define MC_OutputState__xx__LOW                    2
+#define MC_OutputState__xx__HIGH                   3
+#define MC_InputStyle_InsulatedIO_Only_Filter    (MCPARAMID)( 1795 << 14)
+#define MC_InputPinName                          (MCPARAMID)( 1796 << 14)
+#define MC_InputPinName_UNKNOWN                    1
+#define MC_InputPinName_IN1                        2
+#define MC_InputPinName_IN2                        3
+#define MC_InputPinName_IN3                        4
+#define MC_InputPinName_IN4                        5
+#define MC_InputPinName_TRX                        6
+#define MC_InputPinName_TRY                        7
+#define MC_InputPinName_TRZ                        8
+#define MC_InputPinName_CK                         9
+#define MC_InputPinName_RST                       10
+#define MC_InputPinName_HIO                       11
+#define MC_InputPinName_GATE                      12
+#define MC_InputPinName_VIO                       13
+#define MC_InputPinName_EXP                       14
+#define MC_InputConnectorName                    (MCPARAMID)( 1797 << 14)
+#define MC_InputConnectorName_UNKNOWN              1
+#define MC_InputConnectorName_TR_ST                2
+#define MC_InputConnectorName_CAMX                 3
+#define MC_InputConnectorName_CAMY                 4
+#define MC_InputConnectorName_CAMZ                 5
+#define MC_InputConnectorName_PIO                  6
+#define MC_OutputPinName                         (MCPARAMID)( 1798 << 14)
+#define MC_OutputPinName_UNKNOWN                   1
+#define MC_OutputPinName_OUT1                      2
+#define MC_OutputPinName_OUT2                      3
+#define MC_OutputPinName_OUT3                      4
+#define MC_OutputPinName_OUT4                      5
+#define MC_OutputPinName_STX                       6
+#define MC_OutputPinName_STY                       7
+#define MC_OutputPinName_STZ                       8
+#define MC_OutputConnectorName                   (MCPARAMID)( 1799 << 14)
+#define MC_OutputConnectorName_UNKNOWN             1
+#define MC_OutputConnectorName_TR_ST               2
+#define MC_OutputConnectorName_CAMX                3
+#define MC_OutputConnectorName_CAMY                4
+#define MC_OutputConnectorName_CAMZ                5
+#define MC_OutputConnectorName_PIO                 6
+#define MC_InputPinName_IO1                       15
+#define MC_InputPinName_IO2                       16
+#define MC_InputPinName_IO3                       17
+#define MC_InputPinName_IO4                       18
+#define MC_InputPinName_IO5                       19
+#define MC_InputPinName_IO6                       20
+#define MC_InputPinName_IO7                       21
+#define MC_InputPinName_IO8                       22
+#define MC_InputPinName_IO9                       23
+#define MC_InputPinName_IO10                      24
+#define MC_InputPinName_IO11                      25
+#define MC_InputPinName_IO12                      26
+#define MC_InputPinName_IO13                      27
+#define MC_InputPinName_IO14                      28
+#define MC_InputPinName_IO15                      29
+#define MC_InputPinName_IO16                      30
+#define MC_InputPinName_TRG                       31
+#define MC_InputPinName_A1                        32
+#define MC_InputPinName_B1                        33
+#define MC_InputPinName_A2                        34
+#define MC_InputPinName_B2                        35
+#define MC_InputPinName_FVAL                      36
+#define MC_InputPinName_LVAL                      37
+#define MC_InputPinName_DVAL                      38
+#define MC_InputPinName_SPARE                     39
+#define MC_InputConnectorName_SYSTEM               7
+#define MC_InputConnectorName_IO                   8
+#define MC_InputConnectorName_CAMERA               9
+#define MC_InputConnectorName_CAMERA_A            10
+#define MC_InputConnectorName_CAMERA_B            11
+#define MC_OutputPinName_OUT5                      9
+#define MC_OutputPinName_OUT6                     10
+#define MC_OutputPinName_OUT7                     11
+#define MC_OutputPinName_OUT8                     12
+#define MC_OutputPinName_OUT9                     13
+#define MC_OutputPinName_OUT10                    14
+#define MC_OutputPinName_OUT11                    15
+#define MC_OutputPinName_OUT12                    16
+#define MC_OutputPinName_OUT13                    17
+#define MC_OutputPinName_OUT14                    18
+#define MC_OutputPinName_OUT15                    19
+#define MC_OutputPinName_OUT16                    20
+#define MC_OutputPinName_STR                      21
+#define MC_OutputPinName_A1                       22
+#define MC_OutputPinName_B1                       23
+#define MC_OutputPinName_A2                       24
+#define MC_OutputPinName_B2                       25
+#define MC_OutputPinName_CC1                      26
+#define MC_OutputPinName_CC2                      27
+#define MC_OutputPinName_CC3                      28
+#define MC_OutputPinName_CC4                      29
+#define MC_OutputConnectorName_SYSTEM              7
+#define MC_OutputConnectorName_IO                  8
+#define MC_OutputConnectorName_CAMERA              9
+#define MC_OutputConnectorName_CAMERA_A           10
+#define MC_OutputConnectorName_CAMERA_B           11
+#define MC_OutputPinName_IO1                      30
+#define MC_OutputPinName_IO2                      31
+#define MC_OutputPinName_IO3                      32
+#define MC_OutputPinName_IO4                      33
+#define MC_OutputPinName_IO5                      34
+#define MC_OutputPinName_IO6                      35
+#define MC_OutputPinName_IO7                      36
+#define MC_OutputPinName_IO8                      37
+#define MC_OutputPinName_IO9                      38
+#define MC_OutputPinName_IO10                     39
+#define MC_OutputPinName_IO11                     40
+#define MC_OutputPinName_IO12                     41
+#define MC_OutputPinName_IO13                     42
+#define MC_OutputPinName_IO14                     43
+#define MC_OutputPinName_IO15                     44
+#define MC_OutputPinName_IO16                     45
+#define MC___CAMLoopBack                         (MCPARAMID)( 1800 << 14)
+#define MC___CAMLoopBack_DISABLE                   1
+#define MC___CAMLoopBack_ENABLE                    2
+#define MC_GrabberConfig_00_2                     20
+#define MC_GrabberConfig_10_00                    21
+#define MC_GrabberConfig_01_00                    22
+#define MC_GrabberConfig_00_10                    23
+#define MC_GrabberConfig_00_01                    24
+#define MC_GrabberConfig_00_00                    25
+#define MC_MapTimDig_TYX                           9
+#define MC_MapTimDig_TYY                          10
+#define MC__BitMask                              (MCPARAMID)( 1801 << 14)
+#define MC_ConnectLoc_SECOND                       9
+#define MC_ConnectLoc_THIRD                       10
+#define MC_ConnectLoc_FOURTH                      11
+#define MC_Camera_CSB4000CL                      121
+#define MC_Cable_S15_C00                          27
+#define MC_Cable_S15_C01                          28
+#define MC_Cable_S15_C02                          29
+#define MC_CamConfig_P8RC                        175
+#define MC_STOPASMode                            (MCPARAMID)( 1802 << 14)
+#define MC_STOPASMode_AUTO                         1
+#define MC_STOPASMode_MANUAL                       2
+#define MC_OutputPinName_RED                      46
+#define MC_OutputPinName_GREEN                    47
+#define MC_OutputConnectorName_LEDX               12
+#define MC_OutputConnectorName_LEDY               13
+#define MC_OutputConnectorName_LEDZ               14
+#define MC_OutputState_51                        (MCPARAMID)( 1803 << 14)
+#define MC_OutputState_51_HOLD                     1
+#define MC_OutputState_51_LOW                      2
+#define MC_OutputState_51_HIGH                     3
+#define MC_OutputStyle_LED_Filter                (MCPARAMID)( 1804 << 14)
+#define MC_OutputState_52                        (MCPARAMID)( 1805 << 14)
+#define MC_OutputState_52_HOLD                     1
+#define MC_OutputState_52_LOW                      2
+#define MC_OutputState_52_HIGH                     3
+#define MC_OutputState_53                        (MCPARAMID)( 1806 << 14)
+#define MC_OutputState_53_HOLD                     1
+#define MC_OutputState_53_LOW                      2
+#define MC_OutputState_53_HIGH                     3
+#define MC_OutputState_54                        (MCPARAMID)( 1807 << 14)
+#define MC_OutputState_54_HOLD                     1
+#define MC_OutputState_54_LOW                      2
+#define MC_OutputState_54_HIGH                     3
+#define MC_OutputState_55                        (MCPARAMID)( 1808 << 14)
+#define MC_OutputState_55_HOLD                     1
+#define MC_OutputState_55_LOW                      2
+#define MC_OutputState_55_HIGH                     3
+#define MC_OutputState_56                        (MCPARAMID)( 1809 << 14)
+#define MC_OutputState_56_HOLD                     1
+#define MC_OutputState_56_LOW                      2
+#define MC_OutputState_56_HIGH                     3
+#define MC_OutputConnectorName_LED                15
+#define MC_OutputConnectorName_LEDA               16
+#define MC_OutputConnectorName_LEDB               17
+#define MC_BoardTopology_1_11                     21
+#define MC_ConfigGrabber                         (MCPARAMID)( 1810 << 14)
+#define MC_ConfigGrabber_pX                        1
+#define MC_ConfigGrabber_pXBIS                     2
+#define MC_ConfigGrabber_pY                        3
+#define MC_ConfigGrabber_pYBIS                     4
+#define MC_ConfigGrabber_pZ                        5
+#define MC_ConfigGrabber_pZBIS                     6
+#define MC_ConfigGrabber_mX                        7
+#define MC_ConfigGrabber_mXBIS                     8
+#define MC_ConfigGrabber_mY                        9
+#define MC_ConfigGrabber_mYBIS                    10
+#define MC_ConfigGrabber_mZ                       11
+#define MC_ConfigGrabber_mZBIS                    12
+#define MC_ConfigGrabber_PASS                     13
+#define MC_ConfigGrabber_FAIL                     14
+#define MC_NextGrabberConfig                     (MCPARAMID)( 1811 << 14)
+#define MC_NextGrabberConfig_FAIL                  1
+#define MC_NextGrabberConfig_00_00                 2
+#define MC_NextGrabberConfig_2_00                  3
+#define MC_NextGrabberConfig_00_2                  4
+#define MC_NextGrabberConfig_10_00                 5
+#define MC_NextGrabberConfig_01_00                 6
+#define MC_NextGrabberConfig_00_10                 7
+#define MC_NextGrabberConfig_00_01                 8
+#define MC_NextGrabberConfig_10_10                 9
+#define MC_NextGrabberConfig_01_10                10
+#define MC_NextGrabberConfig_10_01                11
+#define MC_NextGrabberConfig_01_01                12
+#define MC_NextGrabberConfig_2_0                  13
+#define MC_NextGrabberConfig_0_2                  14
+#define MC_NextGrabberConfig_1_1                  15
+#define MC_ConfigGrabber_Filter                  (MCPARAMID)( 1812 << 14)
+#define MC_BoardTopology_Filter                  (MCPARAMID)( 1813 << 14)
+#define MC_InputConfig_Filter                    (MCPARAMID)( 1814 << 14)
+#define MC_ConnectorName                         (MCPARAMID)( 1815 << 14)
+#define MC_ConnectorName_UNKNOWN                   1
+#define MC_ConnectorName_SYSTEM                    2
+#define MC_ConnectorName_IO                        3
+#define MC_ConnectorName_CAMERA                    4
+#define MC_ConnectorName_CAMERA_A                  5
+#define MC_ConnectorName_CAMERA_B                  6
+#define MC_ConnectorName_LED                       7
+#define MC_ConnectorName_LEDA                      8
+#define MC_ConnectorName_LEDB                      9
+#define MC_OutputConfig_Filter                   (MCPARAMID)( 1816 << 14)
+#define MC_InputConfig_Filter_17                 (MCPARAMID)( 1817 << 14)
+#define MC_InputConfig_Filter_21                 (MCPARAMID)( 1818 << 14)
+#define MC_InputConfig_Filter_22                 (MCPARAMID)( 1819 << 14)
+#define MC_InputConfig_Filter_23                 (MCPARAMID)( 1820 << 14)
+#define MC_InputConfig_Filter_24                 (MCPARAMID)( 1821 << 14)
+#define MC_InputConfig_Filter_27                 (MCPARAMID)( 1822 << 14)
+#define MC_InputConfig_Filter_28                 (MCPARAMID)( 1823 << 14)
+#define MC_InputConfig_Filter_29                 (MCPARAMID)( 1824 << 14)
+#define MC_OutputConfig_Filter_17                (MCPARAMID)( 1825 << 14)
+#define MC_OutputConfig_Filter_28                (MCPARAMID)( 1826 << 14)
+#define MC_OutputConfig_Filter_29                (MCPARAMID)( 1827 << 14)
+#define MC_OutputConfig_Filter_51                (MCPARAMID)( 1828 << 14)
+#define MC_OutputConfig_Filter_52                (MCPARAMID)( 1829 << 14)
+#define MC_InputConfig_Filter_1                  (MCPARAMID)( 1830 << 14)
+#define MC_InputConfig_Filter_2                  (MCPARAMID)( 1831 << 14)
+#define MC_InputConfig_Filter_3                  (MCPARAMID)( 1832 << 14)
+#define MC_InputConfig_Filter_4                  (MCPARAMID)( 1833 << 14)
+#define MC_InputConfig_Filter_5                  (MCPARAMID)( 1834 << 14)
+#define MC_InputConfig_Filter_6                  (MCPARAMID)( 1835 << 14)
+#define MC_InputConfig_Filter_7                  (MCPARAMID)( 1836 << 14)
+#define MC_InputConfig_Filter_8                  (MCPARAMID)( 1837 << 14)
+#define MC_InputConfig_Filter_9                  (MCPARAMID)( 1838 << 14)
+#define MC_InputConfig_Filter_10                 (MCPARAMID)( 1839 << 14)
+#define MC_InputConfig_Filter_11                 (MCPARAMID)( 1840 << 14)
+#define MC_InputConfig_Filter_12                 (MCPARAMID)( 1841 << 14)
+#define MC_InputConfig_Filter_13                 (MCPARAMID)( 1842 << 14)
+#define MC_InputConfig_Filter_14                 (MCPARAMID)( 1843 << 14)
+#define MC_InputConfig_Filter_15                 (MCPARAMID)( 1844 << 14)
+#define MC_InputConfig_Filter_16                 (MCPARAMID)( 1845 << 14)
+#define MC_InputConfig_Filter_18                 (MCPARAMID)( 1846 << 14)
+#define MC_InputConfig_Filter_19                 (MCPARAMID)( 1847 << 14)
+#define MC_InputConfig_Filter_31                 (MCPARAMID)( 1848 << 14)
+#define MC_InputConfig_Filter_32                 (MCPARAMID)( 1849 << 14)
+#define MC_InputConfig_Filter_33                 (MCPARAMID)( 1850 << 14)
+#define MC_InputConfig_Filter_34                 (MCPARAMID)( 1851 << 14)
+#define MC_InputConfig_Filter_37                 (MCPARAMID)( 1852 << 14)
+#define MC_InputConfig_Filter_38                 (MCPARAMID)( 1853 << 14)
+#define MC_InputConfig_Filter_39                 (MCPARAMID)( 1854 << 14)
+#define MC_OutputConfig_Filter_1                 (MCPARAMID)( 1855 << 14)
+#define MC_OutputConfig_Filter_2                 (MCPARAMID)( 1856 << 14)
+#define MC_OutputConfig_Filter_3                 (MCPARAMID)( 1857 << 14)
+#define MC_OutputConfig_Filter_4                 (MCPARAMID)( 1858 << 14)
+#define MC_OutputConfig_Filter_5                 (MCPARAMID)( 1859 << 14)
+#define MC_OutputConfig_Filter_6                 (MCPARAMID)( 1860 << 14)
+#define MC_OutputConfig_Filter_7                 (MCPARAMID)( 1861 << 14)
+#define MC_OutputConfig_Filter_8                 (MCPARAMID)( 1862 << 14)
+#define MC_OutputConfig_Filter_9                 (MCPARAMID)( 1863 << 14)
+#define MC_OutputConfig_Filter_10                (MCPARAMID)( 1864 << 14)
+#define MC_OutputConfig_Filter_11                (MCPARAMID)( 1865 << 14)
+#define MC_OutputConfig_Filter_12                (MCPARAMID)( 1866 << 14)
+#define MC_OutputConfig_Filter_13                (MCPARAMID)( 1867 << 14)
+#define MC_OutputConfig_Filter_14                (MCPARAMID)( 1868 << 14)
+#define MC_OutputConfig_Filter_15                (MCPARAMID)( 1869 << 14)
+#define MC_OutputConfig_Filter_16                (MCPARAMID)( 1870 << 14)
+#define MC_OutputConfig_Filter_18                (MCPARAMID)( 1871 << 14)
+#define MC_OutputConfig_Filter_19                (MCPARAMID)( 1872 << 14)
+#define MC_OutputConfig_Filter_38                (MCPARAMID)( 1873 << 14)
+#define MC_OutputConfig_Filter_39                (MCPARAMID)( 1874 << 14)
+#define MC_OutputConfig_Filter_53                (MCPARAMID)( 1875 << 14)
+#define MC_OutputConfig_Filter_54                (MCPARAMID)( 1876 << 14)
+#define MC_ConnectorName_TR_ST                    10
+#define MC_ConnectorName_CAMX                     11
+#define MC_ConnectorName_CAMY                     12
+#define MC_ConnectorName_CAMZ                     13
+#define MC_ConnectorName_PIO                      14
+#define MC_ConnectorName_LEDX                     15
+#define MC_ConnectorName_LEDY                     16
+#define MC_ConnectorName_LEDZ                     17
+#define MC_InputConfig_Filter_25                 (MCPARAMID)( 1877 << 14)
+#define MC_InputConfig_Filter_26                 (MCPARAMID)( 1878 << 14)
+#define MC_InputConfig_Filter_35                 (MCPARAMID)( 1879 << 14)
+#define MC_InputConfig_Filter_36                 (MCPARAMID)( 1880 << 14)
+#define MC_InputConfig_Filter_42                 (MCPARAMID)( 1881 << 14)
+#define MC_InputConfig_Filter_43                 (MCPARAMID)( 1882 << 14)
+#define MC_InputConfig_Filter_44                 (MCPARAMID)( 1883 << 14)
+#define MC_InputConfig_Filter_45                 (MCPARAMID)( 1884 << 14)
+#define MC_InputConfig_Filter_46                 (MCPARAMID)( 1885 << 14)
+#define MC_InputConfig_Filter_47                 (MCPARAMID)( 1886 << 14)
+#define MC_OutputConfig_Filter_55                (MCPARAMID)( 1887 << 14)
+#define MC_OutputConfig_Filter_56                (MCPARAMID)( 1888 << 14)
+#define MC_InputFunction_UNKNOWN                   1
+#define MC_InputFunction_SOFT                      2
+#define MC_InputFunction_OUTPUT                    3
+#define MC_InputFunction_TRIG                      4
+#define MC_InputFunction_LINETRIG                  5
+#define MC_InputFunction_HSYNC                     6
+#define MC_InputFunction_VSYNC                     7
+#define MC_InputFunction_CLOCK                     8
+#define MC_InputFunction_NONE                      9
+#define MC_InputFunction_CAMERA                   10
+#define MC_InputState_NONE                         1
+#define MC_InputState_LOW                          2
+#define MC_InputState_HIGH                         3
+#define MC_InputState_WENTLOW                      4
+#define MC_InputState_WENTHIGH                     5
+#define MC_InputStyle_TTL                          1
+#define MC_InputStyle_ITTL                         2
+#define MC_InputStyle_I12V                         3
+#define MC_InputStyle_RS422                        4
+#define MC_InputStyle_LVDS                         5
+#define MC_InputStyle_DIFF                         6
+#define MC_OutputConfig_SOFT                       1
+#define MC_OutputConfig_FREE                       2
+#define MC_OutputFunction_UNKNOWN                  1
+#define MC_OutputFunction_SOFT                     2
+#define MC_OutputFunction_INPUT                    3
+#define MC_OutputFunction_WATCHDOG                 4
+#define MC_OutputFunction_ALARM                    5
+#define MC_OutputFunction_SYSTEM                   6
+#define MC_OutputFunction_TIED                     7
+#define MC_OutputFunction_STROBE                   8
+#define MC_OutputFunction_RESET                    9
+#define MC_OutputFunction_AUXRESET                10
+#define MC_OutputFunction_HDRIVE                  11
+#define MC_OutputFunction_VDRIVE                  12
+#define MC_OutputFunction_CLOCK                   13
+#define MC_OutputFunction_NONE                    14
+#define MC_OutputState_NONE                        4
+#define MC_OutputState_LOW                         5
+#define MC_OutputState_HIGH                        6
+#define MC_OutputState_TOGGLE                      7
+#define MC_OutputStyle_TTL                         1
+#define MC_OutputStyle_ITTL                        2
+#define MC_OutputStyle_IOC                         3
+#define MC_OutputStyle_IOE                         4
+#define MC_OutputStyle_RELAY                       5
+#define MC_OutputStyle_LED                         6
+#define MC_InputFunction_FVAL                     11
+#define MC_InputFunction_LVAL                     12
+#define MC_InputFunction_DVAL                     13
+#define MC_InputFunction_SPARE                    14
+#define MC_InputStyle_CHANNELLINK                  7
+#define MC_InputStyle_CMOS                         8
+#define MC_OutputStyle_OC                          7
+#define MC_InputStyle_Filter17                   (MCPARAMID)( 1889 << 14)
+#define MC_InputStyle_Filter_17                  (MCPARAMID)( 1890 << 14)
+#define MC_InputStyle_Filter18                   (MCPARAMID)( 1891 << 14)
+#define MC_InputStyle_Filter_18                  (MCPARAMID)( 1892 << 14)
+#define MC_InputStyle_Filter19                   (MCPARAMID)( 1893 << 14)
+#define MC_InputStyle_Filter_19                  (MCPARAMID)( 1894 << 14)
+#define MC_OutputStyle_Filter17                  (MCPARAMID)( 1895 << 14)
+#define MC_OutputStyle_Filter_17                 (MCPARAMID)( 1896 << 14)
+#define MC_OutputStyle_Filter18                  (MCPARAMID)( 1897 << 14)
+#define MC_OutputStyle_Filter_18                 (MCPARAMID)( 1898 << 14)
+#define MC_OutputStyle_Filter19                  (MCPARAMID)( 1899 << 14)
+#define MC_OutputStyle_Filter_19                 (MCPARAMID)( 1900 << 14)
+#define MC_InputStyle_Filter_1                   (MCPARAMID)( 1901 << 14)
+#define MC_InputStyle_Filter_2                   (MCPARAMID)( 1902 << 14)
+#define MC_InputStyle_Filter_3                   (MCPARAMID)( 1903 << 14)
+#define MC_InputStyle_Filter_4                   (MCPARAMID)( 1904 << 14)
+#define MC_OutputStyle_Filter_1                  (MCPARAMID)( 1905 << 14)
+#define MC_OutputStyle_Filter_2                  (MCPARAMID)( 1906 << 14)
+#define MC_OutputStyle_Filter_3                  (MCPARAMID)( 1907 << 14)
+#define MC_OutputStyle_Filter_4                  (MCPARAMID)( 1908 << 14)
+#define MC_InputStyle_Filter_28                  (MCPARAMID)( 1909 << 14)
+#define MC_InputStyle_Filter_29                  (MCPARAMID)( 1910 << 14)
+#define MC_OutputStyle_Filter_28                 (MCPARAMID)( 1911 << 14)
+#define MC_OutputStyle_Filter_29                 (MCPARAMID)( 1912 << 14)
+#define MC_InputStyle_Filter_5                   (MCPARAMID)( 1913 << 14)
+#define MC_InputStyle_Filter_6                   (MCPARAMID)( 1914 << 14)
+#define MC_InputStyle_Filter_7                   (MCPARAMID)( 1915 << 14)
+#define MC_InputStyle_Filter_8                   (MCPARAMID)( 1916 << 14)
+#define MC_InputStyle_Filter_9                   (MCPARAMID)( 1917 << 14)
+#define MC_InputStyle_Filter_10                  (MCPARAMID)( 1918 << 14)
+#define MC_InputStyle_Filter_11                  (MCPARAMID)( 1919 << 14)
+#define MC_InputStyle_Filter_12                  (MCPARAMID)( 1920 << 14)
+#define MC_InputStyle_Filter_13                  (MCPARAMID)( 1921 << 14)
+#define MC_InputStyle_Filter_14                  (MCPARAMID)( 1922 << 14)
+#define MC_InputStyle_Filter_15                  (MCPARAMID)( 1923 << 14)
+#define MC_InputStyle_Filter_16                  (MCPARAMID)( 1924 << 14)
+#define MC_InputStyle_Filter_38                  (MCPARAMID)( 1925 << 14)
+#define MC_InputStyle_Filter_39                  (MCPARAMID)( 1926 << 14)
+#define MC_OutputStyle_Filter_5                  (MCPARAMID)( 1927 << 14)
+#define MC_OutputStyle_Filter_6                  (MCPARAMID)( 1928 << 14)
+#define MC_OutputStyle_Filter_7                  (MCPARAMID)( 1929 << 14)
+#define MC_OutputStyle_Filter_8                  (MCPARAMID)( 1930 << 14)
+#define MC_OutputStyle_Filter_9                  (MCPARAMID)( 1931 << 14)
+#define MC_OutputStyle_Filter_10                 (MCPARAMID)( 1932 << 14)
+#define MC_OutputStyle_Filter_11                 (MCPARAMID)( 1933 << 14)
+#define MC_OutputStyle_Filter_12                 (MCPARAMID)( 1934 << 14)
+#define MC_OutputStyle_Filter_13                 (MCPARAMID)( 1935 << 14)
+#define MC_OutputStyle_Filter_14                 (MCPARAMID)( 1936 << 14)
+#define MC_OutputStyle_Filter_15                 (MCPARAMID)( 1937 << 14)
+#define MC_OutputStyle_Filter_16                 (MCPARAMID)( 1938 << 14)
+#define MC_OutputStyle_Filter_38                 (MCPARAMID)( 1939 << 14)
+#define MC_OutputStyle_Filter_39                 (MCPARAMID)( 1940 << 14)
+#define MC_TimUnitN_USEDXBIS                       7
+#define MC_TimUnitN_USEDYBIS                       8
+#define MC_GrabberConfig_1_1_0                    26
+#define MC_GrabberConfig_1_0_1                    27
+#define MC_GrabberConfig_0_1_1                    28
+#define MC_GrabberConfig_1_0_0                    29
+#define MC_GrabberConfig_0_1_0                    30
+#define MC_GrabberConfig_0_0_1                    31
+#define MC_GrabberConfig_2_0_2                    32
+#define MC_GrabberConfig_0_2_2                    33
+#define MC_GrabberConfig_2_0_0                    34
+#define MC_GrabberConfig_0_2_0                    35
+#define MC_GrabberConfig_0_0_2                    36
+#define MC_GrabberConfig_3_0_0                    37
+#define MC_GrabberConfig_0_3_0                    38
+#define MC_GrabberConfig_1_0_2                    39
+#define MC_GrabberConfig_0_1_2                    40
+#define MC_GrabberConfig_2_0_1                    41
+#define MC_GrabberConfig_0_2_1                    42
+#define MC_GrabberConfig_1_3_0                    43
+#define MC_NextGrabberConfig_00_00_00             16
+#define MC_NextGrabberConfig_1_1_1                17
+#define MC_NextGrabberConfig_1_1_2                18
+#define MC_NextGrabberConfig_2_2_0                19
+#define MC_NextGrabberConfig_0_3_1                20
+#define MC_OutputState_Filter_17                 (MCPARAMID)( 1941 << 14)
+#define MC_OutputState_Filter_18                 (MCPARAMID)( 1942 << 14)
+#define MC_OutputState_Filter_19                 (MCPARAMID)( 1943 << 14)
+#define MC_OutputState_Filter_51                 (MCPARAMID)( 1944 << 14)
+#define MC_OutputState_Filter_52                 (MCPARAMID)( 1945 << 14)
+#define MC_OutputState_Filter_53                 (MCPARAMID)( 1946 << 14)
+#define MC_OutputState_Filter_54                 (MCPARAMID)( 1947 << 14)
+#define MC_OutputState_Filter_28                 (MCPARAMID)( 1948 << 14)
+#define MC_OutputState_Filter_29                 (MCPARAMID)( 1949 << 14)
+#define MC_OutputState_Filter_1                  (MCPARAMID)( 1950 << 14)
+#define MC_OutputState_Filter_2                  (MCPARAMID)( 1951 << 14)
+#define MC_OutputState_Filter_3                  (MCPARAMID)( 1952 << 14)
+#define MC_OutputState_Filter_4                  (MCPARAMID)( 1953 << 14)
+#define MC_OutputState_Filter_5                  (MCPARAMID)( 1954 << 14)
+#define MC_OutputState_Filter_6                  (MCPARAMID)( 1955 << 14)
+#define MC_OutputState_Filter_7                  (MCPARAMID)( 1956 << 14)
+#define MC_OutputState_Filter_8                  (MCPARAMID)( 1957 << 14)
+#define MC_OutputState_Filter_9                  (MCPARAMID)( 1958 << 14)
+#define MC_OutputState_Filter_10                 (MCPARAMID)( 1959 << 14)
+#define MC_OutputState_Filter_11                 (MCPARAMID)( 1960 << 14)
+#define MC_OutputState_Filter_12                 (MCPARAMID)( 1961 << 14)
+#define MC_OutputState_Filter_13                 (MCPARAMID)( 1962 << 14)
+#define MC_OutputState_Filter_14                 (MCPARAMID)( 1963 << 14)
+#define MC_OutputState_Filter_15                 (MCPARAMID)( 1964 << 14)
+#define MC_OutputState_Filter_16                 (MCPARAMID)( 1965 << 14)
+#define MC_OutputState_Filter_38                 (MCPARAMID)( 1966 << 14)
+#define MC_OutputState_Filter_39                 (MCPARAMID)( 1967 << 14)
+#define MC_NextGrabberConfig_1_1_0                21
+#define MC_NextGrabberConfig_1_0_1                22
+#define MC_NextGrabberConfig_0_1_1                23
+#define MC_NextGrabberConfig_1_0_0                24
+#define MC_NextGrabberConfig_0_1_0                25
+#define MC_NextGrabberConfig_0_0_1                26
+#define MC_NextGrabberConfig_2_0_2                27
+#define MC_NextGrabberConfig_0_2_2                28
+#define MC_NextGrabberConfig_2_0_0                29
+#define MC_NextGrabberConfig_0_2_0                30
+#define MC_NextGrabberConfig_0_0_2                31
+#define MC_NextGrabberConfig_3_0_0                32
+#define MC_NextGrabberConfig_0_3_0                33
+#define MC_NextGrabberConfig_1_0_2                34
+#define MC_NextGrabberConfig_0_1_2                35
+#define MC_NextGrabberConfig_2_0_1                36
+#define MC_NextGrabberConfig_0_2_1                37
+#define MC_NextGrabberConfig_1_3_0                38
+#define MC_GrabberConfig_00_00_00                 44
+#define MC_OutputState_Filter_55                 (MCPARAMID)( 1968 << 14)
+#define MC_OutputState_Filter_56                 (MCPARAMID)( 1969 << 14)
+#define MC_BoardTopology_2_0                      22
+#define MC_GrabberConfig_11_10_00                 45
+#define MC_GrabberConfig_11_01_00                 46
+#define MC_GrabberConfig_11_00_10                 47
+#define MC_GrabberConfig_11_00_01                 48
+#define MC_GrabberConfig_10_11_00                 49
+#define MC_GrabberConfig_10_10_10                 50
+#define MC_GrabberConfig_10_10_01                 51
+#define MC_GrabberConfig_10_01_10                 52
+#define MC_GrabberConfig_10_O1_01                 53
+#define MC_GrabberConfig_10_00_11                 54
+#define MC_GrabberConfig_01_11_00                 55
+#define MC_GrabberConfig_01_10_10                 56
+#define MC_GrabberConfig_01_10_01                 57
+#define MC_GrabberConfig_01_01_10                 58
+#define MC_GrabberConfig_01_01_01                 59
+#define MC_GrabberConfig_01_00_11                 60
+#define MC_GrabberConfig_00_11_10                 61
+#define MC_GrabberConfig_00_11_01                 62
+#define MC_GrabberConfig_00_10_11                 63
+#define MC_GrabberConfig_00_01_11                 64
+#define MC_GrabberConfig_11_00_00                 65
+#define MC_GrabberConfig_10_10_00                 66
+#define MC_GrabberConfig_10_01_00                 67
+#define MC_GrabberConfig_10_00_10                 68
+#define MC_GrabberConfig_10_00_01                 69
+#define MC_GrabberConfig_01_10_00                 70
+#define MC_GrabberConfig_01_01_00                 71
+#define MC_GrabberConfig_01_00_10                 72
+#define MC_GrabberConfig_01_00_01                 73
+#define MC_GrabberConfig_00_11_00                 74
+#define MC_GrabberConfig_00_10_10                 75
+#define MC_GrabberConfig_00_10_01                 76
+#define MC_GrabberConfig_00_01_10                 77
+#define MC_GrabberConfig_00_01_01                 78
+#define MC_GrabberConfig_00_00_11                 79
+#define MC_GrabberConfig_10_00_00                 80
+#define MC_GrabberConfig_01_00_00                 81
+#define MC_GrabberConfig_00_01_00                 82
+#define MC_GrabberConfig_00_00_10                 83
+#define MC_GrabberConfig_00_00_01                 84
+#define MC_GrabberConfig_10_01_01                 85
+#define MC_GrabberConfig_00_10_00                 86
+#define MC_NextGrabberConfig_11_10_00             39
+#define MC_NextGrabberConfig_11_01_00             40
+#define MC_NextGrabberConfig_11_00_10             41
+#define MC_NextGrabberConfig_11_00_01             42
+#define MC_NextGrabberConfig_10_11_00             43
+#define MC_NextGrabberConfig_10_10_10             44
+#define MC_NextGrabberConfig_10_10_01             45
+#define MC_NextGrabberConfig_10_01_10             46
+#define MC_NextGrabberConfig_10_01_01             47
+#define MC_NextGrabberConfig_10_00_11             48
+#define MC_NextGrabberConfig_01_11_00             49
+#define MC_NextGrabberConfig_01_10_10             50
+#define MC_NextGrabberConfig_01_10_01             51
+#define MC_NextGrabberConfig_01_01_10             52
+#define MC_NextGrabberConfig_01_01_01             53
+#define MC_NextGrabberConfig_01_00_11             54
+#define MC_NextGrabberConfig_00_11_10             55
+#define MC_NextGrabberConfig_00_11_01             56
+#define MC_NextGrabberConfig_00_10_11             57
+#define MC_NextGrabberConfig_00_01_11             58
+#define MC_NextGrabberConfig_11_00_00             59
+#define MC_NextGrabberConfig_10_10_00             60
+#define MC_NextGrabberConfig_10_01_00             61
+#define MC_NextGrabberConfig_10_00_10             62
+#define MC_NextGrabberConfig_10_00_01             63
+#define MC_NextGrabberConfig_01_10_00             64
+#define MC_NextGrabberConfig_01_01_00             65
+#define MC_NextGrabberConfig_01_00_10             66
+#define MC_NextGrabberConfig_01_00_01             67
+#define MC_NextGrabberConfig_00_11_00             68
+#define MC_NextGrabberConfig_00_10_10             69
+#define MC_NextGrabberConfig_00_10_01             70
+#define MC_NextGrabberConfig_00_01_10             71
+#define MC_NextGrabberConfig_00_01_01             72
+#define MC_NextGrabberConfig_00_00_11             73
+#define MC_NextGrabberConfig_10_00_00             74
+#define MC_NextGrabberConfig_01_00_00             75
+#define MC_NextGrabberConfig_00_10_00             76
+#define MC_NextGrabberConfig_00_01_00             77
+#define MC_NextGrabberConfig_00_00_10             78
+#define MC_NextGrabberConfig_00_00_01             79
+#define MC_MapDigTim_AA                            9
+#define MC_MapDigTim_AB                           10
+#define MC_MapDigTim_BA                           11
+#define MC_MapDigTim_BB                           12
+#define MC_DesignNumber                          (MCPARAMID)( 1970 << 14)
+#define MC_DesignNumber_A                          1
+#define MC_DesignNumber_B                          2
+#define MC__Board_Type                           (MCPARAMID)( 1971 << 14)
+#define MC__Board_Type__ALPHA                      1
+#define MC__Board_Type__GAMMA                      2
+#define MC__Board_Type__ALPHA_cPCI                 3
+#define MC_TimUnitNUsage_SHARE                     4
+#define MC__BoardType__ALPHA_A                     9
+#define MC__BoardType__ALPHA_B                    10
+#define MC__DIGTIM                               (MCPARAMID)( 1972 << 14)
+#define MC_BoardTopologyRead                     (MCPARAMID)( 1973 << 14)
+#define MC_BoardTopologyRead_1_1                   1
+#define MC_BoardTopologyRead_2_1                   2
+#define MC_BoardTopologyRead_2_2                   3
+#define MC_BoardTopologyRead_1_11                  4
+#define MC_BoardTopologyRead_2_11                  5
+#define MC_BoardTopologyRead_11_11                 6
+#define MC_BoardTopologyRead_0_2                   7
+#define MC_BoardTopologyRead_2_0                   8
+#define MC_ChannelIndex                          (MCPARAMID)( 1974 << 14)
+#define MC_BoardIndex                            (MCPARAMID)( 1975 << 14)
+#define MC_GrabberIndex                          (MCPARAMID)( 1976 << 14)
+#define MC_ConnectorIndex                        (MCPARAMID)( 1977 << 14)
+#define MC_BayerOnly_Filter                      (MCPARAMID)( 1978 << 14)
+#define MC__Board_Type__IOTA                       4
+#define MC_Spectrum_Filter                       (MCPARAMID)( 1979 << 14)
+#define MC__BoardType__IOTA                       11
+#define MC___SyncMode_Check                      (MCPARAMID)( 1980 << 14)
+#define MC___SyncMode_Check_PASS                   1
+#define MC___SyncMode_Check_FAIL                   2
+#define MC___ADresolution_Check                  (MCPARAMID)( 1981 << 14)
+#define MC___ADresolution_Check_PASS               1
+#define MC___ADresolution_Check_FAIL               2
+#define MC___CalPat_Check                        (MCPARAMID)( 1982 << 14)
+#define MC___CalPat_Check_PASS                     1
+#define MC___CalPat_Check_FAIL                     2
+#define MC_BoardTopology_1_                       23
+#define MC__PRM2_T2OVR                           (MCPARAMID)( 1983 << 14)
+#define MC__PRM2_T2OVR_PROTECT                     1
+#define MC__PRM2_T2OVR_NOPROTECT                   2
+#define MC__HBC_POST                             (MCPARAMID)( 1984 << 14)
+#define MC__HBC_HPOST                            (MCPARAMID)( 1985 << 14)
+#define MC__DRS_CSOL_FVALS                         5
+#define MC__HDC_DCINIT                           (MCPARAMID)( 1986 << 14)
+#define MC__HDC_DCINIT_SOL                         1
+#define MC__HDC_DCINIT_LOOP                        2
+#define MC_Camera_PC_640CL                       122
+#define MC_CamConfig_P60RC                       176
+#define MC_Camera_1M28_SA                        123
+#define MC_CamConfig_P27SC                       177
+#define MC_CamConfig_P27RC                       178
+#define MC__TrueExp_T2                           (MCPARAMID)( 1987 << 14)
+#define MC__Upstream                             (MCPARAMID)( 1988 << 14)
+#define MC__Upstream_ON                            1
+#define MC__Upstream_OFF                           2
+#define MC__DTC_VUS_CST                          (MCPARAMID)( 1989 << 14)
+#define MC__DTC_VUS_CST_INPUT                      1
+#define MC__DTC_VUS_CST_CUS2                       2
+#define MC__DTC_VUS_CST_CUS2INV                    3
+#define MC__DTC_VUS_CST_SUS2                       4
+#define MC__DTC_VUS_CST_SUS2INV                    5
+#define MC__DTC_VUS_CST_LOW                        6
+#define MC__DTC_VUS_CST_HIGH                       7
+#define MC__DTC_VUS_CST_KEEP                       8
+#define MC__DTC_VUS_END                          (MCPARAMID)( 1990 << 14)
+#define MC__DTC_VUS_END_INPUT                      1
+#define MC__DTC_VUS_END_CUS2                       2
+#define MC__DTC_VUS_END_CUS2INV                    3
+#define MC__DTC_VUS_END_SUS2                       4
+#define MC__DTC_VUS_END_SUS2INV                    5
+#define MC__DTC_VUS_END_LOW                        6
+#define MC__DTC_VUS_END_HIGH                       7
+#define MC__DTC_VUS_END_KEEP                       8
+#define MC__DTC_RUS_CST                          (MCPARAMID)( 1991 << 14)
+#define MC__DTC_RUS_CST_INPUT                      1
+#define MC__DTC_RUS_CST_CUS2                       2
+#define MC__DTC_RUS_CST_CUS2INV                    3
+#define MC__DTC_RUS_CST_SUS2                       4
+#define MC__DTC_RUS_CST_SUS2INV                    5
+#define MC__DTC_RUS_CST_LOW                        6
+#define MC__DTC_RUS_CST_HIGH                       7
+#define MC__DTC_RUS_CST_KEEP                       8
+#define MC__DTC_RUS_END                          (MCPARAMID)( 1992 << 14)
+#define MC__DTC_RUS_END_INPUT                      1
+#define MC__DTC_RUS_END_CUS2                       2
+#define MC__DTC_RUS_END_CUS2INV                    3
+#define MC__DTC_RUS_END_SUS2                       4
+#define MC__DTC_RUS_END_SUS2INV                    5
+#define MC__DTC_RUS_END_LOW                        6
+#define MC__DTC_RUS_END_HIGH                       7
+#define MC__DTC_RUS_END_KEEP                       8
+#define MC_Camera_2M30_SA                        124
+#define MC_RequiredGrabbers                      (MCPARAMID)( 1993 << 14)
+#define MC_RequiredGrabber                       (MCPARAMID)( 1994 << 14)
+#define MC_RequiredGrabber_ONE                     1
+#define MC_RequiredGrabber_TWO                     2
+#define MC_RequiredGrabber_THREE                   3
+#define MC_RequiredGrabber_FOUR                    4
+#define MC_NextConfigGrabber                     (MCPARAMID)( 1995 << 14)
+#define MC_NextConfigGrabber_NONE                  1
+#define MC_NextConfigGrabber_mX                    2
+#define MC_NextConfigGrabber_mXBIS                 3
+#define MC_NextConfigGrabber_mY                    4
+#define MC_NextConfigGrabber_mYBIS                 5
+#define MC_NextConfigGrabber_mZ                    6
+#define MC_NextConfigGrabber_mZBIS                 7
+#define MC__NCGKey                               (MCPARAMID)( 1996 << 14)
+#define MC__NCGKey_STD                             1
+#define MC__NCGKey_ALT                             2
+#define MC_TimUnitNConfig                        (MCPARAMID)( 1997 << 14)
+#define MC_TimUnitNConfig_FREE                     1
+#define MC_TimUnitNConfig_A0_00                    2
+#define MC_TimUnitNConfig_0A_00                    3
+#define MC_TimUnitNConfig_00_A0                    4
+#define MC_TimUnitNConfig_00_0A                    5
+#define MC_TimUnitNConfig_C0_00                    6
+#define MC_TimUnitNConfig_C0_M0                    7
+#define MC_TimUnitNConfig_00_C0                    8
+#define MC_TimUnitNConfig_M0_C0                    9
+#define MC_ConfigTimUnitN                        (MCPARAMID)( 1998 << 14)
+#define MC_ConfigTimUnitN_UNUSED                   1
+#define MC_ConfigTimUnitN_ANALOG                   2
+#define MC_ConfigTimUnitN_MASTER                   3
+#define MC_NextTimUnitNConfig                    (MCPARAMID)( 1999 << 14)
+#define MC_NextTimUnitNConfig_FAIL                 1
+#define MC_NextTimUnitNConfig_FREE                 2
+#define MC_NextTimUnitNConfig_A0_00                3
+#define MC_NextTimUnitNConfig_0A_00                4
+#define MC_NextTimUnitNConfig_00_A0                5
+#define MC_NextTimUnitNConfig_00_0A                6
+#define MC_NextTimUnitNConfig_C0_00                7
+#define MC_NextTimUnitNConfig_C0_M0                8
+#define MC_NextTimUnitNConfig_00_C0                9
+#define MC_NextTimUnitNConfig_M0_C0               10
+#define MC_TimUnitNCheck                         (MCPARAMID)( 2000 << 14)
+#define MC_TimUnitNCheck_PASS                      1
+#define MC_TimUnitNCheck_FAIL                      2
+#define MC_ConfigClkSynthFreq                    (MCPARAMID)( 2001 << 14)
+#define MC_ClkSynthFreq                          (MCPARAMID)( 2002 << 14)
+#define MC_ChannelResourcesTimeout               (MCPARAMID)( 2003 << 14)
+#define MC_BoardTopology_MONO                     24
+#define MC_BoardTopology_DUO                      25
+#define MC_ConfigGrabberFailure                  (MCPARAMID)( 2004 << 14)
+#define MC_ConfigGrabberFailure_NONE               1
+#define MC_ConfigGrabberFailure_Connector_InUse    2
+#define MC_ConfigGrabberFailure_TUN_InUse          3
+#define MC_ConfigGrabberFailure_TUN_ShareMaster    4
+#define MC_ConfigGrabberFailure_Out_of_ADC_resource   5
+#define MC_ConfigGrabberFailure_Invalid_Config_PS   6
+#define MC_ConfigGrabberFailure_Invalid_Config     7
+#define MC_NextGrabberConfig_0_0_0_0              80
+#define MC_NextGrabberConfig_1_0_0_0              81
+#define MC_NextGrabberConfig_0_1_0_0              82
+#define MC_NextGrabberConfig_0_0_1_0              83
+#define MC_NextGrabberConfig_0_0_0_1              84
+#define MC_NextGrabberConfig_1_1_0_0              85
+#define MC_NextGrabberConfig_1_0_0_1              86
+#define MC_NextGrabberConfig_0_1_1_0              87
+#define MC_NextGrabberConfig_0_0_1_1              88
+#define MC_GrabberConfig_0_0_0_0                  87
+#define MC_GrabberConfig_1_0_0_0                  88
+#define MC_GrabberConfig_0_1_0_0                  89
+#define MC_GrabberConfig_0_0_1_0                  90
+#define MC_GrabberConfig_0_0_0_1                  91
+#define MC_SequencesR1_JumpNEXTACQ               (MCPARAMID)( 2005 << 14)
+#define MC_SequencesR1_JumpNEXTACQ_ACQR2           1
+#define MC_SequencesR1_JumpNEXTACQ_IDLER2          2
+#define MC_Camera_A302b                          125
+#define MC_INITC_GPTCOUNT                        (MCPARAMID)( 2006 << 14)
+#define MC__GrabMode                             (MCPARAMID)( 2007 << 14)
+#define MC__GrabMode_RAW                           1
+#define MC__GrabMode_XY                            2
+#define MC__RawGrabSizeX_Px                      (MCPARAMID)( 2008 << 14)
+#define MC__NotLive                              (MCPARAMID)( 2009 << 14)
+#define MC__nLive                                (MCPARAMID)( 2010 << 14)
+#define MC__STB_Qx1SRC_FromSTB_Y                   5
+#define MC__STB_Qx1SRC_FromSTB_Y_Inverted          6
+#define MC__STB_Qx2SRC_FromSTB_Y                   5
+#define MC__STB_Qx2SRC_FromSTB_Y_Inverted          6
+#define MC_B1Usage_TRIGGER                         3
+#define MC_B1Usage_LINETRIGGER                     4
+#define MC__BoardType__PICOLO_PRO2                12
+#define MC__BoardType__PICOLO                     13
+#define MC_BreakEffect                           (MCPARAMID)( 2011 << 14)
+#define MC_BreakEffect_ABORT                       1
+#define MC_BreakEffect_FINISH                      2
+#define MC_INITC_GPTCOUNT_ms                     (MCPARAMID)( 2012 << 14)
+#define MC_GrabberPartition                      (MCPARAMID)( 2013 << 14)
+#define MC_GrabberPartition_A                      1
+#define MC_GrabberPartition_B                      2
+#define MC_GrabberPartition_C                      3
+#define MC_GrabberPartition_D                      4
+#define MC_GrabberPartition_E                      5
+#define MC_GrabberPartition_F                      6
+#define MC_GrabberPartition_G                      7
+#define MC_GrabberPartition_H                      8
+#define MC_GrabberPartition_I                      9
+#define MC_NextGrabberPartition                  (MCPARAMID)( 2014 << 14)
+#define MC_NextGrabberPartition_A                  1
+#define MC_NextGrabberPartition_B                  2
+#define MC_NextGrabberPartition_C                  3
+#define MC_NextGrabberPartition_D                  4
+#define MC_NextGrabberPartition_E                  5
+#define MC_NextGrabberPartition_F                  6
+#define MC_NextGrabberPartition_G                  7
+#define MC_NextGrabberPartition_H                  8
+#define MC_NextGrabberPartition_I                  9
+#define MC_NextGrabberPartition_HOLD              10
+#define MC_ConfigGrabberFailure_InvalidPartition   8
+#define MC_NextGrabberPartition_A111              11
+#define MC_NextGrabberPartition_B222              12
+#define MC_NextGrabberPartition_C222              13
+#define MC_NextGrabberPartition_D222              14
+#define MC_GrabberPartition_A111                  10
+#define MC_GrabberPartition_B222                  11
+#define MC_GrabberPartition_C222                  12
+#define MC_GrabberPartition_D222                  13
+#define MC_NextGrabberPartition_A112              15
+#define MC_NextGrabberPartition_B221              16
+#define MC_NextGrabberPartition_C221              17
+#define MC_NextGrabberPartition_D221              18
+#define MC_NextGrabberPartition_E330              19
+#define MC_NextGrabberPartition_F330              20
+#define MC_GrabberPartition_A112                  14
+#define MC_GrabberPartition_B221                  15
+#define MC_GrabberPartition_C221                  16
+#define MC_GrabberPartition_D221                  17
+#define MC_GrabberPartition_E330                  18
+#define MC_GrabberPartition_F330                  19
+#define MC_GrabberPartition_A131                  20
+#define MC_GrabberPartition_F131                  21
+#define MC_GrabberPartition_G131                  22
+#define MC_GrabberPartition_C231                  23
+#define MC_GrabberPartition_F231                  24
+#define MC_GrabberPartition_H111111               25
+#define MC_GrabberPartition_I111111               26
+#define MC_NextGrabberPartition_A131              21
+#define MC_NextGrabberPartition_F131              22
+#define MC_NextGrabberPartition_G131              23
+#define MC_NextGrabberPartition_C231              24
+#define MC_NextGrabberPartition_F231              25
+#define MC_NextGrabberPartition_H111111           26
+#define MC_NextGrabberPartition_I111111           27
+#define MC___BISConnector_Check                  (MCPARAMID)( 2015 << 14)
+#define MC___BISConnector_Check_PASS               1
+#define MC___BISConnector_Check_FAIL               2
+#define MC___TAG_Check                           (MCPARAMID)( 2016 << 14)
+#define MC___TAG_Check_PASS                        1
+#define MC___TAG_Check_FAIL                        2
+#define MC__HBC_HPHAS                            (MCPARAMID)( 2017 << 14)
+#define MC__Category_Sequence_Control             25
+#define MC___SequenceLoad_Check                  (MCPARAMID)( 2018 << 14)
+#define MC___SequenceLoad_Check_PASS               1
+#define MC___SequenceLoad_Check_FAIL               2
+#define MC___WaitCamSync                         (MCPARAMID)( 2019 << 14)
+#define MC___WaitCamSync_OFF                       1
+#define MC___WaitCamSync_ON                        2
+#define MC_TXState                               (MCPARAMID)( 2020 << 14)
+#define MC_TXState_STOPPED                         1
+#define MC_TXState_RUNNING                         2
+#define MC_TYState                               (MCPARAMID)( 2021 << 14)
+#define MC_TYState_STOPPED                         1
+#define MC_TYState_RUNNING                         2
+#define MC_TUState                               (MCPARAMID)( 2022 << 14)
+#define MC_TUState_STOPPED                         1
+#define MC_TUState_RUNNING                         2
+#define MC__CamConfigX                           (MCPARAMID)( 2023 << 14)
+#define MC__CamConfigY                           (MCPARAMID)( 2024 << 14)
+#define MC__CamConfig                            (MCPARAMID)( 2025 << 14)
+#define MC_PartialPage                           (MCPARAMID)( 2026 << 14)
+#define MC_LineCount                             (MCPARAMID)( 2027 << 14)
+#define MC__VLC_LCSNS_PARTIALPAGE                  3
+#define MC__VLC_PartialLCNT                      (MCPARAMID)( 2028 << 14)
+#define MC__STM1_T1SCAL_200ns                      7
+#define MC__PRM1_T1POS_SIG1On                    (MCPARAMID)( 2029 << 14)
+#define MC__PRM1_T1POS_SIG1Off                   (MCPARAMID)( 2030 << 14)
+#define MC__SCC_CC1_T1SIG1                         9
+#define MC__SCC_CC1_T1SIG2                        10
+#define MC__SCC_CC1_T1SIG1n                       11
+#define MC__SCC_CC1_T1SIG2n                       12
+#define MC__SCC_CC2_T1SIG1                         9
+#define MC__SCC_CC2_T1SIG2                        10
+#define MC__SCC_CC2_T1SIG1n                       11
+#define MC__SCC_CC2_T1SIG2n                       12
+#define MC__SCC_CC3_T1SIG1                        13
+#define MC__SCC_CC3_T1SIG2                        14
+#define MC__SCC_CC3_T1SIG1n                       15
+#define MC__SCC_CC3_T1SIG2n                       16
+#define MC__SCC_CC4_T1SIG1                        11
+#define MC__SCC_CC4_T1SIG2                        12
+#define MC__SCC_CC4_T1SIG1n                       13
+#define MC__SCC_CC4_T1SIG2n                       14
+#define MC__PRM1_T1POS_xx                        (MCPARAMID)( 2031 << 14)
+#define MC__PRM1_T1DEF_xx                        (MCPARAMID)( 2032 << 14)
+#define MC__PRM1_T1DEF_01                        (MCPARAMID)( 2033 << 14)
+#define MC__PRM1_T1POS_01                        (MCPARAMID)( 2034 << 14)
+#define MC__PRM1_T1DEF_02                        (MCPARAMID)( 2035 << 14)
+#define MC__PRM1_T1POS_02                        (MCPARAMID)( 2036 << 14)
+#define MC__PRM1_T1DEF_03                        (MCPARAMID)( 2037 << 14)
+#define MC__PRM1_T1POS_03                        (MCPARAMID)( 2038 << 14)
+#define MC__PRM1_T1DEF_04                        (MCPARAMID)( 2039 << 14)
+#define MC__PRM1_T1POS_04                        (MCPARAMID)( 2040 << 14)
+#define MC__PRM1_T1DEF_05                        (MCPARAMID)( 2041 << 14)
+#define MC__PRM1_T1POS_05                        (MCPARAMID)( 2042 << 14)
+#define MC__PRM1_T1DEF_06                        (MCPARAMID)( 2043 << 14)
+#define MC__PRM1_T1POS_06                        (MCPARAMID)( 2044 << 14)
+#define MC__PRM1_T1DEF_07                        (MCPARAMID)( 2045 << 14)
+#define MC__PRM1_T1POS_07                        (MCPARAMID)( 2046 << 14)
+#define MC__PRM1_T1DEF_08                        (MCPARAMID)( 2047 << 14)
+#define MC__PRM1_T1POS_08                        (MCPARAMID)( 2048 << 14)
+#define MC__PRM1_T1DEF_09                        (MCPARAMID)( 2049 << 14)
+#define MC__PRM1_T1POS_09                        (MCPARAMID)( 2050 << 14)
+#define MC__PRM1_T1DEF_10                        (MCPARAMID)( 2051 << 14)
+#define MC__PRM1_T1POS_10                        (MCPARAMID)( 2052 << 14)
+#define MC__PRM1_T1DEF_11                        (MCPARAMID)( 2053 << 14)
+#define MC__PRM1_T1POS_11                        (MCPARAMID)( 2054 << 14)
+#define MC__PRM1_T1DEF_12                        (MCPARAMID)( 2055 << 14)
+#define MC__PRM1_T1POS_12                        (MCPARAMID)( 2056 << 14)
+#define MC__PRM1_T1DEF_13                        (MCPARAMID)( 2057 << 14)
+#define MC__PRM1_T1POS_13                        (MCPARAMID)( 2058 << 14)
+#define MC__PRM1_T1DEF_14                        (MCPARAMID)( 2059 << 14)
+#define MC__PRM1_T1POS_14                        (MCPARAMID)( 2060 << 14)
+#define MC__PRM1_T1DEF_15                        (MCPARAMID)( 2061 << 14)
+#define MC__PRM1_T1POS_15                        (MCPARAMID)( 2062 << 14)
+#define MC__PRM1_T1DEF_16                        (MCPARAMID)( 2063 << 14)
+#define MC__PRM1_T1POS_16                        (MCPARAMID)( 2064 << 14)
+#define MC__RESETOn_T1                           (MCPARAMID)( 2065 << 14)
+#define MC__RESETOff_T1                          (MCPARAMID)( 2066 << 14)
+#define MC__AUXRESETOn_T1                        (MCPARAMID)( 2067 << 14)
+#define MC__AUXRESETOff_T1                       (MCPARAMID)( 2068 << 14)
+#define MC__STROBEOn_T1                          (MCPARAMID)( 2069 << 14)
+#define MC__STROBEOff_T1                         (MCPARAMID)( 2070 << 14)
+#define MC__USEROn_T1                            (MCPARAMID)( 2071 << 14)
+#define MC__USEROff_T1                           (MCPARAMID)( 2072 << 14)
+#define MC__SQ1_T1                               (MCPARAMID)( 2073 << 14)
+#define MC__T1Avail_T1                           (MCPARAMID)( 2074 << 14)
+#define MC__STROBEWidth_T1                       (MCPARAMID)( 2075 << 14)
+#define MC__TrueExp_T1                           (MCPARAMID)( 2076 << 14)
+#define MC__Category_Timers_Control               26
+#define MC__ResetDur_T1                          (MCPARAMID)( 2077 << 14)
+#define MC__T1Span_T1                            (MCPARAMID)( 2078 << 14)
+#define MC__ReadoutDur_T1                        (MCPARAMID)( 2079 << 14)
+#define MC_LUT0                                  (MCPARAMID)( 2080 << 14)
+#define MC_TOTOa                                 (MCPARAMID)( 2081 << 14)
+#define MC_TOTOa_NO_VALUE                          1
+#define MC_TOTOa_NO_VALUE2                         2
+#define MC_TOTOb                                 (MCPARAMID)( 2082 << 14)
+#define MC_TOTOb_NO_VALUE                          1
+#define MC_TOTOb_NO_VALUE2                         2
+#define MC_TOTOc                                 (MCPARAMID)( 2083 << 14)
+#define MC_TOTOc_NO_VALUE                          1
+#define MC_TOTOc_NO_VALUE2                         2
+#define MC__LUT0                                 (MCPARAMID)( 2084 << 14)
+#define MC__LUT1                                 (MCPARAMID)( 2085 << 14)
+#define MC__LUT2                                 (MCPARAMID)( 2086 << 14)
+#define MC__LUTMODE                              (MCPARAMID)( 2087 << 14)
+#define MC__LUTMODE_BYPASS                         1
+#define MC__LUTMODE_SINGLE                         2
+#define MC__LUTMODE_TRIPLE                         3
+#define MC__LUT0_0                                 1
+#define MC__LUT0_1                                 2
+#define MC__LUT0_2                                 3
+#define MC__LUT0_3                                 4
+#define MC__LUT0_4                                 5
+#define MC__LUT0_titi                              6
+#define MC__LUT0_tutu                              7
+#define MC__LUT1_titi                              1
+#define MC__LUT1_tutu                              2
+#define MC__LUT2_titi                              1
+#define MC__LUT2_tutu                              2
+#define MC__LUTAVAILABLE                         (MCPARAMID)( 2088 << 14)
+#define MC__LUTAVAILABLE_NONE                      1
+#define MC__LUTAVAILABLE_SINGLE8                   2
+#define MC__LUTAVAILABLE_TRIPLE8                   3
+#define MC__LUTAVAILABLE_SINGLE10                  4
+#define MC__LUTAVAILABLE_TRIPLE10                  5
+#define MC__T2POS                                (MCPARAMID)( 2089 << 14)
+#define MC__PRM2_T2POS                           (MCPARAMID)( 2090 << 14)
+#define MC__STM2_T2CLK                           (MCPARAMID)( 2091 << 14)
+#define MC__STM2_T2CLK_T1CLK                       1
+#define MC__STM2_T2CLK_LTRIG                       2
+#define MC__STM2_T2CLK_PPLS                        3
+#define MC__STM2_T2SEL_FTRIGS                      7
+#define MC__STM2_T2SEL_SAP                         8
+#define MC__STM2_T2SEL_EAP                         9
+#define MC__STB_Qx1SRC_T1SIG3                      7
+#define MC__STB_Qx1SRC_T1SIG4                      8
+#define MC__STB_Qx1POL                           (MCPARAMID)( 2092 << 14)
+#define MC__STB_Qx1POL_DIRECT                      1
+#define MC__STB_Qx1POL_INVERT                      2
+#define MC__STB_Qx2SRC_T1SIG3                      7
+#define MC__STB_Qx2SRC_T1SIG4                      8
+#define MC__STB_Qx2POL                           (MCPARAMID)( 2093 << 14)
+#define MC__STB_Qx2POL_DIRECT                      1
+#define MC__STB_Qx2POL_INVERT                      2
+#define MC__STB_Qx1POL_HOLD                        3
+#define MC__STB_Qx2POL_HOLD                        3
+#define MC__STR_STXPOL                           (MCPARAMID)( 2094 << 14)
+#define MC__STR_STXPOL_DIRECT                      1
+#define MC__STR_STXPOL_INVERT                      2
+#define MC__STR_STXPOL_HOLD                        3
+#define MC__STR_STXSRC                           (MCPARAMID)( 2095 << 14)
+#define MC__STR_STXSRC_LOW                         1
+#define MC__STR_STXSRC_T1SIG3_X                    2
+#define MC__STR_STXSRC_T1SIG4_X                    3
+#define MC__STR_STXSRC_HOLD                        4
+#define MC__STM1_T1SEL                           (MCPARAMID)( 2096 << 14)
+#define MC__STM1_T1SEL_FTRIGS                      1
+#define MC__STM1_T1SEL_LTRIGS                      2
+#define MC__STM1_T1SEL_PPLS                        3
+#define MC__STM1_T1SEL_OFF                         4
+#define MC__STR_STXSPOL                          (MCPARAMID)( 2097 << 14)
+#define MC__STR_STXSPOL_DIRECT                     1
+#define MC__STR_STXSPOL_INVERT                     2
+#define MC__STR_STXSPOL_HOLD                       3
+#define MC__STR_STXSRC_T1SIG3_Y                    5
+#define MC__STR_STXSRC_T1SIG4_Y                    6
+#define MC__STR_STYSPOL                          (MCPARAMID)( 2098 << 14)
+#define MC__STR_STYSPOL_DIRECT                     1
+#define MC__STR_STYSPOL_INVERT                     2
+#define MC__STR_STYSPOL_HOLD                       3
+#define MC__STR_STZSPOL                          (MCPARAMID)( 2099 << 14)
+#define MC__STR_STZSPOL_DIRECT                     1
+#define MC__STR_STZSPOL_INVERT                     2
+#define MC__STR_STZSPOL_HOLD                       3
+#define MC__STR_STYPOL                           (MCPARAMID)( 2100 << 14)
+#define MC__STR_STYPOL_DIRECT                      1
+#define MC__STR_STYPOL_INVERT                      2
+#define MC__STR_STYPOL_HOLD                        3
+#define MC__STR_STZPOL                           (MCPARAMID)( 2101 << 14)
+#define MC__STR_STZPOL_DIRECT                      1
+#define MC__STR_STZPOL_INVERT                      2
+#define MC__STR_STZPOL_HOLD                        3
+#define MC__STR_STYSRC                           (MCPARAMID)( 2102 << 14)
+#define MC__STR_STYSRC_LOW                         1
+#define MC__STR_STYSRC_T1SIG3_X                    2
+#define MC__STR_STYSRC_T1SIG4_X                    3
+#define MC__STR_STYSRC_T1SIG3_Y                    4
+#define MC__STR_STYSRC_T1SIG4_Y                    5
+#define MC__STR_STYSRC_HOLD                        6
+#define MC__STR_STZSRC                           (MCPARAMID)( 2103 << 14)
+#define MC__STR_STZSRC_LOW                         1
+#define MC__STR_STZSRC_T1SIG3_X                    2
+#define MC__STR_STZSRC_T1SIG4_X                    3
+#define MC__STR_STZSRC_T1SIG3_Y                    4
+#define MC__STR_STZSRC_T1SIG4_Y                    5
+#define MC__STR_STZSRC_HOLD                        6
+#define MC__STB_Qx1SRC_T1SIG3_Inverted             9
+#define MC__STB_Qx1SRC_T1SIG4_Inverted            10
+#define MC__STB_Qx1SRC_HOLD                       11
+#define MC__STB_Qx2SRC_T1SIG3_Inverted             9
+#define MC__STB_Qx2SRC_T1SIG4_Inverted            10
+#define MC__STB_Qx2SRC_HOLD                       11
+#define MC__INITC_USY                            (MCPARAMID)( 2104 << 14)
+#define MC__INITC_USY_TY2Y                         1
+#define MC__INITC_USY_TX2Y                         2
+#define MC__4xFsc_Color_kHz                      (MCPARAMID)( 2105 << 14)
+#define MC__SampledPixels_Ln                     (MCPARAMID)( 2106 << 14)
+#define MC__STEPX1                               (MCPARAMID)( 2107 << 14)
+#define MC__STEPX2                               (MCPARAMID)( 2108 << 14)
+#define MC__STEPX3                               (MCPARAMID)( 2109 << 14)
+#define MC__STEPY1                               (MCPARAMID)( 2110 << 14)
+#define MC__STEPY2                               (MCPARAMID)( 2111 << 14)
+#define MC__STEPY3                               (MCPARAMID)( 2112 << 14)
+#define MC_Connector_STEREOXY                     19
+#define MC_NextConfigGrabber_mSTEREOXY             8
+#define MC_ConfigGrabber_pSTEREOXY                15
+#define MC_ConfigGrabber_mSTEREOXY                16
+#define MC__Cameras                              (MCPARAMID)( 2113 << 14)
+#define MC__TkPx                                 (MCPARAMID)( 2114 << 14)
+#define MC__Images                               (MCPARAMID)( 2115 << 14)
+#define MC_NextGrabberConfig_STEREOXY             89
+#define MC_GrabberConfig_STEREOXY                 92
+#define MC_OutputConfig_Filter_21                (MCPARAMID)( 2116 << 14)
+#define MC_OutputState_Filter_21                 (MCPARAMID)( 2117 << 14)
+#define MC_OutputState_21                        (MCPARAMID)( 2118 << 14)
+#define MC_OutputState_21_HOLD                     1
+#define MC_OutputState_21_LOW                      2
+#define MC_OutputState_21_HIGH                     3
+#define MC_OutputStyle_Filter_21                 (MCPARAMID)( 2119 << 14)
+#define MC_OutputConfig_Filter_22                (MCPARAMID)( 2120 << 14)
+#define MC_OutputState_Filter_22                 (MCPARAMID)( 2121 << 14)
+#define MC_OutputState_22                        (MCPARAMID)( 2122 << 14)
+#define MC_OutputState_22_HOLD                     1
+#define MC_OutputState_22_LOW                      2
+#define MC_OutputState_22_HIGH                     3
+#define MC_OutputStyle_Filter_22                 (MCPARAMID)( 2123 << 14)
+#define MC_OutputConfig_Filter_23                (MCPARAMID)( 2124 << 14)
+#define MC_OutputState_Filter_23                 (MCPARAMID)( 2125 << 14)
+#define MC_OutputState_23                        (MCPARAMID)( 2126 << 14)
+#define MC_OutputState_23_HOLD                     1
+#define MC_OutputState_23_LOW                      2
+#define MC_OutputState_23_HIGH                     3
+#define MC_OutputStyle_Filter_23                 (MCPARAMID)( 2127 << 14)
+#define MC_OutputConfig_Filter_24                (MCPARAMID)( 2128 << 14)
+#define MC_OutputState_Filter_24                 (MCPARAMID)( 2129 << 14)
+#define MC_OutputState_24                        (MCPARAMID)( 2130 << 14)
+#define MC_OutputState_24_HOLD                     1
+#define MC_OutputState_24_LOW                      2
+#define MC_OutputState_24_HIGH                     3
+#define MC_OutputStyle_Filter_24                 (MCPARAMID)( 2131 << 14)
+#define MC_OutputConfig_Filter_31                (MCPARAMID)( 2132 << 14)
+#define MC_OutputState_Filter_31                 (MCPARAMID)( 2133 << 14)
+#define MC_OutputState_31                        (MCPARAMID)( 2134 << 14)
+#define MC_OutputState_31_HOLD                     1
+#define MC_OutputState_31_LOW                      2
+#define MC_OutputState_31_HIGH                     3
+#define MC_OutputStyle_Filter_31                 (MCPARAMID)( 2135 << 14)
+#define MC_OutputConfig_Filter_32                (MCPARAMID)( 2136 << 14)
+#define MC_OutputState_Filter_32                 (MCPARAMID)( 2137 << 14)
+#define MC_OutputState_32                        (MCPARAMID)( 2138 << 14)
+#define MC_OutputState_32_HOLD                     1
+#define MC_OutputState_32_LOW                      2
+#define MC_OutputState_32_HIGH                     3
+#define MC_OutputStyle_Filter_32                 (MCPARAMID)( 2139 << 14)
+#define MC_OutputConfig_Filter_33                (MCPARAMID)( 2140 << 14)
+#define MC_OutputState_Filter_33                 (MCPARAMID)( 2141 << 14)
+#define MC_OutputState_33                        (MCPARAMID)( 2142 << 14)
+#define MC_OutputState_33_HOLD                     1
+#define MC_OutputState_33_LOW                      2
+#define MC_OutputState_33_HIGH                     3
+#define MC_OutputStyle_Filter_33                 (MCPARAMID)( 2143 << 14)
+#define MC_OutputConfig_Filter_34                (MCPARAMID)( 2144 << 14)
+#define MC_OutputState_Filter_34                 (MCPARAMID)( 2145 << 14)
+#define MC_OutputState_34                        (MCPARAMID)( 2146 << 14)
+#define MC_OutputState_34_HOLD                     1
+#define MC_OutputState_34_LOW                      2
+#define MC_OutputState_34_HIGH                     3
+#define MC_OutputStyle_Filter_34                 (MCPARAMID)( 2147 << 14)
+#define MC_OutputStyle_LVDS                        8
+#define MC_OffsetD1WaitAft                       (MCPARAMID)( 2148 << 14)
+#define MC_INITD1State                           (MCPARAMID)( 2149 << 14)
+#define MC_INITD1Signature1                      (MCPARAMID)( 2150 << 14)
+#define MC_INITD1Signature2                      (MCPARAMID)( 2151 << 14)
+#define MC_INITD1Condition                       (MCPARAMID)( 2152 << 14)
+#define MC_TrigDelay_us                          (MCPARAMID)( 2153 << 14)
+#define MC_TriggerDelay_Tk                       (MCPARAMID)( 2154 << 14)
+#define MC_TrigDelay_Tk                          (MCPARAMID)( 2155 << 14)
+#define MC_TrigDelay_E                           (MCPARAMID)( 2156 << 14)
+#define MC_TrueTrigDelay_Tk                      (MCPARAMID)( 2157 << 14)
+#define MC_TrueTrigDelay_us                      (MCPARAMID)( 2158 << 14)
+#define MC__SampleClk_KHz                        (MCPARAMID)( 2159 << 14)
+#define MC_TrigDelay_T1                          (MCPARAMID)( 2160 << 14)
+#define MC_INITCrecord                           (MCPARAMID)( 2161 << 14)
+#define MC_INITCsignature                        (MCPARAMID)( 2162 << 14)
+#define MC_INITCcondition                        (MCPARAMID)( 2163 << 14)
+#define MC_OUTPUTrecord                          (MCPARAMID)( 2164 << 14)
+#define MC_OUT17index                            (MCPARAMID)( 2165 << 14)
+#define MC_OUT17signature                        (MCPARAMID)( 2166 << 14)
+#define MC_OUT17condition                        (MCPARAMID)( 2167 << 14)
+#define MC_OUT18index                            (MCPARAMID)( 2168 << 14)
+#define MC_OUT18signature                        (MCPARAMID)( 2169 << 14)
+#define MC_OUT18condition                        (MCPARAMID)( 2170 << 14)
+#define MC_OUT19index                            (MCPARAMID)( 2171 << 14)
+#define MC_OUT19signature                        (MCPARAMID)( 2172 << 14)
+#define MC_OUT19condition                        (MCPARAMID)( 2173 << 14)
+#define MC_MANTRIGcondition                      (MCPARAMID)( 2174 << 14)
+#define MC__HactiveMax_Px                        (MCPARAMID)( 2175 << 14)
+#define MC_ImageXStep_Px                         (MCPARAMID)( 2176 << 14)
+#define MC_ImageYStep_Ln                         (MCPARAMID)( 2177 << 14)
+#define MC_RoundedOffsetX_Px                     (MCPARAMID)( 2178 << 14)
+#define MC_RoundedOffsetY_Ln                     (MCPARAMID)( 2179 << 14)
+#define MC_FifoOffsetX                           (MCPARAMID)( 2180 << 14)
+#define MC_FifoOffsetY                           (MCPARAMID)( 2181 << 14)
+#define MC_HTotal_Px                             (MCPARAMID)( 2182 << 14)
+#define MC_ImageSizingX_VARIABLE                   2
+#define MC_ImageOffset_X                         (MCPARAMID)( 2183 << 14)
+#define MC_ImageOffset_Y                         (MCPARAMID)( 2184 << 14)
+#define MC_ImageOffsetX                          (MCPARAMID)( 2185 << 14)
+#define MC_ImageOffsetY                          (MCPARAMID)( 2186 << 14)
+#define MC__Category__Grabber_LUT                 27
+#define MC__Category_zGrabber_LUT                 28
+#define MC__STM1_T1SEL_OnLTRIGS                    5
+#define MC__STM1_T1SEL_OnLTRIGE                    6
+#define MC__STM1_T1SEL_OnPPLS                      7
+#define MC__STM1_T1SEL_OnGO1                       8
+#define MC__STM1_T1SEL_OnEND2                      9
+#define MC__STM2_T2CLK_EOL                         4
+#define MC__STROBEWidth_us                       (MCPARAMID)( 2187 << 14)
+#define MC__StrobeStart_us                       (MCPARAMID)( 2188 << 14)
+#define MC__EXPOSEStart_T1                       (MCPARAMID)( 2189 << 14)
+#define MC_Camera_VCC_810                        126
+#define MC_PreStrobe_us                          (MCPARAMID)( 2190 << 14)
+#define MC_ImagePlaneSize                        (MCPARAMID)( 2191 << 14)
+#define MC__EXPOn2STROBEOff_T1                   (MCPARAMID)( 2192 << 14)
+#define MC__PREEXPWidth_T1                       (MCPARAMID)( 2193 << 14)
+#define MC__DRS_CSOL_LTriggeredLVALS               6
+#define MC__SrobeWidth_us                        (MCPARAMID)( 2194 << 14)
+#define MC__ExposeRecovery_T1                    (MCPARAMID)( 2195 << 14)
+#define MC__MaxTimer1TriggerRate_Hz              (MCPARAMID)( 2196 << 14)
+#define MC__EXPOn_T1                             (MCPARAMID)( 2197 << 14)
+#define MC__EXPOff_T1                            (MCPARAMID)( 2198 << 14)
+#define MC__HactiveRef_Px                        (MCPARAMID)( 2199 << 14)
+#define MC__VactiveRef_Ln                        (MCPARAMID)( 2200 << 14)
+#define MC__RoundedActiveSizeX                   (MCPARAMID)( 2201 << 14)
+#define MC__RoundedActiveSizeY                   (MCPARAMID)( 2202 << 14)
+#define MC_ActiveXStep_Px                        (MCPARAMID)( 2203 << 14)
+#define MC__PREEXPWidth_us                       (MCPARAMID)( 2204 << 14)
+#define MC__StrobeStop_us                        (MCPARAMID)( 2205 << 14)
+#define MC___MAXIMUM_T1                          (MCPARAMID)( 2206 << 14)
+#define MC_Camera_VCC_850A                       127
+#define MC_Camera_VCC_870A                       128
+#define MC__CTD_TDSCAL                           (MCPARAMID)( 2207 << 14)
+#define MC__CTD_TDSCAL_1us                         1
+#define MC__CTD_TDSCAL_10us                        2
+#define MC__CTD_TDSCAL_100us                       3
+#define MC__CTD_TDSCAL_1ms                         4
+#define MC__TD_us                                (MCPARAMID)( 2208 << 14)
+#define MC_TrigDelay_TD                          (MCPARAMID)( 2209 << 14)
+#define MC__CTD_TDCLK                            (MCPARAMID)( 2210 << 14)
+#define MC__CTD_TDCLK_PRESCAL                      1
+#define MC__CTD_TDCLK_LTRIG                        2
+#define MC__CTD_TDCLK_PPLS                         3
+#define MC__CTD_TDCLK_EOL                          4
+#define MC__CTD_TDMOD                            (MCPARAMID)( 2211 << 14)
+#define MC__CTD_TDMOD_Bypass                       1
+#define MC__CTD_TDMOD_Enable                       2
+#define MC__CTD_TDCNT                            (MCPARAMID)( 2212 << 14)
+#define MC__CTD_TDSCAL_ns                        (MCPARAMID)( 2213 << 14)
+#define MC_TrueTrigDelay_ns                      (MCPARAMID)( 2214 << 14)
+#define MC_Connector_VID1                         20
+#define MC_Connector_VID2                         21
+#define MC_Connector_VID3                         22
+#define MC_Connector_VID4                         23
+#define MC_Connector_VID5                         24
+#define MC_Connector_VID6                         25
+#define MC_Connector_VID7                         26
+#define MC_Connector_VID8                         27
+#define MC_Connector_VID9                         28
+#define MC_Connector_VID10                        29
+#define MC_Connector_VID11                        30
+#define MC_Connector_VID12                        31
+#define MC_Connector_VID13                        32
+#define MC_Connector_VID14                        33
+#define MC_Connector_VID15                        34
+#define MC_Connector_VID16                        35
+#define MC_TrigLine_PG                            12
+#define MC_TrigLine_LTACT                         13
+#define MC__TrigLine_PG                           18
+#define MC__TrigLine_LTACT                        19
+#define MC__TRG_FTSEL_PG                          15
+#define MC__TRG_FTSEL_LTACT                       16
+#define MC_PGRCUsage                             (MCPARAMID)( 2215 << 14)
+#define MC_PGRCUsage_Unused                        1
+#define MC_PGRCUsage_PG_FT                         2
+#define MC_PGRCUsage_LTActFT                       3
+#define MC_PGRCUsage_PG_LT                         4
+#define MC_PGRCUsage_PG_PT                         5
+#define MC_PGRCUsage_RC_LTActPT                    6
+#define MC__PG_Check                             (MCPARAMID)( 2216 << 14)
+#define MC__PG_Check_PASS                          1
+#define MC__PG_Check_FAIL                          2
+#define MC__LTACT_Check                          (MCPARAMID)( 2217 << 14)
+#define MC__LTACT_Check_PASS                       1
+#define MC__LTACT_Check_FAIL                       2
+#define MC__TrigLine_PGA                          20
+#define MC__TrigLine_LTACTA                       21
+#define MC__TrigLine_PGB                          22
+#define MC__TrigLine_LTACTB                       23
+#define MC__PGRCUsage_Check                      (MCPARAMID)( 2218 << 14)
+#define MC__PGRCUsage_Check_PASS                   1
+#define MC__PGRCUsage_Check_FAIL                   2
+#define MC_PostReadoutRecovery_us                (MCPARAMID)( 2219 << 14)
+#define MC__EAP2EXPOn_us                         (MCPARAMID)( 2220 << 14)
+#define MC__EAP2EXPOn_T1                         (MCPARAMID)( 2221 << 14)
+#define MC__Category_Grabber_LUT                  29
+#define MC__DRS_CSOL_PickedOutLVALS                7
+#define MC_FrameRate_mHz                         (MCPARAMID)( 2222 << 14)
+#define MC_FrameDur_us                           (MCPARAMID)( 2223 << 14)
+#define MC_STXUsage_PPLS                           4
+#define MC_STYUsage_PPLS                           4
+#define MC__STR_STXSRC_PPLS_X                      7
+#define MC__STR_STYSRC_PPLS_Y                      7
+#define MC_STRUsage_PPLS                           3
+#define MC_ColorFormat                           (MCPARAMID)( 2224 << 14)
+#define MC_ColorFormat_RGB24                       1
+#define MC_ColorFormat_BGR24                       2
+#define MC_ColorFormat_RGB32                       3
+#define MC_ColorFormat_BGR32                       4
+#define MC_ColorFormat_RGB16                       5
+#define MC_ColorFormat_RGB15                       6
+#define MC_ColorFormat_Y8                          7
+#define MC_ColorFormat_YUV422                      8
+#define MC_ColorGain                             (MCPARAMID)( 2225 << 14)
+#define MC_ColorGainTrimU                        (MCPARAMID)( 2226 << 14)
+#define MC_ColorGainTrimV                        (MCPARAMID)( 2227 << 14)
+#define MC_ColorGainTrimHue                      (MCPARAMID)( 2228 << 14)
+#define MC__Contrast                             (MCPARAMID)( 2229 << 14)
+#define MC__Brightness                           (MCPARAMID)( 2230 << 14)
+#define MC__SaturationU                          (MCPARAMID)( 2231 << 14)
+#define MC__SaturationV                          (MCPARAMID)( 2232 << 14)
+#define MC__Hue                                  (MCPARAMID)( 2233 << 14)
+#define MC_Camera_COLIBRI2048CL                  129
+#define MC_CamConfig_L2048RGM                    179
+#define MC_Manufacturer_TVI                       21
+#define MC_Camera_CAMERA_CCIR                    130
+#define MC_Camera_CAMERA_EIA                     131
+#define MC_Camera_CAMERA_PAL                     132
+#define MC_Camera_CAMERA_NTSC                    133
+#define MC____Camera                             (MCPARAMID)( 2234 << 14)
+#define MC____Camera_CCIR                          1
+#define MC____Camera_EIA                           2
+#define MC____Camera_PAL                           3
+#define MC____Camera_NTSC                          4
+#define MC__NormalSizeX_px                       (MCPARAMID)( 2235 << 14)
+#define MC__NormalOffsetX_Px                     (MCPARAMID)( 2236 << 14)
+#define MC__SamplingScaleX                       (MCPARAMID)( 2237 << 14)
+#define MC__UserScaleX                           (MCPARAMID)( 2238 << 14)
+#define MC__FullScaleX                           (MCPARAMID)( 2239 << 14)
+#define MC__FullOffsetX_Px                       (MCPARAMID)( 2240 << 14)
+#define MC_ColorGainTrimHue_Filter               (MCPARAMID)( 2241 << 14)
+#define MC_Camera_COLIBRI1024CL                  134
+#define MC_Camera_MyCameraLink                   135
+#define MC_CamConfig_L1024RGM                    180
+#define MC_CamConfig_PxxSC                       181
+#define MC_CamConfig_PxxRC                       182
+#define MC_CamConfig_PxxRG                       183
+#define MC_CamConfig_IxxSC                       184
+#define MC_CamConfig_LxxxxSP                     185
+#define MC_CamConfig_LxxxxRC                     186
+#define MC_CamConfig_LxxxxRG                     187
+#define MC__FullOffsetY_Ln                       (MCPARAMID)( 2242 << 14)
+#define MC__NormalSizeY_Ln                       (MCPARAMID)( 2243 << 14)
+#define MC__FullScaleY                           (MCPARAMID)( 2244 << 14)
+#define MC__FullFrameSizeY_Ln                    (MCPARAMID)( 2245 << 14)
+#define MC_Camera_PRICOLOR1024C                  136
+#define MC_Camera_PRICOLOR2048C                  137
+#define MC_dummydhfjsdhk                         (MCPARAMID)( 2246 << 14)
+#define MC_Camera_AViiVA_C2CL4010                138
+#define MC_CamConfig_L1365RG                     188
+#define MC_CamConfig_L4096RGS                    189
+#define MC_OutputState_WENTLOW                     8
+#define MC_OutputState_WENTHIGH                    9
+#define MC_OutputState_PULSE                      10
+#define MC_Camera_CV_M4CLp                       139
+#define MC_Camera_VCC_8350                       140
+#define MC_Camera_VCC_8550                       141
+#define MC_CamConfig_P60RM_A                     190
+#define MC_OutputConfig_Filter_41                (MCPARAMID)( 2247 << 14)
+#define MC_OutputState_Filter_41                 (MCPARAMID)( 2248 << 14)
+#define MC_OutputState_41                        (MCPARAMID)( 2249 << 14)
+#define MC_OutputState_41_HOLD                     1
+#define MC_OutputState_41_LOW                      2
+#define MC_OutputState_41_HIGH                     3
+#define MC_OutputConfig_Filter_42                (MCPARAMID)( 2250 << 14)
+#define MC_OutputState_Filter_42                 (MCPARAMID)( 2251 << 14)
+#define MC_OutputState_42                        (MCPARAMID)( 2252 << 14)
+#define MC_OutputState_42_HOLD                     1
+#define MC_OutputState_42_LOW                      2
+#define MC_OutputState_42_HIGH                     3
+#define MC_ColorStorage_WORD                       3
+#define MC_ColorStorage_Filter                   (MCPARAMID)( 2253 << 14)
+#define MC_ImagePixelAlign_Filter                (MCPARAMID)( 2254 << 14)
+#define MC__CameraColorFormat                    (MCPARAMID)( 2255 << 14)
+#define MC__CameraColorFormat_MONOCHROME           1
+#define MC__CameraColorFormat_BAYER                2
+#define MC__CameraColorFormat_ParallelRGB          3
+#define MC__CameraColorFormat_UNKNOWN              4
+#define MC_ColorFormat_GRABBER                     9
+#define MC_ColorFormat_Y10                        10
+#define MC_ColorFormat_Y12                        11
+#define MC_ColorFormat_Y14                        12
+#define MC_ColorFormat_Y16                        13
+#define MC_ColorFormat_BAYER8                     14
+#define MC_ColorFormat_BAYER10                    15
+#define MC_ColorFormat_BAYER12                    16
+#define MC_ColorFormat_BAYER14                    17
+#define MC_ColorFormat_BAYER16                    18
+#define MC_ColorFormat_RGB30                      19
+#define MC_ColorFormat_RGB36                      20
+#define MC_ColorFormat_RGB42                      21
+#define MC_ColorFormat_RGB48                      22
+#define MC_ColorFormat_ARGB32                     23
+#define MC_ColorFormat_RAW8                       24
+#define MC_ColorFormat_RAW10                      25
+#define MC_ColorFormat_RAW12                      26
+#define MC_ColorFormat_RAW14                      27
+#define MC_ColorFormat_RAW16                      28
+#define MC_ColorFormat_Filter                    (MCPARAMID)( 2256 << 14)
+#define MC___ColorFormat_Check                   (MCPARAMID)( 2257 << 14)
+#define MC___ColorFormat_Check_PASS                1
+#define MC___ColorFormat_Check_FAIL                2
+#define MC__BoardType__PICOLO_PRO3I               14
+#define MC_ConnectorCount                        (MCPARAMID)( 2258 << 14)
+#define MC_ColorFormat_RGB24PL                    29
+#define MC_ColorFormat_RGB30PL                    30
+#define MC_ColorFormat_RGB36PL                    31
+#define MC_ColorFormat_RGB42PL                    32
+#define MC_ColorFormat_RGB48PL                    33
+#define MC_ColorFormat_                          (MCPARAMID)( 2259 << 14)
+#define MC_ColorFormat__Y8                        34
+#define MC_ColorFormat__Y10                       35
+#define MC_ColorFormat__Y12                       36
+#define MC_ColorFormat__Y14                       37
+#define MC_ColorFormat__Y16                       38
+#define MC_ColorFormat__BAYER8                    39
+#define MC_ColorFormat__BAYER10                   40
+#define MC_ColorFormat__BAYER12                   41
+#define MC_ColorFormat__BAYER14                   42
+#define MC_ColorFormat__BAYER16                   43
+#define MC_ColorFormat__RGB24                     44
+#define MC_ColorFormat__ARGB32                    45
+#define MC_ColorFormat__RGB24PL                   46
+#define MC_ColorFormat__RGB30PL                   47
+#define MC_ColorFormat__RGB36PL                   48
+#define MC_ColorFormat__RGB42PL                   49
+#define MC_ColorFormat__RGB48PL                   50
+#define MC_ColorFormat__RAW8                      51
+#define MC_ColorFormat__RAW10                     52
+#define MC_ColorFormat__RAW12                     53
+#define MC_ColorFormat__RAW14                     54
+#define MC_ColorFormat__RAW16                     55
+#define MC_ColorFormat__GRABBER                   56
+#define MC_InputConfig_Filter_20                 (MCPARAMID)( 2260 << 14)
+#define MC_InputStyle_Filter_20                  (MCPARAMID)( 2261 << 14)
+#define MC_InputPinName_IO17                      40
+#define MC_InputPinName_IO18                      41
+#define MC_InputPinName_IO19                      42
+#define MC_InputPinName_IO20                      43
+#define MC_OutputPinName_IO17                     48
+#define MC_OutputPinName_IO18                     49
+#define MC_OutputPinName_IO19                     50
+#define MC_OutputPinName_IO20                     51
+#define MC_InputMaxId_1                          (MCPARAMID)( 2262 << 14)
+#define MC_InputMaxId_2                          (MCPARAMID)( 2263 << 14)
+#define MC_InputMaxId_3                          (MCPARAMID)( 2264 << 14)
+#define MC_InputMaxId_4                          (MCPARAMID)( 2265 << 14)
+#define MC_InputMaxId_5                          (MCPARAMID)( 2266 << 14)
+#define MC_InputMaxId_6                          (MCPARAMID)( 2267 << 14)
+#define MC_InputMaxId_7                          (MCPARAMID)( 2268 << 14)
+#define MC_InputMaxId_8                          (MCPARAMID)( 2269 << 14)
+#define MC_InputMaxId_9                          (MCPARAMID)( 2270 << 14)
+#define MC_InputMaxId_10                         (MCPARAMID)( 2271 << 14)
+#define MC_InputMaxId_11                         (MCPARAMID)( 2272 << 14)
+#define MC_InputMaxId_12                         (MCPARAMID)( 2273 << 14)
+#define MC_InputMaxId_13                         (MCPARAMID)( 2274 << 14)
+#define MC_InputMaxId_14                         (MCPARAMID)( 2275 << 14)
+#define MC_InputMaxId_15                         (MCPARAMID)( 2276 << 14)
+#define MC_InputMaxId_16                         (MCPARAMID)( 2277 << 14)
+#define MC_InputMaxId_17                         (MCPARAMID)( 2278 << 14)
+#define MC_InputMaxId_18                         (MCPARAMID)( 2279 << 14)
+#define MC_InputMaxId_19                         (MCPARAMID)( 2280 << 14)
+#define MC_InputMaxId_20                         (MCPARAMID)( 2281 << 14)
+#define MC_OutputConfig_Filter_20                (MCPARAMID)( 2282 << 14)
+#define MC_OutputState_Filter_20                 (MCPARAMID)( 2283 << 14)
+#define MC_OutputStyle_Filter_20                 (MCPARAMID)( 2284 << 14)
+#define MC_OutputState_20                        (MCPARAMID)( 2285 << 14)
+#define MC_OutputState_20_HOLD                     1
+#define MC_OutputState_20_LOW                      2
+#define MC_OutputState_20_HIGH                     3
+#define MC_MIO_0_Present                         (MCPARAMID)( 2286 << 14)
+#define MC_MIO_1_Present                         (MCPARAMID)( 2287 << 14)
+#define MC_MIO_2_Present                         (MCPARAMID)( 2288 << 14)
+#define MC_MIO_3_Present                         (MCPARAMID)( 2289 << 14)
+#define MC_MIO_4_Present                         (MCPARAMID)( 2290 << 14)
+#define MC___InputId_1                           (MCPARAMID)( 2291 << 14)
+#define MC___InputId_2                           (MCPARAMID)( 2292 << 14)
+#define MC___InputId_3                           (MCPARAMID)( 2293 << 14)
+#define MC___InputId_4                           (MCPARAMID)( 2294 << 14)
+#define MC___InputId_5                           (MCPARAMID)( 2295 << 14)
+#define MC___InputId_6                           (MCPARAMID)( 2296 << 14)
+#define MC___InputId_7                           (MCPARAMID)( 2297 << 14)
+#define MC___InputId_8                           (MCPARAMID)( 2298 << 14)
+#define MC___InputId_9                           (MCPARAMID)( 2299 << 14)
+#define MC___InputId_10                          (MCPARAMID)( 2300 << 14)
+#define MC___InputId_11                          (MCPARAMID)( 2301 << 14)
+#define MC___InputId_12                          (MCPARAMID)( 2302 << 14)
+#define MC___InputId_13                          (MCPARAMID)( 2303 << 14)
+#define MC___InputId_14                          (MCPARAMID)( 2304 << 14)
+#define MC___InputId_15                          (MCPARAMID)( 2305 << 14)
+#define MC___InputId_16                          (MCPARAMID)( 2306 << 14)
+#define MC___InputId_17                          (MCPARAMID)( 2307 << 14)
+#define MC___InputId_18                          (MCPARAMID)( 2308 << 14)
+#define MC___InputId_19                          (MCPARAMID)( 2309 << 14)
+#define MC___InputId_20                          (MCPARAMID)( 2310 << 14)
+#define MC___OutputId_1                          (MCPARAMID)( 2311 << 14)
+#define MC_OutputMaxId_1                         (MCPARAMID)( 2312 << 14)
+#define MC___OutputId_2                          (MCPARAMID)( 2313 << 14)
+#define MC_OutputMaxId_2                         (MCPARAMID)( 2314 << 14)
+#define MC___OutputId_3                          (MCPARAMID)( 2315 << 14)
+#define MC_OutputMaxId_3                         (MCPARAMID)( 2316 << 14)
+#define MC___OutputId_4                          (MCPARAMID)( 2317 << 14)
+#define MC_OutputMaxId_4                         (MCPARAMID)( 2318 << 14)
+#define MC___OutputId_5                          (MCPARAMID)( 2319 << 14)
+#define MC_OutputMaxId_5                         (MCPARAMID)( 2320 << 14)
+#define MC___OutputId_6                          (MCPARAMID)( 2321 << 14)
+#define MC_OutputMaxId_6                         (MCPARAMID)( 2322 << 14)
+#define MC___OutputId_7                          (MCPARAMID)( 2323 << 14)
+#define MC_OutputMaxId_7                         (MCPARAMID)( 2324 << 14)
+#define MC___OutputId_8                          (MCPARAMID)( 2325 << 14)
+#define MC_OutputMaxId_8                         (MCPARAMID)( 2326 << 14)
+#define MC___OutputId_9                          (MCPARAMID)( 2327 << 14)
+#define MC_OutputMaxId_9                         (MCPARAMID)( 2328 << 14)
+#define MC___OutputId_10                         (MCPARAMID)( 2329 << 14)
+#define MC_OutputMaxId_10                        (MCPARAMID)( 2330 << 14)
+#define MC___OutputId_11                         (MCPARAMID)( 2331 << 14)
+#define MC_OutputMaxId_11                        (MCPARAMID)( 2332 << 14)
+#define MC___OutputId_12                         (MCPARAMID)( 2333 << 14)
+#define MC_OutputMaxId_12                        (MCPARAMID)( 2334 << 14)
+#define MC___OutputId_13                         (MCPARAMID)( 2335 << 14)
+#define MC_OutputMaxId_13                        (MCPARAMID)( 2336 << 14)
+#define MC___OutputId_14                         (MCPARAMID)( 2337 << 14)
+#define MC_OutputMaxId_14                        (MCPARAMID)( 2338 << 14)
+#define MC___OutputId_15                         (MCPARAMID)( 2339 << 14)
+#define MC_OutputMaxId_15                        (MCPARAMID)( 2340 << 14)
+#define MC___OutputId_16                         (MCPARAMID)( 2341 << 14)
+#define MC_OutputMaxId_16                        (MCPARAMID)( 2342 << 14)
+#define MC___OutputId_17                         (MCPARAMID)( 2343 << 14)
+#define MC_OutputMaxId_17                        (MCPARAMID)( 2344 << 14)
+#define MC___OutputId_18                         (MCPARAMID)( 2345 << 14)
+#define MC_OutputMaxId_18                        (MCPARAMID)( 2346 << 14)
+#define MC___OutputId_19                         (MCPARAMID)( 2347 << 14)
+#define MC_OutputMaxId_19                        (MCPARAMID)( 2348 << 14)
+#define MC___OutputId_20                         (MCPARAMID)( 2349 << 14)
+#define MC_OutputMaxId_20                        (MCPARAMID)( 2350 << 14)
+#define MC___InputId_21                          (MCPARAMID)( 2351 << 14)
+#define MC_InputMaxId_21                         (MCPARAMID)( 2352 << 14)
+#define MC_InputStyle_Filter_21                  (MCPARAMID)( 2353 << 14)
+#define MC___InputId_22                          (MCPARAMID)( 2354 << 14)
+#define MC_InputMaxId_22                         (MCPARAMID)( 2355 << 14)
+#define MC_InputStyle_Filter_22                  (MCPARAMID)( 2356 << 14)
+#define MC___InputId_23                          (MCPARAMID)( 2357 << 14)
+#define MC_InputMaxId_23                         (MCPARAMID)( 2358 << 14)
+#define MC_InputStyle_Filter_23                  (MCPARAMID)( 2359 << 14)
+#define MC___InputId_24                          (MCPARAMID)( 2360 << 14)
+#define MC_InputMaxId_24                         (MCPARAMID)( 2361 << 14)
+#define MC_InputStyle_Filter_24                  (MCPARAMID)( 2362 << 14)
+#define MC___InputId_25                          (MCPARAMID)( 2363 << 14)
+#define MC_InputMaxId_25                         (MCPARAMID)( 2364 << 14)
+#define MC_InputStyle_Filter_25                  (MCPARAMID)( 2365 << 14)
+#define MC___InputId_26                          (MCPARAMID)( 2366 << 14)
+#define MC_InputMaxId_26                         (MCPARAMID)( 2367 << 14)
+#define MC_InputStyle_Filter_26                  (MCPARAMID)( 2368 << 14)
+#define MC___InputId_27                          (MCPARAMID)( 2369 << 14)
+#define MC_InputMaxId_27                         (MCPARAMID)( 2370 << 14)
+#define MC_InputStyle_Filter_27                  (MCPARAMID)( 2371 << 14)
+#define MC___InputId_28                          (MCPARAMID)( 2372 << 14)
+#define MC_InputMaxId_28                         (MCPARAMID)( 2373 << 14)
+#define MC___InputId_29                          (MCPARAMID)( 2374 << 14)
+#define MC_InputMaxId_29                         (MCPARAMID)( 2375 << 14)
+#define MC_InputConfig_Filter_30                 (MCPARAMID)( 2376 << 14)
+#define MC___InputId_30                          (MCPARAMID)( 2377 << 14)
+#define MC_InputMaxId_30                         (MCPARAMID)( 2378 << 14)
+#define MC_InputStyle_Filter_30                  (MCPARAMID)( 2379 << 14)
+#define MC___InputId_31                          (MCPARAMID)( 2380 << 14)
+#define MC_InputMaxId_31                         (MCPARAMID)( 2381 << 14)
+#define MC_InputStyle_Filter_31                  (MCPARAMID)( 2382 << 14)
+#define MC___InputId_32                          (MCPARAMID)( 2383 << 14)
+#define MC_InputMaxId_32                         (MCPARAMID)( 2384 << 14)
+#define MC_InputStyle_Filter_32                  (MCPARAMID)( 2385 << 14)
+#define MC___InputId_33                          (MCPARAMID)( 2386 << 14)
+#define MC_InputMaxId_33                         (MCPARAMID)( 2387 << 14)
+#define MC_InputStyle_Filter_33                  (MCPARAMID)( 2388 << 14)
+#define MC___InputId_34                          (MCPARAMID)( 2389 << 14)
+#define MC_InputMaxId_34                         (MCPARAMID)( 2390 << 14)
+#define MC_InputStyle_Filter_34                  (MCPARAMID)( 2391 << 14)
+#define MC___InputId_35                          (MCPARAMID)( 2392 << 14)
+#define MC_InputMaxId_35                         (MCPARAMID)( 2393 << 14)
+#define MC_InputStyle_Filter_35                  (MCPARAMID)( 2394 << 14)
+#define MC___InputId_36                          (MCPARAMID)( 2395 << 14)
+#define MC_InputMaxId_36                         (MCPARAMID)( 2396 << 14)
+#define MC_InputStyle_Filter_36                  (MCPARAMID)( 2397 << 14)
+#define MC___InputId_37                          (MCPARAMID)( 2398 << 14)
+#define MC_InputMaxId_37                         (MCPARAMID)( 2399 << 14)
+#define MC_InputStyle_Filter_37                  (MCPARAMID)( 2400 << 14)
+#define MC___InputId_38                          (MCPARAMID)( 2401 << 14)
+#define MC_InputMaxId_38                         (MCPARAMID)( 2402 << 14)
+#define MC___InputId_39                          (MCPARAMID)( 2403 << 14)
+#define MC_InputMaxId_39                         (MCPARAMID)( 2404 << 14)
+#define MC_InputConfig_Filter_40                 (MCPARAMID)( 2405 << 14)
+#define MC___InputId_40                          (MCPARAMID)( 2406 << 14)
+#define MC_InputMaxId_40                         (MCPARAMID)( 2407 << 14)
+#define MC_InputStyle_Filter_40                  (MCPARAMID)( 2408 << 14)
+#define MC_InputPinName_I1_0                      44
+#define MC_InputPinName_I2_0                      45
+#define MC_InputPinName_I3_0                      46
+#define MC_InputPinName_I4_0                      47
+#define MC_InputPinName_I1_1                      48
+#define MC_InputPinName_I2_1                      49
+#define MC_InputPinName_I3_1                      50
+#define MC_InputPinName_I4_1                      51
+#define MC_InputPinName_I1_2                      52
+#define MC_InputPinName_I2_2                      53
+#define MC_InputPinName_I3_2                      54
+#define MC_InputPinName_I4_2                      55
+#define MC_InputPinName_I1_3                      56
+#define MC_InputPinName_I2_3                      57
+#define MC_InputPinName_I3_3                      58
+#define MC_InputPinName_I4_3                      59
+#define MC_InputPinName_I1_4                      60
+#define MC_InputPinName_I2_4                      61
+#define MC_InputPinName_I3_4                      62
+#define MC_InputPinName_I4_4                      63
+#define MC___OutputId_21                         (MCPARAMID)( 2409 << 14)
+#define MC_OutputMaxId_21                        (MCPARAMID)( 2410 << 14)
+#define MC___OutputId_22                         (MCPARAMID)( 2411 << 14)
+#define MC_OutputMaxId_22                        (MCPARAMID)( 2412 << 14)
+#define MC___OutputId_23                         (MCPARAMID)( 2413 << 14)
+#define MC_OutputMaxId_23                        (MCPARAMID)( 2414 << 14)
+#define MC___OutputId_24                         (MCPARAMID)( 2415 << 14)
+#define MC_OutputMaxId_24                        (MCPARAMID)( 2416 << 14)
+#define MC_OutputConfig_Filter_25                (MCPARAMID)( 2417 << 14)
+#define MC___OutputId_25                         (MCPARAMID)( 2418 << 14)
+#define MC_OutputMaxId_25                        (MCPARAMID)( 2419 << 14)
+#define MC_OutputState_Filter_25                 (MCPARAMID)( 2420 << 14)
+#define MC_OutputStyle_Filter_25                 (MCPARAMID)( 2421 << 14)
+#define MC_OutputState_25                        (MCPARAMID)( 2422 << 14)
+#define MC_OutputState_25_HOLD                     1
+#define MC_OutputState_25_LOW                      2
+#define MC_OutputState_25_HIGH                     3
+#define MC_OutputConfig_Filter_26                (MCPARAMID)( 2423 << 14)
+#define MC___OutputId_26                         (MCPARAMID)( 2424 << 14)
+#define MC_OutputMaxId_26                        (MCPARAMID)( 2425 << 14)
+#define MC_OutputState_Filter_26                 (MCPARAMID)( 2426 << 14)
+#define MC_OutputStyle_Filter_26                 (MCPARAMID)( 2427 << 14)
+#define MC_OutputState_26                        (MCPARAMID)( 2428 << 14)
+#define MC_OutputState_26_HOLD                     1
+#define MC_OutputState_26_LOW                      2
+#define MC_OutputState_26_HIGH                     3
+#define MC_OutputConfig_Filter_27                (MCPARAMID)( 2429 << 14)
+#define MC___OutputId_27                         (MCPARAMID)( 2430 << 14)
+#define MC_OutputMaxId_27                        (MCPARAMID)( 2431 << 14)
+#define MC_OutputState_Filter_27                 (MCPARAMID)( 2432 << 14)
+#define MC_OutputStyle_Filter_27                 (MCPARAMID)( 2433 << 14)
+#define MC_OutputState_27                        (MCPARAMID)( 2434 << 14)
+#define MC_OutputState_27_HOLD                     1
+#define MC_OutputState_27_LOW                      2
+#define MC_OutputState_27_HIGH                     3
+#define MC___OutputId_28                         (MCPARAMID)( 2435 << 14)
+#define MC_OutputMaxId_28                        (MCPARAMID)( 2436 << 14)
+#define MC___OutputId_29                         (MCPARAMID)( 2437 << 14)
+#define MC_OutputMaxId_29                        (MCPARAMID)( 2438 << 14)
+#define MC_OutputConfig_Filter_30                (MCPARAMID)( 2439 << 14)
+#define MC___OutputId_30                         (MCPARAMID)( 2440 << 14)
+#define MC_OutputMaxId_30                        (MCPARAMID)( 2441 << 14)
+#define MC_OutputState_Filter_30                 (MCPARAMID)( 2442 << 14)
+#define MC_OutputStyle_Filter_30                 (MCPARAMID)( 2443 << 14)
+#define MC_OutputState_30                        (MCPARAMID)( 2444 << 14)
+#define MC_OutputState_30_HOLD                     1
+#define MC_OutputState_30_LOW                      2
+#define MC_OutputState_30_HIGH                     3
+#define MC___OutputId_31                         (MCPARAMID)( 2445 << 14)
+#define MC_OutputMaxId_31                        (MCPARAMID)( 2446 << 14)
+#define MC___OutputId_32                         (MCPARAMID)( 2447 << 14)
+#define MC_OutputMaxId_32                        (MCPARAMID)( 2448 << 14)
+#define MC___OutputId_33                         (MCPARAMID)( 2449 << 14)
+#define MC_OutputMaxId_33                        (MCPARAMID)( 2450 << 14)
+#define MC___OutputId_34                         (MCPARAMID)( 2451 << 14)
+#define MC_OutputMaxId_34                        (MCPARAMID)( 2452 << 14)
+#define MC_OutputConfig_Filter_35                (MCPARAMID)( 2453 << 14)
+#define MC___OutputId_35                         (MCPARAMID)( 2454 << 14)
+#define MC_OutputMaxId_35                        (MCPARAMID)( 2455 << 14)
+#define MC_OutputState_Filter_35                 (MCPARAMID)( 2456 << 14)
+#define MC_OutputStyle_Filter_35                 (MCPARAMID)( 2457 << 14)
+#define MC_OutputState_35                        (MCPARAMID)( 2458 << 14)
+#define MC_OutputState_35_HOLD                     1
+#define MC_OutputState_35_LOW                      2
+#define MC_OutputState_35_HIGH                     3
+#define MC_OutputConfig_Filter_36                (MCPARAMID)( 2459 << 14)
+#define MC___OutputId_36                         (MCPARAMID)( 2460 << 14)
+#define MC_OutputMaxId_36                        (MCPARAMID)( 2461 << 14)
+#define MC_OutputState_Filter_36                 (MCPARAMID)( 2462 << 14)
+#define MC_OutputStyle_Filter_36                 (MCPARAMID)( 2463 << 14)
+#define MC_OutputState_36                        (MCPARAMID)( 2464 << 14)
+#define MC_OutputState_36_HOLD                     1
+#define MC_OutputState_36_LOW                      2
+#define MC_OutputState_36_HIGH                     3
+#define MC_OutputConfig_Filter_37                (MCPARAMID)( 2465 << 14)
+#define MC___OutputId_37                         (MCPARAMID)( 2466 << 14)
+#define MC_OutputMaxId_37                        (MCPARAMID)( 2467 << 14)
+#define MC_OutputState_Filter_37                 (MCPARAMID)( 2468 << 14)
+#define MC_OutputStyle_Filter_37                 (MCPARAMID)( 2469 << 14)
+#define MC_OutputState_37                        (MCPARAMID)( 2470 << 14)
+#define MC_OutputState_37_HOLD                     1
+#define MC_OutputState_37_LOW                      2
+#define MC_OutputState_37_HIGH                     3
+#define MC___OutputId_38                         (MCPARAMID)( 2471 << 14)
+#define MC_OutputMaxId_38                        (MCPARAMID)( 2472 << 14)
+#define MC___OutputId_39                         (MCPARAMID)( 2473 << 14)
+#define MC_OutputMaxId_39                        (MCPARAMID)( 2474 << 14)
+#define MC_OutputConfig_Filter_40                (MCPARAMID)( 2475 << 14)
+#define MC___OutputId_40                         (MCPARAMID)( 2476 << 14)
+#define MC_OutputMaxId_40                        (MCPARAMID)( 2477 << 14)
+#define MC_OutputState_Filter_40                 (MCPARAMID)( 2478 << 14)
+#define MC_OutputStyle_Filter_40                 (MCPARAMID)( 2479 << 14)
+#define MC_OutputState_40                        (MCPARAMID)( 2480 << 14)
+#define MC_OutputState_40_HOLD                     1
+#define MC_OutputState_40_LOW                      2
+#define MC_OutputState_40_HIGH                     3
+#define MC_OutputPinName_O1_0                     52
+#define MC_OutputPinName_O2_0                     53
+#define MC_OutputPinName_O3_0                     54
+#define MC_OutputPinName_O4_0                     55
+#define MC_OutputPinName_O1_1                     56
+#define MC_OutputPinName_O2_1                     57
+#define MC_OutputPinName_O3_1                     58
+#define MC_OutputPinName_O4_1                     59
+#define MC_OutputPinName_O1_2                     60
+#define MC_OutputPinName_O2_2                     61
+#define MC_OutputPinName_O3_2                     62
+#define MC_OutputPinName_O4_2                     63
+#define MC_OutputPinName_O1_3                     64
+#define MC_OutputPinName_O2_3                     65
+#define MC_OutputPinName_O3_3                     66
+#define MC_OutputPinName_O4_3                     67
+#define MC_OutputPinName_O1_4                     68
+#define MC_OutputPinName_O2_4                     69
+#define MC_OutputPinName_O3_4                     70
+#define MC_OutputPinName_O4_4                     71
+#define MC_ColorTrap                             (MCPARAMID)( 2481 << 14)
+#define MC_ColorTrap_ENABLE                        1
+#define MC_ColorTrap_DISABLE                       2
+#define MC_ColorKiller                           (MCPARAMID)( 2482 << 14)
+#define MC_ColorKiller_ENABLE                      1
+#define MC_ColorKiller_DISABLE                     2
+#define MC_DataCoring                            (MCPARAMID)( 2483 << 14)
+#define MC_DataCoring_NONE                         1
+#define MC_DataCoring_CORING8                      2
+#define MC_DataCoring_CORING16                     3
+#define MC_DataCoring_CORING32                     4
+#define MC_DataRange                             (MCPARAMID)( 2484 << 14)
+#define MC_DataRange_FULL                          1
+#define MC_DataRange_RESTRICT                      2
+#define MC_GammaRemoval                          (MCPARAMID)( 2485 << 14)
+#define MC_GammaRemoval_ENABLE                     1
+#define MC_GammaRemoval_DISABLE                    2
+#define MC_MaxInputIndex                         (MCPARAMID)( 2486 << 14)
+#define MC_MaxOutputIndex                        (MCPARAMID)( 2487 << 14)
+#define MC_BoardTopology_1_11_0                   26
+#define MC_BoardTopology_1_01_2                   27
+#define MC_BoardTopology_1_2_0                    28
+#define MC_Connector_YC                           36
+#define MC_InputPinName_I1                        64
+#define MC_InputPinName_I2                        65
+#define MC_InputPinName_I3                        66
+#define MC_InputPinName_I4                        67
+#define MC_OutputPinName_O1                       72
+#define MC_OutputPinName_O2                       73
+#define MC_OutputPinName_O3                       74
+#define MC_OutputPinName_O4                       75
+#define MC_InputConfig_Filter_MC_MV0_IN1         (MCPARAMID)( 2488 << 14)
+#define MC___InputId_MC_MV0_IN1                  (MCPARAMID)( 2489 << 14)
+#define MC_InputMaxId_MC_MV0_IN1                 (MCPARAMID)( 2490 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN1          (MCPARAMID)( 2491 << 14)
+#define MC_InputConfig_Filter_MC_MV0_IN2         (MCPARAMID)( 2492 << 14)
+#define MC___InputId_MC_MV0_IN2                  (MCPARAMID)( 2493 << 14)
+#define MC_InputMaxId_MC_MV0_IN2                 (MCPARAMID)( 2494 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN2          (MCPARAMID)( 2495 << 14)
+#define MC_InputConfig_Filter_MC_MV0_IN3         (MCPARAMID)( 2496 << 14)
+#define MC___InputId_MC_MV0_IN3                  (MCPARAMID)( 2497 << 14)
+#define MC_InputMaxId_MC_MV0_IN3                 (MCPARAMID)( 2498 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN3          (MCPARAMID)( 2499 << 14)
+#define MC_InputConfig_Filter_MC_MV0_IN4         (MCPARAMID)( 2500 << 14)
+#define MC___InputId_MC_MV0_IN4                  (MCPARAMID)( 2501 << 14)
+#define MC_InputMaxId_MC_MV0_IN4                 (MCPARAMID)( 2502 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN4          (MCPARAMID)( 2503 << 14)
+#define MC_InputConfig_Filter_MC_MV0_IN5         (MCPARAMID)( 2504 << 14)
+#define MC___InputId_MC_MV0_IN5                  (MCPARAMID)( 2505 << 14)
+#define MC_InputMaxId_MC_MV0_IN5                 (MCPARAMID)( 2506 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN5          (MCPARAMID)( 2507 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN1         (MCPARAMID)( 2508 << 14)
+#define MC___InputId_MC_MV1_IN1                  (MCPARAMID)( 2509 << 14)
+#define MC_InputMaxId_MC_MV1_IN1                 (MCPARAMID)( 2510 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN1          (MCPARAMID)( 2511 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN2         (MCPARAMID)( 2512 << 14)
+#define MC___InputId_MC_MV1_IN2                  (MCPARAMID)( 2513 << 14)
+#define MC_InputMaxId_MC_MV1_IN2                 (MCPARAMID)( 2514 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN2          (MCPARAMID)( 2515 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN3         (MCPARAMID)( 2516 << 14)
+#define MC___InputId_MC_MV1_IN3                  (MCPARAMID)( 2517 << 14)
+#define MC_InputMaxId_MC_MV1_IN3                 (MCPARAMID)( 2518 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN3          (MCPARAMID)( 2519 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN4         (MCPARAMID)( 2520 << 14)
+#define MC___InputId_MC_MV1_IN4                  (MCPARAMID)( 2521 << 14)
+#define MC_InputMaxId_MC_MV1_IN4                 (MCPARAMID)( 2522 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN4          (MCPARAMID)( 2523 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN5         (MCPARAMID)( 2524 << 14)
+#define MC___InputId_MC_MV1_IN5                  (MCPARAMID)( 2525 << 14)
+#define MC_InputMaxId_MC_MV1_IN5                 (MCPARAMID)( 2526 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN5          (MCPARAMID)( 2527 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN1         (MCPARAMID)( 2528 << 14)
+#define MC___InputId_MC_MV2_IN1                  (MCPARAMID)( 2529 << 14)
+#define MC_InputMaxId_MC_MV2_IN1                 (MCPARAMID)( 2530 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN1          (MCPARAMID)( 2531 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN2         (MCPARAMID)( 2532 << 14)
+#define MC___InputId_MC_MV2_IN2                  (MCPARAMID)( 2533 << 14)
+#define MC_InputMaxId_MC_MV2_IN2                 (MCPARAMID)( 2534 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN2          (MCPARAMID)( 2535 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN3         (MCPARAMID)( 2536 << 14)
+#define MC___InputId_MC_MV2_IN3                  (MCPARAMID)( 2537 << 14)
+#define MC_InputMaxId_MC_MV2_IN3                 (MCPARAMID)( 2538 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN3          (MCPARAMID)( 2539 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN4         (MCPARAMID)( 2540 << 14)
+#define MC___InputId_MC_MV2_IN4                  (MCPARAMID)( 2541 << 14)
+#define MC_InputMaxId_MC_MV2_IN4                 (MCPARAMID)( 2542 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN4          (MCPARAMID)( 2543 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN5         (MCPARAMID)( 2544 << 14)
+#define MC___InputId_MC_MV2_IN5                  (MCPARAMID)( 2545 << 14)
+#define MC_InputMaxId_MC_MV2_IN5                 (MCPARAMID)( 2546 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN5          (MCPARAMID)( 2547 << 14)
+#define MC_InputConfig_Filter_MC_MIO0_IN1        (MCPARAMID)( 2548 << 14)
+#define MC___InputId_MC_MIO0_IN1                 (MCPARAMID)( 2549 << 14)
+#define MC_InputMaxId_MC_MIO0_IN1                (MCPARAMID)( 2550 << 14)
+#define MC_InputStyle_Filter_MC_MIO0_IN1         (MCPARAMID)( 2551 << 14)
+#define MC_InputConfig_Filter_MC_MIO0_IN2        (MCPARAMID)( 2552 << 14)
+#define MC___InputId_MC_MIO0_IN2                 (MCPARAMID)( 2553 << 14)
+#define MC_InputMaxId_MC_MIO0_IN2                (MCPARAMID)( 2554 << 14)
+#define MC_InputStyle_Filter_MC_MIO0_IN2         (MCPARAMID)( 2555 << 14)
+#define MC_InputConfig_Filter_MC_MIO0_IN3        (MCPARAMID)( 2556 << 14)
+#define MC___InputId_MC_MIO0_IN3                 (MCPARAMID)( 2557 << 14)
+#define MC_InputMaxId_MC_MIO0_IN3                (MCPARAMID)( 2558 << 14)
+#define MC_InputStyle_Filter_MC_MIO0_IN3         (MCPARAMID)( 2559 << 14)
+#define MC_InputConfig_Filter_MC_MIO0_IN4        (MCPARAMID)( 2560 << 14)
+#define MC___InputId_MC_MIO0_IN4                 (MCPARAMID)( 2561 << 14)
+#define MC_InputMaxId_MC_MIO0_IN4                (MCPARAMID)( 2562 << 14)
+#define MC_InputStyle_Filter_MC_MIO0_IN4         (MCPARAMID)( 2563 << 14)
+#define MC_InputConfig_Filter_MC_MIO1_IN1        (MCPARAMID)( 2564 << 14)
+#define MC___InputId_MC_MIO1_IN1                 (MCPARAMID)( 2565 << 14)
+#define MC_InputMaxId_MC_MIO1_IN1                (MCPARAMID)( 2566 << 14)
+#define MC_InputStyle_Filter_MC_MIO1_IN1         (MCPARAMID)( 2567 << 14)
+#define MC_InputConfig_Filter_MC_MIO1_IN2        (MCPARAMID)( 2568 << 14)
+#define MC___InputId_MC_MIO1_IN2                 (MCPARAMID)( 2569 << 14)
+#define MC_InputMaxId_MC_MIO1_IN2                (MCPARAMID)( 2570 << 14)
+#define MC_InputStyle_Filter_MC_MIO1_IN2         (MCPARAMID)( 2571 << 14)
+#define MC_InputConfig_Filter_MC_MIO1_IN3        (MCPARAMID)( 2572 << 14)
+#define MC___InputId_MC_MIO1_IN3                 (MCPARAMID)( 2573 << 14)
+#define MC_InputMaxId_MC_MIO1_IN3                (MCPARAMID)( 2574 << 14)
+#define MC_InputStyle_Filter_MC_MIO1_IN3         (MCPARAMID)( 2575 << 14)
+#define MC_InputConfig_Filter_MC_MIO1_IN4        (MCPARAMID)( 2576 << 14)
+#define MC___InputId_MC_MIO1_IN4                 (MCPARAMID)( 2577 << 14)
+#define MC_InputMaxId_MC_MIO1_IN4                (MCPARAMID)( 2578 << 14)
+#define MC_InputStyle_Filter_MC_MIO1_IN4         (MCPARAMID)( 2579 << 14)
+#define MC_InputConfig_Filter_MC_MIO2_IN1        (MCPARAMID)( 2580 << 14)
+#define MC___InputId_MC_MIO2_IN1                 (MCPARAMID)( 2581 << 14)
+#define MC_InputMaxId_MC_MIO2_IN1                (MCPARAMID)( 2582 << 14)
+#define MC_InputStyle_Filter_MC_MIO2_IN1         (MCPARAMID)( 2583 << 14)
+#define MC_InputConfig_Filter_MC_MIO2_IN2        (MCPARAMID)( 2584 << 14)
+#define MC___InputId_MC_MIO2_IN2                 (MCPARAMID)( 2585 << 14)
+#define MC_InputMaxId_MC_MIO2_IN2                (MCPARAMID)( 2586 << 14)
+#define MC_InputStyle_Filter_MC_MIO2_IN2         (MCPARAMID)( 2587 << 14)
+#define MC_InputConfig_Filter_MC_MIO2_IN3        (MCPARAMID)( 2588 << 14)
+#define MC___InputId_MC_MIO2_IN3                 (MCPARAMID)( 2589 << 14)
+#define MC_InputMaxId_MC_MIO2_IN3                (MCPARAMID)( 2590 << 14)
+#define MC_InputStyle_Filter_MC_MIO2_IN3         (MCPARAMID)( 2591 << 14)
+#define MC_InputConfig_Filter_MC_MIO2_IN4        (MCPARAMID)( 2592 << 14)
+#define MC___InputId_MC_MIO2_IN4                 (MCPARAMID)( 2593 << 14)
+#define MC_InputMaxId_MC_MIO2_IN4                (MCPARAMID)( 2594 << 14)
+#define MC_InputStyle_Filter_MC_MIO2_IN4         (MCPARAMID)( 2595 << 14)
+#define MC_InputConfig_Filter_MC_MIO3_IN1        (MCPARAMID)( 2596 << 14)
+#define MC___InputId_MC_MIO3_IN1                 (MCPARAMID)( 2597 << 14)
+#define MC_InputMaxId_MC_MIO3_IN1                (MCPARAMID)( 2598 << 14)
+#define MC_InputStyle_Filter_MC_MIO3_IN1         (MCPARAMID)( 2599 << 14)
+#define MC_InputConfig_Filter_MC_MIO3_IN2        (MCPARAMID)( 2600 << 14)
+#define MC___InputId_MC_MIO3_IN2                 (MCPARAMID)( 2601 << 14)
+#define MC_InputMaxId_MC_MIO3_IN2                (MCPARAMID)( 2602 << 14)
+#define MC_InputStyle_Filter_MC_MIO3_IN2         (MCPARAMID)( 2603 << 14)
+#define MC_InputConfig_Filter_MC_MIO3_IN3        (MCPARAMID)( 2604 << 14)
+#define MC___InputId_MC_MIO3_IN3                 (MCPARAMID)( 2605 << 14)
+#define MC_InputMaxId_MC_MIO3_IN3                (MCPARAMID)( 2606 << 14)
+#define MC_InputStyle_Filter_MC_MIO3_IN3         (MCPARAMID)( 2607 << 14)
+#define MC_InputConfig_Filter_MC_MIO3_IN4        (MCPARAMID)( 2608 << 14)
+#define MC___InputId_MC_MIO3_IN4                 (MCPARAMID)( 2609 << 14)
+#define MC_InputMaxId_MC_MIO3_IN4                (MCPARAMID)( 2610 << 14)
+#define MC_InputStyle_Filter_MC_MIO3_IN4         (MCPARAMID)( 2611 << 14)
+#define MC_InputConfig_Filter_MC_MIO4_IN1        (MCPARAMID)( 2612 << 14)
+#define MC___InputId_MC_MIO4_IN1                 (MCPARAMID)( 2613 << 14)
+#define MC_InputMaxId_MC_MIO4_IN1                (MCPARAMID)( 2614 << 14)
+#define MC_InputStyle_Filter_MC_MIO4_IN1         (MCPARAMID)( 2615 << 14)
+#define MC_InputConfig_Filter_MC_MIO4_IN2        (MCPARAMID)( 2616 << 14)
+#define MC___InputId_MC_MIO4_IN2                 (MCPARAMID)( 2617 << 14)
+#define MC_InputMaxId_MC_MIO4_IN2                (MCPARAMID)( 2618 << 14)
+#define MC_InputStyle_Filter_MC_MIO4_IN2         (MCPARAMID)( 2619 << 14)
+#define MC_InputConfig_Filter_MC_MIO4_IN3        (MCPARAMID)( 2620 << 14)
+#define MC___InputId_MC_MIO4_IN3                 (MCPARAMID)( 2621 << 14)
+#define MC_InputMaxId_MC_MIO4_IN3                (MCPARAMID)( 2622 << 14)
+#define MC_InputStyle_Filter_MC_MIO4_IN3         (MCPARAMID)( 2623 << 14)
+#define MC_InputConfig_Filter_MC_MIO4_IN4        (MCPARAMID)( 2624 << 14)
+#define MC___InputId_MC_MIO4_IN4                 (MCPARAMID)( 2625 << 14)
+#define MC_InputMaxId_MC_MIO4_IN4                (MCPARAMID)( 2626 << 14)
+#define MC_InputStyle_Filter_MC_MIO4_IN4         (MCPARAMID)( 2627 << 14)
+#define MC_OutputConfig_Filter_MC_MV0_OUT1       (MCPARAMID)( 2628 << 14)
+#define MC___OutputId_MC_MV0_OUT1                (MCPARAMID)( 2629 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT1               (MCPARAMID)( 2630 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT1        (MCPARAMID)( 2631 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT1        (MCPARAMID)( 2632 << 14)
+#define MC_OutputState_MC_MV0_OUT1               (MCPARAMID)( 2633 << 14)
+#define MC_OutputState_MC_MV0_OUT1_HOLD            1
+#define MC_OutputState_MC_MV0_OUT1_LOW             2
+#define MC_OutputState_MC_MV0_OUT1_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV0_OUT2       (MCPARAMID)( 2634 << 14)
+#define MC___OutputId_MC_MV0_OUT2                (MCPARAMID)( 2635 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT2               (MCPARAMID)( 2636 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT2        (MCPARAMID)( 2637 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT2        (MCPARAMID)( 2638 << 14)
+#define MC_OutputState_MC_MV0_OUT2               (MCPARAMID)( 2639 << 14)
+#define MC_OutputState_MC_MV0_OUT2_HOLD            1
+#define MC_OutputState_MC_MV0_OUT2_LOW             2
+#define MC_OutputState_MC_MV0_OUT2_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV0_OUT3       (MCPARAMID)( 2640 << 14)
+#define MC___OutputId_MC_MV0_OUT3                (MCPARAMID)( 2641 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT3               (MCPARAMID)( 2642 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT3        (MCPARAMID)( 2643 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT3        (MCPARAMID)( 2644 << 14)
+#define MC_OutputState_MC_MV0_OUT3               (MCPARAMID)( 2645 << 14)
+#define MC_OutputState_MC_MV0_OUT3_HOLD            1
+#define MC_OutputState_MC_MV0_OUT3_LOW             2
+#define MC_OutputState_MC_MV0_OUT3_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV0_OUT4       (MCPARAMID)( 2646 << 14)
+#define MC___OutputId_MC_MV0_OUT4                (MCPARAMID)( 2647 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT4               (MCPARAMID)( 2648 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT4        (MCPARAMID)( 2649 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT4        (MCPARAMID)( 2650 << 14)
+#define MC_OutputState_MC_MV0_OUT4               (MCPARAMID)( 2651 << 14)
+#define MC_OutputState_MC_MV0_OUT4_HOLD            1
+#define MC_OutputState_MC_MV0_OUT4_LOW             2
+#define MC_OutputState_MC_MV0_OUT4_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV0_OUT5       (MCPARAMID)( 2652 << 14)
+#define MC___OutputId_MC_MV0_OUT5                (MCPARAMID)( 2653 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT5               (MCPARAMID)( 2654 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT5        (MCPARAMID)( 2655 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT5        (MCPARAMID)( 2656 << 14)
+#define MC_OutputState_MC_MV0_OUT5               (MCPARAMID)( 2657 << 14)
+#define MC_OutputState_MC_MV0_OUT5_HOLD            1
+#define MC_OutputState_MC_MV0_OUT5_LOW             2
+#define MC_OutputState_MC_MV0_OUT5_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT1       (MCPARAMID)( 2658 << 14)
+#define MC___OutputId_MC_MV1_OUT1                (MCPARAMID)( 2659 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT1               (MCPARAMID)( 2660 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT1        (MCPARAMID)( 2661 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT1        (MCPARAMID)( 2662 << 14)
+#define MC_OutputState_MC_MV1_OUT1               (MCPARAMID)( 2663 << 14)
+#define MC_OutputState_MC_MV1_OUT1_HOLD            1
+#define MC_OutputState_MC_MV1_OUT1_LOW             2
+#define MC_OutputState_MC_MV1_OUT1_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT2       (MCPARAMID)( 2664 << 14)
+#define MC___OutputId_MC_MV1_OUT2                (MCPARAMID)( 2665 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT2               (MCPARAMID)( 2666 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT2        (MCPARAMID)( 2667 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT2        (MCPARAMID)( 2668 << 14)
+#define MC_OutputState_MC_MV1_OUT2               (MCPARAMID)( 2669 << 14)
+#define MC_OutputState_MC_MV1_OUT2_HOLD            1
+#define MC_OutputState_MC_MV1_OUT2_LOW             2
+#define MC_OutputState_MC_MV1_OUT2_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT3       (MCPARAMID)( 2670 << 14)
+#define MC___OutputId_MC_MV1_OUT3                (MCPARAMID)( 2671 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT3               (MCPARAMID)( 2672 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT3        (MCPARAMID)( 2673 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT3        (MCPARAMID)( 2674 << 14)
+#define MC_OutputState_MC_MV1_OUT3               (MCPARAMID)( 2675 << 14)
+#define MC_OutputState_MC_MV1_OUT3_HOLD            1
+#define MC_OutputState_MC_MV1_OUT3_LOW             2
+#define MC_OutputState_MC_MV1_OUT3_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT4       (MCPARAMID)( 2676 << 14)
+#define MC___OutputId_MC_MV1_OUT4                (MCPARAMID)( 2677 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT4               (MCPARAMID)( 2678 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT4        (MCPARAMID)( 2679 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT4        (MCPARAMID)( 2680 << 14)
+#define MC_OutputState_MC_MV1_OUT4               (MCPARAMID)( 2681 << 14)
+#define MC_OutputState_MC_MV1_OUT4_HOLD            1
+#define MC_OutputState_MC_MV1_OUT4_LOW             2
+#define MC_OutputState_MC_MV1_OUT4_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT5       (MCPARAMID)( 2682 << 14)
+#define MC___OutputId_MC_MV1_OUT5                (MCPARAMID)( 2683 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT5               (MCPARAMID)( 2684 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT5        (MCPARAMID)( 2685 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT5        (MCPARAMID)( 2686 << 14)
+#define MC_OutputState_MC_MV1_OUT5               (MCPARAMID)( 2687 << 14)
+#define MC_OutputState_MC_MV1_OUT5_HOLD            1
+#define MC_OutputState_MC_MV1_OUT5_LOW             2
+#define MC_OutputState_MC_MV1_OUT5_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT1       (MCPARAMID)( 2688 << 14)
+#define MC___OutputId_MC_MV2_OUT1                (MCPARAMID)( 2689 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT1               (MCPARAMID)( 2690 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT1        (MCPARAMID)( 2691 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT1        (MCPARAMID)( 2692 << 14)
+#define MC_OutputState_MC_MV2_OUT1               (MCPARAMID)( 2693 << 14)
+#define MC_OutputState_MC_MV2_OUT1_HOLD            1
+#define MC_OutputState_MC_MV2_OUT1_LOW             2
+#define MC_OutputState_MC_MV2_OUT1_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT2       (MCPARAMID)( 2694 << 14)
+#define MC___OutputId_MC_MV2_OUT2                (MCPARAMID)( 2695 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT2               (MCPARAMID)( 2696 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT2        (MCPARAMID)( 2697 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT2        (MCPARAMID)( 2698 << 14)
+#define MC_OutputState_MC_MV2_OUT2               (MCPARAMID)( 2699 << 14)
+#define MC_OutputState_MC_MV2_OUT2_HOLD            1
+#define MC_OutputState_MC_MV2_OUT2_LOW             2
+#define MC_OutputState_MC_MV2_OUT2_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT3       (MCPARAMID)( 2700 << 14)
+#define MC___OutputId_MC_MV2_OUT3                (MCPARAMID)( 2701 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT3               (MCPARAMID)( 2702 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT3        (MCPARAMID)( 2703 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT3        (MCPARAMID)( 2704 << 14)
+#define MC_OutputState_MC_MV2_OUT3               (MCPARAMID)( 2705 << 14)
+#define MC_OutputState_MC_MV2_OUT3_HOLD            1
+#define MC_OutputState_MC_MV2_OUT3_LOW             2
+#define MC_OutputState_MC_MV2_OUT3_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT4       (MCPARAMID)( 2706 << 14)
+#define MC___OutputId_MC_MV2_OUT4                (MCPARAMID)( 2707 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT4               (MCPARAMID)( 2708 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT4        (MCPARAMID)( 2709 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT4        (MCPARAMID)( 2710 << 14)
+#define MC_OutputState_MC_MV2_OUT4               (MCPARAMID)( 2711 << 14)
+#define MC_OutputState_MC_MV2_OUT4_HOLD            1
+#define MC_OutputState_MC_MV2_OUT4_LOW             2
+#define MC_OutputState_MC_MV2_OUT4_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT5       (MCPARAMID)( 2712 << 14)
+#define MC___OutputId_MC_MV2_OUT5                (MCPARAMID)( 2713 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT5               (MCPARAMID)( 2714 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT5        (MCPARAMID)( 2715 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT5        (MCPARAMID)( 2716 << 14)
+#define MC_OutputState_MC_MV2_OUT5               (MCPARAMID)( 2717 << 14)
+#define MC_OutputState_MC_MV2_OUT5_HOLD            1
+#define MC_OutputState_MC_MV2_OUT5_LOW             2
+#define MC_OutputState_MC_MV2_OUT5_HIGH            3
+#define MC_OutputConfig_Filter_MC_MIO0_OUT1      (MCPARAMID)( 2718 << 14)
+#define MC___OutputId_MC_MIO0_OUT1               (MCPARAMID)( 2719 << 14)
+#define MC_OutputMaxId_MC_MIO0_OUT1              (MCPARAMID)( 2720 << 14)
+#define MC_OutputState_Filter_MC_MIO0_OUT1       (MCPARAMID)( 2721 << 14)
+#define MC_OutputStyle_Filter_MC_MIO0_OUT1       (MCPARAMID)( 2722 << 14)
+#define MC_OutputState_MC_MIO0_OUT1              (MCPARAMID)( 2723 << 14)
+#define MC_OutputState_MC_MIO0_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO0_OUT1_LOW            2
+#define MC_OutputState_MC_MIO0_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO0_OUT2      (MCPARAMID)( 2724 << 14)
+#define MC___OutputId_MC_MIO0_OUT2               (MCPARAMID)( 2725 << 14)
+#define MC_OutputMaxId_MC_MIO0_OUT2              (MCPARAMID)( 2726 << 14)
+#define MC_OutputState_Filter_MC_MIO0_OUT2       (MCPARAMID)( 2727 << 14)
+#define MC_OutputStyle_Filter_MC_MIO0_OUT2       (MCPARAMID)( 2728 << 14)
+#define MC_OutputState_MC_MIO0_OUT2              (MCPARAMID)( 2729 << 14)
+#define MC_OutputState_MC_MIO0_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO0_OUT2_LOW            2
+#define MC_OutputState_MC_MIO0_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO0_OUT3      (MCPARAMID)( 2730 << 14)
+#define MC___OutputId_MC_MIO0_OUT3               (MCPARAMID)( 2731 << 14)
+#define MC_OutputMaxId_MC_MIO0_OUT3              (MCPARAMID)( 2732 << 14)
+#define MC_OutputState_Filter_MC_MIO0_OUT3       (MCPARAMID)( 2733 << 14)
+#define MC_OutputStyle_Filter_MC_MIO0_OUT3       (MCPARAMID)( 2734 << 14)
+#define MC_OutputState_MC_MIO0_OUT3              (MCPARAMID)( 2735 << 14)
+#define MC_OutputState_MC_MIO0_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO0_OUT3_LOW            2
+#define MC_OutputState_MC_MIO0_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO0_OUT4      (MCPARAMID)( 2736 << 14)
+#define MC___OutputId_MC_MIO0_OUT4               (MCPARAMID)( 2737 << 14)
+#define MC_OutputMaxId_MC_MIO0_OUT4              (MCPARAMID)( 2738 << 14)
+#define MC_OutputState_Filter_MC_MIO0_OUT4       (MCPARAMID)( 2739 << 14)
+#define MC_OutputStyle_Filter_MC_MIO0_OUT4       (MCPARAMID)( 2740 << 14)
+#define MC_OutputState_MC_MIO0_OUT4              (MCPARAMID)( 2741 << 14)
+#define MC_OutputState_MC_MIO0_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO0_OUT4_LOW            2
+#define MC_OutputState_MC_MIO0_OUT4_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO1_OUT1      (MCPARAMID)( 2742 << 14)
+#define MC___OutputId_MC_MIO1_OUT1               (MCPARAMID)( 2743 << 14)
+#define MC_OutputMaxId_MC_MIO1_OUT1              (MCPARAMID)( 2744 << 14)
+#define MC_OutputState_Filter_MC_MIO1_OUT1       (MCPARAMID)( 2745 << 14)
+#define MC_OutputStyle_Filter_MC_MIO1_OUT1       (MCPARAMID)( 2746 << 14)
+#define MC_OutputState_MC_MIO1_OUT1              (MCPARAMID)( 2747 << 14)
+#define MC_OutputState_MC_MIO1_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO1_OUT1_LOW            2
+#define MC_OutputState_MC_MIO1_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO1_OUT2      (MCPARAMID)( 2748 << 14)
+#define MC___OutputId_MC_MIO1_OUT2               (MCPARAMID)( 2749 << 14)
+#define MC_OutputMaxId_MC_MIO1_OUT2              (MCPARAMID)( 2750 << 14)
+#define MC_OutputState_Filter_MC_MIO1_OUT2       (MCPARAMID)( 2751 << 14)
+#define MC_OutputStyle_Filter_MC_MIO1_OUT2       (MCPARAMID)( 2752 << 14)
+#define MC_OutputState_MC_MIO1_OUT2              (MCPARAMID)( 2753 << 14)
+#define MC_OutputState_MC_MIO1_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO1_OUT2_LOW            2
+#define MC_OutputState_MC_MIO1_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO1_OUT3      (MCPARAMID)( 2754 << 14)
+#define MC___OutputId_MC_MIO1_OUT3               (MCPARAMID)( 2755 << 14)
+#define MC_OutputMaxId_MC_MIO1_OUT3              (MCPARAMID)( 2756 << 14)
+#define MC_OutputState_Filter_MC_MIO1_OUT3       (MCPARAMID)( 2757 << 14)
+#define MC_OutputStyle_Filter_MC_MIO1_OUT3       (MCPARAMID)( 2758 << 14)
+#define MC_OutputState_MC_MIO1_OUT3              (MCPARAMID)( 2759 << 14)
+#define MC_OutputState_MC_MIO1_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO1_OUT3_LOW            2
+#define MC_OutputState_MC_MIO1_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO1_OUT4      (MCPARAMID)( 2760 << 14)
+#define MC___OutputId_MC_MIO1_OUT4               (MCPARAMID)( 2761 << 14)
+#define MC_OutputMaxId_MC_MIO1_OUT4              (MCPARAMID)( 2762 << 14)
+#define MC_OutputState_Filter_MC_MIO1_OUT4       (MCPARAMID)( 2763 << 14)
+#define MC_OutputStyle_Filter_MC_MIO1_OUT4       (MCPARAMID)( 2764 << 14)
+#define MC_OutputState_MC_MIO1_OUT4              (MCPARAMID)( 2765 << 14)
+#define MC_OutputState_MC_MIO1_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO1_OUT4_LOW            2
+#define MC_OutputState_MC_MIO1_OUT4_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO2_OUT1      (MCPARAMID)( 2766 << 14)
+#define MC___OutputId_MC_MIO2_OUT1               (MCPARAMID)( 2767 << 14)
+#define MC_OutputMaxId_MC_MIO2_OUT1              (MCPARAMID)( 2768 << 14)
+#define MC_OutputState_Filter_MC_MIO2_OUT1       (MCPARAMID)( 2769 << 14)
+#define MC_OutputStyle_Filter_MC_MIO2_OUT1       (MCPARAMID)( 2770 << 14)
+#define MC_OutputState_MC_MIO2_OUT1              (MCPARAMID)( 2771 << 14)
+#define MC_OutputState_MC_MIO2_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO2_OUT1_LOW            2
+#define MC_OutputState_MC_MIO2_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO2_OUT2      (MCPARAMID)( 2772 << 14)
+#define MC___OutputId_MC_MIO2_OUT2               (MCPARAMID)( 2773 << 14)
+#define MC_OutputMaxId_MC_MIO2_OUT2              (MCPARAMID)( 2774 << 14)
+#define MC_OutputState_Filter_MC_MIO2_OUT2       (MCPARAMID)( 2775 << 14)
+#define MC_OutputStyle_Filter_MC_MIO2_OUT2       (MCPARAMID)( 2776 << 14)
+#define MC_OutputState_MC_MIO2_OUT2              (MCPARAMID)( 2777 << 14)
+#define MC_OutputState_MC_MIO2_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO2_OUT2_LOW            2
+#define MC_OutputState_MC_MIO2_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO2_OUT3      (MCPARAMID)( 2778 << 14)
+#define MC___OutputId_MC_MIO2_OUT3               (MCPARAMID)( 2779 << 14)
+#define MC_OutputMaxId_MC_MIO2_OUT3              (MCPARAMID)( 2780 << 14)
+#define MC_OutputState_Filter_MC_MIO2_OUT3       (MCPARAMID)( 2781 << 14)
+#define MC_OutputStyle_Filter_MC_MIO2_OUT3       (MCPARAMID)( 2782 << 14)
+#define MC_OutputState_MC_MIO2_OUT3              (MCPARAMID)( 2783 << 14)
+#define MC_OutputState_MC_MIO2_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO2_OUT3_LOW            2
+#define MC_OutputState_MC_MIO2_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO2_OUT4      (MCPARAMID)( 2784 << 14)
+#define MC___OutputId_MC_MIO2_OUT4               (MCPARAMID)( 2785 << 14)
+#define MC_OutputMaxId_MC_MIO2_OUT4              (MCPARAMID)( 2786 << 14)
+#define MC_OutputState_Filter_MC_MIO2_OUT4       (MCPARAMID)( 2787 << 14)
+#define MC_OutputStyle_Filter_MC_MIO2_OUT4       (MCPARAMID)( 2788 << 14)
+#define MC_OutputState_MC_MIO2_OUT4              (MCPARAMID)( 2789 << 14)
+#define MC_OutputState_MC_MIO2_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO2_OUT4_LOW            2
+#define MC_OutputState_MC_MIO2_OUT4_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO3_OUT1      (MCPARAMID)( 2790 << 14)
+#define MC___OutputId_MC_MIO3_OUT1               (MCPARAMID)( 2791 << 14)
+#define MC_OutputMaxId_MC_MIO3_OUT1              (MCPARAMID)( 2792 << 14)
+#define MC_OutputState_Filter_MC_MIO3_OUT1       (MCPARAMID)( 2793 << 14)
+#define MC_OutputStyle_Filter_MC_MIO3_OUT1       (MCPARAMID)( 2794 << 14)
+#define MC_OutputState_MC_MIO3_OUT1              (MCPARAMID)( 2795 << 14)
+#define MC_OutputState_MC_MIO3_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO3_OUT1_LOW            2
+#define MC_OutputState_MC_MIO3_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO3_OUT2      (MCPARAMID)( 2796 << 14)
+#define MC___OutputId_MC_MIO3_OUT2               (MCPARAMID)( 2797 << 14)
+#define MC_OutputMaxId_MC_MIO3_OUT2              (MCPARAMID)( 2798 << 14)
+#define MC_OutputState_Filter_MC_MIO3_OUT2       (MCPARAMID)( 2799 << 14)
+#define MC_OutputStyle_Filter_MC_MIO3_OUT2       (MCPARAMID)( 2800 << 14)
+#define MC_OutputState_MC_MIO3_OUT2              (MCPARAMID)( 2801 << 14)
+#define MC_OutputState_MC_MIO3_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO3_OUT2_LOW            2
+#define MC_OutputState_MC_MIO3_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO3_OUT3      (MCPARAMID)( 2802 << 14)
+#define MC___OutputId_MC_MIO3_OUT3               (MCPARAMID)( 2803 << 14)
+#define MC_OutputMaxId_MC_MIO3_OUT3              (MCPARAMID)( 2804 << 14)
+#define MC_OutputState_Filter_MC_MIO3_OUT3       (MCPARAMID)( 2805 << 14)
+#define MC_OutputStyle_Filter_MC_MIO3_OUT3       (MCPARAMID)( 2806 << 14)
+#define MC_OutputState_MC_MIO3_OUT3              (MCPARAMID)( 2807 << 14)
+#define MC_OutputState_MC_MIO3_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO3_OUT3_LOW            2
+#define MC_OutputState_MC_MIO3_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO3_OUT4      (MCPARAMID)( 2808 << 14)
+#define MC___OutputId_MC_MIO3_OUT4               (MCPARAMID)( 2809 << 14)
+#define MC_OutputMaxId_MC_MIO3_OUT4              (MCPARAMID)( 2810 << 14)
+#define MC_OutputState_Filter_MC_MIO3_OUT4       (MCPARAMID)( 2811 << 14)
+#define MC_OutputStyle_Filter_MC_MIO3_OUT4       (MCPARAMID)( 2812 << 14)
+#define MC_OutputState_MC_MIO3_OUT4              (MCPARAMID)( 2813 << 14)
+#define MC_OutputState_MC_MIO3_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO3_OUT4_LOW            2
+#define MC_OutputState_MC_MIO3_OUT4_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO4_OUT1      (MCPARAMID)( 2814 << 14)
+#define MC___OutputId_MC_MIO4_OUT1               (MCPARAMID)( 2815 << 14)
+#define MC_OutputMaxId_MC_MIO4_OUT1              (MCPARAMID)( 2816 << 14)
+#define MC_OutputState_Filter_MC_MIO4_OUT1       (MCPARAMID)( 2817 << 14)
+#define MC_OutputStyle_Filter_MC_MIO4_OUT1       (MCPARAMID)( 2818 << 14)
+#define MC_OutputState_MC_MIO4_OUT1              (MCPARAMID)( 2819 << 14)
+#define MC_OutputState_MC_MIO4_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO4_OUT1_LOW            2
+#define MC_OutputState_MC_MIO4_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO4_OUT2      (MCPARAMID)( 2820 << 14)
+#define MC___OutputId_MC_MIO4_OUT2               (MCPARAMID)( 2821 << 14)
+#define MC_OutputMaxId_MC_MIO4_OUT2              (MCPARAMID)( 2822 << 14)
+#define MC_OutputState_Filter_MC_MIO4_OUT2       (MCPARAMID)( 2823 << 14)
+#define MC_OutputStyle_Filter_MC_MIO4_OUT2       (MCPARAMID)( 2824 << 14)
+#define MC_OutputState_MC_MIO4_OUT2              (MCPARAMID)( 2825 << 14)
+#define MC_OutputState_MC_MIO4_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO4_OUT2_LOW            2
+#define MC_OutputState_MC_MIO4_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO4_OUT3      (MCPARAMID)( 2826 << 14)
+#define MC___OutputId_MC_MIO4_OUT3               (MCPARAMID)( 2827 << 14)
+#define MC_OutputMaxId_MC_MIO4_OUT3              (MCPARAMID)( 2828 << 14)
+#define MC_OutputState_Filter_MC_MIO4_OUT3       (MCPARAMID)( 2829 << 14)
+#define MC_OutputStyle_Filter_MC_MIO4_OUT3       (MCPARAMID)( 2830 << 14)
+#define MC_OutputState_MC_MIO4_OUT3              (MCPARAMID)( 2831 << 14)
+#define MC_OutputState_MC_MIO4_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO4_OUT3_LOW            2
+#define MC_OutputState_MC_MIO4_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO4_OUT4      (MCPARAMID)( 2832 << 14)
+#define MC___OutputId_MC_MIO4_OUT4               (MCPARAMID)( 2833 << 14)
+#define MC_OutputMaxId_MC_MIO4_OUT4              (MCPARAMID)( 2834 << 14)
+#define MC_OutputState_Filter_MC_MIO4_OUT4       (MCPARAMID)( 2835 << 14)
+#define MC_OutputStyle_Filter_MC_MIO4_OUT4       (MCPARAMID)( 2836 << 14)
+#define MC_OutputState_MC_MIO4_OUT4              (MCPARAMID)( 2837 << 14)
+#define MC_OutputState_MC_MIO4_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO4_OUT4_LOW            2
+#define MC_OutputState_MC_MIO4_OUT4_HIGH           3
+#define MC_PreStrobe_Tk                          (MCPARAMID)( 2838 << 14)
+#define MC__STRWidth_Tk                          (MCPARAMID)( 2839 << 14)
+#define MC__EXPOn2STROBEOff_E                    (MCPARAMID)( 2840 << 14)
+#define MC__PREEXPWidth_E                        (MCPARAMID)( 2841 << 14)
+#define MC_PinHIO_Usage                          (MCPARAMID)( 2842 << 14)
+#define MC_PinHIO_Usage_NONE                       1
+#define MC_PinHIO_Usage_INPUT                      2
+#define MC_PinHIO_Usage_LOW                        3
+#define MC_PinHIO_Usage_HIGH                       4
+#define MC_PinHIO_Usage_HDRIVE                     5
+#define MC_PinHIO_Usage_HSYNC                      6
+#define MC_PinVIO_Usage                          (MCPARAMID)( 2843 << 14)
+#define MC_PinVIO_Usage_NONE                       1
+#define MC_PinVIO_Usage_INPUT                      2
+#define MC_PinVIO_Usage_LOW                        3
+#define MC_PinVIO_Usage_HIGH                       4
+#define MC_PinVIO_Usage_VDRIVE                     5
+#define MC_PinVIO_Usage_RESET                      6
+#define MC_PinVIO_Usage_AUXRESET                   7
+#define MC_PinVIO_Usage_VSYNC                      8
+#define MC_PinGATE_Usage                         (MCPARAMID)( 2844 << 14)
+#define MC_PinGATE_Usage_NONE                      1
+#define MC_PinGATE_Usage_INPUT                     2
+#define MC_PinGATE_Usage_LOW                       3
+#define MC_PinGATE_Usage_HIGH                      4
+#define MC_PinGATE_Usage_HSYNC                     5
+#define MC_PinGATE_Usage_VSYNC                     6
+#define MC_PinEXP_Usage                          (MCPARAMID)( 2845 << 14)
+#define MC_PinEXP_Usage_NONE                       1
+#define MC_PinEXP_Usage_INPUT                      2
+#define MC_PinEXP_Usage_LOW                        3
+#define MC_PinEXP_Usage_HIGH                       4
+#define MC_PinEXP_Usage_HDRIVE                     5
+#define MC_PinEXP_Usage_HSYNC                      6
+#define MC_PinRST_Usage                          (MCPARAMID)( 2846 << 14)
+#define MC_PinRST_Usage_NONE                       1
+#define MC_PinRST_Usage_INPUT                      2
+#define MC_PinRST_Usage_LOW                        3
+#define MC_PinRST_Usage_HIGH                       4
+#define MC_PinRST_Usage_VDRIVE                     5
+#define MC_PinRST_Usage_RESET                      6
+#define MC_PinRST_Usage_AUXRESET                   7
+#define MC_PinRST_Usage_VSYNC                      8
+#define MC_CameraControlSignalSet                (MCPARAMID)( 2847 << 14)
+#define MC_CameraControlSignalSet_NONE             1
+#define MC_CameraControlSignalSet_RESET            2
+#define MC_CameraControlSignalSet_RESET_VSYNC      3
+#define MC_CameraControlSignalSet_HDRIVE_VDRIVE    4
+#define MC_CameraControlSignalSet_HDRIVE_RESET     5
+#define MC_CameraControlSignalSet_HDRIVE_RESET_VSYNC   6
+#define MC_CameraControlSignalSet_HDRIVE_RESET_AUXRESET   7
+#define MC_CameraControlSignalSet_CLK_HSYNC_VSYNC   8
+#define MC_CameraControlSignalSet_RESET_CLK_HSYNC_VSYNC   9
+#define MC_CameraControlSignalSet_INVALID         10
+#define MC_CameraSignalSet                       (MCPARAMID)( 2848 << 14)
+#define MC_CameraSignalSet_A1                      1
+#define MC_CameraSignalSet_B1                      2
+#define MC_CameraSignalSet_C1                      3
+#define MC_CameraSignalSet_D1                      4
+#define MC_CameraSignalSet_E1                      5
+#define MC_CameraSignalSet_F1                      6
+#define MC_CameraSignalSet_G1                      7
+#define MC_CameraSignalSet_H1                      8
+#define MC_CameraSignalSet_I1                      9
+#define MC_CameraSignalSet_A2                     10
+#define MC_CameraSignalSet_B2                     11
+#define MC_CameraSignalSet_C2                     12
+#define MC_CameraSignalSet_D2                     13
+#define MC_CameraSignalSet_E2                     14
+#define MC_CameraSignalSet_F2                     15
+#define MC_CameraSignalSet_G2                     16
+#define MC_CameraSignalSet_H2                     17
+#define MC_CameraSignalSet_I2                     18
+#define MC_CameraSignalSet_A3                     19
+#define MC_CameraSignalSet_B3                     20
+#define MC_CameraSignalSet_C3                     21
+#define MC_CameraSignalSet_D3                     22
+#define MC_CameraSignalSet_E3                     23
+#define MC_CameraSignalSet_F3                     24
+#define MC_CameraSignalSet_G3                     25
+#define MC_CameraSignalSet_INVALID                26
+#define MC_ConnectorConfigX                      (MCPARAMID)( 2849 << 14)
+#define MC_ConnectorConfigX_FREE                   1
+#define MC_ConnectorConfigX_A1                     2
+#define MC_ConnectorConfigX_B1                     3
+#define MC_ConnectorConfigX_C1                     4
+#define MC_ConnectorConfigX_D1                     5
+#define MC_ConnectorConfigX_E1                     6
+#define MC_ConnectorConfigX_F1                     7
+#define MC_ConnectorConfigX_G1                     8
+#define MC_ConnectorConfigX_H1                     9
+#define MC_ConnectorConfigX_I1                    10
+#define MC_ConnectorConfigX_A2                    11
+#define MC_ConnectorConfigX_B2                    12
+#define MC_ConnectorConfigX_C2                    13
+#define MC_ConnectorConfigX_D2                    14
+#define MC_ConnectorConfigX_E2                    15
+#define MC_ConnectorConfigX_F2                    16
+#define MC_ConnectorConfigX_G2                    17
+#define MC_ConnectorConfigX_H2                    18
+#define MC_ConnectorConfigX_I2                    19
+#define MC_ConnectorConfigX_A3                    20
+#define MC_ConnectorConfigX_B3                    21
+#define MC_ConnectorConfigX_C3                    22
+#define MC_ConnectorConfigX_D3                    23
+#define MC_ConnectorConfigX_E3                    24
+#define MC_ConnectorConfigX_F3                    25
+#define MC_ConnectorConfigX_G3                    26
+#define MC_ConnectorConfigX_A1_A1                 27
+#define MC_ConnectorConfigX_B1_A1                 28
+#define MC_ConnectorConfigX_B1_B1                 29
+#define MC_ConnectorConfigX_C1_A1                 30
+#define MC_ConnectorConfigX_C1_B1                 31
+#define MC_ConnectorConfigX_C1_C1                 32
+#define MC_ConnectorConfigX_D1_A1                 33
+#define MC_ConnectorConfigX_D1_B1                 34
+#define MC_ConnectorConfigX_D1_C1                 35
+#define MC_ConnectorConfigX_D1_D1                 36
+#define MC_ConnectorConfigX_E1_A1                 37
+#define MC_ConnectorConfigX_E1_B1                 38
+#define MC_ConnectorConfigX_E1_C1                 39
+#define MC_ConnectorConfigX_E1_D1                 40
+#define MC_ConnectorConfigX_E1_E1                 41
+#define MC_ConnectorConfigX_F1_A1                 42
+#define MC_ConnectorConfigX_F1_B1                 43
+#define MC_ConnectorConfigX_F1_D1                 44
+#define MC_ConnectorConfigX_F1_E1                 45
+#define MC_ConnectorConfigX_F1_F1                 46
+#define MC_ConnectorConfigX_G1_A1                 47
+#define MC_ConnectorConfigX_G1_G1                 48
+#define MC_ConnectorConfigX_H1_A1                 49
+#define MC_ConnectorConfigX_H1_B1                 50
+#define MC_ConnectorConfigX_H1_C1                 51
+#define MC_ConnectorConfigX_H1_D1                 52
+#define MC_ConnectorConfigX_H1_E1                 53
+#define MC_ConnectorConfigX_H1_F1                 54
+#define MC_ConnectorConfigX_H1_G1                 55
+#define MC_ConnectorConfigX_I1_A1                 56
+#define MC_ConnectorConfigX_I1_B1                 57
+#define MC_ConnectorConfigX_I1_D1                 58
+#define MC_ConnectorConfigX_I1_E1                 59
+#define MC_ConnectorConfigX_Filter               (MCPARAMID)( 2850 << 14)
+#define MC_ConnectorConfigY                      (MCPARAMID)( 2851 << 14)
+#define MC_ConnectorConfigY_FREE                   1
+#define MC_ConnectorConfigY_A1                     2
+#define MC_ConnectorConfigY_B1                     3
+#define MC_ConnectorConfigY_C1                     4
+#define MC_ConnectorConfigY_D1                     5
+#define MC_ConnectorConfigY_E1                     6
+#define MC_ConnectorConfigY_F1                     7
+#define MC_ConnectorConfigY_G1                     8
+#define MC_ConnectorConfigY_H1                     9
+#define MC_ConnectorConfigY_I1                    10
+#define MC_ConnectorConfigY_A2                    11
+#define MC_ConnectorConfigY_B2                    12
+#define MC_ConnectorConfigY_C2                    13
+#define MC_ConnectorConfigY_D2                    14
+#define MC_ConnectorConfigY_E2                    15
+#define MC_ConnectorConfigY_F2                    16
+#define MC_ConnectorConfigY_G2                    17
+#define MC_ConnectorConfigY_H2                    18
+#define MC_ConnectorConfigY_I2                    19
+#define MC_ConnectorConfigY_A1_A1                 20
+#define MC_ConnectorConfigY_B1_A1                 21
+#define MC_ConnectorConfigY_B1_B1                 22
+#define MC_ConnectorConfigY_C1_A1                 23
+#define MC_ConnectorConfigY_C1_B1                 24
+#define MC_ConnectorConfigY_C1_C1                 25
+#define MC_ConnectorConfigY_D1_A1                 26
+#define MC_ConnectorConfigY_D1_B1                 27
+#define MC_ConnectorConfigY_D1_C1                 28
+#define MC_ConnectorConfigY_D1_D1                 29
+#define MC_ConnectorConfigY_E1_A1                 30
+#define MC_ConnectorConfigY_E1_B1                 31
+#define MC_ConnectorConfigY_E1_C1                 32
+#define MC_ConnectorConfigY_E1_D1                 33
+#define MC_ConnectorConfigY_E1_E1                 34
+#define MC_ConnectorConfigY_F1_A1                 35
+#define MC_ConnectorConfigY_F1_B1                 36
+#define MC_ConnectorConfigY_F1_D1                 37
+#define MC_ConnectorConfigY_F1_E1                 38
+#define MC_ConnectorConfigY_F1_F1                 39
+#define MC_ConnectorConfigY_G1_A1                 40
+#define MC_ConnectorConfigY_G1_G1                 41
+#define MC_ConnectorConfigY_H1_A1                 42
+#define MC_ConnectorConfigY_H1_B1                 43
+#define MC_ConnectorConfigY_H1_C1                 44
+#define MC_ConnectorConfigY_H1_D1                 45
+#define MC_ConnectorConfigY_H1_E1                 46
+#define MC_ConnectorConfigY_H1_F1                 47
+#define MC_ConnectorConfigY_H1_G1                 48
+#define MC_ConnectorConfigY_I1_A1                 49
+#define MC_ConnectorConfigY_I1_B1                 50
+#define MC_ConnectorConfigY_I1_D1                 51
+#define MC_ConnectorConfigY_I1_E1                 52
+#define MC_ConnectorConfigY_Filter               (MCPARAMID)( 2852 << 14)
+#define MC_ConnectorConfigY_A3                    53
+#define MC_ConnectorConfigY_B3                    54
+#define MC_ConnectorConfigY_C3                    55
+#define MC_ConnectorConfigY_D3                    56
+#define MC_ConnectorConfigY_E3                    57
+#define MC_ConnectorConfigY_F3                    58
+#define MC_ConnectorConfigY_G3                    59
+#define MC_ConnectorConfigZ                      (MCPARAMID)( 2853 << 14)
+#define MC_ConnectorConfigZ_FREE                   1
+#define MC_ConnectorConfigZ_A1                     2
+#define MC_ConnectorConfigZ_B1                     3
+#define MC_ConnectorConfigZ_C1                     4
+#define MC_ConnectorConfigZ_D1                     5
+#define MC_ConnectorConfigZ_E1                     6
+#define MC_ConnectorConfigZ_F1                     7
+#define MC_ConnectorConfigZ_G1                     8
+#define MC_ConnectorConfigZ_H1                     9
+#define MC_ConnectorConfigZ_I1                    10
+#define MC_ConnectorConfigZ_A2                    11
+#define MC_ConnectorConfigZ_B2                    12
+#define MC_ConnectorConfigZ_C2                    13
+#define MC_ConnectorConfigZ_D2                    14
+#define MC_ConnectorConfigZ_E2                    15
+#define MC_ConnectorConfigZ_F2                    16
+#define MC_ConnectorConfigZ_G2                    17
+#define MC_ConnectorConfigZ_H2                    18
+#define MC_ConnectorConfigZ_I2                    19
+#define MC_ConnectorConfigZ_A1_A1                 20
+#define MC_ConnectorConfigZ_B1_A1                 21
+#define MC_ConnectorConfigZ_B1_B1                 22
+#define MC_ConnectorConfigZ_C1_A1                 23
+#define MC_ConnectorConfigZ_C1_B1                 24
+#define MC_ConnectorConfigZ_C1_C1                 25
+#define MC_ConnectorConfigZ_D1_A1                 26
+#define MC_ConnectorConfigZ_D1_B1                 27
+#define MC_ConnectorConfigZ_D1_C1                 28
+#define MC_ConnectorConfigZ_D1_D1                 29
+#define MC_ConnectorConfigZ_E1_A1                 30
+#define MC_ConnectorConfigZ_E1_B1                 31
+#define MC_ConnectorConfigZ_E1_C1                 32
+#define MC_ConnectorConfigZ_E1_D1                 33
+#define MC_ConnectorConfigZ_E1_E1                 34
+#define MC_ConnectorConfigZ_F1_A1                 35
+#define MC_ConnectorConfigZ_F1_B1                 36
+#define MC_ConnectorConfigZ_F1_D1                 37
+#define MC_ConnectorConfigZ_F1_E1                 38
+#define MC_ConnectorConfigZ_F1_F1                 39
+#define MC_ConnectorConfigZ_G1_A1                 40
+#define MC_ConnectorConfigZ_G1_G1                 41
+#define MC_ConnectorConfigZ_H1_A1                 42
+#define MC_ConnectorConfigZ_H1_B1                 43
+#define MC_ConnectorConfigZ_H1_C1                 44
+#define MC_ConnectorConfigZ_H1_D1                 45
+#define MC_ConnectorConfigZ_H1_E1                 46
+#define MC_ConnectorConfigZ_H1_F1                 47
+#define MC_ConnectorConfigZ_H1_G1                 48
+#define MC_ConnectorConfigZ_I1_A1                 49
+#define MC_ConnectorConfigZ_I1_B1                 50
+#define MC_ConnectorConfigZ_I1_D1                 51
+#define MC_ConnectorConfigZ_I1_E1                 52
+#define MC_ConnectorConfigZ_Filter               (MCPARAMID)( 2854 << 14)
+#define MC_ConnectorConfig                       (MCPARAMID)( 2855 << 14)
+#define MC_ConnectorConfig_FREE                   60
+#define MC_ConnectorConfig_A1                     61
+#define MC_ConnectorConfig_B1                     62
+#define MC_ConnectorConfig_C1                     63
+#define MC_ConnectorConfig_D1                     64
+#define MC_ConnectorConfig_E1                     65
+#define MC_ConnectorConfig_F1                     66
+#define MC_ConnectorConfig_G1                     67
+#define MC_ConnectorConfig_H1                     68
+#define MC_ConnectorConfig_I1                     69
+#define MC_ConnectorConfig_A2                     70
+#define MC_ConnectorConfig_B2                     71
+#define MC_ConnectorConfig_C2                     72
+#define MC_ConnectorConfig_D2                     73
+#define MC_ConnectorConfig_E2                     74
+#define MC_ConnectorConfig_F2                     75
+#define MC_ConnectorConfig_G2                     76
+#define MC_ConnectorConfig_H2                     77
+#define MC_ConnectorConfig_I2                     78
+#define MC_ConnectorConfig_A3                     79
+#define MC_ConnectorConfig_B3                     80
+#define MC_ConnectorConfig_C3                     81
+#define MC_ConnectorConfig_D3                     82
+#define MC_ConnectorConfig_E3                     83
+#define MC_ConnectorConfig_F3                     84
+#define MC_ConnectorConfig_G3                     85
+#define MC_ConnectorConfig_A1_A1                  86
+#define MC_ConnectorConfig_B1_A1                  87
+#define MC_ConnectorConfig_B1_B1                  88
+#define MC_ConnectorConfig_C1_A1                  89
+#define MC_ConnectorConfig_C1_B1                  90
+#define MC_ConnectorConfig_C1_C1                  91
+#define MC_ConnectorConfig_D1_A1                  92
+#define MC_ConnectorConfig_D1_B1                  93
+#define MC_ConnectorConfig_D1_C1                  94
+#define MC_ConnectorConfig_D1_D1                  95
+#define MC_ConnectorConfig_E1_A1                  96
+#define MC_ConnectorConfig_E1_B1                  97
+#define MC_ConnectorConfig_E1_C1                  98
+#define MC_ConnectorConfig_E1_D1                  99
+#define MC_ConnectorConfig_E1_E1                 100
+#define MC_ConnectorConfig_F1_A1                 101
+#define MC_ConnectorConfig_F1_B1                 102
+#define MC_ConnectorConfig_F1_D1                 103
+#define MC_ConnectorConfig_F1_E1                 104
+#define MC_ConnectorConfig_F1_F1                 105
+#define MC_ConnectorConfig_G1_A1                 106
+#define MC_ConnectorConfig_G1_G1                 107
+#define MC_ConnectorConfig_H1_A1                 108
+#define MC_ConnectorConfig_H1_B1                 109
+#define MC_ConnectorConfig_H1_C1                 110
+#define MC_ConnectorConfig_H1_D1                 111
+#define MC_ConnectorConfig_H1_E1                 112
+#define MC_ConnectorConfig_H1_F1                 113
+#define MC_ConnectorConfig_H1_G1                 114
+#define MC_ConnectorConfig_I1_A1                 115
+#define MC_ConnectorConfig_I1_B1                 116
+#define MC_ConnectorConfig_I1_D1                 117
+#define MC_ConnectorConfig_I1_E1                 118
+#define MC_CameraSignalSetX                      (MCPARAMID)( 2856 << 14)
+#define MC_CameraSignalSetXBIS                   (MCPARAMID)( 2857 << 14)
+#define MC_CameraSignalSetY                      (MCPARAMID)( 2858 << 14)
+#define MC_CameraSignalSetYBIS                   (MCPARAMID)( 2859 << 14)
+#define MC_ConnectorXTopology                    (MCPARAMID)( 2860 << 14)
+#define MC_ConnectorYTopology                    (MCPARAMID)( 2861 << 14)
+#define MC_CameraSignalSetZ                      (MCPARAMID)( 2862 << 14)
+#define MC_CameraSignalSetZBIS                   (MCPARAMID)( 2863 << 14)
+#define MC_ConnectorZTopology                    (MCPARAMID)( 2864 << 14)
+#define MC_ConnectorPort                         (MCPARAMID)( 2865 << 14)
+#define MC_ConnectorPort_PRIMARY                   1
+#define MC_ConnectorPort_SECONDARY                 2
+#define MC_ConnectorTopology                     (MCPARAMID)( 2866 << 14)
+#define MC_ConnectorCameraCount                  (MCPARAMID)( 2867 << 14)
+#define MC_RCable                                (MCPARAMID)( 2868 << 14)
+#define MC_RCable_NONE                             1
+#define MC_RCable_A15_C01                          2
+#define MC_RCable_A15_C02                          3
+#define MC_RCable_A15_C03                          4
+#define MC_RCable_A15_C04                          5
+#define MC_RCable_A15_C05                          6
+#define MC_RCable_A15_C06                          7
+#define MC_RCable_A15_C07                          8
+#define MC_RCable_A15_C08                          9
+#define MC_RCable_A15_C09                         10
+#define MC_RCable_A15_C10                         11
+#define MC_RCable_A15_C11                         12
+#define MC_RCable_A15_C12                         13
+#define MC_RCable_A15_C13                         14
+#define MC_RCable_A15_C14                         15
+#define MC_RCable_A15_C15                         16
+#define MC_RCable_A15_C16                         17
+#define MC_RCable_A15_C17                         18
+#define MC_RCable_A15_C18                         19
+#define MC_RCable_A15_C19                         20
+#define MC_CamCable_Check                        (MCPARAMID)( 2869 << 14)
+#define MC_CamCable_Check_PASS                     1
+#define MC_CamCable_Check_FAIL                     2
+#define MC_Cable_A15_C110000000                   30
+#define MC_Cable_A15_C110010000                   31
+#define MC_Cable_A15_C110210000                   32
+#define MC_Cable_A15_C111100000                   33
+#define MC_Cable_A15_C111010000                   34
+#define MC_Cable_A15_C111210000                   35
+#define MC_Cable_A15_C111020000                   36
+#define MC_Cable_A15_C112200000                   37
+#define MC_Cable_A15_C112210000                   38
+#define MC_Cable_A15_C210000000                   39
+#define MC_Cable_A15_C210010000                   40
+#define MC_Cable_A15_C210210000                   41
+#define MC_Cable_A15_C211100000                   42
+#define MC_Cable_A15_C211010000                   43
+#define MC_Cable_A15_C211210000                   44
+#define MC_Cable_A15_C211020000                   45
+#define MC_Cable_A15_C212200000                   46
+#define MC_Cable_A15_C212210000                   47
+#define MC_Cable_A15_C310000000                   48
+#define MC_Cable_A15_C310010000                   49
+#define MC_Cable_A15_C310210000                   50
+#define MC_Cable_A15_C311100000                   51
+#define MC_Cable_A15_C311010000                   52
+#define MC_Cable_A15_C311210000                   53
+#define MC_Cable_A15_C311020000                   54
+#define MC_Cable_A15_C110001000                   55
+#define MC_Cable_A15_C110011000                   56
+#define MC_Cable_A15_C110211000                   57
+#define MC_Cable_A15_C111101000                   58
+#define MC_Cable_A15_C111011000                   59
+#define MC_Cable_A15_C111211000                   60
+#define MC_Cable_A15_C111021000                   61
+#define MC_Cable_A15_C112201000                   62
+#define MC_Cable_A15_C112211000                   63
+#define MC_Cable_A15_C110011001                   64
+#define MC_Cable_A15_C110211001                   65
+#define MC_Cable_A15_C111101001                   66
+#define MC_Cable_A15_C111011001                   67
+#define MC_Cable_A15_C111211001                   68
+#define MC_Cable_A15_C112201001                   69
+#define MC_Cable_A15_C112211001                   70
+#define MC_Cable_A15_C110211021                   71
+#define MC_Cable_A15_C111101021                   72
+#define MC_Cable_A15_C111011021                   73
+#define MC_Cable_A15_C112201021                   74
+#define MC_Cable_A15_C111101110                   75
+#define MC_Cable_A15_C111011110                   76
+#define MC_Cable_A15_C111211110                   77
+#define MC_Cable_A15_C112201110                   78
+#define MC_Cable_A15_C112211110                   79
+#define MC_Cable_A15_C111011101                   80
+#define MC_Cable_A15_C111211101                   81
+#define MC_Cable_A15_C112201101                   82
+#define MC_Cable_A15_C112211101                   83
+#define MC_Cable_A15_C111211121                   84
+#define MC_Cable_A15_C112201121                   85
+#define MC_Cable_A15_C111021102                   86
+#define MC_Cable_A15_C112201102                   87
+#define MC_CableName_One_Camera_Single_Channel_A  27
+#define MC_CableName_One_Camera_Single_Channel_B  28
+#define MC_CableName_One_Camera_Single_Channel_C  29
+#define MC_CableName_One_Camera_Single_Channel_D  30
+#define MC_CableName_One_Camera_Single_Channel_E  31
+#define MC_CableName_One_Camera_Single_Channel_F  32
+#define MC_CableName_One_Camera_Single_Channel_G  33
+#define MC_CableName_One_Camera_Single_Channel_H  34
+#define MC_CableName_One_Camera_Single_Channel_I  35
+#define MC_CableName_One_Camera_Dual_Channel_A    36
+#define MC_CableName_One_Camera_Dual_Channel_B    37
+#define MC_CableName_One_Camera_Dual_Channel_C    38
+#define MC_CableName_One_Camera_Dual_Channel_D    39
+#define MC_CableName_One_Camera_Dual_Channel_E    40
+#define MC_CableName_One_Camera_Dual_Channel_F    41
+#define MC_CableName_One_Camera_Dual_Channel_G    42
+#define MC_CableName_One_Camera_Dual_Channel_H    43
+#define MC_CableName_One_Camera_Dual_Channel_I    44
+#define MC_CableName_One_Camera_Triple_Channel_A  45
+#define MC_CableName_One_Camera_Triple_Channel_B  46
+#define MC_CableName_One_Camera_Triple_Channel_C  47
+#define MC_CableName_One_Camera_Triple_Channel_D  48
+#define MC_CableName_One_Camera_Triple_Channel_E  49
+#define MC_CableName_One_Camera_Triple_Channel_F  50
+#define MC_CableName_One_Camera_Triple_Channel_G  51
+#define MC_CableName_Two_Cameras_Single_Channel_AA  52
+#define MC_CableName_Two_Cameras_Single_Channel_BA  53
+#define MC_CableName_Two_Cameras_Single_Channel_CA  54
+#define MC_CableName_Two_Cameras_Single_Channel_DA  55
+#define MC_CableName_Two_Cameras_Single_Channel_EA  56
+#define MC_CableName_Two_Cameras_Single_Channel_FA  57
+#define MC_CableName_Two_Cameras_Single_Channel_GA  58
+#define MC_CableName_Two_Cameras_Single_Channel_HA  59
+#define MC_CableName_Two_Cameras_Single_Channel_IA  60
+#define MC_CableName_Two_Cameras_Single_Channel_BB  61
+#define MC_CableName_Two_Cameras_Single_Channel_CB  62
+#define MC_CableName_Two_Cameras_Single_Channel_DB  63
+#define MC_CableName_Two_Cameras_Single_Channel_EB  64
+#define MC_CableName_Two_Cameras_Single_Channel_FB  65
+#define MC_CableName_Two_Cameras_Single_Channel_HB  66
+#define MC_CableName_Two_Cameras_Single_Channel_IB  67
+#define MC_CableName_Two_Cameras_Single_Channel_CC  68
+#define MC_CableName_Two_Cameras_Single_Channel_DC  69
+#define MC_CableName_Two_Cameras_Single_Channel_EC  70
+#define MC_CableName_Two_Cameras_Single_Channel_HC  71
+#define MC_CableName_Two_Cameras_Single_Channel_DD  72
+#define MC_CableName_Two_Cameras_Single_Channel_ED  73
+#define MC_CableName_Two_Cameras_Single_Channel_FD  74
+#define MC_CableName_Two_Cameras_Single_Channel_HD  75
+#define MC_CableName_Two_Cameras_Single_Channel_ID  76
+#define MC_CableName_Two_Cameras_Single_Ehannel_EE  77
+#define MC_CableName_Two_Cameras_Single_Ehannel_FE  78
+#define MC_CableName_Two_Cameras_Single_Ehannel_HE  79
+#define MC_CableName_Two_Cameras_Single_Ehannel_IE  80
+#define MC_CableName_Two_Cameras_Single_Channel_FF  81
+#define MC_CableName_Two_Cameras_Single_Channel_HF  82
+#define MC_CableName_Two_Cameras_Single_Ehannel_GG  83
+#define MC_CableName_Two_Cameras_Single_Ehannel_HG  84
+#define MC_CCCount                               (MCPARAMID)( 2870 << 14)
+#define MC_CCCount_ONE                             1
+#define MC_CCCount_TWO                             2
+#define MC_CableType                             (MCPARAMID)( 2871 << 14)
+#define MC_Cable_A15_T2A                          88
+#define MC_Cable_A15_T2B                          89
+#define MC_Cable_A15_T2C                          90
+#define MC_Cable_A15_T2D                          91
+#define MC_Cable_A15_T2E                          92
+#define MC_Cable_A15_T2F                          93
+#define MC_Cable_A15_T2G                          94
+#define MC_Cable_A15_T2H                          95
+#define MC_Cable_A15_T2I                          96
+#define MC_Cable_A15_T1A                          97
+#define MC_Cable_A15_T1B                          98
+#define MC_Cable_A15_T1C                          99
+#define MC_Cable_A15_T1D                         100
+#define MC_Cable_A15_T1E                         101
+#define MC_Cable_A15_T1F                         102
+#define MC_Cable_A15_T1G                         103
+#define MC_Cable_A15_T1H                         104
+#define MC_Cable_A15_T1I                         105
+#define MC_Cable_A15_T3A                         106
+#define MC_Cable_A15_T3B                         107
+#define MC_Cable_A15_T3C                         108
+#define MC_Cable_A15_T3D                         109
+#define MC_Cable_A15_T3E                         110
+#define MC_Cable_A15_T3F                         111
+#define MC_Cable_A15_T3G                         112
+#define MC_Cable_A15_T11AA                       113
+#define MC_Cable_A15_T11BA                       114
+#define MC_Cable_A15_T11BB                       115
+#define MC_Cable_A15_T11CA                       116
+#define MC_Cable_A15_T11CB                       117
+#define MC_Cable_A15_T11CC                       118
+#define MC_Cable_A15_T11DA                       119
+#define MC_Cable_A15_T11DB                       120
+#define MC_Cable_A15_T11DC                       121
+#define MC_Cable_A15_T11DD                       122
+#define MC_Cable_A15_T11EA                       123
+#define MC_Cable_A15_T11EB                       124
+#define MC_Cable_A15_T11EC                       125
+#define MC_Cable_A15_T11ED                       126
+#define MC_Cable_A15_T11EE                       127
+#define MC_Cable_A15_T11FA                       128
+#define MC_Cable_A15_T11FB                       129
+#define MC_Cable_A15_T11FD                       130
+#define MC_Cable_A15_T11FE                       131
+#define MC_Cable_A15_T11FF                       132
+#define MC_Cable_A15_T11GA                       133
+#define MC_Cable_A15_T11GG                       134
+#define MC_Cable_A15_T11HA                       135
+#define MC_Cable_A15_T11HB                       136
+#define MC_Cable_A15_T11HC                       137
+#define MC_Cable_A15_T11HD                       138
+#define MC_Cable_A15_T11HE                       139
+#define MC_Cable_A15_T11HF                       140
+#define MC_Cable_A15_T11HG                       141
+#define MC_Cable_A15_T11IA                       142
+#define MC_Cable_A15_T11IB                       143
+#define MC_Cable_A15_T11ID                       144
+#define MC_Cable_A15_T11IE                       145
+#define MC_CableName_Two_Cameras_Single_Channel_EE  85
+#define MC_CableName_Two_Cameras_Single_Channel_FE  86
+#define MC_CableName_Two_Cameras_Single_Channel_GG  87
+#define MC_CableName_Two_Cameras_Single_Channel_HE  88
+#define MC_CableName_Two_Cameras_Single_Channel_HG  89
+#define MC_CableName_Two_Cameras_Single_Channel_IE  90
+#define MC_CableXTopology                        (MCPARAMID)( 2872 << 14)
+#define MC_CableYTopology                        (MCPARAMID)( 2873 << 14)
+#define MC_CableTopology                         (MCPARAMID)( 2874 << 14)
+#define MC_CableZTopology                        (MCPARAMID)( 2875 << 14)
+#define MC_Camera_CV_M30                         142
+#define MC_CamConfig_P120SA                      191
+#define MC_CamConfig_P120RA                      192
+#define MC_CableModel                            (MCPARAMID)( 2876 << 14)
+#define MC_CableModel_SPECIFIC                     1
+#define MC_CableModel_GENERIC                      2
+#define MC__PrimaryTopology                      (MCPARAMID)( 2877 << 14)
+#define MC__SecondaryTopology                    (MCPARAMID)( 2878 << 14)
+#define MC__MyTopology                           (MCPARAMID)( 2879 << 14)
+#define MC_CableTopology_CSS_Check               (MCPARAMID)( 2880 << 14)
+#define MC_CableTopology_CSS_Check_PASS            1
+#define MC_CableTopology_CSS_Check_FAIL            2
+#define MC_CableTopology_Swap_Check              (MCPARAMID)( 2881 << 14)
+#define MC_CableTopology_Swap_Check_PASS           1
+#define MC_CableTopology_Swap_Check_FAIL           2
+#define MC_CableTopology_Validity_Check          (MCPARAMID)( 2882 << 14)
+#define MC_CableTopology_Validity_Check_PASS       1
+#define MC_CableTopology_Validity_Check_FAIL       2
+#define MC___CableTopology_Check                 (MCPARAMID)( 2883 << 14)
+#define MC___CableTopology_Check_PASS              1
+#define MC___CableTopology_Check_FAIL              2
+#define MC___CamCable_Check                      (MCPARAMID)( 2884 << 14)
+#define MC___CamCable_Check_PASS                   1
+#define MC___CamCable_Check_FAIL                   2
+#define MC_RCableV                               (MCPARAMID)( 2885 << 14)
+#define MC_RCableV_A                               1
+#define MC_RCableV_B                               2
+#define MC_CorrectedCableTopology                (MCPARAMID)( 2886 << 14)
+#define MC__CableTopology                        (MCPARAMID)( 2887 << 14)
+#define MC_INITD1Signature                       (MCPARAMID)( 2888 << 14)
+#define MC_INITD2Signature                       (MCPARAMID)( 2889 << 14)
+#define MC_DigUnitRecord                         (MCPARAMID)( 2890 << 14)
+#define MC_INITD2Condition                       (MCPARAMID)( 2891 << 14)
+#define MC_GainCtl_p6DB                            9
+#define MC_GainCtl_p5DB                           10
+#define MC_GainCtl_p4DB                           11
+#define MC_GainCtl_Filter                        (MCPARAMID)( 2892 << 14)
+#define MC__NominalGain                          (MCPARAMID)( 2893 << 14)
+#define MC_GainLinMin                            (MCPARAMID)( 2894 << 14)
+#define MC_GainLinMax                            (MCPARAMID)( 2895 << 14)
+#define MC_GainDBMin                             (MCPARAMID)( 2896 << 14)
+#define MC_GainDBMax                             (MCPARAMID)( 2897 << 14)
+#define MC_CamConfig_P240RA                      193
+#define MC__PhaseLength                          (MCPARAMID)( 2898 << 14)
+#define MC_SceneLength                           (MCPARAMID)( 2899 << 14)
+#define MC__BoardType__PICOLO_TETRA               15
+#define MC__BoardType__PICOLO_JETSTREAM           16
+#define MC_InputMaxId_                           (MCPARAMID)( 2900 << 14)
+#define MC_OutputMaxId_                          (MCPARAMID)( 2901 << 14)
+#define MC_Operation_LONGPAGE                      8
+#define MC_SGASet                                (MCPARAMID)( 2902 << 14)
+#define MC__GAP_MODE                             (MCPARAMID)( 2903 << 14)
+#define MC__GAP_MODE_SINGLE_SEQ                    1
+#define MC__GAP_MODE_MULTIPLE_SEQ                  2
+#define MC__COVER_MODE                           (MCPARAMID)( 2904 << 14)
+#define MC__COVER_MODE_ON                          1
+#define MC__COVER_MODE_OFF                         2
+#define MC_STZUsage_COVERX                         4
+#define MC_STZUsage_COVERY                         5
+#define MC__STR_STZSRC_COVER_X                     7
+#define MC__STR_STZSRC_COVER_Y                     8
+#define MC_STZUsage_TRIGX                          6
+#define MC_STZUsage_TRIGY                          7
+#define MC__STR_STZSRC_TRIG_X                      9
+#define MC__STR_STZSRC_TRIG_Y                     10
+#define MC_EndTrigEdge                           (MCPARAMID)( 2905 << 14)
+#define MC_EndTrigEdge_GOHIGH                      1
+#define MC_EndTrigEdge_GOLOW                       2
+#define MC_EndTrigLine                           (MCPARAMID)( 2906 << 14)
+#define MC_EndTrigLine_NOM                         1
+#define MC_EndTrigLine_ALT1                        2
+#define MC_EndTrigLine_ALT2                        3
+#define MC_EndTrigLine_PG                          4
+#define MC_EndTrigLine_LTACT                       5
+#define MC_EndTrigLine_TRX                         6
+#define MC_EndTrigLine_TRY                         7
+#define MC_EndTrigLine_TRZ                         8
+#define MC_EndTrigLine_NONE                        9
+#define MC_Camera_YD5040                         143
+#define MC_EndTrigLine_TRG                        10
+#define MC__SP_Factor_Min_1                      (MCPARAMID)( 2907 << 14)
+#define MC__SP_Factor_AMin_PG                    (MCPARAMID)( 2908 << 14)
+#define MC__SP_Factor_AMin_RC                    (MCPARAMID)( 2909 << 14)
+#define MC__SP_Factor_RMAx_RC                    (MCPARAMID)( 2910 << 14)
+#define MC_CamConfig_L4096RP                     194
+#define MC_PCIDeviceID                           (MCPARAMID)( 2911 << 14)
+#define MC_PCIVendorID                           (MCPARAMID)( 2912 << 14)
+#define MC_PCISubDeviceID                        (MCPARAMID)( 2913 << 14)
+#define MC_PCISubVendorID                        (MCPARAMID)( 2914 << 14)
+#define MC___TrigLine_Check                      (MCPARAMID)( 2915 << 14)
+#define MC___TrigLine_Check_PASS                   1
+#define MC___TrigLine_Check_FAIL                   2
+#define MC_EndTrigMode                           (MCPARAMID)( 2916 << 14)
+#define MC_EndTrigMode_AUTO                        1
+#define MC_EndTrigMode_HARD                        2
+#define MC_HFRModeOnly_Filter                    (MCPARAMID)( 2917 << 14)
+#define MC__FrameCountModulo                     (MCPARAMID)( 2918 << 14)
+#define MC_SetLength_Fr                          (MCPARAMID)( 2919 << 14)
+#define MC__HFR_MODE                             (MCPARAMID)( 2920 << 14)
+#define MC__HFR_MODE_ON                            1
+#define MC__HFR_MODE_OFF                           2
+#define MC__TotalSetLength                       (MCPARAMID)( 2921 << 14)
+#define MC_FrameGrabSizeY_Ln                     (MCPARAMID)( 2922 << 14)
+#define MC_AsyncOverlapLoadSet                   (MCPARAMID)( 2923 << 14)
+#define MC__SequenceLoadSet                      (MCPARAMID)( 2924 << 14)
+#define MC__SequenceLoadSet_NONE                   1
+#define MC__SequenceLoadSet_S1                     2
+#define MC__SequenceLoadSet_S2                     3
+#define MC__SequenceLoadSet_I1                     4
+#define MC__SequenceLoadSet_I2                     5
+#define MC__SequenceLoadSet_M                      6
+#define MC__SequenceLoadSet_V                      7
+#define MC__SequenceLoadSet_O                      8
+#define MC__SequenceLoadSet_Z                      9
+#define MC__SequenceLoadSet_X1                    10
+#define MC__SequenceLoadSet_X2                    11
+#define MC_NONELoadSet                           (MCPARAMID)( 2925 << 14)
+#define MC_CamConfig_P60RM_O                     195
+#define MC__TotalFrameCount                      (MCPARAMID)( 2926 << 14)
+#define MC__SequenceLoadSet_W                     12
+#define MC__ACQW_Line1_Dur                       (MCPARAMID)( 2927 << 14)
+#define MC__ACQW_Acq_Dur                         (MCPARAMID)( 2928 << 14)
+#define MC__ACQW_Line3_Dur                       (MCPARAMID)( 2929 << 14)
+#define MC__ACQW_Line5_Dur                       (MCPARAMID)( 2930 << 14)
+#define MC_ASYNCI2LoadSet                        (MCPARAMID)( 2931 << 14)
+#define MC_FieldParityOrder                      (MCPARAMID)( 2932 << 14)
+#define MC_FieldParityOrder_UNDEFINED              1
+#define MC_FieldParityOrder_DWUP                   2
+#define MC_FieldParityOrder_UPDW                   3
+#define MC_AnalogGrabPosY_Ln                     (MCPARAMID)( 2933 << 14)
+#define MC_FrameSetLength_Fr                     (MCPARAMID)( 2934 << 14)
+#define MC_ACReset                               (MCPARAMID)( 2935 << 14)
+#define MC_ACReset_NO                              1
+#define MC_ACReset_YES                             2
+#define MC_ACResetWidth_us                       (MCPARAMID)( 2936 << 14)
+#define MC_ACResetPostDelay_us                   (MCPARAMID)( 2937 << 14)
+#define MC__PLL_LOCK_TIME_ms                     (MCPARAMID)( 2938 << 14)
+#define MC_INITC1_GPTCOUNT_us                    (MCPARAMID)( 2939 << 14)
+#define MC_INITC1_GPTCOUNT                       (MCPARAMID)( 2940 << 14)
+#define MC_INITC2_GPTCOUNT_us                    (MCPARAMID)( 2941 << 14)
+#define MC_INITC2_GPTCOUNT                       (MCPARAMID)( 2942 << 14)
+#define MC_Light                                 (MCPARAMID)( 2943 << 14)
+#define MC_Camera_AViiVA_M4CL6007                144
+#define MC__BoardType__COLORSCAN                  17
+#define MC_Strobe_Filter                         (MCPARAMID)( 2944 << 14)
+#define MC_SHC_DarkBackground                    (MCPARAMID)( 2945 << 14)
+#define MC_SHC_LightBackground                   (MCPARAMID)( 2946 << 14)
+#define MC_SHC_Dark                              (MCPARAMID)( 2947 << 14)
+#define MC_SHC_Light                             (MCPARAMID)( 2948 << 14)
+#define MC_SHC_UseIndex                          (MCPARAMID)( 2949 << 14)
+#define MC_SHC_StoreIndex                        (MCPARAMID)( 2950 << 14)
+#define MC_LUT_Table                             (MCPARAMID)( 2951 << 14)
+#define MC_LUT_Contrast                          (MCPARAMID)( 2952 << 14)
+#define MC_LUT_Brightness                        (MCPARAMID)( 2953 << 14)
+#define MC_LUT_Visibility                        (MCPARAMID)( 2954 << 14)
+#define MC_LUT_Negative                          (MCPARAMID)( 2955 << 14)
+#define MC_LUT_Negative_TRUE                       1
+#define MC_LUT_Negative_FALSE                      2
+#define MC_LUT_UseIndex                          (MCPARAMID)( 2956 << 14)
+#define MC_LUT_StoreIndex                        (MCPARAMID)( 2957 << 14)
+#define MC_SHC_UsePhysicalIndex                  (MCPARAMID)( 2958 << 14)
+#define MC_LUT_UsePhysicalIndex                  (MCPARAMID)( 2959 << 14)
+#define MC_SHC_OffsetAdjust                      (MCPARAMID)( 2960 << 14)
+#define MC_CamConfig_LxxxxRP                     196
+#define MC_CamConfig_L2098RP                     197
+#define MC_CamConfig_L2048RP                     198
+#define MC_CamConfig_L7500SP                     199
+#define MC_CamConfig_L7500RC                     200
+#define MC_CamConfig_L7500RG                     201
+#define MC_CamConfig_L7500RP                     202
+#define MC_CamConfig_L8192RP                     203
+#define MC_Camera_NUCL4096D                      145
+#define MC_Camera_NUCL7500D                      146
+#define MC_Camera_YD5060                         147
+#define MC_CamConfig_L6144RP                     204
+#define MC_Manufacturer_NED                       22
+#define MC_ColorRegistration_RGB                   5
+#define MC_ColorRegistration_GBR                   6
+#define MC_ColorRegistration_BRG                   7
+#define MC_ColorGap                              (MCPARAMID)( 2961 << 14)
+#define MC_STARTR_GPTCOUNT_us                    (MCPARAMID)( 2962 << 14)
+#define MC_STARTR_GPTCOUNT                       (MCPARAMID)( 2963 << 14)
+#define MC__SEQE_E                               (MCPARAMID)( 2964 << 14)
+#define MC_PostExpose_us                         (MCPARAMID)( 2965 << 14)
+#define MC_PostExpose_Tk                         (MCPARAMID)( 2966 << 14)
+#define MC_PostExpose_E                          (MCPARAMID)( 2967 << 14)
+#define MC__CSC_NROT                             (MCPARAMID)( 2968 << 14)
+#define MC__CSC_LNCPT                            (MCPARAMID)( 2969 << 14)
+#define MC__LCA_R1                               (MCPARAMID)( 2970 << 14)
+#define MC__LCA_R2                               (MCPARAMID)( 2971 << 14)
+#define MC__LCA_R3                               (MCPARAMID)( 2972 << 14)
+#define MC__LCA_R4                               (MCPARAMID)( 2973 << 14)
+#define MC__LCA_G1                               (MCPARAMID)( 2974 << 14)
+#define MC__LCA_G2                               (MCPARAMID)( 2975 << 14)
+#define MC__LCA_G3                               (MCPARAMID)( 2976 << 14)
+#define MC__LCA_G4                               (MCPARAMID)( 2977 << 14)
+#define MC__LCA_B1                               (MCPARAMID)( 2978 << 14)
+#define MC__LCA_B2                               (MCPARAMID)( 2979 << 14)
+#define MC__LCA_B3                               (MCPARAMID)( 2980 << 14)
+#define MC__LCA_B4                               (MCPARAMID)( 2981 << 14)
+#define MC__CSC_FMT                              (MCPARAMID)( 2982 << 14)
+#define MC__TilesX                               (MCPARAMID)( 2983 << 14)
+#define MC__TilesY                               (MCPARAMID)( 2984 << 14)
+#define MC_ScanDirection                         (MCPARAMID)( 2985 << 14)
+#define MC_ScanDirection_FORWARD                   1
+#define MC_ScanDirection_REVERSE                   2
+#define MC__ScanDelayR_Ln                        (MCPARAMID)( 2986 << 14)
+#define MC__ScanDelayG_Ln                        (MCPARAMID)( 2987 << 14)
+#define MC__ScanDelayB_Ln                        (MCPARAMID)( 2988 << 14)
+#define MC__RBT_DAV                              (MCPARAMID)( 2989 << 14)
+#define MC__RBT_OVF                              (MCPARAMID)( 2990 << 14)
+#define MC__BAD_LBAD                             (MCPARAMID)( 2991 << 14)
+#define MC__BAD_CBAD                             (MCPARAMID)( 2992 << 14)
+#define MC_CreationModel                         (MCPARAMID)( 2993 << 14)
+#define MC_CreationModel_COLORSCAN_M               1
+#define MC_CreationModel_VALUE_M                   2
+#define MC_CreationModel_EXPERT_M                  3
+#define MC_CreationModel_EXPERT_A                  4
+#define MC_CreationModel_EXPERT_B                  5
+#define MC_CreationModel_ALPHA_X                   6
+#define MC_CreationModel_ALPHA_XBIS                7
+#define MC_CreationModel_ALPHA_Y                   8
+#define MC_CreationModel_ALPHA_YBIS                9
+#define MC_CreationModel_IOTA_X                   10
+#define MC_CreationModel_GAMMA_X                  11
+#define MC_CreationModel_GAMMA_XBIS               12
+#define MC_CreationModel_GAMMA_Y                  13
+#define MC_CreationModel_GAMMA_YBIS               14
+#define MC_CreationModel_GAMMA_Z                  15
+#define MC_CreationModel_GAMMA_ZBIS               16
+#define MC_CreationModel_FAIL                     17
+#define MC_TileSizeX_Px                          (MCPARAMID)( 2994 << 14)
+#define MC_TileCountX                            (MCPARAMID)( 2995 << 14)
+#define MC_TileSizeY_Ln                          (MCPARAMID)( 2996 << 14)
+#define MC_TileCountY                            (MCPARAMID)( 2997 << 14)
+#define MC_ImageFlipX_Filter                     (MCPARAMID)( 2998 << 14)
+#define MC_ImageFlipY_Filter                     (MCPARAMID)( 2999 << 14)
+#define MC__BoardType__PICOLO_JETX                18
+#define MC_Camera_MyColorScanCameraLink          148
+#define MC_CamConfig_LxxxxSC                     205
+#define MC_CamConfig_LxxxxRG2                    206
+#define MC_CamConfig_L1024SC                     207
+#define MC_CamConfig_L2048SC                     208
+#define MC_CamConfig_L2098SC                     209
+#define MC_CamConfig_L4096SC                     210
+#define MC_CamConfig_L6144SC                     211
+#define MC_CamConfig_L7500SC                     212
+#define MC_CamConfig_L8192SC                     213
+#define MC_CameraRateMode                        (MCPARAMID)( 3000 << 14)
+#define MC_CameraRateMode_FREERUNNING              1
+#define MC_CameraRateMode_CONTROLLED               2
+#define MC_CameraRateMode_UNKNOWN                  3
+#define MC_LineCaptureMode                       (MCPARAMID)( 3001 << 14)
+#define MC_LineCaptureMode_ALL                     1
+#define MC_LineCaptureMode_PICK                    2
+#define MC___CameraRateMode_Check                (MCPARAMID)( 3002 << 14)
+#define MC___CameraRateMode_Check_PASS             1
+#define MC___CameraRateMode_Check_FAIL             2
+#define MC___LineRateMode_Check                  (MCPARAMID)( 3003 << 14)
+#define MC___LineRateMode_Check_PASS               1
+#define MC___LineRateMode_Check_FAIL               2
+#define MC_CrossPitch                            (MCPARAMID)( 3004 << 14)
+#define MC_CrossPitch_Filter                     (MCPARAMID)( 3005 << 14)
+#define MC_ScanDelayCompensation                 (MCPARAMID)( 3006 << 14)
+#define MC_ScanDelayCompensation_DISABLED          1
+#define MC_ScanDelayCompensation_ENABLED           2
+#define MC__ScanDelay_Ln                         (MCPARAMID)( 3007 << 14)
+#define MC__GrabberOffset                        (MCPARAMID)( 3008 << 14)
+#define MC_ColorFormat_JPEG                       57
+#define MC__CamConfig_INVALID                      1
+#define MC__CamConfig_AREA_SP                      2
+#define MC__CamConfig_AREA_RP                      3
+#define MC__CamConfig_AREA_SC                      4
+#define MC__CamConfig_AREA_RC                      5
+#define MC__CamConfig_AREA_RG                      6
+#define MC__CamConfig_AREA_RG2                     7
+#define MC__CamConfig_LINE_SP                      8
+#define MC__CamConfig_LINE_RP                      9
+#define MC__CamConfig_LINE_SC                     10
+#define MC__CamConfig_LINE_RC                     11
+#define MC__CamConfig_LINE_RG                     12
+#define MC__CamConfig_LINE_RG2                    13
+#define MC__CamConfig_TDI_SP                      14
+#define MC__CamConfig_TDI_RP                      15
+#define MC___CameraConfig_Check                  (MCPARAMID)( 3009 << 14)
+#define MC___CameraConfig_Check_PASS               1
+#define MC___CameraConfig_Check_FAIL               2
+#define MC__CSC_SEQ                              (MCPARAMID)( 3010 << 14)
+#define MC_ColorScanBypass                       (MCPARAMID)( 3011 << 14)
+#define MC_ColorScanBypass_OFF                     1
+#define MC_ColorScanBypass_ON                      2
+#define MC__CSC_BYP                              (MCPARAMID)( 3012 << 14)
+#define MC__CSC_SQM                              (MCPARAMID)( 3013 << 14)
+#define MC__STM1_T1SEL_T1END                      10
+#define MC__STM1_LRSEL                           (MCPARAMID)( 3014 << 14)
+#define MC__STM1_LRSEL_FTRIGS                      1
+#define MC__STM1_LRSEL_LTRIGS                      2
+#define MC__STM1_LRSEL_PPLS                        3
+#define MC__STM1_LRSEL_OFF                         4
+#define MC_SHC_InDataWidth                       (MCPARAMID)( 3015 << 14)
+#define MC_SHC_OutDataWidth                      (MCPARAMID)( 3016 << 14)
+#define MC_LUT_InDataWidth                       (MCPARAMID)( 3017 << 14)
+#define MC_LUT_OutDataWidth                      (MCPARAMID)( 3018 << 14)
+#define MC_Camera_AViiVA_M4CL8007                149
+#define MC_BoardTopology_UNIFORM                  29
+#define MC_BoardTopology_1_2                      30
+#define MC_BoardTopology_3_0                      31
+#define MC_BoardTopology_0_3                      32
+#define MC_CreationModel_COLORSCAN                18
+#define MC_CreationModel_0x801DFFFF               19
+#define MC_CreationModel_0                        20
+#define MC_CreationModel_0x8009FFFF               21
+#define MC_CreationModel_0x800AFFFF               22
+#define MC_CreationModel_0x800BFFFF               23
+#define MC_CreationModel_0x800CFFFF               24
+#define MC_CreationModel_MC_CHANNEL_GAMMA_X       25
+#define MC_CreationModel_MC_CHANNEL_GAMMA_XBIS    26
+#define MC_CreationModel_MC_CHANNEL_GAMMA_Y       27
+#define MC_CreationModel_MC_CHANNEL_GAMMA_YBIS    28
+#define MC_CreationModel_MC_CHANNEL_GAMMA_Z       29
+#define MC_CreationModel_MC_CHANNEL_GAMMA_ZBIS    30
+#define MC_BoardInUse                            (MCPARAMID)( 3019 << 14)
+#define MC__NormalOffsetXParity                  (MCPARAMID)( 3020 << 14)
+#define MC_ChannelCount                          (MCPARAMID)( 3021 << 14)
+#define MC_Camera_CV_A33                         150
+#define MC_CamConfig_P117SC                      214
+#define MC_CamConfig_P117RG                      215
+#define MC___PCIID_Check                         (MCPARAMID)( 3022 << 14)
+#define MC___PCIID_Check_PASS                      1
+#define MC___PCIID_Check_FAIL                      2
+#define MC__PCIBridge                            (MCPARAMID)( 3023 << 14)
+#define MC__PCIBridge_PLX9054                      1
+#define MC__PCIBridge_PLX9656                      2
+#define MC__PCIBridge_UNKNOWN                      3
+#define MC_Camera_A402k                          151
+#define MC__Category_Signaling                    30
+#define MC_AcquisitionCleanup                    (MCPARAMID)( 3024 << 14)
+#define MC_AcquisitionCleanup_DISABLED             1
+#define MC_AcquisitionCleanup_ENABLED              2
+#define MC_RecycleIfNecessary                    (MCPARAMID)( 3025 << 14)
+#define MC_RecycleIfNecessary_YES                  1
+#define MC_RecycleIfNecessary_NO                   2
+#define MC_Camera_CS6910CL                       152
+#define MC___FieldPeriod                         (MCPARAMID)( 3026 << 14)
+#define MC___SwitchingGrabDelay                  (MCPARAMID)( 3027 << 14)
+#define MC_HardTrigOnly_Filter                   (MCPARAMID)( 3028 << 14)
+#define MC_NextGrabField_Filter                  (MCPARAMID)( 3029 << 14)
+#define MC_GrabFld_Filter                        (MCPARAMID)( 3030 << 14)
+#define MC__NextGrabFieldParity                  (MCPARAMID)( 3031 << 14)
+#define MC__NextGrabFieldParity_ANY                1
+#define MC__NextGrabFieldParity_UP                 2
+#define MC__NextGrabFieldParity_DOWN               3
+#define MC__NextGrabFieldParity_KEEP               4
+#define MC__NextGrabFieldParity_CHANGE             5
+#define MC__R1FieldNumber                        (MCPARAMID)( 3032 << 14)
+#define MC__R1Parity                             (MCPARAMID)( 3033 << 14)
+#define MC__R1Parity_UP                            1
+#define MC__R1Parity_DOWN                          2
+#define MC__Category_Sequence_Interlace_Master    31
+#define MC__Vref_BACQR1_H                        (MCPARAMID)( 3034 << 14)
+#define MC__Vref_BACQR2_H                        (MCPARAMID)( 3035 << 14)
+#define MC__BACQR1_EACQR1_H                      (MCPARAMID)( 3036 << 14)
+#define MC__BACQR2_EACQR2_H                      (MCPARAMID)( 3037 << 14)
+#define MC__Vref_EACQR1_H                        (MCPARAMID)( 3038 << 14)
+#define MC__Vref_EACQR2_H                        (MCPARAMID)( 3039 << 14)
+#define MC__EACQR1_BACQR2_H                      (MCPARAMID)( 3040 << 14)
+#define MC__VDRIVEDur_H                          (MCPARAMID)( 3041 << 14)
+#define MC__SYNC_IM_VRSTOn_Pos                   (MCPARAMID)( 3042 << 14)
+#define MC__SYNC_IM_VRSTOff_Pos                  (MCPARAMID)( 3043 << 14)
+#define MC__SYNC_IM_ACQR1On_Pos                  (MCPARAMID)( 3044 << 14)
+#define MC__SYNC_IM_ACQR1Off_Pos                 (MCPARAMID)( 3045 << 14)
+#define MC__SYNC_IM_VRSTMIDOn_Pos                (MCPARAMID)( 3046 << 14)
+#define MC__SYNC_IM_VRSTMIDOff_Pos               (MCPARAMID)( 3047 << 14)
+#define MC__SYNC_IM_ACQR2On_Pos                  (MCPARAMID)( 3048 << 14)
+#define MC__SYNC_IM_ACQR2Off_Pos                 (MCPARAMID)( 3049 << 14)
+#define MC__SYNC_IM_R1_Line1_RPT                 (MCPARAMID)( 3050 << 14)
+#define MC__SYNC_IM_R1_Line2_RPT                 (MCPARAMID)( 3051 << 14)
+#define MC__SYNC_IM_R1_Line3_RPT                 (MCPARAMID)( 3052 << 14)
+#define MC__SYNC_IM_R1_Line4_RPT                 (MCPARAMID)( 3053 << 14)
+#define MC__SYNC_IM_R2_Line1_RPT                 (MCPARAMID)( 3054 << 14)
+#define MC__SYNC_IM_R2_Line2_RPT                 (MCPARAMID)( 3055 << 14)
+#define MC__SYNC_IM_R2_Line3_RPT                 (MCPARAMID)( 3056 << 14)
+#define MC__SYNC_IM_R2_Line4_RPT                 (MCPARAMID)( 3057 << 14)
+#define MC__SYNC_IM_IDLER1_Line1_RPT             (MCPARAMID)( 3058 << 14)
+#define MC__SYNC_IM_IDLER1_Line2_RPT             (MCPARAMID)( 3059 << 14)
+#define MC__SYNC_IM_IDLER1_Line3_RPT             (MCPARAMID)( 3060 << 14)
+#define MC__SYNC_IM_IDLER2_Line1_RPT             (MCPARAMID)( 3061 << 14)
+#define MC__SYNC_IM_IDLER2_Line2_RPT             (MCPARAMID)( 3062 << 14)
+#define MC__SYNC_IM_IDLER2_Line3_RPT             (MCPARAMID)( 3063 << 14)
+#define MC__SYNC_IM_ACQR_Line1_RPT               (MCPARAMID)( 3064 << 14)
+#define MC__SYNC_IM_ACQR1_Line2_RPT              (MCPARAMID)( 3065 << 14)
+#define MC__SYNC_IM_ACQR1_Line3_RPT              (MCPARAMID)( 3066 << 14)
+#define MC__SYNC_IM_ACQR1_Line4_RPT              (MCPARAMID)( 3067 << 14)
+#define MC__SYNC_IM_ACQR1_Line5_RPT              (MCPARAMID)( 3068 << 14)
+#define MC__SYNC_IM_ACQR2_Line2_RPT              (MCPARAMID)( 3069 << 14)
+#define MC__SYNC_IM_ACQR2_Line3_RPT              (MCPARAMID)( 3070 << 14)
+#define MC__SYNC_IM_ACQR2_Line4_RPT              (MCPARAMID)( 3071 << 14)
+#define MC__SYNC_IM_ACQR2_Line5_RPT              (MCPARAMID)( 3072 << 14)
+#define MC_F0                                    (MCPARAMID)( 3073 << 14)
+#define MC_F1                                    (MCPARAMID)( 3074 << 14)
+#define MC_F2                                    (MCPARAMID)( 3075 << 14)
+#define MC_I0                                    (MCPARAMID)( 3076 << 14)
+#define MC__Period_Min_us                        (MCPARAMID)( 3077 << 14)
+#define MC__Period_Min_PG                        (MCPARAMID)( 3078 << 14)
+#define MC__STB_x1STYL_HOLD                        6
+#define MC__STB_x2STYL_HOLD                        6
+#define MC___MSFWarning_Check                    (MCPARAMID)( 3079 << 14)
+#define MC___MSFWarning_Check_PASS                 1
+#define MC___MSFWarning_Check_FAIL                 2
+#define MC___TrigFilter_Check                    (MCPARAMID)( 3080 << 14)
+#define MC___TrigFilter_Check_PASS                 1
+#define MC___TrigFilter_Check_FAIL                 2
+#define MC___LineTrigFilter_Check                (MCPARAMID)( 3081 << 14)
+#define MC___LineTrigFilter_Check_PASS             1
+#define MC___LineTrigFilter_Check_FAIL             2
+#define MC_DecimationFactorY                     (MCPARAMID)( 3082 << 14)
+#define MC_InputConfig_Filter_MC_IN1             (MCPARAMID)( 3083 << 14)
+#define MC___InputId_MC_IN1                      (MCPARAMID)( 3084 << 14)
+#define MC_OutputConfig_Filter_MC_OUT1           (MCPARAMID)( 3085 << 14)
+#define MC___OutputId_MC_OUT1                    (MCPARAMID)( 3086 << 14)
+#define MC_OutputState_Filter_MC_OUT1            (MCPARAMID)( 3087 << 14)
+#define MC_OutputStyle_Filter_MC_OUT1            (MCPARAMID)( 3088 << 14)
+#define MC_OutputState_MC_OUT1                   (MCPARAMID)( 3089 << 14)
+#define MC_OutputState_MC_OUT1_HOLD                1
+#define MC_OutputState_MC_OUT1_LOW                 2
+#define MC_OutputState_MC_OUT1_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT2           (MCPARAMID)( 3090 << 14)
+#define MC___OutputId_MC_OUT2                    (MCPARAMID)( 3091 << 14)
+#define MC_OutputState_Filter_MC_OUT2            (MCPARAMID)( 3092 << 14)
+#define MC_OutputStyle_Filter_MC_OUT2            (MCPARAMID)( 3093 << 14)
+#define MC_OutputState_MC_OUT2                   (MCPARAMID)( 3094 << 14)
+#define MC_OutputState_MC_OUT2_HOLD                1
+#define MC_OutputState_MC_OUT2_LOW                 2
+#define MC_OutputState_MC_OUT2_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT3           (MCPARAMID)( 3095 << 14)
+#define MC___OutputId_MC_OUT3                    (MCPARAMID)( 3096 << 14)
+#define MC_OutputState_Filter_MC_OUT3            (MCPARAMID)( 3097 << 14)
+#define MC_OutputStyle_Filter_MC_OUT3            (MCPARAMID)( 3098 << 14)
+#define MC_OutputState_MC_OUT3                   (MCPARAMID)( 3099 << 14)
+#define MC_OutputState_MC_OUT3_HOLD                1
+#define MC_OutputState_MC_OUT3_LOW                 2
+#define MC_OutputState_MC_OUT3_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT4           (MCPARAMID)( 3100 << 14)
+#define MC___OutputId_MC_OUT4                    (MCPARAMID)( 3101 << 14)
+#define MC_OutputState_Filter_MC_OUT4            (MCPARAMID)( 3102 << 14)
+#define MC_OutputStyle_Filter_MC_OUT4            (MCPARAMID)( 3103 << 14)
+#define MC_OutputState_MC_OUT4                   (MCPARAMID)( 3104 << 14)
+#define MC_OutputState_MC_OUT4_HOLD                1
+#define MC_OutputState_MC_OUT4_LOW                 2
+#define MC_OutputState_MC_OUT4_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT5           (MCPARAMID)( 3105 << 14)
+#define MC___OutputId_MC_OUT5                    (MCPARAMID)( 3106 << 14)
+#define MC_OutputState_Filter_MC_OUT5            (MCPARAMID)( 3107 << 14)
+#define MC_OutputStyle_Filter_MC_OUT5            (MCPARAMID)( 3108 << 14)
+#define MC_OutputState_MC_OUT5                   (MCPARAMID)( 3109 << 14)
+#define MC_OutputState_MC_OUT5_HOLD                1
+#define MC_OutputState_MC_OUT5_LOW                 2
+#define MC_OutputState_MC_OUT5_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT6           (MCPARAMID)( 3110 << 14)
+#define MC___OutputId_MC_OUT6                    (MCPARAMID)( 3111 << 14)
+#define MC_OutputState_Filter_MC_OUT6            (MCPARAMID)( 3112 << 14)
+#define MC_OutputStyle_Filter_MC_OUT6            (MCPARAMID)( 3113 << 14)
+#define MC_OutputState_MC_OUT6                   (MCPARAMID)( 3114 << 14)
+#define MC_OutputState_MC_OUT6_HOLD                1
+#define MC_OutputState_MC_OUT6_LOW                 2
+#define MC_OutputState_MC_OUT6_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT7           (MCPARAMID)( 3115 << 14)
+#define MC___OutputId_MC_OUT7                    (MCPARAMID)( 3116 << 14)
+#define MC_OutputState_Filter_MC_OUT7            (MCPARAMID)( 3117 << 14)
+#define MC_OutputStyle_Filter_MC_OUT7            (MCPARAMID)( 3118 << 14)
+#define MC_OutputState_MC_OUT7                   (MCPARAMID)( 3119 << 14)
+#define MC_OutputState_MC_OUT7_HOLD                1
+#define MC_OutputState_MC_OUT7_LOW                 2
+#define MC_OutputState_MC_OUT7_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT8           (MCPARAMID)( 3120 << 14)
+#define MC___OutputId_MC_OUT8                    (MCPARAMID)( 3121 << 14)
+#define MC_OutputState_Filter_MC_OUT8            (MCPARAMID)( 3122 << 14)
+#define MC_OutputStyle_Filter_MC_OUT8            (MCPARAMID)( 3123 << 14)
+#define MC_OutputState_MC_OUT8                   (MCPARAMID)( 3124 << 14)
+#define MC_OutputState_MC_OUT8_HOLD                1
+#define MC_OutputState_MC_OUT8_LOW                 2
+#define MC_OutputState_MC_OUT8_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT9           (MCPARAMID)( 3125 << 14)
+#define MC___OutputId_MC_OUT9                    (MCPARAMID)( 3126 << 14)
+#define MC_OutputState_Filter_MC_OUT9            (MCPARAMID)( 3127 << 14)
+#define MC_OutputStyle_Filter_MC_OUT9            (MCPARAMID)( 3128 << 14)
+#define MC_OutputState_MC_OUT9                   (MCPARAMID)( 3129 << 14)
+#define MC_OutputState_MC_OUT9_HOLD                1
+#define MC_OutputState_MC_OUT9_LOW                 2
+#define MC_OutputState_MC_OUT9_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT10          (MCPARAMID)( 3130 << 14)
+#define MC___OutputId_MC_OUT10                   (MCPARAMID)( 3131 << 14)
+#define MC_OutputState_Filter_MC_OUT10           (MCPARAMID)( 3132 << 14)
+#define MC_OutputStyle_Filter_MC_OUT10           (MCPARAMID)( 3133 << 14)
+#define MC_OutputState_MC_OUT10                  (MCPARAMID)( 3134 << 14)
+#define MC_OutputState_MC_OUT10_HOLD               1
+#define MC_OutputState_MC_OUT10_LOW                2
+#define MC_OutputState_MC_OUT10_HIGH               3
+#define MC_OutputConfig_Filter_MC_OUT11          (MCPARAMID)( 3135 << 14)
+#define MC___OutputId_MC_OUT11                   (MCPARAMID)( 3136 << 14)
+#define MC_OutputState_Filter_MC_OUT11           (MCPARAMID)( 3137 << 14)
+#define MC_OutputStyle_Filter_MC_OUT11           (MCPARAMID)( 3138 << 14)
+#define MC_OutputState_MC_OUT11                  (MCPARAMID)( 3139 << 14)
+#define MC_OutputState_MC_OUT11_HOLD               1
+#define MC_OutputState_MC_OUT11_LOW                2
+#define MC_OutputState_MC_OUT11_HIGH               3
+#define MC_OutputConfig_Filter_MC_OUT12          (MCPARAMID)( 3140 << 14)
+#define MC___OutputId_MC_OUT12                   (MCPARAMID)( 3141 << 14)
+#define MC_OutputState_Filter_MC_OUT12           (MCPARAMID)( 3142 << 14)
+#define MC_OutputStyle_Filter_MC_OUT12           (MCPARAMID)( 3143 << 14)
+#define MC_OutputState_MC_OUT12                  (MCPARAMID)( 3144 << 14)
+#define MC_OutputState_MC_OUT12_HOLD               1
+#define MC_OutputState_MC_OUT12_LOW                2
+#define MC_OutputState_MC_OUT12_HIGH               3
+#define MC_OutputConfig_Filter_MC_OUT13          (MCPARAMID)( 3145 << 14)
+#define MC___OutputId_MC_OUT13                   (MCPARAMID)( 3146 << 14)
+#define MC_OutputState_Filter_MC_OUT13           (MCPARAMID)( 3147 << 14)
+#define MC_OutputStyle_Filter_MC_OUT13           (MCPARAMID)( 3148 << 14)
+#define MC_OutputState_MC_OUT13                  (MCPARAMID)( 3149 << 14)
+#define MC_OutputState_MC_OUT13_HOLD               1
+#define MC_OutputState_MC_OUT13_LOW                2
+#define MC_OutputState_MC_OUT13_HIGH               3
+#define MC_INTERLACERR4LoadSet                   (MCPARAMID)( 3150 << 14)
+#define MC__ASYNC_IRR4_VRST1Off_Pos              (MCPARAMID)( 3151 << 14)
+#define MC__ASYNC_IRR4_VRST2MIDOn_Pos            (MCPARAMID)( 3152 << 14)
+#define MC__ASYNC_IRR4_VRST2MIDOff_Pos           (MCPARAMID)( 3153 << 14)
+#define MC__ASYNC_IRR4_VRST3On_Pos               (MCPARAMID)( 3154 << 14)
+#define MC__ASYNC_IRR4_VRST3Off_Pos              (MCPARAMID)( 3155 << 14)
+#define MC__ASYNC_IRR4_ACQR1On_Pos               (MCPARAMID)( 3156 << 14)
+#define MC__ASYNC_IRR4_ACQR1Off_Pos              (MCPARAMID)( 3157 << 14)
+#define MC__ASYNC_IRR4_VRST4MIDOn_Pos            (MCPARAMID)( 3158 << 14)
+#define MC__ASYNC_IRR4_VRSTMIDOff_Pos            (MCPARAMID)( 3159 << 14)
+#define MC__ASYNC_IRR4_ACQR2On_Pos               (MCPARAMID)( 3160 << 14)
+#define MC__ASYNC_IRR4_ACQR2Off_Pos              (MCPARAMID)( 3161 << 14)
+#define MC__ASYNC_IRR4_Field1_Line1_RPT          (MCPARAMID)( 3162 << 14)
+#define MC__ASYNC_IRR4_Field1_Line2_RPT          (MCPARAMID)( 3163 << 14)
+#define MC__ASYNC_IRR4_Field2_Line1_RPT          (MCPARAMID)( 3164 << 14)
+#define MC__ASYNC_IRR4_Field2_Line3_RPT          (MCPARAMID)( 3165 << 14)
+#define MC__ASYNC_IRR4_Field3_Line1_RPT          (MCPARAMID)( 3166 << 14)
+#define MC__ASYNC_IRR4_Field3_Line2_RPT          (MCPARAMID)( 3167 << 14)
+#define MC__ASYNC_IRR4_Field3_Line3_RPT          (MCPARAMID)( 3168 << 14)
+#define MC__ASYNC_IRR4_Field3_Line4_RPT          (MCPARAMID)( 3169 << 14)
+#define MC__ASYNC_IRR4_Field4_Line1_RPT          (MCPARAMID)( 3170 << 14)
+#define MC__ASYNC_IRR4_Field4_Line2_RPT          (MCPARAMID)( 3171 << 14)
+#define MC__ASYNC_IRR4_Field4_Line3_RPT          (MCPARAMID)( 3172 << 14)
+#define MC__SequenceLoadSet_RR4                   13
+#define MC__Category_Sequence_Interlace_RR4       32
+#define MC__ASYNC_IRR4_VRST4MIDOff_Pos           (MCPARAMID)( 3173 << 14)
+#define MC__ASYNC_IRR4_Field2_Line2_RPT          (MCPARAMID)( 3174 << 14)
+#define MC__ASYNC_IRR4_Field4_Line4_RPT          (MCPARAMID)( 3175 << 14)
+#define MC_CamConfig_IxxRM_4                     216
+#define MC_ChannelTopology_QUADXQUAD              15
+#define MC_Camera_A403k                          153
+#define MC___ExposeReadout_Check                 (MCPARAMID)( 3176 << 14)
+#define MC___ExposeReadout_Check_PASS              1
+#define MC___ExposeReadout_Check_FAIL              2
+#define MC__CamConfig_AREA_RG1                    16
+#define MC__ExposeReadout                        (MCPARAMID)( 3177 << 14)
+#define MC__ExposeReadout_INVALID                  1
+#define MC__ExposeReadout_AREA_SP                  2
+#define MC__ExposeReadout_AREA_RP                  3
+#define MC__ExposeReadout_AREA_SC                  4
+#define MC__ExposeReadout_AREA_RC                  5
+#define MC__ExposeReadout_AREA_RG                  6
+#define MC__ExposeReadout_AREA_RG1                 7
+#define MC__ExposeReadout_AREA_RG2                 8
+#define MC__RESETSource                          (MCPARAMID)( 3178 << 14)
+#define MC__RESETSource_CUS2                       1
+#define MC__RESETSource_SUS2                       2
+#define MC_ExposureController                    (MCPARAMID)( 3179 << 14)
+#define MC_ExposureController_GRABBER              1
+#define MC_ExposureController_CAMERA               2
+#define MC_ExposureController_NONE                 3
+#define MC_Camera_InterlaceRR                    154
+#define MC_CamConfig_IxxRM                       217
+#define MC_Camera_4000m                          155
+#define MC_CamConfig_P16SC                       218
+#define MC_CamConfig_P16RG                       219
+#define MC_CamConfig_I50SM_R                     220
+#define MC_CamConfig_I60SM_R                     221
+#define MC_CamConfig_IxxSM_R                     222
+#define MC__ExposeReadout_AREA_SL                  9
+#define MC___LongPage_Check                      (MCPARAMID)( 3180 << 14)
+#define MC___LongPage_Check_PASS                   1
+#define MC___LongPage_Check_FAIL                   2
+#define MC___LongPage_BoardCheck                 (MCPARAMID)( 3181 << 14)
+#define MC___LongPage_BoardCheck_PASS              1
+#define MC___LongPage_BoardCheck_FAIL              2
+#define MC___LongPage_ParamCoherencyCheck        (MCPARAMID)( 3182 << 14)
+#define MC___LongPage_ParamCoherencyCheck_PASS     1
+#define MC___LongPage_ParamCoherencyCheck_FAIL     2
+#define MC__CSC_LNCPT_RESIDUE                    (MCPARAMID)( 3183 << 14)
+#define MC_ResidualTileCountY                    (MCPARAMID)( 3184 << 14)
+#define MC_Camera_KP_F100BCL                     156
+#define MC_B2Usage_TRIGGER                         3
+#define MC_Camera_XC_ES30                        157
+#define MC_Camera_XC_ES30CE                      158
+#define MC_Camera_2000m                          159
+#define MC_Camera_TM_4000CL                      160
+#define MC_CamConfig_P32SC                       223
+#define MC_CamConfig_P32RG                       224
+#define MC__BoardType__PICOLO_TETRAX              19
+#define MC__BoardType__JUNIOR_4                   20
+#define MC_Camera_SI_M100                        161
+#define MC_CamConfig_P17SA                       225
+#define MC_CamConfig_P17RA                       226
+#define MC_CamConfig_P17RA_G                     227
+#define MC_Manufacturer_COSTAR                    23
+#define MC_Camera_CS8541D                        162
+#define MC__Board_Type__HARMONY                    5
+#define MC__BoardType__HARMONY                    21
+#define MC_GrabberIx                             (MCPARAMID)( 3185 << 14)
+#define MC_Tap                                   (MCPARAMID)( 3186 << 14)
+#define MC_HSLane                                (MCPARAMID)( 3187 << 14)
+#define MC_VSLane                                (MCPARAMID)( 3188 << 14)
+#define MC_ASR                                   (MCPARAMID)( 3189 << 14)
+#define MC_TLD_S                                 (MCPARAMID)( 3190 << 14)
+#define MC_HPD_S                                 (MCPARAMID)( 3191 << 14)
+#define MC_SPD_S                                 (MCPARAMID)( 3192 << 14)
+#define MC_OffsetGate_S                          (MCPARAMID)( 3193 << 14)
+#define MC_EMN                                   (MCPARAMID)( 3194 << 14)
+#define MC_EMX                                   (MCPARAMID)( 3195 << 14)
+#define MC_OMN                                   (MCPARAMID)( 3196 << 14)
+#define MC_OMX                                   (MCPARAMID)( 3197 << 14)
+#define MC_TLD                                   (MCPARAMID)( 3198 << 14)
+#define MC__TLD_S                                (MCPARAMID)( 3199 << 14)
+#define MC_SPD                                   (MCPARAMID)( 3200 << 14)
+#define MC__SPD_S                                (MCPARAMID)( 3201 << 14)
+#define MC_HPD                                   (MCPARAMID)( 3202 << 14)
+#define MC__HPD_S                                (MCPARAMID)( 3203 << 14)
+#define MC_SSB                                   (MCPARAMID)( 3204 << 14)
+#define MC_SBP                                   (MCPARAMID)( 3205 << 14)
+#define MC__OffsetGate_S                         (MCPARAMID)( 3206 << 14)
+#define MC_SVA                                   (MCPARAMID)( 3207 << 14)
+#define MC_SSA                                   (MCPARAMID)( 3208 << 14)
+#define MC_VCC                                   (MCPARAMID)( 3209 << 14)
+#define MC_LAC                                   (MCPARAMID)( 3210 << 14)
+#define MC_TAC                                   (MCPARAMID)( 3211 << 14)
+#define MC_MNS_R                                 (MCPARAMID)( 3212 << 14)
+#define MC__MNS                                  (MCPARAMID)( 3213 << 14)
+#define MC_MNS                                   (MCPARAMID)( 3214 << 14)
+#define MC_MXS_R                                 (MCPARAMID)( 3215 << 14)
+#define MC__MXS                                  (MCPARAMID)( 3216 << 14)
+#define MC_MXS                                   (MCPARAMID)( 3217 << 14)
+#define MC_VSC                                   (MCPARAMID)( 3218 << 14)
+#define MC_VSC_INTERLACE                           1
+#define MC_VSC_PROGRESSIVE                         2
+#define MC_CDC                                   (MCPARAMID)( 3219 << 14)
+#define MC_CDC_PAL                                 1
+#define MC_CDC_NTSC                                2
+#define MC_CDC_MONOCHROME                          3
+#define MC_CDC_PAL_TRAP                            4
+#define MC_CDC_NTSC_TRAP                           5
+#define MC_SPC                                   (MCPARAMID)( 3220 << 14)
+#define MC_SPC_PAL_SYNC                            1
+#define MC_SPC_PAL_EVEN                            2
+#define MC_SPC_PAL_ODD                             3
+#define MC_SPC_NTSC_SYNC                           4
+#define MC_SPC_NTSC_EVEN                           5
+#define MC_SPC_NTSC_ODD                            6
+#define MC_ChannelIx                             (MCPARAMID)( 3221 << 14)
+#define MC__SyncPhase                            (MCPARAMID)( 3222 << 14)
+#define MC__SyncPhase_EVEN                         1
+#define MC__SyncPhase_ODD                          2
+#define MC_DRP_R                                 (MCPARAMID)( 3223 << 14)
+#define MC_RHL_R                                 (MCPARAMID)( 3224 << 14)
+#define MC_RHA                                   (MCPARAMID)( 3225 << 14)
+#define MC_RHL                                   (MCPARAMID)( 3226 << 14)
+#define MC_RHD                                   (MCPARAMID)( 3227 << 14)
+#define MC_RHT                                   (MCPARAMID)( 3228 << 14)
+#define MC_RVA                                   (MCPARAMID)( 3229 << 14)
+#define MC_RVL                                   (MCPARAMID)( 3230 << 14)
+#define MC_RVD                                   (MCPARAMID)( 3231 << 14)
+#define MC_RVT                                   (MCPARAMID)( 3232 << 14)
+#define MC_RHD_0                                 (MCPARAMID)( 3233 << 14)
+#define MC_RHD_1                                 (MCPARAMID)( 3234 << 14)
+#define MC_RHD_2                                 (MCPARAMID)( 3235 << 14)
+#define MC_DummyRHD_0                            (MCPARAMID)( 3236 << 14)
+#define MC_DummyRHD_1                            (MCPARAMID)( 3237 << 14)
+#define MC_DummyRHD_2                            (MCPARAMID)( 3238 << 14)
+#define MC_AlphaComponent                        (MCPARAMID)( 3239 << 14)
+#define MC_DRL                                   (MCPARAMID)( 3240 << 14)
+#define MC__Gain                                 (MCPARAMID)( 3241 << 14)
+#define MC__Offset                               (MCPARAMID)( 3242 << 14)
+#define MC_SBS                                   (MCPARAMID)( 3243 << 14)
+#define MC_URG_0                                 (MCPARAMID)( 3244 << 14)
+#define MC__Gain_0                               (MCPARAMID)( 3245 << 14)
+#define MC_URG_1                                 (MCPARAMID)( 3246 << 14)
+#define MC__Gain_1                               (MCPARAMID)( 3247 << 14)
+#define MC_URG_2                                 (MCPARAMID)( 3248 << 14)
+#define MC__Gain_2                               (MCPARAMID)( 3249 << 14)
+#define MC_URO_0                                 (MCPARAMID)( 3250 << 14)
+#define MC__Offset_0                             (MCPARAMID)( 3251 << 14)
+#define MC_URO_1                                 (MCPARAMID)( 3252 << 14)
+#define MC__Offset_1                             (MCPARAMID)( 3253 << 14)
+#define MC_URO_2                                 (MCPARAMID)( 3254 << 14)
+#define MC__Offset_2                             (MCPARAMID)( 3255 << 14)
+#define MC_KernelIx                              (MCPARAMID)( 3256 << 14)
+#define MC_CVN                                   (MCPARAMID)( 3257 << 14)
+#define MC_KAS                                   (MCPARAMID)( 3258 << 14)
+#define MC_Kernel                                (MCPARAMID)( 3259 << 14)
+#define MC_Kernel_F12_CT_NTSC                      1
+#define MC_Kernel_F12_S1_NTSC                      2
+#define MC_Kernel_F13_CT_NTSC                      3
+#define MC_Kernel_F13_CT_PAL                       4
+#define MC_Kernel_F13_S1_NTSC                      5
+#define MC_Kernel_F13_S1_PAL                       6
+#define MC_Kernel_F13_S2_PAL                       7
+#define MC_Kernel_F15_CT_PAL                       8
+#define MC_Kernel_F15_S1_PAL                       9
+#define MC_Kernel_F18_S1_HIRES                    10
+#define MC_Kernel_F20_S1_HIRES                    11
+#define MC_Kernel_F23_S1_HIRES                    12
+#define MC_Kernel_F25_S1_HIRES                    13
+#define MC_Kernel_F25_S1_NTSC                     14
+#define MC_Kernel_F28_S1_HIRES                    15
+#define MC_Kernel_F30_S1_PAL                      16
+#define MC_Kernel_F32_S1_HIRES                    17
+#define MC_Kernel_F35_S1_HIRES                    18
+#define MC_Kernel_F40_S1_HIRES                    19
+#define MC__SyncPhase_ANY                          3
+#define MC_JpegQuality                           (MCPARAMID)( 3260 << 14)
+#define MC_Module_12_Present                     (MCPARAMID)( 3261 << 14)
+#define MC_ModuleVideoAddress_                   (MCPARAMID)( 3262 << 14)
+#define MC_InputStyle_Filter_MC_IN1              (MCPARAMID)( 3263 << 14)
+#define MC_InputConfig_Filter_MC_IN2             (MCPARAMID)( 3264 << 14)
+#define MC___InputId_MC_IN2                      (MCPARAMID)( 3265 << 14)
+#define MC_InputStyle_Filter_MC_IN2              (MCPARAMID)( 3266 << 14)
+#define MC_InputConfig_Filter_MC_IN3             (MCPARAMID)( 3267 << 14)
+#define MC___InputId_MC_IN3                      (MCPARAMID)( 3268 << 14)
+#define MC_InputStyle_Filter_MC_IN3              (MCPARAMID)( 3269 << 14)
+#define MC_InputConfig_Filter_MC_IN4             (MCPARAMID)( 3270 << 14)
+#define MC___InputId_MC_IN4                      (MCPARAMID)( 3271 << 14)
+#define MC_InputStyle_Filter_MC_IN4              (MCPARAMID)( 3272 << 14)
+#define MC_InputConfig_Filter_MC_IN5             (MCPARAMID)( 3273 << 14)
+#define MC___InputId_MC_IN5                      (MCPARAMID)( 3274 << 14)
+#define MC_InputStyle_Filter_MC_IN5              (MCPARAMID)( 3275 << 14)
+#define MC__ChannelActivationDelay               (MCPARAMID)( 3276 << 14)
+#define MC_Camera_XC_56                          163
+#define MC_Camera_MV_D640                        164
+#define MC_Camera_MV_D1024                       165
+#define MC_CamConfig_P200SC                      228
+#define MC_CamConfig_P200RG                      229
+#define MC_CamConfig_P75SC                       230
+#define MC_CamConfig_P75RG                       231
+#define MC_Manufacturer_PHOTONFOCUS               24
+#define MC_AcqStep_Px                            (MCPARAMID)( 3277 << 14)
+#define MC_CamConfig_P200RC                      232
+#define MC_GrabWindow_FIT                          5
+#define MC_MIO_SB_Present                        (MCPARAMID)( 3278 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN1       (MCPARAMID)( 3279 << 14)
+#define MC___InputId_MC_MIOSB_IN1                (MCPARAMID)( 3280 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN1        (MCPARAMID)( 3281 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN2       (MCPARAMID)( 3282 << 14)
+#define MC___InputId_MC_MIOSB_IN2                (MCPARAMID)( 3283 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN2        (MCPARAMID)( 3284 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN3       (MCPARAMID)( 3285 << 14)
+#define MC___InputId_MC_MIOSB_IN3                (MCPARAMID)( 3286 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN3        (MCPARAMID)( 3287 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN4       (MCPARAMID)( 3288 << 14)
+#define MC___InputId_MC_MIOSB_IN4                (MCPARAMID)( 3289 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN4        (MCPARAMID)( 3290 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN5       (MCPARAMID)( 3291 << 14)
+#define MC___InputId_MC_MIOSB_IN5                (MCPARAMID)( 3292 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN5        (MCPARAMID)( 3293 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN6       (MCPARAMID)( 3294 << 14)
+#define MC___InputId_MC_MIOSB_IN6                (MCPARAMID)( 3295 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN6        (MCPARAMID)( 3296 << 14)
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT1     (MCPARAMID)( 3297 << 14)
+#define MC___OutputId_MC_MIOSB_OUT1              (MCPARAMID)( 3298 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT1      (MCPARAMID)( 3299 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT1      (MCPARAMID)( 3300 << 14)
+#define MC_OutputState_MC_MIOSB_OUT1             (MCPARAMID)( 3301 << 14)
+#define MC_OutputState_MC_MIOSB_OUT1_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT1_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT1_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT2     (MCPARAMID)( 3302 << 14)
+#define MC___OutputId_MC_MIOSB_OUT2              (MCPARAMID)( 3303 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT2      (MCPARAMID)( 3304 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT2      (MCPARAMID)( 3305 << 14)
+#define MC_OutputState_MC_MIOSB_OUT2             (MCPARAMID)( 3306 << 14)
+#define MC_OutputState_MC_MIOSB_OUT2_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT2_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT2_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT3     (MCPARAMID)( 3307 << 14)
+#define MC___OutputId_MC_MIOSB_OUT3              (MCPARAMID)( 3308 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT3      (MCPARAMID)( 3309 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT3      (MCPARAMID)( 3310 << 14)
+#define MC_OutputState_MC_MIOSB_OUT3             (MCPARAMID)( 3311 << 14)
+#define MC_OutputState_MC_MIOSB_OUT3_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT3_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT3_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT4     (MCPARAMID)( 3312 << 14)
+#define MC___OutputId_MC_MIOSB_OUT4              (MCPARAMID)( 3313 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT4      (MCPARAMID)( 3314 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT4      (MCPARAMID)( 3315 << 14)
+#define MC_OutputState_MC_MIOSB_OUT4             (MCPARAMID)( 3316 << 14)
+#define MC_OutputState_MC_MIOSB_OUT4_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT4_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT4_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT5     (MCPARAMID)( 3317 << 14)
+#define MC___OutputId_MC_MIOSB_OUT5              (MCPARAMID)( 3318 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT5      (MCPARAMID)( 3319 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT5      (MCPARAMID)( 3320 << 14)
+#define MC_OutputState_MC_MIOSB_OUT5             (MCPARAMID)( 3321 << 14)
+#define MC_OutputState_MC_MIOSB_OUT5_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT5_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT5_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT6     (MCPARAMID)( 3322 << 14)
+#define MC___OutputId_MC_MIOSB_OUT6              (MCPARAMID)( 3323 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT6      (MCPARAMID)( 3324 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT6      (MCPARAMID)( 3325 << 14)
+#define MC_OutputState_MC_MIOSB_OUT6             (MCPARAMID)( 3326 << 14)
+#define MC_OutputState_MC_MIOSB_OUT6_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT6_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT6_HIGH          3
+#define MC_InputPinName_I5                        68
+#define MC_InputPinName_I6                        69
+#define MC_OutputPinName_O5                       76
+#define MC_OutputPinName_O6                       77
+#define MC_FLT                                   (MCPARAMID)( 3327 << 14)
+#define MC_FLT_OFF                                 1
+#define MC_FLT_ON                                  2
+#define MC__DigitizersMask                       (MCPARAMID)( 3328 << 14)
+#define MC_IDP_CFG                               (MCPARAMID)( 3329 << 14)
+#define MC_TRM                                   (MCPARAMID)( 3330 << 14)
+#define MC_TRM_OFF                                 1
+#define MC_TRM_ON                                  2
+#define MC__VideoLanesMask                       (MCPARAMID)( 3331 << 14)
+#define MC_IDP_TRM                               (MCPARAMID)( 3332 << 14)
+#define MC_BufferSize                            (MCPARAMID)( 3333 << 14)
+#define MC_MinBufferSize                         (MCPARAMID)( 3334 << 14)
+#define MC_MinBufferPitch                        (MCPARAMID)( 3335 << 14)
+#define MC_BufferPitch                           (MCPARAMID)( 3336 << 14)
+#define MC__ScaleFactor                          (MCPARAMID)( 3337 << 14)
+#define MC_GainTrim1_Filter                      (MCPARAMID)( 3338 << 14)
+#define MC_GainTrim2_Filter                      (MCPARAMID)( 3339 << 14)
+#define MC_GainTrim3_Filter                      (MCPARAMID)( 3340 << 14)
+#define MC_OffsetTrim1_Filter                    (MCPARAMID)( 3341 << 14)
+#define MC_OffsetTrim2_Filter                    (MCPARAMID)( 3342 << 14)
+#define MC_OffsetTrim3_Filter                    (MCPARAMID)( 3343 << 14)
+#define MC_ConnectorName_DIGITAL_IO               18
+#define MC_ConnectorName_DB9                      19
+#define MC_Scaling                               (MCPARAMID)( 3344 << 14)
+#define MC_Scaling_ENABLE                          1
+#define MC_Scaling_DISABLE                         2
+#define MC_Camera_CV_M9CL                        166
+#define MC_CamConfig_P30RG_O                     233
+#define MC_Camera_XC_HR57                        167
+#define MC_Camera_XC_HR58                        168
+#define MC_Camera_VCC_8350CL                     169
+#define MC_Camera_VCC_8550CL                     170
+#define MC_Camera_VCC_8750CL                     171
+#define MC_Camera_VCC_8850CL                     172
+#define MC_Camera_1600c                          173
+#define MC_CamConfig_P12SC                       234
+#define MC_CamConfig_P12RG                       235
+#define MC_CamConfig_P30RC                       236
+#define MC_CamConfig_P16RC                       237
+#define MC_CamConfig_P12RC                       238
+#define MC_Camera_1600c_S                        174
+#define MC_Camera_1600c_D                        175
+#define MC_Camera_1600c_S_RGB                    176
+#define MC_Camera_1600c_D_RGB                    177
+#define MC_CamConfig_P17SC                       239
+#define MC_CamConfig_P17RG                       240
+#define MC_CamConfig_P34SC                       241
+#define MC_CamConfig_P34RG                       242
+#define MC_TapStructure_HEX_B2                    20
+#define MC_ChannelTopology_MEDIUM_2T24_1X2_1Y     16
+#define MC__ASSY_SIX                               6
+#define MC__UserScaleY                           (MCPARAMID)( 3345 << 14)
+#define MC_InputConfig_Filter_MC_IN6             (MCPARAMID)( 3346 << 14)
+#define MC___InputId_MC_IN6                      (MCPARAMID)( 3347 << 14)
+#define MC_InputStyle_Filter_MC_IN6              (MCPARAMID)( 3348 << 14)
+#define MC_InputConfig_Filter_MC_IN7             (MCPARAMID)( 3349 << 14)
+#define MC___InputId_MC_IN7                      (MCPARAMID)( 3350 << 14)
+#define MC_InputStyle_Filter_MC_IN7              (MCPARAMID)( 3351 << 14)
+#define MC_InputConfig_Filter_MC_IN8             (MCPARAMID)( 3352 << 14)
+#define MC___InputId_MC_IN8                      (MCPARAMID)( 3353 << 14)
+#define MC_InputStyle_Filter_MC_IN8              (MCPARAMID)( 3354 << 14)
+#define MC_InputConfig_Filter_MC_IN9             (MCPARAMID)( 3355 << 14)
+#define MC___InputId_MC_IN9                      (MCPARAMID)( 3356 << 14)
+#define MC_InputStyle_Filter_MC_IN9              (MCPARAMID)( 3357 << 14)
+#define MC_InputConfig_Filter_MC_IN10            (MCPARAMID)( 3358 << 14)
+#define MC___InputId_MC_IN10                     (MCPARAMID)( 3359 << 14)
+#define MC_InputStyle_Filter_MC_IN10             (MCPARAMID)( 3360 << 14)
+#define MC_InputConfig_Filter_MC_IN11            (MCPARAMID)( 3361 << 14)
+#define MC___InputId_MC_IN11                     (MCPARAMID)( 3362 << 14)
+#define MC_InputStyle_Filter_MC_IN11             (MCPARAMID)( 3363 << 14)
+#define MC_InputConfig_Filter_MC_IN12            (MCPARAMID)( 3364 << 14)
+#define MC___InputId_MC_IN12                     (MCPARAMID)( 3365 << 14)
+#define MC_InputStyle_Filter_MC_IN12             (MCPARAMID)( 3366 << 14)
+#define MC_InputConfig_Filter_MC_IN13            (MCPARAMID)( 3367 << 14)
+#define MC___InputId_MC_IN13                     (MCPARAMID)( 3368 << 14)
+#define MC_InputStyle_Filter_MC_IN13             (MCPARAMID)( 3369 << 14)
+#define MC_ConnectorName_IO_LINES                 20
+#define MC_ConnectorName_IO_SCREW_TERMINAL        21
+#define MC_Camera_1000m_D                        178
+#define MC_Camera_1000m_S                        179
+#define MC_Camera_1600m_D                        180
+#define MC_Camera_1600m_S                        181
+#define MC_Camera_2000m_D                        182
+#define MC_Camera_2000m_S                        183
+#define MC_Camera_4000m_D                        184
+#define MC_Camera_4000m_S                        185
+#define MC_ConnectorName_CTL                      22
+#define MC_RCable_A15_C20                         21
+#define MC_Cable_A15_C20                         146
+#define MC_CableName_Single_Channel_Teli_Remote_Head  91
+#define MC__Board_Type__MELODY                     6
+#define MC__BoardType__MELODY                     22
+#define MC_BoardTopology_1                        33
+#define MC_CamConfig_P17SD                       243
+#define MC_CamConfig_P17RD_G                     244
+#define MC_CamConfig_P17RD                       245
+#define MC_ColorFormat_YV12                       58
+#define MC_HSamplePeriod                         (MCPARAMID)( 3370 << 14)
+#define MC_VSamplePeriod                         (MCPARAMID)( 3371 << 14)
+#define MC_Camera_NSUF7400CL                     186
+#define MC_CamConfig_L12500RP                    246
+#define MC_ConverterMute                         (MCPARAMID)( 3372 << 14)
+#define MC_ConverterMute_OFF                       1
+#define MC_ConverterMute_ON                        2
+#define MC__CPG_PGMOD_PM_CONTROLLED_LR             4
+#define MC_ColorFormat_YVU9                       59
+#define MC_ComponentSwap                         (MCPARAMID)( 3373 << 14)
+#define MC_Camera_SU51                           187
+#define MC_Camera_SU74                           188
+#define MC_CamConfig_L7400RP                     247
+#define MC_CamConfig_L5150SP                     248
+#define MC_CamConfig_L5150RP                     249
+#define MC_CamConfig_L7400SP                     250
+#define MC_ColorFormat_YUV9                       60
+#define MC_ColorFormat_YUV422PL                   61
+#define MC_ColorFormat_YUV411PL                   62
+#define MC_ColorFormat_IYUV                       63
+#define MC_ColorFormat_I420                       64
+#define MC_ColorFormat_Y42B                       65
+#define MC_ColorFormat_Y41B                       66
+#define MC_Camera_KP_F200CL                      189
+#define MC_OnMinSpeed                            (MCPARAMID)( 3374 << 14)
+#define MC_OnMinSpeed_IDLING                       1
+#define MC_OnMinSpeed_MUTING                       2
+#define MC_ColorFormat_YUV411                     67
+#define MC_FrameRate_Hz                          (MCPARAMID)( 3375 << 14)
+#define MC_PhaseTrigMode                         (MCPARAMID)( 3376 << 14)
+#define MC_PhaseTrigMode_IMMEDIATE                 1
+#define MC_PhaseTrigMode_HARD                      2
+#define MC_PhaseTrigMode_SOFT                      3
+#define MC_PhaseTrigMode_COMBINED                  4
+#define MC_PhaseTrigMode_TIMER                     5
+#define MC_TimerPeriodFl_ms                      (MCPARAMID)( 3377 << 14)
+#define MC_TimerPeriod_ms                        (MCPARAMID)( 3378 << 14)
+#define MC_StandardFrameRate_Hz                  (MCPARAMID)( 3379 << 14)
+#define MC__FrameRate_Hz                         (MCPARAMID)( 3380 << 14)
+#define MC__ImageWidth                           (MCPARAMID)( 3381 << 14)
+#define MC__FifoWidth                            (MCPARAMID)( 3382 << 14)
+#define MC__EndOfLineWidth                       (MCPARAMID)( 3383 << 14)
+#define MC__ConvolverOutputSize                  (MCPARAMID)( 3384 << 14)
+#define MC_TimerPeriodFl_us                      (MCPARAMID)( 3385 << 14)
+#define MC_TimerPeriod_us                        (MCPARAMID)( 3386 << 14)
+#define MC_SeqTrigMode                           (MCPARAMID)( 3387 << 14)
+#define MC_SeqTrigMode_IMMEDIATE                   1
+#define MC_SeqTrigMode_HARD                        2
+#define MC_SeqTrigMode_SOFT                        3
+#define MC_SeqTrigMode_COMBINED                    4
+#define MC_ControlledFrameRate                   (MCPARAMID)( 3388 << 14)
+#define MC_ControlledFrameRate_YES                 1
+#define MC_ControlledFrameRate_NO                  2
+#define MC_SeqCount                              (MCPARAMID)( 3389 << 14)
+#define MC__NextTrigMode                         (MCPARAMID)( 3390 << 14)
+#define MC__NextTrigMode_IMMEDIATE                 1
+#define MC__NextTrigMode_HARD                      2
+#define MC__NextTrigMode_SOFT                      3
+#define MC__NextTrigMode_COMBINED                  4
+#define MC_EndTrigEdge_HIGH                        3
+#define MC_EndTrigEdge_LOW                         4
+#define MC__DRS_CACQ_FRAME                         3
+#define MC__TrigLineSupported                    (MCPARAMID)( 3391 << 14)
+#define MC__TrigLineSupported_YES                  1
+#define MC__TrigLineSupported_NO                   2
+#define MC_Camera_2000c_D                        190
+#define MC_TransferInfoLocation                  (MCPARAMID)( 3392 << 14)
+#define MC_TransferInfoLocation_LOCAL              1
+#define MC_TransferInfoLocation_HOST               2
+#define MC__CDC_TPGTAP1                          (MCPARAMID)( 3393 << 14)
+#define MC__CDC_TPGTAP2                          (MCPARAMID)( 3394 << 14)
+#define MC__CDC_TPGTAP3                          (MCPARAMID)( 3395 << 14)
+#define MC__Board_Type__DELTA                      7
+#define MC__BoardType__DELTA                      23
+#define MC_GrabberConfig_1_0_1_0                  93
+#define MC_GrabberConfig_0_1_0_1                  94
+#define MC_Connector_X1                          119
+#define MC_Connector_X2                          120
+#define MC_Connector_Y1                          121
+#define MC_Connector_Y2                          122
+#define MC_NextGrabberConfig_1_0_1_0              90
+#define MC_NextGrabberConfig_0_1_0_1              91
+#define MC_ConnectorName_CAMX1                    23
+#define MC_ConnectorName_CAMX2                    24
+#define MC_ConnectorName_CAMY1                    25
+#define MC_ConnectorName_CAMY2                    26
+#define MC_BoardTopology_1_3                      34
+#define MC_BoardTopology_3_1                      35
+#define MC__Category_Synchronization              33
+#define MC__Category_Acquisition_control          34
+#define MC_AcquisitionMode                       (MCPARAMID)( 3396 << 14)
+#define MC_AcquisitionMode_SNAPSHOT                1
+#define MC_AcquisitionMode_HFR                     2
+#define MC_AcquisitionMode_PAGE                    3
+#define MC_AcquisitionMode_WEB                     4
+#define MC_AcquisitionMode_LONGPAGE                5
+#define MC_AcquisitionMode_Filter                (MCPARAMID)( 3397 << 14)
+#define MC_ActivityLength_Sq                     (MCPARAMID)( 3398 << 14)
+#define MC_SeqLength_Ph                          (MCPARAMID)( 3399 << 14)
+#define MC_SeqLength_Sl                          (MCPARAMID)( 3400 << 14)
+#define MC_SeqLength_Ln                          (MCPARAMID)( 3401 << 14)
+#define MC_PhaseLength_Sl                        (MCPARAMID)( 3402 << 14)
+#define MC_Operation_UNUSED                        9
+#define MC__WFC_ACQCNT                           (MCPARAMID)( 3403 << 14)
+#define MC__WSC_TotalFrameCount                  (MCPARAMID)( 3404 << 14)
+#define MC_PageLength_LowLimit_Ln                (MCPARAMID)( 3405 << 14)
+#define MC_ActivityLength                        (MCPARAMID)( 3406 << 14)
+#define MC_SeqLength_Fr                          (MCPARAMID)( 3407 << 14)
+#define MC_SeqLength_Pg                          (MCPARAMID)( 3408 << 14)
+#define MC_PhaseLength_Fr                        (MCPARAMID)( 3409 << 14)
+#define MC_SIMSTARTCHSet                         (MCPARAMID)( 3410 << 14)
+#define MC_Dummy                                 (MCPARAMID)( 3411 << 14)
+#define MC_PhaseLength_Optimal_Fr                (MCPARAMID)( 3412 << 14)
+#define MC_PhaseLength_Minimal_Fr                (MCPARAMID)( 3413 << 14)
+#define MC_PageLength_Optimal_Ln                 (MCPARAMID)( 3414 << 14)
+#define MC_PageLength_Minimal_Ln                 (MCPARAMID)( 3415 << 14)
+#define MC_KST                                   (MCPARAMID)( 3416 << 14)
+#define MC_KST_PREDEFINED                          1
+#define MC_KST_CUSTOM                              2
+#define MC_KST_FROMFILE                            3
+#define MC_SHP                                   (MCPARAMID)( 3417 << 14)
+#define MC_SHP_LOWPASS                             1
+#define MC_SHP_COLORTRAP                           2
+#define MC_SHP_PASSBAND                            3
+#define MC_SHP_PEAKING                             4
+#define MC_SHP_PEAKTRAP                            5
+#define MC_PhaseLength_Pg                        (MCPARAMID)( 3418 << 14)
+#define MC_KASR                                  (MCPARAMID)( 3419 << 14)
+#define MC_KDN                                   (MCPARAMID)( 3420 << 14)
+#define MC_BWF                                   (MCPARAMID)( 3421 << 14)
+#define MC_CBF                                   (MCPARAMID)( 3422 << 14)
+#define MC_PWF                                   (MCPARAMID)( 3423 << 14)
+#define MC_CFF                                   (MCPARAMID)( 3424 << 14)
+#define MC_CWF                                   (MCPARAMID)( 3425 << 14)
+#define MC_SSN                                   (MCPARAMID)( 3426 << 14)
+#define MC_EndTrigMode_Filter                    (MCPARAMID)( 3427 << 14)
+#define MC_BreakEffect_Filter                    (MCPARAMID)( 3428 << 14)
+#define MC_HMode                                 (MCPARAMID)( 3429 << 14)
+#define MC_HMode_ANALOG_LANE1                      1
+#define MC_HMode_DIGITAL_PULSED                    2
+#define MC_HMode_DIGITAL_MIXED                     3
+#define MC_HMode_LOCAL                             4
+#define MC_VMode                                 (MCPARAMID)( 3430 << 14)
+#define MC_VMode_ANALOG_LANE1                      1
+#define MC_VMode_DIGITAL_PULSED                    2
+#define MC_VMode_DIGITAL_MIXED                     3
+#define MC_VMode_LOCAL                             4
+#define MC_HReference                            (MCPARAMID)( 3431 << 14)
+#define MC_HReference_CAMERA                       1
+#define MC_HReference_LOCAL                        2
+#define MC_HReference_REMOTE                       3
+#define MC_VReference                            (MCPARAMID)( 3432 << 14)
+#define MC_VReference_CAMERA                       1
+#define MC_VReference_LOCAL                        2
+#define MC_VReference_REMOTE                       3
+#define MC_KernelAddress                         (MCPARAMID)( 3433 << 14)
+#define MC_KernelNB                              (MCPARAMID)( 3434 << 14)
+#define MC___HFR_Check                           (MCPARAMID)( 3435 << 14)
+#define MC___HFR_Check_PASS                        1
+#define MC___HFR_Check_FAIL                        2
+#define MC___HFR_BoardCheck                      (MCPARAMID)( 3436 << 14)
+#define MC___HFR_BoardCheck_PASS                   1
+#define MC___HFR_BoardCheck_FAIL                   2
+#define MC_AcquisitionMode_INVALID                 6
+#define MC___FilteredParams_Check                (MCPARAMID)( 3437 << 14)
+#define MC___FilteredParams_Check_PASS             1
+#define MC___FilteredParams_Check_FAIL             2
+#define MC_LogFilePath                           (MCPARAMID)( 3438 << 14)
+#define MC__AutomaticParamsCheck                 (MCPARAMID)( 3439 << 14)
+#define MC__AutomaticParamsCheck_YES               1
+#define MC__AutomaticParamsCheck_NO                2
+#define MC__FilteredParams_Check                 (MCPARAMID)( 3440 << 14)
+#define MC__FilteredParams_Check_PASS              1
+#define MC__FilteredParams_Check_FAIL              2
+#define MC_ParamsConsistency                     (MCPARAMID)( 3441 << 14)
+#define MC_ParamsConsistency_PASS                  1
+#define MC_ParamsConsistency_FAIL                  2
+#define MC_ParamsErrorLog                        (MCPARAMID)( 3442 << 14)
+#define MC_ParamsConsistencyCheck                (MCPARAMID)( 3443 << 14)
+#define MC_ParamsConsistencyCheck_AUTO             1
+#define MC_ParamsConsistencyCheck_MANUAL           2
+#define MC_TargetFrameRate_Hz                    (MCPARAMID)( 3444 << 14)
+#define MC_AcquisitionMode_VIDEO                   7
+#define MC_NextTrigMode_PERIODIC                   9
+#define MC_TrigLineIndex                         (MCPARAMID)( 3445 << 14)
+#define MC_EndTrigLineIndex                      (MCPARAMID)( 3446 << 14)
+#define MC_EndTrigCtl                            (MCPARAMID)( 3447 << 14)
+#define MC_EndTrigCtl_TTL                          1
+#define MC__BCC_Value                            (MCPARAMID)( 3448 << 14)
+#define MC__BCC_Value_PASS                         1
+#define MC__BCC_Value_FAIL                         2
+#define MC__BCC_Expert                           (MCPARAMID)( 3449 << 14)
+#define MC__BCC_Expert_PASS                        1
+#define MC__BCC_Expert_FAIL                        2
+#define MC__BCC_Expert2                          (MCPARAMID)( 3450 << 14)
+#define MC__BCC_Expert2_PASS                       1
+#define MC__BCC_Expert2_FAIL                       2
+#define MC__BCC_ColorScan                        (MCPARAMID)( 3451 << 14)
+#define MC__BCC_ColorScan_PASS                     1
+#define MC__BCC_ColorScan_FAIL                     2
+#define MC_PerSecond_Fr                          (MCPARAMID)( 3452 << 14)
+#define MC_Camera_XCLmV500                       191
+#define MC_Camera_XCLmX700                       192
+#define MC_Camera_XCLmU1000                      193
+#define MC_Camera_XCLmU1000C                     194
+#define MC_CableName_CameraLink_Miniature         92
+#define MC_Camera_XCL_V500                       195
+#define MC_Camera_XCL_X700                       196
+#define MC_Camera_XCL_U1000                      197
+#define MC_Camera_XCL_U1000C                     198
+#define MC_Cable_CL_C04                          147
+#define MC_Elapsed_Fr                            (MCPARAMID)( 3453 << 14)
+#define MC_Remaining_Fr                          (MCPARAMID)( 3454 << 14)
+#define MC_Elapsed_Pg                            (MCPARAMID)( 3455 << 14)
+#define MC_Elapsed_Ln                            (MCPARAMID)( 3456 << 14)
+#define MC_Remaining_Pg                          (MCPARAMID)( 3457 << 14)
+#define MC_Remaining_Ln                          (MCPARAMID)( 3458 << 14)
+#define MC_Camera_CS8550i_01                     199
+#define MC_Camera_CS8550i                        200
+#define MC_Camera_KP_F30                         201
+#define MC_Camera_KP_F30x                        202
+#define MC_CamConfig_P70RA                       251
+#define MC_CamConfig_P70RM                       252
+#define MC_CamConfig_P70SA                       253
+#define MC_CamConfig_P70SM                       254
+#define MC_TrigCtl_DIFF                            7
+#define MC_StrobeCtl_DIFF                          6
+#define MC_MDMPEnable                            (MCPARAMID)( 3459 << 14)
+#define MC_MDMPEnable_TRUE                         1
+#define MC_MDMPEnable_FALSE                        2
+#define MC__Category_D3_Signal_Properties         35
+#define MC__Category_D3_Kernel_Properties         36
+#define MC__Category_D3_Configuration             37
+#define MC__Category_D3_Resampler                 38
+#define MC__Category_D3_Resampling                39
+#define MC__BoardType__SYMPHONY                   24
+#define MC_STARTCHSet                            (MCPARAMID)( 3460 << 14)
+#define MC_InputPinName_ENHANCED_IO1              70
+#define MC_InputPinName_ENHANCED_IO2              71
+#define MC_InputPinName_ENHANCED_IO3              72
+#define MC_InputPinName_ENHANCED_IO4              73
+#define MC_InputPinName_TR                        74
+#define MC_InputPinName_CC1                       75
+#define MC_InputPinName_CC2                       76
+#define MC_InputPinName_CC3                       77
+#define MC_InputPinName_CC4                       78
+#define MC_InputPinName_CC5                       79
+#define MC_InputPinLocked                        (MCPARAMID)( 3461 << 14)
+#define MC_InputPinLocked_TRUE                     1
+#define MC_InputPinLocked_FALSE                    2
+#define MC_OutputState_LOOP1                      11
+#define MC_OutputState_LOOP2                      12
+#define MC_OutputPinName_Enhanced_IO1             78
+#define MC_OutputPinName_Enhanced_IO2             79
+#define MC_OutputPinName_Enhanced_IO3             80
+#define MC_OutputPinName_Enhanced_IO4             81
+#define MC_OutputPinName_ST                       82
+#define MC_OutputPinName_CC5                      83
+#define MC_OutputState_17_LOOP1                    4
+#define MC_OutputState_17_LOOP2                    5
+#define MC_OutputState_18_LOOP1                    4
+#define MC_OutputState_18_LOOP2                    5
+#define MC_OutputState_1_LOOP1                     6
+#define MC_OutputState_1_LOOP2                     7
+#define MC_OutputState_2_LOOP1                     4
+#define MC_OutputState_2_LOOP2                     5
+#define MC_OutputState_3_LOOP1                     4
+#define MC_OutputState_3_LOOP2                     5
+#define MC_OutputState_4_LOOP1                     4
+#define MC_OutputState_4_LOOP2                     5
+#define MC_OutputState_22_LOOP1                    4
+#define MC_OutputState_22_LOOP2                    5
+#define MC_OutputState_23_LOOP1                    4
+#define MC_OutputState_23_LOOP2                    5
+#define MC_OutputState_24_LOOP1                    4
+#define MC_OutputState_24_LOOP2                    5
+#define MC_OutputState_25_LOOP1                    4
+#define MC_OutputState_25_LOOP2                    5
+#define MC_OutputState_26_LOOP1                    4
+#define MC_OutputState_26_LOOP2                    5
+#define MC_OutputState_32_LOOP1                    4
+#define MC_OutputState_32_LOOP2                    5
+#define MC_OutputState_33_LOOP1                    4
+#define MC_OutputState_33_LOOP2                    5
+#define MC_OutputState_34_LOOP1                    4
+#define MC_OutputState_34_LOOP2                    5
+#define MC_OutputState_35_LOOP1                    4
+#define MC_OutputState_35_LOOP2                    5
+#define MC_OutputState_36_LOOP1                    4
+#define MC_OutputState_36_LOOP2                    5
+#define MC_OutputStyle_DIFF                        9
+#define MC_MDMPDec                               (MCPARAMID)( 3462 << 14)
+#define MC_MDMPOffset                            (MCPARAMID)( 3463 << 14)
+#define MC_HdriveLine_CC1                          8
+#define MC_HdriveLine_CC2                          9
+#define MC_HdriveLine_CC3                         10
+#define MC_HdriveLine_CC4                         11
+#define MC_HdriveLine_CC5                         12
+#define MC_VdriveLine_CC1                          8
+#define MC_VdriveLine_CC2                          9
+#define MC_VdriveLine_CC3                         10
+#define MC_VdriveLine_CC4                         11
+#define MC_VdriveLine_CC5                         12
+#define MC_ResetLine_CC5                          12
+#define MC_AuxResetLine_CC5                       12
+#define MC_HsyncLine_CC1                           8
+#define MC_HsyncLine_CC2                           9
+#define MC_HsyncLine_CC3                          10
+#define MC_HsyncLine_CC4                          11
+#define MC_HsyncLine_CC5                          12
+#define MC_VsyncLine_CC1                           8
+#define MC_VsyncLine_CC2                           9
+#define MC_VsyncLine_CC3                          10
+#define MC_VsyncLine_CC4                          11
+#define MC_VsyncLine_CC5                          12
+#define MC_CsyncLine                             (MCPARAMID)( 3464 << 14)
+#define MC_CsyncLine_NC                            1
+#define MC_CsyncLine_CC1                           2
+#define MC_CsyncLine_CC2                           3
+#define MC_CsyncLine_CC3                           4
+#define MC_CsyncLine_CC4                           5
+#define MC_CsyncLine_CC5                           6
+#define MC_GainG                                 (MCPARAMID)( 3465 << 14)
+#define MC_GainR                                 (MCPARAMID)( 3466 << 14)
+#define MC_GainB                                 (MCPARAMID)( 3467 << 14)
+#define MC_OffsetG                               (MCPARAMID)( 3468 << 14)
+#define MC_OffsetR                               (MCPARAMID)( 3469 << 14)
+#define MC_OffsetB                               (MCPARAMID)( 3470 << 14)
+#define MC_PinCC1_Usage                          (MCPARAMID)( 3471 << 14)
+#define MC_PinCC1_Usage_NONE                       1
+#define MC_PinCC1_Usage_INPUT                      2
+#define MC_PinCC1_Usage_LOW                        3
+#define MC_PinCC1_Usage_HIGH                       4
+#define MC_PinCC1_Usage_VDRIVE                     5
+#define MC_PinCC1_Usage_RESET                      6
+#define MC_PinCC1_Usage_AUXRESET                   7
+#define MC_PinCC1_Usage_HDRIVE                     8
+#define MC_PinCC1_Dir                            (MCPARAMID)( 3472 << 14)
+#define MC_PinCC1_Dir_INPUT                        1
+#define MC_PinCC1_Dir_OUTPUT                       2
+#define MC_PinCC1_PinCC2_STYLE                   (MCPARAMID)( 3473 << 14)
+#define MC_PinCC1_PinCC2_STYLE_TTL                 1
+#define MC_PinCC1_PinCC2_STYLE_LVDS                2
+#define MC_PinCC1_Source                         (MCPARAMID)( 3474 << 14)
+#define MC_PinCC1_Source_LOW                       1
+#define MC_PinCC1_Source_HIGH                      2
+#define MC_PinCC1_Source_HDRIVE                    3
+#define MC_PinCC1_Source_VDRIVE                    4
+#define MC_PinCC1_Source_RESET                     5
+#define MC_PinCC1_Source_AUXRESET                  6
+#define MC_PinCC1_Source_UNKNOWN                   7
+#define MC_PinCC3_PinCC4_Style                   (MCPARAMID)( 3475 << 14)
+#define MC_PinCC3_PinCC4_Style_TTL                 1
+#define MC_PinCC3_PinCC4_Style_LVDS                2
+#define MC_PinCC2_Dir                            (MCPARAMID)( 3476 << 14)
+#define MC_PinCC2_Dir_INPUT                        1
+#define MC_PinCC2_Dir_OUTPUT                       2
+#define MC_PinCC2_Source                         (MCPARAMID)( 3477 << 14)
+#define MC_PinCC2_Source_LOW                       1
+#define MC_PinCC2_Source_HIGH                      2
+#define MC_PinCC2_Source_HDRIVE                    3
+#define MC_PinCC2_Source_VDRIVE                    4
+#define MC_PinCC2_Source_RESET                     5
+#define MC_PinCC2_Source_AUXRESET                  6
+#define MC_PinCC2_Source_UNKNOWN                   7
+#define MC_PinCC3_Dir                            (MCPARAMID)( 3478 << 14)
+#define MC_PinCC3_Dir_INPUT                        1
+#define MC_PinCC3_Dir_OUTPUT                       2
+#define MC_PinCC3_Source                         (MCPARAMID)( 3479 << 14)
+#define MC_PinCC3_Source_LOW                       1
+#define MC_PinCC3_Source_HIGH                      2
+#define MC_PinCC3_Source_HDRIVE                    3
+#define MC_PinCC3_Source_VDRIVE                    4
+#define MC_PinCC3_Source_RESET                     5
+#define MC_PinCC3_Source_AUXRESET                  6
+#define MC_PinCC3_Source_UNKNOWN                   7
+#define MC_PinCC4_Dir                            (MCPARAMID)( 3480 << 14)
+#define MC_PinCC4_Dir_INPUT                        1
+#define MC_PinCC4_Dir_OUTPUT                       2
+#define MC_PinCC4_Source                         (MCPARAMID)( 3481 << 14)
+#define MC_PinCC4_Source_LOW                       1
+#define MC_PinCC4_Source_HIGH                      2
+#define MC_PinCC4_Source_HDRIVE                    3
+#define MC_PinCC4_Source_VDRIVE                    4
+#define MC_PinCC4_Source_RESET                     5
+#define MC_PinCC4_Source_AUXRESET                  6
+#define MC_PinCC4_Source_UNKNOWN                   7
+#define MC_PinCC5_Dir                            (MCPARAMID)( 3482 << 14)
+#define MC_PinCC5_Dir_INPUT                        1
+#define MC_PinCC5_Dir_OUTPUT                       2
+#define MC_PinCC5_Source                         (MCPARAMID)( 3483 << 14)
+#define MC_PinCC5_Source_LOW                       1
+#define MC_PinCC5_Source_HIGH                      2
+#define MC_PinCC5_Source_HDRIVE                    3
+#define MC_PinCC5_Source_VDRIVE                    4
+#define MC_PinCC5_Source_RESET                     5
+#define MC_PinCC5_Source_AUXRESET                  6
+#define MC_PinCC5_Source_UNKNOWN                   7
+#define MC_PinSMIO1_Dir                          (MCPARAMID)( 3484 << 14)
+#define MC_PinSMIO1_Dir_INPUT                      1
+#define MC_PinSMIO1_Dir_OUTPUT                     2
+#define MC_PinSMIO1_Dir_UNKNOWN                    3
+#define MC_PinSMIO1_Source                       (MCPARAMID)( 3485 << 14)
+#define MC_PinSMIO1_Source_LOW                     1
+#define MC_PinSMIO1_Source_HIGH                    2
+#define MC_PinSMIO1_Source_STROBE                  3
+#define MC_PinSMIO1_Source_UNKNOWN                 4
+#define MC_PinSMIO2_Dir                          (MCPARAMID)( 3486 << 14)
+#define MC_PinSMIO2_Dir_INPUT                      1
+#define MC_PinSMIO2_Dir_OUTPUT                     2
+#define MC_PinSMIO2_Dir_UNKNOWN                    3
+#define MC_PinSMIO2_Source                       (MCPARAMID)( 3487 << 14)
+#define MC_PinSMIO2_Source_LOW                     1
+#define MC_PinSMIO2_Source_HIGH                    2
+#define MC_PinSMIO2_Source_STROBE                  3
+#define MC_PinSMIO2_Source_UNKNOWN                 4
+#define MC_PinSTR_Source                         (MCPARAMID)( 3488 << 14)
+#define MC_PinSTR_Source_LOW                       1
+#define MC_PinSTR_Source_HIGH                      2
+#define MC_PinSTR_Source_STROBE                    3
+#define MC_PinSTR_Source_UNKNOWN                   4
+#define MC_TrigLine_IO1                           14
+#define MC_TrigLine_IO2                           15
+#define MC_TrigLine_IO3                           16
+#define MC_TrigLine_IO4                           17
+#define MC__TrigLine_IO1                          24
+#define MC__TrigLine_IO2                          25
+#define MC__TrigLine_IO3                          26
+#define MC__TrigLine_IO4                          27
+#define MC_StrobeLine_IO1                          8
+#define MC_StrobeLine_IO2                          9
+#define MC_StrobeLine_IO3                         10
+#define MC_StrobeLine_IO4                         11
+#define MC_StrobeLine_STX                         12
+#define MC_StrobeLine_STY                         13
+#define MC__StrobeLine_IO1                        10
+#define MC__StrobeLine_IO2                        11
+#define MC__StrobeLine_IO3                        12
+#define MC__StrobeLine_IO4                        13
+#define MC_PinSMIO3_Dir                          (MCPARAMID)( 3489 << 14)
+#define MC_PinSMIO3_Dir_INPUT                      1
+#define MC_PinSMIO3_Dir_OUTPUT                     2
+#define MC_PinSMIO3_Dir_UNKNOWN                    3
+#define MC_PinSMIO3_Source                       (MCPARAMID)( 3490 << 14)
+#define MC_PinSMIO3_Source_LOW                     1
+#define MC_PinSMIO3_Source_HIGH                    2
+#define MC_PinSMIO3_Source_STROBE                  3
+#define MC_PinSMIO3_Source_UNKNOWN                 4
+#define MC_PinSMIO4_Dir                          (MCPARAMID)( 3491 << 14)
+#define MC_PinSMIO4_Dir_INPUT                      1
+#define MC_PinSMIO4_Dir_OUTPUT                     2
+#define MC_PinSMIO4_Dir_UNKNOWN                    3
+#define MC_PinSMIO4_Source                       (MCPARAMID)( 3492 << 14)
+#define MC_PinSMIO4_Source_LOW                     1
+#define MC_PinSMIO4_Source_HIGH                    2
+#define MC_PinSMIO4_Source_STROBE                  3
+#define MC_PinSMIO4_Source_UNKNOWN                 4
+#define MC_PinSTX_Source                         (MCPARAMID)( 3493 << 14)
+#define MC_PinSTX_Source_LOW                       1
+#define MC_PinSTX_Source_HIGH                      2
+#define MC_PinSTX_Source_STROBE                    3
+#define MC_PinSTX_Source_UNKNOWN                   4
+#define MC_PinSTY_Source                         (MCPARAMID)( 3494 << 14)
+#define MC_PinSTY_Source_LOW                       1
+#define MC_PinSTY_Source_HIGH                      2
+#define MC_PinSTY_Source_STROBE                    3
+#define MC_PinSTY_Source_UNKNOWN                   4
+#define MC_TrigCtl_LVDS                            8
+#define MC_StrobeCtl_OPTO                          7
+#define MC_TrigLine_TR                            18
+#define MC_StrobeLine_ST                          14
+#define MC_OutputStyle_OPTO                       10
+#define MC_HsyncCtl_LVDS                           5
+#define MC_VsyncCtl_LVDS                           5
+#define MC_TDScale_100ns                         (MCPARAMID)( 3495 << 14)
+#define MC_TrigDelay_TDSCL                       (MCPARAMID)( 3496 << 14)
+#define MC_TrigDelay_TDScale                     (MCPARAMID)( 3497 << 14)
+#define MC__EScale_100ns                         (MCPARAMID)( 3498 << 14)
+#define MC__Expose_E                             (MCPARAMID)( 3499 << 14)
+#define MC__PostExpose_E                         (MCPARAMID)( 3500 << 14)
+#define MC__RESETOn_E                            (MCPARAMID)( 3501 << 14)
+#define MC__RESETOff_E                           (MCPARAMID)( 3502 << 14)
+#define MC__OpenVsyncGate_E                      (MCPARAMID)( 3503 << 14)
+#define MC__SScale_100ns                         (MCPARAMID)( 3504 << 14)
+#define MC_EXPOn2STROBEOff_E                     (MCPARAMID)( 3505 << 14)
+#define MC__PreStrobe_E                          (MCPARAMID)( 3506 << 14)
+#define MC__PREEXP_us                            (MCPARAMID)( 3507 << 14)
+#define MC__EXP_us                               (MCPARAMID)( 3508 << 14)
+#define MC__POSTEXP_us                           (MCPARAMID)( 3509 << 14)
+#define MC__PREEXP_E                             (MCPARAMID)( 3510 << 14)
+#define MC__EXP_E                                (MCPARAMID)( 3511 << 14)
+#define MC__POSTEXP_E                            (MCPARAMID)( 3512 << 14)
+#define MC__SSpan_us                             (MCPARAMID)( 3513 << 14)
+#define MC__EXP_S                                (MCPARAMID)( 3514 << 14)
+#define MC__PreStrobe_S                          (MCPARAMID)( 3515 << 14)
+#define MC__STR_S                                (MCPARAMID)( 3516 << 14)
+#define MC_EXPOn2STROBEOff_S                     (MCPARAMID)( 3517 << 14)
+#define MC_EXPOn2STROff_S                        (MCPARAMID)( 3518 << 14)
+#define MC__EXPOn2STROff_S                       (MCPARAMID)( 3519 << 14)
+#define MC__STPOS_DSB                            (MCPARAMID)( 3520 << 14)
+#define MC__STPOS_ASB                            (MCPARAMID)( 3521 << 14)
+#define MC__STPOS_SLO                            (MCPARAMID)( 3522 << 14)
+#define MC__STPOS_End                            (MCPARAMID)( 3523 << 14)
+#define MC__ETPOS_AuxResetOn                     (MCPARAMID)( 3524 << 14)
+#define MC__ETPOS_AuxResetOff                    (MCPARAMID)( 3525 << 14)
+#define MC__ETPOS_ResetOn                        (MCPARAMID)( 3526 << 14)
+#define MC__ETPOS_ResetOff                       (MCPARAMID)( 3527 << 14)
+#define MC__ETPOS_OpenVsyncGate                  (MCPARAMID)( 3528 << 14)
+#define MC__ETPOS_CloseVsyncGate                 (MCPARAMID)( 3529 << 14)
+#define MC__ETPOS_End                            (MCPARAMID)( 3530 << 14)
+#define MC_Readout_us                            (MCPARAMID)( 3531 << 14)
+#define MC__RDO_us                               (MCPARAMID)( 3532 << 14)
+#define MC__RSpan_us                             (MCPARAMID)( 3533 << 14)
+#define MC__RScale_100ns                         (MCPARAMID)( 3534 << 14)
+#define MC__RDO_E                                (MCPARAMID)( 3535 << 14)
+#define MC__RTPOS_SR                             (MCPARAMID)( 3536 << 14)
+#define MC__RTPOS_NSLA                           (MCPARAMID)( 3537 << 14)
+#define MC__RTPOS_End                            (MCPARAMID)( 3538 << 14)
+#define MC__Category_Readout_Control              40
+#define MC__TrueExp_100ns                        (MCPARAMID)( 3539 << 14)
+#define MC__ExposeTrimFactor                     (MCPARAMID)( 3540 << 14)
+#define MC__PREEXP_100ns                         (MCPARAMID)( 3541 << 14)
+#define MC__EXP_100ns                            (MCPARAMID)( 3542 << 14)
+#define MC__POSTEXP_100ns                        (MCPARAMID)( 3543 << 14)
+#define MC__ESpan_100ns                          (MCPARAMID)( 3544 << 14)
+#define MC_Readout_100ns                         (MCPARAMID)( 3545 << 14)
+#define MC__RDO_100ns                            (MCPARAMID)( 3546 << 14)
+#define MC__RSpan_100s                           (MCPARAMID)( 3547 << 14)
+#define MC__SSpan_100ns                          (MCPARAMID)( 3548 << 14)
+#define MC__RSpan_100ns                          (MCPARAMID)( 3549 << 14)
+#define MC_TDTScale_100ns                        (MCPARAMID)( 3550 << 14)
+#define MC__ETSpan_100ns                         (MCPARAMID)( 3551 << 14)
+#define MC__ETScale_100ns                        (MCPARAMID)( 3552 << 14)
+#define MC__RTSpan_100ns                         (MCPARAMID)( 3553 << 14)
+#define MC__RTScale_100ns                        (MCPARAMID)( 3554 << 14)
+#define MC__STSpan_100ns                         (MCPARAMID)( 3555 << 14)
+#define MC__STScale_100ns                        (MCPARAMID)( 3556 << 14)
+#define MC_TrigDelay_T                           (MCPARAMID)( 3557 << 14)
+#define MC__ETPOS_EndExpose                      (MCPARAMID)( 3558 << 14)
+#define MC_HCsyncToClamp_ns                      (MCPARAMID)( 3559 << 14)
+#define MC_ClampDur_ns                           (MCPARAMID)( 3560 << 14)
+#define MC_SyncPattern                           (MCPARAMID)( 3561 << 14)
+#define MC_SyncPattern_PALSYNC                     1
+#define MC_SyncPattern_NTSCSYNC                    2
+#define MC_SyncPattern_PALEVEN                     3
+#define MC_SyncPattern_PALODD                      4
+#define MC_SyncPattern_NTSCEVEN                    5
+#define MC_SyncPattern_NTSCODD                     6
+#define MC_VideoFilter_Filter                    (MCPARAMID)( 3562 << 14)
+#define MC_VrefSearchWindowLeft_IT               (MCPARAMID)( 3563 << 14)
+#define MC_VrefSearchWindowRight_IT              (MCPARAMID)( 3564 << 14)
+#define MC_Vsync2Vref_IT                         (MCPARAMID)( 3565 << 14)
+#define MC_VrefSearchWindowLeft_TT               (MCPARAMID)( 3566 << 14)
+#define MC_VrefSearchWindowRight_TT              (MCPARAMID)( 3567 << 14)
+#define MC_Vsync2Vref_TT                         (MCPARAMID)( 3568 << 14)
+#define MC_VideoFilter_COLORTRAP                   6
+#define MC_VsyncLNB                              (MCPARAMID)( 3569 << 14)
+#define MC_Expose_Filter                         (MCPARAMID)( 3570 << 14)
+#define MC_Readout_Filter                        (MCPARAMID)( 3571 << 14)
+#define MC__RDO_R                                (MCPARAMID)( 3572 << 14)
+#define MC__RTSS                                 (MCPARAMID)( 3573 << 14)
+#define MC__RTSS_OpenVsyncGate                     1
+#define MC__RTSS_GatedVsync                        2
+#define MC__VsyncFilter                          (MCPARAMID)( 3574 << 14)
+#define MC__VsyncFilter_OFF                        1
+#define MC__VsyncFilter_ON                         2
+#define MC__VsyncFilter_MEDIUM                     3
+#define MC__VsyncFilter_STRONG                     4
+#define MC__PREEXP_S                             (MCPARAMID)( 3575 << 14)
+#define MC__TrigDelay_S                          (MCPARAMID)( 3576 << 14)
+#define MC_Gain_Filter                           (MCPARAMID)( 3577 << 14)
+#define MC_Camera_IK_TF1                         203
+#define MC_Camera_IK_TF5                         204
+#define MC_Camera_IK_TF7                         205
+#define MC_Manufacturer_TOSHIBA                   25
+#define MC_RCable_A15_C21                         22
+#define MC_Cable_A15_C21                         148
+#define MC_CableName_Triple_Channel_RGB           93
+#define MC_SeqLength_Fr_Filter                   (MCPARAMID)( 3578 << 14)
+#define MC_SeqLength_Pg_Filter                   (MCPARAMID)( 3579 << 14)
+#define MC_SeqLength_Ln_Filter                   (MCPARAMID)( 3580 << 14)
+#define MC_PhaseLength_Fr_Filter                 (MCPARAMID)( 3581 << 14)
+#define MC_CCE_Filter                            (MCPARAMID)( 3582 << 14)
+#define MC___PageLength_Error_Check              (MCPARAMID)( 3583 << 14)
+#define MC___PageLength_Error_Check_PASS           1
+#define MC___PageLength_Error_Check_FAIL           2
+#define MC__Category_Camera_Advanced_Features     41
+#define MC_CamConfig_PxxRG_PartialScan           255
+#define MC_SonyXCL_V500PartialScan_Filter        (MCPARAMID)( 3584 << 14)
+#define MC_SonyXCL_X700PartialScan_Filter        (MCPARAMID)( 3585 << 14)
+#define MC_SonyXCL_U1000PartialScan_Filter       (MCPARAMID)( 3586 << 14)
+#define MC_SonyXCL_U1000CPartialScan_Filter      (MCPARAMID)( 3587 << 14)
+#define MC_SonyXCL_V500_FPS                      (MCPARAMID)( 3588 << 14)
+#define MC_SonyXCL_V500_RPS                      (MCPARAMID)( 3589 << 14)
+#define MC_SonyXCL_X700_FPS                      (MCPARAMID)( 3590 << 14)
+#define MC_SonyXCL_X700_RPS                      (MCPARAMID)( 3591 << 14)
+#define MC_SonyXCL_U1000_Start                   (MCPARAMID)( 3592 << 14)
+#define MC_SonyXCL_U1000_End                     (MCPARAMID)( 3593 << 14)
+#define MC_SonyXCL_U1000C_Start                  (MCPARAMID)( 3594 << 14)
+#define MC_SonyXCL_U1000C_End                    (MCPARAMID)( 3595 << 14)
+#define MC_SonyXCL_V500PartialScanFrameRate_mHz  (MCPARAMID)( 3596 << 14)
+#define MC_SonyXCL_V500PartialScanVactive_Ln     (MCPARAMID)( 3597 << 14)
+#define MC_SonyXCL_X700PartialScanFrameRate_mHz  (MCPARAMID)( 3598 << 14)
+#define MC_SonyXCL_X700PartialScanVactive_Ln     (MCPARAMID)( 3599 << 14)
+#define MC_SonyXCL_U1000PartialScanFrameRate_mHz (MCPARAMID)( 3600 << 14)
+#define MC_SonyXCL_U1000PartialScanVactive_Ln    (MCPARAMID)( 3601 << 14)
+#define MC_SonyXCL_U1000CPartialScanFrameRate_mHz (MCPARAMID)( 3602 << 14)
+#define MC_SonyXCL_U1000CPartialScanVactive_Ln   (MCPARAMID)( 3603 << 14)
+#define MC_DvalMode_DID2P0                         4
+#define MC__HDC_DCADV_INTERNAL_D2P0                3
+#define MC_LUT__Data                             (MCPARAMID)( 3604 << 14)
+#define MC__BoardType__AVENUE                     25
+#define MC_TrigLine_ISOA1                         19
+#define MC_TrigLine_ISOA2                         20
+#define MC_TrigLine_TRA1                          21
+#define MC_TrigLine_TRA2                          22
+#define MC_EndTrigLine_IO1                        11
+#define MC_EndTrigLine_IO2                        12
+#define MC_EndTrigLine_IO3                        13
+#define MC_EndTrigLine_IO4                        14
+#define MC_EndTrigLine_ISOA1                      15
+#define MC_EndTrigLine_ISOA2                      16
+#define MC_EndTrigLine_TRA1                       17
+#define MC_EndTrigLine_TRA2                       18
+#define MC__TrigLine_ISOA1                        28
+#define MC__TrigLine_ISOA2                        29
+#define MC__TrigLine_TRA1                         30
+#define MC__TrigLine_TRA2                         31
+#define MC_StrobeLine_ISOA1                       15
+#define MC_StrobeLine_ISOA2                       16
+#define MC_StrobeLine_STA                         17
+#define MC__StrobeLine_ISOA1                      14
+#define MC__StrobeLine_ISOA2                      15
+#define MC__StrobeLine_STA                        16
+#define MC_LineTrigCtl_LVDS                        4
+#define MC_LineTrigLine_IO1                        7
+#define MC_LineTrigLine_IO2                        8
+#define MC_LineTrigLine_IO3                        9
+#define MC_LineTrigLine_IO4                       10
+#define MC_LineTrigLine_ISOA1                     11
+#define MC_LineTrigLine_ISOA2                     12
+#define MC_LineTrigLine_TRA1                      13
+#define MC_LineTrigLine_TRA2                      14
+#define MC__LineTrigLine_IO1                      13
+#define MC__LineTrigLine_IO2                      14
+#define MC__LineTrigLine_IO3                      15
+#define MC__LineTrigLine_IO4                      16
+#define MC__LineTrigLine_ISOA1                    17
+#define MC__LineTrigLine_ISOA2                    18
+#define MC__LineTrigLine_TRA1                     19
+#define MC__LineTrigLine_TRA2                     20
+#define MC__TRG_LTSEL_A1                          11
+#define MC__TRG_LTSEL_A2                          12
+#define MC__TRG_LTSEL_TRG1                        13
+#define MC__TRG_LTSEL_TRG2                        14
+#define MC__TRG_LTSEL_IO1                         15
+#define MC__TRG_LTSEL_IO2                         16
+#define MC__TRG_LTSEL_IO3                         17
+#define MC__TRG_LTSEL_IO4                         18
+#define MC__TRG_FTSEL_TRG1                        17
+#define MC__TRG_FTSEL_TRG2                        18
+#define MC__TRG_FTSEL_IO1                         19
+#define MC__TRG_FTSEL_IO2                         20
+#define MC__TRG_FTSEL_IO3                         21
+#define MC__TRG_FTSEL_IO4                         22
+#define MC_IO1Usage                              (MCPARAMID)( 3605 << 14)
+#define MC_IO1Usage_FREE                           1
+#define MC_IO1Usage_STROBE                         2
+#define MC_IO1Usage_TRIGGER                        3
+#define MC_IO1Usage_LINETRIGGER                    4
+#define MC_IO2Usage                              (MCPARAMID)( 3606 << 14)
+#define MC_IO2Usage_FREE                           1
+#define MC_IO2Usage_STROBE                         2
+#define MC_IO2Usage_TRIGGER                        3
+#define MC_IO2Usage_LINETRIGGER                    4
+#define MC_IO3Usage                              (MCPARAMID)( 3607 << 14)
+#define MC_IO3Usage_FREE                           1
+#define MC_IO3Usage_STROBE                         2
+#define MC_IO3Usage_TRIGGER                        3
+#define MC_IO3Usage_LINETRIGGER                    4
+#define MC_IO4Usage                              (MCPARAMID)( 3608 << 14)
+#define MC_IO4Usage_FREE                           1
+#define MC_IO4Usage_STROBE                         2
+#define MC_IO4Usage_TRIGGER                        3
+#define MC_IO4Usage_LINETRIGGER                    4
+#define MC_ISOA1Usage                            (MCPARAMID)( 3609 << 14)
+#define MC_ISOA1Usage_FREE                         1
+#define MC_ISOA1Usage_STROBE                       2
+#define MC_ISOA1Usage_TRIGGER                      3
+#define MC_ISOA1Usage_LINETRIGGER                  4
+#define MC_ISOA2Usage                            (MCPARAMID)( 3610 << 14)
+#define MC_ISOA2Usage_FREE                         1
+#define MC_ISOA2Usage_STROBE                       2
+#define MC_ISOA2Usage_TRIGGER                      3
+#define MC_ISOA2Usage_LINETRIGGER                  4
+#define MC_TRA1Usage                             (MCPARAMID)( 3611 << 14)
+#define MC_TRA1Usage_FREE                          1
+#define MC_TRA1Usage_STROBE                        2
+#define MC_TRA1Usage_TRIGGER                       3
+#define MC_TRA1Usage_LINETRIGGER                   4
+#define MC_TRA2Usage                             (MCPARAMID)( 3612 << 14)
+#define MC_TRA2Usage_FREE                          1
+#define MC_TRA2Usage_STROBE                        2
+#define MC_TRA2Usage_TRIGGER                       3
+#define MC_TRA2Usage_LINETRIGGER                   4
+#define MC_STAUsage                              (MCPARAMID)( 3613 << 14)
+#define MC_STAUsage_FREE                           1
+#define MC_STAUsage_STROBE                         2
+#define MC_STAUsage_TRIGGER                        3
+#define MC_STAUsage_LINETRIGGER                    4
+#define MC__STR_STR1POL                          (MCPARAMID)( 3614 << 14)
+#define MC__STR_STR1POL_DIRECT                     1
+#define MC__STR_STR1POL_INVERT                     2
+#define MC__STR_STR1POL_HOLD                       3
+#define MC__STR_STR1SRC                          (MCPARAMID)( 3615 << 14)
+#define MC__STR_STR1SRC_LOW                        1
+#define MC__STR_STR1SRC_T1SIG3_X                   2
+#define MC__STR_STR1SRC_T1SIG4_X                   3
+#define MC__STR_STR1SRC_PPLS_X                     4
+#define MC__STR_STR1SRC_HOLD                       5
+#define MC__STB_A1STYL                           (MCPARAMID)( 3616 << 14)
+#define MC__STB_A1STYL_TTLIN                       1
+#define MC__STB_A1STYL_12VIN                       2
+#define MC__STB_A1STYL_TTLOUT                      3
+#define MC__STB_A1STYL_OCOUT                       4
+#define MC__STB_A1STYL_OEOUT                       5
+#define MC__STB_A1STYL_HOLD                        6
+#define MC__STB_A2STYL                           (MCPARAMID)( 3617 << 14)
+#define MC__STB_A2STYL_TTLIN                       1
+#define MC__STB_A2STYL_12VIN                       2
+#define MC__STB_A2STYL_TTLOUT                      3
+#define MC__STB_A2STYL_OCOUT                       4
+#define MC__STB_A2STYL_OEOUT                       5
+#define MC__STB_A2STYL_HOLD                        6
+#define MC__STB_QA1SRC                           (MCPARAMID)( 3618 << 14)
+#define MC__STB_QA1SRC_LOW                         1
+#define MC__STB_QA1SRC_T1SIG3                      2
+#define MC__STB_QA1SRC_T1SIG4                      3
+#define MC__STB_QA1SRC_HIGH                        4
+#define MC__STB_QA1SRC_T1SIG3_Inverted             5
+#define MC__STB_QA1SRC_T1SIG4_Inverted             6
+#define MC__STB_QA1SRC_HOLD                        7
+#define MC__STB_QA2SRC                           (MCPARAMID)( 3619 << 14)
+#define MC__STB_QA2SRC_LOW                         1
+#define MC__STB_QA2SRC_T1SIG3                      2
+#define MC__STB_QA2SRC_T1SIG4                      3
+#define MC__STB_QA2SRC_HIGH                        4
+#define MC__STB_QA2SRC_T1SIG3_Inverted             5
+#define MC__STB_QA2SRC_T1SIG4_Inverted             6
+#define MC__STB_QA2SRC_HOLD                        7
+#define MC__STB_QA1POL                           (MCPARAMID)( 3620 << 14)
+#define MC__STB_QA1POL_DIRECT                      1
+#define MC__STB_QA1POL_INVERT                      2
+#define MC__STB_QA1POL_HOLD                        3
+#define MC__STB_QA2POL                           (MCPARAMID)( 3621 << 14)
+#define MC__STB_QA2POL_DIRECT                      1
+#define MC__STB_QA2POL_INVERT                      2
+#define MC__STB_QA2POL_HOLD                        3
+#define MC_InputPinName_TRA1                      80
+#define MC_InputPinName_TRA2                      81
+#define MC_InputPinName_ISOA1                     82
+#define MC_InputPinName_ISOA2                     83
+#define MC_OutputPinName_STA                      84
+#define MC_OutputPinName_ISOA1                    85
+#define MC_OutputPinName_ISOA2                    86
+#define MC_OutputState_LOOP                       13
+#define MC_OutputState_1_LOOP                      8
+#define MC_OutputState_2_LOOP                      6
+#define MC_OutputState_3_LOOP                      6
+#define MC_OutputState_4_LOOP                      6
+#define MC_OutputState_LOOP3                      14
+#define MC_OutputState_LOOP4                      15
+#define MC_OutputState_17_LOOP3                    6
+#define MC_OutputState_17_LOOP4                    7
+#define MC_OutputState_21_LOOP1                    4
+#define MC_OutputState_21_LOOP2                    5
+#define MC_OutputState_21_LOOP3                    6
+#define MC_OutputState_21_LOOP4                    7
+#define MC_OutputState_22_LOOP3                    6
+#define MC_OutputState_22_LOOP4                    7
+#define MC_OutputState_23_LOOP3                    6
+#define MC_OutputState_23_LOOP4                    7
+#define MC_OutputState_24_LOOP3                    6
+#define MC_OutputState_24_LOOP4                    7
+#define MC_ISOA1Usage_USER                         5
+#define MC_ISOA2Usage_USER                         5
+#define MC_EndTrigLine_Filter                    (MCPARAMID)( 3622 << 14)
+#define MC_EndTrigCtl_Filter                     (MCPARAMID)( 3623 << 14)
+#define MC_EndTrigCtl_LVDS                         2
+#define MC_EndTrigCtl_ITTL                         3
+#define MC_EndTrigCtl_I12V                         4
+#define MC_StrobeLine_STR                         18
+#define MC_ColorFormat_UINT32                     68
+#define MC_CamConfig_L4080SP                     256
+#define MC_CamConfig_L4080RC                     257
+#define MC_CamConfig_L4080RG                     258
+#define MC__CSIO_CSIO1Out                        (MCPARAMID)( 3624 << 14)
+#define MC__CSIO_CSIO1Out_T1SIG3                   1
+#define MC__CSIO_CSIO1Out_T1SIG4                   2
+#define MC__CSIO_CSIO1Out_PPLS                     3
+#define MC__CSIO_CSIO1Out_HOLD                     4
+#define MC__CSIO_CSIO1Dir                        (MCPARAMID)( 3625 << 14)
+#define MC__CSIO_CSIO1Dir_DIRECT                   1
+#define MC__CSIO_CSIO1Dir_INVERT                   2
+#define MC__CSIO_CSIO1Dir_HOLD                     3
+#define MC__CSIO_CSIO2Out                        (MCPARAMID)( 3626 << 14)
+#define MC__CSIO_CSIO2Out_T1SIG3                   1
+#define MC__CSIO_CSIO2Out_T1SIG4                   2
+#define MC__CSIO_CSIO2Out_PPLS                     3
+#define MC__CSIO_CSIO2Out_HOLD                     4
+#define MC__CSIO_CSIO2Dir                        (MCPARAMID)( 3627 << 14)
+#define MC__CSIO_CSIO2Dir_DIRECT                   1
+#define MC__CSIO_CSIO2Dir_INVERT                   2
+#define MC__CSIO_CSIO2Dir_HOLD                     3
+#define MC__CSIO_CSIO3Out                        (MCPARAMID)( 3628 << 14)
+#define MC__CSIO_CSIO3Out_T1SIG3                   1
+#define MC__CSIO_CSIO3Out_T1SIG4                   2
+#define MC__CSIO_CSIO3Out_PPLS                     3
+#define MC__CSIO_CSIO3Out_HOLD                     4
+#define MC__CSIO_CSIO3Dir                        (MCPARAMID)( 3629 << 14)
+#define MC__CSIO_CSIO3Dir_DIRECT                   1
+#define MC__CSIO_CSIO3Dir_INVERT                   2
+#define MC__CSIO_CSIO3Dir_HOLD                     3
+#define MC__CSIO_CSIO4Out                        (MCPARAMID)( 3630 << 14)
+#define MC__CSIO_CSIO4Out_T1SIG3                   1
+#define MC__CSIO_CSIO4Out_T1SIG4                   2
+#define MC__CSIO_CSIO4Out_PPLS                     3
+#define MC__CSIO_CSIO4Out_HOLD                     4
+#define MC__CSIO_CSIO4Dir                        (MCPARAMID)( 3631 << 14)
+#define MC__CSIO_CSIO4Dir_DIRECT                   1
+#define MC__CSIO_CSIO4Dir_INVERT                   2
+#define MC__CSIO_CSIO4Dir_HOLD                     3
+#define MC__CSIO_CSIO1Out_T1SIG3X                  5
+#define MC__CSIO_CSIO1Out_T1SIG4X                  6
+#define MC__CSIO_CSIO2Out_T1SIG3X                  5
+#define MC__CSIO_CSIO2Out_T1SIG4X                  6
+#define MC__CSIO_CSIO3Out_T1SIG3X                  5
+#define MC__CSIO_CSIO3Out_T1SIG4X                  6
+#define MC__CSIO_CSIO4Out_T1SIG3X                  5
+#define MC__CSIO_CSIO4Out_T1SIG4X                  6
+#define MC__CSIO_CSIO1Dir_IO_Output                4
+#define MC__CSIO_CSIO1Dir_IO_nOutput               5
+#define MC__CSIO_CSIO1Dir_IO_Input                 6
+#define MC__CSIO_CSIO2Dir_IO_Output                4
+#define MC__CSIO_CSIO2Dir_IO_nOutput               5
+#define MC__CSIO_CSIO2Dir_IO_Input                 6
+#define MC__CSIO_CSIO3Dir_IO_Output                4
+#define MC__CSIO_CSIO3Dir_IO_nOutput               5
+#define MC__CSIO_CSIO3Dir_IO_Input                 6
+#define MC__CSIO_CSIO4Dir_IO_Output                4
+#define MC__CSIO_CSIO4Dir_IO_nOutput               5
+#define MC__CSIO_CSIO4Dir_IO_Input                 6
+#define MC__CSIO_CSIO1Out_PPLSX                    7
+#define MC__CSIO_CSIO2Out_PPLSX                    7
+#define MC__CSIO_CSIO3Out_PPLSX                    7
+#define MC__CSIO_CSIO4Out_PPLSX                    7
+#define MC_ColorFormat_FLOAT32                    69
+#define MC_Toto                                  (MCPARAMID)( 3632 << 14)
+#define MC_LineTrigLine_Filter                   (MCPARAMID)( 3633 << 14)
+#define MC_OutputState_18_LOOP3                    6
+#define MC_OutputState_18_LOOP4                    7
+#define MC_OutputState_19_LOOP1                    4
+#define MC_OutputState_19_LOOP2                    5
+#define MC_OutputState_19_LOOP3                    6
+#define MC_OutputState_19_LOOP4                    7
+#define MC_OutputState_31_LOOP1                    4
+#define MC_OutputState_31_LOOP2                    5
+#define MC_OutputState_31_LOOP3                    6
+#define MC_OutputState_31_LOOP4                    7
+#define MC_OutputState_32_LOOP3                    6
+#define MC_OutputState_32_LOOP4                    7
+#define MC_OutputState_33_LOOP3                    6
+#define MC_OutputState_33_LOOP4                    7
+#define MC_OutputState_34_LOOP3                    6
+#define MC_OutputState_34_LOOP4                    7
+#define MC_Camera_MV_D1024_80_CL_8               206
+#define MC_Camera_MV_D1024_160_CL_8              207
+#define MC_Camera_MV_D640_66_CL_10               208
+#define MC_Camera_MV_D640C_66_CL_10              209
+#define MC_Camera_MV_D640_33_CL_10               210
+#define MC_Camera_MV_D640C_33_CL_10              211
+#define MC_Camera_TMC_4000CL                     212
+#define MC_CamConfig_P30SC_Base                  259
+#define MC_CamConfig_P30RG_Base                  260
+#define MC_CamConfig_P30RG_O_Base                261
+#define MC_CamConfig_P30SC_Medium                262
+#define MC_CamConfig_P30RG_Medium                263
+#define MC_CamConfig_P30RG_O_Medium              264
+#define MC_CamConfig_L512SC                      265
+#define MC_CamConfig_L512RP                      266
+#define MC_CamConfig_P15RC                       267
+#define MC_CamConfig_P100SC                      268
+#define MC_CamConfig_P100RC                      269
+#define MC_CamConfig_P150SC                      270
+#define MC_CamConfig_P150RG                      271
+#define MC_CamConfig_L1024RG_Base                272
+#define MC_CamConfig_L1024RG_Medium              273
+#define MC_CamConfig_L2048RG_Base                274
+#define MC_CamConfig_L2048RG_Medium              275
+#define MC_CamConfig_L1024RP                     276
+#define MC_CamConfig_L4080SC                     277
+#define MC_CamConfig_L4080RP                     278
+#define MC_Manufacturer_SVS_VISTEK                26
+#define MC_PageLength_TileHeight_Key             (MCPARAMID)( 3634 << 14)
+#define MC___PageLength_TileHeight_Check         (MCPARAMID)( 3635 << 14)
+#define MC___PageLength_TileHeight_Check_PASS      1
+#define MC___PageLength_TileHeight_Check_FAIL      2
+#define MC_ProductionTest                        (MCPARAMID)( 3636 << 14)
+#define MC_ProductionTest_DISABLED                 1
+#define MC_ProductionTest_ENABLED                  2
+#define MC__ReadoutDur_us                        (MCPARAMID)( 3637 << 14)
+#define MC_ForceTrig_ENDTRIG                       2
+#define MC_ForceTrig_Filter                      (MCPARAMID)( 3638 << 14)
+#define MC_EndTrigFilter                         (MCPARAMID)( 3639 << 14)
+#define MC_EndTrigFilter_OFF                       1
+#define MC_EndTrigFilter_MEDIUM                    2
+#define MC_EndTrigFilter_STRONG                    3
+#define MC_EndTrigFilter_ON                        4
+#define MC_EndTrigFilter_Filter                  (MCPARAMID)( 3640 << 14)
+#define MC__EndTrigLine                          (MCPARAMID)( 3641 << 14)
+#define MC__EndTrigLine_NONE                       1
+#define MC__EndTrigLine_IO1                        2
+#define MC__EndTrigLine_IO2                        3
+#define MC__EndTrigLine_IO3                        4
+#define MC__EndTrigLine_IO4                        5
+#define MC__EndTrigLine_ISOA1                      6
+#define MC__EndTrigLine_ISOA2                      7
+#define MC__EndTrigLine_TRA1                       8
+#define MC__EndTrigLine_TRA2                       9
+#define MC__EndTrigLine_LTACT                     10
+#define MC__EndTrigLine_PG                        11
+#define MC__TRG_EFTPOL                           (MCPARAMID)( 3642 << 14)
+#define MC__TRG_EFTPOL_DIRECT                      1
+#define MC__TRG_EFTPOL_INVERT                      2
+#define MC__TRG_EFTSEL                           (MCPARAMID)( 3643 << 14)
+#define MC__TRG_EFTSEL_NA                          1
+#define MC__TRG_EFTSEL_D1                          2
+#define MC__TRG_EFTSEL_D2                          3
+#define MC__TRG_EFTSEL_PG                          4
+#define MC__TRG_EFTSEL_LTACT                       5
+#define MC__TRG_EFTSEL_TRX                         6
+#define MC__TRG_EFTSEL_TRY                         7
+#define MC__TRG_EFTSEL_TRZ                         8
+#define MC__TRG_EFTSEL_DA1                         9
+#define MC__TRG_EFTSEL_DA2                        10
+#define MC__TRG_EFTSEL_TRG1                       11
+#define MC__TRG_EFTSEL_TRG2                       12
+#define MC__TRG_EFTSEL_IO1                        13
+#define MC__TRG_EFTSEL_IO2                        14
+#define MC__TRG_EFTSEL_IO3                        15
+#define MC__TRG_EFTSEL_IO4                        16
+#define MC__EndTrigLine_DA1                       12
+#define MC__EndTrigLine_DA2                       13
+#define MC__EndTrigLine_PGA                       14
+#define MC__EndTrigLine_DB1                       15
+#define MC__EndTrigLine_DB2                       16
+#define MC__EndTrigLine_PGB                       17
+#define MC__EndTrigLine_TRX                       18
+#define MC__EndTrigLine_TRY                       19
+#define MC__EndTrigLine_TRZ                       20
+#define MC_SimMANTRIGSet                         (MCPARAMID)( 3644 << 14)
+#define MC__EndTrigLineNeeded                    (MCPARAMID)( 3645 << 14)
+#define MC__EndTrigLineNeeded_NO                   1
+#define MC__EndTrigLineNeeded_YES                  2
+#define MC__VCOFrequency                         (MCPARAMID)( 3646 << 14)
+#define MC__SSC_CV_A1                              7
+#define MC__CBA_DIRX_w                           (MCPARAMID)( 3647 << 14)
+#define MC_PartialPageLength_Ln                  (MCPARAMID)( 3648 << 14)
+#define MC__LQS_COUNT0                           (MCPARAMID)( 3649 << 14)
+#define MC__LQS_COUNT1                           (MCPARAMID)( 3650 << 14)
+#define MC__LQS_COUNT2                           (MCPARAMID)( 3651 << 14)
+#define MC_PPBUFSize_GrabSizeXStep_Px            (MCPARAMID)( 3652 << 14)
+#define MC_ADR_GrabSizeXStep_Px                  (MCPARAMID)( 3653 << 14)
+#define MC__ADR_ComponentSize_Byte               (MCPARAMID)( 3654 << 14)
+#define MC__ADR_SliceSize_Byte                   (MCPARAMID)( 3655 << 14)
+#define MC__ADR_InputBytePerComponent            (MCPARAMID)( 3656 << 14)
+#define MC__ADR_OutputBytePerComponent           (MCPARAMID)( 3657 << 14)
+#define MC__ADR_OutputsSteps64bit                (MCPARAMID)( 3658 << 14)
+#define MC__ADR_ImageSizeX_Component             (MCPARAMID)( 3659 << 14)
+#define MC__ADR_TotalSliceCount                  (MCPARAMID)( 3660 << 14)
+#define MC__ADR_LastSliceSize_64bit              (MCPARAMID)( 3661 << 14)
+#define MC_LineCaptureMode_ADR                     3
+#define MC__CPG_PGFRAC                           (MCPARAMID)( 3662 << 14)
+#define MC__MinPitch_mw                          (MCPARAMID)( 3663 << 14)
+#define MC__ADR_OutputFormat                     (MCPARAMID)( 3664 << 14)
+#define MC__ADR_OutputFormat_8BIT                  1
+#define MC__ADR_OutputFormat_10BIT                 2
+#define MC__ADR_OutputFormat_12BIT                 3
+#define MC__ADR_OutputFormat_14BIT                 4
+#define MC__ADR_OutputFormat_16BIT                 5
+#define MC__ADR_SliceSize_Component              (MCPARAMID)( 3665 << 14)
+#define MC_MinIntractionLead                     (MCPARAMID)( 3666 << 14)
+#define MC_VSyncSearchWindowLeft_TT              (MCPARAMID)( 3667 << 14)
+#define MC_VSyncSearchWindowRight_TT             (MCPARAMID)( 3668 << 14)
+#define MC_VSyncFoundLNB                         (MCPARAMID)( 3669 << 14)
+#define MC_TimerFrequency                        (MCPARAMID)( 3670 << 14)
+#define MC_Fc_Hz                                 (MCPARAMID)( 3671 << 14)
+#define MC_Fp1_Hz                                (MCPARAMID)( 3672 << 14)
+#define MC_RCR                                   (MCPARAMID)( 3673 << 14)
+#define MC_Fe1_Hz                                (MCPARAMID)( 3674 << 14)
+#define MC__PM_N0                                (MCPARAMID)( 3675 << 14)
+#define MC__PG_SF0                               (MCPARAMID)( 3676 << 14)
+#define MC__Category_Rate_Converter               42
+#define MC__PG_U                                 (MCPARAMID)( 3677 << 14)
+#define MC__PG_S_U_max                           (MCPARAMID)( 3678 << 14)
+#define MC__PG_U_max                             (MCPARAMID)( 3679 << 14)
+#define MC__PG_S_max                             (MCPARAMID)( 3680 << 14)
+#define MC__PG_S                                 (MCPARAMID)( 3681 << 14)
+#define MC__PM_N1                                (MCPARAMID)( 3682 << 14)
+#define MC__PM_PMSDIV                            (MCPARAMID)( 3683 << 14)
+#define MC__PM_M                                 (MCPARAMID)( 3684 << 14)
+#define MC__PM_N2                                (MCPARAMID)( 3685 << 14)
+#define MC_Fp2_Hz                                (MCPARAMID)( 3686 << 14)
+#define MC_Fe2_Hz                                (MCPARAMID)( 3687 << 14)
+#define MC_Fm_Hz                                 (MCPARAMID)( 3688 << 14)
+#define MC_RCDR                                  (MCPARAMID)( 3689 << 14)
+#define MC___RCDR_Check                          (MCPARAMID)( 3690 << 14)
+#define MC___RCDR_Check_PASS                       1
+#define MC___RCDR_Check_FAIL                       2
+#define MC___PM_PMSDIV_Range_Check               (MCPARAMID)( 3691 << 14)
+#define MC___PM_PMSDIV_Range_Check_PASS            1
+#define MC___PM_PMSDIV_Range_Check_FAIL            2
+#define MC___PG_U_Check                          (MCPARAMID)( 3692 << 14)
+#define MC___PG_U_Check_PASS                       1
+#define MC___PG_U_Check_FAIL                       2
+#define MC_SamplingPitch                         (MCPARAMID)( 3693 << 14)
+#define MC__TrimmedKFactor                       (MCPARAMID)( 3694 << 14)
+#define MC__TrimmedKFactor_Check                 (MCPARAMID)( 3695 << 14)
+#define MC__TrimmedKFactor_Check_PASS              1
+#define MC__TrimmedKFactor_Check_FAIL              2
+#define MC__TrimmedPeriod_s                      (MCPARAMID)( 3696 << 14)
+#define MC__Category_Periodic_Timer               43
+#define MC__TrimmedPeriod_us                     (MCPARAMID)( 3697 << 14)
+#define MC_RC_Fc_Hz                              (MCPARAMID)( 3698 << 14)
+#define MC_PT_Fc_Hz                              (MCPARAMID)( 3699 << 14)
+#define MC_PT_Po_s                               (MCPARAMID)( 3700 << 14)
+#define MC__PT_S_U_max                           (MCPARAMID)( 3701 << 14)
+#define MC__PT_U_max                             (MCPARAMID)( 3702 << 14)
+#define MC__PT_U                                 (MCPARAMID)( 3703 << 14)
+#define MC__PT_S_max                             (MCPARAMID)( 3704 << 14)
+#define MC__PT_S                                 (MCPARAMID)( 3705 << 14)
+#define MC__PT_N                                 (MCPARAMID)( 3706 << 14)
+#define MC__PGSCAL                               (MCPARAMID)( 3707 << 14)
+#define MC__PGFRAC                               (MCPARAMID)( 3708 << 14)
+#define MC__KFactorTrim                          (MCPARAMID)( 3709 << 14)
+#define MC__Vtotal_ms                            (MCPARAMID)( 3710 << 14)
+#define MC__Expose_ms                            (MCPARAMID)( 3711 << 14)
+#define MC_MaxCameraLineRate                     (MCPARAMID)( 3712 << 14)
+#define MC_MaxDownwebLineRate                    (MCPARAMID)( 3713 << 14)
+#define MC__MinIntractionLead                    (MCPARAMID)( 3714 << 14)
+#define MC__MinIntractionLead_S                  (MCPARAMID)( 3715 << 14)
+#define MC_SimABORTGASet                         (MCPARAMID)( 3716 << 14)
+#define MC_ExpectedSeqLength_Ln                  (MCPARAMID)( 3717 << 14)
+#define MC__PT_S_min                             (MCPARAMID)( 3718 << 14)
+#define MC___PT_PGCNT_Range_Check                (MCPARAMID)( 3719 << 14)
+#define MC___PT_PGCNT_Range_Check_PASS             1
+#define MC___PT_PGCNT_Range_Check_FAIL             2
+#define MC_SkippedLineCount                      (MCPARAMID)( 3720 << 14)
+#define MC__CTD_ETDMOD                           (MCPARAMID)( 3721 << 14)
+#define MC__CTD_ETDMOD_Bypass                      1
+#define MC__CTD_ETDMOD_Enable                      2
+#define MC__ETD_TDCNT                            (MCPARAMID)( 3722 << 14)
+#define MC_EndPageDelay_Ln                       (MCPARAMID)( 3723 << 14)
+#define MC__ETD_TDMOD                            (MCPARAMID)( 3724 << 14)
+#define MC__ETD_TDMOD_Bypass                       1
+#define MC__ETD_TDMOD_Enable                       2
+#define MC_AssyPixelSize                         (MCPARAMID)( 3725 << 14)
+#define MC_LineCaptureMode_LineCaptureMode_Filter   4
+#define MC_LineCaptureMode_Filter                (MCPARAMID)( 3726 << 14)
+#define MC_IDP_SWITCH                            (MCPARAMID)( 3727 << 14)
+#define MC_IDP_SWITCH_TURN_ON                      1
+#define MC_IDP_SWITCH_TURN_OFF                     2
+#define MC_LineDur_Px                            (MCPARAMID)( 3728 << 14)
+#define MC__SampledPixels_Px                     (MCPARAMID)( 3729 << 14)
+#define MC_ActiveLineDurNoBlack_ns               (MCPARAMID)( 3730 << 14)
+#define MC_LineDurNoBlack_Px                     (MCPARAMID)( 3731 << 14)
+#define MC_MaxHCsyncAft_ns                       (MCPARAMID)( 3732 << 14)
+#define MC_MaxHCsyncBfr_ns                       (MCPARAMID)( 3733 << 14)
+#define MC__NoBlackOffset                        (MCPARAMID)( 3734 << 14)
+#define MC__NoBlackOffset_Px                     (MCPARAMID)( 3735 << 14)
+#define MC__NoBlackScale                         (MCPARAMID)( 3736 << 14)
+#define MC__ModelId                              (MCPARAMID)( 3737 << 14)
+#define MC__ModuleId                             (MCPARAMID)( 3738 << 14)
+#define MC_ImagePixelAlign_N_A                     3
+#define MC__Peak                                 (MCPARAMID)( 3739 << 14)
+#define MC__Peak_OFF                               1
+#define MC__Peak_ON                                2
+#define MC__Hfilt                                (MCPARAMID)( 3740 << 14)
+#define MC__Majs                                 (MCPARAMID)( 3741 << 14)
+#define MC__BoardType__PICOLO_ALERT               26
+#define MC__Dummy                                (MCPARAMID)( 3742 << 14)
+#define MC___PageLength_TileHeight_Check_ErrorMsg (MCPARAMID)( 3743 << 14)
+#define MC_NextTrigMode_NextTrigMode              10
+#define MC__TED_TDCLK                            (MCPARAMID)( 3744 << 14)
+#define MC__TED_TDCLK_PRESCAL                      1
+#define MC__TED_TDCLK_LTRIG                        2
+#define MC__TED_TDCLK_PPLS                         3
+#define MC__TED_TDCLK_EOL                          4
+#define MC__TED_TDMOD                            (MCPARAMID)( 3745 << 14)
+#define MC__TED_TDMOD_Bypass                       1
+#define MC__TED_TDMOD_Enable                       2
+#define MC__ETD_ETDMOD                           (MCPARAMID)( 3746 << 14)
+#define MC__ETD_ETDMOD_Bypass                      1
+#define MC__ETD_ETDMOD_Enable                      2
+#define MC__TED_TDSCAL_ns                        (MCPARAMID)( 3747 << 14)
+#define MC__TED_TDCNT                            (MCPARAMID)( 3748 << 14)
+#define MC__ETD_ETDCNT                           (MCPARAMID)( 3749 << 14)
+#define MC_PageDelay_Filter                      (MCPARAMID)( 3750 << 14)
+#define MC_EndPageDelay_Filter                   (MCPARAMID)( 3751 << 14)
+#define MC_BoardStartSet                         (MCPARAMID)( 3752 << 14)
+#define MC__HDHalfPeriod_25ns                    (MCPARAMID)( 3753 << 14)
+#define MC__HDPulseWidth_25ns                    (MCPARAMID)( 3754 << 14)
+#define MC__VDPeriod_halfHD                      (MCPARAMID)( 3755 << 14)
+#define MC__VDPulseWidth_halfHD                  (MCPARAMID)( 3756 << 14)
+#define MC__CameraSyncEnable                     (MCPARAMID)( 3757 << 14)
+#define MC__CameraSyncEnable_ENABLE                1
+#define MC__CameraSyncEnable_DISABLE               2
+#define MC___DisableCamDigIO                     (MCPARAMID)( 3758 << 14)
+#define MC___DisableCamDigIO_DISABLE               1
+#define MC___DisableCamDigIO_ENABLE                2
+#define MC__Board_Type__ALERT                      8
+#define MC__Category_Low_Level                    44
+#define MC__BoardType__ALERT                      27
+#define MC_BEC_SrcFlipX                          (MCPARAMID)( 3759 << 14)
+#define MC_BEC_SrcFlipX_ON                         1
+#define MC_BEC_SrcFlipX_OFF                        2
+#define MC_BEC_SrcVertRes                        (MCPARAMID)( 3760 << 14)
+#define MC_BEC_SrcVertRes_HALFRES                  1
+#define MC_BEC_SrcVertRes_FULLRES                  2
+#define MC_BEC_SrcSizeY                          (MCPARAMID)( 3761 << 14)
+#define MC_SrcOffsetAddressY                     (MCPARAMID)( 3762 << 14)
+#define MC_BEC_SrcOffsetAddressY                 (MCPARAMID)( 3763 << 14)
+#define MC_BEC_SrcCAPM                           (MCPARAMID)( 3764 << 14)
+#define MC_BEC_SrcCAPM_CField                      1
+#define MC_BEC_SrcCAPM_CFrame                      2
+#define MC_FEC_CAPM                              (MCPARAMID)( 3765 << 14)
+#define MC_FEC_CAPM_CField                         1
+#define MC_FEC_CAPM_CFrame                         2
+#define MC_FEC_HPRE                              (MCPARAMID)( 3766 << 14)
+#define MC_FEC_VPIM                              (MCPARAMID)( 3767 << 14)
+#define MC_FEC_VPIM_EvenIsUp                       1
+#define MC_FEC_VPIM_EvenIsDown                     2
+#define MC_FEC_VSTD                              (MCPARAMID)( 3768 << 14)
+#define MC_FEC_VSTD_PAL_SQ                         1
+#define MC_FEC_VSTD_NTSC_SQ                        2
+#define MC_FEC_VSTD_PAL_BROAD                      3
+#define MC_FEC_VSTD_NTSC_BROAD                     4
+#define MC_FEC_VSTD_SimA                           5
+#define MC_FEC_VSTD_SimB                           6
+#define MC_FEC_VSTD_SimC                           7
+#define MC_FEC_VSTD_SimD                           8
+#define MC_BusIdx                                (MCPARAMID)( 3769 << 14)
+#define MC_DeviceIdx                             (MCPARAMID)( 3770 << 14)
+#define MC__FPGA_Model                           (MCPARAMID)( 3771 << 14)
+#define MC__FPGA_Model_HARMONY_DUOCAM              1
+#define MC__FPGA_Model_HARMONY_MONOCAM_RGB         2
+#define MC__FPGA_Model_MELODY_MONOCAM              3
+#define MC__CONV_OUTPUT_GRANULARITY_             (MCPARAMID)( 3772 << 14)
+#define MC_D3_CONVOLVER_BLOCKS                   (MCPARAMID)( 3773 << 14)
+#define MC__DMA_TRANSFER_GRANULARITY_            (MCPARAMID)( 3774 << 14)
+#define MC__IMAGE_TRANSFER_GRANULARITY_          (MCPARAMID)( 3775 << 14)
+#define MC__Rounded_RHD                          (MCPARAMID)( 3776 << 14)
+#define MC_RAS_R                                 (MCPARAMID)( 3777 << 14)
+#define MC_Connector_UNDEFINED                   123
+#define MC_BEC_VScaleFactor                      (MCPARAMID)( 3778 << 14)
+#define MC_FEC_VPRE                              (MCPARAMID)( 3779 << 14)
+#define MC_FEC_VACT                              (MCPARAMID)( 3780 << 14)
+#define MC_FEC_VBarrelShift                      (MCPARAMID)( 3781 << 14)
+#define MC_FEC_VBarrelShift_1BIT                   1
+#define MC_FEC_VBarrelShift_2BIT                   2
+#define MC_FEC_VBarrelShift_3BIT                   3
+#define MC_FEC_VBarrelShift_0BIT                   4
+#define MC_FEC_HBarrelShift                      (MCPARAMID)( 3782 << 14)
+#define MC_FEC_HBarrelShift_0BIT                   1
+#define MC_FEC_HBarrelShift_1BIT                   2
+#define MC_FEC_HBarrelShift_2BIT                   3
+#define MC_BEC_HScaleFactor                      (MCPARAMID)( 3783 << 14)
+#define MC_BEC_SrcOffetX                         (MCPARAMID)( 3784 << 14)
+#define MC_BEC_DestSizeX                         (MCPARAMID)( 3785 << 14)
+#define MC_BEC_EnableCSC                         (MCPARAMID)( 3786 << 14)
+#define MC_BEC_EnableCSC_ON                        1
+#define MC_BEC_EnableCSC_OFF                       2
+#define MC_BEC_Offset_Y                          (MCPARAMID)( 3787 << 14)
+#define MC_BEC_Gain_Y                            (MCPARAMID)( 3788 << 14)
+#define MC_BEC_Gain_Cr1                          (MCPARAMID)( 3789 << 14)
+#define MC_BEC_Gain_Cr2                          (MCPARAMID)( 3790 << 14)
+#define MC_BEC_Gain_Cb1                          (MCPARAMID)( 3791 << 14)
+#define MC_BEC_Gain_Cb2                          (MCPARAMID)( 3792 << 14)
+#define MC_BEC_Gain_Cr_1                         (MCPARAMID)( 3793 << 14)
+#define MC_BEC_Gain_Cr_2                         (MCPARAMID)( 3794 << 14)
+#define MC_BEC_Gain_Cb_1                         (MCPARAMID)( 3795 << 14)
+#define MC_BEC_Gain_Cb_2                         (MCPARAMID)( 3796 << 14)
+#define MC_PixelTiming                           (MCPARAMID)( 3797 << 14)
+#define MC_PixelTiming_SQUARE                      1
+#define MC_PixelTiming_BROADCAST                   2
+#define MC_Resolution                            (MCPARAMID)( 3798 << 14)
+#define MC_Resolution_FRAME                        1
+#define MC_Resolution_FLD                          2
+#define MC_Resolution_CIF                          3
+#define MC_Resolution_QCIF                         4
+#define MC_BEC_VBarrelShift                      (MCPARAMID)( 3799 << 14)
+#define MC_BEC_VBarrelShift_0BIT                   1
+#define MC_BEC_VBarrelShift_1BIT                   2
+#define MC_BEC_VBarrelShift_2BIT                   3
+#define MC_BEC_HBarrelShift                      (MCPARAMID)( 3800 << 14)
+#define MC_BEC_HBarrelShift_0BIT                   1
+#define MC_BEC_HBarrelShift_1BIT                   2
+#define MC_BEC_HBarrelShift_2BIT                   3
+#define MC__Y_Ln                                 (MCPARAMID)( 3801 << 14)
+#define MC_Resolution_CUSTOM                       5
+#define MC_Resolution_Filter                     (MCPARAMID)( 3802 << 14)
+#define MC__ScaleX                               (MCPARAMID)( 3803 << 14)
+#define MC__RoundedScaledWindowX                 (MCPARAMID)( 3804 << 14)
+#define MC__ScaledWindowX                        (MCPARAMID)( 3805 << 14)
+#define MC_ScaledWindowX                         (MCPARAMID)( 3806 << 14)
+#define MC__ScaleY                               (MCPARAMID)( 3807 << 14)
+#define MC__ScaledWindowY                        (MCPARAMID)( 3808 << 14)
+#define MC_ScaledWindowY                         (MCPARAMID)( 3809 << 14)
+#define MC_ColorFormat_YUV444                     70
+#define MC_ColorFormat_Y41P                       71
+#define MC_ColorFormat_Y42P                       72
+#define MC_ColorFormat_IYU2                       73
+#define MC_ColorFormat_YUV444PL                   74
+#define MC_ColorFormat_YUV411PL_DEC               75
+#define MC_ColorFormat_YUV422PL_DEC               76
+#define MC__HSP                                  (MCPARAMID)( 3810 << 14)
+#define MC__VSP                                  (MCPARAMID)( 3811 << 14)
+#define MC__BPP                                  (MCPARAMID)( 3812 << 14)
+#define MC__Pixel_Assembly_Granularity           (MCPARAMID)( 3813 << 14)
+#define MC__TransferredImageSizeX                (MCPARAMID)( 3814 << 14)
+#define MC__B4PP                                 (MCPARAMID)( 3815 << 14)
+#define MC__Max_OffsetX_Px                       (MCPARAMID)( 3816 << 14)
+#define MC__Min_OffsetX_Px                       (MCPARAMID)( 3817 << 14)
+#define MC__LeftMargin_Max_Px                    (MCPARAMID)( 3818 << 14)
+#define MC__LeftMargin_Px                        (MCPARAMID)( 3819 << 14)
+#define MC__TopMargin_Max_Ln                     (MCPARAMID)( 3820 << 14)
+#define MC__TopMargin_Ln                         (MCPARAMID)( 3821 << 14)
+#define MC_ImageColorSpace                       (MCPARAMID)( 3822 << 14)
+#define MC_ImageColorSpace_YUV                     1
+#define MC_ImageColorSpace_RGB                     2
+#define MC_VsyncAft_Ln_Bit0                      (MCPARAMID)( 3823 << 14)
+#define MC_GainY_f                               (MCPARAMID)( 3824 << 14)
+#define MC__GainC_f                              (MCPARAMID)( 3825 << 14)
+#define MC__CSC_GainY_4_7                        (MCPARAMID)( 3826 << 14)
+#define MC__CSC_GainCrR_4_7                      (MCPARAMID)( 3827 << 14)
+#define MC__CSC_GainCrG_S3_7                     (MCPARAMID)( 3828 << 14)
+#define MC__CSC_GainCbB_4_7                      (MCPARAMID)( 3829 << 14)
+#define MC__CSC_GainCbG_S3_7                     (MCPARAMID)( 3830 << 14)
+#define MC__GainU_f                              (MCPARAMID)( 3831 << 14)
+#define MC__GainV_f                              (MCPARAMID)( 3832 << 14)
+#define MC_ScalersGain_f                         (MCPARAMID)( 3833 << 14)
+#define MC_GainU_f                               (MCPARAMID)( 3834 << 14)
+#define MC_GainV_f                               (MCPARAMID)( 3835 << 14)
+#define MC__CSC_GainCbG_S2_7                     (MCPARAMID)( 3836 << 14)
+#define MC_GainY                                 (MCPARAMID)( 3837 << 14)
+#define MC_GainU                                 (MCPARAMID)( 3838 << 14)
+#define MC_GainV                                 (MCPARAMID)( 3839 << 14)
+#define MC__CSC_GainY                            (MCPARAMID)( 3840 << 14)
+#define MC__CSC_GainCrR                          (MCPARAMID)( 3841 << 14)
+#define MC__CSC_GainCrG                          (MCPARAMID)( 3842 << 14)
+#define MC__CSC_GainCbB                          (MCPARAMID)( 3843 << 14)
+#define MC__CSC_GainCbG                          (MCPARAMID)( 3844 << 14)
+#define MC_ScalersGain                           (MCPARAMID)( 3845 << 14)
+#define MC_ScaleY                                (MCPARAMID)( 3846 << 14)
+#define MC_ScaleX                                (MCPARAMID)( 3847 << 14)
+#define MC_ScalerXGain                           (MCPARAMID)( 3848 << 14)
+#define MC_ScalerYGain                           (MCPARAMID)( 3849 << 14)
+#define MC_BEC_VideoOutFormat                    (MCPARAMID)( 3850 << 14)
+#define MC_BEC_VideoOutFormat_YUV444_Packed        1
+#define MC_BEC_VideoOutFormat_YUV444_Planar        2
+#define MC_BEC_VideoOutFormat_YUV422_Packed        3
+#define MC_BEC_VideoOutFormat_YUV422_Planar        4
+#define MC_BEC_VideoOutFormat_YUV422_Planar_Decimated   5
+#define MC_BEC_VideoOutFormat_YUV411_Packed        6
+#define MC_BEC_VideoOutFormat_YUV411_Planar        7
+#define MC_BEC_VideoOutFormat_YUV411_Planar_Decimated   8
+#define MC_BEC_VideoOutFormat_RGB15_Packed         9
+#define MC_BEC_VideoOutFormat_RGB16_Packed        10
+#define MC_BEC_VideoOutFormat_RGB24_Packed        11
+#define MC_BEC_VideoOutFormat_RGB24_Planar        12
+#define MC_BEC_VideoOutFormat_ARGB32_Packed       13
+#define MC_BEC_VideoOutFormat_Y8                  14
+#define MC_Camera_SIMA                           213
+#define MC_BEC_SrcOffsetX                        (MCPARAMID)( 3851 << 14)
+#define MC_Standard_SIMA                           6
+#define MC__FCR                                  (MCPARAMID)( 3852 << 14)
+#define MC_FEC_FCR                               (MCPARAMID)( 3853 << 14)
+#define MC_DataRange_Filter                      (MCPARAMID)( 3854 << 14)
+#define MC_ColorFormat_MJPG                       77
+#define MC_VideoSamplingPeriod                   (MCPARAMID)( 3855 << 14)
+#define MC_ImageWidth                            (MCPARAMID)( 3856 << 14)
+#define MC_VerticalSamplingPeriod                (MCPARAMID)( 3857 << 14)
+#define MC_Go                                    (MCPARAMID)( 3858 << 14)
+#define MC_CaptureRate                           (MCPARAMID)( 3859 << 14)
+#define MC_CaptureRate_Slider                    (MCPARAMID)( 3860 << 14)
+#define MC_CaptureRate_Max                       (MCPARAMID)( 3861 << 14)
+#define MC_CaptureRate_Min                       (MCPARAMID)( 3862 << 14)
+#define MC_CaptureRate_Default                   (MCPARAMID)( 3863 << 14)
+#define MC_CaptureRate_SliderF                   (MCPARAMID)( 3864 << 14)
+#define MC_InterfaceLayer                        (MCPARAMID)( 3865 << 14)
+#define MC_InterfaceLayer_DISABLED                 1
+#define MC_InterfaceLayer_ENABLED                  2
+#define MC_Brightness_Slider                     (MCPARAMID)( 3866 << 14)
+#define MC_Brightness                            (MCPARAMID)( 3867 << 14)
+#define MC_Brightness_SliderF                    (MCPARAMID)( 3868 << 14)
+#define MC_Brightness_Max                        (MCPARAMID)( 3869 << 14)
+#define MC_Brightness_Min                        (MCPARAMID)( 3870 << 14)
+#define MC_Brightness_Default                    (MCPARAMID)( 3871 << 14)
+#define MC_Contrast_Slider                       (MCPARAMID)( 3872 << 14)
+#define MC_Contrast                              (MCPARAMID)( 3873 << 14)
+#define MC_Contrast_SliderF                      (MCPARAMID)( 3874 << 14)
+#define MC_Contrast_Max                          (MCPARAMID)( 3875 << 14)
+#define MC_Contrast_Min                          (MCPARAMID)( 3876 << 14)
+#define MC_Contrast_Default                      (MCPARAMID)( 3877 << 14)
+#define MC_Saturation_Slider                     (MCPARAMID)( 3878 << 14)
+#define MC_Saturation                            (MCPARAMID)( 3879 << 14)
+#define MC_Saturation_SliderF                    (MCPARAMID)( 3880 << 14)
+#define MC_Saturation_Max                        (MCPARAMID)( 3881 << 14)
+#define MC_Saturation_Min                        (MCPARAMID)( 3882 << 14)
+#define MC_Saturation_Default                    (MCPARAMID)( 3883 << 14)
+#define MC_CaptureRate_Slider_Default            (MCPARAMID)( 3884 << 14)
+#define MC_Contrast_Slider_Default               (MCPARAMID)( 3885 << 14)
+#define MC_Saturation_Slider_Default             (MCPARAMID)( 3886 << 14)
+#define MC_Brightness_Slider_Default             (MCPARAMID)( 3887 << 14)
+#define MC__CaptureRate_Max_x1000                (MCPARAMID)( 3888 << 14)
+#define MC_FEC_VPIM_OddIsUp                        3
+#define MC_StandardFrameRate_mHz                 (MCPARAMID)( 3889 << 14)
+#define MC_VideoStandard                         (MCPARAMID)( 3890 << 14)
+#define MC_VideoStandard_PAL                       1
+#define MC_VideoStandard_NTSC                      2
+#define MC_OutputFormat                          (MCPARAMID)( 3891 << 14)
+#define MC_OutputFormat_YUY2                       1
+#define MC_OutputFormat_YV12                       2
+#define MC_OutputFormat_Y41P                       3
+#define MC_OutputFormat_IYUV                       4
+#define MC_OutputFormat_YVU9                       5
+#define MC_OutputFormat_RGB24                      6
+#define MC_OutputFormat_RGB555                     7
+#define MC_OutputFormat_RGB565                     8
+#define MC_OutputFormat_RGB8                       9
+#define MC_OutputFormat_ARGB32                    10
+#define MC_CaptureRegion                         (MCPARAMID)( 3892 << 14)
+#define MC_CaptureRegion_FRAME                     1
+#define MC_CaptureRegion_FLD                       2
+#define MC_CaptureRegion_CIF                       3
+#define MC_CaptureRegion_QCIF                      4
+#define MC_CaptureRegion_CUSTOM                    5
+#define MC_CaptureRegionXSize_Slider             (MCPARAMID)( 3893 << 14)
+#define MC_CaptureRegionXSize                    (MCPARAMID)( 3894 << 14)
+#define MC_CaptureRegionXSize_Max                (MCPARAMID)( 3895 << 14)
+#define MC_CaptureRegionXSize_Min                (MCPARAMID)( 3896 << 14)
+#define MC_CaptureRegionXSize_Default            (MCPARAMID)( 3897 << 14)
+#define MC_CaptureRegionXSize_Slider_Default     (MCPARAMID)( 3898 << 14)
+#define MC_CaptureRegionXSize_SliderF            (MCPARAMID)( 3899 << 14)
+#define MC_CaptureRegionYSize_Slider             (MCPARAMID)( 3900 << 14)
+#define MC_CaptureRegionYSize                    (MCPARAMID)( 3901 << 14)
+#define MC_CaptureRegionYSize_SliderF            (MCPARAMID)( 3902 << 14)
+#define MC_CaptureRegionYSize_Max                (MCPARAMID)( 3903 << 14)
+#define MC_CaptureRegionYSize_Min                (MCPARAMID)( 3904 << 14)
+#define MC_CaptureRegionYSize_Default            (MCPARAMID)( 3905 << 14)
+#define MC_CaptureRegionYSize_Slider_Default     (MCPARAMID)( 3906 << 14)
+#define MC_CaptureRegionXPosition_Slider         (MCPARAMID)( 3907 << 14)
+#define MC_CaptureRegionXPosition                (MCPARAMID)( 3908 << 14)
+#define MC_CaptureRegionXPosition_SliderF        (MCPARAMID)( 3909 << 14)
+#define MC_CaptureRegionXPosition_Max            (MCPARAMID)( 3910 << 14)
+#define MC_CaptureRegionXPosition_Min            (MCPARAMID)( 3911 << 14)
+#define MC_CaptureRegionXPosition_Default        (MCPARAMID)( 3912 << 14)
+#define MC_CaptureRegionXPosition_Slider_Default (MCPARAMID)( 3913 << 14)
+#define MC_CaptureRegionXPosition_Span           (MCPARAMID)( 3914 << 14)
+#define MC_CaptureRegionYPosition_Slider         (MCPARAMID)( 3915 << 14)
+#define MC_CaptureRegionYPosition                (MCPARAMID)( 3916 << 14)
+#define MC_CaptureRegionYPosition_SliderF        (MCPARAMID)( 3917 << 14)
+#define MC_CaptureRegionYPosition_Span           (MCPARAMID)( 3918 << 14)
+#define MC_CaptureRegionYPosition_Max            (MCPARAMID)( 3919 << 14)
+#define MC_CaptureRegionYPosition_Min            (MCPARAMID)( 3920 << 14)
+#define MC_CaptureRegionYPosition_Default        (MCPARAMID)( 3921 << 14)
+#define MC_CaptureRegionYPosition_Slider_Default (MCPARAMID)( 3922 << 14)
+#define MC__PixelClock_x2                        (MCPARAMID)( 3923 << 14)
+#define MC_EffLineDur_Px                         (MCPARAMID)( 3924 << 14)
+#define MC__PixelClock                           (MCPARAMID)( 3925 << 14)
+#define MC__PLL_fl                               (MCPARAMID)( 3926 << 14)
+#define MC__PLL_int                              (MCPARAMID)( 3927 << 14)
+#define MC_ObjectName_Slider                     (MCPARAMID)( 3928 << 14)
+#define MC_ObjectName_SliderF                    (MCPARAMID)( 3929 << 14)
+#define MC_ObjectName_Max                        (MCPARAMID)( 3930 << 14)
+#define MC_ObjectName_Min                        (MCPARAMID)( 3931 << 14)
+#define MC_ObjectName_Default                    (MCPARAMID)( 3932 << 14)
+#define MC_ObjectName_Slider_Default             (MCPARAMID)( 3933 << 14)
+#define MC_EffPixelClock                         (MCPARAMID)( 3934 << 14)
+#define MC_EffPixelClock_x2                      (MCPARAMID)( 3935 << 14)
+#define MC_Brightness_Span                       (MCPARAMID)( 3936 << 14)
+#define MC__PageLength_Ln_Check                  (MCPARAMID)( 3937 << 14)
+#define MC__LimitedScaleX                        (MCPARAMID)( 3938 << 14)
+#define MC__LimitedScaleY                        (MCPARAMID)( 3939 << 14)
+#define MC_ImageXSize_Slider                     (MCPARAMID)( 3940 << 14)
+#define MC_ImageXSize                            (MCPARAMID)( 3941 << 14)
+#define MC_ImageXSize_SliderF                    (MCPARAMID)( 3942 << 14)
+#define MC_ImageXSize_Max                        (MCPARAMID)( 3943 << 14)
+#define MC_ImageXSize_Min                        (MCPARAMID)( 3944 << 14)
+#define MC_ImageXSize_Default                    (MCPARAMID)( 3945 << 14)
+#define MC_ImageXSize_Slider_Default             (MCPARAMID)( 3946 << 14)
+#define MC_ImageYSize_Slider                     (MCPARAMID)( 3947 << 14)
+#define MC_ImageYSize                            (MCPARAMID)( 3948 << 14)
+#define MC_ImageYSize_SliderF                    (MCPARAMID)( 3949 << 14)
+#define MC_ImageYSize_Max                        (MCPARAMID)( 3950 << 14)
+#define MC_ImageYSize_Min                        (MCPARAMID)( 3951 << 14)
+#define MC_ImageYSize_Default                    (MCPARAMID)( 3952 << 14)
+#define MC_ImageYSize_Slider_Default             (MCPARAMID)( 3953 << 14)
+#define MC_ResolutionX_Slider                    (MCPARAMID)( 3954 << 14)
+#define MC_ResolutionX                           (MCPARAMID)( 3955 << 14)
+#define MC_ResolutionX_SliderF                   (MCPARAMID)( 3956 << 14)
+#define MC_ResolutionX_Max                       (MCPARAMID)( 3957 << 14)
+#define MC_ResolutionX_Min                       (MCPARAMID)( 3958 << 14)
+#define MC_ResolutionX_Default                   (MCPARAMID)( 3959 << 14)
+#define MC_ResolutionX_Slider_Default            (MCPARAMID)( 3960 << 14)
+#define MC_ResolutionY_Slider                    (MCPARAMID)( 3961 << 14)
+#define MC_ResolutionY                           (MCPARAMID)( 3962 << 14)
+#define MC_ResolutionY_SliderF                   (MCPARAMID)( 3963 << 14)
+#define MC_ResolutionY_Max                       (MCPARAMID)( 3964 << 14)
+#define MC_ResolutionY_Min                       (MCPARAMID)( 3965 << 14)
+#define MC_ResolutionY_Default                   (MCPARAMID)( 3966 << 14)
+#define MC_ResolutionY_Slider_Default            (MCPARAMID)( 3967 << 14)
+#define MC_AnalogHSLane                          (MCPARAMID)( 3968 << 14)
+#define MC_DigitalHSLane                         (MCPARAMID)( 3969 << 14)
+#define MC__ResolutionX_Max                      (MCPARAMID)( 3970 << 14)
+#define MC__ResolutionX_Min                      (MCPARAMID)( 3971 << 14)
+#define MC__ResolutionY_Max                      (MCPARAMID)( 3972 << 14)
+#define MC__ResolutionY_Min                      (MCPARAMID)( 3973 << 14)
+#define MC_FieldSizeY                            (MCPARAMID)( 3974 << 14)
+#define MC__SyncPhaseLock                        (MCPARAMID)( 3975 << 14)
+#define MC__SyncPhaseLock_TRUE                     1
+#define MC__SyncPhaseLock_FALSE                    2
+#define MC__FieldsInSignal                       (MCPARAMID)( 3976 << 14)
+#define MC__GrabbedFields                        (MCPARAMID)( 3977 << 14)
+#define MC_InterfaceParameters                   (MCPARAMID)( 3978 << 14)
+#define MC_InterfaceParameters_DISABLE             1
+#define MC_InterfaceParameters_ENABLE              2
+#define MC_CsyncCtl                              (MCPARAMID)( 3979 << 14)
+#define MC_CsyncCtl_NONE                           1
+#define MC_CsyncCtl_TTL                            2
+#define MC_CsyncCtl_DIFF                           3
+#define MC_CsyncCtl_LVDS                           4
+#define MC_CsyncEdge                             (MCPARAMID)( 3980 << 14)
+#define MC_CsyncEdge_GOLOW                         1
+#define MC_CsyncEdge_GOHIGH                        2
+#define MC_CsyncLine_HIO                           7
+#define MC_CsyncLine_GATE                          8
+#define MC_TargetFrameRate_mHz                   (MCPARAMID)( 3981 << 14)
+#define MC_Monochrome                            (MCPARAMID)( 3982 << 14)
+#define MC__BoardType__PICOLO_DILIGENT            28
+#define MC_ResolutionY_Rule                      (MCPARAMID)( 3983 << 14)
+#define MC_ResolutionY_FeedbackRule              (MCPARAMID)( 3984 << 14)
+#define MC_ResolutionYMaxRule                    (MCPARAMID)( 3985 << 14)
+#define MC_OutputFormat_RGB32                     11
+#define MC_CX_VACTIVE                            (MCPARAMID)( 3986 << 14)
+#define MC_WISPackages                           (MCPARAMID)( 3987 << 14)
+#define MC__WIS_CompressMode                     (MCPARAMID)( 3988 << 14)
+#define MC__WIS_CompressMode_MPEG1                 1
+#define MC__WIS_CompressMode_MPEG2                 2
+#define MC__WIS_CompressMode_H263                  3
+#define MC__WIS_CompressMode_MPEG4                 4
+#define MC__WIS_CompressMode_MJPEG                 5
+#define MC_MPEGPackages                          (MCPARAMID)( 3989 << 14)
+#define MC_MPEGXPackage                          (MCPARAMID)( 3990 << 14)
+#define MC_ICXYIVLCPackage                       (MCPARAMID)( 3991 << 14)
+#define MC_MPEGXTBLPackage                       (MCPARAMID)( 3992 << 14)
+#define MC__WIS_SequenceMode                     (MCPARAMID)( 3993 << 14)
+#define MC__WIS_SequenceMode_IP                    1
+#define MC__WIS_SequenceMode_IPB                   2
+#define MC_QDEQTBLPackage                        (MCPARAMID)( 3994 << 14)
+#define MC_OSDPackage                            (MCPARAMID)( 3995 << 14)
+#define MC_WISPackage                            (MCPARAMID)( 3996 << 14)
+#define MC_WindowY_SLn                           (MCPARAMID)( 3997 << 14)
+#define MC_BEC_StorageType                       (MCPARAMID)( 3998 << 14)
+#define MC_BEC_StorageType_PACKED                  1
+#define MC_BEC_StorageType_PLANAR                  2
+#define MC_BEC_ChromaSwap                        (MCPARAMID)( 3999 << 14)
+#define MC_BEC_ChromaSwap_OFF                      1
+#define MC_BEC_ChromaSwap_ON                       2
+#define MC_Vactive_Noblack_Ln                    (MCPARAMID)( 4000 << 14)
+#define MC_WindowX_Noblack_Px                    (MCPARAMID)( 4001 << 14)
+#define MC_Hactive_Noblack_Px                    (MCPARAMID)( 4002 << 14)
+#define MC_ENC_CompressMode                      (MCPARAMID)( 4003 << 14)
+#define MC_ENC_CompressMode_MPEG4                  1
+#define MC_ENC_CompressMode_MJPEG                  2
+#define MC_DIVX_MPEG4                            (MCPARAMID)( 4004 << 14)
+#define MC_MS_MPEG4                              (MCPARAMID)( 4005 << 14)
+#define MC_ENC_Mjpeg                             (MCPARAMID)( 4006 << 14)
+#define MC_ENC_SequenceMode                      (MCPARAMID)( 4007 << 14)
+#define MC_ENC_SequenceMode_IONLY                  1
+#define MC_ENC_SequenceMode_IPONLY                 2
+#define MC_ENC_SequenceMode_IPB                    3
+#define MC_ENC_GopMode                           (MCPARAMID)( 4008 << 14)
+#define MC_ENC_GopMode_OPEN                        1
+#define MC_ENC_GopMode_CLOSE                       2
+#define MC_ENC_GopSize                           (MCPARAMID)( 4009 << 14)
+#define MC_ENC_GopSizeGranularity                (MCPARAMID)( 4010 << 14)
+#define MC_ENC_Mpeg4Mode                         (MCPARAMID)( 4011 << 14)
+#define MC_ENC_Mpeg4Mode_DX50                      1
+#define MC_ENC_Mpeg4Mode_MP4S                      2
+#define MC_ENC_DeinterlaceMode                   (MCPARAMID)( 4012 << 14)
+#define MC_ENC_SearchRange                       (MCPARAMID)( 4013 << 14)
+#define MC_ENC_GopHeaderEn                       (MCPARAMID)( 4014 << 14)
+#define MC_ENC_SeqHeaderEn                       (MCPARAMID)( 4015 << 14)
+#define MC_ENC_AspectRatio                       (MCPARAMID)( 4016 << 14)
+#define MC_MJPEG                                 (MCPARAMID)( 4017 << 14)
+#define MC_ENC_SequenceMode_Filter               (MCPARAMID)( 4018 << 14)
+#define MC_TCFGVIDEOEX                           (MCPARAMID)( 4019 << 14)
+#define MC_TVIDEOCFGFIX                          (MCPARAMID)( 4020 << 14)
+#define MC_ENC_CompressMode_MPEG1                  3
+#define MC_ENC_CompressMode_MPEG2                  4
+#define MC_ENC_CompressMode_H263                   5
+#define MC__MIIR                                 (MCPARAMID)( 4021 << 14)
+#define MC_PixelTiming_Filter                    (MCPARAMID)( 4022 << 14)
+#define MC_ENC_DeinterlaceMode_INTERPOLATION       1
+#define MC_ENC_DeinterlaceMode_INTERLACED_ENCODING   2
+#define MC_ENC_DeinterlaceMode_WEAVING             3
+#define MC_ENC_DeinterlaceMode_BLENDING            4
+#define MC_ENC_DeinterlaceMode_MOTION_DETECTION    5
+#define MC_ENC_DVDCompliant                      (MCPARAMID)( 4023 << 14)
+#define MC_ENC_MaxGopSize                        (MCPARAMID)( 4024 << 14)
+#define MC_ENC_BRCTRLreserved                    (MCPARAMID)( 4025 << 14)
+#define MC_ENC_QMIN                              (MCPARAMID)( 4026 << 14)
+#define MC_ENC_QMAX                              (MCPARAMID)( 4027 << 14)
+#define MC_ENC_BRCWindowSize                     (MCPARAMID)( 4028 << 14)
+#define MC_ENC_MBEnable                          (MCPARAMID)( 4029 << 14)
+#define MC_ENC_DupEn                             (MCPARAMID)( 4030 << 14)
+#define MC_ENC_BitrateControl                    (MCPARAMID)( 4031 << 14)
+#define MC_ENC_BitrateControl_CBR                  1
+#define MC_ENC_BitrateControl_CQ                   2
+#define MC_ENC_BitrateControl_IQPQBQ               3
+#define MC_ENC_TargetBitrate                     (MCPARAMID)( 4032 << 14)
+#define MC_ENC_CBRConvergingSpeed                (MCPARAMID)( 4033 << 14)
+#define MC_ENC_Lambda                            (MCPARAMID)( 4034 << 14)
+#define MC_ENC_Q                                 (MCPARAMID)( 4035 << 14)
+#define MC_ENC_IQ                                (MCPARAMID)( 4036 << 14)
+#define MC_ENC_PQ                                (MCPARAMID)( 4037 << 14)
+#define MC_ENC_BQ                                (MCPARAMID)( 4038 << 14)
+#define MC_ENC_VBVBuffer                         (MCPARAMID)( 4039 << 14)
+#define MC_ENC_PeakBitrate                       (MCPARAMID)( 4040 << 14)
+#define MC_ENC_BitrateControl_CONSTANT_BITRATE     4
+#define MC_ENC_BitrateControl_CONSTANT_QUALITY     5
+#define MC_ENC_BitrateControl_FIXED_QUALITY        6
+#define MC_CBR_Filter                            (MCPARAMID)( 4041 << 14)
+#define MC_VBR_Filter                            (MCPARAMID)( 4042 << 14)
+#define MC_NBR_Filter                            (MCPARAMID)( 4043 << 14)
+#define MC_OutputFormat_MJPG                      12
+#define MC_ENC_Mpeg4Mode_Filter                  (MCPARAMID)( 4044 << 14)
+#define MC_CompressedStream                      (MCPARAMID)( 4045 << 14)
+#define MC_OutputFormat_Filter                   (MCPARAMID)( 4046 << 14)
+#define MC_StandardFramesPerSecond               (MCPARAMID)( 4047 << 14)
+#define MC_ENC_DropFrame                         (MCPARAMID)( 4048 << 14)
+#define MC_ENC_1001FrameRate                     (MCPARAMID)( 4049 << 14)
+#define MC_ENC_DropFrame_Fl                      (MCPARAMID)( 4050 << 14)
+#define MC_ENC_VSyncBitPlane                     (MCPARAMID)( 4051 << 14)
+#define MC_ENC_FingerprintEnable                 (MCPARAMID)( 4052 << 14)
+#define MC_ENC_Quality                           (MCPARAMID)( 4053 << 14)
+#define MC_ENC_Quality2Q                         (MCPARAMID)( 4054 << 14)
+#define MC_DirectShowSupport                     (MCPARAMID)( 4055 << 14)
+#define MC_DirectShowSupport_TRUE                  1
+#define MC_DirectShowSupport_FALSE                 2
+#define MC__HSyncOffsetGate_S                    (MCPARAMID)( 4056 << 14)
+#define MC_HSyncOffsetGate_S                     (MCPARAMID)( 4057 << 14)
+#define MC__HSyncDly_S                           (MCPARAMID)( 4058 << 14)
+#define MC_HSyncDly_S                            (MCPARAMID)( 4059 << 14)
+#define MC__TransferredScaleX                    (MCPARAMID)( 4060 << 14)
+#define MC_VideoLane                             (MCPARAMID)( 4061 << 14)
+#define MC_ScaleX512                             (MCPARAMID)( 4062 << 14)
+#define MC__TransferredScaleX512                 (MCPARAMID)( 4063 << 14)
+#define MC_ScaleX1000                            (MCPARAMID)( 4064 << 14)
+#define MC_ENC_Mpeg4RepeatSeqHead                (MCPARAMID)( 4065 << 14)
+#define MC_ColorFormat_DX50                       78
+#define MC_ColorFormat_MP4S                       79
+#define MC_ScaleY256                             (MCPARAMID)( 4066 << 14)
+#define MC_ScaleY1000                            (MCPARAMID)( 4067 << 14)
+#define MC_ScaleY128                             (MCPARAMID)( 4068 << 14)
+#define MC__TransferredImageSizeY                (MCPARAMID)( 4069 << 14)
+#define MC__EndOfImageHeight                     (MCPARAMID)( 4070 << 14)
+#define MC_FilterDly_ns                          (MCPARAMID)( 4071 << 14)
+#define MC__VSyncSearchWindowLeft_TT             (MCPARAMID)( 4072 << 14)
+#define MC__VSyncSearchWindowRight_TT            (MCPARAMID)( 4073 << 14)
+#define MC__RoundHSyncDly_S                      (MCPARAMID)( 4074 << 14)
+#define MC_BufferOffset                          (MCPARAMID)( 4075 << 14)
+#define MC_OutputFormat_DX50                      13
+#define MC_OutputFormat_MP4S                      14
+#define MC_VideoBusIdx                           (MCPARAMID)( 4076 << 14)
+#define MC_I2cBusIdx                             (MCPARAMID)( 4077 << 14)
+#define MC_UnreleasedFeatureFiltering            (MCPARAMID)( 4078 << 14)
+#define MC_UnreleasedFeatureFiltering_YES          1
+#define MC_UnreleasedFeatureFiltering_NO           2
+#define MC_TrigDelay_us_Filter                   (MCPARAMID)( 4079 << 14)
+#define MC_Even                                  (MCPARAMID)( 4080 << 14)
+#define MC_Even_UP                                 1
+#define MC_Even_DOWN                               2
+#define MC_Odd                                   (MCPARAMID)( 4081 << 14)
+#define MC_Odd_UP                                  1
+#define MC_Odd_DOWN                                2
+#define MC_HReference_Filter                     (MCPARAMID)( 4082 << 14)
+#define MC_VReference_Filter                     (MCPARAMID)( 4083 << 14)
+#define MC_HdriveLine_Filter                     (MCPARAMID)( 4084 << 14)
+#define MC_VdriveLine_Filter                     (MCPARAMID)( 4085 << 14)
+#define MC_ResetLine_Filter                      (MCPARAMID)( 4086 << 14)
+#define MC_AuxResetLine_Filter                   (MCPARAMID)( 4087 << 14)
+#define MC_HsyncLine_Filter                      (MCPARAMID)( 4088 << 14)
+#define MC_VsyncLine_Filter                      (MCPARAMID)( 4089 << 14)
+#define MC_CsyncLine_Filter                      (MCPARAMID)( 4090 << 14)
+#define MC_PinCC1_PinCC2_Style_DIFF                3
+#define MC_PinCC3_PinCC4_Style_DIFF                3
+#define MC_CameraControlSignalSet_CSYNC           11
+#define MC_CameraControlSignalSet_HSYNC           12
+#define MC_CameraControlSignalSet_CSYNC_VSYNC     13
+#define MC_CameraControlSignalSet_HSYNC_VSYNC     14
+#define MC_CameraControlSignalSet_HDRIVE          15
+#define MC_CameraControlSignalSet_HDRIVE_VSYNC    16
+#define MC_CameraControlSignalSet_RESET_HSYNC_VSYNC  17
+#define MC_CameraControlSignalSet_VSYNC           18
+#define MC_ENC_1001FrameRate_Fl                  (MCPARAMID)( 4091 << 14)
+#define MC_ENC_OutputWidth                       (MCPARAMID)( 4092 << 14)
+#define MC_ENC_OutputHeight                      (MCPARAMID)( 4093 << 14)
+#define MC__SurfaceCount                         (MCPARAMID)( 4094 << 14)
+#define MC_NoblackWindowHeight_Ln                (MCPARAMID)( 4095 << 14)
+#define MC_NoblackWindowOffset_Ln                (MCPARAMID)( 4096 << 14)
+#define MC_ENC_FrameDur_ms                       (MCPARAMID)( 4097 << 14)
+#define MC_ENC_FrameDur_ms_Fl                    (MCPARAMID)( 4098 << 14)
+#define MC_ENC_FrameDur_us                       (MCPARAMID)( 4099 << 14)
+#define MC_ENC_FrameDur_us_Fl                    (MCPARAMID)( 4100 << 14)
+#define MC_PixelClkLine_Filter                   (MCPARAMID)( 4101 << 14)
+#define MC_ENC_HSubOffset                        (MCPARAMID)( 4102 << 14)
+#define MC_ENC_HScaleFactor                      (MCPARAMID)( 4103 << 14)
+#define MC_ENC_VScaleFactor                      (MCPARAMID)( 4104 << 14)
+#define MC_ENC_VSubOffset                        (MCPARAMID)( 4105 << 14)
+#define MC_BitrateControl                        (MCPARAMID)( 4106 << 14)
+#define MC_BitrateControl_CBR                      1
+#define MC_BitrateControl_VBR                      2
+#define MC_BitrateControl_Filter                 (MCPARAMID)( 4107 << 14)
+#define MC_AverageBitrate                        (MCPARAMID)( 4108 << 14)
+#define MC_AverageBitrate_Filter                 (MCPARAMID)( 4109 << 14)
+#define MC_VideoQuality                          (MCPARAMID)( 4110 << 14)
+#define MC_VideoQuality_Filter                   (MCPARAMID)( 4111 << 14)
+#define MC__Category_Compression                  45
+#define MC__AverageBitrateFeedback               (MCPARAMID)( 4112 << 14)
+#define MC_SequenceMode                          (MCPARAMID)( 4113 << 14)
+#define MC_SequenceMode_IONLY                      1
+#define MC_SequenceMode_IPONLY                     2
+#define MC_SequenceMode_IPB                        3
+#define MC_SequenceMode_Filter                   (MCPARAMID)( 4114 << 14)
+#define MC_KeyFrameInterval                      (MCPARAMID)( 4115 << 14)
+#define MC_KeyFrameInterval_Filter               (MCPARAMID)( 4116 << 14)
+#define MC_CaptureRegionYSize_Ln                 (MCPARAMID)( 4117 << 14)
+#define MC_GopSize                               (MCPARAMID)( 4118 << 14)
+#define MC_GopSize_Filter                        (MCPARAMID)( 4119 << 14)
+#define MC_CaptureRegionXSize_Px                 (MCPARAMID)( 4120 << 14)
+#define MC_ContrastSliderSlope1                  (MCPARAMID)( 4121 << 14)
+#define MC_ObjectName_Slope                      (MCPARAMID)( 4122 << 14)
+#define MC_Contrast_Slope                        (MCPARAMID)( 4123 << 14)
+#define MC_Contrast_Offset                       (MCPARAMID)( 4124 << 14)
+#define MC_Saturation_Slope                      (MCPARAMID)( 4125 << 14)
+#define MC_Saturation_Offset                     (MCPARAMID)( 4126 << 14)
+#define MC_Brightness_Slope                      (MCPARAMID)( 4127 << 14)
+#define MC_Brightness_Offset                     (MCPARAMID)( 4128 << 14)
+#define MC_SubChIdx                              (MCPARAMID)( 4129 << 14)
+#define MC_VHSync                                (MCPARAMID)( 4130 << 14)
+#define MC_VHSync_NO                               1
+#define MC_VHSync_YES                              2
+#define MC_CXEND_Record                          (MCPARAMID)( 4131 << 14)
+#define MC_FRONTEND_Record                       (MCPARAMID)( 4132 << 14)
+#define MC_CXEND_Signature                       (MCPARAMID)( 4133 << 14)
+#define MC_FRONTEND_Signature                    (MCPARAMID)( 4134 << 14)
+#define MC__FRONTEND_Condition                   (MCPARAMID)( 4135 << 14)
+#define MC__CXEND_Condition                      (MCPARAMID)( 4136 << 14)
+#define MC_TargetFrameRate_Hz_Feedback           (MCPARAMID)( 4137 << 14)
+#define MC_CameraControlSignalSet_RESET_HSYNC     19
+#define MC_MaxAnalysisLead                       (MCPARAMID)( 4138 << 14)
+#define MC__MaxAnalysisLead                      (MCPARAMID)( 4139 << 14)
+#define MC__SamplingBufferSize_Ln                (MCPARAMID)( 4140 << 14)
+#define MC__Category_Master_Sync_Control          46
+#define MC_ConnectorCheckSet                     (MCPARAMID)( 4141 << 14)
+#define MC_VideoBridgeCheckSet                   (MCPARAMID)( 4142 << 14)
+#define MC_VrefAft_Ln                            (MCPARAMID)( 4143 << 14)
+#define MC_Vsync2Vref_H                          (MCPARAMID)( 4144 << 14)
+#define MC_Effective_TrigDelay_100ns             (MCPARAMID)( 4145 << 14)
+#define MC__EXPOn2STROff_100ns                   (MCPARAMID)( 4146 << 14)
+#define MC__STDUR_100ns                          (MCPARAMID)( 4147 << 14)
+#define MC__STPOS_DSB_100ns                      (MCPARAMID)( 4148 << 14)
+#define MC__STPOS_ASB_100ns                      (MCPARAMID)( 4149 << 14)
+#define MC_VideoTerminator                       (MCPARAMID)( 4150 << 14)
+#define MC_VideoTerminator_OFF                     1
+#define MC_VideoTerminator_ON                      2
+#define MC_VideoTerminator_JUMPER                  3
+#define MC_GopStructure                          (MCPARAMID)( 4151 << 14)
+#define MC_GopStructure_IONLY                      1
+#define MC_GopStructure_IPONLY                     2
+#define MC_GopStructure_IPB                        3
+#define MC_GopStructure_Filter                   (MCPARAMID)( 4152 << 14)
+#define MC_BCC_VideoOutputSelector               (MCPARAMID)( 4153 << 14)
+#define MC_VideoOuputSelection                   (MCPARAMID)( 4154 << 14)
+#define MC_VideoOuputSelection_VID1                1
+#define MC_VideoOuputSelection_VID2                2
+#define MC_VideoOuputSelection_VID3                3
+#define MC_VideoOuputSelection_VID4                4
+#define MC_VideoOuputSelection_CASCADE             5
+#define MC_VideoOutputSelection                  (MCPARAMID)( 4155 << 14)
+#define MC_VideoOutputSelection_VID1               1
+#define MC_VideoOutputSelection_VID2               2
+#define MC_VideoOutputSelection_VID3               3
+#define MC_VideoOutputSelection_VID4               4
+#define MC_VideoOutputSelection_CASCADE            5
+#define MC_DetectedSignalStrength                (MCPARAMID)( 4156 << 14)
+#define MC_DetectedSignalStrength_NORMAL           1
+#define MC_DetectedSignalStrength_HIGH             2
+#define MC_DetectedSignalStrength_LOW              3
+#define MC_PinSMIO1_Source_STROBE_INV              5
+#define MC_PinSMIO2_Source_STROBE_INV              5
+#define MC_PinSTX_Source_ON                        5
+#define MC_PinSTX_Source_OFF                       6
+#define MC_PinSTY_Source_ON                        5
+#define MC_PinSTY_Source_OFF                       6
+#define MC_PinSMIO3_Source_STROBE_INV              5
+#define MC_PinSMIO4_Source_STROBE_INV              5
+#define MC_StrobeLevel_Filter                    (MCPARAMID)( 4157 << 14)
+#define MC_Hactive_Nominal_Px                    (MCPARAMID)( 4158 << 14)
+#define MC_DetectedSignalStrength_TOO_HIGH         4
+#define MC_DetectedSignalStrength_TOO_LOW          5
+#define MC_BEC_SrcCAPM_CUp                         3
+#define MC_BEC_SrcCAPM_CDown                       4
+#define MC_FEC_CAPM_CUp                            3
+#define MC_FEC_CAPM_CDown                          4
+#define MC__DelayedStandardFrameRate_Hz          (MCPARAMID)( 4159 << 14)
+#define MC__Delayed_WindowY_Ln                   (MCPARAMID)( 4160 << 14)
+#define MC_InputState_DISCONNECTED                 6
+#define MC_FEC_SWITCH                            (MCPARAMID)( 4161 << 14)
+#define MC_FEC_SWITCH_Forbidden                    1
+#define MC_FEC_SWITCH_Allowed                      2
+#define MC__ImageSizeX                           (MCPARAMID)( 4162 << 14)
+#define MC__ImageSizeY                           (MCPARAMID)( 4163 << 14)
+#define MC__RFields                              (MCPARAMID)( 4164 << 14)
+#define MC__AverageBitratePoints                 (MCPARAMID)( 4165 << 14)
+#define MC__DownScalingFactor                    (MCPARAMID)( 4166 << 14)
+#define MC__AvgBitrateRedFactor                  (MCPARAMID)( 4167 << 14)
+#define MC___AvgBitrateRedFactor                 (MCPARAMID)( 4168 << 14)
+#define MC_HardwareTriggerNeeded                 (MCPARAMID)( 4169 << 14)
+#define MC_HardwareTriggerNeeded_NO                1
+#define MC_HardwareTriggerNeeded_YES               2
+#define MC_CaptureStrategy                       (MCPARAMID)( 4170 << 14)
+#define MC_CaptureStrategy_SPEED                   1
+#define MC_CaptureStrategy_UNITY                   2
+#define MC_ResolutionXMinRule                    (MCPARAMID)( 4171 << 14)
+#define MC_ResolutionYMinRule                    (MCPARAMID)( 4172 << 14)
+#define MC_ENC_HCropping                         (MCPARAMID)( 4173 << 14)
+#define MC_ENC_HCropping_YES                       1
+#define MC_ENC_HCropping_NO                        2
+#define MC_ENC_VCropping                         (MCPARAMID)( 4174 << 14)
+#define MC_ENC_VCropping_YES                       1
+#define MC_ENC_VCropping_NO                        2
+#define MC_ENC_LastLine                          (MCPARAMID)( 4175 << 14)
+#define MC_CameraControlSignalSet_UNAVAILABLE     20
+#define MC_CameraControlSignalSet_UNAVAILABLE_PxxRA_M  21
+#define MC_CameraControlSignalSet_UNAVAILABLE_PxxRM_1  22
+#define MC_CameraControlSignalSet_UNAVAILABLE_PxxRM_2  23
+#define MC__RST_100ns                            (MCPARAMID)( 4176 << 14)
+#define MC__RST_E                                (MCPARAMID)( 4177 << 14)
+#define MC_HID                                   (MCPARAMID)( 4178 << 14)
+#define MC_VID                                   (MCPARAMID)( 4179 << 14)
+#define MC_HVID                                  (MCPARAMID)( 4180 << 14)
+#define MC_VrefSearchWindowLeft_ms               (MCPARAMID)( 4181 << 14)
+#define MC_VrefSearchWindowRight_ms              (MCPARAMID)( 4182 << 14)
+#define MC_Vsync2Vref_ms                         (MCPARAMID)( 4183 << 14)
+#define MC_VSyncSearchWindowLeft_ms              (MCPARAMID)( 4184 << 14)
+#define MC_VSyncSearchWindowRight_ms             (MCPARAMID)( 4185 << 14)
+#define MC_StandardFrameRate_mHz_Int             (MCPARAMID)( 4186 << 14)
+#define MC_StandardFrameRate_Hz_Int              (MCPARAMID)( 4187 << 14)
+#define MC__VideoDecoderType                     (MCPARAMID)( 4188 << 14)
+#define MC__VideoDecoderType_D3                    1
+#define MC__VideoDecoderType_CLASSIC               2
+#define MC_CaptureRate_1                         (MCPARAMID)( 4189 << 14)
+#define MC_CaptureRate_10                        (MCPARAMID)( 4190 << 14)
+#define MC_CaptureRate_11                        (MCPARAMID)( 4191 << 14)
+#define MC_CaptureRate_12                        (MCPARAMID)( 4192 << 14)
+#define MC_CaptureRate_8                         (MCPARAMID)( 4193 << 14)
+#define MC_CaptureRate_3                         (MCPARAMID)( 4194 << 14)
+#define MC_CaptureRate_4                         (MCPARAMID)( 4195 << 14)
+#define MC_CaptureRate_5                         (MCPARAMID)( 4196 << 14)
+#define MC_CaptureRate_7                         (MCPARAMID)( 4197 << 14)
+#define MC_CaptureRate_6                         (MCPARAMID)( 4198 << 14)
+#define MC_CaptureRate_2                         (MCPARAMID)( 4199 << 14)
+#define MC_CaptureRate_9                         (MCPARAMID)( 4200 << 14)
+#define MC_HCsyncBfr_Px                          (MCPARAMID)( 4201 << 14)
+#define MC_HCsyncAft_Px                          (MCPARAMID)( 4202 << 14)
+#define MC_VideoSlewTime_ns                      (MCPARAMID)( 4203 << 14)
+#define MC__LeftMargin_Max_1000                  (MCPARAMID)( 4204 << 14)
+#define MC__TopMargin_Max_1000                   (MCPARAMID)( 4205 << 14)
+#define MC__CaptureRateControl                   (MCPARAMID)( 4206 << 14)
+#define MC_SignalStrength                        (MCPARAMID)( 4207 << 14)
+#define MC_SignalStrength_NORMAL                   1
+#define MC_SignalStrength_STRONG                   2
+#define MC_SignalStrength_WEAK                     3
+#define MC_SignalStrength_TOO_STRONG               4
+#define MC_SignalStrength_TOO_WEAK                 5
+#define MC__FPGA_Model_HARMONY_3_1                 4
+#define MC_MicroBlazeIx                          (MCPARAMID)( 4208 << 14)
+#define MC_InputFunction_FREE                     15
+#define MC_InputFunction_RESERVED                 16
+#define MC_InputState_OPEN                         7
+#define MC_InputStyle_AUTO                         9
+#define MC_InputStyle_RELAY                       10
+#define MC_InputStyle_5V                          11
+#define MC_InputStyle_12V                         12
+#define MC_InputFilter_FILTER_10ms                 6
+#define MC_InputFilter_FILTER_100ms                7
+#define MC_OutputFunction_FREE                    15
+#define MC_OutputStyle_SSRLY                      11
+#define MC_ConnectorName_PROFESSIONAL_IO          27
+#define MC_WatchdogResetsCount_OLD               (MCPARAMID)( 4209 << 14)
+#define MC_StartupTimeout_128ms                  (MCPARAMID)( 4210 << 14)
+#define MC_ApplicationTimeout_128ms              (MCPARAMID)( 4211 << 14)
+#define MC_GainY_VB                              (MCPARAMID)( 4212 << 14)
+#define MC_GainU_VB                              (MCPARAMID)( 4213 << 14)
+#define MC_GainV_VB                              (MCPARAMID)( 4214 << 14)
+#define MC_Offset_VB                             (MCPARAMID)( 4215 << 14)
+#define MC_GainY_CX                              (MCPARAMID)( 4216 << 14)
+#define MC_GainU_CX                              (MCPARAMID)( 4217 << 14)
+#define MC_GainV_CX                              (MCPARAMID)( 4218 << 14)
+#define MC_Offset_CX                             (MCPARAMID)( 4219 << 14)
+#define MC__SIZY_PerField                        (MCPARAMID)( 4220 << 14)
+#define MC__Tk_X_Px                              (MCPARAMID)( 4221 << 14)
+#define MC__Category__ADR_Process                 47
+#define MC__ADR_GrabSizeX_Component              (MCPARAMID)( 4222 << 14)
+#define MC_OffsetY_VB                            (MCPARAMID)( 4223 << 14)
+#define MC_OffsetY_CX                            (MCPARAMID)( 4224 << 14)
+#define MC_GainY_AfterCX                         (MCPARAMID)( 4225 << 14)
+#define MC_GainY_AfterVB                         (MCPARAMID)( 4226 << 14)
+#define MC_GainU_AfterCX                         (MCPARAMID)( 4227 << 14)
+#define MC_GainU_AfterVB                         (MCPARAMID)( 4228 << 14)
+#define MC_GainV_AfterCX                         (MCPARAMID)( 4229 << 14)
+#define MC_GainV_AfterVB                         (MCPARAMID)( 4230 << 14)
+#define MC_OffsetY_AfterCX                       (MCPARAMID)( 4231 << 14)
+#define MC_OffsetY_AfterVB                       (MCPARAMID)( 4232 << 14)
+#define MC__GainY_AfterCX                        (MCPARAMID)( 4233 << 14)
+#define MC__GainY_AfterVB                        (MCPARAMID)( 4234 << 14)
+#define MC__GainU_AfterCX                        (MCPARAMID)( 4235 << 14)
+#define MC__GainU_AfterVB                        (MCPARAMID)( 4236 << 14)
+#define MC__GainV_AfterCX                        (MCPARAMID)( 4237 << 14)
+#define MC__GainV_AfterVB                        (MCPARAMID)( 4238 << 14)
+#define MC__OffsetY_AfterCX                      (MCPARAMID)( 4239 << 14)
+#define MC__OffsetY_AfterVB                      (MCPARAMID)( 4240 << 14)
+#define MC__CSIO_CSIO1Out_LOW                      8
+#define MC__CSIO_CSIO2Out_LOW                      8
+#define MC__CSIO_CSIO3Out_LOW                      8
+#define MC__CSIO_CSIO4Out_LOW                      8
+#define MC__STR_SREF                             (MCPARAMID)( 4241 << 14)
+#define MC__STR_SREF_TSB                           1
+#define MC__STR_SREF_CSB                           2
+#define MC_TrigEdge_Filter                       (MCPARAMID)( 4242 << 14)
+#define MC_EndTrigEdge_Filter                    (MCPARAMID)( 4243 << 14)
+#define MC_Camera_CAMERA_sPAL                    214
+#define MC_Camera_CAMERA_sNTSC                   215
+#define MC_Camera_CAMERA_sCCIR                   216
+#define MC_Camera_CAMERA_sEIA                    217
+#define MC_Standard_sPAL                           7
+#define MC_Standard_sNTSC                          8
+#define MC_FEC_VSTD_sPAL_SQ                        9
+#define MC_FEC_VSTD_sNTSC_SQ                      10
+#define MC_FEC_VSTD_sPAL_BROAD                    11
+#define MC_FEC_VSTD_sNTSC_BROAD                   12
+#define MC_Board_Name                            (MCPARAMID)( 4244 << 14)
+#define MC_Board_Name_Unknown                      1
+#define MC_Board_Name_Alert                        2
+#define MC_Board_Name_Diligent                     3
+#define MC_Board_Family                          (MCPARAMID)( 4245 << 14)
+#define MC_Board_Family_Unknown                    1
+#define MC_CaptureStrategy_Filter                (MCPARAMID)( 4246 << 14)
+#define MC__VBC_LBFR_GEOM                        (MCPARAMID)( 4247 << 14)
+#define MC_LUT_Filter                            (MCPARAMID)( 4248 << 14)
+#define MC_LUT_nbr                               (MCPARAMID)( 4249 << 14)
+#define MC__ImageSizeX_Interface                 (MCPARAMID)( 4250 << 14)
+#define MC__ImageSizeY_Interface                 (MCPARAMID)( 4251 << 14)
+#define MC_WhiteCrush                            (MCPARAMID)( 4252 << 14)
+#define MC_WhiteCrush_ON                           1
+#define MC_WhiteCrush_OFF                          2
+#define MC__BoardType__PICOLO_TYMO                29
+#define MC_Connector_YC1                         124
+#define MC_Connector_YC2                         125
+#define MC_Connector_YC3                         126
+#define MC_Connector_YC4                         127
+#define MC_VideoOutputSelection_VID5               6
+#define MC_VideoOutputSelection_VID6               7
+#define MC_VideoOutputSelection_VID7               8
+#define MC_VideoOutputSelection_VID8               9
+#define MC_VideoOutputSelection_VID9              10
+#define MC_VideoOutputSelection_VID10             11
+#define MC_VideoOutputSelection_VID11             12
+#define MC_VideoOutputSelection_VID12             13
+#define MC_VideoOutputSelection_VID13             14
+#define MC_VideoOutputSelection_VID14             15
+#define MC_VideoOutputSelection_VID15             16
+#define MC_VideoOutputSelection_VID16             17
+#define MC__Range                                (MCPARAMID)( 4253 << 14)
+#define MC__NormalContrast                       (MCPARAMID)( 4254 << 14)
+#define MC_AutoAgc                               (MCPARAMID)( 4255 << 14)
+#define MC_AutoAgc_ENABLED                         1
+#define MC_AutoAgc_DISABLED                        2
+#define MC_AutoVga                               (MCPARAMID)( 4256 << 14)
+#define MC_AutoVga_ENABLED                         1
+#define MC_AutoVga_DISABLED                        2
+#define MC__CDC_MTAP_OneTimeSlot                   3
+#define MC__CDC_MTAP_TwoTimeSlots_MultiplexedBits   4
+#define MC__CDC_MTAP_TwoTimeSlots_MultiplexedTaps   5
+#define MC__CDC_MTAP_ThreeTimeSlots_MultiplexedTaps   6
+#define MC__CDC_ALIGN_Bit8                         4
+#define MC__CDC_ALIGN_Bit10                        5
+#define MC__CDC_ALIGN_Bit12                        6
+#define MC__CDC_ALIGN_Bit14                        7
+#define MC__CDC_ALIGN_Bit16                        8
+#define MC__CDA_TRAIL_LD                         (MCPARAMID)( 4257 << 14)
+#define MC__CDA_LEAD1                            (MCPARAMID)( 4258 << 14)
+#define MC__CDA_TRAIL_INI1                       (MCPARAMID)( 4259 << 14)
+#define MC_TRAIL_MODULO                          (MCPARAMID)( 4260 << 14)
+#define MC__CDA_LEAD2                            (MCPARAMID)( 4261 << 14)
+#define MC__CDA_TRAIL_INI2                       (MCPARAMID)( 4262 << 14)
+#define MC__CDA_LEAD3                            (MCPARAMID)( 4263 << 14)
+#define MC__CDA_TRAIL_INI3                       (MCPARAMID)( 4264 << 14)
+#define MC__CDA_LEAD4                            (MCPARAMID)( 4265 << 14)
+#define MC__CDA_TRAIL_INI4                       (MCPARAMID)( 4266 << 14)
+#define MC__CDA_TRAIL_PADDING                    (MCPARAMID)( 4267 << 14)
+#define MC__CDA_TRAIL_PADDING_OneAssemblyCycle     1
+#define MC__CDA_TRAIL_PADDING_TwoAssemblyCycle     2
+#define MC_TapConfiguration                      (MCPARAMID)( 4268 << 14)
+#define MC_TapConfiguration_BASE_1T8               1
+#define MC_TapConfiguration_BASE_1T10              2
+#define MC_TapConfiguration_BASE_1T12              3
+#define MC_TapConfiguration_BASE_1T14              4
+#define MC_TapConfiguration_BASE_1T16              5
+#define MC_TapConfiguration_BASE_1T24              6
+#define MC_TapConfiguration_BASE_2T8               7
+#define MC_TapConfiguration_BASE_2T10              8
+#define MC_TapConfiguration_BASE_2T12              9
+#define MC_TapConfiguration_BASE_3T8              10
+#define MC_TapConfiguration_BASE_1T30B2           11
+#define MC_TapConfiguration_BASE_1T36B2           12
+#define MC_TapConfiguration_BASE_1T42B2           13
+#define MC_TapConfiguration_BASE_1T48B2           14
+#define MC_TapConfiguration_BASE_2T14B2           15
+#define MC_TapConfiguration_BASE_2T16B2           16
+#define MC_TapConfiguration_BASE_2T24B2           17
+#define MC_TapConfiguration_BASE_3T10B2           18
+#define MC_TapConfiguration_BASE_3T12B2           19
+#define MC_TapConfiguration_BASE_3T14B2           20
+#define MC_TapConfiguration_BASE_3T16B2           21
+#define MC_TapConfiguration_BASE_4T8B2            22
+#define MC_TapConfiguration_BASE_4T10B2           23
+#define MC_TapConfiguration_BASE_4T12B2           24
+#define MC_TapConfiguration_BASE_1T24B3           25
+#define MC_TapConfiguration_BASE_1T30B3           26
+#define MC_TapConfiguration_BASE_1T36B3           27
+#define MC_TapConfiguration_BASE_1T42B3           28
+#define MC_TapConfiguration_BASE_1T48B3           29
+#define MC_TapConfiguration_MEDIUM_1T30           30
+#define MC_TapConfiguration_MEDIUM_1T36           31
+#define MC_TapConfiguration_MEDIUM_1T42           32
+#define MC_TapConfiguration_MEDIUM_1T48           33
+#define MC_TapConfiguration_MEDIUM_2T14           34
+#define MC_TapConfiguration_MEDIUM_2T16           35
+#define MC_TapConfiguration_MEDIUM_2T24           36
+#define MC_TapConfiguration_MEDIUM_3T10           37
+#define MC_TapConfiguration_MEDIUM_3T12           38
+#define MC_TapConfiguration_MEDIUM_3T14           39
+#define MC_TapConfiguration_MEDIUM_3T16           40
+#define MC_TapConfiguration_MEDIUM_4T8            41
+#define MC_TapConfiguration_MEDIUM_4T10           42
+#define MC_TapConfiguration_MEDIUM_4T12           43
+#define MC_TapConfiguration_MEDIUM_8T8B2          44
+#define MC_TapConfiguration_FULL_8T8              45
+#define MC_TapConfiguration_Filter               (MCPARAMID)( 4269 << 14)
+#define MC__GCL_CLCFG_FULL                         3
+#define MC_WIS_DeinterlaceMode                   (MCPARAMID)( 4270 << 14)
+#define MC_WIS_DeinterlaceMode_INTERPOLATION       1
+#define MC_WIS_DeinterlaceMode_WEAVING             2
+#define MC_WIS_DeinterlaceMode_BLENDING            3
+#define MC_CL_ConfigurationClass                 (MCPARAMID)( 4271 << 14)
+#define MC_CL_ConfigurationClass_BASE              1
+#define MC_CL_ConfigurationClass_MEDIUM            2
+#define MC_CL_ConfigurationClass_FULL              3
+#define MC_CL_BitDepth                           (MCPARAMID)( 4272 << 14)
+#define MC_TapGeometry                           (MCPARAMID)( 4273 << 14)
+#define MC_TapGeometry_1X                          1
+#define MC_TapGeometry_1X2                         2
+#define MC_TapGeometry_2X                          3
+#define MC_TapGeometry_2XE                         4
+#define MC_TapGeometry_2XM                         5
+#define MC_TapGeometry_1X3                         6
+#define MC_TapGeometry_3X                          7
+#define MC_TapGeometry_1X4                         8
+#define MC_TapGeometry_4X                          9
+#define MC_TapGeometry_2X2                        10
+#define MC_TapGeometry_2X2E                       11
+#define MC_TapGeometry_2X2M                       12
+#define MC_TapGeometry_1X8                        13
+#define MC_TapGeometry_8X                         14
+#define MC_TapGeometry_4X2                        15
+#define MC_TapGeometry_1X_1Y                      16
+#define MC_TapGeometry_1X2_1Y                     17
+#define MC_TapGeometry_2X_1Y                      18
+#define MC_TapGeometry_2XE_1Y                     19
+#define MC_TapGeometry_2XM_1Y                     20
+#define MC_TapGeometry_1X_1Y2                     21
+#define MC_TapGeometry_1X_2YE                     22
+#define MC_TapGeometry_1X3_1Y                     23
+#define MC_TapGeometry_3X_1Y                      24
+#define MC_TapGeometry_1X4_1Y                     25
+#define MC_TapGeometry_4X_1Y                      26
+#define MC_TapGeometry_2X2_1Y                     27
+#define MC_TapGeometry_2X2E_1Y                    28
+#define MC_TapGeometry_2X2M_1Y                    29
+#define MC_TapGeometry_1X2_2YE                    30
+#define MC_TapGeometry_2X_2YE                     31
+#define MC_TapGeometry_2XE_2YE                    32
+#define MC_TapGeometry_2XM_2YE                    33
+#define MC_TapGeometry_1X8_1Y                     34
+#define MC_TapGeometry_8X_1Y                      35
+#define MC_TapGeometry_4X2_1Y                     36
+#define MC_TapGeometry_2X2E_2YE                   37
+#define MC_CompressionType                       (MCPARAMID)( 4274 << 14)
+#define MC_CompressionType_NONE                    1
+#define MC_CompressionType_DX50                    2
+#define MC_CompressionType_MP4S                    3
+#define MC_TapGeometry_Filter                    (MCPARAMID)( 4275 << 14)
+#define MC_CL_Tapcount                           (MCPARAMID)( 4276 << 14)
+#define MC_AssyConfig                            (MCPARAMID)( 4277 << 14)
+#define MC_AssyConfig_SINGLE                       1
+#define MC_AssyConfig_DUALXPAIR                    2
+#define MC_AssyConfig_DUALXTAP                     3
+#define MC_AssyConfig_DUALXEND                     4
+#define MC_AssyConfig_DUALXMID                     5
+#define MC_AssyConfig_DUALYPAIR                    6
+#define MC_AssyConfig_DUALYEND                     7
+#define MC_AssyConfig_TRIPLE                       8
+#define MC_AssyConfig_QUADXTAP                     9
+#define MC_AssyConfig_QUADXPAIRTAP                10
+#define MC_AssyConfig_QUADXPAIREND                11
+#define MC_AssyConfig_QUADXPAIRMID                12
+#define MC_AssyConfig_OCTALXTAP                   13
+#define MC_AssyConfig_QUADXQUAD                   14
+#define MC_AssyConfig_MEDIUM_2T24_1X2_1Y          15
+#define MC_CL_PixelComponentBitDepth             (MCPARAMID)( 4278 << 14)
+#define MC__CDC_ISIZE_BIT8                        14
+#define MC__CDC_ISIZE_BIT10                       15
+#define MC__CDC_ISIZE_BIT12                       16
+#define MC__CDC_ISIZE_BIT14                       17
+#define MC__CDC_ISIZE_BIT16                       18
+#define MC__CDC_ISIZE_BIT10T2                     19
+#define MC__CDC_ISIZE_BIT12T2                     20
+#define MC__CDC_ISIZE_BIT14T2                     21
+#define MC__CDC_ISIZE_BIT16T2                     22
+#define MC_AssyPixelComponentSize                (MCPARAMID)( 4279 << 14)
+#define MC_AssyComponentCount                    (MCPARAMID)( 4280 << 14)
+#define MC_AssyConfig_INVALID                     16
+#define MC__Category_InputDataProcessing          48
+#define MC_FifoPitchOffset                       (MCPARAMID)( 4281 << 14)
+#define MC_FifoSizeOffset                        (MCPARAMID)( 4282 << 14)
+#define MC_FifoPitch                             (MCPARAMID)( 4283 << 14)
+#define MC_FifoSize                              (MCPARAMID)( 4284 << 14)
+#define MC__Category_WindowControllers            49
+#define MC__SFA01                                (MCPARAMID)( 4285 << 14)
+#define MC__SFA02                                (MCPARAMID)( 4286 << 14)
+#define MC__SFA03                                (MCPARAMID)( 4287 << 14)
+#define MC__SFA04                                (MCPARAMID)( 4288 << 14)
+#define MC__SFA05                                (MCPARAMID)( 4289 << 14)
+#define MC__SFA06                                (MCPARAMID)( 4290 << 14)
+#define MC__SFA07                                (MCPARAMID)( 4291 << 14)
+#define MC__SFA08                                (MCPARAMID)( 4292 << 14)
+#define MC_TapConfiguration_INVALID               46
+#define MC__CDA_INDEX_MAP                        (MCPARAMID)( 4293 << 14)
+#define MC__CWR_INDEX_MAP                        (MCPARAMID)( 4294 << 14)
+#define MC__Lead_W1                              (MCPARAMID)( 4295 << 14)
+#define MC__Lead_W2                              (MCPARAMID)( 4296 << 14)
+#define MC__Lead_W3                              (MCPARAMID)( 4297 << 14)
+#define MC__Lead_W4                              (MCPARAMID)( 4298 << 14)
+#define MC__Lead_D1                              (MCPARAMID)( 4299 << 14)
+#define MC__Lead_D2                              (MCPARAMID)( 4300 << 14)
+#define MC__Lead_D3                              (MCPARAMID)( 4301 << 14)
+#define MC__Lead_D4                              (MCPARAMID)( 4302 << 14)
+#define MC__CDA_P1INDEX                          (MCPARAMID)( 4303 << 14)
+#define MC__CDA_P2INDEX                          (MCPARAMID)( 4304 << 14)
+#define MC__CDA_P3INDEX                          (MCPARAMID)( 4305 << 14)
+#define MC__CDA_P4INDEX                          (MCPARAMID)( 4306 << 14)
+#define MC__AssyPerWindow                        (MCPARAMID)( 4307 << 14)
+#define MC_CL_TimeSlots                          (MCPARAMID)( 4308 << 14)
+#define MC_ASW_1                                 (MCPARAMID)( 4309 << 14)
+#define MC__ASW_1                                (MCPARAMID)( 4310 << 14)
+#define MC__ASW_2                                (MCPARAMID)( 4311 << 14)
+#define MC__ASW_3                                (MCPARAMID)( 4312 << 14)
+#define MC__ASW_4                                (MCPARAMID)( 4313 << 14)
+#define MC__RightMargin_Px                       (MCPARAMID)( 4314 << 14)
+#define MC_FifoWindowOffsetX_Px                  (MCPARAMID)( 4315 << 14)
+#define MC_FifoWindowOffsetY_Ln                  (MCPARAMID)( 4316 << 14)
+#define MC_OffsetX_Px_MinBound                   (MCPARAMID)( 4317 << 14)
+#define MC_OffsetX_Px_MaxBound                   (MCPARAMID)( 4318 << 14)
+#define MC_OffsetY_Ln_MinBound                   (MCPARAMID)( 4319 << 14)
+#define MC_OffsetY_Ln_MaxBound                   (MCPARAMID)( 4320 << 14)
+#define MC_ImageLeadPadding                      (MCPARAMID)( 4321 << 14)
+#define MC_ImageTrailPadding                     (MCPARAMID)( 4322 << 14)
+#define MC_XferSizeX                             (MCPARAMID)( 4323 << 14)
+#define MC_BufferOffsetX                         (MCPARAMID)( 4324 << 14)
+#define MC_XferSizeY                             (MCPARAMID)( 4325 << 14)
+#define MC_BufferOffsetY                         (MCPARAMID)( 4326 << 14)
+#define MC_FifoOffsetX_Unaligned                 (MCPARAMID)( 4327 << 14)
+#define MC_FifoBufferSkew                        (MCPARAMID)( 4328 << 14)
+#define MC_FifoBufferHomeAddress                 (MCPARAMID)( 4329 << 14)
+#define MC_TrigEdge_GOOPEN                         5
+#define MC_TrigEdge_OPEN                           6
+#define MC_EndTrigEdge_GOOPEN                      5
+#define MC_EndTrigEdge_OPEN                        6
+#define MC__PllMax                               (MCPARAMID)( 4330 << 14)
+#define MC__PllMaxOffset                         (MCPARAMID)( 4331 << 14)
+#define MC_MltpLineAnlShift                      (MCPARAMID)( 4332 << 14)
+#define MC_WoiOrgX                               (MCPARAMID)( 4333 << 14)
+#define MC_WOI_GrabWindow_Filter                 (MCPARAMID)( 4334 << 14)
+#define MC_WoiOrgY                               (MCPARAMID)( 4335 << 14)
+#define MC_WoiWidth                              (MCPARAMID)( 4336 << 14)
+#define MC_WoiHeight                             (MCPARAMID)( 4337 << 14)
+#define MC_CameraWoiBankSetup                    (MCPARAMID)( 4338 << 14)
+#define MC_CameraWoiBankSelect                   (MCPARAMID)( 4339 << 14)
+#define MC_GrabWindow_WOI                          6
+#define MC_GrabWindow_Filter                     (MCPARAMID)( 4340 << 14)
+#define MC__Category_CLCAM_Interface              50
+#define MC_CLCAM_Topology                        (MCPARAMID)( 4341 << 14)
+#define MC_CLCAM_Topology_SINGLE                   1
+#define MC_CLCAM_Topology_DUALXPAIR                2
+#define MC_CLCAM_Topology_DUALXTAP                 3
+#define MC_CLCAM_Topology_DUALXEND                 4
+#define MC_CLCAM_Topology_DUALXMID                 5
+#define MC_CLCAM_Topology_DUALYPAIR                6
+#define MC_CLCAM_Topology_DUALYEND                 7
+#define MC_CLCAM_Topology_TRIPLE                   8
+#define MC_CLCAM_Topology_QUADXTAP                 9
+#define MC_CLCAM_Topology_QUADXPAIRTAP            10
+#define MC_CLCAM_Topology_QUADXPAIREND            11
+#define MC_CLCAM_Topology_QUADXPAIRMID            12
+#define MC_CLCAM_Topology_TRIPLEXPAIR             13
+#define MC_CLCAM_DataWidth                       (MCPARAMID)( 4342 << 14)
+#define MC_CLCAM_ClockFreq_KHz                   (MCPARAMID)( 4343 << 14)
+#define MC_CLCAM_FramePeriod                     (MCPARAMID)( 4344 << 14)
+#define MC_CLCAM_FrameBlanking                   (MCPARAMID)( 4345 << 14)
+#define MC_CLCAM_LinePeriod                      (MCPARAMID)( 4346 << 14)
+#define MC_CLCAM_LineBlanking                    (MCPARAMID)( 4347 << 14)
+#define MC_CLCAM_LineInitialdelay                (MCPARAMID)( 4348 << 14)
+#define MC_CLCAM_LineCount                       (MCPARAMID)( 4349 << 14)
+#define MC_CLCAM_DataInitialDelay                (MCPARAMID)( 4350 << 14)
+#define MC_CLCAM_Databurst                       (MCPARAMID)( 4351 << 14)
+#define MC_CLCAM_DataBurstGap                    (MCPARAMID)( 4352 << 14)
+#define MC_CLCAM_DataBurstCount                  (MCPARAMID)( 4353 << 14)
+#define MC_CLCAM_DataGating                      (MCPARAMID)( 4354 << 14)
+#define MC_CLCAM_LVALNone                        (MCPARAMID)( 4355 << 14)
+#define MC_CLCAM_FVALNone                        (MCPARAMID)( 4356 << 14)
+#define MC_CLCAM_DataIncrement                   (MCPARAMID)( 4357 << 14)
+#define MC_CLCAM_DataArrangement                 (MCPARAMID)( 4358 << 14)
+#define MC_CLCAM_OPModeFreeRun                   (MCPARAMID)( 4359 << 14)
+#define MC_CLCAM_OPModeExpWidth                  (MCPARAMID)( 4360 << 14)
+#define MC_CLCAM_AsyncResetPin                   (MCPARAMID)( 4361 << 14)
+#define MC_CLCAM_Power                           (MCPARAMID)( 4362 << 14)
+#define MC_MaxWoiBanks                           (MCPARAMID)( 4363 << 14)
+#define MC_MaxWoiPerBank                         (MCPARAMID)( 4364 << 14)
+#define MC_WoiGranularity                        (MCPARAMID)( 4365 << 14)
+#define MC_ComponentStorageOrder                 (MCPARAMID)( 4366 << 14)
+#define MC_ComponentStorageOrder_DIRECT            1
+#define MC_ComponentStorageOrder_REVERSE           2
+#define MC_InputFilter_OFF                         8
+#define MC_WoiMinWidth                           (MCPARAMID)( 4367 << 14)
+#define MC_WoiMaxWidth                           (MCPARAMID)( 4368 << 14)
+#define MC_WoiMinHeight                          (MCPARAMID)( 4369 << 14)
+#define MC_WoiMaxHeight                          (MCPARAMID)( 4370 << 14)
+#define MC_TrigCtl_AUTO                            9
+#define MC_TrigCtl_RELAY                          10
+#define MC_TrigCtl_5V                             11
+#define MC_TrigCtl_12V                            12
+#define MC_TrigFilter_FILTER_10ms                  5
+#define MC_TrigFilter_FILTER_100ms                 6
+#define MC_EndTrigCtl_AUTO                         5
+#define MC_EndTrigCtl_RELAY                        6
+#define MC_EndTrigCtl_5V                           7
+#define MC_EndTrigCtl_12V                          8
+#define MC_EndTrigFilter_FILTER_10ms               5
+#define MC_EndTrigFilter_FILTER_100ms              6
+#define MC_WoiSaveMemoryBank                     (MCPARAMID)( 4371 << 14)
+#define MC_WoiSaveMemoryBank_YES                   1
+#define MC_WoiSaveMemoryBank_NO                    2
+#define MC_WoiSaveMemoryBankAfterWoiBankSetup    (MCPARAMID)( 4372 << 14)
+#define MC_WoiSaveMemoryBankAfterWoiBankSetup_YES   1
+#define MC_WoiSaveMemoryBankAfterWoiBankSetup_NO   2
+#define MC_SaveMemoryBank                        (MCPARAMID)( 4373 << 14)
+#define MC_SaveMemoryBank_YES                      1
+#define MC_SaveMemoryBank_NO                       2
+#define MC__CDA_LEADASSYNR1                      (MCPARAMID)( 4374 << 14)
+#define MC__CDA_LEADASSYNR2                      (MCPARAMID)( 4375 << 14)
+#define MC__CDA_LEADASSYNR3                      (MCPARAMID)( 4376 << 14)
+#define MC__CDA_LEADASSYNR4                      (MCPARAMID)( 4377 << 14)
+#define MC__CDA_REFASSYNR1                       (MCPARAMID)( 4378 << 14)
+#define MC__CDA_REFASSYNR2                       (MCPARAMID)( 4379 << 14)
+#define MC__CDA_REFASSYNR3                       (MCPARAMID)( 4380 << 14)
+#define MC__CDA_REFASSYNR4                       (MCPARAMID)( 4381 << 14)
+#define MC_CheckRamp_DataIncrement               (MCPARAMID)( 4382 << 14)
+#define MC_DefaultConnector                      (MCPARAMID)( 4383 << 14)
+#define MC_DefaultConnector_M                      1
+#define MC_DefaultConnector_A                      2
+#define MC_DefaultConnector_B                      3
+#define MC___MSFError_Check_Filter               (MCPARAMID)( 4384 << 14)
+#define MC_CLCAM_TapMultiplexingMode             (MCPARAMID)( 4385 << 14)
+#define MC_CLCAM_TapMultiplexingMode_OneTimeSlot   1
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_MultiplexedBits   2
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_MultiplexedTaps   3
+#define MC_CLCAM_TapMultiplexingMode_ThreeTimeSlots_MultiplexedTaps   4
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_TwoMultiplexedTaps   5
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_FourMultiplexedTaps   6
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_SixMultiplexedTaps   7
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_EightMultiplexedTaps   8
+#define MC__CDC_MTAP_TwoTimeSlots_TwoMultiplexedTaps   7
+#define MC__CDC_MTAP_TwoTimeSlots_FourMultiplexedTaps   8
+#define MC__CDC_MTAP_TwoTimeSlots_SixMultiplexedTaps   9
+#define MC__CDC_MTAP_TwoTimeSlots_EightMultiplexedTaps  10
+#define MC_CLCAM_Geometry                        (MCPARAMID)( 4386 << 14)
+#define MC_CLCAM_Geometry_TG_1X                    1
+#define MC_CLCAM_Geometry_TG_1X2                   2
+#define MC_CLCAM_Geometry_TG_2X                    3
+#define MC_CLCAM_Geometry_TG_2XE                   4
+#define MC_CLCAM_Geometry_TG_2XM                   5
+#define MC_CLCAM_Geometry_TG_1X_1Y2                6
+#define MC_CLCAM_Geometry_TG_1X_2YE                7
+#define MC_CLCAM_Geometry_TG_1X3                   8
+#define MC_CLCAM_Geometry_TG_3X                    9
+#define MC_CLCAM_Geometry_TG_1X4                  10
+#define MC_CLCAM_Geometry_TG_4X                   11
+#define MC_CLCAM_Geometry_TG_2X2                  12
+#define MC_CLCAM_Geometry_TG_2X2E                 13
+#define MC_CLCAM_Geometry_TG_2X2M                 14
+#define MC_CLCAM_Geometry_TG_1X2_2YE              15
+#define MC_CLCAM_Geometry_TG_2X_2YE               16
+#define MC_CLCAM_Geometry_TG_2XE_2YE              17
+#define MC_CLCAM_Geometry_TG_2XM_2YE              18
+#define MC_CLCAM_Geometry_TG_1X8                  19
+#define MC_CLCAM_Geometry_TG_8X                   20
+#define MC_CLCAM_Geometry_TG_4X2                  21
+#define MC_CLCAM_Geometry_TG_2X2E_2YE             22
+#define MC_ActiveDroopCompensation               (MCPARAMID)( 4387 << 14)
+#define MC_ActiveDroopCompensation_ENABLED         1
+#define MC_ActiveDroopCompensation_DISABLED        2
+#define MC_AnalogClamping                        (MCPARAMID)( 4388 << 14)
+#define MC_AnalogClamping_ENABLED                  1
+#define MC_AnalogClamping_DISABLED                 2
+#define MC_PhaseRate_AbsoluteUpperLimit_mHz      (MCPARAMID)( 4389 << 14)
+#define MC_PhaseRate_Optimal_mHz                 (MCPARAMID)( 4390 << 14)
+#define MC__VgaGain                              (MCPARAMID)( 4391 << 14)
+#define MC_CLCAM_MinLineRate_Hz                  (MCPARAMID)( 4392 << 14)
+#define MC_CLCAM_MinFrameRate_mHz                (MCPARAMID)( 4393 << 14)
+#define MC_SrcSizeY                              (MCPARAMID)( 4394 << 14)
+#define MC__Requested_GainY                      (MCPARAMID)( 4395 << 14)
+#define MC__Requested_GainU                      (MCPARAMID)( 4396 << 14)
+#define MC__Requested_GainV                      (MCPARAMID)( 4397 << 14)
+#define MC__Requested_OffsetY                    (MCPARAMID)( 4398 << 14)
+#define MC__TwinGrabberIndex                     (MCPARAMID)( 4399 << 14)
+#define MC__Twin_GainY                           (MCPARAMID)( 4400 << 14)
+#define MC__Twin_GainU                           (MCPARAMID)( 4401 << 14)
+#define MC__Twin_GainV                           (MCPARAMID)( 4402 << 14)
+#define MC__Twin_OffsetY                         (MCPARAMID)( 4403 << 14)
+#define MC__Luma_xmin                            (MCPARAMID)( 4404 << 14)
+#define MC__Luma_xmax                            (MCPARAMID)( 4405 << 14)
+#define MC_WindowXY_Filter                       (MCPARAMID)( 4406 << 14)
+#define MC__Twin_GainY_VB                        (MCPARAMID)( 4407 << 14)
+#define MC__Twin_GainU_VB                        (MCPARAMID)( 4408 << 14)
+#define MC__Twin_GainV_VB                        (MCPARAMID)( 4409 << 14)
+#define MC__Twin_OffsetY_VB                      (MCPARAMID)( 4410 << 14)
+#define MC_BEC_TwinOffset_Y                      (MCPARAMID)( 4411 << 14)
+#define MC_BEC_TwinGain_Y                        (MCPARAMID)( 4412 << 14)
+#define MC_BEC_Twin_Gain_Cr_1                    (MCPARAMID)( 4413 << 14)
+#define MC_BEC_Twin_Gain_Cr_2                    (MCPARAMID)( 4414 << 14)
+#define MC_BEC_Twin_Gain_Cb_1                    (MCPARAMID)( 4415 << 14)
+#define MC_BEC_Twin_Gain_Cb_2                    (MCPARAMID)( 4416 << 14)
+#define MC_CameraConfigMessageBuilder            (MCPARAMID)( 4417 << 14)
+#define MC_CameraConfigMessageBuilder_NONE         1
+#define MC_CameraConfigMessageBuilder_CSB4000CL    2
+#define MC__Twin_CSC_GainY                       (MCPARAMID)( 4418 << 14)
+#define MC__Twin_CSC_GainCrR                     (MCPARAMID)( 4419 << 14)
+#define MC__Twin_CSC_GainCrG                     (MCPARAMID)( 4420 << 14)
+#define MC__Twin_CSC_GainCbB                     (MCPARAMID)( 4421 << 14)
+#define MC__Twin_CSC_GainCbG                     (MCPARAMID)( 4422 << 14)
+#define MC__CTD_TDCLK_HRWP                         5
+#define MC__TRG_EFTFLT                           (MCPARAMID)( 4423 << 14)
+#define MC__TRG_EFTFLT_100ns                       1
+#define MC__TRG_EFTFLT_500ns                       2
+#define MC__TRG_EFTFLT_2500ns                      3
+#define MC__CTD_TDCLK_REFTIC                       6
+#define MC__RawGrabSizeY_Ln                      (MCPARAMID)( 4424 << 14)
+#define MC__IsExpert2                            (MCPARAMID)( 4425 << 14)
+#define MC__IsExpert2_YES                          1
+#define MC__IsExpert2_NO                           2
+#define MC__CameraWindowingAvailable             (MCPARAMID)( 4426 << 14)
+#define MC__CameraWindowingAvailable_YES           1
+#define MC__CameraWindowingAvailable_NO            2
+#define MC__RawGrabSizeX_Log2                    (MCPARAMID)( 4427 << 14)
+#define MC_CL_TapCount_Y                         (MCPARAMID)( 4428 << 14)
+#define MC_CL_TapCount_X                         (MCPARAMID)( 4429 << 14)
+#define MC_CamConfig_IxxSA_D                     279
+#define MC_CamConfig_IxxSD                       280
+#define MC_CamConfig_PxxSA_D                     281
+#define MC__LQS_COUNT3                           (MCPARAMID)( 4430 << 14)
+#define MC__TRG_TM                               (MCPARAMID)( 4431 << 14)
+#define MC__TRG_TM_IMM                             1
+#define MC__TRG_TM_HRD                             2
+#define MC__TRG_TM_SFT                             3
+#define MC__TRG_TM_CMB                             4
+#define MC__TRG_NTM                              (MCPARAMID)( 4432 << 14)
+#define MC__TRG_NTM_RPT                            1
+#define MC__TRG_NTM_HRD                            2
+#define MC__TRG_NTM_SFT                            3
+#define MC__TRG_NTM_CMB                            4
+#define MC__TRG_NTM_PER                            5
+#define MC_CameraWoiBankSetupCmd                 (MCPARAMID)( 4433 << 14)
+#define MC_CameraWoiBankSelectCmd                (MCPARAMID)( 4434 << 14)
+#define MC_BruSelonDC                            (MCPARAMID)( 4435 << 14)
+#define MC_BruSelonDC_Forbidden                    1
+#define MC_BruSelonDC_Allowed                      2
+#define MC_FEC_DITHER                            (MCPARAMID)( 4436 << 14)
+#define MC_FEC_DITHER_Forbidden                    1
+#define MC_FEC_DITHER_Allowed                      2
+#define MC_VgaGain                               (MCPARAMID)( 4437 << 14)
+#define MC_VsyncBfrEndExp_us                     (MCPARAMID)( 4438 << 14)
+#define MC_StrobeMode_OFF                          4
+#define MC__CSIO_CSIO2Out_LOX                      9
+#define MC___IO1Usage_Check                      (MCPARAMID)( 4439 << 14)
+#define MC___IO1Usage_Check_PASS                   1
+#define MC___IO1Usage_Check_FAIL                   2
+#define MC___IO2Usage_Check                      (MCPARAMID)( 4440 << 14)
+#define MC___IO2Usage_Check_PASS                   1
+#define MC___IO2Usage_Check_FAIL                   2
+#define MC___IO3Usage_Check                      (MCPARAMID)( 4441 << 14)
+#define MC___IO3Usage_Check_PASS                   1
+#define MC___IO3Usage_Check_FAIL                   2
+#define MC___IO4Usage_Check                      (MCPARAMID)( 4442 << 14)
+#define MC___IO4Usage_Check_PASS                   1
+#define MC___IO4Usage_Check_FAIL                   2
+#define MC___ISOA2Usage_Check                    (MCPARAMID)( 4443 << 14)
+#define MC___ISOA2Usage_Check_PASS                 1
+#define MC___ISOA2Usage_Check_FAIL                 2
+#define MC___TRA1Usage_Check                     (MCPARAMID)( 4444 << 14)
+#define MC___TRA1Usage_Check_PASS                  1
+#define MC___TRA1Usage_Check_FAIL                  2
+#define MC___TRA2Usage_Check                     (MCPARAMID)( 4445 << 14)
+#define MC___TRA2Usage_Check_PASS                  1
+#define MC___TRA2Usage_Check_FAIL                  2
+#define MC___ISOA1Usage_Check                    (MCPARAMID)( 4446 << 14)
+#define MC___ISOA1Usage_Check_PASS                 1
+#define MC___ISOA1Usage_Check_FAIL                 2
+#define MC_Gain_s                                (MCPARAMID)( 4447 << 14)
+#define MC__Twin_GainY_s                         (MCPARAMID)( 4448 << 14)
+#define MC__CBA_READ_RATE                        (MCPARAMID)( 4449 << 14)
+#define MC__CBA_READ_RATE_FULL                     1
+#define MC__CBA_READ_RATE_HALF                     2
+#define MC_GrabWindow_WOI_NO                       7
+#define MC_GrabWindow_WOI_YES                      8
+#define MC_FifoSizeX_inbytes                     (MCPARAMID)( 4450 << 14)
+#define MC_Camera_CSB1100CL                      218
+#define MC_CamConfig_P22RC                       282
+#define MC___FPGA_Model_Check                    (MCPARAMID)( 4451 << 14)
+#define MC___FPGA_Model_Check_PASS                 1
+#define MC___FPGA_Model_Check_FAIL                 2
+#define MC_WoiLvalCount                          (MCPARAMID)( 4452 << 14)
+#define MC_WoiPixelCount                         (MCPARAMID)( 4453 << 14)
+#define MC_ECASet                                (MCPARAMID)( 4454 << 14)
+#define MC_WoiFvalHigh_Tk                        (MCPARAMID)( 4455 << 14)
+#define MC_WoiMinTriggerDisableTime_Tk           (MCPARAMID)( 4456 << 14)
+#define MC_WoiReadoutTime_Tk                     (MCPARAMID)( 4457 << 14)
+#define MC_WoiReadoutDur_Tk                      (MCPARAMID)( 4458 << 14)
+#define MC_WoiReadoutDur_10ns                    (MCPARAMID)( 4459 << 14)
+#define MC_IoCapability                          (MCPARAMID)( 4460 << 14)
+#define MC___MinHactive_Check                    (MCPARAMID)( 4461 << 14)
+#define MC___MinHactive_Check_PASS                 1
+#define MC___MinHactive_Check_FAIL                 2
+#define MC_VIOS_WatchdogConfigSet                (MCPARAMID)( 4462 << 14)
+#define MC_LinePitchGranularity                  (MCPARAMID)( 4463 << 14)
+#define MC__BoardType__CFA                        30
+#define MC__PP_OutputXStep_Bytes                 (MCPARAMID)( 4464 << 14)
+#define MC__Category_CFA_PixelProcessor           51
+#define MC__Category_CFA_PixelProcessor_Local     52
+#define MC_TOI_USR_OrgX_Px                       (MCPARAMID)( 4465 << 14)
+#define MC_TOI_REF_OrgX_Px                       (MCPARAMID)( 4466 << 14)
+#define MC_TOI_USR_OrgY_Ln                       (MCPARAMID)( 4467 << 14)
+#define MC_TOI_USR_Width_Px                      (MCPARAMID)( 4468 << 14)
+#define MC_TOI_USR_Height_Ln                     (MCPARAMID)( 4469 << 14)
+#define MC_TOI_USR_Granularity_Px                (MCPARAMID)( 4470 << 14)
+#define MC_TOI_USR_MinWidth_Px                   (MCPARAMID)( 4471 << 14)
+#define MC_TOI_USR_MaxWidth_Px                   (MCPARAMID)( 4472 << 14)
+#define MC_TOI_USR_MinHeight_Px                  (MCPARAMID)( 4473 << 14)
+#define MC_TOI_REF_OrgY_Ln                       (MCPARAMID)( 4474 << 14)
+#define MC_TOI_REF_Width_Px                      (MCPARAMID)( 4475 << 14)
+#define MC_TOI_REF_Height_Ln                     (MCPARAMID)( 4476 << 14)
+#define MC_TOI_USR_MinHeight_Ln                  (MCPARAMID)( 4477 << 14)
+#define MC_TOI_USR_MaxHeight_Ln                  (MCPARAMID)( 4478 << 14)
+#define MC_TOI_EXT_OrgX_Px                       (MCPARAMID)( 4479 << 14)
+#define MC_TOI_EXT_OrgY_Ln                       (MCPARAMID)( 4480 << 14)
+#define MC_TOI_EXT_Width_Px                      (MCPARAMID)( 4481 << 14)
+#define MC_TOI_EXT_Height_Ln                     (MCPARAMID)( 4482 << 14)
+#define MC_TOI_FSR_OrgX_Px                       (MCPARAMID)( 4483 << 14)
+#define MC_TOI_FSR_OrgY_Ln                       (MCPARAMID)( 4484 << 14)
+#define MC_TOI_FSR_Width_Px                      (MCPARAMID)( 4485 << 14)
+#define MC_TOI_FSR_Height_Ln                     (MCPARAMID)( 4486 << 14)
+#define MC_TOI_XFR_OffsetX_Bytes                 (MCPARAMID)( 4487 << 14)
+#define MC_TOI_XFR_OffsetY_Lines                 (MCPARAMID)( 4488 << 14)
+#define MC_TOI_XFR_Width_Bytes                   (MCPARAMID)( 4489 << 14)
+#define MC_TOI_XFR_Height_Lines                  (MCPARAMID)( 4490 << 14)
+#define MC_ColorComponentCount                   (MCPARAMID)( 4491 << 14)
+#define MC_AssyColorStorage                      (MCPARAMID)( 4492 << 14)
+#define MC_AssyColorStorage_PACKED                 1
+#define MC_AssyColorStorage_PLANAR                 2
+#define MC_ColorFormat_ARGB64                     80
+#define MC_ColorFormat_RGB15Y8                    81
+#define MC_ColorFormat_RGB16Y8                    82
+#define MC_ColorFormat_RGB24Y8                    83
+#define MC_ColorFormat_RGB24Y10                   84
+#define MC_ColorFormat_RGB24Y12                   85
+#define MC_ColorFormat_RGB24Y16                   86
+#define MC_ColorFormat_YRGB32                     87
+#define MC_ColorFormat_YRGB64                     88
+#define MC_ColorFormat_RGB24PLY8                  89
+#define MC_ColorFormat_RGB30PLY8                  90
+#define MC_ColorFormat_RGB36PLY8                  91
+#define MC_ColorFormat_RGB48PLY8                  92
+#define MC_ColorFormat_RGB24PLY10                 93
+#define MC_ColorFormat_RGB30PLY10                 94
+#define MC_ColorFormat_RGB36PLY10                 95
+#define MC_ColorFormat_RGB48PLY10                 96
+#define MC_ColorFormat_RGB24PLY12                 97
+#define MC_ColorFormat_RGB30PLY12                 98
+#define MC_ColorFormat_RGB36PLY12                 99
+#define MC_ColorFormat_RGB48PLY12                100
+#define MC_ColorFormat_RGB24PLY16                101
+#define MC_ColorFormat_RGB30PLY16                102
+#define MC_ColorFormat_RGB36PLY16                103
+#define MC_ColorFormat_RGB48PLY16                104
+#define MC_Camera_CV_M8CL                        219
+#define MC_ScaleX4096                            (MCPARAMID)( 4493 << 14)
+#define MC_ScaleY4096                            (MCPARAMID)( 4494 << 14)
+#define MC_TOI_XFR_Granularity_Bytes             (MCPARAMID)( 4495 << 14)
+#define MC_Param                                 (MCPARAMID)( 4496 << 14)
+#define MC_FifoOffsetX0                          (MCPARAMID)( 4497 << 14)
+#define MC_FifoOffsetX1                          (MCPARAMID)( 4498 << 14)
+#define MC_FifoOffsetX2                          (MCPARAMID)( 4499 << 14)
+#define MC_FifoOffsetX3                          (MCPARAMID)( 4500 << 14)
+#define MC_XferSizeX0                            (MCPARAMID)( 4501 << 14)
+#define MC_XferSizeX1                            (MCPARAMID)( 4502 << 14)
+#define MC_XferSizeX2                            (MCPARAMID)( 4503 << 14)
+#define MC_XferSizeX3                            (MCPARAMID)( 4504 << 14)
+#define MC_FifoSizeX0                            (MCPARAMID)( 4505 << 14)
+#define MC_FifoSizeX1                            (MCPARAMID)( 4506 << 14)
+#define MC_FifoSizeX2                            (MCPARAMID)( 4507 << 14)
+#define MC_FifoSizeX3                            (MCPARAMID)( 4508 << 14)
+#define MC_BufferOffsetX_Unaligned               (MCPARAMID)( 4509 << 14)
+#define MC_BufferOffsetX0                        (MCPARAMID)( 4510 << 14)
+#define MC_BufferOffsetX1                        (MCPARAMID)( 4511 << 14)
+#define MC_BufferOffsetX2                        (MCPARAMID)( 4512 << 14)
+#define MC_BufferOffsetX3                        (MCPARAMID)( 4513 << 14)
+#define MC_FifoSizeY0                            (MCPARAMID)( 4514 << 14)
+#define MC_XferSizeY0                            (MCPARAMID)( 4515 << 14)
+#define MC_FifoOffsetY0                          (MCPARAMID)( 4516 << 14)
+#define MC_BufferOffsetY0                        (MCPARAMID)( 4517 << 14)
+#define MC_TOI_XFR_Granularity_Px                (MCPARAMID)( 4518 << 14)
+#define MC_TOI_XFR_OffsetX_Px                    (MCPARAMID)( 4519 << 14)
+#define MC_TOI_XFR_OffsetY_Ln                    (MCPARAMID)( 4520 << 14)
+#define MC_TOI_XFR_Height_Ln                     (MCPARAMID)( 4521 << 14)
+#define MC_TOI_XFR_OrgX_Px                       (MCPARAMID)( 4522 << 14)
+#define MC_TOI_XFR_OrgY_Ln                       (MCPARAMID)( 4523 << 14)
+#define MC_TOI_XFR_Width_Px                      (MCPARAMID)( 4524 << 14)
+#define MC_TOI_EXT_Margin                        (MCPARAMID)( 4525 << 14)
+#define MC_TOI_FSR_OrgX                          (MCPARAMID)( 4526 << 14)
+#define MC_TOI_FSR_Width                         (MCPARAMID)( 4527 << 14)
+#define MC_FBSizeX_Px                            (MCPARAMID)( 4528 << 14)
+#define MC_FBSizeY_Ln                            (MCPARAMID)( 4529 << 14)
+#define MC_GWPixelSize                           (MCPARAMID)( 4530 << 14)
+#define MC_GWSizeX_Px                            (MCPARAMID)( 4531 << 14)
+#define MC_GWSizeY_Ln                            (MCPARAMID)( 4532 << 14)
+#define MC__Category_CFA_PixelProcessor_LowLevel  53
+#define MC_WRF_1stLineRep0                       (MCPARAMID)( 4533 << 14)
+#define MC_WRF_1stLineRep0_ON                      1
+#define MC_WRF_1stLineRep0_OFF                     2
+#define MC_WRF_1stLineRep1                       (MCPARAMID)( 4534 << 14)
+#define MC_WRF_1stLineRep1_ON                      1
+#define MC_WRF_1stLineRep1_OFF                     2
+#define MC_TOI_EXT_Bot_Ln                        (MCPARAMID)( 4535 << 14)
+#define MC_WRF_LastLineRep0                      (MCPARAMID)( 4536 << 14)
+#define MC_WRF_LastLineRep0_ON                     1
+#define MC_WRF_LastLineRep0_OFF                    2
+#define MC_WRF_LastLineRep1                      (MCPARAMID)( 4537 << 14)
+#define MC_WRF_LastLineRep1_ON                     1
+#define MC_WRF_LastLineRep1_OFF                    2
+#define MC_TOI_EXT_Right_Px                      (MCPARAMID)( 4538 << 14)
+#define MC_WRF_1stColRep0                        (MCPARAMID)( 4539 << 14)
+#define MC_WRF_1stColRep0_ON                       1
+#define MC_WRF_1stColRep0_OFF                      2
+#define MC_WRF_LastColRep0                       (MCPARAMID)( 4540 << 14)
+#define MC_WRF_LastColRep0_ON                      1
+#define MC_WRF_LastColRep0_OFF                     2
+#define MC_GWPixelComponentSize                  (MCPARAMID)( 4541 << 14)
+#define MC_WRF_ColumnIx0                         (MCPARAMID)( 4542 << 14)
+#define MC_WRF_TOIwidth0                         (MCPARAMID)( 4543 << 14)
+#define MC_WRF_Line10                            (MCPARAMID)( 4544 << 14)
+#define MC_WRF_Line10_GB                           1
+#define MC_WRF_Line10_BG                           2
+#define MC_WRF_Line10_RG                           3
+#define MC_WRF_Line10_GR                           4
+#define MC_GWColorRegistration                   (MCPARAMID)( 4545 << 14)
+#define MC_ColorRegistrationTOI0                 (MCPARAMID)( 4546 << 14)
+#define MC_ImagePlaneType                        (MCPARAMID)( 4547 << 14)
+#define MC_ImagePlaneType_Y                        1
+#define MC_ImagePlaneType_R                        2
+#define MC_ImagePlaneType_G                        3
+#define MC_ImagePlaneType_B                        4
+#define MC_ImagePlaneType_RGB                      5
+#define MC_ImagePlaneType_ARGB                     6
+#define MC_ImagePlaneType_YRGB                     7
+#define MC_ImagePlaneType_BAYER                    8
+#define MC_ImagePlaneType_RAW                      9
+#define MC_ImagePlaneType_UNUSED                  10
+#define MC_ImagePlanePixelSize                   (MCPARAMID)( 4548 << 14)
+#define MC_WRF_XferSize00                        (MCPARAMID)( 4549 << 14)
+#define MC_WRF_XferSize10                        (MCPARAMID)( 4550 << 14)
+#define MC_WRF_XferSize20                        (MCPARAMID)( 4551 << 14)
+#define MC_WRF_XferSize30                        (MCPARAMID)( 4552 << 14)
+#define MC_WRF_TOIheight0                        (MCPARAMID)( 4553 << 14)
+#define MC_LastTOIIndex                          (MCPARAMID)( 4554 << 14)
+#define MC_WRF_LastTOI0                          (MCPARAMID)( 4555 << 14)
+#define MC_WRF_LastTOI0_TRUE                       1
+#define MC_WRF_LastTOI0_FALSE                      2
+#define MC_FBPlanePitch                          (MCPARAMID)( 4556 << 14)
+#define MC_FBFormat                              (MCPARAMID)( 4557 << 14)
+#define MC_FBFormat_MONO8                          1
+#define MC_FBFormat_MONO16                         2
+#define MC_FBFormat_PLANAR8                        3
+#define MC_FBFormat_PLANAR16                       4
+#define MC_WRF_TOIGap0                           (MCPARAMID)( 4558 << 14)
+#define MC_TOICount                              (MCPARAMID)( 4559 << 14)
+#define MC_WRF_TOIoffset0                        (MCPARAMID)( 4560 << 14)
+#define MC_FBPitch                               (MCPARAMID)( 4561 << 14)
+#define MC_FBPlaneCount                          (MCPARAMID)( 4562 << 14)
+#define MC_FBPixelComponentSize                  (MCPARAMID)( 4563 << 14)
+#define MC_WRF_NbOfLine0                         (MCPARAMID)( 4564 << 14)
+#define MC_WRF_1stColRep1                        (MCPARAMID)( 4565 << 14)
+#define MC_WRF_1stColRep1_ON                       1
+#define MC_WRF_1stColRep1_OFF                      2
+#define MC_WRF_LastColRep1                       (MCPARAMID)( 4566 << 14)
+#define MC_WRF_LastColRep1_ON                      1
+#define MC_WRF_LastColRep1_OFF                     2
+#define MC_WRF_ColumnIx1                         (MCPARAMID)( 4567 << 14)
+#define MC_WRF_TOIwidth1                         (MCPARAMID)( 4568 << 14)
+#define MC_ColorRegistrationTOI1                 (MCPARAMID)( 4569 << 14)
+#define MC_WRF_Line11                            (MCPARAMID)( 4570 << 14)
+#define MC_WRF_Line11_GB                           1
+#define MC_WRF_Line11_BG                           2
+#define MC_WRF_Line11_RG                           3
+#define MC_WRF_Line11_GR                           4
+#define MC_WRF_XferSize01                        (MCPARAMID)( 4571 << 14)
+#define MC_WRF_XferSize11                        (MCPARAMID)( 4572 << 14)
+#define MC_WRF_XferSize21                        (MCPARAMID)( 4573 << 14)
+#define MC_WRF_XferSize31                        (MCPARAMID)( 4574 << 14)
+#define MC_WRF_TOIheight1                        (MCPARAMID)( 4575 << 14)
+#define MC_WRF_LastTOI1                          (MCPARAMID)( 4576 << 14)
+#define MC_WRF_LastTOI1_TRUE                       1
+#define MC_WRF_LastTOI1_FALSE                      2
+#define MC_WRF_TOIoffset1                        (MCPARAMID)( 4577 << 14)
+#define MC_WRF_TOIGap1                           (MCPARAMID)( 4578 << 14)
+#define MC_WRF_NbOfLine1                         (MCPARAMID)( 4579 << 14)
+#define MC_COF_mux1_sel                          (MCPARAMID)( 4580 << 14)
+#define MC_COF_mux1_sel_BYTE1                      1
+#define MC_COF_mux1_sel_BYTE2                      2
+#define MC_COF_mux1_sel_BYTE3                      3
+#define MC_COF_mux1_sel_INVALID                    4
+#define MC_COF_mux2_sel                          (MCPARAMID)( 4581 << 14)
+#define MC_COF_mux2_sel_BYTE2                      1
+#define MC_COF_mux2_sel_BYTE4                      2
+#define MC_COF_mux2_sel_INVALID                    3
+#define MC_COF_mux3_sel                          (MCPARAMID)( 4582 << 14)
+#define MC_COF_mux3_sel_BYTE2                      1
+#define MC_COF_mux3_sel_BYTE3                      2
+#define MC_COF_mux3_sel_BYTE4                      3
+#define MC_COF_mux3_sel_BYTE6                      4
+#define MC_COF_mux3_sel_INVALID                    5
+#define MC_COF_mux4_sel                          (MCPARAMID)( 4583 << 14)
+#define MC_COF_mux4_sel_BYTE2                      1
+#define MC_COF_mux4_sel_BYTE4                      2
+#define MC_COF_mux4_sel_BYTE8                      3
+#define MC_COF_mux4_sel_INVALID                    4
+#define MC_COF_mux5_sel                          (MCPARAMID)( 4584 << 14)
+#define MC_COF_mux5_sel_BYTE1                      1
+#define MC_COF_mux5_sel_BYTE2                      2
+#define MC_COF_mux5_sel_BYTE3                      3
+#define MC_COF_mux5_sel_BYTE4                      4
+#define MC_COF_mux5_sel_BYTE5                      5
+#define MC_COF_mux5_sel_BYTE6                      6
+#define MC_COF_mux5_sel_INVALID                    7
+#define MC_COF_mux6_sel                          (MCPARAMID)( 4585 << 14)
+#define MC_COF_mux6_sel_BYTE2                      1
+#define MC_COF_mux6_sel_BYTE4                      2
+#define MC_COF_mux6_sel_BYTE6                      3
+#define MC_COF_mux6_sel_INVALID                    4
+#define MC_COF_mux7_sel                          (MCPARAMID)( 4586 << 14)
+#define MC_COF_mux7_sel_BYTE2                      1
+#define MC_COF_mux7_sel_BYTE3                      2
+#define MC_COF_mux7_sel_BYTE6                      3
+#define MC_COF_mux7_sel_BYTE7                      4
+#define MC_COF_mux7_sel_BYTE8                      5
+#define MC_COF_mux7_sel_INVALID                    6
+#define MC_COF_mux8_sel                          (MCPARAMID)( 4587 << 14)
+#define MC_COF_mux8_sel_BYTE4                      1
+#define MC_COF_mux8_sel_BYTE8                      2
+#define MC_COF_mux8_sel_INVALID                    3
+#define MC_COF_mux7_sel_UNUSED                     7
+#define MC_COF_mux8_sel_UNUSED                     4
+#define MC_COF_Config                            (MCPARAMID)( 4588 << 14)
+#define MC_COF_Config_Y8DUAL                       1
+#define MC_COF_Config_RGB24                        2
+#define MC_COF_Config_ARGB32                       3
+#define MC_COF_Config_RGB24PL                      4
+#define MC_COF_Config_RGB30PL                      5
+#define MC_COF_Config_INVALID                      6
+#define MC_COF_mux1_sel_UNUSED                     5
+#define MC_COF_mux6_sel_UNUSED                     5
+#define MC_COF_AELevel1                          (MCPARAMID)( 4589 << 14)
+#define MC_COF_AELevel2                          (MCPARAMID)( 4590 << 14)
+#define MC_COF_AELevel3                          (MCPARAMID)( 4591 << 14)
+#define MC_COF_AELevel4                          (MCPARAMID)( 4592 << 14)
+#define MC_COF_AELevel5                          (MCPARAMID)( 4593 << 14)
+#define MC_COF_AELevel6                          (MCPARAMID)( 4594 << 14)
+#define MC_COF_AELevel7                          (MCPARAMID)( 4595 << 14)
+#define MC_COF_AELevel8                          (MCPARAMID)( 4596 << 14)
+#define MC_WWR_Plane0_Inst0                      (MCPARAMID)( 4597 << 14)
+#define MC_WWR_Plane0_Inst1                      (MCPARAMID)( 4598 << 14)
+#define MC_WWR_Plane0_Inst2                      (MCPARAMID)( 4599 << 14)
+#define MC_WWR_Plane0_Inst3                      (MCPARAMID)( 4600 << 14)
+#define MC_WWR_Plane1_Inst0                      (MCPARAMID)( 4601 << 14)
+#define MC_WWR_Plane1_Inst1                      (MCPARAMID)( 4602 << 14)
+#define MC_WWR_Plane1_Inst2                      (MCPARAMID)( 4603 << 14)
+#define MC_WWR_Plane1_Inst3                      (MCPARAMID)( 4604 << 14)
+#define MC_WWR_Plane2_Inst0                      (MCPARAMID)( 4605 << 14)
+#define MC_WWR_Plane2_Inst1                      (MCPARAMID)( 4606 << 14)
+#define MC_WWR_Plane2_Inst2                      (MCPARAMID)( 4607 << 14)
+#define MC_WWR_Plane2_Inst3                      (MCPARAMID)( 4608 << 14)
+#define MC_WWR_Plane3_Inst0                      (MCPARAMID)( 4609 << 14)
+#define MC_WWR_Plane3_Inst1                      (MCPARAMID)( 4610 << 14)
+#define MC_WWR_Plane3_Inst2                      (MCPARAMID)( 4611 << 14)
+#define MC_WWR_Plane3_Inst3                      (MCPARAMID)( 4612 << 14)
+#define MC_COF_WWR_Plane0_Inst0                  (MCPARAMID)( 4613 << 14)
+#define MC_COF_WWR_Plane0_Inst1                  (MCPARAMID)( 4614 << 14)
+#define MC_COF_WWR_Plane0_Inst2                  (MCPARAMID)( 4615 << 14)
+#define MC_COF_WWR_Plane0_Inst3                  (MCPARAMID)( 4616 << 14)
+#define MC_COF_WWR_Plane1_Inst0                  (MCPARAMID)( 4617 << 14)
+#define MC_COF_WWR_Plane1_Inst1                  (MCPARAMID)( 4618 << 14)
+#define MC_COF_WWR_Plane1_Inst2                  (MCPARAMID)( 4619 << 14)
+#define MC_COF_WWR_Plane1_Inst3                  (MCPARAMID)( 4620 << 14)
+#define MC_COF_WWR_Plane2_Inst0                  (MCPARAMID)( 4621 << 14)
+#define MC_COF_WWR_Plane2_Inst1                  (MCPARAMID)( 4622 << 14)
+#define MC_COF_WWR_Plane2_Inst2                  (MCPARAMID)( 4623 << 14)
+#define MC_COF_WWR_Plane2_Inst3                  (MCPARAMID)( 4624 << 14)
+#define MC_COF_WWR_Plane3_Inst0                  (MCPARAMID)( 4625 << 14)
+#define MC_COF_WWR_Plane3_Inst1                  (MCPARAMID)( 4626 << 14)
+#define MC_COF_WWR_Plane3_Inst2                  (MCPARAMID)( 4627 << 14)
+#define MC_COF_WWR_Plane3_Inst3                  (MCPARAMID)( 4628 << 14)
+#define MC_COF_WWR_ProgSize_Plane0               (MCPARAMID)( 4629 << 14)
+#define MC_COF_WWR_ProgSize_Plane1               (MCPARAMID)( 4630 << 14)
+#define MC_COF_WWR_ProgSize_Plane2               (MCPARAMID)( 4631 << 14)
+#define MC_COF_WWR_ProgSize_Plane3               (MCPARAMID)( 4632 << 14)
+#define MC_CPC_PPOF_bitWiseRouter                (MCPARAMID)( 4633 << 14)
+#define MC_OutputFormatterConfig                 (MCPARAMID)( 4634 << 14)
+#define MC_OutputFormatterConfig_Y8QUAD            1
+#define MC_OutputFormatterConfig_Y8DUAL            2
+#define MC_OutputFormatterConfig_Y10QUAD           3
+#define MC_OutputFormatterConfig_Y10DUAL           4
+#define MC_OutputFormatterConfig_Y12QUAD           5
+#define MC_OutputFormatterConfig_Y12DUAL           6
+#define MC_OutputFormatterConfig_Y16QUAD           7
+#define MC_OutputFormatterConfig_Y16DUAL           8
+#define MC_OutputFormatterConfig_RGB15             9
+#define MC_OutputFormatterConfig_RGB16            10
+#define MC_OutputFormatterConfig_RGB24            11
+#define MC_OutputFormatterConfig_ARGB32           12
+#define MC_OutputFormatterConfig_RGB30            13
+#define MC_OutputFormatterConfig_RGB32            14
+#define MC_OutputFormatterConfig_RGB48            15
+#define MC_OutputFormatterConfig_ARGB64           16
+#define MC_OutputFormatterConfig_RGB24PL          17
+#define MC_OutputFormatterConfig_RGB30PL          18
+#define MC_OutputFormatterConfig_RGB36PL          19
+#define MC_OutputFormatterConfig_RGB48PL          20
+#define MC_OutputFormatterConfig_RGB15Y8          21
+#define MC_OutputFormatterConfig_RGB16Y8          22
+#define MC_OutputFormatterConfig_RGB24Y8          23
+#define MC_OutputFormatterConfig_RGB24Y10         24
+#define MC_OutputFormatterConfig_RGB24Y12         25
+#define MC_OutputFormatterConfig_RGB24Y16         26
+#define MC_OutputFormatterConfig_YRGB32           27
+#define MC_OutputFormatterConfig_YRGB64           28
+#define MC_OutputFormatterConfig_RGB24PLY8        29
+#define MC_OutputFormatterConfig_RGB24PLY10       30
+#define MC_OutputFormatterConfig_RGB24PLY12       31
+#define MC_OutputFormatterConfig_RGB24PLY16       32
+#define MC_OutputFormatterConfig_RGB30PLY8        33
+#define MC_OutputFormatterConfig_RGB36PLY8        34
+#define MC_OutputFormatterConfig_RGB48PLY8        35
+#define MC_OutputFormatterConfig_RGB30PLY10       36
+#define MC_OutputFormatterConfig_RGB30PLY12       37
+#define MC_OutputFormatterConfig_RGB30PLY16       38
+#define MC_OutputFormatterConfig_RGB36PLY10       39
+#define MC_OutputFormatterConfig_RGB36PLY12       40
+#define MC_OutputFormatterConfig_RGB36PLY16       41
+#define MC_OutputFormatterConfig_RGB48PLY10       42
+#define MC_OutputFormatterConfig_RGB48PLY12       43
+#define MC_OutputFormatterConfig_RGB48PLY16       44
+#define MC_COF_mux8                              (MCPARAMID)( 4635 << 14)
+#define MC_COF_mux7                              (MCPARAMID)( 4636 << 14)
+#define MC_COF_mux6                              (MCPARAMID)( 4637 << 14)
+#define MC_COF_mux5                              (MCPARAMID)( 4638 << 14)
+#define MC_COF_mux4                              (MCPARAMID)( 4639 << 14)
+#define MC_COF_mux3                              (MCPARAMID)( 4640 << 14)
+#define MC_COF_mux2                              (MCPARAMID)( 4641 << 14)
+#define MC_COF_mux1                              (MCPARAMID)( 4642 << 14)
+#define MC_COF_WWR_ProgNr                        (MCPARAMID)( 4643 << 14)
+#define MC_PixelProcessorConfiguration           (MCPARAMID)( 4644 << 14)
+#define MC_PixelProcessorConfiguration_BAYER2RGB   1
+#define MC_PixelProcessorConfiguration_BAYER2RGBY   2
+#define MC_PixelProcessorConfiguration_BAYER2Y     3
+#define MC_PixelProcessorConfiguration_BAYER2BAYER   4
+#define MC_PixelProcessorConfiguration_RGB2RGB     5
+#define MC_PixelProcessorConfiguration_RGB2RGBY    6
+#define MC_PixelProcessorConfiguration_RGB2Y       7
+#define MC_PixelProcessorConfiguration_Y2Y         8
+#define MC_CFD_Mode                              (MCPARAMID)( 4645 << 14)
+#define MC_CFD_Mode_ADVANCED                       1
+#define MC_CFD_Mode_LEGACY                         2
+#define MC_CFD_Mode_Filter                       (MCPARAMID)( 4646 << 14)
+#define MC_CPC_DECODER_BYPASS                    (MCPARAMID)( 4647 << 14)
+#define MC_CPC_DECODER_BYPASS_TRUE                 1
+#define MC_CPC_DECODER_BYPASS_FALSE                2
+#define MC_CPC_DECODER_ALGO                      (MCPARAMID)( 4648 << 14)
+#define MC_CPC_DECODER_ALGO_ADVANCED               1
+#define MC_CPC_DECODER_ALGO_LEGACY                 2
+#define MC_CPC_PPSB_Dither                       (MCPARAMID)( 4649 << 14)
+#define MC_CPC_PPSB_Dither_ON                      1
+#define MC_CPC_PPSB_Dither_OFF                     2
+#define MC_CPC_PPSB_DataTyp                      (MCPARAMID)( 4650 << 14)
+#define MC_CPC_PPSB_DataTyp_Y8                     1
+#define MC_CPC_PPSB_DataTyp_Y16                    2
+#define MC_CPC_PPSB_DataTyp_RGB24                  3
+#define MC_CPC_PPSB_DataTyp_RGB48                  4
+#define MC_CPC_PPSB_DataTyp_BAYER8                 5
+#define MC_CPC_PPSB_DataTyp_BAYER16                6
+#define MC_ColorFormatClass                      (MCPARAMID)( 4651 << 14)
+#define MC_ColorFormatClass_RGB                    1
+#define MC_ColorFormatClass_RGBY                   2
+#define MC_ColorFormatClass_Y                      3
+#define MC_ColorFormatClass_BAYER                  4
+#define MC_COF_RAM_k_8                           (MCPARAMID)( 4652 << 14)
+#define MC_COF_RAM_k_7                           (MCPARAMID)( 4653 << 14)
+#define MC_COF_RAM_k_6                           (MCPARAMID)( 4654 << 14)
+#define MC_COF_RAM_k_5                           (MCPARAMID)( 4655 << 14)
+#define MC_COF_RAM_k_4                           (MCPARAMID)( 4656 << 14)
+#define MC_COF_RAM_k_3                           (MCPARAMID)( 4657 << 14)
+#define MC_COF_RAM_k_2                           (MCPARAMID)( 4658 << 14)
+#define MC_COF_RAM_k_1                           (MCPARAMID)( 4659 << 14)
+#define MC_COF_RAM_l_8                           (MCPARAMID)( 4660 << 14)
+#define MC_COF_RAM_l_7                           (MCPARAMID)( 4661 << 14)
+#define MC_COF_RAM_l_6                           (MCPARAMID)( 4662 << 14)
+#define MC_COF_RAM_l_5                           (MCPARAMID)( 4663 << 14)
+#define MC_COF_RAM_l_4                           (MCPARAMID)( 4664 << 14)
+#define MC_COF_RAM_l_3                           (MCPARAMID)( 4665 << 14)
+#define MC_COF_RAM_l_2                           (MCPARAMID)( 4666 << 14)
+#define MC_COF_RAM_l_1                           (MCPARAMID)( 4667 << 14)
+#define MC_TOI_XFR_RightX_Px                     (MCPARAMID)( 4668 << 14)
+#define MC_TOI_XFR_BotY_Ln                       (MCPARAMID)( 4669 << 14)
+#define MC_TOI_DMA_FifoSizeX                     (MCPARAMID)( 4670 << 14)
+#define MC_TOI_DMA_FifoSizeX_Px                  (MCPARAMID)( 4671 << 14)
+#define MC_TOI_DMA_FifoOffsetXPx                 (MCPARAMID)( 4672 << 14)
+#define MC_TOI_DMA_FifoOffsetX_Px                (MCPARAMID)( 4673 << 14)
+#define MC_TOI_DMA_FifoSizeY_Ln                  (MCPARAMID)( 4674 << 14)
+#define MC_TOI_DMA_FifoOffsetY_Ln                (MCPARAMID)( 4675 << 14)
+#define MC_COF_WWR_15                            (MCPARAMID)( 4676 << 14)
+#define MC_COF_WWR_14                            (MCPARAMID)( 4677 << 14)
+#define MC_COF_WWR_13                            (MCPARAMID)( 4678 << 14)
+#define MC_COF_WWR_12                            (MCPARAMID)( 4679 << 14)
+#define MC_COF_WWR_11                            (MCPARAMID)( 4680 << 14)
+#define MC_COF_WWR_10                            (MCPARAMID)( 4681 << 14)
+#define MC_COF_WWR_09                            (MCPARAMID)( 4682 << 14)
+#define MC_COF_WWR_08                            (MCPARAMID)( 4683 << 14)
+#define MC_COF_WWR_07                            (MCPARAMID)( 4684 << 14)
+#define MC_COF_WWR_06                            (MCPARAMID)( 4685 << 14)
+#define MC_COF_WWR_05                            (MCPARAMID)( 4686 << 14)
+#define MC_COF_WWR_04                            (MCPARAMID)( 4687 << 14)
+#define MC_COF_WWR_03                            (MCPARAMID)( 4688 << 14)
+#define MC_COF_WWR_02                            (MCPARAMID)( 4689 << 14)
+#define MC_COF_WWR_01                            (MCPARAMID)( 4690 << 14)
+#define MC_COF_WWR_00                            (MCPARAMID)( 4691 << 14)
+#define MC_COF_WWR_Inst15                        (MCPARAMID)( 4692 << 14)
+#define MC_COF_WWR_Inst14                        (MCPARAMID)( 4693 << 14)
+#define MC_COF_WWR_Inst13                        (MCPARAMID)( 4694 << 14)
+#define MC_COF_WWR_Inst12                        (MCPARAMID)( 4695 << 14)
+#define MC_COF_WWR_Inst11                        (MCPARAMID)( 4696 << 14)
+#define MC_COF_WWR_Inst10                        (MCPARAMID)( 4697 << 14)
+#define MC_COF_WWR_Inst09                        (MCPARAMID)( 4698 << 14)
+#define MC_COF_WWR_Inst08                        (MCPARAMID)( 4699 << 14)
+#define MC_COF_WWR_Inst07                        (MCPARAMID)( 4700 << 14)
+#define MC_COF_WWR_Inst06                        (MCPARAMID)( 4701 << 14)
+#define MC_COF_WWR_Inst05                        (MCPARAMID)( 4702 << 14)
+#define MC_COF_WWR_Inst04                        (MCPARAMID)( 4703 << 14)
+#define MC_COF_WWR_Inst03                        (MCPARAMID)( 4704 << 14)
+#define MC_COF_WWR_Inst02                        (MCPARAMID)( 4705 << 14)
+#define MC_COF_WWR_Inst01                        (MCPARAMID)( 4706 << 14)
+#define MC_COF_WWR_Inst00                        (MCPARAMID)( 4707 << 14)
+#define MC_TOI_DMA_BufferOffsetX_Px              (MCPARAMID)( 4708 << 14)
+#define MC_TOI_DMA_BufferOffsetY_Ln              (MCPARAMID)( 4709 << 14)
+#define MC_CPC_GAIN_0                            (MCPARAMID)( 4710 << 14)
+#define MC_CPC_GAIN_1                            (MCPARAMID)( 4711 << 14)
+#define MC_CPC_GAIN_2                            (MCPARAMID)( 4712 << 14)
+#define MC_CFD_Usage                             (MCPARAMID)( 4713 << 14)
+#define MC_CFD_Usage_UNUSED                        1
+#define MC_CFD_Usage_USED                          2
+#define MC_WBO_Usage                             (MCPARAMID)( 4714 << 14)
+#define MC_WBO_Usage_UNUSED                        1
+#define MC_WBO_Usage_USED                          2
+#define MC_WBO_Mode                              (MCPARAMID)( 4715 << 14)
+#define MC_WBO_Mode_NONE                           1
+#define MC_WBO_Mode_MANUAL                         2
+#define MC_WBO_Mode_CONTINUOUS                     3
+#define MC_WBO_Mode_ONCE                           4
+#define MC_WBO_Mode_Filter                       (MCPARAMID)( 4716 << 14)
+#define MC_WBO_GainR                             (MCPARAMID)( 4717 << 14)
+#define MC_WBO_Gain_Filter                       (MCPARAMID)( 4718 << 14)
+#define MC_WBO_GainG                             (MCPARAMID)( 4719 << 14)
+#define MC_WBO_GainB                             (MCPARAMID)( 4720 << 14)
+#define MC_WRF_TOIPitch0                         (MCPARAMID)( 4721 << 14)
+#define MC_WRF_TOIPitch1                         (MCPARAMID)( 4722 << 14)
+#define MC_TOI_USR_CountX                        (MCPARAMID)( 4723 << 14)
+#define MC_TOI_USR_CountY                        (MCPARAMID)( 4724 << 14)
+#define MC_TOI_USR_Topology                      (MCPARAMID)( 4725 << 14)
+#define MC_TOI_USR_Topology_INVALID                1
+#define MC_TOI_USR_Topology_1X_1Y                  2
+#define MC_TOI_USR_Topology_1X_2Y                  3
+#define MC_TOI_USR_Topology_2X_2Y                  4
+#define MC_TOI_USR_Topology_2X_4Y                  5
+#define MC_TOI_USR_Count                         (MCPARAMID)( 4726 << 14)
+#define MC_TOIWidth                              (MCPARAMID)( 4727 << 14)
+#define MC_TOIHeight                             (MCPARAMID)( 4728 << 14)
+#define MC_TOIHeight_LastRow                     (MCPARAMID)( 4729 << 14)
+#define MC_FirstTOILastRowIndex                  (MCPARAMID)( 4730 << 14)
+#define MC_TOIHeightLastRow                      (MCPARAMID)( 4731 << 14)
+#define MC_TOI_USR_LastIndex                     (MCPARAMID)( 4732 << 14)
+#define MC_TOI_USR_Width                         (MCPARAMID)( 4733 << 14)
+#define MC_TOI_USR_Height                        (MCPARAMID)( 4734 << 14)
+#define MC_TOI_USR_HeightLastRow                 (MCPARAMID)( 4735 << 14)
+#define MC_TOI_USR_FirstTOILastRowIndex          (MCPARAMID)( 4736 << 14)
+#define MC_WRF_TOI_USR_Width0                    (MCPARAMID)( 4737 << 14)
+#define MC_WRF_TOI_USR_Height0                   (MCPARAMID)( 4738 << 14)
+#define MC_WRF_TOI_USR_Width1                    (MCPARAMID)( 4739 << 14)
+#define MC_WRF_TOI_USR_Height1                   (MCPARAMID)( 4740 << 14)
+#define MC_TOI_USR_CountX_Min                    (MCPARAMID)( 4741 << 14)
+#define MC_WRF_1stLineRep2                       (MCPARAMID)( 4742 << 14)
+#define MC_WRF_1stLineRep2_ON                      1
+#define MC_WRF_1stLineRep2_OFF                     2
+#define MC_WRF_LastLineRep2                      (MCPARAMID)( 4743 << 14)
+#define MC_WRF_LastLineRep2_ON                     1
+#define MC_WRF_LastLineRep2_OFF                    2
+#define MC_WRF_1stColRep2                        (MCPARAMID)( 4744 << 14)
+#define MC_WRF_1stColRep2_ON                       1
+#define MC_WRF_1stColRep2_OFF                      2
+#define MC_WRF_LastColRep2                       (MCPARAMID)( 4745 << 14)
+#define MC_WRF_LastColRep2_ON                      1
+#define MC_WRF_LastColRep2_OFF                     2
+#define MC_WRF_ColumnIx2                         (MCPARAMID)( 4746 << 14)
+#define MC_WRF_TOIwidth2                         (MCPARAMID)( 4747 << 14)
+#define MC_ColorRegistrationTOI2                 (MCPARAMID)( 4748 << 14)
+#define MC_WRF_Line12                            (MCPARAMID)( 4749 << 14)
+#define MC_WRF_Line12_GB                           1
+#define MC_WRF_Line12_BG                           2
+#define MC_WRF_Line12_RG                           3
+#define MC_WRF_Line12_GR                           4
+#define MC_WRF_XferSize02                        (MCPARAMID)( 4750 << 14)
+#define MC_WRF_XferSize12                        (MCPARAMID)( 4751 << 14)
+#define MC_WRF_XferSize22                        (MCPARAMID)( 4752 << 14)
+#define MC_WRF_XferSize32                        (MCPARAMID)( 4753 << 14)
+#define MC_WRF_TOIheight2                        (MCPARAMID)( 4754 << 14)
+#define MC_WRF_LastTOI2                          (MCPARAMID)( 4755 << 14)
+#define MC_WRF_LastTOI2_TRUE                       1
+#define MC_WRF_LastTOI2_FALSE                      2
+#define MC_WRF_TOIoffset2                        (MCPARAMID)( 4756 << 14)
+#define MC_WRF_TOIPitch2                         (MCPARAMID)( 4757 << 14)
+#define MC_WRF_NbOfLine2                         (MCPARAMID)( 4758 << 14)
+#define MC_WRF_1stLineRep3                       (MCPARAMID)( 4759 << 14)
+#define MC_WRF_1stLineRep3_ON                      1
+#define MC_WRF_1stLineRep3_OFF                     2
+#define MC_WRF_LastLineRep3                      (MCPARAMID)( 4760 << 14)
+#define MC_WRF_LastLineRep3_ON                     1
+#define MC_WRF_LastLineRep3_OFF                    2
+#define MC_WRF_1stColRep3                        (MCPARAMID)( 4761 << 14)
+#define MC_WRF_1stColRep3_ON                       1
+#define MC_WRF_1stColRep3_OFF                      2
+#define MC_WRF_LastColRep3                       (MCPARAMID)( 4762 << 14)
+#define MC_WRF_LastColRep3_ON                      1
+#define MC_WRF_LastColRep3_OFF                     2
+#define MC_WRF_ColumnIx3                         (MCPARAMID)( 4763 << 14)
+#define MC_WRF_TOIwidth3                         (MCPARAMID)( 4764 << 14)
+#define MC_ColorRegistrationTOI3                 (MCPARAMID)( 4765 << 14)
+#define MC_WRF_Line13                            (MCPARAMID)( 4766 << 14)
+#define MC_WRF_Line13_GB                           1
+#define MC_WRF_Line13_BG                           2
+#define MC_WRF_Line13_RG                           3
+#define MC_WRF_Line13_GR                           4
+#define MC_WRF_XferSize03                        (MCPARAMID)( 4767 << 14)
+#define MC_WRF_XferSize13                        (MCPARAMID)( 4768 << 14)
+#define MC_WRF_XferSize23                        (MCPARAMID)( 4769 << 14)
+#define MC_WRF_XferSize33                        (MCPARAMID)( 4770 << 14)
+#define MC_WRF_TOIheight3                        (MCPARAMID)( 4771 << 14)
+#define MC_WRF_LastTOI3                          (MCPARAMID)( 4772 << 14)
+#define MC_WRF_LastTOI3_TRUE                       1
+#define MC_WRF_LastTOI3_FALSE                      2
+#define MC_WRF_TOIoffset3                        (MCPARAMID)( 4773 << 14)
+#define MC_WRF_TOIPitch3                         (MCPARAMID)( 4774 << 14)
+#define MC_WRF_NbOfLine3                         (MCPARAMID)( 4775 << 14)
+#define MC_WRF_1stLineRep4                       (MCPARAMID)( 4776 << 14)
+#define MC_WRF_1stLineRep4_ON                      1
+#define MC_WRF_1stLineRep4_OFF                     2
+#define MC_WRF_LastLineRep4                      (MCPARAMID)( 4777 << 14)
+#define MC_WRF_LastLineRep4_ON                     1
+#define MC_WRF_LastLineRep4_OFF                    2
+#define MC_WRF_1stColRep4                        (MCPARAMID)( 4778 << 14)
+#define MC_WRF_1stColRep4_ON                       1
+#define MC_WRF_1stColRep4_OFF                      2
+#define MC_WRF_LastColRep4                       (MCPARAMID)( 4779 << 14)
+#define MC_WRF_LastColRep4_ON                      1
+#define MC_WRF_LastColRep4_OFF                     2
+#define MC_WRF_ColumnIx4                         (MCPARAMID)( 4780 << 14)
+#define MC_WRF_TOIwidth4                         (MCPARAMID)( 4781 << 14)
+#define MC_ColorRegistrationTOI4                 (MCPARAMID)( 4782 << 14)
+#define MC_WRF_Line14                            (MCPARAMID)( 4783 << 14)
+#define MC_WRF_Line14_GB                           1
+#define MC_WRF_Line14_BG                           2
+#define MC_WRF_Line14_RG                           3
+#define MC_WRF_Line14_GR                           4
+#define MC_WRF_XferSize04                        (MCPARAMID)( 4784 << 14)
+#define MC_WRF_XferSize14                        (MCPARAMID)( 4785 << 14)
+#define MC_WRF_XferSize24                        (MCPARAMID)( 4786 << 14)
+#define MC_WRF_XferSize34                        (MCPARAMID)( 4787 << 14)
+#define MC_WRF_TOIheight4                        (MCPARAMID)( 4788 << 14)
+#define MC_WRF_LastTOI4                          (MCPARAMID)( 4789 << 14)
+#define MC_WRF_LastTOI4_TRUE                       1
+#define MC_WRF_LastTOI4_FALSE                      2
+#define MC_WRF_TOIoffset4                        (MCPARAMID)( 4790 << 14)
+#define MC_WRF_TOIPitch4                         (MCPARAMID)( 4791 << 14)
+#define MC_WRF_NbOfLine4                         (MCPARAMID)( 4792 << 14)
+#define MC_WRF_1stLineRep5                       (MCPARAMID)( 4793 << 14)
+#define MC_WRF_1stLineRep5_ON                      1
+#define MC_WRF_1stLineRep5_OFF                     2
+#define MC_WRF_LastLineRep5                      (MCPARAMID)( 4794 << 14)
+#define MC_WRF_LastLineRep5_ON                     1
+#define MC_WRF_LastLineRep5_OFF                    2
+#define MC_WRF_1stColRep5                        (MCPARAMID)( 4795 << 14)
+#define MC_WRF_1stColRep5_ON                       1
+#define MC_WRF_1stColRep5_OFF                      2
+#define MC_WRF_LastColRep5                       (MCPARAMID)( 4796 << 14)
+#define MC_WRF_LastColRep5_ON                      1
+#define MC_WRF_LastColRep5_OFF                     2
+#define MC_WRF_ColumnIx5                         (MCPARAMID)( 4797 << 14)
+#define MC_WRF_TOIwidth5                         (MCPARAMID)( 4798 << 14)
+#define MC_ColorRegistrationTOI5                 (MCPARAMID)( 4799 << 14)
+#define MC_WRF_Line15                            (MCPARAMID)( 4800 << 14)
+#define MC_WRF_Line15_GB                           1
+#define MC_WRF_Line15_BG                           2
+#define MC_WRF_Line15_RG                           3
+#define MC_WRF_Line15_GR                           4
+#define MC_WRF_XferSize05                        (MCPARAMID)( 4801 << 14)
+#define MC_WRF_XferSize15                        (MCPARAMID)( 4802 << 14)
+#define MC_WRF_XferSize25                        (MCPARAMID)( 4803 << 14)
+#define MC_WRF_XferSize35                        (MCPARAMID)( 4804 << 14)
+#define MC_WRF_TOIheight5                        (MCPARAMID)( 4805 << 14)
+#define MC_WRF_LastTOI5                          (MCPARAMID)( 4806 << 14)
+#define MC_WRF_LastTOI5_TRUE                       1
+#define MC_WRF_LastTOI5_FALSE                      2
+#define MC_WRF_TOIoffset5                        (MCPARAMID)( 4807 << 14)
+#define MC_WRF_TOIPitch5                         (MCPARAMID)( 4808 << 14)
+#define MC_WRF_NbOfLine5                         (MCPARAMID)( 4809 << 14)
+#define MC_WRF_1stLineRep6                       (MCPARAMID)( 4810 << 14)
+#define MC_WRF_1stLineRep6_ON                      1
+#define MC_WRF_1stLineRep6_OFF                     2
+#define MC_WRF_LastLineRep6                      (MCPARAMID)( 4811 << 14)
+#define MC_WRF_LastLineRep6_ON                     1
+#define MC_WRF_LastLineRep6_OFF                    2
+#define MC_WRF_1stColRep6                        (MCPARAMID)( 4812 << 14)
+#define MC_WRF_1stColRep6_ON                       1
+#define MC_WRF_1stColRep6_OFF                      2
+#define MC_WRF_LastColRep6                       (MCPARAMID)( 4813 << 14)
+#define MC_WRF_LastColRep6_ON                      1
+#define MC_WRF_LastColRep6_OFF                     2
+#define MC_WRF_ColumnIx6                         (MCPARAMID)( 4814 << 14)
+#define MC_WRF_TOIwidth6                         (MCPARAMID)( 4815 << 14)
+#define MC_ColorRegistrationTOI6                 (MCPARAMID)( 4816 << 14)
+#define MC_WRF_Line16                            (MCPARAMID)( 4817 << 14)
+#define MC_WRF_Line16_GB                           1
+#define MC_WRF_Line16_BG                           2
+#define MC_WRF_Line16_RG                           3
+#define MC_WRF_Line16_GR                           4
+#define MC_WRF_XferSize06                        (MCPARAMID)( 4818 << 14)
+#define MC_WRF_XferSize16                        (MCPARAMID)( 4819 << 14)
+#define MC_WRF_XferSize26                        (MCPARAMID)( 4820 << 14)
+#define MC_WRF_XferSize36                        (MCPARAMID)( 4821 << 14)
+#define MC_WRF_TOIheight6                        (MCPARAMID)( 4822 << 14)
+#define MC_WRF_LastTOI6                          (MCPARAMID)( 4823 << 14)
+#define MC_WRF_LastTOI6_TRUE                       1
+#define MC_WRF_LastTOI6_FALSE                      2
+#define MC_WRF_TOIoffset6                        (MCPARAMID)( 4824 << 14)
+#define MC_WRF_TOIPitch6                         (MCPARAMID)( 4825 << 14)
+#define MC_WRF_NbOfLine6                         (MCPARAMID)( 4826 << 14)
+#define MC_WRF_1stLineRep7                       (MCPARAMID)( 4827 << 14)
+#define MC_WRF_1stLineRep7_ON                      1
+#define MC_WRF_1stLineRep7_OFF                     2
+#define MC_WRF_LastLineRep7                      (MCPARAMID)( 4828 << 14)
+#define MC_WRF_LastLineRep7_ON                     1
+#define MC_WRF_LastLineRep7_OFF                    2
+#define MC_WRF_1stColRep7                        (MCPARAMID)( 4829 << 14)
+#define MC_WRF_1stColRep7_ON                       1
+#define MC_WRF_1stColRep7_OFF                      2
+#define MC_WRF_LastColRep7                       (MCPARAMID)( 4830 << 14)
+#define MC_WRF_LastColRep7_ON                      1
+#define MC_WRF_LastColRep7_OFF                     2
+#define MC_WRF_ColumnIx7                         (MCPARAMID)( 4831 << 14)
+#define MC_WRF_TOIwidth7                         (MCPARAMID)( 4832 << 14)
+#define MC_ColorRegistrationTOI7                 (MCPARAMID)( 4833 << 14)
+#define MC_WRF_Line17                            (MCPARAMID)( 4834 << 14)
+#define MC_WRF_Line17_GB                           1
+#define MC_WRF_Line17_BG                           2
+#define MC_WRF_Line17_RG                           3
+#define MC_WRF_Line17_GR                           4
+#define MC_WRF_XferSize07                        (MCPARAMID)( 4835 << 14)
+#define MC_WRF_XferSize17                        (MCPARAMID)( 4836 << 14)
+#define MC_WRF_XferSize27                        (MCPARAMID)( 4837 << 14)
+#define MC_WRF_XferSize37                        (MCPARAMID)( 4838 << 14)
+#define MC_WRF_TOIheight7                        (MCPARAMID)( 4839 << 14)
+#define MC_WRF_LastTOI7                          (MCPARAMID)( 4840 << 14)
+#define MC_WRF_LastTOI7_TRUE                       1
+#define MC_WRF_LastTOI7_FALSE                      2
+#define MC_WRF_TOIoffset7                        (MCPARAMID)( 4841 << 14)
+#define MC_WRF_TOIPitch7                         (MCPARAMID)( 4842 << 14)
+#define MC_WRF_NbOfLine7                         (MCPARAMID)( 4843 << 14)
+#define MC_WRF_XferSizeM100                      (MCPARAMID)( 4844 << 14)
+#define MC_WRF_XferSizeM110                      (MCPARAMID)( 4845 << 14)
+#define MC_WRF_XferSizeM120                      (MCPARAMID)( 4846 << 14)
+#define MC_WRF_XferSizeM130                      (MCPARAMID)( 4847 << 14)
+#define MC_WRF_XferSizeM101                      (MCPARAMID)( 4848 << 14)
+#define MC_WRF_XferSizeM111                      (MCPARAMID)( 4849 << 14)
+#define MC_WRF_XferSizeM121                      (MCPARAMID)( 4850 << 14)
+#define MC_WRF_XferSizeM131                      (MCPARAMID)( 4851 << 14)
+#define MC_WRF_XferSizeM102                      (MCPARAMID)( 4852 << 14)
+#define MC_WRF_XferSizeM112                      (MCPARAMID)( 4853 << 14)
+#define MC_WRF_XferSizeM122                      (MCPARAMID)( 4854 << 14)
+#define MC_WRF_XferSizeM132                      (MCPARAMID)( 4855 << 14)
+#define MC_WRF_XferSizeM103                      (MCPARAMID)( 4856 << 14)
+#define MC_WRF_XferSizeM113                      (MCPARAMID)( 4857 << 14)
+#define MC_WRF_XferSizeM123                      (MCPARAMID)( 4858 << 14)
+#define MC_WRF_XferSizeM133                      (MCPARAMID)( 4859 << 14)
+#define MC_WRF_XferSizeM104                      (MCPARAMID)( 4860 << 14)
+#define MC_WRF_XferSizeM114                      (MCPARAMID)( 4861 << 14)
+#define MC_WRF_XferSizeM124                      (MCPARAMID)( 4862 << 14)
+#define MC_WRF_XferSizeM134                      (MCPARAMID)( 4863 << 14)
+#define MC_WRF_XferSizeM105                      (MCPARAMID)( 4864 << 14)
+#define MC_WRF_XferSizeM115                      (MCPARAMID)( 4865 << 14)
+#define MC_WRF_XferSizeM125                      (MCPARAMID)( 4866 << 14)
+#define MC_WRF_XferSizeM135                      (MCPARAMID)( 4867 << 14)
+#define MC_WRF_XferSizeM106                      (MCPARAMID)( 4868 << 14)
+#define MC_WRF_XferSizeM116                      (MCPARAMID)( 4869 << 14)
+#define MC_WRF_XferSizeM126                      (MCPARAMID)( 4870 << 14)
+#define MC_WRF_XferSizeM136                      (MCPARAMID)( 4871 << 14)
+#define MC_WRF_XferSizeM107                      (MCPARAMID)( 4872 << 14)
+#define MC_WRF_XferSizeM117                      (MCPARAMID)( 4873 << 14)
+#define MC_WRF_XferSizeM127                      (MCPARAMID)( 4874 << 14)
+#define MC_WRF_XferSizeM137                      (MCPARAMID)( 4875 << 14)
+#define MC_SurfacePlaneName                      (MCPARAMID)( 4876 << 14)
+#define MC_SurfacePlaneName_UNUSED                 1
+#define MC_SurfacePlaneName_Y                      2
+#define MC_SurfacePlaneName_R                      3
+#define MC_SurfacePlaneName_G                      4
+#define MC_SurfacePlaneName_B                      5
+#define MC_SurfacePlaneName_RGB                    6
+#define MC_SurfacePlaneName_YRGB                   7
+#define MC_ColorRegistration_Filter              (MCPARAMID)( 4877 << 14)
+#define MC__ColorRegistration                    (MCPARAMID)( 4878 << 14)
+#define MC__ImageColorRegistration               (MCPARAMID)( 4879 << 14)
+#define MC__ColorRegistrationX                   (MCPARAMID)( 4880 << 14)
+#define MC__ColorRegistrationY                   (MCPARAMID)( 4881 << 14)
+#define MC__EnumParamName_                       (MCPARAMID)( 4882 << 14)
+#define MC__EnumParamName__GB                      1
+#define MC__EnumParamName__BG                      2
+#define MC__EnumParamName__RG                      3
+#define MC__EnumParamName__GR                      4
+#define MC__Filter_                              (MCPARAMID)( 4883 << 14)
+#define MC_GWColorRegistrationX                  (MCPARAMID)( 4884 << 14)
+#define MC_GWColorRegistrationY                  (MCPARAMID)( 4885 << 14)
+#define MC_ColorRegistration_TOI0X               (MCPARAMID)( 4886 << 14)
+#define MC_ColorRegistration_TOI0Y               (MCPARAMID)( 4887 << 14)
+#define MC_ColorRegistration_TOI1X               (MCPARAMID)( 4888 << 14)
+#define MC_ColorRegistration_TOI1Y               (MCPARAMID)( 4889 << 14)
+#define MC_ColorRegistration_TOI2X               (MCPARAMID)( 4890 << 14)
+#define MC_ColorRegistration_TOI2Y               (MCPARAMID)( 4891 << 14)
+#define MC_ColorRegistration_TOI3X               (MCPARAMID)( 4892 << 14)
+#define MC_ColorRegistration_TOI3Y               (MCPARAMID)( 4893 << 14)
+#define MC_ColorRegistration_TOI4X               (MCPARAMID)( 4894 << 14)
+#define MC_ColorRegistration_TOI4Y               (MCPARAMID)( 4895 << 14)
+#define MC_ColorRegistration_TOI5X               (MCPARAMID)( 4896 << 14)
+#define MC_ColorRegistration_TOI5Y               (MCPARAMID)( 4897 << 14)
+#define MC_ColorRegistration_TOI6X               (MCPARAMID)( 4898 << 14)
+#define MC_ColorRegistration_TOI6Y               (MCPARAMID)( 4899 << 14)
+#define MC_ColorRegistration_TOI7X               (MCPARAMID)( 4900 << 14)
+#define MC_ColorRegistration_TOI7Y               (MCPARAMID)( 4901 << 14)
+#define MC__ImageColorRegistrationX              (MCPARAMID)( 4902 << 14)
+#define MC__ImageColorRegistrationY              (MCPARAMID)( 4903 << 14)
+#define MC_ColorRegistrationX_TOI0               (MCPARAMID)( 4904 << 14)
+#define MC_ColorRegistrationY_TOI0               (MCPARAMID)( 4905 << 14)
+#define MC_ColorRegistrationX_TOI1               (MCPARAMID)( 4906 << 14)
+#define MC_ColorRegistrationY_TOI1               (MCPARAMID)( 4907 << 14)
+#define MC_ColorRegistrationX_TOI2               (MCPARAMID)( 4908 << 14)
+#define MC_ColorRegistrationY_TOI2               (MCPARAMID)( 4909 << 14)
+#define MC_ColorRegistrationX_TOI3               (MCPARAMID)( 4910 << 14)
+#define MC_ColorRegistrationY_TOI3               (MCPARAMID)( 4911 << 14)
+#define MC_ColorRegistrationX_TOI4               (MCPARAMID)( 4912 << 14)
+#define MC_ColorRegistrationY_TOI4               (MCPARAMID)( 4913 << 14)
+#define MC_ColorRegistrationX_TOI5               (MCPARAMID)( 4914 << 14)
+#define MC_ColorRegistrationY_TOI5               (MCPARAMID)( 4915 << 14)
+#define MC_ColorRegistrationX_TOI6               (MCPARAMID)( 4916 << 14)
+#define MC_ColorRegistrationY_TOI6               (MCPARAMID)( 4917 << 14)
+#define MC_ColorRegistrationX_TOI7               (MCPARAMID)( 4918 << 14)
+#define MC_ColorRegistrationY_TOI7               (MCPARAMID)( 4919 << 14)
+#define MC_FSS_FBSIZE                            (MCPARAMID)( 4920 << 14)
+#define MC_RightToiColumnFlag                    (MCPARAMID)( 4921 << 14)
+#define MC_RightToiColumnFlag_FALSE                1
+#define MC_RightToiColumnFlag_TRUE                 2
+#define MC_TOI_FSR_RightX                        (MCPARAMID)( 4922 << 14)
+#define MC_CPC_PPSB_DataTyp_PASSTHROUGH            7
+#define MC_Sampling                              (MCPARAMID)( 4923 << 14)
+#define MC_Sampling_SQUARE                         1
+#define MC_Sampling_BROADCAST                      2
+#define MC_Broadcast                             (MCPARAMID)( 4924 << 14)
+#define MC__IScale1000                           (MCPARAMID)( 4925 << 14)
+#define MC__XScale65536                          (MCPARAMID)( 4926 << 14)
+#define MC__XScale_Float                         (MCPARAMID)( 4927 << 14)
+#define MC__XScale_10000                         (MCPARAMID)( 4928 << 14)
+#define MC_StrobeCtl_SSRLY                         8
+#define MC_StrobeLine_OUT1                        19
+#define MC_StrobeLine_OUT2                        20
+#define MC_StrobeLine_OUT3                        21
+#define MC_StrobeLine_OUT4                        22
+#define MC__StrobeRate                           (MCPARAMID)( 4929 << 14)
+#define MC__StrobeRate_ANYFIELD                    1
+#define MC__StrobeRate_UPFIELD                     2
+#define MC__StrobeRate_DWFIELD                     3
+#define MC__STROBEDur_Filt                       (MCPARAMID)( 4930 << 14)
+#define MC__STROBEPos_Filt                       (MCPARAMID)( 4931 << 14)
+#define MC__STROBEAcc                            (MCPARAMID)( 4932 << 14)
+#define MC__STROBEGenOperating_                  (MCPARAMID)( 4933 << 14)
+#define MC__STROBEGenOperating__NORM               1
+#define MC__STROBEGenOperating__INVER              2
+#define MC__ST_EventGate                         (MCPARAMID)( 4934 << 14)
+#define MC__ST_EventGate_OFF                       1
+#define MC__ST_EventGate_EVENT1                    2
+#define MC__ST_EventGate_EVENT2                    3
+#define MC__ST_ParityGate                        (MCPARAMID)( 4935 << 14)
+#define MC__ST_ParityGate_ANY                      1
+#define MC__ST_ParityGate_UP                       2
+#define MC__ST_ParityGate_DOWN                     3
+#define MC__VField_Ln                            (MCPARAMID)( 4936 << 14)
+#define MC__ST_Time1_Ln                          (MCPARAMID)( 4937 << 14)
+#define MC_AccumulationMode                      (MCPARAMID)( 4938 << 14)
+#define MC_AccumulationMode_FLD                    1
+#define MC_AccumulationMode_FRAME                  2
+#define MC__ST_Time2_Ln                          (MCPARAMID)( 4939 << 14)
+#define MC_SEC_ST_EventGate                      (MCPARAMID)( 4940 << 14)
+#define MC_SEC_ST_ParityGate                     (MCPARAMID)( 4941 << 14)
+#define MC_SEC_ST_Time1                          (MCPARAMID)( 4942 << 14)
+#define MC_SEC_ST_Time2                          (MCPARAMID)( 4943 << 14)
+#define MC_BEC_SrcCAPM_CUpDown                     5
+#define MC_BEC_SrcCAPM_CDownUp                     6
+#define MC_FEC_CAPM_CUpDown                        5
+#define MC_FEC_CAPM_CDownUp                        6
+#define MC_TrigLine_I1                            23
+#define MC_TrigLine_I2                            24
+#define MC_TrigLine_I3                            25
+#define MC_TrigLine_I4                            26
+#define MC_EndTrigLine_I1                         19
+#define MC_EndTrigLine_I2                         20
+#define MC_EndTrigLine_I3                         21
+#define MC_EndTrigLine_I4                         22
+#define MC__InitTrigMode                         (MCPARAMID)( 4944 << 14)
+#define MC__InitTrigMode_SELFTRIG                  1
+#define MC__InitTrigMode_SOFTTRIG                  2
+#define MC__InitTrigMode_HARDTRIG                  3
+#define MC__InitTrigMode_COMBTRIG                  4
+#define MC__NextTrigMode_SELFTRIG                  5
+#define MC__NextTrigMode_SOFTTRIG                  6
+#define MC__NextTrigMode_HARDTRIG                  7
+#define MC__NextTrigMode_COMBTRIG                  8
+#define MC__HardTrigEvent                        (MCPARAMID)( 4945 << 14)
+#define MC__HardTrigEvent_GOHIGH                   1
+#define MC__HardTrigEvent_GOLOW                    2
+#define MC__HardTrigEvent_GOOPEN                   3
+#define MC__HardEndTrigEvent                     (MCPARAMID)( 4946 << 14)
+#define MC__HardEndTrigEvent_DISABLED              1
+#define MC__HardEndTrigEvent_GOHIGH                2
+#define MC__HardEndTrigEvent_GOLOW                 3
+#define MC__HardEndTrigEvent_GOOPEN                4
+#define MC__IO_Mask                              (MCPARAMID)( 4947 << 14)
+#define MC__IO_Mask_BLOCKING                       1
+#define MC__IO_Mask_NONBLOCKING                    2
+#define MC__TrigDelay_Fld                        (MCPARAMID)( 4948 << 14)
+#define MC__TrigLineUsed                         (MCPARAMID)( 4949 << 14)
+#define MC__TrigLineUsed_TRUE                      1
+#define MC__TrigLineUsed_FALSE                     2
+#define MC__EndTrigLineUsed                      (MCPARAMID)( 4950 << 14)
+#define MC__EndTrigLineUsed_TRUE                   1
+#define MC__EndTrigLineUsed_FALSE                  2
+#define MC__TrigDelayMin_us                      (MCPARAMID)( 4951 << 14)
+#define MC__TrigDelayMAX_us                      (MCPARAMID)( 4952 << 14)
+#define MC__FieldLength_us                       (MCPARAMID)( 4953 << 14)
+#define MC_TEC_SoftTrig                          (MCPARAMID)( 4954 << 14)
+#define MC_TEC_InitTrigMode                      (MCPARAMID)( 4955 << 14)
+#define MC_TEC_NextTrigMode                      (MCPARAMID)( 4956 << 14)
+#define MC_TEC_HardTrigEvent                     (MCPARAMID)( 4957 << 14)
+#define MC_TEC_HardEndTrigEvent                  (MCPARAMID)( 4958 << 14)
+#define MC_TEC_IO_Mask                           (MCPARAMID)( 4959 << 14)
+#define MC_TEC_TrigDelay_Fld                     (MCPARAMID)( 4960 << 14)
+#define MC__IO_LineReserved                      (MCPARAMID)( 4961 << 14)
+#define MC__IO_LineReserved_BLOCKING               1
+#define MC__IO_LineReserved_NONBLOCKING            2
+#define MC_TEC_IOLineReserved                    (MCPARAMID)( 4962 << 14)
+#define MC__IO_LineReserved_RESERVED               3
+#define MC__IO_LineReserved_NONRESERVED            4
+#define MC_StrobeLevel_CLOSED                      5
+#define MC_StrobeField                           (MCPARAMID)( 4963 << 14)
+#define MC_StrobeField_BOTH                        1
+#define MC_StrobeField_UP                          2
+#define MC_StrobeField_DW                          3
+#define MC_StrobeLine_NONE                        23
+#define MC_TrigLine_NONE                          27
+#define MC__ST_NPC_Time1_Ln                      (MCPARAMID)( 4964 << 14)
+#define MC__ST_NPC_Time2_Ln                      (MCPARAMID)( 4965 << 14)
+#define MC__NoPollingCover_Ln                    (MCPARAMID)( 4966 << 14)
+#define MC_SEC_ST_NPC_Time1                      (MCPARAMID)( 4967 << 14)
+#define MC_SEC_ST_NPC_Time2                      (MCPARAMID)( 4968 << 14)
+#define MC_LUT_Method                            (MCPARAMID)( 4969 << 14)
+#define MC_LUT_Method_RESPONSE_CONTROL             1
+#define MC_LUT_Method_EMPHASIS                     2
+#define MC_LUT_Method_THRESHOLD                    3
+#define MC_LUT_Method_TABLE                        4
+#define MC_LUT_Method_COLORSCAN                    5
+#define MC_LUT_Emphasis                          (MCPARAMID)( 4970 << 14)
+#define MC_LUT_SlicingLevel                      (MCPARAMID)( 4971 << 14)
+#define MC_LUT_SlicingBand                       (MCPARAMID)( 4972 << 14)
+#define MC_LUT_LightResponse                     (MCPARAMID)( 4973 << 14)
+#define MC_LUT_BandResponse                      (MCPARAMID)( 4974 << 14)
+#define MC_LUT_DarkResponse                      (MCPARAMID)( 4975 << 14)
+#define MC_TrigLineIndex_I1                        1
+#define MC_TrigLineIndex_I2                        2
+#define MC_TrigLineIndex_I3                        3
+#define MC_TrigLineIndex_I4                        4
+#define MC_TrigLineIndex_NONE                      5
+#define MC_EndTrigLineIndex_I1                     1
+#define MC_EndTrigLineIndex_I2                     2
+#define MC_EndTrigLineIndex_I3                     3
+#define MC_EndTrigLineIndex_I4                     4
+#define MC_EndTrigLineIndex_NONE                   5
+#define MC__IO_LineReservedForTrigger            (MCPARAMID)( 4976 << 14)
+#define MC__IO_LineReservedForTrigger_RESERVED     1
+#define MC__IO_LineReservedForTrigger_NONRESERVED   2
+#define MC_TEC_IOLineReservedForTrigger          (MCPARAMID)( 4977 << 14)
+#define MC_OldStandardFrameRate_Hz               (MCPARAMID)( 4978 << 14)
+#define MC_StandardFramesPerSecond_Int           (MCPARAMID)( 4979 << 14)
+#define MC__IsUpEnoughForGrabFieldFld            (MCPARAMID)( 4980 << 14)
+#define MC__IsUpEnoughForGrabFieldFld_YES          1
+#define MC__IsUpEnoughForGrabFieldFld_NO           2
+#define MC_CaptureRateDefault                    (MCPARAMID)( 4981 << 14)
+#define MC_WBC_MODE                              (MCPARAMID)( 4982 << 14)
+#define MC_WBC_MODE_NONE                           1
+#define MC_WBC_MODE_MANUAL                         2
+#define MC_WBC_MODE_ONCE                           3
+#define MC_WBC_MODE_CONTINUOUS                     4
+#define MC_WBC_HIGH_THRESHOLD                    (MCPARAMID)( 4983 << 14)
+#define MC_WBC_ERROR_THRESHOLD                   (MCPARAMID)( 4984 << 14)
+#define MC_MPC_MIN_PIXEL_COUNT                   (MCPARAMID)( 4985 << 14)
+#define MC_WBC_F                                 (MCPARAMID)( 4986 << 14)
+#define MC_WBC_F_OFF                               1
+#define MC_WBC_F_ON                                2
+#define MC__Category_CFA_AWB                      54
+#define MC__Category_CFA_AWB_Local                55
+#define MC__Category_CFA_AWB_LowLevel             56
+#define MC__Category_CFA_WhiteBalanceOperator     57
+#define MC__Category_CFA_WhiteBalanceOperator_Local  58
+#define MC__Category_CFA_WhiteBalanceOperator_LowLevel  59
+#define MC_ROIName_TOI_USR_CountX_Min            (MCPARAMID)( 4987 << 14)
+#define MC_ROIName_TOI_USR_CountX                (MCPARAMID)( 4988 << 14)
+#define MC_ROIName_TOI_USR_CountY                (MCPARAMID)( 4989 << 14)
+#define MC_ROIName_TOI_USR_Count                 (MCPARAMID)( 4990 << 14)
+#define MC_ROIName_TOI_USR_LastIndex             (MCPARAMID)( 4991 << 14)
+#define MC_ROIName_TOI_USR_Width                 (MCPARAMID)( 4992 << 14)
+#define MC_ROIName_TOI_USR_Height                (MCPARAMID)( 4993 << 14)
+#define MC_ROIName_TOI_USR_HeightLastRow         (MCPARAMID)( 4994 << 14)
+#define MC_ROIName_TOI_USR_FirstTOILastRowIndex  (MCPARAMID)( 4995 << 14)
+#define MC_ROIName_TOI_USR_Width_Px              (MCPARAMID)( 4996 << 14)
+#define MC_ROIName_TOI_USR_Height_Ln             (MCPARAMID)( 4997 << 14)
+#define MC_ROIName_TOI_USR_OrgX_Px               (MCPARAMID)( 4998 << 14)
+#define MC_ROIName_TOI_USR_OrgY_Ln               (MCPARAMID)( 4999 << 14)
+#define MC_XFR_TOI_USR_CountX_Min                (MCPARAMID)( 5000 << 14)
+#define MC_XFR_TOI_USR_CountX                    (MCPARAMID)( 5001 << 14)
+#define MC_XFR_TOI_USR_CountY                    (MCPARAMID)( 5002 << 14)
+#define MC_XFR_TOI_USR_Count                     (MCPARAMID)( 5003 << 14)
+#define MC_XFR_TOI_USR_LastIndex                 (MCPARAMID)( 5004 << 14)
+#define MC_XFR_TOI_USR_Width                     (MCPARAMID)( 5005 << 14)
+#define MC_XFR_TOI_USR_Height                    (MCPARAMID)( 5006 << 14)
+#define MC_XFR_TOI_USR_HeightLastRow             (MCPARAMID)( 5007 << 14)
+#define MC_XFR_TOI_USR_FirstTOILastRowIndex      (MCPARAMID)( 5008 << 14)
+#define MC_XFR_TOI_USR_Width_Px                  (MCPARAMID)( 5009 << 14)
+#define MC_XFR_TOI_USR_Height_Ln                 (MCPARAMID)( 5010 << 14)
+#define MC_XFR_TOI_USR_OrgX_Px                   (MCPARAMID)( 5011 << 14)
+#define MC_XFR_TOI_USR_OrgY_Ln                   (MCPARAMID)( 5012 << 14)
+#define MC_XFR_TOI_XFR_OrgX_Px                   (MCPARAMID)( 5013 << 14)
+#define MC_XFRTOI_XFR_OrgX_Px                    (MCPARAMID)( 5014 << 14)
+#define MC_XFRTOI_XFR_RightX_Px                  (MCPARAMID)( 5015 << 14)
+#define MC_XFRTOI_XFR_Width_Px                   (MCPARAMID)( 5016 << 14)
+#define MC_XFRTOI_XFR_OrgY_Ln                    (MCPARAMID)( 5017 << 14)
+#define MC_XFRTOI_XFR_BotY_Ln                    (MCPARAMID)( 5018 << 14)
+#define MC_XFRTOI_XFR_Height_Ln                  (MCPARAMID)( 5019 << 14)
+#define MC_XFRTOI_DMA_FifoSizeX_Px               (MCPARAMID)( 5020 << 14)
+#define MC_XFRTOI_DMA_FifoOffsetX_Px             (MCPARAMID)( 5021 << 14)
+#define MC_XFRTOI_DMA_BufferOffsetX_Px           (MCPARAMID)( 5022 << 14)
+#define MC_XFRTOI_DMA_FifoSizeY_Ln               (MCPARAMID)( 5023 << 14)
+#define MC_XFRTOI_DMA_FifoOffsetY_Ln             (MCPARAMID)( 5024 << 14)
+#define MC_XFRTOI_DMA_BufferOffsetY_Ln           (MCPARAMID)( 5025 << 14)
+#define MC_XFR_TOI_XFR_RightX_Px                 (MCPARAMID)( 5026 << 14)
+#define MC_XFR_TOI_XFR_Width_Px                  (MCPARAMID)( 5027 << 14)
+#define MC_XFR_TOI_XFR_OrgY_Ln                   (MCPARAMID)( 5028 << 14)
+#define MC_XFR_TOI_XFR_BotY_Ln                   (MCPARAMID)( 5029 << 14)
+#define MC_XFR_TOI_XFR_Height_Ln                 (MCPARAMID)( 5030 << 14)
+#define MC_XFR_TOI_DMA_FifoSizeX_Px              (MCPARAMID)( 5031 << 14)
+#define MC_XFR_TOI_DMA_FifoOffsetX_Px            (MCPARAMID)( 5032 << 14)
+#define MC_XFR_TOI_DMA_BufferOffsetX_Px          (MCPARAMID)( 5033 << 14)
+#define MC_XFR_TOI_DMA_FifoSizeY_Ln              (MCPARAMID)( 5034 << 14)
+#define MC_XFR_TOI_DMA_FifoOffsetY_Ln            (MCPARAMID)( 5035 << 14)
+#define MC_XFR_TOI_DMA_BufferOffsetY_Ln          (MCPARAMID)( 5036 << 14)
+#define MC_XFR__TOI_XFR_OrgX_Px                  (MCPARAMID)( 5037 << 14)
+#define MC_XFR_TOI_REF_OrgX_Px                   (MCPARAMID)( 5038 << 14)
+#define MC_XFR_TOI_REF_OrgY_Ln                   (MCPARAMID)( 5039 << 14)
+#define MC_XFR_TOI_REF_Width_Px                  (MCPARAMID)( 5040 << 14)
+#define MC_XFR_TOI_REF_Height_Ln                 (MCPARAMID)( 5041 << 14)
+#define MC_XFR_TOI_EXT_OrgX_Px                   (MCPARAMID)( 5042 << 14)
+#define MC_XFR_TOI_EXT_OrgY_Ln                   (MCPARAMID)( 5043 << 14)
+#define MC_XFR_TOI_EXT_Width_Px                  (MCPARAMID)( 5044 << 14)
+#define MC_XFR_TOI_EXT_Height_Ln                 (MCPARAMID)( 5045 << 14)
+#define MC_XFR_TOI_EXT_Right_Px                  (MCPARAMID)( 5046 << 14)
+#define MC_XFR_TOI_EXT_Bot_Ln                    (MCPARAMID)( 5047 << 14)
+#define MC_XFR_TOI_FSR_OrgX                      (MCPARAMID)( 5048 << 14)
+#define MC_XFR_TOI_FSR_RightX                    (MCPARAMID)( 5049 << 14)
+#define MC_XFR_TOI_FSR_Width                     (MCPARAMID)( 5050 << 14)
+#define MC_XFR_TOI_FSR_OrgY_Ln                   (MCPARAMID)( 5051 << 14)
+#define MC_XFR_TOI_FSR_Height_Ln                 (MCPARAMID)( 5052 << 14)
+#define MC_XFR_TOI_FSR_OrgX_Px                   (MCPARAMID)( 5053 << 14)
+#define MC_FifoSizeX0_Private                    (MCPARAMID)( 5054 << 14)
+#define MC_XFR_FifoSizeX0                        (MCPARAMID)( 5055 << 14)
+#define MC_XFR_FifoSizeX1                        (MCPARAMID)( 5056 << 14)
+#define MC_XFR_FifoSizeX2                        (MCPARAMID)( 5057 << 14)
+#define MC_XFR_FifoSizeX3                        (MCPARAMID)( 5058 << 14)
+#define MC_XferSizeX0_Private                    (MCPARAMID)( 5059 << 14)
+#define MC_XFR_XferSizeX0                        (MCPARAMID)( 5060 << 14)
+#define MC_XFR_XferSizeX1                        (MCPARAMID)( 5061 << 14)
+#define MC_XFR_XferSizeX2                        (MCPARAMID)( 5062 << 14)
+#define MC_XFR_XferSizeX3                        (MCPARAMID)( 5063 << 14)
+#define MC_XFR_FifoOffsetX0                      (MCPARAMID)( 5064 << 14)
+#define MC_XFR_FifoOffsetX1                      (MCPARAMID)( 5065 << 14)
+#define MC_XFR_FifoOffsetX2                      (MCPARAMID)( 5066 << 14)
+#define MC_XFR_FifoOffsetX3                      (MCPARAMID)( 5067 << 14)
+#define MC_XFR_BufferOffsetX0                    (MCPARAMID)( 5068 << 14)
+#define MC_XFR_BufferOffsetX1                    (MCPARAMID)( 5069 << 14)
+#define MC_XFR_BufferOffsetX2                    (MCPARAMID)( 5070 << 14)
+#define MC_XFR_BufferOffsetX3                    (MCPARAMID)( 5071 << 14)
+#define MC_FifoSizeY0_Private                    (MCPARAMID)( 5072 << 14)
+#define MC_XFR_FifoSizeY0                        (MCPARAMID)( 5073 << 14)
+#define MC_XFR_XferSizeY0                        (MCPARAMID)( 5074 << 14)
+#define MC_XFR_FifoOffsetY0                      (MCPARAMID)( 5075 << 14)
+#define MC_XFR_BufferOffsetY0                    (MCPARAMID)( 5076 << 14)
+#define MC_XF_ROI_TOI_USR_CountX_Min             (MCPARAMID)( 5077 << 14)
+#define MC_XF_ROI_TOI_USR_CountX                 (MCPARAMID)( 5078 << 14)
+#define MC_XF_ROI_TOI_USR_CountY                 (MCPARAMID)( 5079 << 14)
+#define MC_XF_ROI_TOI_USR_Count                  (MCPARAMID)( 5080 << 14)
+#define MC_XF_ROI_TOI_USR_LastIndex              (MCPARAMID)( 5081 << 14)
+#define MC_XF_ROI_TOI_USR_Width                  (MCPARAMID)( 5082 << 14)
+#define MC_XF_ROI_TOI_USR_Height                 (MCPARAMID)( 5083 << 14)
+#define MC_XF_ROI_TOI_USR_HeightLastRow          (MCPARAMID)( 5084 << 14)
+#define MC_XF_ROI_TOI_USR_FirstTOILastRowIndex   (MCPARAMID)( 5085 << 14)
+#define MC_XF_ROI_TOI_USR_Width_Px               (MCPARAMID)( 5086 << 14)
+#define MC_XF_ROI_TOI_USR_Height_Ln              (MCPARAMID)( 5087 << 14)
+#define MC_XF_ROI_TOI_USR_OrgX_Px                (MCPARAMID)( 5088 << 14)
+#define MC_XF_ROI_TOI_USR_OrgY_Ln                (MCPARAMID)( 5089 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgX_Px                (MCPARAMID)( 5090 << 14)
+#define MC_XF_ROI_TOI_XFR_RightX_Px              (MCPARAMID)( 5091 << 14)
+#define MC_XF_ROI_TOI_XFR_Width_Px               (MCPARAMID)( 5092 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgY_Ln                (MCPARAMID)( 5093 << 14)
+#define MC_XF_ROI_TOI_XFR_BotY_Ln                (MCPARAMID)( 5094 << 14)
+#define MC_XF_ROI_TOI_XFR_Height_Ln              (MCPARAMID)( 5095 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeX_Px           (MCPARAMID)( 5096 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetX_Px         (MCPARAMID)( 5097 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetX_Px       (MCPARAMID)( 5098 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeY_Ln           (MCPARAMID)( 5099 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetY_Ln         (MCPARAMID)( 5100 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetY_Ln       (MCPARAMID)( 5101 << 14)
+#define MC_XF_ROI_TOI_REF_OrgX_Px                (MCPARAMID)( 5102 << 14)
+#define MC_XF_ROI_TOI_REF_OrgY_Ln                (MCPARAMID)( 5103 << 14)
+#define MC_XF_ROI_TOI_REF_Width_Px               (MCPARAMID)( 5104 << 14)
+#define MC_XF_ROI_TOI_REF_Height_Ln              (MCPARAMID)( 5105 << 14)
+#define MC_XF_ROI_TOI_EXT_OrgX_Px                (MCPARAMID)( 5106 << 14)
+#define MC_XF_ROI_TOI_EXT_OrgY_Ln                (MCPARAMID)( 5107 << 14)
+#define MC_XF_ROI_TOI_EXT_Width_Px               (MCPARAMID)( 5108 << 14)
+#define MC_XF_ROI_TOI_EXT_Height_Ln              (MCPARAMID)( 5109 << 14)
+#define MC_XF_ROI_TOI_EXT_Right_Px               (MCPARAMID)( 5110 << 14)
+#define MC_XF_ROI_TOI_EXT_Bot_Ln                 (MCPARAMID)( 5111 << 14)
+#define MC_XF_ROI_TOI_FSR_OrgX                   (MCPARAMID)( 5112 << 14)
+#define MC_XF_ROI_TOI_FSR_RightX                 (MCPARAMID)( 5113 << 14)
+#define MC_XF_ROI_TOI_FSR_Width                  (MCPARAMID)( 5114 << 14)
+#define MC_XF_ROI_TOI_FSR_OrgY_Ln                (MCPARAMID)( 5115 << 14)
+#define MC_XF_ROI_TOI_FSR_Height_Ln              (MCPARAMID)( 5116 << 14)
+#define MC_XF_ROI_TOI_FSR_OrgX_Px                (MCPARAMID)( 5117 << 14)
+#define MC_AWB_ROI_TOI_USR_CountX_Min            (MCPARAMID)( 5118 << 14)
+#define MC_AWB_ROI_TOI_USR_CountX                (MCPARAMID)( 5119 << 14)
+#define MC_AWB_ROI_TOI_USR_CountY                (MCPARAMID)( 5120 << 14)
+#define MC_AWB_ROI_TOI_USR_Count                 (MCPARAMID)( 5121 << 14)
+#define MC_AWB_ROI_TOI_USR_LastIndex             (MCPARAMID)( 5122 << 14)
+#define MC_AWB_ROI_TOI_USR_Width                 (MCPARAMID)( 5123 << 14)
+#define MC_AWB_ROI_TOI_USR_Height                (MCPARAMID)( 5124 << 14)
+#define MC_AWB_ROI_TOI_USR_HeightLastRow         (MCPARAMID)( 5125 << 14)
+#define MC_AWB_ROI_TOI_USR_FirstTOILastRowIndex  (MCPARAMID)( 5126 << 14)
+#define MC_AWB_ROI_TOI_USR_Width_Px              (MCPARAMID)( 5127 << 14)
+#define MC_AWB_ROI_TOI_USR_Height_Ln             (MCPARAMID)( 5128 << 14)
+#define MC_AWB_ROI_TOI_USR_OrgX_Px               (MCPARAMID)( 5129 << 14)
+#define MC_XF_ROI_RightToiColumnFlag             (MCPARAMID)( 5130 << 14)
+#define MC_XF_ROI_RightToiColumnFlag_FALSE         1
+#define MC_XF_ROI_RightToiColumnFlag_TRUE          2
+#define MC_AWB_ROI_RightToiColumnFlag            (MCPARAMID)( 5131 << 14)
+#define MC_AWB_ROI_RightToiColumnFlag_FALSE        1
+#define MC_AWB_ROI_RightToiColumnFlag_TRUE         2
+#define MC_AWB_ROI_TOI_USR_OrgY_Ln               (MCPARAMID)( 5132 << 14)
+#define MC_AWB_ROI_TOI_XFR_OrgX_Px               (MCPARAMID)( 5133 << 14)
+#define MC_AWB_ROI_TOI_XFR_RightX_Px             (MCPARAMID)( 5134 << 14)
+#define MC_AWB_ROI_TOI_XFR_Width_Px              (MCPARAMID)( 5135 << 14)
+#define MC_AWB_ROI_TOI_XFR_OrgY_Ln               (MCPARAMID)( 5136 << 14)
+#define MC_AWB_ROI_TOI_XFR_BotY_Ln               (MCPARAMID)( 5137 << 14)
+#define MC_AWB_ROI_TOI_XFR_Height_Ln             (MCPARAMID)( 5138 << 14)
+#define MC_AWB_ROI_TOI_DMA_FifoSizeX_Px          (MCPARAMID)( 5139 << 14)
+#define MC_AWB_ROI_TOI_DMA_FifoOffsetX_Px        (MCPARAMID)( 5140 << 14)
+#define MC_AWB_ROI_TOI_DMA_BufferOffsetX_Px      (MCPARAMID)( 5141 << 14)
+#define MC_AWB_ROI_TOI_DMA_FifoSizeY_Ln          (MCPARAMID)( 5142 << 14)
+#define MC_AWB_ROI_TOI_DMA_FifoOffsetY_Ln        (MCPARAMID)( 5143 << 14)
+#define MC_AWB_ROI_TOI_DMA_BufferOffsetY_Ln      (MCPARAMID)( 5144 << 14)
+#define MC_AWB_ROI_TOI_REF_OrgX_Px               (MCPARAMID)( 5145 << 14)
+#define MC_AWB_ROI_TOI_REF_OrgY_Ln               (MCPARAMID)( 5146 << 14)
+#define MC_AWB_ROI_TOI_REF_Width_Px              (MCPARAMID)( 5147 << 14)
+#define MC_AWB_ROI_TOI_REF_Height_Ln             (MCPARAMID)( 5148 << 14)
+#define MC_AWB_ROI_TOI_EXT_OrgX_Px               (MCPARAMID)( 5149 << 14)
+#define MC_AWB_ROI_TOI_EXT_OrgY_Ln               (MCPARAMID)( 5150 << 14)
+#define MC_AWB_ROI_TOI_EXT_Width_Px              (MCPARAMID)( 5151 << 14)
+#define MC_AWB_ROI_TOI_EXT_Height_Ln             (MCPARAMID)( 5152 << 14)
+#define MC_AWB_ROI_TOI_EXT_Right_Px              (MCPARAMID)( 5153 << 14)
+#define MC_AWB_ROI_TOI_EXT_Bot_Ln                (MCPARAMID)( 5154 << 14)
+#define MC_AWB_ROI_TOI_FSR_OrgX                  (MCPARAMID)( 5155 << 14)
+#define MC_AWB_ROI_TOI_FSR_RightX                (MCPARAMID)( 5156 << 14)
+#define MC_AWB_ROI_TOI_FSR_Width                 (MCPARAMID)( 5157 << 14)
+#define MC_AWB_ROI_TOI_FSR_OrgY_Ln               (MCPARAMID)( 5158 << 14)
+#define MC_AWB_ROI_TOI_FSR_Height_Ln             (MCPARAMID)( 5159 << 14)
+#define MC_AWB_ROI_TOI_FSR_OrgX_Px               (MCPARAMID)( 5160 << 14)
+#define MC_XF_ROI_WRF_1stLineRep0                (MCPARAMID)( 5161 << 14)
+#define MC_XF_ROI_WRF_1stLineRep0_ON               1
+#define MC_XF_ROI_WRF_1stLineRep0_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep0               (MCPARAMID)( 5162 << 14)
+#define MC_XF_ROI_WRF_LastLineRep0_ON              1
+#define MC_XF_ROI_WRF_LastLineRep0_OFF             2
+#define MC_XF_ROI_WRF_1stColRep0                 (MCPARAMID)( 5163 << 14)
+#define MC_XF_ROI_WRF_1stColRep0_ON                1
+#define MC_XF_ROI_WRF_1stColRep0_OFF               2
+#define MC_XF_ROI_WRF_LastColRep0                (MCPARAMID)( 5164 << 14)
+#define MC_XF_ROI_WRF_LastColRep0_ON               1
+#define MC_XF_ROI_WRF_LastColRep0_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx0                  (MCPARAMID)( 5165 << 14)
+#define MC_XF_ROI_WRF_TOIwidth0                  (MCPARAMID)( 5166 << 14)
+#define MC_XF_ROI_WRF_Line10                     (MCPARAMID)( 5167 << 14)
+#define MC_XF_ROI_WRF_Line10_GB                    1
+#define MC_XF_ROI_WRF_Line10_BG                    2
+#define MC_XF_ROI_WRF_Line10_RG                    3
+#define MC_XF_ROI_WRF_Line10_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM100               (MCPARAMID)( 5168 << 14)
+#define MC_XF_ROI_WRF_XferSizeM110               (MCPARAMID)( 5169 << 14)
+#define MC_XF_ROI_WRF_XferSizeM120               (MCPARAMID)( 5170 << 14)
+#define MC_XF_ROI_WRF_XferSizeM130               (MCPARAMID)( 5171 << 14)
+#define MC_XF_ROI_WRF_TOIheight0                 (MCPARAMID)( 5172 << 14)
+#define MC_XF_ROI_WRF_LastTOI0                   (MCPARAMID)( 5173 << 14)
+#define MC_XF_ROI_WRF_LastTOI0_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI0_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset0                 (MCPARAMID)( 5174 << 14)
+#define MC_XF_ROI_WRF_TOIPitch0                  (MCPARAMID)( 5175 << 14)
+#define MC_XF_ROI_WRF_NbOfLine0                  (MCPARAMID)( 5176 << 14)
+#define MC_XF_ROI_WRF_1stLineRep1                (MCPARAMID)( 5177 << 14)
+#define MC_XF_ROI_WRF_1stLineRep1_ON               1
+#define MC_XF_ROI_WRF_1stLineRep1_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep1               (MCPARAMID)( 5178 << 14)
+#define MC_XF_ROI_WRF_LastLineRep1_ON              1
+#define MC_XF_ROI_WRF_LastLineRep1_OFF             2
+#define MC_XF_ROI_WRF_1stColRep1                 (MCPARAMID)( 5179 << 14)
+#define MC_XF_ROI_WRF_1stColRep1_ON                1
+#define MC_XF_ROI_WRF_1stColRep1_OFF               2
+#define MC_XF_ROI_WRF_LastColRep1                (MCPARAMID)( 5180 << 14)
+#define MC_XF_ROI_WRF_LastColRep1_ON               1
+#define MC_XF_ROI_WRF_LastColRep1_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx1                  (MCPARAMID)( 5181 << 14)
+#define MC_XF_ROI_WRF_TOIwidth1                  (MCPARAMID)( 5182 << 14)
+#define MC_XF_ROI_WRF_Line11                     (MCPARAMID)( 5183 << 14)
+#define MC_XF_ROI_WRF_Line11_GB                    1
+#define MC_XF_ROI_WRF_Line11_BG                    2
+#define MC_XF_ROI_WRF_Line11_RG                    3
+#define MC_XF_ROI_WRF_Line11_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM101               (MCPARAMID)( 5184 << 14)
+#define MC_XF_ROI_WRF_XferSizeM111               (MCPARAMID)( 5185 << 14)
+#define MC_XF_ROI_WRF_XferSizeM121               (MCPARAMID)( 5186 << 14)
+#define MC_XF_ROI_WRF_XferSizeM131               (MCPARAMID)( 5187 << 14)
+#define MC_XF_ROI_WRF_TOIheight1                 (MCPARAMID)( 5188 << 14)
+#define MC_XF_ROI_WRF_LastTOI1                   (MCPARAMID)( 5189 << 14)
+#define MC_XF_ROI_WRF_LastTOI1_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI1_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset1                 (MCPARAMID)( 5190 << 14)
+#define MC_XF_ROI_WRF_TOIPitch1                  (MCPARAMID)( 5191 << 14)
+#define MC_XF_ROI_WRF_NbOfLine1                  (MCPARAMID)( 5192 << 14)
+#define MC_XF_ROI_WRF_1stLineRep2                (MCPARAMID)( 5193 << 14)
+#define MC_XF_ROI_WRF_1stLineRep2_ON               1
+#define MC_XF_ROI_WRF_1stLineRep2_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep2               (MCPARAMID)( 5194 << 14)
+#define MC_XF_ROI_WRF_LastLineRep2_ON              1
+#define MC_XF_ROI_WRF_LastLineRep2_OFF             2
+#define MC_XF_ROI_WRF_1stColRep2                 (MCPARAMID)( 5195 << 14)
+#define MC_XF_ROI_WRF_1stColRep2_ON                1
+#define MC_XF_ROI_WRF_1stColRep2_OFF               2
+#define MC_XF_ROI_WRF_LastColRep2                (MCPARAMID)( 5196 << 14)
+#define MC_XF_ROI_WRF_LastColRep2_ON               1
+#define MC_XF_ROI_WRF_LastColRep2_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx2                  (MCPARAMID)( 5197 << 14)
+#define MC_XF_ROI_WRF_TOIwidth2                  (MCPARAMID)( 5198 << 14)
+#define MC_XF_ROI_WRF_Line12                     (MCPARAMID)( 5199 << 14)
+#define MC_XF_ROI_WRF_Line12_GB                    1
+#define MC_XF_ROI_WRF_Line12_BG                    2
+#define MC_XF_ROI_WRF_Line12_RG                    3
+#define MC_XF_ROI_WRF_Line12_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM102               (MCPARAMID)( 5200 << 14)
+#define MC_XF_ROI_WRF_XferSizeM112               (MCPARAMID)( 5201 << 14)
+#define MC_XF_ROI_WRF_XferSizeM122               (MCPARAMID)( 5202 << 14)
+#define MC_XF_ROI_WRF_XferSizeM132               (MCPARAMID)( 5203 << 14)
+#define MC_XF_ROI_WRF_TOIheight2                 (MCPARAMID)( 5204 << 14)
+#define MC_XF_ROI_WRF_LastTOI2                   (MCPARAMID)( 5205 << 14)
+#define MC_XF_ROI_WRF_LastTOI2_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI2_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset2                 (MCPARAMID)( 5206 << 14)
+#define MC_XF_ROI_WRF_TOIPitch2                  (MCPARAMID)( 5207 << 14)
+#define MC_XF_ROI_WRF_NbOfLine2                  (MCPARAMID)( 5208 << 14)
+#define MC_XF_ROI_WRF_1stLineRep3                (MCPARAMID)( 5209 << 14)
+#define MC_XF_ROI_WRF_1stLineRep3_ON               1
+#define MC_XF_ROI_WRF_1stLineRep3_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep3               (MCPARAMID)( 5210 << 14)
+#define MC_XF_ROI_WRF_LastLineRep3_ON              1
+#define MC_XF_ROI_WRF_LastLineRep3_OFF             2
+#define MC_XF_ROI_WRF_1stColRep3                 (MCPARAMID)( 5211 << 14)
+#define MC_XF_ROI_WRF_1stColRep3_ON                1
+#define MC_XF_ROI_WRF_1stColRep3_OFF               2
+#define MC_XF_ROI_WRF_LastColRep3                (MCPARAMID)( 5212 << 14)
+#define MC_XF_ROI_WRF_LastColRep3_ON               1
+#define MC_XF_ROI_WRF_LastColRep3_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx3                  (MCPARAMID)( 5213 << 14)
+#define MC_XF_ROI_WRF_TOIwidth3                  (MCPARAMID)( 5214 << 14)
+#define MC_XF_ROI_WRF_Line13                     (MCPARAMID)( 5215 << 14)
+#define MC_XF_ROI_WRF_Line13_GB                    1
+#define MC_XF_ROI_WRF_Line13_BG                    2
+#define MC_XF_ROI_WRF_Line13_RG                    3
+#define MC_XF_ROI_WRF_Line13_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM103               (MCPARAMID)( 5216 << 14)
+#define MC_XF_ROI_WRF_XferSizeM113               (MCPARAMID)( 5217 << 14)
+#define MC_XF_ROI_WRF_XferSizeM123               (MCPARAMID)( 5218 << 14)
+#define MC_XF_ROI_WRF_XferSizeM133               (MCPARAMID)( 5219 << 14)
+#define MC_XF_ROI_WRF_TOIheight3                 (MCPARAMID)( 5220 << 14)
+#define MC_XF_ROI_WRF_LastTOI3                   (MCPARAMID)( 5221 << 14)
+#define MC_XF_ROI_WRF_LastTOI3_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI3_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset3                 (MCPARAMID)( 5222 << 14)
+#define MC_XF_ROI_WRF_TOIPitch3                  (MCPARAMID)( 5223 << 14)
+#define MC_XF_ROI_WRF_NbOfLine3                  (MCPARAMID)( 5224 << 14)
+#define MC_XF_ROI_WRF_1stLineRep4                (MCPARAMID)( 5225 << 14)
+#define MC_XF_ROI_WRF_1stLineRep4_ON               1
+#define MC_XF_ROI_WRF_1stLineRep4_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep4               (MCPARAMID)( 5226 << 14)
+#define MC_XF_ROI_WRF_LastLineRep4_ON              1
+#define MC_XF_ROI_WRF_LastLineRep4_OFF             2
+#define MC_XF_ROI_WRF_1stColRep4                 (MCPARAMID)( 5227 << 14)
+#define MC_XF_ROI_WRF_1stColRep4_ON                1
+#define MC_XF_ROI_WRF_1stColRep4_OFF               2
+#define MC_XF_ROI_WRF_LastColRep4                (MCPARAMID)( 5228 << 14)
+#define MC_XF_ROI_WRF_LastColRep4_ON               1
+#define MC_XF_ROI_WRF_LastColRep4_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx4                  (MCPARAMID)( 5229 << 14)
+#define MC_XF_ROI_WRF_TOIwidth4                  (MCPARAMID)( 5230 << 14)
+#define MC_XF_ROI_WRF_Line14                     (MCPARAMID)( 5231 << 14)
+#define MC_XF_ROI_WRF_Line14_GB                    1
+#define MC_XF_ROI_WRF_Line14_BG                    2
+#define MC_XF_ROI_WRF_Line14_RG                    3
+#define MC_XF_ROI_WRF_Line14_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM104               (MCPARAMID)( 5232 << 14)
+#define MC_XF_ROI_WRF_XferSizeM114               (MCPARAMID)( 5233 << 14)
+#define MC_XF_ROI_WRF_XferSizeM124               (MCPARAMID)( 5234 << 14)
+#define MC_XF_ROI_WRF_XferSizeM134               (MCPARAMID)( 5235 << 14)
+#define MC_XF_ROI_WRF_TOIheight4                 (MCPARAMID)( 5236 << 14)
+#define MC_XF_ROI_WRF_LastTOI4                   (MCPARAMID)( 5237 << 14)
+#define MC_XF_ROI_WRF_LastTOI4_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI4_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset4                 (MCPARAMID)( 5238 << 14)
+#define MC_XF_ROI_WRF_TOIPitch4                  (MCPARAMID)( 5239 << 14)
+#define MC_XF_ROI_WRF_NbOfLine4                  (MCPARAMID)( 5240 << 14)
+#define MC_XF_ROI_WRF_1stLineRep5                (MCPARAMID)( 5241 << 14)
+#define MC_XF_ROI_WRF_1stLineRep5_ON               1
+#define MC_XF_ROI_WRF_1stLineRep5_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep5               (MCPARAMID)( 5242 << 14)
+#define MC_XF_ROI_WRF_LastLineRep5_ON              1
+#define MC_XF_ROI_WRF_LastLineRep5_OFF             2
+#define MC_XF_ROI_WRF_1stColRep5                 (MCPARAMID)( 5243 << 14)
+#define MC_XF_ROI_WRF_1stColRep5_ON                1
+#define MC_XF_ROI_WRF_1stColRep5_OFF               2
+#define MC_XF_ROI_WRF_LastColRep5                (MCPARAMID)( 5244 << 14)
+#define MC_XF_ROI_WRF_LastColRep5_ON               1
+#define MC_XF_ROI_WRF_LastColRep5_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx5                  (MCPARAMID)( 5245 << 14)
+#define MC_XF_ROI_WRF_TOIwidth5                  (MCPARAMID)( 5246 << 14)
+#define MC_XF_ROI_WRF_Line15                     (MCPARAMID)( 5247 << 14)
+#define MC_XF_ROI_WRF_Line15_GB                    1
+#define MC_XF_ROI_WRF_Line15_BG                    2
+#define MC_XF_ROI_WRF_Line15_RG                    3
+#define MC_XF_ROI_WRF_Line15_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM105               (MCPARAMID)( 5248 << 14)
+#define MC_XF_ROI_WRF_XferSizeM115               (MCPARAMID)( 5249 << 14)
+#define MC_XF_ROI_WRF_XferSizeM125               (MCPARAMID)( 5250 << 14)
+#define MC_XF_ROI_WRF_XferSizeM135               (MCPARAMID)( 5251 << 14)
+#define MC_XF_ROI_WRF_TOIheight5                 (MCPARAMID)( 5252 << 14)
+#define MC_XF_ROI_WRF_LastTOI5                   (MCPARAMID)( 5253 << 14)
+#define MC_XF_ROI_WRF_LastTOI5_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI5_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset5                 (MCPARAMID)( 5254 << 14)
+#define MC_XF_ROI_WRF_TOIPitch5                  (MCPARAMID)( 5255 << 14)
+#define MC_XF_ROI_WRF_NbOfLine5                  (MCPARAMID)( 5256 << 14)
+#define MC_XF_ROI_WRF_1stLineRep6                (MCPARAMID)( 5257 << 14)
+#define MC_XF_ROI_WRF_1stLineRep6_ON               1
+#define MC_XF_ROI_WRF_1stLineRep6_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep6               (MCPARAMID)( 5258 << 14)
+#define MC_XF_ROI_WRF_LastLineRep6_ON              1
+#define MC_XF_ROI_WRF_LastLineRep6_OFF             2
+#define MC_XF_ROI_WRF_1stColRep6                 (MCPARAMID)( 5259 << 14)
+#define MC_XF_ROI_WRF_1stColRep6_ON                1
+#define MC_XF_ROI_WRF_1stColRep6_OFF               2
+#define MC_XF_ROI_WRF_LastColRep6                (MCPARAMID)( 5260 << 14)
+#define MC_XF_ROI_WRF_LastColRep6_ON               1
+#define MC_XF_ROI_WRF_LastColRep6_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx6                  (MCPARAMID)( 5261 << 14)
+#define MC_XF_ROI_WRF_TOIwidth6                  (MCPARAMID)( 5262 << 14)
+#define MC_XF_ROI_WRF_Line16                     (MCPARAMID)( 5263 << 14)
+#define MC_XF_ROI_WRF_Line16_GB                    1
+#define MC_XF_ROI_WRF_Line16_BG                    2
+#define MC_XF_ROI_WRF_Line16_RG                    3
+#define MC_XF_ROI_WRF_Line16_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM106               (MCPARAMID)( 5264 << 14)
+#define MC_XF_ROI_WRF_XferSizeM116               (MCPARAMID)( 5265 << 14)
+#define MC_XF_ROI_WRF_XferSizeM126               (MCPARAMID)( 5266 << 14)
+#define MC_XF_ROI_WRF_XferSizeM136               (MCPARAMID)( 5267 << 14)
+#define MC_XF_ROI_WRF_TOIheight6                 (MCPARAMID)( 5268 << 14)
+#define MC_XF_ROI_WRF_LastTOI6                   (MCPARAMID)( 5269 << 14)
+#define MC_XF_ROI_WRF_LastTOI6_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI6_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset6                 (MCPARAMID)( 5270 << 14)
+#define MC_XF_ROI_WRF_TOIPitch6                  (MCPARAMID)( 5271 << 14)
+#define MC_XF_ROI_WRF_NbOfLine6                  (MCPARAMID)( 5272 << 14)
+#define MC_XF_ROI_WRF_1stLineRep7                (MCPARAMID)( 5273 << 14)
+#define MC_XF_ROI_WRF_1stLineRep7_ON               1
+#define MC_XF_ROI_WRF_1stLineRep7_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep7               (MCPARAMID)( 5274 << 14)
+#define MC_XF_ROI_WRF_LastLineRep7_ON              1
+#define MC_XF_ROI_WRF_LastLineRep7_OFF             2
+#define MC_XF_ROI_WRF_1stColRep7                 (MCPARAMID)( 5275 << 14)
+#define MC_XF_ROI_WRF_1stColRep7_ON                1
+#define MC_XF_ROI_WRF_1stColRep7_OFF               2
+#define MC_XF_ROI_WRF_LastColRep7                (MCPARAMID)( 5276 << 14)
+#define MC_XF_ROI_WRF_LastColRep7_ON               1
+#define MC_XF_ROI_WRF_LastColRep7_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx7                  (MCPARAMID)( 5277 << 14)
+#define MC_XF_ROI_WRF_TOIwidth7                  (MCPARAMID)( 5278 << 14)
+#define MC_XF_ROI_WRF_Line17                     (MCPARAMID)( 5279 << 14)
+#define MC_XF_ROI_WRF_Line17_GB                    1
+#define MC_XF_ROI_WRF_Line17_BG                    2
+#define MC_XF_ROI_WRF_Line17_RG                    3
+#define MC_XF_ROI_WRF_Line17_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM107               (MCPARAMID)( 5280 << 14)
+#define MC_XF_ROI_WRF_XferSizeM117               (MCPARAMID)( 5281 << 14)
+#define MC_XF_ROI_WRF_XferSizeM127               (MCPARAMID)( 5282 << 14)
+#define MC_XF_ROI_WRF_XferSizeM137               (MCPARAMID)( 5283 << 14)
+#define MC_XF_ROI_WRF_TOIheight7                 (MCPARAMID)( 5284 << 14)
+#define MC_XF_ROI_WRF_LastTOI7                   (MCPARAMID)( 5285 << 14)
+#define MC_XF_ROI_WRF_LastTOI7_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI7_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset7                 (MCPARAMID)( 5286 << 14)
+#define MC_XF_ROI_WRF_TOIPitch7                  (MCPARAMID)( 5287 << 14)
+#define MC_XF_ROI_WRF_NbOfLine7                  (MCPARAMID)( 5288 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep0               (MCPARAMID)( 5289 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep0_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep0_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep0              (MCPARAMID)( 5290 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep0_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep0_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep0                (MCPARAMID)( 5291 << 14)
+#define MC_AWB_ROI_WRF_1stColRep0_ON               1
+#define MC_AWB_ROI_WRF_1stColRep0_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep0               (MCPARAMID)( 5292 << 14)
+#define MC_AWB_ROI_WRF_LastColRep0_ON              1
+#define MC_AWB_ROI_WRF_LastColRep0_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx0                 (MCPARAMID)( 5293 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth0                 (MCPARAMID)( 5294 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI0        (MCPARAMID)( 5295 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI0        (MCPARAMID)( 5296 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI1        (MCPARAMID)( 5297 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI1        (MCPARAMID)( 5298 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI2        (MCPARAMID)( 5299 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI2        (MCPARAMID)( 5300 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI3        (MCPARAMID)( 5301 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI3        (MCPARAMID)( 5302 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI4        (MCPARAMID)( 5303 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI4        (MCPARAMID)( 5304 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI5        (MCPARAMID)( 5305 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI5        (MCPARAMID)( 5306 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI6        (MCPARAMID)( 5307 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI6        (MCPARAMID)( 5308 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI7        (MCPARAMID)( 5309 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI7        (MCPARAMID)( 5310 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI0       (MCPARAMID)( 5311 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI0       (MCPARAMID)( 5312 << 14)
+#define MC_AWB_ROI_WRF_Line10                    (MCPARAMID)( 5313 << 14)
+#define MC_AWB_ROI_WRF_Line10_GB                   1
+#define MC_AWB_ROI_WRF_Line10_BG                   2
+#define MC_AWB_ROI_WRF_Line10_RG                   3
+#define MC_AWB_ROI_WRF_Line10_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM100              (MCPARAMID)( 5314 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM110              (MCPARAMID)( 5315 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM120              (MCPARAMID)( 5316 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM130              (MCPARAMID)( 5317 << 14)
+#define MC_AWB_ROI_WRF_TOIheight0                (MCPARAMID)( 5318 << 14)
+#define MC_AWB_ROI_WRF_LastTOI0                  (MCPARAMID)( 5319 << 14)
+#define MC_AWB_ROI_WRF_LastTOI0_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI0_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset0                (MCPARAMID)( 5320 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch0                 (MCPARAMID)( 5321 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine0                 (MCPARAMID)( 5322 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep1               (MCPARAMID)( 5323 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep1_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep1_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep1              (MCPARAMID)( 5324 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep1_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep1_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep1                (MCPARAMID)( 5325 << 14)
+#define MC_AWB_ROI_WRF_1stColRep1_ON               1
+#define MC_AWB_ROI_WRF_1stColRep1_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep1               (MCPARAMID)( 5326 << 14)
+#define MC_AWB_ROI_WRF_LastColRep1_ON              1
+#define MC_AWB_ROI_WRF_LastColRep1_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx1                 (MCPARAMID)( 5327 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth1                 (MCPARAMID)( 5328 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI1       (MCPARAMID)( 5329 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI1       (MCPARAMID)( 5330 << 14)
+#define MC_AWB_ROI_WRF_Line11                    (MCPARAMID)( 5331 << 14)
+#define MC_AWB_ROI_WRF_Line11_GB                   1
+#define MC_AWB_ROI_WRF_Line11_BG                   2
+#define MC_AWB_ROI_WRF_Line11_RG                   3
+#define MC_AWB_ROI_WRF_Line11_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM101              (MCPARAMID)( 5332 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM111              (MCPARAMID)( 5333 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM121              (MCPARAMID)( 5334 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM131              (MCPARAMID)( 5335 << 14)
+#define MC_AWB_ROI_WRF_TOIheight1                (MCPARAMID)( 5336 << 14)
+#define MC_AWB_ROI_WRF_LastTOI1                  (MCPARAMID)( 5337 << 14)
+#define MC_AWB_ROI_WRF_LastTOI1_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI1_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset1                (MCPARAMID)( 5338 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch1                 (MCPARAMID)( 5339 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine1                 (MCPARAMID)( 5340 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep2               (MCPARAMID)( 5341 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep2_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep2_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep2              (MCPARAMID)( 5342 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep2_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep2_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep2                (MCPARAMID)( 5343 << 14)
+#define MC_AWB_ROI_WRF_1stColRep2_ON               1
+#define MC_AWB_ROI_WRF_1stColRep2_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep2               (MCPARAMID)( 5344 << 14)
+#define MC_AWB_ROI_WRF_LastColRep2_ON              1
+#define MC_AWB_ROI_WRF_LastColRep2_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx2                 (MCPARAMID)( 5345 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth2                 (MCPARAMID)( 5346 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI2       (MCPARAMID)( 5347 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI2       (MCPARAMID)( 5348 << 14)
+#define MC_AWB_ROI_WRF_Line12                    (MCPARAMID)( 5349 << 14)
+#define MC_AWB_ROI_WRF_Line12_GB                   1
+#define MC_AWB_ROI_WRF_Line12_BG                   2
+#define MC_AWB_ROI_WRF_Line12_RG                   3
+#define MC_AWB_ROI_WRF_Line12_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM102              (MCPARAMID)( 5350 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM112              (MCPARAMID)( 5351 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM122              (MCPARAMID)( 5352 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM132              (MCPARAMID)( 5353 << 14)
+#define MC_AWB_ROI_WRF_TOIheight2                (MCPARAMID)( 5354 << 14)
+#define MC_AWB_ROI_WRF_LastTOI2                  (MCPARAMID)( 5355 << 14)
+#define MC_AWB_ROI_WRF_LastTOI2_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI2_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset2                (MCPARAMID)( 5356 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch2                 (MCPARAMID)( 5357 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine2                 (MCPARAMID)( 5358 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep3               (MCPARAMID)( 5359 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep3_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep3_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep3              (MCPARAMID)( 5360 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep3_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep3_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep3                (MCPARAMID)( 5361 << 14)
+#define MC_AWB_ROI_WRF_1stColRep3_ON               1
+#define MC_AWB_ROI_WRF_1stColRep3_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep3               (MCPARAMID)( 5362 << 14)
+#define MC_AWB_ROI_WRF_LastColRep3_ON              1
+#define MC_AWB_ROI_WRF_LastColRep3_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx3                 (MCPARAMID)( 5363 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth3                 (MCPARAMID)( 5364 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI3       (MCPARAMID)( 5365 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI3       (MCPARAMID)( 5366 << 14)
+#define MC_AWB_ROI_WRF_Line13                    (MCPARAMID)( 5367 << 14)
+#define MC_AWB_ROI_WRF_Line13_GB                   1
+#define MC_AWB_ROI_WRF_Line13_BG                   2
+#define MC_AWB_ROI_WRF_Line13_RG                   3
+#define MC_AWB_ROI_WRF_Line13_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM103              (MCPARAMID)( 5368 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM113              (MCPARAMID)( 5369 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM123              (MCPARAMID)( 5370 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM133              (MCPARAMID)( 5371 << 14)
+#define MC_AWB_ROI_WRF_TOIheight3                (MCPARAMID)( 5372 << 14)
+#define MC_AWB_ROI_WRF_LastTOI3                  (MCPARAMID)( 5373 << 14)
+#define MC_AWB_ROI_WRF_LastTOI3_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI3_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset3                (MCPARAMID)( 5374 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch3                 (MCPARAMID)( 5375 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine3                 (MCPARAMID)( 5376 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep4               (MCPARAMID)( 5377 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep4_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep4_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep4              (MCPARAMID)( 5378 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep4_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep4_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep4                (MCPARAMID)( 5379 << 14)
+#define MC_AWB_ROI_WRF_1stColRep4_ON               1
+#define MC_AWB_ROI_WRF_1stColRep4_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep4               (MCPARAMID)( 5380 << 14)
+#define MC_AWB_ROI_WRF_LastColRep4_ON              1
+#define MC_AWB_ROI_WRF_LastColRep4_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx4                 (MCPARAMID)( 5381 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth4                 (MCPARAMID)( 5382 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI4       (MCPARAMID)( 5383 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI4       (MCPARAMID)( 5384 << 14)
+#define MC_AWB_ROI_WRF_Line14                    (MCPARAMID)( 5385 << 14)
+#define MC_AWB_ROI_WRF_Line14_GB                   1
+#define MC_AWB_ROI_WRF_Line14_BG                   2
+#define MC_AWB_ROI_WRF_Line14_RG                   3
+#define MC_AWB_ROI_WRF_Line14_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM104              (MCPARAMID)( 5386 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM114              (MCPARAMID)( 5387 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM124              (MCPARAMID)( 5388 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM134              (MCPARAMID)( 5389 << 14)
+#define MC_AWB_ROI_WRF_TOIheight4                (MCPARAMID)( 5390 << 14)
+#define MC_AWB_ROI_WRF_LastTOI4                  (MCPARAMID)( 5391 << 14)
+#define MC_AWB_ROI_WRF_LastTOI4_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI4_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset4                (MCPARAMID)( 5392 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch4                 (MCPARAMID)( 5393 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine4                 (MCPARAMID)( 5394 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep5               (MCPARAMID)( 5395 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep5_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep5_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep5              (MCPARAMID)( 5396 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep5_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep5_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep5                (MCPARAMID)( 5397 << 14)
+#define MC_AWB_ROI_WRF_1stColRep5_ON               1
+#define MC_AWB_ROI_WRF_1stColRep5_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep5               (MCPARAMID)( 5398 << 14)
+#define MC_AWB_ROI_WRF_LastColRep5_ON              1
+#define MC_AWB_ROI_WRF_LastColRep5_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx5                 (MCPARAMID)( 5399 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth5                 (MCPARAMID)( 5400 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI5       (MCPARAMID)( 5401 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI5       (MCPARAMID)( 5402 << 14)
+#define MC_AWB_ROI_WRF_Line15                    (MCPARAMID)( 5403 << 14)
+#define MC_AWB_ROI_WRF_Line15_GB                   1
+#define MC_AWB_ROI_WRF_Line15_BG                   2
+#define MC_AWB_ROI_WRF_Line15_RG                   3
+#define MC_AWB_ROI_WRF_Line15_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM105              (MCPARAMID)( 5404 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM115              (MCPARAMID)( 5405 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM125              (MCPARAMID)( 5406 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM135              (MCPARAMID)( 5407 << 14)
+#define MC_AWB_ROI_WRF_TOIheight5                (MCPARAMID)( 5408 << 14)
+#define MC_AWB_ROI_WRF_LastTOI5                  (MCPARAMID)( 5409 << 14)
+#define MC_AWB_ROI_WRF_LastTOI5_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI5_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset5                (MCPARAMID)( 5410 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch5                 (MCPARAMID)( 5411 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine5                 (MCPARAMID)( 5412 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep6               (MCPARAMID)( 5413 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep6_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep6_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep6              (MCPARAMID)( 5414 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep6_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep6_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep6                (MCPARAMID)( 5415 << 14)
+#define MC_AWB_ROI_WRF_1stColRep6_ON               1
+#define MC_AWB_ROI_WRF_1stColRep6_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep6               (MCPARAMID)( 5416 << 14)
+#define MC_AWB_ROI_WRF_LastColRep6_ON              1
+#define MC_AWB_ROI_WRF_LastColRep6_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx6                 (MCPARAMID)( 5417 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth6                 (MCPARAMID)( 5418 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI6       (MCPARAMID)( 5419 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI6       (MCPARAMID)( 5420 << 14)
+#define MC_AWB_ROI_WRF_Line16                    (MCPARAMID)( 5421 << 14)
+#define MC_AWB_ROI_WRF_Line16_GB                   1
+#define MC_AWB_ROI_WRF_Line16_BG                   2
+#define MC_AWB_ROI_WRF_Line16_RG                   3
+#define MC_AWB_ROI_WRF_Line16_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM106              (MCPARAMID)( 5422 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM116              (MCPARAMID)( 5423 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM126              (MCPARAMID)( 5424 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM136              (MCPARAMID)( 5425 << 14)
+#define MC_AWB_ROI_WRF_TOIheight6                (MCPARAMID)( 5426 << 14)
+#define MC_AWB_ROI_WRF_LastTOI6                  (MCPARAMID)( 5427 << 14)
+#define MC_AWB_ROI_WRF_LastTOI6_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI6_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset6                (MCPARAMID)( 5428 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch6                 (MCPARAMID)( 5429 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine6                 (MCPARAMID)( 5430 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep7               (MCPARAMID)( 5431 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep7_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep7_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep7              (MCPARAMID)( 5432 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep7_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep7_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep7                (MCPARAMID)( 5433 << 14)
+#define MC_AWB_ROI_WRF_1stColRep7_ON               1
+#define MC_AWB_ROI_WRF_1stColRep7_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep7               (MCPARAMID)( 5434 << 14)
+#define MC_AWB_ROI_WRF_LastColRep7_ON              1
+#define MC_AWB_ROI_WRF_LastColRep7_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx7                 (MCPARAMID)( 5435 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth7                 (MCPARAMID)( 5436 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI7       (MCPARAMID)( 5437 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI7       (MCPARAMID)( 5438 << 14)
+#define MC_AWB_ROI_WRF_Line17                    (MCPARAMID)( 5439 << 14)
+#define MC_AWB_ROI_WRF_Line17_GB                   1
+#define MC_AWB_ROI_WRF_Line17_BG                   2
+#define MC_AWB_ROI_WRF_Line17_RG                   3
+#define MC_AWB_ROI_WRF_Line17_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM107              (MCPARAMID)( 5440 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM117              (MCPARAMID)( 5441 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM127              (MCPARAMID)( 5442 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM137              (MCPARAMID)( 5443 << 14)
+#define MC_AWB_ROI_WRF_TOIheight7                (MCPARAMID)( 5444 << 14)
+#define MC_AWB_ROI_WRF_LastTOI7                  (MCPARAMID)( 5445 << 14)
+#define MC_AWB_ROI_WRF_LastTOI7_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI7_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset7                (MCPARAMID)( 5446 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch7                 (MCPARAMID)( 5447 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine7                 (MCPARAMID)( 5448 << 14)
+#define MC_WBO_OrgX                              (MCPARAMID)( 5449 << 14)
+#define MC_WBO_OrgX_Max                          (MCPARAMID)( 5450 << 14)
+#define MC_WBO_OrgX_Check                        (MCPARAMID)( 5451 << 14)
+#define MC_WBO_OrgX_Check_PASS                     1
+#define MC_WBO_OrgX_Check_FAIL                     2
+#define MC_WBO_OrgY                              (MCPARAMID)( 5452 << 14)
+#define MC_WBO_OrgY_Max                          (MCPARAMID)( 5453 << 14)
+#define MC_WBO_OrgY_Check                        (MCPARAMID)( 5454 << 14)
+#define MC_WBO_OrgY_Check_PASS                     1
+#define MC_WBO_OrgY_Check_FAIL                     2
+#define MC_WBO_AWB_AREA_Filter                   (MCPARAMID)( 5455 << 14)
+#define MC_WBO_Width                             (MCPARAMID)( 5456 << 14)
+#define MC_WBO_Width_Max                         (MCPARAMID)( 5457 << 14)
+#define MC_WBO_Width_Check                       (MCPARAMID)( 5458 << 14)
+#define MC_WBO_Width_Check_PASS                    1
+#define MC_WBO_Width_Check_FAIL                    2
+#define MC_WBO_Height                            (MCPARAMID)( 5459 << 14)
+#define MC_WBO_Height_Max                        (MCPARAMID)( 5460 << 14)
+#define MC_WBO_Height_Check                      (MCPARAMID)( 5461 << 14)
+#define MC_WBO_Height_Check_PASS                   1
+#define MC_WBO_Height_Check_FAIL                   2
+#define MC__Category_CFA_TOIExtractor             60
+#define MC__Category_CFA_TOIExtractor_Local       61
+#define MC__Category_CFA_TOIExtractor_LowLevel    62
+#define MC_XF_ROI_TOI_USR_WidthLastCol           (MCPARAMID)( 5462 << 14)
+#define MC_AWB_ROI_TOI_USR_WidthLastCol          (MCPARAMID)( 5463 << 14)
+#define MC_XF_ROI_TOI_USR_LastColFlag            (MCPARAMID)( 5464 << 14)
+#define MC_XF_ROI_TOI_USR_LastColFlag_YES          1
+#define MC_XF_ROI_TOI_USR_LastColFlag_NO           2
+#define MC_AWB_ROI_TOI_USR_LastColFlag           (MCPARAMID)( 5465 << 14)
+#define MC_AWB_ROI_TOI_USR_LastColFlag_YES         1
+#define MC_AWB_ROI_TOI_USR_LastColFlag_NO          2
+#define MC_XF_ROIOrgX                            (MCPARAMID)( 5466 << 14)
+#define MC_XF_ROIOrgY                            (MCPARAMID)( 5467 << 14)
+#define MC_AWB_ROIOrgX                           (MCPARAMID)( 5468 << 14)
+#define MC_AWB_ROIOrgY                           (MCPARAMID)( 5469 << 14)
+#define MC_WBO_AWB_AREA_Check_Filter             (MCPARAMID)( 5470 << 14)
+#define MC_XF_ROI_WRF_1stLineRep8                (MCPARAMID)( 5471 << 14)
+#define MC_XF_ROI_WRF_1stLineRep8_ON               1
+#define MC_XF_ROI_WRF_1stLineRep8_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep8               (MCPARAMID)( 5472 << 14)
+#define MC_XF_ROI_WRF_LastLineRep8_ON              1
+#define MC_XF_ROI_WRF_LastLineRep8_OFF             2
+#define MC_XF_ROI_WRF_1stColRep8                 (MCPARAMID)( 5473 << 14)
+#define MC_XF_ROI_WRF_1stColRep8_ON                1
+#define MC_XF_ROI_WRF_1stColRep8_OFF               2
+#define MC_XF_ROI_WRF_LastColRep8                (MCPARAMID)( 5474 << 14)
+#define MC_XF_ROI_WRF_LastColRep8_ON               1
+#define MC_XF_ROI_WRF_LastColRep8_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx8                  (MCPARAMID)( 5475 << 14)
+#define MC_XF_ROI_WRF_TOIwidth8                  (MCPARAMID)( 5476 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI8        (MCPARAMID)( 5477 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI8        (MCPARAMID)( 5478 << 14)
+#define MC_XF_ROI_WRF_Line18                     (MCPARAMID)( 5479 << 14)
+#define MC_XF_ROI_WRF_Line18_GB                    1
+#define MC_XF_ROI_WRF_Line18_BG                    2
+#define MC_XF_ROI_WRF_Line18_RG                    3
+#define MC_XF_ROI_WRF_Line18_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM108               (MCPARAMID)( 5480 << 14)
+#define MC_XF_ROI_WRF_XferSizeM118               (MCPARAMID)( 5481 << 14)
+#define MC_XF_ROI_WRF_XferSizeM128               (MCPARAMID)( 5482 << 14)
+#define MC_XF_ROI_WRF_XferSizeM138               (MCPARAMID)( 5483 << 14)
+#define MC_XF_ROI_WRF_TOIheight8                 (MCPARAMID)( 5484 << 14)
+#define MC_XF_ROI_WRF_LastTOI8                   (MCPARAMID)( 5485 << 14)
+#define MC_XF_ROI_WRF_LastTOI8_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI8_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset8                 (MCPARAMID)( 5486 << 14)
+#define MC_XF_ROI_WRF_TOIPitch8                  (MCPARAMID)( 5487 << 14)
+#define MC_XF_ROI_WRF_NbOfLine8                  (MCPARAMID)( 5488 << 14)
+#define MC_XF_ROI_WRF_1stLineRep9                (MCPARAMID)( 5489 << 14)
+#define MC_XF_ROI_WRF_1stLineRep9_ON               1
+#define MC_XF_ROI_WRF_1stLineRep9_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep9               (MCPARAMID)( 5490 << 14)
+#define MC_XF_ROI_WRF_LastLineRep9_ON              1
+#define MC_XF_ROI_WRF_LastLineRep9_OFF             2
+#define MC_XF_ROI_WRF_1stColRep9                 (MCPARAMID)( 5491 << 14)
+#define MC_XF_ROI_WRF_1stColRep9_ON                1
+#define MC_XF_ROI_WRF_1stColRep9_OFF               2
+#define MC_XF_ROI_WRF_LastColRep9                (MCPARAMID)( 5492 << 14)
+#define MC_XF_ROI_WRF_LastColRep9_ON               1
+#define MC_XF_ROI_WRF_LastColRep9_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx9                  (MCPARAMID)( 5493 << 14)
+#define MC_XF_ROI_WRF_TOIwidth9                  (MCPARAMID)( 5494 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI9        (MCPARAMID)( 5495 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI9        (MCPARAMID)( 5496 << 14)
+#define MC_XF_ROI_WRF_Line19                     (MCPARAMID)( 5497 << 14)
+#define MC_XF_ROI_WRF_Line19_GB                    1
+#define MC_XF_ROI_WRF_Line19_BG                    2
+#define MC_XF_ROI_WRF_Line19_RG                    3
+#define MC_XF_ROI_WRF_Line19_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM109               (MCPARAMID)( 5498 << 14)
+#define MC_XF_ROI_WRF_XferSizeM119               (MCPARAMID)( 5499 << 14)
+#define MC_XF_ROI_WRF_XferSizeM129               (MCPARAMID)( 5500 << 14)
+#define MC_XF_ROI_WRF_XferSizeM139               (MCPARAMID)( 5501 << 14)
+#define MC_XF_ROI_WRF_TOIheight9                 (MCPARAMID)( 5502 << 14)
+#define MC_XF_ROI_WRF_LastTOI9                   (MCPARAMID)( 5503 << 14)
+#define MC_XF_ROI_WRF_LastTOI9_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI9_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset9                 (MCPARAMID)( 5504 << 14)
+#define MC_XF_ROI_WRF_TOIPitch9                  (MCPARAMID)( 5505 << 14)
+#define MC_XF_ROI_WRF_NbOfLine9                  (MCPARAMID)( 5506 << 14)
+#define MC_XF_ROI_WRF_1stLineRep10               (MCPARAMID)( 5507 << 14)
+#define MC_XF_ROI_WRF_1stLineRep10_ON              1
+#define MC_XF_ROI_WRF_1stLineRep10_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep10              (MCPARAMID)( 5508 << 14)
+#define MC_XF_ROI_WRF_LastLineRep10_ON             1
+#define MC_XF_ROI_WRF_LastLineRep10_OFF            2
+#define MC_XF_ROI_WRF_1stColRep10                (MCPARAMID)( 5509 << 14)
+#define MC_XF_ROI_WRF_1stColRep10_ON               1
+#define MC_XF_ROI_WRF_1stColRep10_OFF              2
+#define MC_XF_ROI_WRF_LastColRep10               (MCPARAMID)( 5510 << 14)
+#define MC_XF_ROI_WRF_LastColRep10_ON              1
+#define MC_XF_ROI_WRF_LastColRep10_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx10                 (MCPARAMID)( 5511 << 14)
+#define MC_XF_ROI_WRF_TOIwidth10                 (MCPARAMID)( 5512 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI10       (MCPARAMID)( 5513 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI10       (MCPARAMID)( 5514 << 14)
+#define MC_XF_ROI_WRF_Line110                    (MCPARAMID)( 5515 << 14)
+#define MC_XF_ROI_WRF_Line110_GB                   1
+#define MC_XF_ROI_WRF_Line110_BG                   2
+#define MC_XF_ROI_WRF_Line110_RG                   3
+#define MC_XF_ROI_WRF_Line110_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1010              (MCPARAMID)( 5516 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1110              (MCPARAMID)( 5517 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1210              (MCPARAMID)( 5518 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1310              (MCPARAMID)( 5519 << 14)
+#define MC_XF_ROI_WRF_TOIheight10                (MCPARAMID)( 5520 << 14)
+#define MC_XF_ROI_WRF_LastTOI10                  (MCPARAMID)( 5521 << 14)
+#define MC_XF_ROI_WRF_LastTOI10_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI10_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset10                (MCPARAMID)( 5522 << 14)
+#define MC_XF_ROI_WRF_TOIPitch10                 (MCPARAMID)( 5523 << 14)
+#define MC_XF_ROI_WRF_NbOfLine10                 (MCPARAMID)( 5524 << 14)
+#define MC_XF_ROI_WRF_1stLineRep11               (MCPARAMID)( 5525 << 14)
+#define MC_XF_ROI_WRF_1stLineRep11_ON              1
+#define MC_XF_ROI_WRF_1stLineRep11_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep11              (MCPARAMID)( 5526 << 14)
+#define MC_XF_ROI_WRF_LastLineRep11_ON             1
+#define MC_XF_ROI_WRF_LastLineRep11_OFF            2
+#define MC_XF_ROI_WRF_1stColRep11                (MCPARAMID)( 5527 << 14)
+#define MC_XF_ROI_WRF_1stColRep11_ON               1
+#define MC_XF_ROI_WRF_1stColRep11_OFF              2
+#define MC_XF_ROI_WRF_LastColRep11               (MCPARAMID)( 5528 << 14)
+#define MC_XF_ROI_WRF_LastColRep11_ON              1
+#define MC_XF_ROI_WRF_LastColRep11_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx11                 (MCPARAMID)( 5529 << 14)
+#define MC_XF_ROI_WRF_TOIwidth11                 (MCPARAMID)( 5530 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI11       (MCPARAMID)( 5531 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI11       (MCPARAMID)( 5532 << 14)
+#define MC_XF_ROI_WRF_Line111                    (MCPARAMID)( 5533 << 14)
+#define MC_XF_ROI_WRF_Line111_GB                   1
+#define MC_XF_ROI_WRF_Line111_BG                   2
+#define MC_XF_ROI_WRF_Line111_RG                   3
+#define MC_XF_ROI_WRF_Line111_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1011              (MCPARAMID)( 5534 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1111              (MCPARAMID)( 5535 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1211              (MCPARAMID)( 5536 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1311              (MCPARAMID)( 5537 << 14)
+#define MC_XF_ROI_WRF_TOIheight11                (MCPARAMID)( 5538 << 14)
+#define MC_XF_ROI_WRF_LastTOI11                  (MCPARAMID)( 5539 << 14)
+#define MC_XF_ROI_WRF_LastTOI11_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI11_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset11                (MCPARAMID)( 5540 << 14)
+#define MC_XF_ROI_WRF_TOIPitch11                 (MCPARAMID)( 5541 << 14)
+#define MC_XF_ROI_WRF_NbOfLine11                 (MCPARAMID)( 5542 << 14)
+#define MC_XF_ROI_WRF_1stLineRep12               (MCPARAMID)( 5543 << 14)
+#define MC_XF_ROI_WRF_1stLineRep12_ON              1
+#define MC_XF_ROI_WRF_1stLineRep12_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep12              (MCPARAMID)( 5544 << 14)
+#define MC_XF_ROI_WRF_LastLineRep12_ON             1
+#define MC_XF_ROI_WRF_LastLineRep12_OFF            2
+#define MC_XF_ROI_WRF_1stColRep12                (MCPARAMID)( 5545 << 14)
+#define MC_XF_ROI_WRF_1stColRep12_ON               1
+#define MC_XF_ROI_WRF_1stColRep12_OFF              2
+#define MC_XF_ROI_WRF_LastColRep12               (MCPARAMID)( 5546 << 14)
+#define MC_XF_ROI_WRF_LastColRep12_ON              1
+#define MC_XF_ROI_WRF_LastColRep12_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx12                 (MCPARAMID)( 5547 << 14)
+#define MC_XF_ROI_WRF_TOIwidth12                 (MCPARAMID)( 5548 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI12       (MCPARAMID)( 5549 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI12       (MCPARAMID)( 5550 << 14)
+#define MC_XF_ROI_WRF_Line112                    (MCPARAMID)( 5551 << 14)
+#define MC_XF_ROI_WRF_Line112_GB                   1
+#define MC_XF_ROI_WRF_Line112_BG                   2
+#define MC_XF_ROI_WRF_Line112_RG                   3
+#define MC_XF_ROI_WRF_Line112_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1012              (MCPARAMID)( 5552 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1112              (MCPARAMID)( 5553 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1212              (MCPARAMID)( 5554 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1312              (MCPARAMID)( 5555 << 14)
+#define MC_XF_ROI_WRF_TOIheight12                (MCPARAMID)( 5556 << 14)
+#define MC_XF_ROI_WRF_LastTOI12                  (MCPARAMID)( 5557 << 14)
+#define MC_XF_ROI_WRF_LastTOI12_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI12_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset12                (MCPARAMID)( 5558 << 14)
+#define MC_XF_ROI_WRF_TOIPitch12                 (MCPARAMID)( 5559 << 14)
+#define MC_XF_ROI_WRF_NbOfLine12                 (MCPARAMID)( 5560 << 14)
+#define MC_XF_ROI_WRF_1stLineRep13               (MCPARAMID)( 5561 << 14)
+#define MC_XF_ROI_WRF_1stLineRep13_ON              1
+#define MC_XF_ROI_WRF_1stLineRep13_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep13              (MCPARAMID)( 5562 << 14)
+#define MC_XF_ROI_WRF_LastLineRep13_ON             1
+#define MC_XF_ROI_WRF_LastLineRep13_OFF            2
+#define MC_XF_ROI_WRF_1stColRep13                (MCPARAMID)( 5563 << 14)
+#define MC_XF_ROI_WRF_1stColRep13_ON               1
+#define MC_XF_ROI_WRF_1stColRep13_OFF              2
+#define MC_XF_ROI_WRF_LastColRep13               (MCPARAMID)( 5564 << 14)
+#define MC_XF_ROI_WRF_LastColRep13_ON              1
+#define MC_XF_ROI_WRF_LastColRep13_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx13                 (MCPARAMID)( 5565 << 14)
+#define MC_XF_ROI_WRF_TOIwidth13                 (MCPARAMID)( 5566 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI13       (MCPARAMID)( 5567 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI13       (MCPARAMID)( 5568 << 14)
+#define MC_XF_ROI_WRF_Line113                    (MCPARAMID)( 5569 << 14)
+#define MC_XF_ROI_WRF_Line113_GB                   1
+#define MC_XF_ROI_WRF_Line113_BG                   2
+#define MC_XF_ROI_WRF_Line113_RG                   3
+#define MC_XF_ROI_WRF_Line113_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1013              (MCPARAMID)( 5570 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1113              (MCPARAMID)( 5571 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1213              (MCPARAMID)( 5572 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1313              (MCPARAMID)( 5573 << 14)
+#define MC_XF_ROI_WRF_TOIheight13                (MCPARAMID)( 5574 << 14)
+#define MC_XF_ROI_WRF_LastTOI13                  (MCPARAMID)( 5575 << 14)
+#define MC_XF_ROI_WRF_LastTOI13_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI13_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset13                (MCPARAMID)( 5576 << 14)
+#define MC_XF_ROI_WRF_TOIPitch13                 (MCPARAMID)( 5577 << 14)
+#define MC_XF_ROI_WRF_NbOfLine13                 (MCPARAMID)( 5578 << 14)
+#define MC_XF_ROI_WRF_1stLineRep14               (MCPARAMID)( 5579 << 14)
+#define MC_XF_ROI_WRF_1stLineRep14_ON              1
+#define MC_XF_ROI_WRF_1stLineRep14_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep14              (MCPARAMID)( 5580 << 14)
+#define MC_XF_ROI_WRF_LastLineRep14_ON             1
+#define MC_XF_ROI_WRF_LastLineRep14_OFF            2
+#define MC_XF_ROI_WRF_1stColRep14                (MCPARAMID)( 5581 << 14)
+#define MC_XF_ROI_WRF_1stColRep14_ON               1
+#define MC_XF_ROI_WRF_1stColRep14_OFF              2
+#define MC_XF_ROI_WRF_LastColRep14               (MCPARAMID)( 5582 << 14)
+#define MC_XF_ROI_WRF_LastColRep14_ON              1
+#define MC_XF_ROI_WRF_LastColRep14_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx14                 (MCPARAMID)( 5583 << 14)
+#define MC_XF_ROI_WRF_TOIwidth14                 (MCPARAMID)( 5584 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI14       (MCPARAMID)( 5585 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI14       (MCPARAMID)( 5586 << 14)
+#define MC_XF_ROI_WRF_Line114                    (MCPARAMID)( 5587 << 14)
+#define MC_XF_ROI_WRF_Line114_GB                   1
+#define MC_XF_ROI_WRF_Line114_BG                   2
+#define MC_XF_ROI_WRF_Line114_RG                   3
+#define MC_XF_ROI_WRF_Line114_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1014              (MCPARAMID)( 5588 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1114              (MCPARAMID)( 5589 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1214              (MCPARAMID)( 5590 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1314              (MCPARAMID)( 5591 << 14)
+#define MC_XF_ROI_WRF_TOIheight14                (MCPARAMID)( 5592 << 14)
+#define MC_XF_ROI_WRF_LastTOI14                  (MCPARAMID)( 5593 << 14)
+#define MC_XF_ROI_WRF_LastTOI14_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI14_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset14                (MCPARAMID)( 5594 << 14)
+#define MC_XF_ROI_WRF_TOIPitch14                 (MCPARAMID)( 5595 << 14)
+#define MC_XF_ROI_WRF_NbOfLine14                 (MCPARAMID)( 5596 << 14)
+#define MC_XF_ROI_WRF_1stLineRep15               (MCPARAMID)( 5597 << 14)
+#define MC_XF_ROI_WRF_1stLineRep15_ON              1
+#define MC_XF_ROI_WRF_1stLineRep15_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep15              (MCPARAMID)( 5598 << 14)
+#define MC_XF_ROI_WRF_LastLineRep15_ON             1
+#define MC_XF_ROI_WRF_LastLineRep15_OFF            2
+#define MC_XF_ROI_WRF_1stColRep15                (MCPARAMID)( 5599 << 14)
+#define MC_XF_ROI_WRF_1stColRep15_ON               1
+#define MC_XF_ROI_WRF_1stColRep15_OFF              2
+#define MC_XF_ROI_WRF_LastColRep15               (MCPARAMID)( 5600 << 14)
+#define MC_XF_ROI_WRF_LastColRep15_ON              1
+#define MC_XF_ROI_WRF_LastColRep15_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx15                 (MCPARAMID)( 5601 << 14)
+#define MC_XF_ROI_WRF_TOIwidth15                 (MCPARAMID)( 5602 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI15       (MCPARAMID)( 5603 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI15       (MCPARAMID)( 5604 << 14)
+#define MC_XF_ROI_WRF_Line115                    (MCPARAMID)( 5605 << 14)
+#define MC_XF_ROI_WRF_Line115_GB                   1
+#define MC_XF_ROI_WRF_Line115_BG                   2
+#define MC_XF_ROI_WRF_Line115_RG                   3
+#define MC_XF_ROI_WRF_Line115_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1015              (MCPARAMID)( 5606 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1115              (MCPARAMID)( 5607 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1215              (MCPARAMID)( 5608 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1315              (MCPARAMID)( 5609 << 14)
+#define MC_XF_ROI_WRF_TOIheight15                (MCPARAMID)( 5610 << 14)
+#define MC_XF_ROI_WRF_LastTOI15                  (MCPARAMID)( 5611 << 14)
+#define MC_XF_ROI_WRF_LastTOI15_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI15_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset15                (MCPARAMID)( 5612 << 14)
+#define MC_XF_ROI_WRF_TOIPitch15                 (MCPARAMID)( 5613 << 14)
+#define MC_XF_ROI_WRF_NbOfLine15                 (MCPARAMID)( 5614 << 14)
+#define MC_XF_ROI_WRF_1stLineRep16               (MCPARAMID)( 5615 << 14)
+#define MC_XF_ROI_WRF_1stLineRep16_ON              1
+#define MC_XF_ROI_WRF_1stLineRep16_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep16              (MCPARAMID)( 5616 << 14)
+#define MC_XF_ROI_WRF_LastLineRep16_ON             1
+#define MC_XF_ROI_WRF_LastLineRep16_OFF            2
+#define MC_XF_ROI_WRF_1stColRep16                (MCPARAMID)( 5617 << 14)
+#define MC_XF_ROI_WRF_1stColRep16_ON               1
+#define MC_XF_ROI_WRF_1stColRep16_OFF              2
+#define MC_XF_ROI_WRF_LastColRep16               (MCPARAMID)( 5618 << 14)
+#define MC_XF_ROI_WRF_LastColRep16_ON              1
+#define MC_XF_ROI_WRF_LastColRep16_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx16                 (MCPARAMID)( 5619 << 14)
+#define MC_XF_ROI_WRF_TOIwidth16                 (MCPARAMID)( 5620 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI16       (MCPARAMID)( 5621 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI16       (MCPARAMID)( 5622 << 14)
+#define MC_XF_ROI_WRF_Line116                    (MCPARAMID)( 5623 << 14)
+#define MC_XF_ROI_WRF_Line116_GB                   1
+#define MC_XF_ROI_WRF_Line116_BG                   2
+#define MC_XF_ROI_WRF_Line116_RG                   3
+#define MC_XF_ROI_WRF_Line116_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1016              (MCPARAMID)( 5624 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1116              (MCPARAMID)( 5625 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1216              (MCPARAMID)( 5626 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1316              (MCPARAMID)( 5627 << 14)
+#define MC_XF_ROI_WRF_TOIheight16                (MCPARAMID)( 5628 << 14)
+#define MC_XF_ROI_WRF_LastTOI16                  (MCPARAMID)( 5629 << 14)
+#define MC_XF_ROI_WRF_LastTOI16_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI16_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset16                (MCPARAMID)( 5630 << 14)
+#define MC_XF_ROI_WRF_TOIPitch16                 (MCPARAMID)( 5631 << 14)
+#define MC_XF_ROI_WRF_NbOfLine16                 (MCPARAMID)( 5632 << 14)
+#define MC_XF_ROI_WRF_1stLineRep17               (MCPARAMID)( 5633 << 14)
+#define MC_XF_ROI_WRF_1stLineRep17_ON              1
+#define MC_XF_ROI_WRF_1stLineRep17_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep17              (MCPARAMID)( 5634 << 14)
+#define MC_XF_ROI_WRF_LastLineRep17_ON             1
+#define MC_XF_ROI_WRF_LastLineRep17_OFF            2
+#define MC_XF_ROI_WRF_1stColRep17                (MCPARAMID)( 5635 << 14)
+#define MC_XF_ROI_WRF_1stColRep17_ON               1
+#define MC_XF_ROI_WRF_1stColRep17_OFF              2
+#define MC_XF_ROI_WRF_LastColRep17               (MCPARAMID)( 5636 << 14)
+#define MC_XF_ROI_WRF_LastColRep17_ON              1
+#define MC_XF_ROI_WRF_LastColRep17_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx17                 (MCPARAMID)( 5637 << 14)
+#define MC_XF_ROI_WRF_TOIwidth17                 (MCPARAMID)( 5638 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI17       (MCPARAMID)( 5639 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI17       (MCPARAMID)( 5640 << 14)
+#define MC_XF_ROI_WRF_Line117                    (MCPARAMID)( 5641 << 14)
+#define MC_XF_ROI_WRF_Line117_GB                   1
+#define MC_XF_ROI_WRF_Line117_BG                   2
+#define MC_XF_ROI_WRF_Line117_RG                   3
+#define MC_XF_ROI_WRF_Line117_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1017              (MCPARAMID)( 5642 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1117              (MCPARAMID)( 5643 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1217              (MCPARAMID)( 5644 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1317              (MCPARAMID)( 5645 << 14)
+#define MC_XF_ROI_WRF_TOIheight17                (MCPARAMID)( 5646 << 14)
+#define MC_XF_ROI_WRF_LastTOI17                  (MCPARAMID)( 5647 << 14)
+#define MC_XF_ROI_WRF_LastTOI17_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI17_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset17                (MCPARAMID)( 5648 << 14)
+#define MC_XF_ROI_WRF_TOIPitch17                 (MCPARAMID)( 5649 << 14)
+#define MC_XF_ROI_WRF_NbOfLine17                 (MCPARAMID)( 5650 << 14)
+#define MC_XF_ROI_WRF_1stLineRep18               (MCPARAMID)( 5651 << 14)
+#define MC_XF_ROI_WRF_1stLineRep18_ON              1
+#define MC_XF_ROI_WRF_1stLineRep18_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep18              (MCPARAMID)( 5652 << 14)
+#define MC_XF_ROI_WRF_LastLineRep18_ON             1
+#define MC_XF_ROI_WRF_LastLineRep18_OFF            2
+#define MC_XF_ROI_WRF_1stColRep18                (MCPARAMID)( 5653 << 14)
+#define MC_XF_ROI_WRF_1stColRep18_ON               1
+#define MC_XF_ROI_WRF_1stColRep18_OFF              2
+#define MC_XF_ROI_WRF_LastColRep18               (MCPARAMID)( 5654 << 14)
+#define MC_XF_ROI_WRF_LastColRep18_ON              1
+#define MC_XF_ROI_WRF_LastColRep18_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx18                 (MCPARAMID)( 5655 << 14)
+#define MC_XF_ROI_WRF_TOIwidth18                 (MCPARAMID)( 5656 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI18       (MCPARAMID)( 5657 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI18       (MCPARAMID)( 5658 << 14)
+#define MC_XF_ROI_WRF_Line118                    (MCPARAMID)( 5659 << 14)
+#define MC_XF_ROI_WRF_Line118_GB                   1
+#define MC_XF_ROI_WRF_Line118_BG                   2
+#define MC_XF_ROI_WRF_Line118_RG                   3
+#define MC_XF_ROI_WRF_Line118_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1018              (MCPARAMID)( 5660 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1118              (MCPARAMID)( 5661 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1218              (MCPARAMID)( 5662 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1318              (MCPARAMID)( 5663 << 14)
+#define MC_XF_ROI_WRF_TOIheight18                (MCPARAMID)( 5664 << 14)
+#define MC_XF_ROI_WRF_LastTOI18                  (MCPARAMID)( 5665 << 14)
+#define MC_XF_ROI_WRF_LastTOI18_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI18_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset18                (MCPARAMID)( 5666 << 14)
+#define MC_XF_ROI_WRF_TOIPitch18                 (MCPARAMID)( 5667 << 14)
+#define MC_XF_ROI_WRF_NbOfLine18                 (MCPARAMID)( 5668 << 14)
+#define MC_XF_ROI_WRF_1stLineRep19               (MCPARAMID)( 5669 << 14)
+#define MC_XF_ROI_WRF_1stLineRep19_ON              1
+#define MC_XF_ROI_WRF_1stLineRep19_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep19              (MCPARAMID)( 5670 << 14)
+#define MC_XF_ROI_WRF_LastLineRep19_ON             1
+#define MC_XF_ROI_WRF_LastLineRep19_OFF            2
+#define MC_XF_ROI_WRF_1stColRep19                (MCPARAMID)( 5671 << 14)
+#define MC_XF_ROI_WRF_1stColRep19_ON               1
+#define MC_XF_ROI_WRF_1stColRep19_OFF              2
+#define MC_XF_ROI_WRF_LastColRep19               (MCPARAMID)( 5672 << 14)
+#define MC_XF_ROI_WRF_LastColRep19_ON              1
+#define MC_XF_ROI_WRF_LastColRep19_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx19                 (MCPARAMID)( 5673 << 14)
+#define MC_XF_ROI_WRF_TOIwidth19                 (MCPARAMID)( 5674 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI19       (MCPARAMID)( 5675 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI19       (MCPARAMID)( 5676 << 14)
+#define MC_XF_ROI_WRF_Line119                    (MCPARAMID)( 5677 << 14)
+#define MC_XF_ROI_WRF_Line119_GB                   1
+#define MC_XF_ROI_WRF_Line119_BG                   2
+#define MC_XF_ROI_WRF_Line119_RG                   3
+#define MC_XF_ROI_WRF_Line119_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1019              (MCPARAMID)( 5678 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1119              (MCPARAMID)( 5679 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1219              (MCPARAMID)( 5680 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1319              (MCPARAMID)( 5681 << 14)
+#define MC_XF_ROI_WRF_TOIheight19                (MCPARAMID)( 5682 << 14)
+#define MC_XF_ROI_WRF_LastTOI19                  (MCPARAMID)( 5683 << 14)
+#define MC_XF_ROI_WRF_LastTOI19_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI19_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset19                (MCPARAMID)( 5684 << 14)
+#define MC_XF_ROI_WRF_TOIPitch19                 (MCPARAMID)( 5685 << 14)
+#define MC_XF_ROI_WRF_NbOfLine19                 (MCPARAMID)( 5686 << 14)
+#define MC_XF_ROI_WRF_1stLineRep20               (MCPARAMID)( 5687 << 14)
+#define MC_XF_ROI_WRF_1stLineRep20_ON              1
+#define MC_XF_ROI_WRF_1stLineRep20_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep20              (MCPARAMID)( 5688 << 14)
+#define MC_XF_ROI_WRF_LastLineRep20_ON             1
+#define MC_XF_ROI_WRF_LastLineRep20_OFF            2
+#define MC_XF_ROI_WRF_1stColRep20                (MCPARAMID)( 5689 << 14)
+#define MC_XF_ROI_WRF_1stColRep20_ON               1
+#define MC_XF_ROI_WRF_1stColRep20_OFF              2
+#define MC_XF_ROI_WRF_LastColRep20               (MCPARAMID)( 5690 << 14)
+#define MC_XF_ROI_WRF_LastColRep20_ON              1
+#define MC_XF_ROI_WRF_LastColRep20_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx20                 (MCPARAMID)( 5691 << 14)
+#define MC_XF_ROI_WRF_TOIwidth20                 (MCPARAMID)( 5692 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI20       (MCPARAMID)( 5693 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI20       (MCPARAMID)( 5694 << 14)
+#define MC_XF_ROI_WRF_Line120                    (MCPARAMID)( 5695 << 14)
+#define MC_XF_ROI_WRF_Line120_GB                   1
+#define MC_XF_ROI_WRF_Line120_BG                   2
+#define MC_XF_ROI_WRF_Line120_RG                   3
+#define MC_XF_ROI_WRF_Line120_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1020              (MCPARAMID)( 5696 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1120              (MCPARAMID)( 5697 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1220              (MCPARAMID)( 5698 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1320              (MCPARAMID)( 5699 << 14)
+#define MC_XF_ROI_WRF_TOIheight20                (MCPARAMID)( 5700 << 14)
+#define MC_XF_ROI_WRF_LastTOI20                  (MCPARAMID)( 5701 << 14)
+#define MC_XF_ROI_WRF_LastTOI20_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI20_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset20                (MCPARAMID)( 5702 << 14)
+#define MC_XF_ROI_WRF_TOIPitch20                 (MCPARAMID)( 5703 << 14)
+#define MC_XF_ROI_WRF_NbOfLine20                 (MCPARAMID)( 5704 << 14)
+#define MC_XF_ROI_WRF_1stLineRep21               (MCPARAMID)( 5705 << 14)
+#define MC_XF_ROI_WRF_1stLineRep21_ON              1
+#define MC_XF_ROI_WRF_1stLineRep21_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep21              (MCPARAMID)( 5706 << 14)
+#define MC_XF_ROI_WRF_LastLineRep21_ON             1
+#define MC_XF_ROI_WRF_LastLineRep21_OFF            2
+#define MC_XF_ROI_WRF_1stColRep21                (MCPARAMID)( 5707 << 14)
+#define MC_XF_ROI_WRF_1stColRep21_ON               1
+#define MC_XF_ROI_WRF_1stColRep21_OFF              2
+#define MC_XF_ROI_WRF_LastColRep21               (MCPARAMID)( 5708 << 14)
+#define MC_XF_ROI_WRF_LastColRep21_ON              1
+#define MC_XF_ROI_WRF_LastColRep21_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx21                 (MCPARAMID)( 5709 << 14)
+#define MC_XF_ROI_WRF_TOIwidth21                 (MCPARAMID)( 5710 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI21       (MCPARAMID)( 5711 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI21       (MCPARAMID)( 5712 << 14)
+#define MC_XF_ROI_WRF_Line121                    (MCPARAMID)( 5713 << 14)
+#define MC_XF_ROI_WRF_Line121_GB                   1
+#define MC_XF_ROI_WRF_Line121_BG                   2
+#define MC_XF_ROI_WRF_Line121_RG                   3
+#define MC_XF_ROI_WRF_Line121_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1021              (MCPARAMID)( 5714 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1121              (MCPARAMID)( 5715 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1221              (MCPARAMID)( 5716 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1321              (MCPARAMID)( 5717 << 14)
+#define MC_XF_ROI_WRF_TOIheight21                (MCPARAMID)( 5718 << 14)
+#define MC_XF_ROI_WRF_LastTOI21                  (MCPARAMID)( 5719 << 14)
+#define MC_XF_ROI_WRF_LastTOI21_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI21_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset21                (MCPARAMID)( 5720 << 14)
+#define MC_XF_ROI_WRF_TOIPitch21                 (MCPARAMID)( 5721 << 14)
+#define MC_XF_ROI_WRF_NbOfLine21                 (MCPARAMID)( 5722 << 14)
+#define MC_XF_ROI_WRF_1stLineRep22               (MCPARAMID)( 5723 << 14)
+#define MC_XF_ROI_WRF_1stLineRep22_ON              1
+#define MC_XF_ROI_WRF_1stLineRep22_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep22              (MCPARAMID)( 5724 << 14)
+#define MC_XF_ROI_WRF_LastLineRep22_ON             1
+#define MC_XF_ROI_WRF_LastLineRep22_OFF            2
+#define MC_XF_ROI_WRF_1stColRep22                (MCPARAMID)( 5725 << 14)
+#define MC_XF_ROI_WRF_1stColRep22_ON               1
+#define MC_XF_ROI_WRF_1stColRep22_OFF              2
+#define MC_XF_ROI_WRF_LastColRep22               (MCPARAMID)( 5726 << 14)
+#define MC_XF_ROI_WRF_LastColRep22_ON              1
+#define MC_XF_ROI_WRF_LastColRep22_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx22                 (MCPARAMID)( 5727 << 14)
+#define MC_XF_ROI_WRF_TOIwidth22                 (MCPARAMID)( 5728 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI22       (MCPARAMID)( 5729 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI22       (MCPARAMID)( 5730 << 14)
+#define MC_XF_ROI_WRF_Line122                    (MCPARAMID)( 5731 << 14)
+#define MC_XF_ROI_WRF_Line122_GB                   1
+#define MC_XF_ROI_WRF_Line122_BG                   2
+#define MC_XF_ROI_WRF_Line122_RG                   3
+#define MC_XF_ROI_WRF_Line122_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1022              (MCPARAMID)( 5732 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1122              (MCPARAMID)( 5733 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1222              (MCPARAMID)( 5734 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1322              (MCPARAMID)( 5735 << 14)
+#define MC_XF_ROI_WRF_TOIheight22                (MCPARAMID)( 5736 << 14)
+#define MC_XF_ROI_WRF_LastTOI22                  (MCPARAMID)( 5737 << 14)
+#define MC_XF_ROI_WRF_LastTOI22_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI22_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset22                (MCPARAMID)( 5738 << 14)
+#define MC_XF_ROI_WRF_TOIPitch22                 (MCPARAMID)( 5739 << 14)
+#define MC_XF_ROI_WRF_NbOfLine22                 (MCPARAMID)( 5740 << 14)
+#define MC_XF_ROI_WRF_1stLineRep23               (MCPARAMID)( 5741 << 14)
+#define MC_XF_ROI_WRF_1stLineRep23_ON              1
+#define MC_XF_ROI_WRF_1stLineRep23_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep23              (MCPARAMID)( 5742 << 14)
+#define MC_XF_ROI_WRF_LastLineRep23_ON             1
+#define MC_XF_ROI_WRF_LastLineRep23_OFF            2
+#define MC_XF_ROI_WRF_1stColRep23                (MCPARAMID)( 5743 << 14)
+#define MC_XF_ROI_WRF_1stColRep23_ON               1
+#define MC_XF_ROI_WRF_1stColRep23_OFF              2
+#define MC_XF_ROI_WRF_LastColRep23               (MCPARAMID)( 5744 << 14)
+#define MC_XF_ROI_WRF_LastColRep23_ON              1
+#define MC_XF_ROI_WRF_LastColRep23_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx23                 (MCPARAMID)( 5745 << 14)
+#define MC_XF_ROI_WRF_TOIwidth23                 (MCPARAMID)( 5746 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI23       (MCPARAMID)( 5747 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI23       (MCPARAMID)( 5748 << 14)
+#define MC_XF_ROI_WRF_Line123                    (MCPARAMID)( 5749 << 14)
+#define MC_XF_ROI_WRF_Line123_GB                   1
+#define MC_XF_ROI_WRF_Line123_BG                   2
+#define MC_XF_ROI_WRF_Line123_RG                   3
+#define MC_XF_ROI_WRF_Line123_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1023              (MCPARAMID)( 5750 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1123              (MCPARAMID)( 5751 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1223              (MCPARAMID)( 5752 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1323              (MCPARAMID)( 5753 << 14)
+#define MC_XF_ROI_WRF_TOIheight23                (MCPARAMID)( 5754 << 14)
+#define MC_XF_ROI_WRF_LastTOI23                  (MCPARAMID)( 5755 << 14)
+#define MC_XF_ROI_WRF_LastTOI23_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI23_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset23                (MCPARAMID)( 5756 << 14)
+#define MC_XF_ROI_WRF_TOIPitch23                 (MCPARAMID)( 5757 << 14)
+#define MC_XF_ROI_WRF_NbOfLine23                 (MCPARAMID)( 5758 << 14)
+#define MC_XF_ROI_WRF_1stLineRep24               (MCPARAMID)( 5759 << 14)
+#define MC_XF_ROI_WRF_1stLineRep24_ON              1
+#define MC_XF_ROI_WRF_1stLineRep24_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep24              (MCPARAMID)( 5760 << 14)
+#define MC_XF_ROI_WRF_LastLineRep24_ON             1
+#define MC_XF_ROI_WRF_LastLineRep24_OFF            2
+#define MC_XF_ROI_WRF_1stColRep24                (MCPARAMID)( 5761 << 14)
+#define MC_XF_ROI_WRF_1stColRep24_ON               1
+#define MC_XF_ROI_WRF_1stColRep24_OFF              2
+#define MC_XF_ROI_WRF_LastColRep24               (MCPARAMID)( 5762 << 14)
+#define MC_XF_ROI_WRF_LastColRep24_ON              1
+#define MC_XF_ROI_WRF_LastColRep24_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx24                 (MCPARAMID)( 5763 << 14)
+#define MC_XF_ROI_WRF_TOIwidth24                 (MCPARAMID)( 5764 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI24       (MCPARAMID)( 5765 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI24       (MCPARAMID)( 5766 << 14)
+#define MC_XF_ROI_WRF_Line124                    (MCPARAMID)( 5767 << 14)
+#define MC_XF_ROI_WRF_Line124_GB                   1
+#define MC_XF_ROI_WRF_Line124_BG                   2
+#define MC_XF_ROI_WRF_Line124_RG                   3
+#define MC_XF_ROI_WRF_Line124_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1024              (MCPARAMID)( 5768 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1124              (MCPARAMID)( 5769 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1224              (MCPARAMID)( 5770 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1324              (MCPARAMID)( 5771 << 14)
+#define MC_XF_ROI_WRF_TOIheight24                (MCPARAMID)( 5772 << 14)
+#define MC_XF_ROI_WRF_LastTOI24                  (MCPARAMID)( 5773 << 14)
+#define MC_XF_ROI_WRF_LastTOI24_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI24_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset24                (MCPARAMID)( 5774 << 14)
+#define MC_XF_ROI_WRF_TOIPitch24                 (MCPARAMID)( 5775 << 14)
+#define MC_XF_ROI_WRF_NbOfLine24                 (MCPARAMID)( 5776 << 14)
+#define MC_XF_ROI_WRF_1stLineRep25               (MCPARAMID)( 5777 << 14)
+#define MC_XF_ROI_WRF_1stLineRep25_ON              1
+#define MC_XF_ROI_WRF_1stLineRep25_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep25              (MCPARAMID)( 5778 << 14)
+#define MC_XF_ROI_WRF_LastLineRep25_ON             1
+#define MC_XF_ROI_WRF_LastLineRep25_OFF            2
+#define MC_XF_ROI_WRF_1stColRep25                (MCPARAMID)( 5779 << 14)
+#define MC_XF_ROI_WRF_1stColRep25_ON               1
+#define MC_XF_ROI_WRF_1stColRep25_OFF              2
+#define MC_XF_ROI_WRF_LastColRep25               (MCPARAMID)( 5780 << 14)
+#define MC_XF_ROI_WRF_LastColRep25_ON              1
+#define MC_XF_ROI_WRF_LastColRep25_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx25                 (MCPARAMID)( 5781 << 14)
+#define MC_XF_ROI_WRF_TOIwidth25                 (MCPARAMID)( 5782 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI25       (MCPARAMID)( 5783 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI25       (MCPARAMID)( 5784 << 14)
+#define MC_XF_ROI_WRF_Line125                    (MCPARAMID)( 5785 << 14)
+#define MC_XF_ROI_WRF_Line125_GB                   1
+#define MC_XF_ROI_WRF_Line125_BG                   2
+#define MC_XF_ROI_WRF_Line125_RG                   3
+#define MC_XF_ROI_WRF_Line125_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1025              (MCPARAMID)( 5786 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1125              (MCPARAMID)( 5787 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1225              (MCPARAMID)( 5788 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1325              (MCPARAMID)( 5789 << 14)
+#define MC_XF_ROI_WRF_TOIheight25                (MCPARAMID)( 5790 << 14)
+#define MC_XF_ROI_WRF_LastTOI25                  (MCPARAMID)( 5791 << 14)
+#define MC_XF_ROI_WRF_LastTOI25_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI25_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset25                (MCPARAMID)( 5792 << 14)
+#define MC_XF_ROI_WRF_TOIPitch25                 (MCPARAMID)( 5793 << 14)
+#define MC_XF_ROI_WRF_NbOfLine25                 (MCPARAMID)( 5794 << 14)
+#define MC_XF_ROI_WRF_1stLineRep26               (MCPARAMID)( 5795 << 14)
+#define MC_XF_ROI_WRF_1stLineRep26_ON              1
+#define MC_XF_ROI_WRF_1stLineRep26_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep26              (MCPARAMID)( 5796 << 14)
+#define MC_XF_ROI_WRF_LastLineRep26_ON             1
+#define MC_XF_ROI_WRF_LastLineRep26_OFF            2
+#define MC_XF_ROI_WRF_1stColRep26                (MCPARAMID)( 5797 << 14)
+#define MC_XF_ROI_WRF_1stColRep26_ON               1
+#define MC_XF_ROI_WRF_1stColRep26_OFF              2
+#define MC_XF_ROI_WRF_LastColRep26               (MCPARAMID)( 5798 << 14)
+#define MC_XF_ROI_WRF_LastColRep26_ON              1
+#define MC_XF_ROI_WRF_LastColRep26_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx26                 (MCPARAMID)( 5799 << 14)
+#define MC_XF_ROI_WRF_TOIwidth26                 (MCPARAMID)( 5800 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI26       (MCPARAMID)( 5801 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI26       (MCPARAMID)( 5802 << 14)
+#define MC_XF_ROI_WRF_Line126                    (MCPARAMID)( 5803 << 14)
+#define MC_XF_ROI_WRF_Line126_GB                   1
+#define MC_XF_ROI_WRF_Line126_BG                   2
+#define MC_XF_ROI_WRF_Line126_RG                   3
+#define MC_XF_ROI_WRF_Line126_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1026              (MCPARAMID)( 5804 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1126              (MCPARAMID)( 5805 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1226              (MCPARAMID)( 5806 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1326              (MCPARAMID)( 5807 << 14)
+#define MC_XF_ROI_WRF_TOIheight26                (MCPARAMID)( 5808 << 14)
+#define MC_XF_ROI_WRF_LastTOI26                  (MCPARAMID)( 5809 << 14)
+#define MC_XF_ROI_WRF_LastTOI26_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI26_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset26                (MCPARAMID)( 5810 << 14)
+#define MC_XF_ROI_WRF_TOIPitch26                 (MCPARAMID)( 5811 << 14)
+#define MC_XF_ROI_WRF_NbOfLine26                 (MCPARAMID)( 5812 << 14)
+#define MC_XF_ROI_WRF_1stLineRep27               (MCPARAMID)( 5813 << 14)
+#define MC_XF_ROI_WRF_1stLineRep27_ON              1
+#define MC_XF_ROI_WRF_1stLineRep27_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep27              (MCPARAMID)( 5814 << 14)
+#define MC_XF_ROI_WRF_LastLineRep27_ON             1
+#define MC_XF_ROI_WRF_LastLineRep27_OFF            2
+#define MC_XF_ROI_WRF_1stColRep27                (MCPARAMID)( 5815 << 14)
+#define MC_XF_ROI_WRF_1stColRep27_ON               1
+#define MC_XF_ROI_WRF_1stColRep27_OFF              2
+#define MC_XF_ROI_WRF_LastColRep27               (MCPARAMID)( 5816 << 14)
+#define MC_XF_ROI_WRF_LastColRep27_ON              1
+#define MC_XF_ROI_WRF_LastColRep27_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx27                 (MCPARAMID)( 5817 << 14)
+#define MC_XF_ROI_WRF_TOIwidth27                 (MCPARAMID)( 5818 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI27       (MCPARAMID)( 5819 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI27       (MCPARAMID)( 5820 << 14)
+#define MC_XF_ROI_WRF_Line127                    (MCPARAMID)( 5821 << 14)
+#define MC_XF_ROI_WRF_Line127_GB                   1
+#define MC_XF_ROI_WRF_Line127_BG                   2
+#define MC_XF_ROI_WRF_Line127_RG                   3
+#define MC_XF_ROI_WRF_Line127_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1027              (MCPARAMID)( 5822 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1127              (MCPARAMID)( 5823 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1227              (MCPARAMID)( 5824 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1327              (MCPARAMID)( 5825 << 14)
+#define MC_XF_ROI_WRF_TOIheight27                (MCPARAMID)( 5826 << 14)
+#define MC_XF_ROI_WRF_LastTOI27                  (MCPARAMID)( 5827 << 14)
+#define MC_XF_ROI_WRF_LastTOI27_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI27_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset27                (MCPARAMID)( 5828 << 14)
+#define MC_XF_ROI_WRF_TOIPitch27                 (MCPARAMID)( 5829 << 14)
+#define MC_XF_ROI_WRF_NbOfLine27                 (MCPARAMID)( 5830 << 14)
+#define MC_XF_ROI_WRF_1stLineRep28               (MCPARAMID)( 5831 << 14)
+#define MC_XF_ROI_WRF_1stLineRep28_ON              1
+#define MC_XF_ROI_WRF_1stLineRep28_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep28              (MCPARAMID)( 5832 << 14)
+#define MC_XF_ROI_WRF_LastLineRep28_ON             1
+#define MC_XF_ROI_WRF_LastLineRep28_OFF            2
+#define MC_XF_ROI_WRF_1stColRep28                (MCPARAMID)( 5833 << 14)
+#define MC_XF_ROI_WRF_1stColRep28_ON               1
+#define MC_XF_ROI_WRF_1stColRep28_OFF              2
+#define MC_XF_ROI_WRF_LastColRep28               (MCPARAMID)( 5834 << 14)
+#define MC_XF_ROI_WRF_LastColRep28_ON              1
+#define MC_XF_ROI_WRF_LastColRep28_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx28                 (MCPARAMID)( 5835 << 14)
+#define MC_XF_ROI_WRF_TOIwidth28                 (MCPARAMID)( 5836 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI28       (MCPARAMID)( 5837 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI28       (MCPARAMID)( 5838 << 14)
+#define MC_XF_ROI_WRF_Line128                    (MCPARAMID)( 5839 << 14)
+#define MC_XF_ROI_WRF_Line128_GB                   1
+#define MC_XF_ROI_WRF_Line128_BG                   2
+#define MC_XF_ROI_WRF_Line128_RG                   3
+#define MC_XF_ROI_WRF_Line128_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1028              (MCPARAMID)( 5840 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1128              (MCPARAMID)( 5841 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1228              (MCPARAMID)( 5842 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1328              (MCPARAMID)( 5843 << 14)
+#define MC_XF_ROI_WRF_TOIheight28                (MCPARAMID)( 5844 << 14)
+#define MC_XF_ROI_WRF_LastTOI28                  (MCPARAMID)( 5845 << 14)
+#define MC_XF_ROI_WRF_LastTOI28_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI28_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset28                (MCPARAMID)( 5846 << 14)
+#define MC_XF_ROI_WRF_TOIPitch28                 (MCPARAMID)( 5847 << 14)
+#define MC_XF_ROI_WRF_NbOfLine28                 (MCPARAMID)( 5848 << 14)
+#define MC_XF_ROI_WRF_1stLineRep29               (MCPARAMID)( 5849 << 14)
+#define MC_XF_ROI_WRF_1stLineRep29_ON              1
+#define MC_XF_ROI_WRF_1stLineRep29_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep29              (MCPARAMID)( 5850 << 14)
+#define MC_XF_ROI_WRF_LastLineRep29_ON             1
+#define MC_XF_ROI_WRF_LastLineRep29_OFF            2
+#define MC_XF_ROI_WRF_1stColRep29                (MCPARAMID)( 5851 << 14)
+#define MC_XF_ROI_WRF_1stColRep29_ON               1
+#define MC_XF_ROI_WRF_1stColRep29_OFF              2
+#define MC_XF_ROI_WRF_LastColRep29               (MCPARAMID)( 5852 << 14)
+#define MC_XF_ROI_WRF_LastColRep29_ON              1
+#define MC_XF_ROI_WRF_LastColRep29_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx29                 (MCPARAMID)( 5853 << 14)
+#define MC_XF_ROI_WRF_TOIwidth29                 (MCPARAMID)( 5854 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI29       (MCPARAMID)( 5855 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI29       (MCPARAMID)( 5856 << 14)
+#define MC_XF_ROI_WRF_Line129                    (MCPARAMID)( 5857 << 14)
+#define MC_XF_ROI_WRF_Line129_GB                   1
+#define MC_XF_ROI_WRF_Line129_BG                   2
+#define MC_XF_ROI_WRF_Line129_RG                   3
+#define MC_XF_ROI_WRF_Line129_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1029              (MCPARAMID)( 5858 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1129              (MCPARAMID)( 5859 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1229              (MCPARAMID)( 5860 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1329              (MCPARAMID)( 5861 << 14)
+#define MC_XF_ROI_WRF_TOIheight29                (MCPARAMID)( 5862 << 14)
+#define MC_XF_ROI_WRF_LastTOI29                  (MCPARAMID)( 5863 << 14)
+#define MC_XF_ROI_WRF_LastTOI29_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI29_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset29                (MCPARAMID)( 5864 << 14)
+#define MC_XF_ROI_WRF_TOIPitch29                 (MCPARAMID)( 5865 << 14)
+#define MC_XF_ROI_WRF_NbOfLine29                 (MCPARAMID)( 5866 << 14)
+#define MC_XF_ROI_WRF_1stLineRep30               (MCPARAMID)( 5867 << 14)
+#define MC_XF_ROI_WRF_1stLineRep30_ON              1
+#define MC_XF_ROI_WRF_1stLineRep30_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep30              (MCPARAMID)( 5868 << 14)
+#define MC_XF_ROI_WRF_LastLineRep30_ON             1
+#define MC_XF_ROI_WRF_LastLineRep30_OFF            2
+#define MC_XF_ROI_WRF_1stColRep30                (MCPARAMID)( 5869 << 14)
+#define MC_XF_ROI_WRF_1stColRep30_ON               1
+#define MC_XF_ROI_WRF_1stColRep30_OFF              2
+#define MC_XF_ROI_WRF_LastColRep30               (MCPARAMID)( 5870 << 14)
+#define MC_XF_ROI_WRF_LastColRep30_ON              1
+#define MC_XF_ROI_WRF_LastColRep30_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx30                 (MCPARAMID)( 5871 << 14)
+#define MC_XF_ROI_WRF_TOIwidth30                 (MCPARAMID)( 5872 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI30       (MCPARAMID)( 5873 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI30       (MCPARAMID)( 5874 << 14)
+#define MC_XF_ROI_WRF_Line130                    (MCPARAMID)( 5875 << 14)
+#define MC_XF_ROI_WRF_Line130_GB                   1
+#define MC_XF_ROI_WRF_Line130_BG                   2
+#define MC_XF_ROI_WRF_Line130_RG                   3
+#define MC_XF_ROI_WRF_Line130_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1030              (MCPARAMID)( 5876 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1130              (MCPARAMID)( 5877 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1230              (MCPARAMID)( 5878 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1330              (MCPARAMID)( 5879 << 14)
+#define MC_XF_ROI_WRF_TOIheight30                (MCPARAMID)( 5880 << 14)
+#define MC_XF_ROI_WRF_LastTOI30                  (MCPARAMID)( 5881 << 14)
+#define MC_XF_ROI_WRF_LastTOI30_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI30_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset30                (MCPARAMID)( 5882 << 14)
+#define MC_XF_ROI_WRF_TOIPitch30                 (MCPARAMID)( 5883 << 14)
+#define MC_XF_ROI_WRF_NbOfLine30                 (MCPARAMID)( 5884 << 14)
+#define MC_XF_ROI_WRF_1stLineRep31               (MCPARAMID)( 5885 << 14)
+#define MC_XF_ROI_WRF_1stLineRep31_ON              1
+#define MC_XF_ROI_WRF_1stLineRep31_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep31              (MCPARAMID)( 5886 << 14)
+#define MC_XF_ROI_WRF_LastLineRep31_ON             1
+#define MC_XF_ROI_WRF_LastLineRep31_OFF            2
+#define MC_XF_ROI_WRF_1stColRep31                (MCPARAMID)( 5887 << 14)
+#define MC_XF_ROI_WRF_1stColRep31_ON               1
+#define MC_XF_ROI_WRF_1stColRep31_OFF              2
+#define MC_XF_ROI_WRF_LastColRep31               (MCPARAMID)( 5888 << 14)
+#define MC_XF_ROI_WRF_LastColRep31_ON              1
+#define MC_XF_ROI_WRF_LastColRep31_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx31                 (MCPARAMID)( 5889 << 14)
+#define MC_XF_ROI_WRF_TOIwidth31                 (MCPARAMID)( 5890 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI31       (MCPARAMID)( 5891 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI31       (MCPARAMID)( 5892 << 14)
+#define MC_XF_ROI_WRF_Line131                    (MCPARAMID)( 5893 << 14)
+#define MC_XF_ROI_WRF_Line131_GB                   1
+#define MC_XF_ROI_WRF_Line131_BG                   2
+#define MC_XF_ROI_WRF_Line131_RG                   3
+#define MC_XF_ROI_WRF_Line131_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1031              (MCPARAMID)( 5894 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1131              (MCPARAMID)( 5895 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1231              (MCPARAMID)( 5896 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1331              (MCPARAMID)( 5897 << 14)
+#define MC_XF_ROI_WRF_TOIheight31                (MCPARAMID)( 5898 << 14)
+#define MC_XF_ROI_WRF_LastTOI31                  (MCPARAMID)( 5899 << 14)
+#define MC_XF_ROI_WRF_LastTOI31_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI31_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset31                (MCPARAMID)( 5900 << 14)
+#define MC_XF_ROI_WRF_TOIPitch31                 (MCPARAMID)( 5901 << 14)
+#define MC_XF_ROI_WRF_NbOfLine31                 (MCPARAMID)( 5902 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep8               (MCPARAMID)( 5903 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep8_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep8_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep8              (MCPARAMID)( 5904 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep8_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep8_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep8                (MCPARAMID)( 5905 << 14)
+#define MC_AWB_ROI_WRF_1stColRep8_ON               1
+#define MC_AWB_ROI_WRF_1stColRep8_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep8               (MCPARAMID)( 5906 << 14)
+#define MC_AWB_ROI_WRF_LastColRep8_ON              1
+#define MC_AWB_ROI_WRF_LastColRep8_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx8                 (MCPARAMID)( 5907 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth8                 (MCPARAMID)( 5908 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI8       (MCPARAMID)( 5909 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI8       (MCPARAMID)( 5910 << 14)
+#define MC_AWB_ROI_WRF_Line18                    (MCPARAMID)( 5911 << 14)
+#define MC_AWB_ROI_WRF_Line18_GB                   1
+#define MC_AWB_ROI_WRF_Line18_BG                   2
+#define MC_AWB_ROI_WRF_Line18_RG                   3
+#define MC_AWB_ROI_WRF_Line18_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM108              (MCPARAMID)( 5912 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM118              (MCPARAMID)( 5913 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM128              (MCPARAMID)( 5914 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM138              (MCPARAMID)( 5915 << 14)
+#define MC_AWB_ROI_WRF_TOIheight8                (MCPARAMID)( 5916 << 14)
+#define MC_AWB_ROI_WRF_LastTOI8                  (MCPARAMID)( 5917 << 14)
+#define MC_AWB_ROI_WRF_LastTOI8_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI8_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset8                (MCPARAMID)( 5918 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch8                 (MCPARAMID)( 5919 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine8                 (MCPARAMID)( 5920 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep9               (MCPARAMID)( 5921 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep9_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep9_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep9              (MCPARAMID)( 5922 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep9_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep9_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep9                (MCPARAMID)( 5923 << 14)
+#define MC_AWB_ROI_WRF_1stColRep9_ON               1
+#define MC_AWB_ROI_WRF_1stColRep9_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep9               (MCPARAMID)( 5924 << 14)
+#define MC_AWB_ROI_WRF_LastColRep9_ON              1
+#define MC_AWB_ROI_WRF_LastColRep9_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx9                 (MCPARAMID)( 5925 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth9                 (MCPARAMID)( 5926 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI9       (MCPARAMID)( 5927 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI9       (MCPARAMID)( 5928 << 14)
+#define MC_AWB_ROI_WRF_Line19                    (MCPARAMID)( 5929 << 14)
+#define MC_AWB_ROI_WRF_Line19_GB                   1
+#define MC_AWB_ROI_WRF_Line19_BG                   2
+#define MC_AWB_ROI_WRF_Line19_RG                   3
+#define MC_AWB_ROI_WRF_Line19_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM109              (MCPARAMID)( 5930 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM119              (MCPARAMID)( 5931 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM129              (MCPARAMID)( 5932 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM139              (MCPARAMID)( 5933 << 14)
+#define MC_AWB_ROI_WRF_TOIheight9                (MCPARAMID)( 5934 << 14)
+#define MC_AWB_ROI_WRF_LastTOI9                  (MCPARAMID)( 5935 << 14)
+#define MC_AWB_ROI_WRF_LastTOI9_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI9_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset9                (MCPARAMID)( 5936 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch9                 (MCPARAMID)( 5937 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine9                 (MCPARAMID)( 5938 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep10              (MCPARAMID)( 5939 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep10_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep10_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep10             (MCPARAMID)( 5940 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep10_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep10_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep10               (MCPARAMID)( 5941 << 14)
+#define MC_AWB_ROI_WRF_1stColRep10_ON              1
+#define MC_AWB_ROI_WRF_1stColRep10_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep10              (MCPARAMID)( 5942 << 14)
+#define MC_AWB_ROI_WRF_LastColRep10_ON             1
+#define MC_AWB_ROI_WRF_LastColRep10_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx10                (MCPARAMID)( 5943 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth10                (MCPARAMID)( 5944 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI10      (MCPARAMID)( 5945 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI10      (MCPARAMID)( 5946 << 14)
+#define MC_AWB_ROI_WRF_Line110                   (MCPARAMID)( 5947 << 14)
+#define MC_AWB_ROI_WRF_Line110_GB                  1
+#define MC_AWB_ROI_WRF_Line110_BG                  2
+#define MC_AWB_ROI_WRF_Line110_RG                  3
+#define MC_AWB_ROI_WRF_Line110_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1010             (MCPARAMID)( 5948 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1110             (MCPARAMID)( 5949 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1210             (MCPARAMID)( 5950 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1310             (MCPARAMID)( 5951 << 14)
+#define MC_AWB_ROI_WRF_TOIheight10               (MCPARAMID)( 5952 << 14)
+#define MC_AWB_ROI_WRF_LastTOI10                 (MCPARAMID)( 5953 << 14)
+#define MC_AWB_ROI_WRF_LastTOI10_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI10_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset10               (MCPARAMID)( 5954 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch10                (MCPARAMID)( 5955 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine10                (MCPARAMID)( 5956 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep11              (MCPARAMID)( 5957 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep11_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep11_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep11             (MCPARAMID)( 5958 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep11_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep11_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep11               (MCPARAMID)( 5959 << 14)
+#define MC_AWB_ROI_WRF_1stColRep11_ON              1
+#define MC_AWB_ROI_WRF_1stColRep11_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep11              (MCPARAMID)( 5960 << 14)
+#define MC_AWB_ROI_WRF_LastColRep11_ON             1
+#define MC_AWB_ROI_WRF_LastColRep11_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx11                (MCPARAMID)( 5961 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth11                (MCPARAMID)( 5962 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI11      (MCPARAMID)( 5963 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI11      (MCPARAMID)( 5964 << 14)
+#define MC_AWB_ROI_WRF_Line111                   (MCPARAMID)( 5965 << 14)
+#define MC_AWB_ROI_WRF_Line111_GB                  1
+#define MC_AWB_ROI_WRF_Line111_BG                  2
+#define MC_AWB_ROI_WRF_Line111_RG                  3
+#define MC_AWB_ROI_WRF_Line111_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1011             (MCPARAMID)( 5966 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1111             (MCPARAMID)( 5967 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1211             (MCPARAMID)( 5968 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1311             (MCPARAMID)( 5969 << 14)
+#define MC_AWB_ROI_WRF_TOIheight11               (MCPARAMID)( 5970 << 14)
+#define MC_AWB_ROI_WRF_LastTOI11                 (MCPARAMID)( 5971 << 14)
+#define MC_AWB_ROI_WRF_LastTOI11_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI11_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset11               (MCPARAMID)( 5972 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch11                (MCPARAMID)( 5973 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine11                (MCPARAMID)( 5974 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep12              (MCPARAMID)( 5975 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep12_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep12_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep12             (MCPARAMID)( 5976 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep12_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep12_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep12               (MCPARAMID)( 5977 << 14)
+#define MC_AWB_ROI_WRF_1stColRep12_ON              1
+#define MC_AWB_ROI_WRF_1stColRep12_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep12              (MCPARAMID)( 5978 << 14)
+#define MC_AWB_ROI_WRF_LastColRep12_ON             1
+#define MC_AWB_ROI_WRF_LastColRep12_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx12                (MCPARAMID)( 5979 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth12                (MCPARAMID)( 5980 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI12      (MCPARAMID)( 5981 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI12      (MCPARAMID)( 5982 << 14)
+#define MC_AWB_ROI_WRF_Line112                   (MCPARAMID)( 5983 << 14)
+#define MC_AWB_ROI_WRF_Line112_GB                  1
+#define MC_AWB_ROI_WRF_Line112_BG                  2
+#define MC_AWB_ROI_WRF_Line112_RG                  3
+#define MC_AWB_ROI_WRF_Line112_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1012             (MCPARAMID)( 5984 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1112             (MCPARAMID)( 5985 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1212             (MCPARAMID)( 5986 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1312             (MCPARAMID)( 5987 << 14)
+#define MC_AWB_ROI_WRF_TOIheight12               (MCPARAMID)( 5988 << 14)
+#define MC_AWB_ROI_WRF_LastTOI12                 (MCPARAMID)( 5989 << 14)
+#define MC_AWB_ROI_WRF_LastTOI12_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI12_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset12               (MCPARAMID)( 5990 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch12                (MCPARAMID)( 5991 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine12                (MCPARAMID)( 5992 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep13              (MCPARAMID)( 5993 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep13_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep13_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep13             (MCPARAMID)( 5994 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep13_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep13_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep13               (MCPARAMID)( 5995 << 14)
+#define MC_AWB_ROI_WRF_1stColRep13_ON              1
+#define MC_AWB_ROI_WRF_1stColRep13_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep13              (MCPARAMID)( 5996 << 14)
+#define MC_AWB_ROI_WRF_LastColRep13_ON             1
+#define MC_AWB_ROI_WRF_LastColRep13_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx13                (MCPARAMID)( 5997 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth13                (MCPARAMID)( 5998 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI13      (MCPARAMID)( 5999 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI13      (MCPARAMID)( 6000 << 14)
+#define MC_AWB_ROI_WRF_Line113                   (MCPARAMID)( 6001 << 14)
+#define MC_AWB_ROI_WRF_Line113_GB                  1
+#define MC_AWB_ROI_WRF_Line113_BG                  2
+#define MC_AWB_ROI_WRF_Line113_RG                  3
+#define MC_AWB_ROI_WRF_Line113_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1013             (MCPARAMID)( 6002 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1113             (MCPARAMID)( 6003 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1213             (MCPARAMID)( 6004 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1313             (MCPARAMID)( 6005 << 14)
+#define MC_AWB_ROI_WRF_TOIheight13               (MCPARAMID)( 6006 << 14)
+#define MC_AWB_ROI_WRF_LastTOI13                 (MCPARAMID)( 6007 << 14)
+#define MC_AWB_ROI_WRF_LastTOI13_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI13_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset13               (MCPARAMID)( 6008 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch13                (MCPARAMID)( 6009 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine13                (MCPARAMID)( 6010 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep14              (MCPARAMID)( 6011 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep14_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep14_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep14             (MCPARAMID)( 6012 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep14_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep14_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep14               (MCPARAMID)( 6013 << 14)
+#define MC_AWB_ROI_WRF_1stColRep14_ON              1
+#define MC_AWB_ROI_WRF_1stColRep14_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep14              (MCPARAMID)( 6014 << 14)
+#define MC_AWB_ROI_WRF_LastColRep14_ON             1
+#define MC_AWB_ROI_WRF_LastColRep14_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx14                (MCPARAMID)( 6015 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth14                (MCPARAMID)( 6016 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI14      (MCPARAMID)( 6017 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI14      (MCPARAMID)( 6018 << 14)
+#define MC_AWB_ROI_WRF_Line114                   (MCPARAMID)( 6019 << 14)
+#define MC_AWB_ROI_WRF_Line114_GB                  1
+#define MC_AWB_ROI_WRF_Line114_BG                  2
+#define MC_AWB_ROI_WRF_Line114_RG                  3
+#define MC_AWB_ROI_WRF_Line114_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1014             (MCPARAMID)( 6020 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1114             (MCPARAMID)( 6021 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1214             (MCPARAMID)( 6022 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1314             (MCPARAMID)( 6023 << 14)
+#define MC_AWB_ROI_WRF_TOIheight14               (MCPARAMID)( 6024 << 14)
+#define MC_AWB_ROI_WRF_LastTOI14                 (MCPARAMID)( 6025 << 14)
+#define MC_AWB_ROI_WRF_LastTOI14_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI14_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset14               (MCPARAMID)( 6026 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch14                (MCPARAMID)( 6027 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine14                (MCPARAMID)( 6028 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep15              (MCPARAMID)( 6029 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep15_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep15_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep15             (MCPARAMID)( 6030 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep15_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep15_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep15               (MCPARAMID)( 6031 << 14)
+#define MC_AWB_ROI_WRF_1stColRep15_ON              1
+#define MC_AWB_ROI_WRF_1stColRep15_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep15              (MCPARAMID)( 6032 << 14)
+#define MC_AWB_ROI_WRF_LastColRep15_ON             1
+#define MC_AWB_ROI_WRF_LastColRep15_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx15                (MCPARAMID)( 6033 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth15                (MCPARAMID)( 6034 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI15      (MCPARAMID)( 6035 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI15      (MCPARAMID)( 6036 << 14)
+#define MC_AWB_ROI_WRF_Line115                   (MCPARAMID)( 6037 << 14)
+#define MC_AWB_ROI_WRF_Line115_GB                  1
+#define MC_AWB_ROI_WRF_Line115_BG                  2
+#define MC_AWB_ROI_WRF_Line115_RG                  3
+#define MC_AWB_ROI_WRF_Line115_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1015             (MCPARAMID)( 6038 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1115             (MCPARAMID)( 6039 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1215             (MCPARAMID)( 6040 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1315             (MCPARAMID)( 6041 << 14)
+#define MC_AWB_ROI_WRF_TOIheight15               (MCPARAMID)( 6042 << 14)
+#define MC_AWB_ROI_WRF_LastTOI15                 (MCPARAMID)( 6043 << 14)
+#define MC_AWB_ROI_WRF_LastTOI15_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI15_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset15               (MCPARAMID)( 6044 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch15                (MCPARAMID)( 6045 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine15                (MCPARAMID)( 6046 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep16              (MCPARAMID)( 6047 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep16_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep16_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep16             (MCPARAMID)( 6048 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep16_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep16_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep16               (MCPARAMID)( 6049 << 14)
+#define MC_AWB_ROI_WRF_1stColRep16_ON              1
+#define MC_AWB_ROI_WRF_1stColRep16_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep16              (MCPARAMID)( 6050 << 14)
+#define MC_AWB_ROI_WRF_LastColRep16_ON             1
+#define MC_AWB_ROI_WRF_LastColRep16_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx16                (MCPARAMID)( 6051 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth16                (MCPARAMID)( 6052 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI16      (MCPARAMID)( 6053 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI16      (MCPARAMID)( 6054 << 14)
+#define MC_AWB_ROI_WRF_Line116                   (MCPARAMID)( 6055 << 14)
+#define MC_AWB_ROI_WRF_Line116_GB                  1
+#define MC_AWB_ROI_WRF_Line116_BG                  2
+#define MC_AWB_ROI_WRF_Line116_RG                  3
+#define MC_AWB_ROI_WRF_Line116_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1016             (MCPARAMID)( 6056 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1116             (MCPARAMID)( 6057 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1216             (MCPARAMID)( 6058 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1316             (MCPARAMID)( 6059 << 14)
+#define MC_AWB_ROI_WRF_TOIheight16               (MCPARAMID)( 6060 << 14)
+#define MC_AWB_ROI_WRF_LastTOI16                 (MCPARAMID)( 6061 << 14)
+#define MC_AWB_ROI_WRF_LastTOI16_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI16_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset16               (MCPARAMID)( 6062 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch16                (MCPARAMID)( 6063 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine16                (MCPARAMID)( 6064 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep17              (MCPARAMID)( 6065 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep17_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep17_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep17             (MCPARAMID)( 6066 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep17_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep17_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep17               (MCPARAMID)( 6067 << 14)
+#define MC_AWB_ROI_WRF_1stColRep17_ON              1
+#define MC_AWB_ROI_WRF_1stColRep17_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep17              (MCPARAMID)( 6068 << 14)
+#define MC_AWB_ROI_WRF_LastColRep17_ON             1
+#define MC_AWB_ROI_WRF_LastColRep17_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx17                (MCPARAMID)( 6069 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth17                (MCPARAMID)( 6070 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI17      (MCPARAMID)( 6071 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI17      (MCPARAMID)( 6072 << 14)
+#define MC_AWB_ROI_WRF_Line117                   (MCPARAMID)( 6073 << 14)
+#define MC_AWB_ROI_WRF_Line117_GB                  1
+#define MC_AWB_ROI_WRF_Line117_BG                  2
+#define MC_AWB_ROI_WRF_Line117_RG                  3
+#define MC_AWB_ROI_WRF_Line117_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1017             (MCPARAMID)( 6074 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1117             (MCPARAMID)( 6075 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1217             (MCPARAMID)( 6076 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1317             (MCPARAMID)( 6077 << 14)
+#define MC_AWB_ROI_WRF_TOIheight17               (MCPARAMID)( 6078 << 14)
+#define MC_AWB_ROI_WRF_LastTOI17                 (MCPARAMID)( 6079 << 14)
+#define MC_AWB_ROI_WRF_LastTOI17_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI17_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset17               (MCPARAMID)( 6080 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch17                (MCPARAMID)( 6081 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine17                (MCPARAMID)( 6082 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep18              (MCPARAMID)( 6083 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep18_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep18_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep18             (MCPARAMID)( 6084 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep18_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep18_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep18               (MCPARAMID)( 6085 << 14)
+#define MC_AWB_ROI_WRF_1stColRep18_ON              1
+#define MC_AWB_ROI_WRF_1stColRep18_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep18              (MCPARAMID)( 6086 << 14)
+#define MC_AWB_ROI_WRF_LastColRep18_ON             1
+#define MC_AWB_ROI_WRF_LastColRep18_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx18                (MCPARAMID)( 6087 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth18                (MCPARAMID)( 6088 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI18      (MCPARAMID)( 6089 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI18      (MCPARAMID)( 6090 << 14)
+#define MC_AWB_ROI_WRF_Line118                   (MCPARAMID)( 6091 << 14)
+#define MC_AWB_ROI_WRF_Line118_GB                  1
+#define MC_AWB_ROI_WRF_Line118_BG                  2
+#define MC_AWB_ROI_WRF_Line118_RG                  3
+#define MC_AWB_ROI_WRF_Line118_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1018             (MCPARAMID)( 6092 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1118             (MCPARAMID)( 6093 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1218             (MCPARAMID)( 6094 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1318             (MCPARAMID)( 6095 << 14)
+#define MC_AWB_ROI_WRF_TOIheight18               (MCPARAMID)( 6096 << 14)
+#define MC_AWB_ROI_WRF_LastTOI18                 (MCPARAMID)( 6097 << 14)
+#define MC_AWB_ROI_WRF_LastTOI18_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI18_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset18               (MCPARAMID)( 6098 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch18                (MCPARAMID)( 6099 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine18                (MCPARAMID)( 6100 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep19              (MCPARAMID)( 6101 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep19_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep19_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep19             (MCPARAMID)( 6102 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep19_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep19_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep19               (MCPARAMID)( 6103 << 14)
+#define MC_AWB_ROI_WRF_1stColRep19_ON              1
+#define MC_AWB_ROI_WRF_1stColRep19_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep19              (MCPARAMID)( 6104 << 14)
+#define MC_AWB_ROI_WRF_LastColRep19_ON             1
+#define MC_AWB_ROI_WRF_LastColRep19_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx19                (MCPARAMID)( 6105 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth19                (MCPARAMID)( 6106 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI19      (MCPARAMID)( 6107 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI19      (MCPARAMID)( 6108 << 14)
+#define MC_AWB_ROI_WRF_Line119                   (MCPARAMID)( 6109 << 14)
+#define MC_AWB_ROI_WRF_Line119_GB                  1
+#define MC_AWB_ROI_WRF_Line119_BG                  2
+#define MC_AWB_ROI_WRF_Line119_RG                  3
+#define MC_AWB_ROI_WRF_Line119_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1019             (MCPARAMID)( 6110 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1119             (MCPARAMID)( 6111 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1219             (MCPARAMID)( 6112 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1319             (MCPARAMID)( 6113 << 14)
+#define MC_AWB_ROI_WRF_TOIheight19               (MCPARAMID)( 6114 << 14)
+#define MC_AWB_ROI_WRF_LastTOI19                 (MCPARAMID)( 6115 << 14)
+#define MC_AWB_ROI_WRF_LastTOI19_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI19_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset19               (MCPARAMID)( 6116 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch19                (MCPARAMID)( 6117 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine19                (MCPARAMID)( 6118 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep20              (MCPARAMID)( 6119 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep20_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep20_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep20             (MCPARAMID)( 6120 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep20_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep20_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep20               (MCPARAMID)( 6121 << 14)
+#define MC_AWB_ROI_WRF_1stColRep20_ON              1
+#define MC_AWB_ROI_WRF_1stColRep20_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep20              (MCPARAMID)( 6122 << 14)
+#define MC_AWB_ROI_WRF_LastColRep20_ON             1
+#define MC_AWB_ROI_WRF_LastColRep20_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx20                (MCPARAMID)( 6123 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth20                (MCPARAMID)( 6124 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI20      (MCPARAMID)( 6125 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI20      (MCPARAMID)( 6126 << 14)
+#define MC_AWB_ROI_WRF_Line120                   (MCPARAMID)( 6127 << 14)
+#define MC_AWB_ROI_WRF_Line120_GB                  1
+#define MC_AWB_ROI_WRF_Line120_BG                  2
+#define MC_AWB_ROI_WRF_Line120_RG                  3
+#define MC_AWB_ROI_WRF_Line120_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1020             (MCPARAMID)( 6128 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1120             (MCPARAMID)( 6129 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1220             (MCPARAMID)( 6130 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1320             (MCPARAMID)( 6131 << 14)
+#define MC_AWB_ROI_WRF_TOIheight20               (MCPARAMID)( 6132 << 14)
+#define MC_AWB_ROI_WRF_LastTOI20                 (MCPARAMID)( 6133 << 14)
+#define MC_AWB_ROI_WRF_LastTOI20_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI20_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset20               (MCPARAMID)( 6134 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch20                (MCPARAMID)( 6135 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine20                (MCPARAMID)( 6136 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep21              (MCPARAMID)( 6137 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep21_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep21_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep21             (MCPARAMID)( 6138 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep21_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep21_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep21               (MCPARAMID)( 6139 << 14)
+#define MC_AWB_ROI_WRF_1stColRep21_ON              1
+#define MC_AWB_ROI_WRF_1stColRep21_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep21              (MCPARAMID)( 6140 << 14)
+#define MC_AWB_ROI_WRF_LastColRep21_ON             1
+#define MC_AWB_ROI_WRF_LastColRep21_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx21                (MCPARAMID)( 6141 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth21                (MCPARAMID)( 6142 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI21      (MCPARAMID)( 6143 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI21      (MCPARAMID)( 6144 << 14)
+#define MC_AWB_ROI_WRF_Line121                   (MCPARAMID)( 6145 << 14)
+#define MC_AWB_ROI_WRF_Line121_GB                  1
+#define MC_AWB_ROI_WRF_Line121_BG                  2
+#define MC_AWB_ROI_WRF_Line121_RG                  3
+#define MC_AWB_ROI_WRF_Line121_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1021             (MCPARAMID)( 6146 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1121             (MCPARAMID)( 6147 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1221             (MCPARAMID)( 6148 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1321             (MCPARAMID)( 6149 << 14)
+#define MC_AWB_ROI_WRF_TOIheight21               (MCPARAMID)( 6150 << 14)
+#define MC_AWB_ROI_WRF_LastTOI21                 (MCPARAMID)( 6151 << 14)
+#define MC_AWB_ROI_WRF_LastTOI21_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI21_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset21               (MCPARAMID)( 6152 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch21                (MCPARAMID)( 6153 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine21                (MCPARAMID)( 6154 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep22              (MCPARAMID)( 6155 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep22_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep22_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep22             (MCPARAMID)( 6156 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep22_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep22_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep22               (MCPARAMID)( 6157 << 14)
+#define MC_AWB_ROI_WRF_1stColRep22_ON              1
+#define MC_AWB_ROI_WRF_1stColRep22_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep22              (MCPARAMID)( 6158 << 14)
+#define MC_AWB_ROI_WRF_LastColRep22_ON             1
+#define MC_AWB_ROI_WRF_LastColRep22_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx22                (MCPARAMID)( 6159 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth22                (MCPARAMID)( 6160 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI22      (MCPARAMID)( 6161 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI22      (MCPARAMID)( 6162 << 14)
+#define MC_AWB_ROI_WRF_Line122                   (MCPARAMID)( 6163 << 14)
+#define MC_AWB_ROI_WRF_Line122_GB                  1
+#define MC_AWB_ROI_WRF_Line122_BG                  2
+#define MC_AWB_ROI_WRF_Line122_RG                  3
+#define MC_AWB_ROI_WRF_Line122_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1022             (MCPARAMID)( 6164 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1122             (MCPARAMID)( 6165 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1222             (MCPARAMID)( 6166 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1322             (MCPARAMID)( 6167 << 14)
+#define MC_AWB_ROI_WRF_TOIheight22               (MCPARAMID)( 6168 << 14)
+#define MC_AWB_ROI_WRF_LastTOI22                 (MCPARAMID)( 6169 << 14)
+#define MC_AWB_ROI_WRF_LastTOI22_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI22_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset22               (MCPARAMID)( 6170 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch22                (MCPARAMID)( 6171 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine22                (MCPARAMID)( 6172 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep23              (MCPARAMID)( 6173 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep23_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep23_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep23             (MCPARAMID)( 6174 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep23_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep23_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep23               (MCPARAMID)( 6175 << 14)
+#define MC_AWB_ROI_WRF_1stColRep23_ON              1
+#define MC_AWB_ROI_WRF_1stColRep23_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep23              (MCPARAMID)( 6176 << 14)
+#define MC_AWB_ROI_WRF_LastColRep23_ON             1
+#define MC_AWB_ROI_WRF_LastColRep23_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx23                (MCPARAMID)( 6177 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth23                (MCPARAMID)( 6178 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI23      (MCPARAMID)( 6179 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI23      (MCPARAMID)( 6180 << 14)
+#define MC_AWB_ROI_WRF_Line123                   (MCPARAMID)( 6181 << 14)
+#define MC_AWB_ROI_WRF_Line123_GB                  1
+#define MC_AWB_ROI_WRF_Line123_BG                  2
+#define MC_AWB_ROI_WRF_Line123_RG                  3
+#define MC_AWB_ROI_WRF_Line123_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1023             (MCPARAMID)( 6182 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1123             (MCPARAMID)( 6183 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1223             (MCPARAMID)( 6184 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1323             (MCPARAMID)( 6185 << 14)
+#define MC_AWB_ROI_WRF_TOIheight23               (MCPARAMID)( 6186 << 14)
+#define MC_AWB_ROI_WRF_LastTOI23                 (MCPARAMID)( 6187 << 14)
+#define MC_AWB_ROI_WRF_LastTOI23_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI23_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset23               (MCPARAMID)( 6188 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch23                (MCPARAMID)( 6189 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine23                (MCPARAMID)( 6190 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep24              (MCPARAMID)( 6191 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep24_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep24_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep24             (MCPARAMID)( 6192 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep24_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep24_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep24               (MCPARAMID)( 6193 << 14)
+#define MC_AWB_ROI_WRF_1stColRep24_ON              1
+#define MC_AWB_ROI_WRF_1stColRep24_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep24              (MCPARAMID)( 6194 << 14)
+#define MC_AWB_ROI_WRF_LastColRep24_ON             1
+#define MC_AWB_ROI_WRF_LastColRep24_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx24                (MCPARAMID)( 6195 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth24                (MCPARAMID)( 6196 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI24      (MCPARAMID)( 6197 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI24      (MCPARAMID)( 6198 << 14)
+#define MC_AWB_ROI_WRF_Line124                   (MCPARAMID)( 6199 << 14)
+#define MC_AWB_ROI_WRF_Line124_GB                  1
+#define MC_AWB_ROI_WRF_Line124_BG                  2
+#define MC_AWB_ROI_WRF_Line124_RG                  3
+#define MC_AWB_ROI_WRF_Line124_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1024             (MCPARAMID)( 6200 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1124             (MCPARAMID)( 6201 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1224             (MCPARAMID)( 6202 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1324             (MCPARAMID)( 6203 << 14)
+#define MC_AWB_ROI_WRF_TOIheight24               (MCPARAMID)( 6204 << 14)
+#define MC_AWB_ROI_WRF_LastTOI24                 (MCPARAMID)( 6205 << 14)
+#define MC_AWB_ROI_WRF_LastTOI24_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI24_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset24               (MCPARAMID)( 6206 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch24                (MCPARAMID)( 6207 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine24                (MCPARAMID)( 6208 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep25              (MCPARAMID)( 6209 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep25_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep25_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep25             (MCPARAMID)( 6210 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep25_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep25_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep25               (MCPARAMID)( 6211 << 14)
+#define MC_AWB_ROI_WRF_1stColRep25_ON              1
+#define MC_AWB_ROI_WRF_1stColRep25_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep25              (MCPARAMID)( 6212 << 14)
+#define MC_AWB_ROI_WRF_LastColRep25_ON             1
+#define MC_AWB_ROI_WRF_LastColRep25_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx25                (MCPARAMID)( 6213 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth25                (MCPARAMID)( 6214 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI25      (MCPARAMID)( 6215 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI25      (MCPARAMID)( 6216 << 14)
+#define MC_AWB_ROI_WRF_Line125                   (MCPARAMID)( 6217 << 14)
+#define MC_AWB_ROI_WRF_Line125_GB                  1
+#define MC_AWB_ROI_WRF_Line125_BG                  2
+#define MC_AWB_ROI_WRF_Line125_RG                  3
+#define MC_AWB_ROI_WRF_Line125_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1025             (MCPARAMID)( 6218 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1125             (MCPARAMID)( 6219 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1225             (MCPARAMID)( 6220 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1325             (MCPARAMID)( 6221 << 14)
+#define MC_AWB_ROI_WRF_TOIheight25               (MCPARAMID)( 6222 << 14)
+#define MC_AWB_ROI_WRF_LastTOI25                 (MCPARAMID)( 6223 << 14)
+#define MC_AWB_ROI_WRF_LastTOI25_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI25_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset25               (MCPARAMID)( 6224 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch25                (MCPARAMID)( 6225 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine25                (MCPARAMID)( 6226 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep26              (MCPARAMID)( 6227 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep26_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep26_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep26             (MCPARAMID)( 6228 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep26_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep26_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep26               (MCPARAMID)( 6229 << 14)
+#define MC_AWB_ROI_WRF_1stColRep26_ON              1
+#define MC_AWB_ROI_WRF_1stColRep26_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep26              (MCPARAMID)( 6230 << 14)
+#define MC_AWB_ROI_WRF_LastColRep26_ON             1
+#define MC_AWB_ROI_WRF_LastColRep26_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx26                (MCPARAMID)( 6231 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth26                (MCPARAMID)( 6232 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI26      (MCPARAMID)( 6233 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI26      (MCPARAMID)( 6234 << 14)
+#define MC_AWB_ROI_WRF_Line126                   (MCPARAMID)( 6235 << 14)
+#define MC_AWB_ROI_WRF_Line126_GB                  1
+#define MC_AWB_ROI_WRF_Line126_BG                  2
+#define MC_AWB_ROI_WRF_Line126_RG                  3
+#define MC_AWB_ROI_WRF_Line126_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1026             (MCPARAMID)( 6236 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1126             (MCPARAMID)( 6237 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1226             (MCPARAMID)( 6238 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1326             (MCPARAMID)( 6239 << 14)
+#define MC_AWB_ROI_WRF_TOIheight26               (MCPARAMID)( 6240 << 14)
+#define MC_AWB_ROI_WRF_LastTOI26                 (MCPARAMID)( 6241 << 14)
+#define MC_AWB_ROI_WRF_LastTOI26_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI26_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset26               (MCPARAMID)( 6242 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch26                (MCPARAMID)( 6243 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine26                (MCPARAMID)( 6244 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep27              (MCPARAMID)( 6245 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep27_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep27_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep27             (MCPARAMID)( 6246 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep27_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep27_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep27               (MCPARAMID)( 6247 << 14)
+#define MC_AWB_ROI_WRF_1stColRep27_ON              1
+#define MC_AWB_ROI_WRF_1stColRep27_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep27              (MCPARAMID)( 6248 << 14)
+#define MC_AWB_ROI_WRF_LastColRep27_ON             1
+#define MC_AWB_ROI_WRF_LastColRep27_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx27                (MCPARAMID)( 6249 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth27                (MCPARAMID)( 6250 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI27      (MCPARAMID)( 6251 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI27      (MCPARAMID)( 6252 << 14)
+#define MC_AWB_ROI_WRF_Line127                   (MCPARAMID)( 6253 << 14)
+#define MC_AWB_ROI_WRF_Line127_GB                  1
+#define MC_AWB_ROI_WRF_Line127_BG                  2
+#define MC_AWB_ROI_WRF_Line127_RG                  3
+#define MC_AWB_ROI_WRF_Line127_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1027             (MCPARAMID)( 6254 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1127             (MCPARAMID)( 6255 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1227             (MCPARAMID)( 6256 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1327             (MCPARAMID)( 6257 << 14)
+#define MC_AWB_ROI_WRF_TOIheight27               (MCPARAMID)( 6258 << 14)
+#define MC_AWB_ROI_WRF_LastTOI27                 (MCPARAMID)( 6259 << 14)
+#define MC_AWB_ROI_WRF_LastTOI27_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI27_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset27               (MCPARAMID)( 6260 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch27                (MCPARAMID)( 6261 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine27                (MCPARAMID)( 6262 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep28              (MCPARAMID)( 6263 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep28_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep28_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep28             (MCPARAMID)( 6264 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep28_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep28_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep28               (MCPARAMID)( 6265 << 14)
+#define MC_AWB_ROI_WRF_1stColRep28_ON              1
+#define MC_AWB_ROI_WRF_1stColRep28_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep28              (MCPARAMID)( 6266 << 14)
+#define MC_AWB_ROI_WRF_LastColRep28_ON             1
+#define MC_AWB_ROI_WRF_LastColRep28_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx28                (MCPARAMID)( 6267 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth28                (MCPARAMID)( 6268 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI28      (MCPARAMID)( 6269 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI28      (MCPARAMID)( 6270 << 14)
+#define MC_AWB_ROI_WRF_Line128                   (MCPARAMID)( 6271 << 14)
+#define MC_AWB_ROI_WRF_Line128_GB                  1
+#define MC_AWB_ROI_WRF_Line128_BG                  2
+#define MC_AWB_ROI_WRF_Line128_RG                  3
+#define MC_AWB_ROI_WRF_Line128_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1028             (MCPARAMID)( 6272 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1128             (MCPARAMID)( 6273 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1228             (MCPARAMID)( 6274 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1328             (MCPARAMID)( 6275 << 14)
+#define MC_AWB_ROI_WRF_TOIheight28               (MCPARAMID)( 6276 << 14)
+#define MC_AWB_ROI_WRF_LastTOI28                 (MCPARAMID)( 6277 << 14)
+#define MC_AWB_ROI_WRF_LastTOI28_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI28_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset28               (MCPARAMID)( 6278 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch28                (MCPARAMID)( 6279 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine28                (MCPARAMID)( 6280 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep29              (MCPARAMID)( 6281 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep29_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep29_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep29             (MCPARAMID)( 6282 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep29_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep29_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep29               (MCPARAMID)( 6283 << 14)
+#define MC_AWB_ROI_WRF_1stColRep29_ON              1
+#define MC_AWB_ROI_WRF_1stColRep29_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep29              (MCPARAMID)( 6284 << 14)
+#define MC_AWB_ROI_WRF_LastColRep29_ON             1
+#define MC_AWB_ROI_WRF_LastColRep29_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx29                (MCPARAMID)( 6285 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth29                (MCPARAMID)( 6286 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI29      (MCPARAMID)( 6287 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI29      (MCPARAMID)( 6288 << 14)
+#define MC_AWB_ROI_WRF_Line129                   (MCPARAMID)( 6289 << 14)
+#define MC_AWB_ROI_WRF_Line129_GB                  1
+#define MC_AWB_ROI_WRF_Line129_BG                  2
+#define MC_AWB_ROI_WRF_Line129_RG                  3
+#define MC_AWB_ROI_WRF_Line129_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1029             (MCPARAMID)( 6290 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1129             (MCPARAMID)( 6291 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1229             (MCPARAMID)( 6292 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1329             (MCPARAMID)( 6293 << 14)
+#define MC_AWB_ROI_WRF_TOIheight29               (MCPARAMID)( 6294 << 14)
+#define MC_AWB_ROI_WRF_LastTOI29                 (MCPARAMID)( 6295 << 14)
+#define MC_AWB_ROI_WRF_LastTOI29_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI29_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset29               (MCPARAMID)( 6296 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch29                (MCPARAMID)( 6297 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine29                (MCPARAMID)( 6298 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep30              (MCPARAMID)( 6299 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep30_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep30_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep30             (MCPARAMID)( 6300 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep30_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep30_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep30               (MCPARAMID)( 6301 << 14)
+#define MC_AWB_ROI_WRF_1stColRep30_ON              1
+#define MC_AWB_ROI_WRF_1stColRep30_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep30              (MCPARAMID)( 6302 << 14)
+#define MC_AWB_ROI_WRF_LastColRep30_ON             1
+#define MC_AWB_ROI_WRF_LastColRep30_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx30                (MCPARAMID)( 6303 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth30                (MCPARAMID)( 6304 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI30      (MCPARAMID)( 6305 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI30      (MCPARAMID)( 6306 << 14)
+#define MC_AWB_ROI_WRF_Line130                   (MCPARAMID)( 6307 << 14)
+#define MC_AWB_ROI_WRF_Line130_GB                  1
+#define MC_AWB_ROI_WRF_Line130_BG                  2
+#define MC_AWB_ROI_WRF_Line130_RG                  3
+#define MC_AWB_ROI_WRF_Line130_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1030             (MCPARAMID)( 6308 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1130             (MCPARAMID)( 6309 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1230             (MCPARAMID)( 6310 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1330             (MCPARAMID)( 6311 << 14)
+#define MC_AWB_ROI_WRF_TOIheight30               (MCPARAMID)( 6312 << 14)
+#define MC_AWB_ROI_WRF_LastTOI30                 (MCPARAMID)( 6313 << 14)
+#define MC_AWB_ROI_WRF_LastTOI30_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI30_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset30               (MCPARAMID)( 6314 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch30                (MCPARAMID)( 6315 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine30                (MCPARAMID)( 6316 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep31              (MCPARAMID)( 6317 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep31_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep31_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep31             (MCPARAMID)( 6318 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep31_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep31_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep31               (MCPARAMID)( 6319 << 14)
+#define MC_AWB_ROI_WRF_1stColRep31_ON              1
+#define MC_AWB_ROI_WRF_1stColRep31_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep31              (MCPARAMID)( 6320 << 14)
+#define MC_AWB_ROI_WRF_LastColRep31_ON             1
+#define MC_AWB_ROI_WRF_LastColRep31_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx31                (MCPARAMID)( 6321 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth31                (MCPARAMID)( 6322 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI31      (MCPARAMID)( 6323 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI31      (MCPARAMID)( 6324 << 14)
+#define MC_AWB_ROI_WRF_Line131                   (MCPARAMID)( 6325 << 14)
+#define MC_AWB_ROI_WRF_Line131_GB                  1
+#define MC_AWB_ROI_WRF_Line131_BG                  2
+#define MC_AWB_ROI_WRF_Line131_RG                  3
+#define MC_AWB_ROI_WRF_Line131_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1031             (MCPARAMID)( 6326 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1131             (MCPARAMID)( 6327 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1231             (MCPARAMID)( 6328 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1331             (MCPARAMID)( 6329 << 14)
+#define MC_AWB_ROI_WRF_TOIheight31               (MCPARAMID)( 6330 << 14)
+#define MC_AWB_ROI_WRF_LastTOI31                 (MCPARAMID)( 6331 << 14)
+#define MC_AWB_ROI_WRF_LastTOI31_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI31_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset31               (MCPARAMID)( 6332 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch31                (MCPARAMID)( 6333 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine31                (MCPARAMID)( 6334 << 14)
+#define MC_ROIName_WRF_1stLineRep0               (MCPARAMID)( 6335 << 14)
+#define MC_ROIName_WRF_1stLineRep0_ON              1
+#define MC_ROIName_WRF_1stLineRep0_OFF             2
+#define MC_ROIName_WRF_LastLineRep0              (MCPARAMID)( 6336 << 14)
+#define MC_ROIName_WRF_LastLineRep0_ON             1
+#define MC_ROIName_WRF_LastLineRep0_OFF            2
+#define MC_ROIName_WRF_1stColRep0                (MCPARAMID)( 6337 << 14)
+#define MC_ROIName_WRF_1stColRep0_ON               1
+#define MC_ROIName_WRF_1stColRep0_OFF              2
+#define MC_ROIName_WRF_LastColRep0               (MCPARAMID)( 6338 << 14)
+#define MC_ROIName_WRF_LastColRep0_ON              1
+#define MC_ROIName_WRF_LastColRep0_OFF             2
+#define MC_ROIName_WRF_ColumnIx0                 (MCPARAMID)( 6339 << 14)
+#define MC_ROIName_WRF_TOIwidth0                 (MCPARAMID)( 6340 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI0       (MCPARAMID)( 6341 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI0       (MCPARAMID)( 6342 << 14)
+#define MC_ROIName_WRF_Line10                    (MCPARAMID)( 6343 << 14)
+#define MC_ROIName_WRF_Line10_GB                   1
+#define MC_ROIName_WRF_Line10_BG                   2
+#define MC_ROIName_WRF_Line10_RG                   3
+#define MC_ROIName_WRF_Line10_GR                   4
+#define MC_ROIName_WRF_XferSizeM100              (MCPARAMID)( 6344 << 14)
+#define MC_ROIName_WRF_XferSizeM110              (MCPARAMID)( 6345 << 14)
+#define MC_ROIName_WRF_XferSizeM120              (MCPARAMID)( 6346 << 14)
+#define MC_ROIName_WRF_XferSizeM130              (MCPARAMID)( 6347 << 14)
+#define MC_ROIName_WRF_TOIheight0                (MCPARAMID)( 6348 << 14)
+#define MC_ROIName_WRF_LastTOI0                  (MCPARAMID)( 6349 << 14)
+#define MC_ROIName_WRF_LastTOI0_TRUE               1
+#define MC_ROIName_WRF_LastTOI0_FALSE              2
+#define MC_ROIName_WRF_TOIoffset0                (MCPARAMID)( 6350 << 14)
+#define MC_ROIName_WRF_TOIPitch0                 (MCPARAMID)( 6351 << 14)
+#define MC_ROIName_WRF_NbOfLine0                 (MCPARAMID)( 6352 << 14)
+#define MC_ROIName_WRF_1stLineRep1               (MCPARAMID)( 6353 << 14)
+#define MC_ROIName_WRF_1stLineRep1_ON              1
+#define MC_ROIName_WRF_1stLineRep1_OFF             2
+#define MC_ROIName_WRF_LastLineRep1              (MCPARAMID)( 6354 << 14)
+#define MC_ROIName_WRF_LastLineRep1_ON             1
+#define MC_ROIName_WRF_LastLineRep1_OFF            2
+#define MC_ROIName_WRF_1stColRep1                (MCPARAMID)( 6355 << 14)
+#define MC_ROIName_WRF_1stColRep1_ON               1
+#define MC_ROIName_WRF_1stColRep1_OFF              2
+#define MC_ROIName_WRF_LastColRep1               (MCPARAMID)( 6356 << 14)
+#define MC_ROIName_WRF_LastColRep1_ON              1
+#define MC_ROIName_WRF_LastColRep1_OFF             2
+#define MC_ROIName_WRF_ColumnIx1                 (MCPARAMID)( 6357 << 14)
+#define MC_ROIName_WRF_TOIwidth1                 (MCPARAMID)( 6358 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI1       (MCPARAMID)( 6359 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI1       (MCPARAMID)( 6360 << 14)
+#define MC_ROIName_WRF_Line11                    (MCPARAMID)( 6361 << 14)
+#define MC_ROIName_WRF_Line11_GB                   1
+#define MC_ROIName_WRF_Line11_BG                   2
+#define MC_ROIName_WRF_Line11_RG                   3
+#define MC_ROIName_WRF_Line11_GR                   4
+#define MC_ROIName_WRF_XferSizeM101              (MCPARAMID)( 6362 << 14)
+#define MC_ROIName_WRF_XferSizeM111              (MCPARAMID)( 6363 << 14)
+#define MC_ROIName_WRF_XferSizeM121              (MCPARAMID)( 6364 << 14)
+#define MC_ROIName_WRF_XferSizeM131              (MCPARAMID)( 6365 << 14)
+#define MC_ROIName_WRF_TOIheight1                (MCPARAMID)( 6366 << 14)
+#define MC_ROIName_WRF_LastTOI1                  (MCPARAMID)( 6367 << 14)
+#define MC_ROIName_WRF_LastTOI1_TRUE               1
+#define MC_ROIName_WRF_LastTOI1_FALSE              2
+#define MC_ROIName_WRF_TOIoffset1                (MCPARAMID)( 6368 << 14)
+#define MC_ROIName_WRF_TOIPitch1                 (MCPARAMID)( 6369 << 14)
+#define MC_ROIName_WRF_NbOfLine1                 (MCPARAMID)( 6370 << 14)
+#define MC_ROIName_WRF_1stLineRep2               (MCPARAMID)( 6371 << 14)
+#define MC_ROIName_WRF_1stLineRep2_ON              1
+#define MC_ROIName_WRF_1stLineRep2_OFF             2
+#define MC_ROIName_WRF_LastLineRep2              (MCPARAMID)( 6372 << 14)
+#define MC_ROIName_WRF_LastLineRep2_ON             1
+#define MC_ROIName_WRF_LastLineRep2_OFF            2
+#define MC_ROIName_WRF_1stColRep2                (MCPARAMID)( 6373 << 14)
+#define MC_ROIName_WRF_1stColRep2_ON               1
+#define MC_ROIName_WRF_1stColRep2_OFF              2
+#define MC_ROIName_WRF_LastColRep2               (MCPARAMID)( 6374 << 14)
+#define MC_ROIName_WRF_LastColRep2_ON              1
+#define MC_ROIName_WRF_LastColRep2_OFF             2
+#define MC_ROIName_WRF_ColumnIx2                 (MCPARAMID)( 6375 << 14)
+#define MC_ROIName_WRF_TOIwidth2                 (MCPARAMID)( 6376 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI2       (MCPARAMID)( 6377 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI2       (MCPARAMID)( 6378 << 14)
+#define MC_ROIName_WRF_Line12                    (MCPARAMID)( 6379 << 14)
+#define MC_ROIName_WRF_Line12_GB                   1
+#define MC_ROIName_WRF_Line12_BG                   2
+#define MC_ROIName_WRF_Line12_RG                   3
+#define MC_ROIName_WRF_Line12_GR                   4
+#define MC_ROIName_WRF_XferSizeM102              (MCPARAMID)( 6380 << 14)
+#define MC_ROIName_WRF_XferSizeM112              (MCPARAMID)( 6381 << 14)
+#define MC_ROIName_WRF_XferSizeM122              (MCPARAMID)( 6382 << 14)
+#define MC_ROIName_WRF_XferSizeM132              (MCPARAMID)( 6383 << 14)
+#define MC_ROIName_WRF_TOIheight2                (MCPARAMID)( 6384 << 14)
+#define MC_ROIName_WRF_LastTOI2                  (MCPARAMID)( 6385 << 14)
+#define MC_ROIName_WRF_LastTOI2_TRUE               1
+#define MC_ROIName_WRF_LastTOI2_FALSE              2
+#define MC_ROIName_WRF_TOIoffset2                (MCPARAMID)( 6386 << 14)
+#define MC_ROIName_WRF_TOIPitch2                 (MCPARAMID)( 6387 << 14)
+#define MC_ROIName_WRF_NbOfLine2                 (MCPARAMID)( 6388 << 14)
+#define MC_ROIName_WRF_1stLineRep3               (MCPARAMID)( 6389 << 14)
+#define MC_ROIName_WRF_1stLineRep3_ON              1
+#define MC_ROIName_WRF_1stLineRep3_OFF             2
+#define MC_ROIName_WRF_LastLineRep3              (MCPARAMID)( 6390 << 14)
+#define MC_ROIName_WRF_LastLineRep3_ON             1
+#define MC_ROIName_WRF_LastLineRep3_OFF            2
+#define MC_ROIName_WRF_1stColRep3                (MCPARAMID)( 6391 << 14)
+#define MC_ROIName_WRF_1stColRep3_ON               1
+#define MC_ROIName_WRF_1stColRep3_OFF              2
+#define MC_ROIName_WRF_LastColRep3               (MCPARAMID)( 6392 << 14)
+#define MC_ROIName_WRF_LastColRep3_ON              1
+#define MC_ROIName_WRF_LastColRep3_OFF             2
+#define MC_ROIName_WRF_ColumnIx3                 (MCPARAMID)( 6393 << 14)
+#define MC_ROIName_WRF_TOIwidth3                 (MCPARAMID)( 6394 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI3       (MCPARAMID)( 6395 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI3       (MCPARAMID)( 6396 << 14)
+#define MC_ROIName_WRF_Line13                    (MCPARAMID)( 6397 << 14)
+#define MC_ROIName_WRF_Line13_GB                   1
+#define MC_ROIName_WRF_Line13_BG                   2
+#define MC_ROIName_WRF_Line13_RG                   3
+#define MC_ROIName_WRF_Line13_GR                   4
+#define MC_ROIName_WRF_XferSizeM103              (MCPARAMID)( 6398 << 14)
+#define MC_ROIName_WRF_XferSizeM113              (MCPARAMID)( 6399 << 14)
+#define MC_ROIName_WRF_XferSizeM123              (MCPARAMID)( 6400 << 14)
+#define MC_ROIName_WRF_XferSizeM133              (MCPARAMID)( 6401 << 14)
+#define MC_ROIName_WRF_TOIheight3                (MCPARAMID)( 6402 << 14)
+#define MC_ROIName_WRF_LastTOI3                  (MCPARAMID)( 6403 << 14)
+#define MC_ROIName_WRF_LastTOI3_TRUE               1
+#define MC_ROIName_WRF_LastTOI3_FALSE              2
+#define MC_ROIName_WRF_TOIoffset3                (MCPARAMID)( 6404 << 14)
+#define MC_ROIName_WRF_TOIPitch3                 (MCPARAMID)( 6405 << 14)
+#define MC_ROIName_WRF_NbOfLine3                 (MCPARAMID)( 6406 << 14)
+#define MC_ROIName_WRF_1stLineRep4               (MCPARAMID)( 6407 << 14)
+#define MC_ROIName_WRF_1stLineRep4_ON              1
+#define MC_ROIName_WRF_1stLineRep4_OFF             2
+#define MC_ROIName_WRF_LastLineRep4              (MCPARAMID)( 6408 << 14)
+#define MC_ROIName_WRF_LastLineRep4_ON             1
+#define MC_ROIName_WRF_LastLineRep4_OFF            2
+#define MC_ROIName_WRF_1stColRep4                (MCPARAMID)( 6409 << 14)
+#define MC_ROIName_WRF_1stColRep4_ON               1
+#define MC_ROIName_WRF_1stColRep4_OFF              2
+#define MC_ROIName_WRF_LastColRep4               (MCPARAMID)( 6410 << 14)
+#define MC_ROIName_WRF_LastColRep4_ON              1
+#define MC_ROIName_WRF_LastColRep4_OFF             2
+#define MC_ROIName_WRF_ColumnIx4                 (MCPARAMID)( 6411 << 14)
+#define MC_ROIName_WRF_TOIwidth4                 (MCPARAMID)( 6412 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI4       (MCPARAMID)( 6413 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI4       (MCPARAMID)( 6414 << 14)
+#define MC_ROIName_WRF_Line14                    (MCPARAMID)( 6415 << 14)
+#define MC_ROIName_WRF_Line14_GB                   1
+#define MC_ROIName_WRF_Line14_BG                   2
+#define MC_ROIName_WRF_Line14_RG                   3
+#define MC_ROIName_WRF_Line14_GR                   4
+#define MC_ROIName_WRF_XferSizeM104              (MCPARAMID)( 6416 << 14)
+#define MC_ROIName_WRF_XferSizeM114              (MCPARAMID)( 6417 << 14)
+#define MC_ROIName_WRF_XferSizeM124              (MCPARAMID)( 6418 << 14)
+#define MC_ROIName_WRF_XferSizeM134              (MCPARAMID)( 6419 << 14)
+#define MC_ROIName_WRF_TOIheight4                (MCPARAMID)( 6420 << 14)
+#define MC_ROIName_WRF_LastTOI4                  (MCPARAMID)( 6421 << 14)
+#define MC_ROIName_WRF_LastTOI4_TRUE               1
+#define MC_ROIName_WRF_LastTOI4_FALSE              2
+#define MC_ROIName_WRF_TOIoffset4                (MCPARAMID)( 6422 << 14)
+#define MC_ROIName_WRF_TOIPitch4                 (MCPARAMID)( 6423 << 14)
+#define MC_ROIName_WRF_NbOfLine4                 (MCPARAMID)( 6424 << 14)
+#define MC_ROIName_WRF_1stLineRep5               (MCPARAMID)( 6425 << 14)
+#define MC_ROIName_WRF_1stLineRep5_ON              1
+#define MC_ROIName_WRF_1stLineRep5_OFF             2
+#define MC_ROIName_WRF_LastLineRep5              (MCPARAMID)( 6426 << 14)
+#define MC_ROIName_WRF_LastLineRep5_ON             1
+#define MC_ROIName_WRF_LastLineRep5_OFF            2
+#define MC_ROIName_WRF_1stColRep5                (MCPARAMID)( 6427 << 14)
+#define MC_ROIName_WRF_1stColRep5_ON               1
+#define MC_ROIName_WRF_1stColRep5_OFF              2
+#define MC_ROIName_WRF_LastColRep5               (MCPARAMID)( 6428 << 14)
+#define MC_ROIName_WRF_LastColRep5_ON              1
+#define MC_ROIName_WRF_LastColRep5_OFF             2
+#define MC_ROIName_WRF_ColumnIx5                 (MCPARAMID)( 6429 << 14)
+#define MC_ROIName_WRF_TOIwidth5                 (MCPARAMID)( 6430 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI5       (MCPARAMID)( 6431 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI5       (MCPARAMID)( 6432 << 14)
+#define MC_ROIName_WRF_Line15                    (MCPARAMID)( 6433 << 14)
+#define MC_ROIName_WRF_Line15_GB                   1
+#define MC_ROIName_WRF_Line15_BG                   2
+#define MC_ROIName_WRF_Line15_RG                   3
+#define MC_ROIName_WRF_Line15_GR                   4
+#define MC_ROIName_WRF_XferSizeM105              (MCPARAMID)( 6434 << 14)
+#define MC_ROIName_WRF_XferSizeM115              (MCPARAMID)( 6435 << 14)
+#define MC_ROIName_WRF_XferSizeM125              (MCPARAMID)( 6436 << 14)
+#define MC_ROIName_WRF_XferSizeM135              (MCPARAMID)( 6437 << 14)
+#define MC_ROIName_WRF_TOIheight5                (MCPARAMID)( 6438 << 14)
+#define MC_ROIName_WRF_LastTOI5                  (MCPARAMID)( 6439 << 14)
+#define MC_ROIName_WRF_LastTOI5_TRUE               1
+#define MC_ROIName_WRF_LastTOI5_FALSE              2
+#define MC_ROIName_WRF_TOIoffset5                (MCPARAMID)( 6440 << 14)
+#define MC_ROIName_WRF_TOIPitch5                 (MCPARAMID)( 6441 << 14)
+#define MC_ROIName_WRF_NbOfLine5                 (MCPARAMID)( 6442 << 14)
+#define MC_ROIName_WRF_1stLineRep6               (MCPARAMID)( 6443 << 14)
+#define MC_ROIName_WRF_1stLineRep6_ON              1
+#define MC_ROIName_WRF_1stLineRep6_OFF             2
+#define MC_ROIName_WRF_LastLineRep6              (MCPARAMID)( 6444 << 14)
+#define MC_ROIName_WRF_LastLineRep6_ON             1
+#define MC_ROIName_WRF_LastLineRep6_OFF            2
+#define MC_ROIName_WRF_1stColRep6                (MCPARAMID)( 6445 << 14)
+#define MC_ROIName_WRF_1stColRep6_ON               1
+#define MC_ROIName_WRF_1stColRep6_OFF              2
+#define MC_ROIName_WRF_LastColRep6               (MCPARAMID)( 6446 << 14)
+#define MC_ROIName_WRF_LastColRep6_ON              1
+#define MC_ROIName_WRF_LastColRep6_OFF             2
+#define MC_ROIName_WRF_ColumnIx6                 (MCPARAMID)( 6447 << 14)
+#define MC_ROIName_WRF_TOIwidth6                 (MCPARAMID)( 6448 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI6       (MCPARAMID)( 6449 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI6       (MCPARAMID)( 6450 << 14)
+#define MC_ROIName_WRF_Line16                    (MCPARAMID)( 6451 << 14)
+#define MC_ROIName_WRF_Line16_GB                   1
+#define MC_ROIName_WRF_Line16_BG                   2
+#define MC_ROIName_WRF_Line16_RG                   3
+#define MC_ROIName_WRF_Line16_GR                   4
+#define MC_ROIName_WRF_XferSizeM106              (MCPARAMID)( 6452 << 14)
+#define MC_ROIName_WRF_XferSizeM116              (MCPARAMID)( 6453 << 14)
+#define MC_ROIName_WRF_XferSizeM126              (MCPARAMID)( 6454 << 14)
+#define MC_ROIName_WRF_XferSizeM136              (MCPARAMID)( 6455 << 14)
+#define MC_ROIName_WRF_TOIheight6                (MCPARAMID)( 6456 << 14)
+#define MC_ROIName_WRF_LastTOI6                  (MCPARAMID)( 6457 << 14)
+#define MC_ROIName_WRF_LastTOI6_TRUE               1
+#define MC_ROIName_WRF_LastTOI6_FALSE              2
+#define MC_ROIName_WRF_TOIoffset6                (MCPARAMID)( 6458 << 14)
+#define MC_ROIName_WRF_TOIPitch6                 (MCPARAMID)( 6459 << 14)
+#define MC_ROIName_WRF_NbOfLine6                 (MCPARAMID)( 6460 << 14)
+#define MC_ROIName_WRF_1stLineRep7               (MCPARAMID)( 6461 << 14)
+#define MC_ROIName_WRF_1stLineRep7_ON              1
+#define MC_ROIName_WRF_1stLineRep7_OFF             2
+#define MC_ROIName_WRF_LastLineRep7              (MCPARAMID)( 6462 << 14)
+#define MC_ROIName_WRF_LastLineRep7_ON             1
+#define MC_ROIName_WRF_LastLineRep7_OFF            2
+#define MC_ROIName_WRF_1stColRep7                (MCPARAMID)( 6463 << 14)
+#define MC_ROIName_WRF_1stColRep7_ON               1
+#define MC_ROIName_WRF_1stColRep7_OFF              2
+#define MC_ROIName_WRF_LastColRep7               (MCPARAMID)( 6464 << 14)
+#define MC_ROIName_WRF_LastColRep7_ON              1
+#define MC_ROIName_WRF_LastColRep7_OFF             2
+#define MC_ROIName_WRF_ColumnIx7                 (MCPARAMID)( 6465 << 14)
+#define MC_ROIName_WRF_TOIwidth7                 (MCPARAMID)( 6466 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI7       (MCPARAMID)( 6467 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI7       (MCPARAMID)( 6468 << 14)
+#define MC_ROIName_WRF_Line17                    (MCPARAMID)( 6469 << 14)
+#define MC_ROIName_WRF_Line17_GB                   1
+#define MC_ROIName_WRF_Line17_BG                   2
+#define MC_ROIName_WRF_Line17_RG                   3
+#define MC_ROIName_WRF_Line17_GR                   4
+#define MC_ROIName_WRF_XferSizeM107              (MCPARAMID)( 6470 << 14)
+#define MC_ROIName_WRF_XferSizeM117              (MCPARAMID)( 6471 << 14)
+#define MC_ROIName_WRF_XferSizeM127              (MCPARAMID)( 6472 << 14)
+#define MC_ROIName_WRF_XferSizeM137              (MCPARAMID)( 6473 << 14)
+#define MC_ROIName_WRF_TOIheight7                (MCPARAMID)( 6474 << 14)
+#define MC_ROIName_WRF_LastTOI7                  (MCPARAMID)( 6475 << 14)
+#define MC_ROIName_WRF_LastTOI7_TRUE               1
+#define MC_ROIName_WRF_LastTOI7_FALSE              2
+#define MC_ROIName_WRF_TOIoffset7                (MCPARAMID)( 6476 << 14)
+#define MC_ROIName_WRF_TOIPitch7                 (MCPARAMID)( 6477 << 14)
+#define MC_ROIName_WRF_NbOfLine7                 (MCPARAMID)( 6478 << 14)
+#define MC_ROIName_WRF_1stLineRep8               (MCPARAMID)( 6479 << 14)
+#define MC_ROIName_WRF_1stLineRep8_ON              1
+#define MC_ROIName_WRF_1stLineRep8_OFF             2
+#define MC_ROIName_WRF_LastLineRep8              (MCPARAMID)( 6480 << 14)
+#define MC_ROIName_WRF_LastLineRep8_ON             1
+#define MC_ROIName_WRF_LastLineRep8_OFF            2
+#define MC_ROIName_WRF_1stColRep8                (MCPARAMID)( 6481 << 14)
+#define MC_ROIName_WRF_1stColRep8_ON               1
+#define MC_ROIName_WRF_1stColRep8_OFF              2
+#define MC_ROIName_WRF_LastColRep8               (MCPARAMID)( 6482 << 14)
+#define MC_ROIName_WRF_LastColRep8_ON              1
+#define MC_ROIName_WRF_LastColRep8_OFF             2
+#define MC_ROIName_WRF_ColumnIx8                 (MCPARAMID)( 6483 << 14)
+#define MC_ROIName_WRF_TOIwidth8                 (MCPARAMID)( 6484 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI8       (MCPARAMID)( 6485 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI8       (MCPARAMID)( 6486 << 14)
+#define MC_ROIName_WRF_Line18                    (MCPARAMID)( 6487 << 14)
+#define MC_ROIName_WRF_Line18_GB                   1
+#define MC_ROIName_WRF_Line18_BG                   2
+#define MC_ROIName_WRF_Line18_RG                   3
+#define MC_ROIName_WRF_Line18_GR                   4
+#define MC_ROIName_WRF_XferSizeM108              (MCPARAMID)( 6488 << 14)
+#define MC_ROIName_WRF_XferSizeM118              (MCPARAMID)( 6489 << 14)
+#define MC_ROIName_WRF_XferSizeM128              (MCPARAMID)( 6490 << 14)
+#define MC_ROIName_WRF_XferSizeM138              (MCPARAMID)( 6491 << 14)
+#define MC_ROIName_WRF_TOIheight8                (MCPARAMID)( 6492 << 14)
+#define MC_ROIName_WRF_LastTOI8                  (MCPARAMID)( 6493 << 14)
+#define MC_ROIName_WRF_LastTOI8_TRUE               1
+#define MC_ROIName_WRF_LastTOI8_FALSE              2
+#define MC_ROIName_WRF_TOIoffset8                (MCPARAMID)( 6494 << 14)
+#define MC_ROIName_WRF_TOIPitch8                 (MCPARAMID)( 6495 << 14)
+#define MC_ROIName_WRF_NbOfLine8                 (MCPARAMID)( 6496 << 14)
+#define MC_ROIName_WRF_1stLineRep9               (MCPARAMID)( 6497 << 14)
+#define MC_ROIName_WRF_1stLineRep9_ON              1
+#define MC_ROIName_WRF_1stLineRep9_OFF             2
+#define MC_ROIName_WRF_LastLineRep9              (MCPARAMID)( 6498 << 14)
+#define MC_ROIName_WRF_LastLineRep9_ON             1
+#define MC_ROIName_WRF_LastLineRep9_OFF            2
+#define MC_ROIName_WRF_1stColRep9                (MCPARAMID)( 6499 << 14)
+#define MC_ROIName_WRF_1stColRep9_ON               1
+#define MC_ROIName_WRF_1stColRep9_OFF              2
+#define MC_ROIName_WRF_LastColRep9               (MCPARAMID)( 6500 << 14)
+#define MC_ROIName_WRF_LastColRep9_ON              1
+#define MC_ROIName_WRF_LastColRep9_OFF             2
+#define MC_ROIName_WRF_ColumnIx9                 (MCPARAMID)( 6501 << 14)
+#define MC_ROIName_WRF_TOIwidth9                 (MCPARAMID)( 6502 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI9       (MCPARAMID)( 6503 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI9       (MCPARAMID)( 6504 << 14)
+#define MC_ROIName_WRF_Line19                    (MCPARAMID)( 6505 << 14)
+#define MC_ROIName_WRF_Line19_GB                   1
+#define MC_ROIName_WRF_Line19_BG                   2
+#define MC_ROIName_WRF_Line19_RG                   3
+#define MC_ROIName_WRF_Line19_GR                   4
+#define MC_ROIName_WRF_XferSizeM109              (MCPARAMID)( 6506 << 14)
+#define MC_ROIName_WRF_XferSizeM119              (MCPARAMID)( 6507 << 14)
+#define MC_ROIName_WRF_XferSizeM129              (MCPARAMID)( 6508 << 14)
+#define MC_ROIName_WRF_XferSizeM139              (MCPARAMID)( 6509 << 14)
+#define MC_ROIName_WRF_TOIheight9                (MCPARAMID)( 6510 << 14)
+#define MC_ROIName_WRF_LastTOI9                  (MCPARAMID)( 6511 << 14)
+#define MC_ROIName_WRF_LastTOI9_TRUE               1
+#define MC_ROIName_WRF_LastTOI9_FALSE              2
+#define MC_ROIName_WRF_TOIoffset9                (MCPARAMID)( 6512 << 14)
+#define MC_ROIName_WRF_TOIPitch9                 (MCPARAMID)( 6513 << 14)
+#define MC_ROIName_WRF_NbOfLine9                 (MCPARAMID)( 6514 << 14)
+#define MC_ROIName_WRF_1stLineRep10              (MCPARAMID)( 6515 << 14)
+#define MC_ROIName_WRF_1stLineRep10_ON             1
+#define MC_ROIName_WRF_1stLineRep10_OFF            2
+#define MC_ROIName_WRF_LastLineRep10             (MCPARAMID)( 6516 << 14)
+#define MC_ROIName_WRF_LastLineRep10_ON            1
+#define MC_ROIName_WRF_LastLineRep10_OFF           2
+#define MC_ROIName_WRF_1stColRep10               (MCPARAMID)( 6517 << 14)
+#define MC_ROIName_WRF_1stColRep10_ON              1
+#define MC_ROIName_WRF_1stColRep10_OFF             2
+#define MC_ROIName_WRF_LastColRep10              (MCPARAMID)( 6518 << 14)
+#define MC_ROIName_WRF_LastColRep10_ON             1
+#define MC_ROIName_WRF_LastColRep10_OFF            2
+#define MC_ROIName_WRF_ColumnIx10                (MCPARAMID)( 6519 << 14)
+#define MC_ROIName_WRF_TOIwidth10                (MCPARAMID)( 6520 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI10      (MCPARAMID)( 6521 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI10      (MCPARAMID)( 6522 << 14)
+#define MC_ROIName_WRF_Line110                   (MCPARAMID)( 6523 << 14)
+#define MC_ROIName_WRF_Line110_GB                  1
+#define MC_ROIName_WRF_Line110_BG                  2
+#define MC_ROIName_WRF_Line110_RG                  3
+#define MC_ROIName_WRF_Line110_GR                  4
+#define MC_ROIName_WRF_XferSizeM1010             (MCPARAMID)( 6524 << 14)
+#define MC_ROIName_WRF_XferSizeM1110             (MCPARAMID)( 6525 << 14)
+#define MC_ROIName_WRF_XferSizeM1210             (MCPARAMID)( 6526 << 14)
+#define MC_ROIName_WRF_XferSizeM1310             (MCPARAMID)( 6527 << 14)
+#define MC_ROIName_WRF_TOIheight10               (MCPARAMID)( 6528 << 14)
+#define MC_ROIName_WRF_LastTOI10                 (MCPARAMID)( 6529 << 14)
+#define MC_ROIName_WRF_LastTOI10_TRUE              1
+#define MC_ROIName_WRF_LastTOI10_FALSE             2
+#define MC_ROIName_WRF_TOIoffset10               (MCPARAMID)( 6530 << 14)
+#define MC_ROIName_WRF_TOIPitch10                (MCPARAMID)( 6531 << 14)
+#define MC_ROIName_WRF_NbOfLine10                (MCPARAMID)( 6532 << 14)
+#define MC_ROIName_WRF_1stLineRep11              (MCPARAMID)( 6533 << 14)
+#define MC_ROIName_WRF_1stLineRep11_ON             1
+#define MC_ROIName_WRF_1stLineRep11_OFF            2
+#define MC_ROIName_WRF_LastLineRep11             (MCPARAMID)( 6534 << 14)
+#define MC_ROIName_WRF_LastLineRep11_ON            1
+#define MC_ROIName_WRF_LastLineRep11_OFF           2
+#define MC_ROIName_WRF_1stColRep11               (MCPARAMID)( 6535 << 14)
+#define MC_ROIName_WRF_1stColRep11_ON              1
+#define MC_ROIName_WRF_1stColRep11_OFF             2
+#define MC_ROIName_WRF_LastColRep11              (MCPARAMID)( 6536 << 14)
+#define MC_ROIName_WRF_LastColRep11_ON             1
+#define MC_ROIName_WRF_LastColRep11_OFF            2
+#define MC_ROIName_WRF_ColumnIx11                (MCPARAMID)( 6537 << 14)
+#define MC_ROIName_WRF_TOIwidth11                (MCPARAMID)( 6538 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI11      (MCPARAMID)( 6539 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI11      (MCPARAMID)( 6540 << 14)
+#define MC_ROIName_WRF_Line111                   (MCPARAMID)( 6541 << 14)
+#define MC_ROIName_WRF_Line111_GB                  1
+#define MC_ROIName_WRF_Line111_BG                  2
+#define MC_ROIName_WRF_Line111_RG                  3
+#define MC_ROIName_WRF_Line111_GR                  4
+#define MC_ROIName_WRF_XferSizeM1011             (MCPARAMID)( 6542 << 14)
+#define MC_ROIName_WRF_XferSizeM1111             (MCPARAMID)( 6543 << 14)
+#define MC_ROIName_WRF_XferSizeM1211             (MCPARAMID)( 6544 << 14)
+#define MC_ROIName_WRF_XferSizeM1311             (MCPARAMID)( 6545 << 14)
+#define MC_ROIName_WRF_TOIheight11               (MCPARAMID)( 6546 << 14)
+#define MC_ROIName_WRF_LastTOI11                 (MCPARAMID)( 6547 << 14)
+#define MC_ROIName_WRF_LastTOI11_TRUE              1
+#define MC_ROIName_WRF_LastTOI11_FALSE             2
+#define MC_ROIName_WRF_TOIoffset11               (MCPARAMID)( 6548 << 14)
+#define MC_ROIName_WRF_TOIPitch11                (MCPARAMID)( 6549 << 14)
+#define MC_ROIName_WRF_NbOfLine11                (MCPARAMID)( 6550 << 14)
+#define MC_ROIName_WRF_1stLineRep12              (MCPARAMID)( 6551 << 14)
+#define MC_ROIName_WRF_1stLineRep12_ON             1
+#define MC_ROIName_WRF_1stLineRep12_OFF            2
+#define MC_ROIName_WRF_LastLineRep12             (MCPARAMID)( 6552 << 14)
+#define MC_ROIName_WRF_LastLineRep12_ON            1
+#define MC_ROIName_WRF_LastLineRep12_OFF           2
+#define MC_ROIName_WRF_1stColRep12               (MCPARAMID)( 6553 << 14)
+#define MC_ROIName_WRF_1stColRep12_ON              1
+#define MC_ROIName_WRF_1stColRep12_OFF             2
+#define MC_ROIName_WRF_LastColRep12              (MCPARAMID)( 6554 << 14)
+#define MC_ROIName_WRF_LastColRep12_ON             1
+#define MC_ROIName_WRF_LastColRep12_OFF            2
+#define MC_ROIName_WRF_ColumnIx12                (MCPARAMID)( 6555 << 14)
+#define MC_ROIName_WRF_TOIwidth12                (MCPARAMID)( 6556 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI12      (MCPARAMID)( 6557 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI12      (MCPARAMID)( 6558 << 14)
+#define MC_ROIName_WRF_Line112                   (MCPARAMID)( 6559 << 14)
+#define MC_ROIName_WRF_Line112_GB                  1
+#define MC_ROIName_WRF_Line112_BG                  2
+#define MC_ROIName_WRF_Line112_RG                  3
+#define MC_ROIName_WRF_Line112_GR                  4
+#define MC_ROIName_WRF_XferSizeM1012             (MCPARAMID)( 6560 << 14)
+#define MC_ROIName_WRF_XferSizeM1112             (MCPARAMID)( 6561 << 14)
+#define MC_ROIName_WRF_XferSizeM1212             (MCPARAMID)( 6562 << 14)
+#define MC_ROIName_WRF_XferSizeM1312             (MCPARAMID)( 6563 << 14)
+#define MC_ROIName_WRF_TOIheight12               (MCPARAMID)( 6564 << 14)
+#define MC_ROIName_WRF_LastTOI12                 (MCPARAMID)( 6565 << 14)
+#define MC_ROIName_WRF_LastTOI12_TRUE              1
+#define MC_ROIName_WRF_LastTOI12_FALSE             2
+#define MC_ROIName_WRF_TOIoffset12               (MCPARAMID)( 6566 << 14)
+#define MC_ROIName_WRF_TOIPitch12                (MCPARAMID)( 6567 << 14)
+#define MC_ROIName_WRF_NbOfLine12                (MCPARAMID)( 6568 << 14)
+#define MC_ROIName_WRF_1stLineRep13              (MCPARAMID)( 6569 << 14)
+#define MC_ROIName_WRF_1stLineRep13_ON             1
+#define MC_ROIName_WRF_1stLineRep13_OFF            2
+#define MC_ROIName_WRF_LastLineRep13             (MCPARAMID)( 6570 << 14)
+#define MC_ROIName_WRF_LastLineRep13_ON            1
+#define MC_ROIName_WRF_LastLineRep13_OFF           2
+#define MC_ROIName_WRF_1stColRep13               (MCPARAMID)( 6571 << 14)
+#define MC_ROIName_WRF_1stColRep13_ON              1
+#define MC_ROIName_WRF_1stColRep13_OFF             2
+#define MC_ROIName_WRF_LastColRep13              (MCPARAMID)( 6572 << 14)
+#define MC_ROIName_WRF_LastColRep13_ON             1
+#define MC_ROIName_WRF_LastColRep13_OFF            2
+#define MC_ROIName_WRF_ColumnIx13                (MCPARAMID)( 6573 << 14)
+#define MC_ROIName_WRF_TOIwidth13                (MCPARAMID)( 6574 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI13      (MCPARAMID)( 6575 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI13      (MCPARAMID)( 6576 << 14)
+#define MC_ROIName_WRF_Line113                   (MCPARAMID)( 6577 << 14)
+#define MC_ROIName_WRF_Line113_GB                  1
+#define MC_ROIName_WRF_Line113_BG                  2
+#define MC_ROIName_WRF_Line113_RG                  3
+#define MC_ROIName_WRF_Line113_GR                  4
+#define MC_ROIName_WRF_XferSizeM1013             (MCPARAMID)( 6578 << 14)
+#define MC_ROIName_WRF_XferSizeM1113             (MCPARAMID)( 6579 << 14)
+#define MC_ROIName_WRF_XferSizeM1213             (MCPARAMID)( 6580 << 14)
+#define MC_ROIName_WRF_XferSizeM1313             (MCPARAMID)( 6581 << 14)
+#define MC_ROIName_WRF_TOIheight13               (MCPARAMID)( 6582 << 14)
+#define MC_ROIName_WRF_LastTOI13                 (MCPARAMID)( 6583 << 14)
+#define MC_ROIName_WRF_LastTOI13_TRUE              1
+#define MC_ROIName_WRF_LastTOI13_FALSE             2
+#define MC_ROIName_WRF_TOIoffset13               (MCPARAMID)( 6584 << 14)
+#define MC_ROIName_WRF_TOIPitch13                (MCPARAMID)( 6585 << 14)
+#define MC_ROIName_WRF_NbOfLine13                (MCPARAMID)( 6586 << 14)
+#define MC_ROIName_WRF_1stLineRep14              (MCPARAMID)( 6587 << 14)
+#define MC_ROIName_WRF_1stLineRep14_ON             1
+#define MC_ROIName_WRF_1stLineRep14_OFF            2
+#define MC_ROIName_WRF_LastLineRep14             (MCPARAMID)( 6588 << 14)
+#define MC_ROIName_WRF_LastLineRep14_ON            1
+#define MC_ROIName_WRF_LastLineRep14_OFF           2
+#define MC_ROIName_WRF_1stColRep14               (MCPARAMID)( 6589 << 14)
+#define MC_ROIName_WRF_1stColRep14_ON              1
+#define MC_ROIName_WRF_1stColRep14_OFF             2
+#define MC_ROIName_WRF_LastColRep14              (MCPARAMID)( 6590 << 14)
+#define MC_ROIName_WRF_LastColRep14_ON             1
+#define MC_ROIName_WRF_LastColRep14_OFF            2
+#define MC_ROIName_WRF_ColumnIx14                (MCPARAMID)( 6591 << 14)
+#define MC_ROIName_WRF_TOIwidth14                (MCPARAMID)( 6592 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI14      (MCPARAMID)( 6593 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI14      (MCPARAMID)( 6594 << 14)
+#define MC_ROIName_WRF_Line114                   (MCPARAMID)( 6595 << 14)
+#define MC_ROIName_WRF_Line114_GB                  1
+#define MC_ROIName_WRF_Line114_BG                  2
+#define MC_ROIName_WRF_Line114_RG                  3
+#define MC_ROIName_WRF_Line114_GR                  4
+#define MC_ROIName_WRF_XferSizeM1014             (MCPARAMID)( 6596 << 14)
+#define MC_ROIName_WRF_XferSizeM1114             (MCPARAMID)( 6597 << 14)
+#define MC_ROIName_WRF_XferSizeM1214             (MCPARAMID)( 6598 << 14)
+#define MC_ROIName_WRF_XferSizeM1314             (MCPARAMID)( 6599 << 14)
+#define MC_ROIName_WRF_TOIheight14               (MCPARAMID)( 6600 << 14)
+#define MC_ROIName_WRF_LastTOI14                 (MCPARAMID)( 6601 << 14)
+#define MC_ROIName_WRF_LastTOI14_TRUE              1
+#define MC_ROIName_WRF_LastTOI14_FALSE             2
+#define MC_ROIName_WRF_TOIoffset14               (MCPARAMID)( 6602 << 14)
+#define MC_ROIName_WRF_TOIPitch14                (MCPARAMID)( 6603 << 14)
+#define MC_ROIName_WRF_NbOfLine14                (MCPARAMID)( 6604 << 14)
+#define MC_ROIName_WRF_1stLineRep15              (MCPARAMID)( 6605 << 14)
+#define MC_ROIName_WRF_1stLineRep15_ON             1
+#define MC_ROIName_WRF_1stLineRep15_OFF            2
+#define MC_ROIName_WRF_LastLineRep15             (MCPARAMID)( 6606 << 14)
+#define MC_ROIName_WRF_LastLineRep15_ON            1
+#define MC_ROIName_WRF_LastLineRep15_OFF           2
+#define MC_ROIName_WRF_1stColRep15               (MCPARAMID)( 6607 << 14)
+#define MC_ROIName_WRF_1stColRep15_ON              1
+#define MC_ROIName_WRF_1stColRep15_OFF             2
+#define MC_ROIName_WRF_LastColRep15              (MCPARAMID)( 6608 << 14)
+#define MC_ROIName_WRF_LastColRep15_ON             1
+#define MC_ROIName_WRF_LastColRep15_OFF            2
+#define MC_ROIName_WRF_ColumnIx15                (MCPARAMID)( 6609 << 14)
+#define MC_ROIName_WRF_TOIwidth15                (MCPARAMID)( 6610 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI15      (MCPARAMID)( 6611 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI15      (MCPARAMID)( 6612 << 14)
+#define MC_ROIName_WRF_Line115                   (MCPARAMID)( 6613 << 14)
+#define MC_ROIName_WRF_Line115_GB                  1
+#define MC_ROIName_WRF_Line115_BG                  2
+#define MC_ROIName_WRF_Line115_RG                  3
+#define MC_ROIName_WRF_Line115_GR                  4
+#define MC_ROIName_WRF_XferSizeM1015             (MCPARAMID)( 6614 << 14)
+#define MC_ROIName_WRF_XferSizeM1115             (MCPARAMID)( 6615 << 14)
+#define MC_ROIName_WRF_XferSizeM1215             (MCPARAMID)( 6616 << 14)
+#define MC_ROIName_WRF_XferSizeM1315             (MCPARAMID)( 6617 << 14)
+#define MC_ROIName_WRF_TOIheight15               (MCPARAMID)( 6618 << 14)
+#define MC_ROIName_WRF_LastTOI15                 (MCPARAMID)( 6619 << 14)
+#define MC_ROIName_WRF_LastTOI15_TRUE              1
+#define MC_ROIName_WRF_LastTOI15_FALSE             2
+#define MC_ROIName_WRF_TOIoffset15               (MCPARAMID)( 6620 << 14)
+#define MC_ROIName_WRF_TOIPitch15                (MCPARAMID)( 6621 << 14)
+#define MC_ROIName_WRF_NbOfLine15                (MCPARAMID)( 6622 << 14)
+#define MC_ROIName_WRF_1stLineRep16              (MCPARAMID)( 6623 << 14)
+#define MC_ROIName_WRF_1stLineRep16_ON             1
+#define MC_ROIName_WRF_1stLineRep16_OFF            2
+#define MC_ROIName_WRF_LastLineRep16             (MCPARAMID)( 6624 << 14)
+#define MC_ROIName_WRF_LastLineRep16_ON            1
+#define MC_ROIName_WRF_LastLineRep16_OFF           2
+#define MC_ROIName_WRF_1stColRep16               (MCPARAMID)( 6625 << 14)
+#define MC_ROIName_WRF_1stColRep16_ON              1
+#define MC_ROIName_WRF_1stColRep16_OFF             2
+#define MC_ROIName_WRF_LastColRep16              (MCPARAMID)( 6626 << 14)
+#define MC_ROIName_WRF_LastColRep16_ON             1
+#define MC_ROIName_WRF_LastColRep16_OFF            2
+#define MC_ROIName_WRF_ColumnIx16                (MCPARAMID)( 6627 << 14)
+#define MC_ROIName_WRF_TOIwidth16                (MCPARAMID)( 6628 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI16      (MCPARAMID)( 6629 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI16      (MCPARAMID)( 6630 << 14)
+#define MC_ROIName_WRF_Line116                   (MCPARAMID)( 6631 << 14)
+#define MC_ROIName_WRF_Line116_GB                  1
+#define MC_ROIName_WRF_Line116_BG                  2
+#define MC_ROIName_WRF_Line116_RG                  3
+#define MC_ROIName_WRF_Line116_GR                  4
+#define MC_ROIName_WRF_XferSizeM1016             (MCPARAMID)( 6632 << 14)
+#define MC_ROIName_WRF_XferSizeM1116             (MCPARAMID)( 6633 << 14)
+#define MC_ROIName_WRF_XferSizeM1216             (MCPARAMID)( 6634 << 14)
+#define MC_ROIName_WRF_XferSizeM1316             (MCPARAMID)( 6635 << 14)
+#define MC_ROIName_WRF_TOIheight16               (MCPARAMID)( 6636 << 14)
+#define MC_ROIName_WRF_LastTOI16                 (MCPARAMID)( 6637 << 14)
+#define MC_ROIName_WRF_LastTOI16_TRUE              1
+#define MC_ROIName_WRF_LastTOI16_FALSE             2
+#define MC_ROIName_WRF_TOIoffset16               (MCPARAMID)( 6638 << 14)
+#define MC_ROIName_WRF_TOIPitch16                (MCPARAMID)( 6639 << 14)
+#define MC_ROIName_WRF_NbOfLine16                (MCPARAMID)( 6640 << 14)
+#define MC_ROIName_WRF_1stLineRep17              (MCPARAMID)( 6641 << 14)
+#define MC_ROIName_WRF_1stLineRep17_ON             1
+#define MC_ROIName_WRF_1stLineRep17_OFF            2
+#define MC_ROIName_WRF_LastLineRep17             (MCPARAMID)( 6642 << 14)
+#define MC_ROIName_WRF_LastLineRep17_ON            1
+#define MC_ROIName_WRF_LastLineRep17_OFF           2
+#define MC_ROIName_WRF_1stColRep17               (MCPARAMID)( 6643 << 14)
+#define MC_ROIName_WRF_1stColRep17_ON              1
+#define MC_ROIName_WRF_1stColRep17_OFF             2
+#define MC_ROIName_WRF_LastColRep17              (MCPARAMID)( 6644 << 14)
+#define MC_ROIName_WRF_LastColRep17_ON             1
+#define MC_ROIName_WRF_LastColRep17_OFF            2
+#define MC_ROIName_WRF_ColumnIx17                (MCPARAMID)( 6645 << 14)
+#define MC_ROIName_WRF_TOIwidth17                (MCPARAMID)( 6646 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI17      (MCPARAMID)( 6647 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI17      (MCPARAMID)( 6648 << 14)
+#define MC_ROIName_WRF_Line117                   (MCPARAMID)( 6649 << 14)
+#define MC_ROIName_WRF_Line117_GB                  1
+#define MC_ROIName_WRF_Line117_BG                  2
+#define MC_ROIName_WRF_Line117_RG                  3
+#define MC_ROIName_WRF_Line117_GR                  4
+#define MC_ROIName_WRF_XferSizeM1017             (MCPARAMID)( 6650 << 14)
+#define MC_ROIName_WRF_XferSizeM1117             (MCPARAMID)( 6651 << 14)
+#define MC_ROIName_WRF_XferSizeM1217             (MCPARAMID)( 6652 << 14)
+#define MC_ROIName_WRF_XferSizeM1317             (MCPARAMID)( 6653 << 14)
+#define MC_ROIName_WRF_TOIheight17               (MCPARAMID)( 6654 << 14)
+#define MC_ROIName_WRF_LastTOI17                 (MCPARAMID)( 6655 << 14)
+#define MC_ROIName_WRF_LastTOI17_TRUE              1
+#define MC_ROIName_WRF_LastTOI17_FALSE             2
+#define MC_ROIName_WRF_TOIoffset17               (MCPARAMID)( 6656 << 14)
+#define MC_ROIName_WRF_TOIPitch17                (MCPARAMID)( 6657 << 14)
+#define MC_ROIName_WRF_NbOfLine17                (MCPARAMID)( 6658 << 14)
+#define MC_ROIName_WRF_1stLineRep18              (MCPARAMID)( 6659 << 14)
+#define MC_ROIName_WRF_1stLineRep18_ON             1
+#define MC_ROIName_WRF_1stLineRep18_OFF            2
+#define MC_ROIName_WRF_LastLineRep18             (MCPARAMID)( 6660 << 14)
+#define MC_ROIName_WRF_LastLineRep18_ON            1
+#define MC_ROIName_WRF_LastLineRep18_OFF           2
+#define MC_ROIName_WRF_1stColRep18               (MCPARAMID)( 6661 << 14)
+#define MC_ROIName_WRF_1stColRep18_ON              1
+#define MC_ROIName_WRF_1stColRep18_OFF             2
+#define MC_ROIName_WRF_LastColRep18              (MCPARAMID)( 6662 << 14)
+#define MC_ROIName_WRF_LastColRep18_ON             1
+#define MC_ROIName_WRF_LastColRep18_OFF            2
+#define MC_ROIName_WRF_ColumnIx18                (MCPARAMID)( 6663 << 14)
+#define MC_ROIName_WRF_TOIwidth18                (MCPARAMID)( 6664 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI18      (MCPARAMID)( 6665 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI18      (MCPARAMID)( 6666 << 14)
+#define MC_ROIName_WRF_Line118                   (MCPARAMID)( 6667 << 14)
+#define MC_ROIName_WRF_Line118_GB                  1
+#define MC_ROIName_WRF_Line118_BG                  2
+#define MC_ROIName_WRF_Line118_RG                  3
+#define MC_ROIName_WRF_Line118_GR                  4
+#define MC_ROIName_WRF_XferSizeM1018             (MCPARAMID)( 6668 << 14)
+#define MC_ROIName_WRF_XferSizeM1118             (MCPARAMID)( 6669 << 14)
+#define MC_ROIName_WRF_XferSizeM1218             (MCPARAMID)( 6670 << 14)
+#define MC_ROIName_WRF_XferSizeM1318             (MCPARAMID)( 6671 << 14)
+#define MC_ROIName_WRF_TOIheight18               (MCPARAMID)( 6672 << 14)
+#define MC_ROIName_WRF_LastTOI18                 (MCPARAMID)( 6673 << 14)
+#define MC_ROIName_WRF_LastTOI18_TRUE              1
+#define MC_ROIName_WRF_LastTOI18_FALSE             2
+#define MC_ROIName_WRF_TOIoffset18               (MCPARAMID)( 6674 << 14)
+#define MC_ROIName_WRF_TOIPitch18                (MCPARAMID)( 6675 << 14)
+#define MC_ROIName_WRF_NbOfLine18                (MCPARAMID)( 6676 << 14)
+#define MC_ROIName_WRF_1stLineRep19              (MCPARAMID)( 6677 << 14)
+#define MC_ROIName_WRF_1stLineRep19_ON             1
+#define MC_ROIName_WRF_1stLineRep19_OFF            2
+#define MC_ROIName_WRF_LastLineRep19             (MCPARAMID)( 6678 << 14)
+#define MC_ROIName_WRF_LastLineRep19_ON            1
+#define MC_ROIName_WRF_LastLineRep19_OFF           2
+#define MC_ROIName_WRF_1stColRep19               (MCPARAMID)( 6679 << 14)
+#define MC_ROIName_WRF_1stColRep19_ON              1
+#define MC_ROIName_WRF_1stColRep19_OFF             2
+#define MC_ROIName_WRF_LastColRep19              (MCPARAMID)( 6680 << 14)
+#define MC_ROIName_WRF_LastColRep19_ON             1
+#define MC_ROIName_WRF_LastColRep19_OFF            2
+#define MC_ROIName_WRF_ColumnIx19                (MCPARAMID)( 6681 << 14)
+#define MC_ROIName_WRF_TOIwidth19                (MCPARAMID)( 6682 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI19      (MCPARAMID)( 6683 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI19      (MCPARAMID)( 6684 << 14)
+#define MC_ROIName_WRF_Line119                   (MCPARAMID)( 6685 << 14)
+#define MC_ROIName_WRF_Line119_GB                  1
+#define MC_ROIName_WRF_Line119_BG                  2
+#define MC_ROIName_WRF_Line119_RG                  3
+#define MC_ROIName_WRF_Line119_GR                  4
+#define MC_ROIName_WRF_XferSizeM1019             (MCPARAMID)( 6686 << 14)
+#define MC_ROIName_WRF_XferSizeM1119             (MCPARAMID)( 6687 << 14)
+#define MC_ROIName_WRF_XferSizeM1219             (MCPARAMID)( 6688 << 14)
+#define MC_ROIName_WRF_XferSizeM1319             (MCPARAMID)( 6689 << 14)
+#define MC_ROIName_WRF_TOIheight19               (MCPARAMID)( 6690 << 14)
+#define MC_ROIName_WRF_LastTOI19                 (MCPARAMID)( 6691 << 14)
+#define MC_ROIName_WRF_LastTOI19_TRUE              1
+#define MC_ROIName_WRF_LastTOI19_FALSE             2
+#define MC_ROIName_WRF_TOIoffset19               (MCPARAMID)( 6692 << 14)
+#define MC_ROIName_WRF_TOIPitch19                (MCPARAMID)( 6693 << 14)
+#define MC_ROIName_WRF_NbOfLine19                (MCPARAMID)( 6694 << 14)
+#define MC_ROIName_WRF_1stLineRep20              (MCPARAMID)( 6695 << 14)
+#define MC_ROIName_WRF_1stLineRep20_ON             1
+#define MC_ROIName_WRF_1stLineRep20_OFF            2
+#define MC_ROIName_WRF_LastLineRep20             (MCPARAMID)( 6696 << 14)
+#define MC_ROIName_WRF_LastLineRep20_ON            1
+#define MC_ROIName_WRF_LastLineRep20_OFF           2
+#define MC_ROIName_WRF_1stColRep20               (MCPARAMID)( 6697 << 14)
+#define MC_ROIName_WRF_1stColRep20_ON              1
+#define MC_ROIName_WRF_1stColRep20_OFF             2
+#define MC_ROIName_WRF_LastColRep20              (MCPARAMID)( 6698 << 14)
+#define MC_ROIName_WRF_LastColRep20_ON             1
+#define MC_ROIName_WRF_LastColRep20_OFF            2
+#define MC_ROIName_WRF_ColumnIx20                (MCPARAMID)( 6699 << 14)
+#define MC_ROIName_WRF_TOIwidth20                (MCPARAMID)( 6700 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI20      (MCPARAMID)( 6701 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI20      (MCPARAMID)( 6702 << 14)
+#define MC_ROIName_WRF_Line120                   (MCPARAMID)( 6703 << 14)
+#define MC_ROIName_WRF_Line120_GB                  1
+#define MC_ROIName_WRF_Line120_BG                  2
+#define MC_ROIName_WRF_Line120_RG                  3
+#define MC_ROIName_WRF_Line120_GR                  4
+#define MC_ROIName_WRF_XferSizeM1020             (MCPARAMID)( 6704 << 14)
+#define MC_ROIName_WRF_XferSizeM1120             (MCPARAMID)( 6705 << 14)
+#define MC_ROIName_WRF_XferSizeM1220             (MCPARAMID)( 6706 << 14)
+#define MC_ROIName_WRF_XferSizeM1320             (MCPARAMID)( 6707 << 14)
+#define MC_ROIName_WRF_TOIheight20               (MCPARAMID)( 6708 << 14)
+#define MC_ROIName_WRF_LastTOI20                 (MCPARAMID)( 6709 << 14)
+#define MC_ROIName_WRF_LastTOI20_TRUE              1
+#define MC_ROIName_WRF_LastTOI20_FALSE             2
+#define MC_ROIName_WRF_TOIoffset20               (MCPARAMID)( 6710 << 14)
+#define MC_ROIName_WRF_TOIPitch20                (MCPARAMID)( 6711 << 14)
+#define MC_ROIName_WRF_NbOfLine20                (MCPARAMID)( 6712 << 14)
+#define MC_ROIName_WRF_1stLineRep21              (MCPARAMID)( 6713 << 14)
+#define MC_ROIName_WRF_1stLineRep21_ON             1
+#define MC_ROIName_WRF_1stLineRep21_OFF            2
+#define MC_ROIName_WRF_LastLineRep21             (MCPARAMID)( 6714 << 14)
+#define MC_ROIName_WRF_LastLineRep21_ON            1
+#define MC_ROIName_WRF_LastLineRep21_OFF           2
+#define MC_ROIName_WRF_1stColRep21               (MCPARAMID)( 6715 << 14)
+#define MC_ROIName_WRF_1stColRep21_ON              1
+#define MC_ROIName_WRF_1stColRep21_OFF             2
+#define MC_ROIName_WRF_LastColRep21              (MCPARAMID)( 6716 << 14)
+#define MC_ROIName_WRF_LastColRep21_ON             1
+#define MC_ROIName_WRF_LastColRep21_OFF            2
+#define MC_ROIName_WRF_ColumnIx21                (MCPARAMID)( 6717 << 14)
+#define MC_ROIName_WRF_TOIwidth21                (MCPARAMID)( 6718 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI21      (MCPARAMID)( 6719 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI21      (MCPARAMID)( 6720 << 14)
+#define MC_ROIName_WRF_Line121                   (MCPARAMID)( 6721 << 14)
+#define MC_ROIName_WRF_Line121_GB                  1
+#define MC_ROIName_WRF_Line121_BG                  2
+#define MC_ROIName_WRF_Line121_RG                  3
+#define MC_ROIName_WRF_Line121_GR                  4
+#define MC_ROIName_WRF_XferSizeM1021             (MCPARAMID)( 6722 << 14)
+#define MC_ROIName_WRF_XferSizeM1121             (MCPARAMID)( 6723 << 14)
+#define MC_ROIName_WRF_XferSizeM1221             (MCPARAMID)( 6724 << 14)
+#define MC_ROIName_WRF_XferSizeM1321             (MCPARAMID)( 6725 << 14)
+#define MC_ROIName_WRF_TOIheight21               (MCPARAMID)( 6726 << 14)
+#define MC_ROIName_WRF_LastTOI21                 (MCPARAMID)( 6727 << 14)
+#define MC_ROIName_WRF_LastTOI21_TRUE              1
+#define MC_ROIName_WRF_LastTOI21_FALSE             2
+#define MC_ROIName_WRF_TOIoffset21               (MCPARAMID)( 6728 << 14)
+#define MC_ROIName_WRF_TOIPitch21                (MCPARAMID)( 6729 << 14)
+#define MC_ROIName_WRF_NbOfLine21                (MCPARAMID)( 6730 << 14)
+#define MC_ROIName_WRF_1stLineRep22              (MCPARAMID)( 6731 << 14)
+#define MC_ROIName_WRF_1stLineRep22_ON             1
+#define MC_ROIName_WRF_1stLineRep22_OFF            2
+#define MC_ROIName_WRF_LastLineRep22             (MCPARAMID)( 6732 << 14)
+#define MC_ROIName_WRF_LastLineRep22_ON            1
+#define MC_ROIName_WRF_LastLineRep22_OFF           2
+#define MC_ROIName_WRF_1stColRep22               (MCPARAMID)( 6733 << 14)
+#define MC_ROIName_WRF_1stColRep22_ON              1
+#define MC_ROIName_WRF_1stColRep22_OFF             2
+#define MC_ROIName_WRF_LastColRep22              (MCPARAMID)( 6734 << 14)
+#define MC_ROIName_WRF_LastColRep22_ON             1
+#define MC_ROIName_WRF_LastColRep22_OFF            2
+#define MC_ROIName_WRF_ColumnIx22                (MCPARAMID)( 6735 << 14)
+#define MC_ROIName_WRF_TOIwidth22                (MCPARAMID)( 6736 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI22      (MCPARAMID)( 6737 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI22      (MCPARAMID)( 6738 << 14)
+#define MC_ROIName_WRF_Line122                   (MCPARAMID)( 6739 << 14)
+#define MC_ROIName_WRF_Line122_GB                  1
+#define MC_ROIName_WRF_Line122_BG                  2
+#define MC_ROIName_WRF_Line122_RG                  3
+#define MC_ROIName_WRF_Line122_GR                  4
+#define MC_ROIName_WRF_XferSizeM1022             (MCPARAMID)( 6740 << 14)
+#define MC_ROIName_WRF_XferSizeM1122             (MCPARAMID)( 6741 << 14)
+#define MC_ROIName_WRF_XferSizeM1222             (MCPARAMID)( 6742 << 14)
+#define MC_ROIName_WRF_XferSizeM1322             (MCPARAMID)( 6743 << 14)
+#define MC_ROIName_WRF_TOIheight22               (MCPARAMID)( 6744 << 14)
+#define MC_ROIName_WRF_LastTOI22                 (MCPARAMID)( 6745 << 14)
+#define MC_ROIName_WRF_LastTOI22_TRUE              1
+#define MC_ROIName_WRF_LastTOI22_FALSE             2
+#define MC_ROIName_WRF_TOIoffset22               (MCPARAMID)( 6746 << 14)
+#define MC_ROIName_WRF_TOIPitch22                (MCPARAMID)( 6747 << 14)
+#define MC_ROIName_WRF_NbOfLine22                (MCPARAMID)( 6748 << 14)
+#define MC_ROIName_WRF_1stLineRep23              (MCPARAMID)( 6749 << 14)
+#define MC_ROIName_WRF_1stLineRep23_ON             1
+#define MC_ROIName_WRF_1stLineRep23_OFF            2
+#define MC_ROIName_WRF_LastLineRep23             (MCPARAMID)( 6750 << 14)
+#define MC_ROIName_WRF_LastLineRep23_ON            1
+#define MC_ROIName_WRF_LastLineRep23_OFF           2
+#define MC_ROIName_WRF_1stColRep23               (MCPARAMID)( 6751 << 14)
+#define MC_ROIName_WRF_1stColRep23_ON              1
+#define MC_ROIName_WRF_1stColRep23_OFF             2
+#define MC_ROIName_WRF_LastColRep23              (MCPARAMID)( 6752 << 14)
+#define MC_ROIName_WRF_LastColRep23_ON             1
+#define MC_ROIName_WRF_LastColRep23_OFF            2
+#define MC_ROIName_WRF_ColumnIx23                (MCPARAMID)( 6753 << 14)
+#define MC_ROIName_WRF_TOIwidth23                (MCPARAMID)( 6754 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI23      (MCPARAMID)( 6755 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI23      (MCPARAMID)( 6756 << 14)
+#define MC_ROIName_WRF_Line123                   (MCPARAMID)( 6757 << 14)
+#define MC_ROIName_WRF_Line123_GB                  1
+#define MC_ROIName_WRF_Line123_BG                  2
+#define MC_ROIName_WRF_Line123_RG                  3
+#define MC_ROIName_WRF_Line123_GR                  4
+#define MC_ROIName_WRF_XferSizeM1023             (MCPARAMID)( 6758 << 14)
+#define MC_ROIName_WRF_XferSizeM1123             (MCPARAMID)( 6759 << 14)
+#define MC_ROIName_WRF_XferSizeM1223             (MCPARAMID)( 6760 << 14)
+#define MC_ROIName_WRF_XferSizeM1323             (MCPARAMID)( 6761 << 14)
+#define MC_ROIName_WRF_TOIheight23               (MCPARAMID)( 6762 << 14)
+#define MC_ROIName_WRF_LastTOI23                 (MCPARAMID)( 6763 << 14)
+#define MC_ROIName_WRF_LastTOI23_TRUE              1
+#define MC_ROIName_WRF_LastTOI23_FALSE             2
+#define MC_ROIName_WRF_TOIoffset23               (MCPARAMID)( 6764 << 14)
+#define MC_ROIName_WRF_TOIPitch23                (MCPARAMID)( 6765 << 14)
+#define MC_ROIName_WRF_NbOfLine23                (MCPARAMID)( 6766 << 14)
+#define MC_ROIName_WRF_1stLineRep24              (MCPARAMID)( 6767 << 14)
+#define MC_ROIName_WRF_1stLineRep24_ON             1
+#define MC_ROIName_WRF_1stLineRep24_OFF            2
+#define MC_ROIName_WRF_LastLineRep24             (MCPARAMID)( 6768 << 14)
+#define MC_ROIName_WRF_LastLineRep24_ON            1
+#define MC_ROIName_WRF_LastLineRep24_OFF           2
+#define MC_ROIName_WRF_1stColRep24               (MCPARAMID)( 6769 << 14)
+#define MC_ROIName_WRF_1stColRep24_ON              1
+#define MC_ROIName_WRF_1stColRep24_OFF             2
+#define MC_ROIName_WRF_LastColRep24              (MCPARAMID)( 6770 << 14)
+#define MC_ROIName_WRF_LastColRep24_ON             1
+#define MC_ROIName_WRF_LastColRep24_OFF            2
+#define MC_ROIName_WRF_ColumnIx24                (MCPARAMID)( 6771 << 14)
+#define MC_ROIName_WRF_TOIwidth24                (MCPARAMID)( 6772 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI24      (MCPARAMID)( 6773 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI24      (MCPARAMID)( 6774 << 14)
+#define MC_ROIName_WRF_Line124                   (MCPARAMID)( 6775 << 14)
+#define MC_ROIName_WRF_Line124_GB                  1
+#define MC_ROIName_WRF_Line124_BG                  2
+#define MC_ROIName_WRF_Line124_RG                  3
+#define MC_ROIName_WRF_Line124_GR                  4
+#define MC_ROIName_WRF_XferSizeM1024             (MCPARAMID)( 6776 << 14)
+#define MC_ROIName_WRF_XferSizeM1124             (MCPARAMID)( 6777 << 14)
+#define MC_ROIName_WRF_XferSizeM1224             (MCPARAMID)( 6778 << 14)
+#define MC_ROIName_WRF_XferSizeM1324             (MCPARAMID)( 6779 << 14)
+#define MC_ROIName_WRF_TOIheight24               (MCPARAMID)( 6780 << 14)
+#define MC_ROIName_WRF_LastTOI24                 (MCPARAMID)( 6781 << 14)
+#define MC_ROIName_WRF_LastTOI24_TRUE              1
+#define MC_ROIName_WRF_LastTOI24_FALSE             2
+#define MC_ROIName_WRF_TOIoffset24               (MCPARAMID)( 6782 << 14)
+#define MC_ROIName_WRF_TOIPitch24                (MCPARAMID)( 6783 << 14)
+#define MC_ROIName_WRF_NbOfLine24                (MCPARAMID)( 6784 << 14)
+#define MC_ROIName_WRF_1stLineRep25              (MCPARAMID)( 6785 << 14)
+#define MC_ROIName_WRF_1stLineRep25_ON             1
+#define MC_ROIName_WRF_1stLineRep25_OFF            2
+#define MC_ROIName_WRF_LastLineRep25             (MCPARAMID)( 6786 << 14)
+#define MC_ROIName_WRF_LastLineRep25_ON            1
+#define MC_ROIName_WRF_LastLineRep25_OFF           2
+#define MC_ROIName_WRF_1stColRep25               (MCPARAMID)( 6787 << 14)
+#define MC_ROIName_WRF_1stColRep25_ON              1
+#define MC_ROIName_WRF_1stColRep25_OFF             2
+#define MC_ROIName_WRF_LastColRep25              (MCPARAMID)( 6788 << 14)
+#define MC_ROIName_WRF_LastColRep25_ON             1
+#define MC_ROIName_WRF_LastColRep25_OFF            2
+#define MC_ROIName_WRF_ColumnIx25                (MCPARAMID)( 6789 << 14)
+#define MC_ROIName_WRF_TOIwidth25                (MCPARAMID)( 6790 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI25      (MCPARAMID)( 6791 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI25      (MCPARAMID)( 6792 << 14)
+#define MC_ROIName_WRF_Line125                   (MCPARAMID)( 6793 << 14)
+#define MC_ROIName_WRF_Line125_GB                  1
+#define MC_ROIName_WRF_Line125_BG                  2
+#define MC_ROIName_WRF_Line125_RG                  3
+#define MC_ROIName_WRF_Line125_GR                  4
+#define MC_ROIName_WRF_XferSizeM1025             (MCPARAMID)( 6794 << 14)
+#define MC_ROIName_WRF_XferSizeM1125             (MCPARAMID)( 6795 << 14)
+#define MC_ROIName_WRF_XferSizeM1225             (MCPARAMID)( 6796 << 14)
+#define MC_ROIName_WRF_XferSizeM1325             (MCPARAMID)( 6797 << 14)
+#define MC_ROIName_WRF_TOIheight25               (MCPARAMID)( 6798 << 14)
+#define MC_ROIName_WRF_LastTOI25                 (MCPARAMID)( 6799 << 14)
+#define MC_ROIName_WRF_LastTOI25_TRUE              1
+#define MC_ROIName_WRF_LastTOI25_FALSE             2
+#define MC_ROIName_WRF_TOIoffset25               (MCPARAMID)( 6800 << 14)
+#define MC_ROIName_WRF_TOIPitch25                (MCPARAMID)( 6801 << 14)
+#define MC_ROIName_WRF_NbOfLine25                (MCPARAMID)( 6802 << 14)
+#define MC_ROIName_WRF_1stLineRep26              (MCPARAMID)( 6803 << 14)
+#define MC_ROIName_WRF_1stLineRep26_ON             1
+#define MC_ROIName_WRF_1stLineRep26_OFF            2
+#define MC_ROIName_WRF_LastLineRep26             (MCPARAMID)( 6804 << 14)
+#define MC_ROIName_WRF_LastLineRep26_ON            1
+#define MC_ROIName_WRF_LastLineRep26_OFF           2
+#define MC_ROIName_WRF_1stColRep26               (MCPARAMID)( 6805 << 14)
+#define MC_ROIName_WRF_1stColRep26_ON              1
+#define MC_ROIName_WRF_1stColRep26_OFF             2
+#define MC_ROIName_WRF_LastColRep26              (MCPARAMID)( 6806 << 14)
+#define MC_ROIName_WRF_LastColRep26_ON             1
+#define MC_ROIName_WRF_LastColRep26_OFF            2
+#define MC_ROIName_WRF_ColumnIx26                (MCPARAMID)( 6807 << 14)
+#define MC_ROIName_WRF_TOIwidth26                (MCPARAMID)( 6808 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI26      (MCPARAMID)( 6809 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI26      (MCPARAMID)( 6810 << 14)
+#define MC_ROIName_WRF_Line126                   (MCPARAMID)( 6811 << 14)
+#define MC_ROIName_WRF_Line126_GB                  1
+#define MC_ROIName_WRF_Line126_BG                  2
+#define MC_ROIName_WRF_Line126_RG                  3
+#define MC_ROIName_WRF_Line126_GR                  4
+#define MC_ROIName_WRF_XferSizeM1026             (MCPARAMID)( 6812 << 14)
+#define MC_ROIName_WRF_XferSizeM1126             (MCPARAMID)( 6813 << 14)
+#define MC_ROIName_WRF_XferSizeM1226             (MCPARAMID)( 6814 << 14)
+#define MC_ROIName_WRF_XferSizeM1326             (MCPARAMID)( 6815 << 14)
+#define MC_ROIName_WRF_TOIheight26               (MCPARAMID)( 6816 << 14)
+#define MC_ROIName_WRF_LastTOI26                 (MCPARAMID)( 6817 << 14)
+#define MC_ROIName_WRF_LastTOI26_TRUE              1
+#define MC_ROIName_WRF_LastTOI26_FALSE             2
+#define MC_ROIName_WRF_TOIoffset26               (MCPARAMID)( 6818 << 14)
+#define MC_ROIName_WRF_TOIPitch26                (MCPARAMID)( 6819 << 14)
+#define MC_ROIName_WRF_NbOfLine26                (MCPARAMID)( 6820 << 14)
+#define MC_ROIName_WRF_1stLineRep27              (MCPARAMID)( 6821 << 14)
+#define MC_ROIName_WRF_1stLineRep27_ON             1
+#define MC_ROIName_WRF_1stLineRep27_OFF            2
+#define MC_ROIName_WRF_LastLineRep27             (MCPARAMID)( 6822 << 14)
+#define MC_ROIName_WRF_LastLineRep27_ON            1
+#define MC_ROIName_WRF_LastLineRep27_OFF           2
+#define MC_ROIName_WRF_1stColRep27               (MCPARAMID)( 6823 << 14)
+#define MC_ROIName_WRF_1stColRep27_ON              1
+#define MC_ROIName_WRF_1stColRep27_OFF             2
+#define MC_ROIName_WRF_LastColRep27              (MCPARAMID)( 6824 << 14)
+#define MC_ROIName_WRF_LastColRep27_ON             1
+#define MC_ROIName_WRF_LastColRep27_OFF            2
+#define MC_ROIName_WRF_ColumnIx27                (MCPARAMID)( 6825 << 14)
+#define MC_ROIName_WRF_TOIwidth27                (MCPARAMID)( 6826 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI27      (MCPARAMID)( 6827 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI27      (MCPARAMID)( 6828 << 14)
+#define MC_ROIName_WRF_Line127                   (MCPARAMID)( 6829 << 14)
+#define MC_ROIName_WRF_Line127_GB                  1
+#define MC_ROIName_WRF_Line127_BG                  2
+#define MC_ROIName_WRF_Line127_RG                  3
+#define MC_ROIName_WRF_Line127_GR                  4
+#define MC_ROIName_WRF_XferSizeM1027             (MCPARAMID)( 6830 << 14)
+#define MC_ROIName_WRF_XferSizeM1127             (MCPARAMID)( 6831 << 14)
+#define MC_ROIName_WRF_XferSizeM1227             (MCPARAMID)( 6832 << 14)
+#define MC_ROIName_WRF_XferSizeM1327             (MCPARAMID)( 6833 << 14)
+#define MC_ROIName_WRF_TOIheight27               (MCPARAMID)( 6834 << 14)
+#define MC_ROIName_WRF_LastTOI27                 (MCPARAMID)( 6835 << 14)
+#define MC_ROIName_WRF_LastTOI27_TRUE              1
+#define MC_ROIName_WRF_LastTOI27_FALSE             2
+#define MC_ROIName_WRF_TOIoffset27               (MCPARAMID)( 6836 << 14)
+#define MC_ROIName_WRF_TOIPitch27                (MCPARAMID)( 6837 << 14)
+#define MC_ROIName_WRF_NbOfLine27                (MCPARAMID)( 6838 << 14)
+#define MC_ROIName_WRF_1stLineRep28              (MCPARAMID)( 6839 << 14)
+#define MC_ROIName_WRF_1stLineRep28_ON             1
+#define MC_ROIName_WRF_1stLineRep28_OFF            2
+#define MC_ROIName_WRF_LastLineRep28             (MCPARAMID)( 6840 << 14)
+#define MC_ROIName_WRF_LastLineRep28_ON            1
+#define MC_ROIName_WRF_LastLineRep28_OFF           2
+#define MC_ROIName_WRF_1stColRep28               (MCPARAMID)( 6841 << 14)
+#define MC_ROIName_WRF_1stColRep28_ON              1
+#define MC_ROIName_WRF_1stColRep28_OFF             2
+#define MC_ROIName_WRF_LastColRep28              (MCPARAMID)( 6842 << 14)
+#define MC_ROIName_WRF_LastColRep28_ON             1
+#define MC_ROIName_WRF_LastColRep28_OFF            2
+#define MC_ROIName_WRF_ColumnIx28                (MCPARAMID)( 6843 << 14)
+#define MC_ROIName_WRF_TOIwidth28                (MCPARAMID)( 6844 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI28      (MCPARAMID)( 6845 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI28      (MCPARAMID)( 6846 << 14)
+#define MC_ROIName_WRF_Line128                   (MCPARAMID)( 6847 << 14)
+#define MC_ROIName_WRF_Line128_GB                  1
+#define MC_ROIName_WRF_Line128_BG                  2
+#define MC_ROIName_WRF_Line128_RG                  3
+#define MC_ROIName_WRF_Line128_GR                  4
+#define MC_ROIName_WRF_XferSizeM1028             (MCPARAMID)( 6848 << 14)
+#define MC_ROIName_WRF_XferSizeM1128             (MCPARAMID)( 6849 << 14)
+#define MC_ROIName_WRF_XferSizeM1228             (MCPARAMID)( 6850 << 14)
+#define MC_ROIName_WRF_XferSizeM1328             (MCPARAMID)( 6851 << 14)
+#define MC_ROIName_WRF_TOIheight28               (MCPARAMID)( 6852 << 14)
+#define MC_ROIName_WRF_LastTOI28                 (MCPARAMID)( 6853 << 14)
+#define MC_ROIName_WRF_LastTOI28_TRUE              1
+#define MC_ROIName_WRF_LastTOI28_FALSE             2
+#define MC_ROIName_WRF_TOIoffset28               (MCPARAMID)( 6854 << 14)
+#define MC_ROIName_WRF_TOIPitch28                (MCPARAMID)( 6855 << 14)
+#define MC_ROIName_WRF_NbOfLine28                (MCPARAMID)( 6856 << 14)
+#define MC_ROIName_WRF_1stLineRep29              (MCPARAMID)( 6857 << 14)
+#define MC_ROIName_WRF_1stLineRep29_ON             1
+#define MC_ROIName_WRF_1stLineRep29_OFF            2
+#define MC_ROIName_WRF_LastLineRep29             (MCPARAMID)( 6858 << 14)
+#define MC_ROIName_WRF_LastLineRep29_ON            1
+#define MC_ROIName_WRF_LastLineRep29_OFF           2
+#define MC_ROIName_WRF_1stColRep29               (MCPARAMID)( 6859 << 14)
+#define MC_ROIName_WRF_1stColRep29_ON              1
+#define MC_ROIName_WRF_1stColRep29_OFF             2
+#define MC_ROIName_WRF_LastColRep29              (MCPARAMID)( 6860 << 14)
+#define MC_ROIName_WRF_LastColRep29_ON             1
+#define MC_ROIName_WRF_LastColRep29_OFF            2
+#define MC_ROIName_WRF_ColumnIx29                (MCPARAMID)( 6861 << 14)
+#define MC_ROIName_WRF_TOIwidth29                (MCPARAMID)( 6862 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI29      (MCPARAMID)( 6863 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI29      (MCPARAMID)( 6864 << 14)
+#define MC_ROIName_WRF_Line129                   (MCPARAMID)( 6865 << 14)
+#define MC_ROIName_WRF_Line129_GB                  1
+#define MC_ROIName_WRF_Line129_BG                  2
+#define MC_ROIName_WRF_Line129_RG                  3
+#define MC_ROIName_WRF_Line129_GR                  4
+#define MC_ROIName_WRF_XferSizeM1029             (MCPARAMID)( 6866 << 14)
+#define MC_ROIName_WRF_XferSizeM1129             (MCPARAMID)( 6867 << 14)
+#define MC_ROIName_WRF_XferSizeM1229             (MCPARAMID)( 6868 << 14)
+#define MC_ROIName_WRF_XferSizeM1329             (MCPARAMID)( 6869 << 14)
+#define MC_ROIName_WRF_TOIheight29               (MCPARAMID)( 6870 << 14)
+#define MC_ROIName_WRF_LastTOI29                 (MCPARAMID)( 6871 << 14)
+#define MC_ROIName_WRF_LastTOI29_TRUE              1
+#define MC_ROIName_WRF_LastTOI29_FALSE             2
+#define MC_ROIName_WRF_TOIoffset29               (MCPARAMID)( 6872 << 14)
+#define MC_ROIName_WRF_TOIPitch29                (MCPARAMID)( 6873 << 14)
+#define MC_ROIName_WRF_NbOfLine29                (MCPARAMID)( 6874 << 14)
+#define MC_ROIName_WRF_1stLineRep30              (MCPARAMID)( 6875 << 14)
+#define MC_ROIName_WRF_1stLineRep30_ON             1
+#define MC_ROIName_WRF_1stLineRep30_OFF            2
+#define MC_ROIName_WRF_LastLineRep30             (MCPARAMID)( 6876 << 14)
+#define MC_ROIName_WRF_LastLineRep30_ON            1
+#define MC_ROIName_WRF_LastLineRep30_OFF           2
+#define MC_ROIName_WRF_1stColRep30               (MCPARAMID)( 6877 << 14)
+#define MC_ROIName_WRF_1stColRep30_ON              1
+#define MC_ROIName_WRF_1stColRep30_OFF             2
+#define MC_ROIName_WRF_LastColRep30              (MCPARAMID)( 6878 << 14)
+#define MC_ROIName_WRF_LastColRep30_ON             1
+#define MC_ROIName_WRF_LastColRep30_OFF            2
+#define MC_ROIName_WRF_ColumnIx30                (MCPARAMID)( 6879 << 14)
+#define MC_ROIName_WRF_TOIwidth30                (MCPARAMID)( 6880 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI30      (MCPARAMID)( 6881 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI30      (MCPARAMID)( 6882 << 14)
+#define MC_ROIName_WRF_Line130                   (MCPARAMID)( 6883 << 14)
+#define MC_ROIName_WRF_Line130_GB                  1
+#define MC_ROIName_WRF_Line130_BG                  2
+#define MC_ROIName_WRF_Line130_RG                  3
+#define MC_ROIName_WRF_Line130_GR                  4
+#define MC_ROIName_WRF_XferSizeM1030             (MCPARAMID)( 6884 << 14)
+#define MC_ROIName_WRF_XferSizeM1130             (MCPARAMID)( 6885 << 14)
+#define MC_ROIName_WRF_XferSizeM1230             (MCPARAMID)( 6886 << 14)
+#define MC_ROIName_WRF_XferSizeM1330             (MCPARAMID)( 6887 << 14)
+#define MC_ROIName_WRF_TOIheight30               (MCPARAMID)( 6888 << 14)
+#define MC_ROIName_WRF_LastTOI30                 (MCPARAMID)( 6889 << 14)
+#define MC_ROIName_WRF_LastTOI30_TRUE              1
+#define MC_ROIName_WRF_LastTOI30_FALSE             2
+#define MC_ROIName_WRF_TOIoffset30               (MCPARAMID)( 6890 << 14)
+#define MC_ROIName_WRF_TOIPitch30                (MCPARAMID)( 6891 << 14)
+#define MC_ROIName_WRF_NbOfLine30                (MCPARAMID)( 6892 << 14)
+#define MC_ROIName_WRF_1stLineRep31              (MCPARAMID)( 6893 << 14)
+#define MC_ROIName_WRF_1stLineRep31_ON             1
+#define MC_ROIName_WRF_1stLineRep31_OFF            2
+#define MC_ROIName_WRF_LastLineRep31             (MCPARAMID)( 6894 << 14)
+#define MC_ROIName_WRF_LastLineRep31_ON            1
+#define MC_ROIName_WRF_LastLineRep31_OFF           2
+#define MC_ROIName_WRF_1stColRep31               (MCPARAMID)( 6895 << 14)
+#define MC_ROIName_WRF_1stColRep31_ON              1
+#define MC_ROIName_WRF_1stColRep31_OFF             2
+#define MC_ROIName_WRF_LastColRep31              (MCPARAMID)( 6896 << 14)
+#define MC_ROIName_WRF_LastColRep31_ON             1
+#define MC_ROIName_WRF_LastColRep31_OFF            2
+#define MC_ROIName_WRF_ColumnIx31                (MCPARAMID)( 6897 << 14)
+#define MC_ROIName_WRF_TOIwidth31                (MCPARAMID)( 6898 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI31      (MCPARAMID)( 6899 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI31      (MCPARAMID)( 6900 << 14)
+#define MC_ROIName_WRF_Line131                   (MCPARAMID)( 6901 << 14)
+#define MC_ROIName_WRF_Line131_GB                  1
+#define MC_ROIName_WRF_Line131_BG                  2
+#define MC_ROIName_WRF_Line131_RG                  3
+#define MC_ROIName_WRF_Line131_GR                  4
+#define MC_ROIName_WRF_XferSizeM1031             (MCPARAMID)( 6902 << 14)
+#define MC_ROIName_WRF_XferSizeM1131             (MCPARAMID)( 6903 << 14)
+#define MC_ROIName_WRF_XferSizeM1231             (MCPARAMID)( 6904 << 14)
+#define MC_ROIName_WRF_XferSizeM1331             (MCPARAMID)( 6905 << 14)
+#define MC_ROIName_WRF_TOIheight31               (MCPARAMID)( 6906 << 14)
+#define MC_ROIName_WRF_LastTOI31                 (MCPARAMID)( 6907 << 14)
+#define MC_ROIName_WRF_LastTOI31_TRUE              1
+#define MC_ROIName_WRF_LastTOI31_FALSE             2
+#define MC_ROIName_WRF_TOIoffset31               (MCPARAMID)( 6908 << 14)
+#define MC_ROIName_WRF_TOIPitch31                (MCPARAMID)( 6909 << 14)
+#define MC_ROIName_WRF_NbOfLine31                (MCPARAMID)( 6910 << 14)
+#define MC__CamConfig_AREA_RG_DX                  17
+#define MC__EXP2On_T1                            (MCPARAMID)( 6911 << 14)
+#define MC__EXP2Off_T1                           (MCPARAMID)( 6912 << 14)
+#define MC__RESET2On_T1                          (MCPARAMID)( 6913 << 14)
+#define MC__RESET2Off_T1                         (MCPARAMID)( 6914 << 14)
+#define MC__STROBE2On_T1                         (MCPARAMID)( 6915 << 14)
+#define MC__STROBE2Off_T1                        (MCPARAMID)( 6916 << 14)
+#define MC__EXPGap_T1                            (MCPARAMID)( 6917 << 14)
+#define MC__EXP2Width_T1                         (MCPARAMID)( 6918 << 14)
+#define MC__STROBE2Width_T1                      (MCPARAMID)( 6919 << 14)
+#define MC__EXP2On2STROBE2Off_T1                 (MCPARAMID)( 6920 << 14)
+#define MC_DoubleExposure_Filter                 (MCPARAMID)( 6921 << 14)
+#define MC_Expose2_us                            (MCPARAMID)( 6922 << 14)
+#define MC__EXP2Width_10ns                       (MCPARAMID)( 6923 << 14)
+#define MC_ExposeGapMin_us                       (MCPARAMID)( 6924 << 14)
+#define MC_ExposeGap_us                          (MCPARAMID)( 6925 << 14)
+#define MC__EXPGap_10ns                          (MCPARAMID)( 6926 << 14)
+#define MC_Strobe2Dur                            (MCPARAMID)( 6927 << 14)
+#define MC_Strobe2_Filter                        (MCPARAMID)( 6928 << 14)
+#define MC_Strobe2Pos                            (MCPARAMID)( 6929 << 14)
+#define MC_CompressionType_MJPG                    4
+#define MC_CompressionType_JPEG                    5
+#define MC_Strobe2Ctl                            (MCPARAMID)( 6930 << 14)
+#define MC_Strobe2Ctl_TTL                          1
+#define MC_Strobe2Ctl_ITTL                         2
+#define MC_Strobe2Ctl_IOC                          3
+#define MC_Strobe2Ctl_IOE                          4
+#define MC_Strobe2Ctl_OPTO                         5
+#define MC_Strobe2Line                           (MCPARAMID)( 6931 << 14)
+#define MC_Strobe2Line_NOM                         1
+#define MC_Strobe2Line_STR                         2
+#define MC_Strobe2Line_STX                         3
+#define MC_Strobe2Line_STY                         4
+#define MC_Strobe2Line_STZ                         5
+#define MC_Strobe2Line_ALT1                        6
+#define MC_Strobe2Line_ALT2                        7
+#define MC_Strobe2Line_IO1                         8
+#define MC_Strobe2Line_IO2                         9
+#define MC_Strobe2Line_IO3                        10
+#define MC_Strobe2Line_IO4                        11
+#define MC_Strobe2Line_ISOA1                      12
+#define MC_Strobe2Line_ISOA2                      13
+#define MC_Strobe2Line_STA                        14
+#define MC_Strobe2Line_Filter                    (MCPARAMID)( 6932 << 14)
+#define MC__Strobe2Line                          (MCPARAMID)( 6933 << 14)
+#define MC__Strobe2Line_NONE                       1
+#define MC__Strobe2Line_IO1                        2
+#define MC__Strobe2Line_IO2                        3
+#define MC__Strobe2Line_IO3                        4
+#define MC__Strobe2Line_IO4                        5
+#define MC__Strobe2Line_ISOA1                      6
+#define MC__Strobe2Line_ISOA2                      7
+#define MC__Strobe2Line_STA                        8
+#define MC_IO1Usage_STROBE2                        5
+#define MC_IO2Usage_STROBE2                        5
+#define MC_IO3Usage_STROBE2                        5
+#define MC_IO4Usage_STROBE2                        5
+#define MC_ISOA1Usage_STROBE2                      6
+#define MC_ISOA2Usage_STROBE2                      6
+#define MC___STAUsage_Check                      (MCPARAMID)( 6934 << 14)
+#define MC___STAUsage_Check_PASS                   1
+#define MC___STAUsage_Check_FAIL                   2
+#define MC_STAUsage_STROBE2                        5
+#define MC_Strobe2Level                          (MCPARAMID)( 6935 << 14)
+#define MC_Strobe2Level_PLSHIGH                    1
+#define MC_Strobe2Level_PLSLOW                     2
+#define MC__STROBE2_Def_On                       (MCPARAMID)( 6936 << 14)
+#define MC__STROBE2_Def_Off                      (MCPARAMID)( 6937 << 14)
+#define MC__RESET2_Def_On                        (MCPARAMID)( 6938 << 14)
+#define MC__RESET2_Def_Off                       (MCPARAMID)( 6939 << 14)
+#define MC_CamConfig_P50RG_DX                    283
+#define MC_Expose_WIDTH_DX                         9
+#define MC__RealTrigDelay_us                     (MCPARAMID)( 6940 << 14)
+#define MC_XF_ROI_LeftTOIColumnFlag              (MCPARAMID)( 6941 << 14)
+#define MC_AWB_ROI_LeftTOIColumnFlag             (MCPARAMID)( 6942 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd0                (MCPARAMID)( 6943 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd1                (MCPARAMID)( 6944 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd2                (MCPARAMID)( 6945 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd3                (MCPARAMID)( 6946 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd4                (MCPARAMID)( 6947 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd5                (MCPARAMID)( 6948 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd6                (MCPARAMID)( 6949 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd7                (MCPARAMID)( 6950 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd0               (MCPARAMID)( 6951 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd1               (MCPARAMID)( 6952 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd2               (MCPARAMID)( 6953 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd3               (MCPARAMID)( 6954 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd4               (MCPARAMID)( 6955 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd5               (MCPARAMID)( 6956 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd6               (MCPARAMID)( 6957 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd7               (MCPARAMID)( 6958 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd8                (MCPARAMID)( 6959 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd9                (MCPARAMID)( 6960 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd10               (MCPARAMID)( 6961 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd11               (MCPARAMID)( 6962 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd12               (MCPARAMID)( 6963 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd13               (MCPARAMID)( 6964 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd14               (MCPARAMID)( 6965 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd15               (MCPARAMID)( 6966 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd16               (MCPARAMID)( 6967 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd17               (MCPARAMID)( 6968 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd18               (MCPARAMID)( 6969 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd19               (MCPARAMID)( 6970 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd20               (MCPARAMID)( 6971 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd21               (MCPARAMID)( 6972 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd22               (MCPARAMID)( 6973 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd23               (MCPARAMID)( 6974 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd24               (MCPARAMID)( 6975 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd25               (MCPARAMID)( 6976 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd26               (MCPARAMID)( 6977 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd27               (MCPARAMID)( 6978 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd28               (MCPARAMID)( 6979 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd29               (MCPARAMID)( 6980 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd30               (MCPARAMID)( 6981 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd31               (MCPARAMID)( 6982 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd8               (MCPARAMID)( 6983 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd9               (MCPARAMID)( 6984 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd10              (MCPARAMID)( 6985 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd11              (MCPARAMID)( 6986 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd12              (MCPARAMID)( 6987 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd13              (MCPARAMID)( 6988 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd14              (MCPARAMID)( 6989 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd15              (MCPARAMID)( 6990 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd16              (MCPARAMID)( 6991 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd17              (MCPARAMID)( 6992 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd18              (MCPARAMID)( 6993 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd19              (MCPARAMID)( 6994 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd20              (MCPARAMID)( 6995 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd21              (MCPARAMID)( 6996 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd22              (MCPARAMID)( 6997 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd23              (MCPARAMID)( 6998 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd24              (MCPARAMID)( 6999 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd25              (MCPARAMID)( 7000 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd26              (MCPARAMID)( 7001 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd27              (MCPARAMID)( 7002 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd28              (MCPARAMID)( 7003 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd29              (MCPARAMID)( 7004 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd30              (MCPARAMID)( 7005 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd31              (MCPARAMID)( 7006 << 14)
+#define MC_XF_ROI_WRF_1stLineRep32               (MCPARAMID)( 7007 << 14)
+#define MC_XF_ROI_WRF_1stLineRep32_ON              1
+#define MC_XF_ROI_WRF_1stLineRep32_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep32              (MCPARAMID)( 7008 << 14)
+#define MC_XF_ROI_WRF_LastLineRep32_ON             1
+#define MC_XF_ROI_WRF_LastLineRep32_OFF            2
+#define MC_XF_ROI_WRF_1stColRep32                (MCPARAMID)( 7009 << 14)
+#define MC_XF_ROI_WRF_1stColRep32_ON               1
+#define MC_XF_ROI_WRF_1stColRep32_OFF              2
+#define MC_XF_ROI_WRF_LastColRep32               (MCPARAMID)( 7010 << 14)
+#define MC_XF_ROI_WRF_LastColRep32_ON              1
+#define MC_XF_ROI_WRF_LastColRep32_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx32                 (MCPARAMID)( 7011 << 14)
+#define MC_XF_ROI_WRF_TOIwidth32                 (MCPARAMID)( 7012 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI32       (MCPARAMID)( 7013 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI32       (MCPARAMID)( 7014 << 14)
+#define MC_XF_ROI_WRF_Line132                    (MCPARAMID)( 7015 << 14)
+#define MC_XF_ROI_WRF_Line132_GB                   1
+#define MC_XF_ROI_WRF_Line132_BG                   2
+#define MC_XF_ROI_WRF_Line132_RG                   3
+#define MC_XF_ROI_WRF_Line132_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1032              (MCPARAMID)( 7016 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1132              (MCPARAMID)( 7017 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1232              (MCPARAMID)( 7018 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1332              (MCPARAMID)( 7019 << 14)
+#define MC_XF_ROI_WRF_TOIheight32                (MCPARAMID)( 7020 << 14)
+#define MC_XF_ROI_WRF_LastTOI32                  (MCPARAMID)( 7021 << 14)
+#define MC_XF_ROI_WRF_LastTOI32_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI32_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset32                (MCPARAMID)( 7022 << 14)
+#define MC_XF_ROI_WRF_TOIPitch32                 (MCPARAMID)( 7023 << 14)
+#define MC_XF_ROI_WRF_NbOfLine32                 (MCPARAMID)( 7024 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd32               (MCPARAMID)( 7025 << 14)
+#define MC_XF_ROI_WRF_1stLineRep33               (MCPARAMID)( 7026 << 14)
+#define MC_XF_ROI_WRF_1stLineRep33_ON              1
+#define MC_XF_ROI_WRF_1stLineRep33_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep33              (MCPARAMID)( 7027 << 14)
+#define MC_XF_ROI_WRF_LastLineRep33_ON             1
+#define MC_XF_ROI_WRF_LastLineRep33_OFF            2
+#define MC_XF_ROI_WRF_1stColRep33                (MCPARAMID)( 7028 << 14)
+#define MC_XF_ROI_WRF_1stColRep33_ON               1
+#define MC_XF_ROI_WRF_1stColRep33_OFF              2
+#define MC_XF_ROI_WRF_LastColRep33               (MCPARAMID)( 7029 << 14)
+#define MC_XF_ROI_WRF_LastColRep33_ON              1
+#define MC_XF_ROI_WRF_LastColRep33_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx33                 (MCPARAMID)( 7030 << 14)
+#define MC_XF_ROI_WRF_TOIwidth33                 (MCPARAMID)( 7031 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI33       (MCPARAMID)( 7032 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI33       (MCPARAMID)( 7033 << 14)
+#define MC_XF_ROI_WRF_Line133                    (MCPARAMID)( 7034 << 14)
+#define MC_XF_ROI_WRF_Line133_GB                   1
+#define MC_XF_ROI_WRF_Line133_BG                   2
+#define MC_XF_ROI_WRF_Line133_RG                   3
+#define MC_XF_ROI_WRF_Line133_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1033              (MCPARAMID)( 7035 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1133              (MCPARAMID)( 7036 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1233              (MCPARAMID)( 7037 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1333              (MCPARAMID)( 7038 << 14)
+#define MC_XF_ROI_WRF_TOIheight33                (MCPARAMID)( 7039 << 14)
+#define MC_XF_ROI_WRF_LastTOI33                  (MCPARAMID)( 7040 << 14)
+#define MC_XF_ROI_WRF_LastTOI33_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI33_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset33                (MCPARAMID)( 7041 << 14)
+#define MC_XF_ROI_WRF_TOIPitch33                 (MCPARAMID)( 7042 << 14)
+#define MC_XF_ROI_WRF_NbOfLine33                 (MCPARAMID)( 7043 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd33               (MCPARAMID)( 7044 << 14)
+#define MC_XF_ROI_WRF_1stLineRep34               (MCPARAMID)( 7045 << 14)
+#define MC_XF_ROI_WRF_1stLineRep34_ON              1
+#define MC_XF_ROI_WRF_1stLineRep34_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep34              (MCPARAMID)( 7046 << 14)
+#define MC_XF_ROI_WRF_LastLineRep34_ON             1
+#define MC_XF_ROI_WRF_LastLineRep34_OFF            2
+#define MC_XF_ROI_WRF_1stColRep34                (MCPARAMID)( 7047 << 14)
+#define MC_XF_ROI_WRF_1stColRep34_ON               1
+#define MC_XF_ROI_WRF_1stColRep34_OFF              2
+#define MC_XF_ROI_WRF_LastColRep34               (MCPARAMID)( 7048 << 14)
+#define MC_XF_ROI_WRF_LastColRep34_ON              1
+#define MC_XF_ROI_WRF_LastColRep34_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx34                 (MCPARAMID)( 7049 << 14)
+#define MC_XF_ROI_WRF_TOIwidth34                 (MCPARAMID)( 7050 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI34       (MCPARAMID)( 7051 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI34       (MCPARAMID)( 7052 << 14)
+#define MC_XF_ROI_WRF_Line134                    (MCPARAMID)( 7053 << 14)
+#define MC_XF_ROI_WRF_Line134_GB                   1
+#define MC_XF_ROI_WRF_Line134_BG                   2
+#define MC_XF_ROI_WRF_Line134_RG                   3
+#define MC_XF_ROI_WRF_Line134_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1034              (MCPARAMID)( 7054 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1134              (MCPARAMID)( 7055 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1234              (MCPARAMID)( 7056 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1334              (MCPARAMID)( 7057 << 14)
+#define MC_XF_ROI_WRF_TOIheight34                (MCPARAMID)( 7058 << 14)
+#define MC_XF_ROI_WRF_LastTOI34                  (MCPARAMID)( 7059 << 14)
+#define MC_XF_ROI_WRF_LastTOI34_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI34_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset34                (MCPARAMID)( 7060 << 14)
+#define MC_XF_ROI_WRF_TOIPitch34                 (MCPARAMID)( 7061 << 14)
+#define MC_XF_ROI_WRF_NbOfLine34                 (MCPARAMID)( 7062 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd34               (MCPARAMID)( 7063 << 14)
+#define MC_XF_ROI_WRF_1stLineRep35               (MCPARAMID)( 7064 << 14)
+#define MC_XF_ROI_WRF_1stLineRep35_ON              1
+#define MC_XF_ROI_WRF_1stLineRep35_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep35              (MCPARAMID)( 7065 << 14)
+#define MC_XF_ROI_WRF_LastLineRep35_ON             1
+#define MC_XF_ROI_WRF_LastLineRep35_OFF            2
+#define MC_XF_ROI_WRF_1stColRep35                (MCPARAMID)( 7066 << 14)
+#define MC_XF_ROI_WRF_1stColRep35_ON               1
+#define MC_XF_ROI_WRF_1stColRep35_OFF              2
+#define MC_XF_ROI_WRF_LastColRep35               (MCPARAMID)( 7067 << 14)
+#define MC_XF_ROI_WRF_LastColRep35_ON              1
+#define MC_XF_ROI_WRF_LastColRep35_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx35                 (MCPARAMID)( 7068 << 14)
+#define MC_XF_ROI_WRF_TOIwidth35                 (MCPARAMID)( 7069 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI35       (MCPARAMID)( 7070 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI35       (MCPARAMID)( 7071 << 14)
+#define MC_XF_ROI_WRF_Line135                    (MCPARAMID)( 7072 << 14)
+#define MC_XF_ROI_WRF_Line135_GB                   1
+#define MC_XF_ROI_WRF_Line135_BG                   2
+#define MC_XF_ROI_WRF_Line135_RG                   3
+#define MC_XF_ROI_WRF_Line135_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1035              (MCPARAMID)( 7073 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1135              (MCPARAMID)( 7074 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1235              (MCPARAMID)( 7075 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1335              (MCPARAMID)( 7076 << 14)
+#define MC_XF_ROI_WRF_TOIheight35                (MCPARAMID)( 7077 << 14)
+#define MC_XF_ROI_WRF_LastTOI35                  (MCPARAMID)( 7078 << 14)
+#define MC_XF_ROI_WRF_LastTOI35_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI35_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset35                (MCPARAMID)( 7079 << 14)
+#define MC_XF_ROI_WRF_TOIPitch35                 (MCPARAMID)( 7080 << 14)
+#define MC_XF_ROI_WRF_NbOfLine35                 (MCPARAMID)( 7081 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd35               (MCPARAMID)( 7082 << 14)
+#define MC_XF_ROI_WRF_1stLineRep36               (MCPARAMID)( 7083 << 14)
+#define MC_XF_ROI_WRF_1stLineRep36_ON              1
+#define MC_XF_ROI_WRF_1stLineRep36_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep36              (MCPARAMID)( 7084 << 14)
+#define MC_XF_ROI_WRF_LastLineRep36_ON             1
+#define MC_XF_ROI_WRF_LastLineRep36_OFF            2
+#define MC_XF_ROI_WRF_1stColRep36                (MCPARAMID)( 7085 << 14)
+#define MC_XF_ROI_WRF_1stColRep36_ON               1
+#define MC_XF_ROI_WRF_1stColRep36_OFF              2
+#define MC_XF_ROI_WRF_LastColRep36               (MCPARAMID)( 7086 << 14)
+#define MC_XF_ROI_WRF_LastColRep36_ON              1
+#define MC_XF_ROI_WRF_LastColRep36_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx36                 (MCPARAMID)( 7087 << 14)
+#define MC_XF_ROI_WRF_TOIwidth36                 (MCPARAMID)( 7088 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI36       (MCPARAMID)( 7089 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI36       (MCPARAMID)( 7090 << 14)
+#define MC_XF_ROI_WRF_Line136                    (MCPARAMID)( 7091 << 14)
+#define MC_XF_ROI_WRF_Line136_GB                   1
+#define MC_XF_ROI_WRF_Line136_BG                   2
+#define MC_XF_ROI_WRF_Line136_RG                   3
+#define MC_XF_ROI_WRF_Line136_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1036              (MCPARAMID)( 7092 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1136              (MCPARAMID)( 7093 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1236              (MCPARAMID)( 7094 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1336              (MCPARAMID)( 7095 << 14)
+#define MC_XF_ROI_WRF_TOIheight36                (MCPARAMID)( 7096 << 14)
+#define MC_XF_ROI_WRF_LastTOI36                  (MCPARAMID)( 7097 << 14)
+#define MC_XF_ROI_WRF_LastTOI36_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI36_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset36                (MCPARAMID)( 7098 << 14)
+#define MC_XF_ROI_WRF_TOIPitch36                 (MCPARAMID)( 7099 << 14)
+#define MC_XF_ROI_WRF_NbOfLine36                 (MCPARAMID)( 7100 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd36               (MCPARAMID)( 7101 << 14)
+#define MC_XF_ROI_WRF_1stLineRep37               (MCPARAMID)( 7102 << 14)
+#define MC_XF_ROI_WRF_1stLineRep37_ON              1
+#define MC_XF_ROI_WRF_1stLineRep37_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep37              (MCPARAMID)( 7103 << 14)
+#define MC_XF_ROI_WRF_LastLineRep37_ON             1
+#define MC_XF_ROI_WRF_LastLineRep37_OFF            2
+#define MC_XF_ROI_WRF_1stColRep37                (MCPARAMID)( 7104 << 14)
+#define MC_XF_ROI_WRF_1stColRep37_ON               1
+#define MC_XF_ROI_WRF_1stColRep37_OFF              2
+#define MC_XF_ROI_WRF_LastColRep37               (MCPARAMID)( 7105 << 14)
+#define MC_XF_ROI_WRF_LastColRep37_ON              1
+#define MC_XF_ROI_WRF_LastColRep37_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx37                 (MCPARAMID)( 7106 << 14)
+#define MC_XF_ROI_WRF_TOIwidth37                 (MCPARAMID)( 7107 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI37       (MCPARAMID)( 7108 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI37       (MCPARAMID)( 7109 << 14)
+#define MC_XF_ROI_WRF_Line137                    (MCPARAMID)( 7110 << 14)
+#define MC_XF_ROI_WRF_Line137_GB                   1
+#define MC_XF_ROI_WRF_Line137_BG                   2
+#define MC_XF_ROI_WRF_Line137_RG                   3
+#define MC_XF_ROI_WRF_Line137_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1037              (MCPARAMID)( 7111 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1137              (MCPARAMID)( 7112 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1237              (MCPARAMID)( 7113 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1337              (MCPARAMID)( 7114 << 14)
+#define MC_XF_ROI_WRF_TOIheight37                (MCPARAMID)( 7115 << 14)
+#define MC_XF_ROI_WRF_LastTOI37                  (MCPARAMID)( 7116 << 14)
+#define MC_XF_ROI_WRF_LastTOI37_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI37_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset37                (MCPARAMID)( 7117 << 14)
+#define MC_XF_ROI_WRF_TOIPitch37                 (MCPARAMID)( 7118 << 14)
+#define MC_XF_ROI_WRF_NbOfLine37                 (MCPARAMID)( 7119 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd37               (MCPARAMID)( 7120 << 14)
+#define MC_XF_ROI_WRF_1stLineRep38               (MCPARAMID)( 7121 << 14)
+#define MC_XF_ROI_WRF_1stLineRep38_ON              1
+#define MC_XF_ROI_WRF_1stLineRep38_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep38              (MCPARAMID)( 7122 << 14)
+#define MC_XF_ROI_WRF_LastLineRep38_ON             1
+#define MC_XF_ROI_WRF_LastLineRep38_OFF            2
+#define MC_XF_ROI_WRF_1stColRep38                (MCPARAMID)( 7123 << 14)
+#define MC_XF_ROI_WRF_1stColRep38_ON               1
+#define MC_XF_ROI_WRF_1stColRep38_OFF              2
+#define MC_XF_ROI_WRF_LastColRep38               (MCPARAMID)( 7124 << 14)
+#define MC_XF_ROI_WRF_LastColRep38_ON              1
+#define MC_XF_ROI_WRF_LastColRep38_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx38                 (MCPARAMID)( 7125 << 14)
+#define MC_XF_ROI_WRF_TOIwidth38                 (MCPARAMID)( 7126 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI38       (MCPARAMID)( 7127 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI38       (MCPARAMID)( 7128 << 14)
+#define MC_XF_ROI_WRF_Line138                    (MCPARAMID)( 7129 << 14)
+#define MC_XF_ROI_WRF_Line138_GB                   1
+#define MC_XF_ROI_WRF_Line138_BG                   2
+#define MC_XF_ROI_WRF_Line138_RG                   3
+#define MC_XF_ROI_WRF_Line138_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1038              (MCPARAMID)( 7130 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1138              (MCPARAMID)( 7131 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1238              (MCPARAMID)( 7132 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1338              (MCPARAMID)( 7133 << 14)
+#define MC_XF_ROI_WRF_TOIheight38                (MCPARAMID)( 7134 << 14)
+#define MC_XF_ROI_WRF_LastTOI38                  (MCPARAMID)( 7135 << 14)
+#define MC_XF_ROI_WRF_LastTOI38_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI38_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset38                (MCPARAMID)( 7136 << 14)
+#define MC_XF_ROI_WRF_TOIPitch38                 (MCPARAMID)( 7137 << 14)
+#define MC_XF_ROI_WRF_NbOfLine38                 (MCPARAMID)( 7138 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd38               (MCPARAMID)( 7139 << 14)
+#define MC_XF_ROI_WRF_1stLineRep39               (MCPARAMID)( 7140 << 14)
+#define MC_XF_ROI_WRF_1stLineRep39_ON              1
+#define MC_XF_ROI_WRF_1stLineRep39_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep39              (MCPARAMID)( 7141 << 14)
+#define MC_XF_ROI_WRF_LastLineRep39_ON             1
+#define MC_XF_ROI_WRF_LastLineRep39_OFF            2
+#define MC_XF_ROI_WRF_1stColRep39                (MCPARAMID)( 7142 << 14)
+#define MC_XF_ROI_WRF_1stColRep39_ON               1
+#define MC_XF_ROI_WRF_1stColRep39_OFF              2
+#define MC_XF_ROI_WRF_LastColRep39               (MCPARAMID)( 7143 << 14)
+#define MC_XF_ROI_WRF_LastColRep39_ON              1
+#define MC_XF_ROI_WRF_LastColRep39_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx39                 (MCPARAMID)( 7144 << 14)
+#define MC_XF_ROI_WRF_TOIwidth39                 (MCPARAMID)( 7145 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI39       (MCPARAMID)( 7146 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI39       (MCPARAMID)( 7147 << 14)
+#define MC_XF_ROI_WRF_Line139                    (MCPARAMID)( 7148 << 14)
+#define MC_XF_ROI_WRF_Line139_GB                   1
+#define MC_XF_ROI_WRF_Line139_BG                   2
+#define MC_XF_ROI_WRF_Line139_RG                   3
+#define MC_XF_ROI_WRF_Line139_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1039              (MCPARAMID)( 7149 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1139              (MCPARAMID)( 7150 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1239              (MCPARAMID)( 7151 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1339              (MCPARAMID)( 7152 << 14)
+#define MC_XF_ROI_WRF_TOIheight39                (MCPARAMID)( 7153 << 14)
+#define MC_XF_ROI_WRF_LastTOI39                  (MCPARAMID)( 7154 << 14)
+#define MC_XF_ROI_WRF_LastTOI39_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI39_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset39                (MCPARAMID)( 7155 << 14)
+#define MC_XF_ROI_WRF_TOIPitch39                 (MCPARAMID)( 7156 << 14)
+#define MC_XF_ROI_WRF_NbOfLine39                 (MCPARAMID)( 7157 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd39               (MCPARAMID)( 7158 << 14)
+#define MC_XF_ROI_WRF_1stLineRep40               (MCPARAMID)( 7159 << 14)
+#define MC_XF_ROI_WRF_1stLineRep40_ON              1
+#define MC_XF_ROI_WRF_1stLineRep40_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep40              (MCPARAMID)( 7160 << 14)
+#define MC_XF_ROI_WRF_LastLineRep40_ON             1
+#define MC_XF_ROI_WRF_LastLineRep40_OFF            2
+#define MC_XF_ROI_WRF_1stColRep40                (MCPARAMID)( 7161 << 14)
+#define MC_XF_ROI_WRF_1stColRep40_ON               1
+#define MC_XF_ROI_WRF_1stColRep40_OFF              2
+#define MC_XF_ROI_WRF_LastColRep40               (MCPARAMID)( 7162 << 14)
+#define MC_XF_ROI_WRF_LastColRep40_ON              1
+#define MC_XF_ROI_WRF_LastColRep40_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx40                 (MCPARAMID)( 7163 << 14)
+#define MC_XF_ROI_WRF_TOIwidth40                 (MCPARAMID)( 7164 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI40       (MCPARAMID)( 7165 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI40       (MCPARAMID)( 7166 << 14)
+#define MC_XF_ROI_WRF_Line140                    (MCPARAMID)( 7167 << 14)
+#define MC_XF_ROI_WRF_Line140_GB                   1
+#define MC_XF_ROI_WRF_Line140_BG                   2
+#define MC_XF_ROI_WRF_Line140_RG                   3
+#define MC_XF_ROI_WRF_Line140_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1040              (MCPARAMID)( 7168 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1140              (MCPARAMID)( 7169 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1240              (MCPARAMID)( 7170 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1340              (MCPARAMID)( 7171 << 14)
+#define MC_XF_ROI_WRF_TOIheight40                (MCPARAMID)( 7172 << 14)
+#define MC_XF_ROI_WRF_LastTOI40                  (MCPARAMID)( 7173 << 14)
+#define MC_XF_ROI_WRF_LastTOI40_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI40_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset40                (MCPARAMID)( 7174 << 14)
+#define MC_XF_ROI_WRF_TOIPitch40                 (MCPARAMID)( 7175 << 14)
+#define MC_XF_ROI_WRF_NbOfLine40                 (MCPARAMID)( 7176 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd40               (MCPARAMID)( 7177 << 14)
+#define MC_XF_ROI_WRF_1stLineRep41               (MCPARAMID)( 7178 << 14)
+#define MC_XF_ROI_WRF_1stLineRep41_ON              1
+#define MC_XF_ROI_WRF_1stLineRep41_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep41              (MCPARAMID)( 7179 << 14)
+#define MC_XF_ROI_WRF_LastLineRep41_ON             1
+#define MC_XF_ROI_WRF_LastLineRep41_OFF            2
+#define MC_XF_ROI_WRF_1stColRep41                (MCPARAMID)( 7180 << 14)
+#define MC_XF_ROI_WRF_1stColRep41_ON               1
+#define MC_XF_ROI_WRF_1stColRep41_OFF              2
+#define MC_XF_ROI_WRF_LastColRep41               (MCPARAMID)( 7181 << 14)
+#define MC_XF_ROI_WRF_LastColRep41_ON              1
+#define MC_XF_ROI_WRF_LastColRep41_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx41                 (MCPARAMID)( 7182 << 14)
+#define MC_XF_ROI_WRF_TOIwidth41                 (MCPARAMID)( 7183 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI41       (MCPARAMID)( 7184 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI41       (MCPARAMID)( 7185 << 14)
+#define MC_XF_ROI_WRF_Line141                    (MCPARAMID)( 7186 << 14)
+#define MC_XF_ROI_WRF_Line141_GB                   1
+#define MC_XF_ROI_WRF_Line141_BG                   2
+#define MC_XF_ROI_WRF_Line141_RG                   3
+#define MC_XF_ROI_WRF_Line141_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1041              (MCPARAMID)( 7187 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1141              (MCPARAMID)( 7188 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1241              (MCPARAMID)( 7189 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1341              (MCPARAMID)( 7190 << 14)
+#define MC_XF_ROI_WRF_TOIheight41                (MCPARAMID)( 7191 << 14)
+#define MC_XF_ROI_WRF_LastTOI41                  (MCPARAMID)( 7192 << 14)
+#define MC_XF_ROI_WRF_LastTOI41_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI41_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset41                (MCPARAMID)( 7193 << 14)
+#define MC_XF_ROI_WRF_TOIPitch41                 (MCPARAMID)( 7194 << 14)
+#define MC_XF_ROI_WRF_NbOfLine41                 (MCPARAMID)( 7195 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd41               (MCPARAMID)( 7196 << 14)
+#define MC_XF_ROI_WRF_1stLineRep42               (MCPARAMID)( 7197 << 14)
+#define MC_XF_ROI_WRF_1stLineRep42_ON              1
+#define MC_XF_ROI_WRF_1stLineRep42_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep42              (MCPARAMID)( 7198 << 14)
+#define MC_XF_ROI_WRF_LastLineRep42_ON             1
+#define MC_XF_ROI_WRF_LastLineRep42_OFF            2
+#define MC_XF_ROI_WRF_1stColRep42                (MCPARAMID)( 7199 << 14)
+#define MC_XF_ROI_WRF_1stColRep42_ON               1
+#define MC_XF_ROI_WRF_1stColRep42_OFF              2
+#define MC_XF_ROI_WRF_LastColRep42               (MCPARAMID)( 7200 << 14)
+#define MC_XF_ROI_WRF_LastColRep42_ON              1
+#define MC_XF_ROI_WRF_LastColRep42_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx42                 (MCPARAMID)( 7201 << 14)
+#define MC_XF_ROI_WRF_TOIwidth42                 (MCPARAMID)( 7202 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI42       (MCPARAMID)( 7203 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI42       (MCPARAMID)( 7204 << 14)
+#define MC_XF_ROI_WRF_Line142                    (MCPARAMID)( 7205 << 14)
+#define MC_XF_ROI_WRF_Line142_GB                   1
+#define MC_XF_ROI_WRF_Line142_BG                   2
+#define MC_XF_ROI_WRF_Line142_RG                   3
+#define MC_XF_ROI_WRF_Line142_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1042              (MCPARAMID)( 7206 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1142              (MCPARAMID)( 7207 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1242              (MCPARAMID)( 7208 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1342              (MCPARAMID)( 7209 << 14)
+#define MC_XF_ROI_WRF_TOIheight42                (MCPARAMID)( 7210 << 14)
+#define MC_XF_ROI_WRF_LastTOI42                  (MCPARAMID)( 7211 << 14)
+#define MC_XF_ROI_WRF_LastTOI42_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI42_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset42                (MCPARAMID)( 7212 << 14)
+#define MC_XF_ROI_WRF_TOIPitch42                 (MCPARAMID)( 7213 << 14)
+#define MC_XF_ROI_WRF_NbOfLine42                 (MCPARAMID)( 7214 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd42               (MCPARAMID)( 7215 << 14)
+#define MC_XF_ROI_WRF_1stLineRep43               (MCPARAMID)( 7216 << 14)
+#define MC_XF_ROI_WRF_1stLineRep43_ON              1
+#define MC_XF_ROI_WRF_1stLineRep43_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep43              (MCPARAMID)( 7217 << 14)
+#define MC_XF_ROI_WRF_LastLineRep43_ON             1
+#define MC_XF_ROI_WRF_LastLineRep43_OFF            2
+#define MC_XF_ROI_WRF_1stColRep43                (MCPARAMID)( 7218 << 14)
+#define MC_XF_ROI_WRF_1stColRep43_ON               1
+#define MC_XF_ROI_WRF_1stColRep43_OFF              2
+#define MC_XF_ROI_WRF_LastColRep43               (MCPARAMID)( 7219 << 14)
+#define MC_XF_ROI_WRF_LastColRep43_ON              1
+#define MC_XF_ROI_WRF_LastColRep43_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx43                 (MCPARAMID)( 7220 << 14)
+#define MC_XF_ROI_WRF_TOIwidth43                 (MCPARAMID)( 7221 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI43       (MCPARAMID)( 7222 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI43       (MCPARAMID)( 7223 << 14)
+#define MC_XF_ROI_WRF_Line143                    (MCPARAMID)( 7224 << 14)
+#define MC_XF_ROI_WRF_Line143_GB                   1
+#define MC_XF_ROI_WRF_Line143_BG                   2
+#define MC_XF_ROI_WRF_Line143_RG                   3
+#define MC_XF_ROI_WRF_Line143_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1043              (MCPARAMID)( 7225 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1143              (MCPARAMID)( 7226 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1243              (MCPARAMID)( 7227 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1343              (MCPARAMID)( 7228 << 14)
+#define MC_XF_ROI_WRF_TOIheight43                (MCPARAMID)( 7229 << 14)
+#define MC_XF_ROI_WRF_LastTOI43                  (MCPARAMID)( 7230 << 14)
+#define MC_XF_ROI_WRF_LastTOI43_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI43_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset43                (MCPARAMID)( 7231 << 14)
+#define MC_XF_ROI_WRF_TOIPitch43                 (MCPARAMID)( 7232 << 14)
+#define MC_XF_ROI_WRF_NbOfLine43                 (MCPARAMID)( 7233 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd43               (MCPARAMID)( 7234 << 14)
+#define MC_XF_ROI_WRF_1stLineRep44               (MCPARAMID)( 7235 << 14)
+#define MC_XF_ROI_WRF_1stLineRep44_ON              1
+#define MC_XF_ROI_WRF_1stLineRep44_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep44              (MCPARAMID)( 7236 << 14)
+#define MC_XF_ROI_WRF_LastLineRep44_ON             1
+#define MC_XF_ROI_WRF_LastLineRep44_OFF            2
+#define MC_XF_ROI_WRF_1stColRep44                (MCPARAMID)( 7237 << 14)
+#define MC_XF_ROI_WRF_1stColRep44_ON               1
+#define MC_XF_ROI_WRF_1stColRep44_OFF              2
+#define MC_XF_ROI_WRF_LastColRep44               (MCPARAMID)( 7238 << 14)
+#define MC_XF_ROI_WRF_LastColRep44_ON              1
+#define MC_XF_ROI_WRF_LastColRep44_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx44                 (MCPARAMID)( 7239 << 14)
+#define MC_XF_ROI_WRF_TOIwidth44                 (MCPARAMID)( 7240 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI44       (MCPARAMID)( 7241 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI44       (MCPARAMID)( 7242 << 14)
+#define MC_XF_ROI_WRF_Line144                    (MCPARAMID)( 7243 << 14)
+#define MC_XF_ROI_WRF_Line144_GB                   1
+#define MC_XF_ROI_WRF_Line144_BG                   2
+#define MC_XF_ROI_WRF_Line144_RG                   3
+#define MC_XF_ROI_WRF_Line144_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1044              (MCPARAMID)( 7244 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1144              (MCPARAMID)( 7245 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1244              (MCPARAMID)( 7246 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1344              (MCPARAMID)( 7247 << 14)
+#define MC_XF_ROI_WRF_TOIheight44                (MCPARAMID)( 7248 << 14)
+#define MC_XF_ROI_WRF_LastTOI44                  (MCPARAMID)( 7249 << 14)
+#define MC_XF_ROI_WRF_LastTOI44_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI44_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset44                (MCPARAMID)( 7250 << 14)
+#define MC_XF_ROI_WRF_TOIPitch44                 (MCPARAMID)( 7251 << 14)
+#define MC_XF_ROI_WRF_NbOfLine44                 (MCPARAMID)( 7252 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd44               (MCPARAMID)( 7253 << 14)
+#define MC_XF_ROI_WRF_1stLineRep45               (MCPARAMID)( 7254 << 14)
+#define MC_XF_ROI_WRF_1stLineRep45_ON              1
+#define MC_XF_ROI_WRF_1stLineRep45_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep45              (MCPARAMID)( 7255 << 14)
+#define MC_XF_ROI_WRF_LastLineRep45_ON             1
+#define MC_XF_ROI_WRF_LastLineRep45_OFF            2
+#define MC_XF_ROI_WRF_1stColRep45                (MCPARAMID)( 7256 << 14)
+#define MC_XF_ROI_WRF_1stColRep45_ON               1
+#define MC_XF_ROI_WRF_1stColRep45_OFF              2
+#define MC_XF_ROI_WRF_LastColRep45               (MCPARAMID)( 7257 << 14)
+#define MC_XF_ROI_WRF_LastColRep45_ON              1
+#define MC_XF_ROI_WRF_LastColRep45_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx45                 (MCPARAMID)( 7258 << 14)
+#define MC_XF_ROI_WRF_TOIwidth45                 (MCPARAMID)( 7259 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI45       (MCPARAMID)( 7260 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI45       (MCPARAMID)( 7261 << 14)
+#define MC_XF_ROI_WRF_Line145                    (MCPARAMID)( 7262 << 14)
+#define MC_XF_ROI_WRF_Line145_GB                   1
+#define MC_XF_ROI_WRF_Line145_BG                   2
+#define MC_XF_ROI_WRF_Line145_RG                   3
+#define MC_XF_ROI_WRF_Line145_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1045              (MCPARAMID)( 7263 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1145              (MCPARAMID)( 7264 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1245              (MCPARAMID)( 7265 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1345              (MCPARAMID)( 7266 << 14)
+#define MC_XF_ROI_WRF_TOIheight45                (MCPARAMID)( 7267 << 14)
+#define MC_XF_ROI_WRF_LastTOI45                  (MCPARAMID)( 7268 << 14)
+#define MC_XF_ROI_WRF_LastTOI45_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI45_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset45                (MCPARAMID)( 7269 << 14)
+#define MC_XF_ROI_WRF_TOIPitch45                 (MCPARAMID)( 7270 << 14)
+#define MC_XF_ROI_WRF_NbOfLine45                 (MCPARAMID)( 7271 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd45               (MCPARAMID)( 7272 << 14)
+#define MC_XF_ROI_WRF_1stLineRep46               (MCPARAMID)( 7273 << 14)
+#define MC_XF_ROI_WRF_1stLineRep46_ON              1
+#define MC_XF_ROI_WRF_1stLineRep46_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep46              (MCPARAMID)( 7274 << 14)
+#define MC_XF_ROI_WRF_LastLineRep46_ON             1
+#define MC_XF_ROI_WRF_LastLineRep46_OFF            2
+#define MC_XF_ROI_WRF_1stColRep46                (MCPARAMID)( 7275 << 14)
+#define MC_XF_ROI_WRF_1stColRep46_ON               1
+#define MC_XF_ROI_WRF_1stColRep46_OFF              2
+#define MC_XF_ROI_WRF_LastColRep46               (MCPARAMID)( 7276 << 14)
+#define MC_XF_ROI_WRF_LastColRep46_ON              1
+#define MC_XF_ROI_WRF_LastColRep46_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx46                 (MCPARAMID)( 7277 << 14)
+#define MC_XF_ROI_WRF_TOIwidth46                 (MCPARAMID)( 7278 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI46       (MCPARAMID)( 7279 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI46       (MCPARAMID)( 7280 << 14)
+#define MC_XF_ROI_WRF_Line146                    (MCPARAMID)( 7281 << 14)
+#define MC_XF_ROI_WRF_Line146_GB                   1
+#define MC_XF_ROI_WRF_Line146_BG                   2
+#define MC_XF_ROI_WRF_Line146_RG                   3
+#define MC_XF_ROI_WRF_Line146_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1046              (MCPARAMID)( 7282 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1146              (MCPARAMID)( 7283 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1246              (MCPARAMID)( 7284 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1346              (MCPARAMID)( 7285 << 14)
+#define MC_XF_ROI_WRF_TOIheight46                (MCPARAMID)( 7286 << 14)
+#define MC_XF_ROI_WRF_LastTOI46                  (MCPARAMID)( 7287 << 14)
+#define MC_XF_ROI_WRF_LastTOI46_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI46_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset46                (MCPARAMID)( 7288 << 14)
+#define MC_XF_ROI_WRF_TOIPitch46                 (MCPARAMID)( 7289 << 14)
+#define MC_XF_ROI_WRF_NbOfLine46                 (MCPARAMID)( 7290 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd46               (MCPARAMID)( 7291 << 14)
+#define MC_XF_ROI_WRF_1stLineRep47               (MCPARAMID)( 7292 << 14)
+#define MC_XF_ROI_WRF_1stLineRep47_ON              1
+#define MC_XF_ROI_WRF_1stLineRep47_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep47              (MCPARAMID)( 7293 << 14)
+#define MC_XF_ROI_WRF_LastLineRep47_ON             1
+#define MC_XF_ROI_WRF_LastLineRep47_OFF            2
+#define MC_XF_ROI_WRF_1stColRep47                (MCPARAMID)( 7294 << 14)
+#define MC_XF_ROI_WRF_1stColRep47_ON               1
+#define MC_XF_ROI_WRF_1stColRep47_OFF              2
+#define MC_XF_ROI_WRF_LastColRep47               (MCPARAMID)( 7295 << 14)
+#define MC_XF_ROI_WRF_LastColRep47_ON              1
+#define MC_XF_ROI_WRF_LastColRep47_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx47                 (MCPARAMID)( 7296 << 14)
+#define MC_XF_ROI_WRF_TOIwidth47                 (MCPARAMID)( 7297 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI47       (MCPARAMID)( 7298 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI47       (MCPARAMID)( 7299 << 14)
+#define MC_XF_ROI_WRF_Line147                    (MCPARAMID)( 7300 << 14)
+#define MC_XF_ROI_WRF_Line147_GB                   1
+#define MC_XF_ROI_WRF_Line147_BG                   2
+#define MC_XF_ROI_WRF_Line147_RG                   3
+#define MC_XF_ROI_WRF_Line147_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1047              (MCPARAMID)( 7301 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1147              (MCPARAMID)( 7302 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1247              (MCPARAMID)( 7303 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1347              (MCPARAMID)( 7304 << 14)
+#define MC_XF_ROI_WRF_TOIheight47                (MCPARAMID)( 7305 << 14)
+#define MC_XF_ROI_WRF_LastTOI47                  (MCPARAMID)( 7306 << 14)
+#define MC_XF_ROI_WRF_LastTOI47_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI47_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset47                (MCPARAMID)( 7307 << 14)
+#define MC_XF_ROI_WRF_TOIPitch47                 (MCPARAMID)( 7308 << 14)
+#define MC_XF_ROI_WRF_NbOfLine47                 (MCPARAMID)( 7309 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd47               (MCPARAMID)( 7310 << 14)
+#define MC_XF_ROI_WRF_1stLineRep48               (MCPARAMID)( 7311 << 14)
+#define MC_XF_ROI_WRF_1stLineRep48_ON              1
+#define MC_XF_ROI_WRF_1stLineRep48_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep48              (MCPARAMID)( 7312 << 14)
+#define MC_XF_ROI_WRF_LastLineRep48_ON             1
+#define MC_XF_ROI_WRF_LastLineRep48_OFF            2
+#define MC_XF_ROI_WRF_1stColRep48                (MCPARAMID)( 7313 << 14)
+#define MC_XF_ROI_WRF_1stColRep48_ON               1
+#define MC_XF_ROI_WRF_1stColRep48_OFF              2
+#define MC_XF_ROI_WRF_LastColRep48               (MCPARAMID)( 7314 << 14)
+#define MC_XF_ROI_WRF_LastColRep48_ON              1
+#define MC_XF_ROI_WRF_LastColRep48_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx48                 (MCPARAMID)( 7315 << 14)
+#define MC_XF_ROI_WRF_TOIwidth48                 (MCPARAMID)( 7316 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI48       (MCPARAMID)( 7317 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI48       (MCPARAMID)( 7318 << 14)
+#define MC_XF_ROI_WRF_Line148                    (MCPARAMID)( 7319 << 14)
+#define MC_XF_ROI_WRF_Line148_GB                   1
+#define MC_XF_ROI_WRF_Line148_BG                   2
+#define MC_XF_ROI_WRF_Line148_RG                   3
+#define MC_XF_ROI_WRF_Line148_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1048              (MCPARAMID)( 7320 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1148              (MCPARAMID)( 7321 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1248              (MCPARAMID)( 7322 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1348              (MCPARAMID)( 7323 << 14)
+#define MC_XF_ROI_WRF_TOIheight48                (MCPARAMID)( 7324 << 14)
+#define MC_XF_ROI_WRF_LastTOI48                  (MCPARAMID)( 7325 << 14)
+#define MC_XF_ROI_WRF_LastTOI48_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI48_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset48                (MCPARAMID)( 7326 << 14)
+#define MC_XF_ROI_WRF_TOIPitch48                 (MCPARAMID)( 7327 << 14)
+#define MC_XF_ROI_WRF_NbOfLine48                 (MCPARAMID)( 7328 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd48               (MCPARAMID)( 7329 << 14)
+#define MC_XF_ROI_WRF_1stLineRep49               (MCPARAMID)( 7330 << 14)
+#define MC_XF_ROI_WRF_1stLineRep49_ON              1
+#define MC_XF_ROI_WRF_1stLineRep49_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep49              (MCPARAMID)( 7331 << 14)
+#define MC_XF_ROI_WRF_LastLineRep49_ON             1
+#define MC_XF_ROI_WRF_LastLineRep49_OFF            2
+#define MC_XF_ROI_WRF_1stColRep49                (MCPARAMID)( 7332 << 14)
+#define MC_XF_ROI_WRF_1stColRep49_ON               1
+#define MC_XF_ROI_WRF_1stColRep49_OFF              2
+#define MC_XF_ROI_WRF_LastColRep49               (MCPARAMID)( 7333 << 14)
+#define MC_XF_ROI_WRF_LastColRep49_ON              1
+#define MC_XF_ROI_WRF_LastColRep49_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx49                 (MCPARAMID)( 7334 << 14)
+#define MC_XF_ROI_WRF_TOIwidth49                 (MCPARAMID)( 7335 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI49       (MCPARAMID)( 7336 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI49       (MCPARAMID)( 7337 << 14)
+#define MC_XF_ROI_WRF_Line149                    (MCPARAMID)( 7338 << 14)
+#define MC_XF_ROI_WRF_Line149_GB                   1
+#define MC_XF_ROI_WRF_Line149_BG                   2
+#define MC_XF_ROI_WRF_Line149_RG                   3
+#define MC_XF_ROI_WRF_Line149_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1049              (MCPARAMID)( 7339 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1149              (MCPARAMID)( 7340 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1249              (MCPARAMID)( 7341 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1349              (MCPARAMID)( 7342 << 14)
+#define MC_XF_ROI_WRF_TOIheight49                (MCPARAMID)( 7343 << 14)
+#define MC_XF_ROI_WRF_LastTOI49                  (MCPARAMID)( 7344 << 14)
+#define MC_XF_ROI_WRF_LastTOI49_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI49_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset49                (MCPARAMID)( 7345 << 14)
+#define MC_XF_ROI_WRF_TOIPitch49                 (MCPARAMID)( 7346 << 14)
+#define MC_XF_ROI_WRF_NbOfLine49                 (MCPARAMID)( 7347 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd49               (MCPARAMID)( 7348 << 14)
+#define MC_XF_ROI_WRF_1stLineRep50               (MCPARAMID)( 7349 << 14)
+#define MC_XF_ROI_WRF_1stLineRep50_ON              1
+#define MC_XF_ROI_WRF_1stLineRep50_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep50              (MCPARAMID)( 7350 << 14)
+#define MC_XF_ROI_WRF_LastLineRep50_ON             1
+#define MC_XF_ROI_WRF_LastLineRep50_OFF            2
+#define MC_XF_ROI_WRF_1stColRep50                (MCPARAMID)( 7351 << 14)
+#define MC_XF_ROI_WRF_1stColRep50_ON               1
+#define MC_XF_ROI_WRF_1stColRep50_OFF              2
+#define MC_XF_ROI_WRF_LastColRep50               (MCPARAMID)( 7352 << 14)
+#define MC_XF_ROI_WRF_LastColRep50_ON              1
+#define MC_XF_ROI_WRF_LastColRep50_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx50                 (MCPARAMID)( 7353 << 14)
+#define MC_XF_ROI_WRF_TOIwidth50                 (MCPARAMID)( 7354 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI50       (MCPARAMID)( 7355 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI50       (MCPARAMID)( 7356 << 14)
+#define MC_XF_ROI_WRF_Line150                    (MCPARAMID)( 7357 << 14)
+#define MC_XF_ROI_WRF_Line150_GB                   1
+#define MC_XF_ROI_WRF_Line150_BG                   2
+#define MC_XF_ROI_WRF_Line150_RG                   3
+#define MC_XF_ROI_WRF_Line150_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1050              (MCPARAMID)( 7358 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1150              (MCPARAMID)( 7359 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1250              (MCPARAMID)( 7360 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1350              (MCPARAMID)( 7361 << 14)
+#define MC_XF_ROI_WRF_TOIheight50                (MCPARAMID)( 7362 << 14)
+#define MC_XF_ROI_WRF_LastTOI50                  (MCPARAMID)( 7363 << 14)
+#define MC_XF_ROI_WRF_LastTOI50_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI50_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset50                (MCPARAMID)( 7364 << 14)
+#define MC_XF_ROI_WRF_TOIPitch50                 (MCPARAMID)( 7365 << 14)
+#define MC_XF_ROI_WRF_NbOfLine50                 (MCPARAMID)( 7366 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd50               (MCPARAMID)( 7367 << 14)
+#define MC_XF_ROI_WRF_1stLineRep51               (MCPARAMID)( 7368 << 14)
+#define MC_XF_ROI_WRF_1stLineRep51_ON              1
+#define MC_XF_ROI_WRF_1stLineRep51_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep51              (MCPARAMID)( 7369 << 14)
+#define MC_XF_ROI_WRF_LastLineRep51_ON             1
+#define MC_XF_ROI_WRF_LastLineRep51_OFF            2
+#define MC_XF_ROI_WRF_1stColRep51                (MCPARAMID)( 7370 << 14)
+#define MC_XF_ROI_WRF_1stColRep51_ON               1
+#define MC_XF_ROI_WRF_1stColRep51_OFF              2
+#define MC_XF_ROI_WRF_LastColRep51               (MCPARAMID)( 7371 << 14)
+#define MC_XF_ROI_WRF_LastColRep51_ON              1
+#define MC_XF_ROI_WRF_LastColRep51_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx51                 (MCPARAMID)( 7372 << 14)
+#define MC_XF_ROI_WRF_TOIwidth51                 (MCPARAMID)( 7373 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI51       (MCPARAMID)( 7374 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI51       (MCPARAMID)( 7375 << 14)
+#define MC_XF_ROI_WRF_Line151                    (MCPARAMID)( 7376 << 14)
+#define MC_XF_ROI_WRF_Line151_GB                   1
+#define MC_XF_ROI_WRF_Line151_BG                   2
+#define MC_XF_ROI_WRF_Line151_RG                   3
+#define MC_XF_ROI_WRF_Line151_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1051              (MCPARAMID)( 7377 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1151              (MCPARAMID)( 7378 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1251              (MCPARAMID)( 7379 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1351              (MCPARAMID)( 7380 << 14)
+#define MC_XF_ROI_WRF_TOIheight51                (MCPARAMID)( 7381 << 14)
+#define MC_XF_ROI_WRF_LastTOI51                  (MCPARAMID)( 7382 << 14)
+#define MC_XF_ROI_WRF_LastTOI51_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI51_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset51                (MCPARAMID)( 7383 << 14)
+#define MC_XF_ROI_WRF_TOIPitch51                 (MCPARAMID)( 7384 << 14)
+#define MC_XF_ROI_WRF_NbOfLine51                 (MCPARAMID)( 7385 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd51               (MCPARAMID)( 7386 << 14)
+#define MC_XF_ROI_WRF_1stLineRep52               (MCPARAMID)( 7387 << 14)
+#define MC_XF_ROI_WRF_1stLineRep52_ON              1
+#define MC_XF_ROI_WRF_1stLineRep52_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep52              (MCPARAMID)( 7388 << 14)
+#define MC_XF_ROI_WRF_LastLineRep52_ON             1
+#define MC_XF_ROI_WRF_LastLineRep52_OFF            2
+#define MC_XF_ROI_WRF_1stColRep52                (MCPARAMID)( 7389 << 14)
+#define MC_XF_ROI_WRF_1stColRep52_ON               1
+#define MC_XF_ROI_WRF_1stColRep52_OFF              2
+#define MC_XF_ROI_WRF_LastColRep52               (MCPARAMID)( 7390 << 14)
+#define MC_XF_ROI_WRF_LastColRep52_ON              1
+#define MC_XF_ROI_WRF_LastColRep52_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx52                 (MCPARAMID)( 7391 << 14)
+#define MC_XF_ROI_WRF_TOIwidth52                 (MCPARAMID)( 7392 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI52       (MCPARAMID)( 7393 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI52       (MCPARAMID)( 7394 << 14)
+#define MC_XF_ROI_WRF_Line152                    (MCPARAMID)( 7395 << 14)
+#define MC_XF_ROI_WRF_Line152_GB                   1
+#define MC_XF_ROI_WRF_Line152_BG                   2
+#define MC_XF_ROI_WRF_Line152_RG                   3
+#define MC_XF_ROI_WRF_Line152_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1052              (MCPARAMID)( 7396 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1152              (MCPARAMID)( 7397 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1252              (MCPARAMID)( 7398 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1352              (MCPARAMID)( 7399 << 14)
+#define MC_XF_ROI_WRF_TOIheight52                (MCPARAMID)( 7400 << 14)
+#define MC_XF_ROI_WRF_LastTOI52                  (MCPARAMID)( 7401 << 14)
+#define MC_XF_ROI_WRF_LastTOI52_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI52_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset52                (MCPARAMID)( 7402 << 14)
+#define MC_XF_ROI_WRF_TOIPitch52                 (MCPARAMID)( 7403 << 14)
+#define MC_XF_ROI_WRF_NbOfLine52                 (MCPARAMID)( 7404 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd52               (MCPARAMID)( 7405 << 14)
+#define MC_XF_ROI_WRF_1stLineRep53               (MCPARAMID)( 7406 << 14)
+#define MC_XF_ROI_WRF_1stLineRep53_ON              1
+#define MC_XF_ROI_WRF_1stLineRep53_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep53              (MCPARAMID)( 7407 << 14)
+#define MC_XF_ROI_WRF_LastLineRep53_ON             1
+#define MC_XF_ROI_WRF_LastLineRep53_OFF            2
+#define MC_XF_ROI_WRF_1stColRep53                (MCPARAMID)( 7408 << 14)
+#define MC_XF_ROI_WRF_1stColRep53_ON               1
+#define MC_XF_ROI_WRF_1stColRep53_OFF              2
+#define MC_XF_ROI_WRF_LastColRep53               (MCPARAMID)( 7409 << 14)
+#define MC_XF_ROI_WRF_LastColRep53_ON              1
+#define MC_XF_ROI_WRF_LastColRep53_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx53                 (MCPARAMID)( 7410 << 14)
+#define MC_XF_ROI_WRF_TOIwidth53                 (MCPARAMID)( 7411 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI53       (MCPARAMID)( 7412 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI53       (MCPARAMID)( 7413 << 14)
+#define MC_XF_ROI_WRF_Line153                    (MCPARAMID)( 7414 << 14)
+#define MC_XF_ROI_WRF_Line153_GB                   1
+#define MC_XF_ROI_WRF_Line153_BG                   2
+#define MC_XF_ROI_WRF_Line153_RG                   3
+#define MC_XF_ROI_WRF_Line153_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1053              (MCPARAMID)( 7415 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1153              (MCPARAMID)( 7416 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1253              (MCPARAMID)( 7417 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1353              (MCPARAMID)( 7418 << 14)
+#define MC_XF_ROI_WRF_TOIheight53                (MCPARAMID)( 7419 << 14)
+#define MC_XF_ROI_WRF_LastTOI53                  (MCPARAMID)( 7420 << 14)
+#define MC_XF_ROI_WRF_LastTOI53_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI53_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset53                (MCPARAMID)( 7421 << 14)
+#define MC_XF_ROI_WRF_TOIPitch53                 (MCPARAMID)( 7422 << 14)
+#define MC_XF_ROI_WRF_NbOfLine53                 (MCPARAMID)( 7423 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd53               (MCPARAMID)( 7424 << 14)
+#define MC_XF_ROI_WRF_1stLineRep54               (MCPARAMID)( 7425 << 14)
+#define MC_XF_ROI_WRF_1stLineRep54_ON              1
+#define MC_XF_ROI_WRF_1stLineRep54_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep54              (MCPARAMID)( 7426 << 14)
+#define MC_XF_ROI_WRF_LastLineRep54_ON             1
+#define MC_XF_ROI_WRF_LastLineRep54_OFF            2
+#define MC_XF_ROI_WRF_1stColRep54                (MCPARAMID)( 7427 << 14)
+#define MC_XF_ROI_WRF_1stColRep54_ON               1
+#define MC_XF_ROI_WRF_1stColRep54_OFF              2
+#define MC_XF_ROI_WRF_LastColRep54               (MCPARAMID)( 7428 << 14)
+#define MC_XF_ROI_WRF_LastColRep54_ON              1
+#define MC_XF_ROI_WRF_LastColRep54_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx54                 (MCPARAMID)( 7429 << 14)
+#define MC_XF_ROI_WRF_TOIwidth54                 (MCPARAMID)( 7430 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI54       (MCPARAMID)( 7431 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI54       (MCPARAMID)( 7432 << 14)
+#define MC_XF_ROI_WRF_Line154                    (MCPARAMID)( 7433 << 14)
+#define MC_XF_ROI_WRF_Line154_GB                   1
+#define MC_XF_ROI_WRF_Line154_BG                   2
+#define MC_XF_ROI_WRF_Line154_RG                   3
+#define MC_XF_ROI_WRF_Line154_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1054              (MCPARAMID)( 7434 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1154              (MCPARAMID)( 7435 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1254              (MCPARAMID)( 7436 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1354              (MCPARAMID)( 7437 << 14)
+#define MC_XF_ROI_WRF_TOIheight54                (MCPARAMID)( 7438 << 14)
+#define MC_XF_ROI_WRF_LastTOI54                  (MCPARAMID)( 7439 << 14)
+#define MC_XF_ROI_WRF_LastTOI54_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI54_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset54                (MCPARAMID)( 7440 << 14)
+#define MC_XF_ROI_WRF_TOIPitch54                 (MCPARAMID)( 7441 << 14)
+#define MC_XF_ROI_WRF_NbOfLine54                 (MCPARAMID)( 7442 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd54               (MCPARAMID)( 7443 << 14)
+#define MC_XF_ROI_WRF_1stLineRep55               (MCPARAMID)( 7444 << 14)
+#define MC_XF_ROI_WRF_1stLineRep55_ON              1
+#define MC_XF_ROI_WRF_1stLineRep55_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep55              (MCPARAMID)( 7445 << 14)
+#define MC_XF_ROI_WRF_LastLineRep55_ON             1
+#define MC_XF_ROI_WRF_LastLineRep55_OFF            2
+#define MC_XF_ROI_WRF_1stColRep55                (MCPARAMID)( 7446 << 14)
+#define MC_XF_ROI_WRF_1stColRep55_ON               1
+#define MC_XF_ROI_WRF_1stColRep55_OFF              2
+#define MC_XF_ROI_WRF_LastColRep55               (MCPARAMID)( 7447 << 14)
+#define MC_XF_ROI_WRF_LastColRep55_ON              1
+#define MC_XF_ROI_WRF_LastColRep55_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx55                 (MCPARAMID)( 7448 << 14)
+#define MC_XF_ROI_WRF_TOIwidth55                 (MCPARAMID)( 7449 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI55       (MCPARAMID)( 7450 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI55       (MCPARAMID)( 7451 << 14)
+#define MC_XF_ROI_WRF_Line155                    (MCPARAMID)( 7452 << 14)
+#define MC_XF_ROI_WRF_Line155_GB                   1
+#define MC_XF_ROI_WRF_Line155_BG                   2
+#define MC_XF_ROI_WRF_Line155_RG                   3
+#define MC_XF_ROI_WRF_Line155_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1055              (MCPARAMID)( 7453 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1155              (MCPARAMID)( 7454 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1255              (MCPARAMID)( 7455 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1355              (MCPARAMID)( 7456 << 14)
+#define MC_XF_ROI_WRF_TOIheight55                (MCPARAMID)( 7457 << 14)
+#define MC_XF_ROI_WRF_LastTOI55                  (MCPARAMID)( 7458 << 14)
+#define MC_XF_ROI_WRF_LastTOI55_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI55_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset55                (MCPARAMID)( 7459 << 14)
+#define MC_XF_ROI_WRF_TOIPitch55                 (MCPARAMID)( 7460 << 14)
+#define MC_XF_ROI_WRF_NbOfLine55                 (MCPARAMID)( 7461 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd55               (MCPARAMID)( 7462 << 14)
+#define MC_XF_ROI_WRF_1stLineRep56               (MCPARAMID)( 7463 << 14)
+#define MC_XF_ROI_WRF_1stLineRep56_ON              1
+#define MC_XF_ROI_WRF_1stLineRep56_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep56              (MCPARAMID)( 7464 << 14)
+#define MC_XF_ROI_WRF_LastLineRep56_ON             1
+#define MC_XF_ROI_WRF_LastLineRep56_OFF            2
+#define MC_XF_ROI_WRF_1stColRep56                (MCPARAMID)( 7465 << 14)
+#define MC_XF_ROI_WRF_1stColRep56_ON               1
+#define MC_XF_ROI_WRF_1stColRep56_OFF              2
+#define MC_XF_ROI_WRF_LastColRep56               (MCPARAMID)( 7466 << 14)
+#define MC_XF_ROI_WRF_LastColRep56_ON              1
+#define MC_XF_ROI_WRF_LastColRep56_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx56                 (MCPARAMID)( 7467 << 14)
+#define MC_XF_ROI_WRF_TOIwidth56                 (MCPARAMID)( 7468 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI56       (MCPARAMID)( 7469 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI56       (MCPARAMID)( 7470 << 14)
+#define MC_XF_ROI_WRF_Line156                    (MCPARAMID)( 7471 << 14)
+#define MC_XF_ROI_WRF_Line156_GB                   1
+#define MC_XF_ROI_WRF_Line156_BG                   2
+#define MC_XF_ROI_WRF_Line156_RG                   3
+#define MC_XF_ROI_WRF_Line156_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1056              (MCPARAMID)( 7472 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1156              (MCPARAMID)( 7473 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1256              (MCPARAMID)( 7474 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1356              (MCPARAMID)( 7475 << 14)
+#define MC_XF_ROI_WRF_TOIheight56                (MCPARAMID)( 7476 << 14)
+#define MC_XF_ROI_WRF_LastTOI56                  (MCPARAMID)( 7477 << 14)
+#define MC_XF_ROI_WRF_LastTOI56_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI56_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset56                (MCPARAMID)( 7478 << 14)
+#define MC_XF_ROI_WRF_TOIPitch56                 (MCPARAMID)( 7479 << 14)
+#define MC_XF_ROI_WRF_NbOfLine56                 (MCPARAMID)( 7480 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd56               (MCPARAMID)( 7481 << 14)
+#define MC_XF_ROI_WRF_1stLineRep57               (MCPARAMID)( 7482 << 14)
+#define MC_XF_ROI_WRF_1stLineRep57_ON              1
+#define MC_XF_ROI_WRF_1stLineRep57_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep57              (MCPARAMID)( 7483 << 14)
+#define MC_XF_ROI_WRF_LastLineRep57_ON             1
+#define MC_XF_ROI_WRF_LastLineRep57_OFF            2
+#define MC_XF_ROI_WRF_1stColRep57                (MCPARAMID)( 7484 << 14)
+#define MC_XF_ROI_WRF_1stColRep57_ON               1
+#define MC_XF_ROI_WRF_1stColRep57_OFF              2
+#define MC_XF_ROI_WRF_LastColRep57               (MCPARAMID)( 7485 << 14)
+#define MC_XF_ROI_WRF_LastColRep57_ON              1
+#define MC_XF_ROI_WRF_LastColRep57_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx57                 (MCPARAMID)( 7486 << 14)
+#define MC_XF_ROI_WRF_TOIwidth57                 (MCPARAMID)( 7487 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI57       (MCPARAMID)( 7488 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI57       (MCPARAMID)( 7489 << 14)
+#define MC_XF_ROI_WRF_Line157                    (MCPARAMID)( 7490 << 14)
+#define MC_XF_ROI_WRF_Line157_GB                   1
+#define MC_XF_ROI_WRF_Line157_BG                   2
+#define MC_XF_ROI_WRF_Line157_RG                   3
+#define MC_XF_ROI_WRF_Line157_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1057              (MCPARAMID)( 7491 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1157              (MCPARAMID)( 7492 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1257              (MCPARAMID)( 7493 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1357              (MCPARAMID)( 7494 << 14)
+#define MC_XF_ROI_WRF_TOIheight57                (MCPARAMID)( 7495 << 14)
+#define MC_XF_ROI_WRF_LastTOI57                  (MCPARAMID)( 7496 << 14)
+#define MC_XF_ROI_WRF_LastTOI57_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI57_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset57                (MCPARAMID)( 7497 << 14)
+#define MC_XF_ROI_WRF_TOIPitch57                 (MCPARAMID)( 7498 << 14)
+#define MC_XF_ROI_WRF_NbOfLine57                 (MCPARAMID)( 7499 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd57               (MCPARAMID)( 7500 << 14)
+#define MC_XF_ROI_WRF_1stLineRep58               (MCPARAMID)( 7501 << 14)
+#define MC_XF_ROI_WRF_1stLineRep58_ON              1
+#define MC_XF_ROI_WRF_1stLineRep58_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep58              (MCPARAMID)( 7502 << 14)
+#define MC_XF_ROI_WRF_LastLineRep58_ON             1
+#define MC_XF_ROI_WRF_LastLineRep58_OFF            2
+#define MC_XF_ROI_WRF_1stColRep58                (MCPARAMID)( 7503 << 14)
+#define MC_XF_ROI_WRF_1stColRep58_ON               1
+#define MC_XF_ROI_WRF_1stColRep58_OFF              2
+#define MC_XF_ROI_WRF_LastColRep58               (MCPARAMID)( 7504 << 14)
+#define MC_XF_ROI_WRF_LastColRep58_ON              1
+#define MC_XF_ROI_WRF_LastColRep58_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx58                 (MCPARAMID)( 7505 << 14)
+#define MC_XF_ROI_WRF_TOIwidth58                 (MCPARAMID)( 7506 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI58       (MCPARAMID)( 7507 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI58       (MCPARAMID)( 7508 << 14)
+#define MC_XF_ROI_WRF_Line158                    (MCPARAMID)( 7509 << 14)
+#define MC_XF_ROI_WRF_Line158_GB                   1
+#define MC_XF_ROI_WRF_Line158_BG                   2
+#define MC_XF_ROI_WRF_Line158_RG                   3
+#define MC_XF_ROI_WRF_Line158_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1058              (MCPARAMID)( 7510 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1158              (MCPARAMID)( 7511 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1258              (MCPARAMID)( 7512 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1358              (MCPARAMID)( 7513 << 14)
+#define MC_XF_ROI_WRF_TOIheight58                (MCPARAMID)( 7514 << 14)
+#define MC_XF_ROI_WRF_LastTOI58                  (MCPARAMID)( 7515 << 14)
+#define MC_XF_ROI_WRF_LastTOI58_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI58_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset58                (MCPARAMID)( 7516 << 14)
+#define MC_XF_ROI_WRF_TOIPitch58                 (MCPARAMID)( 7517 << 14)
+#define MC_XF_ROI_WRF_NbOfLine58                 (MCPARAMID)( 7518 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd58               (MCPARAMID)( 7519 << 14)
+#define MC_XF_ROI_WRF_1stLineRep59               (MCPARAMID)( 7520 << 14)
+#define MC_XF_ROI_WRF_1stLineRep59_ON              1
+#define MC_XF_ROI_WRF_1stLineRep59_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep59              (MCPARAMID)( 7521 << 14)
+#define MC_XF_ROI_WRF_LastLineRep59_ON             1
+#define MC_XF_ROI_WRF_LastLineRep59_OFF            2
+#define MC_XF_ROI_WRF_1stColRep59                (MCPARAMID)( 7522 << 14)
+#define MC_XF_ROI_WRF_1stColRep59_ON               1
+#define MC_XF_ROI_WRF_1stColRep59_OFF              2
+#define MC_XF_ROI_WRF_LastColRep59               (MCPARAMID)( 7523 << 14)
+#define MC_XF_ROI_WRF_LastColRep59_ON              1
+#define MC_XF_ROI_WRF_LastColRep59_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx59                 (MCPARAMID)( 7524 << 14)
+#define MC_XF_ROI_WRF_TOIwidth59                 (MCPARAMID)( 7525 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI59       (MCPARAMID)( 7526 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI59       (MCPARAMID)( 7527 << 14)
+#define MC_XF_ROI_WRF_Line159                    (MCPARAMID)( 7528 << 14)
+#define MC_XF_ROI_WRF_Line159_GB                   1
+#define MC_XF_ROI_WRF_Line159_BG                   2
+#define MC_XF_ROI_WRF_Line159_RG                   3
+#define MC_XF_ROI_WRF_Line159_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1059              (MCPARAMID)( 7529 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1159              (MCPARAMID)( 7530 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1259              (MCPARAMID)( 7531 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1359              (MCPARAMID)( 7532 << 14)
+#define MC_XF_ROI_WRF_TOIheight59                (MCPARAMID)( 7533 << 14)
+#define MC_XF_ROI_WRF_LastTOI59                  (MCPARAMID)( 7534 << 14)
+#define MC_XF_ROI_WRF_LastTOI59_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI59_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset59                (MCPARAMID)( 7535 << 14)
+#define MC_XF_ROI_WRF_TOIPitch59                 (MCPARAMID)( 7536 << 14)
+#define MC_XF_ROI_WRF_NbOfLine59                 (MCPARAMID)( 7537 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd59               (MCPARAMID)( 7538 << 14)
+#define MC_XF_ROI_WRF_1stLineRep60               (MCPARAMID)( 7539 << 14)
+#define MC_XF_ROI_WRF_1stLineRep60_ON              1
+#define MC_XF_ROI_WRF_1stLineRep60_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep60              (MCPARAMID)( 7540 << 14)
+#define MC_XF_ROI_WRF_LastLineRep60_ON             1
+#define MC_XF_ROI_WRF_LastLineRep60_OFF            2
+#define MC_XF_ROI_WRF_1stColRep60                (MCPARAMID)( 7541 << 14)
+#define MC_XF_ROI_WRF_1stColRep60_ON               1
+#define MC_XF_ROI_WRF_1stColRep60_OFF              2
+#define MC_XF_ROI_WRF_LastColRep60               (MCPARAMID)( 7542 << 14)
+#define MC_XF_ROI_WRF_LastColRep60_ON              1
+#define MC_XF_ROI_WRF_LastColRep60_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx60                 (MCPARAMID)( 7543 << 14)
+#define MC_XF_ROI_WRF_TOIwidth60                 (MCPARAMID)( 7544 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI60       (MCPARAMID)( 7545 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI60       (MCPARAMID)( 7546 << 14)
+#define MC_XF_ROI_WRF_Line160                    (MCPARAMID)( 7547 << 14)
+#define MC_XF_ROI_WRF_Line160_GB                   1
+#define MC_XF_ROI_WRF_Line160_BG                   2
+#define MC_XF_ROI_WRF_Line160_RG                   3
+#define MC_XF_ROI_WRF_Line160_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1060              (MCPARAMID)( 7548 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1160              (MCPARAMID)( 7549 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1260              (MCPARAMID)( 7550 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1360              (MCPARAMID)( 7551 << 14)
+#define MC_XF_ROI_WRF_TOIheight60                (MCPARAMID)( 7552 << 14)
+#define MC_XF_ROI_WRF_LastTOI60                  (MCPARAMID)( 7553 << 14)
+#define MC_XF_ROI_WRF_LastTOI60_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI60_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset60                (MCPARAMID)( 7554 << 14)
+#define MC_XF_ROI_WRF_TOIPitch60                 (MCPARAMID)( 7555 << 14)
+#define MC_XF_ROI_WRF_NbOfLine60                 (MCPARAMID)( 7556 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd60               (MCPARAMID)( 7557 << 14)
+#define MC_XF_ROI_WRF_1stLineRep61               (MCPARAMID)( 7558 << 14)
+#define MC_XF_ROI_WRF_1stLineRep61_ON              1
+#define MC_XF_ROI_WRF_1stLineRep61_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep61              (MCPARAMID)( 7559 << 14)
+#define MC_XF_ROI_WRF_LastLineRep61_ON             1
+#define MC_XF_ROI_WRF_LastLineRep61_OFF            2
+#define MC_XF_ROI_WRF_1stColRep61                (MCPARAMID)( 7560 << 14)
+#define MC_XF_ROI_WRF_1stColRep61_ON               1
+#define MC_XF_ROI_WRF_1stColRep61_OFF              2
+#define MC_XF_ROI_WRF_LastColRep61               (MCPARAMID)( 7561 << 14)
+#define MC_XF_ROI_WRF_LastColRep61_ON              1
+#define MC_XF_ROI_WRF_LastColRep61_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx61                 (MCPARAMID)( 7562 << 14)
+#define MC_XF_ROI_WRF_TOIwidth61                 (MCPARAMID)( 7563 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI61       (MCPARAMID)( 7564 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI61       (MCPARAMID)( 7565 << 14)
+#define MC_XF_ROI_WRF_Line161                    (MCPARAMID)( 7566 << 14)
+#define MC_XF_ROI_WRF_Line161_GB                   1
+#define MC_XF_ROI_WRF_Line161_BG                   2
+#define MC_XF_ROI_WRF_Line161_RG                   3
+#define MC_XF_ROI_WRF_Line161_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1061              (MCPARAMID)( 7567 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1161              (MCPARAMID)( 7568 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1261              (MCPARAMID)( 7569 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1361              (MCPARAMID)( 7570 << 14)
+#define MC_XF_ROI_WRF_TOIheight61                (MCPARAMID)( 7571 << 14)
+#define MC_XF_ROI_WRF_LastTOI61                  (MCPARAMID)( 7572 << 14)
+#define MC_XF_ROI_WRF_LastTOI61_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI61_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset61                (MCPARAMID)( 7573 << 14)
+#define MC_XF_ROI_WRF_TOIPitch61                 (MCPARAMID)( 7574 << 14)
+#define MC_XF_ROI_WRF_NbOfLine61                 (MCPARAMID)( 7575 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd61               (MCPARAMID)( 7576 << 14)
+#define MC_XF_ROI_WRF_1stLineRep62               (MCPARAMID)( 7577 << 14)
+#define MC_XF_ROI_WRF_1stLineRep62_ON              1
+#define MC_XF_ROI_WRF_1stLineRep62_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep62              (MCPARAMID)( 7578 << 14)
+#define MC_XF_ROI_WRF_LastLineRep62_ON             1
+#define MC_XF_ROI_WRF_LastLineRep62_OFF            2
+#define MC_XF_ROI_WRF_1stColRep62                (MCPARAMID)( 7579 << 14)
+#define MC_XF_ROI_WRF_1stColRep62_ON               1
+#define MC_XF_ROI_WRF_1stColRep62_OFF              2
+#define MC_XF_ROI_WRF_LastColRep62               (MCPARAMID)( 7580 << 14)
+#define MC_XF_ROI_WRF_LastColRep62_ON              1
+#define MC_XF_ROI_WRF_LastColRep62_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx62                 (MCPARAMID)( 7581 << 14)
+#define MC_XF_ROI_WRF_TOIwidth62                 (MCPARAMID)( 7582 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI62       (MCPARAMID)( 7583 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI62       (MCPARAMID)( 7584 << 14)
+#define MC_XF_ROI_WRF_Line162                    (MCPARAMID)( 7585 << 14)
+#define MC_XF_ROI_WRF_Line162_GB                   1
+#define MC_XF_ROI_WRF_Line162_BG                   2
+#define MC_XF_ROI_WRF_Line162_RG                   3
+#define MC_XF_ROI_WRF_Line162_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1062              (MCPARAMID)( 7586 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1162              (MCPARAMID)( 7587 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1262              (MCPARAMID)( 7588 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1362              (MCPARAMID)( 7589 << 14)
+#define MC_XF_ROI_WRF_TOIheight62                (MCPARAMID)( 7590 << 14)
+#define MC_XF_ROI_WRF_LastTOI62                  (MCPARAMID)( 7591 << 14)
+#define MC_XF_ROI_WRF_LastTOI62_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI62_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset62                (MCPARAMID)( 7592 << 14)
+#define MC_XF_ROI_WRF_TOIPitch62                 (MCPARAMID)( 7593 << 14)
+#define MC_XF_ROI_WRF_NbOfLine62                 (MCPARAMID)( 7594 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd62               (MCPARAMID)( 7595 << 14)
+#define MC_XF_ROI_WRF_1stLineRep63               (MCPARAMID)( 7596 << 14)
+#define MC_XF_ROI_WRF_1stLineRep63_ON              1
+#define MC_XF_ROI_WRF_1stLineRep63_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep63              (MCPARAMID)( 7597 << 14)
+#define MC_XF_ROI_WRF_LastLineRep63_ON             1
+#define MC_XF_ROI_WRF_LastLineRep63_OFF            2
+#define MC_XF_ROI_WRF_1stColRep63                (MCPARAMID)( 7598 << 14)
+#define MC_XF_ROI_WRF_1stColRep63_ON               1
+#define MC_XF_ROI_WRF_1stColRep63_OFF              2
+#define MC_XF_ROI_WRF_LastColRep63               (MCPARAMID)( 7599 << 14)
+#define MC_XF_ROI_WRF_LastColRep63_ON              1
+#define MC_XF_ROI_WRF_LastColRep63_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx63                 (MCPARAMID)( 7600 << 14)
+#define MC_XF_ROI_WRF_TOIwidth63                 (MCPARAMID)( 7601 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI63       (MCPARAMID)( 7602 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI63       (MCPARAMID)( 7603 << 14)
+#define MC_XF_ROI_WRF_Line163                    (MCPARAMID)( 7604 << 14)
+#define MC_XF_ROI_WRF_Line163_GB                   1
+#define MC_XF_ROI_WRF_Line163_BG                   2
+#define MC_XF_ROI_WRF_Line163_RG                   3
+#define MC_XF_ROI_WRF_Line163_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1063              (MCPARAMID)( 7605 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1163              (MCPARAMID)( 7606 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1263              (MCPARAMID)( 7607 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1363              (MCPARAMID)( 7608 << 14)
+#define MC_XF_ROI_WRF_TOIheight63                (MCPARAMID)( 7609 << 14)
+#define MC_XF_ROI_WRF_LastTOI63                  (MCPARAMID)( 7610 << 14)
+#define MC_XF_ROI_WRF_LastTOI63_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI63_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset63                (MCPARAMID)( 7611 << 14)
+#define MC_XF_ROI_WRF_TOIPitch63                 (MCPARAMID)( 7612 << 14)
+#define MC_XF_ROI_WRF_NbOfLine63                 (MCPARAMID)( 7613 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd63               (MCPARAMID)( 7614 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep32              (MCPARAMID)( 7615 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep32_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep32_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep32             (MCPARAMID)( 7616 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep32_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep32_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep32               (MCPARAMID)( 7617 << 14)
+#define MC_AWB_ROI_WRF_1stColRep32_ON              1
+#define MC_AWB_ROI_WRF_1stColRep32_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep32              (MCPARAMID)( 7618 << 14)
+#define MC_AWB_ROI_WRF_LastColRep32_ON             1
+#define MC_AWB_ROI_WRF_LastColRep32_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx32                (MCPARAMID)( 7619 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth32                (MCPARAMID)( 7620 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI32      (MCPARAMID)( 7621 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI32      (MCPARAMID)( 7622 << 14)
+#define MC_AWB_ROI_WRF_Line132                   (MCPARAMID)( 7623 << 14)
+#define MC_AWB_ROI_WRF_Line132_GB                  1
+#define MC_AWB_ROI_WRF_Line132_BG                  2
+#define MC_AWB_ROI_WRF_Line132_RG                  3
+#define MC_AWB_ROI_WRF_Line132_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1032             (MCPARAMID)( 7624 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1132             (MCPARAMID)( 7625 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1232             (MCPARAMID)( 7626 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1332             (MCPARAMID)( 7627 << 14)
+#define MC_AWB_ROI_WRF_TOIheight32               (MCPARAMID)( 7628 << 14)
+#define MC_AWB_ROI_WRF_LastTOI32                 (MCPARAMID)( 7629 << 14)
+#define MC_AWB_ROI_WRF_LastTOI32_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI32_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset32               (MCPARAMID)( 7630 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch32                (MCPARAMID)( 7631 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine32                (MCPARAMID)( 7632 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd32              (MCPARAMID)( 7633 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep33              (MCPARAMID)( 7634 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep33_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep33_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep33             (MCPARAMID)( 7635 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep33_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep33_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep33               (MCPARAMID)( 7636 << 14)
+#define MC_AWB_ROI_WRF_1stColRep33_ON              1
+#define MC_AWB_ROI_WRF_1stColRep33_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep33              (MCPARAMID)( 7637 << 14)
+#define MC_AWB_ROI_WRF_LastColRep33_ON             1
+#define MC_AWB_ROI_WRF_LastColRep33_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx33                (MCPARAMID)( 7638 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth33                (MCPARAMID)( 7639 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI33      (MCPARAMID)( 7640 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI33      (MCPARAMID)( 7641 << 14)
+#define MC_AWB_ROI_WRF_Line133                   (MCPARAMID)( 7642 << 14)
+#define MC_AWB_ROI_WRF_Line133_GB                  1
+#define MC_AWB_ROI_WRF_Line133_BG                  2
+#define MC_AWB_ROI_WRF_Line133_RG                  3
+#define MC_AWB_ROI_WRF_Line133_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1033             (MCPARAMID)( 7643 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1133             (MCPARAMID)( 7644 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1233             (MCPARAMID)( 7645 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1333             (MCPARAMID)( 7646 << 14)
+#define MC_AWB_ROI_WRF_TOIheight33               (MCPARAMID)( 7647 << 14)
+#define MC_AWB_ROI_WRF_LastTOI33                 (MCPARAMID)( 7648 << 14)
+#define MC_AWB_ROI_WRF_LastTOI33_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI33_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset33               (MCPARAMID)( 7649 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch33                (MCPARAMID)( 7650 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine33                (MCPARAMID)( 7651 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd33              (MCPARAMID)( 7652 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep34              (MCPARAMID)( 7653 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep34_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep34_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep34             (MCPARAMID)( 7654 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep34_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep34_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep34               (MCPARAMID)( 7655 << 14)
+#define MC_AWB_ROI_WRF_1stColRep34_ON              1
+#define MC_AWB_ROI_WRF_1stColRep34_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep34              (MCPARAMID)( 7656 << 14)
+#define MC_AWB_ROI_WRF_LastColRep34_ON             1
+#define MC_AWB_ROI_WRF_LastColRep34_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx34                (MCPARAMID)( 7657 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth34                (MCPARAMID)( 7658 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI34      (MCPARAMID)( 7659 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI34      (MCPARAMID)( 7660 << 14)
+#define MC_AWB_ROI_WRF_Line134                   (MCPARAMID)( 7661 << 14)
+#define MC_AWB_ROI_WRF_Line134_GB                  1
+#define MC_AWB_ROI_WRF_Line134_BG                  2
+#define MC_AWB_ROI_WRF_Line134_RG                  3
+#define MC_AWB_ROI_WRF_Line134_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1034             (MCPARAMID)( 7662 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1134             (MCPARAMID)( 7663 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1234             (MCPARAMID)( 7664 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1334             (MCPARAMID)( 7665 << 14)
+#define MC_AWB_ROI_WRF_TOIheight34               (MCPARAMID)( 7666 << 14)
+#define MC_AWB_ROI_WRF_LastTOI34                 (MCPARAMID)( 7667 << 14)
+#define MC_AWB_ROI_WRF_LastTOI34_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI34_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset34               (MCPARAMID)( 7668 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch34                (MCPARAMID)( 7669 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine34                (MCPARAMID)( 7670 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd34              (MCPARAMID)( 7671 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep35              (MCPARAMID)( 7672 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep35_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep35_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep35             (MCPARAMID)( 7673 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep35_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep35_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep35               (MCPARAMID)( 7674 << 14)
+#define MC_AWB_ROI_WRF_1stColRep35_ON              1
+#define MC_AWB_ROI_WRF_1stColRep35_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep35              (MCPARAMID)( 7675 << 14)
+#define MC_AWB_ROI_WRF_LastColRep35_ON             1
+#define MC_AWB_ROI_WRF_LastColRep35_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx35                (MCPARAMID)( 7676 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth35                (MCPARAMID)( 7677 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI35      (MCPARAMID)( 7678 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI35      (MCPARAMID)( 7679 << 14)
+#define MC_AWB_ROI_WRF_Line135                   (MCPARAMID)( 7680 << 14)
+#define MC_AWB_ROI_WRF_Line135_GB                  1
+#define MC_AWB_ROI_WRF_Line135_BG                  2
+#define MC_AWB_ROI_WRF_Line135_RG                  3
+#define MC_AWB_ROI_WRF_Line135_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1035             (MCPARAMID)( 7681 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1135             (MCPARAMID)( 7682 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1235             (MCPARAMID)( 7683 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1335             (MCPARAMID)( 7684 << 14)
+#define MC_AWB_ROI_WRF_TOIheight35               (MCPARAMID)( 7685 << 14)
+#define MC_AWB_ROI_WRF_LastTOI35                 (MCPARAMID)( 7686 << 14)
+#define MC_AWB_ROI_WRF_LastTOI35_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI35_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset35               (MCPARAMID)( 7687 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch35                (MCPARAMID)( 7688 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine35                (MCPARAMID)( 7689 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd35              (MCPARAMID)( 7690 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep36              (MCPARAMID)( 7691 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep36_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep36_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep36             (MCPARAMID)( 7692 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep36_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep36_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep36               (MCPARAMID)( 7693 << 14)
+#define MC_AWB_ROI_WRF_1stColRep36_ON              1
+#define MC_AWB_ROI_WRF_1stColRep36_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep36              (MCPARAMID)( 7694 << 14)
+#define MC_AWB_ROI_WRF_LastColRep36_ON             1
+#define MC_AWB_ROI_WRF_LastColRep36_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx36                (MCPARAMID)( 7695 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth36                (MCPARAMID)( 7696 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI36      (MCPARAMID)( 7697 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI36      (MCPARAMID)( 7698 << 14)
+#define MC_AWB_ROI_WRF_Line136                   (MCPARAMID)( 7699 << 14)
+#define MC_AWB_ROI_WRF_Line136_GB                  1
+#define MC_AWB_ROI_WRF_Line136_BG                  2
+#define MC_AWB_ROI_WRF_Line136_RG                  3
+#define MC_AWB_ROI_WRF_Line136_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1036             (MCPARAMID)( 7700 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1136             (MCPARAMID)( 7701 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1236             (MCPARAMID)( 7702 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1336             (MCPARAMID)( 7703 << 14)
+#define MC_AWB_ROI_WRF_TOIheight36               (MCPARAMID)( 7704 << 14)
+#define MC_AWB_ROI_WRF_LastTOI36                 (MCPARAMID)( 7705 << 14)
+#define MC_AWB_ROI_WRF_LastTOI36_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI36_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset36               (MCPARAMID)( 7706 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch36                (MCPARAMID)( 7707 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine36                (MCPARAMID)( 7708 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd36              (MCPARAMID)( 7709 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep37              (MCPARAMID)( 7710 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep37_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep37_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep37             (MCPARAMID)( 7711 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep37_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep37_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep37               (MCPARAMID)( 7712 << 14)
+#define MC_AWB_ROI_WRF_1stColRep37_ON              1
+#define MC_AWB_ROI_WRF_1stColRep37_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep37              (MCPARAMID)( 7713 << 14)
+#define MC_AWB_ROI_WRF_LastColRep37_ON             1
+#define MC_AWB_ROI_WRF_LastColRep37_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx37                (MCPARAMID)( 7714 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth37                (MCPARAMID)( 7715 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI37      (MCPARAMID)( 7716 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI37      (MCPARAMID)( 7717 << 14)
+#define MC_AWB_ROI_WRF_Line137                   (MCPARAMID)( 7718 << 14)
+#define MC_AWB_ROI_WRF_Line137_GB                  1
+#define MC_AWB_ROI_WRF_Line137_BG                  2
+#define MC_AWB_ROI_WRF_Line137_RG                  3
+#define MC_AWB_ROI_WRF_Line137_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1037             (MCPARAMID)( 7719 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1137             (MCPARAMID)( 7720 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1237             (MCPARAMID)( 7721 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1337             (MCPARAMID)( 7722 << 14)
+#define MC_AWB_ROI_WRF_TOIheight37               (MCPARAMID)( 7723 << 14)
+#define MC_AWB_ROI_WRF_LastTOI37                 (MCPARAMID)( 7724 << 14)
+#define MC_AWB_ROI_WRF_LastTOI37_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI37_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset37               (MCPARAMID)( 7725 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch37                (MCPARAMID)( 7726 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine37                (MCPARAMID)( 7727 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd37              (MCPARAMID)( 7728 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep38              (MCPARAMID)( 7729 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep38_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep38_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep38             (MCPARAMID)( 7730 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep38_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep38_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep38               (MCPARAMID)( 7731 << 14)
+#define MC_AWB_ROI_WRF_1stColRep38_ON              1
+#define MC_AWB_ROI_WRF_1stColRep38_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep38              (MCPARAMID)( 7732 << 14)
+#define MC_AWB_ROI_WRF_LastColRep38_ON             1
+#define MC_AWB_ROI_WRF_LastColRep38_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx38                (MCPARAMID)( 7733 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth38                (MCPARAMID)( 7734 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI38      (MCPARAMID)( 7735 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI38      (MCPARAMID)( 7736 << 14)
+#define MC_AWB_ROI_WRF_Line138                   (MCPARAMID)( 7737 << 14)
+#define MC_AWB_ROI_WRF_Line138_GB                  1
+#define MC_AWB_ROI_WRF_Line138_BG                  2
+#define MC_AWB_ROI_WRF_Line138_RG                  3
+#define MC_AWB_ROI_WRF_Line138_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1038             (MCPARAMID)( 7738 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1138             (MCPARAMID)( 7739 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1238             (MCPARAMID)( 7740 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1338             (MCPARAMID)( 7741 << 14)
+#define MC_AWB_ROI_WRF_TOIheight38               (MCPARAMID)( 7742 << 14)
+#define MC_AWB_ROI_WRF_LastTOI38                 (MCPARAMID)( 7743 << 14)
+#define MC_AWB_ROI_WRF_LastTOI38_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI38_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset38               (MCPARAMID)( 7744 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch38                (MCPARAMID)( 7745 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine38                (MCPARAMID)( 7746 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd38              (MCPARAMID)( 7747 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep39              (MCPARAMID)( 7748 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep39_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep39_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep39             (MCPARAMID)( 7749 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep39_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep39_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep39               (MCPARAMID)( 7750 << 14)
+#define MC_AWB_ROI_WRF_1stColRep39_ON              1
+#define MC_AWB_ROI_WRF_1stColRep39_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep39              (MCPARAMID)( 7751 << 14)
+#define MC_AWB_ROI_WRF_LastColRep39_ON             1
+#define MC_AWB_ROI_WRF_LastColRep39_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx39                (MCPARAMID)( 7752 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth39                (MCPARAMID)( 7753 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI39      (MCPARAMID)( 7754 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI39      (MCPARAMID)( 7755 << 14)
+#define MC_AWB_ROI_WRF_Line139                   (MCPARAMID)( 7756 << 14)
+#define MC_AWB_ROI_WRF_Line139_GB                  1
+#define MC_AWB_ROI_WRF_Line139_BG                  2
+#define MC_AWB_ROI_WRF_Line139_RG                  3
+#define MC_AWB_ROI_WRF_Line139_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1039             (MCPARAMID)( 7757 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1139             (MCPARAMID)( 7758 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1239             (MCPARAMID)( 7759 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1339             (MCPARAMID)( 7760 << 14)
+#define MC_AWB_ROI_WRF_TOIheight39               (MCPARAMID)( 7761 << 14)
+#define MC_AWB_ROI_WRF_LastTOI39                 (MCPARAMID)( 7762 << 14)
+#define MC_AWB_ROI_WRF_LastTOI39_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI39_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset39               (MCPARAMID)( 7763 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch39                (MCPARAMID)( 7764 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine39                (MCPARAMID)( 7765 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd39              (MCPARAMID)( 7766 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep40              (MCPARAMID)( 7767 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep40_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep40_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep40             (MCPARAMID)( 7768 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep40_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep40_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep40               (MCPARAMID)( 7769 << 14)
+#define MC_AWB_ROI_WRF_1stColRep40_ON              1
+#define MC_AWB_ROI_WRF_1stColRep40_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep40              (MCPARAMID)( 7770 << 14)
+#define MC_AWB_ROI_WRF_LastColRep40_ON             1
+#define MC_AWB_ROI_WRF_LastColRep40_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx40                (MCPARAMID)( 7771 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth40                (MCPARAMID)( 7772 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI40      (MCPARAMID)( 7773 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI40      (MCPARAMID)( 7774 << 14)
+#define MC_AWB_ROI_WRF_Line140                   (MCPARAMID)( 7775 << 14)
+#define MC_AWB_ROI_WRF_Line140_GB                  1
+#define MC_AWB_ROI_WRF_Line140_BG                  2
+#define MC_AWB_ROI_WRF_Line140_RG                  3
+#define MC_AWB_ROI_WRF_Line140_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1040             (MCPARAMID)( 7776 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1140             (MCPARAMID)( 7777 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1240             (MCPARAMID)( 7778 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1340             (MCPARAMID)( 7779 << 14)
+#define MC_AWB_ROI_WRF_TOIheight40               (MCPARAMID)( 7780 << 14)
+#define MC_AWB_ROI_WRF_LastTOI40                 (MCPARAMID)( 7781 << 14)
+#define MC_AWB_ROI_WRF_LastTOI40_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI40_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset40               (MCPARAMID)( 7782 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch40                (MCPARAMID)( 7783 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine40                (MCPARAMID)( 7784 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd40              (MCPARAMID)( 7785 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep41              (MCPARAMID)( 7786 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep41_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep41_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep41             (MCPARAMID)( 7787 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep41_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep41_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep41               (MCPARAMID)( 7788 << 14)
+#define MC_AWB_ROI_WRF_1stColRep41_ON              1
+#define MC_AWB_ROI_WRF_1stColRep41_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep41              (MCPARAMID)( 7789 << 14)
+#define MC_AWB_ROI_WRF_LastColRep41_ON             1
+#define MC_AWB_ROI_WRF_LastColRep41_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx41                (MCPARAMID)( 7790 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth41                (MCPARAMID)( 7791 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI41      (MCPARAMID)( 7792 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI41      (MCPARAMID)( 7793 << 14)
+#define MC_AWB_ROI_WRF_Line141                   (MCPARAMID)( 7794 << 14)
+#define MC_AWB_ROI_WRF_Line141_GB                  1
+#define MC_AWB_ROI_WRF_Line141_BG                  2
+#define MC_AWB_ROI_WRF_Line141_RG                  3
+#define MC_AWB_ROI_WRF_Line141_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1041             (MCPARAMID)( 7795 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1141             (MCPARAMID)( 7796 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1241             (MCPARAMID)( 7797 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1341             (MCPARAMID)( 7798 << 14)
+#define MC_AWB_ROI_WRF_TOIheight41               (MCPARAMID)( 7799 << 14)
+#define MC_AWB_ROI_WRF_LastTOI41                 (MCPARAMID)( 7800 << 14)
+#define MC_AWB_ROI_WRF_LastTOI41_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI41_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset41               (MCPARAMID)( 7801 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch41                (MCPARAMID)( 7802 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine41                (MCPARAMID)( 7803 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd41              (MCPARAMID)( 7804 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep42              (MCPARAMID)( 7805 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep42_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep42_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep42             (MCPARAMID)( 7806 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep42_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep42_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep42               (MCPARAMID)( 7807 << 14)
+#define MC_AWB_ROI_WRF_1stColRep42_ON              1
+#define MC_AWB_ROI_WRF_1stColRep42_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep42              (MCPARAMID)( 7808 << 14)
+#define MC_AWB_ROI_WRF_LastColRep42_ON             1
+#define MC_AWB_ROI_WRF_LastColRep42_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx42                (MCPARAMID)( 7809 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth42                (MCPARAMID)( 7810 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI42      (MCPARAMID)( 7811 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI42      (MCPARAMID)( 7812 << 14)
+#define MC_AWB_ROI_WRF_Line142                   (MCPARAMID)( 7813 << 14)
+#define MC_AWB_ROI_WRF_Line142_GB                  1
+#define MC_AWB_ROI_WRF_Line142_BG                  2
+#define MC_AWB_ROI_WRF_Line142_RG                  3
+#define MC_AWB_ROI_WRF_Line142_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1042             (MCPARAMID)( 7814 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1142             (MCPARAMID)( 7815 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1242             (MCPARAMID)( 7816 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1342             (MCPARAMID)( 7817 << 14)
+#define MC_AWB_ROI_WRF_TOIheight42               (MCPARAMID)( 7818 << 14)
+#define MC_AWB_ROI_WRF_LastTOI42                 (MCPARAMID)( 7819 << 14)
+#define MC_AWB_ROI_WRF_LastTOI42_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI42_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset42               (MCPARAMID)( 7820 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch42                (MCPARAMID)( 7821 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine42                (MCPARAMID)( 7822 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd42              (MCPARAMID)( 7823 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep43              (MCPARAMID)( 7824 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep43_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep43_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep43             (MCPARAMID)( 7825 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep43_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep43_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep43               (MCPARAMID)( 7826 << 14)
+#define MC_AWB_ROI_WRF_1stColRep43_ON              1
+#define MC_AWB_ROI_WRF_1stColRep43_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep43              (MCPARAMID)( 7827 << 14)
+#define MC_AWB_ROI_WRF_LastColRep43_ON             1
+#define MC_AWB_ROI_WRF_LastColRep43_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx43                (MCPARAMID)( 7828 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth43                (MCPARAMID)( 7829 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI43      (MCPARAMID)( 7830 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI43      (MCPARAMID)( 7831 << 14)
+#define MC_AWB_ROI_WRF_Line143                   (MCPARAMID)( 7832 << 14)
+#define MC_AWB_ROI_WRF_Line143_GB                  1
+#define MC_AWB_ROI_WRF_Line143_BG                  2
+#define MC_AWB_ROI_WRF_Line143_RG                  3
+#define MC_AWB_ROI_WRF_Line143_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1043             (MCPARAMID)( 7833 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1143             (MCPARAMID)( 7834 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1243             (MCPARAMID)( 7835 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1343             (MCPARAMID)( 7836 << 14)
+#define MC_AWB_ROI_WRF_TOIheight43               (MCPARAMID)( 7837 << 14)
+#define MC_AWB_ROI_WRF_LastTOI43                 (MCPARAMID)( 7838 << 14)
+#define MC_AWB_ROI_WRF_LastTOI43_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI43_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset43               (MCPARAMID)( 7839 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch43                (MCPARAMID)( 7840 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine43                (MCPARAMID)( 7841 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd43              (MCPARAMID)( 7842 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep44              (MCPARAMID)( 7843 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep44_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep44_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep44             (MCPARAMID)( 7844 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep44_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep44_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep44               (MCPARAMID)( 7845 << 14)
+#define MC_AWB_ROI_WRF_1stColRep44_ON              1
+#define MC_AWB_ROI_WRF_1stColRep44_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep44              (MCPARAMID)( 7846 << 14)
+#define MC_AWB_ROI_WRF_LastColRep44_ON             1
+#define MC_AWB_ROI_WRF_LastColRep44_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx44                (MCPARAMID)( 7847 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth44                (MCPARAMID)( 7848 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI44      (MCPARAMID)( 7849 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI44      (MCPARAMID)( 7850 << 14)
+#define MC_AWB_ROI_WRF_Line144                   (MCPARAMID)( 7851 << 14)
+#define MC_AWB_ROI_WRF_Line144_GB                  1
+#define MC_AWB_ROI_WRF_Line144_BG                  2
+#define MC_AWB_ROI_WRF_Line144_RG                  3
+#define MC_AWB_ROI_WRF_Line144_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1044             (MCPARAMID)( 7852 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1144             (MCPARAMID)( 7853 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1244             (MCPARAMID)( 7854 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1344             (MCPARAMID)( 7855 << 14)
+#define MC_AWB_ROI_WRF_TOIheight44               (MCPARAMID)( 7856 << 14)
+#define MC_AWB_ROI_WRF_LastTOI44                 (MCPARAMID)( 7857 << 14)
+#define MC_AWB_ROI_WRF_LastTOI44_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI44_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset44               (MCPARAMID)( 7858 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch44                (MCPARAMID)( 7859 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine44                (MCPARAMID)( 7860 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd44              (MCPARAMID)( 7861 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep45              (MCPARAMID)( 7862 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep45_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep45_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep45             (MCPARAMID)( 7863 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep45_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep45_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep45               (MCPARAMID)( 7864 << 14)
+#define MC_AWB_ROI_WRF_1stColRep45_ON              1
+#define MC_AWB_ROI_WRF_1stColRep45_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep45              (MCPARAMID)( 7865 << 14)
+#define MC_AWB_ROI_WRF_LastColRep45_ON             1
+#define MC_AWB_ROI_WRF_LastColRep45_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx45                (MCPARAMID)( 7866 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth45                (MCPARAMID)( 7867 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI45      (MCPARAMID)( 7868 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI45      (MCPARAMID)( 7869 << 14)
+#define MC_AWB_ROI_WRF_Line145                   (MCPARAMID)( 7870 << 14)
+#define MC_AWB_ROI_WRF_Line145_GB                  1
+#define MC_AWB_ROI_WRF_Line145_BG                  2
+#define MC_AWB_ROI_WRF_Line145_RG                  3
+#define MC_AWB_ROI_WRF_Line145_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1045             (MCPARAMID)( 7871 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1145             (MCPARAMID)( 7872 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1245             (MCPARAMID)( 7873 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1345             (MCPARAMID)( 7874 << 14)
+#define MC_AWB_ROI_WRF_TOIheight45               (MCPARAMID)( 7875 << 14)
+#define MC_AWB_ROI_WRF_LastTOI45                 (MCPARAMID)( 7876 << 14)
+#define MC_AWB_ROI_WRF_LastTOI45_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI45_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset45               (MCPARAMID)( 7877 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch45                (MCPARAMID)( 7878 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine45                (MCPARAMID)( 7879 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd45              (MCPARAMID)( 7880 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep46              (MCPARAMID)( 7881 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep46_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep46_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep46             (MCPARAMID)( 7882 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep46_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep46_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep46               (MCPARAMID)( 7883 << 14)
+#define MC_AWB_ROI_WRF_1stColRep46_ON              1
+#define MC_AWB_ROI_WRF_1stColRep46_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep46              (MCPARAMID)( 7884 << 14)
+#define MC_AWB_ROI_WRF_LastColRep46_ON             1
+#define MC_AWB_ROI_WRF_LastColRep46_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx46                (MCPARAMID)( 7885 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth46                (MCPARAMID)( 7886 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI46      (MCPARAMID)( 7887 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI46      (MCPARAMID)( 7888 << 14)
+#define MC_AWB_ROI_WRF_Line146                   (MCPARAMID)( 7889 << 14)
+#define MC_AWB_ROI_WRF_Line146_GB                  1
+#define MC_AWB_ROI_WRF_Line146_BG                  2
+#define MC_AWB_ROI_WRF_Line146_RG                  3
+#define MC_AWB_ROI_WRF_Line146_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1046             (MCPARAMID)( 7890 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1146             (MCPARAMID)( 7891 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1246             (MCPARAMID)( 7892 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1346             (MCPARAMID)( 7893 << 14)
+#define MC_AWB_ROI_WRF_TOIheight46               (MCPARAMID)( 7894 << 14)
+#define MC_AWB_ROI_WRF_LastTOI46                 (MCPARAMID)( 7895 << 14)
+#define MC_AWB_ROI_WRF_LastTOI46_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI46_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset46               (MCPARAMID)( 7896 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch46                (MCPARAMID)( 7897 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine46                (MCPARAMID)( 7898 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd46              (MCPARAMID)( 7899 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep47              (MCPARAMID)( 7900 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep47_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep47_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep47             (MCPARAMID)( 7901 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep47_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep47_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep47               (MCPARAMID)( 7902 << 14)
+#define MC_AWB_ROI_WRF_1stColRep47_ON              1
+#define MC_AWB_ROI_WRF_1stColRep47_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep47              (MCPARAMID)( 7903 << 14)
+#define MC_AWB_ROI_WRF_LastColRep47_ON             1
+#define MC_AWB_ROI_WRF_LastColRep47_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx47                (MCPARAMID)( 7904 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth47                (MCPARAMID)( 7905 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI47      (MCPARAMID)( 7906 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI47      (MCPARAMID)( 7907 << 14)
+#define MC_AWB_ROI_WRF_Line147                   (MCPARAMID)( 7908 << 14)
+#define MC_AWB_ROI_WRF_Line147_GB                  1
+#define MC_AWB_ROI_WRF_Line147_BG                  2
+#define MC_AWB_ROI_WRF_Line147_RG                  3
+#define MC_AWB_ROI_WRF_Line147_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1047             (MCPARAMID)( 7909 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1147             (MCPARAMID)( 7910 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1247             (MCPARAMID)( 7911 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1347             (MCPARAMID)( 7912 << 14)
+#define MC_AWB_ROI_WRF_TOIheight47               (MCPARAMID)( 7913 << 14)
+#define MC_AWB_ROI_WRF_LastTOI47                 (MCPARAMID)( 7914 << 14)
+#define MC_AWB_ROI_WRF_LastTOI47_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI47_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset47               (MCPARAMID)( 7915 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch47                (MCPARAMID)( 7916 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine47                (MCPARAMID)( 7917 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd47              (MCPARAMID)( 7918 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep48              (MCPARAMID)( 7919 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep48_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep48_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep48             (MCPARAMID)( 7920 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep48_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep48_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep48               (MCPARAMID)( 7921 << 14)
+#define MC_AWB_ROI_WRF_1stColRep48_ON              1
+#define MC_AWB_ROI_WRF_1stColRep48_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep48              (MCPARAMID)( 7922 << 14)
+#define MC_AWB_ROI_WRF_LastColRep48_ON             1
+#define MC_AWB_ROI_WRF_LastColRep48_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx48                (MCPARAMID)( 7923 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth48                (MCPARAMID)( 7924 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI48      (MCPARAMID)( 7925 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI48      (MCPARAMID)( 7926 << 14)
+#define MC_AWB_ROI_WRF_Line148                   (MCPARAMID)( 7927 << 14)
+#define MC_AWB_ROI_WRF_Line148_GB                  1
+#define MC_AWB_ROI_WRF_Line148_BG                  2
+#define MC_AWB_ROI_WRF_Line148_RG                  3
+#define MC_AWB_ROI_WRF_Line148_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1048             (MCPARAMID)( 7928 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1148             (MCPARAMID)( 7929 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1248             (MCPARAMID)( 7930 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1348             (MCPARAMID)( 7931 << 14)
+#define MC_AWB_ROI_WRF_TOIheight48               (MCPARAMID)( 7932 << 14)
+#define MC_AWB_ROI_WRF_LastTOI48                 (MCPARAMID)( 7933 << 14)
+#define MC_AWB_ROI_WRF_LastTOI48_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI48_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset48               (MCPARAMID)( 7934 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch48                (MCPARAMID)( 7935 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine48                (MCPARAMID)( 7936 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd48              (MCPARAMID)( 7937 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep49              (MCPARAMID)( 7938 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep49_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep49_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep49             (MCPARAMID)( 7939 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep49_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep49_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep49               (MCPARAMID)( 7940 << 14)
+#define MC_AWB_ROI_WRF_1stColRep49_ON              1
+#define MC_AWB_ROI_WRF_1stColRep49_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep49              (MCPARAMID)( 7941 << 14)
+#define MC_AWB_ROI_WRF_LastColRep49_ON             1
+#define MC_AWB_ROI_WRF_LastColRep49_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx49                (MCPARAMID)( 7942 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth49                (MCPARAMID)( 7943 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI49      (MCPARAMID)( 7944 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI49      (MCPARAMID)( 7945 << 14)
+#define MC_AWB_ROI_WRF_Line149                   (MCPARAMID)( 7946 << 14)
+#define MC_AWB_ROI_WRF_Line149_GB                  1
+#define MC_AWB_ROI_WRF_Line149_BG                  2
+#define MC_AWB_ROI_WRF_Line149_RG                  3
+#define MC_AWB_ROI_WRF_Line149_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1049             (MCPARAMID)( 7947 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1149             (MCPARAMID)( 7948 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1249             (MCPARAMID)( 7949 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1349             (MCPARAMID)( 7950 << 14)
+#define MC_AWB_ROI_WRF_TOIheight49               (MCPARAMID)( 7951 << 14)
+#define MC_AWB_ROI_WRF_LastTOI49                 (MCPARAMID)( 7952 << 14)
+#define MC_AWB_ROI_WRF_LastTOI49_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI49_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset49               (MCPARAMID)( 7953 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch49                (MCPARAMID)( 7954 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine49                (MCPARAMID)( 7955 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd49              (MCPARAMID)( 7956 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep50              (MCPARAMID)( 7957 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep50_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep50_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep50             (MCPARAMID)( 7958 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep50_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep50_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep50               (MCPARAMID)( 7959 << 14)
+#define MC_AWB_ROI_WRF_1stColRep50_ON              1
+#define MC_AWB_ROI_WRF_1stColRep50_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep50              (MCPARAMID)( 7960 << 14)
+#define MC_AWB_ROI_WRF_LastColRep50_ON             1
+#define MC_AWB_ROI_WRF_LastColRep50_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx50                (MCPARAMID)( 7961 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth50                (MCPARAMID)( 7962 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI50      (MCPARAMID)( 7963 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI50      (MCPARAMID)( 7964 << 14)
+#define MC_AWB_ROI_WRF_Line150                   (MCPARAMID)( 7965 << 14)
+#define MC_AWB_ROI_WRF_Line150_GB                  1
+#define MC_AWB_ROI_WRF_Line150_BG                  2
+#define MC_AWB_ROI_WRF_Line150_RG                  3
+#define MC_AWB_ROI_WRF_Line150_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1050             (MCPARAMID)( 7966 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1150             (MCPARAMID)( 7967 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1250             (MCPARAMID)( 7968 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1350             (MCPARAMID)( 7969 << 14)
+#define MC_AWB_ROI_WRF_TOIheight50               (MCPARAMID)( 7970 << 14)
+#define MC_AWB_ROI_WRF_LastTOI50                 (MCPARAMID)( 7971 << 14)
+#define MC_AWB_ROI_WRF_LastTOI50_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI50_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset50               (MCPARAMID)( 7972 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch50                (MCPARAMID)( 7973 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine50                (MCPARAMID)( 7974 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd50              (MCPARAMID)( 7975 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep51              (MCPARAMID)( 7976 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep51_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep51_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep51             (MCPARAMID)( 7977 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep51_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep51_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep51               (MCPARAMID)( 7978 << 14)
+#define MC_AWB_ROI_WRF_1stColRep51_ON              1
+#define MC_AWB_ROI_WRF_1stColRep51_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep51              (MCPARAMID)( 7979 << 14)
+#define MC_AWB_ROI_WRF_LastColRep51_ON             1
+#define MC_AWB_ROI_WRF_LastColRep51_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx51                (MCPARAMID)( 7980 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth51                (MCPARAMID)( 7981 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI51      (MCPARAMID)( 7982 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI51      (MCPARAMID)( 7983 << 14)
+#define MC_AWB_ROI_WRF_Line151                   (MCPARAMID)( 7984 << 14)
+#define MC_AWB_ROI_WRF_Line151_GB                  1
+#define MC_AWB_ROI_WRF_Line151_BG                  2
+#define MC_AWB_ROI_WRF_Line151_RG                  3
+#define MC_AWB_ROI_WRF_Line151_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1051             (MCPARAMID)( 7985 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1151             (MCPARAMID)( 7986 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1251             (MCPARAMID)( 7987 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1351             (MCPARAMID)( 7988 << 14)
+#define MC_AWB_ROI_WRF_TOIheight51               (MCPARAMID)( 7989 << 14)
+#define MC_AWB_ROI_WRF_LastTOI51                 (MCPARAMID)( 7990 << 14)
+#define MC_AWB_ROI_WRF_LastTOI51_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI51_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset51               (MCPARAMID)( 7991 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch51                (MCPARAMID)( 7992 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine51                (MCPARAMID)( 7993 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd51              (MCPARAMID)( 7994 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep52              (MCPARAMID)( 7995 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep52_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep52_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep52             (MCPARAMID)( 7996 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep52_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep52_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep52               (MCPARAMID)( 7997 << 14)
+#define MC_AWB_ROI_WRF_1stColRep52_ON              1
+#define MC_AWB_ROI_WRF_1stColRep52_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep52              (MCPARAMID)( 7998 << 14)
+#define MC_AWB_ROI_WRF_LastColRep52_ON             1
+#define MC_AWB_ROI_WRF_LastColRep52_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx52                (MCPARAMID)( 7999 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth52                (MCPARAMID)( 8000 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI52      (MCPARAMID)( 8001 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI52      (MCPARAMID)( 8002 << 14)
+#define MC_AWB_ROI_WRF_Line152                   (MCPARAMID)( 8003 << 14)
+#define MC_AWB_ROI_WRF_Line152_GB                  1
+#define MC_AWB_ROI_WRF_Line152_BG                  2
+#define MC_AWB_ROI_WRF_Line152_RG                  3
+#define MC_AWB_ROI_WRF_Line152_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1052             (MCPARAMID)( 8004 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1152             (MCPARAMID)( 8005 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1252             (MCPARAMID)( 8006 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1352             (MCPARAMID)( 8007 << 14)
+#define MC_AWB_ROI_WRF_TOIheight52               (MCPARAMID)( 8008 << 14)
+#define MC_AWB_ROI_WRF_LastTOI52                 (MCPARAMID)( 8009 << 14)
+#define MC_AWB_ROI_WRF_LastTOI52_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI52_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset52               (MCPARAMID)( 8010 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch52                (MCPARAMID)( 8011 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine52                (MCPARAMID)( 8012 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd52              (MCPARAMID)( 8013 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep53              (MCPARAMID)( 8014 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep53_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep53_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep53             (MCPARAMID)( 8015 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep53_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep53_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep53               (MCPARAMID)( 8016 << 14)
+#define MC_AWB_ROI_WRF_1stColRep53_ON              1
+#define MC_AWB_ROI_WRF_1stColRep53_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep53              (MCPARAMID)( 8017 << 14)
+#define MC_AWB_ROI_WRF_LastColRep53_ON             1
+#define MC_AWB_ROI_WRF_LastColRep53_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx53                (MCPARAMID)( 8018 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth53                (MCPARAMID)( 8019 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI53      (MCPARAMID)( 8020 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI53      (MCPARAMID)( 8021 << 14)
+#define MC_AWB_ROI_WRF_Line153                   (MCPARAMID)( 8022 << 14)
+#define MC_AWB_ROI_WRF_Line153_GB                  1
+#define MC_AWB_ROI_WRF_Line153_BG                  2
+#define MC_AWB_ROI_WRF_Line153_RG                  3
+#define MC_AWB_ROI_WRF_Line153_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1053             (MCPARAMID)( 8023 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1153             (MCPARAMID)( 8024 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1253             (MCPARAMID)( 8025 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1353             (MCPARAMID)( 8026 << 14)
+#define MC_AWB_ROI_WRF_TOIheight53               (MCPARAMID)( 8027 << 14)
+#define MC_AWB_ROI_WRF_LastTOI53                 (MCPARAMID)( 8028 << 14)
+#define MC_AWB_ROI_WRF_LastTOI53_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI53_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset53               (MCPARAMID)( 8029 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch53                (MCPARAMID)( 8030 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine53                (MCPARAMID)( 8031 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd53              (MCPARAMID)( 8032 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep54              (MCPARAMID)( 8033 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep54_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep54_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep54             (MCPARAMID)( 8034 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep54_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep54_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep54               (MCPARAMID)( 8035 << 14)
+#define MC_AWB_ROI_WRF_1stColRep54_ON              1
+#define MC_AWB_ROI_WRF_1stColRep54_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep54              (MCPARAMID)( 8036 << 14)
+#define MC_AWB_ROI_WRF_LastColRep54_ON             1
+#define MC_AWB_ROI_WRF_LastColRep54_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx54                (MCPARAMID)( 8037 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth54                (MCPARAMID)( 8038 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI54      (MCPARAMID)( 8039 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI54      (MCPARAMID)( 8040 << 14)
+#define MC_AWB_ROI_WRF_Line154                   (MCPARAMID)( 8041 << 14)
+#define MC_AWB_ROI_WRF_Line154_GB                  1
+#define MC_AWB_ROI_WRF_Line154_BG                  2
+#define MC_AWB_ROI_WRF_Line154_RG                  3
+#define MC_AWB_ROI_WRF_Line154_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1054             (MCPARAMID)( 8042 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1154             (MCPARAMID)( 8043 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1254             (MCPARAMID)( 8044 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1354             (MCPARAMID)( 8045 << 14)
+#define MC_AWB_ROI_WRF_TOIheight54               (MCPARAMID)( 8046 << 14)
+#define MC_AWB_ROI_WRF_LastTOI54                 (MCPARAMID)( 8047 << 14)
+#define MC_AWB_ROI_WRF_LastTOI54_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI54_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset54               (MCPARAMID)( 8048 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch54                (MCPARAMID)( 8049 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine54                (MCPARAMID)( 8050 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd54              (MCPARAMID)( 8051 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep55              (MCPARAMID)( 8052 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep55_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep55_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep55             (MCPARAMID)( 8053 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep55_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep55_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep55               (MCPARAMID)( 8054 << 14)
+#define MC_AWB_ROI_WRF_1stColRep55_ON              1
+#define MC_AWB_ROI_WRF_1stColRep55_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep55              (MCPARAMID)( 8055 << 14)
+#define MC_AWB_ROI_WRF_LastColRep55_ON             1
+#define MC_AWB_ROI_WRF_LastColRep55_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx55                (MCPARAMID)( 8056 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth55                (MCPARAMID)( 8057 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI55      (MCPARAMID)( 8058 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI55      (MCPARAMID)( 8059 << 14)
+#define MC_AWB_ROI_WRF_Line155                   (MCPARAMID)( 8060 << 14)
+#define MC_AWB_ROI_WRF_Line155_GB                  1
+#define MC_AWB_ROI_WRF_Line155_BG                  2
+#define MC_AWB_ROI_WRF_Line155_RG                  3
+#define MC_AWB_ROI_WRF_Line155_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1055             (MCPARAMID)( 8061 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1155             (MCPARAMID)( 8062 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1255             (MCPARAMID)( 8063 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1355             (MCPARAMID)( 8064 << 14)
+#define MC_AWB_ROI_WRF_TOIheight55               (MCPARAMID)( 8065 << 14)
+#define MC_AWB_ROI_WRF_LastTOI55                 (MCPARAMID)( 8066 << 14)
+#define MC_AWB_ROI_WRF_LastTOI55_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI55_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset55               (MCPARAMID)( 8067 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch55                (MCPARAMID)( 8068 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine55                (MCPARAMID)( 8069 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd55              (MCPARAMID)( 8070 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep56              (MCPARAMID)( 8071 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep56_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep56_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep56             (MCPARAMID)( 8072 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep56_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep56_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep56               (MCPARAMID)( 8073 << 14)
+#define MC_AWB_ROI_WRF_1stColRep56_ON              1
+#define MC_AWB_ROI_WRF_1stColRep56_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep56              (MCPARAMID)( 8074 << 14)
+#define MC_AWB_ROI_WRF_LastColRep56_ON             1
+#define MC_AWB_ROI_WRF_LastColRep56_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx56                (MCPARAMID)( 8075 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth56                (MCPARAMID)( 8076 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI56      (MCPARAMID)( 8077 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI56      (MCPARAMID)( 8078 << 14)
+#define MC_AWB_ROI_WRF_Line156                   (MCPARAMID)( 8079 << 14)
+#define MC_AWB_ROI_WRF_Line156_GB                  1
+#define MC_AWB_ROI_WRF_Line156_BG                  2
+#define MC_AWB_ROI_WRF_Line156_RG                  3
+#define MC_AWB_ROI_WRF_Line156_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1056             (MCPARAMID)( 8080 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1156             (MCPARAMID)( 8081 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1256             (MCPARAMID)( 8082 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1356             (MCPARAMID)( 8083 << 14)
+#define MC_AWB_ROI_WRF_TOIheight56               (MCPARAMID)( 8084 << 14)
+#define MC_AWB_ROI_WRF_LastTOI56                 (MCPARAMID)( 8085 << 14)
+#define MC_AWB_ROI_WRF_LastTOI56_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI56_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset56               (MCPARAMID)( 8086 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch56                (MCPARAMID)( 8087 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine56                (MCPARAMID)( 8088 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd56              (MCPARAMID)( 8089 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep57              (MCPARAMID)( 8090 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep57_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep57_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep57             (MCPARAMID)( 8091 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep57_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep57_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep57               (MCPARAMID)( 8092 << 14)
+#define MC_AWB_ROI_WRF_1stColRep57_ON              1
+#define MC_AWB_ROI_WRF_1stColRep57_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep57              (MCPARAMID)( 8093 << 14)
+#define MC_AWB_ROI_WRF_LastColRep57_ON             1
+#define MC_AWB_ROI_WRF_LastColRep57_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx57                (MCPARAMID)( 8094 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth57                (MCPARAMID)( 8095 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI57      (MCPARAMID)( 8096 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI57      (MCPARAMID)( 8097 << 14)
+#define MC_AWB_ROI_WRF_Line157                   (MCPARAMID)( 8098 << 14)
+#define MC_AWB_ROI_WRF_Line157_GB                  1
+#define MC_AWB_ROI_WRF_Line157_BG                  2
+#define MC_AWB_ROI_WRF_Line157_RG                  3
+#define MC_AWB_ROI_WRF_Line157_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1057             (MCPARAMID)( 8099 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1157             (MCPARAMID)( 8100 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1257             (MCPARAMID)( 8101 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1357             (MCPARAMID)( 8102 << 14)
+#define MC_AWB_ROI_WRF_TOIheight57               (MCPARAMID)( 8103 << 14)
+#define MC_AWB_ROI_WRF_LastTOI57                 (MCPARAMID)( 8104 << 14)
+#define MC_AWB_ROI_WRF_LastTOI57_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI57_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset57               (MCPARAMID)( 8105 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch57                (MCPARAMID)( 8106 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine57                (MCPARAMID)( 8107 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd57              (MCPARAMID)( 8108 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep58              (MCPARAMID)( 8109 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep58_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep58_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep58             (MCPARAMID)( 8110 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep58_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep58_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep58               (MCPARAMID)( 8111 << 14)
+#define MC_AWB_ROI_WRF_1stColRep58_ON              1
+#define MC_AWB_ROI_WRF_1stColRep58_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep58              (MCPARAMID)( 8112 << 14)
+#define MC_AWB_ROI_WRF_LastColRep58_ON             1
+#define MC_AWB_ROI_WRF_LastColRep58_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx58                (MCPARAMID)( 8113 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth58                (MCPARAMID)( 8114 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI58      (MCPARAMID)( 8115 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI58      (MCPARAMID)( 8116 << 14)
+#define MC_AWB_ROI_WRF_Line158                   (MCPARAMID)( 8117 << 14)
+#define MC_AWB_ROI_WRF_Line158_GB                  1
+#define MC_AWB_ROI_WRF_Line158_BG                  2
+#define MC_AWB_ROI_WRF_Line158_RG                  3
+#define MC_AWB_ROI_WRF_Line158_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1058             (MCPARAMID)( 8118 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1158             (MCPARAMID)( 8119 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1258             (MCPARAMID)( 8120 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1358             (MCPARAMID)( 8121 << 14)
+#define MC_AWB_ROI_WRF_TOIheight58               (MCPARAMID)( 8122 << 14)
+#define MC_AWB_ROI_WRF_LastTOI58                 (MCPARAMID)( 8123 << 14)
+#define MC_AWB_ROI_WRF_LastTOI58_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI58_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset58               (MCPARAMID)( 8124 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch58                (MCPARAMID)( 8125 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine58                (MCPARAMID)( 8126 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd58              (MCPARAMID)( 8127 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep59              (MCPARAMID)( 8128 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep59_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep59_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep59             (MCPARAMID)( 8129 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep59_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep59_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep59               (MCPARAMID)( 8130 << 14)
+#define MC_AWB_ROI_WRF_1stColRep59_ON              1
+#define MC_AWB_ROI_WRF_1stColRep59_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep59              (MCPARAMID)( 8131 << 14)
+#define MC_AWB_ROI_WRF_LastColRep59_ON             1
+#define MC_AWB_ROI_WRF_LastColRep59_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx59                (MCPARAMID)( 8132 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth59                (MCPARAMID)( 8133 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI59      (MCPARAMID)( 8134 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI59      (MCPARAMID)( 8135 << 14)
+#define MC_AWB_ROI_WRF_Line159                   (MCPARAMID)( 8136 << 14)
+#define MC_AWB_ROI_WRF_Line159_GB                  1
+#define MC_AWB_ROI_WRF_Line159_BG                  2
+#define MC_AWB_ROI_WRF_Line159_RG                  3
+#define MC_AWB_ROI_WRF_Line159_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1059             (MCPARAMID)( 8137 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1159             (MCPARAMID)( 8138 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1259             (MCPARAMID)( 8139 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1359             (MCPARAMID)( 8140 << 14)
+#define MC_AWB_ROI_WRF_TOIheight59               (MCPARAMID)( 8141 << 14)
+#define MC_AWB_ROI_WRF_LastTOI59                 (MCPARAMID)( 8142 << 14)
+#define MC_AWB_ROI_WRF_LastTOI59_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI59_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset59               (MCPARAMID)( 8143 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch59                (MCPARAMID)( 8144 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine59                (MCPARAMID)( 8145 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd59              (MCPARAMID)( 8146 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep60              (MCPARAMID)( 8147 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep60_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep60_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep60             (MCPARAMID)( 8148 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep60_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep60_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep60               (MCPARAMID)( 8149 << 14)
+#define MC_AWB_ROI_WRF_1stColRep60_ON              1
+#define MC_AWB_ROI_WRF_1stColRep60_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep60              (MCPARAMID)( 8150 << 14)
+#define MC_AWB_ROI_WRF_LastColRep60_ON             1
+#define MC_AWB_ROI_WRF_LastColRep60_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx60                (MCPARAMID)( 8151 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth60                (MCPARAMID)( 8152 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI60      (MCPARAMID)( 8153 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI60      (MCPARAMID)( 8154 << 14)
+#define MC_AWB_ROI_WRF_Line160                   (MCPARAMID)( 8155 << 14)
+#define MC_AWB_ROI_WRF_Line160_GB                  1
+#define MC_AWB_ROI_WRF_Line160_BG                  2
+#define MC_AWB_ROI_WRF_Line160_RG                  3
+#define MC_AWB_ROI_WRF_Line160_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1060             (MCPARAMID)( 8156 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1160             (MCPARAMID)( 8157 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1260             (MCPARAMID)( 8158 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1360             (MCPARAMID)( 8159 << 14)
+#define MC_AWB_ROI_WRF_TOIheight60               (MCPARAMID)( 8160 << 14)
+#define MC_AWB_ROI_WRF_LastTOI60                 (MCPARAMID)( 8161 << 14)
+#define MC_AWB_ROI_WRF_LastTOI60_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI60_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset60               (MCPARAMID)( 8162 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch60                (MCPARAMID)( 8163 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine60                (MCPARAMID)( 8164 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd60              (MCPARAMID)( 8165 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep61              (MCPARAMID)( 8166 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep61_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep61_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep61             (MCPARAMID)( 8167 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep61_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep61_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep61               (MCPARAMID)( 8168 << 14)
+#define MC_AWB_ROI_WRF_1stColRep61_ON              1
+#define MC_AWB_ROI_WRF_1stColRep61_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep61              (MCPARAMID)( 8169 << 14)
+#define MC_AWB_ROI_WRF_LastColRep61_ON             1
+#define MC_AWB_ROI_WRF_LastColRep61_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx61                (MCPARAMID)( 8170 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth61                (MCPARAMID)( 8171 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI61      (MCPARAMID)( 8172 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI61      (MCPARAMID)( 8173 << 14)
+#define MC_AWB_ROI_WRF_Line161                   (MCPARAMID)( 8174 << 14)
+#define MC_AWB_ROI_WRF_Line161_GB                  1
+#define MC_AWB_ROI_WRF_Line161_BG                  2
+#define MC_AWB_ROI_WRF_Line161_RG                  3
+#define MC_AWB_ROI_WRF_Line161_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1061             (MCPARAMID)( 8175 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1161             (MCPARAMID)( 8176 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1261             (MCPARAMID)( 8177 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1361             (MCPARAMID)( 8178 << 14)
+#define MC_AWB_ROI_WRF_TOIheight61               (MCPARAMID)( 8179 << 14)
+#define MC_AWB_ROI_WRF_LastTOI61                 (MCPARAMID)( 8180 << 14)
+#define MC_AWB_ROI_WRF_LastTOI61_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI61_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset61               (MCPARAMID)( 8181 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch61                (MCPARAMID)( 8182 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine61                (MCPARAMID)( 8183 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd61              (MCPARAMID)( 8184 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep62              (MCPARAMID)( 8185 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep62_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep62_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep62             (MCPARAMID)( 8186 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep62_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep62_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep62               (MCPARAMID)( 8187 << 14)
+#define MC_AWB_ROI_WRF_1stColRep62_ON              1
+#define MC_AWB_ROI_WRF_1stColRep62_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep62              (MCPARAMID)( 8188 << 14)
+#define MC_AWB_ROI_WRF_LastColRep62_ON             1
+#define MC_AWB_ROI_WRF_LastColRep62_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx62                (MCPARAMID)( 8189 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth62                (MCPARAMID)( 8190 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI62      (MCPARAMID)( 8191 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI62      (MCPARAMID)( 8192 << 14)
+#define MC_AWB_ROI_WRF_Line162                   (MCPARAMID)( 8193 << 14)
+#define MC_AWB_ROI_WRF_Line162_GB                  1
+#define MC_AWB_ROI_WRF_Line162_BG                  2
+#define MC_AWB_ROI_WRF_Line162_RG                  3
+#define MC_AWB_ROI_WRF_Line162_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1062             (MCPARAMID)( 8194 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1162             (MCPARAMID)( 8195 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1262             (MCPARAMID)( 8196 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1362             (MCPARAMID)( 8197 << 14)
+#define MC_AWB_ROI_WRF_TOIheight62               (MCPARAMID)( 8198 << 14)
+#define MC_AWB_ROI_WRF_LastTOI62                 (MCPARAMID)( 8199 << 14)
+#define MC_AWB_ROI_WRF_LastTOI62_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI62_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset62               (MCPARAMID)( 8200 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch62                (MCPARAMID)( 8201 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine62                (MCPARAMID)( 8202 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd62              (MCPARAMID)( 8203 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep63              (MCPARAMID)( 8204 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep63_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep63_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep63             (MCPARAMID)( 8205 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep63_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep63_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep63               (MCPARAMID)( 8206 << 14)
+#define MC_AWB_ROI_WRF_1stColRep63_ON              1
+#define MC_AWB_ROI_WRF_1stColRep63_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep63              (MCPARAMID)( 8207 << 14)
+#define MC_AWB_ROI_WRF_LastColRep63_ON             1
+#define MC_AWB_ROI_WRF_LastColRep63_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx63                (MCPARAMID)( 8208 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth63                (MCPARAMID)( 8209 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI63      (MCPARAMID)( 8210 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI63      (MCPARAMID)( 8211 << 14)
+#define MC_AWB_ROI_WRF_Line163                   (MCPARAMID)( 8212 << 14)
+#define MC_AWB_ROI_WRF_Line163_GB                  1
+#define MC_AWB_ROI_WRF_Line163_BG                  2
+#define MC_AWB_ROI_WRF_Line163_RG                  3
+#define MC_AWB_ROI_WRF_Line163_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1063             (MCPARAMID)( 8213 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1163             (MCPARAMID)( 8214 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1263             (MCPARAMID)( 8215 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1363             (MCPARAMID)( 8216 << 14)
+#define MC_AWB_ROI_WRF_TOIheight63               (MCPARAMID)( 8217 << 14)
+#define MC_AWB_ROI_WRF_LastTOI63                 (MCPARAMID)( 8218 << 14)
+#define MC_AWB_ROI_WRF_LastTOI63_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI63_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset63               (MCPARAMID)( 8219 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch63                (MCPARAMID)( 8220 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine63                (MCPARAMID)( 8221 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd63              (MCPARAMID)( 8222 << 14)
+#define MC_XF_TOI_USR_Check                      (MCPARAMID)( 8223 << 14)
+#define MC_XF_TOI_USR_Check_PASS                   1
+#define MC_XF_TOI_USR_Check_FAIL                   2
+#define MC_AWB_TOI_USR_Check                     (MCPARAMID)( 8224 << 14)
+#define MC_AWB_TOI_USR_Check_PASS                  1
+#define MC_AWB_TOI_USR_Check_FAIL                  2
+#define MC_WBO_AREA_Check                        (MCPARAMID)( 8225 << 14)
+#define MC_WBO_AREA_Check_PASS                     1
+#define MC_WBO_AREA_Check_FAIL                     2
+#define MC_AWB_ROI_TOI_USR_Check                 (MCPARAMID)( 8226 << 14)
+#define MC_AWB_ROI_TOI_USR_Check_PASS              1
+#define MC_AWB_ROI_TOI_USR_Check_FAIL              2
+#define MC_WBO_ROI_Check                         (MCPARAMID)( 8227 << 14)
+#define MC_WBO_ROI_Check_PASS                      1
+#define MC_WBO_ROI_Check_FAIL                      2
+#define MC_XF_ROI_TOI_USR_Check                  (MCPARAMID)( 8228 << 14)
+#define MC_XF_ROI_TOI_USR_Check_PASS               1
+#define MC_XF_ROI_TOI_USR_Check_FAIL               2
+#define MC_CLCAM_ReadoutDelay                    (MCPARAMID)( 8229 << 14)
+#define MC_LUT_SlicingDefSize                    (MCPARAMID)( 8230 << 14)
+#define MC_LUT_Reload                            (MCPARAMID)( 8231 << 14)
+#define MC_TOI_FSR_Alignment                     (MCPARAMID)( 8232 << 14)
+#define MC_MaxSpeedLimiter                       (MCPARAMID)( 8233 << 14)
+#define MC_MaxSpeedLimiter_OFF                     1
+#define MC_MaxSpeedLimiter_ON                      2
+#define MC_MaxCamerateRateLimiter                (MCPARAMID)( 8234 << 14)
+#define MC_MaxCamerateRateLimiter_OFF              1
+#define MC_MaxCamerateRateLimiter_ON               2
+#define MC_SpeedLimit                            (MCPARAMID)( 8235 << 14)
+#define MC_SpeedLimit_CAMERA                       1
+#define MC__CameraPeriod_Min_us                  (MCPARAMID)( 8236 << 14)
+#define MC__PGPeriod_Min_us                      (MCPARAMID)( 8237 << 14)
+#define MC_SpeedLimitSpecifier                   (MCPARAMID)( 8238 << 14)
+#define MC_SpeedLimitSpecifier_CAMERA              1
+#define MC_SpeedLimitSpecifier_USER                2
+#define MC_SpeedLimitSpecifier_BOTH                3
+#define MC_MaxSpeedOptimal                       (MCPARAMID)( 8239 << 14)
+#define MC_UpperSpeedLimitSpecifier              (MCPARAMID)( 8240 << 14)
+#define MC_UpperSpeedLimitSpecifier_CAMERA         1
+#define MC_UpperSpeedLimitSpecifier_USER           2
+#define MC_UpperSpeedLimitSpecifier_BOTH           3
+#define MC__CameraPeriod_Min_PG                  (MCPARAMID)( 8241 << 14)
+#define MC__UserDefinedPeriod_Min_PG             (MCPARAMID)( 8242 << 14)
+#define MC_MinSpeed_Float                        (MCPARAMID)( 8243 << 14)
+#define MC__TrimmedKeff_Float                    (MCPARAMID)( 8244 << 14)
+#define MC__TrimmedKeff                          (MCPARAMID)( 8245 << 14)
+#define MC_EncoderMaxSpeedEffective              (MCPARAMID)( 8246 << 14)
+#define MC_EncoderMinSpeed                       (MCPARAMID)( 8247 << 14)
+#define MC__TrimmedK_Max                         (MCPARAMID)( 8248 << 14)
+#define MC__TrimmedK_Min                         (MCPARAMID)( 8249 << 14)
+#define MC__K_Ratio                              (MCPARAMID)( 8250 << 14)
+#define MC__M_Ratio_Float                        (MCPARAMID)( 8251 << 14)
+#define MC_GWPlaneSizeX                          (MCPARAMID)( 8252 << 14)
+#define MC__BackEndCtrl                          (MCPARAMID)( 8253 << 14)
+#define MC__BackEndCtrl_TwoStroke                  1
+#define MC__BackEndCtrl_OnTheFly                   2
+#define MC__BackEndCtrlMode                      (MCPARAMID)( 8254 << 14)
+#define MC__BackEndCtrlMode_TwoStroke              1
+#define MC__BackEndCtrlMode_OnTheFly               2
+#define MC_GrabberErrors                         (MCPARAMID)( 8255 << 14)
+#define MC_GrabberOverruns                       (MCPARAMID)( 8256 << 14)
+#define MC__AMAX                                 (MCPARAMID)( 8257 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin0           (MCPARAMID)( 8258 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width0                (MCPARAMID)( 8259 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin1           (MCPARAMID)( 8260 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width1                (MCPARAMID)( 8261 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin2           (MCPARAMID)( 8262 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width2                (MCPARAMID)( 8263 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin3           (MCPARAMID)( 8264 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width3                (MCPARAMID)( 8265 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin4           (MCPARAMID)( 8266 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width4                (MCPARAMID)( 8267 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin5           (MCPARAMID)( 8268 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width5                (MCPARAMID)( 8269 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin6           (MCPARAMID)( 8270 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width6                (MCPARAMID)( 8271 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin7           (MCPARAMID)( 8272 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width7                (MCPARAMID)( 8273 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin8           (MCPARAMID)( 8274 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width8                (MCPARAMID)( 8275 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin9           (MCPARAMID)( 8276 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width9                (MCPARAMID)( 8277 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin10          (MCPARAMID)( 8278 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width10               (MCPARAMID)( 8279 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin11          (MCPARAMID)( 8280 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width11               (MCPARAMID)( 8281 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin12          (MCPARAMID)( 8282 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width12               (MCPARAMID)( 8283 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin13          (MCPARAMID)( 8284 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width13               (MCPARAMID)( 8285 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin14          (MCPARAMID)( 8286 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width14               (MCPARAMID)( 8287 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin15          (MCPARAMID)( 8288 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width15               (MCPARAMID)( 8289 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin16          (MCPARAMID)( 8290 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width16               (MCPARAMID)( 8291 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin17          (MCPARAMID)( 8292 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width17               (MCPARAMID)( 8293 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin18          (MCPARAMID)( 8294 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width18               (MCPARAMID)( 8295 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin19          (MCPARAMID)( 8296 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width19               (MCPARAMID)( 8297 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin20          (MCPARAMID)( 8298 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width20               (MCPARAMID)( 8299 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin21          (MCPARAMID)( 8300 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width21               (MCPARAMID)( 8301 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin22          (MCPARAMID)( 8302 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width22               (MCPARAMID)( 8303 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin23          (MCPARAMID)( 8304 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width23               (MCPARAMID)( 8305 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin24          (MCPARAMID)( 8306 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width24               (MCPARAMID)( 8307 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin25          (MCPARAMID)( 8308 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width25               (MCPARAMID)( 8309 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin26          (MCPARAMID)( 8310 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width26               (MCPARAMID)( 8311 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin27          (MCPARAMID)( 8312 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width27               (MCPARAMID)( 8313 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin28          (MCPARAMID)( 8314 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width28               (MCPARAMID)( 8315 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin29          (MCPARAMID)( 8316 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width29               (MCPARAMID)( 8317 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin30          (MCPARAMID)( 8318 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width30               (MCPARAMID)( 8319 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin31          (MCPARAMID)( 8320 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width31               (MCPARAMID)( 8321 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration0         (MCPARAMID)( 8322 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration0_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration0_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration0_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration0_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration1         (MCPARAMID)( 8323 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration1_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration1_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration1_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration1_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration2         (MCPARAMID)( 8324 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration2_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration2_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration2_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration2_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration3         (MCPARAMID)( 8325 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration3_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration3_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration3_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration3_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration4         (MCPARAMID)( 8326 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration4_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration4_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration4_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration4_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration5         (MCPARAMID)( 8327 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration5_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration5_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration5_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration5_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration6         (MCPARAMID)( 8328 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration6_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration6_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration6_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration6_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration7         (MCPARAMID)( 8329 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration7_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration7_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration7_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration7_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration8         (MCPARAMID)( 8330 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration8_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration8_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration8_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration8_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration9         (MCPARAMID)( 8331 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration9_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration9_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration9_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration9_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration10        (MCPARAMID)( 8332 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration10_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration10_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration10_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration10_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration11        (MCPARAMID)( 8333 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration11_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration11_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration11_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration11_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration12        (MCPARAMID)( 8334 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration12_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration12_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration12_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration12_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration13        (MCPARAMID)( 8335 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration13_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration13_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration13_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration13_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration14        (MCPARAMID)( 8336 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration14_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration14_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration14_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration14_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration15        (MCPARAMID)( 8337 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration15_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration15_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration15_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration15_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration16        (MCPARAMID)( 8338 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration16_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration16_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration16_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration16_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration17        (MCPARAMID)( 8339 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration17_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration17_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration17_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration17_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration18        (MCPARAMID)( 8340 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration18_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration18_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration18_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration18_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration19        (MCPARAMID)( 8341 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration19_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration19_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration19_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration19_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration20        (MCPARAMID)( 8342 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration20_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration20_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration20_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration20_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration21        (MCPARAMID)( 8343 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration21_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration21_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration21_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration21_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration22        (MCPARAMID)( 8344 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration22_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration22_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration22_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration22_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration23        (MCPARAMID)( 8345 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration23_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration23_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration23_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration23_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration24        (MCPARAMID)( 8346 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration24_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration24_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration24_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration24_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration25        (MCPARAMID)( 8347 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration25_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration25_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration25_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration25_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration26        (MCPARAMID)( 8348 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration26_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration26_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration26_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration26_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration27        (MCPARAMID)( 8349 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration27_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration27_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration27_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration27_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration28        (MCPARAMID)( 8350 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration28_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration28_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration28_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration28_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration29        (MCPARAMID)( 8351 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration29_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration29_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration29_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration29_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration30        (MCPARAMID)( 8352 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration30_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration30_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration30_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration30_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration31        (MCPARAMID)( 8353 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration31_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration31_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration31_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration31_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration0        (MCPARAMID)( 8354 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration0_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration0_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration0_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration0_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration1        (MCPARAMID)( 8355 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration1_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration1_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration1_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration1_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration2        (MCPARAMID)( 8356 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration2_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration2_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration2_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration2_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration3        (MCPARAMID)( 8357 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration3_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration3_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration3_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration3_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration4        (MCPARAMID)( 8358 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration4_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration4_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration4_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration4_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration5        (MCPARAMID)( 8359 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration5_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration5_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration5_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration5_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration6        (MCPARAMID)( 8360 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration6_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration6_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration6_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration6_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration7        (MCPARAMID)( 8361 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration7_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration7_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration7_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration7_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration8        (MCPARAMID)( 8362 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration8_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration8_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration8_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration8_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration9        (MCPARAMID)( 8363 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration9_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration9_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration9_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration9_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration10       (MCPARAMID)( 8364 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration10_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration10_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration10_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration10_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration11       (MCPARAMID)( 8365 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration11_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration11_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration11_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration11_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration12       (MCPARAMID)( 8366 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration12_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration12_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration12_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration12_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration13       (MCPARAMID)( 8367 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration13_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration13_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration13_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration13_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration14       (MCPARAMID)( 8368 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration14_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration14_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration14_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration14_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration15       (MCPARAMID)( 8369 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration15_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration15_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration15_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration15_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration16       (MCPARAMID)( 8370 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration16_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration16_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration16_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration16_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration17       (MCPARAMID)( 8371 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration17_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration17_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration17_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration17_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration18       (MCPARAMID)( 8372 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration18_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration18_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration18_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration18_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration19       (MCPARAMID)( 8373 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration19_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration19_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration19_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration19_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration20       (MCPARAMID)( 8374 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration20_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration20_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration20_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration20_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration21       (MCPARAMID)( 8375 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration21_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration21_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration21_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration21_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration22       (MCPARAMID)( 8376 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration22_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration22_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration22_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration22_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration23       (MCPARAMID)( 8377 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration23_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration23_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration23_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration23_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration24       (MCPARAMID)( 8378 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration24_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration24_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration24_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration24_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration25       (MCPARAMID)( 8379 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration25_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration25_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration25_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration25_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration26       (MCPARAMID)( 8380 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration26_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration26_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration26_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration26_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration27       (MCPARAMID)( 8381 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration27_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration27_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration27_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration27_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration28       (MCPARAMID)( 8382 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration28_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration28_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration28_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration28_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration29       (MCPARAMID)( 8383 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration29_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration29_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration29_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration29_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration30       (MCPARAMID)( 8384 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration30_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration30_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration30_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration30_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration31       (MCPARAMID)( 8385 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration31_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration31_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration31_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration31_GR      4
+#define MC_XF_ROI_TOI_XFR_NextX_Px               (MCPARAMID)( 8386 << 14)
+#define MC_XF_ROI_TOI_XFR_NextY_Ln               (MCPARAMID)( 8387 << 14)
+#define MC_XF_ROI_TOI_EXT_RightX_Px              (MCPARAMID)( 8388 << 14)
+#define MC_XF_ROI_TOI_EXT_NextY_Ln               (MCPARAMID)( 8389 << 14)
+#define MC_XF_ROI_TOI_FSR_NextX                  (MCPARAMID)( 8390 << 14)
+#define MC_AWB_ROI_TOI_EXT_RightX_Px             (MCPARAMID)( 8391 << 14)
+#define MC_AWB_ROI_TOI_EXT_NextY_Ln              (MCPARAMID)( 8392 << 14)
+#define MC_AWB_ROI_TOI_FSR_NextX                 (MCPARAMID)( 8393 << 14)
+#define MC_XF_ROI_TOI_EXT_NextX_Px               (MCPARAMID)( 8394 << 14)
+#define MC_AWB_ROI_TOI_EXT_NextX_Px              (MCPARAMID)( 8395 << 14)
+#define MC_LiveSimRun                            (MCPARAMID)( 8396 << 14)
+#define MC_LiveSimRun_LIVE                         1
+#define MC_LiveSimRun_SIM                          2
+#define MC_AWB_ROI_TOI_REF_EndX_Px               (MCPARAMID)( 8397 << 14)
+#define MC_TOI_XFR_Granularity_IPx               (MCPARAMID)( 8398 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgX_IPx               (MCPARAMID)( 8399 << 14)
+#define MC_XF_ROI_TOI_XFR_NextX_IPx              (MCPARAMID)( 8400 << 14)
+#define MC_XF_ROI_TOI_XFR_Width_IPx              (MCPARAMID)( 8401 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeX_IPx          (MCPARAMID)( 8402 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetX_IPx        (MCPARAMID)( 8403 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetX_IPx      (MCPARAMID)( 8404 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgY_ILn               (MCPARAMID)( 8405 << 14)
+#define MC_XF_ROI_TOI_XFR_NextY_ILn              (MCPARAMID)( 8406 << 14)
+#define MC_XF_ROI_TOI_XFR_Height_ILn             (MCPARAMID)( 8407 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeY_ILn          (MCPARAMID)( 8408 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetY_ILn        (MCPARAMID)( 8409 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetY_ILn      (MCPARAMID)( 8410 << 14)
+#define MC_ImageYStep_ILn                        (MCPARAMID)( 8411 << 14)
+#define MC_OutputFormatterConfig_RGB10_10_10      45
+#define MC_OutputFormatterConfig_RGB10_12_10      46
+#define MC_ColorFormat_RGB10_10_10               105
+#define MC_ColorFormat_RGB10_12_10               106
+#define MC_AWSizeX_Px                            (MCPARAMID)( 8412 << 14)
+#define MC_AWSizeY_Ln                            (MCPARAMID)( 8413 << 14)
+#define MC_AWColorRegistrationX                  (MCPARAMID)( 8414 << 14)
+#define MC_AWColorRegistrationY                  (MCPARAMID)( 8415 << 14)
+#define MC_AWPlaneSizeX                          (MCPARAMID)( 8416 << 14)
+#define MC_GWOrgX_Px                             (MCPARAMID)( 8417 << 14)
+#define MC_GWOrgY_Ln                             (MCPARAMID)( 8418 << 14)
+#define MC_ImageSizeX_MinBound                   (MCPARAMID)( 8419 << 14)
+#define MC_ImageSizeX_MaxBound                   (MCPARAMID)( 8420 << 14)
+#define MC_ImageSizeY_MinBound                   (MCPARAMID)( 8421 << 14)
+#define MC_ImageSizeY_MaxBound                   (MCPARAMID)( 8422 << 14)
+#define MC_Bidon                                 (MCPARAMID)( 8423 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd0               (MCPARAMID)( 8424 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd1               (MCPARAMID)( 8425 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd2               (MCPARAMID)( 8426 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd3               (MCPARAMID)( 8427 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd4               (MCPARAMID)( 8428 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd5               (MCPARAMID)( 8429 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd6               (MCPARAMID)( 8430 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd7               (MCPARAMID)( 8431 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd8               (MCPARAMID)( 8432 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd9               (MCPARAMID)( 8433 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd10              (MCPARAMID)( 8434 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd11              (MCPARAMID)( 8435 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd12              (MCPARAMID)( 8436 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd13              (MCPARAMID)( 8437 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd14              (MCPARAMID)( 8438 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd15              (MCPARAMID)( 8439 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd16              (MCPARAMID)( 8440 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd17              (MCPARAMID)( 8441 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd18              (MCPARAMID)( 8442 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd19              (MCPARAMID)( 8443 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd20              (MCPARAMID)( 8444 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd21              (MCPARAMID)( 8445 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd22              (MCPARAMID)( 8446 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd23              (MCPARAMID)( 8447 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd24              (MCPARAMID)( 8448 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd25              (MCPARAMID)( 8449 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd26              (MCPARAMID)( 8450 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd27              (MCPARAMID)( 8451 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd28              (MCPARAMID)( 8452 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd29              (MCPARAMID)( 8453 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd30              (MCPARAMID)( 8454 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd31              (MCPARAMID)( 8455 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd0                (MCPARAMID)( 8456 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd1                (MCPARAMID)( 8457 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd2                (MCPARAMID)( 8458 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd3                (MCPARAMID)( 8459 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd4                (MCPARAMID)( 8460 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd5                (MCPARAMID)( 8461 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd6                (MCPARAMID)( 8462 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd7                (MCPARAMID)( 8463 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd8                (MCPARAMID)( 8464 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd9                (MCPARAMID)( 8465 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd10               (MCPARAMID)( 8466 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd11               (MCPARAMID)( 8467 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd12               (MCPARAMID)( 8468 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd13               (MCPARAMID)( 8469 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd14               (MCPARAMID)( 8470 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd15               (MCPARAMID)( 8471 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd16               (MCPARAMID)( 8472 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd17               (MCPARAMID)( 8473 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd18               (MCPARAMID)( 8474 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd19               (MCPARAMID)( 8475 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd20               (MCPARAMID)( 8476 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd21               (MCPARAMID)( 8477 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd22               (MCPARAMID)( 8478 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd23               (MCPARAMID)( 8479 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd24               (MCPARAMID)( 8480 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd25               (MCPARAMID)( 8481 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd26               (MCPARAMID)( 8482 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd27               (MCPARAMID)( 8483 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd28               (MCPARAMID)( 8484 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd29               (MCPARAMID)( 8485 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd30               (MCPARAMID)( 8486 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd31               (MCPARAMID)( 8487 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd0               (MCPARAMID)( 8488 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd1               (MCPARAMID)( 8489 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd2               (MCPARAMID)( 8490 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd3               (MCPARAMID)( 8491 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd4               (MCPARAMID)( 8492 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd5               (MCPARAMID)( 8493 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd6               (MCPARAMID)( 8494 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd7               (MCPARAMID)( 8495 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd8               (MCPARAMID)( 8496 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd9               (MCPARAMID)( 8497 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd10              (MCPARAMID)( 8498 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd11              (MCPARAMID)( 8499 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd12              (MCPARAMID)( 8500 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd13              (MCPARAMID)( 8501 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd14              (MCPARAMID)( 8502 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd15              (MCPARAMID)( 8503 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd16              (MCPARAMID)( 8504 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd17              (MCPARAMID)( 8505 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd18              (MCPARAMID)( 8506 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd19              (MCPARAMID)( 8507 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd20              (MCPARAMID)( 8508 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd21              (MCPARAMID)( 8509 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd22              (MCPARAMID)( 8510 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd23              (MCPARAMID)( 8511 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd24              (MCPARAMID)( 8512 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd25              (MCPARAMID)( 8513 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd26              (MCPARAMID)( 8514 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd27              (MCPARAMID)( 8515 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd28              (MCPARAMID)( 8516 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd29              (MCPARAMID)( 8517 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd30              (MCPARAMID)( 8518 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd31              (MCPARAMID)( 8519 << 14)
+#define MC_XF_ROI_WRF_XferSizeM10_xx_            (MCPARAMID)( 8520 << 14)
+#define MC_XF_ROI_WRF_XferSizeM11_xx_            (MCPARAMID)( 8521 << 14)
+#define MC_XF_ROI_WRF_XferSizeM12_xx_            (MCPARAMID)( 8522 << 14)
+#define MC_XF_ROI_WRF_XferSizeM13_xx_            (MCPARAMID)( 8523 << 14)
+#define MC_XF_ROI_XFR_OrgX_IPx                   (MCPARAMID)( 8524 << 14)
+#define MC_XF_ROI_XFR_NextX_IPx                  (MCPARAMID)( 8525 << 14)
+#define MC__Effective_Window_OrgX_Px             (MCPARAMID)( 8526 << 14)
+#define MC_OffsetX_Trim                          (MCPARAMID)( 8527 << 14)
+#define MC_Test_Error                            (MCPARAMID)( 8528 << 14)
+#define MC_Test_Overrun                          (MCPARAMID)( 8529 << 14)
+#define MC_OffsetX_Effective_Px                  (MCPARAMID)( 8530 << 14)
+#define MC_Window_OrgX_Effective_Px              (MCPARAMID)( 8531 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration32        (MCPARAMID)( 8532 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration32_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration32_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration32_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration32_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd32               (MCPARAMID)( 8533 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration33        (MCPARAMID)( 8534 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration33_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration33_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration33_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration33_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd33               (MCPARAMID)( 8535 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration34        (MCPARAMID)( 8536 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration34_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration34_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration34_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration34_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd34               (MCPARAMID)( 8537 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration35        (MCPARAMID)( 8538 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration35_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration35_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration35_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration35_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd35               (MCPARAMID)( 8539 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration36        (MCPARAMID)( 8540 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration36_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration36_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration36_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration36_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd36               (MCPARAMID)( 8541 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration37        (MCPARAMID)( 8542 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration37_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration37_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration37_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration37_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd37               (MCPARAMID)( 8543 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration38        (MCPARAMID)( 8544 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration38_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration38_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration38_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration38_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd38               (MCPARAMID)( 8545 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration39        (MCPARAMID)( 8546 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration39_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration39_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration39_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration39_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd39               (MCPARAMID)( 8547 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration40        (MCPARAMID)( 8548 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration40_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration40_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration40_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration40_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd40               (MCPARAMID)( 8549 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration41        (MCPARAMID)( 8550 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration41_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration41_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration41_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration41_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd41               (MCPARAMID)( 8551 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration42        (MCPARAMID)( 8552 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration42_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration42_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration42_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration42_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd42               (MCPARAMID)( 8553 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration43        (MCPARAMID)( 8554 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration43_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration43_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration43_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration43_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd43               (MCPARAMID)( 8555 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration44        (MCPARAMID)( 8556 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration44_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration44_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration44_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration44_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd44               (MCPARAMID)( 8557 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration45        (MCPARAMID)( 8558 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration45_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration45_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration45_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration45_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd45               (MCPARAMID)( 8559 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration46        (MCPARAMID)( 8560 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration46_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration46_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration46_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration46_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd46               (MCPARAMID)( 8561 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration47        (MCPARAMID)( 8562 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration47_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration47_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration47_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration47_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd47               (MCPARAMID)( 8563 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration48        (MCPARAMID)( 8564 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration48_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration48_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration48_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration48_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd48               (MCPARAMID)( 8565 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration49        (MCPARAMID)( 8566 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration49_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration49_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration49_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration49_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd49               (MCPARAMID)( 8567 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration50        (MCPARAMID)( 8568 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration50_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration50_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration50_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration50_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd50               (MCPARAMID)( 8569 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration51        (MCPARAMID)( 8570 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration51_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration51_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration51_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration51_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd51               (MCPARAMID)( 8571 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration52        (MCPARAMID)( 8572 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration52_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration52_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration52_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration52_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd52               (MCPARAMID)( 8573 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration53        (MCPARAMID)( 8574 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration53_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration53_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration53_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration53_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd53               (MCPARAMID)( 8575 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration54        (MCPARAMID)( 8576 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration54_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration54_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration54_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration54_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd54               (MCPARAMID)( 8577 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration55        (MCPARAMID)( 8578 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration55_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration55_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration55_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration55_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd55               (MCPARAMID)( 8579 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration56        (MCPARAMID)( 8580 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration56_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration56_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration56_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration56_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd56               (MCPARAMID)( 8581 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration57        (MCPARAMID)( 8582 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration57_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration57_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration57_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration57_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd57               (MCPARAMID)( 8583 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration58        (MCPARAMID)( 8584 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration58_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration58_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration58_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration58_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd58               (MCPARAMID)( 8585 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration59        (MCPARAMID)( 8586 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration59_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration59_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration59_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration59_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd59               (MCPARAMID)( 8587 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration60        (MCPARAMID)( 8588 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration60_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration60_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration60_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration60_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd60               (MCPARAMID)( 8589 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration61        (MCPARAMID)( 8590 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration61_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration61_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration61_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration61_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd61               (MCPARAMID)( 8591 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration62        (MCPARAMID)( 8592 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration62_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration62_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration62_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration62_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd62               (MCPARAMID)( 8593 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration63        (MCPARAMID)( 8594 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration63_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration63_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration63_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration63_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd63               (MCPARAMID)( 8595 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration32       (MCPARAMID)( 8596 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration32_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration32_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration32_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration32_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd32              (MCPARAMID)( 8597 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration33       (MCPARAMID)( 8598 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration33_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration33_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration33_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration33_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd33              (MCPARAMID)( 8599 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration34       (MCPARAMID)( 8600 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration34_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration34_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration34_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration34_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd34              (MCPARAMID)( 8601 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration35       (MCPARAMID)( 8602 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration35_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration35_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration35_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration35_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd35              (MCPARAMID)( 8603 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration36       (MCPARAMID)( 8604 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration36_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration36_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration36_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration36_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd36              (MCPARAMID)( 8605 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration37       (MCPARAMID)( 8606 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration37_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration37_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration37_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration37_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd37              (MCPARAMID)( 8607 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration38       (MCPARAMID)( 8608 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration38_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration38_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration38_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration38_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd38              (MCPARAMID)( 8609 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration39       (MCPARAMID)( 8610 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration39_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration39_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration39_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration39_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd39              (MCPARAMID)( 8611 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration40       (MCPARAMID)( 8612 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration40_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration40_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration40_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration40_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd40              (MCPARAMID)( 8613 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration41       (MCPARAMID)( 8614 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration41_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration41_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration41_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration41_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd41              (MCPARAMID)( 8615 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration42       (MCPARAMID)( 8616 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration42_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration42_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration42_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration42_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd42              (MCPARAMID)( 8617 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration43       (MCPARAMID)( 8618 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration43_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration43_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration43_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration43_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd43              (MCPARAMID)( 8619 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration44       (MCPARAMID)( 8620 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration44_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration44_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration44_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration44_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd44              (MCPARAMID)( 8621 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration45       (MCPARAMID)( 8622 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration45_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration45_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration45_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration45_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd45              (MCPARAMID)( 8623 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration46       (MCPARAMID)( 8624 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration46_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration46_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration46_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration46_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd46              (MCPARAMID)( 8625 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration47       (MCPARAMID)( 8626 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration47_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration47_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration47_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration47_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd47              (MCPARAMID)( 8627 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration48       (MCPARAMID)( 8628 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration48_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration48_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration48_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration48_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd48              (MCPARAMID)( 8629 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration49       (MCPARAMID)( 8630 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration49_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration49_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration49_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration49_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd49              (MCPARAMID)( 8631 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration50       (MCPARAMID)( 8632 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration50_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration50_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration50_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration50_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd50              (MCPARAMID)( 8633 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration51       (MCPARAMID)( 8634 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration51_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration51_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration51_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration51_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd51              (MCPARAMID)( 8635 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration52       (MCPARAMID)( 8636 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration52_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration52_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration52_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration52_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd52              (MCPARAMID)( 8637 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration53       (MCPARAMID)( 8638 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration53_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration53_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration53_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration53_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd53              (MCPARAMID)( 8639 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration54       (MCPARAMID)( 8640 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration54_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration54_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration54_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration54_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd54              (MCPARAMID)( 8641 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration55       (MCPARAMID)( 8642 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration55_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration55_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration55_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration55_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd55              (MCPARAMID)( 8643 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration56       (MCPARAMID)( 8644 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration56_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration56_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration56_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration56_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd56              (MCPARAMID)( 8645 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration57       (MCPARAMID)( 8646 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration57_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration57_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration57_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration57_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd57              (MCPARAMID)( 8647 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration58       (MCPARAMID)( 8648 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration58_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration58_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration58_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration58_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd58              (MCPARAMID)( 8649 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration59       (MCPARAMID)( 8650 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration59_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration59_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration59_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration59_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd59              (MCPARAMID)( 8651 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration60       (MCPARAMID)( 8652 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration60_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration60_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration60_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration60_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd60              (MCPARAMID)( 8653 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration61       (MCPARAMID)( 8654 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration61_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration61_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration61_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration61_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd61              (MCPARAMID)( 8655 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration62       (MCPARAMID)( 8656 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration62_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration62_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration62_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration62_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd62              (MCPARAMID)( 8657 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration63       (MCPARAMID)( 8658 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration63_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration63_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration63_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration63_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd63              (MCPARAMID)( 8659 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin32          (MCPARAMID)( 8660 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width32               (MCPARAMID)( 8661 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin33          (MCPARAMID)( 8662 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width33               (MCPARAMID)( 8663 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin34          (MCPARAMID)( 8664 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width34               (MCPARAMID)( 8665 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin35          (MCPARAMID)( 8666 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width35               (MCPARAMID)( 8667 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin36          (MCPARAMID)( 8668 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width36               (MCPARAMID)( 8669 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin37          (MCPARAMID)( 8670 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width37               (MCPARAMID)( 8671 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin38          (MCPARAMID)( 8672 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width38               (MCPARAMID)( 8673 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin39          (MCPARAMID)( 8674 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width39               (MCPARAMID)( 8675 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin40          (MCPARAMID)( 8676 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width40               (MCPARAMID)( 8677 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin41          (MCPARAMID)( 8678 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width41               (MCPARAMID)( 8679 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin42          (MCPARAMID)( 8680 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width42               (MCPARAMID)( 8681 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin43          (MCPARAMID)( 8682 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width43               (MCPARAMID)( 8683 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin44          (MCPARAMID)( 8684 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width44               (MCPARAMID)( 8685 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin45          (MCPARAMID)( 8686 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width45               (MCPARAMID)( 8687 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin46          (MCPARAMID)( 8688 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width46               (MCPARAMID)( 8689 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin47          (MCPARAMID)( 8690 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width47               (MCPARAMID)( 8691 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin48          (MCPARAMID)( 8692 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width48               (MCPARAMID)( 8693 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin49          (MCPARAMID)( 8694 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width49               (MCPARAMID)( 8695 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin50          (MCPARAMID)( 8696 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width50               (MCPARAMID)( 8697 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin51          (MCPARAMID)( 8698 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width51               (MCPARAMID)( 8699 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin52          (MCPARAMID)( 8700 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width52               (MCPARAMID)( 8701 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin53          (MCPARAMID)( 8702 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width53               (MCPARAMID)( 8703 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin54          (MCPARAMID)( 8704 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width54               (MCPARAMID)( 8705 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin55          (MCPARAMID)( 8706 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width55               (MCPARAMID)( 8707 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin56          (MCPARAMID)( 8708 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width56               (MCPARAMID)( 8709 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin57          (MCPARAMID)( 8710 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width57               (MCPARAMID)( 8711 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin58          (MCPARAMID)( 8712 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width58               (MCPARAMID)( 8713 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin59          (MCPARAMID)( 8714 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width59               (MCPARAMID)( 8715 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin60          (MCPARAMID)( 8716 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width60               (MCPARAMID)( 8717 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin61          (MCPARAMID)( 8718 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width61               (MCPARAMID)( 8719 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin62          (MCPARAMID)( 8720 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width62               (MCPARAMID)( 8721 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin63          (MCPARAMID)( 8722 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width63               (MCPARAMID)( 8723 << 14)
+#define MC_AWSizeX_fPx                           (MCPARAMID)( 8724 << 14)
+#define MC_GWSizeX_fPx                           (MCPARAMID)( 8725 << 14)
+#define MC_GWOrgX_fPx                            (MCPARAMID)( 8726 << 14)
+#define MC_TOI_USR_MinWidth_fPx                  (MCPARAMID)( 8727 << 14)
+#define MC_TOI_USR_MaxWidth_fPx                  (MCPARAMID)( 8728 << 14)
+#define MC_XF_ROI_TOI_USR_Width_fPx              (MCPARAMID)( 8729 << 14)
+#define MC_XF_ROI_TOI_USR_OrgX_fPx               (MCPARAMID)( 8730 << 14)
+#define MC_XF_ROI_TOI_REF_OrgX_fPx               (MCPARAMID)( 8731 << 14)
+#define MC_XF_ROI_TOI_REF_Width_fPx              (MCPARAMID)( 8732 << 14)
+#define MC_XF_ROI_TOI_EXT_OrgX_fPx               (MCPARAMID)( 8733 << 14)
+#define MC_XF_ROI_TOI_EXT_Width_fPx              (MCPARAMID)( 8734 << 14)
+#define MC_XF_ROI_TOI_EXT_NextX_fPx              (MCPARAMID)( 8735 << 14)
+#define MC_XF_ROI_TOI_FSR_OrgX_fPx               (MCPARAMID)( 8736 << 14)
+#define MC_AWB_ROI_TOI_USR_Width_fPx             (MCPARAMID)( 8737 << 14)
+#define MC_AWB_ROI_TOI_USR_OrgX_fPx              (MCPARAMID)( 8738 << 14)
+#define MC_AWB_ROI_TOI_REF_OrgX_fPx              (MCPARAMID)( 8739 << 14)
+#define MC_AWB_ROI_TOI_REF_EndX_fPx              (MCPARAMID)( 8740 << 14)
+#define MC_AWB_ROI_TOI_REF_Width_fPx             (MCPARAMID)( 8741 << 14)
+#define MC_AWB_ROI_TOI_EXT_OrgX_fPx              (MCPARAMID)( 8742 << 14)
+#define MC_AWB_ROI_TOI_EXT_Width_fPx             (MCPARAMID)( 8743 << 14)
+#define MC_AWB_ROI_TOI_EXT_NextX_fPx             (MCPARAMID)( 8744 << 14)
+#define MC_AWB_ROI_TOI_FSR_OrgX_fPx              (MCPARAMID)( 8745 << 14)
+#define MC_TOI_XFR_Granularity_fsPx              (MCPARAMID)( 8746 << 14)
+#define MC_XF_ROI_XFR_OrgX_fsPx                  (MCPARAMID)( 8747 << 14)
+#define MC_XF_ROI_XFR_NextX_fsPx                 (MCPARAMID)( 8748 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgX_fsPx              (MCPARAMID)( 8749 << 14)
+#define MC_XF_ROI_TOI_XFR_NextX_fsPx             (MCPARAMID)( 8750 << 14)
+#define MC_XF_ROI_TOI_XFR_Width_fsPx             (MCPARAMID)( 8751 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgY_sLn               (MCPARAMID)( 8752 << 14)
+#define MC_XF_ROI_TOI_XFR_NextY_sLn              (MCPARAMID)( 8753 << 14)
+#define MC_XF_ROI_TOI_XFR_Height_sLn             (MCPARAMID)( 8754 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeX_fsPx         (MCPARAMID)( 8755 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetX_fsPx       (MCPARAMID)( 8756 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetX_fsPx     (MCPARAMID)( 8757 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeY_sLn          (MCPARAMID)( 8758 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetY_sLn        (MCPARAMID)( 8759 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetY_sLn      (MCPARAMID)( 8760 << 14)
+#define MC_WindowOrgX_Px                         (MCPARAMID)( 8761 << 14)
+#define MC_WindowOrgX_Max_Px                     (MCPARAMID)( 8762 << 14)
+#define MC_WindowEndX_Px                         (MCPARAMID)( 8763 << 14)
+#define MC_WindowOrgX_fPx                        (MCPARAMID)( 8764 << 14)
+#define MC_WindowOrgY_Ln                         (MCPARAMID)( 8765 << 14)
+#define MC_WindowOrgY_Max_Ln                     (MCPARAMID)( 8766 << 14)
+#define MC_ImageColorRegistration_Filter         (MCPARAMID)( 8767 << 14)
+#define MC_WindowX_Effective_Px                  (MCPARAMID)( 8768 << 14)
+#define MC_WindowY_Effective_Ln                  (MCPARAMID)( 8769 << 14)
+#define MC_WindowX_Px_Max                        (MCPARAMID)( 8770 << 14)
+#define MC_WindowY_Ln_Max                        (MCPARAMID)( 8771 << 14)
+#define MC_WBO_OrgX_fPx                          (MCPARAMID)( 8772 << 14)
+#define MC_GrabberError_Number_31                (MCPARAMID)( 8773 << 14)
+#define MC_GrabberError_Number_30                (MCPARAMID)( 8774 << 14)
+#define MC_GrabberError_Number_29                (MCPARAMID)( 8775 << 14)
+#define MC_GrabberError_Number_28                (MCPARAMID)( 8776 << 14)
+#define MC_GrabberError_Number_27                (MCPARAMID)( 8777 << 14)
+#define MC_GrabberError_Number_26                (MCPARAMID)( 8778 << 14)
+#define MC_GrabberError_Number_25                (MCPARAMID)( 8779 << 14)
+#define MC_GrabberError_Number_24                (MCPARAMID)( 8780 << 14)
+#define MC_GrabberError_Number_23                (MCPARAMID)( 8781 << 14)
+#define MC_GrabberError_Number_22                (MCPARAMID)( 8782 << 14)
+#define MC_GrabberError_Number_21                (MCPARAMID)( 8783 << 14)
+#define MC_GrabberError_Number_20                (MCPARAMID)( 8784 << 14)
+#define MC_GrabberError_VdmaIncoherency          (MCPARAMID)( 8785 << 14)
+#define MC_GrabberError_Number_18                (MCPARAMID)( 8786 << 14)
+#define MC_GrabberError_Number_17                (MCPARAMID)( 8787 << 14)
+#define MC_GrabberError_IntractionDpFifo         (MCPARAMID)( 8788 << 14)
+#define MC_GrabberError_Number_15                (MCPARAMID)( 8789 << 14)
+#define MC_GrabberError_Number_14                (MCPARAMID)( 8790 << 14)
+#define MC_GrabberError_Number_13                (MCPARAMID)( 8791 << 14)
+#define MC_GrabberError_Number_12                (MCPARAMID)( 8792 << 14)
+#define MC_GrabberError_Number_11                (MCPARAMID)( 8793 << 14)
+#define MC_GrabberError_Number_10                (MCPARAMID)( 8794 << 14)
+#define MC_GrabberError_Number_9                 (MCPARAMID)( 8795 << 14)
+#define MC_GrabberError_Number_8                 (MCPARAMID)( 8796 << 14)
+#define MC_GrabberError_Number_7                 (MCPARAMID)( 8797 << 14)
+#define MC_GrabberError_Number_6                 (MCPARAMID)( 8798 << 14)
+#define MC_GrabberError_Number_5                 (MCPARAMID)( 8799 << 14)
+#define MC_GrabberError_BackEnd4                 (MCPARAMID)( 8800 << 14)
+#define MC_GrabberError_BackEnd3                 (MCPARAMID)( 8801 << 14)
+#define MC_GrabberError_BackEnd2                 (MCPARAMID)( 8802 << 14)
+#define MC_GrabberError_BackEnd1                 (MCPARAMID)( 8803 << 14)
+#define MC_GrabberOverrun_Number_31              (MCPARAMID)( 8804 << 14)
+#define MC_GrabberOverrun_Number_30              (MCPARAMID)( 8805 << 14)
+#define MC_GrabberOverrun_Number_29              (MCPARAMID)( 8806 << 14)
+#define MC_GrabberOverrun_Number_28              (MCPARAMID)( 8807 << 14)
+#define MC_GrabberOverrun_Number_27              (MCPARAMID)( 8808 << 14)
+#define MC_GrabberOverrun_Number_26              (MCPARAMID)( 8809 << 14)
+#define MC_GrabberOverrun_Number_25              (MCPARAMID)( 8810 << 14)
+#define MC_GrabberOverrun_Number_24              (MCPARAMID)( 8811 << 14)
+#define MC_GrabberOverrun_Number_23              (MCPARAMID)( 8812 << 14)
+#define MC_GrabberOverrun_Number_22              (MCPARAMID)( 8813 << 14)
+#define MC_GrabberOverrun_Number_21              (MCPARAMID)( 8814 << 14)
+#define MC_GrabberOverrun_Number_20              (MCPARAMID)( 8815 << 14)
+#define MC_GrabberOverrun_Number_19              (MCPARAMID)( 8816 << 14)
+#define MC_GrabberOverrun_Number_18              (MCPARAMID)( 8817 << 14)
+#define MC_GrabberOverrun_Number_17              (MCPARAMID)( 8818 << 14)
+#define MC_GrabberOverrun_Number_16              (MCPARAMID)( 8819 << 14)
+#define MC_GrabberOverrun_Number_15              (MCPARAMID)( 8820 << 14)
+#define MC_GrabberOverrun_Number_14              (MCPARAMID)( 8821 << 14)
+#define MC_GrabberOverrun_Number_13              (MCPARAMID)( 8822 << 14)
+#define MC_GrabberOverrun_Number_12              (MCPARAMID)( 8823 << 14)
+#define MC_GrabberOverrun_Number_11              (MCPARAMID)( 8824 << 14)
+#define MC_GrabberOverrun_Number_10              (MCPARAMID)( 8825 << 14)
+#define MC_GrabberOverrun_Number_9               (MCPARAMID)( 8826 << 14)
+#define MC_GrabberOverrun_Number_8               (MCPARAMID)( 8827 << 14)
+#define MC_GrabberOverrun_Acquisition            (MCPARAMID)( 8828 << 14)
+#define MC_GrabberOverrun_FrameTrigger           (MCPARAMID)( 8829 << 14)
+#define MC_GrabberOverrun_LineTrigger            (MCPARAMID)( 8830 << 14)
+#define MC_GrabberOverrun_Number_4               (MCPARAMID)( 8831 << 14)
+#define MC_GrabberOverrun_Number_3               (MCPARAMID)( 8832 << 14)
+#define MC_GrabberOverrun_Number_2               (MCPARAMID)( 8833 << 14)
+#define MC_GrabberOverrun_Number_1               (MCPARAMID)( 8834 << 14)
+#define MC_GrabberError_Number_4                 (MCPARAMID)( 8835 << 14)
+#define MC_GrabberError_Number_3                 (MCPARAMID)( 8836 << 14)
+#define MC_GrabberError_Number_2                 (MCPARAMID)( 8837 << 14)
+#define MC_GrabberError_Number_1                 (MCPARAMID)( 8838 << 14)
+#define MC_GrabberError_DivideBy0                (MCPARAMID)( 8839 << 14)
+#define MC_GrabberError_GainError                (MCPARAMID)( 8840 << 14)
+#define MC_GrabberError_GainOutOfSpec            (MCPARAMID)( 8841 << 14)
+#define MC_GrabberOverrun_GainOutOfSpec          (MCPARAMID)( 8842 << 14)
+#define MC_CPC_PPSB_Scaling                      (MCPARAMID)( 8843 << 14)
+#define MC_CPC_PPSB_Scaling_ON                     1
+#define MC_CPC_PPSB_Scaling_OFF                    2
+#define MC_GrabberError_PPSBincoherency          (MCPARAMID)( 8844 << 14)
+#define MC_GrabberError_PPSBunderflow            (MCPARAMID)( 8845 << 14)
+#define MC_GrabberError_PPSBoverflow             (MCPARAMID)( 8846 << 14)
+#define MC_GrabberError_ScalerIncoherency        (MCPARAMID)( 8847 << 14)
+#define MC_GrabberError_ScalerUnderflow          (MCPARAMID)( 8848 << 14)
+#define MC_GrabberError_ScalerOverflow           (MCPARAMID)( 8849 << 14)
+#define MC_GrabberError_PPOFincoherency          (MCPARAMID)( 8850 << 14)
+#define MC_GrabberError_PPOFoverflow             (MCPARAMID)( 8851 << 14)
+#define MC_GrabberError_PPOFunderflow            (MCPARAMID)( 8852 << 14)
+#define MC_Wic1_StartFrameAddress_byte           (MCPARAMID)( 8853 << 14)
+#define MC_Wic2_StartFrameAddress_byte           (MCPARAMID)( 8854 << 14)
+#define MC_Wic3_StartFrameAddress_byte           (MCPARAMID)( 8855 << 14)
+#define MC_Wic4_StartFrameAddress_byte           (MCPARAMID)( 8856 << 14)
+#define MC_Wic5_StartFrameAddress_byte           (MCPARAMID)( 8857 << 14)
+#define MC_Wic6_StartFrameAddress_byte           (MCPARAMID)( 8858 << 14)
+#define MC_Wic7_StartFrameAddress_byte           (MCPARAMID)( 8859 << 14)
+#define MC_ImageSizeX_Effective_Px               (MCPARAMID)( 8860 << 14)
+#define MC_XF_ROI_TOI_EXT_FBaligned_OrgX         (MCPARAMID)( 8861 << 14)
+#define MC_XF_ROI_TOI_EXT_FBaligned_Width        (MCPARAMID)( 8862 << 14)
+#define MC_XF_ROI_TOI_EXT_FBaligned_NextX        (MCPARAMID)( 8863 << 14)
+#define MC_AWB_ROI_TOI_EXT_FBaligned_OrgX        (MCPARAMID)( 8864 << 14)
+#define MC_AWB_ROI_TOI_EXT_FBaligned_Width       (MCPARAMID)( 8865 << 14)
+#define MC_AWB_ROI_TOI_EXT_FBaligned_NextX       (MCPARAMID)( 8866 << 14)
+#define MC_XF_ROI_XF_ROI_TOI_EXT_FBaligned_OrgX  (MCPARAMID)( 8867 << 14)
+#define MC_XF_ROI_XF_ROI_TOI_EXT_FBaligned_Width (MCPARAMID)( 8868 << 14)
+#define MC_XF_ROI_XF_ROI_TOI_EXT_FBaligned_NextX (MCPARAMID)( 8869 << 14)
+#define MC_XF_ROI_XF_ROI_TOI_EXT_FBaligned_LeftMargin (MCPARAMID)( 8870 << 14)
+#define MC_AWB_ROI_XF_ROI_TOI_EXT_FBaligned_OrgX (MCPARAMID)( 8871 << 14)
+#define MC_AWB_ROI_XF_ROI_TOI_EXT_FBaligned_Width (MCPARAMID)( 8872 << 14)
+#define MC_AWB_ROI_XF_ROI_TOI_EXT_FBaligned_NextX (MCPARAMID)( 8873 << 14)
+#define MC_AWB_ROI_XF_ROI_TOI_EXT_FBaligned_LeftMargin (MCPARAMID)( 8874 << 14)
+#define MC_XF_ROI_TOI_EXT_FBaligned_LeftMargin   (MCPARAMID)( 8875 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin0             (MCPARAMID)( 8876 << 14)
+#define MC_XF_ROI_WRF_XF_Width0                  (MCPARAMID)( 8877 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin1             (MCPARAMID)( 8878 << 14)
+#define MC_XF_ROI_WRF_XF_Width1                  (MCPARAMID)( 8879 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin2             (MCPARAMID)( 8880 << 14)
+#define MC_XF_ROI_WRF_XF_Width2                  (MCPARAMID)( 8881 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin3             (MCPARAMID)( 8882 << 14)
+#define MC_XF_ROI_WRF_XF_Width3                  (MCPARAMID)( 8883 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin4             (MCPARAMID)( 8884 << 14)
+#define MC_XF_ROI_WRF_XF_Width4                  (MCPARAMID)( 8885 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin5             (MCPARAMID)( 8886 << 14)
+#define MC_XF_ROI_WRF_XF_Width5                  (MCPARAMID)( 8887 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin6             (MCPARAMID)( 8888 << 14)
+#define MC_XF_ROI_WRF_XF_Width6                  (MCPARAMID)( 8889 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin7             (MCPARAMID)( 8890 << 14)
+#define MC_XF_ROI_WRF_XF_Width7                  (MCPARAMID)( 8891 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin8             (MCPARAMID)( 8892 << 14)
+#define MC_XF_ROI_WRF_XF_Width8                  (MCPARAMID)( 8893 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin9             (MCPARAMID)( 8894 << 14)
+#define MC_XF_ROI_WRF_XF_Width9                  (MCPARAMID)( 8895 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin10            (MCPARAMID)( 8896 << 14)
+#define MC_XF_ROI_WRF_XF_Width10                 (MCPARAMID)( 8897 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin11            (MCPARAMID)( 8898 << 14)
+#define MC_XF_ROI_WRF_XF_Width11                 (MCPARAMID)( 8899 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin12            (MCPARAMID)( 8900 << 14)
+#define MC_XF_ROI_WRF_XF_Width12                 (MCPARAMID)( 8901 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin13            (MCPARAMID)( 8902 << 14)
+#define MC_XF_ROI_WRF_XF_Width13                 (MCPARAMID)( 8903 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin14            (MCPARAMID)( 8904 << 14)
+#define MC_XF_ROI_WRF_XF_Width14                 (MCPARAMID)( 8905 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin15            (MCPARAMID)( 8906 << 14)
+#define MC_XF_ROI_WRF_XF_Width15                 (MCPARAMID)( 8907 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin16            (MCPARAMID)( 8908 << 14)
+#define MC_XF_ROI_WRF_XF_Width16                 (MCPARAMID)( 8909 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin17            (MCPARAMID)( 8910 << 14)
+#define MC_XF_ROI_WRF_XF_Width17                 (MCPARAMID)( 8911 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin18            (MCPARAMID)( 8912 << 14)
+#define MC_XF_ROI_WRF_XF_Width18                 (MCPARAMID)( 8913 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin19            (MCPARAMID)( 8914 << 14)
+#define MC_XF_ROI_WRF_XF_Width19                 (MCPARAMID)( 8915 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin20            (MCPARAMID)( 8916 << 14)
+#define MC_XF_ROI_WRF_XF_Width20                 (MCPARAMID)( 8917 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin21            (MCPARAMID)( 8918 << 14)
+#define MC_XF_ROI_WRF_XF_Width21                 (MCPARAMID)( 8919 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin22            (MCPARAMID)( 8920 << 14)
+#define MC_XF_ROI_WRF_XF_Width22                 (MCPARAMID)( 8921 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin23            (MCPARAMID)( 8922 << 14)
+#define MC_XF_ROI_WRF_XF_Width23                 (MCPARAMID)( 8923 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin24            (MCPARAMID)( 8924 << 14)
+#define MC_XF_ROI_WRF_XF_Width24                 (MCPARAMID)( 8925 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin25            (MCPARAMID)( 8926 << 14)
+#define MC_XF_ROI_WRF_XF_Width25                 (MCPARAMID)( 8927 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin26            (MCPARAMID)( 8928 << 14)
+#define MC_XF_ROI_WRF_XF_Width26                 (MCPARAMID)( 8929 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin27            (MCPARAMID)( 8930 << 14)
+#define MC_XF_ROI_WRF_XF_Width27                 (MCPARAMID)( 8931 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin28            (MCPARAMID)( 8932 << 14)
+#define MC_XF_ROI_WRF_XF_Width28                 (MCPARAMID)( 8933 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin29            (MCPARAMID)( 8934 << 14)
+#define MC_XF_ROI_WRF_XF_Width29                 (MCPARAMID)( 8935 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin30            (MCPARAMID)( 8936 << 14)
+#define MC_XF_ROI_WRF_XF_Width30                 (MCPARAMID)( 8937 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin31            (MCPARAMID)( 8938 << 14)
+#define MC_XF_ROI_WRF_XF_Width31                 (MCPARAMID)( 8939 << 14)
+#define MC_LUT_Method_LEGACY                       6
+#define MC_WBO_Status                            (MCPARAMID)( 8940 << 14)
+#define MC__ImageSizeX_dup                       (MCPARAMID)( 8941 << 14)
+#define MC__WindowX_Effective_Px_dup             (MCPARAMID)( 8942 << 14)
+#define MC_CalPatYValue                          (MCPARAMID)( 8943 << 14)
+#define MC_FEC_CalPatYValue                      (MCPARAMID)( 8944 << 14)
+#define MC_Bidule                                (MCPARAMID)( 8945 << 14)
+#define MC_COF_AE_Level1_0                       (MCPARAMID)( 8946 << 14)
+#define MC_COF_AE_Level2_0                       (MCPARAMID)( 8947 << 14)
+#define MC_COF_AE_Level3_0                       (MCPARAMID)( 8948 << 14)
+#define MC_COF_AE_Level4_0                       (MCPARAMID)( 8949 << 14)
+#define MC_COF_AE_Level5_0                       (MCPARAMID)( 8950 << 14)
+#define MC_COF_AE_Level6_0                       (MCPARAMID)( 8951 << 14)
+#define MC_COF_AE_Level7_0                       (MCPARAMID)( 8952 << 14)
+#define MC_COF_AE_Level8_0                       (MCPARAMID)( 8953 << 14)
+#define MC_COF_AE_Level1_1                       (MCPARAMID)( 8954 << 14)
+#define MC_COF_AE_Level2_1                       (MCPARAMID)( 8955 << 14)
+#define MC_COF_AE_Level3_1                       (MCPARAMID)( 8956 << 14)
+#define MC_COF_AE_Level4_1                       (MCPARAMID)( 8957 << 14)
+#define MC_COF_AE_Level5_1                       (MCPARAMID)( 8958 << 14)
+#define MC_COF_AE_Level6_1                       (MCPARAMID)( 8959 << 14)
+#define MC_COF_AE_Level7_1                       (MCPARAMID)( 8960 << 14)
+#define MC_COF_AE_Level8_1                       (MCPARAMID)( 8961 << 14)
+#define MC_COF_AE_Level1_2                       (MCPARAMID)( 8962 << 14)
+#define MC_COF_AE_Level2_2                       (MCPARAMID)( 8963 << 14)
+#define MC_COF_AE_Level3_2                       (MCPARAMID)( 8964 << 14)
+#define MC_COF_AE_Level4_2                       (MCPARAMID)( 8965 << 14)
+#define MC_COF_AE_Level5_2                       (MCPARAMID)( 8966 << 14)
+#define MC_COF_AE_Level6_2                       (MCPARAMID)( 8967 << 14)
+#define MC_COF_AE_Level7_2                       (MCPARAMID)( 8968 << 14)
+#define MC_COF_AE_Level8_2                       (MCPARAMID)( 8969 << 14)
+#define MC_COF_AE_Level1_3                       (MCPARAMID)( 8970 << 14)
+#define MC_COF_AE_Level2_3                       (MCPARAMID)( 8971 << 14)
+#define MC_COF_AE_Level3_3                       (MCPARAMID)( 8972 << 14)
+#define MC_COF_AE_Level4_3                       (MCPARAMID)( 8973 << 14)
+#define MC_COF_AE_Level5_3                       (MCPARAMID)( 8974 << 14)
+#define MC_COF_AE_Level6_3                       (MCPARAMID)( 8975 << 14)
+#define MC_COF_AE_Level7_3                       (MCPARAMID)( 8976 << 14)
+#define MC_COF_AE_Level8_3                       (MCPARAMID)( 8977 << 14)
+#define MC_COF_AE_Level1_4                       (MCPARAMID)( 8978 << 14)
+#define MC_COF_AE_Level2_4                       (MCPARAMID)( 8979 << 14)
+#define MC_COF_AE_Level3_4                       (MCPARAMID)( 8980 << 14)
+#define MC_COF_AE_Level4_4                       (MCPARAMID)( 8981 << 14)
+#define MC_COF_AE_Level5_4                       (MCPARAMID)( 8982 << 14)
+#define MC_COF_AE_Level6_4                       (MCPARAMID)( 8983 << 14)
+#define MC_COF_AE_Level7_4                       (MCPARAMID)( 8984 << 14)
+#define MC_COF_AE_Level8_4                       (MCPARAMID)( 8985 << 14)
+#define MC_COF_AE_Level1_5                       (MCPARAMID)( 8986 << 14)
+#define MC_COF_AE_Level2_5                       (MCPARAMID)( 8987 << 14)
+#define MC_COF_AE_Level3_5                       (MCPARAMID)( 8988 << 14)
+#define MC_COF_AE_Level4_5                       (MCPARAMID)( 8989 << 14)
+#define MC_COF_AE_Level5_5                       (MCPARAMID)( 8990 << 14)
+#define MC_COF_AE_Level6_5                       (MCPARAMID)( 8991 << 14)
+#define MC_COF_AE_Level7_5                       (MCPARAMID)( 8992 << 14)
+#define MC_COF_AE_Level8_5                       (MCPARAMID)( 8993 << 14)
+#define MC_COF_AE_Level1_6                       (MCPARAMID)( 8994 << 14)
+#define MC_COF_AE_Level2_6                       (MCPARAMID)( 8995 << 14)
+#define MC_COF_AE_Level3_6                       (MCPARAMID)( 8996 << 14)
+#define MC_COF_AE_Level4_6                       (MCPARAMID)( 8997 << 14)
+#define MC_COF_AE_Level5_6                       (MCPARAMID)( 8998 << 14)
+#define MC_COF_AE_Level6_6                       (MCPARAMID)( 8999 << 14)
+#define MC_COF_AE_Level7_6                       (MCPARAMID)( 9000 << 14)
+#define MC_COF_AE_Level8_6                       (MCPARAMID)( 9001 << 14)
+#define MC_COF_AE_Level1_7                       (MCPARAMID)( 9002 << 14)
+#define MC_COF_AE_Level2_7                       (MCPARAMID)( 9003 << 14)
+#define MC_COF_AE_Level3_7                       (MCPARAMID)( 9004 << 14)
+#define MC_COF_AE_Level4_7                       (MCPARAMID)( 9005 << 14)
+#define MC_COF_AE_Level5_7                       (MCPARAMID)( 9006 << 14)
+#define MC_COF_AE_Level6_7                       (MCPARAMID)( 9007 << 14)
+#define MC_COF_AE_Level7_7                       (MCPARAMID)( 9008 << 14)
+#define MC_COF_AE_Level8_7                       (MCPARAMID)( 9009 << 14)
+#define MC_COF_AE_Level1_8                       (MCPARAMID)( 9010 << 14)
+#define MC_COF_AE_Level2_8                       (MCPARAMID)( 9011 << 14)
+#define MC_COF_AE_Level3_8                       (MCPARAMID)( 9012 << 14)
+#define MC_COF_AE_Level4_8                       (MCPARAMID)( 9013 << 14)
+#define MC_COF_AE_Level5_8                       (MCPARAMID)( 9014 << 14)
+#define MC_COF_AE_Level6_8                       (MCPARAMID)( 9015 << 14)
+#define MC_COF_AE_Level7_8                       (MCPARAMID)( 9016 << 14)
+#define MC_COF_AE_Level8_8                       (MCPARAMID)( 9017 << 14)
+#define MC_COF_AE_Level1_9                       (MCPARAMID)( 9018 << 14)
+#define MC_COF_AE_Level2_9                       (MCPARAMID)( 9019 << 14)
+#define MC_COF_AE_Level3_9                       (MCPARAMID)( 9020 << 14)
+#define MC_COF_AE_Level4_9                       (MCPARAMID)( 9021 << 14)
+#define MC_COF_AE_Level5_9                       (MCPARAMID)( 9022 << 14)
+#define MC_COF_AE_Level6_9                       (MCPARAMID)( 9023 << 14)
+#define MC_COF_AE_Level7_9                       (MCPARAMID)( 9024 << 14)
+#define MC_COF_AE_Level8_9                       (MCPARAMID)( 9025 << 14)
+#define MC_COF_AE_Level1_10                      (MCPARAMID)( 9026 << 14)
+#define MC_COF_AE_Level2_10                      (MCPARAMID)( 9027 << 14)
+#define MC_COF_AE_Level3_10                      (MCPARAMID)( 9028 << 14)
+#define MC_COF_AE_Level4_10                      (MCPARAMID)( 9029 << 14)
+#define MC_COF_AE_Level5_10                      (MCPARAMID)( 9030 << 14)
+#define MC_COF_AE_Level6_10                      (MCPARAMID)( 9031 << 14)
+#define MC_COF_AE_Level7_10                      (MCPARAMID)( 9032 << 14)
+#define MC_COF_AE_Level8_10                      (MCPARAMID)( 9033 << 14)
+#define MC_COF_AE_Level1_11                      (MCPARAMID)( 9034 << 14)
+#define MC_COF_AE_Level2_11                      (MCPARAMID)( 9035 << 14)
+#define MC_COF_AE_Level3_11                      (MCPARAMID)( 9036 << 14)
+#define MC_COF_AE_Level4_11                      (MCPARAMID)( 9037 << 14)
+#define MC_COF_AE_Level5_11                      (MCPARAMID)( 9038 << 14)
+#define MC_COF_AE_Level6_11                      (MCPARAMID)( 9039 << 14)
+#define MC_COF_AE_Level7_11                      (MCPARAMID)( 9040 << 14)
+#define MC_COF_AE_Level8_11                      (MCPARAMID)( 9041 << 14)
+#define MC_COF_AE_Level1_12                      (MCPARAMID)( 9042 << 14)
+#define MC_COF_AE_Level2_12                      (MCPARAMID)( 9043 << 14)
+#define MC_COF_AE_Level3_12                      (MCPARAMID)( 9044 << 14)
+#define MC_COF_AE_Level4_12                      (MCPARAMID)( 9045 << 14)
+#define MC_COF_AE_Level5_12                      (MCPARAMID)( 9046 << 14)
+#define MC_COF_AE_Level6_12                      (MCPARAMID)( 9047 << 14)
+#define MC_COF_AE_Level7_12                      (MCPARAMID)( 9048 << 14)
+#define MC_COF_AE_Level8_12                      (MCPARAMID)( 9049 << 14)
+#define MC_COF_AE_Level1_13                      (MCPARAMID)( 9050 << 14)
+#define MC_COF_AE_Level2_13                      (MCPARAMID)( 9051 << 14)
+#define MC_COF_AE_Level3_13                      (MCPARAMID)( 9052 << 14)
+#define MC_COF_AE_Level4_13                      (MCPARAMID)( 9053 << 14)
+#define MC_COF_AE_Level5_13                      (MCPARAMID)( 9054 << 14)
+#define MC_COF_AE_Level6_13                      (MCPARAMID)( 9055 << 14)
+#define MC_COF_AE_Level7_13                      (MCPARAMID)( 9056 << 14)
+#define MC_COF_AE_Level8_13                      (MCPARAMID)( 9057 << 14)
+#define MC_COF_AE_Level1_14                      (MCPARAMID)( 9058 << 14)
+#define MC_COF_AE_Level2_14                      (MCPARAMID)( 9059 << 14)
+#define MC_COF_AE_Level3_14                      (MCPARAMID)( 9060 << 14)
+#define MC_COF_AE_Level4_14                      (MCPARAMID)( 9061 << 14)
+#define MC_COF_AE_Level5_14                      (MCPARAMID)( 9062 << 14)
+#define MC_COF_AE_Level6_14                      (MCPARAMID)( 9063 << 14)
+#define MC_COF_AE_Level7_14                      (MCPARAMID)( 9064 << 14)
+#define MC_COF_AE_Level8_14                      (MCPARAMID)( 9065 << 14)
+#define MC_COF_AE_Level1_15                      (MCPARAMID)( 9066 << 14)
+#define MC_COF_AE_Level2_15                      (MCPARAMID)( 9067 << 14)
+#define MC_COF_AE_Level3_15                      (MCPARAMID)( 9068 << 14)
+#define MC_COF_AE_Level4_15                      (MCPARAMID)( 9069 << 14)
+#define MC_COF_AE_Level5_15                      (MCPARAMID)( 9070 << 14)
+#define MC_COF_AE_Level6_15                      (MCPARAMID)( 9071 << 14)
+#define MC_COF_AE_Level7_15                      (MCPARAMID)( 9072 << 14)
+#define MC_COF_AE_Level8_15                      (MCPARAMID)( 9073 << 14)
+#define MC_COF_AE_Level1_16                      (MCPARAMID)( 9074 << 14)
+#define MC_COF_AE_Level2_16                      (MCPARAMID)( 9075 << 14)
+#define MC_COF_AE_Level3_16                      (MCPARAMID)( 9076 << 14)
+#define MC_COF_AE_Level4_16                      (MCPARAMID)( 9077 << 14)
+#define MC_COF_AE_Level5_16                      (MCPARAMID)( 9078 << 14)
+#define MC_COF_AE_Level6_16                      (MCPARAMID)( 9079 << 14)
+#define MC_COF_AE_Level7_16                      (MCPARAMID)( 9080 << 14)
+#define MC_COF_AE_Level8_16                      (MCPARAMID)( 9081 << 14)
+#define MC_COF_AE_Level1_17                      (MCPARAMID)( 9082 << 14)
+#define MC_COF_AE_Level2_17                      (MCPARAMID)( 9083 << 14)
+#define MC_COF_AE_Level3_17                      (MCPARAMID)( 9084 << 14)
+#define MC_COF_AE_Level4_17                      (MCPARAMID)( 9085 << 14)
+#define MC_COF_AE_Level5_17                      (MCPARAMID)( 9086 << 14)
+#define MC_COF_AE_Level6_17                      (MCPARAMID)( 9087 << 14)
+#define MC_COF_AE_Level7_17                      (MCPARAMID)( 9088 << 14)
+#define MC_COF_AE_Level8_17                      (MCPARAMID)( 9089 << 14)
+#define MC_COF_AE_Level1_18                      (MCPARAMID)( 9090 << 14)
+#define MC_COF_AE_Level2_18                      (MCPARAMID)( 9091 << 14)
+#define MC_COF_AE_Level3_18                      (MCPARAMID)( 9092 << 14)
+#define MC_COF_AE_Level4_18                      (MCPARAMID)( 9093 << 14)
+#define MC_COF_AE_Level5_18                      (MCPARAMID)( 9094 << 14)
+#define MC_COF_AE_Level6_18                      (MCPARAMID)( 9095 << 14)
+#define MC_COF_AE_Level7_18                      (MCPARAMID)( 9096 << 14)
+#define MC_COF_AE_Level8_18                      (MCPARAMID)( 9097 << 14)
+#define MC_COF_AE_Level1_19                      (MCPARAMID)( 9098 << 14)
+#define MC_COF_AE_Level2_19                      (MCPARAMID)( 9099 << 14)
+#define MC_COF_AE_Level3_19                      (MCPARAMID)( 9100 << 14)
+#define MC_COF_AE_Level4_19                      (MCPARAMID)( 9101 << 14)
+#define MC_COF_AE_Level5_19                      (MCPARAMID)( 9102 << 14)
+#define MC_COF_AE_Level6_19                      (MCPARAMID)( 9103 << 14)
+#define MC_COF_AE_Level7_19                      (MCPARAMID)( 9104 << 14)
+#define MC_COF_AE_Level8_19                      (MCPARAMID)( 9105 << 14)
+#define MC_COF_AE_Level1_20                      (MCPARAMID)( 9106 << 14)
+#define MC_COF_AE_Level2_20                      (MCPARAMID)( 9107 << 14)
+#define MC_COF_AE_Level3_20                      (MCPARAMID)( 9108 << 14)
+#define MC_COF_AE_Level4_20                      (MCPARAMID)( 9109 << 14)
+#define MC_COF_AE_Level5_20                      (MCPARAMID)( 9110 << 14)
+#define MC_COF_AE_Level6_20                      (MCPARAMID)( 9111 << 14)
+#define MC_COF_AE_Level7_20                      (MCPARAMID)( 9112 << 14)
+#define MC_COF_AE_Level8_20                      (MCPARAMID)( 9113 << 14)
+#define MC_COF_AE_Level1_21                      (MCPARAMID)( 9114 << 14)
+#define MC_COF_AE_Level2_21                      (MCPARAMID)( 9115 << 14)
+#define MC_COF_AE_Level3_21                      (MCPARAMID)( 9116 << 14)
+#define MC_COF_AE_Level4_21                      (MCPARAMID)( 9117 << 14)
+#define MC_COF_AE_Level5_21                      (MCPARAMID)( 9118 << 14)
+#define MC_COF_AE_Level6_21                      (MCPARAMID)( 9119 << 14)
+#define MC_COF_AE_Level7_21                      (MCPARAMID)( 9120 << 14)
+#define MC_COF_AE_Level8_21                      (MCPARAMID)( 9121 << 14)
+#define MC_COF_AE_Level1_22                      (MCPARAMID)( 9122 << 14)
+#define MC_COF_AE_Level2_22                      (MCPARAMID)( 9123 << 14)
+#define MC_COF_AE_Level3_22                      (MCPARAMID)( 9124 << 14)
+#define MC_COF_AE_Level4_22                      (MCPARAMID)( 9125 << 14)
+#define MC_COF_AE_Level5_22                      (MCPARAMID)( 9126 << 14)
+#define MC_COF_AE_Level6_22                      (MCPARAMID)( 9127 << 14)
+#define MC_COF_AE_Level7_22                      (MCPARAMID)( 9128 << 14)
+#define MC_COF_AE_Level8_22                      (MCPARAMID)( 9129 << 14)
+#define MC_COF_AE_Level1_23                      (MCPARAMID)( 9130 << 14)
+#define MC_COF_AE_Level2_23                      (MCPARAMID)( 9131 << 14)
+#define MC_COF_AE_Level3_23                      (MCPARAMID)( 9132 << 14)
+#define MC_COF_AE_Level4_23                      (MCPARAMID)( 9133 << 14)
+#define MC_COF_AE_Level5_23                      (MCPARAMID)( 9134 << 14)
+#define MC_COF_AE_Level6_23                      (MCPARAMID)( 9135 << 14)
+#define MC_COF_AE_Level7_23                      (MCPARAMID)( 9136 << 14)
+#define MC_COF_AE_Level8_23                      (MCPARAMID)( 9137 << 14)
+#define MC_COF_AE_Level1_24                      (MCPARAMID)( 9138 << 14)
+#define MC_COF_AE_Level2_24                      (MCPARAMID)( 9139 << 14)
+#define MC_COF_AE_Level3_24                      (MCPARAMID)( 9140 << 14)
+#define MC_COF_AE_Level4_24                      (MCPARAMID)( 9141 << 14)
+#define MC_COF_AE_Level5_24                      (MCPARAMID)( 9142 << 14)
+#define MC_COF_AE_Level6_24                      (MCPARAMID)( 9143 << 14)
+#define MC_COF_AE_Level7_24                      (MCPARAMID)( 9144 << 14)
+#define MC_COF_AE_Level8_24                      (MCPARAMID)( 9145 << 14)
+#define MC_COF_AE_Level1_25                      (MCPARAMID)( 9146 << 14)
+#define MC_COF_AE_Level2_25                      (MCPARAMID)( 9147 << 14)
+#define MC_COF_AE_Level3_25                      (MCPARAMID)( 9148 << 14)
+#define MC_COF_AE_Level4_25                      (MCPARAMID)( 9149 << 14)
+#define MC_COF_AE_Level5_25                      (MCPARAMID)( 9150 << 14)
+#define MC_COF_AE_Level6_25                      (MCPARAMID)( 9151 << 14)
+#define MC_COF_AE_Level7_25                      (MCPARAMID)( 9152 << 14)
+#define MC_COF_AE_Level8_25                      (MCPARAMID)( 9153 << 14)
+#define MC_COF_AE_Level1_26                      (MCPARAMID)( 9154 << 14)
+#define MC_COF_AE_Level2_26                      (MCPARAMID)( 9155 << 14)
+#define MC_COF_AE_Level3_26                      (MCPARAMID)( 9156 << 14)
+#define MC_COF_AE_Level4_26                      (MCPARAMID)( 9157 << 14)
+#define MC_COF_AE_Level5_26                      (MCPARAMID)( 9158 << 14)
+#define MC_COF_AE_Level6_26                      (MCPARAMID)( 9159 << 14)
+#define MC_COF_AE_Level7_26                      (MCPARAMID)( 9160 << 14)
+#define MC_COF_AE_Level8_26                      (MCPARAMID)( 9161 << 14)
+#define MC_COF_AE_Level1_27                      (MCPARAMID)( 9162 << 14)
+#define MC_COF_AE_Level2_27                      (MCPARAMID)( 9163 << 14)
+#define MC_COF_AE_Level3_27                      (MCPARAMID)( 9164 << 14)
+#define MC_COF_AE_Level4_27                      (MCPARAMID)( 9165 << 14)
+#define MC_COF_AE_Level5_27                      (MCPARAMID)( 9166 << 14)
+#define MC_COF_AE_Level6_27                      (MCPARAMID)( 9167 << 14)
+#define MC_COF_AE_Level7_27                      (MCPARAMID)( 9168 << 14)
+#define MC_COF_AE_Level8_27                      (MCPARAMID)( 9169 << 14)
+#define MC_COF_AE_Level1_28                      (MCPARAMID)( 9170 << 14)
+#define MC_COF_AE_Level2_28                      (MCPARAMID)( 9171 << 14)
+#define MC_COF_AE_Level3_28                      (MCPARAMID)( 9172 << 14)
+#define MC_COF_AE_Level4_28                      (MCPARAMID)( 9173 << 14)
+#define MC_COF_AE_Level5_28                      (MCPARAMID)( 9174 << 14)
+#define MC_COF_AE_Level6_28                      (MCPARAMID)( 9175 << 14)
+#define MC_COF_AE_Level7_28                      (MCPARAMID)( 9176 << 14)
+#define MC_COF_AE_Level8_28                      (MCPARAMID)( 9177 << 14)
+#define MC_COF_AE_Level1_29                      (MCPARAMID)( 9178 << 14)
+#define MC_COF_AE_Level2_29                      (MCPARAMID)( 9179 << 14)
+#define MC_COF_AE_Level3_29                      (MCPARAMID)( 9180 << 14)
+#define MC_COF_AE_Level4_29                      (MCPARAMID)( 9181 << 14)
+#define MC_COF_AE_Level5_29                      (MCPARAMID)( 9182 << 14)
+#define MC_COF_AE_Level6_29                      (MCPARAMID)( 9183 << 14)
+#define MC_COF_AE_Level7_29                      (MCPARAMID)( 9184 << 14)
+#define MC_COF_AE_Level8_29                      (MCPARAMID)( 9185 << 14)
+#define MC_COF_AE_Level1_30                      (MCPARAMID)( 9186 << 14)
+#define MC_COF_AE_Level2_30                      (MCPARAMID)( 9187 << 14)
+#define MC_COF_AE_Level3_30                      (MCPARAMID)( 9188 << 14)
+#define MC_COF_AE_Level4_30                      (MCPARAMID)( 9189 << 14)
+#define MC_COF_AE_Level5_30                      (MCPARAMID)( 9190 << 14)
+#define MC_COF_AE_Level6_30                      (MCPARAMID)( 9191 << 14)
+#define MC_COF_AE_Level7_30                      (MCPARAMID)( 9192 << 14)
+#define MC_COF_AE_Level8_30                      (MCPARAMID)( 9193 << 14)
+#define MC_COF_AE_Level1_31                      (MCPARAMID)( 9194 << 14)
+#define MC_COF_AE_Level2_31                      (MCPARAMID)( 9195 << 14)
+#define MC_COF_AE_Level3_31                      (MCPARAMID)( 9196 << 14)
+#define MC_COF_AE_Level4_31                      (MCPARAMID)( 9197 << 14)
+#define MC_COF_AE_Level5_31                      (MCPARAMID)( 9198 << 14)
+#define MC_COF_AE_Level6_31                      (MCPARAMID)( 9199 << 14)
+#define MC_COF_AE_Level7_31                      (MCPARAMID)( 9200 << 14)
+#define MC_COF_AE_Level8_31                      (MCPARAMID)( 9201 << 14)
+#define MC_COF_AELevel1_0                        (MCPARAMID)( 9202 << 14)
+#define MC_COF_AELevel2_0                        (MCPARAMID)( 9203 << 14)
+#define MC_COF_AELevel3_0                        (MCPARAMID)( 9204 << 14)
+#define MC_COF_AELevel4_0                        (MCPARAMID)( 9205 << 14)
+#define MC_COF_AELevel5_0                        (MCPARAMID)( 9206 << 14)
+#define MC_COF_AELevel6_0                        (MCPARAMID)( 9207 << 14)
+#define MC_COF_AELevel7_0                        (MCPARAMID)( 9208 << 14)
+#define MC_COF_AELevel8_0                        (MCPARAMID)( 9209 << 14)
+#define MC_COF_AELevel1_1                        (MCPARAMID)( 9210 << 14)
+#define MC_COF_AELevel2_1                        (MCPARAMID)( 9211 << 14)
+#define MC_COF_AELevel3_1                        (MCPARAMID)( 9212 << 14)
+#define MC_COF_AELevel4_1                        (MCPARAMID)( 9213 << 14)
+#define MC_COF_AELevel5_1                        (MCPARAMID)( 9214 << 14)
+#define MC_COF_AELevel6_1                        (MCPARAMID)( 9215 << 14)
+#define MC_COF_AELevel7_1                        (MCPARAMID)( 9216 << 14)
+#define MC_COF_AELevel8_1                        (MCPARAMID)( 9217 << 14)
+#define MC_COF_AELevel1_2                        (MCPARAMID)( 9218 << 14)
+#define MC_COF_AELevel2_2                        (MCPARAMID)( 9219 << 14)
+#define MC_COF_AELevel3_2                        (MCPARAMID)( 9220 << 14)
+#define MC_COF_AELevel4_2                        (MCPARAMID)( 9221 << 14)
+#define MC_COF_AELevel5_2                        (MCPARAMID)( 9222 << 14)
+#define MC_COF_AELevel6_2                        (MCPARAMID)( 9223 << 14)
+#define MC_COF_AELevel7_2                        (MCPARAMID)( 9224 << 14)
+#define MC_COF_AELevel8_2                        (MCPARAMID)( 9225 << 14)
+#define MC_COF_AELevel1_3                        (MCPARAMID)( 9226 << 14)
+#define MC_COF_AELevel2_3                        (MCPARAMID)( 9227 << 14)
+#define MC_COF_AELevel3_3                        (MCPARAMID)( 9228 << 14)
+#define MC_COF_AELevel4_3                        (MCPARAMID)( 9229 << 14)
+#define MC_COF_AELevel5_3                        (MCPARAMID)( 9230 << 14)
+#define MC_COF_AELevel6_3                        (MCPARAMID)( 9231 << 14)
+#define MC_COF_AELevel7_3                        (MCPARAMID)( 9232 << 14)
+#define MC_COF_AELevel8_3                        (MCPARAMID)( 9233 << 14)
+#define MC_COF_AELevel1_4                        (MCPARAMID)( 9234 << 14)
+#define MC_COF_AELevel2_4                        (MCPARAMID)( 9235 << 14)
+#define MC_COF_AELevel3_4                        (MCPARAMID)( 9236 << 14)
+#define MC_COF_AELevel4_4                        (MCPARAMID)( 9237 << 14)
+#define MC_COF_AELevel5_4                        (MCPARAMID)( 9238 << 14)
+#define MC_COF_AELevel6_4                        (MCPARAMID)( 9239 << 14)
+#define MC_COF_AELevel7_4                        (MCPARAMID)( 9240 << 14)
+#define MC_COF_AELevel8_4                        (MCPARAMID)( 9241 << 14)
+#define MC_COF_AELevel1_5                        (MCPARAMID)( 9242 << 14)
+#define MC_COF_AELevel2_5                        (MCPARAMID)( 9243 << 14)
+#define MC_COF_AELevel3_5                        (MCPARAMID)( 9244 << 14)
+#define MC_COF_AELevel4_5                        (MCPARAMID)( 9245 << 14)
+#define MC_COF_AELevel5_5                        (MCPARAMID)( 9246 << 14)
+#define MC_COF_AELevel6_5                        (MCPARAMID)( 9247 << 14)
+#define MC_COF_AELevel7_5                        (MCPARAMID)( 9248 << 14)
+#define MC_COF_AELevel8_5                        (MCPARAMID)( 9249 << 14)
+#define MC_COF_AELevel1_6                        (MCPARAMID)( 9250 << 14)
+#define MC_COF_AELevel2_6                        (MCPARAMID)( 9251 << 14)
+#define MC_COF_AELevel3_6                        (MCPARAMID)( 9252 << 14)
+#define MC_COF_AELevel4_6                        (MCPARAMID)( 9253 << 14)
+#define MC_COF_AELevel5_6                        (MCPARAMID)( 9254 << 14)
+#define MC_COF_AELevel6_6                        (MCPARAMID)( 9255 << 14)
+#define MC_COF_AELevel7_6                        (MCPARAMID)( 9256 << 14)
+#define MC_COF_AELevel8_6                        (MCPARAMID)( 9257 << 14)
+#define MC_COF_AELevel1_7                        (MCPARAMID)( 9258 << 14)
+#define MC_COF_AELevel2_7                        (MCPARAMID)( 9259 << 14)
+#define MC_COF_AELevel3_7                        (MCPARAMID)( 9260 << 14)
+#define MC_COF_AELevel4_7                        (MCPARAMID)( 9261 << 14)
+#define MC_COF_AELevel5_7                        (MCPARAMID)( 9262 << 14)
+#define MC_COF_AELevel6_7                        (MCPARAMID)( 9263 << 14)
+#define MC_COF_AELevel7_7                        (MCPARAMID)( 9264 << 14)
+#define MC_COF_AELevel8_7                        (MCPARAMID)( 9265 << 14)
+#define MC_COF_AELevel1_8                        (MCPARAMID)( 9266 << 14)
+#define MC_COF_AELevel2_8                        (MCPARAMID)( 9267 << 14)
+#define MC_COF_AELevel3_8                        (MCPARAMID)( 9268 << 14)
+#define MC_COF_AELevel4_8                        (MCPARAMID)( 9269 << 14)
+#define MC_COF_AELevel5_8                        (MCPARAMID)( 9270 << 14)
+#define MC_COF_AELevel6_8                        (MCPARAMID)( 9271 << 14)
+#define MC_COF_AELevel7_8                        (MCPARAMID)( 9272 << 14)
+#define MC_COF_AELevel8_8                        (MCPARAMID)( 9273 << 14)
+#define MC_COF_AELevel1_9                        (MCPARAMID)( 9274 << 14)
+#define MC_COF_AELevel2_9                        (MCPARAMID)( 9275 << 14)
+#define MC_COF_AELevel3_9                        (MCPARAMID)( 9276 << 14)
+#define MC_COF_AELevel4_9                        (MCPARAMID)( 9277 << 14)
+#define MC_COF_AELevel5_9                        (MCPARAMID)( 9278 << 14)
+#define MC_COF_AELevel6_9                        (MCPARAMID)( 9279 << 14)
+#define MC_COF_AELevel7_9                        (MCPARAMID)( 9280 << 14)
+#define MC_COF_AELevel8_9                        (MCPARAMID)( 9281 << 14)
+#define MC_COF_AELevel1_10                       (MCPARAMID)( 9282 << 14)
+#define MC_COF_AELevel2_10                       (MCPARAMID)( 9283 << 14)
+#define MC_COF_AELevel3_10                       (MCPARAMID)( 9284 << 14)
+#define MC_COF_AELevel4_10                       (MCPARAMID)( 9285 << 14)
+#define MC_COF_AELevel5_10                       (MCPARAMID)( 9286 << 14)
+#define MC_COF_AELevel6_10                       (MCPARAMID)( 9287 << 14)
+#define MC_COF_AELevel7_10                       (MCPARAMID)( 9288 << 14)
+#define MC_COF_AELevel8_10                       (MCPARAMID)( 9289 << 14)
+#define MC_COF_AELevel1_11                       (MCPARAMID)( 9290 << 14)
+#define MC_COF_AELevel2_11                       (MCPARAMID)( 9291 << 14)
+#define MC_COF_AELevel3_11                       (MCPARAMID)( 9292 << 14)
+#define MC_COF_AELevel4_11                       (MCPARAMID)( 9293 << 14)
+#define MC_COF_AELevel5_11                       (MCPARAMID)( 9294 << 14)
+#define MC_COF_AELevel6_11                       (MCPARAMID)( 9295 << 14)
+#define MC_COF_AELevel7_11                       (MCPARAMID)( 9296 << 14)
+#define MC_COF_AELevel8_11                       (MCPARAMID)( 9297 << 14)
+#define MC_COF_AELevel1_12                       (MCPARAMID)( 9298 << 14)
+#define MC_COF_AELevel2_12                       (MCPARAMID)( 9299 << 14)
+#define MC_COF_AELevel3_12                       (MCPARAMID)( 9300 << 14)
+#define MC_COF_AELevel4_12                       (MCPARAMID)( 9301 << 14)
+#define MC_COF_AELevel5_12                       (MCPARAMID)( 9302 << 14)
+#define MC_COF_AELevel6_12                       (MCPARAMID)( 9303 << 14)
+#define MC_COF_AELevel7_12                       (MCPARAMID)( 9304 << 14)
+#define MC_COF_AELevel8_12                       (MCPARAMID)( 9305 << 14)
+#define MC_COF_AELevel1_13                       (MCPARAMID)( 9306 << 14)
+#define MC_COF_AELevel2_13                       (MCPARAMID)( 9307 << 14)
+#define MC_COF_AELevel3_13                       (MCPARAMID)( 9308 << 14)
+#define MC_COF_AELevel4_13                       (MCPARAMID)( 9309 << 14)
+#define MC_COF_AELevel5_13                       (MCPARAMID)( 9310 << 14)
+#define MC_COF_AELevel6_13                       (MCPARAMID)( 9311 << 14)
+#define MC_COF_AELevel7_13                       (MCPARAMID)( 9312 << 14)
+#define MC_COF_AELevel8_13                       (MCPARAMID)( 9313 << 14)
+#define MC_COF_AELevel1_14                       (MCPARAMID)( 9314 << 14)
+#define MC_COF_AELevel2_14                       (MCPARAMID)( 9315 << 14)
+#define MC_COF_AELevel3_14                       (MCPARAMID)( 9316 << 14)
+#define MC_COF_AELevel4_14                       (MCPARAMID)( 9317 << 14)
+#define MC_COF_AELevel5_14                       (MCPARAMID)( 9318 << 14)
+#define MC_COF_AELevel6_14                       (MCPARAMID)( 9319 << 14)
+#define MC_COF_AELevel7_14                       (MCPARAMID)( 9320 << 14)
+#define MC_COF_AELevel8_14                       (MCPARAMID)( 9321 << 14)
+#define MC_COF_AELevel1_15                       (MCPARAMID)( 9322 << 14)
+#define MC_COF_AELevel2_15                       (MCPARAMID)( 9323 << 14)
+#define MC_COF_AELevel3_15                       (MCPARAMID)( 9324 << 14)
+#define MC_COF_AELevel4_15                       (MCPARAMID)( 9325 << 14)
+#define MC_COF_AELevel5_15                       (MCPARAMID)( 9326 << 14)
+#define MC_COF_AELevel6_15                       (MCPARAMID)( 9327 << 14)
+#define MC_COF_AELevel7_15                       (MCPARAMID)( 9328 << 14)
+#define MC_COF_AELevel8_15                       (MCPARAMID)( 9329 << 14)
+#define MC_COF_AELevel1_16                       (MCPARAMID)( 9330 << 14)
+#define MC_COF_AELevel2_16                       (MCPARAMID)( 9331 << 14)
+#define MC_COF_AELevel3_16                       (MCPARAMID)( 9332 << 14)
+#define MC_COF_AELevel4_16                       (MCPARAMID)( 9333 << 14)
+#define MC_COF_AELevel5_16                       (MCPARAMID)( 9334 << 14)
+#define MC_COF_AELevel6_16                       (MCPARAMID)( 9335 << 14)
+#define MC_COF_AELevel7_16                       (MCPARAMID)( 9336 << 14)
+#define MC_COF_AELevel8_16                       (MCPARAMID)( 9337 << 14)
+#define MC_COF_AELevel1_17                       (MCPARAMID)( 9338 << 14)
+#define MC_COF_AELevel2_17                       (MCPARAMID)( 9339 << 14)
+#define MC_COF_AELevel3_17                       (MCPARAMID)( 9340 << 14)
+#define MC_COF_AELevel4_17                       (MCPARAMID)( 9341 << 14)
+#define MC_COF_AELevel5_17                       (MCPARAMID)( 9342 << 14)
+#define MC_COF_AELevel6_17                       (MCPARAMID)( 9343 << 14)
+#define MC_COF_AELevel7_17                       (MCPARAMID)( 9344 << 14)
+#define MC_COF_AELevel8_17                       (MCPARAMID)( 9345 << 14)
+#define MC_COF_AELevel1_18                       (MCPARAMID)( 9346 << 14)
+#define MC_COF_AELevel2_18                       (MCPARAMID)( 9347 << 14)
+#define MC_COF_AELevel3_18                       (MCPARAMID)( 9348 << 14)
+#define MC_COF_AELevel4_18                       (MCPARAMID)( 9349 << 14)
+#define MC_COF_AELevel5_18                       (MCPARAMID)( 9350 << 14)
+#define MC_COF_AELevel6_18                       (MCPARAMID)( 9351 << 14)
+#define MC_COF_AELevel7_18                       (MCPARAMID)( 9352 << 14)
+#define MC_COF_AELevel8_18                       (MCPARAMID)( 9353 << 14)
+#define MC_COF_AELevel1_19                       (MCPARAMID)( 9354 << 14)
+#define MC_COF_AELevel2_19                       (MCPARAMID)( 9355 << 14)
+#define MC_COF_AELevel3_19                       (MCPARAMID)( 9356 << 14)
+#define MC_COF_AELevel4_19                       (MCPARAMID)( 9357 << 14)
+#define MC_COF_AELevel5_19                       (MCPARAMID)( 9358 << 14)
+#define MC_COF_AELevel6_19                       (MCPARAMID)( 9359 << 14)
+#define MC_COF_AELevel7_19                       (MCPARAMID)( 9360 << 14)
+#define MC_COF_AELevel8_19                       (MCPARAMID)( 9361 << 14)
+#define MC_COF_AELevel1_20                       (MCPARAMID)( 9362 << 14)
+#define MC_COF_AELevel2_20                       (MCPARAMID)( 9363 << 14)
+#define MC_COF_AELevel3_20                       (MCPARAMID)( 9364 << 14)
+#define MC_COF_AELevel4_20                       (MCPARAMID)( 9365 << 14)
+#define MC_COF_AELevel5_20                       (MCPARAMID)( 9366 << 14)
+#define MC_COF_AELevel6_20                       (MCPARAMID)( 9367 << 14)
+#define MC_COF_AELevel7_20                       (MCPARAMID)( 9368 << 14)
+#define MC_COF_AELevel8_20                       (MCPARAMID)( 9369 << 14)
+#define MC_COF_AELevel1_21                       (MCPARAMID)( 9370 << 14)
+#define MC_COF_AELevel2_21                       (MCPARAMID)( 9371 << 14)
+#define MC_COF_AELevel3_21                       (MCPARAMID)( 9372 << 14)
+#define MC_COF_AELevel4_21                       (MCPARAMID)( 9373 << 14)
+#define MC_COF_AELevel5_21                       (MCPARAMID)( 9374 << 14)
+#define MC_COF_AELevel6_21                       (MCPARAMID)( 9375 << 14)
+#define MC_COF_AELevel7_21                       (MCPARAMID)( 9376 << 14)
+#define MC_COF_AELevel8_21                       (MCPARAMID)( 9377 << 14)
+#define MC_COF_AELevel1_22                       (MCPARAMID)( 9378 << 14)
+#define MC_COF_AELevel2_22                       (MCPARAMID)( 9379 << 14)
+#define MC_COF_AELevel3_22                       (MCPARAMID)( 9380 << 14)
+#define MC_COF_AELevel4_22                       (MCPARAMID)( 9381 << 14)
+#define MC_COF_AELevel5_22                       (MCPARAMID)( 9382 << 14)
+#define MC_COF_AELevel6_22                       (MCPARAMID)( 9383 << 14)
+#define MC_COF_AELevel7_22                       (MCPARAMID)( 9384 << 14)
+#define MC_COF_AELevel8_22                       (MCPARAMID)( 9385 << 14)
+#define MC_COF_AELevel1_23                       (MCPARAMID)( 9386 << 14)
+#define MC_COF_AELevel2_23                       (MCPARAMID)( 9387 << 14)
+#define MC_COF_AELevel3_23                       (MCPARAMID)( 9388 << 14)
+#define MC_COF_AELevel4_23                       (MCPARAMID)( 9389 << 14)
+#define MC_COF_AELevel5_23                       (MCPARAMID)( 9390 << 14)
+#define MC_COF_AELevel6_23                       (MCPARAMID)( 9391 << 14)
+#define MC_COF_AELevel7_23                       (MCPARAMID)( 9392 << 14)
+#define MC_COF_AELevel8_23                       (MCPARAMID)( 9393 << 14)
+#define MC_COF_AELevel1_24                       (MCPARAMID)( 9394 << 14)
+#define MC_COF_AELevel2_24                       (MCPARAMID)( 9395 << 14)
+#define MC_COF_AELevel3_24                       (MCPARAMID)( 9396 << 14)
+#define MC_COF_AELevel4_24                       (MCPARAMID)( 9397 << 14)
+#define MC_COF_AELevel5_24                       (MCPARAMID)( 9398 << 14)
+#define MC_COF_AELevel6_24                       (MCPARAMID)( 9399 << 14)
+#define MC_COF_AELevel7_24                       (MCPARAMID)( 9400 << 14)
+#define MC_COF_AELevel8_24                       (MCPARAMID)( 9401 << 14)
+#define MC_COF_AELevel1_25                       (MCPARAMID)( 9402 << 14)
+#define MC_COF_AELevel2_25                       (MCPARAMID)( 9403 << 14)
+#define MC_COF_AELevel3_25                       (MCPARAMID)( 9404 << 14)
+#define MC_COF_AELevel4_25                       (MCPARAMID)( 9405 << 14)
+#define MC_COF_AELevel5_25                       (MCPARAMID)( 9406 << 14)
+#define MC_COF_AELevel6_25                       (MCPARAMID)( 9407 << 14)
+#define MC_COF_AELevel7_25                       (MCPARAMID)( 9408 << 14)
+#define MC_COF_AELevel8_25                       (MCPARAMID)( 9409 << 14)
+#define MC_COF_AELevel1_26                       (MCPARAMID)( 9410 << 14)
+#define MC_COF_AELevel2_26                       (MCPARAMID)( 9411 << 14)
+#define MC_COF_AELevel3_26                       (MCPARAMID)( 9412 << 14)
+#define MC_COF_AELevel4_26                       (MCPARAMID)( 9413 << 14)
+#define MC_COF_AELevel5_26                       (MCPARAMID)( 9414 << 14)
+#define MC_COF_AELevel6_26                       (MCPARAMID)( 9415 << 14)
+#define MC_COF_AELevel7_26                       (MCPARAMID)( 9416 << 14)
+#define MC_COF_AELevel8_26                       (MCPARAMID)( 9417 << 14)
+#define MC_COF_AELevel1_27                       (MCPARAMID)( 9418 << 14)
+#define MC_COF_AELevel2_27                       (MCPARAMID)( 9419 << 14)
+#define MC_COF_AELevel3_27                       (MCPARAMID)( 9420 << 14)
+#define MC_COF_AELevel4_27                       (MCPARAMID)( 9421 << 14)
+#define MC_COF_AELevel5_27                       (MCPARAMID)( 9422 << 14)
+#define MC_COF_AELevel6_27                       (MCPARAMID)( 9423 << 14)
+#define MC_COF_AELevel7_27                       (MCPARAMID)( 9424 << 14)
+#define MC_COF_AELevel8_27                       (MCPARAMID)( 9425 << 14)
+#define MC_COF_AELevel1_28                       (MCPARAMID)( 9426 << 14)
+#define MC_COF_AELevel2_28                       (MCPARAMID)( 9427 << 14)
+#define MC_COF_AELevel3_28                       (MCPARAMID)( 9428 << 14)
+#define MC_COF_AELevel4_28                       (MCPARAMID)( 9429 << 14)
+#define MC_COF_AELevel5_28                       (MCPARAMID)( 9430 << 14)
+#define MC_COF_AELevel6_28                       (MCPARAMID)( 9431 << 14)
+#define MC_COF_AELevel7_28                       (MCPARAMID)( 9432 << 14)
+#define MC_COF_AELevel8_28                       (MCPARAMID)( 9433 << 14)
+#define MC_COF_AELevel1_29                       (MCPARAMID)( 9434 << 14)
+#define MC_COF_AELevel2_29                       (MCPARAMID)( 9435 << 14)
+#define MC_COF_AELevel3_29                       (MCPARAMID)( 9436 << 14)
+#define MC_COF_AELevel4_29                       (MCPARAMID)( 9437 << 14)
+#define MC_COF_AELevel5_29                       (MCPARAMID)( 9438 << 14)
+#define MC_COF_AELevel6_29                       (MCPARAMID)( 9439 << 14)
+#define MC_COF_AELevel7_29                       (MCPARAMID)( 9440 << 14)
+#define MC_COF_AELevel8_29                       (MCPARAMID)( 9441 << 14)
+#define MC_COF_AELevel1_30                       (MCPARAMID)( 9442 << 14)
+#define MC_COF_AELevel2_30                       (MCPARAMID)( 9443 << 14)
+#define MC_COF_AELevel3_30                       (MCPARAMID)( 9444 << 14)
+#define MC_COF_AELevel4_30                       (MCPARAMID)( 9445 << 14)
+#define MC_COF_AELevel5_30                       (MCPARAMID)( 9446 << 14)
+#define MC_COF_AELevel6_30                       (MCPARAMID)( 9447 << 14)
+#define MC_COF_AELevel7_30                       (MCPARAMID)( 9448 << 14)
+#define MC_COF_AELevel8_30                       (MCPARAMID)( 9449 << 14)
+#define MC_COF_AELevel1_31                       (MCPARAMID)( 9450 << 14)
+#define MC_COF_AELevel2_31                       (MCPARAMID)( 9451 << 14)
+#define MC_COF_AELevel3_31                       (MCPARAMID)( 9452 << 14)
+#define MC_COF_AELevel4_31                       (MCPARAMID)( 9453 << 14)
+#define MC_COF_AELevel5_31                       (MCPARAMID)( 9454 << 14)
+#define MC_COF_AELevel6_31                       (MCPARAMID)( 9455 << 14)
+#define MC_COF_AELevel7_31                       (MCPARAMID)( 9456 << 14)
+#define MC_COF_AELevel8_31                       (MCPARAMID)( 9457 << 14)
+#define MC__PlanePitch_mw                        (MCPARAMID)( 9458 << 14)
+#define MC__PlanePitch                           (MCPARAMID)( 9459 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin32            (MCPARAMID)( 9460 << 14)
+#define MC_XF_ROI_WRF_XF_Width32                 (MCPARAMID)( 9461 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin33            (MCPARAMID)( 9462 << 14)
+#define MC_XF_ROI_WRF_XF_Width33                 (MCPARAMID)( 9463 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin34            (MCPARAMID)( 9464 << 14)
+#define MC_XF_ROI_WRF_XF_Width34                 (MCPARAMID)( 9465 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin35            (MCPARAMID)( 9466 << 14)
+#define MC_XF_ROI_WRF_XF_Width35                 (MCPARAMID)( 9467 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin36            (MCPARAMID)( 9468 << 14)
+#define MC_XF_ROI_WRF_XF_Width36                 (MCPARAMID)( 9469 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin37            (MCPARAMID)( 9470 << 14)
+#define MC_XF_ROI_WRF_XF_Width37                 (MCPARAMID)( 9471 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin38            (MCPARAMID)( 9472 << 14)
+#define MC_XF_ROI_WRF_XF_Width38                 (MCPARAMID)( 9473 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin39            (MCPARAMID)( 9474 << 14)
+#define MC_XF_ROI_WRF_XF_Width39                 (MCPARAMID)( 9475 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin40            (MCPARAMID)( 9476 << 14)
+#define MC_XF_ROI_WRF_XF_Width40                 (MCPARAMID)( 9477 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin41            (MCPARAMID)( 9478 << 14)
+#define MC_XF_ROI_WRF_XF_Width41                 (MCPARAMID)( 9479 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin42            (MCPARAMID)( 9480 << 14)
+#define MC_XF_ROI_WRF_XF_Width42                 (MCPARAMID)( 9481 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin43            (MCPARAMID)( 9482 << 14)
+#define MC_XF_ROI_WRF_XF_Width43                 (MCPARAMID)( 9483 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin44            (MCPARAMID)( 9484 << 14)
+#define MC_XF_ROI_WRF_XF_Width44                 (MCPARAMID)( 9485 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin45            (MCPARAMID)( 9486 << 14)
+#define MC_XF_ROI_WRF_XF_Width45                 (MCPARAMID)( 9487 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin46            (MCPARAMID)( 9488 << 14)
+#define MC_XF_ROI_WRF_XF_Width46                 (MCPARAMID)( 9489 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin47            (MCPARAMID)( 9490 << 14)
+#define MC_XF_ROI_WRF_XF_Width47                 (MCPARAMID)( 9491 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin48            (MCPARAMID)( 9492 << 14)
+#define MC_XF_ROI_WRF_XF_Width48                 (MCPARAMID)( 9493 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin49            (MCPARAMID)( 9494 << 14)
+#define MC_XF_ROI_WRF_XF_Width49                 (MCPARAMID)( 9495 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin50            (MCPARAMID)( 9496 << 14)
+#define MC_XF_ROI_WRF_XF_Width50                 (MCPARAMID)( 9497 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin51            (MCPARAMID)( 9498 << 14)
+#define MC_XF_ROI_WRF_XF_Width51                 (MCPARAMID)( 9499 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin52            (MCPARAMID)( 9500 << 14)
+#define MC_XF_ROI_WRF_XF_Width52                 (MCPARAMID)( 9501 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin53            (MCPARAMID)( 9502 << 14)
+#define MC_XF_ROI_WRF_XF_Width53                 (MCPARAMID)( 9503 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin54            (MCPARAMID)( 9504 << 14)
+#define MC_XF_ROI_WRF_XF_Width54                 (MCPARAMID)( 9505 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin55            (MCPARAMID)( 9506 << 14)
+#define MC_XF_ROI_WRF_XF_Width55                 (MCPARAMID)( 9507 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin56            (MCPARAMID)( 9508 << 14)
+#define MC_XF_ROI_WRF_XF_Width56                 (MCPARAMID)( 9509 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin57            (MCPARAMID)( 9510 << 14)
+#define MC_XF_ROI_WRF_XF_Width57                 (MCPARAMID)( 9511 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin58            (MCPARAMID)( 9512 << 14)
+#define MC_XF_ROI_WRF_XF_Width58                 (MCPARAMID)( 9513 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin59            (MCPARAMID)( 9514 << 14)
+#define MC_XF_ROI_WRF_XF_Width59                 (MCPARAMID)( 9515 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin60            (MCPARAMID)( 9516 << 14)
+#define MC_XF_ROI_WRF_XF_Width60                 (MCPARAMID)( 9517 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin61            (MCPARAMID)( 9518 << 14)
+#define MC_XF_ROI_WRF_XF_Width61                 (MCPARAMID)( 9519 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin62            (MCPARAMID)( 9520 << 14)
+#define MC_XF_ROI_WRF_XF_Width62                 (MCPARAMID)( 9521 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin63            (MCPARAMID)( 9522 << 14)
+#define MC_XF_ROI_WRF_XF_Width63                 (MCPARAMID)( 9523 << 14)
+#define MC_COF_AELevel1_32                       (MCPARAMID)( 9524 << 14)
+#define MC_COF_AELevel2_32                       (MCPARAMID)( 9525 << 14)
+#define MC_COF_AELevel3_32                       (MCPARAMID)( 9526 << 14)
+#define MC_COF_AELevel4_32                       (MCPARAMID)( 9527 << 14)
+#define MC_COF_AELevel5_32                       (MCPARAMID)( 9528 << 14)
+#define MC_COF_AELevel6_32                       (MCPARAMID)( 9529 << 14)
+#define MC_COF_AELevel7_32                       (MCPARAMID)( 9530 << 14)
+#define MC_COF_AELevel8_32                       (MCPARAMID)( 9531 << 14)
+#define MC_COF_AELevel1_33                       (MCPARAMID)( 9532 << 14)
+#define MC_COF_AELevel2_33                       (MCPARAMID)( 9533 << 14)
+#define MC_COF_AELevel3_33                       (MCPARAMID)( 9534 << 14)
+#define MC_COF_AELevel4_33                       (MCPARAMID)( 9535 << 14)
+#define MC_COF_AELevel5_33                       (MCPARAMID)( 9536 << 14)
+#define MC_COF_AELevel6_33                       (MCPARAMID)( 9537 << 14)
+#define MC_COF_AELevel7_33                       (MCPARAMID)( 9538 << 14)
+#define MC_COF_AELevel8_33                       (MCPARAMID)( 9539 << 14)
+#define MC_COF_AELevel1_34                       (MCPARAMID)( 9540 << 14)
+#define MC_COF_AELevel2_34                       (MCPARAMID)( 9541 << 14)
+#define MC_COF_AELevel3_34                       (MCPARAMID)( 9542 << 14)
+#define MC_COF_AELevel4_34                       (MCPARAMID)( 9543 << 14)
+#define MC_COF_AELevel5_34                       (MCPARAMID)( 9544 << 14)
+#define MC_COF_AELevel6_34                       (MCPARAMID)( 9545 << 14)
+#define MC_COF_AELevel7_34                       (MCPARAMID)( 9546 << 14)
+#define MC_COF_AELevel8_34                       (MCPARAMID)( 9547 << 14)
+#define MC_COF_AELevel1_35                       (MCPARAMID)( 9548 << 14)
+#define MC_COF_AELevel2_35                       (MCPARAMID)( 9549 << 14)
+#define MC_COF_AELevel3_35                       (MCPARAMID)( 9550 << 14)
+#define MC_COF_AELevel4_35                       (MCPARAMID)( 9551 << 14)
+#define MC_COF_AELevel5_35                       (MCPARAMID)( 9552 << 14)
+#define MC_COF_AELevel6_35                       (MCPARAMID)( 9553 << 14)
+#define MC_COF_AELevel7_35                       (MCPARAMID)( 9554 << 14)
+#define MC_COF_AELevel8_35                       (MCPARAMID)( 9555 << 14)
+#define MC_COF_AELevel1_36                       (MCPARAMID)( 9556 << 14)
+#define MC_COF_AELevel2_36                       (MCPARAMID)( 9557 << 14)
+#define MC_COF_AELevel3_36                       (MCPARAMID)( 9558 << 14)
+#define MC_COF_AELevel4_36                       (MCPARAMID)( 9559 << 14)
+#define MC_COF_AELevel5_36                       (MCPARAMID)( 9560 << 14)
+#define MC_COF_AELevel6_36                       (MCPARAMID)( 9561 << 14)
+#define MC_COF_AELevel7_36                       (MCPARAMID)( 9562 << 14)
+#define MC_COF_AELevel8_36                       (MCPARAMID)( 9563 << 14)
+#define MC_COF_AELevel1_37                       (MCPARAMID)( 9564 << 14)
+#define MC_COF_AELevel2_37                       (MCPARAMID)( 9565 << 14)
+#define MC_COF_AELevel3_37                       (MCPARAMID)( 9566 << 14)
+#define MC_COF_AELevel4_37                       (MCPARAMID)( 9567 << 14)
+#define MC_COF_AELevel5_37                       (MCPARAMID)( 9568 << 14)
+#define MC_COF_AELevel6_37                       (MCPARAMID)( 9569 << 14)
+#define MC_COF_AELevel7_37                       (MCPARAMID)( 9570 << 14)
+#define MC_COF_AELevel8_37                       (MCPARAMID)( 9571 << 14)
+#define MC_COF_AELevel1_38                       (MCPARAMID)( 9572 << 14)
+#define MC_COF_AELevel2_38                       (MCPARAMID)( 9573 << 14)
+#define MC_COF_AELevel3_38                       (MCPARAMID)( 9574 << 14)
+#define MC_COF_AELevel4_38                       (MCPARAMID)( 9575 << 14)
+#define MC_COF_AELevel5_38                       (MCPARAMID)( 9576 << 14)
+#define MC_COF_AELevel6_38                       (MCPARAMID)( 9577 << 14)
+#define MC_COF_AELevel7_38                       (MCPARAMID)( 9578 << 14)
+#define MC_COF_AELevel8_38                       (MCPARAMID)( 9579 << 14)
+#define MC_COF_AELevel1_39                       (MCPARAMID)( 9580 << 14)
+#define MC_COF_AELevel2_39                       (MCPARAMID)( 9581 << 14)
+#define MC_COF_AELevel3_39                       (MCPARAMID)( 9582 << 14)
+#define MC_COF_AELevel4_39                       (MCPARAMID)( 9583 << 14)
+#define MC_COF_AELevel5_39                       (MCPARAMID)( 9584 << 14)
+#define MC_COF_AELevel6_39                       (MCPARAMID)( 9585 << 14)
+#define MC_COF_AELevel7_39                       (MCPARAMID)( 9586 << 14)
+#define MC_COF_AELevel8_39                       (MCPARAMID)( 9587 << 14)
+#define MC_COF_AELevel1_40                       (MCPARAMID)( 9588 << 14)
+#define MC_COF_AELevel2_40                       (MCPARAMID)( 9589 << 14)
+#define MC_COF_AELevel3_40                       (MCPARAMID)( 9590 << 14)
+#define MC_COF_AELevel4_40                       (MCPARAMID)( 9591 << 14)
+#define MC_COF_AELevel5_40                       (MCPARAMID)( 9592 << 14)
+#define MC_COF_AELevel6_40                       (MCPARAMID)( 9593 << 14)
+#define MC_COF_AELevel7_40                       (MCPARAMID)( 9594 << 14)
+#define MC_COF_AELevel8_40                       (MCPARAMID)( 9595 << 14)
+#define MC_COF_AELevel1_41                       (MCPARAMID)( 9596 << 14)
+#define MC_COF_AELevel2_41                       (MCPARAMID)( 9597 << 14)
+#define MC_COF_AELevel3_41                       (MCPARAMID)( 9598 << 14)
+#define MC_COF_AELevel4_41                       (MCPARAMID)( 9599 << 14)
+#define MC_COF_AELevel5_41                       (MCPARAMID)( 9600 << 14)
+#define MC_COF_AELevel6_41                       (MCPARAMID)( 9601 << 14)
+#define MC_COF_AELevel7_41                       (MCPARAMID)( 9602 << 14)
+#define MC_COF_AELevel8_41                       (MCPARAMID)( 9603 << 14)
+#define MC_COF_AELevel1_42                       (MCPARAMID)( 9604 << 14)
+#define MC_COF_AELevel2_42                       (MCPARAMID)( 9605 << 14)
+#define MC_COF_AELevel3_42                       (MCPARAMID)( 9606 << 14)
+#define MC_COF_AELevel4_42                       (MCPARAMID)( 9607 << 14)
+#define MC_COF_AELevel5_42                       (MCPARAMID)( 9608 << 14)
+#define MC_COF_AELevel6_42                       (MCPARAMID)( 9609 << 14)
+#define MC_COF_AELevel7_42                       (MCPARAMID)( 9610 << 14)
+#define MC_COF_AELevel8_42                       (MCPARAMID)( 9611 << 14)
+#define MC_COF_AELevel1_43                       (MCPARAMID)( 9612 << 14)
+#define MC_COF_AELevel2_43                       (MCPARAMID)( 9613 << 14)
+#define MC_COF_AELevel3_43                       (MCPARAMID)( 9614 << 14)
+#define MC_COF_AELevel4_43                       (MCPARAMID)( 9615 << 14)
+#define MC_COF_AELevel5_43                       (MCPARAMID)( 9616 << 14)
+#define MC_COF_AELevel6_43                       (MCPARAMID)( 9617 << 14)
+#define MC_COF_AELevel7_43                       (MCPARAMID)( 9618 << 14)
+#define MC_COF_AELevel8_43                       (MCPARAMID)( 9619 << 14)
+#define MC_COF_AELevel1_44                       (MCPARAMID)( 9620 << 14)
+#define MC_COF_AELevel2_44                       (MCPARAMID)( 9621 << 14)
+#define MC_COF_AELevel3_44                       (MCPARAMID)( 9622 << 14)
+#define MC_COF_AELevel4_44                       (MCPARAMID)( 9623 << 14)
+#define MC_COF_AELevel5_44                       (MCPARAMID)( 9624 << 14)
+#define MC_COF_AELevel6_44                       (MCPARAMID)( 9625 << 14)
+#define MC_COF_AELevel7_44                       (MCPARAMID)( 9626 << 14)
+#define MC_COF_AELevel8_44                       (MCPARAMID)( 9627 << 14)
+#define MC_COF_AELevel1_45                       (MCPARAMID)( 9628 << 14)
+#define MC_COF_AELevel2_45                       (MCPARAMID)( 9629 << 14)
+#define MC_COF_AELevel3_45                       (MCPARAMID)( 9630 << 14)
+#define MC_COF_AELevel4_45                       (MCPARAMID)( 9631 << 14)
+#define MC_COF_AELevel5_45                       (MCPARAMID)( 9632 << 14)
+#define MC_COF_AELevel6_45                       (MCPARAMID)( 9633 << 14)
+#define MC_COF_AELevel7_45                       (MCPARAMID)( 9634 << 14)
+#define MC_COF_AELevel8_45                       (MCPARAMID)( 9635 << 14)
+#define MC_COF_AELevel1_46                       (MCPARAMID)( 9636 << 14)
+#define MC_COF_AELevel2_46                       (MCPARAMID)( 9637 << 14)
+#define MC_COF_AELevel3_46                       (MCPARAMID)( 9638 << 14)
+#define MC_COF_AELevel4_46                       (MCPARAMID)( 9639 << 14)
+#define MC_COF_AELevel5_46                       (MCPARAMID)( 9640 << 14)
+#define MC_COF_AELevel6_46                       (MCPARAMID)( 9641 << 14)
+#define MC_COF_AELevel7_46                       (MCPARAMID)( 9642 << 14)
+#define MC_COF_AELevel8_46                       (MCPARAMID)( 9643 << 14)
+#define MC_COF_AELevel1_47                       (MCPARAMID)( 9644 << 14)
+#define MC_COF_AELevel2_47                       (MCPARAMID)( 9645 << 14)
+#define MC_COF_AELevel3_47                       (MCPARAMID)( 9646 << 14)
+#define MC_COF_AELevel4_47                       (MCPARAMID)( 9647 << 14)
+#define MC_COF_AELevel5_47                       (MCPARAMID)( 9648 << 14)
+#define MC_COF_AELevel6_47                       (MCPARAMID)( 9649 << 14)
+#define MC_COF_AELevel7_47                       (MCPARAMID)( 9650 << 14)
+#define MC_COF_AELevel8_47                       (MCPARAMID)( 9651 << 14)
+#define MC_COF_AELevel1_48                       (MCPARAMID)( 9652 << 14)
+#define MC_COF_AELevel2_48                       (MCPARAMID)( 9653 << 14)
+#define MC_COF_AELevel3_48                       (MCPARAMID)( 9654 << 14)
+#define MC_COF_AELevel4_48                       (MCPARAMID)( 9655 << 14)
+#define MC_COF_AELevel5_48                       (MCPARAMID)( 9656 << 14)
+#define MC_COF_AELevel6_48                       (MCPARAMID)( 9657 << 14)
+#define MC_COF_AELevel7_48                       (MCPARAMID)( 9658 << 14)
+#define MC_COF_AELevel8_48                       (MCPARAMID)( 9659 << 14)
+#define MC_COF_AELevel1_49                       (MCPARAMID)( 9660 << 14)
+#define MC_COF_AELevel2_49                       (MCPARAMID)( 9661 << 14)
+#define MC_COF_AELevel3_49                       (MCPARAMID)( 9662 << 14)
+#define MC_COF_AELevel4_49                       (MCPARAMID)( 9663 << 14)
+#define MC_COF_AELevel5_49                       (MCPARAMID)( 9664 << 14)
+#define MC_COF_AELevel6_49                       (MCPARAMID)( 9665 << 14)
+#define MC_COF_AELevel7_49                       (MCPARAMID)( 9666 << 14)
+#define MC_COF_AELevel8_49                       (MCPARAMID)( 9667 << 14)
+#define MC_COF_AELevel1_50                       (MCPARAMID)( 9668 << 14)
+#define MC_COF_AELevel2_50                       (MCPARAMID)( 9669 << 14)
+#define MC_COF_AELevel3_50                       (MCPARAMID)( 9670 << 14)
+#define MC_COF_AELevel4_50                       (MCPARAMID)( 9671 << 14)
+#define MC_COF_AELevel5_50                       (MCPARAMID)( 9672 << 14)
+#define MC_COF_AELevel6_50                       (MCPARAMID)( 9673 << 14)
+#define MC_COF_AELevel7_50                       (MCPARAMID)( 9674 << 14)
+#define MC_COF_AELevel8_50                       (MCPARAMID)( 9675 << 14)
+#define MC_COF_AELevel1_51                       (MCPARAMID)( 9676 << 14)
+#define MC_COF_AELevel2_51                       (MCPARAMID)( 9677 << 14)
+#define MC_COF_AELevel3_51                       (MCPARAMID)( 9678 << 14)
+#define MC_COF_AELevel4_51                       (MCPARAMID)( 9679 << 14)
+#define MC_COF_AELevel5_51                       (MCPARAMID)( 9680 << 14)
+#define MC_COF_AELevel6_51                       (MCPARAMID)( 9681 << 14)
+#define MC_COF_AELevel7_51                       (MCPARAMID)( 9682 << 14)
+#define MC_COF_AELevel8_51                       (MCPARAMID)( 9683 << 14)
+#define MC_COF_AELevel1_52                       (MCPARAMID)( 9684 << 14)
+#define MC_COF_AELevel2_52                       (MCPARAMID)( 9685 << 14)
+#define MC_COF_AELevel3_52                       (MCPARAMID)( 9686 << 14)
+#define MC_COF_AELevel4_52                       (MCPARAMID)( 9687 << 14)
+#define MC_COF_AELevel5_52                       (MCPARAMID)( 9688 << 14)
+#define MC_COF_AELevel6_52                       (MCPARAMID)( 9689 << 14)
+#define MC_COF_AELevel7_52                       (MCPARAMID)( 9690 << 14)
+#define MC_COF_AELevel8_52                       (MCPARAMID)( 9691 << 14)
+#define MC_COF_AELevel1_53                       (MCPARAMID)( 9692 << 14)
+#define MC_COF_AELevel2_53                       (MCPARAMID)( 9693 << 14)
+#define MC_COF_AELevel3_53                       (MCPARAMID)( 9694 << 14)
+#define MC_COF_AELevel4_53                       (MCPARAMID)( 9695 << 14)
+#define MC_COF_AELevel5_53                       (MCPARAMID)( 9696 << 14)
+#define MC_COF_AELevel6_53                       (MCPARAMID)( 9697 << 14)
+#define MC_COF_AELevel7_53                       (MCPARAMID)( 9698 << 14)
+#define MC_COF_AELevel8_53                       (MCPARAMID)( 9699 << 14)
+#define MC_COF_AELevel1_54                       (MCPARAMID)( 9700 << 14)
+#define MC_COF_AELevel2_54                       (MCPARAMID)( 9701 << 14)
+#define MC_COF_AELevel3_54                       (MCPARAMID)( 9702 << 14)
+#define MC_COF_AELevel4_54                       (MCPARAMID)( 9703 << 14)
+#define MC_COF_AELevel5_54                       (MCPARAMID)( 9704 << 14)
+#define MC_COF_AELevel6_54                       (MCPARAMID)( 9705 << 14)
+#define MC_COF_AELevel7_54                       (MCPARAMID)( 9706 << 14)
+#define MC_COF_AELevel8_54                       (MCPARAMID)( 9707 << 14)
+#define MC_COF_AELevel1_55                       (MCPARAMID)( 9708 << 14)
+#define MC_COF_AELevel2_55                       (MCPARAMID)( 9709 << 14)
+#define MC_COF_AELevel3_55                       (MCPARAMID)( 9710 << 14)
+#define MC_COF_AELevel4_55                       (MCPARAMID)( 9711 << 14)
+#define MC_COF_AELevel5_55                       (MCPARAMID)( 9712 << 14)
+#define MC_COF_AELevel6_55                       (MCPARAMID)( 9713 << 14)
+#define MC_COF_AELevel7_55                       (MCPARAMID)( 9714 << 14)
+#define MC_COF_AELevel8_55                       (MCPARAMID)( 9715 << 14)
+#define MC_COF_AELevel1_56                       (MCPARAMID)( 9716 << 14)
+#define MC_COF_AELevel2_56                       (MCPARAMID)( 9717 << 14)
+#define MC_COF_AELevel3_56                       (MCPARAMID)( 9718 << 14)
+#define MC_COF_AELevel4_56                       (MCPARAMID)( 9719 << 14)
+#define MC_COF_AELevel5_56                       (MCPARAMID)( 9720 << 14)
+#define MC_COF_AELevel6_56                       (MCPARAMID)( 9721 << 14)
+#define MC_COF_AELevel7_56                       (MCPARAMID)( 9722 << 14)
+#define MC_COF_AELevel8_56                       (MCPARAMID)( 9723 << 14)
+#define MC_COF_AELevel1_57                       (MCPARAMID)( 9724 << 14)
+#define MC_COF_AELevel2_57                       (MCPARAMID)( 9725 << 14)
+#define MC_COF_AELevel3_57                       (MCPARAMID)( 9726 << 14)
+#define MC_COF_AELevel4_57                       (MCPARAMID)( 9727 << 14)
+#define MC_COF_AELevel5_57                       (MCPARAMID)( 9728 << 14)
+#define MC_COF_AELevel6_57                       (MCPARAMID)( 9729 << 14)
+#define MC_COF_AELevel7_57                       (MCPARAMID)( 9730 << 14)
+#define MC_COF_AELevel8_57                       (MCPARAMID)( 9731 << 14)
+#define MC_COF_AELevel1_58                       (MCPARAMID)( 9732 << 14)
+#define MC_COF_AELevel2_58                       (MCPARAMID)( 9733 << 14)
+#define MC_COF_AELevel3_58                       (MCPARAMID)( 9734 << 14)
+#define MC_COF_AELevel4_58                       (MCPARAMID)( 9735 << 14)
+#define MC_COF_AELevel5_58                       (MCPARAMID)( 9736 << 14)
+#define MC_COF_AELevel6_58                       (MCPARAMID)( 9737 << 14)
+#define MC_COF_AELevel7_58                       (MCPARAMID)( 9738 << 14)
+#define MC_COF_AELevel8_58                       (MCPARAMID)( 9739 << 14)
+#define MC_COF_AELevel1_59                       (MCPARAMID)( 9740 << 14)
+#define MC_COF_AELevel2_59                       (MCPARAMID)( 9741 << 14)
+#define MC_COF_AELevel3_59                       (MCPARAMID)( 9742 << 14)
+#define MC_COF_AELevel4_59                       (MCPARAMID)( 9743 << 14)
+#define MC_COF_AELevel5_59                       (MCPARAMID)( 9744 << 14)
+#define MC_COF_AELevel6_59                       (MCPARAMID)( 9745 << 14)
+#define MC_COF_AELevel7_59                       (MCPARAMID)( 9746 << 14)
+#define MC_COF_AELevel8_59                       (MCPARAMID)( 9747 << 14)
+#define MC_COF_AELevel1_60                       (MCPARAMID)( 9748 << 14)
+#define MC_COF_AELevel2_60                       (MCPARAMID)( 9749 << 14)
+#define MC_COF_AELevel3_60                       (MCPARAMID)( 9750 << 14)
+#define MC_COF_AELevel4_60                       (MCPARAMID)( 9751 << 14)
+#define MC_COF_AELevel5_60                       (MCPARAMID)( 9752 << 14)
+#define MC_COF_AELevel6_60                       (MCPARAMID)( 9753 << 14)
+#define MC_COF_AELevel7_60                       (MCPARAMID)( 9754 << 14)
+#define MC_COF_AELevel8_60                       (MCPARAMID)( 9755 << 14)
+#define MC_COF_AELevel1_61                       (MCPARAMID)( 9756 << 14)
+#define MC_COF_AELevel2_61                       (MCPARAMID)( 9757 << 14)
+#define MC_COF_AELevel3_61                       (MCPARAMID)( 9758 << 14)
+#define MC_COF_AELevel4_61                       (MCPARAMID)( 9759 << 14)
+#define MC_COF_AELevel5_61                       (MCPARAMID)( 9760 << 14)
+#define MC_COF_AELevel6_61                       (MCPARAMID)( 9761 << 14)
+#define MC_COF_AELevel7_61                       (MCPARAMID)( 9762 << 14)
+#define MC_COF_AELevel8_61                       (MCPARAMID)( 9763 << 14)
+#define MC_COF_AELevel1_62                       (MCPARAMID)( 9764 << 14)
+#define MC_COF_AELevel2_62                       (MCPARAMID)( 9765 << 14)
+#define MC_COF_AELevel3_62                       (MCPARAMID)( 9766 << 14)
+#define MC_COF_AELevel4_62                       (MCPARAMID)( 9767 << 14)
+#define MC_COF_AELevel5_62                       (MCPARAMID)( 9768 << 14)
+#define MC_COF_AELevel6_62                       (MCPARAMID)( 9769 << 14)
+#define MC_COF_AELevel7_62                       (MCPARAMID)( 9770 << 14)
+#define MC_COF_AELevel8_62                       (MCPARAMID)( 9771 << 14)
+#define MC_COF_AELevel1_63                       (MCPARAMID)( 9772 << 14)
+#define MC_COF_AELevel2_63                       (MCPARAMID)( 9773 << 14)
+#define MC_COF_AELevel3_63                       (MCPARAMID)( 9774 << 14)
+#define MC_COF_AELevel4_63                       (MCPARAMID)( 9775 << 14)
+#define MC_COF_AELevel5_63                       (MCPARAMID)( 9776 << 14)
+#define MC_COF_AELevel6_63                       (MCPARAMID)( 9777 << 14)
+#define MC_COF_AELevel7_63                       (MCPARAMID)( 9778 << 14)
+#define MC_COF_AELevel8_63                       (MCPARAMID)( 9779 << 14)
+#define MC_WBO_Status_OK                           1
+#define MC_WBO_Status_NOT_OK                       2
+#define MC_GrabberError_ThresholdError           (MCPARAMID)( 9780 << 14)
+#define MC_Bidul                                 (MCPARAMID)( 9781 << 14)
+#define MC_InputStyle_TTLHiZ                      13
+#define MC_InputStyle_TTLPD                       14
+#define MC_InputStyle_RS485                       15
+#define MC_InputStyle_DTTL                        16
+#define MC_Connector_C                            37
+#define MC_Connector_D                            38
+#define MC_SYNC_Line5_Field1_Dur                 (MCPARAMID)( 9782 << 14)
+#define MC_ACQZ1_L4RPT                           (MCPARAMID)( 9783 << 14)
+#define MC__BoardType__EXPRESS                    31
+#define MC_PoCL_Mode                             (MCPARAMID)( 9784 << 14)
+#define MC_PoCL_Mode_AUTO                          1
+#define MC_PoCL_Mode_OFF                           2
+#define MC_TapGeometry_4XE                        38
+#define MC_CLCAM_Geometry_TG_4XE                  23
+#define MC_AssyConfig_c                           17
+#define MC_AssyConfig_QUADXTAPEND                 18
+#define MC_ChannelTopology_QUADXTAPEND            17
+#define MC_HactiveRef_Px                         (MCPARAMID)( 9785 << 14)
+#define MC_VactiveRef_Ln                         (MCPARAMID)( 9786 << 14)
+#define MC_CalPatYValueInit                      (MCPARAMID)( 9787 << 14)
+#define MC_CalPatYValueVGap                      (MCPARAMID)( 9788 << 14)
+#define MC_CalPatYValueHGap                      (MCPARAMID)( 9789 << 14)
+#define MC_FEC_CalPatYValueIinit                 (MCPARAMID)( 9790 << 14)
+#define MC_FEC_CalPatYValueVGap                  (MCPARAMID)( 9791 << 14)
+#define MC_FEC_CalPatYValueHGap                  (MCPARAMID)( 9792 << 14)
+#define MC_FEC_CalPatYValueInit                  (MCPARAMID)( 9793 << 14)
+#define MC_SimBayerDecoderEnabled                (MCPARAMID)( 9794 << 14)
+#define MC_SimBayerDecoderEnabled_YES              1
+#define MC_SimBayerDecoderEnabled_NO               2
+#define MC_SimLuminanceBlenderEnabled            (MCPARAMID)( 9795 << 14)
+#define MC_SimLuminanceBlenderEnabled_YES          1
+#define MC_SimLuminanceBlenderEnabled_NO           2
+#define MC_SimWoiNb                              (MCPARAMID)( 9796 << 14)
+#define MC_AutomaticHfrSwitch                    (MCPARAMID)( 9797 << 14)
+#define MC_AutomaticHfrSwitch_ENABLE               1
+#define MC_AutomaticHfrSwitch_DISABLE              2
+#define MC_SimCameraDataWidth                    (MCPARAMID)( 9798 << 14)
+#define MC_SimCameraDataWidth_8BIT                 1
+#define MC_SimCameraDataWidth_10BIT                2
+#define MC_SimCameraDataWidth_12BIT                3
+#define MC_SimCameraDataWidth_14BIT                4
+#define MC_SimCameraDataWidth_16BIT                5
+#define MC__BoardName                            (MCPARAMID)( 9799 << 14)
+#define MC__BoardName__VALUE                       1
+#define MC__BoardName__EXPERT                      2
+#define MC__BoardName__COLORSCAN                   3
+#define MC__BoardName__AVENUE                      4
+#define MC__BoardName__CFA                         5
+#define MC__BoardName__EXPRESS                     6
+#define MC_PoCL_Mode_Filter                      (MCPARAMID)( 9800 << 14)
+#define MC__DCL_RawGrabbing                      (MCPARAMID)( 9801 << 14)
+#define MC__DCL_RawGrabbing_ENABLE                 1
+#define MC__DCL_RawGrabbing_DISABLE                2
+#define MC_PoCL_GroundJumper                     (MCPARAMID)( 9802 << 14)
+#define MC_PoCL_GroundJumper_CLOSE                 1
+#define MC_PoCL_GroundJumper_OPEN                  2
+#define MC_PoCL_GroundJumper_Filter              (MCPARAMID)( 9803 << 14)
+#define MC__DRS_CACQ_FxLADN                        4
+#define MC__DRS_CACQ_FxLADG                        5
+#define MC__DRS_CACQ_FCLNDN                        6
+#define MC__DRS_CACQ_FCLNDG                        7
+#define MC__DRS_CACQ_FALADN                        8
+#define MC__DRS_CACQ_FALADG                        9
+#define MC__DRS_CACQ_FCLADN                       10
+#define MC__DRS_CACQ_FCLADG                       11
+#define MC__HDC_DCNT_PlusOne                     (MCPARAMID)( 9804 << 14)
+#define MC__FBL_Mode                             (MCPARAMID)( 9805 << 14)
+#define MC__FBL_Mode_MANUAL                        1
+#define MC__FBL_Mode_AUTO                          2
+#define MC__FBL_AFL_Value                        (MCPARAMID)( 9806 << 14)
+#define MC_FrameBuffer_AlmostFullLevel           (MCPARAMID)( 9807 << 14)
+#define MC_FrameBuffer_HalfFullLevel             (MCPARAMID)( 9808 << 14)
+#define MC__FBL_HFL_Value                        (MCPARAMID)( 9809 << 14)
+#define MC_IDP_LeadingPixelCompCnt_Win1          (MCPARAMID)( 9810 << 14)
+#define MC_IDP_LeadingPixelCompCnt_Win2          (MCPARAMID)( 9811 << 14)
+#define MC_IDP_LeadingPixelCompCnt_Win3          (MCPARAMID)( 9812 << 14)
+#define MC_IDP_LeadingPixelCompCnt_Win4          (MCPARAMID)( 9813 << 14)
+#define MC_IDP_LeadingDataCnt_Lane1              (MCPARAMID)( 9814 << 14)
+#define MC_IDP_LeadingDataCnt_Lane2              (MCPARAMID)( 9815 << 14)
+#define MC_IDP_LeadingDataCnt_Lane3              (MCPARAMID)( 9816 << 14)
+#define MC_IDP_LeadingDataCnt_Lane4              (MCPARAMID)( 9817 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic1       (MCPARAMID)( 9818 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic2       (MCPARAMID)( 9819 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic3       (MCPARAMID)( 9820 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic4       (MCPARAMID)( 9821 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic5       (MCPARAMID)( 9822 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic6       (MCPARAMID)( 9823 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic7       (MCPARAMID)( 9824 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic8       (MCPARAMID)( 9825 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic1         (MCPARAMID)( 9826 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic2         (MCPARAMID)( 9827 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic3         (MCPARAMID)( 9828 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic4         (MCPARAMID)( 9829 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic5         (MCPARAMID)( 9830 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic6         (MCPARAMID)( 9831 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic7         (MCPARAMID)( 9832 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic8         (MCPARAMID)( 9833 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic1           (MCPARAMID)( 9834 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic2           (MCPARAMID)( 9835 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic3           (MCPARAMID)( 9836 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic4           (MCPARAMID)( 9837 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic5           (MCPARAMID)( 9838 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic6           (MCPARAMID)( 9839 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic7           (MCPARAMID)( 9840 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic8           (MCPARAMID)( 9841 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic1          (MCPARAMID)( 9842 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic2          (MCPARAMID)( 9843 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic3          (MCPARAMID)( 9844 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic4          (MCPARAMID)( 9845 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic5          (MCPARAMID)( 9846 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic6          (MCPARAMID)( 9847 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic7          (MCPARAMID)( 9848 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic8          (MCPARAMID)( 9849 << 14)
+#define MC__Board_Type__SYMPHONY                   9
+#define MC_CodeTarget                            (MCPARAMID)( 9850 << 14)
+#define MC__FPGA_Model_SYMPHONY_Q                  5
+#define MC_LineRateMode_EXPOSE                     5
+#define MC_Camera_VCC_G22V31CL_PoCL              220
+#define MC_Cable_CL_C05                          149
+#define MC_Cable_CL_C06                          150
+#define MC_CableName_Camera_Link_Standard_PoCL    94
+#define MC_CableName_Camera_Link_Miniature_PoCL   95
+#define MC_PinSTA_Source                         (MCPARAMID)( 9851 << 14)
+#define MC_PinSTA_Source_ON                        1
+#define MC_PinSTA_Source_OFF                       2
+#define MC_PinSTA_Source_STROBE                    3
+#define MC_PinSTA_Source_UNKNOWN                   4
+#define MC_PinSTB_Source                         (MCPARAMID)( 9852 << 14)
+#define MC_PinSTB_Source_ON                        1
+#define MC_PinSTB_Source_OFF                       2
+#define MC_PinSTB_Source_STROBE                    3
+#define MC_PinSTB_Source_UNKNOWN                   4
+#define MC_PinSTC_Source                         (MCPARAMID)( 9853 << 14)
+#define MC_PinSTC_Source_ON                        1
+#define MC_PinSTC_Source_OFF                       2
+#define MC_PinSTC_Source_STROBE                    3
+#define MC_PinSTC_Source_UNKNOWN                   4
+#define MC_PinSTD_Source                         (MCPARAMID)( 9854 << 14)
+#define MC_PinSTD_Source_ON                        1
+#define MC_PinSTD_Source_OFF                       2
+#define MC_PinSTD_Source_STROBE                    3
+#define MC_PinSTD_Source_UNKNOWN                   4
+#define MC_TrigCtl_TTLHiz                         13
+#define MC_TrigCtl_TTLPD                          14
+#define MC_TrigCtl_RS485                          15
+#define MC_TrigCtl_DTTL                           16
+#define MC__TrigLine_TRA                          32
+#define MC__TrigLine_TRB                          33
+#define MC__TrigLine_TRC                          34
+#define MC__TrigLine_TRD                          35
+#define MC__StrobeLine_STB                        17
+#define MC__StrobeLine_STC                        18
+#define MC__StrobeLine_STD                        19
+#define MC_InputPinName_TRA                       84
+#define MC_InputPinName_TRB                       85
+#define MC_InputPinName_TRC                       86
+#define MC_InputPinName_TRD                       87
+#define MC_InputPinName_FIN1                      88
+#define MC_InputPinName_FIN2                      89
+#define MC_InputPinName_FIN3                      90
+#define MC_InputPinName_FIN4                      91
+#define MC_ConnectorName_CAMA                     28
+#define MC_ConnectorName_CAMB                     29
+#define MC_ConnectorName_CAMC                     30
+#define MC_ConnectorName_CAMD                     31
+#define MC_ConnectorName_FACTORY                  32
+#define MC_OutputPinName_STB                      87
+#define MC_OutputPinName_STC                      88
+#define MC_OutputPinName_STD                      89
+#define MC_OutputPinName_FOUT1                    90
+#define MC_OutputPinName_FOUT2                    91
+#define MC_OutputPinName_FOUT3                    92
+#define MC_OutputPinName_FOUT4                    93
+#define MC_OutputPinName_FOUT5                    94
+#define MC_OutputPinName_FOUT6                    95
+#define MC_OutputPinName_FOUT7                    96
+#define MC_OutputPinName_FOUT8                    97
+#define MC_OutputPinName_FOUT9                    98
+#define MC_OutputPinName_FOUT10                   99
+#define MC_OutputPinName_FOUT11                  100
+#define MC_OutputPinName_FOUT12                  101
+#define MC_InputStyle_Filter_42                  (MCPARAMID)( 9855 << 14)
+#define MC_InputStyle_Filter_43                  (MCPARAMID)( 9856 << 14)
+#define MC_InputStyle_Filter_44                  (MCPARAMID)( 9857 << 14)
+#define MC_InputStyle_Filter_45                  (MCPARAMID)( 9858 << 14)
+#define MC_InputStyle_Filter_46                  (MCPARAMID)( 9859 << 14)
+#define MC_InputConfig_Filter_52                 (MCPARAMID)( 9860 << 14)
+#define MC_InputStyle_Filter_52                  (MCPARAMID)( 9861 << 14)
+#define MC_InputConfig_Filter_53                 (MCPARAMID)( 9862 << 14)
+#define MC_InputStyle_Filter_53                  (MCPARAMID)( 9863 << 14)
+#define MC_InputConfig_Filter_54                 (MCPARAMID)( 9864 << 14)
+#define MC_InputStyle_Filter_54                  (MCPARAMID)( 9865 << 14)
+#define MC_InputConfig_Filter_55                 (MCPARAMID)( 9866 << 14)
+#define MC_InputStyle_Filter_55                  (MCPARAMID)( 9867 << 14)
+#define MC_InputConfig_Filter_56                 (MCPARAMID)( 9868 << 14)
+#define MC_InputStyle_Filter_56                  (MCPARAMID)( 9869 << 14)
+#define MC_OutputState_20_LOOP1                    4
+#define MC_OutputState_20_LOOP2                    5
+#define MC_OutputState_42_LOOP1                    4
+#define MC_OutputState_42_LOOP2                    5
+#define MC_OutputStyle_Filter_42                 (MCPARAMID)( 9870 << 14)
+#define MC_OutputConfig_Filter_43                (MCPARAMID)( 9871 << 14)
+#define MC_OutputState_Filter_43                 (MCPARAMID)( 9872 << 14)
+#define MC_OutputState_43                        (MCPARAMID)( 9873 << 14)
+#define MC_OutputState_43_HOLD                     1
+#define MC_OutputState_43_LOW                      2
+#define MC_OutputState_43_HIGH                     3
+#define MC_OutputState_43_LOOP1                    4
+#define MC_OutputState_43_LOOP2                    5
+#define MC_OutputStyle_Filter_43                 (MCPARAMID)( 9874 << 14)
+#define MC_OutputConfig_Filter_44                (MCPARAMID)( 9875 << 14)
+#define MC_OutputState_Filter_44                 (MCPARAMID)( 9876 << 14)
+#define MC_OutputState_44                        (MCPARAMID)( 9877 << 14)
+#define MC_OutputState_44_HOLD                     1
+#define MC_OutputState_44_LOW                      2
+#define MC_OutputState_44_HIGH                     3
+#define MC_OutputState_44_LOOP1                    4
+#define MC_OutputState_44_LOOP2                    5
+#define MC_OutputStyle_Filter_44                 (MCPARAMID)( 9878 << 14)
+#define MC_OutputConfig_Filter_45                (MCPARAMID)( 9879 << 14)
+#define MC_OutputState_Filter_45                 (MCPARAMID)( 9880 << 14)
+#define MC_OutputState_45                        (MCPARAMID)( 9881 << 14)
+#define MC_OutputState_45_HOLD                     1
+#define MC_OutputState_45_LOW                      2
+#define MC_OutputState_45_HIGH                     3
+#define MC_OutputState_45_LOOP1                    4
+#define MC_OutputState_45_LOOP2                    5
+#define MC_OutputStyle_Filter_45                 (MCPARAMID)( 9882 << 14)
+#define MC_OutputConfig_Filter_46                (MCPARAMID)( 9883 << 14)
+#define MC_OutputState_Filter_46                 (MCPARAMID)( 9884 << 14)
+#define MC_OutputState_46                        (MCPARAMID)( 9885 << 14)
+#define MC_OutputState_46_HOLD                     1
+#define MC_OutputState_46_LOW                      2
+#define MC_OutputState_46_HIGH                     3
+#define MC_OutputState_46_LOOP1                    4
+#define MC_OutputState_46_LOOP2                    5
+#define MC_OutputStyle_Filter_46                 (MCPARAMID)( 9886 << 14)
+#define MC_OutputState_52_LOOP1                    4
+#define MC_OutputState_52_LOOP2                    5
+#define MC_OutputStyle_Filter_52                 (MCPARAMID)( 9887 << 14)
+#define MC_OutputState_53_LOOP1                    4
+#define MC_OutputState_53_LOOP2                    5
+#define MC_OutputStyle_Filter_53                 (MCPARAMID)( 9888 << 14)
+#define MC_OutputState_54_LOOP1                    4
+#define MC_OutputState_54_LOOP2                    5
+#define MC_OutputStyle_Filter_54                 (MCPARAMID)( 9889 << 14)
+#define MC_OutputState_55_LOOP1                    4
+#define MC_OutputState_55_LOOP2                    5
+#define MC_OutputStyle_Filter_55                 (MCPARAMID)( 9890 << 14)
+#define MC_OutputState_56_LOOP1                    4
+#define MC_OutputState_56_LOOP2                    5
+#define MC_OutputStyle_Filter_56                 (MCPARAMID)( 9891 << 14)
+#define MC_OutputConfig_Filter_61                (MCPARAMID)( 9892 << 14)
+#define MC_OutputState_Filter_61                 (MCPARAMID)( 9893 << 14)
+#define MC_OutputState_61                        (MCPARAMID)( 9894 << 14)
+#define MC_OutputState_61_HOLD                     1
+#define MC_OutputState_61_LOW                      2
+#define MC_OutputState_61_HIGH                     3
+#define MC_OutputState_61_LOOP1                    4
+#define MC_OutputState_61_LOOP2                    5
+#define MC_OutputStyle_Filter_61                 (MCPARAMID)( 9895 << 14)
+#define MC_OutputConfig_Filter_62                (MCPARAMID)( 9896 << 14)
+#define MC_OutputState_Filter_62                 (MCPARAMID)( 9897 << 14)
+#define MC_OutputState_62                        (MCPARAMID)( 9898 << 14)
+#define MC_OutputState_62_HOLD                     1
+#define MC_OutputState_62_LOW                      2
+#define MC_OutputState_62_HIGH                     3
+#define MC_OutputState_62_LOOP1                    4
+#define MC_OutputState_62_LOOP2                    5
+#define MC_OutputStyle_Filter_62                 (MCPARAMID)( 9899 << 14)
+#define MC_OutputConfig_Filter_63                (MCPARAMID)( 9900 << 14)
+#define MC_OutputState_Filter_63                 (MCPARAMID)( 9901 << 14)
+#define MC_OutputState_63                        (MCPARAMID)( 9902 << 14)
+#define MC_OutputState_63_HOLD                     1
+#define MC_OutputState_63_LOW                      2
+#define MC_OutputState_63_HIGH                     3
+#define MC_OutputState_63_LOOP1                    4
+#define MC_OutputState_63_LOOP2                    5
+#define MC_OutputStyle_Filter_63                 (MCPARAMID)( 9903 << 14)
+#define MC_OutputConfig_Filter_64                (MCPARAMID)( 9904 << 14)
+#define MC_OutputState_Filter_64                 (MCPARAMID)( 9905 << 14)
+#define MC_OutputState_64                        (MCPARAMID)( 9906 << 14)
+#define MC_OutputState_64_HOLD                     1
+#define MC_OutputState_64_LOW                      2
+#define MC_OutputState_64_HIGH                     3
+#define MC_OutputState_64_LOOP1                    4
+#define MC_OutputState_64_LOOP2                    5
+#define MC_OutputStyle_Filter_64                 (MCPARAMID)( 9907 << 14)
+#define MC_OutputConfig_Filter_65                (MCPARAMID)( 9908 << 14)
+#define MC_OutputState_Filter_65                 (MCPARAMID)( 9909 << 14)
+#define MC_OutputState_65                        (MCPARAMID)( 9910 << 14)
+#define MC_OutputState_65_HOLD                     1
+#define MC_OutputState_65_LOW                      2
+#define MC_OutputState_65_HIGH                     3
+#define MC_OutputState_65_LOOP1                    4
+#define MC_OutputState_65_LOOP2                    5
+#define MC_OutputStyle_Filter_65                 (MCPARAMID)( 9911 << 14)
+#define MC_OutputConfig_Filter_66                (MCPARAMID)( 9912 << 14)
+#define MC_OutputState_Filter_66                 (MCPARAMID)( 9913 << 14)
+#define MC_OutputState_66                        (MCPARAMID)( 9914 << 14)
+#define MC_OutputState_66_HOLD                     1
+#define MC_OutputState_66_LOW                      2
+#define MC_OutputState_66_HIGH                     3
+#define MC_OutputState_66_LOOP1                    4
+#define MC_OutputState_66_LOOP2                    5
+#define MC_OutputStyle_Filter_66                 (MCPARAMID)( 9915 << 14)
+#define MC_OutputConfig_Filter_67                (MCPARAMID)( 9916 << 14)
+#define MC_OutputState_Filter_67                 (MCPARAMID)( 9917 << 14)
+#define MC_OutputState_67                        (MCPARAMID)( 9918 << 14)
+#define MC_OutputState_67_HOLD                     1
+#define MC_OutputState_67_LOW                      2
+#define MC_OutputState_67_HIGH                     3
+#define MC_OutputState_67_LOOP1                    4
+#define MC_OutputState_67_LOOP2                    5
+#define MC_OutputStyle_Filter_67                 (MCPARAMID)( 9919 << 14)
+#define MC_OutputConfig_Filter_68                (MCPARAMID)( 9920 << 14)
+#define MC_OutputState_Filter_68                 (MCPARAMID)( 9921 << 14)
+#define MC_OutputState_68                        (MCPARAMID)( 9922 << 14)
+#define MC_OutputState_68_HOLD                     1
+#define MC_OutputState_68_LOW                      2
+#define MC_OutputState_68_HIGH                     3
+#define MC_OutputState_68_LOOP1                    4
+#define MC_OutputState_68_LOOP2                    5
+#define MC_OutputStyle_Filter_68                 (MCPARAMID)( 9923 << 14)
+#define MC_OutputConfig_Filter_69                (MCPARAMID)( 9924 << 14)
+#define MC_OutputState_Filter_69                 (MCPARAMID)( 9925 << 14)
+#define MC_OutputState_69                        (MCPARAMID)( 9926 << 14)
+#define MC_OutputState_69_HOLD                     1
+#define MC_OutputState_69_LOW                      2
+#define MC_OutputState_69_HIGH                     3
+#define MC_OutputState_69_LOOP1                    4
+#define MC_OutputState_69_LOOP2                    5
+#define MC_OutputStyle_Filter_69                 (MCPARAMID)( 9927 << 14)
+#define MC_OutputConfig_Filter_70                (MCPARAMID)( 9928 << 14)
+#define MC_OutputState_Filter_70                 (MCPARAMID)( 9929 << 14)
+#define MC_OutputState_70                        (MCPARAMID)( 9930 << 14)
+#define MC_OutputState_70_HOLD                     1
+#define MC_OutputState_70_LOW                      2
+#define MC_OutputState_70_HIGH                     3
+#define MC_OutputState_70_LOOP1                    4
+#define MC_OutputState_70_LOOP2                    5
+#define MC_OutputStyle_Filter_70                 (MCPARAMID)( 9931 << 14)
+#define MC_OutputConfig_Filter_71                (MCPARAMID)( 9932 << 14)
+#define MC_OutputState_Filter_71                 (MCPARAMID)( 9933 << 14)
+#define MC_OutputState_71                        (MCPARAMID)( 9934 << 14)
+#define MC_OutputState_71_HOLD                     1
+#define MC_OutputState_71_LOW                      2
+#define MC_OutputState_71_HIGH                     3
+#define MC_OutputState_71_LOOP1                    4
+#define MC_OutputState_71_LOOP2                    5
+#define MC_OutputStyle_Filter_71                 (MCPARAMID)( 9935 << 14)
+#define MC_OutputConfig_Filter_72                (MCPARAMID)( 9936 << 14)
+#define MC_OutputState_Filter_72                 (MCPARAMID)( 9937 << 14)
+#define MC_OutputState_72                        (MCPARAMID)( 9938 << 14)
+#define MC_OutputState_72_HOLD                     1
+#define MC_OutputState_72_LOW                      2
+#define MC_OutputState_72_HIGH                     3
+#define MC_OutputState_72_LOOP1                    4
+#define MC_OutputState_72_LOOP2                    5
+#define MC_OutputStyle_Filter_72                 (MCPARAMID)( 9939 << 14)
+#define MC_FLT_FIR3S                               3
+#define MC_FLT_FIR5S                               4
+#define MC_FLT_Filter                            (MCPARAMID)( 9940 << 14)
+#define MC_PoCL_Status                           (MCPARAMID)( 9941 << 14)
+#define MC_PoCL_Status_NO_CAMERA                   1
+#define MC_PoCL_Status_CONVENTIONAL_CAMERA         2
+#define MC_PoCL_Status_PoCL_CAMERA                 3
+#define MC_PoCL_Status_Filter                    (MCPARAMID)( 9942 << 14)
+#define MC_PoCL_PowerInput                       (MCPARAMID)( 9943 << 14)
+#define MC_PoCL_PowerInput_AUTO                    1
+#define MC_PoCL_PowerInput_OFF                     2
+#define MC_PoCL_Filter                           (MCPARAMID)( 9944 << 14)
+#define MC_FrameBuffer_AlmostFullLevel_Ln        (MCPARAMID)( 9945 << 14)
+#define MC_FrameBuffer_HalfFullLevel_Ln          (MCPARAMID)( 9946 << 14)
+#define MC_CommandBuffer_AlmostFullLevel_Ln      (MCPARAMID)( 9947 << 14)
+#define MC_CommandBuffer_HalfFullLevel_Ln        (MCPARAMID)( 9948 << 14)
+#define MC_FrameBufferSize_byte                  (MCPARAMID)( 9949 << 14)
+#define MC_WIC_WindowPitch_byte                  (MCPARAMID)( 9950 << 14)
+#define MC_FrameBufferFull                       (MCPARAMID)( 9951 << 14)
+#define MC_GrabberOverrun_FrameBuffer            (MCPARAMID)( 9952 << 14)
+#define MC_GrabberError_Vdma_Incoherency         (MCPARAMID)( 9953 << 14)
+#define MC_GrabberError_Vdma_RepairStream        (MCPARAMID)( 9954 << 14)
+#define MC_GrabberError_Vdma_StreamFifoOvrUdr    (MCPARAMID)( 9955 << 14)
+#define MC_GrabberError_IntractionDpFifoOvr      (MCPARAMID)( 9956 << 14)
+#define MC_GrabberError_AcqVsXfr_Incoherency     (MCPARAMID)( 9957 << 14)
+#define MC_GrabberError_ADRCommandFIFO_Incoherency_2 (MCPARAMID)( 9958 << 14)
+#define MC_GrabberError_ADRCommandFIFO_Incoherency_1 (MCPARAMID)( 9959 << 14)
+#define MC_GrabberOverrun_Vdma_EarlyEndOfXfr     (MCPARAMID)( 9960 << 14)
+#define MC_SurfacePlaneName_YUV                    8
+#define MC_SurfacePlaneName_U                      9
+#define MC_SurfacePlaneName_V                     10
+#define MC_GrabberError_Number_19                (MCPARAMID)( 9961 << 14)
+#define MC_GrabberError_Number_16                (MCPARAMID)( 9962 << 14)
+#define MC_GrabberError_Number_09                (MCPARAMID)( 9963 << 14)
+#define MC_GrabberError_Number_08                (MCPARAMID)( 9964 << 14)
+#define MC_GrabberError_Number_07                (MCPARAMID)( 9965 << 14)
+#define MC_GrabberError_Number_06                (MCPARAMID)( 9966 << 14)
+#define MC_GrabberError_Number_05                (MCPARAMID)( 9967 << 14)
+#define MC_GrabberError_Number_04                (MCPARAMID)( 9968 << 14)
+#define MC_GrabberError_Number_03                (MCPARAMID)( 9969 << 14)
+#define MC_GrabberError_Number_02                (MCPARAMID)( 9970 << 14)
+#define MC_GrabberError_Number_01                (MCPARAMID)( 9971 << 14)
+#define MC_GrabberOverrun_Number_09              (MCPARAMID)( 9972 << 14)
+#define MC_GrabberOverrun_Number_08              (MCPARAMID)( 9973 << 14)
+#define MC_GrabberOverrun_Number_07              (MCPARAMID)( 9974 << 14)
+#define MC_GrabberOverrun_Number_06              (MCPARAMID)( 9975 << 14)
+#define MC_GrabberOverrun_Number_05              (MCPARAMID)( 9976 << 14)
+#define MC_GrabberOverrun_Number_04              (MCPARAMID)( 9977 << 14)
+#define MC_GrabberOverrun_Number_03              (MCPARAMID)( 9978 << 14)
+#define MC_GrabberOverrun_Number_02              (MCPARAMID)( 9979 << 14)
+#define MC_GrabberOverrun_Number_01              (MCPARAMID)( 9980 << 14)
+#define MC_ColorFormat_RGB64                     107
+#define MC_OutputFormatterConfig_RGB64            47
+#define MC_NumOfAssy                             (MCPARAMID)( 9981 << 14)
+#define MC_NumOfAssy_ONE                           1
+#define MC_NumOfAssy_TWO                           2
+#define MC_NumOfAssy_THREE                         3
+#define MC_NumOfAssy_FOUR                          4
+#define MC_NumOfAssy_SIX                           5
+#define MC_NumOfAssy_EIGHT                         6
+#define MC_NumOfWindows                          (MCPARAMID)( 9982 << 14)
+#define MC_NumOfWindows_ONE                        1
+#define MC_NumOfWindows_TWO                        2
+#define MC_NumOfWindows_THREE                      3
+#define MC_NumOfWindows_FOUR                       4
+#define MC_NumOfWindows_EIGHT                      5
+#define MC_NumOfAssyPerWindow                    (MCPARAMID)( 9983 << 14)
+#define MC_GrabberError_Vdma_1                   (MCPARAMID)( 9984 << 14)
+#define MC_GrabberError_Vdma_2                   (MCPARAMID)( 9985 << 14)
+#define MC_GrabberError_Vdma_3                   (MCPARAMID)( 9986 << 14)
+#define MC_GrabberError_Intraction               (MCPARAMID)( 9987 << 14)
+#define MC_GrabberError_AcqVsXfr                 (MCPARAMID)( 9988 << 14)
+#define MC_GrabberError_AdrCmdFifo_2             (MCPARAMID)( 9989 << 14)
+#define MC_GrabberError_AdrCmdFifo_1             (MCPARAMID)( 9990 << 14)
+#define MC__CDA_REFASSYNR                        (MCPARAMID)( 9991 << 14)
+#define MC__CDA_REFASSYNR_LOWEST                   1
+#define MC__CDA_REFASSYNR_HIGHEST                  2
+#define MC_SeqLength_Ln_WEB                      (MCPARAMID)( 9992 << 14)
+#define MC_SeqLength_Ln_LONGPAGE                 (MCPARAMID)( 9993 << 14)
+#define MC_Toto_TITI                               3
+#define MC_BoardFamily                           (MCPARAMID)( 9994 << 14)
+#define MC_BoardFamily_PICOLO_VIDEOBRIDGE          1
+#define MC_BoardMajorType                        (MCPARAMID)( 9995 << 14)
+#define MC_BoardMajorType_PICOLO_DILIGENT          1
+#define MC_BoardMajorType_PICOLO_ALERT             2
+#define MC__PM_N0_Float                          (MCPARAMID)( 9996 << 14)
+#define MC_RCR_Effective                         (MCPARAMID)( 9997 << 14)
+#define MC__PM_N0_Max                            (MCPARAMID)( 9998 << 14)
+#define MC__DynamicFineShift                     (MCPARAMID)( 9999 << 14)
+#define MC__DynamicFineShift_Enable              (MCPARAMID)(10000 << 14)
+#define MC__DynamicFineShift_Enable_ON             1
+#define MC__DynamicFineShift_Enable_OFF            2
+#define MC__DynamicFineShift_Enable_Filt         (MCPARAMID)(10001 << 14)
+#define MC_InputConfig_Filter_61                 (MCPARAMID)(10002 << 14)
+#define MC_InputStyle_Filter_61                  (MCPARAMID)(10003 << 14)
+#define MC_InputConfig_Filter_62                 (MCPARAMID)(10004 << 14)
+#define MC_InputStyle_Filter_62                  (MCPARAMID)(10005 << 14)
+#define MC_InputConfig_Filter_63                 (MCPARAMID)(10006 << 14)
+#define MC_InputStyle_Filter_63                  (MCPARAMID)(10007 << 14)
+#define MC_InputConfig_Filter_64                 (MCPARAMID)(10008 << 14)
+#define MC_InputStyle_Filter_64                  (MCPARAMID)(10009 << 14)
+#define MC_InputFilter_Filter_1                  (MCPARAMID)(10010 << 14)
+#define MC_InputFilter_Filter_2                  (MCPARAMID)(10011 << 14)
+#define MC_InputFilter_Filter_3                  (MCPARAMID)(10012 << 14)
+#define MC_InputFilter_Filter_4                  (MCPARAMID)(10013 << 14)
+#define MC_InputFilter_Filter_17                 (MCPARAMID)(10014 << 14)
+#define MC_InputFilter_Filter_18                 (MCPARAMID)(10015 << 14)
+#define MC_InputFilter_Filter_19                 (MCPARAMID)(10016 << 14)
+#define MC_InputFilter_Filter_20                 (MCPARAMID)(10017 << 14)
+#define MC_InputFilter_Filter_22                 (MCPARAMID)(10018 << 14)
+#define MC_InputFilter_Filter_23                 (MCPARAMID)(10019 << 14)
+#define MC_InputFilter_Filter_24                 (MCPARAMID)(10020 << 14)
+#define MC_InputFilter_Filter_25                 (MCPARAMID)(10021 << 14)
+#define MC_InputFilter_Filter_26                 (MCPARAMID)(10022 << 14)
+#define MC_InputFilter_Filter_32                 (MCPARAMID)(10023 << 14)
+#define MC_InputFilter_Filter_33                 (MCPARAMID)(10024 << 14)
+#define MC_InputFilter_Filter_34                 (MCPARAMID)(10025 << 14)
+#define MC_InputFilter_Filter_35                 (MCPARAMID)(10026 << 14)
+#define MC_InputFilter_Filter_36                 (MCPARAMID)(10027 << 14)
+#define MC_InputFilter_Filter_42                 (MCPARAMID)(10028 << 14)
+#define MC_InputFilter_Filter_43                 (MCPARAMID)(10029 << 14)
+#define MC_InputFilter_Filter_44                 (MCPARAMID)(10030 << 14)
+#define MC_InputFilter_Filter_45                 (MCPARAMID)(10031 << 14)
+#define MC_InputFilter_Filter_46                 (MCPARAMID)(10032 << 14)
+#define MC_InputFilter_Filter_52                 (MCPARAMID)(10033 << 14)
+#define MC_InputFilter_Filter_53                 (MCPARAMID)(10034 << 14)
+#define MC_InputFilter_Filter_54                 (MCPARAMID)(10035 << 14)
+#define MC_InputFilter_Filter_55                 (MCPARAMID)(10036 << 14)
+#define MC_InputFilter_Filter_56                 (MCPARAMID)(10037 << 14)
+#define MC_SerialControlC                        (MCPARAMID)(10038 << 14)
+#define MC_SerialControlD                        (MCPARAMID)(10039 << 14)
+#define MC_PoCL_PowerInput_ON                      3
+#define MC_BoardFamily_D3Series                    2
+#define MC_BoardFamily_GrablinkSeries              3
+#define MC_BoardFamily_PicoloSeries                4
+#define MC_AbsGrabberIx                          (MCPARAMID)(10040 << 14)
+#define MC_Sim_PartialMode                       (MCPARAMID)(10041 << 14)
+#define MC_Sim_PartialMode_TRUE                    1
+#define MC_Sim_PartialMode_FALSE                   2
+#define MC_InputFilter_Filter_28                 (MCPARAMID)(10042 << 14)
+#define MC_InputFilter_Filter_29                 (MCPARAMID)(10043 << 14)
+#define MC_InputFilter_Filter_38                 (MCPARAMID)(10044 << 14)
+#define MC_InputFilter_Filter_39                 (MCPARAMID)(10045 << 14)
+#define MC_Toto_NO_VALUE_3                         4
+#define MC_Kernel_F20_L1_HIRES                    20
+#define MC_Kernel_F25_L1_NTSC                     21
+#define MC_Kernel_F30_L1_PAL                      22
+#define MC_Kernel_F33_L1_HIRES                    23
+#define MC_Kernel_F37_L1_NTSC                     24
+#define MC_Kernel_F44_L1_PAL                      25
+#define MC_Kernel_F49_L1_NTSC                     26
+#define MC_Kernel_F59_L1_PAL                      27
+#define MC_Kernel_F65_L1_HIRES                    28
+#define MC_FSS_ImageSize_byte                    (MCPARAMID)(10046 << 14)
+#define MC_FSS_FBSIZE_img                        (MCPARAMID)(10047 << 14)
+#define MC_FSS_MaxImageSize_Check                (MCPARAMID)(10048 << 14)
+#define MC_FSS_MaxImageSize_Check_PASS             1
+#define MC_FSS_MaxImageSize_Check_FAIL             2
+#define MC_MaxHactive_Px_Check                   (MCPARAMID)(10049 << 14)
+#define MC_MaxHactive_Px_Check_PASS                1
+#define MC_MaxHactive_Px_Check_FAIL                2
+#define MC_MaxVactive_Ln_Check                   (MCPARAMID)(10050 << 14)
+#define MC_MaxVactive_Ln_Check_PASS                1
+#define MC_MaxVactive_Ln_Check_FAIL                2
+#define MC_PciBridgeType                         (MCPARAMID)(10051 << 14)
+#define MC_PciBridgeType_Pci9054                   1
+#define MC_PciBridgeType_Pci9656                   2
+#define MC_PciBridgeType_Pex8311                   3
+#define MC_PciBridgeType_Epec4816                  4
+#define MC_PciBridgeType_Unknown                   5
+#define MC_LocalBusWordSize                      (MCPARAMID)(10052 << 14)
+#define MC_LocalBusWordSize_LocalBus32bit          1
+#define MC_LocalBusWordSize_LocalBus64bit          2
+#define MC_LocalBusWordSize_Unknown                3
+#define MC__BoardName__                            7
+#define MC_ResetCtl_Filter                       (MCPARAMID)(10053 << 14)
+#define MC_AuxResetCtl_Filter                    (MCPARAMID)(10054 << 14)
+#define MC_AuxResetEdge_Filter                   (MCPARAMID)(10055 << 14)
+#define MC_ExposeOverlap_Filter                  (MCPARAMID)(10056 << 14)
+#define MC_PixelClkCtl_Filter                    (MCPARAMID)(10057 << 14)
+#define MC_PixelClkEdge_Filter                   (MCPARAMID)(10058 << 14)
+#define MC_CableComp_Filter                      (MCPARAMID)(10059 << 14)
+#define MC_TrigLine_TRA                           28
+#define MC_TrigLine_TRB                           29
+#define MC_TrigLine_TRC                           30
+#define MC_TrigLine_TRD                           31
+#define MC_InputFilter_Filter_61                 (MCPARAMID)(10060 << 14)
+#define MC_InputFilter_Filter_62                 (MCPARAMID)(10061 << 14)
+#define MC_InputFilter_Filter_63                 (MCPARAMID)(10062 << 14)
+#define MC_InputFilter_Filter_64                 (MCPARAMID)(10063 << 14)
+#define MC_InputPinName_ACC1                      92
+#define MC_InputPinName_ACC2                      93
+#define MC_InputPinName_ACC3                      94
+#define MC_InputPinName_ACC4                      95
+#define MC_InputPinName_ACC5                      96
+#define MC_InputPinName_BCC1                      97
+#define MC_InputPinName_BCC2                      98
+#define MC_InputPinName_BCC3                      99
+#define MC_InputPinName_BCC4                     100
+#define MC_InputPinName_BCC5                     101
+#define MC_InputPinName_CCC1                     102
+#define MC_InputPinName_CCC2                     103
+#define MC_InputPinName_CCC3                     104
+#define MC_InputPinName_CCC4                     105
+#define MC_InputPinName_CCC5                     106
+#define MC_InputPinName_DCC1                     107
+#define MC_InputPinName_DCC2                     108
+#define MC_InputPinName_DCC3                     109
+#define MC_InputPinName_DCC4                     110
+#define MC_InputPinName_DCC5                     111
+#define MC_ConnectorName_CAMERAS                  33
+#define MC_OutputPinName_ACC1                    102
+#define MC_OutputPinName_ACC2                    103
+#define MC_OutputPinName_ACC3                    104
+#define MC_OutputPinName_ACC4                    105
+#define MC_OutputPinName_ACC5                    106
+#define MC_OutputPinName_BCC1                    107
+#define MC_OutputPinName_BCC2                    108
+#define MC_OutputPinName_BCC3                    109
+#define MC_OutputPinName_BCC4                    110
+#define MC_OutputPinName_BCC5                    111
+#define MC_OutputPinName_CCC1                    112
+#define MC_OutputPinName_CCC2                    113
+#define MC_OutputPinName_CCC3                    114
+#define MC_OutputPinName_CCC4                    115
+#define MC_OutputPinName_CCC5                    116
+#define MC_OutputPinName_DCC1                    117
+#define MC_OutputPinName_DCC2                    118
+#define MC_OutputPinName_DCC3                    119
+#define MC_OutputPinName_DCC4                    120
+#define MC_OutputPinName_DCC5                    121
+#define MC_NullSet_Filter                        (MCPARAMID)(10064 << 14)
+#define MC_FullSet_Filter                        (MCPARAMID)(10065 << 14)
+#define MC_NONE_Filter                           (MCPARAMID)(10066 << 14)
+#define MC_OFF_Filter                            (MCPARAMID)(10067 << 14)
+#define MC_AuxResetLine_Feature                  (MCPARAMID)(10068 << 14)
+#define MC_AuxResetLine_Feature_Available          1
+#define MC_AuxResetLine_Feature_NotAvailable       2
+#define MC_CamCtlElecStyle_Filter                (MCPARAMID)(10069 << 14)
+#define MC_CamFileBoardName                      (MCPARAMID)(10070 << 14)
+#define MC_CamFileBoardName_Grablink_Avenue        1
+#define MC_CamFileBoardName_Grablink_Express       2
+#define MC_CamFileBoardName_Grablink_Quickpack_CFA   3
+#define MC_CamFileBoardName_Grablink_Quickpack_CFA_PCIe   4
+#define MC_RHA_WithoutTrim                       (MCPARAMID)(10071 << 14)
+#define MC_RHA_Max                               (MCPARAMID)(10072 << 14)
+#define MC_SampleTrim_Min                        (MCPARAMID)(10073 << 14)
+#define MC_SampleTrim_Max                        (MCPARAMID)(10074 << 14)
+#define MC_PixelClk_Hz_Max                       (MCPARAMID)(10075 << 14)
+#define MC_SampleTrim_Bounded                    (MCPARAMID)(10076 << 14)
+#define MC_CamFileBoardName_Domino_Alpha_2         5
+#define MC_CamFileBoardName_Grablink_Expert_2      6
+#define MC_CamFileBoardName_Domino_Iota            7
+#define MC_CamFileBoardName_Domino_Delta           8
+#define MC_CamFileBoardName_Domino_Harmony         9
+#define MC_CamFileBoardName_Domino_Melody         10
+#define MC_CamFileBoardName_Domino_Symphony       11
+#define MC_CamFileBoardName_Domino_Symphony_PCIe  12
+#define MC_CamFileBoardName__Allowed_CamFileBoardNames_  13
+#define MC_CamFileBoardName_Grablink_Quickpack_ColorScan  14
+#define MC_CamFileBoardName_Grablink_Value        15
+#define MC_OutputState_17_LOOP                     8
+#define MC_OutputState_18_LOOP                     8
+#define MC_OutputState_19_LOOP                     8
+#define MC_OutputState_20_LOOP                     6
+#define MC_OutputState_22_LOOP                     8
+#define MC_OutputState_23_LOOP                     8
+#define MC_OutputState_24_LOOP                     8
+#define MC_OutputState_25_LOOP                     6
+#define MC_OutputState_26_LOOP                     6
+#define MC_OutputState_32_LOOP                     8
+#define MC_OutputState_33_LOOP                     8
+#define MC_OutputState_34_LOOP                     8
+#define MC_OutputState_35_LOOP                     6
+#define MC_OutputState_36_LOOP                     6
+#define MC_OutputState_42_LOOP                     6
+#define MC_OutputState_43_LOOP                     6
+#define MC_OutputState_44_LOOP                     6
+#define MC_OutputState_45_LOOP                     6
+#define MC_OutputState_46_LOOP                     6
+#define MC_OutputState_52_LOOP                     6
+#define MC_OutputState_53_LOOP                     6
+#define MC_OutputState_54_LOOP                     6
+#define MC_OutputState_55_LOOP                     6
+#define MC_OutputState_56_LOOP                     6
+#define MC_OutputState_61_LOOP                     6
+#define MC_OutputState_62_LOOP                     6
+#define MC_OutputState_63_LOOP                     6
+#define MC_OutputState_64_LOOP                     6
+#define MC_OutputState_65_LOOP                     6
+#define MC_OutputState_66_LOOP                     6
+#define MC_OutputState_67_LOOP                     6
+#define MC_OutputState_68_LOOP                     6
+#define MC_OutputState_69_LOOP                     6
+#define MC_OutputState_70_LOOP                     6
+#define MC_OutputState_71_LOOP                     6
+#define MC_OutputState_72_LOOP                     6
+#define MC_OutputState_20_LOOP3                    7
+#define MC_OutputState_20_LOOP4                    8
+#define MC_OutputState_61_LOOP3                    7
+#define MC_OutputState_61_LOOP4                    8
+#define MC_OutputState_62_LOOP3                    7
+#define MC_OutputState_62_LOOP4                    8
+#define MC_OutputState_63_LOOP3                    7
+#define MC_OutputState_63_LOOP4                    8
+#define MC_OutputState_64_LOOP3                    7
+#define MC_OutputState_64_LOOP4                    8
+#define MC_OutputState_65_LOOP3                    7
+#define MC_OutputState_65_LOOP4                    8
+#define MC_OutputState_66_LOOP3                    7
+#define MC_OutputState_66_LOOP4                    8
+#define MC_OutputState_67_LOOP3                    7
+#define MC_OutputState_67_LOOP4                    8
+#define MC_OutputState_68_LOOP3                    7
+#define MC_OutputState_68_LOOP4                    8
+#define MC_OutputState_69_LOOP3                    7
+#define MC_OutputState_69_LOOP4                    8
+#define MC_OutputState_70_LOOP3                    7
+#define MC_OutputState_70_LOOP4                    8
+#define MC_OutputState_71_LOOP3                    7
+#define MC_OutputState_71_LOOP4                    8
+#define MC_OutputState_72_LOOP3                    7
+#define MC_OutputState_72_LOOP4                    8
+#define MC_OutputState_28_LOOP1                    4
+#define MC_OutputState_28_LOOP2                    5
+#define MC_OutputState_29_LOOP1                    4
+#define MC_OutputState_29_LOOP2                    5
+#define MC_OutputState_51_LOOP1                    4
+#define MC_OutputState_51_LOOP2                    5
+#define MC_OutputState_51_LOOP3                    6
+#define MC_OutputState_51_LOOP4                    7
+#define MC_OutputStyle_Filter_51                 (MCPARAMID)(10077 << 14)
+#define MC_OutputState_52_LOOP3                    7
+#define MC_OutputState_52_LOOP4                    8
+#define MC__BoardName__CFAPCIe                     8
+#define MC_PoCL_Feature                          (MCPARAMID)(10078 << 14)
+#define MC_PoCL_Feature_YES                        1
+#define MC_PoCL_Feature_NO                         2
+#define MC_LateLockingMode                       (MCPARAMID)(10079 << 14)
+#define MC_LateLockingMode_OFF                     1
+#define MC_LateLockingMode_ON                      2
+#define MC_TrigDelay_Pls                         (MCPARAMID)(10080 << 14)
+#define MC_NextTrigDelay_Pls                     (MCPARAMID)(10081 << 14)
+#define MC___TriggerControl_Check                (MCPARAMID)(10082 << 14)
+#define MC___TriggerControl_Check_PASS             1
+#define MC___TriggerControl_Check_FAIL             2
+#define MC_TriggerDecimation_Feature             (MCPARAMID)(10083 << 14)
+#define MC_TriggerDecimation_Feature_YES           1
+#define MC_TriggerDecimation_Feature_NO            2
+#define MC_TriggerDecimation_Filter              (MCPARAMID)(10084 << 14)
+#define MC_TemporaryTrig                         (MCPARAMID)(10085 << 14)
+#define MC_TemporaryTrig2                        (MCPARAMID)(10086 << 14)
+#define MC_TemporaryTrig3                        (MCPARAMID)(10087 << 14)
+#define MC___PciDeviceID_Check                   (MCPARAMID)(10088 << 14)
+#define MC___PciDeviceID_Check_PASS                1
+#define MC___PciDeviceID_Check_FAIL                2
+#define MC_CLCAM_OPModeTrueExp                   (MCPARAMID)(10089 << 14)
+#define MC_CamFileBoardName_Grablink_Value_cPCI   16
+#define MC_CamFileBoardName_Grablink_Expert_2_cPCI  17
+#define MC_SimIDPSet                             (MCPARAMID)(10090 << 14)
+#define MC_WIC_NumOfActiveWICs                   (MCPARAMID)(10091 << 14)
+#define MC_TapGeometry_4XR                        39
+#define MC_CLCAM_Geometry_TG_4XR                  24
+#define MC_AssyConfig_QUADXTAPR                   19
+#define MC_SurfaceAllocation                     (MCPARAMID)(10092 << 14)
+#define MC_MapRegistersAvailability              (MCPARAMID)(10093 << 14)
+#define MC_MapRegistersAvailability_Enough         1
+#define MC_MapRegistersAvailability_NotEnough      2
+#define MC_CamFileBoardName_Grablink_Full         18
+#define MC__BoardName__FULL                        9
+#define MC__ASSYF11                              (MCPARAMID)(10094 << 14)
+#define MC__ASSYF12                              (MCPARAMID)(10095 << 14)
+#define MC__ASSYF13                              (MCPARAMID)(10096 << 14)
+#define MC__ASSYF14                              (MCPARAMID)(10097 << 14)
+#define MC__ASSYF15                              (MCPARAMID)(10098 << 14)
+#define MC__ASSYF16                              (MCPARAMID)(10099 << 14)
+#define MC__ASSYF17                              (MCPARAMID)(10100 << 14)
+#define MC__ASSYF18                              (MCPARAMID)(10101 << 14)
+#define MC__ASSYF21                              (MCPARAMID)(10102 << 14)
+#define MC__ASSYF22                              (MCPARAMID)(10103 << 14)
+#define MC__ASSYF23                              (MCPARAMID)(10104 << 14)
+#define MC__ASSYF24                              (MCPARAMID)(10105 << 14)
+#define MC__ASSYF25                              (MCPARAMID)(10106 << 14)
+#define MC__ASSYF26                              (MCPARAMID)(10107 << 14)
+#define MC__ASSYF27                              (MCPARAMID)(10108 << 14)
+#define MC__ASSYF28                              (MCPARAMID)(10109 << 14)
+#define MC__ASSYF31                              (MCPARAMID)(10110 << 14)
+#define MC__ASSYF32                              (MCPARAMID)(10111 << 14)
+#define MC__ASSYF33                              (MCPARAMID)(10112 << 14)
+#define MC__ASSYF34                              (MCPARAMID)(10113 << 14)
+#define MC__ASSYF35                              (MCPARAMID)(10114 << 14)
+#define MC__ASSYF36                              (MCPARAMID)(10115 << 14)
+#define MC__ASSYF37                              (MCPARAMID)(10116 << 14)
+#define MC__ASSYF38                              (MCPARAMID)(10117 << 14)
+#define MC__ASSYF41                              (MCPARAMID)(10118 << 14)
+#define MC__ASSYF42                              (MCPARAMID)(10119 << 14)
+#define MC__ASSYF43                              (MCPARAMID)(10120 << 14)
+#define MC__ASSYF44                              (MCPARAMID)(10121 << 14)
+#define MC__ASSYF45                              (MCPARAMID)(10122 << 14)
+#define MC__ASSYF46                              (MCPARAMID)(10123 << 14)
+#define MC__ASSYF47                              (MCPARAMID)(10124 << 14)
+#define MC__ASSYF48                              (MCPARAMID)(10125 << 14)
+#define MC__ASSYF51                              (MCPARAMID)(10126 << 14)
+#define MC__ASSYF52                              (MCPARAMID)(10127 << 14)
+#define MC__ASSYF53                              (MCPARAMID)(10128 << 14)
+#define MC__ASSYF54                              (MCPARAMID)(10129 << 14)
+#define MC__ASSYF55                              (MCPARAMID)(10130 << 14)
+#define MC__ASSYF56                              (MCPARAMID)(10131 << 14)
+#define MC__ASSYF57                              (MCPARAMID)(10132 << 14)
+#define MC__ASSYF58                              (MCPARAMID)(10133 << 14)
+#define MC__ASSYF61                              (MCPARAMID)(10134 << 14)
+#define MC__ASSYF62                              (MCPARAMID)(10135 << 14)
+#define MC__ASSYF63                              (MCPARAMID)(10136 << 14)
+#define MC__ASSYF64                              (MCPARAMID)(10137 << 14)
+#define MC__ASSYF65                              (MCPARAMID)(10138 << 14)
+#define MC__ASSYF66                              (MCPARAMID)(10139 << 14)
+#define MC__ASSYF67                              (MCPARAMID)(10140 << 14)
+#define MC__ASSYF68                              (MCPARAMID)(10141 << 14)
+#define MC__ASSYF71                              (MCPARAMID)(10142 << 14)
+#define MC__ASSYF72                              (MCPARAMID)(10143 << 14)
+#define MC__ASSYF73                              (MCPARAMID)(10144 << 14)
+#define MC__ASSYF74                              (MCPARAMID)(10145 << 14)
+#define MC__ASSYF75                              (MCPARAMID)(10146 << 14)
+#define MC__ASSYF76                              (MCPARAMID)(10147 << 14)
+#define MC__ASSYF77                              (MCPARAMID)(10148 << 14)
+#define MC__ASSYF78                              (MCPARAMID)(10149 << 14)
+#define MC__ASSYF81                              (MCPARAMID)(10150 << 14)
+#define MC__ASSYF82                              (MCPARAMID)(10151 << 14)
+#define MC__ASSYF83                              (MCPARAMID)(10152 << 14)
+#define MC__ASSYF84                              (MCPARAMID)(10153 << 14)
+#define MC__ASSYF85                              (MCPARAMID)(10154 << 14)
+#define MC__ASSYF86                              (MCPARAMID)(10155 << 14)
+#define MC__ASSYF87                              (MCPARAMID)(10156 << 14)
+#define MC__ASSYF88                              (MCPARAMID)(10157 << 14)
+#define MC__Lead_W5                              (MCPARAMID)(10158 << 14)
+#define MC__Lead_W6                              (MCPARAMID)(10159 << 14)
+#define MC__Lead_W7                              (MCPARAMID)(10160 << 14)
+#define MC__Lead_W8                              (MCPARAMID)(10161 << 14)
+#define MC__Lead_D5                              (MCPARAMID)(10162 << 14)
+#define MC__Lead_D6                              (MCPARAMID)(10163 << 14)
+#define MC__Lead_D7                              (MCPARAMID)(10164 << 14)
+#define MC__Lead_D8                              (MCPARAMID)(10165 << 14)
+#define MC__CDA_P5INDEX                          (MCPARAMID)(10166 << 14)
+#define MC__CDA_P6INDEX                          (MCPARAMID)(10167 << 14)
+#define MC__CDA_P7INDEX                          (MCPARAMID)(10168 << 14)
+#define MC__CDA_P8INDEX                          (MCPARAMID)(10169 << 14)
+#define MC__ASW_5                                (MCPARAMID)(10170 << 14)
+#define MC__ASW_6                                (MCPARAMID)(10171 << 14)
+#define MC__ASW_7                                (MCPARAMID)(10172 << 14)
+#define MC__ASW_8                                (MCPARAMID)(10173 << 14)
+#define MC__CDA_LEAD5                            (MCPARAMID)(10174 << 14)
+#define MC__CDA_LEAD6                            (MCPARAMID)(10175 << 14)
+#define MC__CDA_LEAD7                            (MCPARAMID)(10176 << 14)
+#define MC__CDA_LEAD8                            (MCPARAMID)(10177 << 14)
+#define MC__AllClBufMask                         (MCPARAMID)(10178 << 14)
+#define MC__UsedClBufMask                        (MCPARAMID)(10179 << 14)
+#define MC__CDA_REFASSYNR5                       (MCPARAMID)(10180 << 14)
+#define MC__CDA_REFASSYNR6                       (MCPARAMID)(10181 << 14)
+#define MC__CDA_REFASSYNR7                       (MCPARAMID)(10182 << 14)
+#define MC__CDA_REFASSYNR8                       (MCPARAMID)(10183 << 14)
+#define MC_AssyConfig_OCTALXOCTAL                 20
+#define MC_TapGeometry_4X2E                       40
+#define MC_TapGeometry_4X2E_1Y                    41
+#define MC_CLCAM_Geometry_TG_4X2E                 25
+#define MC_AssyConfig_OCTALXPAIR                  21
+#define MC_AssyConfig_OCTALXPAIREND               22
+#define MC_SurfaceAllocation_ANYWHERE              1
+#define MC_SurfaceAllocation_BELOW4G               2
+#define MC__ADR_OutputsSteps_128bit              (MCPARAMID)(10184 << 14)
+#define MC__ADR_LastSliceSize_128bit             (MCPARAMID)(10185 << 14)
+#define MC__CDC_FSLIC_ONE512                       5
+#define MC__CDC_FSLIC_TWO256                       6
+#define MC__CDC_FSLIC_FOUR128                      7
+#define MC__CDC_FSLIC_EIGHT64                      8
+#define MC__CDC_DIRX_w                           (MCPARAMID)(10186 << 14)
+#define MC_ChannelTopology_QUADXTAPR              18
+#define MC_TapGeometry_4XE_1Y                     42
+#define MC_TapGeometry_4XR_1Y                     43
+#define MC_CamFileBoardName_Grablink_FM1          19
+#define MC__BoardName__FM1                        10
+#define MC__BoardName_FM1_MOCKUP                  11
+#define MC__Category_FM1_Backend                  63
+#define MC__PA_NumBytePerLine_Mod_FBWidth        (MCPARAMID)(10187 << 14)
+#define MC__Category_G3G_Backend                  64
+#define MC__CPA_NumBytePerLine_Mod_FBWidth       (MCPARAMID)(10188 << 14)
+#define MC_OutputFormatterConfig_Y8OCTAL          48
+#define MC_OutputFormatterConfig_Y10              49
+#define MC_OutputFormatterConfig_Y12              50
+#define MC_OutputFormatterConfig_Y16              51
+#define MC_COF_BitWR                             (MCPARAMID)(10189 << 14)
+#define MC_COF_ByteWR_Mux8                       (MCPARAMID)(10190 << 14)
+#define MC_COF_ByteWR_Mux7                       (MCPARAMID)(10191 << 14)
+#define MC_COF_ByteWR_Mux6                       (MCPARAMID)(10192 << 14)
+#define MC_COF_ByteWR_Mux5                       (MCPARAMID)(10193 << 14)
+#define MC_COF_ByteWR_Mux4                       (MCPARAMID)(10194 << 14)
+#define MC_COF_ByteWR_Mux3                       (MCPARAMID)(10195 << 14)
+#define MC_COF_ByteWR_Mux2                       (MCPARAMID)(10196 << 14)
+#define MC_CPA_NumBytePerLine_Mod_FBWidth        (MCPARAMID)(10197 << 14)
+#define MC__CLF_LstFBCycLenMinusOne              (MCPARAMID)(10198 << 14)
+#define MC_PciBridgeType_Epec4832                  6
+#define MC_ActiveXStep_Byte                      (MCPARAMID)(10199 << 14)
+#define MC__CLF_NumFBCylLen                      (MCPARAMID)(10200 << 14)
+#define MC__CLF_NumFBCyl                         (MCPARAMID)(10201 << 14)
+#define MC__CPA_NumBytePerLine                   (MCPARAMID)(10202 << 14)
+#define MC__NumBytePerLine                       (MCPARAMID)(10203 << 14)
+#define MC__NumBytePerLine_Mod_FBWidth           (MCPARAMID)(10204 << 14)
+#define MC__MaxNumBytePerLinePart                (MCPARAMID)(10205 << 14)
+#define MC__NumLinePart                          (MCPARAMID)(10206 << 14)
+#define MC__LastLinePartLen_Byte                 (MCPARAMID)(10207 << 14)
+#define MC__COF_FF_AELvl_12                      (MCPARAMID)(10208 << 14)
+#define MC__COF_FF_AELvl_34                      (MCPARAMID)(10209 << 14)
+#define MC__COF_FF_AELvl_56                      (MCPARAMID)(10210 << 14)
+#define MC__COF_FF_AELvl_78                      (MCPARAMID)(10211 << 14)
+#define MC__COF_FF_AELvl_LstLnPart_12            (MCPARAMID)(10212 << 14)
+#define MC__COF_FF_AELvl_LstLnPart_34            (MCPARAMID)(10213 << 14)
+#define MC__COF_FF_AELvl_LstLnPart_56            (MCPARAMID)(10214 << 14)
+#define MC__COF_FF_AELvl_LstLnPart_78            (MCPARAMID)(10215 << 14)
+#define MC__COF_NumBytePerLine                   (MCPARAMID)(10216 << 14)
+#define MC__COF_NumBytePerLine_Mod_FBWidth       (MCPARAMID)(10217 << 14)
+#define MC__COF_MaxNumBytePerLinePart            (MCPARAMID)(10218 << 14)
+#define MC__COF_NumLinePart                      (MCPARAMID)(10219 << 14)
+#define MC__COF_LastLinePartLen_Byte             (MCPARAMID)(10220 << 14)
+#define MC__COF_NumBytePerLineModMaxNum          (MCPARAMID)(10221 << 14)
+#define MC__COF_NumBytePerLine_Mod_MaxNum        (MCPARAMID)(10222 << 14)
+#define MC__COF_LineLen_Byte                     (MCPARAMID)(10223 << 14)
+#define MC__COF_LineLen_Byte_Mod_FBWidth         (MCPARAMID)(10224 << 14)
+#define MC__COF_MaxLinePartLen_Byte              (MCPARAMID)(10225 << 14)
+#define MC__COF_LineLen_Mod_MaxNum               (MCPARAMID)(10226 << 14)
+#define MC__CPA_ColorMode                        (MCPARAMID)(10227 << 14)
+#define MC__CPA_ColorMode_MONOCHROME               1
+#define MC__CPA_ColorMode_RGB                      2
+#define MC__CPA_ColorMode_BAYER                    3
+#define MC__CPA_PixelSize                        (MCPARAMID)(10228 << 14)
+#define MC__CPA_PixelSize_ONE                      1
+#define MC__CPA_PixelSize_MANY                     2
+#define MC_CPA_ColorMode                         (MCPARAMID)(10229 << 14)
+#define MC_CPA_ColorMode_MONOCHROME                1
+#define MC_CPA_ColorMode_RGB                       2
+#define MC_CPA_ColorMode_BAYER                     3
+#define MC_CPA_PixelSize                         (MCPARAMID)(10230 << 14)
+#define MC_CPA_PixelSize_ONE                       1
+#define MC_CPA_PixelSize_MANY                      2
+#define MC_CPA_NumPixelBayerOut                  (MCPARAMID)(10231 << 14)
+#define MC_CPA_NumPixelBayerOut_ONE                1
+#define MC_CPA_NumPixelBayerOut_TWO                2
+#define MC_CPA_NumPixelPerLine                   (MCPARAMID)(10232 << 14)
+#define MC_CPA_NumByteToFlush                    (MCPARAMID)(10233 << 14)
+#define MC_CPA_LineLen_Byte                      (MCPARAMID)(10234 << 14)
+#define MC_COF_LineLen_Byte                      (MCPARAMID)(10235 << 14)
+#define MC_COF_LineLen_Byte_Mod_FBWidth          (MCPARAMID)(10236 << 14)
+#define MC_COF_MaxLinePartLen_Byte               (MCPARAMID)(10237 << 14)
+#define MC_COF_NumLinePart                       (MCPARAMID)(10238 << 14)
+#define MC_COF_LineLen_Mod_MaxNum                (MCPARAMID)(10239 << 14)
+#define MC_COF_LastLinePartLen_Byte              (MCPARAMID)(10240 << 14)
+#define MC_COF_FF_AELvl_12                       (MCPARAMID)(10241 << 14)
+#define MC_COF_FF_AELvl_34                       (MCPARAMID)(10242 << 14)
+#define MC_COF_FF_AELvl_56                       (MCPARAMID)(10243 << 14)
+#define MC_COF_FF_AELvl_78                       (MCPARAMID)(10244 << 14)
+#define MC_COF_FF_AELvl_LstLnPart_12             (MCPARAMID)(10245 << 14)
+#define MC_COF_FF_AELvl_LstLnPart_34             (MCPARAMID)(10246 << 14)
+#define MC_COF_FF_AELvl_LstLnPart_56             (MCPARAMID)(10247 << 14)
+#define MC_COF_FF_AELvl_LstLnPart_78             (MCPARAMID)(10248 << 14)
+#define MC_CLF_NumFBCyl                          (MCPARAMID)(10249 << 14)
+#define MC_CLF_LstFBCycLenMinusOne               (MCPARAMID)(10250 << 14)
+#define MC__BoardName__FM1_MOCKUP                 12
+#define MC_CLF_NumFBAccessPerLine                (MCPARAMID)(10251 << 14)
+#define MC_CLF_LstFBCycLen                       (MCPARAMID)(10252 << 14)
+#define MC_CBD_ColorRegistration                 (MCPARAMID)(10253 << 14)
+#define MC_CBD_ColorRegistration_BG                1
+#define MC_CBD_ColorRegistration_GB                2
+#define MC_CBD_ColorRegistration_RG                3
+#define MC_CBD_ColorRegistration_GR                4
+#define MC_CBD_Algo                              (MCPARAMID)(10254 << 14)
+#define MC_CBD_Algo_LEGACY                         1
+#define MC_CBD_Algo_ADVANCED                       2
+#define MC_CBD_NumPixelInput                     (MCPARAMID)(10255 << 14)
+#define MC_CBD_NumPixelInput_ONE                   1
+#define MC_CBD_NumPixelInput_TWO                   2
+#define MC__LineLen_Byte                         (MCPARAMID)(10256 << 14)
+#define MC__InBackEnd_LineLen_Byte               (MCPARAMID)(10257 << 14)
+#define MC__OutBackEnd_LineLen_Byte              (MCPARAMID)(10258 << 14)
+#define MC_COF_LineLen_Mod_MaxPartLen            (MCPARAMID)(10259 << 14)
+#define MC_OutputFormatterConfig_RGB24MONO        52
+#define MC_COF_ByteWR_WEN_Step8                  (MCPARAMID)(10260 << 14)
+#define MC_COF_ByteWR_WEN_Step7                  (MCPARAMID)(10261 << 14)
+#define MC_COF_ByteWR_WEN_Step6                  (MCPARAMID)(10262 << 14)
+#define MC_COF_ByteWR_WEN_Step5                  (MCPARAMID)(10263 << 14)
+#define MC_COF_ByteWR_WEN_Step4                  (MCPARAMID)(10264 << 14)
+#define MC_COF_ByteWR_WEN_Step3                  (MCPARAMID)(10265 << 14)
+#define MC_COF_ByteWR_WEN_Step2                  (MCPARAMID)(10266 << 14)
+#define MC_COF_ByteWR_WEN_Step1                  (MCPARAMID)(10267 << 14)
+#define MC_OutputFormatterConfig_M8OCTAL          53
+#define MC_OutputFormatterConfig_M8QUAD           54
+#define MC_OutputFormatterConfig_M10              55
+#define MC_OutputFormatterConfig_M12              56
+#define MC_OutputFormatterConfig_M16              57
+#define MC_OutputFormatterConfig_RGB24DUAL        58
+#define MC_OutputFormatterConfig_ARGB32DUAL       59
+#define MC_OutputFormatterConfig_ARGB32MONO       60
+#define MC_OutputFormatterConfig_RGB24PLDUAL      61
+#define MC_OutputFormatterConfig_RGB24PLMONO      62
+#define MC_LUT_StartAddress_Byte                 (MCPARAMID)(10268 << 14)
+#define MC_LUT_StartAddress_FB64                 (MCPARAMID)(10269 << 14)
+#define MC_LUT_Truncation                        (MCPARAMID)(10270 << 14)
+#define MC_LUT_Truncation_TRUE                     1
+#define MC_LUT_Truncation_FALSE                    2
+#define MC_LUT_Format                            (MCPARAMID)(10271 << 14)
+#define MC_LUT_Format_BYPASS                       1
+#define MC_LUT_Format_M8                           2
+#define MC_LUT_Format_M16                          3
+#define MC_LUT_Format_M16ToM8                      4
+#define MC_LUT_Format_RGB24                        5
+#define MC_LUT_Format_BY8ToRGB24                   6
+#define MC_LUT_Format_RGB48                        7
+#define MC_LUT_Format_BY16ToRGB48                  8
+#define MC_LUT_Format_RGB48ToRGB24                 9
+#define MC_LUT_Format_BY16ToRGB24                 10
+#define MC_LUT_NumLutUsed                        (MCPARAMID)(10272 << 14)
+#define MC_LUT_Format_Trunc16To8                  11
+#define MC_LUT_Config                            (MCPARAMID)(10273 << 14)
+#define MC_LUT_Config_BYPASS8                      1
+#define MC_LUT_Config_BYPASS16                     2
+#define MC_LUT_Config_LUT8                         3
+#define MC_LUT_Config_LUT16                        4
+#define MC_LUT_Config_LUT16To8                     5
+#define MC_CPA_PixolSize                         (MCPARAMID)(10274 << 14)
+#define MC_CPA_PixolSize_ONE                       1
+#define MC_CPA_PixolSize_TWO                       2
+#define MC_CPA_LineLen_Byte_Mod_FBWidth          (MCPARAMID)(10275 << 14)
+#define MC__P1IndexOffset                        (MCPARAMID)(10276 << 14)
+#define MC__P2IndexOffset                        (MCPARAMID)(10277 << 14)
+#define MC__P3IndexOffset                        (MCPARAMID)(10278 << 14)
+#define MC__P4IndexOffset                        (MCPARAMID)(10279 << 14)
+#define MC__P5IndexOffset                        (MCPARAMID)(10280 << 14)
+#define MC__P6IndexOffset                        (MCPARAMID)(10281 << 14)
+#define MC__P7IndexOffset                        (MCPARAMID)(10282 << 14)
+#define MC__P8IndexOffset                        (MCPARAMID)(10283 << 14)
+#define MC_ByteCountGranularity                  (MCPARAMID)(10284 << 14)
+#define MC__LeadWords_W1                         (MCPARAMID)(10285 << 14)
+#define MC__LeadWords_W2                         (MCPARAMID)(10286 << 14)
+#define MC__LeadWords_W3                         (MCPARAMID)(10287 << 14)
+#define MC__LeadWords_W4                         (MCPARAMID)(10288 << 14)
+#define MC__LeadWords_W5                         (MCPARAMID)(10289 << 14)
+#define MC__LeadWords_W6                         (MCPARAMID)(10290 << 14)
+#define MC__LeadWords_W7                         (MCPARAMID)(10291 << 14)
+#define MC__LeadWords_W8                         (MCPARAMID)(10292 << 14)
+#define MC__LeadWords_D1                         (MCPARAMID)(10293 << 14)
+#define MC__LeadWords_D2                         (MCPARAMID)(10294 << 14)
+#define MC__LeadWords_D3                         (MCPARAMID)(10295 << 14)
+#define MC__LeadWords_D4                         (MCPARAMID)(10296 << 14)
+#define MC__LeadWords_D5                         (MCPARAMID)(10297 << 14)
+#define MC__LeadWords_D6                         (MCPARAMID)(10298 << 14)
+#define MC__LeadWords_D7                         (MCPARAMID)(10299 << 14)
+#define MC__LeadWords_D8                         (MCPARAMID)(10300 << 14)
+#define MC__CDA_P1DefaultIndex                   (MCPARAMID)(10301 << 14)
+#define MC__CDA_P2DefaultIndex                   (MCPARAMID)(10302 << 14)
+#define MC__CDA_P3DefaultIndex                   (MCPARAMID)(10303 << 14)
+#define MC__CDA_P4DefaultIndex                   (MCPARAMID)(10304 << 14)
+#define MC__CDA_P5DefaultIndex                   (MCPARAMID)(10305 << 14)
+#define MC__CDA_P6DefaultIndex                   (MCPARAMID)(10306 << 14)
+#define MC__CDA_P7DefaultIndex                   (MCPARAMID)(10307 << 14)
+#define MC__CDA_P8DefaultIndex                   (MCPARAMID)(10308 << 14)
+#define MC_PIndexIncrementFactor                 (MCPARAMID)(10309 << 14)
+#define MC_TapGeometry_2XR                        44
+#define MC_TapGeometry_2X4                        45
+#define MC_TapGeometry_8XR                        46
+#define MC_TapGeometry_2XR_1Y                     47
+#define MC_TapGeometry_1X2_1Y2                    48
+#define MC_TapGeometry_2X_1Y2                     49
+#define MC_TapGeometry_2XE_1Y2                    50
+#define MC_TapGeometry_2XR_1Y2                    51
+#define MC_TapGeometry_2X4_1Y                     52
+#define MC_TapGeometry_8XR_1Y                     53
+#define MC_AssyConfig_DUALXTAPR                   23
+#define MC_AssyConfig_OCTALXQUAD                  24
+#define MC_AssyConfig_OCTALXTAPR                  25
+#define MC_TapGeometry_1X4_1Y2                    54
+#define MC_TapGeometry_4X_1Y2                     55
+#define MC_TapGeometry_4XE_1Y2                    56
+#define MC_TapGeometry_4XR_1Y2                    57
+#define MC_TapGeometry_2X2M_2YE                   58
+#define MC_PCIeLinkWidth                         (MCPARAMID)(10310 << 14)
+#define MC_PCIeEndpointRevisionID                (MCPARAMID)(10311 << 14)
+#define MC_LUT_Type                              (MCPARAMID)(10312 << 14)
+#define MC_LUT_Type_LUT8Monochrome                 1
+#define MC_LUT_Type_LUT8Color                      2
+#define MC_LUT_Type_LUT16Monochrome                3
+#define MC_LUT_Type_LUT16Color                     4
+#define MC_LUT_Type_LUT16To8Monochrome             5
+#define MC_LUT_Type_LUT16To8Color                  6
+#define MC_LUT_Type_LUT16To8BayerToColor           7
+#define MC_LUT_ProgModel                         (MCPARAMID)(10313 << 14)
+#define MC_LUT_ProgModel_LUT8_Monochrome           1
+#define MC_LUT_ProgModel_LUT8_Color                2
+#define MC_LUT_ProgModel_LUT16_Monochrome          3
+#define MC_LUT_ProgModel_LUT16_Color               4
+#define MC_LUT_ProgModel_LUT16To8_Monochrome       5
+#define MC_LUT_ProgModel_LUT16To8_Color            6
+#define MC_LUT_ProgModel_LUT16To8_BayerToColor     7
+#define MC_TapConfiguration_DECA_10T8             47
+#define MC_TapGeometry_1X10                       59
+#define MC_TapGeometry_1X10_1Y                    60
+#define MC_CLCAM_Geometry_TG_1X10                 26
+#define MC_AssyConfig_DECAXDECA                   26
+#define MC__CDA_P9DefaultIndex                   (MCPARAMID)(10314 << 14)
+#define MC__CDA_P10DefaultIndex                  (MCPARAMID)(10315 << 14)
+#define MC__ASSYF91                              (MCPARAMID)(10316 << 14)
+#define MC__ASSYF92                              (MCPARAMID)(10317 << 14)
+#define MC__ASSYF93                              (MCPARAMID)(10318 << 14)
+#define MC__ASSYF94                              (MCPARAMID)(10319 << 14)
+#define MC__ASSYF95                              (MCPARAMID)(10320 << 14)
+#define MC__ASSYF96                              (MCPARAMID)(10321 << 14)
+#define MC__ASSYF97                              (MCPARAMID)(10322 << 14)
+#define MC__ASSYF98                              (MCPARAMID)(10323 << 14)
+#define MC__ASSYF101                             (MCPARAMID)(10324 << 14)
+#define MC__ASSYF102                             (MCPARAMID)(10325 << 14)
+#define MC__ASSYF103                             (MCPARAMID)(10326 << 14)
+#define MC__ASSYF104                             (MCPARAMID)(10327 << 14)
+#define MC__ASSYF105                             (MCPARAMID)(10328 << 14)
+#define MC__ASSYF106                             (MCPARAMID)(10329 << 14)
+#define MC__ASSYF107                             (MCPARAMID)(10330 << 14)
+#define MC__ASSYF108                             (MCPARAMID)(10331 << 14)
+#define MC_NumOfAssy_TEN                           7
+#define MC__LeadWords_D9                         (MCPARAMID)(10332 << 14)
+#define MC__LeadWords_D10                        (MCPARAMID)(10333 << 14)
+#define MC__Lead_D9                              (MCPARAMID)(10334 << 14)
+#define MC__Lead_D10                             (MCPARAMID)(10335 << 14)
+#define MC__CDA_P9INDEX                          (MCPARAMID)(10336 << 14)
+#define MC__CDA_P10INDEX                         (MCPARAMID)(10337 << 14)
+#define MC__D9_WINDEX                            (MCPARAMID)(10338 << 14)
+#define MC__D10_WINDEX                           (MCPARAMID)(10339 << 14)
+#define MC__ASW_9                                (MCPARAMID)(10340 << 14)
+#define MC__ASW_10                               (MCPARAMID)(10341 << 14)
+#define MC__CDA_REFASSYNR9                       (MCPARAMID)(10342 << 14)
+#define MC__CDA_REFASSYNR10                      (MCPARAMID)(10343 << 14)
+#define MC__CDA_LEAD9                            (MCPARAMID)(10344 << 14)
+#define MC__CDA_LEAD10                           (MCPARAMID)(10345 << 14)
+#define MC_CL_ConfigurationClass_DECA              4
+#define MC__GCL_CLCFG_DECA                         4
+#define MC__BoardName_UnknownBoard                13
+#define MC_BoardFeature_CFADecoding              (MCPARAMID)(10346 << 14)
+#define MC_BoardFeature_CFADecoding_YES            1
+#define MC_BoardFeature_CFADecoding_NO             2
+#define MC_InputFunction_CK_PRESENT               17
+#define MC_InputFunction_POWERSTATE5V             18
+#define MC_InputFunction_POWERSTATE12V            19
+#define MC_InputStyle_ISO                         17
+#define MC_InputPinName_IIN1                     112
+#define MC_InputPinName_IIN2                     113
+#define MC_InputPinName_IIN3                     114
+#define MC_InputPinName_IIN4                     115
+#define MC_InputPinName_DIN1                     116
+#define MC_InputPinName_DIN2                     117
+#define MC_InputPinName_POWER_5V                 118
+#define MC_InputPinName_POWER_12V                119
+#define MC_InputPinName_FVAL_X                   120
+#define MC_InputPinName_LVAL_X                   121
+#define MC_InputPinName_DVAL_X                   122
+#define MC_InputPinName_SPARE_X                  123
+#define MC_InputPinName_CK_PRESENT_X             124
+#define MC_InputPinName_FVAL_Y                   125
+#define MC_InputPinName_LVAL_Y                   126
+#define MC_InputPinName_DVAL_Y                   127
+#define MC_InputPinName_SPARE_Y                  128
+#define MC_InputPinName_CK_PRESENT_Y             129
+#define MC_InputPinName_FVAL_Z                   130
+#define MC_InputPinName_LVAL_Z                   131
+#define MC_InputPinName_DVAL_Z                   132
+#define MC_InputPinName_SPARE_Z                  133
+#define MC_InputPinName_CK_PRESENT_Z             134
+#define MC_OutputPinName_IOUT1                   122
+#define MC_OutputPinName_IOUT2                   123
+#define MC_OutputPinName_IOUT3                   124
+#define MC_OutputPinName_IOUT4                   125
+#define MC_TrigCtl_ISO                            17
+#define MC_TrigLine_DIN1                          32
+#define MC_TrigLine_DIN2                          33
+#define MC_TrigLine_IIN1                          34
+#define MC_TrigLine_IIN2                          35
+#define MC_TrigLine_IIN3                          36
+#define MC_TrigLine_IIN4                          37
+#define MC_EndTrigLine_DIN1                       23
+#define MC_EndTrigLine_DIN2                       24
+#define MC_EndTrigLine_IIN1                       25
+#define MC_EndTrigLine_IIN2                       26
+#define MC_EndTrigLine_IIN3                       27
+#define MC_EndTrigLine_IIN4                       28
+#define MC_EndTrigCtl_DIFF                         9
+#define MC_EndTrigCtl_ISO                         10
+#define MC__TrigLine_DIN1                         36
+#define MC__TrigLine_DIN2                         37
+#define MC__TrigLine_IIN1                         38
+#define MC__TrigLine_IIN2                         39
+#define MC__TrigLine_IIN3                         40
+#define MC__TrigLine_IIN4                         41
+#define MC__EndTrigLine_DIN1                      21
+#define MC__EndTrigLine_DIN2                      22
+#define MC__EndTrigLine_IIN1                      23
+#define MC__EndTrigLine_IIN2                      24
+#define MC__EndTrigLine_IIN3                      25
+#define MC__EndTrigLine_IIN4                      26
+#define MC__TRG_FTSEL_FromIsoIn1                  23
+#define MC__TRG_FTSEL_FromIsoIn2                  24
+#define MC__TRG_FTSEL_FromIsoIn3                  25
+#define MC__TRG_FTSEL_FromIsoIn4                  26
+#define MC__TRG_FTSEL_FromDhsIn1                  27
+#define MC__TRG_FTSEL_FromDhsIn2                  28
+#define MC__TRG_FTSEL_None                        29
+#define MC__TRG_EFTSEL_FromIsoIn1                 17
+#define MC__TRG_EFTSEL_FromIsoIn2                 18
+#define MC__TRG_EFTSEL_FromIsoIn3                 19
+#define MC__TRG_EFTSEL_FromIsoIn4                 20
+#define MC__TRG_EFTSEL_FromDhsIn1                 21
+#define MC__TRG_EFTSEL_FromDhsIn2                 22
+#define MC__TRG_EFTSEL_None                       23
+#define MC_StrobeLine_IOUT1                       24
+#define MC__StrobeLine_IOUT1                      20
+#define MC_LineTrigCtl_DIFF                        5
+#define MC_LineTrigCtl_DIFF_PAIRED                 6
+#define MC_LineTrigCtl_ISO                         7
+#define MC_LineTrigCtl_ISO_PAIRED                  8
+#define MC_LineTrig_GlobalFilter                 (MCPARAMID)(10347 << 14)
+#define MC_LineTrigEdge_RISING_A                   3
+#define MC_LineTrigEdge_FALLING_A                  4
+#define MC_LineTrigEdge_ALL_A                      5
+#define MC_LineTrigEdge_ALL_A_B                    6
+#define MC_LineTrigEdge_Filter                   (MCPARAMID)(10348 << 14)
+#define MC_LineTrigFilter_Filter_40ns              4
+#define MC_LineTrigFilter_Filter_100ns             5
+#define MC_LineTrigFilter_Filter_200ns             6
+#define MC_LineTrigFilter_Filter_500ns             7
+#define MC_LineTrigFilter_Filter_1us               8
+#define MC_LineTrigFilter_Filter_5us               9
+#define MC_LineTrigFilter_Filter_10us             10
+#define MC_LineTrigModesEnabled                  (MCPARAMID)(10349 << 14)
+#define MC_LineTrigModesEnabled_TRUE               1
+#define MC_LineTrigModesEnabled_FALSE              2
+#define MC_ForwardDirection                      (MCPARAMID)(10350 << 14)
+#define MC_ForwardDirection_A_LEADS_B              1
+#define MC_ForwardDirection_B_LEADS_A              2
+#define MC_QuadratureEncoder_Filter              (MCPARAMID)(10351 << 14)
+#define MC_BackwardMotionCancellationMode        (MCPARAMID)(10352 << 14)
+#define MC_BackwardMotionCancellationMode_OFF      1
+#define MC_BackwardMotionCancellationMode_FILTERED   2
+#define MC_BackwardMotionCancellationMode_COMPENSATE   3
+#define MC_LineTrigLine_DIN1                      15
+#define MC_LineTrigLine_DIN2                      16
+#define MC_LineTrigLine_IIN1                      17
+#define MC_LineTrigLine_IIN2                      18
+#define MC_LineTrigLine_IIN3                      19
+#define MC_LineTrigLine_IIN4                      20
+#define MC_LineTrigLine_DIN1_DIN2                 21
+#define MC_LineTrigLine_IIN1_IIN2                 22
+#define MC_LineTrigLine_IIN3_IIN4                 23
+#define MC__LineTrigLine_DIN1                     21
+#define MC__LineTrigLine_DIN2                     22
+#define MC__LineTrigLine_IIN1                     23
+#define MC__LineTrigLine_IIN2                     24
+#define MC__LineTrigLine_IIN3                     25
+#define MC__LineTrigLine_IIN4                     26
+#define MC__LineTrigLine_DIN1_DIN2                27
+#define MC__LineTrigLine_IIN1_IIN2                28
+#define MC__LineTrigLine_IIN3_IIN4                29
+#define MC__LTRG_LTPOL                           (MCPARAMID)(10353 << 14)
+#define MC__LTRG_LTPOL_RISING_A                    1
+#define MC__LTRG_LTPOL_FALLING_A                   2
+#define MC__LTRG_LTPOL_ALL_A                       3
+#define MC__LTRG_LTPOL_ALL_A_B                     4
+#define MC__LTRG_LTPOL_NONE                        5
+#define MC__LTRG_LTFLT                           (MCPARAMID)(10354 << 14)
+#define MC__LTRG_LTFLT_40ns                        1
+#define MC__LTRG_LTFLT_100ns                       2
+#define MC__LTRG_LTFLT_200ns                       3
+#define MC__LTRG_LTFLT_500ns                       4
+#define MC__LTRG_LTFLT_1us                         5
+#define MC__LTRG_LTFLT_5us                         6
+#define MC__LTRG_LTFLT_10us                        7
+#define MC__LTRG_LTSELA                          (MCPARAMID)(10355 << 14)
+#define MC__LTRG_LTSELA_FromIsoIn1                 1
+#define MC__LTRG_LTSELA_FromIsoIn2                 2
+#define MC__LTRG_LTSELA_FromIsoIn3                 3
+#define MC__LTRG_LTSELA_FromIsoIn4                 4
+#define MC__LTRG_LTSELA_FromDhsIn1                 5
+#define MC__LTRG_LTSELA_FromDhsIn2                 6
+#define MC__LTRG_LTSELA_None                       7
+#define MC__LTRG_LTSELB                          (MCPARAMID)(10356 << 14)
+#define MC__LTRG_LTSELB_FromIsoIn1                 1
+#define MC__LTRG_LTSELB_FromIsoIn2                 2
+#define MC__LTRG_LTSELB_FromIsoIn3                 3
+#define MC__LTRG_LTSELB_FromIsoIn4                 4
+#define MC__LTRG_LTSELB_FromDhsIn1                 5
+#define MC__LTRG_LTSELB_FromDhsIn2                 6
+#define MC__LTRG_LTSELB_None                       7
+#define MC_IIN1Usage                             (MCPARAMID)(10357 << 14)
+#define MC_IIN1Usage_FREE                          1
+#define MC_IIN1Usage_TRIGGER                       2
+#define MC_IIN1Usage_LINETRIGGER                   3
+#define MC___IIN1Usage_Check                     (MCPARAMID)(10358 << 14)
+#define MC___IIN1Usage_Check_PASS                  1
+#define MC___IIN1Usage_Check_FAIL                  2
+#define MC_IIN2Usage                             (MCPARAMID)(10359 << 14)
+#define MC_IIN2Usage_FREE                          1
+#define MC_IIN2Usage_TRIGGER                       2
+#define MC_IIN2Usage_LINETRIGGER                   3
+#define MC___IIN2Usage_Check                     (MCPARAMID)(10360 << 14)
+#define MC___IIN2Usage_Check_PASS                  1
+#define MC___IIN2Usage_Check_FAIL                  2
+#define MC_IIN3Usage                             (MCPARAMID)(10361 << 14)
+#define MC_IIN3Usage_FREE                          1
+#define MC_IIN3Usage_TRIGGER                       2
+#define MC_IIN3Usage_LINETRIGGER                   3
+#define MC___IIN3Usage_Check                     (MCPARAMID)(10362 << 14)
+#define MC___IIN3Usage_Check_PASS                  1
+#define MC___IIN3Usage_Check_FAIL                  2
+#define MC_IIN4Usage                             (MCPARAMID)(10363 << 14)
+#define MC_IIN4Usage_FREE                          1
+#define MC_IIN4Usage_TRIGGER                       2
+#define MC_IIN4Usage_LINETRIGGER                   3
+#define MC___IIN4Usage_Check                     (MCPARAMID)(10364 << 14)
+#define MC___IIN4Usage_Check_PASS                  1
+#define MC___IIN4Usage_Check_FAIL                  2
+#define MC_DIN1Usage                             (MCPARAMID)(10365 << 14)
+#define MC_DIN1Usage_FREE                          1
+#define MC_DIN1Usage_TRIGGER                       2
+#define MC_DIN1Usage_LINETRIGGER                   3
+#define MC_DIN1Usage_USER                          4
+#define MC___DIN1Usage_Check                     (MCPARAMID)(10366 << 14)
+#define MC___DIN1Usage_Check_PASS                  1
+#define MC___DIN1Usage_Check_FAIL                  2
+#define MC_DIN2Usage                             (MCPARAMID)(10367 << 14)
+#define MC_DIN2Usage_FREE                          1
+#define MC_DIN2Usage_TRIGGER                       2
+#define MC_DIN2Usage_LINETRIGGER                   3
+#define MC_DIN2Usage_USER                          4
+#define MC___DIN2Usage_Check                     (MCPARAMID)(10368 << 14)
+#define MC___DIN2Usage_Check_PASS                  1
+#define MC___DIN2Usage_Check_FAIL                  2
+#define MC_IOUT1Usage                            (MCPARAMID)(10369 << 14)
+#define MC_IOUT1Usage_FREE                         1
+#define MC_IOUT1Usage_STROBE                       2
+#define MC_IOUT2Usage                            (MCPARAMID)(10370 << 14)
+#define MC_IOUT2Usage_FREE                         1
+#define MC_IOUT2Usage_STROBE                       2
+#define MC_IOUT3Usage                            (MCPARAMID)(10371 << 14)
+#define MC_IOUT3Usage_FREE                         1
+#define MC_IOUT3Usage_STROBE                       2
+#define MC_IOUT4Usage                            (MCPARAMID)(10372 << 14)
+#define MC_IOUT4Usage_FREE                         1
+#define MC_IOUT4Usage_STROBE                       2
+#define MC__StrobeSrc                            (MCPARAMID)(10373 << 14)
+#define MC__StrobeSrc_T1SIG3_X                     1
+#define MC__StrobeSrc_NO_STROBE                    2
+#define MC__StrobeSrc_STROBE_TIED_LOW              3
+#define MC_CamFileBoardName_Grablink_FM1_Mockup   20
+#define MC_InputStyle_POWERSTATE                  18
+#define MC_InputFunction_CHANNELLINK_STATE        20
+#define MC_InputPinName_CHANNELLINK_UP_X         135
+#define MC_InputPinName_CHANNELLINK_UP_Y         136
+#define MC_InputPinName_CHANNELLINK_UP_Z         137
+#define MC_CLCAM_Geometry_TG_2XR                  27
+#define MC_PhaseShift_X                          (MCPARAMID)(10374 << 14)
+#define MC_PhaseShift_Y                          (MCPARAMID)(10375 << 14)
+#define MC_PhaseShift_Z                          (MCPARAMID)(10376 << 14)
+#define MC_CLCAM_Geometry_TG_2X4                  28
+#define MC_CameraLinkFrequencyRange              (MCPARAMID)(10377 << 14)
+#define MC_CameraLinkFrequencyRange_Range20MHzTo35MHz   1
+#define MC_CameraLinkFrequencyRange_Range30MHzTo70MHz   2
+#define MC_CameraLinkFrequencyRange_Range60MHzTo85MHz   3
+#define MC_CameraLinkFrequencyRange_From20MHzTo35MHz   4
+#define MC_CameraLinkFrequencyRange_From30MHzTo70MHz   5
+#define MC_CameraLinkFrequencyRange_From60MHzTo85MHz   6
+#define MC_BoardTopology2                        (MCPARAMID)(10378 << 14)
+#define MC_BoardTopology2_MONO                     1
+#define MC_BoardTopology_MONO_From60MHzTo85MHz    36
+#define MC_BoardTopology_MONO_From30MHzTo70MHz    37
+#define MC_BoardTopology_MONO_From20MHzTo35MHz    38
+#define MC_PCIeDeviceID                          (MCPARAMID)(10379 << 14)
+#define MC_CamFileBoardName_Unknown               21
+#define MC__CDC_FSLIC_ONE_1024                     9
+#define MC__CDC_FSLIC_TWO_512                     10
+#define MC__CDC_FSLIC_FOUR_256                    11
+#define MC__CDC_FSLIC_EIGHT_128                   12
+#define MC__STM1_T1SCAL_160ns                      8
+#define MC__STM1_T1SCAL_800ns                      9
+#define MC_CLCAM_Geometry_TG_8XR                  29
+#define MC__CPHASE9                              (MCPARAMID)(10380 << 14)
+#define MC__CPHASE10                             (MCPARAMID)(10381 << 14)
+#define MC__CBA_PSHIFT9                          (MCPARAMID)(10382 << 14)
+#define MC__CBA_PSHIFT10                         (MCPARAMID)(10383 << 14)
+#define MC_CamFileBoardName_Grablink_B2           22
+#define MC_CamFileBoardName_Grablink_B1           23
+#define MC__BoardName__B2                         14
+#define MC__BoardName__B1                         15
+#define MC_GrabberType                           (MCPARAMID)(10384 << 14)
+#define MC_GrabberType_Full                        1
+#define MC_GrabberType_Base                        2
+#define MC_GrabberType_DualBase                    3
+#define MC_PciBridgeType_Epec1816                  7
+#define MC__CDC_FSLIC_ONE_512                     13
+#define MC__CDC_FSLIC_TWO_256                     14
+#define MC_GrabberError_BE_3                     (MCPARAMID)(10385 << 14)
+#define MC_GrabberError_BE_2                     (MCPARAMID)(10386 << 14)
+#define MC_GrabberError_BE_1                     (MCPARAMID)(10387 << 14)
+#define MC_GrabberError_CLCLkLoss_Z              (MCPARAMID)(10388 << 14)
+#define MC_GrabberError_CLCLkLoss_Y              (MCPARAMID)(10389 << 14)
+#define MC_GrabberError_CLCLkLoss_X              (MCPARAMID)(10390 << 14)
+#define MC_GrabberError_FB64                     (MCPARAMID)(10391 << 14)
+#define MC_GrabberError_FB128                    (MCPARAMID)(10392 << 14)
+#define MC_GrabberError_Intr_APA_Z               (MCPARAMID)(10393 << 14)
+#define MC_GrabberError_Intr_APA_Y               (MCPARAMID)(10394 << 14)
+#define MC_GrabberError_Intr_APA_X               (MCPARAMID)(10395 << 14)
+#define MC_GrabberError_Intr_MisEOL              (MCPARAMID)(10396 << 14)
+#define MC_GrabberError_Intr_QB_Ovf              (MCPARAMID)(10397 << 14)
+#define MC_GrabberError_Intr_DPFF_Ovf            (MCPARAMID)(10398 << 14)
+#define MC_AssyConfig_MEDIUM_2T24_2XE_1Y          27
+#define MC_BoardTopology_BASE_MEDIUM_FULL         39
+#define MC_BoardTopology_DECA                     40
+#define MC_GrabberError_Intr_PA_Z                (MCPARAMID)(10399 << 14)
+#define MC_GrabberError_Intr_PA_Y                (MCPARAMID)(10400 << 14)
+#define MC_GrabberError_Intr_PA_X                (MCPARAMID)(10401 << 14)
+#define MC_BoardTopologyCheck                    (MCPARAMID)(10402 << 14)
+#define MC_BoardTopologyCheck_PASS                 1
+#define MC_BoardTopologyCheck_FAIL                 2
+#define MC_BoardTopology_MONO_DECA                41
+#define MC_PCIePayloadSize                       (MCPARAMID)(10403 << 14)
+#define MC_PCIePayloadField                      (MCPARAMID)(10404 << 14)
+#define MC_CFD_Mode_Fipplter                     (MCPARAMID)(10405 << 14)
+#define MC_XDirectionForWic1                     (MCPARAMID)(10406 << 14)
+#define MC_XDirectionForWic2                     (MCPARAMID)(10407 << 14)
+#define MC_XDirectionForWic3                     (MCPARAMID)(10408 << 14)
+#define MC_XDirectionForWic4                     (MCPARAMID)(10409 << 14)
+#define MC_XDirectionForWic5                     (MCPARAMID)(10410 << 14)
+#define MC_XDirectionForWic6                     (MCPARAMID)(10411 << 14)
+#define MC_XDirectionForWic7                     (MCPARAMID)(10412 << 14)
+#define MC_XDirectionForWic8                     (MCPARAMID)(10413 << 14)
+#define MC_YDirectionForWic1                     (MCPARAMID)(10414 << 14)
+#define MC_YDirectionForWic2                     (MCPARAMID)(10415 << 14)
+#define MC_YDirectionForWic3                     (MCPARAMID)(10416 << 14)
+#define MC_YDirectionForWic4                     (MCPARAMID)(10417 << 14)
+#define MC_YDirectionForWic5                     (MCPARAMID)(10418 << 14)
+#define MC_YDirectionForWic6                     (MCPARAMID)(10419 << 14)
+#define MC_YDirectionForWic7                     (MCPARAMID)(10420 << 14)
+#define MC_YDirectionForWic8                     (MCPARAMID)(10421 << 14)
+#define MC_LinePitchInFrameStore_mw              (MCPARAMID)(10422 << 14)
+#define MC_YOffsetForWic1_mw                     (MCPARAMID)(10423 << 14)
+#define MC_YOffsetForWic2_mw                     (MCPARAMID)(10424 << 14)
+#define MC_YOffsetForWic3_mw                     (MCPARAMID)(10425 << 14)
+#define MC_YOffsetForWic4_mw                     (MCPARAMID)(10426 << 14)
+#define MC_YOffsetForWic5_mw                     (MCPARAMID)(10427 << 14)
+#define MC_YOffsetForWic6_mw                     (MCPARAMID)(10428 << 14)
+#define MC_YOffsetForWic7_mw                     (MCPARAMID)(10429 << 14)
+#define MC_YOffsetForWic8_mw                     (MCPARAMID)(10430 << 14)
+#define MC_WIC_WindowPitch_mw                    (MCPARAMID)(10431 << 14)
+#define MC_WIC_WindowOffset_byte_Wic1            (MCPARAMID)(10432 << 14)
+#define MC_WIC_WindowOffset_byte_Wic2            (MCPARAMID)(10433 << 14)
+#define MC_WIC_WindowOffset_byte_Wic3            (MCPARAMID)(10434 << 14)
+#define MC_WIC_WindowOffset_byte_Wic4            (MCPARAMID)(10435 << 14)
+#define MC_WIC_WindowOffset_byte_Wic5            (MCPARAMID)(10436 << 14)
+#define MC_WIC_WindowOffset_byte_Wic6            (MCPARAMID)(10437 << 14)
+#define MC_WIC_WindowOffset_byte_Wic7            (MCPARAMID)(10438 << 14)
+#define MC_WIC_WindowOffset_byte_Wic8            (MCPARAMID)(10439 << 14)
+#define MC_WIC_WindowOffset_mw_Wic1              (MCPARAMID)(10440 << 14)
+#define MC_WIC_WindowOffset_mw_Wic2              (MCPARAMID)(10441 << 14)
+#define MC_WIC_WindowOffset_mw_Wic3              (MCPARAMID)(10442 << 14)
+#define MC_WIC_WindowOffset_mw_Wic4              (MCPARAMID)(10443 << 14)
+#define MC_WIC_WindowOffset_mw_Wic5              (MCPARAMID)(10444 << 14)
+#define MC_WIC_WindowOffset_mw_Wic6              (MCPARAMID)(10445 << 14)
+#define MC_WIC_WindowOffset_mw_Wic7              (MCPARAMID)(10446 << 14)
+#define MC_WIC_WindowOffset_mw_Wic8              (MCPARAMID)(10447 << 14)
+#define MC__CWR_XDirection_WIC1                  (MCPARAMID)(10448 << 14)
+#define MC__CWR_XDirection_WIC2                  (MCPARAMID)(10449 << 14)
+#define MC__CWR_XDirection_WIC3                  (MCPARAMID)(10450 << 14)
+#define MC__CWR_XDirection_WIC4                  (MCPARAMID)(10451 << 14)
+#define MC__CWR_XDirection_WIC5                  (MCPARAMID)(10452 << 14)
+#define MC__CWR_XDirection_WIC6                  (MCPARAMID)(10453 << 14)
+#define MC__CWR_XDirection_WIC7                  (MCPARAMID)(10454 << 14)
+#define MC__CWR_XDirection_WIC8                  (MCPARAMID)(10455 << 14)
+#define MC_CWR_YOffsetForWic1                    (MCPARAMID)(10456 << 14)
+#define MC_CWR_YOffsetForWic2                    (MCPARAMID)(10457 << 14)
+#define MC_CWR_YOffsetForWic3                    (MCPARAMID)(10458 << 14)
+#define MC_CWR_YOffsetForWic4                    (MCPARAMID)(10459 << 14)
+#define MC_CWR_YOffsetForWic5                    (MCPARAMID)(10460 << 14)
+#define MC_CWR_YOffsetForWic6                    (MCPARAMID)(10461 << 14)
+#define MC_CWR_YOffsetForWic7                    (MCPARAMID)(10462 << 14)
+#define MC_CWR_YOffsetForWic8                    (MCPARAMID)(10463 << 14)
+#define MC_DPFifoLinePitch_mw_WIC1               (MCPARAMID)(10464 << 14)
+#define MC_DPFifoLinePitch_mw_WIC2               (MCPARAMID)(10465 << 14)
+#define MC_DPFifoLinePitch_mw_WIC3               (MCPARAMID)(10466 << 14)
+#define MC_DPFifoLinePitch_mw_WIC4               (MCPARAMID)(10467 << 14)
+#define MC_DPFifoLinePitch_mw_WIC5               (MCPARAMID)(10468 << 14)
+#define MC_DPFifoLinePitch_mw_WIC6               (MCPARAMID)(10469 << 14)
+#define MC_DPFifoLinePitch_mw_WIC7               (MCPARAMID)(10470 << 14)
+#define MC_DPFifoLinePitch_mw_WIC8               (MCPARAMID)(10471 << 14)
+#define MC__Lead_W1_byte                         (MCPARAMID)(10472 << 14)
+#define MC__Lead_W2_byte                         (MCPARAMID)(10473 << 14)
+#define MC__Lead_W3_byte                         (MCPARAMID)(10474 << 14)
+#define MC__Lead_W4_byte                         (MCPARAMID)(10475 << 14)
+#define MC__Lead_W5_byte                         (MCPARAMID)(10476 << 14)
+#define MC__Lead_W6_byte                         (MCPARAMID)(10477 << 14)
+#define MC__Lead_W7_byte                         (MCPARAMID)(10478 << 14)
+#define MC__Lead_W8_byte                         (MCPARAMID)(10479 << 14)
+#define MC_OutputFormatterConfig_M8DUAL           63
+#define MC__TapPerWindow_X                       (MCPARAMID)(10480 << 14)
+#define MC_InputPinName_CK_PRESENT               138
+#define MC_InputPinName_CHANNELLINK_UP           139
+#define MC_ConnectorName_IO_A                     34
+#define MC_ConnectorName_IO_B                     35
+#define MC_ConnectorName_TEST_CHECK123            36
+#define MC_ConnectorName_TEST_CHECK153            37
+#define MC_ConnectorName_TEST_CHECK45678          38
+#define MC_ConnectorName_CHK12345                 39
+#define MC_GrabberOverrun_FrameBuffer_A          (MCPARAMID)(10481 << 14)
+#define MC_GrabberOverrun_FrameTrigger_A         (MCPARAMID)(10482 << 14)
+#define MC_GrabberOverrun_LineTrigger_A          (MCPARAMID)(10483 << 14)
+#define MC_GrabberError_Intraction_Gloeps_B_4    (MCPARAMID)(10484 << 14)
+#define MC_GrabberError_Intraction_Gloeps_B_3    (MCPARAMID)(10485 << 14)
+#define MC_GrabberError_Intraction_Gloeps_B_2    (MCPARAMID)(10486 << 14)
+#define MC_GrabberError_Intraction_Gloeps_B_1    (MCPARAMID)(10487 << 14)
+#define MC_GrabberError_AcqCtlr_Gloeps_B_1       (MCPARAMID)(10488 << 14)
+#define MC_GrabberError_CmdFifo_Gloeps_B_2       (MCPARAMID)(10489 << 14)
+#define MC_GrabberError_CmdFifo_Gloeps_B_1       (MCPARAMID)(10490 << 14)
+#define MC_GrabberError_FB64MemCtrl_B            (MCPARAMID)(10491 << 14)
+#define MC_GrabberError_free_23                  (MCPARAMID)(10492 << 14)
+#define MC_GrabberError_free_22                  (MCPARAMID)(10493 << 14)
+#define MC_GrabberError_free_21                  (MCPARAMID)(10494 << 14)
+#define MC_GrabberError_free_20                  (MCPARAMID)(10495 << 14)
+#define MC_GrabberError_free_19                  (MCPARAMID)(10496 << 14)
+#define MC_GrabberError_Vdma_Gloeps_3            (MCPARAMID)(10497 << 14)
+#define MC_GrabberError_Vdma_Gloeps_2            (MCPARAMID)(10498 << 14)
+#define MC_GrabberError_Vdma_Gloeps_1            (MCPARAMID)(10499 << 14)
+#define MC_GrabberError_Intraction_Gloeps_A_4    (MCPARAMID)(10500 << 14)
+#define MC_GrabberError_Intraction_Gloeps_A_3    (MCPARAMID)(10501 << 14)
+#define MC_GrabberError_Intraction_Gloeps_A_2    (MCPARAMID)(10502 << 14)
+#define MC_GrabberError_Intraction_Gloeps_A_1    (MCPARAMID)(10503 << 14)
+#define MC_GrabberError_AcqCtlr_Gloeps_A_1       (MCPARAMID)(10504 << 14)
+#define MC_GrabberError_CmdFifo_Gloeps_A_2       (MCPARAMID)(10505 << 14)
+#define MC_GrabberError_CmdFifo_Gloeps_A_1       (MCPARAMID)(10506 << 14)
+#define MC_GrabberError_FB64MemCtrl_A            (MCPARAMID)(10507 << 14)
+#define MC_GrabberError_free7                    (MCPARAMID)(10508 << 14)
+#define MC_GrabberError_free6                    (MCPARAMID)(10509 << 14)
+#define MC_GrabberError_ErrorLocalStreamDescAdd  (MCPARAMID)(10510 << 14)
+#define MC_GrabberError_DescriptorParityError03  (MCPARAMID)(10511 << 14)
+#define MC_GrabberError_DescriptorParityError02  (MCPARAMID)(10512 << 14)
+#define MC_GrabberError_DescriptorParityError01  (MCPARAMID)(10513 << 14)
+#define MC_GrabberError_DescriptorParityError00  (MCPARAMID)(10514 << 14)
+#define MC_GrabberOverrun_FrameBuffer_B          (MCPARAMID)(10515 << 14)
+#define MC_GrabberOverrun_FrameTrigger_B         (MCPARAMID)(10516 << 14)
+#define MC_GrabberOverrun_LineTrigger_B          (MCPARAMID)(10517 << 14)
+#define MC_InputFunction_TESTCHECK789             21
+#define MC_TestPerforce                          (MCPARAMID)(10518 << 14)
+#define MC_PhaseLength_Pg_Filter                 (MCPARAMID)(10519 << 14)
+#define MC_PreStrobe_us_Filter                   (MCPARAMID)(10520 << 14)
+#define MC_ResetEdge_Filter                      (MCPARAMID)(10521 << 14)
+#define MC_CBD_ColorRegistrationX                (MCPARAMID)(10522 << 14)
+#define MC_CBD_ColorRegistrationY                (MCPARAMID)(10523 << 14)
+#define MC_TrueExp_filter                        (MCPARAMID)(10524 << 14)
+#define MC__Category_Diagnosis                    65
+#define MC_GrabberError_Intr_PA_B                (MCPARAMID)(10525 << 14)
+#define MC_GrabberError_Intr_MisEOL_B            (MCPARAMID)(10526 << 14)
+#define MC_GrabberError_Intr_QB_Ovf_B            (MCPARAMID)(10527 << 14)
+#define MC_GrabberError_Intr_DPFF_Ovf_B          (MCPARAMID)(10528 << 14)
+#define MC_GrabberError_AcqVsXfr_B               (MCPARAMID)(10529 << 14)
+#define MC_GrabberError_AdrCmdFifo_2_B           (MCPARAMID)(10530 << 14)
+#define MC_GrabberError_AdrCmdFifo_1_B           (MCPARAMID)(10531 << 14)
+#define MC_GrabberError_MemCtrl_B                (MCPARAMID)(10532 << 14)
+#define MC_GrabberError_Intr_PA_A                (MCPARAMID)(10533 << 14)
+#define MC_GrabberError_Intr_MisEOL_A            (MCPARAMID)(10534 << 14)
+#define MC_GrabberError_Intr_QB_Ovf_A            (MCPARAMID)(10535 << 14)
+#define MC_GrabberError_Intr_DPFF_Ovf_A          (MCPARAMID)(10536 << 14)
+#define MC_GrabberError_AcqVsXfr_A               (MCPARAMID)(10537 << 14)
+#define MC_GrabberError_AdrCmdFifo_2_A           (MCPARAMID)(10538 << 14)
+#define MC_GrabberError_AdrCmdFifo_1_A           (MCPARAMID)(10539 << 14)
+#define MC_GrabberError_MemCtrl_A                (MCPARAMID)(10540 << 14)
+#define MC_GrabberError_Intr_PA                  (MCPARAMID)(10541 << 14)
+#define MC_GrabberError_MemCtrl                  (MCPARAMID)(10542 << 14)
+#define MC_OutputFormatterConfig_M14              64
+#define MC_OutputFormatterConfig_RGB42PL          65
+#define MC_CRP_Bypass                            (MCPARAMID)(10543 << 14)
+#define MC_CRP_NumLinePartToSkip                 (MCPARAMID)(10544 << 14)
+#define MC_CRP_NumVdmaWordToSkip                 (MCPARAMID)(10545 << 14)
+#define MC_CRP_NumVdmaWordToTransfer             (MCPARAMID)(10546 << 14)
+#define MC_CRP_PlanarMode                        (MCPARAMID)(10547 << 14)
+#define MC_CRP_NumLineToSkip                     (MCPARAMID)(10548 << 14)
+#define MC_CRP_NumLineToTransfer                 (MCPARAMID)(10549 << 14)
+#define MC_CRP_NumByteToSkip                     (MCPARAMID)(10550 << 14)
+#define MC_CRP_FBAddOffset                       (MCPARAMID)(10551 << 14)
+#define MC_ResetDur_Filter                       (MCPARAMID)(10552 << 14)
+#define MC_RateDivisionFactor                    (MCPARAMID)(10553 << 14)
+#define MC_RateDivisionFactor_Filter             (MCPARAMID)(10554 << 14)
+#define MC__TRG_FTDCNT_M1                        (MCPARAMID)(10555 << 14)
+#define MC__TRG_NTDCNT_M1                        (MCPARAMID)(10556 << 14)
+#define MC__LTRG_RDFCNT_M2                       (MCPARAMID)(10557 << 14)
+#define MC_AssyConfig_QUADXENDYEND                28
+#define MC__CTD_TDCLK_SYNCLINETRIG                 7
+#define MC_LineRateMode_MASTER_CHANNEL             6
+#define MC__STM1_T1SEL_SYNCLINETRIG               11
+#define MC_SyncLinescanMode                      (MCPARAMID)(10558 << 14)
+#define MC_SyncLinescanMode_IDLE                   1
+#define MC_SyncLinescanMode_MASTER                 2
+#define MC_SyncLinescanMode_SLAVE                  3
+#define MC_SyncLinescanMode_Filter               (MCPARAMID)(10559 << 14)
+#define MC__STM1_LRSEL_SYNCLINETRIG                5
+#define MC_IOUT2Usage_SYNC_STARTACQ                3
+#define MC_IOUT3Usage_SYNC_ENDACQ                  3
+#define MC_IOUT4Usage_SYNC_LINETRIG                3
+#define MC_IIN2Usage_SYNC_STARTACQ                 4
+#define MC_IIN3Usage_SYNC_ENDACQ                   4
+#define MC_IIN4Usage_SYNC_LINETRIG                 4
+#define MC_SyncLinescanMode_NONE                   4
+#define MC__RstCLClkOnChannelStart               (MCPARAMID)(10560 << 14)
+#define MC__RstCLClkOnChannelStart_ENABLED         1
+#define MC__RstCLClkOnChannelStart_DISABLED        2
+#define MC_PageOrLongPageModeOnly_Filter         (MCPARAMID)(10561 << 14)
+#define MC_WebOrLongPageModeOnly_Filter          (MCPARAMID)(10562 << 14)
+#define MC_EndPageDelay_Ln_Filter                (MCPARAMID)(10563 << 14)
+#define MC_AsyncRst_Filter                       (MCPARAMID)(10564 << 14)
+#define MC_BoardTopology_ECCO                     42
+#define MC_BoardTopology_ECCO_DECA                43
+#define MC_BoardTopology_ECCO_OFF                 44
+#define MC_SerialLinkA                           (MCPARAMID)(10565 << 14)
+#define MC_SerialLinkA_STANDARD                    1
+#define MC_SerialLinkB                           (MCPARAMID)(10566 << 14)
+#define MC_SerialLinkB_STANDARD                    1
+#define MC_TapConfiguration_LITE_1T8              48
+#define MC_TapConfiguration_LITE_1T10             49
+#define MC_IIN3Usage_SYNC_STARTENDACQ              5
+#define MC_IOUT3Usage_SYNC_STARTENDACQ             4
+#define MC_SyncLinescanMode_INTERNAL_MASTER        5
+#define MC_SyncLinescanMode_INTERNAL_SLAVE         6
+#define MC_TrigMode_MASTER_CHANNEL                10
+#define MC__SyncLinescanMode                     (MCPARAMID)(10567 << 14)
+#define MC__SyncLinescanMode_NONE                  1
+#define MC__SyncLinescanMode_MASTER                2
+#define MC__SyncLinescanMode_SLAVE                 3
+#define MC_EndTrigMode_MASTER_CHANNEL              3
+#define MC_SerialLinkA_POCL_LITE                   2
+#define MC_SerialLinkB_POCL_LITE                   2
+#define MC_ECCO_SkewCompensation                 (MCPARAMID)(10568 << 14)
+#define MC_ECCO_SkewCompensation_ON                1
+#define MC_ECCO_SkewCompensation_OFF               2
+#define MC_ECCO_Filter                           (MCPARAMID)(10569 << 14)
+#define MC_ECCO_PLLResetControl                  (MCPARAMID)(10570 << 14)
+#define MC_ECCO_PLLResetControl_CHANNEL_ACTIVE     1
+#define MC_ECCO_PLLResetControl_AUTOMATIC          2
+#define MC_SynchronizedAcquisition               (MCPARAMID)(10571 << 14)
+#define MC_SynchronizedAcquisition_OFF             1
+#define MC_SynchronizedAcquisition_MASTER          2
+#define MC_SynchronizedAcquisition_SLAVE           3
+#define MC_SynchronizedAcquisition_INTERNAL_MASTER   4
+#define MC_SynchronizedAcquisition_INTERNAL_SLAVE   5
+#define MC_SynchronizedAcquisition_Filter        (MCPARAMID)(10572 << 14)
+#define MC__SynchronizedAcquisition              (MCPARAMID)(10573 << 14)
+#define MC__SynchronizedAcquisition_OFF            1
+#define MC__SynchronizedAcquisition_MASTER         2
+#define MC__SynchronizedAcquisition_SLAVE          3
+#define MC_PixelClkMode                          (MCPARAMID)(10574 << 14)
+#define MC_PixelClkMode_PERMANENT                  1
+#define MC_PixelClkMode_INTERMITTENT               2
+#define MC_TrigMode_SLAVE                         11
+#define MC_EndTrigMode_SLAVE                       4
+#define MC_LineRateMode_SLAVE                      7
+#define MC_NextTrigMode_SLAVE                     11
+#define MC_SynchronizedAcquisition_LOCAL_MASTER    6
+#define MC_SynchronizedAcquisition_LOCAL_SLAVE     7
+#define MC_SetSignal                             (MCPARAMID)(10575 << 14)
+#define MC_SetSignal_NONE                          1
+#define MC_SetSignal_SCA                           2
+#define MC_SetSignal_ECA                           3
+#define MC_SetSignal_SAP                           4
+#define MC_SetSignal_EAP                           5
+#define MC_SetSignal_SAS                           6
+#define MC_SetSignal_EAS                           7
+#define MC_SetSignal_FVAL_GOHIGH                   8
+#define MC_SetSignal_FVAL_GOLOW                    9
+#define MC_SetSignal_LVAL_GOHIGH                  10
+#define MC_SetSignal_LVAL_GOLOW                   11
+#define MC_SetSignal_DVAL_GOHIGH                  12
+#define MC_SetSignal_DVAL_GOLOW                   13
+#define MC_SetSignal_CC1_GOHIGH                   14
+#define MC_SetSignal_CC1_GOLOW                    15
+#define MC_SetSignal_CC2_GOHIGH                   16
+#define MC_SetSignal_CC2_GOLOW                    17
+#define MC_SetSignal_CC3_GOHIGH                   18
+#define MC_SetSignal_CC3_GOLOW                    19
+#define MC_SetSignal_CC4_GOHIGH                   20
+#define MC_SetSignal_CC4_GOLOW                    21
+#define MC_ResetSignal                           (MCPARAMID)(10576 << 14)
+#define MC_ResetSignal_NONE                        1
+#define MC_ResetSignal_SCA                         2
+#define MC_ResetSignal_ECA                         3
+#define MC_ResetSignal_SAP                         4
+#define MC_ResetSignal_EAP                         5
+#define MC_ResetSignal_SAS                         6
+#define MC_ResetSignal_EAS                         7
+#define MC_ResetSignal_FVAL_GOHIGH                 8
+#define MC_ResetSignal_FVAL_GOLOW                  9
+#define MC_ResetSignal_LVAL_GOHIGH                10
+#define MC_ResetSignal_LVAL_GOLOW                 11
+#define MC_ResetSignal_DVAL_GOHIGH                12
+#define MC_ResetSignal_DVAL_GOLOW                 13
+#define MC_ResetSignal_CC1_GOHIGH                 14
+#define MC_ResetSignal_CC1_GOLOW                  15
+#define MC_ResetSignal_CC2_GOHIGH                 16
+#define MC_ResetSignal_CC2_GOLOW                  17
+#define MC_ResetSignal_CC3_GOHIGH                 18
+#define MC_ResetSignal_CC3_GOLOW                  19
+#define MC_ResetSignal_CC4_GOHIGH                 20
+#define MC_ResetSignal_CC4_GOLOW                  21
+#define MC_SetDelay                              (MCPARAMID)(10577 << 14)
+#define MC_SetDelay_NONE                           1
+#define MC_SetDelay_10us                           2
+#define MC_SetDelay_20us                           3
+#define MC_SetDelay_50us                           4
+#define MC_SetDelay_100us                          5
+#define MC_SetDelay_200us                          6
+#define MC_SetDelay_500us                          7
+#define MC_SetDelay_1ms                            8
+#define MC_SetDelay_2ms                            9
+#define MC_SetDelay_5ms                           10
+#define MC_SetDelay_10ms                          11
+#define MC_SetDelay_20ms                          12
+#define MC_SetDelay_50ms                          13
+#define MC_SetDelay_100ms                         14
+#define MC_SetDelay_200ms                         15
+#define MC_SetDelay_500ms                         16
+#define MC_ResetDelay                            (MCPARAMID)(10578 << 14)
+#define MC_ResetDelay_NONE                         1
+#define MC_ResetDelay_10us                         2
+#define MC_ResetDelay_20us                         3
+#define MC_ResetDelay_50us                         4
+#define MC_ResetDelay_100us                        5
+#define MC_ResetDelay_200us                        6
+#define MC_ResetDelay_500us                        7
+#define MC_ResetDelay_1ms                          8
+#define MC_ResetDelay_2ms                          9
+#define MC_ResetDelay_5ms                         10
+#define MC_ResetDelay_10ms                        11
+#define MC_ResetDelay_20ms                        12
+#define MC_ResetDelay_50ms                        13
+#define MC_ResetDelay_100ms                       14
+#define MC_ResetDelay_200ms                       15
+#define MC_ResetDelay_500ms                       16
+#define MC_OutputConfig_EVENT                      3
+#define MC_OutputFunction_EVENT                   16
+#define MC_IOUT1Usage_SOFT                         3
+#define MC_IOUT1Usage_EVENT                        4
+#define MC_IOUT2Usage_SOFT                         4
+#define MC_IOUT2Usage_EVENT                        5
+#define MC_IOUT3Usage_SOFT                         5
+#define MC_IOUT3Usage_EVENT                        6
+#define MC_IOUT4Usage_SOFT                         4
+#define MC_IOUT4Usage_EVENT                        5
+#define MC_BoardTopology_MONO_SLOW                45
+#define MC_ECCO_PLLResetControl_CHANNEL_ACTIVATION   3
+#define MC_BoardTopology_DUO_SLOW                 46
+#define MC__Out1FreeForChannel                   (MCPARAMID)(10579 << 14)
+#define MC__Out1FreeForChannel_NO                  1
+#define MC__Out1FreeForChannel_YES                 2
+#define MC__Out2FreeForChannel                   (MCPARAMID)(10580 << 14)
+#define MC__Out2FreeForChannel_NO                  1
+#define MC__Out2FreeForChannel_YES                 2
+#define MC__Out3FreeForChannel                   (MCPARAMID)(10581 << 14)
+#define MC__Out3FreeForChannel_NO                  1
+#define MC__Out3FreeForChannel_YES                 2
+#define MC__Out4FreeForChannel                   (MCPARAMID)(10582 << 14)
+#define MC__Out4FreeForChannel_NO                  1
+#define MC__Out4FreeForChannel_YES                 2
+#define MC__Out12FreeForChannel                  (MCPARAMID)(10583 << 14)
+#define MC__Out12FreeForChannel_NO                 1
+#define MC__Out12FreeForChannel_YES                2
+#define MC__Out13FreeForChannel                  (MCPARAMID)(10584 << 14)
+#define MC__Out13FreeForChannel_NO                 1
+#define MC__Out13FreeForChannel_YES                2
+#define MC__Out14FreeForChannel                  (MCPARAMID)(10585 << 14)
+#define MC__Out14FreeForChannel_NO                 1
+#define MC__Out14FreeForChannel_YES                2
+#define MC__Out15FreeForChannel                  (MCPARAMID)(10586 << 14)
+#define MC__Out15FreeForChannel_NO                 1
+#define MC__Out15FreeForChannel_YES                2
+#define MC_EventDelay_Filter                     (MCPARAMID)(10587 << 14)
+#define MC_IOUT1Usage_BOARD                        5
+#define MC_IOUT2Usage_BOARD                        6
+#define MC_IOUT3Usage_BOARD                        7
+#define MC_IOUT4Usage_BOARD                        6
+#define MC_EventSignaling_xx_Filter              (MCPARAMID)(10588 << 14)
+#define MC_EventSignaling_1_Filter               (MCPARAMID)(10589 << 14)
+#define MC_EventSignaling_2_Filter               (MCPARAMID)(10590 << 14)
+#define MC_EventSignaling_3_Filter               (MCPARAMID)(10591 << 14)
+#define MC_EventSignaling_4_Filter               (MCPARAMID)(10592 << 14)
+#define MC_EventSignaling_7_Filter               (MCPARAMID)(10593 << 14)
+#define MC_EventSignaling_8_Filter               (MCPARAMID)(10594 << 14)
+#define MC_EventSignaling_9_Filter               (MCPARAMID)(10595 << 14)
+#define MC_EventSignaling_10_Filter              (MCPARAMID)(10596 << 14)
+#define MC_FVAL_PULSE_MIN                        (MCPARAMID)(10597 << 14)
+#define MC_FVAL_PULSE_MIN_1                        1
+#define MC_FVAL_PULSE_MIN_3                        2
+#define MC_LVAL_PULSE_MIN                        (MCPARAMID)(10598 << 14)
+#define MC_LVAL_PULSE_MIN_1                        1
+#define MC_LVAL_PULSE_MIN_2                        2
+#define MC_RECOVERED_ERRORS_X                    (MCPARAMID)(10599 << 14)
+#define MC_RECOVERED_ERRORS_Y                    (MCPARAMID)(10600 << 14)
+#define MC_RECOVERED_ERRORS_Z                    (MCPARAMID)(10601 << 14)
+#define MC_CLOCKING_ERRORS_X                     (MCPARAMID)(10602 << 14)
+#define MC_CLOCKING_ERRORS_Y                     (MCPARAMID)(10603 << 14)
+#define MC_CLOCKING_ERRORS_Z                     (MCPARAMID)(10604 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_X      (MCPARAMID)(10605 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_X (MCPARAMID)(10606 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_X (MCPARAMID)(10607 << 14)
+#define MC_EventSignaling_12_Filter              (MCPARAMID)(10608 << 14)
+#define MC_EventSignaling_13_Filter              (MCPARAMID)(10609 << 14)
+#define MC_EventSignaling_14_Filter              (MCPARAMID)(10610 << 14)
+#define MC_EventSignaling_15_Filter              (MCPARAMID)(10611 << 14)
+#define MC_EventSignaling_18_Filter              (MCPARAMID)(10612 << 14)
+#define MC_EventSignaling_19_Filter              (MCPARAMID)(10613 << 14)
+#define MC_EventSignaling_20_Filter              (MCPARAMID)(10614 << 14)
+#define MC_EventSignaling_21_Filter              (MCPARAMID)(10615 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_B      (MCPARAMID)(10616 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_B (MCPARAMID)(10617 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_B (MCPARAMID)(10618 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_A      (MCPARAMID)(10619 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_A (MCPARAMID)(10620 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_A (MCPARAMID)(10621 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_Z      (MCPARAMID)(10622 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_Y      (MCPARAMID)(10623 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_Z (MCPARAMID)(10624 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_Z (MCPARAMID)(10625 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_Y (MCPARAMID)(10626 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_Y (MCPARAMID)(10627 << 14)
+#define MC_FvalMin_Tk                            (MCPARAMID)(10628 << 14)
+#define MC_FvalMin_Tk_1                            1
+#define MC_FvalMin_Tk_3                            2
+#define MC_LvalMin_Tk                            (MCPARAMID)(10629 << 14)
+#define MC_LvalMin_Tk_1                            1
+#define MC_LvalMin_Tk_2                            2
+#define MC_ChannelLinkSyncErrors_X               (MCPARAMID)(10630 << 14)
+#define MC_ChannelLinkClockErrors_X              (MCPARAMID)(10631 << 14)
+#define MC_ChannelLinkSyncErrors_Y               (MCPARAMID)(10632 << 14)
+#define MC_ChannelLinkSyncErrors_Z               (MCPARAMID)(10633 << 14)
+#define MC_ChannelLinkClockErrors_Y              (MCPARAMID)(10634 << 14)
+#define MC_ChannelLinkClockErrors_Z              (MCPARAMID)(10635 << 14)
+#define MC_ExposeReadoutRecovery_Filter          (MCPARAMID)(10636 << 14)
+#define MC_PCIeLinkInfo                          (MCPARAMID)(10637 << 14)
+#define MC_PCIeLinkRetrainingCounter             (MCPARAMID)(10638 << 14)
+#define MC_ECCOMode                              (MCPARAMID)(10639 << 14)
+#define MC_ECCOMode_YES                            1
+#define MC_ECCOMode_NO                             2
+#define MC_TapGeometry_10X                        61
+#define MC_TapGeometry_10X_1Y                     62
+#define MC_CLCAM_Geometry_TG_10X1                 30
+#define MC_AssyConfig_DECA_1X10                   29
+#define MC_AssyConfig_DECA_10X1                   30
+#define MC_XDirectionForWic9                     (MCPARAMID)(10640 << 14)
+#define MC_XDirectionForWic10                    (MCPARAMID)(10641 << 14)
+#define MC_YDirectionForWic9                     (MCPARAMID)(10642 << 14)
+#define MC_YDirectionForWic10                    (MCPARAMID)(10643 << 14)
+#define MC_NumOfWindows_TEN                        6
+#define MC__CDC_FSLIC_SIXTEEN_64                  15
+#define MC__LeadWords_W9                         (MCPARAMID)(10644 << 14)
+#define MC__LeadWords_W10                        (MCPARAMID)(10645 << 14)
+#define MC__Lead_W9                              (MCPARAMID)(10646 << 14)
+#define MC__Lead_W10                             (MCPARAMID)(10647 << 14)
+#define MC_YOffsetForWic9_mw                     (MCPARAMID)(10648 << 14)
+#define MC_YOffsetForWic10_mw                    (MCPARAMID)(10649 << 14)
+#define MC_WIC_WindowOffset_byte_Wic9            (MCPARAMID)(10650 << 14)
+#define MC_WIC_WindowOffset_byte_Wic10           (MCPARAMID)(10651 << 14)
+#define MC_WIC_WindowOffset_mw_Wic9              (MCPARAMID)(10652 << 14)
+#define MC_WIC_WindowOffset_mw_Wic10             (MCPARAMID)(10653 << 14)
+#define MC__CWR_XDirection_WIC9                  (MCPARAMID)(10654 << 14)
+#define MC__CWR_XDirection_WIC10                 (MCPARAMID)(10655 << 14)
+#define MC_CWR_YOffsetForWic9                    (MCPARAMID)(10656 << 14)
+#define MC_CWR_YOffsetForWic10                   (MCPARAMID)(10657 << 14)
+#define MC__Lead_W9_byte                         (MCPARAMID)(10658 << 14)
+#define MC__Lead_W10_byte                        (MCPARAMID)(10659 << 14)
+#define MC_DPFifoLinePitch_mw_WIC9               (MCPARAMID)(10660 << 14)
+#define MC_DPFifoLinePitch_mw_WIC10              (MCPARAMID)(10661 << 14)
+#define MC_AssyConfig_TRIPLEXPAIR                 31
+#define MC_AssyConfig_TRIPLEXTAP                  32
+#define MC__CDC_FSLIC_FOUR_128                    16
+#define MC_TrigRepeatCounter                     (MCPARAMID)(10662 << 14)
+#define MC__HardTriggerSrcIsEnabled              (MCPARAMID)(10663 << 14)
+#define MC__HardTriggerSrcIsEnabled_NO             1
+#define MC__HardTriggerSrcIsEnabled_YES            2
+#define MC_TrigRepeatCounterCheck                (MCPARAMID)(10664 << 14)
+#define MC_TrigRepeatCounterCheck_PASS             1
+#define MC_TrigRepeatCounterCheck_FAIL             2
+#define MC_TrigRepeatCountCheck                  (MCPARAMID)(10665 << 14)
+#define MC_TrigRepeatCountCheck_PASS               1
+#define MC_TrigRepeatCountCheck_FAIL               2
+#define MC_TrigRepeatCount                       (MCPARAMID)(10666 << 14)
+#define MC_EqualizationLevel                     (MCPARAMID)(10667 << 14)
+#define MC_EqualizationLevel_OFF                   1
+#define MC_EqualizationLevel_LOW                   2
+#define MC_EqualizationLevel_MEDIUM                3
+#define MC_EqualizationLevel_HIGH                  4
+#define MC_GrabberType_FullXR                      4
+#define MC_FullXR_Filter                         (MCPARAMID)(10668 << 14)
+#define MC_Equalizer_Feature                     (MCPARAMID)(10669 << 14)
+#define MC_Equalizer_Feature_YES                   1
+#define MC_Equalizer_Feature_NO                    2
+#define MC_Equalizer_Filter                      (MCPARAMID)(10670 << 14)
+#define MC_LvalDataGating                        (MCPARAMID)(10671 << 14)
+#define MC_LvalDataGating_OFF                      1
+#define MC_LvalDataGating_ON                       2
+#define MC_EndTrigEffect                         (MCPARAMID)(10672 << 14)
+#define MC_EndTrigEffect_FOLLOWINGLINE             1
+#define MC_EndTrigEffect_PREVIOUSLINE              2
+#define MC__BackwardMotionCancellation_Check     (MCPARAMID)(10673 << 14)
+#define MC__BackwardMotionCancellation_Check_PASS   1
+#define MC__BackwardMotionCancellation_Check_FAIL   2
+#define MC_EndTrigEffect_PRECEDINGLINE             3
+#define MC_EndTrigEffect_Filter                  (MCPARAMID)(10674 << 14)
+#define MC_TrigDelay_Pls_Filter                  (MCPARAMID)(10675 << 14)
+#define MC_NextTrigDelay_Pls_Filter              (MCPARAMID)(10676 << 14)
+#define MC_BackwardMotionCancellationMode_Filter (MCPARAMID)(10677 << 14)
+#define MC_ForwardDirection_Filter               (MCPARAMID)(10678 << 14)
+#define MC_AssyConfig_MEDIUM_2T24_2X_1Y           33
+#define MC_AssyConfig_MEDIUM_2T24_2XM_1Y          34
+#define MC_AssyConfig_MEDIUM_2T24_2XR_1Y          35
+#define MC_TapGeometry_1X_2Y                      63
+#define MC_CLCAM_Geometry_TG_1X_2Y                31
+#define MC_ECCO_Feature                          (MCPARAMID)(10679 << 14)
+#define MC_ECCO_Feature_YES                        1
+#define MC_ECCO_Feature_NO                         2
+#define MC__Category_White_Balance_Operator       66
+#define MC_WBO_OrgX_Internal                     (MCPARAMID)(10680 << 14)
+#define MC_WBO_OrgY_Internal                     (MCPARAMID)(10681 << 14)
+#define MC_Fld_Gain_R                            (MCPARAMID)(10682 << 14)
+#define MC_Fld_Gain_G                            (MCPARAMID)(10683 << 14)
+#define MC_Fld_Gain_B                            (MCPARAMID)(10684 << 14)
+#define MC_CPA_NumByteToPadd                     (MCPARAMID)(10685 << 14)
+#define MC_CPA_NumByteToPad                      (MCPARAMID)(10686 << 14)
+#define MC_WBO_OrgX_Min                          (MCPARAMID)(10687 << 14)
+#define MC_WBO_OrgY_Min                          (MCPARAMID)(10688 << 14)
+#define MC_WBO_Effective_Width                   (MCPARAMID)(10689 << 14)
+#define MC_WBO_Effective_Height                  (MCPARAMID)(10690 << 14)
+#define MC_WBO_Effective_OrgX                    (MCPARAMID)(10691 << 14)
+#define MC_WBO_Effective_OrgY                    (MCPARAMID)(10692 << 14)
+#define MC_WBO_OrgX_After_Flipping               (MCPARAMID)(10693 << 14)
+#define MC_WBO_Width_Min                         (MCPARAMID)(10694 << 14)
+#define MC_WBO_OrgY_After_Flipping               (MCPARAMID)(10695 << 14)
+#define MC_WBO_Height_Min                        (MCPARAMID)(10696 << 14)
+#define MC_MaxFillingBuffers                     (MCPARAMID)(10697 << 14)
+#define MC_WBO_Decimation_OffsetX                (MCPARAMID)(10698 << 14)
+#define MC_AcqTimeoutInHw_ms                     (MCPARAMID)(10699 << 14)
+#define MC_AcqTimeoutBounded_ms                  (MCPARAMID)(10700 << 14)
+#define MC_AcqTimeoutInHwMax_ms_c                (MCPARAMID)(10701 << 14)
+#define MC_AcqTimerTic_ns_c                      (MCPARAMID)(10702 << 14)
+#define MC_AcqTimerRge_tic_c                     (MCPARAMID)(10703 << 14)
+#define MC_AcqTimerTotalTics_flt                 (MCPARAMID)(10704 << 14)
+#define MC_AcqTimerTotalTics_int                 (MCPARAMID)(10705 << 14)
+#define MC_AcqTimerScaler_Fld                    (MCPARAMID)(10706 << 14)
+#define MC_AcqTimerScaler_int                    (MCPARAMID)(10707 << 14)
+#define MC_AcqTimerCounter_Fld                   (MCPARAMID)(10708 << 14)
+#define MC_AcqTimerMax_tic_c                     (MCPARAMID)(10709 << 14)
+#define MC_AcqTimeoutInHw_bounded_ms             (MCPARAMID)(10710 << 14)
+#define MC_AcqTimeOutCheck                       (MCPARAMID)(10711 << 14)
+#define MC_AcqTimeOutCheck_PASS                    1
+#define MC_AcqTimeOutCheck_FAIL                    2
+#define MC_MaxFillingSurfaces                    (MCPARAMID)(10712 << 14)
+#define MC_MaxFillingSurfaces_MINIMUM              1
+#define MC_MaxFillingSurfaces_MAXIMUM              2
+#define MC_TapGeometry_2XM_1Y2                    64
+#define MC_TapGeometry_2XR_2YE                    65
+#define MC_CLCAM_Geometry_TG_1X2_1Y2              32
+#define MC_CLCAM_Geometry_TG_2X_1Y2               33
+#define MC_CLCAM_Geometry_TG_2XE_1Y2              34
+#define MC_CLCAM_Geometry_TG_2XM_1Y2              35
+#define MC_AssyConfig_QUADXPAIRYPAIR              36
+#define MC_XRegions                              (MCPARAMID)(10713 << 14)
+#define MC_TapConfiguration_MEDIUM_6T8            50
+#define MC_TapGeometry_1X3_1Y2                    66
+#define MC_TapGeometry_2X2_1Y2                    67
+#define MC_TapGeometry_2X2E_1Y2                   68
+#define MC_TapGeometry_2X2M_1Y2                   69
+#define MC_TapGeometry_3X_1Y2                     70
+#define MC_TapGeometry_1X3_2YE                    71
+#define MC_TapGeometry_1X4_2YE                    72
+#define MC_TapGeometry_2X2_2YE                    73
+#define MC_TapGeometry_3X_2YE                     74
+#define MC_TapGeometry_4X_2YE                     75
+#define MC_TapGeometry_4XE_2YE                    76
+#define MC_TapGeometry_4XR_2YE                    77
+#define MC_TapGeometry_Y                         (MCPARAMID)(10714 << 14)
+#define MC_TapGeometry_Y_1Y                        1
+#define MC_TapGeometry_Y_1Y2                       2
+#define MC_TapGeometry_Y_2YE                       3
+#define MC_AssyConfig_1X                          37
+#define MC_AssyConfig_1X2                         38
+#define MC_AssyConfig_1X3                         39
+#define MC_AssyConfig_1X4                         40
+#define MC_AssyConfig_1X8                         41
+#define MC_AssyConfig_1X10                        42
+#define MC_AssyConfig_2X                          43
+#define MC_AssyConfig_2XE                         44
+#define MC_AssyConfig_2XM                         45
+#define MC_AssyConfig_2XR                         46
+#define MC_AssyConfig_2X2                         47
+#define MC_AssyConfig_2X2E                        48
+#define MC_AssyConfig_2X2M                        49
+#define MC_AssyConfig_2X4                         50
+#define MC_AssyConfig_3X                          51
+#define MC_AssyConfig_4X                          52
+#define MC_AssyConfig_4XE                         53
+#define MC_AssyConfig_4XR                         54
+#define MC_AssyConfig_4X2                         55
+#define MC_AssyConfig_4X2E                        56
+#define MC_AssyConfig_8X                          57
+#define MC_AssyConfig_8XR                         58
+#define MC_AssyConfig_10X                         59
+#define MC_AssyConfig_1X_2                        60
+#define MC_AssyConfig_1X2_2                       61
+#define MC_AssyConfig_1X3_2                       62
+#define MC_AssyConfig_1X4_2                       63
+#define MC_AssyConfig_2X_2                        64
+#define MC_AssyConfig_2XE_2                       65
+#define MC_AssyConfig_2XM_2                       66
+#define MC_AssyConfig_2XR_2                       67
+#define MC_AssyConfig_2X2_2                       68
+#define MC_AssyConfig_2X2E_2                      69
+#define MC_AssyConfig_2X2M_2                      70
+#define MC_AssyConfig_3X_2                        71
+#define MC_AssyConfig_4X_2                        72
+#define MC_AssyConfig_4XE_2                       73
+#define MC_AssyConfig_4XR_2                       74
+#define MC_NumOfWindows_SIX                        7
+#define MC_RegionIndex_x_Wic1                    (MCPARAMID)(10715 << 14)
+#define MC_RegionIndex_x_Wic2                    (MCPARAMID)(10716 << 14)
+#define MC_RegionIndex_x_Wic3                    (MCPARAMID)(10717 << 14)
+#define MC_RegionIndex_x_Wic4                    (MCPARAMID)(10718 << 14)
+#define MC_RegionIndex_x_Wic5                    (MCPARAMID)(10719 << 14)
+#define MC_RegionIndex_x_Wic6                    (MCPARAMID)(10720 << 14)
+#define MC_RegionIndex_x_Wic7                    (MCPARAMID)(10721 << 14)
+#define MC_RegionIndex_x_Wic8                    (MCPARAMID)(10722 << 14)
+#define MC_RegionIndex_x_Wic9                    (MCPARAMID)(10723 << 14)
+#define MC_RegionIndex_x_Wic10                   (MCPARAMID)(10724 << 14)
+#define MC_RegionIndex_y_Wic1                    (MCPARAMID)(10725 << 14)
+#define MC_RegionIndex_y_Wic2                    (MCPARAMID)(10726 << 14)
+#define MC_RegionIndex_y_Wic3                    (MCPARAMID)(10727 << 14)
+#define MC_RegionIndex_y_Wic4                    (MCPARAMID)(10728 << 14)
+#define MC_RegionIndex_y_Wic5                    (MCPARAMID)(10729 << 14)
+#define MC_RegionIndex_y_Wic6                    (MCPARAMID)(10730 << 14)
+#define MC_RegionIndex_y_Wic7                    (MCPARAMID)(10731 << 14)
+#define MC_RegionIndex_y_Wic8                    (MCPARAMID)(10732 << 14)
+#define MC_RegionIndex_y_Wic9                    (MCPARAMID)(10733 << 14)
+#define MC_RegionIndex_y_Wic10                   (MCPARAMID)(10734 << 14)
+#define MC_RegionOffset_Wic1                     (MCPARAMID)(10735 << 14)
+#define MC_RegionOffset_Wic2                     (MCPARAMID)(10736 << 14)
+#define MC_RegionOffset_Wic3                     (MCPARAMID)(10737 << 14)
+#define MC_RegionOffset_Wic4                     (MCPARAMID)(10738 << 14)
+#define MC_RegionOffset_Wic5                     (MCPARAMID)(10739 << 14)
+#define MC_RegionOffset_Wic6                     (MCPARAMID)(10740 << 14)
+#define MC_RegionOffset_Wic7                     (MCPARAMID)(10741 << 14)
+#define MC_RegionOffset_Wic8                     (MCPARAMID)(10742 << 14)
+#define MC_RegionOffset_Wic9                     (MCPARAMID)(10743 << 14)
+#define MC_RegionOffset_Wic10                    (MCPARAMID)(10744 << 14)
+#define MC_XDirectionForD1                       (MCPARAMID)(10745 << 14)
+#define MC_XDirectionForD2                       (MCPARAMID)(10746 << 14)
+#define MC_XDirectionForD3                       (MCPARAMID)(10747 << 14)
+#define MC_XDirectionForD4                       (MCPARAMID)(10748 << 14)
+#define MC_XDirectionForD5                       (MCPARAMID)(10749 << 14)
+#define MC_XDirectionForD6                       (MCPARAMID)(10750 << 14)
+#define MC_XDirectionForD7                       (MCPARAMID)(10751 << 14)
+#define MC_XDirectionForD8                       (MCPARAMID)(10752 << 14)
+#define MC_XDirectionForD9                       (MCPARAMID)(10753 << 14)
+#define MC_XDirectionForD10                      (MCPARAMID)(10754 << 14)
+#define MC_CLCAM_Geometry_TG_2XR_1Y2              36
+#define MC_CLCAM_Geometry_TG_2XR_2YE              37
+#define MC_CLCAM_Geometry_TG_1X3_1Y2              38
+#define MC_CLCAM_Geometry_TG_3X_1Y2               39
+#define MC_CLCAM_Geometry_TG_1X3_2YE              40
+#define MC_CLCAM_Geometry_TG_3X_2YE               41
+#define MC_CLCAM_Geometry_TG_1X4_1Y2              42
+#define MC_CLCAM_Geometry_TG_4X_1Y2               43
+#define MC_CLCAM_Geometry_TG_4XE_1Y2              44
+#define MC_CLCAM_Geometry_TG_4XR_1Y2              45
+#define MC_CLCAM_Geometry_TG_2X2_1Y2              46
+#define MC_CLCAM_Geometry_TG_2X2E_1Y2             47
+#define MC_CLCAM_Geometry_TG_2X2M_1Y2             48
+#define MC_CLCAM_Geometry_TG_1X4_2YE              49
+#define MC_CLCAM_Geometry_TG_4X_2YE               50
+#define MC_CLCAM_Geometry_TG_4XE_2YE              51
+#define MC_CLCAM_Geometry_TG_4XR_2YE              52
+#define MC_CLCAM_Geometry_TG_2X2_2YE              53
+#define MC_CLCAM_Geometry_TG_2X2M_2YE             54
+#define MC_CLCAM_Geometry_TG_10X                  55
+#define MC_YOffsetForAllWics_mw                  (MCPARAMID)(10755 << 14)
+#define MC_CWR_YOffsetForAllWics                 (MCPARAMID)(10756 << 14)
+#define MC_XDirectionForW1                       (MCPARAMID)(10757 << 14)
+#define MC_XDirectionForW2                       (MCPARAMID)(10758 << 14)
+#define MC_XDirectionForW3                       (MCPARAMID)(10759 << 14)
+#define MC_XDirectionForW4                       (MCPARAMID)(10760 << 14)
+#define MC_XDirectionForW5                       (MCPARAMID)(10761 << 14)
+#define MC_XDirectionForW6                       (MCPARAMID)(10762 << 14)
+#define MC_XDirectionForW7                       (MCPARAMID)(10763 << 14)
+#define MC_XDirectionForW8                       (MCPARAMID)(10764 << 14)
+#define MC_XDirectionForW9                       (MCPARAMID)(10765 << 14)
+#define MC_XDirectionForW10                      (MCPARAMID)(10766 << 14)
+#define MC__CDA_REFASSYNR_WIC1                   (MCPARAMID)(10767 << 14)
+#define MC__CDA_REFASSYNR_WIC2                   (MCPARAMID)(10768 << 14)
+#define MC__CDA_REFASSYNR_WIC3                   (MCPARAMID)(10769 << 14)
+#define MC__CDA_REFASSYNR_WIC4                   (MCPARAMID)(10770 << 14)
+#define MC__CDA_REFASSYNR_W1                     (MCPARAMID)(10771 << 14)
+#define MC__CDA_REFASSYNR_W2                     (MCPARAMID)(10772 << 14)
+#define MC__CDA_REFASSYNR_W3                     (MCPARAMID)(10773 << 14)
+#define MC__CDA_REFASSYNR_W4                     (MCPARAMID)(10774 << 14)
+#define MC__CDA_REFASSYNR_W5                     (MCPARAMID)(10775 << 14)
+#define MC__CDA_REFASSYNR_W6                     (MCPARAMID)(10776 << 14)
+#define MC__CDA_REFASSYNR_W7                     (MCPARAMID)(10777 << 14)
+#define MC__CDA_REFASSYNR_W8                     (MCPARAMID)(10778 << 14)
+#define MC__CDA_REFASSYNR_W9                     (MCPARAMID)(10779 << 14)
+#define MC__CDA_REFASSYNR_W10                    (MCPARAMID)(10780 << 14)
+#define MC__CDA_REFASSYNR_D1                     (MCPARAMID)(10781 << 14)
+#define MC__CDA_REFASSYNR_D2                     (MCPARAMID)(10782 << 14)
+#define MC__CDA_REFASSYNR_D3                     (MCPARAMID)(10783 << 14)
+#define MC__CDA_REFASSYNR_D4                     (MCPARAMID)(10784 << 14)
+#define MC__CDA_REFASSYNR_D5                     (MCPARAMID)(10785 << 14)
+#define MC__CDA_REFASSYNR_D6                     (MCPARAMID)(10786 << 14)
+#define MC__CDA_REFASSYNR_D7                     (MCPARAMID)(10787 << 14)
+#define MC__CDA_REFASSYNR_D8                     (MCPARAMID)(10788 << 14)
+#define MC__CDA_REFASSYNR_D9                     (MCPARAMID)(10789 << 14)
+#define MC__CDA_REFASSYNR_D10                    (MCPARAMID)(10790 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic1        (MCPARAMID)(10791 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic2        (MCPARAMID)(10792 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic3        (MCPARAMID)(10793 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic4        (MCPARAMID)(10794 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic5        (MCPARAMID)(10795 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic6        (MCPARAMID)(10796 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic7        (MCPARAMID)(10797 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic8        (MCPARAMID)(10798 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic9        (MCPARAMID)(10799 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic10       (MCPARAMID)(10800 << 14)
+#define MC_P1INDEX                               (MCPARAMID)(10801 << 14)
+#define MC_P2INDEX                               (MCPARAMID)(10802 << 14)
+#define MC_P3INDEX                               (MCPARAMID)(10803 << 14)
+#define MC_P4INDEX                               (MCPARAMID)(10804 << 14)
+#define MC_P5INDEX                               (MCPARAMID)(10805 << 14)
+#define MC_P6INDEX                               (MCPARAMID)(10806 << 14)
+#define MC_P7INDEX                               (MCPARAMID)(10807 << 14)
+#define MC_P8INDEX                               (MCPARAMID)(10808 << 14)
+#define MC_P9INDEX                               (MCPARAMID)(10809 << 14)
+#define MC_P10INDEX                              (MCPARAMID)(10810 << 14)
+#define MC_P1_DINDEX                             (MCPARAMID)(10811 << 14)
+#define MC_P2_DINDEX                             (MCPARAMID)(10812 << 14)
+#define MC_P3_DINDEX                             (MCPARAMID)(10813 << 14)
+#define MC_P4_DINDEX                             (MCPARAMID)(10814 << 14)
+#define MC_P5_DINDEX                             (MCPARAMID)(10815 << 14)
+#define MC_P6_DINDEX                             (MCPARAMID)(10816 << 14)
+#define MC_P7_DINDEX                             (MCPARAMID)(10817 << 14)
+#define MC_P8_DINDEX                             (MCPARAMID)(10818 << 14)
+#define MC_P9_DINDEX                             (MCPARAMID)(10819 << 14)
+#define MC_P10_DINDEX                            (MCPARAMID)(10820 << 14)
+#define MC_CDA_P1INDEX                           (MCPARAMID)(10821 << 14)
+#define MC_Default_P1_DINDEX                     (MCPARAMID)(10822 << 14)
+#define MC_Default_P2_DINDEX                     (MCPARAMID)(10823 << 14)
+#define MC_Default_P3_DINDEX                     (MCPARAMID)(10824 << 14)
+#define MC_Default_P4_DINDEX                     (MCPARAMID)(10825 << 14)
+#define MC_Default_P5_DINDEX                     (MCPARAMID)(10826 << 14)
+#define MC_Default_P6_DINDEX                     (MCPARAMID)(10827 << 14)
+#define MC_Default_P7_DINDEX                     (MCPARAMID)(10828 << 14)
+#define MC_Default_P8_DINDEX                     (MCPARAMID)(10829 << 14)
+#define MC_Default_P9_DINDEX                     (MCPARAMID)(10830 << 14)
+#define MC_Default_P10_DINDEX                    (MCPARAMID)(10831 << 14)
+#define MC__CDA_D1INDEX                          (MCPARAMID)(10832 << 14)
+#define MC__CDA_D2INDEX                          (MCPARAMID)(10833 << 14)
+#define MC__CDA_D3INDEX                          (MCPARAMID)(10834 << 14)
+#define MC__CDA_D4INDEX                          (MCPARAMID)(10835 << 14)
+#define MC__CDA_D5INDEX                          (MCPARAMID)(10836 << 14)
+#define MC__CDA_D6INDEX                          (MCPARAMID)(10837 << 14)
+#define MC__CDA_D7INDEX                          (MCPARAMID)(10838 << 14)
+#define MC__CDA_D8INDEX                          (MCPARAMID)(10839 << 14)
+#define MC__CDA_D9INDEX                          (MCPARAMID)(10840 << 14)
+#define MC__CDA_D10INDEX                         (MCPARAMID)(10841 << 14)
+#define MC_TapConfiguration_FULL_8T8C             51
+#define MC_TapConfiguration_DECA_10T8C            52
+#define MC_MetadataInsertion                     (MCPARAMID)(10842 << 14)
+#define MC_MetadataInsertion_ENABLE                1
+#define MC_MetadataInsertion_DISABLE               2
+#define MC_MetadataInsertion_Filter              (MCPARAMID)(10843 << 14)
+#define MC_MetadataFeatureCheck                  (MCPARAMID)(10844 << 14)
+#define MC_MetadataFeatureCheck_PASS               1
+#define MC_MetadataFeatureCheck_FAIL               2
+#define MC_VideoFormat                           (MCPARAMID)(10845 << 14)
+#define MC_VideoFormat_AUTO                        1
+#define MC_VideoFormat_NTSC_M                      2
+#define MC_VideoFormat_PAL_B                       3
+#define MC_VideoFormat_PAL_M                       4
+#define MC_VideoFormat_PAL_N                       5
+#define MC_VideoFormat_PAL_NC                      6
+#define MC_Metadata_XChan_MuxWidth               (MCPARAMID)(10846 << 14)
+#define MC_Metadata_XChan_MuxWidth_W_8BIT          1
+#define MC_Metadata_XChan_MuxWidth_W_12BIT         2
+#define MC_Metadata_XChan_MuxWidth_W_16BIT         3
+#define MC_Metadata_XChan_MuxWidth_W_24BIT         4
+#define MC_Metadata_BitMapping                   (MCPARAMID)(10847 << 14)
+#define MC_Metadata_BitMapping_MONO                1
+#define MC_Metadata_BitMapping_RGB_1F              2
+#define MC_Metadata_BitMapping_RGB_2F              3
+#define MC_Metadata_YChan_Mux                    (MCPARAMID)(10848 << 14)
+#define MC_Metadata_YChan_Mux_ENABLE               1
+#define MC_Metadata_YChan_Mux_DISABLE              2
+#define MC_MetadataContent                       (MCPARAMID)(10849 << 14)
+#define MC_MetadataContent_NONE                    1
+#define MC_MetadataContent_ONE_FIELD               2
+#define MC_MetadataContent_TWO_FIELD               3
+#define MC_MetadataContent_THREE_FIELD             4
+#define MC_ColorRegistrationControl              (MCPARAMID)(10850 << 14)
+#define MC_ColorRegistrationControl_NONE           1
+#define MC_ColorRegistrationControl_FVAL           2
+#define MC_ColorRegistrationControl_Filter       (MCPARAMID)(10851 << 14)
+#define MC_TrigCtl_CAMERA                         18
+#define MC_TrigLine_FVAL                          38
+#define MC_EndTrigLine_FVAL                       29
+#define MC_EndTrigCtl_CAMERA                      11
+#define MC__TrigLine_FVAL                         42
+#define MC__EndTrigLine_FVAL                      27
+#define MC_BoardTopologyType                     (MCPARAMID)(10852 << 14)
+#define MC_BoardTopologyType_SLOW                  1
+#define MC_BoardTopologyType_ECCO                  2
+#define MC__TRG_FTSEL_FromFVAL                    30
+#define MC__TRG_EFTSEL_FromFVAL                   24
+#define MC_BoardTopology_MONO_DECA_DFE            47
+#define MC_LvalLineCheck                         (MCPARAMID)(10853 << 14)
+#define MC_LvalLineCheck_ON                        1
+#define MC_LvalLineCheck_OFF                       2
+#define MC_DFE_Mode                              (MCPARAMID)(10854 << 14)
+#define MC_DFE_Mode_ON                             1
+#define MC_DFE_Mode_OFF                            2
+#define MC_ForcePLLReset                         (MCPARAMID)(10855 << 14)
+#define MC_ForcePLLReset_X                         1
+#define MC_ForcePLLReset_Y                         2
+#define MC_ForcePLLReset_Z                         3
+#define MC_ForcePLLReset_X_AND_Y                   4
+#define MC_ForcePLLReset_X_AND_Z                   5
+#define MC_ForcePLLReset_Y_AND_Z                   6
+#define MC_ForcePLLReset_X_AND_Y_AND_Z             7
+#define MC_ForcePLLReset_NONE                      8
+#define MC_DFE_Filter                            (MCPARAMID)(10856 << 14)
+#define MC_PLLRestartDelay                       (MCPARAMID)(10857 << 14)
+#define MC_PLLRestartDelay_Delay_500us             1
+#define MC_PLLRestartDelay_Delay_5ms               2
+#define MC_PLLRestartDelay_Delay_50ms              3
+#define MC_PLLRestartDelay_Delay_100ms             4
+#define MC_AcquiringLinesWhileChannelLinkNotSynced (MCPARAMID)(10858 << 14)
+#define MC_GrabberOverrun_AcqLinesWhNotSynced    (MCPARAMID)(10859 << 14)
+#define MC_ChannelLinkPLLGoingUp_X               (MCPARAMID)(10860 << 14)
+#define MC_ChannelLinkPLLGoingUp_Y               (MCPARAMID)(10861 << 14)
+#define MC_ChannelLinkPLLGoingUp_Z               (MCPARAMID)(10862 << 14)
+#define MC_ChannelLinkPLLGoingDown_X             (MCPARAMID)(10863 << 14)
+#define MC_ChannelLinkPLLGoingDown_Y             (MCPARAMID)(10864 << 14)
+#define MC_ChannelLinkPLLGoingDown_Z             (MCPARAMID)(10865 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingUp_X      (MCPARAMID)(10866 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingUp_Y      (MCPARAMID)(10867 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingUp_Z      (MCPARAMID)(10868 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingDown_X    (MCPARAMID)(10869 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingDown_Y    (MCPARAMID)(10870 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingDown_Z    (MCPARAMID)(10871 << 14)
+#define MC_Allow_DFE                             (MCPARAMID)(10872 << 14)
+#define MC_Allow_DFE_YES                           1
+#define MC_Allow_DFE_NO                            2
+#define MC_CLCAM_AreaScan                        (MCPARAMID)(10873 << 14)
+#define MC_Timer1ProgramMode                     (MCPARAMID)(10874 << 14)
+#define MC_Timer1ProgramMode_SINGLE                1
+#define MC_Timer1ProgramMode_DUAL                  2
+#define MC__PRM1_T1P1DEF_01                      (MCPARAMID)(10875 << 14)
+#define MC__PRM1_T1P1DEF_02                      (MCPARAMID)(10876 << 14)
+#define MC__PRM1_T1P1DEF_03                      (MCPARAMID)(10877 << 14)
+#define MC__PRM1_T1P1DEF_04                      (MCPARAMID)(10878 << 14)
+#define MC__PRM1_T1P1DEF_05                      (MCPARAMID)(10879 << 14)
+#define MC__PRM1_T1P1DEF_06                      (MCPARAMID)(10880 << 14)
+#define MC__PRM1_T1P1DEF_07                      (MCPARAMID)(10881 << 14)
+#define MC__PRM1_T1P1DEF_08                      (MCPARAMID)(10882 << 14)
+#define MC__PRM1_T1P1DEF_09                      (MCPARAMID)(10883 << 14)
+#define MC__PRM1_T1P1DEF_10                      (MCPARAMID)(10884 << 14)
+#define MC__PRM1_T1P1DEF_11                      (MCPARAMID)(10885 << 14)
+#define MC__PRM1_T1P1DEF_12                      (MCPARAMID)(10886 << 14)
+#define MC__PRM1_T1P1DEF_13                      (MCPARAMID)(10887 << 14)
+#define MC__PRM1_T1P1DEF_14                      (MCPARAMID)(10888 << 14)
+#define MC__PRM1_T1P1DEF_15                      (MCPARAMID)(10889 << 14)
+#define MC__PRM1_T1P1POS_01                      (MCPARAMID)(10890 << 14)
+#define MC__PRM1_T1P1POS_02                      (MCPARAMID)(10891 << 14)
+#define MC__PRM1_T1P1POS_03                      (MCPARAMID)(10892 << 14)
+#define MC__PRM1_T1P1POS_04                      (MCPARAMID)(10893 << 14)
+#define MC__PRM1_T1P1POS_05                      (MCPARAMID)(10894 << 14)
+#define MC__PRM1_T1P1POS_06                      (MCPARAMID)(10895 << 14)
+#define MC__PRM1_T1P1POS_07                      (MCPARAMID)(10896 << 14)
+#define MC__PRM1_T1P1POS_08                      (MCPARAMID)(10897 << 14)
+#define MC__PRM1_T1P1POS_09                      (MCPARAMID)(10898 << 14)
+#define MC__PRM1_T1P1POS_10                      (MCPARAMID)(10899 << 14)
+#define MC__PRM1_T1P1POS_11                      (MCPARAMID)(10900 << 14)
+#define MC__PRM1_T1P1POS_12                      (MCPARAMID)(10901 << 14)
+#define MC__PRM1_T1P1POS_13                      (MCPARAMID)(10902 << 14)
+#define MC__PRM1_T1P1POS_14                      (MCPARAMID)(10903 << 14)
+#define MC__PRM1_T1P1POS_15                      (MCPARAMID)(10904 << 14)
+#define MC__PRM1_T1P2DEF_01                      (MCPARAMID)(10905 << 14)
+#define MC__PRM1_T1P2DEF_02                      (MCPARAMID)(10906 << 14)
+#define MC__PRM1_T1P2DEF_03                      (MCPARAMID)(10907 << 14)
+#define MC__PRM1_T1P2DEF_04                      (MCPARAMID)(10908 << 14)
+#define MC__PRM1_T1P2DEF_05                      (MCPARAMID)(10909 << 14)
+#define MC__PRM1_T1P2DEF_06                      (MCPARAMID)(10910 << 14)
+#define MC__PRM1_T1P2DEF_07                      (MCPARAMID)(10911 << 14)
+#define MC__PRM1_T1P2DEF_08                      (MCPARAMID)(10912 << 14)
+#define MC__PRM1_T1P2DEF_09                      (MCPARAMID)(10913 << 14)
+#define MC__PRM1_T1P2DEF_10                      (MCPARAMID)(10914 << 14)
+#define MC__PRM1_T1P2DEF_11                      (MCPARAMID)(10915 << 14)
+#define MC__PRM1_T1P2DEF_12                      (MCPARAMID)(10916 << 14)
+#define MC__PRM1_T1P2DEF_13                      (MCPARAMID)(10917 << 14)
+#define MC__PRM1_T1P2DEF_14                      (MCPARAMID)(10918 << 14)
+#define MC__PRM1_T1P2DEF_15                      (MCPARAMID)(10919 << 14)
+#define MC__PRM1_T1P2POS_01                      (MCPARAMID)(10920 << 14)
+#define MC__PRM1_T1P2POS_02                      (MCPARAMID)(10921 << 14)
+#define MC__PRM1_T1P2POS_03                      (MCPARAMID)(10922 << 14)
+#define MC__PRM1_T1P2POS_04                      (MCPARAMID)(10923 << 14)
+#define MC__PRM1_T1P2POS_05                      (MCPARAMID)(10924 << 14)
+#define MC__PRM1_T1P2POS_06                      (MCPARAMID)(10925 << 14)
+#define MC__PRM1_T1P2POS_07                      (MCPARAMID)(10926 << 14)
+#define MC__PRM1_T1P2POS_08                      (MCPARAMID)(10927 << 14)
+#define MC__PRM1_T1P2POS_09                      (MCPARAMID)(10928 << 14)
+#define MC__PRM1_T1P2POS_10                      (MCPARAMID)(10929 << 14)
+#define MC__PRM1_T1P2POS_11                      (MCPARAMID)(10930 << 14)
+#define MC__PRM1_T1P2POS_12                      (MCPARAMID)(10931 << 14)
+#define MC__PRM1_T1P2POS_13                      (MCPARAMID)(10932 << 14)
+#define MC__PRM1_T1P2POS_14                      (MCPARAMID)(10933 << 14)
+#define MC__PRM1_T1P2POS_15                      (MCPARAMID)(10934 << 14)
+#define MC__Category_Interleaved_Acquisition      67
+#define MC___Timer1_ONEPROG_Check                (MCPARAMID)(10935 << 14)
+#define MC___Timer1_ONEPROG_Check_PASS             1
+#define MC___Timer1_ONEPROG_Check_FAIL             2
+#define MC_InterleavedAcquisition                (MCPARAMID)(10936 << 14)
+#define MC_InterleavedAcquisition_OFF              1
+#define MC_InterleavedAcquisition_ON               2
+#define MC_InterleavedAcquisition_Filter         (MCPARAMID)(10937 << 14)
+#define MC_GCE_1P_Filter                         (MCPARAMID)(10938 << 14)
+#define MC__DefaultExposureTime_us               (MCPARAMID)(10939 << 14)
+#define MC_ExposureTime_P1_us                    (MCPARAMID)(10940 << 14)
+#define MC_ExposureTime_P2_us                    (MCPARAMID)(10941 << 14)
+#define MC_GCE_2P_Filter                         (MCPARAMID)(10942 << 14)
+#define MC_Expose_P1_Effective_us                (MCPARAMID)(10943 << 14)
+#define MC_Expose_P2_Effective_us                (MCPARAMID)(10944 << 14)
+#define MC__EXPWidth_Min_T1                      (MCPARAMID)(10945 << 14)
+#define MC__EXPWidth_Max_T1                      (MCPARAMID)(10946 << 14)
+#define MC__EXPWidth_P1_T1                       (MCPARAMID)(10947 << 14)
+#define MC__EXPWidth_P2_T1                       (MCPARAMID)(10948 << 14)
+#define MC__DefaultStrobeDuration_us             (MCPARAMID)(10949 << 14)
+#define MC_StrobeDuration_P1_us                  (MCPARAMID)(10950 << 14)
+#define MC_StrobeDuration_P2_us                  (MCPARAMID)(10951 << 14)
+#define MC__DefaultStrobeDelay_us                (MCPARAMID)(10952 << 14)
+#define MC_StrobeDelay_P1_us                     (MCPARAMID)(10953 << 14)
+#define MC_StrobeDelay_P2_us                     (MCPARAMID)(10954 << 14)
+#define MC_StrobeLine_P1                         (MCPARAMID)(10955 << 14)
+#define MC_StrobeLine_P1_IOUT1                     1
+#define MC_StrobeLine_P2                         (MCPARAMID)(10956 << 14)
+#define MC_StrobeLine_P2_IOUT2                     1
+#define MC__STROBEWidth_P1_T1                    (MCPARAMID)(10957 << 14)
+#define MC__STROBEWidth_P2_T1                    (MCPARAMID)(10958 << 14)
+#define MC__EXPOn2STROBEOn_P1_T1                 (MCPARAMID)(10959 << 14)
+#define MC__EXPOn2STROBEOn_P2_T1                 (MCPARAMID)(10960 << 14)
+#define MC__STROBEAdvance_P1_T1                  (MCPARAMID)(10961 << 14)
+#define MC__STROBEAdvance_P2_T1                  (MCPARAMID)(10962 << 14)
+#define MC__STROBEOn_P1_us                       (MCPARAMID)(10963 << 14)
+#define MC__STROBEOn_P2_us                       (MCPARAMID)(10964 << 14)
+#define MC__STROBEWidth_P1_us                    (MCPARAMID)(10965 << 14)
+#define MC__STROBEWidth_P2_us                    (MCPARAMID)(10966 << 14)
+#define MC__STROBEOff_P1_us                      (MCPARAMID)(10967 << 14)
+#define MC__STROBEOff_P2_us                      (MCPARAMID)(10968 << 14)
+#define MC__Timer1_1P_RunTime_us                 (MCPARAMID)(10969 << 14)
+#define MC__Timer1_1P_MaxTriggerRate_Hz          (MCPARAMID)(10970 << 14)
+#define MC__Timer1Mode                           (MCPARAMID)(10971 << 14)
+#define MC__Timer1Mode_ONEPROG                     1
+#define MC__Timer1Mode_TWOPROG                     2
+#define MC__EXPOn_P1_T1                          (MCPARAMID)(10972 << 14)
+#define MC__EXPOff_P1_T1                         (MCPARAMID)(10973 << 14)
+#define MC__RESETOn_P1_T1                        (MCPARAMID)(10974 << 14)
+#define MC__RESETOff_P1_T1                       (MCPARAMID)(10975 << 14)
+#define MC__STROBEOn_P1_T1                       (MCPARAMID)(10976 << 14)
+#define MC__STROBEOff_P1_T1                      (MCPARAMID)(10977 << 14)
+#define MC__SQ1_P1_T1                            (MCPARAMID)(10978 << 14)
+#define MC__T1AVAIL_P1_T1                        (MCPARAMID)(10979 << 14)
+#define MC___MAXIMUM_P1_T1                       (MCPARAMID)(10980 << 14)
+#define MC__EXPOn_P2_T1                          (MCPARAMID)(10981 << 14)
+#define MC__EXPOff_P2_T1                         (MCPARAMID)(10982 << 14)
+#define MC__RESETOn_P2_T1                        (MCPARAMID)(10983 << 14)
+#define MC__RESETOff_P2_T1                       (MCPARAMID)(10984 << 14)
+#define MC__STROBEOn_P2_T1                       (MCPARAMID)(10985 << 14)
+#define MC__STROBEOff_P2_T1                      (MCPARAMID)(10986 << 14)
+#define MC__SQ1_P2_T1                            (MCPARAMID)(10987 << 14)
+#define MC__T1AVAIL_P2_T1                        (MCPARAMID)(10988 << 14)
+#define MC___MAXIMUM_P2_T1                       (MCPARAMID)(10989 << 14)
+#define MC_TWO_PROG_CalcStrategy                 (MCPARAMID)(10990 << 14)
+#define MC_TWO_PROG_CalcStrategy_SAME_EXPOff       1
+#define MC_TWO_PROG_CalcStrategy_SAME_EXPOn        2
+#define MC_TWO_PROG_CalcStrategy_MIN_EXPOn         3
+#define MC__PreEXPWidth_P1_T1                    (MCPARAMID)(10991 << 14)
+#define MC__PreEXPWidth_P2_T1                    (MCPARAMID)(10992 << 14)
+#define MC__NextPreEXPWidth_P1_T1                (MCPARAMID)(10993 << 14)
+#define MC__NextPreEXPWidth_P2_T1                (MCPARAMID)(10994 << 14)
+#define MC__NextEXPWidth_P1_T1                   (MCPARAMID)(10995 << 14)
+#define MC__NextEXPWidth_P2_T1                   (MCPARAMID)(10996 << 14)
+#define MC__PostEXPWidth_P1_T1                   (MCPARAMID)(10997 << 14)
+#define MC__PostEXPWidth_P2_T1                   (MCPARAMID)(10998 << 14)
+#define MC___Timer1_P1_Check                     (MCPARAMID)(10999 << 14)
+#define MC___Timer1_P1_Check_PASS                  1
+#define MC___Timer1_P1_Check_FAIL                  2
+#define MC___Timer1_P2_Check                     (MCPARAMID)(11000 << 14)
+#define MC___Timer1_P2_Check_PASS                  1
+#define MC___Timer1_P2_Check_FAIL                  2
+#define MC__Timer1_P1_RunTime_us                 (MCPARAMID)(11001 << 14)
+#define MC__Timer1_P2_RunTime_us                 (MCPARAMID)(11002 << 14)
+#define MC__Timer1_P1_MaxTriggerRate_Hz          (MCPARAMID)(11003 << 14)
+#define MC__Timer1_P2_MaxTriggerRate_Hz          (MCPARAMID)(11004 << 14)
+#define MC_ExposureTime_P1_Effective_us          (MCPARAMID)(11005 << 14)
+#define MC_ExposureTime_P2_Effective_us          (MCPARAMID)(11006 << 14)
+#define MC_StrobeDuration_P1_Effective_us        (MCPARAMID)(11007 << 14)
+#define MC_StrobeDuration_P2_Effective_us        (MCPARAMID)(11008 << 14)
+#define MC_StrobeDelay_P1_Effective_us           (MCPARAMID)(11009 << 14)
+#define MC_StrobeDelay_P2_Effective_us           (MCPARAMID)(11010 << 14)
+#define MC_ExposureDelay_P1_Effective_us         (MCPARAMID)(11011 << 14)
+#define MC_ExposureDelay_P2_Effective_us         (MCPARAMID)(11012 << 14)
+#define MC__Timer1_RunTime_us                    (MCPARAMID)(11013 << 14)
+#define MC__NextEXPOn_P1_T1                      (MCPARAMID)(11014 << 14)
+#define MC__NextEXPOn_P2_T1                      (MCPARAMID)(11015 << 14)
+#define MC__NextEXPOff_P1_T1                     (MCPARAMID)(11016 << 14)
+#define MC__NextEXPOff_P2_T1                     (MCPARAMID)(11017 << 14)
+#define MC__Strobe1_Src                          (MCPARAMID)(11018 << 14)
+#define MC__Strobe1_Src_T1SIG3_X                   1
+#define MC__Strobe1_Src_NO_STROBE                  2
+#define MC__Strobe1_Src_STROBE_TIED_LOW            3
+#define MC__Strobe2_Src                          (MCPARAMID)(11019 << 14)
+#define MC__Strobe2_Src_T1SIG4_X                   1
+#define MC__Strobe2_Src_NO_STROBE                  2
+#define MC__Strobe2_Src_STROBE_TIED_LOW            3
+#define MC_StrobeLine_P2_NONE                      2
+#define MC_StrobeOutput_P1                       (MCPARAMID)(11020 << 14)
+#define MC_StrobeOutput_P1_ENABLE                  1
+#define MC_StrobeOutput_P1_DISABLE                 2
+#define MC_StrobeOutput_P2                       (MCPARAMID)(11021 << 14)
+#define MC_StrobeOutput_P2_ENABLE                  1
+#define MC_StrobeOutput_P2_DISABLE                 2
+#define MC__IOUT1Source                          (MCPARAMID)(11022 << 14)
+#define MC__IOUT1Source_STROBE_T1SIG3_X            1
+#define MC__IOUT1Source_NONE                       2
+#define MC__IOUT1Source_STROBE_TIED_LOW            3
+#define MC__IOUT2Source                          (MCPARAMID)(11023 << 14)
+#define MC__IOUT2Source_STROBE_T1SIG4_X            1
+#define MC__IOUT2Source_NONE                       2
+#define MC__IOUT2Source_STROBE_TIED_LOW            3
+#define MC__StrobeAdvance_P1_us                  (MCPARAMID)(11024 << 14)
+#define MC__StrobeAdvance_P2_us                  (MCPARAMID)(11025 << 14)
+#define MC__T1Span_2P_10ns                       (MCPARAMID)(11026 << 14)
+#define MC__StrobeAdvance_P1_10ns                (MCPARAMID)(11027 << 14)
+#define MC__StrobeAdvance_P2_10ns                (MCPARAMID)(11028 << 14)
+#define MC_ExposureTime_P1_10ns                  (MCPARAMID)(11029 << 14)
+#define MC_ExposureTime_P2_10ns                  (MCPARAMID)(11030 << 14)
+#define MC_StrobeDuration_P1_10ns                (MCPARAMID)(11031 << 14)
+#define MC_StrobeDuration_P2_10ns                (MCPARAMID)(11032 << 14)
+#define MC_StrobeDelay_P1_10ns                   (MCPARAMID)(11033 << 14)
+#define MC_StrobeDelay_P2_10ns                   (MCPARAMID)(11034 << 14)
+#define MC_MinTriggerPeriod_P1_us                (MCPARAMID)(11035 << 14)
+#define MC_MinTriggerPeriod_P2_us                (MCPARAMID)(11036 << 14)
+#define MC_MaxTriggerRate_P1_Hz                  (MCPARAMID)(11037 << 14)
+#define MC_MaxTriggerRate_P2_Hz                  (MCPARAMID)(11038 << 14)
+#define MC_ExposureDelay_MAN_P1_us               (MCPARAMID)(11039 << 14)
+#define MC_ExposureDelay_MAN_P2_us               (MCPARAMID)(11040 << 14)
+#define MC_ExposureDelay_MAN_P1_10ns             (MCPARAMID)(11041 << 14)
+#define MC_ExposureDelay_MAN_P2_10ns             (MCPARAMID)(11042 << 14)
+#define MC_ExposureDelay_MAN_P1_T1               (MCPARAMID)(11043 << 14)
+#define MC_ExposureDelay_MAN_P2_T1               (MCPARAMID)(11044 << 14)
+#define MC_TWO_PROG_CalcStrategy_MANUAL            4
+#define MC_ExposureDelayControl                  (MCPARAMID)(11045 << 14)
+#define MC_ExposureDelayControl_MANUAL             1
+#define MC_ExposureDelayControl_SAME_END_EXPOSURE   2
+#define MC_ExposureDelayControl_SAME_START_EXPOSURE   3
+#define MC_RateDividerRestart                    (MCPARAMID)(11046 << 14)
+#define MC_RateDividerRestart_NEVER                1
+#define MC_RateDividerRestart_START_OF_SCAN        2
+#define MC__ExposeRecovery_IA_10ns               (MCPARAMID)(11047 << 14)
+#define MC__ExposeRecovery_IA_T1                 (MCPARAMID)(11048 << 14)
+#define MC_TwoLineSynchronization                (MCPARAMID)(11049 << 14)
+#define MC_TwoLineSynchronization_ENABLE           1
+#define MC_TwoLineSynchronization_DISABLE          2
+#define MC_TwoLineSynchronizationParity          (MCPARAMID)(11050 << 14)
+#define MC_TwoLineSynchronizationParity_EVEN       1
+#define MC_TwoLineSynchronizationParity_ODD        2
+#define MC_EndTrigFollowingLinesCount            (MCPARAMID)(11051 << 14)
+#define MC_EndTrigFollowingLinesCount_ONELINE      1
+#define MC_EndTrigFollowingLinesCount_TWOLINES     2
+#define MC_RedBlueSwap                           (MCPARAMID)(11052 << 14)
+#define MC_RedBlueSwap_ENABLE                      1
+#define MC_RedBlueSwap_DISABLE                     2
+#define MC_RedBlueSwap_Filter                    (MCPARAMID)(11053 << 14)
+#define MC_ColorComponentsOrder                  (MCPARAMID)(11054 << 14)
+#define MC_ColorComponentsOrder_RGB                1
+#define MC_ColorComponentsOrder_BGR                2
+#define MC_LineCaptureMode_TAG                     5
+#define MC_MetadataLocation                      (MCPARAMID)(11055 << 14)
+#define MC_MetadataLocation_LEFT                   1
+#define MC_MetadataLocation_SPARSE_1               2
+#define MC_MetadataLocation_Filter               (MCPARAMID)(11056 << 14)
+#define MC_Metadata_On10thTap                    (MCPARAMID)(11057 << 14)
+#define MC_Metadata_On10thTap_ENABLE               1
+#define MC_Metadata_On10thTap_DISABLE              2
+#define MC_MetadataLocation_LEFT_BOARDER           3
+#define MC_MetadataLocation_TAP10                  4
+#define MC_MetadataLocation_LVALRISE               5
+#define MC_BoardTopology_MONO_DECA_AFE            48
+#define MC_BoardTopology_MONO_DECA_AFE_SE1        49
+#define MC_CLCAM_ForcedLineBlanking              (MCPARAMID)(11058 << 14)
+#define MC_CC1Usage_DIN1                           8
+#define MC_CC1Usage_IIN1                           9
+#define MC_CC2Usage_DIN2                           8
+#define MC_CC3Usage_IIN1                           9
+#define MC__SCC_CC1_DIN1                          13
+#define MC__SCC_CC1_IIN1                          14
+#define MC__SCC_CC2_DIN2                          13
+#define MC__SCC_CC3_IIN1                          17
+#define MC_TwoLineSynchronizationParity_Filter   (MCPARAMID)(11059 << 14)
+#define MC_ExposureTime_Effective_us             (MCPARAMID)(11060 << 14)
+#define MC_StrobeLine_P1_NONE                      2
+#define MC_StrobeLine_P1_IOUT2                     3
+#define MC_StrobeLine_P2_IOUT1                     3
+#define MC_Timer1_P1_SigStrobeOn                 (MCPARAMID)(11061 << 14)
+#define MC_Timer1_P1_SigStrobeOff                (MCPARAMID)(11062 << 14)
+#define MC_Timer1_P2_SigStrobeOn                 (MCPARAMID)(11063 << 14)
+#define MC_Timer1_P2_SigStrobeOff                (MCPARAMID)(11064 << 14)
+#define MC_COF_BWR_Mux                           (MCPARAMID)(11065 << 14)
+#define MC_COF_BitWR_B2SLOW                      (MCPARAMID)(11066 << 14)
+#define MC__Category_Pipeline_Control             68
+#define MC_Pipeline_Control                      (MCPARAMID)(11067 << 14)
+#define MC_Pipeline_Control_ENABLE                 1
+#define MC_Pipeline_Control_DISABLE                2
+#define MC_Pipeline_FieldOfView_Position_tc      (MCPARAMID)(11068 << 14)
+#define MC_Pipeline_Output_Position_tc           (MCPARAMID)(11069 << 14)
+#define MC_Pipeline_Output_PulseWidth            (MCPARAMID)(11070 << 14)
+#define MC_Pipeline_Output_PulseWidth_100us        1
+#define MC_Pipeline_Output_PulseWidth_200us        2
+#define MC_Pipeline_Output_PulseWidth_500us        3
+#define MC_Pipeline_Output_PulseWidth_1ms          4
+#define MC_Pipeline_Output_PulseWidth_2ms          5
+#define MC_Pipeline_Output_PulseWidth_5ms          6
+#define MC_Pipeline_Output_Action                (MCPARAMID)(11071 << 14)
+#define MC_Pipeline_Output_Action_ACTIVE           1
+#define MC_Pipeline_Output_Action_INACTIVE         2
+#define MC_Pipeline_Output_Action_NONE             3
+#define MC_Pipeline_Output_Line                  (MCPARAMID)(11072 << 14)
+#define MC_Pipeline_Output_Line_NONE               1
+#define MC_Pipeline_Output_Line_IOUT2              2
+#define MC_Pipeline_Fifo_Overflow                (MCPARAMID)(11073 << 14)
+#define MC_Pipeline_Fifo_Underflow               (MCPARAMID)(11074 << 14)
+#define MC_GrabberOverrun_PipelineCtlr_FifoOvf_A (MCPARAMID)(11075 << 14)
+#define MC_GrabberOverrun_PipelineCtlr_FifoUdf_A (MCPARAMID)(11076 << 14)
+#define MC_Pipeline_StartOfScan_Position_tc      (MCPARAMID)(11077 << 14)
+#define MC_IOUT2Usage_PIPELINE_CTLR_OUT0           7
+#define MC_Pipeline_StartOfScan_Position         (MCPARAMID)(11078 << 14)
+#define MC_Pipeline_Output_Position              (MCPARAMID)(11079 << 14)
+#define MC__IOUT2Source_PIC_OUT0                   4
+#define MC_TapConfiguration_DECA_3T24             53
+#define MC__ASSYD0101                            (MCPARAMID)(11080 << 14)
+#define MC__ASSYD0102                            (MCPARAMID)(11081 << 14)
+#define MC__ASSYD0103                            (MCPARAMID)(11082 << 14)
+#define MC__ASSYD0104                            (MCPARAMID)(11083 << 14)
+#define MC__ASSYD0105                            (MCPARAMID)(11084 << 14)
+#define MC__ASSYD0106                            (MCPARAMID)(11085 << 14)
+#define MC__ASSYD0107                            (MCPARAMID)(11086 << 14)
+#define MC__ASSYD0108                            (MCPARAMID)(11087 << 14)
+#define MC__ASSYD0109                            (MCPARAMID)(11088 << 14)
+#define MC__ASSYD0110                            (MCPARAMID)(11089 << 14)
+#define MC__ASSYD0201                            (MCPARAMID)(11090 << 14)
+#define MC__ASSYD0202                            (MCPARAMID)(11091 << 14)
+#define MC__ASSYD0203                            (MCPARAMID)(11092 << 14)
+#define MC__ASSYD0204                            (MCPARAMID)(11093 << 14)
+#define MC__ASSYD0205                            (MCPARAMID)(11094 << 14)
+#define MC__ASSYD0206                            (MCPARAMID)(11095 << 14)
+#define MC__ASSYD0207                            (MCPARAMID)(11096 << 14)
+#define MC__ASSYD0208                            (MCPARAMID)(11097 << 14)
+#define MC__ASSYD0209                            (MCPARAMID)(11098 << 14)
+#define MC__ASSYD0210                            (MCPARAMID)(11099 << 14)
+#define MC__ASSYD0301                            (MCPARAMID)(11100 << 14)
+#define MC__ASSYD0302                            (MCPARAMID)(11101 << 14)
+#define MC__ASSYD0303                            (MCPARAMID)(11102 << 14)
+#define MC__ASSYD0304                            (MCPARAMID)(11103 << 14)
+#define MC__ASSYD0305                            (MCPARAMID)(11104 << 14)
+#define MC__ASSYD0306                            (MCPARAMID)(11105 << 14)
+#define MC__ASSYD0307                            (MCPARAMID)(11106 << 14)
+#define MC__ASSYD0308                            (MCPARAMID)(11107 << 14)
+#define MC__ASSYD0309                            (MCPARAMID)(11108 << 14)
+#define MC__ASSYD0310                            (MCPARAMID)(11109 << 14)
+#define MC__ASSYD0401                            (MCPARAMID)(11110 << 14)
+#define MC__ASSYD0402                            (MCPARAMID)(11111 << 14)
+#define MC__ASSYD0403                            (MCPARAMID)(11112 << 14)
+#define MC__ASSYD0404                            (MCPARAMID)(11113 << 14)
+#define MC__ASSYD0405                            (MCPARAMID)(11114 << 14)
+#define MC__ASSYD0406                            (MCPARAMID)(11115 << 14)
+#define MC__ASSYD0407                            (MCPARAMID)(11116 << 14)
+#define MC__ASSYD0408                            (MCPARAMID)(11117 << 14)
+#define MC__ASSYD0409                            (MCPARAMID)(11118 << 14)
+#define MC__ASSYD0410                            (MCPARAMID)(11119 << 14)
+#define MC__ASSYD0501                            (MCPARAMID)(11120 << 14)
+#define MC__ASSYD0502                            (MCPARAMID)(11121 << 14)
+#define MC__ASSYD0503                            (MCPARAMID)(11122 << 14)
+#define MC__ASSYD0504                            (MCPARAMID)(11123 << 14)
+#define MC__ASSYD0505                            (MCPARAMID)(11124 << 14)
+#define MC__ASSYD0506                            (MCPARAMID)(11125 << 14)
+#define MC__ASSYD0507                            (MCPARAMID)(11126 << 14)
+#define MC__ASSYD0508                            (MCPARAMID)(11127 << 14)
+#define MC__ASSYD0509                            (MCPARAMID)(11128 << 14)
+#define MC__ASSYD0510                            (MCPARAMID)(11129 << 14)
+#define MC__ASSYD0601                            (MCPARAMID)(11130 << 14)
+#define MC__ASSYD0602                            (MCPARAMID)(11131 << 14)
+#define MC__ASSYD0603                            (MCPARAMID)(11132 << 14)
+#define MC__ASSYD0604                            (MCPARAMID)(11133 << 14)
+#define MC__ASSYD0605                            (MCPARAMID)(11134 << 14)
+#define MC__ASSYD0606                            (MCPARAMID)(11135 << 14)
+#define MC__ASSYD0607                            (MCPARAMID)(11136 << 14)
+#define MC__ASSYD0608                            (MCPARAMID)(11137 << 14)
+#define MC__ASSYD0609                            (MCPARAMID)(11138 << 14)
+#define MC__ASSYD0610                            (MCPARAMID)(11139 << 14)
+#define MC__ASSYD0701                            (MCPARAMID)(11140 << 14)
+#define MC__ASSYD0702                            (MCPARAMID)(11141 << 14)
+#define MC__ASSYD0703                            (MCPARAMID)(11142 << 14)
+#define MC__ASSYD0704                            (MCPARAMID)(11143 << 14)
+#define MC__ASSYD0705                            (MCPARAMID)(11144 << 14)
+#define MC__ASSYD0706                            (MCPARAMID)(11145 << 14)
+#define MC__ASSYD0707                            (MCPARAMID)(11146 << 14)
+#define MC__ASSYD0708                            (MCPARAMID)(11147 << 14)
+#define MC__ASSYD0709                            (MCPARAMID)(11148 << 14)
+#define MC__ASSYD0710                            (MCPARAMID)(11149 << 14)
+#define MC__ASSYD0801                            (MCPARAMID)(11150 << 14)
+#define MC__ASSYD0802                            (MCPARAMID)(11151 << 14)
+#define MC__ASSYD0803                            (MCPARAMID)(11152 << 14)
+#define MC__ASSYD0804                            (MCPARAMID)(11153 << 14)
+#define MC__ASSYD0805                            (MCPARAMID)(11154 << 14)
+#define MC__ASSYD0806                            (MCPARAMID)(11155 << 14)
+#define MC__ASSYD0807                            (MCPARAMID)(11156 << 14)
+#define MC__ASSYD0808                            (MCPARAMID)(11157 << 14)
+#define MC__ASSYD0809                            (MCPARAMID)(11158 << 14)
+#define MC__ASSYD0810                            (MCPARAMID)(11159 << 14)
+#define MC__ASSYD0901                            (MCPARAMID)(11160 << 14)
+#define MC__ASSYD0902                            (MCPARAMID)(11161 << 14)
+#define MC__ASSYD0903                            (MCPARAMID)(11162 << 14)
+#define MC__ASSYD0904                            (MCPARAMID)(11163 << 14)
+#define MC__ASSYD0905                            (MCPARAMID)(11164 << 14)
+#define MC__ASSYD0906                            (MCPARAMID)(11165 << 14)
+#define MC__ASSYD0907                            (MCPARAMID)(11166 << 14)
+#define MC__ASSYD0908                            (MCPARAMID)(11167 << 14)
+#define MC__ASSYD0909                            (MCPARAMID)(11168 << 14)
+#define MC__ASSYD0910                            (MCPARAMID)(11169 << 14)
+#define MC__ASSYD1001                            (MCPARAMID)(11170 << 14)
+#define MC__ASSYD1002                            (MCPARAMID)(11171 << 14)
+#define MC__ASSYD1003                            (MCPARAMID)(11172 << 14)
+#define MC__ASSYD1004                            (MCPARAMID)(11173 << 14)
+#define MC__ASSYD1005                            (MCPARAMID)(11174 << 14)
+#define MC__ASSYD1006                            (MCPARAMID)(11175 << 14)
+#define MC__ASSYD1007                            (MCPARAMID)(11176 << 14)
+#define MC__ASSYD1008                            (MCPARAMID)(11177 << 14)
+#define MC__ASSYD1009                            (MCPARAMID)(11178 << 14)
+#define MC__ASSYD1010                            (MCPARAMID)(11179 << 14)
+#define MC_NumOfAssy_NINE                          8
+#define MC_GrabberOverrun_PipelineCtlr_FifoOvf_B (MCPARAMID)(11180 << 14)
+#define MC_GrabberOverrun_PipelineCtlr_FifoUdf_B (MCPARAMID)(11181 << 14)
+#define MC_ASSY_TEN_STEPS                        (MCPARAMID)(11182 << 14)
+#define MC_ASSY_TEN_STEPS_TRUE                     1
+#define MC_ASSY_TEN_STEPS_FALSE                    2
+#define MC_TapConfiguration_DECA_9T8              54
+#define MC_TapGeometry_3X_1Y3                     78
+#define MC_TapGeometry_Y_1Y3                       4
+#define MC_CLCAM_Geometry_TG_3X_1Y3               56
+#define MC_AssyConfig_3X_3                        75
+#define MC_NumOfWindows_NINE                       8
+#define MC_WIC_SwapRegionIndexXY                 (MCPARAMID)(11183 << 14)
+#define MC_WIC_SwapRegionIndexXY_true              1
+#define MC_WIC_SwapRegionIndexXY_false             2
+#define MC_BoardTopology_MONO_EF1                 50
+#define MC_BoardTopology_MONO_DECA_EF1            51
+#define MC_BoardTopology_MONO_EXT1                52
+#define MC_BoardTopology_MONO_DECA_EXT1           53
+#define MC_BoardTopology_DUO_EXT1                 54
+#define MC_BoardTopology_MONO_OPT1                55
+#define MC_BoardTopology_MONO_DECA_OPT1           56
+#define MC_SimPICACTIONSet                       (MCPARAMID)(11184 << 14)
+#define MC_BoardTopology_DUO_OPT1                 57
+#define MC_Metadata_XChan_MuxWidth_W_28BIT         5
+#define MC_Pipeline_Control_Filter               (MCPARAMID)(11185 << 14)
+#define MC_Pipeline_Control_Parameters_Filter    (MCPARAMID)(11186 << 14)
+#define MC_BMCRestart                            (MCPARAMID)(11187 << 14)
+#define MC_BMCRestart_NEVER                        1
+#define MC_BMCRestart_START_OF_SCAN                2
+#define MC__BMCRestart                           (MCPARAMID)(11188 << 14)
+#define MC__BMCRestart_NEVER                       1
+#define MC__BMCRestart_START_OF_SCAN               2
+#define MC_EncoderTickCount                      (MCPARAMID)(11189 << 14)
+#define MC_EncoderTickCountWrapUp                (MCPARAMID)(11190 << 14)
+#define MC_EncoderTickCountWrapDown              (MCPARAMID)(11191 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapDown    (MCPARAMID)(11192 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapUp      (MCPARAMID)(11193 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapDown_B  (MCPARAMID)(11194 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapUp_B    (MCPARAMID)(11195 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapDown_A  (MCPARAMID)(11196 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapUp_A    (MCPARAMID)(11197 << 14)
+#define MC_SimENCPLSCNTSet                       (MCPARAMID)(11198 << 14)
+#define MC_BMCRestart_Filter                     (MCPARAMID)(11199 << 14)
+#define MC_TapConfiguration_DECA_8T10             55
+#define MC_Deca10Tap8Bit                         (MCPARAMID)(11200 << 14)
+#define MC_Deca10Tap8Bit_ENABLE                    1
+#define MC_Deca10Tap8Bit_DISABLE                   2
+#define MC_ColorFormat_Y10P                      108
+#define MC_TapConfiguration_DECA_2T40             56
+#define MC_TapConfiguration_DECA_8T30             57
+#define MC_ColorFormat_RGB30P                    109
+#define MC_TapConfiguration_DECA_8T30B3           58
+#define MC_ColorFormat_RGBI40P                   110
+#define MC__STM1_T1SCAL_10ms                      10
+#define MC_ConnectorName_BRACKET                  40
+#define MC_OutputPinName_LED                     126
+#define MC_EventSignaling_25_Filter              (MCPARAMID)(11201 << 14)
+#define MC_OutputStyle_LVCMOS                     12
+#define MC_OutputPinName_LED_A                   127
+#define MC_OutputPinName_LED_B                   128
+#define MC_OutputState_OFF                        16
+#define MC_OutputState_ON                         17
+#define MC_OutputState_1_OFF                       9
+#define MC_OutputState_1_ON                       10
+#define MC_OutputState_2_OFF                       9
+#define MC_OutputState_2_ON                       10
+#define MC_OutputState_3_OFF                       9
+#define MC_OutputState_3_ON                       10
+#define MC_OutputState_4_OFF                       7
+#define MC_OutputState_4_ON                        8
+#define MC_OutputState_7_OFF                       9
+#define MC_OutputState_7_ON                       10
+#define MC_OutputState_8_OFF                       4
+#define MC_OutputState_8_ON                        5
+#define MC_OutputState_9_OFF                       4
+#define MC_OutputState_9_ON                        5
+#define MC_OutputState_10_OFF                      4
+#define MC_OutputState_10_ON                       5
+#define MC_OutputState_25_OFF                      7
+#define MC_OutputState_25_ON                       8
+#define MC_OutputStyle_NA                         13
+#define MC_OutputState_12_OFF                      4
+#define MC_OutputState_12_ON                       5
+#define MC_OutputState_13_OFF                      4
+#define MC_OutputState_13_ON                       5
+#define MC_OutputState_14_OFF                      4
+#define MC_OutputState_14_ON                       5
+#define MC_OutputState_15_OFF                      4
+#define MC_OutputState_15_ON                       5
+#define MC_OutputState_18_OFF                      9
+#define MC_OutputState_18_ON                      10
+#define MC_OutputState_19_OFF                      9
+#define MC_OutputState_19_ON                      10
+#define MC_OutputState_20_OFF                      9
+#define MC_OutputState_20_ON                      10
+#define MC_OutputState_21_OFF                      8
+#define MC_OutputState_21_ON                       9
+#define MC_OutputState_27_OFF                      4
+#define MC_OutputState_27_ON                       5
+#define MC_EventSignaling_27_Filter              (MCPARAMID)(11202 << 14)
+#define MC_OutputState_28_OFF                      6
+#define MC_OutputState_28_ON                       7
+#define MC_EventSignaling_28_Filter              (MCPARAMID)(11203 << 14)
+#define MC_ConnectorName_BRACKET_B                41
+#define MC_LUT_Feature                           (MCPARAMID)(11204 << 14)
+#define MC_LUT_Feature_YES                         1
+#define MC_LUT_Feature_NO                          2
+#define MC_WBO_Feature                           (MCPARAMID)(11205 << 14)
+#define MC_WBO_Feature_YES                         1
+#define MC_WBO_Feature_NO                          2
+#define MC_Image_Cropping_Feature                (MCPARAMID)(11206 << 14)
+#define MC_Image_Cropping_Feature_YES              1
+#define MC_Image_Cropping_Feature_NO               2
+#define MC_Bayer_CFA_Decoding_Feature            (MCPARAMID)(11207 << 14)
+#define MC_Bayer_CFA_Decoding_Feature_YES          1
+#define MC_Bayer_CFA_Decoding_Feature_NO           2
+#define MC_RedBlueSwap_Feature                   (MCPARAMID)(11208 << 14)
+#define MC_RedBlueSwap_Feature_YES                 1
+#define MC_RedBlueSwap_Feature_NO                  2
+#define MC_Image_Flipping_Feature                (MCPARAMID)(11209 << 14)
+#define MC_Image_Flipping_Feature_YES              1
+#define MC_Image_Flipping_Feature_NO               2
+#define MC_ImageFlipping_Filter                  (MCPARAMID)(11210 << 14)
+#define MC_BoardTopology_MONO_SE1                 58
+
+
+#endif // _McParams_
diff --git a/Common_Class/EuresysCam/Include/McParamsCompat1x.h b/Common_Class/EuresysCam/Include/McParamsCompat1x.h
new file mode 100644
index 0000000..8535669
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/McParamsCompat1x.h
@@ -0,0 +1,14 @@
+// McParamsCompat1x.h Parameter Identifier File
+// This file defines compatibility identifiers for pre version 2.x
+// MultiCam Parameters
+// History:
+//			00/10/20	Joel Harhellier		First issue
+
+
+#define MC_ProcessorId                           (MCPARAMID)(   34 << 14)
+#define MC_Collector                             (MCPARAMID)(   36 << 14)
+#define MC_FilledCount                           (MCPARAMID)(   43 << 14)
+#define MC_SoftTrig								 (MCPARAMID)(   50 << 14)
+#define MC_Timeout                               (MCPARAMID)(   56 << 14)
+#define MC_LUTIndex                              (MCPARAMID)(   66 << 14)
+#define MC_InputLUT                              (MCPARAMID)(   67 << 14)
diff --git a/Common_Class/EuresysCam/Include/MultiCamCpp.h b/Common_Class/EuresysCam/Include/MultiCamCpp.h
new file mode 100644
index 0000000..9833a67
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MultiCamCpp.h
@@ -0,0 +1,13 @@
+// MultiCamCpp.H - MULTICAM C++ API
+// Do not edit this file
+
+#if !defined(__MULTICAMCPP_H__)
+#define __MULTICAMCPP_H__
+
+#include <iostream>
+#include "multicam.h"
+
+#include "MultiCamCppExternal.h"
+#include "MultiCamCppInternal.h"
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MultiCamCppExternal.h b/Common_Class/EuresysCam/Include/MultiCamCppExternal.h
new file mode 100644
index 0000000..e590cc8
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MultiCamCppExternal.h
@@ -0,0 +1,30 @@
+// MultiCamCppInternal.H - MULTICAM C++ API
+#if !defined(__MULTICAMCPPEXTERNAL_H__)
+#define __MULTICAMCPPEXTERNAL_H__
+
+// For wrapping
+#if defined __MULTICAM_WRAPPING__
+  #ifdef __GNUC__
+    typedef void (*FinalizeCallback)(int handle);
+  #else
+    typedef void (__stdcall *FinalizeCallback)(int handle);
+  #endif
+  #define WRAPPING_MEMBERS public: \
+    FinalizeCallback callback_; \
+    int handle_; \
+
+  #define WRAPPING_MEMBERS_INIT handle_ = 0; \
+    callback_ = 0; \
+
+#define WRAPPING_MEMBERS_UNINIT if ((handle_ != NULL) && (callback_ != NULL)) { \
+    MultiCam_LockDestructorCriticalSection(); \
+    if ((handle_ != NULL) && (callback_ != NULL)) callback_(handle_); \
+    MultiCam_UnlockDestructorCriticalSection(); }\
+
+#else
+#define WRAPPING_MEMBERS
+#define WRAPPING_MEMBERS_INIT
+#define WRAPPING_MEMBERS_UNINIT
+#endif
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MultiCamCppInternal.h b/Common_Class/EuresysCam/Include/MultiCamCppInternal.h
new file mode 100644
index 0000000..cc11102
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MultiCamCppInternal.h
@@ -0,0 +1,38 @@
+// MultiCamCppInternal.H - MULTICAM C++ API
+#if !defined(__MULTICAMCPPINTERNAL_H__)
+#define __MULTICAMCPPINTERNAL_H__
+
+#include "MCpp_MultiCamObject.h"
+#include "MCpp_MultiCamObjectWithSignaling.h"
+#include "MCpp_Board.h"
+#include "MCpp_BoardList.h"
+#include "MCpp_Surface.h"
+#include "MCpp_SignalInfo.h"
+#include "MCpp_Callback.h"
+#include "MCpp_Channel.h"
+#include "MCpp_Configuration.h"
+#include "MCpp_Exception.h"
+#include "MCpp_global.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    static Euresys::MultiCam::Configuration Config;
+    static Euresys::MultiCam::BoardList Boards;
+  }
+}
+
+#include "MCpp_MultiCamObjectImpl.h"
+#include "MCpp_MultiCamObjectWithSignalingImpl.h"
+#include "MCpp_BoardImpl.h"
+#include "MCpp_BoardListImpl.h"
+#include "MCpp_SurfaceImpl.h"
+#include "MCpp_SignalInfoImpl.h"
+#include "MCpp_CallbackImpl.h"
+#include "MCpp_ChannelImpl.h"
+#include "MCpp_ConfigurationImpl.h"
+#include "MCpp_ExceptionImpl.h"
+#include "MCpp_globalImpl.h"
+
+#endif
diff --git a/Common_Class/EuresysCam/Include/MultiCam_DataTypes.h b/Common_Class/EuresysCam/Include/MultiCam_DataTypes.h
new file mode 100644
index 0000000..f8170b1
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/MultiCam_DataTypes.h
@@ -0,0 +1,45 @@
+// MultiCam_DataTypes.h
+
+#ifndef __EURESYS_DATA_TYPES_1_0__
+#define __EURESYS_DATA_TYPES_1_0__
+
+// Standard types
+typedef int BOOL;
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+typedef char CHAR, *PCHAR; 
+typedef void *PVOID; 
+
+typedef signed char         INT8, *PINT8;
+typedef signed short        INT16, *PINT16;
+typedef signed int          INT32, *PINT32;
+typedef unsigned char       UINT8, *PUINT8;
+typedef unsigned short      UINT16, *PUINT16;
+typedef unsigned int        UINT32, *PUINT32;
+
+#ifdef __GNUC__
+typedef signed long long int INT64, *PINT64;
+typedef unsigned long long int UINT64, *PUINT64;
+#else
+typedef signed __int64      INT64, *PINT64;
+typedef unsigned __int64    UINT64, *PUINT64;
+#endif
+
+// Custom types
+typedef unsigned short UNICHAR;
+typedef float FLOAT32, *PFLOAT32;
+typedef double FLOAT64, *PFLOAT64;
+typedef const char *PCCHAR; 
+
+#endif // __EURESYS_DATA_TYPES_1_0__
diff --git a/Common_Class/EuresysCam/Include/containers.h b/Common_Class/EuresysCam/Include/containers.h
new file mode 100644
index 0000000..e0b6805
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/containers.h
@@ -0,0 +1,173 @@
+#include <cstdlib>
+
+namespace Euresys {
+namespace MultiCam {
+namespace Internal {
+
+template < class CItem, int localsize = 512 >
+class AssociativeArray : public Container < CItem >
+{
+        AssociativeArray<CItem, localsize> *next;
+        CItem items[localsize];
+        int keys[localsize];
+        int used;
+    public:
+        /** Construct an associative array.
+        **/
+        AssociativeArray() : next(0), used(0) {
+            int i;
+            for(i = 0; i < localsize; i++) {
+                items[i] = NULL;
+                keys[i] = -1;
+            }
+        }
+
+        ~AssociativeArray() {
+            if (next)
+                delete next;
+        }
+
+        void Add(int key, CItem item) {
+            int i;
+            i = Find(key);
+            if (isValidIndex(i) || (!isValidIndex(i) && used < localsize)) {
+                if (!isValidIndex(i)) {
+                    i = used;
+                    used++;
+                }
+                items[i] = item;
+                keys[i] = key;
+            } else {
+                if (!next) {
+                    next = new AssociativeArray<CItem, localsize>();
+                }
+                next->Add(key, item);
+            }
+        }
+
+        // for compatibility with the container interface
+        virtual int Add(CItem &) {
+            // NOT IMPLEMENTED !!
+            return 0;
+        }
+
+        // for compatibility with the container interface
+        virtual void Assign(int idx, CItem item) {
+            Add(idx, item);
+        }
+
+        virtual int GetCount() const {
+            int size;
+
+            size = used;
+            if (next) size  += next->GetCount();
+            return size;
+        }
+
+        int Find(int key) const {
+            int i;
+            for (i = 0; i < used && i < localsize; i++) {
+                if (keys[i] == key)
+                    return i;
+            }
+            return -1;
+        }
+
+        bool isValidIndex(int i) const {
+            return i >= 0 && i < used && i < localsize;
+        }
+
+        void Remove(int key) {
+            int i = Find(key);
+            if (isValidIndex(i)) {
+                items[i] = NULL;            
+            }
+        }
+
+        CItem Get(int key) const {
+            int i;
+            i = Find(key);
+            if (isValidIndex(i))
+                return items[i];
+            else if (next) 
+                return next->Get(key);
+            
+            return NULL;
+        }
+
+        // for compatibility with the container interface
+        CItem At(int key) const {
+            return Get(key);
+        }
+
+        void DeleteAll() {
+            int i;
+            for (i=0; i < used; i++) {
+                delete items[i];
+                items[i] = NULL;
+            }
+            if (next) {
+                next->DeleteAll();
+                delete next;
+                next = NULL;
+            }
+        }
+};
+
+      
+      
+      // ********************************************************************************************
+      // List: simple list class
+      // -----------------------
+      
+      template <class T, int N> class List : public Container<T>
+      {
+        protected:
+            int count, allocCount;
+            T *list;
+            
+        public:
+            List();
+            virtual ~List();
+            
+            T operator[](int Index) const { return At(Index); }
+            T At(int Index) const { return list[Index]; }
+            int GetCount() const { return count; }
+            int Add(T &item);
+      };
+      
+      template <class T, int N>
+          List<T, N>::List()
+      {
+          count = 0;
+          allocCount = 0;
+          list = NULL;
+      }
+      
+      template <class T, int N>
+          List<T, N>::~List()
+      {
+          if (list != NULL)
+              free(list);
+      }
+      
+      template <class T, int N>
+          int List<T, N>::Add(T &item)
+      {
+          int element = count++;
+          
+          if (count >= allocCount)
+          {
+              allocCount += N;
+              list = (T *)realloc(list, sizeof(T) * allocCount);
+          }
+          
+          list[element] = item;
+          
+          return element;
+      }
+    
+    
+}
+}
+}
diff --git a/Common_Class/EuresysCam/Include/multicam.h b/Common_Class/EuresysCam/Include/multicam.h
new file mode 100644
index 0000000..07960ef
--- /dev/null
+++ b/Common_Class/EuresysCam/Include/multicam.h
@@ -0,0 +1,155 @@
+// MULTICAM.H -- MULTICAM DRIVER API
+
+#ifndef _MULTICAM_
+#define _MULTICAM_
+
+#if defined(WINAPI)
+#define MCAPI WINAPI
+#elif defined(__BORLANDC__)
+#if __BORLANDC__ >= 0x0570
+#define MCAPI __stdcall
+#else
+#define MCAPI stdcall
+#endif
+#elif defined(__GNUC__)
+#define MCAPI
+#else
+#define MCAPI _stdcall
+#endif
+
+#if defined(DLL_EXPORTS) && defined(__GNUC__)
+#define DLL_API  __attribute__((visibility("default")))
+#elif defined(DLL_EXPORTS)
+#define DLL_API __declspec(dllexport) MCAPI
+#elif defined(__BORLANDC__)
+#define DLL_API _import MCAPI
+#elif defined(__GNUC__)
+#define DLL_API
+#elif defined(EURESYS_STATIC)
+#define DLL_API
+#else
+#define DLL_API __declspec(dllimport) MCAPI
+#endif
+
+// MULTICAM PARAMETERS AND DEFINITIONS
+#include "McParams.h"
+#include "McDef.h"
+#include "McIo.h"
+#if !defined(DLL_EXPORTS)
+#include "McParamsCompat1x.h"
+#endif
+
+#include "MultiCam_DataTypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef int MCSTATUS;
+typedef UINT32 MCHANDLE, *PMCHANDLE;
+typedef UINT32 MCPARAMID, *PMCPARAMID;
+typedef int MCEVENT, MCSIGNAL;
+
+
+// SIGNALING
+typedef struct _MC_CALLBACK_INFO {
+	PVOID Context;
+	MCHANDLE Instance;
+	MCSIGNAL Signal;
+	UINT32 SignalInfo;
+	UINT32 SignalContext;
+} MCSIGNALINFO, *PMCSIGNALINFO, *PMCCALLBACKINFO, MCCALLBACKINFO;
+
+typedef void (MCAPI *PMCCALLBACK)(PMCSIGNALINFO CbInfo);
+typedef void (MCAPI *PMCCALLBACKEX)(PVOID Context);
+
+// OBJECT CLASSES
+#define MC_SURFACE_CLASS		0x4
+#define MC_CHANNEL_CLASS		0x8
+#define MC_CONFIG_CLASS			0x2
+#define MC_BOARD_CLASS			0xE
+
+
+// DEFAULT INSTANCE TEMPLATES
+#define MC_DEFAULT_SURFACE_HANDLE (MCHANDLE)((MC_SURFACE_CLASS << 28) | 0x0FFFFFFF)
+
+#define MC_CONFIGURATION			(MCHANDLE)((MC_CONFIG_CLASS << 28) | 0)
+
+#define MC_BOARD					(MCHANDLE)((MC_BOARD_CLASS << 28) | 0)
+
+// CHANNEL CREATION MODELS
+#define MC_CHANNEL					(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0000FFFF)
+#define MC_CHANNEL_ALPHA_X			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0007FFFF)
+#define MC_CHANNEL_ALPHA_Y			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0008FFFF)
+#define MC_CHANNEL_ALPHA_XBIS		(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0015FFFF)
+#define MC_CHANNEL_ALPHA_YBIS		(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0016FFFF)
+#define MC_CHANNEL_ALPHA_STEREOXY	(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x001CFFFF)
+#define MC_CHANNEL_VALUE_M			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0009FFFF)
+#define MC_CHANNEL_EXPERT_M			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x000AFFFF)
+#define MC_CHANNEL_EXPERT_A			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x000BFFFF)
+#define MC_CHANNEL_EXPERT_B			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x000CFFFF)
+#define MC_CHANNEL_HARMONY			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x001EFFFF)
+#define MC_CHANNEL_MELODY			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x001FFFFF)
+#define MC_CHANNEL_AVENUE			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0024FFFF)
+
+
+#if !defined(MC_DYNAMIC_BINDING)
+
+// STATIC INSTANCE OBJECTS
+// FUNCTIONS
+
+// Driver connections
+MCSTATUS DLL_API McOpenDriver(PCCHAR InstanceName);
+MCSTATUS DLL_API McCloseDriver(void);
+
+// Object creation / deletion
+MCSTATUS DLL_API McCreate(MCHANDLE ModelInstance, PMCHANDLE Instance);
+MCSTATUS DLL_API McCreateNm(PCCHAR ModelInstanceName, PMCHANDLE Instance);
+MCSTATUS DLL_API McDelete(MCHANDLE Instance);
+
+// Acquisition control
+MCSTATUS DLL_API McStartAcq(void);
+MCSTATUS DLL_API McStopAcq(void);
+
+// Parameter handling
+MCSTATUS DLL_API McSetParamInt(MCHANDLE Instance, MCPARAMID Param, INT32 ValueInt);
+MCSTATUS DLL_API McSetParamNmInt(MCHANDLE Instance, PCCHAR ParamName, INT32 ValueInt);
+MCSTATUS DLL_API McSetParamStr(MCHANDLE Instance, MCPARAMID Param, PCCHAR ValueStr);
+MCSTATUS DLL_API McSetParamNmStr(MCHANDLE Instance, PCCHAR ParamName, PCCHAR ValueStr);
+MCSTATUS DLL_API McSetParamFloat(MCHANDLE Instance, MCPARAMID Param, FLOAT64 ValueFloat);
+MCSTATUS DLL_API McSetParamNmFloat(MCHANDLE Instance, PCCHAR ParamName, FLOAT64 ValueFloat);
+MCSTATUS DLL_API McSetParamInst(MCHANDLE Instance, MCPARAMID Param, MCHANDLE ValueInst);
+MCSTATUS DLL_API McSetParamNmInst(MCHANDLE Instance, PCCHAR ParamName, MCHANDLE ValueInst);
+MCSTATUS DLL_API McSetParamPtr(MCHANDLE Instance, MCPARAMID Param, PVOID ValuePtr);
+MCSTATUS DLL_API McSetParamNmPtr(MCHANDLE Instance, PCCHAR ParamName, PVOID ValuePtr);
+MCSTATUS DLL_API McSetParamInt64(MCHANDLE Instance, MCPARAMID Param, INT64 ValueInt64);
+MCSTATUS DLL_API McSetParamNmInt64(MCHANDLE Instance, PCCHAR ParamName, INT64 ValueInt64);
+
+MCSTATUS DLL_API McGetParamInt(MCHANDLE Instance, MCPARAMID Param, PINT32 ValueInt);
+MCSTATUS DLL_API McGetParamNmInt(MCHANDLE Instance, PCCHAR ParamName, PINT32 ValueInt);
+MCSTATUS DLL_API McGetParamStr(MCHANDLE Instance, MCPARAMID Param, PCHAR ValueStr, UINT32 MaxLength);
+MCSTATUS DLL_API McGetParamNmStr(MCHANDLE Instance, PCCHAR ParamName, PCHAR ValueStr, UINT32 MaxLength);
+MCSTATUS DLL_API McGetParamFloat(MCHANDLE Instance, MCPARAMID Param, PFLOAT64 ValueFloat);
+MCSTATUS DLL_API McGetParamNmFloat(MCHANDLE Instance, PCCHAR ParamName, PFLOAT64 ValueFloat);
+MCSTATUS DLL_API McGetParamInst(MCHANDLE Instance, MCPARAMID Param, PMCHANDLE ValueInst);
+MCSTATUS DLL_API McGetParamNmInst(MCHANDLE Instance, PCCHAR ParamName, PMCHANDLE ValueInst);
+MCSTATUS DLL_API McGetParamPtr(MCHANDLE Instance, MCPARAMID Param, PVOID *ValuePtr);
+MCSTATUS DLL_API McGetParamNmPtr(MCHANDLE Instance, PCCHAR ParamName, PVOID *ValuePtr);
+MCSTATUS DLL_API McGetParamInt64(MCHANDLE Instance, MCPARAMID Param, PINT64 ValueInt64);
+MCSTATUS DLL_API McGetParamNmInt64(MCHANDLE Instance, PCCHAR ParamName, PINT64 ValueInt64);
+
+// Callback registration for an object
+MCSTATUS DLL_API McRegisterCallback(MCHANDLE Instance, PMCCALLBACK CallBackFunction, PVOID Context);
+MCSTATUS DLL_API McRegisterCallbackEx(MCHANDLE Instance, PMCCALLBACK CallBackFunction, PMCCALLBACKEX ThreadStart, PMCCALLBACKEX ThreadEnd, PVOID Context);
+
+// Event Management
+MCSTATUS DLL_API McWaitSignal(MCHANDLE Instance, MCSIGNAL Signal, UINT32 Timeout, PMCSIGNALINFO Info);
+MCSTATUS DLL_API McGetSignalInfo(MCHANDLE Instance, MCSIGNAL Signal, PMCSIGNALINFO Info);
+
+#endif	// MC_DYNAMIC_BINDING
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // _MULTICAM_
diff --git a/Common_Class/EuresysCam/Lib/MultiCam.def b/Common_Class/EuresysCam/Lib/MultiCam.def
new file mode 100644
index 0000000..8f53614
--- /dev/null
+++ b/Common_Class/EuresysCam/Lib/MultiCam.def
@@ -0,0 +1,35 @@
+IMPORTS
+	McOpenDriver=MULTICAM._McOpenDriver@4
+	McCloseDriver=MULTICAM._McCloseDriver@0
+	McCreate=MULTICAM._McCreate@8
+	McCreateNm=MULTICAM._McCreateNm@8
+	McDelete=MULTICAM._McDelete@4
+	McStartAcq=MULTICAM._McStartAcq@0
+	McStopAcq=MULTICAM._McStopAcq@0
+	McSetParamInt=MULTICAM._McSetParamInt@12
+	McSetParamNmInt=MULTICAM._McSetParamNmInt@12
+	McSetParamStr=MULTICAM._McSetParamStr@12
+	McSetParamNmStr=MULTICAM._McSetParamNmStr@12
+	McSetParamFloat=MULTICAM._McSetParamFloat@16
+	McSetParamNmFloat=MULTICAM._McSetParamNmFloat@16
+	McSetParamInst=MULTICAM._McSetParamInst@12
+	McSetParamNmInst=MULTICAM._McSetParamNmInst@12
+	McSetParamPtr=MULTICAM._McSetParamPtr@12
+	McSetParamNmPtr=MULTICAM._McSetParamNmPtr@12
+	McSetParamInt64=MULTICAM._McSetParamInt64@16
+	McSetParamNmInt64=MULTICAM._McSetParamNmInt64@16
+	McGetParamInt=MULTICAM._McGetParamInt@12
+	McGetParamNmInt=MULTICAM._McGetParamNmInt@12
+	McGetParamStr=MULTICAM._McGetParamStr@16
+	McGetParamNmStr=MULTICAM._McGetParamNmStr@16
+	McGetParamFloat=MULTICAM._McGetParamFloat@12
+	McGetParamNmFloat=MULTICAM._McGetParamNmFloat@12
+	McGetParamInst=MULTICAM._McGetParamInst@12
+	McGetParamNmInst=MULTICAM._McGetParamNmInst@12
+	McGetParamPtr=MULTICAM._McGetParamPtr@12
+	McGetParamNmPtr=MULTICAM._McGetParamNmPtr@12
+	McGetParamInt64=MULTICAM._McGetParamInt64@12
+	McGetParamNmInt64=MULTICAM._McGetParamNmInt64@12
+	McRegisterCallback=MULTICAM._McRegisterCallback@12
+	McWaitSignal=MULTICAM._McWaitSignal@16
+	McGetSignalInfo=MULTICAM._McGetSignalInfo@12
diff --git a/Common_Class/EuresysCam/Lib/MultiCam.lib b/Common_Class/EuresysCam/Lib/MultiCam.lib
new file mode 100644
index 0000000..c4f3d88
--- /dev/null
+++ b/Common_Class/EuresysCam/Lib/MultiCam.lib
Binary files differ
diff --git a/Common_Class/EuresysCam/Lib/amd64/MultiCam.def b/Common_Class/EuresysCam/Lib/amd64/MultiCam.def
new file mode 100644
index 0000000..d5353cc
--- /dev/null
+++ b/Common_Class/EuresysCam/Lib/amd64/MultiCam.def
@@ -0,0 +1,35 @@
+IMPORTS
+	McOpenDriver=MULTICAM.McOpenDriver
+	McCloseDriver=MULTICAM.McCloseDriver
+	McCreate=MULTICAM.McCreate
+	McCreateNm=MULTICAM.McCreateNm
+	McDelete=MULTICAM.McDelete
+	McStartAcq=MULTICAM.McStartAcq
+	McStopAcq=MULTICAM.McStopAcq
+	McSetParamInt=MULTICAM.McSetParamInt
+	McSetParamNmInt=MULTICAM.McSetParamNmInt
+	McSetParamStr=MULTICAM.McSetParamStr
+	McSetParamNmStr=MULTICAM.McSetParamNmStr
+	McSetParamFloat=MULTICAM.McSetParamFloat
+	McSetParamNmFloat=MULTICAM.McSetParamNmFloat
+	McSetParamInst=MULTICAM.McSetParamInst
+	McSetParamNmInst=MULTICAM.McSetParamNmInst
+	McSetParamPtr=MULTICAM.McSetParamPtr
+	McSetParamNmPtr=MULTICAM.McSetParamNmPtr
+	McSetParamInt64=MULTICAM.McSetParamInt64
+	McSetParamNmInt64=MULTICAM.McSetParamNmInt64
+	McGetParamInt=MULTICAM.McGetParamInt
+	McGetParamNmInt=MULTICAM.McGetParamNmInt
+	McGetParamStr=MULTICAM.McGetParamStr
+	McGetParamNmStr=MULTICAM.McGetParamNmStr
+	McGetParamFloat=MULTICAM.McGetParamFloat
+	McGetParamNmFloat=MULTICAM.McGetParamNmFloat
+	McGetParamInst=MULTICAM.McGetParamInst
+	McGetParamNmInst=MULTICAM.McGetParamNmInst
+	McGetParamPtr=MULTICAM.McGetParamPtr
+	McGetParamNmPtr=MULTICAM.McGetParamNmPtr
+	McGetParamInt64=MULTICAM.McGetParamInt64
+	McGetParamNmInt64=MULTICAM.McGetParamNmInt64
+	McRegisterCallback=MULTICAM.McRegisterCallback
+	McWaitSignal=MULTICAM.McWaitSignal
+	McGetSignalInfo=MULTICAM.McGetSignalInfo
diff --git a/Common_Class/EuresysCam/Lib/amd64/MultiCam.lib b/Common_Class/EuresysCam/Lib/amd64/MultiCam.lib
new file mode 100644
index 0000000..67899e7
--- /dev/null
+++ b/Common_Class/EuresysCam/Lib/amd64/MultiCam.lib
Binary files differ
diff --git a/Common_Class/ExpireDay/ExpireDay.cpp b/Common_Class/ExpireDay/ExpireDay.cpp
new file mode 100644
index 0000000..bd0a813
--- /dev/null
+++ b/Common_Class/ExpireDay/ExpireDay.cpp
@@ -0,0 +1,94 @@
+
+// ExpireDay.cpp : 览侩 橇肺弊伐俊 措茄 努贰胶 悼累阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+#include "ExpireDay.h"
+#include "ExpireDayDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CExpireDayApp
+
+BEGIN_MESSAGE_MAP(CExpireDayApp, CWinApp)
+	ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CExpireDayApp 积己
+
+CExpireDayApp::CExpireDayApp()
+{
+	// 促矫 矫累 包府磊 瘤盔
+	m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
+
+	// TODO: 咯扁俊 积己 内靛甫 眠啊钦聪促.
+	// InitInstance俊 葛电 吝夸茄 檬扁拳 累诀阑 硅摹钦聪促.
+}
+
+
+// 蜡老茄 CExpireDayApp 俺眉涝聪促.
+
+CExpireDayApp theApp;
+
+
+// CExpireDayApp 檬扁拳
+
+BOOL CExpireDayApp::InitInstance()
+{
+	// 览侩 橇肺弊伐 概聪其胶飘啊 ComCtl32.dll 滚傈 6 捞惑阑 荤侩窍咯 厚林倔 胶鸥老阑
+	// 荤侩窍档废 瘤沥窍绰 版快, Windows XP 惑俊辑 馆靛矫 InitCommonControlsEx()啊 鞘夸钦聪促.
+	// InitCommonControlsEx()甫 荤侩窍瘤 臼栏搁 芒阑 父甸 荐 绝嚼聪促.
+	INITCOMMONCONTROLSEX InitCtrls;
+	InitCtrls.dwSize = sizeof(InitCtrls);
+	// 览侩 橇肺弊伐俊辑 荤侩且 葛电 傍侩 牧飘费 努贰胶甫 器窃窍档废
+	// 捞 亲格阑 汲沥窍绞矫坷.
+	InitCtrls.dwICC = ICC_WIN95_CLASSES;
+	InitCommonControlsEx(&InitCtrls);
+
+	CWinApp::InitInstance();
+
+
+	AfxEnableControlContainer();
+
+	// 措拳 惑磊俊 夹 飘府 轰 肚绰
+	// 夹 格废 轰 牧飘费捞 器窃登绢 乐绰 版快 夹 包府磊甫 父奠聪促.
+	CShellManager *pShellManager = new CShellManager;
+
+	// 钎霖 檬扁拳
+	// 捞甸 扁瓷阑 荤侩窍瘤 臼绊 弥辆 角青 颇老狼 农扁甫 临捞妨搁
+	// 酒贰俊辑 鞘夸 绝绰 漂沥 檬扁拳
+	// 风凭阑 力芭秦具 钦聪促.
+	// 秦寸 汲沥捞 历厘等 饭瘤胶飘府 虐甫 函版窍绞矫坷.
+	// TODO: 捞 巩磊凯阑 雀荤 肚绰 炼流狼 捞抚苞 鞍篮
+	// 利例茄 郴侩栏肺 荐沥秦具 钦聪促.
+	SetRegistryKey(_T("肺拿 览侩 橇肺弊伐 付过荤俊辑 积己等 览侩 橇肺弊伐"));
+
+	CExpireDayDlg dlg;
+	m_pMainWnd = &dlg;
+	INT_PTR nResponse = dlg.DoModal();
+	if (nResponse == IDOK)
+	{
+		// TODO: 咯扁俊 [犬牢]阑 努腐窍咯 措拳 惑磊啊 绝绢龙 锭 贸府且
+		//  内靛甫 硅摹钦聪促.
+	}
+	else if (nResponse == IDCANCEL)
+	{
+		// TODO: 咯扁俊 [秒家]甫 努腐窍咯 措拳 惑磊啊 绝绢龙 锭 贸府且
+		//  内靛甫 硅摹钦聪促.
+	}
+
+	// 困俊辑 父电 夹 包府磊甫 昏力钦聪促.
+	if (pShellManager != NULL)
+	{
+		delete pShellManager;
+	}
+
+	// 措拳 惑磊啊 摧躯栏骨肺 览侩 橇肺弊伐狼 皋矫瘤 七橇甫 矫累窍瘤 臼绊  览侩 橇肺弊伐阑 场尘 荐 乐档废 FALSE甫
+	// 馆券钦聪促.
+	return FALSE;
+}
+
diff --git a/Common_Class/ExpireDay/ExpireDay.h b/Common_Class/ExpireDay/ExpireDay.h
new file mode 100644
index 0000000..d26d8c0
--- /dev/null
+++ b/Common_Class/ExpireDay/ExpireDay.h
@@ -0,0 +1,32 @@
+
+// ExpireDay.h : PROJECT_NAME 览侩 橇肺弊伐俊 措茄 林 庆歹 颇老涝聪促.
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "PCH俊 措秦 捞 颇老阑 器窃窍扁 傈俊 'stdafx.h'甫 器窃钦聪促."
+#endif
+
+#include "resource.h"		// 林 扁龋涝聪促.
+
+
+// CExpireDayApp:
+// 捞 努贰胶狼 备泅俊 措秦辑绰 ExpireDay.cpp阑 曼炼窍绞矫坷.
+//
+
+class CExpireDayApp : public CWinApp
+{
+public:
+	CExpireDayApp();
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL InitInstance();
+
+// 备泅涝聪促.
+
+	DECLARE_MESSAGE_MAP()
+};
+
+extern CExpireDayApp theApp;
\ No newline at end of file
diff --git a/Common_Class/ExpireDay/ExpireDay.rc b/Common_Class/ExpireDay/ExpireDay.rc
new file mode 100644
index 0000000..ca17b20
--- /dev/null
+++ b/Common_Class/ExpireDay/ExpireDay.rc
Binary files differ
diff --git a/Common_Class/ExpireDay/ExpireDay.vcxproj b/Common_Class/ExpireDay/ExpireDay.vcxproj
new file mode 100644
index 0000000..9943609
--- /dev/null
+++ b/Common_Class/ExpireDay/ExpireDay.vcxproj
@@ -0,0 +1,215 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}</ProjectGuid>
+    <RootNamespace>ExpireDay</RootNamespace>
+    <Keyword>MFCProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>../../Global_Include</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>../../Global_Include</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="res\ExpireDay.ico" />
+    <None Include="res\ExpireDay.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="ExpireDay.h" />
+    <ClInclude Include="ExpireDayDlg.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="ExpireDay.cpp" />
+    <ClCompile Include="ExpireDayDlg.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="ExpireDay.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="ExpireDay.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/ExpireDay/ExpireDay.vcxproj.filters b/Common_Class/ExpireDay/ExpireDay.vcxproj.filters
new file mode 100644
index 0000000..2625c7e
--- /dev/null
+++ b/Common_Class/ExpireDay/ExpireDay.vcxproj.filters
@@ -0,0 +1,59 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="res\ExpireDay.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ExpireDay.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="ExpireDay.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="ExpireDayDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="ExpireDay.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ExpireDayDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="ExpireDay.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/ExpireDay/ExpireDayDlg.cpp b/Common_Class/ExpireDay/ExpireDayDlg.cpp
new file mode 100644
index 0000000..adae78f
--- /dev/null
+++ b/Common_Class/ExpireDay/ExpireDayDlg.cpp
@@ -0,0 +1,204 @@
+
+// ExpireDayDlg.cpp : 备泅 颇老
+//
+
+#include "stdafx.h"
+#include "ExpireDay.h"
+#include "ExpireDayDlg.h"
+#include "afxdialogex.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// 览侩 橇肺弊伐 沥焊俊 荤侩登绰 CAboutDlg 措拳 惑磊涝聪促.
+
+class CAboutDlg : public CDialogEx
+{
+public:
+	CAboutDlg();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_ABOUTBOX };
+
+	protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+// 备泅涝聪促.
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CExpireDayDlg 措拳 惑磊
+
+
+
+
+CExpireDayDlg::CExpireDayDlg(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CExpireDayDlg::IDD, pParent)
+	, m_strYear(_T(""))
+	, m_strMonth(_T(""))
+	, m_strDay(_T(""))
+{
+	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+}
+
+void CExpireDayDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Text(pDX, IDC_EDIT_YEAR, m_strYear);
+	DDX_Text(pDX, IDC_EDIT_MONTH, m_strMonth);
+	DDX_Text(pDX, IDC_EDIT_DAY, m_strDay);
+}
+
+BEGIN_MESSAGE_MAP(CExpireDayDlg, CDialogEx)
+	ON_WM_SYSCOMMAND()
+	ON_WM_PAINT()
+	ON_WM_QUERYDRAGICON()
+	ON_BN_CLICKED(IDOK, &CExpireDayDlg::OnBnClickedOk)
+END_MESSAGE_MAP()
+
+
+// CExpireDayDlg 皋矫瘤 贸府扁
+
+BOOL CExpireDayDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// 矫胶袍 皋春俊 "沥焊..." 皋春 亲格阑 眠啊钦聪促.
+
+	// IDM_ABOUTBOX绰 矫胶袍 疙飞 裹困俊 乐绢具 钦聪促.
+	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+	ASSERT(IDM_ABOUTBOX < 0xF000);
+
+	CMenu* pSysMenu = GetSystemMenu(FALSE);
+	if (pSysMenu != NULL)
+	{
+		BOOL bNameValid;
+		CString strAboutMenu;
+		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
+		ASSERT(bNameValid);
+		if (!strAboutMenu.IsEmpty())
+		{
+			pSysMenu->AppendMenu(MF_SEPARATOR);
+			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+		}
+	}
+
+	// 捞 措拳 惑磊狼 酒捞能阑 汲沥钦聪促. 览侩 橇肺弊伐狼 林 芒捞 措拳 惑磊啊 酒匆 版快俊绰
+	//  橇饭烙况农啊 捞 累诀阑 磊悼栏肺 荐青钦聪促.
+	SetIcon(m_hIcon, TRUE);			// 奴 酒捞能阑 汲沥钦聪促.
+	SetIcon(m_hIcon, FALSE);		// 累篮 酒捞能阑 汲沥钦聪促.
+
+	CFile	file;
+	CString	strPath;
+	STU_EXPIRE_DAY	stuExpire;
+
+	strPath.Format(_T("C:\\RCutProject\\Config\\SISConfirm.bin"));
+
+	if(TRUE == file.Open(strPath,CFile::modeRead))
+	{
+		if(sizeof(STU_EXPIRE_DAY) == file.Read(&stuExpire, sizeof(STU_EXPIRE_DAY)))
+		{
+			m_strYear.Format(_T("%d"),stuExpire.m_nYear);
+			m_strMonth.Format(_T("%d"),stuExpire.m_nMonth);
+			m_strDay.Format(_T("%d"),stuExpire.m_nDay);
+			UpdateData(FALSE);
+		}
+
+		file.Close();
+	}
+
+	return TRUE;  // 器目胶甫 牧飘费俊 汲沥窍瘤 臼栏搁 TRUE甫 馆券钦聪促.
+}
+
+void CExpireDayDlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+	{
+		CAboutDlg dlgAbout;
+		dlgAbout.DoModal();
+	}
+	else
+	{
+		CDialogEx::OnSysCommand(nID, lParam);
+	}
+}
+
+// 措拳 惑磊俊 弥家拳 窜眠甫 眠啊且 版快 酒捞能阑 弊府妨搁
+//  酒贰 内靛啊 鞘夸钦聪促. 巩辑/轰 葛胆阑 荤侩窍绰 MFC 览侩 橇肺弊伐狼 版快俊绰
+//  橇饭烙况农俊辑 捞 累诀阑 磊悼栏肺 荐青钦聪促.
+
+void CExpireDayDlg::OnPaint()
+{
+	if (IsIconic())
+	{
+		CPaintDC dc(this); // 弊府扁甫 困茄 叼官捞胶 牧咆胶飘涝聪促.
+
+		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+		// 努扼捞攫飘 荤阿屈俊辑 酒捞能阑 啊款单俊 嘎娩聪促.
+		int cxIcon = GetSystemMetrics(SM_CXICON);
+		int cyIcon = GetSystemMetrics(SM_CYICON);
+		CRect rect;
+		GetClientRect(&rect);
+		int x = (rect.Width() - cxIcon + 1) / 2;
+		int y = (rect.Height() - cyIcon + 1) / 2;
+
+		// 酒捞能阑 弊赋聪促.
+		dc.DrawIcon(x, y, m_hIcon);
+	}
+	else
+	{
+		CDialogEx::OnPaint();
+	}
+}
+
+// 荤侩磊啊 弥家拳等 芒阑 掺绰 悼救俊 目辑啊 钎矫登档废 矫胶袍俊辑
+//  捞 窃荐甫 龋免钦聪促.
+HCURSOR CExpireDayDlg::OnQueryDragIcon()
+{
+	return static_cast<HCURSOR>(m_hIcon);
+}
+
+
+
+void CExpireDayDlg::OnBnClickedOk()
+{
+	UpdateData(TRUE);
+
+	CString			strPath;
+	CString			str,strContents;
+	CStdioFile		pFile;
+	CFileException	ex;		
+	STU_EXPIRE_DAY	stuExpire;
+
+	stuExpire.m_nYear = _ttoi(m_strYear);
+	stuExpire.m_nMonth = _ttoi(m_strMonth);
+	stuExpire.m_nDay = _ttoi(m_strDay);
+
+	strPath.Format(_T("C:\\RCutProject\\Config\\SISConfirm.bin"));
+	
+	CFile	file;
+	if(TRUE == file.Open(strPath, CFile::modeCreate | CFile::modeWrite))
+	{
+		file.Write(&stuExpire, sizeof(STU_EXPIRE_DAY));
+		file.Close();
+	}
+
+	CDialogEx::OnOK();
+}
diff --git a/Common_Class/ExpireDay/ExpireDayDlg.h b/Common_Class/ExpireDay/ExpireDayDlg.h
new file mode 100644
index 0000000..b7f3dcf
--- /dev/null
+++ b/Common_Class/ExpireDay/ExpireDayDlg.h
@@ -0,0 +1,38 @@
+
+// ExpireDayDlg.h : 庆歹 颇老
+//
+
+#pragma once
+
+#include "ExpireDayDefine.h"
+
+// CExpireDayDlg 措拳 惑磊
+class CExpireDayDlg : public CDialogEx
+{
+// 积己涝聪促.
+public:
+	CExpireDayDlg(CWnd* pParent = NULL);	// 钎霖 积己磊涝聪促.
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_EXPIREDAY_DIALOG };
+
+	protected:
+	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 瘤盔涝聪促.
+
+
+// 备泅涝聪促.
+protected:
+	HICON m_hIcon;
+
+	// 积己等 皋矫瘤 甘 窃荐
+	virtual BOOL OnInitDialog();
+	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+	afx_msg void OnPaint();
+	afx_msg HCURSOR OnQueryDragIcon();
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnBnClickedOk();
+	CString m_strYear;
+	CString m_strMonth;
+	CString m_strDay;
+};
diff --git a/Common_Class/ExpireDay/ReadMe.txt b/Common_Class/ExpireDay/ReadMe.txt
new file mode 100644
index 0000000..e3c9995
--- /dev/null
+++ b/Common_Class/ExpireDay/ReadMe.txt
@@ -0,0 +1,100 @@
+================================================================================
+    MFC 扼捞宏矾府 : ExpireDay 橇肺璃飘 俺夸
+================================================================================
+
+览侩 橇肺弊伐 付过荤俊辑 捞 ExpireDay 览侩 橇肺弊伐阑 
+父甸菌嚼聪促. 捞 览侩 橇肺弊伐篮 MFC狼 扁夯 荤侩过阑 焊咯 临 挥父 酒聪扼 览侩 
+橇肺弊伐累己阑 困茄 扁夯 备炼甫 力傍钦聪促.
+
+捞 颇老俊绰 ExpireDay 览侩 橇肺弊伐阑 备己窍绰 阿 颇老俊 措茄
+夸距 汲疙捞 器窃登绢 乐嚼聪促.
+
+ExpireDay.vcxproj
+    览侩 橇肺弊伐 付过荤甫 荤侩窍咯 积己等 VC++ 橇肺璃飘狼 林 橇肺璃飘 颇老涝聪促. 
+    颇老阑 积己茄 Visual C++ 滚傈俊 措茄 沥焊客 览侩 橇肺弊伐 付过荤甫 荤侩窍咯 急琶茄 
+    敲阀汽, 备己 棺 橇肺璃飘 扁瓷俊 措茄 沥焊啊 甸绢 乐嚼聪促.
+
+ExpireDay.vcxproj.filters
+    览侩 橇肺弊伐 付过荤甫 荤侩窍咯 积己等 VC++ 橇肺璃飘狼 鞘磐 颇老涝聪促. 
+    捞 颇老俊绰 橇肺璃飘狼 颇老苞 鞘磐 埃狼 楷搬 沥焊啊 甸绢 乐嚼聪促. 捞矾茄 
+    楷搬篮 漂沥 畴靛俊辑 蜡荤茄 犬厘疙栏肺 弊缝拳等 颇老阑 钎矫窍扁 困秦 
+    IDE俊辑 荤侩邓聪促. 抗甫 甸绢 ".cpp" 颇老篮 "家胶 颇老" 鞘磐客 楷搬登绢 
+    乐嚼聪促.
+
+
+ExpireDay.h
+    览侩 橇肺弊伐狼 扁夯 庆歹 颇老涝聪促. 咯扁俊绰 促弗 橇肺璃飘 包访
+    庆歹(Resource.h 器窃)啊 甸绢 乐绊 CExpireDayApp 览侩 橇肺弊伐
+    努贰胶甫 急攫钦聪促.
+
+ExpireDay.cpp
+    览侩 橇肺弊伐 努贰胶 CExpireDayApp捞(啊) 甸绢 乐绰 扁夯 览侩 橇肺弊伐
+    家胶 颇老涝聪促.
+
+ExpireDay.rc
+    橇肺弊伐俊辑 荤侩窍绰 葛电 Microsoft Windows 府家胶狼 格废涝聪促.
+ 咯扁俊绰 RES 窍困 叼泛磐府俊 历厘等 酒捞能, 厚飘甘 棺 目辑啊
+    器窃邓聪促. 捞 颇老篮 Microsoft Visual C++俊辑 流立
+    祈笼且 荐 乐嚼聪促. 橇肺璃飘 府家胶绰 1042俊 乐嚼聪促.
+
+res\ExpireDay.ico
+    览侩 橇肺弊伐狼 酒捞能栏肺 荤侩登绰 酒捞能 颇老涝聪促. 捞 酒捞能篮
+    林 府家胶 颇老牢 ExpireDay.rc俊 狼秦 器窃邓聪促.
+
+res\ExpireDay.rc2
+    捞 颇老俊绰 Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶啊 
+    甸绢 乐嚼聪促. 府家胶 祈笼扁肺 祈笼且 荐 绝绰 葛电 府家胶绰
+    捞 颇老俊 持绢具 钦聪促.
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+览侩 橇肺弊伐 付过荤俊辑 窍唱狼 措拳 惑磊 努贰胶啊 父甸绢笼聪促.
+
+ExpireDayDlg.h, ExpireDayDlg.cpp - 措拳 惑磊
+    捞 颇老俊绰 CExpireDayDlg 努贰胶啊 甸绢 乐嚼聪促. 捞 努贰胶绰
+    览侩 橇肺弊伐狼 林 措拳 惑磊 悼累阑 沥狼钦聪促. 措拳 惑磊狼 袍敲复篮
+    Microsoft Visual C++俊辑 祈笼且 荐 乐绰 ExpireDay.rc俊 乐嚼聪促.
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 扁瓷:
+
+ActiveX 牧飘费
+    览侩 橇肺弊伐俊辑 ActiveX 牧飘费阑 荤侩且 荐 乐档废 瘤盔钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 钎霖 颇老:
+
+StdAfx.h, StdAfx.cpp
+    捞 颇老篮 固府 哪颇老等 庆歹 颇老(PCH)牢 ExpireDay.pch客
+    固府 哪颇老等 屈侥 颇老牢 StdAfx.obj甫 呼靛窍绰 单 荤侩邓聪促.
+
+Resource.h
+    货 府家胶 ID甫 沥狼窍绰 钎霖 庆歹 颇老涝聪促.
+    Microsoft Visual C++俊辑 捞 颇老阑 佬绊 诀单捞飘钦聪促.
+
+ExpireDay.manifest
+	览侩 橇肺弊伐 概聪其胶飘 颇老篮 Windows XP俊辑 漂沥 滚傈狼 Side-by-Side 
+	绢祭喉府俊 措茄 览侩 橇肺弊伐 辆加己阑 汲疙窍绰 单 荤侩邓聪促. 肺歹绰 捞 沥焊甫 
+	荤侩窍咯 绢祭喉府 某矫俊辑 利例茄 绢祭喉府甫 肺靛窍芭唱 览侩 橇肺弊伐俊辑 傈侩 
+	绢祭喉府甫 肺靛钦聪促. 览侩 橇肺弊伐 概聪其胶飘绰 览侩 橇肺弊伐 角青 颇老苞 鞍篮 
+	弃歹俊 汲摹等 寇何 .manifest 颇老肺 犁硅器甫 困秦 器窃登芭唱 府家胶狼 屈怕肺 
+	角青 颇老俊 器窃瞪 荐 乐嚼聪促. 
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 曼绊:
+
+览侩 橇肺弊伐 付过荤绰 "TODO:"甫 荤侩窍咯 眠啊窍芭唱 荤侩磊 瘤沥秦具 窍绰
+家胶 内靛 何盒阑 唱鸥忱聪促.
+
+览侩 橇肺弊伐捞 傍蜡 DLL俊辑 MFC甫 荤侩窍绰 版快 秦寸 MFC DLL阑 
+犁硅器秦具 钦聪促. 弊府绊 览侩 橇肺弊伐捞 款康 眉力狼 肺亩苞 
+促弗 攫绢甫 荤侩窍绰 版快 秦寸 瘤开拳等 府家胶牢 MFC100XXX.DLL阑 
+犁硅器秦具 钦聪促. 捞 滴啊瘤 亲格俊 措茄 磊技茄 郴侩篮 
+MSDN 汲疙辑狼 Visual C++ 览侩 橇肺弊伐 犁硅器 亲格阑 
+曼炼窍绞矫坷.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/ExpireDay/res/ExpireDay.ico b/Common_Class/ExpireDay/res/ExpireDay.ico
new file mode 100644
index 0000000..d56fbcd
--- /dev/null
+++ b/Common_Class/ExpireDay/res/ExpireDay.ico
Binary files differ
diff --git a/Common_Class/ExpireDay/res/ExpireDay.rc2 b/Common_Class/ExpireDay/res/ExpireDay.rc2
new file mode 100644
index 0000000..7885cbd
--- /dev/null
+++ b/Common_Class/ExpireDay/res/ExpireDay.rc2
Binary files differ
diff --git a/Common_Class/ExpireDay/resource.h b/Common_Class/ExpireDay/resource.h
new file mode 100644
index 0000000..a1ede54
--- /dev/null
+++ b/Common_Class/ExpireDay/resource.h
Binary files differ
diff --git a/Common_Class/ExpireDay/stdafx.cpp b/Common_Class/ExpireDay/stdafx.cpp
new file mode 100644
index 0000000..9c54628
--- /dev/null
+++ b/Common_Class/ExpireDay/stdafx.cpp
@@ -0,0 +1,8 @@
+
+// stdafx.cpp : 钎霖 器窃 颇老父 甸绢 乐绰 家胶 颇老涝聪促.
+// ExpireDay.pch绰 固府 哪颇老等 庆歹啊 邓聪促.
+// stdafx.obj俊绰 固府 哪颇老等 屈侥 沥焊啊 器窃邓聪促.
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/ExpireDay/stdafx.h b/Common_Class/ExpireDay/stdafx.h
new file mode 100644
index 0000000..3ff9b23
--- /dev/null
+++ b/Common_Class/ExpireDay/stdafx.h
@@ -0,0 +1,58 @@
+
+// stdafx.h : 磊林 荤侩窍瘤父 磊林 函版登瘤绰 臼绰
+// 钎霖 矫胶袍 器窃 颇老 棺 橇肺璃飘 包访 器窃 颇老捞 
+// 甸绢 乐绰 器窃 颇老涝聪促.
+
+#pragma once
+
+#ifndef _SECURE_ATL
+#define _SECURE_ATL 1
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 芭狼 荤侩登瘤 臼绰 郴侩篮 Windows 庆歹俊辑 力寇钦聪促.
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 老何 CString 积己磊绰 疙矫利栏肺 急攫邓聪促.
+
+// MFC狼 傍烹 何盒苞 公矫 啊瓷茄 版绊 皋矫瘤俊 措茄 见扁扁甫 秦力钦聪促.
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h>         // MFC 琴缴 棺 钎霖 备己 夸家涝聪促.
+#include <afxext.h>         // MFC 犬厘涝聪促.
+
+
+#include <afxdisp.h>        // MFC 磊悼拳 努贰胶涝聪促.
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // Internet Explorer 4 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>             // Windows 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxcontrolbars.h>     // MFC狼 府夯 棺 牧飘费 阜措 瘤盔
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+
diff --git a/Common_Class/ExpireDay/targetver.h b/Common_Class/ExpireDay/targetver.h
new file mode 100644
index 0000000..ad5ca61
--- /dev/null
+++ b/Common_Class/ExpireDay/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 器窃 SDKDDKVer.h绰 荤侩 啊瓷茄 Windows 敲阀汽 吝 滚傈捞 啊厘 臭篮 敲阀汽阑 沥狼钦聪促.
+
+// 捞傈 Windows 敲阀汽俊 措秦 览侩 橇肺弊伐阑 呼靛窍妨绰 版快俊绰 SDKDDKVer.h甫 器窃窍扁 傈俊
+// WinSDKVer.h甫 器窃窍绊 _WIN32_WINNT 概农肺甫 瘤盔窍妨绰 敲阀汽栏肺 汲沥窍绞矫坷.
+
+#include <SDKDDKVer.h>
diff --git a/Common_Class/LogView/Header/InsertPathDlg.h b/Common_Class/LogView/Header/InsertPathDlg.h
new file mode 100644
index 0000000..6bcf61e
--- /dev/null
+++ b/Common_Class/LogView/Header/InsertPathDlg.h
@@ -0,0 +1,35 @@
+#pragma once
+
+
+// CInsertPathDlg 措拳 惑磊涝聪促.
+
+class CInsertPathDlg : public CDialog
+{
+	DECLARE_DYNAMIC(CInsertPathDlg)
+
+public:
+	CInsertPathDlg(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CInsertPathDlg();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_insertPathDlg };
+
+	CString GetLogName(){return m_strLogName;};
+	CString GetLogPath(){return m_strLogName;};
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+	DECLARE_MESSAGE_MAP()
+public:
+	int m_nLogID;
+	CString m_strLogName;
+	CString m_strLogPath;
+
+	int* m_pRetLogID;
+	TCHAR* m_pRetLogName;
+	TCHAR* m_pRetLogPath;
+	afx_msg void OnBnClickedChoicepath();
+	afx_msg void OnBnClickedOk();
+	bool SetRetValue(int* LogID, TCHAR* LogName, TCHAR* LogPath);
+};
diff --git a/Common_Class/LogView/Header/LogView.h b/Common_Class/LogView/Header/LogView.h
new file mode 100644
index 0000000..0537beb
--- /dev/null
+++ b/Common_Class/LogView/Header/LogView.h
@@ -0,0 +1,34 @@
+// LogView.h : LogView 览侩 橇肺弊伐俊 措茄 林 庆歹 颇老
+//
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "PCH俊 措秦 捞 颇老阑 器窃窍扁 傈俊 'stdafx.h'甫 器窃钦聪促."
+#endif
+
+#include "resource.h"       // 林 扁龋涝聪促.
+
+
+// CLogViewApp:
+// 捞 努贰胶狼 备泅俊 措秦辑绰 LogView.cpp阑 曼炼窍绞矫坷.
+//
+
+class CLogViewApp : public CWinApp
+{
+public:
+	CLogViewApp();
+
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL InitInstance();
+	virtual int ExitInstance();
+
+// 备泅涝聪促.
+	afx_msg void OnAppAbout();
+	DECLARE_MESSAGE_MAP()
+
+	HANDLE		m_hMutex;
+};
+
+extern CLogViewApp theApp;
\ No newline at end of file
diff --git a/Common_Class/LogView/Header/LogViewDoc.h b/Common_Class/LogView/Header/LogViewDoc.h
new file mode 100644
index 0000000..f1c7af3
--- /dev/null
+++ b/Common_Class/LogView/Header/LogViewDoc.h
@@ -0,0 +1,40 @@
+// LogViewDoc.h : CLogViewDoc 努贰胶狼 牢磐其捞胶
+//
+
+
+#pragma once
+
+
+class CLogViewDoc : public CDocument
+{
+protected: // serialization俊辑父 父甸绢笼聪促.
+	CLogViewDoc();
+	DECLARE_DYNCREATE(CLogViewDoc)
+
+// 漂己涝聪促.
+public:
+
+// 累诀涝聪促.
+public:
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL OnNewDocument();
+	virtual void Serialize(CArchive& ar);
+
+// 备泅涝聪促.
+public:
+	virtual ~CLogViewDoc();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// 积己等 皋矫瘤 甘 窃荐
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+
diff --git a/Common_Class/LogView/Header/LogViewOption.h b/Common_Class/LogView/Header/LogViewOption.h
new file mode 100644
index 0000000..087d424
--- /dev/null
+++ b/Common_Class/LogView/Header/LogViewOption.h
@@ -0,0 +1,30 @@
+#pragma once
+#include "afxwin.h"
+
+
+// CLogViewOption 措拳 惑磊涝聪促.
+
+class CLogViewOption : public CDialog
+{
+	DECLARE_DYNAMIC(CLogViewOption)
+
+public:
+	CLogViewOption(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CLogViewOption();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DiaLog_Option };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+	DECLARE_MESSAGE_MAP()
+public:
+	int m_nOptionLogSaveDelay;
+	int m_nOptionMemoryMapDelay;
+	int m_nOptionCommandReadDelay;
+	int m_nOptionLogSaveLevel;
+	CComboBox m_ComboOptionSaveLevel;
+	int m_nOptionListPrintCount;
+	afx_msg void OnBnClickedOk();
+};
diff --git a/Common_Class/LogView/Header/LogViewView.h b/Common_Class/LogView/Header/LogViewView.h
new file mode 100644
index 0000000..9d81d7c
--- /dev/null
+++ b/Common_Class/LogView/Header/LogViewView.h
@@ -0,0 +1,156 @@
+// LogViewView.h : CLogViewView 努贰胶狼 牢磐其捞胶
+//
+
+
+#pragma once
+#include "afxcmn.h"
+#include "afxwin.h"
+
+#define READ_SHAREDMAP	10
+#define SAVE_LOGFILE	20
+#define READ_COMMAND	30
+#define DELETE_LOG		40
+
+//肺弊 皋葛府 Pool 荤捞令甫 瘤沥钦聪促.
+#define LOG_MEMORY_COUNT	1000
+
+//LOG_MEMORY_SIZE狼 蔼阑 函版且锭 MemoryManager.h俊 乐绰 TLOGSIZE 蔼档 函版秦具 钦聪促.
+//皋葛府 Pool俊 乐绰 窍唱狼 肺弊狼 农扁甫 瘤沥钦聪促.
+
+
+typedef struct _DITSAVEOPTION{
+	unsigned int nMemoryMapReadDelay;
+	unsigned int nCommandReadDelay;
+	unsigned int nLogSaveDelay;
+	unsigned int nLogSaveLevel;
+	unsigned int nListPrintCount;
+	int nViewLevel;
+} DITSAVEOPTION,*PDITSAVEOPTION;
+
+class CLogManager;
+class CMemoryManager;
+class CPathData;
+
+class CLogViewView : public CFormView
+{
+	//SharedMapDll
+	CLogManager* m_pLogManager;
+	//肺弊 皋葛府 Pool苞 肺弊 钮甫 包府钦聪促.
+	CMemoryManager* m_pMemoryManager[LV_FCOUNT];
+
+	CPathData* m_pPathData;
+
+	//泅犁 肺弊 View啊 佬绢柯 牢郸胶
+	unsigned int m_nIndex;
+
+	//肺弊 历厘 林扁甫 淬绊 乐绰 函荐
+	unsigned int m_nLogSaveDelay;
+	//皋葛府 甘 肺靛 林扁甫 淬绊 乐绰 函荐
+	unsigned int m_nMemoryMapReadDelay;
+	//目盖靛 甘 肺靛 林扁甫 淬绊 乐绰 函荐
+	unsigned int m_nCommandReadDelay;
+	//肺弊颇老俊 历厘且 肺弊 力茄 饭骇阑 淬绊 乐绰 函荐
+	unsigned int m_nLogSaveLevel;
+	//LogView 吝汗 角青阑 眉农且 捞亥飘 按眉
+	//橇肺技胶 ID甫 掘绢棵锭 荤侩钦聪促.
+	HANDLE m_hDupCheck;
+
+	//鸥捞赣 林扁 函版矫 焊龋 flag
+	bool m_bKillTimer;
+
+	//肺弊 府胶飘 磊悼 胶农费 眉农 函荐
+	BOOL m_bAutoScroll;
+	//肺弊 府胶飘俊 免仿且 力茄 饭骇
+	int m_nViewLevel;
+	//肺弊 府胶飘 力茄 饭骇阑 牧飘费 窍绰 霓焊冠胶
+	CComboBox m_ComboViewLevel;
+
+	//肺弊甫 免仿窍绰 府胶飘 牧飘费
+	CListCtrl m_ListLogViewer;
+
+	//泅犁 悼累窍绰 橇肺技胶 酒捞叼
+	unsigned int m_nProcessID;
+
+	
+	
+	CString m_strDefaultPath;
+	CString m_strMemoryMap;
+protected: // serialization俊辑父 父甸绢笼聪促.
+	CLogViewView();
+	DECLARE_DYNCREATE(CLogViewView)
+
+public:
+	enum{ IDD = IDD_LOGVIEW_FORM };
+
+// 漂己涝聪促.
+public:
+	CLogViewDoc* GetDocument() const;
+
+// 累诀涝聪促.
+public:
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual void OnInitialUpdate(); // 积己 饶 贸澜 龋免登菌嚼聪促.
+
+// 备泅涝聪促.
+public:
+	virtual ~CLogViewView();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// 积己等 皋矫瘤 甘 窃荐
+protected:
+	DECLARE_MESSAGE_MAP()
+public:
+
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnDestroy();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	//皋葛府 甘俊 乐绰 郴侩阑 佬绢柯促.
+	void ReadSharedMemoryMap(void);
+	//肺弊 钮俊 乐绰 郴侩阑 颇老肺 历厘茄促.
+	void SaveLogFile(void);
+	//林扁利栏肺 目盖靛啊 乐绰瘤 犬牢茄促.
+	void ReadCommand(void);
+	//角青登绊 乐绰 颇老狼 困摹甫 掘绢柯促.
+	void GetModulePath(CString &Temp);
+	afx_msg void OnBnClickedCheckAutoscroll();
+
+	afx_msg void OnCbnSelchangeComboViewlevel();
+	afx_msg void OnOptionLogsave();
+
+	//汲沥等 券版阑 佬绢柯促.
+	void ReadINIFile(void);
+	//汲沥等 蔼阑 INI颇老俊 历厘茄促.
+	void SaveINIFile(void);
+	//府胶飘俊 免仿且 墨款飘 函荐
+	unsigned int m_nListPrintCount;
+	//捞亥飘 按眉甫 捞侩窍咯 吝汗登瘤 臼绰 ProcessID甫 掘绢柯促.
+	unsigned int GetProcessID(TCHAR* MemoryMapName);
+	afx_msg void OnBnClickedButtonMapsave();
+	void DeleteLog(void);
+	void GetDeleteDay(SYSTEMTIME& Today, DWORD DiffDay);
+	DWORD SystemToAbsDay(SYSTEMTIME& st);
+	void AbsDayToSystemTime(DWORD AbsDay, SYSTEMTIME& st);
+	afx_msg void OnLogpathsetting();
+	bool CheckDup(TCHAR* MemoryMapName);
+	int m_nViewLogIndex;
+	afx_msg void OnCbnSelchangeComboLogid();
+	CComboBox m_ComboViewLogID;
+	int m_ComboViewLastLogID;
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+};
+
+#ifndef _DEBUG  // LogViewView.cpp狼 叼滚弊 滚傈
+inline CLogViewDoc* CLogViewView::GetDocument() const
+   { return reinterpret_cast<CLogViewDoc*>(m_pDocument); }
+#endif
+
diff --git a/Common_Class/LogView/Header/MainFrm.h b/Common_Class/LogView/Header/MainFrm.h
new file mode 100644
index 0000000..6df9249
--- /dev/null
+++ b/Common_Class/LogView/Header/MainFrm.h
@@ -0,0 +1,56 @@
+// MainFrm.h : CMainFrame 努贰胶狼 牢磐其捞胶
+//
+
+
+#pragma once
+#define UM_TRAY		WM_USER + 777
+
+class CMainFrame : public CFrameWnd
+{
+	
+protected: // serialization俊辑父 父甸绢笼聪促.
+	CMainFrame();
+	DECLARE_DYNCREATE(CMainFrame)
+
+// 漂己涝聪促.
+public:
+	UINT		m_uShellRestart;
+	bool		m_bOnTop;
+// 累诀涝聪促.
+public:
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+// 备泅涝聪促.
+public:
+	virtual ~CMainFrame();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:  // 牧飘费 葛澜捞 器窃等 糕滚涝聪促.
+	CStatusBar  m_wndStatusBar;
+	CToolBar    m_wndToolBar;
+
+// 积己等 皋矫瘤 甘 窃荐
+protected:
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg LRESULT OnTray(WPARAM wParam, LPARAM lParam);
+	DECLARE_MESSAGE_MAP()
+public:
+	void GoTray(void);
+	afx_msg void OnClose();
+	afx_msg void OnDestroy();
+
+	afx_msg void OnTraymenuShowapplication();
+	afx_msg void OnTraymenuExit();
+protected:
+	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+public:
+	afx_msg void OnViewalwaysontop();
+};
+
+
diff --git a/Common_Class/LogView/Header/MemoryManager.h b/Common_Class/LogView/Header/MemoryManager.h
new file mode 100644
index 0000000..9eb706b
--- /dev/null
+++ b/Common_Class/LogView/Header/MemoryManager.h
@@ -0,0 +1,39 @@
+#pragma once
+#include <stack>
+#include <queue>
+using namespace std;
+
+//窍唱狼 肺弊 皋葛府 荤捞令甫 唱鸥忱聪促.
+#define TLOGSIZE LOG_MEMORY_SIZE+64
+
+class CMemoryManager
+{
+	//皋葛府 Pool肺 荤侩且 STL 胶琶
+	stack<char*> m_MemoryPool;
+
+	//肺弊甫 历厘窍绊 乐绰 STL 钮 = 肺弊 钮
+	queue<char*> m_LogQueue;
+
+	int m_nLogID;
+	CString m_strPathName;//[MAX_PATH];
+	CString m_strLogName;//[MAX_PATH];
+//	TCHAR m_TLog[LOG_MEMORY_SIZE];
+	unsigned short m_LogSize;
+
+	CRITICAL_SECTION m_csLogFile;
+	CRITICAL_SECTION m_csMemory;
+public:
+	CMemoryManager(int MaxCount, int LogSize,int LogID, CString strLogPath, CString strLogName);
+	virtual ~CMemoryManager(void);
+
+	//肺弊甫 肺弊钮俊 持绰促.
+	void PushLog(TCHAR* str, unsigned int* curIndex, 
+		unsigned int* curLevel,unsigned int* curProcess, PSYSTEMTIME curTime);
+
+	//肺弊 钮俊 乐绰 郴侩阑 颇老俊 历厘窍绊
+	//钮俊 乐绰 肺弊 皋葛府甫 皋葛府 Pool肺 颗变促.
+	void SaveLog();
+
+	//泅犁 角青登绊 乐绰 颇老 困摹甫 掘绢柯促.
+	void GetModulePath(void);
+};
diff --git a/Common_Class/LogView/Header/PathData.h b/Common_Class/LogView/Header/PathData.h
new file mode 100644
index 0000000..d3c9173
--- /dev/null
+++ b/Common_Class/LogView/Header/PathData.h
@@ -0,0 +1,30 @@
+#pragma once
+
+class CPathData
+{
+private:
+	//肺弊 颇老阑 历厘且 版肺
+	int m_nLogID[LV_FCOUNT];
+	CString m_strLogPath[LV_FCOUNT];
+	CString m_strLogName[LV_FCOUNT];
+	CString m_strDefaultPath;
+	CString m_strDefaultName;
+public:
+	CPathData(void);
+	virtual ~CPathData(void);
+	void GetModulePath(void);
+	CString GetNameFromID(int& LogID);
+	CString GetPathFromID(int& LogID);
+	int GetIndexFromID(int& LogID);
+	CString GetNameFromIndex(int& Index);
+	CString GetPathFromIndex(int& Index);
+	bool InsertPathData(int& LogID, CString& strName, CString& strPath);
+	int GetEmptyIndex(void);
+	bool DeletePathData(int& LogID);
+	int GetIDFromIndex(int& Index);
+	bool SetPathData(int& LogID, CString& strName, CString& strPath);
+	bool SetNameFromIndex(int& Index, CString& PathName);
+	bool SetPathFromIndex(int& index, CString& strPath);
+	bool ModifyPathData(int& LogID, CString& strPathName, CString& strLogPath);
+	void InitPathData(void);
+};
diff --git a/Common_Class/LogView/Header/PathSettingDlg.h b/Common_Class/LogView/Header/PathSettingDlg.h
new file mode 100644
index 0000000..fdf4c84
--- /dev/null
+++ b/Common_Class/LogView/Header/PathSettingDlg.h
@@ -0,0 +1,35 @@
+#pragma once
+#include "afxcmn.h"
+
+class CPathData;
+
+// CPathSettingDlg 措拳 惑磊涝聪促.
+
+class CPathSettingDlg : public CDialog
+{
+	DECLARE_DYNAMIC(CPathSettingDlg)
+
+	CPathData* m_pPathData;
+	int nCurLogID;
+	CString CurLogName;
+	CString CurLogPath;
+public:
+	CPathSettingDlg(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	void Init(CPathData* pPathData);
+	virtual ~CPathSettingDlg();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_Path_Setting };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnBnClickedInsertpathdata();
+	CListCtrl m_LogPathList;
+	void InitList(void);
+	virtual BOOL OnInitDialog();
+	afx_msg void OnBnClickedOk();
+	afx_msg void OnBnClickedDeletepath();
+};
diff --git a/Common_Class/LogView/InsertPathDlg.cpp b/Common_Class/LogView/InsertPathDlg.cpp
new file mode 100644
index 0000000..9c34fec
--- /dev/null
+++ b/Common_Class/LogView/InsertPathDlg.cpp
@@ -0,0 +1,86 @@
+// InsertPathDlg.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "LogView.h"
+#include "InsertPathDlg.h"
+
+
+// CInsertPathDlg 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CInsertPathDlg, CDialog)
+
+CInsertPathDlg::CInsertPathDlg(CWnd* pParent /*=NULL*/)
+	: CDialog(CInsertPathDlg::IDD, pParent)
+	, m_nLogID(0)
+	, m_strLogName(_T(""))
+	, m_strLogPath(_T(""))
+{
+
+}
+
+CInsertPathDlg::~CInsertPathDlg()
+{
+}
+
+void CInsertPathDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+	DDX_Text(pDX, IDC_LogID, m_nLogID);
+	DDV_MinMaxInt(pDX, m_nLogID, 0, 99);
+	DDX_Text(pDX, IDC_LogName, m_strLogName);
+	DDX_Text(pDX, IDC_LogPath, m_strLogPath);
+}
+
+
+BEGIN_MESSAGE_MAP(CInsertPathDlg, CDialog)
+	ON_BN_CLICKED(IDC_ChoicePath, &CInsertPathDlg::OnBnClickedChoicepath)
+	ON_BN_CLICKED(IDOK, &CInsertPathDlg::OnBnClickedOk)
+END_MESSAGE_MAP()
+
+
+// CInsertPathDlg 皋矫瘤 贸府扁涝聪促.
+
+void CInsertPathDlg::OnBnClickedChoicepath()
+{
+	UpdateData();
+	CString strSelectPath;
+	BROWSEINFO BInfo;
+	TCHAR szBuffer[512];
+	::ZeroMemory(&BInfo, sizeof(BROWSEINFO));
+	::ZeroMemory(szBuffer, 512);
+
+	BInfo.hwndOwner = GetSafeHwnd();
+	BInfo.lpszTitle = _T("肺弊甫 历厘且 弃歹甫 急琶窍技夸.");
+	BInfo.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
+	LPITEMIDLIST pItemidList = ::SHBrowseForFolder(&BInfo);
+	if( pItemidList == NULL)
+		m_strLogPath = _T("");
+
+	::SHGetPathFromIDList(pItemidList, szBuffer);
+	m_strLogPath = szBuffer;
+
+	UpdateData(false);
+}
+
+void CInsertPathDlg::OnBnClickedOk()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+	UpdateData();
+
+	*m_pRetLogID = m_nLogID;
+	_stprintf_s(m_pRetLogName, 128, _T("%s"), m_strLogName);
+	_stprintf_s(m_pRetLogPath, 128, _T("%s"), m_strLogPath);
+
+	OnOK();
+}
+
+bool CInsertPathDlg::SetRetValue(int* LogID, TCHAR* LogName, TCHAR* LogPath)
+{
+	m_pRetLogID = LogID;
+	m_pRetLogName = LogName;
+	m_pRetLogPath = LogPath;
+	return false;
+}
+
+
diff --git a/Common_Class/LogView/LogView.cpp b/Common_Class/LogView/LogView.cpp
new file mode 100644
index 0000000..01836ef
--- /dev/null
+++ b/Common_Class/LogView/LogView.cpp
@@ -0,0 +1,161 @@
+// LogView.cpp : 览侩 橇肺弊伐俊 措茄 努贰胶 悼累阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+#include "LogView.h"
+#include "MainFrm.h"
+
+#include "LogViewDoc.h"
+#include "LogViewView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CLogViewApp
+
+BEGIN_MESSAGE_MAP(CLogViewApp, CWinApp)
+	ON_COMMAND(ID_APP_ABOUT, &CLogViewApp::OnAppAbout)
+	// 钎霖 颇老阑 扁檬肺 窍绰 巩辑 疙飞涝聪促.
+	ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
+	ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
+END_MESSAGE_MAP()
+
+
+// CLogViewApp 积己
+
+CLogViewApp::CLogViewApp()
+{
+	// TODO: 咯扁俊 积己 内靛甫 眠啊钦聪促.
+	// InitInstance俊 葛电 吝夸茄 檬扁拳 累诀阑 硅摹钦聪促.
+
+	m_hMutex = NULL;
+}
+
+
+// 蜡老茄 CLogViewApp 俺眉涝聪促.
+
+CLogViewApp theApp;
+
+
+// CLogViewApp 檬扁拳
+
+int CLogViewApp::ExitInstance() 
+{	
+	if (m_hMutex)
+		CloseHandle(m_hMutex);
+
+	return CWinApp::ExitInstance();
+}
+
+BOOL CLogViewApp::InitInstance()
+{
+	m_hMutex = CreateMutex(NULL, FALSE, _T("MutexLogViwer"));
+	if (ERROR_ALREADY_EXISTS == GetLastError())
+	{		
+		return FALSE;
+	}
+
+	// 览侩 橇肺弊伐 概聪其胶飘啊 ComCtl32.dll 滚傈 6 捞惑阑 荤侩窍咯 厚林倔 胶鸥老阑
+	// 荤侩窍档废 瘤沥窍绰 版快, Windows XP 惑俊辑 馆靛矫 InitCommonControlsEx()啊 鞘夸钦聪促. 
+	// InitCommonControlsEx()甫 荤侩窍瘤 臼栏搁 芒阑 父甸 荐 绝嚼聪促.
+	INITCOMMONCONTROLSEX InitCtrls;
+	InitCtrls.dwSize = sizeof(InitCtrls);
+	// 览侩 橇肺弊伐俊辑 荤侩且 葛电 傍侩 牧飘费 努贰胶甫 器窃窍档废
+	// 捞 亲格阑 汲沥窍绞矫坷.
+	InitCtrls.dwICC = ICC_WIN95_CLASSES;
+	InitCommonControlsEx(&InitCtrls);
+
+	CWinApp::InitInstance();
+
+	// OLE 扼捞宏矾府甫 檬扁拳钦聪促.
+	if (!AfxOleInit())
+	{
+		AfxMessageBox(IDP_OLE_INIT_FAILED);
+		return FALSE;
+	}
+	AfxEnableControlContainer();
+	// 钎霖 檬扁拳
+	// 捞甸 扁瓷阑 荤侩窍瘤 臼绊 弥辆 角青 颇老狼 农扁甫 临捞妨搁
+	// 酒贰俊辑 鞘夸 绝绰 漂沥 檬扁拳
+	// 风凭阑 力芭秦具 钦聪促.
+	// 秦寸 汲沥捞 历厘等 饭瘤胶飘府 虐甫 函版窍绞矫坷.
+	// TODO: 捞 巩磊凯阑 雀荤 肚绰 炼流狼 捞抚苞 鞍篮
+	// 利例茄 郴侩栏肺 荐沥秦具 钦聪促.
+	SetRegistryKey(_T("肺拿 览侩 橇肺弊伐 付过荤俊辑 积己等 览侩 橇肺弊伐"));
+	LoadStdProfileSettings(4);  // MRU甫 器窃窍咯 钎霖 INI 颇老 可记阑 肺靛钦聪促.
+	// 览侩 橇肺弊伐狼 巩辑 袍敲复阑 殿废钦聪促. 巩辑 袍敲复篮
+	//  巩辑, 橇饭烙 芒 棺 轰 荤捞狼 楷搬 开且阑 钦聪促.
+	CSingleDocTemplate* pDocTemplate;
+	pDocTemplate = new CSingleDocTemplate(
+		IDR_MAINFRAME,
+		RUNTIME_CLASS(CLogViewDoc),
+		RUNTIME_CLASS(CMainFrame),       // 林 SDI 橇饭烙 芒涝聪促.
+		RUNTIME_CLASS(CLogViewView));
+	if (!pDocTemplate)
+		return FALSE;
+	AddDocTemplate(pDocTemplate);
+
+
+
+	// 钎霖 夹 疙飞, DDE, 颇老 凯扁俊 措茄 疙飞临阑 备巩 盒籍钦聪促.
+	CCommandLineInfo cmdInfo;
+	ParseCommandLine(cmdInfo);
+
+
+	// 疙飞临俊 瘤沥等 疙飞阑 叼胶菩摹钦聪促.
+	// 览侩 橇肺弊伐捞 /RegServer, /Register, /Unregserver 肚绰 /Unregister肺 矫累等 版快 FALSE甫 馆券钦聪促.
+	if (!ProcessShellCommand(cmdInfo))
+		return FALSE;
+
+	// 芒 窍唱父 檬扁拳登菌栏骨肺 捞甫 钎矫窍绊 诀单捞飘钦聪促.
+	m_pMainWnd->ShowWindow(SW_SHOW);
+	m_pMainWnd->UpdateWindow();
+	// 立固荤啊 乐阑 版快俊父 DragAcceptFiles甫 龋免钦聪促.
+	//  SDI 览侩 橇肺弊伐俊辑绰 ProcessShellCommand 饶俊 捞矾茄 龋免捞 惯积秦具 钦聪促.
+	return TRUE;
+}
+
+
+
+// 览侩 橇肺弊伐 沥焊俊 荤侩登绰 CAboutDlg 措拳 惑磊涝聪促.
+
+class CAboutDlg : public CDialog
+{
+public:
+	CAboutDlg();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_ABOUTBOX };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+// 备泅涝聪促.
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+END_MESSAGE_MAP()
+
+// 措拳 惑磊甫 角青窍扁 困茄 览侩 橇肺弊伐 疙飞涝聪促.
+void CLogViewApp::OnAppAbout()
+{
+	CAboutDlg aboutDlg;
+	aboutDlg.DoModal();
+}
+
+
+// CLogViewApp 皋矫瘤 贸府扁
+
diff --git a/Common_Class/LogView/LogView.rc b/Common_Class/LogView/LogView.rc
new file mode 100644
index 0000000..b3b9edf
--- /dev/null
+++ b/Common_Class/LogView/LogView.rc
@@ -0,0 +1,507 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// 茄惫绢(措茄刮惫) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
+#pragma code_page(949)
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#ifndef APSTUDIO_INVOKED\r\n"
+    "#include ""targetver.h""\r\n"
+    "#endif\r\n"
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
+    "LANGUAGE 18, 1\r\n"
+    "#pragma code_page(949)\r\n"
+    "#include ""res\\LogView.rc2""  // Microsoft Visual C++ AIUAC ⅴU⊥ レレ【々 āiAyCN ㈢OìAOⅴIⅴU.\r\n"
+    "#include ""l.KOR\\afxres.rc""          // C⊥Aí 【ì aOAOⅴIⅴU.\r\n"
+    "#endif\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_LogViewTYPE         ICON                    "res\\LogViewDoc.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDR_MAINFRAME           BITMAP                  "res\\Toolbar.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Toolbar
+//
+
+IDR_MAINFRAME TOOLBAR 16, 15
+BEGIN
+    BUTTON      ID_FILE_NEW
+    BUTTON      ID_FILE_OPEN
+    BUTTON      ID_FILE_SAVE
+    SEPARATOR
+    BUTTON      ID_EDIT_CUT
+    BUTTON      ID_EDIT_COPY
+    BUTTON      ID_EDIT_PASTE
+    SEPARATOR
+    BUTTON      ID_FILE_PRINT
+    BUTTON      ID_APP_ABOUT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MAINFRAME MENU
+BEGIN
+    POPUP "View(&V)"
+    BEGIN
+        MENUITEM "Status Bar(&S)",              ID_VIEW_STATUS_BAR
+        MENUITEM "Always On Top",               ID_ViewAlwaysOnTop
+    END
+    POPUP "Setting"
+    BEGIN
+        MENUITEM "Save Log Setting",            ID_Option_LogSave
+        MENUITEM "Log Path Setting",            ID_LogPathSetting
+    END
+    POPUP "Help(&H)"
+    BEGIN
+        MENUITEM "LogView Infomation(&A)...",   ID_APP_ABOUT
+    END
+END
+
+IDR_Tray MENU
+BEGIN
+    POPUP "TRAY MENU"
+    BEGIN
+        MENUITEM "Show Application",            ID_TRAYMENU_SHOWAPPLICATION
+        MENUITEM SEPARATOR
+        MENUITEM "LogView Exit",                ID_TRAYMENU_EXIT
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_MAINFRAME ACCELERATORS
+BEGIN
+    "N",            ID_FILE_NEW,            VIRTKEY, CONTROL
+    "O",            ID_FILE_OPEN,           VIRTKEY, CONTROL
+    "S",            ID_FILE_SAVE,           VIRTKEY, CONTROL
+    "Z",            ID_EDIT_UNDO,           VIRTKEY, CONTROL
+    "X",            ID_EDIT_CUT,            VIRTKEY, CONTROL
+    "C",            ID_EDIT_COPY,           VIRTKEY, CONTROL
+    "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL
+    VK_BACK,        ID_EDIT_UNDO,           VIRTKEY, ALT
+    VK_DELETE,      ID_EDIT_CUT,            VIRTKEY, SHIFT
+    VK_INSERT,      ID_EDIT_COPY,           VIRTKEY, CONTROL
+    VK_INSERT,      ID_EDIT_PASTE,          VIRTKEY, SHIFT
+    VK_F6,          ID_NEXT_PANE,           VIRTKEY 
+    VK_F6,          ID_PREV_PANE,           VIRTKEY, SHIFT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "LogView 沥焊"
+FONT 9, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+    ICON            IDR_MAINFRAME,IDC_STATIC,14,14,20,20
+    LTEXT           "LogView, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
+    LTEXT           "Smart Imaging Solutions 2018",IDC_STATIC,42,26,114,8
+    DEFPUSHBUTTON   "犬牢",IDOK,113,41,50,14,WS_GROUP
+END
+
+IDD_LOGVIEW_FORM DIALOGEX 0, 0, 353, 308
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 9, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+    CONTROL         "",IDC_List_Log,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,23,335,278
+    CONTROL         "Auto Scroll",IDC_CHECK_AutoScroll,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,289,9,53,10
+    COMBOBOX        IDC_COMBO_ViewLevel,85,7,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Level :",IDC_STATIC,9,9,74,8
+    PUSHBUTTON      "Map File Save",IDC_Button_MapSave,230,7,50,14
+    COMBOBOX        IDC_COMBO_LogID,170,7,48,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "LogID :",IDC_STATIC,143,9,24,8
+END
+
+IDD_DiaLog_Option DIALOGEX 0, 0, 236, 143
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Setting"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "Apply",IDOK,7,122,133,14
+    PUSHBUTTON      "Cancel",IDCANCEL,147,122,50,14
+    EDITTEXT        IDC_Edit_LogSave_Delay,91,7,93,14,ES_AUTOHSCROLL
+    RTEXT           "Save Log Time : ",IDC_STATIC,8,10,81,8
+    LTEXT           "msec",IDC_STATIC,191,9,17,8
+    EDITTEXT        IDC_Edit_MemoryMapRead_Delay,91,30,93,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_Edit_CommanRead_Delay,91,53,93,14,ES_AUTOHSCROLL
+    RTEXT           "Read Memory Map Time: ",IDC_STATIC,8,33,81,8
+    RTEXT           "Read Command Time : ",IDC_STATIC,8,56,81,8
+    LTEXT           "msec",IDC_STATIC,191,32,17,8
+    LTEXT           "msec",IDC_STATIC,191,55,17,8
+    COMBOBOX        IDC_Combo_OptionSaveLevel,91,76,75,94,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "Save Log Level : ",IDC_STATIC,8,77,81,8
+    EDITTEXT        IDC_Edit_ListPrintCount,91,98,93,14,ES_AUTOHSCROLL
+    RTEXT           "Output List Count : ",IDC_STATIC,8,100,81,8
+    LTEXT           "ea",IDC_STATIC,191,101,9,8
+END
+
+IDD_Path_Setting DIALOGEX 0, 0, 381, 182
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Path Setting"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,324,142,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,324,161,50,14
+    PUSHBUTTON      "Input",IDC_InsertPathData,319,7,55,14
+    CONTROL         "",IDC_PathList,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,303,168
+    PUSHBUTTON      "Delete",IDC_DeletePath,320,26,54,14
+END
+
+IDD_insertPathDlg DIALOGEX 0, 0, 181, 137
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Input Path"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,24,116,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,89,116,50,14
+    EDITTEXT        IDC_LogID,59,24,115,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_LogName,59,46,115,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_LogPath,59,68,115,14,ES_AUTOHSCROLL
+    LTEXT           "Log ID :",IDC_STATIC,13,27,26,8
+    LTEXT           "Log Name :",IDC_STATIC,13,49,37,8
+    LTEXT           "Log Path :",IDC_STATIC,13,71,34,8
+    PUSHBUTTON      "Select Path",IDC_ChoicePath,124,86,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "041203b5"
+        BEGIN
+            VALUE "CompanyName", "D.I.T"
+            VALUE "FileDescription", "LogViewer"
+            VALUE "FileVersion", "1.0.0.1"
+            VALUE "InternalName", "LogView.exe"
+            VALUE "LegalCopyright", "TODO: (c) <雀荤 捞抚>.  All rights reserved."
+            VALUE "OriginalFilename", "LogView.exe"
+            VALUE "ProductName", "LogViewer"
+            VALUE "ProductVersion", "1.0.0.1"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x412, 949
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+    IDD_ABOUTBOX, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 163
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 55
+    END
+
+    IDD_LOGVIEW_FORM, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 342
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 301
+    END
+
+    IDD_DiaLog_Option, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 229
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 136
+    END
+
+    IDD_Path_Setting, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 374
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 175
+    END
+
+    IDD_insertPathDlg, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 174
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 130
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_DiaLog_Option DLGINIT
+BEGIN
+    IDC_Combo_OptionSaveLevel, 0x403, 11, 0
+0x2020, 0x4c20, 0x7665, 0x6c65, 0x3020, "\000" 
+    IDC_Combo_OptionSaveLevel, 0x403, 11, 0
+0x2020, 0x4c20, 0x7665, 0x6c65, 0x3120, "\000" 
+    IDC_Combo_OptionSaveLevel, 0x403, 11, 0
+0x2020, 0x4c20, 0x7665, 0x6c65, 0x3220, "\000" 
+    IDC_Combo_OptionSaveLevel, 0x403, 11, 0
+0x2020, 0x4c20, 0x7665, 0x6c65, 0x3320, "\000" 
+    IDC_Combo_OptionSaveLevel, 0x403, 11, 0
+0x2020, 0x4c20, 0x7665, 0x6c65, 0x3420, "\000" 
+    0
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+    IDP_OLE_INIT_FAILED     "OLE甫 檬扁拳且 荐 绝嚼聪促. OLE 扼捞宏矾府 滚傈捞 棵官弗瘤 犬牢窍绞矫坷."
+END
+
+STRINGTABLE
+BEGIN
+    IDR_MAINFRAME           "LogView\n\nLogView\n\n\nLogView.Document\nLogView.Document"
+END
+
+STRINGTABLE
+BEGIN
+    AFX_IDS_APP_TITLE       "LogView"
+    AFX_IDS_IDLEMESSAGE     "霖厚"
+END
+
+STRINGTABLE
+BEGIN
+    ID_INDICATOR_EXT        "EXT"
+    ID_INDICATOR_CAPS       "CAP"
+    ID_INDICATOR_NUM        "NUM"
+    ID_INDICATOR_SCRL       "SCRL"
+    ID_INDICATOR_OVR        "OVR"
+    ID_INDICATOR_REC        "REC"
+END
+
+STRINGTABLE
+BEGIN
+    ID_FILE_NEW             "货 巩辑甫 父奠聪促.\n货肺 父甸扁"
+    ID_FILE_OPEN            "扁粮 巩辑甫 勘聪促.\n凯扁"
+    ID_FILE_CLOSE           "劝己 巩辑甫 摧嚼聪促.\n摧扁"
+    ID_FILE_SAVE            "劝己 巩辑甫 历厘钦聪促.\n历厘"
+    ID_FILE_SAVE_AS         "劝己 巩辑甫 货 捞抚栏肺 历厘钦聪促.\n促弗 捞抚栏肺 历厘"
+END
+
+STRINGTABLE
+BEGIN
+    ID_APP_ABOUT            "橇肺弊伐 沥焊, 滚傈 锅龋, 历累鼻阑 钎矫钦聪促.\n沥焊"
+    ID_APP_EXIT             "巩辑甫 历厘且瘤甫 汞绊 览侩 橇肺弊伐阑 场忱聪促.\n场郴扁"
+END
+
+STRINGTABLE
+BEGIN
+    ID_FILE_MRU_FILE1       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE2       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE3       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE4       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE5       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE6       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE7       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE8       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE9       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE10      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE11      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE12      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE13      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE14      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE15      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE16      "泅犁 巩辑甫 勘聪促."
+END
+
+STRINGTABLE
+BEGIN
+    ID_NEXT_PANE            "促澜 芒栏肺 傈券钦聪促.\n促澜 芒"
+    ID_PREV_PANE            "捞傈 芒栏肺 傈券钦聪促.\n捞傈 芒"
+END
+
+STRINGTABLE
+BEGIN
+    ID_WINDOW_SPLIT         "劝己 芒阑 咯矾 俺狼 芒栏肺 盒且钦聪促.\n盒且"
+END
+
+STRINGTABLE
+BEGIN
+    ID_EDIT_CLEAR           "急琶 康开阑 瘤矿聪促.\n瘤快扁"
+    ID_EDIT_CLEAR_ALL       "葛滴 瘤矿聪促.\n葛滴 瘤快扁"
+    ID_EDIT_COPY            "急琶 康开阑 汗荤窍咯 努赋焊靛俊 持嚼聪促.\n汗荤"
+    ID_EDIT_CUT             "急琶 康开阑 肋扼郴绢 努赋焊靛俊 持嚼聪促.\n肋扼郴扁"
+    ID_EDIT_FIND            "瘤沥茄 咆胶飘甫 茫嚼聪促.\n茫扁"
+    ID_EDIT_PASTE           "努赋焊靛 郴侩阑 火涝钦聪促.\n嘿咯持扁"
+    ID_EDIT_REPEAT          "付瘤阜 累诀阑 馆汗钦聪促.\n馆汗"
+    ID_EDIT_REPLACE         "漂沥 咆胶飘甫 促弗 咆胶飘肺 官策聪促.\n官操扁"
+    ID_EDIT_SELECT_ALL      "傈眉 巩辑甫 急琶钦聪促.\n葛滴 急琶"
+    ID_EDIT_UNDO            "付瘤阜 累诀 角青阑 秒家钦聪促.\n角青 秒家"
+    ID_EDIT_REDO            "捞傈俊 角青 秒家等 累诀阑 促矫 角青钦聪促.\n促矫 角青"
+END
+
+STRINGTABLE
+BEGIN
+    ID_VIEW_TOOLBAR         "档备 葛澜阑 钎矫窍芭唱 见遍聪促.\n档备 葛澜 汲沥/秦力"
+    ID_VIEW_STATUS_BAR      "惑怕 钎矫临阑 钎矫窍芭唱 见遍聪促.\n惑怕 钎矫临 汲沥/秦力"
+END
+
+STRINGTABLE
+BEGIN
+    AFX_IDS_SCSIZE          "芒 农扁甫 函版钦聪促."
+    AFX_IDS_SCMOVE          "芒 困摹甫 函版钦聪促."
+    AFX_IDS_SCMINIMIZE      "芒阑 酒捞能栏肺 绵家钦聪促."
+    AFX_IDS_SCMAXIMIZE      "芒阑 傈眉 拳搁 农扁肺 犬措钦聪促."
+    AFX_IDS_SCNEXTWINDOW    "促澜 巩辑 芒栏肺 傈券钦聪促."
+    AFX_IDS_SCPREVWINDOW    "捞傈 巩辑 芒栏肺 傈券钦聪促."
+    AFX_IDS_SCCLOSE         "巩辑甫 历厘且 巴牢瘤 犬牢窍绊 劝己 芒阑 摧嚼聪促."
+END
+
+STRINGTABLE
+BEGIN
+    AFX_IDS_SCRESTORE       "芒阑 焊烹 农扁肺 汗盔钦聪促."
+    AFX_IDS_SCTASKLIST      "累诀 格废阑 劝己拳钦聪促."
+END
+
+#endif    // 茄惫绢(措茄刮惫) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// 康绢(固惫) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME           ICON                    "res\\LogViewer.ico"
+#endif    // 康绢(固惫) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE 18, 1
+#pragma code_page(949)
+#include "res\LogView.rc2"  // Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶涝聪促.
+#include "l.KOR\afxres.rc"          // 钎霖 备己 夸家涝聪促.
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/Common_Class/LogView/LogView.vcxproj b/Common_Class/LogView/LogView.vcxproj
new file mode 100644
index 0000000..d909e50
--- /dev/null
+++ b/Common_Class/LogView/LogView.vcxproj
@@ -0,0 +1,326 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Template|Win32">
+      <Configuration>Template</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Template|x64">
+      <Configuration>Template</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}</ProjectGuid>
+    <RootNamespace>LogView</RootNamespace>
+    <Keyword>MFCProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>SharedMapDll.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)\include;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.\Header;..\SharedMapDll\Header</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN64;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <BrowseInformationFile>$(IntDir)</BrowseInformationFile>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <ErrorReporting>Queue</ErrorReporting>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>SharedMapDllD.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX64</TargetMachine>
+      <LinkErrorReporting>QueueForNextLogin</LinkErrorReporting>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+    </Link>
+    <Manifest>
+      <VerboseOutput>true</VerboseOutput>
+    </Manifest>
+    <Bscmake>
+      <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>SharedMapDll.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(SolutionDir)\include;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>.\Header;..\SharedMapDll\Header</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <BrowseInformationFile>$(IntDir)</BrowseInformationFile>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <ErrorReporting>Queue</ErrorReporting>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>SharedMapDll.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX64</TargetMachine>
+      <LinkErrorReporting>QueueForNextLogin</LinkErrorReporting>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+    </Link>
+    <Bscmake>
+      <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'">
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'">
+    <Link>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
+    </Link>
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="InsertPathDlg.cpp" />
+    <ClCompile Include="LogView.cpp" />
+    <ClCompile Include="LogViewDoc.cpp" />
+    <ClCompile Include="LogViewOption.cpp" />
+    <ClCompile Include="LogViewView.cpp" />
+    <ClCompile Include="MainFrm.cpp" />
+    <ClCompile Include="MemoryManager.cpp" />
+    <ClCompile Include="PathData.cpp" />
+    <ClCompile Include="PathSettingDlg.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\InsertPathDlg.h" />
+    <ClInclude Include="Header\LogView.h" />
+    <ClInclude Include="Header\LogViewDoc.h" />
+    <ClInclude Include="Header\LogViewOption.h" />
+    <ClInclude Include="Header\LogViewView.h" />
+    <ClInclude Include="Header\MainFrm.h" />
+    <ClInclude Include="Header\MemoryManager.h" />
+    <ClInclude Include="Header\PathData.h" />
+    <ClInclude Include="Header\PathSettingDlg.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\LogView.ico" />
+    <None Include="res\LogView.rc2" />
+    <None Include="res\LogViewDoc.ico" />
+    <None Include="res\LogViewer.ico" />
+    <None Include="res\Toolbar.bmp" />
+    <None Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="LogView.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\SharedMapDll\SharedMapDll.vcxproj">
+      <Project>{681cb63a-6d15-48c9-9990-8874b881cb8c}</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="LogView.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/LogView/LogView.vcxproj.filters b/Common_Class/LogView/LogView.vcxproj.filters
new file mode 100644
index 0000000..d488927
--- /dev/null
+++ b/Common_Class/LogView/LogView.vcxproj.filters
@@ -0,0 +1,110 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="InsertPathDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="LogView.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="LogViewDoc.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="LogViewOption.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="LogViewView.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="MainFrm.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="MemoryManager.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="PathData.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="PathSettingDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\InsertPathDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\LogView.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\LogViewDoc.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\LogViewOption.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\LogViewView.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\MainFrm.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\MemoryManager.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\PathData.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\PathSettingDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\LogView.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\LogView.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\LogViewDoc.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Toolbar.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="ReadMe.txt" />
+    <None Include="res\LogViewer.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="LogView.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/LogView/LogViewDoc.cpp b/Common_Class/LogView/LogViewDoc.cpp
new file mode 100644
index 0000000..9af4314
--- /dev/null
+++ b/Common_Class/LogView/LogViewDoc.cpp
@@ -0,0 +1,78 @@
+// LogViewDoc.cpp : CLogViewDoc 努贰胶狼 备泅
+//
+
+#include "stdafx.h"
+#include "LogView.h"
+
+#include "LogViewDoc.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CLogViewDoc
+
+IMPLEMENT_DYNCREATE(CLogViewDoc, CDocument)
+
+BEGIN_MESSAGE_MAP(CLogViewDoc, CDocument)
+END_MESSAGE_MAP()
+
+
+// CLogViewDoc 积己/家戈
+
+CLogViewDoc::CLogViewDoc()
+{
+	// TODO: 咯扁俊 老雀己 积己 内靛甫 眠啊钦聪促.
+
+}
+
+CLogViewDoc::~CLogViewDoc()
+{
+}
+
+BOOL CLogViewDoc::OnNewDocument()
+{
+	if (!CDocument::OnNewDocument())
+		return FALSE;
+
+	// TODO: 咯扁俊 犁檬扁拳 内靛甫 眠啊钦聪促.
+	// SDI 巩辑绰 捞 巩辑甫 促矫 荤侩钦聪促.
+
+	return TRUE;
+}
+
+
+
+
+// CLogViewDoc serialization
+
+void CLogViewDoc::Serialize(CArchive& ar)
+{
+	if (ar.IsStoring())
+	{
+		// TODO: 咯扁俊 历厘 内靛甫 眠啊钦聪促.
+	}
+	else
+	{
+		// TODO: 咯扁俊 肺爹 内靛甫 眠啊钦聪促.
+	}
+}
+
+
+// CLogViewDoc 柳窜
+
+#ifdef _DEBUG
+void CLogViewDoc::AssertValid() const
+{
+	CDocument::AssertValid();
+}
+
+void CLogViewDoc::Dump(CDumpContext& dc) const
+{
+	CDocument::Dump(dc);
+}
+#endif //_DEBUG
+
+
+// CLogViewDoc 疙飞
diff --git a/Common_Class/LogView/LogViewOption.cpp b/Common_Class/LogView/LogViewOption.cpp
new file mode 100644
index 0000000..3b44445
--- /dev/null
+++ b/Common_Class/LogView/LogViewOption.cpp
@@ -0,0 +1,44 @@
+// LogViewOption.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "LogView.h"
+#include "LogViewOption.h"
+
+
+// CLogViewOption 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CLogViewOption, CDialog)
+
+CLogViewOption::CLogViewOption(CWnd* pParent /*=NULL*/)
+	: CDialog(CLogViewOption::IDD, pParent)
+	, m_nOptionLogSaveDelay(0)
+	, m_nOptionMemoryMapDelay(0)
+	, m_nOptionCommandReadDelay(0)
+	, m_nOptionLogSaveLevel(0)
+	, m_nOptionListPrintCount(0)
+{
+
+}
+
+CLogViewOption::~CLogViewOption()
+{
+}
+
+void CLogViewOption::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+	DDX_Text(pDX, IDC_Edit_LogSave_Delay, m_nOptionLogSaveDelay);
+	DDX_Text(pDX, IDC_Edit_MemoryMapRead_Delay, m_nOptionMemoryMapDelay);
+	DDX_Text(pDX, IDC_Edit_CommanRead_Delay, m_nOptionCommandReadDelay);
+	DDX_CBIndex(pDX, IDC_Combo_OptionSaveLevel, m_nOptionLogSaveLevel);
+	DDX_Control(pDX, IDC_Combo_OptionSaveLevel, m_ComboOptionSaveLevel);
+	DDX_Text(pDX, IDC_Edit_ListPrintCount, m_nOptionListPrintCount);
+}
+
+
+BEGIN_MESSAGE_MAP(CLogViewOption, CDialog)
+END_MESSAGE_MAP()
+
+
+// CLogViewOption 皋矫瘤 贸府扁涝聪促.
diff --git a/Common_Class/LogView/LogViewView.cpp b/Common_Class/LogView/LogViewView.cpp
new file mode 100644
index 0000000..322d65b
--- /dev/null
+++ b/Common_Class/LogView/LogViewView.cpp
@@ -0,0 +1,788 @@
+// LogViewView.cpp : CLogViewView 努贰胶狼 备泅
+//
+
+#include "stdafx.h"
+#include "LogView.h"
+
+#include "LogViewDoc.h"
+#include "LogViewView.h"
+
+#include "PathData.h"
+#include "LogManager.h"
+#include "MemoryManager.h"
+#include "LogViewOption.h"
+
+#include "PathSettingDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CLogViewView
+
+IMPLEMENT_DYNCREATE(CLogViewView, CFormView)
+
+BEGIN_MESSAGE_MAP(CLogViewView, CFormView)
+	ON_WM_CREATE()
+	ON_WM_DESTROY()
+	ON_WM_TIMER()
+	ON_BN_CLICKED(IDC_CHECK_AutoScroll, &CLogViewView::OnBnClickedCheckAutoscroll)
+	ON_CBN_SELCHANGE(IDC_COMBO_ViewLevel, &CLogViewView::OnCbnSelchangeComboViewlevel)
+	ON_COMMAND(ID_Option_LogSave, &CLogViewView::OnOptionLogsave)
+	ON_BN_CLICKED(IDC_Button_MapSave, &CLogViewView::OnBnClickedButtonMapsave)
+	ON_COMMAND(ID_LogPathSetting, &CLogViewView::OnLogpathsetting)
+	ON_CBN_SELCHANGE(IDC_COMBO_LogID, &CLogViewView::OnCbnSelchangeComboLogid)
+	ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+// CLogViewView 积己/家戈
+
+CLogViewView::CLogViewView()
+	: CFormView(CLogViewView::IDD)
+	, m_bAutoScroll(TRUE)
+	, m_nViewLevel(0)
+	, m_bKillTimer(false)
+	, m_nListPrintCount(100)
+	, m_nViewLogIndex(0)
+	, m_ComboViewLastLogID(0)
+{
+	//糕滚 函荐 檬扁拳
+	m_nIndex = 0;
+	m_nLogSaveDelay = 1000;
+	m_nMemoryMapReadDelay = 10;
+	m_nCommandReadDelay = 1000;
+	m_nProcessID = 0;
+	m_nLogSaveLevel = 4;
+
+	m_pPathData = new CPathData();
+
+	/*for( int i = 0; i < LV_FCOUNT; i++)
+	{
+		m_nLogID[i] = -1;
+		m_strLogPath[i] = _T("");
+		m_strLogName[i] = _T("");
+	}*/
+
+	m_strDefaultPath = _T("");
+}
+
+CLogViewView::~CLogViewView()
+{
+	//肺弊 View 家戈
+	if(m_pLogManager != NULL)
+		delete m_pLogManager;
+	m_pLogManager = NULL;
+
+	if(m_pPathData != NULL)
+		delete m_pPathData;
+	m_pPathData = NULL;
+
+	//肺弊 皋葛府 钮 家戈
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		if(m_pMemoryManager[i] != NULL)
+			delete m_pMemoryManager[i];
+		m_pMemoryManager[i] = NULL;
+	}
+}
+
+// CLogViewView 柳窜
+
+#ifdef _DEBUG
+void CLogViewView::AssertValid() const
+{
+	CFormView::AssertValid();
+}
+
+void CLogViewView::Dump(CDumpContext& dc) const
+{
+	CFormView::Dump(dc);
+}
+
+CLogViewDoc* CLogViewView::GetDocument() const // 叼滚弊登瘤 臼篮 滚傈篮 牢扼牢栏肺 瘤沥邓聪促.
+{
+	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLogViewDoc)));
+	return (CLogViewDoc*)m_pDocument;
+}
+#endif //_DEBUG
+
+
+// CLogViewView 皋矫瘤 贸府扁
+
+int CLogViewView::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CFormView::OnCreate(lpCreateStruct) == -1)
+		return -1;	
+	
+	return 0;
+}
+
+void CLogViewView::OnDestroy()
+{
+	CFormView::OnDestroy();
+
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊钦聪促.
+
+	if( m_hDupCheck != NULL) ::CloseHandle(m_hDupCheck);
+
+	//傍蜡皋葛府甫 佬绢坷绰 鸥捞赣甫 家戈钦聪促.
+	KillTimer(READ_SHAREDMAP);
+
+	//巢酒乐绰 肺弊甫 历厘钦聪促.
+	for( int i = 0; i < LV_FCOUNT; i++)
+		m_pMemoryManager[i]->SaveLog();
+	Sleep(50);
+
+	//肺弊 颇老阑 历厘窍绰 鸥捞赣甫 家戈钦聪促.
+	KillTimer(SAVE_LOGFILE);
+	//目盖靛甫 佬绢坷绰 鸥捞赣甫 家戈钦聪促.
+	KillTimer(READ_COMMAND);
+
+	//SaveOptionFile();
+	SaveINIFile();
+}
+
+void CLogViewView::DoDataExchange(CDataExchange* pDX)
+{
+	CFormView::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_List_Log, m_ListLogViewer);
+	DDX_Check(pDX, IDC_CHECK_AutoScroll, m_bAutoScroll);
+	DDX_CBIndex(pDX, IDC_COMBO_ViewLevel, m_nViewLevel);
+	DDX_Control(pDX, IDC_COMBO_ViewLevel, m_ComboViewLevel);
+	DDX_CBIndex(pDX, IDC_COMBO_LogID, m_nViewLogIndex);
+	DDX_Control(pDX, IDC_COMBO_LogID, m_ComboViewLogID);
+}
+
+BOOL CLogViewView::PreCreateWindow(CREATESTRUCT& cs)
+{
+	// TODO: CREATESTRUCT cs甫 荐沥窍咯 咯扁俊辑
+	//  Window 努贰胶 肚绰 胶鸥老阑 荐沥钦聪促.
+
+	return CFormView::PreCreateWindow(cs);
+}
+
+void CLogViewView::OnInitialUpdate()
+{
+	CFormView::OnInitialUpdate();
+	GetParentFrame()->RecalcLayout();
+	ResizeParentToFit();
+
+	ReadINIFile();
+	
+	//m_strMemoryMap = _T("LOGVIEWER");
+
+	//角青登绊 乐绰 橇肺弊伐捞 乐绰瘤 犬牢窍绊 ProcessID甫 掘绢可聪促.
+	//捞固 角青登绢 乐绰 LogView啊 乐促搁 0,1,2,3.. 鉴辑肺 ProcessID啊 刘啊钦聪促.
+	//GetProcessID绰 捞亥飘 按眉甫 荤侩窍咯 捞固 角青登绢 乐绰 LogView甫 眉农钦聪促.
+	//m_nProcessID = GetProcessID((TCHAR*)(LPCTSTR)MemoryMapName);
+
+	//父老 瘤沥等 角青俺荐甫 檬苞窍搁..
+	//if( m_nProcessID == 0xff)
+//	{
+//		AfxMessageBox(_T("肺弊View甫 2俺 捞惑 角青且 荐 绝嚼聪促."));
+//		PostQuitMessage(0);
+//	}
+
+	if(true  == CheckDup((TCHAR*)(LPCTSTR)m_strMemoryMap))
+	{
+		AfxMessageBox(_T("橇肺弊伐捞 吝汗角青 登菌嚼聪促."));
+		PostQuitMessage(0);
+	}
+
+	m_nProcessID = 0;
+
+	//皋葛府甘 dll甫 荤侩窍扁 困秦辑绰 皋葛府 甘 捞抚捞 鞘夸钦聪促.
+	//佬绢甸捞绰 肺弊甫 佬绰 率狼 LogID绰 亲惑 0涝聪促.
+	m_pLogManager = new CLogManager(0,(TCHAR*)(LPCTSTR)m_strMemoryMap);
+
+	//佬绢柯 肺弊甫 皋葛府俊 历厘窍绰 皋葛府 钮甫 包府窍绰 努贰胶 涝聪促.
+	//LOG_MEMORY_SIZE狼 蔼阑 函版且锭 MemoryManager.h俊 乐绰 TLOGSIZE 蔼档 函版秦具 钦聪促.
+	for(int i = 0; i < LV_FCOUNT; i++)
+		m_pMemoryManager[i] = new CMemoryManager(LOG_MEMORY_COUNT, LOG_MEMORY_SIZE, 
+		m_pPathData->GetIDFromIndex(i),m_pPathData->GetPathFromIndex(i), m_pPathData->GetNameFromIndex(i));
+
+	//府胶飘 牧飘费 檬扁拳
+	if(m_ListLogViewer.GetHeaderCtrl()->GetItemCount() <= 0)
+	{
+		m_ListLogViewer.InsertColumn(0,_T("Level : Index"), LVCFMT_LEFT,100);
+		m_ListLogViewer.InsertColumn(1,_T("LogID"), LVCFMT_LEFT,70);
+		m_ListLogViewer.InsertColumn(2,_T("Time"), LVCFMT_LEFT,100);
+		m_ListLogViewer.InsertColumn(3,_T("Log"), LVCFMT_LEFT,1000);
+	}
+
+	//肺弊 府胶飘俊 饭骇 力茄阑 困秦 霓焊府胶飘俊 巩磊凯阑 眠啊钦聪促.
+	m_ComboViewLevel.AddString(_T("   Level 0"));
+	m_ComboViewLevel.AddString(_T("   Level 1"));
+	m_ComboViewLevel.AddString(_T("   Level 2"));
+	m_ComboViewLevel.AddString(_T("   Level 3"));
+	m_ComboViewLevel.AddString(_T("   Level 4"));
+	
+	CString LogID = _T("");
+	int nLogID = -1;
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		
+		nLogID = m_pPathData->GetIDFromIndex(i);
+		if( nLogID != -1)
+		{
+			LogID = _T("");
+			LogID.Format(_T("%d"), nLogID);
+			m_ComboViewLogID.AddString(LogID);
+		}
+	}
+	m_ComboViewLogID.AddString(_T("葛滴免仿"));
+
+	m_ComboViewLastLogID = m_ComboViewLogID.GetCount();
+	m_ComboViewLastLogID--;
+
+	m_nViewLevel = 4;
+	m_nViewLogIndex = 0;//m_ComboViewLastLogID;
+	UpdateData(false);
+
+	//皋葛府 甘阑 佬绰 鸥捞赣 积己
+	SetTimer(READ_SHAREDMAP,m_nMemoryMapReadDelay,0);
+	//肺弊 颇老阑 历厘窍绰 鸥捞赣 积己
+	SetTimer(SAVE_LOGFILE,m_nLogSaveDelay,0);
+	//目盖靛甫 佬绰 鸥捞赣 积己
+	SetTimer(READ_COMMAND,m_nCommandReadDelay,0);
+	//1老 1雀 茄崔傈 肺弊 昏力
+	SetTimer(DELETE_LOG,86400000,0);
+	UpdateData(false);
+	DeleteLog();	
+}
+
+void CLogViewView::OnTimer(UINT_PTR nIDEvent)
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+
+	if(!m_bKillTimer)
+	{
+		switch(nIDEvent)
+		{
+		case READ_SHAREDMAP:
+			//林扁利栏肺 皋葛府 甘 颇老阑 佬绢可聪促.
+			ReadSharedMemoryMap();
+			break;
+		case SAVE_LOGFILE:
+			//林扁利栏肺 肺弊颇老俊 历厘钦聪促.
+			SaveLogFile();
+			break;
+		case READ_COMMAND:
+			//林扁利栏肺 目盖靛啊 乐绰瘤 犬牢钦聪促.
+			ReadCommand();
+			break;
+		case DELETE_LOG:
+			DeleteLog();
+			break;
+		}
+	}
+
+	CFormView::OnTimer(nIDEvent);
+}
+
+void CLogViewView::ReadSharedMemoryMap(void)
+{
+	static unsigned int CurIndex;
+	static unsigned int ListIndex = 0;
+
+	unsigned int curLevel;
+	int curLogID;
+	unsigned int curProcess;
+	SYSTEMTIME curTime;
+	TCHAR strMessage[LOG_MEMORY_SIZE] = {0};
+
+	CString Temp;
+	bool Result = false;
+
+	CurIndex = m_pLogManager->GetIndex();
+
+	int LogIndex = -1;
+	//40篮 APP啊 促款登菌促啊 促矫 角青瞪锭 0栏肺 檬扁拳 登骨肺
+	//弊 瞒啊 40捞惑捞搁 viewer档 牢郸胶甫 度鞍捞 嘎眠霸 邓聪促.
+	if( (CurIndex - m_nIndex) > 400 )
+		m_nIndex = CurIndex;
+
+	while( m_nIndex < CurIndex)
+	{
+		//m_nListPrintCount篮 茄锅俊 府胶飘俊 免仿窍绰 肮荐甫 唱鸥忱聪促.
+		//m_nListPrintCount俊 瘤沥等 俺荐啊 逞栏搁 府胶飘甫 檬扁拳 钦聪促.
+		if( 0 == ListIndex % m_nListPrintCount)
+		{
+			ListIndex = 0;
+			m_ListLogViewer.DeleteAllItems();
+		}
+
+		m_pLogManager->ReadLog(strMessage, m_nIndex, &curLogID, &curLevel,&curProcess,&curTime);
+
+		LogIndex = m_pPathData->GetIndexFromID(curLogID);
+
+		if(LogIndex == m_nViewLogIndex || m_nViewLogIndex == m_ComboViewLastLogID)
+		{
+			//府胶飘俊 免仿窍绰 肺弊饭骇俊 秦寸窍搁
+			if(curLevel <= m_nViewLevel)
+			{
+				//府胶飘芒俊 肺弊甫 免仿茄促.
+				Temp = _T("");
+				Temp.Format(_T("L%02d:%09d"),curLevel,m_nIndex);
+
+				m_ListLogViewer.InsertItem( ListIndex, Temp, 0);
+
+				Temp = _T("");
+				Temp.Format(_T("%02d"),curLogID);
+
+				m_ListLogViewer.SetItemText( ListIndex, 1, Temp);
+
+				Temp = _T("");
+				Temp.Format(_T("[%02d:%02d:%02d.%03d]"),
+					curTime.wHour,curTime.wMinute,curTime.wSecond,curTime.wMilliseconds);
+
+				m_ListLogViewer.SetItemText( ListIndex, 2, Temp);
+
+				m_ListLogViewer.SetItemText( ListIndex, 3, strMessage);
+
+				//磊悼 胶农费捞 登绢乐促搁..
+				if(m_bAutoScroll)
+				m_ListLogViewer.EnsureVisible(ListIndex,-1);
+				ListIndex++;
+			}
+		}
+
+		//父老 肺弊 颇老俊 历厘且 饭骇俊 秦寸窍搁
+		if(curLevel <= m_nLogSaveLevel)
+		{
+			if(LogIndex >= 0 && LogIndex < LV_FCOUNT )
+			//佬绢柯 肺弊甫 皋葛府俊 历厘窍咯 阶酒初绰促.
+			m_pMemoryManager[LogIndex]->PushLog(strMessage, &m_nIndex,
+									&curLevel, &curProcess, &curTime);
+		}
+
+		m_nIndex++;
+
+	}
+
+}
+
+void CLogViewView::SaveLogFile(void)
+{
+	//钮俊 阶咯乐绰 肺弊甸阑 颇老俊 历厘茄促.
+	for(int i = 0; i < LV_FCOUNT; i++)
+		m_pMemoryManager[i]->SaveLog();
+}
+
+void CLogViewView::ReadCommand(void)
+{
+	static unsigned char Command = 0;
+	//函版等 目盖靛啊 乐绰瘤 眉农茄促.
+	m_pLogManager->GetFirstCommand(&Command);
+	
+	//父老 目盖靛 蔼捞 1捞搁 橇肺弊伐 函荐蔼阑 淬绊 乐绰
+	//甘阑 历厘秦具窃
+	if(Command ==1)
+	{
+		CString Path;
+		//泅犁 橇肺弊伐 角青 版肺甫 舅酒柯促.
+		//甘颇老阑 历厘茄促.
+		m_pLogManager->SaveBinary((TCHAR*)(LPCTSTR)m_strDefaultPath);
+
+		Command = 0;
+		m_pLogManager->SetFirstCommand(0);
+	}
+}
+
+//橇肺弊伐捞 角青登绰 泅犁版肺甫 舅酒坷绰 窃荐
+void CLogViewView::GetModulePath(CString &Temp)
+{
+	TCHAR szBuffer[MAX_PATH];
+	memset(szBuffer,0x00,MAX_PATH*sizeof(TCHAR));
+
+	::GetModuleFileName(NULL,szBuffer,MAX_PATH);
+
+	for(int i = lstrlen(szBuffer) -1; i>=0; --i)
+	{
+		if(szBuffer[i] == '\\')
+		{
+			int j = lstrlen(szBuffer)-1;
+			for(;j>=i;--j)
+			{
+				szBuffer[j] = NULL;
+			}
+
+			if(szBuffer[j] == ';') szBuffer[j+1] = '\\';
+
+			szBuffer[j+1] = '\\';
+
+			Temp = szBuffer;
+			return;
+		}
+	}
+}
+
+void CLogViewView::OnBnClickedCheckAutoscroll()
+{
+	UpdateData();
+}
+
+void CLogViewView::OnCbnSelchangeComboViewlevel()
+{
+	UpdateData();
+	//府胶飘俊 免仿窍绰 肺弊饭骇捞 函斑登搁 弊 蔼阑 啊廉柯促.
+	//m_nViewLevel;
+}
+
+void CLogViewView::OnOptionLogsave()
+{
+	//券版汲沥 皋春甫 急琶窍看阑锭...
+	CLogViewOption LogSaveOption;
+	
+	//捞固 历厘登绢 乐绰 蔼阑 促捞倔肺弊俊 钎矫茄促.
+	LogSaveOption.m_nOptionLogSaveDelay = m_nLogSaveDelay;	//肺弊 历厘 林扁
+	LogSaveOption.m_nOptionCommandReadDelay = m_nCommandReadDelay;	//目盖靛甫 眉农窍绰 林扁
+	LogSaveOption.m_nOptionMemoryMapDelay = m_nMemoryMapReadDelay;	//皋葛府 甘阑 佬绢坷绰 林扁
+	LogSaveOption.m_nOptionLogSaveLevel = m_nLogSaveLevel;			//肺弊甫 历厘窍绰 饭骇
+	LogSaveOption.m_nOptionListPrintCount = m_nListPrintCount;		//府胶飘 免仿 临荐
+
+	INT_PTR nResult = LogSaveOption.DoModal();
+
+	//促捞倔 肺弊俊辑 可记蔼阑 葛滴 历厘窍看阑锭..
+	if(nResult == IDOK)
+	{
+		//促捞倔肺弊俊 历厘等 肺弊历厘 饭骇阑 佬绢柯促.
+		m_nLogSaveLevel = LogSaveOption.m_nOptionLogSaveLevel;
+
+		//促捞倔肺弊俊 历厘等 府胶飘 免仿 临荐甫 啊廉柯促.
+		m_nListPrintCount = LogSaveOption.m_nOptionListPrintCount;
+
+		//父老 扁粮狼 皋葛府 甘 佬绢坷绰 林扁啊 函版登菌促搁..
+		if(m_nMemoryMapReadDelay != LogSaveOption.m_nOptionMemoryMapDelay)
+		{
+			//鸥捞赣甫 磷捞扁 傈俊 焊龋内靛..
+			m_bKillTimer = true;
+			Sleep(10);
+			//鸥捞赣甫 磷捞绊..
+			KillTimer(READ_SHAREDMAP);
+			m_nMemoryMapReadDelay = LogSaveOption.m_nOptionMemoryMapDelay;
+			//货肺 汲沥等 林扁肺 货肺 鸥捞赣甫 积己茄促.
+			SetTimer(READ_SHAREDMAP,m_nMemoryMapReadDelay,0);
+			m_bKillTimer = false;
+		}
+
+		if(m_nCommandReadDelay != LogSaveOption.m_nOptionCommandReadDelay)
+		{
+			//鸥捞赣甫 磷捞扁 傈俊 焊龋内靛..
+			m_bKillTimer = true;
+			Sleep(10);
+			//鸥捞赣甫 磷捞绊..
+			KillTimer(READ_COMMAND);
+			m_nCommandReadDelay = LogSaveOption.m_nOptionCommandReadDelay;
+			//货肺 汲沥等 林扁肺 货肺 鸥捞赣甫 积己茄促.
+			SetTimer(READ_COMMAND,m_nCommandReadDelay,0);
+			m_bKillTimer = false;
+		}
+		
+	
+		if(m_nLogSaveDelay != LogSaveOption.m_nOptionLogSaveDelay)
+		{
+			//鸥捞赣甫 磷捞扁 傈俊 焊龋内靛..
+			m_bKillTimer = true;
+			Sleep(10);
+			//鸥捞赣甫 磷捞绊..
+			KillTimer(SAVE_LOGFILE);
+			m_nLogSaveDelay = LogSaveOption.m_nOptionLogSaveDelay;
+			//货肺 汲沥等 林扁肺 货肺 鸥捞赣甫 积己茄促.
+			SetTimer(SAVE_LOGFILE,m_nLogSaveDelay,0);
+			m_bKillTimer = false;
+		}
+	}
+}
+
+void CLogViewView::ReadINIFile(void)
+{
+
+	CString NameOfINIFile = _T("");
+	CString Path;
+	CString DefaultName = _T("DefaultLog");
+	GetModulePath(Path);
+
+	m_strDefaultPath = Path;
+
+	NameOfINIFile.Format(_T("%sLogView.ini"),Path);
+
+	//券版汲沥俊辑 皋葛府甘阑 佬绢坷绰 林扁蔼阑 阂矾可聪促.
+	m_nMemoryMapReadDelay = GetPrivateProfileInt(_T("SAVE_OPTION"),_T("MEMORYMAP_DERAY"),10,NameOfINIFile);
+	//券版汲沥俊辑 皋葛府甘阑 佬绢坷绰 林扁蔼阑 阂矾可聪促.
+	m_nCommandReadDelay = GetPrivateProfileInt(_T("SAVE_OPTION"),_T("COMMAND_DERAY"),1000,NameOfINIFile);
+	//券版汲沥俊辑 肺弊甫 历厘窍绰 林扁蔼阑 阂矾可聪促.
+	m_nLogSaveDelay = GetPrivateProfileInt(_T("SAVE_OPTION"),_T("LOGSAVE_DERAY"),1000,NameOfINIFile);
+	//券版汲沥俊辑 肺弊甫 历厘窍绰 肺弊饭骇蔼阑 阂矾可聪促.
+	m_nLogSaveLevel = GetPrivateProfileInt(_T("SAVE_OPTION"),_T("LOGSAVE_LEVEL"),4,NameOfINIFile);
+	//券版汲沥俊辑 府胶飘俊 免仿窍绰 俺荐甫 阂矾可聪促.
+	m_nListPrintCount = GetPrivateProfileInt(_T("VIEW_OPTION"),_T("LIST_PRINTCOUNT"),100,NameOfINIFile);
+	//券版汲沥俊辑 府胶飘俊 免仿窍绰 肺弊饭骇蔼阑 阂矾可聪促.
+	m_nViewLevel =  GetPrivateProfileInt(_T("VIEW_OPTION"),_T("LIST_VIEWLEVEL"),4,NameOfINIFile);
+
+	TCHAR LogPath[128] = {0};
+	TCHAR LogName[128] = {0};	
+	CString	TempStr = _T("");
+	CString strLogPath = _T("");
+	CString strLogName = _T("");
+	int LogID = -1;
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		TempStr = _T("");
+		TempStr.Format(_T("LOG_ID%02d"),i);
+		LogID =  GetPrivateProfileInt(_T("SAVE_OPTION"),((LPCTSTR)TempStr),-1,NameOfINIFile);
+
+		TempStr = _T("");
+		TempStr.Format(_T("LOG_PATH%02d"),i);
+		//肺弊 历厘 版肺甫 佬绢柯促.
+		::GetPrivateProfileString(_T("SAVE_OPTION"),((LPCTSTR)TempStr), ((LPCTSTR)Path), (LPWSTR)LogPath,64,((LPCTSTR)NameOfINIFile));
+		strLogPath = _T("");
+		strLogPath.Format(_T("%s"),LogPath);
+
+		TempStr = _T("");
+		TempStr.Format(_T("LOG_Name%02d"),i);
+		//肺弊 历厘 版肺甫 佬绢柯促.
+		::GetPrivateProfileString(_T("SAVE_OPTION"),((LPCTSTR)TempStr), ((LPCTSTR)DefaultName),(LPWSTR)LogName,64,((LPCTSTR)NameOfINIFile));
+		strLogName = _T("");
+		strLogName.Format(_T("%s"),LogName);
+
+		m_pPathData->InsertPathData(LogID, strLogName, strLogPath);
+	}
+
+	TCHAR MemoryMapName[128] = {0};
+	CString DefaultMapName = _T("LOGVIEW");
+	//肺弊 历厘 版肺甫 佬绢柯促.
+	::GetPrivateProfileString(_T("SW_SETTING"),_T("MEMORYMAP_NAME"), ((LPCTSTR)DefaultMapName), MemoryMapName,64,((LPCTSTR)NameOfINIFile));
+	
+	m_strMemoryMap.Format(_T("%s"),MemoryMapName);
+}
+
+void CLogViewView::SaveINIFile(void)
+{
+	CString NameOfINIFile = _T("");
+	CString Path;
+	GetModulePath(Path);
+	NameOfINIFile.Format(_T("%sLogView.ini"),Path);
+
+	WritePrivateProfileString(_T("SW_SETTING"),_T("MEMORYMAP_NAME"), m_strMemoryMap,NameOfINIFile);
+
+	//券版汲沥俊辑 皋葛府甘阑 佬绰 林扁甫 历厘钦聪促.
+	CString ValueOfSetting;
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_nMemoryMapReadDelay);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("MEMORYMAP_DERAY"),ValueOfSetting,NameOfINIFile);
+	
+	//券版汲沥俊辑 目盖靛甫 佬绰 林扁甫 历厘钦聪促.
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_nCommandReadDelay);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("COMMAND_DERAY"),ValueOfSetting,NameOfINIFile);
+	
+	//券版汲沥俊辑 肺弊颇老阑 历厘窍绰 林扁甫 历厘钦聪促.
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_nLogSaveDelay);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("LOGSAVE_DERAY"),ValueOfSetting,NameOfINIFile);
+	
+	//券版汲沥俊辑 肺弊颇老俊 历厘且 肺弊饭骇 蔼阑 历厘钦聪促.
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_nLogSaveLevel);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("LOGSAVE_LEVEL"),ValueOfSetting,NameOfINIFile);
+
+	//券版汲沥俊辑 府胶飘牧飘费俊 免仿窍绰 俺荐甫 历厘钦聪促.
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_nListPrintCount);
+	WritePrivateProfileString(_T("VIEW_OPTION"),_T("LIST_PRINTCOUNT"),ValueOfSetting,NameOfINIFile);
+
+	//券版汲沥俊辑 府胶飘俊 焊咯林绰 肺弊饭骇蔼阑 历厘钦聪促.
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_nViewLevel);
+	WritePrivateProfileString(_T("VIEW_OPTION"),_T("LIST_VIEWLEVEL"),ValueOfSetting,NameOfINIFile);
+
+	CString TempStr;
+	CString strLogPath = _T("");
+	CString strLogName = _T("");
+	int LogID = -1;
+	for( int i = 0; i < LV_FCOUNT; i++)
+	{
+
+		TempStr = _T("");
+		TempStr.Format(_T("LOG_ID%02d"),i);
+	
+		ValueOfSetting = _T("");
+		ValueOfSetting.Format(_T("%d"),m_pPathData->GetIDFromIndex(i));
+		WritePrivateProfileString(_T("SAVE_OPTION"),((LPCTSTR)TempStr),ValueOfSetting,NameOfINIFile);
+
+		TempStr = _T("");
+		TempStr.Format(_T("LOG_PATH%02d"),i);
+		//肺弊颇老 历厘 版肺 汲沥
+		WritePrivateProfileString(_T("SAVE_OPTION"),((LPCTSTR)TempStr), m_pPathData->GetPathFromIndex(i),NameOfINIFile);
+
+		TempStr = _T("");
+		TempStr.Format(_T("LOG_Name%02d"),i);
+		//肺弊颇老 历厘 版肺 汲沥
+		WritePrivateProfileString(_T("SAVE_OPTION"),((LPCTSTR)TempStr), m_pPathData->GetNameFromIndex(i),NameOfINIFile);
+	}
+}
+
+unsigned int CLogViewView::GetProcessID(TCHAR* MemoryMapName)
+{
+	//捞亥飘 按眉甫 捞侩窍咯 悼老茄 傍蜡皋葛府甫 啊柳
+	//橇肺技胶啊 积己登绰 巴阑 规瘤茄促.
+	CString EventName = _T("");
+	unsigned int index = 0;
+
+	//捞亥飘 积己 俺荐绰 10俺 捞郴肺 瘤沥茄促.
+	//for( index = 0; index < 1; index++)
+	{
+		EventName = _T("");
+		//EventName.Format(_T("%sEVENT%02d"),MemoryMapName,index);
+		EventName.Format(_T("%sEVENT"),MemoryMapName);
+
+		m_hDupCheck = ::CreateEvent(NULL, FALSE, FALSE, EventName);
+
+		if(::GetLastError() == ERROR_ALREADY_EXISTS)
+		{
+			//continue;
+			return 0xff;
+		}
+		else
+			return index;
+	}
+	//return 0xff;
+}
+
+//肺弊View俊辑 甘颇老 历厘
+void CLogViewView::OnBnClickedButtonMapsave()
+{
+	m_pLogManager->SaveBinary((TCHAR*)(LPCTSTR)m_strDefaultPath);
+}
+
+
+//茄崔捞 瘤抄 肺弊颇老篮 昏力茄促.
+void CLogViewView::DeleteLog(void)
+{
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+
+	GetDeleteDay(st, 30);
+	//橇肺技胶 酒捞叼客 朝楼狼 炼钦栏肺 肺弊颇老 积己
+	TCHAR strFileName[MAX_PATH];
+
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		memset(strFileName, 0x00, MAX_PATH*sizeof(TCHAR));
+		
+		_stprintf_s(strFileName, _T("%s\\%s%02d_%d%02d%02d.log"), 
+			m_pPathData->GetPathFromIndex(i),m_pPathData->GetNameFromIndex(i), st.wYear, st.wMonth, st.wDay);
+
+		DeleteFile(strFileName);
+	}
+}
+
+void CLogViewView::GetDeleteDay(SYSTEMTIME& Today, DWORD DiffDay)
+{
+	DWORD DeleteDay = SystemToAbsDay(Today);
+	DeleteDay -= DiffDay;
+	
+	AbsDayToSystemTime(DeleteDay, Today);
+}
+
+DWORD CLogViewView::SystemToAbsDay(SYSTEMTIME& st)
+{
+	INT64 i64;
+	FILETIME fst;
+
+	st.wHour = 0;
+	st.wMinute = 0;
+	st.wMilliseconds = 0;
+	st.wSecond = 0;
+	st.wDayOfWeek = 0;
+
+	SystemTimeToFileTime(&st,&fst);
+	i64 = (((INT64)fst.dwHighDateTime) << 32) + fst.dwLowDateTime;
+	i64 = i64/864000000000;
+
+	return (DWORD)i64;
+}
+
+void CLogViewView::AbsDayToSystemTime(DWORD AbsDay, SYSTEMTIME& st)
+{
+	INT64 i64;
+	FILETIME fst;
+	i64 = AbsDay*864000000000;
+	fst.dwHighDateTime = (DWORD)(i64>>32);
+	fst.dwLowDateTime = (DWORD)(i64&0xffffffff);
+	FileTimeToSystemTime(&fst,&st);
+
+}
+
+void CLogViewView::OnLogpathsetting()
+{
+	// TODO: 咯扁俊 疙飞 贸府扁 内靛甫 眠啊钦聪促.
+	/*
+	CString strSelectPath;
+	BROWSEINFO BInfo;
+	TCHAR szBuffer[512];
+	::ZeroMemory(&BInfo, sizeof(BROWSEINFO));
+	::ZeroMemory(szBuffer, 512);
+
+	BInfo.hwndOwner = GetSafeHwnd();
+	BInfo.lpszTitle = _T("包府 弃歹甫 急琶窍技夸.");
+	BInfo.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
+	LPITEMIDLIST pItemidList = ::SHBrowseForFolder(&BInfo);
+	if( pItemidList == NULL)
+		GetModulePath(m_strDefaultPath);
+
+	::SHGetPathFromIDList(pItemidList, szBuffer);
+//	m_strLogPath[0] = szBuffer;
+//	m_strLogPath[0] +=_T("\\");
+*/
+	CPathSettingDlg PathSettingDlg;
+
+	PathSettingDlg.Init(m_pPathData);
+
+	//PathSettingDlg.InitList();
+
+	PathSettingDlg.DoModal();
+
+}
+bool CLogViewView::CheckDup(TCHAR* MemoryMapName)
+{
+	//捞亥飘 按眉甫 捞侩窍咯 悼老茄 傍蜡皋葛府甫 啊柳
+	//橇肺技胶啊 积己登绰 巴阑 规瘤茄促.
+	CString EventName = _T("");
+	unsigned int index = 0;
+
+	EventName = _T("");
+	EventName.Format(_T("%sEVENT"),MemoryMapName);
+
+	m_hDupCheck = ::CreateEvent(NULL, FALSE, FALSE, EventName);
+
+	if(::GetLastError() == ERROR_ALREADY_EXISTS)
+	{
+		//(_T("橇肺弊伐捞 吝汗角青 登菌嚼聪促."));
+		return true;
+	}
+	return false;
+}
+
+void CLogViewView::OnCbnSelchangeComboLogid()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+	UpdateData();
+
+	m_ComboViewLastLogID =	m_ComboViewLogID.GetCount();
+	m_ComboViewLastLogID -= 1;
+}
+
+void CLogViewView::OnSize(UINT nType, int cx, int cy)
+{
+	CFormView::OnSize(nType, cx, cy);
+
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊钦聪促.
+	if(m_ListLogViewer)
+	{
+		m_ListLogViewer.SetWindowPos(NULL, 0, 0, cx - 20, cy - 38, SWP_NOSENDCHANGING |
+			SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
+	}
+}
diff --git a/Common_Class/LogView/MainFrm.cpp b/Common_Class/LogView/MainFrm.cpp
new file mode 100644
index 0000000..da00784
--- /dev/null
+++ b/Common_Class/LogView/MainFrm.cpp
@@ -0,0 +1,212 @@
+// MainFrm.cpp : CMainFrame 努贰胶狼 备泅
+//
+
+#include "stdafx.h"
+#include "LogView.h"
+
+#include "MainFrm.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CMainFrame
+
+IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
+
+BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
+	ON_WM_CREATE()
+	ON_WM_CLOSE()
+	ON_WM_DESTROY()
+	ON_MESSAGE(UM_TRAY, &CMainFrame::OnTray)
+	ON_COMMAND(ID_TRAYMENU_SHOWAPPLICATION, &CMainFrame::OnTraymenuShowapplication)
+	ON_COMMAND(ID_TRAYMENU_EXIT, &CMainFrame::OnTraymenuExit)
+	ON_COMMAND(ID_ViewAlwaysOnTop, &CMainFrame::OnViewalwaysontop)
+END_MESSAGE_MAP()
+
+static UINT indicators[] =
+{
+	ID_SEPARATOR,           // 惑怕 临 钎矫扁
+	ID_INDICATOR_CAPS,
+	ID_INDICATOR_NUM,
+	ID_INDICATOR_SCRL,
+};
+
+
+// CMainFrame 积己/家戈
+
+CMainFrame::CMainFrame()
+{
+	// TODO: 咯扁俊 糕滚 檬扁拳 内靛甫 眠啊钦聪促.
+	m_uShellRestart = ::RegisterWindowMessage(__TEXT("TaskbarCreated"));
+	m_bOnTop = false;
+}
+
+CMainFrame::~CMainFrame()
+{
+}
+
+
+int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
+		return -1;
+	/*
+	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
+		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
+		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
+	{
+		TRACE0("档备 葛澜阑 父甸瘤 给沁嚼聪促.\n");
+		return -1;      // 父甸瘤 给沁嚼聪促.
+	}
+*/
+	if (!m_wndStatusBar.Create(this) ||
+		!m_wndStatusBar.SetIndicators(indicators,
+		  sizeof(indicators)/sizeof(UINT)))
+	{
+		TRACE0("StatusBar Error.\n");
+		return -1;      // 父甸瘤 给沁嚼聪促.
+	}
+
+	// TODO: 档备 葛澜阑 档欧且 荐 绝霸 窍妨搁 捞 技 临阑 昏力窍绞矫坷.
+	/*m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
+	EnableDocking(CBRS_ALIGN_ANY);
+	DockControlBar(&m_wndToolBar);
+*/
+	GoTray();
+	return 0;
+}
+
+BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+	if( !CFrameWnd::PreCreateWindow(cs) )
+		return FALSE;
+	// TODO: CREATESTRUCT cs甫 荐沥窍咯 咯扁俊辑
+	//  Window 努贰胶 肚绰 胶鸥老阑 荐沥钦聪促.
+	cs.style = WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX;
+	cs.lpszName = _T("LogView");
+	return TRUE;
+}
+
+
+// CMainFrame 柳窜
+
+#ifdef _DEBUG
+void CMainFrame::AssertValid() const
+{
+	CFrameWnd::AssertValid();
+}
+
+void CMainFrame::Dump(CDumpContext& dc) const
+{
+	CFrameWnd::Dump(dc);
+}
+
+#endif //_DEBUG
+
+
+// CMainFrame 皋矫瘤 贸府扁
+void CMainFrame::GoTray(void)
+{
+	NOTIFYICONDATA nid;
+	::ZeroMemory(&nid, sizeof(nid));
+	nid.cbSize = sizeof(nid);
+	nid.hWnd = m_hWnd;
+	nid.uID = IDR_MAINFRAME;
+	nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
+	nid.uCallbackMessage = UM_TRAY;
+	nid.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+
+	wsprintf(nid.szTip, _T("%s"),_T("LogViewer"));
+
+	::Shell_NotifyIcon(NIM_ADD, &nid);
+}
+
+void CMainFrame::OnClose()
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+	ShowWindow(SW_HIDE);
+	//CFrameWnd::OnClose();
+}
+
+void CMainFrame::OnDestroy()
+{
+	NOTIFYICONDATA nid;
+	nid.cbSize = sizeof(nid);
+	nid.hWnd = m_hWnd;
+	nid.uID = IDR_MAINFRAME;
+
+	::Shell_NotifyIcon(NIM_DELETE, &nid);
+
+	CFrameWnd::OnDestroy();
+}
+
+LRESULT CMainFrame::OnTray(WPARAM wParam, LPARAM lParam)
+{
+	if(lParam == WM_RBUTTONDOWN)
+	{
+		SetCapture();
+	}
+    else if(lParam == WM_RBUTTONUP)
+    {
+		CMenu menu, *pMenu = NULL;
+		CPoint pt;
+
+		menu.LoadMenu(IDR_Tray);
+		pMenu = menu.GetSubMenu(0);
+
+		GetCursorPos(&pt);
+		SetForegroundWindow();
+		pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,
+								pt.x, pt.y, this);
+		::PostMessage(m_hWnd, WM_NULL, 0, 0);
+
+		ReleaseCapture();
+	}
+	else if(lParam == WM_LBUTTONDBLCLK)
+	{
+		ShowWindow(SW_SHOW);
+		SetForegroundWindow();
+	}
+	return 0;
+}
+void CMainFrame::OnTraymenuShowapplication()
+{
+	// TODO: 咯扁俊 疙飞 贸府扁 内靛甫 眠啊钦聪促.
+	ShowWindow(SW_SHOW);
+}
+
+void CMainFrame::OnTraymenuExit()
+{
+	// TODO: 咯扁俊 疙飞 贸府扁 内靛甫 眠啊钦聪促.
+	CFrameWnd::OnClose();
+}
+
+LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
+{
+	// TODO: 咯扁俊 漂荐拳等 内靛甫 眠啊 棺/肚绰 扁夯 努贰胶甫 龋免钦聪促.
+	if(message == m_uShellRestart)		GoTray();
+	
+	return CFrameWnd::WindowProc(message, wParam, lParam);
+}
+
+void CMainFrame::OnViewalwaysontop()
+{
+	// TODO: 咯扁俊 疙飞 贸府扁 内靛甫 眠啊钦聪促.
+	CMenu *m_pMenu;
+	m_pMenu = this->GetMenu();
+
+	if(m_bOnTop)
+	{
+		m_pMenu->CheckMenuItem(ID_ViewAlwaysOnTop, MF_UNCHECKED);
+		SetWindowPos(&wndNoTopMost,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
+		m_bOnTop = !m_bOnTop;
+	}
+	else
+	{
+		m_pMenu->CheckMenuItem(ID_ViewAlwaysOnTop,MF_CHECKED);
+		SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
+		m_bOnTop = !m_bOnTop;
+	}
+}
diff --git a/Common_Class/LogView/MemoryManager.cpp b/Common_Class/LogView/MemoryManager.cpp
new file mode 100644
index 0000000..0069022
--- /dev/null
+++ b/Common_Class/LogView/MemoryManager.cpp
@@ -0,0 +1,165 @@
+#include "StdAfx.h"
+#include "MemoryManager.h"
+
+CMemoryManager::CMemoryManager(int MaxCount, int LogSize, int LogID, CString strLogPath, CString strLogName)
+{
+	int i = 0;
+	m_LogSize = TLOGSIZE;
+	m_nLogID = LogID;
+
+	//积己磊俊辑 皋葛府甫 且寸窍绊 胶琶俊 拌加 持绰促.
+	//抗 320Byte, 3000俺甫 胶琶俊 涝仿
+	for( i = 0; i < MaxCount; i++)
+	{
+		m_MemoryPool.push(new char[m_LogSize]);
+	}
+
+	//农府萍拿 冀记 按眉 檬扁拳
+	InitializeCriticalSection(&m_csLogFile);
+	InitializeCriticalSection(&m_csMemory);
+
+	//角青颇老 困摹甫 舅酒柯促.
+	m_strPathName = strLogPath;
+	m_strLogName = strLogName;
+	//GetModulePath();
+}
+
+//exe颇老疙阑 力寇茄 弃歹疙阑 舅酒柯促.
+void CMemoryManager::GetModulePath(void)
+{
+	TCHAR szBuffer[MAX_PATH];
+	memset(szBuffer,0x00,MAX_PATH*sizeof(TCHAR));
+
+	::GetModuleFileName(NULL,szBuffer,MAX_PATH);
+
+	for(int i = lstrlen(szBuffer) -1; i>=0; --i)
+	{
+		if(szBuffer[i] == '\\')
+		{
+			int j = lstrlen(szBuffer)-1;
+			for(;j>=i;--j)
+			{
+				szBuffer[j] = NULL;
+			}
+
+			if(szBuffer[j] == ';') szBuffer[j+1] = '\\';
+
+			szBuffer[j+1] = '\\';
+
+			m_strPathName = szBuffer;
+			return;
+		}
+	}
+}
+
+
+CMemoryManager::~CMemoryManager(void)
+{
+	char * pLog = NULL;
+	//皋葛府 Pool 昏力
+	while(!m_MemoryPool.empty())
+	{
+		pLog = m_MemoryPool.top();
+		m_MemoryPool.pop();
+		if ( pLog != NULL)
+			delete pLog;
+		pLog = NULL;
+		
+	}
+
+	//肺弊 钮 昏力
+	while(!m_LogQueue.empty())
+	{
+		pLog = m_LogQueue.front();
+		m_LogQueue.pop();
+		if ( pLog != NULL)
+			delete pLog;
+		pLog = NULL;
+	}
+
+	//农府萍拿 冀记 按眉 昏力
+	DeleteCriticalSection(&m_csLogFile);
+	DeleteCriticalSection(&m_csMemory);
+}
+
+//皋葛府 甘俊辑 肺弊甫 佬绢坷搁 肺弊 钮俊 历厘茄促.
+void CMemoryManager::PushLog(TCHAR* str, unsigned int* curIndex, 
+		unsigned int* curLevel,unsigned int* curProcess, PSYSTEMTIME curTime)
+{
+	
+	EnterCriticalSection(&m_csMemory);
+	//皋葛府 Pool俊辑 荤侩且 皋葛府 窍唱甫 波郴柯促.
+	char* pLog = m_MemoryPool.top();
+	m_MemoryPool.pop();
+
+	//波郴柯 皋葛府甫 檬扁拳 茄促.
+	memset(pLog, 0x00, TLOGSIZE);
+
+	CString		strlog;
+
+	strlog.Format(_T("%08d\t[%02d-%02d/%02d:%02d:%02d.%03d]\t[%02d:L%02d]%s\t\r\n"),
+		*curIndex, curTime->wMonth,curTime->wDay,curTime->wHour,
+		curTime->wMinute,curTime->wSecond,curTime->wMilliseconds,*curProcess,*curLevel,str);
+
+USES_CONVERSION;
+	
+	sprintf_s(pLog,TLOGSIZE,W2A(strlog));
+	//波郴柯 皋葛府俊 痹拜俊 嘎苗 肺弊甫 积己茄促.	
+//	sprintf_s(pLog, TLOGSIZE,_T("%08d\t[%02d-%02d/%02d:%02d:%02d.%03d]\t[%02d:L%02d]%s\t\r\n"),
+//		*curIndex, curTime->wMonth,curTime->wDay,curTime->wHour,
+//		curTime->wMinute,curTime->wSecond,curTime->wMilliseconds,*curProcess,*curLevel,str);
+
+	//叼滚弊 View绰 钢萍官捞飘 某腐磐悸栏肺 悼累茄促.
+	//蜡聪内靛甫 钢萍官捞飘 某腐磐 悸栏肺 函券茄促.
+	//::WideCharToMultiByte(CP_ACP, 0, m_TLog, -1, pLog, TLOGSIZE, NULL, NULL);
+
+	//积己茄 肺弊甫 肺弊钮俊 涝仿茄促.
+	m_LogQueue.push(pLog);
+	
+	LeaveCriticalSection(&m_csMemory);
+}
+
+
+void CMemoryManager::SaveLog()
+{
+	//肺弊钮俊 历厘等 郴侩捞 绝栏搁 府畔
+	if(m_LogQueue.empty()) return;
+
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+
+	//橇肺技胶 酒捞叼客 朝楼狼 炼钦栏肺 肺弊颇老 积己
+	static TCHAR strFileName[MAX_PATH];
+	memset(strFileName, 0x00, MAX_PATH*sizeof(TCHAR));
+	_stprintf_s(strFileName, _T("%s\\%s%02d_%d%02d%02d.log"), m_strPathName, m_strLogName, m_nLogID, st.wYear, st.wMonth, st.wDay);
+
+	DWORD dwWritten;
+	HANDLE hFile;
+
+	EnterCriticalSection(&m_csLogFile);
+	hFile = CreateFile(strFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+	int nFilePointer = SetFilePointer(hFile, 0, NULL, FILE_END);
+
+	EnterCriticalSection(&m_csMemory);
+	char* ptrLog;
+
+	//肺弊钮啊 呼锭鳖瘤 葛滴 肺弊颇老俊 敬促.
+	while(!m_LogQueue.empty())
+	{
+		//肺弊钮俊辑 窍唱 波郴柯促.
+		ptrLog = m_LogQueue.front();
+		
+		//颇老阑 累己茄促.
+		WriteFile(hFile, ptrLog, strlen(ptrLog), &dwWritten, NULL);
+		
+		//累己茄 肺弊绰 力芭茄促.
+		m_LogQueue.pop();
+
+		//荤侩茄 皋葛府绰 促矫 皋葛府 钱俊 持绰促.
+		m_MemoryPool.push(ptrLog);	
+	}
+	
+	LeaveCriticalSection(&m_csMemory);
+	CloseHandle(hFile);
+	LeaveCriticalSection(&m_csLogFile);
+}
diff --git a/Common_Class/LogView/PathData.cpp b/Common_Class/LogView/PathData.cpp
new file mode 100644
index 0000000..de1a8c2
--- /dev/null
+++ b/Common_Class/LogView/PathData.cpp
@@ -0,0 +1,164 @@
+#include "StdAfx.h"
+#include "PathData.h"
+
+CPathData::CPathData(void)
+{
+	//积己磊 檬扁拳
+	InitPathData();
+
+	//叼弃飘 蔼
+	m_strDefaultName = _T("DefaultLog");
+	GetModulePath();
+}
+
+CPathData::~CPathData(void)
+{
+}
+
+CString CPathData::GetNameFromID(int& LogID)
+{
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		if( m_nLogID[i] == LogID)
+			return	m_strLogName[i];
+	}
+	return m_strDefaultName;
+}
+
+CString CPathData::GetPathFromID(int& LogID)
+{
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		if( m_nLogID[i] == LogID)
+			return	m_strLogPath[i];
+	}
+	return m_strDefaultPath;
+}
+
+int CPathData::GetIndexFromID(int& LogID)
+{
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		if( m_nLogID[i] == LogID)
+			return	i;
+	}
+	return -1;
+}
+
+CString CPathData::GetNameFromIndex(int& Index)
+{
+	return m_strLogName[Index];
+}
+
+CString CPathData::GetPathFromIndex(int& Index)
+{
+	return m_strLogPath[Index];
+}
+
+void CPathData::GetModulePath(void)
+{
+	TCHAR szBuffer[MAX_PATH];
+	memset(szBuffer,0x00,MAX_PATH*sizeof(TCHAR));
+
+	::GetModuleFileName(NULL,szBuffer,MAX_PATH);
+
+	for(int i = lstrlen(szBuffer) -1; i>=0; --i)
+	{
+		if(szBuffer[i] == '\\')
+		{
+			int j = lstrlen(szBuffer)-1;
+			for(;j>=i;--j)
+			{
+				szBuffer[j] = NULL;
+			}
+
+			if(szBuffer[j] == ';') szBuffer[j+1] = '\\';
+
+			szBuffer[j+1] = '\\';
+
+			m_strDefaultPath = szBuffer;
+			return;
+		}
+	}
+}
+bool CPathData::InsertPathData(int& LogID, CString& strName, CString& strPath)
+{
+	int InsertIndex = GetEmptyIndex();
+	if( InsertIndex == -1)
+		return false;
+
+	m_nLogID[InsertIndex] = LogID;
+	m_strLogName[InsertIndex] = strName;
+	m_strLogPath[InsertIndex] = strPath;
+	return true;
+}
+
+int CPathData::GetEmptyIndex(void)
+{
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		if( m_nLogID[i] == -1)
+			return	i;
+	}
+	return -1;
+}
+
+bool CPathData::DeletePathData(int& LogID)
+{
+	int InsertIndex = GetIndexFromID(LogID);
+	if( InsertIndex == -1)
+		return false;
+
+	m_nLogID[InsertIndex] = -1;
+	m_strLogName[InsertIndex] = _T("");
+	m_strLogPath[InsertIndex] = _T("");
+	return true;
+}
+
+int CPathData::GetIDFromIndex(int& Index)
+{
+	if(Index < 0 || Index > LV_FCOUNT) return -1;
+	return m_nLogID[Index];
+}
+
+bool CPathData::SetPathData(int& LogID, CString& strName, CString& strPath)
+{
+	int index = GetIndexFromID(LogID);
+	if( index == -1)	return false;
+	SetNameFromIndex(index, strName);
+	SetPathFromIndex(index, strPath);
+
+	return true;
+
+}
+
+bool CPathData::SetNameFromIndex(int& index, CString& PathName)
+{
+	if( index < 0 || index >= LV_FCOUNT)
+		return false;
+	m_strLogName[index] = PathName;
+	return true;
+}
+
+bool CPathData::SetPathFromIndex(int& index, CString& strPath)
+{
+	if( index < 0 || index >= LV_FCOUNT)
+		return false;
+	m_strLogPath[index] = strPath;
+	return true;
+}
+
+bool CPathData::ModifyPathData(int& LogID, CString& strPathName, CString& strLogPath)
+{
+	return SetPathData(LogID, strPathName, strLogPath);
+}
+
+void CPathData::InitPathData(void)
+{
+	for(int i = 0; i < LV_FCOUNT; i++)
+	{
+		m_nLogID[i] = -1;
+		m_strLogPath[i] = _T("");
+		m_strLogName[i] = _T("");
+	}
+}
diff --git a/Common_Class/LogView/PathSettingDlg.cpp b/Common_Class/LogView/PathSettingDlg.cpp
new file mode 100644
index 0000000..42f5df3
--- /dev/null
+++ b/Common_Class/LogView/PathSettingDlg.cpp
@@ -0,0 +1,155 @@
+// PathSettingDlg.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "LogView.h"
+#include "PathSettingDlg.h"
+#include "PathData.h"
+#include "InsertPathDlg.h"
+
+
+// CPathSettingDlg 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CPathSettingDlg, CDialog)
+
+void CPathSettingDlg::Init(CPathData* pPathData)
+{
+	m_pPathData = pPathData;
+
+	//int a =pView->m_nLogID[0];
+}
+
+CPathSettingDlg::CPathSettingDlg(CWnd* pParent /*=NULL*/)
+	: CDialog(CPathSettingDlg::IDD, pParent)
+{
+
+}
+
+CPathSettingDlg::~CPathSettingDlg()
+{
+}
+
+void CPathSettingDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_PathList, m_LogPathList);
+}
+
+
+BEGIN_MESSAGE_MAP(CPathSettingDlg, CDialog)
+	ON_BN_CLICKED(IDC_InsertPathData, &CPathSettingDlg::OnBnClickedInsertpathdata)
+	ON_BN_CLICKED(IDOK, &CPathSettingDlg::OnBnClickedOk)
+	ON_BN_CLICKED(IDC_DeletePath, &CPathSettingDlg::OnBnClickedDeletepath)
+END_MESSAGE_MAP()
+
+
+// CPathSettingDlg 皋矫瘤 贸府扁涝聪促.
+
+void CPathSettingDlg::OnBnClickedInsertpathdata()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+	TCHAR strName[128] = {0};
+	TCHAR strPath[128] = {0};
+	int LogID = -1;
+	CString strLogID = _T("");
+
+	int PathCount = 0;
+
+	CInsertPathDlg InsertDlg;
+
+	InsertDlg.SetRetValue(&LogID,strName,strPath);
+	if(InsertDlg.DoModal() == IDOK)
+	{
+		PathCount = m_LogPathList.GetItemCount();
+		strLogID.Format(_T("%d"),LogID);
+		m_LogPathList.InsertItem(PathCount, strLogID);
+
+		m_LogPathList.SetItemText(PathCount, 1, strName);
+		m_LogPathList.SetItemText(PathCount, 2, strPath);
+	}
+}
+
+void CPathSettingDlg::InitList(void)
+{
+	m_LogPathList.InsertColumn(0, _T("肺弊ID"), 0, 70);
+	m_LogPathList.InsertColumn(1, _T("肺弊 捞抚"), 0, 90);
+	m_LogPathList.InsertColumn(2, _T("瘤沥 弃歹"), 0, 280);
+	m_LogPathList.SetExtendedStyle(LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT);
+
+	int PathCount = 0;
+	int LogID = -1;
+	CString strLogID = _T("");
+	CString strLogName = _T("");
+	CString strLogPath = _T("");
+
+	for( int i = 0; i< LV_FCOUNT; i++)
+	{
+		LogID = m_pPathData->GetIDFromIndex(i);
+		if(LogID == -1)
+			continue;
+
+		strLogID = _T("");
+		strLogID.Format(_T("%d"),LogID);
+
+		m_LogPathList.InsertItem(PathCount, strLogID);
+
+		m_LogPathList.SetItemText(PathCount, 1, m_pPathData->GetNameFromIndex(i));
+		m_LogPathList.SetItemText(PathCount, 2, m_pPathData->GetPathFromIndex(i));
+
+		PathCount++;
+	}
+}
+
+BOOL CPathSettingDlg::OnInitDialog()
+{
+	CDialog::OnInitDialog();
+
+	// TODO:  咯扁俊 眠啊 檬扁拳 累诀阑 眠啊钦聪促.
+	InitList();
+	return TRUE;  // return TRUE unless you set the focus to a control
+	// 抗寇: OCX 加己 其捞瘤绰 FALSE甫 馆券秦具 钦聪促.
+}
+
+void CPathSettingDlg::OnBnClickedOk()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+
+	bool result = false;
+	CString strLogID = _T("");
+	CString strLogName = _T("");
+	CString strLogPath = _T("");
+	int LogID = -1;
+
+	m_pPathData->InitPathData();
+
+	int Count = m_LogPathList.GetItemCount();
+	for( int i = 0; i< Count; i++)
+	{
+		strLogID = m_LogPathList.GetItemText(i, 0);
+		LogID = _ttoi(strLogID);
+		strLogName = m_LogPathList.GetItemText(i, 1);
+		strLogPath = m_LogPathList.GetItemText(i, 2);
+		
+
+		result = m_pPathData->ModifyPathData(LogID,strLogName, strLogPath);
+		if( result == false)
+			m_pPathData->InsertPathData(LogID, strLogName, strLogPath);
+	}
+
+	AfxMessageBox(_T("橇肺弊伐阑 犁啊悼窍搁 函版等 肺弊 汲沥捞 利侩邓聪促."));
+
+	OnOK();
+}
+
+void CPathSettingDlg::OnBnClickedDeletepath()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+	int nSelRow = m_LogPathList.GetSelectionMark();
+	if( nSelRow == -1)
+	{
+		AfxMessageBox(_T("昏力且 亲格阑 急琶窍技夸."));
+		return ;
+	}
+
+	m_LogPathList.DeleteItem(nSelRow);
+}
diff --git a/Common_Class/LogView/ReadMe.txt b/Common_Class/LogView/ReadMe.txt
new file mode 100644
index 0000000..ea979be
--- /dev/null
+++ b/Common_Class/LogView/ReadMe.txt
@@ -0,0 +1,113 @@
+================================================================================
+    MFC 扼捞宏矾府 : LogView 橇肺璃飘 俺夸
+===============================================================================
+
+览侩 橇肺弊伐 付过荤俊辑 捞 LogView 览侩 橇肺弊伐阑 
+父甸菌嚼聪促. 捞 览侩 橇肺弊伐篮 MFC狼 扁夯 荤侩过阑 焊咯 临 挥父 酒聪扼 览侩 橇肺弊伐
+累己阑 困茄 扁夯 备炼甫 力傍钦聪促.
+
+捞 颇老俊绰 LogView 览侩 橇肺弊伐阑 备己窍绰 阿 颇老俊 措茄
+夸距 汲疙捞 器窃登绢 乐嚼聪促.
+
+LogView.vcproj
+    览侩 橇肺弊伐 付过荤甫 荤侩窍咯 积己等 VC++ 橇肺璃飘狼 林 橇肺璃飘 颇老涝聪促. 
+    颇老阑 积己茄 Visual C++ 滚傈俊 措茄 沥焊客 览侩 橇肺弊伐 付过荤甫 荤侩窍咯 急琶茄 
+    敲阀汽, 备己 棺 橇肺璃飘 扁瓷俊 措茄 沥焊啊 甸绢 乐嚼聪促.
+
+LogView.h
+    览侩 橇肺弊伐狼 扁夯 庆歹 颇老涝聪促. 咯扁俊绰 促弗 橇肺璃飘 包访
+    庆歹(Resource.h 器窃)啊 甸绢 乐绊 CLogViewApp 览侩 橇肺弊伐
+    努贰胶甫 急攫钦聪促.
+
+LogView.cpp
+    览侩 橇肺弊伐 努贰胶 CLogViewApp捞(啊) 甸绢 乐绰 扁夯 览侩 橇肺弊伐
+    家胶 颇老涝聪促.
+
+LogView.rc
+    橇肺弊伐俊辑 荤侩窍绰 葛电 Microsoft Windows 府家胶狼 格废涝聪促.
+ 咯扁俊绰 RES 窍困 叼泛磐府俊 历厘等 酒捞能, 厚飘甘 棺 目辑啊
+    器窃邓聪促. 捞 颇老篮 Microsoft Visual C++俊辑 流立
+    祈笼且 荐 乐嚼聪促. 橇肺璃飘 府家胶绰 1042俊 乐嚼聪促.
+
+res\LogView.ico
+    览侩 橇肺弊伐狼 酒捞能栏肺 荤侩登绰 酒捞能 颇老涝聪促. 捞 酒捞能篮
+    林 府家胶 颇老牢 LogView.rc俊 狼秦 器窃邓聪促.
+
+res\LogView.rc2
+    捞 颇老俊绰 Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶啊 
+    甸绢 乐嚼聪促. 府家胶 祈笼扁肺 祈笼且 荐 绝绰 葛电 府家胶绰
+    捞 颇老俊 持绢具 钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
+
+林 橇饭烙 芒狼 版快:
+    橇肺璃飘俊绰 钎霖 MFC 牢磐其捞胶啊 器窃邓聪促.
+
+MainFrm.h, MainFrm.cpp
+    捞 颇老俊绰 橇饭烙 努贰胶 CMainFrame捞(啊) 甸绢 乐嚼聪促.
+    捞 努贰胶绰CFrameWnd俊辑 颇积登哥 葛电 SDI 橇饭烙 扁瓷阑 力绢钦聪促.
+
+res\Toolbar.bmp
+    捞 厚飘甘 颇老篮 档备 葛澜阑 困茄 官迪魄侥 捞固瘤甫 父靛绰 单 荤侩邓聪促.
+    檬扁 档备 葛澜苞 惑怕 钎矫临篮 CMainFrame 努贰胶俊辑 积己邓聪促.
+ 府家胶 祈笼扁甫 荤侩窍咯 捞 档备 葛澜 厚飘甘阑 祈笼窍绊
+    LogView.rc狼 IDR_MAINFRAME TOOLBAR 硅凯阑 诀单捞飘窍咯 档备 葛澜
+    窜眠甫 眠啊钦聪促.
+/////////////////////////////////////////////////////////////////////////////
+
+览侩 橇肺弊伐 付过荤俊辑 窍唱狼 巩辑 屈侥苞 窍唱狼 轰啊 父甸绢笼聪促.
+
+LogViewDoc.h, LogViewDoc.cpp - 巩辑
+    捞 颇老俊绰 CLogViewDoc 努贰胶啊 甸绢 乐嚼聪促. 捞 颇老阑 祈笼窍咯
+    漂荐茄 巩辑 单捞磐甫 眠啊窍绊 CLogViewDoc::Serialize甫 烹秦 颇老
+    历厘 棺 肺靛甫 备泅钦聪促.
+
+LogViewView.h, LogViewView.cpp - 巩辑 轰
+    捞 颇老俊绰 CLogViewView 努贰胶啊 甸绢 乐嚼聪促.
+    CLogViewView 俺眉绰 CLogViewDoc 俺眉甫 焊绰 单 荤侩邓聪促.
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 扁瓷:
+
+ActiveX 牧飘费
+    览侩 橇肺弊伐俊辑 ActiveX 牧飘费阑 荤侩且 荐 乐档废 瘤盔钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 钎霖 颇老:
+
+StdAfx.h, StdAfx.cpp
+    捞 颇老篮 固府 哪颇老等 庆歹 颇老(PCH)牢 LogView.pch客
+    固府 哪颇老等 屈侥 颇老牢 StdAfx.obj甫 呼靛窍绰 单 荤侩邓聪促.
+
+Resource.h
+    货 府家胶 ID甫 沥狼窍绰 钎霖 庆歹 颇老涝聪促.
+    Microsoft Visual C++俊辑 捞 颇老阑 佬绊 诀单捞飘钦聪促.
+
+LogView.manifest
+	览侩 橇肺弊伐 概聪其胶飘 颇老篮 Windows XP俊辑 漂沥 滚傈狼 Side-by-Side 
+	绢祭喉府俊 措茄 览侩 橇肺弊伐 辆加己阑 汲疙窍绰 单 荤侩邓聪促. 肺歹绰 捞 沥焊甫 
+	荤侩窍咯 绢祭喉府 某矫俊辑 利例茄 绢祭喉府甫 肺靛窍芭唱 览侩 橇肺弊伐俊辑 傈侩 
+	绢祭喉府甫 肺靛钦聪促. 览侩 橇肺弊伐 概聪其胶飘绰 览侩 橇肺弊伐 角青 颇老苞 鞍篮 
+	弃歹俊 汲摹等 寇何 .manifest 颇老肺 犁硅器甫 困秦 器窃登芭唱 府家胶狼 屈怕肺 
+	角青 颇老俊 器窃瞪 荐 乐嚼聪促. 
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 曼绊:
+
+览侩 橇肺弊伐 付过荤绰 "TODO:"甫 荤侩窍咯 眠啊窍芭唱 荤侩磊 瘤沥秦具 窍绰
+家胶 内靛 何盒阑 唱鸥忱聪促.
+
+览侩 橇肺弊伐捞 傍蜡 DLL俊辑 MFC甫 荤侩窍绰 版快 秦寸 MFC DLL阑 
+犁硅器秦具 钦聪促. 弊府绊 览侩 橇肺弊伐捞 款康 眉力狼 肺亩苞 
+促弗 攫绢甫 荤侩窍绰 版快 秦寸 瘤开拳等 府家胶牢 MFC90XXX.DLL阑 
+犁硅器秦具 钦聪促. 捞 滴啊瘤 亲格俊 措茄 磊技茄 郴侩篮 
+MSDN 汲疙辑狼 Visual C++ 览侩 橇肺弊伐 犁硅器 亲格阑 
+曼炼窍绞矫坷.
+
+/////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/Common_Class/LogView/res/LogView.ico b/Common_Class/LogView/res/LogView.ico
new file mode 100644
index 0000000..ed76315
--- /dev/null
+++ b/Common_Class/LogView/res/LogView.ico
Binary files differ
diff --git a/Common_Class/LogView/res/LogView.rc2 b/Common_Class/LogView/res/LogView.rc2
new file mode 100644
index 0000000..dc971ad
--- /dev/null
+++ b/Common_Class/LogView/res/LogView.rc2
@@ -0,0 +1,13 @@
+//
+// LogView.RC2 - Microsoft Visual C++俊辑 流立 祈笼窍瘤 臼绰 府家胶
+//
+
+#ifdef APSTUDIO_INVOKED
+#error 捞 颇老篮 Microsoft Visual C++俊辑 祈笼且 荐 绝嚼聪促.
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// 咯扁俊 荐悼栏肺 祈笼茄 府家胶甫 眠啊钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/LogView/res/LogViewDoc.ico b/Common_Class/LogView/res/LogViewDoc.ico
new file mode 100644
index 0000000..2a1f1ae
--- /dev/null
+++ b/Common_Class/LogView/res/LogViewDoc.ico
Binary files differ
diff --git a/Common_Class/LogView/res/LogViewer.ico b/Common_Class/LogView/res/LogViewer.ico
new file mode 100644
index 0000000..2c2d172
--- /dev/null
+++ b/Common_Class/LogView/res/LogViewer.ico
Binary files differ
diff --git a/Common_Class/LogView/res/Toolbar.bmp b/Common_Class/LogView/res/Toolbar.bmp
new file mode 100644
index 0000000..d501723
--- /dev/null
+++ b/Common_Class/LogView/res/Toolbar.bmp
Binary files differ
diff --git a/Common_Class/LogView/resource.h b/Common_Class/LogView/resource.h
new file mode 100644
index 0000000..ce7f8f1
--- /dev/null
+++ b/Common_Class/LogView/resource.h
@@ -0,0 +1,53 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by LogView.rc
+//
+#define IDD_ABOUTBOX                    100
+#define IDP_OLE_INIT_FAILED             100
+#define IDD_LOGVIEW_FORM                101
+#define IDR_MAINFRAME                   128
+#define IDR_LogViewTYPE                 129
+#define IDR_Tray                        130
+#define IDD_DIALOG1                     131
+#define IDD_DiaLog_Option               131
+#define IDD_Path_Setting                132
+#define IDD_insertPathDlg               133
+#define IDI_ICON1                       136
+#define IDC_List_Log                    1000
+#define IDC_CHECK_AutoScroll            1001
+#define IDC_COMBO_ViewLevel             1002
+#define IDC_Edit_LogSave_Delay          1003
+#define IDC_Edit_MemoryMapRead_Delay    1004
+#define IDC_Edit_CommanRead_Delay       1005
+#define IDC_Combo_OptionSaveLevel       1006
+#define IDC_Edit_ListPrintCount         1007
+#define IDC_BUTTON1                     1007
+#define IDC_Button_MapSave              1007
+#define IDC_InsertPathData              1007
+#define IDC_ChoicePath                  1007
+#define IDC_LogID                       1008
+#define IDC_LogName                     1009
+#define IDC_PathList                    1009
+#define IDC_LogPath                     1010
+#define IDC_DeletePath                  1010
+#define IDC_COMBO1                      1011
+#define IDC_COMBO_LogID                 1011
+#define ID_TRAYMENU_SHOWAPPLICATION     32771
+#define ID_TRAYMENU_EXIT                32772
+#define ID_32773                        32773
+#define ID_Option_LogSave               32774
+#define ID_32775                        32775
+#define ID_ViewAlwaysOnTop              32776
+#define ID_32777                        32777
+#define ID_LogPathSetting               32778
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        137
+#define _APS_NEXT_COMMAND_VALUE         32779
+#define _APS_NEXT_CONTROL_VALUE         1012
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif
diff --git a/Common_Class/LogView/stdafx.cpp b/Common_Class/LogView/stdafx.cpp
new file mode 100644
index 0000000..6acf7c5
--- /dev/null
+++ b/Common_Class/LogView/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : 钎霖 器窃 颇老父 甸绢 乐绰 家胶 颇老涝聪促.
+// LogView.pch绰 固府 哪颇老等 庆歹啊 邓聪促.
+// stdafx.obj俊绰 固府 哪颇老等 屈侥 沥焊啊 器窃邓聪促.
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/LogView/stdafx.h b/Common_Class/LogView/stdafx.h
new file mode 100644
index 0000000..2d5ab57
--- /dev/null
+++ b/Common_Class/LogView/stdafx.h
@@ -0,0 +1,58 @@
+// stdafx.h : 磊林 荤侩窍瘤父 磊林 函版登瘤绰 臼绰
+// 钎霖 矫胶袍 器窃 颇老 棺 橇肺璃飘 包访 器窃 颇老捞 
+// 甸绢 乐绰 器窃 颇老涝聪促.
+
+#pragma once
+
+#ifndef _SECURE_ATL
+#define _SECURE_ATL 1
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 芭狼 荤侩登瘤 臼绰 郴侩篮 Windows 庆歹俊辑 力寇钦聪促.
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 老何 CString 积己磊绰 疙矫利栏肺 急攫邓聪促.
+
+// MFC狼 傍烹 何盒苞 公矫 啊瓷茄 版绊 皋矫瘤俊 措茄 见扁扁甫 秦力钦聪促.
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h>         // MFC 琴缴 棺 钎霖 备己 夸家涝聪促.
+#include <afxext.h>         // MFC 犬厘涝聪促.
+
+
+#include <afxdisp.h>        // MFC 磊悼拳 努贰胶涝聪促.
+
+#define LV_FCOUNT 10
+#define LOG_MEMORY_SIZE		1024
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // Internet Explorer 4 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // Windows 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_IA64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+
diff --git a/Common_Class/LogView/targetver.h b/Common_Class/LogView/targetver.h
new file mode 100644
index 0000000..ad5ca61
--- /dev/null
+++ b/Common_Class/LogView/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 器窃 SDKDDKVer.h绰 荤侩 啊瓷茄 Windows 敲阀汽 吝 滚傈捞 啊厘 臭篮 敲阀汽阑 沥狼钦聪促.
+
+// 捞傈 Windows 敲阀汽俊 措秦 览侩 橇肺弊伐阑 呼靛窍妨绰 版快俊绰 SDKDDKVer.h甫 器窃窍扁 傈俊
+// WinSDKVer.h甫 器窃窍绊 _WIN32_WINNT 概农肺甫 瘤盔窍妨绰 敲阀汽栏肺 汲沥窍绞矫坷.
+
+#include <SDKDDKVer.h>
diff --git a/Common_Class/Matrox/Include/MILDyn/PFNC.h b/Common_Class/Matrox/Include/MILDyn/PFNC.h
new file mode 100644
index 0000000..1960d34
--- /dev/null
+++ b/Common_Class/Matrox/Include/MILDyn/PFNC.h
@@ -0,0 +1,1183 @@
+锘�/**************************************************************************************************************
+ * This file was automatically generated by tools designed and maintained by Leutron Vision, Matrox, Groget, MVTec Software.
+ * Copyright (C) 2007-2018 Leutron Vision, Matrox, Groget, MVTec Software.
+ * You can freely use and modify the file without restrictions.
+ * The file is provided as is, without any warranty. Bug reports and other feedback is appreciated.
+ **************************************************************************************************************
+ *
+ * Revision     :  10.41.2936
+ *
+ **************************************************************************************************************
+ * Version and date information:
+ * PFNC value list release date: 2019-02-19
+ * Header generator version: 3.5
+ * Header generation date: 2019-11-07
+ **************************************************************************************************************/
+
+ // ===> Note: unofficial and using a new PFNC_PIXEL_SIZE(X) macro to compensate for bad PFNC R10, G10, B10, R12, G12, B12 values.
+
+#ifndef PFNC_H
+#define PFNC_H
+
+#define PFNC_Mono1p                              0x01010037 /* Monochrome 1-bit packed */
+#define PFNC_Mono2p                              0x01020038 /* Monochrome 2-bit packed */
+#define PFNC_Mono4p                              0x01040039 /* Monochrome 4-bit packed */
+#define PFNC_Mono8                               0x01080001 /* Monochrome 8-bit */
+#define PFNC_Mono8s                              0x01080002 /* Monochrome 8-bit signed */
+#define PFNC_Mono10                              0x01100003 /* Monochrome 10-bit unpacked */
+#define PFNC_Mono10p                             0x010A0046 /* Monochrome 10-bit packed */
+#define PFNC_Mono12                              0x01100005 /* Monochrome 12-bit unpacked */
+#define PFNC_Mono12p                             0x010C0047 /* Monochrome 12-bit packed */
+#define PFNC_Mono14                              0x01100025 /* Monochrome 14-bit unpacked */
+#define PFNC_Mono14p                             0x010E0104 /* Monochrome 14-bit packed */
+#define PFNC_Mono16                              0x01100007 /* Monochrome 16-bit */
+#define PFNC_Mono32                              0x01200111 /* Monochrome 32-bit */
+#define PFNC_BayerBG4p                           0x01040110 /* Bayer Blue-Green 4-bit packed */
+#define PFNC_BayerBG8                            0x0108000B /* Bayer Blue-Green 8-bit */
+#define PFNC_BayerBG10                           0x0110000F /* Bayer Blue-Green 10-bit unpacked */
+#define PFNC_BayerBG10p                          0x010A0052 /* Bayer Blue-Green 10-bit packed */
+#define PFNC_BayerBG12                           0x01100013 /* Bayer Blue-Green 12-bit unpacked */
+#define PFNC_BayerBG12p                          0x010C0053 /* Bayer Blue-Green 12-bit packed */
+#define PFNC_BayerBG14                           0x0110010C /* Bayer Blue-Green 14-bit */
+#define PFNC_BayerBG14p                          0x010E0108 /* Bayer Blue-Green 14-bit packed */
+#define PFNC_BayerBG16                           0x01100031 /* Bayer Blue-Green 16-bit */
+#define PFNC_BayerGB4p                           0x0104010F /* Bayer Green-Blue 4-bit packed */
+#define PFNC_BayerGB8                            0x0108000A /* Bayer Green-Blue 8-bit */
+#define PFNC_BayerGB10                           0x0110000E /* Bayer Green-Blue 10-bit unpacked */
+#define PFNC_BayerGB10p                          0x010A0054 /* Bayer Green-Blue 10-bit packed */
+#define PFNC_BayerGB12                           0x01100012 /* Bayer Green-Blue 12-bit unpacked */
+#define PFNC_BayerGB12p                          0x010C0055 /* Bayer Green-Blue 12-bit packed */
+#define PFNC_BayerGB14                           0x0110010B /* Bayer Green-Blue 14-bit */
+#define PFNC_BayerGB14p                          0x010E0107 /* Bayer Green-Blue 14-bit packed */
+#define PFNC_BayerGB16                           0x01100030 /* Bayer Green-Blue 16-bit */
+#define PFNC_BayerGR4p                           0x0104010D /* Bayer Green-Red 4-bit packed */
+#define PFNC_BayerGR8                            0x01080008 /* Bayer Green-Red 8-bit */
+#define PFNC_BayerGR10                           0x0110000C /* Bayer Green-Red 10-bit unpacked */
+#define PFNC_BayerGR10p                          0x010A0056 /* Bayer Green-Red 10-bit packed */
+#define PFNC_BayerGR12                           0x01100010 /* Bayer Green-Red 12-bit unpacked */
+#define PFNC_BayerGR12p                          0x010C0057 /* Bayer Green-Red 12-bit packed */
+#define PFNC_BayerGR14                           0x01100109 /* Bayer Green-Red 14-bit */
+#define PFNC_BayerGR14p                          0x010E0105 /* Bayer Green-Red 14-bit packed */
+#define PFNC_BayerGR16                           0x0110002E /* Bayer Green-Red 16-bit */
+#define PFNC_BayerRG4p                           0x0104010E /* Bayer Red-Green 4-bit packed */
+#define PFNC_BayerRG8                            0x01080009 /* Bayer Red-Green 8-bit */
+#define PFNC_BayerRG10                           0x0110000D /* Bayer Red-Green 10-bit unpacked */
+#define PFNC_BayerRG10p                          0x010A0058 /* Bayer Red-Green 10-bit packed */
+#define PFNC_BayerRG12                           0x01100011 /* Bayer Red-Green 12-bit unpacked */
+#define PFNC_BayerRG12p                          0x010C0059 /* Bayer Red-Green 12-bit packed */
+#define PFNC_BayerRG14                           0x0110010A /* Bayer Red-Green 14-bit */
+#define PFNC_BayerRG14p                          0x010E0106 /* Bayer Red-Green 14-bit packed */
+#define PFNC_BayerRG16                           0x0110002F /* Bayer Red-Green 16-bit */
+#define PFNC_RGBa8                               0x02200016 /* Red-Green-Blue-alpha 8-bit */
+#define PFNC_RGBa10                              0x0240005F /* Red-Green-Blue-alpha 10-bit unpacked */
+#define PFNC_RGBa10p                             0x02280060 /* Red-Green-Blue-alpha 10-bit packed */
+#define PFNC_RGBa12                              0x02400061 /* Red-Green-Blue-alpha 12-bit unpacked */
+#define PFNC_RGBa12p                             0x02300062 /* Red-Green-Blue-alpha 12-bit packed */
+#define PFNC_RGBa14                              0x02400063 /* Red-Green-Blue-alpha 14-bit unpacked */
+#define PFNC_RGBa16                              0x02400064 /* Red-Green-Blue-alpha 16-bit */
+#define PFNC_RGB8                                0x02180014 /* Red-Green-Blue 8-bit */
+#define PFNC_RGB8_Planar                         0x02180021 /* Red-Green-Blue 8-bit planar */
+#define PFNC_RGB10                               0x02300018 /* Red-Green-Blue 10-bit unpacked */
+#define PFNC_RGB10_Planar                        0x02300022 /* Red-Green-Blue 10-bit unpacked planar */
+#define PFNC_RGB10p                              0x021E005C /* Red-Green-Blue 10-bit packed */
+#define PFNC_RGB10p32                            0x0220001D /* Red-Green-Blue 10-bit packed into 32-bit */
+#define PFNC_RGB12                               0x0230001A /* Red-Green-Blue 12-bit unpacked */
+#define PFNC_RGB12_Planar                        0x02300023 /* Red-Green-Blue 12-bit unpacked planar */
+#define PFNC_RGB12p                              0x0224005D /* Red-Green-Blue 12-bit packed */
+#define PFNC_RGB14                               0x0230005E /* Red-Green-Blue 14-bit unpacked */
+#define PFNC_RGB16                               0x02300033 /* Red-Green-Blue 16-bit */
+#define PFNC_RGB16_Planar                        0x02300024 /* Red-Green-Blue 16-bit planar */
+#define PFNC_RGB565p                             0x02100035 /* Red-Green-Blue 5/6/5-bit packed */
+#define PFNC_BGRa8                               0x02200017 /* Blue-Green-Red-alpha 8-bit */
+#define PFNC_BGRa10                              0x0240004C /* Blue-Green-Red-alpha 10-bit unpacked */
+#define PFNC_BGRa10p                             0x0228004D /* Blue-Green-Red-alpha 10-bit packed */
+#define PFNC_BGRa12                              0x0240004E /* Blue-Green-Red-alpha 12-bit unpacked */
+#define PFNC_BGRa12p                             0x0230004F /* Blue-Green-Red-alpha 12-bit packed */
+#define PFNC_BGRa14                              0x02400050 /* Blue-Green-Red-alpha 14-bit unpacked */
+#define PFNC_BGRa16                              0x02400051 /* Blue-Green-Red-alpha 16-bit */
+#define PFNC_BGR8                                0x02180015 /* Blue-Green-Red 8-bit */
+#define PFNC_BGR10                               0x02300019 /* Blue-Green-Red 10-bit unpacked */
+#define PFNC_BGR10p                              0x021E0048 /* Blue-Green-Red 10-bit packed */
+#define PFNC_BGR12                               0x0230001B /* Blue-Green-Red 12-bit unpacked */
+#define PFNC_BGR12p                              0x02240049 /* Blue-Green-Red 12-bit packed */
+#define PFNC_BGR14                               0x0230004A /* Blue-Green-Red 14-bit unpacked */
+#define PFNC_BGR16                               0x0230004B /* Blue-Green-Red 16-bit */
+#define PFNC_BGR565p                             0x02100036 /* Blue-Green-Red 5/6/5-bit packed */
+#define PFNC_R8                                  0x010800C9 /* Red 8-bit */
+#define PFNC_R10                                 0x010A00CA /* Red 10-bit */
+#define PFNC_R12                                 0x010C00CB /* Red 12-bit */
+#define PFNC_R16                                 0x011000CC /* Red 16-bit */
+#define PFNC_G8                                  0x010800CD /* Green 8-bit */
+#define PFNC_G10                                 0x010A00CE /* Green 10-bit */
+#define PFNC_G12                                 0x010C00CF /* Green 12-bit */
+#define PFNC_G16                                 0x011000D0 /* Green 16-bit */
+#define PFNC_B8                                  0x010800D1 /* Blue 8-bit */
+#define PFNC_B10                                 0x010A00D2 /* Blue 10-bit */
+#define PFNC_B12                                 0x010C00D3 /* Blue 12-bit */
+#define PFNC_B16                                 0x011000D4 /* Blue 16-bit */
+#define PFNC_Coord3D_ABC8                        0x021800B2 /* 3D coordinate A-B-C 8-bit */
+#define PFNC_Coord3D_ABC8_Planar                 0x021800B3 /* 3D coordinate A-B-C 8-bit planar */
+#define PFNC_Coord3D_ABC10p                      0x021E00DB /* 3D coordinate A-B-C 10-bit packed */
+#define PFNC_Coord3D_ABC10p_Planar               0x021E00DC /* 3D coordinate A-B-C 10-bit packed planar */
+#define PFNC_Coord3D_ABC12p                      0x022400DE /* 3D coordinate A-B-C 12-bit packed */
+#define PFNC_Coord3D_ABC12p_Planar               0x022400DF /* 3D coordinate A-B-C 12-bit packed planar */
+#define PFNC_Coord3D_ABC16                       0x023000B9 /* 3D coordinate A-B-C 16-bit */
+#define PFNC_Coord3D_ABC16_Planar                0x023000BA /* 3D coordinate A-B-C 16-bit planar */
+#define PFNC_Coord3D_ABC32f                      0x026000C0 /* 3D coordinate A-B-C 32-bit floating point */
+#define PFNC_Coord3D_ABC32f_Planar               0x026000C1 /* 3D coordinate A-B-C 32-bit floating point planar */
+#define PFNC_Coord3D_AC8                         0x021000B4 /* 3D coordinate A-C 8-bit */
+#define PFNC_Coord3D_AC8_Planar                  0x021000B5 /* 3D coordinate A-C 8-bit planar */
+#define PFNC_Coord3D_AC10p                       0x021400F0 /* 3D coordinate A-C 10-bit packed */
+#define PFNC_Coord3D_AC10p_Planar                0x021400F1 /* 3D coordinate A-C 10-bit packed planar */
+#define PFNC_Coord3D_AC12p                       0x021800F2 /* 3D coordinate A-C 12-bit packed */
+#define PFNC_Coord3D_AC12p_Planar                0x021800F3 /* 3D coordinate A-C 12-bit packed planar */
+#define PFNC_Coord3D_AC16                        0x022000BB /* 3D coordinate A-C 16-bit */
+#define PFNC_Coord3D_AC16_Planar                 0x022000BC /* 3D coordinate A-C 16-bit planar */
+#define PFNC_Coord3D_AC32f                       0x024000C2 /* 3D coordinate A-C 32-bit floating point */
+#define PFNC_Coord3D_AC32f_Planar                0x024000C3 /* 3D coordinate A-C 32-bit floating point planar */
+#define PFNC_Coord3D_A8                          0x010800AF /* 3D coordinate A 8-bit */
+#define PFNC_Coord3D_A10p                        0x010A00D5 /* 3D coordinate A 10-bit packed */
+#define PFNC_Coord3D_A12p                        0x010C00D8 /* 3D coordinate A 12-bit packed */
+#define PFNC_Coord3D_A16                         0x011000B6 /* 3D coordinate A 16-bit */
+#define PFNC_Coord3D_A32f                        0x012000BD /* 3D coordinate A 32-bit floating point */
+#define PFNC_Coord3D_B8                          0x010800B0 /* 3D coordinate B 8-bit */
+#define PFNC_Coord3D_B10p                        0x010A00D6 /* 3D coordinate B 10-bit packed */
+#define PFNC_Coord3D_B12p                        0x010C00D9 /* 3D coordinate B 12-bit packed */
+#define PFNC_Coord3D_B16                         0x011000B7 /* 3D coordinate B 16-bit */
+#define PFNC_Coord3D_B32f                        0x012000BE /* 3D coordinate B 32-bit floating point */
+#define PFNC_Coord3D_C8                          0x010800B1 /* 3D coordinate C 8-bit */
+#define PFNC_Coord3D_C10p                        0x010A00D7 /* 3D coordinate C 10-bit packed */
+#define PFNC_Coord3D_C12p                        0x010C00DA /* 3D coordinate C 12-bit packed */
+#define PFNC_Coord3D_C16                         0x011000B8 /* 3D coordinate C 16-bit */
+#define PFNC_Coord3D_C32f                        0x012000BF /* 3D coordinate C 32-bit floating point */
+#define PFNC_Confidence1                         0x010800C4 /* Confidence 1-bit unpacked */
+#define PFNC_Confidence1p                        0x010100C5 /* Confidence 1-bit packed */
+#define PFNC_Confidence8                         0x010800C6 /* Confidence 8-bit */
+#define PFNC_Confidence16                        0x011000C7 /* Confidence 16-bit */
+#define PFNC_Confidence32f                       0x012000C8 /* Confidence 32-bit floating point */
+#define PFNC_BiColorBGRG8                        0x021000A6 /* Bi-color Blue/Green - Red/Green 8-bit */
+#define PFNC_BiColorBGRG10                       0x022000A9 /* Bi-color Blue/Green - Red/Green 10-bit unpacked */
+#define PFNC_BiColorBGRG10p                      0x021400AA /* Bi-color Blue/Green - Red/Green 10-bit packed */
+#define PFNC_BiColorBGRG12                       0x022000AD /* Bi-color Blue/Green - Red/Green 12-bit unpacked */
+#define PFNC_BiColorBGRG12p                      0x021800AE /* Bi-color Blue/Green - Red/Green 12-bit packed */
+#define PFNC_BiColorRGBG8                        0x021000A5 /* Bi-color Red/Green - Blue/Green 8-bit */
+#define PFNC_BiColorRGBG10                       0x022000A7 /* Bi-color Red/Green - Blue/Green 10-bit unpacked */
+#define PFNC_BiColorRGBG10p                      0x021400A8 /* Bi-color Red/Green - Blue/Green 10-bit packed */
+#define PFNC_BiColorRGBG12                       0x022000AB /* Bi-color Red/Green - Blue/Green 12-bit unpacked */
+#define PFNC_BiColorRGBG12p                      0x021800AC /* Bi-color Red/Green - Blue/Green 12-bit packed */
+#define PFNC_Data8                               0x01080116 /* Data 8-bit */
+#define PFNC_Data8s                              0x01080117 /* Data 8-bit signed */
+#define PFNC_Data16                              0x01100118 /* Data 16-bit */
+#define PFNC_Data16s                             0x01100119 /* Data 16-bit signed */
+#define PFNC_Data32                              0x0120011A /* Data 32-bit */
+#define PFNC_Data32f                             0x0120011C /* Data 32-bit floating point */
+#define PFNC_Data32s                             0x0120011B /* Data 32-bit signed */
+#define PFNC_Data64                              0x0140011D /* Data 64-bit */
+#define PFNC_Data64f                             0x0140011F /* Data 64-bit floating point */
+#define PFNC_Data64s                             0x0140011E /* Data 64-bit signed */
+#define PFNC_SCF1WBWG8                           0x01080067 /* Sparse Color Filter #1 White-Blue-White-Green 8-bit */
+#define PFNC_SCF1WBWG10                          0x01100068 /* Sparse Color Filter #1 White-Blue-White-Green 10-bit unpacked */
+#define PFNC_SCF1WBWG10p                         0x010A0069 /* Sparse Color Filter #1 White-Blue-White-Green 10-bit packed */
+#define PFNC_SCF1WBWG12                          0x0110006A /* Sparse Color Filter #1 White-Blue-White-Green 12-bit unpacked */
+#define PFNC_SCF1WBWG12p                         0x010C006B /* Sparse Color Filter #1 White-Blue-White-Green 12-bit packed */
+#define PFNC_SCF1WBWG14                          0x0110006C /* Sparse Color Filter #1 White-Blue-White-Green 14-bit unpacked */
+#define PFNC_SCF1WBWG16                          0x0110006D /* Sparse Color Filter #1 White-Blue-White-Green 16-bit unpacked */
+#define PFNC_SCF1WGWB8                           0x0108006E /* Sparse Color Filter #1 White-Green-White-Blue 8-bit */
+#define PFNC_SCF1WGWB10                          0x0110006F /* Sparse Color Filter #1 White-Green-White-Blue 10-bit unpacked */
+#define PFNC_SCF1WGWB10p                         0x010A0070 /* Sparse Color Filter #1 White-Green-White-Blue 10-bit packed */
+#define PFNC_SCF1WGWB12                          0x01100071 /* Sparse Color Filter #1 White-Green-White-Blue 12-bit unpacked */
+#define PFNC_SCF1WGWB12p                         0x010C0072 /* Sparse Color Filter #1 White-Green-White-Blue 12-bit packed */
+#define PFNC_SCF1WGWB14                          0x01100073 /* Sparse Color Filter #1 White-Green-White-Blue 14-bit unpacked */
+#define PFNC_SCF1WGWB16                          0x01100074 /* Sparse Color Filter #1 White-Green-White-Blue 16-bit */
+#define PFNC_SCF1WGWR8                           0x01080075 /* Sparse Color Filter #1 White-Green-White-Red 8-bit */
+#define PFNC_SCF1WGWR10                          0x01100076 /* Sparse Color Filter #1 White-Green-White-Red 10-bit unpacked */
+#define PFNC_SCF1WGWR10p                         0x010A0077 /* Sparse Color Filter #1 White-Green-White-Red 10-bit packed */
+#define PFNC_SCF1WGWR12                          0x01100078 /* Sparse Color Filter #1 White-Green-White-Red 12-bit unpacked */
+#define PFNC_SCF1WGWR12p                         0x010C0079 /* Sparse Color Filter #1 White-Green-White-Red 12-bit packed */
+#define PFNC_SCF1WGWR14                          0x0110007A /* Sparse Color Filter #1 White-Green-White-Red 14-bit unpacked */
+#define PFNC_SCF1WGWR16                          0x0110007B /* Sparse Color Filter #1 White-Green-White-Red 16-bit */
+#define PFNC_SCF1WRWG8                           0x0108007C /* Sparse Color Filter #1 White-Red-White-Green 8-bit */
+#define PFNC_SCF1WRWG10                          0x0110007D /* Sparse Color Filter #1 White-Red-White-Green 10-bit unpacked */
+#define PFNC_SCF1WRWG10p                         0x010A007E /* Sparse Color Filter #1 White-Red-White-Green 10-bit packed */
+#define PFNC_SCF1WRWG12                          0x0110007F /* Sparse Color Filter #1 White-Red-White-Green 12-bit unpacked */
+#define PFNC_SCF1WRWG12p                         0x010C0080 /* Sparse Color Filter #1 White-Red-White-Green 12-bit packed */
+#define PFNC_SCF1WRWG14                          0x01100081 /* Sparse Color Filter #1 White-Red-White-Green 14-bit unpacked */
+#define PFNC_SCF1WRWG16                          0x01100082 /* Sparse Color Filter #1 White-Red-White-Green 16-bit */
+#define PFNC_YCbCr8                              0x0218005B /* YCbCr 4:4:4 8-bit */
+#define PFNC_YCbCr8_CbYCr                        0x0218003A /* YCbCr 4:4:4 8-bit */
+#define PFNC_YCbCr10_CbYCr                       0x02300083 /* YCbCr 4:4:4 10-bit unpacked */
+#define PFNC_YCbCr10p_CbYCr                      0x021E0084 /* YCbCr 4:4:4 10-bit packed */
+#define PFNC_YCbCr12_CbYCr                       0x02300085 /* YCbCr 4:4:4 12-bit unpacked */
+#define PFNC_YCbCr12p_CbYCr                      0x02240086 /* YCbCr 4:4:4 12-bit packed */
+#define PFNC_YCbCr411_8                          0x020C005A /* YCbCr 4:1:1 8-bit */
+#define PFNC_YCbCr411_8_CbYYCrYY                 0x020C003C /* YCbCr 4:1:1 8-bit */
+#define PFNC_YCbCr420_8_YY_CbCr_Semiplanar       0x020C0112 /* YCbCr 4:2:0 8-bit YY/CbCr Semiplanar */
+#define PFNC_YCbCr420_8_YY_CrCb_Semiplanar       0x020C0114 /* YCbCr 4:2:0 8-bit YY/CrCb Semiplanar */
+#define PFNC_YCbCr422_8                          0x0210003B /* YCbCr 4:2:2 8-bit */
+#define PFNC_YCbCr422_8_CbYCrY                   0x02100043 /* YCbCr 4:2:2 8-bit */
+#define PFNC_YCbCr422_8_YY_CbCr_Semiplanar       0x02100113 /* YCbCr 4:2:2 8-bit YY/CbCr Semiplanar */
+#define PFNC_YCbCr422_8_YY_CrCb_Semiplanar       0x02100115 /* YCbCr 4:2:2 8-bit YY/CrCb Semiplanar */
+#define PFNC_YCbCr422_10                         0x02200065 /* YCbCr 4:2:2 10-bit unpacked */
+#define PFNC_YCbCr422_10_CbYCrY                  0x02200099 /* YCbCr 4:2:2 10-bit unpacked */
+#define PFNC_YCbCr422_10p                        0x02140087 /* YCbCr 4:2:2 10-bit packed */
+#define PFNC_YCbCr422_10p_CbYCrY                 0x0214009A /* YCbCr 4:2:2 10-bit packed */
+#define PFNC_YCbCr422_12                         0x02200066 /* YCbCr 4:2:2 12-bit unpacked */
+#define PFNC_YCbCr422_12_CbYCrY                  0x0220009B /* YCbCr 4:2:2 12-bit unpacked */
+#define PFNC_YCbCr422_12p                        0x02180088 /* YCbCr 4:2:2 12-bit packed */
+#define PFNC_YCbCr422_12p_CbYCrY                 0x0218009C /* YCbCr 4:2:2 12-bit packed */
+#define PFNC_YCbCr601_8_CbYCr                    0x0218003D /* YCbCr 4:4:4 8-bit BT.601 */
+#define PFNC_YCbCr601_10_CbYCr                   0x02300089 /* YCbCr 4:4:4 10-bit unpacked BT.601 */
+#define PFNC_YCbCr601_10p_CbYCr                  0x021E008A /* YCbCr 4:4:4 10-bit packed BT.601 */
+#define PFNC_YCbCr601_12_CbYCr                   0x0230008B /* YCbCr 4:4:4 12-bit unpacked BT.601 */
+#define PFNC_YCbCr601_12p_CbYCr                  0x0224008C /* YCbCr 4:4:4 12-bit packed BT.601 */
+#define PFNC_YCbCr601_411_8_CbYYCrYY             0x020C003F /* YCbCr 4:1:1 8-bit BT.601 */
+#define PFNC_YCbCr601_422_8                      0x0210003E /* YCbCr 4:2:2 8-bit BT.601 */
+#define PFNC_YCbCr601_422_8_CbYCrY               0x02100044 /* YCbCr 4:2:2 8-bit BT.601 */
+#define PFNC_YCbCr601_422_10                     0x0220008D /* YCbCr 4:2:2 10-bit unpacked BT.601 */
+#define PFNC_YCbCr601_422_10_CbYCrY              0x0220009D /* YCbCr 4:2:2 10-bit unpacked BT.601 */
+#define PFNC_YCbCr601_422_10p                    0x0214008E /* YCbCr 4:2:2 10-bit packed BT.601 */
+#define PFNC_YCbCr601_422_10p_CbYCrY             0x0214009E /* YCbCr 4:2:2 10-bit packed BT.601 */
+#define PFNC_YCbCr601_422_12                     0x0220008F /* YCbCr 4:2:2 12-bit unpacked BT.601 */
+#define PFNC_YCbCr601_422_12_CbYCrY              0x0220009F /* YCbCr 4:2:2 12-bit unpacked BT.601 */
+#define PFNC_YCbCr601_422_12p                    0x02180090 /* YCbCr 4:2:2 12-bit packed BT.601 */
+#define PFNC_YCbCr601_422_12p_CbYCrY             0x021800A0 /* YCbCr 4:2:2 12-bit packed BT.601 */
+#define PFNC_YCbCr709_8_CbYCr                    0x02180040 /* YCbCr 4:4:4 8-bit BT.709 */
+#define PFNC_YCbCr709_10_CbYCr                   0x02300091 /* YCbCr 4:4:4 10-bit unpacked BT.709 */
+#define PFNC_YCbCr709_10p_CbYCr                  0x021E0092 /* YCbCr 4:4:4 10-bit packed BT.709 */
+#define PFNC_YCbCr709_12_CbYCr                   0x02300093 /* YCbCr 4:4:4 12-bit unpacked BT.709 */
+#define PFNC_YCbCr709_12p_CbYCr                  0x02240094 /* YCbCr 4:4:4 12-bit packed BT.709 */
+#define PFNC_YCbCr709_411_8_CbYYCrYY             0x020C0042 /* YCbCr 4:1:1 8-bit BT.709 */
+#define PFNC_YCbCr709_422_8                      0x02100041 /* YCbCr 4:2:2 8-bit BT.709 */
+#define PFNC_YCbCr709_422_8_CbYCrY               0x02100045 /* YCbCr 4:2:2 8-bit BT.709 */
+#define PFNC_YCbCr709_422_10                     0x02200095 /* YCbCr 4:2:2 10-bit unpacked BT.709 */
+#define PFNC_YCbCr709_422_10_CbYCrY              0x022000A1 /* YCbCr 4:2:2 10-bit unpacked BT.709 */
+#define PFNC_YCbCr709_422_10p                    0x02140096 /* YCbCr 4:2:2 10-bit packed BT.709 */
+#define PFNC_YCbCr709_422_10p_CbYCrY             0x021400A2 /* YCbCr 4:2:2 10-bit packed BT.709 */
+#define PFNC_YCbCr709_422_12                     0x02200097 /* YCbCr 4:2:2 12-bit unpacked BT.709 */
+#define PFNC_YCbCr709_422_12_CbYCrY              0x022000A3 /* YCbCr 4:2:2 12-bit unpacked BT.709 */
+#define PFNC_YCbCr709_422_12p                    0x02180098 /* YCbCr 4:2:2 12-bit packed BT.709 */
+#define PFNC_YCbCr709_422_12p_CbYCrY             0x021800A4 /* YCbCr 4:2:2 12-bit packed BT.709 */
+#define PFNC_YCbCr2020_8_CbYCr                   0x021800F4 /* YCbCr 4:4:4 8-bit BT.2020 */
+#define PFNC_YCbCr2020_10_CbYCr                  0x023000F5 /* YCbCr 4:4:4 10-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_10p_CbYCr                 0x021E00F6 /* YCbCr 4:4:4 10-bit packed BT.2020 */
+#define PFNC_YCbCr2020_12_CbYCr                  0x023000F7 /* YCbCr 4:4:4 12-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_12p_CbYCr                 0x022400F8 /* YCbCr 4:4:4 12-bit packed BT.2020 */
+#define PFNC_YCbCr2020_411_8_CbYYCrYY            0x020C00F9 /* YCbCr 4:1:1 8-bit BT.2020 */
+#define PFNC_YCbCr2020_422_8                     0x021000FA /* YCbCr 4:2:2 8-bit BT.2020 */
+#define PFNC_YCbCr2020_422_8_CbYCrY              0x021000FB /* YCbCr 4:2:2 8-bit BT.2020 */
+#define PFNC_YCbCr2020_422_10                    0x022000FC /* YCbCr 4:2:2 10-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_422_10_CbYCrY             0x022000FD /* YCbCr 4:2:2 10-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_422_10p                   0x021400FE /* YCbCr 4:2:2 10-bit packed BT.2020 */
+#define PFNC_YCbCr2020_422_10p_CbYCrY            0x021400FF /* YCbCr 4:2:2 10-bit packed BT.2020 */
+#define PFNC_YCbCr2020_422_12                    0x02200100 /* YCbCr 4:2:2 12-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_422_12_CbYCrY             0x02200101 /* YCbCr 4:2:2 12-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_422_12p                   0x02180102 /* YCbCr 4:2:2 12-bit packed BT.2020 */
+#define PFNC_YCbCr2020_422_12p_CbYCrY            0x02180103 /* YCbCr 4:2:2 12-bit packed BT.2020 */
+#define PFNC_YUV8_UYV                            0x02180020 /* YUV 4:4:4 8-bit */
+#define PFNC_YUV411_8_UYYVYY                     0x020C001E /* YUV 4:1:1 8-bit */
+#define PFNC_YUV422_8                            0x02100032 /* YUV 4:2:2 8-bit */
+#define PFNC_YUV422_8_UYVY                       0x0210001F /* YUV 4:2:2 8-bit */
+
+/* Following formats are not PFNC compliant, but are still kept in the list for legacy purposes. */
+
+#define GVSP_Mono10Packed                        0x010C0004 /* GigE Vision specific format, Monochrome 10-bit packed */
+#define GVSP_Mono12Packed                        0x010C0006 /* GigE Vision specific format, Monochrome 12-bit packed */
+#define GVSP_BayerBG10Packed                     0x010C0029 /* GigE Vision specific format, Bayer Blue-Green 10-bit packed */
+#define GVSP_BayerBG12Packed                     0x010C002D /* GigE Vision specific format, Bayer Blue-Green 12-bit packed */
+#define GVSP_BayerGB10Packed                     0x010C0028 /* GigE Vision specific format, Bayer Green-Blue 10-bit packed */
+#define GVSP_BayerGB12Packed                     0x010C002C /* GigE Vision specific format, Bayer Green-Blue 12-bit packed */
+#define GVSP_BayerGR10Packed                     0x010C0026 /* GigE Vision specific format, Bayer Green-Red 10-bit packed */
+#define GVSP_BayerGR12Packed                     0x010C002A /* GigE Vision specific format, Bayer Green-Red 12-bit packed */
+#define GVSP_BayerRG10Packed                     0x010C0027 /* GigE Vision specific format, Bayer Red-Green 10-bit packed */
+#define GVSP_BayerRG12Packed                     0x010C002B /* GigE Vision specific format, Bayer Red-Green 12-bit packed */
+#define GVSP_RGB10V1Packed                       0x0220001C /* GigE Vision specific format, Red-Green-Blue 10-bit packed - variant 1 */
+#define GVSP_RGB12V1Packed                       0x02240034 /* GigE Vision specific format, Red-Green-Blue 12-bit packed - variant 1 */
+
+
+/* Identical set of formats in the form of an enum */
+
+typedef enum PfncFormat_
+{
+  Mono1p                                   = 0x01010037, /* Monochrome 1-bit packed */
+  Mono2p                                   = 0x01020038, /* Monochrome 2-bit packed */
+  Mono4p                                   = 0x01040039, /* Monochrome 4-bit packed */
+  Mono8                                    = 0x01080001, /* Monochrome 8-bit */
+  Mono8s                                   = 0x01080002, /* Monochrome 8-bit signed */
+  Mono10                                   = 0x01100003, /* Monochrome 10-bit unpacked */
+  Mono10p                                  = 0x010A0046, /* Monochrome 10-bit packed */
+  Mono12                                   = 0x01100005, /* Monochrome 12-bit unpacked */
+  Mono12p                                  = 0x010C0047, /* Monochrome 12-bit packed */
+  Mono14                                   = 0x01100025, /* Monochrome 14-bit unpacked */
+  Mono14p                                  = 0x010E0104, /* Monochrome 14-bit packed */
+  Mono16                                   = 0x01100007, /* Monochrome 16-bit */
+  Mono32                                   = 0x01200111, /* Monochrome 32-bit */
+  BayerBG4p                                = 0x01040110, /* Bayer Blue-Green 4-bit packed */
+  BayerBG8                                 = 0x0108000B, /* Bayer Blue-Green 8-bit */
+  BayerBG10                                = 0x0110000F, /* Bayer Blue-Green 10-bit unpacked */
+  BayerBG10p                               = 0x010A0052, /* Bayer Blue-Green 10-bit packed */
+  BayerBG12                                = 0x01100013, /* Bayer Blue-Green 12-bit unpacked */
+  BayerBG12p                               = 0x010C0053, /* Bayer Blue-Green 12-bit packed */
+  BayerBG14                                = 0x0110010C, /* Bayer Blue-Green 14-bit */
+  BayerBG14p                               = 0x010E0108, /* Bayer Blue-Green 14-bit packed */
+  BayerBG16                                = 0x01100031, /* Bayer Blue-Green 16-bit */
+  BayerGB4p                                = 0x0104010F, /* Bayer Green-Blue 4-bit packed */
+  BayerGB8                                 = 0x0108000A, /* Bayer Green-Blue 8-bit */
+  BayerGB10                                = 0x0110000E, /* Bayer Green-Blue 10-bit unpacked */
+  BayerGB10p                               = 0x010A0054, /* Bayer Green-Blue 10-bit packed */
+  BayerGB12                                = 0x01100012, /* Bayer Green-Blue 12-bit unpacked */
+  BayerGB12p                               = 0x010C0055, /* Bayer Green-Blue 12-bit packed */
+  BayerGB14                                = 0x0110010B, /* Bayer Green-Blue 14-bit */
+  BayerGB14p                               = 0x010E0107, /* Bayer Green-Blue 14-bit packed */
+  BayerGB16                                = 0x01100030, /* Bayer Green-Blue 16-bit */
+  BayerGR4p                                = 0x0104010D, /* Bayer Green-Red 4-bit packed */
+  BayerGR8                                 = 0x01080008, /* Bayer Green-Red 8-bit */
+  BayerGR10                                = 0x0110000C, /* Bayer Green-Red 10-bit unpacked */
+  BayerGR10p                               = 0x010A0056, /* Bayer Green-Red 10-bit packed */
+  BayerGR12                                = 0x01100010, /* Bayer Green-Red 12-bit unpacked */
+  BayerGR12p                               = 0x010C0057, /* Bayer Green-Red 12-bit packed */
+  BayerGR14                                = 0x01100109, /* Bayer Green-Red 14-bit */
+  BayerGR14p                               = 0x010E0105, /* Bayer Green-Red 14-bit packed */
+  BayerGR16                                = 0x0110002E, /* Bayer Green-Red 16-bit */
+  BayerRG4p                                = 0x0104010E, /* Bayer Red-Green 4-bit packed */
+  BayerRG8                                 = 0x01080009, /* Bayer Red-Green 8-bit */
+  BayerRG10                                = 0x0110000D, /* Bayer Red-Green 10-bit unpacked */
+  BayerRG10p                               = 0x010A0058, /* Bayer Red-Green 10-bit packed */
+  BayerRG12                                = 0x01100011, /* Bayer Red-Green 12-bit unpacked */
+  BayerRG12p                               = 0x010C0059, /* Bayer Red-Green 12-bit packed */
+  BayerRG14                                = 0x0110010A, /* Bayer Red-Green 14-bit */
+  BayerRG14p                               = 0x010E0106, /* Bayer Red-Green 14-bit packed */
+  BayerRG16                                = 0x0110002F, /* Bayer Red-Green 16-bit */
+  RGBa8                                    = 0x02200016, /* Red-Green-Blue-alpha 8-bit */
+  RGBa10                                   = 0x0240005F, /* Red-Green-Blue-alpha 10-bit unpacked */
+  RGBa10p                                  = 0x02280060, /* Red-Green-Blue-alpha 10-bit packed */
+  RGBa12                                   = 0x02400061, /* Red-Green-Blue-alpha 12-bit unpacked */
+  RGBa12p                                  = 0x02300062, /* Red-Green-Blue-alpha 12-bit packed */
+  RGBa14                                   = 0x02400063, /* Red-Green-Blue-alpha 14-bit unpacked */
+  RGBa16                                   = 0x02400064, /* Red-Green-Blue-alpha 16-bit */
+  RGB8                                     = 0x02180014, /* Red-Green-Blue 8-bit */
+  RGB8_Planar                              = 0x02180021, /* Red-Green-Blue 8-bit planar */
+  RGB10                                    = 0x02300018, /* Red-Green-Blue 10-bit unpacked */
+  RGB10_Planar                             = 0x02300022, /* Red-Green-Blue 10-bit unpacked planar */
+  RGB10p                                   = 0x021E005C, /* Red-Green-Blue 10-bit packed */
+  RGB10p32                                 = 0x0220001D, /* Red-Green-Blue 10-bit packed into 32-bit */
+  RGB12                                    = 0x0230001A, /* Red-Green-Blue 12-bit unpacked */
+  RGB12_Planar                             = 0x02300023, /* Red-Green-Blue 12-bit unpacked planar */
+  RGB12p                                   = 0x0224005D, /* Red-Green-Blue 12-bit packed */
+  RGB14                                    = 0x0230005E, /* Red-Green-Blue 14-bit unpacked */
+  RGB16                                    = 0x02300033, /* Red-Green-Blue 16-bit */
+  RGB16_Planar                             = 0x02300024, /* Red-Green-Blue 16-bit planar */
+  RGB565p                                  = 0x02100035, /* Red-Green-Blue 5/6/5-bit packed */
+  BGRa8                                    = 0x02200017, /* Blue-Green-Red-alpha 8-bit */
+  BGRa10                                   = 0x0240004C, /* Blue-Green-Red-alpha 10-bit unpacked */
+  BGRa10p                                  = 0x0228004D, /* Blue-Green-Red-alpha 10-bit packed */
+  BGRa12                                   = 0x0240004E, /* Blue-Green-Red-alpha 12-bit unpacked */
+  BGRa12p                                  = 0x0230004F, /* Blue-Green-Red-alpha 12-bit packed */
+  BGRa14                                   = 0x02400050, /* Blue-Green-Red-alpha 14-bit unpacked */
+  BGRa16                                   = 0x02400051, /* Blue-Green-Red-alpha 16-bit */
+  BGR8                                     = 0x02180015, /* Blue-Green-Red 8-bit */
+  BGR10                                    = 0x02300019, /* Blue-Green-Red 10-bit unpacked */
+  BGR10p                                   = 0x021E0048, /* Blue-Green-Red 10-bit packed */
+  BGR12                                    = 0x0230001B, /* Blue-Green-Red 12-bit unpacked */
+  BGR12p                                   = 0x02240049, /* Blue-Green-Red 12-bit packed */
+  BGR14                                    = 0x0230004A, /* Blue-Green-Red 14-bit unpacked */
+  BGR16                                    = 0x0230004B, /* Blue-Green-Red 16-bit */
+  BGR565p                                  = 0x02100036, /* Blue-Green-Red 5/6/5-bit packed */
+  R8                                       = 0x010800C9, /* Red 8-bit */
+  R10                                      = 0x010A00CA, /* Red 10-bit */
+  R12                                      = 0x010C00CB, /* Red 12-bit */
+  R16                                      = 0x011000CC, /* Red 16-bit */
+  G8                                       = 0x010800CD, /* Green 8-bit */
+  G10                                      = 0x010A00CE, /* Green 10-bit */
+  G12                                      = 0x010C00CF, /* Green 12-bit */
+  G16                                      = 0x011000D0, /* Green 16-bit */
+  B8                                       = 0x010800D1, /* Blue 8-bit */
+  B10                                      = 0x010A00D2, /* Blue 10-bit */
+  B12                                      = 0x010C00D3, /* Blue 12-bit */
+  B16                                      = 0x011000D4, /* Blue 16-bit */
+  Coord3D_ABC8                             = 0x021800B2, /* 3D coordinate A-B-C 8-bit */
+  Coord3D_ABC8_Planar                      = 0x021800B3, /* 3D coordinate A-B-C 8-bit planar */
+  Coord3D_ABC10p                           = 0x021E00DB, /* 3D coordinate A-B-C 10-bit packed */
+  Coord3D_ABC10p_Planar                    = 0x021E00DC, /* 3D coordinate A-B-C 10-bit packed planar */
+  Coord3D_ABC12p                           = 0x022400DE, /* 3D coordinate A-B-C 12-bit packed */
+  Coord3D_ABC12p_Planar                    = 0x022400DF, /* 3D coordinate A-B-C 12-bit packed planar */
+  Coord3D_ABC16                            = 0x023000B9, /* 3D coordinate A-B-C 16-bit */
+  Coord3D_ABC16_Planar                     = 0x023000BA, /* 3D coordinate A-B-C 16-bit planar */
+  Coord3D_ABC32f                           = 0x026000C0, /* 3D coordinate A-B-C 32-bit floating point */
+  Coord3D_ABC32f_Planar                    = 0x026000C1, /* 3D coordinate A-B-C 32-bit floating point planar */
+  Coord3D_AC8                              = 0x021000B4, /* 3D coordinate A-C 8-bit */
+  Coord3D_AC8_Planar                       = 0x021000B5, /* 3D coordinate A-C 8-bit planar */
+  Coord3D_AC10p                            = 0x021400F0, /* 3D coordinate A-C 10-bit packed */
+  Coord3D_AC10p_Planar                     = 0x021400F1, /* 3D coordinate A-C 10-bit packed planar */
+  Coord3D_AC12p                            = 0x021800F2, /* 3D coordinate A-C 12-bit packed */
+  Coord3D_AC12p_Planar                     = 0x021800F3, /* 3D coordinate A-C 12-bit packed planar */
+  Coord3D_AC16                             = 0x022000BB, /* 3D coordinate A-C 16-bit */
+  Coord3D_AC16_Planar                      = 0x022000BC, /* 3D coordinate A-C 16-bit planar */
+  Coord3D_AC32f                            = 0x024000C2, /* 3D coordinate A-C 32-bit floating point */
+  Coord3D_AC32f_Planar                     = 0x024000C3, /* 3D coordinate A-C 32-bit floating point planar */
+  Coord3D_A8                               = 0x010800AF, /* 3D coordinate A 8-bit */
+  Coord3D_A10p                             = 0x010A00D5, /* 3D coordinate A 10-bit packed */
+  Coord3D_A12p                             = 0x010C00D8, /* 3D coordinate A 12-bit packed */
+  Coord3D_A16                              = 0x011000B6, /* 3D coordinate A 16-bit */
+  Coord3D_A32f                             = 0x012000BD, /* 3D coordinate A 32-bit floating point */
+  Coord3D_B8                               = 0x010800B0, /* 3D coordinate B 8-bit */
+  Coord3D_B10p                             = 0x010A00D6, /* 3D coordinate B 10-bit packed */
+  Coord3D_B12p                             = 0x010C00D9, /* 3D coordinate B 12-bit packed */
+  Coord3D_B16                              = 0x011000B7, /* 3D coordinate B 16-bit */
+  Coord3D_B32f                             = 0x012000BE, /* 3D coordinate B 32-bit floating point */
+  Coord3D_C8                               = 0x010800B1, /* 3D coordinate C 8-bit */
+  Coord3D_C10p                             = 0x010A00D7, /* 3D coordinate C 10-bit packed */
+  Coord3D_C12p                             = 0x010C00DA, /* 3D coordinate C 12-bit packed */
+  Coord3D_C16                              = 0x011000B8, /* 3D coordinate C 16-bit */
+  Coord3D_C32f                             = 0x012000BF, /* 3D coordinate C 32-bit floating point */
+  Confidence1                              = 0x010800C4, /* Confidence 1-bit unpacked */
+  Confidence1p                             = 0x010100C5, /* Confidence 1-bit packed */
+  Confidence8                              = 0x010800C6, /* Confidence 8-bit */
+  Confidence16                             = 0x011000C7, /* Confidence 16-bit */
+  Confidence32f                            = 0x012000C8, /* Confidence 32-bit floating point */
+  BiColorBGRG8                             = 0x021000A6, /* Bi-color Blue/Green - Red/Green 8-bit */
+  BiColorBGRG10                            = 0x022000A9, /* Bi-color Blue/Green - Red/Green 10-bit unpacked */
+  BiColorBGRG10p                           = 0x021400AA, /* Bi-color Blue/Green - Red/Green 10-bit packed */
+  BiColorBGRG12                            = 0x022000AD, /* Bi-color Blue/Green - Red/Green 12-bit unpacked */
+  BiColorBGRG12p                           = 0x021800AE, /* Bi-color Blue/Green - Red/Green 12-bit packed */
+  BiColorRGBG8                             = 0x021000A5, /* Bi-color Red/Green - Blue/Green 8-bit */
+  BiColorRGBG10                            = 0x022000A7, /* Bi-color Red/Green - Blue/Green 10-bit unpacked */
+  BiColorRGBG10p                           = 0x021400A8, /* Bi-color Red/Green - Blue/Green 10-bit packed */
+  BiColorRGBG12                            = 0x022000AB, /* Bi-color Red/Green - Blue/Green 12-bit unpacked */
+  BiColorRGBG12p                           = 0x021800AC, /* Bi-color Red/Green - Blue/Green 12-bit packed */
+  Data8                                    = 0x01080116, /* Data 8-bit */
+  Data8s                                   = 0x01080117, /* Data 8-bit signed */
+  Data16                                   = 0x01100118, /* Data 16-bit */
+  Data16s                                  = 0x01100119, /* Data 16-bit signed */
+  Data32                                   = 0x0120011A, /* Data 32-bit */
+  Data32f                                  = 0x0120011C, /* Data 32-bit floating point */
+  Data32s                                  = 0x0120011B, /* Data 32-bit signed */
+  Data64                                   = 0x0140011D, /* Data 64-bit */
+  Data64f                                  = 0x0140011F, /* Data 64-bit floating point */
+  Data64s                                  = 0x0140011E, /* Data 64-bit signed */
+  SCF1WBWG8                                = 0x01080067, /* Sparse Color Filter #1 White-Blue-White-Green 8-bit */
+  SCF1WBWG10                               = 0x01100068, /* Sparse Color Filter #1 White-Blue-White-Green 10-bit unpacked */
+  SCF1WBWG10p                              = 0x010A0069, /* Sparse Color Filter #1 White-Blue-White-Green 10-bit packed */
+  SCF1WBWG12                               = 0x0110006A, /* Sparse Color Filter #1 White-Blue-White-Green 12-bit unpacked */
+  SCF1WBWG12p                              = 0x010C006B, /* Sparse Color Filter #1 White-Blue-White-Green 12-bit packed */
+  SCF1WBWG14                               = 0x0110006C, /* Sparse Color Filter #1 White-Blue-White-Green 14-bit unpacked */
+  SCF1WBWG16                               = 0x0110006D, /* Sparse Color Filter #1 White-Blue-White-Green 16-bit unpacked */
+  SCF1WGWB8                                = 0x0108006E, /* Sparse Color Filter #1 White-Green-White-Blue 8-bit */
+  SCF1WGWB10                               = 0x0110006F, /* Sparse Color Filter #1 White-Green-White-Blue 10-bit unpacked */
+  SCF1WGWB10p                              = 0x010A0070, /* Sparse Color Filter #1 White-Green-White-Blue 10-bit packed */
+  SCF1WGWB12                               = 0x01100071, /* Sparse Color Filter #1 White-Green-White-Blue 12-bit unpacked */
+  SCF1WGWB12p                              = 0x010C0072, /* Sparse Color Filter #1 White-Green-White-Blue 12-bit packed */
+  SCF1WGWB14                               = 0x01100073, /* Sparse Color Filter #1 White-Green-White-Blue 14-bit unpacked */
+  SCF1WGWB16                               = 0x01100074, /* Sparse Color Filter #1 White-Green-White-Blue 16-bit */
+  SCF1WGWR8                                = 0x01080075, /* Sparse Color Filter #1 White-Green-White-Red 8-bit */
+  SCF1WGWR10                               = 0x01100076, /* Sparse Color Filter #1 White-Green-White-Red 10-bit unpacked */
+  SCF1WGWR10p                              = 0x010A0077, /* Sparse Color Filter #1 White-Green-White-Red 10-bit packed */
+  SCF1WGWR12                               = 0x01100078, /* Sparse Color Filter #1 White-Green-White-Red 12-bit unpacked */
+  SCF1WGWR12p                              = 0x010C0079, /* Sparse Color Filter #1 White-Green-White-Red 12-bit packed */
+  SCF1WGWR14                               = 0x0110007A, /* Sparse Color Filter #1 White-Green-White-Red 14-bit unpacked */
+  SCF1WGWR16                               = 0x0110007B, /* Sparse Color Filter #1 White-Green-White-Red 16-bit */
+  SCF1WRWG8                                = 0x0108007C, /* Sparse Color Filter #1 White-Red-White-Green 8-bit */
+  SCF1WRWG10                               = 0x0110007D, /* Sparse Color Filter #1 White-Red-White-Green 10-bit unpacked */
+  SCF1WRWG10p                              = 0x010A007E, /* Sparse Color Filter #1 White-Red-White-Green 10-bit packed */
+  SCF1WRWG12                               = 0x0110007F, /* Sparse Color Filter #1 White-Red-White-Green 12-bit unpacked */
+  SCF1WRWG12p                              = 0x010C0080, /* Sparse Color Filter #1 White-Red-White-Green 12-bit packed */
+  SCF1WRWG14                               = 0x01100081, /* Sparse Color Filter #1 White-Red-White-Green 14-bit unpacked */
+  SCF1WRWG16                               = 0x01100082, /* Sparse Color Filter #1 White-Red-White-Green 16-bit */
+  YCbCr8                                   = 0x0218005B, /* YCbCr 4:4:4 8-bit */
+  YCbCr8_CbYCr                             = 0x0218003A, /* YCbCr 4:4:4 8-bit */
+  YCbCr10_CbYCr                            = 0x02300083, /* YCbCr 4:4:4 10-bit unpacked */
+  YCbCr10p_CbYCr                           = 0x021E0084, /* YCbCr 4:4:4 10-bit packed */
+  YCbCr12_CbYCr                            = 0x02300085, /* YCbCr 4:4:4 12-bit unpacked */
+  YCbCr12p_CbYCr                           = 0x02240086, /* YCbCr 4:4:4 12-bit packed */
+  YCbCr411_8                               = 0x020C005A, /* YCbCr 4:1:1 8-bit */
+  YCbCr411_8_CbYYCrYY                      = 0x020C003C, /* YCbCr 4:1:1 8-bit */
+  YCbCr420_8_YY_CbCr_Semiplanar            = 0x020C0112, /* YCbCr 4:2:0 8-bit YY/CbCr Semiplanar */
+  YCbCr420_8_YY_CrCb_Semiplanar            = 0x020C0114, /* YCbCr 4:2:0 8-bit YY/CrCb Semiplanar */
+  YCbCr422_8                               = 0x0210003B, /* YCbCr 4:2:2 8-bit */
+  YCbCr422_8_CbYCrY                        = 0x02100043, /* YCbCr 4:2:2 8-bit */
+  YCbCr422_8_YY_CbCr_Semiplanar            = 0x02100113, /* YCbCr 4:2:2 8-bit YY/CbCr Semiplanar */
+  YCbCr422_8_YY_CrCb_Semiplanar            = 0x02100115, /* YCbCr 4:2:2 8-bit YY/CrCb Semiplanar */
+  YCbCr422_10                              = 0x02200065, /* YCbCr 4:2:2 10-bit unpacked */
+  YCbCr422_10_CbYCrY                       = 0x02200099, /* YCbCr 4:2:2 10-bit unpacked */
+  YCbCr422_10p                             = 0x02140087, /* YCbCr 4:2:2 10-bit packed */
+  YCbCr422_10p_CbYCrY                      = 0x0214009A, /* YCbCr 4:2:2 10-bit packed */
+  YCbCr422_12                              = 0x02200066, /* YCbCr 4:2:2 12-bit unpacked */
+  YCbCr422_12_CbYCrY                       = 0x0220009B, /* YCbCr 4:2:2 12-bit unpacked */
+  YCbCr422_12p                             = 0x02180088, /* YCbCr 4:2:2 12-bit packed */
+  YCbCr422_12p_CbYCrY                      = 0x0218009C, /* YCbCr 4:2:2 12-bit packed */
+  YCbCr601_8_CbYCr                         = 0x0218003D, /* YCbCr 4:4:4 8-bit BT.601 */
+  YCbCr601_10_CbYCr                        = 0x02300089, /* YCbCr 4:4:4 10-bit unpacked BT.601 */
+  YCbCr601_10p_CbYCr                       = 0x021E008A, /* YCbCr 4:4:4 10-bit packed BT.601 */
+  YCbCr601_12_CbYCr                        = 0x0230008B, /* YCbCr 4:4:4 12-bit unpacked BT.601 */
+  YCbCr601_12p_CbYCr                       = 0x0224008C, /* YCbCr 4:4:4 12-bit packed BT.601 */
+  YCbCr601_411_8_CbYYCrYY                  = 0x020C003F, /* YCbCr 4:1:1 8-bit BT.601 */
+  YCbCr601_422_8                           = 0x0210003E, /* YCbCr 4:2:2 8-bit BT.601 */
+  YCbCr601_422_8_CbYCrY                    = 0x02100044, /* YCbCr 4:2:2 8-bit BT.601 */
+  YCbCr601_422_10                          = 0x0220008D, /* YCbCr 4:2:2 10-bit unpacked BT.601 */
+  YCbCr601_422_10_CbYCrY                   = 0x0220009D, /* YCbCr 4:2:2 10-bit unpacked BT.601 */
+  YCbCr601_422_10p                         = 0x0214008E, /* YCbCr 4:2:2 10-bit packed BT.601 */
+  YCbCr601_422_10p_CbYCrY                  = 0x0214009E, /* YCbCr 4:2:2 10-bit packed BT.601 */
+  YCbCr601_422_12                          = 0x0220008F, /* YCbCr 4:2:2 12-bit unpacked BT.601 */
+  YCbCr601_422_12_CbYCrY                   = 0x0220009F, /* YCbCr 4:2:2 12-bit unpacked BT.601 */
+  YCbCr601_422_12p                         = 0x02180090, /* YCbCr 4:2:2 12-bit packed BT.601 */
+  YCbCr601_422_12p_CbYCrY                  = 0x021800A0, /* YCbCr 4:2:2 12-bit packed BT.601 */
+  YCbCr709_8_CbYCr                         = 0x02180040, /* YCbCr 4:4:4 8-bit BT.709 */
+  YCbCr709_10_CbYCr                        = 0x02300091, /* YCbCr 4:4:4 10-bit unpacked BT.709 */
+  YCbCr709_10p_CbYCr                       = 0x021E0092, /* YCbCr 4:4:4 10-bit packed BT.709 */
+  YCbCr709_12_CbYCr                        = 0x02300093, /* YCbCr 4:4:4 12-bit unpacked BT.709 */
+  YCbCr709_12p_CbYCr                       = 0x02240094, /* YCbCr 4:4:4 12-bit packed BT.709 */
+  YCbCr709_411_8_CbYYCrYY                  = 0x020C0042, /* YCbCr 4:1:1 8-bit BT.709 */
+  YCbCr709_422_8                           = 0x02100041, /* YCbCr 4:2:2 8-bit BT.709 */
+  YCbCr709_422_8_CbYCrY                    = 0x02100045, /* YCbCr 4:2:2 8-bit BT.709 */
+  YCbCr709_422_10                          = 0x02200095, /* YCbCr 4:2:2 10-bit unpacked BT.709 */
+  YCbCr709_422_10_CbYCrY                   = 0x022000A1, /* YCbCr 4:2:2 10-bit unpacked BT.709 */
+  YCbCr709_422_10p                         = 0x02140096, /* YCbCr 4:2:2 10-bit packed BT.709 */
+  YCbCr709_422_10p_CbYCrY                  = 0x021400A2, /* YCbCr 4:2:2 10-bit packed BT.709 */
+  YCbCr709_422_12                          = 0x02200097, /* YCbCr 4:2:2 12-bit unpacked BT.709 */
+  YCbCr709_422_12_CbYCrY                   = 0x022000A3, /* YCbCr 4:2:2 12-bit unpacked BT.709 */
+  YCbCr709_422_12p                         = 0x02180098, /* YCbCr 4:2:2 12-bit packed BT.709 */
+  YCbCr709_422_12p_CbYCrY                  = 0x021800A4, /* YCbCr 4:2:2 12-bit packed BT.709 */
+  YCbCr2020_8_CbYCr                        = 0x021800F4, /* YCbCr 4:4:4 8-bit BT.2020 */
+  YCbCr2020_10_CbYCr                       = 0x023000F5, /* YCbCr 4:4:4 10-bit unpacked BT.2020 */
+  YCbCr2020_10p_CbYCr                      = 0x021E00F6, /* YCbCr 4:4:4 10-bit packed BT.2020 */
+  YCbCr2020_12_CbYCr                       = 0x023000F7, /* YCbCr 4:4:4 12-bit unpacked BT.2020 */
+  YCbCr2020_12p_CbYCr                      = 0x022400F8, /* YCbCr 4:4:4 12-bit packed BT.2020 */
+  YCbCr2020_411_8_CbYYCrYY                 = 0x020C00F9, /* YCbCr 4:1:1 8-bit BT.2020 */
+  YCbCr2020_422_8                          = 0x021000FA, /* YCbCr 4:2:2 8-bit BT.2020 */
+  YCbCr2020_422_8_CbYCrY                   = 0x021000FB, /* YCbCr 4:2:2 8-bit BT.2020 */
+  YCbCr2020_422_10                         = 0x022000FC, /* YCbCr 4:2:2 10-bit unpacked BT.2020 */
+  YCbCr2020_422_10_CbYCrY                  = 0x022000FD, /* YCbCr 4:2:2 10-bit unpacked BT.2020 */
+  YCbCr2020_422_10p                        = 0x021400FE, /* YCbCr 4:2:2 10-bit packed BT.2020 */
+  YCbCr2020_422_10p_CbYCrY                 = 0x021400FF, /* YCbCr 4:2:2 10-bit packed BT.2020 */
+  YCbCr2020_422_12                         = 0x02200100, /* YCbCr 4:2:2 12-bit unpacked BT.2020 */
+  YCbCr2020_422_12_CbYCrY                  = 0x02200101, /* YCbCr 4:2:2 12-bit unpacked BT.2020 */
+  YCbCr2020_422_12p                        = 0x02180102, /* YCbCr 4:2:2 12-bit packed BT.2020 */
+  YCbCr2020_422_12p_CbYCrY                 = 0x02180103, /* YCbCr 4:2:2 12-bit packed BT.2020 */
+  YUV8_UYV                                 = 0x02180020, /* YUV 4:4:4 8-bit */
+  YUV411_8_UYYVYY                          = 0x020C001E, /* YUV 4:1:1 8-bit */
+  YUV422_8                                 = 0x02100032, /* YUV 4:2:2 8-bit */
+  YUV422_8_UYVY                            = 0x0210001F, /* YUV 4:2:2 8-bit */
+  Mono10Packed                             = 0x010C0004, /* GigE Vision specific format, Monochrome 10-bit packed */
+  Mono12Packed                             = 0x010C0006, /* GigE Vision specific format, Monochrome 12-bit packed */
+  BayerBG10Packed                          = 0x010C0029, /* GigE Vision specific format, Bayer Blue-Green 10-bit packed */
+  BayerBG12Packed                          = 0x010C002D, /* GigE Vision specific format, Bayer Blue-Green 12-bit packed */
+  BayerGB10Packed                          = 0x010C0028, /* GigE Vision specific format, Bayer Green-Blue 10-bit packed */
+  BayerGB12Packed                          = 0x010C002C, /* GigE Vision specific format, Bayer Green-Blue 12-bit packed */
+  BayerGR10Packed                          = 0x010C0026, /* GigE Vision specific format, Bayer Green-Red 10-bit packed */
+  BayerGR12Packed                          = 0x010C002A, /* GigE Vision specific format, Bayer Green-Red 12-bit packed */
+  BayerRG10Packed                          = 0x010C0027, /* GigE Vision specific format, Bayer Red-Green 10-bit packed */
+  BayerRG12Packed                          = 0x010C002B, /* GigE Vision specific format, Bayer Red-Green 12-bit packed */
+  RGB10V1Packed                            = 0x0220001C, /* GigE Vision specific format, Red-Green-Blue 10-bit packed - variant 1 */
+  RGB12V1Packed                            = 0x02240034, /* GigE Vision specific format, Red-Green-Blue 12-bit packed - variant 1 */
+  InvalidPixelFormat                       = 0
+} PfncFormat;
+
+/* 32-bit value layout */
+/* |31            24|23            16|15            08|07            00| */
+/* | C| Comp. Layout| Effective Size |            Pixel ID             | */
+
+/* Custom flag */
+#define PFNC_CUSTOM                              0x80000000
+/* Component layout */
+#define PFNC_SINGLE_COMPONENT                    0x01000000
+#define PFNC_MULTIPLE_COMPONENT                  0x02000000
+#define PFNC_COMPONENT_MASK                      0x7F000000
+/* Effective size */
+#define PFNC_OCCUPY1BIT                          0x00010000
+#define PFNC_OCCUPY2BIT                          0x00020000
+#define PFNC_OCCUPY4BIT                          0x00040000
+#define PFNC_OCCUPY8BIT                          0x00080000
+#define PFNC_OCCUPY10BIT                         0x000A0000
+#define PFNC_OCCUPY12BIT                         0x000C0000
+#define PFNC_OCCUPY16BIT                         0x00100000
+#define PFNC_OCCUPY24BIT                         0x00180000
+#define PFNC_OCCUPY30BIT                         0x001E0000
+#define PFNC_OCCUPY32BIT                         0x00200000
+#define PFNC_OCCUPY36BIT                         0x00240000
+#define PFNC_OCCUPY40BIT                         0x00280000
+#define PFNC_OCCUPY48BIT                         0x00300000
+#define PFNC_OCCUPY64BIT                         0x00400000
+#define PFNC_PIXEL_SIZE_MASK                     0x00FF0000
+#define PFNC_PIXEL_SIZE_SHIFT                    16
+/* Pixel ID */
+#define PFNC_PIXEL_ID_MASK                       0x0000FFFF
+
+/* Pixel format value dissection helpers */
+#define PFNC_PIXEL_SIZE(X) (((X == 0x010A00CA) || (X == 0x010A00CE) || (X == 0x010A00D2) || (X == 0x010C00CB) || (X == 0x010C00CF) || (X == 0x010C00D3)) ? 16 : ((X & PFNC_PIXEL_SIZE_MASK) >> PFNC_PIXEL_SIZE_SHIFT))
+// #define PFNC_PIXEL_SIZE(X) ((X & PFNC_PIXEL_SIZE_MASK) >> PFNC_PIXEL_SIZE_SHIFT)
+#define PFNC_IS_PIXEL_SINGLE_COMPONENT(X)        ((X & PFNC_COMPONENT_MASK) == PFNC_SINGLE_COMPONENT)
+#define PFNC_IS_PIXEL_MULTIPLE_COMPONENT(X)      ((X & PFNC_COMPONENT_MASK) == PFNC_MULTIPLE_COMPONENT)
+#define PFNC_IS_PIXEL_CUSTOM(X)                  ((X & PFNC_CUSTOM) == PFNC_CUSTOM)
+#define PFNC_PIXEL_ID(X)                         (X & PFNC_PIXEL_ID_MASK)
+
+
+/* Additional helpers */
+#ifdef PFNC_INCLUDE_HELPERS
+#ifdef _MSC_VER
+#  define PFNC_INLINE __inline
+#else
+#  define PFNC_INLINE inline
+#endif
+static PFNC_INLINE const char* GetPixelFormatName (PfncFormat format)
+{
+  switch (format)
+  {
+    case Mono1p:                                  return "Mono1p";
+    case Mono2p:                                  return "Mono2p";
+    case Mono4p:                                  return "Mono4p";
+    case Mono8:                                   return "Mono8";
+    case Mono8s:                                  return "Mono8s";
+    case Mono10:                                  return "Mono10";
+    case Mono10p:                                 return "Mono10p";
+    case Mono12:                                  return "Mono12";
+    case Mono12p:                                 return "Mono12p";
+    case Mono14:                                  return "Mono14";
+    case Mono14p:                                 return "Mono14p";
+    case Mono16:                                  return "Mono16";
+    case Mono32:                                  return "Mono32";
+    case BayerBG4p:                               return "BayerBG4p";
+    case BayerBG8:                                return "BayerBG8";
+    case BayerBG10:                               return "BayerBG10";
+    case BayerBG10p:                              return "BayerBG10p";
+    case BayerBG12:                               return "BayerBG12";
+    case BayerBG12p:                              return "BayerBG12p";
+    case BayerBG14:                               return "BayerBG14";
+    case BayerBG14p:                              return "BayerBG14p";
+    case BayerBG16:                               return "BayerBG16";
+    case BayerGB4p:                               return "BayerGB4p";
+    case BayerGB8:                                return "BayerGB8";
+    case BayerGB10:                               return "BayerGB10";
+    case BayerGB10p:                              return "BayerGB10p";
+    case BayerGB12:                               return "BayerGB12";
+    case BayerGB12p:                              return "BayerGB12p";
+    case BayerGB14:                               return "BayerGB14";
+    case BayerGB14p:                              return "BayerGB14p";
+    case BayerGB16:                               return "BayerGB16";
+    case BayerGR4p:                               return "BayerGR4p";
+    case BayerGR8:                                return "BayerGR8";
+    case BayerGR10:                               return "BayerGR10";
+    case BayerGR10p:                              return "BayerGR10p";
+    case BayerGR12:                               return "BayerGR12";
+    case BayerGR12p:                              return "BayerGR12p";
+    case BayerGR14:                               return "BayerGR14";
+    case BayerGR14p:                              return "BayerGR14p";
+    case BayerGR16:                               return "BayerGR16";
+    case BayerRG4p:                               return "BayerRG4p";
+    case BayerRG8:                                return "BayerRG8";
+    case BayerRG10:                               return "BayerRG10";
+    case BayerRG10p:                              return "BayerRG10p";
+    case BayerRG12:                               return "BayerRG12";
+    case BayerRG12p:                              return "BayerRG12p";
+    case BayerRG14:                               return "BayerRG14";
+    case BayerRG14p:                              return "BayerRG14p";
+    case BayerRG16:                               return "BayerRG16";
+    case RGBa8:                                   return "RGBa8";
+    case RGBa10:                                  return "RGBa10";
+    case RGBa10p:                                 return "RGBa10p";
+    case RGBa12:                                  return "RGBa12";
+    case RGBa12p:                                 return "RGBa12p";
+    case RGBa14:                                  return "RGBa14";
+    case RGBa16:                                  return "RGBa16";
+    case RGB8:                                    return "RGB8";
+    case RGB8_Planar:                             return "RGB8_Planar";
+    case RGB10:                                   return "RGB10";
+    case RGB10_Planar:                            return "RGB10_Planar";
+    case RGB10p:                                  return "RGB10p";
+    case RGB10p32:                                return "RGB10p32";
+    case RGB12:                                   return "RGB12";
+    case RGB12_Planar:                            return "RGB12_Planar";
+    case RGB12p:                                  return "RGB12p";
+    case RGB14:                                   return "RGB14";
+    case RGB16:                                   return "RGB16";
+    case RGB16_Planar:                            return "RGB16_Planar";
+    case RGB565p:                                 return "RGB565p";
+    case BGRa8:                                   return "BGRa8";
+    case BGRa10:                                  return "BGRa10";
+    case BGRa10p:                                 return "BGRa10p";
+    case BGRa12:                                  return "BGRa12";
+    case BGRa12p:                                 return "BGRa12p";
+    case BGRa14:                                  return "BGRa14";
+    case BGRa16:                                  return "BGRa16";
+    case BGR8:                                    return "BGR8";
+    case BGR10:                                   return "BGR10";
+    case BGR10p:                                  return "BGR10p";
+    case BGR12:                                   return "BGR12";
+    case BGR12p:                                  return "BGR12p";
+    case BGR14:                                   return "BGR14";
+    case BGR16:                                   return "BGR16";
+    case BGR565p:                                 return "BGR565p";
+    case R8:                                      return "R8";
+    case R10:                                     return "R10";
+    case R12:                                     return "R12";
+    case R16:                                     return "R16";
+    case G8:                                      return "G8";
+    case G10:                                     return "G10";
+    case G12:                                     return "G12";
+    case G16:                                     return "G16";
+    case B8:                                      return "B8";
+    case B10:                                     return "B10";
+    case B12:                                     return "B12";
+    case B16:                                     return "B16";
+    case Coord3D_ABC8:                            return "Coord3D_ABC8";
+    case Coord3D_ABC8_Planar:                     return "Coord3D_ABC8_Planar";
+    case Coord3D_ABC10p:                          return "Coord3D_ABC10p";
+    case Coord3D_ABC10p_Planar:                   return "Coord3D_ABC10p_Planar";
+    case Coord3D_ABC12p:                          return "Coord3D_ABC12p";
+    case Coord3D_ABC12p_Planar:                   return "Coord3D_ABC12p_Planar";
+    case Coord3D_ABC16:                           return "Coord3D_ABC16";
+    case Coord3D_ABC16_Planar:                    return "Coord3D_ABC16_Planar";
+    case Coord3D_ABC32f:                          return "Coord3D_ABC32f";
+    case Coord3D_ABC32f_Planar:                   return "Coord3D_ABC32f_Planar";
+    case Coord3D_AC8:                             return "Coord3D_AC8";
+    case Coord3D_AC8_Planar:                      return "Coord3D_AC8_Planar";
+    case Coord3D_AC10p:                           return "Coord3D_AC10p";
+    case Coord3D_AC10p_Planar:                    return "Coord3D_AC10p_Planar";
+    case Coord3D_AC12p:                           return "Coord3D_AC12p";
+    case Coord3D_AC12p_Planar:                    return "Coord3D_AC12p_Planar";
+    case Coord3D_AC16:                            return "Coord3D_AC16";
+    case Coord3D_AC16_Planar:                     return "Coord3D_AC16_Planar";
+    case Coord3D_AC32f:                           return "Coord3D_AC32f";
+    case Coord3D_AC32f_Planar:                    return "Coord3D_AC32f_Planar";
+    case Coord3D_A8:                              return "Coord3D_A8";
+    case Coord3D_A10p:                            return "Coord3D_A10p";
+    case Coord3D_A12p:                            return "Coord3D_A12p";
+    case Coord3D_A16:                             return "Coord3D_A16";
+    case Coord3D_A32f:                            return "Coord3D_A32f";
+    case Coord3D_B8:                              return "Coord3D_B8";
+    case Coord3D_B10p:                            return "Coord3D_B10p";
+    case Coord3D_B12p:                            return "Coord3D_B12p";
+    case Coord3D_B16:                             return "Coord3D_B16";
+    case Coord3D_B32f:                            return "Coord3D_B32f";
+    case Coord3D_C8:                              return "Coord3D_C8";
+    case Coord3D_C10p:                            return "Coord3D_C10p";
+    case Coord3D_C12p:                            return "Coord3D_C12p";
+    case Coord3D_C16:                             return "Coord3D_C16";
+    case Coord3D_C32f:                            return "Coord3D_C32f";
+    case Confidence1:                             return "Confidence1";
+    case Confidence1p:                            return "Confidence1p";
+    case Confidence8:                             return "Confidence8";
+    case Confidence16:                            return "Confidence16";
+    case Confidence32f:                           return "Confidence32f";
+    case BiColorBGRG8:                            return "BiColorBGRG8";
+    case BiColorBGRG10:                           return "BiColorBGRG10";
+    case BiColorBGRG10p:                          return "BiColorBGRG10p";
+    case BiColorBGRG12:                           return "BiColorBGRG12";
+    case BiColorBGRG12p:                          return "BiColorBGRG12p";
+    case BiColorRGBG8:                            return "BiColorRGBG8";
+    case BiColorRGBG10:                           return "BiColorRGBG10";
+    case BiColorRGBG10p:                          return "BiColorRGBG10p";
+    case BiColorRGBG12:                           return "BiColorRGBG12";
+    case BiColorRGBG12p:                          return "BiColorRGBG12p";
+    case Data8:                                   return "Data8";
+    case Data8s:                                  return "Data8s";
+    case Data16:                                  return "Data16";
+    case Data16s:                                 return "Data16s";
+    case Data32:                                  return "Data32";
+    case Data32f:                                 return "Data32f";
+    case Data32s:                                 return "Data32s";
+    case Data64:                                  return "Data64";
+    case Data64f:                                 return "Data64f";
+    case Data64s:                                 return "Data64s";
+    case SCF1WBWG8:                               return "SCF1WBWG8";
+    case SCF1WBWG10:                              return "SCF1WBWG10";
+    case SCF1WBWG10p:                             return "SCF1WBWG10p";
+    case SCF1WBWG12:                              return "SCF1WBWG12";
+    case SCF1WBWG12p:                             return "SCF1WBWG12p";
+    case SCF1WBWG14:                              return "SCF1WBWG14";
+    case SCF1WBWG16:                              return "SCF1WBWG16";
+    case SCF1WGWB8:                               return "SCF1WGWB8";
+    case SCF1WGWB10:                              return "SCF1WGWB10";
+    case SCF1WGWB10p:                             return "SCF1WGWB10p";
+    case SCF1WGWB12:                              return "SCF1WGWB12";
+    case SCF1WGWB12p:                             return "SCF1WGWB12p";
+    case SCF1WGWB14:                              return "SCF1WGWB14";
+    case SCF1WGWB16:                              return "SCF1WGWB16";
+    case SCF1WGWR8:                               return "SCF1WGWR8";
+    case SCF1WGWR10:                              return "SCF1WGWR10";
+    case SCF1WGWR10p:                             return "SCF1WGWR10p";
+    case SCF1WGWR12:                              return "SCF1WGWR12";
+    case SCF1WGWR12p:                             return "SCF1WGWR12p";
+    case SCF1WGWR14:                              return "SCF1WGWR14";
+    case SCF1WGWR16:                              return "SCF1WGWR16";
+    case SCF1WRWG8:                               return "SCF1WRWG8";
+    case SCF1WRWG10:                              return "SCF1WRWG10";
+    case SCF1WRWG10p:                             return "SCF1WRWG10p";
+    case SCF1WRWG12:                              return "SCF1WRWG12";
+    case SCF1WRWG12p:                             return "SCF1WRWG12p";
+    case SCF1WRWG14:                              return "SCF1WRWG14";
+    case SCF1WRWG16:                              return "SCF1WRWG16";
+    case YCbCr8:                                  return "YCbCr8";
+    case YCbCr8_CbYCr:                            return "YCbCr8_CbYCr";
+    case YCbCr10_CbYCr:                           return "YCbCr10_CbYCr";
+    case YCbCr10p_CbYCr:                          return "YCbCr10p_CbYCr";
+    case YCbCr12_CbYCr:                           return "YCbCr12_CbYCr";
+    case YCbCr12p_CbYCr:                          return "YCbCr12p_CbYCr";
+    case YCbCr411_8:                              return "YCbCr411_8";
+    case YCbCr411_8_CbYYCrYY:                     return "YCbCr411_8_CbYYCrYY";
+    case YCbCr420_8_YY_CbCr_Semiplanar:           return "YCbCr420_8_YY_CbCr_Semiplanar";
+    case YCbCr420_8_YY_CrCb_Semiplanar:           return "YCbCr420_8_YY_CrCb_Semiplanar";
+    case YCbCr422_8:                              return "YCbCr422_8";
+    case YCbCr422_8_CbYCrY:                       return "YCbCr422_8_CbYCrY";
+    case YCbCr422_8_YY_CbCr_Semiplanar:           return "YCbCr422_8_YY_CbCr_Semiplanar";
+    case YCbCr422_8_YY_CrCb_Semiplanar:           return "YCbCr422_8_YY_CrCb_Semiplanar";
+    case YCbCr422_10:                             return "YCbCr422_10";
+    case YCbCr422_10_CbYCrY:                      return "YCbCr422_10_CbYCrY";
+    case YCbCr422_10p:                            return "YCbCr422_10p";
+    case YCbCr422_10p_CbYCrY:                     return "YCbCr422_10p_CbYCrY";
+    case YCbCr422_12:                             return "YCbCr422_12";
+    case YCbCr422_12_CbYCrY:                      return "YCbCr422_12_CbYCrY";
+    case YCbCr422_12p:                            return "YCbCr422_12p";
+    case YCbCr422_12p_CbYCrY:                     return "YCbCr422_12p_CbYCrY";
+    case YCbCr601_8_CbYCr:                        return "YCbCr601_8_CbYCr";
+    case YCbCr601_10_CbYCr:                       return "YCbCr601_10_CbYCr";
+    case YCbCr601_10p_CbYCr:                      return "YCbCr601_10p_CbYCr";
+    case YCbCr601_12_CbYCr:                       return "YCbCr601_12_CbYCr";
+    case YCbCr601_12p_CbYCr:                      return "YCbCr601_12p_CbYCr";
+    case YCbCr601_411_8_CbYYCrYY:                 return "YCbCr601_411_8_CbYYCrYY";
+    case YCbCr601_422_8:                          return "YCbCr601_422_8";
+    case YCbCr601_422_8_CbYCrY:                   return "YCbCr601_422_8_CbYCrY";
+    case YCbCr601_422_10:                         return "YCbCr601_422_10";
+    case YCbCr601_422_10_CbYCrY:                  return "YCbCr601_422_10_CbYCrY";
+    case YCbCr601_422_10p:                        return "YCbCr601_422_10p";
+    case YCbCr601_422_10p_CbYCrY:                 return "YCbCr601_422_10p_CbYCrY";
+    case YCbCr601_422_12:                         return "YCbCr601_422_12";
+    case YCbCr601_422_12_CbYCrY:                  return "YCbCr601_422_12_CbYCrY";
+    case YCbCr601_422_12p:                        return "YCbCr601_422_12p";
+    case YCbCr601_422_12p_CbYCrY:                 return "YCbCr601_422_12p_CbYCrY";
+    case YCbCr709_8_CbYCr:                        return "YCbCr709_8_CbYCr";
+    case YCbCr709_10_CbYCr:                       return "YCbCr709_10_CbYCr";
+    case YCbCr709_10p_CbYCr:                      return "YCbCr709_10p_CbYCr";
+    case YCbCr709_12_CbYCr:                       return "YCbCr709_12_CbYCr";
+    case YCbCr709_12p_CbYCr:                      return "YCbCr709_12p_CbYCr";
+    case YCbCr709_411_8_CbYYCrYY:                 return "YCbCr709_411_8_CbYYCrYY";
+    case YCbCr709_422_8:                          return "YCbCr709_422_8";
+    case YCbCr709_422_8_CbYCrY:                   return "YCbCr709_422_8_CbYCrY";
+    case YCbCr709_422_10:                         return "YCbCr709_422_10";
+    case YCbCr709_422_10_CbYCrY:                  return "YCbCr709_422_10_CbYCrY";
+    case YCbCr709_422_10p:                        return "YCbCr709_422_10p";
+    case YCbCr709_422_10p_CbYCrY:                 return "YCbCr709_422_10p_CbYCrY";
+    case YCbCr709_422_12:                         return "YCbCr709_422_12";
+    case YCbCr709_422_12_CbYCrY:                  return "YCbCr709_422_12_CbYCrY";
+    case YCbCr709_422_12p:                        return "YCbCr709_422_12p";
+    case YCbCr709_422_12p_CbYCrY:                 return "YCbCr709_422_12p_CbYCrY";
+    case YCbCr2020_8_CbYCr:                       return "YCbCr2020_8_CbYCr";
+    case YCbCr2020_10_CbYCr:                      return "YCbCr2020_10_CbYCr";
+    case YCbCr2020_10p_CbYCr:                     return "YCbCr2020_10p_CbYCr";
+    case YCbCr2020_12_CbYCr:                      return "YCbCr2020_12_CbYCr";
+    case YCbCr2020_12p_CbYCr:                     return "YCbCr2020_12p_CbYCr";
+    case YCbCr2020_411_8_CbYYCrYY:                return "YCbCr2020_411_8_CbYYCrYY";
+    case YCbCr2020_422_8:                         return "YCbCr2020_422_8";
+    case YCbCr2020_422_8_CbYCrY:                  return "YCbCr2020_422_8_CbYCrY";
+    case YCbCr2020_422_10:                        return "YCbCr2020_422_10";
+    case YCbCr2020_422_10_CbYCrY:                 return "YCbCr2020_422_10_CbYCrY";
+    case YCbCr2020_422_10p:                       return "YCbCr2020_422_10p";
+    case YCbCr2020_422_10p_CbYCrY:                return "YCbCr2020_422_10p_CbYCrY";
+    case YCbCr2020_422_12:                        return "YCbCr2020_422_12";
+    case YCbCr2020_422_12_CbYCrY:                 return "YCbCr2020_422_12_CbYCrY";
+    case YCbCr2020_422_12p:                       return "YCbCr2020_422_12p";
+    case YCbCr2020_422_12p_CbYCrY:                return "YCbCr2020_422_12p_CbYCrY";
+    case YUV8_UYV:                                return "YUV8_UYV";
+    case YUV411_8_UYYVYY:                         return "YUV411_8_UYYVYY";
+    case YUV422_8:                                return "YUV422_8";
+    case YUV422_8_UYVY:                           return "YUV422_8_UYVY";
+    case Mono10Packed:                            return "Mono10Packed";
+    case Mono12Packed:                            return "Mono12Packed";
+    case BayerBG10Packed:                         return "BayerBG10Packed";
+    case BayerBG12Packed:                         return "BayerBG12Packed";
+    case BayerGB10Packed:                         return "BayerGB10Packed";
+    case BayerGB12Packed:                         return "BayerGB12Packed";
+    case BayerGR10Packed:                         return "BayerGR10Packed";
+    case BayerGR12Packed:                         return "BayerGR12Packed";
+    case BayerRG10Packed:                         return "BayerRG10Packed";
+    case BayerRG12Packed:                         return "BayerRG12Packed";
+    case RGB10V1Packed:                           return "RGB10V1Packed";
+    case RGB12V1Packed:                           return "RGB12V1Packed";
+
+    case InvalidPixelFormat: return "InvalidPixelFormat";
+
+    default: return "UnknownPixelFormat";
+  }
+}
+static PFNC_INLINE const char* GetPixelFormatDescription (PfncFormat format)
+{
+  switch (format)
+  {
+    case Mono1p:                                  return "Monochrome 1-bit packed";
+    case Mono2p:                                  return "Monochrome 2-bit packed";
+    case Mono4p:                                  return "Monochrome 4-bit packed";
+    case Mono8:                                   return "Monochrome 8-bit";
+    case Mono8s:                                  return "Monochrome 8-bit signed";
+    case Mono10:                                  return "Monochrome 10-bit unpacked";
+    case Mono10p:                                 return "Monochrome 10-bit packed";
+    case Mono12:                                  return "Monochrome 12-bit unpacked";
+    case Mono12p:                                 return "Monochrome 12-bit packed";
+    case Mono14:                                  return "Monochrome 14-bit unpacked";
+    case Mono14p:                                 return "Monochrome 14-bit packed";
+    case Mono16:                                  return "Monochrome 16-bit";
+    case Mono32:                                  return "Monochrome 32-bit";
+    case BayerBG4p:                               return "Bayer Blue-Green 4-bit packed";
+    case BayerBG8:                                return "Bayer Blue-Green 8-bit";
+    case BayerBG10:                               return "Bayer Blue-Green 10-bit unpacked";
+    case BayerBG10p:                              return "Bayer Blue-Green 10-bit packed";
+    case BayerBG12:                               return "Bayer Blue-Green 12-bit unpacked";
+    case BayerBG12p:                              return "Bayer Blue-Green 12-bit packed";
+    case BayerBG14:                               return "Bayer Blue-Green 14-bit";
+    case BayerBG14p:                              return "Bayer Blue-Green 14-bit packed";
+    case BayerBG16:                               return "Bayer Blue-Green 16-bit";
+    case BayerGB4p:                               return "Bayer Green-Blue 4-bit packed";
+    case BayerGB8:                                return "Bayer Green-Blue 8-bit";
+    case BayerGB10:                               return "Bayer Green-Blue 10-bit unpacked";
+    case BayerGB10p:                              return "Bayer Green-Blue 10-bit packed";
+    case BayerGB12:                               return "Bayer Green-Blue 12-bit unpacked";
+    case BayerGB12p:                              return "Bayer Green-Blue 12-bit packed";
+    case BayerGB14:                               return "Bayer Green-Blue 14-bit";
+    case BayerGB14p:                              return "Bayer Green-Blue 14-bit packed";
+    case BayerGB16:                               return "Bayer Green-Blue 16-bit";
+    case BayerGR4p:                               return "Bayer Green-Red 4-bit packed";
+    case BayerGR8:                                return "Bayer Green-Red 8-bit";
+    case BayerGR10:                               return "Bayer Green-Red 10-bit unpacked";
+    case BayerGR10p:                              return "Bayer Green-Red 10-bit packed";
+    case BayerGR12:                               return "Bayer Green-Red 12-bit unpacked";
+    case BayerGR12p:                              return "Bayer Green-Red 12-bit packed";
+    case BayerGR14:                               return "Bayer Green-Red 14-bit";
+    case BayerGR14p:                              return "Bayer Green-Red 14-bit packed";
+    case BayerGR16:                               return "Bayer Green-Red 16-bit";
+    case BayerRG4p:                               return "Bayer Red-Green 4-bit packed";
+    case BayerRG8:                                return "Bayer Red-Green 8-bit";
+    case BayerRG10:                               return "Bayer Red-Green 10-bit unpacked";
+    case BayerRG10p:                              return "Bayer Red-Green 10-bit packed";
+    case BayerRG12:                               return "Bayer Red-Green 12-bit unpacked";
+    case BayerRG12p:                              return "Bayer Red-Green 12-bit packed";
+    case BayerRG14:                               return "Bayer Red-Green 14-bit";
+    case BayerRG14p:                              return "Bayer Red-Green 14-bit packed";
+    case BayerRG16:                               return "Bayer Red-Green 16-bit";
+    case RGBa8:                                   return "Red-Green-Blue-alpha 8-bit";
+    case RGBa10:                                  return "Red-Green-Blue-alpha 10-bit unpacked";
+    case RGBa10p:                                 return "Red-Green-Blue-alpha 10-bit packed";
+    case RGBa12:                                  return "Red-Green-Blue-alpha 12-bit unpacked";
+    case RGBa12p:                                 return "Red-Green-Blue-alpha 12-bit packed";
+    case RGBa14:                                  return "Red-Green-Blue-alpha 14-bit unpacked";
+    case RGBa16:                                  return "Red-Green-Blue-alpha 16-bit";
+    case RGB8:                                    return "Red-Green-Blue 8-bit";
+    case RGB8_Planar:                             return "Red-Green-Blue 8-bit planar";
+    case RGB10:                                   return "Red-Green-Blue 10-bit unpacked";
+    case RGB10_Planar:                            return "Red-Green-Blue 10-bit unpacked planar";
+    case RGB10p:                                  return "Red-Green-Blue 10-bit packed";
+    case RGB10p32:                                return "Red-Green-Blue 10-bit packed into 32-bit";
+    case RGB12:                                   return "Red-Green-Blue 12-bit unpacked";
+    case RGB12_Planar:                            return "Red-Green-Blue 12-bit unpacked planar";
+    case RGB12p:                                  return "Red-Green-Blue 12-bit packed";
+    case RGB14:                                   return "Red-Green-Blue 14-bit unpacked";
+    case RGB16:                                   return "Red-Green-Blue 16-bit";
+    case RGB16_Planar:                            return "Red-Green-Blue 16-bit planar";
+    case RGB565p:                                 return "Red-Green-Blue 5/6/5-bit packed";
+    case BGRa8:                                   return "Blue-Green-Red-alpha 8-bit";
+    case BGRa10:                                  return "Blue-Green-Red-alpha 10-bit unpacked";
+    case BGRa10p:                                 return "Blue-Green-Red-alpha 10-bit packed";
+    case BGRa12:                                  return "Blue-Green-Red-alpha 12-bit unpacked";
+    case BGRa12p:                                 return "Blue-Green-Red-alpha 12-bit packed";
+    case BGRa14:                                  return "Blue-Green-Red-alpha 14-bit unpacked";
+    case BGRa16:                                  return "Blue-Green-Red-alpha 16-bit";
+    case BGR8:                                    return "Blue-Green-Red 8-bit";
+    case BGR10:                                   return "Blue-Green-Red 10-bit unpacked";
+    case BGR10p:                                  return "Blue-Green-Red 10-bit packed";
+    case BGR12:                                   return "Blue-Green-Red 12-bit unpacked";
+    case BGR12p:                                  return "Blue-Green-Red 12-bit packed";
+    case BGR14:                                   return "Blue-Green-Red 14-bit unpacked";
+    case BGR16:                                   return "Blue-Green-Red 16-bit";
+    case BGR565p:                                 return "Blue-Green-Red 5/6/5-bit packed";
+    case R8:                                      return "Red 8-bit";
+    case R10:                                     return "Red 10-bit";
+    case R12:                                     return "Red 12-bit";
+    case R16:                                     return "Red 16-bit";
+    case G8:                                      return "Green 8-bit";
+    case G10:                                     return "Green 10-bit";
+    case G12:                                     return "Green 12-bit";
+    case G16:                                     return "Green 16-bit";
+    case B8:                                      return "Blue 8-bit";
+    case B10:                                     return "Blue 10-bit";
+    case B12:                                     return "Blue 12-bit";
+    case B16:                                     return "Blue 16-bit";
+    case Coord3D_ABC8:                            return "3D coordinate A-B-C 8-bit";
+    case Coord3D_ABC8_Planar:                     return "3D coordinate A-B-C 8-bit planar";
+    case Coord3D_ABC10p:                          return "3D coordinate A-B-C 10-bit packed";
+    case Coord3D_ABC10p_Planar:                   return "3D coordinate A-B-C 10-bit packed planar";
+    case Coord3D_ABC12p:                          return "3D coordinate A-B-C 12-bit packed";
+    case Coord3D_ABC12p_Planar:                   return "3D coordinate A-B-C 12-bit packed planar";
+    case Coord3D_ABC16:                           return "3D coordinate A-B-C 16-bit";
+    case Coord3D_ABC16_Planar:                    return "3D coordinate A-B-C 16-bit planar";
+    case Coord3D_ABC32f:                          return "3D coordinate A-B-C 32-bit floating point";
+    case Coord3D_ABC32f_Planar:                   return "3D coordinate A-B-C 32-bit floating point planar";
+    case Coord3D_AC8:                             return "3D coordinate A-C 8-bit";
+    case Coord3D_AC8_Planar:                      return "3D coordinate A-C 8-bit planar";
+    case Coord3D_AC10p:                           return "3D coordinate A-C 10-bit packed";
+    case Coord3D_AC10p_Planar:                    return "3D coordinate A-C 10-bit packed planar";
+    case Coord3D_AC12p:                           return "3D coordinate A-C 12-bit packed";
+    case Coord3D_AC12p_Planar:                    return "3D coordinate A-C 12-bit packed planar";
+    case Coord3D_AC16:                            return "3D coordinate A-C 16-bit";
+    case Coord3D_AC16_Planar:                     return "3D coordinate A-C 16-bit planar";
+    case Coord3D_AC32f:                           return "3D coordinate A-C 32-bit floating point";
+    case Coord3D_AC32f_Planar:                    return "3D coordinate A-C 32-bit floating point planar";
+    case Coord3D_A8:                              return "3D coordinate A 8-bit";
+    case Coord3D_A10p:                            return "3D coordinate A 10-bit packed";
+    case Coord3D_A12p:                            return "3D coordinate A 12-bit packed";
+    case Coord3D_A16:                             return "3D coordinate A 16-bit";
+    case Coord3D_A32f:                            return "3D coordinate A 32-bit floating point";
+    case Coord3D_B8:                              return "3D coordinate B 8-bit";
+    case Coord3D_B10p:                            return "3D coordinate B 10-bit packed";
+    case Coord3D_B12p:                            return "3D coordinate B 12-bit packed";
+    case Coord3D_B16:                             return "3D coordinate B 16-bit";
+    case Coord3D_B32f:                            return "3D coordinate B 32-bit floating point";
+    case Coord3D_C8:                              return "3D coordinate C 8-bit";
+    case Coord3D_C10p:                            return "3D coordinate C 10-bit packed";
+    case Coord3D_C12p:                            return "3D coordinate C 12-bit packed";
+    case Coord3D_C16:                             return "3D coordinate C 16-bit";
+    case Coord3D_C32f:                            return "3D coordinate C 32-bit floating point";
+    case Confidence1:                             return "Confidence 1-bit unpacked";
+    case Confidence1p:                            return "Confidence 1-bit packed";
+    case Confidence8:                             return "Confidence 8-bit";
+    case Confidence16:                            return "Confidence 16-bit";
+    case Confidence32f:                           return "Confidence 32-bit floating point";
+    case BiColorBGRG8:                            return "Bi-color Blue/Green - Red/Green 8-bit";
+    case BiColorBGRG10:                           return "Bi-color Blue/Green - Red/Green 10-bit unpacked";
+    case BiColorBGRG10p:                          return "Bi-color Blue/Green - Red/Green 10-bit packed";
+    case BiColorBGRG12:                           return "Bi-color Blue/Green - Red/Green 12-bit unpacked";
+    case BiColorBGRG12p:                          return "Bi-color Blue/Green - Red/Green 12-bit packed";
+    case BiColorRGBG8:                            return "Bi-color Red/Green - Blue/Green 8-bit";
+    case BiColorRGBG10:                           return "Bi-color Red/Green - Blue/Green 10-bit unpacked";
+    case BiColorRGBG10p:                          return "Bi-color Red/Green - Blue/Green 10-bit packed";
+    case BiColorRGBG12:                           return "Bi-color Red/Green - Blue/Green 12-bit unpacked";
+    case BiColorRGBG12p:                          return "Bi-color Red/Green - Blue/Green 12-bit packed";
+    case Data8:                                   return "Data 8-bit";
+    case Data8s:                                  return "Data 8-bit signed";
+    case Data16:                                  return "Data 16-bit";
+    case Data16s:                                 return "Data 16-bit signed";
+    case Data32:                                  return "Data 32-bit";
+    case Data32f:                                 return "Data 32-bit floating point";
+    case Data32s:                                 return "Data 32-bit signed";
+    case Data64:                                  return "Data 64-bit";
+    case Data64f:                                 return "Data 64-bit floating point";
+    case Data64s:                                 return "Data 64-bit signed";
+    case SCF1WBWG8:                               return "Sparse Color Filter #1 White-Blue-White-Green 8-bit";
+    case SCF1WBWG10:                              return "Sparse Color Filter #1 White-Blue-White-Green 10-bit unpacked";
+    case SCF1WBWG10p:                             return "Sparse Color Filter #1 White-Blue-White-Green 10-bit packed";
+    case SCF1WBWG12:                              return "Sparse Color Filter #1 White-Blue-White-Green 12-bit unpacked";
+    case SCF1WBWG12p:                             return "Sparse Color Filter #1 White-Blue-White-Green 12-bit packed";
+    case SCF1WBWG14:                              return "Sparse Color Filter #1 White-Blue-White-Green 14-bit unpacked";
+    case SCF1WBWG16:                              return "Sparse Color Filter #1 White-Blue-White-Green 16-bit unpacked";
+    case SCF1WGWB8:                               return "Sparse Color Filter #1 White-Green-White-Blue 8-bit";
+    case SCF1WGWB10:                              return "Sparse Color Filter #1 White-Green-White-Blue 10-bit unpacked";
+    case SCF1WGWB10p:                             return "Sparse Color Filter #1 White-Green-White-Blue 10-bit packed";
+    case SCF1WGWB12:                              return "Sparse Color Filter #1 White-Green-White-Blue 12-bit unpacked";
+    case SCF1WGWB12p:                             return "Sparse Color Filter #1 White-Green-White-Blue 12-bit packed";
+    case SCF1WGWB14:                              return "Sparse Color Filter #1 White-Green-White-Blue 14-bit unpacked";
+    case SCF1WGWB16:                              return "Sparse Color Filter #1 White-Green-White-Blue 16-bit";
+    case SCF1WGWR8:                               return "Sparse Color Filter #1 White-Green-White-Red 8-bit";
+    case SCF1WGWR10:                              return "Sparse Color Filter #1 White-Green-White-Red 10-bit unpacked";
+    case SCF1WGWR10p:                             return "Sparse Color Filter #1 White-Green-White-Red 10-bit packed";
+    case SCF1WGWR12:                              return "Sparse Color Filter #1 White-Green-White-Red 12-bit unpacked";
+    case SCF1WGWR12p:                             return "Sparse Color Filter #1 White-Green-White-Red 12-bit packed";
+    case SCF1WGWR14:                              return "Sparse Color Filter #1 White-Green-White-Red 14-bit unpacked";
+    case SCF1WGWR16:                              return "Sparse Color Filter #1 White-Green-White-Red 16-bit";
+    case SCF1WRWG8:                               return "Sparse Color Filter #1 White-Red-White-Green 8-bit";
+    case SCF1WRWG10:                              return "Sparse Color Filter #1 White-Red-White-Green 10-bit unpacked";
+    case SCF1WRWG10p:                             return "Sparse Color Filter #1 White-Red-White-Green 10-bit packed";
+    case SCF1WRWG12:                              return "Sparse Color Filter #1 White-Red-White-Green 12-bit unpacked";
+    case SCF1WRWG12p:                             return "Sparse Color Filter #1 White-Red-White-Green 12-bit packed";
+    case SCF1WRWG14:                              return "Sparse Color Filter #1 White-Red-White-Green 14-bit unpacked";
+    case SCF1WRWG16:                              return "Sparse Color Filter #1 White-Red-White-Green 16-bit";
+    case YCbCr8:                                  return "YCbCr 4:4:4 8-bit";
+    case YCbCr8_CbYCr:                            return "YCbCr 4:4:4 8-bit";
+    case YCbCr10_CbYCr:                           return "YCbCr 4:4:4 10-bit unpacked";
+    case YCbCr10p_CbYCr:                          return "YCbCr 4:4:4 10-bit packed";
+    case YCbCr12_CbYCr:                           return "YCbCr 4:4:4 12-bit unpacked";
+    case YCbCr12p_CbYCr:                          return "YCbCr 4:4:4 12-bit packed";
+    case YCbCr411_8:                              return "YCbCr 4:1:1 8-bit";
+    case YCbCr411_8_CbYYCrYY:                     return "YCbCr 4:1:1 8-bit";
+    case YCbCr420_8_YY_CbCr_Semiplanar:           return "YCbCr 4:2:0 8-bit YY/CbCr Semiplanar";
+    case YCbCr420_8_YY_CrCb_Semiplanar:           return "YCbCr 4:2:0 8-bit YY/CrCb Semiplanar";
+    case YCbCr422_8:                              return "YCbCr 4:2:2 8-bit";
+    case YCbCr422_8_CbYCrY:                       return "YCbCr 4:2:2 8-bit";
+    case YCbCr422_8_YY_CbCr_Semiplanar:           return "YCbCr 4:2:2 8-bit YY/CbCr Semiplanar";
+    case YCbCr422_8_YY_CrCb_Semiplanar:           return "YCbCr 4:2:2 8-bit YY/CrCb Semiplanar";
+    case YCbCr422_10:                             return "YCbCr 4:2:2 10-bit unpacked";
+    case YCbCr422_10_CbYCrY:                      return "YCbCr 4:2:2 10-bit unpacked";
+    case YCbCr422_10p:                            return "YCbCr 4:2:2 10-bit packed";
+    case YCbCr422_10p_CbYCrY:                     return "YCbCr 4:2:2 10-bit packed";
+    case YCbCr422_12:                             return "YCbCr 4:2:2 12-bit unpacked";
+    case YCbCr422_12_CbYCrY:                      return "YCbCr 4:2:2 12-bit unpacked";
+    case YCbCr422_12p:                            return "YCbCr 4:2:2 12-bit packed";
+    case YCbCr422_12p_CbYCrY:                     return "YCbCr 4:2:2 12-bit packed";
+    case YCbCr601_8_CbYCr:                        return "YCbCr 4:4:4 8-bit BT.601";
+    case YCbCr601_10_CbYCr:                       return "YCbCr 4:4:4 10-bit unpacked BT.601";
+    case YCbCr601_10p_CbYCr:                      return "YCbCr 4:4:4 10-bit packed BT.601";
+    case YCbCr601_12_CbYCr:                       return "YCbCr 4:4:4 12-bit unpacked BT.601";
+    case YCbCr601_12p_CbYCr:                      return "YCbCr 4:4:4 12-bit packed BT.601";
+    case YCbCr601_411_8_CbYYCrYY:                 return "YCbCr 4:1:1 8-bit BT.601";
+    case YCbCr601_422_8:                          return "YCbCr 4:2:2 8-bit BT.601";
+    case YCbCr601_422_8_CbYCrY:                   return "YCbCr 4:2:2 8-bit BT.601";
+    case YCbCr601_422_10:                         return "YCbCr 4:2:2 10-bit unpacked BT.601";
+    case YCbCr601_422_10_CbYCrY:                  return "YCbCr 4:2:2 10-bit unpacked BT.601";
+    case YCbCr601_422_10p:                        return "YCbCr 4:2:2 10-bit packed BT.601";
+    case YCbCr601_422_10p_CbYCrY:                 return "YCbCr 4:2:2 10-bit packed BT.601";
+    case YCbCr601_422_12:                         return "YCbCr 4:2:2 12-bit unpacked BT.601";
+    case YCbCr601_422_12_CbYCrY:                  return "YCbCr 4:2:2 12-bit unpacked BT.601";
+    case YCbCr601_422_12p:                        return "YCbCr 4:2:2 12-bit packed BT.601";
+    case YCbCr601_422_12p_CbYCrY:                 return "YCbCr 4:2:2 12-bit packed BT.601";
+    case YCbCr709_8_CbYCr:                        return "YCbCr 4:4:4 8-bit BT.709";
+    case YCbCr709_10_CbYCr:                       return "YCbCr 4:4:4 10-bit unpacked BT.709";
+    case YCbCr709_10p_CbYCr:                      return "YCbCr 4:4:4 10-bit packed BT.709";
+    case YCbCr709_12_CbYCr:                       return "YCbCr 4:4:4 12-bit unpacked BT.709";
+    case YCbCr709_12p_CbYCr:                      return "YCbCr 4:4:4 12-bit packed BT.709";
+    case YCbCr709_411_8_CbYYCrYY:                 return "YCbCr 4:1:1 8-bit BT.709";
+    case YCbCr709_422_8:                          return "YCbCr 4:2:2 8-bit BT.709";
+    case YCbCr709_422_8_CbYCrY:                   return "YCbCr 4:2:2 8-bit BT.709";
+    case YCbCr709_422_10:                         return "YCbCr 4:2:2 10-bit unpacked BT.709";
+    case YCbCr709_422_10_CbYCrY:                  return "YCbCr 4:2:2 10-bit unpacked BT.709";
+    case YCbCr709_422_10p:                        return "YCbCr 4:2:2 10-bit packed BT.709";
+    case YCbCr709_422_10p_CbYCrY:                 return "YCbCr 4:2:2 10-bit packed BT.709";
+    case YCbCr709_422_12:                         return "YCbCr 4:2:2 12-bit unpacked BT.709";
+    case YCbCr709_422_12_CbYCrY:                  return "YCbCr 4:2:2 12-bit unpacked BT.709";
+    case YCbCr709_422_12p:                        return "YCbCr 4:2:2 12-bit packed BT.709";
+    case YCbCr709_422_12p_CbYCrY:                 return "YCbCr 4:2:2 12-bit packed BT.709";
+    case YCbCr2020_8_CbYCr:                       return "YCbCr 4:4:4 8-bit BT.2020";
+    case YCbCr2020_10_CbYCr:                      return "YCbCr 4:4:4 10-bit unpacked BT.2020";
+    case YCbCr2020_10p_CbYCr:                     return "YCbCr 4:4:4 10-bit packed BT.2020";
+    case YCbCr2020_12_CbYCr:                      return "YCbCr 4:4:4 12-bit unpacked BT.2020";
+    case YCbCr2020_12p_CbYCr:                     return "YCbCr 4:4:4 12-bit packed BT.2020";
+    case YCbCr2020_411_8_CbYYCrYY:                return "YCbCr 4:1:1 8-bit BT.2020";
+    case YCbCr2020_422_8:                         return "YCbCr 4:2:2 8-bit BT.2020";
+    case YCbCr2020_422_8_CbYCrY:                  return "YCbCr 4:2:2 8-bit BT.2020";
+    case YCbCr2020_422_10:                        return "YCbCr 4:2:2 10-bit unpacked BT.2020";
+    case YCbCr2020_422_10_CbYCrY:                 return "YCbCr 4:2:2 10-bit unpacked BT.2020";
+    case YCbCr2020_422_10p:                       return "YCbCr 4:2:2 10-bit packed BT.2020";
+    case YCbCr2020_422_10p_CbYCrY:                return "YCbCr 4:2:2 10-bit packed BT.2020";
+    case YCbCr2020_422_12:                        return "YCbCr 4:2:2 12-bit unpacked BT.2020";
+    case YCbCr2020_422_12_CbYCrY:                 return "YCbCr 4:2:2 12-bit unpacked BT.2020";
+    case YCbCr2020_422_12p:                       return "YCbCr 4:2:2 12-bit packed BT.2020";
+    case YCbCr2020_422_12p_CbYCrY:                return "YCbCr 4:2:2 12-bit packed BT.2020";
+    case YUV8_UYV:                                return "YUV 4:4:4 8-bit";
+    case YUV411_8_UYYVYY:                         return "YUV 4:1:1 8-bit";
+    case YUV422_8:                                return "YUV 4:2:2 8-bit";
+    case YUV422_8_UYVY:                           return "YUV 4:2:2 8-bit";
+    case Mono10Packed:                            return "Monochrome 10-bit packed";
+    case Mono12Packed:                            return "Monochrome 12-bit packed";
+    case BayerBG10Packed:                         return "Bayer Blue-Green 10-bit packed";
+    case BayerBG12Packed:                         return "Bayer Blue-Green 12-bit packed";
+    case BayerGB10Packed:                         return "Bayer Green-Blue 10-bit packed";
+    case BayerGB12Packed:                         return "Bayer Green-Blue 12-bit packed";
+    case BayerGR10Packed:                         return "Bayer Green-Red 10-bit packed";
+    case BayerGR12Packed:                         return "Bayer Green-Red 12-bit packed";
+    case BayerRG10Packed:                         return "Bayer Red-Green 10-bit packed";
+    case BayerRG12Packed:                         return "Bayer Red-Green 12-bit packed";
+    case RGB10V1Packed:                           return "Red-Green-Blue 10-bit packed - variant 1";
+    case RGB12V1Packed:                           return "Red-Green-Blue 12-bit packed - variant 1";
+
+    case InvalidPixelFormat: return "Invalid pixel format value";
+
+    default: return "Unknown pixel format value";
+  }
+}
+#endif /* PFNC_INCLUDE_HELPERS */
+
+
+#endif /* PFNC_H */
diff --git a/Common_Class/Matrox/Include/MILDyn/mil3ddisp.h b/Common_Class/Matrox/Include/MILDyn/mil3ddisp.h
new file mode 100644
index 0000000..bd8cfd7
--- /dev/null
+++ b/Common_Class/Matrox/Include/MILDyn/mil3ddisp.h
@@ -0,0 +1,524 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MIL3DDISP.H
+// Content           :  Define for the MIL 3DDISP module
+// Revision          :  10.40.0640
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+
+#ifndef __MIL3DDISP_H__
+#define __MIL3DDISP_H__
+
+// None of this should clash with disp (2d) controls so that if we want to forward them to the
+// 2d display it will be trivial. Should also reuse creation types from 2d.
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+   extern "C"
+      {
+#endif
+
+typedef MIL_INT(MFTYPE *MIL_3DDISP_HOOK_FUNCTION_PTR)(MIL_INT HookType,
+                                                     MIL_ID  EventId,
+                                                     void    *UserDataPtr);
+
+#define M_VTK_TRACKBALL                                        0x00000002L                                         
+#define M_VTK_TERRAIN                                          0x00000003L 
+#define M_TEST_OPENGL                                          0x00000004L 
+#define M_VTK_WINDOW                                           0x00000020L // Reserved in mildisplay.h
+
+// M3ddispSelect  
+#define M_OPEN                                                 0x00000010L // Already defined from mil.h
+#define M_CLOSE                                                0x00000020L // Already defined from mil.h
+#define M_ADD                                                  0x0000L     // Already defined in milocr.h, milim.h
+#define M_REMOVE                                               0x00000004L // Already defined in milim.h
+#define M_SELECT                                               3977L
+
+// These should not clash with disp2d
+// M3ddispAlloc
+//#define M_WINDOWED_DISPLAY                                     0L
+#define M_MIL_BUFFER_WINDOW                                    2L
+#define M_WEB                                                  0x00800000L // Already defined in mil.h, mildisplay.h
+
+// M3ddispControl types
+#define M_3D_GRAPHIC_LIST_ID                                    4111
+#define M_ROTATION_INDICATOR                                    4627
+#define M_BACKGROUND_IMAGE                                      4628
+#define M_BACKGROUND_IMAGE_SIZE_X                               4629
+#define M_BACKGROUND_IMAGE_SIZE_Y                               4630
+#define M_BACKGROUND_IMAGE_SIZE_BAND                            4631
+#define M_AUTO_ROTATE                                           4633
+#define M_ROTATION_SPEED                                        4634
+#define M_ROTATION_AXIS                                         4636
+
+#define M_ACTION_KEY_TRANSLATE_FORWARD                          4638
+#define M_ACTION_KEY_TRANSLATE_BACKWARD                         4639
+#define M_ACTION_KEY_TRANSLATE_DOWN                             2755L
+#define M_ACTION_KEY_TRANSLATE_LEFT                             2756L
+#define M_ACTION_KEY_TRANSLATE_RIGHT                            2757L
+#define M_ACTION_KEY_TRANSLATE_UP                               2758L
+#define M_ACTION_KEY_ROLL_LEFT                                  4640
+#define M_ACTION_KEY_ROLL_RIGHT                                 4641
+#define M_ACTION_KEY_ORBIT_LEFT                                 4642
+#define M_ACTION_KEY_ORBIT_RIGHT                                4643
+#define M_ACTION_KEY_ORBIT_UP                                   4644
+#define M_ACTION_KEY_ORBIT_DOWN                                 4645
+#define M_ACTION_KEY_TURN_LEFT                                  4646
+#define M_ACTION_KEY_TURN_RIGHT                                 4647
+#define M_ACTION_KEY_TURN_UP                                    4648
+#define M_ACTION_KEY_TURN_DOWN                                  4649
+#define M_ACTION_KEY_ZOOM_IN                                    4650
+#define M_ACTION_KEY_ZOOM_OUT                                   4651
+#define M_ACTION_KEY_RESET                                      4652
+#define M_ALTERNATE_SPEED_FACTOR                                4653
+#define M_BACKGROUND_COLOR_GRADIENT                             4654
+#define M_ACTION_KEY_AUTO_ROTATE                                4658
+#define M_ACTION_KEY_ORIENTATION_TOP_VIEW                       4659
+#define M_ACTION_KEY_ORIENTATION_BOTTOM_VIEW                    4660
+#define M_ACTION_KEY_ORIENTATION_FRONT_VIEW                     4661
+#define M_ACTION_KEY_ORIENTATION_REAR_VIEW                      4662
+#define M_ACTION_KEY_ORIENTATION_LEFT_VIEW                      4663
+#define M_ACTION_KEY_ORIENTATION_RIGHT_VIEW                     4664
+#define M_ACTION_KEY_ORIENTATION_TOP_TILTED                     4665
+#define M_ACTION_KEY_ORIENTATION_BOTTOM_TILTED                  4666
+
+#define M_ACTION_MODIFIER_SPEED                       		    2759L
+
+#define M_DISP_CONTROL_START                                    10000L                              // Already defined in mildisplay.h (10000L)
+#define M_BACKGROUND_COLOR                                      (M_DISP_CONTROL_START+66L)          // Already defined in mildisplay.h (10066) M_LOCAL_DISPLAY_CONTROL
+#define M_TITLE                                                 (7702L|M_CLIENT_ENCODING)           // Already defined in mildisplay.h M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SYNC                                          (M_DISP_CONTROL_START+47L)          // Already defined in mildisplay.h (10047) M_LOCAL_DISPLAY_CONTROL
+#define M_QT_MODE                                               (M_DISP_CONTROL_START+151L)         // already defined in mildisplay.h (10151) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURSOR                                         (M_DISP_CONTROL_START+199L)         // already defined in mildisplay.h (10199) M_LOCAL_DISPLAY_CONTROL
+#define M_SELECTED                                              1103L //M_REMOTE_DISPLAY_CONTROL   // Already defined in mildisplay.h
+#define M_DISPLAY_SURFACE                                       1121L                              // Already defined in mildisplay.h M_LOCAL_DISPLAY_CONTROL          
+#define M_WPF_DISPLAY_BUFFER_ID                                 M_DISPLAY_SURFACE                  // Already defined in mildisplay.h           
+#define M_WINDOW_INITIAL_POSITION_X                             3088L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_WINDOW_INITIAL_POSITION_Y                             3089L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_WINDOW_HANDLE                                         3110L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_MOUSE_USE                                             3219L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_KEYBOARD_USE                                          3155L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_SAVE_INTERNAL_BUFFERS                                (M_DISP_CONTROL_START+26L) //(10026) M_LOCAL_DISPLAY_CONTROL Already defined in mildisplay.h
+
+#define M_BACKGROUND_MODE                                       12L //already defined
+#define M_SINGLE_COLOR                                          3969 
+#define M_GRADIENT_VERTICAL                                     3970
+#define M_STRING_SIZE                                    MAKE_INT64(0x0000050000000000)
+#define M_UPDATE                                                3199L                     //M_REMOTE_DISPLAY_CONTROL defined in mildisplay.h
+#define M_SIZE_X                                                1536L       // Already defined in    milcode.h, mil.h
+#define M_SIZE_Y                                                1537L       // Already defined in    milcode.h, mil.h
+#define M_ENABLE_ON_MOUSE_CLICK                                 3973L
+                                                                                                              
+// M3ddispControl
+// MIL_DOUBLE
+#define M_FOV_HORIZONTAL_ANGLE                                  4667
+#define M_FOV_VERTICAL_ANGLE                                    4668
+
+// List of 2d values that are whitelisted
+#ifdef __cplusplus       
+      inline bool In2dDisplayControlsWhiteList(MIL_INT64 ControlType)
+         {
+         switch(ControlType)
+            {
+            case M_QT_MODE:
+            case M_WPF_DISPLAY_BUFFER_ID:
+            case M_DISPLAY_SYNC:
+            case M_WINDOW_CURSOR:
+            case M_WINDOW_HANDLE:
+            case M_SELECTED:
+            case M_SAVE_INTERNAL_BUFFERS:
+               return true;
+            default:
+               return false;
+
+            }
+         }
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+//Dispcontrol values
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define M_RED                                                            0x08L
+#define M_GREEN                                                          0x10L
+#define M_BLUE                                                           0x20L
+
+#define M_ENABLE                                                        -9997L                              // Already defined in    milblob.h, milcal.h, milmeas.h, mil.h, miledge.h
+#define M_DISABLE                                                       -9999L                              // Already defined in    milblob.h, milcal.h, milmeas.h, mil.h, miledge.h
+
+#define M_NOW                                                              29L
+#define M_ALLOCATION_FAILURE_REAL_TEST_FLAG                               971L // Also in milblob.h
+////////////////////////////////////////////////////////////////////////////////
+
+// M3ddispSet/GetViewpoint
+#define M_VIEW_MATRIX                                                    4161L
+#define M_TRAVEL                                                         4162L
+#define M_VIEWPOINT                                                      4163L
+#define M_INTEREST_POINT                                                 4164L
+#define M_UP_VECTOR                                                      4165L
+#define M_VIEW_BOX                                                       4166L
+#define M_NO_REFRESH                                                     4167L
+#define M_TOP_VIEW                                                       4168L
+#define M_BOTTOM_VIEW                                                    4169L
+#define M_LEFT_VIEW                                                      4170L
+#define M_RIGHT_VIEW                                                     4171L
+#define M_FRONT_VIEW                                                     4172L
+#define M_REAR_VIEW                                                      4173L
+#define M_TOP_TILTED                                                     4174L
+#define M_BOTTOM_TILTED                                                  4175L
+#define M_ORBIT_HORIZONTAL                                               4177L
+#define M_ORBIT_VERTICAL                                                 4178L
+#define M_AZIM_ELEV_ROLL                                                    4L  // already defined in milreg.h
+#define M_TRANSLATE                                                         5L  // already defined in mil.h
+#define M_DISTANCE                                                 0x00080000L  // already defined in milim.h
+#define M_FLIP                                                     0x00010000L  // already defined in milim.h
+#define M_ELEVATION                                                        49L  // already defined in milreg.h
+#define M_AZIMUTH                                                          50L  // already defined in milreg.h
+#define M_ROLL                                                             51L  // already defined in milreg.h
+#define M_VIEW_ORIENTATION                                         0x00200000L
+#define M_TRANSFORM_TYPES_SHIFT                                             8L  // =utilities=   (also defined in milcal.h)
+#define M_MOVE_INTEREST_POINT                     (128 << M_TRANSFORM_TYPES_SHIFT)
+////////////////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+// Hook values
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define M_OBJ_HOOK_MODULE_RANGE_START                 0x00000FE00L    // Already defined in mil.h
+#define M_OBJ_HOOK_MODULE_RANGE_END                   0x00000FFFFL    // Already defined in mil.h
+
+// 3ddisplay hook
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+   // M3ddisp calls
+   void      MFTYPE M3ddispControlInt64(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_INT64 ControlValue);
+   void      MFTYPE M3ddispControlDouble(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue);
+   void      MFTYPE M3ddispFree(MIL_ID Disp3dId);
+   MIL_INT64 MFTYPE M3ddispInquire(MIL_ID Disp3dId, MIL_INT64 InquireType, void *UserVarPtr);
+   MIL_INT64 MFTYPE M3ddispSelect(MIL_ID Disp3dId, MIL_ID ContainerOrImageBufId, MIL_INT64 Option, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3ddispSelectWindow(MIL_ID Disp3dId, MIL_ID ContainerOrImageBufId, MIL_INT64 Option, MIL_INT64 ControlFlag, MIL_WINDOW_HANDLE ClientWindowHandle);
+   void      MFTYPE M3ddispSetViewDouble(MIL_ID Disp3dId, MIL_INT64 Mode, const MIL_DOUBLE Param1, const MIL_DOUBLE Param2, const MIL_DOUBLE Param3, MIL_INT64   ControlFlag);
+   void      MFTYPE M3ddispGetView(MIL_ID Disp3dId, MIL_INT64 Mode, MIL_DOUBLE* Param1Ptr, MIL_DOUBLE* Param2Ptr, MIL_DOUBLE* Param3Ptr, MIL_INT64   ControlFlag);
+   void      MFTYPE M3ddispCopy(MIL_ID SrcMilObjectId, MIL_ID DstMilObjectId, MIL_INT64 CopyType, MIL_INT64 ControlFlag);
+   void      MFTYPE M3ddispMessage(MIL_ID Disp3dId, MIL_INT64 EventType, MIL_INT64 MousePositionX, MIL_INT64 MousePositionY, MIL_INT64 EventValue, MIL_INT64 CombinationKeys, MIL_INT64 UserValue);
+   void      MFTYPE M3ddispHookFunction(MIL_ID Disp3dId, MIL_INT HookType, MIL_3DDISP_HOOK_FUNCTION_PTR HookHandlerPtr, void* UserDataPtr);
+   MIL_INT64 MFTYPE M3ddispGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+
+   // For CAPI calls with strings
+#if M_MIL_USE_UNICODE
+   MIL_ID    MFTYPE M3ddispAllocA(MIL_ID SysId, MIL_INT64 DispNum, MIL_CONST_TEXTA_PTR DispFormat, MIL_INT64 InitFlag, MIL_ID *Disp3dIdPtr);
+   MIL_ID    MFTYPE M3ddispAllocW(MIL_ID SysId, MIL_INT64 DispNum, MIL_CONST_TEXTW_PTR DispFormat, MIL_INT64 InitFlag, MIL_ID *Disp3dIdPtr);
+
+   // create default calls
+#if M_MIL_UNICODE_API
+#define M3ddispAlloc M3ddispAllocW
+#else
+#define M3ddispAlloc M3ddispAllocA
+#endif
+
+#else
+   MIL_ID    MFTYPE M3ddispAlloc(MIL_ID SysId, MIL_INT64 DispNum, MIL_CONST_TEXT_PTR DispFormat, MIL_INT64 InitFlag, MIL_ID *Display3dIdPtr);
+#endif
+
+#ifdef __cplusplus
+   inline bool In3ddispInquireDoubleRange(MIL_INT64 InquireType)
+      {
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         {
+         return false;
+         }
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_ALLOCATION_FAILURE_REAL_TEST_FLAG:
+         case M_FOV_HORIZONTAL_ANGLE:
+         case M_FOV_VERTICAL_ANGLE:
+         case M_ALTERNATE_SPEED_FACTOR:
+         case M_ROTATION_SPEED:
+         {
+         return true;
+         }
+
+         default:
+         {
+         break;
+         }
+         }
+
+      return false;
+      }
+   inline bool In3ddispInquireIdRange(MIL_INT64 InquireType)
+      {
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_3D_GRAPHIC_LIST_ID:
+            return true;
+
+         default:
+            break;
+         }
+      return false;
+      }
+   inline bool In3ddispInquireStringRange(MIL_INT64 InquireType)
+      {
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         {
+         return false;
+         }
+
+      switch(M_STRIP_CLIENT_TEXT_ENCODING(M_STRIP_INQ_COMBOFLAGS(InquireType)))
+         {
+         case M_STRIP_CLIENT_TEXT_ENCODING(M_TITLE):
+         {
+         return true;
+         }
+
+         default:
+         {
+         break;
+         }
+         }
+
+      return false;
+      }
+   inline bool In3ddispInquireInt64Range(MIL_INT64 InquireType)
+      {
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_BACKGROUND_COLOR:
+            return true;
+
+         default:
+            break;
+         }
+
+      return false;
+      }
+   inline bool M3ddispInquireMustHaveUserPtr(MIL_INT64 InquireType)
+      {
+      const MIL_INT64 ForcedDataType = MinquireOverrides(M_STRIP_HLVLDATATYPE(InquireType), M_TYPE_MIL_INT);
+      if(ForcedDataType != 0)
+         {
+         return false;
+         }
+      return In3ddispInquireStringRange(InquireType) || In3ddispInquireDoubleRange(InquireType);
+      }
+   #endif // __cplusplus
+   /* C++ directive if needed */
+#ifdef __cplusplus
+   }
+#endif
+
+#ifdef __cplusplus
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
+   {
+   M3ddispControlDouble(Disp3dId, ControlType, ControlValue);
+   }
+
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_INT64 ControlValue)
+   {
+   M3ddispControlInt64(Disp3dId, ControlType, ControlValue);
+   }
+
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   M3ddispControlInt64(Disp3dId, ControlType, ControlValue);
+   }
+
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, int ControlValue)
+   {
+   M3ddispControlInt64(Disp3dId, ControlType, ControlValue);
+   }
+#endif
+
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   M3ddispControl(Disp3dId, ControlType, (MIL_INT)ControlValue);
+   }
+#else
+#define M3ddispControl      M3ddispControlDouble
+#endif
+
+#ifdef __cplusplus
+inline MIL_INT64 M3ddispInquireDataType(MIL_INT64 InquireType)
+   {
+   const MIL_INT64 ForcedDataType = MinquireOverrides(InquireType, M_TYPE_MIL_INT);
+   if(ForcedDataType != 0)
+      return ForcedDataType;
+  
+   if(In3ddispInquireIdRange(InquireType))
+      {
+      return M_TYPE_MIL_ID;
+      }
+   if(In3ddispInquireStringRange(InquireType))
+      {
+      return M_TYPE_TEXT_CHAR;
+      }
+   if(In3ddispInquireInt64Range(InquireType))
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   if(In3ddispInquireDoubleRange(InquireType))
+      {
+      return M_TYPE_MIL_DOUBLE;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+#if M_MIL_USE_SAFE_TYPE
+// ----------------------------------------------------------
+// M3ddispInquire
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   bool MustHaveUserPointer = M3ddispInquireMustHaveUserPtr(InquireType);
+
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("M3ddispInquire"));
+
+   if(!UserVarPtr && MustHaveUserPointer)
+      SafeTypeError(MIL_TEXT("M3ddispInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+   return M3ddispInquire(Disp3dId, InquireType, NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   bool MustHaveUserPointer = M3ddispInquireMustHaveUserPtr(InquireType);
+
+   if(MustHaveUserPointer)
+      SafeTypeError(MIL_TEXT("M3ddispInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+   return M3ddispInquire(Disp3dId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT64 MFTYPE M3ddispInquireSafeTypeExecute(MIL_ID Disp3dId, MIL_INT64  InquireType, void  *UserVarPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64 RequiredType = M_NULL;
+   // Looking for M_TYPE flags
+   RequiredType = M3ddispInquireDataType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if(RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("M3ddispInquire"));
+      }
+
+   return M3ddispInquire(Disp3dId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT64 MFTYPE M3ddispInquireUnsafe(MIL_ID Disp3dId, MIL_INT64  InquireType, void        *UserVarPtr) { return M3ddispInquire(Disp3dId, InquireType, UserVarPtr); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_INT8*   UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_CHAR); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_INT16*  UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_INT32   *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_INT64   *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_FLOAT   *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_FLOAT); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_DOUBLE  *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_DOUBLE); }
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_UINT8*   UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_CHAR); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_UINT16*  UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_UINT32  *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_UINT64  *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T                                                      
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, wchar_t*    UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR); }
+#endif
+
+#define M3ddispInquire          M3ddispInquireSafeType
+#else // #if M_MIL_USE_SAFE_TYPE
+
+#define M3ddispInquireUnsafe    M3ddispInquire 
+
+#endif // #if M_MIL_USE_SAFE_TYPE
+
+#endif //__cplusplus
+
+#if M_MIL_USE_STRING
+inline MIL_ID    MFTYPE M3ddispAlloc(MIL_ID SysId, MIL_INT64 DispNum, const MIL_STRING& ControlFlag, MIL_INT64 InitFlag, MIL_ID *Display3dIdPtr)
+   {
+   return M3ddispAlloc(SysId, DispNum, ControlFlag.c_str(), InitFlag, Display3dIdPtr);
+   }
+#if M_MIL_USE_SAFE_TYPE
+
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_STRING& UserVarPtr)
+   {
+   MIL_INT64 RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   if(!In3ddispInquireStringRange(InquireType))
+      {
+      SafeTypeError(MIL_TEXT("M3ddispInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+
+   M3ddispInquire(Disp3dId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = M3ddispInquire(Disp3dId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+
+      }
+
+   return RetValue;
+   }
+#else
+inline MIL_INT64 MFTYPE M3ddispInquire(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_STRING& UserVarPtr)
+   {
+   MIL_INT64 RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   M3ddispInquire(Disp3dId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = M3ddispInquire(Disp3dId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif // #if M_MIL_USE_SAFE_TYPE
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+   M3ddispControl(Disp3dId, ControlType, M_PTR_TO_MIL_INT(ControlValue.c_str()));
+   }
+
+#endif /* M_MIL_USE_STRING */
+// Automatic double casting
+#define M3ddispSetView(Disp3dId, Mode, Param1, Param2, Param3, ControlFlag) \
+        M3ddispSetViewDouble(Disp3dId, Mode, M_MILID_TO_DOUBLE(Param1), M_MILID_TO_DOUBLE(Param2), M_MILID_TO_DOUBLE(Param3), ControlFlag)
+////////////////////////////////////////////////////////////////////////////////
+//  MIL_UNIQUE_ID  support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+#if M_MIL_USE_SAFE_TYPE
+template <> inline bool MilIsCorrectObjectType<&M3ddispFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_3D_DISPLAY;;
+   }
+#endif
+typedef MIL_UNIQUE_ID<&M3ddispFree> MIL_UNIQUE_3DDISP_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+//3DDISP
+inline MIL_UNIQUE_3DDISP_ID M3ddispAlloc(MIL_ID SysId, MIL_INT DispNum, MIL_CONST_TEXT_PTR ControlFlag, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_3DDISP_ID(M3ddispAlloc(SysId, DispNum, ControlFlag, InitFlag, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void M3ddispFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+// End of MIL_UNIQUE_ID support
+
+#endif // __MIL3DDISP_H__
diff --git a/Common_Class/Matrox/Include/MILDyn/mil3dgeo.h b/Common_Class/Matrox/Include/MILDyn/mil3dgeo.h
new file mode 100644
index 0000000..cb27025
--- /dev/null
+++ b/Common_Class/Matrox/Include/MILDyn/mil3dgeo.h
@@ -0,0 +1,740 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MIL3DGEO.H
+// Content           :  Define for the MIL 3D module
+// Revision          :  10.40.0640
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+
+#ifndef __MIL3DGEO_H__
+#define __MIL3DGEO_H__
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+// M3DGEO
+////////////////////////////////////////////////////////////////////////////////////////////////
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+   {
+#endif
+#define M_GEOMETRY_TYPE                                     1321L 
+#define M_GEOMETRY                                          1306L // Already defined
+#define M_PLANE                                             1353L // Already defined in 3dmap
+#define M_SPHERE                                            2931L
+#define M_CYLINDER                                          3656
+#define M_BOX                                               0x101L      // Already defined in    milblob.h
+#define M_LINE                                         0x00000080L   // Already defined
+#define M_UNCHANGED                                    0x40000005L // Already defined
+//BoX
+#define M_SIZE_X                                            1536L    //Already defined elsewhere
+#define M_SIZE_Y                                            1537L    //Already defined elsewhere
+#define M_SIZE_Z                                            1538L // also in mil.h
+#define M_AXIS_ALIGNED                                 0x00040000 // Already defined in mil.h
+#define M_BOX_ORIENTATION                                    3814
+#define M_CORNER_X(N)                                     (1221L + (N)+ ((N) > 3 ? 2595 : 0))
+#define M_CORNER_Y(N)                                     (1225L + (N)+ ((N) > 3 ? 2595 : 0))
+#define M_CORNER_Z(N)                                     (3828+(N))
+#define M_CORNER_X_ALL                                     3847                     
+#define M_CORNER_Y_ALL                                     3848
+#define M_CORNER_Z_ALL                                     3849
+#define M_UNROTATED_MIN_X                                  3850
+#define M_UNROTATED_MIN_Y                                  3851
+#define M_UNROTATED_MIN_Z                                  3852
+#define M_UNROTATED_MAX_X                                  3853
+#define M_UNROTATED_MAX_Y                                  3854
+#define M_UNROTATED_MAX_Z                                  3855
+#define M_ORIENTATION_UNCHANGED                            0x8000L
+//Plane type
+#define M_COEFFICIENTS                                       3388
+#define M_POINT_AND_NORMAL                                   3389
+#define M_THREE_POINTS                                       3390
+#define M_POINT_AND_TWO_VECTORS                              3391
+//Sphere
+#define M_CENTER_Z                                           3400
+#define M_RADIUS                                       0x00000040L       // Already defined in MilMod.h
+//Plane
+#define M_COEFFICIENT_A                                     3401
+#define M_COEFFICIENT_B                                     3402
+#define M_COEFFICIENT_C                                     3403
+#define M_COEFFICIENT_D                                     3404
+#define M_NORMAL_X                                          3537
+#define M_NORMAL_Y                                          3538
+#define M_NORMAL_Z                                          3539
+#define M_CLOSEST_TO_ORIGIN_X                               3540
+#define M_CLOSEST_TO_ORIGIN_Y                               3541
+#define M_CLOSEST_TO_ORIGIN_Z                               3542
+//Cylinder
+#define M_TWO_POINTS                                        3657
+#define M_START_POINT_X                                     3658
+#define M_START_POINT_Y                                     3659                               
+#define M_START_POINT_Z                                     3660
+#define M_END_POINT_X                                       3661
+#define M_END_POINT_Y                                       3662
+#define M_END_POINT_Z                                       3663
+#define M_AXIS_X                                            3664
+#define M_AXIS_Y                                            3665
+#define M_AXIS_Z                                            3666
+#define M_INFINITE                                            -1L // Also defined in Mil.h
+#define M_POINT_AND_VECTOR                                  4670
+//SetMatrix
+#define M_TRANSFORMATION_MATRIX                               72L  // Already defined in milreg.h
+#define M_TRANSFORM_TYPES_SHIFT                   8L  // =utilities=   (also defined in milcal.h)
+#define M_ASSIGN                                (1 << M_TRANSFORM_TYPES_SHIFT)      /* (also defined in milcal.h) */
+#define M_COMPOSE_WITH_CURRENT                  (2 << M_TRANSFORM_TYPES_SHIFT)      /* (also defined in milcal.h) */
+
+
+#define M_TRANSFORMATION_TYPE                                      3L    // Already defined in Milreg.h
+#define M_INVERSE                                             0x00100
+#define M_IDENTITY                                           6L // already defined in milcal.h
+#define M_TRANSLATION                                        1L // already defined in milcal.h 
+#define M_ROTATION                                           3410
+#define M_RIGID                                              3411 
+#define M_SCALE_UNIFORM                                      3413   
+#define M_SIMILARITY                                         3415
+#define M_AFFINE                                             3416
+#define M_PROJECTION                                         3417
+#define M_COMPOSE_TWO_MATRICES                               3766
+#define M_ROTATION_AXIS_ANGLE                                  2L // already defined in milcal.h
+#define M_ROTATION_QUATERNION                                  3L // already defined in milcal.h
+#define M_ROTATION_X                                           7L // already defined in milcal.h
+#define M_ROTATION_Y                                           8L // already defined in milcal.h
+#define M_ROTATION_Z                                           9L // already defined in milcal.h
+#define M_ROTATION_YXZ                                         4L // already defined in milcal.h
+#define M_ROTATION_XYZ                                        10L // already defined in milcal.h
+#define M_ROTATION_XZY                                        11L // already defined in milcal.h
+#define M_ROTATION_YZX                                        12L // already defined in milcal.h
+#define M_ROTATION_ZXY                                        13L // already defined in milcal.h
+#define M_ROTATION_ZYX                                        14L // already defined in milcal.h
+#define M_ROTATION_AXIS_X                                     17L // already defined in milcal.h
+#define M_ROTATION_AXIS_Y                                     18L // already defined in milcal.h
+#define M_ROTATION_AXIS_Z                                     19L // already defined in milcal.h
+#define M_FIXTURE_TO_PLANE                                    20L // already defined in milcal.h
+#define M_FIXTURE_TO_GEOMETRY                                 21L // already defined in milcal.h
+//MatrixDefine
+#define M_XY_AXES                                           3926L
+#define M_XZ_AXES                                           3927L
+#define M_YX_AXES                                           3928L
+#define M_YZ_AXES                                           3929L
+#define M_ZX_AXES                                           3930L
+#define M_ZY_AXES                                           3931L
+#define M_FORWARD_TRANSFORMATION                      0x00001000L
+#define M_BACKWARD_TRANSFORMATION                     0x00002000L
+//Draw3d
+#define M_ROOT_NODE                                            0
+//Copy
+#define M_ROTATION_AND_SCALE                                 3993
+
+   // CAPI function prototypes
+   MIL_ID  MFTYPE M3dgeoAlloc(MIL_ID     SysId,
+                              MIL_INT64  ObjectType,
+                              MIL_INT64  ControlFlag,
+                              MIL_ID*    GeometryOrMatrix3dgeoIdPtr);
+
+   MIL_DOUBLE MFTYPE M3dgeoInquire(MIL_ID     GeometryOrMatrix3dgeoId,
+                                   MIL_INT64  InquireType,
+                                   void*      UserVarPtr);
+
+   void MFTYPE M3dgeoFree(MIL_ID GeometryOrMatrix3dgeoId);
+
+   void MFTYPE M3dgeoBox(MIL_ID     Geometry3dgeoId,
+                         MIL_INT64  CreationMode,
+                         MIL_DOUBLE XPos1,
+                         MIL_DOUBLE YPos1,
+                         MIL_DOUBLE ZPos1,
+                         MIL_DOUBLE XPos2OrLength,
+                         MIL_DOUBLE YPos2OrLength,
+                         MIL_DOUBLE ZPos2OrLength,
+                         MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoSphere(MIL_ID     Geometry3dgeoId,
+                            MIL_DOUBLE CenterX,
+                            MIL_DOUBLE CenterY,
+                            MIL_DOUBLE CenterZ,
+                            MIL_DOUBLE Radius,
+                            MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoPlane(MIL_ID     Geometry3dgeoId,
+                           MIL_INT64  CreationMode,
+                           MIL_DOUBLE X1,
+                           MIL_DOUBLE Y1,
+                           MIL_DOUBLE Z1,
+                           MIL_DOUBLE X2OrD,
+                           MIL_DOUBLE Y2,
+                           MIL_DOUBLE Z2,
+                           MIL_DOUBLE X3,
+                           MIL_DOUBLE Y3,
+                           MIL_DOUBLE Z3,
+                           MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoCopy(MIL_ID     SrcMilObjectId,
+                          MIL_ID     DstMilObjectId,
+                          MIL_INT64  CopyType,
+                          MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoMatrixSetTransformDouble(MIL_ID     Matrix3dgeoId,
+                                              MIL_INT64  TransformType,
+                                              MIL_DOUBLE Param1,
+                                              MIL_DOUBLE Param2,
+                                              MIL_DOUBLE Param3,
+                                              MIL_DOUBLE Param4,
+                                              MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoMatrixPutDouble(MIL_ID            Matrix3dgeoId,
+                                     MIL_INT64         PutType,
+                                     const MIL_DOUBLE* UserArrayPtr);
+   void MFTYPE M3dgeoMatrixPutFloat(MIL_ID           Matrix3dgeoId,
+                                    MIL_INT64        PutType,
+                                    const MIL_FLOAT* UserArrayPtr);
+
+   void MFTYPE M3dgeoMatrixGetDouble(MIL_ID      Matrix3dgeoId,
+                                     MIL_INT64   GetType,
+                                     MIL_DOUBLE* UserArrayPtr);
+   void MFTYPE M3dgeoMatrixGetFloat(MIL_ID      Matrix3dgeoId,
+                                    MIL_INT64   GetType,
+                                    MIL_FLOAT*  UserArrayPtr);
+
+   void  MFTYPE M3dgeoMatrixGetTransform(MIL_ID     Matrix3dgeoId,
+                                         MIL_INT64  InquireType,
+                                         MIL_DOUBLE *Param1Ptr,
+                                         MIL_DOUBLE *Param2Ptr,
+                                         MIL_DOUBLE *Param3Ptr,
+                                         MIL_DOUBLE *Param4Ptr,
+                                         MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoCylinder(MIL_ID     Geometry3dgeoId,
+                              MIL_INT64  CreationMode,
+                              MIL_DOUBLE XPos1,
+                              MIL_DOUBLE YPos1,
+                              MIL_DOUBLE ZPos1,
+                              MIL_DOUBLE XPos2OrVector,
+                              MIL_DOUBLE YPos2OrVector,
+                              MIL_DOUBLE ZPos2OrVector,
+                              MIL_DOUBLE Radius,
+                              MIL_DOUBLE Length,
+                              MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgeoDraw3d(MIL_ID     OperationDraw3dContext3dgeoId,
+                                 MIL_ID     SrcGeometry3dgeoId,
+                                 MIL_ID     DstList3dgraId,
+                                 MIL_INT64  DstParentLabel,
+                                 MIL_INT64  ControlFlag);
+
+
+   void MFTYPE M3dgeoLine(MIL_ID     Geometry3dgeoId,
+                          MIL_INT64  CreationMode,
+                          MIL_DOUBLE XPos1,
+                          MIL_DOUBLE YPos1,
+                          MIL_DOUBLE ZPos1,
+                          MIL_DOUBLE XPos2OrVector,
+                          MIL_DOUBLE YPos2OrVector,
+                          MIL_DOUBLE ZPos2OrVector,
+                          MIL_DOUBLE Length,
+                          MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoMatrixSetWithAxes(MIL_ID     Matrix3dgeoId,
+                                       MIL_INT64  Mode,
+                                       MIL_DOUBLE OriginX,
+                                       MIL_DOUBLE OriginY,
+                                       MIL_DOUBLE OriginZ,
+                                       MIL_DOUBLE Axis1VectorX,
+                                       MIL_DOUBLE Axis1VectorY,
+                                       MIL_DOUBLE Axis1VectorZ,
+                                       MIL_DOUBLE Axis2VectorX,
+                                       MIL_DOUBLE Axis2VectorY,
+                                       MIL_DOUBLE Axis2VectorZ,
+                                       MIL_INT64  ControlFlag);
+
+   //M3dgeo Control  
+
+
+
+#if M_MIL_USE_UNICODE
+   void MFTYPE M3dgeoSaveA(MIL_CONST_TEXTA_PTR FileName,
+                           MIL_ID              GeometryOrMatrix3dgeoId,
+                           MIL_INT64           ControlFlag);
+
+   MIL_ID MFTYPE M3dgeoRestoreA(MIL_CONST_TEXTA_PTR FileName,
+                                MIL_ID              SysId,
+                                MIL_INT64           ControlFlag,
+                                MIL_ID*             GeometryOrMatrix3dgeoIdPtr);
+
+   void MFTYPE M3dgeoStreamA(MIL_TEXTA_PTR MemPtrOrFileName,
+                             MIL_ID        SysId,
+                             MIL_INT64     Operation,
+                             MIL_INT64     StreamType,
+                             MIL_DOUBLE    Version,
+                             MIL_INT64     ControlFlag,
+                             MIL_ID*       GeometryOrMatrix3dgeoIdPtr,
+                             MIL_INT*      SizeByteVarPtr);
+
+   void MFTYPE M3dgeoSaveW(MIL_CONST_TEXTW_PTR FileName,
+                           MIL_ID              GeometryOrMatrix3dgeoId,
+                           MIL_INT64           ControlFlag);
+
+   MIL_ID MFTYPE M3dgeoRestoreW(MIL_CONST_TEXTW_PTR FileName,
+                                MIL_ID              SysId,
+                                MIL_INT64           ControlFlag,
+                                MIL_ID*             GeometryOrMatrix3dgeoIdPtr);
+
+   void MFTYPE M3dgeoStreamW(MIL_TEXTW_PTR MemPtrOrFileName,
+                             MIL_ID        SysId,
+                             MIL_INT64     Operation,
+                             MIL_INT64     StreamType,
+                             MIL_DOUBLE    Version,
+                             MIL_INT64     ControlFlag,
+                             MIL_ID*       GeometryOrMatrix3dgeoIdPtr,
+                             MIL_INT*      SizeByteVarPtr);
+
+
+
+#if M_MIL_UNICODE_API
+#define M3dgeoSave               M3dgeoSaveW
+#define M3dgeoRestore            M3dgeoRestoreW
+#define M3dgeoStream             M3dgeoStreamW
+//#define M3dgeoImport             M3dgeoImportW
+#else
+#define M3dgeoSave               M3dgeoSaveA
+#define M3dgeoRestore            M3dgeoRestoreA
+#define M3dgeoStream             M3dgeoStreamA
+//#define M3dgeoImport             M3dgeoImportA
+#endif
+
+#else
+
+   void MFTYPE   M3dgeoSave(MIL_CONST_TEXT_PTR FileName,
+                            MIL_ID             GeometryOrMatrix3dgeoId,
+                            MIL_INT64          ControlFlag);
+
+   MIL_ID MFTYPE   M3dgeoRestore(MIL_CONST_TEXT_PTR FileName,
+                                 MIL_ID             SysId,
+                                 MIL_INT64          ControlFlag,
+                                 MIL_ID*            GeometryOrMatrix3dgeoIdPtr);
+
+   void MFTYPE   M3dgeoStream(MIL_TEXT_PTR MemPtrOrFileName,
+                              MIL_ID       SysId,
+                              MIL_INT64    Operation,
+                              MIL_INT64    StreamType,
+                              MIL_DOUBLE   Version,
+                              MIL_INT64    ControlFlag,
+                              MIL_ID*      GeometryOrMatrix3dgeoIdPtr,
+                              MIL_INT*     SizeByteVarPtr);
+
+#endif  // M_MIL_USE_UNICODE
+
+#ifdef __cplusplus
+
+ inline bool In3dgeoInquireDoubleRange( MIL_INT64 InquireType)
+      {
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         {
+         return false;
+         }
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         //case M_ALLOCATION_FAILURE_REAL_TEST_FLAG:
+         case M_CENTER_X:
+         case M_CENTER_Y:
+         case M_CENTER_Z:
+         case M_RADIUS:
+         case M_UNROTATED_MIN_X:
+         case M_UNROTATED_MIN_Y:
+         case M_UNROTATED_MIN_Z:
+         case M_UNROTATED_MAX_X:
+         case M_UNROTATED_MAX_Y:
+         case M_UNROTATED_MAX_Z:
+         case M_SIZE_X:
+         case M_SIZE_Y:
+         case M_SIZE_Z:
+         case M_COEFFICIENT_A:
+         case M_COEFFICIENT_B:
+         case M_COEFFICIENT_C:
+         case M_COEFFICIENT_D:
+         case M_NORMAL_X:
+         case M_NORMAL_Y:
+         case M_NORMAL_Z:
+         case M_CLOSEST_TO_ORIGIN_X:
+         case M_CLOSEST_TO_ORIGIN_Y:
+         case M_CLOSEST_TO_ORIGIN_Z:
+         case M_START_POINT_X:
+         case M_START_POINT_Y:
+         case M_START_POINT_Z:
+         case M_END_POINT_X:
+         case M_END_POINT_Y:
+         case M_END_POINT_Z:
+         case M_AXIS_X:
+         case M_AXIS_Y:
+         case M_AXIS_Z:
+         case M_LENGTH:
+         case M_CORNER_X_ALL:
+         case M_CORNER_Y_ALL:
+         case M_CORNER_Z_ALL:
+         case M_CORNER_X(0):
+         case M_CORNER_X(1):
+         case M_CORNER_X(2):
+         case M_CORNER_X(3):
+         case M_CORNER_X(4):
+         case M_CORNER_X(5):
+         case M_CORNER_X(6):
+         case M_CORNER_X(7):
+         case M_CORNER_Y(0):
+         case M_CORNER_Y(1):
+         case M_CORNER_Y(2):
+         case M_CORNER_Y(3):
+         case M_CORNER_Y(4):
+         case M_CORNER_Y(5):
+         case M_CORNER_Y(6):
+         case M_CORNER_Y(7):
+         case M_CORNER_Z(0):
+         case M_CORNER_Z(1):
+         case M_CORNER_Z(2):
+         case M_CORNER_Z(3):
+         case M_CORNER_Z(4):
+         case M_CORNER_Z(5):
+         case M_CORNER_Z(6):
+         case M_CORNER_Z(7):
+         {
+         return true;
+         }
+
+         default:
+         {
+         break;
+         }
+         }
+
+      return false;
+      }
+
+   inline bool In3dgeoInquireInt64Range( MIL_INT64 )
+      {
+      return false;
+      }
+   inline bool M3dgeoInquireMustHaveUserPtr( MIL_INT64 InquireType)
+      {
+      const MIL_INT64 ForcedDataType = MinquireOverrides(M_STRIP_HLVLDATATYPE(InquireType), M_TYPE_MIL_INT);
+      if(ForcedDataType != 0)
+         {
+         return false;// ForcedDataType == M_TYPE_MIL_INT64;
+         }
+
+      return In3dgeoInquireInt64Range(InquireType);
+      }
+#endif // __cplusplus
+
+   /* C++ directive if needed */
+#ifdef __cplusplus
+   }
+#endif
+#ifdef __cplusplus
+   inline void MFTYPE M3dgeoStreamCpp(MilStreamParam MemPtrOrFileName,
+                                      MIL_ID         SysId,
+                                      MIL_INT64      Operation,
+                                      MIL_INT64      StreamType,
+                                      MIL_DOUBLE     Version,
+                                      MIL_INT64      ControlFlag,
+                                      MIL_ID*        GeometryOrMatrix3dgeoIdPtr,
+                                      MIL_INT*       SizeByteVarPtr)
+      {
+      M3dgeoStream(MemPtrOrFileName.m_Param, SysId, Operation, StreamType, Version, ControlFlag, GeometryOrMatrix3dgeoIdPtr, SizeByteVarPtr);
+      }
+
+#undef  M3dgeoStream
+#define M3dgeoStream M3dgeoStreamCpp
+
+#endif // __cplusplus
+#ifdef __cplusplus
+   inline void M3dgeoMatrixGet(MIL_ID      Matrix3dgeoId,
+                               MIL_INT64   GetType,
+                               MIL_DOUBLE* UserArrayPtr)
+      {
+      return M3dgeoMatrixGetDouble(Matrix3dgeoId, GetType, UserArrayPtr);
+      }
+   inline void M3dgeoMatrixGet(MIL_ID      Matrix3dgeoId,
+                               MIL_INT64   GetType,
+                               MIL_FLOAT*  UserArrayPtr)
+      {
+      return M3dgeoMatrixGetFloat(Matrix3dgeoId, GetType, UserArrayPtr);
+      }
+   inline void M3dgeoMatrixPut(MIL_ID            Matrix3dgeoId,
+                               MIL_INT64         PutType,
+                               const MIL_DOUBLE* UserArrayPtr)
+      {
+      return M3dgeoMatrixPutDouble(Matrix3dgeoId, PutType, UserArrayPtr);
+      }
+   inline void M3dgeoMatrixPut(MIL_ID            Matrix3dgeoId,
+                               MIL_INT64         PutType,
+                               const MIL_FLOAT*  UserArrayPtr)
+      {
+      return M3dgeoMatrixPutFloat(Matrix3dgeoId, PutType, UserArrayPtr);
+      }
+
+#else
+#define M3dgeoMatrixGet M3dgeoMatrixGetDouble
+#define M3dgeoMatrixPut M3dgeoMatrixPutDouble
+#endif
+
+#ifdef __cplusplus
+   inline MIL_INT64 M3dgeoInquireDataType(MIL_INT64 InquireType)
+      {
+      const MIL_INT64 ForcedDataType = MinquireOverrides(InquireType, M_TYPE_MIL_INT);
+      if(ForcedDataType != 0)
+         return ForcedDataType;
+
+      if(In3dgeoInquireDoubleRange(InquireType))
+         return M_TYPE_DOUBLE;
+
+      if(In3dgeoInquireInt64Range(InquireType))
+         return M_TYPE_MIL_INT64;
+
+      return M_TYPE_MIL_INT;
+      }
+#if M_MIL_USE_SAFE_TYPE
+   // ----------------------------------------------------------
+// ----------------------------------------------------------
+// M3dgeoInquire
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, int UserVarPtr)
+      {
+      bool MustHaveUserPointer = M3dgeoInquireMustHaveUserPtr(InquireType);
+
+      if(UserVarPtr)
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"));
+
+      if(!UserVarPtr && MustHaveUserPointer)
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+      return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, NULL);
+      }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, std::nullptr_t)
+      {
+      bool MustHaveUserPointer = M3dgeoInquireMustHaveUserPtr(InquireType);
+
+      if(MustHaveUserPointer)
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"),MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+      return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, NULL);
+      }
+#endif
+
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeTypeExecute(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, void  *UserVarPtr, MIL_INT64  GivenType)
+      {
+      MIL_INT64  RequiredType = M3dgeoInquireDataType(InquireType);
+      ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+      if(RequiredType != GivenType)
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"));
+
+      return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr);
+      }
+
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireUnsafe(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, void        *UserVarPtr) { return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_INT8*   UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_CHAR); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_INT16*  UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_INT32   *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_INT64   *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_FLOAT   *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_FLOAT); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_DOUBLE  *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_DOUBLE); }
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_UINT8*   UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_CHAR); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_UINT16*  UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_UINT32  *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_UINT64  *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T                                                      
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, wchar_t*    UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+#endif
+
+#define M3dgeoInquire           M3dgeoInquireSafeType
+
+
+#else // #if M_MIL_USE_SAFE_TYPE
+#define M3dgeoInquireUnsafe     M3dgeoInquire
+
+#endif // #if M_MIL_USE_SAFE_TYPE
+
+#endif
+#if M_MIL_USE_STRING
+   inline void MFTYPE M3dgeoSave(const MIL_STRING& FileName, MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64 ControlFlag)
+      {
+      return M3dgeoSave(FileName.c_str(), GeometryOrMatrix3dgeoId, ControlFlag);
+      }
+
+   inline MIL_ID MFTYPE M3dgeoRestore(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_ID* GeometryOrMatrix3dgeoIdPtr)
+      {
+      return M3dgeoRestore(FileName.c_str(), SysId, ControlFlag, GeometryOrMatrix3dgeoIdPtr);
+      }
+#endif /* M_MIL_USE_STRING */
+   // ----------------------------------------------------------
+// Overload for std::vector.
+#if defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+// ----------------------------------------------------------
+// Overloads for std::vector in  M3dgeoInquire.
+   template <typename UserType>
+   inline MIL_DOUBLE MFTYPE M3dgeoInquire(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, std::vector<UserType> &UserVarPtr)
+      {
+      // If the given MIL data type is not the same as the SrcType, change it to the correct one
+      // and give a warning.
+      MIL_INT64 InternalTrueDataTypeForStdVector = MilTraits<UserType>::TypeFlag;
+
+#if M_MIL_USE_SAFE_TYPE
+      if(M_GET_HLVLDATATYPE(InquireType) != 0)
+         {
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+         }
+#endif
+
+      InquireType = M_STRIP_HLVLDATATYPE(InquireType) + InternalTrueDataTypeForStdVector;
+
+      MIL_INT InternalNumberOfElementsForStdVector = 0;
+      M3dgeoInquire(GeometryOrMatrix3dgeoId, M_STRIP_HLVLDATATYPE(InquireType) + M_NB_ELEMENTS + M_TYPE_MIL_INT, &InternalNumberOfElementsForStdVector);
+
+      UserVarPtr.resize(InternalNumberOfElementsForStdVector);
+
+      if(InternalNumberOfElementsForStdVector > 0)
+         {
+         return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, &UserVarPtr[0]);
+         }
+      return 0;
+      }
+   // ----------------------------------------------------------
+   // Overloads for std::vector in  M3dgeoMatrixPut.
+   template <typename T>
+   inline void MFTYPE  M3dgeoMatrixPut(MIL_ID                Matrix3dgeoId,
+                                       MIL_INT64             PutType,
+                                       const std::vector<T>& ArrayPtr)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      if(ArrayPtr.empty())
+         {
+         SafeTypeError(MIL_TEXT("M3dgeoMatrixPut"), MIL_TEXT("The input vector cannot be empty."));
+         }
+
+      if(ArrayPtr.size() != 16)
+         {
+         SafeTypeError(MIL_TEXT("M3dgeoMatrixPut"), MIL_TEXT("The size of the input vector must be 16."));
+         }
+#endif
+      M3dgeoMatrixPut(Matrix3dgeoId,
+                      PutType,
+                      &ArrayPtr[0]);
+      }
+   // Overloads for std::vector in M3dgeoMatrixGet.
+   template <typename T>
+   inline void M3dgeoMatrixGet(MIL_ID          Matrix3dgeoId,
+                               MIL_INT64       GetType,
+                               std::vector<T>& ArrayPtr)
+      {
+      ArrayPtr.resize(16);//InternalNbElementRequired
+      M3dgeoMatrixGet(Matrix3dgeoId,
+                      GetType,
+                      &ArrayPtr[0]);
+      }
+   // ----------------------------------------------------------
+// Overloads for std::vector in M3dgeoStream.
+   inline void MFTYPE M3dgeoStream(std::vector<MIL_UINT8> &MemPtrOrFileName,
+                                   MIL_ID                 SysId,
+                                   MIL_INT64              Operation,
+                                   MIL_INT64              StreamType,
+                                   MIL_DOUBLE             Version,
+                                   MIL_INT64              ControlFlag,
+                                   MIL_ID*                GeometryOrMatrix3dgeoIdPtr,
+                                   MIL_INT*               SizeByteVarPtr)
+      {
+      MxxxStreamForStdVector(MemPtrOrFileName,
+                             SysId,
+                             Operation,
+                             StreamType,
+                             Version,
+                             ControlFlag,
+                             GeometryOrMatrix3dgeoIdPtr,
+                             SizeByteVarPtr,
+                             M3dgeoStream);
+      }
+#endif // defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+ // Automatic double casting
+#define M3dgeoMatrixSetTransform(Matrix3dgeoId, TransformType, Param1, Param2, Param3, Param4, ControlFlag) \
+        M3dgeoMatrixSetTransformDouble(Matrix3dgeoId, TransformType, M_MILID_TO_DOUBLE(Param1), M_MILID_TO_DOUBLE(Param2), M_MILID_TO_DOUBLE(Param3), M_MILID_TO_DOUBLE(Param4), ControlFlag)
+////////////////////////////////////////////////////////////////////////////////
+// MIL_UNIQUE_ID support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+#if M_MIL_USE_SAFE_TYPE
+   template <> inline bool MilIsCorrectObjectType<&M3dgeoFree>(MIL_INT64 ObjectType)
+      {
+      return (ObjectType == M_3DGEO_GEOMETRY || ObjectType == M_3DGEO_TRANSFORMATION_MATRIX);
+      }
+#endif
+
+   typedef MIL_UNIQUE_ID<&M3dgeoFree > MIL_UNIQUE_3DGEO_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+
+   //3DGEO
+   inline  MIL_UNIQUE_3DGEO_ID M3dgeoAlloc(MIL_ID SysId, MIL_INT64 ObjectType, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+      {
+      return MIL_UNIQUE_3DGEO_ID(M3dgeoAlloc(SysId, ObjectType, InitFlag, M_NULL));
+      }
+   inline MIL_UNIQUE_3DGEO_ID M3dgeoRestore(MIL_CONST_TEXT_PTR FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+      {
+      return MIL_UNIQUE_3DGEO_ID(M3dgeoRestore(FileName, SysId, ControlFlag, M_NULL));
+      }
+#if M_MIL_USE_STRING
+   inline MIL_UNIQUE_3DGEO_ID M3dgeoRestore(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+      {
+      return MIL_UNIQUE_3DGEO_ID(M3dgeoRestore(FileName.c_str(), SysId, ControlFlag, M_NULL));
+      }
+#endif // M_MIL_USE_STRING
+   template <MilFreeFuncType FreeFunc> inline void M3dgeoFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+   inline void M3dgeoStream(MilStreamParam       MemPtrOrFileName,
+                            MIL_ID               SysId,
+                            MIL_INT64            Operation,
+                            MIL_INT64            StreamType,
+                            MIL_DOUBLE           Version,
+                            MIL_INT64            ControlFlag,
+                            MIL_UNIQUE_3DGEO_ID* Context3dgeoIdPtr,
+                            MIL_INT*             SizeByteVarPtr)
+      {
+      MxxxStreamForMilUniqueId(MemPtrOrFileName, SysId, Operation, StreamType, Version, ControlFlag, Context3dgeoIdPtr, SizeByteVarPtr, M3dgeoStream);
+      }
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+
+// End of MIL_UNIQUE_ID support
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+   /* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+   {
+#endif
+   // MbufConvert3d
+#define M_COMPENSATE                   3713
+#define M_REMOVE_NON_FINITE            0x00000001L
+
+
+   void MFTYPE MbufConvert3d(MIL_ID    SrcContainerOrImageBufId,
+                             MIL_ID    DstContainerOrImageBufId,
+                             MIL_ID    ExternalYArrayBufId,
+                             MIL_INT64 DstOptions,
+                             MIL_INT64 ControlFlag);
+
+
+
+   /* C++ directive if needed */
+#ifdef __cplusplus
+   }
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+#endif // __MIL3D_H__
diff --git a/Common_Class/Matrox/Include/MILDyn/mil3dgra.h b/Common_Class/Matrox/Include/MILDyn/mil3dgra.h
new file mode 100644
index 0000000..7eff7ad
--- /dev/null
+++ b/Common_Class/Matrox/Include/MILDyn/mil3dgra.h
@@ -0,0 +1,908 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MIL3DGRA.H
+// Content           :  Define for the MIL 3DGRA module
+// Revision          :  10.40.0640
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+
+#ifndef __MIL3DGRA_H__
+#define __MIL3DGRA_H__
+
+#if !defined(__MIL3DGEO_H__)
+#include <mildyn/mil3dgeo.h>
+#endif
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+   {
+#endif
+// Control values
+#define M_ROOT_NODE                                                          0
+#define M_NO_LABEL                                                  0x20000000L  // Also defined in milreg.h
+#define M_LIST                                                      0x08000000L  /* already defined in mil.h */
+#define M_DEFAULT_SETTINGS                                          0x04000000L
+
+// M3dgraAlloc
+// 1000-2000
+
+#define M_GRAPHIC_TYPE_ARC                                               1505L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_DOTS                                              1507L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_LINE                                              1508L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_POLYGON                                           1510L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_TEXT                                              1513L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_AXIS                                              3881L
+#define M_GRAPHIC_TYPE_BOX                                               3882L
+#define M_GRAPHIC_TYPE_POINT_CLOUD                                       3883L
+#define M_GRAPHIC_TYPE_CYLINDER                                          3884L
+#define M_GRAPHIC_TYPE_GRID                                              3885L
+#define M_GRAPHIC_TYPE_PLANE                                             3886L
+#define M_GRAPHIC_TYPE_QUAD                                              3887L
+#define M_GRAPHIC_TYPE_SPHERE                                            3888L
+#define M_GRAPHIC_TYPE_NODE                                              3889L
+
+// M3dgraCopy
+#define M_CLIPPING_BOX                                                   3868L
+#define M_GRAPHIC                                                        3879L
+#define M_COLOR_LUT                                                      3945L
+#define M_RECURSIVE                                                0x00040000 // already defined in milmod.h
+#define M_CHILDREN_ONLY                                            0x00080000
+#define M_BOUNDING_BOX                                             0x00000003L  // already defined
+#define M_GEOMETRY                                                       1306L // Already defined
+
+// Gralist controls
+#define M_BOTH_CORNERS                                             0x00000004L  // Already defined in mil.h
+#define M_CENTER_AND_DIMENSION                                     0x00000002L  // Already defined in 
+#define M_POINT_AND_VECTOR                                               4670
+#define M_VISIBLE                                                        1533L // Already defined in mil.h
+#define M_LABEL_EXISTS                                                   4671
+#define M_POSITION_X                                               0x00003400L // Already defined in milim.h
+#define M_POSITION_Y                                               0x00004400L // Already defined in milim.h
+#define M_POSITION_Z                                                     3960L
+
+// Container
+#define M_TRANSFORMATION_MATRIX                                            72L  // Already defined in milreg.h
+#define M_BUFFER_LIMITS                                                  4672
+#define M_DATA_EXTREMES_GLOBAL                                           4673
+#define M_DATA_EXTREMES_PER_BAND                                         4674
+#define M_USER_DEFINED                                                     21L // Already defined in alot of places
+#define M_AUTO_COLOR                                               0x00100000L
+#define M_CONTAINER_ID                                                   4675
+#define M_GRAPHIC_RESOLUTION                                             4676
+
+// Dots
+#define M_PER_POINT                                                      3873L
+
+// Axis
+#define M_PER_AXIS                                                       3956L
+
+//Plane
+#define M_THREE_POINTS                                                   3390 // Already defined in mil3dgeo.h
+#define M_COEFFICIENTS                                                   3388
+#define M_POINT_AND_NORMAL                                               3389
+#define M_POINT_AND_TWO_VECTORS                                          3391
+// Text
+#define M_GRAPHIC_TEXT                             (3869L | M_CLIENT_ENCODING)
+#define M_FONT                                        (7L | M_CLIENT_ENCODING) // Already defined in mil.h
+#define M_TEXT_ALIGN_HORIZONTAL                                            58L // Already defined in Mil.h
+#define M_TEXT_ALIGN_VERTICAL                                              71L // Already defined in Mil.h
+#define M_TEXT_BORDER                                                    1785L // Already defined in Mil.h
+#define M_TEXT_DIRECTION                                           0x01000061L // Already defined in Mil.h
+#define M_TEXT_SHADING                                                   4747L
+#define M_BACKGROUND_MODE                                                  12L // Already defined in Mil.h
+//Cylinder
+#define M_TWO_POINTS                                                     3657
+// Arc
+#define M_CENTER_AND_TWO_POINTS                                          3875L  
+#define M_CENTER_AND_TWO_VECTORS                                         3876L
+#define M_NORMAL_AND_ANGLE                                               3877L
+
+// Grid
+#define M_SIZE_AND_SPACING                                               3932L  
+#define M_TILES_AND_SPACING                                              3933L
+
+////////////////////////////////////////////////////////////////////////////////
+// M3dgraControl
+////////////////////////////////////////////////////////////////////////////////
+// MIL_INT64 CONTROLS
+#define M_COLOR_COMPONENT                                                4678
+#define M_APPEARANCE                                                     4679
+#define M_COLOR_LIMITS                                                   4680
+#define M_COLOR_LUT_SIZE                                                 4681
+#define M_COLOR_LUT_SIZE_BAND                                            4682
+#define M_COLOR_COMPONENT_BAND                                           4683
+#define M_COLOR_USE_LUT                                                  4684  
+#define M_CHILDREN                                                       4685    
+#define M_NUMBER_OF_CHILDREN                                             4686   
+#define M_PARENT                                                         4687   
+#define M_CYLINDER_BASES                                                 4688   
+#define M_COLOR_AXIS_X                                                   4689
+#define M_COLOR_AXIS_Y                                                   4690
+#define M_COLOR_AXIS_Z                                                   4691
+#define M_SAME_AS_COLOR                                                  4692
+#define M_COLOR_USE_TEXTURE                                              4693
+#define M_COLOR_TEXTURE_SIZE_X                                           4694
+#define M_COLOR_TEXTURE_SIZE_Y                                           4695
+#define M_COLOR_TEXTURE_SIZE_BAND                                        4696
+#define M_COLOR_TEXTURE                                                  4697
+#define M_SHADING                                                        4698
+#define M_FLAT                                                           4699
+#define M_GOURAUD                                                        4700
+#define M_PHONG                                                          4726
+#define M_KEYING_COLOR                                                   4727
+#define M_GRAPHIC_TYPE                                                   1518L // Already defined in mil.h
+#define M_FILL_COLOR                                    (M_DISP_CONTROL_START+193L) // already defined in mildisplay.h
+
+#define M_POINTS                                                   0x00000010L
+#define M_WIREFRAME                                                0x00000020L
+#define M_SOLID                                                    0x00000040L
+#define M_SOLID_WITH_WIREFRAME                          (M_SOLID + M_WIREFRAME)
+
+// MIL_DOUBLE CONTROLS
+#define M_OPACITY                                                        4728
+#define M_COLOR_LIMITS_MIN                                               4729
+#define M_COLOR_LIMITS_MAX                                               4730
+#define M_POINTS_X                                                       4733
+#define M_POINTS_Y                                                       4734
+#define M_POINTS_Z                                                       4735
+#define M_SPACING_X                                                      4736
+#define M_SPACING_Y                                                      4737
+#define M_FONT_SIZE                                                0x01000060L  // already defined in Mil.h
+#define M_THICKNESS                                                         3L  // also used in MgraLines
+#define M_TRANSFORM_TYPES_SHIFT                                             8L  // =utilities=   (also defined in milcal.h)
+#define M_RELATIVE_TO_ROOT                            (256 << M_TRANSFORM_TYPES_SHIFT)
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+// M3dgra calls
+   MIL_INT64 MFTYPE M3dgraAdd(MIL_ID    List3dgraId,
+                              MIL_INT64 ParentLabel,
+                              MIL_ID    ContainerOrImageBufId,
+                              MIL_INT64 ControlFlag);
+
+   MIL_ID    MFTYPE M3dgraAlloc(MIL_ID    SysId,
+                                MIL_INT64 ControlFlag,
+                                MIL_ID*   List3dgraIdPtr);
+
+   void      MFTYPE M3dgraControlDouble(MIL_ID     List3dgraId,
+                                        MIL_INT64  Label,
+                                        MIL_INT64  ControlType,
+                                        MIL_DOUBLE ControlValue);
+
+   void      MFTYPE M3dgraControlInt64 (MIL_ID    List3dgraId,
+                                        MIL_INT64 Label,
+                                        MIL_INT64 ControlType,
+                                        MIL_INT64 ControlValue);
+
+   void      MFTYPE M3dgraFree(MIL_ID List3dgraId);
+
+   MIL_INT64 MFTYPE M3dgraInquire(MIL_ID    List3dgraId,
+                                  MIL_INT64 Label,
+                                  MIL_INT64 InquireType,
+                                  void*     UserVarPtr);
+
+   void      MFTYPE M3dgraRemove(MIL_ID    List3dgraId,
+                                 MIL_INT64 Label,
+                                 MIL_INT64 ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraBox(MIL_ID     List3dgraId,
+                              MIL_INT64  ParentLabel,
+                              MIL_INT64  CreationMode,
+                              MIL_DOUBLE XPos1,
+                              MIL_DOUBLE YPos1,
+                              MIL_DOUBLE ZPos1,
+                              MIL_DOUBLE XPos2OrLength,
+                              MIL_DOUBLE YPos2OrLength,
+                              MIL_DOUBLE ZPos2OrLength,
+                              MIL_ID     Matrix3dgeoId,
+                              MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraSphere(MIL_ID     List3dgraId,
+                                 MIL_INT64  ParentLabel,
+                                 MIL_DOUBLE CenterX,
+                                 MIL_DOUBLE CenterY,
+                                 MIL_DOUBLE CenterZ,
+                                 MIL_DOUBLE Radius,
+                                 MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraCylinder(MIL_ID     List3dgraId,
+                                   MIL_INT64  ParentLabel,
+                                   MIL_INT64  CreationMode,
+                                   MIL_DOUBLE XPos1,
+                                   MIL_DOUBLE YPos1,
+                                   MIL_DOUBLE ZPos1,
+                                   MIL_DOUBLE XPos2OrVector,
+                                   MIL_DOUBLE YPos2OrVector,
+                                   MIL_DOUBLE ZPos2OrVector,
+                                   MIL_DOUBLE Radius,
+                                   MIL_DOUBLE Length,
+                                   MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraGrid(MIL_ID     List3dgraId,
+                               MIL_INT64  ParentLabel,
+                               MIL_INT64  CreationMode,
+                               MIL_ID     Matrix3dgeoId,
+                               MIL_DOUBLE Param1,
+                               MIL_DOUBLE Param2,
+                               MIL_DOUBLE Param3,
+                               MIL_DOUBLE Param4,
+                               MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraLine(MIL_ID     List3dgraId,
+                               MIL_INT64  ParentLabel,
+                               MIL_INT64  CreationMode,
+                               MIL_INT64  Symbol,
+                               MIL_DOUBLE PointX,
+                               MIL_DOUBLE PointY,
+                               MIL_DOUBLE PointZ,
+                               MIL_DOUBLE PointOrVectorX,
+                               MIL_DOUBLE PointOrVectorY,
+                               MIL_DOUBLE PointOrVectorZ,
+                               MIL_DOUBLE Length,
+                               MIL_INT64  ControlFlag);
+   
+   MIL_INT64 MFTYPE M3dgraNode(MIL_ID     List3dgraId,
+                               MIL_INT64  ParentLabel,
+                               MIL_ID     Matrix3dgeoId,
+                               MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraPlane(MIL_ID     List3dgraId,
+                                MIL_INT64  ParentLabel,
+                                MIL_INT64  CreationMode,
+                                MIL_DOUBLE X1,
+                                MIL_DOUBLE Y1,
+                                MIL_DOUBLE Z1,
+                                MIL_DOUBLE X2OrD,
+                                MIL_DOUBLE Y2,
+                                MIL_DOUBLE Z2,
+                                MIL_DOUBLE X3,
+                                MIL_DOUBLE Y3,
+                                MIL_DOUBLE Z3,
+                                MIL_DOUBLE Size,
+                                MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraArc(MIL_ID     List3dgraId,
+                              MIL_INT64  ParentLabel,
+                              MIL_INT64  CreationMode,
+                              MIL_INT64  Symbol,
+                              MIL_DOUBLE X1,
+                              MIL_DOUBLE Y1,
+                              MIL_DOUBLE Z1,
+                              MIL_DOUBLE X2,
+                              MIL_DOUBLE Y2,
+                              MIL_DOUBLE Z2,
+                              MIL_DOUBLE X3,
+                              MIL_DOUBLE Y3,
+                              MIL_DOUBLE Z3,
+                              MIL_DOUBLE Angle,
+                              MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraDotsDouble(MIL_ID            List3dgraId,
+                                     MIL_INT64         ParentLabel,
+                                     MIL_INT           NumPoints,
+                                     const MIL_DOUBLE* CoordXArrayPtr,
+                                     const MIL_DOUBLE* CoordYArrayPtr,
+                                     const MIL_DOUBLE* CoordZArrayPtr,
+                                     const MIL_UINT8*  PointsRArrayPtr,
+                                     const MIL_UINT8*  PointsGArrayPtr,
+                                     const MIL_UINT8*  PointsBArrayPtr,
+                                     MIL_INT64         ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraDotsFloat(MIL_ID           List3dgraId,
+                                    MIL_INT64        ParentLabel,
+                                    MIL_INT          NumPoints,
+                                    const MIL_FLOAT* CoordXArrayPtr,
+                                    const MIL_FLOAT* CoordYArrayPtr,
+                                    const MIL_FLOAT* CoordZArrayPtr,
+                                    const MIL_UINT8* PointsRArrayPtr,
+                                    const MIL_UINT8* PointsGArrayPtr,
+                                    const MIL_UINT8* PointsBArrayPtr,
+                                    MIL_INT64        ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraCopy(MIL_ID     SrcMilObjectId,
+                               MIL_INT64  SrcLabel,
+                               MIL_ID     DstMilObjectId,
+                               MIL_INT64  DstLabel,
+                               MIL_INT64  CopyType,
+                               MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraPolygonDouble(MIL_ID            List3dgraId,
+                                        MIL_INT64         ParentLabel,
+                                        MIL_INT64         CreationMode,
+                                        MIL_INT           NumPoints,
+                                        const MIL_DOUBLE* CoordXArrayPtr,
+                                        const MIL_DOUBLE* CoordYArrayPtr,
+                                        const MIL_DOUBLE* CoordZArrayPtr,
+                                        const MIL_DOUBLE* TextureXArrayPtr,
+                                        const MIL_DOUBLE* TextureYArrayPtr,
+                                        MIL_ID            TextureBufId,
+                                        MIL_INT64         ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraPolygonFloat(MIL_ID           List3dgraId,
+                                       MIL_INT64        ParentLabel,
+                                       MIL_INT64        CreationMode,
+                                       MIL_INT          NumPoints,
+                                       const MIL_FLOAT* CoordXArrayPtr,
+                                       const MIL_FLOAT* CoordYArrayPtr,
+                                       const MIL_FLOAT* CoordZArrayPtr,
+                                       const MIL_FLOAT* TextureXArrayPtr,
+                                       const MIL_FLOAT* TextureYArrayPtr,
+                                       MIL_ID           TextureBufId,
+                                       MIL_INT64        ControlFlag);
+
+// For CAPI calls with strings
+#if M_MIL_USE_UNICODE
+   MIL_INT64 MFTYPE M3dgraTextA(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_CONST_TEXTA_PTR Text, MIL_ID Matrix3dgeoId, MIL_INT64 Options, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3dgraTextW(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_CONST_TEXTW_PTR Text, MIL_ID Matrix3dgeoId, MIL_INT64 Options, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3dgraAxisA(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_ID Matrix3dgeoId, MIL_DOUBLE AxisLength, MIL_CONST_TEXTA_PTR Name, MIL_INT64 Options, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3dgraAxisW(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_ID Matrix3dgeoId, MIL_DOUBLE AxisLength, MIL_CONST_TEXTW_PTR Name, MIL_INT64 Options, MIL_INT64 ControlFlag);
+     
+
+// create default calls
+#if M_MIL_UNICODE_API
+#define M3dgraText   M3dgraTextW
+#define M3dgraAxis   M3dgraAxisW
+
+#else
+#define M3dgraText   M3dgraTextA
+#define M3dgraAxis   M3dgraAxisA
+#endif
+
+#else
+   MIL_INT64 MFTYPE M3dgraText(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_CONST_TEXT_PTR Text, MIL_ID Matrix3dgeoId, MIL_INT64 Options, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3dgraAxis(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_ID Matrix3dgeoId, MIL_DOUBLE AxisLength, MIL_CONST_TEXT_PTR Name, MIL_INT64 Options, MIL_INT64 ControlFlag);
+ #endif
+
+#ifdef __cplusplus
+
+   inline bool In3dgraInquireDoubleRange(MIL_INT64 InquireType)
+      {
+      InquireType &= ~(M_RELATIVE_TO_ROOT | M_RECURSIVE);  // Remove custom combo flags
+
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         return false;
+
+      if(In3dgeoInquireDoubleRange(InquireType))
+         return true;
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_ANGLE:
+         case M_OPACITY:
+         case M_COLOR_LIMITS_MIN:
+         case M_COLOR_LIMITS_MAX:
+         case M_POINTS_X:
+         case M_POINTS_Y:
+         case M_POINTS_Z:
+         case M_SPACING_X:
+         case M_SPACING_Y:
+         case M_FONT_SIZE:
+         case M_THICKNESS:
+         case M_POSITION_X:
+         case M_POSITION_Y:
+         case M_POSITION_Z:
+            return true;
+
+         default:
+            break;
+         }
+
+      return false;
+      }
+
+   inline bool In3dgraInquireInt64Range(MIL_INT64 InquireType)
+      {
+      InquireType &= ~(M_RELATIVE_TO_ROOT | M_RECURSIVE);  // Remove custom combo flags
+
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         return false;
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_COLOR_COMPONENT:
+         case M_COLOR:
+         case M_BACKGROUND_COLOR:
+         case M_KEYING_COLOR:
+         case M_COLOR_AXIS_X:
+         case M_COLOR_AXIS_Y:
+         case M_COLOR_AXIS_Z:
+         case M_FILL_COLOR:
+         case M_PARENT:
+         case M_CHILDREN:
+            return true;
+
+         default:
+            break;
+         }
+
+      return false;
+      }
+
+   inline bool In3dgraInquireStringRange(MIL_INT64 InquireType)
+      {
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         return false;
+
+      switch(M_STRIP_CLIENT_TEXT_ENCODING(M_STRIP_INQ_COMBOFLAGS(InquireType)))
+         {
+         case M_STRIP_CLIENT_TEXT_ENCODING(M_GRAPHIC_TEXT):
+         case M_STRIP_CLIENT_TEXT_ENCODING(M_FONT):
+            return true;
+
+         default:
+            break;
+         }
+
+      return false;
+      }
+   inline bool M3dgraInquireMustHaveUserPtr(MIL_INT64 InquireType)
+      {
+      const MIL_INT64 ForcedDataType = MinquireOverrides(M_STRIP_HLVLDATATYPE(InquireType), M_TYPE_MIL_INT);
+      if(ForcedDataType != 0)
+         {
+         return false;
+         }
+      return In3dgraInquireDoubleRange(InquireType) || In3dgraInquireStringRange(InquireType);
+      }
+
+#endif // __cplusplus
+
+   /* C++ directive if needed */
+#ifdef __cplusplus
+   }
+#endif
+
+
+
+
+// M3dgradots/polygon c++ overloads
+#ifdef __cplusplus
+   inline MIL_INT64 M3dgraDots(MIL_ID List3dgraId,
+                               MIL_INT64 ParentLabel,
+                               MIL_INT NumPoints,
+                               const MIL_DOUBLE* CoordXArrayPtr,
+                               const MIL_DOUBLE* CoordYArrayPtr,
+                               const MIL_DOUBLE* CoordZArrayPtr,
+                               const MIL_UINT8* PointsRArrayPtr,
+                               const MIL_UINT8* PointsGArrayPtr,
+                               const MIL_UINT8* PointsBArrayPtr,
+                               MIL_INT64 ControlFlag)
+      {
+      return M3dgraDotsDouble(List3dgraId, ParentLabel, NumPoints, CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, PointsRArrayPtr, PointsGArrayPtr, PointsBArrayPtr, ControlFlag);
+      }
+
+   inline MIL_INT64 M3dgraDots(MIL_ID List3dgraId,
+                               MIL_INT64 ParentLabel,
+                               MIL_INT NumPoints,
+                               const MIL_FLOAT* CoordXArrayPtr,
+                               const MIL_FLOAT* CoordYArrayPtr,
+                               const MIL_FLOAT* CoordZArrayPtr,
+                               const MIL_UINT8* PointsRArrayPtr,
+                               const MIL_UINT8* PointsGArrayPtr,
+                               const MIL_UINT8* PointsBArrayPtr,
+                               MIL_INT64 ControlFlag)
+      {
+      return M3dgraDotsFloat(List3dgraId, ParentLabel, NumPoints, CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, PointsRArrayPtr, PointsGArrayPtr, PointsBArrayPtr, ControlFlag);
+      }
+
+   inline MIL_INT64 M3dgraPolygon(MIL_ID List3dgraId,
+                                  MIL_INT64 ParentLabel,
+                                  MIL_INT64 CreationMode,
+                                  MIL_INT    NumPoints,
+                                  const MIL_DOUBLE* CoordXArrayPtr,
+                                  const MIL_DOUBLE* CoordYArrayPtr,
+                                  const MIL_DOUBLE* CoordZArrayPtr,
+                                  const MIL_DOUBLE* TextureXArrayPtr,
+                                  const MIL_DOUBLE* TextureYArrayPtr,
+                                  MIL_ID TextureBufId,
+                                  MIL_INT64 ControlFlag)
+      {
+      return M3dgraPolygonDouble(List3dgraId, ParentLabel, CreationMode, NumPoints, CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, TextureXArrayPtr, TextureYArrayPtr, TextureBufId, ControlFlag);
+      }
+
+   inline MIL_INT64 M3dgraPolygon(MIL_ID List3dgraId,
+                                  MIL_INT64 ParentLabel,
+                                  MIL_INT64 CreationMode,
+                                  MIL_INT    NumPoints,
+                                  const MIL_FLOAT* CoordXArrayPtr,
+                                  const MIL_FLOAT* CoordYArrayPtr,
+                                  const MIL_FLOAT* CoordZArrayPtr,
+                                  const MIL_FLOAT* TextureXArrayPtr,
+                                  const MIL_FLOAT* TextureYArrayPtr,
+                                  MIL_ID TextureBufId,
+                                  MIL_INT64 ControlFlag)
+      {
+      return M3dgraPolygonFloat(List3dgraId, ParentLabel, CreationMode, NumPoints, CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, TextureXArrayPtr, TextureYArrayPtr, TextureBufId, ControlFlag);
+      }
+#endif
+
+
+
+#ifdef __cplusplus
+
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
+   {
+   M3dgraControlDouble(List3dgraId, Label, ControlType, ControlValue);
+   }
+
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, MIL_INT64 ControlValue)
+   {
+   M3dgraControlInt64(List3dgraId, Label, ControlType, ControlValue);
+   }
+
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   M3dgraControlInt64(List3dgraId, Label, ControlType, ControlValue);
+   }
+
+#if M_MIL_USE_STRING
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+   M3dgraControl(List3dgraId, Label, ControlType, M_PTR_TO_MIL_INT(ControlValue.c_str()));
+   }
+#endif
+
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValuePtr)
+   {
+   M3dgraControl(List3dgraId, Label, ControlType, (MIL_INT)ControlValuePtr);
+   }
+
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, int ControlValue)
+   {
+   M3dgraControlInt64(List3dgraId, Label, ControlType, ControlValue);
+   }
+#endif
+
+
+
+#else
+
+#define M3dgraControl       M3dgraControlDouble
+#endif
+
+#ifdef __cplusplus
+inline MIL_INT64 M3dgraInquireDataType(MIL_INT64 InquireType)
+   {
+   const MIL_INT64 ForcedDataType = MinquireOverrides(InquireType, M_TYPE_MIL_INT);
+   if(ForcedDataType != 0)
+      return ForcedDataType;
+
+   if(In3dgraInquireDoubleRange(InquireType))
+      return M_TYPE_DOUBLE;
+
+   if(In3dgraInquireInt64Range(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if(In3dgraInquireStringRange(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   return M_TYPE_MIL_INT;
+   }
+
+#if M_MIL_USE_SAFE_TYPE
+// ----------------------------------------------------------
+// M3dgraInquire
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, int UserVarPtr)
+      {
+      bool MustHaveUserPointer = M3dgraInquireMustHaveUserPtr(InquireType);
+         
+      if(UserVarPtr)
+         SafeTypeError(MIL_TEXT("M3dgraInquire"));
+
+      if(!UserVarPtr && MustHaveUserPointer)
+         SafeTypeError(MIL_TEXT("M3dgraInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+      return M3dgraInquire(List3dgraId, Label, InquireType, NULL);
+      }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, std::nullptr_t)
+      {
+      bool MustHaveUserPointer = M3dgraInquireMustHaveUserPtr(InquireType);
+
+      if(MustHaveUserPointer)
+         SafeTypeError(MIL_TEXT("M3dgraInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+      return M3dgraInquire(List3dgraId, Label, InquireType, NULL);
+      }
+#endif
+
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeTypeExecute(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64  InquireType, void  *UserVarPtr, MIL_INT64  GivenType)
+      {
+      MIL_INT64  RequiredType = M3dgraInquireDataType(InquireType);
+      ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+      if(RequiredType != GivenType)
+         SafeTypeError(MIL_TEXT("M3dgraInquire"));
+
+      return M3dgraInquire(List3dgraId, Label, InquireType, UserVarPtr);
+      }
+
+   inline MIL_INT64 MFTYPE M3dgraInquireUnsafe(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, void         *UserVarPtr) { return M3dgraInquire(List3dgraId, Label, InquireType, UserVarPtr); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_INT8*   UserVarPtr) { return  M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_CHAR); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_INT16*  UserVarPtr) { return  M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_SHORT); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_INT32   *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_INT64   *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_FLOAT   *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_FLOAT); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_DOUBLE); }
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_UINT8*   UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_CHAR); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_UINT16*  UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_SHORT); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_UINT32  *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_UINT64  *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T                                                      
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID Display3dId, MIL_INT64 Label, MIL_INT64  InquireType, wchar_t*    UserVarPtr) { return M3dgraInquireSafeTypeExecute(Display3dId, Label, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR); }
+#endif
+
+#define M3dgraInquire           M3dgraInquireSafeType
+
+#else // #if M_MIL_USE_SAFE_TYPE
+#define M3dgraInquireUnsafe     M3dgraInquire
+#endif // #if M_MIL_USE_SAFE_TYPE
+
+#endif //__cplusplus
+#if M_MIL_USE_STRING
+
+#if M_MIL_USE_SAFE_TYPE
+inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64  InquireType, MIL_STRING&    UserVarPtr)
+   {
+   MIL_INT64 RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("M3dgraInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+
+   M3dgraInquire(List3dgraId, Label, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = M3dgraInquire(List3dgraId, Label, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+
+      }
+
+   return RetValue;
+   }
+
+#else
+inline MIL_INT64 MFTYPE M3dgraInquire(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64  InquireType, MIL_STRING&    UserVarPtr)
+   {
+   MIL_INT64 RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   M3dgraInquire(List3dgraId, Label, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = M3dgraInquire(List3dgraId, Label, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif
+
+inline MIL_INT64 MFTYPE M3dgraText(MIL_ID List3dgraId, MIL_INT64 ParentLabel, const MIL_STRING& Text, MIL_ID Matrix3dgeoId, MIL_INT64 Options, MIL_INT64 ControlFlag)
+   {
+   return M3dgraText(List3dgraId, ParentLabel, Text.c_str(), Matrix3dgeoId, Options, ControlFlag);
+   }
+
+
+inline MIL_INT64 M3dgraAxis(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_ID Matrix3dgeoId, MIL_DOUBLE AxisLength, const MIL_STRING& Name, MIL_INT64 Options, MIL_INT64 ControlFlag)
+   {
+   return M3dgraAxis(List3dgraId, ParentLabel, Matrix3dgeoId, AxisLength, Name.c_str(), Options, ControlFlag);
+   }
+#endif /* M_MIL_USE_STRING */
+
+// ----------------------------------------------------------
+// Overload for std::vector.
+#if defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+// ----------------------------------------------------------
+// Overloads for std::vector in  M3dgraInquire.
+   template <typename UserType>
+   inline MIL_INT64 MFTYPE M3dgraInquire(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, std::vector<UserType> &UserVarPtr)
+      {
+      // If the given MIL data type is not the same as the SrcType, change it to the correct one
+      // and give a warning.
+      MIL_INT64 InternalTrueDataTypeForStdVector = MilTraits<UserType>::TypeFlag;
+
+#if M_MIL_USE_SAFE_TYPE
+      if(M_GET_HLVLDATATYPE(InquireType) != 0)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraInquire"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+         }
+#endif
+
+      InquireType = M_STRIP_HLVLDATATYPE(InquireType) + InternalTrueDataTypeForStdVector;
+
+      MIL_INT InternalNumberOfElementsForStdVector = 0;
+      M3dgraInquire(List3dgraId, Label, M_STRIP_HLVLDATATYPE(InquireType) + M_NB_ELEMENTS + M_TYPE_MIL_INT, &InternalNumberOfElementsForStdVector);
+
+      UserVarPtr.resize(InternalNumberOfElementsForStdVector);
+
+      if(InternalNumberOfElementsForStdVector > 0)
+         {
+         return M3dgraInquire(List3dgraId, Label, InquireType, &UserVarPtr[0]);
+         }
+      return 0;
+      }
+
+   // ----------------------------------------------------------
+   // Overloads for std::vector in M3dgraDots.
+   template <typename UserType>
+   inline MIL_INT64 MFTYPE M3dgraDots(MIL_ID List3dgraId,
+                                      MIL_INT64 ParentLabel,
+                                      MIL_INT NumPoints,
+                                      const std::vector<UserType>& CoordXArrayPtr,
+                                      const std::vector<UserType>& CoordYArrayPtr,
+                                      const std::vector<UserType>& CoordZArrayPtr,
+                                      CMilArrayParamIn PointsRArrayPtr,
+                                      CMilArrayParamIn PointsGArrayPtr,
+                                      CMilArrayParamIn PointsBArrayPtr,
+                                      MIL_INT64 ControlFlag)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      if(!PointsRArrayPtr.IsValidParam() ||
+         !PointsGArrayPtr.IsValidParam() ||
+         !PointsBArrayPtr.IsValidParam())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The input arrays cannot be a non-zero integer."));
+         }
+      if((!PointsRArrayPtr.IsNullPtr() && PointsRArrayPtr.GetMilDataType() != MilTraits<MIL_UINT8>::TypeFlag) ||
+         (!PointsGArrayPtr.IsNullPtr() && PointsGArrayPtr.GetMilDataType() != MilTraits<MIL_UINT8>::TypeFlag) ||
+         (!PointsBArrayPtr.IsNullPtr() && PointsBArrayPtr.GetMilDataType() != MilTraits<MIL_UINT8>::TypeFlag))
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The data type of the color vectors must be MIL_UINT8."));
+         }
+      if(CoordXArrayPtr.size() != CoordYArrayPtr.size() || CoordXArrayPtr.size() != CoordZArrayPtr.size())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The coordinate vectors must have the same size."));
+         }
+      if(CoordXArrayPtr.empty())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The coordinate vectors cannot be empty."));
+         }
+      if((PointsRArrayPtr.IsNullPtr() != PointsGArrayPtr.IsNullPtr()) ||
+         (PointsRArrayPtr.IsNullPtr() != PointsBArrayPtr.IsNullPtr()) ||
+         (!PointsRArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != PointsRArrayPtr.Size<MIL_UINT8>()) ||
+         (!PointsGArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != PointsGArrayPtr.Size<MIL_UINT8>()) ||
+         (!PointsBArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != PointsBArrayPtr.Size<MIL_UINT8>()))
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The color vectors must either all be empty or have the same size as the coordinate vectors."));
+         }
+      if(NumPoints <= 0)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("NumPoints parameter must be greater than zero."));
+         }
+      if(NumPoints > (MIL_INT)CoordXArrayPtr.size() && NumPoints != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("NumPoints parameter must be smaller or equal (M_DEFAULT) to the size of the coordinate vectors."));
+         }
+#endif
+      if(NumPoints == M_DEFAULT || NumPoints > (MIL_INT)CoordXArrayPtr.size())
+         {
+         NumPoints = (MIL_INT)CoordXArrayPtr.size();
+         }
+
+      return M3dgraDots(List3dgraId,
+                        ParentLabel,
+                        NumPoints,
+                        &CoordXArrayPtr[0],
+                        &CoordYArrayPtr[0],
+                        &CoordZArrayPtr[0],
+                        PointsRArrayPtr.GetData<MIL_UINT8>(),
+                        PointsGArrayPtr.GetData<MIL_UINT8>(),
+                        PointsBArrayPtr.GetData<MIL_UINT8>(),
+                        ControlFlag);
+      }
+   // ----------------------------------------------------------
+   // Overloads for std::vector in M3dgraPolygon.
+   template <typename UserType>
+   inline MIL_INT64 MFTYPE M3dgraPolygon(MIL_ID List3dgraId,
+                                         MIL_INT64 ParentLabel,
+                                         MIL_INT64 CreationMode,
+                                         MIL_INT NumPoints,
+                                         const std::vector<UserType>& CoordXArrayPtr,
+                                         const std::vector<UserType>& CoordYArrayPtr,
+                                         const std::vector<UserType>& CoordZArrayPtr,
+                                         CMilArrayParamIn TextureXArrayPtr,
+                                         CMilArrayParamIn TextureYArrayPtr,
+                                         MIL_ID TextureBufId,
+                                         MIL_INT64 ControlFlag)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      if(!TextureXArrayPtr.IsValidParam() ||
+         !TextureYArrayPtr.IsValidParam())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The input arrays cannot be a non-zero integer."));
+         }
+      if((!TextureXArrayPtr.IsNullPtr() && TextureXArrayPtr.GetMilDataType() != MilTraits<UserType>::TypeFlag) ||
+         (!TextureYArrayPtr.IsNullPtr() && TextureYArrayPtr.GetMilDataType() != MilTraits<UserType>::TypeFlag))
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The coordinate and texture vectors must all have the same data type."));
+         }
+      if(CoordXArrayPtr.size() != CoordYArrayPtr.size() || CoordXArrayPtr.size() != CoordZArrayPtr.size())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The coordinate vectors must have the same size."));
+         }
+      if(CoordXArrayPtr.empty())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The vectors cannot be empty."));
+         }
+      if((TextureXArrayPtr.IsNullPtr() != TextureYArrayPtr.IsNullPtr()) ||
+         (!TextureXArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != TextureXArrayPtr.Size<UserType>()) ||
+         (!TextureYArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != TextureYArrayPtr.Size<UserType>()))
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The texture vectors must either both be null or have the same size as the coordinate vectors."));
+         }
+      if(NumPoints <= 0)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("NumPoints parameter must be greater than zero."));
+         }
+      if(NumPoints > (MIL_INT)CoordXArrayPtr.size() && NumPoints != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("NumPoints parameter must be smaller or equal (M_DEFAULT) to the size of the coordinate vectors."));
+         }
+#endif
+      if(NumPoints == M_DEFAULT || NumPoints > (MIL_INT)CoordXArrayPtr.size())
+         {
+         NumPoints = (MIL_INT)CoordXArrayPtr.size();
+         }
+
+      return M3dgraPolygon(List3dgraId,
+                           ParentLabel,
+                           CreationMode,
+                           NumPoints,
+                           &CoordXArrayPtr[0],
+                           &CoordYArrayPtr[0],
+                           &CoordZArrayPtr[0],
+                           TextureXArrayPtr.GetData<UserType>(),
+                           TextureYArrayPtr.GetData<UserType>(),
+                           TextureBufId,
+                           ControlFlag);
+      }
+#endif // defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+
+
+////////////////////////////////////////////////////////////////////////////////
+// MIL_UNIQUE_ID support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+#if M_MIL_USE_SAFE_TYPE
+template <> inline bool MilIsCorrectObjectType<&M3dgraFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_3D_GRAPHIC_LIST;
+   }
+#endif
+typedef MIL_UNIQUE_ID<&M3dgraFree > MIL_UNIQUE_3DGRA_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+//3DGRA
+inline MIL_UNIQUE_3DGRA_ID M3dgraAlloc(MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_3DGRA_ID(M3dgraAlloc(SysId, ControlFlag, M_NULL));
+   }
+
+template <MilFreeFuncType FreeFunc> inline void M3dgraFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+
+
+// End of MIL_UNIQUE_ID support
+////////////////////////////////////////////////////////////////////////////////
+#endif // __MIL3DGRA_H__
diff --git a/Common_Class/Matrox/Include/MILDyn/milcom.h b/Common_Class/Matrox/Include/MILDyn/milcom.h
new file mode 100644
index 0000000..0765387
--- /dev/null
+++ b/Common_Class/Matrox/Include/MILDyn/milcom.h
@@ -0,0 +1,326 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MILCOM.H
+// Content           :  Define for the Mcom module
+// Revision          :  10.35.1105
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2019.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+#ifndef __MILCOM_H__
+#define __MILCOM_H__
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* General milcom defines */
+#define M_COM_SUCCESS                  0
+#define M_COM_ERROR                    1
+
+// Allocation control flags
+#define M_NO_RXYZ_SWAP                      0x00000001
+#define M_COM_NO_CONNECT                    0x00000002
+#define M_COM_NO_CONNECT_NO_RXYZ_SWAP       0x00000004
+#define M_COM_EMULATION                     0x00000008
+
+/**************************************************************************/
+/* McomAlloc TypeofProtocol                                               */
+/**************************************************************************/
+#define M_COM_PROTOCOL_PROFINET     1
+#define M_COM_PROTOCOL_ETHERNETIP   2
+#define M_COM_PROTOCOL_MODBUS       3
+#define M_COM_PROTOCOL_EPSON        4
+#define M_COM_PROTOCOL_ABB          5
+#define M_COM_PROTOCOL_FANUC        6
+#define M_COM_PROTOCOL_KUKA         7
+#define M_COM_PROTOCOL_MOTOMAN      8
+#define M_COM_PROTOCOL_DENSO        9
+#define M_COM_PROTOCOL_STAUBLI      10
+#define M_COM_PROTOCOL_GENERIC      11
+#define M_COM_PROTOCOL_CCLINK       12
+#define M_COM_PROTOCOL_OPCUA        13
+
+/**************************************************************************/
+/* McomRead/McomWrite description                                         */
+/**************************************************************************/
+#define M_DISCRETE_INPUT     MIL_TEXT("M_DISCRETE_INPUT")
+#define M_COILS              MIL_TEXT("M_COILS")
+#define M_HOLDING_REGISTER   MIL_TEXT("M_HOLDING_REGISTER")
+#define M_INPUT_REGISTER     MIL_TEXT("M_INPUT_REGISTER")
+
+#define M_COM_ETHERNETIP_PRODUCER_ID  110
+#define M_COM_ETHERNETIP_PRODUCER     MIL_TEXT("110")
+#define M_COM_ETHERNETIP_CONSUMER_ID  111
+#define M_COM_ETHERNETIP_CONSUMER     MIL_TEXT("111")
+#define M_COM_ETHERNETIP_CONFIG_ID    112
+#define M_COM_ETHERNETIP_CONFIG       MIL_TEXT("112")
+
+#define M_COM_MODBUS_PATH(id,table) MIL_TEXT(#id) MIL_TEXT("/") table
+#define M_COM_MODBUS_TCP_PATH(slave,id,table) MIL_TEXT(#id) MIL_TEXT("@") MIL_TEXT(slave) MIL_TEXT("/") table
+#define M_COM_ETHERNETIP_PATH(assembly) MIL_TEXT("/") MIL_TEXT(#assembly)
+#define M_COM_ETHERNETIP_REMOTE_PATH(assembly, remote) MIL_TEXT(slave) MIL_TEXT("/") MIL_TEXT(#assembly)
+#define M_COM_PROFINET_PATH(module) MIL_TEXT("/") MIL_TEXT(#module)
+
+// CClink Device
+#define M_COM_CCLINK_RAW                                 MIL_TEXT("RAW")
+#define M_COM_CCLINK_INPUT_FLAG                          MIL_TEXT("RX")
+#define M_COM_CCLINK_OUTPUT_FLAG                         MIL_TEXT("RY")
+#define M_COM_CCLINK_INPUT_REGISTER                      MIL_TEXT("RWR")
+#define M_COM_CCLINK_OUTPUT_REGISTER                     MIL_TEXT("RWW")
+
+// CClink Raw mode Offset
+#define M_COM_CCLINK_FORCE_READ_INPUT                    (1UL << 0)
+
+#define M_COM_CCLINK_FLAGS_MEMORY_BANK                   (1UL << 1)
+#define M_COM_CCLINK_INPUT_FLAGS_MEMORY_BANK             (M_COM_CCLINK_FLAGS_MEMORY_BANK | M_COM_CCLINK_FORCE_READ_INPUT)
+#define M_COM_CCLINK_OUTPUT_FLAGS_MEMORY_BANK            (M_COM_CCLINK_FLAGS_MEMORY_BANK)
+
+#define M_COM_CCLINK_REGISTERS_MEMORY_BANK               (1UL << 2)
+#define M_COM_CCLINK_INPUT_REGISTERS_MEMORY_BANK         (M_COM_CCLINK_REGISTERS_MEMORY_BANK | M_COM_CCLINK_FORCE_READ_INPUT)
+#define M_COM_CCLINK_OUTPUT_REGISTERS_MEMORY_BANK        (M_COM_CCLINK_REGISTERS_MEMORY_BANK)
+
+/**************************************************************************/
+/* Mcom control/Inquire settings                                          */
+/**************************************************************************/
+//General
+#define M_COM_REMOTE_ADDRESS                 (2|M_CLIENT_ENCODING)
+#define M_COM_REMOTE_ADDRESS_SIZE            (M_STRING_SIZE + M_COM_REMOTE_ADDRESS)
+#define M_COM_REMOTE_PORT                    3
+
+#define M_COM_PROFINET_DEVICEID              7
+#define M_COM_PROFINET_GET_MODULES           8
+#define M_COM_HOOK_ID                        9
+#define M_COM_START                          10
+#define M_COM_TIMEOUT                        11
+#define M_COM_ABORT                          12
+#define M_COM_PROFINET_GET_PLC_STATE         13
+#define M_COM_GET_CONNECTION_STATE           14
+#define M_COM_IS_HARDWARE                    15
+#define M_COM_PROTOCOL_TYPE                  16
+#define M_COM_DEVICE_DESCRIPTION             (17|M_CLIENT_ENCODING)
+#define M_COM_DEVICE_DESCRIPTION_SIZE        (M_STRING_SIZE + M_COM_DEVICE_DESCRIPTION)
+#define M_COM_INIT_VALUE                     19
+#define M_COM_EMULATION_MODE                 20
+#define M_COM_EMULATOR_SYNC                  21
+#define M_COM_INSTANCE_NAME                  (22|M_CLIENT_ENCODING)
+#define M_COM_PROTOCOL_VERSION               23
+#define M_COM_INSTANCE_NAME_SIZE             (M_STRING_SIZE + M_COM_INSTANCE_NAME)
+
+//Robot
+#define M_COM_ROBOT_CONNECT                 106
+#define M_COM_ROBOT_TIMEOUT                 107
+#define M_COM_ROBOT_ISCONNECTED             108
+#define M_COM_ROBOT_COMMAND_ABORT           109
+#define M_COM_ROBOT_COMMAND_TIMEOUT         110
+#define M_COM_ROBOT_DISCONNECT              111
+#define M_COM_ROBOT_CONNECT_RETRY           112
+#define M_COM_ROBOT_CONNECT_RETRY_WAIT      113
+
+//Cclink
+#define M_COM_CCLINK_START                   1000
+#define M_COM_CCLINK_TOTAL_OCCUPIED_STATION  M_COM_CCLINK_START + 1
+
+//Opcua - Open Platform Communications Unified Architecture
+#define M_COM_OPCUA_START                   2000
+#define M_COM_OPCUA_NODESET_LIST            M_COM_OPCUA_START + 1
+
+//Ethernet/IP
+#define M_COM_ETHERNETIP_START              20000
+#define M_COM_ETHERNETIP_CONSUMER_SIZE      M_COM_ETHERNETIP_START + 1
+#define M_COM_ETHERNETIP_PRODUCER_SIZE      M_COM_ETHERNETIP_START + 2
+#define M_COM_ETHERNETIP_CONFIG_SIZE        M_COM_ETHERNETIP_START + 3
+#define M_COM_ETHERNETIP_ASSEMBLY_LIST      M_COM_ETHERNETIP_START + 4
+
+//Profinet Array
+#define M_COM_PROFINET_GET_MODULE_ID             10000
+#define M_COM_PROFINET_GET_MODULE_ID_RANGE       500
+   //We reserve 500 ID for modules ID
+
+#define M_COM_PROFINET_GET_SUBMODULE_ID          (M_COM_PROFINET_GET_MODULE_ID + M_COM_PROFINET_GET_MODULE_ID_RANGE)
+#define M_COM_PROFINET_GET_SUBMODULE_ID_RANGE    500
+   //We reserve 500 ID for modules ID
+
+#define M_COM_PROFINET_GET_MODULE_INSIZE         (M_COM_PROFINET_GET_SUBMODULE_ID + M_COM_PROFINET_GET_SUBMODULE_ID_RANGE)
+#define M_COM_PROFINET_GET_MODULE_INSIZE_RANGE   500
+   //We reserve 500 ID for module IN size
+
+#define M_COM_PROFINET_GET_MODULE_OUTSIZE        (M_COM_PROFINET_GET_MODULE_INSIZE + M_COM_PROFINET_GET_MODULE_INSIZE_RANGE)
+#define M_COM_PROFINET_GET_MODULE_OUTSIZE_RANGE  500
+#define M_COM_PROFINET_START                     (M_COM_PROFINET_GET_MODULE_OUTSIZE + M_COM_PROFINET_GET_MODULE_OUTSIZE_RANGE) 
+#define M_COM_PROFINET_INPUT_SIZE                M_COM_PROFINET_START + 1
+#define M_COM_PROFINET_OUTPUT_SIZE               M_COM_PROFINET_START + 2
+   //We reserve 500 ID for module OUT size
+
+/**************************************************************************/
+/* McomControl Parameter                                                  */
+/**************************************************************************/
+
+/**************************************************************************/
+/* McomInquire Parameter                                                  */
+/**************************************************************************/
+
+//Values for M_COM_PROFINET_GET_PLC_STATE
+#define M_COM_PROFINET_STATUS_STOP            0x0001
+#define M_COM_PROFINET_STATUS_RUN             0x0002
+#define M_COM_PROFINET_STATUS_PRIMARY         0x0010
+#define M_COM_PROFINET_STATUS_BACKUP          0x0020
+#define M_COM_PROFINET_STATUS_STATION_OK      0x0040
+/**************************************************************************/
+/* McomHookFunction HookType                                              */
+/**************************************************************************/
+#define M_COM_ERROR_TRIGGER     4
+#define M_COM_DATA_CHANGE       5
+
+#define M_COM_GET_HOOK_INFO_SIZE   0x8000000000000000
+/**************************************************************************/
+/* McomGetHookInfo(), Info type                                           */
+/**************************************************************************/
+#define M_COM_ID                             99
+
+#define M_COM_ERROR_NUMBER                   56
+#define M_COM_PROFINET_SLOT_CHANGED_COUNT    57
+#define M_COM_PROFINET_SLOT_CHANGED_LIST     58
+#define M_COM_EVENT_ID                       59
+
+#define M_COM_ERR_OFFSET                     47000L
+
+/**************************************************************************/
+/* McomQueryProtocols                                                     */
+/**************************************************************************/
+#define M_COM_PROTOCOL_NAME_SIZE       50
+#define M_COM_PROTOCOL_TYPE_ALL        0
+#define M_COM_PROTOCOL_TYPE_PLC        1
+#define M_COM_PROTOCOL_TYPE_ROBOT      2
+
+/**************************************************************************/
+/* McomSendPositionXXX                                                    */
+/**************************************************************************/
+#define M_COM_FIND_POSITION_REQUEST          1
+#define M_COM_ROBOT_FIND_POSITION_RESULT     2
+#define M_COM_USER_OPCODE                    1000
+/**************************************************************************/
+/* Function prototypes                                                    */
+/**************************************************************************/
+
+typedef MIL_HOOK_FUNCTION_PTR MIL_COM_HOOK_FUNCTION_PTR;
+
+#if M_MIL_USE_UNICODE
+MIL_ID MFTYPE McomAllocW(MIL_ID SysId, MIL_INT64 ProtocolType, MIL_CONST_TEXTW_PTR DeviceDescription, MIL_INT64 InitFlag, MIL_INT64 InitValue, MIL_ID* ComIdPtr);
+MIL_ID MFTYPE McomAllocA(MIL_ID SysId, MIL_INT64 ProtocolType, MIL_CONST_TEXTA_PTR DeviceDescription, MIL_INT64 InitFlag, MIL_INT64 InitValue, MIL_ID* ComIdPtr);
+void MFTYPE McomReadW(MIL_ID ComId, MIL_CONST_TEXTW_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, void* UserArrayPtr);
+void MFTYPE McomReadA(MIL_ID ComId, MIL_CONST_TEXTA_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, void* UserArrayPtr);
+void MFTYPE McomWriteW(MIL_ID ComId, MIL_CONST_TEXTW_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, const void* UserArrayPtr);
+void MFTYPE McomWriteA(MIL_ID ComId, MIL_CONST_TEXTA_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, const void* UserArrayPtr);
+MIL_INT MFTYPE McomQueryProtocolsW(MIL_ID SystemId, MIL_INT Type, MIL_INT Version, MIL_INT Index, MIL_TEXTW_PTR Name, MIL_INT64* Id);
+MIL_INT MFTYPE McomQueryProtocolsA(MIL_ID SystemId, MIL_INT Type, MIL_INT Version, MIL_INT Index, MIL_TEXTA_PTR Name, MIL_INT64* Id);
+void MFTYPE McomControlText(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue);
+void MFTYPE McomControlTextW(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR ControlValue);
+void MFTYPE McomControlTextA(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR ControlValue);
+#else
+MIL_ID MFTYPE McomAlloc(MIL_ID SysId, MIL_INT64 ProtocolType, MIL_CONST_TEXT_PTR DeviceDescription, MIL_INT64 InitFlag, MIL_INT64 InitValue, MIL_ID* ComIdPtr);
+void MFTYPE McomRead(MIL_ID ComId, MIL_CONST_TEXT_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, void* UserArrayPtr);
+void MFTYPE McomWrite(MIL_ID ComId, MIL_CONST_TEXT_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, const void* UserArrayPtr);
+MIL_INT MFTYPE McomQueryProtocols(MIL_ID SystemId, MIL_INT Type, MIL_INT Version, MIL_INT Index, MIL_TEXT_PTR Name, MIL_INT64* Id);
+void MFTYPE McomControlText(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue);
+#endif
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+void MFTYPE McomControlInt64(MIL_ID ComId,
+                             MIL_INT64 ControlType,
+                             MIL_INT64 ControlValue);
+void MFTYPE McomControlDouble(MIL_ID ComId,
+                              MIL_INT64 ControlType,
+                              MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+#define McomControlInt64  McomControl
+#define McomControlDouble McomControl
+void MFTYPE McomControl(MIL_ID ComId,
+                        MIL_INT64 ControlType,
+                        MIL_DOUBLE ControlValue);
+#endif
+
+MIL_INT MFTYPE McomInquire(MIL_ID     ComId,
+                           MIL_INT64  InquireType,
+                           void*      UserVarPtr);
+
+MIL_INT MFTYPE McomHookFunction(MIL_ID ComId, MIL_INT HookType, MIL_COM_HOOK_FUNCTION_PTR HookHandlerPtr, void *UserDataPtr);
+
+MIL_INT MFTYPE McomGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+
+void MFTYPE McomSendPosition(MIL_ID ComId, MIL_INT64 OperationCode, MIL_INT64 Status, MIL_INT64 ObjectSpecifier, MIL_DOUBLE PositionX, MIL_DOUBLE PositionY, MIL_DOUBLE PositionZ, MIL_DOUBLE RotationX, MIL_DOUBLE RotationY, MIL_DOUBLE RotationZ, MIL_INT64 ControlFlag, MIL_DOUBLE ControlValue);
+void MFTYPE McomWaitPositionRequest(MIL_ID ComId, MIL_INT64 *OperationCodePtr, MIL_INT64 *StatusPtr, MIL_INT64 *ObjectSpecifierPtr, MIL_DOUBLE *PositionXPtr, MIL_DOUBLE *PositionYPtr, MIL_DOUBLE *PositionZPtr, MIL_DOUBLE *RotationXPtr, MIL_DOUBLE *RotationYPtr, MIL_DOUBLE *RotationZPtr, MIL_INT64 ControlFlag, MIL_DOUBLE ControlValue);
+void MFTYPE McomSendCommand(MIL_ID ComId, MIL_INT64 OperationCode, MIL_INT64 Status, MIL_INT64 DataSize, void* DataPtr, MIL_INT64 ControlFlag, MIL_DOUBLE ControlValue);
+void MFTYPE McomReceiveCommand(MIL_ID ComId, MIL_INT64 *OperationCodePtr, MIL_INT64 *StatusPtr, MIL_INT64 ArraySize, void* ArrayPtr, MIL_INT64 *ReceivedDataSizePtr, MIL_INT64 ControlFlag, MIL_DOUBLE ControlValue);
+
+void MFTYPE McomFree(MIL_ID ComId);
+
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+#define McomRead         McomReadW
+#define McomWrite        McomWriteW
+#define McomAlloc        McomAllocW
+#define McomQueryProtocols McomQueryProtocolsW
+#else
+#define McomRead         McomReadA
+#define McomWrite        McomWriteA
+#define McomAlloc        McomAllocA
+#define McomQueryProtocols McomQueryProtocolsA
+#undef McomControlText
+#define McomControlText McomControlTextA
+#endif
+#endif
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+}
+#endif
+
+#if M_MIL_USE_64BIT
+#ifdef __cplusplus
+//////////////////////////////////////////////////////////////
+// McomControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, int ControlValue)
+   {
+   McomControlInt64(ComId, ControlType, ControlValue);
+   };
+#endif
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   McomControlInt64(ComId, ControlType, ControlValue);
+   };
+
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, MIL_INT64 ControlValue)
+   {
+   McomControlInt64(ComId, ControlType, ControlValue);
+   };
+
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
+   {
+   McomControlDouble(ComId, ControlType, ControlValue);
+   };
+
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   McomControlText(ComId, ControlType, ControlValue);
+   };
+#else
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. Int64 one
+//////////////////////////////////////////////////////////////
+#define McomControl  McomControlDouble
+
+
+#endif // __cplusplus
+#endif // M_MIL_USE_64BIT
+
+
+#endif /* __MILCOM_H__ */
diff --git a/Common_Class/Matrox/Include/MILDyn/mildisplay.h b/Common_Class/Matrox/Include/MILDyn/mildisplay.h
new file mode 100644
index 0000000..03444eb
--- /dev/null
+++ b/Common_Class/Matrox/Include/MILDyn/mildisplay.h
@@ -0,0 +1,2036 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MILDISPLAY.H
+* Revision     :  10.40.0640
+* Content      :  This file contains the defines necessary to use the
+*                 Matrox Imaging Library display module
+* Comments     :  
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+#ifndef __MIL_DISPLAY_H__
+#define __MIL_DISPLAY_H__
+
+/************************************************************************/
+/* MdispAlloc() for Windowed system                                     */
+/************************************************************************/
+#define M_MIL_DISPLAY_WND_CLASS_NAME MIL_TEXT("MIL Default Window")
+
+// Maximum number of display that can be managed
+#define M_MAX_VIDEO_DEVICE                            64L
+
+/* DispNum */
+#define M_DEV0                                        0L
+#define M_DEV1                                        1L
+#define M_DEV2                                        2L
+#define M_DEV3                                        3L
+#define M_DEV4                                        4L
+#define M_DEV5                                        5L
+#define M_DEV6                                        6L
+#define M_DEV7                                        7L
+#define M_DEV8                                        8L
+#define M_DEV9                                        9L
+#define M_DEV10                                       10L
+#define M_DEV11                                       11L
+#define M_DEV12                                       12L
+#define M_DEV13                                       13L
+#define M_DEV14                                       14L
+#define M_DEV15                                       15L
+#define M_DEV16                                       16L
+#define M_DEV17                                       17L
+#define M_DEV18                                       18L
+#define M_DEV19                                       19L
+#define M_DEV20                                       20L
+#define M_DEV21                                       21L
+#define M_DEV22                                       22L
+#define M_DEV23                                       23L
+#define M_DEV24                                       24L
+#define M_DEV25                                       25L
+#define M_DEV26                                       26L
+#define M_DEV27                                       27L
+#define M_DEV28                                       28L
+#define M_DEV29                                       29L
+#define M_DEV30                                       30L
+#define M_DEV31                                       31L
+#define M_DEV32                                       32L
+#define M_DEV33                                       33L
+#define M_DEV34                                       34L
+#define M_DEV35                                       35L
+#define M_DEV36                                       36L
+#define M_DEV37                                       37L
+#define M_DEV38                                       38L
+#define M_DEV39                                       39L
+#define M_DEV40                                       40L
+#define M_DEV41                                       41L
+#define M_DEV42                                       42L
+#define M_DEV43                                       43L
+#define M_DEV44                                       44L
+#define M_DEV45                                       45L
+#define M_DEV46                                       46L
+#define M_DEV47                                       47L
+#define M_DEV48                                       48L
+#define M_DEV49                                       49L
+#define M_DEV50                                       50L
+#define M_DEV51                                       51L
+#define M_DEV52                                       52L
+#define M_DEV53                                       53L
+#define M_DEV54                                       54L
+#define M_DEV55                                       55L
+#define M_DEV56                                       56L
+#define M_DEV57                                       57L
+#define M_DEV58                                       58L
+#define M_DEV59                                       59L
+#define M_DEV60                                       60L
+#define M_DEV61                                       61L
+#define M_DEV62                                       62L
+#define M_DEV63                                       63L
+#define M_CRTC0                                       0x00010000L
+#define M_CRTC1                                       0x00020000L
+#define M_CRTC2                                       0x00030000L
+#define M_CRTC3                                       0x00040000L
+#define M_CRTC4                                       0x00050000L
+#define M_CRTC5                                       0x00060000L
+#define M_CRTC6                                       0x00070000L
+#define M_CRTC_MASK                                   0x00070000L
+#define M_CRTC_OFFSET                                 (16)
+#define M_CRTC_INDEX(a)                               (((a&M_CRTC_MASK)>>M_CRTC_OFFSET)-1)
+#define M_DEVICE_NUMBER_MASK                          0x000003F
+#define M_DEVICE_NUMBER(a)                            (a&M_DEVICE_NUMBER_MASK)
+#define M_ALL_VALID_DISP_DEV_BITS                     (M_DEVICE_NUMBER_MASK | M_CRTC_MASK | M_MONITOR_BITS)
+#define M_DISPLAY_NUMBER(devindex,crtcindex)          (devindex|((crtcindex+1)<<M_CRTC_OFFSET))
+#define M_CENTER                                      0x00000080L
+/* display positions values */
+#define M_LEFT                                        0x00000100L
+#define M_RIGHT                                       0x00000200L
+#define M_TOP                                         0x00000400L
+#define M_BOTTOM                                      0x00000800L
+#define M_MONITOR_BITS                                0x00000F80
+#define M_MONITOR_POSITION(p)                         ((M_NULL == (p&(~M_MONITOR_BITS)))? (p&M_MONITOR_BITS): M_NULL)
+#define M_MOUSE_RESTRICTED                            0x00000001L
+
+/* Init Flag */
+#define M_REMOTE_DISPLAY                              0x00000001L
+#define M_ASYNC_CUSTOM                                0x00000002L
+#define M_DISPLAY_PROGRESSIVE                         0x00000004L
+#define M_DISPLAY_INTERLACED                          0x00000008L
+#define M_LOCAL_DISPLAY                               0x00000010L
+//#define  AVAILABLE                                  0x00000020L Reserved for 3ddisp
+//#define  AVAILABLE                                  0x00000040L
+//#define  AVAILABLE                                  0x00000080L
+//#define  AVAILABLE                                  0x00000100L
+#define M_NETWORK                                     0x00000200L
+#define M_EXCLUSIVE                                   0x00000400L
+//#define  AVAILABLE                                  0x00000800L
+#define M_XDUAL_SCREEN                                0x00001000L
+#define M_VIDEO_HD                                    0x00002000L
+#define M_DUAL_SCREEN                                 0x00004000L
+#define M_VIDEO_ENCODER                               0x00008000L
+#define M_AUXILIARY                                   0x00010000L
+//#define  AVAILABLE                                  0x00020000L
+#define M_EXTERNAL                                    0x00040000L
+#define M_VIDEO_HARDWARE_DEVICE                       0x00080000L
+#define M_WPF                                         0x00100000L
+#define M_IN_BUFFER_DISPLAY                           0x00200000L
+#define M_RENDER_TO_BUFFER                            0x00400000L
+#define M_WEB                                         0x00800000L
+#define M_WINDOWED                                    0x01000000L
+//#define  AVAILABLE                                  0x02000000L
+//#define  AVAILABLE                                  0x04000000L
+#define M_MIL_WINDOW                                  0x08000000L
+#define M_USER_WINDOW                                 0x10000000L
+#define M_GDI_OVERLAY                                 0x20000000L
+#define  M_FULL_SCREEN                                0x40000000L //M_LOCAL_DISPLAY_CONTROL
+//NOT available (sign bit)                            0x80000000L
+#define M_ALL_INIT_FLAGS                              0x41F5F62FL //for basic-display
+#define M_DOCUMENTED_INIT_FLAGS                       (M_WINDOWED|M_AUXILIARY|M_DUAL_SCREEN|M_VIDEO_ENCODER|M_EXCLUSIVE)
+#define M_DISPLAY_LOCATION                            (M_LOCAL_DISPLAY|M_REMOTE_DISPLAY)
+#define M_IS_EXCLUSIVE(InitFlag)                      (InitFlag&M_EXCLUSIVE)
+
+/************************************************************************/
+/* MdispInquire() / MdispControl() Types                                */
+/************************************************************************/
+#define M_LOCAL_DISPLAY_CONTROL                       0X40000000L
+#define M_REMOTE_DISPLAY_CONTROL                      0X20000000L
+#define M_FORCED_LOCAL_DISPLAY_CONTROL                0x10000000L
+#define M_FORCED_REMOTE_DISPLAY_CONTROL               0x08000000L
+#define M_POST_CONTROL                                0x04000000L
+
+#define M_IS_POST_CONTROL(X)                          ((X)&M_POST_CONTROL)
+#define M_ORIGINAL_DISPLAY_CONTROL(X)                 ((X)&~(M_FORCED_LOCAL_DISPLAY_CONTROL|M_FORCED_REMOTE_DISPLAY_CONTROL))
+#define M_FORCE_ON_LOCAL_DISPLAY(X)                   ((X) | M_FORCED_LOCAL_DISPLAY_CONTROL)
+#define M_FORCE_ON_REMOTE_DISPLAY(X)                  ((X) | M_FORCED_REMOTE_DISPLAY_CONTROL)
+#define M_IS_FORCED_ON_LOCAL_DISPLAY(X)               (((X) & M_FORCED_LOCAL_DISPLAY_CONTROL))
+#define M_IS_FORCED_ON_REMOTE_DISPLAY(X)              (((X) & M_FORCED_REMOTE_DISPLAY_CONTROL))
+
+// Shared controls/inquires with other modules (not all listed)
+#define M_SIZE_X                                      1536L //M_LOCAL_DISPLAY_CONTROL // 0x600
+#define M_SIZE_Y                                      1537L //M_LOCAL_DISPLAY_CONTROL // 0x601
+#define M_SIZE_Z                                      1538L //M_LOCAL_DISPLAY_CONTROL // 0x602
+#define M_SIZE_BAND                                   1005L //M_LOCAL_DISPLAY_CONTROL
+#define M_SIZE_BAND_LUT                               1006L //M_REMOTE_DISPLAY_CONTROL
+#define M_SIZE_BIT                                    1007L //M_REMOTE_DISPLAY_CONTROL
+#define M_TYPE                                        1008L //M_REMOTE_DISPLAY_CONTROL
+#define M_NUMBER                                      1009L //M_LOCAL_DISPLAY_CONTROL
+#define M_INIT_FLAG                                   1012L //M_LOCAL_DISPLAY_CONTROL
+#define M_ATTRIBUTE                                   1013L //M_REMOTE_DISPLAY_CONTROL
+#define M_SIGN                                        1014L //M_REMOTE_DISPLAY_CONTROL
+#define M_THREAD_PRIORITY                             1019L //M_LOCAL_DISPLAY_CONTROL // Already defined in mil.h
+#define M_NEED_UPDATE                                 1020L //M_REMOTE_DISPLAY_CONTROL
+#define M_ENCODER_START                               1025L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER                                     M_ENCODER_START
+#define M_ENCODER_MODE                                1026L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_TYPE                                1027L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_SYNC_SOURCE                         1028L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_SYNC                                M_ENCODER_SYNC_SOURCE
+#define M_ENCODER_PEDESTAL                            1029L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_FILTER                              1030L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_RGB_SYNC                            1031L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_INFO_MODE                           1032L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_RESET                               1033L //M_LOCAL_DISPLAY_CONTROL   //1034 reseved
+#define M_ENCODER_SELECT_FIELD_ODD                    1037L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_SELECT_FIELD_EVEN                   1038L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_CONTRAST                            1039L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_BRIGHTNESS                          1040L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_SATURATION                          1041L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_HUE                                 1042L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_OVR_SHOW                            1043L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_OVR_LUT                             1044L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_OVR_BUF_ID                          1045L //M_LOCAL_DISPLAY_CONTROL
+
+#define M_ENCODER_STATE                               M_ENCODER
+#define M_SYNC_TYPE                                   M_ENCODER_RGB_SYNC
+#define M_ENCODER_SYNC_LOCK                           M_ENCODER_SYNC_SOURCE
+#define M_ENCODER_SYNC_FIELDS                         1047L //M_REMOTE_DISPLAY_CONTROL
+#define M_ENCODER_CLOCK                               1048L //M_REMOTE_DISPLAY_CONTROL
+#define M_ENCODER_END                                 M_ENCODER_CLOCK
+#define M_Q_FACTOR                                    2564L //M_REMOTE_DISPLAY_CONTROL    // Already defined in mil.h
+#define M_MODIFICATION_COUNT                          5010L //M_REMOTE_DISPLAY_CONTROL    // Already defined in mil.h
+
+/************************************************************************/
+/* MdispInquire() Types MIL_ID range start                              */
+/************************************************************************/
+#define M_DISP_INQUIRE_MIL_ID_START                   1100L
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_OWNER_SYSTEM                                1101L //M_REMOTE_DISPLAY_CONTROL // Already define in mil.h
+#define M_LUT_ID                                      1102L //M_REMOTE_DISPLAY_CONTROL // Already define in mil.h
+#define M_SELECTED                                    1103L //M_REMOTE_DISPLAY_CONTROL
+#define M_OVERLAY_LUT                                 1104L //M_REMOTE_DISPLAY_CONTROL
+#define M_WINDOW_BUF_ID                               1105L //M_REMOTE_DISPLAY_CONTROL
+#define M_OVERLAY_ID                                  1106L //M_REMOTE_DISPLAY_CONTROL
+#define M_ASSOCIATED_LUT                              1110L //M_REMOTE_DISPLAY_CONTROL
+#define M_AUXILIARY_BUF_ID                            1115L //M_LOCAL_DISPLAY_CONTROL
+#define M_UNDERLAY_ID                                 1120L //M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SURFACE                             1121L //M_LOCAL_DISPLAY_CONTROL
+#define M_PRIMARY_SURFACE_ID                          1122L //M_REMOTE_DISPLAY_CONTROL
+#define M_USER_OVERLAY_ID                             1123L //M_REMOTE_DISPLAY_CONTROL
+#define M_COMPRESSED_DISPLAY_SURFACE                  1125L //M_REMOTE_DISPLAY_CONTROL
+#define M_ASYNCHRONOUS_DISPLAY_SURFACE                1126L //M_REMOTE_DISPLAY_CONTROL
+#define M_CURRENT_OVERLAY_ID                          1127L //M_REMOTE_DISPLAY_CONTROL
+#define M_DISP_INQUIRE_MIL_ID_END                     1199L
+/************************************************************************/
+/* MdispInquire() Types MIL_ID range end                                */
+/************************************************************************/
+
+
+#define M_PAN_X                                       3000L //M_LOCAL_DISPLAY_CONTROL
+#define M_PAN_Y                                       3001L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_X                                      3002L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_Y                                      3003L //M_LOCAL_DISPLAY_CONTROL
+#define M_HARDWARE_PAN                                3004L //M_LOCAL_DISPLAY_CONTROL
+#define M_HARDWARE_ZOOM                               3005L //M_LOCAL_DISPLAY_CONTROL
+#define M_KEY_MODE                                    3007L //M_REMOTE_DISPLAY_CONTROL
+#define M_KEY_CONDITION                               3008L //M_REMOTE_DISPLAY_CONTROL
+#define M_KEY_MASK                                    3009L //M_REMOTE_DISPLAY_CONTROL
+#define M_KEY_SUPPORTED                               3011L //M_REMOTE_DISPLAY_CONTROL
+#define M_TRANSPARENT_COLOR                           0x01000060L //M_LOCAL_DISPLAY_CONTROL
+#define M_OVERLAY                                     M_OVR //(0x00000080) M_REMOTE_DISPLAY_CONTROL
+#define M_INTERPOLATION_MODE                          3018L //M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_OFFSET                                 3019L
+#define M_FRAME_START_HANDLER_PTR                     3020L//needed for mil.dll? -applicationinfo
+#define M_FRAME_START_HANDLER_USER_PTR                3021L//needed for mil.dll? -applicationinfo
+#define M_OVERLAY_SHOW                                3023L //M_REMOTE_DISPLAY_CONTROL
+#define M_DISPLAY_MODE                                3029L //M_LOCAL_DISPLAY_CONTROL
+#define M_PIXEL_FORMAT                                3032L //M_LOCAL_DISPLAY_CONTROL
+#define M_LUT_SUPPORTED                               3033L //M_REMOTE_DISPLAY_CONTROL
+#define M_WINDOW_ZOOM                                 3051L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_RESIZE                               3052L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_OVERLAP                              3053L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SCROLLBAR                            3054L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PROTECT_AREA                         3056L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_TITLE_BAR                            3057L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MENU_BAR                             3058L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_TITLE_BAR_CHANGE                     3059L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MENU_BAR_CHANGE                      3060L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MOVE                                 3061L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SYSBUTTON                            3062L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MINBUTTON                            3063L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MAXBUTTON                            3064L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PALETTE_NOCOLLAPSE                   3069L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_RANGE                                3072L //M_LOCAL_DISPLAY_CONTROL // Already defined in mil.h
+#define M_WINDOW_UPDATE_ON_PAINT                      3081L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PAINT                                3083L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_INITIAL_POSITION_X                   3088L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_INITIAL_POSITION_Y                   3089L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_HANDLE                               3110L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_OFFSET_X                             3111L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_OFFSET_Y                             3112L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SIZE_X                               3113L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SIZE_Y                               3114L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PAN_X                                3115L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PAN_Y                                3116L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ZOOM_X                               3117L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ZOOM_Y                               3118L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE_OFFSET_X                     3141L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE_OFFSET_Y                     3142L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE_SIZE_X                       3145L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE_SIZE_Y                       3146L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ACTIVE                               3149L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ENABLE                               3150L //M_LOCAL_DISPLAY_CONTROL
+#define M_PALETTE_HANDLE                              3151L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_THREAD_HANDLE                        3152L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_THREAD_ID                            3153L //M_LOCAL_DISPLAY_CONTROL
+#define M_KEYBOARD_USE                                3155L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SYNC_UPDATE                          3165L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PAINT_MESSAGES                       3172L //M_LOCAL_DISPLAY_CONTROL
+#define M_VIEW_MODE                                   3182L //M_REMOTE_DISPLAY_CONTROL
+#define M_VIEW_BIT_SHIFT                              3183L //M_REMOTE_DISPLAY_CONTROL
+#define M_UPDATE_WEB                                  3187L //M_LOCAL_DISPLAY_CONTROL
+#define M_NO_TEARING                                  3188L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_MAX_X                                  3190L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_MIN_X                                  3191L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_MAX_Y                                  3192L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_MIN_Y                                  3193L //M_LOCAL_DISPLAY_CONTROL
+#define M_DUAL_ZOOM                                   3197L //M_LOCAL_DISPLAY_CONTROL
+#define M_DUAL_ZOOM_SUPPORTED                         3198L //M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE                                      3199L //M_REMOTE_DISPLAY_CONTROL
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+//      M_UPDATE+M_SYNCHRONOUS                        3200L //M_REMOTE_DISPLAY_CONTROL
+//      M_UPDATE+M_ASYNCHRONOUS                       3201L //M_REMOTE_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE                              3202L //M_LOCAL_DISPLAY_CONTROL
+#define M_AUXILIARY_KEEP_DISPLAY_ALIVE                3207L //M_LOCAL_DISPLAY_CONTROL
+#define M_USE_MOUSE_PAN                               3208L //M_LOCAL_DISPLAY_CONTROL
+#define M_USE_MOUSE_ZOOM                              3209L //M_LOCAL_DISPLAY_CONTROL
+#define M_SELECT_VIDEO_SOURCE                         3210L //M_LOCAL_DISPLAY_CONTROL
+#define M_AUXILIARY_KEEP_UNDERLAY_ALIVE               3211L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_TRANSPARENCY                         3212L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_TRANSPARENT_COLOR                    3213L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ALPHA_BLENDING                       3214L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ALPHA_VALUE                          3215L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_LAYERED                              3216L //M_LOCAL_DISPLAY_CONTROL
+#define M_RESTRICTED_MOUSE_ACTIVATED                  3217L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_MODE                            3218L //M_LOCAL_DISPLAY_CONTROL
+#define M_MOUSE_USE                                   3219L //M_LOCAL_DISPLAY_CONTROL
+#define M_SOMEONE_HOOKED_TO_ANNOTATIONS_DRAW          3220L //M_LOCAL_DISPLAY_CONTROL
+#define M_REGION_OUTSIDE_SHOW                         3221L //M_LOCAL_DISPLAY_CONTROL
+#define M_REGION_INSIDE_SHOW                          3222L //M_LOCAL_DISPLAY_CONTROL
+#define M_REGION_OUTSIDE_COLOR                        3223L //M_LOCAL_DISPLAY_CONTROL
+#define M_REGION_INSIDE_COLOR                         3224L //M_LOCAL_DISPLAY_CONTROL
+#define M_UNIFIED_ZOOM                                3225L //M_LOCAL_DISPLAY_CONTROL
+#define M_ACTUAL_SIZE                                 3226L //M_LOCAL_DISPLAY_CONTROL
+#define M_HANDLE_MESSAGES                             3227L //M_LOCAL_DISPLAY_CONTROL
+#define M_MOUSE_CURSOR_CHANGE                         3229L //M_LOCAL_DISPLAY_CONTROL
+#define M_HANDLE_SET_CURSOR_MESSAGE                   M_MOUSE_CURSOR_CHANGE
+#define M_FORWARD_DISP_MESSAGES_TO_CLIENT             3233L //M_LOCAL_DISPLAY_CONTROL
+
+/******************************************************************************/
+
+#if OldDefinesSupport
+#define M_KEY_COLOR                                   M_TRANSPARENT_COLOR
+MIL_DEPRECATED(M_KEY_COLOR, 1000)
+#define M_WINDOW_OVR_WRITE                            M_OVERLAY
+MIL_DEPRECATED(M_WINDOW_OVR_WRITE, 1000)
+#define M_WINDOW_OVR_BUF_ID                           M_OVERLAY_ID
+MIL_DEPRECATED(M_WINDOW_OVR_BUF_ID, 1000)
+#define M_WINDOW_OVR_SHOW                             M_OVERLAY_SHOW
+MIL_DEPRECATED(M_WINDOW_OVR_SHOW, 1000)
+#define M_WINDOW_OVR_LUT                              M_OVERLAY_LUT
+MIL_DEPRECATED(M_WINDOW_OVR_LUT, 1000)
+#define M_WINDOW_UPDATE                               M_UPDATE
+MIL_DEPRECATED(M_WINDOW_UPDATE, 1000)
+#define M_DISP_NUMBER                                 M_NUMBER
+MIL_DEPRECATED(M_DISP_NUMBER, 1000)
+#define M_DISP_FORMAT                                 M_FORMAT
+MIL_DEPRECATED(M_DISP_FORMAT, 1000)
+#define M_DISP_INIT_FLAG                              M_INIT_FLAG
+MIL_DEPRECATED(M_DISP_INIT_FLAG, 1000)
+#define M_DISP_PAN_X                                  M_PAN_X
+MIL_DEPRECATED(M_DISP_PAN_X, 1000)
+#define M_DISP_PAN_Y                                  M_PAN_Y
+MIL_DEPRECATED(M_DISP_PAN_Y, 1000)
+#define M_DISP_ZOOM_X                                 M_ZOOM_X
+MIL_DEPRECATED(M_DISP_ZOOM_X, 1000)
+#define M_DISP_ZOOM_Y                                 M_ZOOM_Y
+MIL_DEPRECATED(M_DISP_ZOOM_Y, 1000)
+#define M_DISP_HARDWARE_PAN                           M_HARDWARE_PAN
+MIL_DEPRECATED(M_DISP_HARDWARE_PAN, 1000)
+#define M_DISP_HARDWARE_ZOOM                          M_HARDWARE_ZOOM
+MIL_DEPRECATED(M_DISP_HARDWARE_ZOOM, 1000)
+#define M_DISP_KEY_MODE                               M_KEY_MODE
+MIL_DEPRECATED(M_DISP_KEY_MODE, 1000)
+#define M_DISP_KEY_CONDITION                          M_KEY_CONDITION
+MIL_DEPRECATED(M_DISP_KEY_CONDITION, 1000)
+#define M_DISP_KEY_MASK                               M_KEY_MASK
+MIL_DEPRECATED(M_DISP_KEY_MASK, 1000)
+#define M_DISP_KEY_COLOR                              M_TRANSPARENT_COLOR
+MIL_DEPRECATED(M_DISP_KEY_COLOR, 1000)
+#define M_DISP_MODE                                   M_DISPLAY_MODE
+MIL_DEPRECATED(M_DISP_MODE, 1000)
+#define M_DISP_THREAD_PRIORITY                        M_THREAD_PRIORITY
+MIL_DEPRECATED(M_DISP_THREAD_PRIORITY, 1000)
+#define M_DISP_INTERPOLATION_MODE                     M_INTERPOLATION_MODE
+MIL_DEPRECATED(M_DISP_INTERPOLATION_MODE, 1000)
+#define M_DISP_HOOK_OFFSET                            M_HOOK_OFFSET
+MIL_DEPRECATED(M_DISP_HOOK_OFFSET, 1000)
+#define M_DISP_KEY_SUPPORTED                          M_KEY_SUPPORTED
+MIL_DEPRECATED(M_DISP_KEY_SUPPORTED, 1000)
+#define M_DISP_WINDOW_ZOOM                            M_WINDOW_ZOOM
+MIL_DEPRECATED(M_DISP_WINDOW_ZOOM, 1000)
+#define M_DISP_WINDOW_RESIZE                          M_WINDOW_RESIZE
+MIL_DEPRECATED(M_DISP_WINDOW_RESIZE, 1000)
+#define M_DISP_WINDOW_OVERLAP                         M_WINDOW_OVERLAP
+MIL_DEPRECATED(M_DISP_WINDOW_OVERLAP, 1000)
+#define M_DISP_WINDOW_SCROLLBAR                       M_WINDOW_SCROLLBAR
+MIL_DEPRECATED(M_DISP_WINDOW_SCROLLBAR, 1000)
+#define M_DISP_WINDOW_UPDATE                          M_UPDATE
+MIL_DEPRECATED(M_DISP_WINDOW_UPDATE, 1000)
+#define M_DISP_WINDOW_PROTECT_AREA                    M_WINDOW_PROTECT_AREA
+MIL_DEPRECATED(M_DISP_WINDOW_PROTECT_AREA, 1000)
+#define M_DISP_WINDOW_TITLE_BAR                       M_WINDOW_TITLE_BAR
+MIL_DEPRECATED(M_DISP_WINDOW_TITLE_BAR, 1000)
+#define M_DISP_WINDOW_MENU_BAR                        M_WINDOW_MENU_BAR
+MIL_DEPRECATED(M_DISP_WINDOW_MENU_BAR, 1000)
+#define M_DISP_WINDOW_TITLE_BAR_CHANGE                M_WINDOW_TITLE_BAR_CHANGE
+MIL_DEPRECATED(M_DISP_WINDOW_TITLE_BAR_CHANGE, 1000)
+#define M_DISP_WINDOW_MENU_BAR_CHANGE                 M_WINDOW_MENU_BAR_CHANGE
+MIL_DEPRECATED(M_DISP_WINDOW_MENU_BAR_CHANGE, 1000)
+#define M_DISP_WINDOW_MOVE                            M_WINDOW_MOVE
+MIL_DEPRECATED(M_DISP_WINDOW_MOVE, 1000)
+#define M_DISP_WINDOW_SYSBUTTON                       M_WINDOW_SYSBUTTON
+MIL_DEPRECATED(M_DISP_WINDOW_SYSBUTTON, 1000)
+#define M_DISP_WINDOW_MINBUTTON                       M_WINDOW_MINBUTTON
+MIL_DEPRECATED(M_DISP_WINDOW_MINBUTTON, 1000)
+#define M_DISP_WINDOW_MAXBUTTON                       M_WINDOW_MAXBUTTON
+MIL_DEPRECATED(M_DISP_WINDOW_MAXBUTTON, 1000)
+#define M_DISP_WINDOW_PALETTE_NOCOLLAPSE              M_WINDOW_PALETTE_NOCOLLAPSE
+MIL_DEPRECATED(M_DISP_WINDOW_PALETTE_NOCOLLAPSE, 1000)
+#define M_DISP_WINDOW_UPDATE_WITH_MESSAGE             M_WINDOW_UPDATE_WITH_SEND_MESSAGE
+MIL_DEPRECATED(M_DISP_WINDOW_UPDATE_WITH_MESSAGE, 1000)
+#define M_DISP_WINDOW_PAINT                           M_WINDOW_PAINT
+MIL_DEPRECATED(M_DISP_WINDOW_PAINT, 1000)
+#define M_DISP_WINDOW_RANGE                           M_WINDOW_RANGE
+MIL_DEPRECATED(M_DISP_WINDOW_RANGE, 1000)
+#define M_DISP_WINDOW_HANDLE                          M_WINDOW_HANDLE
+MIL_DEPRECATED(M_DISP_WINDOW_HANDLE, 1000)
+#define M_DISP_WINDOW_OFFSET_X                        M_WINDOW_OFFSET_X
+MIL_DEPRECATED(M_DISP_WINDOW_OFFSET_X, 1000)
+#define M_DISP_WINDOW_OFFSET_Y                        M_WINDOW_OFFSET_Y
+MIL_DEPRECATED(M_DISP_WINDOW_OFFSET_Y, 1000)
+#define M_DISP_WINDOW_SIZE_X                          M_WINDOW_SIZE_X
+MIL_DEPRECATED(M_DISP_WINDOW_SIZE_X, 1000)
+#define M_DISP_WINDOW_SIZE_Y                          M_WINDOW_SIZE_Y
+MIL_DEPRECATED(M_DISP_WINDOW_SIZE_Y, 1000)
+#define M_DISP_WINDOW_PAN_X                           M_WINDOW_PAN_X
+MIL_DEPRECATED(M_DISP_WINDOW_PAN_X, 1000)
+#define M_DISP_WINDOW_PAN_Y                           M_WINDOW_PAN_Y
+MIL_DEPRECATED(M_DISP_WINDOW_PAN_Y, 1000)
+#define M_DISP_WINDOW_ZOOM_X                          M_WINDOW_ZOOM_X
+MIL_DEPRECATED(M_DISP_WINDOW_ZOOM_X, 1000)
+#define M_DISP_WINDOW_ZOOM_Y                          M_WINDOW_ZOOM_Y
+MIL_DEPRECATED(M_DISP_WINDOW_ZOOM_Y, 1000)
+#define M_DISP_WINDOW_TITLE_NAME                      M_WINDOW_TITLE_NAME
+MIL_DEPRECATED(M_DISP_WINDOW_TITLE_NAME, 1000)
+#define M_DISP_VISIBLE_OFFSET_X                       M_WINDOW_VISIBLE_OFFSET_X
+MIL_DEPRECATED(M_DISP_VISIBLE_OFFSET_X, 1000)
+#define M_DISP_VISIBLE_OFFSET_Y                       M_WINDOW_VISIBLE_OFFSET_Y
+MIL_DEPRECATED(M_DISP_VISIBLE_OFFSET_Y, 1000)
+#define M_DISP_VISIBLE_SIZE_X                         M_WINDOW_VISIBLE_SIZE_X
+MIL_DEPRECATED(M_DISP_VISIBLE_SIZE_X, 1000)
+#define M_DISP_VISIBLE_SIZE_Y                         M_WINDOW_VISIBLE_SIZE_Y
+MIL_DEPRECATED(M_DISP_VISIBLE_SIZE_Y, 1000)
+#define M_VISIBLE_OFFSET_X                            M_WINDOW_VISIBLE_OFFSET_X
+MIL_DEPRECATED(M_VISIBLE_OFFSET_X, 1000)
+#define M_VISIBLE_OFFSET_Y                            M_WINDOW_VISIBLE_OFFSET_Y
+MIL_DEPRECATED(M_VISIBLE_OFFSET_Y, 1000)
+#define M_VISIBLE_SIZE_X                              M_WINDOW_VISIBLE_SIZE_X
+MIL_DEPRECATED(M_VISIBLE_SIZE_X, 1000)
+#define M_VISIBLE_SIZE_Y                              M_WINDOW_VISIBLE_SIZE_Y
+MIL_DEPRECATED(M_VISIBLE_SIZE_Y, 1000)
+#define M_DISP_WINDOW_ACTIVE                          M_WINDOW_ACTIVE
+MIL_DEPRECATED(M_DISP_WINDOW_ACTIVE, 1000)
+#define M_DISP_WINDOW_ENABLE                          M_WINDOW_ENABLE
+MIL_DEPRECATED(M_DISP_WINDOW_ENABLE, 1000)
+#define M_DISP_PALETTE_HANDLE                         M_PALETTE_HANDLE
+MIL_DEPRECATED(M_DISP_PALETTE_HANDLE, 1000)
+#define M_DISP_WINDOW_THREAD_HANDLE                   M_WINDOW_THREAD_HANDLE
+MIL_DEPRECATED(M_DISP_WINDOW_THREAD_HANDLE, 1000)
+#define M_DISP_WINDOW_THREAD_ID                       M_WINDOW_THREAD_ID
+MIL_DEPRECATED(M_DISP_WINDOW_THREAD_ID, 1000)
+#define M_WINDOW_DIB_HEADER                           M_BITMAPINFO
+MIL_DEPRECATED(M_WINDOW_DIB_HEADER, 1000)
+#define M_WINDOW_UPDATE_WITH_SEND_MESSAGE             M_UPDATE_WITH_PAINT_MESSAGE
+MIL_DEPRECATED(M_WINDOW_UPDATE_WITH_SEND_MESSAGE, 1000)
+#define M_DDRAW_UNDERLAY_ID                           M_UNDERLAY_ID
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_ID, 1000)
+#define M_DDRAW_UNDERLAY_SHOW                         M_UNDERLAY_SHOW
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_SHOW, 1000)
+#define M_MAX_VGA_DEVICE                              M_MAX_VIDEO_DEVICE
+MIL_DEPRECATED(M_MAX_VGA_DEVICE, 1000)
+#define M_WINDOW_KEYBOARD_USE                         M_KEYBOARD_USE
+MIL_DEPRECATED(M_WINDOW_KEYBOARD_USE, 1000)
+#endif //OldDefinesSupport
+
+// Display reserved area for Sys or Dev Inquire/Control
+#define M_SYS_DISPLAY_START                           4501L
+#define M_IS_IN_DISPLAY_SYS_RANGE(X)     (((M_STRIP_INTERMOD_BITS(X) >= M_SYS_DISPLAY_START) && ( M_STRIP_INTERMOD_BITS(X) <= M_SYS_DISPLAY_END)) || \
+                                          ((M_STRIP_INTERMOD_BITS(X) >= M_SYS_DISPLAY_RANGE2_START) && (M_STRIP_INTERMOD_BITS(X) <= M_SYS_DISPLAY_RANGE2_END)))
+
+#define M_MAIN_DDRAW_OBJECT                           M_SYS_DISPLAY_START+0L     //4501
+#define M_DDRAW_AVAILABLE                             M_SYS_DISPLAY_START+2L     //4503
+#define M_PRIMARY_SURFACE_FORMAT                      M_SYS_DISPLAY_START+9L     //4510
+#define M_PRIMARY_SURFACE_SIZE_BITS                   M_SYS_DISPLAY_START+10L    //4511
+#define M_PRIMARY_SURFACE_SIZE_X                      M_SYS_DISPLAY_START+11L    //4512
+#define M_PRIMARY_SURFACE_SIZE_Y                      M_SYS_DISPLAY_START+12L    //4513
+#define M_PRIMARY_SURFACE_PITCH_BYTE                  M_SYS_DISPLAY_START+13L    //4514
+#define M_WINDOWED_DISPLAY_AVAILABLE                  M_SYS_DISPLAY_START+19L    //4520
+#define M_UNDERLAY_LIVE_FORMAT_SUPPORTED              M_SYS_DISPLAY_START+26L    //4527
+#define M_UNDERLAY_FORMAT_SUPPORTED                   M_SYS_DISPLAY_START+28L    //4529
+#define M_UNDERLAY_SUPPORTED                          M_SYS_DISPLAY_START+29L    //4530
+#define M_UNDERLAY_ZOOM_MAX                           M_SYS_DISPLAY_START+30L    //4531
+#define M_UNDERLAY_ZOOM_MIN                           M_SYS_DISPLAY_START+31L    //4532
+
+#define M_UNDERLAY_DOUBLE_RANGE_START                 M_SYS_DISPLAY_START+33L    //4534
+#define M_UNDERLAY_DOUBLE_RANGE_END                   M_SYS_DISPLAY_START+40L    //4541
+
+#define M_VENDOR_ID                                   M_SYS_DISPLAY_START+48L    //4549
+#define M_DEVICE_ID                                   M_SYS_DISPLAY_START+49L    //4550
+#define M_DIRECTX_USED_FOR_AUXILIARY                  M_SYS_DISPLAY_START+50L    //4551
+#define M_SUPPORTED_DISPLAY_TYPE_STRING               ((M_SYS_DISPLAY_START+52L) | M_CLIENT_ENCODING)    //4553
+#define M_NEED_LOCK_UNLOCK                            M_SYS_DISPLAY_START+54L    //4555
+#define M_CAN_ALLOCATE_VIDEO_MEMORY                   M_SYS_DISPLAY_START+56L    //4557
+#define M_SCAN_LINE_ORDERING_MODE                     M_SYS_DISPLAY_START+58L    //4559
+#define M_REFRESH_RATE                                M_SYS_DISPLAY_START+59L    //4560
+#define M_VIDEO_DEVICE_DESCRIPTION_STRING             ((M_SYS_DISPLAY_START+64L) | M_CLIENT_ENCODING)    //4565
+#define M_SUB_SYSTEM_ID                               M_SYS_DISPLAY_START+66L    //4567
+#define M_CAN_ALLOCATE_MONO8_IN_VIDEO_MEMORY          M_SYS_DISPLAY_START+75L    //4576
+#define M_D3D_AVAILABLE                               M_SYS_DISPLAY_START+77L    //4578
+#define M_MAIN_D3D9_OBJECT                            M_SYS_DISPLAY_START+78L    //4579
+#define M_PART_OF_DESKTOP                             M_SYS_DISPLAY_START+79L    //4580
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#endif
+#define M_DISPLAY_TYPE_SUPPORTED                      M_SYS_DISPLAY_START+88L    //4589
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#endif
+#define M_CAN_ALLOCATE_CONTIGUOUS_VIDEO_MEMORY        M_SYS_DISPLAY_START+94L    //4595
+#define M_REVISION                                    M_SYS_DISPLAY_START+95L    //4596
+
+#define M_SYS_BUFFER_HANDLER_START                    M_SYS_DISPLAY_START+96L       // 4597
+#define M_REGISTER_EXTERN_BUFFER_API_MODULE           M_SYS_BUFFER_HANDLER_START+0L // 4598
+#define M_UNREGISTER_EXTERN_BUFFER_API_MODULE         M_SYS_BUFFER_HANDLER_START+1L // 4599
+#define M_SYS_BUFFER_HANDLER_END                      M_SYS_DISPLAY_START+99L       // 4600
+#define M_IS_IN_BUFFER_HANDLER_SYS_RANGE(X)           ((M_STRIP_INTERMOD_BITS(X) >= M_SYS_BUFFER_HANDLER_START) && (M_STRIP_INTERMOD_BITS(X) <= M_SYS_BUFFER_HANDLER_END))
+#define M_SYS_DISPLAY_END                             4600L
+
+#define M_COMPRESSION_TYPE                            5045L //M_REMOTE_DISPLAY_CONTROL // already defined in mil.h
+#define M_GRAB_BUFFERS                                5095L // internal use only
+#define M_GRAB_BUFFERS_NO_LOCK                        5096L // internal use only
+#define M_NUMBER_OF_GRAB_IN_PROGRESS                  5097L
+
+#define M_APP_DIRECTX_RANGE_START                    (M_APP_INQUIRE_SYS_START+300L)
+
+// Value reserved for AppInquire/AppControl to the hardware manager (300 to 374)
+#define M_SYSTEM_ASSOCIATED_TO_DX_OBJECT             (M_APP_DIRECTX_RANGE_START+2L)      // 302
+#define M_DIRECTX_VERSION                            (M_APP_DIRECTX_RANGE_START+3L)      // 303
+#define M_IS_GPU_AVAILABLE                           (M_APP_DIRECTX_RANGE_START+7L)      // 307
+#define M_DUAL_HEAD                                  (M_APP_DIRECTX_RANGE_START+20L)     // 320
+#define M_XORG_ACCELERATION                          (M_APP_DIRECTX_RANGE_START+21L)     // 321
+#define M_NB_OF_VIDEO_DEVICE                         (M_APP_DIRECTX_RANGE_START+22L)     // 322
+#define M_NB_OF_VGA_DEVICE                           M_NB_OF_VIDEO_DEVICE
+#define M_VGA_SYSTEM_FROM_PHYSICAL_ADDRESS           (M_APP_DIRECTX_RANGE_START+23L)     // 323
+#define M_USE_UNDERLAY_IN_ALL_DISPLAY                (M_APP_DIRECTX_RANGE_START+24L)     // 324
+#define M_USE_DDRAW_UNDERLAY                         M_USE_UNDERLAY_IN_ALL_DISPLAY
+#define M_USE_UNDERLAY                               (M_APP_DIRECTX_RANGE_START+25L)     // 325 //This define is used as an AppControl/Inquire *AND* a DispControl/Inquire //M_LOCAL_DISPLAY_CONTROL
+#define M_USE_DDRAW_UNDERLAY_SURFACE                 M_USE_UNDERLAY                      // This control is used in both directX and display dll (but use internally only for display DLL)
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#endif
+#define M_NB_OF_DESKTOP_VGA_DEVICE                   (M_APP_DIRECTX_RANGE_START+29L)     // 329
+#define M_CURRENT_DIRECTX_VERSION                    (M_APP_DIRECTX_RANGE_START+31L)     // 331
+#define M_NB_OF_GRAPHIC_ADAPTER                      (M_APP_DIRECTX_RANGE_START+32L)     // 332
+#define M_GPU_NO_TEARING_AVAILABLE                   (M_APP_DIRECTX_RANGE_START+34L)     // 334
+#define M_NB_OF_PCI_VIDEO_DEVICE                     (M_APP_DIRECTX_RANGE_START+38L)     // 338
+#define M_FIRST_VIDEO_DEVICE_ON_DESKTOP              (M_APP_DIRECTX_RANGE_START+40L)     // 340
+#define M_CONFIG_CHANGE_THREAD_PRIORITY              (M_APP_DIRECTX_RANGE_START+41L)     // 341
+#define M_GPU_BILINEAR_SUPPORTED                     (M_APP_DIRECTX_RANGE_START+42L)     // 342
+#define M_ENUM_PCI_VIDDEV_MEMORY_RANGE               (M_APP_DIRECTX_RANGE_START+43L)     // 343 
+#define M_GENERATE_CAPS_FILE                         (M_APP_DIRECTX_RANGE_START+45L)     // 345
+#define M_CAN_ALLOC_NON_PAGED_IN_VIDEO_MEMORY        (M_APP_DIRECTX_RANGE_START+46L)     // 346
+//#define                                            (M_APP_DIRECTX_RANGE_START+48L)     // 348
+#define M_DESKTOP_FORMAT                             (M_APP_DIRECTX_RANGE_START+49L)     // 349
+#define M_DESKTOP_SIZE_BIT                           (M_APP_DIRECTX_RANGE_START+50L)     // 350
+#define M_IS_ONE_DISPLAY_8_BITS                      (M_APP_DIRECTX_RANGE_START+51L)     // 351
+#define M_IS_ONE_DISPLAY_15_BITS                     (M_APP_DIRECTX_RANGE_START+52L)     // 352
+#define M_IS_ONE_DISPLAY_16_BITS                     (M_APP_DIRECTX_RANGE_START+53L)     // 353
+#define M_IS_ONE_DISPLAY_24_BITS                     (M_APP_DIRECTX_RANGE_START+54L)     // 354
+#define M_IS_ONE_DISPLAY_32_BITS                     (M_APP_DIRECTX_RANGE_START+55L)     // 355
+#define M_APP_DIRECTX_RANGE_END                      (M_APP_DIRECTX_RANGE_START+74L)
+
+// Display reserved area for AppInquire/Control
+/*Reserve values between M_APP_DISPLAY_START and M_APP_DISPLAY_END*/
+#define M_APP_DISPLAY_START                          (M_APP_INQUIRE_SYS_START+375L)
+// General purpose AppInquire/AppControl for MilDisplay (375 to 450)
+#define M_APP_GENERAL_DISPLAY_START                  (M_APP_DISPLAY_START)             // 375
+#define M_CAN_ALLOC_MTX0                             (M_APP_GENERAL_DISPLAY_START+0L)  // 375
+#define M_DISPLAY_NUMBER_ALLOCATED                   (M_APP_GENERAL_DISPLAY_START+3L)  // 378
+#define M_DEFAULT_3BITS_3BANDS_DISP_BUFFER_FORMAT    (M_APP_GENERAL_DISPLAY_START+4L)  // 379
+
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL)) //Within ASCII client apps
+   #define M_TRACE_INFORMATION                        M_TRACE_ASCII_INFORMATION
+#else //Inside MIL and in Backward
+   #define M_TRACE_INFORMATION                       (M_APP_GENERAL_DISPLAY_START+6L)  // 381
+#endif
+
+#define M_SHOW_COUNTER_IN_TITLE                      (M_APP_GENERAL_DISPLAY_START+8L)  // 383
+#define M_KILL_SCHEME                                (M_APP_GENERAL_DISPLAY_START+10L) // 385
+#define M_DISP_BUFFER_NUMBER_ALLOCATED               (M_APP_GENERAL_DISPLAY_START+11L) // 386
+#define M_READY_TO_BE_FREED                          (M_APP_GENERAL_DISPLAY_START+12L) // 387
+#define M_USER_TRACE_TEXT                            (M_APP_GENERAL_DISPLAY_START+15L) // 390
+#define M_USER_TRACE_VALUE                           (M_APP_GENERAL_DISPLAY_START+16L) // 391
+#define M_RESUSCITATE_SCHEME                         (M_APP_GENERAL_DISPLAY_START+17L) // 392
+#define M_NB_EXTERN_BUFFER_API_MODULE                (M_APP_GENERAL_DISPLAY_START+18L) // 393
+#define M_WANT_TO_HANDLE_AUXILIARY_UPDATE            (M_APP_GENERAL_DISPLAY_START+19L) // 394
+#define M_TRACE_ASCII_INFORMATION                    (M_APP_GENERAL_DISPLAY_START+22L) // 397
+#define M_DESKTOP_COMPOSITION                        (M_APP_GENERAL_DISPLAY_START+24L) // 399
+#define M_EXCLUSIVE_ON_LAST_MONITOR                  (M_APP_GENERAL_DISPLAY_START+27L) // 402
+#define M_MILDISPLAY_DLL_IN_DEBUG_MODE               (M_APP_GENERAL_DISPLAY_START+28L) // 403
+
+// End of reserved value for display
+#define M_APP_DISPLAY_END                            (M_APP_INQUIRE_SYS_START+450L)
+
+#define M_IS_IN_DIRECTX_APP_RANGE(X)                 (((M_STRIP_INTERMOD_BITS(X) >= M_APP_DIRECTX_RANGE_START) && (M_STRIP_INTERMOD_BITS(X) <= M_APP_DIRECTX_RANGE_END))   || \
+                                                      M_IS_IN_DIRECTX_APP_DX_HANDLER_RANGE(X) || \
+                                                      M_IS_IN_VGA_DEVICE_SYSTEM_RANGE(X))
+
+#define M_IS_IN_DISPLAY_APP_RANGE(X)                 (((M_STRIP_INTERMOD_BITS(X) >= M_APP_DISPLAY_START) && (M_STRIP_INTERMOD_BITS(X) <= M_APP_DISPLAY_END))         || \
+                                                      M_IS_IN_APP_SCREEN_MANAGER_RANGE(X))
+
+#define M_DISP_INQUIRE_SIZEOF_DOUBLE_START            6600L
+// Inquire value with a size of double, must be in that range : 6600-6699
+//#define                                             (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+0L)  // 6600L //M_LOCAL_DISPLAY_CONTROL
+#define M_SCALE_X                                     (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+1L)  // 6601L //M_LOCAL_DISPLAY_CONTROL
+#define M_SCALE_Y                                     (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+2L)  // 6602L //M_LOCAL_DISPLAY_CONTROL
+#define M_PAN_OFFSET_X                                (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+3L)  // 6603L //M_LOCAL_DISPLAY_CONTROL
+#define M_PAN_OFFSET_Y                                (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+4L)  // 6604L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_FACTOR_X                               (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+5L)  // 6605L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_FACTOR_Y                               (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+6L)  // 6606L //M_LOCAL_DISPLAY_CONTROL
+#define M_REAL_ZOOM_FACTOR_X                          (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+7L)  // 6607L //M_LOCAL_DISPLAY_CONTROL
+#define M_REAL_ZOOM_FACTOR_Y                          (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+8L)  // 6608L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MAXIMUM_ZOOM_FACTOR                  (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+9L)  // 6609L //M_LOCAL_DISPLAY_CONTROL // obsolete
+#define M_WINDOW_MINIMUM_ZOOM_FACTOR                  (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+10L) // 6610L //M_LOCAL_DISPLAY_CONTROL // obsolete
+#define M_WINDOW_ZOOM_FACTOR_X                        (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+11L) // 6611L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ZOOM_FACTOR_Y                        (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+12L) // 6612L //M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_RATE                                 (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+13L) // 6613L //M_LOCAL_DISPLAY_CONTROL
+#define M_REAL_OFFSET_X                               (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+14L) // 6614L //M_LOCAL_DISPLAY_CONTROL
+#define M_REAL_OFFSET_Y                               (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+15L) // 6615L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_ZOOM_MAX                        (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+16L) // 6616L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_ZOOM_MIN                        (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+17L) // 6617L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_ZOOM_INCREMENT                  (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+18L) // 6618L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_ZOOM                            (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+19L) // 6619L //M_LOCAL_DISPLAY_CONTROL
+#define M_DISP_INQUIRE_SIZEOF_DOUBLE_END              (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+99L) // 6699L
+
+
+#define M_DISP_INQUIRE_SIZEOF_INT64_START             6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+#define M_EXTENDED_DISPLAY_SCHEME                     (M_DISP_INQUIRE_SIZEOF_INT64_START+0L) //(6700) M_LOCAL_DISPLAY_CONTROL
+
+#define M_EXTENDED_INIT_FLAG                          6705L //M_LOCAL_DISPLAY_CONTROL
+#define M_DISP_INQUIRE_SIZEOF_INT64_END               6799L
+
+#define M_DISP_INQUIRE_UNKNOWN_SIZEOF_START           6800L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 6800-6899
+#define M_DISP_INQUIRE_UNKNOWN_SIZEOF_END             6899L
+
+
+#define M_DISP_INQUIRE_STRING_START                   7700L
+   #define M_FORMAT                                (7701L|M_CLIENT_ENCODING) //M_LOCAL_DISPLAY_CONTROL  // Already defined in mil.h, considered as a shared control
+   #define M_TITLE                                 (7702L|M_CLIENT_ENCODING) //M_LOCAL_DISPLAY_CONTROL
+
+//      M_FORMAT+M_STRING_SIZE                       (M_STRING_SIZE + M_FORMAT)  //M_LOCAL_DISPLAY_CONTROL
+//      M_TITLE+M_STRING_SIZE                        (M_STRING_SIZE + M_TITLE)  //M_LOCAL_DISPLAY_CONTROL
+
+#if OldDefinesSupport
+   #define M_FORMAT_SIZE                              (M_STRING_SIZE + M_FORMAT) // Already defined in mil.h, considered as a shared control
+   #define M_TITLE_SIZE                               (M_STRING_SIZE + M_TITLE)  
+   #define M_WINDOW_TITLE_NAME_SIZE                   M_TITLE_SIZE
+   #define M_WINDOW_TITLE_NAME                     M_TITLE
+// MIL_DEPRECATED(M_FORMAT_SIZE, 1040)
+// MIL_DEPRECATED(M_TITLE_SIZE, 1040)
+MIL_DEPRECATED(M_WINDOW_TITLE_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_WINDOW_TITLE_NAME, 1040)
+#endif
+
+#define M_DISP_INQUIRE_STRING_END                     7799L
+
+
+
+
+// MdispControl(M_REMAP_TYPE)
+#define M_MULTI_BYTES                                    1L
+#define M_AUTO_SCALE                                     2L
+#define M_BIT_SHIFT                                      3L
+#define M_LOGARITHMIC                                    4L
+#define M_PIXEL_VALUES                                   5L
+#define M_OPAQUE                                         0x01000058L
+#define M_TRANSPARENT                                    0x01000059L
+
+// MdispControl(M_WINDOW_SHOW)
+#define M_FORCE_DISABLE                                  2L
+
+// Mouse cursor types
+//
+// MdispControl(Id, M_SET_USER_CURSOR+[M_CURSOR_XYZ], (MIL_INT)hCursor)
+//
+#define M_CURSOR_NULL                  0L    // To hide the cursor
+#define M_CURSOR_DEFAULT               1L    // Standard arrow
+#define M_OS_CURSOR_ARROW              2L    // Standard arrow
+#define M_OS_CURSOR_IBEAM              3L    // I-beam
+#define M_OS_CURSOR_WAIT               4L    // Hourglass
+#define M_OS_CURSOR_CROSS              5L    // Crosshair
+#define M_OS_CURSOR_UPARROW            6L    // Vertical arrow
+#define M_OS_CURSOR_SIZENWSE           7L    // Double-pointed arrow pointing northwest and southeast
+#define M_OS_CURSOR_SIZENESW           8L    // Double-pointed arrow pointing northeast and southwest
+#define M_OS_CURSOR_SIZEWE             9L    // Double-pointed arrow pointing west and east
+#define M_OS_CURSOR_SIZENS             10L   // Double-pointed arrow pointing north and south
+#define M_OS_CURSOR_SIZEALL            11L   // Four-pointed arrow pointing north, south, east, and west
+#define M_OS_CURSOR_NO                 12L   // Slashed circle
+#define M_OS_CURSOR_HAND               13L   // Pointing Hand
+#define M_OS_CURSOR_APPSTARTING        14L   // Standard arrow and small hourglass
+#define M_OS_CURSOR_HELP               15L   // Arrow and question mark
+#define M_CURSOR_HAND_OPEN             16L   // Open hand
+#define M_CURSOR_HAND_CLOSED           17L   // Closed hand
+#define M_GRA_CURSOR_SIZENWSE          18L   // Double-pointed arrow pointing northwest and southeast 
+#define M_GRA_CURSOR_SIZENESW          19L   // Double-pointed arrow pointing northeast and southwest
+#define M_GRA_CURSOR_SIZEWE            20L   // Double-pointed arrow pointing west and east
+#define M_GRA_CURSOR_SIZENS            21L   // Double-pointed arrow pointing north and south
+#define M_GRA_CURSOR_SIZEALL           22L   // Four-pointed arrow pointing north, south, east, and west
+#define M_GRA_CURSOR_SIZEALL_POINTER   23L   // Arrow and four-pointed arrow pointing north, south, east, and west
+#define M_GRA_CURSOR_NO                24L   // Slashed circle
+#define M_GRA_CURSOR_ROTATE            25L   // Circular arrow
+#define M_GRA_CURSOR_IN_ROTATION       26L   // Quadruple circular arrows
+#define M_GRA_CURSOR_HAND              27L   // Pointing Hand
+#define M_CURSOR_COLOR_PICKER          28L   // Pointing Hand
+// =======================================
+#define M_NUMBER_OF_CURSORS            29L// *** Must be updated when adding new cursor ***
+#define M_MAX_CURSOR                   63L
+#define M_CURSOR_TYPE_MASK             0x0000003F
+
+// 7872 to 7935
+#define M_SET_USER_CURSOR                             7872L //(0x00001EC0) M_LOCAL_DISPLAY_CONTROL
+/*Reserve next values      from                       (M_SET_USER_CURSOR+M_CURSOR_NULL)      //7872L */ //M_LOCAL_DISPLAY_CONTROL
+/*                         to                         (M_SET_USER_CURSOR+M_MAX_CURSOR)       //7935L */ //M_LOCAL_DISPLAY_CONTROL
+
+//Pseudo-ID to apply a control on all displays
+#define M_ALL_DISPLAYS                                (M_PSEUDO_ID+3)
+
+// Value to represent all scheme id. Used with M_RESUSCITATE_SCHEME control
+#define M_ALL_DISPLAY_SCHEMES                         (0x80000000)
+
+//Second range that is reserved for Display Sys or Dev Inquire/Control
+/* Reserve next values     from    M_SYS_DISPLAY_RANGE2_START    8500L 
+                           to      M_SYS_DISPLAY_RANGE2_END      8699L */
+#define M_SYS_DISPLAY_RANGE2_START                    8500L 
+#define M_D3D_SUPPORTED_NO_TEARING_MODE               (M_SYS_DISPLAY_RANGE2_START+1L)    //8501L
+#define M_NO_TEARING_DEVICE                           (M_SYS_DISPLAY_RANGE2_START+5L)    //8505L
+#define M_NO_TEARING_ACTIVE_DEVICE                    (M_SYS_DISPLAY_RANGE2_START+6L)    //8506L
+#define M_VGA_INFO_DISPLAY_RECT                       (M_SYS_DISPLAY_RANGE2_START+7L)    //8507L    // 
+#define M_VGA_INFO_DISPLAY_DEVICE_NAME                (M_SYS_DISPLAY_RANGE2_START+10L)   //8510L    // 
+#define M_CURRENT_MONITOR_RECT                        (M_SYS_DISPLAY_RANGE2_START+12L)   //8512L
+#define M_CURRENT_MONITOR_WORK_RECT                   (M_SYS_DISPLAY_RANGE2_START+13L)   //8513L
+#define M_VIDEO_DEVICE_SYNC                           (M_SYS_DISPLAY_RANGE2_START+14L)   //8514L
+#define M_MAIN_D3D10_OBJECT                           (M_SYS_DISPLAY_RANGE2_START+19L)   //8519L
+#define M_IS_VIRTUAL_DEVICE                           (M_SYS_DISPLAY_RANGE2_START+37L)   //8537L
+#define M_MAIN_D3D11_OBJECT                           (M_SYS_DISPLAY_RANGE2_START+39L)   //8539L
+#define M_D3D_NO_TEARING                              (M_SYS_DISPLAY_RANGE2_START+43L)   //8543L
+#define M_ALLOW_NONPAGED_BUFFERS_IN_VIDEO_MEMORY      (M_SYS_DISPLAY_RANGE2_START+48L)   //8548L
+#define M_IS_VIDEO_DEVICE_ALIVE                       (M_SYS_DISPLAY_RANGE2_START+51L)   //8551L
+#define M_VGA_DEVICE_SYSTEM_START                     (M_SYS_DISPLAY_RANGE2_START+100L)  //8600L
+#define M_VGA_DEVICE_SYSTEM                           (M_VGA_DEVICE_SYSTEM_START+0L)     //8600L
+//8600L to 8663L reserved for M_VGA_DEVICE_SYSTEM
+#define M_VGA_DEVICE_SYSTEM_END                       (M_VGA_DEVICE_SYSTEM_START+M_MAX_VIDEO_DEVICE-1) //8663L
+#define M_SYS_DISPLAY_RANGE2_END                      (M_SYS_DISPLAY_RANGE2_START+199L)  //8699L
+
+// This range is an App inquire range not a DEV range
+#define M_IS_IN_VGA_DEVICE_SYSTEM_RANGE(X)            ((M_STRIP_INTERMOD_BITS(X)>=M_VGA_DEVICE_SYSTEM_START) && \
+                                                       (M_STRIP_INTERMOD_BITS(X)<=M_VGA_DEVICE_SYSTEM_END)     )  // 8600 to 8663
+
+
+#define M_DIB_HANDLE                                  (M_BUF_DISPLAY_START+31L) // 9031
+
+//Reserved values for Screen Manager 9200 - 9399
+#define M_SCREEN_MANAGER_START                        9200L
+//Reserved APP control/inquire values for Screen Manager 9200 - 9249
+#define M_APP_SCREEN_MANAGER_START                    (M_SCREEN_MANAGER_START+0L)      // 9200L
+#define M_PHYS_SHOW_TASKBAR                           (M_APP_SCREEN_MANAGER_START+0L)  // 9200L
+#define M_BEST_DESKTOP_MONITOR                        (M_APP_SCREEN_MANAGER_START+1L)  // 9201L
+#define M_BEST_DESKTOP_RECT                           (M_APP_SCREEN_MANAGER_START+2L)  // 9202L
+#define M_BEST_EXCLUSIVE_MONITOR                      (M_APP_SCREEN_MANAGER_START+3L)  // 9203L
+#define M_MULTI_MONITOR                               (M_APP_SCREEN_MANAGER_START+4L)  // 9204L
+#define M_MONITORS_RECTS_LIST                         (M_APP_SCREEN_MANAGER_START+5L)  // 9205L
+#define M_NEW_EXTERNAL_DISPLAY_ID                     (M_APP_SCREEN_MANAGER_START+6L)  // 9206L
+#define M_DELETE_EXTERNAL_DISPLAY_ID                  (M_APP_SCREEN_MANAGER_START+7L)  // 9207L
+#define M_SCREEN_ID_FROM_SYSTEM_ID                    (M_APP_SCREEN_MANAGER_START+8L)  // 9208L
+#define M_SCREEN_MANAGER_SYSTEM_ID                    (M_APP_SCREEN_MANAGER_START+9L)  // 9209L
+#define M_EXTERNAL_DISPLAY_NUMBER                     (M_APP_SCREEN_MANAGER_START+10L) // 9210L
+#define M_NB_MONITORS_AVAILABLE                       (M_APP_SCREEN_MANAGER_START+13L) // 9213L
+#define M_APP_SCREEN_MANAGER_END                      (M_APP_SCREEN_MANAGER_START+49L) // 9249L
+
+//Reserved DEV control/inquire values for dev Screen Manager 9250 - 9299
+#define M_DEV_SCREEN_MANAGER_START                    (M_APP_SCREEN_MANAGER_END+1L)    // 9250L
+#define M_DESKTOP_RESOLUTION                          (M_DEV_SCREEN_MANAGER_START+0L)  // 9250L
+#define M_TEST_DESKTOP_RESOLUTION                     (M_DEV_SCREEN_MANAGER_START+1L)  // 9251L
+#define M_DESKTOP_DEVICE_NAME                         (M_DEV_SCREEN_MANAGER_START+2L)  // 9252L
+//#define M_DESKTOP_DEVICE_NAME_SIZE                    (M_STRING_SIZE + M_DESKTOP_DEVICE_NAME)
+#define M_EXCLUSIVE_MONITOR_RANK                      (M_DEV_SCREEN_MANAGER_START+4L)  // 9254L
+#define M_IS_EXCLUSIVE_MONITOR_AVAILABLE              (M_DEV_SCREEN_MANAGER_START+5L)  // 9255L
+#define M_EXTERN_DISPLAY_AVAILABLE                    (M_DEV_SCREEN_MANAGER_START+6L)  // 9256L
+#define M_EXTERN_DISPLAY_SUPPORTED_FORMAT             (M_DEV_SCREEN_MANAGER_START+9L)  // 9259L
+#define M_EXTERN_UNDERLAY_AVAILABLE                   (M_DEV_SCREEN_MANAGER_START+10L) // 9260L
+#define M_IS_EXTERNAL_DISPLAY                         (M_DEV_SCREEN_MANAGER_START+14L) // 9264L
+#define M_CURRENT_SCREEN_RECT                         (M_DEV_SCREEN_MANAGER_START+15L) // 9265L (M_CURRENT_MONITOR_RECT)
+#define M_CURRENT_SCREEN_WORK_RECT                    (M_DEV_SCREEN_MANAGER_START+16L) // 9266L (M_CURRENT_MONITOR_WORK_RECT)
+#define M_IS_SCREEN_FORBIDDEN                         (M_DEV_SCREEN_MANAGER_START+18L) // 9268L
+#define M_IS_SCREEN_RECT_USABLE                       (M_DEV_SCREEN_MANAGER_START+19L) // 9269L
+#define M_DEV_SCREEN_MANAGER_END                      (M_DEV_SCREEN_MANAGER_START+49L) // 9299L
+//Reserved but unused values for Screen Manager 9300 - 9374
+#define M_SCREEN_MANAGER_END                          9374L
+
+#define M_IS_IN_SCREEN_MANAGER_RANGE(X)               (((M_STRIP_INTERMOD_BITS(X)>=M_SCREEN_MANAGER_START) && (M_STRIP_INTERMOD_BITS(X)<=M_SCREEN_MANAGER_END)))                     // 9200 - 9399
+#define M_IS_IN_APP_SCREEN_MANAGER_RANGE(X)           (((M_STRIP_INTERMOD_BITS(X)>=M_APP_SCREEN_MANAGER_START) && (M_STRIP_INTERMOD_BITS(X)<=M_APP_SCREEN_MANAGER_END)))             // 9200 - 9249
+#define M_IS_IN_DEV_SCREEN_MANAGER_RANGE(X)           (((M_STRIP_INTERMOD_BITS(X)>=M_DEV_SCREEN_MANAGER_START) && (M_STRIP_INTERMOD_BITS(X)<=M_DEV_SCREEN_MANAGER_END)))             // 9250 - 9299
+
+//Reserved APP control/inquire values for Directx and Display 9400 - 9499
+#define M_DUAL_DISP_DX_APP_RANGE_START                9400L
+#define M_RESET_CRTC                                  (M_DUAL_DISP_DX_APP_RANGE_START+0L)  // 9400L
+#define M_NEW_VIDEO_DEVICE_ADDED                      (M_DUAL_DISP_DX_APP_RANGE_START+6L)  // 9406L
+#define M_VIDEO_DEVICE_REMOVED                        (M_DUAL_DISP_DX_APP_RANGE_START+7L)  // 9407L
+#define M_DUAL_DISP_DX_APP_RANGE_END                  (M_DUAL_DISP_DX_APP_RANGE_START+99L) // 9499L
+#define M_IS_IN_DUAL_DISP_DX_APP_RANGE(X)             (((M_STRIP_INTERMOD_BITS(X) >= M_DUAL_DISP_DX_APP_RANGE_START) && (M_STRIP_INTERMOD_BITS(X) <= M_DUAL_DISP_DX_APP_RANGE_END)))     // 9400 - 9499
+
+#define M_DIRECTX_APP_DX_HANDLER_START                9500L
+#define M_DIRECTX_CAN_CREATE_OVER_HOST_MEMORY         (M_DIRECTX_APP_DX_HANDLER_START+0L)  // 9500L
+#define M_MTX0_SERVICE                                (M_DIRECTX_APP_DX_HANDLER_START+1L)  // 9501L
+#define M_DIRECTX_VIDEO_BUFFER_MAPPABLE               (M_DIRECTX_APP_DX_HANDLER_START+2L)  // 9502L
+#define M_KEEP_POLLING_ON_MODE_CHANGED                (M_DIRECTX_APP_DX_HANDLER_START+3L)  // 9503L
+#define M_DIRECTX_APP_DX_HANDLER_END                  (M_DIRECTX_APP_DX_HANDLER_START+49L) // 9549L
+#define M_IS_IN_DIRECTX_APP_DX_HANDLER_RANGE(X)       ((M_STRIP_INTERMOD_BITS(X) >= M_DIRECTX_APP_DX_HANDLER_START) && (M_STRIP_INTERMOD_BITS(X) <= M_DIRECTX_APP_DX_HANDLER_END))       // 9500 - 9549
+
+//Reserved values for DispControl
+#define M_DISP_CONTROL_START                          10000L
+#define M_NO_TEARING_SKIP_MODE                        (M_DISP_CONTROL_START+1L) //(10001) M_LOCAL_DISPLAY_CONTROL
+#define M_NO_SKIP                                     (M_DISP_CONTROL_START+2L) //(10002) M_LOCAL_DISPLAY_CONTROL
+#define M_SKIP_OLDEST                                 (M_DISP_CONTROL_START+3L) //(10003) M_LOCAL_DISPLAY_CONTROL
+#define M_SKIP_NEWEST                                 (M_DISP_CONTROL_START+4L) //(10004) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SCHEME                              (M_DISP_CONTROL_START+5L) //(10005) M_LOCAL_DISPLAY_CONTROL
+#define M_OVERLAY_CLEAR                               (M_DISP_CONTROL_START+6L) //(10006) M_REMOTE_DISPLAY_CONTROL
+#define M_FORCE_MONO_OVR                              (M_DISP_CONTROL_START+7L) //(10007) M_REMOTE_DISPLAY_CONTROL
+#define M_D3D_VSYNC_INTERVAL_ONE                      (M_DISP_CONTROL_START+8L) //(10008) M_LOCAL_DISPLAY_CONTROL
+#define M_D3D_VSYNC_INTERVAL_TWO                      (M_DISP_CONTROL_START+9L) //(10009) M_LOCAL_DISPLAY_CONTROL
+#define M_D3D_VSYNC_INTERVAL_THREE                    (M_DISP_CONTROL_START+10L) //(10010) M_LOCAL_DISPLAY_CONTROL
+#define M_D3D_VSYNC_INTERVAL_FOUR                     (M_DISP_CONTROL_START+11L) //(10011) M_LOCAL_DISPLAY_CONTROL
+#define M_DIRECTX_VIDEO_DEVICE_ID                     (M_DISP_CONTROL_START+12L) //(10012) M_LOCAL_DISPLAY_CONTROL
+#define M_VGA_INDEX                                   M_DIRECTX_VIDEO_DEVICE_ID
+#define M_GDI_COMPATIBLE_OVERLAY                      (M_DISP_CONTROL_START+13L) //(10013) M_REMOTE_DISPLAY_CONTROL
+#define M_HSCROLL_VISIBLE                             (M_DISP_CONTROL_START+14L) //(10014) M_LOCAL_DISPLAY_CONTROL
+#define M_VSCROLL_VISIBLE                             (M_DISP_CONTROL_START+15L) //(10015) M_LOCAL_DISPLAY_CONTROL
+#define M_SRC_UPDATE_REGION_OFFSET_X                  (M_DISP_CONTROL_START+16L) //(10016) M_LOCAL_DISPLAY_CONTROL
+#define M_SRC_UPDATE_REGION_OFFSET_Y                  (M_DISP_CONTROL_START+17L) //(10017) M_LOCAL_DISPLAY_CONTROL
+#define M_NEAREST_COLOR                               (M_DISP_CONTROL_START+18L) //(10018) M_LOCAL_DISPLAY_CONTROL
+#define M_CENTER_DISPLAY                              (M_DISP_CONTROL_START+19L) //(10019) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_RESERVED_COLOR                          (M_DISP_CONTROL_START+20L) //(10020) M_LOCAL_DISPLAY_CONTROL
+#define M_LOWER_RESERVED_COLOR_START                  (M_DISP_CONTROL_START+21L) //(10021) M_LOCAL_DISPLAY_CONTROL
+#define M_LOWER_RESERVED_COLOR_END                    (M_DISP_CONTROL_START+22L) //(10022) M_LOCAL_DISPLAY_CONTROL
+#define M_HIGHER_RESERVED_COLOR_START                 (M_DISP_CONTROL_START+23L) //(10023) M_LOCAL_DISPLAY_CONTROL
+#define M_HIGHER_RESERVED_COLOR_END                   (M_DISP_CONTROL_START+24L) //(10024) M_LOCAL_DISPLAY_CONTROL
+#define M_PREFERED_DISPLAY_FORMAT                     (M_DISP_CONTROL_START+25L) //(10025) M_LOCAL_DISPLAY_CONTROL
+#define M_SAVE_INTERNAL_BUFFERS                       (M_DISP_CONTROL_START+26L) //(10026) M_LOCAL_DISPLAY_CONTROL
+#define M_HARDWARE_LUT_AVAILABLE                      (M_DISP_CONTROL_START+27L) //(10027) M_LOCAL_DISPLAY_CONTROL
+#define M_IS_IN_MEGA_BUFFER_MODE                      (M_DISP_CONTROL_START+28L) //(10028) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_THREAD_PRIORITY                      (M_DISP_CONTROL_START+29L) //(10029) M_LOCAL_DISPLAY_CONTROL
+#define M_VISIBLE_BUFFER_RECT_SIZE_X                  (M_DISP_CONTROL_START+30L) //(10030) M_LOCAL_DISPLAY_CONTROL
+#define M_VISIBLE_BUFFER_RECT_SIZE_Y                  (M_DISP_CONTROL_START+31L) //(10031) M_LOCAL_DISPLAY_CONTROL
+#define M_NO_TEARING_ACTIVE                           (M_DISP_CONTROL_START+32L) //(10032) M_LOCAL_DISPLAY_CONTROL
+#define M_FORCE_DISPLAY_RESOLUTION                    (M_DISP_CONTROL_START+33L) //(10033) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_INTERNAL_BUFFER_FOR_GRAB_CONTINUOUS     (M_DISP_CONTROL_START+34L) //(10034) M_REMOTE_DISPLAY_CONTROL
+#define M_NO_TEARING_MODE                             (M_DISP_CONTROL_START+35L) //(10035) M_REMOTE_DISPLAY_CONTROL
+#define M_UNDERLAY_UPDATE_STATE                       (M_DISP_CONTROL_START+36L) //(10036) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_PRIMARY_SURFACE                         (M_DISP_CONTROL_START+37L) //(10037) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_RATE_DIVIDER                         (M_DISP_CONTROL_START+38L) //(10038) M_REMOTE_DISPLAY_CONTROL
+#define M_STOP_UPDATE                                 (M_DISP_CONTROL_START+39L) //(10039) M_REMOTE_DISPLAY_CONTROL
+#define M_CAN_DO_HARDWARE_COMPOSITION                 (M_DISP_CONTROL_START+40L) //(10040) M_REMOTE_DISPLAY_CONTROL
+#define M_MIN_MAX_OF_SELECTED_BUFFER_CHANGED          (M_DISP_CONTROL_START+41L) //(10041) M_REMOTE_DISPLAY_CONTROL
+#define M_UPDATE_MEGA_BUFFER_CHILD_POSITION           (M_DISP_CONTROL_START+42L) //(10042) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_DX_VERSION_ON_TITLEBAR               (M_DISP_CONTROL_START+43L) //(10043) M_LOCAL_DISPLAY_CONTROL
+#define M_DEBUG_COLOR                                 (M_DISP_CONTROL_START+44L) //(10044) M_LOCAL_DISPLAY_CONTROL
+#define M_LOSING_VIDEO_MEMORY                         (M_DISP_CONTROL_START+45L) //(10045) M_LOCAL_DISPLAY_CONTROL
+#define M_VIDEO_MEMORY_RESTORED                       (M_DISP_CONTROL_START+46L) //(10046) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SYNC                                (M_DISP_CONTROL_START+47L) //(10047) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_USAGE                               (M_DISP_CONTROL_START+48L) //(10048) M_REMOTE_DISPLAY_CONTROL
+#define M_GENERATE_PENDING_HOOKS                      (M_DISP_CONTROL_START+49L) //(10049) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_GRAB_TYPE                            (M_DISP_CONTROL_START+50L) //(10050) M_REMOTE_DISPLAY_CONTROL
+#define M_GRAB_TYPE_ON_TITLE_BAR                      (M_DISP_CONTROL_START+51L) //(10051) M_LOCAL_DISPLAY_CONTROL
+#define M_VIDEO_DEVICE_WAS_MODIFIED                   (M_DISP_CONTROL_START+52L) //(10052) M_LOCAL_DISPLAY_CONTROL
+#define M_PAR_ENCODER_WAIT_FIELD                      (M_DISP_CONTROL_START+53L) //(10053) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_YCBCR_RANGE                             (M_DISP_CONTROL_START+54L) //(10054) M_REMOTE_DISPLAY_CONTROL
+#define M_RESTRICT_CURSOR                             (M_DISP_CONTROL_START+55L) //(10055) M_LOCAL_DISPLAY_CONTROL
+#define M_RESTRICT_FOCUS                              (M_DISP_CONTROL_START+56L) //(10056) M_LOCAL_DISPLAY_CONTROL
+#define M_SHOW_TASKBAR                                (M_DISP_CONTROL_START+57L) //(10057) M_LOCAL_DISPLAY_CONTROL
+#define M_EXCLUSIVE_MODE                              (M_DISP_CONTROL_START+58L) //(10058) M_LOCAL_DISPLAY_CONTROL
+#define M_PRE_DISPSELECT_OPERATIONS                   (M_DISP_CONTROL_START+59L) //(10059) M_LOCAL_DISPLAY_CONTROL
+#define M_POST_DISPSELECT_OPERATIONS                  (M_DISP_CONTROL_START+60L) //(10060) M_LOCAL_DISPLAY_CONTROL
+#define M_PRE_DISPDESELECT_OPERATIONS                 (M_DISP_CONTROL_START+61L) //(10061) M_LOCAL_DISPLAY_CONTROL
+#define M_POST_DISPDESELECT_OPERATIONS                (M_DISP_CONTROL_START+62L) //(10062) M_LOCAL_DISPLAY_CONTROL
+#define M_PROPAGATE_CALIBRATION_TO_OVERLAY            (M_DISP_CONTROL_START+63L) //(10063) M_REMOTE_DISPLAY_CONTROL
+#define M_SAVE_BASIC_SELECTED_BUFFER                  (M_DISP_CONTROL_START+64L) //(10064) M_LOCAL_DISPLAY_CONTROL
+#define M_ACQUIRE_WINDOW_FOCUS                        (M_DISP_CONTROL_START+65L) //(10065) M_LOCAL_DISPLAY_CONTROL
+#define M_BACKGROUND_COLOR                            (M_DISP_CONTROL_START+66L) //(10066) M_LOCAL_DISPLAY_CONTROL
+#define M_BASIC_DISPLAY_SYSTEM_ID                     (M_DISP_CONTROL_START+67L) //(10067) M_LOCAL_DISPLAY_CONTROL
+#define M_VGA_DEVICE_SYSTEM_ID                        (M_DISP_CONTROL_START+100L) //(10100) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_RESOLUTION                          (M_DISP_CONTROL_START+107L) //(10107) M_LOCAL_DISPLAY_CONTROL
+#define M_DEFAULT_DISPLAY_RESOLUTION                  (M_DISP_CONTROL_START+108L) //(10108) M_LOCAL_DISPLAY_CONTROL
+#define M_SAFE_MODE                                   (M_DISP_CONTROL_START+109L) //(10109) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_VIDEO_MEMORY_BUFFER                     (M_DISP_CONTROL_START+110L) //(10110) M_LOCAL_DISPLAY_CONTROL
+#define M_SELECT_USER_BUFFER_DIRECTLY_ON_DISPLAY      (M_DISP_CONTROL_START+111L) //(10111) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_FORMAT                              (M_DISP_CONTROL_START+112L) //(10112) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_FORMAT_SUPPORTED                    (M_DISP_CONTROL_START+113L) //(10113) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_TYPE                                (M_DISP_CONTROL_START+114L) //(10114) M_LOCAL_DISPLAY_CONTROL
+#define M_EXTENDED_DISPLAY_TYPE                       (M_DISP_CONTROL_START+115L) //(10115) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_UNDERLAY_IN_DUALHEAD                    (M_DISP_CONTROL_START+116L) //(10116) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SCHEME_ON_TITLEBAR                  (M_DISP_CONTROL_START+117L) //(10117) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_SYNCHRONIZATION                      (M_DISP_CONTROL_START+118L) //(10118) M_LOCAL_DISPLAY_CONTROL
+#define M_UNDERLAY_ALWAYS_ON_TOP                      (M_DISP_CONTROL_START+119L) //(10119) M_LOCAL_DISPLAY_CONTROL
+#define M_ALLOW_GRA_MESSAGE_WITH_NO_UPDATE            (M_DISP_CONTROL_START+120L) //(10120) M_LOCAL_DISPLAY_CONTROL
+#define M_USER_WINDOW_HANDLE                          (M_DISP_CONTROL_START+121L) //(10121) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_HOST_OVERLAY                            (M_DISP_CONTROL_START+122L) //(10122) M_REMOTE_DISPLAY_CONTROL
+#define M_SELECTED_LINK_COPY                          (M_DISP_CONTROL_START+123L) //(10123) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_ERROR                               (M_DISP_CONTROL_START+124L) //(10124) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_LIVE_UNDERLAY                           (M_DISP_CONTROL_START+125L) //(10125) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_WITH_PAINT_MESSAGE                   (M_DISP_CONTROL_START+126L) //(10126) M_LOCAL_DISPLAY_CONTROL
+
+#define M_DISPLAY_SCHEME_COUNT                        (M_DISP_CONTROL_START+131L) //(10131) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_DOUBLE_BUFFERING_SCHEME                 (M_DISP_CONTROL_START+132L) //(10132) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_STATE                                (M_DISP_CONTROL_START+133L) //(10133) M_LOCAL_DISPLAY_CONTROL
+#define M_FORCE_DISPLAY_SCHEME_CHANGE                 (M_DISP_CONTROL_START+134L) //(10134) M_LOCAL_DISPLAY_CONTROL
+#define M_UNDERLAY_SHOW                               (M_DISP_CONTROL_START+137L) //(10137) M_LOCAL_DISPLAY_CONTROL
+#define M_MINIMUM_DISPLAY_SIZE_X                      (M_DISP_CONTROL_START+138L) //(10138) M_LOCAL_DISPLAY_CONTROL
+#define M_MINIMUM_DISPLAY_SIZE_Y                      (M_DISP_CONTROL_START+139L) //(10139) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SHOW                                 (M_DISP_CONTROL_START+140L) //(10140) M_LOCAL_DISPLAY_CONTROL
+#define M_BUFFER_FORMAT_TO_SELECT_DIRECTLY            (M_DISP_CONTROL_START+141L) //(10141) M_LOCAL_DISPLAY_CONTROL
+
+#define M_USE_USER_BUFFER_FOR_UNDERLAY                (M_DISP_CONTROL_START+144L) //(10144) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_CREATE_OVER_USER_BUFFER                 (M_DISP_CONTROL_START+145L) //(10145) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_FLICKER_FREE_BUFFER                     (M_DISP_CONTROL_START+146L) //(10146) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_CONVERT_TO_COLOR_DIB                    (M_DISP_CONTROL_START+147L) //(10147) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_SOFTWARE_COMPOSITION                    (M_DISP_CONTROL_START+148L) //(10148) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_HOST_ENTRY_BUFFER                       (M_DISP_CONTROL_START+149L) //(10149) M_REMOTE_DISPLAY_CONTROL
+#define M_DISPLAY_SCHEME_BASE                         (M_DISP_CONTROL_START+150L) //(10150) M_REMOTE_DISPLAY_CONTROL
+
+#define M_QT_MODE                                     (M_DISP_CONTROL_START+151L) //(10151) M_LOCAL_DISPLAY_CONTROL
+#define M_GTK_MODE                                    (M_DISP_CONTROL_START+152L) //(10152) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_DISPLAY_SIZE_BUFFER                     (M_DISP_CONTROL_START+153L) //(10153) M_LOCAL_DISPLAY_CONTROL
+
+#define M_USE_MEGA_BUFFER                             (M_DISP_CONTROL_START+154L) //(10154) M_REMOTE_DISPLAY_CONTROL
+#define M_UPDATE_TRANSFER_TYPE                        (M_DISP_CONTROL_START+155L) //(10155) M_REMOTE_DISPLAY_CONTROL
+
+#define M_DEFAULT_MEGA_DISPLAY_SIZE_X                 (M_DISP_CONTROL_START+158L) //(10158) M_LOCAL_DISPLAY_CONTROL
+#define M_DEFAULT_MEGA_DISPLAY_SIZE_Y                 (M_DISP_CONTROL_START+159L) //(10159) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_INITIAL_SIZE_X                       (M_DISP_CONTROL_START+160L) //(10160) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_INITIAL_SIZE_Y                       (M_DISP_CONTROL_START+161L) //(10161) M_LOCAL_DISPLAY_CONTROL
+#define M_PREFER_COLOR_DISPLAY_RESOLUTION             (M_DISP_CONTROL_START+162L) //(10162) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_ON_OVERLAY_MODIFIED_INTERNAL         (M_DISP_CONTROL_START+164L) //(10164) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_GIGACOLOR_SCHEME                        (M_DISP_CONTROL_START+165L) //(10165) M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOMED_DESTINATION_OUT_DESKTOP              (M_DISP_CONTROL_START+168L) //(10168) M_LOCAL_DISPLAY_CONTROL
+#define M_VALIDATE_DISPLAY                            (M_DISP_CONTROL_START+169L) //(10169) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOKS                                       (M_DISP_CONTROL_START+170L) //(10170) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_OUT_OF_MONITOR                      (M_DISP_CONTROL_START+171L) //(10171) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_ZOOM_CHANGE                         (M_DISP_CONTROL_START+172L) //(10172) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_MB_CHILD_RESIZE                     (M_DISP_CONTROL_START+173L) //(10173) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLACE_WINDOWS                            (M_DISP_CONTROL_START+174L) //(10174) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_TITLE                                (M_DISP_CONTROL_START+175L) //(10175) M_LOCAL_DISPLAY_CONTROL
+#define M_RESET_WINDOW_SIZE                           (M_DISP_CONTROL_START+176L) //(10176) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURRENTLY_MAXIMIZED                  (M_DISP_CONTROL_START+177L) //(10177) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURRENTLY_MINIMIZED                  (M_DISP_CONTROL_START+178L) //(10178) M_LOCAL_DISPLAY_CONTROL
+#define M_MEGA_BUFFER_LOW_LIMIT                       (M_DISP_CONTROL_START+179L) //(10179) M_LOCAL_DISPLAY_CONTROL
+#define M_MAXIMUM_VISIBLE_DEST_SIZE_X                 (M_DISP_CONTROL_START+180L) //(10180) M_LOCAL_DISPLAY_CONTROL
+#define M_MAXIMUM_VISIBLE_DEST_SIZE_Y                 (M_DISP_CONTROL_START+181L) //(10181) M_LOCAL_DISPLAY_CONTROL
+#define M_DO_SELECT                                   (M_DISP_CONTROL_START+182L) //(10182) M_LOCAL_DISPLAY_CONTROL
+#define M_RESTRICT_WINDOWS                            (M_DISP_CONTROL_START+183L) //(10183) M_LOCAL_DISPLAY_CONTROL
+#define M_NUMBER_OF_BASIC_IMPLEMENTATIONS             (M_DISP_CONTROL_START+185L) //(10185) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURRENTLY_VISIBLE                    (M_DISP_CONTROL_START+187L) //(10187) M_LOCAL_DISPLAY_CONTROL
+#define M_VIRTUAL_GRAB                                (M_DISP_CONTROL_START+188L) //(10188) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_RESIZE_ON_ZOOM                       (M_DISP_CONTROL_START+189L) //(10189) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_NO_VIDEO_OVERLAY_BUFFER                 (M_DISP_CONTROL_START+191L) //(10191) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_YUV16_UYVY_SCHEME                       (M_DISP_CONTROL_START+192L) //(10192_
+#define M_FILL_COLOR                                  (M_DISP_CONTROL_START+193L) //(10193) M_LOCAL_DISPLAY_CONTROL
+#define M_CURRENTLY_CENTERED_X                        (M_DISP_CONTROL_START+194L) //(10194) M_LOCAL_DISPLAY_CONTROL
+#define M_XDISPLAY                                    (M_DISP_CONTROL_START+195L) //(10195)
+#define M_WINDOW_TASKBAR                              (M_DISP_CONTROL_START+196L) //(10196) M_LOCAL_DISPLAY_CONTROL
+#define M_SHOW_WINDOW_IN_TASKBAR                      M_WINDOW_TASKBAR
+#define M_WINDOW_TASKBAR_ON_FULLSCREEN                (M_DISP_CONTROL_START+197L) //(10197) M_LOCAL_DISPLAY_CONTROL
+#define M_CURRENTLY_CENTERED_Y                        (M_DISP_CONTROL_START+198L) //(10198) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURSOR                               (M_DISP_CONTROL_START+199L) //(10199) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ROI_BUTTONS                          (M_DISP_CONTROL_START+200L) //(10200) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_AUTO_RESET                              (M_DISP_CONTROL_START+201L) //(10201) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_TO_CLIPBOARD                           (M_DISP_CONTROL_START+202L) //(10202) M_LOCAL_DISPLAY_CONTROL
+#define M_SAVE_TO_FILE                                ((M_DISP_CONTROL_START+203L)|M_CLIENT_ENCODING)  // M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_DISPLAY_TO_ID                          (M_DISP_CONTROL_START+204L) //(10204) M_LOCAL_DISPLAY_CONTROL
+#define M_SAVE_TO_BUFFER                              M_COPY_DISPLAY_TO_ID
+#define M_COPY_TO_BUFFER                              M_COPY_DISPLAY_TO_ID
+#define M_UPDATE_RATE_MAX                             (M_DISP_CONTROL_START+205L) //(10205) M_REMOTE_DISPLAY_CONTROL
+#define M_ASYNC_UPDATE                                (M_DISP_CONTROL_START+206L) //(10206) M_REMOTE_DISPLAY_CONTROL
+#define M_MEGA_BUFFER_LOW_LIMIT_X                     (M_DISP_CONTROL_START+207L) //(10207) M_LOCAL_DISPLAY_CONTROL
+#define M_COMMON_DIRECTX_VIDEO_DEVICE_ID              (M_DISP_CONTROL_START+208L) //(10208) M_LOCAL_DISPLAY_CONTROL
+#define M_COMMON_VGA_INDEX                            M_COMMON_DIRECTX_VIDEO_DEVICE_ID
+#define M_FAST_SELECT                                 (M_DISP_CONTROL_START+209L) //(10209) M_REMOTE_DISPLAY_CONTROL
+#define M_FAST_UNDERLAY_MODE                          (M_DISP_CONTROL_START+210L) //(10210) M_LOCAL_DISPLAY_CONTROL
+#define M_CUSTOM_SCHEME_CHANGING                      (M_DISP_CONTROL_START+211L) //(10211) M_REMOTE_DISPLAY_CONTROL
+#define M_DISPLAY_FRAME_RATE_ON_TITLEBAR              (M_DISP_CONTROL_START+212L) //(10212) M_LOCAL_DISPLAY_CONTROL
+#define M_SCREEN_RECT                                 (M_DISP_CONTROL_START+213L) //(10213) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_ZOOM_FACTOR_ON_TITLEBAR             (M_DISP_CONTROL_START+214L) //(10214) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_BUFFER_LAYER_TO_CLIPBOARD              (M_DISP_CONTROL_START+215L) //(10215) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_BUFFER_LAYER_TO_ID                     (M_DISP_CONTROL_START+216L) //(10216) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_ANNOTATIONS_LAYER_TO_CLIPBOARD         (M_DISP_CONTROL_START+217L) //(10217) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_ANNOTATIONS_LAYER_TO_ID                (M_DISP_CONTROL_START+218L) //(10218) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_TO_BUFFER_WITH_SCALE                   (M_DISP_CONTROL_START+219L) //(10219) M_LOCAL_DISPLAY_CONTROL
+
+#define M_ROI_DISPCONTROL_START                       (M_DISP_CONTROL_START+500L) // 10500
+#define M_ROI_DEFINE                                  (M_DISP_CONTROL_START+500L) //(10500) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_SHOW                                    (M_DISP_CONTROL_START+501L) //(10501) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_SUPPORT                                 (M_DISP_CONTROL_START+502L) //(10502) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_LINE_COLOR                              (M_DISP_CONTROL_START+503L) //(10503) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_RESET                                   (M_DISP_CONTROL_START+504L) //(10504) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_RECT_DISPLAY                            (M_DISP_CONTROL_START+505L) //(10505) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_RECT_BUFFER                             (M_DISP_CONTROL_START+506L) //(10506) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_SET_POINT                               (M_DISP_CONTROL_START+507L) //(10507) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_LINE_WIDTH                              (M_DISP_CONTROL_START+508L) //(10508) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_HANDLE_COLOR                            (M_DISP_CONTROL_START+509L) //(10509) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_HANDLE_SIZE                             (M_DISP_CONTROL_START+510L) //(10510) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPLAY_OFFSET_X                        (M_DISP_CONTROL_START+511L) //(10511) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPLAY_OFFSET_Y                        (M_DISP_CONTROL_START+512L) //(10512) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPLAY_SIZE_X                          (M_DISP_CONTROL_START+513L) //(10513) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPLAY_SIZE_Y                          (M_DISP_CONTROL_START+514L) //(10514) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_BUFFER_OFFSET_X                         (M_DISP_CONTROL_START+515L) //(10515) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_BUFFER_OFFSET_Y                         (M_DISP_CONTROL_START+516L) //(10516) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_BUFFER_SIZE_X                           (M_DISP_CONTROL_START+517L) //(10517) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_BUFFER_SIZE_Y                           (M_DISP_CONTROL_START+518L) //(10518) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_SHAPE                                   (M_DISP_CONTROL_START+519L) //(10519) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_MINIMUM_SIZE                            (M_DISP_CONTROL_START+520L) //(10521) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPCONTROL_END                         (M_DISP_CONTROL_START+550L) // 10550
+#define M_IS_IN_ROI_DISPLAY_RANGE(X)                  ((M_ORIGINAL_DISPLAY_CONTROL(M_STRIP_INTERMOD_BITS(X))>=M_ROI_DISPCONTROL_START) && (M_ORIGINAL_DISPLAY_CONTROL(M_STRIP_INTERMOD_BITS(X))<=M_ROI_DISPCONTROL_END))
+#define M_CONTEXTUAL_MENU                             (M_DISP_CONTROL_START+551L) //(10551) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_IS_INTERNALLY_ALLOCATED             (M_DISP_CONTROL_START+553L) //(10553) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_DEVICE_LOSING                       (M_DISP_CONTROL_START+554L) //(10554) 
+#define M_WINDOW_ANNOTATIONS                          (M_DISP_CONTROL_START+556L) //(10556) M_LOCAL_DISPLAY_CONTROL  
+#define M_SCALE_DISPLAY                               (M_DISP_CONTROL_START+557L) //(10557) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ANNOTATIONS_STATE                    (M_DISP_CONTROL_START+558L) //(10558) M_LOCAL_DISPLAY_CONTROL
+#define M_NO_TEARING_ALLOWED                          (M_DISP_CONTROL_START+559L) //(10559) M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_ACCURACY                               (M_DISP_CONTROL_START+560L) //(10560) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_EXTERNAL_NO_TEARING                     (M_DISP_CONTROL_START+561L) //(10561) M_LOCAL_DISPLAY_CONTROL
+#define M_ASSOCIATED_GRAPHIC_LIST_ID                  (M_DISP_CONTROL_START+562L) //(10562) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_GRAPHIC_LIST                        M_ASSOCIATED_GRAPHIC_LIST_ID
+#define M_ZOOM_PAN_HANDLED_BY_SCHEME                  (M_DISP_CONTROL_START+563L) //(10563) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_GRAPHIC_LIST                         (M_DISP_CONTROL_START+564L) //(10564) M_LOCAL_DISPLAY_CONTROL
+#define M_MEGA_BUFFER_SIZE_X_TO_USE                   (M_DISP_CONTROL_START+565L) //(10565) M_LOCAL_DISPLAY_CONTROL
+#define M_MEGA_BUFFER_SIZE_Y_TO_USE                   (M_DISP_CONTROL_START+566L) //(10566) M_LOCAL_DISPLAY_CONTROL
+#define M_GRAPHIC_LIST_INTERACTIVE                    (M_DISP_CONTROL_START+567L) //(10567) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_GDI_TO_APPLY_LUT                        (M_DISP_CONTROL_START+568L) //(10568) M_LOCAL_DISPLAY_CONTROL //available for customers
+#define M_GRAPHIC_LIST_BOUNDING_RECT                  (M_DISP_CONTROL_START+570L) //(10570) M_LOCAL_DISPLAY_CONTROL
+#define M_DMIL_REALLOC_SURFACE                        (M_DISP_CONTROL_START+571L) //(10571) M_REMOTE_DISPLAY_CONTROL
+#define M_ASSOCIATED_REMOTE_DISPLAY_ID                (M_DISP_CONTROL_START+572L) //(10572) M_LOCAL_DISPLAY_CONTROL
+#define M_FILL_DISPLAY                                (M_DISP_CONTROL_START+574L) //(10574) M_LOCAL_DISPLAY_CONTROL
+#define M_GRAPHIC_LIST_LIMITED_TO_BUFFER_AREA         (M_DISP_CONTROL_START+575L) //(10575) M_LOCAL_DISPLAY_CONTROL
+#define M_GRAPHIC_LIST_RELATIVE_TO_ANCESTOR           (M_DISP_CONTROL_START+576L) //(10576) M_LOCAL_DISPLAY_CONTROL
+
+
+#define M_DISP_CONTROL_DIRECT_STOP                    11000L
+
+#define M_APP_BH_DISPLAY_START                        12000L
+#define M_DESCRIPTOR_LOCK                             (M_APP_BH_DISPLAY_START+00L)     // 12000
+#define M_APP_BH_DISPLAY_END                          12099L
+#define M_IS_IN_DISPLAY_APP_BH_RANGE(X)               ((M_STRIP_INTERMOD_BITS(X) >= M_APP_BH_DISPLAY_START) && (M_STRIP_INTERMOD_BITS(X) <= M_APP_BH_DISPLAY_END))
+
+
+#define M_SCALE                                       0x00008010L
+#define M_CUSTOM_DISPLAY                              M_IN_BUFFER_DISPLAY
+#define M_CUSTOM_DISPLAY_BUFFER                       M_DISPLAY_SURFACE
+#define M_RENDER_BUFFER_ID                            M_DISPLAY_SURFACE
+#define M_WPF_DISPLAY_BUFFER_ID                       M_DISPLAY_SURFACE
+
+/************************************************************************/
+/* MdispControl() / MdispInquire() Values                               */
+/************************************************************************/
+
+#define M_FULL_SIZE                      0L
+#define M_NORMAL_SIZE                    1L
+
+#define M_BENCHMARK_IN_DEBUG_ON          0x00000001L
+#define M_BENCHMARK_IN_DEBUG_OFF         0
+#define M_BENCHMARK_IN_DEBUG_TRACE       0x00000002L
+#define M_BENCHMARK_IN_DEBUG_NOTRACE     0
+#define M_BENCHMARK_IN_DEBUG_ALLSIZE     0x00000004L
+#define M_BENCHMARK_IN_DEBUG_CSTSIZE     0
+
+#define M_DISPLAY_SCAN_LINE_START        0x00000000L
+#define M_DISPLAY_SCAN_LINE_END                   -1
+
+#define M_SLAVE                          0L
+#define M_MASTER                         1L
+
+#define M_TRANSPARENT_COLOR              0x01000060L //M_LOCAL_DISPLAY_CONTROL
+#define M_TEST_UPDATE_IF_ASYNCHRONOUS    0x00000010L
+
+//For M_NO_TEARING dispControl
+#define M_ENABLE                                      -9997L
+#define M_FULL_UPDATE                                 -9998L
+#define M_DISABLE                                     -9999L
+#define M_DEFAULT                                     0x10000000L
+#define M_GRAB_CONTINUOUS_ONLY                        0x00100000L
+#define M_BASIC                                       0x00200000L
+#define M_ADVANCED                                    0x00400000L
+#define M_NO_SKIP                                     (M_DISP_CONTROL_START+2L) //(10002) M_LOCAL_DISPLAY_CONTROL
+#define M_SKIP_OLDEST                                 (M_DISP_CONTROL_START+3L) //(10003) M_LOCAL_DISPLAY_CONTROL
+#define M_SKIP_NEWEST                                 (M_DISP_CONTROL_START+4L) //(10004) 
+#define M_NO_TEARING_SKIP_MODE_MASK                   0x000FFFFFL //M_LOCAL_DISPLAY_CONTROL
+#define M_NO_TEARING_MODE_MASK                        0x00F00000L
+#define M_CURRENT_RESOLUTION                          MIL_TEXT("M_CURRENT_RESOLUTION")
+#define M_RESET_RESOLUTION                            MIL_TEXT("M_RESET_RESOLUTION")
+#define M_RESTORE_RESOLUTION                          MIL_TEXT("M_RESTORE_RESOLUTION")
+
+#define BIN_TO_MIL(b)                                 ( ((M_DEFAULT==b)||(M_ENABLE==b)||(M_DISABLE==b)||(M_FULL_UPDATE==b))?(b):(b?M_ENABLE:M_DISABLE) )
+
+#define M_ON_SELECT                      1L
+#define M_ON_DESELECT                    2L
+
+// For the control M_GRAB_BUFFERS
+#define M_DRIVER_ERROR_PENDING                        0x40000000L
+
+// For the M_STOP_UPDATE control/inquire
+#define M_WHEN_MINIMIZED                              0x00000001L
+#define M_WHEN_NOT_VISIBLE                            0x00000002L
+
+// For M_VIDEO_DEVICE_LOST control/inquire
+#define M_SIGNAL_OFF                                  0x00000000L
+#define M_CLEAR                                       0x00000001L
+#define M_NO_CLEAR                                    0x00000002L
+
+// For M_ROI_DEFINE control
+#define M_START                                       0x00000002L
+#define M_STOP                                        0x00000004L
+#define M_RESET                                       9L
+#define M_RECTANGULAR                                 0x00000010L
+
+
+// For M_VGA_INDEX inquire
+#define M_INVALID_VGA_INDEX                           M_INVALID
+
+// Used for DispMessage when comming from HTML Client
+#define M_HTML5_MESSAGE                               0x01000000L
+
+// For M_CAN_ALLOCATE_CONTIGUOUS_VIDEO_MEMORY inquire
+#define M_CONTIGUOUS                    0x00000001L
+#define M_START_IN_VIDEO_MEMORY         0x00000010L
+#define M_END_IN_VIDEO_MEMORY           0x00000020L
+#define M_START_IN_HOST_MEMORY          0x00000040L
+#define M_END_IN_HOST_MEMORY            0x00000080L
+#define M_NO_PHYSICAL_ADDRESS           0x00000100L
+#define M_IN_VIDEO_MEMORY(x)               ((x&M_START_IN_VIDEO_MEMORY) && (x&M_END_IN_VIDEO_MEMORY))
+#define M_IN_HOST_MEMORY(x)                ((x&M_START_IN_HOST_MEMORY) && (x&M_END_IN_HOST_MEMORY))
+#define M_CONTIGUOUS_AND_IN_VIDEO_MEMORY(x)((x&M_CONTIGUOUS) && M_IN_VIDEO_MEMORY(x))
+
+// For M_ZOOM_ACCURACY
+#define M_MEDIUM                                2L
+#define M_HIGH                                  3L
+
+
+// For M_INTERACTIVE_MODE
+//M_LEGACY
+#define M_MOUSE_DRIVEN                          0x00000002L
+
+// For M_UPDATE_RATE_MAX
+#define M_SCREEN_REFRESH_RATE                   0x01000000L
+#define M_MAX_REFRESH_RATE                      0x02000000L
+
+
+/************************************************************************/
+/* MdispLut()                                                           */
+#define M_PSEUDO                                       M_PSEUDO_LUT //(M_PSEUDO_ID+2)
+
+
+/************************************************************************/
+/* MdispHook()                                                          */
+/************************************************************************/
+#define M_ASYNC_HOOK                  0x08000000L
+
+/* Defines for hook to modification to bitmap and window */
+#define M_NOT_MODIFIED                0 /* No changed at all              */
+#define M_MODIFIED_LUT                1 /* Disp lut is changed            */
+#define M_MODIFIED_DIB                2 /* Disp buffer data is changed    */
+#define M_MODIFIED_ZOOM               3 /* Disp is zoomed                 */
+#define M_MODIFIED_PAN                4 /* Disp is panned                 */
+#define M_MODIFIED_DIB_CREATION       5 /* Disp receives a new buffer ID  */
+#define M_MODIFIED_DIB_DESTRUCTION    6 /* Disp receives a buffer ID 0    */
+#define M_MODIFIED_WINDOW_CREATION    7 /* Wnd is created                 */
+#define M_MODIFIED_WINDOW_DESTRUCTION 8 /* Wnd is destroyed               */
+#define M_MODIFIED_WINDOW_LOCATION    9 /* Wnd size is changed            */
+#define M_MODIFIED_WINDOW_OVERLAP    11 /* Wnd overlap is changed         */
+#define M_MODIFIED_WINDOW_ICONIZED   12 /* Wnd is changed to iconic state */
+#define M_MODIFIED_WINDOW_ZOOM       13 /* Wnd is zoomed                  */
+#define M_MODIFIED_WINDOW_PAN        14 /* Wnd is panned                  */
+#define M_MODIFIED_WINDOW_MENU       15 /* Wnd menu pulled-down           */
+#define M_MODIFIED_WINDOW_PAINT      16 /* Wnd is painted with image      */
+#define M_MODIFIED_WINDOW_ACTIVE     17 /* Wnd activation state changed   */
+#define M_MODIFIED_WINDOW_ENABLE     18 /* Wnd enable state changed       */
+#define M_MODIFIED_WINDOW_CLIP_LIST  19 /* Wnd clip list changed          */
+
+/* M_MODIFIED_WINDOW_MENU modification hook defines */
+#define M_MODIFIED_SYS_MENU            0x00100L
+#define M_MODIFIED_APP_MENU            0x00200L
+#define M_MODIFIED_USER_APP_MENU       0x10000L
+#define M_MODIFIED_RESTORE_MENUITEM    0x00001L
+#define M_MODIFIED_MOVE_MENUITEM       0x00002L
+#define M_MODIFIED_SIZE_MENUITEM       0x00003L
+#define M_MODIFIED_MINIMIZE_MENUITEM   0x00004L
+#define M_MODIFIED_MAXIMIZE_MENUITEM   0x00005L
+#define M_MODIFIED_CLOSE_MENUITEM      0x00006L
+#define M_MODIFIED_TASKLIST_MENUITEM   0x00007L
+#define M_MODIFIED_MENUBAR_MENUITEM    0x00008L
+#define M_MODIFIED_TITLEOFF_MENUITEM   0x00009L
+#define M_MODIFIED_ZOOMIN_MENUITEM     0x0000AL
+#define M_MODIFIED_ZOOMOUT_MENUITEM    0x0000BL
+#define M_MODIFIED_NOZOOM_MENUITEM     0x0000CL
+
+/* M_MODIFIED_WINDOW_ACTIVE modification hook defines */
+/* M_MODIFIED_WINDOW_ENABLE modification hook defines */
+#define M_MODIFIED_STATE_FROM_WINDOW   0
+#define M_MODIFIED_STATE_FROM_PARENT   0x00000010L
+#define M_MODIFIED_OFF                 0
+#define M_MODIFIED_ON                  0x00000001L
+
+/* M_MODIFIED_WINDOW_CLIP_LIST modification hook defines */
+/* M_MODIFIED_WINDOW_CLIP_LIST modification hook defines */
+#define M_MODIFIED_ACCESS_RECTANGULAR_OFF 0
+#define M_MODIFIED_ACCESS_RECTANGULAR_ON  0x00000001L
+#define M_MODIFIED_ACCESS_OFF             0
+#define M_MODIFIED_ACCESS_ON              0x00000002L
+#define M_MODIFIED_ACCESS_COMMAND_PROMPT  0x00000004L
+
+/* Type of event to hook for a display */
+#define M_HOOK_AFTER                0x10000000L          /* For hook after modification      */
+#define M_HOOK_BEFORE               0x20000000L          /* For hook before modification     */
+#define M_LOCAL_HOOK_RANGE1_START   M_HOOK_MODIFIED_DIB  /* Start of first range of local hooks */
+#define M_HOOK_MODIFIED_DIB         1L                                                 /* For buffer bitmap modification   */
+#define M_HOOK_MODIFIED_WINDOW      2L                                                 /* For disp window modification     */
+#define M_HOOK_MESSAGE_LOOP         4L                                                 /* For disp window modification     */
+#define M_LOCAL_HOOK_RANGE1_END     M_HOOK_MESSAGE_LOOP  /* End of first range of local hooks */
+#define M_FRAME_START               9L                   /* For disp frame start             */
+#define M_PRE_GRAB_BUFFER_CHANGE    10L                  /* For hook before the display scheme change when it imply the change of the grab buffers */
+#define M_POST_GRAB_BUFFER_CHANGE   11L                  /* For hook after the display scheme change when it imply the change of the grab buffers  */
+#define M_PRE_SCHEME_CHANGE         M_PRE_GRAB_BUFFER_CHANGE   /* Old Name */
+#define M_POST_SCHEME_CHANGE        M_POST_GRAB_BUFFER_CHANGE  /* Old Name */
+#define M_LOCAL_HOOK_RANGE2_START   (M_BASIC_DISPLAY_EVENT & ~M_ASYNC_HOOK)   /* Start of second range of local hooks */
+#define M_BASIC_DISPLAY_EVENT       (12L | M_ASYNC_HOOK)                               /* For hook when disp window is displayed in another VGA,or between, or unsupported zoom or more (new MIL8) */
+#define M_SURFACE_LOST              (14L | M_ASYNC_HOOK)                               /* For hook when DirectX surface is lost (new event for MIL8.0)     */
+#define M_LOCAL_HOOK_RANGE2_END     (M_SURFACE_LOST & ~M_ASYNC_HOOK) /* End of second range of local hooks */
+#define M_INVALIDATE_DISPLAY        (16L | M_ASYNC_HOOK) /* For hook when a full internal update is needed (new event for MIL8.0)     */
+#define M_LOCAL_HOOK_RANGE3_START   M_WINDOW_CLOSE_BEFORE   /* Start of third range of local hooks */
+#define M_WINDOW_CLOSE_BEFORE       17L
+#define M_WINDOW_CLOSE_AFTER        18L
+#define M_WINDOW_MINIMIZE_BEFORE    19L
+#define M_WINDOW_MINIMIZE_AFTER     20L
+#define M_WINDOW_MAXIMIZE_BEFORE    21L
+#define M_WINDOW_MAXIMIZE_AFTER     22L
+#define M_WINDOW_RESTORE_BEFORE     23L
+#define M_WINDOW_RESTORE_AFTER      24L
+#define M_WINDOW_POSCHANGE_BEFORE   25L
+#define M_WINDOW_POSCHANGE_AFTER    26L
+#define M_WINDOW_ZOOM_BEFORE        27L
+#define M_WINDOW_ZOOM_AFTER         28L
+#define M_WINDOW_SCROLL_BEFORE      29L
+#define M_WINDOW_SCROLL_AFTER       30L
+#define M_WINDOW_PAINT_BEFORE       31L
+#define M_WINDOW_PAINT_AFTER        32L
+#define M_WINDOW_ACTIVE_BEFORE      33L
+#define M_WINDOW_ACTIVE_AFTER       34L
+#define M_WINDOW_ENABLE_BEFORE      35L
+#define M_WINDOW_ENABLE_AFTER       36L
+#define M_WINDOW_SHOW_BEFORE        37L
+#define M_WINDOW_SHOW_AFTER         38L
+#define M_MODIFIED_DISPLAY          39L
+#define M_LOCAL_HOOK_RANGE3_END     M_MODIFIED_DISPLAY   /* End of third range of local hooks */
+#define M_DISPLAY_SCHEME_CHANGED    40L
+#define M_PRE_OVERLAY_ID_CHANGE     41L
+#define M_POST_OVERLAY_ID_CHANGE    42L
+#define M_LOCAL_HOOK_RANGE4_START   M_WINDOW_VISIBLE_CHANGE /* Start of fourth range of local hooks */
+#define M_WINDOW_VISIBLE_CHANGE     43L
+#define M_LOCAL_HOOK_RANGE4_END     M_WINDOW_VISIBLE_CHANGE /* End of fourth range of local hooks */
+#define M_PRIMARY_SURFACE_ID_CHANGED 44L
+#define M_LOCAL_HOOK_RANGE5_START   M_DEVICE_LOSING   /* Start of fifth range of local hooks */
+#define M_DEVICE_LOSING             45L
+#define M_DEVICE_LOST               46L
+#define M_DEVICE_RESTORING          47L
+#define M_DEVICE_RESTORED           48L
+#define M_ROI_CHANGE                49L
+#define M_ROI_CHANGE_END            50L
+#define M_ROI_HANDLE_RELEASE        51L
+#define M_VIDEO_DEVICE_MODIFIED_BEFORE 52L
+#define M_VIDEO_DEVICE_MODIFIED_AFTER  53L
+#define M_DEVICE_LEAVEVT            54L
+#define M_DEVICE_ENTERVT            55L
+#define M_MOUSE_LEFT_BUTTON_DOWN    56L
+#define M_MOUSE_RIGHT_BUTTON_DOWN   57L
+#define M_MOUSE_LEFT_BUTTON_UP      58L
+#define M_MOUSE_RIGHT_BUTTON_UP     59L
+#define M_ANNOTATIONS_DRAW          60L
+#define M_LOCAL_HOOK_RANGE5_END     M_ANNOTATIONS_DRAW   /* End of fifth of local hooks */
+#define M_WINDOW_ACTION             61L
+#define M_WINDOW_RESIZED            62L
+#define M_LOCAL_HOOK_RANGE6_START   M_MOUSE_MOVE /* Start of sixth range of local hooks */
+#define M_MOUSE_MOVE                64L
+#define M_MOUSE_WHEEL               65L
+#define M_MOUSE_MIDDLE_BUTTON_DOWN  66L
+#define M_MOUSE_MIDDLE_BUTTON_UP    67L
+#define M_KEY_DOWN                  68L
+#define M_KEY_UP                    69L
+#define M_DISP_MESSAGE_ANY          70L
+#define M_MOUSE_LEFT_DOUBLE_CLICK   71L
+#define M_KEY_CHAR                  72L
+#define M_SET_CURSOR                73L
+#define M_WINDOW_SIZING             74L
+#define M_CUSTOM_MESSAGE_SERVER     75L
+#define M_CUSTOM_MESSAGE_CLIENT     76L
+#define M_GRA_INTERACTIVE_ENABLED   77L
+#define M_GRA_INTERACTIVE_DISABLED  78L
+#define M_DISP_DESELECT_BEFORE      79L
+#define M_DISP_DESELECT_AFTER       80L
+#define M_DISP_SELECT_AFTER         81L
+#define M_DISP_PAN_BEFORE           82L
+#define M_DISP_PAN_AFTER            83L
+#define M_UPDATE_INTERACTIVE_STATE  84L
+#define M_MOUSE_LEAVE               85L
+#define M_DISP_SELECT_BEFORE        86L
+#define M_LOCAL_HOOK_RANGE6_END     M_SET_CURSOR   /* End of sixth of local hooks */
+
+#define M_IS_LOCAL_HOOK(HookType)   (((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE1_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE1_END)) ||   \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE2_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE2_END)) ||   \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE3_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE3_END)) ||   \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE4_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE4_END)) ||   \
+                                      ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE5_START) &&  \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE5_END)) ||   \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE6_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE6_END))))
+
+//Old names
+#define M_WINDOW_LBUTTONDOWN        M_MOUSE_LEFT_BUTTON_DOWN
+#define M_WINDOW_RBUTTONDOWN        M_MOUSE_RIGHT_BUTTON_DOWN
+#define M_WINDOW_LBUTTONUP          M_MOUSE_LEFT_BUTTON_UP
+#define M_WINDOW_RBUTTONUP          M_MOUSE_RIGHT_BUTTON_UP
+#define M_PRE_SCHEME_CHANGE         M_PRE_GRAB_BUFFER_CHANGE 
+#define M_POST_SCHEME_CHANGE        M_POST_GRAB_BUFFER_CHANGE
+
+#if OldDefinesSupport
+#define M_ROI_ANCHOR_COLOR    M_ROI_HANDLE_COLOR
+MIL_DEPRECATED(M_ROI_ANCHOR_COLOR, 1000)
+#define M_ROI_ANCHOR_SIZE     M_ROI_HANDLE_SIZE
+MIL_DEPRECATED(M_ROI_ANCHOR_SIZE, 1000)
+#define M_ROI_ANCHOR_RELEASE  M_ROI_HANDLE_RELEASE
+MIL_DEPRECATED(M_ROI_ANCHOR_RELEASE, 1000)
+#define M_WINDOW_ROI          M_WINDOW_ROI_BUTTONS
+MIL_DEPRECATED(M_WINDOW_ROI, 1000)
+#endif
+
+
+// Flag passed via the EventId of the hook
+#define M_INVALIDATE_OVERLAY     (0x00000001)
+#define M_INVALIDATE_UNDERLAY    (0x00000002)
+#define M_INVALIDATE_ALL_DISPLAY (M_INVALIDATE_OVERLAY|M_INVALIDATE_UNDERLAY)
+
+/************************************************************************/
+/* MdispGetHookInfo() Info types                                        */
+/************************************************************************/
+#define M_DISPLAY                0x00200000L
+#define M_MOUSE_POSITION_X       1L
+#define M_MOUSE_POSITION_Y       2L
+#define M_ANNOTATIONS_DC         3L
+#define M_ANNOTATIONS_PIXMAP     M_ANNOTATIONS_DC // Pixmap for Linux 
+#define M_MOUSE_POSITION_BUFFER_X  4L
+#define M_MOUSE_POSITION_BUFFER_Y  5L
+#define M_USER_FLAG                6L
+#define M_COMBINATION_KEYS         7L
+#define M_EVENT_VALUE              8L
+#define M_MIL_KEY_VALUE            9L // OS-independent Key Code
+
+// documented aliases for M_EVENT_VALUE
+#define M_MOUSE_WHEEL_VALUE   M_EVENT_VALUE
+#define M_KEY_VALUE           M_EVENT_VALUE  // OS-dependent Key Code
+
+// aliases for some infos, for easier documentation of M_CUSTOM_MESSAGE_CLIENT/SERVER
+#define M_EVENT_VALUE_1          M_MOUSE_POSITION_X
+#define M_EVENT_VALUE_2          M_MOUSE_POSITION_Y
+#define M_EVENT_VALUE_3          M_EVENT_VALUE
+#define M_EVENT_VALUE_4          M_COMBINATION_KEYS
+
+/************************************************************************/
+/* MdispMessage flags                                                   */
+/************************************************************************/
+
+#define M_KEY_SHIFT              0x00010000
+#define M_KEY_CTRL               0x00020000
+#define M_KEY_ALT                0x00040000
+#define M_MOUSE_LEFT_BUTTON      0x00080000
+#define M_MOUSE_MIDDLE_BUTTON    0x00100000
+#define M_MOUSE_RIGHT_BUTTON     0x00200000
+#define M_KEY_WIN                0x00400000
+
+#if M_MIL_USE_WINDOWS
+
+#define M_COMBINATION_KEYS_FROM_KEY_STATE()  (((GetKeyState(VK_SHIFT)&0x8000)    ?  M_KEY_SHIFT : M_NULL)   | \
+                                              ((GetKeyState(VK_CONTROL)&0x8000)  ?  M_KEY_CTRL  : M_NULL)   | \
+                                              ((GetKeyState(VK_MENU)&0x8000)     ?  M_KEY_ALT   : M_NULL)   | \
+                                              ((GetKeyState(VK_LWIN) & 0x8000)   ?  M_KEY_WIN   : M_NULL)   | \
+                                              ((GetKeyState(VK_RWIN) & 0x8000)   ?  M_KEY_WIN   : M_NULL))
+
+#define M_COMBINATION_KEYS_FROM_WPARAM(X) ( M_COMBINATION_KEYS_FROM_KEY_STATE() | \
+                                           ((X&MK_LBUTTON) ? M_MOUSE_LEFT_BUTTON : M_NULL) | \
+                                           ((X&MK_MBUTTON) ? M_MOUSE_MIDDLE_BUTTON : M_NULL) | \
+                                           ((X&MK_RBUTTON) ? M_MOUSE_RIGHT_BUTTON : M_NULL))
+
+#else
+#define M_COMBINATION_KEYS_FROM_STATE(X)(((X&ShiftMask)    ?  M_KEY_SHIFT           : M_NULL)   | \
+                                         ((X&ControlMask)  ?  M_KEY_CTRL            : M_NULL)   | \
+                                         ((X&Mod1Mask)     ?  M_KEY_ALT             : M_NULL)   | \
+                                         ((X&Mod4Mask)     ?  M_KEY_WIN             : M_NULL)   | \
+                                         ((X&Button1Mask)  ?  M_MOUSE_LEFT_BUTTON   : M_NULL)   | \
+                                         ((X&Button2Mask)  ?  M_MOUSE_MIDDLE_BUTTON : M_NULL)   | \
+                                         ((X&Button3Mask)  ?  M_MOUSE_RIGHT_BUTTON  : M_NULL))
+
+#define M_COMBINATION_KEYS_FROM_BUTTON(X) (((X==Button1) ? M_MOUSE_LEFT_BUTTON : M_NULL) | \
+                                           ((X==Button2) ? M_MOUSE_MIDDLE_BUTTON : M_NULL) | \
+                                           ((X==Button3) ? M_MOUSE_RIGHT_BUTTON : M_NULL))
+
+#endif
+
+// OS-Independent Key Codes (mapped to the windows virtual key codes)
+#define M_KEY_BACK               0x08 // VK_BACK      (Backspace key)
+#define M_KEY_TAB                0x09 // VK_TAB       (Tab key)
+
+#define M_KEY_CLEAR              0x0C // VK_CLEAR     (Clear key)
+#define M_KEY_RETURN             0x0D // VK_RETURN    (Enter key)
+
+#define M_KEY_PAUSE              0x13 // VK_PAUSE     (Pause key)
+#define M_KEY_CAPS_LOCK          0x14 // VK_CAPITAL   (Caps lock key)
+
+#define M_KEY_ESC                0x1B // VK_ESCAPE    (Esc key)
+
+#define M_KEY_SPACE              0x20 // VK_SPACE     (Spacebar)
+#define M_KEY_PAGEUP             0x21 // VK_PRIOR     (Page Up key)
+#define M_KEY_PAGEDOWN           0x22 // VK_NEXT      (Page Down key)
+#define M_KEY_END                0x23 // VK_END       (End key)
+#define M_KEY_HOME               0x24 // VK_HOME      (Home key)
+#define M_KEY_ARROW_LEFT         0x25 // VK_LEFT      (Left Arrow key)
+#define M_KEY_ARROW_UP           0x26 // VK_UP        (Up Arrow key)
+#define M_KEY_ARROW_RIGHT        0x27 // VK_RIGHT     (Right Arrow key)
+#define M_KEY_ARROW_DOWN         0x28 // VK_DOWN      (Down Arrow key)
+
+#define M_KEY_SELECT             0x29 // VK_SELECT    (Select key)
+#define M_KEY_PRINT              0x2A // VK_PRINT     (Print key)
+#define M_KEY_EXECUTE            0x2B // VK_EXECUTE   (Execute key)
+#define M_KEY_INSERT             0x2D // VK_INSERT    (Ins key)
+#define M_KEY_DELETE             0x2E // VK_DELETE    (Del key)
+#define M_KEY_HELP               0x2F // VK_HELP      (Help key)
+
+#define M_KEY_0                  0x30 // 0 key
+#define M_KEY_1                  0x31 // 1 key
+#define M_KEY_2                  0x32 // 2 key
+#define M_KEY_3                  0x33 // 3 key
+#define M_KEY_4                  0x34 // 4 key
+#define M_KEY_5                  0x35 // 5 key
+#define M_KEY_6                  0x36 // 6 key
+#define M_KEY_7                  0x37 // 7 key
+#define M_KEY_8                  0x38 // 8 key
+#define M_KEY_9                  0x39 // 9 key
+#define M_KEY_A                  0x41 // A key
+#define M_KEY_B                  0x42 // B key
+#define M_KEY_C                  0x43 // C key
+#define M_KEY_D                  0x44 // D key
+#define M_KEY_E                  0x45 // E key
+#define M_KEY_F                  0x46 // F key
+#define M_KEY_G                  0x47 // G key
+#define M_KEY_H                  0x48 // H key
+#define M_KEY_I                  0x49 // I key
+#define M_KEY_J                  0x4A // J key
+#define M_KEY_K                  0x4B // K key
+#define M_KEY_L                  0x4C // L key
+#define M_KEY_M                  0x4D // M key
+#define M_KEY_N                  0x4E // N key
+#define M_KEY_O                  0x4F // O key
+#define M_KEY_P                  0x50 // P key
+#define M_KEY_Q                  0x51 // Q key
+#define M_KEY_R                  0x52 // R key
+#define M_KEY_S                  0x53 // S key
+#define M_KEY_T                  0x54 // T key
+#define M_KEY_U                  0x55 // U key
+#define M_KEY_V                  0x56 // V key
+#define M_KEY_W                  0x57 // W key
+#define M_KEY_X                  0x58 // X key
+#define M_KEY_Y                  0x59 // Y key
+#define M_KEY_Z                  0x5A // Z key
+
+#define M_KEY_NUMPAD0            0x60 // VK_NUMPAD0   (Numeric keypad 0 key)
+#define M_KEY_NUMPAD1            0x61 // VK_NUMPAD1   (Numeric keypad 1 key)
+#define M_KEY_NUMPAD2            0x62 // VK_NUMPAD2   (Numeric keypad 2 key)
+#define M_KEY_NUMPAD3            0x63 // VK_NUMPAD3   (Numeric keypad 3 key)
+#define M_KEY_NUMPAD4            0x64 // VK_NUMPAD4   (Numeric keypad 4 key)
+#define M_KEY_NUMPAD5            0x65 // VK_NUMPAD5   (Numeric keypad 5 key)
+#define M_KEY_NUMPAD6            0x66 // VK_NUMPAD6   (Numeric keypad 6 key)
+#define M_KEY_NUMPAD7            0x67 // VK_NUMPAD7   (Numeric keypad 7 key)
+#define M_KEY_NUMPAD8            0x68 // VK_NUMPAD8   (Numeric keypad 8 key)
+#define M_KEY_NUMPAD9            0x69 // VK_NUMPAD9   (Numeric keypad 9 key)
+#define M_KEY_MULTIPLY           0x6A // VK_MULTIPLY  (Multiply key)
+#define M_KEY_ADD                0x6B // VK_ADD       (Add key)
+#define M_KEY_SEPARATOR          0x6C // VK_SEPARATOR (Separator key)
+#define M_KEY_SUBTRACT           0x6D // VK_SUBTRACT  (Subtract key)
+#define M_KEY_DECIMAL            0x6E // VK_DECIMAL   (Decimal key)
+#define M_KEY_DIVIDE             0x6F // VK_DIVIDE    (Divide key)
+#define M_KEY_F1                 0x70 // VK_F1        (F1 key)
+#define M_KEY_F2                 0x71 // VK_F2        (F2 key)
+#define M_KEY_F3                 0x72 // VK_F3        (F3 key)
+#define M_KEY_F4                 0x73 // VK_F4        (F4 key)
+#define M_KEY_F5                 0x74 // VK_F5        (F5 key)
+#define M_KEY_F6                 0x75 // VK_F6        (F6 key)
+#define M_KEY_F7                 0x76 // VK_F7        (F7 key)
+#define M_KEY_F8                 0x77 // VK_F8        (F8 key)
+#define M_KEY_F9                 0x78 // VK_F9        (F9 key)
+#define M_KEY_F10                0x79 // VK_F10       (F10 key)
+#define M_KEY_F11                0x7A // VK_F11       (F11 key)
+#define M_KEY_F12                0x7B // VK_F12       (F12 key)
+#define M_KEY_F13                0x7C // VK_F13       (F13 key)
+#define M_KEY_F14                0x7D // VK_F14       (F14 key)
+#define M_KEY_F15                0x7E // VK_F15       (F15 key)
+#define M_KEY_F16                0x7F // VK_F16       (F16 key)
+#define M_KEY_F17                0x80 // VK_F17       (F17 key)
+#define M_KEY_F18                0x81 // VK_F18       (F18 key)
+#define M_KEY_F19                0x82 // VK_F19       (F19 key)
+#define M_KEY_F20                0x83 // VK_F20       (F20 key)
+#define M_KEY_F21                0x84 // VK_F21       (F21 key)
+#define M_KEY_F22                0x85 // VK_F22       (F22 key)
+#define M_KEY_F23                0x86 // VK_F23       (F23 key)
+#define M_KEY_F24                0x87 // VK_F24       (F24 key)
+
+#define M_KEY_NUM_LOCK           0x90   // VK_NUMLOCK (Num Lock key)
+#define M_KEY_SCROLL_LOCK        0x91   // VK_SCROLL (Scroll Lock key)
+
+#define M_KEY_OEM_PLUS           0xBB  // VK_OEM_PLUS '+' any country	//  (For any country / region, the '+' key)
+#define M_KEY_OEM_COMMA          0xBC  // VK_OEM_COMMA ',' any country	//  (For any country / region, the ',' key)
+#define M_KEY_OEM_MINUS          0xBD  // VK_OEM_MINUS '-' any country	//  (For any country / region, the '-' key)
+#define M_KEY_OEM_PERIOD         0xBE  // VK_OEM_PERIOD '.' any country	//  (For any country / region, the '.' key)
+
+// Deprecated names, kept for code backward compatibility
+#if OldDefinesSupport
+#define M_KEY_SUBSTRACT    M_KEY_SUBTRACT
+MIL_DEPRECATED(M_KEY_SUBSTRACT, 1030)
+#endif
+
+
+#if M_MIL_USE_WINDOWS
+#define M_WHEEL_DELTA            WHEEL_DELTA
+#define M_MOUSE_WHEEL_DELTA_FROM_WPARAM(X)  (GET_WHEEL_DELTA_WPARAM(X)/M_WHEEL_DELTA)
+#else
+#define M_WHEEL_DELTA            120 
+#define M_MOUSE_WHEEL_DELTA_FROM_WPARAM(X)   ((X<0)?-1:1)
+#endif
+
+
+/************************************************************************/
+/* MdispOverlayKey()                                                    */
+/************************************************************************/
+#define M_KEY_ON_COLOR                                1L
+#define M_KEY_OFF                                     2L
+#define M_KEY_ALWAYS                                  3L
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* FUNCTION PROTOTYPES */
+
+      /* -------------------------------------------------------------- */
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+   {
+#endif
+
+typedef MIL_HOOK_FUNCTION_PTR MDISPHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_DISP_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void MFTYPE    MdispHookFunction    (MIL_ID DisplayId,
+                                     MIL_INT HookType,
+                                     MIL_DISP_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                     void *UserDataPtr);
+
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC MIL_ID MFTYPE  MdispAllocA          (MIL_ID SystemId,
+                                     MIL_INT DispNum,
+                                     MIL_CONST_TEXTA_PTR DispFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID *DisplayIdPtr);
+MIL_DLLFUNC MIL_ID MFTYPE  MdispAllocW          (MIL_ID SystemId,
+                                     MIL_INT DispNum,
+                                     MIL_CONST_TEXTW_PTR DispFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID *DisplayIdPtr);
+#if M_MIL_UNICODE_API
+#define MdispAlloc MdispAllocW
+#else
+#define MdispAlloc MdispAllocA
+#endif
+#else
+
+MIL_DLLFUNC MIL_ID MFTYPE  MdispAlloc           (MIL_ID SystemId,
+                                     MIL_INT DispNum,
+                                     MIL_CONST_TEXT_PTR DispFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID *DisplayIdPtr);
+
+#endif
+
+
+MIL_DLLFUNC void MFTYPE    MdispFree            (MIL_ID DisplayId);
+
+MIL_DLLFUNC void MFTYPE    MdispSelect          (MIL_ID DisplayId,
+                                     MIL_ID ImageBufId);
+
+#define MdispDeselect(DisplayId, ImageId) MdispSelect(DisplayId, M_NULL)
+
+MIL_DLLFUNC MIL_INT MFTYPE MdispInquire         (MIL_ID DisplayId,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MdispPan             (MIL_ID DisplayId,
+                                     MIL_DOUBLE XOffset,
+                                     MIL_DOUBLE YOffset);
+MIL_DLLFUNC void MFTYPE    MdispZoom            (MIL_ID DisplayId,
+                                     MIL_DOUBLE XFactor,
+                                     MIL_DOUBLE YFactor);
+
+MIL_DLLFUNC void MFTYPE    MdispLut             (MIL_ID DisplayId,
+                                     MIL_ID LutBufId);
+
+MIL_DLLFUNC void MFTYPE    MdispMessage(         MIL_ID  DisplayId, 
+                                     MIL_INT EventType, 
+                                     MIL_INT MousePositionX, 
+                                     MIL_INT MousePositionY, 
+                                     MIL_INT EventValue, 
+                                     MIL_INT CombinationKeys,
+                                     MIL_INT UserValue);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MdispControlInt64        (MIL_ID DisplayId,
+                                         MIL_INT64 ControlType,
+                                         MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MdispControlDouble       (MIL_ID DisplayId,
+                                         MIL_INT64 ControlType,
+                                         MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MdispControlDouble MdispControl
+#define MdispControlInt64  MdispControl
+MIL_DLLFUNC void MFTYPE       MdispControl         (MIL_ID DisplayId,
+                                        MIL_INT64 ControlType,
+                                        MIL_DOUBLE ControlValue);
+#endif
+
+
+MIL_DLLFUNC void MFTYPE    MdispUpdate         (MIL_ID DisplayId,
+                                    MIL_INT OffsetX,
+                                    MIL_INT OffsetY,
+                                    MIL_INT SizeX,
+                                    MIL_INT SizeY,
+                                    MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MdispGetHookInfo    (MIL_ID EventId,
+                                       MIL_INT64 InfoType,
+                                       void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MdispSelectWindow    (MIL_ID DisplayId,
+                                     MIL_ID ImageBufId,
+                                     MIL_WINDOW_HANDLE ClientWindowHandle);
+
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+#if M_MIL_USE_64BIT
+
+//////////////////////////////////////////////////////////////
+// MdispControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         int ControlValue)
+   {
+   MdispControlInt64(DisplayId, ControlType, ControlValue);
+   };
+#endif
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         MIL_INT32 ControlValue)
+   {
+   MdispControlInt64(DisplayId, ControlType, ControlValue);
+   }
+
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         MIL_INT64 ControlValue)
+   {
+   MdispControlInt64(DisplayId, ControlType, ControlValue);
+   }
+
+inline void MdispControl(MIL_ID DisplayId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue)
+   {
+   MdispControlDouble(DisplayId, ControlType, ControlValue);
+   }
+
+inline void MdispControl(MIL_ID DisplayId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+#else // M_MIL_USE_64BIT
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         int ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, (double)ControlValue);
+   };
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         MIL_INT32 ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, (double)ControlValue);
+   };
+
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         MIL_INT64 ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, (double)ControlValue);
+   };
+
+inline void MdispControl(MIL_ID DisplayId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   };
+#endif // M_MIL_USE_64BIT
+#else // __cplusplus
+
+#define MdispControl MdispControlInt64
+#endif // __cplusplus
+
+//////////////////////////////////////////////////////////////
+// SafeType functions.
+//////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////
+// See milos.h for explanation about these functions.
+//////////////////////////////////////////////////////////////
+
+// M_MIL_USE_SAFE_TYPE defined in milos.h.
+#if M_MIL_USE_SAFE_TYPE
+
+// ----------------------------------------------------------
+// MdispInquire
+
+inline MIL_INT MFTYPE MdispInquireUnsafe  (MIL_ID DisplayId, MIL_INT64 InquireType, void*                 ResultPtr);
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, int                   ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_TEXT_CHAR*        ResultPtr);
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_INT*              ResultPtr);
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_DOUBLE*           ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_UINT*             ResultPtr);
+#endif
+#if   M_MIL_USE_WINDOWS
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_WINDOW_HANDLE*    ResultPtr);
+#endif
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_INT64*            ResultPtr);
+#endif
+
+inline MIL_INT64 MdispInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_DISP_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_DISP_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_DOUBLE;
+
+   if (M_IN_DISP_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_DISP_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr || M_DISP_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MdispInquire"));
+
+   return MdispInquire(DisplayId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_DISP_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MdispInquire"));
+
+   return MdispInquire(DisplayId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MdispInquireExecute (MIL_ID DisplayId, MIL_INT64 InquireType, void* ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MdispInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdispInquire"));
+
+   return MdispInquire(DisplayId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MdispInquireUnsafe  (MIL_ID DisplayId, MIL_INT64 InquireType, void*          UserVarPtr) {return MdispInquire       (DisplayId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_TEXT_CHAR* UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_INT*       UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_DOUBLE*    UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_UINT*      UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_INT64*     UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#if   M_MIL_USE_WINDOWS
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_WINDOW_HANDLE* ResultPtr)
+   {
+   if (InquireType != M_WINDOW_HANDLE)
+      SafeTypeError(MIL_TEXT("MdispInquire"));
+
+   return MdispInquire(DisplayId, InquireType, ResultPtr);
+   }
+#endif
+// ----------------------------------------------------------
+// MdispGetHookInfo
+
+inline MIL_INT MFTYPE MdispGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int             *UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *UserVarPtr);
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DC_HANDLE   *UserVarPtr);
+
+//safe type checking 
+inline MIL_INT64 MdispGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   //check if InfoType requires a double
+   if ((M_MOUSE_POSITION_BUFFER_X == InfoType) || (M_MOUSE_POSITION_BUFFER_Y == InfoType))
+      {
+      return M_TYPE_MIL_DOUBLE;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MdispGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MdispGetHookInfoRequiredType(InfoType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdispGetHookInfo"));
+
+   return MdispGetHookInfo(EventId, InfoType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdispGetHookInfo"));
+
+   return MdispGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MdispGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MdispGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *UserVarPtr) {return MdispGetHookInfo               (EventId, InfoType, UserVarPtr)                  ;}
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *UserVarPtr) {return MdispGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *UserVarPtr) {return MdispGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_DOUBLE   );}
+
+#if !M_MIL_USE_LINUX
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DC_HANDLE   *UserVarPtr)
+      {
+      if (InfoType != M_ANNOTATIONS_DC)
+         SafeTypeError(MIL_TEXT("MdispHookFunction"));
+
+      return MdispGetHookInfo(EventId, InfoType, UserVarPtr);
+      }
+#endif
+
+#define MdispInquire         MdispInquireSafeType
+#define MdispGetHookInfo     MdispGetHookInfoSafeType
+
+#else // #if M_MIL_USE_SAFE_TYPE
+
+#define MdispGetHookInfoUnsafe     MdispGetHookInfo
+#define MdispInquireUnsafe         MdispInquire
+
+#endif
+#if M_MIL_USE_STRING
+///***************************************************************************/
+///* DISP MODULE                                                             */
+///***************************************************************************/
+inline void MdispControl(MIL_ID DisplayId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+   if(M_IN_DISP_INQUIRE_STRING_RANGE(ControlType))
+      {
+      MdispControl(DisplayId, ControlType, ControlValue.c_str());
+      }
+   else
+      {
+#if M_MIL_USE_SAFE_TYPE
+      SafeTypeError(MIL_TEXT("MdispControl: ControlType does not support string argument."));
+#endif
+      }
+   }
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+inline MIL_ID MFTYPE  MdispAllocW(MIL_ID SystemId, MIL_INT DispNum, const MIL_STRING& DispFormat, MIL_INT64 InitFlag, MIL_ID *DisplayIdPtr)
+   {
+   return MdispAllocW(SystemId, DispNum, DispFormat.c_str(), InitFlag, DisplayIdPtr);
+   }
+#else
+inline MIL_ID MFTYPE  MdispAllocA(MIL_ID SystemId, MIL_INT DispNum, const MIL_STRING& DispFormat, MIL_INT64 InitFlag, MIL_ID *DisplayIdPtr)
+   {
+   return MdispAllocA(SystemId, DispNum, DispFormat.c_str(), InitFlag, DisplayIdPtr);
+   }
+#endif /* M_MIL_USE_UNICODE */
+#else
+inline MIL_ID MFTYPE  MdispAlloc(MIL_ID SystemId, MIL_INT DispNum, const MIL_STRING& DispFormat, MIL_INT64 InitFlag, MIL_ID *DisplayIdPtr)
+   {
+   return MdispAlloc(SystemId, DispNum, DispFormat.c_str(), InitFlag, DisplayIdPtr);
+   }
+#endif /* M_MIL_UNICODE_API */
+
+#if !M_MIL_USE_SAFE_TYPE
+inline MIL_INT MFTYPE MdispInquire(MIL_ID DispId, MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   MdispInquire(DispId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdispInquire(DispId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#else
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DispId, MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   MdispInquire(DispId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdispInquire(DispId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif /* M_MIL_UNICODE */
+#endif /* M_MIL_USE_STRING*/
+
+////////////////////////////////////////////////////////////////////////////////
+// MIL_UNIQUE_ID support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+#if M_MIL_USE_SAFE_TYPE
+template <> inline bool MilIsCorrectObjectType<&MdispFree>(MIL_INT64 ObjectType)
+   {
+   return M_IS_DISPLAY_TYPE(ObjectType);
+   }
+#endif
+
+typedef MIL_UNIQUE_ID<&MdispFree> MIL_UNIQUE_DISP_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+
+inline MIL_UNIQUE_DISP_ID MdispAlloc(MIL_ID SystemId, MIL_INT DispNum, MIL_CONST_TEXT_PTR DispFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_DISP_ID(MdispAlloc(SystemId, DispNum, DispFormat, InitFlag, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_DISP_ID MdispAlloc(MIL_ID SystemId, MIL_INT DispNum, const MIL_STRING& DispFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_DISP_ID(MdispAlloc(SystemId, DispNum, DispFormat, InitFlag, M_NULL));
+   }
+#endif // M_MIL_USE_STRING
+template <MilFreeFuncType FreeFunc> inline void MdispFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+
+// End of MIL_UNIQUE_ID support
+////////////////////////////////////////////////////////////////////////////////
+
+#endif //__MIL_DISPLAY_H__
diff --git a/Common_Class/Matrox/Include/MILDyn/milim.h b/Common_Class/Matrox/Include/MILDyn/milim.h
new file mode 100644
index 0000000..95fe13b
--- /dev/null
+++ b/Common_Class/Matrox/Include/MILDyn/milim.h
@@ -0,0 +1,3389 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MILIM.H
+// Revision          :  10.40.0640
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+#ifndef __MILIM_H__
+#define __MILIM_H__
+
+/************************************************************************/
+/* MimAlloc()                                                           */
+/************************************************************************/
+#define M_DEINTERLACE_CONTEXT                         1L
+
+#define M_FLAT_FIELD_CONTEXT                          3L
+#define M_DEAD_PIXEL_CONTEXT                          4L
+#define M_REARRANGE_CONTEXT                           5L
+#define M_STAT_MULTIPLE_CONTEXT                       6L
+#define M_MATCH_CONTEXT                               7L
+#define M_PROJECT_SHAPE_CONTEXT                       8L
+#define M_WAVELET_TRANSFORM_CONTEXT                   9L
+#define M_WAVELET_TRANSFORM_CUSTOM_CONTEXT            10L
+#define M_FIND_ORIENTATION_CONTEXT                    11L
+#define M_LOCATE_PEAK_1D_CONTEXT                      12L
+#define M_HISTOGRAM_EQUALIZE_ADAPTIVE_CONTEXT         13L
+#define M_BINARIZE_ADAPTIVE_CONTEXT                   14L
+#define M_BINARIZE_ADAPTIVE_FROM_SEED_CONTEXT         15L
+#define M_STATISTICS_CONTEXT                          16L
+#define M_STATISTICS_CUMULATIVE_CONTEXT               17L
+#define M_AUGMENTATION_CONTEXT                        18L
+#define M_LINEAR_FILTER_IIR_CONTEXT                   19L
+
+
+/************************************************************************/
+/* MimGetResult()                                                       */
+/************************************************************************/
+#define M_VALUE                                       0L
+#define M_POSITION_X                                  0x00003400L
+#define M_POSITION_Y                                  0x00004400L
+#define M_NB_EVENT                                    5L
+#define M_NUMBER                                      1009L    // Already defined elsewhere
+#define M_TOTAL_NUMBER                                1010L    // Already defined elsewhere
+#define M_NUMBER_OF_LEVELS                            1797L
+#define M_WAVELET_TYPE                                1802L    // Already defined elsewhere
+#define M_TRANSFORMATION_MODE                         1824L    // Already defined elsewhere
+#define M_WAVELET_SIZE                                1856L
+#define M_WAVELET_DRAW_SIZE_X_WITH_PADDING            1857L
+#define M_WAVELET_DRAW_SIZE_Y_WITH_PADDING            1858L
+#define M_REAL_PART                                   0x1000L
+#define M_IMAGINARY_PART                              0x2000L
+#define M_TRANSFORMATION_DOMAIN                       1864L
+#define M_ORIGINAL_IMAGE_SIZE_X                       1869L
+#define M_ORIGINAL_IMAGE_SIZE_Y                       1870L
+#define M_WAVELET_DRAW_SIZE_X                         1871L
+#define M_WAVELET_DRAW_SIZE_Y                         1872L
+#define M_ALLOCATED_TYPE                              2183L
+
+/************************************************************************/
+/* MimGetResult/MimHistogram()                                          */
+/************************************************************************/
+#define M_CUMULATIVE_VALUE                            1L
+#define M_PERCENTAGE                                  2L    // to be used as a complement to M_VALUE and M_CUMULATIVE_VALUE
+#define M_PERCENTILE_VALUE                            0x10L // can also be used as a complement to M_GREATER/... with MimBinarize
+#define M_PERCENTILE_VALUE_RESULT_SIZE                101L  // 0 to 100%
+#define M_HIST_REAL_SIZE                              102L  // Real size of histogram obtain from automatic bin size.
+#define M_HIST_VALUE_OFFSET                           103L  // Source value of the first bin.
+#define M_HIST_VALUE_RANGE                            104L  // Source value range.
+
+/************************************************************************/
+/* MimGetResult/MimAugment()                                          */
+/************************************************************************/
+#define M_AUG_ROTATION_ANGLE                              3265L
+#define M_AUG_TRANSLATION_X                               3266L
+#define M_AUG_TRANSLATION_Y                               3267L
+#define M_AUG_SCALE_FACTOR                                3268L
+#define M_AUG_ASPECT_RATIO                                3269L
+#define M_AUG_ASPECT_RATIO_MODE                           3373L
+#define M_AUG_FLIP_DIRECTION                              3374L
+#define M_AUG_SHEAR_X                                     3270L
+#define M_AUG_SHEAR_Y                                     3271L
+#define M_AUG_DILATION_NB_ITERATIONS                      3272L
+#define M_AUG_EROSION_NB_ITERATIONS                       3273L
+#define M_AUG_DILATION_ASYM_NB_ITERATIONS                 3274L
+#define M_AUG_DILATION_ASYM_SUBAREA                       3275L
+#define M_AUG_EROSION_ASYM_NB_ITERATIONS                  3276L
+#define M_AUG_EROSION_ASYM_SUBAREA                        3277L
+#define M_AUG_LIGHTING_DIRECTIONAL_ANGLE                  3278L
+#define M_AUG_SATURATION_GAIN                             3279L
+#define M_AUG_HSV_VALUE_GAIN                              3280L
+#define M_AUG_HUE_OFFSET                                  3281L
+#define M_AUG_SMOOTH_DERICHE_VALUE                        3282L
+#define M_AUG_BLUR_MOTION_SIZE                            3283L
+#define M_AUG_BLUR_MOTION_ANGLE                           3284L
+#define M_AUG_SHARPEN_DERICHE_VALUE                       3285L
+#define M_AUG_SMOOTH_GAUSSIAN_STDDEV                      3286L
+#define M_AUG_CROP_TOP_LEFT_X                             3287L
+#define M_AUG_CROP_TOP_LEFT_Y                             3288L
+#define M_AUG_CROP_BOTTOM_RIGHT_X                         3289L
+#define M_AUG_CROP_BOTTOM_RIGHT_Y                         3290L
+#define M_AUG_NOISE_SALT_PEPPER_DENSITY                   3375L
+#define M_AUG_NOISE_MULTIPLICATIVE_STDDEV                 3376L
+#define M_AUG_NOISE_GAUSSIAN_ADDITIVE_STDDEV              3377L
+#define M_AUG_INTENSITY_MULTIPLY_VALUE                    3365L
+#define M_AUG_INTENSITY_ADD_VALUE                         3366L
+#define M_AUG_GAMMA_VALUE_BAND_0                          3367L
+#define M_AUG_GAMMA_VALUE_BAND_1                          3369L
+#define M_AUG_GAMMA_VALUE_BAND_2                          3371L
+
+#define M_AUG_SEED_USED                                   3423L 
+
+
+/* Result vectors */
+#define M_AUG_OPERATIONS_ENABLED                          3291L
+#define M_AUG_OPERATIONS_APPLIED                          3292L
+#define M_AUG_OPERATION_RESULT_TYPES                      3293L
+#define M_AUG_OPERATION_RESULT_VALUES                     3294L
+#define M_AUG_OPERATION_ASSOCIATED_WITH_RESULT_TYPES      3295L
+#define M_AUG_REVERSE_TRANSFORMATION_MATRIX               3399L 
+
+
+
+/************************************************************************/
+/* MimGetResultSingle()                                                 */
+/************************************************************************/
+#define M_WAVELET_COEFFICIENTS_IMAGE_ID               1850L
+#define M_WAVELET_LEVEL_SIZE_X                        1798L
+#define M_WAVELET_LEVEL_SIZE_Y                        1799L
+#define M_WAVELET_LEVEL_PADDING_OFFSET_X              1866L
+#define M_WAVELET_LEVEL_PADDING_OFFSET_Y              1867L
+#define M_PREDEFINED                                  1967L
+#define M_COMPLEX                                     1968L
+
+#define M_HORIZONTAL_LEVEL_TAG                        0x01000000L
+#define M_HORIZONTAL_LEVEL(a)                         (M_HORIZONTAL_LEVEL_TAG + (a))
+#define M_VERTICAL_LEVEL_TAG                          0x02000000L
+#define M_VERTICAL_LEVEL(a)                           (M_VERTICAL_LEVEL_TAG + (a))
+#define M_DIAGONAL_LEVEL_TAG                          0x04000000L
+#define M_DIAGONAL_LEVEL(a)                           (M_DIAGONAL_LEVEL_TAG + (a))
+#define M_APPROXIMATION                               0x08000000L
+
+/************************************************************************/
+/* MimGetResult2d()/MimStatMultiple                                     */
+/************************************************************************/
+#define M_MAX                                         0x04000000L    //Already defined elsewhere
+#define M_MAX_ABS                                     0x00800000L    //Already defined elsewhere
+#define M_MEAN                                        0x08000000L    //Already defined elsewhere
+#define M_MIN                                         0x02000000L    //Already defined elsewhere
+#define M_MIN_ABS                                     0x00200000L    //Already defined elsewhere
+#define M_STANDARD_DEVIATION                          0x10000000L    //Already defined elsewhere
+#define M_SUM                                         0x00004000L    //Already defined elsewhere
+#define M_SUM_ABS                                     0x00000008L    //Already defined elsewhere
+#define M_SUM_OF_SQUARES                              0x00000400L    //Already defined elsewhere
+
+/************************************************************************/
+/* MimControl()/MimInquire()                                            */
+/************************************************************************/
+#define M_IN_IM_CONTROL_MIL_ID_RANGE(X)               ((X) == M_DARK_IMAGE || \
+                                                       (X) == M_OFFSET_IMAGE || \
+                                                       (X) == M_FLAT_IMAGE || \
+                                                       (X) == M_DEAD_PIXELS || \
+                                                       (X) == M_MODEL_IMAGE || \
+                                                       (X) == M_MASK_IMAGE)
+
+
+// To avoid eventual clashes with M_TYPE_XXX, we must use the mask before checking the value itself.
+#define M_MASK_MIM_INQUIRE_TYPE                       0x0001FFFF
+#define M_RESULT_SIZE                                 0L
+#define M_RESULT_TYPE                                 1L
+#define M_DEINTERLACE_TYPE                            2L
+#define M_DISCARD_FIELD                               3L
+#define M_FIRST_FIELD                                 4L
+#define M_MOTION_DETECT_NUM_FRAMES                    5L
+#define M_MOTION_DETECT_THRESHOLD                     6L
+#define M_MOTION_DETECT_REFERENCE_FRAME               7L
+#define M_MOTION_DETECT_OUTPUT                        8L
+#define M_SOURCE_FIRST_IMAGE                          9L
+#define M_SOURCE_START_IMAGE                          M_SOURCE_FIRST_IMAGE
+#if OldDefinesSupport
+#define M_EXTENDED_CONTEXT_TYPE                       10L
+MIL_DEPRECATED(M_EXTENDED_CONTEXT_TYPE, 1010)
+#endif
+#define M_EXTENDED_CONTEXT_TYPE_DEPRECATED            10L
+#define M_EXTENDED_RESULT_TYPE                        11L
+#define M_INTERNAL_CONTEXT_TYPE                       2906L
+#define M_ASSOCIATED_CONTEXT_TYPE                     2968L
+
+// Inquire and control types for M_FLAT_FIELD_CONTEXT.
+#define M_DARK_IMAGE                                  200L
+#define M_OFFSET_IMAGE                                201L
+#define M_FLAT_IMAGE                                  202L
+
+#define M_DARK_CONST                                  203L
+#define M_OFFSET_CONST                                204L
+#define M_FLAT_CONST                                  205L
+#define M_GAIN_CONST                                  206L
+
+#define M_DARK_IMAGE_NB_BANDS                         207L
+#define M_DARK_IMAGE_WIDTH                            208L
+#define M_DARK_IMAGE_HEIGHT                           209L
+#define M_DARK_IMAGE_TYPE                             210L
+
+#define M_OFFSET_IMAGE_NB_BANDS                       212L
+#define M_OFFSET_IMAGE_WIDTH                          213L
+#define M_OFFSET_IMAGE_HEIGHT                         214L
+#define M_OFFSET_IMAGE_TYPE                           215L
+
+#define M_FLAT_IMAGE_NB_BANDS                         217L
+#define M_FLAT_IMAGE_WIDTH                            218L
+#define M_FLAT_IMAGE_HEIGHT                           219L
+#define M_FLAT_IMAGE_TYPE                             220L
+
+#define M_EFFECTIVE_GAIN_CONST                        221L
+
+#define M_INVALID_CONST                               0x40000000L
+
+// Inquire and control types for M_REARRANGE_CONTEXT.
+#define M_X_SOURCE                                    300L
+#define M_Y_SOURCE                                    301L
+#define M_XY_SOURCE                                   302L
+#define M_X_DESTINATION                               303L
+#define M_Y_DESTINATION                               304L
+#define M_XY_DESTINATION                              305L
+#define M_X_SIZE                                      306L
+#define M_Y_SIZE                                      307L
+#define M_XY_SIZE                                     308L
+
+#define M_X_SOURCE_ARRAY_SIZE                         309L
+#define M_Y_SOURCE_ARRAY_SIZE                         310L
+#define M_XY_SOURCE_ARRAY_SIZE                        311L
+#define M_X_DESTINATION_ARRAY_SIZE                    312L
+#define M_Y_DESTINATION_ARRAY_SIZE                    313L
+#define M_XY_DESTINATION_ARRAY_SIZE                   314L
+#define M_X_SIZE_ARRAY_SIZE                           315L
+#define M_Y_SIZE_ARRAY_SIZE                           316L
+#define M_XY_SIZE_ARRAY_SIZE                          317L
+
+// Inquire and control types for M_DEAD_PIXEL_CONTEXT.
+#define M_DEAD_PIXELS                                 80L
+#define M_X_DEAD_PIXELS                               81L
+#define M_Y_DEAD_PIXELS                               82L
+#define M_XY_DEAD_PIXELS                              83L
+
+#define M_X_DEAD_PIXELS_ARRAY_SIZE                    84L
+#define M_Y_DEAD_PIXELS_ARRAY_SIZE                    85L
+#define M_XY_DEAD_PIXELS_ARRAY_SIZE                   86L
+#define M_DEAD_PIXELS_IMAGE_NB_BANDS                  87L      //Inquire only
+#define M_DEAD_PIXELS_IMAGE_WIDTH                     88L      //Inquire only
+#define M_DEAD_PIXELS_IMAGE_HEIGHT                    89L      //Inquire only
+#define M_DEAD_PIXELS_IMAGE_TYPE                      91L      //Inquire only
+#define M_DEAD_PIXELS_IMAGE_ATTRIBUTE                 92L      //Inquire only
+
+
+// Inquire and control types for M_STAT_MULTIPLE_CONTEXT.
+#define M_TYPE                                        1008L    //Already defined elsewhere
+#define M_SIZE_X                                      1536L    //Already defined elsewhere
+#define M_SIZE_Y                                      1537L    //Already defined elsewhere
+#define M_2D                                          90L
+//See MimStat for M_TYPE possible values.
+
+// Inquire and control types for M_MATCH_CONTEXT.
+#define M_MODEL_IMAGE                                 1019L
+#define M_MASK_IMAGE                                  1020L       //Already defined in milreg.h
+#define M_MAX_SCORE                                   100L
+#define M_SCORE_TYPE                                  37L         //Already defined elsewhere
+#define M_MODEL_STEP                                  33L         //Already defined elsewhere
+#define M_MODE                                        103L        //Already defined elsewhere
+#define M_CORRELATE_NORMALIZED                        1L          //Mode value.
+#define M_CORRELATE                                   2L          //Mode value.
+#define M_ABS_SUM_OF_DIFFERENCES                      3L          //Mode value.
+#define M_MAX_DEPTH                                   MIL_MAKE_CONST(0xFFFFFFFF, 0x00000000FFFFFFFF)  //M_MAX_SCORE value.
+#define M_NORM                                        4000L       //Already defined elsewhere, ScoreType value.
+#define M_SQR_NORM                                    4001L       //Already defined elsewhere, ScoreType value.
+#define M_NORM_CLIP                                   4002L       //ScoreType value.
+#define M_NORM_CLIP_SQR                               4003L       //ScoreType value.
+
+#define M_MODEL_IMAGE_NB_BANDS                        105L        //Inquire only
+#define M_MODEL_IMAGE_WIDTH                           106L        //Inquire only
+#define M_MODEL_IMAGE_HEIGHT                          107L        //Inquire only
+#define M_MODEL_IMAGE_TYPE                            108L        //Inquire only
+#define M_MODEL_IMAGE_ATTRIBUTE                       109L        //Inquire only
+
+#define M_MASK_IMAGE_NB_BANDS                         110L        //Inquire only
+#define M_MASK_IMAGE_WIDTH                            111L        //Inquire only
+#define M_MASK_IMAGE_HEIGHT                           112L        //Inquire only
+#define M_MASK_IMAGE_TYPE                             113L        //Inquire only
+#define M_MASK_IMAGE_ATTRIBUTE                        114L        //Inquire only
+
+
+// Inquire and control types for M_WAVELET_TRANSFORM_CONTEXT.
+#define M_WAVELET_TYPE                                1802L
+#define M_CUSTOM                                      2           //WaveletType value
+#define M_DAUBECHIES_1                                3L          //WaveletType value
+#define M_DAUBECHIES_2                                4L          //WaveletType value
+#define M_DAUBECHIES_3                                5L          //WaveletType value
+#define M_DAUBECHIES_4                                6L          //WaveletType value
+#define M_DAUBECHIES_5                                7L          //WaveletType value
+#define M_DAUBECHIES_6                                8L          //WaveletType value
+#define M_DAUBECHIES_7                                9L          //WaveletType value
+#define M_DAUBECHIES_8                                10L         //WaveletType value
+#define M_DAUBECHIES_3_COMPLEX                        11L         //WaveletType value
+#define M_DAUBECHIES_5_COMPLEX                        12L         //WaveletType value
+#define M_DAUBECHIES_7_COMPLEX                        13L         //WaveletType value
+#define M_SYMLET_1                                    14L         //WaveletType value
+#define M_SYMLET_2                                    15L         //WaveletType value
+#define M_SYMLET_3                                    16L         //WaveletType value
+#define M_SYMLET_4                                    17L         //WaveletType value
+#define M_SYMLET_5                                    18L         //WaveletType value
+#define M_SYMLET_6                                    19L         //WaveletType value
+#define M_SYMLET_7                                    20L         //WaveletType value
+#define M_SYMLET_8                                    21L         //WaveletType value
+#define M_HAAR                                        1L          //WaveletType value
+#define M_TRANSFORMATION_MODE                         1824L
+#define M_DYADIC                                      1825L       //DecompositionMode value
+#define M_UNDECIMATED                                 1826L       //DecompositionMode value
+#define M_FILTER_FORWARD_LOW_PASS_ID                  1820L       // MimWaveletSetFilter
+#define M_FILTER_REVERSE_LOW_PASS_ID                  1821L       // MimWaveletSetFilter
+#define M_FILTER_FORWARD_HIGH_PASS_ID                 1822L       // MimWaveletSetFilter
+#define M_FILTER_REVERSE_HIGH_PASS_ID                 1823L       // MimWaveletSetFilter
+#define M_WAVELET_VALIDITY                            1827L       // MimInquire
+#define M_WAVELET_CONTEXT_TYPE                        1828L       // MimInquire
+#define M_REAL_PART                                   0x1000L     // MimInquire
+#define M_IMAGINARY_PART                              0x2000L     // MimInquire
+
+// Inquire and control types for M_FIND_ORIENTATION_CONTEXT.
+#define M_INTERPOLATION_MODE                          3018L       //Defined in mildisplay.h
+#define M_FREQUENCY_CUTOFF_RATIO_LOW                  1830L        //Low frequency cut off
+#define M_FREQUENCY_CUTOFF_RATIO_HIGH                 1831L        //High frequency cut off
+#define M_CLIP_CENTER                                 106L        //Mode value
+#define M_RESIZE_DOWN                                 107L        //Mode value
+#define M_RESIZE_UP                                   108L        //Mode value
+#define M_CENTERED_WINDOW                             (M_PSEUDO_ID | 0x40)
+#define M_SCORE                                       0x00001400L  //Defined in milgab.h
+#define M_BORDER_ATTENUATION                          109L
+
+// Inquire and control types for M_HISTOGRAM_EQUALIZE_ADAPTIVE_CONTEXT.
+#define M_NUMBER_OF_TILES_X                           250L        // Number of tiles in X
+#define M_NUMBER_OF_TILES_Y                           251L        // Number of tiles in Y
+#define M_CLIP_LIMIT                                  252L        // Mormalized clip limit.
+#define M_HIST_SIZE                                   253L        // Number of histogram bins.
+#define M_ACCORDING_TO_SOURCE                         -1L         // Number of bin determine from source range.
+#define M_OPERATION                                   M_METHOD    // Already defined elsewhere. Histogram equalization distrition.
+#define M_UNIFORM                                     1           // Already defined elsewhere
+#define M_EXPONENTIAL                                 2           // Already defined elsewhere
+#define M_RAYLEIGH                                    3           // Already defined elsewhere
+#define M_HYPER_CUBE_ROOT                             4           // Already defined elsewhere
+#define M_HYPER_LOG                                   5           // Already defined elsewhere
+#define M_ALPHA_VALUE                                 5278L       // Already defined elsewhere
+
+
+// Inquire and control types for M_LOCATE_PEAK_1D_CONTEXT.
+#define M_SCAN_LANE_DIRECTION                         1
+#define M_PEAK_VALUE_MODE                             2
+#define M_PEAK_INTENSITY_MODE                         3
+#define M_NUMBER_OF_PEAKS                             4
+#define M_SORT_CRITERION                              5
+#define M_PEAK_WIDTH_NOMINAL                          6
+#define M_PEAK_WIDTH_DELTA                            7
+#define M_FRAME_SIZE                                  8
+#define M_FULL_SIZE                                   0L          // Already defined in mildisplay.h
+#define M_SELECT_PEAK(a,b)  ((MIL_INT64)((MIL_UINT64)(a) << 32 | (MIL_UINT64)(b)))
+
+//Common to many objects.
+#define M_MODE                                        103L
+
+// Already defined in another header file.
+#define M_LINES                                       0x00000080L
+
+#define M_RECTS                                       0x00000100L
+
+#define M_AVERAGE                                     0x00000020L
+#define M_DISCARD                                     0x00000021L
+#define M_BOB                                         0x00000022L
+#define M_ADAPTIVE_AVERAGE                            0x00000023L
+#define M_ADAPTIVE_DISCARD                            0x00000024L
+#define M_ADAPTIVE_BOB                                0x00000025L
+#define M_ADAPTATIVE_AVERAGE                          M_ADAPTIVE_AVERAGE
+#define M_ADAPTATIVE_DISCARD                          M_ADAPTIVE_DISCARD
+#define M_ADAPTATIVE_BOB                              M_ADAPTIVE_BOB
+#define M_ODD_FIELD                                   1L
+#define M_EVEN_FIELD                                  2L
+#define M_FIRST_FRAME                                 0x40000001L
+#define M_CENTER_FRAME                                0x40000002L
+#define M_LAST_FRAME                                  0x40000003L
+#define M_RESULT_OUTPUT_UNITS 	                     1300L
+#define M_NUMBER_OF_FRAMES                            1080L
+
+// Control values for M_RESULT_OUTPUT_UNITS
+#define M_PIXEL                              0x1000L
+#define M_WORLD                              0x2000L
+#define M_ACCORDING_TO_CALIBRATION             1301L
+
+// Control for M_HIST_LIST
+#define  M_HIST_BIN_SIZE_MODE                            400L        // ControlType to specify binning mode.
+#define  M_REGULAR                                       0x00020000L // Define elsewhere. Default mode used before, with no binning and
+// just ignore values that don't fit in the size of the result.
+#define  M_FIT_SRC_RANGE                                 0x01        // Use the size as the number of bin and a simple algo for indexing.
+#define  M_FIT_SRC_DATA                                  0x02        // Use the size as the number of bin and a simple algo for indexing.
+#define  M_FREEDMAN                                      0x03        // MIL automaticly determine optimal bin size/number of bin using Freedman algorithm.
+#define  M_HIST_SMOOTHING_ITERATIONS                     401L        // Number of smoothing pass to do as post processing.
+
+// Inquire and control types for M_LINEAR_FILTER_IIR_CONTEXT.
+#define M_FILTER_TYPE                           1046L                               // Already defined in miledge.h, milmeas.h
+#define M_SHEN                                  0x802L                              // FilterType value.
+#define M_DERICHE                               M_ID_OFFSET_OF_DEFAULT_KERNEL + 10L // FilterType value. Already defined in miledge.h
+#define M_VLIET                                 0x803L                              // FilterType value.
+
+#define M_SMOOTHNESS                            108L                                // Already defined in    milmod.h, milmeas.h
+#define M_FILTER_SMOOTHNESS                     M_SMOOTHNESS                        // Already defined in    milmeas.h
+
+#define M_FILTER_SMOOTHNESS_TYPE                2842L
+#define M_NORMALIZED                            0x00000002L                         // Smoothness type value.
+#define M_NATIVE                                0x00000003L                         // Smoothness type value.
+
+#define M_FILTER_RESPONSE_TYPE                  2843L
+#define M_SLOPE                                 2844L                               // Response type value.
+#define M_STEP                                  2845L                               // Response type value.
+
+#define M_FILTER_ASPECT_RATIO                   2846L
+
+#define M_FILTER_DEFAULT_SHARPEN_PARAM          4056L
+
+
+/************************************************************************/
+/* MimFindExtreme()                                                     */
+/************************************************************************/
+#define M_MIN_VALUE                                   MAKE_INT64(0x0000010000000000)
+#define M_MAX_VALUE                                   MAKE_INT64(0x0000020000000000)
+#define M_MIN_ABS_VALUE                               4L
+#define M_MAX_ABS_VALUE                               8L
+
+/************************************************************************/
+/* MimStat()                                                            */
+/************************************************************************/
+#define M_MIN_ABS                                     0x00200000L    //Already defined elsewhere
+#define M_MAX_ABS                                     0x00800000L    //Already defined elsewhere
+#define M_SUM_ABS                                     0x00000008L    //Already defined elsewhere
+#define M_SUM_OF_SQUARES                              0x00000400L    //Already defined elsewhere
+#define M_SUM                                         0x00004000L    //Already defined in milocr.h
+#define M_MEAN                                        0x08000000L    //Already defined in milmeas.h
+#define M_STANDARD_DEVIATION                          0x10000000L    //Already defined in milmeas.h
+#define M_NUMBER                                      1009L          // Already defined elsewhere 0x000003F1
+#define M_ANGULAR_DATA_MEAN                           0x00000004L
+#define M_ANGULAR_DATA_COHERENCE                      0x00000800L
+#define M_ORIENTATION_DATA_MEAN                       0x00001000L
+#define M_ORIENTATION_DATA_COHERENCE                  0x00002000L
+
+/************************************************************************/
+/* MimStatCalculate()                                                            */
+/************************************************************************/
+#define M_STAT_TYPE                                   2149
+#define M_GLCM_STAT_TYPE                              2150
+#define M_GLCM_PAIR_OFFSET_X                          2151
+#define M_GLCM_PAIR_OFFSET_Y                          2152
+#define M_STEP_SIZE_X                                 2153
+#define M_STEP_SIZE_Y                                 2160
+#define M_GLCM_QUANTIFICATION                         2161
+#define M_STAT_GLCM_DISSIMILARITY                     2162
+#define M_STAT_GLCM_ENERGY                            2163
+#define M_STAT_GLCM_ENTROPY                           2164
+#define M_STAT_GLCM_HOMOGENEITY                       2165
+#define M_CONDITION                                   2167
+#define M_COND_LOW                                    2168
+#define M_COND_HIGH                                   2172
+#define M_STAT_GLCM_CORRELATION                       2173
+#define M_STAT_GLCM_CONTRAST                          2174
+
+/* These defines preserve the values of their non-prefixed counterpart where possible. */
+#define M_STAT_MIN                                         2502
+#define M_STAT_MAX                                         2503
+#define M_STAT_MIN_ABS                                     2504
+#define M_STAT_MAX_ABS                                     2505
+#define M_STAT_SUM_ABS                                     2506
+#define M_STAT_SUM_OF_SQUARES                              2507
+#define M_STAT_SUM                                         2508
+#define M_STAT_MEAN                                        2509
+#define M_STAT_STANDARD_DEVIATION                          2510
+#define M_STAT_NUMBER                                      1009L       // Same as M_NUMBER
+#define M_STAT_ANGULAR_DATA_MEAN                           2511
+#define M_STAT_ANGULAR_DATA_COHERENCE                      2512
+#define M_STAT_ORIENTATION_DATA_MEAN                       2513
+#define M_STAT_ORIENTATION_DATA_COHERENCE                  2514
+
+/************************************************************************/
+/* MimArith()                                                           */
+/************************************************************************/
+#define M_CONSTANT                                    0x8000L
+#define M_FIXED_POINT                                 0x00004000L
+#define M_FLOAT_PROC                                  0x40000000L
+#define M_LOGICAL                                     0x08000000L
+#define M_SOURCE_VALUE                                0x00010000L
+#define M_ADD                                         0x0000L
+#define M_ADD_CONST                                   (M_ADD | M_CONSTANT)
+#define M_SUB                                         0x0001L
+#define M_SUB_CONST                                   (M_SUB | M_CONSTANT)
+#define M_NEG_SUB                                     0x000AL
+#define M_CONST_SUB                                   (M_NEG_SUB | M_CONSTANT)
+#define M_SUB_ABS                                     0x0011L
+#define M_SUB_CONST_ABS                               (M_SUB_ABS | M_CONSTANT)
+#define M_MIN                                         0x02000000L
+#define M_MIN_CONST                                   (M_MIN | M_CONSTANT)
+#define M_MAX                                         0x04000000L
+#define M_MAX_CONST                                   (M_MAX | M_CONSTANT)
+#define M_OR                                          0x0016L
+#define M_OR_CONST                                    (M_OR  | M_CONSTANT)
+#define M_AND                                         0x0017L
+#define M_AND_CONST                                   (M_AND | M_CONSTANT)
+#define M_XOR                                         0x0018L
+#define M_XOR_CONST                                   (M_XOR | M_CONSTANT)
+#define M_NOR                                         0x0019L
+#define M_NOR_CONST                                   (M_NOR | M_CONSTANT)
+#define M_NAND                                        0x001AL
+#define M_NAND_CONST                                  (M_NAND | M_CONSTANT)
+#define M_XNOR                                        0x001BL
+#define M_XNOR_CONST                                  (M_XNOR | M_CONSTANT)
+#define M_NOT                                         0x0014L
+#define M_NEG                                         0x0023L
+#define M_ABS                                         0x000CL
+#define M_PASS                                        0x0002L
+#define M_CONST_PASS                                  (M_PASS | M_CONSTANT)
+#define M_MULT                                        0x0100L
+#define M_MULT_CONST                                  (M_MULT | M_CONSTANT)
+#define M_DIV                                         0x0101L
+#define M_DIV_CONST                                   (M_DIV | M_CONSTANT)
+#define M_INV_DIV                                     0x0102L
+#define M_CONST_DIV                                   (M_INV_DIV | M_CONSTANT)
+#define M_SQRT                                        0x0103L
+#define M_SQUARE_ROOT                                 M_SQRT
+#define M_SQUARE                                      0x00000020L // Already defined in milmod.h
+#define M_CUBE                                        0x0104L
+#define M_LN                                          0x0105L
+#define M_LOG10                                       0x0106L
+#define M_LOG2                                        0x0107L
+#define M_EXP_CONST                                   0x0108L
+#define M_CONST_EXP                                   0x0109L
+#define M_EXP                                         0x010AL     // Also defined in mil.h for MgenLutFunction
+#define M_LOG_CONST                                   0x010BL
+#define M_CONST_LOG                                   0x010CL
+#define M_LOG                                         0x010DL     // Also defined in mil.h for MgenLutFunction
+#define M_ATAN2                                       0x010EL
+#define M_INTEGRAL                                    0x010FL
+#define M_AVG                                         0x0110L
+#define M_ABS_SUB                                     0x0111L
+#define M_MIN_ABS                                     0x00200000L // Already defined elsewhere
+#define M_MAX_ABS                                     0x00800000L // Already defined elsewhere
+
+// Note that those are valid only with M_LOGICAL, avoiding conflict with other flags.
+#define M_EQUAL                                       3L
+#define M_NOT_EQUAL                                   4L
+#define M_GREATER                                     5L
+#define M_LESS                                        6L
+#define M_GREATER_OR_EQUAL                            7L
+#define M_LESS_OR_EQUAL                               8L
+
+#define M_EQUAL_CONST                                 (M_EQUAL | M_CONSTANT)
+#define M_NOT_EQUAL_CONST                             (M_NOT_EQUAL | M_CONSTANT)
+#define M_GREATER_CONST                               (M_GREATER | M_CONSTANT)
+#define M_LESS_CONST                                  (M_LESS | M_CONSTANT)
+#define M_GREATER_OR_EQUAL_CONST                      (M_GREATER_OR_EQUAL | M_CONSTANT)
+#define M_LESS_OR_EQUAL_CONST                         (M_LESS_OR_EQUAL | M_CONSTANT)
+
+/************************************************************************/
+/* MimArithMultiple()                                                   */
+/************************************************************************/
+#define M_OFFSET_GAIN                                 0x0000L
+#define M_WEIGHTED_AVERAGE                            0x0001L
+#define M_MULTIPLY_ACCUMULATE_1                       0x0002L
+#define M_MULTIPLY_ACCUMULATE_2                       0x0004L
+
+/************************************************************************/
+/* MimFlip()                                                            */
+/************************************************************************/
+#define M_FLIP_VERTICAL                               1L
+#define M_FLIP_HORIZONTAL                             2L
+
+/************************************************************************/
+/* MimBinarize(), MimClip(), MimLocateEvent(), MimStat()                */
+/* Some of these defines are also define in milutil.h                   */
+/************************************************************************/
+#define M_IN_RANGE                                    1L
+#define M_OUT_RANGE                                   2L
+#define M_EQUAL                                       3L
+#define M_NOT_EQUAL                                   4L
+#define M_GREATER                                     5L
+#define M_LESS                                        6L
+#define M_GREATER_OR_EQUAL                            7L
+#define M_LESS_OR_EQUAL                               8L
+#define M_MASK                                        0x00001000L
+#define M_ALL                                         0x40000000L
+
+/************************************************************************/
+/* These flags are specific to MimLocateEvent()                         */
+/************************************************************************/
+
+//The encoding for extremum mode is done on 11 bits, with the 8 lower bits
+//indicating we use > or >= (0 or 1) for a specific neighbor, the bit 8 is used
+//to select minimum or maximum (0 or 1) and bit 9 for the special case strickly
+//greater than any one and greater or equal to all others. Bit 10 is indicating
+//that one mode is selected. Note that for the neighbor position, we use the
+//same convention than MimConnectMap.
+// n3 n2 n1
+// n4 X  n0
+// n5 n6 n7
+#define M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT      17L                                             // =utilities=
+#define M_LOCAL_MAX_NOT_STRICT                  (0x05FFL << M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT) //Greater or equal to all
+#define M_LOCAL_MAX_STRICT_MEDIUM               (0x0587L << M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT) //Greater right
+#define M_LOCAL_MIN_NOT_STRICT                  (0x04FFL << M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT) //Less or equal to all
+#define M_LOCAL_MIN_STRICT_MEDIUM               (0x0487L << M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT) //Less right
+
+/************************************************************************/
+/* MimBinarize()                                                        */
+/************************************************************************/
+// reserve bits 4-7 to the binarization method
+#define M_BINARIZATION_METHOD_MASK                    0x0F0L
+//#define M_PERCENTILE_VALUE                            0x10L // already defined at the beginning of the file
+#define M_TRIANGLE_BISECTION_DARK                     0x20L
+#define M_TRIANGLE_BISECTION_BRIGHT                   0x30L
+#define M_BIMODAL                                     0x40L
+#define M_FIXED                                       0x50L
+#define M_DISCRETE_RANGE                              0x1000L
+#define M_RETURN_VALUE_AS_FLOAT_IN_INT                0x2000L
+
+/************************************************************************/
+/* MimConvolve()                                                        */
+/************************************************************************/
+#define M_ID_OFFSET_OF_DEFAULT_KERNEL                 (0x00100000L|M_PSEUDO_ID)
+#define M_ID_OFFSET_OF_EDGE_DETECTVAR                 (0x00100100L|M_PSEUDO_ID)
+
+#define M_SMOOTH                                      (M_ID_OFFSET_OF_DEFAULT_KERNEL +  0L)
+#define M_LAPLACIAN_EDGE                              (M_ID_OFFSET_OF_DEFAULT_KERNEL +  1L)
+#define M_LAPLACIAN_EDGE2                             (M_ID_OFFSET_OF_DEFAULT_KERNEL +  2L)
+#define M_SHARPEN                                     (M_ID_OFFSET_OF_DEFAULT_KERNEL +  3L)
+#define M_SHARPEN2                                    (M_ID_OFFSET_OF_DEFAULT_KERNEL +  4L)
+#define M_HORIZ_EDGE                                  (M_ID_OFFSET_OF_DEFAULT_KERNEL +  5L)
+#define M_VERT_EDGE                                   (M_ID_OFFSET_OF_DEFAULT_KERNEL +  6L)
+#define M_EDGE_DETECT                                 (M_ID_OFFSET_OF_DEFAULT_KERNEL +  7L)
+#define M_EDGE_DETECT2                                (M_ID_OFFSET_OF_DEFAULT_KERNEL +  8L)
+#define M_EDGE_DETECT_SQR                             (M_ID_OFFSET_OF_DEFAULT_KERNEL +  9L)
+#define M_FIRST_DERIVATIVE_X                          (M_ID_OFFSET_OF_DEFAULT_KERNEL + 10L)
+#define M_FIRST_DERIVATIVE_Y                          (M_ID_OFFSET_OF_DEFAULT_KERNEL + 11L)
+#define M_SECOND_DERIVATIVE_X                         (M_ID_OFFSET_OF_DEFAULT_KERNEL + 12L)
+#define M_SECOND_DERIVATIVE_Y                         (M_ID_OFFSET_OF_DEFAULT_KERNEL + 13L)
+#define M_SECOND_DERIVATIVE_XY                        (M_ID_OFFSET_OF_DEFAULT_KERNEL + 14L)
+#define M_HORIZONTAL_EDGE_SOBEL                       (M_ID_OFFSET_OF_DEFAULT_KERNEL + 15L)
+#define M_VERTICAL_EDGE_SOBEL                         (M_ID_OFFSET_OF_DEFAULT_KERNEL + 16L)
+#define M_HORIZONTAL_EDGE_PREWITT                     (M_ID_OFFSET_OF_DEFAULT_KERNEL + 17L)
+#define M_VERTICAL_EDGE_PREWITT                       (M_ID_OFFSET_OF_DEFAULT_KERNEL + 18L)
+#define M_SOBEL_X                                     (M_ID_OFFSET_OF_DEFAULT_KERNEL + 19L)
+#define M_SOBEL_Y                                     (M_ID_OFFSET_OF_DEFAULT_KERNEL + 20L)
+#define M_PREWITT_X                                   (M_ID_OFFSET_OF_DEFAULT_KERNEL + 21L)
+#define M_PREWITT_Y                                   (M_ID_OFFSET_OF_DEFAULT_KERNEL + 22L)
+#define M_LAPLACIAN_ISO_8                             (M_ID_OFFSET_OF_DEFAULT_KERNEL + 23L)
+#define M_EDGE_DETECTVAR(Val)                         (M_ID_OFFSET_OF_EDGE_DETECTVAR + Val)
+
+#define M_EDGE_DETECT_SOBEL_FAST                      M_EDGE_DETECT
+#define M_EDGE_DETECT_PREWITT_FAST                    M_EDGE_DETECT2
+#define M_LAPLACIAN_4                                 M_LAPLACIAN_EDGE
+#define M_LAPLACIAN_8                                 M_LAPLACIAN_EDGE2
+#define M_SHARPEN_4                                   M_SHARPEN2
+#define M_SHARPEN_8                                   M_SHARPEN
+
+#define M_OVERSCAN_ENABLE                             0x00008000L
+#define M_OVERSCAN_DISABLE                            0x00080000L
+#define M_OVERSCAN_FAST                               0x00040000L
+
+#if OldDefinesSupport
+
+#define M_SHEN_PREDEFINED_KERNEL                      (0x10000000L|M_ID_OFFSET_OF_DEFAULT_KERNEL)                                   
+#define M_DERICHE_PREDEFINED_KERNEL                   (0x20000000L|M_ID_OFFSET_OF_DEFAULT_KERNEL)                                   
+#define M_SHEN_PREDEFINED_KERNEL_INVALID_TYPE         (0x01000000L|M_SHEN_PREDEFINED_KERNEL)                                        
+#define M_SHEN_PREDEFINED_KERNEL_INVALID_FACTOR       (0x02000000L|M_SHEN_PREDEFINED_KERNEL)                                        
+#define M_DERICHE_PREDEFINED_KERNEL_INVALID_TYPE      (0x01000000L|M_DERICHE_PREDEFINED_KERNEL)                                     
+#define M_DERICHE_PREDEFINED_KERNEL_INVALID_FACTOR    (0x02000000L|M_DERICHE_PREDEFINED_KERNEL)                                     
+#define M_IS_SHEN_PREDEFINED_KERNEL(KernelId)         (((KernelId) & M_SHEN_PREDEFINED_KERNEL) == M_SHEN_PREDEFINED_KERNEL)         
+#define M_IS_DERICHE_PREDEFINED_KERNEL(KernelId)      (((KernelId) & M_DERICHE_PREDEFINED_KERNEL) == M_DERICHE_PREDEFINED_KERNEL)
+
+#define M_SHEN_FILTER(FilterOperation, FilterSmoothness)  (((((FilterOperation) & M_ID_OFFSET_OF_DEFAULT_KERNEL) != M_ID_OFFSET_OF_DEFAULT_KERNEL) && (FilterOperation!=M_DEFAULT))   ? M_SHEN_PREDEFINED_KERNEL_INVALID_TYPE :   \
+   ((((FilterOperation) & (~(M_ID_OFFSET_OF_DEFAULT_KERNEL | 0xFF))) != 0) && (FilterOperation!=M_DEFAULT))                    ? M_SHEN_PREDEFINED_KERNEL_INVALID_TYPE :   \
+   (((((FilterSmoothness) < 0) || ((FilterSmoothness) > 100))) && (FilterSmoothness!=M_DEFAULT))                               ? M_SHEN_PREDEFINED_KERNEL_INVALID_FACTOR : \
+   M_SHEN_PREDEFINED_KERNEL | ((FilterOperation==M_DEFAULT) ? 0x80 : FilterOperation) | ((FilterSmoothness==M_DEFAULT)?(0xFF00):(((long) FilterSmoothness) << 8))          )
+MIL_DEPRECATED(M_SHEN_FILTER, 1040)       // Use new M_LINEAR_FILTER_IIR_CONTEXT with MimConvolve or MimDerivative instead.
+
+#define M_DERICHE_FILTER(FilterOperation, FilterSmoothness) (((((FilterOperation) & M_ID_OFFSET_OF_DEFAULT_KERNEL) != M_ID_OFFSET_OF_DEFAULT_KERNEL) && (FilterOperation!=M_DEFAULT)) ? M_DERICHE_PREDEFINED_KERNEL_INVALID_TYPE :   \
+   ((((FilterOperation) & (~(M_ID_OFFSET_OF_DEFAULT_KERNEL | 0xFF))) != 0) && (FilterOperation!=M_DEFAULT))                  ? M_DERICHE_PREDEFINED_KERNEL_INVALID_TYPE :   \
+   (((((FilterSmoothness) < 0) || ((FilterSmoothness) > 100))) && (FilterSmoothness!=M_DEFAULT))                             ? M_DERICHE_PREDEFINED_KERNEL_INVALID_FACTOR : \
+   M_DERICHE_PREDEFINED_KERNEL | ((FilterOperation==M_DEFAULT) ? 0x80 : FilterOperation) | ((FilterSmoothness==M_DEFAULT)?(0xFF00):(((long) FilterSmoothness) << 8))        )
+MIL_DEPRECATED(M_DERICHE_FILTER, 1040)    // Use new M_LINEAR_FILTER_IIR_CONTEXT with MimConvolve or MimDerivative instead.
+#endif
+
+/************************************************************************/
+/* MimDifferential()                                                    */
+/************************************************************************/
+#define  M_GAUSSIAN_CURVATURE                         2691L             // Already defined.
+#define  M_GRADIENT                                   3306L
+#define  M_GRADIENT_SQR                               3307L
+#define  M_HESSIAN                                    3308L
+#define  M_JACOBIAN                                   3309L
+#define  M_LAPLACIAN                                  3310L
+#define  M_MEAN_CURVATURE                             2692L             // Already defined.
+#define  M_SHARPEN                                    (M_ID_OFFSET_OF_DEFAULT_KERNEL +  3L)  // Already defined for MimConvolve.
+
+
+/************************************************************************/
+/* MimEdgeDetect()                                                      */
+/************************************************************************/
+#if M_MIL_LITE || MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION
+#define M_SOBEL                                       M_EDGE_DETECT_SOBEL_FAST
+#endif
+#define M_NOT_WRITE_ANGLE                             1L
+#define M_NOT_WRITE_INT                               2L
+#define M_FAST_ANGLE                                  4L
+#define M_FAST_GRADIENT                               8L
+#define M_FAST_EDGE_DETECT                            (M_FAST_ANGLE + M_FAST_GRADIENT)
+#define M_REGULAR_ANGLE                               16L
+#define M_REGULAR_GRADIENT                            64L
+#define M_REGULAR_EDGE_DETECT                         (M_REGULAR_ANGLE + M_REGULAR_GRADIENT)
+#define M_USE_RESERVED_ANGLE_VALUE                    128L
+
+/************************************************************************/
+/* MimRank()                                                            */
+/************************************************************************/
+#define M_MEDIAN                                      0x10000L
+#define M_3X3_RECT                                    (M_ID_OFFSET_OF_DEFAULT_KERNEL + 20L)
+#define M_3X3_CROSS                                   (M_ID_OFFSET_OF_DEFAULT_KERNEL + 21L)
+#define M_5X5_RECT                                    (M_ID_OFFSET_OF_DEFAULT_KERNEL + 30L)
+
+/************************************************************************/
+/* MimMorphic(), ...                                                    */
+/************************************************************************/
+#define M_ERODE                                       1L
+#define M_DILATE                                      2L
+#define M_THIN                                        3L
+#define M_THICK                                       4L
+#define M_HIT_OR_MISS                                 5L
+#define M_MATCH                                       6L
+#define M_AREA_OPEN                                   7L
+#define M_AREA_CLOSE                                  8L
+#define M_TOP_HAT                                     9L
+#define M_BOTTOM_HAT                                 10L
+#define M_LEVEL                                      11L
+
+// These flags are already defined elsewhere. We use the same values here.
+#define M_OPEN                                       0x00000010L
+#define M_CLOSE                                      0x00000020L
+
+/************************************************************************/
+/* MimErode()                                                           */
+/************************************************************************/
+#define M_BINARY_ULTIMATE                             1L
+#define M_BINARY_ULTIMATE_ACCUMULATE                  2460L
+
+/************************************************************************/
+/* MimThin()                                                            */
+/************************************************************************/
+#define M_TO_SKELETON                                -1L
+#define M_BINARY2                                     1L
+#define M_BINARY3                                     2L
+#define M_OVERSCAN_REPLACE_MAX                        0x10
+#define M_OVERSCAN_REPLACE_MIN                        0x20
+
+/************************************************************************/
+/* MimThick()                                                           */
+/************************************************************************/
+#define M_TO_IDEMPOTENCE                              M_TO_SKELETON
+
+/************************************************************************/
+/* MimDistance()                                                        */
+/************************************************************************/
+#define M_CHAMFER_3_4                                 0x01
+#define M_CITY_BLOCK                                  0x02
+#define M_CHESSBOARD                                  0x04
+#define M_FORWARD                                     0x01
+#define M_BACKWARD                                    0x02
+#define M_OVERSCAN_TO_DO                              0x04
+#define M_BOTH                                        0x07
+
+/************************************************************************/
+/* MimWatershed()                                                        */
+/************************************************************************/
+#define M_WATERSHED                                   0x0001
+#define M_BASIN                                       0x0002
+#define M_MINIMA_FILL                                 0x0004
+#define M_MAXIMA_FILL                                 0x0008
+
+#define M_4_CONNECTED                                 0x00000010L
+#define M_8_CONNECTED                                 0x00000020L
+#define M_REGULAR                                     0x00020000L
+#define M_STRAIGHT_WATERSHED                          0x0080
+#define M_SKIP_LAST_LEVEL                             0x0100
+#define M_FILL_SOURCE                                 0x0200
+#define M_LABELLED_MARKER                             0x0400
+#define M_LABELED_MARKER                              M_LABELLED_MARKER
+
+#define M_METHOD_1                                    0x1000
+#define M_METHOD_2                                    0x2000
+
+#define M_BASIN_4_CONNECTED                           0x4000
+#define M_BASIN_8_CONNECTED                           0x8000
+
+/************************************************************************/
+/* MimProject()                                                         */
+/************************************************************************/
+#define M_0_DEGREE                                      0.0
+#define M_90_DEGREE                                    90.0
+#define M_180_DEGREE                                  180.0
+#define M_270_DEGREE                                  270.0
+
+/************************************************************************/
+/* MimResize(), MimTranslate() and MimRotate()                          */
+/************************************************************************/
+#define M_OVERSCAN_DISABLE                            0x00080000L
+#define M_OVERSCAN_ENABLE                             0x00008000L
+#define M_OVERSCAN_FAST                               0x00040000L
+#define M_INTERPOLATE                                 0x00000004L
+#define M_BILINEAR                                    0x00000008L
+#define M_BICUBIC                                     0x00000010L
+#define M_AVERAGE                                     0x00000020L
+#define M_NEAREST_NEIGHBOR                            0x00000040L
+#define M_OVERSCAN_CLEAR                              0x00000080L
+#define M_FIT_ALL_ANGLE                               0x00000100L
+#define M_BINARY                                      0x00001000L
+#define M_FAST                                        0x00002000L
+#define M_REGULAR                                     0x00020000L
+
+/************************************************************************/
+/* MimResize                                                            */
+/************************************************************************/
+#define M_FILL_DESTINATION                            -1 // DO NOT MODIFY, WITHOUT CODE MODIFICATION
+
+/************************************************************************/
+/* MimHistogramEqualize()                                               */
+/************************************************************************/
+#define M_UNIFORM                                     1
+#define M_EXPONENTIAL                                 2
+#define M_RAYLEIGH                                    3
+#define M_HYPER_CUBE_ROOT                             4
+#define M_HYPER_LOG                                   5
+
+/************************************************************************/
+/* MimConvert()                                                         */
+/************************************************************************/
+#define M_REGULAR                                     0x00020000L
+#define M_FAST                                        0x00002000L
+#define M_MASK                                        0x00001000L
+
+#define M_ID_OFFSET_OF_DEFAULT_CONVERT                (0x00200000L|M_PSEUDO_ID)
+
+#define M_RGB_TO_HSL                                  (M_ID_OFFSET_OF_DEFAULT_CONVERT + 1L)     // Same as Mil.h
+#define M_RGB_TO_HLS                                  M_RGB_TO_HSL                              // Obsolete
+#define M_RGB_TO_L                                    (M_ID_OFFSET_OF_DEFAULT_CONVERT + 2L)     // Same as Mil.h
+#define M_HSL_TO_RGB                                  (M_ID_OFFSET_OF_DEFAULT_CONVERT + 3L)     // Same as Mil.h
+#define M_HLS_TO_RGB                                  M_HSL_TO_RGB                              // Obsolete
+#define M_L_TO_RGB                                    (M_ID_OFFSET_OF_DEFAULT_CONVERT + 4L)     // Same as Mil.h
+#define M_RGB_TO_Y                                    (M_ID_OFFSET_OF_DEFAULT_CONVERT + 5L)     // Same as Mil.h
+#define M_RGB_TO_H                                    (M_ID_OFFSET_OF_DEFAULT_CONVERT + 6L)     // Same as Mil.h
+
+#define M_RGB_TO_YUV16                                (M_ID_OFFSET_OF_DEFAULT_CONVERT + 101L)   // Same as Mil.h
+#define M_YUV16_TO_RGB                                (M_ID_OFFSET_OF_DEFAULT_CONVERT + 301L)   // Same as Mil.h
+#define M_RGB_NORMALIZE                               (M_ID_OFFSET_OF_DEFAULT_CONVERT + 10L)
+#define M_RGB_TO_HSV                                  (M_ID_OFFSET_OF_DEFAULT_CONVERT + 11L)    // Same as Mildev.h
+#define M_HSV_TO_RGB                                  (M_ID_OFFSET_OF_DEFAULT_CONVERT + 12L)    // Same as Mildev.h
+
+#define M_SRGB_LINEAR_TO_LAB                          (M_ID_OFFSET_OF_DEFAULT_CONVERT + 500L)
+#define M_SRGB_TO_LAB                                 (M_ID_OFFSET_OF_DEFAULT_CONVERT + 501L)
+#define M_LAB_TO_SRGB_LINEAR                          (M_ID_OFFSET_OF_DEFAULT_CONVERT + 502L)
+#define M_LAB_TO_SRGB                                 (M_ID_OFFSET_OF_DEFAULT_CONVERT + 503L)
+#define M_SRGB_LINEAR_TO_LCH                          (M_ID_OFFSET_OF_DEFAULT_CONVERT + 504L)
+#define M_SRGB_TO_LCH                                 (M_ID_OFFSET_OF_DEFAULT_CONVERT + 505L)
+#define M_LCH_TO_SRGB_LINEAR                          (M_ID_OFFSET_OF_DEFAULT_CONVERT + 506L)
+#define M_LCH_TO_SRGB                                 (M_ID_OFFSET_OF_DEFAULT_CONVERT + 507L)
+
+#define M_MATRIX_ID(x)                                (x)                                       // Obsolete from MIL 9
+
+// If the conversion type is set to M_DEFAULT, the conversion will be
+//  choosen according to the type of buffers passed to the function.
+#define M_DEFAULT                                    0x10000000L
+
+// These can be added to the conversion type to speed-up the
+//   process ( M_FAST ) or have a better precision ( M_REGULAR ).
+//   Not all conversion are affected by this flag.
+#define M_REGULAR                                     0x00020000L
+#define M_FAST                                        0x00002000L
+
+/************************************************************************/
+/* MimWarp()                                                            */
+/************************************************************************/
+/* 8 bits reserved for number of fractional bits */
+#define M_WARP_MATRIX                                 0x00100000L
+#define M_WARP_POLYNOMIAL                             0x00200000L
+#define M_WARP_LUT                                    0x00400000L
+#define M_OVERSCAN_ENABLE                             0x00008000L
+#define M_OVERSCAN_DISABLE                            0x00080000L
+#define M_OVERSCAN_FAST                               0x00040000L
+#define M_OVERSCAN_CLEAR                              0x00000080L
+#define M_FIXED_POINT                                 0x00004000L
+
+/************************************************************************/
+/* MimTransform()                                                       */
+/************************************************************************/
+#define M_FFT                                         1L
+#define M_DCT8X8                                      2L
+#define M_DCT                                         3L
+#define M_POLAR                                       5L
+
+#define M_FORWARD                                     0x01
+#define M_REVERSE                                     4L
+#define M_NORMALIZED                                  0x00000002L
+#define M_NORMALIZE                                   M_NORMALIZED
+#define M_1D_ROWS                                     0x00000010L
+#define M_1D_COLUMNS                                  0x00000020L
+#define M_REAL                                        0x00000040L
+#define M_CENTER                                      0x00000080L
+#define M_MAGNITUDE                                   0x00000100L
+#define M_PHASE                                       0x00000200L
+#define M_LOG_SCALE                                   0x00000400L
+#define M_FAST_PHASE                                  0x00000800L
+#define M_SQUARE_MAGNITUDE                            0x00001000L
+#define M_NORMALIZE_PHASE                             0x00002000L
+#define M_NORMALIZE_PHASE_255                         0x00008000L
+#define M_CLOCKWISE_PHASE                             0x00010000L
+#define M_USE_CORDIC                                  0x00020000L
+#define M_INTERNAL_FFT_NEW                            0x00000008L
+
+
+/************************************************************************/
+/* MimWaveletTransform()                                                */
+/************************************************************************/
+#define M_FORWARD                                     0x01            // Already defined elsewhere
+#define M_REVERSE                                     4L              // Already defined elsewhere
+#define M_COPY                                        0x00020000L     // Already defined elsewhere
+
+/************************************************************************/
+/* MimWaveletDenoise  ()                                                */
+/************************************************************************/
+#define M_DENOISE_PSEUDO_ID                              (0x00100100L|M_PSEUDO_ID)   // =utilities
+#define M_BAYES_SHRINK                                   (M_DENOISE_PSEUDO_ID + 2L)
+#define M_SURE_SHRINK                                    (M_DENOISE_PSEUDO_ID + 3L)
+#define M_NEIGH_SHRINK                                   (M_DENOISE_PSEUDO_ID + 4L)
+
+/************************************************************************/
+/* MimPolarTransform()                                                  */
+/************************************************************************/
+#define M_RECTANGULAR_TO_POLAR                        0x00000001L
+#define M_POLAR_TO_RECTANGULAR                        0x00000002L
+#define M_FIXED_POINT                                 0x00004000L
+#define M_RECTANGULAR_TO_POLAR_LUT                    0x00008000L
+#define M_POLAR_TO_RECTANGULAR_LUT                    0x00010000L
+
+/************************************************************************/
+/* MimDraw()                                                       */
+/************************************************************************/
+#define M_DRAW_PEAKS                                  0x01000000L
+#define M_DRAW_DARK_IMAGE                             0x02000000L
+#define M_DRAW_OFFSET_IMAGE                           0x04000000L
+#define M_DRAW_FLAT_IMAGE                             0x08000000L
+#define M_DOTS                                        0x00000040L
+#define M_LINES                                       0x00000080L
+#define M_1D_ROWS                                     0x00000010L    // Already defined elsewhere
+#define M_1D_COLUMNS                                  0x00000020L    // Already defined elsewhere
+#define M_DRAW_STAT_RESULT                            0x00000100L
+#define M_DRAW_WAVELET                                0x00010000L
+#define M_DRAW_WAVELET_WITH_PADDING                   0x00000800L
+#define M_DRAW_MODEL                                  0x00001000L
+#define M_DRAW_MASK                                   0x200000L      // Already defined elsewhere
+#define M_DRAW_PATH                                   0x00000200L
+#define M_DRAW_DEAD_PIXELS                            0x00000400L
+#define M_DRAW_IMAGE_ORIENTATION                      0x00002000L
+#define M_DRAW_DEPTH_MAP_ROW                          0x00004000L
+#define M_DRAW_INTENSITY_MAP_ROW                      0x00008000L
+#define M_DRAW_GLCM_MATRIX                            0x00100000L
+#define M_AUTO_SCALE                                           2L   // Already defined in mil.h
+#define M_SATURATION                                      0x2000L   // Already defined in mil.h
+
+#define M_DRAW_AUG_IMAGE                              0x00020000L // TOMODIFY: review this value
+
+/************************************************************************/
+/* MimStatMultiple()                                                    */
+/************************************************************************/
+#define M_CALCULATE                                   1L          // Already defined elsewhere
+#define M_PREPROCESS                                  0x00000002L // Already defined elsewhere
+#define M_REMOVE                                      0x00000004L
+#define M_RESET_EXTREMES                              0x00000008L
+
+/************************************************************************/
+/* MimFlatField(), MimDeadPixelCorrection(), MimRearrange() and         */
+/* MimStatMultiple()                                                    */
+/************************************************************************/
+#define M_PREPROCESS                                  0x00000002L
+
+/************************************************************************/
+/* MimProjectShape(), MgenLutWarp()                                     */
+/************************************************************************/
+#define M_OPTIMAL_SIZE_X                              0x1L
+#define M_OPTIMAL_SIZE_Y                              0x2L
+#define M_PATH_LIST                                   0x3L
+#define M_X_PATH_LIST                                 0x4L
+#define M_Y_PATH_LIST                                 0x5L
+#define M_XY_PATH_LIST                                0x6L
+#define M_PATH_WIDTH_LIST                             0x7L
+
+/************************************************************************/
+/* MimLocatepeak1d()                                                    */
+/************************************************************************/
+#define M_SCAN_LANE_INDEX                             0x000100000L
+#define M_RANK_INDEX                                  0x000200000L
+
+#define M_PEAK_POSITION                               0x000400000L
+#define M_PEAK_POSITION_X                             0x000800000L
+#define M_PEAK_POSITION_Y                             0x001000000L
+
+#define M_NUMBER                                      1009L         // defined in milmeas.h
+#define M_PEAK_INTENSITY_RANGE                        0x000008000L
+#define M_PEAK_INTENSITY                              0x000010000L
+#define M_FRAME_INDEX                                 0x002000000L
+
+#define M_PEAK_WIDTH                                  11L
+#define M_NUMBER_OF_SCAN_LANES                        0x000020000L
+#define M_INCLUDE_MISSING_DATA                        0x000040000L
+#define M_ONLY_MISSING_DATA                           0x000080000L
+
+#define M_STATUS                                      0x00008002L // Already defined elsewhere
+
+/************************************************************************/
+/* MimBinarizeAdaptive()                                                */
+/************************************************************************/
+#define M_THRESHOLD_MODE                                33L    // Already defined in    miledge.h
+#define M_NIBLACK                                     1880L
+#define M_BERNSEN                                     1881L
+#define M_LOCAL_MEAN                                  1882L
+#define M_PSEUDOMEDIAN                                1883L
+#define M_LOCAL_DIMENSION                             1884L
+#define M_MINIMUM_CONTRAST                            600L     // Also defined in milstr.h
+#define M_GLOBAL_MAX                                  1885L
+#define M_GLOBAL_MIN                                  1886L
+#define M_NIBLACK_BIAS                                1887L
+#define M_GLOBAL_OFFSET                               1888L
+//#define M_HYSTERESIS 31L
+#define M_NIBLACK_BIAS_SECOND_PASS                            1889L
+#define M_GLOBAL_OFFSET_SECOND_PASS                           1890L
+#define M_AVERAGE_MODE                                1891L
+//#define M_UNIFORM                                      1L
+#define M_GAUSSIAN                                    0x805L //also defined in miledge.h
+#define M_RECONSTRUCT                                 1892L
+#define M_NB_ITERATIONS                               1893L
+#define M_NB_SEED_ITERATIONS                          1894L
+#define M_TOGGLE                                      1895L
+#define M_THRESHOLD_TYPE                              3000L
+
+/************************************************************************/
+/* MimAugment()                                                     */
+/************************************************************************/
+
+#define M_SAVE_REPORT                             0x200L // already defined in milcode.h
+                                             
+#define M_PRIORITY                           0x00004000L
+#define M_PROBABILITY                        0x00008000L
+
+// STRUCTURE
+#define M_AUG_DILATION_OP                          3098L
+#define M_AUG_EROSION_OP                           3099L
+#define M_AUG_DILATION_ASYM_OP                     3100L
+#define M_AUG_EROSION_ASYM_OP                      3101L
+
+// GEOMETRIQUE
+#define M_AUG_FLIP_OP                              2870L
+#define M_AUG_CROP_OP                              3102L
+
+// AFFINE
+#define M_AUG_ROTATION_OP                          3103L
+#define M_AUG_SCALE_OP                             3104L
+#define M_AUG_TRANSLATION_X_OP                     3105L
+#define M_AUG_TRANSLATION_Y_OP                     3106L
+#define M_AUG_ASPECT_RATIO_OP                      3107L
+#define M_AUG_SHEAR_X_OP                           2892L
+#define M_AUG_SHEAR_Y_OP                           2893L
+
+// INTENSITY
+#define M_AUG_INTENSITY_MULTIPLY_OP                2940L
+#define M_AUG_INTENSITY_ADD_OP                     2887L
+#define M_AUG_GAMMA_OP                             2962L
+#define M_AUG_LIGHTING_DIRECTIONAL_OP              3108L
+#define M_AUG_SATURATION_GAIN_OP                   2910L
+#define M_AUG_HUE_OFFSET_OP                        2917L
+#define M_AUG_HSV_VALUE_GAIN_OP                    2914L
+
+// FILTER
+#define M_AUG_SMOOTH_DERICHE_OP                    2920L
+#define M_AUG_SMOOTH_GAUSSIAN_OP                   2932L
+#define M_AUG_BLUR_MOTION_OP                       2923L
+#define M_AUG_SHARPEN_DERICHE_OP                   2928L
+
+// NOISE
+#define M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP           2955L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP              2950L
+#define M_AUG_NOISE_SALT_PEPPER_OP                 2947L
+
+
+// Augmentation Control parameters
+#define M_AUG_DILATION_OP_NB_ITERATIONS_MAX           2873L
+#define M_AUG_EROSION_OP_NB_ITERATIONS_MAX            2875L
+#define M_AUG_DILATION_ASYM_OP_NB_ITERATIONS_MAX      2881L
+#define M_AUG_EROSION_ASYM_OP_NB_ITERATIONS_MAX       2882L
+
+#define M_AUG_FLIP_OP_DIRECTION                       3120L
+#define M_AUG_CROP_OP_FACTOR_X                        2884L
+#define M_AUG_CROP_OP_FACTOR_Y                        2885L
+#define M_AUG_CROP_OP_RESIZE                          2886L
+
+#define M_AUG_SCALE_OP_FACTOR_MAX                     2876L
+#define M_AUG_SCALE_OP_FACTOR_MIN                     2877L
+#define M_AUG_ROTATION_OP_ANGLE_MAX                   2805L
+#define M_AUG_ROTATION_OP_ANGLE_REF                   3348L 
+#define M_AUG_ROTATION_OP_ANGLE_DELTA                 3349L
+#define M_AUG_ROTATION_OP_ANGLE_STEP                  3350L
+#define M_AUG_ROTATION_OP_ANGLE_MIN                   3351L
+#define M_AUG_TRANSLATION_X_OP_MAX                    2868L
+#define M_AUG_TRANSLATION_Y_OP_MAX                    2869L
+#define M_AUG_ASPECT_RATIO_OP_MIN                     2878L
+#define M_AUG_ASPECT_RATIO_OP_MAX                     2879L
+#define M_AUG_ASPECT_RATIO_OP_MODE                    2880L
+#define M_AUG_SHEAR_X_OP_MIN                          2888L
+#define M_AUG_SHEAR_X_OP_MAX                          2889L
+#define M_AUG_SHEAR_Y_OP_MIN                          2890L
+#define M_AUG_SHEAR_Y_OP_MAX                          2891L
+
+#define M_AUG_LIGHTING_DIRECTIONAL_OP_ANGLE_MAX       2894L
+#define M_AUG_LIGHTING_DIRECTIONAL_OP_INTENSITY_MIN   2895L
+#define M_AUG_LIGHTING_DIRECTIONAL_OP_INTENSITY_MAX   2896L
+#define M_AUG_SATURATION_GAIN_OP_MIN                  2911L
+#define M_AUG_SATURATION_GAIN_OP_MAX                  2912L
+#define M_AUG_HUE_OFFSET_OP_MIN                       2915L
+#define M_AUG_HUE_OFFSET_OP_MAX                       2916L
+#define M_AUG_HSV_VALUE_GAIN_OP_MIN                   2918L
+#define M_AUG_HSV_VALUE_GAIN_OP_MAX                   2919L
+
+#define M_GAIN_CONST                                  206L  // Already defined for M_FLAT_FIELD_CONTEXT
+#define M_AUG_INTENSITY_MULTIPLY_OP_VALUE             M_GAIN_CONST
+#define M_AUG_INTENSITY_MULTIPLY_OP_DELTA             2941L
+#define M_AUG_INTENSITY_MULTIPLY_OP_MODE              2959L
+#define M_OFFSET_CONST                                204L  // Already defined for M_FLAT_FIELD_CONTEXT
+#define M_AUG_INTENSITY_ADD_OP_VALUE                  M_OFFSET_CONST
+#define M_AUG_INTENSITY_ADD_OP_DELTA                  2958L
+#define M_AUG_INTENSITY_ADD_OP_MODE                   2883L 
+#define M_GAMMA                                       6672L // Already defined mil.h
+#define M_AUG_GAMMA_OP_VALUE                          M_GAMMA
+#define M_AUG_GAMMA_OP_DELTA                          2963L
+#define M_AUG_GAMMA_OP_MODE                           2942L
+
+#define M_AUG_SMOOTH_DERICHE_OP_FACTOR_MIN             2921L
+#define M_AUG_SMOOTH_DERICHE_OP_FACTOR_MAX             2922L
+#define M_AUG_SMOOTH_GAUSSIAN_OP_STDDEV_MIN            2933L
+#define M_AUG_SMOOTH_GAUSSIAN_OP_STDDEV_MAX            2934L
+#define M_AUG_BLUR_MOTION_OP_SIZE_MIN                  2924L
+#define M_AUG_BLUR_MOTION_OP_SIZE_MAX                  2925L
+#define M_AUG_BLUR_MOTION_OP_ANGLE_MIN                 2926L
+#define M_AUG_BLUR_MOTION_OP_ANGLE_MAX                 2927L
+#define M_AUG_SHARPEN_DERICHE_OP_FACTOR_MIN            2929L
+#define M_AUG_SHARPEN_DERICHE_OP_FACTOR_MAX            2930L
+
+#define M_AUG_NOISE_SALT_PEPPER_OP_DENSITY             2948L
+#define M_AUG_NOISE_SALT_PEPPER_OP_DENSITY_DELTA       2949L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP_STDDEV           2951L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP_STDDEV_DELTA     2952L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP_INTENSITY_MIN    2953L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP_DISTRIBUTION     2954L
+#define M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP_STDDEV        2956L
+#define M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP_STDDEV_DELTA  2957L
+
+#define M_AUG_RNG_INIT_VALUE                           2867L
+#define M_AUG_SEED_MODE                                3421L
+//#define M_AUG_CONTEXT_SEED                             3422L 
+#define M_AUG_OPTIMAL_SIZE_X                           3419L 
+#define M_AUG_OPTIMAL_SIZE_Y                           3420L 
+
+/* Parameter value */
+#define M_ALL_BANDS                                    M_ALL_BAND // Already defined mil.h
+#define M_PER_BAND                                     2966L
+#define M_UNIFORM                                      1      // Already defined MimHistogramEqualize()
+#define M_GAUSSIAN                                     0x805L // Already defined in miledge.h
+#define M_RGB                                          8L     // Already defined in mil.h
+#define M_LEFT_HALF                                    M_LEFT
+#define M_RIGHT_HALF                                   M_RIGHT
+#define M_UPPER_HALF                                   M_TOP
+#define M_LOWER_HALF                                   M_BOTTOM
+#define M_NORMAL                                       8L // Already defined in mil.h
+#define M_INVERT                                       2L // Arleady defined in milocr.h    
+
+#define M_RNG_AUTO                                     3422L
+#define M_RNG_INIT_VALUE                               3464L
+#define M_USER_DEFINED_SEED                            3465L
+
+#define M_AUTO_VALUE                                   MAKE_INT64(0x0000000100000000) 
+/************************************************************************/
+/* MimStatCalculate()                                                   */
+/************************************************************************/
+
+/************************************************************************/
+/* MimFilterAdaptive()                                                   */
+/************************************************************************/
+#define M_BILATERAL                                   (M_PSEUDO_ID | 0x400)
+
+#if OldDefinesSupport
+   #define M_NOPEL                                    (M_PSEUDO_ID | 0x401)
+   MIL_DEPRECATED(M_NOPEL, 1040) // Use M_NOISE_PEAK_REMOVAL instead.
+#endif
+#define M_NOISE_PEAK_REMOVAL                          (M_PSEUDO_ID | 0x402)
+#define M_MEDIAN                                      0x10000L       // Already defined elsewhere.
+#define M_MEAN                                        0x08000000L    // Already defined elsewhere.
+#define M_EXTREME                                     3393L
+
+/************************************************************************/
+/* MimRemap()                                                           */
+/************************************************************************/
+
+// Control for M_HIST_LIST
+#define  M_FIT_SRC_RANGE                                 0x01        // Already defined as control for M_HIST_LIST.
+#define  M_FIT_SRC_DATA                                  0x02        // Already defined as control for M_HIST_LIST.
+#define  M_CENTERED                                      0x00010000
+
+#ifdef __cplusplus
+
+inline MIL_INT64 ExtractTypeFromValue(MIL_INT64 Value,
+                                      MIL_INT64 Type1,
+                                      MIL_INT64 Type2 = 0,
+                                      MIL_INT64 Type3 = 0,
+                                      MIL_INT64 Type4 = 0,
+                                      MIL_INT64 Type5 = 0,
+                                      MIL_INT64 Type6 = 0,
+                                      MIL_INT64 Type7 = 0,
+                                      MIL_INT64 Type8 = 0)
+   {
+   MIL_INT64 Type = (Value & M_HLVLDATATYPE_MASK);
+   if (Type) // type specified.
+      {
+      // If the extracted type doesn't match one of the allowed types, set it to 0.
+      if (Type != Type1 &&
+          Type != Type2 &&
+          Type != Type3 &&
+          Type != Type4 &&
+          Type != Type5 &&
+          Type != Type6 &&
+          Type != Type7 &&
+          Type != Type8)
+         {
+         Type = 0;
+         }
+      }
+
+   return Type;
+   }
+
+#endif
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* POINT TO POINT : */
+
+      /* -------------------------------------------------------------- */
+
+#if M_MIL_USE_64BIT
+   #define MimArith(Src1, Src2, Dest, Op) MimArithDouble(M_MILID_TO_DOUBLE(Src1), M_MILID_TO_DOUBLE(Src2), Dest, Op)
+#else
+   #define MimArithDouble MimArith
+#endif
+MIL_DLLFUNC void MFTYPE    MimArithDouble       (MIL_DOUBLE Src1ImageBufIdOrConst,
+                                     MIL_DOUBLE Src2ImageBufIdOrConst,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 Operation);
+
+#if M_MIL_USE_64BIT
+   #define MimArithMultiple(Src1, Src2, Src3, Src4, Src5, Dest, Op, OpFlag) MimArithMultipleDouble(M_MILID_TO_DOUBLE(Src1), M_MILID_TO_DOUBLE(Src2), M_MILID_TO_DOUBLE(Src3), Src4, Src5, Dest, Op, OpFlag)
+#else
+   #define MimArithMultipleDouble MimArithMultiple
+#endif
+MIL_DLLFUNC void MFTYPE    MimArithMultipleDouble(MIL_DOUBLE Src1ImageBufId,
+                                      MIL_DOUBLE Src2ImageBufIdOrConst,
+                                      MIL_DOUBLE Src3ImageBufIdOrConst,
+                                      MIL_DOUBLE Src4Const,
+                                      MIL_DOUBLE Src5Const,
+                                      MIL_ID DstImageBufId,
+                                      MIL_INT64  Operation,
+                                      MIL_INT64  OperationFlag);
+
+MIL_DLLFUNC void MFTYPE    MimLutMap            (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID LutBufId);
+
+MIL_DLLFUNC void MFTYPE    MimShift             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbBitsToShift);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MimBinarizeDouble    (MIL_ID     SrcImageBufId,
+                                        MIL_ID     DstImageBufId,
+                                        MIL_INT64  ConditionAndThreshMode,
+                                        MIL_DOUBLE LowParam,
+                                        MIL_DOUBLE HighParam);
+
+MIL_DLLFUNC void MFTYPE    MimClipDouble        (MIL_ID     SrcImageBufId,
+                                     MIL_ID     DstImageBufId,
+                                     MIL_INT64  Condition,
+                                     MIL_DOUBLE CondLow,
+                                     MIL_DOUBLE CondHigh,
+                                     MIL_DOUBLE WriteLow,
+                                     MIL_DOUBLE WriteHigh);
+
+MIL_DLLFUNC void MFTYPE    MimFlatField         (MIL_ID FlatFieldContextImId,
+                                     MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* NEIGHBOURHOOD : */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimDeinterlace       (MIL_ID DeinterlaceContextImId,
+                                     const MIL_ID *SrcImageArrayPtr,
+                                     const MIL_ID *DstImageArrayPtr,
+                                     MIL_INT SrcImageCount,
+                                     MIL_INT DstImageCount,
+                                     MIL_INT64 ControlFlag);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* GEOMETRICAL: */
+
+   /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimResize             (MIL_ID     SrcImageBufId,
+                                      MIL_ID     DstImageOrArrayBufId,
+                                      MIL_DOUBLE ScaleFactorX,
+                                      MIL_DOUBLE ScaleFactorY,
+                                      MIL_INT64  InterpolationMode);
+
+MIL_DLLFUNC void MFTYPE    MimRotate             (MIL_ID     SrcImageBufId,
+                                      MIL_ID     DstImageOrArrayBufId,
+                                      MIL_DOUBLE Angle,
+                                      MIL_DOUBLE SrcCenX,
+                                      MIL_DOUBLE SrcCenY,
+                                      MIL_DOUBLE DstCenX,
+                                      MIL_DOUBLE DstCenY,
+                                      MIL_INT64  InterpolationMode);
+
+MIL_DLLFUNC void MFTYPE    MimFlip               (MIL_ID SrcImageBufId,
+                                      MIL_ID DstImageBufId,
+                                      MIL_INT64 Operation,
+                                      MIL_INT64 OpFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* STATISTICAL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimHistogram         (MIL_ID SrcImageBufId,
+                                     MIL_ID HistResultImId);
+
+MIL_DLLFUNC void MFTYPE    MimHistogramEqualizeDouble(MIL_ID     SrcImageBufId,
+                                          MIL_ID     DstImageBufId,
+                                          MIL_INT64  Operation,
+                                          MIL_DOUBLE Alpha,
+                                          MIL_DOUBLE Min,
+                                          MIL_DOUBLE Max);
+
+MIL_DLLFUNC void MFTYPE    MimFindExtreme       (MIL_ID SrcImageBufId,
+                                     MIL_ID ExtremeResultImId,
+                                     MIL_INT64 ExtremeType);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MimAllocResult       (MIL_ID SysId,
+                                     MIL_INT NbEntries,
+                                     MIL_INT64 ResultType,
+                                     MIL_ID* ResultImIdPtr);
+
+MIL_DLLFUNC void MFTYPE    MimFree              (MIL_ID ContextOrResultImId);
+
+MIL_DLLFUNC MIL_INT MFTYPE MimInquire           (MIL_ID ContextOrResultImId,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MimGetResult2d       (MIL_ID ResultImId,
+                                     MIL_INT OffsetX,
+                                     MIL_INT OffsetY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT64  ResultType,
+                                     MIL_INT64  ControlFlag,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MimGetResult1d       (MIL_ID ResultImId,
+                                     MIL_INT OffEntry,
+                                     MIL_INT NbEntries,
+                                     MIL_INT64 ResultType,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MimGetResult         (MIL_ID ResultImId,
+                                     MIL_INT64 ResultType,
+                                     void* UserArrayPtr);
+
+/*
+                                     */
+MIL_DLLFUNC void MFTYPE    MimGetResultSingleInt64   (MIL_ID ResultImId,
+                                     MIL_INT64 Index1,
+                                     MIL_INT64 Index2,
+                                     MIL_INT64 ResultType,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MimAlloc             (MIL_ID SysId,
+                                     MIL_INT64 ContextType,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID* ContextImIdPtr);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MimControlInt64      (MIL_ID ContextOrResultImId,
+                                     MIL_INT64 ControlType,
+                                     MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MimControlDouble     (MIL_ID ContextOrResultImId,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MimControlDouble   MimControl
+#define MimControlInt64    MimControl
+MIL_DLLFUNC void MFTYPE    MimControl           (MIL_ID     ContextOrResultImId,
+                                     MIL_INT64  ControlType,
+                                     MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC MIL_INT MFTYPE MimGet               (MIL_ID     ContextImId,
+                                     MIL_INT64  GetType,
+                                     MIL_INT    ArraySize,
+                                     void *     Param1Ptr,
+                                     void *     Param2Ptr,
+                                     MIL_INT64  ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimPut               (MIL_ID      ContextImId,
+                                     MIL_INT64   PutType,
+                                     MIL_INT     ArraySize,
+                                     const void *Param1Ptr,
+                                     const void *Param2Ptr,
+                                     MIL_INT64   ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CONVERSION: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimConvert           (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID ArrayBufIdOrConversionType);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* BUF: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimRearrange         (MIL_ID RearrangeContextImId,
+                                     MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 ControlFlag);
+
+#if M_MIL_USE_UNICODE
+
+MIL_DLLFUNC MIL_ID MFTYPE MimRestoreA           (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID      SysId,
+                                     MIL_INT64   ControlFlag,
+                                     MIL_ID*     ContextImIdPtr);
+MIL_DLLFUNC void MFTYPE MimSaveA                (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID      ContextImId,
+                                     MIL_INT64   ControlFlag);
+MIL_DLLFUNC void MFTYPE MimStreamA              (MIL_TEXTA_PTR      MemPtrOrFileName,
+                                     MIL_ID     SysId,
+                                     MIL_INT64  Operation,
+                                     MIL_INT64  StreamType,
+                                     MIL_DOUBLE Version,
+                                     MIL_INT64  ControlFlag,
+                                     MIL_ID*    ContextImIdPtr,
+                                     MIL_INT*   SizeByteVarPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE MimRestoreW  (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID SysId,
+                                     MIL_INT64  ControlFlag,
+                                     MIL_ID *ContextImIdPtr);
+MIL_DLLFUNC void MFTYPE MimSaveW                (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID ContextImId,
+                                     MIL_INT64  ControlFlag);
+MIL_DLLFUNC void MFTYPE MimStreamW              (MIL_TEXTW_PTR MemPtrOrFileName,
+                                     MIL_ID       SysId,
+                                     MIL_INT64    Operation,
+                                     MIL_INT64    StreamType,
+                                     MIL_DOUBLE   Version,
+                                     MIL_INT64    ControlFlag,
+                                     MIL_ID*      ContextImIdPtr,
+                                     MIL_INT*     SizeByteVarPtr);
+
+#if M_MIL_UNICODE_API
+#define MimRestore   MimRestoreW
+#define MimSave      MimSaveW
+#define MimStream    MimStreamW
+#else
+#define MimRestore   MimRestoreA
+#define MimSave      MimSaveA
+#define MimStream    MimStreamA
+#endif
+
+#else
+
+MIL_DLLFUNC MIL_ID MFTYPE MimRestore            (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID SysId,
+                                     MIL_INT64  ControlFlag,
+                                     MIL_ID *ContextImIdPtr);
+
+MIL_DLLFUNC void MFTYPE MimSave                 (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID ContextImId,
+                                     MIL_INT64  ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MimStream               (MIL_TEXT_PTR  MemPtrOrFileName,
+                                     MIL_ID        SysId,
+                                     MIL_INT64     Operation,
+                                     MIL_INT64     StreamType,
+                                     MIL_DOUBLE    Version,
+                                     MIL_INT64     ControlFlag,
+                                     MIL_ID*       ContextImIdPtr,
+                                     MIL_INT*      SizeByteVarPtr);
+#endif   //#if M_MIL_USE_UNICODE
+
+#if (!M_MIL_LITE)
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* NEIGHBOURHOOD : */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimConvolve          (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID FilterContextImOrKernelBufId);
+
+
+MIL_DLLFUNC void MFTYPE    MimRank              (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID StructElemBufId,
+                                     MIL_INT Rank,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimEdgeDetectMIL_INT (MIL_ID SrcImageBufId,
+                                     MIL_ID DstIntensityImageBufId,
+                                     MIL_ID DstAngleImageBufId,
+                                     MIL_ID KernelId,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_INT Threshold);
+
+MIL_DLLFUNC void MFTYPE    MimMatch             (MIL_ID MatchContextImId,
+                                     MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MimBinarizeAdaptive (  MIL_ID AdaptiveBinarizeContextImId,
+                                               MIL_ID SrcImageBufId,
+                                               MIL_ID SeedImage1BufId,
+                                               MIL_ID SeedImage2BufId,
+                                               MIL_ID BinarizedImageBufId,
+                                               MIL_ID ThresholdImageBufId,
+                                               MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MimAugment(MIL_ID    AugmentationContextImId,
+                                   MIL_ID    SrcImageBufId,
+                                   MIL_ID    DstImageBufOrAugmentationResultImId,
+                                   MIL_INT64 SeedValue,
+                                   MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MimFilterAdaptive(MIL_ID      AdaptiveFilterContextImId,
+                                          MIL_ID      SrcImageBufId,
+                                          MIL_ID      DstImageBufId,
+                                          MIL_DOUBLE  Param1,
+                                          MIL_DOUBLE  Param2,
+                                          MIL_DOUBLE  Param3,
+                                          MIL_INT64   ControlFlag
+                                          );
+
+
+
+MIL_DLLFUNC void MFTYPE MimDifferential(MIL_ID     Drv1ImageBufIdOrFilterContextImId, 
+                                        MIL_ID     SrcOrDrv2ImageBufId, 
+                                        MIL_ID     SrcOrDrv3ImageBufId, 
+                                        MIL_ID     Drv4ImageBufId, 
+                                        MIL_ID     Drv5ImageBufId, 
+                                        MIL_ID     Dst1ImageBufId, 
+                                        MIL_ID     Dst2ImageBufId,
+                                        MIL_DOUBLE Param,
+                                        MIL_INT64  Operation,
+                                        MIL_INT64  ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* MORPHOLOGICAL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimLabel             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimConnectMap        (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID LutBufId);
+
+MIL_DLLFUNC void MFTYPE    MimDilate            (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimErode             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimClose             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimOpen              (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimMorphic           (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID StructElemBufId,
+                                     MIL_INT64 Operation,
+                                     MIL_INT NbIterationOrArea,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimThin              (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimThick             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimDistance          (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 DistanceTransform);
+
+MIL_DLLFUNC void MFTYPE    MimWatershed         (MIL_ID SrcImageBufId,
+                                     MIL_ID MarkerImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT MinVariation,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimZoneOfInfluence   (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 OperationFlag);
+
+MIL_DLLFUNC void MFTYPE    MimDeadPixelCorrection(MIL_ID DeadPixelContextImId,
+                                      MIL_ID SrcImageBufId,
+                                      MIL_ID DstImageBufId,
+                                      MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* GEOMETRICAL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimTranslate          (MIL_ID     SrcImageBufId,
+                                      MIL_ID     DstImageOrArrayBufId,
+                                      MIL_DOUBLE DisplacementX,
+                                      MIL_DOUBLE DisplacementY,
+                                      MIL_INT64  InterpolationMode);
+
+MIL_DLLFUNC void MFTYPE    MimWarp               (MIL_ID SrcImageBufId,
+                                      MIL_ID DstImageBufId,
+                                      MIL_ID WarpParam1BufId,
+                                      MIL_ID WarpParam2BufId,
+                                      MIL_INT64 OperationMode,
+                                      MIL_INT64 InterpolationMode);
+
+MIL_DLLFUNC void MFTYPE    MimWarpList(MIL_ID WarpParamBufId,
+                                       MIL_INT64 TransformType,
+                                       MIL_INT NumPoints,
+                                       const MIL_DOUBLE* SrcCoordXArrayPtr,
+                                       const MIL_DOUBLE* SrcCoordYArrayPtr,
+                                       MIL_DOUBLE* DstCoordXArrayPtr,
+                                       MIL_DOUBLE* DstCoordYArrayPtr,
+                                       MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimPolarTransform (MIL_ID      SrcImageOrDstXLutBufId,
+                                  MIL_ID      DstImageOrYLutBufId,
+                                  MIL_DOUBLE  CenterPosX,
+                                  MIL_DOUBLE  CenterPosY,
+                                  MIL_DOUBLE  StartRadius,
+                                  MIL_DOUBLE  EndRadius,
+                                  MIL_DOUBLE  StartAngle,
+                                  MIL_DOUBLE  EndAngle,
+                                  MIL_INT64   OperationMode,
+                                  MIL_INT64   InterpolationMode,
+                                  MIL_DOUBLE *DstSizeXPtr,
+                                  MIL_DOUBLE *DstSizeYPtr);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* STATISTICAL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimBoundingBox(MIL_ID SrcImageBufId,
+                                          MIL_INT64 Condition,
+                                          MIL_DOUBLE CondLow,
+                                          MIL_DOUBLE CondHigh,
+                                          MIL_INT64 BoxDefinitionType,
+                                          MIL_INT* TopLeftX,
+                                          MIL_INT* TopLeftY,
+                                          MIL_INT* BottomRightX,
+                                          MIL_INT* BottomRightY,
+                                          MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimProject           (MIL_ID SrcImageBufId,
+                                                 MIL_ID ProjResultImId,
+                                                 MIL_DOUBLE ProjectionAngle);
+
+#if M_MILIM_FUNCTION_DEPRECATION_WARNING
+MIL_DEPRECATED(MimProject, 1060) // Use MimProjection instead.
+#endif
+
+MIL_DLLFUNC void MFTYPE MimProjection(MIL_ID       SrcImageBufId,
+                                      MIL_ID       DstImageBufOrResultImId,
+                                      MIL_DOUBLE   ProjectionAxisAngle,
+                                      MIL_INT64    Operation,
+                                      MIL_DOUBLE   OperationValue);
+
+#if M_MIL_USE_64BIT
+   #define MimStat(Src, Result, Type, Condition, CondLow, CondHigh) MimStatDouble(Src, Result, Type, Condition, M_MILID_TO_DOUBLE(CondLow), CondHigh)
+#else
+   #define MimStatDouble MimStat
+#endif
+MIL_DLLFUNC void MFTYPE    MimStatDouble        (MIL_ID SrcImageBufId,
+                                     MIL_ID StatResultImId,
+                                     MIL_INT64 StatType,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondLow,
+                                     MIL_DOUBLE CondHigh);
+
+#if M_MILIM_FUNCTION_DEPRECATION_WARNING
+MIL_DEPRECATED(MimStat, 1060) // Use MimStatCalculate instead.
+#endif
+
+MIL_DLLFUNC void MFTYPE    MimStatMultiple      (MIL_ID StatMultipleContextImId,
+                                     MIL_ID SrcImageBufId,
+                                     MIL_ID StatMultipleResultImId,
+                                     MIL_INT64 ControlFlag);
+#if M_MILIM_FUNCTION_DEPRECATION_WARNING
+MIL_DEPRECATED(MimStatMultiple, 1060) // Use MimStatCalculate instead.
+#endif
+
+MIL_DLLFUNC MIL_INT MFTYPE MimLocateEventDouble (MIL_ID     SrcImageBufId,
+                                     MIL_ID     EventResultImId,
+                                     MIL_INT64  Condition,
+                                     MIL_DOUBLE CondLow,
+                                     MIL_DOUBLE CondHigh);
+
+MIL_DLLFUNC void MFTYPE    MimLocatePeak1dDouble(MIL_ID ContextId,
+                                                 MIL_ID SrcImageBufId,
+                                                 MIL_ID ResultId,
+                                                 MIL_INT PeakWidthNominal,
+                                                 MIL_INT PeakWidthDelta,
+                                                 MIL_DOUBLE MinContrast,
+                                                 MIL_INT64 ControlFlag,
+                                                 MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC MIL_INT MFTYPE MimCountDifference   (MIL_ID Src1ImageBufId,
+                                     MIL_ID Src2ImageBufId,
+                                     MIL_ID CountResultImId);
+
+MIL_DLLFUNC void MFTYPE    MimHistogramEqualizeAdaptive(MIL_ID AdaptiveEqualizeContextImId,
+                                               MIL_ID SrcImageBufId,
+                                               MIL_ID DstImageBufId,
+                                               MIL_INT64 ControlFlag);
+
+
+MIL_DLLFUNC void MFTYPE MimFindOrientation(MIL_ID OrientationContextImId,
+                                       MIL_ID SrcImageBufId,
+                                       MIL_ID OrientationResultImId,
+                                       MIL_INT64  ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimStatCalculate(MIL_ID StatContextImId,
+                                            MIL_ID SrcImageBufId,
+                                            MIL_ID StatResultImId,
+                                            MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* REMAPPING: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimRemap(MIL_ID RemapContextImId,
+                                 MIL_ID SrcImageBufId,
+                                 MIL_ID DstImageBufId,
+                                 MIL_INT64 ControlFlag);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* TRANSFORM: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimTransform            (MIL_ID SrcImageRBufId,
+                                     MIL_ID SrcImageIBufId,
+                                     MIL_ID DstImageRBufId,
+                                     MIL_ID DstImageIBufId,
+                                     MIL_INT64 TransformType,
+                                     MIL_INT64 ControlFlag);
+
+
+/* -------------------------------------------------------------- */
+/* -------------------------------------------------------------- */
+
+/* WAVELET TRANSFORM: */
+
+/* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimWaveletTransform     (MIL_ID WaveletContextImId,
+                                     MIL_ID SrcImageBufOrWaveletResultImId,
+                                     MIL_ID DstImageBufOrWaveletResultImId,
+                                     MIL_INT64 TransformType,
+                                     MIL_INT Level,
+                                     MIL_INT64 ControlFlag);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* WAVELET DENOISE: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimWaveletDenoise (MIL_ID WaveletContextImId,
+                                     MIL_ID SrcImageBufOrWaveletResultImId,
+                                     MIL_ID DstImageBufOrWaveletResultImId,
+                                     MIL_INT Level,
+                                     MIL_ID DenoisingType,
+                                     MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* SET FILTER FOR WAVELET TRANSFORM: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimWaveletSetFilter     (MIL_ID    WaveletContextImId,
+                                     MIL_ID    LowForwardRealFilterId,
+                                     MIL_ID    HighForwardRealFilterId,
+                                     MIL_ID    LowReverseRealFilterId,
+                                     MIL_ID    HighReverseRealFilterId,
+                                     MIL_ID    LowForwardImaginaryFilterId,
+                                     MIL_ID    HighForwardImaginaryFilterId,
+                                     MIL_ID    LowReverseImaginaryFilterId,
+                                     MIL_ID    HighReverseImaginaryFilterId,
+                                     MIL_INT64 ControlFlag);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* DRAW: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimDrawDouble           (MIL_ID     ContextGraId,
+                                     MIL_ID     Src1MilId,
+                                     MIL_ID     Src2MilId,
+                                     MIL_ID     DstImageBufOrListGraId,
+                                     MIL_INT64  Operation,
+                                     MIL_DOUBLE Param1,
+                                     MIL_DOUBLE Param2,
+                                     MIL_INT64  ControlFlag);
+
+#endif // (!MIL_LITE)
+
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#ifdef __cplusplus
+
+inline void MFTYPE MimStreamCpp(MilStreamParam MemPtrOrFileName,
+                                MIL_ID         SysId,
+                                MIL_INT64      Operation,
+                                MIL_INT64      StreamType,
+                                MIL_DOUBLE     Version,
+                                MIL_INT64      ControlFlag,
+                                MIL_ID*        ContextImIdPtr,
+                                MIL_INT*       SizeByteVarPtr)
+   {
+   MimStream(MemPtrOrFileName.m_Param, SysId, Operation, StreamType, Version, ControlFlag, ContextImIdPtr, SizeByteVarPtr);
+   }
+
+#undef  MimStream
+#define MimStream MimStreamCpp
+
+#endif // __cplusplus
+
+#ifdef __cplusplus
+
+inline bool M_IN_IM_INQUIRE_DOUBLE_RANGE(MIL_ID ContextOrResultId, MIL_INT64 InquireType)
+   {
+   if(M_NB_ELEMENTS_BIT_SET(InquireType))
+      {
+      return false;
+      }
+
+   switch (InquireType & M_MASK_MIM_INQUIRE_TYPE)
+      {
+      case M_FILTER_SMOOTHNESS: // case M_MODEL_IMAGE_TYPE:
+         {
+         MIL_INT ContextType = MimInquire(ContextOrResultId, M_INTERNAL_CONTEXT_TYPE, M_NULL);
+
+         if (ContextType == M_LINEAR_FILTER_IIR_CONTEXT)
+            {
+            return true;
+            }
+
+         return false; // if (ContextType == M_MATCH_CONTEXT)
+         }
+
+      case M_DARK_CONST:
+      case M_OFFSET_CONST:
+      case M_FLAT_CONST:
+      case M_GAIN_CONST:
+      case M_EFFECTIVE_GAIN_CONST:
+      case M_MAX_SCORE:
+      case M_CLIP_LIMIT:
+      case M_ALPHA_VALUE:
+      case M_FREQUENCY_CUTOFF_RATIO_HIGH:
+      case M_FREQUENCY_CUTOFF_RATIO_LOW:
+      case M_MINIMUM_CONTRAST:
+      case M_GLOBAL_MAX:
+      case M_GLOBAL_MIN:
+      case M_NIBLACK_BIAS:
+      case M_GLOBAL_OFFSET:
+      case M_NIBLACK_BIAS_SECOND_PASS:
+      case M_GLOBAL_OFFSET_SECOND_PASS:
+      case M_COND_HIGH:
+      case M_COND_LOW:
+      case M_FILTER_ASPECT_RATIO:
+      case M_FILTER_DEFAULT_SHARPEN_PARAM:
+      case M_AUG_ROTATION_OP_ANGLE_MAX:
+      case M_AUG_ROTATION_OP_ANGLE_REF:
+      case M_AUG_ROTATION_OP_ANGLE_DELTA:
+      case M_AUG_ROTATION_OP_ANGLE_STEP:
+      case M_AUG_TRANSLATION_X_OP_MAX:
+      case M_AUG_TRANSLATION_Y_OP_MAX:
+      case M_AUG_SCALE_OP_FACTOR_MIN:
+      case M_AUG_SCALE_OP_FACTOR_MAX:
+      case M_AUG_ASPECT_RATIO_OP_MIN:
+      case M_AUG_ASPECT_RATIO_OP_MAX:
+      case M_AUG_CROP_OP_FACTOR_X:
+      case M_AUG_CROP_OP_FACTOR_Y:
+      case M_AUG_SHEAR_X_OP_MIN:
+      case M_AUG_SHEAR_X_OP_MAX:
+      case M_AUG_SHEAR_Y_OP_MIN:
+      case M_AUG_SHEAR_Y_OP_MAX:
+      case M_AUG_LIGHTING_DIRECTIONAL_OP_INTENSITY_MAX:
+      case M_AUG_LIGHTING_DIRECTIONAL_OP_INTENSITY_MIN:
+      case M_AUG_LIGHTING_DIRECTIONAL_OP_ANGLE_MAX:
+      case M_AUG_SATURATION_GAIN_OP_MIN:
+      case M_AUG_SATURATION_GAIN_OP_MAX:
+      case M_AUG_HSV_VALUE_GAIN_OP_MIN:
+      case M_AUG_HSV_VALUE_GAIN_OP_MAX:
+      case M_AUG_HUE_OFFSET_OP_MIN:
+      case M_AUG_HUE_OFFSET_OP_MAX:
+      case M_AUG_SMOOTH_DERICHE_OP_FACTOR_MIN:
+      case M_AUG_SMOOTH_DERICHE_OP_FACTOR_MAX:
+      case M_AUG_BLUR_MOTION_OP_ANGLE_MIN:
+      case M_AUG_BLUR_MOTION_OP_ANGLE_MAX:
+      case M_AUG_SHARPEN_DERICHE_OP_FACTOR_MIN:
+      case M_AUG_SHARPEN_DERICHE_OP_FACTOR_MAX:
+      case M_AUG_SMOOTH_GAUSSIAN_OP_STDDEV_MAX:
+      case M_AUG_SMOOTH_GAUSSIAN_OP_STDDEV_MIN:
+      case M_AUG_NOISE_SALT_PEPPER_OP_DENSITY:
+      case M_AUG_NOISE_SALT_PEPPER_OP_DENSITY_DELTA:
+      case M_AUG_NOISE_MULTIPLICATIVE_OP_STDDEV:
+      case M_AUG_NOISE_MULTIPLICATIVE_OP_STDDEV_DELTA:
+      case M_AUG_NOISE_MULTIPLICATIVE_OP_INTENSITY_MIN:
+      case M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP_STDDEV:
+      case M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP_STDDEV_DELTA:
+      case M_AUG_INTENSITY_MULTIPLY_OP_DELTA:
+      case M_AUG_INTENSITY_ADD_OP_DELTA:
+      case M_GAMMA:
+      case M_AUG_GAMMA_OP_DELTA:
+      case M_AUG_DILATION_OP + M_PROBABILITY:
+      case M_AUG_EROSION_OP + M_PROBABILITY:
+      case M_AUG_DILATION_ASYM_OP + M_PROBABILITY:
+      case M_AUG_EROSION_ASYM_OP + M_PROBABILITY:
+      case M_AUG_FLIP_OP + M_PROBABILITY:
+      case M_AUG_CROP_OP + M_PROBABILITY:
+      case M_AUG_ROTATION_OP + M_PROBABILITY:
+      case M_AUG_SCALE_OP + M_PROBABILITY:
+      case M_AUG_TRANSLATION_X_OP + M_PROBABILITY:
+      case M_AUG_TRANSLATION_Y_OP + M_PROBABILITY:
+      case M_AUG_ASPECT_RATIO_OP + M_PROBABILITY:
+      case M_AUG_SHEAR_X_OP + M_PROBABILITY:
+      case M_AUG_SHEAR_Y_OP + M_PROBABILITY:
+      case M_AUG_INTENSITY_MULTIPLY_OP + M_PROBABILITY:
+      case M_AUG_INTENSITY_ADD_OP + M_PROBABILITY:
+      case M_AUG_GAMMA_OP + M_PROBABILITY:
+      case M_AUG_LIGHTING_DIRECTIONAL_OP + M_PROBABILITY:
+      case M_AUG_SATURATION_GAIN_OP + M_PROBABILITY:
+      case M_AUG_HUE_OFFSET_OP + M_PROBABILITY:
+      case M_AUG_HSV_VALUE_GAIN_OP + M_PROBABILITY:
+      case M_AUG_SMOOTH_DERICHE_OP + M_PROBABILITY:
+      case M_AUG_SMOOTH_GAUSSIAN_OP + M_PROBABILITY:
+      case M_AUG_BLUR_MOTION_OP + M_PROBABILITY:
+      case M_AUG_SHARPEN_DERICHE_OP + M_PROBABILITY:
+      case M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP + M_PROBABILITY:
+      case M_AUG_NOISE_MULTIPLICATIVE_OP + M_PROBABILITY:
+      case M_AUG_NOISE_SALT_PEPPER_OP + M_PROBABILITY:
+         {
+         return true;
+         }
+
+      default:
+         {
+         break;
+         }
+      }
+
+   return false;
+   }
+
+inline bool M_IN_IM_INQUIRE_MIL_INT64_RANGE(MIL_ID ContextOrResultId, MIL_INT64 InquireType)
+   {
+   UNREFERENCED_PARAMETER(ContextOrResultId);
+
+   if(M_NB_ELEMENTS_BIT_SET(InquireType))
+      {
+      return false;
+      }
+
+   switch (InquireType & M_MASK_MIM_INQUIRE_TYPE)
+      {
+      case M_EXTENDED_CONTEXT_TYPE_DEPRECATED:
+      case M_EXTENDED_RESULT_TYPE:
+      case M_DEAD_PIXELS_IMAGE_ATTRIBUTE:
+      case M_MODEL_IMAGE_ATTRIBUTE:
+      case M_MASK_IMAGE_ATTRIBUTE:
+      case M_ALLOCATED_TYPE:
+         {
+         return true;
+         }
+
+      default:
+         {
+         break;
+         }
+      }
+
+   return false;
+   }
+
+inline bool M_IM_INQUIRE_MUST_HAVE_USER_PTR(MIL_ID ContextOrResultId, MIL_INT64 InquireType)
+   {
+   #if M_MIL_USE_64BIT
+
+   return M_IN_IM_INQUIRE_DOUBLE_RANGE(ContextOrResultId, InquireType);
+
+   #else
+
+   return (M_IN_IM_INQUIRE_DOUBLE_RANGE(ContextOrResultId, InquireType) || M_IN_IM_INQUIRE_MIL_INT64_RANGE(ContextOrResultId, InquireType));
+
+   #endif
+   }
+
+#endif
+
+#if M_MIL_USE_64BIT
+#ifdef __cplusplus
+//////////////////////////////////////////////////////////////
+// MbufControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MimControl(MIL_ID ContextOrResultImId,
+                       MIL_INT64 ControlType,
+                       int ControlValue)
+   {
+   MimControlInt64(ContextOrResultImId, ControlType, ControlValue);
+   };
+#endif
+
+inline void MimControl(MIL_ID ContextOrResultImId,
+                       MIL_INT64 ControlType,
+                       MIL_INT32 ControlValue)
+   {
+   MimControlInt64(ContextOrResultImId, ControlType, ControlValue);
+   }
+
+inline void MimControl(MIL_ID ContextOrResultImId,
+                       MIL_INT64 ControlType,
+                       MIL_INT64 ControlValue)
+   {
+   MimControlInt64(ContextOrResultImId, ControlType, ControlValue);
+   }
+
+inline void MimControl(MIL_ID ContextOrResultImId,
+                       MIL_INT64 ControlType,
+                       MIL_DOUBLE ControlValue)
+   {
+   MimControlDouble(ContextOrResultImId, ControlType, ControlValue);
+   }
+
+#else
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. Int64 one
+//////////////////////////////////////////////////////////////
+#define MimControl  MimControlInt64
+
+#endif // __cplusplus
+#endif // M_MIL_USE_64BIT
+
+#if(defined(__cplusplus))
+
+//////////////////////////////////////////////////////////////
+// MbufBinarize function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline MIL_INT MFTYPE MimBinarize(MIL_ID     SrcImageBufId,
+                                  MIL_ID     DstImageBufId,
+                                  MIL_INT64  ConditionAndThreshMode,
+                                  MIL_DOUBLE LowParam,
+                                  MIL_DOUBLE HighParam)
+   {
+   return   MimBinarizeDouble(SrcImageBufId, DstImageBufId, ConditionAndThreshMode, LowParam, HighParam);
+   }
+
+inline void MFTYPE MimClip(MIL_ID     SrcImageBufId,
+                           MIL_ID     DstImageBufId,
+                           MIL_INT64  Condition,
+                           MIL_DOUBLE CondLow,
+                           MIL_DOUBLE CondHigh,
+                           MIL_DOUBLE WriteLow,
+                           MIL_DOUBLE WriteHigh)
+   {
+   MimClipDouble(SrcImageBufId, DstImageBufId, Condition, CondLow, CondHigh, WriteLow, WriteHigh);
+   }
+
+inline void MFTYPE MimHistogramEqualize(MIL_ID      SrcImageBufId,
+                                        MIL_ID      DstImageBufId,
+                                        MIL_INT64   EqualizationType,
+                                        MIL_DOUBLE  Alpha,
+                                        MIL_DOUBLE  Min,
+                                        MIL_DOUBLE  Max)
+   {
+   MimHistogramEqualizeDouble(SrcImageBufId, DstImageBufId, EqualizationType, Alpha, Min, Max);
+   }
+
+#if (!M_MIL_LITE)
+
+inline void MFTYPE MimDraw(MIL_ID     ContextGraId,
+                           MIL_ID     Src1MilId,
+                           MIL_ID     Src2MilId,
+                           MIL_ID     DstImageBufOrListGraId,
+                           MIL_INT64  Operation,
+                           MIL_DOUBLE Param1,
+                           MIL_DOUBLE Param2,
+                           MIL_INT64  ControlFlag)
+   {
+   MimDrawDouble(ContextGraId, Src1MilId, Src2MilId, DstImageBufOrListGraId, Operation, Param1, Param2, ControlFlag);
+   }
+
+inline void MFTYPE MimEdgeDetect(MIL_ID SrcImageBufId,
+                                 MIL_ID DstIntensityImageBufId,
+                                 MIL_ID DstAngleImageBufId,
+                                 MIL_ID KernelId,
+                                 MIL_INT64 ControlFlag,
+                                 MIL_INT Threshold)
+   {
+   MimEdgeDetectMIL_INT(SrcImageBufId, DstIntensityImageBufId, DstAngleImageBufId, KernelId, ControlFlag, Threshold);
+   }
+
+inline MIL_INT MFTYPE MimLocateEvent(MIL_ID     SrcImageBufId,
+                                     MIL_ID     EventResultImId,
+                                     MIL_INT64  Condition,
+                                     MIL_DOUBLE CondLow,
+                                     MIL_DOUBLE CondHigh)
+   {
+   return MimLocateEventDouble(SrcImageBufId, EventResultImId, Condition, CondLow, CondHigh);
+   }
+
+inline void MFTYPE MimLocatePeak1d(MIL_ID ContextId,
+                                   MIL_ID SrcImageBufId,
+                                   MIL_ID ResultId,
+                                   MIL_INT PeakWidthNominal,
+                                   MIL_INT PeakWidthDelta,
+                                   MIL_DOUBLE MinContrast,
+                                   MIL_INT64 ControlFlag,
+                                   MIL_DOUBLE ControlValue)
+   {
+   MimLocatePeak1dDouble(ContextId, SrcImageBufId, ResultId, PeakWidthNominal, PeakWidthDelta, MinContrast, ControlFlag, ControlValue);
+   }
+
+
+#endif
+
+#else //#if(!defined(__cplusplus))
+
+#define  MimBinarize                   MimBinarizeDouble
+#define  MimClip                       MimClipDouble
+#define  MimHistogramEqualize          MimHistogramEqualizeDouble
+
+#if (!M_MIL_LITE)
+
+#define  MimDraw                       MimDrawDouble
+#define  MimEdgeDetect                 MimEdgeDetectMIL_INT
+#define  MimLocateEvent                MimLocateEventDouble
+#define  MimLocatePeak1d               MimLocatePeak1dDouble
+#endif
+
+#endif   //#if(defined(__cplusplus))
+
+#define  MimGetResultSingle            MimGetResultSingleInt64
+
+#if M_MIL_USE_SAFE_TYPE
+
+//////////////////////////////////////////////////////////////
+// See milos.h for explanation about these functions.
+//////////////////////////////////////////////////////////////
+
+//-------------------------------------------------------------------------------------
+// MimGetResult
+
+inline void MFTYPE MimGetResultUnsafe  (MIL_ID ResultImId, MIL_INT64  ResultType, void           *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, int             UserArrayPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, std::nullptr_t              );
+#endif
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_INT32      *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_INT64      *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, float          *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_DOUBLE     *UserArrayPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_UINT32     *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_UINT64     *UserArrayPtr);
+#endif
+
+//-------------------------------------------------------------------------------------
+// MimGetResult1d
+
+inline void MFTYPE MimGetResult1dUnsafe  (MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, void           *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, int             UserArrayPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, std::nullptr_t              );
+#endif
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_INT32      *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_INT64      *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, float          *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_DOUBLE     *UserArrayPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_UINT32     *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_UINT64     *UserArrayPtr);
+#endif
+
+//-------------------------------------------------------------------------------------
+// MimGetResult2d
+
+inline void MFTYPE MimGetResult2dUnsafe  (MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, void           *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, int             UserArrayPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, std::nullptr_t              );
+#endif
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_INT32      *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_INT64      *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, float          *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_DOUBLE     *UserArrayPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_UINT32     *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_UINT64     *UserArrayPtr);
+#endif
+
+//-------------------------------------------------------------------------------------
+// MimGetResultSingle
+
+inline void MFTYPE MimGetResultSingleUnsafe  (MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, void           *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, int             UserArrayPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, std::nullptr_t              );
+#endif
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_INT32      *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_INT64      *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, float          *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_DOUBLE     *UserArrayPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_UINT32     *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_UINT64     *UserArrayPtr);
+#endif   //#if(defined(__cplusplus))
+//-------------------------------------------------------------------------------------
+// MimGet
+
+inline MIL_INT MFTYPE MimGetUnsafe  (MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, void        *Param1Ptr, void        *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, int         *Param1Ptr, int         *Param2Ptr, MIL_INT64 ControlFlag);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, std::nullptr_t        , std::nullptr_t        , MIL_INT64 ControlFlag);
+#endif
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_INT32   *Param1Ptr, MIL_INT32   *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_INT64   *Param1Ptr, MIL_INT64   *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, float       *Param1Ptr, float       *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_DOUBLE  *Param1Ptr, MIL_DOUBLE  *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, char        *Param1Ptr, char        *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, short       *Param1Ptr, short       *Param2Ptr, MIL_INT64 ControlFlag);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT32  *Param1Ptr, MIL_UINT32  *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT64  *Param1Ptr, MIL_UINT64  *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT8   *Param1Ptr, MIL_UINT8   *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT16  *Param1Ptr, MIL_UINT16  *Param2Ptr, MIL_INT64 ControlFlag);
+#endif
+
+// ----------------------------------------------------------
+// MimInquire
+
+inline MIL_INT MFTYPE MimInquireUnsafe  (MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, void        * ValuePtr);
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, int           ValuePtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, std::nullptr_t        );
+#endif
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_INT32   * ValuePtr);
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_INT64   * ValuePtr);
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_DOUBLE  * ValuePtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_UINT32  * ValuePtr);
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_UINT64  * ValuePtr);
+#endif
+
+// -------------------------------------------------------------------------
+// MimGetResult
+
+inline MIL_INT64 RequiredTypeFromBufType(MIL_ID ResultImId)
+   {
+   MIL_INT Type = MbufInquire(ResultImId, M_TYPE, M_NULL);
+
+   if (Type == 32+M_FLOAT)
+      {
+      return M_TYPE_FLOAT;
+      }
+   else if (Type == 64+M_FLOAT)
+      {
+      return M_TYPE_DOUBLE;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline bool IsAugmentResult(MIL_INT64 ResultType, MIL_INT64* ResultDataType)
+   {
+   bool bAskAvailable = (ResultType & M_AVAILABLE) == M_AVAILABLE;
+   MIL_INT64 ResultTypeStripped = ResultType & ~M_AVAILABLE;
+   bool bIsAugmentResultType = false;
+   switch(ResultTypeStripped)
+      {
+      case M_AUG_DILATION_NB_ITERATIONS:
+      case M_AUG_EROSION_NB_ITERATIONS:
+      case M_AUG_DILATION_ASYM_NB_ITERATIONS:
+      case M_AUG_DILATION_ASYM_SUBAREA:
+      case M_AUG_EROSION_ASYM_NB_ITERATIONS:
+      case M_AUG_EROSION_ASYM_SUBAREA:
+      case M_AUG_FLIP_DIRECTION:
+      case M_AUG_CROP_TOP_LEFT_X:
+      case M_AUG_CROP_TOP_LEFT_Y:
+      case M_AUG_CROP_BOTTOM_RIGHT_X:
+      case M_AUG_CROP_BOTTOM_RIGHT_Y:
+      case M_AUG_ROTATION_ANGLE:
+      case M_AUG_SCALE_FACTOR:
+      case M_AUG_TRANSLATION_X:
+      case M_AUG_TRANSLATION_Y:
+      case M_AUG_ASPECT_RATIO:
+      case M_AUG_ASPECT_RATIO_MODE:
+      case M_AUG_SHEAR_X:
+      case M_AUG_SHEAR_Y:
+      case M_AUG_INTENSITY_MULTIPLY_VALUE:
+      case M_AUG_INTENSITY_ADD_VALUE:
+      case M_AUG_GAMMA_VALUE_BAND_0:
+      case M_AUG_GAMMA_VALUE_BAND_1:
+      case M_AUG_GAMMA_VALUE_BAND_2:
+      case M_AUG_LIGHTING_DIRECTIONAL_ANGLE:
+      case M_AUG_SATURATION_GAIN:
+      case M_AUG_HUE_OFFSET:
+      case M_AUG_HSV_VALUE_GAIN:
+      case M_AUG_SMOOTH_DERICHE_VALUE:
+      case M_AUG_SMOOTH_GAUSSIAN_STDDEV:
+      case M_AUG_BLUR_MOTION_SIZE:
+      case M_AUG_BLUR_MOTION_ANGLE:
+      case M_AUG_SHARPEN_DERICHE_VALUE:
+      case M_AUG_NOISE_GAUSSIAN_ADDITIVE_STDDEV:
+      case M_AUG_NOISE_MULTIPLICATIVE_STDDEV:
+      case M_AUG_NOISE_SALT_PEPPER_DENSITY:
+      case M_AUG_OPTIMAL_SIZE_X:
+      case M_AUG_OPTIMAL_SIZE_Y:
+      case M_AUG_SEED_USED:
+      case M_AUG_REVERSE_TRANSFORMATION_MATRIX:
+      case M_AUG_OPERATIONS_ENABLED:
+      case M_AUG_OPERATIONS_APPLIED:
+      case M_AUG_OPERATION_RESULT_TYPES:
+      case M_AUG_OPERATION_ASSOCIATED_WITH_RESULT_TYPES:
+         *ResultDataType = M_TYPE_MIL_DOUBLE;
+         bIsAugmentResultType = true;
+         break;
+
+      default:
+         bIsAugmentResultType = false;
+         break;
+      }
+   if(bIsAugmentResultType)
+      {
+      if(bAskAvailable)
+         *ResultDataType = M_TYPE_MIL_INT;
+      return true;
+      }
+   else
+      return false;
+
+   }
+
+inline MIL_INT64  MimGetResultRequiredType(MIL_ID ResultImId, MIL_INT64  ResultType)
+   {
+   /* MimAugment Result specific (include M_AVAILABLE) which is not available for other M_IM_RESULT */
+   MIL_INT64 AugmentResultDataType;
+   if(IsAugmentResult(ResultType, &AugmentResultDataType))
+      return AugmentResultDataType;
+
+   /* Other M_IM_RESULT*/
+   switch (ResultType)
+      {
+      case M_NB_EVENT:
+      case M_POSITION_X:
+      case M_POSITION_Y:
+      {
+      // For these results, the doc specifies that MIL_INT is returned
+      // except when allocated with 32+M_FLOAT, where a float is returned.
+      return RequiredTypeFromBufType(ResultImId);
+      }
+      break;
+   case M_VALUE:
+      {
+      // For M_VALUE, the doc specifies that MIL_INT is returned
+      // except for M_PROJ_LIST, M_EXTREME_LIST, M_EVENT_LIST
+      // allocated with 32+M_FLOAT, where a float is returned.
+      MIL_INT64 IdResultType = 0;
+      MimInquire(ResultImId, M_EXTENDED_RESULT_TYPE, &IdResultType);
+      switch (IdResultType)
+         {
+      case M_PROJ_LIST:
+      case M_EXTREME_LIST:
+      case M_EVENT_LIST:
+         {
+         return RequiredTypeFromBufType(ResultImId);
+         }
+         break;
+      default:
+         return M_TYPE_MIL_INT;
+         break;
+         }
+      }
+      break;
+   case M_ANGLE:
+   case M_SCORE:
+      {
+      MIL_INT64 IdResultType = 0;
+      MimInquire(ResultImId, M_EXTENDED_RESULT_TYPE, &IdResultType);
+      switch (IdResultType)
+         {
+      case M_FIND_ORIENTATION_LIST:
+         {
+         return RequiredTypeFromBufType(ResultImId);
+         }
+         break;
+      default:
+         return M_TYPE_MIL_INT;
+         break;
+         }
+      }
+      break;
+
+   case M_VALUE+M_PERCENTAGE:
+   case M_CUMULATIVE_VALUE+M_PERCENTAGE:
+   case M_PERCENTILE_VALUE:
+   case M_NUMBER_OF_LEVELS:
+   case M_TRANSFORMATION_MODE:
+   case M_WAVELET_TYPE:
+   case M_WAVELET_SIZE:
+   case M_WAVELET_DRAW_SIZE_X:
+   case M_WAVELET_DRAW_SIZE_Y:
+   case M_WAVELET_DRAW_SIZE_X_WITH_PADDING:
+   case M_WAVELET_DRAW_SIZE_Y_WITH_PADDING:
+   case M_TRANSFORMATION_DOMAIN:
+   case M_HIST_VALUE_OFFSET:
+   case M_HIST_VALUE_RANGE:
+   case M_HIST_REAL_SIZE:
+   case M_ORIGINAL_IMAGE_SIZE_X:
+   case M_ORIGINAL_IMAGE_SIZE_Y:
+      return M_TYPE_MIL_INT;
+      break;
+
+   case M_CUMULATIVE_VALUE: /* case M_VALID: */
+      {
+      MIL_INT64 IdResultType = 0;
+
+      MimInquire(ResultImId, M_EXTENDED_RESULT_TYPE, &IdResultType);
+
+      switch (IdResultType)
+         {
+         case M_PROJ_LIST:
+            {
+            return RequiredTypeFromBufType(ResultImId);
+
+            break;
+            }
+
+         default:
+            {
+            return M_TYPE_MIL_INT;
+
+            break;
+            }
+         }
+
+      break;
+      }
+
+   case M_WAVELET_COEFFICIENTS_IMAGE_ID:
+   case M_WAVELET_COEFFICIENTS_IMAGE_ID + M_REAL_PART:
+   case M_WAVELET_COEFFICIENTS_IMAGE_ID + M_IMAGINARY_PART:
+      return M_TYPE_MIL_ID;
+      break;
+
+   case M_WAVELET_LEVEL_SIZE_X:
+   case M_WAVELET_LEVEL_SIZE_Y:
+   case M_WAVELET_LEVEL_PADDING_OFFSET_X:
+   case M_WAVELET_LEVEL_PADDING_OFFSET_Y:
+      return M_TYPE_DOUBLE;
+      break;
+
+   case M_ASSOCIATED_CONTEXT_TYPE:
+      return M_TYPE_MIL_INT;
+      break;
+
+   default:
+      {
+      MIL_INT64 IdResultType = 0;
+      MimInquire(ResultImId, M_EXTENDED_RESULT_TYPE, &IdResultType);
+      if (M_LOCATE_PEAK_1D_RESULT == IdResultType)
+         return M_TYPE_MIL_INT;
+      }
+      return M_TYPE_DOUBLE;
+      break;
+      }
+   }
+
+
+inline MIL_INT64 MimGetRequiredType(MIL_INT64 ResultType)
+   {
+   UNREFERENCED_PARAMETER(ResultType);
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64 ResultType, int UserArrayPtr)
+   {
+   if (UserArrayPtr)
+      SafeTypeError(MIL_TEXT("MimGetResult"));
+
+   MimGetResult(ResultImId, ResultType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64 ResultType, std::nullptr_t)
+   {
+   MimGetResult(ResultImId, ResultType, NULL);
+   }
+#endif
+
+inline void MimGetResultSafeTypeExecute (MIL_ID ResultImId, MIL_INT64 ResultType, void *UserArrayPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(ResultType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT);
+   if (RequiredType == 0)
+      RequiredType = MimGetResultRequiredType(ResultImId, ResultType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGetResult"));
+
+   MimGetResult(ResultImId, ResultType, UserArrayPtr);
+   }
+
+
+inline void MFTYPE MimGetResultUnsafe  (MIL_ID ResultImId, MIL_INT64  ResultType, void        *UserArrayPtr) {MimGetResult               (ResultImId, ResultType, UserArrayPtr);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_INT32   *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_INT64   *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, float       *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_FLOAT);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_DOUBLE  *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_UINT32  *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_UINT64  *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// -------------------------------------------------------------------------
+// MimGetResult1d
+
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, int UserArrayPtr)
+   {
+   if (UserArrayPtr)
+      SafeTypeError(MIL_TEXT("MimGetResult1d"));
+
+   MimGetResult1d(ResultImId, OffEntry, NbEntries, ResultType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, std::nullptr_t)
+   {
+   MimGetResult1d(ResultImId, OffEntry, NbEntries, ResultType, NULL);
+   }
+#endif
+
+inline void MimGetResult1dSafeTypeExecute (MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, void *UserArrayPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(ResultType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT);
+   if (RequiredType == 0)
+      RequiredType = MimGetResultRequiredType(ResultImId, ResultType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGetResult1d"));
+
+   MimGetResult1d(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr);
+   }
+
+inline void MFTYPE MimGetResult1dUnsafe  (MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, void        *UserArrayPtr){MimGetResult1d               (ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_INT32   *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_INT64   *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, float       *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_FLOAT);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_DOUBLE  *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_UINT32  *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_UINT64  *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// -------------------------------------------------------------------------
+// MimGetResult2d
+
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, int UserArrayPtr)
+   {
+   if(UserArrayPtr)
+      SafeTypeError(MIL_TEXT("MimGetResult2d"));
+
+   MimGetResult2d(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, std::nullptr_t)
+   {
+   MimGetResult2d(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, NULL);
+   }
+#endif
+
+inline void MimGetResult2dSafeTypeExecute (MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, void *UserArrayPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(ResultType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT);
+   if (RequiredType == 0)
+      RequiredType = MimGetResultRequiredType(ResultImId, ResultType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGetResult2d"));
+
+   MimGetResult2d(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr);
+   }
+
+inline void MFTYPE MimGetResult2dUnsafe  (MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, void        *UserArrayPtr){MimGetResult2d               (ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_INT32   *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_INT64   *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_MIL_INT64);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, float       *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_FLOAT);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_DOUBLE  *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_UINT32  *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_UINT64  *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// -------------------------------------------------------------------------
+// MimGetResultSingle
+
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, int UserArrayPtr)
+   {
+   if(UserArrayPtr)
+      SafeTypeError(MIL_TEXT("MimGetResultSingle"));
+
+   MimGetResultSingleInt64(ResultImId, Index1, Index2,ResultType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, std::nullptr_t)
+   {
+   MimGetResultSingleInt64(ResultImId, Index1, Index2, ResultType, NULL);
+   }
+#endif
+
+inline void MFTYPE MimGetResultSingleSafeTypeExecute (MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, void *UserArrayPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(ResultType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT, M_TYPE_MIL_ID);
+   if (RequiredType == 0)
+      RequiredType = MimGetResultRequiredType(ResultImId, ResultType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGetResultSingle"));
+
+   MimGetResultSingleInt64(ResultImId, Index1, Index2, ResultType, UserArrayPtr);
+   }
+
+inline void MFTYPE MimGetResultSingleUnsafe  (MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, void        *UserArrayPtr){MimGetResultSingleInt64          (ResultImId, Index1, Index2, ResultType, UserArrayPtr);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_INT32   *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_INT64   *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, float       *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_FLOAT);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_DOUBLE  *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_UINT32  *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_UINT64  *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+#endif
+
+
+// -------------------------------------------------------------------------
+// MimGet
+
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, int Param1Ptr, int ParamPtr2, MIL_INT64 ControlFlag)
+   {
+   if(Param1Ptr)
+      SafeTypeError(MIL_TEXT("MimGet"));
+
+   if(ParamPtr2)
+      SafeTypeError(MIL_TEXT("MimGet"));
+
+   return MimGet(ContextImId, GetType, ArraySize, NULL, NULL, ControlFlag);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, std::nullptr_t, std::nullptr_t, MIL_INT64 ControlFlag)
+   {
+   return MimGet(ContextImId, GetType, ArraySize, NULL, NULL, ControlFlag);
+   }
+#endif
+
+inline MIL_INT MimGetSafeTypeExecute (MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, void *Param1Ptr, void *ParamPtr2, MIL_INT64 ControlFlag, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(GetType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT, M_TYPE_MIL_ID, M_TYPE_CHAR, M_TYPE_SHORT);
+   if (RequiredType == 0)
+      RequiredType = MimGetRequiredType(GetType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGet"));
+
+   return MimGet(ContextImId, GetType, ArraySize, Param1Ptr, ParamPtr2, ControlFlag);
+   }
+
+inline MIL_INT MFTYPE MimGetUnsafe  (MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, void        *Param1Ptr, void        *Param2Ptr, MIL_INT64 ControlFlag){return MimGet               (ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_INT32   *Param1Ptr, MIL_INT32   *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_INT64   *Param1Ptr, MIL_INT64   *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, float       *Param1Ptr, float       *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_FLOAT);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_DOUBLE  *Param1Ptr, MIL_DOUBLE  *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_DOUBLE);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, char        *Param1Ptr, char        *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_CHAR);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, short       *Param1Ptr, short       *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_SHORT);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT32  *Param1Ptr, MIL_UINT32  *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT64  *Param1Ptr, MIL_UINT64  *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT8   *Param1Ptr, MIL_UINT8   *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_CHAR);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT16  *Param1Ptr, MIL_UINT16  *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_SHORT);}
+#endif
+// ----------------------------------------------------------
+// MimInquire
+
+inline MIL_INT64 MimInquireRequiredType(MIL_ID ContextOrResultId, MIL_INT64 InquireType)
+   {
+   MIL_INT64  DataType = ExtractTypeFromValue(InquireType, M_TYPE_DOUBLE, M_TYPE_MIL_ID, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64);
+
+   if (DataType)
+      return DataType;
+
+   if (M_IN_IM_INQUIRE_DOUBLE_RANGE(ContextOrResultId, InquireType))
+      return M_TYPE_DOUBLE;
+
+   if (M_IN_IM_INQUIRE_MIL_INT64_RANGE(ContextOrResultId, InquireType))
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, int UserVarPtr)
+   {
+   bool MustHaveUserPointer = M_IM_INQUIRE_MUST_HAVE_USER_PTR(ContextOrResultId, InquireType);
+
+   if (UserVarPtr || MustHaveUserPointer)
+      SafeTypeError(MIL_TEXT("MimInquire"));
+
+   return MimInquire(ContextOrResultId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, std::nullptr_t)
+   {
+   bool MustHaveUserPointer = M_IM_INQUIRE_MUST_HAVE_USER_PTR(ContextOrResultId, InquireType);
+
+   if(MustHaveUserPointer)
+      SafeTypeError(MIL_TEXT("MimInquire"));
+
+   return MimInquire(ContextOrResultId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MimInquireSafeTypeExecute (MIL_ID ContextOrResultId, MIL_INT64  InquireType, void  *UserVarPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = MimInquireRequiredType(ContextOrResultId, InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimInquire"));
+
+   return MimInquire(ContextOrResultId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MimInquireUnsafe  (MIL_ID ContextOrResultId, MIL_INT64  InquireType, void        *UserVarPtr) {return MimInquire               (ContextOrResultId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_INT32   *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_INT64   *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_DOUBLE  *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_UINT32  *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_UINT64  *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#define MimGet               MimGetSafeType
+#define MimGetResult         MimGetResultSafeType
+#define MimGetResult1d       MimGetResult1dSafeType
+#define MimGetResult2d       MimGetResult2dSafeType
+#if (defined(MimGetResultSingle))
+#undef MimGetResultSingle
+#endif
+#define MimGetResultSingle   MimGetResultSingleSafeType
+#define MimInquire           MimInquireSafeType
+
+#else // #if M_MIL_USE_SAFE_TYPE
+
+#define MimGetUnsafe               MimGet
+#define MimGetResultUnsafe         MimGetResult
+#define MimGetResult1dUnsafe       MimGetResult1d
+#define MimGetResult2dUnsafe       MimGetResult2d
+#define MimGetResultSingleUnsafe   MimGetResultSingle
+#define MimInquireUnsafe           MimInquire
+
+#endif // #if M_MIL_USE_SAFE_TYPE
+
+// ----------------------------------------------------------
+// Overload for std::vector.
+#if defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+template <typename UserType>
+inline void MFTYPE MimGetResult(MIL_ID ResultImId, MIL_INT64  ResultType, std::vector<UserType> &UserArrayPtr)
+   {
+   //! If the given MIL data type is not the same as the SrcType, change it to the correct one
+   //! and give a warning.
+   MIL_INT64 InternalTrueDataTypeForStdVector = MilTraits<UserType>::TypeFlag;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(ResultType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+#endif
+
+   ResultType = M_STRIP_HLVLDATATYPE(ResultType) + InternalTrueDataTypeForStdVector;
+
+   MIL_INT InternalNumberOfElementsForStdVector = 0;
+   MimGetResult(ResultImId, M_STRIP_HLVLDATATYPE(ResultType) + M_NB_ELEMENTS + M_TYPE_MIL_INT, &InternalNumberOfElementsForStdVector);
+
+   UserArrayPtr.resize(InternalNumberOfElementsForStdVector);
+
+   if(InternalNumberOfElementsForStdVector > 0)
+      {
+      MimGetResult(ResultImId, ResultType, &UserArrayPtr[0]);
+      }
+   }
+template <typename UserType>
+inline void MFTYPE MimGetResultSingle(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64  ResultType, std::vector<UserType> &UserArrayPtr)
+   {
+   //! If the given MIL data type is not the same as the SrcType, change it to the correct one
+   //! and give a warning.
+   MIL_INT64 InternalTrueDataTypeForStdVector = MilTraits<UserType>::TypeFlag;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(ResultType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResultSingle"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+#endif
+
+   ResultType = M_STRIP_HLVLDATATYPE(ResultType) + InternalTrueDataTypeForStdVector;
+
+   MIL_INT InternalNumberOfElementsForStdVector = 0;
+   MimGetResultSingle(ResultImId, Index1, Index2, M_STRIP_HLVLDATATYPE(ResultType) + M_NB_ELEMENTS + M_TYPE_MIL_INT, &InternalNumberOfElementsForStdVector);
+
+   UserArrayPtr.resize(InternalNumberOfElementsForStdVector);
+
+   if(InternalNumberOfElementsForStdVector > 0)
+      {
+      MimGetResultSingle(ResultImId, Index1, Index2, ResultType, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimDeinterlace.
+inline void MFTYPE MimDeinterlace(MIL_ID                     DeinterlaceContextImId,
+                                  const std::vector<MIL_ID>& SrcImageArrayPtr,
+                                  const std::vector<MIL_ID>& DstImageArrayPtr,
+                                  MIL_INT                    SrcImageCount,
+                                  MIL_INT                    DstImageCount,
+                                  MIL_INT64                  ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(SrcImageCount <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("SrcImageCount parameter must be greater than zero."));
+      }
+   if(DstImageCount <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("DstImageCount parameter must be greater than zero."));
+      }
+   if(SrcImageArrayPtr.empty() || DstImageArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(SrcImageCount > (MIL_INT)SrcImageArrayPtr.size() && SrcImageCount != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("SrcImageCount parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+   if(DstImageCount > (MIL_INT)DstImageArrayPtr.size() && DstImageCount != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("DstImageCount parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(SrcImageCount == M_DEFAULT || SrcImageCount > (MIL_INT)SrcImageArrayPtr.size())
+      {
+      SrcImageCount = (MIL_INT)SrcImageArrayPtr.size();
+      }
+   if(DstImageCount == M_DEFAULT || DstImageCount > (MIL_INT)DstImageArrayPtr.size())
+      {
+      DstImageCount = (MIL_INT)DstImageArrayPtr.size();
+      }
+
+   MimDeinterlace(DeinterlaceContextImId,
+                  &SrcImageArrayPtr[0],
+                  &DstImageArrayPtr[0],
+                  SrcImageCount,
+                  DstImageCount,
+                  ControlFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimGet with two output parameters
+template <typename UserType>
+inline MIL_INT MFTYPE MimGet(MIL_ID                ContextImId,
+                             MIL_INT64             GetType,
+                             MIL_INT               ArraySize,
+                             std::vector<UserType> &Param1Ptr,
+                             std::vector<UserType> &Param2Ptr,
+                             MIL_INT64             ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(GetType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGet"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+#endif
+
+   GetType = M_STRIP_HLVLDATATYPE(GetType) + MilTraits<UserType>::TypeFlag;
+
+   bool InternalArraySizeSpecified = true;
+
+   if(ArraySize == M_DEFAULT)
+      {
+      InternalArraySizeSpecified = false;
+      ArraySize = 0;
+      ArraySize = MimGet(ContextImId, M_STRIP_HLVLDATATYPE(GetType), M_NULL, M_NULL, M_NULL, ControlFlag);
+      }
+
+   if(ArraySize >= 0)
+      {
+      Param1Ptr.resize(ArraySize);
+      Param2Ptr.resize(ArraySize);
+      }
+
+   // Call the original function in case the ArraySize parameter is specified.
+   // It is to allow the MIL function to pop an MIL error if the ArraySize is invalid.
+   // But, if the ArraySize is M_DEFAULT and that M3dmapGet outputs an MIL error,
+   // the following condition will ensure to not recall the same function.
+   if(ArraySize > 0 || InternalArraySizeSpecified)
+      {
+      MIL_INT InternalNbEntriesForStdVector = MimGet(ContextImId,
+                                                  GetType,
+                                                  ArraySize,
+                                                  &Param1Ptr[0],
+                                                  &Param2Ptr[0],
+                                                  ControlFlag);
+
+      if(InternalNbEntriesForStdVector < ArraySize && ArraySize != M_DEFAULT)
+         {
+         Param1Ptr.resize(InternalNbEntriesForStdVector);
+         Param2Ptr.resize(InternalNbEntriesForStdVector);
+         }
+      return InternalNbEntriesForStdVector;
+      }
+   return 0;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimGet with only one output parameter.
+template <typename UserType>
+inline MIL_INT MFTYPE MimGet(MIL_ID                ContextImId,
+                             MIL_INT64             GetType,
+                             MIL_INT               ArraySize,
+                             std::vector<UserType> &Param1Ptr,
+                             void*                 Param2Ptr,
+                             MIL_INT64             ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(GetType) != 0)
+      SafeTypeError(MIL_TEXT("MimGet"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+#endif
+
+   GetType = M_STRIP_HLVLDATATYPE(GetType) + MilTraits<UserType>::TypeFlag;
+
+   if(ArraySize == M_DEFAULT)
+      {
+      ArraySize = 0;
+      ArraySize = MimGet(ContextImId, M_STRIP_HLVLDATATYPE(GetType), M_NULL, M_NULL, M_NULL, ControlFlag);
+      }
+   if(ArraySize >= 0)
+      Param1Ptr.resize(ArraySize);
+   if(ArraySize > 0)
+      {
+      MIL_INT InternalNbEntriesForStdVector = MimGet(ContextImId,
+                                                     GetType,
+                                                     ArraySize,
+                                                     &Param1Ptr[0],
+                                                     (UserType*)Param2Ptr,
+                                                     ControlFlag);
+      if(InternalNbEntriesForStdVector < ArraySize && ArraySize != M_DEFAULT)
+         Param1Ptr.resize(InternalNbEntriesForStdVector);
+
+      return InternalNbEntriesForStdVector;
+      }
+   return 0;
+   }
+
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimGetResult1d.
+template <typename UserType>
+inline void MFTYPE MimGetResult1d(MIL_ID                ResultImId,
+                                  MIL_INT               OffEntry,
+                                  MIL_INT               NbEntries,
+                                  MIL_INT64             ResultType,
+                                  std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(ResultType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult1d"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+   if(NbEntries <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult1d"), MIL_TEXT("NbEntries must be greater than zero."));
+      }
+#endif
+
+   ResultType = M_STRIP_HLVLDATATYPE(ResultType) + MilTraits<UserType>::TypeFlag;
+
+   UserArrayPtr.resize(NbEntries);
+
+   MimGetResult1d(ResultImId,
+                  OffEntry,
+                  NbEntries,
+                  ResultType,
+                  &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimGetResult2d.
+template <typename UserType>
+inline void MimGetResult2d(MIL_ID                ResultImId,
+                           MIL_INT               OffsetX,
+                           MIL_INT               OffsetY,
+                           MIL_INT               SizeX,
+                           MIL_INT               SizeY,
+                           MIL_INT64             ResultType,
+                           MIL_INT64             ControlFlag,
+                           std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(ResultType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult2d"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+   if(SizeX <= 0 || SizeY <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult2d"), MIL_TEXT("SizeX and SizeY must be greater than zero."));
+      }
+#endif
+
+   ResultType = M_STRIP_HLVLDATATYPE(ResultType) + MilTraits<UserType>::TypeFlag;
+
+   UserArrayPtr.resize(SizeX*SizeY);
+
+   MimGetResult2d(ResultImId,
+                  OffsetX,
+                  OffsetY,
+                  SizeX,
+                  SizeY,
+                  ResultType,
+                  ControlFlag,
+                  &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimPut.
+template <typename UserType>
+inline void MFTYPE MimPut(MIL_ID                       ContextImId,
+                          MIL_INT64                    PutType,
+                          MIL_INT                      ArraySize,
+                          const std::vector<UserType>& Param1Ptr,
+                          const std::vector<UserType>& Param2Ptr,
+                          MIL_INT64                    ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(PutType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+   if(ArraySize <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("ArraySize parameter must be greater than zero."));
+      }
+   if(Param1Ptr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(Param1Ptr.size() != Param2Ptr.size())
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(ArraySize > (MIL_INT)Param1Ptr.size() && ArraySize != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("ArraySize parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   PutType = M_STRIP_HLVLDATATYPE(PutType) + MilTraits<UserType>::TypeFlag;
+
+   if(ArraySize == M_DEFAULT || ArraySize > (MIL_INT)Param1Ptr.size())
+      {
+      ArraySize = (MIL_INT)Param1Ptr.size();
+      }
+
+   MimPut(ContextImId,
+          PutType,
+          ArraySize,
+          &Param1Ptr[0],
+          &Param2Ptr[0],
+          ControlFlag);
+   }
+
+#if (!M_MIL_LITE)
+// ----------------------------------------------------------
+// Overloads for std::vector in MimWarpList.
+inline void MFTYPE MimWarpList(MIL_ID                         WarpParamBufId,
+                               MIL_INT64                      TransformType,
+                               MIL_INT                        NumPoints,
+                               const std::vector<MIL_DOUBLE>& SrcCoordXArrayPtr,
+                               const std::vector<MIL_DOUBLE>& SrcCoordYArrayPtr,
+                               std::vector<MIL_DOUBLE>&       DstCoordXArrayPtr,
+                               std::vector<MIL_DOUBLE>&       DstCoordYArrayPtr,
+                               MIL_INT64                      ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumPoints <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimWarpList"), MIL_TEXT("NumPoints parameter must be greater than zero."));
+      }
+   if(SrcCoordXArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MimWarpList"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(SrcCoordXArrayPtr.size() != SrcCoordYArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MimWarpList"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumPoints > (MIL_INT)SrcCoordXArrayPtr.size() && NumPoints != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MimWarpList"), MIL_TEXT("NumPoints parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumPoints == M_DEFAULT || NumPoints > (MIL_INT)SrcCoordXArrayPtr.size())
+      {
+      NumPoints = (MIL_INT)SrcCoordXArrayPtr.size();
+      }
+
+   DstCoordXArrayPtr.resize(NumPoints);
+   DstCoordYArrayPtr.resize(NumPoints);
+
+   MimWarpList(WarpParamBufId,
+               TransformType,
+               NumPoints,
+               &SrcCoordXArrayPtr[0],
+               &SrcCoordYArrayPtr[0],
+               &DstCoordXArrayPtr[0],
+               &DstCoordYArrayPtr[0],
+               ControlFlag);
+   }
+#endif // (!MIL_LITE)
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MxxxStream.
+inline void MFTYPE MimStream(std::vector<MIL_UINT8>  &MemPtrOrFileName,
+                               MIL_ID                 SysId,
+                               MIL_INT64              Operation,
+                               MIL_INT64              StreamType,
+                               MIL_DOUBLE             Version,
+                               MIL_INT64              ControlFlag,
+                               MIL_ID*                McontextIdPtr,
+                               MIL_INT*               SizeByteVarPtr)
+   {
+   MxxxStreamForStdVector(MemPtrOrFileName,
+                          SysId,
+                          Operation,
+                          StreamType,
+                          Version,
+                          ControlFlag,
+                          McontextIdPtr,
+                          SizeByteVarPtr,
+                          MimStream);
+   }
+#endif // defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+
+#if M_MIL_USE_STRING
+/***************************************************************************/
+/* IM MODULE                                                               */
+/***************************************************************************/
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+inline void MFTYPE MimSaveW(const MIL_STRING& FileName, MIL_ID ContextImId, MIL_INT64 ControlFlag)
+   {
+   return MimSaveW(FileName.c_str(), ContextImId, ControlFlag);
+   }
+
+inline MIL_ID MFTYPE MimRestoreW(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_ID* ContextImIdPtr)
+   {
+   return MimRestoreW(FileName.c_str(), SysId, ControlFlag, ContextImIdPtr);
+   }
+#else
+inline void MFTYPE MimSaveA(const MIL_STRING& FileName, MIL_ID ContextImId, MIL_INT64 ControlFlag)
+   {
+   return MimSaveA(FileName.c_str(), ContextImId, ControlFlag);
+   }
+
+inline MIL_ID MFTYPE MimRestoreA(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_ID* ContextImIdPtr)
+   {
+   return MimRestoreA(FileName.c_str(), SysId, ControlFlag, ContextImIdPtr);
+   }
+#endif /* M_MIL_UNICODE_API */
+#else
+inline void MFTYPE MimSave(const MIL_STRING& FileName, MIL_ID ContextImId, MIL_INT64 ControlFlag)
+   {
+   return MimSave(FileName.c_str(), ContextImId, ControlFlag);
+   }
+
+inline MIL_ID MFTYPE MimRestore(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_ID* ContextImIdPtr)
+   {
+   return MimRestore(FileName.c_str(), SysId, ControlFlag, ContextImIdPtr);
+   }
+#endif /* M_MIL_USE_UNICODE */
+#endif /* M_MIL_USE_STRING */
+
+////////////////////////////////////////////////////////////////////////////////
+// MIL_UNIQUE_ID support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+#if M_MIL_USE_SAFE_TYPE
+template <> inline bool MilIsCorrectObjectType<&MimFree>(MIL_INT64 ObjectType)
+   {
+   const MIL_INT64 AllImTypes = M_IM_ALLOC_RESULT_BUFFER_TYPES | M_IM_CONTEXT | M_IM_RESULT_OBJECT_TYPES;
+   return (ObjectType & M_USER_ATTRIBUTE) == 0 && (ObjectType & AllImTypes) != 0;
+   }
+#endif
+
+typedef MIL_UNIQUE_ID<&MimFree> MIL_UNIQUE_IM_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+
+inline MIL_UNIQUE_IM_ID MimAlloc(MIL_ID SysId, MIL_INT64 ContextType, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_IM_ID(MimAlloc(SysId, ContextType, ControlFlag, M_NULL));
+   }
+inline MIL_UNIQUE_IM_ID MimAllocResult(MIL_ID SysId, MIL_INT NbEntries, MIL_INT64 ResultType, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_IM_ID(MimAllocResult(SysId, NbEntries, ResultType, M_NULL));
+   }
+inline MIL_UNIQUE_IM_ID MimRestore(MIL_CONST_TEXT_PTR FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_IM_ID(MimRestore(FileName, SysId, ControlFlag, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_IM_ID MimRestore(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_IM_ID(MimRestore(FileName, SysId, ControlFlag, M_NULL));
+   }
+#endif // M_MIL_USE_STRING
+template <MilFreeFuncType FreeFunc> inline void MimFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+inline void MimDeinterlace(
+      MIL_ID               DeinterlaceContextImId,
+      MilConstArrayIdParam SrcImageArrayPtr      ,
+      MilConstArrayIdParam DstImageArrayPtr      ,
+      MIL_INT              SrcImageCount         ,
+      MIL_INT              DstImageCount         ,
+      MIL_INT64            ControlFlag           )
+   {
+   MimDeinterlace(DeinterlaceContextImId, SrcImageArrayPtr.m_IdArrayPtr, DstImageArrayPtr.m_IdArrayPtr,
+                  SrcImageCount, DstImageCount, ControlFlag);
+   }
+
+inline void MimStream(MilStreamParam     MemPtrOrFileName,
+                      MIL_ID             SysId           ,
+                      MIL_INT64          Operation       ,
+                      MIL_INT64          StreamType      ,
+                      MIL_DOUBLE         Version         ,
+                      MIL_INT64          ControlFlag     ,
+                      MIL_UNIQUE_IM_ID*  ContextImIdPtr  ,
+                      MIL_INT*           SizeByteVarPtr  )
+   {
+   MxxxStreamForMilUniqueId(MemPtrOrFileName, SysId, Operation, StreamType, Version, ControlFlag, ContextImIdPtr, SizeByteVarPtr, MimStream);
+   }
+
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+
+// End of MIL_UNIQUE_ID support
+////////////////////////////////////////////////////////////////////////////////
+
+#endif //__MILIM_H__
diff --git a/Common_Class/Matrox/Include/Mil.h b/Common_Class/Matrox/Include/Mil.h
new file mode 100644
index 0000000..6cb8da4
--- /dev/null
+++ b/Common_Class/Matrox/Include/Mil.h
@@ -0,0 +1,11819 @@
+锘�
+/************************************************************************/
+/*
+*
+* Filename     :  MIL.H
+* Revision     :  10.40.0640
+* Content      :  This file contains the defines necessary to use the
+*                 Matrox Imaging Library "C" user interface.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+
+#ifndef __MIL_H
+#define __MIL_H
+
+/************************************************************************/
+/* Support for old defines name                                         */
+/************************************************************************/
+#ifndef OldDefinesSupport
+   #define OldDefinesSupport     1
+#endif
+
+/* Hide deprecated defines and functions from Intellisense. */
+#ifdef __INTELLISENSE__
+   #undef  OldDefinesSupport
+   #define OldDefinesSupport     0
+   #define M_HIDE_DEPRECATED_FROM_INTELLISENSE 1
+#else
+   #define M_HIDE_DEPRECATED_FROM_INTELLISENSE 0
+#endif
+
+/************************************************************************/
+/* DEFAULT SETUP FLAG */
+/************************************************************************/
+
+/* include set-up instructions (if not specified) */
+#include <milsetup.h>
+
+/* include mil memory allocator when needed */
+#if defined(M_MIL_USE_MEMORY_ALLOCATOR) && M_MIL_USE_MEMORY_ALLOCATOR
+#if M_MIL_USE_RT
+   #include <wince/milmem.h>
+#else
+   #include <milmem.h>
+#endif
+#endif
+
+/************************************************************************/
+/* MIL buffer identifier type                                           */
+/************************************************************************/
+#if M_MIL_USE_64BIT
+#define M_MIL_USE_INT64_ID 1
+#endif
+
+#if defined(M_USE_MBUFBLIT) && !(M_MIL_USE_LINUX)
+#include <memory.h>  // for memset()
+#include <mddraw.h>   // for lpdirectdrawsurface
+#endif
+
+/************************************************************************/
+/* MIL OS support                                                       */
+/************************************************************************/
+#include <milos.h>
+
+
+/************************************************************************/
+/* MIL HOST CURRENT VERSION  (Inquired by MappInquire)                  */
+/************************************************************************/
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_MIL_CURRENT_VERSION             10.00
+   #define M_MIL_CURRENT_INT_VERSION         0x1000
+   #define M_MIL_CURRENT_ASCII_VERSION       "10.00"
+   #define M_MIL_CURRENT_MT_VERSION          MIL_TEXT("10.00")
+
+   #define M_CURRENT_DATAGRAM_VERSION        1000
+   #define M_CURRENT_DATAGRAM_ASCII_VERSION  "10.00"
+   #define M_CURRENT_DATAGRAM_MT_VERSION     MIL_TEXT("10.00")
+#else
+   #define M_MIL_CURRENT_VERSION             10.60
+   #define M_MIL_CURRENT_INT_VERSION         0x1060
+   #define M_MIL_CURRENT_ASCII_VERSION       "10.60"
+   #define M_MIL_CURRENT_MT_VERSION          MIL_TEXT("10.60")
+
+   #define M_CURRENT_DATAGRAM_VERSION        1060
+   #define M_CURRENT_DATAGRAM_ASCII_VERSION  "10.60"
+   #define M_CURRENT_DATAGRAM_MT_VERSION     MIL_TEXT("10.60")
+#endif
+
+#define M_DMILTCP_TRANSPORT_PROTOCOL   MIL_TEXT("dmiltcp")
+#define M_DMILPCIE_TRANSPORT_PROTOCOL  MIL_TEXT("dmilpcie")
+#define M_DMILSHM_TRANSPORT_PROTOCOL   MIL_TEXT("dmilshm")
+#define M_DMILSHMRT_TRANSPORT_PROTOCOL MIL_TEXT("dmilshmrt")
+#define M_DMIL_CLUSTER_PROTOCOL        MIL_TEXT("dmilcluster")
+
+
+/************************************************************************/
+/* MIL DIRECTX SERVICE                                                  */
+/************************************************************************/
+#if M_MIL_USE_WINDOWS && !M_MIL_USE_RT
+   #define M_MIL_USE_DIRECTX_SERVICE 1
+#elif M_MIL_USE_LINUX
+   #define M_MIL_USE_DIRECTX_SERVICE 0
+#else
+   #define M_MIL_USE_DIRECTX_SERVICE 0
+#endif
+
+/************************************************************************
+ * MIL Highlevel processing pack versions
+ * Those version numbers are used only by the highlevel module and must NOT
+ * be confused with M_MIL_CURRENT_VERSION and MappInquire(...M_VERSION...)
+ * The define serves for the MxxxStream function of each highlevel module
+ ************************************************************************/
+// DO NOT CHANGE THOSE VALUES
+#define M_PROC_VERSION_75        7.5
+#define M_PROC_VERSION_75_PP1    7.51
+#define M_PROC_VERSION_80        8.0
+#define M_PROC_VERSION_80_PP1    8.1
+#define M_PROC_VERSION_80_PP2    8.2
+#define M_PROC_VERSION_80_PP3    8.3
+#define M_PROC_VERSION_80_PP4    8.4
+#define M_PROC_VERSION_90        9.0
+#define M_PROC_VERSION_90_PP1    9.1
+#define M_PROC_VERSION_90_PP2    9.2
+#define M_PROC_VERSION_100       10.0
+#define M_PROC_VERSION_100_PP1   10.10
+#define M_PROC_VERSION_100_PP2   10.20
+#define M_PROC_VERSION_100_PP3   10.30
+#define M_PROC_VERSION_100_SP4   10.40
+
+#define M_PROC_CURRENT_VERSION   M_PROC_VERSION_100_SP4
+
+#if defined(M_MIL_USE_INT64_ID) && M_MIL_USE_INT64_ID
+   typedef  MIL_INT64  MIL_ID;
+#else
+   typedef  MIL_INT32  MIL_ID;
+#endif
+
+/************************************************************************/
+/* MIL HighLevel Context File Data type                                 */
+/************************************************************************/
+#define M_MIL_USE_INT64_DATA_FILES 0
+#if M_MIL_USE_INT64_DATA_FILES
+   typedef MIL_INT64 FILE_DATA_TYPE;
+#else
+   typedef MIL_INT32 FILE_DATA_TYPE;
+#endif
+
+
+/************************************************************************/
+/* General default parameters (may be bit encoded)                      */
+/************************************************************************/
+#define M_NULL                                           0
+
+#if M_MIL_USE_LINUX && M_MIL_USE_64BIT
+   #define MAKE_INT64(I)        (I ## L)
+   #define MAKE_UINT64(I)       (I ## LU)
+#elif M_MIL_USE_LINUX || (defined(__GNUC__) && __GNUC__)
+   #define MAKE_INT64(I)        (I ## LL)
+   #define MAKE_UINT64(I)       (I ## LLU)
+#elif M_MIL_USE_WINDOWS
+   #define MAKE_INT64(I)        (I##I64)
+   #define MAKE_UINT64(I)       (I##Ui64)
+#else
+   #define MAKE_INT64(I)        (I)
+   #define MAKE_UINT64(I)       (I)
+#endif
+
+// Make constant value
+#if M_MIL_USE_64BIT
+   #define MIL_MAKE_CONST(X32, X64) (MAKE_INT64(X64))
+#else
+   #define MIL_MAKE_CONST(X32, X64) (X32)
+#endif
+
+/*Pseudo IDs*/
+#define M_PSEUDO_ID                                   0x00800000L
+#define M_DEFAULT_LUT                                 (M_PSEUDO_ID+1)
+#define M_PSEUDO_LUT                                  (M_PSEUDO_ID+2)
+#define M_ALL_DISPLAYS                                (M_PSEUDO_ID+3)
+#define M_INDIAN_PATTERN                              (M_PSEUDO_ID+4)   // Use in Indian display scheme
+#define M_TRANSIENT_PATTERN                           (M_PSEUDO_ID+5)   // Use in Transient display scheme
+#define M_DISPLAY_SERVICE                             (M_PSEUDO_ID+6)   // Used for control/inquires not specific to one display.
+#define M_DEFAULT_ERROR_CONTEXT                       (M_PSEUDO_ID+7)   // Used as a pseudo func ID for MfuncErrorReport.
+#define M_DEFAULT_UNIFORM_CALIBRATION                 (M_PSEUDO_ID+8)   // Used as a pseudo calibration object ID
+#define M_DIRECTX_SERVICE                             (M_PSEUDO_ID+9)   // Used for control/inquires related to video device of DirectX.
+#define M_DEFAULT_EXTENDED_DEPTH_OF_FIELD_CONTEXT     (M_PSEUDO_ID+10)  // Used as a pseudo registration extended depth of field with default controls.
+#define M_IDENTITY_MATRIX                             (M_PSEUDO_ID+11)  // Used as a pseudo matrix of type identity
+
+#if(MIL_COMPILE_VERSION >= 1040)
+#define M_COLORMAP_JET                                (M_PSEUDO_ID+12)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_HOT                                (M_PSEUDO_ID+13)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_HUE                                (M_PSEUDO_ID+14)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_SPECTRUM                           (M_PSEUDO_ID+15)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#endif
+#define M_MULTIPLE_IDS                                (M_PSEUDO_ID+17)  // Used by MbufInquireContainer
+
+#define M_COLORMAP_TURBO                              (M_PSEUDO_ID+16)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+
+#define M_XY_PLANE                                    (M_PSEUDO_ID+18)  //Used as a pseudo Id for plane geometry Z=0
+#define M_WHOLE_SCENE                                 (M_PSEUDO_ID+19)  //Used as a pseudo box that contains the entire 3d display scene
+
+#define M_COLORMAP_DISTINCT_256                       (M_PSEUDO_ID+20)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+
+#define M_3DIM_PSEUDO_ID                              (0x00200000L|M_PSEUDO_ID)
+#define M_ID_OFFSET_OF_DEFAULT_KERNEL                 (0x00100000L|M_PSEUDO_ID)
+/*Reserve 256 values*/
+/*#define M_ID_OFFSET_OF_DEFAULT_KERNEL                 (0x00100000L|M_PSEUDO_ID + 255)*/
+
+#define M_IS_PSEUDO_ID(X)                             (X&M_PSEUDO_ID)
+#define M_IS_VIDEO_DEVICE_INDEX(a)                    ((a>=M_DEV0) && (a<M_MAX_VIDEO_DEVICE))        
+#define M_IS_VIDEO_DEVICE_ID(a)                       ((a>=M_VIDEO_DEVICE_ID) && (a<M_VIDEO_DEVICE_ID+M_MAX_VIDEO_DEVICE))
+#define M_VIDEO_DEVICE_INDEX_FROM_ID(a)               ((M_IS_VIDEO_DEVICE_ID(a)) ? ((a) - M_VIDEO_DEVICE_ID) : M_INVALID)
+#define M_MAKE_VIDEO_DEVICE_ID(a)                     (M_IS_VIDEO_DEVICE_INDEX(a) ? (M_VIDEO_DEVICE_ID+a) : M_NULL)
+#define M_OVERSCAN_DISABLE                            0x00080000L
+
+
+//////////////////////////////////////////////////////////////////////////////
+// MIL_ID manipulation macros
+// Id use the following representation:
+// SNNN NNNN PRRR XXXX XXXX XXXX XXXX XXXX
+//
+// where
+//    S: Sign bit (can't be used)
+//    N: Cluster node
+//    P: Pseudo-id
+//    O: ONL system number
+//    B: ONL board number
+//    X: Id
+   
+#define M_CLUSTER_NODE_MASK            0x7F000000                 
+#define M_DEFAULT_CLUSTER_NODE_VALUE   0x7F000000                 
+   
+  
+#define M_CLUSTER_NODE_SHIFT     24                               
+#define M_NAKED_ID_MASK          0xFFFFF                          
+
+#define M_MAKE_ID(NakedId, ClusterNode)       ((((ClusterNode) << M_CLUSTER_NODE_SHIFT) & M_CLUSTER_NODE_MASK) | ((NakedId) & M_NAKED_ID_MASK))
+#define M_MAKE_DEFAULT_ID(NakedId)              M_MAKE_ID((NakedId), (M_DEFAULT_CLUSTER_NODE_VALUE >> M_CLUSTER_NODE_SHIFT))
+
+#define M_FALSE                                       0L
+#define M_NO                                          0L
+#define M_OFF                                         0L
+#define M_IN_PROGRESS                                 0L
+#define M_OUTSIDE                                     0L
+#define M_INSIDE                                      1L
+#define M_FINISHED                                    1L
+#define M_TRUE                                        1L
+#define M_YES                                         1L
+#define M_ON                                          1L
+#define M_WAIT                                        1L
+#define M_CREATE                                      M_YES
+#define M_FREE                                        0x00020000
+#define M_UNICODE_CLIENT                              0x01000000L
+#define M_ASCII_CLIENT                                0x04000000L
+#define M_QUIET                                       0x08000000L
+#define M_DEFAULT                                     0x10000000L
+#define M_VALID                                       0x00000001L
+#define M_INVALID                                     -1
+#define M_UNKNOWN                                     -9999L
+#define M_CLEAR                                       0x00000001L
+#define M_NO_CLEAR                                    0x00000002L
+#define M_ENABLE                                      -9997L
+#define M_DISABLE                                     -9999L
+#define M_CONFIG                                      0x20000000L
+#define M_LOCAL                                       0x01000000	// Also defined in milmeas.h
+#define M_REMOTE                                      0x00000000
+#define M_WEB                                         0x00800000L // Also defined in mildisplay.h
+#define M_CUSTOM                                      2
+#define M_OFFICIAL                                    3
+#define M_SKIP_CHECK                                  2
+#define M_OS_CONTROLLED                               -9990L
+#define M_OS_DEFAULT                                  -9991L
+#define M_WITH_COMPENSATION                           2
+#define M_FIRST                                       0x10000000
+#define M_LAST                                        0x20000000L
+
+// Offset for Web publishing
+#define M_MAX_WEBSOCKET_SERVER                          5
+#define M_DEFAULT_WEB_OFFSET                            0
+#define M_USER1_WEB_OFFSET                              1
+#define M_USER2_WEB_OFFSET                              2
+#define M_FB_WEB_OFFSET                                 3
+#define M_DA_WEB_OFFSET                                 4
+
+// Control values for M_TEST_IMAGE
+#define M_GREY_DIAGONAL_RAMP                          2
+#define M_GREY_DIAGONAL_RAMP_MOVING                   3
+ 
+
+#define M_UNINITIALIZED                               0x0badbad0
+#define M_STATUS_UNINITIALIZED                        0x0bad      // for CallStatus in Datagram
+
+#define M_KEEP_IN_QUEUE                               0x00000100L
+#define M_OVERWRITE                                   1861L       // Already defined in mil3dim.h
+#define M_QUEUE                                       0x00000400
+
+#define M_NO_TIMEOUT                                  0x00000800
+#define M_BUFFER_TOO_SMALL                            1
+#define M_SUCCESS                                     0x00000000L // Already defined in milreg.h, milcolor.h
+
+#define M_ALL                                         0x40000000L
+#define M_ANY                                         0x11000000L
+#define M_SAME                                                -1L
+#define M_INVALID_MDID                                0x40000000L
+#define M_ALWAYS                                               0L  // defined in Milblob.h
+#define M_FOREVER                                             -1   // Same as in mildrv.h
+
+// Macro used to process M_DEFAULT
+#define PROCESS_M_DEFAULT(VALUE, REPLACEMENT_VALUE) if((VALUE) == M_DEFAULT) {(VALUE) = (REPLACEMENT_VALUE);}
+
+// Macro for M_INDSIDE & M_OUTSIDE
+#define M_IS_MOUSE_OUTSIDE(v) (((M_OUTSIDE == v) || (M_ENABLE == v))? M_YES: M_NO)
+#define M_IS_MOUSE_INSIDE(v) ((M_INSIDE == v)? M_YES: M_NO)
+
+#if MIL_COMPILE_VERSION < 1010
+#define M_MAX_INSTALLED_SYSTEMS 16
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_MAX_INSTALLED_SYSTEMS 16
+#endif
+
+#define M_MAX_SYSTEMS_PER_TYPE         16
+#if MIL_COMPILE_VERSION >= 1010
+#define M_MAX_INSTALLED_SYSTEM_TYPES   64
+#else
+#define M_MAX_INSTALLED_SYSTEM_TYPES   16
+#endif
+#define M_MAX_FINGERPRINTS_PER_TYPE M_MAX_SYSTEMS_PER_TYPE
+
+/************************************************************************/
+/* MIL_UUID Data type                                                    */
+/************************************************************************/
+
+#if defined(_MSC_VER) && (_MSC_VER < 1910)
+#ifdef __cplusplus
+#define MIL_UUID_C_INLINE __forceinline
+#else
+   #define MIL_UUID_C_INLINE static __forceinline
+#endif
+#else
+#ifdef __cplusplus
+#define MIL_UUID_C_INLINE inline
+#else
+   #define MIL_UUID_C_INLINE static inline
+#endif
+#endif
+
+typedef struct
+   {
+   MIL_UINT32 Data1;
+   MIL_UINT16 Data2;
+   MIL_UINT16 Data3;
+   MIL_UINT8  Data4[8];
+   } __MIL_WGUID;
+
+typedef struct
+   {
+   union
+      {
+      MIL_UINT64  U64s[2];
+      __MIL_WGUID MilGuid;
+      MIL_UINT8   Bytes[16];
+      } Data;
+   } MIL_UUID;
+
+MIL_UUID_C_INLINE MIL_UUID MIL_MAKE_DEFAULT_UUID()
+   {
+   MIL_UUID DefaultMilUuid;
+   DefaultMilUuid.Data.U64s[0] = M_DEFAULT;
+   DefaultMilUuid.Data.U64s[1] = M_DEFAULT;
+   return DefaultMilUuid;
+   }
+
+MIL_UUID_C_INLINE MIL_UUID MIL_MAKE_NULL_UUID()
+   {
+   MIL_UUID NullKey;
+   NullKey.Data.U64s[0] = 0;
+   NullKey.Data.U64s[1] = 0;
+   return NullKey;
+   }
+
+MIL_UUID_C_INLINE int _INT_MIL_COMPARE_UUID(MIL_UUID A, MIL_UUID B)
+   { return (int) ((A.Data.U64s[0] == B.Data.U64s[0]) && (A.Data.U64s[1] == B.Data.U64s[1])); }
+
+
+#define M_DEFAULT_UUID MIL_MAKE_DEFAULT_UUID()
+#define M_NULL_UUID MIL_MAKE_NULL_UUID()
+
+#ifdef __cplusplus
+
+#define M_COMPARE_MIL_UUID(A, B) ((bool)(_INT_MIL_COMPARE_UUID((A), (B)) != 0))
+#define M_IS_DEFAULT_UUID(A) ((bool)(_INT_MIL_COMPARE_UUID((A), M_DEFAULT_UUID) != 0))
+#define M_IS_NULL_UUID(A) ((bool)(_INT_MIL_COMPARE_UUID((A), M_NULL_UUID) != 0))
+
+inline bool operator==(const MIL_UUID& A, const MIL_UUID& B) { return  M_COMPARE_MIL_UUID(A, B); }
+inline bool operator!=(const MIL_UUID& A, const MIL_UUID& B) { return !M_COMPARE_MIL_UUID(A, B); }
+inline bool operator< (const MIL_UUID& A, const MIL_UUID& B)
+   {
+   if(A.Data.U64s[0] < B.Data.U64s[0]) { return true; }
+   else if(A.Data.U64s[0] > B.Data.U64s[0]) { return false; }
+   return (A.Data.U64s[1] < B.Data.U64s[1]);
+   }
+
+#else // 'C'
+
+#define M_COMPARE_MIL_UUID(A, B)    _INT_MIL_COMPARE_UUID((A), (B))
+#define M_IS_DEFAULT_UUID(A)        _INT_MIL_COMPARE_UUID((A), M_DEFAULT_UUID)
+#define M_IS_NULL_UUID(A)           _INT_MIL_COMPARE_UUID((A), M_NULL_UUID)
+
+#endif //__cplusplus
+
+
+/************************************************************************/
+/* Board generic information.                                           */
+/************************************************************************/
+#define M_RS170                                       0x00000001L
+#define M_NTSC                                        0x00000002L
+#define M_CCIR                                        0x00000003L
+#define M_PAL                                         0x00000004L
+#define M_NTSC_RGB                                    0x00000005L
+#define M_PAL_RGB                                     0x00000006L
+#define M_SECAM_RGB                                   0x00000007L
+#define M_SECAM                                       0x00000008L
+/* Reserve next 2 values                       from   0x00000009L*/
+/*                                             to     0x0000000AL*/
+
+/************************************************************************/
+/* Iris Product select the type of lighting environment                 */
+/************************************************************************/
+
+#define M_LIGHT_INDOOR                                0x0L
+#define M_LIGHT_OUTDOOR                               0x1L
+
+/************************************************************************/
+/* PCIe Product SysInquire for M_PCIE_SPEED and M_PCIE_SPEED_MAX        */
+/************************************************************************/
+
+#define M_GEN1                                        0x1L
+#define M_GEN2                                        0x2L
+#define M_GEN3                                        0x3L
+#define M_INVALID                                     -1
+
+
+/************************************************************************/
+/* Buffer Type and SizeBit                                              */
+/************************************************************************/
+// #define M_SIZE_BIT_1                               0x00000001 
+// #define M_SIZE_BIT_8                               0x00000008 
+// #define M_SIZE_BIT_16                              0x00000010 
+// #define M_SIZE_BIT_32                              0x00000020 
+// #define M_SIZE_BIT_64                              0x00000040 
+#define M_SIZE_BIT_MASK                               0x000000FFL
+
+#define M_NO_TYPE                                     0x00100000L
+#define M_ANY_TYPE                                    0x10000000L    // Represents any type, including signed and unsigned 
+#define M_ANY_SIGN                                    0x04000000L
+#define M_TYPE_META_FLAGS                             (M_ANY_SIGN+M_ANY_TYPE+M_NO_TYPE)
+
+#define M_UNSIGNED                                    0x00000000L
+#define M_SIGNED                                      0x08000000L
+#define M_FLOAT                                      (0x40000000L | M_SIGNED)
+#define M_EXACT_IN_DOUBLE                             0x80000000L
+#define M_PFNC                                        MAKE_INT64(0x100000000)
+#define M_PFNC_COMPACT                                (0x20000000)
+
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_PFNC_TO_TYPE(X)                             (M_PFNC_COMPACT | ((X) & 0xFFFF))
+#define M_IS_PFNC_TYPE(X)                             (((((X) & M_PFNC_COMPACT) == M_PFNC_COMPACT) && (((X) & ~M_PFNC_TO_TYPE(0xFFFF)) == 0)) || (((X) & 0xFFFFFFFF00000000) == M_PFNC))
+#else
+//#define M_PFNC_TO_TYPE(X)                             (M_PFNC | (X))
+//#define M_IS_PFNC_TYPE(X)                             (((X) & M_PFNC) == M_PFNC)
+#define M_PFNC_TO_TYPE(X)                             (M_PFNC_COMPACT | ((X) & 0xFFFF))
+#define M_IS_PFNC_TYPE(X)                             (((((X) & M_PFNC_COMPACT) == M_PFNC_COMPACT) && (((X) & ~M_PFNC_TO_TYPE(0xFFFF)) == 0)) || (((X) & 0xFFFFFFFF00000000) == M_PFNC))
+#endif
+#define M_PFNC_TO_TYPE_AS_IS(X)                       ((X) | M_PFNC)
+
+
+#define M_TYPE_MASK                                   0x7FFFFF00L
+#define M_TYPE_SIGN_MASK                              (M_ANY_SIGN|M_UNSIGNED|M_SIGNED)
+#define M_COMPLETE_TYPE                               (M_TYPE_MASK|M_SIZE_BIT_MASK)
+
+/************************************************************************/
+/* MMX related                                                          */
+/************************************************************************/
+#define M_READ_PREFETCH_EXTRA_BYTES                   32
+
+// Kept for backward compatibility.
+#define M_MMX_EXTRA_BYTES                             M_READ_PREFETCH_EXTRA_BYTES
+
+// Default values for memory allocators. Can be overridden at run-
+// time by any OS-specific version of the MIL memory allocator
+#define M_MEMORY_ALLOC_PRE_PADDING_VALUE             M_READ_PREFETCH_EXTRA_BYTES
+#define M_MEMORY_ALLOC_POST_PADDING_VALUE            M_READ_PREFETCH_EXTRA_BYTES
+#define M_MEMORY_ALLOC_PITCH_BYTE_VALUE              1
+#define M_MEMORY_ALLOC_ALIGNMENT_VALUE               128
+
+/************************************************************************/
+/* Non cachable related                                                 */
+/************************************************************************/
+#define M_NO_ALIGNMENT                               -1
+#define M_4K_ALIGNMENT                                4096
+
+
+/************************************************************************/
+/* Multi thread                                                         */
+/************************************************************************/
+#define M_HOST_THREAD                                 0x00000002L
+#define M_MIL_THREAD                                  0x00000004L
+#define M_STATE                                       0x00000008L
+#define M_SIGNALED                                    0x00000010L
+#define M_NOT_SIGNALED                                0x00000020L
+#define M_THREAD_DETACH                               0x00000080L
+#define M_AUTO_RESET                                  0x00002000L
+#define M_MANUAL_RESET                                0x00004000L
+
+#define M_IDLE                                                 1L
+#define M_LOWEST                                               6L
+#define M_BELOW_NORMAL                                         7L
+#define M_NORMAL                                               8L
+#define M_ABOVE_NORMAL                                         9L
+#define M_HIGHEST                                             10L
+#define M_TIME_CRITICAL                                       15L
+
+#define M_THREAD_PRIORITY                             1019L
+#define M_EVENT_ALLOC                                 1700L
+#define M_EVENT_FREE                                  1701L
+#define M_EVENT_SEND                                  1702L
+#define M_EVENT_CONTROL                               1703L
+
+#define M_DEFAULT                                     0x10000000L
+#define M_THREAD_WAIT                                 0x01000000L
+#define M_EVENT_WAIT                                  0x20000000L
+#define M_EVENT_STATE                                 1706L
+#define M_EVENT_SET                                   1707L
+
+#define M_THREAD_ALLOC                                1800L
+#define M_THREAD_FREE                                 1801L
+#define M_THREAD_CONTROL                              1803L
+#define M_THREAD_MODE                                 1804L
+#define M_THREAD_IO_MODE                              1805L
+
+/************************************************************************/
+/* Inter-module defines                                                 */
+/************************************************************************/
+#define M_INTERMOD_MASK                               MAKE_INT64(0xFFFFFFFC00000000)
+#define M_STRIP_INTERMOD_BITS(X)                      ((X) & ~M_INTERMOD_MASK)
+#define M_GET_INTERMOD_BITS(X)                        ((X) & M_INTERMOD_MASK)
+
+#define M_HLVLDATATYPE_MASK                           MAKE_INT64(0x000000F000000000)
+#define M_TYPE_CHAR                                   MAKE_INT64(0x0000001000000000) // used in highlvl modules
+#define M_TYPE_MIL_INT16                              MAKE_INT64(0x0000002000000000) // used in highlvl modules
+#define M_TYPE_SHORT                                  M_TYPE_MIL_INT16               // used in highlvl modules
+#define M_TYPE_MIL_INT32                              MAKE_INT64(0x0000003000000000) // used in highlvl modules and mil
+#define M_TYPE_FLOAT                                  MAKE_INT64(0x0000004000000000) // used in highlvl modules
+#define M_TYPE_DOUBLE                                 MAKE_INT64(0x0000005000000000) // used in highlvl modules and mil
+#define M_TYPE_MIL_ID                                 MAKE_INT64(0x0000006000000000) // used in highlvl modules, drivers and mil
+#define M_TYPE_STRING                                 MAKE_INT64(0x0000007000000000) // used in mil, dmil, drivers, highlvl modules
+#define M_TYPE_MIL_INT64                              MAKE_INT64(0x0000008000000000) // Type switch for 32/64 bits support in highlvl modules
+#define M_TYPE_MIL_TEXT                               MAKE_INT64(0x0000009000000000) // used in highlvl modules
+#define M_TYPE_MIL_UINT8                              MAKE_INT64(0x000000A000000000) // used in highlvl modules
+#define M_TYPE_MIL_UUID                               MAKE_INT64(0x000000B000000000) // used in highlvl modules
+
+#define M_STRIP_HLVLDATATYPE(X)                       ((X) & ~M_HLVLDATATYPE_MASK)
+#define M_GET_HLVLDATATYPE(X)                         ((X) & M_HLVLDATATYPE_MASK)
+
+#define M_INTERMOD_VALUE_MASK                         MAKE_INT64(0x00000F0000000000)
+#define M_MIN_VALUE                                   MAKE_INT64(0x0000010000000000)
+#define M_MAX_VALUE                                   MAKE_INT64(0x0000020000000000)
+#define M_DEFAULT_VALUE                               MAKE_INT64(0x0000030000000000)
+#if OldDefinesSupport
+#define M_INCREMENT                                   MAKE_INT64(0x0000040000000000)   // Deprecated for MdigInquire/ControlFeature() use M_FEATURE_INCREMENT
+MIL_DEPRECATED(M_INCREMENT, 1000)                     // New Control Feature API Replaced by M_FEATURE_INCREMENT
+#endif
+
+#define M_STRING_SIZE                                 MAKE_INT64(0x0000050000000000)
+#define M_FEATURE_USER_ARRAY_SIZE_BITS                MAKE_INT64(0x0000060000000000)
+#define M_STRING_LENGTH                               M_STRING_SIZE
+#define M_NB_ELEMENTS                                 MAKE_INT64(0x0000070000000000)
+#define M_GET_INTERMOD_VALUE_BITS(X)                  ((X) &  M_INTERMOD_VALUE_MASK)
+#define M_STRIP_INTERMOD_VALUE_BITS(X)                ((X) & ~M_INTERMOD_VALUE_MASK)
+#define M_STRING_SIZE_BIT_SET(X)                      ((M_GET_INTERMOD_VALUE_BITS(X) == M_STRING_SIZE) ? M_TRUE : M_FALSE)
+#define M_NB_ELEMENTS_BIT_SET(X)                      ((M_GET_INTERMOD_VALUE_BITS(X) == M_NB_ELEMENTS) ? M_TRUE : M_FALSE)
+#define M_STRIP_STRING_SIZE_BIT(X)                    M_STRIP_INTERMOD_VALUE_BITS(X)
+#define M_STRIP_NB_ELEMENTS_BIT(X)                    M_STRIP_INTERMOD_VALUE_BITS(X)
+#define M_FEATURE_USER_ARRAY_SIZE_BIT_SET(X)          ((M_GET_INTERMOD_VALUE_BITS(X) == M_FEATURE_USER_ARRAY_SIZE_BITS) ? M_TRUE : M_FALSE)
+#define M_STRIP_FEATURE_USER_ARRAY_SIZE_BITS(X)       M_STRIP_INTERMOD_VALUE_BITS(X)
+
+#if OldDefinesSupport
+#define M_STRING_ARRAY_SIZE_BIT                       M_FEATURE_USER_ARRAY_SIZE_BITS
+#define M_STRING_ARRAY_SIZE_BIT_SET(X)                M_FEATURE_USER_ARRAY_SIZE_BIT_SET(X)
+#define M_STRIP_STRING_ARRAY_SIZE_BIT(X)              M_STRIP_FEATURE_USER_ARRAY_SIZE_BITS(X)
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_BIT, 1060)         // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_BITS
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_BIT_SET, 1060)     // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_BIT_SET
+MIL_DEPRECATED(M_STRIP_STRING_ARRAY_SIZE_BIT, 1060)   // New Control Feature API Replaced by M_STRIP_FEATURE_USER_ARRAY_SIZE_BITS
+#endif
+
+#define M_INTERMOD_STATE_MASK                         MAKE_INT64(0x0000F00000000000)
+#define M_IS_SET_TO_DEFAULT                           MAKE_INT64(0x0000100000000000)
+#define M_AVAILABLE                                   MAKE_INT64(0x0000400000000000)
+#define M_SUPPORTED                                   MAKE_INT64(0x0000800000000000)
+#define M_GET_INTERMOD_STATE_BITS(X)                  ((X) &  M_INTERMOD_STATE_MASK)
+#define M_STRIP_INTERMOD_STATE_BITS(X)                ((X) & ~M_INTERMOD_STATE_MASK)
+
+#define M_INQ_COMBOFLAGS_MASK                         (M_HLVLDATATYPE_MASK | M_INTERMOD_VALUE_MASK | M_INTERMOD_STATE_MASK | M_DEFAULT)
+#define M_GET_INQ_COMBOFLAGS(X)                       ((X) &  M_INQ_COMBOFLAGS_MASK)
+#define M_STRIP_INQ_COMBOFLAGS(X)                     ((X) & ~M_INQ_COMBOFLAGS_MASK)
+
+#define M_CLIENT_TEXT_ENCODING                        MAKE_INT64(0x0001000000000000)
+#define M_CLIENT_ASCII_ENCODING                       MAKE_INT64(0x0001000000000000)
+
+#define M_CLIENT_ASCII_ENCODING_SET(X)                ((((X) & M_CLIENT_TEXT_ENCODING) == M_CLIENT_ASCII_ENCODING) ? true : false)
+#define M_STRIP_CLIENT_TEXT_ENCODING(X)               ((X) & ~M_CLIENT_TEXT_ENCODING)
+#define M_GET_CLIENT_TEXT_ENCODING(X)                 ((X) & M_CLIENT_TEXT_ENCODING)
+
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#if M_MIL_USE_UNICODE && !M_MIL_UNICODE_API
+#define     M_CLIENT_ENCODING       M_CLIENT_ASCII_ENCODING
+#else
+#define     M_CLIENT_ENCODING       0
+#endif
+#else // MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if M_MIL_USE_LINUX
+#define     M_CLIENT_ENCODING       M_CLIENT_UTF8_ENCODING
+#else // M_MIL_USE_LINUX
+#if M_MIL_UNICODE_API
+#define     M_CLIENT_ENCODING       M_CLIENT_UTF16_ENCODING
+#else // M_MIL_UNICODE_API
+#define     M_CLIENT_ENCODING       M_CLIENT_ASCII_ENCODING
+#endif   // M_MIL_UNICODE_API
+#endif   // M_MIL_USE_LINUX
+#endif   // MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_CLIENT_ASCII_MODE   M_CLIENT_ENCODING
+#define M_STRIP_CLIENT_ASCII_MODE_BIT(X)              M_STRIP_CLIENT_TEXT_ENCODING(X)
+#define M_CLIENT_ASCII_MODE_BIT_SET(X)                ((((X) & M_CLIENT_ASCII_MODE) == M_CLIENT_ASCII_MODE) ? true : false)
+#endif
+
+/************************************************************************/
+/* MsysAlloc()                                                          */
+/************************************************************************/
+/* System type */
+#define M_DEFAULT_HOST                                M_MAKE_DEFAULT_ID(1)
+#define M_DEV                                         0L
+#define M_DEV0                                        0L
+#define M_DEV1                                        1L
+#define M_DEV2                                        2L
+#define M_DEV3                                        3L
+#define M_DEV4                                        4L
+#define M_DEV5                                        5L
+#define M_DEV6                                        6L
+#define M_DEV7                                        7L
+#define M_DEV8                                        8L
+#define M_DEV9                                        9L
+#define M_DEV10                                       10L
+#define M_DEV11                                       11L
+#define M_DEV12                                       12L
+#define M_DEV13                                       13L
+#define M_DEV14                                       14L
+#define M_DEV15                                       15L
+#define M_DEV16                                       16L
+#define M_DEV17                                       17L
+#define M_DEV18                                       18L
+#define M_DEV19                                       19L
+#define M_DEV20                                       20L
+#define M_DEV21                                       21L
+#define M_DEV22                                       22L
+#define M_DEV23                                       23L
+#define M_DEV24                                       24L
+#define M_DEV25                                       25L
+#define M_DEV26                                       26L
+#define M_DEV27                                       27L
+#define M_DEV28                                       28L
+#define M_DEV29                                       29L
+#define M_DEV30                                       30L
+#define M_DEV31                                       31L
+#define M_DEV32                                       32L
+#define M_DEV33                                       33L
+#define M_DEV34                                       34L
+#define M_DEV35                                       35L
+#define M_DEV36                                       36L
+#define M_DEV37                                       37L
+#define M_DEV38                                       38L
+#define M_DEV39                                       39L
+#define M_DEV40                                       40L
+#define M_DEV41                                       41L
+#define M_DEV42                                       42L
+#define M_DEV43                                       43L
+#define M_DEV44                                       44L
+#define M_DEV45                                       45L
+#define M_DEV46                                       46L
+#define M_DEV47                                       47L
+#define M_DEV48                                       48L
+#define M_DEV49                                       49L
+#define M_DEV50                                       50L
+#define M_DEV51                                       51L
+#define M_DEV52                                       52L
+#define M_DEV53                                       53L
+#define M_DEV54                                       54L
+#define M_DEV55                                       55L
+#define M_DEV56                                       56L
+#define M_DEV57                                       57L
+#define M_DEV58                                       58L
+#define M_DEV59                                       59L
+#define M_DEV60                                       60L
+#define M_DEV61                                       61L
+#define M_DEV62                                       62L
+#define M_DEV63                                       63L
+
+#define M_GENTL_PRODUCER_BIT                          MIL_MAKE_CONST(0x80000000, 0x0000000080000000)
+#define M_GENTL_PRODUCER_MASK                         MIL_MAKE_CONST(0x7F000000, 0x000000007F000000)
+#define M_GENTL_PRODUCER_SHIFT                        24
+#define M_GENTL_PRODUCER(N)                           (M_GENTL_PRODUCER_BIT | ((N  << M_GENTL_PRODUCER_SHIFT) & M_GENTL_PRODUCER_MASK))
+
+#define M_SYSTEM_TYPE_NONE                            0L
+#define M_SYSTEM_HOST_TYPE                            1000L //Needs to be the highest value
+#define M_SYSTEM_RADIENT_TYPE                         13L
+#define M_SYSTEM_RADIENTCXP_TYPE                      14L
+#define M_SYSTEM_RADIENTCLHS_TYPE                     15L
+#define M_SYSTEM_RADIENTPRO_TYPE                      16L
+#define M_SYSTEM_RADIENTEVCL_TYPE                     17L
+#define M_SYSTEM_RAPIXOCXP_TYPE                       18L
+#define M_SYSTEM_RAPIXOCL_TYPE                        19L
+#define M_SYSTEM_1394_TYPE                            22L
+#define M_SYSTEM_MMX_TYPE                             23L
+#define M_SYSTEM_SSE_TYPE                             24L
+/* Free for future system type                        25L*/
+#define M_SYSTEM_SSE2_TYPE                            26L
+#define M_SYSTEM_AMD_3DNOW_TYPE                       27L
+#define M_SYSTEM_AMD_MMX_EXT_TYPE                     28L
+#define M_SYSTEM_AMD_3DNOW_EXT_TYPE                   29L
+/* Free for future system type                  from  31L*/
+/*                                                to  36L*/
+#define M_SYSTEM_IRIS_TYPE                            37L
+#define M_SYSTEM_CRONOSPLUS_TYPE                      38L
+#define M_SYSTEM_MORPHIS_TYPE                         39L
+#define M_SYSTEM_IRIS_GTR_TYPE                        40L
+#define M_SYSTEM_NEXIS3_TYPE                          41L
+#define M_SYSTEM_SOLIOS_TYPE                          42L
+#define M_SYSTEM_SSE3_TYPE                            43L
+#define M_SYSTEM_VIO_TYPE                             44L
+// !!!ATTENTION!!! Value used for display             45 - 56 See Below
+#define M_SYSTEM_NEXIS_TYPE                           57L
+#define M_SYSTEM_GPU_TYPE                             58L
+#define M_SYSTEM_MORPHISQXT_TYPE                      59L
+#define M_SYSTEM_GIGE_VISION_TYPE                     60L
+#define M_SYSTEM_SSE4_TYPE                            62L
+#define M_SYSTEM_USB3_VISION_TYPE                     63L
+#define M_SYSTEM_MP_TYPE                              64L
+#define M_SYSTEM_GENTL_TYPE                           65L
+#define M_SYSTEM_CONCORD_1394_TYPE                    M_SYSTEM_1394_TYPE
+#define M_SYSTEM_ORION_UHD_TYPE                       66L
+#define M_SYSTEM_CLARITY_UHD_TYPE                     66L
+#define M_SYSTEM_IRIS_GT_TYPE                         67L
+#define M_SYSTEM_ORION_HD_TYPE                        68L
+#define M_SYSTEM_NEXIS2_TYPE                          69L
+#define M_SYSTEM_HDDVR_TYPE                           71L
+#define M_SYSTEM_MATROXCOMPRESS_TYPE                  72L
+#define M_SYSTEM_AVX_TYPE                             73L
+#define M_SYSTEM_AVX2_TYPE                            74L
+#define M_SYSTEM_INDIO_TYPE                           75L
+#define M_SYSTEM_CONCORD_POE_TYPE                     76L
+#define M_SYSTEM_AVX512_TYPE                          77L
+
+
+//System Type Value used for display
+#define M_SYSTEM_DIRECTX_TYPE                         45L
+#define M_SYSTEM_MTX0_TYPE                            46L
+// Reserve dib section (10 values)
+#define M_SYSTEM_DIB_TYPE_START                       47L
+#define M_SYSTEM_DRAWDIB_TYPE                         M_SYSTEM_DIB_TYPE_START+0L    // 47
+#define M_SYSTEM_BITBLT_TYPE                          M_SYSTEM_DIB_TYPE_START+1L    // 48
+#define M_SYSTEM_STRETCHBLT_TYPE                      M_SYSTEM_DIB_TYPE_START+2L    // 49
+#define M_SYSTEM_DIBTODEV_TYPE                        M_SYSTEM_DIB_TYPE_START+3L    // 50
+#define M_SYSTEM_STRETCHDIB_TYPE                      M_SYSTEM_DIB_TYPE_START+4L    // 51
+#define M_SYSTEM_DIB_TYPE_END                         56L
+#define M_IS_SYSTEM_DIB_TYPE(t)     ((t)>=M_SYSTEM_DIB_TYPE_START && (t)<=M_SYSTEM_DIB_TYPE_END)
+
+// System type information flags
+#define M_SYSTEM_DISTRIBUTED_FLAG                     0x40000000
+#define M_SYSTEM_INFORMATION_FLAGS                    0x40000000
+#define M_IS_SYSTEM_DISTRIBUTED(t)                    (((t) & M_SYSTEM_DISTRIBUTED_FLAG) == M_SYSTEM_DISTRIBUTED_FLAG)
+#define M_REAL_SYSTEM_TYPE(t)                         ((t) & ~M_SYSTEM_INFORMATION_FLAGS)
+
+
+
+/* MsysAlloc() flags  */
+#define M_APP_ALLOC_INIT_FLAGS                        0x0FF00000L
+#define M_SYS_ALLOC_INIT_FLAGS                        0x20000FFFL
+
+#define M_COMPLETE                                    0x00000000L
+#define M_PARTIAL                                     0x00000001L
+#define M_DISPLAY_INTERNAL_USE                        0x00000002L // mil.dll
+#define M_INTERNAL_USE                                0x00000004L // mil.dll
+#define M_CREATE_SYSTEM                               0x00000008L // mil.dll
+#define M_NO_INTERRUPT                                0x00000010L
+#define M_NO_FORCE_IP                                 M_NO_INTERRUPT //For GigEVision
+#define M_UPDATE_FIRMWARES                            M_NO_INTERRUPT
+#define M_ACCELERATOR_DISABLE                         0x00000020L // For GPU
+#define M_REGISTER_EDITOR                             0x00000040L
+#define M_DEVICE_NAME                                (MAKE_INT64(0x0000001000000000) | M_CLIENT_ENCODING)
+#define M_NO_FPGA_UPGRADE                             0x20000000L
+
+//do not add defines here
+
+// Board-specific flags
+#define M_REGISTER                                    0x00000100L // For MorphisEvo
+#define M_SCAN                                        0x00000100L // For GigE
+#define M_NO_SCAN                                     0x00000200L // For GigE
+#define M_SERVICE                                     0x00000400L // For GigE
+#define M_TOLERATE_INVALID_FPGA                       0x00000800L // For Solios and Radient
+#define M_SILENT                                      0x00000100L // For GPU
+#define M_GEV                                         0x00000100L // For GenTL
+#define M_CXP                                         0x00000200L // For GenTL
+#define M_U3V                                         0x00000300L // For GenTL
+#define M_CLHS                                        0x00000400L // For GenTL
+#define M_MIXED                                       0x00000500L // For GenTL
+#define M_XCL                                         0x00000800L // For GenTL
+#define M_CL                                          M_XCL       // For GenTL
+#define M_CUSTOM_TL                                   0x00000600L // For GenTL
+#define M_FROM_ACQUISITION_DRIVER                     0x00001000L // DO NOT REUSE
+#define M_FROM_HOST_AUX_SERVICE                       0x00002000L // DO NOT REUSE
+
+#define M_DEFAULT                                     0x10000000L
+
+
+/************************************************************************/
+/* MsysInquire() / MsysControl() Types                                  */
+/************************************************************************/
+#define M_EXECUTE_BUFFER_HOOKS                        1002L
+#define M_TYPE                                        1008L
+#define M_NUMBER                                      1009L
+#define M_INIT_FLAG                                   1012L
+#define M_ATTRIBUTE                                   1013L
+#define M_NATIVE_ID                                   1016L
+#define M_THREAD_PRIORITY                             1019L
+#define M_DETECT_HOOK_THREAD                          1020L
+#define M_MAP_VIDEO_RANGE_A_LA_PIECE                  1021L
+#define M_GPU_UPDATE_EFFECTS                          1022L
+#define M_MAP_VIDEO_MEMORY                            1023L
+#define M_LOCATION                                    1048L
+#define M_MIL_ID_INTERNAL                             1049L
+#define M_UPDATE_PERFORMANCE_COUNTERS                 1050L
+#define M_DEBUG_LOG_INFO                              1051L
+#define M_LED_USER                                    1053L
+#define M_DISTRIBUTED_MIL_TYPE                        1054L
+#define M_DISTRIBUTED_MIL_PROTOCOL                    1055L
+#define M_DEVICE_NAME_MAX_SIZE                        1056L
+#define M_GENICAM_AVAILABLE                           1079L
+#define M_GC_NIC_PORT_COUNT                           1080L
+#define M_DISCOVER_DEVICE                             1081L
+#define M_DISCOVER_DEVICE_COUNT                       1082L
+#define M_DISCOVER_DEVICE_MAX_COUNT                   256L
+
+/***************************************************************/
+/* MsysInquire() Types MIL_ID range start                      */
+/***************************************************************/
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_SYS_INQUIRE_MIL_ID_START                    1100L
+#define M_OWNER_APPLICATION                           1100L
+#define M_CURRENT_THREAD_ID                           1103L
+#define M_OWNER_NODE_ID                               1104L
+#define M_SHADING_CORRECTION_OFFSET_ID                1190L
+#define M_SHADING_CORRECTION_GAIN_ID                  1191L
+#define M_ADD_DESTINATION                             1192L
+#define M_REMOVE_DESTINATION                          1193L
+#define M_SYS_INQUIRE_MIL_ID_END                      1199L
+/***************************************************************/
+/* MsysInquire() Types MIL_ID range end                        */
+/***************************************************************/
+
+#define M_DISCOVER_DEVICE_DIGITIZER_NUMBER            1200L
+/* Reserve 256 values. 1200 - 1455 */
+#define M_DISCOVER_DEVICE_INTERFACE_TYPE              1456L
+/* Reserve 256 values. 1456 - 1711*/
+#define M_DISCOVER_DEVICE_ALLOCATION_STATUS           1712L
+/* Reserve 256 values. 1712 - 1967*/
+
+/************************************************************************/
+/* Camera allocation status                                             */
+/************************************************************************/
+#define M_DEVICE_ALLOCATED                            1
+#define M_DEVICE_FREE                                 2
+
+/************************************************************************/
+/* Interface types                                                      */
+/************************************************************************/
+#define M_GIGE_VISION                                180L
+#define M_USB3_VISION                                200L
+#define M_CL                                         M_XCL       // 0x00000800L
+#define M_CXP                                        0x00000200L
+#define M_CLHS                                       0x00000400L
+#define M_HDMI                                       0x2000
+#define M_SDI                                        0x00001000L
+
+#define M_THREAD_MODE                                 1804L
+
+#define M_SYSTEM_TYPE                                 2000L
+#define M_DISPLAY_OUTPUT_NUM                          2001L//2001L was use by M_SYSTEM_TYPE_PTR that is no longer supported.
+#define M_INTERNAL_SYSTEM_TYPE                        2002L
+//2003L was use by M_DISPLAY_TYPE, that is now in the Display reserved area.
+#define M_DIGITIZER_NUM                               2004L
+#define M_DIGITIZER_TYPE_NUMBER                       2400L
+#define M_DIGITIZER_TYPE                              M_DIGITIZER_TYPE_NUMBER
+#define M_PROCESSOR_NUM                               2006L
+//2007L was use by M_PROCESSOR_TYPE, that is now in the processor specific section.
+#define M_TIMER_NUM                                   2008L
+#define M_PROCESSING_SYSTEM_TYPE                      2009L
+#define M_TUNER_NUM                                   2010L
+#define M_TUNER_TYPE                                  2011L
+#define M_RGB_MODULE_NUM                              2012L
+#define M_RGB_MODULE_TYPE                             2013L
+#define M_BOARD_TYPE                                  2014L
+#define M_BOARD_REVISION                              2015L
+#define M_WIN_MODE                                    2017L
+//2018L was use by M_DUAL_SCREEN_MODE, that is now in the Display reserved area.
+//2019L was use by M_UNDERLAY_SURFACE_AVAILABLE, that is now in the Display reserved area.
+#define M_LOW_LEVEL_SYSTEM_ID                         2024L
+#define M_PHYSICAL_ADDRESS_UNDERLAY                   2029L
+
+//2030L was use by M_PHYSICAL_ADDRESS_VGA, that is now in the Display reserved area.
+//2031 was used by M_PSEUDO_LIVE_GRAB_ON_MGA, that is no longer supported.
+//2032 was used by M_PSEUDO_LIVE_GRAB, that is no longer supported.
+//2033 was used by M_FORCE_PSEUDO_IN_NON_UNDERLAY_DISPLAYS, that is no longer supported
+#define M_LIVE_GRAB                                   2034L
+#define M_LIVE_GRAB_WHEN_DISPLAY_DOES_NOT_MATCH       2035L
+#define M_ADD_BUFFER_INFO                             2036L
+// free for reuse                                     2037L
+#define M_GRAB_CONTINUOUS_END_TRIGGER                 2038L
+//2038 M_LIVE_GRAB_END_TRIGGER is now in OldDefines
+//2040 was used by M_STOP_LIVE_GRAB_WHEN_MENU, that is no longer supported
+//2041 was used by M_STOP_LIVE_GRAB_WHEN_INACTIVE, that is no longer supported
+//2042 was used by M_STOP_LIVE_GRAB_WHEN_DISABLED, that is no longer supported
+#define M_GRAB_BY_DISPLAY_CAPTURE                     2043L
+#define M_ALLOC_BUF_RGB888_AS_RGB555                  2044L
+#define M_RGB555_BUFFER_ALLOCATION                    2045L
+//2046 was used by M_LAST_GRAB_IN_TRUE_BUFFER, that is now in the Digitizer reserved area.
+#define M_NO_GRAB_WHEN_NO_INPUT_SIGNAL                2047L
+#define M_PCI_LATENCY                                 2048L
+//2049 was used by M_FAST_PCI_TO_MEM, that is no longer supported.
+#define M_DCF_SUPPORTED                               2050L
+#define M_DMA_ENABLE                                  2051L
+#define M_DMA_DISABLE                                 2052L
+#define M_DIB_ONLY                                    2053L
+#define M_DIB_OR_DDRAW                                2054L
+#define M_FLIP_ONLY                                   2055L
+//2057L was use by M_PRIMARY_DDRAW_SURFACE_MEM_PTR, that is now in the Display reserved area.
+//2058L was use by M_PRIMARY_DDRAW_SURFACE_PITCH_BYTE, that is now in the Display reserved area.
+//2059L was use by M_PRIMARY_DDRAW_SURFACE_SIZE_X, that is now in the Display reserved area.
+//2060L was use by M_PRIMARY_DDRAW_SURFACE_SIZE_Y, that is now in the Display reserved area.
+//2061L was use by M_PRIMARY_DDRAW_SURFACE_SIZE_BITS, that is now in the Display reserved area.
+#define M_INTERNAL_FORMAT_SIZE                        2062L
+#define M_INTERNAL_FORMAT_ENUMERATION                 2063L
+#define M_INTERNAL_FORMAT_CHECK                       2064L
+//2065L was use by M_DDRAW_AVAILABLE, that is now in the Display reserved area.
+#define M_BOARD_CODE                                  2066L
+#define M_LIVE_GRAB_DDRAW                             2067L
+#define M_THREAD_CONTEXT_PTR                          2068L
+#define M_PSEUDO_LIVE_GRAB_NB_FRAMES                  2069L
+#define M_PSEUDO_LIVE_GRAB_NB_FIELDS                  2070L
+//2071L was use by M_DISPLAY_DOUBLE_BUFFERING, that is now in the Display reserved area.
+#define M_PSEUDO_LIVE_GRAB_TIME                       2072L
+#define M_PCI_BRIDGE_LATENCY                          2073L
+#define M_PSEUDO_LIVE_GRAB_WITH_DDRAW                 2074L
+#define M_MULTI_DISP_IN_UNDERLAY                      2075L
+#define M_MULTI_DISP_FOR_GRAB                         2076L
+#define M_TIMEOUT                                     2077L
+#define M_AUTO_FLIP_FOR_TRUE_COLOR                    2078L
+#define M_PCI_BRIDGE_HOST_WRITE_POSTING               2079L
+#define M_FAST_MEM_TO_VGA                             2080L
+#define M_ERROR_ASYNCHRONOUS_LOG                      2081L
+#define M_LIVE_GRAB_WHEN_NOT_VISIBLE                  2082L
+//2086 was used by M_PHYSICAL_ADDRESS_VIA, that is no longer supported.
+#define M_PCI_MGA_ID                                  2087L
+#define M_PCI_VIA_ID                                  2088L
+#define M_PCI_BRIDGE_ID                               2089L
+#define M_NATIVE_SYSTEM_NUMBER                        2090L
+#define M_NATIVE_NODE_NUMBER                          2091L
+#define M_JTAG_CHAIN                                  2092L
+
+#define M_CUSTOMER_PRODUCT_ID                         2093L
+#define M_UNDERLAY_MEM_SIZE                           2094L
+#define M_OVERLAY_MEM_SIZE                            2095L
+#define M_VIA_MEM_SIZE                                2096L
+#define M_ERROR_CLEAR                                 2099L
+#define M_DEBUG_BUFFER_CLEAR                          2100L  // Was M_SYS_DEBUG_BUFFER_SIZE. Used for remote debugging at clients' sites. Please keep undocumented.
+#define M_DEBUG_BUFFER_TO_FILE                        2101L  // Was M_SYS_DEBUG_BUFFER_ID. Used for remote debugging at clients' sites. Please keep undocumented.
+#define M_USE_NOA                                     2102L
+#define M_USE_ACCELERATOR                             M_USE_NOA
+#define M_COMPRESSION_MODULE_PRESENT                  2104L
+#define M_DIGITAL_MODULE_PRESENT                      2105L
+#define M_INTERRUPT_NEW_TECHNIQUE                     2106L
+#define M_INTERRUPT_NEW_TECHNIQUE_STAT                2107L
+#define M_INTERRUPT_NEW_TECHNIQUE_QUEUE               2108L
+#define M_INTERRUPT_MASTER_SWITCH                     2109L
+#define M_BUS_MASTER_COPY_TO_HOST                     2110L
+#define M_BUS_MASTER_COPY_FROM_HOST                   2111L
+#define M_MEMORY_OFF_SCREEN_AVAILABLE                 2112L
+#define M_BUFCOPY_SUPPORTED                           2113L
+#define M_COMPRESSION_SUPPORTED                       2114L
+#define M_COMPRESSION_BOARD_TYPE                      2121L
+#define M_COMPRESSION_BOARD_RESET                     2122L
+#define M_COMPACT_PCI_PRESENT                         2123L
+#define M_HARDWARE_COMPRESSION                        2130L
+#define M_HARDWARE_DECOMPRESSION                      2131L
+#define M_UART_PRESENT                                2132L
+#define M_PC104_PRESENT                               2133L
+#define M_HARDWARE_COMPRESSION_TYPE                   2134L
+#define M_DDRAW_UNDERLAY_FORMAT                       2137L
+#define M_ENCODER_PRESENT                             2138L
+#define M_COMPRESSION_INTERNAL_BUFFER_SIZE            2139L
+#define M_BIOS_REVISION                               2154L
+#define M_FPGA_REVISION                               2155L
+#define M_FIRMWARE_REVISION                           M_FPGA_REVISION
+#define M_INTERNAL_CAMERA_STRUCT_PTR                  2156L
+#define M_INTERNAL_CAMERA_STRUCT_SIZE                 2157L
+#define M_SUPPORTED_INTERFACE                         2159L
+
+#define M_BOARD_REVISION_SENSOR                       2160L
+#define M_BOARD_REVISION_DAUGHTER                     2161L
+
+#define M_SYSTEM_NUM                                  2169L
+#define M_ASSOCIATED_VGA_DEVICE                       2171L
+#define M_GPU_IS_NON_POWER_OF_2_FULLY_SUPPORTED       2177L
+#define M_GPU_IS_TEXTURE_BORDER_SUPPORTED             2178L
+#define M_GPU_IS_16_BIT_PRECISE                       2179L
+#define M_GPU_SERIES                                  2180L
+#define M_GENTL_INTERFACE_COUNT                       2181L
+#define M_GENTL_DEVICE_COUNT                          2182L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_SUPPORT_SYSTEM_NOTIFICATION                 2183L
+#endif
+#define M_SUPPORT_DEVICE_NAME                         2184L
+
+#define M_BOARD_SUB_REVISION                          2200L
+#define M_USER_BIT_CHANGE                             2244L
+
+#define M_USER_BIT_CHANGE_HANDLER_PTR                 2245L
+/* Reserve next 18 values                       from  2246L*/
+/*                                             to     2264L*/
+#define M_USER_BIT_CHANGE_HANDLER_USER_PTR            2266L
+/* Reserve next 19 values                       from  2267L*/
+/*                                             to     2285L*/
+#define M_CURRENTLY_USED_CAMERA                       2289L
+#define M_DIGITIZER_MODE                              2290L
+#define M_MSG_BUFFER_SIZE                             2291L
+#define M_MSG_BUFFER_PHYSICAL_ADDRESS                 2292L
+#define M_DEFAULT_PITCH_BYTE_MULTIPLE                 2294L
+#if OldDefinesSupport
+#define M_DEFAULT_PITCH_BYTE                          M_DEFAULT_PITCH_BYTE_MULTIPLE
+MIL_DEPRECATED(M_DEFAULT_PITCH_BYTE, 1010)
+#endif
+#define M_SYS_USE_WINDOWED_CLASS                      2295L
+#define M_SUBSYSTEM_ID                                2299L
+#define M_USE_DDRAW                                   2300L
+#define M_PREFERRED_DISPLAY_SYSTEM                    2301L
+#define M_USAGE_METER                                 2302L
+#define M_GRAB_USAGE                                  2303L
+#define M_ACCELERATOR_USAGE                           2304L
+#define M_DMA_USAGE                                   2305L
+#define M_DMA_WRITE_USAGE                             M_DMA_USAGE
+#define M_UTILITY_USAGE                               2306L
+#define M_MAX_UNIT_IDLE_TIME                          2307L
+#define M_JPEG2000_USAGE                              2308L
+#define M_DMA_READ_USAGE                              2309L
+
+#define M_BUFFER_DEFAULT_LOCATION                     2310L
+#define M_ON_BOARD_NATIVE_THREAD_ID                   2314L
+#define M_COPY_BY_DRIVER                              2315L
+#define M_ASSOCIATED_VIDEO_DEVICE_INDEX               2316L
+#define M_ASSOCIATED_EXT_VIDEO_DEVICE_ID              2317L
+
+#define M_NATIVE_CLUSTER_NUMBER                       M_NATIVE_SYSTEM_NUMBER
+#define M_CPU_SPEED                                   2320L
+#define M_ACCELERATOR_SPEED                           2321L
+#define M_ACCELERATOR_PRESENT                         2322L
+#define M_MEMORY_SIZE                                 2323L
+#define M_MEMORY_FREE                                 2324L
+#define M_FAST_MEMORY_FREE                            2325L
+#define M_SHARED_MEMORY_FREE                          2326L
+#define M_HEAP_SIZE                                   2327L
+#define M_HEAP_FREE                                   2328L
+#define M_SIZE_X_CREATE_RESTRICTION                   2329L
+#define M_SHARED_MEMORY_SIZE                          2330L
+#define M_DIGITIZER_NUM_ALLOCATED                     2331L
+/* Reserve next 4 values                       from   2232L*/
+/*                                             to     2235L*/
+/* Next 4 values are used to specify device number of the digitizer.*/
+#define M_SERIAL_DEVICE_PORT_NUMBERS                  2336L
+#define M_FIRMWARE_UPDATE                             2340L
+#define M_CURRENTLY_IN_HOOK                           2341L
+#define M_FIRMWARE_REVISION_GRAB                      2342L
+#define M_FIRMWARE_REVISION_IO                        2343L
+#define M_FIRMWARE_REVISION_PROCESSING                2344L
+#define M_FIRMWARE_REVISION_JPEG2000                  M_FIRMWARE_REVISION_PROCESSING
+#define M_FIRMWARE_BUILDDATE                          2345L
+#define M_FIRMWARE_BUILDDATE_GRAB                     2346L
+#define M_FIRMWARE_BUILDDATE_IO                       2347L
+#define M_FIRMWARE_BUILDDATE_PROCESSING               2348L
+#define M_FIRMWARE_BUILDDATE_JPEG2000                 M_FIRMWARE_BUILDDATE_PROCESSING
+#define M_MPEG4_USAGE                                 2349L
+
+#define M_MEMORY_SIZE_BANK_0                          2350L
+#define M_MEMORY_SIZE_BANK_1                          2351L
+#define M_MEMORY_SIZE_BANK_2                          2352L
+#define M_MEMORY_SIZE_BANK_3                          2353L
+
+#define M_MEMORY_FREE_BANK_0                          2354L
+#define M_MEMORY_FREE_BANK_1                          2355L
+#define M_MEMORY_FREE_BANK_2                          2356L
+#define M_MEMORY_FREE_BANK_3                          2357L
+
+#define M_SYSTEM_NUM_ALLOCATED                        2360L
+#define M_COM_PORT_PCI_BUS_NB                         2361L
+#define M_JPEG2000_COMPATIBILITY_CHECKING             2362L
+#define M_SET_BACK_TO_ZERO                            2363L
+#define M_PROCESSING_FPGA_FAN_RPM                     2364L
+#define M_GRAB_FPGA_FAN_RPM                           2365L
+
+#define M_FIRMWARE_FILE_INDEX                         2367L
+
+// WATCHDOG
+#define M_WATCHDOG_MODE                               2370
+#define M_WATCHDOG_TIMEOUT                            2371
+#define M_WATCHDOG_WARNING                            2372
+#define M_WATCHDOG_REBOOT_TIMEOUT                     2373
+#define M_WATCHDOG_RESET                              2374
+#define M_WATCHDOG_RESET_COUNTER                      2375
+#define M_WATCHDOG_WARNING_TIME                       2376
+#define M_WATCHDOG_PRESENT                            2378
+#define M_OK_TO_FREE                                  2379
+// CRYPTOGRAPHY
+#define M_CRYPTOGRAPHY_MODE                           2380L
+#define M_CRYPTOGRAPHY_P_KEY                          2381L
+#define M_CRYPTOGRAPHY_Q_KEY                          2382L
+#define M_CRYPTOGRAPHY_PUBLIC_KEY                     2383L
+#define M_CRYPTOGRAPHY_PRIVATE_KEY                    2384L
+#define M_CRYPTOGRAPHY_RSA                            2385L
+#define M_CRYPTOGRAPHY_HMAC_KEY                       2386L
+// CRYPTOGRAPHY support old defines
+#define M_CRYPTO_MODE                                 M_CRYPTOGRAPHY_MODE
+#define M_CRYPTO_P_KEY                                M_CRYPTOGRAPHY_P_KEY
+#define M_CRYPTO_Q_KEY                                M_CRYPTOGRAPHY_Q_KEY
+#define M_CRYPTO_PUBLIC_KEY                           M_CRYPTOGRAPHY_PUBLIC_KEY
+#define M_CRYPTO_PRIVATE_KEY                          M_CRYPTOGRAPHY_PRIVATE_KEY
+#define M_CRYPTO_RSA                                  M_CRYPTOGRAPHY_RSA
+
+#define M_DIGITIZER_TYPE_NUMBER                       2400L
+/* Reserve next 31 values                      from   2400*/
+/* for M_DIGITIZER_TYPE+M_DEVn inquire         to     2432*/
+
+
+#define M_AGP_TO_PCI_TRANSFER                         2433L
+#define M_TRANSFER_PRIORITY                           2434L
+#define M_THREAD_CANCEL                               2435L
+#define M_THREAD_HALT                                 2436L
+#define M_NUMBER_OF_GRAB_BLOCKS                       2437L
+/* Reserve next 4 values                        from  2438L*/
+/*                                              to    2441L*/
+#define M_GRAB_BLOCK_FACTOR                           2442L
+/* Reserve next 4 values                        from  2443L*/
+/*                                              to    2446L*/
+#define M_MODIFIED_BUFFER_HOOK_MODE                   2447L
+#define M_GC_CAMERA_SELECT                            2448L
+
+#define M_POWER_OVER_CABLE                            2560  /* 0xA00 */
+/* Reserve next 15 values                       from  2560L */
+/*                                              to    2576  */
+#define M_CAMERA_POWER                                M_POWER_OVER_CABLE
+#define M_POWER_OVER_CABLE_OVER_CURRENT_DETECTION_DELAY 2577L
+
+#define M_POWER_EXTERNAL_SOURCE_PRESENT               2579L
+
+#define METEOR_II_1394B_BIT_MASK_POWER                 0x7
+#define M_BUS_MASTER_PCI_LOCATION                     2580L
+/* Reserve next 8 values                       from   2580L*/
+/*                                             to     2587L*/
+#define M_PCIE_NUMBER_OF_LANES                        2588L
+#define M_PCIE_NUMBER_OF_LANES_MAX                    2589L
+#define M_BUS_MASTER_REQUESTER_ID                     2590L
+/* Reserve next 8 values                       from   2590L*/
+/*                                             to     2597L*/
+#define M_PCIE_SPEED                                  2598L
+#define M_PCIE_SPEED_MAX                              2599L
+
+#define M_PROCESSING_UNIT_START                       0L
+#define M_PROCESSING_UNIT_END                         299L
+#define M_PROCESSING_FPGA_USAGE                       2600L
+/* Reserve next 300 values                     from   2600L*/
+/*                                             to     2899L*/
+#define M_DMA_WRITE_UNIT0_USAGE                       2900L
+#define M_DMA_WRITE_UNIT1_USAGE                       2901L
+#define M_DMA_WRITE_UNIT2_USAGE                       2902L
+#define M_DMA_WRITE_UNIT3_USAGE                       2903L
+// CXP system inquire
+#define M_CONNECTION_COUNT                            3000L
+#define M_CONNECTION_STATE                            3008L
+/* Reserve next 15 values                       from  3009*/
+/*                                             to     3023*/
+#define M_CONNECTION_BIT_RATE_UP_DIRECTION            3024L
+/* Reserve next 15 values                       from  3025*/
+/*                                             to     3039*/
+#define M_CONNECTION_BIT_RATE_DOWN_DIRECTION          3040L
+/* Reserve next 15 values                       from  3041*/
+/*                                             to     3055*/
+#define M_CONNECTION_ID                               3056L
+/* Reserve next 15 values                       from  3057*/
+/*                                             to     3071*/
+
+#define M_POWER_OVER_CABLE_STATUS                     3072  /* 0xCD0 */
+/* Reserve next 15 values                       from  3073L */
+/*                                              to    3087  */
+#define M_TL_ERROR_DETECTION_MODE                     3100
+#define M_TL_ERROR_LOCK_LOSS_COUNT                    3104   
+/* Reserve next 15 values                       from  3105*/
+/*                                             to     3119*/
+#define M_TL_ERROR_CORRECTED_COUNT                    3120   
+/* Reserve next 15 values                       from  3121*/
+/*                                             to     3135*/
+#define M_TL_ERROR_UNCORRECTED_COUNT                  3136  
+/* Reserve next 15 values                       from  3137*/
+/*                                             to     3151*/
+#define M_TL_ERROR_DATA_CRC_COUNT                     3152   
+/* Reserve next 15 values                       from  3153*/
+/*                                             to     3167*/
+#define M_TL_ERROR_CTRL_CRC_COUNT                     3168   
+/* Reserve next 15 values                       from  3169*/
+/*                                             to     3183*/
+#define M_TL_ERROR_EVENT_CRC_COUNT                    3184   
+/* Reserve next 15 values                       from  3185*/
+/*                                             to     3199*/
+#define M_TL_ERROR_ENCODING_COUNT                     3200  
+/* Reserve next 15 values                       from  3201*/
+/*                                             to     3215*/
+#define M_TL_ERROR_COUNT                              3216  
+/* Reserve next 15 values                       from  3217*/
+/*                                             to     3231*/
+#define M_CONNECTION_TYPE                             3232L
+/* Reserve next 15 values                       from  3233*/
+/*                                             to     3247*/
+
+// MPEG4 ENCODER
+#define M_STREAM(value)                               ((value + 1) & 0x003f)
+#define M_STREAM_EXTRACT_STREAM(value)                ((value & 0x003f) - 1)
+#define M_STREAM_EXTRACT_TYPE(value)                  (value & ~0x003f)
+
+// NOTE: For the following defines, the 6 LSBs must be zeros
+#define M_STREAM_CONTROL                              3264L // 0x00000CC0
+#define M_STREAM_BIT_RATE_MODE                        3328L // 0x00000D00
+#define M_STREAM_BIT_RATE                             3392L // 0x00000D40
+#define M_STREAM_Q_PARAMETER                          3456L // 0x00000D80
+#define M_STREAM_QUALITY                              3520L // 0x00000DC0
+#define M_STREAM_BIT_RATE_MAX                         3584L // 0x00000E00
+#define M_STREAM_GROUP_OF_PICTURE_SIZE                3648L // 0x00000E40
+#define M_STREAM_FRAME_RATE                           3712L // 0x00000E80
+#define M_STREAM_FRAME_PERIOD                         3776L // 0x00000EC0
+#define M_STREAM_ENCODING_MODE                        3840L // 0x00000F00
+#define M_STREAM_FILE_NAME                           (3904L | M_CLIENT_ENCODING) // 0x00000F40
+#define M_STREAM_WRITE                                3968L // 0x00000F80
+#define M_STREAM_PROFILE                              4032L // 0x00000FC0
+#define M_STREAM_LEVEL                                4096L // 0x00001000
+
+
+#define M_STREAM_GROUP_OF_PICTURE_TYPE                4160L // 0x00001040
+#define M_STREAM_GROUP_OF_PICTURE_P_SIZE              4224L // 0x00001080
+#define M_STREAM_GROUP_OF_PICTURE_I_SIZE              4288L // 0x000010c0
+#define M_STREAM_LAST                                 (M_STREAM_GROUP_OF_PICTURE_I_SIZE + 63)
+// Continues at value 4864L
+
+#define M_DRIVER_COMPILATION_TYPE                     4362L
+#define M_USER_BIT_INQUIRE_START                      4363L
+#define M_USER_BIT_COUNT                              4364L
+#define M_USER_BIT_OPTOMODULE                         4365L
+#define M_USER_BIT_INQUIRE_END                        4366L
+#define M_FORCE_PITCH_BYTE_MULTIPLE                   4367L
+
+//EEPROM-related defines
+#define M_EEPROM_SIZE                                 4369L
+
+#define M_SUPPORT_START_NO                            4374L
+/*Reserve values between M_SUPPORT_START_NO
+                          and M_SUPPORT_END_NO*/
+#define M_DISPLAY_SUPPORT                             4374L
+#define M_MULTITHREAD_SUPPORT                         4375L
+#define M_ASYNCHRONOUS_CALL_SUPPORT                   4376L
+#define M_COLOR_BUFFERS_PROCESSING_SUPPORT            4377L
+#define M_64BIT_RESULT_BUFFERS_SUPPORT                4378L
+#define M_MILGRABC_VERSION                            4385L    // Also defined as a MdigInquire
+#define M_NETWORKED                                   4386L
+#define M_ALL_DEV_ARE_EQUIVALENT                      4387L
+#define M_MP_SUPPORT                                  4388L
+#define M_REMOTE_MAPPING_SUPPORT                      4389L
+#define M_SUPPORT_NEW_CONTROL_FEATURE                 4390L
+#define M_GPU_NO_TEARING_SUPPORT                      4391L
+#define M_GPU_BILINEAR_SUPPORT                        4392L
+#define M_RAW_CALL_SUPPORT                            4393L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_NAMED_BUFFER_SUPPORTED                      4394L
+#define M_SYS_CONTROL_SUPPORT_MULTI_TYPE              4395L
+#define M_OBJ_CONTROL_SUPPORT_COMPENSATE_REAL_ID      4396L
+#define M_DIG_INQUIRE_SUPPORT_COMPONENT               4398L
+#endif
+#define M_COM_SUPPORTED                               4399L
+#define M_PROFINET_HARDWARE_SUPPORTED                 4400L
+#define M_YCBCR_UHD_SUPPORTED                         4401L
+#define M_PFNC_GRAB_SUPPORTED                         4403L
+#define M_SUPPORT_END_NO                              4439L
+
+#define M_SUPPORT_START_YES                           4440L
+/*Reserve values between M_SUPPORT_START_YES and M_SUPPORT_END_YES*/
+#define M_CAN_GRAB                                    4441L
+#define M_ALLOC_WITH_FORCED_PITCH_SUPPORT             4442L
+#define M_WINDOW_ANNOTATIONS_ENABLED                  4443L
+#define M_SUPPORT_END_YES                             4500L
+
+#define M_SYS_DISPLAY_START                           4501L
+//This section is reserved for displays and defines are in mildisplay.h
+#define M_SYS_DISPLAY_END                             4600L
+#define M_PERFORMANCE_LOGS                            4601L
+#define M_INTERRUPT_LATENCY                           4602L
+// UNUSED                                             4603L
+#define M_DEV_MIN_HEAP_SIZE                           4604L
+#define M_DIGITIZER_INTERNAL_BUFFERS_NUM              4605L
+#define M_CHECK_ERROR                                 4606L
+
+#define M_GC_ACTION_DEVICE_KEY                        4610L
+#define M_GC_ACTION_GROUP_KEY                         4611L
+#define M_GC_ACTION_GROUP_MASK                        4612L
+#define M_GC_ACTION_ACKNOWLEDGE_NUMBER                4613L
+#define M_GC_ACTION_EXECUTE                           4614L
+#define M_GC_ACTION_CLEAR_DEVICES                     4615L
+
+#define M_TRIGGER_ACTIVATION                          4616L
+#define M_TRIGGER_SOURCE                              4617L
+#define M_TRIGGER_STATE                               4618L
+#define M_TRIGGER_COMMAND                             4619L
+#define M_CLEAR_DESTINATIONS                          M_GC_ACTION_CLEAR_DEVICES
+
+#define M_GC_ACTION_SHIFT                             16L
+#define M_GC_ACTION_NUMBER_MASK                       MAKE_INT64(0x0000000000FF0000)
+#define M_GC_ACTION_NUMBER(X)                         (((X) & M_GC_ACTION_NUMBER_MASK) >> M_GC_ACTION_SHIFT)
+#define M_GC_STRIP_ACTION_NUMBER(X)                   ((X) & ~M_GC_ACTION_NUMBER_MASK)
+#define M_GC_ACTION_BASE                              0x0
+#define M_GC_ACTION(X)                                ((M_GC_ACTION_BASE + (X))  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION0                                  ((M_GC_ACTION_BASE + 0)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION1                                  ((M_GC_ACTION_BASE + 1)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION2                                  ((M_GC_ACTION_BASE + 2)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION3                                  ((M_GC_ACTION_BASE + 3)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION4                                  ((M_GC_ACTION_BASE + 4)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION5                                  ((M_GC_ACTION_BASE + 5)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION6                                  ((M_GC_ACTION_BASE + 6)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION7                                  ((M_GC_ACTION_BASE + 7)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION8                                  ((M_GC_ACTION_BASE + 8)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION9                                  ((M_GC_ACTION_BASE + 9)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION10                                 ((M_GC_ACTION_BASE + 10) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION11                                 ((M_GC_ACTION_BASE + 11) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION12                                 ((M_GC_ACTION_BASE + 12) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION13                                 ((M_GC_ACTION_BASE + 13) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION14                                 ((M_GC_ACTION_BASE + 14) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION15                                 ((M_GC_ACTION_BASE + 15) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION16                                 ((M_GC_ACTION_BASE + 16) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION17                                 ((M_GC_ACTION_BASE + 17) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION18                                 ((M_GC_ACTION_BASE + 18) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION19                                 ((M_GC_ACTION_BASE + 19) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION20                                 ((M_GC_ACTION_BASE + 20) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION21                                 ((M_GC_ACTION_BASE + 21) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION22                                 ((M_GC_ACTION_BASE + 22) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION23                                 ((M_GC_ACTION_BASE + 23) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION24                                 ((M_GC_ACTION_BASE + 24) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION25                                 ((M_GC_ACTION_BASE + 25) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION26                                 ((M_GC_ACTION_BASE + 26) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION27                                 ((M_GC_ACTION_BASE + 27) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION28                                 ((M_GC_ACTION_BASE + 28) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION29                                 ((M_GC_ACTION_BASE + 29) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION30                                 ((M_GC_ACTION_BASE + 30) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION31                                 ((M_GC_ACTION_BASE + 31) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION_MAX                               M_GC_ACTION31
+
+#define M_GC_TRIGGER_SOFTWARE_SHIFT                   M_GC_ACTION_SHIFT
+#define M_GC_TRIGGER_SOFTWARE_NUMBER_MASK             M_GC_ACTION_NUMBER_MASK
+#define M_GC_TRIGGER_SOFTWARE_NUMBER(X)               M_GC_ACTION_NUMBER(X)
+#define M_GC_STRIP_TRIGGER_SOFTWARE_NUMBER(X)         M_GC_STRIP_ACTION_NUMBER(X)
+#define M_GC_TRIGGER_SOFTWARE_BASE                    128
+#define M_GC_TRIGGER_SOFTWARE(X)                      ((M_GC_TRIGGER_SOFTWARE_BASE + (X))  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE0                        ((M_GC_TRIGGER_SOFTWARE_BASE + 0)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE1                        ((M_GC_TRIGGER_SOFTWARE_BASE + 1)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE2                        ((M_GC_TRIGGER_SOFTWARE_BASE + 2)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE3                        ((M_GC_TRIGGER_SOFTWARE_BASE + 3)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE4                        ((M_GC_TRIGGER_SOFTWARE_BASE + 4)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE5                        ((M_GC_TRIGGER_SOFTWARE_BASE + 5)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE6                        ((M_GC_TRIGGER_SOFTWARE_BASE + 6)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE7                        ((M_GC_TRIGGER_SOFTWARE_BASE + 7)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE8                        ((M_GC_TRIGGER_SOFTWARE_BASE + 8)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE9                        ((M_GC_TRIGGER_SOFTWARE_BASE + 9)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE10                       ((M_GC_TRIGGER_SOFTWARE_BASE + 10) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE11                       ((M_GC_TRIGGER_SOFTWARE_BASE + 11) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE12                       ((M_GC_TRIGGER_SOFTWARE_BASE + 12) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE13                       ((M_GC_TRIGGER_SOFTWARE_BASE + 13) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE14                       ((M_GC_TRIGGER_SOFTWARE_BASE + 14) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE15                       ((M_GC_TRIGGER_SOFTWARE_BASE + 15) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE16                       ((M_GC_TRIGGER_SOFTWARE_BASE + 16) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE17                       ((M_GC_TRIGGER_SOFTWARE_BASE + 17) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE18                       ((M_GC_TRIGGER_SOFTWARE_BASE + 18) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE19                       ((M_GC_TRIGGER_SOFTWARE_BASE + 19) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE20                       ((M_GC_TRIGGER_SOFTWARE_BASE + 20) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE21                       ((M_GC_TRIGGER_SOFTWARE_BASE + 21) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE22                       ((M_GC_TRIGGER_SOFTWARE_BASE + 22) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE23                       ((M_GC_TRIGGER_SOFTWARE_BASE + 23) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE24                       ((M_GC_TRIGGER_SOFTWARE_BASE + 24) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE25                       ((M_GC_TRIGGER_SOFTWARE_BASE + 25) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE26                       ((M_GC_TRIGGER_SOFTWARE_BASE + 26) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE27                       ((M_GC_TRIGGER_SOFTWARE_BASE + 27) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE28                       ((M_GC_TRIGGER_SOFTWARE_BASE + 28) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE29                       ((M_GC_TRIGGER_SOFTWARE_BASE + 29) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE30                       ((M_GC_TRIGGER_SOFTWARE_BASE + 30) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE31                       ((M_GC_TRIGGER_SOFTWARE_BASE + 31) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE_MAX                     M_GC_TRIGGER_SOFTWARE31
+
+// Map of UART defines, used by Mdig and Msys
+#define M_UART_START                                  4701L
+#define M_UART_PARITY                                 4701L
+#define M_UART_STOP_BITS                              4702L
+#define M_UART_DATA_SIZE                              4703L
+#define M_UART_SPEED                                  4704L
+#define M_UART_WRITE_CHAR                             4705L
+#define M_UART_READ_CHAR                              4706L
+#define M_UART_DATA_PENDING                           4707L
+#define M_UART_WRITE_STRING                           4708L
+#define M_UART_WRITE_STRING_SIZE                      4709L
+#define M_UART_READ_STRING                            4710L
+#define M_UART_READ_STRING_SIZE                       4711L
+#define M_UART_READ_STRING_MAXIMUM_SIZE               4712L
+#define M_UART_STRING_DELIMITER                       4713L
+#define M_UART_TIMEOUT                                4714L
+#define M_UART_OUTPUT                                 4716L
+#define M_UART_THREAD_HANDLE                          4717L
+#define M_UART_THREAD_ID                              4718L
+#define M_UART_DATA_RECEIVED_HANDLER_PTR              4719L
+#define M_UART_DATA_RECEIVED_HANDLER_USER_PTR         4720L
+#define M_UART_INTERFACE_TYPE                         4721L
+#define M_UART_BYTES_WRITTEN                          4722L
+#define M_UART_BYTES_READ                             4723L
+#define M_COM_PORT_NUMBER                             4724L
+#define M_UART_FREE                                   4725L
+#define M_UART_END                                    4725L
+#define M_UART_SYNCHRONOUS                            0x02000000
+#define M_UART_NB_MASK_SHIFT                          16L
+#define M_MAX_UART_NB                                 0x000000ff
+#define M_UART_NB(n)                                  ((MIL_INT64)((n & M_MAX_UART_NB) << M_UART_NB_MASK_SHIFT))
+#define M_UART0                                       M_UART_NB(0)
+#define M_UART1                                       M_UART_NB(1)
+#define M_UART2                                       M_UART_NB(2)
+#define M_UART3                                       M_UART_NB(3)
+#define M_UART4                                       M_UART_NB(4)
+#define M_UART5                                       M_UART_NB(5)
+#define M_UART6                                       M_UART_NB(6)
+#define M_UART7                                       M_UART_NB(7)
+#define M_UART8                                       M_UART_NB(8)
+#define M_UART9                                       M_UART_NB(9)
+#define M_UART10                                      M_UART_NB(10)
+#define M_UART11                                      M_UART_NB(11)
+#define M_UART12                                      M_UART_NB(12)
+#define M_UART13                                      M_UART_NB(13)
+#define M_UART14                                      M_UART_NB(14)
+#define M_UART15                                      M_UART_NB(15)
+#define M_UART_CONTROL_VALUE(n)                       (n & (~( M_UART_SYNCHRONOUS | (M_MAX_UART_NB << M_UART_NB_MASK_SHIFT))))
+#define M_IS_IN_UART_RANGE(Type)                      (((M_UART_CONTROL_VALUE((Type)) >= M_UART_START) && \
+                                                        (M_UART_CONTROL_VALUE((Type)) <= M_UART_END)))
+
+#if OldDefinesSupport
+#define M_UART_DATA_LENGTH                            M_UART_DATA_SIZE
+MIL_DEPRECATED(M_UART_DATA_LENGTH, 1000)
+#define M_UART_WRITE_STRING_LENGTH                    M_UART_WRITE_STRING_SIZE
+MIL_DEPRECATED(M_UART_WRITE_STRING_LENGTH, 1000)
+#define M_UART_READ_STRING_LENGTH                     M_UART_READ_STRING_SIZE
+MIL_DEPRECATED(M_UART_READ_STRING_LENGTH, 1000)
+#define M_UART_READ_STRING_MAXIMUM_LENGTH             M_UART_READ_STRING_MAXIMUM_SIZE
+MIL_DEPRECATED(M_UART_READ_STRING_MAXIMUM_LENGTH, 1000)
+#endif
+
+
+#define M_FPGA_CONTEXT_SHARED_API                     4800L
+#define M_DRIVER_FPGA_CONTEXT_SIZE                    4801L
+#define M_PROCESSING_MODULE_COUNT                     4802L
+#define M_FPGA_RESET                                  4803L
+#define M_PROCESSING_FPGA_REGISTER_RANGE              4804L
+#define M_PF_CLOCK_FREQUENCY                          4805L
+#define M_PF_MEMORY_SIZE                              4806L
+#define M_DISTRIBUTED_SYSTEM_ON_LOCAL_HOST            4807L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_IS_DISTRIBUTED_SYSTEM_ON_LOCAL_HOST         4807L
+#endif
+#define M_NETWORK_PORT                                4808L
+
+#define M_GC_DISCOVER_DEVICES                         4810L
+#define M_NUM_CAMERA_PRESENT                          4811L
+// Reserved                                           4812L
+#define M_GC_FEATURE_EXECUTE_POLLING_MODE             4813L
+#define M_FPGA_MEMORY_ARBITER_GRANT                   4814L
+#define M_PCIE_PAYLOAD_SIZE                           4815L
+
+#define M_HFPGA_REGISTER_RANGE                        4818L
+#define M_GENTL_DISCOVERY_TIMEOUT                     4819L
+
+
+#define M_STREAM_ENCODING_IMPLEMENTATION              4864L // 0x00001300
+#define M_STREAM_TOTAL_ENCODING_TIME                  4928L // 0x00001340
+#define M_STREAM_INPUT_FRAME_NUMBER                   4992L // 0x00001380
+#define M_STREAM_ENCODED_FRAME_NUMBER                 5056L // 0x000013C0
+#define M_STREAM_ADAPTATIVE_SCALINGLIST               5120L
+/* Reserve next 448 values                     from   5184L*/
+/*                                             to     5504L*/
+#define M_STREAM_LAST_PART2                           (M_STREAM_ENCODED_FRAME_NUMBER + 63)
+
+
+
+#define M_SYS_INQUIRE_SIZEOF_INT64_START              6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+
+#define M_PROCESSING_FPGA_REGISTER_PHYSICAL_ADDRESS   6701L
+#define M_HFPGA_REGISTER_PHYSICAL_ADDRESS             6702L
+
+#define M_EXTENDED_INIT_FLAG                          6705L
+#define M_PROFINET_MAC_ADDRESS                        6706L
+
+#define M_GC_NIC_MAC_ADDRESS                          6731L
+#define M_GC_LOCAL_MAC_ADDRESS                        M_GC_NIC_MAC_ADDRESS
+/* Reserve next 7 values                       from   6732L*/
+/*                                             to     6738L*/
+#define M_GC_NIC_IP_ADDRESS                           6739L
+#define M_GC_LOCAL_IP_ADDRESS                         M_GC_NIC_IP_ADDRESS
+/* Reserve next 7 values                       from   6740L*/
+/*                                             to     6746L*/
+
+#define M_PORT(n)                                     n
+
+#define M_SYS_INQUIRE_SIZEOF_INT64_END                6799L
+
+#define M_GC_FEATURE_NODEMAP_MIL                      6951L
+
+#define M_SYS_INQUIRE_SIZEOF_DOUBLE_START             7300L
+// Inquire value with a size of double, must be in that range : 7300-7399
+
+#define M_TEMPERATURE_FPGA                            7301L
+#define M_TEMPERATURE_FPGA_MAX_MEASURED               7302L
+#define M_VOLTAGE_FGPA_VCCINT                         7303L
+#define M_VOLTAGE_FPGA_VCCINT_MIN_MEASURED            7304L
+#define M_VOLTAGE_FPGA_VCCINT_MAX_MEASURED            7305L
+#define M_VOLTAGE_FPGA_VCCAUX                         7306L
+#define M_VOLTAGE_FPGA_VCCAUX_MIN_MEASURED            7307L
+#define M_VOLTAGE_FPGA_VCCAUX_MAX_MEASURED            7308L
+#define M_TEMPERATURE_FPGA_PROCESSING                 7309L
+#define M_TEMPERATURE_FPGA_PROCESSING_MAX_MEASURED    7310L
+#define M_GC_GENICAM_VERSION                          7311L
+#define M_TEMPERATURE_CPU                             7312L
+#define M_GC_ACTION_TIME                              7313L
+#define M_VOLTAGE_FPGA_VCCBRAM                        7314L
+#define M_VOLTAGE_FPGA_VCCBRAM_MIN_MEASURED           7315L
+#define M_VOLTAGE_FPGA_VCCBRAM_MAX_MEASURED           7316L
+#define M_VOLTAGE_FPGA_VREFP                          7317L
+
+#define M_TEMPERATURE_IMAGE_SENSOR                    7320L
+/* M_TEMPERATURE_IMAGE_SENSOR + M_DEV0 ... M_DEV8   Reserved until 7328*/
+
+#define M_CLOCK_FREQUENCY_FPGA                        7330L
+/* Reserved M_CLOCK_FREQUENCY_FPGA_PROCESSING             7331L */
+#define M_SYSTEM_TIME_STAMP_VALUE                     7332L
+
+#define M_SYS_INQUIRE_SIZEOF_DOUBLE_END               7399L
+
+
+
+#define M_SYS_AUX_START                               7400L
+
+#define M_DUMMY_SYS_INQUIRE                           7401L
+#define M_USER_BIT_IN_ACTIVE_LEVEL                    7402L
+#define M_USER_BIT_PERFORMANCE_LOGS                   7403L
+
+#define M_SYS_AUX_END                                 7499L
+
+
+
+#define M_SYS_INQUIRE_UNKNOWN_SIZEOF_START            7500L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 7500-7599
+#define M_LOGICAL_TO_PHYSICAL_ADDRESS                 7501L
+/* Reserve value                                      7502L*/
+
+
+#define M_SYS_INQUIRE_UNKNOWN_SIZEOF_END              7599L
+
+#define M_SYS_DISPLAY_START                           4501L
+#define M_SYS_DISPLAY_END                             4600L
+#define M_DEV_SCREEN_MANAGER_START                    (M_APP_SCREEN_MANAGER_END+1L)    // 9250L
+#define M_DEV_SCREEN_MANAGER_END                      (M_DEV_SCREEN_MANAGER_START+49L) // 9299L
+
+// Inquire value with string type must be in that range : 7700-7799
+#define M_SYS_INQUIRE_STRING_START                    7700L
+   #define M_GPU_TYPE                              (7700L|M_CLIENT_ENCODING)
+   #define M_SYSTEM_DESCRIPTOR                     (7701L|M_CLIENT_ENCODING)
+   #define M_SYSTEM_NAME                           (7702L|M_CLIENT_ENCODING)
+   #define M_SERIAL_NUMBER                         (7703L|M_CLIENT_ENCODING)
+   #define M_DISTRIBUTED_MIL_REMOTE_COMPUTER_NAME  (7704L|M_CLIENT_ENCODING)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_NETWORK_ADDRESS                       (7704L|M_CLIENT_ENCODING)
+#endif
+   #define M_SYSTEM_TYPE_STRING                    (7705L|M_CLIENT_ENCODING)
+   #define M_TRANSPORT_PROTOCOL                    (7706L|M_CLIENT_ENCODING)
+   #define M_GC_GENICAM_UI                         (7707L|M_CLIENT_ENCODING)
+   #define M_DEBUG_BUFFER_PATH                     (7708L|M_CLIENT_ENCODING)
+   #define M_SYSTEM_PRINT_NAME                     (7709L|M_CLIENT_ENCODING)
+   #define M_PRODUCT_MODEL                         (7710L|M_CLIENT_ENCODING)
+   #define M_PRODUCT_SENSOR                        (7711L|M_CLIENT_ENCODING)
+   #define M_USER_NAME                             (7712L|M_CLIENT_ENCODING)
+   #define M_FPGA_DESCRIPTION                      (7713L|M_CLIENT_ENCODING)
+   #define M_GC_TRIGGER_SELECTOR                   (7714L|M_CLIENT_ENCODING)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_TRIGGER_SELECTOR                       M_GC_TRIGGER_SELECTOR
+#endif
+   #define M_DEVICE_NAME                           (MAKE_INT64(0x0000001000000000) | M_CLIENT_ENCODING)
+
+#if OldDefinesSupport
+   #define M_GPU_TYPE_SIZE                            (M_STRING_SIZE + M_GPU_TYPE)
+   #define M_SYSTEM_DESCRIPTOR_SIZE                   (M_STRING_SIZE + M_SYSTEM_DESCRIPTOR)
+   #define M_SERIAL_NUMBER_SIZE                       (M_STRING_SIZE + M_SERIAL_NUMBER)
+   #define M_DISTRIBUTED_MIL_REMOTE_COMPUTER_NAME_SIZE (M_STRING_SIZE + M_DISTRIBUTED_MIL_REMOTE_COMPUTER_NAME)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_NETWORK_ADDRESS_SIZE                     (M_STRING_SIZE + M_NETWORK_ADDRESS)
+#endif
+   #define M_SYSTEM_TYPE_STRING_SIZE                  (M_STRING_SIZE + M_SYSTEM_TYPE_STRING)
+   #define M_TRANSPORT_PROTOCOL_SIZE                  (M_STRING_SIZE + M_TRANSPORT_PROTOCOL)
+   #define M_GC_GENICAM_UI_SIZE                       (M_STRING_SIZE + M_GC_GENICAM_UI)
+   #define M_DEBUG_BUFFER_PATH_SIZE                   (M_STRING_SIZE + M_DEBUG_BUFFER_PATH)
+   #define M_SYSTEM_PRINT_NAME_SIZE                   (M_STRING_SIZE + M_SYSTEM_PRINT_NAME)
+   #define M_PRODUCT_MODEL_SIZE                       (M_STRING_SIZE + M_PRODUCT_MODEL)
+   #define M_PRODUCT_SENSOR_SIZE                      (M_STRING_SIZE + M_PRODUCT_SENSOR)
+   #define M_USER_NAME_SIZE                           (M_STRING_SIZE + M_USER_NAME)
+   #define M_FPGA_DESCRIPTION_SIZE                    (M_STRING_SIZE + M_FPGA_DESCRIPTION)
+   #define M_DEVICE_NAME_SIZE                         (M_STRING_SIZE + M_DEVICE_NAME)
+   #define M_GC_TRIGGER_SELECTOR_SIZE                 (M_STRING_SIZE + M_GC_TRIGGER_SELECTOR)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_TRIGGER_SELECTOR_SIZE                    M_GC_TRIGGER_SELECTOR_SIZE
+#endif
+
+MIL_DEPRECATED(M_GPU_TYPE_SIZE, 1040)
+MIL_DEPRECATED(M_SYSTEM_DESCRIPTOR_SIZE, 1040)
+MIL_DEPRECATED(M_SYSTEM_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_SERIAL_NUMBER_SIZE, 1040)
+MIL_DEPRECATED(M_DISTRIBUTED_MIL_REMOTE_COMPUTER_NAME_SIZE, 1040)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   MIL_DEPRECATED(M_NETWORK_ADDRESS_SIZE, 1040)
+#endif
+MIL_DEPRECATED(M_SYSTEM_TYPE_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_TRANSPORT_PROTOCOL_SIZE, 1040)
+MIL_DEPRECATED(M_GC_GENICAM_UI_SIZE, 1040)
+MIL_DEPRECATED(M_DEBUG_BUFFER_PATH_SIZE, 1040)
+MIL_DEPRECATED(M_SYSTEM_PRINT_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_PRODUCT_MODEL_SIZE, 1040)
+MIL_DEPRECATED(M_PRODUCT_SENSOR_SIZE, 1040)
+MIL_DEPRECATED(M_USER_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_FPGA_DESCRIPTION_SIZE, 1040)
+MIL_DEPRECATED(M_DEVICE_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_GC_TRIGGER_SELECTOR_SIZE, 1040)
+
+#endif
+
+#define M_SYS_INQUIRE_STRING_END                      7799L
+
+/* Reserve next values     from    M_SYS_DISPLAY_RANGE2_START    8500L 
+                           to      M_SYS_DISPLAY_RANGE2_END      8699L 
+  Display, reserved area in mildisplay.h 
+  (this is the second range we have to use, 4501L-4600L is also reserved for the displays)
+*/
+
+// Data Latch for Msys (Since M_DATA_LATCH for Mdig conflicts with M_SYS_DISPLAY_RANGE2)
+#define M_SYS_DATA_LATCH_PARSING_MODE                      8700L
+#define M_SYS_DATA_LATCH_CLOCK_FREQUENCY                   8701L
+#define M_SYS_DATA_LATCH_MAX_INDEX                         0x20 
+#define M_SYS_DATA_LATCH_INDEX_START                       8704L
+#define M_SYS_DATA_LATCH_STATE                             (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*0)
+#define M_SYS_DATA_LATCH_TYPE                              (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*1)
+#define M_SYS_DATA_LATCH_TRIGGER_SOURCE                    (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*2)
+#define M_SYS_DATA_LATCH_MODE                              (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*3)
+#define M_SYS_DATA_LATCH_BUFFER_TRIGGER_SOURCE             (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*4)
+#define M_SYS_DATA_LATCH_CALLBACK                          (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*5)
+#define M_SYS_DATA_LATCH_FLUSH_TRIGGER_SOURCE              (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*6)
+#define M_SYS_DATA_LATCH_TRIGGER_ACTIVATION                (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*7)
+// Used in the callback
+#define M_SYS_DATA_LATCH_VALUE_COUNT                       (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*8)
+#define M_SYS_DATA_LATCH_SIZE_BYTE                         (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*9)
+#define M_SYS_DATA_LATCH_VALUE_ALL                         (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*10)
+#define M_SYS_DATA_LATCH_VALUE                             (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*11)
+#define M_SYS_DATA_LATCH_EXTRACT_INDEX_FROM_TYPE(TYPE)     ((((TYPE)&~M_DATA_LATCH_INSTANCE_MASK) - M_SYS_DATA_LATCH_INDEX_START) % M_SYS_DATA_LATCH_MAX_INDEX)
+#define M_SYS_DATA_LATCH_EXTRACT_INSTANCE_FROM_TYPE(TYPE)  ((((TYPE) & M_DATA_LATCH_INSTANCE_MASK) >> M_DATA_LATCH_INSTANCE_BITSHIFT))
+#define M_SYS_DATA_LATCH_EXTRACT_TYPE(TYPE)                (((TYPE)&~M_DATA_LATCH_INSTANCE_MASK) - M_SYS_DATA_LATCH_EXTRACT_INDEX_FROM_TYPE(TYPE))
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+//Processor specific and optimization MsysInquire/MsysControl type.
+//The range between 0x00002800 to 0x00002FFF (10240L to 12287).
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#define M_CPU_FLAG_RANGE                              0x00002800L    //10240
+#define M_CPU_FLAG_RANGE_END                          0x00002FFFL    //12287
+#define M_IS_IN_CPU_FLAG_RANGE(n)                     ((((n) & ~(M_CLIENT_TEXT_ENCODING | M_STRING_SIZE)) >= M_CPU_FLAG_RANGE) && \
+                                                       (((n) & ~(M_CLIENT_TEXT_ENCODING | M_STRING_SIZE)) <= M_CPU_FLAG_RANGE_END))
+
+#define M_PROCESSOR_TYPE                              0x00002800L
+#define M_INTEL_X86                                   0x00002801L
+#define M_INTEL_IA64                                  0x00002802L
+#define M_PPC_7400                                    0x00002803L
+#define M_AMD_64                                      0x00002804L
+#define M_ARM_CORTEX_A_SERIES                         0x00002805L
+//Reserved for future processor type                  0x00002806L
+//                                                 to 0x0000281FL
+#define M_UNKNOWN_TYPE                                0x00002820L
+
+#define M_USE_SIMD                                    0x00002821L
+
+//Intel x86 specific
+#define M_USE_MMX                                     0x00002822L
+#define M_USE_SSE_INT                                 0x00002823L
+#define M_USE_SSE                                     0x00002824L
+#define M_USE_SSE2_INT                                0x00002825L
+#define M_USE_SSE2                                    0x00002826L
+#define M_USE_SSE3                                    0x00002827L
+#define M_USE_SSE4_1                                  0x00002828L
+#define M_USE_SSE4_2                                  0x00002829L
+#define M_USE_AVX                                     0x0000282AL
+#define M_USE_AVX2                                    0x0000282BL
+#define M_USE_AVX512_BASE                             0x0000282CL
+#define M_USE_AVX512_BLOCK1                           0x0000282DL
+#define M_USE_AVX512_BLOCK2                           0x0000282EL
+//Reserved for future Intel instruction set expansion 0x0000282FL
+//                                                 to 0x00002830L
+#define M_USE_AMD_3DNOW                               0x00002831L
+#define M_USE_AMD_MMX_EXTENSION                       0x00002832L
+#define M_USE_AMD_3DNOW_EXTENSION                     0x00002833L
+//Reserved for future AMD instruction set expansion   0x00002834L
+//                                                 to 0x00002840L
+#define M_CPU_FAMILY_NUMBER                           0x00002842L
+#define M_CPU_MODEL_NUMBER                            0x00002843L
+#define M_CPU_STEPPING_NUMBER                         0x00002844L
+#define M_CPU_SERIAL_NUMBER                           0x00002845L
+#define M_CPU_SIMD_BITFIELD                           0x00002846L
+
+// Reserve for sysinquire string types
+#define M_SYS_INQUIRE_CPU_STRING_START                0x00002848L
+#define M_CPU_VENDOR_NAME                       (0x00002848L|M_CLIENT_ENCODING)
+/*Reserve next values      from                 (0x00002849L|M_CLIENT_ENCODING)*/
+/*                         to                   (0x00002883L|M_CLIENT_ENCODING)*/
+
+#if OldDefinesSupport
+#define M_CPU_VENDOR_NAME_SIZE                     (M_STRING_SIZE + M_CPU_VENDOR_NAME)
+MIL_DEPRECATED(M_CPU_VENDOR_NAME_SIZE, 1040)
+#endif
+
+#define M_SYS_INQUIRE_CPU_STRING_END                  0x00002883L
+
+
+//Reserved for future processor expansion             0x00002884L
+//                                                 to 0x00002900L
+
+#define M_CPU_SUPPORT_RDTSC                           0x00002901L
+#define M_CPU_SUPPORT_ENHANCED_REP_MOVSB_STOSB        0x00002902L
+#define M_CPU_SUPPORT_AVX512_WITH_2_FMA_UNITS         0x00002903L
+//Reserved for future processor specific flags        0x00002904L
+//                                                 to 0x00002FFFL    //12287
+
+#define M_APP_INQUIRE_SYS_START                       15000L
+/*Reserve values between 15000 and 30000 for AppInquires.
+Needed for remote systems                                 */
+#define M_APP_INQUIRE_SYS_END                         30000L
+
+/* Reserve next values     from    M_TIMER_RANGE_START           0x20000L (131072) 
+                           to      M_ROTARY_RANGE_END            0x3F800L (235520)
+
+  These are range for Rotary encoder API and Timer control API
+  (Note IO function is also a range that can be used in both MsysControl and MdigControl)
+*/
+
+#define M_ALLOCATION_OVERSCAN                         0x00008000L    //32768 //This flag is also use as MbufControl/Inquire type and as buffer attribute.
+#define M_FAST_OVERSCAN_BUFFER                        M_ALLOCATION_OVERSCAN
+#define M_ALLOCATION_OVERSCAN_SIZE                    0x00008001L   //32769
+
+#define M_SYS_INQUIRE_STRING_START_1                  33000L
+
+#define M_DISCOVER_DEVICE_MODEL_NAME                  (M_SYS_INQUIRE_STRING_START_1|M_CLIENT_ENCODING)
+/* Reserve 256 values. 12000 - 12255 */
+#define M_DISCOVER_DEVICE_MANUFACTURER_NAME           ((M_SYS_INQUIRE_STRING_START_1 + (1 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 12256 - 12511 */
+#define M_DISCOVER_DEVICE_MANUFACTURER_INFO           ((M_SYS_INQUIRE_STRING_START_1 + (2 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 12512 - 12767*/
+#define M_DISCOVER_DEVICE_USER_NAME                   ((M_SYS_INQUIRE_STRING_START_1 + (3 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 12768 - 13023*/
+#define M_DISCOVER_DEVICE_VERSION                     ((M_SYS_INQUIRE_STRING_START_1 + (4 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 13024 - 13279 */
+#define M_DISCOVER_DEVICE_SERIAL_NUMBER               ((M_SYS_INQUIRE_STRING_START_1 + (5 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 13280 - 13535 */
+#define M_DISCOVER_DEVICE_INTERFACE_NAME              ((M_SYS_INQUIRE_STRING_START_1 + (6 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 13536 - 13791 */
+#define M_DISCOVER_DEVICE_STATISTICS                  ((M_SYS_INQUIRE_STRING_START_1 + (7 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 13792 - 14047 */
+#define M_DISCOVER_DEVICE_CAPABILITIES                ((M_SYS_INQUIRE_STRING_START_1 + (8 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 14048 - 14303 */
+#define M_DISCOVER_DEVICE_ADDRESS                     ((M_SYS_INQUIRE_STRING_START_1 + (9 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 14304 - 14559 */
+
+#define M_SYS_INQUIRE_STRING_END_1                    36000L
+
+
+//#define MAX_NUM_OF_SIGNAL_IN_GROUP                    0x100
+// Define to support
+// Define macros used with M_IO_SOURCE and other IO Control/Inquire to represent various signal
+
+// M_TIMERx 1 to 99
+
+#define M_GRAB_FRAME_END_SIGNAL                     120
+#define M_GRAB_FRAME_END_SIGNAL0                    M_GRAB_FRAME_END_SIGNAL
+#define M_GRAB_FRAME_END_SIGNAL1                    M_GRAB_FRAME_END_SIGNAL+1
+#define M_GRAB_FRAME_END_SIGNAL2                    M_GRAB_FRAME_END_SIGNAL+2
+#define M_GRAB_FRAME_END_SIGNAL3                    M_GRAB_FRAME_END_SIGNAL+3
+
+
+#define M_END_OF_TRANSFER_SIGNAL                      140
+#define M_END_OF_TRANSFER_SIGNAL0                     M_END_OF_TRANSFER_SIGNAL
+#define M_END_OF_TRANSFER_SIGNAL1                     M_END_OF_TRANSFER_SIGNAL+1
+#define M_END_OF_TRANSFER_SIGNAL2                     M_END_OF_TRANSFER_SIGNAL+2
+#define M_END_OF_TRANSFER_SIGNAL3                     M_END_OF_TRANSFER_SIGNAL+3
+
+
+#define M_CC_IO                                       0x100
+#define M_CC_IO1                                      M_CC_IO
+#define M_CC_IO2                                      (M_CC_IO+1)
+#define M_CC_IO3                                      (M_CC_IO+2)
+#define M_CC_IO4                                      (M_CC_IO+3)
+#define M_CC1                                         M_CC_IO1
+#define M_CC2                                         M_CC_IO2
+#define M_CC3                                         M_CC_IO3
+#define M_CC4                                         M_CC_IO4
+// Reserved value for a max of 32 CCbits
+
+#define M_LOGIC_BLOCK                               0x120
+#define M_LOGIC_BLOCK0                              M_LOGIC_BLOCK
+#define M_LOGIC_BLOCK1                              (M_LOGIC_BLOCK+1)
+#define M_LOGIC_BLOCK2                              (M_LOGIC_BLOCK+2)
+#define M_LOGIC_BLOCK3                              (M_LOGIC_BLOCK+3)
+#define M_LOGIC_BLOCK4                              (M_LOGIC_BLOCK+4)
+#define M_LOGIC_BLOCK5                              (M_LOGIC_BLOCK+5)
+#define M_LOGIC_BLOCK6                              (M_LOGIC_BLOCK+6)
+#define M_LOGIC_BLOCK7                              (M_LOGIC_BLOCK+7)
+#define M_LOGIC_BLOCK8                              (M_LOGIC_BLOCK+8)
+#define M_LOGIC_BLOCK9                              (M_LOGIC_BLOCK+9)
+#define M_LOGIC_BLOCK10                             (M_LOGIC_BLOCK+10)
+#define M_LOGIC_BLOCK11                             (M_LOGIC_BLOCK+11)
+#define M_LOGIC_BLOCK12                             (M_LOGIC_BLOCK+12)
+#define M_LOGIC_BLOCK13                             (M_LOGIC_BLOCK+13)
+#define M_LOGIC_BLOCK14                             (M_LOGIC_BLOCK+14)
+#define M_LOGIC_BLOCK15                             (M_LOGIC_BLOCK+15)
+// Reserved value up to M_TL_IO
+
+#define M_TL_IO                                     0x200
+#define M_TL_IO0                                    M_TL_IO
+#define M_TL_IO1                                    (M_TL_IO+1)
+#define M_TL_IO2                                    (M_TL_IO+2)
+#define M_TL_IO3                                    (M_TL_IO+3)
+#define M_TL_IO4                                    (M_TL_IO+4)
+#define M_TL_IO5                                    (M_TL_IO+5)
+#define M_TL_IO6                                    (M_TL_IO+6)
+#define M_TL_IO7                                    (M_TL_IO+7)
+#define M_TL_IO8                                    (M_TL_IO+8)
+#define M_TL_IO9                                    (M_TL_IO+9)
+#define M_TL_IO10                                   (M_TL_IO+10)
+#define M_TL_IO11                                   (M_TL_IO+11)
+#define M_TL_IO12                                   (M_TL_IO+12)
+#define M_TL_IO13                                   (M_TL_IO+13)
+#define M_TL_IO14                                   (M_TL_IO+14)
+#define M_TL_IO15                                   (M_TL_IO+15)
+// Reserved value up to M_TL_IO+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+#define M_TL_TRIGGER                                  0x300
+#define M_TL_TRIGGER0                                 M_TL_TRIGGER
+#define M_TL_TRIGGER1                                 (M_TL_TRIGGER+1)
+#define M_TL_TRIGGER2                                 (M_TL_TRIGGER+2)
+#define M_TL_TRIGGER3                                 (M_TL_TRIGGER+3)
+
+// Reserved value up to M_TL_TRIGGER+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+#define M_TL_EVENT                                    0x400
+#define M_TL_EVENT0                                   M_TL_EVENT
+// Reserved value up to M_TL_EVENT+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+#define M_AUX_IO                                      0x500
+#define M_AUX_IO0                                     M_AUX_IO
+#define M_AUX_IO1                                     (M_AUX_IO+1)
+#define M_AUX_IO2                                     (M_AUX_IO+2)
+#define M_AUX_IO3                                     (M_AUX_IO+3)
+#define M_AUX_IO4                                     (M_AUX_IO+4)
+#define M_AUX_IO5                                     (M_AUX_IO+5)
+#define M_AUX_IO6                                     (M_AUX_IO+6)
+#define M_AUX_IO7                                     (M_AUX_IO+7)
+#define M_AUX_IO8                                     (M_AUX_IO+8)
+#define M_AUX_IO9                                     (M_AUX_IO+9)
+#define M_AUX_IO10                                    (M_AUX_IO+10)
+#define M_AUX_IO11                                    (M_AUX_IO+11)
+#define M_AUX_IO12                                    (M_AUX_IO+12)
+#define M_AUX_IO13                                    (M_AUX_IO+13)
+#define M_AUX_IO14                                    (M_AUX_IO+14)
+#define M_AUX_IO15                                    (M_AUX_IO+15)
+#define M_AUX_IO16                                    (M_AUX_IO+16)
+#define M_AUX_IO17                                    (M_AUX_IO+17)
+#define M_AUX_IO18                                    (M_AUX_IO+18)
+#define M_AUX_IO19                                    (M_AUX_IO+19)
+#define M_AUX_IO20                                    (M_AUX_IO+20)
+#define M_AUX_IO21                                    (M_AUX_IO+21)
+#define M_AUX_IO22                                    (M_AUX_IO+22)
+#define M_AUX_IO23                                    (M_AUX_IO+23)
+#define M_AUX_IO24                                    (M_AUX_IO+24)
+#define M_AUX_IO25                                    (M_AUX_IO+25)
+#define M_AUX_IO26                                    (M_AUX_IO+26)
+#define M_AUX_IO27                                    (M_AUX_IO+27)
+#define M_AUX_IO28                                    (M_AUX_IO+28)
+#define M_AUX_IO29                                    (M_AUX_IO+29)
+#define M_AUX_IO30                                    (M_AUX_IO+30)
+#define M_AUX_IO31                                    (M_AUX_IO+31)
+#define M_AUX_IO32                                    (M_AUX_IO+32)
+#define M_AUX_IO33                                    (M_AUX_IO+33)
+#define M_AUX_IO34                                    (M_AUX_IO+34)
+#define M_AUX_IO35                                    (M_AUX_IO+35)
+#define M_AUX_IO36                                    (M_AUX_IO+36)
+#define M_AUX_IO37                                    (M_AUX_IO+37)
+#define M_AUX_IO38                                    (M_AUX_IO+38)
+#define M_AUX_IO39                                    (M_AUX_IO+39)
+#define M_AUX_IO40                                    (M_AUX_IO+40)
+#define M_AUX_IO41                                    (M_AUX_IO+41)
+#define M_AUX_IO42                                    (M_AUX_IO+42)
+#define M_AUX_IO43                                    (M_AUX_IO+43)
+#define M_AUX_IO44                                    (M_AUX_IO+44)
+#define M_AUX_IO45                                    (M_AUX_IO+45)
+#define M_AUX_IO46                                    (M_AUX_IO+46)
+#define M_AUX_IO47                                    (M_AUX_IO+47)
+#define M_AUX_IO48                                    (M_AUX_IO+48)
+#define M_AUX_IO49                                    (M_AUX_IO+49)
+#define M_AUX_IO50                                    (M_AUX_IO+50)
+#define M_AUX_IO51                                    (M_AUX_IO+51)
+#define M_AUX_IO52                                    (M_AUX_IO+52)
+#define M_AUX_IO53                                    (M_AUX_IO+53)
+#define M_AUX_IO54                                    (M_AUX_IO+54)
+#define M_AUX_IO55                                    (M_AUX_IO+55)
+#define M_AUX_IO56                                    (M_AUX_IO+56)
+#define M_AUX_IO57                                    (M_AUX_IO+57)
+#define M_AUX_IO58                                    (M_AUX_IO+58)
+#define M_AUX_IO59                                    (M_AUX_IO+59)
+#define M_AUX_IO60                                    (M_AUX_IO+60)
+#define M_AUX_IO61                                    (M_AUX_IO+61)
+#define M_AUX_IO62                                    (M_AUX_IO+62)
+#define M_AUX_IO63                                    (M_AUX_IO+63)
+// Reserved value up to M_AUX_IO+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+// The following are Rotary encoder define used as value
+#define M_ROTARY_MAX_OUTPUT                           0x10
+#define M_ROTARY_ENCODER                              0x700L
+#define M_ROTARY_ENCODER1                             (M_ROTARY_ENCODER +M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER2                             (M_ROTARY_ENCODER1+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER3                             (M_ROTARY_ENCODER2+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER4                             (M_ROTARY_ENCODER3+M_ROTARY_MAX_OUTPUT)
+// Reserved value up to M_ROTARY_ENCODER+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+// The following are user bit define used as value
+#define M_USER_BIT0                                    M_USER_BIT
+#define M_USER_BIT1                                    (M_USER_BIT+1)
+#define M_USER_BIT2                                    (M_USER_BIT+2)
+#define M_USER_BIT3                                    (M_USER_BIT+3)
+#define M_USER_BIT4                                    (M_USER_BIT+4)
+#define M_USER_BIT5                                    (M_USER_BIT+5)
+#define M_USER_BIT6                                    (M_USER_BIT+6)
+#define M_USER_BIT7                                    (M_USER_BIT+7)
+#define M_USER_BIT8                                    (M_USER_BIT+8)
+#define M_USER_BIT9                                    (M_USER_BIT+9)
+#define M_USER_BIT10                                   (M_USER_BIT+10)
+#define M_USER_BIT11                                   (M_USER_BIT+11)
+#define M_USER_BIT12                                   (M_USER_BIT+12)
+#define M_USER_BIT13                                   (M_USER_BIT+13)
+#define M_USER_BIT14                                   (M_USER_BIT+14)
+#define M_USER_BIT15                                   (M_USER_BIT+15)
+#define M_USER_BIT16                                   (M_USER_BIT+16)
+#define M_USER_BIT17                                   (M_USER_BIT+17)
+#define M_USER_BIT18                                   (M_USER_BIT+18)
+#define M_USER_BIT19                                   (M_USER_BIT+19)
+#define M_USER_BIT20                                   (M_USER_BIT+20)
+#define M_USER_BIT21                                   (M_USER_BIT+21)
+#define M_USER_BIT22                                   (M_USER_BIT+22)
+#define M_USER_BIT23                                   (M_USER_BIT+23)
+#define M_USER_BIT24                                   (M_USER_BIT+24)
+#define M_USER_BIT25                                   (M_USER_BIT+25)
+#define M_USER_BIT26                                   (M_USER_BIT+26)
+#define M_USER_BIT27                                   (M_USER_BIT+27)
+#define M_USER_BIT28                                   (M_USER_BIT+28)
+#define M_USER_BIT29                                   (M_USER_BIT+29)
+#define M_USER_BIT30                                   (M_USER_BIT+30)
+#define M_USER_BIT31                                   (M_USER_BIT+31)
+#define M_USER_BIT32                                   (M_USER_BIT+32)
+#define M_USER_BIT33                                   (M_USER_BIT+33)
+#define M_USER_BIT34                                   (M_USER_BIT+34)
+#define M_USER_BIT35                                   (M_USER_BIT+35)
+#define M_USER_BIT36                                   (M_USER_BIT+36)
+#define M_USER_BIT37                                   (M_USER_BIT+37)
+#define M_USER_BIT38                                   (M_USER_BIT+38)
+#define M_USER_BIT39                                   (M_USER_BIT+39)
+#define M_USER_BIT40                                   (M_USER_BIT+40)
+#define M_USER_BIT41                                   (M_USER_BIT+41)
+#define M_USER_BIT42                                   (M_USER_BIT+42)
+#define M_USER_BIT43                                   (M_USER_BIT+43)
+#define M_USER_BIT44                                   (M_USER_BIT+44)
+#define M_USER_BIT45                                   (M_USER_BIT+45)
+#define M_USER_BIT46                                   (M_USER_BIT+46)
+#define M_USER_BIT47                                   (M_USER_BIT+47)
+#define M_USER_BIT48                                   (M_USER_BIT+48)
+#define M_USER_BIT49                                   (M_USER_BIT+49)
+#define M_USER_BIT50                                   (M_USER_BIT+50)
+#define M_USER_BIT51                                   (M_USER_BIT+51)
+#define M_USER_BIT52                                   (M_USER_BIT+52)
+#define M_USER_BIT53                                   (M_USER_BIT+53)
+#define M_USER_BIT54                                   (M_USER_BIT+54)
+#define M_USER_BIT55                                   (M_USER_BIT+55)
+#define M_USER_BIT56                                   (M_USER_BIT+56)
+#define M_USER_BIT57                                   (M_USER_BIT+57)
+#define M_USER_BIT58                                   (M_USER_BIT+58)
+#define M_USER_BIT59                                   (M_USER_BIT+59)
+#define M_USER_BIT60                                   (M_USER_BIT+60)
+#define M_USER_BIT61                                   (M_USER_BIT+61)
+#define M_USER_BIT62                                   (M_USER_BIT+62)
+#define M_USER_BIT63                                   (M_USER_BIT+63)
+
+
+#define M_USER_BIT_TL_IO                               (M_USER_BIT+M_TL_IO)
+#define M_USER_BIT_TL_IO0                              (M_USER_BIT+M_TL_IO0)
+#define M_USER_BIT_TL_IO1                              (M_USER_BIT+M_TL_IO1)
+#define M_USER_BIT_TL_IO2                              (M_USER_BIT+M_TL_IO2)
+#define M_USER_BIT_TL_IO3                              (M_USER_BIT+M_TL_IO3)
+#define M_USER_BIT_TL_IO4                              (M_USER_BIT+M_TL_IO4)
+#define M_USER_BIT_TL_IO5                              (M_USER_BIT+M_TL_IO5)
+#define M_USER_BIT_TL_IO6                              (M_USER_BIT+M_TL_IO6)
+#define M_USER_BIT_TL_IO7                              (M_USER_BIT+M_TL_IO7)
+#define M_USER_BIT_TL_IO8                              (M_USER_BIT+M_TL_IO8)
+#define M_USER_BIT_TL_IO9                              (M_USER_BIT+M_TL_IO9)
+#define M_USER_BIT_TL_IO10                             (M_USER_BIT+M_TL_IO10)
+#define M_USER_BIT_TL_IO11                             (M_USER_BIT+M_TL_IO11)
+#define M_USER_BIT_TL_IO12                             (M_USER_BIT+M_TL_IO12)
+#define M_USER_BIT_TL_IO13                             (M_USER_BIT+M_TL_IO13)
+#define M_USER_BIT_TL_IO14                             (M_USER_BIT+M_TL_IO14)
+#define M_USER_BIT_TL_IO15                             (M_USER_BIT+M_TL_IO15)
+
+#define M_USER_BIT_CC_IO                               (M_USER_BIT+M_CC_IO)
+#define M_USER_BIT_CC_IO0                              (M_USER_BIT+M_CC_IO1)
+#define M_USER_BIT_CC_IO1                              (M_USER_BIT+M_CC_IO2)
+#define M_USER_BIT_CC_IO2                              (M_USER_BIT+M_CC_IO3)
+#define M_USER_BIT_CC_IO3                              (M_USER_BIT+M_CC_IO4)
+
+#define M_USER_BIT_TL_TRIGGER                          (M_USER_BIT+M_TL_TRIGGER)
+#define M_USER_BIT_TL_TRIGGER0                         (M_USER_BIT+M_TL_TRIGGER0)
+#define M_USER_BIT_TL_TRIGGER1                         (M_USER_BIT+M_TL_TRIGGER1)
+#define M_USER_BIT_TL_TRIGGER2                         (M_USER_BIT+M_TL_TRIGGER2)
+#define M_USER_BIT_TL_TRIGGER3                         (M_USER_BIT+M_TL_TRIGGER3)
+
+// IO Command list and IO Command list (tick table)
+#define M_IO_COMMAND_LIST                              0x600
+#define M_IO_COMMAND_LIST1                             M_IO_COMMAND_LIST
+#define M_IO_COMMAND_LIST2                             (M_IO_COMMAND_LIST1+0x20) // Reserve 32 command bit per command list
+#define M_IO_COMMAND_LIST3                             (M_IO_COMMAND_LIST2+0x20) // Reserve 32 command bit per command list
+#define M_IO_COMMAND_LIST4                             (M_IO_COMMAND_LIST3+0x20) // Reserve 32 command bit per command list
+#define M_IO_COMMAND_BIT0                              0
+#define M_IO_COMMAND_BIT1                              1
+#define M_IO_COMMAND_BIT2                              2
+#define M_IO_COMMAND_BIT3                              3
+#define M_IO_COMMAND_BIT4                              4
+#define M_IO_COMMAND_BIT5                              5
+#define M_IO_COMMAND_BIT6                              6
+#define M_IO_COMMAND_BIT7                              7
+#define M_IO_COMMAND_BIT_MASK_FLAG                     0x100000000  // Leave first 32bits to I/O cmd bits.
+#define M_IO_COMMAND_BIT_MASK(Value)                   M_IO_COMMAND_BIT_MASK_FLAG | (Value)
+#define M_REFERENCE_VALUE_CURRENT                      0x4000000000000000
+
+// New IO define
+#define M_USER_BIT_STATE                              0x00080000L
+#define M_USER_BIT_STATE_ALL                          (M_USER_BIT_BIT_MASK_ENABLED|M_USER_BIT_STATE)
+#define M_IO_FORMAT                                   0x00082000L
+#define M_IO_STATUS                                   0x00081000L
+#define M_IO_STATUS_ALL                               (M_USER_BIT_BIT_MASK_ENABLED|M_IO_STATUS)
+#define M_IO_SOURCE                                   0x00083000L
+#define M_IO_MODE                                     MIL_MAKE_CONST(0x00084000L,0x0000000000084000)
+#define M_IO_INTERRUPT_ACTIVATION                     MIL_MAKE_CONST(0x00085000L,0x0000000000085000)
+#define M_IO_INTERRUPT_TRANSITION_COUNT               MIL_MAKE_CONST(0x00086000L,0x0000000000086000)
+#define M_IO_INTERRUPT_TRANSITION_COUNT_RESET         MIL_MAKE_CONST(0x00087000L,0x0000000000087000)
+#define M_IO_DEBOUNCE_TIME                            MIL_MAKE_CONST(0x00088000L,0x0000000000088000)
+#define M_IO_INTERRUPT_STATE                          MIL_MAKE_CONST(0x00089000L,0x0000000000089000)
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+#define M_IO_INTERRUPT_SOURCE                         0x0008A000L
+#define M_IO_CHANGE                                   0x0008B000L
+#define M_IO_CHANGE_HANDLER_PTR                       0x0008B001L
+/* Reserve next 0x1000 values                    from  0x0008B002L*/
+/*                                              to    0x0008BFFFL*/
+#define M_IO_CHANGE_HANDLER_USER_PTR                  0x0008C000L
+/* Reserve next 0x1000 values                    from  0x0008C000L*/
+/*                                              to    0x0008CFFFL*/
+#define M_IO_GLITCH_FILTER_STATE                      0x0008D000L
+/* Reserve next 0x1000 values                    from  0x0008D000L*/
+/*                                              to    0x0008DFFFL*/
+#define M_TL_TRIGGER_ACTIVATION                       0x0008E000L
+/* Reserve next 0x1000 values                    from  0x0008E000L*/
+/*                                              to    0x0008EFFFL*/
+#define M_IO_INVERTER                                 0x0008F000L
+/* Reserve next 0x1000 values                    from  0x0008F000L*/
+/*                                              to    0x0008FFFFL*/
+
+#define M_AUX_IO_COUNT                                4450L
+#define M_AUX_IO_COUNT_IN                             4451L
+#define M_AUX_IO_COUNT_OUT                            4452L
+#define M_CC_IO_COUNT                                 4453L
+#define M_CC_IO_COUNT_IN                              4454L
+#define M_CC_IO_COUNT_OUT                             4455L
+#define M_TL_TRIGGER_COUNT                            4456L
+#define M_TL_TRIGGER_COUNT_IN                         4457L
+#define M_TL_TRIGGER_COUNT_OUT                        4458L
+
+//Auxiliary IO defines 4Sight
+#define M_USER_BIT_MASK                               MAKE_INT64(0x00000000EE000000)
+#define M_USER_BIT_BIT_MASK_ENABLED                   0x10000000L
+#define M_USER_BIT_INVALID_BIT_MASK                   0x01FFFFFFL
+#define M_USER_BIT_ALL                                0x000FFFFFL
+#define M_AUX_IO_ALL                                  0x00000FFFL
+#define M_NEW_USER_BIT_ALL                            (M_USER_BIT|M_AUX_IO_ALL)
+
+#define M_USER_IN_FORMAT                              0x08000000L
+#define M_USER_OUT_FORMAT                             0x04000000L
+#define M_USER_BIT_FORMAT                             0x02000000L
+#if OldDefinesSupport
+MIL_DEPRECATED(M_USER_BIT_FORMAT, 1000)     // New IO API Replaced by M_IO_FORMAT
+#endif
+#define M_USER_BIT_PRESENT                            0x40000000L
+#define M_AUX_SIGNAL_SOURCE                           0x20000000L
+#define M_AUX_SIGNAL                                  0x10000000L
+#if OldDefinesSupport
+MIL_DEPRECATED(M_AUX_SIGNAL, 1000)// abc 
+#endif
+#define M_AUX_SIGNAL_MODE                             MIL_MAKE_CONST(0x80000000L,0x0000000080000000)
+#define M_USER_BIT_MODE                               MIL_MAKE_CONST(0x80000000L,0x0000000080000000)
+#if OldDefinesSupport
+MIL_DEPRECATED(M_AUX_SIGNAL_SOURCE, 1000)     // New IO API Replaced by M_IO_SOURCE
+MIL_DEPRECATED(M_AUX_SIGNAL_MODE, 1000)     // New IO API Replaced by M_IO_MODE
+MIL_DEPRECATED(M_USER_BIT_MODE, 1000)     // New IO API Replaced by M_IO_MODE
+#endif
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+
+#define M_USER_BIT_VALUE                              M_USER_BIT     
+#define M_USER_BIT_VALUE_IN                           (M_USER_BIT | M_USER_IN_FORMAT)
+#define M_USER_BIT_VALUE_OUT                          (M_USER_BIT | M_USER_OUT_FORMAT)
+#define M_USER_BIT_INTERRUPT_MODE                     MIL_MAKE_CONST(0xC0000000L,0x00000000C0000000)
+#define M_USER_BIT_INTERRUPT_COUNT                    MIL_MAKE_CONST(0xC2000000L,0x00000000C2000000)
+#define M_USER_BIT_INTERRUPT_COUNT_RESET              MIL_MAKE_CONST(0xC4000000L,0x00000000C4000000)
+#define M_AUX_SIGNAL_DEBOUNCE_TIME                    MIL_MAKE_CONST(0xD0000000L,0x00000000D0000000)
+#define M_USER_BIT_INTERRUPT_STATE                    MIL_MAKE_CONST(0xE0000000L,0x00000000E0000000)
+#if OldDefinesSupport
+MIL_DEPRECATED(M_USER_BIT_VALUE, 1000)     // New IO API Replaced by M_USER_BIT_STATE
+MIL_DEPRECATED(M_AUX_SIGNAL_DEBOUNCE_TIME, 1000)     // New IO API Replaced by M_IO_DEBOUNCE_TIME
+MIL_DEPRECATED(M_USER_BIT_INTERRUPT_MODE, 1000)     // New IO API Replaced by M_IO_INTERRUPT_ACTIVATION
+MIL_DEPRECATED(M_USER_BIT_INTERRUPT_STATE, 1000)     // New IO API Replaced by M_IO_INTERRUPT_STATE
+MIL_DEPRECATED(M_USER_BIT_INTERRUPT_COUNT, 1000)     // New IO API Replaced by M_IO_INTERRUPT_TRANSITION_COUNT
+MIL_DEPRECATED(M_USER_BIT_INTERRUPT_COUNT_RESET, 1000)     // New IO API Replaced by M_IO_INTERRUPT_TRANSITION_COUNT_RESET
+#endif
+#define M_BIT_MASK(mask)   ( ((MIL_INT32) (mask) <= M_USER_BIT_ALL) ? (M_USER_BIT_BIT_MASK_ENABLED | ((MIL_INT32) (mask))) : (M_USER_BIT_BIT_MASK_ENABLED | M_USER_BIT_INVALID_BIT_MASK) )
+#if OldDefinesSupport
+MIL_DEPRECATED(M_BIT_MASK, 1000)     // New IO API Replaced by M_USER_BIT_STATE_ALL
+#endif
+#define M_USER_BIT_COUNT_IN                           (M_USER_BIT_VALUE_IN | M_USER_BIT_COUNT)
+#define M_USER_BIT_COUNT_OUT                          (M_USER_BIT_VALUE_OUT| M_USER_BIT_COUNT)
+#if OldDefinesSupport
+MIL_DEPRECATED(M_USER_BIT_COUNT_IN, 1000)     // New IO API Replaced by 
+MIL_DEPRECATED(M_USER_BIT_COUNT_OUT, 1000)     // New IO API Replaced by 
+#endif
+
+#define M_USER_OUT                                    1L
+/* Reserve 31 values for M_USER_OUT             from   2L*/
+/*                                              to     32L*/
+
+// SysControls for modifying the coefficients used in the Vio and Radient color space converter.
+#define M_BOARD_TO_HOST_COLOR_CONVERSION_COEFFICIENTS         MAKE_INT64(0x00000000EF000000)
+#define M_BOARD_TO_HOST_COLOR_CONVERSION_COEFFICIENTS_MASK    MAKE_INT64(0x00000000FFFF0000)
+
+#define M_COLOR_CONVERSION_COEFFICIENTS           M_BOARD_TO_HOST_COLOR_CONVERSION_COEFFICIENTS
+#define M_COLOR_CONVERSION_COEFFICIENTS_MASK      M_BOARD_TO_HOST_COLOR_CONVERSION_COEFFICIENTS_MASK
+
+#define M_MONO_TO_MONO                          0x00000001L //MONO source buffer
+#define M_MONO_TO_BGR                           0x00000002L
+#define M_MONO_TO_RGB                           0x00000003L
+#define M_MONO_TO_YUV                           0x00000004L
+#define M_MONO_TO_YCBCRSD                       0x00000005L
+#define M_MONO_TO_YCRCBSD                       M_MONO_TO_YCBCRSD //Obsolete
+#define M_MONO_TO_YCBCRHD                       0x00000006L
+#define M_MONO_TO_YCRCBHD                       M_MONO_TO_YCBCRHD //Obsolete
+#define M_BGR_TO_MONO                           0x00000007L //BGR source buffer
+#define M_BGR_TO_BGR                            0x00000008L
+#define M_BGR_TO_YUV                            0x00000009L
+#define M_BGR_TO_YCBCRSD                        0x0000000AL
+#define M_BGR_TO_YCRCBSD                        M_BGR_TO_YCBCRSD  //Obsolete
+#define M_BGR_TO_YCBCRHD                        0x0000000BL
+#define M_BGR_TO_YCRCBHD                        M_BGR_TO_YCBCRHD  //Obsolete
+#define M_RGB_TO_MONO                           0x0000000CL //RGB source buffer
+#define M_RGB_TO_RGB                            0x0000000DL
+#define M_RGB_TO_YUV                            0x0000000EL
+#define M_RGB_TO_YCBCRSD                        0x0000000FL
+#define M_RGB_TO_YCRCBSD                        M_RGB_TO_YCBCRSD  //Obsolete
+#define M_RGB_TO_YCBCRHD                        0x00000010L
+#define M_RGB_TO_YCRCBHD                        M_RGB_TO_YCBCRHD  //Obsolete
+#define M_YUV_TO_MONO                           0x00000011L //YUV source buffer
+#define M_YUV_TO_BGR                            0x00000012L
+#define M_YUV_TO_RGB                            0x00000013L
+#define M_YUV_TO_YUV                            0x00000014L
+#define M_YUV_TO_YCBCRSD                        0x00000015L
+#define M_YUV_TO_YCRCBSD                        M_YUV_TO_YCBCRSD  //Obsolete
+#define M_YUV_TO_YCBCRHD                        0x00000016L
+#define M_YUV_TO_YCRCBHD                        M_YUV_TO_YCBCRHD  //Obsolete
+#define M_YCBCRSD_TO_MONO                       0x00000017L //YCrCb SDTV source buffer
+#define M_YCRCBSD_TO_MONO                       M_YCBCRSD_TO_MONO //Obsolete
+#define M_YCBCRSD_TO_BGR                        0x00000018L
+#define M_YCRCBSD_TO_BGR                        M_YCBCRSD_TO_BGR  //Obsolete
+#define M_YCBCRSD_TO_RGB                        0x00000019L
+#define M_YCRCBSD_TO_RGB                        M_YCBCRSD_TO_RGB  //Obsolete
+#define M_YCBCRSD_TO_YUV                        0x0000001AL
+#define M_YCRCBSD_TO_YUV                        M_YCBCRSD_TO_YUV  //Obsolete
+#define M_YCBCRSD_TO_YCRCBSD                    0x0000001BL
+#define M_YCRCBSD_TO_YCRCBSD                    M_YCBCRSD_TO_YCRCBSD //Obsolete
+#define M_YCBCRHD_TO_MONO                       0x0000001CL //YCrCb HDTV source buffer
+#define M_YCRCBHD_TO_MONO                       M_YCBCRHD_TO_MONO //Obsolete
+#define M_YCBCRHD_TO_BGR                        0x0000001DL
+#define M_YCRCBHD_TO_BGR                        M_YCBCRHD_TO_BGR  //Obsolete
+#define M_YCBCRHD_TO_RGB                        0x0000001EL
+#define M_YCRCBHD_TO_RGB                        M_YCBCRHD_TO_RGB  //Obsolete
+#define M_YCBCRHD_TO_YUV                        0x0000001FL
+#define M_YCRCBHD_TO_YUV                        M_YCBCRHD_TO_YUV  //Obsolete
+#define M_YCBCRHD_TO_YCBCRHD                    0x00000020L
+#define M_YCRCBHD_TO_YCRCBHD                    M_YCBCRHD_TO_YCBCRHD //Obsolete
+
+// !!! MAP FOR OLD DEFINES
+#if OldDefinesSupport
+#define M_SETUP                                       M_DEFAULT
+MIL_DEPRECATED(M_SETUP, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_FORMAT                M_PRIMARY_SURFACE_FORMAT
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_FORMAT, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_SIZE_BITS             M_PRIMARY_SURFACE_SIZE_BITS
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_SIZE_BITS, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_SIZE_X                M_PRIMARY_SURFACE_SIZE_X
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_SIZE_X, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_SIZE_Y                M_PRIMARY_SURFACE_SIZE_Y
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_SIZE_Y, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_PITCH_BYTE            M_PRIMARY_SURFACE_PITCH_BYTE
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_PITCH_BYTE, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_MEM_PTR               4515
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_MEM_PTR, 1000)
+#define M_DDRAW_LIVE_VIDEO_FORMAT_SUPPORTED           M_UNDERLAY_LIVE_FORMAT_SUPPORTED
+MIL_DEPRECATED(M_DDRAW_LIVE_VIDEO_FORMAT_SUPPORTED, 1000)
+#define M_DDRAW_UNDERLAY_FORMAT_SUPPORTED             M_UNDERLAY_FORMAT_SUPPORTED
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_FORMAT_SUPPORTED, 1000)
+#define M_DDRAW_UNDERLAY_SUPPORTED                    M_UNDERLAY_SUPPORTED
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_SUPPORTED, 1000)
+#define M_DDRAW_UNDERLAY_ZOOM_MAX                     M_UNDERLAY_ZOOM_MAX
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_ZOOM_MAX, 1000)
+#define M_DDRAW_UNDERLAY_ZOOM_MIN                     M_UNDERLAY_ZOOM_MIN
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_ZOOM_MIN, 1000)
+#define M_LIVE_GRAB_END_TRIGGER                       M_GRAB_CONTINUOUS_END_TRIGGER
+MIL_DEPRECATED(M_LIVE_GRAB_END_TRIGGER, 1000)
+#define M_LAST_GRAB_IN_ACTUAL_BUFFER                  M_LAST_GRAB_IN_TRUE_BUFFER
+MIL_DEPRECATED(M_LAST_GRAB_IN_ACTUAL_BUFFER, 1000)
+#define M_SYS_TYPE                                    M_SYSTEM_TYPE
+MIL_DEPRECATED(M_SYS_TYPE, 1000)
+#define M_SYS_NUMBER                                  M_NUMBER
+MIL_DEPRECATED(M_SYS_NUMBER, 1000)
+#define M_SYS_INIT_FLAG                               M_INIT_FLAG
+MIL_DEPRECATED(M_SYS_INIT_FLAG, 1000)
+#define M_SYS_DISPLAY_NUM                             4548
+MIL_DEPRECATED(M_SYS_DISPLAY_NUM, 1000)
+#define M_SYS_DISPLAY_TYPE                            M_DISPLAY_TYPE
+MIL_DEPRECATED(M_SYS_DISPLAY_TYPE, 1000)
+#define M_SYS_DIGITIZER_NUM                           M_DIGITIZER_NUM
+MIL_DEPRECATED(M_SYS_DIGITIZER_NUM, 1000)
+#define M_SYS_DIGITIZER_TYPE                          M_DIGITIZER_TYPE
+MIL_DEPRECATED(M_SYS_DIGITIZER_TYPE, 1000)
+#define M_SYS_PROCESSOR_NUM                           M_PROCESSOR_NUM
+MIL_DEPRECATED(M_SYS_PROCESSOR_NUM, 1000)
+#define M_SYS_BOARD_TYPE                              M_BOARD_TYPE
+MIL_DEPRECATED(M_SYS_BOARD_TYPE, 1000)
+#define M_SYS_BOARD_REVISION                          M_BOARD_REVISION
+MIL_DEPRECATED(M_SYS_BOARD_REVISION, 1000)
+#define M_SYS_TUNER_NUM                               M_TUNER_NUM
+MIL_DEPRECATED(M_SYS_TUNER_NUM, 1000)
+#define M_SYS_TUNER_TYPE                              M_TUNER_TYPE
+MIL_DEPRECATED(M_SYS_TUNER_TYPE, 1000)
+#define M_SYS_RGB_MODULE_NUM                          M_RGB_MODULE_NUM
+MIL_DEPRECATED(M_SYS_RGB_MODULE_NUM, 1000)
+#define M_SYS_RGB_MODULE_TYPE                         M_RGB_MODULE_TYPE
+MIL_DEPRECATED(M_SYS_RGB_MODULE_TYPE, 1000)
+#define M_SYS_DUAL_SCREEN_MODE                        4518
+MIL_DEPRECATED(M_SYS_DUAL_SCREEN_MODE, 1000)
+#define M_SYS_UNDERLAY_SURFACE_AVAILABLE              4517
+MIL_DEPRECATED(M_SYS_UNDERLAY_SURFACE_AVAILABLE, 1000)
+#define M_SYS_UNDERLAY_SURFACE_PHYSICAL_ADDRESS       M_PHYSICAL_ADDRESS_UNDERLAY
+MIL_DEPRECATED(M_SYS_UNDERLAY_SURFACE_PHYSICAL_ADDRESS, 1000)
+#define M_SYS_WIN_MODE                                M_WIN_MODE
+MIL_DEPRECATED(M_SYS_WIN_MODE, 1000)
+#define M_ON_BOARD_MEM_ADRS                           M_PHYSICAL_ADDRESS_UNDERLAY
+MIL_DEPRECATED(M_ON_BOARD_MEM_ADRS, 1000)
+#define M_ON_BOARD_VGA_ADRS                           4508
+MIL_DEPRECATED(M_ON_BOARD_VGA_ADRS, 1000)
+#define MMX_EXTRA_BYTES                               M_MMX_EXTRA_BYTES
+MIL_DEPRECATED(MMX_EXTRA_BYTES, 1000)
+#define M_LOCATION_WORK_HOST                          M_SYSTEM_HOST_TYPE
+MIL_DEPRECATED(M_LOCATION_WORK_HOST, 1000)
+#define M_DMA_POOL_FREE                               M_NON_PAGED_MEMORY_FREE
+MIL_DEPRECATED(M_DMA_POOL_FREE, 1000)
+#define M_DMA_POOL_USED                               M_NON_PAGED_MEMORY_USED
+MIL_DEPRECATED(M_DMA_POOL_USED, 1000)
+#define M_DMA_POOL_SIZE                               M_NON_PAGED_MEMORY_SIZE
+MIL_DEPRECATED(M_DMA_POOL_SIZE, 1000)
+#define M_BOTH_FIELD                                  M_BOTH_FIELDS
+MIL_DEPRECATED(M_BOTH_FIELD, 1000)
+
+#define M_FPGA_TEMPERATURE                            M_TEMPERATURE_FPGA
+MIL_DEPRECATED(M_FPGA_TEMPERATURE, 1000)
+#define M_FPGA_TEMPERATURE_MAX_MEASURED               M_TEMPERATURE_FPGA_MAX_MEASURED
+MIL_DEPRECATED(M_FPGA_TEMPERATURE_MAX_MEASURED, 1000)
+#define M_FPGA_VOLTAGE_VCCINT                         M_VOLTAGE_FGPA_VCCINT
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCINT, 1000)
+#define M_FPGA_VOLTAGE_VCCINT_MIN_MEASURED            M_VOLTAGE_FPGA_VCCINT_MIN_MEASURED
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCINT_MIN_MEASURED, 1000)
+#define M_FPGA_VOLTAGE_VCCINT_MAX_MEASURED            M_VOLTAGE_FPGA_VCCINT_MAX_MEASURED
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCINT_MAX_MEASURED, 1000)
+#define M_FPGA_VOLTAGE_VCCAUX                         M_VOLTAGE_FPGA_VCCAUX
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCAUX, 1000)
+#define M_FPGA_VOLTAGE_VCCAUX_MIN_MEASURED            M_VOLTAGE_FPGA_VCCAUX_MIN_MEASURED
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCAUX_MIN_MEASURED, 1000)
+#define M_FPGA_VOLTAGE_VCCAUX_MAX_MEASURED            M_VOLTAGE_FPGA_VCCAUX_MAX_MEASURED
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCAUX_MAX_MEASURED, 1000)
+#define M_PROCESSING_FPGA_TEMPERATURE                 M_TEMPERATURE_FPGA_PROCESSING
+MIL_DEPRECATED(M_PROCESSING_FPGA_TEMPERATURE, 1000)
+#define M_PROCESSING_FPGA_TEMPERATURE_MAX_MEASURED    M_TEMPERATURE_FPGA_PROCESSING_MAX_MEASURED
+MIL_DEPRECATED(M_PROCESSING_FPGA_TEMPERATURE_MAX_MEASURED, 1000)
+
+#endif // !!! MAP FOR OLD DEFINES
+
+/************************************************************************/
+/* MsysInquire() / MsysControl() Values                                 */
+/************************************************************************/
+
+#define M_FORCE                                       -9998L
+#define M_L1                                              1L
+
+//Values for the M_MPEG_BIT_RATE_MODE
+#define M_CONSTANT                                    0x8000L
+#define M_VARIABLE                                    2L
+#define M_VARIABLE_MAX                                3L
+#define M_CONSTANT_QUALITY                            4L
+
+#define M_BASIC                                       0x00200000L
+#define M_ADVANCED                                    0x00400000L
+
+#define M_PROFILE_BASELINE                            102L
+#define M_PROFILE_MAIN                                103L
+#define M_PROFILE_HIGH                                104L
+#define M_PROFILE_EXTENDED                            105L
+#define M_PROFILE_HIGH10                              106L
+#define M_PROFILE_HIGH422                             107L
+#define M_PROFILE_HIGH444                             108L
+#define M_PROFILE_CAVLC                               109L
+
+#define M_FRAME_RATE_24                               110L
+#define M_FRAME_RATE_24M                              111L
+#define M_FRAME_RATE_25                               112L
+#define M_FRAME_RATE_30                               113L
+#define M_FRAME_RATE_30M                              114L
+#define M_FRAME_RATE_50                               115L
+#define M_FRAME_RATE_60                               116L
+#define M_FRAME_RATE_60M                              117L
+
+
+
+// M_MODIFIED_BUFFER_HOOK_MODE values
+#define M_MULTI_THREAD                                0x1000
+#define M_SINGLE_THREAD                               0x2000
+#define M_NO_LIMIT                                    0x4000
+
+// M_IO_SOURCE+M_AUX_IOn values
+// Reserve lower 16 bits for combinations (M_DIGITIZER_DEV0+ ...)
+#define M_DIGITIZER_DEVx_INDEX_OFFSET                 16
+#define M_DIGITIZER_DEVx_INDEX_MASK                   (0xFF << M_DIGITIZER_DEVx_INDEX_OFFSET)
+#define M_DIGITIZER_DEVx_GET_INDEX(X)                 ((((M_DIGITIZER_DEVx_INDEX_MASK & X ) >> M_DIGITIZER_DEVx_INDEX_OFFSET ) - 1))
+#define M_DIGITIZER_DEV0                              0x010000
+#define M_DIGITIZER_DEV1                              0x020000
+#define M_DIGITIZER_DEV2                              0x030000
+#define M_DIGITIZER_DEV3                              0x040000
+#define M_DIGITIZER_DEV4                              0x050000
+#define M_DIGITIZER_DEV5                              0x060000
+#define M_DIGITIZER_DEV6                              0x070000
+#define M_DIGITIZER_DEV7                              0x080000
+#define M_DIGITIZER_DEV8                              0x090000
+#define M_DIGITIZER_DEV9                              0x0A0000
+#define M_DIGITIZER_DEV10                             0x0B0000
+#define M_DIGITIZER_DEV11                             0x0C0000
+#define M_DIGITIZER_DEV12                             0x0D0000
+#define M_DIGITIZER_DEV13                             0x0E0000
+#define M_DIGITIZER_DEV14                             0x0F0000
+#define M_DIGITIZER_DEV15                             0x100000
+#define M_PWM                                         0x000200
+#define M_PHASE1                                      0x000400
+#define M_PHASE2                                      0x000800
+
+// Values for M_DISTRIBUTED_MIL inquire
+#define M_DMIL_NOT_USED                               0
+#define M_DMIL_LOCAL_HOST                             1
+#define M_DMIL_REMOTE                                 2
+#define M_DMIL_TCPIP                                  3
+#define M_DMIL_SHM                                    4
+#define M_DMIL_PCIE                                   5
+#define M_DMIL_SHMRT                                  6
+#define M_DMIL_UNKNOWN_PROTOCOL                       7
+
+
+/************************************************************************/
+/* Msys other defines                                                   */
+/************************************************************************/
+// Maximum string size for M_CPU_VENDOR_NAME inquire value
+#define M_CPU_VENDOR_NAME_MAX_SIZE                    13L
+
+// Maximum string size for M_SYSTEM_NAME inquire value
+#define M_SYSTEM_NAME_MAX_SIZE                        64L
+
+/************************************************************************/
+/* MsysHookFunction()                                                   */
+/************************************************************************/
+#define M_FEATURE_CHANGE                              26L
+#define M_GC_FIRMWARE_UPDATE_PROGRESS                 27L
+#define M_USER_BIT_CHANGE                             2244L
+
+#define M_USER_BIT_CHANGE_HANDLER_PTR                 2245L
+/* Reserve next 18 values                       from  2246L*/
+/*                                             to     2264L*/
+#define M_USER_BIT_CHANGE_HANDLER_USER_PTR             2266L
+/* Reserve next 19 values                       from  2267L*/
+/*                                             to     2285L*/
+#if OldDefinesSupport
+MIL_DEPRECATED(M_USER_BIT_CHANGE, 1000)     // New IO API Replaced by M_IO_CHANGE
+MIL_DEPRECATED(M_USER_BIT_CHANGE_HANDLER_PTR, 1000)     // New IO API Replaced by M_IO_CHANGE_HANDLER_PTR
+MIL_DEPRECATED(M_USER_BIT_CHANGE_HANDLER_USER_PTR, 1000)    // New IO API Replaced by M_IO_CHANGE_HANDLER_USER_PTR
+#endif
+
+// Values h264 encoding
+#define M_HOOK_ENCODING_END                           2304L
+/* Reserve next 62 values                       from  2305L*/
+/*                                             to     2367L*/
+#define M_WATCHDOG_BITE_WARNING                       2377
+
+#define M_IO_CHANGE                                   0x0008B000L
+#define M_IO_CHANGE_HANDLER_PTR                       0x0008B001L
+/* Reserve next 0x1000 values                    from  0x0008B002L*/
+/*                                              to    0x0008B000L*/
+#define M_IO_CHANGE_HANDLER_USER_PTR                  0x0008C000L
+/* Reserve next 0x1000 values                    from  2267L*/
+/*                                              to    2285L*/
+
+
+/************************************************************************/
+/* MsysGetHookInfo()                                                    */
+/************************************************************************/
+
+#define M_USER_BIT                              MAKE_INT64(0x00000000A0000000)
+/* Reserve next 31 values                      from   4088L*/
+/*                                             to     4118L*/
+#define M_USER_BIT_FIELD                              4181L
+#define M_IO_INTERRUPT_SOURCE                   0x0008A000L
+/* Reserve next 0x1000 values                   from  0x0008A001L*/
+/*                                              to    0x0008AFFFL*/
+
+#define M_SYSTEM_ID                             0x00020000L
+// Values h264 encoding
+#define M_HOOK_ENCODING_STREAM_PTR                      2304L
+/* Reserve next 62 values                       from  2305L*/
+/*                                             to     2367L*/
+
+/************************************************************************/
+/* MsysConfigAccess()                                                   */
+/************************************************************************/
+#define M_PCI_CONFIGURATION_SPACE                     0L
+#define M_DETECT_PCI_DEVICE                           1L
+
+
+#define M_DEFAULT                                     0x10000000L
+#define M_READ                                        1
+#define M_WRITE                                       2
+#define M_BIG_ENDIAN                                  0x00080000L
+#define M_LITTLE_ENDIAN                               0x00000200L
+
+
+#define M_PCI_VENDOR_ID                               0x00 // (16 lsb)
+#define M_PCI_DEVICE_ID                               0x00 // (16 msb)
+#define M_PCI_COMMAND                                 0x01 // (16 lsb)
+#define M_PCI_STATUS                                  0x01 // (16 msb)
+#define M_PCI_REVISION_ID                             0x02 // (byte 0)
+#define M_PCI_CLASS_CODE                              0x02 // (byte 1,2,3)
+#define M_PCI_LATENCY_TIMER                           0x03 // (byte 1)
+#define M_PCI_BASE_ADRS0                              0x04 //
+#define M_PCI_BASE_ADRS1                              0x05 //
+#define M_PCI_BASE_ADRS2                              0x06 //
+#define M_PCI_INT_LINE                                0x0F // (byte 0)
+#define M_PCI_INT_PIN                                 0x0F // (byte 1)
+
+//Auxiliary IO values
+#define M_OFF                                         0L       // Must be zero
+#define M_ON                                          1L
+#define M_INPUT                                       2L
+#define M_OUTPUT                                      3L
+#define M_EDGE_RISING                                 12L
+#define M_EDGE_FALLING                                13L
+#define M_ANY_EDGE                                    50L
+#define M_DISABLE                                     -9999L
+#define M_ENABLE                                      -9997L
+
+// POWER definition
+#define M_OFF                                         0L       // Must be zero
+#define M_ON                                          1L
+#define M_SENSE                                       10L
+#define M_UNDER_CURRENT                               14L
+#define M_OVER_CURRENT                                15L
+
+/************************************************************************/
+/* MsysIoControl/MsysIoInquire()                                        */
+/************************************************************************/
+#define M_LATCH0                                    0 // reserved, should not use
+#define M_LATCH1                                    1
+#define M_LATCH2                                    2
+#define M_LATCH3                                    3
+#define M_LATCH4                                    4
+#define M_LATCH5                                    5
+#define M_LATCH6                                    6
+#define M_LATCH7                                    7
+#define M_LATCH8                                    8
+#define M_LATCH9                                    9
+#define M_LATCH10                                   10
+#define M_LATCH11                                   11
+#define M_LATCH12                                   12
+#define M_LATCH13                                   13
+#define M_LATCH14                                   14
+#define M_LATCH15                                   15
+#define M_LATCH16                                   16
+
+// #define M_CLOCK_FREQUENCY                           5505L moved to MIL_DOUBLE range
+#define M_IO_COMMAND_COUNTER_ACTIVATION             5506L
+#define M_IO_COMMAND_CANCEL                         5507L
+
+#define M_REFERENCE_LATCH_TRIGGER_SOURCE            5510L
+// Reserve next 31 elements from 5511 to 5541
+
+#define M_REFERENCE_LATCH_ACTIVATION                5550L
+// Reserve next 31 elements from 5551 to 5581
+
+#define M_REFERENCE_LATCH_STATE                     5600L
+// Reserve next 31 elements from 5601 to 5631
+
+
+#define M_SYS_IO_INQUIRE_MIL_ID_START                 1100L
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_OWNER_SYSTEM                                1101L
+#define M_GC_ACTION_ADD_DEVICE                        1102L
+#define M_GC_ACTION_REMOVE_DEVICE                     1103L
+#define M_SYS_IO_INQUIRE_MIL_ID_END                   1199L
+
+
+#define M_SYS_IO_INQUIRE_SIZEOF_INT64_START           6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+#define M_REFERENCE_VALUE                             6700L
+#define M_IO_COMMAND_COUNTER_SOURCE                   6701L
+#define M_IO_COMMAND_LIST_NUMBER                      6702L
+#define M_IO_OBJECT_TYPE                              6703L
+
+//  Reserve next 31 element from 6702 to 6732
+#define M_SYS_IO_INQUIRE_SIZEOF_INT64_END             6799L
+
+#define M_SYS_IO_INQUIRE_SIZEOF_INT64_START2          0x40000L
+#define M_REFERENCE_LATCH_VALUE                       0x40000L
+// Reserve next 0x700 elements because we can combine in MsysGetHookInfo with M_IO_COMMAND_LISTx
+#define M_SYS_IO_INQUIRE_SIZEOF_INT64_END2            0x43000L
+
+#define M_SYS_IO_INQUIRE_SIZEOF_DOUBLE_START          7300L
+// Inquire value with a size of double, must be in that range : 7300-7399
+#define M_CLOCK_FREQUENCY                             7301L
+#define M_SYS_IO_INQUIRE_SIZEOF_DOUBLE_END            7399L
+
+
+#define M_SYS_IO_INQUIRE_UNKNOWN_SIZEOF_START         7500L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 7500-7599
+#define M_SYS_IO_INQUIRE_UNKNOWN_SIZEOF_END           7599L
+
+
+// Inquire value with string type must be in that range : 7700-7799
+#define M_SYS_IO_INQUIRE_STRING_START                 7700L
+#define M_SYS_IO_INQUIRE_STRING_END                   7799L
+
+
+/************************************************************************/
+/* MthrXxxxxx                                                           */
+/************************************************************************/
+#define M_DEFAULT                                     0x10000000L
+#define M_SIGNALED                                    0x00000010L
+#define M_NOT_SIGNALED                                0x00000020L
+#define M_AUTO_RESET                                  0x00002000L
+#define M_MANUAL_RESET                                0x00004000L
+#define M_TRACE_LOG_DISABLE                           0x00400000L
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+
+#define M_ENABLE                                      -9997L
+#define M_DISABLE                                     -9999L
+
+/************************************************************************/
+/* MthrAlloc                                                            */
+/************************************************************************/
+#define M_ALL                                         0x40000000L
+
+#define M_EVENT                                       0x00000080L
+#define M_EVENT_CREATE                                0x00000200L
+#define M_THREAD                                      M_SYSTEM_THREAD  // 0x00000100
+#define M_SELECTABLE_THREAD                           0x00001000L
+#define M_THREAD_CREATE                               0x00000800L
+#define M_THREAD_CREATE_ON_ID                         0x00002000L
+#define M_MUTEX                                       0x10000000L
+#define M_CORE_USE_BIT                                0x00001000L
+#define M_CORE_USE(X)                                 (M_CORE_USE_BIT | ((X & 0x3F) << 6))
+#define M_EXTRACT_CORE_USE(X)                         ((X >> 6) & 0x3F)
+#define M_CORE_USE_MASK                               M_CORE_USE(63)
+
+/************************************************************************/
+/* MthrControl only                                                     */
+/************************************************************************/
+#define M_THREAD_COMMANDS_ABORT                       1810L
+#define M_THREAD_SELECT                               1708L
+#define M_EVENT_SET                                   1707L
+
+#define M_LOCK                                        20480L   // 0x00005000
+#define M_UNLOCK                                      24576L   // 0x00006000
+
+#define M_THR_CONT_TYPE_MASK                          0x00FFFFFFL
+#define M_THR_CONT_TYPE(n)                            (n&M_THR_CONT_TYPE_MASK)
+
+#define M_THREAD_CURRENT                              0x01000000L
+#define M_THREAD_ALL                                  0x02000000L
+#define M_QUEUED                                      0x04000000L //To be ORed with M_THREAD_COMMANDS_ABORT
+#define M_LOW_LATENCY                                 0x00001000L // Command remove node used in ThreadCancel
+
+
+/************************************************************************/
+/* MthrControl / Inquire                                                */
+/************************************************************************/
+#define M_THREAD_MODE                                 1804L
+#define M_THREAD_TIME_SLICE                           1811L
+#define M_THREAD_PRIORITY                             1019L
+#define M_ACCELERATOR                                 1813L
+#define M_BUS_MASTER_COPY_MODE                        1815L
+#define M_NODE_SELECT                                 1816L
+#if OldDefinesSupport
+   #define M_MP_MAX_CORES                             1818L
+   MIL_DEPRECATED(M_MP_MAX_CORES, 1060)
+#endif
+#define M_PU_INSTANCE_NUMBER                          1819L
+#define M_CORE_ID                                     1820L
+
+#define M_LOCK_TRY                                    28672L   // 0x00007000
+
+#define M_IDLE                                           1L
+#define M_LOWEST                                         6L
+#define M_BELOW_NORMAL                                   7L
+#define M_NORMAL                                         8L
+#define M_ABOVE_NORMAL                                   9L
+#define M_HIGHEST                                       10L
+#define M_TIME_CRITICAL                                 15L
+
+
+/************************************************************************/
+/* MthrInquire only                                                     */
+/************************************************************************/
+#define M_NATIVE_ID                                   1016L
+#define M_EVENT_STATE                                 1706L
+#define M_EVENT_MODE                                  1709L
+#if OldDefinesSupport
+   #define M_MP_MAX_CORES_EFFECTIVE                   1710L
+   MIL_DEPRECATED(M_MP_MAX_CORES_EFFECTIVE, 1060)
+#endif
+
+
+/************************************************************************/
+/* MthrInquireMp / MthrControlMp                                        */
+/*                                                                      */
+/* The flags for these functions are the same as for                    */
+/* MappControlMp and MappInquireMp and so are not duplicated here.      */
+/************************************************************************/
+
+
+/************************************************************************/
+/* MthrWait                                                             */
+/************************************************************************/
+#define M_THREAD_END_WAIT                             0x40000000L
+#define M_EVENT_WAIT                                  0x20000000L
+#define M_EVENT_SYNCHRONIZE                           0x08000000L
+#define M_THREAD_WAIT                                 0x01000000L
+#define M_INFINITE                                    -1L
+
+#define M_MAX_TIMEOUT                                 0xFFFFFFL
+#define M_TIMEOUT_MASK                                M_MAX_TIMEOUT
+#define M_EVENT_TIMEOUT(Val)                          (((unsigned long)Val >= M_MAX_TIMEOUT) ? 0 : Val)
+#define M_THREAD_TIMEOUT(Val)                         M_EVENT_TIMEOUT(Val)
+#define M_WAIT_OPTION_WITHOUT_TIMEOUT(WaitOption)     (WaitOption&0xFF000000)
+#define M_EXTRACT_TIMEOUT(WaitOption)                 (WaitOption&M_TIMEOUT_MASK)
+
+/************************************************************************/
+/* MthrWaitMultiple                                                     */
+/************************************************************************/
+#define M_THREAD_END_WAIT                             0x40000000L
+#define M_EVENT_WAIT                                  0x20000000L
+//#define M_DEFAULT                                     0x10000000L
+#define M_EVENT_SYNCHRONIZE                           0x08000000L
+#define M_ALL_OBJECTS                                 0x04000000L
+//#define M_THREAD_WAIT                                 0x01000000L
+#define M_THREAD_END_WAIT_ALL                         M_ALL_OBJECTS+M_THREAD_END_WAIT
+#define M_EVENT_WAIT_ALL                              M_ALL_OBJECTS+M_EVENT_WAIT
+#define M_EVENT_SYNCRONIZE_ALL                        M_ALL_OBJECTS+M_EVENT_SYNCHRONIZE
+
+#define M_MAX_TIMEOUT                                 0xFFFFFFL
+#define M_TIMEOUT_MASK                                M_MAX_TIMEOUT
+#define M_EVENT_TIMEOUT(Val) (((unsigned long)Val >= M_MAX_TIMEOUT) ? 0 : Val)
+#define M_THREAD_TIMEOUT(Val) M_EVENT_TIMEOUT(Val)
+#define M_WAIT_OPTION_WITHOUT_TIMEOUT(WaitOption) (WaitOption&0xFF000000)
+#define M_WAIT_OPTION_WITHOUT_TIMEOUT_AND_ALL_OBJECTS(WaitOption) (WaitOption&0xFB000000)
+#define M_EXTRACT_TIMEOUT(WaitOption)             (WaitOption&M_TIMEOUT_MASK)
+
+#define M_MAXIMUM_WAIT_OBJECTS                        64L
+
+
+/************************************************************************/
+/* MdigAlloc() defines                                                  */
+/************************************************************************/
+#define M_GC_DEVICE_IP_ADDRESS                        1
+#define M_GC_DEVICE_NAME                              2
+#define M_DEV_NUMBER                                  3
+
+#define M_GC_DEVICE_USER_NAME                         M_GC_DEVICE_NAME
+#if OldDefinesSupport
+MIL_DEPRECATED(M_GC_DEVICE_USER_NAME, 1100)
+#endif
+//Add non-bitwise values above
+
+#define M_DIG_NON_BITWISE_MASK                        0x0000000FL
+#define M_USE_MEMORY_DCF                              0x00000010L
+#define M_DCF_REALLOC                                 0x00000020L
+#define M_SHARED_BANDWIDTH                            0x00000200L
+#define M_EMULATED                                    0x00000400L
+#define M_1394_BANDWIDTH_FLAG                         0x00000800L
+#define M_1394_BANDWIDTH(percent)   ( (((long) percent > 0) && ((long) percent <= 100)) ? (M_1394_BANDWIDTH_FLAG | ((long) percent)) : 0 )
+#define M_EXCLUSIVE_BANDWIDTH                         M_DEFAULT
+#define M_FAST                                        0x00002000L
+#define M_DEFAULT_1394                                0x00100000L
+#define M_GC_BROADCAST_MASTER                         0x00200000L
+#define M_GC_MULTICAST_MASTER                         0x00400000L
+#define M_GC_MULTICAST_SLAVE                          0x00800000L
+#define M_GC_SLAVE                                    M_GC_MULTICAST_SLAVE
+#if OldDefinesSupport
+MIL_DEPRECATED(M_GC_SLAVE, 1000)
+#endif
+#define M_GC_MULTICAST_MONITOR                        0x01000000L
+#define M_GC_XML_DOWNLOAD_SKIP                        0x00000080L
+#define M_GC_XML_FORCE_DOWNLOAD                       0x00000040L
+#define M_GC_PACKET_SIZE_NEGOTIATION_SKIP             0x00004000L
+#define M_MINIMAL                                     0x00001000L
+#define M_GC_MANIFEST_ENTRY_BIT                       0x20000000L
+#define M_GC_MANIFEST_ENTRY_SHIFT                     32
+#define M_GC_MANIFEST_ENTRY_MASK                      0xF
+#define M_GC_MANIFEST_ENTRY(N)                        (((((MIL_UINT64)N) & M_GC_MANIFEST_ENTRY_MASK) << M_GC_MANIFEST_ENTRY_SHIFT) | M_GC_MANIFEST_ENTRY_BIT)
+#define M_GC_MANIFEST_ENTRY_RESERVED_BITS             M_GC_MANIFEST_ENTRY(0xF)
+
+#define M_DIG_DEV_IS_STRING(X) (((X & M_DIG_NON_BITWISE_MASK) == M_GC_DEVICE_IP_ADDRESS) || ((X & M_DIG_NON_BITWISE_MASK) == M_GC_DEVICE_NAME))
+#define M_GC_CAMERA_ID(X) ((MIL_INT)(X))
+
+#define M_DEV0                                        0L
+#define M_DEV1                                        1L
+#define M_DEV2                                        2L
+#define M_DEV3                                        3L
+#define M_DEV4                                        4L
+#define M_DEV5                                        5L
+#define M_DEV6                                        6L
+#define M_DEV7                                        7L
+#define M_DEV8                                        8L
+#define M_DEV9                                        9L
+#define M_DEV10                                       10L
+#define M_DEV11                                       11L
+#define M_DEV12                                       12L
+#define M_DEV13                                       13L
+#define M_DEV14                                       14L
+#define M_DEV15                                       15L
+#define M_DEV16                                       16L
+#define M_DEV17                                       17L
+#define M_DEV18                                       18L
+#define M_DEV19                                       19L
+#define M_DEV20                                       20L
+#define M_DEV21                                       21L
+#define M_DEV22                                       22L
+#define M_DEV23                                       23L
+#define M_DEV24                                       24L
+#define M_DEV25                                       25L
+#define M_DEV26                                       26L
+#define M_DEV27                                       27L
+#define M_DEV28                                       28L
+#define M_DEV29                                       29L
+#define M_DEV30                                       30L
+#define M_DEV31                                       31L
+#define M_DEV32                                       32L
+#define M_DEV33                                       33L
+#define M_DEV34                                       34L
+#define M_DEV35                                       35L
+#define M_DEV36                                       36L
+#define M_DEV37                                       37L
+#define M_DEV38                                       38L
+#define M_DEV39                                       39L
+#define M_DEV40                                       40L
+#define M_DEV41                                       41L
+#define M_DEV42                                       42L
+#define M_DEV43                                       43L
+#define M_DEV44                                       44L
+#define M_DEV45                                       45L
+#define M_DEV46                                       46L
+#define M_DEV47                                       47L
+#define M_DEV48                                       48L
+#define M_DEV49                                       49L
+#define M_DEV50                                       50L
+#define M_DEV51                                       51L
+#define M_DEV52                                       52L
+#define M_DEV53                                       53L
+#define M_DEV54                                       54L
+#define M_DEV55                                       55L
+#define M_DEV56                                       56L
+#define M_DEV57                                       57L
+#define M_DEV58                                       58L
+#define M_DEV59                                       59L
+#define M_DEV60                                       60L
+#define M_DEV61                                       61L
+#define M_DEV62                                       62L
+#define M_DEV63                                       63L
+
+/************************************************************************/
+/* MdigInquire() / MdigControl() Types                                  */
+/************************************************************************/
+/************************************************************************/
+/* MdigInquire() Types MIL_INT                                          */
+/************************************************************************/
+
+//Used, as combination constants, to target board vs camera with MdigInquire/MdigControl
+#define M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK          MAKE_INT64(0x0000000300000000)
+#define M_CAMERA                                      MAKE_INT64(0x0000000100000000)
+#define M_BOARD                                       MAKE_INT64(0x0000000200000000)
+#define M_DIG_DISPATCH_IMMEDIATE                      MAKE_INT64(0x0800000000000000)
+#define M_DIG_STRIP_CAM_BIT(X)                        (X & (~M_CAMERA))
+#define M_DIG_STRIP_BRD_BIT(X)                        (X & (~M_BOARD))
+#define M_DIG_STRIP_CAM_BRD_BITS(X)                   (X & (~(M_CAMERA | M_BOARD)))
+#define M_DIG_CAM_BIT_SET(X)                          ((X & M_CAMERA) ? M_TRUE : M_FALSE)
+#define M_DIG_BRD_BIT_SET(X)                          ((X & M_BOARD) ? M_TRUE : M_FALSE)
+#define M_DIG_CAM_BRD_BITS_SET(X)                     (((X & (M_CAMERA|M_BOARD)) == (M_CAMERA|M_BOARD)) ? M_TRUE : M_FALSE)
+
+#if OldDefinesSupport
+#define M_DIG_STRING_LEN(A)                           ((A&~M_CLIENT_TEXT_ENCODING) | M_STRING_SIZE)
+MIL_DEPRECATED(M_DIG_STRING_LEN, 1000)
+#endif
+
+#define M_IRIS                                        160L
+/* Reserve next 2 value 131, 132*/
+#define M_NO_INPUT_PRESENT                            0x00000080L
+#define M_SIZE_BAND                                   1005L
+#define M_SIZE_BAND_LUT                               1006L
+#define M_SIZE_BIT                                    1007L
+#define M_TYPE                                        1008L
+#define M_NUMBER                                      1009L
+#define M_INIT_FLAG                                   1012L
+#define M_ATTRIBUTE                                   1013L
+#define M_SIGN                                        1014L
+#define M_NATIVE_ID                                   1016L
+#define M_COLOR_MODE                                  1018L
+#define M_THREAD_PRIORITY                             1019L
+#define M_OWNER_SYSTEM_TYPE                           1023L
+#define M_LOW_LEVEL_API_OBJECT                        1024L
+#define M_EFFECTIVE_SIZE_BIT                          1039L
+#define M_MIL_ID_INTERNAL                             1049L
+#define M_GENICAM_AVAILABLE                           1079L
+#define M_NUMBER_OF_FRAMES                            1080L
+#define M_SOURCE_NUMBER_OF_FRAMES                     1080L
+
+
+/************************************************************************/
+/* MdigInquire() Types MIL_ID range start                               */
+/************************************************************************/
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_DIG_INQUIRE_MIL_ID_START                    1100L
+#define M_OWNER_SYSTEM                                1101L
+#define M_LUT_ID                                      1102L
+#define M_GENTL_ANNOUNCE_BUFFER                       1103L
+#define M_GENTL_REVOKE_BUFFER                         1104L
+#define M_DRIVER_HOOK_CONTEXT_REMOTE_ID               1170L
+/* Reserve next 20 values                      from   1170L*/
+/*                                             to     1189L*/
+#define M_DRIVER_HOOK_CONTEXT_REMOTE_ID_END           1189L
+#define M_SHADING_CORRECTION_OFFSET_ID                1190L
+#define M_SHADING_CORRECTION_GAIN_ID                  1191L
+
+#define M_DIG_INQUIRE_MIL_ID_END                      1199L
+
+/************************************************************************/
+/* MdigInquire() Types MIL_INT                                          */
+/************************************************************************/
+
+#define M_SIZE_X                                      1536L // 0x600
+#define M_SIZE_Y                                      1537L // 0x601
+#define M_SIZE_Z                                      1538L // 0x602
+
+#define M_CAPTURE_RAW_DATA                            1580L
+#define M_ROTARY_ENCODER                              0x700L // 1792L
+#define M_LIVE_GRAB                                   2034L
+#define M_GRAB_CONTINUOUS_END_TRIGGER                 2038L
+#define M_LAST_GRAB_IN_TRUE_BUFFER                    2046L
+#define M_DISPLAY_DOUBLE_BUFFERING                    2071L
+#define M_SERIAL_NUMBER_0                             2099L
+#define M_SERIAL_NUMBER_1                             2100L
+#define M_TEST_IMAGE                                  2102L
+#define M_TEST_FRAME_COUNTER_DRAW                     2103L
+#define M_TEST_FRAME_COUNTER                          2104L
+
+#define M_GENTL_INTERFACE_INDEX                       2105L
+#define M_GENTL_STREAM_COUNT                          2106L
+
+#define M_CHANNEL                                     4000L  
+#define M_CHANNEL_SYNC                                M_CHANNEL + M_SYNC
+#define M_CHANNEL_SIGNAL                              M_CHANNEL + M_SIGNAL
+/* Reserve next 1 bits                         from  (4000L | 0x00800000L)*/
+#define M_CHANNEL_NUM                                 4001L
+#define M_BASE_BLACK_REF                              4002L
+
+#define M_GRAB_MODE                                   4016L
+#define M_GRAB_FRAME_NUM                              4017L
+#define M_GRAB_FIELD_NUM                              4018L
+#define M_GRAB_INPUT_GAIN                             4019L    // dependent of M_LUMINANCE and M_CHROMINANCE
+#define M_INPUT_MODE                                  4020L
+#define M_SCAN_MODE                                   4021L
+#define M_SOURCE_SIZE_X                               4022L
+#define M_SOURCE_SIZE_Y                               4023L
+#define M_SOURCE_OFFSET_X                             4024L
+#define M_SOURCE_OFFSET_Y                             4025L
+#define M_SECONDARY_SOURCE_SIZE_X                     4026L
+#define M_SECONDARY_SOURCE_SIZE_Y                     4027L
+#define M_SECONDARY_SOURCE_OFFSET_X                   4028L
+#define M_SECONDARY_SOURCE_OFFSET_Y                   4029L
+#define M_GRAB_END_HANDLER_PTR                        4030L
+#define M_SOURCE_OFFSET_Y_DYNAMIC                     4031L  //Custom define for Iris GT DUAL
+#define M_GRAB_END_HANDLER_USER_PTR                   4032L
+#define M_GRAB_START_HANDLER_PTR                      4033L
+#define M_GRAB_START_HANDLER_USER_PTR                 4035L
+#define M_GRAB_FIELD_END_HANDLER_PTR                  4036L
+#define M_GRAB_FIELD_END_HANDLER_USER_PTR             4037L
+#define M_GRAB_FIELD_END_ODD_HANDLER_PTR              4038L
+#define M_GRAB_FIELD_END_ODD_HANDLER_USER_PTR         4039L
+#define M_GRAB_FIELD_END_EVEN_HANDLER_PTR             4040L
+#define M_GRAB_FIELD_END_EVEN_HANDLER_USER_PTR        4041L
+#define M_GRAB_FRAME_END_HANDLER_PTR                  4042L
+#define M_GRAB_FRAME_END_HANDLER_USER_PTR             4043L
+#define M_GRAB_FRAME_START_HANDLER_PTR                4044L
+#define M_GRAB_FRAME_START_HANDLER_USER_PTR           4045L
+#define M_FIELD_START_HANDLER_PTR                     4046L
+#define M_FIELD_START_HANDLER_USER_PTR                4047L
+#define M_FIELD_START_ODD_HANDLER_PTR                 4048L
+#define M_FIELD_START_ODD_HANDLER_USER_PTR            4049L
+#define M_FIELD_START_EVEN_HANDLER_PTR                4050L
+#define M_FIELD_START_EVEN_HANDLER_USER_PTR           4051L
+#define M_SCALING_Y_AVAILABLE                         4052L
+#define M_GRAB_TRIGGER_SOURCE                         4053L
+#define M_GRAB_TRIGGER_ACTIVATION                     4054L
+#define M_GRAB_TRIGGER_MODE                           M_GRAB_TRIGGER_ACTIVATION
+#if OldDefinesSupport
+MIL_DEPRECATED(M_GRAB_TRIGGER_MODE, 1000)     // New IO API Replaced by M_GRAB_TRIGGER_ACTIVATION
+#endif
+#define M_SOURCE_OFFSET_BIT                           4055L
+#define M_NATIVE_CAMERA_ID                            4060L
+#define M_VCR_INPUT_TYPE                              4061L
+#define M_CLIP_SRC_SUPPORTED                          4062L
+#define M_CLIP_DST_SUPPORTED                          4063L
+#define M_HOOK_FUNCTION_SUPPORTED                     4064L
+#define M_GRAB_WINDOW_RANGE_SUPPORTED                 4065L
+#define M_GRAB_8_BITS_SUPPORTED                       4068L
+#define M_GRAB_15_BITS_SUPPORTED                      4069L
+#define M_GRAB_32_BITS_SUPPORTED                      4070L
+#define M_GRAB_EXTRA_LINE                             4071L
+#define M_GRAB_DESTRUCTIVE_IN_PROGRESS                4073L
+#define M_GRAB_START_MODE                             4074L
+#define M_GRAB_WINDOW_RANGE                           4075L
+#define M_INPUT_SIGNAL_PRESENT                        4078L
+#define M_INPUT_SIGNAL_SOURCE                         4079L
+#define M_FIELD_START_THREAD_ID                       4080L
+#define M_GRAB_FIELD_END_ODD_THREAD_ID                4081L
+#define M_GRAB_FIELD_END_EVEN_THREAD_ID               4082L
+#define M_FIELD_START_THREAD_HANDLE                   4083L
+#define M_GRAB_FIELD_END_ODD_THREAD_HANDLE            4084L
+#define M_GRAB_FIELD_END_EVEN_THREAD_HANDLE           4085L
+#define M_INPUT_TYPE                                  4086L
+
+#define M_USER_BIT_QUEUE_MODE                         4087L
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+/* Reserve next 31 values                      from   4088L*/
+/*                                             to     4118L*/
+#if MIL_COMPILE_VERSION <= 960
+#define M_USER_BIT_STATE_OLD                          4119L
+#endif
+#define M_GRAB_FAIL_CHECK                             4120L
+#define M_GRAB_FAIL_STATUS                            4121L
+#define M_GRAB_FAIL_RETRY_NUMBER                      4122L
+#define M_GRAB_ON_ONE_LINE                            4123L
+#define M_GRAB_WRITE_FORMAT                           4124L
+#define M_GRAB_LUT_PALETTE                            4125L
+#define M_GRAB_HALT_ON_NEXT_FIELD                     4126L
+#define M_GRAB_TIMEOUT                                4127L
+#define M_GRAB_IN_PROGRESS                            4128L
+#define M_FIELD_START_HOOK_WHEN_GRAB_ONLY             4129L
+#define M_GRAB_PENDING                                4130L
+#define M_PFNC_TARGET_FORMAT                          4131L
+#define M_TRANSFER_RAW_DATA                           4132L
+#define M_FORCE_RAW_DATA                              M_TRANSFER_RAW_DATA
+#if OldDefinesSupport
+MIL_DEPRECATED(M_FORCE_RAW_DATA, 1000)     // New API Replaced by M_TRANSFER_RAW_DATA
+#endif
+#define M_GC_STREAMING_MODE                           4133L
+#define M_GC_UPDATE_MULTICAST_INFO                    4134L
+#define M_3D_CONTAINER_CALIBRATION_INITIALIZATION     4135L
+#define M_EXTERNAL_CHROMINANCE                        4137L
+#define M_TUNER_FREQUENCY                             4138L
+#define M_TUNER_STANDARD                              4139L
+#define M_CLOCK_NOT_ALWAYS_VALID                      4140L
+#define M_GRAB_LINESCAN_MODE                          4141L
+#define M_GRAB_PERIOD                                 4142L
+#define M_OVERRIDE_ROUTER                             4143L
+#define M_GRAB_TRIGGER_DELAY_CLOCK_SOURCE             4144L
+#define M_GRAB_TRIGGER_DELAY_CLOCK_ACTIVATION         4145L
+#define M_GRAB_TRIGGER_DELAY_CLOCK_MODE               M_GRAB_TRIGGER_DELAY_CLOCK_ACTIVATION
+#define M_GRAB_TRIGGER_STATE                          4200L
+#define M_GRAB_TRIGGER                                M_GRAB_TRIGGER_STATE
+/* Reserve next 8 values                       from   4201L*/
+/*                                             to     4208L*/
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_TRIGGER_DELAY_CLOCK_MODE, 1000)     // New IO API Replaced by M_GRAB_TRIGGER_DELAY_CLOCK_ACTIVATION
+#endif
+
+#define M_GRAB_TRIGGER_SOFTWARE                       4209L
+#define M_DCF_REALLOC_HANDLER_PTR                     4211L
+#define M_DCF_REALLOC_HANDLER_USER_PTR                4212L
+#define M_GRAB_RESTRICTION_CHECK                      4215L
+#define M_LAST_GRAB_BUFFER                            4216L
+#define M_SYNCHRONIZE_ON_STARTED                      4218L
+#define M_GRAB_WAIT                                   4219L
+#define M_GRAB_FIELD_START_HANDLER_PTR                4220L
+#define M_GRAB_FIELD_START_HANDLER_USER_PTR           4221L
+#define M_GRAB_FIELD_START_ODD_HANDLER_PTR            4222L
+#define M_GRAB_FIELD_START_ODD_HANDLER_USER_PTR       4223L
+#define M_GRAB_FIELD_START_EVEN_HANDLER_PTR           4224L
+#define M_GRAB_FIELD_START_EVEN_HANDLER_USER_PTR      4225L
+#define M_GRAB_16_BITS_SUPPORTED                      4226L
+#define M_GRAB_24_BITS_SUPPORTED                      4227L
+#define M_INPUT_SIGNAL_HSYNC_LOCK                     4228L
+#define M_GRAB_BLOCK_SIZE                             4229L
+#define M_GRAB_DIRECTION_X                            4230L
+#define M_GRAB_DIRECTION_Y                            4231L
+#define M_GRAB_FREQ_MAX                               4232L
+#define M_GRAB_THREAD_HANDLE                          4233L
+#define M_GRAB_THREAD_ID                              4234L
+#define M_GRAB_START_THREAD_HANDLE                    4235L
+#define M_GRAB_START_THREAD_ID                        4236L
+#define M_GRAB_END_THREAD_HANDLE                      4237L
+#define M_GRAB_END_THREAD_ID                          4238L
+#define M_GRAB_PATH_OVERRIDE                          4239L
+#define M_GRAB_PATH_OVERRIDE_DCF                      4240L
+#define M_GRAB_PATH_PCI                               4241L
+#define M_GRAB_AUTOMATIC_INPUT_GAIN                   4242L
+#define M_GRAB_DISPLAY_SCALER_QUALITY                 4243L
+#define M_GRAB_VALID                                  4244L
+#define M_GRAB_FIELD_START_THREAD_HANDLE              4248L
+#define M_GRAB_FIELD_START_THREAD_ID                  4249L
+
+#define M_GRAB_FIELD_END_THREAD_HANDLE                4259L
+#define M_GRAB_FIELD_END_THREAD_ID                    4260L
+#define M_GRAB_FRAME_END_THREAD_HANDLE                4261L
+#define M_GRAB_FRAME_END_THREAD_ID                    4262L
+#define M_SET_VCOUNT                                  4263L
+#define M_JPEG_ENCODING_MODE                          4264L
+#define M_JPEG_DECODING_MODE                          4265L
+#define M_JPEG_MARKERS_ENABLE                         4266L
+#define M_JPEG_NUMBER_OF_SCAN_ENCODED                 4267L
+#define M_JPEG_INPUT_COLOR_MODE                       4268L
+#define M_JPEG_OUTPUT_COLOR_MODE                      4269L
+#define M_JPEG_IMAGE_FORMAT                           4270L
+#define M_JPEG_NAX                                    4271L
+#define M_JPEG_NAY                                    4272L
+#define M_JPEG_PAX                                    4273L
+#define M_JPEG_PAY                                    4274L
+#define M_JPEG_AUTO_START_MODE                        4275L
+#define M_JPEG_COMPRESS_MODE                          4276L
+#define M_JPEG_HW_PROG_MODE                           4277L
+#define M_HOOK_MASTER_THREAD_HANDLE                   4278L
+#define M_HOOK_MASTER_THREAD_ID                       4279L
+#define M_GRAB_PATH_RR                                4280L
+#define M_PIXCLK_JPEG_SIGNAL_PRESENT                  4281L
+#define M_GRAB_VM                                     4282L
+#define M_GARBAGE_UV_ADDRESS                          4283L
+#define M_SET_EXPOSURE_ENABLE                         4290L
+/* Reserve next 8 values                       from   4291L*/
+/*                                             to     4298L*/
+#define M_JPEG_FIRST_FIELD_SIZEBYTE                   4301L
+#define M_JPEG_SECOND_FIELD_SIZEBYTE                  4302L
+#define M_JPEG_OFFSET_X                               4303L
+#define M_JPEG_OFFSET_Y                               4304L
+#define M_CURRENT_GRAB_BUFFER_HOST_ADDRESS            4305L
+#define M_CURRENT_GRAB_BUFFER_PHYSICAL_ADDRESS        4306L
+#define M_RESET_CONTINUOUS_GRABBER                    4307L
+#define M_TIMER_INTERRUPT                             4308L
+//4309L
+#define M_TIMER_SET_INTERRUPT                         4310L
+#define M_GRAB_SAMPLING_POSITION                      4311L
+#define M_JPEG_DMA_TRANSFER                           4312L
+#define M_GRAB_FRAME_START_THREAD_HANDLE              4313L
+#define M_GRAB_FRAME_START_THREAD_ID                  4314L
+#define M_INTERNAL_GRAB_BUFFERS_NB                    4315L
+#define M_INTERNAL_GRAB_BUFFERS_FORMAT                4317L
+#define M_KS0127_REV_ID                               4318L
+#define M_DECODER_REV_ID                              M_KS0127_REV_ID
+#define M_GRAB_SCALE_MODE                             4319L
+#define M_GRAB_SCALE_MODE_X                           4320L
+#define M_GRAB_SCALE_MODE_Y                           4321L
+#define M_START_THREAD_HANDLE                         4322L
+#define M_START_THREAD_ID                             4323L
+#define M_SOURCE_COMPENSATION                         4324L
+#define M_GRAB_COLOR                                  4325L
+#define M_SYNCHRONIZE_CHANNEL                         4326L
+#define M_ODD_EVEN_CORRECTION                         4327L
+#define M_POLLING_FOR_END_OF_XFER                     4328L
+#define M_FORCE_PSEUDO_LIVE_GRAB                      4329L
+#define M_GRAB_END_HOOK                               4330L
+#define M_GRAB_START_HOOK                             4331L
+#define M_FIX_PATTERN_NOISE_CORRECTION                4332L
+#define M_EXPOSURE_MODE                               4333L
+#define M_BLACK_OFFSET                                4334L
+/* Free to use                                 from   4335*/
+/*                                             to     4339*/
+
+#define M_HOOK_FOR_PSEUDO_LIVE_GRAB                   4360L
+#define M_YIELD_FOR_END_OF_XFER                       4361L
+#define M_GRAB_SCALE_QUALITY                          4362L
+#define M_USER_BIT_INQUIRE_START                      4363L
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+/* Reserve next 31 values                      from   4088L*/
+/*                                             to     4118L*/
+#define M_USER_BIT_COUNT                              4364L
+#define M_USER_BIT_OPTOMODULE                         4365L
+#define M_USER_BIT_INQUIRE_END                        4366L
+
+#define MAX_HOST_USER_BIT_NB                                  20       // Nb of user bits available on host system
+
+#define M_GRAB_LINE_HANDLER_PTR                       4367L
+#define M_GRAB_LINE_HANDLER_USER_PTR                  4368L
+#define M_GRAB_QUEUE_SIZE                             4369L
+#define M_SECONDARY_GRAB_BUFFER                       4370L
+#define M_GRAB_FRAME_END_TIME_STAMP_BUFFER            4371L
+#define M_GRAB_BUF_MODIFIED                           4372L
+#define M_RGB_PIXEL_SWAP                              4373L
+#define M_PREFERRED_BUFFER_FORMAT                     4374L
+#define M_GRAB_IN_USER_BUFFER                         4375L
+#define M_SYNCHRONIZE_GRAB_WITH_DISPLAY_REFRESH       4376L
+#define M_LAST_GRAB_BUFFER_INDEX                      4377L
+#define M_GRAB_LINE_COUNT                             4378L
+#define M_GRAB_LINE_COUNTER                           0x0000111B //4379L
+#define M_COUPLING_MODE                               4380L
+#define M_LIGHTING_DARK_FIELD                         4381L
+#define M_LIGHT_DARK_FIELD                            M_LIGHTING_DARK_FIELD
+#define M_LIGHTING_BRIGHT_FIELD                       4382L
+#define M_LIGHT_BRIGHT_FIELD                          M_LIGHTING_BRIGHT_FIELD
+#define M_GRAB_TRIGGER_OVERLAP                        4383L
+#define M_GRAB_TRIGGER_BUFFERING                      4384L
+#define M_MILGRABC_VERSION                            4385L    // Also define as a MsysInquire
+#define M_GRAB_FRAME_BURST_COUNT                      4386L
+#define M_GRAB_FRAME_BURST_END_SOURCE                 4387L
+#define M_CURRENT_LINE_COUNT                          4388L
+#define M_GRAB_CONTROL_OFFLOAD                        4390L
+#define M_GRAB_OFFLOAD_ENGINE_PRESENT                 4391L
+/* Reserve next 4 values                       from   4392L*/
+/*                                             to     4395L*/
+
+#define M_INPUT_SIGNAL_COLOR_LOCK                     4399L
+#define M_SENSOR_RED_GAIN                             4401L
+#define M_SENSOR_GREEN_GAIN                           4402L
+#define M_SENSOR_BLUE_GAIN                            4403L
+#define M_SENSOR_GAIN                                 4404L
+
+#define M_DECODER_MODE                                  4417L
+#define M_LIGHTING_BRIGHT_FIELD_OFFSET                  4418L
+#define M_LIGHTING_BRIGHT_FIELD_HIDRIVE                 4419L
+#define M_LIGHTING_BRIGHT_FIELD_HIDRIVE_TIME            4420L
+#define M_LIGHTING_BRIGHT_FIELD_EFFECTIVE_TIME          4421L
+#define M_LIGHTING_BRIGHT_FIELD_OPTIMIZED_EXPOSURE_TIME 4422L
+#define M_LIGHTING_BRIGHT_FIELD_OPTIMIZED_INTENSITY     4423L
+#define M_LIGHTING_DARK_FIELD_EFFECTIVE_TIME            4424L
+#define M_LIGHTING_DARK_FIELD_OPTIMIZED_EXPOSURE_TIME   4425L
+#define M_LIGHTING_DARK_FIELD_OPTIMIZED_INTENSITY       4426L
+#define M_DIG_OK_TO_BE_FREED                            4427L
+#define M_GRAB_END_WAITS_FOR_HOOK_FUNCTION              4428L
+#define M_GRAB_FRAME_BURST_SIZE                         4429L
+#define M_GRAB_FRAME_BURST_START_TRIGGER_STATE          4430L
+#define M_GRAB_FRAME_BURST_START_TRIGGER_SOURCE         4431L
+#define M_GRAB_FRAME_BURST_END_TRIGGER_STATE            4432L
+#define M_GRAB_FRAME_BURST_END_TRIGGER_SOURCE           4433L
+
+#define M_AUX_IO_COUNT                                4450L
+#define M_AUX_IO_COUNT_IN                             4451L
+#define M_AUX_IO_COUNT_OUT                            4452L
+#define M_CC_IO_COUNT                                 4453L
+#define M_CC_IO_COUNT_IN                              4454L
+#define M_CC_IO_COUNT_OUT                             4455L
+#define M_TL_TRIGGER_COUNT                            4456L
+#define M_TL_TRIGGER_COUNT_IN                         4457L
+#define M_TL_TRIGGER_COUNT_OUT                        4458L
+
+#define M_EXPOSURE_OUTPUT_INVERTER                    4459L
+#define M_GRAB_TRIGGER_MISSED                         4460L
+
+#define M_TL_IO_COUNT                                 4465L
+#define M_TL_IO_COUNT_IN                              4466L
+#define M_TL_IO_COUNT_OUT                             4467L
+
+#define M_CAPTURE_LEVEL_FRAME_END                     4524L
+
+// Map of UART defines, used by Mdig and Msys
+#define M_UART_PARITY                                 4701L
+#define M_UART_STOP_BITS                              4702L
+#define M_UART_DATA_SIZE                              4703L
+#define M_UART_SPEED                                  4704L
+#define M_UART_WRITE_CHAR                             4705L
+#define M_UART_READ_CHAR                              4706L
+#define M_UART_DATA_PENDING                           4707L
+#define M_UART_WRITE_STRING                           4708L
+#define M_UART_WRITE_STRING_SIZE                      4709L
+#define M_UART_READ_STRING                            4710L
+#define M_UART_READ_STRING_SIZE                       4711L
+#define M_UART_READ_STRING_MAXIMUM_SIZE               4712L
+#define M_UART_STRING_DELIMITER                       4713L
+#define M_UART_TIMEOUT                                4714L
+#define M_UART_OUTPUT                                 4716L
+#define M_UART_THREAD_HANDLE                          4717L
+#define M_UART_THREAD_ID                              4718L
+#define M_UART_DATA_RECEIVED_HANDLER_PTR              4719L
+#define M_UART_DATA_RECEIVED_HANDLER_USER_PTR         4720L
+#define M_UART_INTERFACE_TYPE                         4721L
+#define M_UART_BYTES_WRITTEN                          4722L
+#define M_UART_BYTES_READ                             4723L
+
+#define M_NATIVE_LAST_GRAB_THREAD_ID                  4750L
+#define M_COMMAND_QUEUE_MODE                          4775L
+
+#define M_GRAB_ATTRIBUTE                              4800L
+#define M_GRAB_CONTINUOUS_ERROR                       4801L
+
+#define M_GC_CONTROL_PROTOCOL_CAPABILITY              4802L
+#define M_GC_STREAM_PROTOCOL_CAPABILITY               4803L
+#define M_GC_MESSAGE_PROTOCOL_CAPABILITY              4804L
+#define M_GC_NETWORK_INTERFACE_CAPABILITY             4805L
+#define M_GC_PHYSICAL_LINK_CONFIGURATION_CAPABILITY   4806L
+#define M_GC_STREAM_CHANNEL_CAPABILITY                4807L
+#define M_GC_NETWORK_INTERFACE_CONFIGURATION          4808L
+#define M_GC_IEEE_1588                                4809L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY                 4810L
+#define M_GC_IEEE_1588_STATUS                         4811L
+#define M_GC_EXTENDED_ID_MODE                         4812L
+
+
+#define M_LOGIC_BLOCK_FUNCTION                        4896L
+/* Reserve next 32 values                       from  4897L*/
+/*                                             to     4927L*/
+#define M_LOGIC_BLOCK_INPUT_SOURCE0                   4928L
+/* Reserve next 32 values                       from  4929L*/
+/*                                             to     4959L*/
+#define M_LOGIC_BLOCK_INPUT_SOURCE1                   4960L
+/* Reserve next 32 values                       from  4961L*/
+/*                                             to     4991L*/
+
+/* defines for 1394*/
+#define M_MIN_VALUE                                   MAKE_INT64(0x0000010000000000)
+#define M_MAX_VALUE                                   MAKE_INT64(0x0000020000000000)
+#define M_MODE_CONTROL                                0x00010000L
+#define M_ABSOLUTE_CTL_MASK                           0x00080000L
+
+#define M_BRIGHTNESS                                  5100L/* Reserve all values between 5100 and 5159*/
+#define M_EXPOSURE_AUTO                               5104L
+#define M_AUTO_EXPOSURE                               M_EXPOSURE_AUTO
+#define M_SHARPNESS                                   5108L
+#define M_WHITE_BALANCE                               5112L
+#define M_HUE                                         0x00008000L
+#define M_SATURATION                                  0x2000L
+#define M_SHUTTER                                     5120L
+#define M_GAIN                                        5124L
+#define M_FOCUS                                       5132L
+#define M_FOCUS_WAIT                                  5133L
+#define M_FOCUS_PERSISTENCE                           5134L
+#define M_FOCUS_PERSISTENT_VALUE                      5135L
+#define M_TEMPERATURE                                 5136L
+#define M_FOCUS_LENGTH                                5137L
+#define M_TRIGGER                                     5140L
+#define M_ZOOM                                        5144L
+#define M_PAN                                         5148L
+#define M_TILT                                        5152L
+#define M_OPTICAL_FILTER                              5156L
+#define M_CAPTURE_SIZE                                5160L
+#define M_CAPTURE_QUALITY                             5164L
+#define M_WHITE_BALANCE_U                             5168L
+#define M_WHITE_BALANCE_V                             5172L
+#define M_TARGET_TEMPERATURE                          5176L
+/* Reserve next 3 values                       from   5177L*/
+/*                                             to     5179L*/
+#define M_FORMAT_SUPPORTED_NUM                        5181L
+#define M_TRIGGER_SUPPORTED                           5183L
+#define M_INPUT_LOW_PASS_FILTER                       5184L
+#define M_PIXCLK_FREQ                                 5185L
+#define M_INPUT_FILTER                                5186L
+#define M_DIGITIZER_CONTROL_LOG                       5187L
+#define M_TARGET_BUFFER_UPDATE                        5188L
+#define M_DUMP_REGISTERS                              5189L
+#define M_FORMAT7_TILE_SIZE_X                         5190L
+#define M_FORMAT7_TILE_SIZE_Y                         5191L
+#define M_ADVANCED_FEATURE                            0x80000000L
+#define M_ADVANCED_FEATURE_SET_ID                     5192L
+#define M_ADVANCED_FEATURE_UNLOCK                     5193L
+#define M_CAMERA_VENDOR_ID                            5194L
+// 5195 is still free
+#define M_TRIGGER_DELAY                               5196L
+#define M_GC_PAYLOAD_SIZE                             5197L
+#define M_GC_PIXEL_FORMAT                             5198L
+
+/* defines for camera link*/
+#define M_CAMERALINK_CC1_SOURCE                       5200L
+#define M_CAMERALINK_CC2_SOURCE                       5201L
+#define M_CAMERALINK_CC3_SOURCE                       5202L
+#define M_CAMERALINK_CC4_SOURCE                       5203L
+
+#define M_WHITE_SHADING                               5204L
+#define M_SHADING_CORRECTION_GAIN                     5205L
+#define M_SHADING_CORRECTION                          5206L
+#define M_SHADING_CORRECTION_OFFSET                   5207L
+#define M_FRAME_RATE_1394                             5208L
+/* Reserve next 3 values                       from   5209L*/
+/*                                             to     5211L*/
+#define M_SHADING_BOUNDARY_BYPASS_LOW                 5215L
+#define M_SHADING_BOUNDARY_BYPASS_HIGH                5216L
+#define M_SHADING_CORRECTION_GAIN_FIXED_POINT         5217L
+#define M_SHADING_CORRECTION_GAIN_FIX_POINT           M_SHADING_CORRECTION_GAIN_FIXED_POINT
+#if OldDefinesSupport
+MIL_DEPRECATED(M_SHADING_CORRECTION_GAIN_FIX_POINT, 1100)
+#endif
+#define M_GRAB_DUAL_PHASE                             5230L
+
+#define M_SIGNAL_GAIN                                 5235L
+
+/* custom defines for IrisGT Dual */
+#define M_CUSTOM_FPGA_PROCESSING                      5240L
+#define M_CUSTOM_FPGA_PROCESSING_EROSION              5241L
+#define M_CUSTOM_FPGA_PROCESSING_MAX_SELECTOR         5242L
+
+/* defines for channel switch lock mechanism*/
+#define M_CAMERA_LOCK                                 5300L
+#define M_CAMERA_COLOR_LOCK                           5301L
+#define M_CAMERA_LOCK_SENSITIVITY                     5302L
+#define M_CAMERA_UNLOCK_SENSITIVITY                   5303L
+#define M_CAMERA_LOCKED                               5304L
+#define M_CAMERA_COLOR_LOCKED                         5305L
+#define M_CAMERA_LOCK_MODE                            5306L
+
+#define M_CAMERA_LOCK_HANDLER_PTR                     5307L
+#define M_CAMERA_LOCK_HANDLER_USER_PTR                5308L
+#define M_CAMERA_LOCK_THREAD_ID                       5309L
+#define M_CAMERA_LOCK_THREAD_HANDLE                   5310L
+
+/* defines for camera detect */
+#define M_CAMERA_PRESENT_HANDLER_PTR                  5311L
+#define M_CAMERA_PRESENT_HANDLER_USER_PTR             5312L
+#define M_CAMERA_PRESENT_THREAD_ID                    5313L
+#define M_CAMERA_PRESENT_THREAD_HANDLE                5314L
+#define M_CAMERA_PRESENT                              5315L
+#define M_CAMERA_PRESENT_SENSITIVITY                  5316L
+
+#define M_WRITE_GRAB_VALIDATION_TAG                   5317L
+
+#define M_INFO_FORMAT                                 5318L
+#define M_HV_RESET                                    5319L
+#define M_FORCE_INTERNAL_GRAB_BUFFER                  5320L
+#define M_INITIALIZATION_DELAY                        5321L
+
+#define M_BAYER_CONVERSION                            5326L
+#define M_GRAB_PROCESSING                             5327L
+#define M_BAYER_COEFFICIENTS_ID                       5328L
+#define M_ACQUISITION_PATH                            5329L
+
+#define M_GRAB_LL_SEQ_CONTEXT                         5330L
+/* Reserve next value                                 5331L*/
+
+/* Reserve next value                                 5332 */
+#define M_PROCESS_FRAME_MISSED_RESET                  5333L
+#define M_PROCESS_FRAME_MISSED                        5334L
+#define M_PROCESS_FRAME_COUNT                         5335L
+
+#define M_BUF_MODIFIED_HANDLER                        5336L
+
+#define M_DIG_PROCESS_IN_PROGRESS                     5337L
+
+#define M_GRAB_FRAME_MISSED                           5347L
+#define M_GRAB_FRAME_MISSED_COUNTER                   5348L
+#define M_GRAB_FRAME_MISSED_RESET                     5349L
+
+#define M_BAYER_DEMOSAICING                           5350L
+#define M_PROCESS_GRAB_MONITOR                        5351L
+/* Reserve next value                                 5352L */
+
+#define M_PROCESS_NUMBER_OF_FRAME                     5353L
+
+
+#define M_PROCESS_TIMEOUT                             5364L
+#define M_BAYER_PATTERN                               5365L
+
+#define M_LAST_DRIVER_HOOK_CONTEXT_ID                 5366L
+#define M_ROTARY_ENCODER_HANDLER_PTR                  5400L
+#define M_ROTARY_ENCODER_HANDLER_USER_PTR             5401L
+/* Reserve next 4  values                      from   5402*/
+/*                                             to     5405L*/
+
+#define M_MOTION_DETECT_SENSITIVITY_LEVEL             5406L
+#define M_MOTION_DETECT_SPATIAL_SENSITIVITY_LEVEL     5407L
+#define M_MOTION_DETECT_TEMPORAL_SENSITIVITY_LEVEL    5408L
+#define M_MOTION_DETECT_VELOCITY_LEVEL                5409L
+#define M_MOTION_DETECT_FIELD_SELECT                  5410L
+#define M_MOTION_DETECT_MASK_BUFFER_ID                5411L
+#define M_MOTION_DETECT_MATRICE_SIZE_X                5412L
+#define M_MOTION_DETECT_MATRICE_SIZE_Y                5413L
+#define M_MOTION_DETECT_RESULT_BUFFER_ID              5414L
+
+#define M_BLIND_DETECT_SENSITIVITY_LEVEL              5415L
+#define M_BLIND_DETECT_TEMPORAL_LEVEL                 5416L
+
+#define M_NIGHT_DETECT_SENSITIVITY_LEVEL              5417L
+#define M_NIGHT_DETECT_TEMPORAL_LEVEL                 5418L
+
+#define M_HARDWARE_DEINTERLACING                      5449L
+#define M_DIGITIZER_FILTER_TYPE                       5450L
+#if OldDefinesSupport
+#define M_DIGITIZER_SCALING_MODE                      5451L // Replaced by M_INPUT_FILTER
+MIL_DEPRECATED(M_DIGITIZER_SCALING_MODE, 1000)
+#define M_DIGITIZER_INTERPOLATION_MODE                5452L // Replaced by M_GRAB_SCALE_INTERPOLATION_MODE
+MIL_DEPRECATED(M_DIGITIZER_INTERPOLATION_MODE, 1000)
+#endif
+#define M_GRAB_SCALE_INTERPOLATION_MODE               5452L
+#define M_SYNCHRONIZE_OUTPUT                          5453L
+#define M_SYNCHRONIZE_OUTPUT_VALUE                    5454L
+
+
+#define M_CONNECTION_TEST_MODE                        5600
+/* Reserve next 16 values                      from   5601L*/
+/* To be used with M_CONNECTIONx               to     5615L*/
+
+
+/*Reserve values between M_DIG_SUPPORT_START_NO
+and M_DIG_SUPPORT_END_NO*/
+#define M_DIG_SUPPORT_START_NO                        5900L
+#define M_IS_EMULATED                                 5900L
+#define M_DIG_SUPPORT_END_NO                          5949L
+/*Reserve values between M_DIG_SUPPORT_START_YES
+and M_DIG_SUPPORT_START_YES*/
+#define M_DIG_SUPPORT_START_YES                       5950L
+#define M_DIG_SUPPORT_END_YES                         5999L
+
+
+/************************************************************************/
+/* MdigInquire() Types MIL_DOUBLE range start                           */
+/************************************************************************/
+
+#define M_DIG_INQUIRE_SIZEOF_DOUBLE_START             6000L
+// Inquire value with a size of double, must be in that range : 6000-6699
+
+#define M_GRAB_SCALE                                  6600L
+#define M_GRAB_SCALE_X                                6601L
+#define M_GRAB_SCALE_Y                                6602L
+#define M_GRAB_SUBSAMPLE                              6603L
+#define M_GRAB_SUBSAMPLE_X                            6604L
+#define M_GRAB_SUBSAMPLE_Y                            6605L
+#define M_SELECTED_FRAME_RATE                         6606L
+#define M_PROCESS_FRAME_RATE                          6607L
+#define M_GRAB_FRAME_BURST_MAX_TIME                   6608L
+#define M_GC_THEORETICAL_INTER_PACKET_DELAY           6609L
+#define M_GAIN_DIGITAL                                6610L
+#define M_SELECTED_FRAME_RATE_FOR_BUFFER              6611L
+#define M_EXPOSURE_TIME_MAX_FOR_BUFFER                6612L
+#define M_FOCUS_TEMPERATURE                           6613L
+
+#define M_GRAB_ABORT                                  6643L
+#define M_GRAB_FRAME_END_DELAY                        6644L
+#define M_GC_FRAME_TIMESTAMP                          6645L
+#define M_GRAB_TRIGGER_DELAY                          6646L
+#define M_TEMPERATURE_SENSOR                          6647L
+#define M_GRAB_SCALE_X_SUPPORTED                      6648L
+#define M_GRAB_SCALE_Y_SUPPORTED                      6649L
+#define M_BLACK_REF_DOUBLE                            6650L
+#define M_WHITE_REF_DOUBLE                            6651L
+#define M_BLACK_REF                                   M_BLACK_REF_DOUBLE
+#define M_WHITE_REF                                   M_WHITE_REF_DOUBLE
+
+#define M_EXPOSURE_TIME                               6652L
+#define M_EXPOSURE_TIME_MAX                           6653L
+#define M_EXPOSURE_DELAY                              6654L
+
+#define M_HUE_REF                                     6655L
+#define M_SATURATION_REF                              6656L
+#define M_BRIGHTNESS_REF                              6657L
+#define M_CONTRAST_REF                                6658L
+
+#define M_EXPOSURE_TIME2                              6659L
+#define M_EXPOSURE_DELAY2                             6660L
+
+#define M_GAMMA                                       6672L
+/* Reserve next 3 values                       from   6673L*/
+/*                                             to     6675L*/
+
+#define M_DIGITIZER_FILTER_SIGMA                      6689L
+
+#define M_DIG_INQUIRE_SIZEOF_DOUBLE_END               6699L
+
+/************************************************************************/
+/* MdigInquire() Types MIL_INT64 range start                            */
+/************************************************************************/
+#define M_DIG_INQUIRE_SIZEOF_INT64_START              6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+#define M_GC_MAC_ADDRESS                              6701L
+#define M_GC_REMOTE_MAC_ADDRESS                       M_GC_MAC_ADDRESS
+#define M_GC_IP_ADDRESS                               6702L
+#define M_GC_REMOTE_IP_ADDRESS                        M_GC_IP_ADDRESS
+#define M_GC_COUNTER_TICK_FREQUENCY                   6703L
+#define M_GC_TOTAL_BYTES_RECEIVED                     6704L
+
+#define M_EXTENDED_INIT_FLAG                          6705L
+#define M_SOURCE_DATA_FORMAT                          6706L
+#if OldDefinesSupport
+#define M_SOURCE_BUFFER_FORMAT                    M_SOURCE_DATA_FORMAT
+MIL_DEPRECATED(M_SOURCE_BUFFER_FORMAT, 1000)
+#endif
+
+#define M_GC_TOTAL_FRAMES_GRABBED                     6707L
+#define M_GC_TOTAL_FRAMES_CORRUPTED                   6708L
+#define M_GC_TOTAL_PACKETS_MISSED                     6709L
+#define M_GC_TOTAL_PACKETS_RECEIVED                   6710L
+#define M_GC_TOTAL_PACKETS_RESENDS_NUM                6711L
+#define M_GC_TOTAL_PACKETS_RECOVERED                  6712L
+#define M_GC_TOTAL_PACKETS_TIMEOUT                    6713L
+#define M_GC_TOTAL_PACKETS_RECEIVED_OUT_OF_ORDER      6714L
+#define M_GC_TOTAL_PACKET_CACHE_HITS                  6715L
+#define M_GC_TOTAL_FRAME_CACHE_HITS                   6716L
+#define M_GC_TOTAL_FRAMES_MISSED                      6717L
+#define M_GC_TOTAL_PACKETS_NOT_COPIED                 6718L
+
+#define M_DEFAULT_IO_DEVICE                           6730L
+#define M_GC_NIC_MAC_ADDRESS                          6731L
+#define M_GC_LOCAL_MAC_ADDRESS                        M_GC_NIC_MAC_ADDRESS
+/* Reserve next 7 values                       from   6732L*/
+/*                                             to     6738L*/
+#define M_GC_NIC_IP_ADDRESS                           6739L
+#define M_GC_LOCAL_IP_ADDRESS                         M_GC_NIC_IP_ADDRESS
+/* Reserve next 7 values                       from   6740L*/
+/*                                             to     6746L*/
+
+#define M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS         6747L
+#define M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS        6748L
+#define M_GC_FRAME_BLOCK_ID64                         6749L
+
+#define M_TARGET_BUFFER_OBJECT                        6750L
+#define M_TARGET_BUFFER_ATTRIBUTE                     6751L
+
+#define M_CONNECTION_TEST_ERROR_COUNT                 6752L
+/* Reserve next 16 values                      from   6753L*/
+/* To be used with M_CONNECTIONx               to     6767L*/
+#define M_CONNECTION_TEST_PACKET_TRANSMITTED_COUNT      6768L
+/* Reserve next 16 values                      from   6769L*/
+/* To be used with M_CONNECTIONx               to     6783L*/
+#define M_CONNECTION_TEST_PACKET_RECEIVED_COUNT       6784L
+/* Reserve next 16 values                      from   6785L*/
+/* To be used with M_CONNECTIONx               to     6799L*/
+
+#define M_DIG_INQUIRE_SIZEOF_INT64_END                6799L
+/************************************************************************/
+/* MdigInquire() Types unknown                                          */
+/************************************************************************/
+
+#define M_DIG_INQUIRE_UNKNOWN_SIZEOF_START            6800L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 6800-6899
+#define M_INTERNAL_GRAB_BUFFERS_ID                    6801L
+#define M_INTERNAL_GRAB_BUFFER_MIL_ID                 6804L
+
+#define M_DIG_INQUIRE_UNKNOWN_SIZEOF_END              6899L
+/************************************************************************/
+/* MdigInquire() Types MIL_INT                                          */
+/************************************************************************/
+
+#define M_GC_PACKET_SIZE                              6900L
+#define M_GC_HEARTBEAT_TIMEOUT                        6901L
+#define M_GC_HEARTBEAT                                M_GC_HEARTBEAT_TIMEOUT
+#define M_GC_COMMAND_TIMEOUT                          6902L
+#define M_GC_COMMAND_RETRY                            6903L
+#define M_GC_FEATURE_BROWSER                          6905L
+#define M_GC_FEATURE_NODEMAP                          6906L
+#define M_GC_INTER_PACKET_DELAY                       6907L
+#define M_GC_ACQUISITION_MODE                         6908L
+#define M_GC_ETHERNET_LINK_SPEED                      6909L
+#define M_GC_HEARTBEAT_STATE                          6910L
+
+#define M_GC_PACKET_RESEND                            6911L
+#define M_GC_STREAM_PORT                              6912L
+#define M_GC_LOCAL_STREAM_PORT                        M_GC_STREAM_PORT
+#define M_GC_READ_REGISTER                            6914L
+#define M_GC_WRITE_REGISTER                           6915L
+#define M_GC_READ_MEMORY                              6916L
+#define M_GC_WRITE_MEMORY                             6917L
+#define M_GC_PIXEL_FORMAT_SWITCHING                   6918L
+#if OldDefinesSupport
+#define M_GC_PIXELFORMAT_SWITCHING                    M_GC_PIXEL_FORMAT_SWITCHING
+MIL_DEPRECATED(M_GC_PIXELFORMAT_SWITCHING, 1000)
+#endif
+
+
+
+#define M_NIC_FILTERING                               6921L
+#define M_GC_FEATURE_BROWSER_HWND                     6922L
+#define M_CORRUPTED_FRAME                             6923L
+#define M_CORRUPTED_FRAME_ERROR                       6924L
+#define M_PROCESS_FRAME_CORRUPTED                     6925L
+#define M_PROCESS_PENDING_GRAB_NUM                    6926L
+#define M_PROCESS_TOTAL_BUFFER_NUM                    6927L
+
+#define M_GC_STREAMING_STOP                           6928L
+#define M_GC_STREAMING_STOP_CHECK_PERIOD              6929L
+#define M_GC_STREAMING_STOP_DELAY                     6930L
+#define M_GC_STREAMING_START                          6931L
+#define M_GC_NUMBER_OF_STREAM_CHANNELS                6932L
+
+
+#define M_GC_MESSAGE_PORT                             6936L
+#define M_GC_LOCAL_MESSAGE_PORT                       M_GC_MESSAGE_PORT
+
+#define M_GC_SCHEMA_MAJOR                             6937L
+#define M_GC_SCHEMA_MINOR                             6938L
+#define M_GC_XML_MAJOR                                6939L
+#define M_GC_XML_MINOR                                6940L
+#define M_GC_XML_SUBMINOR                             6941L
+#define M_GC_MULTICAST_MASTER_CONNECTED               6942L
+#define M_GC_MAX_NBR_PACKETS_OUT_OF_ORDER             6943L
+#define M_GC_FRAME_MAX_RETRIES                        6944L
+#define M_GC_PACKET_MAX_TIMEOUT                       6945L
+#define M_GC_PACKET_MAX_RETRIES                       6946L
+#define M_GC_MAX_LEADING_PACKET_MISSED                6947L
+#define M_GC_FRAME_TIMEOUT                            6948L
+#define M_GC_PACKET_TIMEOUT                           6949L
+#define M_GC_FEATURE_NODEMAP_MIL                      6951L
+#define M_GC_LOCAL_CONTROL_PORT                       6952L
+#define M_GC_REMOTE_CONTROL_PORT                      6953L
+#define M_GC_REMOTE_STREAM_PORT                       6954L
+#define M_GC_REMOTE_MESSAGE_PORT                      6955L
+
+#define M_GC_PACKET_TIMEOUT_NUM                       6956L
+#define M_GC_PACKETS_MISSED                           6957L
+#define M_GC_PACKETS_RECEIVED                         6958L
+#define M_GC_PACKETS_RESENDS_NUM                      6959L
+#define M_GC_PACKETS_RECOVERED                        6960L
+#define M_GC_FRAME_ERROR_CODE                         6961L
+#define M_GC_FRAME_LINE_COUNT                         6962L
+#define M_GC_FRAME_BLOCK_ID                           6963L
+#define M_GC_FRAME_BYTES_RECEIVED                     6964L
+
+#define M_GC_FRAME_OFFSET_X                           6965L
+#define M_GC_FRAME_OFFSET_Y                           6966L
+#define M_GC_FRAME_SIZE_X                             6967L
+#define M_GC_FRAME_SIZE_Y                             6968L
+#define M_GC_FRAME_PIXEL_TYPE                         6969L
+
+#define M_GC_STATISTICS_RESET                         6970L
+#define M_GC_FIREWALL_PRESENT                         6971L
+
+#define M_GC_FRAME_STATUS_CODE                        6972L
+
+#define M_GC_FEATURE_POLLING                          6973L
+
+#define M_GC_CLPROTOCOL                               6974L
+#define M_GC_CLPROTOCOL_DEVICE_ID_NUM                 6975L
+#define M_GC_CLPROTOCOL_DEVICE_ID_SIZE_MAX            6976L
+
+#define M_GC_LINK_RESET                               6977L
+#define M_GC_EVENT_TRANSFER_SIZE                      6978L
+#define M_GC_STREAMING_TRANSFER_SIZE                  6979L
+#define M_GC_COMMAND_IN_PACKET_SIZE                   6980L
+#define M_GC_COMMAND_OUT_PACKET_SIZE                  6981L
+
+
+
+#if OldDefinesSupport
+#define M_GC_CLPROTOCOL_DEVICEID_NUM                  M_GC_CLPROTOCOL_DEVICE_ID_NUM
+MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID_NUM, 1000)
+#define M_GC_CLPROTOCOL_DEVICEID_SIZE_MAX             M_GC_CLPROTOCOL_DEVICE_ID_SIZE_MAX
+MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID_SIZE_MAX, 1000)
+#endif
+/************************************************************************/
+/* MdigInquire() Types MIL_TEXT_PTR range start                            */
+/************************************************************************/
+
+#define M_DIG_INQUIRE_STRING_START                    7700L
+
+   #define M_FORMAT                                         (7701L|M_CLIENT_ENCODING)
+   #define M_FORMAT_SUPPORTED                               (7702L|M_CLIENT_ENCODING)
+   #define M_SERIAL_NUMBER                                  (7703L|M_CLIENT_ENCODING)
+   #define M_CAMERA_VENDOR                                  (7704L|M_CLIENT_ENCODING)
+   #define M_GC_VERSION                                     (7705L|M_CLIENT_ENCODING)
+   #define M_GC_SPECIFIC_INFO                               (7706L|M_CLIENT_ENCODING)
+   #define M_GC_USER_NAME                                   (7707L|M_CLIENT_ENCODING)
+   #define M_GC_SERIAL_NUMBER                               (7708L|M_CLIENT_ENCODING)
+   #define M_GC_FEATURE_BROWSER_NODES                       (7709L|M_CLIENT_ENCODING)
+   #define M_FORMAT_DETECTED                                (7710L|M_CLIENT_ENCODING)
+   #define M_CAMERA_MODEL                                   (7711L|M_CLIENT_ENCODING)
+   #define M_GC_GET_STREAMABLE_FEATURES                     (7712L|M_CLIENT_ENCODING)
+   #define M_GC_IP_ADDRESS_STRING                           (7713L|M_CLIENT_ENCODING)
+   #define M_GC_REMOTE_IP_ADDRESS_STRING                    M_GC_IP_ADDRESS_STRING
+   #define M_GC_MAC_ADDRESS_STRING                          (7714L|M_CLIENT_ENCODING)
+   #define M_GC_REMOTE_MAC_ADDRESS_STRING                   M_GC_MAC_ADDRESS_STRING
+   #define M_GC_UNIQUE_ID_STRING                            (M_GC_MAC_ADDRESS_STRING|M_CLIENT_ENCODING)
+   #define M_GC_NIC_IP_ADDRESS_STRING                       (7715L|M_CLIENT_ENCODING)
+   #define M_GC_LOCAL_IP_ADDRESS_STRING                     M_GC_NIC_IP_ADDRESS_STRING
+   #define M_GC_NIC_MAC_ADDRESS_STRING                      (7716L|M_CLIENT_ENCODING)
+   #define M_GC_LOCAL_MAC_ADDRESS_STRING                    M_GC_NIC_MAC_ADDRESS_STRING
+   #define M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING     (7717L|M_CLIENT_ENCODING)
+   #define M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING    (7718L|M_CLIENT_ENCODING)
+   #define M_GC_CLPROTOCOL_DEVICE_ID                        (7730L|M_CLIENT_ENCODING)
+   /* Reserve next 128 values                from           (7731L|M_CLIENT_ENCODING) */
+   /*                                        to             (7857L|M_CLIENT_ENCODING) */
+   #define M_GC_CLPROTOCOL_DEVICE_ID_DEFAULT                (7859L|M_CLIENT_ENCODING)
+   #define M_GC_INTERFACE_NAME                              (7860L|M_CLIENT_ENCODING)
+   #define M_GC_XML_PATH                                    (7861L|M_CLIENT_ENCODING)
+   #define M_GC_PIXEL_FORMAT_STRING                         (7878L|M_CLIENT_ENCODING)
+
+#define M_DIG_INQUIRE_STRING_END                               7999L
+/************************************************************************/
+/* MdigInquire() Types MIL_INT                                          */
+/************************************************************************/
+
+#if OldDefinesSupport
+   #define M_FORMAT_SIZE                                       (M_STRING_SIZE + M_FORMAT)
+   #define M_FORMAT_SUPPORTED_SIZE                             (M_STRING_SIZE + M_FORMAT_SUPPORTED)
+//   #define M_SERIAL_NUMBER_SIZE                                (M_STRING_SIZE + M_SERIAL_NUMBER)
+   #define M_CAMERA_VENDOR_SIZE                                (M_STRING_SIZE + M_CAMERA_VENDOR)
+   #define M_GC_VERSION_SIZE                                   (M_STRING_SIZE + M_GC_VERSION)
+   #define M_GC_SPECIFIC_INFO_SIZE                             (M_STRING_SIZE + M_GC_SPECIFIC_INFO)
+   #define M_GC_USER_NAME_SIZE                                 (M_STRING_SIZE + M_GC_USER_NAME)
+   #define M_GC_SERIAL_NUMBER_SIZE                             (M_STRING_SIZE + M_GC_SERIAL_NUMBER)
+   #define M_FORMAT_DETECTED_SIZE                              (M_STRING_SIZE + M_FORMAT_DETECTED)
+   #define M_CAMERA_MODEL_SIZE                                 (M_STRING_SIZE + M_CAMERA_MODEL)
+   #define M_GC_GET_STREAMABLE_FEATURES_SIZE                   (M_STRING_SIZE + M_GC_GET_STREAMABLE_FEATURES)
+   #define M_GC_IP_ADDRESS_STRING_SIZE                         (M_STRING_SIZE + M_GC_IP_ADDRESS_STRING)
+   #define M_GC_REMOTE_IP_ADDRESS_STRING_SIZE                  M_GC_IP_ADDRESS_STRING_SIZE
+   #define M_GC_MAC_ADDRESS_STRING_SIZE                        (M_STRING_SIZE + M_GC_MAC_ADDRESS_STRING)
+   #define M_GC_REMOTE_MAC_ADDRESS_STRING_SIZE                 M_GC_MAC_ADDRESS_STRING_SIZE
+   #define M_GC_UNIQUE_ID_STRING_SIZE                          (M_STRING_SIZE + M_GC_UNIQUE_ID_STRING)
+   #define M_GC_NIC_IP_ADDRESS_STRING_SIZE                     (M_STRING_SIZE + M_GC_NIC_IP_ADDRESS_STRING)
+   #define M_GC_LOCAL_IP_ADDRESS_STRING_SIZE                   M_GC_NIC_IP_ADDRESS_STRING_SIZE
+   #define M_GC_NIC_MAC_ADDRESS_STRING_SIZE                    (M_STRING_SIZE + M_GC_NIC_MAC_ADDRESS_STRING)
+   #define M_GC_LOCAL_MAC_ADDRESS_STRING_SIZE                  M_GC_NIC_MAC_ADDRESS_STRING_SIZE
+   #define M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING_SIZE   (M_STRING_SIZE + M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING)
+   #define M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING_SIZE  (M_STRING_SIZE + M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING)
+   #define M_GC_CLPROTOCOL_DEVICE_ID_SIZE                      (M_STRING_SIZE + M_GC_CLPROTOCOL_DEVICE_ID)
+   #define M_GC_INTERFACE_NAME_SIZE                            (M_STRING_SIZE + M_GC_INTERFACE_NAME)
+   #define M_GC_XML_PATH_SIZE                                  (M_STRING_SIZE + M_GC_XML_PATH)
+   #define M_GC_PIXEL_FORMAT_STRING_SIZE                       (M_STRING_SIZE + M_GC_PIXEL_FORMAT_STRING)
+
+MIL_DEPRECATED(M_FORMAT_SIZE, 1040)
+MIL_DEPRECATED(M_FORMAT_SUPPORTED_SIZE, 1040)
+MIL_DEPRECATED(M_CAMERA_VENDOR_SIZE, 1040)
+MIL_DEPRECATED(M_GC_VERSION_SIZE, 1040)
+MIL_DEPRECATED(M_GC_SPECIFIC_INFO_SIZE, 1040)
+MIL_DEPRECATED(M_GC_USER_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_GC_SERIAL_NUMBER_SIZE, 1040)
+MIL_DEPRECATED(M_FORMAT_DETECTED_SIZE, 1040)
+MIL_DEPRECATED(M_CAMERA_MODEL_SIZE, 1040)
+MIL_DEPRECATED(M_GC_GET_STREAMABLE_FEATURES_SIZE, 1040)
+MIL_DEPRECATED(M_GC_IP_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_MAC_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_UNIQUE_ID_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_NIC_IP_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_NIC_MAC_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICE_ID_SIZE, 1040)
+MIL_DEPRECATED(M_GC_INTERFACE_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_GC_XML_PATH_SIZE, 1040)
+MIL_DEPRECATED(M_GC_PIXEL_FORMAT_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_SOFTWARE_TRIGGER_SOURCE_NAME_SIZE, 1040)
+
+#endif
+
+
+#define M_GRAB_ERROR_HALT_GRAB                        8000L
+#define M_GRAB_ERROR_CHECK_PIXEL                      8001L
+#define M_GRAB_ERROR_CHECK_SYNC                       8002L
+#define M_GRAB_ERROR_RESET                            8003L
+#define M_GRAB_ERROR_STATUS                           8004L
+#define M_GRAB_ERROR_COUNT                            8005L
+#define M_GAIN_AUTO_BALANCE                           8006L
+
+#define M_VIDEO_OUTPUT                                8007L
+#define M_VIDEO_OUTPUT_TILE                           8008L
+#define M_VIDEO_OUTPUT_CHANNELS                       8009L
+#define M_VIDEO_OUTPUT_INTERVAL                       8010L
+
+/* Reserve next 400 values                     from   8304L*/
+/*                                             to     8799L*/
+/* Reserve 16 index per type. */
+#define M_DATA_LATCH_INSTANCE_BITSHIFT                  (16)
+#define M_DATA_LATCH_INSTANCE_MASK                      (0xffff << M_DATA_LATCH_INSTANCE_BITSHIFT)
+#define M_VALUE_INDEX(Instance)                        (Instance << M_DATA_LATCH_INSTANCE_BITSHIFT)
+#define M_DATA_LATCH_PARSING_MODE                      8300L
+#define M_DATA_LATCH_CLOCK_FREQUENCY                   8301L
+#define M_DATA_LATCH_BUFFER_HOST_ADDRESS               8302L
+#define M_DATA_LATCH_MAX_INDEX                         0x20 
+#define M_DATA_LATCH_INDEX_START                       8304L
+#define M_DATA_LATCH_STATE                             (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*0)
+#define M_DATA_LATCH_TYPE                              (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*1)
+#define M_DATA_LATCH_TRIGGER_SOURCE                    (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*2)
+#define M_DATA_LATCH_MODE                              (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*3)
+#define M_DATA_LATCH_BUFFER_TRIGGER_SOURCE             (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*4)
+#define M_DATA_LATCH_CALLBACK                          (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*5)
+#define M_DATA_LATCH_FLUSH_TRIGGER_SOURCE              (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*6)
+#define M_DATA_LATCH_TRIGGER_ACTIVATION                (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*7)
+// Used in the callback
+#define M_DATA_LATCH_VALUE_COUNT                       (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*8)
+#define M_DATA_LATCH_SIZE_BYTE                         (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*9)
+#define M_DATA_LATCH_VALUE_ALL                         (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*10)
+#define M_DATA_LATCH_VALUE                             (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*11)
+#define M_DATA_LATCH_EXTRACT_INDEX_FROM_TYPE(TYPE)     ((((TYPE)&~M_DATA_LATCH_INSTANCE_MASK) - M_DATA_LATCH_INDEX_START) % M_DATA_LATCH_MAX_INDEX)
+#define M_DATA_LATCH_EXTRACT_INSTANCE_FROM_TYPE(TYPE)  ((((TYPE) & M_DATA_LATCH_INSTANCE_MASK) >> M_DATA_LATCH_INSTANCE_BITSHIFT))
+#define M_DATA_LATCH_EXTRACT_TYPE(TYPE)                (((TYPE)&~M_DATA_LATCH_INSTANCE_MASK) - M_DATA_LATCH_EXTRACT_INDEX_FROM_TYPE(TYPE))
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_TIMER_STATE                                 0x20000L
+#define M_GRAB_EXPOSURE                               M_TIMER_STATE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE, 1000)     // New IO API Replaced by M_TIMER_STATE
+#endif
+      /* Reserve next 100 values                     from   0x20001L*/
+      /*                                             to     0x20063L*/
+#define M_TIMER_TRIGGER_SOURCE                        0x20064L
+#define M_GRAB_EXPOSURE_SOURCE                        M_TIMER_TRIGGER_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_SOURCE, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_SOURCE
+#endif
+      /* Reserve next 100 values                     from   0x20065L*/
+      /*                                             to     0x200C7L*/
+#define M_TIMER_OUTPUT_INVERTER                       0x200C8L
+#define M_GRAB_EXPOSURE_MODE                          M_TIMER_OUTPUT_INVERTER
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_MODE, 1000)     // New IO API Replaced by M_TIMER_OUTPUT_INVERTER
+#endif
+      /* Reserve next 100 values                     from   0x200C9L*/
+      /*                                             to     0x2012BL*/
+#define M_TIMER_DELAY_CLOCK_ACTIVATION                0x2012CL
+#define M_GRAB_EXPOSURE_DELAY_CLOCK_MODE              M_TIMER_DELAY_CLOCK_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_DELAY_CLOCK_MODE, 1000)     // New IO API Replaced by M_TIMER_DELAY_CLOCK_ACTIVATION
+#endif
+      /* Reserve next 100 values                     from   0x2012DL*/
+      /*                                             to     0x2018FL*/
+#define M_TIMER_DELAY_CLOCK_SOURCE                    0x20190L
+#define M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE            M_TIMER_DELAY_CLOCK_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE, 1000)     // New IO API Replaced by M_TIMER_DELAY_CLOCK_SOURCE
+#endif
+      /* Reserve next 100 values                     from   0x20191L*/
+      /*                                             to     0x201F3L*/
+
+#define M_TIMER_TRIGGER_ACTIVATION                    0x201F4L
+#define M_GRAB_EXPOSURE_TRIGGER_MODE                  M_TIMER_TRIGGER_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MODE, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_ACTIVATION
+#endif
+      /* Reserve next 100 values                     from   0x201F5L*/
+      /*                                             to     0x20257L*/
+#define M_TIMER_CLOCK_SOURCE                          0x20258L
+#define M_GRAB_EXPOSURE_CLOCK_SOURCE                  M_TIMER_CLOCK_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_CLOCK_SOURCE, 1000)     // New IO API Replaced by M_TIMER_CLOCK_SOURCE
+#endif
+      /* Reserve next 100 values                     from   0x20259L*/
+      /*                                             to     0x202BBL*/
+#define M_TIMER_USAGE                                 0x202BCL
+#define M_GRAB_EXPOSURE_USAGE                         M_TIMER_USAGE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_USAGE, 1000)     // New IO API Replaced by M_TIMER_USAGE
+#endif
+      /* Reserve next 100 values                     from   0x202BDL*/
+      /*                                             to     0x2031FL*/
+#define M_TIMER_TRIGGER_MISSED                        0x20320L
+#define M_GRAB_EXPOSURE_TRIGGER_MISSED                M_TIMER_TRIGGER_MISSED
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MISSED, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_MISSED
+#endif
+      /* Reserve next 100 values                     from   0x20321L*/
+      /*                                             to     0x20383L*/
+#define M_TIMER_TRIGGER_MISSED_STATUS                 0x20384L
+#define M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS         M_TIMER_TRIGGER_MISSED_STATUS
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_MISSED_STATUS
+#endif
+      /* Reserve next 100 values                     from   0x20385L*/
+      /*                                             to     0x203E7L*/
+#define M_TIMER_TRIGGER_RATE_DIVIDER                  0x203E8L
+#define M_GRAB_EXPOSURE_TRIGGER_DIVIDER               M_TIMER_TRIGGER_RATE_DIVIDER
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_DIVIDER, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_RATE_DIVIDER
+#endif
+      /* Reserve next 100 values                     from   0x203E9L*/
+      /*                                             to     0x2044BL*/
+
+#define M_TIMER_TRIGGER_SOFTWARE                      0x2044CL
+      /* Reserve next 100 values                     from   0x2044DL*/
+      /*                                             to     0x204AFL*/
+
+#define M_TIMER_ARM                                   0x204B0L
+#define M_GRAB_EXPOSURE_ARM                           M_TIMER_ARM
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM, 1000)     // New IO API Replaced by M_TIMER_ARM
+#endif
+      /* Reserve next 100 values                     from   0x204B1L*/
+      /*                                             to     0x20513L*/
+#define M_TIMER_ARM_SOURCE                            0x20514L
+#define M_GRAB_EXPOSURE_ARM_SOURCE                    M_TIMER_ARM_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM_SOURCE, 1000)     // New IO API Replaced by M_TIMER_ARM_SOURCE
+#endif
+      /* Reserve next 100 values                     from   0x20515L*/
+      /*                                             to     0x20577L*/
+#define M_TIMER_ARM_ACTIVATION                        0x20578L
+#define M_GRAB_EXPOSURE_ARM_MODE                      M_TIMER_ARM_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM_MODE, 1000)     // New IO API Replaced by M_TIMER_ARM_ACTIVATION
+#endif
+      /* Reserve next 100 values                     from   0x20579L*/
+      /*                                             to     0x205DBL*/
+
+#define M_TIMER_ARM_SOFTWARE                          0x205DCL
+      /* Reserve next 100 values                     from   0x205DDL*/
+      /*                                             to     0x2063FL*/
+
+#define M_TIMER_CLOCK_ACTIVATION                      0x20640L
+      /* Reserve next 100 values                     from   0x20641L*/
+      /*                                             to     0x206A3L*/
+#define M_TIMER_TRIGGER_OVERLAP                       0x20708L
+      /* Reserve next 100 values                     from   0x20709L*/
+      /*                                             to     0x2076BL*/
+#define M_TIMER_RESET_SOURCE                         0x2076CL
+
+      /* Reserve next 100 values                     from   0x2076DL*/
+      /* For future M_TIMER FUNCTIONNALITY           to     0x207CFL*/
+
+/************************************************************************/
+/* MdigInquire() Types MIL_DOUBLE                                       */
+/************************************************************************/
+#define M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_START   0x207D0L
+
+#define M_TIMER_DURATION_MAX                          0x207D0L
+#define M_GRAB_EXPOSURE_TIME_MAX                      M_TIMER_DURATION_MAX
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME_MAX, 1000)     // New IO API Replaced by M_TIMER_DURATION_MAX
+#endif
+      /* Reserve next 100 values                     from   0x207D1L*/
+      /*                                             to     0x20833L*/
+#define M_TIMER_DURATION                              0x20834L
+#define M_GRAB_EXPOSURE_TIME                          M_TIMER_DURATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME, 1000)     // New IO API Replaced by M_TIMER_DURATION
+#endif
+      /* Reserve next 100 values                     from   0x20835L*/
+      /*                                             to     0x20897L*/
+#define M_TIMER_DELAY                                 0x20898L
+#define M_GRAB_EXPOSURE_TIME_DELAY                    M_TIMER_DELAY
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME_DELAY, 1000)     // New IO API Replaced by M_TIMER_DELAY
+#endif
+      /* Reserve next 100 values                     from   0x20899L*/
+      /*                                             to     0x208FBL*/
+#define M_TIMER_CLOCK_FREQUENCY                       0x208FCL
+#define M_GRAB_EXPOSURE_CLOCK_FREQUENCY               M_TIMER_CLOCK_FREQUENCY
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_CLOCK_FREQUENCY, 1000)     // New IO API Replaced by M_TIMER_CLOCK_FREQUENCY
+#endif
+      /* Reserve next 100 values                     from   0x208FDL*/
+      /*                                             to     0x2095FL*/
+#define M_TIMER_TIMEOUT                               0x20960L
+#define M_GRAB_EXPOSURE_TIMEOUT                       M_TIMER_TIMEOUT
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIMEOUT, 1000)     // New IO API Replaced by M_TIMER_TIMEOUT
+#endif
+      /* Reserve next 100 values                     from   0x20961L*/
+      /*                                             to     0x209C3L*/
+#define M_TIMER_VALUE                                 0x209C4L
+#define M_GRAB_EXPOSURE_MEASURED                      M_TIMER_VALUE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_MEASURED, 1000)     // New IO API Replaced by M_TIMER_VALUE
+#endif
+      /* Reserve next 100 values                     from   0x209C5L*/
+      /*                                             to     0x20A27L*/
+#define M_TIMER_DURATION2                              0x20A28L
+      /* Reserve next 100 values                     from   0x20A29L*/
+      /*                                             to     0x20A8BL*/
+#define M_TIMER_DELAY2                                 0x20A8CL
+      /* Reserve next 100 values                     from   0x20A8DL*/
+      /*                                             to     0x20AEFL*/
+#define M_TIMER_DELAY_CLOCK_FREQUENCY                  0x20AF0L
+      /* Reserve next 100 values                     from   0x20AF1L*/
+      /*                                             to     0x20A53L*/
+      /* Reserve next 100 values                     from   0x20B54L*/
+      /* For future M_TIMER FUNCTIONNALITY           to     0x20BB7L*/
+
+#define M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_END           0x20BB8L
+#else
+#define M_TIMER_STATE                                 0x20000L
+#define M_GRAB_EXPOSURE                               M_TIMER_STATE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE, 1000)     // New IO API Replaced by M_TIMER_STATE
+#endif
+      /* Reserve next 128 values                     from   0x20001L*/
+      /*                                             to     0x2007FL*/
+#define M_TIMER_TRIGGER_SOURCE                        0x20080L
+#define M_GRAB_EXPOSURE_SOURCE                        M_TIMER_TRIGGER_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_SOURCE, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_SOURCE
+#endif
+      /* Reserve next 128 values                     from   0x20081L*/
+      /*                                             to     0x200FFL*/
+#define M_TIMER_OUTPUT_INVERTER                       0x20100L
+#define M_GRAB_EXPOSURE_MODE                          M_TIMER_OUTPUT_INVERTER
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_MODE, 1000)     // New IO API Replaced by M_TIMER_OUTPUT_INVERTER
+#endif
+      /* Reserve next 128 values                     from   0x20101LL*/
+      /*                                             to     0x2017FLL*/
+#define M_TIMER_DELAY_CLOCK_ACTIVATION                0x20180L
+#define M_GRAB_EXPOSURE_DELAY_CLOCK_MODE              M_TIMER_DELAY_CLOCK_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_DELAY_CLOCK_MODE, 1000)     // New IO API Replaced by M_TIMER_DELAY_CLOCK_ACTIVATION
+#endif
+      /* Reserve next 128 values                     from   0x20181LL*/
+      /*                                             to     0x201FFLL*/
+#define M_TIMER_DELAY_CLOCK_SOURCE                    0x20200L
+#define M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE            M_TIMER_DELAY_CLOCK_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE, 1000)     // New IO API Replaced by M_TIMER_DELAY_CLOCK_SOURCE
+#endif
+      /* Reserve next 128 values                     from   0x20201L*/
+      /*                                             to     0x2027FL*/
+
+#define M_TIMER_TRIGGER_ACTIVATION                    0x20280L
+#define M_GRAB_EXPOSURE_TRIGGER_MODE                  M_TIMER_TRIGGER_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MODE, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_ACTIVATION
+#endif
+      /* Reserve next 128 values                     from   0x20281L*/
+      /*                                             to     0x202FFL*/
+#define M_TIMER_CLOCK_SOURCE                          0x20300L
+#define M_GRAB_EXPOSURE_CLOCK_SOURCE                  M_TIMER_CLOCK_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_CLOCK_SOURCE, 1000)     // New IO API Replaced by M_TIMER_CLOCK_SOURCE
+#endif
+      /* Reserve next 128 values                     from   0x20301L*/
+      /*                                             to     0x2037FL*/
+#define M_TIMER_USAGE                                 0x20380L
+#define M_GRAB_EXPOSURE_USAGE                         M_TIMER_USAGE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_USAGE, 1000)     // New IO API Replaced by M_TIMER_USAGE
+#endif
+      /* Reserve next 128 values                     from   0x20381L*/
+      /*                                             to     0x203FFL*/
+#define M_TIMER_TRIGGER_MISSED                        0x20400L
+#define M_GRAB_EXPOSURE_TRIGGER_MISSED                M_TIMER_TRIGGER_MISSED
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MISSED, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_MISSED
+#endif
+      /* Reserve next 128 values                     from   0x20401L*/
+      /*                                             to     0x2047FL*/
+#define M_TIMER_TRIGGER_MISSED_STATUS                 0x20480L
+#define M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS         M_TIMER_TRIGGER_MISSED_STATUS
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_MISSED_STATUS
+#endif
+      /* Reserve next 128 values                     from   0x20481L*/
+      /*                                             to     0x204FFL*/
+#define M_TIMER_TRIGGER_RATE_DIVIDER                  0x20500L
+#define M_GRAB_EXPOSURE_TRIGGER_DIVIDER               M_TIMER_TRIGGER_RATE_DIVIDER
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_DIVIDER, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_RATE_DIVIDER
+#endif
+      /* Reserve next 128 values                     from   0x20501L*/
+      /*                                             to     0x2057FL*/
+
+#define M_TIMER_TRIGGER_SOFTWARE                      0x20580L
+      /* Reserve next 128 values                     from   0x20581L*/
+      /*                                             to     0x205FFL*/
+
+#define M_TIMER_ARM                                   0x20600L
+#define M_GRAB_EXPOSURE_ARM                           M_TIMER_ARM
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM, 1000)     // New IO API Replaced by M_TIMER_ARM
+#endif
+      /* Reserve next 128 values                     from   0x20601L*/
+      /*                                             to     0x2067FL*/
+#define M_TIMER_ARM_SOURCE                            0x20680L
+#define M_GRAB_EXPOSURE_ARM_SOURCE                    M_TIMER_ARM_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM_SOURCE, 1000)     // New IO API Replaced by M_TIMER_ARM_SOURCE
+#endif
+      /* Reserve next 128 values                     from   0x20681L*/
+      /*                                             to     0x206FFL*/
+#define M_TIMER_ARM_ACTIVATION                        0x20700L
+#define M_GRAB_EXPOSURE_ARM_MODE                      M_TIMER_ARM_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM_MODE, 1000)     // New IO API Replaced by M_TIMER_ARM_ACTIVATION
+#endif
+      /* Reserve next 128 values                     from   0x20701L*/
+      /*                                             to     0x2077FL*/
+
+#define M_TIMER_ARM_SOFTWARE                          0x20780L
+      /* Reserve next 128 values                     from   0x20781L*/
+      /*                                             to     0x207FFL*/
+
+#define M_TIMER_CLOCK_ACTIVATION                      0x20800L
+      /* Reserve next 128 values                     from   0x20801L*/
+      /*                                             to     0x2087FL*/
+#define M_TIMER_TRIGGER_OVERLAP                       0x20880L
+      /* Reserve next 128 values                     from   0x20881L*/
+      /*                                             to     0x208FFL*/
+#define M_TIMER_RESET_SOURCE                         0x20900L
+
+      /* Reserve next 128 values                     from   0x20901L*/
+      /* For future M_TIMER FUNCTIONNALITY           to     0x2097FL*/
+
+/************************************************************************/
+/* MdigInquire() Types MIL_DOUBLE                                       */
+/************************************************************************/
+#define M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_START   0x21500L
+
+#define M_TIMER_DURATION_MAX                          0x21500L
+#define M_GRAB_EXPOSURE_TIME_MAX                      M_TIMER_DURATION_MAX
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME_MAX, 1000)     // New IO API Replaced by M_TIMER_DURATION_MAX
+#endif
+      /* Reserve next 128 values                     from   0x21501L*/
+      /*                                             to     0x2157FL*/
+#define M_TIMER_DURATION                              0x21580L
+#define M_GRAB_EXPOSURE_TIME                          M_TIMER_DURATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME, 1000)     // New IO API Replaced by M_TIMER_DURATION
+#endif
+      /* Reserve next 128 values                     from   0x21581L*/
+      /*                                             to     0x215FFL*/
+#define M_TIMER_DELAY                                 0x21600L
+#define M_GRAB_EXPOSURE_TIME_DELAY                    M_TIMER_DELAY
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME_DELAY, 1000)     // New IO API Replaced by M_TIMER_DELAY
+#endif
+      /* Reserve next 128 values                     from   0x21601L*/
+      /*                                             to     0x2167FL*/
+#define M_TIMER_CLOCK_FREQUENCY                       0x21680L
+#define M_GRAB_EXPOSURE_CLOCK_FREQUENCY               M_TIMER_CLOCK_FREQUENCY
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_CLOCK_FREQUENCY, 1000)     // New IO API Replaced by M_TIMER_CLOCK_FREQUENCY
+#endif
+      /* Reserve next 128 values                     from   0x21681L*/
+      /*                                             to     0x216FFL*/
+#define M_TIMER_TIMEOUT                               0x21700L
+#define M_GRAB_EXPOSURE_TIMEOUT                       M_TIMER_TIMEOUT
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIMEOUT, 1000)     // New IO API Replaced by M_TIMER_TIMEOUT
+#endif
+      /* Reserve next 128 values                     from   0x21701L*/
+      /*                                             to     0x2177FL*/
+#define M_TIMER_VALUE                                 0x21780L
+#define M_GRAB_EXPOSURE_MEASURED                      M_TIMER_VALUE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_MEASURED, 1000)     // New IO API Replaced by M_TIMER_VALUE
+#endif
+      /* Reserve next 128 values                     from   0x21781L*/
+      /*                                             to     0x217FFL*/
+#define M_TIMER_DURATION2                              0x21800L
+      /* Reserve next 128 values                     from   0x21801L*/
+      /*                                             to     0x2187FL*/
+#define M_TIMER_DELAY2                                 0x21880L
+      /* Reserve next 128 values                     from   0x21881L*/
+      /*                                             to     0x218FFL*/
+#define M_TIMER_DELAY_CLOCK_FREQUENCY                  0x21900L
+      /* Reserve next 128 values                     from   0x21901L*/
+      /*                                             to     0x2197FL*/
+
+#define M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_END           0x22500L
+#endif
+
+#define M_GRAB_EXTENDED_DATA                                0x23000L
+      /* Reserve      0x1000 values                  from   0x23001*/
+      /*                                             to     0x23FFF*/
+
+      // Rotary encoder
+#define M_ROTARY_ENCODER_POSITION                    MIL_MAKE_CONST(0x00024000L,0x0000000000024000)
+      /* Reserve      0x100 values                   from   0x24700*/
+      /*                                             to     0x247FF*/
+#define M_ROTARY_ENCODER_POSITION_TRIGGER            MIL_MAKE_CONST(0x00025000L,0x0000000000025000)
+      /* Reserve      0x100 values                   from   0x25700*/
+      /*                                             to     0x257FF*/
+#define M_ROTARY_ENCODER_FRAME_END_POSITION          MIL_MAKE_CONST(0x00026000L,0x0000000000026000)
+      /* Reserve      0x100 values                   from   0x26700*/
+      /*                                             to     0x267FF*/
+#define M_ROTARY_ENCODER_DIRECTION                   MIL_MAKE_CONST(0x00027000L,0x0000000000027000)
+      /* Reserve      0x100 values                   from   0x27700*/
+      /*                                             to     0x277FF*/
+#define M_ROTARY_ENCODER_GRAB_LINE_READ              MIL_MAKE_CONST(0x00028000L,0x0000000000028000)
+      /* Reserve      0x100 values                   from   0x28700*/
+      /*                                             to     0x287FF*/
+#define M_ROTARY_ENCODER_ON_GRAB_LINE                M_ROTARY_ENCODER_GRAB_LINE_READ
+#define M_ROTARY_ENCODER_MULTIPLIER                  MIL_MAKE_CONST(0x00029000L,0x0000000000029000)
+      /* Reserve      0x100 values                   from   0x29700*/
+      /*                                             to     0x297FF*/
+#define M_ROTARY_ENCODER_DIVIDER                     MIL_MAKE_CONST(0x0002A000L,0x000000000002A000)
+      /* Reserve      0x100 values                   from   0x2A700*/
+      /*                                             to     0x2A7FF*/
+#define M_ROTARY_ENCODER_RESET_SOURCE                MIL_MAKE_CONST(0x0002B000L,0x000000000002B000)
+      /* Reserve      0x100 values                   from   0x2B700*/
+      /*                                             to     0x2B7FF*/
+#define M_ROTARY_ENCODER_RESET_VALUE                 MIL_MAKE_CONST(0x0002C000L,0x000000000002C000)
+      /* Reserve      0x100 values                   from   0x2C700*/
+      /*                                             to     0x2C7FF*/
+#define M_ROTARY_ENCODER_OUTPUT_MODE                 MIL_MAKE_CONST(0x0002D000L,0x000000000002D000)
+      /* Reserve      0x100 values                   from   0x2D700*/
+      /*                                             to     0x2D7FF*/
+#define M_ROTARY_ENCODER_OUTPUT1_MODE                MIL_MAKE_CONST(0x0002E000L,0x000000000002E000)
+      /* Reserve      0x100 values                   from   0x2E700*/
+      /*                                             to     0x2E7FF*/
+#define M_ROTARY_ENCODER_OUTPUT2_MODE                MIL_MAKE_CONST(0x0002F000L,0x000000000002F000)
+      /* Reserve      0x100 values                   from   0x2F700*/
+      /*                                             to     0x2F7FF*/
+#define M_ROTARY_ENCODER_STATE                       MIL_MAKE_CONST(0x00030000L,0x0000000000030000)
+      /* Reserve      0x100 values                   from   0x30700*/
+      /*                                             to     0x307FF*/
+#define M_ROTARY_ENCODER_BIT0_SOURCE                 MIL_MAKE_CONST(0x00031000L,0x0000000000031000)
+      /* Reserve      0x100 values                   from   0x31700*/
+      /*                                             to     0x317FF*/
+#define M_ROTARY_ENCODER_BIT1_SOURCE                 MIL_MAKE_CONST(0x00032000L,0x0000000000032000)
+      /* Reserve      0x100 values                   from   0x32700*/
+      /*                                             to     0x327FF*/
+#define M_ROTARY_ENCODER_FORCE_VALUE_SOURCE          MIL_MAKE_CONST(0x00033000L,0x0000000000033000)
+      /* Reserve      0x100 values                   from   0x33700*/
+      /*                                             to     0x337FF*/
+#define M_ROTARY_ENCODER_FRAME_END_READ              MIL_MAKE_CONST(0x00034000L,0x0000000000034000)
+      /* Reserve 0x100 values                        from   0x34700*/
+      /*                                             to     0x347FF*/
+#define M_ROTARY_ENCODER_RESET_ACTIVATION            MIL_MAKE_CONST(0x00035000L,0x0000000000035000)
+      /* Reserve 0x100 values                        from   0x35700*/
+      /*                                             to     0x357FF*/
+      /*                                             to     0x36000L*/
+#define M_ROTARY_ENCODER_POSITION_START_TRIGGER      MIL_MAKE_CONST(0x00036000L,0x0000000000036000)
+      /* Reserve      0x100 values                   from   0x36700*/
+      /*                                             to     0x367FF*/
+      /* Reserve next 3 ranges of values             from   0x37000L*/
+      /* For future M_ROTARY_FUNCTIONALITY           to     0x39000L*/
+
+#define M_ROTARY_RANGE_DOUBLE_START                  0x3A000L
+#define M_ROTARY_ENCODER_POSITION_TRIGGER_DOUBLE     MIL_MAKE_CONST(0x0003A000L,0x000000000003A000)
+      /* Reserve      0x100 values                   from   0x3A700*/
+      /*                                             to     0x3A7FF*/
+      /* Reserve next 5 ranges of values             from   0x3B000L*/
+      /* For future M_ROTARY_FUNCTIONALITY           to     0x3F000L*/
+
+#define M_ROTARY_RANGE_DOUBLE_END                    0x3F800L
+
+   #if OldDefinesSupport
+   #define M_FORMAT_LENGTH                         M_FORMAT_SIZE
+   #define M_FORMAT_SUPPORTED_LENGTH               M_FORMAT_SUPPORTED_SIZE
+   #define M_SERIAL_NUMBER_LENGTH                  M_SERIAL_NUMBER_SIZE
+   #define M_CAMERA_VENDOR_LENGTH                  M_CAMERA_VENDOR_SIZE
+   #define M_GC_VERSION_LENGTH                     M_GC_VERSION_SIZE
+   #define M_GC_SPECIFIC_INFO_LENGTH               M_GC_SPECIFIC_INFO_SIZE
+   #define M_GC_USER_NAME_LENGTH                   M_GC_USER_NAME_SIZE
+   #define M_GC_SERIAL_NUMBER_LENGTH               M_GC_SERIAL_NUMBER_SIZE
+   #define M_FORMAT_DETECTED_LENGTH                M_FORMAT_DETECTED_SIZE
+   #define M_CAMERA_MODEL_LENGTH                   M_CAMERA_MODEL_SIZE
+   #define M_GC_GET_STREAMABLE_FEATURES_LENGTH     M_GC_GET_STREAMABLE_FEATURES_SIZE
+   #define M_GC_CLPROTOCOL_DEVICEID_LENGTH         M_GC_CLPROTOCOL_DEVICE_ID_SIZE
+   #define M_GC_INTERFACE_NAME_LENGTH              M_GC_INTERFACE_NAME_SIZE
+   #define M_GC_XML_PATH_LENGTH                    M_GC_XML_PATH_SIZE
+   #define M_GC_CLPROTOCOL_DEVICEID                M_GC_CLPROTOCOL_DEVICE_ID
+   MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID, 1000)
+   #define M_GC_CLPROTOCOL_DEVICEID_SIZE           M_GC_CLPROTOCOL_DEVICE_ID_SIZE
+   MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID_MAX, 1000)
+   #define M_GC_CLPROTOCOL_DEVICEID_DEFAULT        M_GC_CLPROTOCOL_DEVICE_ID_DEFAULT
+   MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID_DEFAULT, 1000)
+   #endif
+
+
+
+#define M_HOOK_EVENT_BACKDOOR_INTERNAL                0x4444L // 17476
+#define M_HOOK_CANCEL_EVENT_BACKDOOR_INTERNAL         0x4464L // 17508
+
+
+
+
+/* Reserve 3 values for M_HUE                  from   32768*/
+/*                                             to     32771*/
+#define M_MODEL                                       0x00010000L   //65536
+
+#define M_START_REGISTER_ADDRESS                      MAKE_INT64(0x00000000F0000000)
+/*Reserve the values between 0xF000000 and 0xF0FFFFFF for 1394*/
+#define M_END_REGISTER_ADDRESS                        MAKE_INT64(0x00000000F0FFFFFF) 
+
+// !!! MAP FOR OLD DEFINES
+#if OldDefinesSupport
+#define M_DIG_TYPE                                    M_TYPE
+MIL_DEPRECATED(M_DIG_TYPE, 1000)
+#define M_DIG_NUMBER                                  M_NUMBER
+MIL_DEPRECATED(M_DIG_NUMBER, 1000)
+#define M_DIG_FORMAT                                  M_FORMAT
+MIL_DEPRECATED(M_DIG_FORMAT, 1000)
+#define M_DIG_INIT_FLAG                               M_INIT_FLAG
+MIL_DEPRECATED(M_DIG_INIT_FLAG, 1000)
+#define M_DIG_CHANNEL_NUM                             M_CHANNEL_NUM
+MIL_DEPRECATED(M_DIG_CHANNEL_NUM, 1000)
+
+#define M_DIG_REF_BLACK                               M_BLACK_REF
+MIL_DEPRECATED(M_DIG_REF_BLACK, 1000)
+#define M_DIG_REF_WHITE                               M_WHITE_REF
+MIL_DEPRECATED(M_DIG_REF_WHITE, 1000)
+#define M_DIG_REF_HUE                                 M_HUE_REF
+MIL_DEPRECATED(M_DIG_REF_HUE, 1000)
+#define M_DIG_REF_SATURATION                          M_SATURATION_REF
+MIL_DEPRECATED(M_DIG_REF_SATURATION, 1000)
+#define M_DIG_REF_BRIGHTNESS                          M_BRIGHTNESS_REF
+MIL_DEPRECATED(M_DIG_REF_BRIGHTNESS, 1000)
+#define M_DIG_REF_CONTRAST                            M_CONTRAST_REF
+MIL_DEPRECATED(M_DIG_REF_CONTRAST, 1000)
+#define M_DIG_BLACK_REF                               M_BLACK_REF
+MIL_DEPRECATED(M_DIG_BLACK_REF, 1000)
+#define M_DIG_WHITE_REF                               M_WHITE_REF
+MIL_DEPRECATED(M_DIG_WHITE_REF, 1000)
+#define M_DIG_HUE_REF                                 M_HUE_REF
+MIL_DEPRECATED(M_DIG_HUE_REF, 1000)
+#define M_DIG_SATURATION_REF                          M_SATURATION_REF
+MIL_DEPRECATED(M_DIG_SATURATION_REF, 1000)
+#define M_DIG_BRIGHTNESS_REF                          M_BRIGHTNESS_REF
+MIL_DEPRECATED(M_DIG_BRIGHTNESS_REF, 1000)
+#define M_DIG_CONTRAST_REF                            M_CONTRAST_REF
+MIL_DEPRECATED(M_DIG_CONTRAST_REF, 1000)
+#define M_DIG_INPUT_MODE                              M_INPUT_MODE
+MIL_DEPRECATED(M_DIG_INPUT_MODE, 1000)
+#define M_DIG_GRAB_SCALE                              M_GRAB_SCALE
+MIL_DEPRECATED(M_DIG_GRAB_SCALE, 1000)
+#define M_DIG_GRAB_SCALE_X                            M_GRAB_SCALE_X
+MIL_DEPRECATED(M_DIG_GRAB_SCALE_X, 1000)
+#define M_DIG_GRAB_SCALE_Y                            M_GRAB_SCALE_Y
+MIL_DEPRECATED(M_DIG_GRAB_SCALE_Y, 1000)
+#define M_DIG_GRAB_SUBSAMPLE                          M_GRAB_SUBSAMPLE
+MIL_DEPRECATED(M_DIG_GRAB_SUBSAMPLE, 1000)
+#define M_DIG_GRAB_SUBSAMPLE_X                        M_GRAB_SUBSAMPLE_X
+MIL_DEPRECATED(M_DIG_GRAB_SUBSAMPLE_X, 1000)
+#define M_DIG_GRAB_SUBSAMPLE_Y                        M_GRAB_SUBSAMPLE_Y
+MIL_DEPRECATED(M_DIG_GRAB_SUBSAMPLE_Y, 1000)
+#define M_DIG_GRAB_MODE                               M_GRAB_MODE
+MIL_DEPRECATED(M_DIG_GRAB_MODE, 1000)
+#define M_DIG_GRAB_FRAME_NUM                          M_GRAB_FRAME_NUM
+MIL_DEPRECATED(M_DIG_GRAB_FRAME_NUM, 1000)
+#define M_DIG_GRAB_FIELD_NUM                          M_GRAB_FIELD_NUM
+MIL_DEPRECATED(M_DIG_GRAB_FIELD_NUM, 1000)
+#define M_DIG_SOURCE_SIZE_X                           M_SOURCE_SIZE_X
+MIL_DEPRECATED(M_DIG_SOURCE_SIZE_X, 1000)
+#define M_DIG_SOURCE_SIZE_Y                           M_SOURCE_SIZE_Y
+MIL_DEPRECATED(M_DIG_SOURCE_SIZE_Y, 1000)
+#define M_DIG_SOURCE_OFFSET_X                         M_SOURCE_OFFSET_X
+MIL_DEPRECATED(M_DIG_SOURCE_OFFSET_X, 1000)
+#define M_DIG_SOURCE_OFFSET_Y                         M_SOURCE_OFFSET_Y
+MIL_DEPRECATED(M_DIG_SOURCE_OFFSET_Y, 1000)
+#define M_DIG_USER_BIT                                M_USER_BIT
+MIL_DEPRECATED(M_DIG_USER_BIT, 1000)
+#define M_DIG_INPUT_SIGNAL_PRESENT                    M_INPUT_SIGNAL_PRESENT
+MIL_DEPRECATED(M_DIG_INPUT_SIGNAL_PRESENT, 1000)
+#define M_DIG_INPUT_SIGNAL_SOURCE                     M_INPUT_SIGNAL_SOURCE
+MIL_DEPRECATED(M_DIG_INPUT_SIGNAL_SOURCE, 1000)
+
+#define M_DIG_CLIP_SRC_SUPPORTED                      M_CLIP_SRC_SUPPORTED
+MIL_DEPRECATED(M_DIG_CLIP_SRC_SUPPORTED, 1000)
+#define M_DIG_CLIP_DST_SUPPORTED                      M_CLIP_DST_SUPPORTED
+MIL_DEPRECATED(M_DIG_CLIP_DST_SUPPORTED, 1000)
+#define M_DIG_HOOK_FUNCTION_SUPPORTED                 M_HOOK_FUNCTION_SUPPORTED
+MIL_DEPRECATED(M_DIG_HOOK_FUNCTION_SUPPORTED, 1000)
+#define M_GRAB_INTERLACED_MODE                        M_SCAN_MODE
+MIL_DEPRECATED(M_GRAB_INTERLACED_MODE, 1000)
+#define M_GRAB_THREAD_PRIORITY                        M_THREAD_PRIORITY
+MIL_DEPRECATED(M_GRAB_THREAD_PRIORITY, 1000)
+#define M_HOOK_PRIORITY                               M_THREAD_PRIORITY
+MIL_DEPRECATED(M_HOOK_PRIORITY, 1000)
+#define M_GRAB_WINDOWS_RANGE                          M_GRAB_WINDOW_RANGE
+MIL_DEPRECATED(M_GRAB_WINDOWS_RANGE, 1000)
+#define M_GRAB_WINDOWS_RANGE_SUPPORTED                M_GRAB_WINDOW_RANGE_SUPPORTED
+MIL_DEPRECATED(M_GRAB_WINDOWS_RANGE_SUPPORTED, 1000)
+
+#define M_HW_TRIGGER                                  M_HARDWARE_PORT0
+MIL_DEPRECATED(M_HW_TRIGGER, 1000)
+#define M_SW_TRIGGER                                  M_SOFTWARE
+MIL_DEPRECATED(M_SW_TRIGGER, 1000)
+#define M_VSYNC_TRIGGER                               M_VSYNC
+MIL_DEPRECATED(M_VSYNC_TRIGGER, 1000)
+#define M_HSYNC_TRIGGER                               M_HSYNC
+MIL_DEPRECATED(M_HSYNC_TRIGGER, 1000)
+#define M_USER_BIT_SOURCE                             M_IO_SOURCE
+MIL_DEPRECATED(M_USER_BIT_SOURCE, 1000)
+
+#endif
+
+// List of defines for CLLjpegControl
+//==============================================================================
+#define M_LOSSY                                          1L
+#define M_AUTO_BIT_RATE_CONTROL                          2L
+#define M_STATISTICAL                                    3L
+#define M_BIT_RATE_CONTROL                               4L
+#define M_TABLES_ONLY                                    5L
+#define M_TABLES_PRELOAD                                 6L
+#define M_LOSSLESS                                       7L
+#define M_FAST_PREVIEW                                   8L
+
+#define M_APP                                         0x00000001L
+#define M_COM                                         0x00000002L
+#define M_DRI                                         0x00000004L
+#define M_DQT                                         0x00000008L
+#define M_DHT                                         0x00000010L
+#define M_DNL                                         0x00000020L
+#define M_DQTI                                        0x00000040L
+#define M_DHTI                                        0x00000080L
+
+#define M_NSCN_1                                         0L
+#define M_NSCN_2                                         1L
+#define M_NSCN_3                                         2L
+#define M_NSCN_4                                         3L
+#define M_NSCN_5                                         4L
+#define M_NSCN_6                                         5L
+#define M_NSCN_7                                         6L
+#define M_NSCN_8                                         7L
+
+/* Inquire Values */
+#define M_DIGITAL                                     0L
+#define M_ANALOG                                      1L
+#define M_INTERLACE                                   0L
+#define M_PROGRESSIVE                                 1L
+#define M_LINESCAN                                    2L
+#define M_DEINTERLACE                                 3L
+#define M_ACTIVATE                                    1L
+
+/* Inquire Values for the color mode */
+#define M_MONOCHROME                                  0L
+#define M_COMPOSITE                                   1L
+#define M_RGB                                         8L
+#define M_YUV                                         4L
+#define M_EXTERNAL_CHROMINANCE                        4137L
+#define M_MONO8_VIA_RGB                               M_MONO32
+#define M_SEPARATE                                    0x8000L
+
+
+/* List of define for hardware deinterlacing */
+#define M_ANTIALIASING                                0x1000
+#define M_BOB_METHOD                                  0x4
+#define M_MADI_METHOD                                 0x8
+
+// Values return by M_GRAB_FRAME_BURST_END_SOURCE
+#define M_BURST_MAX_TIME                       0x00000001
+#define M_BURST_TRIGGER                        0x00000002
+#define M_BURST_COUNT                          0x00000004
+
+// Values to control M_DATA_LATCH_TYPE
+#define M_IO_STATUS_ALL                       (M_USER_BIT_BIT_MASK_ENABLED|M_IO_STATUS)
+#define M_ROTARY_ENCODER                       0x700L
+#define M_ROTARY_ENCODER1                      (M_ROTARY_ENCODER +M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER2                      (M_ROTARY_ENCODER1+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER3                      (M_ROTARY_ENCODER2+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER4                      (M_ROTARY_ENCODER3+M_ROTARY_MAX_OUTPUT)
+#define M_TIME_STAMP                           M_GRAB_TIME_STAMP
+#define M_DATA_LATCH_CXP_HEADER_PIXEL_FORMAT    0x4
+#define M_DATA_LATCH_CXP_HEADER_X_SIZE_OFFSET   0x6
+#define M_DATA_LATCH_CXP_HEADER_Y_SIZE_OFFSET   0x5
+
+// Values to control M_DATA_LATCH_LATCH_MODE
+#define M_NORMAL                                8L
+#define M_PREFETCH                             32L
+
+/* List of define for digitizer filter type */
+#define M_DIGITIZER_FILTER_MASK                       MAKE_INT64(0x000000000000FFFF)
+#define M_KAISER                                      0x10000
+#define M_GAUSS                                       0x20000
+
+
+#define M_DVI_1                                       0x0001
+#define M_DVI_2                                       0x0020
+#define M_DVI_3                                       0x0040
+#define M_DVI_4                                       0x0080
+#define M_SDI_1                                       0x0100
+#define M_SDI_2                                       0x0200
+#define M_SDI_3                                       0x0400
+#define M_SDI_4                                       0x0800
+
+#define M_HDMI                                        0x2000
+#define M_DP                                          0x2001
+
+
+/************************************************************************/
+/* Board types                                                          */
+/************************************************************************/
+#define M_BOARD_TYPE_MASK                             0x000000FFL
+
+// Radient board type
+#define M_RADIENT                                     10L
+#define M_RADIENTPRO                                  15L
+
+// Corona board type
+#define M_CORONA                                      20L
+#define M_CORONA_LC                                   21L
+#define M_CORONA_VIA                                  22L
+#define M_CORONA_RR                                   23L
+#define M_INDIO                                       24L
+#define M_CORONA_II                                   25L
+/* Free for future board type                         27L*/
+#define M_CORONA_II_WITH_DIG_MODULE                   (M_CORONA_II|M_DIGITAL_MODULE)
+
+/* Free for future board type                         33L*/
+/* Free for future board type                         35L*/
+
+/* Free for future board type                         40L*/
+
+// 1394 board type
+#define M_IEEE_1394_IIDC                              50L
+#define M_NON_MATROX_OHCI_BOARD                       M_IEEE_1394_IIDC
+
+/* Free for future board type                         60L*/
+
+// CronosPlus board type
+#define M_CRONOSPLUS                                  70L
+
+// Free for future board type                         80L
+
+// Morphis Board type
+#define M_MORPHIS                                     90L
+
+// Host board type
+#define M_HOST                                       100L
+
+// Rapixo board type
+#define M_RAPIXOCXP                                  M_RAPIXO
+#define M_RAPIXO                                     110L
+
+// Solios board type
+#define M_SOLIOS                                     120L
+
+// Nexis board type
+#define M_NEXIS                                      130L
+
+#define M_CONCORD_POE                                140L
+
+// Vio board type
+#define M_VIO                                        150L
+
+// Iris board type
+#define M_IRIS                                       160L
+
+// MorphisQxt board type
+#define M_MORPHISQXT                                 170L
+
+// GigeVision board type
+#define M_GIGE_VISION                                180L
+
+// GPU board type
+#define M_GPU                                        190L
+
+#define M_USB3_VISION                                200L
+
+#define M_GENTL                                      210L
+
+#define M_IRIS_GTR                                   220L
+#define M_NEXIS3                                     221L
+
+// Iris Gt board type
+#define M_IRIS_GT                                    230L
+#define M_IRIS_GT_DUAL                               231L
+#define M_NEXIS2                                     232L
+
+#define M_ORION_HD                                   240L
+
+#define M_ORION_UHD                                  250L
+#define M_CLARITY_UHD                                250L
+
+/* Free for future board type                        280L*/
+
+// Corona and Genesis module type.
+#define M_DIGITAL_MODULE                              0x00000100L
+
+// Solios, Radient module type.
+#define M_XCL                                         0x00000800L
+#define M_CL                                          M_XCL
+#define M_CXP                                         0x00000200L // Coax Express 
+#define M_CLHS                                        0x00000400L // CLHS 
+#define M_XA                                          0x00001000L
+#define M_XD                                          0x00008000L
+#define M_PF                                          0x01000000L // Processing fpga installed
+#define M_DFWD                                        0x00000100L // Data Forwarding 
+
+// Camera Link, Digital and Analog 
+#define M_QBCL                                        0x04000000L // Quad Base CL
+#define M_SBCL                                        0x08000000L // Single Base CL
+#define M_QHA                                         0x00100000L // Quad High freq. Analog
+#define M_SFCL                                        0x00200000L // Single Full CL
+#define M_DBCL                                        0x00400000L // Dual Base CL
+#define M_QD                                          0x00800000L // Quad Digital
+#define M_DA                                          0x00010000L // Dual Analog
+#define M_QA                                          0x00020000L // Quad Analog
+#define M_SA                                          0x00040000L // Single Analog
+#define M_SMCL                                        0x00080000L // Single Medium CL
+#define M_DFCL                                        0x00004000L // Dual Full CL
+// CXP only
+#define M_Q3G                                         0x00010000L // Quad link 3 Gbits 
+#define M_Q6G                                         0x02000000L // Quad link 6 Gbits
+#define M_Q12G                                        0x00800000L // Quad link 6 Gbits
+#define M_D3G                                         0x10000000L // Dual link 3 Gbits
+#define M_D6G                                         0x20000000L // Dual link 6 Gbits
+#define M_D12G                                        0x00100000L // Dual link 12 Gbits
+#define M_S12G                                        0x00002000L // Single link 12 Gbits
+// CLHS only
+#define M_SC7MS3                                      0x40000000L // Single copper 7 lanes 3 Gbits
+
+// Solios only.
+#define M_FAST                                        0x00002000L
+
+// SoliosGige module type.
+#define M_SCH                                         0x00010000L
+#define M_DCH                                         0x00020000L
+#define M_TCH                                         0x00040000L
+#define M_QCH                                         0x00080000L
+#define M_PF                                          0x01000000L // Processing fpga installed
+
+// Morphis and MorphisQxT module type.
+#define M_1VD                                         0x00004000L
+#define M_2VD                                         0x00008000L
+#define M_IO                                          0x00010000L
+#define M_4VD                                         0x00020000L
+#define M_16VD                                        0x00040000L
+#define M_J2K                                         0x00000200L
+#define M_JPEG2000                                    M_J2K
+#define M_COMPRESSION                                 0x00080000L
+#define M_AUDIO_MODULE                                0x00100000L
+
+// Vio module type.
+#define M_SDI                                         0x00001000L // Serial Digital Interface
+#define M_SA                                          0x00040000L // Single Analog
+#define M_DVI                                         0x00100000L // DVI Analog
+
+// Concord TOE module type.
+#define M_TOE                                         0x00001000L // Trigger over Ethernet
+#define M_SCH                                         0x00010000L
+#define M_DCH                                         0x00020000L
+#define M_TCH                                         0x00040000L
+#define M_QCH                                         0x00080000L
+
+// 1394 and Host module type.
+/* Free for future board type                         0x00000100L*/
+#define M_4SIGHT                                      0x00000200L
+#define M_4SIGHT_II                                   0x00000400L
+#define M_PC104                                       0x00000800L
+#define M_CONCORD                                     0x00001000L
+#define M_4SIGHT_X                                    0x00002000L
+#define M_SUPERSIGHT                                  0x00004000L
+#define M_4SIGHT_M                                    0x00008000L
+#define M_4SIGHT_GP                                   0x00010000L
+#define M_4SIGHT_GP_NEXIS2                            0x00020000L
+#define M_4SIGHT_GPM                                  0x00040000L
+#define M_4SIGHT_GPM_BT                               0x00080000L
+#define M_4SIGHT_EV6                                  0x00100000L
+
+// Iris Camera type
+// Suggested format:
+// 23:21 0
+// 20    Remote 1/Non remote 0
+// 19:12 P300 03, P700 07, P1200 12
+// 11    Mini head 1/Normal head 0
+// 10    High Speed 1/Normal 0
+// 9     E model 1/P model 0/GT model 0
+// 8     Color 1/Mono 0
+// 7:0   0
+#define M_P300                                        0x003000L
+#define M_P300C                                       0x003100L
+#define M_E300                                        0x003200L
+#define M_E300C                                       0x003300L
+#define M_P300H                                       0x003400L
+#define M_E300H                                       0x003600L
+#define M_P300HM                                      0x003C00L
+#define M_E300HM                                      0x003E00L
+#define M_P300R                                       0x103000L
+#define M_P300CR                                      0x103100L
+#define M_E300R                                       0x103200L
+#define M_E300CR                                      0x103300L
+#define M_P300HR                                      0x103400L
+#define M_E300HR                                      0x103600L
+#define M_P300HMR                                     0x103C00L
+#define M_E300HMR                                     0x103E00L
+#define M_P700                                        0x007000L
+#define M_E700                                        0x007200L
+#define M_P700W                                       0x007300L
+#define M_E700W                                       0x007400L
+#define M_P700R                                       0x107000L
+#define M_E700R                                       0x107200L
+#define M_P700WR                                      0x107300L
+#define M_E700WR                                      0x107400L
+#define M_P1200                                       0x012000L
+#define M_E1200                                       0x012200L
+#define M_P1200R                                      0x112000L
+#define M_E1200R                                      0x112200L
+#define M_P1200H                                      0x013000L
+#define M_E1200H                                      0x013200L
+#define M_P1200HR                                     0x113000L
+#define M_E1200HR                                     0x113200L
+#define M_P1200HM                                     0x012C00L
+#define M_E1200HM                                     0x012E00L
+#define M_P1200HMR                                    0x112C00L
+#define M_E1200HMR                                    0x112E00L
+
+// Iris Camera type - For compatibility before define renamed
+#define P300                                          M_P300   
+#define P300C                                         M_P300C  
+#define E300                                          M_E300   
+#define E300C                                         M_E300C  
+#define P300H                                         M_P300H  
+#define E300H                                         M_E300H  
+#define P300HM                                        M_P300HM 
+#define E300HM                                        M_E300HM 
+#define P300R                                         M_P300R  
+#define P300CR                                        M_P300CR 
+#define E300R                                         M_E300R  
+#define E300CR                                        M_E300CR 
+#define P300HR                                        M_P300HR 
+#define E300HR                                        M_E300HR 
+#define P300HMR                                       M_P300HMR
+#define E300HMR                                       M_E300HMR
+#define P700                                          M_P700   
+#define E700                                          M_E700   
+#define P700W                                         M_P700W  
+#define E700W                                         M_E700W  
+#define P700R                                         M_P700R  
+#define E700R                                         M_E700R  
+#define P700WR                                        M_P700WR 
+#define E700WR                                        M_E700WR 
+#define P1200                                         M_P1200  
+#define E1200                                         M_E1200  
+#define P1200R                                        M_P1200R 
+#define E1200R                                        M_E1200R 
+#define P1200H                                        M_P1200H  
+#define E1200H                                        M_E1200H  
+#define P1200HR                                       M_P1200HR 
+#define E1200HR                                       M_E1200HR 
+#define P1200HM                                       M_P1200HM  
+#define E1200HM                                       M_E1200HM  
+#define P1200HMR                                      M_P1200HMR 
+#define E1200HMR                                      M_E1200HMR 
+
+// Nexis Camera type
+#define M_S300T                                       M_P300R
+#define M_S300CT                                      M_P300CR
+#define M_S300HT                                      M_P300HR
+#define M_S300HM                                      M_P300HMR
+#define M_S700T                                       M_P700R
+#define M_S1200T                                      M_P1200R
+#define M_S1200HT                                     M_P1200HR
+#define M_S1200HM                                     M_P1200HMR
+
+// Iris GT camera type
+#define M_GT300                                       0x00001000
+#define M_GT1200                                      0x04001000
+#define M_GT1900                                      0x08001000
+#define M_GT300C                                      0x80001000
+#define M_GT1200C                                     0x84001000
+#define M_GT1900C                                     0x88001000
+#define M_GT5000                                      0x0C001000
+
+// Nexis2 camera type
+#define M_N2S300                                      0x40001000
+#define M_N2S1200                                     0x5C001000
+
+// Iris GTR
+#define M_480                                         0x50040000
+#define M_300                                         0x50d00100
+#define M_500                                         0x50d00200
+#define M_1300                                        0x50d00000
+#define M_2000                                        0x50320100
+#define M_5000                                        0x50320000
+
+#define M_480C                                        0x51040000
+#define M_300C                                        0x51d00100
+#define M_500C                                        0x51d00200
+#define M_1300C                                       0x51d00000
+#define M_2000C                                       0x51320100
+#define M_5000C                                       0x51320000
+
+#define M_480NIR                                      0x52040000
+#define M_300NIR                                      0x52d00100
+#define M_500NIR                                      0x52d00200
+#define M_1300NIR                                     0x52d00000
+#define M_2000NIR                                     0x52320100
+#define M_5000NIR                                     0x52320000
+
+/************************************************************************/
+/* MdigControl() / MdigInquire() Values                                 */
+/************************************************************************/
+#define M_WEIGHTED                                    2L
+#define M_CONTINUOUS                                 -1L
+#define M_ONCE                                        3L
+#define M_SINGLE_FRAME                                1L
+
+#define M_TIMER0                                      0L
+#define M_TIMER1                                      1L
+#define M_TIMER2                                      2L
+#define M_TIMER3                                      3L
+#define M_TIMER4                                      4L
+#define M_TIMER5                                      5L
+#define M_TIMER6                                      6L
+#define M_TIMER7                                      7L
+#define M_TIMER8                                      8L
+#define M_TIMER9                                      9L
+#define M_TIMER10                                     10L
+#define M_TIMER11                                     11L
+#define M_TIMER12                                     12L
+#define M_TIMER13                                     13L
+#define M_TIMER14                                     14L
+#define M_TIMER15                                     15L
+#define M_TIMER16                                     16L
+#define M_TIMER60                                     60L
+#define M_TIMER99                                     99L
+
+#define M_TIMER_IO                                    M_TIMER2
+#define M_TIMER_DEFAULT                               M_TIMER99
+
+#define M_TIMER_STROBE                                M_TIMER60
+
+#define M_LOW                                         1L
+#define M_HIGH                                        3L
+
+#define M_FOLLOW_TIMER_CLOCK                         -3L
+
+#define M_ARM_CONTINUOUS                              9L
+#define M_ARM_MONOSHOT                                10L
+#define M_ARM_RESET                                   11L
+#define M_EDGE_RISING                                 12L
+#define M_EDGE_FALLING                                13L
+#define M_LEVEL_LOW                                   14L
+#define M_LEVEL_HIGH                                  15L
+#define M_HARDWARE_PORT0                              16L
+#define M_HARDWARE_PORT1                              17L
+#define M_HARDWARE_PORT_CAMERA                        18L
+#define M_START_EXPOSURE                              19L
+#define M_SOFTWARE                                    0x010000L
+#define M_SOFTWARE1                                   (M_SOFTWARE+1)
+#define M_SOFTWARE2                                   (M_SOFTWARE+2)
+#define M_SOFTWARE3                                   (M_SOFTWARE+3)
+#define M_SOFTWARE4                                   (M_SOFTWARE+4)
+#define M_USER_DEFINED                                21L
+#define M_HSYNC                                       22L
+#define M_VSYNC                                       23L
+#define M_HARDWARE_PORT2                              24L
+#define M_HARDWARE_PORT3                              25L
+#define M_SYSCLK                                      26L
+#define M_PIXCLK                                      27L
+#define M_URGENT                                      28L
+#define M_NOW                                         29L
+#define M_FRAME                                       30L
+#define M_HARDWARE_PORT4                              31L
+#define M_HARDWARE_PORT5                              32L
+#define M_HARDWARE_PORT6                              33L
+#define M_HARDWARE_PORT7                              34L
+#define M_HARDWARE_PORT8                              35L
+#define M_HARDWARE_PORT9                              36L
+#define M_HARDWARE_PORT10                             37L
+#define M_HARDWARE_PORT11                             38L
+#define M_HARDWARE_PORT12                             39L
+#define M_HARDWARE_PORT13                             40L
+#define M_HARDWARE_PORT14                             41L
+#define M_HARDWARE_PORT15                             42L
+#define M_USER_BIT_CC_A                               43L
+#define M_USER_BIT_CC_B                               44L
+#define M_CC_OUTPUT_A                                 M_USER_BIT_CC_A
+#define M_CC_OUTPUT_B                                 M_USER_BIT_CC_B
+
+#define M_ANY_EDGE                                    50L
+
+#define M_LEVEL_LOW_END_WHEN_INACTIVE                 63L
+#define M_LEVEL_HIGH_END_WHEN_INACTIVE                64L
+#define M_PULSE_GENERATION                            65L
+#define M_PULSE_MEASUREMENT                           66L
+#define M_PERIOD_MEASUREMENT                          67L
+#define M_HARDWARE_PORT16                             68L
+#define M_HARDWARE_PORT17                             69L
+#define M_HARDWARE_PORT18                             70L
+#define M_HARDWARE_PORT19                             71L
+#define M_HARDWARE_PORT20                             72L
+#define M_HARDWARE_PORT21                             73L
+#define M_HARDWARE_PORT22                             74L
+#define M_HARDWARE_PORT23                             75L
+#define M_HARDWARE_PORT24                             76L
+#define M_HARDWARE_PORT25                             77L
+#define M_HARDWARE_PORT26                             78L
+#define M_HARDWARE_PORT27                             79L
+#define M_HARDWARE_PORT28                             80L
+#define M_HARDWARE_PORT29                             81L
+#define M_HARDWARE_PORT30                             82L
+#define M_HARDWARE_PORT31                             83L
+
+#define M_INTERNAL_SYNC                               84L
+
+// Defines for MsysIoCommand functions 
+#define M_CLOCK                                       85L
+#define M_PULSE_HIGH                                  86L
+#define M_PULSE_LOW                                   87L
+#define M_IMPULSE                                     88L
+#define M_AUTO_REGISTER                               0x10000000
+#define M_AUTO_REGISTER_CANCEL                        0x20000000
+
+#define M_EXPOSURE                                    90L
+#define M_GRAB_TRIGGER_READY                          91L
+
+#define M_CONTROL                                     0x20L
+#define M_STREAMING                                   0x40L
+
+// Timer trigger activation combination values
+#define M_AND_ARM_ACTIVATION                          0x01000000
+#define M_OR_ARM_ACTIVATION                           0x02000000
+#define M_XOR_ARM_ACTIVATION                          0x03000000
+
+// M_TIMER_TRIGGER_OVERLAP or M_GRAB_TRIGGER_OVERLAP
+#define M_OFF                                           0L
+#define M_RESET                                         9L   //Also defined in mildisplay.h
+#define M_PREVIOUS_FRAME                              101L
+#define M_PREVIOUS_LINE                               102L
+#define M_READ_OUT                                    103L
+#define M_READ_OUT_NO_LATCH                           104L
+#define M_LATCH                                    0x2000L
+
+//Rotary encoder values
+#define M_POSITION_TRIGGER                            200L
+#define M_STEP_ANY                                    201L
+#define M_STEP_FORWARD                                202L
+#define M_STEP_BACKWARD                               203L
+#define M_STEP_ANY_WHILE_POSITIVE                     204L
+#define M_STEP_FORWARD_WHILE_POSITIVE                 205L
+#define M_STEP_BACKWARD_WHILE_POSITIVE                206L
+#define M_STEP_ANY_WHILE_NEGATIVE                     207L
+#define M_STEP_FORWARD_WHILE_NEGATIVE                 208L
+#define M_STEP_BACKWARD_WHILE_NEGATIVE                209L
+#define M_COUNTER_OVERFLOW                            210L
+#define M_STEP_FORWARD_NEW_POSITIVE                   211L
+#define M_POSITION_TRIGGER_MULTIPLE                   212L
+#define M_POSITION_START_TRIGGER                      213L
+
+#define M_ROTARY_ENCODER                              0x700L
+#define M_ROTARY_ENCODER1                             (M_ROTARY_ENCODER +M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER2                             (M_ROTARY_ENCODER1+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER3                             (M_ROTARY_ENCODER2+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER4                             (M_ROTARY_ENCODER3+M_ROTARY_MAX_OUTPUT)
+
+// Additions to M_ROTARY_ENCODERn and M_ROTARY_ENCODER_OUTPUT_MODE
+#define M_FPGA_STREAM_OUTPUT_BIT                      0x20000000
+#define M_OUTPUT0                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000000)
+#define M_OUTPUT1                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000001)
+#define M_OUTPUT2                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000002)
+#define M_OUTPUT3                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000003)
+#define M_OUTPUT4                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000004)
+#define M_OUTPUT5                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000005)
+#define M_OUTPUT6                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000006)
+#define M_OUTPUT7                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000007)
+#define M_OUTPUT8                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000008)
+#define M_OUTPUT9                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000009)
+
+// M_GC_CONTROL_PROTOCOL_CAPABILITY  values
+#define M_GC_USER_DEFINED_NAME_SUPPORT                0x80000000L
+#define M_GC_SERIAL_NUMBER_SUPPORT                    0x40000000L
+#define M_GC_HEARTBEAT_DISABLE_SUPPORT                0x20000000L
+#define M_GC_LINK_SPEED_REGISTER_SUPPORT              0x10000000L
+#define M_GC_PORT_AND_IP_REGISTER_SUPPORT             0x08000000L
+#define M_GC_MANIFEST_TABLE_SUPPORT                   0x04000000L
+#define M_GC_TEST_DATA_SUPPORT                        0x02000000L
+#define M_GC_DISCOVERY_ACK_DELAY_SUPPORT              0x01000000L
+#define M_GC_WRITABLE_DISCOVERY_ACK_DELAY_SUPPORT     0x00800000L
+#define M_GC_EXTENDED_STATUS_CODES_1_SUPPORT          0x00400000L
+#define M_GC_PRIMARY_APP_SWITCHOVER_SUPPORT           0x00200000L
+#define M_GC_UNCONDITIONAL_ACTION_SUPPORT             0x00100000L
+#define M_GC_IEEE_1588_SUPPORT                        0x00080000L
+#define M_GC_EXTENDED_STATUS_CODES_2_SUPPORT          0x00040000L
+#define M_GC_SCHEDULED_ACTION_SUPPORT                 0x00020000L
+#define M_GC_ACTION_SUPPORT                           0x00000040L
+#define M_GC_PENDING_ACK_SUPPORT                      0x00000020L
+#define M_GC_EVENT_DATA_SUPPORT                       0x00000010L
+#define M_GC_EVENT_SUPPORT                            0x00000008L
+#define M_GC_PACKET_RESEND_SUPPORT                    0x00000004L
+#define M_GC_WRITE_MEM_SUPPORT                        0x00000002L
+#define M_GC_CONCATENATION_SUPPORT                    0x00000001L
+
+// M_GC_STREAM_PROTOCOL_CAPABILITY values
+#define M_GC_FIREWALL_TRAVERSAL_SUPPORT               0x80000000L
+#define M_GC_LEGACY_16BIT_BLOCK_SUPPORT               0x40000000L
+
+// M_GC_MESSAGE_PROTOCOL_CAPABILITY values
+#define M_GC_FIREWALL_TRAVERSAL_SUPPORT               0x80000000L
+
+// M_GC_NETWORK_INTERFACE_CONFIGURATION and
+// M_GC_NETWORK_INTERFACE_CAPABILITY values
+#define M_GC_PAUSE_RECEPTION_SUPPORT                  0x80000000L
+#define M_GC_PAUSE_GENERATION_SUPPORT                 0x40000000L
+#define M_GC_LINK_LOCAL_ADDRESS_SUPPORT               0x00000004L
+#define M_GC_DHCP_SUPPORT                             0x00000002L
+#define M_GC_PERSISTENT_IP_SUPPORT                    0x00000001L
+
+// M_GC_PHYSICAL_LINK_CONFIGURATION_CAPABILITY values
+#define M_GC_SINGLE_LINK_SUPPORT                      0x00000001L
+#define M_GC_MULTIPLE_LINK_SUPPORT                    0x00000002L
+#define M_GC_STATIC_LINK_AGGREGATION_SUPPORT          0x00000004L
+#define M_GC_DYNAMIC_LINK_AGGREGATION_SUPPORT         0x00000008L
+
+// M_GC_STREAM_CHANNEL_CAPABILITY values
+#define M_GC_BIG_AND_LITTLE_ENDIAN_SUPPORT            0x80000000L
+#define M_GC_IP_REASSEMBLY_SUPPORT                    0x40000000L
+#define M_GC_MULTI_ZONE_SUPPORT                       0x00000010L
+#define M_GC_PACKET_RESEND_OPTION_SUPPORT             0x00000008L
+#define M_GC_ALL_IN_SUPPORT                           0x00000004L
+#define M_GC_UNCONDITIONAL_STREAMING_SUPPORT          0x00000002L
+#define M_GC_EXTENDED_CHUNK_DATA_SUPPORT              0x00000001L
+
+// M_GC_IEEE_1588_STATUS values
+#define M_GC_IEEE_1588_STATUS_INITIALIZING            0L
+#define M_GC_IEEE_1588_STATUS_FAULTY                  1L
+#define M_GC_IEEE_1588_STATUS_DISABLED                2L
+#define M_GC_IEEE_1588_STATUS_LISTENING               3L
+#define M_GC_IEEE_1588_STATUS_PREMASTER               4L
+#define M_GC_IEEE_1588_STATUS_MASTER                  5L
+#define M_GC_IEEE_1588_STATUS_PASSIVE                 6L
+#define M_GC_IEEE_1588_STATUS_UNCALIBRATED            7L
+#define M_GC_IEEE_1588_STATUS_SLAVE                   8L
+
+// M_GC_IEEE_1588_CLOCK_ACCURACY values
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_25NS        0x20L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_100NS       0x21L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_250NS       0x22L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_1US         0x23L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_2_5US       0x24L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_10US        0x25L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_25US        0x26L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_100US       0x27L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_250US       0x28L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_1MS         0x29L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_2_5MS       0x2AL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_10MS        0x2BL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_25MS        0x2CL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_100MS       0x2DL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_250MS       0x2EL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_1S          0x2FL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_10S         0x30L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_GREATER_10S        0x31L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_ALTERNATE_PROFILE  0x80L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_UNKNOWN            0xFEL
+
+#if OldDefinesSupport
+MIL_DEPRECATED(M_HARDWARE_PORT0, 1000)     // New IO API Replaced by M_AUX_IO0
+MIL_DEPRECATED(M_HARDWARE_PORT1, 1000)     // New IO API Replaced by M_AUX_IO1
+MIL_DEPRECATED(M_HARDWARE_PORT2, 1000)     // New IO API Replaced by M_AUX_IO2
+MIL_DEPRECATED(M_HARDWARE_PORT3, 1000)     // New IO API Replaced by M_AUX_IO3
+MIL_DEPRECATED(M_HARDWARE_PORT4, 1000)     // New IO API Replaced by M_AUX_IO4
+MIL_DEPRECATED(M_HARDWARE_PORT5, 1000)     // New IO API Replaced by M_AUX_IO5
+MIL_DEPRECATED(M_HARDWARE_PORT6, 1000)     // New IO API Replaced by M_AUX_IO6
+MIL_DEPRECATED(M_HARDWARE_PORT7, 1000)     // New IO API Replaced by M_AUX_IO7
+MIL_DEPRECATED(M_HARDWARE_PORT8, 1000)     // New IO API Replaced by M_AUX_IO8
+MIL_DEPRECATED(M_HARDWARE_PORT9, 1000)     // New IO API Replaced by M_AUX_IO9
+MIL_DEPRECATED(M_HARDWARE_PORT10, 1000)     // New IO API Replaced by M_AUX_IO10
+MIL_DEPRECATED(M_HARDWARE_PORT11, 1000)     // New IO API Replaced by M_AUX_IO11
+MIL_DEPRECATED(M_HARDWARE_PORT12, 1000)     // New IO API Replaced by M_AUX_IO12
+MIL_DEPRECATED(M_HARDWARE_PORT13, 1000)     // New IO API Replaced by M_AUX_IO13
+MIL_DEPRECATED(M_HARDWARE_PORT14, 1000)     // New IO API Replaced by M_AUX_IO14
+MIL_DEPRECATED(M_HARDWARE_PORT15, 1000)     // New IO API Replaced by M_AUX_IO15
+MIL_DEPRECATED(M_HARDWARE_PORT16, 1000)     // New IO API Replaced by M_AUX_IO16
+MIL_DEPRECATED(M_HARDWARE_PORT17, 1000)     // New IO API Replaced by M_AUX_IO17
+MIL_DEPRECATED(M_HARDWARE_PORT18, 1000)     // New IO API Replaced by M_AUX_IO18
+MIL_DEPRECATED(M_HARDWARE_PORT19, 1000)     // New IO API Replaced by M_AUX_IO19
+MIL_DEPRECATED(M_HARDWARE_PORT20, 1000)     // New IO API Replaced by M_AUX_IO20
+MIL_DEPRECATED(M_HARDWARE_PORT21, 1000)     // New IO API Replaced by M_AUX_IO21
+MIL_DEPRECATED(M_HARDWARE_PORT22, 1000)     // New IO API Replaced by M_AUX_IO22
+MIL_DEPRECATED(M_HARDWARE_PORT23, 1000)     // New IO API Replaced by M_AUX_IO23
+MIL_DEPRECATED(M_HARDWARE_PORT24, 1000)     // New IO API Replaced by M_AUX_IO24
+MIL_DEPRECATED(M_HARDWARE_PORT25, 1000)     // New IO API Replaced by M_AUX_IO25
+MIL_DEPRECATED(M_HARDWARE_PORT26, 1000)     // New IO API Replaced by M_AUX_IO26
+MIL_DEPRECATED(M_HARDWARE_PORT27, 1000)     // New IO API Replaced by M_AUX_IO27
+MIL_DEPRECATED(M_HARDWARE_PORT28, 1000)     // New IO API Replaced by M_AUX_IO28
+MIL_DEPRECATED(M_HARDWARE_PORT29, 1000)     // New IO API Replaced by M_AUX_IO29
+MIL_DEPRECATED(M_HARDWARE_PORT30, 1000)     // New IO API Replaced by M_AUX_IO30
+MIL_DEPRECATED(M_HARDWARE_PORT31, 1000)     // New IO API Replaced by M_AUX_IO31
+#endif
+
+
+#define M_LOCAL_ENGINE                                200L
+
+#define M_ABSOLUTE_MODE                               0x00000800
+#define M_RELATIVE_MODE                               0x00002000
+#define M_LEGACY_MODE                                 0x00000000
+
+#define M_FILL_DESTINATION                            -1
+
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+
+#define M_ASYNCHRONOUS_QUEUED                         3L
+
+#define M_LUT_PALETTE0                                0L
+#define M_LUT_PALETTE1                                1L
+#define M_LUT_PALETTE2                                2L
+#define M_LUT_PALETTE3                                3L
+#define M_LUT_PALETTE4                                4L
+#define M_LUT_PALETTE5                                5L
+#define M_LUT_PALETTE6                                6L
+#define M_LUT_PALETTE7                                7L
+
+#define M_GAIN0                                       0x00010000L
+#define M_GAIN1                                       (M_GAIN0 + 1)
+#define M_GAIN2                                       (M_GAIN0 + 2)
+#define M_GAIN3                                       (M_GAIN0 + 3)
+#define M_GAIN4                                       (M_GAIN0 + 4)
+#define M_GAIN5                                       (M_GAIN0 + 5)
+#define M_GAIN6                                       (M_GAIN0 + 6)
+#define M_GAIN7                                       (M_GAIN0 + 7)
+#define M_GAIN8                                       (M_GAIN0 + 8)
+#define M_GAIN9                                       (M_GAIN0 + 9)
+#define M_GAIN10                                      (M_GAIN0 + 10)
+
+#define M_OPTO                                        0L
+#define M_TTL                                         1L
+#define M_LVDS                                        2L
+#define M_TRI_STATE                                   3L
+#define M_NO_CONNECT                                  4L
+#define M_OPEN_DRAIN                                  5L
+#define M_RS422                                       6L
+#define M_CURRENT_SOURCE                              7L
+
+#define M_ENABLE                                      -9997L
+#define M_FINAL_GRAB                                  -9998L
+#define M_DISABLE                                     -9999L
+
+// M_DECODER_MODE
+#define M_ADV7183                                     1L
+#define M_ADV7184                                     2L
+
+
+// M_CAMERA_LOCK
+#define M_ENABLE                                      -9997L
+#define M_FAST                                   0x00002000L
+
+// Uart parity values
+#define M_ODD                                         1L
+#define M_EVEN                                        2L
+
+#define M_RS232                                       1L
+#define M_RS485                                       2L
+
+#define M_CALCULATE                                   1L
+
+// M_GRAB_ABORT
+#define M_IMMEDIATE                                  10L
+#define M_NEXT_FRAMES                                11L
+
+// M_GRAB_ERROR_STATUS
+#define M_PIXEL_ERROR                                 1L
+#define M_HSYNC_ERROR                                 2L
+#define M_VSYNC_ERROR                                 4L
+
+// M_AUDIO_ENCODING_FORMAT
+#define M_AUDIO_RAW_16                                1L
+#define M_AUDIO_ADPCM                                 2L
+#define M_AUDIO_MULAW                                 3L
+#define M_AUDIO_ALAW                                  4L
+
+// M_AUDIO_CHANNEL_MODE
+#define M_AUDIO_MONO                                  1L
+#define M_AUDIO_STEREO                                2L
+
+#define M_AUTOMATIC                                   0x00020000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_MANUAL                                      1L
+
+// M_INPUT_FILTER
+#define M_BYPASS                                      0L
+#define M_LOW_PASS_0                                  1L
+#define M_LOW_PASS_1                                  2L
+#define M_LOW_PASS_2                                  3L
+
+/* custom defines for IrisGT Dual */
+// M_CUSTOM_FPGA_PROCESSING_MAX_SELECTOR
+#define M_CUSTOM_FPGA_COLUMN                          1L
+#define M_CUSTOM_FPGA_ROW                             2L
+
+// Fixed Pattern Noise correction (FPN)
+#define M_SENSOR                                      1L
+#define M_PREPROCESSING                               2L
+
+// Exposure mode
+#define M_TIMED                                       0L
+#define M_TRIGGER_WIDTH                               1L
+
+// CXP test mode
+#define M_OFF                                         0L
+#define M_MODE1                                       1L
+
+// CXP Connection speed
+#define M_LOW_SPEED_21                                0x8L
+#define M_LOW_SPEED_42                                0x10L
+#define M_CXP1                                        0x28L
+#define M_CXP2                                        0x30L
+#define M_CXP3                                        0x38L
+#define M_CXP5                                        0x40L
+#define M_CXP6                                        0x48L
+#define M_CXP10                                       0x50L
+#define M_CXP12                                       0x58L
+
+#define M_DETECTED                                    0x100L
+#define M_UNDETECTED                                  0x200L
+
+/************************************************************************/
+/* MdigControl(): Used as connection selection                          */
+/************************************************************************/
+#define M_CONNECTION                               0L
+#define M_CONNECTION0                              M_CONNECTION
+#define M_CONNECTION1                              (M_CONNECTION+1)
+#define M_CONNECTION2                              (M_CONNECTION+2)
+#define M_CONNECTION3                              (M_CONNECTION+3)
+#define M_CONNECTION4                              (M_CONNECTION+4)
+#define M_CONNECTION5                              (M_CONNECTION+5)
+#define M_CONNECTION6                              (M_CONNECTION+6)
+#define M_CONNECTION7                              (M_CONNECTION+7)
+#define M_CONNECTION8                              (M_CONNECTION+8)
+#define M_CONNECTION9                              (M_CONNECTION+9)
+#define M_CONNECTION10                             (M_CONNECTION+10)
+#define M_CONNECTION11                             (M_CONNECTION+11)
+#define M_CONNECTION12                             (M_CONNECTION+12)
+#define M_CONNECTION13                             (M_CONNECTION+13)
+#define M_CONNECTION14                             (M_CONNECTION+14)
+#define M_CONNECTION15                             (M_CONNECTION+15)
+
+/************************************************************************/
+/* MdigControl(): Type of dialog for M_GENICAM_INTERACTIVE              */
+/************************************************************************/
+#define M_GENICAM_INTERACTIVE_MODAL_DIALOG           15L
+#define M_GENICAM_INTERACTIVE_MODELESS_DIALOG        16L
+
+
+/************************************************************************/
+/* MdigChannel()                                                        */
+/************************************************************************/
+#define M_DEFAULT                                     0x10000000L
+#define M_CH0                                         0x40000000L
+#define M_CH1                                         0x20000000L
+#define M_CH2                                         0x08000000L
+#define M_CH3                                         0x01000000L
+#define M_CH4                                         0x02000000L
+#define M_CH5                                         0x04000000L
+#define M_CH6                                         0x00800000L
+#define M_CH7                                         0x00400000L
+#define M_CH8                                         0x00200000L
+#define M_CH9                                         0x00100000L
+#define M_CH10                                        0x00080000L
+#define M_CH11                                        0x00040000L
+#define M_CH12                                        0x00020000L
+#define M_CH13                                        0x00010000L
+#define M_CH14                                        0x00008000L
+#define M_CH15                                        0x00004000L
+#define M_AUTOMATIC                                   0x00020000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_VOLTAGE                                     0x00010000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_SYNC                                        0x00002000L
+#define M_SIGNAL                                      0x00001000L
+#define M_AC                                          0x00000004L
+#define M_DC                                          0x00000002L
+#define M_CHANNEL_COLOR                               0x00000001L
+#define M_RGB                                         8L
+#define M_YC                                          9L
+#define M_ALL_CHANNEL                                 (M_CH0|M_CH1|M_CH2|M_CH3|M_CH4|M_CH5|M_CH6|M_CH7|M_CH8|M_CH9|M_CH10|M_CH11|M_CH12|M_CH13|M_CH14|M_CH15)
+#define M_ALL_CHANNELS                                M_ALL_CHANNEL
+
+
+/************************************************************************/
+/* MdigReference()                                                      */
+/************************************************************************/
+#define M_BLACK                                       0L
+#define M_WHITE                                       1L
+#define M_STEREO                                      0L
+#define M_MONO                                        1L
+
+/* See the Inquire for the M_CHx values */
+#define M_CH0_REF                                     M_CH0
+#define M_CH1_REF                                     M_CH1
+#define M_CH2_REF                                     M_CH2
+#define M_CH3_REF                                     M_CH3
+#define M_CH4_REF                                     M_CH4
+#define M_CH5_REF                                     M_CH5
+#define M_CH6_REF                                     M_CH6
+#define M_CH7_REF                                     M_CH7
+#define M_ALL_REF                                     (M_CH0_REF | M_CH1_REF | M_CH2_REF | M_CH3_REF | M_CH4_REF | M_CH5_REF | M_CH6_REF | M_CH7_REF)
+#define M_VOLTAGE                                     0x00010000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_AUTOMATIC                                   0x00020000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_MIN_LEVEL                                   0L
+#define M_MAX_LEVEL                                   255L
+
+// MdigControl/MdigReference/MdigInquire with M_GRAB_INPUT_GAIN or M_BLACK_REF
+#define M_TAP1                                        M_CH0
+#define M_TAP2                                        M_CH1
+
+/************************************************************************/
+/* MdigFocus()                                                          */
+/************************************************************************/
+#define M_NO_FILTER        0x00080000L
+#define M_NO_SUBSAMPLING   0x00100000L
+#define M_SMART_SCAN       0x00200000L
+#define M_SCAN_ALL         0x00400000L
+#define M_BISECTION        0x00800000L
+#define M_REFOCUS          0x01000000L
+#define M_EVALUATE         0x02000000L
+#define M_CHANGE           0x00000063L
+#define M_ON_FOCUS         0x00000064L
+#define M_STOP_FOCUS       0x00000002L
+
+/************************************************************************/
+/* MdigGrabWait()                                                       */
+/************************************************************************/
+#define M_GRAB_NEXT_FRAME                             1L
+#define M_GRAB_NEXT_FIELD                             2L
+#define M_GRAB_END                                    3L
+#define M_GRAB_READY                                  45L
+
+
+/************************************************************************/
+/* MdigHookFunction()                                                   */
+/************************************************************************/
+#define M_BOARD_HOOK                                  0
+#define M_CAMERA_HOOK                                 0
+#define M_UNHOOK                                      0x04000000L
+#define M_GC_EVENT                                    0x00400000L
+
+#define M_GRAB_END                                    3L
+#define M_GRAB_START                                  4L
+#define M_GRAB_FRAME_END                              5L
+#define M_GRAB_FIELD_END_ODD                          6L
+#define M_GRAB_FIELD_END_EVEN                         7L
+#define M_GRAB_FIELD_END                              8L
+#define M_FRAME_START                                 9L
+#define M_FIELD_START                                 20L
+#define M_FIELD_START_ODD                             21L
+#define M_FIELD_START_EVEN                            22L
+#define M_GRAB_FRAME_START                            13L
+#define M_GRAB_FIELD_START                            14L
+#define M_GRAB_FIELD_START_ODD                        15L
+#define M_GRAB_FIELD_START_EVEN                       16L
+#define M_UART_DATA_RECEIVED                          17L
+#define M_ROTARY_ENCODER                              0x700L
+#define M_GRAB_LINE                                   0x00100000L
+#define M_GRAB_LINE_END                               0x00200000L
+#define M_DCF_REALLOC                                 0x00000020L
+#define M_CAMERA_LOCK                                 5300L
+#define M_CAMERA_PRESENT                              5315L
+#define M_FEATURE_CHANGE                              26L
+
+#define M_GRAB_EXPOSURE_START                         100L
+#define M_EXPOSURE_START                              M_GRAB_EXPOSURE_START
+/* Reserve next 100 values                     from   101L*/
+/*                                             to     199L*/
+#define M_GRAB_EXPOSURE_END                           200L
+#define M_EXPOSURE_END                                M_GRAB_EXPOSURE_END
+/* Reserve next 100 values                     from   201L*/
+/*                                             to     299L*/
+
+/************************  Values that can be added to M_GC_EVENT*/
+#define M_ACQUISITION_TRIGGER                         0x00000011L
+#define M_ACQUISITION_START                           0x00000012L
+#define M_ACQUISITION_END                             0x00000013L
+#define M_ACQUISITION_TRANSFER_START                  0x00000014L
+#define M_ACQUISITION_TRANSFER_END                    0x00000015L
+#define M_ACQUISITION_ERROR                           0x00008010L
+#define M_FRAME_TRIGGER                               0x00000002L
+//#define M_FRAME_START                               0x00000009L
+#define M_FRAME_END                                   0x0000000aL
+#define M_FRAME_TRANSFER_START                        0x00000005L
+#define M_FRAME_TRANSFER_END                          0x00000006L
+//#define M_EXPOSURE_START                            0x0000001aL //26L
+//#define M_EXPOSURE_END                              0x00000023L //35L
+
+/**  Counter/timer indices that are added should start from one!*/
+#define M_GC_NUMBERED_EVENTS_MASK                     0x000000FFL
+#define M_GC_IS_NUMBERED_EVENT(a)                     (a&(M_COUNTER_START|M_COUNTER_END|M_TIMER_START|M_TIMER_ACTIVE|M_TIMER_END|M_LINE_RISING_EDGE|M_LINE_FALLING_EDGE|M_LINE_ANY_EDGE))
+#define M_COUNTER_START                               0x00000100L
+#define M_COUNTER_END                                 0x00000200L
+#define M_TIMER_START                                 0x00000300L
+#define M_TIMER_END                                   0x00000400L
+#define M_TIMER_ACTIVE                                0x00000800L
+
+/************************************   Line numbers are 0 or 1-based*/
+#define M_LINE_RISING_EDGE                            0x00000500L
+#define M_LINE_FALLING_EDGE                           0x00000600L
+#define M_LINE_ANY_EDGE                               0x00000700L
+
+/********************************************  Error event types*/
+//#define M_ERROR                                     0x40000000L
+#define M_ERROR_NOT_IMPLEMENTED                       0x00008001L
+#define M_ERROR_INVALID_PARAMETER                     0x00008002L
+#define M_ERROR_INVALID_ADDRESS                       0x00008003L
+#define M_ERROR_WRITE_PROTECTED                       0x00008004L
+#define M_ERROR_BAD_ALIGNMENT                         0x00008005L
+#define M_ERROR_ACCESS_DENIED                         0x00008006L
+#define M_ERROR_BUSY                                  0x00008007L
+#define M_ERROR_LOCAL_PROBLEM                         0x00008008L
+#define M_ERROR_MSG_MISMATCH                          0x00008009L
+#define M_ERROR_INVALID_PROTOCOL                      0x0000800AL
+#define M_ERROR_NO_MSG                                0x0000800BL
+#define M_ERROR_PACKET_UNAVAILABLE                    0x0000800CL
+#define M_ERROR_DATA_OVERRUN                          0x0000800DL
+#define M_ERROR_INVALID_HEADER                        0x0000800EL
+#define M_ERROR_WRONG_CONFIG                          0x0000800FL
+#define M_ERROR_PACKET_NOT_YET_AVAILABLE              0x00008010L
+#define M_ERROR_PACKET_AND_PREV_REMOVED_FROM_MEMORY   0x00008011L
+#define M_ERROR_PACKET_REMOVED_FROM_MEMORY            0x00008012L
+
+#define M_ERROR_GENERIC_ERROR                         0x00008FFFL
+
+#define M_DEVICE_SPECIFIC_EVENT                       0x00009000L
+
+/************************************************************************/
+/* MdigProcess()                                                        */
+/************************************************************************/
+
+#define M_DIG_PRCSS_COUNT_SHIFT                       0x00000005L
+#define M_DIG_PRCSS_COUNT_MASK                        0xFFFFFFE0L
+
+/* Operation bitwise parameters */
+#define M_WAIT                                        1L
+#define M_START                                       0x00000002L
+#define M_STOP                                        0x00000004L
+#define M_SEQUENCE                                    0x00000008L
+#define M_COUNT(n)                                    ((MIL_UINT32)(n << M_DIG_PRCSS_COUNT_SHIFT))
+#define M_FRAMES_PER_TRIGGER(n)                       M_COUNT(n)
+
+/* OperationFlag bitwise parameters */
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+#define M_CALIBRATION_PROPAGATE_ONCE                  0x00000000L
+#define M_CALIBRATION_PROPAGATE_AT_EACH_FRAME         0x00000004L
+#define M_CALIBRATION_PROPAGATE_OFF                   0x00000008L
+#define M_TRIGGER_FOR_FIRST_GRAB                      0x00000010L
+#define M_REGION_KEEP                                 0x00000000L
+#define M_REGION_DELETE_AT_EACH_FRAME                 0x00000020L
+
+/************************************************************************/
+/* MdigGetHookInfo()                                                    */
+/************************************************************************/
+#define M_ASYNC_HOOK                                  0x08000000L
+#define M_MODIFIED_BUFFER                             0x40000000L
+
+#define M_BUFFER_ID                                   0x00160000L
+#define M_REGION_OFFSET_X                             0x00410000L
+#define M_REGION_OFFSET_Y                             0x00420000L
+#define M_REGION_SIZE_X                               0x00430000L
+#define M_REGION_SIZE_Y                               0x00480000L
+#define M_BUFFER_INDEX                                0x001B0000L
+#define M_DIGITIZER_ID                                0x001C0000L
+#define M_DRIVER_HOOK_CONTEXT_PTR                     0x001D0000L
+#define M_GRAB_LINE                                   0x00100000L
+#define M_GRAB_LINE_END                               0x00200000L
+#define M_GC_CAMERA_TIME_STAMP                        0x00400000L
+#define M_GC_EVENT_DATA                               0x00800000L
+#define M_GC_EVENT_TYPE                               0x00810000L
+#define M_GC_EVENT_DATA_SIZE                          0x00820000L
+#define M_GRAB_TIME_STAMP                             0x00000040L //64L
+#define M_TIME_STAMP                                  M_GRAB_TIME_STAMP
+#define M_SOURCE_FRAME_INDEX                          1082L 
+#define M_GRAB_LINE_COUNTER                           0x0000111B //4379L
+#define M_GRAB_FRAME_BURST_COUNT                      4386L
+#define M_GRAB_FRAME_BURST_END_SOURCE                 4387L
+#define M_USER_DATA_PTR                               0x00000001
+#define M_CORRUPT                                     0x01000000L
+#define M_COUNTER_INDEX                               0x00830000L
+#define M_TIMER_INDEX                                 0x00840000L
+#define M_LINE_INDEX                                  0x00850000L
+#define M_ROTARY_ENCODER_INDEX                        0x00860000L
+#define M_GC_FEATURE_CHANGE_NAME                      (0x00870000L|M_CLIENT_ENCODING)
+#if OldDefinesSupport
+#define M_GC_FEATURE_CHANGE_NAME_SIZE                 (M_STRING_SIZE + M_GC_FEATURE_CHANGE_NAME)
+MIL_DEPRECATED(M_GC_FEATURE_CHANGE_NAME_SIZE, 1040)
+#endif
+#define M_GC_XML_TYPE                                 0x00880000L
+#define M_IO_INTERRUPT_SOURCE                         0x0008A000L
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+
+
+/************************************************************************/
+/* MdigInquireFeature() / MdigControlFeature ControlFlag                */
+/************************************************************************/
+#define M_DEFAULT                                                        0x10000000L
+
+// For reading feature properties
+#define M_FEATURE_INDEX_MASK                          MAKE_INT64(0x000000000000FFFF)
+#define M_FEATURE_PROPERTY_MASK                       MAKE_INT64(0x0000000000FF0000)
+#define M_FEATURE_NAME                                MAKE_INT64(0x0000000000020000)
+#define M_FEATURE_DISPLAY_NAME                        MAKE_INT64(0x0000000000030000)
+#define M_FEATURE_TYPE                                MAKE_INT64(0x0000000000040000)
+#define M_FEATURE_TOOLTIP                             MAKE_INT64(0x0000000000050000)
+#define M_FEATURE_DESCRIPTION                         MAKE_INT64(0x0000000000060000)
+#define M_FEATURE_ACCESS_MODE                         MAKE_INT64(0x0000000000070000)
+#define M_FEATURE_VISIBILITY                          MAKE_INT64(0x0000000000080000)
+#define M_FEATURE_CACHING_MODE                        MAKE_INT64(0x0000000000090000)
+#define M_FEATURE_STREAMABLE                          MAKE_INT64(0x00000000000A0000)
+#define M_FEATURE_DEPRECATED                          MAKE_INT64(0x00000000000B0000)
+#define M_FEATURE_REPRESENTATION                      MAKE_INT64(0x00000000000C0000)
+#define M_FEATURE_PRESENT                             MAKE_INT64(0x00000000000D0000)
+#define M_FEATURE_CHANGE_HOOK                         MAKE_INT64(0x00000000000E0000)
+#define M_FEATURE_POLLING_INTERVAL                    MAKE_INT64(0x00000000000F0000)
+#define M_FEATURE_UNIT                                MAKE_INT64(0x0000000000100000)
+
+// For reading/writing feature values
+#define M_FEATURE_VALUE                               MAKE_INT64(0x0000000000FA0000)
+#if OldDefinesSupport
+#define M_FEATURE_VALUE_AS_STRING                     MAKE_INT64(0x0000000000FB0000)
+#define M_FEATURE_VALUE_AS_STRING_INTERNAL            MAKE_INT64(0x0000000000FB0000)
+MIL_DEPRECATED(M_FEATURE_VALUE_AS_STRING, 1060)      // New Control Feature API Replaced by M_FEATURE_VALUE and M_TYPE_STRING as UserVarType, UserVarPtr must be an array to a MIL_TEXT_CHAR
+#endif
+#define M_FEATURE_EXECUTE                             MAKE_INT64(0x0000000000FC0000)
+#define M_FEATURE_MIN                                 MAKE_INT64(0x0000000000FD0000)
+#define M_FEATURE_MAX                                 MAKE_INT64(0x0000000000FE0000)
+#define M_FEATURE_INCREMENT                           MAKE_INT64(0x0000000000FF0000)
+#define M_FEATURE_EXECUTE_COMPLETED                   MAKE_INT64(0x0000000000FC0000)
+
+#define M_FEATURE_SIZE                               (MAKE_INT64(0x0000000100000000)|M_CLIENT_ENCODING)
+
+#define M_IGNORE_CACHE                                MAKE_INT64(0x0000000200000000)
+
+#define M_FEATURE_OP_MASK                             MAKE_INT64(0x0000000000FF0000)
+#define M_FEATURE_OP(N)                               ((N) & M_FEATURE_OP_MASK)
+
+#define M_FEATURE_ENUM_MASK                           MAKE_INT64(0x0F00000000000000)
+#define M_FEATURE_ENUM(N)                             ((N) & M_FEATURE_ENUM_MASK)
+
+// For enumerating the GenICam feature tree.
+#define M_GC_NODE_COUNT                               MAKE_INT64(0x0000000000010000)
+
+#define M_GC_NODES                                    MAKE_INT64(0x0100000000000000)
+#define M_SUBFEATURE_INDEX_MASK                       M_FEATURE_INDEX_MASK
+#define M_SUBFEATURE_INDEX(N)                         ((N) & M_SUBFEATURE_INDEX_MASK)
+#define M_SUBFEATURE_COUNT                            (M_GC_NODES + M_GC_NODE_COUNT)
+#define M_SUBFEATURE_NAME                             (M_GC_NODES + M_FEATURE_NAME)
+#define M_SUBFEATURE_TYPE                             (M_GC_NODES + M_FEATURE_TYPE)
+
+// For targeting a specific XML file
+#define M_GENTL_XML_TYPE_MASK                         MAKE_INT64(0x000000000F000000)
+#define M_GENTL_XML_STRIP_TYPE_MASK(N)                ((N) & ~M_GENTL_XML_TYPE_MASK)
+#define M_GENTL_XML_INDEX_MASK_LOWER                  MAKE_INT64(0x000000F000000000)
+#define M_GENTL_XML_INDEX_MASK_UPPER                  MAKE_INT64(0x0000100000000000)
+#define M_GENTL_XML_INDEX_MASK                        (M_GENTL_XML_INDEX_MASK_UPPER | M_GENTL_XML_INDEX_MASK_LOWER)
+#define M_GENTL_XML_INDEX_SHIFT_LOWER                 MAKE_INT64(36)
+#define M_GENTL_XML_INDEX_SHIFT_UPPER                 MAKE_INT64(40)
+#define M_GENTL_XML_INDEX(N)                          ((((N) & M_GENTL_XML_INDEX_MASK_UPPER) >> M_GENTL_XML_INDEX_SHIFT_UPPER) | (((N) & M_GENTL_XML_INDEX_MASK_LOWER) >> M_GENTL_XML_INDEX_SHIFT_LOWER))
+#define M_GENTL_XML_STRIP_INDEX(N)                    ((N) & ~M_GENTL_XML_INDEX_MASK)
+
+#define M_GENTL_SYSTEM                                MIL_MAKE_CONST(0x01000000, 0x0000000001000000)
+#define M_GENTL_INTERFACE                             MIL_MAKE_CONST(0x02000000, 0x0000000002000000)
+#define M_GENTL_DEVICE                                MIL_MAKE_CONST(0x03000000, 0x0000000003000000)
+#define M_GENTL_REMOTE_DEVICE                         MIL_MAKE_CONST(0x08000000, 0x0000000008000000)
+#define M_GENTL_STREAM                                MIL_MAKE_CONST(0x09000000, 0x0000000009000000)
+#define M_GENTL_BUFFER                                MIL_MAKE_CONST(0x0A000000, 0x000000000A000000)
+
+#define M_GENTL_INTERFACE_NUMBER(N)                  (M_GENTL_INTERFACE | ((((MIL_INT64)N) << M_GENTL_XML_INDEX_SHIFT_LOWER) & M_GENTL_XML_INDEX_MASK_LOWER) | ((((MIL_INT64)N) << M_GENTL_XML_INDEX_SHIFT_UPPER) & M_GENTL_XML_INDEX_MASK_UPPER))
+#define M_GENTL_INTERFACE0                            MAKE_INT64(0x0000000002000000)
+#define M_GENTL_INTERFACE1                            MAKE_INT64(0x0000001002000000)
+#define M_GENTL_INTERFACE2                            MAKE_INT64(0x0000002002000000)
+#define M_GENTL_INTERFACE3                            MAKE_INT64(0x0000003002000000)
+#define M_GENTL_INTERFACE4                            MAKE_INT64(0x0000004002000000)
+#define M_GENTL_INTERFACE5                            MAKE_INT64(0x0000005002000000)
+#define M_GENTL_INTERFACE6                            MAKE_INT64(0x0000006002000000)
+#define M_GENTL_INTERFACE7                            MAKE_INT64(0x0000007002000000)
+#define M_GENTL_INTERFACE8                            MAKE_INT64(0x0000008002000000)
+#define M_GENTL_INTERFACE9                            MAKE_INT64(0x0000009002000000)
+#define M_GENTL_INTERFACE10                           MAKE_INT64(0x000000A002000000)
+#define M_GENTL_INTERFACE11                           MAKE_INT64(0x000000B002000000)
+#define M_GENTL_INTERFACE12                           MAKE_INT64(0x000000C002000000)
+#define M_GENTL_INTERFACE13                           MAKE_INT64(0x000000D002000000)
+#define M_GENTL_INTERFACE14                           MAKE_INT64(0x000000E002000000)
+#define M_GENTL_INTERFACE15                           MAKE_INT64(0x000000F002000000)
+#define M_GENTL_INTERFACE16                           MAKE_INT64(0x0000100002000000)
+#define M_GENTL_INTERFACE17                           MAKE_INT64(0x0000101002000000)
+#define M_GENTL_INTERFACE18                           MAKE_INT64(0x0000102002000000)
+#define M_GENTL_INTERFACE19                           MAKE_INT64(0x0000103002000000)
+#define M_GENTL_INTERFACE20                           MAKE_INT64(0x0000104002000000)
+#define M_GENTL_INTERFACE21                           MAKE_INT64(0x0000105002000000)
+#define M_GENTL_INTERFACE22                           MAKE_INT64(0x0000106002000000)
+#define M_GENTL_INTERFACE23                           MAKE_INT64(0x0000107002000000)
+#define M_GENTL_INTERFACE24                           MAKE_INT64(0x0000108002000000)
+#define M_GENTL_INTERFACE25                           MAKE_INT64(0x0000109002000000)
+#define M_GENTL_INTERFACE26                           MAKE_INT64(0x000010A002000000)
+#define M_GENTL_INTERFACE27                           MAKE_INT64(0x000010B002000000)
+#define M_GENTL_INTERFACE28                           MAKE_INT64(0x000010C002000000)
+#define M_GENTL_INTERFACE29                           MAKE_INT64(0x000010D002000000)
+#define M_GENTL_INTERFACE30                           MAKE_INT64(0x000010E002000000)
+#define M_GENTL_INTERFACE31                           MAKE_INT64(0x000010F002000000)
+
+#define M_GENTL_STREAM_NUMBER(N)                     (M_GENTL_STREAM | ((((MIL_INT64)N) << M_GENTL_XML_INDEX_SHIFT_LOWER) & M_GENTL_XML_INDEX_MASK_LOWER) | ((((MIL_INT64)N) << M_GENTL_XML_INDEX_SHIFT_UPPER) & M_GENTL_XML_INDEX_MASK_UPPER))
+#define M_GENTL_STREAM0                               MAKE_INT64(0x0000000009000000)
+#define M_GENTL_STREAM1                               MAKE_INT64(0x0000001009000000)
+#define M_GENTL_STREAM2                               MAKE_INT64(0x0000002009000000)
+#define M_GENTL_STREAM3                               MAKE_INT64(0x0000003009000000)
+#define M_GENTL_STREAM4                               MAKE_INT64(0x0000004009000000)
+#define M_GENTL_STREAM5                               MAKE_INT64(0x0000005009000000)
+#define M_GENTL_STREAM6                               MAKE_INT64(0x0000006009000000)
+#define M_GENTL_STREAM7                               MAKE_INT64(0x0000007009000000)
+#define M_GENTL_STREAM8                               MAKE_INT64(0x0000008009000000)
+#define M_GENTL_STREAM9                               MAKE_INT64(0x0000009009000000)
+#define M_GENTL_STREAM10                              MAKE_INT64(0x000000A009000000)
+#define M_GENTL_STREAM11                              MAKE_INT64(0x000000B009000000)
+#define M_GENTL_STREAM12                              MAKE_INT64(0x000000C009000000)
+#define M_GENTL_STREAM13                              MAKE_INT64(0x000000D009000000)
+#define M_GENTL_STREAM14                              MAKE_INT64(0x000000E009000000)
+#define M_GENTL_STREAM15                              MAKE_INT64(0x000000F009000000)
+#define M_GENTL_STREAM16                              MAKE_INT64(0x0000100009000000)
+#define M_GENTL_STREAM17                              MAKE_INT64(0x0000101009000000)
+#define M_GENTL_STREAM18                              MAKE_INT64(0x0000102009000000)
+#define M_GENTL_STREAM19                              MAKE_INT64(0x0000103009000000)
+#define M_GENTL_STREAM20                              MAKE_INT64(0x0000104009000000)
+#define M_GENTL_STREAM21                              MAKE_INT64(0x0000105009000000)
+#define M_GENTL_STREAM22                              MAKE_INT64(0x0000106009000000)
+#define M_GENTL_STREAM23                              MAKE_INT64(0x0000107009000000)
+#define M_GENTL_STREAM24                              MAKE_INT64(0x0000108009000000)
+#define M_GENTL_STREAM25                              MAKE_INT64(0x0000109009000000)
+#define M_GENTL_STREAM26                              MAKE_INT64(0x000010A009000000)
+#define M_GENTL_STREAM27                              MAKE_INT64(0x000010B009000000)
+#define M_GENTL_STREAM28                              MAKE_INT64(0x000010C009000000)
+#define M_GENTL_STREAM29                              MAKE_INT64(0x000010D009000000)
+#define M_GENTL_STREAM30                              MAKE_INT64(0x000010E009000000)
+#define M_GENTL_STREAM31                              MAKE_INT64(0x000010F009000000)
+
+/* Values returned by M_FEATURE_ACCESS_MODE */
+#define M_FEATURE_NOT_IMPLEMENTED                     1
+#define M_FEATURE_NOT_AVAILABLE                       2
+#define M_FEATURE_WRITE_ONLY                          3
+#define M_FEATURE_READ_ONLY                           4
+#define M_FEATURE_READ_WRITE                          5
+#define M_FEATURE_IS_IMPLEMENTED(ACCESSMODE)          (((ACCESSMODE) != M_FEATURE_NOT_IMPLEMENTED) ? M_TRUE : M_FALSE)
+#define M_FEATURE_IS_AVAILABLE(ACCESSMODE)            ((! ( (ACCESSMODE) == M_FEATURE_NOT_AVAILABLE || (ACCESSMODE) == M_FEATURE_NOT_IMPLEMENTED )) ? M_TRUE : M_FALSE)
+#define M_FEATURE_IS_READABLE(ACCESSMODE)             ((((ACCESSMODE) == M_FEATURE_READ_ONLY)   || ((ACCESSMODE) == M_FEATURE_READ_WRITE)) ? M_TRUE : M_FALSE)
+#define M_FEATURE_IS_WRITABLE(ACCESSMODE)             ((((ACCESSMODE) == M_FEATURE_WRITE_ONLY)  || ((ACCESSMODE) == M_FEATURE_READ_WRITE)) ? M_TRUE : M_FALSE)
+
+/* Values returned by M_FEATURE_VISIBILITY */
+#define M_FEATURE_VISIBILITY_BEGINNER                 1
+#define M_FEATURE_VISIBILITY_EXPERT                   2
+#define M_FEATURE_VISIBILITY_GURU                     3
+#define M_FEATURE_VISIBILITY_INVISIBLE                4
+
+/* Values returned by M_FEATURE_CACHING_MODE */
+#define M_FEATURE_CACHING_MODE_NONE                   1
+#define M_FEATURE_CACHING_MODE_WRITE_THROUGH          2
+#define M_FEATURE_CACHING_MODE_WRITE_AROUND           3
+#define M_FEATURE_IS_CACHABLE(N)                      (((N) != M_FEATURE_CACHING_MODE_NONE) ? M_TRUE : M_FALSE)
+
+/* Values returned by M_FEATURE_REPRESENTATION */
+#define M_FEATURE_REPRESENTATION_LINEAR               1
+#define M_FEATURE_REPRESENTATION_LOGARITHMIC          2
+#define M_FEATURE_REPRESENTATION_BOOLEAN              3
+#define M_FEATURE_REPRESENTATION_PURE_NUMBER          4
+#define M_FEATURE_REPRESENTATION_HEX_NUMBER           5
+#define M_FEATURE_REPRESENTATION_IPV4_ADDRESS         6
+#define M_FEATURE_REPRESENTATION_MAC_ADDRESS          7
+
+// For enumerating enum entries in enumeration type features
+#define M_FEATURE_ENUM_ENTRY                          MAKE_INT64(0x0200000000000000)
+#define M_FEATURE_ENUM_ENTRY_INDEX_MASK               M_FEATURE_INDEX_MASK
+#define M_FEATURE_ENUM_ENTRY_INDEX(N)                 ((N) & M_FEATURE_ENUM_ENTRY_INDEX_MASK)
+#define M_FEATURE_ENUM_ENTRY_COUNT                    (M_FEATURE_ENUM_ENTRY + M_GC_NODE_COUNT)
+#define M_FEATURE_ENUM_ENTRY_NAME                     (M_FEATURE_ENUM_ENTRY + M_FEATURE_NAME)
+#define M_FEATURE_ENUM_ENTRY_DISPLAY_NAME             (M_FEATURE_ENUM_ENTRY + M_FEATURE_DISPLAY_NAME)
+#define M_FEATURE_ENUM_ENTRY_VALUE                    (M_FEATURE_ENUM_ENTRY + M_FEATURE_VALUE)
+#define M_FEATURE_ENUM_ENTRY_TOOLTIP                  (M_FEATURE_ENUM_ENTRY + M_FEATURE_TOOLTIP)
+#define M_FEATURE_ENUM_ENTRY_DESCRIPTION              (M_FEATURE_ENUM_ENTRY + M_FEATURE_DESCRIPTION)
+#define M_FEATURE_ENUM_ENTRY_ACCESS_MODE              (M_FEATURE_ENUM_ENTRY + M_FEATURE_ACCESS_MODE)
+#define M_FEATURE_ENUM_ENTRY_VISIBILITY               (M_FEATURE_ENUM_ENTRY + M_FEATURE_VISIBILITY)
+#define M_FEATURE_ENUM_ENTRY_CACHING_MODE             (M_FEATURE_ENUM_ENTRY + M_FEATURE_CACHING_MODE)
+#define M_FEATURE_ENUM_ENTRY_STREAMABLE               (M_FEATURE_ENUM_ENTRY + M_FEATURE_STREAMABLE)
+
+#define M_FEATURE_SELECTOR                            MAKE_INT64(0x0300000000000000)
+#define M_FEATURE_SELECTOR_INDEX_MASK                 M_FEATURE_INDEX_MASK
+#define M_FEATURE_SELECTOR_INDEX(N)                   ((N) & M_FEATURE_SELECTOR_INDEX_MASK)
+#define M_FEATURE_SELECTOR_COUNT                      (M_FEATURE_SELECTOR + M_GC_NODE_COUNT)
+#define M_FEATURE_SELECTOR_NAME                       (M_FEATURE_SELECTOR + M_FEATURE_NAME)
+
+#define M_FEATURE_VALID_VALUE_LIST                    MAKE_INT64(0x0400000000000000)
+#define M_FEATURE_VALID_VALUE_INDEX_MASK              M_FEATURE_INDEX_MASK
+#define M_FEATURE_VALID_VALUE_INDEX(N)                ((N) & M_FEATURE_VALID_VALUE_INDEX_MASK)
+#define M_FEATURE_VALID_VALUE_COUNT                   (M_FEATURE_VALID_VALUE_LIST + M_GC_NODE_COUNT)
+#define M_FEATURE_VALID_VALUE                         (M_FEATURE_VALID_VALUE_LIST + M_FEATURE_VALUE)
+
+#define M_MIN                                                            0x02000000L   // Deprecated for MdigInquire/ControlFeature() use M_FEATURE_MIN
+#define M_MAX                                                            0x04000000L   // Deprecated for MdigInquire/ControlFeature() use M_FEATURE_MAX
+#define M_LENGTH                                                         0x00002000L   // Deprecated for MdigInquire/ControlFeature() use M_STRING_SIZE or M_FEATURE_SIZE
+
+#if OldDefinesSupport
+#define M_ELEMENT                                     M_FEATURE_ENUM_ENTRY             // Deprecated for MdigInquire/ControlFeature() use one of M_FEATURE_ENUM_ENTRY...
+#define M_ELEMENT_COUNT                               M_GC_NODE_COUNT                  // Deprecated for MdigInquire/ControlFeature() use one of M_FEATURE_ENUM_ENTRY...
+#define M_INCREMENT                                   MAKE_INT64(0x0000040000000000)   // Deprecated for MdigInquire/ControlFeature() use M_FEATURE_INCREMENT
+MIL_DEPRECATED(M_ELEMENT, 1000)                       // New Control Feature API Replaced by M_FEATURE_ENUM_ENTRY
+MIL_DEPRECATED(M_ELEMENT_COUNT, 1000)                 // New Control Feature API Replaced by M_FEATURE_ENUM_ENTRY_COUNT
+//MIL_DEPRECATED(M_INCREMENT, 1000)                     // New Control Feature API Replaced by M_FEATURE_INCREMENT
+#endif
+
+/************************************************************************/
+/* MdigInquireFeature() / MdigControlFeature FeatureType                */
+/************************************************************************/
+#define M_FEATURE_USER_ARRAY_SIZE_MASK                MAKE_INT64(0x000000007FFFFFFF)
+#define M_FEATURE_USER_ARRAY_SIZE_SHIFT               MAKE_INT64(0x0000000000000000)
+#define M_FEATURE_USER_ARRAY_SIZE(N)                  (M_FEATURE_USER_ARRAY_SIZE_BITS | (((N) & M_FEATURE_USER_ARRAY_SIZE_MASK) << M_FEATURE_USER_ARRAY_SIZE_SHIFT))
+#define M_FEATURE_USER_ARRAY_SIZE_VALUE(N)            (M_FEATURE_USER_ARRAY_SIZE_BIT_SET(N) ? (((N) >> M_FEATURE_USER_ARRAY_SIZE_SHIFT) & M_FEATURE_USER_ARRAY_SIZE_MASK) : 0)
+#define M_STRIP_FEATURE_USER_ARRAY_SIZE_VALUE(N)      (M_FEATURE_USER_ARRAY_SIZE_BIT_SET(N) ? ((N) & (~(M_FEATURE_USER_ARRAY_SIZE_BITS | (M_FEATURE_USER_ARRAY_SIZE_MASK << M_FEATURE_USER_ARRAY_SIZE_SHIFT)))) : N)
+
+#if OldDefinesSupport
+#define M_STRING_ARRAY_SIZE_MASK                      M_FEATURE_USER_ARRAY_SIZE_MASK
+#define M_STRING_ARRAY_SIZE_SHIFT                     M_FEATURE_USER_ARRAY_SIZE_SHIFT
+#define M_STRING_ARRAY_SIZE(N)                        M_FEATURE_USER_ARRAY_SIZE(N)
+#define M_ARRAY_SIZE(N)                               M_FEATURE_USER_ARRAY_SIZE(N)
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE, 1060)             // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE
+MIL_DEPRECATED(M_ARRAY_SIZE, 1060)                    // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_MASK, 1060)        // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_MASK
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_SHIFT, 1060)       // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_SHIFT
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_VALUE, 1060)       // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_VALUE
+MIL_DEPRECATED(M_STRIP_STRING_ARRAY_SIZE_VALUE, 1060) // New Control Feature API Replaced by M_STRIP_FEATURE_USER_ARRAY_SIZE_VALUE
+#endif
+
+
+/************************************************************************/
+/* MgenLutFunction()                                                    */
+/************************************************************************/
+#define M_LOG                                         0x010DL  //Also defined in milim.h for MimArith
+#define M_EXP                                         0x010AL  //Also defined in milim.h for MimArith
+#define M_SIN                                         0x00000002L
+#define M_COS                                         0x00000003L
+#define M_TAN                                         0x00000004L
+#define M_QUAD                                        0x00000005L
+#define M_POWER                                       0x00000006L
+#if(MIL_COMPILE_VERSION >= 1040)
+#define M_COLORMAP_JET                                (M_PSEUDO_ID+12)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_HOT                                (M_PSEUDO_ID+13)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_HUE                                (M_PSEUDO_ID+14)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_SPECTRUM                           (M_PSEUDO_ID+15)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#else
+#define M_COLORMAP_JET                                0x00000007L
+#define M_COLORMAP_HOT                                0x00000008L
+#define M_COLORMAP_HUE                                0x00000009L
+#define M_COLORMAP_SPECTRUM                           0x0000000AL
+#endif
+#if(MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#define M_COLORMAP_JET_OLD                            0x00000007L
+#define M_COLORMAP_HOT_OLD                            0x00000008L
+#define M_COLORMAP_HUE_OLD                            0x00000009L
+#define M_COLORMAP_SPECTRUM_OLD                       0x0000000AL
+#endif
+#define M_FIRST_GRAY                                  0x00004000L //Combined with M_COLORMAP_...
+#define M_LAST_GRAY                                   0x00002000L //Combined with M_COLORMAP_...
+#define M_SIGMOID                                     0x0000000BL
+#define M_TONE_MAPPING                                0x0000000CL
+
+
+
+#define M_COLORMAP_MASK                               (0xFFFFFFFF - M_FIRST_GRAY - M_LAST_GRAY)
+#if(MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#define IS_GEN_LUT_COLORMAP_FUNCTION(func)  ((((func) & M_COLORMAP_MASK) == M_COLORMAP_HOT) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_JET) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_SPECTRUM) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_HUE) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_TURBO) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_DISTINCT_256) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_HOT_OLD) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_JET_OLD) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_SPECTRUM_OLD) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_HUE_OLD) )
+#else
+#define IS_GEN_LUT_COLORMAP_FUNCTION(func)  ((((func) & M_COLORMAP_MASK) == M_COLORMAP_HOT) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_JET) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_SPECTRUM) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_HUE) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_TURBO) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_DISTINCT_256) )
+#endif
+
+#define IS_GEN_LUT_FUNCTION(func) ( ((func) == M_COS) || \
+                                    ((func) == M_EXP) || \
+                                    ((func) == M_LOG) || \
+                                    ((func) == M_POWER) || \
+                                    ((func) == M_QUAD) || \
+                                    ((func) == M_SIN) || \
+                                    ((func) == M_TAN) || \
+                                    ((func) == M_SIGMOID) || \
+                                    ((func) == M_TONE_MAPPING) || \
+                                    IS_GEN_LUT_COLORMAP_FUNCTION(func) )
+
+/************************************************************************/
+/* MgenWarpParameter()                                                  */
+/************************************************************************/
+/* 8 bits reserved for number of fractional bits added to M_FIXED_POINT */
+#define M_WARP_MATRIX                                 0x00100000L
+#define M_WARP_POLYNOMIAL                             0x00200000L
+#define M_WARP_LUT                                    0x00400000L
+#define M_WARP_4_CORNER                               0x00800000L
+#define M_WARP_4_CORNER_REVERSE                       0x01000000L
+/* Optional controls */
+#define M_FIXED_POINT                                 0x00004000L
+#define M_OVERSCAN_ENABLE                             0x00008000L
+/*#define M_OVERSCAN_DISABLE                          See previous definition*/
+#define M_OVERSCAN_FAST                               0x00040000L
+#define M_FAST                                        0x00002000L
+#define M_VERY_FAST                                   0x00010000L
+#define M_REGULAR                                     0x00020000L
+
+/* Transforms */
+#define M_RESIZE                                      1L
+#define M_ROTATE                                      2L
+#define M_SHEAR_X                                     3L
+#define M_SHEAR_Y                                     4L
+#define M_TRANSLATE                                   5L
+#define M_SCALE                                 0x00008010L
+
+/************************************************************************/
+/* MbufBayer() defines                                                  */
+/************************************************************************/
+#define M_BAYER_GB                                    32L
+#define M_BAYER_BG                                    64L
+#define M_BAYER_RG                                    96L
+#define M_BAYER_GR                                    128L
+#define M_WHITE_BALANCE_CALCULATE                     16L
+#define M_BAYER_NORMALIZE                             512L
+#define M_COLOR_CORRECTION                            1024L
+#define M_ADAPTIVE                                    2048L 
+#define M_AVERAGE_2X2                                 4096L
+#define M_ADAPTIVE_FAST                               8192L
+#define M_BAYER_BIT_SHIFT_MASK                        0x01F00000L
+#define M_BAYER_EXTRACT_BIT_SHIFT(ControlFlag)        (MIL_INT)((ControlFlag & M_BAYER_BIT_SHIFT_MASK) >> 20)
+#define M_BAYER_BIT_SHIFT(NbBit)                      (NbBit << 20)
+#define M_BAYER_REVERSE                               M_REVERSE
+#define M_BAYER_OVERSCAN_ENABLE                       M_OVERSCAN_ENABLE
+#define M_BAYER_OVERSCAN_DISABLE                      M_OVERSCAN_DISABLE
+#define M_CUSTOM_BRGG                                 256L
+#define M_CUSTOM_RBGG                                 288L
+#define M_CUSTOM_GGBR                                 320L
+#define M_CUSTOM_GGRB                                 352L
+
+#define M_BAYER_MASK                                 (M_BAYER_GB    | \
+                                                      M_BAYER_BG    | \
+                                                      M_BAYER_RG    | \
+                                                      M_BAYER_GR    | \
+                                                      M_CUSTOM_BRGG | \
+                                                      M_CUSTOM_RBGG | \
+                                                      M_CUSTOM_GGBR | \
+                                                      M_CUSTOM_GGRB)
+
+/************************************************************************/
+/* DContext & Datagram Param Role attributes                            */
+/************************************************************************/
+#define M_ROLE_UNUSED_1                               0x00000001
+#define M_SKIP_PFNC_CHECK                             0x00000002
+#define M_ALLOW_BUFFER_WITH_REGION_MODIFY             0x00000004L
+//#define M_GRAB                                      0x00000008L
+//#define M_PROC                                      0x00000010L
+//#define M_DISP                                      0x00000020L
+//#define M_BASIC_BUFFER_PURPOSE                      (M_GRAB|M_PROC|M_DISP)
+#define M_SKIP_PORTABLE_CHECK                         0x00000040
+#define M_NO_DMIL_COMPENSATION                        0x00000080L
+#define M_IS_RETURN_VALUE                             0x00000100L
+#define M_IN                                          0x00000200L
+#define M_OUT                                         0x00000400L
+#define M_SRC                                         M_IN
+#define M_DEST                                        M_OUT
+#define M_ALLOW_NULL_ID                               0x00000800L
+#define M_ALLOW_NULL_VALUE                            M_ALLOW_NULL_ID
+#define M_ALLOW_DEFAULT_ID                            0x00001000L
+#define M_ALLOW_PSEUDO_ID                             0x00002000
+#define M_AS_VALUE                                    0x00004000L 
+#define M_ALLOW_BUFFER_WITH_REGION                    0x00008000L
+
+#define M_PROCMAN_ATTRIBUTE_BITS                      0xFFFF0000L
+#define M_INTERNAL_PARAMETER                          0x00010000L       // Used for internal adjusted buffers
+#define M_EXCLUDE_FOR_ANY_ADJUSTMENT                  0x00040000L       // Not considered for any adjustments in the ProcManager
+#define M_EXCLUDE_FOR_INTERSECTION                    0x00080000L       // Not considered when computing the Size and #Band intersection in ProcManager
+#define M_EXCLUDE_FOR_SYSTEM_SELECTION                0x00100000L       // Not considered when selecting the system in SystemCallControl
+#define M_EXCLUDE_FOR_TYPE_ADJUSTMENT                 0x00200000L       // Not considered for type adjustment in ProcManager
+
+#define M_STRICTLY_ROLE_BITS                          (M_ROLE_UNUSED_1 | M_SKIP_PFNC_CHECK | M_ALLOW_BUFFER_WITH_REGION_MODIFY | M_SKIP_PORTABLE_CHECK | M_NO_DMIL_COMPENSATION | M_IS_RETURN_VALUE | M_ALLOW_PSEUDO_ID |M_IN|M_OUT|M_ALLOW_NULL_ID|M_ALLOW_DEFAULT_ID|M_AS_VALUE|M_ALLOW_BUFFER_WITH_REGION)
+
+// this mask is used to get the value needed in the CommandDispatcher to determine 
+// what to do with the MIL_ID
+#define M_ROLE_IO_MASK                                (M_IN | M_OUT | M_AS_VALUE)
+
+// Macro used to identify virtual id.  A virtual id is accepted in parameters accepting
+// MIL_ID but does not identify an existing resource having a valid MGObject.
+#define M_IS_DEFAULT_ID(Id)      ((Id) == M_DEFAULT)
+#define M_IS_NULL_ID(Id)         ((Id) == M_NULL)
+
+#define M_ID_IS_VIRTUAL_OR_NULL(Id)      (M_IS_DEFAULT_ID(Id) || M_IS_PSEUDO_ID(Id) || M_IS_NULL_ID(Id) )
+#define M_ID_IS_VIRTUAL(Id)              (M_IS_DEFAULT_ID(Id) || M_IS_PSEUDO_ID(Id))
+
+/************************************************************************/
+/* Buffer attributes                                                    */
+/************************************************************************/
+#define M_UNKNOWN_OBJECT_TYPE                         0x00000000L
+#define M_IMAGE                                       0x00000004L
+#define M_GRAB                                        0x00000008L
+#define M_PROC                                        0x00000010L
+#define M_DISP                                        0x00000020L
+#define M_BASIC_BUFFER_PURPOSE                        (M_GRAB|M_PROC|M_DISP)
+#define M_ARRAY                                       0x00000040L
+#define M_EVENT                                       0x00000080L
+#define M_SYSTEM_THREAD                               0x00000100L
+#define M_APPLICATION                                 0x00000200L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_THREAD_CONTEXT                              0x00000400L
+#endif
+#define M_EVENT_CONTEXT                               0x00000800L
+#define M_STAT_LIST                                   0x00001000L
+#define M_HIST_LIST                                   0x00002000L
+#define M_PROJ_LIST                                   0x00004000L
+#define M_EVENT_LIST                                  0x00008000L
+#define M_EXTREME_LIST                                0x00010000L
+#define M_COUNT_LIST                                  0x00020000L
+#define M_LUT                                         0x00040000L
+#define M_WARP_COEFFICIENT                            0x00080000L
+#define M_DIGITIZER                                   0x00100000L
+#define M_DISPLAY                                     0x00200000L
+#define M_KERNEL                                      0x00400000L
+#define M_SYSTEM                                      0x00800000L
+#define M_GRAPHIC_CONTEXT                             0x01000000L
+#define M_CALL_CONTEXT                                0x02000000L
+#define M_ERROR_CONTEXT                               0x04000000L
+#define M_STRUCT_ELEMENT                              0x08000000L
+#define M_MUTEX                                       0x10000000L
+#define M_USER_ATTRIBUTE                              0x20000000L
+#define M_IM_CONTEXT                                  0x40000000L
+#define M_CONTAINER                                   MAKE_INT64(0x0000000080000000)
+#define M_MIL_ID_PROXY_OBJECT                         MAKE_INT64(0x0000000100000000)
+#define M_GRAPHIC_LIST                                MAKE_INT64(0x0000000200000000)
+#define M_STAT_MULTIPLE_RESULT                        MAKE_INT64(0x0000004000000000)
+#define M_VIDEO_DEVICE_OBJECT                         MAKE_INT64(0x0000010000000000)
+#define M_WAVELET_TRANSFORM_RESULT                    MAKE_INT64(0x0000020000000000)
+#define M_SEQUENCE_CONTEXT                            MAKE_INT64(0x0000040000000000)
+#define M_FIND_ORIENTATION_LIST                       MAKE_INT64(0x0000080000000000)
+#define M_SYS_IO_CONTEXT                              MAKE_INT64(0x0000100000000000)
+#define M_LOCATE_PEAK_1D_RESULT                       MAKE_INT64(0x0000200000000000)
+#define M_MESSAGE_MAILBOX                             MAKE_INT64(0x0000800000000000)
+#define M_STATISTICS_RESULT                           MAKE_INT64(0x0001000000000000)
+#define M_HTTP_SERVER                                 MAKE_INT64(0x0002000000000000)
+
+#define M_AUGMENTATION_RESULT                         MAKE_INT64(0x0004000000000000)                     
+
+#define M_BUF_ALLOC_BUFFER_TYPES                     (M_IMAGE          | \
+                                                      M_LUT            | \
+                                                      M_KERNEL         | \
+                                                      M_STRUCT_ELEMENT | \
+                                                      M_ARRAY)
+
+#define M_IM_ALLOC_RESULT_BUFFER_TYPES               (M_HIST_LIST      | \
+                                                      M_PROJ_LIST      | \
+                                                      M_EVENT_LIST     | \
+                                                      M_EXTREME_LIST   | \
+                                                      M_STAT_LIST      | \
+                                                      M_COUNT_LIST     | \
+                                                      M_FIND_ORIENTATION_LIST)
+
+#define M_IM_RESULT_OBJECT_TYPES                     (M_STAT_MULTIPLE_RESULT | \
+                                                      M_WAVELET_TRANSFORM_RESULT | \
+                                                      M_AUGMENTATION_RESULT | \
+                                                      M_LOCATE_PEAK_1D_RESULT | \
+                                                      M_STATISTICS_RESULT |\
+                                                      M_AUGMENTATION_RESULT)
+
+#define M_IM_RESULT_BUFFER_MEMORY_SPECIFIERS         (M_ON_BOARD         | \
+                                                      M_OFF_BOARD        | \
+                                                      M_PAGED            | \
+                                                      M_NON_PAGED        | \
+                                                      M_HOST_MEMORY      | \
+                                                      M_VIDEO_MEMORY     | \
+                                                      M_PROC_GPU         | \
+                                                      M_FPGA_ACCESSIBLE  | \
+                                                      M_FAST_MEMORY      | \
+                                                      M_MEMORY_BANK_MASK)
+
+#define M_ALL_BUFFER_TYPES                           (M_BUF_ALLOC_BUFFER_TYPES | \
+                                                      M_IM_ALLOC_RESULT_BUFFER_TYPES)
+
+/* Use this macro to verify safely if a Mil object is a buffer. */
+#define M_IS_BUFFER_TYPE( ParIs )      ( (0                != (ParIs & M_ALL_BUFFER_TYPES)) && \
+                                         (M_USER_ATTRIBUTE != (ParIs & M_USER_ATTRIBUTE  )) )
+
+#define M_IS_ALLOC_BUFFER_TYPE( ParIs )      ( (0                != (ParIs & M_BUF_ALLOC_BUFFER_TYPES)) && \
+                                               (M_USER_ATTRIBUTE != (ParIs & M_USER_ATTRIBUTE  )) )
+
+#define M_IS_BUFFER_IMAGE(ParIs)          (((ParIs) & (M_IMAGE | M_USER_ATTRIBUTE)) == M_IMAGE)
+
+/* Use this macro to verify safely if a Mil object is a display. */
+#define M_IS_DISPLAY_TYPE( ParIs )     ( (M_DISPLAY == (ParIs & M_DISPLAY        )) && \
+                                         (0         == (ParIs & M_USER_ATTRIBUTE )) && \
+                                         (0         == (ParIs & M_ALL_BUFFER_TYPES)) )
+
+/* Use this macro to verify safely if a Mil object is a digitizer. */
+#define M_IS_DIGITIZER_TYPE( ParIs )   ( (M_DIGITIZER == (ParIs & M_DIGITIZER      )) && \
+                                         (0           == (ParIs & M_USER_ATTRIBUTE )) && \
+                                         (0           == (ParIs & M_ALL_BUFFER_TYPES)) )
+
+
+#define M_USER_OBJECT_1                               (M_USER_ATTRIBUTE       | 0x00010000L)
+#define M_USER_OBJECT_2                               (M_USER_ATTRIBUTE       | 0x00020000L)
+#define M_BLOB_OBJECT                                 (M_USER_ATTRIBUTE       | 0x00040000L)
+#define M_BLOB_FEATURE_LIST                           (M_BLOB_OBJECT          | 0x00000001L)
+#define M_BLOB_RESULT                                 (M_BLOB_OBJECT          | 0x00000002L)
+#define M_BLOB_CONTEXT                                (M_BLOB_OBJECT          | 0x00000004L)
+#define M_PAT_OBJECT                                  (M_USER_ATTRIBUTE       | 0x00080000L)
+#define M_PAT_MODEL                                   (M_PAT_OBJECT           | 0x00000001L)
+#define M_PAT_RESULT                                  (M_PAT_OBJECT           | 0x00000002L)
+#define M_PAT_CONTEXT                                 (M_PAT_OBJECT           | 0x00000004L)
+#define M_OCR_OBJECT                                  (M_USER_ATTRIBUTE       | 0x00100000L)
+#define M_OCR_FONT                                    (M_OCR_OBJECT           | 0x00000001L)
+#define M_OCR_RESULT                                  (M_OCR_OBJECT           | 0x00000002L)
+#define M_MEAS_OBJECT                                 (M_USER_ATTRIBUTE       | 0x00200000L)
+#define M_MEAS_MARKER                                 (M_MEAS_OBJECT          | 0x00000001L)
+#define M_MEAS_RESULT                                 (M_MEAS_OBJECT          | 0x00000002L)
+#define M_MEAS_CONTEXT                                (M_MEAS_OBJECT          | 0x00000004L)
+#define M_CAL_OBJECT                                  (M_USER_ATTRIBUTE       | 0x00400000L)
+#define M_CAL_CONTEXT                                 (M_CAL_OBJECT           | 0x00000001L)
+#if OldDefinesSupport
+   #define M_CAL_PARENT                                M_CAL_CONTEXT
+   MIL_DEPRECATED(M_CAL_PARENT, 1000)
+#endif
+#define M_CAL_FIXTURING_OFFSET                        (M_CAL_OBJECT           | 0x00000004L)
+#define M_CAL_DRAW_3D_CONTEXT                         (M_CAL_OBJECT           | 0x00000008L )
+#define M_CODE_OBJECT                                 (M_USER_ATTRIBUTE       | 0x00800000L)
+#define M_CODE_CONTEXT                                (M_CODE_OBJECT          | 0x00000001L)
+#if OldDefinesSupport
+#define M_CODE_RESULT                                 (M_CODE_OBJECT          | 0x00000002L)
+MIL_DEPRECATED(M_CODE_RESULT, 1040) // Use M_CODE_GRADE_RESULT instead.
+#endif
+#define M_CODE_GRADE_RESULT                           (M_CODE_OBJECT          | 0x00000002L)
+#define M_OLD_CODE_CONTEXT                            (M_CODE_OBJECT          | 0x00000003L) // DEPRECATED replaced by M_CODE_CONTEXT
+#define M_CODE_MODEL                                  (M_CODE_OBJECT          | 0x00000004L)
+#define M_CODE_TRAIN_RESULT                           (M_CODE_OBJECT          | 0x00000008L)
+#define M_CODE_DETECT_RESULT                          (M_CODE_OBJECT          | 0x00000010L)
+#define M_CODE_READ_RESULT                            (M_CODE_OBJECT          | 0x00000020L)
+#define M_CODE_WRITE_RESULT                           (M_CODE_OBJECT          | 0x00000040L)
+#define M_STR_OBJECT                                  (M_USER_ATTRIBUTE       | 0x02000000L)
+#define M_STR_CONTEXT                                 (M_STR_OBJECT           | 0x00000001L)
+#if OldDefinesSupport
+   #define M_STR_FEATURE_BASED_CONTEXT                M_STR_CONTEXT
+   MIL_DEPRECATED(M_STR_FEATURE_BASED_CONTEXT, 1010)
+#endif
+#define M_STR_RESULT                                  (M_STR_OBJECT           | 0x00000002L)
+#define M_MOD_OBJECT                                  (M_USER_ATTRIBUTE       | 0x04000000L)
+#define M_MOD_GEOMETRIC                               (M_MOD_OBJECT           | 0x00000001L)
+#define M_MOD_RESULT                                  (M_MOD_OBJECT           | 0x00000004L)
+#define M_MOD_GEOMETRIC_CONTROLLED                    (M_MOD_OBJECT           | 0x00000008L)
+#define M_MOD_SHAPE_RESULT                            (M_MOD_OBJECT           | 0x00000010L)
+#define M_MOD_SHAPE_CIRCLE_CONTEXT                    (M_MOD_OBJECT           | 0x00000020L)
+#define M_MOD_SHAPE_ELLIPSE_CONTEXT                   (M_MOD_OBJECT           | 0x00000040L)
+#define M_MOD_SHAPE_RECTANGLE_CONTEXT                 (M_MOD_OBJECT           | 0x00000080L)
+#define M_MOD_SHAPE_SEGMENT_CONTEXT                   (M_MOD_OBJECT           | 0x00000100L)
+#define M_EDGE_OBJECT                                 (M_USER_ATTRIBUTE       | 0x08000000L)
+#define M_EDGE_CONTOUR                                (M_EDGE_OBJECT          | 0x00000001L)
+#define M_EDGE_CREST                                  (M_EDGE_OBJECT          | 0x00000002L)
+#define M_EDGE_RESULT                                 (M_EDGE_OBJECT          | 0x00000004L)
+#define M_HOOK_CONTEXT_OBJECT                         (M_USER_ATTRIBUTE       | 0x40000000L)
+#define M_HOOK_CONTEXT                                (M_HOOK_CONTEXT_OBJECT  | 0x00000001L)
+#define M_DRIVER_HOOK_CONTEXT                         (M_HOOK_CONTEXT_OBJECT  | 0x00000002L)
+#define M_GRA_HOOK_CONTEXT                            (M_HOOK_CONTEXT_OBJECT  | 0x00000004L)
+#define M_SEQ_HOOK_CONTEXT                            (M_HOOK_CONTEXT_OBJECT  | 0x00000008L)
+#define M_EMULATED_HOOK_CONTEXT                       (M_HOOK_CONTEXT_OBJECT  | 0x00000010L)
+#define M_OPAQUE_HOOK_CONTEXT                         (M_HOOK_CONTEXT_OBJECT  | 0x00000020L)
+#define M_REG_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000000800000000))
+#define M_REG_STITCHING_CONTEXT                       (M_REG_OBJECT           | 0x00000001L )
+#define M_REG_EDOF_CONTEXT                            (M_REG_OBJECT           | 0x00000004L )
+#define M_REG_DFF_CONTEXT                             (M_REG_OBJECT           | 0x00000010L )
+#define M_REG_PHOTOMETRIC_STEREO_CONTEXT              (M_REG_OBJECT           | 0x00000040L )
+#define M_REG_HDR_CONTEXT                             (M_REG_OBJECT           | 0x00000100L )
+#define M_REG_STITCHING_RESULT                        (M_REG_OBJECT           | 0x00000002L )
+#define M_REG_EDOF_RESULT                             (M_REG_OBJECT           | 0x00000008L )
+#define M_REG_DFF_RESULT                              (M_REG_OBJECT           | 0x00000020L )
+#define M_REG_PHOTOMETRIC_STEREO_RESULT               (M_REG_OBJECT           | 0x00000080L )
+#define M_REG_HDR_RESULT                              (M_REG_OBJECT           | 0x00000200L )
+#define M_MET_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000000100000000))
+#define M_MET_CONTEXT                                 (M_MET_OBJECT           | 0x00000001L )
+#define M_MET_RESULT                                  (M_MET_OBJECT           | 0x00000002L )
+#define M_MET_GEOMETRY                                (M_MET_OBJECT           | 0x00000004L ) // DEPRECATED, replaced by M_MET_DERIVED_GEOMETRY_REGION
+#define M_MET_DERIVED_GEOMETRY_REGION                 (M_MET_OBJECT           | 0x00000004L )
+#define M_COL_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000000200000000))
+#define M_COL_MATCH_CONTEXT                           (M_COL_OBJECT           | 0x00000001L )
+#define M_COL_SPACE_DEF_CONTEXT                       (M_COL_OBJECT           | 0x00000002L )
+#define M_COL_PROJECT_CONTEXT                         (M_COL_OBJECT           | 0x00000004L )
+#define M_COL_MATCH_RESULT                            (M_COL_OBJECT           | 0x00000008L )
+#define M_COL_RELATIVE_CALIBRATION_CONTEXT            (M_COL_OBJECT           | 0x00000010L )
+#define M_3DMAP_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000000400000000))
+#if OldDefinesSupport
+#define M_3DPR_OBJECT                                  M_3DMAP_OBJECT
+MIL_DEPRECATED(M_3DPR_OBJECT, 1000)
+#endif
+#define M_3DMAP_LASER_CONTEXT                         (M_3DMAP_OBJECT         | 0x00000001L )
+#if OldDefinesSupport
+   #define M_3DMAP_LASER_DATA                         (M_3DMAP_OBJECT         | 0x00000002L )
+   MIL_DEPRECATED(M_3DMAP_LASER_DATA, 1010)
+#endif
+#define M_3DMAP_GEOMETRY                              (M_3DMAP_OBJECT         | 0x00000004L )
+#define M_3DMAP_STAT_RESULT                           (M_3DMAP_OBJECT         | 0x00000008L )
+#define M_3DMAP_LASER_CALIBRATION_DATA                (M_3DMAP_OBJECT         | 0x00000010L )
+#define M_3DMAP_DEPTH_CORRECTED_DATA                  (M_3DMAP_OBJECT         | 0x00000020L )
+#define M_3DMAP_POINT_CLOUD_CONTAINER                 (M_3DMAP_OBJECT         | 0x00000040L ) // deprecated name since 10.40
+#define M_3DMAP_POINT_CLOUD_RESULT                    (M_3DMAP_OBJECT         | 0x00000040L )
+#define M_3DMAP_PAIRWISE_ALIGNMENT_CONTEXT            (M_3DMAP_OBJECT         | 0x00000080L )
+#define M_3DMAP_ALIGNMENT_RESULT                      (M_3DMAP_OBJECT         | 0x00000100L )
+#define M_3DMAP_DRAW_3D_CONTEXT                       (M_3DMAP_OBJECT         | 0x00000200L )
+#define M_BEAD_OBJECT                                 (M_MEAS_OBJECT)
+#define M_BEAD_CONTEXT                                (M_BEAD_OBJECT          | 0x00000010L )
+#define M_BEAD_RESULT                                 (M_BEAD_OBJECT          | 0x00000020L )
+#define M_COM_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000001000000000))
+#define M_COM_CONTEXT                                 (M_COM_OBJECT           | 0x00000001L )
+#define M_DMR_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000002000000000))
+#define M_DMR_CONTEXT                                 (M_DMR_OBJECT           | 0x00000001L )
+#define M_DMR_RESULT                                  (M_DMR_OBJECT           | 0x00000020L )
+#define M_CLASS_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000004000000000))
+#define M_SAVABLE_OBJECT                               MAKE_INT64(0x0000000000008000)
+#define M_CLASS_OBJECT_SAVABLE                                  (M_CLASS_OBJECT         | M_SAVABLE_OBJECT)
+#define M_CLASS_CLASSIFIER_CNN_CONTEXT                          (M_CLASS_OBJECT_SAVABLE |  1L )
+#define M_CLASS_CLASSIFIER_CNN_PREDEFINED_CONTEXT               (M_CLASS_OBJECT_SAVABLE |  2L )
+#define M_CLASS_CLASSIFIER_TREE_ENSEMBLE_CONTEXT                (M_CLASS_OBJECT_SAVABLE |  3L )
+#define M_CLASS_TRAIN_CNN_CONTEXT                               (M_CLASS_OBJECT_SAVABLE |  4L )
+#define M_CLASS_TRAIN_TREE_ENSEMBLE_CONTEXT                     (M_CLASS_OBJECT_SAVABLE |  5L )
+#define M_CLASS_PREDICT_TREE_ENSEMBLE_RESULT                    (M_CLASS_OBJECT         |  6L )
+#define M_CLASS_TRAIN_TREE_ENSEMBLE_RESULT                      (M_CLASS_OBJECT         |  7L )
+#define M_CLASS_DATASET_IMAGES                                  (M_CLASS_OBJECT_SAVABLE |  8L )
+#define M_CLASS_DATASET_FEATURES                                (M_CLASS_OBJECT_SAVABLE |  9L )
+#define M_CLASS_CNN_EPOCH_HOOK_INFO                             (M_CLASS_OBJECT         | 10L )
+#define M_CLASS_CNN_MINI_BATCH_HOOK_INFO                        (M_CLASS_OBJECT         | 11L )
+#define M_CLASS_CNN_PREDICT_ENTRY_HOOK_INFO                     (M_CLASS_OBJECT         | 12L )
+#define M_CLASS_TREE_ENSEMBLE_TREE_HOOK_INFO                    (M_CLASS_OBJECT         | 13L )
+#define M_CLASS_TREE_ENSEMBLE_PREDICT_ENTRY_HOOK_INFO           (M_CLASS_OBJECT         | 14L )
+#define M_CLASS_PREDICT_CNN_RESULT                              (M_CLASS_OBJECT         | 32L )
+#define M_CLASS_TRAIN_CNN_RESULT                                (M_CLASS_OBJECT         | 64L )
+#if OldDefinesSupport
+#define M_CLASS_RESULT                                          (M_CLASS_OBJECT         | 32L )
+MIL_DEPRECATED(M_CLASS_RESULT, 1040) // Use M_CLASS_PREDICT_CNN_RESULT instead.
+#endif
+
+#define M_GAB_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000200000000000))
+#define M_GAB_CONTEXT                                 (M_GAB_OBJECT           | 0x00000001L )
+#define M_GAB_RESULT                                  (M_GAB_OBJECT           | 0x00000002L )
+#define M_3DIM_OBJECT                                 (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000400000000000))
+#define M_3DIM_CALCULATE_MAP_SIZE_CONTEXT             (M_3DIM_OBJECT          | 0x00000001L )                   
+#define M_3DIM_SUBSAMPLE_CONTEXT                      (M_3DIM_OBJECT          | 0x00000002L )
+#define M_3DIM_MESH_CONTEXT                           (M_3DIM_OBJECT          | 0x00000004L )
+#define M_3DIM_NORMALS_CONTEXT                        (M_3DIM_OBJECT          | 0x00000008L )
+#define M_3DIM_STATISTICS_CONTEXT                     (M_3DIM_OBJECT          | 0x00000010L )
+#define M_3DIM_SURFACE_SAMPLE_CONTEXT                 (M_3DIM_OBJECT          | 0x00000020L ) 
+#define M_3DIM_STATISTICS_RESULT                      (M_3DIM_OBJECT          | 0x00000040L )
+#define M_3DIM_FILL_GAPS_CONTEXT                      (M_3DIM_OBJECT          | 0x00000080L )
+#define M_3DIM_PROFILE_RESULT                         (M_3DIM_OBJECT          | 0x00000100L )
+
+#define M_3D_DISPLAY_OBJECT                           (M_USER_ATTRIBUTE          | MAKE_INT64(0x0000008000000000))
+#define M_3D_DISPLAY                                  (M_3D_DISPLAY_OBJECT       | 0x00000001L )
+
+#define M_3D_GRAPHIC_LIST_OBJECT                      (M_USER_ATTRIBUTE          | MAKE_INT64(0x0000010000000000))
+#define M_3D_GRAPHIC_LIST                             (M_3D_GRAPHIC_LIST_OBJECT  | 0x00000001L ) 
+#define M_3D_GRAPHIC                                  (M_3D_GRAPHIC_LIST_OBJECT  | 0x00000002L ) 
+
+#define M_3DGEO_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000800000000000))
+#define M_3DGEO_GEOMETRY                              (M_3DGEO_OBJECT         | 0x00000001L )
+#define M_3DGEO_TRANSFORMATION_MATRIX                 (M_3DGEO_OBJECT         | 0x00000002L )
+#define M_3DGEO_DRAW_3D_CONTEXT                       (M_3DGEO_OBJECT         | 0x00000004L )
+
+
+#define M_3DMET_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0002000000000000)) 
+#define M_3DMET_FIT_CONTEXT                           (M_3DMET_OBJECT         | 0x00000002L )
+#define M_3DMET_STATISTICS_CONTEXT                    (M_3DMET_OBJECT         | 0x00000004L )
+#define M_3DMET_DRAW_3D_CONTEXT                       (M_3DMAP_OBJECT         | 0x00000008L )
+#define M_3DMET_FIT_RESULT                            (M_3DMET_OBJECT         | 0x00000020L )
+#define M_3DMET_STATISTICS_RESULT                     (M_3DMET_OBJECT         | 0x00000040L )
+
+#define M_3DREG_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0004000000000000)) 
+#define M_3DREG_PAIRWISE_REGISTRATION_CONTEXT         (M_3DREG_OBJECT         | 0x00000001L )
+#define M_3DREG_PAIRWISE_REGISTRATION_RESULT          (M_3DREG_OBJECT         | 0x00000004L )
+
+
+#define M_VIDEO_DEVICE_OBJECT                         MAKE_INT64(0x0000010000000000)
+#define M_DIRECTX_VIDEO_DEVICE_OBJECT                 (M_VIDEO_DEVICE_OBJECT | 0x00000001L)
+#define M_EXTERNAL_VIDEO_DEVICE_OBJECT                (M_VIDEO_DEVICE_OBJECT | 0x00000002L)
+#define M_USER_DEFINE_LOW_ATTRIBUTE                   0x0000FFFFL
+
+#define M_SYSTEM_ALLOCATED                            0x00000001L
+#define M_USER_ALLOCATED                              MAKE_INT64(0x00000000FFFFFFFE)
+
+// For M_CONTAINER buffers
+#define M_GRAB                                        0x00000008L
+#define M_PROC                                        0x00000010L
+#define M_DISP                                        0x00000020L
+#if MIL_COMPILE_VERSION < 1040
+#define M_3D_SCENE                                    0x00000040L
+#define M_BUFFER_SEQUENCE                             0x00000080L
+#if OldDefinesSupport
+MIL_DEPRECATED(M_3D_SCENE, 1000)
+MIL_DEPRECATED(M_BUFFER_SEQUENCE, 1000)
+#endif
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_3D_SCENE                                    0
+#define M_BUFFER_SEQUENCE                             0
+#if OldDefinesSupport
+MIL_DEPRECATED(M_3D_SCENE, 1000)
+MIL_DEPRECATED(M_BUFFER_SEQUENCE, 1000)
+#endif
+#endif
+
+
+// For M_IMAGE buffers:
+#define M_DYNAMIC                                     0x00000002L
+#define M_IMAGE                                       0x00000004L
+#define M_GRAB                                        0x00000008L
+#define M_PROC                                        0x00000010L
+#define M_DISP                                        0x00000020L
+// 0x40 to used
+#define M_OVR                                         0x00000080L
+#define M_OFFSCREEN                                   M_OVR
+#define M_INTERNAL_FORMAT                             0x00003F00L
+#define M_COMPRESS                                    0x00004000L
+#define M_ALLOCATION_OVERSCAN                         0x00008000L              // This flag is also use as MbufControl/Inquire type and as MsysControl/Inquire type.
+#define M_FAST_OVERSCAN                               M_ALLOCATION_OVERSCAN
+#define M_FLIP                                        0x00010000L
+#define M_PACKED                                      0x00020000L
+#define M_PLANAR                                      0x00040000L
+#define M_ON_BOARD                                    0x00080000L
+#define M_OFF_BOARD                                   0x00100000L
+#define M_NON_PAGED                                   0x00200000L
+// 0x00400000 used with M_COMPRESS
+#define M_UND                                         0x00800000L // value also used with M_COMPRESS
+#define M_UNDERLAY                                    M_UND
+#define M_SINGLE                                      0x01000000L
+#define M_VIA                                         M_SINGLE
+#define M_PAGED                                       0x02000000L
+#define M_NO_FLIP                                     0x04000000L
+#define M_OVERSCAN_BUFFER                             0x08000000L // value also used with M_COMPRESS
+#define M_READ_PREFETCH_ENABLED                       0x10000000L
+//Keep only for backward compatibility.
+#define M_MMX_ENABLED                                 M_READ_PREFETCH_ENABLED
+#define M_SSE_ENABLED                                 M_READ_PREFETCH_ENABLED
+#define M_USER_ATTRIBUTE                              0x20000000L
+#define M_DDRAW                                       0x40000000L
+#define M_DIRECTX                                     M_DDRAW
+// 0x8000000 reserved
+
+#if !M_MIL_USE_LINUX
+#define M_NON_LOCAL_MEMORY                            MAKE_INT64(0x0000000800000000)
+#define M_BITMAP_HANDLE                               MAKE_INT64(0x0000008000000000)
+#endif
+// New define place in the 32 higher bits of the attribute
+#define M_GDI                                         MAKE_INT64(0x0000000100000000)
+#define M_HOST_MEMORY                                 MAKE_INT64(0x0000000200000000)
+#define M_VIDEO_MEMORY                                MAKE_INT64(0x0000000400000000)
+#define M_FAST_MEMORY                                 MAKE_INT64(0x0000001000000000)
+#define M_D3D_BUFFER                                  M_FAST_MEMORY
+#define M_SHARED                                      MAKE_INT64(0x0000002000000000)
+#define M_PRIMARY_SURFACE                             MAKE_INT64(0x0000004000000000)
+// BITS RESERVED FOR COMPLEX BUFFERS                     0x0000070000000000
+#define M_LIVE_VIDEO                                  MAKE_INT64(0x0000080000000000)
+#define M_AUDIO                                       MAKE_INT64(0x0000080000000000)
+#define M_MTX0                                        MAKE_INT64(0x0000100000000000)
+#define M_NON_CACHABLE                                MAKE_INT64(0x0000200000000000)
+// Available                                          MAKE_INT64(0x0000400000000000)
+// Available                                          MAKE_INT64(0x0000800000000000)
+
+//Linux specific buffer attribute
+#define M_LINUX_MXIMAGE                               MAKE_INT64(0x0800000000000000) // Same value as M_DIB
+
+#define M_MAPPABLE                                    MAKE_INT64(0x0001000000000000)
+//End of Linux specific buffer attribute
+#define M_AUX_VISIBLE                                 MAKE_INT64(0x0002000000000000)
+#define M_AUX                                         M_AUX_VISIBLE
+#define M_DISPLAY_AS_RGB10BIT                         MAKE_INT64(0x0004000000000000)
+#define M_DISPLAY_AS_YUV32                            MAKE_INT64(0x0080000000000000)
+#define M_NO_MEMORY                                   MAKE_INT64(0x0008000000000000)
+#define M_MEMORY_BANK_DEFAULT                         MAKE_INT64(0x0000000000000000)
+#define M_MEMORY_BANK_0                               MAKE_INT64(0x0010000000000000)
+#define M_MEMORY_BANK_1                               MAKE_INT64(0x0020000000000000)
+#define M_MEMORY_BANK_2                               MAKE_INT64(0x0030000000000000)
+#define M_MEMORY_BANK_3                               MAKE_INT64(0x0040000000000000)
+#define M_MEMORY_BANK_4                               MAKE_INT64(0x0050000000000000)
+#define M_MEMORY_BANK_5                               MAKE_INT64(0x0060000000000000)
+#define M_MEMORY_BANK_6                               MAKE_INT64(0x0070000000000000)
+#define M_MEMORY_BANK_MASK                            MAKE_INT64(0x0070000000000000)
+#define M_FPGA_ACCESSIBLE                             MAKE_INT64(0x0100000000000000)
+#define M_DYNAMIC_TEXTURE                             M_FPGA_ACCESSIBLE
+#define M_FPGA_MEMORY                                 M_FPGA_ACCESSIBLE //Obsolete, use M_FPGA_ACCESSIBLE
+#define M_OPENCL_COMPATIBLE                           MAKE_INT64(0x0200000000000000)
+#define M_D3D_OFFSCREEN_SURFACE                       MAKE_INT64(0x0400000000000000)
+#define M_DIB                                         MAKE_INT64(0x0800000000000000)
+#define M_PROC_GPU                                    MAKE_INT64(0x1000000000000000)
+#define M_DISPATTRIB_RESERVED                         MAKE_INT64(0x2000000000000000)
+#define M_DISP_EXTERNAL                               MAKE_INT64(0x4000000000000000)
+#define M_UNUSED_BITS                                 MAKE_INT64(0x8000000000000000) //Update when reusing bits for new defines
+
+
+#define M_IS_D3D_BUFFER(attrib)                       (((attrib)&(M_D3D_BUFFER|M_IMAGE|M_VIDEO_MEMORY))==(M_D3D_BUFFER|M_IMAGE|M_VIDEO_MEMORY))
+#define M_IS_FAST_MEMORY(attrib)                      ((((attrib)&M_FAST_MEMORY) != 0) && (((attrib)&M_VIDEO_MEMORY) == 0))
+
+#define M_IS_DYNAMIC_TEXTURE(attrib)                  (((attrib)&(M_DYNAMIC_TEXTURE|M_IMAGE|M_VIDEO_MEMORY))==(M_DYNAMIC_TEXTURE|M_IMAGE|M_VIDEO_MEMORY))
+#define M_IS_FPGA_ACCESSIBLE(attrib)                  ((((attrib)&M_FPGA_ACCESSIBLE) != 0) && (((attrib)&M_VIDEO_MEMORY) == 0))
+
+#define M_IS_OPENCL_COMPATIBLE(attrib)                (((attrib)&(M_OPENCL_COMPATIBLE)) == (M_OPENCL_COMPATIBLE))
+#define M_IS_D3D_OFFSCREEN_SURFACE(attrib)            (((attrib)&(M_IMAGE|M_D3D_OFFSCREEN_SURFACE)) == (M_IMAGE|M_D3D_OFFSCREEN_SURFACE))
+#define M_IS_PROC_GPU(attrib)                         (((attrib)&(M_PROC_GPU)) == (M_PROC_GPU))
+
+#if MIL_COMPILE_VERSION < 1040
+#define M_IS_3D_SCENE(attrib)                         (((attrib)&(M_3D_SCENE)) == (M_3D_SCENE))
+#define M_IS_BUFFER_SEQUENCE(attrib)                  (((attrib)&(M_BUFFER_SEQUENCE)) == (M_BUFFER_SEQUENCE))
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_IS_3D_SCENE(attrib)                         (false)
+#define M_IS_BUFFER_SEQUENCE(attrib)                  (false)
+#endif
+
+#if M_MIL_USE_WINDOWS
+// Attributes specific to one DirectX version
+#define M_IS_DDRAW7_SPECIFIC(attrib)                  (((((attrib)&(M_IMAGE|M_UNDERLAY))==(M_IMAGE|M_UNDERLAY)) && (((attrib)&M_COMPRESS) == 0))           || \
+                                                       (((attrib)&(M_LIVE_VIDEO|M_IMAGE))==(M_LIVE_VIDEO|M_IMAGE))                                         || \
+                                                       (((attrib)&(M_PRIMARY_SURFACE|M_IMAGE|M_VIDEO_MEMORY))==(M_PRIMARY_SURFACE|M_IMAGE|M_VIDEO_MEMORY)) || \
+                                                       (((attrib)&M_AUX_VISIBLE)==M_AUX_VISIBLE)                                                           || \
+                                                       (((attrib)&(M_NON_LOCAL_MEMORY|M_IMAGE))==(M_NON_LOCAL_MEMORY|M_IMAGE))                             || \
+                                                       (M_IS_DDRAW7_SPECIFIC_BITS(attrib)))
+
+#define M_IS_D3D9_SPECIFIC(attrib)                    (M_IS_DYNAMIC_TEXTURE(attrib) || M_IS_D3D_OFFSCREEN_SURFACE(attrib))
+#define M_IS_D3D10_SPECIFIC(attrib)                   (false)
+#define M_IS_D3D11_SPECIFIC(attrib)                   (M_IS_D3D_BUFFER(attrib))
+
+#define M_IS_DIRECTX_SPECIFIC(attrib)                 ((attrib&M_DIRECTX) == M_DIRECTX || M_IS_DDRAW7_SPECIFIC(attrib) || M_IS_D3D9_SPECIFIC(attrib) || M_IS_D3D10_SPECIFIC(attrib) || M_IS_D3D11_SPECIFIC(attrib))
+
+// Attributes incompatible with one DirectX version
+#define M_IS_DDRAW7_INCOMPATIBLE(attrib)              (M_IS_PROC_GPU(attrib) || M_IS_OPENCL_COMPATIBLE(attrib) || M_IS_D3D9_SPECIFIC(attrib) || M_IS_D3D10_SPECIFIC(attrib) || M_IS_D3D11_SPECIFIC(attrib))
+#define M_IS_D3D9_INCOMPATIBLE(attrib)                (M_IS_OPENCL_COMPATIBLE(attrib) || M_IS_DDRAW7_SPECIFIC(attrib) || M_IS_D3D10_SPECIFIC(attrib) || M_IS_D3D11_SPECIFIC(attrib))
+#define M_IS_D3D10_INCOMPATIBLE(attrib)               (M_IS_DDRAW7_SPECIFIC(attrib) || M_IS_D3D9_SPECIFIC(attrib)  || M_IS_D3D11_SPECIFIC(attrib))
+#define M_IS_D3D11_INCOMPATIBLE(attrib)               (M_IS_DDRAW7_SPECIFIC(attrib) || M_IS_D3D9_SPECIFIC(attrib)  || M_IS_D3D10_SPECIFIC(attrib))
+
+// Bits specific to one DirectX version
+// DDraw7 specific bits
+#define M_DDRAW7_SPECIFIC_BITS                        (M_UNDERLAY|M_LIVE_VIDEO|M_PRIMARY_SURFACE|M_AUX_VISIBLE|M_NON_LOCAL_MEMORY)
+#define M_IS_DDRAW7_SPECIFIC_BITS(attrib)             ((attrib&(M_DDRAW7_SPECIFIC_BITS)))
+#endif // M_MIL_USE_WINDOWS
+
+// Incompatible bits mask
+#define M_HOST_MEMORY_INCOMPATIBLE_BITS               (M_UNDERLAY|M_VIDEO_MEMORY|M_PRIMARY_SURFACE|M_LIVE_VIDEO|M_AUX_VISIBLE|M_PROC_GPU)
+#define M_OVR_INCOMPATIBLE_BITS                       (M_UNDERLAY|M_PRIMARY_SURFACE|M_AUX_VISIBLE)
+#define M_OFFSCREEN_INCOMPATIBLE_BITS                 M_OVR_INCOMPATIBLE_BITS
+#define M_UNDERLAY_INCOMPATIBLE_BITS                  (M_HOST_MEMORY|M_OVR|M_PROC_GPU)
+
+#define M_COMPLEX_SURFACE_OFFSET                      (40)
+#define M_COMPLEX_SURFACE_MASK                        (((MIL_INT64)0x7)<<M_COMPLEX_SURFACE_OFFSET)
+#define M_IS_COMPLEX_SURFACE(attrib)                  ((((attrib)&M_COMPLEX_SURFACE_MASK) != 0) && (((attrib)&M_COMPRESS) == 0) && (((attrib)&M_VIDEO_MEMORY) != 0))
+#define M_COMPLEX_SURFACE(_nb)                        ((((MIL_INT64)(_nb))<<M_COMPLEX_SURFACE_OFFSET)&M_COMPLEX_SURFACE_MASK)
+#define M_COMPLEX_NB_BUFFER(attrib)                   ((((attrib)&M_COMPRESS) != 0)?0:((long)(((MIL_INT64)(attrib)&M_COMPLEX_SURFACE_MASK)>>M_COMPLEX_SURFACE_OFFSET)))
+
+#define M_MEMORY_BANK_OFFSET                          52
+#define M_MEMORY_BANK_TO_USE(attrib)                  ((((attrib)&M_MEMORY_BANK_MASK)>>M_MEMORY_BANK_OFFSET)-1)
+
+#define M_COMPRESSION_FORMAT_MASK                     0x08C08000L
+
+#define M_JPEG_LOSSLESS                               0x00400000L
+#define M_JPEG_LOSSY                                  0x00800000L
+#define M_JPEG_LOSSLESS_INTERLACED                    0x00C00000L
+#define M_JPEG_LOSSY_INTERLACED                       0x08000000L
+#define M_JPEG2000_LOSSY                              0x08400000L
+#define M_JPEG2000_LOSSLESS                           0x08800000L
+#define M_MPEG4                                       0x08C00000L
+#define M_H264                                        0x00008000L
+#define M_RLE                                         0x00408000L
+#define M_RLE_LABEL                                   0x00808000L
+
+/*
+Reserved compression format                           0x00C08000L
+Reserved compression format                           0x08008000L
+Reserved compression format                           0x08408000L
+Reserved compression format                           0x08808000L
+Reserved compression format                           0x08C08000L
+*/
+
+#define M_IS_LOSSY(a)                                 (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY_INTERLACED) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG2000_LOSSY) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_MPEG4) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_H264)))
+#define M_IS_LOSSLESS(a)                              (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS_INTERLACED) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG2000_LOSSLESS) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_RLE) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_RLE_LABEL)))
+#define M_IS_JPEG(a)                                  (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS_INTERLACED) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY_INTERLACED)))
+#define M_IS_JPEG2000(a)                              (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG2000_LOSSY) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG2000_LOSSLESS)))
+#define M_IS_MPEG4(a)                                 (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_MPEG4)))
+#define M_IS_H264(a)                                  (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_H264)))
+#define M_IS_INTERLACED(a)                            (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY_INTERLACED) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS_INTERLACED)))
+#define M_IS_RLE(a)                                   (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_RLE) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_RLE_LABEL)))
+#define M_COMPRESSION_FORMAT(a)                       (M_IS_COMPRESSED(a) ? ((a) & M_COMPRESSION_FORMAT_MASK) : 0)
+#define M_IS_COMPRESSED(a)                            ((((a) & M_IMAGE) != 0) && (((a) & M_COMPRESS) != 0))
+#define M_IS_AUDIO(a)                                 ((((a) & M_ARRAY) != 0) && (((a) & M_AUDIO) != 0))
+#define M_IS_PACKED_LUT(a)                            (((a&M_IMAGE)==0) && ((a&~(M_READ_PREFETCH_ENABLED|M_DIRECTX|M_VIDEO_MEMORY|M_HOST_MEMORY|M_PROC_GPU|M_NON_PAGED|M_PAGED)) == (M_LUT|M_PACKED|M_BGR32)))
+#define M_IS_ON_BOARD(a)                              (((a) & M_HOST_MEMORY) ? M_FALSE : (((a) & M_ON_BOARD) ? M_TRUE : (((a) & M_MEMORY_BANK_MASK) ? M_TRUE : (M_IS_FPGA_ACCESSIBLE(a) ? M_TRUE : M_FALSE))))
+#define M_IS_ON_BOARD_OR_VIDEO_MEMORY(a)              (M_IS_ON_BOARD(a) || (((a) & M_VIDEO_MEMORY) != 0))
+
+/* 6 bits reserved for buffer internal format and format definitions */
+#define M_INTERNAL_FORMAT             0x00003F00L
+#define M_INTERNAL_FORMAT_SHIFT       8L
+#define M_INTERNAL_COMPLETE_FORMAT    0x7FFFFF80L
+#define M_ANY_INTERNAL_FORMAT         (0   << M_INTERNAL_FORMAT_SHIFT)
+
+// Range for MONO formats : 1 to 5.
+#define M_MONO_RANGE_START                (1   << M_INTERNAL_FORMAT_SHIFT)
+#define M_MONO1                           (1   << M_INTERNAL_FORMAT_SHIFT)   // Force  1 bit  pixels in monochrome format
+#define M_MONO8                           (2   << M_INTERNAL_FORMAT_SHIFT)   // Force  8 bits pixels in monochrome format
+#define M_MONO16                          (3   << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in monochrome format
+#define M_MONO32                          (4   << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in monochrome format
+/* AVAILABLE                              (5) */
+#define M_MONO_RANGE_END                  (5   << M_INTERNAL_FORMAT_SHIFT)
+
+// Extended range for MONO formats : 41 to 47.
+#define M_MONO_EXTENDED_RANGE_START       (41  << M_INTERNAL_FORMAT_SHIFT)
+#define M_MONO64                          (41  << M_INTERNAL_FORMAT_SHIFT)   // Force 64 bits pixels in monochrome format
+/* AVAILABLE                              (42 to 47) */
+#define M_MONO_EXTENDED_RANGE_END         (47  << M_INTERNAL_FORMAT_SHIFT)
+
+// Range for RGB and BGR formats : 6 to 20.
+#define M_RGB_BGR_RANGE_START             (6   << M_INTERNAL_FORMAT_SHIFT)
+#define M_RGB15                           (6   << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in color XRGB  1.5.5.5  format
+#define M_RGB16                           (7   << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in color RGB   5.6.5    format
+#define M_RGB24                           (8   << M_INTERNAL_FORMAT_SHIFT)   // Force 24 bits pixels in color RGB   8.8.8    format
+#define M_RGBX32                          (9   << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color RGBX  8.8.8.8  format
+#define M_RGB32                           M_RGBX32
+#define M_XRGB32                          (10  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color XRGB  8.8.8.8  format
+#define M_RGB48                           (11  << M_INTERNAL_FORMAT_SHIFT)   // Force 48 bits pixels in color RGB  16.16.16  format
+#define M_RGB96                           (12  << M_INTERNAL_FORMAT_SHIFT)   // Force 96 bits pixels in color RGB  32.32.32  format
+#define M_RGB3                            (13  << M_INTERNAL_FORMAT_SHIFT)   // Force  3 bits pixels in color RGB   1.1.1    format
+#define M_BGR15                           (14  << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in color BGRX  5.5.5.1  format
+#define M_BGR16                           (15  << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in color BGR   5.6.5    format
+#define M_BGR24                           (16  << M_INTERNAL_FORMAT_SHIFT)   // Force 24 bits pixels in color BGR   8.8.8    format
+#define M_BGRX32                          (17  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color BGRX  8.8.8.8  format
+#define M_BGR32                           M_BGRX32
+#define M_XBGR32                          (18  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color XBGR  8.8.8.8  format
+#define M_BGR30                           (19  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color XBGR  2.10.10.10  format
+#define M_RGB192                          (20  << M_INTERNAL_FORMAT_SHIFT)   // Force 192 bits pixels in color RGB  64.64.64  format
+#define M_RGB_BGR_RANGE_END               (20  << M_INTERNAL_FORMAT_SHIFT)
+
+// Extended range for RGB and BGR formats : 48 to 55.
+#define M_RGB_BGR_EXTENDED_RANGE_START    (48  << M_INTERNAL_FORMAT_SHIFT)
+/* AVAILABLE                              (48 to 55) */
+#define M_RGB_BGR_EXTENDED_RANGE_END      (55  << M_INTERNAL_FORMAT_SHIFT)
+
+// Range for YUV formats : 21 to 40.
+#define M_YUV_RANGE_START                 (21  << M_INTERNAL_FORMAT_SHIFT)
+#define M_YUV9                            (21  << M_INTERNAL_FORMAT_SHIFT)   // Force  9 bits YUV pixels in color YUV 16:1:1 format
+#define M_YUV1611                         M_YUV9
+#define M_YUV12                           (22  << M_INTERNAL_FORMAT_SHIFT)   // Force 12 bits YUV pixels in color YUV  4:1:1 format
+#define M_YUV411                          M_YUV12
+#define M_YUV16                           (23  << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits YUV pixels in color YUV  4:2:2 format
+#define M_YUV422                          M_YUV16
+/* AVAILABLE                              (24 to 26) */
+#define M_YUV24                           (27  << M_INTERNAL_FORMAT_SHIFT)   // Force 24 bits YUV pixels in color YUV  4:4:4 format
+#define M_YUV444                          M_YUV24
+#define M_YUV16_YUYV                      (28  << M_INTERNAL_FORMAT_SHIFT)   // Force YUV16 packed buffers into a YUYV memory layout ( meteor, corona, meteor2 ) (FOURCC: YUY2).
+#define M_YUV422_YUYV                     M_YUV16_YUYV
+#define M_YUV16_UYVY                      (29  << M_INTERNAL_FORMAT_SHIFT)   // Force YUV16 packed buffers into a UYVY memory layout ( meteor ) (FOURCC: UYVY).
+#define M_YUV16_1394                      M_YUV16_UYVY
+#define M_YUV422_UYVY                     M_YUV16_UYVY
+#define M_YUV422_1394                     M_YUV16_1394
+/* AVAILABLE                              (30) */
+#define M_YUV12_1394                      (31  << M_INTERNAL_FORMAT_SHIFT)   // Force YUV12 packed buffers with the special memory layout of the 1394.
+#define M_YUV411_1394                     M_YUV12_1394
+#define M_YUV32                           (32  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits YUV pixels in color (8(X)-8(Y)-8(U)-8(V))
+/* AVAILABLE                              (33 to 40) */
+#define M_YUV_RANGE_END                   (40  << M_INTERNAL_FORMAT_SHIFT)
+
+// Extended range for YUV formats : 56 to 63.
+#define M_YUV_EXTENDED_RANGE_START        (56  << M_INTERNAL_FORMAT_SHIFT)
+/* AVAILABLE                              (56 to 63) */
+#define M_YUV_EXTENDED_RANGE_END          (63 << M_INTERNAL_FORMAT_SHIFT)
+
+#define M_SINGLE_BAND                     (255 << M_INTERNAL_FORMAT_SHIFT)   // PutColor and GetColor specification for a single band
+
+
+#define M_COMPRESSED_DATA                 1
+
+
+#define M_IS_FORMAT_MONO(f)               ((((f & M_INTERNAL_FORMAT) >= M_MONO_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_MONO_RANGE_END)) || \
+                                           (((f & M_INTERNAL_FORMAT) >= M_MONO_EXTENDED_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_MONO_EXTENDED_RANGE_END)))
+
+#define M_IS_FORMAT_RGB_BGR(f)            ((((f & M_INTERNAL_FORMAT) >= M_RGB_BGR_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_RGB_BGR_RANGE_END)) || \
+                                           (((f & M_INTERNAL_FORMAT) >= M_RGB_BGR_EXTENDED_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_RGB_BGR_EXTENDED_RANGE_END)))
+
+#define M_IS_FORMAT_YUV(f)                ((((f & M_INTERNAL_FORMAT) >= M_YUV_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_YUV_RANGE_END)) || \
+                                           (((f & M_INTERNAL_FORMAT) >= M_YUV_EXTENDED_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_YUV_EXTENDED_RANGE_END)))
+
+#define M_BIT_FIELD_FORMAT(f)             (((MIL_INT) 1) << (((f & M_INTERNAL_FORMAT) >> M_INTERNAL_FORMAT_SHIFT) - 1))
+
+// The following MACRO keep only attribute used by the host.
+#define M_KEEP_HO_ATTRIBUTES(a)                                                               \
+   ((a&M_IMAGE) ?                                                                             \
+      (a&(M_INTERNAL_FORMAT|M_IMAGE|M_PACKED|M_PLANAR|M_COMPRESS|M_COMPRESSION_FORMAT_MASK|   \
+          M_FLIP|M_NO_FLIP|M_NON_PAGED|M_PAGED|M_READ_PREFETCH_ENABLED|                       \
+          M_HOST_MEMORY))                                                                     \
+   :  (a))
+
+//Attributes accepted by all non-M_IMAGE buffers on the Host
+#define MIL_MEMORY_SPECIFIERS (M_PAGED | M_NON_PAGED | M_OFF_BOARD | M_HOST_MEMORY | M_MAPPABLE | M_READ_PREFETCH_ENABLED)
+
+// The following MACRO takes a data format as input and returns the number
+// of bits per pixel that it implies as an output.
+// For an unknown data format, it returns M_INVALID.
+#define NB_OF_BITS_PER_PIXEL(DataFormat,NbOfBits)             \
+   switch( ((DataFormat) & M_INTERNAL_FORMAT) )               \
+      {                                                       \
+      case M_MONO1:        NbOfBits = 1;         break;       \
+      case M_MONO8:        NbOfBits = 8;         break;       \
+      case M_MONO16:       NbOfBits = 16;        break;       \
+      case M_MONO32:       NbOfBits = 32;        break;       \
+      case M_MONO64:       NbOfBits = 64;        break;       \
+      case M_RGB15:        NbOfBits = 16;        break;       \
+      case M_RGB16:        NbOfBits = 16;        break;       \
+      case M_RGB24:        NbOfBits = 24;        break;       \
+      case M_RGBX32:       NbOfBits = 32;        break;       \
+      case M_XRGB32:       NbOfBits = 32;        break;       \
+      case M_RGB48:        NbOfBits = 48;        break;       \
+      case M_RGB96:        NbOfBits = 96;        break;       \
+      case M_RGB192:       NbOfBits = 192;       break;       \
+      case M_RGB3:         NbOfBits = 3;         break;       \
+      case M_BGR15:        NbOfBits = 16;        break;       \
+      case M_BGR16:        NbOfBits = 16;        break;       \
+      case M_BGR24:        NbOfBits = 24;        break;       \
+      case M_BGRX32:       NbOfBits = 32;        break;       \
+      case M_XBGR32:       NbOfBits = 32;        break;       \
+      case M_BGR30:        NbOfBits = 32;        break;       \
+                                                              \
+      case M_YUV9:         NbOfBits = 9;         break;       \
+      case M_YUV12:        NbOfBits = 12;        break;       \
+      case M_YUV16:        NbOfBits = 16;        break;       \
+      case M_YUV24:        NbOfBits = 24;        break;       \
+      case M_YUV16_YUYV:   NbOfBits = 16;        break;       \
+      case M_YUV16_UYVY:   NbOfBits = 16;        break;       \
+      case M_YUV12_1394:   NbOfBits = 12;        break;       \
+      default:             NbOfBits = M_INVALID; break;       \
+      }
+
+// The following MACRO takes a data format as input and returns the number
+// of bits per pixel per plane that it implies as an output.
+// For an unknown data format, it returns M_INVALID.
+// It is better to compare the format with M_PACKED, because M_PLANAR is
+// not always present on planar buffers.
+#define M_NB_BITS_PER_PIXEL_PER_PLANE(DataFormat,NbOfBits)       \
+  switch( ((DataFormat) & M_INTERNAL_FORMAT)  )                  \
+     {                                                           \
+     /* M_PACKED is implicit */                                  \
+     case M_MONO1:        NbOfBits = 1;         break;           \
+     case M_MONO8:        NbOfBits = 8;         break;           \
+     case M_MONO16:       NbOfBits = 16;        break;           \
+     case M_MONO32:       NbOfBits = 32;        break;           \
+     case M_MONO64:       NbOfBits = 64;        break;           \
+     case M_RGB15:        NbOfBits = 16;        break;           \
+     case M_RGB16:        NbOfBits = 16;        break;           \
+     case M_RGBX32:       NbOfBits = 32;        break;           \
+     case M_XRGB32:       NbOfBits = 32;        break;           \
+     case M_BGR15:        NbOfBits = 16;        break;           \
+     case M_BGR16:        NbOfBits = 16;        break;           \
+     case M_BGR24:        NbOfBits = 24;        break;           \
+     case M_BGRX32:       NbOfBits = 32;        break;           \
+     case M_XBGR32:       NbOfBits = 32;        break;           \
+     case M_BGR30:        NbOfBits = 32;        break;           \
+     case M_YUV16_YUYV:   NbOfBits = 16;        break;           \
+     case M_YUV16_UYVY:   NbOfBits = 16;        break;           \
+     /* M_PLANAR is implicit */                                  \
+     case M_RGB3:         NbOfBits = 1;         break;           \
+     case M_RGB192:       NbOfBits = 64;        break;           \
+     /* Ambiguous internal format */                             \
+     default:                                                    \
+        if((DataFormat)&M_PACKED)                                \
+           {                                                     \
+           switch(((DataFormat) & M_INTERNAL_FORMAT))            \
+              {                                                  \
+              case M_RGB24:        NbOfBits = 24;        break;  \
+              case M_RGB48:        NbOfBits = 48;        break;  \
+              case M_RGB96:        NbOfBits = 96;        break;  \
+              case M_YUV9:         NbOfBits = 9;         break;  \
+              case M_YUV12:        NbOfBits = 12;        break;  \
+              case M_YUV16:        NbOfBits = 16;        break;  \
+              case M_YUV24:        NbOfBits = 24;        break;  \
+              case M_YUV12_1394:   NbOfBits = 12;        break;  \
+              default:             NbOfBits = M_INVALID; break;  \
+              }                                                  \
+           }                                                     \
+        /* If packed is not present, consider planar */          \
+        else                                                     \
+           {                                                     \
+           switch(((DataFormat) & M_INTERNAL_FORMAT))            \
+              {                                                  \
+              case M_RGB24:        NbOfBits = 8;         break;  \
+              case M_RGB48:        NbOfBits = 16;        break;  \
+              case M_RGB96:        NbOfBits = 32;        break;  \
+              case M_YUV9:         NbOfBits = 8;         break;  \
+              case M_YUV12:        NbOfBits = 8;         break;  \
+              case M_YUV16:        NbOfBits = 8;         break;  \
+              case M_YUV24:        NbOfBits = 8;         break;  \
+              case M_YUV12_1394:   NbOfBits = 8;         break;  \
+              default:             NbOfBits = M_INVALID; break;  \
+              }                                                  \
+           }                                                     \
+        break;                                                   \
+     }
+
+#define MONO_FORMAT_FROM_SIZEBIT(MonoFormat, NbOfBits)             \
+   switch( NbOfBits)                                               \
+      {                                                            \
+      case 1:        MonoFormat = M_MONO1;         break;          \
+      case 8:        MonoFormat = M_MONO8;         break;          \
+      case 16:       MonoFormat = M_MONO16;        break;          \
+      case 32:       MonoFormat = M_MONO32;        break;          \
+      case 64:       MonoFormat = M_MONO64;        break;          \
+      default:       MonoFormat = M_INVALID;       break;          \
+      }
+
+// The following MACRO takes a data format as input and returns 
+// the buffer type that is associated with it.
+// For an unknown data format, it returns M_INVALID.
+#define M_TYPE_FROM_FORMAT(DataFormat,Type)                 \
+   switch( ((DataFormat) & M_INTERNAL_FORMAT) )             \
+      {                                                     \
+      case M_MONO1:        Type = 1+M_UNSIGNED;     break;  \
+      case M_MONO8:        Type = 8+M_UNSIGNED;     break;  \
+      case M_MONO16:       Type = 16+M_UNSIGNED;    break;  \
+      case M_MONO32:       Type = 32+M_UNSIGNED;    break;  \
+      case M_MONO64:       Type = 64+M_UNSIGNED;    break;  \
+                                                            \
+      case M_RGB15:        Type = 8+M_UNSIGNED;     break;  \
+      case M_RGB16:        Type = 8+M_UNSIGNED;     break;  \
+      case M_RGB24:        Type = 8+M_UNSIGNED;     break;  \
+      case M_RGBX32:       Type = 8+M_UNSIGNED;     break;  \
+      case M_XRGB32:       Type = 8+M_UNSIGNED;     break;  \
+      case M_RGB48:        Type = 16+M_UNSIGNED;    break;  \
+      case M_RGB96:        Type = 32+M_UNSIGNED;    break;  \
+      case M_RGB192:       Type = 64+M_UNSIGNED;    break;  \
+      case M_RGB3:         Type = 1+M_UNSIGNED;     break;  \
+                                                            \
+      case M_BGR15:        Type = 8+M_UNSIGNED;     break;  \
+      case M_BGR16:        Type = 8+M_UNSIGNED;     break;  \
+      case M_BGR24:        Type = 8+M_UNSIGNED;     break;  \
+      case M_BGRX32:       Type = 8+M_UNSIGNED;     break;  \
+      case M_XBGR32:       Type = 8+M_UNSIGNED;     break;  \
+      case M_BGR30:        Type = 10+M_UNSIGNED;    break;  \
+                                                            \
+      case M_YUV9:         Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV12:        Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV16:        Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV24:        Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV16_YUYV:   Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV16_UYVY:   Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV12_1394:   Type = 8+M_UNSIGNED;     break;  \
+      default:             Type = M_INVALID;        break;  \
+      }
+
+
+// The following MACRO compare 2 attribute and return (boolean)
+//  if the internal format are equivalent. Two internal format
+//  are equivalent if the internal format is equal. The YUV16
+//  is a special case since M_YUV16 is used to define one
+//  of the 2 YUV16 type: YUYV and UYVY
+#define M_EQUIVALENT_INTERNAL_FORMAT(a,b)                                              \
+   (  (a&M_INTERNAL_FORMAT) == (b&M_INTERNAL_FORMAT)                             ||    \
+      ((a&M_INTERNAL_FORMAT)==M_YUV16  &&  (b&M_INTERNAL_FORMAT)==M_YUV16_YUYV)  ||    \
+      ((a&M_INTERNAL_FORMAT)==M_YUV16  &&  (b&M_INTERNAL_FORMAT)==M_YUV16_UYVY)  ||    \
+      ((b&M_INTERNAL_FORMAT)==M_YUV16  &&  (a&M_INTERNAL_FORMAT)==M_YUV16_YUYV)  ||    \
+      ((b&M_INTERNAL_FORMAT)==M_YUV16  &&  (a&M_INTERNAL_FORMAT)==M_YUV16_UYVY)    )   \
+
+// !!! MAP FOR OLD DEFINES
+#if OldDefinesSupport
+#define M_CHAR                        (M_MONO8     | M_SIGNED)
+MIL_DEPRECATED(M_CHAR, 1000)
+#define M_UCHAR                       (M_MONO8)
+MIL_DEPRECATED(M_UCHAR, 1000)
+#define M_SHORT                       (M_MONO16    | M_SIGNED)
+MIL_DEPRECATED(M_SHORT, 1000)
+#define M_USHORT                      (M_MONO16)
+MIL_DEPRECATED(M_USHORT, 1000)
+#define M_LONG                        (M_MONO32    | M_SIGNED)
+MIL_DEPRECATED(M_LONG, 1000)
+#define M_ULONG                       (M_MONO32)
+MIL_DEPRECATED(M_ULONG, 1000)
+#define M_RGB555                      (M_RGB15     | M_SIGNED)
+MIL_DEPRECATED(M_RGB555, 1000)
+#define M_URGB555                     (M_RGB15)
+MIL_DEPRECATED(M_URGB555, 1000)
+#define M_URGB888                     (M_RGB24)
+MIL_DEPRECATED(M_URGB888, 1000)
+#define M_RGB161616                   (M_RGB48     | M_SIGNED)
+MIL_DEPRECATED(M_RGB161616, 1000)
+#define M_URGB161616                  (M_RGB48)
+MIL_DEPRECATED(M_URGB161616, 1000)
+#define M_RGB323232                   (M_RGB96     | M_SIGNED)
+MIL_DEPRECATED(M_RGB323232, 1000)
+#define M_URGB323232                  (M_RGB96)
+MIL_DEPRECATED(M_URGB323232, 1000)
+#define M_YUV9_PLANAR                 (M_YUV9      | M_PLANAR)
+MIL_DEPRECATED(M_YUV9_PLANAR, 1000)
+#define M_YUV12_PLANAR                (M_YUV12     | M_PLANAR)
+MIL_DEPRECATED(M_YUV12_PLANAR, 1000)
+#define M_YUV16_PLANAR                (M_YUV16     | M_PLANAR)
+MIL_DEPRECATED(M_YUV16_PLANAR, 1000)
+#define M_YUV16_PACKED                (M_YUV16     | M_PACKED)
+MIL_DEPRECATED(M_YUV16_PACKED, 1000)
+#define M_BGR15_PACKED                (M_BGR15     | M_PACKED)
+MIL_DEPRECATED(M_BGR15_PACKED, 1000)
+#define M_RGB24_PACKED                (M_RGB24     | M_PACKED)
+MIL_DEPRECATED(M_RGB24_PACKED, 1000)
+#define M_RGB32_PACKED                (M_RGB32     | M_PACKED)
+MIL_DEPRECATED(M_RGB32_PACKED, 1000)
+#define M_BGR24_PACKED                (M_BGR24     | M_PACKED)
+MIL_DEPRECATED(M_BGR24_PACKED, 1000)
+#define M_NODIBFLIP                   (M_FLIP)
+MIL_DEPRECATED(M_NODIBFLIP, 1000)
+#if !M_MIL_USE_LINUX
+#define M_DIB_BGR24_PACKED            (M_BGR24     | M_PACKED | M_FLIP | M_DIB)
+MIL_DEPRECATED(M_DIB_BGR24_PACKED, 1000)
+#else
+#define M_DIB_BGR24_PACKED            (M_BGR24     | M_PACKED | M_FLIP )
+MIL_DEPRECATED(M_DIB_BGR24_PACKED, 1000)
+#endif
+#define M_BGR32_PACKED                (M_BGR32     | M_PACKED)
+MIL_DEPRECATED(M_BGR32_PACKED, 1000)
+#endif
+
+#define M_USE                   0x00001000L    // The region (if it exists) is used normally
+#define M_IGNORE                0x00002000L    // The region is ignored in all processing
+#define M_MODIFY                       999L    // The region is ignored for processing, but is modified to fit written content
+
+/************************************************************************/
+/* MbufCreateColor() ControlFlags                                       */
+/************************************************************************/
+#define M_ALIGNMENT_RESERVED_BITS                     0x000000FFL
+#define M_VIDEO_DEVICE_MASK                           0x00000F00L
+#define M_NO_4GB_BORDERS                              0x00001000L
+#define M_NO_PARSING                                  0x00002000L
+#define M_WRITE_COMBINING                             16384L      // 0x00004000L
+#define M_64BIT_PHYSICAL_ADDRESS                      0x00008000L
+#define M_HOST_ADDRESS                                0x00010000L // Was 0x80000000L
+#define M_MIL_ID                                      0x00020000L
+#define M_FIRST_MIL_BUFFER                            0x00040000L
+#define M_HOST_ADDRESS_REMOTE                         0x00080000L
+#define M_ALLOCATION                                  0x00100000L
+#define M_NAME                                        (0x00200000L | M_CLIENT_ENCODING)
+#define M_PHYSICAL_ADDRESS_REMOTE                     0x00400000L
+#define M_DIRECTX_CREATION                            0x00800000L
+#define M_CACHABLE                                    0x01000000L
+// Free                                               0x02000000L
+#define M_NO_MAP                                      0x04000000L
+#define M_PITCH_BYTE                                  0x08000000L
+#define M_DEFAULT                                     0x10000000L
+#define M_PITCH                                       0x20000000L
+#define M_PHYSICAL_ADDRESS                            0x40000000L
+
+// MAKE_INT64(0x0000000080000000) // Reserved
+#define M_BELOW_4GB                                   MAKE_INT64(0x0000000100000000)
+#define M_ABOVE_4GB                                   MAKE_INT64(0x0000000200000000)
+// MAKE_INT64(0x0000000400000000)
+// MAKE_INT64(0x0000000800000000)
+// MAKE_INT64(0x0000001000000000)
+// MAKE_INT64(0x0000002000000000)
+// MAKE_INT64(0x0000004000000000)
+// MAKE_INT64(0x0000008000000000)
+// MAKE_INT64(0x0000010000000000)
+// MAKE_INT64(0x0000020000000000)
+// MAKE_INT64(0x0000040000000000)
+// MAKE_INT64(0x0000080000000000)
+// MAKE_INT64(0x0000100000000000)
+#define M_NON_CACHABLE                                MAKE_INT64(0x0000200000000000)
+// MAKE_INT64(0x0000400000000000)
+// MAKE_INT64(0x0000800000000000)
+// MAKE_INT64(0x0001000000000000)
+// MAKE_INT64(0x0002000000000000)
+// MAKE_INT64(0x0004000000000000)
+// MAKE_INT64(0x0008000000000000)
+// MAKE_INT64(0x0010000000000000)
+// MAKE_INT64(0x0020000000000000)
+// MAKE_INT64(0x0040000000000000)
+// MAKE_INT64(0x0080000000000000)
+// MAKE_INT64(0x0100000000000000)
+// MAKE_INT64(0x0200000000000000)
+// MAKE_INT64(0x0400000000000000)
+// MAKE_INT64(0x0800000000000000)
+// MAKE_INT64(0x1000000000000000)
+// MAKE_INT64(0x2000000000000000)
+// MAKE_INT64(0x4000000000000000)
+// MAKE_INT64(0x8000000000000000)
+
+
+#define M_ADDRESS_ALIGNMENT(n)                                (n)
+
+#define M_VIDEO_DEVICE_OFFSET                         8L
+#define M_VIDEO_DEVICE(dev)                           ((((dev)+1)<<M_VIDEO_DEVICE_OFFSET)&M_VIDEO_DEVICE_MASK)
+#define M_VIDEO_DEVICE_TO_USE(cf)                     ((((cf)&M_VIDEO_DEVICE_MASK)>>M_VIDEO_DEVICE_OFFSET)-1)
+
+#define M_INFINITE                                    -1L
+
+/************************************************************************/
+/* MbufClone() ControlFlags                                             */
+/************************************************************************/
+#if OldDefinesSupport
+#define  M_COPY_SRC_DATA      0x00000001L    //Copy source data contain.
+MIL_DEPRECATED(M_COPY_SRC_DATA, 1060)
+#endif
+#define  M_COPY_SOURCE_DATA   0x00000001L    //Copy source data contain. Replace M_COPY_SRC_DATA.
+
+/************************************************************************/
+/* MbufBlit() Values                                                    */
+/************************************************************************/
+
+// A combination of flags that determine the valid members of the MBLTDESC structure.
+#define M_BLT_REGION       0x00000001L  // Uses the lRegion member of the MBLTDESC structure to determine which region to copy.
+#define M_BLT_MODE         0x00000002L  // Uses the lMode member of the MBLTDESC structure to determine if the blit is synchronous or not.
+#define M_BLT_TYPE         0x00000004L  // Uses the lType member of the MBLTDESC structure to determine the type of the copy.
+#define M_BLT_DESTRECT     0x00000008L  // Uses the lDestRect member of the MBLTDESC structure to determine the valid destination rectangle.
+#define M_BLT_SRCRECT      0x00000010L  // Uses the lSrcRect member of the MBLTDESC structure to determine the valid source rectangle.
+
+
+
+// Indicate which region (M_BLT_REGION) to copy from the source buffer to the destination buffer (the default is M_BLT_FRAME).
+// The valid values for this member are:
+#define M_BLT_FRAME        1  // Blit all lines of the source buffer in the destination buffer. ***DEFAULT***
+#define M_BLT_ODD          2  // Blit all lines from the sources buffer to ODD lines of the destination buffer.
+#define M_BLT_EVEN         3  // Blit all lines from the sources buffer to EVEN lines of the destination buffer.
+#define M_BLT_ODD_ODD      4  // Blit ODD lines from the sources buffer to ODD lines of the destination buffer.
+#define M_BLT_EVEN_EVEN    5  // Blit EVEN lines from the sources buffer to EVEN lines of the destination buffer.
+
+// Indicate if the blit (M_BLT_MODE) is done asynchronously or synchronously (the default is synchronously). The valid value are:
+#define M_BLT_ASYNC        10  // Performs this blit asynchronously.
+#define M_BLT_SYNC         11  // Performs this blit synchronously. ***DEFAULT***
+
+// Indicate which type (M_BLT_TYPE) of copy is performed (the default is a normal blit, M_SCRCOPY). The valid values are:
+#define M_BLT_SRCCOPY               20  // Performs a normal blit. (only supported by M_BLT_FRAME) ***DEFAULT***
+#define M_BLT_SRCKEYONBLACK         21  // Performs a blit with black keying. (only supported by M_BLT_FRAME)
+#define M_BLT_SRCMIRRORLEFTRIGHT    22 // This blit mirrors the surface from left to right (y-axis).
+#define M_BLT_SRCMIRRORUPDOWN       23 // This blit mirrors the surface from top to bottom (x-axis).
+#define M_BLT_SRCMIRRORLRUPDN       24 // This blit mirrors the surface from top to bottom and from left to right.
+#define M_BLT_SCALELINEAR           25
+#define M_BLT_SCALENEAR             26
+#define M_BLT_SCALECONSTANT         27
+#define M_BLT_SCALEYUV2BGR          28
+#define M_BLT_SCALEYUV2Y            29
+#define M_BLT_SCALEYUV              30
+
+#ifdef M_USE_MBUFBLIT
+// ****************************************************************************
+//
+// Description of the MBLTDESC_VER1 structure :
+//
+//    lSize :        Size of the structure, in bytes. This member must be
+//                   initialized before the structure is used.
+//    lValidMembers: A combination of flags that determine the valid members of
+//                   the MBLTDESC structure.
+//    lRegion:       Indicate which region to copy from the source buffer to
+//                   the destiantion buffer (the default is M_BLT_FRAME).
+//    lMode:         Indicate if the blit is done asynchronously or
+//                   synchronously (the default is synchronously).
+//    lType:         Indicate which type of copy is performed (the default
+//                   is a normal blit, M_SCR_COPY).
+//    DestRect:      RECT structure that defines the upper-left and lower-right
+//                   points of the rectangle to blit to on the destination
+//                   surface. If this parameter is set to ZERO, the entire
+//                   destination surface is used.
+//    SrcRect:       RECT structure that defines the upper-left and lower-right
+//                   points of the rectangle to blit from on the source surface.
+//                   If this parameter is set to ZERO, the entire source surface
+//                   is used.
+//    lpDDDestSurface: Address of the destination direct draw surface used for
+//                   the copy. MIL will fill automatically this member is the blit
+//                   is valid. Use this member if you want to know if an
+//                   asynchronously blit is done (GetBltStatus(DDGBS_ISBLTDONE)).
+//    lSrcType:      Indicate which type of protocol to use for the source (FB, PCI or AGP)
+//    lDestType:     Indicate which type of protocol to use for the destination (FB, PCI or AGP)
+//
+// ****************************************************************************
+
+#if !(M_MIL_USE_LINUX)
+typedef struct _MBLTDESC_VER1 {
+   long        lSize;
+   long        lValidMembers;
+   long        lRegion;
+   long        lMode;
+   long        lType;
+   RECT        DestRect;
+   RECT        SrcRect;
+   LPDIRECTDRAWSURFACE lpDDDestSurface;
+   long        lSrcType;
+   long        lDestType;
+   } MBLTDESC_VER1;
+typedef MBLTDESC_VER1 *LPMBLTDESC_VER1;
+
+typedef MBLTDESC_VER1 MBLTDESC;
+
+typedef MBLTDESC *LPMBLTDESC;
+#endif // M_MIL_USE_LINUX
+
+#define M_INIT_STRUCT(x) (memset(&x,0,sizeof(x)), x.lSize=sizeof(x))
+#endif // M_USE_MBUFBLIT
+
+
+
+/************************************************************************/
+/* MbufCopyCond  conditions                                             */
+/************************************************************************/
+#define M_EQUAL                                       3L
+#define M_NOT_EQUAL                                   4L
+#define M_BGRX32_COMPOSITION                          5L
+
+/************************************************************************/
+/* MbufGet(), MbufPut(), MbufChild(), ...                               */
+/************************************************************************/
+#define M_RED                                         0x08L
+#define M_GREEN                                       0x10L
+#define M_BLUE                                        0x20L
+#define M_ALL_BAND                                    -1L
+#define M_ALL_BANDS                                   M_ALL_BAND
+#define M_HUE                                         0x00008000L
+#define M_SATURATION                                  0x2000L
+#define M_LUMINANCE                                   0x00020000L   // M_GRAB_INPUT_GAIN
+#define M_CHROMINANCE                                 0x00040000L   // M_GRAB_INPUT_GAIN
+#define M_Y                                           M_RED
+#define M_U                                           M_GREEN
+#define M_V                                           M_BLUE
+#define M_DITHERING                                   0x2000L
+#define M_CBCR                                        0x4000L
+#define M_ORANGE                                      0x30          // For M_LED_USER
+
+#define M_ALL_BITS                                    -1L
+#define M_DONT_CARE                                   0x00008000L
+#if !M_MIL_USE_LINUX
+#define M_CHILD_ALLOC_LOSABLE_ATTRIBUTE               (M_DIRECTX|M_DIB|M_GDI|M_BITMAP_HANDLE|M_MTX0)
+#else
+#define M_CHILD_ALLOC_LOSABLE_ATTRIBUTE               (M_GDI|M_MTX0|M_LINUX_MXIMAGE)
+#endif
+
+/************************************************************************/
+/* MbufChildColor2dClip(), MbufChildMove()                              */
+/************************************************************************/
+#define M_CLIPPED_OFFSET_X                            1L
+#define M_CLIPPED_OFFSET_Y                            2L
+#define M_CLIPPED_SIZE_X                              4L
+#define M_CLIPPED_SIZE_Y                              8L
+#define M_CLIP                                        0x0010L /* also defined in milcal.h */
+
+
+/************************************************************************/
+/* MbufChildContainer()                                                 */
+/************************************************************************/
+#define M_ANY_CRITERIA                                1
+#define M_ALL_CRITERIA                                2
+
+/************************************************************************/
+/* MbufTransfer()                                                       */
+/************************************************************************/
+/*Transfer function value*/
+#define M_DEFAULT                                     0x10000000L
+#define M_CLEAR                                       0x00000001L
+#define M_AUTO_SCALE                            2L  //0x00000002L
+#define M_BIT_SHIFT                             3L  //0x00000003L
+#define M_WINDOW_RANGE                       3072L  //0x00000C00L
+#define M_COMPOSITION                                 0x00001000L
+#define M_COPY_EVEN                                   0x00002000L
+#define M_COPY_ODD                                    0x00004000L
+#define M_COPY_TO_HWND                                0x00010000L
+#define M_COPY                                        0x00020000L
+#define M_REPLICATE                                   0x00040000L
+#define M_SCALE                                       0x00008010L    // Can be added to some functions like M_COPY
+#define M_BYTE_SWAP                                   0x00080000L
+#define M_BINARIZE                                    0x00100000L
+#define M_LUT_MAP                                     0x00200000L
+#define M_COLOR_MATCH                                 0x00400000L
+#define M_ALPHA_BLENDING                              0x00800000L
+/*Transfer type*/
+#define M_DEFAULT                                     0x10000000L
+#define M_MIL_METHOD                                  0x01000000L
+#define M_DRIVER_METHOD                               0x02000000L
+#define M_DIRECTX_METHOD                              0x00001000L
+#define M_MTX0_METHOD                                 0x00002000L
+#define M_DRAWDIB_METHOD                              0x00004000L
+#define M_BITBLT_METHOD                               0x00008000L
+#define M_STRETCHBLT_METHOD                           0x00010000L
+#define M_DIBTODEV_METHOD                             0x00020000L
+#define M_STRETCHDIB_METHOD                           0x00040000L
+#define M_DIB_METHOD                                  (M_DRAWDIB_METHOD|M_BITBLT_METHOD|M_STRETCHBLT_METHOD|M_DIBTODEV_METHOD|M_STRETCHDIB_METHOD)
+#define M_LINUX_METHOD                                0x00080000L
+//#define M_LINUX_DGA_METHOD                            0x00100000L (Obsolete)
+#define M_NON_DISPLAY_METHOD                          MAKE_INT64(0x00000000EF000000)
+#define M_DISPLAY_METHOD                              0x00FFF000L
+/*Double name for the documentation*/
+#define M_MIL_MODE                                    M_MIL_METHOD
+#define M_DRIVER_MODE                                 M_DRIVER_METHOD
+#define M_DIRECTX_MODE                                M_DIRECTX_METHOD
+#define M_MTX0_MODE                                   M_MTX0_METHOD
+#define M_DRAWDIB_MODE                                M_DRAWDIB_METHOD
+#define M_BITBLT_MODE                                 M_BITBLT_METHOD
+#define M_STRETCHBLT_MODE                             M_STRETCHBLT_METHOD
+#define M_DIBTODEV_MODE                               M_DIBTODEV_METHOD
+#define M_STRETCHDIB_MODE                             M_STRETCHDIB_METHOD
+#define M_DIB_MODE                                    M_DIB_METHOD   /*NOTE: DibMode is also a BufInquire (old displays)*/
+#define M_LINUX_MODE                                  M_LINUX_METHOD
+
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+
+#define M_ALLOW_LARGER_RECT                           0x00000100L
+#define M_CAN_GROW_RECT                               M_ALLOW_LARGER_RECT
+#define M_USE_RECT_LIST                               0x00000200L
+#define M_BILINEAR                                    0x00000008L
+#define M_BICUBIC                                     0x00000010L
+#define M_NEAREST_NEIGHBOR                            0x00000040L
+#define M_USE_MP_FOR_TRANSFER                         0x00000080L
+#define M_BILINEAR_RENDERING                          0x00000400L
+#define M_IGNORE_REGION                               0x00000800L
+
+/*Mask used to retrieve field in the transfer type*/
+#define M_ALL_METHOD                                  MAKE_INT64(0x00000000EFFFF000)    // M_DISPLAY_METHOD | M_NON_DISPLAY_METHOD
+#define M_NB_OF_TRANSFER_METHOD                               19L    // Must be equal to CountSetBit(M_ALL_METHOD)
+#define M_TRANSFER_METHOD                             MAKE_INT64(0x00000000FFFFF000)
+#define M_SCALING_METHOD                              (M_BILINEAR|M_BILINEAR_RENDERING|M_BICUBIC|M_NEAREST_NEIGHBOR)
+#define M_TRANSFER_TYPE_KNOWN_BITS                    (M_TRANSFER_METHOD|M_SCALING_METHOD|M_USE_RECT_LIST|M_ALLOW_LARGER_RECT|M_SYNCHRONOUS|M_ASYNCHRONOUS|M_USE_MP_FOR_TRANSFER|M_IGNORE_REGION)
+
+
+/************************************************************************/
+/* MbufImport(), MbufExport()                                           */
+/************************************************************************/
+#define M_RESTORE                                     0x10L
+
+#define M_LOAD                                        1L
+#define M_NO_COMPRESS                                 2L
+#define M_NO_GRAB                                     4L
+#define M_NO_PROC                                     8L
+#define M_NO_DISP                                     32L
+
+// TIFF compression as defined in tiff spec 6.0
+#define M_COMPRESSION_NONE                       1L
+#define M_COMPRESSION_CCITTRLE                   2L
+#define M_COMPRESSION_CCITTFAX3                  3L
+#define M_COMPRESSION_CCITTFAX4                  4L
+#define M_COMPRESSION_LZW                        5L
+#define M_COMPRESSION_OJPEG                      6L
+#define M_COMPRESSION_JPEG                       7L
+#define M_COMPRESSION_NEXT                       32766L
+#define M_COMPRESSION_CCITTRLEW                  32771L
+#define M_COMPRESSION_PACKBITS                   32773L
+#define M_COMPRESSION_THUNDERSCAN                32809L
+#define M_COMPRESSION_IT8CTPAD                   32895L
+#define M_COMPRESSION_IT8LW                      32896L
+#define M_COMPRESSION_IT8MP                      32897L
+#define M_COMPRESSION_IT8BL                      32898L
+#define M_COMPRESSION_PIXARFILM                  32908L
+#define M_COMPRESSION_PIXARLOG                   32909L
+#define M_COMPRESSION_DEFLATE                    32946L
+#define M_COMPRESSION_ADOBE_DEFLATE              8L
+#define M_COMPRESSION_DCS                        32947L
+#define M_COMPRESSION_JBIG                       34661L
+#define M_COMPRESSION_SGILOG                     34676L
+#define M_COMPRESSION_SGILOG24                   34677L
+#define M_COMPRESSION_JP2000                     34712L
+
+// Used by legacy tiff handler
+#define M_TIFF_NO_COMPRESSION                         M_COMPRESSION_NONE
+#define M_TIFF_CCITT_3                                M_COMPRESSION_CCITTRLE
+#define M_TIFF_CCITT_3_T4_ENCODING                    M_COMPRESSION_CCITTFAX3
+#define M_TIFF_CCITT_4_T6_ENCODING                    M_COMPRESSION_CCITTFAX4
+
+
+#define M_MIL                                         1L
+#define M_MIL_TIFF                                    1L
+#define M_RAW                                         2L
+#define M_TIFF_LEGACY                                 4L // Used for legacy tiff handler
+#define M_TIFF_COMPRESS                              16L // Used for legacy tiff handler
+#define M_TIFF_COMPRESS_2                            32L // Used for legacy tiff handler
+
+#define M_PLY_ASCII                                2832L
+#define M_PLY_BINARY_LITTLE_ENDIAN                 2833L
+#define M_STL_ASCII                                3303
+#define M_STL_BINARY                               3304
+#define M_PLY                                      1964L
+#define M_STL                                      2198L
+
+
+
+#define M_TIFF                                      0x1000L
+
+// TIFF Compression type
+#define M_TIFF_COMPRESSED(x)                       (M_TIFF + (x)) // Compressed TIFF type
+#define M_TIFF_COMPRESSION_TAG(x)                  (M_TIFF_IS_COMPRESSED(x)) ? ((x) - M_TIFF)  : M_INVALID // TIFF Compression tag value
+
+#define M_TIFF_IS_COMPRESSED(x)                    (((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_NONE         ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTRLE     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTFAX3    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTFAX4    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_LZW          ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_OJPEG        ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_JPEG         ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_NEXT         ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTRLEW    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_PACKBITS     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_THUNDERSCAN  ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_IT8CTPAD     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_IT8LW        ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_IT8MP        ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_IT8BL        ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_PIXARFILM    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_PIXARLOG     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_DEFLATE      ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_ADOBE_DEFLATE))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_DCS          ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_JBIG         ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_SGILOG       ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_SGILOG24     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_JP2000       ))))
+
+#define M_TIFF_IS_CCITT(x)                         (((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTRLEW    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTRLE     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTFAX3    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTFAX4    ))))
+
+
+#define M_GENDC                                       0x100000
+#define M_MIL_NATIVE                                  21
+#define M_USE_EXTENSION                               22
+#define M_BMP                                         64L
+#define M_JPEG2K_JP2                                  8L 
+#define M_PNG                                    0x2000L
+
+#define M_JPEG_LOSSLESS                               0x00400000L
+#define M_JPEG_LOSSY                                  0x00800000L
+#define M_JPEG_LOSSLESS_INTERLACED                    0x00C00000L
+#define M_JPEG_LOSSY_INTERLACED                       0x08000000L
+#define M_JPEG2000_LOSSY                              0x08400000L
+#define M_JPEG2000_LOSSLESS                           0x08800000L
+
+// Special file formats for import and export.
+#define M_JPEG_LOSSY_RGB                              0x01000000L
+#define M_JPEG2000_LOSSY_JP2                          M_JPEG2000_LOSSY+M_JPEG2K_JP2
+#define M_JPEG2000_LOSSLESS_JP2                       M_JPEG2000_LOSSLESS+M_JPEG2K_JP2
+
+#define M_PLANAR                                      0x00040000L
+
+#define M_WITH_CALIBRATION                            0x00020000L
+#define M_NO_REGION                                   0x00010000L
+
+#define M_INTERACTIVE                                 M_NULL
+
+#define M_DEFAULT_RESOLUTION_X                        72L
+#define M_DEFAULT_RESOLUTION_Y                        72L
+
+#define M_DPM_FACTOR                                  0.0254 //1 inche/meter
+
+/************************************************************************/
+/* MbufImportSequence(), MbufExportSequence()                           */
+/************************************************************************/
+#define M_RESTORE                                     0x10L
+
+#define M_LOAD                                        1L
+
+#define M_AVI_MIL                                     128L
+#define M_AVI_DIB                                     256L // Standard Windows AVI files.
+#define M_AVI_MJPG                                    512L
+#define M_AVI_MJPEG                                   M_AVI_MJPG
+#define M_AVI_MPG4                                    1024L
+#define M_AVI_MPEG4                                   M_AVI_MPG4
+#define M_AVI_H264                                    2048L
+#define M_AVI_CODEC                                   0x4000L // Use external codecs
+#define M_DEFAULT                                     0x10000000L
+
+#define M_AVI_CODEC_UNSUPPORTED                       -2      // AVI Codec not available
+
+// Import/Export Control Flags.
+#define M_DEFAULT                                     0x10000000L         /* Create a file-Write/Read-Close           */
+#define M_APPEND                                      0x20000000L         /* Open-Append-Close                        */
+#define M_READ                                        1                   /* Read from an opened file.                */
+#define M_WRITE                                       2                   /* Write into an opened file.               */
+#define M_OPEN                                        0x00000010L         /* Open a file to Read/Write( with create ) */
+#define M_CLOSE                                       0x00000020L         /* Close an open file.                      */
+#define M_OPEN_APPEND                                 (M_OPEN + M_APPEND) /* Open an existing file to append into.    */
+
+#define M_INTERACTIVE                                 M_NULL
+
+
+/************************************************************************/
+/* MbufLoad()                                                           */
+/************************************************************************/
+#define M_INTERACTIVE                                 M_NULL
+
+
+/************************************************************************/
+/* MbufSave()                                                           */
+/************************************************************************/
+#define M_INTERACTIVE                                 M_NULL
+
+
+/************************************************************************/
+/* MbufRestore()                                                        */
+/************************************************************************/
+#define M_INTERACTIVE                                 M_NULL
+
+
+/************************************************************************/
+/* MbufControl() (formerly MbufControlNeighborhood()) / MbufInquire()   */
+/************************************************************************/
+#define M_ABSOLUTE_VALUE                              50L
+#define M_NORMALIZATION_FACTOR                        52L
+#define M_OVERSCAN                                    53L
+#define M_OVERSCAN_REPLACE_VALUE                      54L
+#define M_OFFSET_CENTER_X                             55L
+#define M_OFFSET_CENTER_Y                             56L
+#define M_SATURATION                                  0x2000L
+#define M_FILTER_MODE                                 122L     // Already defined in miledge.h
+#define M_FILTER_TYPE                                 1046L    // Already defined in miledge.h, milmeas.h
+#define M_FILTER_OPERATION                            57L
+#define M_NUMBER_OF_ELEMENT_VALUES_VALID              58L
+#define M_SMOOTHNESS                                  108L         // Already defined in    milmod.h, milmeas.h, mil.h
+#define M_FILTER_SMOOTHNESS                           M_SMOOTHNESS // Already defined in    mil.h, milmeas.h
+
+#define M_DEFAULT                                     0x10000000L
+#define M_ENABLE                                      -9997L
+#define M_DISABLE                                     -9999L
+
+// Control values for M_OVERSCAN.
+#define M_DEFAULT                                     0x10000000L
+#define M_FAST                                        0x00002000L
+#define M_TRANSPARENT                                 0x01000059L
+#define M_REPLACE                                     0x01000060L
+#define M_MIRROR                                      0x01000061L
+#define M_REPLICATE                                   0x00040000L
+#define M_DISABLE                                     -9999L
+
+// Control values for M_OVERSCAN_REPLACE_VALUE.
+#define M_DEFAULT                                     0x10000000L
+#define M_REPLACE_MAX                                 0x01000063L
+#define M_REPLACE_MIN                                 0x01000064L
+
+/************************************************************************/
+/* MbufCopyComponent() Operation                                        */
+/************************************************************************/
+#define M_MOVE_APPEND                                 0x01000070L
+#define M_MOVE_REPLACE                                0x01000080L
+
+/************************************************************************/
+/* MbufCopyComponent() Control flag                                     */
+/************************************************************************/
+#define M_NO_COPY_SOURCE_DATA                         0x00100000
+#define M_SOURCE_MUST_EXIST                           0x00200000
+#define M_IDENTICAL                                   0x00400000
+#define M_USE_DESTINATION                             0x00800000
+#define M_BASIC_ATTRIBUTE                             0x01000000
+
+/************************************************************************/
+/* MbufInquire() / MbufControl() Types                                  */
+/************************************************************************/
+#define M_SIZE_BAND                                   1005L
+#define M_SIZE_BAND_LUT                               1006L
+#define M_SIZE_BIT                                    1007L
+#define M_TYPE                                        1008L
+#define M_NUMBER                                      1009L
+#define M_INIT_FLAG                                   1012L
+#define M_ATTRIBUTE                                   1013L
+#define M_SIGN                                        1014L
+#define M_NATIVE_ID                                   1016L
+#define M_MAP                                         1018L
+#define M_DIRECTX_STRUCT_FOR_MAPPABLE_BUFFER          1019L
+#define M_MAP_REMOTE                                  1020L
+#define M_SURFACE                                     1021L
+#define M_DATA_TYPE                                   1022L
+#define M_OWNER_SYSTEM_TYPE                           1023L
+#define M_BUF_MODIFIED_HOOKED                         1030L
+#define M_MAP_HOST_ADDRESS                            1031L
+#define M_CALL_HOOKS                                  1034L
+#define M_DRIVER_ASYNC_CALL_BW                        1038L
+#define M_EFFECTIVE_SIZE_BIT                          1039L
+#define M_DIG_PROCESS_PTR                             1040L
+#define M_DATA_FORMAT                                 1041L
+#define M_SET_MODIFIED_RECT_EMPTY                     1042L
+#define M_IS_INTERNALLY_ALLOCATED                     1043L
+#if OldDefinesSupport
+#define M_SRC_INTER_SYSTEM_COPY                       1044L
+MIL_DEPRECATED(M_SRC_INTER_SYSTEM_COPY, 1060)
+#endif
+#define M_SATURATION_SIZE_BIT                         1045L
+//1046L is used by M_FILTER_TYPE, see MbufControl() (formerly MbufControlNeighborhood()).
+#define M_SATURATION_TYPE                             1047L
+#define M_LOCATION                                    1048L
+#define M_SYSTEM_LOCATION                             M_LOCATION
+#define M_MIL_ID_INTERNAL                             1049L
+#define M_REAL_FORMAT                                 1050L
+#define M_SET_LOCKED_BUFFER_HOST_ADDRESS              1051L
+#define M_SET_LOCKED_BUFFER_PHYSICAL_ADDRESS          1052L
+#define M_GPU_ACCESS_ONLY                             1053L
+#define M_DATA_STORAGE_MODE                           1054L
+#define M_REGION_STREAM_SIZE_BYTE                     1055L
+#define M_REGION_COPY                                 1056L
+#define M_VIDEO_DEVICE_INDEX                          1057L
+#define M_REGION_TYPE                                 1058L
+#define M_ALLOCATED_USING_BUF_CREATE                  1059L
+#define M_DRIVER_ASYNC_CALL                           1060L
+#define M_RESOLUTION_X                                1062L
+#define M_RESOLUTION_Y                                1063L
+#define M_BYTE_ORDER                                  1064L
+#define M_REGION_USE                                  1065L
+#define M_REGION_LINK                                 1066L
+#define M_REGION_LINK_OFFSET_X                        1067L
+#define M_REGION_LINK_OFFSET_Y                        1068L
+#define M_REGION_MODIFICATION_COUNT                   1069L
+#define M_SPPD_STATE                                  1070L 
+#define M_SPPD_DATA_SAMPLE_COUNT                      1071L 
+#define M_SPPD_PEAK_AVERAGE_WIDTH                     1072L 
+#define M_SPPD_PEAK_MODE                              1073L 
+#define M_SPPD_OUTPUT_FORMAT                          1074L 
+#define M_SPPD_PEAK_MINIMUM_WIDTH                     1075L 
+#define M_SPPD_PEAK_MAXIMUM_WIDTH                     1076L 
+#define M_SPPD_PEAK_AVERAGE_MINIMUM_CONTRAST          1077L 
+#define M_SPPD_FRAME_HEIGHT                           1078L 
+#define M_GENICAM_AVAILABLE                           1079L
+#define M_SPPD_PEAK_INTENSITY_RANGE                   1083L
+#define M_IMPULSE_C_STATE                             1085L
+#define M_REGION_ACTIVE                               1086L
+#define M_COMPONENT_INVALID                           1087L
+#define M_3D_PROCESSABLE                              1088L
+#define M_3D_DISPLAYABLE                              1089L
+#define M_3D_PROCESSABLE_MESHED                       1091L
+#define M_3D_CONVERTIBLE                              1092L
+/************************************************************************/
+/* MbufInquire() Types MIL_ID range start                               */
+/************************************************************************/
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_BUF_INQUIRE_MIL_ID_START                    1100L
+#define M_OWNER_SYSTEM                                1101L
+#define M_LUT_ID                                      1102L
+#define M_PARENT_ID                                   1103L
+#define M_ANCESTOR_ID                                 1104L
+#define M_PROC_HOST_ID                                1105L
+#define M_HOST_ID                                     1106L
+#define M_DRIVER_ID                                   1107L
+#define M_ASSOCIATED_AUDIO_BUFFER_ID                  1108L/////ADDED//////
+#define M_ASSOCIATED_LUT                              1110L
+#define M_REGION_GRAPHIC_LIST_ID                      1111L
+#define M_REGION_BUFFER_ID                            1112L
+//#define unused                                      1113L
+
+#define M_HUFFMAN_DC_LUMINANCE                        1120L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_AC_LUMINANCE                        1121L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_DC_CHROMINANCE                      1122L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_AC_CHROMINANCE                      1123L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_DC                                  1124L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_AC                                  1125L // Buffer M_COMPRESS Jpeg
+#define M_QUANTIZATION_LUMINANCE                      1126L // Buffer M_COMPRESS Jpeg
+#define M_QUANTIZATION_CHROMINANCE                    1127L // Buffer M_COMPRESS Jpeg
+
+// M_QUANTIZATION + M_ALL_BAND                        1151L
+#define M_QUANTIZATION                                1152L
+// M_QUANTIZATION + M_RED                             1160L // 1152+0x08
+// M_QUANTIZATION + M_GREEN                           1168L // 1152+0x10
+// M_QUANTIZATION + M_BLUE                            1184L // 1152+0x20
+
+#define M_SHADING_CORRECTION_OFFSET_ID                1190L
+#define M_SHADING_CORRECTION_GAIN_ID                  1191L
+#define M_OWNER_CONTAINER_ID                          1193L
+#define M_COMPONENT_ID                                1195L
+
+#define M_BUF_INQUIRE_MIL_ID_END                      1199L
+
+/************************************************************************/
+/* MbufInquire() Types MIL_ID range end                                 */
+/************************************************************************/
+
+
+#define M_SIZE_X                                      1536L // 0x600
+#define M_SIZE_Y                                      1537L // 0x601
+#define M_SIZE_Z                                      1538L // 0x602
+
+#define M_SIZE_X_RED                                  M_SIZE_X + M_RED // 1544L or 0x608
+#define M_SIZE_Y_RED                                  M_SIZE_Y + M_RED // 1545L or 0x609
+#define M_SIZE_Z_RED                                  M_SIZE_Z + M_RED // 1546L or 0x60A
+
+#define M_SIZE_X_GREEN                                M_SIZE_X + M_GREEN // 1552L or 0x610
+#define M_SIZE_Y_GREEN                                M_SIZE_Y + M_GREEN // 1553L or 0x611
+#define M_SIZE_Z_GREEN                                M_SIZE_Z + M_GREEN // 1554L or 0x612
+
+#define M_SIZE_X_BLUE                                 M_SIZE_X + M_BLUE // 1568L or 0x620
+#define M_SIZE_Y_BLUE                                 M_SIZE_Y + M_BLUE // 1569L or 0x621
+#define M_SIZE_Z_BLUE                                 M_SIZE_Z + M_BLUE // 1570L or 0x622
+
+
+// The difference between the following defines must be >= 2. The bits
+// M_RED, M_GREEN, M_BLUE, i.e. 4, 5 and 6 (zero-based) of the flags
+// must also always be cleared.
+
+// M_NUMBER_SUBBAND + M_ALL_BAND                      2559L
+#define M_NUMBER_SUBBAND                              2560L
+// M_NUMBER_SUBBAND + M_RED                           2568L // 2560+0x08
+// M_NUMBER_SUBBAND + M_GREEN                         2576L // 2560+0x10
+// M_NUMBER_SUBBAND + M_BLUE                          2592L // 2560+0x20
+
+// M_DECOMPOSITION_LEVEL + M_ALL_BAND                 2561L
+#define M_DECOMPOSITION_LEVEL                         2562L
+// M_DECOMPOSITION_LEVEL + M_RED                      2570L // 2562+0x08
+// M_DECOMPOSITION_LEVEL + M_GREEN                    2578L // 2562+0x10
+// M_DECOMPOSITION_LEVEL + M_BLUE                     2594L // 2562+0x20
+
+// Note : also used in JPEG.
+// M_Q_FACTOR + M_ALL_BAND                            2563L
+#define M_Q_FACTOR                                    2564L
+// M_Q_FACTOR + M_RED                                 2572L // 2564+0x08
+// M_Q_FACTOR + M_GREEN                               2580L // 2564+0x10
+// M_Q_FACTOR + M_BLUE                                2596L // 2564+0x20
+
+// M_CODE_BLOCK_SIZE_X + M_ALL_BAND                   2565L
+#define M_CODE_BLOCK_SIZE_X                           2566L
+// M_CODE_BLOCK_SIZE_X + M_RED                        2574L // 2566+0x08
+// M_CODE_BLOCK_SIZE_X + M_GREEN                      2582L // 2566+0x10
+// M_CODE_BLOCK_SIZE_X + M_BLUE                       2598L // 2566+0x20
+
+// M_CODE_BLOCK_SIZE_Y + M_ALL_BAND                   2599L
+#define M_CODE_BLOCK_SIZE_Y                           2600L
+// M_CODE_BLOCK_SIZE_Y + M_RED                        2608L // 2600+0x08
+// M_CODE_BLOCK_SIZE_Y + M_GREEN                      2616L // 2600+0x10
+// M_CODE_BLOCK_SIZE_Y + M_BLUE                       2632L // 2600+0x20
+
+// M_QUANTIZATION_INTERNAL + M_ALL_BAND               2601L
+#define M_QUANTIZATION_INTERNAL                       2602L
+// M_QUANTIZATION_INTERNAL + M_RED                    2610L // 2602+0x08
+// M_QUANTIZATION_INTERNAL + M_GREEN                  2618L // 2602+0x10
+// M_QUANTIZATION_INTERNAL + M_BLUE                   2634L // 2602+0x20
+
+// M_QUANTIZATION_MODIFIED + M_ALL_BAND               2603L
+#define M_QUANTIZATION_MODIFIED                       2604L
+// M_QUANTIZATION_MODIFIED + M_RED                    2612L // 2604+0x08
+// M_QUANTIZATION_MODIFIED + M_GREEN                  2620L // 2604+0x10
+// M_QUANTIZATION_MODIFIED + M_BLUE                   2636L // 2604+0x20
+
+// M_PRECINCT_SIZE_X + M_ALL_BAND                     2605L
+#define M_PRECINCT_SIZE_X                             2606L
+// M_PRECINCT_SIZE_X + M_RED                          2614L // 2606+0x08
+// M_PRECINCT_SIZE_X + M_GREEN                        2622L // 2606+0x10
+// M_PRECINCT_SIZE_X + M_BLUE                         2638L // 2606+0x20
+
+// M_PRECINCT_SIZE_Y + M_ALL_BAND                     2639L
+#define M_PRECINCT_SIZE_Y                             2640L
+// M_PRECINCT_SIZE_Y + M_RED                          2648L // 2640+0x08
+// M_PRECINCT_SIZE_Y + M_GREEN                        2656L // 2640+0x10
+// M_PRECINCT_SIZE_Y + M_BLUE                         2672L // 2640+0x20
+
+// M_QUANTIZATION_STYLE + M_ALL_BAND                  2641L
+#define M_QUANTIZATION_STYLE                          2642L
+// M_QUANTIZATION_STYLE + M_RED                       2650L // 2642+0x08
+// M_QUANTIZATION_STYLE + M_GREEN                     2658L // 2642+0x10
+// M_QUANTIZATION_STYLE + M_BLUE                      2674L // 2642+0x20
+
+#define M_RLE_BUFFER_TYPE                             2675L
+
+#define M_SOURCE_OFFSET_X                             4024L
+#define M_SOURCE_OFFSET_Y                             4025L
+
+#define M_MODIFIED                                    4096L  //bitwise value 0x00001000
+
+#define M_PARENT_OFFSET_X                             5003L
+#define M_PARENT_OFFSET_Y                             5004L
+#define M_ANCESTOR_OFFSET_X                           5005L
+#define M_ANCESTOR_OFFSET_Y                           5006L
+#define M_PARENT_OFFSET_BAND                          5007L
+#define M_ANCESTOR_OFFSET_BAND                        5008L
+#define M_NB_CHILD                                    5009L
+#define M_MODIFICATION_COUNT                          5010L
+#define M_ANCESTOR_SIZE_X                             5012L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_BUFFER_INFO_OLD                             5028L
+#endif
+#if MIL_COMPILE_VERSION < 1040
+#define M_SOURCE_INDEX                                5029L
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_SOURCE_INDEX                                0L
+#endif
+#define M_ANCESTOR_OFFSET_BIT                         5038L
+#define M_DIB_MODE                                    M_DIB_METHOD // 0x0007C000
+#define M_FLIP_MODE                                   5040L
+#define M_COMPRESSION_TYPE                            5045L
+#define M_PREDICTOR                                   5052L // Buffer M_COMPRESS Jpeg
+#define M_Q_FACTOR_LUMINANCE                          5056L // Buffer M_COMPRESS Jpeg
+#define M_Q_FACTOR_CHROMINANCE                        5057L // Buffer M_COMPRESS Jpeg
+#define M_RESTART_INTERVAL                            5059L // Buffer M_COMPRESS Jpeg
+#define M_SIZE_BYTE                                   5061L
+#define M_INTERNAL_COMPRESSION_BUFFER_ID              5063L
+#define M_INTERNAL_BUFFER_HOST_ADDRESS                5064L
+#define M_INTERNAL_JPEG_FRAME_SIZEBYTE                5065L
+#define M_INTERNAL_COMPRESSION_BUFFER_SIZE_DIVISION_FACTOR  5066L
+#define M_SIZE_BYTE_FIRST_FIELD                       5067L
+#define M_SIZE_BYTE_SECOND_FIELD                      5068L
+#define M_JPEG_COMPRESS                               5069L // Buffer M_COMPRESS Jpeg
+#define M_JPEG_DECOMPRESS                             5070L // Buffer M_COMPRESS Jpeg
+#define M_PARSE_JPEG_DATA                             5072L
+#define M_PARSE_JPEG2000_DATA                         M_PARSE_JPEG_DATA
+#define M_PARSE_MPEG4_DATA                            M_PARSE_JPEG_DATA
+#define M_PARSE_H264_DATA                             M_PARSE_JPEG_DATA
+#define M_PARSE_COMPRESSED_DATA                       M_PARSE_JPEG_DATA
+#define M_TARGET_SIZE                                 5074L // Set internal compression buffer size in byte
+#define M_ATTACHED_BUFFER_0_ID                        5076L
+#define M_ATTACHED_BUFFER_1_ID                        5077L
+#define M_ASSOCIATED_VGA_BUFFER_ID                    5078L
+#define M_FIELD_UPDATE_MODE                           5079L
+#define M_YCRCB_RANGE                                 5080L // Obsolete, use M_YCBCR_RANGE with M_YCBCR_SD/M_YCBCR_HD/M_YCBCR_UHD instead.
+#define M_MODIFICATION_HOOK                           5082L
+#define M_FIELD_ORDER                                 5083L
+#define M_YCBCR_RANGE                                 5085L
+#define M_REVERSE_X                                   5087L
+#define M_REVERSE_Y                                   5088L
+#define M_SUBSAMPLE_X                                 5089L
+#define M_SUBSAMPLE_Y                                 5090L
+#define M_SUBSAMPLE                                   5091L
+#define M_BUFFER_DIRECTX_INFO_PTR                     5092L
+#define M_BUFFER_DISPLAY_INFO_PTR                     5093L
+#define M_NUMBER_OF_BUFFERS                           5094L // Used with complex surface
+#define M_GRAB_BUFFERS                                5095L
+#define M_USED_IN_CONTINUOUS_GRAB                     5096L
+#define M_GRAB_TYPE                                   5097L
+#define M_BUF_TRANSPARENT_COLOR                       5098L
+#define M_OFFSET_X                                    5099L
+#define M_OFFSET_Y                                    5100L
+#define M_PFNC_VALUE                                  5101L
+#define M_3D_DISTANCE_UNIT                            5102
+#define M_3D_COORDINATE_SYSTEM_TYPE                   5103
+#define M_3D_REPRESENTATION                           5104
+#define M_3D_INVALID_DATA_FLAG                        5105
+#define M_GENDC_CONTAINER_DESCRIPTOR_POINTER          5109
+#define M_3D_PROPERTIES_DEFAULT                       5110
+#define M_HAS_CUSTOM_COMPONENT_TYPE_NAME              5111
+#define M_LAYOUT_MODIFICATION_COUNT                   5112
+#define M_COMPONENT_TIME_STAMP_IS_PTP                 5113
+
+#define M_HOOK_TO_BUFFER_MODIFICATIONS                5201L
+// free for reuse                                     5202L
+// free for reuse                                     5204L
+#define M_HOST_ADDRESS_BAND                           5205L
+/* Reserve next 16 values               from          5206L*/
+/*                                      to            5221L*/
+#define M_PHYS_ADDRESS_BAND                           5222L
+/* Reserve next 16 values               from          5223L*/
+/*                                      to            5237L*/
+#define M_GRAB_BUFFERS_AFTER_SET_SCHEME               5238L
+/* Free                                               5239L*/
+#define M_NB_CHILD_SELECTED_ON_DISPLAY                5240L
+#define M_UNSUPPORTED_FORMAT                          5241L
+#define M_PREFERRED_DIGITIZER_FORMAT                  5242L
+#define M_RESET_ASSOCIATED_LUT                        5243L
+//Free                                                5244L
+/* Reserve next 16 values               from          5245L*/
+/*                                      to            5259L*/
+/*Free                                  from          5260L*/
+/*                                      to            5275L*/
+#define M_GRAB_BUFFERS_AFTER_SET_SCHEME_NO_LOCK       5276
+#define M_GRAB_BUFFERS_USED                           5277L
+#define M_ALPHA_VALUE                                 5278L
+#define M_BGRX_ALPHA_VALUE                            M_ALPHA_VALUE
+#define M_BUFFER_INFO_COPY                            5279L
+#define M_BUFFER_INFO                                 5280L
+#define M_PFNC_SIZE_BIT                               5282L
+#define M_PFNC_SUPPORT                                5283L
+#define M_STORAGE_SIZE                                5284L
+
+#define M_IS_NO_MAP                                   5300L
+#define M_CRYPTOGRAPHY                                5301L
+#define M_CRYPTO                                      M_CRYPTOGRAPHY
+#define M_COMPONENT_REGION_OFFSET_X                   5302L
+#define M_COMPONENT_REGION_OFFSET_Y                   5303L
+
+
+
+#define M_BUF_INQUIRE_SIZEOF_INT64_START              6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+
+#define M_PHYSICAL_ADDRESS_ON_BOARD                   6700L
+#define M_64BIT_PHYSICAL_ADDRESS_REMOTE               6701L
+#define M_EXTENDED_FORMAT                             6702L
+#define M_EXTENDED_ATTRIBUTE                          6703L
+//#define M_PHYSICAL_ADDRESS_ON_BOARD+M_RED             6708L
+//#define M_PHYSICAL_ADDRESS_ON_BOARD+M_BLUE            6716L
+//#define M_PHYSICAL_ADDRESS_ON_BOARD+M_GREEN           6732L
+
+#define M_64BIT_PHYSICAL_ADDRESS_BAND_REMOTE          6733L
+/* Reserve next 16 values               from          6733L*/
+/*                                      to            6749L*/
+#define M_64BIT_PHYSICAL_ADDRESS_BAND                 6750L
+/* Reserve next 16 values               from          6751L*/
+/*                                      to            6765L*/
+
+#define M_DATA_INFO_TYPE                              6766L
+#if MIL_COMPILE_VERSION < 1040
+#define M_COMPONENT_ID_VALUE                          6767L
+#endif
+#define M_COMPONENT_TYPE                              6768L
+#define M_COMPONENT_GROUP_ID                          6769L
+#define M_COMPONENT_SOURCE_ID                         6770L
+#define M_COMPONENT_REGION_ID                         6771L
+#define M_GRAB_TIME_STAMP_NS                          6772L
+#define M_CAMERA_TIME_STAMP_NS                        6773L
+#define M_COMPONENT_TIME_STAMP_NS                     6774L
+
+
+#define M_BUF_INQUIRE_SIZEOF_INT64_END                6799L
+
+/************************************************************************/
+/* Values for M_COMPONENT_TYPE                                          */
+/************************************************************************/
+#define M_COMPONENT_UNDEFINED          0
+#define M_COMPONENT_INTENSITY          1
+#define M_COMPONENT_INFRARED           2
+#define M_COMPONENT_ULTRAVIOLET        3
+#define M_COMPONENT_RANGE              4
+#define M_COMPONENT_REFLECTANCE        5
+#define M_COMPONENT_CONFIDENCE         6
+#define M_COMPONENT_SCATTER            7
+#define M_COMPONENT_DISPARITY          8
+#define M_COMPONENT_MULTISPECTRAL      9
+#define M_COMPONENT_METADATA           0x8001
+#define M_COMPONENT_CUSTOM             0xFF00
+#define M_COMPONENT_MESH_MIL           0x01000001
+#define M_COMPONENT_NORMALS_MIL        0x01000002
+#define M_COMPONENT_METADATA_DA        0x01000003
+#define M_COMPONENT_ALL                MAKE_INT64(0x0000100000000000)
+
+
+
+/************************************************************************/
+/* Values for M_3D_DISTANCE_UNIT                                        */
+/************************************************************************/
+#define M_MILLIMETER                           2450L
+#define M_INCH                                 2454L
+#define M_PIXEL                               0x1000L
+
+/************************************************************************/
+/* Values for M_3D_COORDINATE_SYSTEM_TYPE                               */
+/************************************************************************/
+#define  M_CARTESIAN                                        2717L
+#define  M_SPHERICAL                                        2716L
+#define  M_CYLINDRICAL                                      2718L
+
+/************************************************************************/
+/* Values for M_3D_REPRESENTATION                                       */
+/************************************************************************/
+#define  M_UNCALIBRATED_Z                                   50
+#define  M_CALIBRATED_XYZ                                   51
+#define  M_CALIBRATED_XYZ_UNORGANIZED                       52
+#define  M_CALIBRATED_XZ_UNIFORM_Y                          53
+#define  M_CALIBRATED_XZ_EXTERNAL_Y                         54
+#define  M_CALIBRATED_Z                                     55
+#define  M_CALIBRATED_Z_EXTERNAL_Y                          56
+#define  M_CALIBRATED_Z_UNIFORM_XY                          57
+#define  M_CALIBRATED_Z_UNIFORM_X_EXTERNAL_Y                58
+#define  M_DISPARITY                                        59
+#define  M_DISPARITY_EXTERNAL_Y                             60
+#define  M_DISPARITY_UNIFORM_Y                              61
+
+
+#define M_BUF_INQUIRE_UNKNOWN_SIZEOF_START            6800L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 6800-6899
+#define M_REGION_STREAM                               6801L
+#define M_BUF_INQUIRE_UNKNOWN_SIZEOF_END              6899L
+
+#define M_BUF_INQUIRE_STRING_START                    6900L
+
+#define M_EXTENDED_FORMAT_NAME                   ((M_BUF_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING)
+#define M_EXTENDED_ATTRIBUTE_NAME                ((M_BUF_INQUIRE_STRING_START+1)|M_CLIENT_ENCODING)
+#define M_COMPONENT_TYPE_NAME                    ((M_BUF_INQUIRE_STRING_START+2)|M_CLIENT_ENCODING)
+#define M_PFNC_NAME                              ((M_BUF_INQUIRE_STRING_START+3)|M_CLIENT_ENCODING)
+#define M_COMPONENT_REGION_NAME                  ((M_BUF_INQUIRE_STRING_START+4)|M_CLIENT_ENCODING)
+#define M_COMPONENT_SOURCE_NAME                  ((M_BUF_INQUIRE_STRING_START+5)|M_CLIENT_ENCODING)
+
+
+#define M_BUF_INQUIRE_STRING_END                      6999L
+
+// M_FORMAT is not a string when used with MbufInquire but the define
+// is shared with MdispInquire and MdigInquire
+#define M_FORMAT                                      (7701L|M_CLIENT_ENCODING)
+
+// Flags related to JPEG2000.
+
+/* Reserve next 9 values                from          8193L */
+/*                                      to            8201L */
+
+#define M_OPERATION_MODE                              8203L
+
+#define M_REGULAR                                     0x00020000L /* already defined elsewhere in mil.h */
+#define M_PRECISE                                     0x00040000L
+
+#define M_DEFAULT_QUANTIZATION_TABLE                  8204L
+
+#define M_LEGACY                                      1L
+#define M_STANDARD                                    2L
+
+#define M_USER_DATA_SIZE                              8205L
+
+// Note : also used in JPEG.
+#define M_ALLOCATE_MEMORY                             8206L
+#define M_SHRINK_MEMORY                               8207L
+#define M_ALLOCATED_SIZE_BYTE                         8208L
+#define M_COMPRESSED_DATA_SIZE_BYTE                   8209L
+#define M_COMPRESSION_PLATFORM                        8202L
+
+#define M_CODESTREAM_FORMAT                           8210L
+
+#define M_RAW_FORMAT                                  0L
+#define M_JP2_FORMAT                                  2L
+
+#define M_BATCH_COUNT                                 8211L
+#define M_BATCH_FLAGS                                 8212L
+#define M_BATCH_INQUIRE                               8213L
+#define M_PROGRESSION_ORDER                           8214L
+
+#define M_LAYER_RES_COMP_POS                          0L
+#define M_RES_LAYER_COMP_POS                          1L
+#define M_RES_POS_COMP_LAYER                          2L
+#define M_POS_COMP_RES_LAYER                          3L
+#define M_COMP_POS_RES_LAYER                          4L
+
+#define M_IMAGE_OFFSET_X                              8215L
+#define M_IMAGE_OFFSET_Y                              8216L
+#define M_TILE_OFFSET_X                               8217L
+#define M_TILE_OFFSET_Y                               8218L
+#define M_TILE_SIZE_X                                 8219L
+#define M_TILE_SIZE_Y                                 8220L
+#define M_SOP_MARKERS                                 8221L
+#define M_EPH_MARKERS                                 8222L
+
+#define M_CODESTREAM_OFFSET                           8223L
+#define M_CODESTREAM_SIZE                             8224L
+
+//Mpeg4 related inquire
+#define M_FRAME_TYPE                                  8225L
+#define M_ASSOCIATED_STREAM                           8226L
+
+#define M_LOCKABLE                                    8255
+
+#define M_LOCK_TYPE                                   8452
+#define M_FLAGS                                       8453
+
+#define M_IS_LOCKED                                   8454
+
+#define M_READ                                        1
+#define M_WRITE                                       2
+#define M_LOCK_ACCESS_MASK                            (M_READ|M_WRITE)
+
+// DirectX Lock Types
+#define M_RT_GPU_ACCESS                               0x00000004L
+#define M_HOST_ACCESS                                 0x00000008L
+#define M_GPU_ACCESS                                  0x00000010L
+
+#define M_DMA_ACCESS                                  0x00000020L
+/* Following bitwise values are reserved for future DirectX Lock Types
+                                                      0x00000040L
+                                                      0x00000080L
+                                                      0x00000100L
+                                                      0x00000200L
+                                                      0x00000400L
+                                                      0x00000800L */
+#define M_LOCK_TYPE_MASK                              0x00000FFCL
+
+#define M_LOCK_UNLOCK_MASK                            (M_LOCK_TYPE_MASK|M_LOCK_ACCESS_MASK)
+
+// Display reserved area
+#define M_BUF_DISPLAY_START                           9000L
+#define M_IS_IN_DISPLAY_BUF_RANGE(X)                  ((X>=M_BUF_DISPLAY_START) && (X<=M_BUF_DISPLAY_END))
+#define M_DC_ALLOC                                    (M_BUF_DISPLAY_START+0L)   // 9000
+#define M_DC_FREE                                     (M_BUF_DISPLAY_START+1L)   // 9001
+#define M_DC_HANDLE                                   (M_BUF_DISPLAY_START+2L)   // 9002
+#define M_XPIXMAP_ALLOC                               M_DC_ALLOC
+#define M_XPIXMAP_FREE                                M_DC_FREE
+#define M_XPIXMAP_HANDLE                              M_DC_HANDLE 
+#define M_ENHANCE_FORMAT                              (M_BUF_DISPLAY_START+3L)   // 9003
+// available                                          (M_BUF_DISPLAY_START+4L)   // 9004
+// available                                          (M_BUF_DISPLAY_START+5L)   // 9005
+#define M_MTX0_CAPABLE_DIRECTX_OWNER                  (M_BUF_DISPLAY_START+6L)   // 9006
+// available                                          (M_BUF_DISPLAY_START+7L)   // 9007
+#define M_ENHANCE_FROM_ID                             (M_BUF_DISPLAY_START+8L)   // 9008
+#define M_ENHANCE_MAX_DISPLAY_FORMAT                  (M_BUF_DISPLAY_START+9L)   // 9009
+#define M_VIDEO_SYSTEM_ID                             (M_BUF_DISPLAY_START+10L)  // 9010
+#define M_NEXT_FREE_BUFFER                            (M_BUF_DISPLAY_START+11L)  // 9011
+#define M_OLDEST_READY_BUFFER                         (M_BUF_DISPLAY_START+12L)  // 9012
+#define M_WAIT_ON_BUFFER_FREED                        (M_BUF_DISPLAY_START+13L)  // 9013
+#define M_ENHANCE_SYSTEM_CREATE                       (M_BUF_DISPLAY_START+14L)  // 9014
+#define M_ENHANCE_GRAB_CREATE                         (M_BUF_DISPLAY_START+15L)  // 9015
+#define M_FREE_ENHANCED_BUFFER                        (M_BUF_DISPLAY_START+16L)  // 9016
+#define M_ENHANCED_BUFFER                             (M_BUF_DISPLAY_START+17L)  // 9017
+#define M_INVALID_RECT                                (M_BUF_DISPLAY_START+18L)  // 9018
+#define M_VALID_RECT                                  (M_BUF_DISPLAY_START+19L)  // 9019
+#define M_BITMAPINFO                                  (M_BUF_DISPLAY_START+26L)  // 9026
+// available                                          (M_BUF_DISPLAY_START+28L)  // 9028
+#define M_DIB_HANDLE                                  (M_BUF_DISPLAY_START+31L)  // 9031 // Also in MdispInquire section, don't change the value
+#define M_DC_FREE_NO_MODIFIED_CHECK                   (M_BUF_DISPLAY_START+32L)  // 9032
+// available                                          (M_BUF_DISPLAY_START+34L)  // 9034
+#define M_DIRECTX_SURFACE_MAPPED                      (M_BUF_DISPLAY_START+35L)  // 9035
+#define M_DIRECTX_SURFACE_MAPPABLE                    (M_BUF_DISPLAY_START+36L)  // 9036
+// available                                          (M_BUF_DISPLAY_START+37L)  // 9037
+#define M_UNENHANCE_FORMAT                            (M_BUF_DISPLAY_START+41L)  // 9041
+// available                                          (M_BUF_DISPLAY_START+42L)  // 9042
+#define M_EXTERNAL_BUFFER_ID                          (M_BUF_DISPLAY_START+43L)  // 9043
+#define M_EXTERNAL_LL_MD_ID                           (M_BUF_DISPLAY_START+44L)  // 9044
+#define M_RESTORE_VIDEO_MEMORY                        (M_BUF_DISPLAY_START+45L)  // 9045
+#define M_XVIDEO_ADAPTOR_INDEX                        (M_BUF_DISPLAY_START+46L)  // 9046
+#define M_SET_GDI_PALETTE_FROM_LUT                    (M_BUF_DISPLAY_START+47L)  // 9047
+// available                                          (M_BUF_DISPLAY_START+48L)  // 9048
+// ...
+// available                                          (M_BUF_DISPLAY_START+193L) // 9193
+//////////////MAXIMAL VALUE///////////////////////////////////////////////+193L  // 9193
+#define M_BUF_DISPLAY_END                             (M_BUF_DISPLAY_START+193L) // 9193
+
+
+// 
+// Reserved value for M_SIZE_BYTE + M_FAST            13253L // 5061L + 0x2000
+
+
+// DirectX reserved area for BufControl/BufInquire
+#if M_MIL_USE_DIRECTX_SERVICE
+#define M_BUF_DIRECTX_START                           14000L
+#define M_IS_IN_DIRECTX_BUF_RANGE(X)                  ((X>=M_BUF_DIRECTX_START) && (X<=M_BUF_DIRECTX_END))
+
+#define M_REAL_HOST_ADDRESS                           (M_BUF_DIRECTX_START+2L)   // 14002
+// reserved 14004 to 14014 for future general DirectX BufControl/BufInquire
+
+#define M_DDRAW_SURFACE                               (M_BUF_DIRECTX_START+15L)  // 14015
+#define M_DDRAW7_HANDLE                               M_DDRAW_SURFACE
+// reserved 14018 to 14019 for future DDraw BufControl/BufInquire
+
+#define M_D3D9_HANDLE                                 (M_BUF_DIRECTX_START+20L)  // 14020
+#define M_D3D9_SURFACE                                (M_BUF_DIRECTX_START+21L)  // 14021
+#define M_D3D9_TEXTURE                                (M_BUF_DIRECTX_START+22L)  // 14022
+#define M_D3D9_SURFACE_RT                             (M_BUF_DIRECTX_START+27L)  // 14027
+#define M_D3D9_SURFACE_LK                             (M_BUF_DIRECTX_START+28L)  // 14028
+#define M_D3D9_TEXTURE_LK                             (M_BUF_DIRECTX_START+29L)  // 14029
+// reserved 14032 to 14039 for future D3D9 BufControl/BufInquire
+
+#define M_D3D10_HANDLE                                (M_BUF_DIRECTX_START+40L)  // 14040
+#define M_D3D10_TEXTURE                               (M_BUF_DIRECTX_START+41L)  // 14041
+#define M_D3D10_TEXTURE_LK                            (M_BUF_DIRECTX_START+44L)  // 14044
+// reserved 14046 to 14059 for future D3D10 BufControl/BufInquire
+
+#define M_D3D11_HANDLE                                (M_BUF_DIRECTX_START+60L)  // 14060
+#define M_D3D11_TEXTURE                               (M_BUF_DIRECTX_START+61L)  // 14061
+#define M_D3D11_TEXTURE_LK                            (M_BUF_DIRECTX_START+64L)  // 14064
+#define M_D3D11_BUFFER                                (M_BUF_DIRECTX_START+66L)  // 14066
+#define M_D3D11_BUFFER_LK                             (M_BUF_DIRECTX_START+67L)  // 14067
+// reserved 14068 to 14079 for future D3D11 BufControl/BufInquire
+
+// available
+// ...
+// available                                          (M_BUF_DIRECTX_START+999L) // 14999
+//////////////MAXIMAL VALUE///////////////////////////////////////////////+999L  // 14999
+#define M_BUF_DIRECTX_END                             (M_BUF_DIRECTX_START+999L) // 14999
+#endif
+
+// MTXDMA reserved area
+#define M_BUF_MTXDMA_START                            16384L
+#define M_WRITE_COMBINING                             16384L // Must be bitwise
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_BUFFER_AGP_CAPABLE                          16387L
+#endif
+#define M_BUFFER_KERNEL_MAP                           16388L
+// Reserved 16390 to 16434 for other MTXDMA controls
+#define M_BUF_MTXDMA_END                              16434L
+
+
+#define M_BUF_DX_LOCK_UNLOCK_START                    20480L
+#define M_LOCK                                        20480L   // 0x00005000
+/*Reserved next 0xfff (4095) for other bitwise flags*/
+#define M_UNLOCK                                      24576L   // 0x00006000
+/*Reserved next 0xfff (4095) for other bitwise flags*/
+#define M_LOCK_TRY                                    28672L   // 0x00007000
+/*Reserved next 0xfff (4095) for other bitwise flags*/
+#define M_BUF_DX_LOCK_UNLOCK_END                      32767L
+
+#define M_NO_QUANTIZATION                             0L
+#define M_SCALAR_IMPLICIT                             1L
+#define M_SCALAR_EXPLICIT                             2L
+
+#define M_HOST_ADDRESS                                0x00010000L
+#define M_HOST_ADDRESS_RED                            M_HOST_ADDRESS + M_RED    // 0x00010008L
+#define M_HOST_ADDRESS_GREEN                          M_HOST_ADDRESS + M_GREEN  // 0x00010010L
+#define M_HOST_ADDRESS_BLUE                           M_HOST_ADDRESS + M_BLUE   // 0x00010020L
+#define M_HOST_ADDRESS_REMOTE                         0x00080000L
+#define M_HOST_ADDRESS_REMOTE_RED                     M_HOST_ADDRESS_REMOTE + M_RED    // 0x00080008L
+#define M_HOST_ADDRESS_REMOTE_GREEN                   M_HOST_ADDRESS_REMOTE + M_GREEN  // 0x00080010L
+#define M_HOST_ADDRESS_REMOTE_BLUE                    M_HOST_ADDRESS_REMOTE + M_BLUE   // 0x00080020L
+#define M_PHYSICAL_ADDRESS                            0x40000000L
+#define M_PHYSICAL_ADDRESS_RED                        M_PHYSICAL_ADDRESS + M_RED    // 0x40000008L
+#define M_PHYSICAL_ADDRESS_GREEN                      M_PHYSICAL_ADDRESS + M_GREEN  // 0x40000010L
+#define M_PHYSICAL_ADDRESS_BLUE                       M_PHYSICAL_ADDRESS + M_BLUE   // 0x40000020L
+
+#define M_SIZE_X                                      1536L // 0x600
+#define M_SIZE_X_RED                                  M_SIZE_X + M_RED     // 1544L or 0x608
+#define M_SIZE_X_GREEN                                M_SIZE_X + M_GREEN   // 1552L or 0x610
+#define M_SIZE_X_BLUE                                 M_SIZE_X + M_BLUE    // 1568L or 0x620
+
+#define M_SIZE_Y                                      1537L // 0x601
+#define M_SIZE_Y_RED                                  M_SIZE_Y + M_RED     // 1545L or 0x609
+#define M_SIZE_Y_GREEN                                M_SIZE_Y + M_GREEN   // 1553L or 0x611
+#define M_SIZE_Y_BLUE                                 M_SIZE_Y + M_BLUE    // 1569L or 0x621
+
+// 0x00008000L Reserved for M_ALLOCATION_OVERSCAN that is MsysControl\Inquire type and as buffer attribute.
+#define M_ALLOCATION_OVERSCAN_SIZE                    0x00008001L
+#define M_PHYSICAL_ADDRESS                            0x40000000L
+#define M_PITCH                                       0x20000000L
+#define M_DEFAULT                                     0x10000000L
+#define M_PITCH_BYTE                                  0x08000000L
+
+// MbufControl and MbufInquire double range start
+#define M_BUF_INQUIRE_DOUBLE_RANGE_START              0x02000000L // M_MIN
+#define M_MIN                                         0x02000000L
+#define M_COMPONENT_TIME_STAMP                        0x02000001L
+#define M_3D_SCALE_X                                  0x02000002L
+#define M_3D_SCALE_Y                                  0x02000003L
+#define M_3D_SCALE_Z                                  0x02000004L
+#define M_3D_OFFSET_X                                 0x02000005L
+#define M_3D_OFFSET_Y                                 0x02000006L
+#define M_3D_OFFSET_Z                                 0x02000007L
+#define M_3D_INVALID_DATA_VALUE                       0x02000008L
+#define M_3D_DISPARITY_FOCAL_LENGTH                   0x02000009L
+#define M_3D_DISPARITY_BASELINE                       0x0200000AL
+#define M_3D_DISPARITY_PRINCIPAL_POINT_X              0x0200000BL
+#define M_3D_DISPARITY_PRINCIPAL_POINT_Y              0x0200000CL
+#define M_3D_SHEAR_X                                  0x02000011L
+#define M_3D_SHEAR_Z                                  0x02000012L
+#define M_CAMERA_TIME_STAMP                           0x02000013L
+
+#define M_MAX                                         0x04000000L
+#define M_BUF_INQUIRE_DOUBLE_RANGE_END                0x04000000L // M_MAX
+// MbufControl and MbufInquire double range end
+
+// !!! MAP FOR OLD DEFINES
+#if OldDefinesSupport
+#define M_DMA_READ_HOST_ID                            M_HOST_ID
+MIL_DEPRECATED(M_DMA_READ_HOST_ID, 1000)
+#define M_BUF_ASSOCIATED_BUFFER_ID                    5016L
+MIL_DEPRECATED(M_BUF_ASSOCIATED_BUFFER_ID, 1000)
+#if M_MIL_USE_DIRECTX_SERVICE
+#define M_WINDOW_DDRAW_SURFACE                        M_DDRAW_SURFACE
+MIL_DEPRECATED(M_WINDOW_DDRAW_SURFACE, 1000)
+#endif
+#define M_WINDOW_DC_ALLOC                             M_DC_ALLOC
+MIL_DEPRECATED(M_WINDOW_DC_ALLOC, 1000)
+#define M_WINDOW_DC_FREE                              M_DC_FREE
+MIL_DEPRECATED(M_WINDOW_DC_FREE, 1000)
+#define M_WINDOW_DC                                   M_DC_HANDLE
+MIL_DEPRECATED(M_WINDOW_DC, 1000)
+#define M_FILTER                                      M_FILTER_TYPE
+MIL_DEPRECATED(M_FILTER, 1000)
+#endif
+
+#define M_COMPONENT_ADD                               0x00040000
+#define M_COMPONENT_LIST                              0x00100000
+#define M_COMPONENT_ID_LIST                           M_COMPONENT_LIST
+#define M_COMPONENT_GROUP_ID_LIST                     0x00200000
+#define M_COMPONENT_REGION_ID_LIST                    0x00600000
+#define M_COMPONENT_TYPE_LIST                         0x00800000
+#define M_COMPONENT_SOURCE_ID_LIST                    0x00C00000
+#define M_FREE_WITH_CONTAINER                         0x00200000
+
+#define M_ARRAY_ID_MASK                               0x000FFFFF
+#define M_ARRAY_ID_SIZE(N)                            (N & M_ARRAY_ID_MASK)
+
+#define M_IS_BUINQ_CONT_ID_ARRAY(X)                   ((X) == M_COMPONENT_LIST)
+
+#if M_MIL_USE_64BIT
+#define M_IS_BUINQ_CONT_INT64_ARRAY(X)                (((X) == M_COMPONENT_LIST) || \
+                                                       ((X) == M_COMPONENT_GROUP_ID_LIST) ||  \
+                                                       ((X) == M_COMPONENT_SOURCE_ID_LIST) || \
+                                                       ((X) == M_COMPONENT_REGION_ID_LIST) || \
+                                                       ((X) == M_COMPONENT_TYPE_LIST))
+#else
+#define M_IS_BUINQ_CONT_INT64_ARRAY(X)                (((X) == M_COMPONENT_GROUP_ID_LIST)  || \
+                                                       ((X) == M_COMPONENT_SOURCE_ID_LIST) || \
+                                                       ((X) == M_COMPONENT_REGION_ID_LIST) || \
+                                                       ((X) == M_COMPONENT_TYPE_LIST))
+#endif
+
+
+
+#if MIL_COMPILE_VERSION < 1040
+#define M_COMPONENT_ID_BY_INDEX_FLAG                  0x00200000
+#define M_COMPONENT_ID_BY_INDEX(N)                    (M_COMPONENT_ID_BY_INDEX_FLAG | M_ARRAY_ID_SIZE(N))
+#endif
+
+#define M_COMPONENT_BY_MASK                          MAKE_INT64(0x7800000000000000)
+#define M_COMPONENT_BY_INDEX_FLAG                    MAKE_INT64(0x1000000000000000)
+#define M_COMPONENT_BY_ID_FLAG                       MAKE_INT64(0x2000000000000000)
+#define M_COMPONENT_BY_GROUP_ID_FLAG                 MAKE_INT64(0x3000000000000000)
+#define M_COMPONENT_BY_REGION_ID_FLAG                MAKE_INT64(0x4000000000000000)
+#define M_COMPONENT_BY_SOURCE_ID_FLAG                MAKE_INT64(0x5000000000000000)
+
+#define M_COMPONENT_BY_INDEX(N)                      (M_COMPONENT_BY_INDEX_FLAG | (N))
+#define M_COMPONENT_BY_ID(N)                         (M_COMPONENT_BY_ID_FLAG    | (N))
+#define M_COMPONENT_BY_GROUP_ID(N)                   (M_COMPONENT_BY_GROUP_ID_FLAG  | (N))
+#define M_COMPONENT_BY_REGION_ID(N)                  (M_COMPONENT_BY_REGION_ID_FLAG | (N))
+#define M_COMPONENT_BY_SOURCE_ID(N)                  (M_COMPONENT_BY_SOURCE_ID_FLAG | (N))
+
+#define M_COMPONENT_EXTRACT_VALUE(N)                  ((N) & ~M_COMPONENT_BY_MASK)
+#define M_COMPONENT_EXTRACT_FLAG(N)                   ((N) & M_COMPONENT_BY_MASK)
+
+
+
+/************************************************************************/
+/* MbufControl() MbufInquire() Values                                   */
+/************************************************************************/
+#define M_MAX_INTERNAL_BUFFERS                        8L
+#define M_MAX_NB_GRAB_BUFFERS                         8L
+
+#define M_MEGABUFFER_GRAB                    0x08000000L
+
+#define M_ODD_FIELD                                   1L
+#define M_EVEN_FIELD                                  2L
+#define M_BOTH_FIELDS                                 3L
+#define M_NO_HOOK                            0x00000004L
+#define M_GRAB_TYPE_PSEUDO                            5L
+#define M_GRAB_TYPE_LIVE                              6L
+#define M_GRAB_TYPE_PSEUDO_MULTIPLE_BUFFERS           7L
+#define M_GRAB_TYPE_NO_TEARING                        8L
+#define M_GRAB_TYPE_ENCODER                           9L
+#define M_GRAB_TYPE_PSEUDO_SINGLE_BUFFER              10L
+#define M_GRAB_FORCE_IN_USER_BUFFER                   11L
+#define M_GRAB_FORCE_WITHOUT_UNDERLAY                 12L
+#define M_UNCONDITIONAL                               0L
+
+#define M_CONDITIONAL                                 1L
+
+#define M_INVALID                                     -1
+#define M_DEFAULT                            0x10000000L
+
+#define  M_YCBCR_SD                                   1L
+#define  M_YCBCR_HD                                   2L
+#define  M_YCBCR_UHD                                  3L
+
+#define M_MPEG_P_FRAME                                0L
+#define M_MPEG_I_FRAME                                1L
+#define M_MPEG_B_FRAME                                2L
+
+#define M_ODD_EVEN                                    1L
+#define M_EVEN_ODD                                    2L
+
+#define M_INCREMENT_ASYNC                             1L
+#define M_DECREMENT_ASYNC                             2L
+#define M_INTERNAL_THREAD_CALL               0x00000004L
+
+#define M_LUT_REPLICATE_2X                            1L
+#define M_LUT_REPLICATE_4X                            2L
+#define M_LUT_ADDRESS_ZOOM_2X                         3L
+#define M_WARP_TILE                                   4L
+#define M_STREAM_COPY                                 5L
+
+#define M_NONE                               0x08000000L // Also defined in milcal.h, milcolor.h
+#define M_VECTOR                                   1411L
+#define M_RASTER                                   1416L
+#define M_VECTOR_AND_RASTER                        1417L
+
+// Used for M_SPPD_PEAK_MODE
+#define M_SPPD_STRONGEST                           0L
+#define M_SPPD_FIRST                               1L
+#define M_SPPD_SECOND                              2L
+#define M_SPPD_THIRD                               3L
+
+// M_SPPD_OUTPUT_FORMAT:
+#define M_SPPD                                     0L
+#define M_DATA_REDUCTION                           1L
+
+
+#define M_PROCESSABLE                                28L
+#define M_NOT_PROCESSABLE                            29L
+#define M_DISPLAYABLE                                30L
+#define M_DISPLAYABLE_WITH_CONVERSION                31L 
+#define M_NOT_DISPLAYABLE                            32L
+#define M_CONVERTIBLE                                33L
+#define M_CONVERTIBLE_WITH_COMPENSATION              34L 
+#define M_NOT_CONVERTIBLE                            35L
+/************************************************************************/
+/* MbufControlRegion() ControlTypes                                     */
+/************************************************************************/
+#define M_MODIFIED                                 4096L  //bitwise value 0x00001000
+
+
+#define M_GRAB_TIME_STAMP                    0x00000040L
+#define M_ALWAYS_SYNCHRONOUS                 0x40000000L
+#define M_MODIFIED_WITH_ERROR                0x20000000L
+#define M_DRIVER_ASYNC_CALL_CANCELLED        0x10000000L
+#define M_DRIVER_ASYNC_CALL_END              0x08000000L
+#define M_DRIVER_RESET_HOOK_CONTEXT_ID       0x04000000L
+#define M_MODIFIED_DIGITIZER                 0x02000000L
+#define M_MODIFIED_DIGITIZER_WITH_ERROR      0x01000000L
+#define M_MODIFIED_DIGITIZER_CORRUPT         0x00800000L
+#define M_MODIFIED_BY_DIRECTX                      5400L
+
+/************************************************************************/
+/* MbufControlRegion() ControlValues                                    */
+/************************************************************************/
+
+#define M_NO_HOOK                            0x00000004L
+#define M_NO_MODIFIED_HOOK                   0x00000008L
+
+#define M_ODD_FIELD                                   1L
+#define M_EVEN_FIELD                                  2L
+#define M_BOTH_FIELDS                                 3L
+#define M_ANY_FIELD                                   4L
+
+/************************************************************************/
+/* MbufSetRegion()                                                      */
+/************************************************************************/
+#define M_NO_RASTERIZE                                1L
+#define M_DELETE                                      3L
+#define M_RASTERIZE_AND_DISCARD_LIST               1414L
+#define M_RASTERIZE                                1415L
+#define M_LINK_TO_PARENT                           1774L
+#define M_COPY                               0x00020000L
+#define M_MERGE                              0x00000040L
+#define M_EXTRACT                            0x00040000L
+
+/* Combination flag */
+#define M_FILL_REGION                        0x00080000L
+
+/************************************************************************/
+/* MbufDiskInquire()                                                    */
+/************************************************************************/
+#define M_LUT_PRESENT                                 6000L
+#define M_ASPECT_RATIO                                6001L
+#define M_FRAME_RATE                                  6002L
+#define M_NUMBER_OF_IMAGES                            6003L
+#define M_CALIBRATION_PRESENT                         1400L
+#define M_CALIBRATION_CONTEXT_PRESENT                 1401L
+#define M_REGION_PRESENT                              1461L
+
+/* Common with other Inquire/Control */
+#define M_ABSOLUTE_VALUE                              50L
+#define M_NORMALIZATION_FACTOR                        52L
+#define M_OVERSCAN                                    53L
+#define M_OVERSCAN_REPLACE_VALUE                      54L
+#define M_OFFSET_CENTER_X                             55L
+#define M_OFFSET_CENTER_Y                             56L
+#define M_SIZE_X                                      1536L // 0x600
+#define M_SIZE_Y                                      1537L // 0x601
+#define M_SIZE_BAND                                   1005L
+#define M_SIZE_BIT                                    1007L
+#define M_TYPE                                        1008L
+#define M_ATTRIBUTE                                   1013L
+#define M_SIGN                                        1014L
+#define M_GREEN                                       0x10L
+#define M_SATURATION                                  0x2000L
+
+#define M_FILE_FORMAT                                 1015L
+#define M_IS_VIDEO_FILE_FORMAT(x) (((x) == M_AVI_MIL) || \
+                                   ((x) == M_AVI_DIB) || \
+                                   ((x) == M_AVI_MJPG) || \
+                                   ((x) == M_AVI_MPG4) || \
+                                   ((x) == M_AVI_H264) || \
+                                   ((x) == M_AVI_CODEC))
+#define M_IS_IMAGE_FILE_FORMAT(x) (((x) == M_BMP) || \
+                                   ((x) == M_JPEG_LOSSLESS) || \
+                                   ((x) == M_JPEG_LOSSY) || \
+                                   ((x) == M_JPEG_LOSSLESS_INTERLACED) || \
+                                   ((x) == M_JPEG_LOSSY_INTERLACED) || \
+                                   ((x) == M_JPEG2000_LOSSY) || \
+                                   ((x) == M_JPEG2000_LOSSLESS) || \
+                                   ((x) == M_TIFF) || \
+                                   (M_TIFF_IS_COMPRESSED(x)) || \
+                                   ((x) == M_MIL_TIFF) || \
+                                   ((x) == M_PNG))
+#define M_IS_3DMODEL_FILE_FORMAT(x) (((x) == M_PLY_ASCII) || \
+                                   ((x) == M_PLY_BINARY_LITTLE_ENDIAN) || \
+                                   ((x) == M_STL_ASCII) || \
+                                   ((x) == M_STL_BINARY))
+
+#define M_LUT                                         0x00040000L
+// Reserved M_SIZE_X+M_LUT                            0x00040600L or 263680L
+
+/************************************************************************/
+/* Lattice values                                                       */
+/************************************************************************/
+#define M_4_CONNECTED                                 0x00000010L
+#define M_8_CONNECTED                                 0x00000020L
+
+/************************************************************************/
+/* Data types for results                                               */
+/************************************************************************/
+
+#define M_TYPE_COMMAND                                0x00008000L       // used in drivers (gigevision)
+#define M_TYPE_MIL_DOUBLE                             M_TYPE_DOUBLE
+#define M_TYPE_MIL_FLOAT                              M_TYPE_FLOAT
+#define M_TYPE_INT64                                  M_TYPE_MIL_INT64
+#define M_TYPE_PTR                                    0x00200000L       // used in mil (MappGetHookInfo), in drivers and in dmil
+#define M_TYPE_STRING_PTR                             M_TYPE_STRING     // used in mil, dmil, drivers
+#define M_TYPE_BOOLEAN                                0x01000000L       // used in drivers (gigevision)
+#define M_TYPE_FILENAME                               0x08000000L       // used in mil (MappGetHookInfo)
+#define M_TYPE_ARRAY_ID_PTR                           0x10000000L       // used in mil (MappGetHookInfo)
+#define M_TYPE_ENUMERATION                            0x40000000L       // see M_TYPE_INTEGER_ENUMERATION and M_TYPE_STRING_ENUMERATION
+#define M_TYPE_UINT8                                  M_TYPE_MIL_UINT8
+#define M_TYPE_REGISTER                               MAKE_INT64(0x0000000080000000)
+#define M_TYPE_VALUE                                  0x00004000L
+#if OldDefinesSupport
+#define M_TYPE_INTEGER_ENUMERATION                    M_TYPE_ENUMERATION + M_TYPE_MIL_INT32 // used indirectly in mil, drivers (gigevision)
+#define M_TYPE_STRING_ENUMERATION                     M_TYPE_ENUMERATION + M_TYPE_STRING    // used indirectly in mil, drivers (gigevision)
+#define M_TYPE_ENUMERATION_FROM_STRING                M_TYPE_ENUMERATION + M_TYPE_STRING    // used indirectly in mil, drivers (gigevision)
+#define M_TYPE_REGISTER_FROM_STRING                   M_TYPE_REGISTER + M_TYPE_STRING
+#define M_TYPE_VALUE_FROM_STRING                      M_TYPE_VALUE + M_TYPE_STRING
+MIL_DEPRECATED(M_TYPE_INTEGER_ENUMERATION, 1000)      // New Control Feature API Replaced by M_TYPE_ENUMERATION as FeatrureType, UserVarPtr must be a pointer to a MIL_INT64
+MIL_DEPRECATED(M_TYPE_STRING_ENUMERATION, 1000)       // New Control Feature API Replaced by M_TYPE_ENUMERATION as FeatrureType and M_FEATURE_VALUE_AS_STRING as ControlType, UserVarPtr must be an array of MIL_TEXT_CHAR
+MIL_DEPRECATED(M_TYPE_ENUMERATION_FROM_STRING, 1000)  // New Control Feature API Replaced by M_TYPE_ENUMERATION as FeatrureType and M_FEATURE_VALUE_AS_STRING as ControlType, UserVarPtr must be an array of MIL_TEXT_CHAR
+MIL_DEPRECATED(M_TYPE_REGISTER_FROM_STRING, 1000)     // New Control Feature API Replaced by M_TYPE_REGISTER as FeatrureType and M_FEATURE_VALUE_AS_STRING as ControlType, UserVarPtr must be an array of MIL_TEXT_CHAR
+MIL_DEPRECATED(M_TYPE_VALUE_FROM_STRING, 1000)        // New Control Feature API Replaced by M_DEFAULT as FeatrureType and M_FEATURE_VALUE_AS_STRING as ControlType, UserVarPtr must be an array of MIL_TEXT_CHAR
+#endif
+
+#define M_TYPE_CATEGORY                               0x00002000L
+
+#define M_MAX_BYTE_COUNT                              0x00007FFCL  //Maximum payload of a M_TYPE_REGISTER.
+
+#if OldDefinesSupport
+#define M_BYTE_COUNT(n)                               (n)  //Used in combination with M_TYPE_REGISTER for GigE Vision
+MIL_DEPRECATED(M_BYTE_COUNT, 1060)        // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE() as combination constant to M_TYPE_UINT8 (previously known as M_TYPE_REGISTER) or M_TYPE_STRING
+#endif
+
+#if M_MIL_USE_64BIT
+   #define M_TYPE_MIL_INT                             M_TYPE_MIL_INT64
+#else
+   #define M_TYPE_MIL_INT                             M_TYPE_MIL_INT32
+#endif
+#if M_MIL_USE_LINUX && M_MIL_USE_64BIT
+   #define M_TYPE_LONG                                M_TYPE_MIL_INT64
+#else
+   #define M_TYPE_LONG                                M_TYPE_MIL_INT32
+#endif
+
+
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL)) || M_MIL_USE_LINUX
+#define M_TYPE_TEXT_CHAR                              M_TYPE_CHAR
+#else
+#define M_TYPE_TEXT_CHAR                              M_TYPE_MIL_TEXT
+#endif
+
+/************************************************************************/
+/* Data types for inquiring parameters type                             */
+/************************************************************************/
+
+#define M_PARAM_TYPE_CONST                   0x10000000
+#define M_PARAM_TYPE_POINTER                 0x08000000
+#define M_PARAM_TYPE_FILENAME                0x04000000
+#define M_PARAM_TYPE_UNICODE                 0x02000000
+#define M_PARAM_TYPE_ASCII                   0x01000000
+
+#define M_FIRST_PARAM_TYPE                   1
+#define M_PARAM_TYPE_MIL_INT                 1
+#define M_PARAM_TYPE_MIL_UINT                2
+#define M_PARAM_TYPE_MIL_DOUBLE              3
+#define M_PARAM_TYPE_MIL_ID                  4
+#define M_PARAM_TYPE_MIL_INT32               5
+#define M_PARAM_TYPE_MIL_UINT32              6
+#define M_PARAM_TYPE_MIL_INT64               7
+#define M_PARAM_TYPE_MIL_UINT64              8
+#define M_PARAM_TYPE_VOID                    9
+#define M_PARAM_TYPE_CHAR                   10
+#define M_PARAM_TYPE_MIL_FLOAT              11
+#define M_PARAM_TYPE_MIL_INT8               12
+#define M_PARAM_TYPE_MIL_UINT8              13
+#define M_PARAM_TYPE_MIL_INT16              14
+#define M_PARAM_TYPE_MIL_UINT16             15
+#define M_PARAM_TYPE_MIL_CHAR               16  // for array of MIL_TEXT_CHAR
+#define M_PARAM_TYPE_MIL_UUID               17
+#define M_LAST_PARAM_TYPE                   17 // Always equal to the
+                                               // last parameter type value
+
+
+#define M_PARAM_TYPE_ARRAY_MIL_INT           (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT   )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT          (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT  )
+#define M_PARAM_TYPE_ARRAY_MIL_UUID          (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UUID  )
+#define M_PARAM_TYPE_ARRAY_MIL_DOUBLE        (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_DOUBLE)
+#define M_PARAM_TYPE_ARRAY_MIL_FLOAT         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_FLOAT )
+#define M_PARAM_TYPE_ARRAY_MIL_ID            (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_ID    )
+#define M_PARAM_TYPE_ARRAY_MIL_INT8          (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT8  )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT8         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT8 )
+#define M_PARAM_TYPE_ARRAY_MIL_INT16         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT16 )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT16        (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT16)
+#define M_PARAM_TYPE_ARRAY_MIL_INT32         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT32 )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT32        (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT32)
+#define M_PARAM_TYPE_ARRAY_MIL_INT64         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT64 )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT64        (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT64)
+
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT           (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT    | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT   | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UUID          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UUID   | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_DOUBLE        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_DOUBLE | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_FLOAT         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_FLOAT  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_ID            (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_ID     | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT8          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT8   | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT8         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT8  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT16         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT16  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT16        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT16 | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT32         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT32  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT32        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT32 | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT64         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT64  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT64        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT64 | M_PARAM_TYPE_CONST)
+
+#define M_PARAM_TYPE_ARRAY_MIL_CHAR                (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR)                           // only for API usage
+#define M_PARAM_TYPE_ARRAY_MIL_CHAR_ASCII          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_ASCII)
+#define M_PARAM_TYPE_ARRAY_MIL_CHAR_UNICODE        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_UNICODE)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_CHAR          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_CONST)      // only for API usage
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_CHAR_ASCII    (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_CONST | M_PARAM_TYPE_ASCII)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_CHAR_UNICODE  (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_CONST | M_PARAM_TYPE_UNICODE)
+
+#define M_PARAM_TYPE_MIL_TEXT                (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR)                           // only for API usage
+#define M_PARAM_TYPE_DATA_PTR                (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_VOID)
+#define M_PARAM_TYPE_MIL_TEXT_UNICODE        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR  | M_PARAM_TYPE_UNICODE)
+#define M_PARAM_TYPE_MIL_TEXT_ASCII          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR  | M_PARAM_TYPE_ASCII)
+#define M_PARAM_TYPE_CONST_MIL_TEXT          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CONST | M_PARAM_TYPE_CHAR)                           // only for API usage
+#define M_PARAM_TYPE_CONST_DATA_PTR          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CONST | M_PARAM_TYPE_VOID)
+#define M_PARAM_TYPE_CONST_MIL_TEXT_UNICODE  (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CONST | M_PARAM_TYPE_CHAR | M_PARAM_TYPE_UNICODE)
+#define M_PARAM_TYPE_CONST_MIL_TEXT_ASCII    (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CONST | M_PARAM_TYPE_CHAR | M_PARAM_TYPE_ASCII)
+#define M_PARAM_TYPE_FILENAME_UNICODE        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR  | M_PARAM_TYPE_UNICODE | M_PARAM_TYPE_FILENAME)
+#define M_PARAM_TYPE_FILENAME_ASCII          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR  | M_PARAM_TYPE_ASCII   | M_PARAM_TYPE_FILENAME)
+
+
+/* Bit encoded image types */
+#define M_GREYSCALE                                   0x0200L
+#define M_GRAYSCALE                                   M_GREYSCALE
+
+/************************************************************************/
+/* MseqAlloc()                                                          */
+/************************************************************************/
+
+#define M_FOURCC_CODE(c0)  ((MIL_UINT32)c0)
+#define M_MAKEFOURCC_CODE(c0, c1, c2, c3)  ((MIL_UINT32) (unsigned char) (c0) | \
+                                    ((MIL_UINT32) (unsigned char) (c1) << 8) | \
+                                    ((MIL_UINT32) (unsigned char) (c2) << 16) | \
+                                    ((MIL_UINT32) (unsigned char) (c3) << 24))
+
+
+// Actions for Mseq Module
+#define M_SEQ_COMPRESS              1L
+#define M_SEQ_DECOMPRESS            2L
+#define M_SEQ_ENCAPSULATION         4L    // unsupported but probably useful
+
+
+#define MSEQSYSTEMS(x)              (x<<8)
+#define MSEQSYSTEMS_MASK            MSEQSYSTEMS(0x000F)
+#define M_QSV                       MSEQSYSTEMS(1L)
+#define M_CLARITY_UHD_H264          MSEQSYSTEMS(2L)
+// 15 system types reserved MSEQSYSTEMES(1 - 15)
+
+/************************************************************************/
+/* MseqDefine()                                                         */
+/************************************************************************/
+// Seq Container types 0 reserved for invalid
+#define M_CONTEXT                0x08000000L // already defined elsewhere
+#define M_PIPE                   23L
+#define M_BUFFER_LIST            24L
+#define M_FILE                   25L         // already defined elsewhere
+#define M_USER_HOOK              26L
+#define M_USER_FEED              27L
+
+#define M_FILE_FORMAT_TYPE(X)          ((X<<5)|M_CLIENT_ENCODING)
+
+#define M_FILE_FORMAT_MASK             M_FILE_FORMAT_TYPE(0x0FFFF)
+#define M_FILE_FORMAT_AVI              M_FILE_FORMAT_TYPE(1)
+#define M_FILE_FORMAT_MP4              M_FILE_FORMAT_TYPE(3)
+#define M_FILE_FORMAT_H264             M_FILE_FORMAT_TYPE(4)
+#define M_FILE_FORMAT_MPEGTS           M_FILE_FORMAT_TYPE(5)
+#define M_FILE_FORMAT_RAW              M_FILE_FORMAT_TYPE(6)
+
+
+#define M_SEQ_CONTAINER_SOURCE         (2L << 16)
+#define M_SEQ_CONTAINER_DESTINATION    (1L << 16)
+#define M_SEQ_CONTAINER_MAX_COUNT      32L
+#define M_SEQ_CONTAINER_MASK           0x0000001F
+#define M_EXTRACT_SEQ_CONTAINER_INDEX(x)   (x & M_SEQ_CONTAINER_MASK)
+
+#define M_SEQ_CONTAINER_OUTPUT         (1L << 22)
+#define M_SEQ_CONTAINER_IO_MAX_COUNT   16L
+#define M_SEQ_CONTAINER_IO_MASK        (0x0F << 18)
+#define M_EXTRACT_SEQ_CONTAINER_IO_INDEX(x)  ((x&M_SEQ_CONTAINER_SOURCE)? (M_EXTRACT_SEQ_CONTAINER_INDEX(x)) : ((x & M_SEQ_CONTAINER_IO_MASK) >> 18))
+
+#define M_SEQ_SRC(_x_)                 (M_SEQ_CONTAINER_SOURCE | _x_)
+#define M_SEQ_DEST(_x_)                (M_SEQ_CONTAINER_DESTINATION | _x_)
+
+#define M_SEQ_INPUT(_x_)               M_SEQ_SRC(_x_)
+#define M_SEQ_OUTPUT(_x_)              (M_SEQ_CONTAINER_OUTPUT | (_x_ << 18))
+
+#define M_SEQ_FILE_MODE_MASK           (M_READ | M_WRITE)
+
+#define M_BUFFER_RELEASE                              1066L
+
+/************************************************************************/
+/* MseqInquire()                                                        */
+/************************************************************************/
+#define M_EFFECTIVE_VALUE                             0x01000000
+#define M_TYPE                                        1008L
+#define M_FILE_FORMAT                                 1015L
+#define M_STREAM_FILE_NAME                           (3904L | M_CLIENT_ENCODING) // 0x00000F40
+#if OldDefinesSupport
+#define M_STREAM_FILE_NAME_SIZE                       (M_STRING_SIZE + M_STREAM_FILE_NAME)
+MIL_DEPRECATED(M_STREAM_FILE_NAME_SIZE, 1040)
+#endif
+#define M_STREAM_FILE_MODE                            1068L
+#define M_BUFFER_COUNT                                1069L
+
+#define M_BUFFER_SAMPLE                               1070L
+
+#define M_SIZE_X                                      1536L // already defined elsewhere
+#define M_SIZE_Y                                      1537L // already defined elsewhere
+
+
+#define M_CODEC_TYPE                                  1540L
+
+#define M_SETTING_AUTO_ADJUSTMENT                     1541L
+#define M_STREAM_FRAME_RATE_MODE                      1542L
+#define M_CONTEXT_VALID                               1543L
+
+#define M_STREAM_BIT_RATE_MODE                        3328L // already defined elsewhere
+#define M_STREAM_BIT_RATE                             3392L // already defined elsewhere
+#define M_STREAM_QUALITY                              3520L // already defined elsewhere
+#define M_STREAM_BIT_RATE_MAX                         3584L // already defined elsewhere
+#define M_STREAM_GROUP_OF_PICTURE_SIZE                3648L // already defined elsewhere
+#define M_STREAM_FRAME_RATE                           3712L // already defined elsewhere
+#define M_STREAM_ENCODING_MODE                        3840L // already defined elsewhere
+#define M_STREAM_PROFILE                              4032L // already defined elsewhere
+#define M_STREAM_LEVEL                                4096L // already defined elsewhere
+#define M_STREAM_GROUP_OF_PICTURE_TYPE                4160L // already defined elsewhere
+#define M_STREAM_GROUP_OF_PICTURE_P_SIZE              4224L // already defined elsewhere
+#define M_STREAM_GROUP_OF_PICTURE_I_SIZE              4288L // already defined elsewhere
+
+#define M_SEQ_CONTAINER_INQUIRE_SIZEOF_INT64_START    6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+
+#define M_SEQ_CONTAINER_INQUIRE_SIZEOF_INT64_END      6799L
+
+
+
+// MseqInquire() / MseqControl() values
+#define M_PROFILE_BASELINE                            102L // already defined elsewhere
+#define M_PROFILE_MAIN                                103L // already defined elsewhere
+#define M_PROFILE_HIGH                                104L // already defined elsewhere
+
+#define M_LEVEL_1                                     100L
+#define M_LEVEL_1B                                    102L
+#define M_LEVEL_1_1                                   110L
+#define M_LEVEL_1_2                                   120L
+#define M_LEVEL_1_3                                   130L
+#define M_LEVEL_2                                     200L
+#define M_LEVEL_2_1                                   210L
+#define M_LEVEL_2_2                                   220L
+#define M_LEVEL_3                                     300L
+#define M_LEVEL_3_1                                   310L
+#define M_LEVEL_3_2                                   320L
+#define M_LEVEL_4                                     400L
+#define M_LEVEL_4_1                                   410L
+#define M_LEVEL_4_2                                   420L
+#define M_LEVEL_5                                     500L
+#define M_LEVEL_5_1                                   510L
+#define M_LEVEL_5_2                                   520L
+
+/************************************************************************/
+/* MseqHookFunction()                                                   */
+/************************************************************************/
+#define M_FRAME_END                                   0x0000000aL // already defined elsewhere
+#define M_SEQUENCE_END                                0x0000000bL
+
+/************************************************************************/
+/* MgraAlloc()                                                           */
+/************************************************************************/
+#define M_DEFAULT_GRAPHIC_CONTEXT                     M_MAKE_DEFAULT_ID(2)
+
+/************************************************************************/
+/* MgraAllocList()                                                      */
+/************************************************************************/
+#define M_DRAW_LIST                             1022L
+
+/************************************************************************/
+/* MgraDots()                                                           */
+/************************************************************************/
+#define M_PACKED_X_Y_ANGLE                            0x00080000L
+
+/************************************************************************/
+/* MgraLines()                                                          */
+/************************************************************************/
+#define M_LINE_LIST                                   0x00000010L
+#define M_POLYLINE                                    0x00000020L
+#define M_POLYGON                                     0x00000040L
+#define M_FILLED                                      0x00000080L
+#define M_PACKED                                      0x00020000L
+#define M_INFINITE_LINES                              0x00000100L
+#define M_INFINITE_LINES_A_B_C                        0x00000200L
+
+/************************************************************************/
+/* MgraRectAngle                                                        */
+/************************************************************************/
+#define M_CORNER_AND_DIMENSION                        0x00000001L
+#define M_CENTER_AND_DIMENSION                        0x00000002L
+#define M_BOTH_CORNERS                                0x00000004L
+#define M_FILLED                                      0x00000080L
+
+/************************************************************************/
+/* MgraArcAngle                                                         */
+/************************************************************************/
+#define M_CONTOUR                                          0x800L
+#define M_SECTOR                                      0x00000300L
+
+#define M_FILLED                                      0x00000080L
+
+/************************************************************************/
+/* MgraImage                                                            */
+/************************************************************************/
+#define M_DRAW_REGION                                 0x00000010L
+#define M_NO_ERROR_ON_MISSING_CALIBRATION             0x00000020L
+#define M_DRAW_ERROR_ON_MISSING_CALIBRATION           0x00000040L
+#define M_DRAW_FOREGROUND_ON_NON_ZERO_PIXELS          0x00000080L
+#define M_DRAW_FOREGROUND_ON_ZERO_PIXELS              0x00000100L
+
+/************************************************************************/
+/* MgraFont()                                                           */
+/************************************************************************/
+#define M_FONT_DEFAULT_SMALL                          1L
+#define M_FONT_DEFAULT_MEDIUM                         2L
+#define M_FONT_DEFAULT_LARGE                          3L
+#define M_FONT_DEFAULT                                M_FONT_DEFAULT_SMALL
+#define M_FONT_TTF                                    4L
+
+#define MIL_FONT_NAME(name)                          ((MIL_ADDR )(name))
+/* Using TrueType Font */
+#define M_FONT_DEFAULT_TTF                            MIL_TEXT("MILFont")
+#define M_TTF_FONT_DEFAULT_SIZE                       12L //12pt
+
+/************************************************************************/
+/* Used by MgraControl() / MgraInquire() / MgraControlList() / MgraInquireList() Types */
+/************************************************************************/
+
+/* Index modifiers for list */
+#define M_DEFAULT                                     0x10000000L
+#define M_LIST                                        0x08000000L
+#define M_ALL                                         0x40000000L
+
+#define M_GRAPHIC_INDEX_TAG                           0x01000000L
+#define M_GRAPHIC_INDEX(a)                            (M_GRAPHIC_INDEX_TAG + (a))
+#define M_GRAPHIC_LABEL_TAG                           0x02000000L
+#define M_GRAPHIC_LABEL(a)                            (M_GRAPHIC_LABEL_TAG + (a))
+
+#define M_NO_LABEL                                    0x20000000L   // Also defined in milmod.h
+#define M_MULTIPLE_LABELS                             0x30000000L
+
+/* ControlType, InquireType applicable to graphic contexts and graphic lists */
+
+
+#define M_COLOR                                       0x00000100L // 256L
+// Reserved values with M_COLOR
+// M_COLOR+M_RED                                      264L  // 0x00000108L
+// M_COLOR+M_GREEN                                    272L  // 0x00000110L
+// M_COLOR+M_BLUE                                     288L  // 0x00000120L
+
+#define M_BACKCOLOR                                   0x00000200L // 512L
+// Reserved values with M_BACKCOLOR
+// M_BACKCOLOR+M_RED                                  520L  // 0x00000208L
+// M_BACKCOLOR+M_GREEN                                528L  // 0x00000210L
+// M_BACKCOLOR+M_BLUE                                 544L  // 0x00000220L
+#define M_BACK_COLOR                                  M_BACKCOLOR
+
+#define M_SELECTED_COLOR                              0x00000300L // 768L
+// Reserved values with M_SELECTED_COLOR
+// M_SELECTED_COLOR+M_RED                             776L  // 0x00000308L
+// M_SELECTED_COLOR+M_GREEN                           784L  // 0x00000310L
+// M_SELECTED_COLOR+M_BLUE                            800L  // 0x00000320L
+
+#define M_INTERACTIVE_ANNOTATIONS_COLOR               0x00000400L // 1024L
+// Reserved values with M_INTERACTIVE_ANNOTATIONS_COLOR
+// M_INTERACTIVE_ANNOTATIONS_COLOR+M_RED              1032L // 0x00000408L
+// M_INTERACTIVE_ANNOTATIONS_COLOR+M_GREEN            1040L // 0x00000410L
+// M_INTERACTIVE_ANNOTATIONS_COLOR+M_BLUE             1056L // 0x00000420L
+
+#define M_FONT                                        (7L | M_CLIENT_ENCODING)
+#define M_FONT_X_SCALE                                8L
+#define M_FONT_Y_SCALE                                9L
+#define M_BACKGROUND_MODE                             12L
+#define M_RGB_COLOR_MODE                              13L
+
+
+#define M_SELECTABLE                                  50L
+#define M_RESIZABLE                                   51L
+#define M_ROTATABLE                                   52L
+#define M_TRANSLATABLE                                53L
+#define M_TEXT_ALIGN_HORIZONTAL                       58L
+#define M_TEXT_ALIGN_VERTICAL                         71L
+#define M_GRAPHIC_SELECTED                            75L
+#define M_INPUT_UNITS                                 121L        // Also defined in milcal.h, milmeas.h
+#define M_FILLED                                      0x00000080L // 128L
+#define M_OWNER_SYSTEM_TYPE                           1023L
+
+#define M_GRA_INQUIRE_MIL_ID_RANGE_START              1100L
+#define M_OWNER_SYSTEM                                1101L
+#define M_GRAPHIC_SOURCE_CALIBRATION                  1113L
+#define M_GRA_INQUIRE_MIL_ID_RANGE_END                1199L
+
+#if OldDefinesSupport
+   #define M_DRAW_RELATIVE_ORIGIN_X                    319L // deprecated : Use MgraControl(... M_DRAW_OFFSET_X...)
+   #define M_DRAW_RELATIVE_ORIGIN_Y                    320L // deprecated : Use MgraControl(... M_DRAW_OFFSET_Y...)
+   #define M_DRAW_SCALE_X                             3203L // deprecated : Use MgraControl(... M_DRAW_ZOOM_X ...)
+   #define M_DRAW_SCALE_Y                             3204L // deprecated : Use MgraControl(... M_DRAW_ZOOM_Y ...)
+   #define M_MOVABLE                                  M_TRANSLATABLE // deprecated : Use M_TRANSLATABLE
+
+   MIL_DEPRECATED(M_DRAW_RELATIVE_ORIGIN_X, 1010)           
+   MIL_DEPRECATED(M_DRAW_RELATIVE_ORIGIN_Y, 1010)           
+   MIL_DEPRECATED(M_DRAW_SCALE_X, 1010)                     
+   MIL_DEPRECATED(M_DRAW_SCALE_Y, 1010)                     
+   MIL_DEPRECATED(M_MOVABLE, 1060)
+#endif    
+
+#define M_GRA_INQUIRE_DOUBLE_RANGE_START              1200L
+#define M_DRAW_ZOOM_X                                 1203L
+#define M_DRAW_ZOOM_Y                                 1204L
+#define M_DRAW_OFFSET_X                               1205L
+#define M_DRAW_OFFSET_Y                               1206L
+#define M_RADIUS_X                                    1210L
+#define M_RADIUS_Y                                    1211L
+#define M_RECTANGLE_WIDTH                             1212L
+#define M_RECTANGLE_HEIGHT                            1213L
+#define M_SYMBOL_DIMENSION                            1214L
+#define M_INNER_RADIUS_X                              1215L
+#define M_INNER_RADIUS_Y                              1216L
+#define M_OUTER_RADIUS_X                              1217L
+#define M_OUTER_RADIUS_Y                              1218L
+#define M_INNER_TO_OUTER_RADIUS                       2793L
+#define M_OUTER_TO_INNER_RADIUS                       2794L
+#define M_RADII_DIRECTION                             2795L 
+#define M_START_RADIUS_X                              2796L
+#define M_START_RADIUS_Y                              2797L
+#define M_END_RADIUS_X                                2798L
+#define M_END_RADIUS_Y                                2799L
+#define M_SELECTION_RADIUS                            1219L
+#define M_CONSTRAIN_ASPECT_RATIO                      1220L
+#define M_CORNER_X(N)                                (1221L + (N)+ ((N) > 3 ? 2595 : 0))
+#define M_CORNER_Y(N)                                (1225L + (N)+ ((N) > 3 ? 2595 : 0))
+#define M_CORNER_TOP_LEFT_X                           M_CORNER_X(0)
+#define M_CORNER_TOP_RIGHT_X                          M_CORNER_X(1)
+#define M_CORNER_BOTTOM_RIGHT_X                       M_CORNER_X(2)
+#define M_CORNER_BOTTOM_LEFT_X                        M_CORNER_X(3)
+#define M_CORNER_TOP_LEFT_Y                           M_CORNER_Y(0)
+#define M_CORNER_TOP_RIGHT_Y                          M_CORNER_Y(1)
+#define M_CORNER_BOTTOM_RIGHT_Y                       M_CORNER_Y(2)
+#define M_CORNER_BOTTOM_LEFT_Y                        M_CORNER_Y(3)
+#define M_GRA_INQUIRE_DOUBLE_RANGE_END                1299L
+
+#define M_VISIBLE                                     1533L
+#define M_SYMBOL_TYPE                                 1629L
+#define M_SYMBOL_DIMENSION_INPUT_UNITS                1630L
+#define M_LINE_ENDS_DIMENSION_INPUT_UNITS             1639L
+#define M_LINE_ENDS_STYLE                             1640L
+#define M_LINE_ENDS_DIMENSION                         1641L
+#define M_LINE_THICKNESS                              4001L // Also used in M3dgra
+
+#define M_GRAPHIC_CONVERSION_MODE                     1721L
+#define M_ARC_STYLE                                   1722L
+#define M_INTERACTIVITY                               1724L
+#define M_INTERACTIVE_GRAPHIC_STATE                   1746L
+#define M_CALIBRATION                                 1770L
+#define M_FIXTURE                                     1771L
+#define M_EDITABLE                                    1772L
+#define M_SYMBOL_ANGLE_INPUT_UNITS                    1775L
+#define M_SPECIFIC_FEATURES_EDITABLE                  1778L
+#define M_TEXT_BORDER                                 1785L
+#define M_MULTIPLE_SELECTION                          1786L
+#define M_DRAW_DIRECTION                              2767L
+
+#define M_MODE_RESIZE                                 2684L
+#define M_MODE_ROTATE                                 2685L
+#define M_MODE_TRANSLATE                              2686L
+#define M_ANGLE_SNAPPING_VALUE                        2687L
+#define M_MODE_RESIZE_SECONDARY_DIMENSION             2732L
+
+#define M_KEY_SHIFT                             0x00010000  // already defined in mildisplay.h
+#define M_KEY_CTRL                              0x00020000  // already defined in mildisplay.h
+#define M_KEY_ALT                               0x00040000  // already defined in mildisplay.h
+#define M_MODE_RESIZE_SHIFT                           (M_MODE_RESIZE    | M_KEY_SHIFT)
+#define M_MODE_RESIZE_CTRL                            (M_MODE_RESIZE    | M_KEY_CTRL )
+#define M_MODE_RESIZE_ALT                             (M_MODE_RESIZE    | M_KEY_ALT  )
+#define M_MODE_ROTATE_SHIFT                           (M_MODE_ROTATE    | M_KEY_SHIFT)
+#define M_MODE_ROTATE_CTRL                            (M_MODE_ROTATE    | M_KEY_CTRL )
+#define M_MODE_ROTATE_ALT                             (M_MODE_ROTATE    | M_KEY_ALT  )
+#define M_MODE_TRANSLATE_SHIFT                        (M_MODE_TRANSLATE | M_KEY_SHIFT)
+#define M_MODE_TRANSLATE_CTRL                         (M_MODE_TRANSLATE | M_KEY_CTRL )
+#define M_MODE_TRANSLATE_ALT                          (M_MODE_TRANSLATE | M_KEY_ALT  )
+#define M_MODE_RESIZE_SECONDARY_DIMENSION_SHIFT       (M_MODE_RESIZE_SECONDARY_DIMENSION | M_KEY_SHIFT)
+#define M_MODE_RESIZE_SECONDARY_DIMENSION_CTRL        (M_MODE_RESIZE_SECONDARY_DIMENSION | M_KEY_CTRL )
+#define M_MODE_RESIZE_SECONDARY_DIMENSION_ALT         (M_MODE_RESIZE_SECONDARY_DIMENSION | M_KEY_ALT  )
+
+#define M_ACTION_KEYS                                 2746L
+  
+#define M_ACTION_KEY_CANCEL                           2747L
+#define M_ACTION_KEY_DELETE                           2748L
+#define M_ACTION_KEY_RESIZE_HEIGHT_DOWN               2749L
+#define M_ACTION_KEY_RESIZE_HEIGHT_UP                 2750L
+#define M_ACTION_KEY_RESIZE_WIDTH_DOWN                2751L
+#define M_ACTION_KEY_RESIZE_WIDTH_UP                  2752L
+#define M_ACTION_KEY_ROTATE_CLOCKWISE                 2753L
+#define M_ACTION_KEY_ROTATE_COUNTER_CLOCKWISE         2754L
+#define M_ACTION_KEY_TRANSLATE_DOWN                   2755L
+#define M_ACTION_KEY_TRANSLATE_LEFT                   2756L
+#define M_ACTION_KEY_TRANSLATE_RIGHT                  2757L
+#define M_ACTION_KEY_TRANSLATE_UP                     2758L
+
+#define M_ACTION_MODIFIER_SPEED                       2759L
+
+#define M_ACTION_RESIZE_INCREMENT                     2760L
+#define M_ACTION_RESIZE_INCREMENT_ALTERNATE           2761L
+#define M_ACTION_ROTATE_INCREMENT                     2762L
+#define M_ACTION_ROTATE_INCREMENT_ALTERNATE           2763L
+#define M_ACTION_TRANSLATE_INCREMENT                  2764L
+#define M_ACTION_TRANSLATE_INCREMENT_ALTERNATE        2765L
+#define M_ACTION_TRANSLATE_AXES                       2766L
+
+#define M_RESIZE_WIDTH                                2768L
+#define M_RESIZE_HEIGHT                               2769L
+#define M_MULTIPLE_SELECTION_KEY                      2770L
+#define M_EASY_SELECTION                              2771L
+
+#define M_RESHAPE_FROM_POINTS                         M_LOW
+#define M_RESHAPE_FOLLOWING_DISTORTION                M_HIGH
+#define M_PRESERVE_SHAPE_AVERAGE                      1783L
+
+/* Should be in double range, but are already defined elsewhere. */
+#define M_CENTER_X                                       4L
+#define M_CENTER_Y                                       5L
+#define M_POSITION_X                            0x00003400L          
+#define M_POSITION_Y                            0x00004400L   
+#define M_ANGLE                                 0x00000800L
+#define M_ANGLE_START                           0x00000801L
+#define M_ANGLE_END                             0x00000802L
+
+#define M_FONT_SIZE                             0x01000060L
+#define M_TEXT_DIRECTION                        0x01000061L
+#define M_FONT_FILENAME                         0x01000063L // unused
+#define M_FONT_AUTO_SELECT                      0x01000064L
+#define M_SCAN_ALL_FONTS                        0x01000065L
+#define M_FONT_DPI                              0x01000066L
+
+#define M_USE_OS_DPI                            0x01000001L
+
+/* ControlType, InquireType only applicable to list objects */
+
+/* ControlType, InquireType only applicable to attribute context or list */
+#define M_LIST_TYPE                                   201L
+             
+/* ControlType only */
+#define M_DELETE                                      3L   // 3   Also defined in Milblob.h
+
+/* Inquire Types only */
+#define M_GRAPHIC_TYPE                               1518L
+#define M_NUMBER_OF_GRAPHICS                         1519L
+#define M_LAST_LABEL                                 1520L
+#define M_INDEX                                       217L
+#define M_INDEX_VALUE                                 M_INDEX
+#define M_LABEL_VALUE                                   1L
+
+/* Graphic manipulation controls */
+#define M_TRANSLATE_X                         1521L
+#define M_TRANSLATE_Y                         1522L
+#define M_APPLY_SCALE                         1523L
+#define M_ROTATE                                 2L
+#define M_POSITION_TYPE                       1524L
+#define M_SAME_LOCATION                 0x00002000L
+#define M_NUMBER_OF_SUB_ELEMENTS              1525L
+#define M_ADD_POINT                           1745L
+
+/* Control values for M_BACKGROUND_MODE */
+#define M_OPAQUE                                      0x01000058L
+#define M_TRANSPARENT                                 0x01000059L
+
+/* Control values for M_COLOR */
+#define M_RGB_COLOR                                   0x40000000
+#if M_MIL_USE_ARM
+#define M_RGB888(r,g,b) (M_RGB_COLOR | (((MIL_INT32)(char)(r))&0x000000FF) | ((((MIL_INT32)(char)(g))<<8)&0x0000FF00) | ((((MIL_INT32)(char)(b))<<16)&0x00FF0000))
+#else
+#define M_RGB888(r,g,b)                               (M_RGB_COLOR|((MIL_INT32)(((unsigned char)(r)|((MIL_INT32)((unsigned char)(g))<<8))|(((MIL_INT32)(unsigned char)(b))<<16))))
+#endif
+#define M_RGB888_r(color)                             ((MIL_INT32)(color)&0x000000FF)
+#define M_RGB888_g(color)                             (((MIL_INT32)(color)&0x0000FF00)>>8)
+#define M_RGB888_b(color)                             (((MIL_INT32)(color)&0x00FF0000)>>16)
+#define M_IS_RGB888(color)                            (((MIL_INT32)(color)&0xFF000000) == M_RGB_COLOR)
+#if M_MIL_USE_ARM
+#define M_BGR888(b,g,r) (M_RGB_COLOR | (((MIL_INT32)(char)(b))&0x000000FF) | ((((MIL_INT32)(char)(g))<<8)&0x0000FF00) | ((((MIL_INT32)(char)(r))<<16)&0x00FF0000))
+#else
+#define M_BGR888(b,g,r)                               (M_RGB_COLOR|((MIL_INT32)(((unsigned char)(b)|((MIL_INT32)((unsigned char)(g))<<8))|(((MIL_INT32)(unsigned char)(r))<<16))))
+#endif
+#define M_BGR888_b(color)                             ((MIL_INT32)color&0x000000FF)
+#define M_BGR888_g(color)                             (((MIL_INT32)color&0x0000FF00)>>8)
+#define M_BGR888_r(color)                             (((MIL_INT32)color&0x00FF0000)>>16)
+#define M_BGR888_B(color)                              M_BGR888_b(color)
+#define M_BGR888_G(color)                              M_BGR888_g(color)
+#define M_BGR888_R(color)                              M_BGR888_r(color)
+#define M_RGB888_R(color)                              M_RGB888_r(color)
+#define M_RGB888_G(color)                              M_RGB888_g(color)
+#define M_RGB888_B(color)                              M_RGB888_b(color)
+
+/* Control values for M_INPUT_UNITS */
+#define M_DISPLAY                               0x00200000L
+#define M_PIXEL                                     0x1000L
+#define M_WORLD                                     0x2000L
+#define M_SAME_AS_INPUT_UNITS                         1776L
+
+/* Control values for M_TEXT_ALIGN_HORIZONTAL and display positions values */
+#define M_LEFT                                  0x00000100L
+#define M_RIGHT                                 0x00000200L
+
+/* Control values for M_TEXT_ALIGN_VERTICAL and display positions values  */
+#define M_TOP                                   0x00000400L
+#define M_BOTTOM                                0x00000800L
+
+/* Control values for M_SYMBOL_TYPE */
+#define M_CROSS                                 0x00002000L
+#define M_DIRECT_ARROW                              1643L
+#define M_ARROW_HEAD                                1644L
+#define M_PERPENDICULAR_LINE                        1646L
+#define M_FRAME_ORIGIN                              1648L
+#define M_FRAME_REFERENCE_AXIS                      1725L
+#define M_FRAME_AXIS                                1726L
+#define M_CIRCLE                                0x00000008L
+#define M_ANGLE_AT_POSITION                         1787L
+#define M_SQUARE                                0x00000020L
+
+/* Control values for M_LINE_ENDS_STYLE */
+#define M_LINE_ENDS_MASK                        0x0000F000L
+#define M_LINE_ENDS_PLAIN                       0x00001000L
+#define M_LINE_ENDS_H_BOTH_ENDS                 0x00002000L
+#define M_LINE_ENDS_ARROW_A_ON_END              0x00003000L
+#define M_LINE_NEGATIVE_BOX                     0x00004000L
+#define M_LINE_ENDS_CLOSING_ARROWS              0x00005000L
+#define M_LINE_ENDS_OPENING_ARROWS              0x00006000L
+#define M_LINE_ENDS_CIRCLES                     0x00007000L
+
+/* Graphic primitive type */
+#define M_GRAPHIC_TYPE_ARC                          1505L
+#define M_GRAPHIC_TYPE_DOT                          1506L
+#define M_GRAPHIC_TYPE_DOTS                         1507L
+#define M_GRAPHIC_TYPE_LINE                         1508L
+#define M_GRAPHIC_TYPE_LINES                        1509L
+#define M_GRAPHIC_TYPE_POLYGON                      1510L
+#define M_GRAPHIC_TYPE_POLYLINE                     1511L
+#define M_GRAPHIC_TYPE_RECT                         1512L
+#define M_GRAPHIC_TYPE_TEXT                         1513L
+#define M_GRAPHIC_TYPE_RING_SECTOR                  1514L
+#define M_GRAPHIC_TYPE_SYMBOLS                      1633L
+#define M_GRAPHIC_TYPE_INFINITE_LINES               1655L
+#define M_GRAPHIC_TYPE_COLLECTION                   1661L
+
+
+#define M_LEFT_TO_RIGHT                               20L
+#define M_RIGHT_TO_LEFT                               21L
+  
+#define M_PIXEL_TO_WORLD                          1L
+#define M_WORLD_TO_PIXEL                          2L
+
+#define M_Y_AXIS_COUNTER_CLOCKWISE                 0x010L
+
+/* Control values for M_INTERACTIVE_GRAPHIC_STATE, M_INTERACTIVE_GRAPHIC_PREVIOUS_STATE */
+#define M_STATE_IDLE                                1748L
+#define M_STATE_GRAPHIC_HOVERED                     1749L
+#define M_STATE_HANDLE_HOVERED                      1750L
+#define M_STATE_GRAPHIC_DRAGGED                     1751L
+#define M_STATE_HANDLE_DRAGGED                      1752L
+#define M_STATE_WAITING_FOR_CREATION                1753L
+#define M_STATE_BEING_CREATED                       1754L
+
+/* Control values for M_FIXTURE and M_CALIBRATION */
+#define M_USE_SOURCE_FIRST                          1768L
+#define M_USE_DESTINATION_FIRST                     1769L
+
+/* Control values for M_TEXT_BORDER */
+#define M_NONE                                  0x08000000L
+#define M_LEFT                                  0x00000100L
+#define M_RIGHT                                 0x00000200L
+#define M_TOP                                   0x00000400L
+#define M_BOTTOM                                0x00000800L
+
+/* Control values for M_DRAW_DIRECTION */
+#define M_PRIMARY_DIRECTION                     0x00001000L
+#define M_SECONDARY_DIRECTION                   0x00002000L
+#define M_NONE                                  0x08000000L /* also in milstr.h, milcolor.h */
+
+/* Control values for M_MODE_RESIZE* */
+#define M_DISABLE                                  -9999L
+#define M_FIXED_CENTER                              2689L
+#define M_FIXED_CORNER                              2690L
+#define M_FIXED_ASPECT_RATIO                    0x00010000L
+#define M_SQUARE_ASPECT_RATIO                   0x00000008L
+#define M_NO_CONSTRAINT                         0x00020000L
+
+/* Control values for M_MODE_ROTATE* */
+#define M_ANGLE_SNAPPING                            2688L
+#define M_DISABLE                                  -9999L
+#define M_NO_CONSTRAINT                         0x00020000L
+
+/* Control values for M_MODE_TRANSLATE* */
+#define M_AXIS_ALIGNED                          0x00040000
+#define M_DISABLE                                  -9999L
+#define M_NO_CONSTRAINT                         0x00020000L
+
+/* Control values for M_MODE_RESIZE_SECONDARY_DIMENSION* */
+#define M_DISABLE                                  -9999L
+#define M_ONE_SIDED                                 2733L
+#define M_SYMMETRIC                                 2734L
+
+/**************************************************************************/
+/* Used by MgraDraw()                                                     */
+/**************************************************************************/
+#define M_DRAW_IN_CACHE                         600L
+#define M_NO_ERROR_ON_MISSING_CALIBRATION       0x00000020L
+#define M_DRAW_ERROR_ON_MISSING_CALIBRATION     0x00000040L
+#define M_NO_INTERACTIVE_ANNOTATION             0x00001000L
+
+/************************************************************************/
+/* Used by MgraHookFunction                                             */
+/************************************************************************/
+
+#define M_GRAPHIC_SELECTION_MODIFIED            1526L
+#define M_GRAPHIC_MODIFIED                      1527L
+#define M_INTERACTIVE_GRAPHIC_STATE_MODIFIED    1528L
+#define M_GRAPHIC_LIST_MODIFIED                 1529L
+#define M_GRAPHIC_LIST_MODIFIED_INTERNAL        1530L
+
+#define M_UNHOOK                                0x04000000L
+
+/**************************************************************************/
+/* Used by MgraGetBoundingBox()                                           */
+/**************************************************************************/
+#define M_NO_ERROR_ON_MISSING_CALIBRATION       0x00000020L
+#define M_NO_ERROR_ON_EMPTY_LIST                0x00000080L
+#define M_INTEGER_BOUNDING_BOX                  0x00000100L
+
+/**************************************************************************/
+/* Used by MgraProcess()                                                  */
+/**************************************************************************/
+#define M_CONVERT_TO_PIXEL                      1500L
+#define M_CONVERT_TO_WORLD                      1501L
+
+/**************************************************************************/
+/* Used by MgraMessage()                                                  */
+/**************************************************************************/
+#define M_MESSAGE_PROCESSED                     1657L
+#define M_MESSAGE_NOT_PROCESSED                 1658L
+
+/**************************************************************************/
+/* Used by MgraInteractive()                                              */
+/**************************************************************************/
+#define M_GRAPHIC_TYPE_ARC                          1505L
+#define M_GRAPHIC_TYPE_DOT                          1506L
+#define M_GRAPHIC_TYPE_LINE                         1508L
+#define M_GRAPHIC_TYPE_POLYGON                      1510L
+#define M_GRAPHIC_TYPE_POLYLINE                     1511L
+#define M_GRAPHIC_TYPE_RECT                         1512L
+#define M_GRAPHIC_TYPE_RING_SECTOR                  1514L
+#define M_GRAPHIC_TYPE_SYMBOLS                      1633L
+#define M_CANCEL                                    1767L
+#define M_STOP                                0x00000004L
+
+// InitFlag parameter.
+#define M_SQUARE_ASPECT_RATIO                 0x00000008L
+#if OldDefinesSupport
+   #define M_FORCE_ASPECT_RATIO_1                   M_SQUARE_ASPECT_RATIO
+   MIL_DEPRECATED(M_FORCE_ASPECT_RATIO_1, 1060)
+#endif
+#define M_FILLED                              0x00000080L
+#define M_SECTOR                              0x00000300L
+#define M_ROTATE_AROUND_CORNER                0x00000400L
+
+// CreationMode parameter
+#define M_LEGACY_RECT               2725L
+#define M_LEGACY_ELLIPSE            2726L
+#define M_AXIS_ALIGNED_ELLIPSE      2727L
+#define M_ARC_THREE_POINTS          2728L
+#define M_CIRCLE                    0x00000008L
+#define M_AXIS_ALIGNED_RECT         2730L
+#define M_ORIENTED_RECT             2735L
+
+// Defines documented for MdispHookFunction
+#define M_MOUSE_LEFT_BUTTON_DOWN    56L      // also used in mildisplay.h
+#define M_MOUSE_RIGHT_BUTTON_DOWN   57L      // also used in mildisplay.h
+#define M_MOUSE_LEFT_BUTTON_UP      58L      // also used in mildisplay.h
+#define M_MOUSE_RIGHT_BUTTON_UP     59L      // also used in mildisplay.h
+#define M_MOUSE_MOVE                64L      // also used in mildisplay.h
+
+/**************************************************************************/
+/* Used by MgraGetNeighbors()                                             */
+/**************************************************************************/
+
+// LabelOrIndex parameter
+#define M_GRAPHIC_INDEX_TAG                     0x01000000L
+#define M_GRAPHIC_INDEX(a)                      (M_GRAPHIC_INDEX_TAG + (a))
+#define M_GRAPHIC_LABEL_TAG                     0x02000000L
+#define M_GRAPHIC_LABEL(a)                      (M_GRAPHIC_LABEL_TAG + (a))
+#define M_ALL_SELECTED                          0x04000000L
+#define M_ALL                                   0x40000000L
+
+// Units parameter
+#define M_DISPLAY                               0x00200000L
+#define M_PIXEL                                     0x1000L
+#define M_WORLD                                     0x2000L
+
+// Operation parameter
+#define M_POINT_AND_DISTANCE                          1743L
+#define M_RECTANGLE_SELECTION                         1744L
+
+// Combination constants for returned graphic objects identifiers
+#define M_RETURN_INDEX                          0x00004000L
+#define M_RETURN_LABEL                          0x00008000L
+
+// Combination constants for sorting
+#define M_SORT_BY_ASCENDING_DISTANCE            0x00020000L
+#define M_SORT_BY_ASCENDING_INDEX               0x00040000L
+#define M_SORT_BY_DESCENDING_INDEX              0x00060000L
+
+// Combination constants for returned coordinates
+#define M_RETURN_DISTANCE                       0x00100000L
+#define M_RETURN_X                              0x00200000L
+
+/**************************************************************************/
+/* Used by MgraGetGetHookInfo()                                           */
+/**************************************************************************/
+#define M_INTERACTIVE_GRAPHIC_STATE                   1746L
+#define M_GRAPHIC_LIST_ID                             1755L
+#define M_INTERACTIVE_GRAPHIC_PREVIOUS_STATE          1756L
+#define M_GRAPHIC_LABEL_VALUE                         1758L
+#define M_GRAPHIC_LABEL_VALUE_DESELECTED              1759L
+#define M_GRAPHIC_SUB_INDEX                           1760L
+#define M_GRAPHIC_CONTROL_TYPE                        1761L
+
+// Possible return values for M_GRAPHIC_CONTROL_TYPE (other than what is given to MgraControlList)
+#define M_GRAPHIC_LOAD                                1762L
+#define M_GRAPHIC_CREATE                              1763L
+#define M_GRAPHIC_INTERACTIVE                         1764L
+
+/**************************************************************************/
+/* Used by MgraCopy()                                                     */
+/**************************************************************************/
+
+// Operation
+#define M_MOVE                                  0x00010000L     // also in milblob.h
+#define M_COPY                                  0x00020000L     // already defined many times
+
+// Operation's combination flag
+#define M_INDEX_VALUE                               M_INDEX     //217L
+#define M_LABEL_VALUE                                    1L
+
+// InsertLocation
+#define M_GRAPHIC_INDEX_TAG                     0x01000000L
+#define M_GRAPHIC_INDEX(a)                      (M_GRAPHIC_INDEX_TAG + (a))
+#define M_GRAPHIC_LABEL_TAG                     0x02000000L
+#define M_GRAPHIC_LABEL(a)                      (M_GRAPHIC_LABEL_TAG + (a))
+#define M_END_OF_LIST                           0x04000000L
+
+// NumberOfGraObjects
+#define M_ALL                                   0x40000000L
+
+/************************************************************************/
+/* MgraVectors()/MgraVectorsGrid()                                      */
+/************************************************************************/
+#define M_SKIP_NULL_VECTORS                           0x00000001L
+#define M_DRAW_NULL_VECTORS                           0x00000002L
+#define M_FIXED_LENGTH_ARROWHEADS                     0x00000004L
+#define M_PROPORTIONAL_ARROWHEADS                     0x00000008L
+#define M_ABSOLUTE                                             1L // already defined elsewhere
+#define M_AUTO                                               444L // already defined elsewhere
+
+/********************************************************************/
+/* Predefined colors                                                */
+/********************************************************************/
+#define M_COLOR_BLACK                                 M_RGB888(0,0,0)
+#define M_COLOR_RED                                   M_RGB888(255,0,0)
+#define M_COLOR_GREEN                                 M_RGB888(0,255,0)
+#define M_COLOR_BLUE                                  M_RGB888(0,0,255)
+#define M_COLOR_YELLOW                                M_RGB888(255,255,0)
+#define M_COLOR_MAGENTA                               M_RGB888(255,0,255)
+#define M_COLOR_CYAN                                  M_RGB888(0,255,255)
+#define M_COLOR_WHITE                                 M_RGB888(255,255,255)
+#define M_COLOR_GRAY                                  M_RGB888(128,128,128)
+#define M_COLOR_BRIGHT_GRAY                           M_RGB888(192,192,192)
+#define M_COLOR_LIGHT_GRAY                            M_RGB888(160,160,164)
+#define M_COLOR_LIGHT_GREEN                           M_RGB888(192,220,192)
+#define M_COLOR_LIGHT_BLUE                            M_RGB888(166,202,240)
+#define M_COLOR_LIGHT_WHITE                           M_RGB888(255,251,240)
+#define M_COLOR_DARK_RED                              M_RGB888(128,0,0)
+#define M_COLOR_DARK_GREEN                            M_RGB888(0,128,0)
+#define M_COLOR_DARK_BLUE                             M_RGB888(0,0,128)
+#define M_COLOR_DARK_YELLOW                           M_RGB888(128,128,0)
+#define M_COLOR_DARK_MAGENTA                          M_RGB888(128,0,128)
+#define M_COLOR_DARK_CYAN                             M_RGB888(0,128,128)
+
+/* McalTransformCoordinates() related flags */
+#define M_INVALID_POINT                  1.7976931348623158e+308
+#define M_NO_POINTS_BEHIND_CAMERA        0x00040000L
+
+/* McalSet|GetCoordinateSystem(), McalInquire() related flags */
+#define M_RELATIVE_ORIGIN_X                     112L  /* (also defined in milcal.h) */
+#define M_RELATIVE_ORIGIN_Y                     113L  /* (also defined in milcal.h) */
+#define M_RELATIVE_ORIGIN_Z                     114L  /* (also defined in milcal.h) */
+#define M_RELATIVE_ORIGIN_ANGLE                 115L  /* (also defined in milcal.h) */
+#define M_CALIBRATION_STATUS                    159L  /* (also defined in milcal.h) */
+
+#define M_HOMOGENEOUS_MATRIX                      0L  /* (also defined in mil.h) */
+
+#define M_ABSOLUTE_COORDINATE_SYSTEM     0x01000000L  /* (also defined in milcal.h) */
+#define M_RELATIVE_COORDINATE_SYSTEM              0L  /* (also defined in milcal.h) */
+
+
+#define M_TRANSFORM_TYPES_SHIFT                   8L  // =utilities=   (also defined in milcal.h)
+#define M_ASSIGN                                (1 << M_TRANSFORM_TYPES_SHIFT)      /* (also defined in milcal.h) */
+#define M_COMPOSE_WITH_CURRENT                  (2 << M_TRANSFORM_TYPES_SHIFT)      /* (also defined in milcal.h) */
+
+#define M_2D_CALIBRATION                          1L  /* also defined in milcal.h */
+#define M_3D_CALIBRATION                          2L  /* also defined in milcal.h */
+
+#define M_CALIBRATION_CATEGORY                  214L  /* also defined in milcal.h */
+
+/* M_CALIBRATION_STATUS control values */
+#define M_CALIBRATED                      0x0000300L /* also defined in milcal.h, milmod.h */
+
+/* McalFixture() related flags */
+#define M_MOVE_RELATIVE                  0x00010000L /* also defined in milcal.h */
+#define M_SAME_AS_SOURCE                 0x00000070L /* also defined in milcal.h */
+
+/* McalTransformResult() related flags */
+#define M_LENGTH_X                              0x3L /* also defined in milcal.h */
+#define M_LENGTH_Y                              0x4L /* also defined in milcal.h */
+
+/************************************************************************/
+/* MappGetError()                                                       */
+/************************************************************************/
+#define M_NULL_ERROR                                  0L
+#define M_NO_ERROR                                    0L
+
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_CURRENT                                     0x00000002L
+#define M_CURRENT_FCT                                 0x00030000L
+#define M_CURRENT_FCT_FULL                            0x00040000L
+#define M_CURRENT_SUB_NB                              0x00000004L
+#define M_CURRENT_SUB                                 0x00050000L
+#define M_CURRENT_SUB_1                               0x00050000L
+#define M_CURRENT_SUB_2                               0x00060000L
+#define M_CURRENT_SUB_3                               0x00070000L
+#define M_GLOBAL                                      0x00000008L // Also defined in milmeas.h
+#define M_GLOBAL_FCT                                  0x00090000L
+#define M_GLOBAL_SUB_NB                               0x000A0000L
+#define M_GLOBAL_SUB                                  0x000B0000L
+#define M_GLOBAL_SUB_1                                0x000B0000L
+#define M_GLOBAL_SUB_2                                0x000C0000L
+#define M_GLOBAL_SUB_3                                0x000D0000L
+#define M_ERROR_REMOTE                                0x00000010L
+
+
+#define M_INTERNAL                                    0x000E0000L
+#define M_INTERNAL_FCT                                0x000F0000L
+#define M_INTERNAL_SUB_NB                             0x00100000L
+#define M_INTERNAL_SUB                                0x00110000L
+#define M_INTERNAL_SUB_1                              0x00110000L
+#define M_INTERNAL_SUB_2                              0x00120000L
+#define M_INTERNAL_SUB_3                              0x00130000L
+#define M_PARAM_NB                                    0x00140000L
+#define M_FATAL                                       0x00150000L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_CLIENT_ERROR_ASCII_MODE                     0x00000100L
+#endif
+#define M_ERROR_UNUSED_BITS                           0x0AE0FEF0L
+#define M_UNHOOK                                      0x04000000L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL))
+#define M_MESSAGE                                     (0x20000000L|M_CLIENT_ERROR_ASCII_MODE)
+#else
+#define M_MESSAGE                                     0x20000000L
+#endif
+#else
+#define M_MESSAGE                                    (0x20000000L | M_CLIENT_ENCODING)
+#endif
+#define M_ERROR                                       0x40000000L
+#define M_USER                                        0x00000001L
+#define M_NO_REPORT                                   0x00000008L
+
+                                                                  /* Bit field exclusive to M_TRACE  to M_PROCESSING      (3L to 6L) */
+#define M_THREAD_CURRENT                              0x01000000L /*                        M_TRACE_START                       (1L) */
+                                                                  /*                        M_TRACE_END                         (2L) */
+                                                                  /*                        M_ERROR                     (0x40000000) */
+                                                                  /*                        M_MESSAGE                   (0x20000000) */
+                                                                  /*                        M_CURRENT to M_REGION_SIZE_Y (1L to 44L) */
+                                                                  /*                        M_UNHOOK                    (0x04000000) */
+#define M_ERROR_CURRENT                               (M_ERROR|M_CURRENT)
+#define M_ERROR_GLOBAL                                (M_ERROR|M_GLOBAL)
+#define M_ERROR_FATAL                                 (M_ERROR|M_FATAL)
+#define M_ERROR_REMOTE_CURRENT                        (M_ERROR_CURRENT | M_ERROR_REMOTE)
+
+
+/************************************************************************/
+/* MbufLink() Values (Option)                                           */
+/************************************************************************/
+#define M_LINK                                        0x00000001L
+#define M_UNLINK                                      0x00000002L
+#define M_MODIFIED_REGION                                     25L
+#define M_DO_INITIAL_COPY                                     36L
+
+/************************************************************************/
+/* MbufGetHookInfo()  //MbufHookFunction()                              */
+/************************************************************************/
+#define M_BUFFER_ID                                   0x00160000L
+#define M_REGION_OFFSET_X                             0x00410000L
+#define M_REGION_OFFSET_Y                             0x00420000L
+#define M_REGION_SIZE_X                               0x00430000L
+#define M_REGION_SIZE_Y                               0x00480000L
+#define M_OBJECT_ID                                   0x001B0000L
+#define M_FIELD                                       0x001C0000L
+#define M_BAND                                        0x001D0000L
+#define M_DONE_BY_DIRECTX                             0x001E0000L
+#define M_MOVED                                       0x001F0000L
+#define M_USER_DATA_PTR                               0x00000001
+#define M_RESIZED                                     0x00000002L
+
+// Reserve next value for M_BUFFER_INDEX
+// used by MdigGetHookInfo                                    49L
+#define M_GRAB_TIME_STAMP                             0x00000040L //64L
+#define M_EVENT_TYPE                            M_REGION_OFFSET_X
+#define M_PARAM1                                M_REGION_OFFSET_Y
+#define M_PARAM2                                  M_REGION_SIZE_X
+#define M_PARAM3                                  M_REGION_SIZE_Y
+
+
+#define M_TRACE_START                                 1L       // app hook
+#define M_TRACE_END                                   2L       // app hook
+#define M_DMIL_CLIENT_CONNECTED                       4L       // app hook
+#define M_DMIL_CLIENT_DISCONNECTED                    5L       // app hook
+#define M_DMIL_CONNECTION_LOST                        (6L + M_ASYNC_HOOK)       // app hook
+#define M_SLAVE_ERROR_CURRENT                         7L       // app hook
+#define M_SLAVE_ERROR_GLOBAL                          8L       // app hook
+#define M_PRE_GRAB_BUFFER_CHANGE                              10L
+#define M_POST_GRAB_BUFFER_CHANGE                             11L
+#define M_MODIFIED_BUFFER_INTERNAL                            12L
+#define M_LICENSE_SERVER_EVENT                        (14|M_ASYNC_HOOK)       // app hook
+#define M_STATE_MACHINE_PRE_BUFFER_MODIFIED                   15L
+#define M_STATE_MACHINE_POST_BUFFER_MODIFIED                  16L
+#define M_REMOTE_BUFFER_EVENT                                 18L //TBR
+#define M_MODIFIED_BUFFER_ERROR                               19L
+#define M_DX_SURFACE_RESTORED                                 20L
+#define M_MODIFIED_BUFFER_DIGITIZER                           21L
+#define M_MODIFIED_BUFFER_DIGITIZER_ERROR                     22L
+#define M_MODIFIED_BUFFER_DIGITIZER_CORRUPT                   23L
+#define M_MODIFIED_REGION                                     25L
+#define M_FEATURE_CHANGE                                      26L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_CLIENT_CONNECTED                            27L       // app hook
+#define M_OLD_WEB_CLIENT_DISCONNECTED                         28L       // app hook
+#define M_OLD_WEB_CONNECTION_LOST                             29L       // app hook
+#endif
+#define M_OBJECT_PUBLISH_DMIL                                 30L       // app hook
+#define M_PRE_APP_FREE                                        31L       // app hook
+#define M_GET_END                                             32L
+#define M_GET_COLOR_2D_END                                    33L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_OBJECT_PUBLISH_WEB                              34L
+#endif
+#define M_SLAVE_ERROR_REMOTE_CURRENT                          35L       // app hook
+#define M_DO_INITIAL_COPY                                     36L
+#define M_DYNAMIC_BUFFER_CHANGED                              37L
+#define M_OBJECT_PUBLISH_WEB                                  38L
+// Reserve User M_OBJECT_PUBLISH_WEB + 1                      39L
+// Reserve User M_OBJECT_PUBLISH_WEB + 2                      40L
+// Reserve FB   M_OBJECT_PUBLISH_WEB + 3                      41L
+// Reserve DA   M_OBJECT_PUBLISH_WEB + 4                      42L
+
+#define M_WEB_CLIENT_CONNECTED                                43L       // app hook
+// Reserve User M_WEB_CLIENT_CONNECTED +1                     44L
+// Reserve User M_WEB_CLIENT_CONNECTED +2                     45L
+// Reserve FB   M_WEB_CLIENT_CONNECTED +3                     46L
+// Reserve DA   M_WEB_CLIENT_CONNECTED +4                     48L
+#define M_WEB_CLIENT_DISCONNECTED                             49L       // app hook
+// Reserve User M_WEB_CLIENT_DISCONNECTED +1                  50L       // app hook
+// Reserve User M_WEB_CLIENT_DISCONNECTED +2                  51L       // app hook
+// Reserve FB   M_WEB_CLIENT_DISCONNECTED +3                  52L       // app hook
+// Reserve DA   M_WEB_CLIENT_DISCONNECTED +4                  53L       // app hook
+#define M_MODIFIED_BUFFER_DISPLAYABLE_CHANGE                  54L       // buf hook
+#define M_LAYOUT_MODIFIED                                     55L       // buf hook
+
+#define M_OBJ_HOOK_RANGE_START                        0x000000800L
+#define M_OBJ_HOOK_RANGE_END                          0x0000008FFL
+#define M_OBJ_HOOK_USER_RANGE_START                   0x00000FD00L
+#define M_OBJ_HOOK_USER_RANGE_END                     0x00000FDFFL
+#define M_OBJ_HOOK_MODULE_RANGE_START                 0x00000FE00L
+#define M_OBJ_HOOK_MODULE_RANGE_END                   0x00000FFFFL
+#define M_MODIFIED_BUFFER                             0x40000000L
+#define M_UNHOOK                                      0x04000000L
+#define M_ASYNC_HOOK                                  0x08000000L
+#define M_GRAB_LINE                                   0x00100000L
+#define M_GRAB_LINE_END                               0x00200000L
+#define M_CHILD_BUFFER_MOVED                          0x00400000L
+#define M_DISP_BUF_HOOK                               0x00800000L // Hook redirected to the displays (use the M_DISP_BUF_HOOK flag)
+#define M_PRE_FLIP_COMPLEX_BUFFER                    (M_DISP_BUF_HOOK + 01L)
+#define M_POST_FLIP_COMPLEX_BUFFER                   (M_DISP_BUF_HOOK + 02L)
+#define M_ON_COMPONENT                                0x02000000L
+
+// info type for MobjGetHookInfo
+#define M_MESSAGE_STATUS                              100
+#define M_MESSAGE_PTR                                 101
+#define M_MESSAGE_SIZE_IN                             102
+#define M_MESSAGE_SIZE_OUT                            103
+#define M_MESSAGE_TAG                                 104
+
+/************************************************************************/
+/* MappAlloc                                                            */
+/* Bits used here are shared with MsysAlloc thru MappAllocDefault       */
+/************************************************************************/
+#define M_APP_ALLOC_INIT_FLAGS                        0x0FF00000L     
+#define M_SYS_ALLOC_INIT_FLAGS                        0x20000FFFL     
+
+// Linux support only 1 or 0
+#define M_X11_ACCELERATION(X)                         (M_DX_VERSION(X))
+
+// Useful
+#define M_DX_VERSION(X)                               ((X == M_DEFAULT)?(M_DIRECTX_VERSION_FLAG + (1 << M_DIRECTX_VERSION_OFFSET)):\
+                                                      (M_DIRECTX_VERSION_FLAG + (X<<M_DIRECTX_VERSION_OFFSET)))
+#define M_DX_VERSION_NUMBER(X)                        ((M_INTERNAL_GET_DX_VERSION_NUMBER(X) == 1)? M_DEFAULT: M_INTERNAL_GET_DX_VERSION_NUMBER(X))
+
+#define M_X11_ACC(X)                                 ((M_INTERNAL_GET_DX_VERSION_NUMBER(X) == M_X11_ACC_NONE)? M_X11_ACC_NONE: M_X11_ACC_DEFAULT)
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_IS_DIRECTX_VERSION_VALID(X)                 ((X == M_DIRECTX_DDRAW7) || (X == M_DIRECTX_D3D9) || (X == M_DIRECTX_D3D10) || (X == M_DIRECTX_D3D11) || (X == M_DIRECTX_NONE))
+#else
+#define M_IS_DIRECTX_VERSION_VALID(X)                 ((X == M_DIRECTX_D3D9) || (X == M_DIRECTX_D3D10) || (X == M_DIRECTX_D3D11) || (X == M_DIRECTX_NONE))
+#endif
+
+#define M_IS_XORG_ACC_VALID(X)                        ((X == M_X11_ACC_DEFAULT) || (X == M_X11_ACC_NONE)) 
+
+
+// Internal
+// Note that M_DEFAULT is also possible but not considered valid. mildisplay.dll should replace M_DEFAULT depending on context.
+#define M_DIRECTX_VERSION_MASK                        0X000F0000L
+#define M_DIRECTX_VERSION_OFFSET                      16L
+#define M_INTERNAL_GET_DX_VERSION_NUMBER(X)           (MIL_INT)((X&M_DIRECTX_VERSION_FLAG)?(((X)&M_DIRECTX_VERSION_MASK)>>M_DIRECTX_VERSION_OFFSET):M_INVALID)
+
+#define M_NEW_DISPLAYS                                0L
+
+#define M_TRACE_LOG_DISABLE                           0x00400000L
+#define M_DIRECTX_VERSION_FLAG                        0x00800000L
+#define M_UNICODE_CLIENT                              0x01000000L
+#define M_ASCII_CLIENT                                0x04000000L
+#define M_QUIET                                       0x08000000L
+#define M_DEFAULT                                     0x10000000L
+
+#define M_SET_CLUSTER_NODE_MASK                       MAKE_INT64(0X0000007F00000000)
+#define M_SET_CLUSTER_NODE_OFFSET                     32L
+#define M_INTERNAL_GET_SET_CLUSTER_NODE(X)           (((X)&M_SET_CLUSTER_NODE_MASK)>>M_SET_CLUSTER_NODE_OFFSET)
+#define M_CLUSTER_NODE(X)                             ((((MIL_INT64)X)<<M_SET_CLUSTER_NODE_OFFSET)&M_SET_CLUSTER_NODE_MASK)
+
+#define M_ERROR_FUNCTION_NAME_SIZE                    32L
+#define M_ERROR_MESSAGE_SIZE                          320L
+
+#define M_NBFCTNAMEMAX                                445 /* max number of function codes     */
+#define M_NBERRMSGMAX_ORIG                            200 /* max number of error messages     */
+#define M_NBSUBERRMSGMAX                              10  /* max number of sub error messages */
+
+#define M_ASYNC_ERROR                                 0x40000000
+
+#define M_CORE_ORIG_ERROR_START                           0
+#define M_CORE_ORIG_ERROR_END                           199
+
+#define M_SYSTEMS_ERROR_START                           200
+#define M_SYSTEMS_ERROR_END                           19999  
+#define M_HIGHLVL_ERR_OFFSET                          20000L
+#define M_HIGHLVL_ERR_OFFSET_MAX                      M_HIGHLVL_ERR_OFFSET + 28999L //48999
+#define M_FUNC_ERROR                                  49000      //User error numbers
+#define M_SCRIPT_ERROR_START                          49500
+#define M_SCRIPT_ERROR_END                            49600
+#define M_DISPLAY_DLL_ERROR_START                     50000
+#define M_DISPLAY_DLL_ERROR_END                       51999
+#define M_CODEC_ENGINE_ERROR_START                    52000
+#define M_CODEC_ENGINE_ERROR_END                      52999
+#define M_URL_ERROR_START                             53000
+#define M_URL_ERROR_END                               53999
+#define M_HTTP_ERROR_START                            54000
+#define M_HTTP_ERROR_END                              54999
+#define M_WEB_ERROR_START                             55000
+#define M_WEB_ERROR_END                               55999
+#define M_CORE_ERROR_START                            56000
+#define M_CORE_ERROR_END                              56999
+#define M_MISC_ERROR_START                            57000
+#define M_MISC_ERROR_END                              57050
+
+#define M_IS_CORE_ERROR(ERR)                          (((ERR >= M_CORE_ORIG_ERROR_START) && (ERR <= M_CORE_ORIG_ERROR_END)) || ((ERR >= M_CORE_ERROR_START) && (ERR <= M_CORE_ERROR_END)))
+
+#define M_DIRECTX_NONE                                    M_NULL
+#define M_DIRECTX_UNDETERMINED                            -1L
+#define M_DIRECTX_DDRAW7                                  7L
+#define M_DIRECTX_D3D9                                    9L
+#define M_DIRECTX_D3D10                                   10L
+#define M_DIRECTX_D3D11                                   11L
+
+#define M_X11_ACC_NONE                                    M_NULL
+#define M_X11_ACC_DEFAULT                                 1L
+
+/************************************************************************/
+/* MappTrace()                                                          */
+/************************************************************************/
+#define M_TRACE_MARKER                                0x0000000000000000
+#define M_TRACE_SECTION_START                         0x1000000000000000
+#define M_TRACE_SECTION_END                           0x2000000000000000
+#define M_TRACE_SET_TAG_INFORMATION                   0x8000000000000000
+#define M_TRACE_LOG_DISABLE                           0x00400000L
+
+/************************************************************************/
+/* MappHookFunction()                                                   */
+/************************************************************************/
+
+//License server event types
+#define M_LICENSE_SERVER_CONTACT_LOST                 1
+#define M_LICENSE_SERVER_KEY_DISCONNECTED             2
+#define M_LICENSE_LOCAL_CLIENT_CONTACT_LOST           3
+#define M_LICENSE_SERVER_OK                           4
+#define M_LICENSE_SERVER_SWITCH                       5
+#define M_LICENSE_PERMISSIONS_CHANGED                 6
+#define M_LICENSE_SERVER_RECONNECT                    7
+
+
+/************************************************************************/
+#define M_TRACE_START                                 1L
+#define M_TRACE_END                                   2L
+#define M_DMIL_CLIENT_CONNECTED                       4L
+#define M_DMIL_CLIENT_DISCONNECTED                    5L
+#define M_DMIL_CONNECTION_LOST                        (6L + M_ASYNC_HOOK)
+#define M_SLAVE_ERROR_CURRENT                         7L
+#define M_SLAVE_ERROR_GLOBAL                          8L
+#define M_LICENSE_SERVER_EVENT                        (14|M_ASYNC_HOOK)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_CLIENT_CONNECTED                   27L
+#define M_OLD_WEB_CLIENT_DISCONNECTED                28L
+#define M_OLD_WEB_CONNECTION_LOST                    29L
+#endif
+#define M_OBJECT_PUBLISH_DMIL                        30L
+#define M_APP_LAST_FREE                              31L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_OBJECT_PUBLISH_WEB                     34L
+#endif
+#define M_SLAVE_ERROR_REMOTE_CURRENT                 35L
+#define M_OBJECT_PUBLISH_WEB                         38L
+// Reserve User M_OBJECT_PUBLISH_WEB + 1             39L
+// Reserve User M_OBJECT_PUBLISH_WEB + 2             40L
+// Reserve FB   M_OBJECT_PUBLISH_WEB + 3             41L
+// Reserve DA   M_OBJECT_PUBLISH_WEB + 4             42L
+
+#define M_WEB_CLIENT_CONNECTED                                43L       // app hook
+// Reserve User M_WEB_CLIENT_CONNECTED +1                     44L
+// Reserve User M_WEB_CLIENT_CONNECTED +2                     45L
+// Reserve FB   M_WEB_CLIENT_CONNECTED +3                     46L
+// Reserve DA   M_WEB_CLIENT_CONNECTED +4                     48L
+#define M_WEB_CLIENT_DISCONNECTED                             49L       // app hook
+// Reserve User M_WEB_CLIENT_DISCONNECTED +1                  50L       // app hook
+// Reserve User M_WEB_CLIENT_DISCONNECTED +2                  51L       // app hook
+// Reserve FB   M_WEB_CLIENT_DISCONNECTED +3                  52L       // app hook
+// Reserve DA   M_WEB_CLIENT_DISCONNECTED +4                  53L       // app hook
+
+#define M_ERROR_FATAL                                 (M_ERROR|M_FATAL)
+#define M_UNHOOK                                      0x04000000L
+                                                                  /* Bit field exclusive to M_TRACE  to M_PROCESSING      (3L to 6L) */
+#define M_THREAD_CURRENT                              0x01000000L /*                        M_TRACE_START                       (1L) */
+#if OldDefinesSupport
+#define M_INTERNAL_ALLOC                              0x00200000L /*                        M_TRACE_END                         (2L) */
+MIL_DEPRECATED(M_INTERNAL_ALLOC, 1000)
+#define M_INTERNAL_FREE                               0x00400000L /*                        M_ERROR                     (0x40000000) */
+MIL_DEPRECATED(M_INTERNAL_FREE, 1000)
+#endif
+#define M_OBJECT_FREE                                 0x00010000L /*                        M_MESSAGE                   (0x20000000) */
+#define M_OBJECT_FREE_REMOTE                          0x00010001L /*                        M_CURRENT to M_REGION_SIZE_Y (1L to 44L) */
+                                                                  /*                        M_UNHOOK                    (0x04000000) */
+#define M_VSYNC_SIGNAL                                0x00000100L /* For hook when a vsync occurred on a host                         */
+                                                                  /*  Range use: 0x00000100 to 0x0000010F                            */
+                                                                  /*  The host system to use (device number) must be added to        */
+                                                                  /*  M_VSYNC.  Exemple: to hook on the vsync of the 3rd host        */
+
+                                                                  /*                system, use the hook type M_VSYNC_SIGNAL+M_DEV2  */
+
+#define M_LICENSE_FATAL_ERROR                        (0x00000110|M_ASYNC_HOOK)
+#define M_VSYNC_HOOK_SYSTEM_NUM(hooktype)             (hooktype&0x0000000F)   /* IMPORTANT these macros are base on the value of M_MAX_VIDEO_DEVICE */
+#define M_IS_VSYNC_HOOK(hooktype)                     ((hooktype&(~(M_UNHOOK|0x0000000F)))==M_VSYNC_SIGNAL)
+#define M_MIL_DISPLAY_DLL_LOAD                        0x000000200L
+#define M_MIL_DIRECTX_DLL_LOAD                        0x000000400L
+#define M_IS_DMIL_HOOK(hooktype)                      ((hooktype==M_DMIL_CLIENT_CONNECTED) || (hooktype==M_DMIL_CLIENT_DISCONNECTED) || (hooktype==M_DMIL_CONNECTION_LOST))
+
+//License server event types
+#define M_LICENSE_SERVER_CONTACT_LOST                 1
+#define M_LICENSE_SERVER_KEY_DISCONNECTED             2
+#define M_LICENSE_LOCAL_CLIENT_CONTACT_LOST           3
+#define M_LICENSE_SERVER_OK                           4
+#define M_LICENSE_SERVER_SWITCH                       5
+#define M_LICENSE_PERMISSIONS_CHANGED                 6
+
+/************************************************************************/
+/* MappGetHookInfo()                                                    */
+/************************************************************************/
+#define M_NULL_ERROR                                  0L
+#define M_NO_ERROR                                    0L
+
+#define M_CURRENT                                     0x00000002L
+#define M_CURRENT_FCT                                 0x00030000L
+#define M_CURRENT_SUB_NB                              0x00000004L
+#define M_CURRENT_SUB                                 0x00050000L
+#define M_CURRENT_SUB_1                               0x00050000L
+#define M_CURRENT_SUB_2                               0x00060000L
+#define M_CURRENT_SUB_3                               0x00070000L
+#define M_GLOBAL                                      0x00000008L
+#define M_GLOBAL_FCT                                  0x00090000L
+#define M_GLOBAL_SUB_NB                               0x000A0000L
+#define M_GLOBAL_SUB                                  0x000B0000L
+#define M_GLOBAL_SUB_1                                0x000B0000L
+#define M_GLOBAL_SUB_2                                0x000C0000L
+#define M_GLOBAL_SUB_3                                0x000D0000L
+#define M_PARAM_NB                                    0x00140000L
+#define M_BUFFER_ID                                   0x00160000L
+#define M_REGION_OFFSET_X                             0x00410000L
+#define M_REGION_OFFSET_Y                             0x00420000L
+#define M_REGION_SIZE_X                               0x00430000L
+#define M_REGION_SIZE_Y                               0x00480000L
+#define M_OBJECT_ID                                   0x001B0000L
+#define M_PARAM_VALUE                                 0x08000000L
+#define M_EXTENDED_PARAM_TYPE                         0x10000000L
+#define M_PARAM_ATTRIBUTES                            0x04000000L
+#define M_PARAM_SIZE                                  0x01000000L
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL))
+#define M_MESSAGE                                     (0x20000000L|M_CLIENT_ERROR_ASCII_MODE)
+#else
+#define M_MESSAGE                                     0x20000000L
+#endif
+#else
+#define M_MESSAGE                                    (0x20000000L | M_CLIENT_ENCODING)
+#endif
+
+#define M_PARAM_TYPE_INFO                             (0x02000000L | M_CLIENT_ENCODING)
+
+
+
+/************************************************************************/
+/* MappInquire() / MappControl() Types                                  */
+/* NB: All values in this range must be included between
+                       M_APP_INQUIRE_SYS_START and M_APP_INQUIRE_SYS_END*/
+/************************************************************************/
+#define M_LOCATION                                    1048L
+
+
+#define M_APP_INQUIRE_SIZEOF_INT64_START              6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+#define M_EXTENDED_INIT_FLAG                          6705L
+#define M_APP_INQUIRE_SIZEOF_INT64_END                6799L
+
+
+#define M_APP_INQUIRE_SYS_START                       15000L
+/*Reserve values between 15000L and 20000L for AppInquires.
+Needed for remote systems                                 */
+
+#define M_VERSION                                     (M_APP_INQUIRE_SYS_START+1L)
+#define M_TRACE_HOOKS                                 (M_APP_INQUIRE_SYS_START+2L)
+#define M_CLEAR_ERROR                                 (M_APP_INQUIRE_SYS_START+3L)
+#define M_PARAMETER                                   (M_APP_INQUIRE_SYS_START+4L)
+#define M_REBOOT_NEEDED                               (M_APP_INQUIRE_SYS_START+5L)
+#define M_PROCESSING                                  (M_APP_INQUIRE_SYS_START+6L)
+#if OldDefinesSupport
+   #define M_LAST_PLATFORM_USE                        (M_APP_INQUIRE_SYS_START+7L)
+   MIL_DEPRECATED(M_LAST_PLATFORM_USE, 1060)
+#endif
+#define M_LAST_PLATFORM_USED                          (M_APP_INQUIRE_SYS_START+7L)
+#define M_CURRENT_ERROR_HANDLER_PTR                   (M_APP_INQUIRE_SYS_START+8L)
+#define M_CURRENT_ERROR_HANDLER_USER_PTR              (M_APP_INQUIRE_SYS_START+9L)
+#define M_GLOBAL_ERROR_HANDLER_PTR                    (M_APP_INQUIRE_SYS_START+10L)
+#define M_GLOBAL_ERROR_HANDLER_USER_PTR               (M_APP_INQUIRE_SYS_START+11L)
+#define M_FATAL_ERROR_HANDLER_PTR                     (M_APP_INQUIRE_SYS_START+12L)
+#define M_FATAL_ERROR_HANDLER_USER_PTR                (M_APP_INQUIRE_SYS_START+13L)
+#define M_TRACE_START_HANDLER_PTR                     (M_APP_INQUIRE_SYS_START+14L)
+#define M_TRACE_START_HANDLER_USER_PTR                (M_APP_INQUIRE_SYS_START+15L)
+#define M_TRACE_END_HANDLER_PTR                       (M_APP_INQUIRE_SYS_START+16L)
+#define M_TRACE_END_HANDLER_USER_PTR                  (M_APP_INQUIRE_SYS_START+17L)
+#define M_IRQ_CONTROL                                 (M_APP_INQUIRE_SYS_START+18L)
+#define M_ERROR_HANDLER_PTR                           (M_APP_INQUIRE_SYS_START+19L)
+#define M_ERROR_HANDLER_USER_PTR                      (M_APP_INQUIRE_SYS_START+20L)
+#define M_CURRENT_APPLICATION                         (M_APP_INQUIRE_SYS_START+21L)
+#define M_ERROR_HOOKS                                 (M_APP_INQUIRE_SYS_START+22L)
+#define M_MIL_UNIQUE_NUMBER                           (M_APP_INQUIRE_SYS_START+23L)
+#define M_MIL_TRACE_FILENAME                          (M_APP_INQUIRE_SYS_START+24L)
+#define M_FREE_ALL_DEFAULT                            (M_APP_INQUIRE_SYS_START+25L)
+#define M_LICENSE_VALID_MODULES                       (M_APP_INQUIRE_SYS_START+26L)
+#define M_LICENSE_UNLOCKED_MODULES                    M_LICENSE_VALID_MODULES
+#define M_LICENSE_TEMP_UNLOCKED_MODULES               (M_APP_INQUIRE_SYS_START+29L)
+#define M_ERROR_CODE_PTR                              (M_APP_INQUIRE_SYS_START+38L)
+#define M_MILCE_ALLOC_IN_DMA_SIZE                     (M_APP_INQUIRE_SYS_START+40L)
+#define M_MILCE_ALLOC_IN_MMF_SIZE                     (M_APP_INQUIRE_SYS_START+41L)
+#define M_MILCE_ALLOC_IN_MMF_AUTO_COMMIT              (M_APP_INQUIRE_SYS_START+42L)
+#define M_X86_FPU_FLAGS                               (M_APP_INQUIRE_SYS_START+43L)
+#define M_REAL_TRACE_LEVEL                            (M_APP_INQUIRE_SYS_START+44L)
+
+#define M_FORCE_THREAD_DETACH                         (M_APP_INQUIRE_SYS_START+46L)
+#define M_BUFTRANSFER_METHOD                          (M_APP_INQUIRE_SYS_START+47L)
+#define M_DISABLE_BUFTRANSFER_METHOD                  (M_APP_INQUIRE_SYS_START+48L)
+#define M_RESET_DEFAULTS                              (M_APP_INQUIRE_SYS_START+49L)
+#define M_USE_WINDOWED_CLASS                          (M_APP_INQUIRE_SYS_START+50L)
+
+#define M_IN_HIGHLEVEL_MODULE                         (M_APP_INQUIRE_SYS_START+52L)
+#define M_USING_OLD_DISP                              (M_APP_INQUIRE_SYS_START+53L)
+#define M_LICENSE_NON_TEMP_MODULES                    (M_APP_INQUIRE_SYS_START+55L)
+#define M_TEMP_LICENSE_DAYS_LEFT                      (M_APP_INQUIRE_SYS_START+57L)
+#define M_DRIVER_IS_CALLED_INTERNALLY                 (M_APP_INQUIRE_SYS_START+59L)
+#define M_MAX_PLATFORM_USED                           (M_APP_INQUIRE_SYS_START+60L)
+#define M_CREATE_REGCONTROL                           (M_APP_INQUIRE_SYS_START+61L)
+#define M_ERROR_POP                                   (M_APP_INQUIRE_SYS_START+62L)
+#if MIL_COMPILE_VERSION < 1010
+#define M_INSTALLED_SYSTEM_COUNT                      (M_APP_INQUIRE_SYS_START+63L)
+#else
+#define M_INSTALLED_SYSTEM_COUNT_OLD                  (M_APP_INQUIRE_SYS_START+63L)
+#endif
+#define M_GENTL_PRODUCER_COUNT                        (M_APP_INQUIRE_SYS_START+64L)
+#if OldDefinesSupport
+#define M_NUMBER_OF_BOARD_TYPES                       M_INSTALLED_SYSTEM_COUNT
+MIL_DEPRECATED(M_NUMBER_OF_BOARD_TYPES, 1000)
+#endif
+#define M_SAFE_FLOATING_POINT_CONTROL                 (M_APP_INQUIRE_SYS_START+65L)
+#define M_RESET_SYSDETECT                             (M_APP_INQUIRE_SYS_START+66L)
+/* Reserve next 31 values               from          (M_APP_INQUIRE_SYS_START+67L)*/
+/*                                      to            (M_APP_INQUIRE_SYS_START+95)*/
+#define M_SUPERSIGHT_DRIVER_VERSION                   (M_APP_INQUIRE_SYS_START+118L)
+#define M_EXECUTING_ON_SUPERSIGHT_MASTER              (M_APP_INQUIRE_SYS_START+119L)
+#define M_MEMORY                                      (M_APP_INQUIRE_SYS_START+120L) /*5120*/ //Only 2 bits set. Used in bitwise operations
+#if MIL_COMPILE_VERSION >= 1010
+#define M_INSTALLED_SYSTEM_COUNT                      (M_APP_INQUIRE_SYS_START+121L)
+#endif
+#define M_APPLICATION_ALLOCATED                       (M_APP_INQUIRE_SYS_START+122L)
+#define M_DIRECTX_SERVICE_IS_VALID                    (M_APP_INQUIRE_SYS_START+126L)
+#if OldDefinesSupport
+   #define M_MP_ACTIVE_THREAD                         (M_APP_INQUIRE_SYS_START+127L)
+   MIL_DEPRECATED(M_MP_ACTIVE_THREAD, 1060)
+#endif
+#define M_MP_USE                                      (M_APP_INQUIRE_SYS_START+128L)
+#if (MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION)
+#endif
+#if OldDefinesSupport
+   #define M_MP_MAX_CORES_PER_THREAD                  (M_APP_INQUIRE_SYS_START+130L)
+   MIL_DEPRECATED(M_MP_MAX_CORES_PER_THREAD, 1060)
+   #define M_MP_PRE_PROCESS                           (M_APP_INQUIRE_SYS_START+131L)
+   MIL_DEPRECATED(M_MP_PRE_PROCESS, 1060)
+   #define M_MP_CORES_NUM                             (M_APP_INQUIRE_SYS_START+133L)
+   MIL_DEPRECATED(M_MP_CORES_NUM, 1060)
+   #define M_MP_PHYSICAL_CORES_NUM                    (M_APP_INQUIRE_SYS_START+134L)
+   MIL_DEPRECATED(M_MP_PHYSICAL_CORES_NUM, 1060)
+#endif
+#define M_SUPERSIGHT_DESC                             (M_APP_INQUIRE_SYS_START+136L)
+#define M_USE_LIB_TIFF_HANDLER                        (M_APP_INQUIRE_SYS_START+137L)
+#define M_PNG_ALPHA_CHANNEL                           (M_APP_INQUIRE_SYS_START+138L)
+#define M_FLIP_BUFFERS_SUPPORT                        (M_APP_INQUIRE_SYS_START+139L)
+#define M_USE_LEGACY_RAW_FORMAT                       (M_APP_INQUIRE_SYS_START+141L)
+#define M_GENERATE_BEEP                               (M_APP_INQUIRE_SYS_START+142L)
+#define M_LEGACY_COMPENSATION                         (M_APP_INQUIRE_SYS_START+143L)
+#define M_SELECTABLE_SYSTEM_COUNT                     (M_APP_INQUIRE_SYS_START+144L)
+#define M_IMPORT_JPEG_WITH_VALIDATION                 (M_APP_INQUIRE_SYS_START+145L)
+
+#define M_DEFAULT_HOST_FROM_ID                        (M_APP_INQUIRE_SYS_START+290L)
+/* Reserve for error to prevent previous inquire + n  (M_APP_INQUIRE_SYS_START+293L)*/
+/* Reserve for error to prevent previous inquire + n  (M_APP_INQUIRE_SYS_START+295L)*/
+// Unused                                             (M_APP_INQUIRE_SYS_START+297L)
+
+
+#define M_NON_PAGED_MEMORY_FREE                       (M_APP_INQUIRE_SYS_START+500L)
+#define M_NON_PAGED_MEMORY_USED                       (M_APP_INQUIRE_SYS_START+501L)
+#define M_NON_PAGED_MEMORY_SIZE                       (M_APP_INQUIRE_SYS_START+502L)
+#define M_NON_PAGED_MEMORY_LARGEST_FREE               (M_APP_INQUIRE_SYS_START+503L)
+#define M_ANCESTOR_APPLICATION                        (M_APP_INQUIRE_SYS_START+505L)
+
+#define M_USE_NEW_DISPLAYS                            (M_APP_INQUIRE_SYS_START+0x00000200L) /*512L*/
+#define M_MEMORY_ALLOC_PRE_PADDING                    (M_APP_INQUIRE_SYS_START+513L)
+#define M_MEMORY_ALLOC_POST_PADDING                   (M_APP_INQUIRE_SYS_START+514L)
+#define M_MEMORY_ALLOC_PITCH_BYTE                     (M_APP_INQUIRE_SYS_START+515L)
+#define M_MEMORY_ALLOC_ALIGNMENT                      (M_APP_INQUIRE_SYS_START+516L)
+#define M_DMIL_CONNECTION_PORT                        (M_APP_INQUIRE_SYS_START+517L)
+#define M_DMIL_CONNECTION                             (M_APP_INQUIRE_SYS_START+518L)
+#define M_DMIL_AUTO_PUBLISH_ALL                       (M_APP_INQUIRE_SYS_START+519L)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_CONNECTION                          (M_APP_INQUIRE_SYS_START+521L)
+#define M_OLD_WEB_CONNECTION_PORT                     (M_APP_INQUIRE_SYS_START+522L)
+#endif
+#define M_WEB_CONNECTION                              (M_APP_INQUIRE_SYS_START+523L)
+// Reserve User M_WEB_CONNECTION + 1                  (M_APP_INQUIRE_SYS_START+524L)
+// Reserve User M_WEB_CONNECTION + 2                  (M_APP_INQUIRE_SYS_START+525L)
+// Reserve FB M_WEB_CONNECTION   + 3                  (M_APP_INQUIRE_SYS_START+526L)
+// Reserve DA M_WEB_CONNECTION   + 4                  (M_APP_INQUIRE_SYS_START+527L)
+#define M_WEB_CONNECTION_PORT                         (M_APP_INQUIRE_SYS_START+528L)
+// Reserve User M_WEB_CONNECTION_PORT + 1             (M_APP_INQUIRE_SYS_START+529L)
+// Reserve User M_WEB_CONNECTION_PORT + 2             (M_APP_INQUIRE_SYS_START+530L)
+// Reserve FB   M_WEB_CONNECTION_PORT + 3             (M_APP_INQUIRE_SYS_START+531L)
+// Reserve DA   M_WEB_CONNECTION_PORT + 4             (M_APP_INQUIRE_SYS_START+532L)
+#define M_COMP_DISP_RESELECT                          (M_APP_INQUIRE_SYS_START+533L)
+
+#define M_MTX_MEM_MANAGER_INFO_START                  (M_APP_INQUIRE_SYS_START+600L)
+   #define M_MTX_MEM_MANAGER_ADDRESS                  (M_MTX_MEM_MANAGER_INFO_START)
+   #define M_MTX_MEM_MANAGER_MEM_SIZE                 (M_MTX_MEM_MANAGER_INFO_START+1L)
+   #define M_MTX_MEM_MANAGER_FREE_MEM_SIZE            (M_MTX_MEM_MANAGER_INFO_START+2L)
+   #define M_MTX_MEM_MANAGER_USED_MEM_SIZE            (M_MTX_MEM_MANAGER_INFO_START+3L)
+   #define M_MTX_MEM_MANAGER_VERSION                  (M_MTX_MEM_MANAGER_INFO_START+4L)
+   #define M_MTX_MEM_MANAGER_NUM_OF_BANK              (M_MTX_MEM_MANAGER_INFO_START+5L)
+   #define M_MTX_MEM_MANAGER_BANK_FLAGS               (M_MTX_MEM_MANAGER_INFO_START+6L)
+   #define M_MTX_MEM_MANAGER_NON_PAGED_FLAGS          (M_MTX_MEM_MANAGER_INFO_START+7L)
+   #define M_MTX_MEM_MANAGER_KERNEL_ADDRESS           (M_MTX_MEM_MANAGER_INFO_START+8L)
+   #define M_MTX_MEM_MANAGER_STARTUP_NONPAGED_MODE    (M_MTX_MEM_MANAGER_INFO_START+9L)
+   #define M_MTX_MEM_MANAGER_STARTUP_NONPAGED_SIZE    (M_MTX_MEM_MANAGER_INFO_START+10L)
+   #define M_MTX_MEM_MANAGER_STARTUP_CHUNK_SIZE       (M_MTX_MEM_MANAGER_INFO_START+11L)
+   #define M_MTX_MEM_MANAGER_OS_MEMORY_SIZE           (M_MTX_MEM_MANAGER_INFO_START+12L)
+   #define M_MTX_MEM_MANAGER_BOOT_FLAGS               (M_MTX_MEM_MANAGER_INFO_START+13L)
+   #define M_MTX_MEM_MANAGER_THRESHOLD                (M_MTX_MEM_MANAGER_INFO_START+14L)
+   #define M_MTX_MEM_MANAGER_REG_NONPAGED_MODE        (M_MTX_MEM_MANAGER_INFO_START+15L)
+   #define M_MTX_MEM_MANAGER_REG_CHUNK_SIZE           (M_MTX_MEM_MANAGER_INFO_START+16L)
+   #define M_MTX_MEM_MANAGER_REG_NONPAGED_SIZE        (M_MTX_MEM_MANAGER_INFO_START+17L)
+
+   #define M_MTX_MEM_DRIVER_INFORMATION_STRUCT        (M_MTX_MEM_MANAGER_INFO_START+18L)
+   #define M_MTX_MEM_MANAGER_STRUCT_VERSION           (M_MTX_MEM_MANAGER_INFO_START+19L)
+   #define M_MTX_MEM_MANAGER_STRUCT_SIZE              (M_MTX_MEM_MANAGER_INFO_START+20L)
+   #define M_MTX_MEM_MANAGER_BASE_ADDRESS             (M_MTX_MEM_MANAGER_ADDRESS)
+   #define M_MTX_MEM_MANAGER_SIZE_IN_BYTE             (M_MTX_MEM_MANAGER_MEM_SIZE)
+   #define M_MTX_MEM_MANAGER_FREE_MEM_SIZE_IN_BYTE    (M_MTX_MEM_MANAGER_FREE_MEM_SIZE)
+   #define M_MTX_MEM_MANAGER_USED_MEM_SIZE_IN_BYTE    (M_MTX_MEM_MANAGER_USED_MEM_SIZE)
+   #define M_MTX_MEM_MANAGER_NONPAGED_MODE            (M_MTX_MEM_MANAGER_INFO_START+21L)
+   #define M_MTX_MEM_MANAGER_CHUNK_SIZE               (M_MTX_MEM_MANAGER_INFO_START+22L)
+   #define M_MTX_MEM_MANAGER_NUM_USER_BANKS           (M_MTX_MEM_MANAGER_INFO_START+23L)
+   #define M_MTX_MEM_MANAGER_BIGGEST_BANK             (M_MTX_MEM_MANAGER_INFO_START+24L)
+   #define M_MTX_MEM_MANAGER_SMALLEST_BANK            (M_MTX_MEM_MANAGER_INFO_START+25L)
+   #define M_MTX_MEM_MANAGER_MIN_CHUNK_SIZE           (M_MTX_MEM_MANAGER_INFO_START+26L)
+   #define M_MTX_MEM_MANAGER_MAX_NON_PAGED            (M_MTX_MEM_MANAGER_INFO_START+27L)
+   #define M_MTX_MEM_MANAGER_SPECIAL_MODE             (M_MTX_MEM_MANAGER_INFO_START+28L)
+   #define M_MTX_MEM_MANAGER_RAM_INSTALLED            (M_MTX_MEM_MANAGER_INFO_START+29L)
+
+   /* Reserve next values                  from       (M_APP_INQUIRE_SYS_START+600L)*/
+   /*                                      to         (M_APP_INQUIRE_SYS_START+639L)*/
+#define M_MTX_MEM_MANAGER_INFO_END                    (M_APP_INQUIRE_SYS_START+639L)
+
+#define M_IN_MTX_MEM_MANAGER_INFO_RANGE(X)            ((M_STRIP_INTERMOD_BITS(X) >= M_MTX_MEM_MANAGER_INFO_START) && \
+                                                       (M_STRIP_INTERMOD_BITS(X) <= M_MTX_MEM_MANAGER_INFO_END  )  )
+
+
+/* Reserve next values                  from          (M_APP_INQUIRE_SYS_START+640L)*/
+/*                                      to            (M_APP_INQUIRE_SYS_START+704L)*/
+
+#define M_BH_BASE_BUFFER_TYPE                         (M_APP_INQUIRE_SYS_START+705L)
+#define M_BH_NEEDED_BUFFER_ATTRIBUTE                  (M_APP_INQUIRE_SYS_START+706L)
+#define M_BH_INCOMPATIBLE_BUFFER_ATTRIBUTE            (M_APP_INQUIRE_SYS_START+707L)
+#define M_BH_TRANSFER_METHOD                          (M_APP_INQUIRE_SYS_START+708L)
+#define M_BH_TRANSFER_FUNCTION_SUPPORTED              (M_APP_INQUIRE_SYS_START+709L)
+#define M_BH_IS_ALLOCATOR                             (M_APP_INQUIRE_SYS_START+710L)
+#define M_BH_IS_CREATOR                               (M_APP_INQUIRE_SYS_START+711L)
+#define M_BH_KNOWN_DISPLAY_ATTRIBUTE                  (M_APP_INQUIRE_SYS_START+712L)
+/* Reserve next values                  from          (M_APP_INQUIRE_SYS_START+713L)*/
+/*                                      to            (M_APP_INQUIRE_SYS_START+719L)*/
+#define M_DMA_MANAGER_TYPE                            (M_APP_INQUIRE_SYS_START+720L)
+#define M_FREE_EMPTY_WORKSPACE                        (M_APP_INQUIRE_SYS_START+721L)
+#define M_RESERVE_CLUSTER_NODE                        (M_APP_INQUIRE_SYS_START+722L)
+#define M_FREE_CLUSTER_NODE                           (M_APP_INQUIRE_SYS_START+723L)
+#define M_DEFAULT_CLUSTER_NODE                        (M_APP_INQUIRE_SYS_START+724L)
+#define M_FREE_EMPTY_CLUSTER_NODE                     (M_APP_INQUIRE_SYS_START+725L)
+#define M_CLUSTER_NODE_FROM_ID                        (M_APP_INQUIRE_SYS_START+726L)
+#define M_EXPIRATION_DATE                             (M_APP_INQUIRE_SYS_START+727L)
+#define M_FREE_DEFAULT_SHADOWS                        (M_APP_INQUIRE_SYS_START+728L)
+#define M_FREE_REMAINING_TUBES                        (M_APP_INQUIRE_SYS_START+729L)
+#if MIL_COMPILE_VERSION < 1010
+#define M_INSTALLED_SYSTEM_TYPE                       (M_APP_INQUIRE_SYS_START+728L)
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_INSTALLED_SYSTEM_TYPE_OLD                   (M_APP_INQUIRE_SYS_START+728L)
+/* Reserved the 15 next values               from     (M_APP_INQUIRE_SYS_START+729L)*/
+/*                                        to          (M_APP_INQUIRE_SYS_START+744L)*/
+#endif
+#define M_IGNORED_EXP_DATE                            (M_APP_INQUIRE_SYS_START+745L)
+#define M_FREE_ALL_SHADOWS                            (M_APP_INQUIRE_SYS_START+746L)
+
+#if MIL_COMPILE_VERSION < 1010
+#define M_INSTALLED_SYSTEM_CAN_GRAB                   (M_APP_INQUIRE_SYS_START+800L)
+#define M_IS_DISTRIBUTED_BOARD                        (M_APP_INQUIRE_SYS_START+816L)
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_INSTALLED_SYSTEM_CAN_GRAB_OLD               (M_APP_INQUIRE_SYS_START+800L)
+/* Reserved the next values               from        (M_APP_INQUIRE_SYS_START+801L)*/
+/*                                        to          (M_APP_INQUIRE_SYS_START+815L)*/
+#define M_IS_DISTRIBUTED_BOARD_OLD                    (M_APP_INQUIRE_SYS_START+816L)
+/* Reserve next 15 values                from         (M_APP_INQUIRE_SYS_START+817L)*/
+/*                                       to           (M_APP_INQUIRE_SYS_START+831L)*/
+#endif
+
+#define M_DIRECT_ACCESS_START                         (M_APP_INQUIRE_SYS_START+832L)
+   #define M_PROCESSING_PACK_REVISION                 (M_APP_INQUIRE_SYS_START+833L)
+   /* The next values are available          from     (M_APP_INQUIRE_SYS_START+834L)*/
+   /*                                        to       (M_APP_INQUIRE_SYS_START+889L)*/
+
+
+   #define M_APP_INQUIRE_DIRECT_ACCESS_STRING_START   (M_APP_INQUIRE_SYS_START+890L)
+
+
+   #define M_APP_INQUIRE_DIRECT_ACCESS_STRING_END     (M_APP_INQUIRE_SYS_START+949)
+
+   #define M_DUMP_ID_TABLE                           ((M_APP_INQUIRE_SYS_START+951L)|M_CLIENT_ENCODING)
+   #define M_DEFAULT_SYSTEM_ID                        (M_APP_INQUIRE_SYS_START+952L)
+   #define M_DUMP_ALL_ID_INFO                         (M_APP_INQUIRE_SYS_START+954L)
+   #define M_MIL_DLL_COMPILATION_TYPE                 (M_APP_INQUIRE_SYS_START+956L)
+   #define M_MILUTIL_COMPILATION_TYPE                 (M_APP_INQUIRE_SYS_START+957L)
+   #define M_IS_DISTRIBUTED_MIL_INSTALLED             (M_APP_INQUIRE_SYS_START+958L)
+   #define M_IS_DISTRIBUTED_MIL_SERVER_INSTALLED      (M_APP_INQUIRE_SYS_START+959L)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_SUPPORT_ERROR_REMOTE_CURRENT             (M_APP_INQUIRE_SYS_START+962L)
+#endif
+   #define M_IS_MIL_WEB_INSTALLED                     (M_APP_INQUIRE_SYS_START+963L)
+   #define M_IS_MIL_HTTP_SERVER_INSTALLED             (M_APP_INQUIRE_SYS_START+964L)
+   /* The next values are available from              (M_APP_INQUIRE_SYS_START+965L)*/
+   /*                               to                (M_APP_INQUIRE_SYS_START+975L)*/
+
+
+   #define M_REG_DEF_START                            (M_APP_INQUIRE_SYS_START+976L)                                      
+      #define M_APP_INQUIRE_REG_DEF_STRING_START      (M_APP_INQUIRE_SYS_START+977L)                                      
+      #define M_APP_INQUIRE_REG_DEF_STRING_END        (M_APP_INQUIRE_SYS_START+1296L)                                     
+   #define M_REG_DEF_END                              (M_APP_INQUIRE_SYS_START+1521L)                                     
+
+
+#define M_DIRECT_ACCESS_END                           (M_APP_INQUIRE_SYS_START+1522L)
+
+
+
+#define M_INSTALLATION_TYPE                           (M_APP_INQUIRE_SYS_START+1523L)
+#define M_NEED_NETWORK_TUBE_DECODER                   (M_APP_INQUIRE_SYS_START+1524L)
+#define M_SUPPORT_INTERSYSTEM_CALL                    (M_APP_INQUIRE_SYS_START+1525L)
+#define M_SUPPORT_MIXED_CLUSTER                       (M_APP_INQUIRE_SYS_START+1526L)
+#define M_NEED_DEFAULT_COMPENSATION                   (M_APP_INQUIRE_SYS_START+1527L)
+#define M_CLUSTER_MASK                                (M_APP_INQUIRE_SYS_START+1528L)
+#define M_INTRA_CLUSTER_NODE_MASK                     (M_APP_INQUIRE_SYS_START+1529L)
+#define M_IDEMPOTENT_FOR_WORKSPACE                    (M_APP_INQUIRE_SYS_START+1530L)
+
+#define M_SYSTEM_OFFSET                               (M_APP_INQUIRE_SYS_START+1531L)   // Undocumented inquire type
+/* Reserve values from                                (M_APP_INQUIRE_SYS_START+1532L)*/
+/*                to                                  (M_APP_INQUIRE_SYS_START+1546L)*/ 
+// This inquire type initializes a BoardInfo struct with the defaults values of the specified system
+// A pointer to this struct is then returned. To select a specified system, inquire its offset using M_SYSTEM_OFFSET
+// and then simply added it to M_SET_SYSTEM_DEFAULTS.
+#if MIL_COMPILE_VERSION < 1010
+#define M_BOARD_DEFAULTS_PTR                          (M_APP_INQUIRE_SYS_START+1548L)   // Undocumented inquire type 
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_BOARD_DEFAULTS_PTR_OLD                      (M_APP_INQUIRE_SYS_START+1548L)   // Undocumented inquire type 
+/* Reserve values from                                (M_APP_INQUIRE_SYS_START+1549L)*/
+/*                to                                  (M_APP_INQUIRE_SYS_START+1563L)*/ 
+#endif
+#define M_ID_TABLE_SIZE                               (M_APP_INQUIRE_SYS_START+1581L)
+#define M_ID_LIST_FREE_ENTRIES                        (M_APP_INQUIRE_SYS_START+1582L)
+#define M_ID_TABLE_LEGACY_MODE                        (M_APP_INQUIRE_SYS_START+1583L)
+#define M_PLATFORM_BITNESS                            (M_APP_INQUIRE_SYS_START+1584L)
+#define M_PLATFORM_OS_TYPE                            (M_APP_INQUIRE_SYS_START+1585L)
+#define M_LICENSE_KEY_WAIT_TIME                       (M_APP_INQUIRE_SYS_START+1586L)
+#define M_IS_EA_EXPIRED                               (M_APP_INQUIRE_SYS_START+1587L)
+
+#define M_TRACE                                       0x00004100L // = (M_APP_INQUIRE_SYS_START+1640L)  Use in MappTimer
+#define M_TRACE_ACTIVE                                (M_APP_INQUIRE_SYS_START+1641L)
+#if OldDefinesSupport
+   #define M_TRACE_ENABLED                            M_TRACE_ACTIVE
+   MIL_DEPRECATED(M_TRACE_ENABLED, 1010)
+#endif
+
+// Common App and Sys string types, next 200 values
+#define M_SYS_APP_INQUIRE_STRING_START                (M_APP_INQUIRE_SYS_START+1800L)
+
+#if MIL_COMPILE_VERSION < 1010
+#define M_INSTALLED_SYSTEM_DESCRIPTOR       ((M_APP_INQUIRE_SYS_START+1800L)|M_CLIENT_ENCODING)
+#define M_INSTALLED_SYSTEM_PRINT_NAME       ((M_APP_INQUIRE_SYS_START+1816L)|M_CLIENT_ENCODING)
+#define M_INSTALLED_SYSTEM_REG_KEY_NAME     ((M_APP_INQUIRE_SYS_START+1832L)|M_CLIENT_ENCODING)
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+      #define M_INSTALLED_SYSTEM_DESCRIPTOR_OLD       ((M_APP_INQUIRE_SYS_START+1800L)|M_CLIENT_ENCODING)
+      /* Reserve next 15 values               from    ((M_APP_INQUIRE_SYS_START+1801L)|M_CLIENT_ENCODING)*/
+      /*                                      to      ((M_APP_INQUIRE_SYS_START+1815L)|M_CLIENT_ENCODING)*/
+      #define M_INSTALLED_SYSTEM_PRINT_NAME_OLD       ((M_APP_INQUIRE_SYS_START+1816L)|M_CLIENT_ENCODING)
+      /* Reserve next 15 values               from    ((M_APP_INQUIRE_SYS_START+1817L)|M_CLIENT_ENCODING)*/
+      /*                                      to      ((M_APP_INQUIRE_SYS_START+1831L)|M_CLIENT_ENCODING)*/
+      #define M_INSTALLED_SYSTEM_REG_KEY_NAME_OLD     ((M_APP_INQUIRE_SYS_START+1832L)|M_CLIENT_ENCODING)
+      /* Reserve next 15 values               from    ((M_APP_INQUIRE_SYS_START+1833L)|M_CLIENT_ENCODING)*/
+      /*                                      to      ((M_APP_INQUIRE_SYS_START+1847L)|M_CLIENT_ENCODING)*/
+#endif
+      #define M_CLUSTER_SERVER_NAME                   ((M_APP_INQUIRE_SYS_START+1848L)|M_CLIENT_ENCODING)
+      #define M_TRACER_NAME                           ((M_APP_INQUIRE_SYS_START+1849L)|M_CLIENT_ENCODING)
+      #define M_TRACE_SAVE_TO_FILE                    ((M_APP_INQUIRE_SYS_START+1850L)|M_CLIENT_ENCODING)
+      #define M_MIL_DIRECTORY_INSTALL                 ((M_APP_INQUIRE_SYS_START+1851L)|M_CLIENT_ENCODING)
+      #define M_MIL_DIRECTORY_EXAMPLES                ((M_APP_INQUIRE_SYS_START+1852L)|M_CLIENT_ENCODING)
+      #define M_MIL_DIRECTORY_IMAGES                  ((M_APP_INQUIRE_SYS_START+1853L)|M_CLIENT_ENCODING)
+      #define M_MIL_DIRECTORY_CONTEXTS                ((M_APP_INQUIRE_SYS_START+1854L)|M_CLIENT_ENCODING)
+
+#if MIL_COMPILE_VERSION < 1010
+#if OldDefinesSupport
+#define M_NAME_OF_BOARD_TYPE                    M_INSTALLED_SYSTEM_DESCRIPTOR
+      MIL_DEPRECATED(M_NAME_OF_BOARD_TYPE, 1000)
+#define M_DISPLAY_NAME_OF_BOARD_TYPE            M_INSTALLED_SYSTEM_PRINT_NAME
+      MIL_DEPRECATED(M_DISPLAY_NAME_OF_BOARD_TYPE, 1000)
+#define M_REG_KEY_NAME_OF_BOARD_TYPE            M_INSTALLED_SYSTEM_REG_KEY_NAME
+      MIL_DEPRECATED(M_REG_KEY_NAME_OF_BOARD_TYPE, 1000)
+#define M_IMAGING_BOARD_TYPE                    M_INSTALLED_SYSTEM_REG_KEY_NAME
+      MIL_DEPRECATED(M_IMAGING_BOARD_TYPE, 1000)
+#endif
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #if OldDefinesSupport
+      #define M_NAME_OF_BOARD_TYPE                    M_INSTALLED_SYSTEM_DESCRIPTOR_OLD
+      MIL_DEPRECATED(M_NAME_OF_BOARD_TYPE, 1000)
+      #define M_DISPLAY_NAME_OF_BOARD_TYPE            M_INSTALLED_SYSTEM_PRINT_NAME_OLD
+      MIL_DEPRECATED(M_DISPLAY_NAME_OF_BOARD_TYPE, 1000)
+      #define M_REG_KEY_NAME_OF_BOARD_TYPE            M_INSTALLED_SYSTEM_REG_KEY_NAME_OLD
+      MIL_DEPRECATED(M_REG_KEY_NAME_OF_BOARD_TYPE, 1000)
+      #define M_IMAGING_BOARD_TYPE                    M_INSTALLED_SYSTEM_REG_KEY_NAME_OLD
+      MIL_DEPRECATED(M_IMAGING_BOARD_TYPE, 1000)
+   #endif
+#endif
+
+#if MIL_COMPILE_VERSION < 1010
+   #define M_INSTALLED_SYSTEM_DESCRIPTOR_SIZE     (M_STRING_SIZE + M_INSTALLED_SYSTEM_DESCRIPTOR)
+   #define M_INSTALLED_SYSTEM_PRINT_NAME_SIZE     (M_STRING_SIZE + M_INSTALLED_SYSTEM_PRINT_NAME)
+   #define M_INSTALLED_SYSTEM_REG_KEY_NAME_SIZE   (M_STRING_SIZE + M_INSTALLED_SYSTEM_REG_KEY_NAME)
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_INSTALLED_SYSTEM_DESCRIPTOR_SIZE_OLD     (M_STRING_SIZE + M_INSTALLED_SYSTEM_DESCRIPTOR_OLD)
+   #define M_INSTALLED_SYSTEM_PRINT_NAME_SIZE_OLD     (M_STRING_SIZE + M_INSTALLED_SYSTEM_PRINT_NAME_OLD)
+   #define M_INSTALLED_SYSTEM_REG_KEY_NAME_SIZE_OLD   (M_STRING_SIZE + M_INSTALLED_SYSTEM_REG_KEY_NAME_OLD)
+#endif
+
+#if OldDefinesSupport
+#define M_CLUSTER_SERVER_NAME_SIZE                 (M_STRING_SIZE + M_CLUSTER_SERVER_NAME)
+      MIL_DEPRECATED(M_CLUSTER_SERVER_NAME_SIZE, 1040)
+#endif
+#define M_SYS_APP_INQUIRE_STRING_END               (M_APP_INQUIRE_SYS_START+1999L)
+
+
+#define M_LICENSE_MODULES                             (M_APP_INQUIRE_SYS_START+2002L)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#endif
+#define M_KEY_CUSTOM_VALUE                            (M_APP_INQUIRE_SYS_START+2029L)
+
+
+
+#define M_LICENSE_FINGERPRINT                         (M_APP_INQUIRE_SYS_START+5480L)
+#define M_NUMBER_OF_KEYS                              (M_APP_INQUIRE_SYS_START+6506L)
+
+
+
+// Common App and Sys string types, next 200 values
+#define M_SYS_APP_INQUIRE_STRING_2_START              (M_APP_INQUIRE_SYS_START+7000)
+
+#if MIL_COMPILE_VERSION >= 1010
+#define M_INSTALLED_SYSTEM_DESCRIPTOR           ((M_APP_INQUIRE_SYS_START+7000L)|M_CLIENT_ENCODING)
+/* Reserve next 63 values               from    ((M_APP_INQUIRE_SYS_START+7001L)|M_CLIENT_ENCODING)*/
+/*                                      to      ((M_APP_INQUIRE_SYS_START+7063L)|M_CLIENT_ENCODING)*/
+#define M_INSTALLED_SYSTEM_PRINT_NAME           ((M_APP_INQUIRE_SYS_START+7064L)|M_CLIENT_ENCODING)
+/* Reserve next 63 values               from    ((M_APP_INQUIRE_SYS_START+7065L)|M_CLIENT_ENCODING)*/
+/*                                      to      ((M_APP_INQUIRE_SYS_START+7127L)|M_CLIENT_ENCODING)*/
+#define M_INSTALLED_SYSTEM_REG_KEY_NAME         ((M_APP_INQUIRE_SYS_START+7128L)|M_CLIENT_ENCODING)
+/* Reserve next 63 values               from    ((M_APP_INQUIRE_SYS_START+7129L)|M_CLIENT_ENCODING)*/
+/*                                      to      ((M_APP_INQUIRE_SYS_START+7191L)|M_CLIENT_ENCODING)*/
+
+#if OldDefinesSupport
+#define M_INSTALLED_SYSTEM_DESCRIPTOR_SIZE         (M_STRING_SIZE + M_INSTALLED_SYSTEM_DESCRIPTOR)
+#define M_INSTALLED_SYSTEM_PRINT_NAME_SIZE         (M_STRING_SIZE + M_INSTALLED_SYSTEM_PRINT_NAME)
+#define M_INSTALLED_SYSTEM_REG_KEY_NAME_SIZE       (M_STRING_SIZE + M_INSTALLED_SYSTEM_REG_KEY_NAME)
+
+MIL_DEPRECATED(M_INSTALLED_SYSTEM_DESCRIPTOR_SIZE   , 1040)
+MIL_DEPRECATED(M_INSTALLED_SYSTEM_PRINT_NAME_SIZE   , 1040)
+MIL_DEPRECATED(M_INSTALLED_SYSTEM_REG_KEY_NAME_SIZE , 1040)
+#endif
+#endif
+
+
+#define M_GENTL_PRODUCER_DESCRIPTOR             ((M_APP_INQUIRE_SYS_START+7192L)|M_CLIENT_ENCODING)
+#define M_GENTL_PRODUCER_DESCRIPTION            M_GENTL_PRODUCER_DESCRIPTOR
+/* Reserve next 63 values               from    ((M_APP_INQUIRE_SYS_START+7193L)|M_CLIENT_ENCODING)*/
+/*                                      to      ((M_APP_INQUIRE_SYS_START+7255L)|M_CLIENT_ENCODING)*/
+
+#if OldDefinesSupport
+#define M_GENTL_PRODUCER_DESCRIPTOR_SIZE           (M_STRING_SIZE + M_GENTL_PRODUCER_DESCRIPTOR)
+#define M_GENTL_PRODUCER_DESCRIPTION_SIZE          M_GENTL_PRODUCER_DESCRIPTOR_SIZE
+MIL_DEPRECATED(M_GENTL_PRODUCER_DESCRIPTOR_SIZE , 1040)
+#endif
+
+#define M_KEY_SERIAL_NUMBER                     ((M_APP_INQUIRE_SYS_START+7264L)|M_CLIENT_ENCODING)
+
+
+
+#define M_SYS_APP_INQUIRE_STRING_2_END             (M_APP_INQUIRE_SYS_START+7399L)
+
+
+/*Reserve values between M_REG_DEF_START and M_REG_DEF_END*/
+/*Reserve values between M_REG_DEF_START and M_REG_DEF_END*/
+#define M_DIRECT_ACCESS_2_START                 (M_APP_INQUIRE_SYS_START+8000L)
+
+#define M_REG_DEF_2_START                       (M_APP_INQUIRE_SYS_START+8000L)                               
+#define M_APP_INQUIRE_REG_DEF_STRING_2_START      (M_APP_INQUIRE_SYS_START+8000L)                             
+#define M_APP_INQUIRE_REG_DEF_STRING_2_END        (M_APP_INQUIRE_SYS_START+8959L)                             
+#define M_REG_DEF_2_END                         (M_APP_INQUIRE_SYS_START+9791L)
+#define M_DIRECT_ACCESS_2_END                   (M_APP_INQUIRE_SYS_START+9791L)
+
+
+#if MIL_COMPILE_VERSION >= 1010
+#define M_BOARD_DEFAULTS_PTR                     (M_APP_INQUIRE_SYS_START+9792L)
+/* reserve value up to                           (M_APP_INQUIRE_SYS_START+9855L) */
+
+#define M_INSTALLED_SYSTEM_CAN_GRAB              (M_APP_INQUIRE_SYS_START+9856L)
+/* Reserved the next values               from   (M_APP_INQUIRE_SYS_START+9857L)*/
+/*                                        to     (M_APP_INQUIRE_SYS_START+9919L)*/
+
+#define M_INSTALLED_SYSTEM_TYPE                   (M_APP_INQUIRE_SYS_START+9920L)
+/* Reserved the 63 next values            from    (M_APP_INQUIRE_SYS_START+9921L)*/
+/*                                        to      (M_APP_INQUIRE_SYS_START+9983L)*/
+#define M_IS_DISTRIBUTED_BOARD                    (M_APP_INQUIRE_SYS_START+9984L)
+/* Reserve next 63 values                from     (M_APP_INQUIRE_SYS_START+9985L)*/
+/*                                       to       (M_APP_INQUIRE_SYS_START+10048L)*/
+#endif
+
+
+#define M_DIRECT_ACCESS_3_START                 (M_APP_INQUIRE_SYS_START+10050L)
+#define M_REG_DEF_3_START                       (M_APP_INQUIRE_SYS_START+10050L)
+
+
+
+
+#define M_REG_DEF_3_END                          (M_APP_INQUIRE_SYS_START+10369L)
+
+
+#define M_DIRECT_ACCESS_3_END                    (M_APP_INQUIRE_SYS_START+10369L)
+
+#define M_INSTALLED_SYSTEM_DEVICE_COUNT         (M_APP_INQUIRE_SYS_START+10500L)
+/* Reserve values from                          (M_APP_INQUIRE_SYS_START+10501L)*/
+/*                to                            (M_APP_INQUIRE_SYS_START+10563L)*/
+
+
+#define M_IN_DIRECT_ACCESS_RANGE(X)             ( ((M_STRIP_INTERMOD_BITS(X) >= M_DIRECT_ACCESS_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_DIRECT_ACCESS_END  ) ) || \
+                                                  ((M_STRIP_INTERMOD_BITS(X) >= M_DIRECT_ACCESS_2_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_DIRECT_ACCESS_2_END  ) ) || \
+                                                  ((M_STRIP_INTERMOD_BITS(X) >= M_DIRECT_ACCESS_3_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_DIRECT_ACCESS_3_END  ) ) || \
+                                                   (X == M_REBOOT_NEEDED))
+
+#define M_IN_REG_DEF_RANGE(X)                   ( ((M_STRIP_INTERMOD_BITS(X) >= M_REG_DEF_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_REG_DEF_END  ) ) || \
+                                                  ((M_STRIP_INTERMOD_BITS(X) >= M_REG_DEF_2_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_REG_DEF_2_END  ) ) || \
+                                                  ((M_STRIP_INTERMOD_BITS(X) >= M_REG_DEF_3_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_REG_DEF_3_END  ) ) )
+
+
+#define M_APP_INQUIRE_SYS_END                         30000L
+
+/************************************************************************/
+/* MappInquireMp() / MappControlMp() Types                              */
+/* MthrInquireMp() / MthrControlMp() Types                              */
+/************************************************************************/
+#define M_CORE_MAX_FOR_COPY                           1586L
+#define M_CORE_MAX                                    1587L
+#define M_MP_USER_THREAD                              1588L
+#define M_MP_PRIORITY                                 1589L
+#define M_CORE_AFFINITY_MASK                          1590L
+#define M_CORE_SHARING                                1591L
+#define M_MP_USE                                      (M_APP_INQUIRE_SYS_START+128L) // 15128
+
+#define M_FOLLOW_CORE_MAX                             0x00040000L
+
+// MappXXXMp only
+#define M_CORE_PARKING_STATE                          1789L
+#define M_CORE_THROTTLING_STATE                       1790L
+
+// MappInquireMp only
+#define M_CORE_NUM_PROCESS                            1592L
+#define M_MP_FORCED_DISABLE                           1593L
+#define M_CORE_NUM_HARDWARE                           1594L
+#define M_MEMORY_BANK_NUM                             1595L
+#define M_MEMORY_BANK_AFFINITY_MASK                   1596L
+#define M_MEMORY_BANK_CORE_AFFINITY_MASK              1597L
+#define M_CORE_MEMORY_BANK                            1598L
+#define M_CORE_MEMORY_BANK_AFFINITY_MASK              1599L
+//#define unused                                      1600L
+#define M_CORE_AFFINITY_MASK_ARRAY_SIZE               1601L
+#define M_MEMORY_BANK_AFFINITY_MASK_ARRAY_SIZE        1602L
+#define M_CORE_AFFINITY_MASK_PROCESS                  1642L
+#define M_CORE_AFFINITY_MASK_HARDWARE                 1647L
+//#define unused                                      1650L
+#define M_CORE_NUM_OS                                 1651L
+
+
+// MappControlMp only
+#define M_CORE_FORCE_NB                               1603L
+#define M_MP_POOL_SIZE                                1604L
+#define M_MP_SPIN_LOOP_COUNT                          1605L
+#define M_CORE_FORCE_ONE                              1606L
+#define M_MP_USE_INTERNAL_FORCED                      1608L
+#define M_MP_THRESHOLD_RESTRICTION                    (1609L | M_CLIENT_ENCODING)
+
+// MthrInquireMp only
+//#define unused                                      1652L
+#define M_CORE_NUM_EFFECTIVE                          M_CORE_NUM_PROCESS
+
+
+
+#if OldDefinesSupport
+#define M_CORE_NUM                                    M_CORE_NUM_PROCESS            // To support Mil9PP2 EA users
+MIL_DEPRECATED(M_CORE_NUM, 1000)
+#define M_MP_FORCE_DISABLE                            M_MP_FORCED_DISABLE           // To support Mil9PP2 EA users
+MIL_DEPRECATED(M_MP_FORCE_DISABLE, 1000)
+#define M_APPLICATION_CORE_AFFINITY_MASK              M_CORE_AFFINITY_MASK_PROCESS  // To support Mil9PP2 EA users
+MIL_DEPRECATED(M_APPLICATION_CORE_AFFINITY_MASK, 1000)
+#endif
+
+
+/************************************************************************/
+/* Licensing: Module information                                        */
+/************************************************************************/
+#define M_LICENSE_LITE               0x00000001L //0L
+#define M_LICENSE_DEBUG              0x00000002L //1L
+#define M_LICENSE_IM                 0x00000004L //2L
+#define M_LICENSE_CODE               0x00000008L //3L
+#define M_LICENSE_MEAS               0x00000010L //4L
+#define M_LICENSE_BEAD               M_LICENSE_MEAS
+#define M_LICENSE_PAT                0x00000020L //5L
+#define M_LICENSE_MOD                0x00000040L //6L
+#define M_LICENSE_JPEG2000           0x00000080L //7L
+#define M_LICENSE_BGA                0x00000100L //8L
+#define M_LICENSE_BLOB               0x00000200L //9L
+#define M_LICENSE_CAL                0x00000400L //10L
+#define M_LICENSE_OCR                0x00000800L //11L
+#define M_LICENSE_JPEGSTD            0x00001000L //12L
+#define M_LICENSE_STR                0x00002000L //13L
+#define M_LICENSE_DMR                M_LICENSE_STR
+#define M_LICENSE_MET                0x00004000L //14L
+#define M_LICENSE_COL                0x00008000L //15L
+#define M_LICENSE_3DSUP              0x00010000L //16L
+#define M_LICENSE_CLASS              0x00020000L //17L
+#if OldDefinesSupport
+   #define M_LICENSE_3DMAP           M_LICENSE_3DSUP
+   #define M_LICENSE_3DPR            M_LICENSE_3DMAP
+   MIL_DEPRECATED(M_LICENSE_3DPR, 1000)
+   MIL_DEPRECATED(M_LICENSE_3DMAP, 1050)
+#endif
+#define M_LICENSE_REG                0x00040000L //18L
+#define M_LICENSE_DMILC              0x00200000L //21L
+#define M_LICENSE_INSPECTOR          0x00400000L //22L
+#if OldDefinesSupport
+#define M_LICENSE_INSP40            M_LICENSE_INSPECTOR
+   MIL_DEPRECATED(M_LICENSE_INSP40, 1000)
+#endif
+#define M_LICENSE_SER                0x00800000L //23L
+#define M_LICENSE_INTERFACE          M_LICENSE_SER
+#define M_LICENSE_EDGE               0x01000000L //24L
+#define M_LICENSE_DMIL               0x04000000L //26L
+#define M_LICENSE_3DCA               0x08000000L //27L
+#define M_LICENSE_COM                0x10000000L //28L
+#define M_LICENSE_GPU                0x20000000L //29L
+#define M_LICENSE_DA0                MAKE_INT64(0x0000000100000000) //32L
+#define M_LICENSE_DA1                MAKE_INT64(0x0000000200000000) //33L
+
+#define M_LIC_FINGERPRINT_TYPE(N)                     (M_LICENSE_FINGERPRINT+(N * M_MAX_FINGERPRINTS_PER_TYPE))
+#define M_MORPHISQXT_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(16)
+#define M_NEXIS_FINGERPRINT                           M_LIC_FINGERPRINT_TYPE(17)
+#define M_VIO_FINGERPRINT                             M_LIC_FINGERPRINT_TYPE(18)
+#define M_4SIGHTM_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(19)
+#define M_SOLIOS_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(20)
+#define M_1394_FINGERPRINT                            M_LIC_FINGERPRINT_TYPE(21)
+#define M_CONCORD_1394_FINGERPRINT                    M_1394_FINGERPRINT
+#define M_IRISGTR_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(22)
+#define M_INDIO_FINGERPRINT                           M_LIC_FINGERPRINT_TYPE(23)
+#define M_RAPIXOCXP_FINGERPRINT                       M_LIC_FINGERPRINT_TYPE(24)
+#define M_SUPERSIGHT_ARBOR_FINGERPRINT                M_LIC_FINGERPRINT_TYPE(25)
+#define M_NEXIS3_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(26)
+#define M_CRONOSPLUS_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(27)
+#define M_RAPIXOCL_FINGERPRINT                        M_LIC_FINGERPRINT_TYPE(28)
+#define M_MORPHIS_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(29)
+#define M_IRIS_FINGERPRINT                            M_LIC_FINGERPRINT_TYPE(30)
+#define M_ORIONHD_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(32)
+#define M_CONCORD_GIGE_FINGERPRINT                    M_LIC_FINGERPRINT_TYPE(33)
+#define M_RADIENTEVCL_FINGERPRINT                     M_LIC_FINGERPRINT_TYPE(34)
+#define M_4SIGHTX_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(35)
+#define M_4SIGHTGPM_FINGERPRINT                       M_LIC_FINGERPRINT_TYPE(36)
+#define M_IRISGT_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(37)
+#define M_RADIENT_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(38)
+#define M_SUPERSIGHT_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(39)
+#define M_NEXIS2_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(40)
+#define M_RADIENTPRO_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(41)
+#define M_RADIENTCXP_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(42)
+#define M_RADIENTCLHS_FINGERPRINT                     M_LIC_FINGERPRINT_TYPE(43)
+#define M_4SIGHTGP_FINGERPRINT                        M_LIC_FINGERPRINT_TYPE(44)
+#define M_USB3_FINGERPRINT                            M_LIC_FINGERPRINT_TYPE(45)
+#define M_CONCORDPOE_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(46)
+#define M_CUSTOM_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(49)
+#define M_MSERIES_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(53)
+#define M_ID_KEY_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(55)
+#define M_MATROX_BOARD_FINGERPRINT                    M_LIC_FINGERPRINT_TYPE(62)
+#define M_ANY_FINGERPRINT                             M_MATROX_BOARD_FINGERPRINT
+
+/************************************************************************/
+/* MWrite() / MpatRead() Types                                          */
+/************************************************************************/
+#define M_FILE                                        25L
+
+#define M_DRAW_DONT_CARE                              0x00000008L   // Also define in MilPat.h and MilMod.h
+#if OldDefinesSupport
+   #define M_DRAW_DONT_CARES                          M_DRAW_DONT_CARE 
+   MIL_DEPRECATED(M_DRAW_DONT_CARES, 1010)
+#endif
+
+/************************************************************************/
+/* MmodControl() / MedgeControl() / MmetControl ControlTypes            */
+/************************************************************************/
+#if OldDefinesSupport
+   #define M_KERNEL_DEPTH                    368L 
+   #define M_KERNEL_WIDTH                    109L 
+   MIL_DEPRECATED(M_KERNEL_DEPTH, 1010)
+   MIL_DEPRECATED(M_KERNEL_WIDTH, 1010)
+#endif
+
+/************************************************************************/
+/* MappInquire() / MappControl() Values                                 */
+/************************************************************************/
+#define M_PARAMETER_CHECK                    0x00000001L
+#define M_PRINT_DISABLE                               0L
+#define M_PRINT_ENABLE                                1L
+#define M_CHECK_DISABLE                               2L
+#define M_CHECK_ENABLE                                3L
+#define M_COMPENSATION_DISABLE                        4L
+#define M_COMPENSATION_ENABLE                         5L
+#define M_HOOK_CONTEXT_SIZE                           6L
+#define M_ENABLE_FOR_ALL_FUNCTIONS                    7L
+#define M_DISABLE_FOR_ALL_FUNCTIONS                   8L
+#define M_DISP_HOOK_CONTEXT_SIZE                     10L
+#define M_THROW_EXCEPTION                            11L          /* Value to enable exceptions in the MIL .NET wrapper (.NET only)  */
+#define M_COMPONENT_RESELECT_DISABLE                 12L
+#define M_COMPONENT_RESELECT_ENABLE                  13L
+#define M_DMIL_CONTROL                                1L
+#define M_DMIL_MONITOR                                2L
+#define M_MIL_SETUP                                   2L
+
+#define M_INTERNAL_USE                       0x00000004L
+#define M_READ_WRITE                         0x00000010L
+#define M_READ_ONLY                          0x00000020L
+
+                                                                  /* Bit field exclusive to M_TRACE  to M_PROCESSING      (3L to 6L) */
+#define M_THREAD_CURRENT                              0x01000000L /*                        M_TRACE_START                       (1L) */
+                                                                  /*                        M_TRACE_END                         (2L) */
+                                                                  /*                        M_ERROR                     (0x40000000) */
+                                                                  /*                        M_MESSAGE                   (0x20000000) */
+                                                                  /*                        M_CURRENT to M_REGION_SIZE_Y (1L to 44L) */
+                                                                  /*                        M_UNHOOK                    (0x04000000) */
+
+// Possible value for the M_PANEL control
+#define M_ENABLE                                      -9997L
+#define M_DISABLE                                     -9999L
+#define M_UPDATE_PANEL                                   1L
+#define M_CLOSE_FROM_DLL                                 64L
+
+// Values returned by MappInquire(M_DMA_MANAGER_TYPE)
+#define DMA_MANAGER_TYPE_MTXDMA                                1
+#define DMA_MANAGER_TYPE_MEMMAN                                2
+#define DMA_MANAGER_TYPE_SERVMAN                               4
+
+// values returned by MappInquire/MsysInquire(M_PLATFORM_OS_TYPE)
+#define M_OS_WINDOWS                                           1
+#define M_OS_WINDOWS_CE                                        2
+#define M_OS_LINUX                                             3
+#define M_OS_RTX                                               5
+
+// M_TRACE value.
+#define M_LOG_DISABLE                                 M_PRINT_DISABLE
+#define M_LOG_ENABLE                                  M_PRINT_ENABLE
+#define M_TRACER_BIN_FILE                             0x00000002
+#define M_TRACER_TXT_FILE                             0x00000004
+#define M_TRACER_CONSOLE                              0x00000008
+#define M_TRACER_MEM                                  0x00000040
+
+
+
+#define M_BEEP_DEF(FREQ, DURATION)                    ((MIL_INT)((((FREQ) & 0xFFFF) << 16) | ((DURATION) & 0xFFFF)))
+#define M_EXTRACT_BEEP_FREQ(CODE)                     (MIL_UINT32)(((CODE) >> 16) & 0xFFFF)
+#define M_EXTRACT_BEEP_DURATION(CODE)                 (MIL_UINT32)((CODE) & 0xFFFF)
+
+
+/************************************************************************/
+/* MappInquireConnection()                                              */
+/************************************************************************/
+#define M_DMIL_PUBLISHED_LIST                   1
+#define M_DMIL_PUBLISHED_LIST_SIZE              2
+
+#define M_DMIL_PUBLISHED_NAME                   (3 | M_CLIENT_ENCODING)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_PUBLISHED_NAME                    (6 | M_CLIENT_ENCODING)
+#define M_OLD_WEB_PUBLISHED_LIST                    4
+#define M_OLD_WEB_PUBLISHED_LIST_SIZE               5
+#endif
+#define M_WEB_PUBLISHED_NAME                       (7 | M_CLIENT_ENCODING)
+// Reserve User M_WEB_PUBLISHED_NAME +1            (8 | M_CLIENT_ENCODING)
+// Reserve User M_WEB_PUBLISHED_NAME +2            (9 | M_CLIENT_ENCODING)
+// Reserve FB   M_WEB_PUBLISHED_NAME +3            (10 | M_CLIENT_ENCODING)
+// Reserve DA   M_WEB_PUBLISHED_NAME +4            (11 | M_CLIENT_ENCODING)
+#define M_WEB_PUBLISHED_LIST                       12
+// Reserve User M_WEB_PUBLISHED_LIST + 1           13
+// Reserve User M_WEB_PUBLISHED_LIST + 2           14
+// Reserve FB   M_WEB_PUBLISHED_LIST + 3           15
+// Reserve DA   M_WEB_PUBLISHED_LIST + 4           16
+#define M_WEB_PUBLISHED_LIST_SIZE                  17
+// Reserve User M_WEB_PUBLISHED_LIST_SIZE + 1      18
+// Reserve User M_WEB_PUBLISHED_LIST_SIZE + 2      19
+// Reserve FB   M_WEB_PUBLISHED_LIST_SIZE + 3      20
+// Reserve DA   M_WEB_PUBLISHED_LIST_SIZE + 4      21
+
+/************************************************************************/
+/* MappTimer()                                                          */
+/************************************************************************/
+#define M_TIMER_MODE_MASK                             0x000F0000L
+#define M_FIRST_TIMER_MODE                            0x00010000L
+#define M_TIMER_RESOLUTION                            0x00010000L
+#define M_TIMER_RESET                                 0x00020000L
+#define M_TIMER_READ                                  0x00030000L
+#define M_TIMER_WAIT                                  0x00040000L
+#define M_TIMER_COMPENSATION                          0x00050000L
+#define M_TIMER_WAIT_EXACT                            0x00060000L
+#define M_TIMER_LOCK_TO_CPU                           0x00070000L
+#define M_TIMER_UNLOCK_FROM_CPU                       0x00080000L
+#define M_TIMER_USE_CPU                               0x00090000L
+#define M_TIMER_USE_OS                                0x000A0000L
+#define M_LAST_TIMER_MODE                             M_TIMER_USE_OS // Update this define if other modes are added.
+
+// Following defines are bitwise
+#define M_SYNCHRONOUS                                 0x00000001L
+
+#define M_GLOBAL                                      0x00000008L
+#define M_TRACE                                       0x00004100L  // Also used in M_APP_INQUIRE_SYS range.
+#define M_TIMER_FLAG_MASK                             (M_TRACE|M_GLOBAL)
+
+
+// Utility macro
+#define M_TIMER_MODE_IS_VALID(m)                      ( ((m&(~M_TIMER_MODE_MASK)) == 0) &&                  \
+                                                        ((m&M_TIMER_MODE_MASK) >= M_FIRST_TIMER_MODE) &&    \
+                                                        ((m&M_TIMER_MODE_MASK) <= M_LAST_TIMER_MODE) )
+
+/************************************************************************/
+/* MappFileOperation()                                                  */
+/************************************************************************/
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_FILE_EXECUTE                                      (0x100 + M_SYNCHRONOUS)
+#else
+#define M_FILE_EXECUTE                                      0x100
+#endif
+#define M_FILE_DELETE                                       0x200
+#define M_FILE_COPY                                         0x300
+#define M_FILE_COPY_MIL_DLL                                 0x400
+#define M_FILE_MAKE_DIR                                     0x500
+#define M_FILE_DELETE_DIR                                   0x600
+#define M_FILE_DISPATCH                                     0x700
+#define M_FILE_EXISTS                                       0x800
+#define M_FILE_EXISTS_MIL_DLL                               0x900
+#define M_FILE_COPY_MIL_USER_DLL                            0xA00
+#define M_FILE_EXISTS_MIL_USER_DLL                          0xB00
+#define M_FILE_MOVE                                         0xC00
+#define M_FILE_NAME_FIND_COUNT                              0xD00
+#define M_FILE_NAME_FIND                                    (0xE00 + M_CLIENT_ENCODING)
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+
+/************************************************************************/
+/* Binary functions in BLOB module.                                     */
+/************************************************************************/
+#define M_LENGTH                                      0x00002000L
+
+/************************************************************************/
+/* MmeasCalculate(), MmeasGetResult(), MpatGetResult() */
+/************************************************************************/
+#define M_ANGLE                                       0x00000800L
+#define M_ORIENTATION                                 0x00002400L
+#if OldDefinesSupport
+   #define M_ALL_OLD                                           0L 
+   MIL_DEPRECATED(M_ALL_OLD, 1010)
+#endif
+
+/************************************************************************/
+/* MblobControl() and/or MblobInquire() values and MmeasControl()       */
+/************************************************************************/
+#define M_PIXEL_ASPECT_RATIO                          5L
+
+/************************************************************************/
+/* McolDistance()                                                       */
+/************************************************************************/
+#define M_MAHALANOBIS_SAMPLE                       5L          // value for M_DISTANCE_TYPE
+#define M_MAHALANOBIS                              M_MAHALANOBIS_SAMPLE
+
+/***********************************************************************/
+/* MfuncParam... defines                                               */
+/***********************************************************************/
+#define M_FILE_READ                                   M_IN
+#define M_FILE_WRITE                                  M_OUT
+#define M_FPGA_FUNC_MAX_NB_PARAM                      M_NB_MAX_PARAMETER
+
+/***********************************************************************/
+/* MfuncDriverCall... defines                                          */
+/***********************************************************************/
+#define M_DONT_CONVERT_ID                             1L
+
+/************************************************************************/
+/* MfuncPrintMessage() defines                                          */
+/************************************************************************/
+// Return Value
+#define M_RESP_YES                                    1L
+#define M_RESP_NO                                     2L
+#define M_RESP_CANCEL                                 4L
+#define M_RESP_OK                                     8L
+
+// Mode
+#define M_RESP_OK                                     8L
+#define M_RESP_YES_NO                                 (M_RESP_YES|M_RESP_NO)
+#define M_RESP_YES_NO_CANCEL                          (M_RESP_YES|M_RESP_NO|M_RESP_CANCEL)
+#define M_RESP_BUTTONS_MASK                         0xFL
+// Additional Mode
+#define M_ICON_STOP                          0x00000010L
+#define M_ICON_EXCLAMATION                   0x00000030L
+#define M_ICON_MASK                          0x000000F0L
+#define M_ERROR_TITLE                        0x00000100L
+#define M_ST_ERROR_TITLE                     0x00000200L
+
+/************************************************************************/
+/* MfuncCalibrationInfo() defines                                       */
+/************************************************************************/
+
+
+#define M_CALIBRATION_STREAM_SIZE            0L    // already defined in mcalinfo.h
+#define M_GET_CALIBRATION_INFO               1L    // already defined in mcalinfo.h
+#define M_SET_CALIBRATION_INFO               2L    // already defined in mcalinfo.h
+#define M_COPY_CALIBRATION_INFO              3L    // already defined in mcalinfo.h
+#define M_GET_CALIBRATION_ID                 4L    // already defined in mcalinfo.h
+#define M_SET_CALIBRATION_ID                 5L    // already defined in mcalinfo.h
+#define M_CHANGE_ID_IN_CAL_STREAM            6L    // already defined in mcalinfo.h
+
+#define M_ADD_CALIBRATION_USE                17L   // already defined in mcalinfo.h
+#define M_REMOVE_CALIBRATION_USE             18L   // already defined in mcalinfo.h
+#define M_USE_CALIBRATION                    19L   // already defined in mcalinfo.h
+// other defines in mcalinfo.h
+
+#define M_WORLD                         0x2000L
+#if OldDefinesSupport
+   #define M_OUTPUT_COORDINATE_SYSTEM         M_OUTPUT_UNITS
+   MIL_DEPRECATED(M_OUTPUT_COORDINATE_SYSTEM, 1010)
+   #define M_OUTPUT_UNITS                     122L // deprecated: use M_RESULT_OUTPUT_UNITS
+   MIL_DEPRECATED(M_OUTPUT_UNITS, 1060)
+#endif
+#define M_SAVE                           0x100L
+#define M_ACCORDING_TO_CALIBRATION        1301L
+
+/************************************************************************/
+/* MfuncAlloc/MfuncAllocScript defines                                  */
+/************************************************************************/
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_USER_FUNCTION                     0x4000E000
+#define M_USER_MODULE_1                     0x4000E200
+#define M_USER_MODULE_2                     0x4000E400
+#define M_USER_MODULE_3                     0x4000E600
+#define M_USER_MODULE_4                     0x4000E800
+#define M_USER_MODULE_5                     0x4000EA00
+#define M_USER_MODULE_6                     0x4000EC00
+#define M_USER_MODULE_7                     0x4000EE00
+#define M_SCRIPT_FUNCTION                   0x4000F000
+#define M_SCRIPT_MODULE_1                   0x4000F200
+#define M_SCRIPT_MODULE_2                   0x4000F400
+#define M_USER_MODULE_FPGA                  0x4000FC00
+#else
+#define M_USER_FUNCTION                     0x40007000
+#define M_USER_MODULE_1                     0x40007100
+#define M_USER_MODULE_2                     0x40007200
+#define M_USER_MODULE_3                     0x40007300
+#define M_USER_MODULE_4                     0x40007400
+#define M_USER_MODULE_5                     0x40007500
+#define M_USER_MODULE_6                     0x40007600
+#define M_USER_MODULE_7                     0x40007700
+#define M_SCRIPT_FUNCTION                   0x40007800
+#define M_SCRIPT_MODULE_1                   0x40007900
+#define M_SCRIPT_MODULE_2                   0x40007A00
+#define M_USER_MODULE_FPGA                  0x40007E00
+#endif
+#define M_USER_FPGA_FUNCTION                M_USER_MODULE_FPGA
+
+// InitFlag values
+#define M_ALLOC                             0x00010000   // Update opcodes.h accordingly
+#define M_FREE                              0x00020000   // Update opcodes.h accordingly
+#define M_SYNCHRONOUS_FUNCTION              0x00080000   // Update opcodes.h accordingly
+#define M_ASYNCHRONOUS_FUNCTION             0x00000000
+#define M_LOCAL                             0x01000000   // Update opcodes.h accordingly
+#define M_REMOTE                            0x00000000
+#define M_REGISTER_FUNCTION                 MAKE_INT64(0x100000000)
+
+// Reserved: 0x00000001
+#define M_DONT_ADD_ALWAYS_LOCAL             0x00000040L  // Update decstatus.h accordingly
+#if MIL_COMPILE_VERSION < 1010
+#define M_INTERNAL_CALL                     0x00000004L  // Update decstatus.h accordingly
+#else
+#define M_INTERNAL_CALL                     0x00000100L  // Update decstatus.h accordingly
+#endif
+#define M_NON_PORTABLE_CALL                 0x00000008L  // Update decstatus.h accordingly
+#if MIL_COMPILE_VERSION < 1010
+#define M_STATUS_MASK                       0x0000004CL
+#else
+#define M_STATUS_MASK                       0x00000148L
+#endif
+#define M_STACK_BASED_FUNCTION              0x02000000L
+
+#define M_NB_MAX_PARAMETER                  16L
+#define M_NUMBER_OF_USER_MODULES            16L
+
+#define M_NON_PAGED                         0x00200000L
+#define M_PAGED                             0x02000000L
+#define M_DEFAULT                           0x10000000L
+
+/************************************************************************/
+/* MfuncAllocScript defines                                             */
+/************************************************************************/
+
+#define M_INTERPRETER_CSHARP              MIL_TEXT("MilInterpCSharp.dll")
+#define M_INTERPRETER_VB_DOT_NET          MIL_TEXT("MilInterpVBNet.dll")
+#define M_INTERPRETER_C_PYTHON38          MIL_TEXT("MilInterpPython38.dll")
+#define M_INTERPRETER_C_PYTHON37          MIL_TEXT("MilInterpPython37.dll")
+#define M_INTERPRETER_C_PYTHON36          MIL_TEXT("MilInterpPython36.dll")
+#define M_INTERPRETER_C_PYTHON27          MIL_TEXT("MilInterpPython27.dll")
+#define M_INTERPRETER_CUSTOM(dllpath)     dllpath
+
+/************************************************************************/
+/* Custom Scripting Interpreter defines                                 */
+/************************************************************************/
+
+
+/************************************************************************/
+/* MfuncControl/MfuncInquire() defines                                  */
+/************************************************************************/
+#define M_USER_DATA_PTR            0x00000001
+#define M_DRIVER_INFO_PTR                   2
+#if MIL_COMPILE_VERSION < 1010
+#else
+#endif
+
+
+#define M_OBJECT_PTR                       10
+#define M_SLAVE_FUNCTION_PTR               13
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#endif
+#define M_SLAVE_FUNCTION_OPCODE            18
+#define M_PARAM_NUMBER                     20
+#define M_OBJECT_LOCK                      22
+#define M_DRIVER_HOOK_CONTEXT_ID           25
+#define M_OBJECT_TYPE_EXTENDED             29
+#define M_IS_NOT_INTERNAL_OBJECT           31
+#define M_ACTIVE_ERROR                     32
+#define M_TRACE_LEVEL                      34
+#define M_MIL_DLL_IN_DEBUG_MODE            38
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#define M_IS_CLIENT_UNICODE                41
+#endif
+/***********************************************************************
+ * FuncInquire string types
+ ***********************************************************************/
+#define M_FUNC_INQUIRE_STRING_START                   47
+
+#define M_OBJECT_NAME                           ((M_FUNC_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING)
+#define M_FUNCTION_NAME_FROM_OPCODE             ((M_FUNC_INQUIRE_STRING_START+1)|M_CLIENT_ENCODING)
+#define M_FUNCTION_NAME                         ((M_FUNC_INQUIRE_STRING_START+2)|M_CLIENT_ENCODING)
+#define M_SLAVE_DLL_NAME                        ((M_FUNC_INQUIRE_STRING_START+3)|M_CLIENT_ENCODING)
+#define M_SLAVE_FUNCTION_NAME                   ((M_FUNC_INQUIRE_STRING_START+4)|M_CLIENT_ENCODING)
+#define M_SCRIPT_FUNCTION_NAME                  ((M_FUNC_INQUIRE_STRING_START+5)|M_CLIENT_ENCODING)
+#define M_INTERPRETER_PATH                      M_SLAVE_DLL_NAME
+#define M_SCRIPT_PATH                           ((M_FUNC_INQUIRE_STRING_START+6)|M_CLIENT_ENCODING)
+#define M_DEBUG_INFORMATION_PATH                ((M_FUNC_INQUIRE_STRING_START+7)|M_CLIENT_ENCODING)
+#define M_ADD_SCRIPT_REFERENCE                  ((M_FUNC_INQUIRE_STRING_START+8)|M_CLIENT_ENCODING)
+/* Reserve next values  from                    ((M_FUNC_INQUIRE_STRING_START+9)|M_CLIENT_ENCODING)
+                        to                      ((M_FUNC_INQUIRE_STRING_START+58)|M_CLIENT_ENCODING)*/
+
+
+#if OldDefinesSupport
+   #define M_OBJECT_NAME_SIZE                         (M_STRING_SIZE + M_OBJECT_NAME)
+   #define M_FUNCTION_NAME_FROM_OPCODE_SIZE           (M_STRING_SIZE + M_FUNCTION_NAME_FROM_OPCODE)
+   #define M_FUNCTION_NAME_SIZE                       (M_STRING_SIZE + M_FUNCTION_NAME)
+   #define M_SLAVE_DLL_NAME_SIZE                      (M_STRING_SIZE + M_SLAVE_DLL_NAME)
+   #define M_SLAVE_FUNCTION_NAME_SIZE                 (M_STRING_SIZE + M_SLAVE_FUNCTION_NAME)
+   #define M_SCRIPT_FUNCTION_NAME_SIZE                (M_STRING_SIZE + M_SCRIPT_FUNCTION_NAME)
+   #define M_INTERPRETER_PATH_SIZE                    M_SLAVE_DLL_NAME_SIZE
+   #define M_SCRIPT_PATH_SIZE                         (M_STRING_SIZE + M_SCRIPT_PATH)
+   #define M_DEBUG_INFORMATION_PATH_SIZE              (M_STRING_SIZE + M_DEBUG_INFORMATION_PATH)
+
+MIL_DEPRECATED(M_OBJECT_NAME_SIZE              , 1040)
+MIL_DEPRECATED(M_FUNCTION_NAME_FROM_OPCODE_SIZE, 1040)
+MIL_DEPRECATED(M_FUNCTION_NAME_SIZE            , 1040)
+MIL_DEPRECATED(M_SLAVE_DLL_NAME_SIZE           , 1040)
+MIL_DEPRECATED(M_SLAVE_FUNCTION_NAME_SIZE      , 1040)
+MIL_DEPRECATED(M_SCRIPT_FUNCTION_NAME_SIZE     , 1040)
+MIL_DEPRECATED(M_SCRIPT_PATH_SIZE              , 1040)
+MIL_DEPRECATED(M_DEBUG_INFORMATION_PATH_SIZE   , 1040)
+
+#endif
+
+#define M_FUNC_INQUIRE_STRING_END                     (M_FUNC_INQUIRE_STRING_START+58)
+
+#if OldDefinesSupport
+#define M_BEAD_GETNEIGHBORS                           0x0000A80E // use M_BEAD_GET_NEIGHBORS instead
+MIL_DEPRECATED(M_BEAD_GETNEIGHBORS, 1010)
+
+#define M_ASSOCIATED_NAME                   M_OBJECT_NAME
+MIL_DEPRECATED(M_ASSOCIATED_NAME, 1060)
+
+#define M_ASSOCIATED_NAME_SIZE                   M_OBJECT_NAME_SIZE
+
+#endif
+
+#define M_SYSTEM_CODE                      107
+
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#endif
+#define M_MIL_NET_INFO_PTR                 133
+#define M_OBJECT_TYPE                      136
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#define M_OBJECT_TYPE_OLD                  162
+#endif
+#define M_CALLER_BITNESS                   165
+// some free space for future values
+// reserve 168-187 for  M_ALLOCATE_OUTPUT_POINTER +1 ... +16 and a little extra space
+// put a little free space here
+// reserve next 20 for +1 to +16 and extra space
+// next one should be 210
+#define M_CALLER_WORKSPACE                 210
+
+
+#if MIL_COMPILE_VERSION >= 1010
+#endif
+
+// reserve next 20 for +1 to +16 and extra space
+// next one should be 244
+#define M_WEB_PUBLISH                      244
+// Reserve User M_WEB_PUBLISH + 1          245
+// Reserve User M_WEB_PUBLISH + 2          246
+// Reserve FB   M_WEB_PUBLISH + 3          247
+// Reserve DA   M_WEB_PUBLISH + 4          248
+
+//Free space here                          249 to 249
+
+//For Scripting
+#define M_COMPILE                          250
+#define M_DEBUG_INFORMATION                251
+#define M_NUMBER_OF_SCRIPT_REFERENCES      252
+
+//Scripting Specific Error
+#define M_SCRIPT_ERROR_NO_FILE_ACCESS     M_SCRIPT_ERROR_START + 1
+#define M_SCRIPT_ERROR_COMPILATION_ERROR  M_SCRIPT_ERROR_START + 2
+#define M_SCRIPT_ERROR_OTHER              M_SCRIPT_ERROR_START + 3
+#define M_SCRIPT_ERROR_FUNCTION_NOT_FOUND M_SCRIPT_ERROR_START + 4
+#define M_SCRIPT_ERROR_INCORRECT_PROTO    M_SCRIPT_ERROR_START + 5
+#define M_SCRIPT_ERROR_CLASS_MISSING      M_SCRIPT_ERROR_START + 6
+#define M_SCRIPT_ERROR_INVALID_CONTROL    M_SCRIPT_ERROR_START + 7
+#define M_SCRIPT_ERROR_WRAPPER_NOT_FOUND  M_SCRIPT_ERROR_START + 8
+#define M_SCRIPT_ERROR_REF_NOT_FOUND      M_SCRIPT_ERROR_START + 9
+#define M_SCRIPT_ERROR_PYTHON_ERROR       M_SCRIPT_ERROR_START + 10
+
+#define M_FREE_CUR_APPLICATION             317
+#define M_ID_IS_ON_LOCAL_CLUSTER           318
+
+//Values 512 to 768 reserved for references
+#define M_NB_MAX_SCRIPT_REFERENCE                256
+#define M_SCRIPT_REFERENCE_START                 512L
+#define M_SCRIPT_REFERENCE_END                   M_SCRIPT_REFERENCE_START + M_NB_MAX_SCRIPT_REFERENCE
+
+#define M_SCRIPT_REFERENCE                   (M_SCRIPT_REFERENCE_START|M_CLIENT_ENCODING)
+#if OldDefinesSupport
+#define M_SCRIPT_REFERENCE_SIZE                 (M_STRING_SIZE + M_SCRIPT_REFERENCE)
+MIL_DEPRECATED(M_SCRIPT_REFERENCE_SIZE, 1040)
+#endif
+
+#define M_OBJECT_VALID                   1038L
+#define M_IS_INTERNALLY_ALLOCATED        1043L 
+#define M_LOCATION                       1048L
+
+
+
+#define M_BUFFER_INFO                     5280L
+
+
+#define M_IS_A_LICENSE_SERVER_CMD(X)  ((((X&~M_STRING_SIZE)>=M_LICENSE_SERVER_CMD_START) && ((X&~M_STRING_SIZE)<M_LICENSE_SERVER_CMD_END)) ||\
+
+//operation
+//Information
+
+
+
+
+
+
+#define M_EXTENDED_PARAM_TYPE      0x10000000L
+/* Reserve next 16 (M_NB_MAX_PARAMETER) values   from   0x10000001L*/
+/*                                               to     0x10000010L*/
+#define M_PARAM_ATTRIBUTES         0x04000000L
+/* Reserve next 16 (M_NB_MAX_PARAMETER) values   from   0x04000001L*/
+/*                                               to     0x04000010L*/
+#define M_PARAM_TYPE_INFO         (0x02000000L | M_CLIENT_ENCODING)
+/* Reserve next 16 (M_NB_MAX_PARAMETER) values   from   0x02000001L*/
+/*                                               to     0x02000010L*/
+#define M_PARAM_SIZE               0x01000000L
+/* Reserve next 16 (M_NB_MAX_PARAMETER) values   from   0x01000001L*/
+/*                                               to     0x01000010L*/
+
+#define M_TRACE_HOOKS                                 (M_APP_INQUIRE_SYS_START+2L)  //15002L
+
+
+
+/* Return Value */
+#define M_NOT_ENOUGH_MEMORY   4L // already defined in mil3dmap.h
+
+/* Scripting related values */
+#define M_AUTO                444L    //already defined in mil.h, ...
+#define M_YES                 1L      //already defined in milmeas.h
+#define M_NO                  0L      //already defined in mil.h
+#define M_ONCE                3L      //already defined in mil.h
+#define M_MODIFIED            4096L   //already defined in mil.h
+
+#if MIL_COMPILE_VERSION >= 1010
+#endif
+
+/************************************************************************/
+/* MappInquireObject()/MappControlObject() defines                      */
+/************************************************************************/
+#define M_DMIL_PUBLISH                                12L
+#define M_OBJECT_TYPE_EXTENDED                        29
+
+#define M_APP_INQUIRE_OBJ_STRING_START                M_FUNC_INQUIRE_STRING_START // 47
+
+#define M_OBJECT_NAME                            ((M_FUNC_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING) //47
+#define M_OBJECT_FILE_PATH                       ((M_FUNC_INQUIRE_STRING_START+1)|M_CLIENT_ENCODING) //48
+#define M_OBJECT_FILENAME M_OBJECT_FILE_PATH
+#define M_OBJECT_FILE_NAME_NO_EXTENSION          ((M_FUNC_INQUIRE_STRING_START+4)|M_CLIENT_ENCODING) //51
+#define M_OBJECT_FILE_EXTENSION                  ((M_FUNC_INQUIRE_STRING_START+5)|M_CLIENT_ENCODING) //52
+#define M_OBJECT_FILE_FOLDER                     ((M_FUNC_INQUIRE_STRING_START+6)|M_CLIENT_ENCODING) //53
+#define M_OBJECT_FILE_NAME                       ((M_FUNC_INQUIRE_STRING_START+7)|M_CLIENT_ENCODING) //54
+
+#define M_APP_INQUIRE_OBJ_STRING_END                  M_FUNC_INQUIRE_STRING_END
+
+#define M_OBJECT_TYPE                                 136
+
+
+#define M_APP_INQUIRE_OBJ_DOUBLE_RANGE_START    10000
+#define M_APP_INQUIRE_OBJ_DOUBLE_RANGE_END      20000
+
+#define M_APP_INQUIRE_OBJ_INT64_RANGE_START    20001
+#define M_APP_INQUIRE_OBJ_INT64_RANGE_END      21000
+
+
+/************************************************************************/
+/* MilGPU                                                               */
+/************************************************************************/
+  /* Vertex processing type */
+#define M_SOFTWARE                                    0x010000L
+#define M_HARDWARE                                    0x020000L
+#define M_MIXED_VERTEXPROCESSING                      0x040000L
+
+  /* GPU specific errors */
+#define M_GPU_ERROR_START                             0x710
+#define M_GPU_ERROR_DIRECTX_NOTSUPPORTED              (M_GPU_ERROR_START+1)
+#define M_GPU_ERROR_INVALID_DECODER                   (M_GPU_ERROR_START+2)
+#define M_GPU_ERROR_D3D9_NOTLOADED                    (M_GPU_ERROR_START+3)
+#define M_GPU_ERROR_D3D10_NOTLOADED                   (M_GPU_ERROR_START+4)
+#define M_GPU_ERROR_D3D11_NOTLOADED                   (M_GPU_ERROR_START+5)
+#define M_GPU_ERROR_WINDOWS_SERVICE                   (M_GPU_ERROR_START+6)
+/* Reserve next 3 values                       from   (M_GPU_ERROR_START+7)*/
+/*                                             to     (M_GPU_ERROR_START+9)*/
+#define M_GPU_ERROR_END                               (M_GPU_ERROR_START+10)
+
+#define M_IS_GPU_SPECIFIC_ERROR(x)                    ((x > M_GPU_ERROR_START) && (x < M_GPU_ERROR_END))
+#define M_GPU_ERROR_GET_CODE(x)                       (x >> 4)
+#define M_GPU_ERROR_GET_SUBMSG(x)                     (x - M_GPU_ERROR_START)
+
+//Hook types
+#define M_SUB_OBJECT_LIST_MODIFIED                    M_OBJ_HOOK_RANGE_START+1L
+#define M_OBJECT_PROPERTIES_MODIFIED                  M_OBJ_HOOK_RANGE_START+2L
+#define M_OBJECT_RESULTS_MODIFIED                     M_OBJ_HOOK_RANGE_START+3L
+#define M_MASK_MODIFIED                               M_OBJ_HOOK_RANGE_START+4L
+#define M_MESSAGE_RECEIVED                            M_OBJ_HOOK_RANGE_START+5L
+#define M_READ_TIMEOUT                                M_OBJ_HOOK_RANGE_START+6L
+#define M_UPDATE_START                                M_OBJ_HOOK_RANGE_START+7L
+#define M_UPDATE_END                                  M_OBJ_HOOK_RANGE_START+8L
+#define M_COMPONENT_REMOVE                            M_OBJ_HOOK_RANGE_START+10L
+#define M_WRITE_TIMEOUT                               M_OBJ_HOOK_RANGE_START+11L
+#define M_CALIBRATION_STATUS_MODIFIED                 M_OBJ_HOOK_RANGE_START+12L
+#define M_MESSAGE_READ_ASYNC                          M_OBJ_HOOK_RANGE_START+13L
+
+
+//Operations
+#define M_CLEAR                              0x00000001L
+#define M_NEW_RESULTS                                 2L
+#define M_DELETE                                      3L
+#define M_ALL_PROPERTIES                              4L
+#define M_INSERT                                      5L
+#define M_MODIFIED                                 4096L
+#define M_NEW_LIST                                 2147L
+#define M_APPEND                             0x20000000L
+
+#define M_METHOD                                     103L
+#define M_OPERATION                               M_METHOD
+#define M_INDEX                                      217L
+#define M_TARGET_ID                                  218L
+#define M_TYPE                                      1008L
+#define M_WEB_CLIENT_INDEX                           219L
+#define M_WEB_CLIENT_TYPE                            220L
+#define M_CALIBRATION_ID                               4L
+#define M_SUB_INDEX_1                                2488
+#define M_SUB_INDEX_2                                2489
+#define M_CALIBRATION_STATUS                         159L  /* (also defined in milcal.h) */
+
+// MIL Web application Type
+#define M_WEB_APPLICATION                              1L
+#define M_STANDALONE_APPLICATION                       2L
+
+/************************************************************************/
+/* MobjControl()/MobjInquire() defines                                  */
+/************************************************************************/
+/*Free for reuse                                       1L*/
+#define M_INIT_HOOK_CONTEXT                            2L
+#define M_COPY_CALIBRATION_INFO                        3L   // already defined in mcalinfo.h
+#define M_CALIBRATION_ID                               4L
+#define M_CORRECTED_SCALES                             5L
+#define M_CALIBRATION_TRANSLATIONS                     6L
+#define M_COMPARE_CALIBRATION_INFO                     7L   // already defined in mcalinfo.h
+#define M_COMPARE_CALIBRATION_INFO_NO_OFFSET           8L   // already defined in mcalinfo.h
+#define M_REAL_OWNER_SYSTEM                            9L
+#define M_COPY_DISP_HOOK_CONTEXT                      10L
+#define M_CAL_PARENT_OFFSETS                          11L
+#define M_DMIL_PUBLISH                                12L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_PUBLISH                             14L
+#endif
+#define M_MESSAGE_COUNT                               15L
+#define M_MESSAGE_LENGTH                              16L
+#define M_COMPONENT_COUNT                             17L
+#define M_GROUP_ID                                    18L
+#define M_QUEUE_SIZE                                  19L
+#define M_QUEUE_FULL_MODE                             20L
+#define M_COMPENSATED_REAL_ID                         22L
+#define M_HOOK_PARAM                                  30L
+// reserve 10 entries                                 39L
+#define M_HOOK_TYPE                                   50L
+#define M_ASSOCIATED_CALIBRATION                     125L   // already defined in milcal.h
+#define M_COPY_HOOK_CONTEXT                          103L
+#define M_COPY_NEIGHBORHOOD_INFO                     104L
+#define M_NEIGHBORHOOD_INFO_SIZE                     105L
+#define M_COPY_HISTOGRAM_INFO                        106L
+#define M_HTTP_PORT                                  107L
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION
+#define M_HTTP_ROOT_DIRECTORY                        (108L|M_CLIENT_ENCODING)
+#define M_HTTP_ADDRESS                               (109L|M_CLIENT_ENCODING)
+#else
+#define M_HTTP_ROOT_DIRECTORY                        108L
+#define M_HTTP_ADDRESS                               109L
+#endif
+#define M_HTTP_START                                 110L
+#define M_HTTP_STOP                                  112L
+#define M_HTTP_MODE                                  113L
+#define M_HTTP_STATE                                 114L
+#define M_WEB_PUBLISH_MODE                           115L
+// Reserve User M_WEB_PUBLISH_MODE + 1               116L
+// Reserve User M_WEB_PUBLISH_MODE + 2               117L
+// Reserve FB   M_WEB_PUBLISH_MODE + 3               118L
+// Reserve DA   M_WEB_PUBLISH_MODE + 4               119L
+
+#define M_OBJECT_USER_DATA_PTR                       150L
+#define M_EMPTY                                      236L   // already defined in milmod.h
+
+// Http Server Mode
+#if OldDefinesSupport
+#define M_HTTP_ADDRESS_SIZE                          (M_STRING_SIZE + M_HTTP_ADDRESS)
+#define M_HTTP_ROOT_DIRECTORY_SIZE                   (M_STRING_SIZE + M_HTTP_ROOT_DIRECTORY)
+MIL_DEPRECATED(M_HTTP_ADDRESS_SIZE          , 1040)
+MIL_DEPRECATED(M_HTTP_ROOT_DIRECTORY_SIZE   , 1040)
+#endif
+#define M_FILE_SERVER                                  1L
+#define M_REST_SERVER                                  2L
+#define M_HTTP_LISTENING_PORT                          8080L
+#define M_HTTP_LISTENING_ADDRESS                       MT("localhost")
+
+
+#define M_CALIBRATION_STREAM_SIZE_WITH_CONTEXT      1405L
+#define M_CALIBRATION_STREAM_WITH_CONTEXT           1406L
+
+#define M_OBJ_INQUIRE_DOUBLE_RANGE_START            1407L
+#define M_OBJ_INQUIRE_DOUBLE_RANGE_END              1407L
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if OldDefinesSupport
+#define M_MEMBER_LIST                              10199L
+// reserve the next 1000 entries                   10200L
+// end reserve                                     11199L
+
+// macro for M_MEMBER_LIST
+#define M_LIST_SIZE(n)                             ((n >= 0 ) ? ((n <= 1000) ? n : 1000) : 0)
+
+MIL_DEPRECATED(M_MEMBER_LIST, 1000)
+MIL_DEPRECATED(M_LIST_SIZE, 1000)
+#endif
+
+#endif
+
+// Used in MfuncControl/MfuncInquire
+#define M_OBJECT_TYPE                                136
+
+#define M_OBJECT_TYPE_EXTENDED                        29  // Used in MfuncControl/MfuncInquire
+#define M_OWNER_SYSTEM                              1101L // Used in many places
+#define M_IS_INTERNALLY_ALLOCATED                   1043L // Used by MbufControl/MbufInquire but kept in MGObject
+#define M_OBJECT_ID                           0x001B0000L // MbufGetHookInfo, MbufHookFunction
+#define M_GRAB_LINE                           0x00100000L // MdigHookFunction
+#define M_GRAB_LINE_END                       0x00200000L // MdigHookFunction
+
+/************************************************************************/
+/* Special defines required to pass a pointer to a function that needs  */
+/* a double. (use in McalControl to set a user string in the context)   */
+/************************************************************************/
+#if !M_MIL_USE_64BIT
+#define M_PTR_TO_DOUBLE(ptr)            ((double) MPtrToInt((void*)(ptr)))
+#else
+#define M_PTR_TO_DOUBLE(ptr)            (MIL_INT64)(ptr)
+#endif //!M_MIL_USE_64BIT
+
+#if OldDefinesSupport
+#define M_STRING_TO_DOUBLE(ptr)         M_PTR_TO_DOUBLE(ptr)
+MIL_DEPRECATED(M_STRING_TO_DOUBLE, 1040)
+#endif
+
+#define M_DOUBLE_TO_PTR(val)            ((void *)((MIL_UINT)val))
+#if !M_MIL_USE_64BIT
+#define M_PTR_TO_MIL_INT(val)           ((MIL_INT)MPtrToInt((void*)(val)))
+#else
+#define M_PTR_TO_MIL_INT(val)           ((MIL_INT)((MIL_UINT)val))
+#endif
+#define M_PARAM_TO_PTR(val)            ((void *)((MIL_UINT)val))
+
+/************************************************************************/
+/* Reserved MIL_IDs                                                     */
+/************************************************************************/
+#define M_DEFAULT_HOST                                M_MAKE_DEFAULT_ID(1)
+#define M_DEFAULT_GRAPHIC_CONTEXT                     M_MAKE_DEFAULT_ID(2)
+#define M_CONST_DEFAULT_HOST                       M_MAKE_DEFAULT_ID(3)
+#define M_VIDEO_DEVICE_ID                             M_MAKE_DEFAULT_ID(4)
+//Reserve next M_MAX_VIDEO_DEVICE IDs (reserved 64)   -> 68
+#define M_RESERVED_ID_END                             M_MAKE_DEFAULT_ID(4 + M_MAX_VIDEO_DEVICE)
+#define M_IS_RESERVED_ID(X)                           ((M_NAKED_ID(X) > 0) && (M_NAKED_ID(X) <= M_NAKED_ID(M_RESERVED_ID_END)))
+
+
+
+
+
+
+
+/************************************************************************/
+/* MIL OPTIONAL COMPILE DEFINES prefixes */
+/************************************************************************/
+
+#if M_MIL_USE_WINDOWS
+   #define MFTYPE        _stdcall         // Exported Function type
+#elif M_MIL_USE_LINUX
+   #define MFTYPE                         // Exported Function type
+#else
+   #error Operating system not supported in Mil.h!
+#endif
+
+#if OldDefinesSupport
+   #define  MFTYPE32                      // Exported Function type (32 bits)
+   MIL_DEPRECATED(MFTYPE32, 1000)
+   #define MPTYPE                         // Pointer and Reference type
+   MIL_DEPRECATED(MPTYPE, 1000)
+#endif
+
+/************************************************************************/
+/* M_MISC_DATA_TRANSFER related defines */
+#define M_REGISTER_HOOK_THREAD                        1L
+#define M_INTERNAL_THREAD_ERROR_TOOLS                 2L
+
+#define M_HAS_BUFTRANSFER_FORMAT1(X) ( (M_DIRECTX|M_MTX0) & (X) )
+#define M_HAS_BUFTRANSFER_FORMAT(X,Y) ((M_HAS_BUFTRANSFER_FORMAT1(X) & M_HAS_BUFTRANSFER_FORMAT1(Y)) != 0)
+
+
+//////////////////////////////////////////////////////////////////////////
+// MappInquire (InquireType range values)
+//////////////////////////////////////////////////////////////////////////
+#define M_IN_SYS_APP_INQUIRE_STRING_RANGE(X)             ( (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_APP_INQUIRE_STRING_START) && \
+                                                            ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_APP_INQUIRE_STRING_END  ) ) || \
+                                                           (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_APP_INQUIRE_STRING_2_START) && \
+                                                            ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_APP_INQUIRE_STRING_2_END  )  ) || \
+                                                            ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_DEVICE_NAME)  )  )
+
+#define M_IN_APP_INQUIRE_REG_DEF_STRING_RANGE(X)         ( (((X&~M_CLIENT_TEXT_ENCODING) >= M_APP_INQUIRE_REG_DEF_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_APP_INQUIRE_REG_DEF_STRING_END  )   ) || \
+                                                          (((X&~M_CLIENT_TEXT_ENCODING) >= M_APP_INQUIRE_REG_DEF_STRING_2_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_APP_INQUIRE_REG_DEF_STRING_2_END  )   ))
+
+#define M_IN_APP_INQUIRE_DIRECT_ACCESS_STRING_RANGE(X)   (((X&~M_CLIENT_TEXT_ENCODING) >= M_APP_INQUIRE_DIRECT_ACCESS_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_APP_INQUIRE_DIRECT_ACCESS_STRING_END  )   )
+
+#define M_IN_APP_INQUIRE_STRING_RANGE(X)                 (M_IN_SYS_APP_INQUIRE_STRING_RANGE(X)           || \
+                                                          M_IN_APP_INQUIRE_REG_DEF_STRING_RANGE(X)       || \
+                                                          M_IN_APP_INQUIRE_DIRECT_ACCESS_STRING_RANGE(X)   )
+
+#define M_IN_APP_INQUIRE_DOUBLE_RANGE(X)                 ((X&~M_INTERMOD_VALUE_MASK) == M_VERSION)
+
+#define M_IN_APP_INQUIRE_MIL_ID_RANGE(X)                 (X == M_CURRENT_APPLICATION)
+
+#define M_IN_APP_INQUIRE_MIL_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_APP_INQUIRE_SIZEOF_INT64_START) &&     \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_APP_INQUIRE_SIZEOF_INT64_END  )   ) || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_INIT_FLAG                         )  )
+
+
+//////////////////////////////////////////////////////////////////////////
+// MfuncInquire (InquireType range values)
+//////////////////////////////////////////////////////////////////////////
+#define M_IN_FUNC_INQUIRE_STRING_RANGE(X)                ((((X&~M_CLIENT_TEXT_ENCODING) >= M_FUNC_INQUIRE_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_FUNC_INQUIRE_STRING_END  )) || \
+                                                          (((X&~M_CLIENT_TEXT_ENCODING) >= M_SCRIPT_REFERENCE_START) &&   \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_SCRIPT_REFERENCE_END)))
+
+
+//////////////////////////////////////////////////////////////////////////
+// MappInquireObject (InquireType range values)
+#define M_IN_APP_INQUIRE_OBJ_DOUBLE_RANGE(X)             (((X&~M_INTERMOD_VALUE_MASK) >= M_APP_INQUIRE_OBJ_DOUBLE_RANGE_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_APP_INQUIRE_OBJ_DOUBLE_RANGE_END  )   )
+
+#define M_IN_APP_INQUIRE_OBJ_STRING_RANGE(X)             (((X&~M_CLIENT_TEXT_ENCODING) >= M_APP_INQUIRE_OBJ_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_APP_INQUIRE_OBJ_STRING_END  )   )
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#define M_IN_APP_INQUIRE_OBJ_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_APP_INQUIRE_OBJ_INT64_RANGE_START) &&     \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_APP_INQUIRE_OBJ_INT64_RANGE_END  )   ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE                           ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE_OLD                       ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE_EXTENDED                  )   )
+#else
+#define M_IN_APP_INQUIRE_OBJ_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_APP_INQUIRE_OBJ_INT64_RANGE_START) &&     \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_APP_INQUIRE_OBJ_INT64_RANGE_END  )   ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE                           ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE_EXTENDED                  )   )
+#endif
+
+#if M_MIL_USE_64BIT
+#define M_APP_INQUIRE_OBJ_MUST_HAVE_USER_PTR(X)          (M_IN_APP_INQUIRE_OBJ_STRING_RANGE(X))
+#else
+#define M_APP_INQUIRE_OBJ_MUST_HAVE_USER_PTR(X)          (M_IN_APP_INQUIRE_OBJ_STRING_RANGE(X) || M_IN_APP_INQUIRE_OBJ_INT64_RANGE(X))
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MbufInquire (InquireType range values)
+#define M_IN_BUF_INQUIRE_DOUBLE_RANGE(X)                 ((((X&~M_INTERMOD_VALUE_MASK) >= M_BUF_INQUIRE_DOUBLE_RANGE_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_BUF_INQUIRE_DOUBLE_RANGE_END  )   ) || \
+                                                          (X == M_GRAB_TIME_STAMP) )
+
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION
+#define M_IN_BUF_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)        (((X >= M_BUF_INQUIRE_UNKNOWN_SIZEOF_START) && \
+                                                          (X <= M_BUF_INQUIRE_UNKNOWN_SIZEOF_END  )   ) || \
+                                                          (X == M_BUFFER_INFO_COPY) || \
+                                                          (X == M_GRAB_BUFFERS) || \
+                                                          (X == M_GRAB_BUFFERS_AFTER_SET_SCHEME) || \
+                                                          (X == M_GRAB_BUFFERS_USED) || \
+                                                          (X == M_BATCH_FLAGS) || \
+                                                          (X == M_BATCH_INQUIRE) )
+#else
+#define M_IN_BUF_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)        (((X >= M_BUF_INQUIRE_UNKNOWN_SIZEOF_START) && \
+                                                          (X <= M_BUF_INQUIRE_UNKNOWN_SIZEOF_END  )   ) || \
+                                                          (X == M_BUFFER_INFO_COPY) || \
+                                                          (X == M_GRAB_BUFFERS) || \
+                                                          (X == M_GRAB_BUFFERS_AFTER_SET_SCHEME) || \
+                                                          (X == M_GRAB_BUFFERS_USED) || \
+                                                          (X == M_BUFFER_INFO_OLD) || \
+                                                          (X == M_BATCH_FLAGS) || \
+                                                          (X == M_BATCH_INQUIRE) )
+#endif
+
+#define M_IN_BUF_INQUIRE_MIL_ID_RANGE(X)                 (((X >= M_BUF_INQUIRE_MIL_ID_START) &&     \
+                                                           (X <= M_BUF_INQUIRE_MIL_ID_END  )   ) || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_LIST )   || \
+                                                          (X == M_MIL_ID_INTERNAL              )   )
+
+#define M_IN_BUF_INQUIRE_MIL_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_BUF_INQUIRE_SIZEOF_INT64_START) &&     \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_BUF_INQUIRE_SIZEOF_INT64_END  )   ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_FLAGS                              ) || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_GROUP_ID_LIST )   || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_REGION_ID_LIST )  || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_SOURCE_ID_LIST )  || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_TYPE_LIST )       || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_64BIT_PHYSICAL_ADDRESS             )   )
+
+// M_HOST_ADDRESS_REMOTE has the same value as M_COMPONENT_ID_FLAG.
+// M_CONFIDENCE sets all 3 bits from M_RED M_GREEN M_BLUE so we mistakingly assume that M_COMPONENT_ID(M_CONFIDENCE)
+// is really M_HOST_ADDRESS_REMOTE. So we must split it
+#define M_IN_BUF_INQUIRE_PTR_RANGE(X)                    (  (X &~ (M_RED | M_GREEN | M_BLUE | M_Y | M_U | M_V)) == M_HOST_ADDRESS            || \
+                                                            (X == M_HOST_ADDRESS_REMOTE) || \
+                                                            (X == (M_HOST_ADDRESS_REMOTE | M_RED)) || \
+                                                            (X == (M_HOST_ADDRESS_REMOTE | M_GREEN)) || \
+                                                            (X == (M_HOST_ADDRESS_REMOTE | M_BLUE)) || \
+                                                            (X &~ (M_RED | M_GREEN | M_BLUE | M_Y | M_U | M_V)) == M_PHYSICAL_ADDRESS        || \
+                                                            (X &~ (M_RED | M_GREEN | M_BLUE | M_Y | M_U | M_V)) == M_PHYSICAL_ADDRESS_REMOTE || \
+                                                            (X == M_DC_HANDLE) || \
+                                                            (X == M_DIB_HANDLE) )
+
+#define M_IN_BUF_INQUIRE_STRING_RANGE(X)                 (((X&~(M_CLIENT_TEXT_ENCODING)) >= M_BUF_INQUIRE_STRING_START) && \
+                                                          ((X&~(M_CLIENT_TEXT_ENCODING)) <= M_BUF_INQUIRE_STRING_END))
+
+#if M_MIL_USE_64BIT
+#define M_BUF_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_BUF_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)  )
+#else
+#define M_BUF_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_BUF_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_BUF_INQUIRE_MIL_INT64_RANGE(X)        )
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MdigInquire (InquireType range values)
+#define M_IN_DIG_INQUIRE_STRING_RANGE(X)                 (((X&~(M_CLIENT_TEXT_ENCODING|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_INQUIRE_STRING_START  ) && \
+                                                          ((X&~(M_CLIENT_TEXT_ENCODING|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_INQUIRE_STRING_END    )   )
+
+#define M_IN_DIG_INQUIRE_MIL_ID_RANGE(X)                 ((((X&~(M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_INQUIRE_MIL_ID_START  )  && \
+                                                           ((X&~(M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_INQUIRE_MIL_ID_END    )) || \
+                                                           ((X&~(M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_MIL_ID_INTERNAL           )  || \
+                                                           ((X&~(M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_BAYER_COEFFICIENTS_ID     ) )
+
+#define M_IN_DIG_INQUIRE_DOUBLE_RANGE(X)                 ((((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_INQUIRE_SIZEOF_DOUBLE_START) &&          \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_INQUIRE_SIZEOF_DOUBLE_END  )        ) || \
+                                                          (((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_START) &&    \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_END  )   )|| \
+                                                           (((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_ROTARY_RANGE_DOUBLE_START) &&               \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_ROTARY_RANGE_DOUBLE_END  )   )||             \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK|M_ALL_REF|M_VOLTAGE|M_AUTOMATIC)) == M_BLACK_REF) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK|M_ALL_REF|M_VOLTAGE|M_AUTOMATIC)) == M_WHITE_REF) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK|M_MODE_CONTROL|M_ABSOLUTE_CTL_MASK)) == M_GAMMA ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_GC_CAMERA_TIME_STAMP ))
+
+#define M_IN_DIG_INQUIRE_MIL_INT64_RANGE(X)              ((((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_INQUIRE_SIZEOF_INT64_START ) &&      \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_INQUIRE_SIZEOF_INT64_END   )   )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK|M_SIGNAL|M_SYNC)) == M_CHANNEL             )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_IO_STATUS_ALL                       )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_IO_STATUS_ALL+M_AUX_IO              )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_IO_STATUS_ALL+M_CC_IO               )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_USER_BIT_STATE_ALL                  )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_USER_BIT_STATE_ALL+M_USER_BIT       )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_USER_BIT_STATE_ALL+M_USER_BIT_CC_IO )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_USER_BIT_STATE_ALL+M_USER_BIT_TL_TRIGGER ))
+
+
+#define M_IN_DIG_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)        (((X >= M_DIG_INQUIRE_UNKNOWN_SIZEOF_START) &&  \
+                                                           (X <= M_DIG_INQUIRE_UNKNOWN_SIZEOF_END  )  )  )
+
+#if !M_MIL_USE_64BIT
+#define M_DIG_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_DIG_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_DIG_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_DIG_INQUIRE_MIL_INT64_RANGE(X)        )
+#else
+#define M_DIG_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_DIG_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_DIG_INQUIRE_STRING_RANGE(X)           )
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MdispInquire (InquireType range values)
+#define M_IN_DISP_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)       (((M_ORIGINAL_DISPLAY_CONTROL(X) >= M_DISP_INQUIRE_UNKNOWN_SIZEOF_START) &&     \
+                                                           (M_ORIGINAL_DISPLAY_CONTROL(X) <= M_DISP_INQUIRE_UNKNOWN_SIZEOF_END  )   ) || \
+                                                          (X == M_GRAB_BUFFERS                                                      ) || \
+                                                          (X == M_ROI_RECT_BUFFER                                                   ) || \
+                                                          (X == M_ROI_RECT_DISPLAY                                                  ) || \
+                                                          (X == M_NEAREST_COLOR                                                     ) || \
+                                                          (X == M_CURRENT_SCREEN_RECT                                               ) || \
+                                                          (X == M_CURRENT_SCREEN_WORK_RECT                                          ) || \
+                                                          (X == M_CURRENT_MONITOR_RECT                                              ) || \
+                                                          (X == M_CURRENT_MONITOR_WORK_RECT                                         ) || \
+                                                          (X == M_VGA_INFO_DISPLAY_RECT                                             )   )
+
+#define M_IN_DISP_INQUIRE_STRING_RANGE(X)                (((M_ORIGINAL_DISPLAY_CONTROL((X&~M_CLIENT_TEXT_ENCODING)) >= M_DISP_INQUIRE_STRING_START) &&     \
+                                                           (M_ORIGINAL_DISPLAY_CONTROL((X&~M_CLIENT_TEXT_ENCODING)) <= M_DISP_INQUIRE_STRING_END  )   ) || \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_VIDEO_DEVICE_DESCRIPTION_STRING)                           ) || \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_VGA_INFO_DISPLAY_DEVICE_NAME)                              ) || \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_DESKTOP_DEVICE_NAME)                                       ) || \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_SUPPORTED_DISPLAY_TYPE_STRING)                             )   )
+
+#define M_IN_DISP_INQUIRE_MIL_ID_RANGE(X)                (((M_ORIGINAL_DISPLAY_CONTROL(X) >= M_DISP_INQUIRE_MIL_ID_START ) &&     \
+                                                           (M_ORIGINAL_DISPLAY_CONTROL(X) <= M_DISP_INQUIRE_MIL_ID_END   )   ) || \
+                                                          (M_IS_IN_VGA_DEVICE_SYSTEM_RANGE(M_ORIGINAL_DISPLAY_CONTROL(X))    ) || \
+                                                          (X == M_SYSTEM_ASSOCIATED_TO_DX_OBJECT                             ) || \
+                                                          (X == M_VGA_SYSTEM_FROM_PHYSICAL_ADDRESS                           ) || \
+                                                          (X == M_SELECT_VIDEO_SOURCE                                        ) || \
+                                                          (X == M_MIL_ID_INTERNAL                                            ) || \
+                                                          (X == M_ENCODER_OVR_BUF_ID                                         )   )
+
+#define M_IN_DISP_INQUIRE_DOUBLE_UNDERLAY_RANGE(X)       ((M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) >= M_UNDERLAY_DOUBLE_RANGE_START     ) && \
+                                                          (M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) <= M_UNDERLAY_DOUBLE_RANGE_END       )   )
+
+#define M_IN_DISP_INQUIRE_DOUBLE_RANGE(X)                (((M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) >= M_DISP_INQUIRE_SIZEOF_DOUBLE_START) &&     \
+                                                           (M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) <= M_DISP_INQUIRE_SIZEOF_DOUBLE_END  )   ) || \
+                                                          M_IN_DISP_INQUIRE_DOUBLE_UNDERLAY_RANGE(X)                                                          )
+
+#define M_IN_DISP_INQUIRE_MIL_INT64_RANGE(X)             ((M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) >= M_DISP_INQUIRE_SIZEOF_INT64_START) && \
+                                                          (M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) <= M_DISP_INQUIRE_SIZEOF_INT64_END  )   )
+
+#if M_MIL_USE_64BIT
+#define M_DISP_INQUIRE_MUST_HAVE_USER_PTR(X)             (M_IN_DISP_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_DISP_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)   )
+#else
+#define M_DISP_INQUIRE_MUST_HAVE_USER_PTR(X)             (M_IN_DISP_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_DISP_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_DISP_INQUIRE_MIL_INT64_RANGE(X)         )
+#endif
+
+
+#define M_IN_DISP_INQUIRE_MIL_INT_RANGE(X)               (!M_IN_DISP_INQUIRE_DOUBLE_RANGE(X)    && \
+                                                          !M_IN_DISP_INQUIRE_MIL_ID_RANGE(X)    && \
+                                                          !M_DISP_INQUIRE_MUST_HAVE_USER_PTR(X)   )
+
+#define M_IN_DISP_CONTROL_DOUBLE_RANGE(X)                M_IN_DISP_INQUIRE_DOUBLE_RANGE(X)
+#define M_IN_DISP_CONTROL_STRING_RANGE(X)                M_IN_DISP_INQUIRE_STRING_RANGE(X)
+#define M_IN_DISP_CONTROL_MIL_ID_RANGE(X)                M_IN_DISP_INQUIRE_MIL_ID_RANGE(X)
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// MsysInquire (InquireType range values)
+
+#define M_IN_SYS_INQUIRE_CPU_STRING_RANGE(X)             (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_INQUIRE_CPU_STRING_START ) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_INQUIRE_CPU_STRING_END   )   )
+
+#define M_IN_SYS_INQUIRE_STRING_RANGE(X)                 ((((X&~M_CLIENT_TEXT_ENCODING &~M_DIGITIZER_DEVx_INDEX_MASK) >= M_SYS_INQUIRE_STRING_START) &&     \
+                                                           ((X&~M_CLIENT_TEXT_ENCODING &~M_DIGITIZER_DEVx_INDEX_MASK) <= M_SYS_INQUIRE_STRING_END  )   ) || \
+                                                           (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_INQUIRE_STRING_START_1) &&     \
+                                                           ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_INQUIRE_STRING_END_1  )   ) || \
+                                                          M_IN_SYS_INQUIRE_CPU_STRING_RANGE(X)                             || \
+                                                          M_IN_SYS_APP_INQUIRE_STRING_RANGE(X)                             || \
+                                                          (((M_GC_STRIP_TRIGGER_SOFTWARE_NUMBER(X)&~M_CLIENT_TEXT_ENCODING) >= M_SYS_INQUIRE_STRING_START) &&     \
+                                                           ((M_GC_STRIP_TRIGGER_SOFTWARE_NUMBER(X)&~M_CLIENT_TEXT_ENCODING) <= M_SYS_INQUIRE_STRING_END  )))
+
+#define M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)        ((X >= M_SYS_INQUIRE_UNKNOWN_SIZEOF_START) && \
+                                                          (X <= M_SYS_INQUIRE_UNKNOWN_SIZEOF_END  )   )
+
+#define M_IN_SYS_INQUIRE_MIL_ID_RANGE(X)                 (((X >= M_SYS_INQUIRE_MIL_ID_START) &&     \
+                                                           (X <= M_SYS_INQUIRE_MIL_ID_END  )   ) || \
+                                                          (X == M_MIL_ID_INTERNAL              )   )
+
+#define M_IN_SYS_INQUIRE_DOUBLE_RANGE(X)                 ((((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_INQUIRE_SIZEOF_DOUBLE_START) &&              \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_INQUIRE_SIZEOF_DOUBLE_END  )   ) ||          \
+                                                          (((X&~M_INTERMOD_VALUE_MASK) >= M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_START) &&    \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_END  )   )|| \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_TEMPERATURE                         )   )
+
+#define M_IN_SYS_INQUIRE_MIL_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_INQUIRE_SIZEOF_INT64_START) &&      \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_INQUIRE_SIZEOF_INT64_END  )   )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_GC_TOTAL_BYTES_RECEIVED           )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_IO_STATUS_ALL                     )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_IO_STATUS_ALL+M_AUX_IO            )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_USER_BIT_STATE_ALL                )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_USER_BIT_STATE_ALL+M_USER_BIT ))
+
+
+#if M_MIL_USE_64BIT
+#define M_IN_SYS_INQUIRE_MIL_INT_RANGE(X)                ((!M_IN_SYS_INQUIRE_MIL_ID_RANGE(X)          &&     \
+                                                           !M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) &&     \
+                                                           !M_IN_SYS_INQUIRE_DOUBLE_RANGE(X) &&     \
+                                                           !M_IN_SYS_INQUIRE_STRING_RANGE(X)            ) || \
+                                                          M_IN_SYS_INQUIRE_MIL_INT64_RANGE(X)               )
+#else
+#define M_IN_SYS_INQUIRE_MIL_INT_RANGE(X)                ((!M_IN_SYS_INQUIRE_MIL_ID_RANGE(X)          && \
+                                                           !M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) && \
+                                                           !M_IN_SYS_INQUIRE_DOUBLE_RANGE(X) && \
+                                                           !M_IN_SYS_INQUIRE_STRING_RANGE(X)            ) )
+#endif
+
+#if !M_MIL_USE_64BIT
+#define M_SYS_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_SYS_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_SYS_INQUIRE_MIL_INT64_RANGE(X)         )
+#else
+#define M_SYS_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_SYS_INQUIRE_STRING_RANGE(X)            )
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MSysGetHookInfo (InquireType range values)
+#define M_IN_SYS_GET_HOOK_INFO_INT64_RANGE(X)           (((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GC_MAC_ADDRESS             ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GC_IP_ADDRESS             ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST1+M_LATCH1  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST1+M_LATCH2  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST1+M_LATCH3  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST1+M_LATCH4  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST2+M_LATCH1  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST2+M_LATCH2  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST2+M_LATCH3  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST2+M_LATCH4  ) || \
+    (((X&~M_DATA_LATCH_INSTANCE_MASK) >= M_SYS_DATA_LATCH_VALUE) && ((X&~M_DATA_LATCH_INSTANCE_MASK) < (M_SYS_DATA_LATCH_VALUE+M_SYS_DATA_LATCH_MAX_INDEX))) )
+
+#define M_IN_SYS_GET_HOOK_INFO_STRING_RANGE(X)          M_IN_SYS_INQUIRE_STRING_RANGE(X)
+
+#define M_IN_SYS_GET_HOOK_INFO_DOUBLE_RANGE(X)           (((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIME_STAMP ) || \
+                                                          (((X&~(M_INTERMOD_VALUE_MASK | M_MODIFIED_BUFFER)) >= M_TIMER_VALUE) && \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK | M_MODIFIED_BUFFER)) <= M_TIMER_VALUE+M_TIMER99)) )
+
+//////////////////////////////////////////////////////////////////////////
+// MsysIoInquire (InquireType range values)
+
+#define M_IN_SYS_IO_INQUIRE_STRING_RANGE(X)              (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_IO_INQUIRE_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_IO_INQUIRE_STRING_END  )   )
+
+#define M_IN_SYS_IO_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)     ((X >= M_SYS_IO_INQUIRE_UNKNOWN_SIZEOF_START) && \
+                                                          (X <= M_SYS_IO_INQUIRE_UNKNOWN_SIZEOF_END  )   )
+
+#define M_IN_SYS_IO_INQUIRE_MIL_ID_RANGE(X)              ((X >= M_SYS_IO_INQUIRE_MIL_ID_START) && \
+                                                          (X <= M_SYS_IO_INQUIRE_MIL_ID_END  )   )
+
+#define M_IN_SYS_IO_INQUIRE_DOUBLE_RANGE(X)              (((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_IO_INQUIRE_SIZEOF_DOUBLE_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_IO_INQUIRE_SIZEOF_DOUBLE_END  )   )
+
+#define M_IN_SYS_IO_INQUIRE_MIL_INT64_RANGE(X)           ((((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_IO_INQUIRE_SIZEOF_INT64_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_IO_INQUIRE_SIZEOF_INT64_END  )) || \
+                                                          (((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_IO_INQUIRE_SIZEOF_INT64_START2) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_IO_INQUIRE_SIZEOF_INT64_END2  )))
+
+#if !M_MIL_USE_64BIT
+#define M_SYS_IO_INQUIRE_MUST_HAVE_USER_PTR(X)           (M_IN_SYS_IO_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_SYS_IO_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_SYS_IO_INQUIRE_MIL_INT64_RANGE(X)         )
+#else
+#define M_SYS_IO_INQUIRE_MUST_HAVE_USER_PTR(X)           (M_IN_SYS_IO_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_SYS_IO_INQUIRE_STRING_RANGE(X)            )
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MSeqInquire
+#define M_IN_SEQ_CONTAINER_INQUIRE_DOUBLE_RANGE(X)       (((X&~M_INTERMOD_VALUE_MASK) == M_STREAM_FRAME_RATE              ) )
+
+#define M_IN_SEQ_CONTAINER_INQUIRE_MIL_INT64_RANGE(X)    (((X&~M_INTERMOD_VALUE_MASK) >= M_SEQ_CONTAINER_INQUIRE_SIZEOF_INT64_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_SEQ_CONTAINER_INQUIRE_SIZEOF_INT64_END  ) )
+
+#define M_IN_SEQ_CONTAINER_INQUIRE_STRING_RANGE(X)       ((X&~M_CLIENT_TEXT_ENCODING) == (M_STREAM_FILE_NAME&~M_CLIENT_TEXT_ENCODING))
+
+#define M_IN_SEQ_CONTAINER_INQUIRE_MUST_HAVE_PTR(X)      (M_IN_SEQ_CONTAINER_INQUIRE_STRING_RANGE(X))
+
+#define M_IN_SEQ_DEFINE_CONTAINER_TYPE(X)                ((X == M_PIPE       ) || \
+                                                          (X == M_FILE       ) || \
+                                                          (X == M_BUFFER_LIST) || \
+                                                          (X == M_USER_HOOK  ) || \
+                                                          (X == M_USER_FEED  ) )
+
+//////////////////////////////////////////////////////////////////////////
+// MSeqInquire (InquireType range values)
+#define M_SEQ_INTERMOD_VALUE_MASK (M_INTERMOD_VALUE_MASK | M_EFFECTIVE_VALUE)
+#define M_IN_SEQ_INQUIRE_MIL_INT64_RANGE(X)              (M_IN_SEQ_CONTAINER_INQUIRE_MIL_INT64_RANGE(X)  )
+
+#define M_IN_SEQ_INQUIRE_MIL_DOUBLE_RANGE(X)             (((X&~M_SEQ_INTERMOD_VALUE_MASK) == M_PROCESS_FRAME_RATE ) || \
+                                                          ((X&~M_SEQ_INTERMOD_VALUE_MASK) == M_STREAM_FRAME_RATE  ) || \
+                                                          M_IN_SEQ_CONTAINER_INQUIRE_DOUBLE_RANGE(X)              )
+
+#define M_IN_SEQ_INQUIRE_STRING_RANGE(X)                 (M_IN_SEQ_CONTAINER_INQUIRE_STRING_RANGE(X))
+
+#define M_IN_SEQ_INQUIRE_MIL_ID_RANGE(X)                 (!(X == X)) //Return false for now
+
+#define M_IN_SEQ_INQUIRE_MUST_HAVE_PTR(X)                (M_IN_SEQ_INQUIRE_STRING_RANGE(X))
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// MgraInquire / MgraInquireList (InquireType range values)
+#define M_IN_GRA_INQUIRE_DOUBLE_RANGE(X)                 ((((X&~M_INTERMOD_VALUE_MASK) >= M_GRA_INQUIRE_DOUBLE_RANGE_START) &&            \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_GRA_INQUIRE_DOUBLE_RANGE_END  )          ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_RED|M_GREEN|M_BLUE)) == M_COLOR              ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_RED|M_GREEN|M_BLUE)) == M_BACKCOLOR          ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_RED|M_GREEN|M_BLUE)) == M_SELECTED_COLOR     ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_FONT_X_SCALE                              ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_FONT_Y_SCALE                              ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_POSITION_X                                ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_POSITION_Y                                ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_CENTER_X                                ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_CENTER_Y                                ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_ANGLE                                     ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_ANGLE_START                               ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_ANGLE_END                                 ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_LINE_THICKNESS                            ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_LINE_ENDS_DIMENSION                       )   )
+
+#define M_IN_GRA_INQUIRE_MIL_ID_RANGE(X)                 ((X >= M_GRA_INQUIRE_MIL_ID_RANGE_START) && \
+                                                          (X <= M_GRA_INQUIRE_MIL_ID_RANGE_END  )   )
+
+
+//////////////////////////////////////////////////////////////////////////
+// MDigGetHookInfo (InquireType range values)
+#define M_IN_DIG_GET_HOOK_INFO_DOUBLE_RANGE(X)           (((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GRAB_TIME_STAMP             ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GRAB_TIME_STAMP+M_TIMER_IO  ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE                 ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER1        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER2        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER3        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER4        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER5        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER6        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER7        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER8        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GC_CAMERA_TIME_STAMP        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIME_STAMP                  ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GC_FRAME_TIMESTAMP          )   )
+
+
+//////////////////////////////////////////////////////////////////////////
+// MDigGetHookInfo (InquireType range values)
+#define M_IN_DIG_GET_HOOK_INFO_STRING_RANGE(X)           (((X&(~M_CLIENT_TEXT_ENCODING)) == (M_GC_FEATURE_CHANGE_NAME&(~M_CLIENT_TEXT_ENCODING)) ) || \
+                                                           ((X&(~M_CLIENT_TEXT_ENCODING)) == (M_CAMERA_MODEL&(~M_CLIENT_TEXT_ENCODING)) ) )
+
+//////////////////////////////////////////////////////////////////////////
+// MDigGetHookInfo (InfoType range values)
+#define M_IN_DIG_GET_HOOK_INFO_INT64_RANGE(X)            ((((X&~M_DATA_LATCH_INSTANCE_MASK) >= M_DATA_LATCH_VALUE) && ((X&~M_DATA_LATCH_INSTANCE_MASK) < (M_DATA_LATCH_VALUE+M_DATA_LATCH_MAX_INDEX))) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK | M_MODIFIED_BUFFER)) == M_GC_FRAME_BLOCK_ID64) )
+
+//////////////////////////////////////////////////////////////////////////
+// MDigGetHookInfo (InfoType range values)
+#define M_IN_DIG_GET_HOOK_INFO_PTR_RANGE(X)               ((X == M_DRIVER_HOOK_CONTEXT_PTR) || \
+                                                          ((X >= M_DATA_LATCH_VALUE_ALL ) && (X < (M_DATA_LATCH_VALUE_ALL + M_DATA_LATCH_MAX_INDEX))))
+
+//////////////////////////////////////////////////////////////////////////
+// MobjInquire (Inquire range values)
+#define M_IN_OBJ_INQUIRE_DOUBLE_RANGE(X)                  (((X&~M_INTERMOD_VALUE_MASK) >= M_OBJ_INQUIRE_DOUBLE_RANGE_START) &&            \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_OBJ_INQUIRE_DOUBLE_RANGE_END  )          )
+
+#ifdef __cplusplus
+
+// General function handling combination flags in Inquire and GetResult functions,
+// used to determine the output pointer type.
+inline MIL_INT64 MinquireOverrides(MIL_INT64 InquireType, MIL_INT64 ComboFlagDefaultType)
+   {
+   const MIL_INT64 RequiredType = M_GET_HLVLDATATYPE(InquireType);
+   if (RequiredType != 0)
+      return RequiredType;
+
+   const MIL_INT64 StateBits = M_GET_INTERMOD_STATE_BITS(InquireType);
+   const MIL_INT64 ValueBits = M_GET_INTERMOD_VALUE_BITS(InquireType);
+   if (StateBits & (M_AVAILABLE | M_SUPPORTED | M_IS_SET_TO_DEFAULT) || ValueBits == M_STRING_SIZE || ValueBits == M_NB_ELEMENTS)
+      return ComboFlagDefaultType;
+
+   return 0;
+   }
+
+#endif
+
+/************************************************************************/
+/* Miltracer defines                                                   */
+/************************************************************************/
+#define M_TRACE_STRING_LENGTH                         2048
+
+/************************************************************************/
+/* MIL command decoder functions */
+#include <mildec.h>
+
+/************************************************************************/
+/* MIL library prototypes */
+#include <milproto.h>
+
+/************************************************************************/
+/* MIL_UNIQUE_ID class definition and overloads */
+#include <miluniqueid.h>
+
+/************************************************************************/
+/* MIL custom-made header file*/
+#include <mildyn.h>
+
+#if !defined(MappAllocDefault) && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL) && defined(M_SYSTEM_DEFAULT)
+
+#define M_MIL_USE_APP_ALLOC_DEFAULT 1
+
+#ifdef __cplusplus
+#define INL_FUNC_PREFIX   inline
+#else
+#define INL_FUNC_PREFIX   static
+#endif
+
+/***************************************************************************/
+/* LocalBufferAllocDefault - Local macro to allocate a default MIL buffer: */
+/*                                                                         */
+/* MIL_ID *SystemIdVarPtr;                                                 */
+/* MIL_ID *DisplayIdVarPtr;                                                */
+/* MIL_ID *ImageIdVarPtr;                                                  */
+/*                                                                         */
+/***************************************************************************/
+INL_FUNC_PREFIX void LocalBufferAllocDefault(MIL_ID* SystemIdVarPtr, MIL_ID* DisplayIdVarPtr, MIL_ID* DigitizerIdVarPtr, MIL_ID* ImageIdVarPtr)
+   {
+   /* local variables */
+   MIL_INT   m_def_image_numbands = 1;
+   MIL_INT   m_def_image_size_x = 640;
+   MIL_INT   m_def_image_size_y = 480;
+   MIL_INT   m_def_image_type = 8 + M_UNSIGNED;
+   MIL_INT64 m_def_image_attribute = M_IMAGE + M_PROC;
+
+   /* determines the needed size band, x, y and attribute */
+   if ((DigitizerIdVarPtr != M_NULL) && (*DigitizerIdVarPtr != M_NULL))
+      {
+      m_def_image_size_x = MdigInquire(*((MIL_ID *)(DigitizerIdVarPtr)), M_SIZE_X, M_NULL);
+      m_def_image_size_y = MdigInquire(*((MIL_ID *)(DigitizerIdVarPtr)), M_SIZE_Y, M_NULL);
+      m_def_image_attribute |= M_GRAB;
+      m_def_image_numbands = MdigInquire(*(MIL_ID *)DigitizerIdVarPtr, M_SIZE_BAND, M_NULL);
+      }
+
+
+   /* determines the needed attribute */
+   if ((DisplayIdVarPtr != M_NULL) && (*DisplayIdVarPtr != M_NULL))
+      {
+      m_def_image_attribute |= M_DISP;
+      }
+
+   /* allocates a monochromatic or color image buffer */
+   MbufAllocColor(*SystemIdVarPtr,
+      m_def_image_numbands,
+      m_def_image_size_x,
+      m_def_image_size_y,
+      m_def_image_type,
+      m_def_image_attribute,
+      ImageIdVarPtr);
+
+   /* clear and display the image buffer */
+   if ((DisplayIdVarPtr != M_NULL) &&
+      (*DisplayIdVarPtr != M_NULL) &&
+      (*ImageIdVarPtr != M_NULL))
+      {
+      MbufClear(*ImageIdVarPtr, 0);
+      MdispSelect(*DisplayIdVarPtr, *ImageIdVarPtr);
+      }
+   }
+
+/**************************************************************************/
+/* MappAllocDefault - macro to allocate default MIL objects:              */
+/*                                                                        */
+/* MIL_UINT64 InitFlag;                                                   */
+/* MIL_ID*    ContextAppIdPtr;                                            */
+/* MIL_ID*    SystemIdVarPtr;                                             */
+/* MIL_ID*    DisplayIdVarPtr;                                            */
+/* MIL_ID*    DigitizerIdVarPtr;                                          */
+/* MIL_ID*    ImageIdVarPtr;                                              */
+/*                                                                        */
+/* Note:                                                                  */
+/*       An application must be allocated before a system.                */
+/*       An system must be allocated before a display, digitizer or image.*/
+/*                                                                        */
+/**************************************************************************/
+INL_FUNC_PREFIX void MappAllocDefault(MIL_INT64 InitFlag, MIL_ID* ContextAppIdPtr, MIL_ID* SystemIdVarPtr, MIL_ID* DisplayIdVarPtr, MIL_ID* DigitizerIdVarPtr, MIL_ID* ImageIdVarPtr)
+   {
+   /* local variables */
+   MIL_INT DefAutoPublish = M_DEF_AUTO_PUBLISH;
+
+   /*Make sure variables are initialized to M_NULL if a call fails*/
+   if (ContextAppIdPtr != M_NULL)
+      *ContextAppIdPtr = M_NULL;
+   if (SystemIdVarPtr != M_NULL)
+      *SystemIdVarPtr = M_NULL;
+   if (DisplayIdVarPtr != M_NULL)
+      *DisplayIdVarPtr = M_NULL;
+   if (DigitizerIdVarPtr != M_NULL)
+      *DigitizerIdVarPtr = M_NULL;
+   if (ImageIdVarPtr != M_NULL)
+      *ImageIdVarPtr = M_NULL;
+   /* allocate a MIL application. */
+
+   if (ContextAppIdPtr == M_NULL)
+      {
+      // we have nothing to allocate
+      return;
+      }
+
+
+   MappAlloc(MIL_TEXT("M_DEFAULT"), InitFlag, ContextAppIdPtr);
+
+   /* Enables DMIL monitoring mode */
+   if (DefAutoPublish != 0)
+      {
+      MappControl(M_DEFAULT, M_DMIL_CONNECTION, M_DMIL_MONITOR);
+      MappControl(M_DEFAULT, M_DMIL_AUTO_PUBLISH_ALL, M_ENABLE);
+      }
+
+   /* allocate a system */
+   if ((*ContextAppIdPtr == M_NULL) || (SystemIdVarPtr == M_NULL))
+      {
+      // Application failed to allocate or no requested system
+      return;
+      }
+
+   //MIL_CONST_TEXT_PTR SysName = M_SYSTEM_DEFAULT;
+   MsysAlloc(M_DEFAULT, M_SYSTEM_DEFAULT, M_DEFAULT, InitFlag, SystemIdVarPtr);
+   //MsysAlloc(M_DEFAULT, SysName, M_DEFAULT, InitFlag, SystemIdVarPtr);
+
+
+   if (*SystemIdVarPtr == M_NULL)
+      {
+      // System failed to allocate
+      return;
+      }
+
+
+   /* allocate a display */
+   if (DisplayIdVarPtr != M_NULL)
+      MdispAlloc(*SystemIdVarPtr,
+         M_DEFAULT,
+         MIL_TEXT("M_DEFAULT"),
+         M_DEFAULT,
+         DisplayIdVarPtr);
+
+   /* allocate a digitizer */
+   if (DigitizerIdVarPtr != M_NULL)
+      MdigAlloc(*SystemIdVarPtr,
+         M_DEFAULT,
+         MIL_TEXT("M_DEFAULT"),
+         M_DEFAULT,
+         DigitizerIdVarPtr);
+
+
+   /* allocate an image buffer */
+   if (ImageIdVarPtr != M_NULL)
+      LocalBufferAllocDefault(SystemIdVarPtr,
+         DisplayIdVarPtr,
+         DigitizerIdVarPtr,
+         ImageIdVarPtr);
+
+   }
+
+
+/************************************************************************/
+/* MappFreeDefault - macro to free default MIL objects:                 */
+/*                                                                      */
+/* MIL_ID ContextAppId;                                                 */
+/* MIL_ID SystemId;                                                     */
+/* MIL_ID DisplayId;                                                    */
+/* MIL_ID DigitizerId;                                                  */
+/* MIL_ID ImageId;                                                      */
+/*                                                                      */
+/************************************************************************/
+INL_FUNC_PREFIX void MappFreeDefault(MIL_ID ContextAppId, MIL_ID SystemId, MIL_ID DisplayId, MIL_ID DigitizerId, MIL_ID BufferId)
+   {
+
+   /* free the image buffer */
+   if (BufferId != M_NULL)
+      {
+      MbufFree(BufferId);
+      }
+
+   /* free digitizer */
+   if (DigitizerId != M_NULL)
+      {
+      MdigFree(DigitizerId);
+      }
+
+   /* free the display */
+   if (DisplayId != M_NULL)
+      {
+      MdispFree(DisplayId);
+      }
+
+   /* free the system */
+   if (SystemId != M_NULL)
+      {
+      MsysFree((SystemId));
+      }
+
+   /* free the application */
+   if (ContextAppId != M_NULL)
+      {
+      MappFree(ContextAppId);
+      }
+   }
+
+#if M_MIL_USE_MIL_UNIQUE_ID && M_MIL_USE_MOVE_SEMANTICS
+
+inline void MappAllocDefault(MIL_INT64           InitFlag       ,
+                             MIL_UNIQUE_APP_ID*  ContextAppIdPtr,
+                             MIL_UNIQUE_SYS_ID*  SysIdPtr       ,
+                             MIL_UNIQUE_DISP_ID* DispIdPtr      ,
+                             MIL_UNIQUE_DIG_ID*  DigIdPtr       ,
+                             MIL_UNIQUE_BUF_ID*  ImageBufIdPtr  )
+   {
+   MIL_ID ContextAppId = M_NULL;
+   MIL_ID SysId        = M_NULL;
+   MIL_ID DispId       = M_NULL;
+   MIL_ID DigId        = M_NULL;
+   MIL_ID ImageBufId   = M_NULL;
+   MappAllocDefault(InitFlag,
+                    ContextAppIdPtr ? &ContextAppId : M_NULL,
+                    SysIdPtr        ? &SysId        : M_NULL,
+                    DispIdPtr       ? &DispId       : M_NULL,
+                    DigIdPtr        ? &DigId        : M_NULL,
+                    ImageBufIdPtr   ? &ImageBufId   : M_NULL);
+   if (ContextAppIdPtr) ContextAppIdPtr->reset(ContextAppId);
+   if (SysIdPtr       ) SysIdPtr       ->reset(SysId       );
+   if (DispIdPtr      ) DispIdPtr      ->reset(DispId      );
+   if (DigIdPtr       ) DigIdPtr       ->reset(DigId       );
+   if (ImageBufIdPtr  ) ImageBufIdPtr  ->reset(ImageBufId  );
+   }
+
+#endif // M_MIL_USE_MIL_UNIQUE_ID && M_MIL_USE_MOVE_SEMANTICS
+
+#undef INL_FUNC_PREFIX
+#else
+#define M_MIL_USE_APP_ALLOC_DEFAULT 0
+#endif
+
+#ifndef M_GROUP
+#define M_GROUP                                       MAKE_INT64(0x0000400000000000)
+#endif
+
+/************************************************************************/
+/* MIL low-level DTK prototypes */
+#include <milfuncll.h>
+
+
+
+
+
+//Add deleted PNFC constants
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#ifdef PFNC_H
+#ifndef PFNC_MONO
+
+#define PFNC_MONO                                  0x01000000
+#define PFNC_RGB                                   0x02000000
+#define PFNC16_YUV                                 0x0600
+#define PFNC16_422                                 0x0020
+
+#define PFNC16_8_BITS                              0x0001
+
+#define PFNC_OCCUPY8BIT                            0x00080000
+#define PFNC_OCCUPY10BIT                           0x000A0000
+#define PFNC_OCCUPY12BIT                           0x000C0000
+#define PFNC_OCCUPY16BIT                           0x00100000
+#define PFNC_OCCUPY24BIT                           0x00180000
+
+#define PFNC_MONO8_ID                              (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x0001)
+#define GEV_MONO10_PACKED_ID                       (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0004)
+#define GEV_MONO12_PACKED_ID                       (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0006)
+#define PFNC_MONO10_ID                             (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0003)
+#define PFNC_MONO12_ID                             (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0005)
+#define PFNC_MONO14_ID                             (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0025)
+#define PFNC_MONO16_ID                             (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0007)
+#define PFNC_RGB8_ID                               (PFNC_RGB  | PFNC_OCCUPY24BIT  | 0x0014)
+#define PFNC_BGR8_ID                               (PFNC_RGB  | PFNC_OCCUPY24BIT  | 0x0015)
+#define PFNC_BAYERGR8_ID                           (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x0008)
+#define PFNC_BAYERRG8_ID                           (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x0009)
+#define PFNC_BAYERGB8_ID                           (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x000A)
+#define PFNC_BAYERBG8_ID                           (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x000B)
+#define PFNC_BGRa8_ID                              (PFNC_RGB  | PFNC_OCCUPY32BIT  | 0x0017)
+#define PFNC_BAYERGR10_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x000C)
+#define PFNC_BAYERRG10_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x000D)
+#define PFNC_BAYERGB10_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x000E)
+#define PFNC_BAYERBG10_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x000F)
+#define PFNC_BAYERGR12_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0010)
+#define PFNC_BAYERRG12_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0011)
+#define PFNC_BAYERGB12_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0012)
+#define PFNC_BAYERBG12_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0013)
+#define PFNC_BAYERGR16_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x002E)
+#define PFNC_BAYERRG16_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x002F)
+#define PFNC_BAYERGB16_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0030)
+#define PFNC_BAYERBG16_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0031)
+#define GEV_BAYGR10_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0026)
+#define GEV_BAYRG10_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0027)
+#define GEV_BAYGB10_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0028)
+#define GEV_BAYBG10_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0029)
+#define GEV_BAYGR12_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x002A)
+#define GEV_BAYRG12_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x002B)
+#define GEV_BAYGB12_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x002C)
+#define GEV_BAYBG12_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x002D)
+#define PFNC_RGB10_ID                              (PFNC_RGB  | PFNC_OCCUPY48BIT  | 0x0018)
+#define PFNC_RGB12_ID                              (PFNC_RGB  | PFNC_OCCUPY48BIT  | 0x001A)
+#define PFNC_BGR10_ID                              (PFNC_RGB  | PFNC_OCCUPY48BIT  | 0x0019)
+#define PFNC_BGR12_ID                              (PFNC_RGB  | PFNC_OCCUPY48BIT  | 0x001B)
+#define PFNC_YUV422_8_UYVY_ID                      (PFNC_RGB  | PFNC_OCCUPY16BIT  | 0x001F)
+#define PFNC_YUV422_8_ID16                         (PFNC16_YUV       | PFNC16_422      | PFNC16_8_BITS)
+#define PFNC_YUV422_8_ID                           (PFNC_RGB  | PFNC_OCCUPY16BIT  | 0x0032)
+
+#endif // PFNC_MONO
+#endif //PFNC_H
+#endif //MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+
+#endif
diff --git a/Common_Class/Matrox/Include/MilDSFCapture.h b/Common_Class/Matrox/Include/MilDSFCapture.h
new file mode 100644
index 0000000..b600106
--- /dev/null
+++ b/Common_Class/Matrox/Include/MilDSFCapture.h
@@ -0,0 +1,618 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MilCaptureBase.H
+* Revision     :  10.30.0643
+* Content      :  This file contains the interface structure required for 
+*                 MIL Capture DirectShow Filter.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+
+#pragma once
+#pragma warning(disable:4995)
+
+#include <initguid.h>
+#include "MilDSFCaptureGUID.h"
+
+#include <mil.h>
+
+#define MEDIASUBTYPE_INVERTED 0x10000000L
+enum MEDIASUBTYPE_FORMAT
+{
+   MF_UNKNOWN     = -1,
+   MF_RGB32       = 0,
+   MF_YUV16       = 1,
+   MF_NV12        = 2,
+   MF_RGB24       = 3,
+   MF_ARGB32      = 4,
+   MF_RGB32_INV   = MEDIASUBTYPE_INVERTED|MF_RGB32,
+   MF_RGB24_INV   = MEDIASUBTYPE_INVERTED|MF_RGB24,
+   MF_ARGB32_INV  = MEDIASUBTYPE_INVERTED|MF_ARGB32,
+};
+
+enum CAPTURE_BUFFER_FORMAT
+{
+   CBF_UNKNOWN    = -1,
+   CBF_BGR32      = 0,
+   CBF_YUV16_YUYV = 1,
+   CBF_MONO8      = 2,
+};
+
+enum PinDbgParam
+   {
+   PRINT_PIN_FRAME_COUNTER,
+   PRINT_PIN_TIMESTAMP,
+   };
+
+/////////////////////////////////////////////////////////////////
+//
+// Interface         : IMilCapture
+//
+// Synopsis          : Access the system
+//
+// Comments          : for the functions begining with "sys" they are
+//                      equivalent to Msys from Mil but you do not
+//                      need to place the MIL_ID of the system
+//
+/////////////////////////////////////////////////////////////////
+DECLARE_INTERFACE_(IMilCapture, IBaseFilter)
+   {
+   // USE THIS METHOD BEFORE ADDING THE FILTER
+#if UNICODE
+#define setSystemInfo setSystemInfoW
+#else
+#define setSystemInfo setSystemInfoA
+#endif
+
+   STDMETHOD(setSystemInfoA)
+      ( THIS_
+      const char* systemName, // [in] system descriptor string
+      MIL_INT devNum // [in] system Number
+      )  PURE;
+
+   STDMETHOD(setSystemInfoW)
+      ( THIS_
+      const wchar_t* systemName, // [in] system descriptor string
+      MIL_INT devNum // [in] system Number
+      )  PURE;
+
+   STDMETHOD(getAppID)
+      ( THIS_
+      MIL_ID* appID  // [out] adress to contain the returning application MIL_ID
+      )  PURE;
+
+   // -------------------------------------------------------------------------
+   // Mil System exposed function
+   // -------------------------------------------------------------------------
+   // Same Call as Mil MsysControl without SystemId
+   STDMETHOD(sysControl)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT ControlValue
+      )  PURE;
+
+   // Same Call as Mil MsysGetHookInfo without SystemId
+   STDMETHOD(sysGetHookInfo)
+      ( THIS_
+      MIL_ID EventId,
+      MIL_INT64 InquireType,
+      MIL_INT* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MsysHookFunction without SystemId
+   STDMETHOD(sysHookFunction)
+      ( THIS_
+      MIL_INT HookType,
+      MIL_SYS_HOOK_FUNCTION_PTR HookHandlerPtr,
+      void* UserDataPtr
+      )  PURE;
+
+   // *************************************************************************
+   // Multiple definition for sysInquire to support all output format
+   // *************************************************************************
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT32* UserVarPtr 
+      )  PURE;
+
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT64* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_TEXT_CHAR* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT32* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT64* UserVarPtr
+      )  PURE;
+#endif // M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+   };
+
+
+/////////////////////////////////////////////////////////////////
+//
+// Interface         : IMilCapturePin
+//
+// Synopsis          : Access the digitizer
+//
+// Comments          : for the functions begining with "dig" they are
+//                      equivalent to Mdig call from Mil but you do not
+//                      need to place the MIL_ID of the Digitizer
+//
+/////////////////////////////////////////////////////////////////
+DECLARE_INTERFACE_(IMilCapturePin, IPin)
+   {
+#if UNICODE
+#define set_DigitizerInfo set_DigitizerInfoW
+#else
+#define set_DigitizerInfo set_DigitizerInfoA
+#endif
+
+   STDMETHOD(DigAlloc)
+      (THIS_
+         bool bRealloc = false
+         )  PURE;
+
+   STDMETHOD(DigFree)
+      (THIS_
+         )  PURE;
+
+   STDMETHOD(set_DigitizerInfoW)
+      ( THIS_
+      MIL_INT DevNum,   // [in] Digitizer Number.
+      MIL_INT64 ChNum,  // [in] Digitizer channel Number.
+      const wchar_t* DCFPath    // [in] complete string to represent the DCF.
+      )  PURE;
+
+   STDMETHOD(set_DigitizerInfoA)
+      ( THIS_
+      MIL_INT DevNum,   // [in] Digitizer Number.
+      MIL_INT64 ChNum,  // [in] Digitizer channel Number.
+      const char* DCFPath    // [in] complete string to represent the DCF.
+      )  PURE;
+
+   STDMETHOD(get_FIFOSize)
+      ( THIS_
+      MIL_INT* FIFOSize // [out] Number of buffer to allocate for MdigProcess.
+      )  PURE;
+
+   STDMETHOD(set_FIFOSize)
+      ( THIS_
+      MIL_INT FIFOSize // [in] Number of buffer to allocate for MdigProcess.
+      )  PURE;
+
+   STDMETHOD(is_DigAllocated)
+      ( THIS_
+      )  PURE;
+
+   STDMETHOD(set_DebugParam)
+      ( THIS_
+      PinDbgParam DebugOptionType, // [in] Debug parameter ID.
+      MIL_INT DebugOptionValue // [in] Value to set.
+      )  PURE;
+
+   STDMETHOD(get_DebugParam)
+      ( THIS_
+      PinDbgParam DebugOptionType, // [in] Debug parameter ID.
+      MIL_INT* DebugOptionValue // [out] Value of the parameter.
+      )  PURE;
+
+   // Function moves specified MediaSubType Format to desired rank
+   STDMETHOD(Set_PinMediaSubTypePriority)
+      ( THIS_
+      MEDIASUBTYPE_FORMAT mfID,  // [in] Pin MediaSubtype format to move.
+      MIL_INT priorityIdx        // [in] position indexed at 0 of the rank in priority.
+      )  PURE;
+
+   STDMETHOD(Get_PinMediaSubTypeAtPriority)
+      ( THIS_
+      MIL_INT priorityIdx,       // [in] position indexed at 0 of the rank in priority.
+      MEDIASUBTYPE_FORMAT* mfID  // [out] Pin MediaSubtype format pointer.
+      )  PURE;
+
+   // Function moves specified Capture Buffer Format to desired rank
+   STDMETHOD(Set_CaptureBufferFormatPriority)
+      ( THIS_
+      CAPTURE_BUFFER_FORMAT cbfID,  // [in] Capture Buffer Format to move.
+      MIL_INT priorityIdx           // [in] position indexed at 0 of the rank in priority.
+      )  PURE;
+
+   STDMETHOD(Get_CaptureBufferFormatAtPriority)
+      ( THIS_
+      MIL_INT priorityIdx,          // [in] position indexed at 0 of the rank in priority.
+      CAPTURE_BUFFER_FORMAT* cbfID  // [out] Capture Buffer Format pointer.
+      )  PURE;
+
+   STDMETHOD_(void, Set_SyncFrameRate)
+      ( THIS_
+      BOOL bForce,                  // [in] force to use the custom value.
+      MIL_DOUBLE fSyncFrameRate     // [in] specifies the frame rate used for synchronization.
+      )  PURE;
+
+   // Return if the value was forced to a custom value.
+   // true means the value is set to a custom value
+   // false means it uses the digitizer internal value
+   STDMETHOD_(BOOL, IsForcedSyncFrameRate)
+      ( THIS_
+      MIL_DOUBLE* pfSyncFrameRate
+      )  PURE;
+
+
+   // -------------------------------------------------------------------------
+   // Mil Digitizer exposed function
+   // -------------------------------------------------------------------------
+   // Same Call as Mil MdigChannel without DigId
+   __declspec(deprecated) STDMETHOD(digChannel)
+      ( THIS_
+      MIL_INT64 channel
+      )  PURE;
+
+   // Same Call as Mil MdigControl without DigId
+   STDMETHOD(digControl)
+      ( THIS_
+      MIL_INT64  ControlType,
+      MIL_DOUBLE ControlValue
+      )  PURE;
+
+   // Same Call as Mil MdigControl without DigId
+   STDMETHOD(digControl)
+      ( THIS_
+      MIL_INT64  ControlType,
+      MIL_INT32 ControlValue
+      )  PURE;
+
+   // Same Call as Mil MdigControl without DigId
+   STDMETHOD(digControl)
+      ( THIS_
+      MIL_INT64  ControlType,
+      MIL_INT64 ControlValue
+      )  PURE;
+
+   // Same Call as Mil MdigControl without DigId
+   STDMETHOD(digControl)
+      (THIS_
+         MIL_INT64  ControlType,
+         MIL_CONST_TEXT_PTR ControlValue
+         )  PURE;
+
+#if UNICODE
+#define digControlFeature digControlFeatureW
+#else
+#define digControlFeature digControlFeatureA
+#endif
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      char* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT64* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_DOUBLE* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT32* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_UINT8* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      int FeatureValue
+      )  PURE;
+
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_TEXT_CHAR* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT64* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_DOUBLE* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT32* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_UINT8* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      int FeatureValue
+      )  PURE;
+
+   // *************************************************************************
+   // Multiple definition for digGetHookInfo to support all output format
+   // *************************************************************************
+   // Same Call as Mil MdigGetHookInfo without DigId
+   STDMETHOD(digGetHookInfo)
+      ( THIS_
+      MIL_ID EventId,
+      MIL_INT64 InfoType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigGetHookInfo
+   STDMETHOD(digGetHookInfo)
+      ( THIS_
+      MIL_ID EventId,
+      MIL_INT64 InfoType,
+      MIL_INT* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigHokfunction without DigId
+   STDMETHOD(digHookFunction)
+      ( THIS_
+      MIL_INT HookType,
+      MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr,
+      void* UserDataPtr
+      )  PURE;
+
+   // *************************************************************************
+   // Multiple definition for digInquire to support all output format
+   // *************************************************************************
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT32* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT64* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_TEXT_CHAR* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT32* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT64* UserVarPtr
+      )  PURE;
+#endif // M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+#if UNICODE
+#define digInquireFeature digInquireFeatureW
+#else
+#define digInquireFeature digInquireFeatureA
+#endif
+
+   // Same Call as Mil MdigInquireFeature without DigitizerId
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      char* FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT64 *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_DOUBLE *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT32 *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_UINT8 *FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquireFeature without DigitizerId
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_TEXT_CHAR* FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT64 *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_DOUBLE *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT32 *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_UINT8 *FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigReference without DigId
+   __declspec(deprecated) STDMETHOD(digReference)
+      ( THIS_
+      MIL_INT64  ReferenceType,
+      MIL_DOUBLE ReferenceLevel
+      )  PURE;
+   };
+
+// callback definition
+typedef void (*MANAGEDCALLBACKPROC)(MIL_ID bufID, AM_MEDIA_TYPE *pmt, void* userCallbackData);
+
+/////////////////////////////////////////////////////////////////
+//
+// Interface         : IMilSampleGrabber
+//
+// Synopsis          : Receive hook on each Media Sample
+//
+// Comments          : 
+//
+/////////////////////////////////////////////////////////////////
+DECLARE_INTERFACE_(IMilSampleGrabber, IUnknown)
+   {
+   STDMETHOD(RegisterCallback)
+      ( THIS_
+      MANAGEDCALLBACKPROC callback,
+      void* UserCallbackData=NULL
+      )  PURE;
+
+   STDMETHOD(SetMediaType)
+      ( THIS_
+      const AM_MEDIA_TYPE *pType
+      )  PURE;
+   };
diff --git a/Common_Class/Matrox/Include/MilDSFCaptureGUID.h b/Common_Class/Matrox/Include/MilDSFCaptureGUID.h
new file mode 100644
index 0000000..12023dc
--- /dev/null
+++ b/Common_Class/Matrox/Include/MilDSFCaptureGUID.h
@@ -0,0 +1,44 @@
+锘�
+/************************************************************************/
+/*
+*
+* Filename     :  MilCaptureFilterUids.H
+* Revision     :  10.30.0643
+* Content      :  This file contains the GUIDs relative to the  
+*                 MIL Capture DirectShow Filter.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+
+#pragma once
+
+
+// {F39B53A0-9881-468A-B256-2AFCDC070A18}
+DEFINE_GUID(CLSID_MilSampleGrabber, 
+   0xf39b53a0, 0x9881, 0x468a, 0xb2, 0x56, 0x2a, 0xfc, 0xdc, 0x7, 0xa, 0x18);
+
+// {54CEB8AD-D0DB-474D-B3A8-2282F7249192}
+DEFINE_GUID(CLSID_MilCapture,
+   0x54ceb8ad, 0xd0db, 0x474d, 0xb3, 0xa8, 0x22, 0x82, 0xf7, 0x24, 0x91, 0x92);
+
+//
+// IMilCapture's GUID
+//
+// {39450A9A-2ACC-42A2-8D40-0FC3DA005767}
+DEFINE_GUID(IID_IMilCapture, 
+   0x39450a9a, 0x2acc, 0x42a2, 0x8d, 0x40, 0xf, 0xc3, 0xda, 0x0, 0x57, 0x67);
+
+// {88D68975-9802-444F-9B37-1EC5E978C14A}
+DEFINE_GUID(IID_IMilCapturePin, 
+   0x88d68975, 0x9802, 0x444f, 0x9b, 0x37, 0x1e, 0xc5, 0xe9, 0x78, 0xc1, 0x4a);
+
+//
+// IMilSampleGraber's GUID
+//
+// {9491EF84-DC84-4793-9272-0CFAE6B50502}
+DEFINE_GUID(IID_IMilSampleGrabber, 
+   0x9491ef84, 0xdc84, 0x4793, 0x92, 0x72, 0xc, 0xfa, 0xe6, 0xb5, 0x5, 0x2);
diff --git a/Common_Class/Matrox/Include/MilDSFSequence.h b/Common_Class/Matrox/Include/MilDSFSequence.h
new file mode 100644
index 0000000..70f2d64
--- /dev/null
+++ b/Common_Class/Matrox/Include/MilDSFSequence.h
@@ -0,0 +1,168 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MilDSFSequence.H
+* Revision     :  10.30.0643
+* Content      :  This file contains the interface structure required for 
+*                 Matrox Image Compression Filter.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+
+#pragma once
+#pragma warning(disable:4995)
+
+#include <initguid.h>
+#include "MilDSFSequenceGUID.h"
+
+#include <mil.h>
+
+/////////////////////////////////////////////////////////////////
+//
+// Interface         : IMilSequenceEncode
+//
+// Synopsis          : Access the encoding context
+//
+// Comments          : Control and Inquire functions are equivalent to
+//                     MseqControl and MseqInquire except you do not have to
+//                     specify a MIL_ID for the sequence context.
+//
+/////////////////////////////////////////////////////////////////
+DECLARE_INTERFACE_(IMilSequenceEncode, IBaseFilter)
+   {
+   STDMETHOD_(MIL_ID, GetMilSystemId)
+      (THIS_)PURE;
+
+   STDMETHOD_(void, Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_DOUBLE ControlValue
+      )  PURE;
+
+   STDMETHOD_(void, Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT32 ControlValue
+      )  PURE;
+
+   STDMETHOD_(void, Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT64 ControlValue
+      )  PURE;
+
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT32* UserVarPtr
+      )  PURE;
+
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT64* UserVarPtr
+      )  PURE;
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT32* UserVarPtr
+      )  PURE;
+
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT64* UserVarPtr
+      )  PURE;
+#endif // M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+   STDMETHOD (InitParam)
+      ( THIS_
+      MIL_UINT32 OutputFormat,
+      MIL_INT64 InitFlag
+      )  PURE;
+
+   STDMETHOD(GetInitFlag)
+      ( THIS_
+      MIL_INT64* pInitFlag
+      )  PURE;
+   };
+
+
+DECLARE_INTERFACE_(IMilSequenceDecode, IBaseFilter)
+   {
+   STDMETHOD_(MIL_ID, GetMilSystemId)
+      (THIS_)PURE;
+
+   STDMETHOD(Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_DOUBLE ControlValue
+      )  PURE;
+
+   STDMETHOD(Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT32 ControlValue
+      )  PURE;
+
+   STDMETHOD(Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT64 ControlValue
+      )  PURE;
+
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT32* UserVarPtr
+      )  PURE;
+
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT64* UserVarPtr
+      )  PURE;
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT32* UserVarPtr
+      )  PURE;
+
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT64* UserVarPtr
+      )  PURE;
+#endif // M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+   STDMETHOD (InitParam)
+      ( THIS_
+      MIL_UINT32 OutputFormat,
+      MIL_INT64 InitFlag
+      )  PURE;
+
+   STDMETHOD(GetInitFlag)
+      (THIS_
+      MIL_INT64* pInitFlag
+      )  PURE;
+   };
diff --git a/Common_Class/Matrox/Include/MilDSFSequenceGUID.h b/Common_Class/Matrox/Include/MilDSFSequenceGUID.h
new file mode 100644
index 0000000..60ac898
--- /dev/null
+++ b/Common_Class/Matrox/Include/MilDSFSequenceGUID.h
@@ -0,0 +1,33 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MilDSFSequenceGUID.H
+* Revision     :  10.30.0643
+* Content      :  This file contains the GUIDs relative to the  
+*                 Matrox Image Compression Filter.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+
+#pragma once
+
+// {B218240E-DC4B-477B-83A7-57611302555D}
+DEFINE_GUID(CLSID_MilSequenceEncode, 
+            0xb218240e, 0xdc4b, 0x477b, 0x83, 0xa7, 0x57, 0x61, 0x13, 0x2, 0x55, 0x5d);
+
+// {80B8662C-1FD1-438D-BE7B-FA580B30F31C}
+DEFINE_GUID(CLSID_MilSequenceDecode, 
+            0x80b8662c, 0x1fd1, 0x438d, 0xbe, 0x7b, 0xfa, 0x58, 0xb, 0x30, 0xf3, 0x1c);
+
+
+// {D83CE998-4E95-42F0-9BE0-9C32A2954C1A}
+DEFINE_GUID(IID_IMilSequenceEncode, 
+            0xd83ce998, 0x4e95, 0x42f0, 0x9b, 0xe0, 0x9c, 0x32, 0xa2, 0x95, 0x4c, 0x1a);
+
+// {570480A1-1D35-4822-997D-01C683A0C5F3}
+DEFINE_GUID(IID_IMilSequenceDecode, 
+            0x570480a1, 0x1d35, 0x4822, 0x99, 0x7d, 0x1, 0xc6, 0x83, 0xa0, 0xc5, 0xf3);
diff --git a/Common_Class/Matrox/Include/MilDyn.h b/Common_Class/Matrox/Include/MilDyn.h
new file mode 100644
index 0000000..40dd255
--- /dev/null
+++ b/Common_Class/Matrox/Include/MilDyn.h
@@ -0,0 +1,20 @@
+锘�//==============================================================================
+// Filename:  MILDYN.H
+// Created by: M10U107.
+// Content:  This file was dynamically created by the Mil installation program.
+// COPYRIGHT (c) Matrox Electronic Systems Ltd.
+// All Rights Reserved
+//==============================================================================
+
+#define M_MIL_LITE 1
+#if !M_MIL_USE_64BIT
+#error "Win64 installation: Please select the x64 configuration."
+#endif
+
+#include "MilDyn\mil3ddisp.h"
+#include "MilDyn\mil3dgeo.h"
+#include "MilDyn\mil3dgra.h"
+#include "MilDyn\milcom.h"
+#include "MilDyn\mildisplay.h"
+#include "MilDyn\milim.h"
+#include "MilDyn\PFNC.h"
diff --git a/Common_Class/Matrox/Include/MilFunc.h b/Common_Class/Matrox/Include/MilFunc.h
new file mode 100644
index 0000000..89cc971
--- /dev/null
+++ b/Common_Class/Matrox/Include/MilFunc.h
@@ -0,0 +1,455 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILFUNC.H
+    Revision:  10.40.0640
+    Content :  This file contains the prototypes for the Matrox
+               Imaging Library (MIL) Mfunc user's functions.
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef __MILFUNC_H
+#define __MILFUNC_H
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/***************************************************************************/
+/* TOOLKIT FOR PSEUDO MIL FUNCTIONS DEVELOPMENT                            */
+/***************************************************************************/
+typedef void (MFTYPE *MIL_FUNC_FUNCTION_PTR)(MIL_ID FunctionId);
+typedef MIL_FUNC_FUNCTION_PTR MFUNCSLAVEFCTPTR;
+typedef MIL_FUNC_FUNCTION_PTR MFUNCFCTPTR;
+typedef MIL_FUNC_FUNCTION_PTR MFUNCSLAVEPAFCTPTR;
+
+// we need the ASCII version even on non-Unicode version
+// this is needed for transferring ASCII strings in DMIL 
+MIL_DLLFUNC void MFTYPE MfuncParamMilTextA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXTA_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstMilTextA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTA_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamFilenameA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTA_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+#if M_MIL_USE_UNICODE
+   MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocW(MIL_CONST_TEXTW_PTR FunctionName,
+                             MIL_INT ParameterNum,
+                             MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr,
+                             MIL_CONST_TEXTW_PTR SlaveFunctionDLLName,
+                             MIL_CONST_TEXTW_PTR SlaveFunctionName,
+                             MIL_INT SlaveFunctionOpcode,
+                             MIL_INT64 InitFlag,
+                             MIL_ID *CBasedContextFuncIdPtr);
+   MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocA(MIL_CONST_TEXTA_PTR FunctionName,
+                             MIL_INT ParameterNum,
+                             MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr,
+                             MIL_CONST_TEXTA_PTR SlaveFunctionDLLName,
+                             MIL_CONST_TEXTA_PTR SlaveFunctionName,
+                             MIL_INT SlaveFunctionOpcode,
+                             MIL_INT64 InitFlag,
+                             MIL_ID *CBasedContextFuncIdPtr);
+
+   MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocScriptW(MIL_CONST_TEXTW_PTR FunctionName,
+                             MIL_INT ParameterNum,
+                             MIL_CONST_TEXTW_PTR InterpreterLanguage,
+                             MIL_CONST_TEXTW_PTR ScriptFileName,
+                             MIL_CONST_TEXTW_PTR ScriptFunctionName,
+                             MIL_INT ScriptFunctionOpcode,
+                             MIL_INT64 InitFlag,
+                             MIL_ID *ScriptBasedContextFuncIdPtr);
+   MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocScriptA(MIL_CONST_TEXTA_PTR FunctionName,
+                             MIL_INT ParameterNum,
+                             MIL_CONST_TEXTA_PTR InterpreterLanguage,
+                             MIL_CONST_TEXTA_PTR ScriptFileName,
+                             MIL_CONST_TEXTA_PTR ScriptFunctionName,
+                             MIL_INT ScriptFunctionOpcode,
+                             MIL_INT64 InitFlag,
+                             MIL_ID *ScriptBasedContextFuncIdPtr);
+
+   MIL_DLLFUNC MIL_INT MFTYPE MfuncErrorReportW(MIL_ID ContextFuncId,
+                                    MIL_INT ErrorCode,
+                                    MIL_CONST_TEXTW_PTR ErrorMessage,
+                                    MIL_CONST_TEXTW_PTR ErrorSubMessage1,
+                                    MIL_CONST_TEXTW_PTR ErrorSubMessage2,
+                                    MIL_CONST_TEXTW_PTR ErrorSubMessage3);
+   MIL_DLLFUNC MIL_INT MFTYPE MfuncErrorReportA(MIL_ID ContextFuncId,
+                                    MIL_INT ErrorCode,
+                                    MIL_CONST_TEXTA_PTR ErrorMessage,
+                                    MIL_CONST_TEXTA_PTR ErrorSubMessage1,
+                                    MIL_CONST_TEXTA_PTR ErrorSubMessage2,
+                                    MIL_CONST_TEXTA_PTR ErrorSubMessage3);
+
+   MIL_DLLFUNC void MFTYPE MfuncParamMilTextW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXTW_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+   MIL_DLLFUNC void MFTYPE MfuncParamConstMilTextW(MIL_ID ContextFuncId, MIL_INT ParamIndex,MIL_CONST_TEXTW_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+   MIL_DLLFUNC void MFTYPE MfuncParamFilenameW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTW_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+   MIL_DLLFUNC MIL_INT MFTYPE MfuncPrintMessageW(MIL_INT Mode,
+                                     MIL_CONST_TEXTW_PTR Str1,
+                                     MIL_CONST_TEXTW_PTR Str2,
+                                     MIL_CONST_TEXTW_PTR Str3,
+                                     MIL_CONST_TEXTW_PTR Str4,
+                                     MIL_CONST_TEXTW_PTR Str5);
+   MIL_DLLFUNC MIL_INT MFTYPE MfuncPrintMessageA(MIL_INT Mode,
+                                     MIL_CONST_TEXTA_PTR Str1,
+                                     MIL_CONST_TEXTA_PTR Str2,
+                                     MIL_CONST_TEXTA_PTR Str3,
+                                     MIL_CONST_TEXTA_PTR Str4,
+                                     MIL_CONST_TEXTA_PTR Str5);
+   MIL_DLLFUNC void MFTYPE MfuncParamA(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void* ParamValuePtr, MIL_UINT ParamType, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+   MIL_DLLFUNC void MFTYPE MfuncParamW(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void* ParamValuePtr, MIL_UINT ParamType, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+
+   #if M_MIL_UNICODE_API
+      #define MfuncAlloc                     MfuncAllocW
+      #define MfuncAllocScript               MfuncAllocScriptW
+      #define MfuncErrorReport               MfuncErrorReportW
+      #define MfuncParamMilText              MfuncParamMilTextW
+      #define MfuncParamConstMilText         MfuncParamConstMilTextW
+      #define MfuncParamFilename             MfuncParamFilenameW
+      #define MfuncPrintMessage              MfuncPrintMessageW
+      #define MfuncParam                     MfuncParamW
+   #else
+      #define MfuncAlloc                     MfuncAllocA
+      #define MfuncAllocScript               MfuncAllocScriptA
+      #define MfuncErrorReport               MfuncErrorReportA
+      #define MfuncParamMilText              MfuncParamMilTextA
+      #define MfuncParamConstMilText         MfuncParamConstMilTextA
+      #define MfuncParamFilename             MfuncParamFilenameA
+      #define MfuncPrintMessage              MfuncPrintMessageA
+      #define MfuncParam                     MfuncParamA
+   #endif
+   #else
+      MIL_DLLFUNC MIL_ID MFTYPE MfuncAlloc(MIL_CONST_TEXT_PTR FunctionName,
+                              MIL_INT ParameterNum,
+                              MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr,
+                              MIL_CONST_TEXT_PTR SlaveFunctionDLLName,
+                              MIL_CONST_TEXT_PTR SlaveFunctionName,
+                              MIL_INT SlaveFunctionOpcode,
+                              MIL_INT64 InitFlag,
+                              MIL_ID *CBasedContextFuncIdPtr);
+
+      MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocScript(MIL_CONST_TEXT_PTR FunctionName,
+                              MIL_INT ParameterNum,
+                              MIL_CONST_TEXT_PTR InterpreterLanguage,
+                              MIL_CONST_TEXT_PTR ScriptFileName,
+                              MIL_CONST_TEXT_PTR ScriptFunctionName,
+                              MIL_INT ScriptFunctionOpcode,
+                              MIL_INT64 InitFlag,
+                              MIL_ID *ScriptBasedContextFuncIdPtr);
+
+      MIL_DLLFUNC MIL_INT MFTYPE MfuncErrorReport( MIL_ID ContextFuncId,
+                                       MIL_INT ErrorCode,
+                                       MIL_CONST_TEXT_PTR ErrorMessage,
+                                       MIL_CONST_TEXT_PTR ErrorSubMessage1,
+                                       MIL_CONST_TEXT_PTR ErrorSubMessage2,
+                                       MIL_CONST_TEXT_PTR ErrorSubMessage3);
+
+      MIL_DLLFUNC void MFTYPE MfuncParamMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXT_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+      MIL_DLLFUNC void MFTYPE MfuncParamConstMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex,MIL_CONST_TEXT_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+
+      MIL_DLLFUNC void MFTYPE MfuncParamFilename(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXT_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+
+      MIL_DLLFUNC MIL_INT MFTYPE MfuncPrintMessage(MIL_INT Mode, MIL_CONST_TEXT_PTR Str1,
+                                       MIL_CONST_TEXT_PTR Str2,
+                                       MIL_CONST_TEXT_PTR Str3,
+                                       MIL_CONST_TEXT_PTR Str4,
+                                       MIL_CONST_TEXT_PTR Str5);
+      MIL_DLLFUNC void MFTYPE MfuncParam(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void* ParamValuePtr, MIL_UINT ParamType, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+#endif
+// compatibility function
+#if OldDefinesSupport
+#define MfuncParamString   MfuncParamMilText
+MIL_DEPRECATED(MfuncParamString, 1000)
+#endif
+
+
+MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocId(MIL_ID ContextFuncId, MIL_INT64 MilObjectType, void *UserObjectPtr);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncParamCheck(MIL_ID ContextFuncId);
+MIL_DLLFUNC void MFTYPE MfuncParamMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID ParamValue, MIL_INT64 MilObjectType, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamId MfuncParamMilId // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamId, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamLong (MIL_ID ContextFuncId, MIL_INT ParamIndex, long ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT32 ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT64 ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT32 ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT64 ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_DOUBLE ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UUID ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamDataPointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, void *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamDouble MfuncParamMilDouble // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamDouble, 1000)
+#define MfuncParamPointer MfuncParamDataPointer
+MIL_DEPRECATED(MfuncParamPointer, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamIdPointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID *ParamValuePtr, MIL_INT64 MilObjectType, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamValue(MIL_ID ContextFuncId, MIL_INT ParamIndex, void *ParamValuePtr);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncGetError(MIL_ID FunctId, MIL_INT ErrorType,void* ErrorVarPtr);
+MIL_DLLFUNC void MFTYPE MfuncFreeId(MIL_ID ContextFuncId, MIL_ID UserObjectFuncId);
+MIL_DLLFUNC void MFTYPE MfuncFree(MIL_ID ContextFuncId);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncCall(MIL_ID ContextFuncId);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncInquire(MIL_ID MilObjectId, MIL_INT64 InquireType, void* UserVarPtr);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncExit();
+MIL_DLLFUNC void* MFTYPE MfuncMemory(MIL_INT64 Operation, MIL_INT OperationValue, MIL_INT64 OperationFlag, void *DataPointer);
+MIL_DLLFUNC MIL_ID MFTYPE MfuncGetNextId(MIL_ID CurrentId);
+MIL_DLLFUNC void MFTYPE MfuncMDTrace(void** FileHandle, MIL_INT64 Action, void* DataPointer);
+MIL_DLLFUNC void MFTYPE MfuncTraceTimerRead(MIL_DOUBLE* pCurrentTime);
+
+
+/* The following MfuncParamValue are for getting the value by type */
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT32 *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT64 *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT32 *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT64 *ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_DOUBLE *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UUID *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID *ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_DOUBLE **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_DOUBLE **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UUID **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UUID **ParamValuePtr);
+
+#if OldDefinesSupport
+#define MfuncParamValueDouble MfuncParamValueMilDouble                     // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueDouble, 1000)
+#define MfuncParamValueId MfuncParamValueMilId                             // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueId, 1000)
+#define MfuncParamValueArrayDouble MfuncParamValueArrayMilDouble           // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueArrayDouble, 1000)
+#define MfuncParamValueConstArrayDouble MfuncParamValueConstArrayMilDouble // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueConstArrayDouble, 1000)
+#endif
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilTextA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXTA_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstMilTextA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTA_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueFilenameA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTA_PTR *ParamValuePtr);
+
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+#define MfuncParamValueMilText            MfuncParamValueMilTextW
+#define MfuncParamValueConstMilText       MfuncParamValueConstMilTextW
+#define MfuncParamValueFilename           MfuncParamValueFilenameW
+#else
+#define MfuncParamValueMilText            MfuncParamValueMilTextA
+#define MfuncParamValueConstMilText       MfuncParamValueConstMilTextA
+#define MfuncParamValueFilename           MfuncParamValueFilenameA
+#endif
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilTextW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXTW_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstMilTextW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTW_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueFilenameW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTW_PTR *ParamValuePtr);
+
+#else
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXT_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXT_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueFilename(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXT_PTR *ParamValuePtr);
+
+#endif
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT **ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT32 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT32 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT64 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT64 **ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT32 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT32 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT64 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT64 **ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID **ParamValuePtr);
+#if OldDefinesSupport
+#define MfuncParamValueArrayId MfuncParamValueArrayMilId                          // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueArrayId, 1000)
+#endif
+
+MIL_DLLFUNC void MFTYPE MfuncParamValuePointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, void ** ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstDataPointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void ** ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex,const MIL_ID **ParamValuePtr);
+#if OldDefinesSupport
+#define MfuncParamValueConstArrayId MfuncParamValueConstArrayMilId                // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueConstArrayId, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT **ParamValuePtr);
+
+
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_DOUBLE *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UUID *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamArrayDouble MfuncParamArrayMilDouble   // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamArrayDouble, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID *ParamValuePtr, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamArrayId MfuncParamArrayMilId           // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamArrayId, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT32 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT64 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT32 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT64 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_DOUBLE *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UUID *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamConstArrayDouble MfuncParamConstArrayMilDouble // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamConstArrayDouble, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT32 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT64 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT32 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT64 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex,const MIL_ID *ParamValuePtr, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamConstArrayId MfuncParamConstArrayMilId // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamConstArrayId, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+MIL_DLLFUNC void MFTYPE MfuncParamConstDataPointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void * ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+typedef struct 
+   {
+   MIL_INT32 StructSize;
+   MIL_INT32 ScriptPathSize;
+   MIL_INT32 ScriptPathOffset;
+   MIL_INT32 ScriptFunctionNameSize;
+   MIL_INT32 ScriptFunctionNameOffset;
+   MIL_INT32 DebugPathSize;
+   MIL_INT32 DebugPathOffset;
+   MIL_INT32 ReferenceListSize;
+   MIL_INT32 ReferenceListOffset;
+   MIL_INT64 Compile;
+   MIL_INT64 DebugInfo;
+   } M_FUNCSCRIPT_CALL_DATA;
+
+/*The following Mfunc functions are obsolete*/
+MIL_DLLFUNC MIL_INT MFTYPE MfuncStart(MIL_ID ContextFuncId);          /*Replaced by MfuncCall*/
+MIL_DLLFUNC void    MFTYPE MfuncFreeAndEnd(MIL_ID ContextFuncId);     /*Replaced by MfuncCall*/
+MIL_DLLFUNC MIL_INT MFTYPE MfuncModified(MIL_ID ImageId);      /*Replaced by MbufControl(M_MODIFIED)*/
+MIL_DLLFUNC MIL_INT MFTYPE MfuncParamRegister(MIL_ID ContextFuncId);  /*Parameters must always be registered*/
+MIL_DLLFUNC MIL_INT MFTYPE MfuncIdGetObjectType(MIL_ID FunctionId, MIL_ID ObjectId);               /*Replaced by MfuncInquire*/
+MIL_DLLFUNC void    MFTYPE MfuncIdSetUserPtr(MIL_ID FunctionId, MIL_ID ObjectId, void *UserPtr);   /*Replaced by MfuncControl*/
+MIL_DLLFUNC void*   MFTYPE MfuncIdGetUserPtr(MIL_ID FunctionId, MIL_ID ObjectId);                  /*Replaced by MfuncInquire*/
+
+#if MIL_COMPILE_VERSION >= 1040 || M_MIL_USE_64BIT
+MIL_DLLFUNC void   MFTYPE MfuncControlInt64(MIL_ID ContextFuncId, MIL_INT64 ControlType, MIL_INT64 ControlValue);
+MIL_DLLFUNC void   MFTYPE MfuncControlDouble(MIL_ID ContextFuncId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue);
+#else
+#define MfuncControlDouble MfuncControl
+#define MfuncControlInt64 MfuncControl
+#endif
+
+#if !M_MIL_USE_64BIT
+MIL_DLLFUNC void   MFTYPE MfuncControl(MIL_ID ContextFuncId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue);
+#endif   //M_MIL_USE_64BIT
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+}
+#endif
+
+#if M_MIL_USE_64BIT
+
+#ifdef __cplusplus
+//////////////////////////////////////////////////////////////
+// MfuncControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+
+inline void MfuncControl(  MIL_ID ContextFuncId,
+                           MIL_INT64 ControlType,
+                           MIL_DOUBLE ControlValue)
+   {
+   MfuncControlDouble(ContextFuncId, ControlType, ControlValue);
+   }
+
+#else
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. Int64 one
+//////////////////////////////////////////////////////////////
+#define MfuncControl MfuncControlInt64
+#endif // __cplusplus
+
+#endif   //M_MIL_USE_64BIT
+
+//////////////////////////////////////////////////////////////
+// MfuncControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+
+#if MIL_COMPILE_VERSION >= 1040 || M_MIL_USE_64BIT
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue)
+   {
+   MfuncControlInt64(ContextFuncId, ControlType, ControlValue);
+   }
+#endif
+
+#if !(M_MIL_USE_LINUX  && M_MIL_USE_64BIT)
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= 1040
+   MfuncControlInt64(ContextFuncId, ControlType, ControlValue);
+#else
+   MfuncControl(ContextFuncId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+#endif
+
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   MIL_INT32 ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= 1040
+   MfuncControlInt64(ContextFuncId, ControlType, ControlValue);
+#else
+   MfuncControl(ContextFuncId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+
+
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MfuncControl(ContextFuncId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   void* ControlValue)
+   {
+   MfuncControl(ContextFuncId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+#endif
+
+
+#endif
diff --git a/Common_Class/Matrox/Include/MilFunctionCode.h b/Common_Class/Matrox/Include/MilFunctionCode.h
new file mode 100644
index 0000000..f1535c0
--- /dev/null
+++ b/Common_Class/Matrox/Include/MilFunctionCode.h
@@ -0,0 +1,737 @@
+锘�//////////////////////////////////////////////////////////////////////////////
+//
+// Filename          : MilFunctionCode.h
+// Content           : Functions opcodes :
+// Revision          : 10.40.0640
+//                     Values returned by MappGetHookInfo (M_CURRENT_FCT)
+//
+//
+// Copyright (c) Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+//////////////////////////////////////////////////////////////////////////////
+#ifndef __FUNCTIONCODES_H__
+#define __FUNCTIONCODES_H__
+
+#define M_NO_FUNCTION                               0x00000000
+
+#define M_SYS_ALLOC                                 0x00000001  // MsysAlloc
+#define M_SYS_FREE                                  0x00000002  // MsysFree
+#define M_SYS_INQUIRE                               0x00000003  // MsysInquire
+#define M_SYS_CONTROL                               0x00000004  // MsysControl
+#define M_SYS_HOOK_FUNCTION                         0x00000007  // MsysHookFunction
+#define M_SYS_GET_HOOK_INFO                         0x00000008  // MsysGetHookInfo
+#define M_SYS_IO_ALLOC                              0x00000009  // MsysIoAlloc
+#define M_SYS_IO_FREE                               0x0000000A  // MsysIoFree
+#define M_SYS_IO_CONTROL                            0x0000000B  // MsysIoControl
+#define M_SYS_IO_INQUIRE                            0x0000000C  // MsysIoInquire
+#define M_SYS_IO_COMMAND_REGISTER                   0x0000000D  // MsysIoCommandRegister
+#define M_SYS_CONTROL_FEATURE                       0x0000000E  // MsysControlFeature
+#define M_SYS_INQUIRE_FEATURE                       0x0000000F  // MsysInquireFeature
+
+#define M_BUF_ALLOC_2D                              0x00000201  // MbufAlloc2d
+#define M_BUF_CHILD_2D                              0x00000202  // MbufChild2d
+#define M_BUF_FREE                                  0x00000203  // MbufFree
+#define M_BUF_GET_2D                                0x00000204  // MbufGet2d
+#define M_BUF_PUT_2D                                0x00000205  // MbufPut2d
+#define M_BUF_COPY                                  0x00000206  // MbufCopy
+#define M_BUF_COPY_COLOR                            0x00000207  // MbufCopyColor
+#define M_BUF_GET_COLOR_2D                          0x00000208  // MbufGetColor2d
+#define M_BUF_PUT_COLOR_2D                          0x00000209  // MbufPutColor2d
+#define M_BUF_INQUIRE                               0x0000020A  // MbufInquire
+#define M_BUF_CHILD_COLOR_2D                        0x0000020B  // MbufChildColor2d
+#define M_BUF_CLEAR                                 0x0000020C  // MbufClear
+#define M_BUF_COPY_MASK                             0x0000020D  // MbufCopyMask
+#define M_BUF_COPY_COND                             0x0000020E  // MbufCopyCond
+#define M_BUF_CONTROL                               0x00000210  // MbufControl
+#define M_BUF_GET_LINE                              0x00000211  // MbufGetLine
+#define M_BUF_PUT_LINE                              0x00000212  // MbufPutLine
+#define M_BUF_CREATE_COLOR                          0x00000213  // MbufCreateColor
+#define M_BUF_COPY_COLOR_2D                         0x00000215  // MbufCopyColor2d
+#define M_BUF_HOOK_FUNCTION                         0x0000021C  // MbufHookFunction
+#define M_BUF_ALLOC_1D                              0x0000021D  // MbufAlloc1d
+#define M_BUF_ALLOC_COLOR                           0x0000021E  // MbufAllocColor
+#define M_BUF_BAYER                                 0x0000021F  // MbufBayer
+#define M_BUF_CHILD_1D                              0x00000220  // MbufChild1d
+#define M_BUF_CHILD_COLOR                           0x00000221  // MbufChildColor
+#define M_BUF_COPY_CLIP                             0x00000222  // MbufCopyClip
+#define M_BUF_CREATE_2D                             0x00000223  // MbufCreate2d
+#define M_BUF_DISK_INQUIRE                          0x00000224  // MbufDiskInquire
+#define M_BUF_EXPORT                                0x00000225  // MbufExport
+#define M_BUF_EXPORT_SEQUENCE                       0x00000226  // MbufExportSequence
+#define M_BUF_GET                                   0x00000227  // MbufGet
+#define M_BUF_GET_1D                                0x00000228  // MbufGet1d
+#define M_BUF_GET_COLOR                             0x00000229  // MbufGetColor
+#define M_BUF_IMPORT                                0x0000022A  // MbufImport
+#define M_BUF_IMPORT_SEQUENCE                       0x0000022B  // MbufImportSequence
+#define M_BUF_LOAD                                  0x0000022C  // MbufLoad
+#define M_BUF_CONTROL_AREA                          0x0000022D  // MbufControlArea
+#define M_BUF_PUT                                   0x0000022E  // MbufPut
+#define M_BUF_PUT_1D                                0x0000022F  // MbufPut1d
+#define M_BUF_PUT_COLOR                             0x00000230  // MbufPutColor
+#define M_BUF_RESTORE                               0x00000231  // MbufRestore
+#define M_BUF_SAVE                                  0x00000232  // MbufSave
+#define M_BUF_TRANSFER                              0x00000233  // MbufTransfer
+#define M_BUF_GET_HOOK_INFO                         0x00000234  // MbufGetHookInfo
+#define M_BUF_GET_ARC                               0x00000235  // MbufGetArc
+#define M_BUF_CHILD_MOVE                            0x00000237  // MbufChildMove
+#define M_BUF_SET_REGION                            0x00000238  // MbufSetRegion
+#define M_BUF_CLEAR_COND                            0x00000239  // MbufClearCond
+#define M_BUF_LINK                                  0x00000240  // MbufLink
+#define M_BUF_CLONE                                 0x00000241  // MbufClone
+#define M_BUF_CHILD_COLOR_2D_CLIP                   0x00000243  // MbufChildColor2dClip
+#define M_BUF_CONTROL_FEATURE                       0x00000244  // MbufControlFeature
+#define M_BUF_INQUIRE_FEATURE                       0x00000245  // MbufInquireFeature
+#define M_BUF_GET_LIST                              0x00000246  // MbufGetList
+#define M_BUF_PUT_LIST                              0x00000247  // MbufPutList
+#define M_BUF_ALLOC_DEFAULT                         0x0000024A  // MbufAllocDefault
+#define M_BUF_ALLOC_COLOR_NAMED                     0x0000024B  // MbufAllocColorNamed
+#define M_BUF_SET_DYNAMIC_PARAMETERS                0x0000024E  // MbufSetDynamicParameters
+#define M_BUF_STREAM                                0x0000024F  // MbufStream
+#define M_BUF_ALLOC_CONTAINER                       0x00000250  // MbufAllocContainer
+#define M_BUF_ALLOC_COMPONENT                       0x00000251  // MbufAllocComponent
+#define M_BUF_COPY_COMPONENT                        0x00000252  // MbufCopyComponent
+#define M_BUF_FREE_COMPONENT                        0x00000253  // MbufFreeComponent
+#define M_BUF_INQUIRE_CONTAINER                     0x00000254  // MbufInquireContainer
+#define M_BUF_CONTROL_CONTAINER                     0x00000255  // MbufControlContainer
+#define M_BUF_CHILD_CONTAINER                       0x00000256  // MbufChildContainer
+#define M_BUF_CREATE_COMPONENT                      0x00000257  // MbufCreateComponent
+
+#define M_DISP_ALLOC                                0x00000401  // MdispAlloc
+#define M_DISP_FREE                                 0x00000402  // MdispFree
+#define M_DISP_ZOOM                                 0x00000403  // MdispZoom
+#define M_DISP_PAN                                  0x00000404  // MdispPan
+#define M_DISP_SELECT                               0x00000405  // MdispSelect
+#define M_DISP_LUT                                  0x00000406  // MdispLut
+#define M_DISP_INQUIRE                              0x00000407  // MdispInquire
+#define M_DISP_CONTROL                              0x0000040A  // MdispControl
+#define M_DISP_HOOK_FUNCTION                        0x0000040B  // MdispHookFunction
+#define M_DISP_SELECT_WINDOW                        0x0000040C  // MdispSelectWindow
+#define M_DISP_GET_HOOK_INFO                        0x0000040F  // MdispGetHookInfo
+
+#define M_DIG_ALLOC                                 0x00000601  // MdigAlloc
+#define M_DIG_FREE                                  0x00000602  // MdigFree
+#define M_DIG_GRAB                                  0x00000603  // MdigGrab
+#define M_DIG_HALT                                  0x00000605  // MdigHalt
+#define M_DIG_INQUIRE                               0x00000607  // MdigInquire
+#define M_DIG_CONTROL                               0x00000609  // MdigControl
+#define M_DIG_GRAB_WAIT                             0x0000060A  // MdigGrabWait
+#define M_DIG_HOOK_FUNCTION                         0x0000060C  // MdigHookFunction
+#define M_DIG_FOCUS                                 0x0000060D  // MdigFocus
+#define M_DIG_GRAB_CONTINUOUS                       0x0000060E  // MdigGrabContinuous
+#define M_DIG_PROCESS                               0x00000610  // MdigProcess
+#define M_DIG_GET_HOOK_INFO                         0x00000611  // MdigGetHookInfo
+#define M_DIG_CONTROL_FEATURE                       0x00000612  // MdigControlFeature
+#define M_DIG_INQUIRE_FEATURE                       0x00000613  // MdigInquireFeature
+
+#define M_IM_EDGE_DETECT                            0x00000801  // MimEdgeDetect
+#define M_IM_RANK                                   0x00000802  // MimRank
+#define M_IM_CONVOLVE                               0x00000803  // MimConvolve
+#define M_IM_DILATE                                 0x00000804  // MimDilate
+#define M_IM_ERODE                                  0x00000805  // MimErode
+#define M_IM_CLOSE                                  0x00000806  // MimClose
+#define M_IM_OPEN                                   0x00000807  // MimOpen
+#define M_IM_LABEL                                  0x00000808  // MimLabel
+#define M_IM_CONNECT_MAP                            0x00000809  // MimConnectMap
+#define M_IM_THIN                                   0x0000080A  // MimThin
+#define M_IM_THICK                                  0x0000080B  // MimThick
+#define M_IM_DISTANCE                               0x0000080C  // MimDistance
+#define M_IM_WATERSHED                              0x0000080D  // MimWatershed
+#define M_IM_ZONE_OF_INFLUENCE                      0x0000080E  // MimZoneOfInfluence
+#define M_IM_MORPHIC                                0x0000080F  // MimMorphic
+#define M_IM_LOCATE_EVENT                           0x00000812  // MimLocateEvent
+#define M_IM_COUNT_DIFFERENCE                       0x00000813  // MimCountDifference
+#define M_IM_LOCATE_PEAK_1D                         0x00000815  // MimLocatePeak1d
+#define M_IM_TRANSLATE                              0x00000816  // MimTranslate
+#define M_IM_ROTATE                                 0x00000817  // MimRotate
+#define M_IM_WARP                                   0x00000818  // MimWarp
+#define M_IM_POLAR_TRANSFORM                        0x00000819  // MimPolarTransform
+#define M_IM_TRANSFORM                              0x0000081A  // MimTransform
+#define M_IM_DRAW                                   0x0000081B  // MimDraw
+#define M_IM_DEAD_PIXEL_CORRECTION                  0x0000081C  // MimDeadPixelCorrection
+#define M_IM_MATCH                                  0x00000838  // MimMatch
+#define M_IM_WAVELET_TRANSFORM                      0x0000083B  // MimWaveletTransform
+#define M_IM_WAVELET_SET_FILTER                     0x0000083C  // MimWaveletSetFilter
+#define M_IM_HISTOGRAM_EQUALIZE_ADAPTIVE            0x0000083D  // MimHistogramEqualizeAdaptive
+#define M_IM_FIND_ORIENTATION                       0x0000083E  // MimFindOrientation
+#define M_IM_WAVELET_DENOISE                        0x0000083F  // MimWaveletDenoise
+#define M_IM_ADAPTATIVE_LOCATE_PEAK_1D              0x00000840  // MimLocatePeak1d
+#define M_IM_BINARIZE_ADAPTIVE                      0x00000841  // MimBinarizeAdaptive
+#define M_IM_WARP_LIST                              0x00000846  // MimWarpList
+#define M_IM_STAT_CALCULATE                         0x00000847  // MimStatCalculate
+#define M_IM_PROJECTION                             0x00000848  // MimProjection
+#define M_IM_FILTER_ADAPTIVE                        0x0000084E  // MimFilterAdaptive
+#define M_IM_REMAP                                  0x0000084F  // MimRemap
+#define M_IM_AUGMENT                                0x00000851  // MimAugment
+#define M_IM_DIFFERENTIAL                           0x00000853  // MimDifferential
+#define M_IM_BOUNDING_BOX                           0x00000854  // MimBoundingBox
+
+#define M_IM_ARITH                                  0x00000A01  // MimArith
+#define M_IM_ARITH_MULTIPLE                         0x00000A02  // MimArithMultiple
+#define M_IM_SHIFT                                  0x00000A03  // MimShift
+#define M_IM_BINARIZE                               0x00000A04  // MimBinarize
+#define M_IM_CLIP                                   0x00000A05  // MimClip
+#define M_IM_CONVERT                                0x00000A06  // MimConvert
+#define M_IM_FLIP                                   0x00000A07  // MimFlip
+#define M_IM_HISTOGRAM                              0x00000A08  // MimHistogram
+#define M_IM_HISTOGRAM_EQUALIZE                     0x00000A09  // MimHistogramEqualize
+#define M_IM_LUT_MAP                                0x00000A0A  // MimLutMap
+#define M_IM_RESIZE                                 0x00000A0B  // MimResize
+#define M_IM_FIND_EXTREME                           0x00000A0C  // MimFindExtreme
+#define M_IM_DEINTERLACE                            0x00000A0D  // MimDeinterlace
+#define M_IM_ALLOC                                  0x00000A0E  // MimAlloc
+#define M_IM_CONTROL                                0x00000A0F  // MimControl
+#define M_IM_ALLOC_RESULT                           0x00000A10  // MimAllocResult
+#define M_IM_FREE                                   0x00000A11  // MimFree
+#define M_IM_INQUIRE                                0x00000A12  // MimInquire
+#define M_IM_GET_RESULT_1D                          0x00000A13  // MimGetResult1d
+#define M_IM_GET_RESULT                             0x00000A14  // MimGetResult
+#define M_IM_FLAT_FIELD                             0x00000A41  // MimFlatField
+#define M_IM_REARRANGE                              0x00000A43  // MimRearrange
+#define M_IM_GET_RESULT_2D                          0x00000A44  // MimGetResult2d
+#define M_IM_PUT                                    0x00000A45  // MimPut
+#define M_IM_GET                                    0x00000A46  // MimGet
+#define M_IM_ALLOC_RESULT_OBJECT                    0x00000A67  // MimAllocResult
+#define M_IM_GET_RESULT_SINGLE                      0x00000A68  // MimGetResultSingle
+#define M_IM_RESTORE                                0x00000A69  // MimRestore
+#define M_IM_SAVE                                   0x00000A6A  // MimSave
+#define M_IM_STREAM                                 0x00000A6B  // MimStream
+#define M_IM_ROTATE_MULT90                          0x00000A6D  // MimRotate
+
+#define M_SEQ_ALLOC                                 0x00001601  // MseqAlloc
+#define M_SEQ_FREE                                  0x00001602  // MseqFree
+#define M_SEQ_DEFINE                                0x00001603  // MseqDefine
+#define M_SEQ_CONTROL                               0x00001604  // MseqControl
+#define M_SEQ_INQUIRE                               0x00001605  // MseqInquire
+#define M_SEQ_HOOK_FUNCTION                         0x00001606  // MseqHookFunction
+#define M_SEQ_GET_HOOK_INFO                         0x00001607  // MseqGetHookInfo
+#define M_SEQ_FEED                                  0x00001608  // MseqFeed
+#define M_SEQ_PROCESS                               0x00001609  // MseqProcess
+
+#define M_GRA_CLEAR                                 0x00001A01  // MgraClear
+#define M_GRA_DOT                                   0x00001A02  // MgraDot
+#define M_GRA_LINE                                  0x00001A03  // MgraLine
+#define M_GRA_RECT                                  0x00001A04  // MgraRect
+#define M_GRA_RECT_FILL                             0x00001A05  // MgraRectFill
+#define M_GRA_ARC                                   0x00001A06  // MgraArc
+#define M_GRA_ARC_FILL                              0x00001A07  // MgraArcFill
+#define M_GRA_FILL                                  0x00001A08  // MgraFill
+#define M_GRA_TEXT                                  0x00001A09  // MgraText
+#define M_GRA_BACK_COLOR                            0x00001A0A  // MgraBackColor
+#define M_GRA_COLOR                                 0x00001A0B  // MgraColor
+#define M_GRA_DOTS                                  0x00001A0C  // MgraDots
+#define M_GRA_LINES                                 0x00001A0D  // MgraLines
+#define M_GRA_ALLOC                                 0x00001A0E  // MgraAlloc
+#define M_GRA_FREE                                  0x00001A0F  // MgraFree
+#define M_GRA_CONTROL                               0x00001A10  // MgraControl
+#define M_GRA_FONT                                  0x00001A11  // MgraFont
+#define M_GRA_FONT_SCALE                            0x00001A12  // MgraFontScale
+#define M_GRA_INQUIRE                               0x00001A13  // MgraInquire
+#define M_GRA_ALLOC_LIST                            0x00001A14  // MgraAllocList
+#define M_GRA_CONTROL_LIST                          0x00001A15  // MgraControlList
+#define M_GRA_DRAW                                  0x00001A16  // MgraDraw
+#define M_GRA_GET_HOOK_INFO                         0x00001A1A  // MgraGetHookInfo
+#define M_GRA_HOOK_FUNCTION                         0x00001A1B  // MgraHookFunction
+#define M_GRA_INQUIRE_LIST                          0x00001A1C  // MgraInquireList
+#define M_GRA_RECT_ANGLE                            0x00001A1E  // MgraRectAngle
+#define M_GRA_ARC_ANGLE                             0x00001A1F  // MgraArcAngle
+#define M_GRA_INTERACTIVE                           0x00001A2A  // MgraInteractive
+#define M_GRA_COPY                                  0x00001A2C  // MgraCopy
+#define M_GRA_VECTORS                               0x00001A2E  // MgraVectors
+#define M_GRA_VECTORS_GRID                          0x00001A2F  // MgraVectorsGrid
+
+#define M_GEN_LUT_RAMP                              0x00001C01  // MgenLutRamp
+#define M_GEN_LUT_FUNCTION                          0x00001C02  // MgenLutFunction
+#define M_GEN_WARP_PARAMETER                        0x00001C03  // MgenWarpParameter
+#define M_GEN_RAMP                                  0x00001C04  // MgenRamp
+
+#define M_APP_ALLOC                                 0x00002801  // MappAlloc
+#define M_APP_CONTROL                               0x00002803  // MappControl
+#define M_APP_FREE                                  0x00002805  // MappFree
+#define M_APP_GET_ERROR                             0x00002806  // MappGetError
+#define M_APP_GET_HOOK_INFO                         0x00002807  // MappGetHookInfo
+#define M_APP_HOOK_FUNCTION                         0x00002808  // MappHookFunction
+#define M_APP_INQUIRE                               0x00002809  // MappInquire
+#define M_APP_TIMER                                 0x0000280B  // MappTimer
+#define M_APP_FILE_OPERATION                        0x00002811  // MappFileOperation
+#define M_APP_INQUIRE_MP                            0x00002812  // MappInquireMp
+#define M_APP_CONTROL_MP                            0x00002813  // MappControlMp
+#define M_APP_INQUIRE_CONNECTION                    0x00002814  // MappInquireConnection
+#define M_APP_OPEN_CONNECTION                       0x00002815  // MappOpenConnection
+#define M_APP_INQUIRE_OBJECT                        0x00002816  // MappInquireObject
+#define M_APP_CONTROL_OBJECT                        0x00002817  // MappControlObject
+#define M_APP_CLOSE_CONNECTION                      0x00002818  // MappCloseConnection
+#define M_APP_TRACE                                 0x00002819  // MappTrace
+
+#define M_OBJ_CONTROL                               0x00002C01  // MobjControl
+#define M_OBJ_INQUIRE                               0x00002C02  // MobjInquire
+#define M_OBJ_HOOK_FUNCTION                         0x00002C03  // MobjHookFunction
+#define M_OBJ_ALLOC                                 0x00002C04  // MobjAlloc
+#define M_OBJ_FREE                                  0x00002C05  // MobjFree
+#define M_OBJ_GET_HOOK_INFO                         0x00002C06  // MobjGetHookInfo
+#define M_OBJ_MESSAGE_WRITE                         0x00002C08  // MobjMessageWrite
+#define M_OBJ_MESSAGE_READ                          0x00002C09  // MobjMessageRead
+
+#define M_THR_ALLOC                                 0x00002E01  // MthrAlloc
+#define M_THR_CONTROL                               0x00002E02  // MthrControl
+#define M_THR_FREE                                  0x00002E03  // MthrFree
+#define M_THR_INQUIRE                               0x00002E04  // MthrInquire
+#define M_THR_WAIT                                  0x00002E05  // MthrWait
+#define M_THR_WAIT_MULTIPLE                         0x00002E06  // MthrWaitMultiple
+#define M_THR_INQUIRE_MP                            0x00002E07  // MthrInquireMp
+#define M_THR_CONTROL_MP                            0x00002E08  // MthrControlMp
+
+#define M_MISC_DLL_MAIN                             0x0000301A  // DllMain
+
+#define M_BLOB_ALLOC_RESULT_OLD                     0x00008002  // MblobAllocResult
+#define M_BLOB_CALCULATE                            0x00008003  // MblobCalculate
+#define M_BLOB_CONTROL                              0x00008004  // MblobControl
+#define M_BLOB_FREE                                 0x00008006  // MblobFree
+#define M_BLOB_GET_LABEL                            0x00008007  // MblobGetLabel
+#define M_BLOB_GET_RESULT_OLD                       0x00008009  // MblobGetResult
+#define M_BLOB_INQUIRE                              0x0000800C  // MblobInquire
+#define M_BLOB_LABEL_FUNC                           0x0000800D  // MblobLabel
+#define M_BLOB_RECONSTRUCT                          0x0000800E  // MblobReconstruct
+#define M_BLOB_SELECT                               0x0000800F  // MblobSelect
+#define M_BLOB_DRAW                                 0x00008013  // MblobDraw
+#define M_BLOB_MERGE                                0x00008014  // MblobMerge
+#define M_BLOB_ALLOC                                0x00008015  // MblobAlloc
+#define M_BLOB_SAVE                                 0x00008016  // MblobSave
+#define M_BLOB_RESTORE                              0x00008017  // MblobRestore
+#define M_BLOB_STREAM                               0x00008018  // MblobStream
+#define M_BLOB_ALLOC_RESULT                         0x00008019  // MblobAllocResult
+#define M_BLOB_GET_RESULT                           0x0000801A  // MblobGetResult
+#define M_BLOB_TRANSFORM                            0x0000801B  // MblobTransform
+
+#define M_MEAS_ALLOC_MARKER                         0x00008201  // MmeasAllocMarker
+#define M_MEAS_SET_MARKER                           0x00008202  // MmeasSetMarker
+#define M_MEAS_FIND_MARKER                          0x00008203  // MmeasFindMarker
+#define M_MEAS_GET_RESULT                           0x00008204  // MmeasGetResult
+#define M_MEAS_GET_RESULT_SINGLE                    0x00008205  // MmeasGetResultSingle
+#define M_MEAS_INQUIRE                              0x00008206  // MmeasInquire
+#define M_MEAS_SAVE_MARKER                          0x00008207  // MmeasSaveMarker
+#define M_MEAS_CALCULATE                            0x00008208  // MmeasCalculate
+#define M_MEAS_FREE                                 0x00008209  // MmeasFree
+#define M_MEAS_ALLOC_RESULT                         0x0000820A  // MmeasAllocResult
+#define M_MEAS_ALLOC_CONTEXT                        0x0000820B  // MmeasAllocContext
+#define M_MEAS_CONTROL                              0x0000820C  // MmeasControl
+#define M_MEAS_RESTORE_MARKER                       0x0000820D  // MmeasRestoreMarker
+#define M_MEAS_DRAW                                 0x0000820E  // MmeasDraw
+#define M_MEAS_STREAM                               0x0000820F  // MmeasStream
+#define M_MEAS_SET_SCORE                            0x00008210  // MmeasSetScore
+#define M_MEAS_GET_SCORE                            0x00008211  // MmeasGetScore
+
+#define M_CAL_ALLOC                                 0x00008401  // McalAlloc
+#define M_CAL_GRID                                  0x00008402  // McalGrid
+#define M_CAL_TRANSFORM_IMAGE                       0x00008403  // McalTransformImage
+#define M_CAL_CONTROL                               0x00008404  // McalControl
+#define M_CAL_FREE                                  0x00008405  // McalFree
+#define M_CAL_INQUIRE                               0x00008406  // McalInquire
+#define M_CAL_LIST                                  0x00008407  // McalList
+#define M_CAL_SAVE                                  0x00008408  // McalSave
+#define M_CAL_RESTORE                               0x00008409  // McalRestore
+#define M_CAL_RELATIVE_ORIGIN                       0x0000840A  // McalRelativeOrigin
+#define M_CAL_TRANSFORM_COORDINATE                  0x0000840B  // McalTransformCoordinate
+#define M_CAL_TRANSFORM_COORDINATE_LIST             0x0000840C  // McalTransformCoordinateList
+#define M_CAL_TRANSFORM_RESULT                      0x0000840D  // McalTransformResult
+#define M_CAL_STREAM                                0x00008410  // McalStream
+#define M_CAL_ASSOCIATE                             0x00008411  // McalAssociate
+#define M_CAL_GET_COORDINATE_SYSTEM                 0x00008412  // McalGetCoordinateSystem
+#define M_CAL_SET_COORDINATE_SYSTEM                 0x00008413  // McalSetCoordinateSystem
+#define M_CAL_DRAW                                  0x00008414  // McalDraw
+#define M_CAL_TRANSFORM_COORDINATE_3D_LIST          0x00008415  // McalTransformCoordinate3dList
+#define M_CAL_INQUIRE_SINGLE                        0x00008416  // McalInquireSingle
+#define M_CAL_FIXTURE                               0x00008417  // McalFixture
+#define M_CAL_TRANSFORM_RESULT_AT_POSITION          0x00008418  // McalTransformResultAtPosition
+#define M_CAL_UNIFORM                               0x00008419  // McalUniform
+#define M_CAL_WARP                                  0x0000841A  // McalWarp
+#define M_CAL_DRAW_3D                               0x0000841B  // McalDraw3d
+
+#define M_CODE_ALLOC                                0x00008601  // McodeAlloc
+#define M_CODE_CONTROL                              0x00008602  // McodeControl
+#define M_CODE_FREE                                 0x00008603  // McodeFree
+#define M_CODE_GET_RESULT_OLD                       0x00008604  // McodeGetResultOld
+#define M_CODE_INQUIRE                              0x00008605  // McodeInquire
+#define M_CODE_READ                                 0x00008606  // McodeRead
+#define M_CODE_WRITE_OLD                            0x00008607  // McodeWriteOld
+#define M_CODE_SAVE                                 0x00008608  // McodeSave
+#define M_CODE_RESTORE                              0x00008609  // McodeRestore
+#define M_CODE_STREAM                               0x0000860B  // McodeStream
+#define M_CODE_DRAW_OLD                             0x0000860C  // McodeDrawOld
+#define M_CODE_ALLOC_RESULT                         0x0000860D  // McodeAllocResult
+#define M_CODE_MODEL_FUNC                           0x0000860E  // McodeModel
+#define M_CODE_GET_RESULT_SINGLE                    0x0000860F  // McodeGetResultSingle
+#define M_CODE_GRADE                                0x00008610  // McodeGrade
+#define M_CODE_TRAIN                                0x00008611  // McodeTrain
+#define M_CODE_DETECT                               0x00008612  // McodeDetect
+#define M_CODE_GET_RESULT                           0x00008613  // McodeGetResult
+#define M_CODE_DRAW                                 0x00008614  // McodeDraw
+#define M_CODE_WRITE                                0x00008615  // McodeWrite
+
+#define M_OCR_ALLOC_FONT                            0x00008801  // MocrAllocFont
+#define M_OCR_ALLOC_RESULT                          0x00008802  // MocrAllocResult
+#define M_OCR_CALIBRATE_FONT                        0x00008803  // MocrCalibrateFont
+#define M_OCR_CONTROL                               0x00008804  // MocrControl
+#define M_OCR_COPY_FONT                             0x00008805  // MocrCopyFont
+#define M_OCR_FREE                                  0x00008806  // MocrFree
+#define M_OCR_GET_RESULT                            0x00008807  // MocrGetResult
+#define M_OCR_HOOK_FUNCTION                         0x00008808  // MocrHookFunction
+#define M_OCR_IMPORT_FONT                           0x00008809  // MocrImportFont
+#define M_OCR_INQUIRE                               0x0000880A  // MocrInquire
+#define M_OCR_MODIFY_FONT                           0x0000880B  // MocrModifyFont
+#define M_OCR_READ_STRING                           0x0000880C  // MocrReadString
+#define M_OCR_RESTORE_FONT                          0x0000880D  // MocrRestoreFont
+#define M_OCR_SAVE_FONT                             0x0000880E  // MocrSaveFont
+#define M_OCR_SET_CONSTRAINT                        0x0000880F  // MocrSetConstraint
+#define M_OCR_VERIFY_STRING                         0x00008811  // MocrVerifyString
+#define M_OCR_PREPROCESS                            0x00008813  // MocrPreprocess
+#define M_OCR_STREAM                                0x00008816  // MocrStream
+#define M_OCR_DRAW                                  0x00008817  // MocrDraw
+
+#define M_PAT_ALLOC_RESULT_OLD                      0x00008C03  // MpatAllocResult
+#define M_PAT_DRAW                                  0x00008C06  // MpatDraw
+#define M_PAT_FREE                                  0x00008C0A  // MpatFree
+#define M_PAT_GET_RESULT_OLD                        0x00008C0C  // MpatGetResult
+#define M_PAT_INQUIRE_OLD                           0x00008C0D  // MpatInquire
+#define M_PAT_RESTORE_OLD                           0x00008C11  // MpatRestore
+#define M_PAT_SAVE_OLD                              0x00008C12  // MpatSave
+#define M_PAT_STREAM                                0x00008C22  // MpatStream
+#define M_PAT_PREPROCESS                            0x00008C23  // MpatPreprocess
+#define M_PAT_ALLOC_RESULT                          0x00008C24  // MpatAllocResult
+#define M_PAT_GET_RESULT                            0x00008C25  // MpatGetResult
+#define M_PAT_INQUIRE                               0x00008C26  // MpatInquire
+#define M_PAT_RESTORE                               0x00008C27  // MpatRestore
+#define M_PAT_SAVE                                  0x00008C28  // MpatSave
+#define M_PAT_ALLOC                                 0x00008C29  // MpatAlloc
+#define M_PAT_CONTROL                               0x00008C2A  // MpatControl
+#define M_PAT_DEFINE                                0x00008C2B  // MpatDefine
+#define M_PAT_FIND                                  0x00008C2C  // MpatFind
+#define M_PAT_MASK                                  0x00008C2D  // MpatMask
+
+#define M_MOD_ALLOC                                 0x00008E01  // MmodAlloc
+#define M_MOD_ALLOC_RESULT                          0x00008E02  // MmodAllocResult
+#define M_MOD_DEFINE                                0x00008E03  // MmodDefine
+#define M_MOD_CONTROL                               0x00008E04  // MmodControl
+#define M_MOD_PREPROCESS                            0x00008E05  // MmodPreprocess
+#define M_MOD_DRAW                                  0x00008E06  // MmodDraw
+#define M_MOD_FIND                                  0x00008E07  // MmodFind
+#define M_MOD_GET_RESULT                            0x00008E08  // MmodGetResult
+#define M_MOD_FREE                                  0x00008E09  // MmodFree
+#define M_MOD_INQUIRE                               0x00008E0A  // MmodInquire
+#define M_MOD_SAVE                                  0x00008E0B  // MmodSave
+#define M_MOD_RESTORE                               0x00008E0C  // MmodRestore
+#define M_MOD_MASK                                  0x00008E0D  // MmodMask
+#define M_MOD_DEFINE_FROM_FILE                      0x00008E0E  // MmodDefineFromFile
+#define M_MOD_STREAM                                0x00008E0F  // MmodStream
+
+#define M_EDGE_ALLOC                                0x00009401  // MedgeAlloc
+#define M_EDGE_ALLOC_RESULT                         0x00009402  // MedgeAllocResult
+#define M_EDGE_INQUIRE                              0x00009403  // MedgeInquire
+#define M_EDGE_CONTROL                              0x00009404  // MedgeControl
+#define M_EDGE_CALCULATE                            0x00009405  // MedgeCalculate
+#define M_EDGE_DRAW                                 0x00009406  // MedgeDraw
+#define M_EDGE_GET_RESULT                           0x00009407  // MedgeGetResult
+#define M_EDGE_FREE                                 0x00009408  // MedgeFree
+#define M_EDGE_SAVE                                 0x00009409  // MedgeSave
+#define M_EDGE_RESTORE                              0x0000940A  // MedgeRestore
+#define M_EDGE_MASK                                 0x0000940B  // MedgeMask
+#define M_EDGE_SELECT                               0x0000940C  // MedgeSelect
+#define M_EDGE_GET_NEIGHBORS                        0x0000940D  // MedgeGetNeighbors
+#define M_EDGE_PUT                                  0x0000940E  // MedgePut
+#define M_EDGE_STREAM                               0x0000940F  // MedgeStream
+
+#define M_STR_ALLOC                                 0x00009601  // MstrAlloc
+#define M_STR_ALLOC_RESULT                          0x00009602  // MstrAllocResult
+#define M_STR_FREE                                  0x00009603  // MstrFree
+#define M_STR_CONTROL                               0x00009604  // MstrControl
+#define M_STR_INQUIRE                               0x00009605  // MstrInquire
+#define M_STR_EDIT_FONT                             0x00009606  // MstrEditFont
+#define M_STR_SET_CONSTRAINT                        0x00009607  // MstrSetConstraint
+#define M_STR_PREPROCESS                            0x00009608  // MstrPreprocess
+#define M_STR_READ                                  0x00009609  // MstrRead
+#define M_STR_GET_RESULT                            0x0000960A  // MstrGetResult
+#define M_STR_DRAW                                  0x0000960B  // MstrDraw
+#define M_STR_SAVE                                  0x0000960C  // MstrSave
+#define M_STR_RESTORE                               0x0000960D  // MstrRestore
+#define M_STR_STREAM                                0x0000960E  // MstrStream
+#define M_STR_EXPERT                                0x0000960F  // MstrExpert
+
+#define M_MET_ALLOC                                 0x00009A01  // MmetAlloc
+#define M_MET_ALLOC_RESULT                          0x00009A02  // MmetAllocResult
+#define M_MET_CONTROL                               0x00009A03  // MmetControl
+#define M_MET_INQUIRE                               0x00009A04  // MmetInquire
+#define M_MET_ADD_FEATURE                           0x00009A05  // MmetAddFeature
+#define M_MET_ADD_TOLERANCE                         0x00009A06  // MmetAddTolerance
+#define M_MET_SET_POSITION                          0x00009A07  // MmetSetPosition
+#define M_MET_SET_REGION                            0x00009A08  // MmetSetRegion
+#define M_MET_CALCULATE                             0x00009A09  // MmetCalculate
+#define M_MET_GET_RESULT                            0x00009A0A  // MmetGetResult
+#define M_MET_DRAW                                  0x00009A0B  // MmetDraw
+#define M_MET_SAVE                                  0x00009A0C  // MmetSave
+#define M_MET_RESTORE                               0x00009A0D  // MmetRestore
+#define M_MET_STREAM                                0x00009A0E  // MmetStream
+#define M_MET_FREE                                  0x00009A0F  // MmetFree
+#define M_MET_NAME                                  0x00009A10  // MmetName
+#define M_MET_PUT                                   0x00009A11  // MmetPut
+
+#define M_COL_ALLOC                                 0x00009C01  // McolAlloc
+#define M_COL_ALLOC_RESULT                          0x00009C02  // McolAllocResult
+#define M_COL_DEFINE                                0x00009C03  // McolDefine
+#define M_COL_MATCH                                 0x00009C04  // McolMatch
+#define M_COL_FREE                                  0x00009C05  // McolFree
+#define M_COL_CONTROL                               0x00009C06  // McolControl
+#define M_COL_INQUIRE                               0x00009C07  // McolInquire
+#define M_COL_PREPROCESS                            0x00009C08  // McolPreprocess
+#define M_COL_GET_RESULT                            0x00009C09  // McolGetResult
+#define M_COL_DISTANCE                              0x00009C0A  // McolDistance
+#define M_COL_DRAW                                  0x00009C0B  // McolDraw
+#define M_COL_STREAM                                0x00009C0C  // McolStream
+#define M_COL_SAVE                                  0x00009C0D  // McolSave
+#define M_COL_RESTORE                               0x00009C0E  // McolRestore
+#define M_COL_MASK                                  0x00009C0F  // McolMask
+#define M_COL_SET_METHOD                            0x00009C10  // McolSetMethod
+#define M_COL_PROJECT                               0x00009C11  // McolProject
+#define M_COL_TRANSFORM                             0x00009C12  // McolTransform
+
+#define M_3DMAP_ALLOC                               0x00009E01  // M3dmapAlloc
+#define M_3DMAP_ALLOC_RESULT                        0x00009E02  // M3dmapAllocResult
+#define M_3DMAP_INQUIRE                             0x00009E03  // M3dmapInquire
+#define M_3DMAP_CONTROL                             0x00009E04  // M3dmapControl
+#define M_3DMAP_GET_RESULT                          0x00009E05  // M3dmapGetResult
+#define M_3DMAP_FREE                                0x00009E06  // M3dmapFree
+#define M_3DMAP_SAVE                                0x00009E07  // M3dmapSave
+#define M_3DMAP_RESTORE                             0x00009E08  // M3dmapRestore
+#define M_3DMAP_STREAM                              0x00009E09  // M3dmapStream
+#define M_3DMAP_ADD_SCAN                            0x00009E0A  // M3dmapAddScan
+#define M_3DMAP_CALIBRATE                           0x00009E0B  // M3dmapCalibrate
+#define M_3DMAP_EXTRACT                             0x00009E0C  // M3dmapExtract
+#define M_3DMAP_TRIANGULATE                         0x00009E0D  // M3dmapTriangulate
+#define M_3DMAP_SET_GEOMETRY                        0x00009E0E  // M3dmapSetGeometry
+#define M_3DMAP_DRAW                                0x00009E0F  // M3dmapDraw
+#define M_3DMAP_STAT                                0x00009E10  // M3dmapStat
+#define M_3DMAP_ARITH                               0x00009E11  // M3dmapArith
+#define M_3DMAP_PUT                                 0x00009E12  // M3dmapPut
+#define M_3DMAP_PUT_ORGANIZED                       0x00009E13  // M3dmapPutOrganized
+#define M_3DMAP_CALIBRATE_MULTIPLE                  0x00009E14  // M3dmapCalibrateMultiple
+#define M_3DMAP_CLEAR                               0x00009E15  // M3dmapClear
+#define M_3DMAP_ALIGN                               0x00009E16  // M3dmapAlign
+#define M_3DMAP_GET                                 0x00009E17  // M3dmapGet
+#define M_3DMAP_IMPORT                              0x00009E18  // M3dmapImport
+#define M_3DMAP_SET_BOX                             0x00009E19  // M3dmapSetBox
+#define M_3DMAP_EXPORT                              0x00009E1A  // M3dmapExport
+#define M_3DMAP_COPY                                0x00009E1B  // M3dmapCopy
+#define M_3DMAP_COPY_COND                           0x00009E1C  // M3dmapCopyCond
+#define M_3DMAP_PT_CLD_CALCULATE                    0x00009E1D  // M3dmapPtCldCalculate
+#define M_3DMAP_COPY_RESULT                         0x00009E1E  // M3dmapCopyResult
+#define M_3DMAP_DRAW_3D                             0x00009E1F  // M3dmapDraw3d
+
+#define M_REG_ALLOC                                 0x0000A001  // MregAlloc
+#define M_REG_ALLOC_RESULT                          0x0000A002  // MregAllocResult
+#define M_REG_INQUIRE                               0x0000A003  // MregInquire
+#define M_REG_CONTROL                               0x0000A004  // MregControl
+#define M_REG_CALCULATE                             0x0000A005  // MregCalculate
+#define M_REG_DRAW                                  0x0000A006  // MregDraw
+#define M_REG_GET_RESULT                            0x0000A008  // MregGetResult
+#define M_REG_FREE                                  0x0000A009  // MregFree
+#define M_REG_SAVE                                  0x0000A00B  // MregSave
+#define M_REG_RESTORE                               0x0000A00C  // MregRestore
+#define M_REG_STREAM                                0x0000A00F  // MregStream
+#define M_REG_SET_LOCATION                          0x0000A010  // MregSetLocation
+#define M_REG_TRANSFORM_IMAGE                       0x0000A011  // MregTransformImage
+#define M_REG_TRANSFORM_COORDINATE                  0x0000A012  // MregTransformCoordinate
+#define M_REG_TRANSFORM_COORDINATE_LIST             0x0000A013  // MregTransformCoordinateList
+
+#define M_DMR_ALLOC                                 0x0000A201  // MdmrAlloc
+#define M_DMR_ALLOC_RESULT                          0x0000A202  // MdmrAllocResult
+#define M_DMR_INQUIRE                               0x0000A203  // MdmrInquire
+#define M_DMR_CONTROL                               0x0000A204  // MdmrControl
+#define M_DMR_PREPROCESS                            0x0000A205  // MdmrPreprocess
+#define M_DMR_READ                                  0x0000A206  // MdmrRead
+#define M_DMR_GET_RESULT                            0x0000A207  // MdmrGetResult
+#define M_DMR_FREE                                  0x0000A208  // MdmrFree
+#define M_DMR_SAVE                                  0x0000A209  // MdmrSave
+#define M_DMR_RESTORE                               0x0000A20A  // MdmrRestore
+#define M_DMR_STREAM                                0x0000A20B  // MdmrStream
+#define M_DMR_CONTROL_FONT                          0x0000A20C  // MdmrControlFont
+#define M_DMR_INQUIRE_FONT                          0x0000A20D  // MdmrInquireFont
+#define M_DMR_CONTROL_STRING_MODEL                  0x0000A20E  // MdmrControlStringModel
+#define M_DMR_INQUIRE_STRING_MODEL                  0x0000A20F  // MdmrInquireStringModel
+#define M_DMR_DRAW                                  0x0000A210  // MdmrDraw
+#define M_DMR_IMPORT_FONT                           0x0000A211  // MdmrImportFont
+#define M_DMR_EXPORT_FONT                           0x0000A212  // MdmrExportFont
+#define M_DMR_NAME                                  0x0000A213  // MdmrName
+
+#define M_COM_ALLOC                                 0x0000A601  // McomAlloc
+#define M_COM_CONTROL                               0x0000A602  // McomControl
+#define M_COM_INQUIRE                               0x0000A603  // McomInquire
+#define M_COM_HOOK_FUNCTION                         0x0000A604  // McomHookFunction
+#define M_COM_GET_HOOK_INFO                         0x0000A605  // McomGetHookInfo
+#define M_COM_READ                                  0x0000A606  // McomRead
+#define M_COM_WRITE                                 0x0000A607  // McomWrite
+#define M_COM_FREE                                  0x0000A608  // McomFree
+#define M_COM_RECEIVE_POSITION_COMMAND              0x0000A609  // McomReceivePositionCommand
+#define M_COM_SEND_POSITION_COMMAND                 0x0000A60A  // McomSendPositionCommand
+#define M_COM_SEND_COMMAND                          0x0000A60B  // McomSendCommand
+#define M_COM_RECEIVE_COMMAND                       0x0000A60C  // McomReceiveCommand
+
+#define M_BEAD_ALLOC                                0x0000A801  // MbeadAlloc
+#define M_BEAD_ALLOC_RESULT                         0x0000A802  // MbeadAllocResult
+#define M_BEAD_FREE                                 0x0000A803  // MbeadFree
+#define M_BEAD_CONTROL                              0x0000A804  // MbeadControl
+#define M_BEAD_INQUIRE                              0x0000A805  // MbeadInquire
+#define M_BEAD_TRAIN                                0x0000A806  // MbeadTrain
+#define M_BEAD_TEMPLATE                             0x0000A807  // MbeadTemplate
+#define M_BEAD_VERIFY                               0x0000A808  // MbeadVerify
+#define M_BEAD_GET_RESULT                           0x0000A809  // MbeadGetResult
+#define M_BEAD_DRAW                                 0x0000A80A  // MbeadDraw
+#define M_BEAD_SAVE                                 0x0000A80B  // MbeadSave
+#define M_BEAD_RESTORE                              0x0000A80C  // MbeadRestore
+#define M_BEAD_STREAM                               0x0000A80D  // MbeadStream
+#define M_BEAD_GET_NEIGHBORS                        0x0000A80E  // MbeadGetNeighbors
+
+#define M_CLASS_ALLOC                               0x0000AC01  // MclassAlloc
+#define M_CLASS_ALLOC_RESULT                        0x0000AC02  // MclassAllocResult
+#define M_CLASS_INQUIRE                             0x0000AC03  // MclassInquire
+#define M_CLASS_CONTROL                             0x0000AC04  // MclassControl
+#define M_CLASS_IMPORT                              0x0000AC08  // MclassImport
+#define M_CLASS_PREPROCESS                          0x0000AC09  // MclassPreprocess
+#define M_CLASS_PREDICT                             0x0000AC0A  // MclassPredict
+#define M_CLASS_GET_RESULT                          0x0000AC0B  // MclassGetResult
+#define M_CLASS_FREE                                0x0000AC0C  // MclassFree
+#define M_CLASS_SAVE                                0x0000AC0D  // MclassSave
+#define M_CLASS_RESTORE                             0x0000AC0E  // MclassRestore
+#define M_CLASS_STREAM                              0x0000AC0F  // MclassStream
+#define M_CLASS_DRAW                                0x0000AC10  // MclassDraw
+#define M_CLASS_PREDICT_MULTIBAND                   0x0000AC13  // MclassPredictMultiband
+#define M_CLASS_CONTROL_ENTRY                       0x0000AC14  // MclassControlEntry
+#define M_CLASS_TRAIN                               0x0000AC15  // MclassTrain
+#define M_CLASS_INQUIRE_ENTRY                       0x0000AC16  // MclassInquireEntry
+#define M_CLASS_EXPORT                              0x0000AC17  // MclassExport
+#define M_CLASS_COPY_RESULT                         0x0000AC18  // MclassCopyResult
+#define M_CLASS_HOOK_FUNCTION                       0x0000AC19  // MclassHookFunction
+#define M_CLASS_GET_HOOK_INFO                       0x0000AC1A  // MclassGetHookInfo
+#define M_CLASS_COPY                                0x0000AC1B  // MclassCopy
+#define M_CLASS_SPLIT_DATASET                       0x0000AC1D  // MclassSplitDataset
+
+
+#define M_3DGRA_ALLOC                               0x00000101  // M3dgraAlloc
+#define M_3DGRA_ADD                                 0x00000102  // M3dgraAdd
+#define M_3DGRA_CONTROL                             0x00000103  // M3dgraControl
+#define M_3DGRA_COPY                                0x00000104  // M3dgraCopy
+#define M_3DGRA_FREE                                0x00000105  // M3dgraFree
+#define M_3DGRA_INQUIRE                             0x00000106  // M3dgraInquire
+#define M_3DGRA_REMOVE                              0x00000107  // M3dgraRemove
+#define M_3DGRA_BOX                                 0x00000108  // M3dgraBox
+#define M_3DGRA_SPHERE                              0x00000109  // M3dgraSphere
+#define M_3DGRA_CYLINDER                            0x0000010A  // M3dgraCylinder
+#define M_3DGRA_GRID                                0x0000010B  // M3dgraGrid
+#define M_3DGRA_LINE                                0x0000010C  // M3dgraLine
+#define M_3DGRA_TEXT                                0x0000010D  // M3dgraText
+#define M_3DGRA_AXIS                                0x0000010E  // M3dgraAxis
+#define M_3DGRA_PLANE                               0x0000010F  // M3dgraPlane
+#define M_3DGRA_DOTS                                0x00000110  // M3dgraDots
+#define M_3DGRA_POLYGON                             0x00000111  // M3dgraPolygon
+#define M_3DGRA_ARC                                 0x00000112  // M3dgraArc
+#define M_3DGRA_NODE                                0x00000113  // M3dgraNode
+
+#define M_3DDISP_ALLOC                              0x00000301  // M3ddispAlloc
+#define M_3DDISP_CONTROL                            0x00000302  // M3ddispControl
+#define M_3DDISP_FREE                               0x00000303  // M3ddispFree
+#define M_3DDISP_INQUIRE                            0x00000304  // M3ddispInquire
+#define M_3DDISP_SELECT                             0x00000305  // M3ddispSelect
+#define M_3DDISP_SELECT_WINDOW                      0x00000306  // M3ddispSelectWindow
+#define M_3DDISP_SET_VIEW                           0x00000307  // M3ddispSetView
+#define M_3DDISP_GET_VIEW                           0x00000308  // M3ddispGetView
+#define M_3DDISP_COPY                               0x00000309  // M3ddispCopy
+#define M_3DDISP_HOOK_FUNCTION                      0x0000030B  // M3ddispHookFunction
+#define M_3DDISP_GET_HOOK_INFO                      0x0000030C  // M3ddispGetHookInfo
+
+#define M_3DGEO_ALLOC                               0x00000501  // M3dgeoAlloc
+#define M_3DGEO_INQUIRE                             0x00000502  // M3dgeoInquire
+#define M_3DGEO_FREE                                0x00000503  // M3dgeoFree
+#define M_3DGEO_SAVE                                0x00000504  // M3dgeoSave
+#define M_3DGEO_RESTORE                             0x00000505  // M3dgeoRestore
+#define M_3DGEO_STREAM                              0x00000506  // M3dgeoStream
+#define M_3DGEO_BOX                                 0x00000507  // M3dgeoBox
+#define M_3DGEO_SPHERE                              0x00000508  // M3dgeoSphere
+#define M_3DGEO_PLANE                               0x00000509  // M3dgeoPlane
+#define M_3DGEO_COPY                                0x0000050A  // M3dgeoCopy
+#define M_3DGEO_MATRIX_SET_TRANSFORM                0x0000050B  // M3dgeoMatrixSetTransform
+#define M_3DGEO_MATRIX_PUT                          0x0000050C  // M3dgeoMatrixPut
+#define M_3DGEO_MATRIX_GET                          0x0000050D  // M3dgeoMatrixGet
+#define M_3DGEO_MATRIX_GET_TRANSFORM                0x0000050E  // M3dgeoMatrixGetTransform
+#define M_3DGEO_CYLINDER                            0x0000050F  // M3dgeoCylinder
+#define M_3DGEO_DRAW_3D                             0x00000510  // M3dgeoDraw3d
+#define M_3DGEO_UNDEFINED                           0x00000511  // M3dgeoUndefined
+#define M_3DGEO_LINE                                0x00000512  // M3dgeoLine
+#define M_3DGEO_MATRIX_SET_WITH_AXES                0x00000513  // M3dgeoMatrixSetWithAxes
+
+#define M_3DBUF_IMPORT                              0x00000901  // M3dbufImport
+#define M_3DBUF_EXPORT                              0x00000902  // M3dbufExport
+#define M_3DBUF_CONVERT                             0x00000903  // MbufConvert3d
+
+#define M_3DIM_ALLOC                                0x00002101  // M3dimAlloc
+#define M_3DIM_ALLOC_RESULT                         0x00002102  // M3dimAllocResult
+#define M_3DIM_INQUIRE                              0x00002103  // M3dimInquire
+#define M_3DIM_CONTROL                              0x00002104  // M3dimControl
+#define M_3DIM_GET_RESULT                           0x00002105  // M3dimGetResult
+#define M_3DIM_FREE                                 0x00002106  // M3dimFree
+#define M_3DIM_SAVE                                 0x00002107  // M3dimSave
+#define M_3DIM_RESTORE                              0x00002108  // M3dimRestore
+#define M_3DIM_STREAM                               0x00002109  // M3dimStream
+#define M_3DIM_TRANSLATE                            0x0000210A  // M3dimTranslate
+#define M_3DIM_SCALE                                0x0000210B  // M3dimScale
+#define M_3DIM_ROTATE                               0x0000210C  // M3dimRotate
+#define M_3DIM_MATRIX_TRANSFORM                     0x0000210D  // M3dimMatrixTransform
+#define M_3DIM_CROP                                 0x0000210E  // M3dimCrop
+#define M_3DIM_MERGE                                0x0000210F  // M3dimMerge
+#define M_3DIM_SAMPLE                               0x00002110  // M3dimSample
+#define M_3DIM_NORMALS                              0x00002111  // M3dimNormals
+#define M_3DIM_MESH                                 0x00002112  // M3dimMesh
+#define M_3DIM_STAT                                 0x00002113  // M3dimStat
+#define M_3DIM_COPY_RESULT                          0x00002114  // M3dimCopyResult
+#define M_3DIM_PROJECT                              0x00002115  // M3dimProject
+#define M_3DIM_COPY                                 0x00002116  // M3dimCopy
+#define M_3DIM_CALIBRATE_DEPTH_MAP                  0x00002117  // M3dimCalibrateDepthMap
+#define M_3DIM_MATRIX_TRANSFORM_LIST                0x00002118  // M3dimMatrixTransformList
+#define M_3DIM_CALCULATE_MAP_SIZE                   0x00002119  // M3dimCalculateMapSize
+#define M_3DIM_REMOVE_POINTS                        0x0000211A  // M3dimRemovePoints
+#define M_3DIM_ARITH                                0x0000211B  // M3dimArith
+#define M_3DIM_FILL_GAP                             0x0000211C  // M3dimFillGap
+#define M_3DIM_FIX                                  0x0000211D  // M3dimFix
+#define M_3DIM_PROFILE                              0x0000211E  // M3dimProfile
+
+#define M_3DMET_ALLOC                               0x00002301  // M3dmetAlloc
+#define M_3DMET_ALLOC_RESULT                        0x00002302  // M3dmetAllocResult
+#define M_3DMET_INQUIRE                             0x00002303  // M3dmetInquire
+#define M_3DMET_CONTROL                             0x00002304  // M3dmetControl
+#define M_3DMET_GET_RESULT                          0x00002305  // M3dmetGetResult
+#define M_3DMET_FREE                                0x00002306  // M3dmetFree
+#define M_3DMET_SAVE                                0x00002307  // M3dmetSave
+#define M_3DMET_RESTORE                             0x00002308  // M3dmetRestore
+#define M_3DMET_STREAM                              0x00002309  // M3dmetStream
+#define M_3DMET_DISTANCE                            0x0000230A  // M3dmetDistance
+#define M_3DMET_FIT                                 0x0000230B  // M3dmetFit
+#define M_3DMET_COPY_RESULT                         0x0000230C  // M3dmetCopyResult
+#define M_3DMET_STAT                                0x0000230D  // M3dmetStat
+#define M_3DMET_COPY                                0x0000230E  // M3dmetCopy
+#define M_3DMET_VOLUME                              0x0000230F  // M3dmetVolume
+#define M_3DMET_DRAW_3D                             0x00002310  // M3dmetDraw3d
+
+#define M_3DREG_ALLOC                               0x00002501  // M3dregAlloc
+#define M_3DREG_ALLOC_RESULT                        0x00002502  // M3dregAllocResult
+#define M_3DREG_INQUIRE                             0x00002503  // M3dregInquire
+#define M_3DREG_CONTROL                             0x00002504  // M3dregControl
+#define M_3DREG_GET_RESULT                          0x00002505  // M3dregGetResult
+#define M_3DREG_FREE                                0x00002506  // M3dregFree
+#define M_3DREG_SAVE                                0x00002507  // M3dregSave
+#define M_3DREG_RESTORE                             0x00002508  // M3dregRestore
+#define M_3DREG_STREAM                              0x00002509  // M3dregStream
+#define M_3DREG_COPY_RESULT                         0x0000250A  // M3dregCopyResult
+#define M_3DREG_CALCULATE                           0x0000250B  // M3dregCalculate
+#define M_3DREG_COPY                                0x0000250C  // M3dregCopy
+#define M_3DREG_SET_LOCATION                        0x0000250D  // M3dregSetLocation
+#define M_3DREG_MERGE                               0x0000250E  // M3dregMerge
+
+
+#endif //__FUNCTIONCODES_H__
\ No newline at end of file
diff --git a/Common_Class/Matrox/Include/Mildec.h b/Common_Class/Matrox/Include/Mildec.h
new file mode 100644
index 0000000..7e16410
--- /dev/null
+++ b/Common_Class/Matrox/Include/Mildec.h
@@ -0,0 +1,53 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILDEC.H
+    Revision:  10.40.0640
+    Content :  This file contains the defines that are used by the
+               mil functions to specify which type of command decoder
+               will be used by the allocated system (MsysAlloc()).
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef __MILDEC_H
+#define __MILDEC_H
+
+    #define M_SYSTEM_DEFAULT        MIL_TEXT("M_DEFAULT")
+    #define M_SYSTEM_HOST           MIL_TEXT("M_SYSTEM_HOST")
+    #define M_SYSTEM_VGA            M_SYSTEM_HOST
+    #define M_SYSTEM_1394           MIL_TEXT("M_SYSTEM_1394")
+    #define M_SYSTEM_IRIS           MIL_TEXT("M_SYSTEM_IRIS")
+    #define M_SYSTEM_CRONOSPLUS     MIL_TEXT("M_SYSTEM_CRONOSPLUS")
+    #define M_SYSTEM_MORPHIS        MIL_TEXT("M_SYSTEM_MORPHIS")
+    #define M_SYSTEM_SOLIOS         MIL_TEXT("M_SYSTEM_SOLIOS")
+    #define M_SYSTEM_MTXAUXILIARY   MIL_TEXT("M_SYSTEM_MTXAUXILIARY")
+    #define M_SYSTEM_VIO            MIL_TEXT("M_SYSTEM_VIO")
+    #define M_SYSTEM_NEXIS          MIL_TEXT("M_SYSTEM_NEXIS")
+    #define M_SYSTEM_GPU            MIL_TEXT("M_SYSTEM_GPU")
+    #define M_SYSTEM_GIGE_VISION    MIL_TEXT("M_SYSTEM_GIGE_VISION")
+    #define M_SYSTEM_MORPHISQXT     MIL_TEXT("M_SYSTEM_MORPHISQXT")
+    #define M_SYSTEM_IRIS_GT        MIL_TEXT("M_SYSTEM_IRIS_GT")
+    #define M_SYSTEM_RADIENT        MIL_TEXT("M_SYSTEM_RADIENT")
+    #define M_SYSTEM_ORION_HD       MIL_TEXT("M_SYSTEM_ORION_HD")
+    #define M_SYSTEM_NEXIS2         MIL_TEXT("M_SYSTEM_NEXIS2")
+    #define M_SYSTEM_HDDVR          MIL_TEXT("M_SYSTEM_HDDVR")
+    #define M_SYSTEM_RADIENTCXP     MIL_TEXT("M_SYSTEM_RADIENTCXP")
+    #define M_SYSTEM_RAPIXOCXP      MIL_TEXT("M_SYSTEM_RAPIXOCXP")
+    #define M_SYSTEM_RAPIXOCL       MIL_TEXT("M_SYSTEM_RAPIXOCL")
+    #define M_SYSTEM_RADIENTCLHS    MIL_TEXT("M_SYSTEM_RADIENTCLHS")
+    #define M_SYSTEM_RADIENTPRO     MIL_TEXT("M_SYSTEM_RADIENTPRO")
+    #define M_SYSTEM_RADIENTEVCL    MIL_TEXT("M_SYSTEM_RADIENTEVCL")
+    #define M_SYSTEM_MATROXCOMPRESS MIL_TEXT("M_SYSTEM_MATROXCOMPRESS")
+    #define M_SYSTEM_USB3_VISION    MIL_TEXT("M_SYSTEM_USB3_VISION")
+    #define M_SYSTEM_GENTL          MIL_TEXT("M_SYSTEM_GENTL")
+    #define M_SYSTEM_IRIS_GTR       MIL_TEXT("M_SYSTEM_IRIS_GTR")
+    #define M_SYSTEM_NEXIS3         MIL_TEXT("M_SYSTEM_NEXIS3")
+    #define M_SYSTEM_ORION_UHD      MIL_TEXT("M_SYSTEM_ORION_UHD")
+    #define M_SYSTEM_CLARITY_UHD    MIL_TEXT("M_SYSTEM_CLARITY_UHD")
+    #define M_SYSTEM_INDIO          MIL_TEXT("M_SYSTEM_INDIO")
+    #define M_SYSTEM_CONCORD_POE    MIL_TEXT("M_SYSTEM_CONCORD_POE")
+#endif
diff --git a/Common_Class/Matrox/Include/Milerr.h b/Common_Class/Matrox/Include/Milerr.h
new file mode 100644
index 0000000..932f76c
--- /dev/null
+++ b/Common_Class/Matrox/Include/Milerr.h
@@ -0,0 +1,2784 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILERR.H
+    Owner   :  Matrox Imaging
+    Revision:  10.35.1105
+    Content :  This file contains the defines that are used by the
+               mil functions to generate error codes and messages that
+               will be used by the MIL Application Error Logging and
+               other error related functions.
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2019.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef  __MILERR_H
+#define  __MILERR_H
+
+/*
+First line is the error code.
+Second line is the error message for this code.
+Other 9 lines are optional sub-messages with more detailed information.
+
+------------------------------------------------------------------------
+-                                                                      -
+-  WARNING: Strings (including the NULL character at the end) should   -
+-           never be longer than M_ERROR_MESSAGE_SIZE (128L).          -
+-           No checking is done anywhere in the code to ensure this.   -
+-                                                                      -
+------------------------------------------------------------------------
+*/
+
+
+#define NO_MSG                   MIL_TEXT("")  /* empty error message          */
+#define NO_SUBMSG                MIL_TEXT("")  /* empty sub-error message      */
+#define NO_FCTNAME               MIL_TEXT("")  /* empty function name          */
+
+// The following define must be set to a value higher
+// than the error subcode range. For now, error subcode
+// range is 1-9. M_NBSUBERRMSGMAX is 10.
+#define M_SYSTEM_STRING_CODE     M_NBSUBERRMSGMAX
+
+/* LIST OF ERROR CODES AND MESSAGES */
+
+#define M_NULL_ERROR             0L
+#define M_ERR_0_MSG              MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_1         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_2         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_3         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_4         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_5         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_6         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_7         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_8         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_9         MIL_TEXT("Null.")
+
+#define M_SIMD_ERROR_1           1L
+#define M_ERR_1_MSG              MIL_TEXT("SIMD Error.")
+#define M_ERR_1_SUBMSG_1         MIL_TEXT("Cannot force MMX on a non-MMX CPU.")
+#define M_ERR_1_SUBMSG_2         MIL_TEXT("Cannot force SSE on a non-SSE CPU or the OS does not support SSE.")
+#define M_ERR_1_SUBMSG_3         MIL_TEXT("Cannot force SSE2 on a non-SSE2 CPU or the OS does not support SSE2.")
+#define M_ERR_1_SUBMSG_4         MIL_TEXT("Cannot force 3DNow on a non-3DNow CPU.")
+#define M_ERR_1_SUBMSG_5         MIL_TEXT("Cannot force MMX Extension on a non-MMX Extension CPU.")
+#define M_ERR_1_SUBMSG_6         MIL_TEXT("Cannot force 3DNow Extension on a non-3DNow Extension CPU.")
+#define M_ERR_1_SUBMSG_7         MIL_TEXT("Cannot force SSE3 on a non-SSE3 CPU or the OS does not support SSE3.")
+#define M_ERR_1_SUBMSG_8         MIL_TEXT("Cannot force SSE4 on a non-SSE4 CPU or the OS does not support SSE4.")
+#define M_ERR_1_SUBMSG_9         MIL_TEXT("Cannot force AVX on a non-AVX CPU or the OS does not support AVX.")
+
+#define M_SIMD_ERROR_2           2L
+#define M_ERR_2_MSG              MIL_TEXT("SIMD Error.")
+#define M_ERR_2_SUBMSG_1         MIL_TEXT("Cannot force AVX2 on a non-AVX2 CPU or the OS does not support AVX2.")
+#define M_ERR_2_SUBMSG_2         NO_SUBMSG
+#define M_ERR_2_SUBMSG_3         NO_SUBMSG
+#define M_ERR_2_SUBMSG_4         NO_SUBMSG
+#define M_ERR_2_SUBMSG_5         NO_SUBMSG
+#define M_ERR_2_SUBMSG_6         NO_SUBMSG
+#define M_ERR_2_SUBMSG_7         NO_SUBMSG
+#define M_ERR_2_SUBMSG_8         NO_SUBMSG
+#define M_ERR_2_SUBMSG_9         NO_SUBMSG
+
+#define M_FUNC_FCT_ERROR         3L
+#define M_ERR_3_MSG              MIL_TEXT("Function call error.")
+#define M_ERR_3_SUBMSG_1         MIL_TEXT("MappGetError cannot be called from inside a MIL function. Use MfuncGetError instead.")
+#define M_ERR_3_SUBMSG_2         MIL_TEXT("Unable to obtain information about the slave function.")
+#define M_ERR_3_SUBMSG_3         MIL_TEXT("Node selected is not a valid node.")
+#define M_ERR_3_SUBMSG_4         MIL_TEXT("Cannot execute because an object resides in another workspace than the system selected to perform the call.")
+#define M_ERR_3_SUBMSG_5         MIL_TEXT("Propagating calibration informations between two MIL objects that reside on two different remote systems is not supported.")
+#define M_ERR_3_SUBMSG_6         NO_SUBMSG
+#define M_ERR_3_SUBMSG_7         NO_SUBMSG
+#define M_ERR_3_SUBMSG_8         NO_SUBMSG
+#define M_ERR_3_SUBMSG_9         NO_SUBMSG
+
+#define M_OPERATION_ERROR_5      4L
+#define M_ERR_4_MSG              MIL_TEXT("Operation error.")
+#define M_ERR_4_SUBMSG_1         MIL_TEXT("Buffer(s) must be unlocked before calling processing functions.")
+#define M_ERR_4_SUBMSG_2         MIL_TEXT("Cannot retrieve the system decoder for shadow allocation.")
+#define M_ERR_4_SUBMSG_3         MIL_TEXT("This lock type is not allowed on a buffer with GPU access only.")
+#define M_ERR_4_SUBMSG_4         MIL_TEXT("The buffer must be unlocked before calling MbufControl.")
+#define M_ERR_4_SUBMSG_5         MIL_TEXT("This operation cannot be forced to be executed from a specific node.")
+#define M_ERR_4_SUBMSG_6         MIL_TEXT("Node selected is not a valid node.")
+#define M_ERR_4_SUBMSG_7         MIL_TEXT("The graphic edition is not supported for this graphic element.")
+#define M_ERR_4_SUBMSG_8         MIL_TEXT("No bounding box could be found.")
+#define M_ERR_4_SUBMSG_9         MIL_TEXT("No neighbor could be found.")
+
+#define M_OPERATION_ERROR_4      5L
+#define M_ERR_5_MSG              MIL_TEXT("Operation error.")
+#define M_ERR_5_SUBMSG_1         MIL_TEXT("Cannot unlock an unlocked mutex.")
+#define M_ERR_5_SUBMSG_2         MIL_TEXT("Cannot free a mutex that still locked.")
+#define M_ERR_5_SUBMSG_3         MIL_TEXT("Error while locking the mutex.")
+#define M_ERR_5_SUBMSG_4         MIL_TEXT("Error while unlocking the mutex.")
+#define M_ERR_5_SUBMSG_5         MIL_TEXT("Error while freeing the mutex.")
+#define M_ERR_5_SUBMSG_6         MIL_TEXT("Deinterlacing is not supported on Odyssey systems.")
+#define M_ERR_5_SUBMSG_7         MIL_TEXT("MimLocatePeak1d is not supported on Odyssey systems.")
+#define M_ERR_5_SUBMSG_8         MIL_TEXT("MimDraw is not supported on Odyssey systems.")
+#define M_ERR_5_SUBMSG_9         MIL_TEXT("No file selected by user.")
+
+#define M_INVALID_PARAM_ERROR    6L
+#define M_ERR_6_MSG              MIL_TEXT("Invalid parameter.")
+#define M_ERR_6_SUBMSG_1         MIL_TEXT("Bad parameter value.")
+#define M_ERR_6_SUBMSG_2         MIL_TEXT("One of the parameters does not reside within the buffer's limits.")
+#define M_ERR_6_SUBMSG_3         MIL_TEXT("The pointer should not be null.")
+/* WARNING: Obsolete sub errors (4,5);*/
+#define M_ERR_6_SUBMSG_4         MIL_TEXT("Parameter 1 not supported.")
+#define M_ERR_6_SUBMSG_5         MIL_TEXT("Parameter 2 not supported.")
+#define M_ERR_6_SUBMSG_6         MIL_TEXT("No graphic text font selected.")
+#define M_ERR_6_SUBMSG_7         MIL_TEXT("The member StructSize from the MILBUFFERINFOOLD structure which was given as an argument is invalid.")
+#define M_ERR_6_SUBMSG_8         MIL_TEXT("The result buffer is too small to hold the result.")
+#define M_ERR_6_SUBMSG_9         MIL_TEXT("The scale factors is out of the supported range.")
+       
+
+#define M_OVERSCAN_ERROR         7L
+#define M_ERR_7_MSG              MIL_TEXT("Overscan processing error.")
+#define M_ERR_7_SUBMSG_1         MIL_TEXT("Cannot allocate temporary buffers in memory.")
+#define M_ERR_7_SUBMSG_2         MIL_TEXT("The buffer is too small to perform the selected overscan.")
+#define M_ERR_7_SUBMSG_3         NO_SUBMSG
+#define M_ERR_7_SUBMSG_4         NO_SUBMSG
+#define M_ERR_7_SUBMSG_5         NO_SUBMSG
+#define M_ERR_7_SUBMSG_6         NO_SUBMSG
+#define M_ERR_7_SUBMSG_7         NO_SUBMSG
+#define M_ERR_7_SUBMSG_8         NO_SUBMSG
+#define M_ERR_7_SUBMSG_9         NO_SUBMSG
+
+#define M_ALLOC_ERROR            8L
+#define M_ERR_8_MSG              MIL_TEXT("Allocation error.")
+#define M_ERR_8_SUBMSG_1         MIL_TEXT("Not enough memory to allocate the application.")
+#define M_ERR_8_SUBMSG_2         MIL_TEXT("Only one application can be allocated by the host thread.")
+#define M_ERR_8_SUBMSG_3         MIL_TEXT("Cannot allocate temporary buffers in memory.")
+#define M_ERR_8_SUBMSG_4         MIL_TEXT("Not enough memory to allocate the buffer.")
+#define M_ERR_8_SUBMSG_5         MIL_TEXT("Cannot allocate system.")
+#define M_ERR_8_SUBMSG_6         MIL_TEXT("Cannot allocate digitizer.")
+#define M_ERR_8_SUBMSG_7         MIL_TEXT("Cannot allocate display.")
+#define M_ERR_8_SUBMSG_8         MIL_TEXT("Not enough host memory to allocate buffer.")
+#define M_ERR_8_SUBMSG_9         MIL_TEXT("Buffer type not supported.")
+
+#define M_CHILD_ERROR            9L
+#define M_ERR_9_MSG              MIL_TEXT("Child allocation error.")
+#define M_ERR_9_SUBMSG_1         MIL_TEXT("Only one application can be allocated by the host thread.")
+#define M_ERR_9_SUBMSG_2         MIL_TEXT("Not enough memory to allocate a child application.")
+#define M_ERR_9_SUBMSG_3         MIL_TEXT("Not enough memory to allocate a child buffer.")
+#define M_ERR_9_SUBMSG_4         MIL_TEXT("Cannot allocate a temporary child buffer in memory.")
+#define M_ERR_9_SUBMSG_5         MIL_TEXT("It is impossible to make a band child from a compressed buffer.")
+#define M_ERR_9_SUBMSG_6         MIL_TEXT("Impossible to make a band child. The parent does not have enough bands.")
+#define M_ERR_9_SUBMSG_7         MIL_TEXT("It is impossible to make a child from a MPEG4 buffer.")
+#define M_ERR_9_SUBMSG_8         MIL_TEXT("It is impossible to make a child from a H264 buffer.")
+#define M_ERR_9_SUBMSG_9         MIL_TEXT("Cannot allocate a child that is completely outside its parent's limits.")
+
+#define M_ACCESS_ERROR           10L
+#define M_ERR_10_MSG             MIL_TEXT("Buffer access error.")
+#define M_ERR_10_SUBMSG_1        MIL_TEXT("Cannot M_RESTORE a M_RAW file format buffer.")
+#define M_ERR_10_SUBMSG_2        MIL_TEXT("Cannot export the buffer.")
+#define M_ERR_10_SUBMSG_3        MIL_TEXT("Source buffer must be an M_IMAGE buffer to export it.")
+#define M_ERR_10_SUBMSG_4        MIL_TEXT("Cannot import buffer.")
+#define M_ERR_10_SUBMSG_5        MIL_TEXT("File format is not supported.")
+#define M_ERR_10_SUBMSG_6        MIL_TEXT("Cannot export child buffers in M_PLANAR format.")
+#define M_ERR_10_SUBMSG_7        MIL_TEXT("Cannot load the object.")
+#define M_ERR_10_SUBMSG_8        MIL_TEXT("Cannot restore the object.")
+#define M_ERR_10_SUBMSG_9        MIL_TEXT("Cannot save the object.")
+
+#define M_DISPLAY_ERROR          11L
+#define M_ERR_11_MSG             MIL_TEXT("Display error.")
+#define M_ERR_11_SUBMSG_1        MIL_TEXT("The display and the buffer must be allocated on the same system.")
+#define M_ERR_11_SUBMSG_2        MIL_TEXT("Display Lut dimensions are not compatible with the user Lut.")
+#define M_ERR_11_SUBMSG_3        MIL_TEXT("Cannot associate a M_PSEUDO Lut with a monochrome display.")
+#define M_ERR_11_SUBMSG_4        MIL_TEXT("The zoom factor is out of the zoom limit or equal to zero.")
+#define M_ERR_11_SUBMSG_5        MIL_TEXT("Buffer not currently selected on the display.")
+#define M_ERR_11_SUBMSG_6        MIL_TEXT("Incompatible display type.")
+#define M_ERR_11_SUBMSG_7        MIL_TEXT("Display must be allocated with the M_WINDOWED init flag.")
+#define M_ERR_11_SUBMSG_8        MIL_TEXT("Invalid window handle.")
+#define M_ERR_11_SUBMSG_9        MIL_TEXT("Cannot allocate compensation buffer. Display and buffer should belong to the same system.")
+
+#define M_OPERATION_ERROR        12L
+#define M_ERR_12_MSG             MIL_TEXT("Operation error.")
+#define M_ERR_12_SUBMSG_1        MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_12_SUBMSG_2        MIL_TEXT("Not enough host memory to allocate a buffer.")
+#define M_ERR_12_SUBMSG_3        MIL_TEXT("The application still has MIL objects associated with it.")
+#define M_ERR_12_SUBMSG_4        MIL_TEXT("Only logical addresses are supported on host systems.")
+#define M_ERR_12_SUBMSG_5        MIL_TEXT("The pitch must be a multiple of 4 bytes with binary buffers.")
+#define M_ERR_12_SUBMSG_6        MIL_TEXT("Requested operation not supported.") 
+#define M_ERR_12_SUBMSG_7        MIL_TEXT("Pitch must be a multiple of 2 pixels.")
+#define M_ERR_12_SUBMSG_8        MIL_TEXT("Can only create on a physical address with non paged buffers.")
+#define M_ERR_12_SUBMSG_9        MIL_TEXT("The polar band to put must fit in the destination.")
+
+#define M_DIGITIZER_ERROR        13L
+#define M_ERR_13_MSG             MIL_TEXT("Digitizer error.")
+#define M_ERR_13_SUBMSG_1        MIL_TEXT("Digitizer and buffer must belong to same system.")
+#define M_ERR_13_SUBMSG_2        MIL_TEXT("Cannot free digitizer. Continuous grab in progress.")
+#define M_ERR_13_SUBMSG_3        MIL_TEXT("Cannot grab. Digitizer is already being used for a continuous grab.")
+#define M_ERR_13_SUBMSG_4        MIL_TEXT("Operation already in progress.")
+#define M_ERR_13_SUBMSG_5        MIL_TEXT("Digitizer has denied the request to be freed.")
+#define M_ERR_13_SUBMSG_6        MIL_TEXT("A buffer in the list is already being used by MdigGrab or MdigProcess.")
+#define M_ERR_13_SUBMSG_7        MIL_TEXT("Unable to load DigitizerController.dll.")
+#define M_ERR_13_SUBMSG_8        MIL_TEXT("Unable to find entry point in DigitizerController.dll.")
+#define M_ERR_13_SUBMSG_9        MIL_TEXT("Cannot free digitizer. MdigProcess is in progress.")
+
+#define M_HOOK_ERROR             14L
+#define M_ERR_14_MSG             MIL_TEXT("Hook function error.")
+#define M_ERR_14_SUBMSG_1        MIL_TEXT("Function and/or user data not found.")
+#define M_ERR_14_SUBMSG_2        MIL_TEXT("A hook function must be provided.")
+#define M_ERR_14_SUBMSG_3        MIL_TEXT("Object not hooked to an event.")
+#define M_ERR_14_SUBMSG_4        MIL_TEXT("Invalid hook type.")
+#define M_ERR_14_SUBMSG_5        MIL_TEXT("Required hardware not present.")
+#define M_ERR_14_SUBMSG_6        MIL_TEXT("Address of hooked function is not accessible from current process.")
+#define M_ERR_14_SUBMSG_7        MIL_TEXT("MIL has detected a stack corruption in user hook function.")
+#define M_ERR_14_SUBMSG_8        MIL_TEXT("A C++ exception occurred in the user hook function.")
+#define M_ERR_14_SUBMSG_9        MIL_TEXT("Unspecfied error occurred in driver.")
+
+#define M_JPEG_COMPRESS_ERROR    15L
+#define M_ERR_15_MSG             MIL_TEXT("JPEG compression error.")
+#define M_ERR_15_SUBMSG_1        MIL_TEXT("Unable to allocate memory.")
+#define M_ERR_15_SUBMSG_2        MIL_TEXT("Invalid image depth for JPEG compression.")
+#define M_ERR_15_SUBMSG_3        MIL_TEXT("Invalid compression parameter.")
+#define M_ERR_15_SUBMSG_4        MIL_TEXT("Invalid Huffman table.")
+#define M_ERR_15_SUBMSG_5        MIL_TEXT("Invalid predictor.")
+#define M_ERR_15_SUBMSG_6        MIL_TEXT("Invalid Q Factor.")
+#define M_ERR_15_SUBMSG_7        MIL_TEXT("Invalid quantization table.")
+#define M_ERR_15_SUBMSG_8        MIL_TEXT("Invalid restart interval.")
+#define M_ERR_15_SUBMSG_9        MIL_TEXT("Invalid source or destination format.")
+
+#define M_COMPRESS_ERROR         16L
+#define M_ERR_16_MSG             MIL_TEXT("Compression error.")
+#define M_ERR_16_SUBMSG_1        MIL_TEXT("Invalid compression type.")
+#define M_ERR_16_SUBMSG_2        MIL_TEXT("Corrupted data.")
+#define M_ERR_16_SUBMSG_3        MIL_TEXT("Invalid image depth for required compression type.")
+#define M_ERR_16_SUBMSG_4        MIL_TEXT("Buffer allocated with MbufCreate cannot be the destination of a compression operation.")
+#define M_ERR_16_SUBMSG_5        MIL_TEXT("Buffer allocated with MbufCreate cannot be the destination of a MbufPut operation.")
+#define M_ERR_16_SUBMSG_6        MIL_TEXT("Buffer too small to contain the compressed data.")
+#define M_ERR_16_SUBMSG_7        MIL_TEXT("Cannot modify the pointer of a buffer allocated with MbufCreate.")
+#define M_ERR_16_SUBMSG_8        NO_SUBMSG
+#define M_ERR_16_SUBMSG_9        NO_SUBMSG
+
+#define M_JPEG_COMPRESS_ERROR_2  17L
+#define M_ERR_17_MSG             MIL_TEXT("JPEG compression error.")
+#define M_ERR_17_SUBMSG_1        MIL_TEXT("Chrominance tables are allowed only with 3 band YUV buffers.")
+#define M_ERR_17_SUBMSG_2        MIL_TEXT("Luminance tables are allowed only with 3 band YUV buffers.")
+#define M_ERR_17_SUBMSG_3        MIL_TEXT("The predictor value is only available for 1 band buffers or child band buffers.")
+#define M_ERR_17_SUBMSG_4        MIL_TEXT("The Q factor is only available for 1 band buffers or band child band buffers.")
+#define M_ERR_17_SUBMSG_5        MIL_TEXT("The restart interval is only available for 1 band buffers or child band buffers.")
+#define M_ERR_17_SUBMSG_6        MIL_TEXT("The source image must be a multiple of 16 in X and a multiple of 8 in Y.")
+#define M_ERR_17_SUBMSG_7        MIL_TEXT("The destination image must be a multiple of 16 in X and a multiple of 8 in Y.")
+#define M_ERR_17_SUBMSG_8        MIL_TEXT("The source image must be a multiple of 16 in X and a multiple of 16 in Y.")
+#define M_ERR_17_SUBMSG_9        MIL_TEXT("The destination image must be a multiple of 16 in X and a multiple of 16 in Y.")
+
+
+#define M_BMP_ERROR              18L
+#define M_ERR_18_MSG             MIL_TEXT("BMP handler file access error.")
+#define M_ERR_18_SUBMSG_1        MIL_TEXT("Not a bitmap file.")
+#define M_ERR_18_SUBMSG_2        MIL_TEXT("Error closing bitmap file.")
+#define M_ERR_18_SUBMSG_3        MIL_TEXT("Cannot open file in read mode.")
+#define M_ERR_18_SUBMSG_4        MIL_TEXT("Error reading file.")
+#define M_ERR_18_SUBMSG_5        MIL_TEXT("Unable to position file pointer.")
+#define M_ERR_18_SUBMSG_6        MIL_TEXT("Cannot create or open file in write mode.")
+#define M_ERR_18_SUBMSG_7        MIL_TEXT("No bitmap file opened in read mode.")
+#define M_ERR_18_SUBMSG_8        MIL_TEXT("No bitmap file opened in write mode.")
+#define M_ERR_18_SUBMSG_9        MIL_TEXT("Error writing file.")
+
+#define M_BMP_ERROR_2            19L
+#define M_ERR_19_MSG             MIL_TEXT("BMP handler general error.")
+#define M_ERR_19_SUBMSG_1        MIL_TEXT("Unable to allocate sufficient memory.")
+#define M_ERR_19_SUBMSG_2        MIL_TEXT("Color format not supported.")
+#define M_ERR_19_SUBMSG_3        MIL_TEXT("Invalid write color format specified.")
+#define M_ERR_19_SUBMSG_4        MIL_TEXT("Invalid write compression type specified.")
+#define M_ERR_19_SUBMSG_5        MIL_TEXT("Conversion not supported.")
+#define M_ERR_19_SUBMSG_6        MIL_TEXT("Invalid array format specified.")
+#define M_ERR_19_SUBMSG_7        MIL_TEXT("Invalid length of palette arrays specified.")
+#define M_ERR_19_SUBMSG_8        MIL_TEXT("No palette to read.")
+#define M_ERR_19_SUBMSG_9        MIL_TEXT("Palette not needed for current write format.")
+
+
+#define M_TIFF_ERROR             20L
+#define M_ERR_20_MSG             MIL_TEXT("TIFF file access error.")
+#define M_ERR_20_SUBMSG_1        MIL_TEXT("Cannot open file.")
+#define M_ERR_20_SUBMSG_2        MIL_TEXT("Cannot close file.")
+#define M_ERR_20_SUBMSG_3        MIL_TEXT("Cannot read file.")
+#define M_ERR_20_SUBMSG_4        MIL_TEXT("Cannot read file.")
+#define M_ERR_20_SUBMSG_5        MIL_TEXT("Cannot write to file.")
+#define M_ERR_20_SUBMSG_6        MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_20_SUBMSG_7        MIL_TEXT("The image file does not conform to the TIFF 6.0 specification.")
+#define M_ERR_20_SUBMSG_8        MIL_TEXT("Wrong Byte Order, Only INTEL Byte Ordering supported.")
+#define M_ERR_20_SUBMSG_9        MIL_TEXT("Not a TIFF file.")
+
+#define M_MIL_FILE_ERROR         21L
+#define M_ERR_21_MSG             MIL_TEXT("MIL file access error.")
+#define M_ERR_21_SUBMSG_1        MIL_TEXT("Cannot open file.")
+#define M_ERR_21_SUBMSG_2        MIL_TEXT("Cannot close file.")
+#define M_ERR_21_SUBMSG_3        MIL_TEXT("Cannot read file.")
+#define M_ERR_21_SUBMSG_4        MIL_TEXT("Cannot read file.")
+#define M_ERR_21_SUBMSG_5        MIL_TEXT("Cannot write to file.")
+#define M_ERR_21_SUBMSG_6        MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_21_SUBMSG_7        MIL_TEXT("The image file does not conform to the TIFF 6.0 specification.")
+#define M_ERR_21_SUBMSG_8        MIL_TEXT("Wrong Byte Order, Only INTEL Byte Ordering supported.")
+#define M_ERR_21_SUBMSG_9        MIL_TEXT("Not a MIL file.")
+
+#define M_MIL_FILE_ERROR_2       22L
+#define M_ERR_22_MSG             MIL_TEXT("MIL file access error.")
+#define M_ERR_22_SUBMSG_1        MIL_TEXT("Only 8, 16 or 32 BitsPerSample supported.")
+#define M_ERR_22_SUBMSG_2        MIL_TEXT("Lempel-Ziv & Welch (LZW) compression not supported.")
+#define M_ERR_22_SUBMSG_3        MIL_TEXT("PhotometricInterp incompatible with SamplePerPixel.")
+#define M_ERR_22_SUBMSG_4        MIL_TEXT("Only PlanarConfiguration 2 supported for multi-band images.")
+#define M_ERR_22_SUBMSG_5        MIL_TEXT("Up to 8 Samples Per Pixel supported.")
+#define M_ERR_22_SUBMSG_6        MIL_TEXT("Only identical BitsPerSample for every sample supported.")
+#define M_ERR_22_SUBMSG_7        MIL_TEXT("Cannot seek in file.")
+#define M_ERR_22_SUBMSG_8        MIL_TEXT("Bad file format detected.")
+#define M_ERR_22_SUBMSG_9        MIL_TEXT("Invalid info requested.")
+
+#define M_MIL_FILE_ERROR_3       23L
+#define M_ERR_23_MSG             MIL_TEXT("MIL file access error.")
+#define M_ERR_23_SUBMSG_1        MIL_TEXT("Invalid parameter detected.")
+#define M_ERR_23_SUBMSG_2        MIL_TEXT("Missing information in file.")
+#define M_ERR_23_SUBMSG_3        MIL_TEXT("Invalid size information detected in file.")
+#define M_ERR_23_SUBMSG_4        MIL_TEXT("Invalid identification information detected in file.")
+#define M_ERR_23_SUBMSG_5        MIL_TEXT("Invalid data information detected in file.")
+#define M_ERR_23_SUBMSG_6        MIL_TEXT("Unexpected internal error.")
+#define M_ERR_23_SUBMSG_7        MIL_TEXT("Cannot open file: Invalid file name.")
+#define M_ERR_23_SUBMSG_8        MIL_TEXT("Unable to open or access file, or file contains an invalid stream.")
+#define M_ERR_23_SUBMSG_9        MIL_TEXT("Invalid stream.")
+
+#define M_MULTI_THREAD_ERROR     24L
+#define M_ERR_24_MSG             MIL_TEXT("Multi thread error.")
+#define M_ERR_24_SUBMSG_1        NO_SUBMSG
+#define M_ERR_24_SUBMSG_2        MIL_TEXT("Invalid MIL_ID, MIL thread or event was not allocated in current HOST thread.")
+#define M_ERR_24_SUBMSG_3        MIL_TEXT("Application must be freed before exiting a thread.")
+#define M_ERR_24_SUBMSG_4        MIL_TEXT("Operation not supported on this system.")
+#define M_ERR_24_SUBMSG_5        MIL_TEXT("Cannot allocate thread.")
+#define M_ERR_24_SUBMSG_6        MIL_TEXT("Cannot select this thread in the current host thread.")
+#define M_ERR_24_SUBMSG_7        MIL_TEXT("The thread belongs to a system that does not support this operation.")
+#define M_ERR_24_SUBMSG_8        MIL_TEXT("Operation not supported.")
+#define M_ERR_24_SUBMSG_9        MIL_TEXT("Cannot wait for the completion of a thread allocated in another host thread.")
+
+#define M_JPEG_ERROR             25L
+#define M_ERR_25_MSG             MIL_TEXT("JPEG handler general error.")
+#define M_ERR_25_SUBMSG_1        MIL_TEXT("Color format not supported.")
+#define M_ERR_25_SUBMSG_2        MIL_TEXT("Error closing JPEG file.")
+#define M_ERR_25_SUBMSG_3        MIL_TEXT("Error opening JPEG file.")
+#define M_ERR_25_SUBMSG_4        MIL_TEXT("Unable to allocate sufficient memory.")
+#define M_ERR_25_SUBMSG_5        MIL_TEXT("Image too large to save.")
+#define M_ERR_25_SUBMSG_6        MIL_TEXT("Invalid JPEG marker.")
+#define M_ERR_25_SUBMSG_7        MIL_TEXT("Bad identification information detected in file.")
+#define M_ERR_25_SUBMSG_8        MIL_TEXT("Buffer to receive data does not fit with data.")
+#define M_ERR_25_SUBMSG_9        MIL_TEXT("Error reading JPEG file.")
+
+#define M_BUFFER_FREE_ERROR      26L
+#define M_ERR_26_MSG             MIL_TEXT("Buffer free operation error.")
+#define M_ERR_26_SUBMSG_1        MIL_TEXT("Buffer still has child(ren) associated with it.")
+#define M_ERR_26_SUBMSG_2        MIL_TEXT("This buffer is currently being used.")
+#define M_ERR_26_SUBMSG_3        MIL_TEXT("User attempting to free a system allocated buffer.")
+#define M_ERR_26_SUBMSG_4        MIL_TEXT("Internal error, internal function attempting to free a user allocated buffer.")
+#define M_ERR_26_SUBMSG_5        MIL_TEXT("This buffer is currently being used by a digitizer for a continuous grab.")
+#define M_ERR_26_SUBMSG_6        MIL_TEXT("Memory corruption detected: the guard value has been overwritten.")
+#define M_ERR_26_SUBMSG_7        MIL_TEXT("This buffer is still remotely mapped.")
+#define M_ERR_26_SUBMSG_8        MIL_TEXT("Error while freeing non-paged buffer.")
+#define M_ERR_26_SUBMSG_9        MIL_TEXT("Error while freeing paged buffer.")
+
+#define M_SYSTEM_FREE_ERROR      27L
+#define M_ERR_27_MSG             MIL_TEXT("System free error.")
+#define M_ERR_27_SUBMSG_1        MIL_TEXT("System still has buffer(s) associated with it.")
+#define M_ERR_27_SUBMSG_2        MIL_TEXT("System still has display(s) associated with it.")
+#define M_ERR_27_SUBMSG_3        MIL_TEXT("System still has digitizer(s) associated with it.")
+#define M_ERR_27_SUBMSG_4        MIL_TEXT("Cannot free M_DEFAULT_HOST.")
+#define M_ERR_27_SUBMSG_5        MIL_TEXT("System still has object(s) associated with it.")
+#define M_ERR_27_SUBMSG_6        MIL_TEXT("System still has processing object(s) associated with it.")
+#define M_ERR_27_SUBMSG_7        MIL_TEXT("System is still selected in at least one thread.")
+#define M_ERR_27_SUBMSG_8        NO_SUBMSG
+#define M_ERR_27_SUBMSG_9        NO_SUBMSG
+
+#define M_FUNCTION_START_ERROR   28L
+#define M_ERR_28_MSG             MIL_TEXT("Function start error.")
+#define M_ERR_28_SUBMSG_1        MIL_TEXT("No application allocated.")
+#define M_ERR_28_SUBMSG_2        NO_SUBMSG
+#define M_ERR_28_SUBMSG_3        NO_SUBMSG
+#define M_ERR_28_SUBMSG_4        NO_SUBMSG
+#define M_ERR_28_SUBMSG_5        NO_SUBMSG
+#define M_ERR_28_SUBMSG_6        NO_SUBMSG
+#define M_ERR_28_SUBMSG_7        NO_SUBMSG
+#define M_ERR_28_SUBMSG_8        NO_SUBMSG
+#define M_ERR_28_SUBMSG_9        NO_SUBMSG
+
+#define M_COMMAND_DECODER_ERROR  29L
+#define M_ERR_29_MSG             MIL_TEXT("System command error.")
+#define M_ERR_29_SUBMSG_1        MIL_TEXT("Requested operation not supported.")
+#define M_ERR_29_SUBMSG_2        MIL_TEXT("Operation execution failed.")
+#define M_ERR_29_SUBMSG_3        MIL_TEXT("Requested Raw Call is not supported.")
+#define M_ERR_29_SUBMSG_4        NO_SUBMSG 
+#define M_ERR_29_SUBMSG_5        NO_SUBMSG
+#define M_ERR_29_SUBMSG_6        NO_SUBMSG
+#define M_ERR_29_SUBMSG_7        NO_SUBMSG
+#define M_ERR_29_SUBMSG_8        NO_SUBMSG
+#define M_ERR_29_SUBMSG_9        NO_SUBMSG
+
+#define M_LABELLING_ERROR        30L
+#define M_ERR_30_MSG             MIL_TEXT("Labeling error.")
+#define M_ERR_30_SUBMSG_1        MIL_TEXT("Maximum number of labels reached.")
+#define M_ERR_30_SUBMSG_2        MIL_TEXT("Should use a buffer of greater bit depth.")
+#define M_ERR_30_SUBMSG_3        MIL_TEXT("Maximum number of labels reached.\nShould use a buffer of greater bit depth.")
+#define M_ERR_30_SUBMSG_4        NO_SUBMSG
+#define M_ERR_30_SUBMSG_5        NO_SUBMSG
+#define M_ERR_30_SUBMSG_6        NO_SUBMSG
+#define M_ERR_30_SUBMSG_7        NO_SUBMSG
+#define M_ERR_30_SUBMSG_8        NO_SUBMSG
+#define M_ERR_30_SUBMSG_9        NO_SUBMSG
+
+#define M_FILE_ERROR             31L
+#define M_ERR_31_MSG             MIL_TEXT("File access error.")
+#define M_ERR_31_SUBMSG_1        MIL_TEXT("Cannot open output file.")
+#define M_ERR_31_SUBMSG_2        MIL_TEXT("Cannot write to file.")
+#define M_ERR_31_SUBMSG_3        MIL_TEXT("Cannot open input file.")
+#define M_ERR_31_SUBMSG_4        MIL_TEXT("Cannot read file.")
+#define M_ERR_31_SUBMSG_5        MIL_TEXT("Cannot close output file.")
+#define M_ERR_31_SUBMSG_6        MIL_TEXT("Cannot close input file.")
+#define M_ERR_31_SUBMSG_7        MIL_TEXT("The FileFormat parameter does not represent the actual file format.")
+#define M_ERR_31_SUBMSG_8        MIL_TEXT("This OS does not support file access.")
+#define M_ERR_31_SUBMSG_9        MIL_TEXT("Not a MIL file.")
+
+#define M_APP_FREE_ERROR         32L
+#define M_ERR_32_MSG             MIL_TEXT("Application free operation error.")
+#define M_ERR_32_SUBMSG_1        MIL_TEXT("Application still has system(s) associated with it.")
+#define M_ERR_32_SUBMSG_2        MIL_TEXT("Default host system still has buffer(s) associated with it.")
+#define M_ERR_32_SUBMSG_3        MIL_TEXT("Application still has child(ren) associated with it.")
+#define M_ERR_32_SUBMSG_4        MIL_TEXT("Application was not freed.")
+#define M_ERR_32_SUBMSG_5        MIL_TEXT("Application still has object(s) associated with it.")
+#define M_ERR_32_SUBMSG_6        MIL_TEXT("Application must be freed in the thread in which it was allocated.")
+#define M_ERR_32_SUBMSG_7        MIL_TEXT("Some display related object(s) were not freed.")
+#define M_ERR_32_SUBMSG_8        MIL_TEXT("Could not free the Auxiliary IO service.")
+#define M_ERR_32_SUBMSG_9        MIL_TEXT("Application is still processing.")
+
+#define M_TIFF_ERROR_2           33L
+#define M_ERR_33_MSG             MIL_TEXT("TIFF File access error.")
+#define M_ERR_33_SUBMSG_1        MIL_TEXT("Only 1, 8, 16 or 32 BitsPerSample supported.")
+#define M_ERR_33_SUBMSG_2        MIL_TEXT("Cannot read compressed image file.")
+#define M_ERR_33_SUBMSG_3        MIL_TEXT("PhotometricInterp incompatible with SamplePerPixel.")
+#define M_ERR_33_SUBMSG_4        MIL_TEXT("Only PlanarConfiguration 2 supported for multi-band images.")
+#define M_ERR_33_SUBMSG_5        MIL_TEXT("Up to 8 Samples Per Pixel supported.")
+#define M_ERR_33_SUBMSG_6        MIL_TEXT("Only identical BitsPerSample for every sample supported.")
+#define M_ERR_33_SUBMSG_7        MIL_TEXT("Cannot seek in file.")
+#define M_ERR_33_SUBMSG_8        MIL_TEXT("Bad file format detected.")
+#define M_ERR_33_SUBMSG_9        MIL_TEXT("Invalid info requested.")
+
+#define M_PROCESSING_ERROR       34L
+#define M_ERR_34_MSG             MIL_TEXT("Processing error.")
+#define M_ERR_34_SUBMSG_1        MIL_TEXT("All buffers do not have the same working system.")
+#define M_ERR_34_SUBMSG_2        MIL_TEXT("Cannot find any working system between buffers.")
+#define M_ERR_34_SUBMSG_3        MIL_TEXT("Cannot process a HOST buffer as a whole and a temporary buffer.")
+#define M_ERR_34_SUBMSG_4        MIL_TEXT("Source buffers cannot overlap with destination buffers.")
+#define M_ERR_34_SUBMSG_5        MIL_TEXT("No processor on target processing system.")
+#define M_ERR_34_SUBMSG_6        MIL_TEXT("Pixel values out of supported range.")
+#define M_ERR_34_SUBMSG_7        NO_SUBMSG
+#define M_ERR_34_SUBMSG_8        NO_SUBMSG
+#define M_ERR_34_SUBMSG_9        MIL_TEXT("Not enough memory or system limitation, cannot process buffer.")
+
+#define M_INVALID_ID             35L
+#define M_ERR_35_MSG             MIL_TEXT("Invalid MIL ID.")
+#define M_ERR_35_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_35_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_35_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_35_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_35_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_35_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_35_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_35_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_35_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_INVALID_NATURE         36L
+#define M_ERR_36_MSG             MIL_TEXT("Inappropriate MIL ID.")
+#define M_ERR_36_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_36_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_36_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_36_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_36_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_36_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_36_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_36_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_36_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_INVALID_PARAM_ERROR_2  37L
+#define M_ERR_37_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_37_SUBMSG_1        MIL_TEXT("For this operation, you should supply a LUT buffer with at least 512 entries.")
+#define M_ERR_37_SUBMSG_2        MIL_TEXT("For this operation the grab mode must be asynchronous.")
+#define M_ERR_37_SUBMSG_3        MIL_TEXT("This type of conversion requires two 3 band buffers.")
+#define M_ERR_37_SUBMSG_4        MIL_TEXT("This type of conversion requires a 3 band source buffer.")
+#define M_ERR_37_SUBMSG_5        MIL_TEXT("This type of conversion requires a 3 band destination buffer.")
+#define M_ERR_37_SUBMSG_6        MIL_TEXT("Invalid interpolation type specified.")
+#define M_ERR_37_SUBMSG_7        MIL_TEXT("Specified center is outside buffer.")
+#define M_ERR_37_SUBMSG_8        MIL_TEXT("A 8 or 16 bit monochrome uncompressed image buffer is required for this operation.")
+#define M_ERR_37_SUBMSG_9        MIL_TEXT("LUTs must be 1 or 3 bands, 8 or 16 bit.")
+
+#define M_INVALID_ATTRIBUTE      38L
+#define M_ERR_38_MSG             MIL_TEXT("Invalid attributes.")
+#define M_ERR_38_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_38_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_38_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_38_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_38_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_38_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_38_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_38_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_38_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_CALL_CONTEXT_ERROR     39L
+#define M_ERR_39_MSG             MIL_TEXT("Call context error.")
+#define M_ERR_39_SUBMSG_1        MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_39_SUBMSG_2        NO_SUBMSG
+#define M_ERR_39_SUBMSG_3        NO_SUBMSG
+#define M_ERR_39_SUBMSG_4        NO_SUBMSG
+#define M_ERR_39_SUBMSG_5        NO_SUBMSG
+#define M_ERR_39_SUBMSG_6        NO_SUBMSG
+#define M_ERR_39_SUBMSG_7        NO_SUBMSG
+#define M_ERR_39_SUBMSG_8        NO_SUBMSG
+#define M_ERR_39_SUBMSG_9        NO_SUBMSG
+
+#define M_DRIVER_OBSOLETE        40L
+#define M_ERR_40_MSG             MIL_TEXT("MIL driver version.")
+#define M_ERR_40_SUBMSG_1        MIL_TEXT("Driver version is invalid.")
+#define M_ERR_40_SUBMSG_2        NO_SUBMSG
+#define M_ERR_40_SUBMSG_3        NO_SUBMSG
+#define M_ERR_40_SUBMSG_4        NO_SUBMSG
+#define M_ERR_40_SUBMSG_5        NO_SUBMSG
+#define M_ERR_40_SUBMSG_6        NO_SUBMSG
+#define M_ERR_40_SUBMSG_7        NO_SUBMSG
+#define M_ERR_40_SUBMSG_8        NO_SUBMSG
+#define M_ERR_40_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_3  41L
+#define M_ERR_41_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_41_SUBMSG_1        MIL_TEXT("Parameter 1 not in supported list.")
+#define M_ERR_41_SUBMSG_2        MIL_TEXT("Parameter 2 not in supported list.")
+#define M_ERR_41_SUBMSG_3        MIL_TEXT("Parameter 3 not in supported list.")
+#define M_ERR_41_SUBMSG_4        MIL_TEXT("Parameter 4 not in supported list.")
+#define M_ERR_41_SUBMSG_5        MIL_TEXT("Parameter 5 not in supported list.")
+#define M_ERR_41_SUBMSG_6        MIL_TEXT("Parameter 6 not in supported list.")
+#define M_ERR_41_SUBMSG_7        MIL_TEXT("Parameter 7 not in supported list.")
+#define M_ERR_41_SUBMSG_8        MIL_TEXT("Parameter 8 not in supported list.")
+#define M_ERR_41_SUBMSG_9        MIL_TEXT("Parameter 9 not in supported list.")
+
+#define M_ALLOC_ERROR_2          42L
+#define M_ERR_42_MSG             MIL_TEXT("Allocation error.")
+#define M_ERR_42_SUBMSG_1        MIL_TEXT("Not enough host memory to do the operation.")
+#define M_ERR_42_SUBMSG_2        MIL_TEXT("Invalid attribute, M_GRAB not supported on host.")
+#define M_ERR_42_SUBMSG_3        MIL_TEXT("Incompatible buffer dimensions, SizeBand, SizeY and (SizeX x SizeBit) must be identical.")
+#define M_ERR_42_SUBMSG_4        MIL_TEXT("Unable to communicate with MIL Memory manager.")
+#define M_ERR_42_SUBMSG_5        MIL_TEXT("The requested memory size is invalid.")
+#define M_ERR_42_SUBMSG_6        MIL_TEXT("Impossible to make a band child of a compressed buffer.")
+#define M_ERR_42_SUBMSG_7        MIL_TEXT("You require a fast overscan buffer, but the M_ALLOCATION_OVERSCAN_SIZE is 0.")
+#define M_ERR_42_SUBMSG_8        MIL_TEXT("Memory already allocated.")
+#define M_ERR_42_SUBMSG_9        MIL_TEXT("The MIL_ID table is full. Make sure you do not have a resource leak.")
+
+#define M_TIMER_ERROR            43L
+#define M_ERR_43_MSG             MIL_TEXT("Timer error.")
+#define M_ERR_43_SUBMSG_1        MIL_TEXT("Invalid ControlType specified.")
+#define M_ERR_43_SUBMSG_2        MIL_TEXT("TimePtr parameter cannot be null.")
+#define M_ERR_43_SUBMSG_3        MIL_TEXT("Installed hardware does not support a high-resolution performance counter.")
+#define M_ERR_43_SUBMSG_4        MIL_TEXT("Timer must be reset prior to a read.")
+#define M_ERR_43_SUBMSG_5        MIL_TEXT("Does not support remote application.")
+#define M_ERR_43_SUBMSG_6        MIL_TEXT("M_TRACE timer cannot be reset.")
+#define M_ERR_43_SUBMSG_7        NO_SUBMSG
+#define M_ERR_43_SUBMSG_8        NO_SUBMSG
+#define M_ERR_43_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_4  44L
+#define M_ERR_44_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_44_SUBMSG_1        MIL_TEXT("The valid data formats for binary buffers are M_SINGLE_BAND and M_PLANAR.")
+#define M_ERR_44_SUBMSG_2        MIL_TEXT("Operation not supported on float buffers.")
+#define M_ERR_44_SUBMSG_3        MIL_TEXT("Destination buffer is binary, MaskValue must be equal to 0 or 1.")
+#define M_ERR_44_SUBMSG_4        MIL_TEXT("Image buffer must be monochrome for this operation.")
+#define M_ERR_44_SUBMSG_5        MIL_TEXT("Source buffers must be of the same type.")
+#define M_ERR_44_SUBMSG_6        MIL_TEXT("Integer source buffers must be unsigned.")
+#define M_ERR_44_SUBMSG_7        MIL_TEXT("Operation not supported with binary buffers.")
+#define M_ERR_44_SUBMSG_8        MIL_TEXT("Source buffers must be of the same pixel depth.")
+#define M_ERR_44_SUBMSG_9        MIL_TEXT("The width and height of the source and destination buffers must be a power of 2.")
+
+#define M_INVALID_PARAM_ERROR_5  45L
+#define M_ERR_45_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_45_SUBMSG_1        MIL_TEXT("The number of bands is not valid.")
+#define M_ERR_45_SUBMSG_2        MIL_TEXT("The X dimension is not valid.")
+#define M_ERR_45_SUBMSG_3        MIL_TEXT("The Y dimension is not valid.")
+#define M_ERR_45_SUBMSG_4        MIL_TEXT("The pixel depth is not valid.")
+#define M_ERR_45_SUBMSG_5        MIL_TEXT("The buffer attributes are not valid.")
+#define M_ERR_45_SUBMSG_6        MIL_TEXT("The data type is not valid.")
+#define M_ERR_45_SUBMSG_7        MIL_TEXT("Invalid FFT type specified.")
+#define M_ERR_45_SUBMSG_8        MIL_TEXT("Invalid operation mode specified.")
+#define M_ERR_45_SUBMSG_9        MIL_TEXT("Invalid transform specified.")
+
+#define M_INVALID_PARAM_ERROR_6  46L
+#define M_ERR_46_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_46_SUBMSG_1        MIL_TEXT("Operation not supported on 32-bit buffers.")
+#define M_ERR_46_SUBMSG_2        MIL_TEXT("Invalid minimal variation specified.")
+#define M_ERR_46_SUBMSG_3        MIL_TEXT("Invalid combination of control flag constants.")
+#define M_ERR_46_SUBMSG_4        MIL_TEXT("A marker image or a minimal variation must be supplied.")
+#define M_ERR_46_SUBMSG_5        MIL_TEXT("Value out of range.")
+#define M_ERR_46_SUBMSG_6        MIL_TEXT("Invalid mode specified.")
+#define M_ERR_46_SUBMSG_7        MIL_TEXT("The pointer should not be null.")
+#define M_ERR_46_SUBMSG_8        MIL_TEXT("The buffer must be a M_IMAGE + M_COMPRESS buffer.")
+#define M_ERR_46_SUBMSG_9        MIL_TEXT("Invalid compression type.")
+
+#define M_INVALID_PARAM_ERROR_7  47L
+#define M_ERR_47_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_47_SUBMSG_1        MIL_TEXT("Cannot change the compression type of a single band.")
+#define M_ERR_47_SUBMSG_2        MIL_TEXT("Invalid ControlFlag value.")
+#define M_ERR_47_SUBMSG_3        MIL_TEXT("The MIL_INT64 pointer cannot be null.")
+#define M_ERR_47_SUBMSG_4        MIL_TEXT("Invalid source buffers.")
+#define M_ERR_47_SUBMSG_5        MIL_TEXT("Invalid Q factor value.")
+#define M_ERR_47_SUBMSG_6        MIL_TEXT("Invalid destination buffers.")
+#define M_ERR_47_SUBMSG_7        MIL_TEXT("The second LUT must be M_NULL for M_WARP_POLYNOMIAL operation mode.")
+#define M_ERR_47_SUBMSG_8        MIL_TEXT("The angle range must be less than 360 degrees.")
+#define M_ERR_47_SUBMSG_9        MIL_TEXT("Invalid WarpParam1Id Size or Type.")
+
+#define M_INVALID_PARAM_ERROR_8  48L
+#define M_ERR_48_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_48_SUBMSG_1        MIL_TEXT("Source buffers must be of the same type and pixel depth.")
+#define M_ERR_48_SUBMSG_2        MIL_TEXT("Destination buffers must be of the same type and pixel depth.")
+#define M_ERR_48_SUBMSG_3        MIL_TEXT("Angle value must be between -360 and 360.")
+#define M_ERR_48_SUBMSG_4        MIL_TEXT("Polar conversion only supported on float buffers.")
+#define M_ERR_48_SUBMSG_5        MIL_TEXT("This type of conversion requires a 1 band destination buffer.")
+#define M_ERR_48_SUBMSG_6        MIL_TEXT("Invalid transform type.")
+#define M_ERR_48_SUBMSG_7        MIL_TEXT("The M_NORMALIZE flag must be used with this transform.")
+#define M_ERR_48_SUBMSG_8        MIL_TEXT("This type of conversion requires a 1 band source buffer.")
+#define M_ERR_48_SUBMSG_9        MIL_TEXT("Invalid number of bytes. Use zero or a positive value.")
+
+#define M_JPEG_ERROR_2           49L
+#define M_ERR_49_MSG             MIL_TEXT("JPEG handler general error.")
+#define M_ERR_49_SUBMSG_1        MIL_TEXT("Vertical sampling factor of more than 4 not supported.")
+#define M_ERR_49_SUBMSG_2        MIL_TEXT("MIL supports only 1-band and 3-band buffers.")
+#define M_ERR_49_SUBMSG_3        MIL_TEXT("MIL only supports sequential baseline DCT JPEG and lossless JPEG files.")
+#define M_ERR_49_SUBMSG_4        MIL_TEXT("Point transform not supported.")
+#define M_ERR_49_SUBMSG_5        MIL_TEXT("Reading beyond the available data.")
+#define M_ERR_49_SUBMSG_6        MIL_TEXT("The EOI marker is before the end of the file.")
+#define M_ERR_49_SUBMSG_7        MIL_TEXT("16-bit quantization table not supported.")
+#define M_ERR_49_SUBMSG_8        MIL_TEXT("Horizontal sampling factor of more than 4 not supported.")
+#define M_ERR_49_SUBMSG_9        MIL_TEXT("Sampling factors do not correspond to any supported format.")
+
+#define M_INVALID_PARAM_ERROR_9  50L
+#define M_ERR_50_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_50_SUBMSG_1        MIL_TEXT("Inquire type not supported.")
+#define M_ERR_50_SUBMSG_2        MIL_TEXT("The look up table must have a Y size of 1.")
+#define M_ERR_50_SUBMSG_3        MIL_TEXT("The size of the buffer is too large.")
+#define M_ERR_50_SUBMSG_4        MIL_TEXT("The destination buffer cannot be 1-bit.")
+#define M_ERR_50_SUBMSG_5        MIL_TEXT("SaturationSizeBit must be 1, 8, 16 or 32.")
+#define M_ERR_50_SUBMSG_6        MIL_TEXT("SaturationType must be M_SIGNED, M_UNSIGNED or M_FLOAT.")
+#define M_ERR_50_SUBMSG_7        MIL_TEXT("Invalid combination of SaturationType and SizeBit.")
+#define M_ERR_50_SUBMSG_8        MIL_TEXT("YUV buffers must be M_UNSIGNED.")
+#define M_ERR_50_SUBMSG_9        MIL_TEXT("The file name length must be greater than 0.")
+
+#define M_AVI_FILE_ERROR         51L
+#define M_ERR_51_MSG             MIL_TEXT("AVI file error.")
+#define M_ERR_51_SUBMSG_1        MIL_TEXT("The frame to write contains no data.")
+#define M_ERR_51_SUBMSG_2        MIL_TEXT("Error writing into the AVI file.")
+#define M_ERR_51_SUBMSG_3        MIL_TEXT("File format not supported.")
+#define M_ERR_51_SUBMSG_4        MIL_TEXT("The file format and image format are incompatible.")
+#define M_ERR_51_SUBMSG_5        MIL_TEXT("Error opening the AVI file.")
+#define M_ERR_51_SUBMSG_6        MIL_TEXT("Invalid file format.")
+#define M_ERR_51_SUBMSG_7        MIL_TEXT("Cannot write the frame. The index is full.")
+#define M_ERR_51_SUBMSG_8        MIL_TEXT("File format not supported. Cannot import MPEG4 sequences.")
+#define M_ERR_51_SUBMSG_9        MIL_TEXT("File format not supported. Cannot import H264 sequences.")
+
+#define M_DMA_ERROR              52L
+#define M_ERR_52_MSG             MIL_TEXT("Error using Matrox Dma service.")
+#define M_ERR_52_SUBMSG_1        MIL_TEXT("Cannot open the Matrox Dma manager.")
+#define M_ERR_52_SUBMSG_2        MIL_TEXT("Cannot access PCI data.")
+#define M_ERR_52_SUBMSG_3        MIL_TEXT("Unsupported control/inquire")
+#define M_ERR_52_SUBMSG_4        MIL_TEXT("Cannot communicate with Memory manager. Check if it is installed and started.")
+#define M_ERR_52_SUBMSG_5        MIL_TEXT("Cannot access hook information.")
+#define M_ERR_52_SUBMSG_6        MIL_TEXT("Can only perform this operation on the Default Host.")
+#define M_ERR_52_SUBMSG_7        MIL_TEXT("Unable to recover info from Dma pool.")
+#define M_ERR_52_SUBMSG_8        MIL_TEXT("Unsupported control flag.") // Error logged when using M_LOW_4GB_MEMORY or M_HIGH_4GB_MEMORY
+#define M_ERR_52_SUBMSG_9        MIL_TEXT("Could not enable or disable the Write-combining feature.")
+
+#define M_BMP_ERROR_3            53L
+#define M_ERR_53_MSG             MIL_TEXT("BMP handler general error.")
+#define M_ERR_53_SUBMSG_1        MIL_TEXT("MIL does not support a bit count of zero with BMP files.")
+#define M_ERR_53_SUBMSG_2        MIL_TEXT("MIL does not support 1-bit BMP files.")
+#define M_ERR_53_SUBMSG_3        MIL_TEXT("MIL does not support 4-bit BMP files.")
+#define M_ERR_53_SUBMSG_4        MIL_TEXT("Run Length Encoding ( RLE ) compression not supported.")
+#define M_ERR_53_SUBMSG_5        NO_SUBMSG
+#define M_ERR_53_SUBMSG_6        NO_SUBMSG
+#define M_ERR_53_SUBMSG_7        NO_SUBMSG
+#define M_ERR_53_SUBMSG_8        NO_SUBMSG
+#define M_ERR_53_SUBMSG_9        NO_SUBMSG
+
+#define M_JPEG_ERROR_3           54L
+#define M_ERR_54_MSG             MIL_TEXT("JPEG handler general error.")
+#define M_ERR_54_SUBMSG_1        MIL_TEXT("Invalid JPEG data.")
+#define M_ERR_54_SUBMSG_2        MIL_TEXT("Invalid data for a MTRX specific marker.")
+#define M_ERR_54_SUBMSG_3        MIL_TEXT("Extended sequential DCT not supported in MIL.")
+#define M_ERR_54_SUBMSG_4        MIL_TEXT("Progressive DCT not supported in MIL.")
+#define M_ERR_54_SUBMSG_5        MIL_TEXT("YUV9 packed images not supported.")
+#define M_ERR_54_SUBMSG_6        MIL_TEXT("YUV12 packed images not supported.")
+#define M_ERR_54_SUBMSG_7        MIL_TEXT("YUV24 packed images not supported.")
+#define M_ERR_54_SUBMSG_8        MIL_TEXT("Invalid data. EOI marker not found.")
+#define M_ERR_54_SUBMSG_9        MIL_TEXT("Cannot create or open file in write mode.")
+  
+#define M_ALLOC_ERROR_3          55L
+#define M_ERR_55_MSG             MIL_TEXT("Allocation error.")
+#define M_ERR_55_SUBMSG_1        MIL_TEXT("No pitch control flag used in create.")
+#define M_ERR_55_SUBMSG_2        MIL_TEXT("Cannot create a buffer with a physical address.")
+#define M_ERR_55_SUBMSG_3        MIL_TEXT("Cannot allocate a M_COMPRESS buffer with the M_DISP attribute.")
+#define M_ERR_55_SUBMSG_4        MIL_TEXT("Cannot allocate a M_COMPRESS buffer with the M_SIGNED or M_FLOAT type.")
+#define M_ERR_55_SUBMSG_5        MIL_TEXT("Interlaced buffers should have a height of at least 2.")
+#define M_ERR_55_SUBMSG_6        MIL_TEXT("Requested system DLL cannot be loaded.")
+#define M_ERR_55_SUBMSG_7        MIL_TEXT("MIL DLLs not found.")
+#define M_ERR_55_SUBMSG_8        MIL_TEXT("Not enough non-paged memory to allocate the buffer.")
+#define M_ERR_55_SUBMSG_9        MIL_TEXT("Not enough non-paged memory for a MIL CE allocation.\nContinuing the application may cause abnormal behavior!")
+
+#define M_LIMITATION_ERROR       56L
+#define M_ERR_56_MSG             MIL_TEXT("Limitation error.")
+#define M_ERR_56_SUBMSG_1        MIL_TEXT("This operation cannot be performed on a section of a compressed buffer.")
+#define M_ERR_56_SUBMSG_2        MIL_TEXT("This operation cannot be performed on a child of a compressed buffer.")
+#define M_ERR_56_SUBMSG_3        MIL_TEXT("This operation cannot be performed on a section of a YUV buffer.")
+#define M_ERR_56_SUBMSG_4        MIL_TEXT("This operation cannot be performed on a child of a YUV buffer.")
+#define M_ERR_56_SUBMSG_5        MIL_TEXT("This operation cannot be performed on a section of an M_PACKED buffer.")
+#define M_ERR_56_SUBMSG_6        MIL_TEXT("This operation cannot be performed on a child of an M_PACKED buffer.")
+#define M_ERR_56_SUBMSG_7        MIL_TEXT("This operation cannot be performed on a section of a M_PLANAR buffer.")
+#define M_ERR_56_SUBMSG_8        MIL_TEXT("This operation cannot be performed on a child of a M_PLANAR buffer.")
+#define M_ERR_56_SUBMSG_9        MIL_TEXT("This operation can only be performed on a compressed buffer.")
+
+#define M_OPERATION_ERROR_2      57L
+#define M_ERR_57_MSG             MIL_TEXT("Operation error.")
+#define M_ERR_57_SUBMSG_1        MIL_TEXT("Pitch must be a multiple of 4 pixels.")
+#define M_ERR_57_SUBMSG_2        MIL_TEXT("The default pitch byte value is incompatible with this type of buffer.")
+#define M_ERR_57_SUBMSG_3        MIL_TEXT("Operation not supported on remote systems.")
+#define M_ERR_57_SUBMSG_4        MIL_TEXT("Not enough non-paged memory to perform the operation on a remote system.")
+#define M_ERR_57_SUBMSG_5        MIL_TEXT("Not enough remote memory to perform the operation on a remote system.")
+#define M_ERR_57_SUBMSG_6        MIL_TEXT("Operation not supported on this system.")
+#define M_ERR_57_SUBMSG_7        MIL_TEXT("Cannot allocate event.")
+#define M_ERR_57_SUBMSG_8        MIL_TEXT("Cannot create event.")
+#define M_ERR_57_SUBMSG_9        MIL_TEXT("Buffer low level handle is invalid.")
+
+#define M_LICENSING_ERROR        58L
+#define M_ERR_58_MSG             MIL_TEXT("Licensing error.")
+#define M_ERR_58_SUBMSG_1        MIL_TEXT("A processing function was used with MIL-Lite.")
+#define M_ERR_58_SUBMSG_2        MIL_TEXT("License watchdog timed out.")
+#define M_ERR_58_SUBMSG_3        MIL_TEXT("A module was used without a valid license.")
+#define M_ERR_58_SUBMSG_4        MIL_TEXT("Debugging is not allowed with a run-time license. You must have a development license.")
+#define M_ERR_58_SUBMSG_5        MIL_TEXT("Your license does not allow the allocation of JPEG buffers.")
+#define M_ERR_58_SUBMSG_6        MIL_TEXT("Your license does not allow the allocation of JPEG2000 buffers.")
+#define M_ERR_58_SUBMSG_7        MIL_TEXT("A module not permitted by MappControl(M_LICENSE_PERMIT_MODULES) was used.")
+#define M_ERR_58_SUBMSG_8        MIL_TEXT("This Early Access version of MIL has expired. Please contact your Matrox representative to obtain an updated version.")
+#define M_ERR_58_SUBMSG_9        MIL_TEXT("The validity period of your MIL license is over. Please contact your Matrox representative to obtain a new license.")
+
+#define M_AVI_FILE_ERROR_2       59L
+#define M_ERR_59_MSG             MIL_TEXT("AVI file error.")
+#define M_ERR_59_SUBMSG_1        NO_SUBMSG
+#define M_ERR_59_SUBMSG_2        NO_SUBMSG
+#define M_ERR_59_SUBMSG_3        MIL_TEXT("The file is still used by MbufExportSequence.")
+#define M_ERR_59_SUBMSG_4        MIL_TEXT("The file is still used by MbufImportSequence.")
+#define M_ERR_59_SUBMSG_5        MIL_TEXT("Cannot write frame. The AVI file size limit has been reached.")
+#define M_ERR_59_SUBMSG_6        MIL_TEXT("Impossible to write into a closed file.")
+#define M_ERR_59_SUBMSG_7        MIL_TEXT("Error creating AVI stream.")
+#define M_ERR_59_SUBMSG_8        MIL_TEXT("The file is already open.")
+#define M_ERR_59_SUBMSG_9        MIL_TEXT("Impossible to read from a closed file.")
+
+#define M_JPEG_COMPRESS_ERROR_3  60L
+#define M_ERR_60_MSG             MIL_TEXT("JPEG compression error.")
+#define M_ERR_60_SUBMSG_1        MIL_TEXT("Cannot allocate 3-band M_JPEG_LOSSLESS_INTERLACED buffers.")
+#define M_ERR_60_SUBMSG_2        MIL_TEXT("In lossless, the RestartInterval multiplied by the number of \ncolumns in the buffer must fit in 16 bits (smaller than 65536).")
+#define M_ERR_60_SUBMSG_3        MIL_TEXT("The restart interval must fit in 16 bits (smaller than 65536).")
+#define M_ERR_60_SUBMSG_4        MIL_TEXT("Only JPEG lossless buffers can have predictors.")
+#define M_ERR_60_SUBMSG_5        MIL_TEXT("Luminance parameters are only allowed for YUV buffers.")
+#define M_ERR_60_SUBMSG_6        MIL_TEXT("Chrominance parameters are only allowed for YUV buffers.")
+#define M_ERR_60_SUBMSG_7        MIL_TEXT("AC tables and quantization parameters are only allowed \nfor JPEG lossy buffers.")
+#define M_ERR_60_SUBMSG_8        MIL_TEXT("For YUV buffers, specific luminance or chrominance \nflags must be used.")
+#define M_ERR_60_SUBMSG_9        MIL_TEXT("Field size is only applicable to interlaced buffers.")
+
+#define M_AVI_FILE_ERROR_3       61L
+#define M_ERR_61_MSG             MIL_TEXT("AVI file error.")
+#define M_ERR_61_SUBMSG_1        MIL_TEXT("Error reading from the AVI file.")
+#define M_ERR_61_SUBMSG_2        MIL_TEXT("Cannot read after the last frame.")
+#define M_ERR_61_SUBMSG_3        NO_SUBMSG
+#define M_ERR_61_SUBMSG_4        MIL_TEXT("Images must have a width greater than or equal to 16.")
+#define M_ERR_61_SUBMSG_5        MIL_TEXT("Images must have a height greater than or equal to 8.")
+#define M_ERR_61_SUBMSG_6        NO_SUBMSG
+#define M_ERR_61_SUBMSG_7        MIL_TEXT("The frame rate has not been set.")
+#define M_ERR_61_SUBMSG_8        NO_SUBMSG
+#define M_ERR_61_SUBMSG_9        MIL_TEXT("The AVI file size exceeds the supported limit.")
+
+#define M_USER_BIT_CONFIG_ERROR  62L         // These 2 following message are use for user bits of 4sightII
+#define M_ERR_62_MSG             NO_MSG      // Now the error message are move the the milmtxapi.dll
+#define M_ERR_62_SUBMSG_1        NO_SUBMSG
+#define M_ERR_62_SUBMSG_2        NO_SUBMSG
+#define M_ERR_62_SUBMSG_3        NO_SUBMSG
+#define M_ERR_62_SUBMSG_4        NO_SUBMSG
+#define M_ERR_62_SUBMSG_5        NO_SUBMSG
+#define M_ERR_62_SUBMSG_6        NO_SUBMSG
+#define M_ERR_62_SUBMSG_7        NO_SUBMSG
+#define M_ERR_62_SUBMSG_8        NO_SUBMSG
+#define M_ERR_62_SUBMSG_9        NO_SUBMSG
+
+#define M_USER_BIT_ERROR         63L
+#define M_ERR_63_MSG             NO_MSG
+#define M_ERR_63_SUBMSG_1        NO_SUBMSG
+#define M_ERR_63_SUBMSG_2        NO_SUBMSG
+#define M_ERR_63_SUBMSG_3        NO_SUBMSG
+#define M_ERR_63_SUBMSG_4        NO_SUBMSG
+#define M_ERR_63_SUBMSG_5        NO_SUBMSG
+#define M_ERR_63_SUBMSG_6        NO_SUBMSG
+#define M_ERR_63_SUBMSG_7        NO_SUBMSG
+#define M_ERR_63_SUBMSG_8        NO_SUBMSG
+#define M_ERR_63_SUBMSG_9        NO_SUBMSG
+
+#define M_TIFF_ERROR_3           64L
+#define M_ERR_64_MSG             MIL_TEXT("TIFF File access error.")
+#define M_ERR_64_SUBMSG_1        MIL_TEXT("Error recording tag.")
+#define M_ERR_64_SUBMSG_2        MIL_TEXT("LZW compression not supported in multi strip TIFF files.")
+#define M_ERR_64_SUBMSG_3        MIL_TEXT("Maximum TIFF file size exceeded")
+#define M_ERR_64_SUBMSG_4        MIL_TEXT("BitsPerSample image must be 1 for CCITT 3/4 compression.")
+#define M_ERR_64_SUBMSG_5        MIL_TEXT("Compression type not supported.")
+#define M_ERR_64_SUBMSG_6        MIL_TEXT("Image Format not supported.")
+#define M_ERR_64_SUBMSG_7        MIL_TEXT("Cannot read tile data.")
+#define M_ERR_64_SUBMSG_8        MIL_TEXT("Cannot read strip data.")
+#define M_ERR_64_SUBMSG_9        MIL_TEXT("Cannot write strip data.")
+
+#define M_MIL_FILE_ERROR_4       65L
+#define M_ERR_65_MSG             MIL_TEXT("MIL File access error.")
+#define M_ERR_65_SUBMSG_1        MIL_TEXT("Error recording tag.")
+#define M_ERR_65_SUBMSG_2        MIL_TEXT("LZW compression not supported in multi strip MIL files.")
+#define M_ERR_65_SUBMSG_3        MIL_TEXT("Error when closing file. Check disk space.")
+#define M_ERR_65_SUBMSG_4        MIL_TEXT("Unable to save: object is too big.")
+#define M_ERR_65_SUBMSG_5        MIL_TEXT("Stream is corrupt or has been generated with a newer version of MIL.")
+#define M_ERR_65_SUBMSG_6        MIL_TEXT("The specified version is too old to support compression.")
+#define M_ERR_65_SUBMSG_7        NO_SUBMSG
+#define M_ERR_65_SUBMSG_8        NO_SUBMSG
+#define M_ERR_65_SUBMSG_9        NO_SUBMSG
+
+#define M_JPEG_ERROR_4           66L
+#define M_ERR_66_MSG             MIL_TEXT("JPEG handler general error.")
+#define M_ERR_66_SUBMSG_1        MIL_TEXT("Second field of interlaced image not found.")
+#define M_ERR_66_SUBMSG_2        MIL_TEXT("Buffer width is greater than the maximum supported.")
+#define M_ERR_66_SUBMSG_3        MIL_TEXT("Buffer height is greater than the maximum supported.")
+#define M_ERR_66_SUBMSG_4        MIL_TEXT("Error writing JPEG file.")
+#define M_ERR_66_SUBMSG_5        NO_SUBMSG
+#define M_ERR_66_SUBMSG_6        NO_SUBMSG
+#define M_ERR_66_SUBMSG_7        NO_SUBMSG
+#define M_ERR_66_SUBMSG_8        NO_SUBMSG
+#define M_ERR_66_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_10 67L
+#define M_ERR_67_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_67_SUBMSG_1        MIL_TEXT("The width and height of the source and destination buffers must be a multiple of 8.")
+#define M_ERR_67_SUBMSG_2        MIL_TEXT("Operation not supported on 16 bits buffer.")
+#define M_ERR_67_SUBMSG_3        MIL_TEXT("Size of image buffers must be greater than or equal to the size of the kernel.")
+#define M_ERR_67_SUBMSG_4        MIL_TEXT("Invalid data formats.")
+#define M_ERR_67_SUBMSG_5        MIL_TEXT("Operation not supported on 3 bands planar buffers.")
+#define M_ERR_67_SUBMSG_6        MIL_TEXT("Float addresses must be a multiple of 4.")
+#define M_ERR_67_SUBMSG_7        MIL_TEXT("This operation is only supported on the host.")
+#define M_ERR_67_SUBMSG_8        MIL_TEXT("Cannot create an M_NO_MAP buffer with null pointers.")
+#define M_ERR_67_SUBMSG_9        MIL_TEXT("Can only create a M_NO_MAP buffer with a physical address.")
+
+#define M_J2K_ERROR_1            68L
+#define M_ERR_68_MSG             MIL_TEXT("JPEG2000 handler general error.")
+#define M_ERR_68_SUBMSG_1        MIL_TEXT("Error closing JPEG2000 file.")
+#define M_ERR_68_SUBMSG_2        MIL_TEXT("Unable to allocate sufficient memory.")
+#define M_ERR_68_SUBMSG_3        MIL_TEXT("Cannot create or open file in write mode.")
+#define M_ERR_68_SUBMSG_4        MIL_TEXT("Error opening JPEG2000 file.")
+#define M_ERR_68_SUBMSG_5        MIL_TEXT("Error writing JPEG2000 file.")
+#define M_ERR_68_SUBMSG_6        NO_SUBMSG
+#define M_ERR_68_SUBMSG_7        NO_SUBMSG
+#define M_ERR_68_SUBMSG_8        NO_SUBMSG
+#define M_ERR_68_SUBMSG_9        NO_SUBMSG
+
+#define M_J2K_ERROR_2            69L
+#define M_ERR_69_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_69_SUBMSG_1        MIL_TEXT("Invalid JPEG2000 data.")
+#define M_ERR_69_SUBMSG_2        MIL_TEXT("Unexpected marker in the JPEG2000 image.")
+#define M_ERR_69_SUBMSG_3        MIL_TEXT("Component index out of range.")
+#define M_ERR_69_SUBMSG_4        MIL_TEXT("MIL supports only 1-band and 3-band buffers.")
+#define M_ERR_69_SUBMSG_5        MIL_TEXT("All components must have the same bit depth.")
+#define M_ERR_69_SUBMSG_6        MIL_TEXT("Unsupported bit depth.")
+#define M_ERR_69_SUBMSG_7        MIL_TEXT("Invalid subsampling factors.")
+#define M_ERR_69_SUBMSG_8        MIL_TEXT("Scalar implicit quantization not supported.")
+#define M_ERR_69_SUBMSG_9        MIL_TEXT("Unsupported coding style.")
+
+#define M_LICENSE_ERROR_2        70L
+#define M_ERR_70_MSG             MIL_TEXT("License error.")
+#define M_ERR_70_SUBMSG_1        MIL_TEXT("No valid license found (1)")
+#define M_ERR_70_SUBMSG_2        MIL_TEXT("No valid license found (2)")
+#define M_ERR_70_SUBMSG_3        MIL_TEXT("No valid license found (3)")
+#define M_ERR_70_SUBMSG_4        MIL_TEXT("PC clock has been altered")
+#define M_ERR_70_SUBMSG_5        NO_SUBMSG
+#define M_ERR_70_SUBMSG_6        MIL_TEXT("No valid license found (6)")
+#define M_ERR_70_SUBMSG_7        NO_SUBMSG
+#define M_ERR_70_SUBMSG_8        NO_SUBMSG
+#define M_ERR_70_SUBMSG_9        NO_SUBMSG
+
+#define M_J2K_ERROR_3            71L
+#define M_ERR_71_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_71_SUBMSG_1        MIL_TEXT("Unsupported progression order.")
+#define M_ERR_71_SUBMSG_2        MIL_TEXT("Multi-layer images are not supported.")
+#define M_ERR_71_SUBMSG_3        MIL_TEXT("Unsupported compression setting.")
+#define M_ERR_71_SUBMSG_4        MIL_TEXT("This marker is not supported by MIL yet.")
+#define M_ERR_71_SUBMSG_5        MIL_TEXT("Wavelet type cannot be changed.")
+#define M_ERR_71_SUBMSG_6        MIL_TEXT("Mismatched field settings.")
+#define M_ERR_71_SUBMSG_7        MIL_TEXT("Not enough user memory to do the operation.")
+#define M_ERR_71_SUBMSG_8        MIL_TEXT("Invalid number of decomposition levels.")
+#define M_ERR_71_SUBMSG_9        MIL_TEXT("Invalid number of wavelet sub-bands.")
+
+#define M_J2K_ERROR_4            72L
+#define M_ERR_72_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_72_SUBMSG_1        MIL_TEXT("The target size must be a positive number of bytes.")
+#define M_ERR_72_SUBMSG_2        MIL_TEXT("Target size is only allowed in lossy modes.")
+#define M_ERR_72_SUBMSG_3        MIL_TEXT("Quantization tables are applicable to lossy buffers only.")
+#define M_ERR_72_SUBMSG_4        MIL_TEXT("The Q factor is only valid with lossy buffers.")
+#define M_ERR_72_SUBMSG_5        MIL_TEXT("Wrong number of entries in the quantization table.")
+#define M_ERR_72_SUBMSG_6        MIL_TEXT("Invalid MIL_ID for the quantization table.")
+#define M_ERR_72_SUBMSG_7        MIL_TEXT("The quantization table must be one-band, 32-bit floating-point, one-dimensional, and M_ARRAY.")
+#define M_ERR_72_SUBMSG_8        MIL_TEXT("Valid Q factor values are between 1 and 99 (both inclusive).")
+#define M_ERR_72_SUBMSG_9        MIL_TEXT("Unexpected number of tile-parts.")
+
+#define M_J2K_ERROR_5            73L
+#define M_ERR_73_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_73_SUBMSG_1        MIL_TEXT("Corrupted JPEG2000 data.")
+#define M_ERR_73_SUBMSG_2        MIL_TEXT("Quantization coefficient out of range.")
+#define M_ERR_73_SUBMSG_3        MIL_TEXT("Luminance and chrominance parameters are only allowed for YUV buffers.")
+#define M_ERR_73_SUBMSG_4        MIL_TEXT("The number of reserved bytes must be greater than or equal to 0.")
+#define M_ERR_73_SUBMSG_5        MIL_TEXT("Tile offsets are out of range.")
+#define M_ERR_73_SUBMSG_6        MIL_TEXT("Image offsets are out of range.")
+#define M_ERR_73_SUBMSG_7        MIL_TEXT("Only one COC marker by band is allowed.")
+#define M_ERR_73_SUBMSG_8        MIL_TEXT("Only one QCC marker by band is allowed.")
+#define M_ERR_73_SUBMSG_9        MIL_TEXT("Invalid size bit.")
+
+#define M_FUNC_CALL_ERROR        74L
+#define M_ERR_74_MSG             MIL_TEXT("Function call error.")
+#define M_ERR_74_SUBMSG_1        MIL_TEXT("Calibration not supported on remote systems.")
+#define M_ERR_74_SUBMSG_2        MIL_TEXT("Unable to load the User Slave DLL. Please make sure it is in the path.")
+#define M_ERR_74_SUBMSG_3        MIL_TEXT("Slave function not found in the DLL.")
+#define M_ERR_74_SUBMSG_4        MIL_TEXT("Cannot execute because two MIL objects reside in two different workspaces/platforms and compensation cannot be done.") //TBM MIL 8
+#define M_ERR_74_SUBMSG_5        MIL_TEXT("Slave module is not in the user module table.")
+#define M_ERR_74_SUBMSG_6        MIL_TEXT("Slave function is not in the user function table.")
+#define M_ERR_74_SUBMSG_7        MIL_TEXT("No slave function pointer specified.")
+#define M_ERR_74_SUBMSG_8        MIL_TEXT("No slave function in the internal function table.")
+#define M_ERR_74_SUBMSG_9        MIL_TEXT("The function table already contains a function pointer.\nCheck that you have not given the same opcode to 2 different functions.")
+
+#define M_OPERATION_ERROR_3      75L
+#define M_ERR_75_MSG             MIL_TEXT("Operation error.")
+#define M_ERR_75_SUBMSG_1        MIL_TEXT("Cannot free internally allocated objects.")
+#define M_ERR_75_SUBMSG_2        MIL_TEXT("SystemId and ObjectType are incompatible.") // MthrAlloc
+#define M_ERR_75_SUBMSG_3        MIL_TEXT("Thread or event id is not compatible with the control flag specified.") // MthrControl
+#define M_ERR_75_SUBMSG_4        MIL_TEXT("Cannot perform operation with this thread or event id.")
+#define M_ERR_75_SUBMSG_5        MIL_TEXT("Cannot perform operation on unmapped buffer(s).")
+#define M_ERR_75_SUBMSG_6        MIL_TEXT("Cannot map buffers.")
+#define M_ERR_75_SUBMSG_7        MIL_TEXT("Buffer must have M_DIRECTX in its format.")
+#define M_ERR_75_SUBMSG_8        MIL_TEXT("Cannot map 2 buffers of the same family at the same time.")
+#define M_ERR_75_SUBMSG_9        MIL_TEXT("Buffer cannot have child buffers.")
+
+#define M_BUF_TRANSFER_ERROR     76L
+#define M_ERR_76_MSG             MIL_TEXT("Transfer Error.")
+#define M_ERR_76_SUBMSG_1        MIL_TEXT("Unknown transfer function.")
+#define M_ERR_76_SUBMSG_2        MIL_TEXT("Transfer method not supported for this transfer function.")
+#define M_ERR_76_SUBMSG_3        MIL_TEXT("Transfer cannot be done asynchronously.")
+#define M_ERR_76_SUBMSG_4        MIL_TEXT("Scaling not supported by this transfer function.")
+#define M_ERR_76_SUBMSG_5        MIL_TEXT("No transfer made.")
+#define M_ERR_76_SUBMSG_6        MIL_TEXT("MTX0 transfer only supported on MTX0 buffers.")
+#define M_ERR_76_SUBMSG_7        MIL_TEXT("MTX0 not supported in this environment.")
+#define M_ERR_76_SUBMSG_8        MIL_TEXT("Illegal null MIL_ID passed to MbufTransfer.")
+#define M_ERR_76_SUBMSG_9        MIL_TEXT("Invalid Transfer type.")
+
+#define M_DISP_SERVICE_ERROR     77L
+#define M_ERR_77_MSG             MIL_TEXT("Display service error.")
+#define M_ERR_77_SUBMSG_1        MIL_TEXT("Cannot load MilDisplay DLL.")
+#define M_ERR_77_SUBMSG_2        MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_77_SUBMSG_3        MIL_TEXT("Cannot find AppAlloc function in MilDisplay.")
+#define M_ERR_77_SUBMSG_4        MIL_TEXT("Cannot find AppFree function in MilDisplay.")
+#define M_ERR_77_SUBMSG_5        NO_SUBMSG
+#define M_ERR_77_SUBMSG_6        NO_SUBMSG
+#define M_ERR_77_SUBMSG_7        NO_SUBMSG
+#define M_ERR_77_SUBMSG_8        NO_SUBMSG
+#define M_ERR_77_SUBMSG_9        NO_SUBMSG
+
+#define M_ALLOC_ERROR_4          78L
+#define M_ERR_78_MSG             MIL_TEXT("Allocation error.")
+#define M_ERR_78_SUBMSG_1        MIL_TEXT("M_BGR15 and M_BGR16 buffers are not supported.")
+#define M_ERR_78_SUBMSG_2        MIL_TEXT("The requested system is not (correctly) installed.")
+#define M_ERR_78_SUBMSG_3        MIL_TEXT("Not enough logical address space to map the buffer.")
+#define M_ERR_78_SUBMSG_4        MIL_TEXT("Cannot open the DCF.")
+#define M_ERR_78_SUBMSG_5        MIL_TEXT("Cannot create a buffer at address 0.")
+#define M_ERR_78_SUBMSG_6        MIL_TEXT("Cannot allocate a M_MAPPABLE buffer with the M_DISP attribute.")
+#define M_ERR_78_SUBMSG_7        MIL_TEXT("The driver DLL has an invalid format and cannot be loaded.")
+#define M_ERR_78_SUBMSG_8        MIL_TEXT("Invalid bits set in the attribute.")
+#define M_ERR_78_SUBMSG_9        MIL_TEXT("The M_NO_PARSING control flag is only available to M_COMPRESS buffers.")
+
+#define M_SYS_CTRL_INQ_ERROR     79L
+#define M_ERR_79_MSG             MIL_TEXT("System Control/Inquire error.")
+#define M_ERR_79_SUBMSG_1        MIL_TEXT("Control/Inquire type supported only on the Host system.")
+#define M_ERR_79_SUBMSG_2        MIL_TEXT("Default pitch byte must be a power of 2.")
+#define M_ERR_79_SUBMSG_3        MIL_TEXT("This Control/Inquire is not supported any more.")
+#define M_ERR_79_SUBMSG_4        MIL_TEXT("This Control/Inquire is now a Digitizer Control/Inquire.")
+#define M_ERR_79_SUBMSG_5        MIL_TEXT("This Control/Inquire is now a Display Control/Inquire.")
+#define M_ERR_79_SUBMSG_6        MIL_TEXT("Controls are not allowed on this system.")
+#define M_ERR_79_SUBMSG_7        MIL_TEXT("Cannot call MsysControl with MIL_INT.")
+#define M_ERR_79_SUBMSG_8        NO_SUBMSG
+#define M_ERR_79_SUBMSG_9        NO_SUBMSG
+
+#define M_APP_MODIF_ERROR        80L
+#define M_ERR_80_MSG             MIL_TEXT("Swap ID error.")
+#define M_ERR_80_SUBMSG_1        MIL_TEXT("This function does not support remote objects.")
+#define M_ERR_80_SUBMSG_2        NO_SUBMSG
+#define M_ERR_80_SUBMSG_3        NO_SUBMSG
+#define M_ERR_80_SUBMSG_4        NO_SUBMSG
+#define M_ERR_80_SUBMSG_5        NO_SUBMSG
+#define M_ERR_80_SUBMSG_6        NO_SUBMSG
+#define M_ERR_80_SUBMSG_7        NO_SUBMSG
+#define M_ERR_80_SUBMSG_8        NO_SUBMSG
+#define M_ERR_80_SUBMSG_9        NO_SUBMSG
+
+#define M_INSTALLATION_ERROR     81L
+#define M_ERR_81_MSG             MIL_TEXT("Installation error.")
+#define M_ERR_81_SUBMSG_1        MIL_TEXT("Could not find the installation path in the registry.")
+#define M_ERR_81_SUBMSG_2        MIL_TEXT("The list of installed boards is corrupted in the registry. Please re-install MIL.")
+#define M_ERR_81_SUBMSG_3        NO_SUBMSG
+#define M_ERR_81_SUBMSG_4        NO_SUBMSG
+#define M_ERR_81_SUBMSG_5        NO_SUBMSG
+#define M_ERR_81_SUBMSG_6        NO_SUBMSG
+#define M_ERR_81_SUBMSG_7        NO_SUBMSG
+#define M_ERR_81_SUBMSG_8        NO_SUBMSG
+#define M_ERR_81_SUBMSG_9        NO_SUBMSG
+
+#define M_BUF_CTRL_INQ_ERROR     82L
+#define M_ERR_82_MSG             MIL_TEXT("Buffer Control/Inquire error.")
+#define M_ERR_82_SUBMSG_1        MIL_TEXT("Invalid index of bands.")
+#define M_ERR_82_SUBMSG_2        NO_SUBMSG
+#define M_ERR_82_SUBMSG_3        NO_SUBMSG
+#define M_ERR_82_SUBMSG_4        NO_SUBMSG
+#define M_ERR_82_SUBMSG_5        NO_SUBMSG
+#define M_ERR_82_SUBMSG_6        NO_SUBMSG
+#define M_ERR_82_SUBMSG_7        NO_SUBMSG
+#define M_ERR_82_SUBMSG_8        NO_SUBMSG
+#define M_ERR_82_SUBMSG_9        NO_SUBMSG
+
+#define M_CALL_FPGA_PARAM_ERROR    83L
+#define M_ERR_83_MSG             MIL_TEXT("Invalid parameter in user function call.")
+#define M_ERR_83_SUBMSG_1        MIL_TEXT("All the MIL IDs need to be allocated on the same system.")
+#define M_ERR_83_SUBMSG_2        MIL_TEXT("Only buffer IDs are supported.")
+#define M_ERR_83_SUBMSG_3        MIL_TEXT("At least one parameter must be an ID.")
+#define M_ERR_83_SUBMSG_4        MIL_TEXT("Cannot execute user functions on the Host system.")
+#define M_ERR_83_SUBMSG_5        MIL_TEXT("Too many parameters.")
+#define M_ERR_83_SUBMSG_6        NO_SUBMSG
+#define M_ERR_83_SUBMSG_7        NO_SUBMSG
+#define M_ERR_83_SUBMSG_8        NO_SUBMSG
+#define M_ERR_83_SUBMSG_9        NO_SUBMSG
+
+#define M_DISP_CTRL_INQ_ERROR    84L
+#define M_ERR_84_MSG             MIL_TEXT("Display Control/Inquire error.")
+#define M_ERR_84_SUBMSG_1        MIL_TEXT("This Control/Inquire is no longer supported.")
+#define M_ERR_84_SUBMSG_2        NO_SUBMSG
+#define M_ERR_84_SUBMSG_3        NO_SUBMSG
+#define M_ERR_84_SUBMSG_4        NO_SUBMSG
+#define M_ERR_84_SUBMSG_5        NO_SUBMSG
+#define M_ERR_84_SUBMSG_6        NO_SUBMSG
+#define M_ERR_84_SUBMSG_7        NO_SUBMSG
+#define M_ERR_84_SUBMSG_8        NO_SUBMSG
+#define M_ERR_84_SUBMSG_9        NO_SUBMSG
+
+#define M_J2K_ERROR_6            85L
+#define M_ERR_85_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_85_SUBMSG_1        MIL_TEXT("Too many tiles.")
+#define M_ERR_85_SUBMSG_2        MIL_TEXT("Invalid code block size.")
+#define M_ERR_85_SUBMSG_3        MIL_TEXT("Unexpected field delimiter.")
+#define M_ERR_85_SUBMSG_4        MIL_TEXT("Video standard not supported.")
+#define M_ERR_85_SUBMSG_5        MIL_TEXT("Unknown wavelet and quantization settings.")
+#define M_ERR_85_SUBMSG_6        MIL_TEXT("Unknown entropy coder parameters.")
+#define M_ERR_85_SUBMSG_7        MIL_TEXT("Code block attributes are truncated.")
+#define M_ERR_85_SUBMSG_8        MIL_TEXT("The field is truncated.")
+#define M_ERR_85_SUBMSG_9        MIL_TEXT("Invalid JP2 format.")
+
+#define M_INVALID_PARAM_ERROR_11 86L
+#define M_ERR_86_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_86_SUBMSG_1        MIL_TEXT("Mask buffer must be the same size as the source buffer.")
+#define M_ERR_86_SUBMSG_2        MIL_TEXT("Invalid frame rate value.")
+#define M_ERR_86_SUBMSG_3        MIL_TEXT("Invalid number of frames.")
+#define M_ERR_86_SUBMSG_4        MIL_TEXT("Invalid file format flag.")
+#define M_ERR_86_SUBMSG_5        MIL_TEXT("The file name pointer must not be null.")
+#define M_ERR_86_SUBMSG_6        MIL_TEXT("The pointer to the array of frames must be null.")
+#define M_ERR_86_SUBMSG_7        MIL_TEXT("The pointer to the array of frames must not be null.")
+#define M_ERR_86_SUBMSG_8        MIL_TEXT("The number of frames must be 0.")
+#define M_ERR_86_SUBMSG_9        MIL_TEXT("Invalid control flag.")
+
+#define M_INVALID_PARAM_ERROR_12 87L
+#define M_ERR_87_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_87_SUBMSG_1        MIL_TEXT("The start image value must be 0.")
+#define M_ERR_87_SUBMSG_2        MIL_TEXT("Invalid start image value.")
+#define M_ERR_87_SUBMSG_3        MIL_TEXT("The operation flag must be M_NULL.")
+#define M_ERR_87_SUBMSG_4        MIL_TEXT("Invalid operation flag.")
+#define M_ERR_87_SUBMSG_5        MIL_TEXT("The system identifier must be M_NULL.")
+#define M_ERR_87_SUBMSG_6        MIL_TEXT("Invalid system identifier.")
+#define M_ERR_87_SUBMSG_7        MIL_TEXT("Invalid shen filter type.")
+#define M_ERR_87_SUBMSG_8        MIL_TEXT("Invalid shen smooth factor range.")
+#define M_ERR_87_SUBMSG_9        MIL_TEXT("Invalid deriche filter type.")
+
+#define M_INVALID_PARAM_ERROR_13 88L
+#define M_ERR_88_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_88_SUBMSG_1        MIL_TEXT("Invalid deriche smooth factor range.")
+#define M_ERR_88_SUBMSG_2        MIL_TEXT("Difference between angles must be in the range of 0 - 360 degrees.")
+#define M_ERR_88_SUBMSG_3        MIL_TEXT("Invalid array format.")
+#define M_ERR_88_SUBMSG_4        MIL_TEXT("This operation requires a child buffer.")
+#define M_ERR_88_SUBMSG_5        MIL_TEXT("Cannot move the buffer because it has a child.")
+#define M_ERR_88_SUBMSG_6        MIL_TEXT("Cannot resize the buffer because it is selected on a display.")
+#define M_ERR_88_SUBMSG_7        MIL_TEXT("Cannot move a compressed buffer.")
+#define M_ERR_88_SUBMSG_8        MIL_TEXT("Type and attribute depths do not match.")
+#define M_ERR_88_SUBMSG_9        MIL_TEXT("Invalid internal format.")
+
+#define M_BUF_TRANSFER_ERROR_2   89L
+#define M_ERR_89_MSG             MIL_TEXT("Transfer Error.")
+#define M_ERR_89_SUBMSG_1        MIL_TEXT("Source and Destination buffers must belong to the same system.")
+#define M_ERR_89_SUBMSG_2        MIL_TEXT("M_DRIVER_METHOD cannot be specified with other methods.")
+#define M_ERR_89_SUBMSG_3        MIL_TEXT("Invalid composition source: planar buffer not supported.") 
+#define M_ERR_89_SUBMSG_4        MIL_TEXT("Composition only supported on all bands (in source and destination).")
+#define M_ERR_89_SUBMSG_5        MIL_TEXT("Composition is only supported with Mono8, Mono16, RGB16, BGR24 and BGR32 buffers.")
+#define M_ERR_89_SUBMSG_6        MIL_TEXT("Destination buffer of composition must have the same format as the source buffer.")
+#define M_ERR_89_SUBMSG_7        MIL_TEXT("Invalid composition source: yuv buffer not supported.")
+#define M_ERR_89_SUBMSG_8        MIL_TEXT("Invalid offset and/or size specified.")
+#define M_ERR_89_SUBMSG_9        MIL_TEXT("Float buffer not supported.")
+
+#define M_J2K_ERROR_7            90L
+#define M_ERR_90_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_90_SUBMSG_1        MIL_TEXT("Precinct size must be a power of two.")
+#define M_ERR_90_SUBMSG_2        MIL_TEXT("Only the first resolution can have a precinct size of 1.")
+#define M_ERR_90_SUBMSG_3        MIL_TEXT("Precinct size must not exceed 32768.")
+#define M_ERR_90_SUBMSG_4        MIL_TEXT("Code block size must be a power of 2.")
+#define M_ERR_90_SUBMSG_5        MIL_TEXT("The quantization table must be a one-band, 16 bits unsigned, one-dimensional M_ARRAY.")
+#define M_ERR_90_SUBMSG_6        MIL_TEXT("Invalid MIL_ID for the precincts size table.")
+#define M_ERR_90_SUBMSG_7        MIL_TEXT("The precincts size table must be a one-band, 16 bits unsigned, one-dimensional M_ARRAY.")
+#define M_ERR_90_SUBMSG_8        MIL_TEXT("Expected marker not found.")
+#define M_ERR_90_SUBMSG_9        MIL_TEXT("The buffer contains invalid data.")
+
+#define M_AUX_SERVICE_ERROR      91L
+#define M_ERR_91_MSG             MIL_TEXT("Auxiliary service error.")
+#define M_ERR_91_SUBMSG_1        MIL_TEXT("Cannot load MilAux DLL.")
+#define M_ERR_91_SUBMSG_2        NO_SUBMSG
+#define M_ERR_91_SUBMSG_3        MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_91_SUBMSG_4        MIL_TEXT("Hardware not supported by Auxiliary Service.")
+#define M_ERR_91_SUBMSG_5        MIL_TEXT("System not allocated.")
+#define M_ERR_91_SUBMSG_6        MIL_TEXT("The computer needs to be rebooted.")
+#define M_ERR_91_SUBMSG_7        NO_SUBMSG
+#define M_ERR_91_SUBMSG_8        NO_SUBMSG
+#define M_ERR_91_SUBMSG_9        NO_SUBMSG
+
+#define M_ALLOC_ERROR_5          92L
+#define M_ERR_92_MSG             MIL_TEXT("Allocation error.")
+#define M_ERR_92_SUBMSG_1        MIL_TEXT("Cannot create a buffer on this MIL_ID, the source buffer does not have a valid host address.")
+#define M_ERR_92_SUBMSG_2        MIL_TEXT("Cannot create a buffer on this MIL_ID, the source buffer does not have a valid physical address.")
+#define M_ERR_92_SUBMSG_3        MIL_TEXT("Invalid pitch value.")
+#define M_ERR_92_SUBMSG_4        MIL_TEXT("Cannot allocate an on-board buffer with the M_MAPPABLE attribute.")
+#define M_ERR_92_SUBMSG_5        MIL_TEXT("This system does not support allocations with a non-default pitch.")
+#define M_ERR_92_SUBMSG_6        MIL_TEXT("Unable to map the non-paged buffer to a logical address.")
+#define M_ERR_92_SUBMSG_7        MIL_TEXT("Unable to allocate digitizer using a non-ansi DCF file name.")
+#define M_ERR_92_SUBMSG_8        MIL_TEXT("DirectX version not supported.")
+#define M_ERR_92_SUBMSG_9        MIL_TEXT("Unable to allocate shadow for inter-system calls.")
+
+#define M_DGPRCSS_WATCHOG_ERROR 302 //This define was given to the user. It is now only available internally.
+#define M_RUNTIME_ERROR_1        93L
+#define M_ERR_93_MSG             MIL_TEXT("Runtime error.")
+#define M_ERR_93_SUBMSG_1        MIL_TEXT("The specified feature is not implemented.")
+#define M_ERR_93_SUBMSG_2        NO_SUBMSG
+#define M_ERR_93_SUBMSG_3        NO_SUBMSG
+#define M_ERR_93_SUBMSG_4        NO_SUBMSG
+#define M_ERR_93_SUBMSG_5        NO_SUBMSG
+#define M_ERR_93_SUBMSG_6        NO_SUBMSG
+#define M_ERR_93_SUBMSG_7        NO_SUBMSG
+#define M_ERR_93_SUBMSG_8        NO_SUBMSG
+#define M_ERR_93_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_14 94L
+#define M_ERR_94_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_94_SUBMSG_1        MIL_TEXT("If using float buffers, all source and destination buffers must be float.")
+#define M_ERR_94_SUBMSG_2        MIL_TEXT("A format must be specified for 3-band 8-bit images.")
+#define M_ERR_94_SUBMSG_3        MIL_TEXT("All buffers must have the same SizeX and SizeY.")
+#define M_ERR_94_SUBMSG_4        MIL_TEXT("All sources must have the same internal format.")
+#define M_ERR_94_SUBMSG_5        MIL_TEXT("All destinations must have the same internal format.")
+#define M_ERR_94_SUBMSG_6        MIL_TEXT("All sources must be allocated on the same system.")
+#define M_ERR_94_SUBMSG_7        MIL_TEXT("All destinations must be allocated on the same system.")
+#define M_ERR_94_SUBMSG_8        MIL_TEXT("Buffers must have at least 2 lines.")
+#define M_ERR_94_SUBMSG_9        MIL_TEXT("SrcStartImage must between 0 and SrcImageCount-1.")
+
+#define M_BUF_TRANSFER_ERROR_3   95L
+#define M_ERR_95_MSG             MIL_TEXT("Transfer Error.")
+#define M_ERR_95_SUBMSG_1        MIL_TEXT("Keying color does not correspond to the source data.")
+#define M_ERR_95_SUBMSG_2        MIL_TEXT("Invalid band.")
+#define M_ERR_95_SUBMSG_3        MIL_TEXT("Functionality is not implemented.")
+#define M_ERR_95_SUBMSG_4        MIL_TEXT("Unknown transfer function.")
+#define M_ERR_95_SUBMSG_5        MIL_TEXT("Unknown transfer mode.")
+#define M_ERR_95_SUBMSG_6        MIL_TEXT("A parameter is invalid.")
+#define M_ERR_95_SUBMSG_7        MIL_TEXT("Transfer not supported with the current license.")
+#define M_ERR_95_SUBMSG_8        MIL_TEXT("Unable to map a DirectX buffer.")
+#define M_ERR_95_SUBMSG_9        MIL_TEXT("All source parameter should be null.")
+
+#define M_J2K_ERROR_8            96L
+#define M_ERR_96_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_96_SUBMSG_1        MIL_TEXT("Unable to allocate memory.")
+#define M_ERR_96_SUBMSG_2        MIL_TEXT("The quantization style is only applicable to lossy buffers.")
+#define M_ERR_96_SUBMSG_3        MIL_TEXT("EOC marker found in a packet body.")
+#define M_ERR_96_SUBMSG_4        MIL_TEXT("The default quantization table identifier is invalid.")
+#define M_ERR_96_SUBMSG_5        MIL_TEXT("Invalid operation mode.")
+#define M_ERR_96_SUBMSG_6        NO_SUBMSG
+#define M_ERR_96_SUBMSG_7        NO_SUBMSG
+#define M_ERR_96_SUBMSG_8        NO_SUBMSG
+#define M_ERR_96_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_15 97L
+#define M_ERR_97_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_97_SUBMSG_1        MIL_TEXT("Only 8 and 16-bit source buffers are supported.")
+#define M_ERR_97_SUBMSG_2        MIL_TEXT("Only 8 and 16-bit destination buffers are supported.")
+#define M_ERR_97_SUBMSG_3        MIL_TEXT("All source buffers must be M_FLIP or M_NO_FLIP.")
+#define M_ERR_97_SUBMSG_4        MIL_TEXT("All destination buffers must be M_FLIP or M_NO_FLIP.")
+#define M_ERR_97_SUBMSG_5        MIL_TEXT("Invalid number of source buffers.")
+#define M_ERR_97_SUBMSG_6        MIL_TEXT("Invalid number of destination buffers.")
+#define M_ERR_97_SUBMSG_7        MIL_TEXT("M_MOTION_DETECT_REFERENCE_FRAME must be between 0 and M_MOTION_DETECT_NUM_FRAMES - 1 or set to one of the predefined values.")
+#define M_ERR_97_SUBMSG_8        MIL_TEXT("ControlFlag cannot be zero.")
+#define M_ERR_97_SUBMSG_9        MIL_TEXT("Invalid ControlFlag. Only one type of create is supported.")
+
+#define M_INVALID_PARAM_ERROR_16 98L
+#define M_ERR_98_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_98_SUBMSG_1        MIL_TEXT("Invalid pitch specified.")
+#define M_ERR_98_SUBMSG_2        MIL_TEXT("One of the IDs in the list is not a valid event.")
+#define M_ERR_98_SUBMSG_3        MIL_TEXT("All events do not belong to the same system type.")
+#define M_ERR_98_SUBMSG_4        MIL_TEXT("M_VIDEO_DEVICE_OBJECT cannot be used with something else.")
+#define M_ERR_98_SUBMSG_5        MIL_TEXT("Invalid warp parameters.")
+#define M_ERR_98_SUBMSG_6        MIL_TEXT("Invalid matrix size. Allowed values are 3 or 4 for SizeX, and 1 or 3 for SizeY.")
+#define M_ERR_98_SUBMSG_7        MIL_TEXT("BayerBitShift must be lower than source SizeBit.")
+#define M_ERR_98_SUBMSG_8        MIL_TEXT("Workspace already reserved.")
+#define M_ERR_98_SUBMSG_9        MIL_TEXT("Invalid version.")
+
+#define M_BUF_TRANSFER_ERROR_4   99L
+#define M_ERR_99_MSG             MIL_TEXT("Transfer Error.")
+#define M_ERR_99_SUBMSG_1        MIL_TEXT("Destination buffer id should be null.")
+#define M_ERR_99_SUBMSG_2        MIL_TEXT("The scaling method (type of interpolation) is unknown.")
+#define M_ERR_99_SUBMSG_3        MIL_TEXT("The scaling method (type of interpolation) is not supported.")
+#define M_ERR_99_SUBMSG_4        MIL_TEXT("M_ALLOW_LARGER_RECT is not compatible with the scaling function.")
+#define M_ERR_99_SUBMSG_5        MIL_TEXT("Autoscale is only supported on 32-bit buffers when the buffer is an image.")
+#define M_ERR_99_SUBMSG_6        MIL_TEXT("Transfer type is invalid.")
+#define M_ERR_99_SUBMSG_7        MIL_TEXT("The source of the autoscale function must be an image.")
+#define M_ERR_99_SUBMSG_8        MIL_TEXT("DirectX transfer only supported on DirectX buffers.")
+#define M_ERR_99_SUBMSG_9        MIL_TEXT("The DirectX transfer method is not supported in this environment.")
+
+#define M_COMPOSITION_ERROR      100L
+#define M_ERR_100_MSG            MIL_TEXT("Composition Error.")
+#define M_ERR_100_SUBMSG_1       MIL_TEXT("M_BGRX32_COMPOSITION requires 1-band buffers.")
+#define M_ERR_100_SUBMSG_2       MIL_TEXT("M_BGRX32_COMPOSITION requires 32-bit buffers.")
+#define M_ERR_100_SUBMSG_3       MIL_TEXT("M_BGRX32_COMPOSITION does not accept M_FLOAT buffers.")
+#define M_ERR_100_SUBMSG_4       NO_SUBMSG
+#define M_ERR_100_SUBMSG_5       NO_SUBMSG
+#define M_ERR_100_SUBMSG_6       NO_SUBMSG
+#define M_ERR_100_SUBMSG_7       NO_SUBMSG
+#define M_ERR_100_SUBMSG_8       NO_SUBMSG
+#define M_ERR_100_SUBMSG_9       NO_SUBMSG
+
+#define M_JPEG_COMPRESS_ERROR_4  101L
+#define M_ERR_101_MSG            MIL_TEXT("JPEG compression error.")
+#define M_ERR_101_SUBMSG_1       MIL_TEXT("Field order is only applicable to interlaced buffers.")
+#define M_ERR_101_SUBMSG_2       MIL_TEXT("Invalid field order.")
+#define M_ERR_101_SUBMSG_3       NO_SUBMSG
+#define M_ERR_101_SUBMSG_4       NO_SUBMSG
+#define M_ERR_101_SUBMSG_5       NO_SUBMSG
+#define M_ERR_101_SUBMSG_6       NO_SUBMSG
+#define M_ERR_101_SUBMSG_7       NO_SUBMSG
+#define M_ERR_101_SUBMSG_8       NO_SUBMSG
+#define M_ERR_101_SUBMSG_9       NO_SUBMSG
+
+#define M_OPERATION_ERROR_6      102L
+#define M_ERR_102_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_102_SUBMSG_1       MIL_TEXT("In place operations are not supported.")
+#define M_ERR_102_SUBMSG_2       MIL_TEXT("Cannot free a thread from within the same thread.")
+#define M_ERR_102_SUBMSG_3       MIL_TEXT("All parameters must be set in the context before calling the function.")
+#define M_ERR_102_SUBMSG_4       MIL_TEXT("The buffer to draw has not been set in the context.")
+#define M_ERR_102_SUBMSG_5       MIL_TEXT("MappFileOperation is not supported on Odyssey systems.")
+#define M_ERR_102_SUBMSG_6       MIL_TEXT("Buffer is already unmapped.")
+#define M_ERR_102_SUBMSG_7       MIL_TEXT("The size array must not be set in this mode.")
+#define M_ERR_102_SUBMSG_8       MIL_TEXT("Operation does not support buffers with region.")
+#define M_ERR_102_SUBMSG_9       MIL_TEXT("MappFileOperation is not supported on this operating system.")
+
+#define M_INVALID_PARAM_ERROR_17 103L
+#define M_ERR_103_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_103_SUBMSG_1       MIL_TEXT("Invalid file format flag. Cannot import MPEG4 sequences.")
+#define M_ERR_103_SUBMSG_2       MIL_TEXT("Array of ids parameter contains both local and remote ids.")
+#define M_ERR_103_SUBMSG_3       MIL_TEXT("InWarpParameter contain invalid coordinates.")
+#define M_ERR_103_SUBMSG_4       MIL_TEXT("Cannot convert an internal data structure to 32-bit values.")
+#define M_ERR_103_SUBMSG_5       MIL_TEXT("This control cannot be executed on a child buffer.")
+#define M_ERR_103_SUBMSG_6       MIL_TEXT("A buffer id must be specified in order to determine the target host.")
+#define M_ERR_103_SUBMSG_7       MIL_TEXT("A system id must be specified in order to determine the target host.")
+#define M_ERR_103_SUBMSG_8       MIL_TEXT("Objects in array must have the same owner system.")
+#define M_ERR_103_SUBMSG_9       MIL_TEXT("Invalid file format flag. Cannot import H264 sequences.")
+
+#define M_LICENSING_ERROR_2      104L
+#define M_ERR_104_MSG            MIL_TEXT("Licensing error.")
+#define M_ERR_104_SUBMSG_1       MIL_TEXT("MIL Lite requires a Matrox Imaging board or a valid license.\nIf a Matrox Imaging board is present, make sure it is correctly installed.")
+#define M_ERR_104_SUBMSG_2       MIL_TEXT("If a Matrox Imaging board is present, make sure it is correctly installed.")
+#define M_ERR_104_SUBMSG_3       MIL_TEXT("This system requires a license.")
+#define M_ERR_104_SUBMSG_4       MIL_TEXT("Your license does not allow JPEG compression.")
+#define M_ERR_104_SUBMSG_5       MIL_TEXT("Your license does not allow JPEG2000 compression.")
+#define M_ERR_104_SUBMSG_6       MIL_TEXT("Your license does not allow the use of JPEG-compressed sequences.")
+#define M_ERR_104_SUBMSG_7       MIL_TEXT("Your license has reached its time limit.")
+#define M_ERR_104_SUBMSG_8       MIL_TEXT("Your license does not allow the use of JPEG2000-compressed sequences.")
+#define M_ERR_104_SUBMSG_9       MIL_TEXT("Your license does not allow the allocation of this type of object.")
+
+#define M_ALLOC_ERROR_6          105L
+#define M_ERR_105_MSG            MIL_TEXT("Allocation error.")
+#define M_ERR_105_SUBMSG_1       MIL_TEXT("Unable to allocate memory.")
+#define M_ERR_105_SUBMSG_2       MIL_TEXT("Cannot allocate temporary buffer.")
+#define M_ERR_105_SUBMSG_3       MIL_TEXT("This system is not registered. Make sure the driver is started.")
+#define M_ERR_105_SUBMSG_4       MIL_TEXT("Not enough memory for a MIL CE allocation.\nContinuing the application may cause abnormal behavior!")
+#define M_ERR_105_SUBMSG_5       MIL_TEXT("Unable to allocate object because it is not of the expected type.")
+#if MIL_COMPILE_VERSION < 1060
+#define M_ERR_105_SUBMSG_6       MIL_TEXT("The computer has not been rebooted since the last setup ran.")
+#else
+#define M_ERR_105_SUBMSG_6       MIL_TEXT("The computer needs to be rebooted.")
+#endif
+#define M_ERR_105_SUBMSG_7       MIL_TEXT("The M_FLIP buffer attribute is no longer supported.")
+#define M_ERR_105_SUBMSG_8       MIL_TEXT("Cluster Manager Server not found. Verify settings in MILConfig or in the MappAlloc parameters")
+#define M_ERR_105_SUBMSG_9       MIL_TEXT("Error with the Cluster Manager Server handshake.")
+
+#define M_FONT_ERROR             106L
+#define M_ERR_106_MSG            MIL_TEXT("Font error.")
+#define M_ERR_106_SUBMSG_1       MIL_TEXT("Invalid font or font not installed.") 
+#define M_ERR_106_SUBMSG_2       MIL_TEXT("Invalid font name.")
+#define M_ERR_106_SUBMSG_3       MIL_TEXT("The default fonts do not support all character codes of the text. Please use another font.") 
+#define M_ERR_106_SUBMSG_4       MIL_TEXT("The specified fonts do not support all characters of the text. Please use another font.")
+#define M_ERR_106_SUBMSG_5       MIL_TEXT("Unable to find a system font that supports all character codes of the text. Please install a suitable font.")
+#define M_ERR_106_SUBMSG_6       MIL_TEXT("Your locale environment is not in UTF8.")
+#define M_ERR_106_SUBMSG_7       MIL_TEXT("Invalid font size.")
+#define M_ERR_106_SUBMSG_8       MIL_TEXT("Invalid font file.")
+#define M_ERR_106_SUBMSG_9       MIL_TEXT("Invalid text encoding.")
+
+#define M_FORMAT_ERROR           107L
+#define M_ERR_107_MSG            MIL_TEXT("Format error.")
+#define M_ERR_107_SUBMSG_1       MIL_TEXT("The specified YUV format is only supported for all bands and with a compatible YUV buffer.")
+#define M_ERR_107_SUBMSG_2       MIL_TEXT("The specified format is only supported for all bands.")
+#define M_ERR_107_SUBMSG_3       NO_SUBMSG
+#define M_ERR_107_SUBMSG_4       NO_SUBMSG
+#define M_ERR_107_SUBMSG_5       NO_SUBMSG
+#define M_ERR_107_SUBMSG_6       NO_SUBMSG
+#define M_ERR_107_SUBMSG_7       NO_SUBMSG
+#define M_ERR_107_SUBMSG_8       NO_SUBMSG
+#define M_ERR_107_SUBMSG_9       NO_SUBMSG
+
+#define M_APP_CTRL_INQ_ERROR     108L
+#define M_ERR_108_MSG            MIL_TEXT("Application Control/Inquire error.")
+#define M_ERR_108_SUBMSG_1       MIL_TEXT("Some display related object(s) were not freed.")
+#define M_ERR_108_SUBMSG_2       MIL_TEXT("This control cannot be executed if the video memory usage is disabled.")
+#define M_ERR_108_SUBMSG_3       NO_SUBMSG
+#define M_ERR_108_SUBMSG_4       NO_SUBMSG
+#define M_ERR_108_SUBMSG_5       NO_SUBMSG
+#define M_ERR_108_SUBMSG_6       NO_SUBMSG
+#define M_ERR_108_SUBMSG_7       NO_SUBMSG
+#define M_ERR_108_SUBMSG_8       NO_SUBMSG
+#define M_ERR_108_SUBMSG_9       NO_SUBMSG
+
+#define M_GRA_OPERATION_ERROR    109L
+#define M_ERR_109_MSG            MIL_TEXT("Drawing operation error.")
+#define M_ERR_109_SUBMSG_1       MIL_TEXT("Cannot draw in world units in an uncalibrated image.")
+#define M_ERR_109_SUBMSG_2       NO_SUBMSG
+#define M_ERR_109_SUBMSG_3       MIL_TEXT("Cannot perform this draw operation from an uncalibrated source object.")
+#define M_ERR_109_SUBMSG_4       MIL_TEXT("No calibration found to perform this operation.")
+#define M_ERR_109_SUBMSG_5       MIL_TEXT("M_GRAPHIC_CONVERSION_MODE set to M_PRESERVE_SHAPE_AVERAGE is not supported for this operation.")
+#define M_ERR_109_SUBMSG_6       MIL_TEXT("M_GRAPHIC_CONVERSION_MODE set to M_RESHAPE_FROM_POINTS is not supported for this operation.")
+#define M_ERR_109_SUBMSG_7       MIL_TEXT("M_GRAPHIC_CONVERSION_MODE set to M_RESHAPE_FOLLOWING_DISTORTION is not supported for this operation.")
+#define M_ERR_109_SUBMSG_8       MIL_TEXT("This operation can only be performed when drawing to a graphic list.")
+#define M_ERR_109_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_18 110L
+#define M_ERR_110_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_110_SUBMSG_1       MIL_TEXT("Invalid inquire type for this graphic.")
+#define M_ERR_110_SUBMSG_2       MIL_TEXT("Invalid LabelOrIndex.")
+#define M_ERR_110_SUBMSG_3       MIL_TEXT("Invalid list type.")
+#define M_ERR_110_SUBMSG_4       MIL_TEXT("This value cannot be modified.")
+#define M_ERR_110_SUBMSG_5       MIL_TEXT("This value cannot be read.")
+#define M_ERR_110_SUBMSG_6       MIL_TEXT("Invalid units.")
+#define M_ERR_110_SUBMSG_7       MIL_TEXT("Invalid SubIndex.")
+#define M_ERR_110_SUBMSG_8       MIL_TEXT("Invalid Number.")
+#define M_ERR_110_SUBMSG_9       MIL_TEXT("X2Ptr and Y2Ptr should be M_NULL for M_POLYLINE or M_POLYGON.")
+
+#define M_MEM_MAN_INQ_ERROR      111L
+#define M_ERR_111_MSG            MIL_TEXT("Memory manager Inquire error.")
+#define M_ERR_111_SUBMSG_1       MIL_TEXT("MIL is not using Mtx Memory Manager driver.")
+#define M_ERR_111_SUBMSG_2       MIL_TEXT("Cannot get memory manager handle.")
+#define M_ERR_111_SUBMSG_3       MIL_TEXT("Cannot get memory manager driver information.")
+#define M_ERR_111_SUBMSG_4       NO_SUBMSG
+#define M_ERR_111_SUBMSG_5       NO_SUBMSG
+#define M_ERR_111_SUBMSG_6       NO_SUBMSG
+#define M_ERR_111_SUBMSG_7       NO_SUBMSG
+#define M_ERR_111_SUBMSG_8       NO_SUBMSG
+#define M_ERR_111_SUBMSG_9       NO_SUBMSG
+
+#define M_NO_MEM_ERROR           112L
+#define M_ERR_112_MSG            MIL_TEXT("Memory error.")
+#define M_ERR_112_SUBMSG_1       MIL_TEXT("Not enough heap memory to continue.")
+#define M_ERR_112_SUBMSG_2       NO_SUBMSG
+#define M_ERR_112_SUBMSG_3       NO_SUBMSG
+#define M_ERR_112_SUBMSG_4       NO_SUBMSG
+#define M_ERR_112_SUBMSG_5       NO_SUBMSG
+#define M_ERR_112_SUBMSG_6       NO_SUBMSG
+#define M_ERR_112_SUBMSG_7       NO_SUBMSG
+#define M_ERR_112_SUBMSG_8       NO_SUBMSG
+#define M_ERR_112_SUBMSG_9       NO_SUBMSG
+
+#define M_GPU_ERROR              113L
+#define M_ERR_113_MSG            MIL_TEXT("GPU driver error.")
+#define M_ERR_113_SUBMSG_1       MIL_TEXT("DirectX version not supported.")
+#define M_ERR_113_SUBMSG_2       MIL_TEXT("Invalid command decoder.")
+#define M_ERR_113_SUBMSG_3       MIL_TEXT("MilGPUd3d9.dll DLL cannot be loaded.")
+#define M_ERR_113_SUBMSG_4       MIL_TEXT("MilGPUd3d10.dll DLL cannot be loaded.")
+#define M_ERR_113_SUBMSG_5       MIL_TEXT("MilGPUd3d11.dll DLL cannot be loaded.")
+#define M_ERR_113_SUBMSG_6       MIL_TEXT("GPU system cannot be used in a Windows Service.")
+#define M_ERR_113_SUBMSG_7       NO_SUBMSG
+#define M_ERR_113_SUBMSG_8       NO_SUBMSG
+#define M_ERR_113_SUBMSG_9       NO_SUBMSG
+
+#define M_FILE_OPERATION_ERROR   114L
+#define M_ERR_114_MSG            MIL_TEXT("File operation error.")
+#define M_ERR_114_SUBMSG_1       MIL_TEXT("Source file must be specified.")
+#define M_ERR_114_SUBMSG_2       MIL_TEXT("Folder already exists.")
+#define M_ERR_114_SUBMSG_3       MIL_TEXT("File does not exist.")
+#define M_ERR_114_SUBMSG_4       MIL_TEXT("Could not create folder.")
+#define M_ERR_114_SUBMSG_5       MIL_TEXT("Could not delete folder.")
+#define M_ERR_114_SUBMSG_6       MIL_TEXT("Folder is not empty.")
+#define M_ERR_114_SUBMSG_7       MIL_TEXT("Error executing command.")
+#define M_ERR_114_SUBMSG_8       MIL_TEXT("File not found.")
+#define M_ERR_114_SUBMSG_9       MIL_TEXT("Permission denied.")
+
+#define M_FILE_OPERATION_ERROR_2 115L
+#define M_ERR_115_MSG            MIL_TEXT("File operation error.")
+#define M_ERR_115_SUBMSG_1       MIL_TEXT("Could not copy file.")
+#define M_ERR_115_SUBMSG_2       MIL_TEXT("The command is not a valid executable.")
+#define M_ERR_115_SUBMSG_3       MIL_TEXT("The executable must be specified.")
+#define M_ERR_115_SUBMSG_4       MIL_TEXT("Destination file must be specified.")
+#define M_ERR_115_SUBMSG_5       MIL_TEXT("Source and Destination files must be different.")
+#define M_ERR_115_SUBMSG_6       MIL_TEXT("Sharing violation.")
+#define M_ERR_115_SUBMSG_7       MIL_TEXT("Name is invalid.")
+#define M_ERR_115_SUBMSG_8       MIL_TEXT("No file specified.")
+#define M_ERR_115_SUBMSG_9       MIL_TEXT("OperationDataPtr cannot be NULL.")
+
+#define M_INVALID_PARAM_ERROR_19 116L
+#define M_ERR_116_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_116_SUBMSG_1       MIL_TEXT("The ID of the source buffer can only be M_NULL when preprocessing the context.")
+#define M_ERR_116_SUBMSG_2       MIL_TEXT("The ID of the destination buffer can only be M_NULL when preprocessing the context.")
+#define M_ERR_116_SUBMSG_3       MIL_TEXT("Inquire type not supported.")
+#define M_ERR_116_SUBMSG_4       MIL_TEXT("Control type not supported.")
+#define M_ERR_116_SUBMSG_5       MIL_TEXT("Invalid control value.")
+#define M_ERR_116_SUBMSG_6       MIL_TEXT("Invalid mode.")
+#define M_ERR_116_SUBMSG_7       MIL_TEXT("DeadPixels buffer must be specified.")
+#define M_ERR_116_SUBMSG_8       MIL_TEXT("DeadPixels array contain invalid coordinates.")
+#define M_ERR_116_SUBMSG_9       MIL_TEXT("Matrix array must be 1 band.")
+
+#define M_INVALID_PARAM_ERROR_20 117L
+#define M_ERR_117_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_117_SUBMSG_1       MIL_TEXT("All arrays must have the same number of elements.")
+#define M_ERR_117_SUBMSG_2       MIL_TEXT("Buffer must be 1 band.")
+#define M_ERR_117_SUBMSG_3       MIL_TEXT("Buffer SizeY must be 1.")
+#define M_ERR_117_SUBMSG_4       MIL_TEXT("Buffer SizeX must be multiple of 2.")
+#define M_ERR_117_SUBMSG_5       MIL_TEXT("Src image size must be greater or equal to DeadPixels size.")
+#define M_ERR_117_SUBMSG_6       MIL_TEXT("Dst image size must be greater or equal to DeadPixels size.")
+#define M_ERR_117_SUBMSG_7       MIL_TEXT("DeadPixels could not be filled with all non-zero values.")
+#define M_ERR_117_SUBMSG_8       MIL_TEXT("Invalid statistic type.")
+#define M_ERR_117_SUBMSG_9       MIL_TEXT("SizeX and SizeY must be specified in the context or a source buffer must be passed at the preprocess.")
+
+#define M_NULL_PARAMETER          118L
+#define M_ERR_118_MSG             MIL_TEXT("Parameter cannot be NULL.")
+#define M_ERR_118_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_118_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_118_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_118_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_118_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_118_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_118_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_118_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_118_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_INVALID_PARAM_ERROR_21 119L
+#define M_ERR_119_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_119_SUBMSG_1       MIL_TEXT("The affinity mask array pointer cannot be NULL.")
+#define M_ERR_119_SUBMSG_2       MIL_TEXT("The affinity mask array must contain at least one valid bit.")
+#define M_ERR_119_SUBMSG_3       MIL_TEXT("The value pointer is not used and should be NULL.")
+#define M_ERR_119_SUBMSG_4       MIL_TEXT("Context and result must be on the same system.")
+#define M_ERR_119_SUBMSG_5       MIL_TEXT("Model must be specified.")
+#define M_ERR_119_SUBMSG_6       MIL_TEXT("Mask must be specified.")
+#define M_ERR_119_SUBMSG_7       MIL_TEXT("Invalid score type.")
+#define M_ERR_119_SUBMSG_8       MIL_TEXT("Model step must be 1 or 2.")
+#define M_ERR_119_SUBMSG_9       MIL_TEXT("Invalid max score.")
+
+#define M_INVALID_PARAM_ERROR_22 120L
+#define M_ERR_120_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_120_SUBMSG_1       MIL_TEXT("Invalid source buffer type.")
+#define M_ERR_120_SUBMSG_2       MIL_TEXT("Invalid destination buffer type.")
+#define M_ERR_120_SUBMSG_3       MIL_TEXT("Model must be a monochrome image.")
+#define M_ERR_120_SUBMSG_4       MIL_TEXT("Invalid model buffer type.")
+#define M_ERR_120_SUBMSG_5       MIL_TEXT("Invalid model size.")
+#define M_ERR_120_SUBMSG_6       MIL_TEXT("Mask must be a monochrome image.")
+#define M_ERR_120_SUBMSG_7       MIL_TEXT("Invalid mask buffer type.")
+#define M_ERR_120_SUBMSG_8       MIL_TEXT("Invalid mask size.")
+#define M_ERR_120_SUBMSG_9       MIL_TEXT("Invalid center structural element value.")
+
+#define M_THRESHOLDS_ERROR       121L
+#define M_ERR_121_MSG            MIL_TEXT("External MP thresholds error.")
+#define M_ERR_121_SUBMSG_1       MIL_TEXT("Invalid file name.")
+#define M_ERR_121_SUBMSG_2       MIL_TEXT("Cannot open file.")
+#define M_ERR_121_SUBMSG_3       MIL_TEXT("Bad file format.")
+#define M_ERR_121_SUBMSG_4       MIL_TEXT("Invalid threshold identifier.")
+#define M_ERR_121_SUBMSG_5       MIL_TEXT("Invalid parameter value.")
+#define M_ERR_121_SUBMSG_6       MIL_TEXT("This Control Value is not supported in this version of MIL.")
+#define M_ERR_121_SUBMSG_7       MIL_TEXT("Cannot close file.")
+#define M_ERR_121_SUBMSG_8       NO_SUBMSG
+#define M_ERR_121_SUBMSG_9       NO_SUBMSG
+
+#define M_SYS_CONFIG_ERROR       122L
+#define M_ERR_122_MSG            MIL_TEXT("Config access error.")
+#define M_ERR_122_SUBMSG_1       MIL_TEXT("Could not write to eeprom.")
+#define M_ERR_122_SUBMSG_2       MIL_TEXT("Could not read from eeprom.")
+#define M_ERR_122_SUBMSG_3       NO_SUBMSG
+#define M_ERR_122_SUBMSG_4       NO_SUBMSG
+#define M_ERR_122_SUBMSG_5       NO_SUBMSG
+#define M_ERR_122_SUBMSG_6       NO_SUBMSG
+#define M_ERR_122_SUBMSG_7       NO_SUBMSG
+#define M_ERR_122_SUBMSG_8       NO_SUBMSG
+#define M_ERR_122_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_23 123L
+#define M_ERR_123_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_123_SUBMSG_1       MIL_TEXT("Invalid number of elements. The number of elements should greater or equal to zero.")
+#define M_ERR_123_SUBMSG_2       MIL_TEXT("Parameter 2 must be set to M_NULL with this operation.")
+#define M_ERR_123_SUBMSG_3       MIL_TEXT("Parameter 2 cannot be M_NULL for this operation as the image buffer does not have any region information.")
+#define M_ERR_123_SUBMSG_4       MIL_TEXT("Invalid Application ID.")
+#define M_ERR_123_SUBMSG_5       MIL_TEXT("ObjectIdPtr cannot be M_NULL.")
+#define M_ERR_123_SUBMSG_6       MIL_TEXT("StreamType must either be M_FILE or M_MEMORY.")
+#define M_ERR_123_SUBMSG_7       MIL_TEXT("MemPtrOrFileName must be M_NULL for M_INQUIRE_SIZE_BYTE operation, and must not be M_NULL otherwise.")
+#define M_ERR_123_SUBMSG_8       MIL_TEXT("For a M_LOAD or M_RESTORE Operation, Version must be set to M_DEFAULT.")
+#define M_ERR_123_SUBMSG_9       MIL_TEXT("This ResultType is not available for this object type.")
+
+#define M_SET_REGION_ERROR       124L
+#define M_ERR_124_MSG            MIL_TEXT("Region error.")
+#define M_ERR_124_SUBMSG_1       MIL_TEXT("Cannot rasterize a graphic list with world input units in an uncalibrated image.")
+#define M_ERR_124_SUBMSG_2       MIL_TEXT("Unsupported operation value when using a graphic list as the second parameter.")
+#define M_ERR_124_SUBMSG_3       MIL_TEXT("Unsupported operation value when using an image buffer as the second parameter.")
+#define M_ERR_124_SUBMSG_4       MIL_TEXT("Unsupported buffer format used as the second parameter.")
+#define M_ERR_124_SUBMSG_5       MIL_TEXT("The region buffer must have the same sizes as its owner buffer.")
+#define M_ERR_124_SUBMSG_6       MIL_TEXT("Incompatible destination for the buffer region type.")
+#define M_ERR_124_SUBMSG_7       MIL_TEXT("Incompatible source and destination regions.")
+#define M_ERR_124_SUBMSG_8       MIL_TEXT("Cannot rasterize because a linked region exists in a child with a different calibration.")
+#define M_ERR_124_SUBMSG_9       MIL_TEXT("Unsupported region type for this operation.")
+
+#define M_OPERATION_ERROR_7      125L
+#define M_ERR_125_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_125_SUBMSG_1       MIL_TEXT("Error while converting this graphic.")
+#define M_ERR_125_SUBMSG_2       MIL_TEXT("Stream does not contain an object of the expected type.")
+#define M_ERR_125_SUBMSG_3       MIL_TEXT("Stream is corrupt.")
+#define M_ERR_125_SUBMSG_4       MIL_TEXT("Unable to control this object type.")
+#define M_ERR_125_SUBMSG_5       MIL_TEXT("Unable to inquire this object type.")
+#define M_ERR_125_SUBMSG_6       MIL_TEXT("Unable to get result for this object type.")
+#define M_ERR_125_SUBMSG_7       MIL_TEXT("Unable to call MimGet() on this object type.")
+#define M_ERR_125_SUBMSG_8       MIL_TEXT("Unable to call MimPut() on this object type.")
+#define M_ERR_125_SUBMSG_9       MIL_TEXT("The ControlType is not supported at this time.")
+
+#define M_DMIL_MONITOR_ERROR     126L
+#define M_ERR_126_MSG            MIL_TEXT("DMILMonitor error.")
+#define M_ERR_126_SUBMSG_1       MIL_TEXT("Cannot load DMILMonitor DLL.")
+#define M_ERR_126_SUBMSG_2       MIL_TEXT("A non-null cluster node must be specified during MappAlloc to activate the monitoring mode.")
+#define M_ERR_126_SUBMSG_3       MIL_TEXT("The port must be set before enabling the connection")
+#define M_ERR_126_SUBMSG_4       MIL_TEXT("Cluster Manager Server not found. Verify settings in MILConfig or in the MappAlloc parameters")
+#define M_ERR_126_SUBMSG_5       MIL_TEXT("Error with the Cluster Manager Server handshake.")
+#define M_ERR_126_SUBMSG_6       MIL_TEXT("Invalid Cluster Manager Server name passed as an argument to MappAlloc.")
+#define M_ERR_126_SUBMSG_7       MIL_TEXT("Internal Cluster Manager Server connection error.")
+#define M_ERR_126_SUBMSG_8       NO_SUBMSG
+#define M_ERR_126_SUBMSG_9       NO_SUBMSG
+
+#define M_MP_ERROR               127L
+#define M_ERR_127_MSG            MIL_TEXT("MP subsystem error.")
+#define M_ERR_127_SUBMSG_1       MIL_TEXT("Unrecognized host hardware configuration.  MP will be disabled.")
+#define M_ERR_127_SUBMSG_2       NO_SUBMSG
+#define M_ERR_127_SUBMSG_3       NO_SUBMSG
+#define M_ERR_127_SUBMSG_4       NO_SUBMSG
+#define M_ERR_127_SUBMSG_5       NO_SUBMSG
+#define M_ERR_127_SUBMSG_6       NO_SUBMSG
+#define M_ERR_127_SUBMSG_7       NO_SUBMSG
+#define M_ERR_127_SUBMSG_8       NO_SUBMSG
+#define M_ERR_127_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_24 128L
+#define M_ERR_128_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_128_SUBMSG_1       MIL_TEXT("This GetType is not supported for this object type.")
+#define M_ERR_128_SUBMSG_2       MIL_TEXT("This PutType is not supported for this object type.")
+#define M_ERR_128_SUBMSG_3       MIL_TEXT("Cannot use both +M_AVAILABLE and +M_SUPPORTED at the same time.")
+#define M_ERR_128_SUBMSG_4       MIL_TEXT("Cannot use both +M_AVAILABLE and +M_DEFAULT at the same time.")
+#define M_ERR_128_SUBMSG_5       MIL_TEXT("Only one +M_TYPE_[] flag can be used at a time.")
+#define M_ERR_128_SUBMSG_6       MIL_TEXT("+M_SUPPORTED, +M_AVAILABLE or +M_DEFAULT cannot be used with this operation.")
+#define M_ERR_128_SUBMSG_7       MIL_TEXT("+M_TYPE_[] flags cannot be used with this operation.")
+#define M_ERR_128_SUBMSG_8       MIL_TEXT("Empty arrays are not supported by this PutType.")
+#define M_ERR_128_SUBMSG_9       MIL_TEXT("The MIL_ID given as control value cannot be M_NULL.")
+
+#define M_OPERATION_ERROR_8      129L
+#define M_ERR_129_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_129_SUBMSG_1       MIL_TEXT("The InquireType is not supported at this time.")
+#define M_ERR_129_SUBMSG_2       MIL_TEXT("The ResultType is not available at this time.")
+#define M_ERR_129_SUBMSG_3       MIL_TEXT("The PutType is not supported at this time.")
+#define M_ERR_129_SUBMSG_4       MIL_TEXT("The GetType is not supported at this time.")
+#define M_ERR_129_SUBMSG_5       MIL_TEXT("Required data is not initialized.")
+#define M_ERR_129_SUBMSG_6       MIL_TEXT("Cannot move a child completely outside its parent's limits.")
+#define M_ERR_129_SUBMSG_7       MIL_TEXT("A streaming operation failed.")
+#define M_ERR_129_SUBMSG_8       MIL_TEXT("No default value is available.")
+#define M_ERR_129_SUBMSG_9       MIL_TEXT("When inquiring an array, the output pointer must not be M_NULL.")
+
+#define M_OPERATION_ERROR_9      130L
+#define M_ERR_130_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_130_SUBMSG_1       MIL_TEXT("The value of M_MAX_DISTANCE must be greater or equal to the value of M_MIN_DISTANCE.")
+#define M_ERR_130_SUBMSG_2       MIL_TEXT("Dead pixels must have been specified prior to this function call.")
+#define M_ERR_130_SUBMSG_3       MIL_TEXT("Unsupported buffer format.")
+#define M_ERR_130_SUBMSG_4       MIL_TEXT("Event synchronize timeout occurred.")
+#define M_ERR_130_SUBMSG_5       MIL_TEXT("Unexpected internal error.")
+#define M_ERR_130_SUBMSG_6       MIL_TEXT("Timeout is not supported.")
+#define M_ERR_130_SUBMSG_7       MIL_TEXT("When using M_LOAD, the stream's object type must be the same as the current object type.")
+#define M_ERR_130_SUBMSG_8       MIL_TEXT("Unsupported operation on internally allocated objects.")
+#define M_ERR_130_SUBMSG_9       MIL_TEXT("Cannot add object to group.")
+
+#define M_INVALID_PARAM_ERROR_25 131L
+#define M_ERR_131_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_131_SUBMSG_1       MIL_TEXT("Only M_DRAW_LIST objects are accepted.")
+#define M_ERR_131_SUBMSG_2       MIL_TEXT("Only lists containing 1 polyline are accepted.")
+#define M_ERR_131_SUBMSG_3       MIL_TEXT("The MIL_ID given as control value must be an M_IMAGE.")
+#define M_ERR_131_SUBMSG_4       MIL_TEXT("The image buffer given as control value must have the M_PROC attribute.")
+#define M_ERR_131_SUBMSG_5       MIL_TEXT("The image buffer given as control value must be 8-bit or 16-bit unsigned.")
+#define M_ERR_131_SUBMSG_6       MIL_TEXT("Saturation is not supported with 64-bit integer buffers.")
+#define M_ERR_131_SUBMSG_7       MIL_TEXT("Invalid min/max values specified on source buffer.")
+#define M_ERR_131_SUBMSG_8       MIL_TEXT("Cannot inquire M_INTERNAL error.")
+#define M_ERR_131_SUBMSG_9       MIL_TEXT("InWarpParameter and OutXLutOrCoefId must be of the same type.")
+
+#define M_CONNECTION_ERROR       132L
+#define M_ERR_132_MSG            MIL_TEXT("Connection error.")
+#define M_ERR_132_SUBMSG_1       MIL_TEXT("Cannot open connection.")
+#define M_ERR_132_SUBMSG_2       MIL_TEXT("Cannot open connection, already established.")
+#define M_ERR_132_SUBMSG_3       MIL_TEXT("Invalid parameter 1. This function requires a remote Application.")
+#define M_ERR_132_SUBMSG_4       NO_SUBMSG
+#define M_ERR_132_SUBMSG_5       NO_SUBMSG
+#define M_ERR_132_SUBMSG_6       NO_SUBMSG
+#define M_ERR_132_SUBMSG_7       NO_SUBMSG
+#define M_ERR_132_SUBMSG_8       NO_SUBMSG
+#define M_ERR_132_SUBMSG_9       NO_SUBMSG
+
+#define M_PUBLICATION_ERROR      133L
+#define M_ERR_133_MSG            MIL_TEXT("Publication error.")
+#define M_ERR_133_SUBMSG_1       MIL_TEXT("This type of object cannot be published.")
+#define M_ERR_133_SUBMSG_2       NO_SUBMSG
+#define M_ERR_133_SUBMSG_3       NO_SUBMSG
+#define M_ERR_133_SUBMSG_4       NO_SUBMSG
+#define M_ERR_133_SUBMSG_5       NO_SUBMSG
+#define M_ERR_133_SUBMSG_6       NO_SUBMSG
+#define M_ERR_133_SUBMSG_7       NO_SUBMSG
+#define M_ERR_133_SUBMSG_8       NO_SUBMSG
+#define M_ERR_133_SUBMSG_9       NO_SUBMSG
+
+#define M_APP_FREE_ERROR_2       134L
+#define M_ERR_134_MSG            MIL_TEXT("Application free operation error.")
+#define M_ERR_134_SUBMSG_1       MIL_TEXT("Some remote connections have not been closed.")
+#define M_ERR_134_SUBMSG_2       MIL_TEXT("Could not free the software grab simulator service.")
+#define M_ERR_134_SUBMSG_3       MIL_TEXT("Invalid flag when freeing current application.")
+#define M_ERR_134_SUBMSG_4       NO_SUBMSG
+#define M_ERR_134_SUBMSG_5       NO_SUBMSG
+#define M_ERR_134_SUBMSG_6       NO_SUBMSG
+#define M_ERR_134_SUBMSG_7       NO_SUBMSG
+#define M_ERR_134_SUBMSG_8       NO_SUBMSG
+#define M_ERR_134_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_26 135L
+#define M_ERR_135_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_135_SUBMSG_1       MIL_TEXT("When using a graphic list as the draw destination, Param2 must be set to 1.0.")
+#define M_ERR_135_SUBMSG_2       MIL_TEXT("A source intensity buffer is not supported when drawing in a graphic list.")
+#define M_ERR_135_SUBMSG_3       MIL_TEXT("A graphic context with a zoom or offset is not supported when drawing in an image buffer.")
+#define M_ERR_135_SUBMSG_4       MIL_TEXT("Context type is not in supported list.")
+#define M_ERR_135_SUBMSG_5       MIL_TEXT("Invalid matrix buffer type.")
+#define M_ERR_135_SUBMSG_6       MIL_TEXT("Operation is not supported on subsampled band.")
+#define M_ERR_135_SUBMSG_7       MIL_TEXT("The outer radius must be greater than the inner radius.")
+#define M_ERR_135_SUBMSG_8       MIL_TEXT("A radius cannot be negative.")
+#define M_ERR_135_SUBMSG_9       MIL_TEXT("MaxNumNeighbors must be greater than or equal to 0.")
+
+#define M_COMPENSATION_ERROR     136L
+#define M_ERR_136_MSG            MIL_TEXT("Compensation error.")
+#define M_ERR_136_SUBMSG_1       MIL_TEXT("Parameters not supported by the board.")
+#define M_ERR_136_SUBMSG_2       MIL_TEXT("Legacy board is not supported.")
+#define M_ERR_136_SUBMSG_3       MIL_TEXT("The selected system does not support regions.")
+#define M_ERR_136_SUBMSG_4       NO_SUBMSG
+#define M_ERR_136_SUBMSG_5       NO_SUBMSG
+#define M_ERR_136_SUBMSG_6       NO_SUBMSG
+#define M_ERR_136_SUBMSG_7       NO_SUBMSG
+#define M_ERR_136_SUBMSG_8       NO_SUBMSG
+#define M_ERR_136_SUBMSG_9       NO_SUBMSG
+
+#define M_PNG_ERROR              137L
+#define M_ERR_137_MSG            MIL_TEXT("PNG error.")
+#define M_ERR_137_SUBMSG_1       MIL_TEXT("Cannot open file.")
+#define M_ERR_137_SUBMSG_2       MIL_TEXT("Cannot read file.")
+#define M_ERR_137_SUBMSG_3       MIL_TEXT("Cannot write file.")
+#define M_ERR_137_SUBMSG_4       MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_137_SUBMSG_5       MIL_TEXT("Invalid PNG file.")
+#define M_ERR_137_SUBMSG_6       NO_SUBMSG
+#define M_ERR_137_SUBMSG_7       MIL_TEXT("Only 8, 16 BitsPerSample is supported with RGB or RGBA files.")
+#define M_ERR_137_SUBMSG_8       MIL_TEXT("Only 1, 8, 16 BitsPerSample supported.")
+#define M_ERR_137_SUBMSG_9       MIL_TEXT("Only 1 or 3 SizeBand supported.")
+
+#define M_AVI_FILE_ERROR_4       138L
+#define M_ERR_138_MSG            MIL_TEXT("AVI file error.")
+#define M_ERR_138_SUBMSG_1       MIL_TEXT("No suitable codec found.")
+#define M_ERR_138_SUBMSG_2       MIL_TEXT("Cannot load FFmpeg library. Make sure FFmpeg is correctly installed.")
+#define M_ERR_138_SUBMSG_3       MIL_TEXT("Unable to load FFmpeg library. Make sure FFmpeg is correctly installed.")
+#define M_ERR_138_SUBMSG_4       MIL_TEXT("Cannot decompress frame image.")
+#define M_ERR_138_SUBMSG_5       MIL_TEXT("No Video stream found")
+#define M_ERR_138_SUBMSG_6       MIL_TEXT("Invalid pixel format.")
+#define M_ERR_138_SUBMSG_7       MIL_TEXT("FFmpeg version mismatch. Please install FFmpeg Version 0.8")
+#define M_ERR_138_SUBMSG_8       NO_SUBMSG
+#define M_ERR_138_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_27 139L
+#define M_ERR_139_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_139_SUBMSG_1       MIL_TEXT("Not enough parameters packed for the function.")
+#define M_ERR_139_SUBMSG_2       MIL_TEXT("Too many parameters packed for the function.")
+#define M_ERR_139_SUBMSG_3       MIL_TEXT("If MaxNumNeighbors is set to 0, ObjectLabelOrIndexArray, ObjectPosXOrDistArray and ObjectPosYArray must be M_NULL.")
+#define M_ERR_139_SUBMSG_4       MIL_TEXT("When using M_POINT_AND_DISTANCE, Param1 must be strictly positive.")
+#define M_ERR_139_SUBMSG_5       MIL_TEXT("When using M_POINT_AND_DISTANCE, Param2 must be set to M_NULL.")
+#define M_ERR_139_SUBMSG_6       MIL_TEXT("When using M_RECTANGLE_SELECTION, ObjectPosXOrDistArray and ObjectPosYArray must be set to M_NULL.")
+#define M_ERR_139_SUBMSG_7       MIL_TEXT("When Operation is set to M_RECTANGLE_SELECTION, M_SORT_BY_ASCENDING_DISTANCE cannot be used.")
+#define M_ERR_139_SUBMSG_8       MIL_TEXT("When Operation is set to M_RECTANGLE_SELECTION, M_RETURN_DISTANCE and M_RETURN_X cannot be used.")
+#define M_ERR_139_SUBMSG_9       MIL_TEXT("ResultOutputUnits cannot be set to M_WORLD because no calibration context is available.")
+
+#define M_INVALID_PARAM_ERROR_28 140L
+#define M_ERR_140_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_140_SUBMSG_1       MIL_TEXT("ResultOutputUnits cannot be set to M_WORLD because the calibration context is not calibrated.")
+#define M_ERR_140_SUBMSG_2       MIL_TEXT("A calibration context is needed because some graphic objects use world units.")
+#define M_ERR_140_SUBMSG_3       MIL_TEXT("The given calibration context is not calibrated and is needed for some graphic objects.")
+#define M_ERR_140_SUBMSG_4       MIL_TEXT("CondHigh must be greater or equal to CondLow.")
+#define M_ERR_140_SUBMSG_5       MIL_TEXT("Invalid LUT size.")
+#define M_ERR_140_SUBMSG_6       MIL_TEXT("MgraSymbols() only supports positions as MIL_DOUBLE in this version. Do you have a system with mixed versions?")
+#define M_ERR_140_SUBMSG_7       MIL_TEXT("Invalid type of graphic object.")
+#define M_ERR_140_SUBMSG_8       MIL_TEXT("Queued results are deprecated. Result pointer cannot be NULL.")
+#define M_ERR_140_SUBMSG_9       MIL_TEXT("This graphic object type does not support the ControlType.")
+
+#define M_INVALID_PARAM_ERROR_29 141L
+#define M_ERR_141_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_141_SUBMSG_1       MIL_TEXT("Parameter 1 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_2       MIL_TEXT("Parameter 2 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_3       MIL_TEXT("Parameter 3 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_4       MIL_TEXT("Parameter 4 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_5       MIL_TEXT("Parameter 5 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_6       MIL_TEXT("Parameter 6 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_7       MIL_TEXT("Parameter 7 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_8       MIL_TEXT("Parameter 8 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_9       MIL_TEXT("Parameter 9 must be set to M_NULL.")
+
+#define M_DIRECTX_SERVICE_ERROR  142L
+#define M_ERR_142_MSG            MIL_TEXT("DirectX service error.")
+#define M_ERR_142_SUBMSG_1       MIL_TEXT("Cannot load MilDirectX DLL.")
+#define M_ERR_142_SUBMSG_2       MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_142_SUBMSG_3       MIL_TEXT("Cannot find AppAlloc function in MilDirectX.")
+#define M_ERR_142_SUBMSG_4       MIL_TEXT("Cannot find AppFree function in MilDirectX.")
+#define M_ERR_142_SUBMSG_5       MIL_TEXT("DirectX is needed, but the DirectX-based Display Service is not installed.")
+#define M_ERR_142_SUBMSG_6       NO_SUBMSG
+#define M_ERR_142_SUBMSG_7       NO_SUBMSG
+#define M_ERR_142_SUBMSG_8       NO_SUBMSG
+#define M_ERR_142_SUBMSG_9       NO_SUBMSG
+
+#define M_CODEC_ENGINE_SERVICE_ERROR 143L
+#define M_ERR_143_MSG            MIL_TEXT("Sequence context error.")
+#define M_ERR_143_SUBMSG_1       MIL_TEXT("Cannot load codec engine DLL.")
+#define M_ERR_143_SUBMSG_2       MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_143_SUBMSG_3       MIL_TEXT("Cannot initialize requested codec implementation.")
+#define M_ERR_143_SUBMSG_4       MIL_TEXT("Failed allocating requested container.")
+#define M_ERR_143_SUBMSG_5       MIL_TEXT("Cannot feed buffer, because process is not started.")
+#define M_ERR_143_SUBMSG_6       MIL_TEXT("Warning!: Some encoding settings are incompatible. The problematic settings have been modified internally.")
+#define M_ERR_143_SUBMSG_7       MIL_TEXT("Invalid context parameters.")
+#define M_ERR_143_SUBMSG_8       MIL_TEXT("Failed allocating internal memory.")
+#define M_ERR_143_SUBMSG_9       NO_SUBMSG
+
+#define M_MISSING_M_DISP_ERROR    144L
+#define M_ERR_144_MSG             MIL_TEXT("This function requires the image to have the M_DISP attribute")
+#define M_ERR_144_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_144_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_144_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_144_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_144_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_144_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_144_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_144_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_144_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_MISSING_M_PROC_ERROR    145L
+#define M_ERR_145_MSG             MIL_TEXT("This function requires the image to have the M_PROC attribute")
+#define M_ERR_145_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_145_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_145_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_145_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_145_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_145_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_145_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_145_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_145_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_MISSING_M_GRAB_ERROR    146L
+#define M_ERR_146_MSG             MIL_TEXT("This function requires the image to have the M_GRAB attribute")
+#define M_ERR_146_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_146_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_146_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_146_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_146_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_146_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_146_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_146_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_146_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_INVALID_PARAM_ERROR_30 147L
+#define M_ERR_147_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_147_SUBMSG_1       MIL_TEXT("Y2Ptr parameter must be null when using M_INFINITE_LINES_A_B_C.")
+#define M_ERR_147_SUBMSG_2       MIL_TEXT("X1Ptr and Y1Ptr cannot be null if the number of line is greater than zero.")
+#define M_ERR_147_SUBMSG_3       MIL_TEXT("X2Ptr and Y2Ptr cannot be null drawing this type of lines.")
+#define M_ERR_147_SUBMSG_4       MIL_TEXT("Cannot pass a M_NULL graphic context except for M_CANCEL.")
+#define M_ERR_147_SUBMSG_5       MIL_TEXT("A graphic context with M_INPUT_UNITS set to M_WORLD is not supported for this function.")
+#define M_ERR_147_SUBMSG_6       MIL_TEXT("An intensity and/or angle buffer(s) must be specified.")
+#define M_ERR_147_SUBMSG_7       MIL_TEXT("Parameter 2 cannot be set to M_NULL for this operation.")
+#define M_ERR_147_SUBMSG_8       MIL_TEXT("InsertLocation is not a valid index or label in the destination graphics list.")
+#define M_ERR_147_SUBMSG_9       MIL_TEXT("NumberOfGraObjects must not be negative.")
+
+#define M_ALLOC_ERROR_7          148L
+#define M_ERR_148_MSG            MIL_TEXT("Allocation error.")
+#define M_ERR_148_SUBMSG_1       MIL_TEXT("Invalid Cluster Manager Server name passed as an argument to MappAlloc.")
+#define M_ERR_148_SUBMSG_2       MIL_TEXT("Internal Cluster Manager Server connection error.")
+#define M_ERR_148_SUBMSG_3       MIL_TEXT("Distributed MIL DLL cannot be loaded.")
+#define M_ERR_148_SUBMSG_4       MIL_TEXT("Not enough host memory to allocate buffer.\nCannot allocate temporary buffers in memory.")
+#define M_ERR_148_SUBMSG_5       MIL_TEXT("Cannot allocate digitizer.\nCannot allocate temporary buffers in memory.")
+#define M_ERR_148_SUBMSG_6       MIL_TEXT("Unable to create the compressed buffer using the given data.")
+#define M_ERR_148_SUBMSG_7       MIL_TEXT("Invalid reference ID.")
+#define M_ERR_148_SUBMSG_8       MIL_TEXT("Cannot allocate object.")
+#define M_ERR_148_SUBMSG_9       MIL_TEXT("Digitizer is not compatible with M_3D_SCENE.")
+
+#define M_DIG_SERVICE_ERROR      149L
+#define M_ERR_149_MSG            MIL_TEXT("Digitizer service error.")
+#define M_ERR_149_SUBMSG_1       MIL_TEXT("Cannot load MilDig DLL.")
+#define M_ERR_149_SUBMSG_2       MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_149_SUBMSG_3       MIL_TEXT("Cannot find AppAlloc function in MilDig.")
+#define M_ERR_149_SUBMSG_4       MIL_TEXT("Cannot find AppFree function in MilDig.")
+#define M_ERR_149_SUBMSG_5       NO_SUBMSG
+#define M_ERR_149_SUBMSG_6       NO_SUBMSG
+#define M_ERR_149_SUBMSG_7       NO_SUBMSG
+#define M_ERR_149_SUBMSG_8       NO_SUBMSG
+#define M_ERR_149_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_31 150L
+#define M_ERR_150_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_150_SUBMSG_1       MIL_TEXT("When NumberOfGraObjects is set to M_ALL, SrcIndexOrLabelArrayPtr must be set to M_NULL.")
+#define M_ERR_150_SUBMSG_2       MIL_TEXT("SrcIndexOrLabelArrayPtr must not be set to M_NULL.")
+#define M_ERR_150_SUBMSG_3       MIL_TEXT("Invalid index of label in the array SrcIndexOrLabelArrayPtr.")
+#define M_ERR_150_SUBMSG_4       MIL_TEXT("When Operation is set to M_MOVE, the same label or index must not appear more than once in the array SrcIndexOrLabelArrayPtr.")
+#define M_ERR_150_SUBMSG_5       MIL_TEXT("For inplace move operations, the InsertLocation must not appear in the array SrcIndexOrLabelArrayPtr.")
+#define M_ERR_150_SUBMSG_6       MIL_TEXT("Inquire to M_INIT_FLAG is deprecated, please use M_EXTENDED_INIT_FLAG.")
+#define M_ERR_150_SUBMSG_7       MIL_TEXT("Invalid ExtremeType. Are you using M_MIN/M_MAX instead of M_MIN_VALUE/M_MAX_VALUE?")
+#define M_ERR_150_SUBMSG_8       MIL_TEXT("Invalid InitFlag.")
+#define M_ERR_150_SUBMSG_9       MIL_TEXT("Region are not allowed on LUT destination.")
+
+#define M_LICENSING_ERROR_3      151L
+#define M_ERR_151_MSG            MIL_TEXT("Licensing error.")
+#define M_ERR_151_SUBMSG_1       MIL_TEXT("MIL requires a Matrox Imaging board or a valid license.")
+#define M_ERR_151_SUBMSG_2       MIL_TEXT("An expired context file is being used. This file is no longer usable.")
+#define M_ERR_151_SUBMSG_3       NO_SUBMSG
+#define M_ERR_151_SUBMSG_4       NO_SUBMSG
+#define M_ERR_151_SUBMSG_5       NO_SUBMSG
+#define M_ERR_151_SUBMSG_6       NO_SUBMSG
+#define M_ERR_151_SUBMSG_7       NO_SUBMSG
+#define M_ERR_151_SUBMSG_8       NO_SUBMSG
+#define M_ERR_151_SUBMSG_9       NO_SUBMSG
+
+#define M_APP_TRACE_ERROR_1      152L
+#define M_ERR_152_MSG            MIL_TEXT("MappTrace error.")
+#define M_ERR_152_SUBMSG_1       MIL_TEXT("TraceTag value must be between 0 and 255.")
+#define M_ERR_152_SUBMSG_2       MIL_TEXT("Call with M_TRACE_SECTION_END TraceType for this TraceTag doesn't match the last section start.")
+#define M_ERR_152_SUBMSG_3       MIL_TEXT("Call with M_TRACE_SECTION_END TraceType must be preceded by a call with M_TRACE_SECTION_START.")
+#define M_ERR_152_SUBMSG_4       MIL_TEXT("TraceValue must be M_DEFAULT or a color defined using M_RGB888().")
+#define M_ERR_152_SUBMSG_5       NO_SUBMSG
+#define M_ERR_152_SUBMSG_6       NO_SUBMSG
+#define M_ERR_152_SUBMSG_7       NO_SUBMSG
+#define M_ERR_152_SUBMSG_8       NO_SUBMSG
+#define M_ERR_152_SUBMSG_9       NO_SUBMSG
+
+#define M_SET_REGION_ERROR_2     153L
+#define M_ERR_153_MSG            MIL_TEXT("Region error.")
+#define M_ERR_153_SUBMSG_1       MIL_TEXT("Cannot change a parent's region from a linked child.")
+#define M_ERR_153_SUBMSG_2       MIL_TEXT("The image buffer does not have a parent to link to.")
+#define M_ERR_153_SUBMSG_3       MIL_TEXT("Region cannot be set on a YUV buffer with subsampled bands.")
+#define M_ERR_153_SUBMSG_4       NO_SUBMSG
+#define M_ERR_153_SUBMSG_5       NO_SUBMSG
+#define M_ERR_153_SUBMSG_6       NO_SUBMSG
+#define M_ERR_153_SUBMSG_7       NO_SUBMSG
+#define M_ERR_153_SUBMSG_8       NO_SUBMSG
+#define M_ERR_153_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_32 154L
+#define M_ERR_154_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_154_SUBMSG_1       MIL_TEXT("Invalid ControlType.")
+#define M_ERR_154_SUBMSG_2       MIL_TEXT("Invalid InquireType.")
+#define M_ERR_154_SUBMSG_3       MIL_TEXT("Invalid ErrorType.")
+#define M_ERR_154_SUBMSG_4       MIL_TEXT("Invalid SystemDescriptor format.")
+#define M_ERR_154_SUBMSG_5       MIL_TEXT("Invalid ConnectionDescriptor format.")
+#define M_ERR_154_SUBMSG_6       MIL_TEXT("Invalid SequenceType.")
+#define M_ERR_154_SUBMSG_7       MIL_TEXT("Invalid SequenceIndex.")
+#define M_ERR_154_SUBMSG_8       MIL_TEXT("Invalid ID.")
+#define M_ERR_154_SUBMSG_9       MIL_TEXT("The non-paged memory manager is not installed.")
+
+#define M_FUNC_CALL_ERROR_2      155L
+#define M_ERR_155_MSG            MIL_TEXT("Function call error.")
+#define M_ERR_155_SUBMSG_1       MIL_TEXT("Cannot load DLL implementing this function.")
+#define M_ERR_155_SUBMSG_2       MIL_TEXT("No module name passed")
+#define M_ERR_155_SUBMSG_3       MIL_TEXT("No function name passed")
+#define M_ERR_155_SUBMSG_4       MIL_TEXT("Opcode not found in the function table.")
+#define M_ERR_155_SUBMSG_5       NO_SUBMSG
+#define M_ERR_155_SUBMSG_6       NO_SUBMSG
+#define M_ERR_155_SUBMSG_7       NO_SUBMSG
+#define M_ERR_155_SUBMSG_8       NO_SUBMSG
+#define M_ERR_155_SUBMSG_9       NO_SUBMSG
+
+#define M_DIG_ALLOC_ERROR        156L
+#define M_ERR_156_MSG            MIL_TEXT("Cannot allocate digitizer.")
+#define M_ERR_156_SUBMSG_1       MIL_TEXT("Software emulated grab is not supported on this system.")
+#define M_ERR_156_SUBMSG_2       NO_SUBMSG
+#define M_ERR_156_SUBMSG_3       NO_SUBMSG
+#define M_ERR_156_SUBMSG_4       NO_SUBMSG
+#define M_ERR_156_SUBMSG_5       NO_SUBMSG
+#define M_ERR_156_SUBMSG_6       NO_SUBMSG
+#define M_ERR_156_SUBMSG_7       NO_SUBMSG
+#define M_ERR_156_SUBMSG_8       NO_SUBMSG
+#define M_ERR_156_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_33 157L
+#define M_ERR_157_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_157_SUBMSG_1       MIL_TEXT("Invalid image processing context. Its context type must be an M_WAVELET_TRANSFORM_CUSTOM_CONTEXT.")
+#define M_ERR_157_SUBMSG_2       MIL_TEXT("Invalid control flag. Must be set to M_DEFAULT.")
+#define M_ERR_157_SUBMSG_3       MIL_TEXT("Invalid filters buffers MIL_ID : they can't all be null.")
+#define M_ERR_157_SUBMSG_4       MIL_TEXT("Invalid filters buffers attributes : they all must be M_KERNEL.")
+#define M_ERR_157_SUBMSG_5       MIL_TEXT("All the filters buffers types must be 32 + M_FLOAT.")
+#define M_ERR_157_SUBMSG_6       MIL_TEXT("All the filters buffers sizes must be the same.")
+#define M_ERR_157_SUBMSG_7       MIL_TEXT("The band parameter is invalid.")
+#define M_ERR_157_SUBMSG_8       MIL_TEXT("All the filters kernels must have SizeY set to 1.")
+#define M_ERR_157_SUBMSG_9       MIL_TEXT("Source and destination buffers must be of the same type and pixel depth.")
+
+#define M_WAV_VALIDATION_ERROR   158L
+#define M_ERR_158_MSG            MIL_TEXT("Invalid Custom Wavelet.")
+#define M_ERR_158_SUBMSG_1       MIL_TEXT("All the custom filters must have the same size.")
+#define M_ERR_158_SUBMSG_2       MIL_TEXT("The perfect reconstruction condition is not verified with the used custom wavelet.")
+#define M_ERR_158_SUBMSG_3       NO_SUBMSG
+#define M_ERR_158_SUBMSG_4       NO_SUBMSG
+#define M_ERR_158_SUBMSG_5       NO_SUBMSG
+#define M_ERR_158_SUBMSG_6       NO_SUBMSG
+#define M_ERR_158_SUBMSG_7       NO_SUBMSG
+#define M_ERR_158_SUBMSG_8       NO_SUBMSG
+#define M_ERR_158_SUBMSG_9       NO_SUBMSG
+
+#define M_WAV_DENOISE_ERROR      159L
+#define M_ERR_159_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_159_SUBMSG_1       MIL_TEXT("Invalid wavelet context.")
+#define M_ERR_159_SUBMSG_2       MIL_TEXT("Invalid denoising type.")
+#define M_ERR_159_SUBMSG_3       MIL_TEXT("NbLevels must be positive.")
+#define M_ERR_159_SUBMSG_4       MIL_TEXT("Invalid control flag. Must be set to M_DEFAULT.")
+#define M_ERR_159_SUBMSG_5       MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_159_SUBMSG_6       MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_159_SUBMSG_7       NO_SUBMSG
+#define M_ERR_159_SUBMSG_8       NO_SUBMSG
+#define M_ERR_159_SUBMSG_9       NO_SUBMSG
+
+#define M_WAVE_TRANSFORM_ERROR   160L
+#define M_ERR_160_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_160_SUBMSG_1       MIL_TEXT("Invalid wavelet context.")
+#define M_ERR_160_SUBMSG_2       MIL_TEXT("Invalid transformation type.")
+#define M_ERR_160_SUBMSG_3       MIL_TEXT("NbLevels must be positive.")
+#define M_ERR_160_SUBMSG_4       MIL_TEXT("Invalid control flag. Must be set to M_DEFAULT.")
+#define M_ERR_160_SUBMSG_5       MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_160_SUBMSG_6       MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_160_SUBMSG_7       MIL_TEXT("Context and result must be on the same system.")
+#define M_ERR_160_SUBMSG_8       MIL_TEXT("The context must be set to M_NULL for the copy operation.")
+#define M_ERR_160_SUBMSG_9       MIL_TEXT("The filters of the custom wavelet are not defined. Use MimWaveletSetFilter.")
+
+#define M_WAVE_TRANSFORM_COMB    161L
+#define M_ERR_161_MSG            MIL_TEXT("Invalid parameter combination.")
+#define M_ERR_161_SUBMSG_1       MIL_TEXT("Source and destination can't be both images.")
+#define M_ERR_161_SUBMSG_2       MIL_TEXT("NbLevels must be > 0.")
+#define M_ERR_161_SUBMSG_3       MIL_TEXT("Invalid transformation type.")
+#define M_ERR_161_SUBMSG_4       MIL_TEXT("NbLevels must be 0 or M_DEFAULT.")
+#define M_ERR_161_SUBMSG_5       MIL_TEXT("Image size is not compatible with the decomposition level.")
+#define M_ERR_161_SUBMSG_6       MIL_TEXT("For the copy of a wavelet result, NbLevels and the number of level in the source wavelet result should be the same.")
+#define M_ERR_161_SUBMSG_7       MIL_TEXT("The decomposition level of the source and the destination are not compatible with the transformation type.")
+#define M_ERR_161_SUBMSG_8       MIL_TEXT("The wavelet context and the source wavelet result don't match.")
+#define M_ERR_161_SUBMSG_9       MIL_TEXT("The source wavelet result is empty.")
+
+#define M_MIM_GET_RES_SINGLE     162L
+#define M_ERR_162_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_162_SUBMSG_1       MIL_TEXT("This Wavelet result has no quadrants (Nblevels = 0).")
+#define M_ERR_162_SUBMSG_2       MIL_TEXT("This Wavelet result doesn't not contain the quadrant you are asking for.")
+#define M_ERR_162_SUBMSG_3       MIL_TEXT("This Wavelet has no imaginary decomposition.")
+#define M_ERR_162_SUBMSG_4       NO_SUBMSG
+#define M_ERR_162_SUBMSG_5       NO_SUBMSG
+#define M_ERR_162_SUBMSG_6       NO_SUBMSG
+#define M_ERR_162_SUBMSG_7       NO_SUBMSG
+#define M_ERR_162_SUBMSG_8       NO_SUBMSG
+#define M_ERR_162_SUBMSG_9       NO_SUBMSG
+
+#define M_MIM_DRAW_WAVELET       163L
+#define M_ERR_163_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_163_SUBMSG_1       MIL_TEXT("This Wavelet has no imaginary decomposition.")
+#define M_ERR_163_SUBMSG_2       MIL_TEXT("The drawn image must have the same number of band that the source image used to compute the wavelet result have.")
+#define M_ERR_163_SUBMSG_3       MIL_TEXT("The wavelet result is empty.")
+#define M_ERR_163_SUBMSG_4       NO_SUBMSG
+#define M_ERR_163_SUBMSG_5       NO_SUBMSG
+#define M_ERR_163_SUBMSG_6       NO_SUBMSG
+#define M_ERR_163_SUBMSG_7       NO_SUBMSG
+#define M_ERR_163_SUBMSG_8       NO_SUBMSG
+#define M_ERR_163_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_34 164L
+#define M_ERR_164_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_164_SUBMSG_1       MIL_TEXT("Cannot create an M_NON_PAGED buffer with null pointers.")
+#define M_ERR_164_SUBMSG_2       MIL_TEXT("Can only create a M_NON_PAGED buffer with a physical address.")
+#define M_ERR_164_SUBMSG_3       MIL_TEXT("Invalid Command.")
+#define M_ERR_164_SUBMSG_4       MIL_TEXT("Invalid CommandFlag.")
+#define M_ERR_164_SUBMSG_5       MIL_TEXT("Number of tiles cannot exceed buffer size.")
+#define M_ERR_164_SUBMSG_6       MIL_TEXT("Angle value must be between -360 and 720.")
+#define M_ERR_164_SUBMSG_7       MIL_TEXT("Invalid path.")
+#define M_ERR_164_SUBMSG_8       MIL_TEXT("Operation not supported on 32-bit integral buffers.")
+#define M_ERR_164_SUBMSG_9       MIL_TEXT("Calibration not supported on source buffer, consider using a child buffer.")
+
+#define M_WAV_DENOISE_COMB       165L
+#define M_ERR_165_MSG            MIL_TEXT("Invalid parameter combination.")
+#define M_ERR_165_SUBMSG_1       MIL_TEXT("Source and destination must be both images or wavelet results.")
+#define M_ERR_165_SUBMSG_2       MIL_TEXT("Wavelet context can't be NULL.")
+#define M_ERR_165_SUBMSG_3       MIL_TEXT("NbLevels must be > 0.")
+#define M_ERR_165_SUBMSG_4       MIL_TEXT("Image size is not compatible with the decomposition level.")
+#define M_ERR_165_SUBMSG_5       MIL_TEXT("Wavelet context must be NULL.")
+#define M_ERR_165_SUBMSG_6       MIL_TEXT("NbLevels must be M_DEFAULT.")
+#define M_ERR_165_SUBMSG_7       MIL_TEXT("Context and result must be on the same system.")
+#define M_ERR_165_SUBMSG_8       MIL_TEXT("The wavelet used for decomposition can't be complex.")
+#define M_ERR_165_SUBMSG_9       MIL_TEXT("The source result is empty.")
+
+#define M_WAV_DENOISE_COMB2      166L
+#define M_ERR_166_MSG            MIL_TEXT("Invalid parameter combination.")
+#define M_ERR_166_SUBMSG_1       MIL_TEXT("The wavelet used and the denoising method don't match.")
+#define M_ERR_166_SUBMSG_2       NO_SUBMSG
+#define M_ERR_166_SUBMSG_3       NO_SUBMSG
+#define M_ERR_166_SUBMSG_4       NO_SUBMSG
+#define M_ERR_166_SUBMSG_5       NO_SUBMSG
+#define M_ERR_166_SUBMSG_6       NO_SUBMSG
+#define M_ERR_166_SUBMSG_7       NO_SUBMSG
+#define M_ERR_166_SUBMSG_8       NO_SUBMSG
+#define M_ERR_166_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_COMB_1       167L
+#define M_ERR_167_MSG            MIL_TEXT("Invalid parameter combination.")
+#define M_ERR_167_SUBMSG_1       MIL_TEXT("Maximum cannot be inferior to minimum.")
+#define M_ERR_167_SUBMSG_2       MIL_TEXT("Second pass parameters and their counterpart cannot have the same values.")
+#define M_ERR_167_SUBMSG_3       MIL_TEXT("Source and threshold destination must have the same type.")
+#define M_ERR_167_SUBMSG_4       NO_SUBMSG
+#define M_ERR_167_SUBMSG_5       NO_SUBMSG
+#define M_ERR_167_SUBMSG_6       NO_SUBMSG
+#define M_ERR_167_SUBMSG_7       NO_SUBMSG
+#define M_ERR_167_SUBMSG_8       NO_SUBMSG
+#define M_ERR_167_SUBMSG_9       NO_SUBMSG
+
+#define M_SEQUENCE_CONTEXT_WARNING   168L
+#define M_ERR_168_MSG            MIL_TEXT("Sequence context warning.")
+#define M_ERR_168_SUBMSG_1       MIL_TEXT("Some encoding settings are incompatible. The problematic settings have been modified internally.")
+#define M_ERR_168_SUBMSG_2       NO_SUBMSG
+#define M_ERR_168_SUBMSG_3       NO_SUBMSG
+#define M_ERR_168_SUBMSG_4       NO_SUBMSG
+#define M_ERR_168_SUBMSG_5       NO_SUBMSG
+#define M_ERR_168_SUBMSG_6       NO_SUBMSG
+#define M_ERR_168_SUBMSG_7       NO_SUBMSG
+#define M_ERR_168_SUBMSG_8       NO_SUBMSG
+#define M_ERR_168_SUBMSG_9       NO_SUBMSG
+
+#define M_RUNTIME_ERROR          169L
+#define M_ERR_169_MSG            MIL_TEXT("Undefined error")
+#define M_ERR_169_SUBMSG_1       MIL_TEXT("Default CAPI error")
+#define M_ERR_169_SUBMSG_2       NO_SUBMSG
+#define M_ERR_169_SUBMSG_3       NO_SUBMSG
+#define M_ERR_169_SUBMSG_4       NO_SUBMSG
+#define M_ERR_169_SUBMSG_5       NO_SUBMSG
+#define M_ERR_169_SUBMSG_6       NO_SUBMSG
+#define M_ERR_169_SUBMSG_7       NO_SUBMSG
+#define M_ERR_169_SUBMSG_8       NO_SUBMSG
+#define M_ERR_169_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_35 170L
+#define M_ERR_170_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_170_SUBMSG_1       MIL_TEXT("Invalid result type.")
+#define M_ERR_170_SUBMSG_2       MIL_TEXT("The LUT buffer must have 3 bands.")
+#define M_ERR_170_SUBMSG_3       MIL_TEXT("The LUT buffer must be M_UNSIGNED or M_FLOAT.")
+#if MIL_COMPILE_VERSION < 1040
+#define M_ERR_170_SUBMSG_4       MIL_TEXT("Parameters 3 to 8 must be set to M_DEFAULT.") // moved to M_INVALID_PARAM_ERROR_43 Can reuse after PP4 release
+#else
+#define M_ERR_170_SUBMSG_4       NO_SUBMSG
+#endif
+#define M_ERR_170_SUBMSG_5       MIL_TEXT("For compressed buffers, the min value must be 0.")
+#define M_ERR_170_SUBMSG_6       MIL_TEXT("For 8-bit JPEG buffers, the max value must be 255.")
+#define M_ERR_170_SUBMSG_7       MIL_TEXT("For 16-bit JPEG buffers, the max value must be 65535.")
+#define M_ERR_170_SUBMSG_8       MIL_TEXT("For MPEG4 buffers, the max value must be 255.")
+#define M_ERR_170_SUBMSG_9       MIL_TEXT("For H264 buffers, the max value must be 255.")
+
+#define M_FILE_OPERATION_ERROR_3 171L
+#define M_ERR_171_MSG            MIL_TEXT("File operation error.")
+#define M_ERR_171_SUBMSG_1       MIL_TEXT("Unsupported operation on this platform.")
+#define M_ERR_171_SUBMSG_2       MIL_TEXT("User DLL path is not available.")
+#define M_ERR_171_SUBMSG_3       NO_SUBMSG
+#define M_ERR_171_SUBMSG_4       NO_SUBMSG
+#define M_ERR_171_SUBMSG_5       NO_SUBMSG
+#define M_ERR_171_SUBMSG_6       NO_SUBMSG
+#define M_ERR_171_SUBMSG_7       NO_SUBMSG
+#define M_ERR_171_SUBMSG_8       NO_SUBMSG
+#define M_ERR_171_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_INQUIRE        172L
+#define M_ERR_172_MSG            MIL_TEXT("Invalid inquire.")
+#define M_ERR_172_SUBMSG_1       MIL_TEXT("The pitch is not a multiple of the pixel size. Only M_PITCH_BYTE can be safely used.")
+#define M_ERR_172_SUBMSG_2       MIL_TEXT("Unsupported under this OS")
+#define M_ERR_172_SUBMSG_3       NO_SUBMSG
+#define M_ERR_172_SUBMSG_4       NO_SUBMSG
+#define M_ERR_172_SUBMSG_5       NO_SUBMSG
+#define M_ERR_172_SUBMSG_6       NO_SUBMSG
+#define M_ERR_172_SUBMSG_7       NO_SUBMSG
+#define M_ERR_172_SUBMSG_8       NO_SUBMSG
+#define M_ERR_172_SUBMSG_9       NO_SUBMSG
+
+#define M_MONITORING_ERROR       173L
+#define M_ERR_173_MSG            MIL_TEXT("DMIL Monitoring error.")
+#define M_ERR_173_SUBMSG_1       MIL_TEXT("Cannot load Milnetworkserver DLL.")
+#define M_ERR_173_SUBMSG_2       MIL_TEXT("Function not exported.")
+#define M_ERR_173_SUBMSG_3       NO_SUBMSG
+#define M_ERR_173_SUBMSG_4       NO_SUBMSG
+#define M_ERR_173_SUBMSG_5       NO_SUBMSG
+#define M_ERR_173_SUBMSG_6       NO_SUBMSG
+#define M_ERR_173_SUBMSG_7       NO_SUBMSG
+#define M_ERR_173_SUBMSG_8       NO_SUBMSG
+#define M_ERR_173_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_36 174L
+#define M_ERR_174_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_174_SUBMSG_1       MIL_TEXT("For 8-bit JPEG2000 buffers, the max value must be 255.")
+#define M_ERR_174_SUBMSG_2       MIL_TEXT("For 16-bit JPEG2000 buffers, the max value can only be 511, 1023, 2047, 4095, 8191, 16383, 32767 or 65535.")
+#define M_ERR_174_SUBMSG_3       MIL_TEXT("For 8-bit JPEG buffers, the effective size bit must be 8.")
+#define M_ERR_174_SUBMSG_4       MIL_TEXT("For 16-bit JPEG buffers, the effective size bit must be 16.")
+#define M_ERR_174_SUBMSG_5       MIL_TEXT("For MPEG4 buffers, the effective size bit must be 8.")
+#define M_ERR_174_SUBMSG_6       MIL_TEXT("For H264 buffers, the effective size bit must be 8.")
+#define M_ERR_174_SUBMSG_7       MIL_TEXT("For 8-bit JPEG2000 buffers, the effective size bit must be 8.")
+#define M_ERR_174_SUBMSG_8       MIL_TEXT("For 16-bit JPEG2000 buffers, the effective size bit cannot be less than 9 or greater than 16.")
+#define M_ERR_174_SUBMSG_9       MIL_TEXT("Center position at M_DEFAULT are not supported when generating a warp matrix.")
+
+#define M_DISPLAY_ERROR2         175L
+#define M_ERR_175_MSG            MIL_TEXT("Display error.")
+#define M_ERR_175_SUBMSG_1       MIL_TEXT("The display and the LUT must be allocated on the same system.")
+#define M_ERR_175_SUBMSG_2       NO_SUBMSG
+#define M_ERR_175_SUBMSG_3       NO_SUBMSG
+#define M_ERR_175_SUBMSG_4       NO_SUBMSG
+#define M_ERR_175_SUBMSG_5       NO_SUBMSG
+#define M_ERR_175_SUBMSG_6       NO_SUBMSG
+#define M_ERR_175_SUBMSG_7       NO_SUBMSG
+#define M_ERR_175_SUBMSG_8       NO_SUBMSG
+#define M_ERR_175_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_37 176L
+#define M_ERR_176_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_176_SUBMSG_1       MIL_TEXT("Invalid destination Size or Type.")
+#define M_ERR_176_SUBMSG_2       MIL_TEXT("M_FILL_DESTINATION is not supported when generating a warp matrix.")
+#define M_ERR_176_SUBMSG_3       MIL_TEXT("Destination image must be 32-bit with the same type as the source.")
+#define M_ERR_176_SUBMSG_4       MIL_TEXT("Invalid matrix specified.")
+#define M_ERR_176_SUBMSG_5       MIL_TEXT("The number of pixels must be greater than 0.")
+#define M_ERR_176_SUBMSG_6       MIL_TEXT("Invalid Reference Id")
+#define M_ERR_176_SUBMSG_7       MIL_TEXT("Invalid interpolation mode specified.")
+#define M_ERR_176_SUBMSG_8       MIL_TEXT("Invalid ObjectType.")
+#define M_ERR_176_SUBMSG_9       MIL_TEXT("Unsupported operation flag.")
+
+#define M_OPERATION_ERROR_10     177L
+#define M_ERR_177_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_177_SUBMSG_1       MIL_TEXT("Cannot remove object from group.")
+#define M_ERR_177_SUBMSG_2       MIL_TEXT("Message queue is full.")
+#define M_ERR_177_SUBMSG_3       MIL_TEXT("Message write failed.")
+#define M_ERR_177_SUBMSG_4       MIL_TEXT("Message write timeout.")
+#define M_ERR_177_SUBMSG_5       MIL_TEXT("Cannot end update without a previous start.")
+#define M_ERR_177_SUBMSG_6       MIL_TEXT("More messages present than the queue size requested.")
+#define M_ERR_177_SUBMSG_7       MIL_TEXT("Must specify an user array size.")
+#define M_ERR_177_SUBMSG_8       MIL_TEXT("Component ID invalid.")
+#define M_ERR_177_SUBMSG_9       MIL_TEXT("Buffer already in another container.")
+
+#define M_WEB_ERROR              178L
+#define M_ERR_178_MSG            MIL_TEXT("MILWeb Error.")
+#define M_ERR_178_SUBMSG_1       MIL_TEXT("Cannot load milwebserver DLL.")
+#define M_ERR_178_SUBMSG_2       MIL_TEXT("Function not exported.")
+#define M_ERR_178_SUBMSG_3       MIL_TEXT("The port must be set before enabling the connection")
+#define M_ERR_178_SUBMSG_4       MIL_TEXT("The connection mode must be set before enabling the connection")
+#define M_ERR_178_SUBMSG_5       MIL_TEXT("Object must be published before setting publish mode.")
+#define M_ERR_178_SUBMSG_6       MIL_TEXT("Cannot start the websocket server, Listenning port in use.")
+#define M_ERR_178_SUBMSG_7       MIL_TEXT("Cannot start the websocket server,")
+#define M_ERR_178_SUBMSG_8       MIL_TEXT("Server not started")
+#define M_ERR_178_SUBMSG_9       MIL_TEXT("Cannot stop the websocket server,")
+
+#define M_INVALID_PARAM_ERROR_38 179L
+#define M_ERR_179_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_179_SUBMSG_1       MIL_TEXT("Message size must be positive.")
+#define M_ERR_179_SUBMSG_2       MIL_TEXT("Timeout must be positive.")
+#define M_ERR_179_SUBMSG_3       MIL_TEXT("Queue size must be greater than 0.")
+#define M_ERR_179_SUBMSG_4       MIL_TEXT("Queue full behaviour unsupported.")
+#define M_ERR_179_SUBMSG_5       MIL_TEXT("In overwrite mode, queue size must be 1.")
+#define M_ERR_179_SUBMSG_6       MIL_TEXT("Control value must be a hook context.")
+#define M_ERR_179_SUBMSG_7       MIL_TEXT("Unsupported hook information type.")
+#define M_ERR_179_SUBMSG_8       MIL_TEXT("Condition not supported.")
+#define M_ERR_179_SUBMSG_9       MIL_TEXT("M_TYPE_STRING is not supported in this case.")
+
+#define M_INVALID_PROCESS_ERROR  180L
+#define M_ERR_180_MSG            MIL_TEXT("Invalid process")
+#define M_ERR_180_SUBMSG_1       MIL_TEXT("Using MIL in a child process after allocating an application in the parent process is unsupported.")
+#define M_ERR_180_SUBMSG_2       NO_SUBMSG
+#define M_ERR_180_SUBMSG_3       NO_SUBMSG
+#define M_ERR_180_SUBMSG_4       NO_SUBMSG
+#define M_ERR_180_SUBMSG_5       NO_SUBMSG
+#define M_ERR_180_SUBMSG_6       NO_SUBMSG
+#define M_ERR_180_SUBMSG_7       NO_SUBMSG
+#define M_ERR_180_SUBMSG_8       NO_SUBMSG
+#define M_ERR_180_SUBMSG_9       NO_SUBMSG
+
+#define M_BUF_TRANSFER_ERROR_5   181L
+#define M_ERR_181_MSG            MIL_TEXT("Transfer Error.")
+#define M_ERR_181_SUBMSG_1       MIL_TEXT("Cannot clear a specific band in a M_COMPRESS buffer. Must use M_DEFAULT for the DestinationBand parameter.")
+#define M_ERR_181_SUBMSG_2       NO_SUBMSG
+#define M_ERR_181_SUBMSG_3       NO_SUBMSG
+#define M_ERR_181_SUBMSG_4       NO_SUBMSG
+#define M_ERR_181_SUBMSG_5       NO_SUBMSG
+#define M_ERR_181_SUBMSG_6       NO_SUBMSG
+#define M_ERR_181_SUBMSG_7       NO_SUBMSG
+#define M_ERR_181_SUBMSG_8       NO_SUBMSG
+#define M_ERR_181_SUBMSG_9       NO_SUBMSG
+
+#define M_ALLOC_ERROR_8          182L
+#define M_ERR_182_MSG            MIL_TEXT("Allocation error.")
+#define M_ERR_182_SUBMSG_1       MIL_TEXT("Incompatible Reference ID.")
+#define M_ERR_182_SUBMSG_2       MIL_TEXT("Named buffer unsupported.")
+#define M_ERR_182_SUBMSG_3       MIL_TEXT("Error while allocating non-paged buffer.")
+#define M_ERR_182_SUBMSG_4       MIL_TEXT("Error while creating non-paged buffer.")
+#define M_ERR_182_SUBMSG_5       MIL_TEXT("Error while opening a named non-paged buffer.")
+#define M_ERR_182_SUBMSG_6       MIL_TEXT("Error while freeing non-paged buffer.")
+#define M_ERR_182_SUBMSG_7       MIL_TEXT("Buffer dimension is too large.")
+#define M_ERR_182_SUBMSG_8       MIL_TEXT("RLE buffer must be binary.")
+#define M_ERR_182_SUBMSG_9       MIL_TEXT("Grab to PFNC buffer unsupported.")
+
+#define M_OPERATION_ERROR_11     183L
+#define M_ERR_183_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_183_SUBMSG_1       MIL_TEXT("Buffer must reside on same system.")
+#define M_ERR_183_SUBMSG_2       MIL_TEXT("Buffer has unsupported PFNC value.")
+#define M_ERR_183_SUBMSG_3       MIL_TEXT("Added component does not have the correct buffer purpose.")
+#define M_ERR_183_SUBMSG_4       MIL_TEXT("Buffer PFNC value unsupported as a destination.")
+#define M_ERR_183_SUBMSG_5       MIL_TEXT("Fail to unmap buffer.")
+#define M_ERR_183_SUBMSG_6       MIL_TEXT("Not in a hook function.")
+#define M_ERR_183_SUBMSG_7       MIL_TEXT("Internal objects are still allocated.")
+#define M_ERR_183_SUBMSG_8       MIL_TEXT("Internal buffers are still allocated.")
+#define M_ERR_183_SUBMSG_9       MIL_TEXT("Cannot change the label when using M_ALL, it would created non-unique labels.")
+
+#define M_CONTAINER_ERROR_1      184L
+#define M_ERR_184_MSG            MIL_TEXT("Container error.")
+#define M_ERR_184_SUBMSG_1       MIL_TEXT("This system does not support the M_CONTAINER buffer object type.")
+#define M_ERR_184_SUBMSG_2       MIL_TEXT("Invalid buffer container type.")
+#define M_ERR_184_SUBMSG_3       MIL_TEXT("Software emulated grab does not support container buffer types.")
+#define M_ERR_184_SUBMSG_4       MIL_TEXT("Invalid destination image list size. Use M_DEFAULT with container objects.")
+#define M_ERR_184_SUBMSG_5       MIL_TEXT("Error copying component(s).")
+#define M_ERR_184_SUBMSG_6       MIL_TEXT("Cannot add new component.")
+#define M_ERR_184_SUBMSG_7       MIL_TEXT("Component not found.")
+#define M_ERR_184_SUBMSG_8       MIL_TEXT("More than one component found.")
+#define M_ERR_184_SUBMSG_9       MIL_TEXT("Cannot free a user added component.")
+
+#define M_INVALID_PARAM_ERROR_39 185L
+#define M_ERR_185_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_185_SUBMSG_1       MIL_TEXT("No buffer found with the provided name.")
+#define M_ERR_185_SUBMSG_2       MIL_TEXT("M_DISP not supported on container.")
+#define M_ERR_185_SUBMSG_3       MIL_TEXT("Index out of bounds.")
+#define M_ERR_185_SUBMSG_4       MIL_TEXT("M_CENTER_X and M_CENTER_Y are not supported for text.")
+#define M_ERR_185_SUBMSG_5       MIL_TEXT("Invalid number of images.")
+#define M_ERR_185_SUBMSG_6       MIL_TEXT("The value must be a positive divisor of 180.")
+#define M_ERR_185_SUBMSG_7       MIL_TEXT("For RLE buffers, the effective size bit must be 1.")
+#define M_ERR_185_SUBMSG_8       MIL_TEXT("M_SQUARE_ASPECT_RATIO is not supported for this GraphicType.")
+#define M_ERR_185_SUBMSG_9       MIL_TEXT("M_SQUARE_ASPECT_RATIO is not supported for this CreationMode.")
+
+#define M_MIL_HOOK_ERROR         186L
+#define M_ERR_186_MSG            MIL_TEXT("Hook function error.")
+#define M_ERR_186_SUBMSG_1       MIL_TEXT("Invalid object type for EventId")
+#define M_ERR_186_SUBMSG_2       NO_SUBMSG
+#define M_ERR_186_SUBMSG_3       NO_SUBMSG
+#define M_ERR_186_SUBMSG_4       NO_SUBMSG
+#define M_ERR_186_SUBMSG_5       NO_SUBMSG
+#define M_ERR_186_SUBMSG_6       NO_SUBMSG
+#define M_ERR_186_SUBMSG_7       NO_SUBMSG
+#define M_ERR_186_SUBMSG_8       NO_SUBMSG
+#define M_ERR_186_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_40 187L
+#define M_ERR_187_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_187_SUBMSG_1       MIL_TEXT("M_SECTOR is not supported for this GraphicType.")
+#define M_ERR_187_SUBMSG_2       MIL_TEXT("M_FILLED is not supported for this GraphicType.")
+#define M_ERR_187_SUBMSG_3       MIL_TEXT("M_ROTATE_AROUND_CORNER is not supported for this GraphicType.")
+#define M_ERR_187_SUBMSG_4       MIL_TEXT("M_ROTATE_AROUND_CORNER is not supported for this CreationMode.")
+#define M_ERR_187_SUBMSG_5       MIL_TEXT("Invalid CreationMode.")
+#define M_ERR_187_SUBMSG_6       MIL_TEXT("The number of vectors must be greater than 0.")
+#define M_ERR_187_SUBMSG_7       MIL_TEXT("The stride must be greater than 0.")
+#define M_ERR_187_SUBMSG_8       MIL_TEXT("The U/V buffers must be monochrome.")
+#define M_ERR_187_SUBMSG_9       MIL_TEXT("Format must be set to M_DEFAULT.")
+
+#define M_HTTP_SERVICE_ERROR     188L
+#define M_ERR_188_MSG            MIL_TEXT("Http Service Error.")
+#define M_ERR_188_SUBMSG_1       MIL_TEXT("Cannot load milhttpserver DLL.")
+#define M_ERR_188_SUBMSG_2       MIL_TEXT("Function not exported.")
+#define M_ERR_188_SUBMSG_3       NO_SUBMSG
+#define M_ERR_188_SUBMSG_4       NO_SUBMSG
+#define M_ERR_188_SUBMSG_5       NO_SUBMSG
+#define M_ERR_188_SUBMSG_6       NO_SUBMSG
+#define M_ERR_188_SUBMSG_7       NO_SUBMSG
+#define M_ERR_188_SUBMSG_8       NO_SUBMSG
+#define M_ERR_188_SUBMSG_9       NO_SUBMSG
+
+#define M_BUFFER_TYPE_ERROR      189L
+#define M_ERR_189_MSG            MIL_TEXT("Buffer type not supported.")
+#define M_ERR_189_SUBMSG_1       MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_189_SUBMSG_2       MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_189_SUBMSG_3       MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_189_SUBMSG_4       MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_189_SUBMSG_5       MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_189_SUBMSG_6       MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_189_SUBMSG_7       MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_189_SUBMSG_8       MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_189_SUBMSG_9       MIL_TEXT("Invalid parameter 9.")
+
+#define M_GRA_OPERATION_ERROR_2  190L
+#define M_ERR_190_MSG            MIL_TEXT("Drawing operation error.")
+#define M_ERR_190_SUBMSG_1       MIL_TEXT("The U/V buffers must be calibrated because this operation uses world units.")
+#define M_ERR_190_SUBMSG_2       MIL_TEXT("The U/V buffers must have the same calibration.")
+#define M_ERR_190_SUBMSG_3       NO_SUBMSG
+#define M_ERR_190_SUBMSG_4       NO_SUBMSG
+#define M_ERR_190_SUBMSG_5       NO_SUBMSG
+#define M_ERR_190_SUBMSG_6       NO_SUBMSG
+#define M_ERR_190_SUBMSG_7       NO_SUBMSG
+#define M_ERR_190_SUBMSG_8       NO_SUBMSG
+#define M_ERR_190_SUBMSG_9       NO_SUBMSG
+
+#define M_HOOK_ERROR_SPECIFIC     191L
+#define M_ERR_191_MSG             MIL_TEXT("Hook function error.")
+#define M_ERR_191_SUBMSG_1        MIL_TEXT("No driver information in hook context.")
+#define M_ERR_191_SUBMSG_2        MIL_TEXT("Unsupported buffer MIL_ID used.")
+#define M_ERR_191_SUBMSG_3        NO_SUBMSG
+#define M_ERR_191_SUBMSG_4        NO_SUBMSG
+#define M_ERR_191_SUBMSG_5        NO_SUBMSG
+#define M_ERR_191_SUBMSG_6        NO_SUBMSG
+#define M_ERR_191_SUBMSG_7        NO_SUBMSG
+#define M_ERR_191_SUBMSG_8        NO_SUBMSG
+#define M_ERR_191_SUBMSG_9        NO_SUBMSG
+
+
+#define M_WEB_ERROR_2            192L
+#define M_ERR_192_MSG            MIL_TEXT("MILWeb Error.")
+#define M_ERR_192_SUBMSG_1       MIL_TEXT("Cannot share instance of websocket server with different port or diffent publish mode.")
+#define M_ERR_192_SUBMSG_2       NO_SUBMSG
+#define M_ERR_192_SUBMSG_3       NO_SUBMSG
+#define M_ERR_192_SUBMSG_4       NO_SUBMSG
+#define M_ERR_192_SUBMSG_5       NO_SUBMSG
+#define M_ERR_192_SUBMSG_6       NO_SUBMSG
+#define M_ERR_192_SUBMSG_7       NO_SUBMSG
+#define M_ERR_192_SUBMSG_8       NO_SUBMSG
+#define M_ERR_192_SUBMSG_9       NO_SUBMSG
+
+#define M_FEATURE_BROWSER_ERROR  193L
+#define M_ERR_193_MSG            MIL_TEXT("Feature Browser Error.")
+#define M_ERR_193_SUBMSG_1       MIL_TEXT("Could not start the feature browser process. Make sure it is located in the MIL tools folder.")
+#define M_ERR_193_SUBMSG_2       NO_SUBMSG
+#define M_ERR_193_SUBMSG_3       NO_SUBMSG
+#define M_ERR_193_SUBMSG_4       NO_SUBMSG
+#define M_ERR_193_SUBMSG_5       NO_SUBMSG
+#define M_ERR_193_SUBMSG_6       NO_SUBMSG
+#define M_ERR_193_SUBMSG_7       NO_SUBMSG
+#define M_ERR_193_SUBMSG_8       NO_SUBMSG
+#define M_ERR_193_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_41 194L
+#define M_ERR_194_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_194_SUBMSG_1       MIL_TEXT("Invalid inquire type. Cannot combine M_NB_ELEMENTS with M_DEFAULT or M_SUPPORTED.")
+#define M_ERR_194_SUBMSG_2       MIL_TEXT("Invalid inquire type: M_NB_ELEMENTS cannot be used with any string inquire type.")
+#define M_ERR_194_SUBMSG_3       MIL_TEXT("Invalid result type. Cannot combine M_NB_ELEMENTS with M_DEFAULT or M_AVAILABLE.")
+#define M_ERR_194_SUBMSG_4       MIL_TEXT("Invalid result type: M_NB_ELEMENTS cannot be used with any string result type.")
+#define M_ERR_194_SUBMSG_5       MIL_TEXT("Invalid SystemNum.") 
+#define M_ERR_194_SUBMSG_6       MIL_TEXT("Driver does not support M_DEVICE_NAME.")
+#define M_ERR_194_SUBMSG_7       MIL_TEXT("Number of bands must be M_DEFAULT.") 
+#define M_ERR_194_SUBMSG_8       MIL_TEXT("Buffer must be dynamic.")
+#define M_ERR_194_SUBMSG_9       MIL_TEXT("Invalid number of band offset.")
+
+#define M_DATA_AUGMENT_ERROR     195L
+#define M_ERR_195_MSG            MIL_TEXT("Data augment error.")
+#define M_ERR_195_SUBMSG_1       MIL_TEXT("Invalid minimum and maximum values for range parameters. Minimum is not less than maximum value.")
+#define M_ERR_195_SUBMSG_2       MIL_TEXT("Invalid buffer type. Hue|Saturation|Value augmentation operates on color buffers only.")
+#define M_ERR_195_SUBMSG_3       MIL_TEXT("Invalid crop mode. Control not available with current crop mode.")
+#define M_ERR_195_SUBMSG_4       MIL_TEXT("Cannot inquire M_AUG_RNG_INIT_VALUE before preprocessing the context.")
+#define M_ERR_195_SUBMSG_5       MIL_TEXT("Dispatch internal error.")
+#define M_ERR_195_SUBMSG_6       MIL_TEXT("Invalid buffer type. Gamma Mode per band operates on color buffers only.")
+#define M_ERR_195_SUBMSG_7       MIL_TEXT("Unavailable result. Make sure the associated augmentation has been enabled.")
+#define M_ERR_195_SUBMSG_8       MIL_TEXT("Unavailable result image. Make sure you called MimAugment.")
+#define M_ERR_195_SUBMSG_9       MIL_TEXT("Invalid Destination ID, should be M_IMAGE or M_AUGMENTATION_RESULT")   
+
+#define M_INVALID_PARAM_ERROR_42 196L
+#define M_ERR_196_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_196_SUBMSG_1       MIL_TEXT("SystemNum default must be a name.")
+#define M_ERR_196_SUBMSG_2       MIL_TEXT("SystemNum default cannot be a name.")
+#define M_ERR_196_SUBMSG_3       MIL_TEXT("DigNum default must be a name.")
+#define M_ERR_196_SUBMSG_4       MIL_TEXT("DigNum default cannot be a name.")
+#define M_ERR_196_SUBMSG_5       MIL_TEXT("Cannot use remote file on local system.")
+#define M_ERR_196_SUBMSG_6       MIL_TEXT("Min must be lower or equal to Max.")
+#define M_ERR_196_SUBMSG_7       MIL_TEXT("Impossible to go from Min to Max with a k equal to 0.")
+#define M_ERR_196_SUBMSG_8       MIL_TEXT("At least one destination must be specified.")
+#define M_ERR_196_SUBMSG_9       MIL_TEXT("Destination buffers must have the same number of bands.")
+
+#define M_ALLOC_ERROR_9          197L
+#define M_ERR_197_MSG            MIL_TEXT("Allocation error.")
+#define M_ERR_197_SUBMSG_1       MIL_TEXT("M_PROC or M_DISP not supported for this PFNC value.")
+#define M_ERR_197_SUBMSG_2       MIL_TEXT("Incompatible parameters when using M_DYNAMIC.")
+#define M_ERR_197_SUBMSG_3       MIL_TEXT("Can only set PFNC for M_IMAGE.")
+#define M_ERR_197_SUBMSG_4       NO_SUBMSG
+#define M_ERR_197_SUBMSG_5       NO_SUBMSG
+#define M_ERR_197_SUBMSG_6       NO_SUBMSG
+#define M_ERR_197_SUBMSG_7       NO_SUBMSG
+#define M_ERR_197_SUBMSG_8       NO_SUBMSG
+#define M_ERR_197_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_43 198L
+#define M_ERR_198_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_198_SUBMSG_1       MIL_TEXT("Parameters 3 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_2       MIL_TEXT("Parameters 3, 5 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_3       MIL_TEXT("Parameters 4 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_4       MIL_TEXT("Parameters 5 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_5       MIL_TEXT("Parameter B must be compatible with provided buffer.")
+#define M_ERR_198_SUBMSG_6       MIL_TEXT("Parameter A must be compatible with provided buffer.")
+#define M_ERR_198_SUBMSG_7       MIL_TEXT("Parameter 10 not in supported list.")
+#define M_ERR_198_SUBMSG_8       MIL_TEXT("Parameters 6 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_9       MIL_TEXT("Parameter 3 must be smaller than parameter 4.")
+
+#define M_INVALID_PARAM_ERROR_44 199L
+#define M_ERR_199_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_199_SUBMSG_1       MIL_TEXT("Parameter 6 cannot be set to M_DEFAULT.")
+#define M_ERR_199_SUBMSG_2       MIL_TEXT("Invalid component type.")
+#define M_ERR_199_SUBMSG_3       MIL_TEXT("Invalid number of components.")
+#define M_ERR_199_SUBMSG_4       MIL_TEXT("No pitch control flag used.")
+#define M_ERR_199_SUBMSG_5       NO_SUBMSG
+#define M_ERR_199_SUBMSG_6       NO_SUBMSG
+#define M_ERR_199_SUBMSG_7       NO_SUBMSG
+#define M_ERR_199_SUBMSG_8       NO_SUBMSG
+#define M_ERR_199_SUBMSG_9       NO_SUBMSG
+
+#define M_OPERATION_ERROR_12     56200L
+#define M_ERR_200_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_200_SUBMSG_1       MIL_TEXT("Operation does not support buffers with M_MODIFY region.")
+#define M_ERR_200_SUBMSG_2       NO_SUBMSG
+#define M_ERR_200_SUBMSG_3       NO_SUBMSG
+#define M_ERR_200_SUBMSG_4       NO_SUBMSG
+#define M_ERR_200_SUBMSG_5       NO_SUBMSG
+#define M_ERR_200_SUBMSG_6       NO_SUBMSG
+#define M_ERR_200_SUBMSG_7       NO_SUBMSG
+#define M_ERR_200_SUBMSG_8       NO_SUBMSG
+#define M_ERR_200_SUBMSG_9       NO_SUBMSG
+
+
+#define M_INVALID_PARAM_ERROR_45 56201L
+#define M_ERR_201_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_201_SUBMSG_1       MIL_TEXT("Control value must be in [0.5 : 1.0].")
+#define M_ERR_201_SUBMSG_2       MIL_TEXT("Control value must be in [0.0 : 1.0].")
+#define M_ERR_201_SUBMSG_3       MIL_TEXT("Control value must be in [5 : 15].")
+#define M_ERR_201_SUBMSG_4       MIL_TEXT("Control value must be in [0.0 : 16.0].")
+#define M_ERR_201_SUBMSG_5       MIL_TEXT("Control value must be in [-MIL_DOUBLE_MAX/2 : MIL_DOUBLE_MAX/2].")
+#define M_ERR_201_SUBMSG_6       MIL_TEXT("Control value must be in [0.0 : MIL_DOUBLE_MAX/2].")
+#define M_ERR_201_SUBMSG_7       MIL_TEXT("Control value must be >= 0.")
+#define M_ERR_201_SUBMSG_8       MIL_TEXT("Control value must be in [0.0 : 100.0].")
+#define M_ERR_201_SUBMSG_9       MIL_TEXT("Control value must be in [0 : MIL_INT32_MAX].")
+
+
+#define M_SERVICE_3D_ERROR       56202L
+#define M_ERR_202_MSG            MIL_TEXT("3D service error.")
+#define M_ERR_202_SUBMSG_1       MIL_TEXT("Cannot load Mil3D DLL.")
+#define M_ERR_202_SUBMSG_2       MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_202_SUBMSG_3       NO_SUBMSG
+#define M_ERR_202_SUBMSG_4       NO_SUBMSG
+#define M_ERR_202_SUBMSG_5       NO_SUBMSG
+#define M_ERR_202_SUBMSG_6       NO_SUBMSG
+#define M_ERR_202_SUBMSG_7       NO_SUBMSG
+#define M_ERR_202_SUBMSG_8       NO_SUBMSG
+#define M_ERR_202_SUBMSG_9       NO_SUBMSG
+
+
+
+#define M_CONTAINER_ERROR_2      56203L
+#define M_ERR_203_MSG            MIL_TEXT("Container error.")
+#define M_ERR_203_SUBMSG_1       MIL_TEXT("The buffer is already in a container.")
+#define M_ERR_203_SUBMSG_2       NO_SUBMSG
+#define M_ERR_203_SUBMSG_3       NO_SUBMSG
+#define M_ERR_203_SUBMSG_4       NO_SUBMSG
+#define M_ERR_203_SUBMSG_5       NO_SUBMSG
+#define M_ERR_203_SUBMSG_6       NO_SUBMSG
+#define M_ERR_203_SUBMSG_7       NO_SUBMSG
+#define M_ERR_203_SUBMSG_8       NO_SUBMSG
+#define M_ERR_203_SUBMSG_9       NO_SUBMSG
+
+#define M_CHILD_ERROR_2          56204L
+#define M_ERR_204_MSG            MIL_TEXT("Child allocation error.")
+#define M_ERR_204_SUBMSG_1       MIL_TEXT("Cannot allocate a child on a dynamic buffer.")
+#define M_ERR_204_SUBMSG_2       NO_SUBMSG
+#define M_ERR_204_SUBMSG_3       NO_SUBMSG
+#define M_ERR_204_SUBMSG_4       NO_SUBMSG
+#define M_ERR_204_SUBMSG_5       NO_SUBMSG
+#define M_ERR_204_SUBMSG_6       NO_SUBMSG
+#define M_ERR_204_SUBMSG_7       NO_SUBMSG
+#define M_ERR_204_SUBMSG_8       NO_SUBMSG
+#define M_ERR_204_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_46 56205L
+#define M_ERR_205_MSG            NO_SUBMSG
+#define M_ERR_205_SUBMSG_1       NO_SUBMSG
+#define M_ERR_205_SUBMSG_2       NO_SUBMSG
+#define M_ERR_205_SUBMSG_3       MIL_TEXT("Control value must be in [0.0 : 10.0].")
+#define M_ERR_205_SUBMSG_4       NO_SUBMSG
+#define M_ERR_205_SUBMSG_5       NO_SUBMSG
+#define M_ERR_205_SUBMSG_6       NO_SUBMSG
+#define M_ERR_205_SUBMSG_7       NO_SUBMSG
+#define M_ERR_205_SUBMSG_8       NO_SUBMSG
+#define M_ERR_205_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_206       56206L
+#define M_ERR_206_MSG            NO_SUBMSG
+#define M_ERR_206_SUBMSG_1       NO_SUBMSG
+#define M_ERR_206_SUBMSG_2       NO_SUBMSG
+#define M_ERR_206_SUBMSG_3       NO_SUBMSG
+#define M_ERR_206_SUBMSG_4       NO_SUBMSG
+#define M_ERR_206_SUBMSG_5       NO_SUBMSG
+#define M_ERR_206_SUBMSG_6       NO_SUBMSG
+#define M_ERR_206_SUBMSG_7       NO_SUBMSG
+#define M_ERR_206_SUBMSG_8       NO_SUBMSG
+#define M_ERR_206_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_207       56207L
+#define M_ERR_207_MSG            NO_SUBMSG
+#define M_ERR_207_SUBMSG_1       NO_SUBMSG
+#define M_ERR_207_SUBMSG_2       NO_SUBMSG
+#define M_ERR_207_SUBMSG_3       NO_SUBMSG
+#define M_ERR_207_SUBMSG_4       NO_SUBMSG
+#define M_ERR_207_SUBMSG_5       NO_SUBMSG
+#define M_ERR_207_SUBMSG_6       NO_SUBMSG
+#define M_ERR_207_SUBMSG_7       NO_SUBMSG
+#define M_ERR_207_SUBMSG_8       NO_SUBMSG
+#define M_ERR_207_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_208       56208L
+#define M_ERR_208_MSG            NO_SUBMSG
+#define M_ERR_208_SUBMSG_1       NO_SUBMSG
+#define M_ERR_208_SUBMSG_2       NO_SUBMSG
+#define M_ERR_208_SUBMSG_3       NO_SUBMSG
+#define M_ERR_208_SUBMSG_4       NO_SUBMSG
+#define M_ERR_208_SUBMSG_5       NO_SUBMSG
+#define M_ERR_208_SUBMSG_6       NO_SUBMSG
+#define M_ERR_208_SUBMSG_7       NO_SUBMSG
+#define M_ERR_208_SUBMSG_8       NO_SUBMSG
+#define M_ERR_208_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_209       56209L
+#define M_ERR_209_MSG            NO_SUBMSG
+#define M_ERR_209_SUBMSG_1       NO_SUBMSG
+#define M_ERR_209_SUBMSG_2       NO_SUBMSG
+#define M_ERR_209_SUBMSG_3       NO_SUBMSG
+#define M_ERR_209_SUBMSG_4       NO_SUBMSG
+#define M_ERR_209_SUBMSG_5       NO_SUBMSG
+#define M_ERR_209_SUBMSG_6       NO_SUBMSG
+#define M_ERR_209_SUBMSG_7       NO_SUBMSG
+#define M_ERR_209_SUBMSG_8       NO_SUBMSG
+#define M_ERR_209_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_210       56210L
+#define M_ERR_210_MSG            NO_SUBMSG
+#define M_ERR_210_SUBMSG_1       NO_SUBMSG
+#define M_ERR_210_SUBMSG_2       NO_SUBMSG
+#define M_ERR_210_SUBMSG_3       NO_SUBMSG
+#define M_ERR_210_SUBMSG_4       NO_SUBMSG
+#define M_ERR_210_SUBMSG_5       NO_SUBMSG
+#define M_ERR_210_SUBMSG_6       NO_SUBMSG
+#define M_ERR_210_SUBMSG_7       NO_SUBMSG
+#define M_ERR_210_SUBMSG_8       NO_SUBMSG
+#define M_ERR_210_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_211       56211L
+#define M_ERR_211_MSG            NO_SUBMSG
+#define M_ERR_211_SUBMSG_1       NO_SUBMSG
+#define M_ERR_211_SUBMSG_2       NO_SUBMSG
+#define M_ERR_211_SUBMSG_3       NO_SUBMSG
+#define M_ERR_211_SUBMSG_4       NO_SUBMSG
+#define M_ERR_211_SUBMSG_5       NO_SUBMSG
+#define M_ERR_211_SUBMSG_6       NO_SUBMSG
+#define M_ERR_211_SUBMSG_7       NO_SUBMSG
+#define M_ERR_211_SUBMSG_8       NO_SUBMSG
+#define M_ERR_211_SUBMSG_9       NO_SUBMSG
+
+
+#define M_UNUSED_ERROR_212       56212L
+#define M_ERR_212_MSG            NO_SUBMSG
+#define M_ERR_212_SUBMSG_1       NO_SUBMSG
+#define M_ERR_212_SUBMSG_2       NO_SUBMSG
+#define M_ERR_212_SUBMSG_3       NO_SUBMSG
+#define M_ERR_212_SUBMSG_4       NO_SUBMSG
+#define M_ERR_212_SUBMSG_5       NO_SUBMSG
+#define M_ERR_212_SUBMSG_6       NO_SUBMSG
+#define M_ERR_212_SUBMSG_7       NO_SUBMSG
+#define M_ERR_212_SUBMSG_8       NO_SUBMSG
+#define M_ERR_212_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_213       56213L
+#define M_ERR_213_MSG            NO_SUBMSG
+#define M_ERR_213_SUBMSG_1       NO_SUBMSG
+#define M_ERR_213_SUBMSG_2       NO_SUBMSG
+#define M_ERR_213_SUBMSG_3       NO_SUBMSG
+#define M_ERR_213_SUBMSG_4       NO_SUBMSG
+#define M_ERR_213_SUBMSG_5       NO_SUBMSG
+#define M_ERR_213_SUBMSG_6       NO_SUBMSG
+#define M_ERR_213_SUBMSG_7       NO_SUBMSG
+#define M_ERR_213_SUBMSG_8       NO_SUBMSG
+#define M_ERR_213_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_214       56214L
+#define M_ERR_214_MSG            NO_SUBMSG
+#define M_ERR_214_SUBMSG_1       NO_SUBMSG
+#define M_ERR_214_SUBMSG_2       NO_SUBMSG
+#define M_ERR_214_SUBMSG_3       NO_SUBMSG
+#define M_ERR_214_SUBMSG_4       NO_SUBMSG
+#define M_ERR_214_SUBMSG_5       NO_SUBMSG
+#define M_ERR_214_SUBMSG_6       NO_SUBMSG
+#define M_ERR_214_SUBMSG_7       NO_SUBMSG
+#define M_ERR_214_SUBMSG_8       NO_SUBMSG
+#define M_ERR_214_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_215       56215L
+#define M_ERR_215_MSG            NO_SUBMSG
+#define M_ERR_215_SUBMSG_1       NO_SUBMSG
+#define M_ERR_215_SUBMSG_2       NO_SUBMSG
+#define M_ERR_215_SUBMSG_3       NO_SUBMSG
+#define M_ERR_215_SUBMSG_4       NO_SUBMSG
+#define M_ERR_215_SUBMSG_5       NO_SUBMSG
+#define M_ERR_215_SUBMSG_6       NO_SUBMSG
+#define M_ERR_215_SUBMSG_7       NO_SUBMSG
+#define M_ERR_215_SUBMSG_8       NO_SUBMSG
+#define M_ERR_215_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_216       56216L
+#define M_ERR_216_MSG            NO_SUBMSG
+#define M_ERR_216_SUBMSG_1       NO_SUBMSG
+#define M_ERR_216_SUBMSG_2       NO_SUBMSG
+#define M_ERR_216_SUBMSG_3       NO_SUBMSG
+#define M_ERR_216_SUBMSG_4       NO_SUBMSG
+#define M_ERR_216_SUBMSG_5       NO_SUBMSG
+#define M_ERR_216_SUBMSG_6       NO_SUBMSG
+#define M_ERR_216_SUBMSG_7       NO_SUBMSG
+#define M_ERR_216_SUBMSG_8       NO_SUBMSG
+#define M_ERR_216_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_217       56217L
+#define M_ERR_217_MSG            NO_SUBMSG
+#define M_ERR_217_SUBMSG_1       NO_SUBMSG
+#define M_ERR_217_SUBMSG_2       NO_SUBMSG
+#define M_ERR_217_SUBMSG_3       NO_SUBMSG
+#define M_ERR_217_SUBMSG_4       NO_SUBMSG
+#define M_ERR_217_SUBMSG_5       NO_SUBMSG
+#define M_ERR_217_SUBMSG_6       NO_SUBMSG
+#define M_ERR_217_SUBMSG_7       NO_SUBMSG
+#define M_ERR_217_SUBMSG_8       NO_SUBMSG
+#define M_ERR_217_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_218       56218L
+#define M_ERR_218_MSG            NO_SUBMSG
+#define M_ERR_218_SUBMSG_1       NO_SUBMSG
+#define M_ERR_218_SUBMSG_2       NO_SUBMSG
+#define M_ERR_218_SUBMSG_3       NO_SUBMSG
+#define M_ERR_218_SUBMSG_4       NO_SUBMSG
+#define M_ERR_218_SUBMSG_5       NO_SUBMSG
+#define M_ERR_218_SUBMSG_6       NO_SUBMSG
+#define M_ERR_218_SUBMSG_7       NO_SUBMSG
+#define M_ERR_218_SUBMSG_8       NO_SUBMSG
+#define M_ERR_218_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_219       56219L
+#define M_ERR_219_MSG            NO_SUBMSG
+#define M_ERR_219_SUBMSG_1       NO_SUBMSG
+#define M_ERR_219_SUBMSG_2       NO_SUBMSG
+#define M_ERR_219_SUBMSG_3       NO_SUBMSG
+#define M_ERR_219_SUBMSG_4       NO_SUBMSG
+#define M_ERR_219_SUBMSG_5       NO_SUBMSG
+#define M_ERR_219_SUBMSG_6       NO_SUBMSG
+#define M_ERR_219_SUBMSG_7       NO_SUBMSG
+#define M_ERR_219_SUBMSG_8       NO_SUBMSG
+#define M_ERR_219_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_220       56220L
+#define M_ERR_220_MSG            NO_SUBMSG
+#define M_ERR_220_SUBMSG_1       NO_SUBMSG
+#define M_ERR_220_SUBMSG_2       NO_SUBMSG
+#define M_ERR_220_SUBMSG_3       NO_SUBMSG
+#define M_ERR_220_SUBMSG_4       NO_SUBMSG
+#define M_ERR_220_SUBMSG_5       NO_SUBMSG
+#define M_ERR_220_SUBMSG_6       NO_SUBMSG
+#define M_ERR_220_SUBMSG_7       NO_SUBMSG
+#define M_ERR_220_SUBMSG_8       NO_SUBMSG
+#define M_ERR_220_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_221       56221L
+#define M_ERR_221_MSG            NO_SUBMSG
+#define M_ERR_221_SUBMSG_1       NO_SUBMSG
+#define M_ERR_221_SUBMSG_2       NO_SUBMSG
+#define M_ERR_221_SUBMSG_3       NO_SUBMSG
+#define M_ERR_221_SUBMSG_4       NO_SUBMSG
+#define M_ERR_221_SUBMSG_5       NO_SUBMSG
+#define M_ERR_221_SUBMSG_6       NO_SUBMSG
+#define M_ERR_221_SUBMSG_7       NO_SUBMSG
+#define M_ERR_221_SUBMSG_8       NO_SUBMSG
+#define M_ERR_221_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_222       56222L
+#define M_ERR_222_MSG            NO_SUBMSG
+#define M_ERR_222_SUBMSG_1       NO_SUBMSG
+#define M_ERR_222_SUBMSG_2       NO_SUBMSG
+#define M_ERR_222_SUBMSG_3       NO_SUBMSG
+#define M_ERR_222_SUBMSG_4       NO_SUBMSG
+#define M_ERR_222_SUBMSG_5       NO_SUBMSG
+#define M_ERR_222_SUBMSG_6       NO_SUBMSG
+#define M_ERR_222_SUBMSG_7       NO_SUBMSG
+#define M_ERR_222_SUBMSG_8       NO_SUBMSG
+#define M_ERR_222_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_223       56223L
+#define M_ERR_223_MSG            NO_SUBMSG
+#define M_ERR_223_SUBMSG_1       NO_SUBMSG
+#define M_ERR_223_SUBMSG_2       NO_SUBMSG
+#define M_ERR_223_SUBMSG_3       NO_SUBMSG
+#define M_ERR_223_SUBMSG_4       NO_SUBMSG
+#define M_ERR_223_SUBMSG_5       NO_SUBMSG
+#define M_ERR_223_SUBMSG_6       NO_SUBMSG
+#define M_ERR_223_SUBMSG_7       NO_SUBMSG
+#define M_ERR_223_SUBMSG_8       NO_SUBMSG
+#define M_ERR_223_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_224       56224L
+#define M_ERR_224_MSG            NO_SUBMSG
+#define M_ERR_224_SUBMSG_1       NO_SUBMSG
+#define M_ERR_224_SUBMSG_2       NO_SUBMSG
+#define M_ERR_224_SUBMSG_3       NO_SUBMSG
+#define M_ERR_224_SUBMSG_4       NO_SUBMSG
+#define M_ERR_224_SUBMSG_5       NO_SUBMSG
+#define M_ERR_224_SUBMSG_6       NO_SUBMSG
+#define M_ERR_224_SUBMSG_7       NO_SUBMSG
+#define M_ERR_224_SUBMSG_8       NO_SUBMSG
+#define M_ERR_224_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_225       56225L
+#define M_ERR_225_MSG            NO_SUBMSG
+#define M_ERR_225_SUBMSG_1       NO_SUBMSG
+#define M_ERR_225_SUBMSG_2       NO_SUBMSG
+#define M_ERR_225_SUBMSG_3       NO_SUBMSG
+#define M_ERR_225_SUBMSG_4       NO_SUBMSG
+#define M_ERR_225_SUBMSG_5       NO_SUBMSG
+#define M_ERR_225_SUBMSG_6       NO_SUBMSG
+#define M_ERR_225_SUBMSG_7       NO_SUBMSG
+#define M_ERR_225_SUBMSG_8       NO_SUBMSG
+#define M_ERR_225_SUBMSG_9       NO_SUBMSG
+
+
+#define M_LAST_CORE_ERROR        M_UNUSED_ERROR_225
+// TO DO when adding a new error message
+// Update M_NBERRMSGMAX in mil.h when adding a new error message
+// Update osglob.cpp as well
+
+#endif
diff --git a/Common_Class/Matrox/Include/Milos.h b/Common_Class/Matrox/Include/Milos.h
new file mode 100644
index 0000000..9205bec
--- /dev/null
+++ b/Common_Class/Matrox/Include/Milos.h
@@ -0,0 +1,1423 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MILOS.H
+* Revision     :  10.40.0640
+* Content      :  This file contains the defines necessary to use the
+*                 Matrox Imaging Library under different operating systems
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+
+#ifndef __MILOS_H
+#define __MILOS_H
+
+#ifndef M_MIL_USE_OS
+#define M_MIL_USE_WINDOWS       1
+#endif
+
+#define        M_SEEK_SET  0
+#define        M_SEEK_CUR  1
+#define        M_SEEK_END  2
+
+/************************************************************************/
+/* Include float.h                                                      */
+/************************************************************************/
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+#include <float.h>
+#endif
+
+/************************************************************************/
+/* MIL TYPE DEFINITIONS                                                 */
+/************************************************************************/
+/* GENERAL RELATED DEFINES */
+/***************************/
+#if M_MIL_USE_WINDOWS
+
+      #if M_MIL_USE_64BIT
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+         typedef  __int64              MIL_INT;
+         typedef  unsigned __int64     MIL_UINT;
+#else
+         typedef  long long            MIL_INT;
+         typedef  unsigned long long   MIL_UINT;
+#endif
+
+         #define  MIL_UINT_MIN      0ULL
+         #define  MIL_UINT_MAX      18446744073709551615ULL
+         #define  MIL_INT_MIN       (-9223372036854775807LL - 1)
+         #define  MIL_INT_MAX       9223372036854775807LL
+      #else
+         #if (_MSC_VER < 1400) // Visual Studio 2003
+            typedef  long           MIL_INT;
+            typedef  unsigned long  MIL_UINT;
+         #else                 // Visual Studio 2005
+            // _W64 Lets you mark variables, such that when you compile
+            // with /Wp64 the compiler will report any warnings that would
+            // be reported if you were compiling with a 64-bit compiler.
+            typedef _W64          long MIL_INT;
+            typedef _W64 unsigned long MIL_UINT;
+         #endif
+         #define  MIL_UINT_MIN   0UL
+         #define  MIL_UINT_MAX   4294967295UL
+         #define  MIL_INT_MIN    (-2147483647L-1L)
+         #define  MIL_INT_MAX    2147483647L
+      #endif
+   
+   typedef                long         MIL_INT32;
+   typedef const          long         MIL_CINT32;
+   typedef       unsigned long         MIL_UINT32;
+   typedef const unsigned long         MIL_CUINT32;
+   #define  MIL_UINT32_MIN             0UL
+   #define  MIL_UINT32_MAX             4294967295UL
+   #define  MIL_INT32_MIN              (-2147483647L-1L)
+   #define  MIL_INT32_MAX              2147483647L
+   #define  MIL_UINT32_MIN_FLT         0UL               //Min precise value in 32-bit floating point.
+   #define  MIL_UINT32_MAX_FLT         0xFFFFFF00UL      //Max precise value in 32-bit floating point.
+   #define  MIL_INT32_MIN_FLT          (-2147483647L-1L) //Min precise value in 32-bit floating point.
+   #define  MIL_INT32_MAX_FLT          0x7FFFFF80L       //Max precise value in 32-bit floating point.
+
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+   typedef                __int64      MIL_INT64;
+   typedef const          __int64      MIL_CINT64;
+   typedef       unsigned __int64      MIL_UINT64;
+   typedef const unsigned __int64      MIL_CUINT64;
+#else
+   typedef                long long    MIL_INT64;
+   typedef const          long long    MIL_CINT64;
+   typedef       unsigned long long    MIL_UINT64;
+   typedef const unsigned long long    MIL_CUINT64;
+#endif
+   #define  MIL_UINT64_MIN             0ULL
+   #define  MIL_UINT64_MAX             18446744073709551615ULL
+   #define  MIL_INT64_MIN              (-9223372036854775807LL - 1)
+   #define  MIL_INT64_MAX              9223372036854775807LL
+   #define  MIL_UINT64_MIN_DBL         0ULL                    //Min precise value in 64-bit floating point.
+   #define  MIL_UINT64_MAX_DBL         0xFFFFFFFFFFFFF800ULL   //Max precise value in 64-bit floating point.
+   #define  MIL_INT64_MIN_DBL          (-9223372036854775807LL - 1LL)  //Min precise value in 64-bit floating point.
+   #define  MIL_INT64_MAX_DBL          0x7FFFFFFFFFFFFC00LL    //Max precise value in 64-bit floating point.
+   #define  MIL_UINT64_MIN_EXACT_DBL   0x0ULL                        //Min precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_UINT64_MAX_EXACT_DBL   0x001FFFFFFFFFFFFFULL         //Max precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_INT64_MIN_EXACT_DBL    (-0x001FFFFFFFFFFFFFLL - 1LL) //Min precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_INT64_MAX_EXACT_DBL    0x001FFFFFFFFFFFFFLL          //Max precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+
+   typedef                double       MIL_DOUBLE;
+   typedef                float        MIL_FLOAT;
+   typedef                char         MIL_INT8;
+   typedef const          char         MIL_CINT8;
+   typedef       unsigned char         MIL_UINT8;
+   typedef const unsigned char         MIL_CUINT8;
+   typedef                short        MIL_INT16;
+   typedef const          short        MIL_CINT16;
+   typedef       unsigned short        MIL_UINT16;
+   typedef const unsigned short        MIL_CUINT16;
+   typedef MIL_INT32                   MIL_BOOL;
+   typedef const MIL_INT32             MIL_CBOOL;
+
+   #define  MIL_UINT8_MIN              0UL
+   #define  MIL_UINT8_MAX              255UL
+   #define  MIL_INT8_MIN               -128L
+   #define  MIL_INT8_MAX               127L
+   #define  MIL_UINT16_MIN             0UL
+   #define  MIL_UINT16_MAX             65535UL
+   #define  MIL_INT16_MIN              -32768L
+   #define  MIL_INT16_MAX              32767L
+   #define  MIL_DOUBLE_MIN             DBL_MIN
+   #define  MIL_DOUBLE_MAX             DBL_MAX
+   #define  MIL_FLOAT_MIN              FLT_MIN
+   #define  MIL_FLOAT_MAX              FLT_MAX
+   #define  MIL_BOOL_MIN               0UL
+   #define  MIL_BOOL_MAX               1UL
+
+#if M_MIL_UNICODE_API
+   typedef       wchar_t               MIL_WCHAR;
+#else
+   typedef       unsigned short        MIL_WCHAR;
+#endif
+
+#elif M_MIL_USE_LINUX
+   typedef               long          MIL_INT;
+   typedef      unsigned long          MIL_UINT;
+
+   #if M_MIL_USE_64BIT
+   typedef                int          MIL_INT32;
+   typedef const          int          MIL_CINT32;
+   typedef       unsigned int          MIL_UINT32;
+   typedef const unsigned int          MIL_CUINT32;
+
+   #define  MIL_UINT_MIN               MIL_UINT64_MIN
+   #define  MIL_UINT_MAX               MIL_UINT64_MAX
+   #define  MIL_INT_MIN                MIL_INT64_MIN
+   #define  MIL_INT_MAX                MIL_INT64_MAX
+   #else // M_MIL_USE_64BIT
+   typedef                long         MIL_INT32;
+   typedef const          long         MIL_CINT32;
+   typedef       unsigned long         MIL_UINT32;
+   typedef const unsigned long         MIL_CUINT32;
+
+   #define  MIL_UINT_MIN               MIL_UINT32_MIN
+   #define  MIL_UINT_MAX               MIL_UINT32_MAX
+   #define  MIL_INT_MIN                MIL_INT32_MIN
+   #define  MIL_INT_MAX                MIL_INT32_MAX
+   #endif
+
+   #define  MIL_UINT32_MIN             0
+   #define  MIL_UINT32_MAX             4294967295U
+   #define  MIL_INT32_MIN              (-MIL_INT32_MAX - 1) // -2147483648L does not yield the right value
+   #define  MIL_INT32_MAX              2147483647
+   #define  MIL_UINT32_MIN_FLT         0U                //Min precise value in 32-bit floating point.
+   #define  MIL_UINT32_MAX_FLT         0xFFFFFF00U       //Max precise value in 32-bit floating point.
+   #define  MIL_INT32_MIN_FLT          (-2147483647-1)   //Min precise value in 32-bit floating point.
+   #define  MIL_INT32_MAX_FLT          0x7FFFFF80       //Max precise value in 32-bit floating point.
+
+   #if M_MIL_USE_64BIT
+      typedef                long       MIL_INT64;
+      typedef const          long       MIL_CINT64;
+      typedef       unsigned long       MIL_UINT64;
+      typedef const unsigned long       MIL_CUINT64;
+   #else
+      typedef                long long MIL_INT64;
+      typedef const          long long MIL_CINT64;
+      typedef       unsigned long long MIL_UINT64;
+      typedef const unsigned long long MIL_CUINT64;
+   #endif
+   #define  MIL_UINT64_MIN             0ULL
+   #define  MIL_UINT64_MAX             18446744073709551615ULL
+   #define  MIL_INT64_MAX              9223372036854775807LL
+   #define  MIL_INT64_MIN              (-MIL_INT64_MAX - 1LL) // Using -9223372036854775808LL directly causes weird warnings.
+   #define  MIL_UINT64_MIN_DBL         0ULL                    //Min precise value in 64-bit floating point.
+   #define  MIL_UINT64_MAX_DBL         0xFFFFFFFFFFFFF800ULL   //Max precise value in 64-bit floating point.
+   #define  MIL_INT64_MIN_DBL          (-9223372036854775807LL - 1LL)  //Min precise value in 64-bit floating point.
+   #define  MIL_INT64_MAX_DBL          0x7FFFFFFFFFFFFC00LL    //Max precise value in 64-bit floating point.
+   #define  MIL_UINT64_MIN_EXACT_DBL   0x0ULL                        //Min precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_UINT64_MAX_EXACT_DBL   0x001FFFFFFFFFFFFFULL         //Max precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_INT64_MIN_EXACT_DBL    (-0x001FFFFFFFFFFFFFLL - 1LL) //Min precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_INT64_MAX_EXACT_DBL    0x001FFFFFFFFFFFFFLL          //Max precise value in 64-bit floating point that garantees the precision of every value in the range.   
+
+   typedef                double       MIL_DOUBLE;
+   typedef                float        MIL_FLOAT;
+   typedef                char         MIL_INT8;
+   typedef const          char         MIL_CINT8;
+   typedef       unsigned char         MIL_UINT8;
+   typedef const unsigned char         MIL_CUINT8;
+   typedef                short        MIL_INT16;
+   typedef const          short        MIL_CINT16;
+   typedef       unsigned short        MIL_UINT16;
+   typedef const unsigned short        MIL_CUINT16;
+   typedef MIL_INT32                   MIL_BOOL;
+   typedef const MIL_INT32             MIL_CBOOL;
+
+   #define  MIL_UINT8_MIN              0UL
+   #define  MIL_UINT8_MAX              255UL
+   #define  MIL_INT8_MIN               -128L
+   #define  MIL_INT8_MAX               127L
+   #define  MIL_UINT16_MIN             0UL
+   #define  MIL_UINT16_MAX             65535UL
+   #define  MIL_INT16_MIN              -32768L
+   #define  MIL_INT16_MAX              32767L
+   #define  MIL_DOUBLE_MIN             DBL_MIN
+   #define  MIL_DOUBLE_MAX             DBL_MAX
+   #define  MIL_FLOAT_MIN              FLT_MIN
+   #define  MIL_FLOAT_MAX              FLT_MAX
+   #define  MIL_BOOL_MIN               0UL
+   #define  MIL_BOOL_MAX               1UL
+
+   typedef       unsigned short        MIL_WCHAR;
+
+#else
+   #error Operating system not supported in Milos.h!
+#endif
+
+typedef MIL_UINT64               MIL_DATA_PTR;
+
+typedef MIL_DATA_PTR             MIL_PHYS_DATA_PTR;
+typedef void*                    MIL_HOST_DATA_PTR;
+typedef const void*              MIL_CONST_HOST_DATA_PTR;
+
+typedef MIL_UINT                 MIL_ADDR;   // this type is used to cast a pointer to an integer type for arithmetic conversion
+                                             // for example void *NewPtr = (void*)((MIL_ADDR)OldPtr + Offset);
+
+typedef unsigned char            MIL_BYTE;
+
+
+///////////////////////////////////////////////////////////////////////////
+// Data pointer macro definitions                                        //
+///////////////////////////////////////////////////////////////////////////
+#define M_INT_DATA_PTR_SIZE   MIL_UINT64
+
+#if M_MIL_USE_64BIT
+#define M_CAST_MIL_HOST_PTR_TO_MIL_DATA_PTR(PTR)   ((MIL_DATA_PTR)(PTR))
+#define M_CAST_MIL_DATA_PTR_TO_MIL_HOST_PTR(PTR)   ((MIL_HOST_DATA_PTR)(PTR))
+
+#define M_CAST_MIL_HOST_PTR_TO_MIL_DATA_PTR_CONST(PTR) ((MIL_CONST_DATA_PTR)(PTR))
+#define M_CAST_MIL_DATA_PTR_TO_MIL_HOST_PTR_CONST(PTR) ((MIL_CONST_HOST_DATA_PTR)(PTR))
+
+#else
+#define M_CAST_MIL_HOST_PTR_TO_MIL_DATA_PTR(PTR)     ((MIL_ADDR)(PTR))
+#define M_CAST_MIL_DATA_PTR_TO_MIL_HOST_PTR(PTR)     ((MIL_HOST_DATA_PTR)((MIL_ADDR)(PTR)))
+
+#define M_CAST_MIL_HOST_PTR_TO_MIL_DATA_PTR_CONST(PTR)     ((MIL_CONST_DATA_PTR)(PTR))
+#define M_CAST_MIL_DATA_PTR_TO_MIL_HOST_PTR_CONST(PTR)     ((MIL_CONST_HOST_DATA_PTR)((MIL_ADDR)(PTR)))
+#endif
+
+#define M_CAST_MIL_PHYS_PTR_TO_MIL_DATA_PTR(PTR)  (PTR)
+#define M_CAST_MIL_DATA_PTR_TO_MIL_PHYS_PTR(PTR)  (PTR)
+
+#define M_IS_PTR_OK_FOR_PLATFORM(X) ((sizeof(X) == 4) || (sizeof(X) == sizeof(void*)) || ((((MIL_INT64)X)&MAKE_INT64(0xFFFFFFFF00000000))==0))
+
+typedef    MIL_UINT64 MIL_ADDRESS64;
+
+#if defined(M_MIL_USE_INT64_ID) && M_MIL_USE_INT64_ID
+   #define M_MILID_TO_DOUBLE(X) (MIL_DOUBLE)(X)
+   #define M_MDID_TO_DOUBLE(X)  (MIL_DOUBLE)(X)
+#else
+   #define M_MILID_TO_DOUBLE(X) X
+   #define M_MDID_TO_DOUBLE(X)  X
+#endif
+
+
+/***************************/
+/* STRING RELATED DEFINES  */
+/***************************/
+#if M_MIL_UNICODE_API
+   #define MIL_TEXT(quote)        L##quote
+   typedef wchar_t                MIL_TEXT_CHAR;
+   #define  MIL_TEXT_CHAR_MIN     MIL_UINT16_MIN;
+   #define  MIL_TEXT_CHAR_MAX     MIL_UINT16_MAX;
+#elif M_MIL_USE_WINDOWS || M_MIL_USE_LINUX
+   #define MIL_TEXT(quote)        quote
+   typedef char                   MIL_TEXT_CHAR;
+   #define  MIL_TEXT_CHAR_MIN     MIL_UINT8_MIN;
+   #define  MIL_TEXT_CHAR_MAX     MIL_UINT8_MAX;
+#else
+   #error Operating system not supported in Milos.h!
+#endif
+
+#define MT                          MIL_TEXT
+#if defined(OldDefinesSupport) && OldDefinesSupport 
+   MIL_DEPRECATED(MT, 1000)      //Please use MIL_TEXT()
+#endif
+   
+#define MIL_FUNC_NAME(Func)    Func
+typedef const char*            MIL_FUNC_NAME_PTR;  // In Windows (not CE), the GetProcAddress function is not Unicode compliant
+
+typedef MIL_TEXT_CHAR*         MIL_TEXT_PTR;
+typedef const MIL_TEXT_CHAR*   MIL_CONST_TEXT_PTR;
+
+typedef char*                  MIL_TEXTA_PTR;
+typedef const char*            MIL_CONST_TEXTA_PTR;
+#if M_MIL_USE_UNICODE
+typedef wchar_t*               MIL_TEXTW_PTR;
+typedef const wchar_t*         MIL_CONST_TEXTW_PTR;
+#endif
+
+
+
+/***************************************/
+/* OLD DEFINES THAT SHOULD NOT BE USED */
+/***************************************/
+#if defined(OldDefinesSupport) && OldDefinesSupport
+
+#define MIL_INTADDR  MIL_UINT             // Please, use MIL_UINT
+MIL_DEPRECATED(MIL_INTADDR, 1000)
+#define MIL_UINTADDR MIL_UINT             // Please, use MIL_UINT
+MIL_DEPRECATED(MIL_UINTADDR, 1000)
+#define MILTCHAR     MIL_TEXT_CHAR        // Please, use MIL_TEXT_CHAR
+MIL_DEPRECATED(MILTCHAR, 1000)
+#define LPMILSTR     MIL_TEXT_PTR         // Please, use MIL_TEXT_PTR
+//MIL_DEPRECATED(LPMILSTR)
+#define LPCMILSTR    MIL_CONST_TEXT_PTR   // Please, use MIL_CONST_TEXT_PTR
+//MIL_DEPRECATED(LPCMILSTR)
+#define BUFATTRTYPE  MIL_INT64            // Please, use MIL_INT64
+MIL_DEPRECATED(BUFATTRTYPE, 1000)
+
+#endif   // defined(OldDefinesSupport) && OldDefinesSupport
+
+
+/************************************************************************/
+/* Define UNREFERENCED_PARAMETER                                        */
+/************************************************************************/
+#ifndef UNREFERENCED_PARAMETER
+#if M_MIL_USE_LINUX
+#define UNREFERENCED_PARAMETER(P) (void)(P)
+#else
+#define UNREFERENCED_PARAMETER(P) (P)
+#endif
+#endif
+
+#if (defined(M_MIL_DEBUG) && M_MIL_DEBUG) || defined(_DEBUG)
+#define PARAM_DEBUG_ONLY(X)
+#else
+#define PARAM_DEBUG_ONLY   UNREFERENCED_PARAMETER
+#endif
+
+/************************************************************************/
+/* HANDLES RELATED DEFINITIONS                                          */
+/************************************************************************/
+#if   M_MIL_USE_WINDOWS
+#if (defined(_INC_WINDOWS) || defined(_WINDOWS_) || defined(__WINDOWS_H) || defined(__WINDOWS__))
+typedef HWND                   MIL_WINDOW_HANDLE;
+typedef HDC                    MIL_DC_HANDLE;
+#else
+typedef void*                   MIL_WINDOW_HANDLE;
+typedef void*                   MIL_DC_HANDLE;
+#endif
+#else
+// Window is typedef-ed to XID, which is typedef-ed to
+// unsigned long
+typedef unsigned long          MIL_WINDOW_HANDLE;
+typedef MIL_INT                MIL_DC_HANDLE;
+#endif
+
+
+/*************************************************************************/
+/** Include string.h                                                     */
+/*************************************************************************/
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+#include <string.h>
+#endif
+
+// Regular string functions' definition
+#if M_MIL_UNICODE_API
+#if (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE) 
+   #define     MOs_ltoa          _ltow
+   #define     MOs_itoa          _itow
+   #define     MOs_ultoa         _ultow
+   #define     MOs_atoi          _wtoi
+   #define     MOs_atol          _wtol
+   #define     MOs_ANSIatol      atol
+   #define     MOs_atof          _wtof
+   #define     MOs_strtol        wcstol
+   #define     MOs_strtoul       wcstoul
+   #define     MOs_ANSIstrtoul   strtoul
+   #define     MOs_strtoui64     _wcstoui64
+   #define     MOs_strcpy        wcscpy
+   #define     MOs_ANSIstrcpy    strcpy
+   #define     MOs_strncpy       wcsncpy
+   #define     MOs_ANSIstrncpy   strncpy
+   #define     MOs_strcmp        wcscmp
+   #define     MOs_ANSIstrcmp    strcmp
+   #define     MOs_stricmp       _wcsicmp
+   #define     MOs_ANSIstricmp   _stricmp
+   #define     MOs_strncmp       wcsncmp
+   #define     MOs_ANSIstrncmp   strncmp
+   #define     MOs_ANSIstrnicmp  _strnicmp
+   #define     MOs_strcat        wcscat
+   #define     MOs_ANSIstrcat    strcat
+   #define     MOs_strncat       wcsncat
+   #define     MOs_strchr        wcschr
+   #define     MOs_strrchr       wcsrchr
+   #define     MOs_ANSIstrchr    strchr
+   #define     MOs_isprint       iswprint
+   #define     MOs_ANSIisprint   isprint
+   #define     MOs_isspace       iswspace
+   #define     MOs_ANSIisspace   isspace
+   #define     MOs_strlen        wcslen
+   #define     MOs_strnlen       wcsnlen
+   #define     MOs_ANSIstrlen    strlen
+   #define     MOs_ANSIstrnlen   strnlen
+   #define     MOs_sprintf       swprintf
+   #define     MOs_ANSIsprintf   sprintf
+   #define     MOs_vsprintf      vswprintf
+   #define     MOs_sscanf        swscanf
+   #define     MOs_ANSIsscanf    sscanf
+   #define     MOs_fscanf        fwscanf
+   #define     MOs_fprintf       fwprintf
+   #define     MOs_ANSIfprintf   fprintf
+   #define     MOs_ANSIvfprintf  vfprintf
+   #define     MOs_ANSIvprintf   vprintf
+   #define     MOs_vfprintf      vfwprintf
+   #define     MOs_strtod        wcstod
+   #define     MOs_strupr        _wcsupr
+   #define     MOs_getchar       getwchar
+   #define     MOs_ctime         _wctime
+   #define     MOs_ftime         _ftime_s
+   #define     MOs_localtime     localtime
+   #define     MOs_strlwr        _wcslwr
+   #define     MOs_system        _wsystem
+#if M_MIL_USE_RT
+   #define     MOs_printf        RTXMonitor::GetInstance()->PrintMessage
+#else
+   #define     MOs_printf        wprintf
+#endif
+   #define     MOs_scprintf      _scwprintf
+   #define     MOs_vprintf       vwprintf
+// #define     MOs_vscanf        vwscanf  NOT SUPPORTED ON ALL PLATFORMS
+   #define     MOs_fputs         fputws
+   #define     MOs_ANSIfputs     fputs
+   #define     MOs_fputc         fputc
+   #define     MOs_strtok        wcstok
+   #define     MOs_ANSIstrtok    strtok
+   #define     MOs_ungetc        ungetwc
+   #define     MOs_tolower       towlower
+   #define     MOs_ANSItolower   tolower
+   #define     MOs_toupper       towupper
+   #define     MOs_strspn        wcsspn
+   #define     MOs_strcspn       wcscspn
+   #define     MOs_ANSIstrcspn   strcspn
+   #define     MOs_asctime       _wasctime
+   #define     MOs_ANSIasctime   asctime
+   #define     MOs_strstr        wcsstr
+   #define     MOs_ANSIstrstr    strstr
+   #define     MOs_splitpath     _wsplitpath
+   #define     MOs_makepath      _wmakepath
+   #define     MOs_strnset       _wcsnset
+   #define     MOs_strpbrk       wcspbrk
+
+#if M_MIL_USING_SAFE_CRT
+   #define     MOs_sprintf_s              swprintf_s
+
+   #define     MOs_ANSIsprintf_s          sprintf_s
+
+   #define     MOs_printf_s               wprintf_s
+   #define     MOs_scanf_s                wscanf_s
+   #define     MOs_sscanf_s               swscanf_s
+   #define     MOs_ANSIsscanf_s           sscanf_s
+   #define     MOs_fscanf_s               fwscanf_s
+   #define     MOs_strncpy_s              wcsncpy_s
+   #define     MOs_ANSIstrncpy_s          strncpy_s
+#if !M_MIL_USE_RT
+   #define     MOs_asctime_s              _wasctime_s
+   #define     MOs_ANSIasctime_s          asctime_s
+#endif
+   #define     MOs_strcpy_s               wcscpy_s
+   #define     MOs_ANSIstrcpy_s           strcpy_s
+#if M_MIL_USE_RT
+// there is no environment variable under RTX, so let's return NULL. Also _wgetenv does not exist
+#ifdef __cplusplus
+   inline void* MOs_getenv_s(size_t * /*pReturnValue*/, MIL_TEXT_PTR /*buffer*/, size_t /*numberOfElements*/, MIL_CONST_TEXT_PTR /*varname*/ )
+      {
+      return NULL;
+      }
+#else
+#define  MOs_getenv_s(A, B, C, D)      NULL
+#endif
+
+#else
+#define     MOs_getenv_s               _wgetenv_s
+#endif
+   #define     MOs_ANSIgetenv_s           getenv_s
+   #define     MOs_strcat_s               wcscat_s
+   #define     MOs_ANSIstrcat_s           strcat_s
+   
+   #include <share.h>
+   #define     MOs_fopen_s         _wfopen_s
+   #define     MOs_ANSIfopen_s     fopen_s
+   #define     MOs_strncat_s              wcsncat_s
+   #define     MOs_fcvt_s                 _fcvt_s
+   #define     MOs_strtok_s               wcstok_s
+   #define     MOs_ANSIstrtok_s           strtok_s
+   #define     MOs_vsprintf_s             vswprintf_s
+   #define     MOs_ANSIvsprintf_s         vsprintf_s
+   #define     MOs_splitpath_s            _wsplitpath_s
+   #define     MOs_makepath_s             _wmakepath_s
+   #define     MOs_strnset_s              _wcsnset_s
+   #define     MOs_strlwr_s               _wcslwr_s
+   #define     MOs_strupr_s               _wcsupr_s
+   #define     MOs_strnicmp               _wcsnicmp
+   #define     MOs_ctime_s                _wctime_s
+   #define     MOs_ftime_s                _ftime_s
+   #define     MOs_localtime_s            localtime_s
+   #define     MOs_mbstowcs_s             mbstowcs_s
+   #define     MOs_wcstombs_s             wcstombs_s
+#else    // Safe version of CRT map to unsafe version
+   #define     MOs_sprintf_s              _snwprintf
+   
+   #define     MOs_ANSIsprintf_s          _snprintf
+
+   #define     MOs_printf_s                        wprintf
+   #define     MOs_sscanf_s                        swscanf
+   #define     MOs_ANSIsscanf_s                    sscanf
+   #define     MOs_fscanf_s                        fwscanf
+   #define     MOs_strncpy_s(A, B, C, D)           wcsncpy(A, C, D)
+   #define     MOs_ANSIstrncpy_s(A, B, C, D)       strncpy(A, C, D)
+   #define     MOs_asctime_s                       _wasctime
+   #define     MOs_ANSIasctime_s                   asctime
+   #define     MOs_strcpy_s(A, B, C)               wcscpy(A, C)
+   #define     MOs_ANSIstrcpy_s(A, B, C)           strcpy(A, C)
+   #define     MOs_getenv_s(A, B, C, D)            (MOs_getenv(D)) ? wcscpy(B, MOs_getenv(D)) : wcscpy(B, MT("\0"))
+   #define     MOs_ANSIgetenv_s(A, B, C, D)        (MOs_ANSIgetenv(D)) ? strcpy(B, MOs_ANSIgetenv(D)) : strcpy(B, "\0")
+   #define     MOs_strcat_s(A, B, C)               wcscat(A, C)
+   #define     MOs_ANSIstrcat_s(A, B, C)           strcat(A, C)
+   #define     MOs_fopen_s(A,B,C)               (((*(A) =_wfsopen(B,C,_SH_DENYRW)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A,B,C)           (((*(A) =_fsopen(B,C,_SH_DENYRW)) != NULL) ? (0) : (1))
+   #define     MOs_strncat_s(A, B, C, D)           wcsncat(A, C, D)
+   #define     MOs_strtok_s(A, B, C)               wcstok(A, (C, B))
+   #define     MOs_ANSIstrtok_s(A, B, C)           strtok(A, (C, B))
+   #define     MOs_vsprintf_s(A, B, C, D)          vswprintf(A, C, D)
+   #define     MOs_ANSIvsprintf_s(A, B, C, D)      vsprintf(A, C, D)
+   #define     MOs_splitpath_s(A,B,C,D,E,F,G,H,I)  _wsplitpath(A,B,D,F,H)
+   #define     MOs_makepath_s(A,B,C,D,E,F)         _wmakepath(A,C,D,E,F)
+   #define     MOs_strnset_s(A,B,C,D)              _wcsnset(A,C,D)
+   #define     MOs_strupr_s(A,B)                   _wcsupr(A)
+   #define     MOs_strnicmp                        wcsnicmp
+   #define     MOs_ctime_s(A,B,C)                  wcscpy(A, _wctime(C))
+   #define     MOs_ftime_s                         _ftime
+   #define     MOs_localtime_s(A, B)               A = localtime(B)
+   #if M_MIL_USE_WINDOWS
+      #define     MOs_strlwr_s(A, B)                  _wcslwr(A)
+      #define     MOs_strupr_s(A, B)                  _wcsupr(A)
+   #endif
+   #define     MOs_mbstowcs_s(A,B,C,D,E)              (((*(A) =mbstowcs(B,D,E)) != NULL) ? (0) : (1))
+   #define     MOs_wcstombs_s(A,B,C,D,E)              (((*(A) =wcstombs(B,D,E)) != NULL) ? (0) : (1))
+#endif
+
+   #define MOs_strdup _wcsdup
+
+   #if (M_MIL_USE_UNICODE)
+      #if (M_MIL_USING_SAFE_CRT)
+         // Functions used by the Mosxxx functions (which are visible by MIL clients) must support both charset API's
+         #define     MOs_strcpy_sA              strcpy_s
+         #define     MOs_vsprintf_sA            vsprintf_s
+         #define     MOs_strcat_sA              strcat_s
+         #define     MOs_strlwr_sA              _strlwr_s
+         #define     MOs_strupr_sA              _strupr_s
+         #define     MOs_unlink                 _wunlink
+
+      #else
+         #define     MOs_strlwr_sA           strlwr
+         #define     MOs_strupr_sA           strupr
+         #define     MOs_strcpy_sA(A, B, C)      strcpy(A, C)
+         #define     MOs_vsprintf_sA(A, B, C, D) vsprintf(A, C, D)
+         #define     MOs_strcat_sA(A, B, C)      strcat(A, C)
+         #define     MOs_strlwrA                strlwr
+         #define     MOs_struprA                strupr
+         #define     MOs_strcpyA                strcpy
+         #define     MOs_vsprintfA              vsprintf
+         #define     MOs_strcatA                strcat
+         #define     MOs_strlwrA                strlwr
+         #define     MOs_struprA                strupr
+         #define     MOs_unlink                 wunlink
+      #endif
+         #define     MOs_vprintfA               vprintf
+         #define     MOs_strcmpA                strcmp
+   #endif
+
+#endif // !M_WINDOWS_NT_KERNEL_MODE
+#elif (M_MIL_USE_WINDOWS)
+#if !(defined(M_WINDOWS_NT_KERNEL_MODE) && M_WINDOWS_NT_KERNEL_MODE)
+   #define     MOs_strcat        strcat
+   #define     MOs_ANSIstrcat    strcat
+   #define     MOs_atoi          atoi
+   #define     MOs_atol          atol
+   #define     MOs_ANSIatol      atol
+   #define     MOs_atof          atof
+   #define     MOs_strtol        strtol
+   #define     MOs_strtoul       strtoul
+   #define     MOs_ANSIstrtoul   strtoul
+   #define     MOs_strtoui64     _strtoui64
+   #define     MOs_strcpy        strcpy
+   #define     MOs_ANSIstrcpy    strcpy
+   #define     MOs_strncpy       strncpy
+   #define     MOs_ANSIstrncpy   strncpy
+   #define     MOs_strcmp        strcmp
+   #define     MOs_ANSIstrcmp    strcmp
+   #define     MOs_strncmp       strncmp
+   #define     MOs_ANSIstrncmp   strncmp
+   #define     MOs_ANSIstrnicmp  _strnicmp
+   #define     MOs_strncat       strncat
+   #define     MOs_strchr        strchr
+   #define     MOs_strrchr       strrchr
+   #define     MOs_ANSIstrchr    strchr
+   #define     MOs_sprintf       sprintf
+   #define     MOs_ANSIsprintf   sprintf
+   #define     MOs_vsprintf      vsprintf
+   #define     MOs_strstr        strstr
+   #define     MOs_ANSIstrstr    strstr
+   #define     MOs_sscanf        sscanf
+   #define     MOs_ANSIsscanf    sscanf
+   #define     MOs_fscanf        fscanf
+   #define     MOs_strtod        strtod
+   #define     MOs_strlwr        strlwr
+   #define     MOs_system        system
+   #define     MOs_strtok        strtok
+   #define     MOs_ANSIstrtok    strtok
+   #define     MOs_ungetc        ungetc
+   #define     MOs_tolower       tolower
+   #define     MOs_ANSItolower   tolower
+   #define     MOs_tcscpy        _tcscpy
+   #define     MOs_tcslen        _tcslen
+   #define     MOs_tcsncpy       _tcsncpy
+   #define     MOs_toupper       toupper
+   #define     MOs_strspn        strspn
+   #define     MOs_strcspn       strcspn
+   #define     MOs_ANSIstrcspn   strcspn
+   #define     MOs_asctime       asctime
+   #define     MOs_ANSIasctime   asctime
+   #define     MOs_getchar       getchar
+   #define     MOs_ctime         ctime
+   #define     MOs_ftime         _ftime
+   #define     MOs_localtime     localtime
+   #define     MOs_splitpath     _splitpath
+   #define     MOs_makepath      _makepath
+   #define     MOs_strnset       _strnset
+   #define     MOs_strpbrk       strpbrk
+   #define     MOs_isprint       isprint
+   #define     MOs_ANSIisprint   isprint
+   #define     MOs_isspace       isspace
+   #define     MOs_ANSIisspace   isspace
+
+#if M_MIL_USING_SAFE_CRT
+   #define     MOs_sprintf_s              sprintf_s
+   
+   #define     MOs_ANSIsprintf_s          sprintf_s
+
+   #define     MOs_printf_s               printf_s
+   #define     MOs_scanf_s                scanf_s
+   #define     MOs_sscanf_s               sscanf_s
+   #define     MOs_ANSIsscanf_s           sscanf_s
+   #define     MOs_fscanf_s               fscanf_s
+   #define     MOs_strncpy_s              strncpy_s
+   #define     MOs_ANSIstrncpy_s          strncpy_s
+   #define     MOs_asctime_s              asctime_s
+   #define     MOs_ANSIasctime_s          asctime_s
+   #define     MOs_ctime_s                ctime_s
+   #define     MOs_ftime_s                _ftime_s
+   #define     MOs_strcpy_s               strcpy_s
+   #define     MOs_ANSIstrcpy_s           strcpy_s
+   #define     MOs_getenv_s               getenv_s
+   #define     MOs_ANSIgetenv_s           getenv_s
+   #define     MOs_strcat_s               strcat_s
+   #define     MOs_ANSIstrcat_s           strcat_s
+   #define     MOs_fopen_s(A,B,C)         (((*(A) = _fsopen(B,C,_SH_DENYNO)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A,B,C)     (((*(A) = _fsopen(B,C,_SH_DENYNO)) != NULL) ? (0) : (1))
+   #define     MOs_strncat_s              strncat_s
+   #define     MOs_fcvt_s                 _fcvt_s
+   #define     MOs_strtok_s               strtok_s
+   #define     MOs_ANSIstrtok_s           strtok_s
+   #define     MOs_vsprintf_s             vsprintf_s
+   #define     MOs_ANSIvsprintf_s         vsprintf_s
+   #define     MOs_splitpath_s            _splitpath_s
+   #define     MOs_makepath_s             _makepath_s
+   #define     MOs_strnset_s              _strnset_s
+   #define     MOs_strlwr_s               _strlwr_s
+   #define     MOs_strupr_s               _strupr_s
+   #define     MOs_stricmp                _stricmp
+   #define     MOs_ANSIstricmp            _stricmp
+   #define     MOs_strnicmp               _strnicmp
+   #define     MOs_unlink                 _unlink
+   #define     MOs_localtime_s            localtime_s
+   #define     MOs_mbstowcs_s             mbstowcs_s
+   #define     MOs_wcstombs_s             wcstombs_s
+#else
+   #define     MOs_sprintf_s              _snprintf
+   
+   #define     MOs_ANSIsprintf_s          _snprintf
+
+   #define     MOs_printf_s                        printf
+   #define     MOs_sscanf_s                        sscanf
+   #define     MOs_ANSIsscanf_s                    sscanf
+   #define     MOs_fscanf_s                        fscanf
+   #define     MOs_strncpy_s(A, B, C, D)           strncpy(A, C, D)
+   #define     MOs_ANSIstrncpy_s(A, B, C, D)       strncpy(A, C, D)
+   #define     MOs_asctime_s                       asctime_s
+   #define     MOs_ANSIasctime_s                   asctime_s
+   #define     MOs_ctime_s(A,B,C)                  strcpy((A), ctime(C))
+   #define     MOs_ftime_s                         _ftime
+   #define     MOs_strcpy_s(A, B, C)               strcpy(A, C)
+   #define     MOs_ANSIstrcpy_s(A, B, C)           strcpy(A, C)
+   #define     MOs_getenv_s(A, B, C, D)           (getenv(D)) ? strcpy(B, getenv(D)) : strcpy(B, "\0")
+   #define     MOs_ANSIgetenv_s(A, B, C, D)       (getenv(D)) ? strcpy(B, getenv(D)) : strcpy(B, "\0")
+   #define     MOs_strcat_s(A, B, C)               strcat(A, C)
+   #define     MOs_ANSIstrcat_s(A, B, C)           strcat(A, C)
+   #define     MOs_fopen_s(A, B, C)                (((*(A)=fopen(B, C)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A, B, C)            (((*(A)=fopen(B, C)) != NULL) ? (0) : (1))
+   #define     MOs_strncat_s(A, B, C, D)           strncat(A, C, D)
+   #define     MOs_fcvt_s                          _fcvt
+   #define     MOs_strtok_s(A, B, C)               strtok(A, (C, B))
+   #define     MOs_ANSIstrtok_s(A, B, C)           strtok(A, (C, B))
+   #define     MOs_vsprintf_s(A, B, C, D)          vsprintf(A, C, D)
+   #define     MOs_ANSIvsprintf_s(A, B, C, D)      vsprintf(A, C, D)
+   #define     MOs_splitpath_s(A,B,C,D,E,F,G,H,I)  _splitpath(A,B,D,F,H)
+   #define     MOs_makepath_s(A,B,C,D,E,F)         _makepath(A,C,D,E,F)
+   #define     MOs_strnset_s(A,B,C,D)              _strnset(A,C,D)
+   #define     MOs_stricmp                         stricmp
+   #define     MOs_ANSIstricmp                     stricmp
+   #define     MOs_unlink                          unlink
+   #define     MOs_localtime_s(A, B)               A = localtime(B)
+
+   #define     MOs_strnicmp                        strnicmp
+
+   #if M_MIL_USE_WINDOWS
+      #define     MOs_strlwr_s(A, B)                  _strlwr(A)
+      #define     MOs_strupr_s(A, B)                  _strupr(A)
+   #endif
+   #define     MOs_mbstowcs_s(A,B,C,D,E)              (((*(A) =mbstowcs(B,D,E)) != NULL) ? (0) : (1))
+   #define     MOs_wcstombs_s(A,B,C,D,E)              (((*(A) =wcstombs(B,D,E)) != NULL) ? (0) : (1))
+#endif
+
+   #define     MOs_strlen   strlen
+   #define     MOs_ANSIstrlen    strlen //size_t is an __int64 under Win64,
+   #define     MOs_ltoa          _ltoa
+   #define     MOs_itoa          _itoa
+   #define     MOs_ultoa         _ultoa
+   #define     MOs_fprintf       fprintf
+   #define     MOs_ANSIfprintf   fprintf
+   #define     MOs_ANSIvfprintf  vfprintf
+   #define     MOs_vfprintf      vfprintf
+   #define     MOs_printf        printf
+   #define     MOs_scprintf      _scprintf
+   #define     MOs_vprintf       vprintf
+   #define     MOs_ANSIvprintf   vprintf
+//      #define     MOs_vscanf      vscanf NOT SUPPORTED ON ALL PLATFORMS
+   #if M_MIL_USING_SAFE_CRT
+      #define     MOs_printf_s                        printf_s
+   #else
+      #define     MOs_printf_s                        printf
+   #endif
+   #if M_MIL_USE_WINDOWS
+      #define     MOs_strdup   _strdup
+      #define     MOs_strupr   strupr
+   #else
+      #define     MOs_strdup   strdup
+      #define     MOs_strupr(Str) Str
+   #endif
+
+#endif // !M_WINDOWS_NT_KERNEL_MODE
+#elif M_MIL_USE_LINUX
+#if !M_LINUX_KERNEL
+   // forward declarations
+   MIL_TEXT_PTR strupr( MIL_TEXT_PTR String1 );
+   #ifdef __cplusplus
+   extern "C"
+   {
+   #endif
+   MIL_TEXT_PTR MilLinstrlwr(MIL_TEXT_PTR String1);
+   #ifdef __cplusplus
+   }
+   #endif
+
+//   #define     MOs_ltoa        Not implemented under Linux
+//   #define     MOs_itoa        Not implemented under Linux
+//   #define     MOs_ultoa       Not implemented under Linux
+   #define     MOs_atoi          atoi
+   #define     MOs_atol          atol
+   #define     MOs_ANSIatol      atol
+   #define     MOs_atof          atof
+   #define     MOs_strtol        strtol
+   #define     MOs_strtoul       strtoul
+   #define     MOs_ANSIstrtoul   strtoul
+   #define     MOs_strtoui64     strtoull
+   #define     MOs_strcpy        strcpy
+   #define     MOs_ANSIstrcpy    strcpy
+   #define     MOs_strncpy       strncpy
+   #define     MOs_ANSIstrncpy   strncpy
+   #define     MOs_strcmp        strcmp
+   #define     MOs_ANSIstrcmp    strcmp
+   #define     MOs_stricmp       strcasecmp
+   #define     MOs_ANSIstricmp   strcasecmp
+   #define     MOs_strncmp       strncmp
+   #define     MOs_ANSIstrncmp   strncmp
+   #define     MOs_strnicmp      strncasecmp
+   #define     MOs_ANSIstrnicmp  strncasecmp
+   #define     MOs_strcat        strcat
+   #define     MOs_ANSIstrcat    strcat
+   #define     MOs_strncat       strncat
+   #define     MOs_strchr        strchr
+   #define     MOs_strrchr       strrchr
+   #define     MOs_ANSIstrchr    strchr
+   #define     MOs_isprint       isprint
+   #define     MOs_ANSIisprint   isprint
+   #define     MOs_isspace       isspace
+   #define     MOs_ANSIisspace   isspace
+   #define     MOs_strlen        strlen
+   #define     MOs_ANSIstrlen    strlen
+   #define     MOs_strnlen        strnlen
+   #define     MOs_ANSIstrnlen    strnlen
+   #define     MOs_fprintf       fprintf
+   #define     MOs_ANSIfprintf   fprintf
+   #define     MOs_ANSIvfprintf  vfprintf
+   #define     MOs_vfprintf      vfprintf
+   #define     MOs_printf        printf
+   #define     MOs_printf_s      printf
+   #define     MOs_vprintf       vprintf
+   #define     MOs_ANSIvprintf   vprintf
+//   #define     MOs_vscanf  vscanf NOT SUPPORTED ON ALL PLATFORMS
+   #define     MOs_sprintf       sprintf
+   #define     MOs_ANSIsprintf   sprintf
+   #define     MOs_vsprintf      vsprintf
+   #define     MOs_strstr        strstr
+   #define     MOs_ANSIstrstr    strstr
+   #define     MOs_sscanf        sscanf
+   #define     MOs_scanf_s       scanf
+   #define     MOs_ANSIsscanf    sscanf
+   #define     MOs_fscanf        fscanf
+   #define     MOs_strtod        strtod
+   #define     MOs_strupr        strupr
+   #define     MOs_strupr_s(A,B) strupr(A)
+   #define     MOs_strdup        strdup
+   #define     MOs_strlwr        MilLinstrlwr
+   #define     MOs_system        system
+   #define     MOs_strlwr_s(A,B) MilLinstrlwr(A)
+   #define     MOs_strtok        strtok
+   #define     MOs_ANSIstrtok    strtok
+   #define     MOs_ungetc        ungetc
+   #define     MOs_tolower       tolower
+   #define     MOs_ANSItolower   tolower
+   #define     MOs_tcscpy
+   #define     MOs_tcslen
+   #define     MOs_tcsncpy
+   #define     MOs_toupper       toupper
+   #define     MOs_strspn        strspn
+   #define     MOs_strcspn       strcspn
+   #define     MOs_ANSIstrcspn   strcspn
+   #define     MOs_asctime       asctime
+   #define     MOs_asctime_s(A,B,C) strcpy((A), asctime(C))
+   #define     MOs_ANSIasctime   asctime
+   #define     MOs_getchar       getchar
+   #define     MOs_ctime         ctime
+   #define     MOs_ftime         ftime
+   #define     MOs_ctime_s(A,B,C) strcpy((A), ctime(C))
+   #define     MOs_localtime     localtime
+   #define     MOs_localtime_s(A,B) localtime_r(B, A)
+//   #define     MOs_sscanf_s      Not implemented under Linux
+//   #define     MOs_ANSIsscanf_s  Not implemented under Linux
+//   #define     MOs_fscanf_s      Not implemented under Linux
+//   #define     MOs_splitpath     Not implemented under Linux
+//   #define     MOs_makepath      Not implemented under Linux
+//   #define     MOs_strnset       Not implemented under Linux
+   #define     MOs_strpbrk       strpbrk
+   #define     MOs_sprintf_s                       snprintf
+   
+   #define     MOs_ANSIsprintf_s                   snprintf
+  #if defined(_LARGE_FILES) || defined(_LARGEFILE64_SOURCE)
+   #define     MOs_fopen_s(A, B, C)                (((*(A)=fopen64(B, C)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A, B, C)            (((*(A)=fopen64(B, C)) != NULL) ? (0) : (1))
+  #else
+   #define     MOs_fopen_s(A, B, C)                (((*(A)=fopen(B, C)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A, B, C)            (((*(A)=fopen(B, C)) != NULL) ? (0) : (1))
+  #endif
+   #define     MOs_strcpy_s(A, B, C)               strncpy(A, C, B)
+   #define     MOs_ANSIstrcpy_s(A, B, C)           strncpy(A, C, B)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define     MOs_getenv_s(A, B, C, D)                \
+                  do {                                 \
+                     char *tmp = getenv(D);            \
+                     *(A) = (tmp) ? strlen(tmp)+1 : 0; \
+                     if (B && tmp && (*(A) <= C))      \
+                        strcpy(B, tmp);                \
+                  } while(0)
+
+   #define     MOs_ANSIgetenv_s(A, B, C, D)            \
+                  do {                                 \
+                     char *tmp = getenv(D);            \
+                     *(A) = (tmp) ? strlen(tmp)+1 : 0; \
+                     if (B && tmp && (*(A) <= C))      \
+                        strcpy(B, tmp);                \
+                  } while(0)
+
+   #define     MOs_strcat_s(A, B, C)               strncat(A, C, B)
+   #define     MOs_ANSIstrcat_s(A, B, C)           strncat(A, C, B)
+#endif
+   #define     MOs_vsprintf_s(A, B, C, D)          vsnprintf(A, B, C, D)
+   #define     MOs_ANSIvsprintf_s(A, B, C, D)      vsnprintf(A, B, C, D)
+   #define     MOs_strtok_s(A, B, C)               strtok_r(A, B, C)
+   #define     MOs_ANSIstrtok_s(A, B, C)           strtok_r(A, B, C)
+   #define     MOs_unlink                          unlink
+#endif // !M_LINUX_KERNEL
+
+#else
+   #error Operating system not supported in Milos.h!
+#endif
+
+
+/************************************************************************/
+/* FILES RELATED DEFINITIONS                                            */
+/************************************************************************/
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+#include <stdio.h>   /* required for definition of file */
+
+typedef FILE* MIL_FILE;
+#define MIL_EOF      EOF
+#define MIL_STDOUT   ((MIL_FILE)1)
+
+
+#if M_MIL_UNICODE_API
+   #define     MOs_hypot   _hypot
+#if M_MIL_USE_RT
+// there is no environment variable under RTX, so let's return NULL. Also _wgetenv does not exist
+#ifdef __cplusplus
+   inline void* MOs_getenv(MIL_CONST_TEXT_PTR /*Data*/)
+      {
+      return NULL;
+      }
+#else
+#define MOs_getenv(A)      NULL
+#endif
+#else
+
+   #define     MOs_getenv       _wgetenv
+#endif
+   #define     MOs_ANSIgetenv   getenv
+   #define     MOs_chmod     _wchmod
+   #define     MOs_fopen     _wfopen
+   #define     MOs_ANSIfopen fopen
+   #define     MOs_fclose    fclose
+   #define     MOs_fwrite    fwrite
+   #define     MOs_fread     fread
+#if M_MIL_USE_64BIT
+   #define     MOs_fseek    _fseeki64
+#else
+   #define     MOs_fseek    fseek
+#endif
+   #define     MOs_fseek64     _fseeki64
+   #define     MOs_ftell64     _ftelli64
+   #define     MOs_ftell       ftell
+   #define     MOs_feof        feof
+   #define     MOs_ferror      ferror
+   #define     MOs_fflush      fflush
+   #define     MOs_fgetc       fgetc
+   #define     MOs_fgets       fgetws
+   #define     MOs_ANSIfgets   fgets
+   #define     MOs_clearerr    clearerr
+   #define     MOs_remove(n)   (DeleteFile(n) ? 0 : -1)
+   #define     MOs_rename(n,m) (MoveFile(n,m) ? 0 : -1)
+   #define     MOs_copyfile(n,m,b) CopyFile(n,m,b)
+#elif ((M_MIL_USE_WINDOWS) || (!M_MIL_USE_TIFF_OPTIMISATION)) && !M_MIL_USE_LINUX
+#if defined(_MSC_VER)
+   #include <direct.h>         //for _rmdir and _mkdir
+   #include <io.h>             //for _chmod
+#endif
+
+   #define     MOs_chmod       _chmod
+   #define     MOs_fopen       fopen
+   #define     MOs_ANSIfopen   fopen
+   #define     MOs_fclose      fclose
+   #define     MOs_fwrite      fwrite
+   #define     MOs_fread       fread
+#if M_MIL_USE_64BIT
+   #define     MOs_fseek    _fseeki64
+#else
+   #define     MOs_fseek    fseek
+#endif
+   #define     MOs_fseek64     _fseeki64
+   #define     MOs_ftell64     _ftelli64
+   #define     MOs_ftell     ftell
+   #define     MOs_feof      feof
+   #define     MOs_ferror    ferror
+   #define     MOs_fflush    fflush
+   #define     MOs_fgetc     fgetc
+   #define     MOs_fgets     fgets
+   #define     MOs_ANSIfgets fgets
+   #define     MOs_clearerr  clearerr
+   #define     MOs_remove    remove
+   #define     MOs_rename    rename
+   #define     MOs_copyfile  CopyFile
+#if _MSC_VER >= 1400
+   #define     MOs_hypot   _hypot
+#else
+   #define     MOs_hypot   hypot
+#endif
+   #define     MOs_getenv      getenv
+   #define     MOs_ANSIgetenv  getenv
+   #define     MOs_putenv      putenv
+   #define     MOs_fputs       fputs
+   #define     MOs_fputc       fputc
+#elif M_MIL_USE_LINUX
+  #if defined(_LARGE_FILES) || defined(_LARGEFILE64_SOURCE)
+   #define     MOs_fopen        fopen64
+   #define     MOs_ANSIfopen    fopen64
+   #define     MOs_fseek        fseeko64
+   #define     MOs_ftell        ftello64
+  #else
+   #define     MOs_fopen        fopen
+   #define     MOs_ANSIfopen    fopen
+   #define     MOs_fseek        fseek
+   #define     MOs_ftell        ftell
+  #endif
+   #define     MOs_fseek64      fseeko64
+   #define     MOs_ftell64      ftello64
+   #define     MOs_chmod        chmod
+   #define     MOs_fclose       fclose
+   #define     MOs_fwrite       fwrite
+   #define     MOs_fread        fread
+   #define     MOs_feof         feof
+   #define     MOs_ferror       ferror
+   #define     MOs_fflush       fflush
+   #define     MOs_fgetc        fgetc
+   #define     MOs_fgets        fgets
+   #define     MOs_ANSIfgets    fgets
+   #define     MOs_ANSIfputs    fputs
+   #define     MOs_fputs        fputs
+   #define     MOs_clearerr     clearerr
+   #define     MOs_remove       remove
+   #define     MOs_rename       rename
+   #define     MOs_copyfile     LinCopyFile
+   #define     MOs_hypot        hypot
+   #define     MOs_getenv       getenv
+   #define     MOs_ANSIgetenv   getenv
+   #define     MOs_putenv       putenv
+   #define     MOs_fputs        fputs
+   #define     MOs_fputc        fputc
+
+#else
+   #error Operating system not supported in Milos.h!
+#endif
+
+#endif // M_LINUX_KERNEL
+
+
+/************************************************************************/
+/* C++ EXCEPTIONS SUPPORT                                               */
+/************************************************************************/
+   #define MOs_try                        try
+   #define MOs_catch(x)                   catch(x)
+   #define MOs_throw                      throw
+
+// Macro usage are deprecated, please use MosXXX() functions if equivalent exist.
+#if defined(M_MIL_WARN_ON_DEPRECATED_MOS) && M_MIL_WARN_ON_DEPRECATED_MOS
+   MIL_DEPRECATED(MOs_ltoa, 1000)
+   MIL_DEPRECATED(MOs_itoa, 1000)
+   MIL_DEPRECATED(MOs_ultoa, 1000)
+   MIL_DEPRECATED(MOs_atoi, 1000)
+   MIL_DEPRECATED(MOs_atol, 1000)
+   MIL_DEPRECATED(MOs_ANSIatol, 1000)
+   MIL_DEPRECATED(MOs_atof, 1000)
+   MIL_DEPRECATED(MOs_strtol, 1000)
+   MIL_DEPRECATED(MOs_strtoul, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrtoul, 1000)
+   MIL_DEPRECATED(MOs_strtoui64, 1000)
+   MIL_DEPRECATED(MOs_strcpy, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcpy, 1000)
+   MIL_DEPRECATED(MOs_strncpy, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrncpy, 1000)
+   MIL_DEPRECATED(MOs_strcmp, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcmp, 1000)
+   MIL_DEPRECATED(MOs_stricmp, 1000)
+   MIL_DEPRECATED(MOs_ANSIstricmp, 1000)
+   MIL_DEPRECATED(MOs_strncmp, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrncmp, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrnicmp, 1000)
+   MIL_DEPRECATED(MOs_strcat, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcat, 1000)
+   MIL_DEPRECATED(MOs_strncat, 1000)
+   MIL_DEPRECATED(MOs_strchr, 1000)
+   MIL_DEPRECATED(MOs_strrchr, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrchr, 1000)
+   MIL_DEPRECATED(MOs_strlen, 1000)
+   MIL_DEPRECATED(MOs_strnlen, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrlen, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrnlen, 1000)
+   MIL_DEPRECATED(MOs_sprintf, 1000)
+   MIL_DEPRECATED(MOs_ANSIsprintf, 1000)
+   MIL_DEPRECATED(MOs_vsprintf, 1000)
+   MIL_DEPRECATED(MOs_sscanf, 1000)
+   MIL_DEPRECATED(MOs_ANSIsscanf, 1000)
+   MIL_DEPRECATED(MOs_fscanf, 1000)
+   MIL_DEPRECATED(MOs_fprintf, 1000)
+   MIL_DEPRECATED(MOs_ANSIfprintf, 1000)
+   MIL_DEPRECATED(MOs_ANSIvfprintf, 1000)
+   MIL_DEPRECATED(MOs_vfprintf, 1000)
+   MIL_DEPRECATED(MOs_strtod, 1000)
+   MIL_DEPRECATED(MOs_strupr, 1000)
+   MIL_DEPRECATED(MOs_getchar, 1000)
+   MIL_DEPRECATED(MOs_ctime, 1000)
+   MIL_DEPRECATED(MOs_ftime, 1000)
+   MIL_DEPRECATED(MOs_localtime, 1000)
+   MIL_DEPRECATED(MOs_strlwr, 1000)
+   MIL_DEPRECATED(MOs_system, 1000)
+   MIL_DEPRECATED(MOs_printf, 1000)
+   MIL_DEPRECATED(MOs_vprintf, 1000)
+   MIL_DEPRECATED(MOs_fputs, 1000)
+   MIL_DEPRECATED(MOs_ANSIfputs, 1000)
+   MIL_DEPRECATED(MOs_fputc, 1000)
+   MIL_DEPRECATED(MOs_strtok, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrtok, 1000)
+   MIL_DEPRECATED(MOs_ungetc, 1000)
+   MIL_DEPRECATED(MOs_tolower, 1000)
+   MIL_DEPRECATED(MOs_ANSItolower, 1000)
+   MIL_DEPRECATED(MOs_toupper, 1000)
+   MIL_DEPRECATED(MOs_strspn, 1000)
+   MIL_DEPRECATED(MOs_strcspn, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcspn, 1000)
+   MIL_DEPRECATED(MOs_asctime, 1000)
+   MIL_DEPRECATED(MOs_ANSIasctime, 1000)
+   MIL_DEPRECATED(MOs_strstr, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrstr, 1000)
+   MIL_DEPRECATED(MOs_splitpath, 1000)
+   MIL_DEPRECATED(MOs_makepath, 1000)
+   MIL_DEPRECATED(MOs_strnset, 1000)
+   MIL_DEPRECATED(MOs_strpbrk, 1000)
+   MIL_DEPRECATED(MOs_sprintf_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIsprintf_s, 1000)
+   MIL_DEPRECATED(MOs_printf_s, 1000)
+   MIL_DEPRECATED(MOs_sscanf_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIsscanf_s, 1000)
+   MIL_DEPRECATED(MOs_fscanf_s, 1000)
+   MIL_DEPRECATED(MOs_strncpy_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrncpy_s, 1000)
+   MIL_DEPRECATED(MOs_asctime_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIasctime_s, 1000)
+   MIL_DEPRECATED(MOs_strcpy_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcpy_s, 1000)
+   MIL_DEPRECATED(MOs_getenv_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIgetenv_s, 1000)
+   MIL_DEPRECATED(MOs_strcat_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcat_s, 1000)
+   MIL_DEPRECATED(MOs_fopen_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIfopen_s, 1000)
+   MIL_DEPRECATED(MOs_strncat_s, 1000)
+   MIL_DEPRECATED(MOs_fcvt_s, 1000)
+   MIL_DEPRECATED(MOs_strtok_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrtok_s, 1000)
+   MIL_DEPRECATED(MOs_vsprintf_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIvsprintf_s, 1000)
+   MIL_DEPRECATED(MOs_splitpath_s, 1000)
+   MIL_DEPRECATED(MOs_makepath_s, 1000)
+   MIL_DEPRECATED(MOs_strnset_s, 1000)
+   MIL_DEPRECATED(MOs_strlwr_s, 1000)
+   MIL_DEPRECATED(MOs_strupr_s, 1000)
+   MIL_DEPRECATED(MOs_strnicmp, 1000)
+   MIL_DEPRECATED(MOs_ctime_s, 1000)
+   MIL_DEPRECATED(MOs_ftime_s, 1000)
+   MIL_DEPRECATED(MOs_localtime_s, 1000)
+   MIL_DEPRECATED(MOs_mbstowcs_s, 1000)
+   MIL_DEPRECATED(MOs_wcstombs_s, 1000)
+   MIL_DEPRECATED(MOs_strdup, 1000)
+   MIL_DEPRECATED(MOs_strlwr_sA, 1000)
+   MIL_DEPRECATED(MOs_strupr_sA, 1000)
+   MIL_DEPRECATED(MOs_strcpy_sA, 1000)
+   MIL_DEPRECATED(MOs_vsprintf_sA, 1000)
+   MIL_DEPRECATED(MOs_strcat_sA, 1000)
+   MIL_DEPRECATED(MOs_strlwrA, 1000)
+   MIL_DEPRECATED(MOs_struprA, 1000)
+   MIL_DEPRECATED(MOs_strcpyA, 1000)
+   MIL_DEPRECATED(MOs_vsprintfA, 1000)
+   MIL_DEPRECATED(MOs_strcatA, 1000)
+   MIL_DEPRECATED(MOs_strlwrA, 1000)
+   MIL_DEPRECATED(MOs_struprA, 1000)
+   MIL_DEPRECATED(MOs_unlink, 1000)
+   MIL_DEPRECATED(MOs_vprintfA, 1000)
+   MIL_DEPRECATED(MOs_strcmpA, 1000)
+   MIL_DEPRECATED(MOs_hypot, 1000)
+   MIL_DEPRECATED(MOs_getenv, 1000)
+   MIL_DEPRECATED(MOs_ANSIgetenv, 1000)
+   MIL_DEPRECATED(MOs_mkdir, 1000)
+   MIL_DEPRECATED(MOs_rmdir, 1000)
+   MIL_DEPRECATED(MOs_chmod, 1000)
+   MIL_DEPRECATED(MOs_fopen, 1000)
+   MIL_DEPRECATED(MOs_ANSIfopen, 1000)
+   MIL_DEPRECATED(MOs_fclose, 1000)
+   MIL_DEPRECATED(MOs_fwrite, 1000)
+   MIL_DEPRECATED(MOs_fread, 1000)
+   MIL_DEPRECATED(MOs_fseek, 1000)
+   MIL_DEPRECATED(MOs_fseek64, 1000)
+   MIL_DEPRECATED(MOs_ftell, 1000)
+   MIL_DEPRECATED(MOs_ftell64, 1000)
+   MIL_DEPRECATED(MOs_feof, 1000)
+   MIL_DEPRECATED(MOs_ferror, 1000)
+   MIL_DEPRECATED(MOs_fflush, 1000)
+   MIL_DEPRECATED(MOs_fgetc, 1000)
+   MIL_DEPRECATED(MOs_fgets, 1000)
+   MIL_DEPRECATED(MOs_ANSIfgets, 1000)
+   MIL_DEPRECATED(MOs_clearerr, 1000)
+   MIL_DEPRECATED(MOs_remove, 1000)
+   MIL_DEPRECATED(MOs_rename, 1000)
+   MIL_DEPRECATED(MOs_copyfile, 1000)
+   MIL_DEPRECATED(MOs_putenv, 1000)
+   MIL_DEPRECATED(MOs_try, 1000)
+   MIL_DEPRECATED(MOs_catch, 1000)
+   MIL_DEPRECATED(MOs_throw, 1000)
+#endif
+
+/************************************************************************/
+/* SUPPORT FOR nullptr                                                  */
+/************************************************************************/
+
+#ifndef M_MIL_USE_NULLPTR
+   #ifdef __cplusplus
+      #if defined(_MSC_VER) && (_MSC_VER >= 1600) // On Windows
+         #define M_MIL_USE_NULLPTR 1
+      #elif (!M_LINUX_KERNEL) && (__cplusplus >= 201103L) // On Linux (and potentially others)
+         #define M_MIL_USE_NULLPTR 1
+      #endif
+   #endif
+#endif
+
+#ifndef M_MIL_USE_NULLPTR
+   #define M_MIL_USE_NULLPTR 0
+#endif
+
+/************************************************************************/
+/* SUPPORT FOR noexcept                                                 */
+/************************************************************************/
+
+#ifndef MIL_NOEXCEPT
+   #ifdef __cplusplus
+      #if defined(_MSC_VER) && (_MSC_VER >= 1900) // On Windows
+         #define MIL_NOEXCEPT noexcept
+      #elif (!M_LINUX_KERNEL) && (__cplusplus >= 201103L) // On Linux (and potentially others)
+         #define MIL_NOEXCEPT noexcept
+      #endif
+   #endif
+#endif
+
+#ifndef MIL_NOEXCEPT
+   #define MIL_NOEXCEPT
+#endif
+
+/************************************************************************/
+/* SUPPORT FOR MOVE SEMANTICS                                           */
+/************************************************************************/
+
+#ifndef M_MIL_USE_MOVE_SEMANTICS
+   #ifdef __cplusplus
+      #if defined(_MSC_VER) && (_MSC_VER >= 1700) // On Windows
+         #define M_MIL_USE_MOVE_SEMANTICS 1
+      #elif (!M_LINUX_KERNEL) && (__cplusplus >= 201103L) // On Linux (and potentially others)
+         #define M_MIL_USE_MOVE_SEMANTICS 1
+      #endif
+   #endif
+#endif
+
+#ifndef M_MIL_USE_MOVE_SEMANTICS
+   #define M_MIL_USE_MOVE_SEMANTICS 0
+#endif
+
+#ifndef M_MIL_USE_REF_QUALIFIERS
+   #ifdef __cplusplus
+      #if defined(_MSC_VER) && (_MSC_VER >= 1900) // On Windows
+         #define M_MIL_USE_REF_QUALIFIERS 1
+      #elif (!M_LINUX_KERNEL) && (__cplusplus >= 201103L) // On Linux (and potentially others)
+         #define M_MIL_USE_REF_QUALIFIERS 1
+      #endif
+   #endif
+#endif
+
+#ifndef M_MIL_USE_REF_QUALIFIERS
+   #define M_MIL_USE_REF_QUALIFIERS 0
+#endif
+
+/************************************************************************/
+/* SAFETYPE FUNCTIONS ON/OFF                                            */
+/************************************************************************/
+
+/* 
+The SafeType functions overload the C functions that receive a void*
+argument.
+
+A C++ overload is defined for each possible type of pointer that can be
+received. The type of data received is compared with the expected data
+type according to MIL documentation.
+
+Two types of FALSE POSITIVE errors can occur:
+1. Compile time error 
+
+   If a wrapper has been build around a MIL function and the MIL
+   function is called via a void*, for ex:
+      void MyBufInquire(MIL_ID Id, MIL_INT64 InquireType, void *Ptr) 
+         {
+         MbufInquire(Id, InquireType, Ptr);
+         }
+
+   If the following syntax is used to access an array on the stack:
+      {
+      double AllScores[MAX_NUM_OCCURENCES];
+      MmodGetResult(ResultId, M_ALL, M_SCORE+M_TYPE_DOUBLE, &AllScores) ;
+      }
+   The only thing to do is to remove the " & ".
+
+   In these situations, the error will be
+   "none of the ?? overloads could convert all the argument types"
+
+2. Run time error: the inline function SafeTypeError is called.
+
+   If the application voluntarily passes a pointer of the wrong 
+   type of data, for example:
+      {
+      char *Ptr = new char[sizeof(double)];
+      MmodGetResult(ResultId, 0, M_SCORE+M_TYPE_DOUBLE, Ptr);
+      double Score = (double*)Ptr;
+      }
+   It is possible to remove this error by casting Ptr to the correct
+   type if available.
+
+TO DEACTIVATE THE SAFE TYPE OVERLOADS AND GET RID OF COMPILE-TIME
+OR RUN-TIME ERRORS:
+
+1. Deactivate globally by using
+   #define M_MIL_USE_SAFE_TYPE 0
+   before including mil.h
+
+OR
+
+2. Deactivate locally by adding "Unsafe" as a suffix to the 
+   function name.
+
+*/
+
+/* Safe type is activated by default in C++ and in Debug.
+   It is deactivated in Release or in C. */
+#ifndef M_MIL_USE_SAFE_TYPE
+   #if !defined(__cplusplus)
+      #define M_MIL_USE_SAFE_TYPE 0 /* In C, there is no multiple overload of a function. */
+   #elif defined(NDEBUG) || defined(__OPTIMIZE__)
+      #define M_MIL_USE_SAFE_TYPE 0 /* Disable SafeType in Release to avoid added overhead. */
+   #elif M_MIL_USE_LINUX
+      #if M_LINUX_KERNEL
+         #define M_MIL_USE_SAFE_TYPE 0
+      #else
+         #define M_MIL_USE_SAFE_TYPE 1
+      #endif
+   #elif (defined(M_WINDOWS_NT_KERNEL_MODE) && M_WINDOWS_NT_KERNEL_MODE)
+      #define M_MIL_USE_SAFE_TYPE 0 /* Driver compilation defines double to MIL_INT64, causing ambiguous calls. */
+   #else
+      #define M_MIL_USE_SAFE_TYPE 1 /* Enable SafeType in Debug. */
+   #endif
+#endif
+
+#define M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS (M_MIL_USE_SAFE_TYPE && M_MIL_USE_NULLPTR)
+
+#if M_MIL_USE_NULLPTR
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4668)
+#endif
+
+#include <cstddef> // for std::nullptr_t
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+
+#endif
+
+#if M_MIL_USE_SAFE_TYPE && !__cplusplus
+#error M_MIL_USE_SAFE_TYPE can only be activated with C++ compilation.
+#endif
+
+// Even if the MIL documentation does not officially support pointers to "unsigned"
+// integers, many applications do it anyway without problems. We support it here to
+// avoid too many false errors.
+#ifndef M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+#define M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED 1
+#endif
+
+// It would be safer to ensure that when asking for pointers we only fill 
+// double pointers (ex: void**), but too much code exists that probably fills a 
+// pointer into an integer of the correct type.
+#ifndef M_MIL_SAFE_TYPE_STRONG_POINTER_CHECK
+#define M_MIL_SAFE_TYPE_STRONG_POINTER_CHECK 0
+#endif
+
+#if M_MIL_SAFE_TYPE_STRONG_POINTER_CHECK
+   // An integer will not be accepted to hold pointers.
+   #define M_SAFE_TYPE_CHECK_PTR   M_TYPE_PTR
+#else
+   // An integer of the correct size will be accepted to hold pointers.
+   #if M_MIL_USE_64BIT
+      #define M_SAFE_TYPE_CHECK_PTR   M_TYPE_MIL_INT64
+   #else
+      #define M_SAFE_TYPE_CHECK_PTR   M_TYPE_MIL_INT32
+   #endif
+#endif
+
+// With VisualStudio compilers, we may have to add the definition of pointers to 
+// wchar_t since it is different from unsigned short
+#if (M_MIL_USE_UNICODE ) && (defined(_NATIVE_WCHAR_T_DEFINED) || defined(__MINGW32__))
+#define M_MIL_SAFE_TYPE_ADD_WCHAR_T 1
+#endif
+
+#endif /* #ifndef __MILOS_H */
diff --git a/Common_Class/Matrox/Include/Milproto.h b/Common_Class/Matrox/Include/Milproto.h
new file mode 100644
index 0000000..906b9d8
--- /dev/null
+++ b/Common_Class/Matrox/Include/Milproto.h
@@ -0,0 +1,9696 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILPROTO.H
+    Owner   :  Matrox Imaging
+    Revision:  10.40.0640
+    Content :  This file contains the prototypes for the Matrox
+               Imaging Library (MIL) C user's functions.
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef __MILPROTO_H
+#define __MILPROTO_H
+
+#include <stdarg.h>
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/***************************************************************************/
+/* HOOK HANDLER PROTOTYPE                                                  */
+/***************************************************************************/
+typedef MIL_INT (MFTYPE* MIL_HOOK_FUNCTION_PTR)(MIL_INT HookType,
+                                                MIL_ID EventId,
+                                                void* UserData);
+
+
+/***************************************************************************/
+/* GRAPHIC MODULE:                                                         */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CONTROL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC MIL_ID MFTYPE  MgraAlloc            (MIL_ID SysId,
+                                     MIL_ID* ContextGraIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MgraAllocList        (MIL_ID SysId,
+                                     MIL_INT64 ListGraType,
+                                     MIL_ID *ListGraIdPtr);
+
+MIL_DLLFUNC void MFTYPE    MgraFree             (MIL_ID ObjectId);
+
+MIL_DLLFUNC void MFTYPE    MgraColorDouble      (MIL_ID ContextGraId,
+                                     MIL_DOUBLE ForegroundColor);
+
+MIL_DLLFUNC void MFTYPE    MgraBackColorDouble  (MIL_ID ContextGraId,
+                                     MIL_DOUBLE BackgroundColor);
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC void MFTYPE    MgraFontW            (MIL_ID ContextGraId,
+                                     MIL_INT64  FontName);
+MIL_DLLFUNC void MFTYPE    MgraFontA            (MIL_ID ContextGraId,
+                                     MIL_INT64  FontName);
+#if M_MIL_UNICODE_API
+#define MgraFont           MgraFontW
+#else
+#define MgraFont           MgraFontA
+#endif
+
+#else
+MIL_DLLFUNC void MFTYPE    MgraFont             (MIL_ID     ContextGraId,
+                                     MIL_INT64  FontName);
+#endif
+
+MIL_DLLFUNC void* MFTYPE MgraFontGetLarge(void);
+MIL_DLLFUNC void* MFTYPE MgraFontGetSmall(void);
+MIL_DLLFUNC void* MFTYPE MgraFontGetMedium(void);
+
+MIL_DLLFUNC void MFTYPE    MgraFontScale        (MIL_ID ContextGraId,
+                                     MIL_DOUBLE XFontScale,
+                                     MIL_DOUBLE YFontScale);
+
+MIL_DLLFUNC MIL_INT    MFTYPE    MgraInquire    (MIL_ID ContextGraId,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MgraControlListInt64 (MIL_ID GraListId,
+                                     MIL_INT LabelOrIndex,
+                                     MIL_INT SubIndex,
+                                     MIL_INT64 ControlType,
+                                     MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MgraControlListDouble(MIL_ID GraListId,
+                                     MIL_INT LabelOrIndex,
+                                     MIL_INT SubIndex,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MgraControlInt64 (MIL_ID ContextGraId,
+                                 MIL_INT64 ControlType,
+                                 MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MgraControlDouble(MIL_ID ContextGraId,
+                                 MIL_INT64 ControlType,
+                                 MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MgraControlListDouble MgraControlList
+#define MgraControlListInt64  MgraControlList
+MIL_DLLFUNC void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                     MIL_INT LabelOrIndex,
+                                     MIL_INT SubIndex,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue);
+
+#define MgraControlDouble MgraControl
+#define MgraControlInt64  MgraControl
+MIL_DLLFUNC void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                            MIL_INT64 ControlType,
+                            MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC MIL_INT MFTYPE MgraInquireList      (MIL_ID GraListId,
+                                     MIL_INT LabelOrIndex,
+                                     MIL_INT SubIndex,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MgraGetNeighbors        (MIL_ID        GraphListId            ,
+                                     MIL_ID        DisplayId              ,
+                                     MIL_ID        CalOrImageId           ,
+                                     MIL_INT       LabelOrIndex           ,
+                                     MIL_INT64     Operation              ,
+                                     MIL_DOUBLE    PosX                   ,
+                                     MIL_DOUBLE    PosY                   ,
+                                     MIL_DOUBLE    Param1                 ,
+                                     MIL_DOUBLE    Param2                 ,
+                                     MIL_INT64     ResultOutputUnits      ,
+                                     MIL_INT       MaxNumNeighbors        ,
+                                     MIL_INT*      NumNeighborsFoundPtr   ,
+                                     MIL_INT*      ObjectLabelOrIndexArray,
+                                     MIL_DOUBLE*   ObjectPosXArray        ,
+                                     MIL_DOUBLE*   ObjectPosYArray        ,
+                                     MIL_INT64     ControlFlag            );
+
+MIL_DLLFUNC void MFTYPE MgraGetBoundingBox      (MIL_ID        GraphListId,
+                                     MIL_ID        CalOrImageId,
+                                     MIL_INT64     LabelOrIndex,
+                                     MIL_INT64     Units,
+                                     MIL_DOUBLE*   MinXPtr,
+                                     MIL_DOUBLE*   MinYPtr,
+                                     MIL_DOUBLE*   MaxXPtr,
+                                     MIL_DOUBLE*   MaxYPtr,
+                                     MIL_INT64     ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MgraDraw                (MIL_ID        GraListId,
+                                     MIL_ID        DestImageId,
+                                     MIL_INT64     ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MgraDrawZoom            (MIL_ID        GraphListId,
+                                     MIL_ID        ImageId,
+                                     MIL_ID        CalibrationId,
+                                     MIL_DOUBLE    ScaleX,
+                                     MIL_DOUBLE    ScaleY,
+                                     MIL_DOUBLE    OffsetX,
+                                     MIL_DOUBLE    OffsetY,
+                                     MIL_INT       SizeX,
+                                     MIL_INT       SizeY,
+                                     MIL_INT64     ControlFlag);
+
+typedef MIL_HOOK_FUNCTION_PTR MIL_GRA_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void MFTYPE MgraHookFunction        (MIL_ID GraListId,
+                                     MIL_INT HookType,
+                                     MIL_GRA_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                     void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MgraGetHookInfo      (MIL_ID EventId,
+                                     MIL_INT64 InfoType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MgraMessage             (MIL_ID   GraListId,
+                                     MIL_INT  MessageType,
+                                     MIL_INT  MessageParam1,
+                                     MIL_INT  MessageParam2,
+                                     MIL_INT  MessageParam3,
+                                     MIL_INT  CombinationKeys,
+                                     MIL_ID   CalOrImageId,
+                                     MIL_DOUBLE DisplayOffX,
+                                     MIL_DOUBLE DisplayOffY,
+                                     MIL_DOUBLE DisplayScaleX,
+                                     MIL_DOUBLE DisplayScaleY,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_INT* StatusPtr);
+
+MIL_DLLFUNC void MFTYPE MgraMessageEx(MIL_ID   GraListId,
+                                      MIL_INT  MessageType,
+                                      MIL_INT  MessageParam1,
+                                      MIL_INT  MessageParam2,
+                                      MIL_INT  MessageParam3,
+                                      MIL_INT  CombinationKeys,
+                                      MIL_ID   CalOrImageId,
+                                      MIL_DOUBLE DisplayOffX,
+                                      MIL_DOUBLE DisplayOffY,
+                                      MIL_DOUBLE DisplayScaleX,
+                                      MIL_DOUBLE DisplayScaleY,
+                                      MIL_INT    Dpi,
+                                      MIL_INT64 ControlFlag,
+                                      MIL_INT* StatusPtr);
+
+MIL_DLLFUNC void MFTYPE MgraCopy                (MIL_ID         SrcListGraId           ,
+                                     MIL_ID         DstListGraId           ,
+                                     MIL_INT64      Operation              ,
+                                     MIL_INT        InsertLocation         ,
+                                     MIL_INT        NumGraphics            ,
+                                     const MIL_INT* SrcIndexOrLabelArrayPtr,
+                                     MIL_INT*       DstLabelArrayPtr       ,
+                                     MIL_INT64      ControlFlag            );
+
+MIL_DLLFUNC void MFTYPE MgraProcess             (MIL_ID SrcGraphListId,
+                                     MIL_ID DstGraphListId,
+                                     MIL_ID CalOrImageId,
+                                     MIL_INT SrcLabelOrIndex,
+                                     MIL_INT DstLabelOrIndex,
+                                     MIL_INT64 Operation,
+                                     MIL_DOUBLE Param);
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC void MFTYPE MgraSaveW(MIL_CONST_TEXTW_PTR  FileName,
+                      MIL_ID              GraphListId,
+                      MIL_INT64           ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE MgraRestoreW(MIL_CONST_TEXTW_PTR FileName,
+                           MIL_ID             SystemId,
+                           MIL_INT64          ControlFlag,
+                           MIL_ID*            GraphListIdPtr);
+
+MIL_DLLFUNC void MFTYPE MgraStreamW(MIL_TEXTW_PTR MemPtrOrFileName,
+                        MIL_ID       SystemId,
+                        MIL_INT64    Operation,
+                        MIL_INT64    StreamType,
+                        MIL_DOUBLE   Version,
+                        MIL_INT64    ControlFlag,
+                        MIL_ID*      GraphListIdPtr,
+                        MIL_INT*     SizeByteVarPtr);
+
+MIL_DLLFUNC void MFTYPE MgraSaveA(MIL_CONST_TEXTA_PTR  FileName,
+                      MIL_ID       GraphListId,
+                      MIL_INT64    ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE MgraRestoreA(MIL_CONST_TEXTA_PTR FileName,
+                           MIL_ID      SystemId,
+                           MIL_INT64   ControlFlag,
+                           MIL_ID*     GraphListIdPtr);
+
+MIL_DLLFUNC void MFTYPE MgraStreamA(MIL_TEXTA_PTR  MemPtrOrFileName,
+                        MIL_ID       SystemId,
+                        MIL_INT64    Operation,
+                        MIL_INT64    StreamType,
+                        MIL_DOUBLE   Version,
+                        MIL_INT64    ControlFlag,
+                        MIL_ID*      ObjectIdPtr,
+                        MIL_INT*     GraphListIdPtr);
+#if M_MIL_UNICODE_API
+#define MgraSave           MgraSaveW
+#define MgraRestore        MgraRestoreW
+#define MgraStream         MgraStreamW
+#else
+#define MgraSave           MgraSaveA
+#define MgraRestore        MgraRestoreA
+#define MgraStream         MgraStreamA
+#endif
+
+#else
+MIL_DLLFUNC void MFTYPE MgraSave(MIL_CONST_TEXT_PTR  FileName,
+                     MIL_ID              GraphListId,
+                     MIL_INT64           ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE MgraRestore(MIL_CONST_TEXT_PTR FileName,
+                          MIL_ID             SystemId,
+                          MIL_INT64          ControlFlag,
+                          MIL_ID*            GraphListIdPtr);
+
+MIL_DLLFUNC void MFTYPE MgraStream(MIL_TEXT_PTR MemPtrOrFileName,
+                       MIL_ID       SystemId,
+                       MIL_INT64    Operation,
+                       MIL_INT64    StreamType,
+                       MIL_DOUBLE   Version,
+                       MIL_INT64    ControlFlag,
+                       MIL_ID*      GraphListIdPtr,
+                       MIL_INT*     SizeByteVarPtr);
+
+#endif
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+       /* DRAWING : */
+
+      /* -------------------------------------------------------------- */
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraDotDouble        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos);
+
+   MIL_DLLFUNC void MFTYPE    MgraDotDoubleEx      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraDotInt64         (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XPos,
+                                        MIL_INT64 YPos);
+
+   MIL_DLLFUNC void MFTYPE    MgraDotInt64Ex       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XPos,
+                                        MIL_INT64 YPos,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+#else
+   MIL_DLLFUNC void MFTYPE    MgraDot              (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos);
+
+   MIL_DLLFUNC void MFTYPE    MgraDotEx            (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   #define MgraDotDouble MgraDot
+   #define MgraDotInt64  MgraDot
+   #define MgraDotDoubleEx MgraDotEx
+   #define MgraDotInt64Ex  MgraDotEx  
+#endif
+
+
+/* -------------------------------------------------------------- */
+MIL_DLLFUNC void MFTYPE    MgraDotsDouble       (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_DOUBLE *PosXArrayPtr,
+                                     const MIL_DOUBLE *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsInt64        (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_INT64 *PosXArrayPtr,
+                                     const MIL_INT64 *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsInt32        (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_INT32 *PosXArrayPtr,
+                                     const MIL_INT32 *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsDoubleEx     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_DOUBLE *PosXArrayPtr,
+                                     const MIL_DOUBLE *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsInt64Ex      (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_INT64 *PosXArrayPtr,
+                                     const MIL_INT64 *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsInt32Ex      (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_INT32 *PosXArrayPtr,
+                                     const MIL_INT32 *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+/* -------------------------------------------------------------- */
+MIL_DLLFUNC void MFTYPE    MgraSymbolsDouble    (MIL_ID ContextGraId,
+                                     MIL_ID DestImageBufIdOrGraListId,
+                                     MIL_INT  NumberOfSymbols,
+                                     const MIL_DOUBLE *XPosArray,
+                                     const MIL_DOUBLE *YPosArray,
+                                     const MIL_DOUBLE *AngleArray,
+                                     MIL_DOUBLE Dimension,
+                                     MIL_INT64 SymbolType,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraSymbolsDoubleEx  (MIL_ID ContextGraId,
+                                     MIL_ID DestImageBufIdOrGraListId,
+                                     MIL_INT  NumberOfSymbols,
+                                     const MIL_DOUBLE *XPosArray,
+                                     const MIL_DOUBLE *YPosArray,
+                                     const MIL_DOUBLE *AngleArray,
+                                     MIL_DOUBLE Dimension,
+                                     MIL_INT64 SymbolType,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_INT64 AngleUnits,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraLineDouble       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraLineDoubleEx     (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraLineInt64        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraLineInt64Ex      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraLine             (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraLineEx           (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   #define MgraLineDouble MgraLine
+   #define MgraLineInt64  MgraLine
+   #define MgraLineDoubleEx MgraLineEx
+   #define MgraLineInt64Ex  MgraLineEx
+#endif
+
+/* -------------------------------------------------------------- */
+MIL_DLLFUNC void MFTYPE    MgraLinesDouble      (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_DOUBLE *XPtr,
+                                     const MIL_DOUBLE *YPtr,
+                                     const MIL_DOUBLE *X2Ptr,
+                                     const MIL_DOUBLE *Y2Ptr,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MgraLinesInt64       (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_INT64 *XPtr,
+                                     const MIL_INT64 *YPtr,
+                                     const MIL_INT64 *X2Ptr,
+                                     const MIL_INT64 *Y2Ptr,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MgraLinesInt32       (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_INT32 *XPtr,
+                                     const MIL_INT32 *YPtr,
+                                     const MIL_INT32 *X2Ptr,
+                                     const MIL_INT32 *Y2Ptr,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraLinesDoubleEx    (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_DOUBLE *XPtr,
+                                     const MIL_DOUBLE *YPtr,
+                                     const MIL_DOUBLE *X2Ptr,
+                                     const MIL_DOUBLE *Y2Ptr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraLinesInt64Ex     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_INT64 *XPtr,
+                                     const MIL_INT64 *YPtr,
+                                     const MIL_INT64 *X2Ptr,
+                                     const MIL_INT64 *Y2Ptr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraLinesInt32Ex     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_INT32 *XPtr,
+                                     const MIL_INT32 *YPtr,
+                                     const MIL_INT32 *X2Ptr,
+                                     const MIL_INT32 *Y2Ptr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraArcDouble        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcDoubleEx      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcInt64         (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XCenter,
+                                        MIL_INT64 YCenter,
+                                        MIL_INT64 XRad,
+                                        MIL_INT64 YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcInt64Ex       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XCenter,
+                                        MIL_INT64 YCenter,
+                                        MIL_INT64 XRad,
+                                        MIL_INT64 YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraArc              (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcEx            (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   #define MgraArcDouble MgraArc
+   #define MgraArcInt64  MgraArc
+   #define MgraArcDoubleEx MgraArcEx
+   #define MgraArcInt64Ex  MgraArcEx
+
+
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraArcFillDouble    (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcFillDoubleEx  (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcFillInt64     (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XCenter,
+                                        MIL_INT64 YCenter,
+                                        MIL_INT64 XRad,
+                                        MIL_INT64 YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcFillInt64Ex   (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XCenter,
+                                        MIL_INT64 YCenter,
+                                        MIL_INT64 XRad,
+                                        MIL_INT64 YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraArcFill          (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcFillEx        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   #define MgraArcFillDouble MgraArcFill
+   #define MgraArcFillInt64  MgraArcFill
+   #define MgraArcFillDoubleEx MgraArcFillEx
+   #define MgraArcFillInt64Ex  MgraArcFillEx
+#endif
+
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE MgraArcAngleDouble       (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_DOUBLE XCenter,
+                                         MIL_DOUBLE YCenter,
+                                         MIL_DOUBLE XRad,
+                                         MIL_DOUBLE YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraArcAngleDoubleEx     (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_DOUBLE XCenter,
+                                         MIL_DOUBLE YCenter,
+                                         MIL_DOUBLE XRad,
+                                         MIL_DOUBLE YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag,
+                                         MIL_ID NativeCalibration,
+                                         MIL_INT64 NativeUnits,
+                                         MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE MgraArcAngleInt64        (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_INT64 XCenter,
+                                         MIL_INT64 YCenter,
+                                         MIL_INT64 XRad,
+                                         MIL_INT64 YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraArcAngleInt64Ex      (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_INT64 XCenter,
+                                         MIL_INT64 YCenter,
+                                         MIL_INT64 XRad,
+                                         MIL_INT64 YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag,
+                                         MIL_ID NativeCalibration,
+                                         MIL_INT64 NativeUnits,
+                                         MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE MgraArcAngle             (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_DOUBLE XCenter,
+                                         MIL_DOUBLE YCenter,
+                                         MIL_DOUBLE XRad,
+                                         MIL_DOUBLE YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraArcAngleEx           (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_DOUBLE XCenter,
+                                         MIL_DOUBLE YCenter,
+                                         MIL_DOUBLE XRad,
+                                         MIL_DOUBLE YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag,
+                                         MIL_ID NativeCalibration,
+                                         MIL_INT64 NativeUnits,
+                                         MIL_INT64 ConvertMode);
+   #define MgraArcAngleDouble MgraArcAngle
+   #define MgraArcAngleInt64  MgraArcAngle
+   #define MgraArcAngleDoubleEx MgraArcAngleEx
+   #define MgraArcAngleInt64Ex  MgraArcAngleEx
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE MgraRingSectorDouble     (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_DOUBLE XCenter                  ,
+                                         MIL_DOUBLE YCenter                  ,
+                                         MIL_DOUBLE XInnerRadius             ,
+                                         MIL_DOUBLE YInnerRadius             ,
+                                         MIL_DOUBLE XOuterRadius             ,
+                                         MIL_DOUBLE YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              );
+
+   MIL_DLLFUNC void MFTYPE MgraRingSectorDoubleEx   (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_DOUBLE XCenter                  ,
+                                         MIL_DOUBLE YCenter                  ,
+                                         MIL_DOUBLE XInnerRadius             ,
+                                         MIL_DOUBLE YInnerRadius             ,
+                                         MIL_DOUBLE XOuterRadius             ,
+                                         MIL_DOUBLE YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              ,
+                                         MIL_ID     NativeCalibration        ,
+                                         MIL_INT64  NativeUnits              ,
+                                         MIL_INT64  ConvertMode          );
+
+   MIL_DLLFUNC void MFTYPE MgraRingSectorInt64      (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_INT64  XCenter                  ,
+                                         MIL_INT64  YCenter                  ,
+                                         MIL_INT64  XInnerRadius             ,
+                                         MIL_INT64  YInnerRadius             ,
+                                         MIL_INT64  XOuterRadius             ,
+                                         MIL_INT64  YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              );
+
+   MIL_DLLFUNC void MFTYPE MgraRingSectorInt64Ex    (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_INT64  XCenter                  ,
+                                         MIL_INT64  YCenter                  ,
+                                         MIL_INT64  XInnerRadius             ,
+                                         MIL_INT64  YInnerRadius             ,
+                                         MIL_INT64  XOuterRadius             ,
+                                         MIL_INT64  YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              ,
+                                         MIL_ID     NativeCalibration        ,
+                                         MIL_INT64  NativeUnits              ,
+                                         MIL_INT64  ConvertMode          );
+
+#else
+   MIL_DLLFUNC void MFTYPE MgraRingSector           (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_DOUBLE XCenter                  ,
+                                         MIL_DOUBLE YCenter                  ,
+                                         MIL_DOUBLE XInnerRadius             ,
+                                         MIL_DOUBLE YInnerRadius             ,
+                                         MIL_DOUBLE XOuterRadius             ,
+                                         MIL_DOUBLE YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              );
+
+   MIL_DLLFUNC void MFTYPE MgraRingSectorEx         (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_DOUBLE XCenter                  ,
+                                         MIL_DOUBLE YCenter                  ,
+                                         MIL_DOUBLE XInnerRadius             ,
+                                         MIL_DOUBLE YInnerRadius             ,
+                                         MIL_DOUBLE XOuterRadius             ,
+                                         MIL_DOUBLE YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              ,
+                                         MIL_ID     NativeCalibration        ,
+                                         MIL_INT64  NativeUnits              ,
+                                         MIL_INT64  ConvertMode          );
+   #define MgraRingSectorDouble   MgraRingSector
+   #define MgraRingSectorInt64    MgraRingSector
+   #define MgraRingSectorDoubleEx MgraRingSectorEx
+   #define MgraRingSectorInt64Ex  MgraRingSectorEx
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraRectDouble       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectDoubleEx     (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectInt64        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectInt64Ex      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraRect             (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectEx           (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+   #define MgraRectDouble MgraRect
+   #define MgraRectInt64  MgraRect
+   #define MgraRectDoubleEx MgraRectEx
+   #define MgraRectInt64Ex  MgraRectEx
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraRectFillDouble   (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectFillDoubleEx (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectFillInt64    (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectFillInt64Ex  (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraRectFill         (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectFillEx       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+   #define MgraRectFillDouble MgraRectFill
+   #define MgraRectFillInt64  MgraRectFill
+   #define MgraRectFillDoubleEx MgraRectFillEx
+   #define MgraRectFillInt64Ex  MgraRectFillEx
+#endif
+
+
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE MgraRectAngleDouble     (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_DOUBLE Width,
+                                        MIL_DOUBLE Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraRectAngleDoubleEx   (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_DOUBLE Width,
+                                        MIL_DOUBLE Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE MgraRectAngleInt64      (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_INT64 XPos,
+                                        MIL_INT64 YPos,
+                                        MIL_INT64 Width,
+                                        MIL_INT64 Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraRectAngleInt64Ex    (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_INT64 XPos,
+                                        MIL_INT64 YPos,
+                                        MIL_INT64 Width,
+                                        MIL_INT64 Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE MgraRectAngle           (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_DOUBLE Width,
+                                        MIL_DOUBLE Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraRectAngleEx         (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_DOUBLE Width,
+                                        MIL_DOUBLE Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+   #define MgraRectAngleDouble MgraRectAngle
+   #define MgraRectAngleInt64  MgraRectAngle
+   #define MgraRectAngleDoubleEx MgraRectAngleEx
+   #define MgraRectAngleInt64Ex  MgraRectAngleEx
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraFillDouble       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart);
+
+   MIL_DLLFUNC void MFTYPE    MgraFillDoubleEx     (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraFillInt64        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart);
+
+   MIL_DLLFUNC void MFTYPE    MgraFillInt64Ex      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraFill             (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart);
+
+   MIL_DLLFUNC void MFTYPE    MgraFillEx           (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+   #define MgraFillDouble MgraFill
+   #define MgraFillInt64  MgraFill
+   #define MgraFillDoubleEx MgraFillEx
+   #define MgraFillInt64Ex  MgraFillEx
+#endif
+
+/* -------------------------------------------------------------- */
+MIL_DLLFUNC void MFTYPE    MgraClear            (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId);
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+
+   #if M_MIL_USE_UNICODE
+      MIL_DLLFUNC void MFTYPE    MgraTextADouble      (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextADoubleEx    (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextAInt64       (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextAInt64Ex     (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWDouble      (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWDoubleEx    (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWInt64       (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWInt64Ex     (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+
+      // MgraTextW and MgraTextA themselves will be defined at the end of the
+      // file in C++ function (or #define in C) mapping to on of the 4 flavors
+      // of MgraText.
+      #if M_MIL_UNICODE_API
+         #define MgraTextDouble MgraTextWDouble
+         #define MgraText MgraTextW
+         #define MgraTextEx MgraTextWEx
+      #else
+         #define MgraTextDouble MgraTextADouble
+         #define MgraText MgraTextA
+         #define MgraTextEx MgraTextAEx
+      #endif
+
+   #else // #if M_MIL_USE_UNICODE
+      MIL_DLLFUNC void MFTYPE    MgraTextDouble       (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextDoubleEx     (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextInt64        (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextInt64Ex      (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      #define MgraTextA MgraText
+      #define MgraTextAEx MgraTextEx
+
+   #endif // #if M_MIL_USE_UNICODE #else
+
+#else // #if M_MIL_USE_64BIT
+
+   #if M_MIL_USE_UNICODE
+      MIL_DLLFUNC void MFTYPE    MgraTextA            (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextAEx          (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextW            (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWEx          (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      #define MgraTextDouble MgraText
+      #if M_MIL_UNICODE_API
+         #define MgraText MgraTextW
+         #define MgraTextEx MgraTextWEx
+      #else
+         #define MgraText MgraTextA
+         #define MgraTextEx MgraTextAEx
+      #endif
+
+   #else // #if M_MIL_USE_UNICODE
+      MIL_DLLFUNC void MFTYPE    MgraText             (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextEx           (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      #define MgraTextA MgraText
+      #define MgraTextAEx MgraTextEx
+   #endif // #if M_MIL_USE_UNICODE #else
+
+#endif // #if M_MIL_USE_64BIT #else
+
+MIL_DLLFUNC void MFTYPE    MgraImage            (MIL_ID ContextGraId,
+                                     MIL_ID ImageId,
+                                     MIL_ID DestImageId,
+                                     MIL_INT64 ControlFlag);
+
+
+
+#define M_NO_ERROR_TO_REPORT      0
+#define M_ERROR_ALREADY_REPORTED  1
+typedef MIL_INT (MFTYPE* MIL_GRA_CUSTOM_FUNCTION_PTR)(MIL_ID        ContextGraId,
+                                                      MIL_ID        DestImageId,
+                                                      MIL_INT64     DrawType,
+                                                      const void*   DrawData,
+                                                      const MIL_INT SizeX,
+                                                      const MIL_INT SizeY,
+                                                      MIL_ID        NativeCalibration,
+                                                      MIL_INT64     NativeConversion,
+                                                      MIL_INT64     ConvertMode,
+                                                      MIL_INT64     ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraCustom           (MIL_ID ContextGraId,
+                                     MIL_ID DestImageOrGraphicListId,
+                                     MIL_INT64 DrawType,
+                                     MIL_GRA_CUSTOM_FUNCTION_PTR CustomDrawPtr,
+                                     const void* DrawData,
+                                     MIL_INT DrawDataSizeByte,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraCustomEx         (MIL_ID ContextGraId,
+                                     MIL_ID DestImageOrGraphicListId,
+                                     MIL_INT64 DrawType,
+                                     MIL_GRA_CUSTOM_FUNCTION_PTR CustomDrawPtr,
+                                     const void* DrawData,
+                                     MIL_INT DrawDataSizeByte,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraInteractive      (MIL_ID ContextGraId,
+                                     MIL_ID ListGraId,
+                                     MIL_INT64 GraphicType,
+                                     MIL_INT64 InitFlag,
+                                     MIL_INT64 CreationMode);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsDouble    (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumVectors,
+                                     const MIL_DOUBLE *XArrayPtr,
+                                     const MIL_DOUBLE *YArrayPtr,
+                                     const MIL_DOUBLE *UArrayPtr,
+                                     const MIL_DOUBLE *VArrayPtr,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsFloat     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumVectors,
+                                     const MIL_FLOAT *XArrayPtr,
+                                     const MIL_FLOAT *YArrayPtr,
+                                     const MIL_FLOAT *UArrayPtr,
+                                     const MIL_FLOAT *VArrayPtr,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsInt32     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumVectors,
+                                     const MIL_INT32 *XArrayPtr,
+                                     const MIL_INT32 *YArrayPtr,
+                                     const MIL_INT32 *UArrayPtr,
+                                     const MIL_INT32 *VArrayPtr,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsInt64     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumVectors,
+                                     const MIL_INT64 *XArrayPtr,
+                                     const MIL_INT64 *YArrayPtr,
+                                     const MIL_INT64 *UArrayPtr,
+                                     const MIL_INT64 *VArrayPtr,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsGrid      (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_ID UImageBufId,
+                                     MIL_ID VImageBufId,
+                                     MIL_INT Stride,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+/* -------------------------------------------------------------- */
+
+
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* SEQUENCE MODULE:                                                        */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+
+typedef MIL_HOOK_FUNCTION_PTR MIL_SEQ_HOOK_FUNCTION_PTR;
+
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT|| M_COMPILING_MILDLL
+
+MIL_DLLFUNC MIL_ID MFTYPE MseqAlloc(MIL_ID SystemId,
+                        MIL_INT64 SequenceType,
+                        MIL_INT64 Operation,
+                        MIL_UINT32 OutputFormat,
+                        MIL_INT64 InitFlag,
+                        MIL_ID* ContextSeqIdPtr);
+
+MIL_DLLFUNC void MFTYPE MseqFree(MIL_ID ContextSeqId);
+
+MIL_DLLFUNC void MFTYPE MseqDefine(MIL_ID ContextSeqId,
+                       MIL_INT SequenceIndex,
+                       MIL_INT64 SequenceType,
+                       const void *Param1Ptr,
+                       MIL_DOUBLE Param2);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE MseqControlInt64( MIL_ID ContextSeqId,
+                              MIL_INT SequenceIndex,
+                              MIL_INT64 ControlType,
+                              MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE MseqControlDouble(MIL_ID ContextSeqId,
+                              MIL_INT SequenceIndex,
+                              MIL_INT64 ControlType,
+                              MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MseqControlDouble MseqControl
+#define MseqControlInt64  MseqControl
+MIL_DLLFUNC void MFTYPE MseqControl(   MIL_ID ContextSeqId,
+                           MIL_INT SequenceIndex,
+                           MIL_INT64 ControlType,
+                           MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC MIL_INT MFTYPE MseqInquire( MIL_ID ContextSeqId,
+                              MIL_INT SequenceIndex,
+                              MIL_INT64 InquireType,
+                              void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MseqHookFunction( MIL_ID ContextSeqId,
+                              MIL_INT HookType,
+                              MIL_SEQ_HOOK_FUNCTION_PTR HookHandlerPtr,
+                              void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MseqGetHookInfo(  MIL_ID EventId,
+                              MIL_INT64 InfoType,
+                              void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MseqFeed(MIL_ID ContextSeqId,
+                     MIL_ID ImageBufId,
+                     MIL_INT64 InitFlag);
+
+MIL_DLLFUNC void MFTYPE MseqProcess(MIL_ID ContextSeqId,
+                        MIL_INT64 Command,
+                        MIL_INT64 CommandFlag);
+#endif 
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* DATA GENERATION MODULE:                                                 */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* DATA BUFFERS: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MgenLutRamp          (MIL_ID LutBufId,
+                                     MIL_INT StartIndex,
+                                     MIL_DOUBLE StartValue,
+                                     MIL_INT EndIndex,
+                                     MIL_DOUBLE EndValue);
+
+MIL_DLLFUNC void MFTYPE    MgenLutFunction      (MIL_ID LutBufId,
+                                     MIL_INT Func,
+                                     MIL_DOUBLE a,
+                                     MIL_DOUBLE b,
+                                     MIL_DOUBLE c,
+                                     MIL_INT StartIndex,
+                                     MIL_DOUBLE StartXValue,
+                                     MIL_INT EndIndex);
+
+MIL_DLLFUNC void MFTYPE    MgenWarpParameter    (MIL_ID     SrcArrayBufId,
+                                     MIL_ID     DstXLutOrArrayBufId,
+                                     MIL_ID     DstYLutBufId,
+                                     MIL_INT    OperationMode,
+                                     MIL_INT    Transform,
+                                     MIL_DOUBLE Val1,
+                                     MIL_DOUBLE Val2);
+
+MIL_DLLFUNC void MFTYPE    MgenRamp(MIL_ID      BufId,
+                                    MIL_DOUBLE  ScaleX,
+                                    MIL_DOUBLE  ScaleY,
+                                    MIL_DOUBLE  Offset,
+                                    MIL_INT64   ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* DATA BUFFERS MODULE:                                                    */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CREATION: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAlloc1d          (MIL_ID SystemId,
+                                     MIL_INT SizeX,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAlloc2d          (MIL_ID SystemId,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAllocColor       (MIL_ID SystemId,
+                                     MIL_INT SizeBand,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAllocContainer(MIL_ID SystemId,
+                                              MIL_INT64 Attribute,
+                                              MIL_INT64 ControlFlag,
+                                              MIL_ID* ContainerBufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAllocDefault(MIL_ID SystemId,
+                                            MIL_ID ReferenceDigId,
+                                            MIL_INT64 Attribute,
+                                            MIL_INT64 ControlFlag,
+                                            MIL_INT64 ControlValue,
+                                            MIL_ID* VarContainerOrBufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChild1d          (MIL_ID ParentBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT SizeX,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChild2d          (MIL_ID  ParentBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChildColor       (MIL_ID  ParentBufId,
+                                     MIL_INT Band,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChildColor2d     (MIL_ID  ParentBufId,
+                                     MIL_INT Band,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChildColor2dClip (MIL_ID  ParentBufId,
+                                     MIL_INT Band,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT* StatusPtr,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufChildContainer(MIL_ID ParentContainerBufId,
+   MIL_INT ComponentCriteriaSize,
+   const MIL_INT64* ComponentCriteriaArrayPtr,
+   MIL_INT64 ControlFlag,
+   MIL_ID* ContainerBufIdPtr);
+
+
+MIL_DLLFUNC void  MFTYPE  MbufChildMove         (MIL_ID  BufId,
+                                     MIL_INT OffsetX,
+                                     MIL_INT OffsetY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufCreateColor      (MIL_ID SystemId,
+                                     MIL_INT SizeBand,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_INT Pitch,
+                                     void* *ArrayOfDataPtr,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE   MbufCreateComponent(MIL_ID ContainerBufId,
+                                                MIL_INT SizeBand,
+                                                MIL_INT SizeX,
+                                                MIL_INT SizeY,
+                                                MIL_INT Type,
+                                                MIL_INT64 Attribute,
+                                                MIL_INT64 ControlFlag,
+                                                MIL_INT Pitch,
+                                                void **ArrayOfDataPtr,
+                                                MIL_INT64 ComponentType,
+                                                MIL_ID*  ComponentIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufClone(MIL_ID SrcContainerOrBufId,
+                                     MIL_ID SysId,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID* VarContainerOrBufIdPtr);
+
+#ifdef M_USE_MBUFBLIT
+/*void MFTYPE  MbufBlit                (MIL_ID  SrcBufId,
+                                              MIL_ID  DstBufId,
+                                              LPMBLTDESC pBltDesc);*/
+#define MbufBlit(srcID,dstID,pBltDesc)        MbufTransfer(srcID,                \
+                                                           dstID,                \
+                                                           0,                    \
+                                                           0,                    \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           0,                    \
+                                                           0,                    \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           M_MTX0_METHOD,        \
+                                                           M_DEFAULT,            \
+                                                           pBltDesc)
+#endif
+
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufCreate2dFunc      (MIL_ID SystemId,
+                                      MIL_INT SizeX,
+                                      MIL_INT SizeY,
+                                      MIL_INT Type,
+                                      MIL_INT64 Attribute,
+                                      MIL_INT64 ControlFlag,
+                                      MIL_INT Pitch,
+                                      MIL_DATA_PTR DataPtr,
+                                      MIL_ID* BufIdPtr);
+
+#define CAST_TO_64BIT_WITHOUT_SIGN_EXTENSION(X) ((MIL_ADDR)(X))
+
+#define MbufCreate2d(SystemId, SizeX, SizeY, Type, Attribute, ControlFlag, Pitch, DataPtr, IdVarPtr) \
+        MbufCreate2dFunc(SystemId, SizeX, SizeY, Type, Attribute, ControlFlag, Pitch, CAST_TO_64BIT_WITHOUT_SIGN_EXTENSION(DataPtr), IdVarPtr)
+
+MIL_DLLFUNC void MFTYPE    MbufFree             (MIL_ID BufOrContainerBufId);
+
+/* -------------------------------------------------------------- */
+/* -------------------------------------------------------------- */
+
+/* HOOK: */
+
+/* -------------------------------------------------------------- */
+
+typedef MIL_HOOK_FUNCTION_PTR MBUFHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_BUF_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void    MFTYPE    MbufHookFunction(MIL_ID ContainerOrBufId,
+                                             MIL_INT HookType,
+                                             MIL_BUF_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                             void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MbufGetHookInfo(MIL_ID EventId,
+                                             MIL_INT64 InfoType,
+                                             void* UserVarPtr);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* ACCESS: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MbufClearDouble(MIL_ID DstContainerOrBufId,
+                                     MIL_DOUBLE Color);
+
+MIL_DLLFUNC void MFTYPE    MbufCopy             (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyColor        (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_INT Band);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyColor2d      (MIL_ID  SrcBufId,
+                                     MIL_ID  DstBufId,
+                                     MIL_INT SrcBand,
+                                     MIL_INT SrcOffX,
+                                     MIL_INT SrcOffY,
+                                     MIL_INT DstBand,
+                                     MIL_INT DstOffX,
+                                     MIL_INT DstOffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyClip         (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_INT DestOffX,
+                                     MIL_INT DestOffY);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyMask         (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_INT64 MaskValue);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyCondDouble   (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_ID CondBufId,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondValue);
+
+MIL_DLLFUNC void MFTYPE    MbufClearCondDouble  (MIL_ID DstBufId,
+                                     MIL_DOUBLE RedOrMonoVal,
+                                     MIL_DOUBLE GreenVal,
+                                     MIL_DOUBLE BlueVal,
+                                     MIL_ID CondBufId,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondValue);
+
+MIL_DLLFUNC void MFTYPE    MbufGetLine          (MIL_ID ImageBufId,
+                                     MIL_INT StartX,
+                                     MIL_INT StartY,
+                                     MIL_INT EndX,
+                                     MIL_INT EndY,
+                                     MIL_INT64 Mode,
+                                     MIL_INT* NbPixelsPtr,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetListDouble    (MIL_ID SrcBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_DOUBLE *PixXArrayPtr,
+                                     const MIL_DOUBLE *PixYArrayPtr,
+                                     MIL_INT64 InterpolationMode,
+                                     void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetListInt32     (MIL_ID SrcBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_INT32 *PixXArrayPtr,
+                                     const MIL_INT32 *PixYArrayPtr,
+                                     MIL_INT64 InterpolationMode,
+                                     void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetListInt64     (MIL_ID SrcBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_INT64 *PixXArrayPtr,
+                                     const MIL_INT64 *PixYArrayPtr,
+                                     MIL_INT64 InterpolationMode,
+                                     void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE MbufLink    (MIL_ID SrcContainerOrBufId,
+                                     MIL_ID TargetContainerOrBufId,
+                                     MIL_INT64 LinkOperation,
+                                     MIL_INT ControlFlag);
+
+
+MIL_DLLFUNC void MFTYPE    MbufPut1d            (MIL_ID DestBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT SizeX,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPut2d            (MIL_ID DestBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutColor         (MIL_ID DestBufId,
+                                     MIL_INT64 DataFormat,
+                                     MIL_INT Band,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutColor2d       (MIL_ID DestBufId,
+                                     MIL_INT64 DataFormat,
+                                     MIL_INT Band,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutLine          (MIL_ID ImageBufId,
+                                     MIL_INT StartX,
+                                     MIL_INT StartY,
+                                     MIL_INT EndX,
+                                     MIL_INT EndY,
+                                     MIL_INT64 Mode,
+                                     MIL_INT* NbPixelsPtr,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutListDouble    (MIL_ID DestBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_DOUBLE *PixXArrayPtr,
+                                     const MIL_DOUBLE *PixYArrayPtr,
+                                     MIL_INT64 OverscanMode,
+                                     const void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutListInt32     (MIL_ID DestBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_INT32 *PixXArrayPtr,
+                                     const MIL_INT32 *PixYArrayPtr,
+                                     MIL_INT64 OverscanMode,
+                                     const void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutListInt64     (MIL_ID DestBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_INT64 *PixXArrayPtr,
+                                     const MIL_INT64 *PixYArrayPtr,
+                                     MIL_INT64 OverscanMode,
+                                     const void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPut              (MIL_ID DestBufId,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGet1d            (MIL_ID  SrcBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT SizeX,
+                                     void   *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGet2d            (MIL_ID  SrcBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     void   *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetColor         (MIL_ID SrcBufId,
+                                     MIL_INT64 DataFormat,
+                                     MIL_INT Band,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGet(MIL_ID SrcBufId,
+                                   void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetColor2dAsync(MIL_ID    SrcBufId,
+                                             MIL_INT64 DataFormat,
+                                             MIL_INT   Band,
+                                             MIL_INT   OffX,
+                                             MIL_INT   OffY,
+                                             MIL_INT   SizeX,
+                                             MIL_INT   SizeY,
+                                             void     *UserArrayPtr,
+                                             MIL_INT64 UserArrayInSize,
+                                             MIL_INT64 OperationFlag,
+                                             MIL_BUF_HOOK_FUNCTION_PTR CallbackFct,
+                                             void* CallbackDataPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetAsync(MIL_ID SrcBufId,
+                                       void* UserArrayPtr,
+                                       MIL_INT64 UserArrayInSize,
+                                       MIL_INT64 OperationFlag,
+                                       MIL_BUF_HOOK_FUNCTION_PTR CallbackFct,
+                                       void* CallbackDataPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetColor2d       (MIL_ID    SrcBufId,
+                                     MIL_INT64 DataFormat,
+                                     MIL_INT   Band,
+                                     MIL_INT   OffX,
+                                     MIL_INT   OffY,
+                                     MIL_INT   SizeX,
+                                     MIL_INT   SizeY,
+                                     void     *UserArrayPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufGetArc2 (MIL_ID     ImageBufId,
+                                        MIL_INT    XCenter,
+                                        MIL_INT    YCenter,
+                                        MIL_INT    XRad,
+                                        MIL_INT    YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_INT64  Mode,
+                                        MIL_INT*   NbPixelsPtr,
+                                        void*      ValueArrayPtr,
+                                        void*      PosXArrayPtr,
+                                        void*      PosYArrayPtr);
+
+
+#ifndef __cplusplus
+
+
+// The default in C is the use of the old API until MIL 11.
+#ifndef M_USE_OLD_MBUFGETARC_API_IN_C
+#define M_USE_OLD_MBUFGETARC_API_IN_C 1
+#endif
+
+#if M_USE_OLD_MBUFGETARC_API_IN_C
+#define MbufGetArc(ImageBufId, XCenter, YCenter, XRad, YRad, StartAngle, EndAngle, UserArrayPtr, NbPixelsPtr)     \
+        MbufGetArc2(ImageBufId, XCenter, YCenter, XRad, YRad, StartAngle, EndAngle, M_DEFAULT, NbPixelsPtr, UserArrayPtr, M_NULL, M_NULL);
+#else
+#define MbufGetArc   MbufGetArc2
+#endif
+
+
+
+#endif
+
+
+
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufInquire          (MIL_ID BufId,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufInquireContainer(MIL_ID ContainerBufId,
+                                                MIL_INT64 Component,
+                                                MIL_INT64 InquireType,
+                                                void* UserVarPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufAllocComponent(MIL_ID ContainerBufId,
+                                             MIL_INT SizeBand,
+                                             MIL_INT SizeX,
+                                             MIL_INT SizeY,
+                                             MIL_INT Type,
+                                             MIL_INT64 Attribute,
+                                             MIL_INT64 ComponentType,
+                                             MIL_ID* ComponentIdPtr);
+
+MIL_DLLFUNC void MFTYPE MbufCopyComponent(MIL_ID SrcContainerOrBufId,
+                                          MIL_ID DstContainerBufId,
+                                          MIL_INT64 SrcComponent,
+                                          MIL_INT64 Operation,
+                                          MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MbufFreeComponent(MIL_ID ContainerBufId,
+   MIL_INT64 Component,
+   MIL_INT64 ControlFlag);
+
+#if M_MIL_USE_UNICODE
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufAllocColorNamedA(MIL_ID SystemId,
+                                                MIL_INT SizeBand,
+                                                MIL_INT SizeX,
+                                                MIL_INT SizeY,
+                                                MIL_INT Type,
+                                                MIL_INT64 Attribute,
+                                                MIL_CONST_TEXTA_PTR BufferNamePtr,
+                                                MIL_ID *BufIdPtr);
+
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufDiskInquireA     (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+MIL_DLLFUNC void MFTYPE    MbufSaveA            (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID ContainerOrBufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufRestoreA         (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID SystemId,
+                                     MIL_ID* BufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufLoadA            (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID BufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufImportA          (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SysId,
+                                     MIL_ID* ContainerOrBufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufExportA          (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_ID SrcContainerOrBufId);
+MIL_DLLFUNC void MFTYPE    MbufExportSequenceA  (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     const MIL_ID *BufArrayPtrOrSystemIdPtr,
+                                     MIL_INT NumOfIds,
+                                     MIL_DOUBLE FrameRate,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MbufImportSequenceA  (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SystemId,
+                                     MIL_ID *BufArrayPtr,
+                                     MIL_INT StartImage,
+                                     MIL_INT NumberOfImages,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufAllocColorNamedW(MIL_ID SystemId,
+                                                MIL_INT SizeBand,
+                                                MIL_INT SizeX,
+                                                MIL_INT SizeY,
+                                                MIL_INT Type,
+                                                MIL_INT64 Attribute,
+                                                MIL_CONST_TEXTW_PTR BufferNamePtr,
+                                                MIL_ID *BufIdPtr);
+
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufDiskInquireW     (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufSaveW            (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID ContainerOrBufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufRestoreW         (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID SystemId,
+                                     MIL_ID* BufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufLoadW            (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID BufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufImportW          (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SysId,
+                                     MIL_ID* ContainerOrBufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufExportW          (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_ID SrcContainerOrBufId);
+MIL_DLLFUNC void MFTYPE    MbufExportSequenceW  (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     const MIL_ID *BufArrayPtrOrSystemIdPtr,
+                                     MIL_INT NumOfIds,
+                                     MIL_DOUBLE FrameRate,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MbufImportSequenceW  (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SystemId,
+                                     MIL_ID *BufArrayPtr,
+                                     MIL_INT StartImage,
+                                     MIL_INT NumberOfImages,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MbufControlFeatureW    (MIL_ID BufId,
+                                                MIL_INT64 ControlType,
+                                                MIL_CONST_TEXTW_PTR FeatureName,
+                                                MIL_INT64 UserVarType,
+                                                const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufInquireFeatureW    (MIL_ID BufId,
+                                                MIL_INT64 InquireType,
+                                                MIL_CONST_TEXTW_PTR FeatureName,
+                                                MIL_INT64 UserVarType,
+                                                void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufControlFeatureA    (MIL_ID BufId,
+                                                MIL_INT64 ControlType,
+                                                MIL_CONST_TEXTA_PTR FeatureName,
+                                                MIL_INT64 UserVarType,
+                                                const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufInquireFeatureA(MIL_ID BufId,
+                                            MIL_INT64 InquireType,
+                                            MIL_CONST_TEXTA_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufStreamW(MIL_TEXTW_PTR MemPtrOrFileName,
+                                    MIL_ID       SystemId,
+                                    MIL_INT64       Operation,
+                                    MIL_INT64       StreamType,
+                                    MIL_DOUBLE   Version,
+                                    MIL_INT64       ControlFlag,
+                                    MIL_ID *     ContainerOrBufIdPtr,
+                                    MIL_INT *    SizeByteVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufStreamA(MIL_TEXTA_PTR MemPtrOrFileName,
+                                    MIL_ID       SystemId,
+                                    MIL_INT64       Operation,
+                                    MIL_INT64       StreamType,
+                                    MIL_DOUBLE   Version,
+                                    MIL_INT64       ControlFlag,
+                                    MIL_ID *     ContainerOrBufIdPtr,
+                                    MIL_INT *    SizeByteVarPtr);
+
+
+#if M_MIL_UNICODE_API
+#define MbufAllocColorNamed   MbufAllocColorNamedW
+#define MbufExportSequence    MbufExportSequenceW
+#define MbufImportSequence    MbufImportSequenceW
+#define MbufDiskInquire       MbufDiskInquireW
+#define MbufSave              MbufSaveW
+#define MbufStream            MbufStreamW
+#define MbufRestore           MbufRestoreW
+#define MbufLoad              MbufLoadW
+#define MbufImport            MbufImportW
+#define MbufExport            MbufExportW
+#define MbufControlFeature    MbufControlFeatureW
+#define MbufInquireFeature    MbufInquireFeatureW
+#else
+#define MbufAllocColorNamed   MbufAllocColorNamedA
+#define MbufExportSequence    MbufExportSequenceA
+#define MbufImportSequence    MbufImportSequenceA
+#define MbufDiskInquire       MbufDiskInquireA
+#define MbufSave              MbufSaveA
+#define MbufStream            MbufStreamA
+#define MbufRestore           MbufRestoreA
+#define MbufLoad              MbufLoadA
+#define MbufImport            MbufImportA
+#define MbufExport            MbufExportA
+#define MbufControlFeature    MbufControlFeatureA
+#define MbufInquireFeature    MbufInquireFeatureA
+#endif
+#else
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufAllocColorNamed(MIL_ID SystemId,
+                                                MIL_INT SizeBand,
+                                                MIL_INT SizeX,
+                                                MIL_INT SizeY,
+                                                MIL_INT Type,
+                                                MIL_INT64 Attribute,
+                                                MIL_CONST_TEXT_PTR BufferNamePtr,
+                                                MIL_ID *BufIdPtr);
+
+
+MIL_DLLFUNC MIL_INT     MFTYPE    MbufDiskInquire(MIL_CONST_TEXT_PTR FileName,
+                                      MIL_INT64 InquireType,
+                                      void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufSave             (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID ContainerOrBufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufRestore          (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID SystemId,
+                                     MIL_ID* BufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufLoad             (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID BufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufImport           (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SystemId,
+                                     MIL_ID* BufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufExport           (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_ID SrcContainerOrBufId);
+MIL_DLLFUNC void MFTYPE    MbufExportSequence   (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     const MIL_ID *BufArrayPtrOrSystemIdPtr,
+                                     MIL_INT NumOfIds,
+                                     MIL_DOUBLE FrameRate,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MbufImportSequence   (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SystemId,
+                                     MIL_ID *BufArrayPtr,
+                                     MIL_INT StartImage,
+                                     MIL_INT NumberOfImages,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE MbufControlFeature(MIL_ID BufId,
+                                           MIL_INT64 ControlType,
+                                           MIL_CONST_TEXT_PTR FeatureName,
+                                           MIL_INT64 UserVarType,
+                                           const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufInquireFeature(MIL_ID BufId,
+                                           MIL_INT64 InquireType,
+                                           MIL_CONST_TEXT_PTR FeatureName,
+                                           MIL_INT64 UserVarType,
+                                           void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufStream(MIL_TEXT_PTR MemPtrOrFileName,
+                                    MIL_ID       SystemId,
+                                    MIL_INT64       Operation,
+                                    MIL_INT64       StreamType,
+                                    MIL_DOUBLE   Version,
+                                    MIL_INT64       ControlFlag,
+                                    MIL_ID *     ContainerOrBufIdPtr,
+                                    MIL_INT *    SizeByteVarPtr);
+#endif
+
+MIL_DLLFUNC void MFTYPE    MbufControlAreaDouble(MIL_ID  BufId,
+                                     MIL_INT OffsetX,
+                                     MIL_INT OffsetY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Band,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue);
+#define MbufModified2d(BufId, OffsetX, OffsetY, SizeX, SizeY) \
+        MbufControlAreaDouble(BufId, OffsetX, OffsetY, SizeX, SizeY, M_ALL_BAND, M_MODIFIED, M_DEFAULT)
+
+
+MIL_DLLFUNC void MFTYPE    MbufCompression      (MIL_ID SrcImageId,
+                                     MIL_ID DestImageId,
+                                     MIL_INT ControlValue,
+                                     MIL_INT64 OperationFlag);
+
+MIL_DLLFUNC void MFTYPE    MbufBayer            (MIL_ID SrcImageBufId,
+                                     MIL_ID DestImageBufId,
+                                     MIL_ID CoefOrExpId,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MbufTransfer         (MIL_ID     SrcBufId,
+                                     MIL_ID     DestBufId,
+                                     MIL_INT    SrcOffX,
+                                     MIL_INT    SrcOffY,
+                                     MIL_INT    SrcSizeX,
+                                     MIL_INT    SrcSizeY,
+                                     MIL_INT    SrcBand,
+                                     MIL_INT    DestOffX,
+                                     MIL_INT    DestOffY,
+                                     MIL_INT    DestSizeX,
+                                     MIL_INT    DestSizeY,
+                                     MIL_INT    DestBand,
+                                     MIL_INT64  TransferFunction,
+                                     MIL_INT64  TransferType,
+                                     MIL_INT64  OperationFlag,
+                                     void      *ExtraParameterPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufTransferDouble   (MIL_ID     SrcBufId,
+                                     MIL_ID     DestBufId,
+                                     MIL_DOUBLE SrcOffX,
+                                     MIL_DOUBLE SrcOffY,
+                                     MIL_DOUBLE SrcSizeX,
+                                     MIL_DOUBLE SrcSizeY,
+                                     MIL_INT    SrcBand,
+                                     MIL_INT    DestOffX,
+                                     MIL_INT    DestOffY,
+                                     MIL_INT    DestSizeX,
+                                     MIL_INT    DestSizeY,
+                                     MIL_INT    DestBand,
+                                     MIL_INT64  TransferFunction,
+                                     MIL_INT64  TransferType,
+                                     MIL_INT64  OperationFlag,
+                                     void      *ExtraParameterPtr);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CONTROL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MbufControlNeighborhoodMIL_INT(MIL_ID BufId,
+                                                       MIL_INT64 OperationControlType,
+                                                       MIL_INT OperationValue);
+
+#define MbufControlNeighborhood MbufControlNeighborhoodMIL_INT
+
+MIL_DEPRECATED(MbufControlNeighborhood, 1060) // Use MbufControl instead.
+
+#if M_MIL_USE_64BIT || (MIL_COMPILE_VERSION >= 1040)
+
+MIL_DLLFUNC void MFTYPE    MbufControlInt64(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MbufControlDouble(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+
+
+#if !M_MIL_USE_64BIT
+
+MIL_DLLFUNC void MFTYPE    MbufControl(MIL_ID BufId,
+                                        MIL_INT64 ControlType,
+                                        MIL_DOUBLE ControlValue);
+#endif
+
+#else
+// for 32 bit BW compilation
+#define MbufControlDouble MbufControl
+#define MbufControlInt64  MbufControl
+MIL_DLLFUNC void MFTYPE    MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+
+#endif
+MIL_DLLFUNC void MFTYPE MbufControlContainerInt64(MIL_ID ContainerBufId,
+                                                  MIL_INT64 Component,
+                                                  MIL_INT64 ControlType,
+                                                  MIL_INT64 ControlValue);
+MIL_DLLFUNC void MFTYPE MbufControlContainerDouble(MIL_ID ContainerBufId,
+                                                   MIL_INT64 Component,
+                                                   MIL_INT64 ControlType,
+                                                   MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MbufSetRegionDouble     (MIL_ID ImageBufId,
+                                        MIL_ID ImageOrGraphicListId,
+                                        MIL_INT64 Label,
+                                        MIL_INT64 Operation,
+                                        MIL_DOUBLE Param);
+
+MIL_DLLFUNC void  MFTYPE MbufSetDynamicParameters(MIL_ID BufferId,
+                                                  MIL_INT NbBand,
+                                                  MIL_INT SizeX,
+                                                  MIL_INT SizeY,
+                                                  MIL_INT64 Type,
+                                                  MIL_INT64 Attribute,
+                                                  MIL_INT64 ControlFlag,
+                                                  MIL_INT64 ControlValue,
+                                                  MIL_INT Pitch,
+                                                  MIL_INT NbBandOffset,
+                                                  MIL_INT *BandOffset);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* I/O DEVICES:                                                            */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CREATION: */
+
+      /* -------------------------------------------------------------- */
+
+typedef MIL_HOOK_FUNCTION_PTR MDIGHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_DIG_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void MFTYPE    MdigHookFunction     (MIL_ID DigId,
+                                     MIL_INT HookType,
+                                     MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                     void* UserDataPtr);
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC MIL_ID MFTYPE  MdigAllocA           (MIL_ID SystemId,
+                                     MIL_INT DigNum,
+                                     MIL_CONST_TEXTA_PTR DataFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID* DigIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MdigAllocW           (MIL_ID SystemId,
+                                     MIL_INT DigNum,
+                                     MIL_CONST_TEXTW_PTR DataFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID* DigIdPtr);
+#if M_MIL_UNICODE_API
+#define MdigAlloc MdigAllocW
+#else
+#define MdigAlloc MdigAllocA
+#endif
+#else
+MIL_DLLFUNC MIL_ID MFTYPE  MdigAlloc            (MIL_ID SystemId,
+                                     MIL_INT DigNum,
+                                     MIL_CONST_TEXT_PTR DataFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID* DigIdPtr);
+#endif
+
+MIL_DLLFUNC void MFTYPE    MdigFree             (MIL_ID DigId);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CONTROL: */
+
+      /* -------------------------------------------------------------- */
+
+#if !M_HIDE_DEPRECATED_FROM_INTELLISENSE
+MIL_DLLFUNC void MFTYPE    MdigChannel         (MIL_ID DigId,
+                                    MIL_INT64 Channel);
+MIL_DEPRECATED(MdigChannel, 1000)
+
+MIL_DLLFUNC void MFTYPE    MdigReference       (MIL_ID  DigId,
+                                    MIL_INT64 ReferenceType,
+                                    MIL_DOUBLE ReferenceLevel);
+MIL_DEPRECATED(MdigReference, 1000)
+
+MIL_DLLFUNC void MFTYPE    MdigLut             (MIL_ID DigId,
+                                    MIL_ID LutBufId);
+MIL_DEPRECATED(MdigLut, 1000)
+#endif
+
+MIL_DLLFUNC void MFTYPE    MdigHalt            (MIL_ID DigId);
+
+MIL_DLLFUNC MIL_INT MFTYPE MdigInquire         (MIL_ID DigId,
+                                    MIL_INT64 InquireType,
+                                    void* UserVarPtr);
+
+#if M_MIL_USE_64BIT || (MIL_COMPILE_VERSION >= 1040)
+MIL_DLLFUNC void MFTYPE    MdigControlInt64(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MdigControlDouble(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+
+#if !M_MIL_USE_64BIT
+// Prototypes for 32 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MdigControl         (MIL_ID DigId,
+                                    MIL_INT64 ControlType,
+                                    MIL_DOUBLE ControlValue);
+#endif
+
+#else
+// for 32 bit BW compilation
+
+#define MdigControlDouble MdigControl
+#define MdigControlInt64  MdigControl
+MIL_DLLFUNC void MFTYPE    MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC void MFTYPE    MdigGrabWait        (MIL_ID DigId,
+                                    MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+       /* ACCESS: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MdigGrab            (MIL_ID DigId,
+                                    MIL_ID DstContainerOrImageBufId);
+
+MIL_DLLFUNC void MFTYPE    MdigGrabContinuous  (MIL_ID DigId,
+                                    MIL_ID DestContainerOrImageBufId);
+
+MIL_DLLFUNC void MFTYPE    MdigProcess (MIL_ID DigId,
+                                    const MIL_ID* DestContainerOrImageBufArrayPtr,
+                                    MIL_INT ImageCount,
+                                    MIL_INT64 Operation,
+                                    MIL_INT64 OperationFlag,
+                                    MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                    void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MdigGetHookInfo  (MIL_ID EventId,
+                                    MIL_INT64 InfoType,
+                                    void* UserVarPtr);
+
+typedef MIL_INT (MFTYPE *MIL_FOCUS_HOOK_FUNCTION_PTR)(MIL_INT HookType,
+                                                      MIL_INT position,
+                                                      void* UserDataPtr);
+typedef MIL_FOCUS_HOOK_FUNCTION_PTR MFOCUSHOOKFCTPTR;
+
+MIL_DLLFUNC void MFTYPE    MdigFocus           (MIL_ID DigId,
+                                    MIL_ID DestImageBufId,
+                                    MIL_ID FocusImageRegionBufId,
+                                    MIL_FOCUS_HOOK_FUNCTION_PTR FocusHookPtr,
+                                    void* UserDataPtr,
+                                    MIL_INT MinPosition,
+                                    MIL_INT StartPosition,
+                                    MIL_INT MaxPosition,
+                                    MIL_INT MaxPositionVariation,
+                                    MIL_INT64 Operation,
+                                    MIL_INT *ResultPtr);
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC void MFTYPE MdigControlFeatureW    (MIL_ID DigId,
+                                    MIL_INT64 ControlType,
+                                    MIL_CONST_TEXTW_PTR FeatureName,
+                                    MIL_INT64 UserVarType,
+                                    const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MdigInquireFeatureW    (MIL_ID DigId,
+                                    MIL_INT64 InquireType,
+                                    MIL_CONST_TEXTW_PTR FeatureName,
+                                    MIL_INT64 UserVarType,
+                                    void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MdigControlFeatureA    (MIL_ID DigId,
+                                    MIL_INT64 ControlType,
+                                    MIL_CONST_TEXTA_PTR FeatureName,
+                                    MIL_INT64 UserVarType,
+                                    const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MdigInquireFeatureA    (MIL_ID DigId,
+                                    MIL_INT64 InquireType,
+                                    MIL_CONST_TEXTA_PTR FeatureName,
+                                    MIL_INT64 UserVarType,
+                                    void* UserVarPtr);
+
+#if M_MIL_UNICODE_API
+#define MdigControlFeature MdigControlFeatureW
+#define MdigInquireFeature MdigInquireFeatureW
+#else
+#define MdigControlFeature MdigControlFeatureA
+#define MdigInquireFeature MdigInquireFeatureA
+#endif
+#else
+
+MIL_DLLFUNC void MFTYPE MdigControlFeature    (MIL_ID DigId,
+                                   MIL_INT64 ControlType,
+                                   MIL_CONST_TEXT_PTR FeatureName,
+                                   MIL_INT64 UserVarType,
+                                   const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MdigInquireFeature    (MIL_ID DigId,
+                                   MIL_INT64 InquireType,
+                                   MIL_CONST_TEXT_PTR FeatureName,
+                                   MIL_INT64 UserVarType,
+                                   void* UserVarPtr);
+#endif
+
+
+
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* SYSTEM MODULE:                                                          */
+/***************************************************************************/
+
+typedef MIL_HOOK_FUNCTION_PTR MSYSHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_SYS_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void MFTYPE MsysHookFunction        (MIL_ID                    SysId,
+                                     MIL_INT                   HookType,
+                                     MIL_SYS_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                     void*                     UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE  MsysGetHookInfo     (MIL_ID     SysId,
+                                     MIL_ID     EventId,
+                                     MIL_INT64  InquireType,
+                                     void*      UserVarPtr);
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC MIL_ID MFTYPE MsysAllocW            (MIL_ID             ContextAppId,
+                                     MIL_CONST_TEXTW_PTR SystemDescriptor,
+                                     MIL_INT            SystemNum,
+                                     MIL_INT64          InitFlag,
+                                     MIL_ID*            SysIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE MsysAllocA            (MIL_ID             ContextAppId,
+                                     MIL_CONST_TEXTA_PTR        SystemDescriptor,
+                                     MIL_INT            SystemNum,
+                                     MIL_INT64          InitFlag,
+                                     MIL_ID*            SysIdPtr);
+
+
+MIL_DLLFUNC void MFTYPE MsysControlFeatureW(MIL_ID SysId,
+                                            MIL_INT64 ControlType,
+                                            MIL_CONST_TEXTW_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MsysInquireFeatureW(MIL_ID SysId,
+                                            MIL_INT64 InquireType,
+                                            MIL_CONST_TEXTW_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MsysControlFeatureA(MIL_ID SysId,
+                                            MIL_INT64 ControlType,
+                                            MIL_CONST_TEXTA_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MsysInquireFeatureA(MIL_ID SysId,
+                                            MIL_INT64 InquireType,
+                                            MIL_CONST_TEXTA_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            void* UserVarPtr);
+
+#if M_MIL_UNICODE_API
+#define MsysAlloc MsysAllocW
+#define MsysControlFeature MsysControlFeatureW
+#define MsysInquireFeature MsysInquireFeatureW
+#else
+#define MsysAlloc MsysAllocA
+#define MsysControlFeature MsysControlFeatureA
+#define MsysInquireFeature MsysInquireFeatureA
+#endif
+
+#else
+MIL_DLLFUNC MIL_ID MFTYPE MsysAlloc             (MIL_ID             ContextAppId,
+                                     MIL_CONST_TEXT_PTR SystemDescriptor,
+                                     MIL_INT            SystemNum,
+                                     MIL_INT64          InitFlag,
+                                     MIL_ID*            SysIdPtr);
+
+
+MIL_DLLFUNC void MFTYPE MsysControlFeature(MIL_ID SysId,
+                                           MIL_INT64 ControlType,
+                                           MIL_CONST_TEXT_PTR FeatureName,
+                                           MIL_INT64 UserVarType,
+                                           const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MsysInquireFeature(MIL_ID SysId,
+                                           MIL_INT64 InquireType,
+                                           MIL_CONST_TEXT_PTR FeatureName,
+                                           MIL_INT64 UserVarType,
+                                           void* UserVarPtr);
+#endif
+
+
+
+MIL_DLLFUNC void MFTYPE  MsysFree               (MIL_ID     SysId);
+
+MIL_DLLFUNC MIL_INT MFTYPE  MsysInquire         (MIL_ID     SysId,
+                                     MIL_INT64  InquireType,
+                                     void*      UserVarPtr);
+
+MIL_DLLFUNC void      MFTYPE  MsysControlDouble(MIL_ID     SysId,
+                                                MIL_INT64  ControlType,
+                                                MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC void      MFTYPE  MsysControlInt64(MIL_ID     SysId,
+                                               MIL_INT64  ControlType,
+                                               MIL_INT64  ControlValue);
+
+MIL_DLLFUNC void MFTYPE MsysConfigAccess        (MIL_ID     SystemId,
+                                     MIL_INT    VendorId,
+                                     MIL_INT    DeviceId,
+                                     MIL_INT    DeviceNum,
+                                     MIL_INT64  OperationFlag,
+                                     MIL_INT64  OperationType,
+                                     MIL_INT    Offset,
+                                     MIL_INT    Size,
+                                     void*      UserArrayPtr);
+
+MIL_DLLFUNC MIL_ID    MFTYPE  MsysIoAlloc(MIL_ID SysId,
+                                          MIL_INT64 IoCmdListNum,
+                                          MIL_INT64 Type,
+                                          MIL_INT64 CounterSrc,
+                                          MIL_ID* IoCmdListSysIdPtr);
+
+MIL_DLLFUNC void      MFTYPE  MsysIoFree(MIL_ID IoCmdListSysId);
+
+MIL_DLLFUNC MIL_INT   MFTYPE  MsysIoInquire(MIL_ID IoCmdListSysId,
+                                            MIL_INT64 InquireType,
+                                            void* UserVarPtr);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void      MFTYPE  MsysIoControlInt64(MIL_ID IoCmdListSysId,
+                                                 MIL_INT64 ControlType,
+                                                 MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void      MFTYPE  MsysIoControlDouble(MIL_ID IoCmdListSysId,
+                                                  MIL_INT64 ControlType,
+                                                  MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MsysIoControlDouble MsysIoControl
+#define MsysIoControlInt64  MsysIoControl
+MIL_DLLFUNC void      MFTYPE  MsysIoControl(MIL_ID IoCmdListSysId,
+                                            MIL_INT64 ControlType,
+                                            MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC MIL_INT   MFTYPE  MsysIoCommandRegister(MIL_ID IoCmdListSysId,
+                                                    MIL_INT64 Operation,
+                                                    MIL_INT64 Reference,
+                                                    MIL_DOUBLE DelayFromReference,
+                                                    MIL_DOUBLE Duration,
+                                                    MIL_INT64 BitToOperate,
+                                                    void* CommandStatusPtr);
+
+/***************************************************************************/
+/* APPLICATION MODULE:                                                     */
+/***************************************************************************/
+
+typedef MIL_HOOK_FUNCTION_PTR MAPPHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_APP_HOOK_FUNCTION_PTR;
+
+#if M_MIL_USE_UNICODE
+   MIL_DLLFUNC MIL_ID MFTYPE     MappAllocA(MIL_CONST_TEXTA_PTR ServerDescription, MIL_INT64 InitFlag, MIL_ID* ContextAppIdPtr);
+
+   MIL_DLLFUNC MIL_ID MFTYPE     MappAllocW              (MIL_CONST_TEXTW_PTR ServerDescription,
+                                              MIL_INT64 InitFlag,
+                                              MIL_ID* ContextAppIdPtr);
+   #if !defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL
+      #if M_MIL_UNICODE_API
+      #define MappAlloc MappAllocW
+      #else
+      #define MappAlloc MappAllocA
+      #endif
+   #endif
+#else
+MIL_DLLFUNC MIL_ID MFTYPE     MappAlloc               (MIL_CONST_TEXT_PTR ServerDescription,
+                                           MIL_INT64 InitFlag,
+                                           MIL_ID* ContextAppIdPtr);
+#endif
+
+
+MIL_DLLFUNC void MFTYPE       MappFree                (MIL_ID ContextAppId);
+
+
+MIL_DLLFUNC void MFTYPE       MappControl             (MIL_ID ContextAppId,
+                                           MIL_INT64 ControlType,
+                                           MIL_INT ControlValue);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappGetError            (MIL_ID ContextAppId,
+                                           MIL_INT64 ErrorType,
+                                           void* ErrorPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappGetHookInfo         (MIL_ID ContextAppId,
+                                           MIL_ID EventId,
+                                           MIL_INT64 InfoType,
+                                           void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE       MappHookFunction        (MIL_ID ContextAppId,
+                                           MIL_INT HookType,
+                                           MIL_APP_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                           void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappInquire             (MIL_ID ContextAppId,
+                                           MIL_INT64 InquireType,
+                                           void* UserVarPtr);
+
+MIL_DLLFUNC MIL_DOUBLE MFTYPE MappTimer               (MIL_ID ContextAppId,
+                                           MIL_INT64 ControlType,
+                                           MIL_DOUBLE *TimePtr);
+
+MIL_DLLFUNC void MFTYPE       MappTimerVoid           (MIL_ID ContextAppId,
+                                           MIL_INT64 Mode,
+                                           MIL_DOUBLE *Time);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappInquireMp           (MIL_ID ContextAppId,
+                                           MIL_INT64 InquireType,
+                                           MIL_INT64 TypeFlag,
+                                           MIL_INT64 TypeValue,
+                                           void* UserVarPtr);
+
+MIL_DLLFUNC void    MFTYPE    MappControlMp           (MIL_ID ContextAppId,
+                                           MIL_INT64 ControlType,
+                                           MIL_INT64 TypeFlag,
+                                           MIL_INT64 TypeValue,
+                                           void* ValuePtr);
+
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC void MFTYPE       MappOpenConnectionA     (MIL_CONST_TEXTA_PTR ConnectionDescriptor,
+                                           MIL_INT64 InitFlag,
+                                           MIL_INT64 ControlFlag,
+                                           MIL_ID* RemoteContextAppIdPtr);
+
+MIL_DLLFUNC void MFTYPE       MappOpenConnectionW     (MIL_CONST_TEXTW_PTR ConnectionDescriptor,
+                                           MIL_INT64 InitFlag,
+                                           MIL_INT64 ControlFlag,
+                                           MIL_ID* RemoteContextAppIdPtr);
+
+MIL_DLLFUNC void   MFTYPE     MappFileOperationW      (MIL_ID Comp1ContextAppId, 
+                                           MIL_CONST_TEXTW_PTR Comp1FileName, 
+                                           MIL_ID Comp2ContextAppId, 
+                                           MIL_CONST_TEXTW_PTR Comp2FileName, 
+                                           MIL_INT64 Operation, 
+                                           MIL_INT64 OperationFlag, 
+                                           void *OperationDataPtr);
+
+MIL_DLLFUNC void   MFTYPE     MappFileOperationA      (MIL_ID Comp1ContextAppId, 
+                                           MIL_CONST_TEXTA_PTR Comp1FileName, 
+                                           MIL_ID Comp2ContextAppId, 
+                                           MIL_CONST_TEXTA_PTR Comp2FileName, 
+                                           MIL_INT64 Operation, 
+                                           MIL_INT64 OperationFlag, 
+                                           void *OperationDataPtr);
+
+MIL_DLLFUNC void   MFTYPE     MappTraceA              (MIL_ID ContextAppId,
+                                           MIL_INT64 TraceType,
+                                           MIL_INT64 TraceTag,
+                                           MIL_INT64 TraceValue,
+                                           MIL_CONST_TEXTA_PTR TraceString);
+
+MIL_DLLFUNC void   MFTYPE     MappTraceW              (MIL_ID ContextAppId,
+                                           MIL_INT64 TraceType,
+                                           MIL_INT64 TraceTag,
+                                           MIL_INT64 TraceValue,
+                                           MIL_CONST_TEXTW_PTR TraceString);
+
+#if M_MIL_UNICODE_API
+   #define MappOpenConnection MappOpenConnectionW
+   #define MappTrace MappTraceW
+   #if M_MIL_USE_SAFE_TYPE
+      #define MappFileOperation MappFileOperationSafeTypeW
+   #else
+      #define MappFileOperation MappFileOperationW
+   #endif
+#else
+   #define MappOpenConnection MappOpenConnectionA
+   #define MappTrace MappTraceA
+   #if M_MIL_USE_SAFE_TYPE
+      #define MappFileOperation MappFileOperationSafeTypeA
+   #else
+      #define MappFileOperation MappFileOperationA
+   #endif
+#endif
+#else
+MIL_DLLFUNC void MFTYPE       MappOpenConnection      (MIL_CONST_TEXT_PTR ConnectionDescriptor,
+                                           MIL_INT64 InitFlag,
+                                           MIL_INT64 ControlFlag,
+                                           MIL_ID* RemoteContextAppIdPtr);
+
+
+MIL_DLLFUNC void   MFTYPE     MappFileOperation       (MIL_ID Comp1ContextAppId, 
+                                           MIL_CONST_TEXT_PTR Comp1FileName, 
+                                           MIL_ID Comp2ContextAppId, 
+                                           MIL_CONST_TEXT_PTR Comp2FileName, 
+                                           MIL_INT64 Operation, 
+                                           MIL_INT64 OperationFlag, 
+                                           void *OperationDataPtr);
+
+MIL_DLLFUNC void   MFTYPE     MappTrace               (MIL_ID ContextAppId,
+                                           MIL_INT64 TraceType,
+                                           MIL_INT64 TraceTag,
+                                           MIL_INT64 TraceValue,
+                                           MIL_CONST_TEXT_PTR TraceString);
+#endif
+
+MIL_DLLFUNC void MFTYPE       MappCloseConnection     (MIL_ID RemoteContextAppId);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappInquireConnection   (MIL_ID ContextAppId,
+                                           MIL_INT64 InquireType,
+                                           MIL_INT64 ControlFlag,
+                                           MIL_INT64 ExtraFlag,
+                                           void* UserVarPtr);
+
+#if !M_HIDE_DEPRECATED_FROM_INTELLISENSE
+MIL_DLLFUNC MIL_INT MFTYPE    MappInquireObject       (MIL_ID ContextAppId,
+                                           MIL_ID ObjectId,
+                                           MIL_INT64 InquireType,
+                                           void* UserVarPtr);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+MIL_DLLFUNC void MFTYPE       MappControlObjectDouble (MIL_ID ContextAppId,
+                                           MIL_ID ObjectId,
+                                           MIL_INT64 ControlType,
+                                           MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC void MFTYPE       MappControlObjectInt64  (MIL_ID ContextAppId,
+                                           MIL_ID ObjectId,
+                                           MIL_INT64 ControlType,
+                                           MIL_INT64 ControlValue);
+#else
+// Prototypes for 32 bits OSs
+#define MappControlObjectDouble MappControlObject
+#define MappControlObjectInt64  MappControlObject
+
+MIL_DLLFUNC void MFTYPE       MappControlObject       (MIL_ID ContextAppId,
+                                           MIL_ID ObjectId,
+                                           MIL_INT64 ControlType,
+                                           MIL_DOUBLE ControlValue);
+#endif
+#endif
+
+/***************************************************************************/
+/* OBJ MODULE:                                                              */
+/***************************************************************************/
+MIL_DLLFUNC MIL_ID MFTYPE MobjAlloc(MIL_ID SysId, MIL_INT64 ObjectType, MIL_INT64 InitFlag, MIL_ID *ObjIdPtr);
+MIL_DLLFUNC void MFTYPE MobjFree(MIL_ID ObjId);
+MIL_DLLFUNC MIL_INT MFTYPE MobjInquire(MIL_ID ObjectId, MIL_INT64 InquireType, void* UserVarPtr);
+MIL_DLLFUNC MIL_INT64 MFTYPE MobjMessageRead(MIL_ID MessageId, void* MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 *MessageOutSizePtr, MIL_INT64 *MessageTagPtr, MIL_INT64 *StatusPtr, MIL_INT64  OperationFlag);
+MIL_DLLFUNC void MFTYPE MobjMessageWrite(MIL_ID MessageId, const void* MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64  OperationFlag);
+MIL_DLLFUNC MIL_INT MFTYPE MobjGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+typedef MIL_HOOK_FUNCTION_PTR MIL_OBJ_HOOK_FUNCTION_PTR;
+MIL_DLLFUNC void MFTYPE MobjMessageReadAsync(MIL_ID MessageId, void* MessagePtr, MIL_INT64 MessageInSize, MIL_INT64  OperationFlag, MIL_OBJ_HOOK_FUNCTION_PTR  HookFunc, void* UserData);
+MIL_DLLFUNC void MFTYPE MobjHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_OBJ_HOOK_FUNCTION_PTR HookHandlerPtr, void * UserDataPtr);
+
+#if MIL_COMPILE_VERSION == 1000
+MIL_DLLFUNC void MFTYPE MobjControl(MIL_ID ObjectId, MIL_INT64 ControlType, void* ControlPtr);
+#else
+
+#if M_MIL_USE_64BIT || (MIL_COMPILE_VERSION >= 1040)
+MIL_DLLFUNC void MFTYPE    MobjControlInt64(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MobjControlDouble(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+
+
+#if !M_MIL_USE_64BIT
+// Prototypes for 32 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+#endif
+#else
+// for 32 bit BW compilation
+
+#define MobjControlDouble MobjControl
+#define MobjControlInt64  MobjControl
+MIL_DLLFUNC void MFTYPE    MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+#endif
+
+#endif
+/***************************************************************************/
+/* THREAD FUNCTIONS:                                                       */
+/***************************************************************************/
+typedef MIL_UINT32 (MFTYPE *MIL_THREAD_FUNCTION_PTR)(void* UserDataPtr);
+typedef MIL_THREAD_FUNCTION_PTR MTHREADFCTPTR;
+
+MIL_DLLFUNC MIL_ID MFTYPE  MthrAlloc         (MIL_ID SystemId,
+                                  MIL_INT64 ObjectType,
+                                  MIL_INT64 ControlFlag,
+                                  MIL_THREAD_FUNCTION_PTR ThreadFctPtr,
+                                  void *UserDataPtr,
+                                  MIL_ID *ThreadEventOrMutexIdPtr);
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MthrControlInt64  (MIL_ID ThreadEventOrMutexId,
+                                  MIL_INT64 ControlType,
+                                  MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MthrControlDouble (MIL_ID ThreadEventOrMutexId,
+                                  MIL_INT64 ControlType,
+                                  MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MthrControlDouble MthrControl
+#define MthrControlInt64  MthrControl
+MIL_DLLFUNC void MFTYPE    MthrControl       (MIL_ID ThreadEventOrMutexId,
+                                  MIL_INT64 ControlType,
+                                  MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC void MFTYPE    MthrFree          (MIL_ID ThreadEventorMutexId);
+
+MIL_DLLFUNC MIL_INT MFTYPE MthrInquire       (MIL_ID ThreadEventOrMutexId,
+                                  MIL_INT64 InquireType,
+                                  void *UserVarPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MthrWait          (MIL_ID ThreadOrEventId,
+                                  MIL_INT64 WaitOption,
+                                  MIL_INT *StatePtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MthrWaitMultiple  (const MIL_ID *EventArrayIdPtr,
+                                  MIL_INT EventArraySize,
+                                  MIL_INT64 WaitOption,
+                                  MIL_INT *StatePtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MthrInquireMp      (MIL_ID ThrId,
+                                   MIL_INT64 InquireType,
+                                   MIL_INT64 TypeFlag,
+                                   MIL_INT64 TypeValue,
+                                   void* ResultPtr);
+
+MIL_DLLFUNC void    MFTYPE MthrControlMp      (MIL_ID ThrId,
+                                   MIL_INT64 ControlType,
+                                   MIL_INT64 TypeFlag,
+                                   MIL_INT64 TypeValue,
+                                   void* ValuePtr);
+
+
+/***************************************************************************/
+/* OS MODULE:                                                              */
+/***************************************************************************/
+// Main declaration
+#if M_MIL_UNICODE_API && !M_MIL_USE_LINUX
+#define MosMain wmain
+#define MosWinMain wWinMain
+#else
+#define MosMain main
+#define MosWinMain WinMain
+#endif
+
+/**************************************/
+/*  CRITICAL SECTION RELATED DEFINES  */
+/**************************************/
+typedef void*                       MOS_CRITICAL_SECTION;
+
+MIL_DLLFUNC void MFTYPE MosInitializeCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+MIL_DLLFUNC void MFTYPE MosDeleteCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+MIL_DLLFUNC MIL_INT MFTYPE MosTryEnterCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+MIL_DLLFUNC void MFTYPE MosEnterCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+MIL_DLLFUNC void MFTYPE MosLeaveCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+
+MIL_DLLFUNC MIL_INT MFTYPE MosGetch();
+MIL_DLLFUNC MIL_INT MFTYPE MosKbhit();
+MIL_DLLFUNC MIL_INT MFTYPE MosGetchar();
+MIL_DLLFUNC MIL_INT MFTYPE MosAbs(MIL_INT val);
+MIL_DLLFUNC void MFTYPE MosSleep(MIL_INT ms);
+
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+MIL_DLLFUNC MIL_INT MosFclose(MIL_FILE File);
+MIL_DLLFUNC void MFTYPE MosFflush(MIL_FILE stream);
+#endif
+
+// String manipulation
+#if M_MIL_USE_UNICODE
+   MIL_DLLFUNC MIL_FILE MosFopenA(MIL_CONST_TEXTA_PTR FileName, MIL_CONST_TEXTA_PTR Format);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrlenA(const char* str);
+   MIL_DLLFUNC char* MFTYPE MosStruprA(char* str);   
+   MIL_DLLFUNC char* MFTYPE MosStrlwrA(char* str);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrcmpA(const char* string1, const char* string2);
+   MIL_DLLFUNC char* MFTYPE MosStrcatA(char* dest, MIL_INT destsize, const char* source);
+   MIL_DLLFUNC MIL_INT MosPrintfA(const char* format, ...);
+   MIL_DLLFUNC MIL_INT MosFprintfA(MIL_FILE File, const char* format, ...);
+   MIL_DLLFUNC MIL_INT MosVprintfA(const char* format, va_list args);
+   MIL_DLLFUNC MIL_INT MosVsprintfA(char* buf, MIL_INT bufsize, const char* format, va_list args);
+   MIL_DLLFUNC MIL_INT MosSprintfA(char* buf, MIL_INT bufsize, const char* format, ...);
+   MIL_DLLFUNC char* MFTYPE MosStrcpyA(char* dest, MIL_INT destsize, const char* source);
+#endif
+
+#if M_MIL_USE_LINUX
+   #define MosFopenA MosFopen
+   #define MosStrlenA MosStrlen
+   #define MosStruprA MosStrupr   
+   #define MosStrlwrA MosStrlwr
+   #define MosStrcmpA MosStrcmp
+   #define MosStrcatA MosStrcat
+   #define MosPrintfA MosPrintf
+   #define MosVprintfA MosVprintf
+   #define MosFprintfA MosFprintf
+   #define MosSprintfA MosSprintf
+   #define MosStrcpyA MosStrcpy
+#endif
+
+#if M_MIL_USE_UNICODE
+   MIL_DLLFUNC MIL_FILE MosFopenW(MIL_CONST_TEXTW_PTR FileName, MIL_CONST_TEXTW_PTR Format);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrlenW(const wchar_t* str);
+   MIL_DLLFUNC wchar_t* MFTYPE MosStruprW(wchar_t* str);   
+   MIL_DLLFUNC wchar_t* MFTYPE MosStrlwrW(wchar_t* str);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrcmpW(const wchar_t* string1, const wchar_t* string2);
+   MIL_DLLFUNC wchar_t* MFTYPE MosStrcatW(wchar_t* dest, MIL_INT destsize, const wchar_t* source);
+   MIL_DLLFUNC MIL_INT MosPrintfW(const wchar_t* format, ...);
+   MIL_DLLFUNC MIL_INT MosFprintfW(MIL_FILE File, const wchar_t* format, ...);
+   MIL_DLLFUNC MIL_INT MosVprintfW(const wchar_t* format, va_list args);
+   MIL_DLLFUNC MIL_INT MosVsprintfW(wchar_t* buf, MIL_INT bufsize, const wchar_t* format, va_list args);
+   MIL_DLLFUNC MIL_INT MosSprintfW(wchar_t* buf, MIL_INT bufsize, const wchar_t* format, ...);
+   MIL_DLLFUNC wchar_t* MFTYPE MosStrcpyW(wchar_t* dest, MIL_INT destsize, const wchar_t* source);
+
+   #if M_MIL_UNICODE_API
+      #define MosFopen     MosFopenW
+      #define MosStrlen    MosStrlenW
+      #define MosStrupr    MosStruprW 
+      #define MosStrlwr    MosStrlwrW
+      #define MosStrcmp    MosStrcmpW
+      #define MosStrcat    MosStrcatW
+      #define MosPrintf    MosPrintfW
+      #define MosVprintf   MosVprintfW
+      #define MosFprintf   MosFprintfW
+      #define MosVsprintf  MosVsprintfW
+      #define MosSprintf   MosSprintfW
+      #define MosStrcpy    MosStrcpyW
+   #else
+      #define MosFopen     MosFopenA
+      #define MosStrlen    MosStrlenA
+      #define MosStrupr    MosStruprA
+      #define MosStrlwr    MosStrlwrA
+      #define MosStrcmp    MosStrcmpA
+      #define MosStrcat    MosStrcatA
+      #define MosPrintf    MosPrintfA
+      #define MosFprintf   MosFprintfA
+      #define MosVprintf   MosVprintfA
+      #define MosVsprintf  MosVsprintfA
+      #define MosSprintf   MosSprintfA
+      #define MosStrcpy    MosStrcpyA
+   #endif
+#else
+   
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrlen(MIL_CONST_TEXT_PTR str);
+   MIL_DLLFUNC MIL_TEXT_PTR MFTYPE MosStrupr(MIL_TEXT_PTR str);
+   MIL_DLLFUNC MIL_TEXT_PTR MFTYPE MosStrlwr(MIL_TEXT_PTR str);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrcmp(MIL_CONST_TEXT_PTR string1, MIL_CONST_TEXT_PTR string2);
+   MIL_DLLFUNC MIL_TEXT_PTR MFTYPE MosStrcat(MIL_TEXT_PTR dest, MIL_INT destsize, MIL_CONST_TEXT_PTR source);   
+   MIL_DLLFUNC MIL_TEXT_PTR MFTYPE MosStrcpy(MIL_TEXT_PTR dest, MIL_INT destsize, MIL_CONST_TEXT_PTR source);
+   MIL_DLLFUNC MIL_INT MosSprintf(MIL_TEXT_PTR buf, MIL_INT bufsize, MIL_CONST_TEXT_PTR format, ...);
+   MIL_DLLFUNC MIL_INT MosPrintf(MIL_CONST_TEXT_PTR format, ...);   
+   MIL_DLLFUNC MIL_INT MosVprintf(MIL_CONST_TEXT_PTR format, va_list args);
+   MIL_DLLFUNC MIL_INT MosVsprintf(MIL_TEXT_PTR buf, MIL_INT bufsize, MIL_CONST_TEXT_PTR format, va_list args);
+#if !M_LINUX_KERNEL
+   MIL_DLLFUNC MIL_INT MosFprintf(MIL_FILE File, const char* format, ...);
+   MIL_DLLFUNC MIL_FILE MosFopen(MIL_CONST_TEXT_PTR FileName, MIL_CONST_TEXT_PTR Format);
+#endif
+#endif
+
+/***************************************************************************/
+/* SCREEN FUNCTIONS:                                                         */
+/***************************************************************************/
+#if defined(M_MIL_USE_OS_SCREEN_FUNCTIONS) && M_MIL_USE_OS_SCREEN_FUNCTIONS
+#if M_MIL_USE_LINUX
+#include <ncurses.h>
+#define MosPrintf printw
+#define MosScreenRefresh refresh
+#define MosScreenScroll(A) scrollok(stdscr, A)
+#define MosScreenInit()        \
+   do {                        \
+      initscr();               \
+      move(0,0);               \
+      scrollok(stdscr, TRUE);  \
+      refresh();               \
+   } while(0)
+#define MosScreenRelease endwin
+#define MosScreenClear()       \
+   do {                        \
+      scrollok(stdscr, TRUE);  \
+      clear();                 \
+      refresh();               \
+   } while(0)
+#define MosScreenSetPosition(X,Y)   \
+   do {                             \
+      move(Y,X);                    \
+      refresh();                    \
+      scrollok(stdscr, FALSE);      \
+   } while(0)
+#else
+#include <windows.h>
+#define MosScreenRefresh()
+#define MosScreenScroll(A)
+#define MosScreenInit()
+#define MosScreenRelease()
+#define MosScreenClear()  \
+   do {                   \
+      std::system("cls"); \
+   } while(0)
+#define MosScreenSetPosition(A, B)                                      \
+   do {                                                                 \
+      COORD Coord;                                                      \
+      Coord.X = SHORT(A);                                               \
+      Coord.Y = SHORT(B);                                               \
+      SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Coord); \
+   } while(0)
+#endif
+#endif
+/***************************************************************************/
+/* MISC FUNCTIONS:                                                         */
+/***************************************************************************/
+MIL_DLLFUNC MIL_UINT MFTYPE  MPtrToInt           (void *pvPtr);
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+}
+#endif
+
+/***************************************************************************/
+/* TOOLKIT FOR PSEUDO MIL FUNCTIONS DEVELOPMENT                            */
+/***************************************************************************/
+#include <milfunc.h> // milfunc.h handles the extern "C" and has some C++ code for safe-type support
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if !M_MIL_USE_64BIT
+typedef struct _MILBUFFERINFO {
+    long   StructSize;      // Size of the structure, in bytes. This member must be initialized before the structure is used. 
+    long   SizeX;
+    long   SizeY;
+    long   SizeBand;
+    long   SizeBit;
+    long   Type;
+    long   Attribute;
+    long   Format;
+    long   OffsetX;
+    long   OffsetY;
+    long   OffsetBand;
+    long   AncestorOffsetX;
+    long   AncestorOffsetY;
+    long   AncestorOffsetBand;
+    long   AncestorOffsetBit;
+    long   Pitch;
+    long   PitchByte;
+    void*  HostPtr;
+    void*  BandHostPtr[3];
+    MIL_PHYS_DATA_PTR  PhysPtr;
+    MIL_ID Id;
+    MIL_ID ParentId;
+    MIL_ID AncestorId;
+    long   NativeId;
+} MILBUFFERINFOOLD,* LPMILBUFFERINFOOLD;
+#endif
+#endif
+
+
+
+
+#ifdef __cplusplus
+
+inline MIL_ID MsysAlloc(MIL_CONST_TEXT_PTR SystemDescriptor,
+                        MIL_INT SystemNum,
+                        MIL_INT64 InitFlag,
+                        MIL_ID* SysIdPtr)
+   {
+   return MsysAlloc(M_DEFAULT,
+                    SystemDescriptor,
+                    SystemNum,
+                    InitFlag,
+                    SysIdPtr);
+   }
+
+#if !defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL
+inline MIL_ID MappAlloc(MIL_INT64 InitFlag,
+                        MIL_ID* ContextAppIdPtr)
+   {
+   return MappAlloc(MIL_TEXT("M_DEFAULT"),
+                    InitFlag,
+                    ContextAppIdPtr);
+   }
+#endif
+
+inline void MappControl(MIL_INT64 ControlType,
+                        MIL_INT ControlFlag)
+   {
+   MappControl(M_DEFAULT, ControlType, ControlFlag);
+   }
+
+inline MIL_INT MappGetError(MIL_INT64 ErrorType,
+                            void* ErrorPtr)
+   {
+   return MappGetError(M_DEFAULT, ErrorType, ErrorPtr);
+   }
+
+inline MIL_INT MappGetHookInfo(MIL_ID EventId,
+                               MIL_INT64 InfoType,
+                               void* UserVarPtr)
+   {
+   return MappGetHookInfo(M_DEFAULT, EventId, InfoType, UserVarPtr);
+   }
+
+inline void MappHookFunction(MIL_INT HookType,
+                             MIL_APP_HOOK_FUNCTION_PTR HookHandlerPtr,
+                             void* UserDataPtr)
+   {
+   MappHookFunction(M_DEFAULT, HookType, HookHandlerPtr, UserDataPtr);
+   }
+
+inline MIL_INT MappInquire(MIL_INT64 InquireType,
+                           void* UserVarPtr)
+   {
+   return MappInquire(M_DEFAULT, InquireType, UserVarPtr);
+   }
+
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+inline MIL_DOUBLE MappTimer(MIL_INT64 ControlType,
+                            MIL_DOUBLE* TimePtr)
+   {
+   return MappTimer(M_DEFAULT, ControlType, TimePtr);
+   }
+#endif
+
+inline void MappTimerVoid(MIL_INT64 Mode,
+                          MIL_DOUBLE* Time)
+   {
+   MappTimerVoid(M_DEFAULT, Mode, Time);
+   }
+#endif
+
+#ifdef __cplusplus
+//////////////////////////////////////////////////////////////
+// MbufControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !(M_MIL_USE_LINUX  && M_MIL_USE_64BIT)
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040)   || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, ControlValue);
+#else
+   MbufControl(BufId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, int ControlValue)
+   {
+   MbufControlContainerInt64(ContainerBufId, Component, ControlType, ControlValue);
+   }
+
+#endif
+
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_INT32 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, ControlValue);
+#else
+   MbufControl(BufId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   MbufControlContainerInt64(ContainerBufId, Component, ControlType, ControlValue);
+   }
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MbufControlContainerInt64(ContainerBufId, Component, ControlType, (MIL_ADDR)ControlValue);
+   }
+
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040)  || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, ControlValue);
+#else
+   MbufControl(BufId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040)  || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, (MIL_ADDR)ControlValue);
+#else
+   MbufControl(BufId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+#endif
+   }
+
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   void* ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040)  || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, (MIL_ADDR)ControlValue);
+#else
+   MbufControl(BufId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+#endif
+   }
+
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, MIL_INT64 ControlValue)
+   {
+   MbufControlContainerInt64(ContainerBufId, Component, ControlType, ControlValue);
+   }
+
+
+#if M_MIL_USE_64BIT
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue)
+   {
+   MbufControlDouble(BufId, ControlType, ControlValue);
+   }
+#endif
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
+   {
+   MbufControlContainerDouble(ContainerBufId, Component, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MdigControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MdigControlInt64(DigId, ControlType, ControlValue);
+#else
+   MdigControl(DigId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   };
+#endif
+
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_INT32 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MdigControlInt64(DigId, ControlType, ControlValue);
+#else
+   MdigControl(DigId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MdigControlInt64(DigId, ControlType, ControlValue);
+#else
+   MdigControl(DigId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+#if M_MIL_USE_64BIT
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue)
+   {
+   MdigControlDouble(DigId, ControlType, ControlValue);
+   }
+#endif
+
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MdigControl(DigId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+
+//////////////////////////////////////////////////////////////
+// MobjControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MobjControlInt64(ObjectId, ControlType, ControlValue);
+#else
+   MobjControl(ObjectId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   };
+#endif
+
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_INT32 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MobjControlInt64(ObjectId, ControlType, ControlValue);
+#else
+   MobjControl(ObjectId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MobjControlInt64(ObjectId, ControlType, ControlValue);
+#else
+   MobjControl(ObjectId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+#if M_MIL_USE_64BIT
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue)
+   {
+   MobjControlDouble(ObjectId, ControlType, ControlValue);
+   }
+#endif
+
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MobjControl(ObjectId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   void* ControlValue)
+   {
+   MobjControl(ObjectId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+
+
+#endif
+
+
+#if M_MIL_USE_64BIT
+#ifdef __cplusplus
+#if !M_HIDE_DEPRECATED_FROM_INTELLISENSE
+inline void MappControlObject(MIL_ID ContextAppId,
+                              MIL_ID ObjectId,
+                              MIL_INT64 ControlType,
+                              MIL_INT32 ControlValue)
+   {
+   MappControlObjectInt64(ContextAppId, ObjectId, ControlType, ControlValue);
+   }
+
+inline void MappControlObject(MIL_ID ContextAppId,
+                              MIL_ID ObjectId,
+                              MIL_INT64 ControlType,
+                              MIL_INT64 ControlValue)
+   {
+   MappControlObjectInt64(ContextAppId, ObjectId, ControlType, ControlValue);
+   }
+
+inline void MappControlObject(MIL_ID ContextAppId,
+                              MIL_ID ObjectId,
+                              MIL_INT64 ControlType,
+                              MIL_DOUBLE ControlValue)
+   {
+   MappControlObjectDouble(ContextAppId, ObjectId, ControlType, ControlValue);
+   }
+#endif
+
+struct MCppParameter
+   {
+#if !M_MIL_USE_LINUX
+   MCppParameter(int          Param) { m_Param = (double)Param; }
+   MCppParameter(unsigned int Param) { m_Param = (double)Param; }
+#endif
+   MCppParameter(MIL_INT8     Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_UINT8    Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_INT16    Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_UINT16   Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_INT32    Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_UINT32   Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_INT64    Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_UINT64   Param) { m_Param = (double)Param; }
+   MCppParameter(float        Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_DOUBLE   Param) { m_Param = (double)Param; }
+
+   double m_Param;
+   };
+
+//////////////////////////////////////////////////////////////
+// MgraDot function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraDot(MIL_ID ContextGraId,
+                    MIL_ID DstImageBufOrListGraId,
+                    const MCppParameter& XPos,
+                    const MCppParameter& YPos)
+   {
+   MgraDotDouble(ContextGraId, DstImageBufOrListGraId, XPos.m_Param, YPos.m_Param);
+   }
+
+inline void MgraDotEx(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      const MCppParameter& XPos,
+                      const MCppParameter& YPos,
+                      MIL_ID NativeCalibration,
+                      MIL_INT64 NativeUnits,
+                      MIL_INT64 ConvertMode)
+   {
+   MgraDotDoubleEx(ContextGraId, DstImageBufOrListGraId, XPos.m_Param, YPos.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraLine function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+
+inline void MgraLine(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     const MCppParameter& XStart,
+                     const MCppParameter& YStart,
+                     const MCppParameter& XEnd,
+                     const MCppParameter& YEnd)
+   {
+   MgraLineDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param);
+   }
+
+inline void MgraLineEx(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     const MCppParameter& XStart,
+                     const MCppParameter& YStart,
+                     const MCppParameter& XEnd,
+                     const MCppParameter& YEnd,
+                     MIL_ID NativeCalibration,
+                     MIL_INT64 NativeUnits,
+                     MIL_INT64 ConvertMode)
+   {
+   MgraLineDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraArc function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraArc(MIL_ID ContextGraId,
+                    MIL_ID DstImageBufOrListGraId,
+                    const MCppParameter& XCenter,
+                    const MCppParameter& YCenter,
+                    const MCppParameter& XRad,
+                    const MCppParameter& YRad,
+                    MIL_DOUBLE StartAngle,
+                    MIL_DOUBLE EndAngle)
+   {
+   MgraArcDouble(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle);
+   }
+
+inline void MgraArcEx(MIL_ID ContextGraId,
+                    MIL_ID DstImageBufOrListGraId,
+                    const MCppParameter& XCenter,
+                    const MCppParameter& YCenter,
+                    const MCppParameter& XRad,
+                    const MCppParameter& YRad,
+                    MIL_DOUBLE StartAngle,
+                    MIL_DOUBLE EndAngle,
+                    MIL_ID NativeCalibration,
+                    MIL_INT64 NativeUnits,
+                    MIL_INT64 ConvertMode)
+   {
+   MgraArcDoubleEx(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraArcFill function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraArcFill(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XCenter,
+                        const MCppParameter& YCenter,
+                        const MCppParameter& XRad,
+                        const MCppParameter& YRad,
+                        MIL_DOUBLE StartAngle,
+                        MIL_DOUBLE EndAngle)
+   {
+   MgraArcFillDouble(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle);
+   }
+
+inline void MgraArcFillEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XCenter,
+                        const MCppParameter& YCenter,
+                        const MCppParameter& XRad,
+                        const MCppParameter& YRad,
+                        MIL_DOUBLE StartAngle,
+                        MIL_DOUBLE EndAngle,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraArcFillDoubleEx(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraArcAngle function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraArcAngle(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XCenter,
+                        const MCppParameter& YCenter,
+                        const MCppParameter& XRad,
+                        const MCppParameter& YRad,
+                        MIL_DOUBLE StartAngle,
+                        MIL_DOUBLE EndAngle,
+                        MIL_DOUBLE XAxisAngle,
+                        MIL_INT64  ControlFlag)
+   {
+   MgraArcAngleDouble(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle, XAxisAngle, ControlFlag);
+   }
+
+inline void MgraArcAngleEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XCenter,
+                        const MCppParameter& YCenter,
+                        const MCppParameter& XRad,
+                        const MCppParameter& YRad,
+                        MIL_DOUBLE StartAngle,
+                        MIL_DOUBLE EndAngle,
+                        MIL_DOUBLE XAxisAngle,
+                        MIL_INT64 ControlFlag,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraArcAngleDoubleEx(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle, XAxisAngle, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+// MgraRingSector function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE MgraRingSector(MIL_ID     ContextGraId             ,
+                                  MIL_ID     DestImageBufIdOrGraListId,
+                                  const MCppParameter&  XCenter       ,
+                                  const MCppParameter&  YCenter       ,
+                                  const MCppParameter&  XInnerRadius  ,
+                                  const MCppParameter&  YInnerRadius  ,
+                                  const MCppParameter&  XOuterRadius  ,
+                                  const MCppParameter&  YOuterRadius  ,
+                                  MIL_DOUBLE StartAngle               ,
+                                  MIL_DOUBLE EndAngle                 ,
+                                  MIL_DOUBLE XAxisAngle               ,
+                                  MIL_INT64  ControlFlag              )
+   {
+   MgraRingSectorDouble(ContextGraId, DestImageBufIdOrGraListId, XCenter.m_Param, YCenter.m_Param, XInnerRadius.m_Param, YInnerRadius.m_Param, XOuterRadius.m_Param, YOuterRadius.m_Param, StartAngle, EndAngle, XAxisAngle, ControlFlag);
+   }
+
+inline void MFTYPE MgraRingSectorEx(MIL_ID     ContextGraId             ,
+                                    MIL_ID     DestImageBufIdOrGraListId,
+                                    const MCppParameter&  XCenter       ,
+                                    const MCppParameter&  YCenter       ,
+                                    const MCppParameter&  XInnerRadius  ,
+                                    const MCppParameter&  YInnerRadius  ,
+                                    const MCppParameter&  XOuterRadius  ,
+                                    const MCppParameter&  YOuterRadius  ,
+                                    MIL_DOUBLE StartAngle               ,
+                                    MIL_DOUBLE EndAngle                 ,
+                                    MIL_DOUBLE XAxisAngle               ,
+                                    MIL_INT64  ControlFlag              ,
+                                    MIL_ID     NativeCalibration        ,
+                                    MIL_INT64  NativeUnits              ,
+                                    MIL_INT64  ConvertMode          )
+   {
+   MgraRingSectorDoubleEx(ContextGraId, DestImageBufIdOrGraListId, XCenter.m_Param, YCenter.m_Param, XInnerRadius.m_Param, YInnerRadius.m_Param, XOuterRadius.m_Param, YOuterRadius.m_Param, StartAngle, EndAngle, XAxisAngle, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+// MgraRect function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraRect(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     const MCppParameter& XStart,
+                     const MCppParameter& YStart,
+                     const MCppParameter& XEnd,
+                     const MCppParameter& YEnd)
+   {
+   MgraRectDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param);
+   }
+
+inline void MgraRectEx(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      const MCppParameter& XStart,
+                      const MCppParameter& YStart,
+                      const MCppParameter& XEnd,
+                      const MCppParameter& YEnd,
+                      MIL_ID NativeCalibration,
+                      MIL_INT64 NativeUnits,
+                      MIL_INT64 ConvertMode)
+   {
+   MgraRectDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraRectAngle function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraRectAngle(MIL_ID ContextGraId,
+                          MIL_ID DestImageBufIdOrGraListId,
+                          const MCppParameter& XPos,
+                          const MCppParameter& YPos,
+                          const MCppParameter& Width,
+                          const MCppParameter& Height,
+                          MIL_DOUBLE Angle,
+                          MIL_INT64 ControlFlag)
+   {
+   MgraRectAngleDouble(ContextGraId, DestImageBufIdOrGraListId, 
+      XPos.m_Param, YPos.m_Param, 
+      Width.m_Param, Height.m_Param, 
+      Angle, ControlFlag);
+   }
+
+inline void MgraRectAngleEx(MIL_ID ContextGraId,
+                          MIL_ID DestImageBufIdOrGraListId,
+                          const MCppParameter& XPos,
+                          const MCppParameter& YPos,
+                          const MCppParameter& Width,
+                          const MCppParameter& Height,
+                          MIL_DOUBLE Angle,
+                          MIL_INT64 ControlFlag,
+                          MIL_ID NativeCalibration,
+                          MIL_INT64 NativeUnits,
+                          MIL_INT64 ConvertMode)
+   {
+   MgraRectAngleDoubleEx(ContextGraId, DestImageBufIdOrGraListId, 
+      XPos.m_Param, YPos.m_Param, 
+      Width.m_Param, Height.m_Param, 
+      Angle, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraRectFill function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraRectFill(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         const MCppParameter& XEnd,
+                         const MCppParameter& YEnd)
+   {
+   MgraRectFillDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param);
+   }
+
+inline void MgraRectFillEx(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         const MCppParameter& XEnd,
+                         const MCppParameter& YEnd,
+                         MIL_ID NativeCalibration,
+                         MIL_INT64 NativeUnits,
+                         MIL_INT64 ConvertMode)
+   {
+   MgraRectFillDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraFill function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraFill(MIL_ID ContextGraId,
+                     MIL_ID ImageId,
+                     const MCppParameter& XStart,
+                     const MCppParameter& YStart)
+   {
+   MgraFillDouble(ContextGraId, ImageId, XStart.m_Param, YStart.m_Param);
+   }
+
+inline void MgraFillEx(MIL_ID ContextGraId,
+                       MIL_ID ImageId,
+                       const MCppParameter& XStart,
+                       const MCppParameter& YStart,
+                       MIL_ID NativeCalibration,
+                       MIL_INT64 NativeUnits,
+                       MIL_INT64 ConvertMode)
+   {
+   MgraFillDoubleEx(ContextGraId, ImageId, XStart.m_Param, YStart.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraTextW function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if M_MIL_USE_UNICODE
+
+   inline void MgraTextA(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         MIL_CONST_TEXTA_PTR StringPtr)
+      {
+      MgraTextADouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr);
+      }
+
+   inline void MgraTextAEx(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         MIL_CONST_TEXTA_PTR StringPtr,
+                         MIL_ID NativeCalibration,
+                         MIL_INT64 NativeUnits,
+                         MIL_INT64 ConvertMode)
+      {
+      MgraTextADoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr, NativeCalibration, NativeUnits, ConvertMode);
+      }
+
+   inline void MgraTextW(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         MIL_CONST_TEXTW_PTR StringPtr)
+      {
+      MgraTextWDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr);
+      }
+
+   inline void MgraTextWEx(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         MIL_CONST_TEXTW_PTR StringPtr,
+                         MIL_ID NativeCalibration,
+                         MIL_INT64 NativeUnits,
+                         MIL_INT64 ConvertMode)
+      {
+      MgraTextWDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr, NativeCalibration, NativeUnits, ConvertMode);
+      }
+
+#else // #if M_MIL_USE_UNICODE
+
+   inline void MgraText(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XStart,
+                        const MCppParameter& YStart,
+                        MIL_CONST_TEXT_PTR StringPtr)
+      {
+      MgraTextDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr);
+      }
+
+   inline void MgraTextEx(MIL_ID ContextGraId,
+                          MIL_ID DstImageBufOrListGraId,
+                          const MCppParameter& XStart,
+                          const MCppParameter& YStart,
+                          MIL_CONST_TEXT_PTR StringPtr,
+                          MIL_ID NativeCalibration,
+                          MIL_INT64 NativeUnits,
+                          MIL_INT64 ConvertMode)
+      {
+      MgraTextDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr, NativeCalibration, NativeUnits, ConvertMode);
+      }
+
+#endif // #if M_MIL_USE_UNICODE #else
+
+#if  !M_MIL_USE_LINUX || M_MIL_USE_64BIT || M_COMPILING_MILDLL
+inline void MseqControl(MIL_ID ContextSeqId,
+                        MIL_INT SequenceIndex,
+                        MIL_INT64 ControlType,
+                        int ControlValue)
+      {
+      MseqControlInt64(ContextSeqId, SequenceIndex, ControlType, ControlValue);
+      }
+#if !M_MIL_USE_LINUX
+inline void MseqControl(MIL_ID ContextSeqId,
+                        MIL_INT SequenceIndex,
+                        MIL_INT64 ControlType,
+                        MIL_INT32 ControlValue)
+   {
+   MseqControlInt64(ContextSeqId, SequenceIndex, ControlType, ControlValue);
+   }
+#endif
+inline void MseqControl(MIL_ID ContextSeqId,
+                        MIL_INT SequenceIndex,
+                        MIL_INT64 ControlType,
+                        MIL_INT64 ControlValue)
+   {
+   MseqControlInt64(ContextSeqId, SequenceIndex, ControlType, ControlValue);
+   }
+
+inline void MseqControl(MIL_ID ContextSeqId,
+                        MIL_INT SequenceIndex,
+                        MIL_INT64 ControlType,
+                        MIL_DOUBLE ControlValue)
+   {
+   MseqControlDouble(ContextSeqId, SequenceIndex, ControlType, ControlValue);
+   }
+#endif 
+
+
+
+
+//////////////////////////////////////////////////////////////
+// MsysIoControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MsysIoControl(MIL_ID IoObjectId,
+                          MIL_INT64 ControlType,
+                          int ControlValue)
+   {
+   MsysIoControlInt64(IoObjectId, ControlType, ControlValue);
+   };
+#endif
+
+inline void MsysIoControl(MIL_ID IoObjectId,
+                          MIL_INT64 ControlType,
+                          MIL_INT32 ControlValue)
+   {
+   MsysIoControlInt64(IoObjectId, ControlType, ControlValue);
+   }
+
+inline void MsysIoControl(MIL_ID IoObjectId,
+                          MIL_INT64 ControlType,
+                          MIL_INT64 ControlValue)
+   {
+   MsysIoControlInt64(IoObjectId, ControlType, ControlValue);
+   }
+
+inline void MsysIoControl(MIL_ID IoObjectId,
+                          MIL_INT64 ControlType,
+                          MIL_DOUBLE ControlValue)
+   {
+   MsysIoControlDouble(IoObjectId, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MthrControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MthrControl(MIL_ID ThreadEventOrMutexId,
+                        MIL_INT64 ControlType,
+                        int ControlValue)
+   {
+   MthrControlInt64(ThreadEventOrMutexId, ControlType, ControlValue);
+   };
+#endif
+
+inline void MthrControl(MIL_ID ThreadEventOrMutexId,
+                        MIL_INT64 ControlType,
+                        MIL_INT32 ControlValue)
+   {
+   MthrControlInt64(ThreadEventOrMutexId, ControlType, ControlValue);
+   }
+
+inline void MthrControl(MIL_ID ThreadEventOrMutexId,
+                        MIL_INT64 ControlType,
+                        MIL_INT64 ControlValue)
+   {
+   MthrControlInt64(ThreadEventOrMutexId, ControlType, ControlValue);
+   }
+
+inline void MthrControl(MIL_ID ThreadEventOrMutexId,
+                        MIL_INT64 ControlType,
+                        MIL_DOUBLE ControlValue)
+   {
+   MthrControlDouble(ThreadEventOrMutexId, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraControlList function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                            MIL_INT LabelOrIndex,
+                                            MIL_INT SubIndex,
+                                            MIL_INT64 ControlType,
+                                            int ControlValue)
+   {
+   MgraControlListInt64(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+#endif
+
+inline void MFTYPE    MgraControlList(MIL_ID GraListId,
+                                      MIL_INT LabelOrIndex,
+                                      MIL_INT SubIndex,
+                                      MIL_INT64 ControlType,
+                                      MIL_ADDR ControlValue)
+   {
+   MgraControlListInt64(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+inline void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                            MIL_INT LabelOrIndex,
+                                            MIL_INT SubIndex,
+                                            MIL_INT64 ControlType,
+                                            MIL_INT32 ControlValue)
+   {
+   MgraControlListInt64(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+
+inline void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                            MIL_INT LabelOrIndex,
+                                            MIL_INT SubIndex,
+                                            MIL_INT64 ControlType,
+                                            MIL_INT64 ControlValue)
+   {
+   MgraControlListInt64(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+
+inline void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                            MIL_INT LabelOrIndex,
+                                            MIL_INT SubIndex,
+                                            MIL_INT64 ControlType,
+                                            MIL_DOUBLE ControlValue)
+   {
+   MgraControlListDouble(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                                   MIL_INT64 ControlType,
+                                   int ControlValue)
+   {
+   MgraControlInt64(ContextGraId, ControlType, ControlValue);
+   }
+#endif
+
+inline void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                                   MIL_INT64 ControlType,
+                                   MIL_INT32 ControlValue)
+   {
+   MgraControlInt64(ContextGraId, ControlType, ControlValue);
+   }
+
+inline void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                                   MIL_INT64 ControlType,
+                                   MIL_INT64 ControlValue)
+   {
+   MgraControlInt64(ContextGraId, ControlType, ControlValue);
+   }
+
+inline void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                                   MIL_INT64 ControlType,
+                                   MIL_DOUBLE ControlValue)
+   {
+   MgraControlDouble(ContextGraId, ControlType, ControlValue);
+   }
+
+#else
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. Int64 one
+//////////////////////////////////////////////////////////////
+#define MgraDot         MgraDotInt64
+#define MgraDotEx       MgraDotInt64Ex
+#define MgraLine        MgraLineInt64
+#define MgraLineEx      MgraLineInt64Ex
+#define MgraArc         MgraArcInt64
+#define MgraArcEx       MgraArcInt64Ex
+#define MgraArcFill     MgraArcFillInt64
+#define MgraArcFillEx   MgraArcFillInt64Ex
+#define MgraArcAngle    MgraArcAngleInt64
+#define MgraArcAngleEx  MgraArcAngleInt64Ex
+#define MgraRingSector  MgraRingSectorInt64
+#define MgraRingSectorEx  MgraRingSectorInt64Ex
+#define MgraRect        MgraRectInt64
+#define MgraRectEx      MgraRectInt64Ex
+#define MgraRectFill    MgraRectFillInt64
+#define MgraRectFillEx  MgraRectFillInt64Ex
+#define MgraRectAngle   MgraRectAngleInt64
+#define MgraRectAngleEx MgraRectAngleInt64Ex
+#define MgraFill        MgraFillInt64
+#define MgraFillEx      MgraFillInt64Ex
+#if M_MIL_USE_UNICODE 
+#define MgraTextW       MgraTextWInt64
+#define MgraTextWEx     MgraTextWInt64Ex
+#define MgraTextA       MgraTextAInt64
+#define MgraTextAEx     MgraTextAInt64Ex
+#else
+#define MgraText        MgraTextInt64
+#define MgraTextEx      MgraTextInt64Ex
+#endif
+#define MseqControl     MseqControlInt64
+#define MobjControl     MobjControlInt64
+#define MbufControl     MbufControlInt64
+#define MdigControl     MdigControlInt64
+#define MthrControl     MthrControlInt64
+#define MgraControlList MgraControlListInt64
+#define MsysIoControl   MsysIoControlInt64
+
+#endif // __cplusplus
+#else //M_MIL_USE_64BIT
+
+#endif // M_MIL_USE_64BIT
+
+
+MIL_DEPRECATED(MappControlObject, 1060)
+MIL_DEPRECATED(MappInquireObject, 1060)
+
+
+#if(defined(__cplusplus))
+
+//////////////////////////////////////////////////////////////
+// MbufControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE   MbufClear(MIL_ID DstContainerOrBufId, MIL_DOUBLE Color)
+   {
+   MbufClearDouble(DstContainerOrBufId, Color);
+   }
+
+//////////////////////////////////////////////////////////////
+// MbufControlArea function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE   MbufControlArea(MIL_ID  BufId,
+                                     MIL_INT OffsetX,
+                                     MIL_INT OffsetY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Band,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue)
+   {
+   MbufControlAreaDouble(BufId, OffsetX, OffsetY, SizeX, SizeY, Band, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MbufClearCond function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE    MbufClearCond (MIL_ID DstBufId,
+                                     MIL_DOUBLE RedOrMonoVal,
+                                     MIL_DOUBLE GreenVal,
+                                     MIL_DOUBLE BlueVal,
+                                     MIL_ID CondBufId,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondValue)
+   {
+   MbufClearCondDouble(DstBufId, RedOrMonoVal, GreenVal, BlueVal, CondBufId, Condition, CondValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MbufCopyCond function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE    MbufCopyCond  (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_ID CondBufId,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondValue)
+   {
+   MbufCopyCondDouble(SrcBufId, DestBufId, CondBufId, Condition, CondValue);
+   }
+
+
+
+// New API call so redirect it to the good entry point.
+#define MbufGetArc   MbufGetArc2
+
+
+inline MIL_INT MbufGetArc(MIL_ID     ImageBufId,
+                          MIL_INT    XCenter,
+                          MIL_INT    YCenter,
+                          MIL_INT    XRad,
+                          MIL_INT    YRad,
+                          MIL_DOUBLE StartAngle,
+                          MIL_DOUBLE EndAngle,
+                          void*      UserArrayPtr,
+                          MIL_INT*   NbPixelsPtr)
+   {
+   return MbufGetArc(ImageBufId, XCenter, YCenter, XRad, YRad, StartAngle, EndAngle, M_DEFAULT, NbPixelsPtr, UserArrayPtr, M_NULL, M_NULL);
+   }
+
+//////////////////////////////////////////////////////////////
+// MbufSetRegion function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE    MbufSetRegion    (MIL_ID ImageBufId,
+                                        MIL_ID ImageOrGraphicListId,
+                                        MIL_INT64 Label,
+                                        MIL_INT64 Operation,
+                                        MIL_DOUBLE Param)
+   {
+   MbufSetRegionDouble(ImageBufId, ImageOrGraphicListId, Label, Operation, Param);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraBackColor function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE    MgraBackColor (MIL_ID ContextGraId,
+                                     MIL_DOUBLE BackgroundColor)
+   {
+   MgraBackColorDouble(ContextGraId, BackgroundColor);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraColor function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE   MgraColor      (MIL_ID ContextGraId,
+                                     MIL_DOUBLE ForegroundColor)
+   {
+   MgraColorDouble(ContextGraId, ForegroundColor);
+   }
+
+//////////////////////////////////////////////////////////////
+// MsysControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL
+#if !M_MIL_USE_LINUX || !M_MIL_USE_64BIT
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        int ControlValue)
+   {
+   MsysControlInt64(SysId, ControlType, ControlValue);
+   };
+#endif
+
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_INT32 ControlValue)
+   {
+   MsysControlInt64(SysId, ControlType, ControlValue);
+   }
+
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_INT64 ControlValue)
+   {
+   MsysControlInt64(SysId, ControlType, ControlValue);
+   }
+
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_UINT32 ControlValue)
+   {
+   MsysControlInt64(SysId, ControlType, ControlValue);
+   }
+
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_DOUBLE ControlValue)
+   {
+   MsysControlDouble(SysId, ControlType, ControlValue);
+   }
+   
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MsysControl(SysId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+inline void MsysControl(MIL_ID SysId,
+   MIL_INT64 ControlType,
+   void* ControlValue)
+   {
+   MsysControl(SysId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+#endif //#if !M_COMPILING_MILDLL
+
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+inline void MseqControl(MIL_ID ContextSeqId,
+   MIL_INT SequenceIndex,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MseqControl(ContextSeqId, SequenceIndex, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+#if !M_MIL_USE_64BIT
+inline void MseqControl(MIL_ID ContextSeqId,
+   MIL_INT SequenceIndex,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+   MseqControl(ContextSeqId, SequenceIndex, ControlType, (MIL_DOUBLE)(M_PTR_TO_MIL_INT(ControlValue)));
+   }
+#endif
+#endif
+
+#if M_MIL_USE_64BIT
+inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   MappControl(ContextAppId, ControlType, (MIL_INT)ControlValue);
+   }
+inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_UINT32 ControlValue)
+   {
+   MappControl(ContextAppId, ControlType, (MIL_INT)ControlValue);
+   }
+
+inline void MappControl(MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   MappControl(ControlType, (MIL_INT)ControlValue);
+   }
+
+inline void MappControl(MIL_INT64 ControlType, MIL_UINT32 ControlValue)
+   {
+   MappControl(ControlType, (MIL_INT)ControlValue);
+   }
+
+#endif
+
+inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MappControl(ContextAppId, ControlType, (MIL_INT)ControlValue);
+   }
+
+inline void MappControl(MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MappControl(M_DEFAULT, ControlType, ControlValue);
+   }
+
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, int ControlValue)
+   {
+   MappControl(ContextAppId, ControlType, (MIL_INT)ControlValue);
+   }
+
+inline void MappControl(MIL_INT64 ControlType, int ControlValue)
+   {
+   MappControl(M_DEFAULT, ControlType, (MIL_INT)ControlValue);
+   }
+
+#endif
+
+#else //#if(!defined(__cplusplus))
+
+#define  MbufClear                     MbufClearDouble
+#define  MbufControlArea               MbufControlAreaDouble
+#define  MbufClearCond                 MbufClearCondDouble
+#define  MbufCopyCond                  MbufCopyCondDouble
+#define  MbufSetRegion                 MbufSetRegionDouble
+#define  MgraBackColor                 MgraBackColorDouble
+#define  MgraColor                     MgraColorDouble
+#define  MgraControl                   MgraControlDouble
+#define  MsysControl                   MsysControlDouble
+
+#endif   //#if(defined(__cplusplus))
+
+// These functions have 3 versions of Mgra API even in 32 bits.
+#if (defined __cplusplus)
+
+//////////////////////////////////////////////////////////////
+// MgraDots function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraDots(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     MIL_INT  NumberOfDots,
+                     const MIL_INT32 *PosXArrayPtr,
+                     const MIL_INT32 *PosYArrayPtr,
+                     MIL_INT64 ControlFlag)
+   {
+   MgraDotsInt32(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag);
+   }
+
+inline void MgraDotsEx(MIL_ID ContextGraId,
+                       MIL_ID DstImageBufOrListGraId,
+                       MIL_INT  NumberOfDots,
+                       const MIL_INT32 *PosXArrayPtr,
+                       const MIL_INT32 *PosYArrayPtr,
+                       MIL_INT64 ControlFlag,
+                       MIL_ID NativeCalibration,
+                       MIL_INT64 NativeUnits,
+                       MIL_INT64 ConvertMode)
+   {
+   MgraDotsInt32Ex(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+inline void MgraDots(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     MIL_INT  NumberOfDots,
+                     const MIL_INT64 *PosXArrayPtr,
+                     const MIL_INT64 *PosYArrayPtr,
+                     MIL_INT64 ControlFlag)
+   {
+   MgraDotsInt64(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag);
+   }
+
+inline void MgraDotsEx(MIL_ID ContextGraId,
+                       MIL_ID DstImageBufOrListGraId,
+                       MIL_INT  NumberOfDots,
+                       const MIL_INT64 *PosXArrayPtr,
+                       const MIL_INT64 *PosYArrayPtr,
+                       MIL_INT ControlFlag,
+                       MIL_ID NativeCalibration,
+                       MIL_INT64 NativeUnits,
+                       MIL_INT64 ConvertMode)
+   {
+   MgraDotsInt64Ex(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+inline void MgraDots(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     MIL_INT  NumberOfDots,
+                     const MIL_DOUBLE *PosXArrayPtr,
+                     const MIL_DOUBLE *PosYArrayPtr,
+                     MIL_INT64 ControlFlag)
+   {
+   MgraDotsDouble(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag);
+   }
+
+inline void MgraDotsEx(MIL_ID ContextGraId,
+                       MIL_ID DstImageBufOrListGraId,
+                       MIL_INT  NumberOfDots,
+                       const MIL_DOUBLE *PosXArrayPtr,
+                       const MIL_DOUBLE *PosYArrayPtr,
+                       MIL_INT ControlFlag,
+                       MIL_ID NativeCalibration,
+                       MIL_INT64 NativeUnits,
+                       MIL_INT64 ConvertMode)
+   {
+   MgraDotsDoubleEx(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraLines function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraLines(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      MIL_INT NumberOfLinesOrVertices,
+                      const MIL_INT32 *XPtr,
+                      const MIL_INT32 *YPtr,
+                      const MIL_INT32 *X2Ptr,
+                      const MIL_INT32 *Y2Ptr,
+                      MIL_INT64 ControlFlag)
+   {
+   MgraLinesInt32(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag);
+   }
+
+inline void MgraLinesEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        MIL_INT NumberOfLinesOrVertices,
+                        const MIL_INT32 *XPtr,
+                        const MIL_INT32 *YPtr,
+                        const MIL_INT32 *X2Ptr,
+                        const MIL_INT32 *Y2Ptr,
+                        MIL_INT64 ControlFlag,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraLinesInt32Ex(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+inline void MgraLines(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      MIL_INT NumberOfLinesOrVertices,
+                      const MIL_INT64 *XPtr,
+                      const MIL_INT64 *YPtr,
+                      const MIL_INT64 *X2Ptr,
+                      const MIL_INT64 *Y2Ptr,
+                      MIL_INT64 ControlFlag)
+   {
+   MgraLinesInt64(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag);
+   }
+
+inline void MgraLinesEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        MIL_INT NumberOfLinesOrVertices,
+                        const MIL_INT64 *XPtr,
+                        const MIL_INT64 *YPtr,
+                        const MIL_INT64 *X2Ptr,
+                        const MIL_INT64 *Y2Ptr,
+                        MIL_INT64 ControlFlag,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraLinesInt64Ex(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+inline void MgraLines(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      MIL_INT NumberOfLinesOrVertices,
+                      const MIL_DOUBLE *XPtr,
+                      const MIL_DOUBLE *YPtr,
+                      const MIL_DOUBLE *X2Ptr,
+                      const MIL_DOUBLE *Y2Ptr,
+                      MIL_INT64 ControlFlag)
+   {
+   MgraLinesDouble(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag);
+   }
+
+inline void MgraLinesEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        MIL_INT NumberOfLinesOrVertices,
+                        const MIL_DOUBLE *XPtr,
+                        const MIL_DOUBLE *YPtr,
+                        const MIL_DOUBLE *X2Ptr,
+                        const MIL_DOUBLE *Y2Ptr,
+                        MIL_INT64 ControlFlag,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraLinesDoubleEx(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+#else //#if(defined(__cplusplus))
+
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. MIL_INT one
+// for backward compatibility. For MgraSymbols, we have no
+// backward compatibility issues, prefer MgraSymbolsDouble.
+//////////////////////////////////////////////////////////////
+#if M_MIL_USE_64BIT
+   #define MgraDots     MgraDotsInt64
+   #define MgraDotsEx   MgraDotsInt64Ex
+   #define MgraLines    MgraLinesInt64
+   #define MgraLinesEx  MgraLinesInt64Ex   
+#else
+   #define MgraDots     MgraDotsInt32
+   #define MgraDotsEx   MgraDotsInt32Ex
+   #define MgraLines    MgraLinesInt32
+   #define MgraLinesEx  MgraLinesInt32Ex
+#endif
+
+#endif // #if(defined(__cplusplus)) #else
+
+/* For compatibility with possible future MgraSymbols
+   functions receiving arrays of other types. */
+#define MgraSymbols    MgraSymbolsDouble
+#define MgraSymbolsEx  MgraSymbolsDoubleEx
+
+#ifdef __cplusplus
+
+inline void MFTYPE MgraVectors(MIL_ID ContextGraId,
+                               MIL_ID DstImageBufOrListGraId,
+                               MIL_INT NumVectors,
+                               const MIL_DOUBLE *XArrayPtr,
+                               const MIL_DOUBLE *YArrayPtr,
+                               const MIL_DOUBLE *UArrayPtr,
+                               const MIL_DOUBLE *VArrayPtr,
+                               MIL_INT64 ScaleMode,
+                               MIL_DOUBLE ScaleValue,
+                               MIL_INT64 ControlFlag)
+   {
+   MgraVectorsDouble(ContextGraId,
+                     DstImageBufOrListGraId,
+                     NumVectors,
+                     XArrayPtr,
+                     YArrayPtr,
+                     UArrayPtr,
+                     VArrayPtr,
+                     ScaleMode,
+                     ScaleValue,
+                     ControlFlag);
+   }
+
+inline void MFTYPE MgraVectors(MIL_ID ContextGraId,
+                               MIL_ID DstImageBufOrListGraId,
+                               MIL_INT NumVectors,
+                               const MIL_FLOAT *XArrayPtr,
+                               const MIL_FLOAT *YArrayPtr,
+                               const MIL_FLOAT *UArrayPtr,
+                               const MIL_FLOAT *VArrayPtr,
+                               MIL_INT64 ScaleMode,
+                               MIL_DOUBLE ScaleValue,
+                               MIL_INT64 ControlFlag)
+   {
+   MgraVectorsFloat(ContextGraId,
+                    DstImageBufOrListGraId,
+                    NumVectors,
+                    XArrayPtr,
+                    YArrayPtr,
+                    UArrayPtr,
+                    VArrayPtr,
+                    ScaleMode,
+                    ScaleValue,
+                    ControlFlag);
+   }
+
+inline void MFTYPE MgraVectors(MIL_ID ContextGraId,
+                               MIL_ID DstImageBufOrListGraId,
+                               MIL_INT NumVectors,
+                               const MIL_INT32 *XArrayPtr,
+                               const MIL_INT32 *YArrayPtr,
+                               const MIL_INT32 *UArrayPtr,
+                               const MIL_INT32 *VArrayPtr,
+                               MIL_INT64 ScaleMode,
+                               MIL_DOUBLE ScaleValue,
+                               MIL_INT64 ControlFlag)
+   {
+   MgraVectorsInt32(ContextGraId,
+                    DstImageBufOrListGraId,
+                    NumVectors,
+                    XArrayPtr,
+                    YArrayPtr,
+                    UArrayPtr,
+                    VArrayPtr,
+                    ScaleMode,
+                    ScaleValue,
+                    ControlFlag);
+   }
+
+inline void MFTYPE MgraVectors(MIL_ID ContextGraId,
+                               MIL_ID DstImageBufOrListGraId,
+                               MIL_INT NumVectors,
+                               const MIL_INT64 *XArrayPtr,
+                               const MIL_INT64 *YArrayPtr,
+                               const MIL_INT64 *UArrayPtr,
+                               const MIL_INT64 *VArrayPtr,
+                               MIL_INT64 ScaleMode,
+                               MIL_DOUBLE ScaleValue,
+                               MIL_INT64 ControlFlag)
+   {
+   MgraVectorsInt64(ContextGraId,
+                    DstImageBufOrListGraId,
+                    NumVectors,
+                    XArrayPtr,
+                    YArrayPtr,
+                    UArrayPtr,
+                    VArrayPtr,
+                    ScaleMode,
+                    ScaleValue,
+                    ControlFlag);
+   }
+
+#else
+
+#define MgraVectors MgraVectorsDouble
+
+#endif
+
+#if M_MIL_USE_64BIT
+
+#define MgraVectorsInt MgraVectorsInt64
+
+#else
+
+#define MgraVectorsInt MgraVectorsInt32
+
+#endif
+
+#ifdef __cplusplus
+
+inline void MFTYPE MbufGetList(MIL_ID SrcBufId,
+                               MIL_INT NumPixels,
+                               const MIL_DOUBLE *PixXArrayPtr,
+                               const MIL_DOUBLE *PixYArrayPtr,
+                               MIL_INT64 InterpolationMode,
+                               void *UserArrayPtr)
+   {
+   MbufGetListDouble(SrcBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, InterpolationMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufGetList(MIL_ID SrcBufId,
+                               MIL_INT NumPixels,
+                               const MIL_INT32 *PixXArrayPtr,
+                               const MIL_INT32 *PixYArrayPtr,
+                               MIL_INT64 InterpolationMode,
+                               void *UserArrayPtr)
+   {
+   MbufGetListInt32(SrcBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, InterpolationMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufGetList(MIL_ID SrcBufId,
+                               MIL_INT NumPixels,
+                               const MIL_INT64 *PixXArrayPtr,
+                               const MIL_INT64 *PixYArrayPtr,
+                               MIL_INT64 InterpolationMode,
+                               void *UserArrayPtr)
+   {
+   MbufGetListInt64(SrcBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, InterpolationMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufPutList(MIL_ID DestBufId,
+                               MIL_INT NumPixels,
+                               const MIL_DOUBLE *PixXArrayPtr,
+                               const MIL_DOUBLE *PixYArrayPtr,
+                               MIL_INT64 OverscanMode,
+                               const void *UserArrayPtr)
+   {
+   MbufPutListDouble(DestBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, OverscanMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufPutList(MIL_ID DestBufId,
+                               MIL_INT NumPixels,
+                               const MIL_INT32 *PixXArrayPtr,
+                               const MIL_INT32 *PixYArrayPtr,
+                               MIL_INT64 OverscanMode,
+                               const void *UserArrayPtr)
+   {
+   MbufPutListInt32(DestBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, OverscanMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufPutList(MIL_ID DestBufId,
+                               MIL_INT NumPixels,
+                               const MIL_INT64 *PixXArrayPtr,
+                               const MIL_INT64 *PixYArrayPtr,
+                               MIL_INT64 OverscanMode,
+                               const void *UserArrayPtr)
+   {
+   MbufPutListInt64(DestBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, OverscanMode, UserArrayPtr);
+   }
+
+#else
+
+#define MbufGetList MbufGetListDouble
+#define MbufPutList MbufPutListDouble
+
+#endif
+
+#if M_MIL_USE_64BIT
+
+#define MbufGetListInt MbufGetListInt64
+#define MbufPutListInt MbufPutListInt64
+
+#else
+
+#define MbufGetListInt MbufGetListInt32
+#define MbufPutListInt MbufPutListInt32
+
+#endif
+
+//////////////////////////////////////////////////////////////
+// SafeType functions.
+//////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////
+// See milos.h for explanation about these functions.
+//////////////////////////////////////////////////////////////
+
+#if (defined __cplusplus)
+inline MIL_INT64 MgraInquireRequiredType(MIL_INT64 InquireType)
+   {
+   MIL_INT64 RequiredType = (InquireType & M_HLVLDATATYPE_MASK);
+
+   if (RequiredType != 0)
+      return RequiredType;
+
+   if ( (InquireType & (M_AVAILABLE|M_SUPPORTED)) != 0 )
+      return M_TYPE_MIL_INT;
+
+   // Here, only the +M_DEFAULT combo flag is left; remove it.
+   MIL_INT64 StrippedInquireType = ( InquireType & ~(M_HLVLDATATYPE_MASK|M_AVAILABLE|M_SUPPORTED|M_DEFAULT) );
+
+   if (M_IN_GRA_INQUIRE_MIL_ID_RANGE(StrippedInquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_GRA_INQUIRE_DOUBLE_RANGE(StrippedInquireType))
+      return M_TYPE_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+#endif //#if (defined __cplusplus)
+
+#if M_MIL_USE_SAFE_TYPE
+
+inline void SafeTypeError(MIL_CONST_TEXT_PTR FunctionName,
+                          MIL_CONST_TEXT_PTR Message = M_NULL);
+
+// Definition of the error function called at each error of bad type
+// of data passed to a void* argument.
+//
+// Application can define their own SafeTypeError function and
+// disable this one by adding #define M_MIL_SAFE_TYPE_ERROR_DEFINED 1
+// before including mil.h.
+
+#if !M_MIL_SAFE_TYPE_ERROR_DEFINED
+#define M_MIL_SAFE_TYPE_ERROR_DEFINED 1
+
+#ifndef M_MIL_USE_SAFE_TYPE_COMPILE_ERROR_ONLY
+inline void SafeTypeError(MIL_CONST_TEXT_PTR FunctionName,
+                          MIL_CONST_TEXT_PTR Message)
+   {
+   MfuncPrintMessage(
+      M_RESP_OK | M_ST_ERROR_TITLE,
+      MIL_TEXT("SafeType error in "), 
+      FunctionName,
+      MIL_TEXT(".\n"),
+      Message ? Message : MIL_TEXT("Pointer type is wrong."),
+      MIL_TEXT("\n\n\n"));
+   }
+#else
+inline void SafeTypeError(MIL_CONST_TEXT_PTR FunctionName,
+                          MIL_CONST_TEXT_PTR Message)
+   {
+   }
+#endif
+
+#endif
+
+inline void ReplaceTypeMilIdByTypeMilIntXX(MIL_INT64 *DataType)
+   {
+#if defined(M_MIL_USE_INT64_ID) && M_MIL_USE_INT64_ID
+   if(*DataType == M_TYPE_MIL_ID)
+      *DataType = M_TYPE_MIL_INT64;
+#else
+   if(*DataType == M_TYPE_MIL_ID)
+      *DataType = M_TYPE_MIL_INT32;
+#endif
+   }
+#endif //end M_MIL_USE_SAFE_TYPE
+
+
+// M_MIL_USE_SAFE_TYPE defined in milos.h.
+#if M_MIL_USE_SAFE_TYPE
+
+// ----------------------------------------------------------
+// MappGetError
+
+inline MIL_INT MFTYPE MappGetErrorUnsafe  (MIL_INT64 ErrorType, void           *ErrorPtr);
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, int             ErrorPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_TEXT_CHAR  *ErrorPtr);
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_INT        *ErrorPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_UINT       *ErrorPtr);
+#endif
+inline MIL_INT MFTYPE MappGetErrorUnsafe  (MIL_ID ContextAppId, MIL_INT64 ErrorType, void           *ErrorPtr);
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, int             ErrorPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_TEXT_CHAR  *ErrorPtr);
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_INT        *ErrorPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_UINT       *ErrorPtr);
+#endif
+
+//---------------------------------------------------------------------------------
+// MappGetHookInfo
+inline MIL_INT MFTYPE MappGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void               *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int                 ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT8           *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT16          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, void              **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, const void        **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_ID            **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, const MIL_ID      **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR       *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_CONST_TEXT_PTR *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT8          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT16         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT32         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT64         *ResultPtr);
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, wchar_t            *ResultPtr);
+#endif
+inline MIL_INT MFTYPE MappGetHookInfoUnsafe  (MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void               *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, int                 ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT8           *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT16          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void              **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, const void        **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_ID            **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, const MIL_ID      **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR       *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_CONST_TEXT_PTR *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT8          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT16         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT32         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT64         *ResultPtr);
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, wchar_t            *ResultPtr);
+#endif
+
+//---------------------------------------------------------------
+// MappInquire
+inline MIL_INT MFTYPE MappInquireUnsafe  (MIL_INT64 InquireType, void           *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, int             UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_INT        *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr);
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_INT64      *UserVarPtr);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_UINT        *UserVarPtr);
+#endif
+inline MIL_INT MFTYPE MappInquireUnsafe  (MIL_ID ContextAppId, MIL_INT64 InquireType, void           *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, int             UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT        *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr);
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64      *UserVarPtr);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_UINT        *UserVarPtr);
+#endif
+
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MappFileOperationUnsafeA(    MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                void*              OperationDataPtr);
+inline void MFTYPE MappFileOperationUnsafeW(    MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                void*              OperationDataPtr);
+
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID             Comp1ContextAppId,
+                                                int                Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                MIL_INT*           OperationDataPtr);
+
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID             Comp1ContextAppId,
+                                                int                Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                MIL_INT*           OperationDataPtr);
+
+#if M_MIL_UNICODE_API
+#define MappFileOperationSafeType   MappFileOperationSafeTypeW
+#else
+#define MappFileOperationSafeType   MappFileOperationSafeTypeA
+#endif
+
+
+#else
+inline void MFTYPE MappFileOperationUnsafe(     MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                void*              OperationDataPtr);
+
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID             Comp1ContextAppId,
+                                                int                Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                MIL_INT*           OperationDataPtr);
+#endif
+
+// ----------------------------------------------------------
+// MbufDiskInquire
+
+#if M_MIL_USE_UNICODE
+inline MIL_INT MFTYPE MbufDiskInquireUnsafeA  (MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, int          UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireUnsafeW  (MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, int          UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr);
+#endif
+
+#if M_MIL_UNICODE_API
+#define MbufDiskInquireSafeType MbufDiskInquireSafeTypeW
+#else
+#define MbufDiskInquireSafeType MbufDiskInquireSafeTypeA
+#endif
+
+#else
+inline MIL_INT MFTYPE MbufDiskInquireUnsafe   (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, int          UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, std::nullptr_t         ); 
+#endif
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr);
+#endif
+#endif
+
+// ----------------------------------------------------------
+// MbufGetHookInfo
+
+inline MIL_INT MFTYPE MbufGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *ResultPtr);
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int              ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t            ); 
+#endif
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *ResultPtr);
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *ResultPtr);
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64       *ResultPtr);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT        *ResultPtr);
+#endif
+
+
+// ----------------------------------------------------------
+// MbufInquireContainer
+inline MIL_INT MFTYPE MbufInquireContainerUnsafe  (MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, int              UserVarPtr);
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT8       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT32       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT64       *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MbufInquire
+
+inline MIL_INT MFTYPE MbufInquireUnsafe  (MIL_ID BufId, MIL_INT64 InquireType,       void            *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       int              ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT32       *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT64       *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_DOUBLE      *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_TEXT_CHAR   *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       char           **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const char           **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       signed char    **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const signed char    **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       unsigned char  **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const unsigned char  **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT16      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT16      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT16     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT16     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT32      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT32      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT32     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT32     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       float          **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const float          **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT64      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT64      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT64     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT64     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_DOUBLE     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_DOUBLE     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       void           **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const void           **ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT32      *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT64      *ResultPtr);
+#endif
+
+#if M_MIL_USE_WINDOWS
+#if M_MIL_USE_DIRECTX_SERVICE
+struct IDirectDrawSurface;
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, IDirectDrawSurface   **ResultPtr);
+#endif // M_MIL_USE_DIRECTX_SERVICE
+struct tagBITMAPINFO;
+typedef tagBITMAPINFO BITMAPINFO;
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, BITMAPINFO           **ResultPtr);
+#endif // M_MIL_USE_WINDOWS
+
+// MbufInquireFeature
+
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MbufInquireFeatureUnsafeW  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MbufInquireFeatureUnsafeA  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+#endif
+
+
+#if M_MIL_UNICODE_API
+#define MbufInquireFeatureSafeType  MbufInquireFeatureSafeTypeW
+#else
+#define MbufInquireFeatureSafeType  MbufInquireFeatureSafeTypeA
+#endif
+
+#else
+
+inline void MFTYPE MbufInquireFeatureUnsafe  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void             *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64        *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32        *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool             *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64       *UserVarPtr);
+#endif
+#endif
+
+// ----------------------------------------------------------
+// MbufInquireContainer
+inline MIL_INT MFTYPE MbufInquireContainerUnsafe  (MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, int              UserVarPtr);
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT8       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT32       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT64       *UserVarPtr);
+#endif
+
+///////
+
+// ----------------------------------------------------------
+
+// MbufControlFeature
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MbufControlFeatureUnsafeW  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MbufControlFeatureUnsafeA  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MbufControlFeatureUnsafe  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t               ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr);
+#endif
+#endif
+
+// ----------------------------------------------------------
+// MdigGetHookInfo
+
+inline MIL_INT MFTYPE MdigGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void           *ResultPtr);
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int             ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32      *ResultPtr);
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64      *ResultPtr);
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE     *ResultPtr);
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR    ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT       *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+
+// MdigInquire
+
+inline MIL_INT MFTYPE MdigInquireUnsafe  (MIL_ID DigId, MIL_INT64 InquireType, void           *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, int             ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_TEXT_CHAR  *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_INT32      *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_INT64      *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_DOUBLE     *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_ID         *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_UINT32     *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_UINT64     *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+
+// MdigInquireFeature
+
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MdigInquireFeatureUnsafeW  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTW_PTR    UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MdigInquireFeatureUnsafeA  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTA_PTR    UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MdigInquireFeatureUnsafe  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void             *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64        *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32        *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool             *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64       *UserVarPtr);
+#endif
+
+#endif
+
+// ----------------------------------------------------------
+
+// MdigControlFeature
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MdigControlFeatureUnsafeW  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTW_PTR    UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MdigControlFeatureUnsafeA  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTA_PTR    UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MdigControlFeatureUnsafe  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr);
+#endif
+#endif
+// ----------------------------------------------------------
+// MfpgaGetHookInfo
+
+inline MIL_INT MFTYPE MfpgaGetHookInfoUnsafe  (MIL_ID  EventId, MIL_INT64 InfoType, void             *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_INT32        *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_INT64        *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_DOUBLE       *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_UINT32       *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_UINT64       *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MfpgaInquire
+
+inline MIL_INT MFTYPE MfpgaInquireUnsafe  (MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, void             *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_INT32        *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_INT64        *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_TEXT_CHAR    *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_UINT32       *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_UINT64       *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MfuncInquire
+
+inline MIL_INT MFTYPE MfuncInquireUnsafe  (MIL_ID ObjectId, MIL_INT64 InquireType, void         *UserVarPtr);
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, int           UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_INT32    *UserVarPtr);
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_INT64    *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_UINT64   *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MgraInquire
+
+inline MIL_INT MFTYPE MgraInquireUnsafe  (MIL_ID ContextGraId, MIL_INT64 InquireType, void         *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, int           UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT8     *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT16    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT32    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT64    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, float        *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_DOUBLE   *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT8    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT16   *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT32   *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT64   *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MgraInquireList
+
+inline MIL_INT MFTYPE MgraInquireListUnsafe  (MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, void         *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, int           UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT8     *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT16    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT32    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT64    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, float        *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_DOUBLE   *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT8    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT16   *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT32   *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT64   *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MsysGetHookInfo
+
+inline MIL_INT MFTYPE MsysGetHookInfoUnsafe  (MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, void            *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, int              ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_INT32       *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_INT64       *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_DOUBLE      *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_TEXT_PTR     ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_UINT32      *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_UINT64      *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+// MsysInquire
+
+inline MIL_INT MFTYPE MsysInquireUnsafe  (MIL_ID SysId, MIL_INT64 InquireType, void            *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, int              ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_INT32       *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_INT64       *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_TEXT_CHAR   *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_DOUBLE      *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_UINT32      *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_UINT64      *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+// MsysInquireFeature
+
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MsysInquireFeatureUnsafeW  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MsysInquireFeatureUnsafeA  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MsysInquireFeatureUnsafe  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void             *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64        *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32        *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool             *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64       *UserVarPtr);
+#endif
+
+#endif
+
+
+// ----------------------------------------------------------
+
+// MsysControlFeature
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MsysControlFeatureUnsafeW  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MsysControlFeatureUnsafeA  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MsysControlFeatureUnsafe  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr);
+#endif
+#endif
+
+// ----------------------------------------------------------
+// MsysIoInquire
+
+inline MIL_INT MFTYPE MsysIoInquireUnsafe  (MIL_ID IoObjectId, MIL_INT64 InquireType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MsysIoCommandRegister
+inline MIL_INT MFTYPE MsysIoCommandRegisterUnsafe  (MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, void*    CommandStatusPtr);
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, int      CommandStatusPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, MIL_INT* CommandStatusPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, MIL_UINT* CommandStatusPtr);
+#endif
+
+//--------------------------------------------------------------------
+// MthrInquire
+
+inline MIL_INT MFTYPE MthrInquireUnsafe  (MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, void      *UserVarPtr);
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, int        UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, MIL_INT   *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, MIL_UINT  *UserVarPtr);
+#endif
+
+//--------------------------------------------------------------------
+// MseqGetHookInfo
+inline MIL_INT MFTYPE MseqGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int             *UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT        *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MseqInquire
+
+inline MIL_INT MFTYPE MseqInquireUnsafe  (MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MappInquireMp
+
+inline MIL_INT MFTYPE MappInquireMpUnsafe  (MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void       *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int         UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT32  *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64  *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT32 *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MthrInquireMp
+
+inline MIL_INT MFTYPE MthrInquireMpUnsafe  (MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void       *ResultPtr);
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int         ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT32  *ResultPtr);
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64  *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT32 *ResultPtr);
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+// MappControlMp
+
+inline void MFTYPE MappControlMpUnsafe  (MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void          *ValuePtr);
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int            ValuePtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t);
+#endif
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64     *ValuePtr);
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_TEXT_PTR   ValuePtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64    *ValuePtr);
+#endif
+
+// ----------------------------------------------------------
+// MthrControlMp
+
+inline void MFTYPE MthrControlMpUnsafe  (MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void       *ValuePtr);
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int         ValuePtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t);
+#endif
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64  *ValuePtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ValuePtr);
+#endif
+
+// -------------------------------------------------------------------------
+// MappGetError
+
+inline MIL_INT64 MappGetErrorRequiredType(MIL_INT64 ErrorType)
+   {
+   if ((ErrorType & M_STRING_SIZE) == M_STRING_SIZE)
+      return M_TYPE_MIL_INT;
+
+   if (((M_STRIP_CLIENT_TEXT_ENCODING(ErrorType)) & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE)))
+      return M_TYPE_TEXT_CHAR;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, int ErrorPtr)
+   {
+   if (ErrorPtr || (((M_STRIP_CLIENT_TEXT_ENCODING(ErrorType)) & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE))))
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ErrorType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, std::nullptr_t) 
+   { 
+   if(((M_STRIP_CLIENT_TEXT_ENCODING(ErrorType)) & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE)))
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ErrorType, NULL); 
+   }
+#endif
+
+inline MIL_INT MFTYPE MappGetErrorSafeTypeExecute (MIL_INT64 ErrorType, void *ErrorPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappGetErrorRequiredType(ErrorType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ErrorType, ErrorPtr);
+   }
+
+inline MIL_INT MFTYPE MappGetErrorUnsafe  (MIL_INT64 ErrorType, void           *ErrorPtr) {return MappGetError               (ErrorType, ErrorPtr                  );}
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_TEXT_CHAR  *ErrorPtr) {return MappGetErrorSafeTypeExecute(ErrorType, ErrorPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_INT        *ErrorPtr) {return MappGetErrorSafeTypeExecute(ErrorType, ErrorPtr, M_TYPE_MIL_INT  );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_UINT       *ErrorPtr) {return MappGetErrorSafeTypeExecute(ErrorType, ErrorPtr, M_TYPE_MIL_INT);}
+#endif
+
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, int ErrorPtr)
+   {
+   if (ErrorPtr || ((ErrorType & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE))))
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ContextAppId, ErrorType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, std::nullptr_t)
+   {
+   if((ErrorType & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE)))
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ContextAppId, ErrorType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappGetErrorSafeTypeExecute (MIL_ID ContextAppId, MIL_INT64 ErrorType, void  *ErrorPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappGetErrorRequiredType(ErrorType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ContextAppId, ErrorType, ErrorPtr);
+   }
+
+inline MIL_INT MFTYPE MappGetErrorUnsafe  (MIL_ID ContextAppId, MIL_INT64 ErrorType, void           *ErrorPtr) {return MappGetError               (ContextAppId, ErrorType, ErrorPtr                  );}
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_TEXT_CHAR  *ErrorPtr) {return MappGetErrorSafeTypeExecute(ContextAppId, ErrorType, ErrorPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_INT        *ErrorPtr) {return MappGetErrorSafeTypeExecute(ContextAppId, ErrorType, ErrorPtr, M_TYPE_MIL_INT  );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_UINT       *ErrorPtr) {return MappGetErrorSafeTypeExecute(ContextAppId, ErrorType, ErrorPtr, M_TYPE_MIL_INT);}
+#endif
+
+// ----------------------------------------------------------
+// MappGetHookInfo
+
+
+inline MIL_INT64 MappGetHookInfoRequiredType(MIL_ID EventId, MIL_INT64 InfoType)
+   {
+   if((InfoType & M_STRING_SIZE) == M_STRING_SIZE)
+      {
+      return M_TYPE_MIL_INT;
+      }
+
+   if (((M_STRIP_CLIENT_TEXT_ENCODING(InfoType)) & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE)))
+      return M_TYPE_TEXT_CHAR;
+
+   if((InfoType & M_PARAM_VALUE) == M_PARAM_VALUE)
+      {
+      MIL_INT64 InquireParamType = ((InfoType & ~M_PARAM_VALUE) + M_EXTENDED_PARAM_TYPE);
+      MIL_INT64 ParamType;
+      MappGetHookInfo(EventId, InquireParamType, &ParamType);
+      if (ParamType == M_TYPE_ARRAY_ID_PTR || ParamType == M_TYPE_PTR || ParamType == M_TYPE_FILENAME || ParamType == M_TYPE_STRING )
+         ParamType = M_SAFE_TYPE_CHECK_PTR;
+      return ParamType;
+      }
+   
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappGetHookInfoRequiredType(EventId, InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"));
+
+   return MappGetHookInfo(EventId, InfoType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"));
+
+   return MappGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MappGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *ResultPtr) {return MappGetHookInfo               (EventId, InfoType, ResultPtr)                    ;}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT8        *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_CHAR       );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT16       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_SHORT      );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_DOUBLE     );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, void           **ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, const void     **ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_ID         **ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, const MIL_ID   **ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR    *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_CONST_TEXT_PTR *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT8       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_CHAR       );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT16      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_SHORT      );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT32      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT64      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64  );}
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, wchar_t         *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_TEXT   );}
+#endif
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeTypeExecute(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappGetHookInfoRequiredType(EventId, InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"));
+
+   return MappGetHookInfo(ContextAppId, EventId, InfoType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"));
+
+   return MappGetHookInfo(ContextAppId, EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MappGetHookInfo(ContextAppId, EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappGetHookInfoUnsafe  (MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void            *ResultPtr) {return MappGetHookInfo               (ContextAppId, EventId, InfoType, ResultPtr)                    ;}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT8        *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_CHAR       );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT16       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_SHORT      );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_DOUBLE     );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void           **ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, const void     **ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_ID         **ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, const MIL_ID   **ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR    *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_CONST_TEXT_PTR *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT8       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_CHAR       );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT16      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_SHORT      );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT32      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT64      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64  );}
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, wchar_t         *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_TEXT   );}
+#endif
+
+//-----------------------------------------------------------------------------
+// MappInquire
+
+inline MIL_INT64 MappInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_APP_INQUIRE_STRING_RANGE(InquireType))
+      {
+      return M_TYPE_TEXT_CHAR;
+      }
+
+
+   if(M_IN_APP_INQUIRE_DOUBLE_RANGE(InquireType))
+      {
+      return M_TYPE_DOUBLE;
+      }
+
+   if(M_IN_APP_INQUIRE_MIL_ID_RANGE(InquireType))
+      {
+      return M_TYPE_MIL_ID;
+      }
+
+   if(M_IN_APP_INQUIRE_MIL_INT64_RANGE(InquireType))
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MappInquire"));
+
+   return MappInquire(InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, std::nullptr_t            ) {return MappInquire               (InquireType, NULL);}
+#endif
+
+inline MIL_INT MFTYPE MappInquireSafeTypeExecute (MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappInquire"));
+
+   return MappInquire(InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MappInquireUnsafe  (MIL_INT64 InquireType, void           *UserVarPtr) {return MappInquire               (InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_INT        *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_INT64      *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_UINT       *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MappInquire"));
+
+   return MappInquire(ContextAppId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MappInquire(ContextAppId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappInquireSafeTypeExecute(MIL_ID ContextAppId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappInquire"));
+
+   return MappInquire(ContextAppId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MappInquireUnsafe  (MIL_ID ContextAppId, MIL_INT64 InquireType, void           *UserVarPtr) {return MappInquire               (ContextAppId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT        *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64      *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_UINT       *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+
+#if M_MIL_USE_UNICODE
+// ----------------------------------------------------------
+// MappFileOperation
+inline void MFTYPE MappFileOperationUnsafeA(    MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                void*                   OperationDataPtr)
+   {
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationUnsafeW(    MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                void*                   OperationDataPtr)
+   {
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappFileOperationSafeTypeW(MIL_ID                  Comp1ContextAppId,
+                                              MIL_CONST_TEXTW_PTR     Comp1FileName,
+                                              MIL_ID                  Comp2ContextAppId,
+                                              MIL_CONST_TEXTW_PTR     Comp2FileName,
+                                              MIL_INT64               Operation,
+                                              MIL_INT64               OperationFlag,
+                                              std::nullptr_t          )
+   {
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(MIL_ID                 Comp1ContextAppId,
+                                              MIL_CONST_TEXTW_PTR    Comp1FileName,
+                                              MIL_ID                 Comp2ContextAppId,
+                                              int                    Comp2FileName,
+                                              MIL_INT64              Operation,
+                                              MIL_INT64              OperationFlag,
+                                              std::nullptr_t)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+
+#endif
+
+
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID                  Comp1ContextAppId,
+                                                int                     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp1FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, NULL, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID                 Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR    Comp1FileName,
+                                                MIL_ID                 Comp2ContextAppId,
+                                                int                    Comp2FileName,
+                                                MIL_INT64              Operation,
+                                                MIL_INT64              OperationFlag,
+                                                int                    OperationDataPtr)
+   {
+   if (Comp2FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID                     Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR        Comp1FileName,
+                                                MIL_ID                     Comp2ContextAppId,
+                                                int                        Comp2FileName,
+                                                MIL_INT64                  Operation,
+                                                MIL_INT64                  OperationFlag,
+                                                MIL_INT*                   OperationDataPtr)
+   {
+   if(Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(MIL_ID                     Comp1ContextAppId,
+                                              MIL_CONST_TEXTW_PTR        Comp1FileName,
+                                              MIL_ID                     Comp2ContextAppId,
+                                              int                        Comp2FileName,
+                                              MIL_INT64                  Operation,
+                                              MIL_INT64                  OperationFlag,
+                                              MIL_TEXT_PTR               OperationDataPtr)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID                  Comp1ContextAppId,
+                                                int                     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp1FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, NULL, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappFileOperationSafeTypeA(MIL_ID                  Comp1ContextAppId,
+                                              MIL_CONST_TEXTA_PTR     Comp1FileName,
+                                              MIL_ID                  Comp2ContextAppId,
+                                              MIL_CONST_TEXTA_PTR     Comp2FileName,
+                                              MIL_INT64               Operation,
+                                              MIL_INT64               OperationFlag,
+                                              std::nullptr_t          )
+   {
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeA(MIL_ID                 Comp1ContextAppId,
+                                              MIL_CONST_TEXTA_PTR    Comp1FileName,
+                                              MIL_ID                 Comp2ContextAppId,
+                                              int                    Comp2FileName,
+                                              MIL_INT64              Operation,
+                                              MIL_INT64              OperationFlag,
+                                              std::nullptr_t)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+
+#endif
+
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                int                     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp2FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID                     Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR        Comp1FileName,
+                                                MIL_ID                     Comp2ContextAppId,
+                                                int                        Comp2FileName,
+                                                MIL_INT64                  Operation,
+                                                MIL_INT64                  OperationFlag,
+                                                MIL_INT*                   OperationDataPtr)
+   {
+   if(Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperationSafeTypeA(MIL_ID                     Comp1ContextAppId,
+                                              MIL_CONST_TEXTA_PTR        Comp1FileName,
+                                              MIL_ID                     Comp2ContextAppId,
+                                              int                        Comp2FileName,
+                                              MIL_INT64                  Operation,
+                                              MIL_INT64                  OperationFlag,
+                                              MIL_TEXT_PTR               OperationDataPtr)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+
+
+#if M_MIL_UNICODE_API
+#define MappFileOperationUnsafe      MappFileOperationUnsafeW
+#else
+#define MappFileOperationUnsafe      MappFileOperationUnsafeA
+#endif
+#else
+
+inline void MFTYPE MappFileOperationUnsafe(     MIL_ID                  Comp1ContextAppId,
+                                                const char*             Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                const char*             Comp2FileName, 
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                void*                   OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID                  Comp1ContextAppId,
+                                                const char*             Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                const char*             Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                  Comp1ContextAppId,
+                                             const char*             Comp1FileName,
+                                             MIL_ID                  Comp2ContextAppId,
+                                             const char*             Comp2FileName,
+                                             MIL_INT64               Operation,
+                                             MIL_INT64               OperationFlag,
+                                             std::nullptr_t          )
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                 Comp1ContextAppId,
+                                             const char*            Comp1FileName,
+                                             MIL_ID                 Comp2ContextAppId,
+                                             int                    Comp2FileName,
+                                             MIL_INT64              Operation,
+                                             MIL_INT64              OperationFlag,
+                                             std::nullptr_t)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+
+#endif
+
+
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID                  Comp1ContextAppId,
+                                                int                     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                const char*             Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp1FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, NULL, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeType(  MIL_ID                  Comp1ContextAppId,
+                                                const char*             Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                int                     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp2FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID                     Comp1ContextAppId,
+                                                const char*                Comp1FileName,
+                                                MIL_ID                     Comp2ContextAppId,
+                                                int                        Comp2FileName,
+                                                MIL_INT64                  Operation,
+                                                MIL_INT64                  OperationFlag,
+                                                MIL_INT*                   OperationDataPtr)
+   {
+   if(Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                     Comp1ContextAppId,
+                                             const char*                Comp1FileName,
+                                             MIL_ID                     Comp2ContextAppId,
+                                             int                        Comp2FileName,
+                                             MIL_INT64                  Operation,
+                                             MIL_INT64                  OperationFlag,
+                                             MIL_TEXT_PTR               OperationDataPtr)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MappInquireConnection
+inline MIL_INT64 MappInquireConnectionRequiredType(MIL_INT64 InquireType)
+   {
+   if ((InquireType == M_DMIL_PUBLISHED_LIST) ||
+       (InquireType == M_DMIL_PUBLISHED_NAME) ||
+       ((InquireType >= M_WEB_PUBLISHED_LIST) && (InquireType < (M_WEB_PUBLISHED_LIST + M_MAX_WEBSOCKET_SERVER))) ||
+       ((InquireType >= M_WEB_PUBLISHED_NAME) && (InquireType < (M_WEB_PUBLISHED_NAME + M_MAX_WEBSOCKET_SERVER))))
+      return M_TYPE_MIL_ID;
+   else if ((InquireType == M_DMIL_PUBLISHED_LIST_SIZE) ||
+            ((InquireType >= M_WEB_PUBLISHED_LIST_SIZE) && (InquireType < (M_WEB_PUBLISHED_LIST_SIZE + M_MAX_WEBSOCKET_SERVER))))
+      return M_TYPE_MIL_INT64;
+   else
+      {
+      SafeTypeError(MIL_TEXT("MappInquireConnectionSafeType"));
+      return M_NULL;
+      }
+   }
+
+inline MIL_INT MappInquireConnectionSafeTypeExecute(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void * UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappInquireConnectionRequiredType(InquireType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+   
+   if (RequiredType != GivenType) 
+      {
+      SafeTypeError(MIL_TEXT("MappInquireConnectionSafeType"));
+      }
+      
+   return MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr);
+   }
+
+//declare functions
+inline MIL_INT MFTYPE MappInquireConnectionUnsafe  (MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void             *UserVarPtr)  {return MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr);}
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, MIL_INT32        *UserVarPtr)  { return MappInquireConnectionSafeTypeExecute(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr, M_TYPE_MIL_INT32); }
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, MIL_INT64        *UserVarPtr)  { return MappInquireConnectionSafeTypeExecute(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr, M_TYPE_MIL_INT64); }
+#if !M_MIL_USE_LINUX
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, int              *UserVarPtr)  { return MappInquireConnectionSafeTypeExecute(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr, M_TYPE_MIL_INT32); }
+#endif
+
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MappInquireConnectionSafeType"));
+
+   return MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, std::nullptr_t              ) { return MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, NULL); }
+#endif
+
+
+// ----------------------------------------------------------
+// MbufDiskInquire
+
+inline MIL_INT64 MbufDiskInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (
+      InquireType == M_ASPECT_RATIO ||
+      InquireType == M_FRAME_RATE
+      )
+      return M_TYPE_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+
+#if M_MIL_USE_UNICODE
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireA"));
+
+   return MbufDiskInquireA(FileName, InquireType, NULL);
+   }
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireW"));
+
+   return MbufDiskInquireW(FileName, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MbufDiskInquireA(FileName, InquireType, NULL);
+   }
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MbufDiskInquireW(FileName, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeAExecute(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, void     *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufDiskInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireSafeTypeA"));
+
+   return MbufDiskInquireA(FileName, InquireType, UserVarPtr);;
+   }
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeWExecute(MIL_CONST_TEXTW_PTR     FileName, MIL_INT64 InquireType, void     *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufDiskInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireSafeTypeW"));
+
+   return MbufDiskInquireW(FileName, InquireType, UserVarPtr);;
+   }
+
+inline MIL_INT MFTYPE MbufDiskInquireUnsafeA  (MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr) {return MbufDiskInquireA(FileName, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr) {return MbufDiskInquireSafeTypeAExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) {return MbufDiskInquireSafeTypeAExecute(FileName, InquireType, UserVarPtr, M_TYPE_DOUBLE );}
+
+inline MIL_INT MFTYPE MbufDiskInquireUnsafeW  (MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr) {return MbufDiskInquireW(FileName, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr) {return MbufDiskInquireSafeTypeWExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) {return MbufDiskInquireSafeTypeWExecute(FileName, InquireType, UserVarPtr, M_TYPE_DOUBLE );}
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr) {return MbufDiskInquireSafeTypeAExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr) {return MbufDiskInquireSafeTypeWExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+#endif
+
+#if M_MIL_UNICODE_API
+#define MbufDiskInquireUnsafe             MbufDiskInquireUnsafeW
+#define MbufDiskInquireSafeTypeExecute    MbufDiskInquireSafeTypeWExecute
+#define MbufDiskInquireSafeType           MbufDiskInquireSafeTypeW
+#else
+#define MbufDiskInquireUnsafe             MbufDiskInquireUnsafeA
+#define MbufDiskInquireSafeTypeExecute    MbufDiskInquireSafeTypeAExecute
+#define MbufDiskInquireSafeType           MbufDiskInquireSafeTypeA
+#endif
+
+#else
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr != M_NULL)
+      SafeTypeError(MIL_TEXT("MbufDiskInquire"));
+
+   return MbufDiskInquire(FileName, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MbufDiskInquire(FileName, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeExecute(MIL_CONST_TEXT_PTR     FileName, MIL_INT64 InquireType, void     *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufDiskInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireSafeType"));
+
+   return MbufDiskInquire(FileName, InquireType, UserVarPtr);;
+   }
+inline MIL_INT MFTYPE MbufDiskInquireUnsafe  (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr) {return MbufDiskInquire(FileName, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr) {return MbufDiskInquireSafeTypeExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) {return MbufDiskInquireSafeTypeExecute(FileName, InquireType, UserVarPtr, M_TYPE_DOUBLE );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr) {return MbufDiskInquireSafeTypeExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+#endif
+
+#endif
+// ----------------------------------------------------------
+// MbufGetHookInfo
+
+
+inline MIL_INT64 MbufGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   switch (InfoType)
+      {
+      case M_MODIFIED_BUFFER+M_BUFFER_ID:
+         return M_TYPE_MIL_ID;
+         break;
+
+      case M_MODIFIED_BUFFER+M_GRAB_TIME_STAMP:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER1:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER2:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER3:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER4:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER5:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER6:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER7:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER8:
+
+        return M_TYPE_DOUBLE;
+        break;
+#if !M_MIL_USE_64BIT
+      case M_USER_DATA_SIZE:
+      case M_FORMAT:
+         return M_TYPE_MIL_INT64;
+         break;
+#endif
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MbufGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufGetHookInfoRequiredType(InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufGetHookInfo"));
+
+   return MbufGetHookInfo(EventId, InfoType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MbufGetHookInfo"));
+
+   return MbufGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MbufGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *ResultPtr) {return MbufGetHookInfo               (EventId, InfoType, ResultPtr)                  ;}
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *ResultPtr) {return MbufGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *ResultPtr) {return MbufGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_DOUBLE   );}
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64       *ResultPtr) { return MbufGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64); }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT        *ResultPtr) {return MbufGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT  );}
+#endif
+
+
+// ----------------------------------------------------------
+// MbufInquireContainer
+inline MIL_INT64 MbufInquireContainerRequiredType(MIL_INT64 InquireType)
+   {
+   if(M_IN_BUF_INQUIRE_PTR_RANGE(InquireType))
+      return M_SAFE_TYPE_CHECK_PTR;
+
+   if(M_IN_BUF_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if(M_IN_BUF_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if(M_IN_BUF_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_DOUBLE;
+
+   if(M_IN_BUF_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if(UserVarPtr || M_BUF_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MbufInquireContainer"));
+
+   return MbufInquireContainer(ContainerBufId, Component, InquireType, M_NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_BUF_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MbufInquireContainer"));
+
+   return MbufInquireContainer(ContainerBufId, Component, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufInquireContainerSafeTypeExecute(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, void *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufInquireContainerRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if(RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquireContainer"));
+
+   return MbufInquireContainer(ContainerBufId, Component, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MbufInquireContainerUnsafe  (MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, void *UserVarPtr)            { return MbufInquireContainer(ContainerBufId, Component, InquireType, UserVarPtr); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_TEXT_CHAR *UserVarPtr)   { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);  }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_DOUBLE); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT8       *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_UINT8); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+#endif
+
+// ----------------------------------------------------------
+// MbufInquire
+
+
+inline MIL_INT64 MbufInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if(M_IN_BUF_INQUIRE_PTR_RANGE(InquireType))
+      return M_SAFE_TYPE_CHECK_PTR;
+
+   if (M_IN_BUF_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_BUF_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_BUF_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_DOUBLE;
+
+   if (M_IN_BUF_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, int ResultPtr)
+   {
+   if (ResultPtr || M_BUF_INQUIRE_MUST_HAVE_USER_PTR(InquireType))  
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquire(BufId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_BUF_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquire(BufId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufInquireSafeTypeExecute (MIL_ID BufId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquire(BufId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MbufInquireUnsafe  (MIL_ID BufId, MIL_INT64 InquireType,       void            *ResultPtr) {return MbufInquire               (BufId, InquireType, ResultPtr);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT32       *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT64       *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_DOUBLE      *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_DOUBLE   );}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_TEXT_CHAR   *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       char           **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const char           **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       signed char    **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const signed char    **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       unsigned char  **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const unsigned char  **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT16      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT16      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT16     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT16     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT32      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT32      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT32     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT32     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       float          **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const float          **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT64      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT64      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT64     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT64     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_DOUBLE     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_DOUBLE     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       void           **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const void           **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT32      *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT64      *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#ifdef __MILBUFFERINFO_H__
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MilBufferInfo **ResultPtr)
+   {
+   if (InquireType != M_BUFFER_INFO)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquireUnsafe(BufId, InquireType, ResultPtr);
+   }
+
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MilBufferInfo **ResultPtr)
+   {
+   if (InquireType != M_BUFFER_INFO)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquireUnsafe(BufId, InquireType, ResultPtr);
+   }
+#endif
+
+#if M_MIL_USE_WINDOWS
+#if M_MIL_USE_DIRECTX_SERVICE
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, IDirectDrawSurface   **ResultPtr)
+   {
+   if (InquireType != M_DDRAW_SURFACE)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquireUnsafe(BufId, InquireType, ResultPtr);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, BITMAPINFO           **ResultPtr)
+   {
+   if (InquireType != M_BITMAPINFO)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquireUnsafe(BufId, InquireType, ResultPtr);
+   }
+#endif
+
+inline MIL_INT64 InquireFeatureRequiredType(MIL_INT64 InquireType, MIL_INT64 UserVarType)
+   {
+   MIL_INT64 Type = 0;
+
+   if((M_GET_INTERMOD_VALUE_BITS(InquireType) == M_STRING_SIZE) || (InquireType & M_FEATURE_SIZE))
+      Type = M_TYPE_MIL_INT;
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+   else if(InquireType & M_LENGTH)
+      {
+      if(UserVarType == M_TYPE_REGISTER)
+         Type = M_TYPE_INT64;
+      else
+         Type = M_TYPE_MIL_INT;
+      }
+#endif
+   else
+      {
+      switch (M_FEATURE_OP(InquireType))
+         {
+         case M_FEATURE_PRESENT:
+         case M_FEATURE_EXECUTE_COMPLETED:
+            Type = M_TYPE_MIL_INT32;
+            break;
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION && OldDefinesSupport)
+         case M_FEATURE_VALUE_AS_STRING_INTERNAL:
+#endif
+         case M_FEATURE_NAME:
+         case M_FEATURE_DISPLAY_NAME:
+         case M_FEATURE_TOOLTIP:
+         case M_FEATURE_DESCRIPTION:
+         case M_FEATURE_UNIT:
+            Type = M_TYPE_TEXT_CHAR;
+            break;
+         case M_FEATURE_TYPE:
+         case M_FEATURE_ACCESS_MODE:
+         case M_FEATURE_VISIBILITY:
+         case M_FEATURE_CACHING_MODE:
+         case M_FEATURE_STREAMABLE:
+         case M_FEATURE_DEPRECATED:
+         case M_FEATURE_REPRESENTATION:
+         case M_FEATURE_POLLING_INTERVAL:
+            Type = M_TYPE_INT64;
+            break;
+         case M_GC_NODE_COUNT:
+         case M_FEATURE_CHANGE_HOOK:
+            Type = M_TYPE_MIL_INT;
+            break;
+         case M_FEATURE_MIN:
+         case M_FEATURE_MAX:
+         case M_FEATURE_INCREMENT:
+            {
+            if (UserVarType == M_TYPE_DOUBLE)
+               Type = M_TYPE_DOUBLE;
+            else if (UserVarType == M_TYPE_MIL_INT32)
+               Type = M_TYPE_MIL_INT32;
+            else
+               Type = M_TYPE_INT64;
+            }
+            break;
+         default:
+            {
+            if (M_FEATURE_ENUM(InquireType) == M_GC_NODES)
+               {
+               if ((InquireType & (~M_SUBFEATURE_INDEX_MASK)) == M_SUBFEATURE_COUNT)
+                  Type = M_TYPE_MIL_INT;
+               else if ((InquireType & (~M_SUBFEATURE_INDEX_MASK)) == M_SUBFEATURE_NAME)
+                  Type = M_TYPE_TEXT_CHAR;
+               else if ((InquireType & (~M_SUBFEATURE_INDEX_MASK)) == (M_SUBFEATURE_NAME + M_STRING_SIZE))
+                  Type = M_TYPE_MIL_INT;
+               else if ((InquireType & (~M_SUBFEATURE_INDEX_MASK)) == M_SUBFEATURE_TYPE)
+                  Type = M_TYPE_INT64;
+               }
+            else if (M_FEATURE_ENUM(InquireType) == M_FEATURE_ENUM_ENTRY)
+               {
+               if ((InquireType & (~M_FEATURE_ENUM_ENTRY_INDEX_MASK)) == M_FEATURE_ENUM_ENTRY_COUNT)
+                  Type = M_TYPE_MIL_INT;
+               else if ((InquireType & (~M_FEATURE_ENUM_ENTRY_INDEX_MASK)) == M_FEATURE_ENUM_ENTRY_NAME)
+                  Type = M_TYPE_TEXT_CHAR;
+               else if ((InquireType & (~M_FEATURE_ENUM_ENTRY_INDEX_MASK)) == (M_FEATURE_ENUM_ENTRY_NAME + M_STRING_SIZE))
+                  Type = M_TYPE_MIL_INT;
+               else if ((InquireType & (~M_FEATURE_ENUM_ENTRY_INDEX_MASK)) == M_FEATURE_ENUM_ENTRY_VALUE)
+                  Type = M_TYPE_INT64;
+               }
+            }
+            break;
+         }
+      }
+
+   if(Type == 0)
+      {
+      switch(UserVarType)
+         {
+         case M_TYPE_STRING:
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_ENUMERATION + M_TYPE_STRING: //M_TYPE_STRING_ENUMERATION:
+         case M_TYPE_REGISTER + M_TYPE_STRING: //M_TYPE_REGISTER_FROM_STRING:
+         case M_TYPE_VALUE + M_TYPE_STRING: //M_TYPE_VALUE_FROM_STRING:
+#endif
+            Type = M_TYPE_TEXT_CHAR;
+            break;
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_ENUMERATION:
+            Type = M_TYPE_INT64;
+            break;
+         case M_TYPE_ENUMERATION + M_TYPE_MIL_INT32: //M_TYPE_INTEGER_ENUMERATION:
+            Type = M_TYPE_INT64;
+            break;
+#endif
+         case M_TYPE_BOOLEAN:
+         case M_TYPE_MIL_INT32:
+            Type = M_TYPE_MIL_INT32;
+            break;
+         case M_TYPE_INT64:
+            Type = M_TYPE_INT64;
+            break;
+         case M_TYPE_DOUBLE:
+            Type = M_TYPE_DOUBLE;
+            break;
+         default:
+            if (M_FEATURE_USER_ARRAY_SIZE_BIT_SET(UserVarType))
+               {
+               switch (M_STRIP_FEATURE_USER_ARRAY_SIZE_VALUE(UserVarType))
+                  {
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+                  case M_TYPE_REGISTER:
+#endif
+                  case M_TYPE_UINT8:
+                     Type = M_TYPE_UINT8;
+                     break;
+                  default:
+                     Type = M_TYPE_TEXT_CHAR;
+                     break;
+                  }
+               }
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+            else if ((UserVarType & M_TYPE_REGISTER) == M_TYPE_REGISTER)
+               Type = M_TYPE_UINT8;
+#endif
+            else if ((UserVarType & M_TYPE_UINT8) == M_TYPE_UINT8)
+               Type = M_TYPE_UINT8;
+            else
+               Type = 0;
+            break;
+         }
+      }
+
+   return Type;
+   }
+
+inline MIL_INT64 ControlFeatureRequiredType(MIL_INT64 ControlType, MIL_INT64 UserVarType)
+   {
+   MIL_INT64 Type = 0;
+
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION && OldDefinesSupport)
+   if (M_FEATURE_OP(ControlType) == M_FEATURE_VALUE_AS_STRING_INTERNAL)
+      Type = M_TYPE_TEXT_CHAR;
+   else
+#endif
+   if(M_FEATURE_OP(ControlType) == M_FEATURE_CHANGE_HOOK)
+      Type = M_TYPE_MIL_INT;
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   else if((M_FEATURE_OP(ControlType) == M_FEATURE_EXECUTE) && (UserVarType == M_DEFAULT))
+      Type = M_DEFAULT;
+#else
+   else if(M_FEATURE_OP(ControlType) == M_FEATURE_EXECUTE)
+      Type = M_DEFAULT;
+#endif
+   else if(M_FEATURE_OP(ControlType) == M_FEATURE_MAX || M_FEATURE_OP(ControlType) == M_FEATURE_MIN)
+      Type = M_DEFAULT;
+   else
+      {
+      switch(UserVarType)
+         {
+         case M_TYPE_STRING:
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_ENUMERATION + M_TYPE_STRING: //M_TYPE_STRING_ENUMERATION:
+         case M_TYPE_REGISTER + M_TYPE_STRING: //M_TYPE_REGISTER_FROM_STRING:
+         case M_TYPE_VALUE + M_TYPE_STRING: //M_TYPE_VALUE_FROM_STRING:
+#endif
+            Type = M_TYPE_TEXT_CHAR;
+            break;
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_ENUMERATION:
+            Type = M_TYPE_INT64;
+            break;
+         case M_TYPE_ENUMERATION + M_TYPE_MIL_INT32: //M_TYPE_INTEGER_ENUMERATION:
+            Type = M_TYPE_INT64;
+            break;
+#endif
+         case M_TYPE_INT64:
+            Type = M_TYPE_INT64;
+            break;
+         case M_TYPE_DOUBLE:
+            Type = M_TYPE_DOUBLE;
+            break;
+         case M_TYPE_MIL_INT32:
+         case M_TYPE_BOOLEAN:
+            Type = M_TYPE_MIL_INT32;
+            break;
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_COMMAND:
+            Type = M_TYPE_COMMAND;
+            break;
+#endif
+         default:
+            if (M_FEATURE_USER_ARRAY_SIZE_BIT_SET(UserVarType))
+               {
+               switch (M_STRIP_FEATURE_USER_ARRAY_SIZE_VALUE(UserVarType))
+                  {
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+                  case M_TYPE_REGISTER:
+#endif
+                  case M_TYPE_UINT8:
+                     Type = M_TYPE_UINT8;
+                     break;
+                  case M_TYPE_STRING:
+                     Type = M_TYPE_STRING;
+                     break;
+                  default:
+                     Type = 0;
+                     break;
+                  }
+               }
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+            else if ((UserVarType & M_TYPE_REGISTER) == M_TYPE_REGISTER)
+               Type = M_TYPE_UINT8;
+#endif
+            else if ((UserVarType & M_TYPE_UINT8) == M_TYPE_UINT8)
+               Type = M_TYPE_UINT8;
+            else
+               Type = 0;
+            break;
+         }
+      }
+
+   return Type;
+   }
+
+// ----------------------------------------------------------
+// MbufInquireFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MbufInquireFeatureExecuteW (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufInquireFeatureExecuteA (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+#if M_MIL_UNICODE_API
+#define MbufInquireFeatureExecute  MbufInquireFeatureExecuteW
+#else
+#define MbufInquireFeatureExecute  MbufInquireFeatureExecuteA
+#endif
+
+inline void MFTYPE MbufInquireFeatureUnsafeW  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+inline void MFTYPE MbufInquireFeatureUnsafeA  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MbufInquireFeatureUnsafe MbufInquireFeatureUnsafeW
+#else
+#define MbufInquireFeatureUnsafe MbufInquireFeatureUnsafeA
+#endif
+
+#else
+
+inline void MFTYPE MbufInquireFeatureExecute (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureUnsafe  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, (void*)((MIL_UINT)UserVarPtr));
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, (void*)NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#endif //M_MIL_USE_UNICODE
+// ----------------------------------------------------------
+// MbufControlFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MbufControlFeatureExecuteW (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufControlFeatureExecuteW (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+   else if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureW(BufId, ControlType, FeatureName, UserVarType, NULL);
+   }
+
+inline void MFTYPE MbufControlFeatureExecuteA (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufControlFeatureExecuteA (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureA(BufId, ControlType, FeatureName, UserVarType, NULL);
+   }
+
+#if M_MIL_UNICODE_API
+#define MbufControlFeatureExecute  MbufControlFeatureExecuteW
+#else
+#define MbufControlFeatureExecute  MbufControlFeatureExecuteA
+#endif
+
+inline void MFTYPE MbufControlFeatureUnsafeW  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr)
+   {
+   MbufControlFeatureW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,        std::nullptr_t            )
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+inline void MFTYPE MbufControlFeatureUnsafeA (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void                    *UserVarPtr)
+   {
+   MbufControlFeatureA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR          *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64              *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE             *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32              *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8              *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool                   *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int                     UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t                          )
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64             *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MbufControlFeatureUnsafe MbufControlFeatureUnsafeW
+#else
+#define MbufControlFeatureUnsafe MbufControlFeatureUnsafeA
+#endif
+
+#else
+inline void MFTYPE MbufControlFeatureExecute (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeature(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufControlFeatureExecute (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int  UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeature(BufId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MbufControlFeatureUnsafe  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr)
+   {
+   MbufControlFeature(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeature(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t               )
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MdigGetHookInfo
+
+inline MIL_INT64 MdigGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   if((M_IN_DIG_GET_HOOK_INFO_DOUBLE_RANGE(InfoType)))
+      {
+      return M_TYPE_DOUBLE;
+      }
+   else if((M_IN_DIG_GET_HOOK_INFO_STRING_RANGE(InfoType)))
+      {
+      return M_TYPE_STRING_PTR;
+      }
+   else if((M_IN_DIG_GET_HOOK_INFO_INT64_RANGE(InfoType)))
+      {
+      return M_TYPE_MIL_INT64;
+      }
+   else if (((InfoType & ~M_MODIFIED_BUFFER) == M_BUFFER_ID) || ((InfoType & ~M_MODIFIED_BUFFER) == 0))
+      {
+      return M_TYPE_MIL_ID;
+      }
+   else if ((M_IN_DIG_GET_HOOK_INFO_PTR_RANGE(InfoType)))
+      {
+      return M_TYPE_MIL_INT64;
+      }
+   else
+      {
+      return M_TYPE_MIL_INT;   
+      }
+   }
+
+inline MIL_INT MFTYPE MdigGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MdigGetHookInfoRequiredType(InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigGetHookInfo"));
+
+   return MdigGetHookInfo(EventId, InfoType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MdigGetHookInfo"));
+
+   return MdigGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MdigGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MdigGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void           *ResultPtr) {return MdigGetHookInfo               (EventId, InfoType, ResultPtr)                  ;}
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32      *ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64      *ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE     *ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_DOUBLE   );}
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR    ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_STRING_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT       *ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT  );}
+#endif
+
+// ----------------------------------------------------------
+// MdigInquireFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MdigInquireFeatureExecuteW (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeatureExecuteA (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeatureUnsafeW  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTW_PTR  UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t           )
+   {
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+inline void MFTYPE MdigInquireFeatureUnsafeA  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTA_PTR  UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t           )
+   {
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MdigInquireFeatureUnsafe MdigInquireFeatureUnsafeW
+#else
+#define MdigInquireFeatureUnsafe MdigInquireFeatureUnsafeA
+#endif
+
+#else
+
+inline void MFTYPE MdigInquireFeatureExecute (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureUnsafe  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   } 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MdigControlFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MdigControlFeatureExecuteW (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigControlFeatureExecuteW (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+   else if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureW(DigId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MdigControlFeatureExecuteA (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigControlFeatureExecuteA (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureA(DigId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MdigControlFeatureUnsafeW  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr)
+   {
+   MdigControlFeatureW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTW_PTR UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t                 )
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+inline void MFTYPE MdigControlFeatureUnsafeA (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void                    *UserVarPtr)
+   {
+   MdigControlFeatureA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTA_PTR   UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64              *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE             *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32              *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8              *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool                   *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int                     UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64             *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MdigControlFeatureUnsafe MdigControlFeatureUnsafeW
+#else
+#define MdigControlFeatureUnsafe MdigControlFeatureUnsafeA
+#endif
+
+#else
+inline void MFTYPE MdigControlFeatureExecute (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeature(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigControlFeatureExecute (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int  UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeature(DigId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MdigControlFeatureUnsafe  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr)
+   {
+   MdigControlFeature(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeature(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t             )
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MdigInquire
+
+inline MIL_INT64 MdigInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if ( M_IN_DIG_INQUIRE_STRING_RANGE(InquireType) )
+      return M_TYPE_TEXT_CHAR;
+
+   if ( M_IN_DIG_INQUIRE_DOUBLE_RANGE(InquireType) )
+      return M_TYPE_DOUBLE;
+
+   if ( M_IN_DIG_INQUIRE_MIL_INT64_RANGE(InquireType) )
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdigInquire"));
+
+   return MdigInquire(DigId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MdigInquire(DigId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MdigInquireExecute (MIL_ID DigId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MdigInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigInquire"));
+
+   return MdigInquire(DigId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MdigInquireUnsafe  (MIL_ID DigId, MIL_INT64 InquireType, void           *UserVarPtr) {return MdigInquire       (DigId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_INT32      *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_INT64      *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_UINT32     *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_UINT64     *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#ifdef __MILFPGA_H__
+// ----------------------------------------------------------
+// MfpgaGetHookInfo
+
+inline MIL_INT64 MfpgaGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   switch (InfoType)
+      {
+      case M_TIME_STAMP:
+         return M_TYPE_DOUBLE;
+         break;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, int UserVarPtr)
+   {
+   if (UserVarPtr != NULL)
+      SafeTypeError(MIL_TEXT("MfpgaGetHookInfo"));
+
+   return MfpgaGetHookInfo(EventId, InfoType, NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MfpgaGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeTypeExecute (MIL_ID  EventId, MIL_INT64 InfoType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MfpgaGetHookInfoRequiredType(InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MfpgaGetHookInfo"));
+
+   return MfpgaGetHookInfo(EventId, InfoType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MfpgaGetHookInfoUnsafe  (MIL_ID  EventId, MIL_INT64 InfoType, void         *UserVarPtr) {return MfpgaGetHookInfo               (EventId, InfoType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_INT32    *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_INT64    *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_DOUBLE   *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_UINT32   *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_UINT64   *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MfpgaInquire
+
+inline MIL_INT64 MfpgaInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if(M_IN_FPGA_INQUIRE_STRING_RANGE(InquireType))
+      {
+      return M_TYPE_TEXT_CHAR;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr != NULL)
+      SafeTypeError(MIL_TEXT("MfpgaInquire"));
+
+   return MfpgaInquire(MilSystemId, FpgaDeviceNum, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MfpgaInquire(MilSystemId, FpgaDeviceNum, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MfpgaInquireSafeTypeExecute (MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MfpgaInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MfpgaInquire"));
+
+   return MfpgaInquire(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MfpgaInquireUnsafe  (MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, void            *UserVarPtr) {return MfpgaInquire               (MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#endif // #ifdef __MILFPGA_H__
+
+// ----------------------------------------------------------
+// MfuncInquire
+
+inline MIL_INT64 MfuncInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (InquireType == M_OBJECT_TYPE_EXTENDED)
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MfuncInquireSafeTypeExecute (MIL_ID ObjectId, MIL_INT64 InquireType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MfuncInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MfuncInquire"));
+
+   return MfuncInquire(ObjectId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MfuncInquire"));
+
+   return MfuncInquire(ObjectId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MfuncInquire(ObjectId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MfuncInquireUnsafe  (MIL_ID ObjectId, MIL_INT64 InquireType, void        *UserVarPtr) {return MfuncInquire               (ObjectId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_INT32   *UserVarPtr) {return MfuncInquireSafeTypeExecute(ObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_INT64   *UserVarPtr) {return MfuncInquireSafeTypeExecute(ObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_UINT32  *UserVarPtr) {return MfuncInquireSafeTypeExecute(ObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_UINT64  *UserVarPtr) {return MfuncInquireSafeTypeExecute(ObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MgraInquire
+
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID GraContextId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MgraInquire"));
+
+   return MgraInquire(GraContextId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID GraContextId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MgraInquire(GraContextId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MgraInquireSafeTypeExecute (MIL_ID ContextGraId, MIL_INT64 InquireType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MgraInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MgraInquire"));
+
+   return MgraInquire(ContextGraId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MgraInquireUnsafe  (MIL_ID ContextGraId, MIL_INT64 InquireType, void        *UserVarPtr) {return MgraInquire               (ContextGraId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT8    *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_CHAR     );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT16   *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_SHORT    );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT32   *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT64   *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, float       *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_FLOAT    );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT8   *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_CHAR     );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT16  *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_SHORT    );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT32  *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT64  *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MgraInquireList
+
+inline MIL_INT64 MgraInquireListRequiredType(MIL_INT64 InquireType)
+   {
+   return MgraInquireRequiredType(InquireType);
+   }
+
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, int                 UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MgraInquireList"));
+
+   return MgraInquireList(GraListId, Index, SubIndex, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MgraInquireList(GraListId, Index, SubIndex, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MgraInquireListSafeTypeExecute (MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MgraInquireListRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MgraInquireList"));
+
+   return MgraInquireList(GraListId, Index, SubIndex, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MgraInquireListUnsafe  (MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, void         *UserVarPtr) {return MgraInquireList               (GraListId, Index, SubIndex, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT8     *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_CHAR     );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT16    *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_SHORT    );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT32    *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT64    *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, float        *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_FLOAT    );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_DOUBLE   *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT8    *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_CHAR     );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT16   *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_SHORT    );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT32   *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT64   *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MsysGetHookInfo
+
+inline MIL_INT64 MsysGetHookInfoRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_SYS_GET_HOOK_INFO_DOUBLE_RANGE(InquireType))
+      return M_TYPE_MIL_DOUBLE;
+
+   if (M_IN_SYS_GET_HOOK_INFO_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if (M_IN_SYS_GET_HOOK_INFO_STRING_RANGE(InquireType))
+      return M_TYPE_STRING_PTR;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MsysGetHookInfo"));
+
+   return MsysGetHookInfo(SysId,EventId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MsysGetHookInfo(SysId, EventId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MsysGetHookInfoSafeTypeExecute (MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MsysGetHookInfoRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysGetHookInfo"));
+
+   return MsysGetHookInfo(SysId, EventId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MsysGetHookInfoUnsafe  (MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, void            *ResultPtr) {return MsysGetHookInfo               (SysId, EventId, InquireType, ResultPtr);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_INT32       *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_INT64       *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_DOUBLE      *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_DOUBLE);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_TEXT_PTR     ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_STRING_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_UINT32      *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_UINT64      *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MsysInquire
+
+
+inline MIL_INT64 MsysInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_SYS_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_SYS_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_SYS_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if (M_IN_SYS_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_MIL_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, int ResultPtr)
+   {
+   if (ResultPtr || M_SYS_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MsysInquire"));
+
+   return MsysInquire(SysId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_SYS_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MsysInquire"));
+
+   return MsysInquire(SysId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MsysInquireSafeTypeExecute (MIL_ID SysId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MsysInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysInquire"));
+
+   return MsysInquire(SysId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MsysInquireUnsafe  (MIL_ID SysId, MIL_INT64 InquireType, void            *ResultPtr) {return MsysInquire               (SysId, InquireType, ResultPtr);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_INT32       *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_INT64       *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_TEXT_CHAR   *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_DOUBLE      *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_DOUBLE);}
+
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_UINT32      *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_UINT64      *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MsysInquireFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MsysInquireFeatureExecuteW (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysInquireFeatureExecuteA (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysInquireFeatureUnsafeW  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTW_PTR  UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+inline void MFTYPE MsysInquireFeatureUnsafeA  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTA_PTR UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MsysInquireFeatureUnsafe MsysInquireFeatureUnsafeW
+#define MsysInquireFeatureExecute MsysInquireFeatureExecuteW
+#else
+#define MsysInquireFeatureUnsafe MsysInquireFeatureUnsafeA
+#define MsysInquireFeatureExecute MsysInquireFeatureExecuteA
+#endif
+
+#else
+
+inline void MFTYPE MsysInquireFeatureExecute (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureUnsafe  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t             )
+   {
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MsysControlFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MsysControlFeatureExecuteW (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureExecuteW (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   else if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureW(SysId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MsysControlFeatureExecuteA (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureExecuteA (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureA(SysId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MsysControlFeatureUnsafeW  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr)
+   {
+   MsysControlFeatureW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTW_PTR UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t                   )
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+inline void MFTYPE MsysControlFeatureUnsafeA (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void                    *UserVarPtr)
+   {
+   MsysControlFeatureA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTA_PTR   UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64              *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE             *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32              *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8              *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool                   *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int                     UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t                           )
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64             *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MsysControlFeatureUnsafe    MsysControlFeatureUnsafeW
+#define MsysControlFeatureExecute   MsysControlFeatureExecuteW
+#else
+#define MsysControlFeatureUnsafe    MsysControlFeatureUnsafeA
+#define MsysControlFeatureExecute   MsysControlFeatureExecuteA
+#endif
+
+#else
+inline void MFTYPE MsysControlFeatureExecute (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeature(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureExecute (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int  UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeature(SysId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MsysControlFeatureUnsafe  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr)
+   {
+   MsysControlFeature(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeature(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t             )
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MsysIoInquire
+
+
+inline MIL_INT64 MsysIoInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_SYS_IO_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_SYS_IO_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_SYS_IO_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if (M_IN_SYS_IO_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_MIL_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr || M_SYS_IO_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MsysIoInquire"));
+
+   return MsysIoInquire(IoObjectId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_SYS_IO_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MsysIoInquire"));
+
+   return MsysIoInquire(IoObjectId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MsysIoInquireSafeTypeExecute (MIL_ID IoObjectId, MIL_INT64 InquireType, void* UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MsysIoInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysIoInquire"));
+
+   return MsysIoInquire(IoObjectId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MsysIoInquireUnsafe  (MIL_ID IoObjectId, MIL_INT64 InquireType, void            *UserVarPtr) {return MsysIoInquire               (IoObjectId, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MsysIoCommandRegister
+
+inline MIL_INT64 MsysIoCommandRegisterRequiredType(MIL_INT64 Operation)
+   {
+   UNREFERENCED_PARAMETER(Operation);
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, int CommandStatusPtr)
+   {
+   if (CommandStatusPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysIoCommandRegister"));
+
+   return MsysIoCommandRegister(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, std::nullptr_t)
+   {
+   return MsysIoCommandRegister(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MsysIoCommandRegisterExecute(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, void* CommandStatusPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MsysIoCommandRegisterRequiredType(Operation);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysIoCommandRegister"));
+
+   return MsysIoCommandRegister(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, CommandStatusPtr);
+   }
+
+inline MIL_INT MFTYPE MsysIoCommandRegisterUnsafe  (MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, void*    CommandStatusPtr)  {return MsysIoCommandRegister(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, CommandStatusPtr);}
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, MIL_INT* CommandStatusPtr)  {return MsysIoCommandRegisterExecute(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, CommandStatusPtr, M_TYPE_MIL_INT);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, MIL_UINT* CommandStatusPtr) {return MsysIoCommandRegisterExecute(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, CommandStatusPtr, M_TYPE_MIL_INT);}
+#endif
+
+//-------------------------------------------------------------------------------
+// MthrInquire
+
+inline MIL_INT64 MthrInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if(InquireType == M_NATIVE_ID)
+      return M_TYPE_MIL_ID;
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MthrInquire"));
+
+   return MthrInquire(ThreadEventOrMutexId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MthrInquire(ThreadEventOrMutexId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MthrInquireExecute (MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MthrInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MthrInquire"));
+
+   return MthrInquire(ThreadEventOrMutexId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MthrInquireUnsafe  (MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, void         *UserVarPtr) {return MthrInquire     (  ThreadEventOrMutexId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, MIL_INT      *UserVarPtr) {return MthrInquireExecute(ThreadEventOrMutexId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, MIL_UINT     *UserVarPtr) {return MthrInquireExecute(ThreadEventOrMutexId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+
+// ----------------------------------------------------------
+// MseqGetHookInfo
+#if  !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+inline MIL_INT64 MseqGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   switch (InfoType)
+      {
+      case M_MODIFIED_BUFFER+M_BUFFER_ID:
+         return M_TYPE_MIL_ID;
+         break;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MseqGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MseqGetHookInfoRequiredType(InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MseqGetHookInfo"));
+
+   return MseqGetHookInfo(EventId, InfoType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MseqGetHookInfo"));
+
+   return MseqGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MseqGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MseqGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *UserVarPtr) {return MseqGetHookInfo               (EventId, InfoType, UserVarPtr)                  ;}
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *UserVarPtr) {return MseqGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT  );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT        *UserVarPtr) {return MseqGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+
+
+// ----------------------------------------------------------
+// MseqInquire
+
+
+inline MIL_INT64 MseqInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_SEQ_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_SEQ_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if (M_IN_SEQ_INQUIRE_MIL_DOUBLE_RANGE(InquireType))
+      return M_TYPE_MIL_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr || M_IN_SEQ_INQUIRE_MUST_HAVE_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MseqInquire"));
+
+   return MseqInquire(ContextSeqId, SequenceIndex, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_IN_SEQ_INQUIRE_MUST_HAVE_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MseqInquire"));
+   return MseqInquire(ContextSeqId, SequenceIndex, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MseqInquireSafeTypeExecute(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, void* UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MseqInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MseqInquire"));
+
+   return MseqInquire(ContextSeqId, SequenceIndex, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MseqInquireUnsafe  (MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, void            *UserVarPtr) {return MseqInquire               (ContextSeqId, SequenceIndex, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+#endif // !M_MIL_USE_LINUX
+// ----------------------------------------------------------
+// MappInquireMp
+
+inline MIL_INT64 MappInquireMpRequiredType(MIL_INT64 InquireType)
+   {
+   if (InquireType == M_CORE_AFFINITY_MASK ||
+       InquireType == M_CORE_AFFINITY_MASK_PROCESS ||
+       InquireType == M_CORE_AFFINITY_MASK_HARDWARE ||
+       InquireType == M_MEMORY_BANK_CORE_AFFINITY_MASK ||
+       InquireType == M_MEMORY_BANK_AFFINITY_MASK ||
+       InquireType == M_CORE_MEMORY_BANK_AFFINITY_MASK)
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeTypeExecute(MIL_ID ContextAppId,
+                                                   MIL_INT64 InquireType,
+                                                   MIL_INT64 TypeFlag,
+                                                   MIL_INT64 TypeValue,
+                                                   void *UserVarPtr,
+                                                   MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappInquireMpRequiredType(InquireType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("MappInquireMp"));
+      }
+
+   return MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      {
+      SafeTypeError(MIL_TEXT("MappInquireMp"));
+      }
+
+   return MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t)
+   {
+   return MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappInquireMpUnsafe(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void *UserVarPtr)
+   {
+   return MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT32 *UserVarPtr)
+   {
+   return MappInquireMpSafeTypeExecute(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64 *UserVarPtr)
+   {
+   return MappInquireMpSafeTypeExecute(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr, M_TYPE_MIL_INT64);
+   }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT32 *UserVarPtr)
+   {
+   return MappInquireMpSafeTypeExecute(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *UserVarPtr)
+   {
+   return MappInquireMpSafeTypeExecute(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr, M_TYPE_MIL_INT64);
+   }
+
+#endif
+
+// ----------------------------------------------------------
+// MthrInquireMp
+
+inline MIL_INT64 MthrInquireMpRequiredType(MIL_INT64 InquireType)
+   {
+   if (InquireType == M_CORE_AFFINITY_MASK)
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeTypeExecute(MIL_ID ThreadId,
+                                                   MIL_INT64 InquireType,
+                                                   MIL_INT64 TypeFlag,
+                                                   MIL_INT64 TypeValue,
+                                                   void *ResultPtr,
+                                                   MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MthrInquireMpRequiredType(InquireType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("MthrInquireMp"));
+      }
+
+   return MthrInquireMp(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr);
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int ResultPtr)
+   {
+   if (ResultPtr)
+      {
+      SafeTypeError(MIL_TEXT("MthrInquireMp"));
+      }
+
+   return MthrInquireMp(ThreadId, InquireType, TypeFlag, TypeValue, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t)
+   {
+   return MthrInquireMp(ThreadId, InquireType, TypeFlag, TypeValue, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MthrInquireMpUnsafe(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void *ResultPtr)
+   {
+   return MthrInquireMp(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr);
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT32 *ResultPtr)
+   {
+   return MthrInquireMpSafeTypeExecute(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr, M_TYPE_MIL_INT32);
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64 *ResultPtr)
+   {
+   return MthrInquireMpSafeTypeExecute(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr, M_TYPE_MIL_INT64);
+   }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT32 *ResultPtr)
+   {
+   return MthrInquireMpSafeTypeExecute(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr, M_TYPE_MIL_INT32);
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ResultPtr)
+   {
+   return MthrInquireMpSafeTypeExecute(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr, M_TYPE_MIL_INT64);
+   }
+
+#endif
+
+// ----------------------------------------------------------
+// MappControlMp
+
+inline MIL_INT64 MappControlMpRequiredType(MIL_INT64 ControlType)
+   {
+   if (ControlType == M_CORE_AFFINITY_MASK)
+      {
+      return M_TYPE_MIL_INT64;
+      }
+   else if (ControlType == M_MP_THRESHOLD_RESTRICTION)
+      {
+      return M_TYPE_STRING;
+      }
+
+   return M_NULL;
+   }
+
+inline void MFTYPE MappControlMpSafeTypeExecute(MIL_ID ContextAppId,
+                                                MIL_INT64 ControlType,
+                                                MIL_INT64 TypeFlag,
+                                                MIL_INT64 TypeValue,
+                                                void *ValuePtr,
+                                                MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappControlMpRequiredType(ControlType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("MappControlMp"));
+      }
+
+   MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr);
+   }
+
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int ValuePtr)
+   {
+   if (ValuePtr)
+      {
+      SafeTypeError(MIL_TEXT("MappControlMp"));
+      }
+
+   MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t)
+   {
+   MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, NULL);
+   }
+#endif
+
+inline void MFTYPE MappControlMpUnsafe(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void *ValuePtr)
+   {
+   MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr);
+   }
+
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64 *ValuePtr)
+   {
+   MappControlMpSafeTypeExecute(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_MIL_INT64);
+   }
+
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_TEXT_PTR ValuePtr)
+   {
+   MappControlMpSafeTypeExecute(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_STRING);
+   }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ValuePtr)
+   {
+   MappControlMpSafeTypeExecute(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_MIL_INT64);
+   }
+
+#endif
+
+// ----------------------------------------------------------
+// MthrControlMp
+
+inline MIL_INT64 MthrControlMpRequiredType(MIL_INT64 ControlType)
+   {
+   if (ControlType == M_CORE_AFFINITY_MASK)
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   return M_NULL;
+   }
+
+inline void MFTYPE MthrControlMpSafeTypeExecute(MIL_ID ThreadId,
+                                                MIL_INT64 ControlType,
+                                                MIL_INT64 TypeFlag,
+                                                MIL_INT64 TypeValue,
+                                                void *ValuePtr,
+                                                MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MthrControlMpRequiredType(ControlType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("MthrControlMp"));
+      }
+
+   MthrControlMp(ThreadId, ControlType, TypeFlag, TypeValue, ValuePtr);
+   }
+
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int ValuePtr)
+   {
+   if (ValuePtr)
+      {
+      SafeTypeError(MIL_TEXT("MthrControlMp"));
+      }
+
+   MthrControlMp(ThreadId, ControlType, TypeFlag, TypeValue, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t)
+   {
+   MthrControlMp(ThreadId, ControlType, TypeFlag, TypeValue, NULL);
+   }
+#endif
+
+inline void MFTYPE MthrControlMpUnsafe(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void *ValuePtr)
+   {
+   MthrControlMp(ThreadId, ControlType, TypeFlag, TypeValue, ValuePtr);
+   }
+
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64 *ValuePtr)
+   {
+   MthrControlMpSafeTypeExecute(ThreadId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_MIL_INT64);
+   }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ValuePtr)
+   {
+   MthrControlMpSafeTypeExecute(ThreadId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_MIL_INT64);
+   }
+
+#endif
+
+#define MappGetError         MappGetErrorSafeType
+#define MappGetHookInfo      MappGetHookInfoSafeType
+#define MappInquire          MappInquireSafeType
+#define MappInquireConnection MappInquireConnectionSafeType
+
+#if M_MIL_USE_UNICODE
+#define MbufDiskInquireW     MbufDiskInquireSafeTypeW
+#define MbufDiskInquireA     MbufDiskInquireSafeTypeA
+#define MbufInquireFeatureW   MbufInquireFeatureSafeTypeW
+#define MbufControlFeatureW   MbufControlFeatureSafeTypeW
+#if M_MIL_UNICODE_API
+#define MbufControlFeatureSafeType  MbufControlFeatureSafeTypeW
+#else
+#define MbufControlFeatureSafeType  MbufControlFeatureSafeTypeA
+#endif
+#define MbufInquireFeatureA   MbufInquireFeatureSafeTypeA
+#define MbufControlFeatureA   MbufControlFeatureSafeTypeA
+#else
+#define MbufDiskInquire      MbufDiskInquireSafeType
+#define MbufInquireFeature   MbufInquireFeatureSafeType
+#define MbufControlFeature   MbufControlFeatureSafeType
+#endif
+#define MbufGetHookInfo      MbufGetHookInfoSafeType
+#define MbufInquire          MbufInquireSafeType
+#define MbufInquireContainer MbufInquireContainerSafeType
+#define MdigGetHookInfo      MdigGetHookInfoSafeType
+#define MdigInquire          MdigInquireSafeType
+
+#if M_MIL_USE_UNICODE
+#define MdigInquireFeatureW   MdigInquireFeatureSafeTypeW
+#define MdigControlFeatureW   MdigControlFeatureSafeTypeW
+#define MdigInquireFeatureA   MdigInquireFeatureSafeTypeA
+#define MdigControlFeatureA   MdigControlFeatureSafeTypeA
+#else
+#define MdigInquireFeature   MdigInquireFeatureSafeType
+#define MdigControlFeature   MdigControlFeatureSafeType
+#endif
+
+//#define MfpgaGetHookInfo     MfpgaGetHookInfoSafeType
+//#define MfpgaInquire         MfpgaInquireSafeType
+
+// MfuncInquireSafeType is not activated because too many undocumented InquireTypes with various pointer types.
+//#define MfuncInquire         MfuncInquireSafeType
+
+#define MgraInquire          MgraInquireSafeType
+#define MgraInquireList      MgraInquireListSafeType
+
+#define MsysGetHookInfo      MsysGetHookInfoSafeType
+#define MsysInquire          MsysInquireSafeType
+#define MsysIoInquire        MsysIoInquireSafeType
+#define MsysIoCommandRegister MsysIoCommandRegisterSafeType
+
+#if M_MIL_USE_UNICODE
+#define MsysInquireFeatureW   MsysInquireFeatureSafeTypeW
+#define MsysControlFeatureW   MsysControlFeatureSafeTypeW
+#define MsysInquireFeatureA   MsysInquireFeatureSafeTypeA
+#define MsysControlFeatureA   MsysControlFeatureSafeTypeA
+
+#if M_MIL_UNICODE_API
+#define MsysInquireFeatureSafeType   MsysInquireFeatureSafeTypeW
+#define MsysControlFeatureSafeType   MsysControlFeatureSafeTypeW
+#else
+#define MsysInquireFeatureSafeType   MsysInquireFeatureSafeTypeA
+#define MsysControlFeatureSafeType   MsysControlFeatureSafeTypeA
+#endif
+
+
+#else
+#define MsysInquireFeature   MsysInquireFeatureSafeType
+#define MsysControlFeature   MsysControlFeatureSafeType
+#endif
+
+#define MthrInquire          MthrInquireSafeType
+
+#define MseqGetHookInfo      MseqGetHookInfoSafeType
+#define MseqInquire          MseqInquireSafeType
+#define MappInquireMp        MappInquireMpSafeType
+#define MthrInquireMp        MthrInquireMpSafeType
+#define MappControlMp        MappControlMpSafeType
+#define MthrControlMp        MthrControlMpSafeType
+
+#else // #if M_MIL_USE_SAFE_TYPE
+
+// Definitions of Unsafe functions are available even if M_MIL_USE_SAFE_TYPE
+// is deactivated in order to allow applications that have been transformed
+// to use it to compile properly.
+
+#define MappGetErrorUnsafe         MappGetError
+#define MappGetHookInfoUnsafe      MappGetHookInfo
+#define MappInquireUnsafe          MappInquire
+#define MappFileOperationUnsafe    MappFileOperation
+#define MappInquireConnectionUnsafe MappInquireConnection
+
+#define MbufCreate2dUnsafe         MbufCreate2d
+#define MbufCreateColorUnsafe      MbufCreateColor
+#if M_MIL_USE_UNICODE
+#define MbufDiskInquireUnsafeW     MbufDiskInquireW
+#define MbufDiskInquireUnsafeA     MbufDiskInquireA
+#define MbufInquireFeatureUnsafeW   MbufInquireFeatureW
+#define MbufControlFeatureUnsafeW   MbufControlFeatureW
+#define MbufInquireFeatureUnsafeA   MbufInquireFeatureA
+#define MbufControlFeatureUnsafeA   MbufControlFeatureA
+#if M_MIL_UNICODE_API
+#define MbufDiskInquireUnsafe      MbufDiskInquireW
+#define MbufInquireFeatureUnsafe   MbufInquireFeatureW
+#define MbufControlFeatureUnsafe   MbufControlFeatureW
+#else
+#define MbufDiskInquireUnsafe      MbufDiskInquireA
+#define MbufInquireFeatureUnsafe   MbufInquireFeatureA
+#define MbufControlFeatureUnsafe   MbufControlFeatureA
+#endif
+#else
+#define MbufDiskInquireUnsafe      MbufDiskInquire
+#define MbufInquireFeatureUnsafe   MbufInquireFeature
+#define MbufControlFeatureUnsafe   MbufControlFeature
+#endif
+#if M_MIL_USE_UNICODE
+#define MdigInquireFeatureUnsafeW   MdigInquireFeatureW
+#define MdigControlFeatureUnsafeW   MdigControlFeatureW
+#define MdigInquireFeatureUnsafeA   MdigInquireFeatureA
+#define MdigControlFeatureUnsafeA   MdigControlFeatureA
+#if M_MIL_UNICODE_API
+#define MdigInquireFeatureUnsafe   MdigInquireFeatureW
+#define MdigControlFeatureUnsafe   MdigControlFeatureW
+#else
+#define MdigInquireFeatureUnsafe   MdigInquireFeatureA
+#define MdigControlFeatureUnsafe   MdigControlFeatureA
+#endif
+#else
+#define MdigInquireFeatureUnsafe   MdigInquireFeature
+#define MdigControlFeatureUnsafe   MdigControlFeature
+#endif
+#define MbufGet1dUnsafe            MbufGet1d
+#define MbufGet2dUnsafe            MbufGet2d
+#define MbufGetUnsafe              MbufGet
+#define MbufGetArcUnsafe           MbufGetArc
+#define MbufGetColor2dUnsafe       MbufGetColor2d
+#define MbufGetColorUnsafe         MbufGetColor
+#define MbufGetHookInfoUnsafe      MbufGetHookInfo
+#define MbufGetLineUnsafe          MbufGetLine
+#define MbufInquireUnsafe          MbufInquire
+#define MbufInquireContainerUnsafe MbufInquireContainer
+#define MbufPut1dUnsafe            MbufPut1d
+#define MbufPut2dUnsafe            MbufPut2d
+#define MbufPutUnsafe              MbufPut
+#define MbufPutColor2dUnsafe       MbufPutColor2d
+#define MbufPutColorUnsafe         MbufPutColor
+#define MbufPutLineUnsafe          MbufPutLine
+
+#define MdigGetHookInfoUnsafe      MdigGetHookInfo
+#define MdigInquireUnsafe          MdigInquire
+
+#define MfpgaGetHookInfoUnsafe     MfpgaGetHookInfo
+#define MfpgaInquireUnsafe         MfpgaInquire
+
+#define MfuncInquireUnsafe         MfuncInquire
+
+#define MgraInquireUnsafe          MgraInquire
+#define MgraInquireListUnsafe      MgraInquireList
+
+#define MsysGetHookInfoUnsafe      MsysGetHookInfo
+#define MsysInquireUnsafe          MsysInquire
+#define MsysIoInquireUnsafe        MsysIoInquire
+#define MsysIoCommandRegisterUnsafe MsysIoCommandRegister
+
+#define MthrInquireUnsafe          MthrInquire
+
+#define MseqGetHookInfoUnsafe      MseqGetHookInfo
+#define MseqInquireUnsafe          MseqInquire
+#define MappInquireMpUnsafe        MappInquireMp
+#define MthrInquireMpUnsafe        MthrInquireMp
+#define MappControlMpUnsafe        MappControlMp
+#define MthrControlMpUnsafe        MthrControlMp
+
+#if M_MIL_USE_UNICODE
+#define MsysInquireFeatureUnsafeW   MsysInquireFeatureW
+#define MsysControlFeatureUnsafeW   MsysControlFeatureW
+#define MsysInquireFeatureUnsafeA   MsysInquireFeatureA
+#define MsysControlFeatureUnsafeA   MsysControlFeatureA
+#if M_MIL_UNICODE_API
+#define MsysInquireFeatureUnsafe   MsysInquireFeatureW
+#define MsysControlFeatureUnsafe   MsysControlFeatureW
+#else
+#define MsysInquireFeatureUnsafe   MsysInquireFeatureA
+#define MsysControlFeatureUnsafe   MsysControlFeatureA
+#endif
+#else
+#define MsysInquireFeatureUnsafe   MsysInquireFeature
+#define MsysControlFeatureUnsafe   MsysControlFeature
+#endif
+
+#endif // #if M_MIL_USE_SAFE_TYPE #else
+
+// For backward compatibility to the deprecated function name
+#define MbufControlRegion MbufControlArea
+#endif
+
+#ifdef __cplusplus
+
+inline MIL_ID MsysAlloc(MIL_ID             ContextAppId,
+   MIL_CONST_TEXT_PTR SystemDescriptor,
+   MIL_CONST_TEXT_PTR SystemNum,
+   MIL_INT64          InitFlag,
+   MIL_ID*            SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor, (MIL_INT)SystemNum, InitFlag, SysIdPtr);
+   }
+
+#if M_MIL_USE_64BIT
+inline MIL_ID MsysAlloc(MIL_ID             ContextAppId,
+   MIL_CONST_TEXT_PTR SystemDescriptor,
+   MIL_INT32          SystemNum,
+   MIL_INT64          InitFlag,
+   MIL_ID*            SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor, (MIL_INT)SystemNum, InitFlag, SysIdPtr);
+   }
+#endif
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION    
+inline MIL_ID MsysAlloc(MIL_ID             ContextAppId,
+                        MIL_CONST_TEXT_PTR SystemDescriptor,
+                        MIL_UINT           SystemNum,
+                        MIL_INT64          InitFlag,
+                        MIL_ID*            SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor, (MIL_INT)SystemNum, InitFlag, SysIdPtr);
+   }
+#endif
+
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline MIL_ID MsysAlloc(MIL_ID             ContextAppId,
+   MIL_CONST_TEXT_PTR SystemDescriptor,
+   int                SystemNum,
+   MIL_INT64          InitFlag,
+   MIL_ID*            SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor, (MIL_INT)SystemNum, InitFlag, SysIdPtr);
+   }
+#endif
+
+inline MIL_ID MdigAlloc(MIL_ID SystemId,
+   MIL_CONST_TEXT_PTR DigNum,
+   MIL_CONST_TEXT_PTR DataFormat,
+   MIL_INT64 InitFlag,
+   MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, (MIL_INT)DigNum, DataFormat, InitFlag, DigIdPtr);
+   }
+
+inline MIL_ID MdigAlloc(MIL_ID SystemId,
+   int DigNum,
+   MIL_CONST_TEXT_PTR DataFormat,
+   MIL_INT64 InitFlag,
+   MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, (MIL_INT)DigNum, DataFormat, InitFlag, DigIdPtr);
+   }
+
+
+#if M_MIL_USE_64BIT && !M_MIL_USE_LINUX
+inline MIL_ID MdigAlloc(MIL_ID SystemId,
+   MIL_INT32 DigNum,
+   MIL_CONST_TEXT_PTR DataFormat,
+   MIL_INT64 InitFlag,
+   MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, (MIL_INT)DigNum, DataFormat, InitFlag, DigIdPtr);
+   }
+#endif
+
+// Include Milstring to include MIL_STRING overload to MIL functions
+#include <milstring.h>
+
+// Struct used as first parameter in C++ overloads of Stream functions.
+struct MilStreamParam
+   {
+   MIL_TEXT_PTR m_Param;
+
+   inline MilStreamParam(int): m_Param(M_NULL) {}
+   inline MilStreamParam(long) : m_Param(M_NULL) {}
+#if M_MIL_USE_NULLPTR
+   inline MilStreamParam(std::nullptr_t) : m_Param(M_NULL) {}
+#endif
+#if M_MIL_USE_STRING
+   inline MilStreamParam(const MIL_STRING&  FileName) : m_Param((MIL_TEXT_PTR)FileName.c_str()) {}
+#endif
+   inline MilStreamParam(MIL_TEXT_PTR       FileName): m_Param(FileName) {}
+   inline MilStreamParam(MIL_CONST_TEXT_PTR FileName) : m_Param((MIL_TEXT_PTR)FileName) {}
+   inline MilStreamParam(const MIL_UINT8*   InMemPtr) : m_Param((MIL_TEXT_PTR)InMemPtr) {}
+   inline MilStreamParam(MIL_UINT8*         OutMemPtr) : m_Param((MIL_TEXT_PTR)OutMemPtr) {}
+   };
+
+
+
+inline void MFTYPE MbufStreamCpp(MilStreamParam MemPtrOrFileName,
+                                 MIL_ID         SysId,
+                                 MIL_INT64      Operation,
+                                 MIL_INT64      StreamType,
+                                 MIL_DOUBLE     Version,
+                                 MIL_INT64      ControlFlag,
+                                 MIL_ID*        ContextModIdPtr,
+                                 MIL_INT*       SizeByteVarPtr)
+   {
+   MbufStream(MemPtrOrFileName.m_Param, SysId, Operation, StreamType, Version, ControlFlag, ContextModIdPtr, SizeByteVarPtr);
+   }
+
+#undef  MbufStream
+#define MbufStream MbufStreamCpp
+
+#endif
+
+
+
+// Include Milstring to include std::vector overloads to MIL functions
+#include <milvector.h>
diff --git a/Common_Class/Matrox/Include/Milsetup.h b/Common_Class/Matrox/Include/Milsetup.h
new file mode 100644
index 0000000..09ee135
--- /dev/null
+++ b/Common_Class/Matrox/Include/Milsetup.h
@@ -0,0 +1,303 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MILSETUP.H
+* Revision     :  10.40.0640
+* Content      :  This file contains definitions for specifying the target
+*                 compile environment and the default state to set for
+*                 MIL (Matrox Imaging Library). It also defines the
+*                 MappAllocDefault() and MappFreeDefault() macros.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+#ifndef __MILSETUP_H__
+#define __MILSETUP_H__
+
+/************************************************************************/
+/* MIL COMPILE VERSION                                                  */
+/* These defines are for Matrox internal purpose only and are NOT meant */
+/* to be edited by the client.                                          */
+/************************************************************************/
+#if !defined(MIL_COMPILE_VERSION_HEX) || (MIL_COMPILE_VERSION_HEX== 0)
+   #ifdef MIL_COMPILE_VERSION_HEX
+      #undef MIL_COMPILE_VERSION_HEX
+   #endif
+   #define MIL_COMPILE_VERSION_HEX 0x1040
+#endif
+
+// Let's put the hex value in decimal.
+#define MIL_COMPILE_VERSION ((((MIL_COMPILE_VERSION_HEX >> 12) & 0xf) * 1000) + (((MIL_COMPILE_VERSION_HEX >> 8) & 0xf) * 100) + (((MIL_COMPILE_VERSION_HEX >> 4) & 0xf) * 10) + (((MIL_COMPILE_VERSION_HEX) & 0xf) ))
+#define MIL_COMPILE_TRUNK_VERSION         1060
+#define MIL_COMPILE_NEXT_MAJOR_VERSION    1100
+
+/************************************************************************/
+/* COMPILATION FLAG                                                     */
+/* One and only one flag must be active                                 */
+/************************************************************************/
+#ifndef M_MIL_USE_OS
+   #define M_MIL_USE_OS               1
+
+#ifndef M_MIL_USE_RT
+
+#if defined(UNDER_RTSS)
+#define M_MIL_USE_RT    1
+#else
+#define M_MIL_USE_RT    0
+#endif
+
+#endif
+
+   #if defined(__linux__)
+      #if defined(__arm__) || defined(__aarch64__)
+         #define M_MIL_USE_ARM        1
+      #else
+         #define M_MIL_USE_ARM        0
+      #endif
+      #define M_MIL_USE_WINDOWS       0
+      #define M_MIL_USE_LINUX         1
+      #define M_MIL_USE_NEW_STDHEADERS 1
+      #if defined(__x86_64__) || defined(__aarch64__)
+         #define M_MIL_USE_64BIT      1
+      #else
+         #define M_MIL_USE_64BIT      0
+      #endif
+
+      #ifndef M_LINUX_KERNEL
+         #define M_LINUX_KERNEL       0
+      #endif
+
+      #ifdef __INTEL_COMPILER
+         #define M_MIL_USE_LINTEL     1
+      #endif
+   #else
+      #define M_MIL_USE_WINDOWS       1
+      #define M_MIL_USE_LINUX         0
+      #define M_MIL_USE_ARM           0
+      #if defined(_WIN64) || defined(WIN64)
+         #define M_MIL_USE_64BIT      1
+      #else
+         #define M_MIL_USE_64BIT      0
+      #endif
+
+      #if (_MSC_VER >= 1400) && !defined(M_MIL_USING_SAFE_CRT)
+         #define M_MIL_USING_SAFE_CRT       1
+      #endif
+   #endif
+
+   #if defined(__POWERPC__)
+#error "PowerPC not supported"
+   #endif
+#endif
+
+#if !(M_MIL_USE_WINDOWS || M_MIL_USE_LINUX)
+#error "You must set at least one compilation flag."
+#endif
+
+#if ( (M_MIL_USE_WINDOWS && M_MIL_USE_LINUX) )
+#error "You must select one and only one compilation flag."
+#endif
+
+
+#if M_MIL_USE_RT
+#define MIL_DLLFUNC //__declspec(dllimport)
+#else
+#define MIL_DLLFUNC
+#endif
+/************************************************************************/
+/*This flag indicates if MIL has been compiled without UNICODE support  */
+/*If MIL supports UNICODE, user can define UNICODE to use UNICODE API   */
+/************************************************************************/
+#if !defined(M_MIL_USE_UNICODE) && !M_MIL_USE_LINUX
+   #define M_MIL_USE_UNICODE 1
+#elif !defined (M_MIL_USE_UNICODE)
+   #define M_MIL_USE_UNICODE 0
+#endif
+
+
+#if defined(UNICODE)
+   #define M_MIL_UNICODE_API 1
+#else
+   #if M_MIL_USE_RT
+      #error "The project must be compiled with Unicode character set"
+   #endif
+   #define M_MIL_UNICODE_API 0
+#endif
+
+#if M_MIL_USE_LINUX || M_MIL_UNICODE_API
+#define M_MIL_USE_TTF_UNICODE 1
+#endif
+
+/************************************************************************/
+/*This flag enable or disable deprecated defines.                       */
+/************************************************************************/
+#if !defined(M_MIL_WARN_ON_DEPRECATED)
+#if (defined(_MSC_VER) && (_MSC_VER >= 1400)) || defined(__INTEL_COMPILER)
+#define M_MIL_WARN_ON_DEPRECATED 1
+#else
+#define M_MIL_WARN_ON_DEPRECATED 0
+#endif
+#endif
+
+#if M_MIL_WARN_ON_DEPRECATED
+   // Define true (1) or false (2) depends on MIL_COMPILE_VERSION and START_VERSION.
+   #if MIL_COMPILE_VERSION >= 1000
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1000 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1000 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1010
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1010 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1010 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1020
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1020 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1020 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1030
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1030 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1030 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1040
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1040 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1040 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1050
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1050 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1050 0
+   #endif
+
+   #if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1060 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1060 0
+   #endif
+   #if MIL_COMPILE_VERSION >= MIL_COMPILE_NEXT_MAJOR_VERSION
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1100 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1100 0
+   #endif
+
+   #define PRIMITIVE_CAT(X, ...)                     X ## __VA_ARGS__
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO(X) PRIMITIVE_CAT(MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_, X)
+   #define IIF(X)                                    PRIMITIVE_CAT(IIF_, X)
+   #define IIF_0(X, ...)                             __VA_ARGS__
+   #define IIF_1(X, ...)                             X
+
+   #define MIL_DEPRECATED(IDENTIFIER, START_VERSION) IIF(MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO(START_VERSION)) (__pragma(deprecated(#IDENTIFIER)), /*nothing*/)
+#else
+   #define MIL_DEPRECATED(IDENTIFIER, START_VERSION)
+#endif
+
+
+#ifndef M_MIL_WARN_ON_DEPRECATED_MOS
+   #define M_MIL_WARN_ON_DEPRECATED_MOS 1
+#endif
+
+
+#ifndef M_MILIM_FUNCTION_DEPRECATION_WARNING
+   #if defined(OldDefinesSupport) && OldDefinesSupport
+      #define M_MILIM_FUNCTION_DEPRECATION_WARNING 1
+   #else
+      #define M_MILIM_FUNCTION_DEPRECATION_WARNING 0
+   #endif
+#endif
+
+/************************************************************************/
+/* DEFAULT STATE INITIALIZATION FLAG                                    */
+/************************************************************************/
+
+//Defines for INSTALLDIR support
+#define M_INSTALL_DIR    MIL_TEXT("///INSTALLDIR///")
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define INSTALL_DIR    M_INSTALL_DIR
+#endif
+#define M_TEMP_DIR     MIL_TEXT("///MILTEMPDIRDIR///")
+#define M_USER_DLL_DIR MIL_TEXT("///MILUSERDLLDIR///")
+
+#if   M_MIL_USE_LINUX
+   #define M_IMAGE_PATH               M_INSTALL_DIR MIL_TEXT("images/")
+   #define M_CONTEXT_PATH             M_INSTALL_DIR MIL_TEXT("contexts/")
+#else
+   #define M_IMAGE_PATH               M_INSTALL_DIR MIL_TEXT("images\\")
+   #define M_CONTEXT_PATH             M_INSTALL_DIR MIL_TEXT("contexts\\")
+#endif
+
+/************************************************************************/
+/* DEFAULT SYSTEM SPECIFICATIONS                                        */
+/************************************************************************/
+
+/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
+#if OldDefinesSupport
+   #define M_DEF_SYSTEM_NUM           M_DEFAULT
+   MIL_DEPRECATED(M_DEF_SYSTEM_NUM, 1000)
+   #define M_SYSTEM_SETUP             M_DEF_SYSTEM_TYPE
+   MIL_DEPRECATED(M_SYSTEM_SETUP, 1000)
+   #define M_DEF_SYSTEM_TYPE          M_SYSTEM_DEFAULT
+   MIL_DEPRECATED(M_DEF_SYSTEM_TYPE, 1000)
+#endif
+
+/************************************************************************/
+/* DEFAULT DIGITIZER SPECIFICATIONS                                     */
+/************************************************************************/
+
+/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
+#if OldDefinesSupport
+   #define M_DEF_DIGITIZER_INIT       M_DEFAULT
+   MIL_DEPRECATED(M_DEF_DIGITIZER_INIT, 1000)
+   #define M_DEF_DIGITIZER_NUM        M_DEFAULT
+   MIL_DEPRECATED(M_DEF_DIGITIZER_NUM, 1000)
+   #define M_CAMERA_SETUP             M_DEF_DIGITIZER_FORMAT
+   MIL_DEPRECATED(M_CAMERA_SETUP, 1000)
+   #define M_DEF_DIGITIZER_FORMAT     MIL_TEXT("M_DEFAULT")
+   MIL_DEPRECATED(M_DEF_DIGITIZER_FORMAT, 1000)
+#endif
+
+/************************************************************************/
+/* DEFAULT DISPLAY SPECIFICATIONS                                       */
+/************************************************************************/
+
+/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
+#if OldDefinesSupport
+   #define M_DEF_DISPLAY_FORMAT               MIL_TEXT("M_DEFAULT")
+   #define M_DISPLAY_SETUP                    M_DEF_DISPLAY_FORMAT
+   MIL_DEPRECATED(M_DISPLAY_SETUP, 1000)
+   MIL_DEPRECATED(M_DEF_DISPLAY_FORMAT, 1000)
+   #define M_DEF_DISPLAY_INIT                 M_DEFAULT
+   MIL_DEPRECATED(M_DEF_DISPLAY_INIT, 1000)
+   #define M_DEF_DISPLAY_NUM                  M_DEFAULT
+   MIL_DEPRECATED(M_DEF_DISPLAY_NUM, 1000)
+#endif
+
+/************************************************************************/
+/* DEFAULT IMAGE BUFFER SPECIFICATIONS                                  */
+/************************************************************************/
+#if OldDefinesSupport
+   #define M_DEF_IMAGE_NUMBANDS_MIN   1
+   MIL_DEPRECATED(M_DEF_IMAGE_NUMBANDS_MIN, 1000)
+   #define M_DEF_IMAGE_SIZE_X_MIN     50
+   MIL_DEPRECATED(M_DEF_IMAGE_SIZE_X_MIN, 1000)
+   #define M_DEF_IMAGE_SIZE_Y_MIN     50
+   MIL_DEPRECATED(M_DEF_IMAGE_SIZE_Y_MIN, 1000)
+   #define M_DEF_IMAGE_SIZE_X_MAX     4000000
+   MIL_DEPRECATED(M_DEF_IMAGE_SIZE_X_MAX, 1000)
+   #define M_DEF_IMAGE_SIZE_Y_MAX     4000000
+   MIL_DEPRECATED(M_DEF_IMAGE_SIZE_Y_MAX, 1000)
+   #define M_DEF_IMAGE_TYPE           (8+M_UNSIGNED)
+   MIL_DEPRECATED(M_DEF_IMAGE_TYPE, 1000)
+   #define M_DEF_IMAGE_ATTRIBUTE_MIN  (M_IMAGE+M_PROC)
+   MIL_DEPRECATED(M_DEF_IMAGE_ATTRIBUTE_MIN, 1000)
+#endif
+
+/************************************************************************/
+/* Enables DMIL monitoring auto-publish mode. 0 == Disabled             */
+/************************************************************************/
+#define M_DEF_AUTO_PUBLISH  0
+
+
+#endif /*__MILSETUP_H__*/
diff --git a/Common_Class/Matrox/Include/mbasictypes.h b/Common_Class/Matrox/Include/mbasictypes.h
new file mode 100644
index 0000000..e19d6c9
--- /dev/null
+++ b/Common_Class/Matrox/Include/mbasictypes.h
@@ -0,0 +1,35 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  mbasictypes.h
+* Revision     :  10.30.0643
+* Content      :  This file contains the definitions of basic types 
+*                 for Matrox Imaging.
+*
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+#ifndef __MATROX_IMAGING_BASIC_TYPES__
+#define __MATROX_IMAGING_BASIC_TYPES__     1
+
+
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+   typedef       unsigned __int64   M_UINT64;
+#else
+   typedef       unsigned long long M_UINT64;
+#endif
+   typedef       unsigned int       M_UINT32;
+   typedef       unsigned short     M_UINT16;
+   typedef       unsigned char      M_UINT8;
+
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+   typedef       __int64            M_INT64;
+#else
+   typedef       long long          M_INT64;
+#endif
+   typedef       int                M_INT32;
+   typedef       short              M_INT16;
+   typedef       char               M_INT8;
+
+#endif 
diff --git a/Common_Class/Matrox/Include/milfpga.h b/Common_Class/Matrox/Include/milfpga.h
new file mode 100644
index 0000000..0900f8a
--- /dev/null
+++ b/Common_Class/Matrox/Include/milfpga.h
@@ -0,0 +1,518 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  milfpga.h
+* Revision     :  10.41.2936
+* Content      :  This file contains the defines necessary to use the
+*                 Matrox Imaging Library FPGA DTK "C" user interface.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2021.
+* All Rights Reserved
+*************************************************************************/
+
+#ifndef __MILFPGA_H__
+#define __MILFPGA_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/************************************************************************/
+/* MIL FPGA context identifier type                                     */
+/************************************************************************/
+typedef void* MIL_FPGA_CONTEXT;
+typedef MIL_INT (MFTYPE* MIL_FPGA_HOOK_FUNCTION_PTR)(  MIL_INT HookType,
+                                                       MIL_ID  EventId,
+                                                       void*   UserDataPtr);
+
+typedef MIL_INT (MFTYPE* MFPGAINQUIRE)(                MIL_ID  SystemId,
+                                                       MIL_INT FpgaDeviceNum,
+                                                       MIL_INT64 InquireType,
+                                                       void*   ResultPtr);
+/************************************************************************/
+/* MIL FPGA API declaration                                             */
+/************************************************************************/
+MIL_INT MFTYPE MfpgaCommandAlloc(  MIL_ID MilSysId,
+                                               MIL_INT DeviceNumber,
+                                               MIL_INT FunctionId,
+                                               MIL_INT SubFunctionId,
+                                               MIL_INT64 FunctionNumber,
+                                               MIL_INT ExecutionMode,
+                                               MIL_INT64 ControlFlag,
+                                               MIL_FPGA_CONTEXT* FpgaCommandContextPtr);
+
+MIL_INT MFTYPE MfpgaCommandFree(   MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 ControlFlag);
+
+#if M_MIL_USE_UNICODE
+
+MIL_INT MFTYPE MfpgaLoadA(         MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_CONST_TEXTA_PTR FirmwareFile,
+                                               MIL_INT64 ControlFlag);
+
+MIL_INT MFTYPE MfpgaLoadW(         MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_CONST_TEXTW_PTR FirmwareFile,
+                                               MIL_INT64 ControlFlag);
+#if M_MIL_UNICODE_API
+#define MfpgaLoad MfpgaLoadW
+#else
+#define MfpgaLoad MfpgaLoadA
+#endif
+#else
+
+MIL_INT MFTYPE MfpgaLoad(          MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_CONST_TEXT_PTR FirmwareFile,
+                                               MIL_INT64 ControlFlag);
+#define MfpgaLoadW MfpgaLoad
+#endif
+
+void MFTYPE MfpgaSetSource(        MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_BUFFER_INFO SrcBuf,
+                                               MIL_INT StreamInputNumber,
+                                               MIL_INT64 ControlFlag);
+
+MIL_INT MFTYPE MfpgaSetDestination(MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_BUFFER_INFO DstBuf,
+                                               MIL_INT StreamOutputNumber,
+                                               MIL_INT64 ControlFlag);
+
+MIL_INT MFTYPE MfpgaSetLink(       MIL_FPGA_CONTEXT SrcFpgaCommandContext,
+                                               MIL_INT SrcStreamPort,
+                                               MIL_FPGA_CONTEXT DstFpgaCommandContext,
+                                               MIL_INT DstStreamPort,
+                                               MIL_INT64 ControlFlag);
+
+void MFTYPE MfpgaCommandQueue(     MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 CompletionMode,
+                                               MIL_INT64 QueueType);
+
+void MFTYPE MfpgaGetRegister(      MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 RegisterSection,
+                                               MIL_INT Offset,
+                                               MIL_INT Length,
+                                               void *ValuePtr,
+                                               MIL_INT64 ReadAccessFlag);
+
+void MFTYPE MfpgaSetRegister(      MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 RegisterSection,
+                                               MIL_INT Offset,
+                                               MIL_INT Length,
+                                               void *ValuePtr,
+                                               MIL_INT64 WriteAccessFlag);
+
+void MFTYPE MfpgaGetAndSetRegister(MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 SrcRegisterBank,
+                                               MIL_INT SrcOffset,
+                                               MIL_INT64 DstRegisterBank,
+                                               MIL_INT DstOffset,
+                                               MIL_INT64 BitMaskRegisterBank,
+                                               MIL_INT BitMaskOffset,
+                                               MIL_INT Length,
+                                               MIL_INT64 ControlFlag);
+
+void MFTYPE MfpgaCommandControl(   MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 ControlType,
+                                               const void *ControlValuePtr);
+
+void MFTYPE MfpgaCommandInquire(   MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 InquireType,
+                                               void *UserVarPtr);
+
+MIL_INT MFTYPE MfpgaInquire(       MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_INT64 InquireType,
+                                               void* UserVarPtr);
+
+MIL_INT MFTYPE MfpgaControl(       MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_INT64 ControlType,
+                                               const void* ControlValuePtr);
+
+void MFTYPE MfpgaHookFunction(     MIL_ID MilSystemId,
+                                               MIL_INT DeviceNumber,
+                                               MIL_INT FunctionId,
+                                               MIL_INT SubFunctionId,
+                                               MIL_INT64 FunctionNumber,
+                                               MIL_INT HookType,
+                                               MIL_FPGA_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                               void *UserDataPtr);
+
+MIL_INT MFTYPE MfpgaGetHookInfo(   MIL_ID EventId,
+                                               MIL_INT64 InfoType,
+                                               void *UserVarPtr);
+
+/************************************************************************/
+/* Transfer unit Function ID  and SubFunction ID definitions            */
+/************************************************************************/
+#define FPGA_HOST_2_AVALON_FID                        0xC001
+#define FPGA_DMA_READ_2_STREAM_FID                    0xC010
+#define FPGA_STREAM_2_DMA_WRITE_FID                   0xC011
+#define FPGA_HSSI_2_AVALON_FID                        0xC012
+
+#define FPGA_HLS_FID                                  0xD000
+#define FPGA_FID                                      0x1000
+#define IS_HLS_FID(x)                                ( (x >= FPGA_HLS_FID) && (x < (FPGA_HLS_FID + 0x1000)))
+
+
+/************************************************************************/
+/* For Processing unit Function ID definitions                          */
+/* see milfunctioncode.h                                                */
+/************************************************************************/
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaSetSource, MfpgaSetDestination and MfpgaSetLink                 */
+/* stream offset defines                                                */
+/*                                                                      */
+/************************************************************************/
+#define M_FPGA_STREAM_INPUT_BIT                 0x10000000
+#define M_FPGA_STREAM_OUTPUT_BIT                0x20000000
+#define M_FPGA_STREAM_IO_MASK                   (M_FPGA_STREAM_INPUT_BIT | M_FPGA_STREAM_OUTPUT_BIT)
+#define M_FPGA_STREAM_IO_FILTER              (~ (M_FPGA_STREAM_INPUT_BIT | M_FPGA_STREAM_OUTPUT_BIT))
+
+#define M_INPUT0                                (M_FPGA_STREAM_INPUT_BIT | 0x00000000)
+#define M_INPUT1                                (M_FPGA_STREAM_INPUT_BIT | 0x00000001)
+#define M_INPUT2                                (M_FPGA_STREAM_INPUT_BIT | 0x00000002)
+#define M_INPUT3                                (M_FPGA_STREAM_INPUT_BIT | 0x00000003)
+#define M_INPUT4                                (M_FPGA_STREAM_INPUT_BIT | 0x00000004)
+#define M_INPUT5                                (M_FPGA_STREAM_INPUT_BIT | 0x00000005)
+#define M_INPUT6                                (M_FPGA_STREAM_INPUT_BIT | 0x00000006)
+#define M_INPUT7                                (M_FPGA_STREAM_INPUT_BIT | 0x00000007)
+#define M_INPUT8                                (M_FPGA_STREAM_INPUT_BIT | 0x00000008)
+#define M_INPUT9                                (M_FPGA_STREAM_INPUT_BIT | 0x00000009)
+
+#define M_OUTPUT0                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000000)
+#define M_OUTPUT1                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000001)
+#define M_OUTPUT2                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000002)
+#define M_OUTPUT3                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000003)
+#define M_OUTPUT4                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000004)
+#define M_OUTPUT5                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000005)
+#define M_OUTPUT6                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000006)
+#define M_OUTPUT7                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000007)
+#define M_OUTPUT8                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000008)
+#define M_OUTPUT9                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000009)
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaSetSource, MfpgaSetDestination and MfpgaSetLink                 */
+/* flag defines                                                         */
+/*                                                                      */
+/************************************************************************/
+//#define M_DEFAULT                             0x10000000L
+#define M_FPGA_FLAG_TYPE                        0xf0000000L
+#define M_FPGA_FLAG_TU_FLAVOR_MASK              0x70000000L
+#define M_FPGA_MULTI_CONTEXT                    0x30000000L
+#define M_FPGA_MULTI_STREAM_PORT                0x40000000L
+#define M_FPGA_DONT_INTERSECT                   0x80000000L
+#define M_FPGA_TU_NUMBER                        0xA0000000L
+
+#define M_CONTEXT0                              (M_FPGA_MULTI_CONTEXT | 0)
+#define M_CONTEXT1                              (M_FPGA_MULTI_CONTEXT | 1)
+#define M_CONTEXT2                              (M_FPGA_MULTI_CONTEXT | 2)
+#define M_CONTEXT3                              (M_FPGA_MULTI_CONTEXT | 3)
+
+#define M_FPGA_FLIP_VERTICAL                    0x01000000L
+#define M_FPGA_FLIP_HORIZONTAL                  0x02000000L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaCommandQueue completion mode defines                            */
+/*                                                                      */
+/************************************************************************/
+//#define M_DEFAULT                             0x10000000L
+#define M_PROCESSING_COMPLETED                  0x00000001L
+#define M_DESTINATION_WRITTEN                   0x00000002L
+#define M_SOURCE_READ                           0x00000003L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaCommandQueue flags                                              */
+/*                                                                      */
+/************************************************************************/
+//#define M_DEFAULT                             0x10000000L
+//#define M_WAIT                                1L
+#define M_DISPATCH                              2L
+#define M_DISPATCH_IMMEDIATE                    3L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaGetRegister/MfpgaSetRegister Register bank defines              */
+/*                                                                      */
+/************************************************************************/
+#define M_USER                                  0x00000001L
+#define M_STREAMER_BASE                         0x00000002L
+#define M_PU_BASE                               0x00000003L
+#define M_FPGA_BASE                             0x00000004L
+#define M_ABSOLUTE_BASE                         0x00000005L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaGetRegister/MfpgaSetRegister Flag defines                       */
+/*                                                                      */
+/************************************************************************/
+#define M_WHEN_DISPATCHED                       1
+#define M_WHEN_COMPLETED                        2
+#define M_AFTER_DISPATCHED                      3
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaGetError                                                        */
+/*                                                                      */
+/************************************************************************/
+#define M_FPGA_ERROR_CODE     1
+#define M_FPGA_ERROR_MESSAGE  2
+#define M_FPGA_ERROR_SYSTEM   3
+#define M_FPGA_ERROR_DELETE   0x80000000L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaInquire / MfpgaControl                                          */
+/*                                                                      */
+/************************************************************************/
+#define M_MAX_NB_OF_PUS                      512
+#define M_MAX_NB_OF_PORTS                    255
+#define M_NUMBER_OF_PU                       0x1000
+#define M_NUMBER_OF_TU                       0x1001
+#define M_PU_LIST                            0x1002
+#define M_TU_LIST                            0x1003
+#define M_FPGA_PACKAGE_NAME                  (0x1005|M_CLIENT_ENCODING)
+#define M_FPGA_PACKAGE_NAME_LENGTH           0x1004
+#define M_FPGA_CONFIGURATION_FILENAME       (0x1007|M_CLIENT_ENCODING)
+#define M_FPGA_CONFIGURATION_FILENAME_LENGTH 0x1006
+#define M_FPGA_CONFIG                        0x1008
+#define M_FPGA_BUILD_NUMBER                  0x1009
+#define M_PU_SELECT                          0x1010
+
+#define M_PU_NAME                            (0x1100|M_CLIENT_ENCODING)
+/* Reserve next 511 values           from    (0x1100) */
+/*                                   to      (0x12ff) */
+#define M_PU_NAME_LENGTH                     (M_PU_NAME + M_STRING_SIZE)
+#define M_TU_NAME                            (0x1300|M_CLIENT_ENCODING)
+/* Reserve next 511 values           from    (0x1300) */
+/*                                   to      (0x14ff) */
+#define M_TU_NAME_LENGTH                     (M_TU_NAME + M_STRING_SIZE)
+#define M_PU_FID                             0x1500
+/* Reserve next 511 values           from    (0x1500 */
+/*                                   to      (0x16ff */
+#define M_TU_FID                             0x1700
+/* Reserve next 511 values           from    (0x1700 */
+/*                                   to      (0x18ff */
+#define M_FPGA_CONFIGURATION                 (0x1900|M_CLIENT_ENCODING)
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaCommandInquire                                                  */
+/*                                                                      */
+/************************************************************************/
+#define M_MINOR_VERSION                      0x2000
+#define M_MAJOR_VERSION                      0x2001
+#define M_FUNCTION_ID                        0x2003
+#define M_INSTANCE_ID                        0x2004
+#define M_REG_USER_SIZE                      0x2005
+#define M_REG_FULL_SIZE                      0x2006
+#define M_REG_USER_OFFSET                    0x2007
+#define M_REG_IOCTL_OFFSET                   0x2008
+#define M_NUMBER_OF_EVENTS                   0x2009
+#define M_CAPABILITY                         0x200A
+#define M_SUB_FUNCTION_ID                    0x200B
+#define M_NUMBER_OF_INPUTS                   2835L  // used in milclass.h 0xB13
+#define M_NUMBER_OF_OUTPUTS                  2836L  // used in milclass.h 0xB14
+
+// M_PORT_NAME is ored with M_FPGA_STREAM_IO_MASK (0x30000000)
+#define M_PORT_NAME                          (0x2200|M_CLIENT_ENCODING)
+/* Reserve next 255 values           from    (0x2200 */
+/*                                   to      (0x22FF */
+#define M_PORT_NAME_LENGTH                   (M_PORT_NAME + M_STRING_SIZE)
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaCommandControl                                                  */
+/*                                                                      */
+/************************************************************************/
+#define M_FPGA_CMD_CTRL_TYPE_MASK            0x0FFFF000L
+#define M_COMPLETION_MODE                    0x00003000L
+#define M_STREAM_OUTPUT_FORMAT               0x00004000L
+
+#define M_FPGA_OVERSCAN                      0x00005000L
+#define M_LEFT                               0x00000100L
+#define M_RIGHT                              0x00000200L
+#define M_TOP                                0x00000400L
+#define M_BOTTOM                             0x00000800L
+#define M_FPGA_OVERSCAN_POSITION_MASK        (M_LEFT|M_RIGHT|M_TOP|M_BOTTOM)
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaHookFunction                                                     */
+/*                                                                      */
+/************************************************************************/
+#define M_END_OF_PROCESSING                  0x0001
+#define M_INTERRUPT_OVERRUN                  0x0080
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaGetHookInfo                                                     */
+/*                                                                      */
+/************************************************************************/
+//#define M_TIME_STAMP                       0x0040
+//#define M_FUNCTION_ID                      0x2003
+//#define M_INSTANCE_ID                      0x2004
+//#define M_SUB_FUNCTION_ID                  0x200B
+#define M_FPGA_DEVICE_NUMBER                 0x2100
+
+#define M_IN_FPGA_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) (false)
+#define M_IN_FPGA_INQUIRE_STRING_RANGE(X)          (((X&~M_CLIENT_TEXT_ENCODING) == M_FPGA_PACKAGE_NAME) || \
+                                                   (((X&~M_CLIENT_TEXT_ENCODING) >= M_PU_NAME) && ((X&~M_CLIENT_TEXT_ENCODING) < (M_PU_NAME + M_MAX_NB_OF_PUS))) ||\
+                                                   (((X&~M_CLIENT_TEXT_ENCODING) >= M_TU_NAME) && ((X&~M_CLIENT_TEXT_ENCODING) < (M_TU_NAME + M_MAX_NB_OF_PUS))))
+
+#define M_IN_FPGA_INQUIRE_DOUBLE_RANGE(X)          (false)
+#define M_IN_FPGA_INQUIRE_MIL_INT64_RANGE(X)       (false)
+#define M_FPGA_INQUIRE_MUST_HAVE_USER_PTR(X)       (M_IN_FPGA_INQUIRE_STRING_RANGE(X)          || \
+                                                    M_IN_FPGA_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)  )
+
+#ifdef __cplusplus
+   }
+#endif
+
+#if M_MIL_USE_STRING
+
+#if defined(__cplusplus) && !defined(__MIL_AVX_H__) && (!defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL) && (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE)
+inline MIL_INT MFTYPE MfpgaInquire(MIL_ID SystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_STRING &ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MfpgaInquire(SystemId, FpgaDeviceNum, InquireType + M_STRING_SIZE, &InternalStringSize);
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+   return RetValue;
+   }
+
+inline void MFTYPE MfpgaCommandInquire(MIL_FPGA_CONTEXT FpgaCommandContext,
+                                       MIL_INT64 InquireType,
+                                       MIL_STRING &UserVarPtr)
+   {
+   MIL_INT InternalStringSize = 0;
+
+   MfpgaCommandInquire(FpgaCommandContext, InquireType + M_STRING_SIZE, &InternalStringSize);
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MfpgaCommandInquire(FpgaCommandContext, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+   return;
+   }
+
+#if M_MIL_USE_VECTOR
+
+inline MIL_INT MFTYPE MfpgaInquire(MIL_ID SystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, std::vector<MIL_STRING> &ResultArrayPtr)
+   {
+   MIL_INT RetValue = 0;
+
+   if(InquireType == M_PU_NAME)
+      {
+      MIL_INT numberOfPUs = 0;
+
+      MfpgaInquire(SystemId, FpgaDeviceNum, M_NUMBER_OF_PU, &numberOfPUs);
+      ResultArrayPtr.resize(numberOfPUs);
+
+      for(MIL_INT i = 0; i < numberOfPUs; i++)
+         {
+         MIL_INT InternalStringSize = 0;
+         MfpgaInquire(SystemId, FpgaDeviceNum, M_PU_NAME + i + M_STRING_SIZE, &InternalStringSize);
+
+         if(InternalStringSize > 0)
+            {
+            ResultArrayPtr[i].assign(InternalStringSize, MIL_TEXT('\0'));
+            RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, M_PU_NAME + i, &ResultArrayPtr[i][0]);
+            ResultArrayPtr[i].resize(InternalStringSize - 1);
+
+            }
+         }
+      }
+   else
+      {
+      if(InquireType == M_TU_NAME)
+         {
+         MIL_INT numberOfTUs = 0;
+
+         MfpgaInquire(SystemId, FpgaDeviceNum, M_NUMBER_OF_TU, &numberOfTUs);
+         ResultArrayPtr.resize(numberOfTUs);
+
+         for(MIL_INT i = 0; i < numberOfTUs; i++)
+            {
+            MIL_INT InternalStringSize = 0;
+            MfpgaInquire(SystemId, FpgaDeviceNum, M_TU_NAME + i + M_STRING_SIZE, &InternalStringSize);
+
+            if(InternalStringSize > 0)
+               {
+               ResultArrayPtr[i].assign(InternalStringSize, MIL_TEXT('\0'));
+               RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, M_TU_NAME + i, &ResultArrayPtr[i][0]);
+               ResultArrayPtr[i].resize(InternalStringSize - 1);
+
+               }
+            }
+         }
+      else
+         {
+#if M_MIL_USE_SAFE_TYPE
+         SafeTypeError(MIL_TEXT("MfpgaInquire"), MIL_TEXT("Inquire type compatible with std::vector<MIL_STRING> overload."));
+#endif
+         }
+      }
+
+   return RetValue;
+   }
+#endif
+
+#endif
+
+#if M_MIL_USE_VECTOR
+inline MIL_INT MFTYPE MfpgaInquire(MIL_ID SystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, std::vector<MIL_INT> &ResultArrayPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT numberOfPUs = 0;
+
+   if(InquireType == M_PU_LIST)
+      {
+      MfpgaInquire(SystemId, FpgaDeviceNum, M_NUMBER_OF_PU, &numberOfPUs);
+      if(numberOfPUs)
+         {
+         ResultArrayPtr.resize(numberOfPUs);
+         RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, InquireType, &ResultArrayPtr[0]);
+         }
+      else
+         {
+         ResultArrayPtr.resize(0);
+         }
+      }
+   else
+      {
+      ResultArrayPtr.resize(1);
+      RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, InquireType, &ResultArrayPtr[0]);
+      }
+
+   return RetValue;
+   }
+#endif
+
+
+#endif // __cplusplus
+
+
+
+#endif
+
diff --git a/Common_Class/Matrox/Include/milfuncll.h b/Common_Class/Matrox/Include/milfuncll.h
new file mode 100644
index 0000000..4adc178
--- /dev/null
+++ b/Common_Class/Matrox/Include/milfuncll.h
@@ -0,0 +1,74 @@
+锘�//MfuncBuf DTK functions
+
+/***************************************************************************/
+/*
+
+    Filename:  MILFUNC.H
+    Revision:  10.40.0640
+
+    Content :  This file contains the prototypes for the Matrox
+               Imaging Library (MIL) MfuncBuf DTK functions.
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef __MFUNCBUF_H
+#define __MFUNCBUF_H
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef __MILBUFFERINFO_H__
+#if !M_MIL_USE_CPP_FUNC_BUF
+typedef void* MIL_BUFFER_INFO;
+MIL_DOUBLE MFTYPE MfuncBufMaxValue(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_DOUBLE MFTYPE MfuncBufMinValue(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_ID MFTYPE MfuncBufDriverId(MIL_BUFFER_INFO BufferInfoPtr);
+void* MFTYPE MfuncBufHostAddress(MIL_BUFFER_INFO BufferInfoHandle);
+void* MFTYPE MfuncBufHostAddressBand(MIL_BUFFER_INFO BufferInfoHandle, MIL_INT Band);
+MIL_UINT64  MFTYPE MfuncBufPhysicalAddressBand(MIL_BUFFER_INFO BufferInfoHandle, MIL_INT Band);
+MIL_UINT64 MFTYPE MfuncBufPhysicalAddress(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufSizeX(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufSizeY(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufSizeBand(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufSizeBit(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufType(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufPitch(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufPitchByte(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT64 MFTYPE MfuncBufAttribute(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT64 MFTYPE MfuncBufFormat(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT64 MFTYPE MfuncBufFlags(MIL_BUFFER_INFO BufInfoPtr);
+MIL_INT MFTYPE MfuncBufLockable(MIL_BUFFER_INFO BufInfoPtr);
+MIL_INT MFTYPE MfuncBufParentOffsetX(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufParentOffsetY(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufParentOffsetBand(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufAncestorOffsetX(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufAncestorOffsetY(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufAncestorOffsetBand(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufAncestorOffsetBit(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufNativeId(MIL_BUFFER_INFO BufInfoPtr);
+MIL_ID MFTYPE MfuncBufId(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_ID MFTYPE MfuncBufHostId(MIL_BUFFER_INFO BufInfoPtr);
+MIL_ID MFTYPE MfuncBufParentId(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_ID MFTYPE MfuncBufAncestorId(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_ID MFTYPE MfuncBufOwnerSystemId(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufOwnerSystemType(MIL_BUFFER_INFO BufferInfoHandle);
+#endif 
+#else
+MIL_DLLFUNC MIL_DOUBLE MFTYPE MfuncBufMaxValue(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_DLLFUNC MIL_DOUBLE MFTYPE MfuncBufMinValue(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_DLLFUNC MIL_ID MFTYPE MfuncBufDriverId(MIL_BUFFER_INFO BufferInfoPtr);
+#endif 
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/Common_Class/Matrox/Include/milstring.h b/Common_Class/Matrox/Include/milstring.h
new file mode 100644
index 0000000..4b976af
--- /dev/null
+++ b/Common_Class/Matrox/Include/milstring.h
@@ -0,0 +1,1852 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILSTRING.H
+    Owner   :  Matrox Imaging
+    Revision:  10.40.0640
+    Content :  This file contains the MIL_STRING overload for the Matrox
+    Imaging Library (MIL)
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+    */
+/***************************************************************************/
+#ifndef __MILPROTO_H
+#error milproto.h required
+#else
+
+#ifndef __MILSTRING_H__
+#define __MILSTRING_H__
+
+/************************************************************************/
+/* SUPPORT FOR MIL_STRING                                               */
+/************************************************************************/
+#ifndef M_MIL_USE_STRING
+#if defined(__cplusplus) && !defined(__MIL_AVX_H__) && (!defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL) && (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE)
+   #define M_MIL_USE_STRING 1
+#else
+   #define M_MIL_USE_STRING 0
+#endif
+#endif
+
+#if M_MIL_USE_STRING
+
+#if M_MIL_USE_LINUX
+#include <string.h>
+#endif
+#include <string>
+#include <sstream>
+
+#define M_STATIC_STRING_SIZE 64
+
+typedef std::basic_string<MIL_TEXT_CHAR, std::char_traits<MIL_TEXT_CHAR>, std::allocator<MIL_TEXT_CHAR> >
+MIL_STRING;
+
+typedef std::basic_stringstream<MIL_TEXT_CHAR, std::char_traits<MIL_TEXT_CHAR>, std::allocator<MIL_TEXT_CHAR> >
+MIL_STRING_STREAM;
+
+#if M_MIL_UNICODE_API                    
+#define M_TO_STRING(X) std::to_wstring(X)
+#else                                     
+#define M_TO_STRING(X) std::to_string(X)
+#endif
+
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#define milstring       MIL_STRING
+#define milstringstream MIL_STRING_STREAM
+#endif
+
+#if M_MIL_UNICODE_API
+#if (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE)
+#define     MOs_UseDeprecatedStrLength   wcslen
+#endif
+#elif (M_MIL_USE_WINDOWS)
+#if !(defined(M_WINDOWS_NT_KERNEL_MODE) && M_WINDOWS_NT_KERNEL_MODE) 
+#define     MOs_UseDeprecatedStrLength   strlen
+#endif // !M_WINDOWS_NT_KERNEL_MODE 
+#elif M_MIL_USE_LINUX
+#define     MOs_UseDeprecatedStrLength   strlen
+#endif
+
+/***************************************************************************/
+/* FUNC MODULE                                                             */
+/***************************************************************************/
+inline void MFTYPE MfuncParamValue(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_STRING &ParamValuePtr)
+   {
+   //No need to inquire text since MfuncParamMilText will return the address of the string content
+   MfuncParamValue(ContextFuncId, ParamIndex, const_cast<MIL_TEXT_PTR>(ParamValuePtr.c_str()));
+   }
+
+inline void MFTYPE MfuncParamMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_STRING &ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute)
+   {
+   //No need to inquire text since MfuncParamMilText will return the address of the string content
+   MfuncParamMilText(ContextFuncId, ParamIndex, const_cast<MIL_TEXT_PTR>(ParamValuePtr.c_str()), NumOfItems, Attribute);
+   }
+
+inline void MFTYPE MfuncParamConstMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_STRING &ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute)
+   {
+   MfuncParamConstMilText(ContextFuncId, ParamIndex, ParamValuePtr.c_str(), NumOfItems, Attribute);
+   }
+
+inline void MFTYPE MfuncParamFilename(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_STRING& ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute)
+   {
+   MfuncParamFilename(ContextFuncId, ParamIndex, ParamValuePtr.c_str(), NumOfItems, Attribute);
+   }
+
+inline MIL_ID MFTYPE MfuncAlloc(const MIL_STRING &FunctionName, MIL_INT ParameterNum, MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr, const MIL_STRING &SlaveFunctionDLLName,
+                                const MIL_STRING &SlaveFunctionName, MIL_INT SlaveFunctionOpcode, MIL_INT64 InitFlag, MIL_ID *CBasedContextFuncIdPtr)
+   {
+   return MfuncAlloc(FunctionName.c_str(), ParameterNum, SlaveFunctionPtr, SlaveFunctionDLLName.c_str(), SlaveFunctionName.c_str(), SlaveFunctionOpcode, InitFlag, CBasedContextFuncIdPtr);
+   }
+
+inline MIL_ID MFTYPE MfuncAllocScript(const MIL_STRING &FunctionName, MIL_INT ParameterNum, const MIL_STRING &InterpreterLanguage, const MIL_STRING &ScriptFileName,
+                                      const MIL_STRING &ScriptFunctionName, MIL_INT ScriptFunctionOpcode, MIL_INT64 InitFlag, MIL_ID *ScriptBasedContextFuncIdPtr)
+   {
+   return MfuncAllocScript(FunctionName.c_str(), ParameterNum, InterpreterLanguage.c_str(), ScriptFileName.c_str(), ScriptFunctionName.c_str(),
+                           ScriptFunctionOpcode, InitFlag, ScriptBasedContextFuncIdPtr);
+   }
+
+inline MIL_ID MFTYPE MfuncAllocScript(const MIL_STRING &FunctionName, MIL_INT ParameterNum, MIL_CONST_TEXT_PTR InterpreterLanguage, const MIL_STRING &ScriptFileName,
+                                      const MIL_STRING &ScriptFunctionName, MIL_INT ScriptFunctionOpcode, MIL_INT64 InitFlag, MIL_ID *ScriptBasedContextFuncIdPtr)
+   {
+   return MfuncAllocScript(FunctionName.c_str(), ParameterNum, InterpreterLanguage, ScriptFileName.c_str(), ScriptFunctionName.c_str(),
+                           ScriptFunctionOpcode, InitFlag, ScriptBasedContextFuncIdPtr);
+   }
+
+inline MIL_INT MFTYPE MfuncErrorReport(MIL_ID ContextFuncId, MIL_INT ErrorCode, const MIL_STRING &ErrorMessage, const MIL_STRING &ErrorSubMessage1,
+                                       const MIL_STRING &ErrorSubMessage2, const MIL_STRING &ErrorSubMessage3)
+   {
+   return MfuncErrorReport(ContextFuncId, ErrorCode, ErrorMessage.c_str(), ErrorSubMessage1.c_str(), ErrorSubMessage2.c_str(), ErrorSubMessage3.c_str());
+   }
+
+inline MIL_INT MFTYPE MfuncPrintMessage(MIL_INT Mode, const MIL_STRING &Str1, const MIL_STRING &Str2, const MIL_STRING &Str3, const MIL_STRING &Str4, const MIL_STRING &Str5)
+   {
+   return MfuncPrintMessage(Mode, Str1.c_str(), Str2.c_str(), Str3.c_str(), Str4.c_str(), Str5.c_str());
+   }
+
+//// MfuncInquireSafeType is not activated because too many undocumented InquireTypes with various pointer types.
+//#if M_MIL_USE_SAFE_TYPE
+//inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_STRING    &UserVarPtr)
+//   {
+//   MIL_INT RetValue = 0;
+//
+//   //Test if InquireType is in string range
+//   if(M_IN_FUNC_INQUIRE_STRING_RANGE(InquireType))
+//      {
+//      MIL_INT InternalStringSize = 0;
+//      MfuncInquireSafeType(ObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+//
+//      if(InternalStringSize > 0)
+//         {
+//         UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+//         RetValue = MfuncInquireSafeTypeExecute(ObjectId, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+//         UserVarPtr.resize(InternalStringSize - 1);
+//         }
+//      }
+//   else
+//      {
+//      SafeTypeError(MIL_TEXT("MfuncInquire: Inquire type not in string range"));
+//      }
+//   return RetValue;
+//   }
+//
+//#else
+inline MIL_INT MFTYPE MfuncInquire(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_STRING    &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MfuncInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT InternalStringSize = 0;
+   MfuncInquire(ObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MfuncInquire(ObjectId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+      
+      }
+
+   return RetValue;
+   }
+//#endif
+
+/***************************************************************************/
+/* GRAPHIC MODULE                                                          */
+/***************************************************************************/
+#if M_MIL_USE_64BIT
+inline void MFTYPE MgraText(MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, const MCppParameter& XStart, const MCppParameter& YStart, MIL_STRING StringPtr)
+   {
+   MgraText(ContextGraId, DstImageBufOrListGraId, XStart, YStart, (MIL_CONST_TEXT_PTR)StringPtr.c_str());
+   }
+#else //different prototype are used for 32-bit
+inline void MFTYPE MgraText(MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, MIL_DOUBLE XStart, MIL_DOUBLE YStart, MIL_STRING StringPtr)
+   {
+   MgraText(ContextGraId, DstImageBufOrListGraId, XStart, YStart, (MIL_CONST_TEXT_PTR)StringPtr.c_str());
+   }
+
+#endif //M_MIL_USE_64BIT
+
+/***************************************************************************/
+/* BUFFER MODULE                                                          */
+/***************************************************************************/
+inline void MFTYPE MbufExportSequence(const MIL_STRING& FileName, MIL_INT64 FileFormat, const MIL_ID * BufArrayPtrOrSystemIdPtr, MIL_INT NumOfIds, MIL_DOUBLE FrameRate, MIL_INT64 ControlFlag)
+   {
+   return MbufExportSequence(FileName.c_str(), FileFormat, BufArrayPtrOrSystemIdPtr, NumOfIds, FrameRate, ControlFlag);
+   }
+
+inline void MFTYPE MbufExport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_ID SrcBufId)
+   {
+   return MbufExport(FileName.c_str(), FileFormat, SrcBufId);
+   }
+
+inline void MFTYPE MbufImportSequence(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_ID *BufArrayPtr, MIL_INT StartImage, MIL_INT NumberOfImages, MIL_INT64 ControlFlag)
+   {
+   return MbufImportSequence(FileName.c_str(), FileFormat, Operation, SystemId, BufArrayPtr, StartImage, NumberOfImages, ControlFlag);
+   }
+
+inline MIL_ID MFTYPE MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_ID* BufIdPtr)
+   {
+   return MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, BufIdPtr);
+   }
+
+inline void MFTYPE MbufLoad(const MIL_STRING& FileName, MIL_ID BufId)
+   {
+   return MbufLoad(FileName.c_str(), BufId);
+   }
+
+inline MIL_ID MFTYPE MbufRestore(const MIL_STRING& FileName, MIL_ID SystemId, MIL_ID* BufIdPtr)
+   {
+   return MbufRestore(FileName.c_str(), SystemId, BufIdPtr);
+   }
+
+inline void MFTYPE MbufSave(const MIL_STRING& FileName, MIL_ID BufId)
+   {
+   return MbufSave(FileName.c_str(), BufId);
+   }
+
+#if M_MIL_USE_SAFE_TYPE
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if(UserVarPtr != M_NULL)
+      SafeTypeError(MIL_TEXT("MbufDiskInquire"));
+
+   return MbufDiskInquire(FileName.c_str(), InquireType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MbufDiskInquire(FileName.c_str(), InquireType, M_NULL);
+   }
+#endif
+inline MIL_INT MFTYPE MbufDiskInquireUnsafe(const MIL_STRING& FileName, MIL_INT64 InquireType, void        *UserVarPtr) { return MbufDiskInquireUnsafe(FileName.c_str(), InquireType, UserVarPtr); }
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr) { return MbufDiskInquireSafeTypeExecute(FileName.c_str(), InquireType, UserVarPtr, M_TYPE_MIL_INT); }
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) { return MbufDiskInquireSafeTypeExecute(FileName.c_str(), InquireType, UserVarPtr, M_TYPE_DOUBLE); }
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr) { return MbufDiskInquireSafeTypeExecute(FileName.c_str(), InquireType, UserVarPtr, M_TYPE_MIL_INT); }
+#endif
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING    &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MbufInquireFeatureSafeType(BufId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+   }
+
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING&        UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str(), M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeature(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int               UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t                   )
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+#endif // MIL_COMPILE_VERSION >= 1020
+
+#else /* MIL_SAFE_TYPE */
+inline MIL_INT MFTYPE MbufDiskInquire(const MIL_STRING& FileName, MIL_INT64 InquireType, void * UserVarPtr)
+   {
+   return MbufDiskInquire(FileName.c_str(), InquireType, UserVarPtr);
+   }
+
+#if (MIL_COMPILE_VERSION >= 1020)   
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+#if !M_MIL_USE_SAFE_TYPE
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MbufInquireFeature(BufId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+#endif
+
+inline void MFTYPE MbufControlFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MbufControlFeature(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufControlFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MbufControlFeature(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+#endif // MIL_COMPILE_VERSION >= 1020
+#endif /* M_MIL_USE_SAFETYPE */   
+
+/***************************************************************************/
+/* APP MODULE                                                              */
+/***************************************************************************/
+inline void MFTYPE MappOpenConnection(const MIL_STRING& ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr)
+   {
+   return MappOpenConnection(ConnectionDescriptor.c_str(), InitFlag, ControlFlag, RemoteContextAppIdPtr);
+   }
+
+inline MIL_ID MFTYPE MappAlloc(const MIL_STRING& ServerDescription, MIL_INT64 InitFlag, MIL_ID* ContextAppIdPtr)
+   {
+   return MappAlloc(ServerDescription.c_str(), InitFlag, ContextAppIdPtr);
+   }
+
+inline void MFTYPE MappTrace(MIL_ID ContextAppId, MIL_INT64 TraceType, MIL_INT64 TraceTag, MIL_INT64 TraceValue, const MIL_STRING &TraceString)
+   {
+   return MappTrace(ContextAppId, TraceType, TraceTag, TraceValue, TraceString.c_str());
+   }
+
+
+#if M_MIL_USE_SAFE_TYPE
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_STRING&      ErrorPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ErrorType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappGetError"), MIL_TEXT("Error type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT InternalStringSize = 0;
+   MIL_INT RetValue = 0;
+   MappGetErrorSafeType(ErrorType + M_STRING_SIZE, &InternalStringSize);
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetErrorSafeTypeExecute(ErrorType, &ErrorPtr[0], M_TYPE_TEXT_CHAR);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_STRING      &ErrorPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ErrorType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappGetError"), MIL_TEXT("Error type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MappGetErrorSafeType(ContextAppId, ErrorType + M_STRING_SIZE, &InternalStringSize);
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetErrorSafeTypeExecute(ContextAppId, ErrorType, &ErrorPtr[0], M_TYPE_TEXT_CHAR);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING       &ErrorPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InfoType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"), MIL_TEXT("Info type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   //Resize to M_ERROR_MESSAGE_SIZE first
+   MappGetHookInfoSafeType(EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetHookInfoSafeTypeExecute(EventId, InfoType, &ErrorPtr[0], M_TYPE_TEXT_CHAR);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING       &ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InfoType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"), MIL_TEXT("Info type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MappGetHookInfoSafeType(ContextAppId, EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, &ResultPtr[0], M_TYPE_TEXT_CHAR);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MappInquireSafeType(InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappInquireSafeTypeExecute(InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(MOs_UseDeprecatedStrLength(UserVarPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_STRING&      UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MappInquireSafeType(ContextAppId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappInquireSafeTypeExecute(ContextAppId, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(MOs_UseDeprecatedStrLength(UserVarPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline void MFTYPE MappFileOperationUnsafe(MIL_ID                  Comp1ContextAppId,
+                                           const MIL_STRING&       Comp1FileName,
+                                           MIL_ID                  Comp2ContextAppId,
+                                           const MIL_STRING&       Comp2FileName,
+                                           MIL_INT64               Operation,
+                                           MIL_INT64               OperationFlag,
+                                           void*                   OperationDataPtr)
+   {
+   MappFileOperationUnsafe(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                  Comp1ContextAppId,
+                                             const MIL_STRING&       Comp1FileName,
+                                             MIL_ID                  Comp2ContextAppId,
+                                             const MIL_STRING&       Comp2FileName,
+                                             MIL_INT64               Operation,
+                                             MIL_INT64               OperationFlag,
+                                             int                     OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                  Comp1ContextAppId,
+                                             int                     Comp1FileName,
+                                             MIL_ID                  Comp2ContextAppId,
+                                             const MIL_STRING&       Comp2FileName,
+                                             MIL_INT64               Operation,
+                                             MIL_INT64               OperationFlag,
+                                             int                     OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                  Comp1ContextAppId,
+                                             const MIL_STRING&       Comp1FileName,
+                                             MIL_ID                  Comp2ContextAppId,
+                                             int                     Comp2FileName,
+                                             MIL_INT64               Operation,
+                                             MIL_INT64               OperationFlag,
+                                             int                     OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+
+
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                     Comp1ContextAppId,
+                                             const MIL_STRING&           Comp1FileName,
+                                             MIL_ID                     Comp2ContextAppId,
+                                             int                        Comp2FileName,
+                                             MIL_INT64                  Operation,
+                                             MIL_INT64                  OperationFlag,
+                                             MIL_INT*                   OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                     Comp1ContextAppId,
+                                             const MIL_STRING&           Comp1FileName,
+                                             MIL_ID                     Comp2ContextAppId,
+                                             int                        Comp2FileName,
+                                             MIL_INT64                  Operation,
+                                             MIL_INT64                  OperationFlag,
+                                             MIL_TEXT_PTR               OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperation(MIL_ID             Comp1ContextAppId,
+                                     const MIL_STRING& Comp1FileName,
+                                     MIL_ID            Comp2ContextAppId,
+                                     const MIL_STRING& Comp2FileName,
+                                     MIL_INT64        Operation,
+                                     MIL_INT64        OperationFlag,
+                                     void*            OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperation(MIL_ID             Comp1ContextAppId,
+                                     const MIL_STRING& Comp1FileName,
+                                     MIL_ID            Comp2ContextAppId,
+                                     int Comp2FileName,
+                                     MIL_INT64        Operation,
+                                     MIL_INT64        OperationFlag,
+                                     void*            OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, (MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperation(MIL_ID                  Comp1ContextAppId,
+                                     MIL_CONST_TEXT_PTR      Comp1FileName,
+                                     MIL_ID                  Comp2ContextAppId,
+                                     int                     Comp2FileName,
+                                     MIL_INT64               Operation,
+                                     MIL_INT64               OperationFlag,
+                                     void*                   OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId,(MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                     Comp1ContextAppId,
+                                             const MIL_STRING&           Comp1FileName,
+                                             MIL_ID                     Comp2ContextAppId,
+                                             int                        Comp2FileName,
+                                             MIL_INT64                  Operation,
+                                             MIL_INT64                  OperationFlag,
+                                             MIL_STRING&                OperationDataPtr)
+   {
+
+   MIL_INT InternalStringSize = 0;
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation + M_STRING_SIZE, OperationFlag, &InternalStringSize);
+
+   if (InternalStringSize > 0)
+      {
+      OperationDataPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation , OperationFlag, &OperationDataPtr[0]);
+      OperationDataPtr.resize(InternalStringSize - 1);
+      }
+   }
+
+#else /* !M_MIL_USE_SAFE_TYPE */
+
+inline MIL_INT MFTYPE MappGetHookInfo(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING       &ErrorPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   MappGetHookInfo(ContextAppId, EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetHookInfo(ContextAppId, EventId, InfoType, &ErrorPtr[0]);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING       &ErrorPtr)
+   {
+   return MappGetHookInfo(M_DEFAULT, EventId, InfoType, ErrorPtr);
+   }
+
+inline MIL_INT MFTYPE MappInquire(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_STRING&      UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+
+   MIL_INT InternalStringSize = 0;
+   MappInquire(ContextAppId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappInquire(ContextAppId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(MOs_UseDeprecatedStrLength(UserVarPtr.c_str()));
+      }
+
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappInquire(MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+   return MappInquire(M_DEFAULT, InquireType, UserVarPtr);
+   }
+inline MIL_INT MFTYPE MappGetError(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_STRING&      ErrorPtr)
+   {
+   MIL_INT RetValue = 0;
+
+
+   MIL_INT InternalStringSize = 0;
+   MappGetError(ContextAppId, ErrorType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetError(ContextAppId, ErrorType, &ErrorPtr[0]);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetError(MIL_INT64 ErrorType, MIL_STRING&      ErrorPtr)
+   {
+   return MappGetError(M_DEFAULT, ErrorType, ErrorPtr);
+   }
+
+
+inline void MFTYPE MappFileOperation(MIL_ID             Comp1ContextAppId,
+                                      const MIL_STRING& Comp1FileName,
+                                      MIL_ID            Comp2ContextAppId,
+                                      const MIL_STRING& Comp2FileName,
+                                      MIL_INT64        Operation,
+                                      MIL_INT64        OperationFlag,
+                                      void*            OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperation(MIL_ID             Comp1ContextAppId,
+                                      const MIL_STRING& Comp1FileName,
+                                      MIL_ID            Comp2ContextAppId,
+                                      int Comp2FileName,
+                                      MIL_INT64        Operation,
+                                      MIL_INT64        OperationFlag,
+                                      void*            OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, (MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperation(MIL_ID                  Comp1ContextAppId,
+                                     MIL_CONST_TEXT_PTR      Comp1FileName,
+                                     MIL_ID                  Comp2ContextAppId,
+                                     int                     Comp2FileName,
+                                     MIL_INT64               Operation,
+                                     MIL_INT64               OperationFlag,
+                                     void*                   OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId,(MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperation(MIL_ID                  Comp1ContextAppId,
+                                     const MIL_STRING&       Comp1FileName,
+                                     MIL_ID                  Comp2ContextAppId,
+                                     int                     Comp2FileName,
+                                     MIL_INT64               Operation,
+                                     MIL_INT64               OperationFlag,
+                                     MIL_STRING&             OperationDataPtr)
+   {
+
+   MIL_INT InternalStringSize = 0;
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, (MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation + M_STRING_SIZE, OperationFlag, &InternalStringSize);
+   if (InternalStringSize > 0)
+      {
+      OperationDataPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, (MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, &OperationDataPtr[0]);
+      OperationDataPtr.resize(InternalStringSize - 1);
+      }
+   }
+#endif /* M_MIL_USE_SAFE_TYPE*/
+
+/***************************************************************************/
+/* SYS MODULE                                                              */
+/***************************************************************************/
+inline void MsysControl(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ControlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MsysControl"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MsysControl(SysId, ControlType, ControlValue.c_str());
+   }
+
+
+inline MIL_ID MFTYPE MsysAlloc(MIL_ID ContextAppId, const MIL_STRING &SystemDescriptor, MIL_INT SystemNum, MIL_INT64 InitFlag, MIL_ID* SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor.c_str(), SystemNum, InitFlag, SysIdPtr);
+   }
+inline MIL_ID MFTYPE MsysAlloc(MIL_ID ContextAppId, const MIL_STRING &SystemDescriptor, const MIL_STRING &SystemNum, MIL_INT64 InitFlag, MIL_ID* SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor.c_str(), SystemNum.c_str(), InitFlag, SysIdPtr);
+   }
+
+#if M_MIL_USE_SAFE_TYPE
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING      &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MsysInquireFeatureSafeType(SysId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING       &UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str(), M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeature(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int               UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+#endif // (MIL_COMPILE_VERSION >= 1020)
+
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_STRING&       UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MsysIoInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysIoInquireSafeType(IoObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MsysGetHookInfo"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysGetHookInfoSafeType(SysId, EventId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, &ResultPtr[0], M_TYPE_STRING_PTR);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MsysInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysInquireSafeType(SysId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysInquireSafeTypeExecute(SysId, InquireType, &ResultPtr[0], M_TYPE_TEXT_CHAR);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MbufInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MbufInquireSafeType(BufId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MbufInquireSafeTypeExecute(BufId, InquireType, &ResultPtr[0], M_TYPE_TEXT_CHAR);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+#else /* !M_MIL_USE_SAFE_TYPE*/
+
+inline MIL_INT MFTYPE MsysIoInquire(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_STRING        UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+
+   MIL_INT InternalStringSize = 0;
+   MsysIoInquire(IoObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysIoInquire(IoObjectId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline MIL_INT MFTYPE MsysGetHookInfo(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysGetHookInfo(SysId, EventId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysGetHookInfo(SysId, EventId, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020)*/    
+inline MIL_INT MFTYPE MsysInquire(MIL_ID SysId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysInquire(SysId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysInquire(SysId, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MbufInquire(MIL_ID SysId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MbufInquire(SysId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MbufInquire(SysId, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MsysInquireFeatureW(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeatureW(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureW(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MsysControlFeatureW(SysId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+
+inline void MFTYPE MsysControlFeatureW(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MsysControlFeatureW(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+
+inline void MFTYPE MsysInquireFeatureW(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MsysInquireFeatureW(SysId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MsysInquireFeatureW(SysId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#else
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MsysInquireFeatureA(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeatureA(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureA(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MsysControlFeatureA(SysId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+
+inline void MFTYPE MsysControlFeatureA(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MsysControlFeatureA(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+
+inline void MFTYPE MsysInquireFeatureA(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MsysInquireFeatureA(SysId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MsysInquireFeatureA(SysId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#endif /* M_MIL_UNICODE_API */
+#else
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MsysControlFeature(SysId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+
+inline void MFTYPE MsysControlFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MsysControlFeature(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MsysInquireFeature(SysId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+#endif /* M_MIL_USE_UNICODE*/
+
+#endif
+/***************************************************************************/
+/* OBJ MODULE                                                              */
+/***************************************************************************/
+inline MIL_INT MFTYPE MobjInquire(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_STRING  &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MobjInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MobjInquire(ObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MobjInquire(ObjectId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+inline void MobjControl(MIL_ID ObjectId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ControlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MobjControl"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MobjControl(ObjectId, ControlType, ControlValue.c_str());
+   }
+
+/***************************************************************************/
+/* DIG MODULE                                                              */
+/***************************************************************************/
+inline void MdigControl(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ControlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MdigControl"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MdigControl(DigId, ControlType, ControlValue.c_str());
+   }
+
+/***************************************************************************/
+/* BUF MODULE                                                              */
+/***************************************************************************/
+inline void MFTYPE MbufInquireContainer(MIL_ID ContainerId, MIL_INT64 TargetObject, MIL_INT64 InquireType, MIL_STRING    &UserVarPtr)
+   {
+   if(M_IN_BUF_INQUIRE_STRING_RANGE(InquireType))
+      {
+      MIL_INT InternalStringSize = 0;
+      MbufInquireContainer(ContainerId, TargetObject, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+      if(InternalStringSize > 0)
+         {
+         UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+         MbufInquireContainer(ContainerId, TargetObject, InquireType, &UserVarPtr[0]);
+         UserVarPtr.resize(MOs_UseDeprecatedStrLength(UserVarPtr.c_str()));
+         }
+      }
+#if M_MIL_USE_SAFE_TYPE	  
+   else
+      {
+      SafeTypeError(MIL_TEXT("MbufInquireContainer: Inquire type not in string range"));
+      }
+#endif	  
+   }
+
+inline void MbufControl(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if ((ControlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MbufControl"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MbufControl(BufId, ControlType, ControlValue.c_str());
+   }
+
+inline void MbufControlContainer(MIL_ID ContainerId, MIL_INT64 TargetObject, MIL_INT64 CtrlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((CtrlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MbufControlContainer"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MbufControlContainer(ContainerId, TargetObject, CtrlType, ControlValue.c_str());
+   }
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+inline MIL_ID MFTYPE MdigAllocW(MIL_ID SystemId, MIL_INT DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAllocW(SystemId, DigNum, DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+inline MIL_ID MFTYPE MdigAllocW(MIL_ID SystemId, const MIL_STRING& DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAllocW(SystemId, DigNum.c_str(), DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+#else
+inline MIL_ID MFTYPE MdigAllocA(MIL_ID SystemId, MIL_INT DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAllocA(SystemId, DigNum, DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+inline MIL_ID MFTYPE MdigAllocA(MIL_ID SystemId, const MIL_STRING& DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAllocA(SystemId, DigNum.c_str(), DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+#endif /* M_MIL_UNICODE_API */
+#else
+inline MIL_ID MFTYPE MdigAlloc(MIL_ID SystemId, MIL_INT DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, DigNum, DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+inline MIL_ID MFTYPE MdigAlloc(MIL_ID SystemId, const MIL_STRING&  DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, DigNum.c_str(), DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+#endif /* M_MIL_USE_UNICODE */
+
+#if M_MIL_USE_SAFE_TYPE
+#if (MIL_COMPILE_VERSION >= 1020)
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING&     ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InfoType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MdigGetHookInfo"), MIL_TEXT("Info type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MdigGetHookInfoSafeType(EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdigGetHookInfoSafeTypeExecute(EventId, InfoType, &ResultPtr[0], M_TYPE_STRING_PTR);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING&     UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MdigInquireFeatureSafeTypeW(DigId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING      &UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str(), M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int              UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, UserVarType);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#endif
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#else
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING&      UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MdigInquireFeatureSafeTypeA(DigId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING&               UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str());
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64              *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE             *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32              *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8              *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool                   *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int                     UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64             *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#endif
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#endif /* M_MIL_UNICODE_API */
+#else
+
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING&      UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MdigInquireFeatureSafeType(DigId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeature(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureSafeType(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigInquireFeatureSafeType(DigId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING&       UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str(), M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeature(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int               UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+#endif   /* M_MIL_USE_UNICODE */
+
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MdigInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MdigInquireSafeType(DigId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdigInquireExecute(DigId, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#else
+inline MIL_INT MFTYPE MdigInquire(MIL_ID DigId, MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MdigInquire(DigId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdigInquire(DigId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MdigInquireFeature(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MdigInquireFeature(DigId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MdigInquireFeature(DigId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+
+inline void MFTYPE MdigControlFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MdigControlFeature(DigId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigControlFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MdigControlFeature(DigId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline MIL_INT MFTYPE MdigGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING&    ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   MdigGetHookInfo(EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdigGetHookInfo(EventId, InfoType, &ResultPtr[0]);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#endif /* M_MIL_USE_SAFE_TYPE */
+
+/***************************************************************************/
+/* COM MODULE                                                              */
+/***************************************************************************/
+#ifdef  __MILCOM_H__
+inline MIL_INT MFTYPE McomInquire(MIL_ID ComId, MIL_INT64  InquireType, MIL_STRING &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("McomInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   McomInquire(ComId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = McomInquire(ComId, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif
+
+/***************************************************************************/
+/* SEQ MODULE                                                              */
+/***************************************************************************/
+
+#if  !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+inline void MFTYPE MseqDefine(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 SequenceType, const MIL_STRING& Param1Ptr, MIL_DOUBLE Param2)
+   {
+   MseqDefine(ContextSeqId, SequenceIndex, SequenceType, Param1Ptr.c_str(), Param2);
+   }
+
+#if M_MIL_USE_SAFE_TYPE
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_STRING       &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MseqInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MseqInquireSafeType(ContextSeqId, SequenceIndex, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#else
+inline MIL_INT MFTYPE MseqInquire(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_STRING       &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MseqInquire(ContextSeqId, SequenceIndex, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MseqInquire(ContextSeqId, SequenceIndex, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#endif
+
+//Undefined MOs_UseDeprecatedStrLength
+#ifdef  MOs_UseDeprecatedStrLength
+#undef  MOs_UseDeprecatedStrLength
+#endif
+
+
+#endif //#!M_MIL_USE_LINUX
+#endif /* M_MIL_USE_STRING */
+#endif /* __MILSTRING_H__ */	
+#endif /* __MILPROTO_H */
diff --git a/Common_Class/Matrox/Include/miluniqueid.h b/Common_Class/Matrox/Include/miluniqueid.h
new file mode 100644
index 0000000..0d25982
--- /dev/null
+++ b/Common_Class/Matrox/Include/miluniqueid.h
@@ -0,0 +1,554 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  miluniqueid.h
+* Revision     :  10.40.0640
+* Content      :  MIL_UNIQUE_ID C++ RAII class for a MIL_ID
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+#ifndef __UNIQUE_MIL_ID_H
+#define __UNIQUE_MIL_ID_H
+
+#ifndef M_MIL_USE_MIL_UNIQUE_ID
+   #if defined(__cplusplus) && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL) && (!defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL) && (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE)
+      #define M_MIL_USE_MIL_UNIQUE_ID 1
+   #else
+      #define M_MIL_USE_MIL_UNIQUE_ID 0
+   #endif
+#endif
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+typedef void (MFTYPE MilFreeFuncType)(MIL_ID Id);
+
+#if M_MIL_USE_SAFE_TYPE
+
+template <MilFreeFuncType FreeFunc>
+inline bool MilIsCorrectObjectType(MIL_INT64 ObjectType);
+
+// Functions used in debug to report an error if a MIL object ends up in the wrong
+// MIL_UNIQUE_ID type.
+
+template <> inline bool MilIsCorrectObjectType<&MappFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_APPLICATION;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MappCloseConnection>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_APPLICATION;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MbufFree>(MIL_INT64 ObjectType)
+   {
+   return M_IS_BUFFER_TYPE(ObjectType) || ObjectType == M_CONTAINER;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MdigFree>(MIL_INT64 ObjectType)
+   {
+   return M_IS_DIGITIZER_TYPE(ObjectType);
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MgraFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_GRAPHIC_CONTEXT || ObjectType == M_GRAPHIC_LIST;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MobjFree>(MIL_INT64 ObjectType)
+   {
+   return (ObjectType == M_MESSAGE_MAILBOX) ||
+          (ObjectType == M_HOOK_CONTEXT) ||
+          (ObjectType == M_OPAQUE_HOOK_CONTEXT) ||
+          (ObjectType == M_HTTP_SERVER);
+   }
+
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+template <> inline bool MilIsCorrectObjectType<&MseqFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_SEQUENCE_CONTEXT;
+   }
+#endif
+template <> inline bool MilIsCorrectObjectType<&MsysFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_SYSTEM;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MsysIoFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_SYS_IO_CONTEXT;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MthrFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_EVENT || ObjectType == M_SYSTEM_THREAD || ObjectType == M_MUTEX;
+   }
+
+template <MilFreeFuncType FreeFunc>
+inline void MilCheckObjectType(MIL_ID Id)
+   {
+   if (!M_ID_IS_VIRTUAL_OR_NULL(Id))
+      {
+      MIL_INT64 ObjectType;
+      MobjInquire(Id, M_OBJECT_TYPE, &ObjectType);
+      if (!MilIsCorrectObjectType<FreeFunc>(ObjectType))
+         SafeTypeError(MIL_TEXT("allocation function"), MIL_TEXT("Mismatch between object type and MIL_UNIQUE_ID type."));
+      }
+   }
+
+#define MIL_CHECK_OBJECT_TYPE(Id, FreeFunc) MilCheckObjectType<FreeFunc>(Id)
+
+#else
+
+// In release, there is no check at ID acquisition. When the free function is called,
+// a MIL error is reported if the object type is incorrect.
+#define MIL_CHECK_OBJECT_TYPE(Id, FreeFunc)
+
+#endif
+
+// MIL_ID wrapper that manages its lifetime by calling the corresponding free function
+// in the destructor. Interface similar to std::unique_ptr.
+template <MilFreeFuncType FreeFunc>
+class MIL_UNIQUE_ID
+   {
+   public:
+      explicit MIL_UNIQUE_ID(MIL_ID Id = M_NULL) MIL_NOEXCEPT
+         : m_Id(Id)
+         {
+         MIL_CHECK_OBJECT_TYPE(m_Id, FreeFunc);
+         }
+
+      ~MIL_UNIQUE_ID() MIL_NOEXCEPT
+         {
+         free_id();
+         }
+
+#if M_MIL_USE_MOVE_SEMANTICS
+      MIL_UNIQUE_ID(MIL_UNIQUE_ID&& Other) MIL_NOEXCEPT
+         : m_Id(Other.m_Id)
+         {
+         Other.m_Id = M_NULL;
+         }
+
+      MIL_UNIQUE_ID& operator=(MIL_UNIQUE_ID&& Other) MIL_NOEXCEPT
+         {
+         if (&Other != this)
+            {
+            free_id();
+            m_Id = Other.m_Id;
+            Other.m_Id = M_NULL;
+            }
+         return *this;
+         }
+
+      // Forbid construction from MIL_UNIQUE_ID of a different type.
+      // (Could happen because of implicit conversion to MIL_ID)
+      template <MilFreeFuncType FreeFunc2>
+      MIL_UNIQUE_ID(const MIL_UNIQUE_ID<FreeFunc2>&) = delete;
+#endif
+
+#if M_MIL_USE_NULLPTR
+      MIL_UNIQUE_ID& operator=(std::nullptr_t) MIL_NOEXCEPT
+         {
+         reset();
+         return *this;
+         }
+#endif
+
+      MIL_ID release() MIL_NOEXCEPT
+         {
+         MIL_ID Id = m_Id;
+         m_Id = M_NULL;
+         return Id;
+         }
+
+      void reset(MIL_ID NewId = M_NULL) MIL_NOEXCEPT
+         {
+         if (NewId != m_Id)
+            {
+            free_id();
+            m_Id = NewId;
+            }
+         MIL_CHECK_OBJECT_TYPE(m_Id, FreeFunc);
+         }
+
+      MIL_ID get() const MIL_NOEXCEPT
+         {
+         return m_Id;
+         }
+
+#if M_MIL_USE_REF_QUALIFIERS
+      // Allow implicit conversion to MIL_ID only on non-temporary MIL_UNIQUE_IDs.
+      operator MIL_ID() const & MIL_NOEXCEPT
+         {
+         return m_Id;
+         }
+      operator MIL_ID() && = delete;
+#else
+      operator MIL_ID() const MIL_NOEXCEPT
+         {
+         return m_Id;
+         }
+#endif
+
+      friend void swap(MIL_UNIQUE_ID& lhs, MIL_UNIQUE_ID& rhs) MIL_NOEXCEPT
+         {
+         MIL_ID lhsId = lhs.m_Id;
+         lhs.m_Id = rhs.m_Id;
+         rhs.m_Id = lhsId;
+         }
+
+   private:
+#ifndef M_MIL_USE_MOVE_SEMANTICS
+      // Copy is forbidden
+      MIL_UNIQUE_ID(const MIL_UNIQUE_ID&);
+      MIL_UNIQUE_ID& operator=(const MIL_UNIQUE_ID&);
+#endif
+
+      void free_id() MIL_NOEXCEPT
+         {
+         if (!M_ID_IS_VIRTUAL_OR_NULL(m_Id))
+            FreeFunc(m_Id);
+         }
+
+      MIL_ID m_Id;
+   };
+
+// Specific MIL_UNIQUE_ID instantiations for each free function.
+typedef MIL_UNIQUE_ID<&MappFree  > MIL_UNIQUE_APP_ID;
+typedef MIL_UNIQUE_ID<&MappCloseConnection> MIL_UNIQUE_CONNECTION_ID;
+typedef MIL_UNIQUE_ID<&MbufFree  > MIL_UNIQUE_BUF_ID;
+typedef MIL_UNIQUE_ID<&MdigFree  > MIL_UNIQUE_DIG_ID;
+typedef MIL_UNIQUE_ID<&MgraFree  > MIL_UNIQUE_GRA_ID;
+typedef MIL_UNIQUE_ID<&MobjFree  > MIL_UNIQUE_OBJ_ID;
+typedef MIL_UNIQUE_ID<&MsysFree  > MIL_UNIQUE_SYS_ID;
+typedef MIL_UNIQUE_ID<&MsysIoFree> MIL_UNIQUE_SYSIO_ID;
+typedef MIL_UNIQUE_ID<&MthrFree  > MIL_UNIQUE_THR_ID;
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+typedef MIL_UNIQUE_ID<&MseqFree  > MIL_UNIQUE_SEQ_ID;
+#endif
+
+// Factory functions that wrap all MIL allocation functions to return a MIL_UNIQUE_ID
+// instead of a MIL_ID. To use the factory function, simply replace the last
+// MIL_ID* parameter with M_UNIQUE_ID.
+
+#if M_MIL_USE_MOVE_SEMANTICS
+
+// Structure used for tag dispatching in the C++ overloads below.
+struct MIL_UNIQUE_ID_TAG {};
+#define M_UNIQUE_ID  MIL_UNIQUE_ID_TAG()
+
+// Structure used to accept an array of either MIL_UNIQUE_IDs or MIL_IDs.
+struct MilConstArrayIdParam
+   {
+   const MIL_ID* m_IdArrayPtr;
+
+   inline MilConstArrayIdParam(const MIL_ID* p) : m_IdArrayPtr(p) {}
+
+   template <MilFreeFuncType FreeFunc>
+   inline MilConstArrayIdParam(const MIL_UNIQUE_ID<FreeFunc>* p)
+      : m_IdArrayPtr(reinterpret_cast<const MIL_ID*>(p))
+      {
+      static_assert(sizeof(MIL_UNIQUE_ID<FreeFunc>[2]) == sizeof(MIL_ID[2]),
+                    "cannot cast const MIL_UNIQUE_ID<FreeFunc>* to const MIL_ID*");
+      }
+   };
+
+// Generic implementation of MxxxStream C++ overloads for MIL_UNIQUE_IDs.
+template <MilFreeFuncType FreeFunc>
+inline void MxxxStreamForMilUniqueId(MilStreamParam         MemPtrOrFileName,
+                                     MIL_ID                 SysId           ,
+                                     MIL_INT64              Operation       ,
+                                     MIL_INT64              StreamType      ,
+                                     MIL_DOUBLE             Version         ,
+                                     MIL_INT64              ControlFlag     ,
+                                     MIL_UNIQUE_ID<FreeFunc>* UniqueIdPtr     ,
+                                     MIL_INT*               SizeByteVarPtr  ,
+                                     M_XXX_STREAM_FUNCTION  MxxxStream      )
+   {
+   MIL_ID TempId = UniqueIdPtr->get();
+   (*MxxxStream)(MemPtrOrFileName, SysId, Operation, StreamType, Version, ControlFlag, &TempId, SizeByteVarPtr);
+   if (Operation & M_RESTORE)
+      UniqueIdPtr->reset(TempId);
+   }
+
+
+// APP
+inline MIL_UNIQUE_APP_ID MappAlloc(MIL_CONST_TEXT_PTR ServerDescription, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_APP_ID(MappAlloc(ServerDescription, InitFlag, M_NULL));
+   }
+inline MIL_UNIQUE_CONNECTION_ID MappOpenConnection(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   MIL_ID RemoteContextAppId = M_NULL;
+   MappOpenConnection(ConnectionDescriptor, InitFlag, ControlFlag, &RemoteContextAppId);
+   return MIL_UNIQUE_CONNECTION_ID(RemoteContextAppId);
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_APP_ID MappAlloc(const MIL_STRING& ServerDescription, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_APP_ID(MappAlloc(ServerDescription, InitFlag, M_NULL));
+   }
+inline MIL_UNIQUE_CONNECTION_ID MappOpenConnection(const MIL_STRING& ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   MIL_ID RemoteContextAppId = M_NULL;
+   MappOpenConnection(ConnectionDescriptor, InitFlag, ControlFlag, &RemoteContextAppId);
+   return MIL_UNIQUE_CONNECTION_ID(RemoteContextAppId);
+   }
+#endif
+template <MilFreeFuncType FreeFunc> inline void MappFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+template <MilFreeFuncType FreeFunc> inline void MappCloseConnection(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// BUF
+inline MIL_UNIQUE_BUF_ID MbufAlloc1d(MIL_ID SystemId, MIL_INT SizeX, MIL_INT Type, MIL_INT64 Attribute, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAlloc1d(SystemId, SizeX, Type, Attribute, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufAlloc2d(MIL_ID SystemId, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAlloc2d(SystemId, SizeX, SizeY, Type, Attribute, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufAllocColor(MIL_ID SystemId, MIL_INT SizeBand, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAllocColor(SystemId, SizeBand, SizeX, SizeY, Type, Attribute, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufAllocDefault(MIL_ID SysId, MIL_ID RefMilObjectId, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_INT64 ControlValue, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAllocDefault(SysId, RefMilObjectId, Attribute, ControlFlag, ControlValue, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufAllocContainer(MIL_ID SysId, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAllocContainer(SysId, Attribute, ControlFlag, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChild1d(MIL_ID ParentBufId, MIL_INT OffX, MIL_INT SizeX, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChild1d(ParentBufId, OffX, SizeX, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChild2d(MIL_ID ParentBufId, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChild2d(ParentBufId, OffX, OffY, SizeX, SizeY, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChildColor2d(MIL_ID ParentBufId, MIL_INT Band, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChildColor2d(ParentBufId, Band, OffX, OffY, SizeX, SizeY, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChildColor2dClip(MIL_ID ParentBufId, MIL_INT Band, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT* StatusPtr, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChildColor2dClip(ParentBufId, Band, OffX, OffY, SizeX, SizeY, StatusPtr, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChildColor(MIL_ID ParentBufId, MIL_INT Band, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChildColor(ParentBufId, Band, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChildContainer(MIL_ID ContId, MIL_INT ComponentCriteriaSize, const MIL_INT64* ComponentCriteriaArrayPtr, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChildContainer(ContId, ComponentCriteriaSize, ComponentCriteriaArrayPtr, ControlFlag, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufClone(MIL_ID SrcBufId, MIL_ID SysId, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufClone(SrcBufId, SysId, SizeX, SizeY, Type, Attribute, ControlFlag, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufCreate2dFunc(MIL_ID SystemId, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_INT Pitch, MIL_DATA_PTR DataPtr, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufCreate2dFunc(SystemId, SizeX, SizeY, Type, Attribute, ControlFlag, Pitch, DataPtr, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufCreateColor(MIL_ID SystemId, MIL_INT SizeBand, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_INT Pitch, void** ArrayOfDataPtr, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufCreateColor(SystemId, SizeBand, SizeX, SizeY, Type, Attribute, ControlFlag, Pitch, ArrayOfDataPtr, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufRestore(MIL_CONST_TEXT_PTR FileName, MIL_ID SystemId, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufRestore(FileName, SystemId, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_BUF_ID MbufRestore(const MIL_STRING& FileName, MIL_ID SystemId, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufRestore(FileName, SystemId, M_NULL));
+   }
+#endif
+template <MilFreeFuncType FreeFunc> inline void MbufFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+inline void MbufExportSequence(
+      MIL_CONST_TEXT_PTR   FileName                ,
+      MIL_INT64            FileFormat              ,
+      MilConstArrayIdParam BufArrayPtrOrSystemIdPtr,
+      MIL_INT              NumOfIds                ,
+      MIL_DOUBLE           FrameRate               ,
+      MIL_INT64            ControlFlag             )
+   {
+   MbufExportSequence(FileName, FileFormat, BufArrayPtrOrSystemIdPtr.m_IdArrayPtr,
+                      NumOfIds, FrameRate, ControlFlag);
+   }
+inline MIL_ID MbufImport(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, int)
+   {
+   return MbufImport(FileName, FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+   }
+#if M_MIL_USE_NULLPTR
+inline MIL_ID MbufImport(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, std::nullptr_t)
+   {
+   return MbufImport(FileName, FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+   }
+#endif 
+inline MIL_ID MbufImport(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_UNIQUE_BUF_ID* BufIdPtr)
+   {
+   if (BufIdPtr)
+      {
+      MIL_ID TempBufId = BufIdPtr->get();
+      MIL_ID ReturnValue = MbufImport(FileName, FileFormat, Operation, SystemId, &TempBufId);
+      if (Operation & M_RESTORE)
+         BufIdPtr->reset(TempBufId);
+      return ReturnValue;
+      }
+   else
+      {
+      return MbufImport(FileName, FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+      }
+   }
+inline  MIL_UNIQUE_BUF_ID MbufImport(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_UNIQUE_ID_TAG)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if ((Operation & M_RESTORE) != M_RESTORE)
+      SafeTypeError(MIL_TEXT("MbufImport"), MIL_TEXT("This overload only supports the M_RESTORE operation."));
+#endif
+   return MIL_UNIQUE_BUF_ID(MbufImport(FileName, FileFormat, Operation, SystemId, M_NULL));
+   }
+
+#if M_MIL_USE_STRING
+inline void MbufExportSequence(
+      const MIL_STRING&    FileName                ,
+      MIL_INT64            FileFormat              ,
+      MilConstArrayIdParam BufArrayPtrOrSystemIdPtr,
+      MIL_INT              NumOfIds                ,
+      MIL_DOUBLE           FrameRate               ,
+      MIL_INT64            ControlFlag             )
+   {
+   MbufExportSequence(FileName.c_str(), FileFormat, BufArrayPtrOrSystemIdPtr.m_IdArrayPtr,
+                      NumOfIds, FrameRate, ControlFlag);
+   }
+inline MIL_ID MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, int)
+   {
+   return MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+   }
+#if M_MIL_USE_NULLPTR
+inline MIL_ID MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, std::nullptr_t)
+   {
+   return MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+   }
+#endif
+inline MIL_ID MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_UNIQUE_BUF_ID* BufIdPtr)
+   {
+   return MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, BufIdPtr);
+   }
+inline  MIL_UNIQUE_BUF_ID MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_UNIQUE_ID_TAG)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(Operation != M_RESTORE)
+      SafeTypeError(MIL_TEXT("MbufImport"), MIL_TEXT("This overload only supports the M_RESTORE operation."));
+#endif
+   return MIL_UNIQUE_BUF_ID(MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, M_NULL));
+   }
+#endif
+
+inline void MbufStream(MilStreamParam     MemPtrOrFileName,
+                       MIL_ID             SysId,
+                       MIL_INT64          Operation,
+                       MIL_INT64          StreamType,
+                       MIL_DOUBLE         Version,
+                       MIL_INT64          ControlFlag,
+                       MIL_UNIQUE_BUF_ID* MbufIdPtr,
+                       MIL_INT*           SizeByteVarPtr)
+   {
+   MxxxStreamForMilUniqueId(MemPtrOrFileName, SysId, Operation, StreamType, Version, ControlFlag, MbufIdPtr, SizeByteVarPtr, MbufStream);
+   }
+
+// DIG
+inline MIL_UNIQUE_DIG_ID MdigAlloc(MIL_ID SystemId, MIL_INT DigNum, MIL_CONST_TEXT_PTR DataFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_DIG_ID(MdigAlloc(SystemId, DigNum, DataFormat, InitFlag, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_DIG_ID MdigAlloc(MIL_ID SystemId, MIL_INT DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_DIG_ID(MdigAlloc(SystemId, DigNum, DataFormat, InitFlag, M_NULL));
+   }
+#endif
+template <MilFreeFuncType FreeFunc> inline void MdigFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+inline void MdigProcess(
+   MIL_ID                    DigId,
+   MilConstArrayIdParam      DestImageArrayPtr,
+   MIL_INT                   ImageCount,
+   MIL_INT64                 Operation,
+   MIL_INT64                 OperationFlag,
+   MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr,
+   void*                     UserDataPtr)
+   {
+   MdigProcess(DigId, DestImageArrayPtr.m_IdArrayPtr, ImageCount,
+               Operation, OperationFlag, HookHandlerPtr, UserDataPtr);
+   }
+
+// GRA
+inline MIL_UNIQUE_GRA_ID MgraAlloc(MIL_ID SysId, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_GRA_ID(MgraAlloc(SysId, M_NULL));
+   }
+inline MIL_UNIQUE_GRA_ID MgraAllocList(MIL_ID SysId, MIL_INT ListGraType, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_GRA_ID(MgraAllocList(SysId, ListGraType, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MgraFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// OBJ
+inline MIL_UNIQUE_OBJ_ID MobjAlloc(MIL_ID SysId, MIL_INT64 ObjectType, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_OBJ_ID(MobjAlloc(SysId, ObjectType, InitFlag, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MobjFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// SEQ
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+inline MIL_UNIQUE_SEQ_ID MseqAlloc(MIL_ID SystemId, MIL_INT64 SequenceType, MIL_INT64 Operation, MIL_UINT32 OutputFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_SEQ_ID(MseqAlloc(SystemId, SequenceType, Operation, OutputFormat, InitFlag, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MseqFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+#endif
+
+// SYS
+inline MIL_UNIQUE_SYS_ID MsysAlloc(MIL_ID ContextAppId, MIL_CONST_TEXT_PTR SystemDescriptor, MIL_INT SystemNum, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_SYS_ID(MsysAlloc(ContextAppId, SystemDescriptor, SystemNum, InitFlag, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_SYS_ID MsysAlloc(MIL_ID ContextAppId, const MIL_STRING& SystemDescriptor, MIL_INT SystemNum, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_SYS_ID(MsysAlloc(ContextAppId, SystemDescriptor, SystemNum, InitFlag, M_NULL));
+   }
+#endif
+template <MilFreeFuncType FreeFunc> inline void MsysFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// SYSIO
+inline MIL_UNIQUE_SYSIO_ID MsysIoAlloc(MIL_ID SysId, MIL_INT64 IoCmdListNum, MIL_INT64 Type, MIL_INT64 CounterSrc, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_SYSIO_ID(MsysIoAlloc(SysId, IoCmdListNum, Type, CounterSrc, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MsysIoFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// THR
+inline MIL_UNIQUE_THR_ID MthrAlloc(MIL_ID SystemId, MIL_INT64 ObjectType, MIL_INT64 ControlFlag, MIL_THREAD_FUNCTION_PTR ThreadFctPtr, void *UserDataPtr, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_THR_ID(MthrAlloc(SystemId, ObjectType, ControlFlag, ThreadFctPtr, UserDataPtr, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MthrFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+inline MIL_INT MthrWaitMultiple(MilConstArrayIdParam EventArrayIdPtr, MIL_INT EventArraySize, MIL_INT64 WaitOption, MIL_INT *StatePtr)
+   {
+   return MthrWaitMultiple(EventArrayIdPtr.m_IdArrayPtr, EventArraySize, WaitOption, StatePtr);
+   }
+
+#endif // #if M_MIL_USE_MOVE_SEMANTICS
+
+#endif // #if M_MIL_USE_MIL_UNIQUE_ID
+
+#endif // #ifndef __UNIQUE_MIL_ID_H
diff --git a/Common_Class/Matrox/Include/milvector.h b/Common_Class/Matrox/Include/milvector.h
new file mode 100644
index 0000000..ca0ee6d
--- /dev/null
+++ b/Common_Class/Matrox/Include/milvector.h
@@ -0,0 +1,2279 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILVECTOR.H
+    Owner   :  Matrox Imaging
+    Revision:  10.40.0640
+    Content :  This file contains the std::vector overload for the Matrox
+    Imaging Library (MIL)
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+    */
+/***************************************************************************/
+#ifndef __MILPROTO_H
+#error milproto.h required
+#else
+
+#ifndef __MILVECTOR_H__
+#define __MILVECTOR_H__
+
+/************************************************************************/
+/* SUPPORT FOR std::vector                                              */
+/************************************************************************/
+#ifndef M_MIL_USE_VECTOR
+#if (!defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL) && (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE) && (!defined(M_WINDOWS_CE_KERNEL_MODE) || !M_WINDOWS_CE_KERNEL_MODE) &&  defined(__cplusplus)
+#define M_MIL_USE_VECTOR 1
+#else
+#define M_MIL_USE_VECTOR 0
+#endif
+#endif
+
+/************************************************************************/
+/* SUPPORT FOR std::vector                                              */
+/************************************************************************/
+#if M_MIL_USE_VECTOR
+#include <vector>
+
+// Struct used for getting the MIL data type flag of a data type.
+template <typename UserType>
+struct MilTraits;
+
+#define DECLARE_MIL_TRAITS(Type, MilDataTypeFlag, MilBufferTypeFlag)       \
+template <>                                                                \
+struct MilTraits<Type>                                                     \
+   {                                                                       \
+   static const MIL_INT64 TypeFlag = MilDataTypeFlag;                      \
+   static const MIL_INT64 BufferTypeFlag = MilBufferTypeFlag;              \
+   }
+
+#define RUN_BUFINQUIRE_RETURNIFFAIL(MacroBufId, MacroInquireType, MacroUserVarptr)   \
+   MbufInquire(MacroBufId, MacroInquireType, MacroUserVarptr);                       \
+   if(*MacroUserVarptr == 0) {                                                        \
+      return;                                                                        \
+      }                                                                              
+
+DECLARE_MIL_TRAITS(MIL_INT8  , M_TYPE_CHAR      , M_SIGNED   + 8 );
+DECLARE_MIL_TRAITS(MIL_UINT8 , M_TYPE_MIL_UINT8 , M_UNSIGNED + 8 );
+DECLARE_MIL_TRAITS(MIL_UINT16, M_DEFAULT        , M_UNSIGNED + 16);
+DECLARE_MIL_TRAITS(MIL_UINT32, M_DEFAULT        , M_UNSIGNED + 32);
+DECLARE_MIL_TRAITS(MIL_INT16 , M_TYPE_MIL_INT16 , M_SIGNED   + 16);
+DECLARE_MIL_TRAITS(MIL_INT32 , M_TYPE_MIL_INT32 , M_SIGNED   + 32);
+DECLARE_MIL_TRAITS(MIL_INT64 , M_TYPE_MIL_INT64 , M_SIGNED   + 64);
+DECLARE_MIL_TRAITS(MIL_FLOAT , M_TYPE_MIL_FLOAT , M_FLOAT    + 32);
+DECLARE_MIL_TRAITS(MIL_DOUBLE, M_TYPE_MIL_DOUBLE, M_FLOAT    + 64);
+DECLARE_MIL_TRAITS(MIL_UUID  , M_TYPE_MIL_UUID  , M_INVALID      );
+
+// Class used as any array parameter in C++ overloads of any functions that takes std::vector.
+class CMilArrayParamOut
+   {
+   public:
+      inline CMilArrayParamOut(int Value): m_pParamVector(M_NULL), m_ParamValue(Value), m_MilDataType(M_NULL) {}
+#if M_MIL_USE_NULLPTR
+      inline CMilArrayParamOut(std::nullptr_t) : m_pParamVector(M_NULL), m_ParamValue(M_NULL), m_MilDataType(M_NULL) {}
+#endif
+      inline CMilArrayParamOut(std::vector<MIL_INT8  >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT8  >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_UINT8 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT8 >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_UINT16>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT16>::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_UINT32>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT32>::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_INT16 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT16 >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_INT32 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT32 >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_INT64 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT64 >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_FLOAT >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_FLOAT >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_DOUBLE>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_DOUBLE>::TypeFlag) {}
+
+      template <typename UserType>
+      inline void Resize(const MIL_INT& Size) { if(m_pParamVector) { (reinterpret_cast<std::vector<UserType>*>(m_pParamVector))->resize(Size); } }
+
+      template <typename UserType>
+      inline UserType* GetData() { return m_pParamVector ? &(*reinterpret_cast<std::vector<UserType>*>(m_pParamVector))[0] : M_NULL; }
+
+      inline bool IsValidParam() { return m_pParamVector ? true : m_ParamValue ? false : true; }
+
+      // For debug purpose.
+      inline bool IsNullPtr() { return m_pParamVector ? false : true; }
+
+      inline MIL_INT64 GetMilDataType() { return m_MilDataType; }
+
+   private:
+      void* m_pParamVector;
+      int m_ParamValue;
+      MIL_INT64 m_MilDataType;
+   };
+
+class CMilArrayParamIn
+   {
+   public:
+      inline CMilArrayParamIn(int Value): m_pParamVector(M_NULL), m_ParamValue(Value), m_MilDataType(M_NULL) {}
+#if M_MIL_USE_NULLPTR
+      inline CMilArrayParamIn(std::nullptr_t) : m_pParamVector(M_NULL), m_ParamValue(M_NULL), m_MilDataType(M_NULL) {}
+#endif
+      inline CMilArrayParamIn(const std::vector<MIL_INT8  >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT8  >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_UINT8 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT8 >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_UINT16>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT16>::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_INT16 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT16 >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_INT32 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT32 >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_INT64 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT64 >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_FLOAT >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_FLOAT >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_DOUBLE>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_DOUBLE>::TypeFlag) {}
+
+      template <typename UserType>
+      inline MIL_INT Size() { return m_pParamVector ? (MIL_INT)((reinterpret_cast<const std::vector<UserType>*>(m_pParamVector))->size()) : 0; }
+
+      template <typename UserType>
+      inline const UserType* GetData() { return m_pParamVector ? &(*reinterpret_cast<const std::vector<UserType>*>(m_pParamVector))[0] : M_NULL; }
+
+      inline bool IsValidParam() { return m_pParamVector ? true : m_ParamValue ? false : true; }
+
+      // For debug purpose.
+      inline bool IsNullPtr() { return m_pParamVector ? false : true; }
+
+      inline MIL_INT64 GetMilDataType() { return m_MilDataType; }
+
+      template <typename UserType>
+      inline bool IsEmpty() { return m_pParamVector ? (reinterpret_cast<const std::vector<UserType>*>(m_pParamVector))->empty() : false; }
+
+   private:
+      const void* m_pParamVector;
+      int m_ParamValue;
+      MIL_INT64 m_MilDataType;
+   };
+
+#define M_INQUIRE_SIZE_BYTE      2L // Used in the MxxxStreamForStdVector function defined in milproto.h
+
+/***************************************************************************/
+/* MxxxStream function PROTOTYPE                                           */
+/***************************************************************************/
+typedef void(MFTYPE* M_XXX_STREAM_FUNCTION)(MilStreamParam MemPtrOrFileName,
+                                            MIL_ID         SysId,
+                                            MIL_INT64      Operation,
+                                            MIL_INT64      StreamType,
+                                            MIL_DOUBLE     Version,
+                                            MIL_INT64      ControlFlag,
+                                            MIL_ID*        MxxxIdPtr,
+                                            MIL_INT*       SizeByteVarPtr);
+// ----------------------------------------------------------
+// Overloads for std::vector in MxxxStream.
+inline void MFTYPE MxxxStreamForStdVector(std::vector<MIL_UINT8> &MemPtrOrFileName,
+                                          MIL_ID                 SysId,
+                                          MIL_INT64              Operation,
+                                          MIL_INT64              StreamType,
+                                          MIL_DOUBLE             Version,
+                                          MIL_INT64              ControlFlag,
+                                          MIL_ID*                MxxxIdPtr,
+                                          MIL_INT*               SizeByteVarPtr,
+                                          M_XXX_STREAM_FUNCTION  MxxxStream)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(StreamType != M_MEMORY)
+      {
+      SafeTypeError(MIL_TEXT("MxxxStream"), MIL_TEXT("StreamType parameter must be set to M_MEMORY with the std::vector overloads."));
+      }
+#endif
+
+   switch(Operation)
+      {
+      case M_LOAD:
+      case M_RESTORE:
+      {
+#if M_MIL_USE_SAFE_TYPE
+      if(MemPtrOrFileName.empty())
+         {
+         SafeTypeError(MIL_TEXT("MxxxStream"), MIL_TEXT("The Mem vector cannot be empty with M_LOAD or M_RESTORE operation."));
+         }
+#endif
+      (*MxxxStream)(&MemPtrOrFileName[0],
+                    SysId,
+                    Operation,
+                    StreamType,
+                    Version,
+                    ControlFlag,
+                    MxxxIdPtr,
+                    SizeByteVarPtr);
+      }
+      break;
+      case M_SAVE:
+      {
+      MIL_INT NumberOfBytes = -1;
+      (*MxxxStream)(M_NULL, M_NULL, M_INQUIRE_SIZE_BYTE, StreamType, Version, ControlFlag, MxxxIdPtr, &NumberOfBytes);
+
+      if(NumberOfBytes > 0)
+         {
+         MemPtrOrFileName.resize(NumberOfBytes);
+
+         (*MxxxStream)(&MemPtrOrFileName[0],
+                       SysId,
+                       Operation,
+                       StreamType,
+                       Version,
+                       ControlFlag,
+                       MxxxIdPtr,
+                       SizeByteVarPtr);
+         }
+      }
+      break;
+      default:
+#if M_MIL_USE_SAFE_TYPE
+      {
+      SafeTypeError(MIL_TEXT("MxxxStream"), MIL_TEXT("Invalid Operation with the std::vector overloads."));
+      }
+#endif
+      break;
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MgraCopy.
+inline void MFTYPE MgraCopy(MIL_ID                     SrcListGraId,
+                            MIL_ID                     DstListGraId,
+                            MIL_INT64                  Operation,
+                            MIL_INT                    InsertLocation,
+                            MIL_INT                    NumGraphics,
+                            CMilArrayParamIn           SrcIndexOrLabelArrayPtr,
+                            CMilArrayParamOut          DstLabelArrayPtr,
+                            MIL_INT64                  ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumGraphics <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("NumGraphics parameter must be greater than zero."));
+      }
+   if(!DstLabelArrayPtr.IsValidParam() || !SrcIndexOrLabelArrayPtr.IsValidParam())
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("SrcIndexOrLabelArrayPtr or DstLabelArrayPtr cannot be an non zero integer."));
+      }
+   if(SrcIndexOrLabelArrayPtr.IsEmpty<MIL_INT>())
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("The input vector cannot be empty."));
+      }
+   if(!SrcIndexOrLabelArrayPtr.IsNullPtr() && SrcIndexOrLabelArrayPtr.GetMilDataType() != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("The data type of SrcIndexOrLabelArrayPtr must be MIL_INT."));
+      }
+   if(!DstLabelArrayPtr.IsNullPtr() && DstLabelArrayPtr.GetMilDataType() != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("The data type of DstLabelArrayPtr must be MIL_INT."));
+      }
+   if(!SrcIndexOrLabelArrayPtr.IsNullPtr() && NumGraphics > (MIL_INT)SrcIndexOrLabelArrayPtr.Size<MIL_INT>() && NumGraphics != M_DEFAULT && NumGraphics != M_ALL)
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("NumGraphics parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(!SrcIndexOrLabelArrayPtr.IsNullPtr() && NumGraphics != M_ALL && (NumGraphics == M_DEFAULT || NumGraphics > (MIL_INT)SrcIndexOrLabelArrayPtr.Size<MIL_INT>()))
+      {
+      NumGraphics = (MIL_INT)SrcIndexOrLabelArrayPtr.Size<MIL_INT>();
+      }
+
+   if(NumGraphics == M_ALL)
+      {
+      MIL_INT InternalNumGraphicsForStdVector = 0;
+
+      MgraInquireList(SrcListGraId, M_LIST, M_DEFAULT, M_NUMBER_OF_GRAPHICS + M_TYPE_MIL_INT, &InternalNumGraphicsForStdVector);
+
+      DstLabelArrayPtr.Resize<MIL_INT>(InternalNumGraphicsForStdVector);
+
+      if(InternalNumGraphicsForStdVector <= 0)
+         {
+         return;
+         }
+      }
+   else
+      {
+      DstLabelArrayPtr.Resize<MIL_INT>(NumGraphics);
+      }
+
+   MgraCopy(SrcListGraId,
+            DstListGraId,
+            Operation,
+            InsertLocation,
+            NumGraphics,
+            SrcIndexOrLabelArrayPtr.GetData<MIL_INT>(),
+            DstLabelArrayPtr.GetData<MIL_INT>(),
+            ControlFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MgraDots.
+template <typename UserType>
+inline void MgraDots(MIL_ID                      ContextGraId,
+                     MIL_ID                      DstImageBufOrListGraId,
+                     MIL_INT                     NumberOfDots,
+                     const std::vector<UserType> &PosXArrayPtr,
+                     const std::vector<UserType> &PosYArrayPtr,
+                     MIL_INT64                   ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumberOfDots <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MgraDots"), MIL_TEXT("NumberOfDots parameter must be greater than zero."));
+      }
+   if(PosXArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MgraDots"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(PosXArrayPtr.size() != PosYArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MgraDots"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumberOfDots > (MIL_INT)PosXArrayPtr.size() && NumberOfDots != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MgraDots"), MIL_TEXT("NumberOfDots parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumberOfDots == M_DEFAULT || NumberOfDots > (MIL_INT)PosXArrayPtr.size())
+      {
+      NumberOfDots = (MIL_INT)PosXArrayPtr.size();
+      }
+
+   MgraDots(ContextGraId,
+            DstImageBufOrListGraId,
+            NumberOfDots,
+            &PosXArrayPtr[0],
+            &PosYArrayPtr[0],
+            ControlFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MgraLines.
+template <typename UserType>
+inline void MgraLines(MIL_ID                      ContextGraId,
+                      MIL_ID                      DstImageBufOrListGraId,
+                      MIL_INT                     NumberOfLinesOrVertices,
+                      const std::vector<UserType> &XPtr,
+                      const std::vector<UserType> &YPtr,
+                      CMilArrayParamIn            X2Ptr,
+                      CMilArrayParamIn            Y2Ptr,
+                      MIL_INT64                   ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(!X2Ptr.IsValidParam() || !Y2Ptr.IsValidParam())
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("X2Ptr or Y2Ptr cannot be an non zero integer!"));
+      }
+   if(XPtr.size() != YPtr.size() ||
+      ((MIL_INT)XPtr.size() != X2Ptr.Size<UserType>() && !X2Ptr.IsNullPtr()) ||
+      ((MIL_INT)XPtr.size() != Y2Ptr.Size<UserType>() && !Y2Ptr.IsNullPtr()) ||
+      ((MIL_INT)YPtr.size() != X2Ptr.Size<UserType>() && !X2Ptr.IsNullPtr()) ||
+      ((MIL_INT)YPtr.size() != Y2Ptr.Size<UserType>() && !Y2Ptr.IsNullPtr()) ||
+      (X2Ptr.Size<UserType>() != Y2Ptr.Size<UserType>() && !X2Ptr.IsNullPtr() && !Y2Ptr.IsNullPtr()))
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("The input vectors must have the same size!"));
+      }
+   if(XPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(NumberOfLinesOrVertices <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("NumberOfLinesOrVertices parameter must be greater than zero."));
+      }
+   if((!X2Ptr.IsNullPtr() && X2Ptr.GetMilDataType() != MilTraits<UserType>::TypeFlag) ||
+      (!Y2Ptr.IsNullPtr() && Y2Ptr.GetMilDataType() != MilTraits<UserType>::TypeFlag))
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("The data type of X2Ptr or Y2Ptr must be the same as XPtr or YPtr."));
+      }
+   if(NumberOfLinesOrVertices > (MIL_INT)XPtr.size() && NumberOfLinesOrVertices != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("NumberOfLinesOrVertices parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumberOfLinesOrVertices == M_DEFAULT || NumberOfLinesOrVertices > (MIL_INT)XPtr.size())
+      {
+      NumberOfLinesOrVertices = (MIL_INT)XPtr.size();
+      }
+
+   MgraLines(ContextGraId,
+             DstImageBufOrListGraId,
+             NumberOfLinesOrVertices,
+             &XPtr[0],
+             &YPtr[0],
+             X2Ptr.GetData<UserType>(),
+             Y2Ptr.GetData<UserType>(),
+             ControlFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MgraVectors.
+template <typename UserType>
+inline void MFTYPE MgraVectors(MIL_ID                       ContextGraId,
+                               MIL_ID                       DstImageBufOrListGraId,
+                               MIL_INT                      NumVectors,
+                               const std::vector<UserType>& XArrayPtr,
+                               const std::vector<UserType>& YArrayPtr,
+                               const std::vector<UserType>& UArrayPtr,
+                               const std::vector<UserType>& VArrayPtr,
+                               MIL_INT64                    ScaleMode,
+                               MIL_DOUBLE                   ScaleValue,
+                               MIL_INT64                    ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumVectors <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MgraVectors"), MIL_TEXT("NumVectors parameter must be greater than zero."));
+      }
+   if(XArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MgraVectors"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(XArrayPtr.size() != YArrayPtr.size() ||
+      XArrayPtr.size() != UArrayPtr.size() ||
+      XArrayPtr.size() != VArrayPtr.size() ||
+      YArrayPtr.size() != UArrayPtr.size() ||
+      YArrayPtr.size() != VArrayPtr.size() ||
+      UArrayPtr.size() != VArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MgraVectors"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumVectors > (MIL_INT)XArrayPtr.size() && NumVectors != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MgraVectors"), MIL_TEXT("NumVectors parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumVectors == M_DEFAULT || NumVectors > (MIL_INT)XArrayPtr.size())
+      {
+      NumVectors = (MIL_INT)XArrayPtr.size();
+      }
+
+   MgraVectors(ContextGraId,
+               DstImageBufOrListGraId,
+               NumVectors,
+               &XArrayPtr[0],
+               &YArrayPtr[0],
+               &UArrayPtr[0],
+               &VArrayPtr[0],
+               ScaleMode,
+               ScaleValue,
+               ControlFlag);
+   }
+
+#if !M_MIL_USE_LINUX || M_COMPILING_MILDLL
+// ----------------------------------------------------------
+// Overloads for std::vector in MseqDefine.
+inline void MFTYPE MseqDefine(MIL_ID                     ContextSeqId,
+                              MIL_INT                    SequenceIndex,
+                              MIL_INT64                  SequenceType,
+                              const std::vector<MIL_ID>& Param1Ptr,
+                              MIL_DOUBLE                 Param2)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(Param2 <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MseqDefine"), MIL_TEXT("Param2 parameter must be greater than zero."));
+      }
+   if(Param1Ptr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MseqDefine"), MIL_TEXT("The input vector cannot be empty."));
+      }
+   if(SequenceType != M_BUFFER_LIST)
+      {
+      SafeTypeError(MIL_TEXT("MseqDefine"), MIL_TEXT("Invalid SequenceType with the std::vector overload."));
+      }
+   if(Param2 > (MIL_INT)Param1Ptr.size() && Param2 != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MseqDefine"), MIL_TEXT("Param2 parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(Param2 == M_DEFAULT || Param2 > (MIL_INT)Param1Ptr.size())
+      {
+      Param2 = (MIL_DOUBLE)Param1Ptr.size();
+      }
+
+   MseqDefine(ContextSeqId,
+              SequenceIndex,
+              SequenceType,
+              &Param1Ptr[0],
+              Param2);
+   }
+#endif // !M_MIL_USE_LINUX || M_COMPILING_MILDLL
+
+//Overload for MbufGet to support vector inquire type
+template <typename UserType>
+inline void MFTYPE  MbufGet(MIL_ID SrcBufId, std::vector<UserType> &UserArrayPtr)
+   {
+   MIL_INT InternalBufSizeX = 0;
+   MIL_INT InternalBufSizeY = 0; 
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_X, &InternalBufSizeX);
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_Y, &InternalBufSizeY);
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = (InternalBufSizeX*InternalBufSizeY);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that SizeByteRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   if(InternalNbElementRequired > 0)
+      {
+      MbufGet(SrcBufId, &UserArrayPtr[0]);
+      }
+   }
+
+//Overload for MbufImportSequence to support vector
+inline void MFTYPE  MbufImportSequence(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, std::vector<MIL_ID> &BufArrayPtr, MIL_INT StartImage, MIL_INT NumberOfImages, MIL_INT64 ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumberOfImages <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MbufImportSequence"), MIL_TEXT("NumberOfImages must be greater than zero."));
+      }
+   if(NumberOfImages > (MIL_INT64)BufArrayPtr.size() && NumberOfImages != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufImportSequence"), MIL_TEXT("NumberOfImages parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(NumberOfImages == M_DEFAULT || NumberOfImages > (MIL_INT64)BufArrayPtr.size())
+      {
+      NumberOfImages = (MIL_INT64)BufArrayPtr.size();
+      }
+
+   BufArrayPtr.resize(NumberOfImages);
+
+   if(NumberOfImages > 0)
+      {
+      MbufImportSequence(FileName, FileFormat, Operation, SystemId, &BufArrayPtr[0], StartImage, NumberOfImages, ControlFlag);
+      }
+   }
+
+//MIL_STRING and vector Overload for MbufImportSequence to support vector 
+#if M_MIL_USE_STRING
+inline void MFTYPE  MbufImportSequence(const MIL_STRING &FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, std::vector<MIL_ID> &BufArrayPtr, MIL_INT StartImage, MIL_INT NumberOfImages, MIL_INT64 ControlFlag)
+   {
+   MbufImportSequence(FileName.c_str(), FileFormat, Operation, SystemId, BufArrayPtr, StartImage, NumberOfImages, ControlFlag);
+   }
+#endif
+
+//Overload for MbufExportSequence to support vector 
+inline void MFTYPE  MbufExportSequence(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, const std::vector<MIL_ID> &BufArrayPtrOrSystemIdPtr, MIL_INT NumOfIds, MIL_DOUBLE FrameRate, MIL_INT64 ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumOfIds <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MbufExportSequence"), MIL_TEXT("NumOfIds must be greater than zero."));
+      }
+   if(NumOfIds > (MIL_INT64)BufArrayPtrOrSystemIdPtr.size() && NumOfIds != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufExportSequence"), MIL_TEXT("NumOfIds parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(NumOfIds == M_DEFAULT || NumOfIds > (MIL_INT64)BufArrayPtrOrSystemIdPtr.size())
+      {
+      NumOfIds = (MIL_INT64)BufArrayPtrOrSystemIdPtr.size();
+      }
+
+   if(NumOfIds > 0)
+      {
+      MbufExportSequence(FileName, FileFormat, &BufArrayPtrOrSystemIdPtr[0], NumOfIds, FrameRate, ControlFlag);
+      }
+   }
+
+//MIL_STRING and vector Overload for MbufExportSequence to support vector 
+#if M_MIL_USE_STRING
+inline void MFTYPE  MbufExportSequence(const MIL_STRING &FileName, MIL_INT64 FileFormat, const std::vector<MIL_ID> &BufArrayPtrOrSystemIdPtr, MIL_INT NumOfIds, MIL_DOUBLE FrameRate, MIL_INT64 ControlFlag)
+   {
+   MbufExportSequence(FileName.c_str(), FileFormat, BufArrayPtrOrSystemIdPtr, NumOfIds, FrameRate, ControlFlag);
+   }
+#endif
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGet1d.
+template <typename UserType>
+inline void MFTYPE  MbufGet1d(MIL_ID SrcBufId, MIL_INT OffX, MIL_INT SizeX, std::vector<UserType> &UserArrayPtr)
+   {
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = SizeX;
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet1d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet1d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that SizeByteRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   // In case if SizeX = 0, call the original function which will pop an MIL error.
+   if(InternalNbElementRequired > 0 || SizeX == 0)
+      {
+      MbufGet1d(SrcBufId, OffX, SizeX, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGet2d.
+template <typename UserType>
+inline void MFTYPE  MbufGet2d(MIL_ID SrcBufId, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, std::vector<UserType> &UserArrayPtr)
+   {
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = (SizeX*SizeY);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet2d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet2d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   // In case if SizeX or SizeY = 0, call the original function which will pop an MIL error.
+   if(InternalNbElementRequired > 0 || SizeX == 0 || SizeY == 0)
+      {
+      MbufGet2d(SrcBufId, OffX, OffY, SizeX, SizeY, &UserArrayPtr[0]);
+      }
+   }
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetArc.
+template <typename UserType>
+inline MIL_INT MFTYPE MbufGetArc(MIL_ID ImageBufId,
+                                 MIL_INT XCenter,
+                                 MIL_INT YCenter,
+                                 MIL_INT XRad,
+                                 MIL_INT YRad,
+                                 MIL_DOUBLE StartAngle,
+                                 MIL_DOUBLE EndAngle,
+                                 MIL_INT64 Mode,
+                                 MIL_INT *NbPixelsPtr,
+                                 std::vector<UserType> &ValueArrayPtr,
+                                 CMilArrayParamOut     PosXArrayPtr,
+                                 CMilArrayParamOut     PosYArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(!PosXArrayPtr.IsValidParam() || !PosYArrayPtr.IsValidParam())
+      {
+      SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("PosXArrayPtr and PosYArrayPtr cannot be an non zero integer."));
+      }
+   if(!PosXArrayPtr.IsNullPtr() && PosXArrayPtr.GetMilDataType() != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("The data type of PosXArrayPtr must be MIL_INT."));
+      }
+   if(!PosYArrayPtr.IsNullPtr() && PosYArrayPtr.GetMilDataType() != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("The data type of PosYArrayPtr must be MIL_INT."));
+      }
+#endif
+
+   MIL_INT InternalNbElementRequired = 0;
+   MbufGetArc(ImageBufId, XCenter, YCenter, XRad, YRad, StartAngle, EndAngle, Mode, &InternalNbElementRequired, M_NULL, M_NULL, M_NULL);
+
+   if(InternalNbElementRequired == 0)
+      {
+      return 0;
+      }
+
+   MIL_INT InternalBufferType = 0;
+   MbufInquire(ImageBufId, M_TYPE, &InternalBufferType);
+   
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   ValueArrayPtr.resize(InternalNbElementRequired);
+   PosXArrayPtr.Resize<MIL_INT>(InternalNbElementRequired);
+   PosYArrayPtr.Resize<MIL_INT>(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   if(InternalNbElementRequired > 0)
+      {
+      MbufGetArc(ImageBufId,
+                 XCenter,
+                 YCenter,
+                 XRad,
+                 YRad,
+                 StartAngle,
+                 EndAngle,
+                 Mode,
+                 NbPixelsPtr,
+                 &ValueArrayPtr[0],
+                 PosXArrayPtr.GetData<MIL_INT>(),
+                 PosYArrayPtr.GetData<MIL_INT>());
+      }
+   
+   return InternalNbElementRequired;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetColor.
+template <typename UserType>
+inline void MFTYPE MbufGetColor(MIL_ID SrcBufId, MIL_INT64 DataFormat, MIL_INT Band, std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      case M_PACKED + M_BGR32:
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetColor"), MIL_TEXT("When the data format is M_PACKED, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+      break;
+      default:
+      break;
+      }
+#endif
+
+   MIL_INT InternalBufSizeX    = 0;
+   MIL_INT InternalBufSizeY    = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_X, &InternalBufSizeX);
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_Y, &InternalBufSizeY);
+   
+   MIL_INT InternalNbElementRequired = (InternalBufSizeX*InternalBufSizeY);
+
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      {
+      InternalNbElementRequired *= 2;
+      }
+      break;
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      {
+      InternalNbElementRequired *= 3;
+      }
+      break;
+      case M_PACKED + M_BGR32:
+      {
+      InternalNbElementRequired *= 4;
+      }
+      break;
+      default:
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+#if M_MIL_USE_SAFE_TYPE
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetColor"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetColor"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+#endif
+
+      MIL_INT InternalSizeBand = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+      InternalSizeBand = (Band == M_ALL_BANDS) ? InternalSizeBand : 1;
+
+      InternalNbElementRequired *= InternalSizeBand;
+      }
+      break;
+      }
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   if(InternalNbElementRequired > 0)
+      {
+      MbufGetColor(SrcBufId, DataFormat, Band, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetColor2d.
+template <typename UserType>
+inline void MFTYPE  MbufGetColor2d(MIL_ID SrcBufId, MIL_INT64 DataFormat, MIL_INT Band, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      case M_PACKED + M_BGR32:
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetColor2d"), MIL_TEXT("When the data format is M_PACKED, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+      break;
+      default:
+      break;
+      }
+#endif
+
+   MIL_INT InternalNbElementRequired = (SizeX*SizeY);
+
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      {
+      InternalNbElementRequired *= 2;
+      }
+      break;
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      {
+      InternalNbElementRequired *= 3;
+      }
+      break;
+      case M_PACKED + M_BGR32:
+      {
+      InternalNbElementRequired *= 4;
+      }
+      break;
+      default:
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+#if M_MIL_USE_SAFE_TYPE
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetColor2d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetColor2d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+#endif
+
+      MIL_INT InternalSizeBand = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+      InternalSizeBand = (Band == M_ALL_BANDS) ? InternalSizeBand : 1;
+
+      InternalNbElementRequired *= InternalSizeBand;
+      }
+      break;
+      }
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   // In case if SizeX or SizeY = 0, call the original function which will pop an MIL error.
+   if(InternalNbElementRequired > 0 || SizeX == 0 || SizeY == 0)
+      {
+      MbufGetColor2d(SrcBufId, DataFormat, Band, OffX, OffY, SizeX, SizeY, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetLine.
+template <typename UserType>
+inline void MFTYPE MbufGetLine(MIL_ID ImageBufId, MIL_INT StartX, MIL_INT StartY, MIL_INT EndX, MIL_INT EndY, MIL_INT64 Mode, MIL_INT *NbPixelsPtr, std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(Mode != M_DEFAULT && MilTraits<UserType>::TypeFlag != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MbufGetLine"), MIL_TEXT("When Mode is not M_DEFAULT, the data type of UserArrayPtr must be MIL_INT."));
+      }
+#endif
+
+   MIL_INT InternalNbElementRequired = 0;
+   MbufGetLine(ImageBufId, StartX, StartY, EndX, EndY, Mode, &InternalNbElementRequired, NULL);
+
+   if(Mode == M_DEFAULT)
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(ImageBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+#if M_MIL_USE_SAFE_TYPE
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetLine"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetLine"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+#endif
+      }
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   if(InternalNbElementRequired > 0)
+      {
+      MbufGetLine(ImageBufId, StartX, StartY, EndX, EndY, Mode, NbPixelsPtr, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetList.
+template<typename PosType, typename ValType>
+inline void MFTYPE MbufGetList(MIL_ID SrcBufId,
+                               MIL_INT NumPixels,
+                               const std::vector<PosType>& PixXArrayPtr,
+                               const std::vector<PosType>& PixYArrayPtr,
+                               MIL_INT64 InterpolationMode,
+                               std::vector<ValType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(PixXArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(PixXArrayPtr.size() != PixYArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumPixels > (MIL_INT)PixXArrayPtr.size() && NumPixels != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("NumPixels parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumPixels == M_DEFAULT || NumPixels > (MIL_INT)PixXArrayPtr.size())
+      {
+      NumPixels = (MIL_INT)PixXArrayPtr.size();
+      }
+
+   MIL_INT InternalSizeBand = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = NumPixels;
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<ValType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<ValType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   // In case if NumPixels = 0, call the original function which will pop an MIL error.
+   if(InternalNbElementRequired > 0 || NumPixels == 0)
+      {
+      MbufGetList(SrcBufId, NumPixels, &PixXArrayPtr[0], &PixYArrayPtr[0], InterpolationMode, &UserArrayPtr[0]);   
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPut.
+template<typename UserType>
+inline void MFTYPE MbufPut(MIL_ID DestBufId, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalBufSizeX = 0;
+   MIL_INT InternalBufSizeY = 0;
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_X, &InternalBufSizeX);
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_Y, &InternalBufSizeY);
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = (InternalBufSizeX*InternalBufSizeY);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPut"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPut(DestBufId, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPut1d.
+template<typename UserType>
+inline void MFTYPE MbufPut1d(MIL_ID DestBufId, MIL_INT OffX, MIL_INT SizeX, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalSizeBand = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = SizeX;
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut1d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut1d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPut1d"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPut1d(DestBufId, OffX, SizeX, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPut2d
+template<typename UserType>
+inline void MFTYPE MbufPut2d(MIL_ID DestBufId, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = (SizeX*SizeY);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut2d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut2d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPut2d"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPut2d(DestBufId, OffX, OffY, SizeX, SizeY, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPutColor
+template<typename UserType>
+inline void MFTYPE MbufPutColor(MIL_ID DestBufId, MIL_INT64 DataFormat, MIL_INT Band, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      case M_PACKED + M_BGR32:
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutColor"), MIL_TEXT("When the data format is M_PACKED, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+      break;
+      default:
+      break;
+      }
+
+   MIL_INT InternalBufSizeX = 0;
+   MIL_INT InternalBufSizeY = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_X, &InternalBufSizeX);
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_Y, &InternalBufSizeY);
+
+   MIL_INT InternalNbElementRequired = (InternalBufSizeX*InternalBufSizeY);
+
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      {
+      InternalNbElementRequired *= 2;
+      }
+      break;
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      {
+      InternalNbElementRequired *= 3;
+      }
+      break;
+      case M_PACKED + M_BGR32:
+      {
+      InternalNbElementRequired *= 4;
+      }
+      break;
+      default:
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufPutColor"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufPutColor"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+
+      MIL_INT InternalSizeBand = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+      InternalSizeBand = (Band == M_ALL_BANDS) ? InternalSizeBand : 1;
+
+      InternalNbElementRequired *= InternalSizeBand;
+      }
+      break;
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutColor"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPutColor(DestBufId, DataFormat, Band, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPutColor2d
+template<typename UserType>
+inline void MFTYPE MbufPutColor2d(MIL_ID DestBufId, MIL_INT64 DataFormat, MIL_INT Band, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      case M_PACKED + M_BGR32:
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutColor2d"), MIL_TEXT("When the data format is M_PACKED, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+      break;
+      default:
+         break;
+      }
+
+   MIL_INT InternalNbElementRequired = (SizeX*SizeY);
+
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      {
+      InternalNbElementRequired *= 2;
+      }
+      break;
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      {
+      InternalNbElementRequired *= 3;
+      }
+      break;
+      case M_PACKED + M_BGR32:
+      {
+      InternalNbElementRequired *= 4;
+      }
+      break;
+      default:
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufPutColor2d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufPutColor2d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+
+      MIL_INT InternalSizeBand = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+      InternalSizeBand = (Band == M_ALL_BANDS) ? InternalSizeBand : 1;
+
+      InternalNbElementRequired *= InternalSizeBand;
+      }
+      break;
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutColor2d"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPutColor2d(DestBufId, DataFormat, Band, OffX, OffY, SizeX, SizeY, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector MbufPutLine
+template<typename UserType>
+inline void MFTYPE MbufPutLine(MIL_ID ImageBufId, MIL_INT StartX, MIL_INT StartY, MIL_INT EndX, MIL_INT EndY, MIL_INT64 Mode, MIL_INT *NbPixelsPtr, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalNbElementRequired = 0;
+   MbufPutLine(ImageBufId, StartX, StartY, EndX, EndY, Mode, &InternalNbElementRequired, NULL);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(ImageBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutLine"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutLine"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutLine"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPutLine(ImageBufId, StartX, StartY, EndX, EndY, Mode, NbPixelsPtr, &UserArrayPtr[0]);
+   }
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPutList.
+template<typename PosType, typename ValType>
+inline void MFTYPE MbufPutList(MIL_ID                      DestBufId,
+                               MIL_INT                     NumPixels,
+                               const std::vector<PosType>& PixXArrayPtr,
+                               const std::vector<PosType>& PixYArrayPtr,
+                               MIL_INT64                   OverscanMode,
+                               const std::vector<ValType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(PixXArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(PixXArrayPtr.size() != PixYArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumPixels > (MIL_INT)PixXArrayPtr.size() && NumPixels != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("NumPixels parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumPixels == M_DEFAULT || NumPixels > (MIL_INT)PixXArrayPtr.size())
+      {
+      NumPixels = (MIL_INT)PixXArrayPtr.size();
+      }
+
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalSizeBand = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = NumPixels;
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<ValType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<ValType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPutList(DestBufId, NumPixels, &PixXArrayPtr[0], &PixYArrayPtr[0], OverscanMode, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MobjMessageWrite.
+inline void MFTYPE MobjMessageWrite(MIL_ID MessageId, const std::vector<MIL_UINT8>& MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64 OperationFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(MessageSize <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MobjMessageWrite"), MIL_TEXT("MessageSize must be greater than zero."));
+      }
+   if(MessageSize > (MIL_INT64)MessagePtr.size() && MessageSize != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MobjMessageWrite"), MIL_TEXT("MessageSize parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(MessageSize == M_DEFAULT || MessageSize > (MIL_INT64)MessagePtr.size())
+      {
+      MessageSize = (MIL_INT64)MessagePtr.size();
+      }
+
+   MobjMessageWrite(MessageId, &MessagePtr[0], MessageSize, MessageTag, OperationFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MobjMessageRead.
+inline MIL_INT64 MFTYPE MobjMessageRead(MIL_ID MessageId, std::vector<MIL_UINT8> &MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 *MessageOutSizePtr, MIL_INT64 *MessageTagPtr, MIL_INT64 *StatusPtr, MIL_INT64  OperationFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(MessageInSize <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MobjMessageRead"), MIL_TEXT("MessageInSize must be greater than zero."));
+      }
+#endif
+
+   if(MessageInSize == M_DEFAULT)
+      {
+      MessageInSize = 0;
+      MessageInSize = MobjMessageRead(MessageId, M_NULL, M_NULL, M_NULL, M_NULL, StatusPtr, OperationFlag);
+      }
+
+   MessagePtr.resize((MIL_INT)MessageInSize);
+
+   if(MessageInSize > 0)
+      {
+      MIL_INT64 InternalNeededSizeForStdVector = MobjMessageRead(MessageId, &MessagePtr[0], MessageInSize, MessageOutSizePtr, MessageTagPtr, StatusPtr, OperationFlag);
+
+      if(InternalNeededSizeForStdVector < MessageInSize)
+         {
+         MessagePtr.resize((MIL_INT)InternalNeededSizeForStdVector);
+         }
+      return InternalNeededSizeForStdVector;
+      }
+   return 0;
+   }
+//Overloads for std::overload MthrWaitMultiple
+inline MIL_INT MthrWaitMultiple(const std::vector<MIL_ID> &EventArrayIdPtr, MIL_INT EventArraySize, MIL_INT64 WaitOption, MIL_INT *StatePtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(EventArraySize == M_DEFAULT || EventArraySize > (MIL_INT64)EventArrayIdPtr.size())
+      {
+      EventArraySize = (MIL_INT64)EventArrayIdPtr.size();
+      }
+
+   RetVal = MthrWaitMultiple(&EventArrayIdPtr[0], EventArraySize, WaitOption, StatePtr);
+
+   return RetVal;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MthrInquireMp.
+inline MIL_INT MFTYPE MthrInquireMp(MIL_ID ThrId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::vector<MIL_UINT64> &ResultPtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(InquireType == M_CORE_AFFINITY_MASK)
+      {
+      MIL_INT MaskArraySz = MthrInquireMp(ThrId, M_CORE_AFFINITY_MASK_ARRAY_SIZE, M_DEFAULT, M_DEFAULT, M_NULL);
+      ResultPtr.resize(MaskArraySz);
+      RetVal = MthrInquireMp(ThrId, InquireType, TypeFlag, TypeValue, &ResultPtr[0]);
+      }
+   else
+      {
+      ResultPtr.resize(1);
+      RetVal = MthrInquireMp(ThrId, InquireType, TypeFlag, TypeValue, &ResultPtr[0]);
+      }
+   return RetVal;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MthrControlMp.
+inline void MFTYPE MthrControlMp(MIL_ID ThrId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, const std::vector<MIL_UINT64> &ValuePtr)
+   {
+   if(ControlType == M_CORE_AFFINITY_MASK)
+      {
+      MIL_INT AffinityMaskSz = MthrInquireMp(ThrId, M_CORE_AFFINITY_MASK_ARRAY_SIZE, M_DEFAULT, M_DEFAULT, M_NULL);
+      if(AffinityMaskSz > (MIL_INT)ValuePtr.size())
+         {
+#if M_MIL_USE_SAFE_TYPE
+         SafeTypeError(MIL_TEXT("MthrControlMp"), MIL_TEXT("ValuePtr size has to be bigger than the M_CORE_AFFINITY_MASK_ARRAY_SIZE."));
+#endif
+         }
+      else
+         {
+         MthrControlMp(ThrId, ControlType, TypeFlag, TypeValue, (MIL_UINT64*)&ValuePtr[0]);
+         }
+      }
+   else
+      {
+      MthrControlMp(ThrId, ControlType, TypeFlag, TypeValue, (MIL_UINT64*)&ValuePtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MappControlMp.
+inline void MFTYPE MappControlMp(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, const std::vector<MIL_UINT64> &ValuePtr)
+   {
+   if(ControlType == M_CORE_AFFINITY_MASK)
+      {
+      MIL_INT AffinityMaskSz = MappInquireMp(ContextAppId, M_CORE_AFFINITY_MASK_ARRAY_SIZE, M_DEFAULT, M_DEFAULT, M_NULL);
+      if(AffinityMaskSz > (MIL_INT)ValuePtr.size())
+         {
+#if M_MIL_USE_SAFE_TYPE
+         SafeTypeError(MIL_TEXT("MappControlMp"), MIL_TEXT("ValuePtr size has to be bigger than the M_CORE_AFFINITY_MASK_ARRAY_SIZE."));
+#endif
+         }
+      else
+         {
+         MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, (MIL_UINT64*)&ValuePtr[0]);
+         }
+      }
+   else
+      {
+      MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, (MIL_UINT64*)&ValuePtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MappInquireConnection.
+inline MIL_INT MFTYPE MappInquireConnection(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, std::vector<MIL_ID> &UserVarPtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(InquireType == M_DMIL_PUBLISHED_LIST)
+      {
+      MIL_INT PublishListSz = MappInquireConnection(ContextAppId, M_DMIL_PUBLISHED_LIST_SIZE, ControlFlag, ExtraFlag, M_NULL);
+      UserVarPtr.resize(PublishListSz);
+      if(PublishListSz > 0)
+         {
+         RetVal = MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, &UserVarPtr[0]);
+         }
+      }
+   else
+      {
+      UserVarPtr.resize(1);
+      RetVal = MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, &UserVarPtr[0]);
+      }
+   return RetVal;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MappInquireMp.
+inline MIL_INT MFTYPE MappInquireMp(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::vector<MIL_UINT64> &UserVarPtr)
+   {
+   MIL_INT RetVal = 0;
+   if((InquireType == M_CORE_AFFINITY_MASK) || (InquireType == M_CORE_AFFINITY_MASK_PROCESS) || (InquireType == M_MEMORY_BANK_AFFINITY_MASK) || (InquireType == M_MEMORY_BANK_CORE_AFFINITY_MASK))
+      {
+      MIL_INT64 MaskSizeInquireType = 0;
+      if((InquireType == M_CORE_AFFINITY_MASK) || (InquireType == M_CORE_AFFINITY_MASK_PROCESS))
+         {
+         MaskSizeInquireType = M_CORE_AFFINITY_MASK_ARRAY_SIZE;
+         }
+      else
+         {
+         MaskSizeInquireType = M_MEMORY_BANK_AFFINITY_MASK_ARRAY_SIZE;
+         }
+      MIL_INT AffinityMaskArraySize = MappInquireMp(ContextAppId, MaskSizeInquireType, TypeFlag, TypeValue, M_NULL);
+      if(AffinityMaskArraySize > 0)
+         {
+         UserVarPtr.resize(AffinityMaskArraySize);
+         RetVal = MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, &UserVarPtr[0]);
+         }
+      }
+   else
+      {
+      UserVarPtr.resize(1);
+      RetVal = MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, &UserVarPtr[0]);
+      }
+   return RetVal;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MsysInquireFeature.
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_STRING> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DISPLAY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_TOOLTIP ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DESCRIPTION)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MsysInquireFeature(SysId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_STRING> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_STRING>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MsysInquireFeature(SysId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_NAME)
+      {
+      MsysInquireFeature(SysId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_FEATURE_SELECTOR_NAME)
+      {
+      MsysInquireFeature(SysId, M_FEATURE_SELECTOR_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MsysInquireFeature(SysId, InquireType + i, FeatureName, M_TYPE_STRING, UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_INT64> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_VALUE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_ACCESS_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_VISIBILITY ||
+       InquireType == M_FEATURE_ENUM_ENTRY_CACHING_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_STREAMABLE)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MsysInquireFeature(SysId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("InquireType type not compatible with std::vector<MIL_INT64> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_INT64>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MsysInquireFeature(SysId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_TYPE)
+      {
+      MsysInquireFeature(SysId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MsysInquireFeature(SysId, InquireType + i, FeatureName.c_str(), M_TYPE_INT64, &UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MsysInquireFeature(SysId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   MIL_INT Size = 0;
+   if (InquireType == M_FEATURE_VALUE)
+      {
+      MsysInquireFeature(SysId, M_FEATURE_SIZE, FeatureName.c_str(), M_TYPE_INT64, &Size);
+      UserVarPtr.resize(Size);
+      MsysInquireFeature(SysId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(Size), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MsysControlFeature.
+inline void MFTYPE MsysControlFeature(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MsysInquireFeature(SysId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MsysControlFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MsysControlFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   if (ControlType == M_FEATURE_VALUE)
+      {
+      MsysControlFeature(SysId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(UserVarPtr.size()), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MdigInquireFeature.
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_STRING> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DISPLAY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_TOOLTIP ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DESCRIPTION)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MdigInquireFeature(DigId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_STRING> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_STRING>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MdigInquireFeature(DigId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_NAME)
+      {
+      MdigInquireFeature(DigId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_FEATURE_SELECTOR_NAME)
+      {
+      MdigInquireFeature(DigId, M_FEATURE_SELECTOR_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MdigInquireFeature(DigId, InquireType + i, FeatureName, M_TYPE_STRING, UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_INT64> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_VALUE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_ACCESS_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_VISIBILITY ||
+       InquireType == M_FEATURE_ENUM_ENTRY_CACHING_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_STREAMABLE)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MdigInquireFeature(DigId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("InquireType type not compatible with std::vector<MIL_INT64> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_INT64>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MdigInquireFeature(DigId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_TYPE)
+      {
+      MdigInquireFeature(DigId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MdigInquireFeature(DigId, InquireType + i, FeatureName.c_str(), M_TYPE_INT64, &UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MdigInquireFeature(DigId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   MIL_INT Size = 0;
+   if (InquireType == M_FEATURE_VALUE)
+      {
+      MdigInquireFeature(DigId, M_FEATURE_SIZE, FeatureName.c_str(), M_TYPE_INT64, &Size);
+      UserVarPtr.resize(Size);
+      MdigInquireFeature(DigId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(Size), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MdigControlFeature.
+inline void MFTYPE MdigControlFeature(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MdigInquireFeature(DigId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MdigControlFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MdigControlFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   if (ControlType == M_FEATURE_VALUE)
+      {
+      MdigControlFeature(DigId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(UserVarPtr.size()), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufInquireFeature.
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_STRING> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DISPLAY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_TOOLTIP ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DESCRIPTION)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MbufInquireFeature(BufId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_STRING> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_STRING>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MbufInquireFeature(BufId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_NAME)
+      {
+      MbufInquireFeature(BufId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_FEATURE_SELECTOR_NAME)
+      {
+      MbufInquireFeature(BufId, M_FEATURE_SELECTOR_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MbufInquireFeature(BufId, InquireType + i, FeatureName, M_TYPE_STRING, UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_INT64> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_VALUE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_ACCESS_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_VISIBILITY ||
+       InquireType == M_FEATURE_ENUM_ENTRY_CACHING_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_STREAMABLE)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MbufInquireFeature(BufId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("InquireType type not compatible with std::vector<MIL_INT64> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_INT64>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MbufInquireFeature(BufId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_TYPE)
+      {
+      MbufInquireFeature(BufId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MbufInquireFeature(BufId, InquireType + i, FeatureName.c_str(), M_TYPE_INT64, &UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MbufInquireFeature(BufId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   MIL_INT Size = 0;
+   if (InquireType == M_FEATURE_VALUE)
+      {
+      MbufInquireFeature(BufId, M_FEATURE_SIZE, FeatureName.c_str(), M_TYPE_INT64, &Size);
+      UserVarPtr.resize(Size);
+      MbufInquireFeature(BufId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(Size), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufControlFeature.
+inline void MFTYPE MbufControlFeature(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MbufInquireFeature(BufId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MbufControlFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufControlFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   if (ControlType == M_FEATURE_VALUE)
+      {
+      MbufControlFeature(BufId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(UserVarPtr.size()), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufInquireContainer.
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MbufInquireContainer(MIL_ID ContainerId, MIL_INT64 Component, MIL_INT64 InquireType, std::vector<MIL_ID> &UserVarPtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(M_IS_BUINQ_CONT_ID_ARRAY(InquireType))
+      {
+      MIL_INT ComponentListSz = MbufInquireContainer(ContainerId, Component, InquireType + M_NB_ELEMENTS, M_NULL);
+      UserVarPtr.resize(ComponentListSz);
+      if(ComponentListSz > 0)
+         {
+         RetVal = MbufInquireContainer(ContainerId, Component, InquireType + M_ARRAY_ID_SIZE(ComponentListSz), &UserVarPtr[0]);
+         }
+      }
+   else
+      {
+      UserVarPtr.resize(1);
+      RetVal = MbufInquireContainer(ContainerId, Component, InquireType, &UserVarPtr[0]);
+      }
+   return RetVal;
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufInquireContainer(MIL_ID ContainerId, MIL_INT64 Component, MIL_INT64 InquireType, std::vector<MIL_INT64> &UserVarPtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(M_IS_BUINQ_CONT_INT64_ARRAY(InquireType))
+      {
+      MIL_INT ComponentListSz = MbufInquireContainer(ContainerId, Component, InquireType + M_NB_ELEMENTS, M_NULL);
+      UserVarPtr.resize(ComponentListSz);
+      if(ComponentListSz > 0)
+         {
+         RetVal = MbufInquireContainer(ContainerId, Component, InquireType + M_ARRAY_ID_SIZE(ComponentListSz), &UserVarPtr[0]);
+         }
+      }
+   else
+      {
+      UserVarPtr.resize(1);
+      RetVal = MbufInquireContainer(ContainerId, Component, InquireType, &UserVarPtr[0]);
+      }
+   return RetVal;
+   }
+
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MxxxStream.
+inline void MFTYPE MbufStream(std::vector<MIL_UINT8>  &MemPtrOrFileName,
+   MIL_ID                 SysId,
+   MIL_INT64              Operation,
+   MIL_INT64              StreamType,
+   MIL_DOUBLE             Version,
+   MIL_INT64              ControlFlag,
+   MIL_ID*                McontextIdPtr,
+   MIL_INT*               SizeByteVarPtr)
+   {
+   MxxxStreamForStdVector(MemPtrOrFileName,
+      SysId,
+      Operation,
+      StreamType,
+      Version,
+      ControlFlag,
+      McontextIdPtr,
+      SizeByteVarPtr,
+      MbufStream);
+   }
+// ----------------------------------------------------------
+// Overloads for std::vector in MdigProcess.
+inline void MFTYPE MdigProcess(MIL_ID DigId, const std::vector<MIL_ID>& DestImageArrayPtr, MIL_INT ImageCount, MIL_INT64 Operation, MIL_INT64 OperationFlag, MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr, void *UserDataPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(ImageCount <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MdigProcess"), MIL_TEXT("ImageCount must be greater than zero."));
+      }
+   if(ImageCount > (MIL_INT)DestImageArrayPtr.size() && ImageCount != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MdigProcess"), MIL_TEXT("ImageCount parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(ImageCount == M_DEFAULT || ImageCount > (MIL_INT)DestImageArrayPtr.size())
+      {
+      ImageCount = (MIL_INT)DestImageArrayPtr.size();
+      }
+
+   MdigProcess(DigId, &DestImageArrayPtr[0], ImageCount, Operation, OperationFlag, HookHandlerPtr, UserDataPtr);
+   }   
+
+#endif // M_MIL_USE_VECTOR
+
+#endif /* __MILVECTOR_H__ */	
+#endif /* __MILPROTO_H */
diff --git a/Common_Class/Matrox/Include/milweb.h b/Common_Class/Matrox/Include/milweb.h
new file mode 100644
index 0000000..724cfa6
--- /dev/null
+++ b/Common_Class/Matrox/Include/milweb.h
@@ -0,0 +1,735 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  milweb.h
+// Revision          : 10.40.0640
+// Content           :  This file contains the defines necessary to use the milwebclient
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+#ifndef __MIL_WEB_CLIENT_H
+#define __MIL_WEB_CLIENT_H
+
+#include <stddef.h>
+
+#if !defined(MIL_COMPILE_VERSION_HEX) || (MIL_COMPILE_VERSION_HEX== 0)
+#ifdef MIL_COMPILE_VERSION_HEX
+#undef MIL_COMPILE_VERSION_HEX
+#endif
+#define MIL_COMPILE_VERSION_HEX 0x1040
+#endif
+
+// Let's put the hex value in decimal.
+#define MIL_COMPILE_VERSION ((((MIL_COMPILE_VERSION_HEX >> 12) & 0xf) * 1000) + (((MIL_COMPILE_VERSION_HEX >> 8) & 0xf) * 100) + (((MIL_COMPILE_VERSION_HEX >> 4) & 0xf) * 10) + (((MIL_COMPILE_VERSION_HEX) & 0xf) ))
+#define MIL_COMPILE_TRUNK_VERSION         1060
+#define MIL_COMPILE_NEXT_MAJOR_VERSION    1100
+
+
+#define WEB_CLIENT 1
+#define M_CLIENT_VERSION         0x1000000
+
+#if defined(__linux__)
+#if defined(__arm__) || defined(__aarch64__)
+         #define M_MIL_USE_ARM        1
+      #else
+         #define M_MIL_USE_ARM        0
+#endif
+#define M_MIL_USE_LINUX         1
+#define M_MIL_USE_WINDOWS       0
+#if defined(__x86_64__) || defined(__aarch64__)
+   #define M_MIL_USE_64BIT      1
+#else
+   #define M_MIL_USE_64BIT      0
+#endif
+#else
+#define M_MIL_USE_LINUX         0
+#define M_MIL_USE_WINDOWS       1
+#if defined(_WIN64) || defined(WIN64)
+   #define M_MIL_USE_64BIT      1
+#else
+   #define M_MIL_USE_64BIT      0
+#endif
+#endif
+#define M_NULL                                           0
+
+#if !defined(M_MIL_USE_UNICODE) && !M_MIL_USE_LINUX
+   #define M_MIL_USE_UNICODE 1
+#elif !defined (M_MIL_USE_UNICODE)
+   #define M_MIL_USE_UNICODE 0
+#endif
+
+#if  M_MIL_USE_UNICODE
+   #if defined(UNICODE)
+      #define M_MIL_UNICODE_API 1
+   #else
+      #define M_MIL_UNICODE_API 0
+   #endif
+#endif
+
+#if M_MIL_USE_UNICODE && M_MIL_UNICODE_API
+   #define MIL_TEXT(quote)        L##quote
+   typedef wchar_t                MIL_TEXT_CHAR;
+#elif M_MIL_USE_WINDOWS || M_MIL_USE_LINUX
+   #define MIL_TEXT(quote)        quote
+   typedef char                   MIL_TEXT_CHAR;
+#else
+   #error Operating system not supported !
+#endif
+typedef MIL_TEXT_CHAR*               MIL_TEXT_PTR;
+typedef const MIL_TEXT_CHAR*         MIL_CONST_TEXT_PTR;
+
+
+#if M_MIL_USE_WINDOWS
+   #define MFTYPE        _stdcall         // Exported Function type
+#elif M_MIL_USE_LINUX
+   #define MFTYPE                         // Exported Function type
+#else
+   #error Operating system not supported in Mil.h!
+#endif
+
+/************************************************************************/
+/* MIL TYPE DEFINITIONS                                                 */
+/************************************************************************/
+/* GENERAL RELATED DEFINES */
+/***************************/
+#if M_MIL_USE_WINDOWS
+      #if M_MIL_USE_64BIT
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+         typedef  __int64              MIL_INT;
+         typedef  unsigned __int64     MIL_UINT;
+#else
+         typedef  long long            MIL_INT;
+         typedef  unsigned long long   MIL_UINT;
+#endif
+
+         #define  MIL_UINT_MIN      0ULL
+         #define  MIL_UINT_MAX      18446744073709551615ULL
+         #define  MIL_INT_MIN       (-9223372036854775807LL - 1)
+         #define  MIL_INT_MAX       9223372036854775807LL
+      #else
+         #if (_MSC_VER < 1400) // Visual Studio 2003
+            typedef  long           MIL_INT;
+            typedef  unsigned long  MIL_UINT;
+         #else                 // Visual Studio 2005
+            // _W64 Lets you mark variables, such that when you compile
+            // with /Wp64 the compiler will report any warnings that would
+            // be reported if you were compiling with a 64-bit compiler.
+            typedef _W64          long MIL_INT;
+            typedef _W64 unsigned long MIL_UINT;
+         #endif
+         #define  MIL_UINT_MIN   0UL
+         #define  MIL_UINT_MAX   4294967295UL
+         #define  MIL_INT_MIN    (-2147483647L-1L)
+         #define  MIL_INT_MAX    2147483647L
+      #endif
+
+   typedef                long         MIL_INT32;
+   typedef const          long         MIL_CINT32;
+   typedef       unsigned long         MIL_UINT32;
+   typedef const unsigned long         MIL_CUINT32;
+   #define  MIL_UINT32_MIN             0UL
+   #define  MIL_UINT32_MAX             4294967295UL
+   #define  MIL_INT32_MIN              (-2147483647L-1L)
+   #define  MIL_INT32_MAX              2147483647L
+   #define  MIL_UINT32_MIN_FLT         0UL               //Min precise value in 32-bit floating point.
+   #define  MIL_UINT32_MAX_FLT         0xFFFFFF00UL      //Max precise value in 32-bit floating point.
+   #define  MIL_INT32_MIN_FLT          (-2147483647L-1L) //Min precise value in 32-bit floating point.
+   #define  MIL_INT32_MAX_FLT          0x7FFFFF80L       //Max precise value in 32-bit floating point.
+
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+   typedef                __int64      MIL_INT64;
+   typedef const          __int64      MIL_CINT64;
+   typedef       unsigned __int64      MIL_UINT64;
+   typedef const unsigned __int64      MIL_CUINT64;
+#else
+   typedef                long long    MIL_INT64;
+   typedef const          long long    MIL_CINT64;
+   typedef       unsigned long long    MIL_UINT64;
+   typedef const unsigned long long    MIL_CUINT64;
+#endif
+   #define  MIL_UINT64_MIN             0ULL
+   #define  MIL_UINT64_MAX             18446744073709551615ULL
+   #define  MIL_INT64_MIN              (-9223372036854775807LL - 1)
+   #define  MIL_INT64_MAX              9223372036854775807LL
+   #define  MIL_UINT64_MIN_DBL         0ULL                    //Min precise value in 64-bit floating point.
+   #define  MIL_UINT64_MAX_DBL         0xFFFFFFFFFFFFF800ULL   //Max precise value in 64-bit floating point.
+   #define  MIL_INT64_MIN_DBL          (-9223372036854775807LL - 1LL)  //Min precise value in 64-bit floating point.
+   #define  MIL_INT64_MAX_DBL          0x7FFFFFFFFFFFFC00LL    //Max precise value in 64-bit floating point.
+
+   typedef                double       MIL_DOUBLE;
+   typedef                float        MIL_FLOAT;
+   typedef                char         MIL_INT8;
+   typedef const          char         MIL_CINT8;
+   typedef       unsigned char         MIL_UINT8;
+   typedef const unsigned char         MIL_CUINT8;
+   typedef                short        MIL_INT16;
+   typedef const          short        MIL_CINT16;
+   typedef       unsigned short        MIL_UINT16;
+   typedef const unsigned short        MIL_CUINT16;
+   typedef MIL_INT32                   MIL_BOOL;
+   typedef const MIL_INT32             MIL_CBOOL;
+
+   #define  MIL_UINT8_MIN              0UL
+   #define  MIL_UINT8_MAX              255UL
+   #define  MIL_INT8_MIN               -128L
+   #define  MIL_INT8_MAX               127L
+   #define  MIL_UINT16_MIN             0UL
+   #define  MIL_UINT16_MAX             65535UL
+   #define  MIL_INT16_MIN              -32768L
+   #define  MIL_INT16_MAX              32767L
+   #define  MIL_DOUBLE_MIN             DBL_MIN
+   #define  MIL_DOUBLE_MAX             DBL_MAX
+   #define  MIL_FLOAT_MIN              FLT_MIN
+   #define  MIL_FLOAT_MAX              FLT_MAX
+   #define  MIL_BOOL_MIN               0UL
+   #define  MIL_BOOL_MAX               1UL
+
+#if M_MIL_USE_UNICODE && M_MIL_UNICODE_API
+   typedef       wchar_t               MIL_WCHAR;
+#else
+   typedef       unsigned short        MIL_WCHAR;
+#endif
+
+#elif M_MIL_USE_LINUX
+   typedef               long          MIL_INT;
+   typedef      unsigned long          MIL_UINT;
+
+   #if M_MIL_USE_64BIT
+   typedef                int          MIL_INT32;
+   typedef const          int          MIL_CINT32;
+   typedef       unsigned int          MIL_UINT32;
+   typedef const unsigned int          MIL_CUINT32;
+
+   #define  MIL_UINT_MIN               MIL_UINT64_MIN
+   #define  MIL_UINT_MAX               MIL_UINT64_MAX
+   #define  MIL_INT_MIN                MIL_INT64_MIN
+   #define  MIL_INT_MAX                MIL_INT64_MAX
+   #else // M_MIL_USE_64BIT
+   typedef                long         MIL_INT32;
+   typedef const          long         MIL_CINT32;
+   typedef       unsigned long         MIL_UINT32;
+   typedef const unsigned long         MIL_CUINT32;
+
+   #define  MIL_UINT_MIN               MIL_UINT32_MIN
+   #define  MIL_UINT_MAX               MIL_UINT32_MAX
+   #define  MIL_INT_MIN                MIL_INT32_MIN
+   #define  MIL_INT_MAX                MIL_INT32_MAX
+   #endif
+
+   #define  MIL_UINT32_MIN             0
+   #define  MIL_UINT32_MAX             4294967295U
+   #define  MIL_INT32_MIN              (-MIL_INT32_MAX - 1) // -2147483648L does not yield the right value
+   #define  MIL_INT32_MAX              2147483647
+   #define  MIL_UINT32_MIN_FLT         0U                //Min precise value in 32-bit floating point.
+   #define  MIL_UINT32_MAX_FLT         0xFFFFFF00U       //Max precise value in 32-bit floating point.
+   #define  MIL_INT32_MIN_FLT          (-2147483647-1)   //Min precise value in 32-bit floating point.
+   #define  MIL_INT32_MAX_FLT          0x7FFFFF80       //Max precise value in 32-bit floating point.
+
+   #if M_MIL_USE_64BIT
+      typedef                long       MIL_INT64;
+      typedef const          long       MIL_CINT64;
+      typedef       unsigned long       MIL_UINT64;
+      typedef const unsigned long       MIL_CUINT64;
+   #else
+      typedef                long long MIL_INT64;
+      typedef const          long long MIL_CINT64;
+      typedef       unsigned long long MIL_UINT64;
+      typedef const unsigned long long MIL_CUINT64;
+   #endif
+   #define  MIL_UINT64_MIN             0ULL
+   #define  MIL_UINT64_MAX             18446744073709551615ULL
+   #define  MIL_INT64_MAX              9223372036854775807LL
+   #define  MIL_INT64_MIN              (-MIL_INT64_MAX - 1LL) // Using -9223372036854775808LL directly causes weird warnings.
+   #define  MIL_UINT64_MIN_DBL         0ULL                    //Min precise value in 64-bit floating point.
+   #define  MIL_UINT64_MAX_DBL         0xFFFFFFFFFFFFF800ULL   //Max precise value in 64-bit floating point.
+   #define  MIL_INT64_MIN_DBL          (-9223372036854775807LL - 1LL)  //Min precise value in 64-bit floating point.
+   #define  MIL_INT64_MAX_DBL          0x7FFFFFFFFFFFFC00LL    //Max precise value in 64-bit floating point.
+
+   typedef                double       MIL_DOUBLE;
+   typedef                float        MIL_FLOAT;
+   typedef                char         MIL_INT8;
+   typedef const          char         MIL_CINT8;
+   typedef       unsigned char         MIL_UINT8;
+   typedef const unsigned char         MIL_CUINT8;
+   typedef                short        MIL_INT16;
+   typedef const          short        MIL_CINT16;
+   typedef       unsigned short        MIL_UINT16;
+   typedef const unsigned short        MIL_CUINT16;
+   typedef MIL_INT32                   MIL_BOOL;
+   typedef const MIL_INT32             MIL_CBOOL;
+
+   #define  MIL_UINT8_MIN              0UL
+   #define  MIL_UINT8_MAX              255UL
+   #define  MIL_INT8_MIN               -128L
+   #define  MIL_INT8_MAX               127L
+   #define  MIL_UINT16_MIN             0UL
+   #define  MIL_UINT16_MAX             65535UL
+   #define  MIL_INT16_MIN              -32768L
+   #define  MIL_INT16_MAX              32767L
+   #define  MIL_DOUBLE_MIN             DBL_MIN
+   #define  MIL_DOUBLE_MAX             DBL_MAX
+   #define  MIL_FLOAT_MIN              FLT_MIN
+   #define  MIL_FLOAT_MAX              FLT_MAX
+   #define  MIL_BOOL_MIN               0UL
+   #define  MIL_BOOL_MAX               1UL
+
+   typedef       unsigned short        MIL_WCHAR;
+
+#else
+   #error Operating system not supported!
+#endif
+
+typedef MIL_UINT64               MIL_DATA_PTR;
+
+typedef MIL_DATA_PTR             MIL_PHYS_DATA_PTR;
+typedef void*                    MIL_HOST_DATA_PTR;
+typedef const void*              MIL_CONST_HOST_DATA_PTR;
+
+typedef MIL_UINT                 MIL_ADDR;   // this type is used to cast a pointer to an integer type for arithmetic conversion
+                                             // for example void *NewPtr = (void*)((MIL_ADDR)OldPtr + Offset);
+
+typedef unsigned char            MIL_BYTE;
+
+#if M_MIL_USE_64BIT
+#define M_MIL_USE_INT64_ID 1
+#endif
+
+#if defined(M_MIL_USE_INT64_ID) && M_MIL_USE_INT64_ID
+   typedef  MIL_INT64  MIL_ID;
+#else
+   typedef  MIL_INT32  MIL_ID;
+#endif
+
+#if M_MIL_USE_LINUX && M_MIL_USE_64BIT
+   #define MAKE_INT64(I)        (I ## L)
+   #define MAKE_UINT64(I)       (I ## LU)
+#elif M_MIL_USE_LINUX || (defined(__GNUC__) && __GNUC__)
+   #define MAKE_INT64(I)        (I ## LL)
+   #define MAKE_UINT64(I)       (I ## LLU)
+#elif M_MIL_USE_WINDOWS
+   #define MAKE_INT64(I)        (I##I64)
+   #define MAKE_UINT64(I)       (I##Ui64)
+#else
+   #define MAKE_INT64(I)        (I)
+   #define MAKE_UINT64(I)       (I)
+#endif
+
+#if !M_MIL_USE_64BIT
+#define M_PTR_TO_DOUBLE(ptr)            ((double) MPtrToInt((void*)(ptr)))
+#define M_STRING_TO_DOUBLE(ptr)         M_PTR_TO_DOUBLE((ptr))
+#define M_PTR_TO_MIL_INT(val)           ((MIL_INT)MPtrToInt((void*)(val)))
+#else
+#define M_PTR_TO_DOUBLE(ptr)            (MIL_INT64)(ptr)
+#define M_STRING_TO_DOUBLE(ptr)         M_PTR_TO_DOUBLE(ptr)
+#define M_PTR_TO_MIL_INT(val)           ((MIL_INT)((MIL_UINT)val))
+#endif //!M_MIL_USE_64BIT
+#define M_DOUBLE_TO_PTR(val)            ((void *)((MIL_UINT)val))
+#define M_CLIENT_ASCII_ENCODING                           MAKE_INT64(0x0001000000000000)
+#define M_CLIENT_TEXT_ENCODING                        MAKE_INT64(0x0001000000000000)
+
+#if M_MIL_USE_UNICODE && !M_MIL_UNICODE_API
+#define     M_CLIENT_ENCODING       M_CLIENT_ASCII_ENCODING
+#else
+#define     M_CLIENT_ENCODING       0
+#endif
+
+#define M_CLIENT_ASCII_ENCODING_SET(X)                ((((X) & M_CLIENT_TEXT_ENCODING) == M_CLIENT_ASCII_ENCODING) ? true : false)
+#define M_STRIP_CLIENT_TEXT_ENCODING(X)               ((X) & ~M_CLIENT_TEXT_ENCODING)
+
+#define M_STRING_SIZE                                 MAKE_INT64(0x0000050000000000)
+#define M_FUNC_INQUIRE_STRING_START                   47
+#define M_APP_INQUIRE_OBJ_STRING_STA               M_FUNC_INQUIRE_STRING_START // 47
+   #define M_OBJECT_NAME                           ((M_FUNC_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING) //47
+
+   #define M_OBJECT_NAME_SIZE                         (M_STRING_SIZE + M_OBJECT_NAME)
+
+#define M_OBJ_HOOK_RANGE_START                                   0x000000800L
+#define M_INVALID                                                         -1
+#define M_DEFAULT                                                 0x10000000L
+#define M_UNHOOK                                                  0x04000000L
+#define M_NULL_ERROR                                              0L
+#define M_NO_ERROR                                                0L
+
+#define M_NO_TIMEOUT                                              0x00000800
+#define M_BUFFER_TOO_SMALL                                                 1
+#define M_SUCCESS                                                 0x00000000L // Already defined in milreg.h, milcolor.h
+
+#define M_CURRENT                                                 0x00000002L
+#define M_CURRENT_FCT                                             0x00030000L
+#define M_CURRENT_SUB_NB                                          0x00000004L
+#define M_CURRENT_SUB                                             0x00050000L
+#define M_CURRENT_SUB_1                                           0x00050000L
+#define M_CURRENT_SUB_2                                           0x00060000L
+#define M_CURRENT_SUB_3                                           0x00070000L
+#define M_GLOBAL                                                  0x00000008L
+#define M_GLOBAL_FCT                                              0x00090000L
+#define M_GLOBAL_SUB_NB                                           0x000A0000L
+#define M_GLOBAL_SUB                                              0x000B0000L
+#define M_GLOBAL_SUB_1                                            0x000B0000L
+#define M_GLOBAL_SUB_2                                            0x000C0000L
+#define M_GLOBAL_SUB_3                                            0x000D0000L
+#define M_PARAM_NB                                                0x00140000L
+#define M_BUFFER_ID                                               0x00160000L
+#define M_REGION_OFFSET_X                                         0x00410000L
+#define M_REGION_OFFSET_Y                                         0x00420000L
+#define M_REGION_SIZE_X                                           0x00430000L
+#define M_REGION_SIZE_Y                                           0x00480000L
+#define M_OBJECT_ID                                               0x001B0000L
+#define M_PARAM_VALUE                                             0x08000000L
+#define M_EXTENDED_PARAM_TYPE                                     0x10000000L
+#define M_PARAM_ATTRIBUTES                                        0x04000000L
+#define M_PARAM_SIZE                                              0x01000000L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API )
+#define M_MESSAGE                                     (0x20000000L|M_CLIENT_ERROR_ASCII_MODE)
+#else
+#define M_MESSAGE                                                 0x20000000L
+#endif
+#else
+#define M_MESSAGE                                                 (0x20000000L | M_CLIENT_ENCODING)
+#endif
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_OBJECT_PUBLISH_WEB                                   34L
+#endif
+
+#define M_SILENT                                                  0x00000100L
+
+#define M_ERROR                                                   0x40000000L
+#define M_ERROR_CURRENT                                   (M_ERROR|M_CURRENT)
+#define M_CONNECTING                                                       1L
+#define M_DISCONNECT                                                       2L
+#define M_CONNECT                                                          3L
+#define M_TIMEOUT                                                       2077L
+#define M_UPDATE_WEB                                                    3187L
+#define M_UPDATE_END                                M_OBJ_HOOK_RANGE_START+8L
+#define M_OBJECT_FREE                                             0x00010000L
+#define M_OBJECT_PUBLISH_WEB                                              38L
+#define M_COMPONENT_ADD                                           0x00040000
+#define M_COMPONENT_REMOVE                         M_OBJ_HOOK_RANGE_START+10L
+#define M_GET_END                                                         32L
+#define M_READ_END                                                        11L
+#define M_UPDATE_INTERACTIVE_STATE                                        84L
+
+#define M_ERROR_MESSAGE_SIZE                                              320L
+
+#define M_INTERNAL_FORMAT                                          0x00003F00L
+#define M_INTERNAL_FORMAT_SHIFT                                    8L
+#define M_INTERNAL_COMPLETE_FORMAT                                 0x7FFFFF80L
+#define M_ANY_INTERNAL_FORMAT                                      (0   << M_INTERNAL_FORMAT_SHIFT)
+#define M_BGRX32                                                       (17  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color BGRX  8.8.8.8  format
+#define M_BGR32                                                        M_BGRX32
+
+#define M_APP_INQUIRE_SYS_START                                        15000L
+#define M_CLOSE_CONNECTION                     (M_APP_INQUIRE_SYS_START+504L)
+#define M_WEB_PUBLISHED_FORMAT                                          3206L
+
+// Inquires
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_PUBLISH                                  14L
+#define M_OLD_WEB_PUBLISHED_LIST                            4
+#define M_OLD_WEB_PUBLISHED_LIST_SIZE                       5
+#define M_OLD_WEB_PUBLISHED_NAME                    (6 | M_CLIENT_ENCODING)
+#endif
+#define M_WEB_PUBLISH                                  244
+#define M_WEB_PUBLISHED_LIST                            12
+#define M_WEB_PUBLISHED_LIST_SIZE                       17
+#define M_WEB_PUBLISHED_NAME                    (7 | M_CLIENT_ENCODING)
+
+#define M_TYPE                                        1008L
+#define M_SIZE_X                                      1536L
+#define M_SIZE_Y                                      1537L
+#define M_SIZE_BYTE                                   5061L
+#define M_MESSAGE_LENGTH                                16L
+#define M_INTERACTIVE                                M_NULL
+
+// Object Type
+#define M_APPLICATION                                 0x00000200L
+#define M_DISPLAY                                     0x00200000L
+#define M_LUT                                         0x00040000L
+#define M_KERNEL                                      0x00400000L
+#define M_EVENT                                       0x00000080L
+#define M_STRUCT_ELEMENT                              0x08000000L
+#define M_ARRAY                                       0x00000040L
+#define M_GROUP                                       MAKE_INT64(0x0000400000000000)
+#define M_IMAGE                                       0x00000004L
+#define M_MODIFIED_BUFFER                             0x40000000L
+#define M_BUFFER_ID                                   0x00160000L
+#define M_OBJECT_ID                                   0x001B0000L
+#define M_GROUP_ID                                            18L
+#define M_MESSAGE_MAILBOX                             MAKE_INT64(0x0000800000000000)
+#define M_FUNC_INQUIRE_STRING_START                   47
+
+#define M_OBJECT_NAME                           ((M_FUNC_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING)
+#define M_OBJECT_NAME_SIZE                         (M_STRING_SIZE + M_OBJECT_NAME)
+#define M_OBJECT_TYPE                                         136
+#define M_COMPONENT_COUNT                                      17L
+#define M_WEB_CLIENT_INDEX                                    219L
+#define M_WEB_CLIENT_TYPE                                     220L
+#define M_READ_WRITE                                    0x00000010L
+#define M_READ_ONLY                                     0x00000020L
+#define M_NO                                                     0L
+
+#define M_COMPONENT_ID_LIST                           M_COMPONENT_LIST
+#define M_COMPONENT_LIST                              0x00100000
+#define M_ARRAY_ID_MASK                               0x000FFFFF
+#define M_ARRAY_ID_SIZE(N)                            (N & M_ARRAY_ID_MASK)
+#define M_EXTRACT_ARRAY_ID_SIZE(N)                    ((MIL_INT)(N & M_ARRAY_ID_MASK))
+
+#define M_HOST_ADDRESS                                   0x00010000L
+#define M_IMAGE_HOST_ADDRESS                             0x00010000L
+// DataType
+#define M_SIGN                                                 1014L
+#define M_SIZE_BAND                                            1005L
+#define M_UNSIGNED                                       0x00000000L
+#define M_SIGNED                                         0x08000000L
+#define M_FLOAT                             (0x40000000L | M_SIGNED)
+#define M_USER_DATA_PTR                                   0x00000001
+
+#define M_MESSAGE_PTR                                            101
+
+#define M_MOUSE_LEFT_BUTTON_DOWN                                 56L
+#define M_MOUSE_RIGHT_BUTTON_DOWN                                57L
+#define M_MOUSE_LEFT_BUTTON_UP                                   58L
+#define M_MOUSE_RIGHT_BUTTON_UP                                  59L
+#define M_MOUSE_MOVE                                             64L
+#define M_MOUSE_WHEEL                                            65L
+#define M_MOUSE_MIDDLE_BUTTON_DOWN                               66L
+#define M_MOUSE_MIDDLE_BUTTON_UP                                 67L
+#define M_KEY_DOWN                                               68L
+#define M_KEY_UP                                                 69L
+#define M_MOUSE_LEAVE                                            85L
+
+#define M_KEY_SHIFT                                       0x00010000
+#define M_KEY_CTRL                                        0x00020000
+#define M_KEY_ALT                                         0x00040000
+#define M_MOUSE_LEFT_BUTTON                               0x00080000
+#define M_MOUSE_MIDDLE_BUTTON                             0x00100000
+#define M_MOUSE_RIGHT_BUTTON                              0x00200000
+#define M_KEY_WIN                                         0x00400000
+
+#define M_MOUSE_POSITION_X                                         1L
+#define M_MOUSE_POSITION_Y                                         2L
+#define M_ANNOTATIONS_DC                                           3L
+#define M_COMBINATION_KEYS                                         7L
+#define M_EVENT_VALUE                                              8L
+
+#define M_MOUSE_WHEEL_VALUE                              M_EVENT_VALUE
+#define M_KEY_VALUE                                      M_EVENT_VALUE
+
+
+
+#define M_FRAMES_PER_SECOND_DEFAULT                               10
+
+#define M_ENABLE                                               -9997L
+#define M_DISABLE                                              -9999L
+#define M_NOW                                                     29L
+
+#define M_PRINT_DISABLE                                            0L
+#define M_PRINT_ENABLE                                             1L
+
+#define M_FRAME_RATE                                            6002L
+
+#define M_PIXEL_FORMAT                                          3032L //M_LOCAL_DISPLAY_CONTROL
+#define M_DATA_FORMAT                                           1041L
+#define M_PITCH                                            0x20000000L
+#define M_PITCH_BYTE                                      0x08000000L
+#define M_INTERNAL_FORMAT_SHIFT                                    8L
+#define M_MONO8                           (2   << M_INTERNAL_FORMAT_SHIFT)   // Force  8 bits pixels in monochrome format
+#define M_RGBX32                          (9   << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color RGBX  8.8.8.8  format
+#define M_RGB32                                             M_RGBX32
+
+#define WEB_TIMEOUT                                             100
+#define WEB_MAX_LOOP_WAIT                                        20
+
+// MIL Web application Type
+#define M_WEB_APPLICATION                                        1L
+#define M_STANDALONE_APPLICATION                                 2L
+
+typedef MIL_INT (MFTYPE* MIL_HOOK_FUNCTION_PTR)(MIL_INT HookType,
+                                                MIL_ID EventId,
+                                                void* UserData);
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#if M_MIL_USE_UNICODE
+void MFTYPE MilWebMappOpenConnectionW(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr);
+void MFTYPE MilWebMappOpenConnectionA(const char* ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr);
+#if M_MIL_UNICODE_API
+#define MilWebMappOpenConnection MilWebMappOpenConnectionW
+#else
+#define MilWebMappOpenConnection MilWebMappOpenConnectionA
+#endif
+#else
+void MFTYPE MilWebMappOpenConnection(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr);
+#endif
+void MFTYPE MilWebMappCloseConnection(MIL_ID AppId);
+MIL_INT MFTYPE MilWebMappInquireConnection(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void* UserVarPtr);
+MIL_INT MFTYPE MilWebMappInquire(MIL_ID AppId, MIL_INT64 InquireType, void* ResultPtr);
+void MFTYPE MilWebMappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT ControlFlag);
+void MFTYPE MilWebMappHookFunction(MIL_ID AppId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandlerPtr, void* UserDataPtr);
+MIL_INT MFTYPE MilWebMappGetHookInfo(MIL_ID AppId, MIL_ID EventId, MIL_INT64 InfoType, void* UserPtr);
+
+MIL_INT MFTYPE MilWebMdispInquire(MIL_ID DisplayId, MIL_INT64 InquireType, void* ResultPtr);
+void MFTYPE MilWebMdispControl(MIL_ID DisplayId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag);
+void MFTYPE  MilWebMdispMessage(  MIL_ID  DisplayId, MIL_INT EventType, MIL_INT MousePositionX,MIL_INT MousePositionY, MIL_INT EventValue, MIL_INT CombinationKeys, MIL_INT UserValue);
+void MFTYPE MilWebMdispHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandler, void *UserDataPtr);
+MIL_INT MFTYPE MilWebMdispGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+void MFTYPE MilWebMdispZoom(MIL_ID DisplayId, MIL_DOUBLE XFactor, MIL_DOUBLE YFactor);
+
+MIL_INT MFTYPE MilWebMbufInquire(MIL_ID BufId, MIL_INT64 InquireType, void* ResultPtr);
+void MFTYPE MilWebMbufControl(MIL_ID BufId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag);
+MIL_INT MFTYPE MilWebMbufGetHookInfo(MIL_ID EventId,  MIL_INT64 InfoType, void* UserPtr);
+void MFTYPE MilWebMbufGet(MIL_ID SrcBufId, void* BufferPtr);
+
+MIL_INT MFTYPE MilWebMobjInquire(MIL_ID ObjectId, MIL_INT64 InquireType, void* ResultPtr);
+void MFTYPE MilWebMobjControl(MIL_ID ObjId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag);
+void MFTYPE MilWebMobjHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandler, void *UserDataPtr);
+MIL_INT MFTYPE MilWebMobjGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+
+
+MIL_INT64 MFTYPE MilWebMobjMessageRead(MIL_ID MessageId, void* MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 *MessageOutSizePtr, MIL_INT64 *MessageTagPtr, MIL_INT64 *StatusPtr, MIL_INT64  OperationFlag);
+void MFTYPE MilWebMobjMessageWrite(MIL_ID MessageId, const void* MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64  OperationFlag);
+
+MIL_UINT MFTYPE MPtrToInt(void *pPtr);
+#ifdef __cplusplus
+}
+#endif
+
+
+#ifdef __cplusplus
+namespace MilWeb
+   {
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+      inline void MappOpenConnection(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr)
+         {
+         MilWebMappOpenConnectionW(ConnectionDescriptor, InitFlag, ControlFlag, RemoteContextAppIdPtr);
+         }
+#else
+      inline void MappOpenConnection(const char* ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr)
+         {
+         MilWebMappOpenConnectionA(ConnectionDescriptor, InitFlag, ControlFlag, RemoteContextAppIdPtr);
+         }
+#endif
+#else
+      inline void MappOpenConnection(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr)
+         {
+         MilWebMappOpenConnection(ConnectionDescriptor, InitFlag, ControlFlag, RemoteContextAppIdPtr);
+         }
+#endif
+      inline void  MappCloseConnection(MIL_ID AppId)
+         {
+         MilWebMappCloseConnection(AppId);
+         }
+
+      inline MIL_INT MappInquireConnection(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void* UserVarPtr)
+         {
+         return MilWebMappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr);
+         }
+
+      inline MIL_INT MappInquire(MIL_ID AppId, MIL_INT64 InquireType, void* ResultPtr)
+         {
+         return MilWebMappInquire(AppId, InquireType, ResultPtr);
+         }
+
+      inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT ControlFlag)
+         {
+         MilWebMappControl(ContextAppId, ControlType, ControlFlag);
+         }
+
+      inline void MappHookFunction(MIL_ID AppId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandlerPtr, void* UserDataPtr)
+         {
+         MilWebMappHookFunction(AppId, HookType, HookHandlerPtr, UserDataPtr);
+         }
+
+      inline MIL_INT MappGetHookInfo(MIL_ID AppId, MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr)
+         {
+         return MilWebMappGetHookInfo(AppId,EventId, InfoType, UserVarPtr);
+         }
+
+      inline MIL_INT MdispInquire(MIL_ID DisplayId, MIL_INT64 InquireType, void* ResultPtr)
+         {
+         return MilWebMdispInquire(DisplayId, InquireType, ResultPtr);
+         }
+
+      inline void MdispControl(MIL_ID DisplayId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag)
+         {
+         MilWebMdispControl(DisplayId, ControlType, ControlFlag);
+         }
+
+      inline void MdispMessage(  MIL_ID  DisplayId, MIL_INT EventType, MIL_INT MousePositionX,MIL_INT MousePositionY, MIL_INT EventValue, MIL_INT CombinationKeys, MIL_INT UserValue)
+         {
+         MilWebMdispMessage(DisplayId, EventType, MousePositionX, MousePositionY, EventValue, CombinationKeys, UserValue);
+         }
+
+      inline void MdispHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandler, void *UserDataPtr)
+         {
+         MilWebMdispHookFunction(ObjectId, HookType, HookHandler, UserDataPtr);
+         }
+
+      inline MIL_INT MdispGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr)
+         {
+         return MilWebMdispGetHookInfo(EventId, InfoType, UserVarPtr);
+         }
+
+      inline void MdispZoom(MIL_ID DisplayId, MIL_DOUBLE XFactor, MIL_DOUBLE YFactor)
+         {
+         MilWebMdispZoom(DisplayId, XFactor, YFactor);
+         }
+
+      inline MIL_INT MbufInquire(MIL_ID BufId, MIL_INT64 InquireType, void* ResultPtr)
+         {
+         return  MilWebMbufInquire(BufId, InquireType, ResultPtr);
+         }
+
+      inline MIL_INT MbufGetHookInfo(MIL_ID EventId,  MIL_INT64 InfoType, void* UserPtr)
+         {
+         return MilWebMbufGetHookInfo(EventId,  InfoType, UserPtr);
+         }
+
+      inline void MbufGet(MIL_ID SrcBufId, void* BufferPtr)
+         {
+         MilWebMbufGet(SrcBufId, BufferPtr);
+         }
+
+      inline void MbufControl(MIL_ID BufId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag)
+         {
+         MilWebMbufControl(BufId, ControlType, ControlFlag);
+         }
+
+      inline MIL_INT MobjInquire(MIL_ID ObjId, MIL_INT64 InquireType, void* ResultPtr)
+         {
+         return MilWebMobjInquire(ObjId, InquireType, ResultPtr);
+         }
+
+      inline void MobjControl(MIL_ID ObjectId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag)
+         {
+         MilWebMobjControl(ObjectId, ControlType, ControlFlag);
+         }
+
+      inline void MobjHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandler, void *UserDataPtr)
+         {
+         MilWebMobjHookFunction(ObjectId, HookType, HookHandler, UserDataPtr);
+         }
+
+      inline MIL_INT MobjGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr)
+         {
+         return MilWebMobjGetHookInfo(EventId, InfoType, UserVarPtr);
+         }
+
+
+      inline MIL_INT64 MobjMessageRead(MIL_ID MessageId, void* MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 *MessageOutSizePtr, MIL_INT64 *MessageTagPtr, MIL_INT64 *StatusPtr, MIL_INT64  OperationFlag)
+         {
+         return MilWebMobjMessageRead(MessageId, MessagePtr, MessageInSize, MessageOutSizePtr, MessageTagPtr, StatusPtr, OperationFlag);
+         }
+
+      inline void MobjMessageWrite(MIL_ID MessageId, const void* MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64  OperationFlag)
+         {
+         MilWebMobjMessageWrite(MessageId, MessagePtr, MessageSize, MessageTag, OperationFlag);
+         }
+   }
+#endif // __cplusplus
+#endif //__MIL_WEB_CLIENT_H
diff --git a/Common_Class/Matrox/dll/DigitizerController.dll b/Common_Class/Matrox/dll/DigitizerController.dll
new file mode 100644
index 0000000..dcd5ca2
--- /dev/null
+++ b/Common_Class/Matrox/dll/DigitizerController.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/Liberatus.dll b/Common_Class/Matrox/dll/Liberatus.dll
new file mode 100644
index 0000000..5102b1c
--- /dev/null
+++ b/Common_Class/Matrox/dll/Liberatus.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MILIrisGTRFocusDelay.dll b/Common_Class/Matrox/dll/MILIrisGTRFocusDelay.dll
new file mode 100644
index 0000000..cf76040
--- /dev/null
+++ b/Common_Class/Matrox/dll/MILIrisGTRFocusDelay.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MILPerf.dll b/Common_Class/Matrox/dll/MILPerf.dll
new file mode 100644
index 0000000..98ef923
--- /dev/null
+++ b/Common_Class/Matrox/dll/MILPerf.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MILQSVEngine.dll b/Common_Class/Matrox/dll/MILQSVEngine.dll
new file mode 100644
index 0000000..eaca889
--- /dev/null
+++ b/Common_Class/Matrox/dll/MILQSVEngine.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/McomController.dll b/Common_Class/Matrox/dll/McomController.dll
new file mode 100644
index 0000000..2627d8d
--- /dev/null
+++ b/Common_Class/Matrox/dll/McomController.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilAux.dll b/Common_Class/Matrox/dll/MilAux.dll
new file mode 100644
index 0000000..92e3980
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilAux.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilClarityUHD.dll b/Common_Class/Matrox/dll/MilClarityUHD.dll
new file mode 100644
index 0000000..6e7fb65
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilClarityUHD.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilClarityUHDUI.dll b/Common_Class/Matrox/dll/MilClarityUHDUI.dll
new file mode 100644
index 0000000..07ec4bf
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilClarityUHDUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilCodec.dll b/Common_Class/Matrox/dll/MilCodec.dll
new file mode 100644
index 0000000..5047ab1
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilCodec.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilConcordPoE.dll b/Common_Class/Matrox/dll/MilConcordPoE.dll
new file mode 100644
index 0000000..0a59512
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilConcordPoE.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilConcordPoEUI.dll b/Common_Class/Matrox/dll/MilConcordPoEUI.dll
new file mode 100644
index 0000000..979747b
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilConcordPoEUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilDSFCapture.dll b/Common_Class/Matrox/dll/MilDSFCapture.dll
new file mode 100644
index 0000000..55b8c2c
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilDSFCapture.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilDSFCommon.dll b/Common_Class/Matrox/dll/MilDSFCommon.dll
new file mode 100644
index 0000000..b6342df
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilDSFCommon.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilDSFSequence.dll b/Common_Class/Matrox/dll/MilDSFSequence.dll
new file mode 100644
index 0000000..d85343b
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilDSFSequence.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilDirectX.dll b/Common_Class/Matrox/dll/MilDirectX.dll
new file mode 100644
index 0000000..18e6bc5
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilDirectX.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilDisplay.dll b/Common_Class/Matrox/dll/MilDisplay.dll
new file mode 100644
index 0000000..f5945af
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilDisplay.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilGPU.dll b/Common_Class/Matrox/dll/MilGPU.dll
new file mode 100644
index 0000000..50848ae
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilGPU.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilGPUd3d10.dll b/Common_Class/Matrox/dll/MilGPUd3d10.dll
new file mode 100644
index 0000000..3e132ef
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilGPUd3d10.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilGPUd3d11.dll b/Common_Class/Matrox/dll/MilGPUd3d11.dll
new file mode 100644
index 0000000..5b51eac
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilGPUd3d11.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilGPUd3d9.dll b/Common_Class/Matrox/dll/MilGPUd3d9.dll
new file mode 100644
index 0000000..bdc4ef4
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilGPUd3d9.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilGenTL.dll b/Common_Class/Matrox/dll/MilGenTL.dll
new file mode 100644
index 0000000..ae61066
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilGenTL.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilGenTLUI.dll b/Common_Class/Matrox/dll/MilGenTLUI.dll
new file mode 100644
index 0000000..96a06fe
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilGenTLUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilGigEVision.dll b/Common_Class/Matrox/dll/MilGigEVision.dll
new file mode 100644
index 0000000..798a99c
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilGigEVision.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilGrabc.dll b/Common_Class/Matrox/dll/MilGrabc.dll
new file mode 100644
index 0000000..90cdf11
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilGrabc.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilIrisGTRUI.dll b/Common_Class/Matrox/dll/MilIrisGTRUI.dll
new file mode 100644
index 0000000..284db21
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilIrisGTRUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilMorphis.dll b/Common_Class/Matrox/dll/MilMorphis.dll
new file mode 100644
index 0000000..2039675
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilMorphis.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilMorphisQxt.dll b/Common_Class/Matrox/dll/MilMorphisQxt.dll
new file mode 100644
index 0000000..eadde9f
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilMorphisQxt.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilNetwork.dll b/Common_Class/Matrox/dll/MilNetwork.dll
new file mode 100644
index 0000000..aead836
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilNetwork.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilNetworkSlave.dll b/Common_Class/Matrox/dll/MilNetworkSlave.dll
new file mode 100644
index 0000000..2ce569e
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilNetworkSlave.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilOrionHd.dll b/Common_Class/Matrox/dll/MilOrionHd.dll
new file mode 100644
index 0000000..078e48d
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilOrionHd.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRadient.dll b/Common_Class/Matrox/dll/MilRadient.dll
new file mode 100644
index 0000000..74f7275
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRadient.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRadientCXP.dll b/Common_Class/Matrox/dll/MilRadientCXP.dll
new file mode 100644
index 0000000..992461d
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRadientCXP.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRadientCXPUI.dll b/Common_Class/Matrox/dll/MilRadientCXPUI.dll
new file mode 100644
index 0000000..e2ed335
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRadientCXPUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRadientPro.dll b/Common_Class/Matrox/dll/MilRadientPro.dll
new file mode 100644
index 0000000..457c06c
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRadientPro.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRadientProUI.dll b/Common_Class/Matrox/dll/MilRadientProUI.dll
new file mode 100644
index 0000000..93eb2e1
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRadientProUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRadientUI.dll b/Common_Class/Matrox/dll/MilRadientUI.dll
new file mode 100644
index 0000000..bbf8ddc
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRadientUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRadientevcl.dll b/Common_Class/Matrox/dll/MilRadientevcl.dll
new file mode 100644
index 0000000..1ea331c
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRadientevcl.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRadientevclUI.dll b/Common_Class/Matrox/dll/MilRadientevclUI.dll
new file mode 100644
index 0000000..f237e85
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRadientevclUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRapixoCXP.dll b/Common_Class/Matrox/dll/MilRapixoCXP.dll
new file mode 100644
index 0000000..51675e2
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRapixoCXP.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilRapixoCXPUI.dll b/Common_Class/Matrox/dll/MilRapixoCXPUI.dll
new file mode 100644
index 0000000..3ff49e6
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilRapixoCXPUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilSoliosUI.dll b/Common_Class/Matrox/dll/MilSoliosUI.dll
new file mode 100644
index 0000000..f0818e3
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilSoliosUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/MilgigevisionUI.dll b/Common_Class/Matrox/dll/MilgigevisionUI.dll
new file mode 100644
index 0000000..864b07b
--- /dev/null
+++ b/Common_Class/Matrox/dll/MilgigevisionUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/Milim.dll b/Common_Class/Matrox/dll/Milim.dll
new file mode 100644
index 0000000..2d91b17
--- /dev/null
+++ b/Common_Class/Matrox/dll/Milim.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/Milnetworkinfo.dll b/Common_Class/Matrox/dll/Milnetworkinfo.dll
new file mode 100644
index 0000000..774a58c
--- /dev/null
+++ b/Common_Class/Matrox/dll/Milnetworkinfo.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/Milsolios.dll b/Common_Class/Matrox/dll/Milsolios.dll
new file mode 100644
index 0000000..d602daf
--- /dev/null
+++ b/Common_Class/Matrox/dll/Milsolios.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/Milusb3visionUI.dll b/Common_Class/Matrox/dll/Milusb3visionUI.dll
new file mode 100644
index 0000000..96efff9
--- /dev/null
+++ b/Common_Class/Matrox/dll/Milusb3visionUI.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/RadientPfpga.dll b/Common_Class/Matrox/dll/RadientPfpga.dll
new file mode 100644
index 0000000..50e77cf
--- /dev/null
+++ b/Common_Class/Matrox/dll/RadientPfpga.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/SoliosPFpga.dll b/Common_Class/Matrox/dll/SoliosPFpga.dll
new file mode 100644
index 0000000..fe85004
--- /dev/null
+++ b/Common_Class/Matrox/dll/SoliosPFpga.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/libmfxsw64.dll b/Common_Class/Matrox/dll/libmfxsw64.dll
new file mode 100644
index 0000000..b20bcb4
--- /dev/null
+++ b/Common_Class/Matrox/dll/libmfxsw64.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/mil.dll b/Common_Class/Matrox/dll/mil.dll
new file mode 100644
index 0000000..28ae3ba
--- /dev/null
+++ b/Common_Class/Matrox/dll/mil.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/mil3d.dll b/Common_Class/Matrox/dll/mil3d.dll
new file mode 100644
index 0000000..c82710c
--- /dev/null
+++ b/Common_Class/Matrox/dll/mil3d.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milcacheinfo.dll b/Common_Class/Matrox/dll/milcacheinfo.dll
new file mode 100644
index 0000000..d53152e
--- /dev/null
+++ b/Common_Class/Matrox/dll/milcacheinfo.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milcom.dll b/Common_Class/Matrox/dll/milcom.dll
new file mode 100644
index 0000000..be284fa
--- /dev/null
+++ b/Common_Class/Matrox/dll/milcom.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/mildig.dll b/Common_Class/Matrox/dll/mildig.dll
new file mode 100644
index 0000000..4c76ad0
--- /dev/null
+++ b/Common_Class/Matrox/dll/mildig.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milfpga.dll b/Common_Class/Matrox/dll/milfpga.dll
new file mode 100644
index 0000000..6f59e6f
--- /dev/null
+++ b/Common_Class/Matrox/dll/milfpga.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milhttpserver.dll b/Common_Class/Matrox/dll/milhttpserver.dll
new file mode 100644
index 0000000..9c6c779
--- /dev/null
+++ b/Common_Class/Matrox/dll/milhttpserver.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milirisgtr.dll b/Common_Class/Matrox/dll/milirisgtr.dll
new file mode 100644
index 0000000..ccd7bc8
--- /dev/null
+++ b/Common_Class/Matrox/dll/milirisgtr.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milmp.dll b/Common_Class/Matrox/dll/milmp.dll
new file mode 100644
index 0000000..39789b4
--- /dev/null
+++ b/Common_Class/Matrox/dll/milmp.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milnetworkserver.dll b/Common_Class/Matrox/dll/milnetworkserver.dll
new file mode 100644
index 0000000..12ae5dc
--- /dev/null
+++ b/Common_Class/Matrox/dll/milnetworkserver.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milpcie.dll b/Common_Class/Matrox/dll/milpcie.dll
new file mode 100644
index 0000000..04e71ba
--- /dev/null
+++ b/Common_Class/Matrox/dll/milpcie.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milshm.dll b/Common_Class/Matrox/dll/milshm.dll
new file mode 100644
index 0000000..77290d3
--- /dev/null
+++ b/Common_Class/Matrox/dll/milshm.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milusb3vision.dll b/Common_Class/Matrox/dll/milusb3vision.dll
new file mode 100644
index 0000000..9670310
--- /dev/null
+++ b/Common_Class/Matrox/dll/milusb3vision.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milwebclient.dll b/Common_Class/Matrox/dll/milwebclient.dll
new file mode 100644
index 0000000..dc9de18
--- /dev/null
+++ b/Common_Class/Matrox/dll/milwebclient.dll
Binary files differ
diff --git a/Common_Class/Matrox/dll/milwebserver.dll b/Common_Class/Matrox/dll/milwebserver.dll
new file mode 100644
index 0000000..c46c2f8
--- /dev/null
+++ b/Common_Class/Matrox/dll/milwebserver.dll
Binary files differ
diff --git a/Common_Class/Matrox/lib/Mil3d.lib b/Common_Class/Matrox/lib/Mil3d.lib
new file mode 100644
index 0000000..18d27f6
--- /dev/null
+++ b/Common_Class/Matrox/lib/Mil3d.lib
Binary files differ
diff --git a/Common_Class/Matrox/lib/Milim.lib b/Common_Class/Matrox/lib/Milim.lib
new file mode 100644
index 0000000..642479f
--- /dev/null
+++ b/Common_Class/Matrox/lib/Milim.lib
Binary files differ
diff --git a/Common_Class/Matrox/lib/mil.lib b/Common_Class/Matrox/lib/mil.lib
new file mode 100644
index 0000000..053db2c
--- /dev/null
+++ b/Common_Class/Matrox/lib/mil.lib
Binary files differ
diff --git a/Common_Class/Matrox/lib/milcom.lib b/Common_Class/Matrox/lib/milcom.lib
new file mode 100644
index 0000000..4b2c7aa
--- /dev/null
+++ b/Common_Class/Matrox/lib/milcom.lib
Binary files differ
diff --git a/Common_Class/Matrox/lib/milfpga.lib b/Common_Class/Matrox/lib/milfpga.lib
new file mode 100644
index 0000000..2eb263c
--- /dev/null
+++ b/Common_Class/Matrox/lib/milfpga.lib
Binary files differ
diff --git a/Common_Class/Matrox/lib/milwebclient.lib b/Common_Class/Matrox/lib/milwebclient.lib
new file mode 100644
index 0000000..aad6152
--- /dev/null
+++ b/Common_Class/Matrox/lib/milwebclient.lib
Binary files differ
diff --git a/Common_Class/MegaLock/lib/l_mega64.lib b/Common_Class/MegaLock/lib/l_mega64.lib
new file mode 100644
index 0000000..d53675e
--- /dev/null
+++ b/Common_Class/MegaLock/lib/l_mega64.lib
Binary files differ
diff --git a/Common_Class/MegaLock/lib/l_mega64__.lib b/Common_Class/MegaLock/lib/l_mega64__.lib
new file mode 100644
index 0000000..a439cc6
--- /dev/null
+++ b/Common_Class/MegaLock/lib/l_mega64__.lib
Binary files differ
diff --git a/Common_Class/Mvsol/MVENC852v30_User Manual_V141.pdf b/Common_Class/Mvsol/MVENC852v30_User Manual_V141.pdf
new file mode 100644
index 0000000..f02389b
--- /dev/null
+++ b/Common_Class/Mvsol/MVENC852v30_User Manual_V141.pdf
Binary files differ
diff --git a/Common_Class/Mvsol/include/Mvsenc.h b/Common_Class/Mvsol/include/Mvsenc.h
new file mode 100644
index 0000000..1580f90
--- /dev/null
+++ b/Common_Class/Mvsol/include/Mvsenc.h
@@ -0,0 +1,174 @@
+锘�#ifndef __MVS_ENC_H__
+#define __MVS_ENC_H__
+
+#ifndef HANDLE
+typedef void *HANDLE;
+#endif
+
+#ifndef USHORT
+typedef unsigned short USHORT;
+#endif
+
+#ifndef UINT
+typedef unsigned int UINT;
+#endif // !UINT
+
+typedef void(__stdcall *MvsEncSendCallBack)(unsigned char*, int);
+typedef void(__stdcall *MvsEncRecvCallBack)(unsigned char*, int);
+// 靷毄 靾滌劀 頃鸽摛霟� 靸濎劚 -> 韽姼 鞐搓赴 -> Read, Write -> 韽姼 雼赴 -> 頃鸽摛霟� 鞝滉卑 -> Release()
+
+#pragma region 頃鸽摛霟�, 韽姼鞐搓赴, Read, Write
+
+
+
+//頃鸽摛霟� 靸濎劚, 頃挫牅, 鞙犿毃靹� 瓴�靷�
+extern "C"   HANDLE __stdcall MvsEncCreateHandler();
+extern "C"   void __stdcall MvsEncCloseHandler(HANDLE handle);
+extern "C"   bool __stdcall MvsEncIsValidHandle(HANDLE handle);
+
+//Open, Close, Open Check
+extern "C"   bool __stdcall MvsEncOpen(HANDLE handle, const char* lpszDevice);
+extern "C"   void __stdcall MvsEncClose(HANDLE handle);
+extern "C"   bool __stdcall MvsEncIsOpen(HANDLE handle);
+extern "C"   bool __stdcall MvsEncPurge(HANDLE handle);
+
+//Read, Write
+extern "C"   UINT __stdcall MvsEncSendOnly(HANDLE handle, char command, USHORT address, UINT data = 0);
+extern "C"   UINT __stdcall MvsEncSendData(HANDLE handle, char command, USHORT address, UINT data = 0, UINT *out = nullptr);
+extern "C"   UINT __stdcall MvsEncSendRead(HANDLE handle, USHORT address, UINT data, UINT *out = nullptr);
+extern "C"   UINT __stdcall MvsEncSendWrite(HANDLE handle, USHORT address, UINT data, UINT *out = nullptr);
+extern "C"   UINT __stdcall MvsEncRead(HANDLE handle, void* buffer, int offset, int count, bool *cancel);
+extern "C"	 UINT __stdcall MvsEncReadUntil(HANDLE handle, void* buffer, unsigned char etx, bool * cancel);
+
+//頃挫牅
+extern "C"  void __stdcall MvsEncRelease();
+#pragma endregion
+
+#pragma region Event
+//Send, receive Event
+extern "C"   UINT __stdcall MvsEncRegisterSendEvent(HANDLE handle, void* func);
+extern "C"   UINT __stdcall MvsEncRegisterRecvEvent(HANDLE handle, void* func);
+extern "C"   UINT __stdcall MvsEncRegisterErrorEvent(HANDLE handle, void* func);
+#pragma endregion
+
+#pragma region Enc頃垬 Return Status
+//Trigger Controls
+extern "C"   UINT __stdcall MvsEncSetTriggerControlsEachTrigger(HANDLE handle, int triggerID, int type, int channel, int multi, int conditionFactor, int outputOperator, int directionFactor, int positionDirection, int correction, int triggerBase);
+extern "C"   UINT __stdcall MvsEncSetTriggerControls(HANDLE handle, int triggerID, const void* ctrl);
+extern "C"   UINT __stdcall MvsEncGetTriggerControls(HANDLE handle, int triggerID, void* ctrl);
+
+extern "C"  UINT __stdcall MvsEncSetTriggerGenerator(HANDLE handle, int triggerID, int cycle, int pulseHigh);
+extern "C"  UINT __stdcall MvsEncGetTriggerGenerator(HANDLE handle, int triggerID, int* cycle, int* pulseHigh);
+
+
+//ROLL VERSION 鞝勳毄
+extern "C"   UINT __stdcall MvsEncSetTriggerGeneratorRoll(HANDLE handle, int triggerID, unsigned int cycle);
+extern "C"   UINT __stdcall MvsEncGetTriggerGeneratorRoll(HANDLE handle, int triggerID, int* cycle);
+
+//鞎勲偁搿滉犯 毂勲鞍鞙� 靹れ爼
+extern "C"  UINT __stdcall MvsEncSetEncoderMultiForAnalog(HANDLE handle, int triggerID, int AnalogMulti);
+extern "C"  UINT __stdcall MvsEncGetEncoderMultiForAnalog(HANDLE handle, int triggerID, int* AnalogMulti);
+
+//鞎勲偁搿滉犯 鞛呺牓 氩旍渼
+extern "C"   UINT __stdcall MvsSetEncoderInputRange(HANDLE handle, int triggerID, int Range);
+extern "C"   UINT __stdcall MvsGetEncoderInputRange(HANDLE handle, int triggerID, int* Range);
+
+//鞎勲偁搿滉犯 鞐旍綌雿� 旌橂Μ敫岆爤鞚挫厴
+extern "C"  UINT __stdcall MvsEncStartCalibration(HANDLE handle, int triggerID);
+extern "C"  UINT __stdcall MvsEncStopCalibration(HANDLE handle, int triggerID);
+
+//韸鸽Μ瓯� 於滊牓 甑皠 靹れ爼
+//count 臧掛溂搿� 靹れ爼(start)
+extern "C"  UINT __stdcall MvsEncSetTriggerPosition0(HANDLE handle, int triggerID, int position);
+//um 臧掛溂搿� 靹れ爼
+extern "C"  UINT __stdcall MvsEncSetTriggerPositionMicrometer0(HANDLE handle, int triggerID, int position, int multi, double resolution, int unit = 0);
+extern "C"  UINT __stdcall MvsEncGetTriggerPosition0(HANDLE handle, int triggerID, int* position);
+//count 臧掛溂搿� 靹れ爼(end)
+extern "C"  UINT __stdcall MvsEncSetTriggerPosition1(HANDLE handle, int triggerID, int position);
+//um 臧掛溂搿� 靹れ爼
+extern "C"  UINT __stdcall MvsEncSetTriggerPositionMicrometer1(HANDLE handle, int triggerID, int position, int multi, double resolution, int unit = 0);
+extern "C"  UINT __stdcall MvsEncGetTriggerPosition1(HANDLE handle, int triggerID, int *position);
+
+extern "C"  UINT __stdcall MvsEncSetEncoderDirection(HANDLE handle, int triggerID, int direction);
+extern "C"  UINT __stdcall MvsEncGetEncoderDirection(HANDLE handle, int triggerID, int *direction);
+
+//韸鸽Μ瓯� 於滊牓 氇摐 靹れ爼
+extern "C"  UINT __stdcall MvsEncSetTriggerOutputMode(HANDLE handle, int triggerID, int mode);
+extern "C"  UINT __stdcall MvsEncGetTriggerOutputMode(HANDLE handle, int triggerID, int *mode);
+
+extern "C"  UINT __stdcall MvsEncSetTriggerPulseWidth(HANDLE handle, int triggerID, double pulseWidth);
+extern "C"  UINT __stdcall MvsEncGetTriggerPulseWidth(HANDLE handle, int triggerID, double *pulseWidth);
+
+extern "C"  UINT __stdcall MvsEncSetTriggerDelay(HANDLE handle, int triggerID, double delay);
+extern "C"  UINT __stdcall MvsEncGetTriggerDelay(HANDLE handle, int triggerID, double *delay);
+
+extern "C"  UINT __stdcall MvsEncSetEncoderResetValue(HANDLE handle, int triggerID, int position);
+extern "C"  UINT __stdcall MvsEncGetEncoderResetValue(HANDLE handle, int triggerID, int *position);
+
+//臧�靸� 鞐旍綌雿�, 欤柬寣靾� 靹れ爼
+extern "C" UINT __stdcall MvsEncSetVirtualEncoderFrequency(HANDLE handle, int virtualEncoderID, int frequency);
+extern "C" UINT __stdcall MvsEncGetVirtualEncoderFrequency(HANDLE handle, int virtualEncoderID, int *frequency);
+
+
+//霐旍韯胳瀰霠� 臧� 臧�鞝胳槫旮�
+extern "C"  UINT __stdcall MvsEncGetDI(HANDLE handle, int* di0, int* di1, int* di2, int* di3, int* di4, int* di5, int* di6);
+extern "C"  UINT __stdcall MvsEncGetDIState(HANDLE handle, int diID, int *value);
+
+//霐旍韯胳瀰霠� 旃挫毚韸� 臧� 臧�鞝胳槫旮�
+extern "C"  UINT __stdcall MvsEncGetDiCount(HANDLE handle, int diID, UINT *dicount);
+//韸鸽Μ瓯办稖霠� 旃挫毚韸� 臧� 臧�鞝胳槫旮�
+extern "C"  UINT __stdcall MvsEncGetTriggerCount(HANDLE handle, int triggerID, UINT *Triggercount);
+//順勳灛鞙勳箻 臧�鞝胳槫旮� count
+extern "C"  UINT __stdcall MvsEncGetEncoderPosition(HANDLE handle, int encoderID, int *encoderposition);
+//霐旍韯� 順勳灛鞙勳箻 臧�鞝胳槫旮� ummh
+extern "C"  UINT __stdcall MvsEncGetEncoderPositionForAnalog(HANDLE handle, int encoderID, int multi, double resolution, int *encoderposition);
+//鞐愲煬 旃挫毚韸� 臧� 臧�鞝胳槫旮�
+extern "C"  UINT __stdcall MvsEncGetTriggerErrorCount(HANDLE handle, int triggerID,UINT *errorCount);
+
+//韼岇洦鞏措矂鞝勱臣 氤措摐韮�鞛� 臧�鞝胳槫旮�
+extern "C"  UINT __stdcall MvsEncGetFirmwareVersion(HANDLE handle, double *version);
+//搿滌氩勳爠 臧�鞝胳槫旮�
+extern "C"  UINT __stdcall MvsEncGetLogicVersion(HANDLE handle, double *version);
+
+//氤措摐齑堦赴頇�
+extern "C"  UINT __stdcall MvsEncLoadDefaultParameters(HANDLE handle);
+//頂岆灅鞁滊氇Μ鞐� 靹れ爼臧� 鞝�鞛�
+extern "C"  UINT __stdcall MvsEncSaveFlash(HANDLE handle);
+//頂岆灅鞁滊氇Μ鞐愳劀 靹れ爼臧� 臧�鞝胳槫旮�
+extern "C"  UINT __stdcall MvsEncLoadFlash(HANDLE handle);
+//氇摖 旃挫毚韸� 齑堦赴頇�
+extern "C"  UINT __stdcall MvsEncClearAll(HANDLE handle);
+//霐旍韯胳瀰霠� 旃挫毚韸� 齑堦赴頇�
+extern "C"  UINT __stdcall MvsEncClearDiAll(HANDLE handle);
+//韸鸽Μ瓯办稖霠� 旃挫毚韸� 齑堦赴頇�
+extern "C"  UINT __stdcall MvsEncClearTriggerAll(HANDLE handle);
+//順勳灛鞙勳箻 齑堦赴頇�
+extern "C"  UINT __stdcall MvsEncClearEncoderPositionAll(HANDLE handle);
+//鞐愲煬 旃挫毚韸� 齑堦赴頇�
+extern "C"  UINT __stdcall MvsEncClearErrorCountAll(HANDLE handle);
+//霐旍韯胳瀰霠� 旃挫毚韸� 齑堦赴頇� 臧滊硠
+extern "C"  UINT __stdcall MvsEncClearDiCount(HANDLE handle, int diID);
+//韸鸽Μ瓯办稖霠� 旃挫毚韸� 齑堦赴頇� 臧滊硠
+extern "C"  UINT __stdcall MvsEncClearTriggerCount(HANDLE handle, int triggerID);
+//順勳灛鞙勳箻 齑堦赴頇� 臧滊硠
+extern "C"  UINT __stdcall MvsEncClearEncoderPosition(HANDLE handle, int encoderID);
+//鞐愲煬 旃挫毚韸� 齑堦赴頇� 臧滊硠
+extern "C"  UINT __stdcall MvsEncClearErrorCount(HANDLE handle, int id);
+
+//鞐旍綌雿� 攵勴暣電� 靹れ爼
+//resolution (um)
+extern "C"  UINT __stdcall  MvsEncSetEncoderResolution(HANDLE handle, double resolution);
+extern "C"  UINT __stdcall MvsEncGetEncoderResolution(HANDLE handle, double *resolution);
+
+
+
+
+#pragma endregion
+
+
+
+
+
+
+
+#endif
\ No newline at end of file
diff --git a/Common_Class/Mvsol/include/Mvsencenum.h b/Common_Class/Mvsol/include/Mvsencenum.h
new file mode 100644
index 0000000..fd3ccc9
--- /dev/null
+++ b/Common_Class/Mvsol/include/Mvsencenum.h
@@ -0,0 +1,104 @@
+#ifndef __MVS_ENC_ENUM_H__
+#define __MVS_ENC_ENUM_H__
+
+#ifndef MVS_ENC_HT_TRGCONTROL_
+#define MVS_ENC_HT_TRGCONTROL_
+
+typedef struct MVS_ENC_HT_TRGCONTROL
+{
+	unsigned int EncoderType : 4;		//0:DIFF, 1:TTL, 2:Virtual Encoder
+	unsigned int EncoderCh : 4;		//Encoder CH (0~3)
+	unsigned int Multi : 4;		//Encoder Multi(1:x1, 2:x2, 4:x4)
+	unsigned int CondFactor : 4;		//0:DI0 ~ 6:DI6, 7:High, 8:Low
+	unsigned int TriggerOutputOperator : 4;		//0:AND, 1:OR, 2:XOR, 3:NAND
+	unsigned int EncoderResetFactor : 4;		//0:DISABLE, 1:DI0 ~ 7:DI6, 8:CW, 9:CCW
+	unsigned int PositionDirection : 4;		//0:DISABLE, 1:Positive, 2:Negative, 3:Bi-Direction
+	unsigned int Temp : 2;
+	unsigned int Correction : 1;		//0:DISABLE, 1:ENABLE
+	unsigned int TriggerBase : 1;		//0:COUNT, 1:POSITION
+} MVS_ENC_HT_TRGCONTROL;
+
+typedef enum MVS_ENC_HT_TRGCONTROL_TRIGGERBASE
+{
+	TRIGGERBASE_COUNT = 0x00,
+	TRIGGERBASE_POSITION = 0x01
+}MVS_ENC_HT_TRGCONTROL_TRIGGERBASE;
+
+typedef enum MVS_ENC_HT_TRGCONTROL_CORRECTION
+{
+	CORRECTION_DISABLE = 0x00,
+	CORRECTION_ENABLE = 0x01
+} MVS_ENC_HT_TRGCONTROL_CORRECTION;
+
+typedef enum MVS_ENC_HT_TRGCONTROL_POSITIONDIRECTION
+{
+	POSITIONDIRECTION_DISABLE = 0x00, 
+	POSITIONDIRECTION_POSITIVE = 0x01,
+	POSITIONDIRECTION_NEGATIVE = 0x02,
+	POSITIONDIRECTION_BIDIRECTION = 0x03
+} MVS_ENC_HT_TRGCONTROL_POSITIONDIRECTION;
+
+typedef enum MVS_ENC_HT_TRGCONTROL_ENCODERRESETFACTOR
+{
+	ENCODERRESETFACTOR_DISABLE = 0x00,
+	ENCODERRESETFACTOR_DI0 = 0x01,
+	ENCODERRESETFACTOR_DI1 = 0x02,
+	ENCODERRESETFACTOR_DI2 = 0x03,
+	ENCODERRESETFACTOR_DI3 = 0x04
+} MVS_ENC_HT_TRGCONTROL_ENCODER_ENCODERRESETFACTOR;
+
+typedef enum MVS_ENC_HT_TRGCONTROL_TRIGGEROUT
+{
+	TRIGGEROUT_AND = 0x00,
+	TRIGGEROUT_OR = 0x01,
+	TRIGGEROUT_XOR = 0x02,
+	TRIGGEROUT_NAND = 0x03,
+} MVS_ENC_HT_TRGCONTROL_ENCODER_TRIGGEROUT;
+
+typedef enum MVS_ENC_HT_TRGCONTROL_CONDITIONFACTOR
+{
+	CONDITIONFACTOR_DI0 = 0x00,
+	CONDITIONFACTOR_DI1 = 0x01,
+	CONDITIONFACTOR_DI2 = 0x02,
+	CONDITIONFACTOR_DI3 = 0x03,
+	CONDITIONFACTOR_HIGH = 0x04,
+	CONDITIONFACTOR_LOW = 0x05,
+
+} MVS_ENC_HT_TRGCONTROL_CONDITIONFACTOR;
+
+
+typedef enum MVS_ENC_HT_TRGCONTROL_MULTI
+{
+	MULTI_MultiX1 = 0,
+	MULTI_MultiX2 = 1,
+	MULTI_MultiX4 = 2
+} MVS_ENC_HT_TRGCONTROL_MULTI;
+
+
+typedef enum MVS_ENC_HT_TRGCONTROL_ENCODERCHANNEL
+{
+	ENCODERCHANNEL_ENCODER0 = 0x00,
+	ENCODERCHANNEL_ENCODER1 = 0x01,
+	ENCODERCHANNEL_ENCODER2 = 0x02,
+	ENCODERCHANNEL_ENCODER3 = 0x03,
+
+} MVS_ENC_HT_TRGCONTROL_ENCODERCHANNEL;
+
+typedef enum MVS_ENC_HT_TRGCONTROL_ENCODERTYPE
+{
+	ENCODERTYPE_DIFF = 0x00,
+	ENCODERTYPE_TTL = 0x01,
+	ENCODERTYPE_Virtual = 0x02
+} MVS_ENC_HT_TRGCONTROL_ENCODERTYPE;
+#endif
+
+
+
+
+
+
+
+
+
+
+#endif
\ No newline at end of file
diff --git a/Common_Class/Mvsol/include/Serial.h b/Common_Class/Mvsol/include/Serial.h
new file mode 100644
index 0000000..7c1eb7a
--- /dev/null
+++ b/Common_Class/Mvsol/include/Serial.h
@@ -0,0 +1,367 @@
+//	Serial.h - Definition of the CSerial class
+//
+//	Copyright (C) 1999-2003 Ramon de Klein (Ramon.de.Klein@ict.nl)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+#ifndef __SERIAL_H
+#define __SERIAL_H
+
+
+//////////////////////////////////////////////////////////////////////
+// The SERIAL_DEFAULT_OVERLAPPED defines if the default open mode uses
+// overlapped I/O. When overlapped I/O is available (normal Win32
+// platforms) it uses overlapped I/O. Windows CE doesn't allow the use
+// of overlapped I/O, so it is disabled there by default.
+
+#ifndef SERIAL_DEFAULT_OVERLAPPED
+#ifndef SERIAL_NO_OVERLAPPED
+#define SERIAL_DEFAULT_OVERLAPPED	true
+#else
+#define SERIAL_DEFAULT_OVERLAPPED	false
+#endif
+#endif
+
+
+//////////////////////////////////////////////////////////////////////
+//
+// CSerial - Win32 wrapper for serial communications
+//
+// Serial communication often causes a lot of problems. This class
+// tries to supply an easy to use interface to deal with serial
+// devices.
+//
+// The class is actually pretty ease to use. You only need to open
+// the COM-port, where you need to specify the basic serial
+// communication parameters. You can also choose to setup handshaking
+// and read timeout behaviour.
+//
+// The following serial classes are available:
+//
+// CSerial      - Serial communication support.
+// CSerialEx    - Serial communication with listener thread for events
+// CSerialSync  - Serial communication with synchronized event handler
+// CSerialWnd   - Asynchronous serial support, which uses the Win32
+//                message queue for event notification.
+// CSerialMFC   - Preferred class to use in MFC-based GUI windows.
+// 
+//
+// Pros:
+// -----
+//	- Easy to use (hides a lot of nasty Win32 stuff)
+//	- Fully ANSI and Unicode aware
+//
+// Cons:
+// -----
+//  - Little less flexibility then native Win32 API, however you can
+//    use this API at the same time for features which are missing
+//    from this class.
+//  - Incompatible with Windows 95 or Windows NT v3.51 (or earlier),
+//    because CancelIo isn't support on these platforms. Define the
+//	  SERIAL_NO_CANCELIO macro for support of these platforms as
+//	  well. When this macro is defined, then only time-out values of
+//	  0 or INFINITE are valid.
+//
+//
+// Copyright (C) 1999-2003 Ramon de Klein
+//                         (Ramon.de.Klein@ict.nl)
+
+class CSerial
+{
+// Class enumerations
+public:
+	// Communication event
+	typedef enum
+	{
+		EEventUnknown  	   = -1,			// Unknown event
+		EEventNone  	   = 0,				// Event trigged without cause
+		EEventBreak 	   = EV_BREAK,		// A break was detected on input
+		EEventCTS   	   = EV_CTS,		// The CTS signal changed state
+		EEventDSR   	   = EV_DSR,		// The DSR signal changed state
+		EEventError 	   = EV_ERR,		// A line-status error occurred
+		EEventRing  	   = EV_RING,		// A ring indicator was detected
+		EEventRLSD  	   = EV_RLSD,		// The RLSD signal changed state
+		EEventRecv  	   = EV_RXCHAR,		// Data is received on input
+		EEventRcvEv 	   = EV_RXFLAG,		// Event character was received on input
+		EEventSend		   = EV_TXEMPTY,	// Last character on output was sent
+		EEventPrinterError = EV_PERR,		// Printer error occured
+		EEventRx80Full	   = EV_RX80FULL,	// Receive buffer is 80 percent full
+		EEventProviderEvt1 = EV_EVENT1,		// Provider specific event 1
+		EEventProviderEvt2 = EV_EVENT2,		// Provider specific event 2
+	} 
+	EEvent;
+
+	// Baudrate
+	typedef enum
+	{
+		EBaudUnknown = -1,			// Unknown
+		EBaud110     = CBR_110,		// 110 bits/sec
+		EBaud300     = CBR_300,		// 300 bits/sec
+		EBaud600     = CBR_600,		// 600 bits/sec
+		EBaud1200    = CBR_1200,	// 1200 bits/sec
+		EBaud2400    = CBR_2400,	// 2400 bits/sec
+		EBaud4800    = CBR_4800,	// 4800 bits/sec
+		EBaud9600    = CBR_9600,	// 9600 bits/sec
+		EBaud14400   = CBR_14400,	// 14400 bits/sec
+		EBaud19200   = CBR_19200,	// 19200 bits/sec (default)
+		EBaud38400   = CBR_38400,	// 38400 bits/sec
+		EBaud56000   = CBR_56000,	// 56000 bits/sec
+		EBaud57600   = CBR_57600,	// 57600 bits/sec
+		EBaud115200  = CBR_115200,	// 115200 bits/sec
+		EBaud128000  = CBR_128000,	// 128000 bits/sec
+		EBaud256000  = CBR_256000,	// 256000 bits/sec
+	}
+	EBaudrate;
+
+	// Data bits (5-8)
+	typedef enum
+	{
+		EDataUnknown = -1,			// Unknown
+		EData5       =  5,			// 5 bits per byte
+		EData6       =  6,			// 6 bits per byte
+		EData7       =  7,			// 7 bits per byte
+		EData8       =  8			// 8 bits per byte (default)
+	}
+	EDataBits;
+
+	// Parity scheme
+	typedef enum
+	{
+		EParUnknown = -1,			// Unknown
+		EParNone    = NOPARITY,		// No parity (default)
+		EParOdd     = ODDPARITY,	// Odd parity
+		EParEven    = EVENPARITY,	// Even parity
+		EParMark    = MARKPARITY,	// Mark parity
+		EParSpace   = SPACEPARITY	// Space parity
+	}
+	EParity;
+
+	// Stop bits
+	typedef enum
+	{
+		EStopUnknown = -1,			// Unknown
+		EStop1       = ONESTOPBIT,	// 1 stopbit (default)
+		EStop1_5     = ONE5STOPBITS,// 1.5 stopbit
+		EStop2       = TWOSTOPBITS	// 2 stopbits
+	} 
+	EStopBits;
+
+	// Handshaking
+	typedef enum
+	{
+		EHandshakeUnknown		= -1,	// Unknown
+		EHandshakeOff			=  0,	// No handshaking
+		EHandshakeHardware		=  1,	// Hardware handshaking (RTS/CTS)
+		EHandshakeSoftware		=  2	// Software handshaking (XON/XOFF)
+	} 
+	EHandshake;
+
+	// Timeout settings
+	typedef enum
+	{
+		EReadTimeoutUnknown		= -1,	// Unknown
+		EReadTimeoutNonblocking	=  0,	// Always return immediately
+		EReadTimeoutBlocking	=  1	// Block until everything is retrieved
+	}
+	EReadTimeout;
+
+	// Communication errors
+	typedef enum
+	{
+		EErrorUnknown = 0,			// Unknown
+		EErrorBreak   = CE_BREAK,	// Break condition detected
+		EErrorFrame   = CE_FRAME,	// Framing error
+		EErrorIOE     = CE_IOE,		// I/O device error
+		EErrorMode    = CE_MODE,	// Unsupported mode
+		EErrorOverrun = CE_OVERRUN,	// Character buffer overrun, next byte is lost
+		EErrorRxOver  = CE_RXOVER,	// Input buffer overflow, byte lost
+		EErrorParity  = CE_RXPARITY,// Input parity error
+		EErrorTxFull  = CE_TXFULL	// Output buffer full
+	}
+	EError;
+
+	// Port availability
+	typedef enum
+	{
+		EPortUnknownError = -1,		// Unknown error occurred
+		EPortAvailable    =  0,		// Port is available
+		EPortNotAvailable =  1,		// Port is not present
+		EPortInUse        =  2		// Port is in use
+
+	} 
+	EPort;
+
+// Construction
+public:
+	CSerial();
+	virtual ~CSerial();
+
+// Operations
+public:
+	// Check if particular COM-port is available (static method).
+	static EPort CheckPort (LPCTSTR lpszDevice);
+
+	// Open the serial communications for a particular COM port. You
+	// need to use the full devicename (i.e. "COM1") to open the port.
+	// It's possible to specify the size of the input/output queues.
+	virtual LONG Open (LPCTSTR lpszDevice, DWORD dwInQueue = 0, DWORD dwOutQueue = 0, bool fOverlapped = SERIAL_DEFAULT_OVERLAPPED);
+
+	// Close the serial port.
+	virtual LONG Close (void);
+
+	// Setup the communication settings such as baudrate, databits,
+	// parity and stopbits. The default settings are applied when the
+	// device has been opened. Call this function if these settings do
+	// not apply for your application. If you prefer to use integers
+	// instead of the enumerated types then just cast the integer to
+	// the required type. So the following two initializations are
+	// equivalent:
+	//
+	//   Setup(EBaud9600,EData8,EParNone,EStop1)
+	//
+	// or
+	//
+	//   Setup(EBaudrate(9600),EDataBits(8),EParity(NOPARITY),EStopBits(ONESTOPBIT))
+	//
+	// In the latter case, the types are not validated. So make sure
+	// that you specify the appropriate values.
+	virtual LONG Setup (EBaudrate eBaudrate = EBaud9600,
+						EDataBits eDataBits = EData8,
+						EParity   eParity   = EParNone,
+						EStopBits eStopBits = EStop1);
+
+	// Set/clear the event character. When this byte is being received
+	// on the serial port then the EEventRcvEv event is signalled,
+	// when the mask has been set appropriately. If the fAdjustMask flag
+	// has been set, then the event mask is automatically adjusted.
+	virtual LONG SetEventChar (BYTE bEventChar, bool fAdjustMask = true);
+
+	// Set the event mask, which indicates what events should be
+	// monitored. The WaitEvent method can only monitor events that
+	// have been enabled. The default setting only monitors the
+	// error events and data events. An application may choose to
+	// monitor CTS. DSR, RLSD, etc as well.
+	virtual LONG SetMask (DWORD dwMask = EEventBreak|EEventError|EEventRecv);
+
+	// The WaitEvent method waits for one of the events that are
+	// enabled (see SetMask).
+	virtual LONG WaitEvent (LPOVERLAPPED lpOverlapped = 0, DWORD dwTimeout = INFINITE);
+
+	// Setup the handshaking protocol. There are three forms of
+	// handshaking:
+	//
+	// 1) No handshaking, so data is always send even if the receiver
+	//    cannot handle the data anymore. This can lead to data loss,
+	//    when the sender is able to transmit data faster then the
+	//    receiver can handle.
+	// 2) Hardware handshaking, where the RTS/CTS lines are used to
+	//    indicate if data can be sent. This mode requires that both
+	//    ports and the cable support hardware handshaking. Hardware
+	//    handshaking is the most reliable and efficient form of
+	//    handshaking available, but is hardware dependant.
+	// 3) Software handshaking, where the XON/XOFF characters are used
+	//    to throttle the data. A major drawback of this method is that
+	//    these characters cannot be used for data anymore.
+	virtual LONG SetupHandshaking (EHandshake eHandshake);
+
+	// Read operations can be blocking or non-blocking. You can use
+	// this method to setup wether to use blocking or non-blocking
+	// reads. Non-blocking reads is the default, which is required
+	// for most applications.
+	//
+	// 1) Blocking reads, which will cause the 'Read' method to block
+	//    until the requested number of bytes have been read. This is
+	//    useful if you know how many data you will receive.
+	// 2) Non-blocking reads, which will read as many bytes into your
+	//    buffer and returns almost immediately. This is often the
+	//    preferred setting.
+	virtual LONG SetupReadTimeouts (EReadTimeout eReadTimeout);
+
+	// Obtain communication settings
+	virtual EBaudrate  GetBaudrate    (void);
+	virtual EDataBits  GetDataBits    (void);
+	virtual EParity    GetParity      (void);
+	virtual EStopBits  GetStopBits    (void);
+	virtual EHandshake GetHandshaking (void);
+	virtual DWORD      GetEventMask   (void);
+	virtual BYTE       GetEventChar   (void);
+
+	// Write data to the serial port. Note that we are only able to
+	// send ANSI strings, because it probably doesn't make sense to
+	// transmit Unicode strings to an application.
+	virtual LONG Write (const void* pData, size_t iLen, DWORD* pdwWritten = 0, LPOVERLAPPED lpOverlapped = 0, DWORD dwTimeout = INFINITE);
+	virtual LONG Write (LPCSTR pString, DWORD* pdwWritten = 0, LPOVERLAPPED lpOverlapped = 0, DWORD dwTimeout = INFINITE);
+
+	// Read data from the serial port. Refer to the description of
+	// the 'SetupReadTimeouts' for an explanation about (non) blocking
+	// reads and how to use this.
+	virtual LONG Read (void* pData, size_t iLen, DWORD* pdwRead = 0, LPOVERLAPPED lpOverlapped = 0, DWORD dwTimeout = INFINITE);
+
+	// Send a break
+	LONG Break (void);
+
+	// Determine what caused the event to trigger
+	EEvent GetEventType (void);
+
+	// Obtain the error
+	EError GetError (void);
+
+	// Obtain the COMM and event handle
+	HANDLE GetCommHandle (void)		{ return m_hFile; }
+
+	// Check if com-port is opened
+	bool IsOpen (void) const		{ return (m_hFile != 0); }
+
+	// Obtain last error status
+	LONG GetLastError (void) const	{ return m_lLastError; }
+
+	// Obtain CTS/DSR/RING/RLSD settings
+	bool GetCTS (void);
+	bool GetDSR (void);
+	bool GetRing (void);
+	bool GetRLSD (void);
+
+	// Purge all buffers
+	virtual LONG Purge (void);
+
+protected:
+	// Internal helper class which wraps DCB structure
+	class CDCB : public DCB
+	{
+	public:
+		CDCB() { DCBlength = sizeof(DCB); }
+	};
+
+// Attributes
+protected:
+	LONG	m_lLastError;		// Last serial error
+	HANDLE	m_hFile;			// File handle
+	EEvent	m_eEvent;			// Event type
+	DWORD	m_dwEventMask;		// Event mask
+
+#ifndef SERIAL_NO_OVERLAPPED
+	HANDLE	m_hevtOverlapped;	// Event handle for internal overlapped operations
+#endif
+
+protected:
+	// Check the requirements
+	void CheckRequirements (LPOVERLAPPED lpOverlapped, DWORD dwTimeout) const;
+
+	// CancelIo wrapper (for Win95 compatibility)
+	BOOL CancelCommIo (void);
+};
+
+#endif	// __SERIAL_H
diff --git a/Common_Class/Mvsol/include/SerialEx.h b/Common_Class/Mvsol/include/SerialEx.h
new file mode 100644
index 0000000..001ae44
--- /dev/null
+++ b/Common_Class/Mvsol/include/SerialEx.h
@@ -0,0 +1,118 @@
+//	SerialEx.h - Definition of the CSerialEx class
+//
+//	Copyright (C) 1999-2003 Ramon de Klein (Ramon.de.Klein@ict.nl)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+#ifndef __SERIAL_EX_H
+#define __SERIAL_EX_H
+
+
+//////////////////////////////////////////////////////////////////////
+// Include CSerial base class
+
+#include "Serial.h"
+
+
+//////////////////////////////////////////////////////////////////////
+//
+// CSerialEx - Win32 message-based wrapper for serial communications
+//
+// A lot of MS-Windows GUI based programs use a central message
+// loop, so the application cannot block to wait for objects. This
+// make serial communication difficult, because it isn't event
+// driven using a message queue. This class makes the CSerial based
+// classes suitable for use with such a messagequeue. Whenever
+// an event occurs on the serial port, a user-defined message will
+// be sent to a user-defined window. It can then use the standard
+// message dispatching to handle the event.
+//
+// Pros:
+// -----
+//	- Easy to use
+//	- Fully ANSI and Unicode aware
+//  - Integrates easily in GUI applications and is intuitive to
+//    use for GUI application programmers
+//
+// Cons:
+// -----
+//  - Uses a thread for each COM-port, which has been opened.
+//  - More overhead, due to thread switching and message queues.
+//  - Requires a window, but that's probably why you're using
+//    this class.
+//
+// Copyright (C) 1999-2003 Ramon de Klein
+//                         (Ramon.de.Klein@ict.nl)
+
+class CSerialEx : public CSerial
+{
+// Construction
+public:
+	CSerialEx();
+	virtual ~CSerialEx();
+
+// Operations
+public:
+	// Open the serial communications for a particular COM port. You
+	// need to use the full devicename (i.e. "COM1") to open the port.
+	virtual LONG Open (LPCTSTR lpszDevice, DWORD dwInQueue = 0, DWORD dwOutQueue = 0, bool fStartListener = false);
+
+	// Close the serial port.
+	virtual LONG Close (void);
+
+	// Start the listener thread
+	virtual LONG StartListener (void);
+
+	// Stop the listener thread. Because the other thread might be
+	// busy processing data it might take a while, so you can specify
+	// a time-out.
+	virtual LONG StopListener (DWORD dwTimeout = INFINITE);
+
+protected:
+	// Each opened COM-port uses its own specific thread, which will
+	// wait for one of the events to happen. When an event happens,
+	// then the client window is send a message informing about the
+	// event.
+	static DWORD WINAPI ThreadProc (LPVOID lpArg);
+	DWORD ThreadProc (void);
+
+	// Event handler
+	virtual void OnEvent (EEvent eEvent, EError eError) = 0;
+
+protected:
+	// The WaitEvent method is being used by this class internally
+	// and shouldn't be used by client applications. Client
+	// application should monior the messages.
+	using CSerial::WaitEvent;
+
+	// The event-type is send in the WPARAM of the message and
+	// the GetEventType method returns the wrong data, so we'll
+	// hide this method for client applications to avoid problems.
+	using CSerial::GetEventType;
+	using CSerial::GetError;
+
+protected:
+	// Internal attributes
+	bool	m_fStopping;
+	HANDLE	m_hThread;
+
+#ifndef SERIAL_NO_OVERLAPPED
+	// Handle for overlapped operations in worker-thread
+	HANDLE	m_hevtOverlappedWorkerThread;
+#endif
+};
+
+#endif	// __SERIAL_EX_H
diff --git a/Common_Class/Mvsol/include/xxEnc852Serial.h b/Common_Class/Mvsol/include/xxEnc852Serial.h
new file mode 100644
index 0000000..8c2aebf
--- /dev/null
+++ b/Common_Class/Mvsol/include/xxEnc852Serial.h
@@ -0,0 +1,223 @@
+锘�#pragma once
+#include "serialex.h"
+
+typedef struct tagTRGCTRL
+{
+	UINT Type : 4;		//0:DIFF, 1:TTL, 2:Virtual Encoder
+	UINT Ch : 4;		//Encoder CH (0~3)
+	UINT Multi : 4;		//Encoder Multi(1:x1, 2:x2, 4:x4)
+	UINT CondFactor : 4;		//0:DI0 ~ 6:DI6, 7:High, 8:Low
+	UINT OutputOperator : 4;		//0:AND, 1:OR, 2:XOR, 3:NAND
+	UINT DirectionFactor : 4;		//0:DISABLE, 1:DI0 ~ 7:DI6, 8:CW, 9:CCW
+	UINT PositionDirection : 4;		//0:DISABLE, 1:Positive, 2:Negative, 3:Bi-Direction
+	UINT Temp : 2;
+	UINT Correction : 1;		//0:DISABLE, 1:ENABLE
+	UINT TriggerBase : 1;		//0:COUNT, 1:POSITION
+} TRGCTRL;
+
+
+enum {
+	BOARD_CH_TYPE_852,
+	BOARD_CH_TYPE_100D,
+	BOARD_CH_TYPE_100A,
+	BOARD_CH_TYPE_ROLL
+};
+//////////////////////////////////////////////////////////////////////////
+/*
+Ex)
+
+	xxEnc852Serial m_serial;
+	m_serial.Open("COM1");
+
+	if (m_serial.IsValid())
+	{
+		//韸鸽Μ瓯半炒霌� 鞐瓣舶鞎堧惃.
+		return;
+	}
+
+	//FirmwareVersion (3.00)
+	double firwareVersion = m_serial.GetFirmwareVersion();
+
+	//Resolution 80um
+	m_serial.SetEncoderResolution(80);
+
+	m_serial.Purge();
+	m_serial.Close();
+
+*/
+#define WM_SIGNAL_COMPLETED (WM_USER+1)
+#define WM_SIGNAL_DATA		(WM_USER+2)
+#define WM_SIGNAL_STEP		(WM_USER+3)
+
+#define MVSOL_STATUS_SUCCESS			0x0000
+#define MVSOL_STATUS_NAK				0x00F1
+#define MVSOL_STATUS_NOTREADY			0x00F2
+#define MVSOL_STATUS_CHECKSUM			0x00F3
+#define MVSOL_STATUS_FPGADATAMISSMATCH	0x00F4
+#define MVSOL_STATUS_UNKNOWNADDRESS		0x00F5
+#define MVSOL_STATUS_FRAMEERROR			0x00F6
+#define MVSOL_STATUS_FLASHMISSMATCH		0x00F7
+#define MVSOL_STATUS_RANGEERROR			0x00F8
+#define MVSOL_STATUS_DEVICETIMEOUT		0x00F9
+#define MVSOL_STATUS_NOTOPEN			0xFFF2
+#define MVSOL_STATUS_TIMEOUT			0xFFF9
+#define MVSOL_STATUS_COUNTZERO			0xFFFA
+#define MVSOL_STATUS_UNKNOWNEXCEPTION	0xFFF6
+
+typedef struct
+{
+	byte *dataA;
+	byte *dataB;
+	byte *dataC;
+} SIGNALDATA, *PSIGNALDATA;
+
+
+class AFX_EXT_CLASS xxEnc852Serial :
+	public CSerialEx
+{
+public:
+	xxEnc852Serial(void);
+	~xxEnc852Serial(void);
+
+	static EPort CheckPort(LPCTSTR lpszDevice);
+
+	virtual LONG Open(LPCTSTR lpszDevice, DWORD dwInQueue = 0, DWORD dwOutQueue = 0, bool fStartListener = false);
+	virtual LONG Close();
+	virtual LONG Purge();
+
+	virtual void OnEvent(EEvent eEvent, EError eError);
+
+	UINT SendData(char command, USHORT address, UINT data, UINT *out = NULL);
+	UINT SendRead(USHORT address, UINT data = 0, UINT *out = NULL);
+	UINT SendWrite(USHORT address, UINT data = 1, UINT *out = NULL);
+
+	bool IsValid();
+
+
+	//韸鸽Μ瓯� 靹れ爼
+	//TRGCTRL 甑“觳� 彀戈碃
+	UINT SetTriggerControls(int triggerID, int type, int channel, int multi, int conditionFactor, int outputOperator, int directionFactor, int positionDirection, int correction, int triggerBase);
+	UINT SetTriggerControls(int triggerID, const TRGCTRL& ctrl);
+	UINT SetTriggerControls(int triggerID, UINT ctrl);
+	UINT GetTriggerControls(int triggerID, TRGCTRL* ctrl);
+	UINT GetTriggerControls(int triggerID, UINT* ctrl);
+
+	//韸鸽Μ瓯办稖霠� 靹れ爼
+	//甑槙氩勳爠 靷毄, 順疙櫂靹彪鞝滊 旮办〈頃垬 臧欖澊 靷毄
+	UINT SetTriggerGenerator(int triggerID, int cycle, int pulseHigh);
+	UINT SetTriggerGenerator(int triggerID, UINT generator);
+	UINT GetTriggerGenerator(int triggerID, int* cycle, int* pulseHigh);
+	UINT GetTriggerGenerator(int triggerID, UINT* generator);
+
+	//ROLL & 32bitCycle VERSION 鞝勳毄
+	UINT SetTriggerGeneratorCycle(int triggerID, UINT cycle);
+	UINT GetTriggerGeneratorCycle(int triggerID, UINT* cycle);
+
+	//鞎勲偁搿滉犯 毂勲鞍鞙� 靹れ爼
+	UINT SetEncoderMultiForAnalog(int triggerID, int multi);
+	UINT GetEncoderMultiForAnalog(int triggerID, int* multi);
+
+	//靷毄鞎堩暔.
+	UINT SetEncoderInputRange(int triggerID, int range);
+	UINT GetEncoderInputRange(int triggerID, int* range);
+
+	//鞎勲偁搿滉犯 鞐旍綌雿� 鞝勳毄 頃垬
+	//A靸侁臣 B靸侅潉 氚旉繄.
+	UINT SetEncoderInversion(int triggerID, int inversion);
+	UINT GetEncoderInversion(int triggerID, int* inversion);
+
+	//鞎勲偁搿滉犯 鞐旍綌雿� 旌橂Μ敫岆爤鞚挫厴
+	UINT StartCalibration(int triggerID);
+	UINT StopCalibration(int triggerID);
+
+	//韸鸽Μ瓯� 於滊牓 甑皠 靹れ爼
+	//count 臧掛溂搿� 靹れ爼
+	UINT SetTriggerPosition0(int triggerID, int position);
+	//um 臧掛溂搿� 靹れ爼
+	UINT SetTriggerPosition0(int triggerID, int position, int multi, double resolution, int unit = 0);
+	UINT GetTriggerPosition0(int triggerID, int* position);
+	//count 臧掛溂搿� 靹れ爼
+	UINT SetTriggerPosition1(int triggerID, int position);
+	//um 臧掛溂搿� 靹れ爼
+	UINT SetTriggerPosition1(int triggerID, int position, int multi, double resolution, int unit = 0);
+	UINT GetTriggerPosition1(int triggerID, int* position);
+
+	UINT SetEncoderDirection(int triggerID, int direction);
+	UINT GetEncoderDirection(int triggerID, int* direction);
+
+	//韸鸽Μ瓯� 於滊牓 氇摐 靹れ爼
+	UINT SetTriggerOutputMode(int triggerID, int mode);
+	UINT GetTriggerOutputMode(int triggerID, int* mode);
+
+	UINT SetTriggerPulseWidth(int triggerID, double pulseWidth);
+	UINT GetTriggerPulseWidth(int triggerID, double* pulseWidth);
+
+	UINT SetTriggerDelay(int triggerID, double delay);
+	UINT GetTriggerDelay(int triggerID, double* delay);
+
+	UINT SetEncoderResetValue(int triggerID, int position);
+	UINT GetEncoderResetValue(int triggerID, int* position);
+
+	//臧�靸� 鞐旍綌雿�, 欤柬寣靾� 靹れ爼
+	UINT SetVirtualEncoderFrequency(int virtualEncoderID, int frequency);
+	UINT GetVirtualEncoderFrequency(int virtualEncoderID, int* frequency);
+
+	
+	//霐旍韯胳瀰霠� 臧� 臧�鞝胳槫旮�
+	UINT GetDI(int* di0, int* di1, int* di2, int* di3, int* di4, int* di5, int* di6);
+	UINT GetDIState(int diID, int* value);
+	UINT GetDI(UINT* di);
+	
+	//霐旍韯胳瀰霠� 旃挫毚韸� 臧� 臧�鞝胳槫旮�
+	UINT GetDiCount(int diID, UINT* count);
+	//韸鸽Μ瓯办稖霠� 旃挫毚韸� 臧� 臧�鞝胳槫旮�
+	UINT GetTriggerCount(int triggerID, UINT* count);
+	//韸鸽Μ瓯办稖霠� 旃挫毚韸� 64Bit鞖� 臧� 臧�鞝胳槫旮�
+	UINT GetTriggerCount64(int triggerID, ULONG64* count);
+	//順勳灛鞙勳箻 臧�鞝胳槫旮� count
+	UINT GetEncoderPosition(int encoderID, int* position);
+	//霐旍韯� 順勳灛鞙勳箻 臧�鞝胳槫旮� um
+	int GetEncoderPosition(int encoderID, int multi, double resolution, int unit = 0);
+	//100A 順勳灛鞙勳箻 臧�鞝胳槫旮� um
+	int GetEncoderPositionForAnalog(int encoderID, int multi, double resolution, int unit = 0);
+	//鞐愲煬 旃挫毚韸� 臧� 臧�鞝胳槫旮�
+	UINT GetTriggerErrorCount(int triggerID, UINT* count);
+	
+	//韼岇洦鞏措矂鞝勱臣 氤措摐韮�鞛� 臧�鞝胳槫旮�
+	UINT GetFirmwareVersion(double* version, int *boardType, int *boardChType);
+	//搿滌氩勳爠 臧�鞝胳槫旮�
+	UINT GetLogicVersion(double* version);
+
+	//氤措摐齑堦赴頇�
+	UINT LoadDefaultParameters();
+	//頂岆灅鞁滊氇Μ鞐� 靹れ爼臧� 鞝�鞛�
+	UINT SaveFlash();
+	//頂岆灅鞁滊氇Μ鞐愳劀 靹れ爼臧� 臧�鞝胳槫旮�
+	UINT LoadFlash();
+	//氇摖 旃挫毚韸� 齑堦赴頇�
+	UINT ClearAll();
+	//霐旍韯胳瀰霠� 旃挫毚韸� 齑堦赴頇�
+	UINT ClearDiAll();
+	//韸鸽Μ瓯办稖霠� 旃挫毚韸� 齑堦赴頇�
+	UINT ClearTriggerAll();
+	//順勳灛鞙勳箻 齑堦赴頇�
+	UINT ClearEncoderPositionAll();
+	//鞐愲煬 旃挫毚韸� 齑堦赴頇�
+	UINT ClearErrorCountAll();
+	//霐旍韯胳瀰霠� 旃挫毚韸� 齑堦赴頇� 臧滊硠
+	UINT ClearDiCount(int diID);
+	//韸鸽Μ瓯办稖霠� 旃挫毚韸� 齑堦赴頇� 臧滊硠
+	UINT ClearTriggerCount(int triggerID);
+	//順勳灛鞙勳箻 齑堦赴頇� 臧滊硠
+	UINT ClearEncoderPosition(int encoderID);
+	//鞐愲煬 旃挫毚韸� 齑堦赴頇� 臧滊硠
+	UINT ClearErrorCount(int id);
+
+
+	//鞐旍綌雿� 攵勴暣電� 靹れ爼
+	//resolution (um)
+	UINT SetEncoderResolution(double resolution);
+	UINT GetEncoderResolution(double* resolution);
+
+
+};
\ No newline at end of file
diff --git a/Common_Class/Mvsol/lib/mvenc852v3.lib b/Common_Class/Mvsol/lib/mvenc852v3.lib
new file mode 100644
index 0000000..0f5ca37
--- /dev/null
+++ b/Common_Class/Mvsol/lib/mvenc852v3.lib
Binary files differ
diff --git a/Common_Class/Mvsol/lib/mvenc852v3d.lib b/Common_Class/Mvsol/lib/mvenc852v3d.lib
new file mode 100644
index 0000000..b2505ba
--- /dev/null
+++ b/Common_Class/Mvsol/lib/mvenc852v3d.lib
Binary files differ
diff --git a/Common_Class/Mvsol/lib/mvenc852v3x64.lib b/Common_Class/Mvsol/lib/mvenc852v3x64.lib
new file mode 100644
index 0000000..c3a4f7c
--- /dev/null
+++ b/Common_Class/Mvsol/lib/mvenc852v3x64.lib
Binary files differ
diff --git a/Common_Class/Mvsol/lib/mvenc852v3x64d.lib b/Common_Class/Mvsol/lib/mvenc852v3x64d.lib
new file mode 100644
index 0000000..dda6e0e
--- /dev/null
+++ b/Common_Class/Mvsol/lib/mvenc852v3x64d.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cv.h b/Common_Class/OpenCV/opencv_3.1/include/opencv/cv.h
new file mode 100644
index 0000000..0aefc6d
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cv.h
@@ -0,0 +1,73 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_CV_H__
+#define __OPENCV_OLD_CV_H__
+
+#if defined(_MSC_VER)
+    #define CV_DO_PRAGMA(x) __pragma(x)
+    #define __CVSTR2__(x) #x
+    #define __CVSTR1__(x) __CVSTR2__(x)
+    #define __CVMSVCLOC__ __FILE__ "("__CVSTR1__(__LINE__)") : "
+    #define CV_MSG_PRAGMA(_msg) CV_DO_PRAGMA(message (__CVMSVCLOC__ _msg))
+#elif defined(__GNUC__)
+    #define CV_DO_PRAGMA(x) _Pragma (#x)
+    #define CV_MSG_PRAGMA(_msg) CV_DO_PRAGMA(message (_msg))
+#else
+    #define CV_DO_PRAGMA(x)
+    #define CV_MSG_PRAGMA(_msg)
+#endif
+#define CV_WARNING(x) CV_MSG_PRAGMA("Warning: " #x)
+
+//CV_WARNING("This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module")
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/imgproc/imgproc_c.h"
+#include "opencv2/photo/photo_c.h"
+#include "opencv2/video/tracking_c.h"
+#include "opencv2/objdetect/objdetect_c.h"
+
+#if !defined(CV_IMPL)
+#define CV_IMPL extern "C"
+#endif //CV_IMPL
+
+#endif // __OPENCV_OLD_CV_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cv.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv/cv.hpp
new file mode 100644
index 0000000..e498d7a
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cv.hpp
@@ -0,0 +1,60 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_CV_HPP__
+#define __OPENCV_OLD_CV_HPP__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "cv.h"
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/photo.hpp"
+#include "opencv2/video.hpp"
+#include "opencv2/highgui.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/calib3d.hpp"
+#include "opencv2/objdetect.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.h b/Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.h
new file mode 100644
index 0000000..fe86c5d
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.h
@@ -0,0 +1,57 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_OLD_AUX_H__
+#define __OPENCV_OLD_AUX_H__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/imgproc/imgproc_c.h"
+#include "opencv2/photo/photo_c.h"
+#include "opencv2/video/tracking_c.h"
+#include "opencv2/objdetect/objdetect_c.h"
+
+#endif
+
+/* End of file. */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.hpp
new file mode 100644
index 0000000..b0e60a3
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cvaux.hpp
@@ -0,0 +1,52 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_OLD_AUX_HPP__
+#define __OPENCV_OLD_AUX_HPP__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "cvaux.h"
+#include "opencv2/core/utility.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cvwimage.h b/Common_Class/OpenCV/opencv_3.1/include/opencv/cvwimage.h
new file mode 100644
index 0000000..de89c92
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cvwimage.h
@@ -0,0 +1,46 @@
+///////////////////////////////////////////////////////////////////////////////
+//  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) 2008, Google, 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 Intel Corporation or contributors 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.
+
+
+#ifndef __OPENCV_OLD_WIMAGE_HPP__
+#define __OPENCV_OLD_WIMAGE_HPP__
+
+#include "opencv2/core/wimage.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.h b/Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.h
new file mode 100644
index 0000000..0982bd7
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.h
@@ -0,0 +1,52 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_CXCORE_H__
+#define __OPENCV_OLD_CXCORE_H__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "opencv2/core/core_c.h"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.hpp
new file mode 100644
index 0000000..9af4ac7
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cxcore.hpp
@@ -0,0 +1,53 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_CXCORE_HPP__
+#define __OPENCV_OLD_CXCORE_HPP__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "cxcore.h"
+#include "opencv2/core.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp
new file mode 100644
index 0000000..1f04d1a
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp
@@ -0,0 +1,48 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_EIGEN_HPP__
+#define __OPENCV_OLD_EIGEN_HPP__
+
+#include "opencv2/core/eigen.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/cxmisc.h b/Common_Class/OpenCV/opencv_3.1/include/opencv/cxmisc.h
new file mode 100644
index 0000000..6c93a0c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/cxmisc.h
@@ -0,0 +1,8 @@
+#ifndef __OPENCV_OLD_CXMISC_H__
+#define __OPENCV_OLD_CXMISC_H__
+
+#ifdef __cplusplus
+#  include "opencv2/core/utility.hpp"
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/highgui.h b/Common_Class/OpenCV/opencv_3.1/include/opencv/highgui.h
new file mode 100644
index 0000000..0261029
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/highgui.h
@@ -0,0 +1,48 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_OLD_HIGHGUI_H__
+#define __OPENCV_OLD_HIGHGUI_H__
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/highgui/highgui_c.h"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv/ml.h b/Common_Class/OpenCV/opencv_3.1/include/opencv/ml.h
new file mode 100644
index 0000000..d8e967f
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv/ml.h
@@ -0,0 +1,47 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_OLD_ML_H__
+#define __OPENCV_OLD_ML_H__
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/ml.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp
new file mode 100644
index 0000000..ddffffe
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp
@@ -0,0 +1,2001 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CALIB3D_HPP__
+#define __OPENCV_CALIB3D_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/core/affine.hpp"
+
+/**
+  @defgroup calib3d Camera Calibration and 3D Reconstruction
+
+The functions in this section use a so-called pinhole camera model. In this model, a scene view is
+formed by projecting 3D points into the image plane using a perspective transformation.
+
+\f[s  \; m' = A [R|t] M'\f]
+
+or
+
+\f[s  \vecthree{u}{v}{1} = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}
+\begin{bmatrix}
+r_{11} & r_{12} & r_{13} & t_1  \\
+r_{21} & r_{22} & r_{23} & t_2  \\
+r_{31} & r_{32} & r_{33} & t_3
+\end{bmatrix}
+\begin{bmatrix}
+X \\
+Y \\
+Z \\
+1
+\end{bmatrix}\f]
+
+where:
+
+-   \f$(X, Y, Z)\f$ are the coordinates of a 3D point in the world coordinate space
+-   \f$(u, v)\f$ are the coordinates of the projection point in pixels
+-   \f$A\f$ is a camera matrix, or a matrix of intrinsic parameters
+-   \f$(cx, cy)\f$ is a principal point that is usually at the image center
+-   \f$fx, fy\f$ are the focal lengths expressed in pixel units.
+
+Thus, if an image from the camera is scaled by a factor, all of these parameters should be scaled
+(multiplied/divided, respectively) by the same factor. The matrix of intrinsic parameters does not
+depend on the scene viewed. So, once estimated, it can be re-used as long as the focal length is
+fixed (in case of zoom lens). The joint rotation-translation matrix \f$[R|t]\f$ is called a matrix of
+extrinsic parameters. It is used to describe the camera motion around a static scene, or vice versa,
+rigid motion of an object in front of a still camera. That is, \f$[R|t]\f$ translates coordinates of a
+point \f$(X, Y, Z)\f$ to a coordinate system, fixed with respect to the camera. The transformation above
+is equivalent to the following (when \f$z \ne 0\f$ ):
+
+\f[\begin{array}{l}
+\vecthree{x}{y}{z} = R  \vecthree{X}{Y}{Z} + t \\
+x' = x/z \\
+y' = y/z \\
+u = f_x*x' + c_x \\
+v = f_y*y' + c_y
+\end{array}\f]
+
+Real lenses usually have some distortion, mostly radial distortion and slight tangential distortion.
+So, the above model is extended as:
+
+\f[\begin{array}{l}
+\vecthree{x}{y}{z} = R  \vecthree{X}{Y}{Z} + t \\
+x' = x/z \\
+y' = y/z \\
+x'' = x'  \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + 2 p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4 \\
+y'' = y'  \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\
+\text{where} \quad r^2 = x'^2 + y'^2  \\
+u = f_x*x'' + c_x \\
+v = f_y*y'' + c_y
+\end{array}\f]
+
+\f$k_1\f$, \f$k_2\f$, \f$k_3\f$, \f$k_4\f$, \f$k_5\f$, and \f$k_6\f$ are radial distortion coefficients. \f$p_1\f$ and \f$p_2\f$ are
+tangential distortion coefficients. \f$s_1\f$, \f$s_2\f$, \f$s_3\f$, and \f$s_4\f$, are the thin prism distortion
+coefficients. Higher-order coefficients are not considered in OpenCV.
+
+In some cases the image sensor may be tilted in order to focus an oblique plane in front of the
+camera (Scheimpfug condition). This can be useful for particle image velocimetry (PIV) or
+triangulation with a laser fan. The tilt causes a perspective distortion of \f$x''\f$ and
+\f$y''\f$. This distortion can be modelled in the following way, see e.g. @cite Louhichi07.
+
+\f[\begin{array}{l}
+s\vecthree{x'''}{y'''}{1} =
+\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}(\tau_x, \tau_y)}
+{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)}
+{0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\
+u = f_x*x''' + c_x \\
+v = f_y*y''' + c_y
+\end{array}\f]
+
+where the matrix \f$R(\tau_x, \tau_y)\f$ is defined by two rotations with angular parameter \f$\tau_x\f$
+and \f$\tau_y\f$, respectively,
+
+\f[
+R(\tau_x, \tau_y) =
+\vecthreethree{\cos(\tau_y)}{0}{-\sin(\tau_y)}{0}{1}{0}{\sin(\tau_y)}{0}{\cos(\tau_y)}
+\vecthreethree{1}{0}{0}{0}{\cos(\tau_x)}{\sin(\tau_x)}{0}{-\sin(\tau_x)}{\cos(\tau_x)} =
+\vecthreethree{\cos(\tau_y)}{\sin(\tau_y)\sin(\tau_x)}{-\sin(\tau_y)\cos(\tau_x)}
+{0}{\cos(\tau_x)}{\sin(\tau_x)}
+{\sin(\tau_y)}{-\cos(\tau_y)\sin(\tau_x)}{\cos(\tau_y)\cos(\tau_x)}.
+\f]
+
+In the functions below the coefficients are passed or returned as
+
+\f[(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f]
+
+vector. That is, if the vector contains four elements, it means that \f$k_3=0\f$ . The distortion
+coefficients do not depend on the scene viewed. Thus, they also belong to the intrinsic camera
+parameters. And they remain the same regardless of the captured image resolution. If, for example, a
+camera has been calibrated on images of 320 x 240 resolution, absolutely the same distortion
+coefficients can be used for 640 x 480 images from the same camera while \f$f_x\f$, \f$f_y\f$, \f$c_x\f$, and
+\f$c_y\f$ need to be scaled appropriately.
+
+The functions below use the above model to do the following:
+
+-   Project 3D points to the image plane given intrinsic and extrinsic parameters.
+-   Compute extrinsic parameters given intrinsic parameters, a few 3D points, and their
+projections.
+-   Estimate intrinsic and extrinsic camera parameters from several views of a known calibration
+pattern (every view is described by several 3D-2D point correspondences).
+-   Estimate the relative position and orientation of the stereo camera "heads" and compute the
+*rectification* transformation that makes the camera optical axes parallel.
+
+@note
+   -   A calibration sample for 3 cameras in horizontal position can be found at
+        opencv_source_code/samples/cpp/3calibration.cpp
+    -   A calibration sample based on a sequence of images can be found at
+        opencv_source_code/samples/cpp/calibration.cpp
+    -   A calibration sample in order to do 3D reconstruction can be found at
+        opencv_source_code/samples/cpp/build3dmodel.cpp
+    -   A calibration sample of an artificially generated camera and chessboard patterns can be
+        found at opencv_source_code/samples/cpp/calibration_artificial.cpp
+    -   A calibration example on stereo calibration can be found at
+        opencv_source_code/samples/cpp/stereo_calib.cpp
+    -   A calibration example on stereo matching can be found at
+        opencv_source_code/samples/cpp/stereo_match.cpp
+    -   (Python) A camera calibration sample can be found at
+        opencv_source_code/samples/python/calibrate.py
+
+  @{
+    @defgroup calib3d_fisheye Fisheye camera model
+
+    Definitions: Let P be a point in 3D of coordinates X in the world reference frame (stored in the
+    matrix X) The coordinate vector of P in the camera reference frame is:
+
+    \f[Xc = R X + T\f]
+
+    where R is the rotation matrix corresponding to the rotation vector om: R = rodrigues(om); call x, y
+    and z the 3 coordinates of Xc:
+
+    \f[x = Xc_1 \\ y = Xc_2 \\ z = Xc_3\f]
+
+    The pinehole projection coordinates of P is [a; b] where
+
+    \f[a = x / z \ and \ b = y / z \\ r^2 = a^2 + b^2 \\ \theta = atan(r)\f]
+
+    Fisheye distortion:
+
+    \f[\theta_d = \theta (1 + k_1 \theta^2 + k_2 \theta^4 + k_3 \theta^6 + k_4 \theta^8)\f]
+
+    The distorted point coordinates are [x'; y'] where
+
+    \f[x' = (\theta_d / r) x \\ y' = (\theta_d / r) y \f]
+
+    Finally, conversion into pixel coordinates: The final pixel coordinates vector [u; v] where:
+
+    \f[u = f_x (x' + \alpha y') + c_x \\
+    v = f_y yy + c_y\f]
+
+    @defgroup calib3d_c C API
+
+  @}
+ */
+
+namespace cv
+{
+
+//! @addtogroup calib3d
+//! @{
+
+//! type of the robust estimation algorithm
+enum { LMEDS  = 4, //!< least-median algorithm
+       RANSAC = 8, //!< RANSAC algorithm
+       RHO    = 16 //!< RHO algorithm
+     };
+
+enum { SOLVEPNP_ITERATIVE = 0,
+       SOLVEPNP_EPNP      = 1, //!< EPnP: Efficient Perspective-n-Point Camera Pose Estimation @cite lepetit2009epnp
+       SOLVEPNP_P3P       = 2, //!< Complete Solution Classification for the Perspective-Three-Point Problem @cite gao2003complete
+       SOLVEPNP_DLS       = 3, //!< A Direct Least-Squares (DLS) Method for PnP  @cite hesch2011direct
+       SOLVEPNP_UPNP      = 4  //!< Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation @cite penate2013exhaustive
+
+};
+
+enum { CALIB_CB_ADAPTIVE_THRESH = 1,
+       CALIB_CB_NORMALIZE_IMAGE = 2,
+       CALIB_CB_FILTER_QUADS    = 4,
+       CALIB_CB_FAST_CHECK      = 8
+     };
+
+enum { CALIB_CB_SYMMETRIC_GRID  = 1,
+       CALIB_CB_ASYMMETRIC_GRID = 2,
+       CALIB_CB_CLUSTERING      = 4
+     };
+
+enum { CALIB_USE_INTRINSIC_GUESS = 0x00001,
+       CALIB_FIX_ASPECT_RATIO    = 0x00002,
+       CALIB_FIX_PRINCIPAL_POINT = 0x00004,
+       CALIB_ZERO_TANGENT_DIST   = 0x00008,
+       CALIB_FIX_FOCAL_LENGTH    = 0x00010,
+       CALIB_FIX_K1              = 0x00020,
+       CALIB_FIX_K2              = 0x00040,
+       CALIB_FIX_K3              = 0x00080,
+       CALIB_FIX_K4              = 0x00800,
+       CALIB_FIX_K5              = 0x01000,
+       CALIB_FIX_K6              = 0x02000,
+       CALIB_RATIONAL_MODEL      = 0x04000,
+       CALIB_THIN_PRISM_MODEL    = 0x08000,
+       CALIB_FIX_S1_S2_S3_S4     = 0x10000,
+       CALIB_TILTED_MODEL        = 0x40000,
+       CALIB_FIX_TAUX_TAUY       = 0x80000,
+       // only for stereo
+       CALIB_FIX_INTRINSIC       = 0x00100,
+       CALIB_SAME_FOCAL_LENGTH   = 0x00200,
+       // for stereo rectification
+       CALIB_ZERO_DISPARITY      = 0x00400,
+       CALIB_USE_LU              = (1 << 17), //!< use LU instead of SVD decomposition for solving. much faster but potentially less precise
+     };
+
+//! the algorithm for finding fundamental matrix
+enum { FM_7POINT = 1, //!< 7-point algorithm
+       FM_8POINT = 2, //!< 8-point algorithm
+       FM_LMEDS  = 4, //!< least-median algorithm
+       FM_RANSAC = 8  //!< RANSAC algorithm
+     };
+
+
+
+/** @brief Converts a rotation matrix to a rotation vector or vice versa.
+
+@param src Input rotation vector (3x1 or 1x3) or rotation matrix (3x3).
+@param dst Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.
+@param jacobian Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial
+derivatives of the output array components with respect to the input array components.
+
+\f[\begin{array}{l} \theta \leftarrow norm(r) \\ r  \leftarrow r/ \theta \\ R =  \cos{\theta} I + (1- \cos{\theta} ) r r^T +  \sin{\theta} \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}\f]
+
+Inverse transformation can be also done easily, since
+
+\f[\sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}\f]
+
+A rotation vector is a convenient and most compact representation of a rotation matrix (since any
+rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry
+optimization procedures like calibrateCamera, stereoCalibrate, or solvePnP .
+ */
+CV_EXPORTS_W void Rodrigues( InputArray src, OutputArray dst, OutputArray jacobian = noArray() );
+
+/** @brief Finds a perspective transformation between two planes.
+
+@param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
+or vector\<Point2f\> .
+@param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
+a vector\<Point2f\> .
+@param method Method used to computed a homography matrix. The following methods are possible:
+-   **0** - a regular method using all the points
+-   **RANSAC** - RANSAC-based robust method
+-   **LMEDS** - Least-Median robust method
+-   **RHO**    - PROSAC-based robust method
+@param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
+(used in the RANSAC and RHO methods only). That is, if
+\f[\| \texttt{dstPoints} _i -  \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|  >  \texttt{ransacReprojThreshold}\f]
+then the point \f$i\f$ is considered an outlier. If srcPoints and dstPoints are measured in pixels,
+it usually makes sense to set this parameter somewhere in the range of 1 to 10.
+@param mask Optional output mask set by a robust method ( RANSAC or LMEDS ). Note that the input
+mask values are ignored.
+@param maxIters The maximum number of RANSAC iterations, 2000 is the maximum it can be.
+@param confidence Confidence level, between 0 and 1.
+
+The functions find and return the perspective transformation \f$H\f$ between the source and the
+destination planes:
+
+\f[s_i  \vecthree{x'_i}{y'_i}{1} \sim H  \vecthree{x_i}{y_i}{1}\f]
+
+so that the back-projection error
+
+\f[\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\f]
+
+is minimized. If the parameter method is set to the default value 0, the function uses all the point
+pairs to compute an initial homography estimate with a simple least-squares scheme.
+
+However, if not all of the point pairs ( \f$srcPoints_i\f$, \f$dstPoints_i\f$ ) fit the rigid perspective
+transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
+you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
+random subsets of the corresponding point pairs (of four pairs each), estimate the homography matrix
+using this subset and a simple least-square algorithm, and then compute the quality/goodness of the
+computed homography (which is the number of inliers for RANSAC or the median re-projection error for
+LMeDs). The best subset is then used to produce the initial estimate of the homography matrix and
+the mask of inliers/outliers.
+
+Regardless of the method, robust or not, the computed homography matrix is refined further (using
+inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
+re-projection error even more.
+
+The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
+distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
+noise is rather small, use the default method (method=0).
+
+The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
+determined up to a scale. Thus, it is normalized so that \f$h_{33}=1\f$. Note that whenever an H matrix
+cannot be estimated, an empty one will be returned.
+
+@sa
+   getAffineTransform, getPerspectiveTransform, estimateRigidTransform, warpPerspective,
+    perspectiveTransform
+
+@note
+   -   A example on calculating a homography for image matching can be found at
+        opencv_source_code/samples/cpp/video_homography.cpp
+
+ */
+CV_EXPORTS_W Mat findHomography( InputArray srcPoints, InputArray dstPoints,
+                                 int method = 0, double ransacReprojThreshold = 3,
+                                 OutputArray mask=noArray(), const int maxIters = 2000,
+                                 const double confidence = 0.995);
+
+/** @overload */
+CV_EXPORTS Mat findHomography( InputArray srcPoints, InputArray dstPoints,
+                               OutputArray mask, int method = 0, double ransacReprojThreshold = 3 );
+
+/** @brief Computes an RQ decomposition of 3x3 matrices.
+
+@param src 3x3 input matrix.
+@param mtxR Output 3x3 upper-triangular matrix.
+@param mtxQ Output 3x3 orthogonal matrix.
+@param Qx Optional output 3x3 rotation matrix around x-axis.
+@param Qy Optional output 3x3 rotation matrix around y-axis.
+@param Qz Optional output 3x3 rotation matrix around z-axis.
+
+The function computes a RQ decomposition using the given rotations. This function is used in
+decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
+and a rotation matrix.
+
+It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
+degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
+sequence of rotations about the three principle axes that results in the same orientation of an
+object, eg. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angules
+are only one of the possible solutions.
+ */
+CV_EXPORTS_W Vec3d RQDecomp3x3( InputArray src, OutputArray mtxR, OutputArray mtxQ,
+                                OutputArray Qx = noArray(),
+                                OutputArray Qy = noArray(),
+                                OutputArray Qz = noArray());
+
+/** @brief Decomposes a projection matrix into a rotation matrix and a camera matrix.
+
+@param projMatrix 3x4 input projection matrix P.
+@param cameraMatrix Output 3x3 camera matrix K.
+@param rotMatrix Output 3x3 external rotation matrix R.
+@param transVect Output 4x1 translation vector T.
+@param rotMatrixX Optional 3x3 rotation matrix around x-axis.
+@param rotMatrixY Optional 3x3 rotation matrix around y-axis.
+@param rotMatrixZ Optional 3x3 rotation matrix around z-axis.
+@param eulerAngles Optional three-element vector containing three Euler angles of rotation in
+degrees.
+
+The function computes a decomposition of a projection matrix into a calibration and a rotation
+matrix and the position of a camera.
+
+It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
+be used in OpenGL. Note, there is always more than one sequence of rotations about the three
+principle axes that results in the same orientation of an object, eg. see @cite Slabaugh . Returned
+tree rotation matrices and corresponding three Euler angules are only one of the possible solutions.
+
+The function is based on RQDecomp3x3 .
+ */
+CV_EXPORTS_W void decomposeProjectionMatrix( InputArray projMatrix, OutputArray cameraMatrix,
+                                             OutputArray rotMatrix, OutputArray transVect,
+                                             OutputArray rotMatrixX = noArray(),
+                                             OutputArray rotMatrixY = noArray(),
+                                             OutputArray rotMatrixZ = noArray(),
+                                             OutputArray eulerAngles =noArray() );
+
+/** @brief Computes partial derivatives of the matrix product for each multiplied matrix.
+
+@param A First multiplied matrix.
+@param B Second multiplied matrix.
+@param dABdA First output derivative matrix d(A\*B)/dA of size
+\f$\texttt{A.rows*B.cols} \times {A.rows*A.cols}\f$ .
+@param dABdB Second output derivative matrix d(A\*B)/dB of size
+\f$\texttt{A.rows*B.cols} \times {B.rows*B.cols}\f$ .
+
+The function computes partial derivatives of the elements of the matrix product \f$A*B\f$ with regard to
+the elements of each of the two input matrices. The function is used to compute the Jacobian
+matrices in stereoCalibrate but can also be used in any other similar optimization function.
+ */
+CV_EXPORTS_W void matMulDeriv( InputArray A, InputArray B, OutputArray dABdA, OutputArray dABdB );
+
+/** @brief Combines two rotation-and-shift transformations.
+
+@param rvec1 First rotation vector.
+@param tvec1 First translation vector.
+@param rvec2 Second rotation vector.
+@param tvec2 Second translation vector.
+@param rvec3 Output rotation vector of the superposition.
+@param tvec3 Output translation vector of the superposition.
+@param dr3dr1
+@param dr3dt1
+@param dr3dr2
+@param dr3dt2
+@param dt3dr1
+@param dt3dt1
+@param dt3dr2
+@param dt3dt2 Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and
+tvec2, respectively.
+
+The functions compute:
+
+\f[\begin{array}{l} \texttt{rvec3} =  \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} )  \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right )  \\ \texttt{tvec3} =  \mathrm{rodrigues} ( \texttt{rvec2} )  \cdot \texttt{tvec1} +  \texttt{tvec2} \end{array} ,\f]
+
+where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and
+\f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See Rodrigues for details.
+
+Also, the functions can compute the derivatives of the output vectors with regards to the input
+vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+function that contains a matrix multiplication.
+ */
+CV_EXPORTS_W void composeRT( InputArray rvec1, InputArray tvec1,
+                             InputArray rvec2, InputArray tvec2,
+                             OutputArray rvec3, OutputArray tvec3,
+                             OutputArray dr3dr1 = noArray(), OutputArray dr3dt1 = noArray(),
+                             OutputArray dr3dr2 = noArray(), OutputArray dr3dt2 = noArray(),
+                             OutputArray dt3dr1 = noArray(), OutputArray dt3dt1 = noArray(),
+                             OutputArray dt3dr2 = noArray(), OutputArray dt3dt2 = noArray() );
+
+/** @brief Projects 3D points to an image plane.
+
+@param objectPoints Array of object points, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel (or
+vector\<Point3f\> ), where N is the number of points in the view.
+@param rvec Rotation vector. See Rodrigues for details.
+@param tvec Translation vector.
+@param cameraMatrix Camera matrix \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. If the vector is empty, the zero distortion coefficients are assumed.
+@param imagePoints Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, or
+vector\<Point2f\> .
+@param jacobian Optional output 2Nx(10+\<numDistCoeffs\>) jacobian matrix of derivatives of image
+points with respect to components of the rotation vector, translation vector, focal lengths,
+coordinates of the principal point and the distortion coefficients. In the old interface different
+components of the jacobian are returned via different output parameters.
+@param aspectRatio Optional "fixed aspect ratio" parameter. If the parameter is not 0, the
+function assumes that the aspect ratio (*fx/fy*) is fixed and correspondingly adjusts the jacobian
+matrix.
+
+The function computes projections of 3D points to the image plane given intrinsic and extrinsic
+camera parameters. Optionally, the function computes Jacobians - matrices of partial derivatives of
+image points coordinates (as functions of all the input parameters) with respect to the particular
+parameters, intrinsic and/or extrinsic. The Jacobians are used during the global optimization in
+calibrateCamera, solvePnP, and stereoCalibrate . The function itself can also be used to compute a
+re-projection error given the current intrinsic and extrinsic parameters.
+
+@note By setting rvec=tvec=(0,0,0) or by setting cameraMatrix to a 3x3 identity matrix, or by
+passing zero distortion coefficients, you can get various useful partial cases of the function. This
+means that you can compute the distorted coordinates for a sparse set of points or apply a
+perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.
+ */
+CV_EXPORTS_W void projectPoints( InputArray objectPoints,
+                                 InputArray rvec, InputArray tvec,
+                                 InputArray cameraMatrix, InputArray distCoeffs,
+                                 OutputArray imagePoints,
+                                 OutputArray jacobian = noArray(),
+                                 double aspectRatio = 0 );
+
+/** @brief Finds an object pose from 3D-2D point correspondences.
+
+@param objectPoints Array of object points in the object coordinate space, 3xN/Nx3 1-channel or
+1xN/Nx1 3-channel, where N is the number of points. vector\<Point3f\> can be also passed here.
+@param imagePoints Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel,
+where N is the number of points. vector\<Point2f\> can be also passed here.
+@param cameraMatrix Input camera matrix \f$A = \vecthreethree{fx}{0}{cx}{0}{fy}{cy}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are
+assumed.
+@param rvec Output rotation vector (see Rodrigues ) that, together with tvec , brings points from
+the model coordinate system to the camera coordinate system.
+@param tvec Output translation vector.
+@param useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses
+the provided rvec and tvec values as initial approximations of the rotation and translation
+vectors, respectively, and further optimizes them.
+@param flags Method for solving a PnP problem:
+-   **SOLVEPNP_ITERATIVE** Iterative method is based on Levenberg-Marquardt optimization. In
+this case the function finds such a pose that minimizes reprojection error, that is the sum
+of squared distances between the observed projections imagePoints and the projected (using
+projectPoints ) objectPoints .
+-   **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+"Complete Solution Classification for the Perspective-Three-Point Problem". In this case the
+function requires exactly four object and image points.
+-   **SOLVEPNP_EPNP** Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
+paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation".
+-   **SOLVEPNP_DLS** Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
+"A Direct Least-Squares (DLS) Method for PnP".
+-   **SOLVEPNP_UPNP** Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
+F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+Estimation". In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
+assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+focal length.
+
+The function estimates the object pose given a set of object points, their corresponding image
+projections, as well as the camera matrix and the distortion coefficients.
+
+@note
+   -   An example of how to use solvePnP for planar augmented reality can be found at
+        opencv_source_code/samples/python/plane_ar.py
+   -   If you are using Python:
+        - Numpy array slices won't work as input because solvePnP requires contiguous
+        arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+        modules/calib3d/src/solvepnp.cpp version 2.4.9)
+        - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+        to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+        which requires 2-channel information.
+        - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+        it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+        np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ */
+CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints,
+                            InputArray cameraMatrix, InputArray distCoeffs,
+                            OutputArray rvec, OutputArray tvec,
+                            bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE );
+
+/** @brief Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+
+@param objectPoints Array of object points in the object coordinate space, 3xN/Nx3 1-channel or
+1xN/Nx1 3-channel, where N is the number of points. vector\<Point3f\> can be also passed here.
+@param imagePoints Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel,
+where N is the number of points. vector\<Point2f\> can be also passed here.
+@param cameraMatrix Input camera matrix \f$A = \vecthreethree{fx}{0}{cx}{0}{fy}{cy}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are
+assumed.
+@param rvec Output rotation vector (see Rodrigues ) that, together with tvec , brings points from
+the model coordinate system to the camera coordinate system.
+@param tvec Output translation vector.
+@param useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses
+the provided rvec and tvec values as initial approximations of the rotation and translation
+vectors, respectively, and further optimizes them.
+@param iterationsCount Number of iterations.
+@param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
+is the maximum allowed distance between the observed and computed point projections to consider it
+an inlier.
+@param confidence The probability that the algorithm produces a useful result.
+@param inliers Output vector that contains indices of inliers in objectPoints and imagePoints .
+@param flags Method for solving a PnP problem (see solvePnP ).
+
+The function estimates an object pose given a set of object points, their corresponding image
+projections, as well as the camera matrix and the distortion coefficients. This function finds such
+a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+projections imagePoints and the projected (using projectPoints ) objectPoints. The use of RANSAC
+makes the function resistant to outliers.
+
+@note
+   -   An example of how to use solvePNPRansac for object detection can be found at
+        opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ */
+CV_EXPORTS_W bool solvePnPRansac( InputArray objectPoints, InputArray imagePoints,
+                                  InputArray cameraMatrix, InputArray distCoeffs,
+                                  OutputArray rvec, OutputArray tvec,
+                                  bool useExtrinsicGuess = false, int iterationsCount = 100,
+                                  float reprojectionError = 8.0, double confidence = 0.99,
+                                  OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE );
+
+/** @brief Finds an initial camera matrix from 3D-2D point correspondences.
+
+@param objectPoints Vector of vectors of the calibration pattern points in the calibration pattern
+coordinate space. In the old interface all the per-view vectors are concatenated. See
+calibrateCamera for details.
+@param imagePoints Vector of vectors of the projections of the calibration pattern points. In the
+old interface all the per-view vectors are concatenated.
+@param imageSize Image size in pixels used to initialize the principal point.
+@param aspectRatio If it is zero or negative, both \f$f_x\f$ and \f$f_y\f$ are estimated independently.
+Otherwise, \f$f_x = f_y * \texttt{aspectRatio}\f$ .
+
+The function estimates and returns an initial camera matrix for the camera calibration process.
+Currently, the function only supports planar calibration patterns, which are patterns where each
+object point has z-coordinate =0.
+ */
+CV_EXPORTS_W Mat initCameraMatrix2D( InputArrayOfArrays objectPoints,
+                                     InputArrayOfArrays imagePoints,
+                                     Size imageSize, double aspectRatio = 1.0 );
+
+/** @brief Finds the positions of internal corners of the chessboard.
+
+@param image Source chessboard view. It must be an 8-bit grayscale or color image.
+@param patternSize Number of inner corners per a chessboard row and column
+( patternSize = cvSize(points_per_row,points_per_colum) = cvSize(columns,rows) ).
+@param corners Output array of detected corners.
+@param flags Various operation flags that can be zero or a combination of the following values:
+-   **CV_CALIB_CB_ADAPTIVE_THRESH** Use adaptive thresholding to convert the image to black
+and white, rather than a fixed threshold level (computed from the average image brightness).
+-   **CV_CALIB_CB_NORMALIZE_IMAGE** Normalize the image gamma with equalizeHist before
+applying fixed or adaptive thresholding.
+-   **CV_CALIB_CB_FILTER_QUADS** Use additional criteria (like contour area, perimeter,
+square-like shape) to filter out false quads extracted at the contour retrieval stage.
+-   **CALIB_CB_FAST_CHECK** Run a fast check on the image that looks for chessboard corners,
+and shortcut the call if none is found. This can drastically speed up the call in the
+degenerate condition when no chessboard is observed.
+
+The function attempts to determine whether the input image is a view of the chessboard pattern and
+locate the internal chessboard corners. The function returns a non-zero value if all of the corners
+are found and they are placed in a certain order (row by row, left to right in every row).
+Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example,
+a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black
+squares touch each other. The detected coordinates are approximate, and to determine their positions
+more accurately, the function calls cornerSubPix. You also may use the function cornerSubPix with
+different parameters if returned coordinates are not accurate enough.
+
+Sample usage of detecting and drawing chessboard corners: :
+@code
+    Size patternsize(8,6); //interior number of corners
+    Mat gray = ....; //source image
+    vector<Point2f> corners; //this will be filled by the detected corners
+
+    //CALIB_CB_FAST_CHECK saves a lot of time on images
+    //that do not contain any chessboard corners
+    bool patternfound = findChessboardCorners(gray, patternsize, corners,
+            CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
+            + CALIB_CB_FAST_CHECK);
+
+    if(patternfound)
+      cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1),
+        TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
+
+    drawChessboardCorners(img, patternsize, Mat(corners), patternfound);
+@endcode
+@note The function requires white space (like a square-thick border, the wider the better) around
+the board to make the detection more robust in various environments. Otherwise, if there is no
+border and the background is dark, the outer black squares cannot be segmented properly and so the
+square grouping and ordering algorithm fails.
+ */
+CV_EXPORTS_W bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners,
+                                         int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE );
+
+//! finds subpixel-accurate positions of the chessboard corners
+CV_EXPORTS bool find4QuadCornerSubpix( InputArray img, InputOutputArray corners, Size region_size );
+
+/** @brief Renders the detected chessboard corners.
+
+@param image Destination image. It must be an 8-bit color image.
+@param patternSize Number of inner corners per a chessboard row and column
+(patternSize = cv::Size(points_per_row,points_per_column)).
+@param corners Array of detected corners, the output of findChessboardCorners.
+@param patternWasFound Parameter indicating whether the complete board was found or not. The
+return value of findChessboardCorners should be passed here.
+
+The function draws individual chessboard corners detected either as red circles if the board was not
+found, or as colored corners connected with lines if the board was found.
+ */
+CV_EXPORTS_W void drawChessboardCorners( InputOutputArray image, Size patternSize,
+                                         InputArray corners, bool patternWasFound );
+
+/** @brief Finds centers in the grid of circles.
+
+@param image grid view of input circles; it must be an 8-bit grayscale or color image.
+@param patternSize number of circles per row and column
+( patternSize = Size(points_per_row, points_per_colum) ).
+@param centers output array of detected centers.
+@param flags various operation flags that can be one of the following values:
+-   **CALIB_CB_SYMMETRIC_GRID** uses symmetric pattern of circles.
+-   **CALIB_CB_ASYMMETRIC_GRID** uses asymmetric pattern of circles.
+-   **CALIB_CB_CLUSTERING** uses a special algorithm for grid detection. It is more robust to
+perspective distortions but much more sensitive to background clutter.
+@param blobDetector feature detector that finds blobs like dark circles on light background.
+
+The function attempts to determine whether the input image contains a grid of circles. If it is, the
+function locates centers of the circles. The function returns a non-zero value if all of the centers
+have been found and they have been placed in a certain order (row by row, left to right in every
+row). Otherwise, if the function fails to find all the corners or reorder them, it returns 0.
+
+Sample usage of detecting and drawing the centers of circles: :
+@code
+    Size patternsize(7,7); //number of centers
+    Mat gray = ....; //source image
+    vector<Point2f> centers; //this will be filled by the detected centers
+
+    bool patternfound = findCirclesGrid(gray, patternsize, centers);
+
+    drawChessboardCorners(img, patternsize, Mat(centers), patternfound);
+@endcode
+@note The function requires white space (like a square-thick border, the wider the better) around
+the board to make the detection more robust in various environments.
+ */
+CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize,
+                                   OutputArray centers, int flags = CALIB_CB_SYMMETRIC_GRID,
+                                   const Ptr<FeatureDetector> &blobDetector = SimpleBlobDetector::create());
+
+/** @brief Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
+
+@param objectPoints In the new interface it is a vector of vectors of calibration pattern points in
+the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
+vector contains as many elements as the number of the pattern views. If the same calibration pattern
+is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
+possible to use partially occluded patterns, or even different patterns in different views. Then,
+the vectors will be different. The points are 3D, but since they are in a pattern coordinate system,
+then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that
+Z-coordinate of each input object point is 0.
+In the old interface all the vectors of object points from different views are concatenated
+together.
+@param imagePoints In the new interface it is a vector of vectors of the projections of calibration
+pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
+objectPoints.size() and imagePoints[i].size() must be equal to objectPoints[i].size() for each i.
+In the old interface all the vectors of object points from different views are concatenated
+together.
+@param imageSize Size of the image used only to initialize the intrinsic camera matrix.
+@param cameraMatrix Output 3x3 floating-point camera matrix
+\f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . If CV\_CALIB\_USE\_INTRINSIC\_GUESS
+and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
+initialized before calling the function.
+@param distCoeffs Output vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements.
+@param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view
+(e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding
+k-th translation vector (see the next output parameter description) brings the calibration pattern
+from the model coordinate space (in which object points are specified) to the world coordinate
+space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
+@param tvecs Output vector of translation vectors estimated for each pattern view.
+@param flags Different flags that may be zero or a combination of the following values:
+-   **CV_CALIB_USE_INTRINSIC_GUESS** cameraMatrix contains valid initial values of
+fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+Note, that if intrinsic parameters are known, there is no need to use this function just to
+estimate extrinsic parameters. Use solvePnP instead.
+-   **CV_CALIB_FIX_PRINCIPAL_POINT** The principal point is not changed during the global
+optimization. It stays at the center or at a different location specified when
+CV_CALIB_USE_INTRINSIC_GUESS is set too.
+-   **CV_CALIB_FIX_ASPECT_RATIO** The functions considers only fy as a free parameter. The
+ratio fx/fy stays the same as in the input cameraMatrix . When
+CV_CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are
+ignored, only their ratio is computed and used further.
+-   **CV_CALIB_ZERO_TANGENT_DIST** Tangential distortion coefficients \f$(p_1, p_2)\f$ are set
+to zeros and stay zero.
+-   **CV_CALIB_FIX_K1,...,CV_CALIB_FIX_K6** The corresponding radial distortion
+coefficient is not changed during the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is
+set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+-   **CV_CALIB_RATIONAL_MODEL** Coefficients k4, k5, and k6 are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the rational model and return 8 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_THIN_PRISM_MODEL** Coefficients s1, s2, s3 and s4 are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the thin prism model and return 12 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_FIX_S1_S2_S3_S4** The thin prism distortion coefficients are not changed during
+the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+-   **CALIB_TILTED_MODEL** Coefficients tauX and tauY are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_FIX_TAUX_TAUY** The coefficients of the tilted sensor model are not changed during
+the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+@param criteria Termination criteria for the iterative optimization algorithm.
+
+The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
+views. The algorithm is based on @cite Zhang2000 and @cite BouguetMCT . The coordinates of 3D object
+points and their corresponding 2D projections in each view must be specified. That may be achieved
+by using an object with a known geometry and easily detectable feature points. Such an object is
+called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as
+a calibration rig (see findChessboardCorners ). Currently, initialization of intrinsic parameters
+(when CV_CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration
+patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also
+be used as long as initial cameraMatrix is provided.
+
+The algorithm performs the following steps:
+
+-   Compute the initial intrinsic parameters (the option only available for planar calibration
+    patterns) or read them from the input parameters. The distortion coefficients are all set to
+    zeros initially unless some of CV_CALIB_FIX_K? are specified.
+
+-   Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
+    done using solvePnP .
+
+-   Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
+    that is, the total sum of squared distances between the observed feature points imagePoints and
+    the projected (using the current estimates for camera parameters and the poses) object points
+    objectPoints. See projectPoints for details.
+
+The function returns the final re-projection error.
+
+@note
+   If you use a non-square (=non-NxN) grid and findChessboardCorners for calibration, and
+    calibrateCamera returns bad values (zero distortion coefficients, an image center very far from
+    (w/2-0.5,h/2-0.5), and/or large differences between \f$f_x\f$ and \f$f_y\f$ (ratios of 10:1 or more)),
+    then you have probably used patternSize=cvSize(rows,cols) instead of using
+    patternSize=cvSize(cols,rows) in findChessboardCorners .
+
+@sa
+   findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
+ */
+CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,
+                                     InputArrayOfArrays imagePoints, Size imageSize,
+                                     InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
+                                     OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
+                                     int flags = 0, TermCriteria criteria = TermCriteria(
+                                        TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON) );
+
+/** @brief Computes useful camera characteristics from the camera matrix.
+
+@param cameraMatrix Input camera matrix that can be estimated by calibrateCamera or
+stereoCalibrate .
+@param imageSize Input image size in pixels.
+@param apertureWidth Physical width in mm of the sensor.
+@param apertureHeight Physical height in mm of the sensor.
+@param fovx Output field of view in degrees along the horizontal sensor axis.
+@param fovy Output field of view in degrees along the vertical sensor axis.
+@param focalLength Focal length of the lens in mm.
+@param principalPoint Principal point in mm.
+@param aspectRatio \f$f_y/f_x\f$
+
+The function computes various useful camera characteristics from the previously estimated camera
+matrix.
+
+@note
+   Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for
+    the chessboard pitch (it can thus be any value).
+ */
+CV_EXPORTS_W void calibrationMatrixValues( InputArray cameraMatrix, Size imageSize,
+                                           double apertureWidth, double apertureHeight,
+                                           CV_OUT double& fovx, CV_OUT double& fovy,
+                                           CV_OUT double& focalLength, CV_OUT Point2d& principalPoint,
+                                           CV_OUT double& aspectRatio );
+
+/** @brief Calibrates the stereo camera.
+
+@param objectPoints Vector of vectors of the calibration pattern points.
+@param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+observed by the first camera.
+@param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+observed by the second camera.
+@param cameraMatrix1 Input/output first camera matrix:
+\f$\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\f$ , \f$j = 0,\, 1\f$ . If
+any of CV_CALIB_USE_INTRINSIC_GUESS , CV_CALIB_FIX_ASPECT_RATIO ,
+CV_CALIB_FIX_INTRINSIC , or CV_CALIB_FIX_FOCAL_LENGTH are specified, some or all of the
+matrix components must be initialized. See the flags description for details.
+@param distCoeffs1 Input/output vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. The output vector length depends on the flags.
+@param cameraMatrix2 Input/output second camera matrix. The parameter is similar to cameraMatrix1
+@param distCoeffs2 Input/output lens distortion coefficients for the second camera. The parameter
+is similar to distCoeffs1 .
+@param imageSize Size of the image used only to initialize intrinsic camera matrix.
+@param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
+@param T Output translation vector between the coordinate systems of the cameras.
+@param E Output essential matrix.
+@param F Output fundamental matrix.
+@param flags Different flags that may be zero or a combination of the following values:
+-   **CV_CALIB_FIX_INTRINSIC** Fix cameraMatrix? and distCoeffs? so that only R, T, E , and F
+matrices are estimated.
+-   **CV_CALIB_USE_INTRINSIC_GUESS** Optimize some or all of the intrinsic parameters
+according to the specified flags. Initial values are provided by the user.
+-   **CV_CALIB_FIX_PRINCIPAL_POINT** Fix the principal points during the optimization.
+-   **CV_CALIB_FIX_FOCAL_LENGTH** Fix \f$f^{(j)}_x\f$ and \f$f^{(j)}_y\f$ .
+-   **CV_CALIB_FIX_ASPECT_RATIO** Optimize \f$f^{(j)}_y\f$ . Fix the ratio \f$f^{(j)}_x/f^{(j)}_y\f$
+.
+-   **CV_CALIB_SAME_FOCAL_LENGTH** Enforce \f$f^{(0)}_x=f^{(1)}_x\f$ and \f$f^{(0)}_y=f^{(1)}_y\f$ .
+-   **CV_CALIB_ZERO_TANGENT_DIST** Set tangential distortion coefficients for each camera to
+zeros and fix there.
+-   **CV_CALIB_FIX_K1,...,CV_CALIB_FIX_K6** Do not change the corresponding radial
+distortion coefficient during the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set,
+the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+-   **CV_CALIB_RATIONAL_MODEL** Enable coefficients k4, k5, and k6. To provide the backward
+compatibility, this extra flag should be explicitly specified to make the calibration
+function use the rational model and return 8 coefficients. If the flag is not set, the
+function computes and returns only 5 distortion coefficients.
+-   **CALIB_THIN_PRISM_MODEL** Coefficients s1, s2, s3 and s4 are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the thin prism model and return 12 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_FIX_S1_S2_S3_S4** The thin prism distortion coefficients are not changed during
+the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+-   **CALIB_TILTED_MODEL** Coefficients tauX and tauY are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_FIX_TAUX_TAUY** The coefficients of the tilted sensor model are not changed during
+the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+@param criteria Termination criteria for the iterative optimization algorithm.
+
+The function estimates transformation between two cameras making a stereo pair. If you have a stereo
+camera where the relative position and orientation of two cameras is fixed, and if you computed
+poses of an object relative to the first camera and to the second camera, (R1, T1) and (R2, T2),
+respectively (this can be done with solvePnP ), then those poses definitely relate to each other.
+This means that, given ( \f$R_1\f$,\f$T_1\f$ ), it should be possible to compute ( \f$R_2\f$,\f$T_2\f$ ). You only
+need to know the position and orientation of the second camera relative to the first camera. This is
+what the described function does. It computes ( \f$R\f$,\f$T\f$ ) so that:
+
+\f[R_2=R*R_1
+T_2=R*T_1 + T,\f]
+
+Optionally, it computes the essential matrix E:
+
+\f[E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} *R\f]
+
+where \f$T_i\f$ are components of the translation vector \f$T\f$ : \f$T=[T_0, T_1, T_2]^T\f$ . And the function
+can also compute the fundamental matrix F:
+
+\f[F = cameraMatrix2^{-T} E cameraMatrix1^{-1}\f]
+
+Besides the stereo-related information, the function can also perform a full calibration of each of
+two cameras. However, due to the high dimensionality of the parameter space and noise in the input
+data, the function can diverge from the correct solution. If the intrinsic parameters can be
+estimated with high accuracy for each of the cameras individually (for example, using
+calibrateCamera ), you are recommended to do so and then pass CV_CALIB_FIX_INTRINSIC flag to the
+function along with the computed intrinsic parameters. Otherwise, if all the parameters are
+estimated at once, it makes sense to restrict some parameters, for example, pass
+CV_CALIB_SAME_FOCAL_LENGTH and CV_CALIB_ZERO_TANGENT_DIST flags, which is usually a
+reasonable assumption.
+
+Similarly to calibrateCamera , the function minimizes the total re-projection error for all the
+points in all the available views from both cameras. The function returns the final value of the
+re-projection error.
+ */
+CV_EXPORTS_W double stereoCalibrate( InputArrayOfArrays objectPoints,
+                                     InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
+                                     InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1,
+                                     InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2,
+                                     Size imageSize, OutputArray R,OutputArray T, OutputArray E, OutputArray F,
+                                     int flags = CALIB_FIX_INTRINSIC,
+                                     TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6) );
+
+
+/** @brief Computes rectification transforms for each head of a calibrated stereo camera.
+
+@param cameraMatrix1 First camera matrix.
+@param distCoeffs1 First camera distortion parameters.
+@param cameraMatrix2 Second camera matrix.
+@param distCoeffs2 Second camera distortion parameters.
+@param imageSize Size of the image used for stereo calibration.
+@param R Rotation matrix between the coordinate systems of the first and the second cameras.
+@param T Translation vector between coordinate systems of the cameras.
+@param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
+@param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
+@param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+camera.
+@param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+camera.
+@param Q Output \f$4 \times 4\f$ disparity-to-depth mapping matrix (see reprojectImageTo3D ).
+@param flags Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY . If the flag is set,
+the function makes the principal points of each camera have the same pixel coordinates in the
+rectified views. And if the flag is not set, the function may still shift the images in the
+horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+useful image area.
+@param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
+scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
+images are zoomed and shifted so that only valid pixels are visible (no black areas after
+rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
+pixels from the original images from the cameras are retained in the rectified images (no source
+image pixels are lost). Obviously, any intermediate value yields an intermediate result between
+those two extreme cases.
+@param newImageSize New image resolution after rectification. The same size should be passed to
+initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+is passed (default), it is set to the original imageSize . Setting it to larger value can help you
+preserve details in the original image, especially when there is a big radial distortion.
+@param validPixROI1 Optional output rectangles inside the rectified images where all the pixels
+are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+(see the picture below).
+@param validPixROI2 Optional output rectangles inside the rectified images where all the pixels
+are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+(see the picture below).
+
+The function computes the rotation matrices for each camera that (virtually) make both camera image
+planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
+the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate
+as input. As output, it provides two rotation matrices and also two projection matrices in the new
+coordinates. The function distinguishes the following two cases:
+
+-   **Horizontal stereo**: the first and the second camera views are shifted relative to each other
+    mainly along the x axis (with possible small vertical shift). In the rectified images, the
+    corresponding epipolar lines in the left and right cameras are horizontal and have the same
+    y-coordinate. P1 and P2 look like:
+
+    \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx_1 & 0 \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f]
+
+    \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx_2 & T_x*f \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix} ,\f]
+
+    where \f$T_x\f$ is a horizontal shift between the cameras and \f$cx_1=cx_2\f$ if
+    CV_CALIB_ZERO_DISPARITY is set.
+
+-   **Vertical stereo**: the first and the second camera views are shifted relative to each other
+    mainly in vertical direction (and probably a bit in the horizontal direction too). The epipolar
+    lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
+
+    \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_1 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f]
+
+    \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_2 & T_y*f \\ 0 & 0 & 1 & 0 \end{bmatrix} ,\f]
+
+    where \f$T_y\f$ is a vertical shift between the cameras and \f$cy_1=cy_2\f$ if CALIB_ZERO_DISPARITY is
+    set.
+
+As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
+matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to
+initialize the rectification map for each camera.
+
+See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
+the corresponding image regions. This means that the images are well rectified, which is what most
+stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
+their interiors are all valid pixels.
+
+![image](pics/stereo_undistort.jpg)
+ */
+CV_EXPORTS_W void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1,
+                                 InputArray cameraMatrix2, InputArray distCoeffs2,
+                                 Size imageSize, InputArray R, InputArray T,
+                                 OutputArray R1, OutputArray R2,
+                                 OutputArray P1, OutputArray P2,
+                                 OutputArray Q, int flags = CALIB_ZERO_DISPARITY,
+                                 double alpha = -1, Size newImageSize = Size(),
+                                 CV_OUT Rect* validPixROI1 = 0, CV_OUT Rect* validPixROI2 = 0 );
+
+/** @brief Computes a rectification transform for an uncalibrated stereo camera.
+
+@param points1 Array of feature points in the first image.
+@param points2 The corresponding points in the second image. The same formats as in
+findFundamentalMat are supported.
+@param F Input fundamental matrix. It can be computed from the same set of point pairs using
+findFundamentalMat .
+@param imgSize Size of the image.
+@param H1 Output rectification homography matrix for the first image.
+@param H2 Output rectification homography matrix for the second image.
+@param threshold Optional threshold used to filter out the outliers. If the parameter is greater
+than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
+for which \f$|\texttt{points2[i]}^T*\texttt{F}*\texttt{points1[i]}|>\texttt{threshold}\f$ ) are
+rejected prior to computing the homographies. Otherwise,all the points are considered inliers.
+
+The function computes the rectification transformations without knowing intrinsic parameters of the
+cameras and their relative position in the space, which explains the suffix "uncalibrated". Another
+related difference from stereoRectify is that the function outputs not the rectification
+transformations in the object (3D) space, but the planar perspective transformations encoded by the
+homography matrices H1 and H2 . The function implements the algorithm @cite Hartley99 .
+
+@note
+   While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily
+    depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion,
+    it would be better to correct it before computing the fundamental matrix and calling this
+    function. For example, distortion coefficients can be estimated for each head of stereo camera
+    separately by using calibrateCamera . Then, the images can be corrected using undistort , or
+    just the point coordinates can be corrected with undistortPoints .
+ */
+CV_EXPORTS_W bool stereoRectifyUncalibrated( InputArray points1, InputArray points2,
+                                             InputArray F, Size imgSize,
+                                             OutputArray H1, OutputArray H2,
+                                             double threshold = 5 );
+
+//! computes the rectification transformations for 3-head camera, where all the heads are on the same line.
+CV_EXPORTS_W float rectify3Collinear( InputArray cameraMatrix1, InputArray distCoeffs1,
+                                      InputArray cameraMatrix2, InputArray distCoeffs2,
+                                      InputArray cameraMatrix3, InputArray distCoeffs3,
+                                      InputArrayOfArrays imgpt1, InputArrayOfArrays imgpt3,
+                                      Size imageSize, InputArray R12, InputArray T12,
+                                      InputArray R13, InputArray T13,
+                                      OutputArray R1, OutputArray R2, OutputArray R3,
+                                      OutputArray P1, OutputArray P2, OutputArray P3,
+                                      OutputArray Q, double alpha, Size newImgSize,
+                                      CV_OUT Rect* roi1, CV_OUT Rect* roi2, int flags );
+
+/** @brief Returns the new camera matrix based on the free scaling parameter.
+
+@param cameraMatrix Input camera matrix.
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are
+assumed.
+@param imageSize Original image size.
+@param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
+valid) and 1 (when all the source image pixels are retained in the undistorted image). See
+stereoRectify for details.
+@param newImgSize Image size after rectification. By default,it is set to imageSize .
+@param validPixROI Optional output rectangle that outlines all-good-pixels region in the
+undistorted image. See roi1, roi2 description in stereoRectify .
+@param centerPrincipalPoint Optional flag that indicates whether in the new camera matrix the
+principal point should be at the image center or not. By default, the principal point is chosen to
+best fit a subset of the source image (determined by alpha) to the corrected image.
+@return new_camera_matrix Output new camera matrix.
+
+The function computes and returns the optimal new camera matrix based on the free scaling parameter.
+By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
+image pixels if there is valuable information in the corners alpha=1 , or get something in between.
+When alpha\>0 , the undistortion result is likely to have some black pixels corresponding to
+"virtual" pixels outside of the captured distorted image. The original camera matrix, distortion
+coefficients, the computed new camera matrix, and newImageSize should be passed to
+initUndistortRectifyMap to produce the maps for remap .
+ */
+CV_EXPORTS_W Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs,
+                                            Size imageSize, double alpha, Size newImgSize = Size(),
+                                            CV_OUT Rect* validPixROI = 0,
+                                            bool centerPrincipalPoint = false);
+
+/** @brief Converts points from Euclidean to homogeneous space.
+
+@param src Input vector of N-dimensional points.
+@param dst Output vector of N+1-dimensional points.
+
+The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of
+point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).
+ */
+CV_EXPORTS_W void convertPointsToHomogeneous( InputArray src, OutputArray dst );
+
+/** @brief Converts points from homogeneous to Euclidean space.
+
+@param src Input vector of N-dimensional points.
+@param dst Output vector of N-1-dimensional points.
+
+The function converts points homogeneous to Euclidean space using perspective projection. That is,
+each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the
+output point coordinates will be (0,0,0,...).
+ */
+CV_EXPORTS_W void convertPointsFromHomogeneous( InputArray src, OutputArray dst );
+
+/** @brief Converts points to/from homogeneous coordinates.
+
+@param src Input array or vector of 2D, 3D, or 4D points.
+@param dst Output vector of 2D, 3D, or 4D points.
+
+The function converts 2D or 3D points from/to homogeneous coordinates by calling either
+convertPointsToHomogeneous or convertPointsFromHomogeneous.
+
+@note The function is obsolete. Use one of the previous two functions instead.
+ */
+CV_EXPORTS void convertPointsHomogeneous( InputArray src, OutputArray dst );
+
+/** @brief Calculates a fundamental matrix from the corresponding points in two images.
+
+@param points1 Array of N points from the first image. The point coordinates should be
+floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param method Method for computing a fundamental matrix.
+-   **CV_FM_7POINT** for a 7-point algorithm. \f$N = 7\f$
+-   **CV_FM_8POINT** for an 8-point algorithm. \f$N \ge 8\f$
+-   **CV_FM_RANSAC** for the RANSAC algorithm. \f$N \ge 8\f$
+-   **CV_FM_LMEDS** for the LMedS algorithm. \f$N \ge 8\f$
+@param param1 Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+line in pixels, beyond which the point is considered an outlier and is not used for computing the
+final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+point localization, image resolution, and the image noise.
+@param param2 Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level
+of confidence (probability) that the estimated matrix is correct.
+@param mask
+
+The epipolar geometry is described by the following equation:
+
+\f[[p_2; 1]^T F [p_1; 1] = 0\f]
+
+where \f$F\f$ is a fundamental matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the
+second images, respectively.
+
+The function calculates the fundamental matrix using one of four methods listed above and returns
+the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point
+algorithm, the function may return up to 3 solutions ( \f$9 \times 3\f$ matrix that stores all 3
+matrices sequentially).
+
+The calculated fundamental matrix may be passed further to computeCorrespondEpilines that finds the
+epipolar lines corresponding to the specified points. It can also be passed to
+stereoRectifyUncalibrated to compute the rectification transformation. :
+@code
+    // Example. Estimation of fundamental matrix using the RANSAC algorithm
+    int point_count = 100;
+    vector<Point2f> points1(point_count);
+    vector<Point2f> points2(point_count);
+
+    // initialize the points here ...
+    for( int i = 0; i < point_count; i++ )
+    {
+        points1[i] = ...;
+        points2[i] = ...;
+    }
+
+    Mat fundamental_matrix =
+     findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);
+@endcode
+ */
+CV_EXPORTS_W Mat findFundamentalMat( InputArray points1, InputArray points2,
+                                     int method = FM_RANSAC,
+                                     double param1 = 3., double param2 = 0.99,
+                                     OutputArray mask = noArray() );
+
+/** @overload */
+CV_EXPORTS Mat findFundamentalMat( InputArray points1, InputArray points2,
+                                   OutputArray mask, int method = FM_RANSAC,
+                                   double param1 = 3., double param2 = 0.99 );
+
+/** @brief Calculates an essential matrix from the corresponding points in two images.
+
+@param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
+be floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+Note that this function assumes that points1 and points2 are feature points from cameras with the
+same camera matrix.
+@param method Method for computing a fundamental matrix.
+-   **RANSAC** for the RANSAC algorithm.
+-   **MEDS** for the LMedS algorithm.
+@param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+line in pixels, beyond which the point is considered an outlier and is not used for computing the
+final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+point localization, image resolution, and the image noise.
+@param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+confidence (probability) that the estimated matrix is correct.
+@param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
+for the other points. The array is computed only in the RANSAC and LMedS methods.
+
+This function estimates essential matrix based on the five-point algorithm solver in @cite Nister03 .
+@cite SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
+
+\f[[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\f]
+
+where \f$E\f$ is an essential matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the
+second images, respectively. The result of this function may be passed further to
+decomposeEssentialMat or recoverPose to recover the relative pose between cameras.
+ */
+CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
+                                 InputArray cameraMatrix, int method = RANSAC,
+                                 double prob = 0.999, double threshold = 1.0,
+                                 OutputArray mask = noArray() );
+
+/** @overload
+@param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
+be floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param focal focal length of the camera. Note that this function assumes that points1 and points2
+are feature points from cameras with same focal length and principle point.
+@param pp principle point of the camera.
+@param method Method for computing a fundamental matrix.
+-   **RANSAC** for the RANSAC algorithm.
+-   **LMEDS** for the LMedS algorithm.
+@param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+line in pixels, beyond which the point is considered an outlier and is not used for computing the
+final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+point localization, image resolution, and the image noise.
+@param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+confidence (probability) that the estimated matrix is correct.
+@param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
+for the other points. The array is computed only in the RANSAC and LMedS methods.
+
+This function differs from the one above that it computes camera matrix from focal length and
+principal point:
+
+\f[K =
+\begin{bmatrix}
+f & 0 & x_{pp}  \\
+0 & f & y_{pp}  \\
+0 & 0 & 1
+\end{bmatrix}\f]
+ */
+CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
+                                 double focal = 1.0, Point2d pp = Point2d(0, 0),
+                                 int method = RANSAC, double prob = 0.999,
+                                 double threshold = 1.0, OutputArray mask = noArray() );
+
+/** @brief Decompose an essential matrix to possible rotations and translation.
+
+@param E The input essential matrix.
+@param R1 One possible rotation matrix.
+@param R2 Another possible rotation matrix.
+@param t One possible translation.
+
+This function decompose an essential matrix E using svd decomposition @cite HartleyZ00 . Generally 4
+possible poses exists for a given E. They are \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$. By
+decomposing E, you can only get the direction of the translation, so the function returns unit t.
+ */
+CV_EXPORTS_W void decomposeEssentialMat( InputArray E, OutputArray R1, OutputArray R2, OutputArray t );
+
+/** @brief Recover relative camera rotation and translation from an estimated essential matrix and the
+corresponding points in two images, using cheirality check. Returns the number of inliers which pass
+the check.
+
+@param E The input essential matrix.
+@param points1 Array of N 2D points from the first image. The point coordinates should be
+floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+Note that this function assumes that points1 and points2 are feature points from cameras with the
+same camera matrix.
+@param R Recovered relative rotation.
+@param t Recoverd relative translation.
+@param mask Input/output mask for inliers in points1 and points2.
+:   If it is not empty, then it marks inliers in points1 and points2 for then given essential
+matrix E. Only these inliers will be used to recover pose. In the output mask only inliers
+which pass the cheirality check.
+This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible
+pose hypotheses by doing cheirality check. The cheirality check basically means that the
+triangulated 3D points should have positive depth. Some details can be found in @cite Nister03 .
+
+This function can be used to process output E and mask from findEssentialMat. In this scenario,
+points1 and points2 are the same input for findEssentialMat. :
+@code
+    // Example. Estimation of fundamental matrix using the RANSAC algorithm
+    int point_count = 100;
+    vector<Point2f> points1(point_count);
+    vector<Point2f> points2(point_count);
+
+    // initialize the points here ...
+    for( int i = 0; i < point_count; i++ )
+    {
+        points1[i] = ...;
+        points2[i] = ...;
+    }
+
+    // cametra matrix with both focal lengths = 1, and principal point = (0, 0)
+    Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
+
+    Mat E, R, t, mask;
+
+    E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask);
+    recoverPose(E, points1, points2, cameraMatrix, R, t, mask);
+@endcode
+ */
+CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray points2,
+                            InputArray cameraMatrix, OutputArray R, OutputArray t,
+                            InputOutputArray mask = noArray() );
+
+/** @overload
+@param E The input essential matrix.
+@param points1 Array of N 2D points from the first image. The point coordinates should be
+floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param R Recovered relative rotation.
+@param t Recoverd relative translation.
+@param focal Focal length of the camera. Note that this function assumes that points1 and points2
+are feature points from cameras with same focal length and principle point.
+@param pp Principle point of the camera.
+@param mask Input/output mask for inliers in points1 and points2.
+:   If it is not empty, then it marks inliers in points1 and points2 for then given essential
+matrix E. Only these inliers will be used to recover pose. In the output mask only inliers
+which pass the cheirality check.
+
+This function differs from the one above that it computes camera matrix from focal length and
+principal point:
+
+\f[K =
+\begin{bmatrix}
+f & 0 & x_{pp}  \\
+0 & f & y_{pp}  \\
+0 & 0 & 1
+\end{bmatrix}\f]
+ */
+CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray points2,
+                            OutputArray R, OutputArray t,
+                            double focal = 1.0, Point2d pp = Point2d(0, 0),
+                            InputOutputArray mask = noArray() );
+
+/** @brief For points in an image of a stereo pair, computes the corresponding epilines in the other image.
+
+@param points Input points. \f$N \times 1\f$ or \f$1 \times N\f$ matrix of type CV_32FC2 or
+vector\<Point2f\> .
+@param whichImage Index of the image (1 or 2) that contains the points .
+@param F Fundamental matrix that can be estimated using findFundamentalMat or stereoRectify .
+@param lines Output vector of the epipolar lines corresponding to the points in the other image.
+Each line \f$ax + by + c=0\f$ is encoded by 3 numbers \f$(a, b, c)\f$ .
+
+For every point in one of the two images of a stereo pair, the function finds the equation of the
+corresponding epipolar line in the other image.
+
+From the fundamental matrix definition (see findFundamentalMat ), line \f$l^{(2)}_i\f$ in the second
+image for the point \f$p^{(1)}_i\f$ in the first image (when whichImage=1 ) is computed as:
+
+\f[l^{(2)}_i = F p^{(1)}_i\f]
+
+And vice versa, when whichImage=2, \f$l^{(1)}_i\f$ is computed from \f$p^{(2)}_i\f$ as:
+
+\f[l^{(1)}_i = F^T p^{(2)}_i\f]
+
+Line coefficients are defined up to a scale. They are normalized so that \f$a_i^2+b_i^2=1\f$ .
+ */
+CV_EXPORTS_W void computeCorrespondEpilines( InputArray points, int whichImage,
+                                             InputArray F, OutputArray lines );
+
+/** @brief Reconstructs points by triangulation.
+
+@param projMatr1 3x4 projection matrix of the first camera.
+@param projMatr2 3x4 projection matrix of the second camera.
+@param projPoints1 2xN array of feature points in the first image. In case of c++ version it can
+be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
+@param projPoints2 2xN array of corresponding points in the second image. In case of c++ version
+it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
+@param points4D 4xN array of reconstructed points in homogeneous coordinates.
+
+The function reconstructs 3-dimensional points (in homogeneous coordinates) by using their
+observations with a stereo camera. Projections matrices can be obtained from stereoRectify.
+
+@note
+   Keep in mind that all input data should be of float type in order for this function to work.
+
+@sa
+   reprojectImageTo3D
+ */
+CV_EXPORTS_W void triangulatePoints( InputArray projMatr1, InputArray projMatr2,
+                                     InputArray projPoints1, InputArray projPoints2,
+                                     OutputArray points4D );
+
+/** @brief Refines coordinates of corresponding points.
+
+@param F 3x3 fundamental matrix.
+@param points1 1xN array containing the first set of points.
+@param points2 1xN array containing the second set of points.
+@param newPoints1 The optimized points1.
+@param newPoints2 The optimized points2.
+
+The function implements the Optimal Triangulation Method (see Multiple View Geometry for details).
+For each given point correspondence points1[i] \<-\> points2[i], and a fundamental matrix F, it
+computes the corrected correspondences newPoints1[i] \<-\> newPoints2[i] that minimize the geometric
+error \f$d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2\f$ (where \f$d(a,b)\f$ is the
+geometric distance between points \f$a\f$ and \f$b\f$ ) subject to the epipolar constraint
+\f$newPoints2^T * F * newPoints1 = 0\f$ .
+ */
+CV_EXPORTS_W void correctMatches( InputArray F, InputArray points1, InputArray points2,
+                                  OutputArray newPoints1, OutputArray newPoints2 );
+
+/** @brief Filters off small noise blobs (speckles) in the disparity map
+
+@param img The input 16-bit signed disparity image
+@param newVal The disparity value used to paint-off the speckles
+@param maxSpeckleSize The maximum speckle size to consider it a speckle. Larger blobs are not
+affected by the algorithm
+@param maxDiff Maximum difference between neighbor disparity pixels to put them into the same
+blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
+disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
+account when specifying this parameter value.
+@param buf The optional temporary buffer to avoid memory allocation within the function.
+ */
+CV_EXPORTS_W void filterSpeckles( InputOutputArray img, double newVal,
+                                  int maxSpeckleSize, double maxDiff,
+                                  InputOutputArray buf = noArray() );
+
+//! computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by cv::stereoRectify())
+CV_EXPORTS_W Rect getValidDisparityROI( Rect roi1, Rect roi2,
+                                        int minDisparity, int numberOfDisparities,
+                                        int SADWindowSize );
+
+//! validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm
+CV_EXPORTS_W void validateDisparity( InputOutputArray disparity, InputArray cost,
+                                     int minDisparity, int numberOfDisparities,
+                                     int disp12MaxDisp = 1 );
+
+/** @brief Reprojects a disparity image to 3D space.
+
+@param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
+floating-point disparity image. If 16-bit signed format is used, the values are assumed to have no
+fractional bits.
+@param _3dImage Output 3-channel floating-point image of the same size as disparity . Each
+element of _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity
+map.
+@param Q \f$4 \times 4\f$ perspective transformation matrix that can be obtained with stereoRectify.
+@param handleMissingValues Indicates, whether the function should handle missing values (i.e.
+points where the disparity was not computed). If handleMissingValues=true, then pixels with the
+minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
+to 3D points with a very large Z value (currently set to 10000).
+@param ddepth The optional output array depth. If it is -1, the output image will have CV_32F
+depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
+
+The function transforms a single-channel disparity map to a 3-channel image representing a 3D
+surface. That is, for each pixel (x,y) andthe corresponding disparity d=disparity(x,y) , it
+computes:
+
+\f[\begin{array}{l} [X \; Y \; Z \; W]^T =  \texttt{Q} *[x \; y \; \texttt{disparity} (x,y) \; 1]^T  \\ \texttt{\_3dImage} (x,y) = (X/W, \; Y/W, \; Z/W) \end{array}\f]
+
+The matrix Q can be an arbitrary \f$4 \times 4\f$ matrix (for example, the one computed by
+stereoRectify). To reproject a sparse set of points {(x,y,d),...} to 3D space, use
+perspectiveTransform .
+ */
+CV_EXPORTS_W void reprojectImageTo3D( InputArray disparity,
+                                      OutputArray _3dImage, InputArray Q,
+                                      bool handleMissingValues = false,
+                                      int ddepth = -1 );
+
+/** @brief Calculates the Sampson Distance between two points.
+
+The function sampsonDistance calculates and returns the first order approximation of the geometric error as:
+\f[sd( \texttt{pt1} , \texttt{pt2} )= \frac{(\texttt{pt2}^t \cdot \texttt{F} \cdot \texttt{pt1})^2}{(\texttt{F} \cdot \texttt{pt1})(0) + (\texttt{F} \cdot \texttt{pt1})(1) + (\texttt{F}^t \cdot \texttt{pt2})(0) + (\texttt{F}^t \cdot \texttt{pt2})(1)}\f]
+The fundamental matrix may be calculated using the cv::findFundamentalMat function. See HZ 11.4.3 for details.
+@param pt1 first homogeneous 2d point
+@param pt2 second homogeneous 2d point
+@param F fundamental matrix
+*/
+CV_EXPORTS_W double sampsonDistance(InputArray pt1, InputArray pt2, InputArray F);
+
+/** @brief Computes an optimal affine transformation between two 3D point sets.
+
+@param src First input 3D point set.
+@param dst Second input 3D point set.
+@param out Output 3D affine transformation matrix \f$3 \times 4\f$ .
+@param inliers Output vector indicating which points are inliers.
+@param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as
+an inlier.
+@param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
+between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+
+The function estimates an optimal 3D affine transformation between two 3D point sets using the
+RANSAC algorithm.
+ */
+CV_EXPORTS_W  int estimateAffine3D(InputArray src, InputArray dst,
+                                   OutputArray out, OutputArray inliers,
+                                   double ransacThreshold = 3, double confidence = 0.99);
+
+/** @brief Decompose a homography matrix to rotation(s), translation(s) and plane normal(s).
+
+@param H The input homography matrix between two images.
+@param K The input intrinsic camera calibration matrix.
+@param rotations Array of rotation matrices.
+@param translations Array of translation matrices.
+@param normals Array of plane normal matrices.
+
+This function extracts relative camera motion between two views observing a planar object from the
+homography H induced by the plane. The intrinsic camera matrix K must also be provided. The function
+may return up to four mathematical solution sets. At least two of the solutions may further be
+invalidated if point correspondences are available by applying positive depth constraint (all points
+must be in front of the camera). The decomposition method is described in detail in @cite Malis .
+ */
+CV_EXPORTS_W int decomposeHomographyMat(InputArray H,
+                                        InputArray K,
+                                        OutputArrayOfArrays rotations,
+                                        OutputArrayOfArrays translations,
+                                        OutputArrayOfArrays normals);
+
+/** @brief The base class for stereo correspondence algorithms.
+ */
+class CV_EXPORTS_W StereoMatcher : public Algorithm
+{
+public:
+    enum { DISP_SHIFT = 4,
+           DISP_SCALE = (1 << DISP_SHIFT)
+         };
+
+    /** @brief Computes disparity map for the specified stereo pair
+
+    @param left Left 8-bit single-channel image.
+    @param right Right image of the same size and the same type as the left one.
+    @param disparity Output disparity map. It has the same size as the input images. Some algorithms,
+    like StereoBM or StereoSGBM compute 16-bit fixed-point disparity map (where each disparity value
+    has 4 fractional bits), whereas other algorithms output 32-bit floating-point disparity map.
+     */
+    CV_WRAP virtual void compute( InputArray left, InputArray right,
+                                  OutputArray disparity ) = 0;
+
+    CV_WRAP virtual int getMinDisparity() const = 0;
+    CV_WRAP virtual void setMinDisparity(int minDisparity) = 0;
+
+    CV_WRAP virtual int getNumDisparities() const = 0;
+    CV_WRAP virtual void setNumDisparities(int numDisparities) = 0;
+
+    CV_WRAP virtual int getBlockSize() const = 0;
+    CV_WRAP virtual void setBlockSize(int blockSize) = 0;
+
+    CV_WRAP virtual int getSpeckleWindowSize() const = 0;
+    CV_WRAP virtual void setSpeckleWindowSize(int speckleWindowSize) = 0;
+
+    CV_WRAP virtual int getSpeckleRange() const = 0;
+    CV_WRAP virtual void setSpeckleRange(int speckleRange) = 0;
+
+    CV_WRAP virtual int getDisp12MaxDiff() const = 0;
+    CV_WRAP virtual void setDisp12MaxDiff(int disp12MaxDiff) = 0;
+};
+
+
+/** @brief Class for computing stereo correspondence using the block matching algorithm, introduced and
+contributed to OpenCV by K. Konolige.
+ */
+class CV_EXPORTS_W StereoBM : public StereoMatcher
+{
+public:
+    enum { PREFILTER_NORMALIZED_RESPONSE = 0,
+           PREFILTER_XSOBEL              = 1
+         };
+
+    CV_WRAP virtual int getPreFilterType() const = 0;
+    CV_WRAP virtual void setPreFilterType(int preFilterType) = 0;
+
+    CV_WRAP virtual int getPreFilterSize() const = 0;
+    CV_WRAP virtual void setPreFilterSize(int preFilterSize) = 0;
+
+    CV_WRAP virtual int getPreFilterCap() const = 0;
+    CV_WRAP virtual void setPreFilterCap(int preFilterCap) = 0;
+
+    CV_WRAP virtual int getTextureThreshold() const = 0;
+    CV_WRAP virtual void setTextureThreshold(int textureThreshold) = 0;
+
+    CV_WRAP virtual int getUniquenessRatio() const = 0;
+    CV_WRAP virtual void setUniquenessRatio(int uniquenessRatio) = 0;
+
+    CV_WRAP virtual int getSmallerBlockSize() const = 0;
+    CV_WRAP virtual void setSmallerBlockSize(int blockSize) = 0;
+
+    CV_WRAP virtual Rect getROI1() const = 0;
+    CV_WRAP virtual void setROI1(Rect roi1) = 0;
+
+    CV_WRAP virtual Rect getROI2() const = 0;
+    CV_WRAP virtual void setROI2(Rect roi2) = 0;
+
+    /** @brief Creates StereoBM object
+
+    @param numDisparities the disparity search range. For each pixel algorithm will find the best
+    disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
+    shifted by changing the minimum disparity.
+    @param blockSize the linear size of the blocks compared by the algorithm. The size should be odd
+    (as the block is centered at the current pixel). Larger block size implies smoother, though less
+    accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
+    chance for algorithm to find a wrong correspondence.
+
+    The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for
+    a specific stereo pair.
+     */
+    CV_WRAP static Ptr<StereoBM> create(int numDisparities = 0, int blockSize = 21);
+};
+
+/** @brief The class implements the modified H. Hirschmuller algorithm @cite HH08 that differs from the original
+one as follows:
+
+-   By default, the algorithm is single-pass, which means that you consider only 5 directions
+instead of 8. Set mode=StereoSGBM::MODE_HH in createStereoSGBM to run the full variant of the
+algorithm but beware that it may consume a lot of memory.
+-   The algorithm matches blocks, not individual pixels. Though, setting blockSize=1 reduces the
+blocks to single pixels.
+-   Mutual information cost function is not implemented. Instead, a simpler Birchfield-Tomasi
+sub-pixel metric from @cite BT98 is used. Though, the color images are supported as well.
+-   Some pre- and post- processing steps from K. Konolige algorithm StereoBM are included, for
+example: pre-filtering (StereoBM::PREFILTER_XSOBEL type) and post-filtering (uniqueness
+check, quadratic interpolation and speckle filtering).
+
+@note
+   -   (Python) An example illustrating the use of the StereoSGBM matching algorithm can be found
+        at opencv_source_code/samples/python/stereo_match.py
+ */
+class CV_EXPORTS_W StereoSGBM : public StereoMatcher
+{
+public:
+    enum
+    {
+        MODE_SGBM = 0,
+        MODE_HH   = 1,
+        MODE_SGBM_3WAY = 2
+    };
+
+    CV_WRAP virtual int getPreFilterCap() const = 0;
+    CV_WRAP virtual void setPreFilterCap(int preFilterCap) = 0;
+
+    CV_WRAP virtual int getUniquenessRatio() const = 0;
+    CV_WRAP virtual void setUniquenessRatio(int uniquenessRatio) = 0;
+
+    CV_WRAP virtual int getP1() const = 0;
+    CV_WRAP virtual void setP1(int P1) = 0;
+
+    CV_WRAP virtual int getP2() const = 0;
+    CV_WRAP virtual void setP2(int P2) = 0;
+
+    CV_WRAP virtual int getMode() const = 0;
+    CV_WRAP virtual void setMode(int mode) = 0;
+
+    /** @brief Creates StereoSGBM object
+
+    @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+    rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+    @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+    zero. In the current implementation, this parameter must be divisible by 16.
+    @param blockSize Matched block size. It must be an odd number \>=1 . Normally, it should be
+    somewhere in the 3..11 range.
+    @param P1 The first parameter controlling the disparity smoothness. See below.
+    @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+    the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+    between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+    pixels. The algorithm requires P2 \> P1 . See stereo_match.cpp sample where some reasonably good
+    P1 and P2 values are shown (like 8\*number_of_image_channels\*SADWindowSize\*SADWindowSize and
+    32\*number_of_image_channels\*SADWindowSize\*SADWindowSize , respectively).
+    @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right
+    disparity check. Set it to a non-positive value to disable the check.
+    @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first
+    computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+    The result values are passed to the Birchfield-Tomasi pixel cost function.
+    @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function
+    value should "win" the second best value to consider the found match correct. Normally, a value
+    within the 5-15 range is good enough.
+    @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles
+    and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+    50-200 range.
+    @param speckleRange Maximum disparity variation within each connected component. If you do speckle
+    filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+    Normally, 1 or 2 is good enough.
+    @param mode Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming
+    algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+    huge for HD-size pictures. By default, it is set to false .
+
+    The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+    set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+    to a custom value.
+     */
+    CV_WRAP static Ptr<StereoSGBM> create(int minDisparity, int numDisparities, int blockSize,
+                                          int P1 = 0, int P2 = 0, int disp12MaxDiff = 0,
+                                          int preFilterCap = 0, int uniquenessRatio = 0,
+                                          int speckleWindowSize = 0, int speckleRange = 0,
+                                          int mode = StereoSGBM::MODE_SGBM);
+};
+
+//! @} calib3d
+
+/** @brief The methods in this namespace use a so-called fisheye camera model.
+  @ingroup calib3d_fisheye
+*/
+namespace fisheye
+{
+//! @addtogroup calib3d_fisheye
+//! @{
+
+    enum{
+        CALIB_USE_INTRINSIC_GUESS   = 1,
+        CALIB_RECOMPUTE_EXTRINSIC   = 2,
+        CALIB_CHECK_COND            = 4,
+        CALIB_FIX_SKEW              = 8,
+        CALIB_FIX_K1                = 16,
+        CALIB_FIX_K2                = 32,
+        CALIB_FIX_K3                = 64,
+        CALIB_FIX_K4                = 128,
+        CALIB_FIX_INTRINSIC         = 256
+    };
+
+    /** @brief Projects points using fisheye model
+
+    @param objectPoints Array of object points, 1xN/Nx1 3-channel (or vector\<Point3f\> ), where N is
+    the number of points in the view.
+    @param imagePoints Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, or
+    vector\<Point2f\>.
+    @param affine
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param alpha The skew coefficient.
+    @param jacobian Optional output 2Nx15 jacobian matrix of derivatives of image points with respect
+    to components of the focal lengths, coordinates of the principal point, distortion coefficients,
+    rotation vector, translation vector, and the skew. In the old interface different components of
+    the jacobian are returned via different output parameters.
+
+    The function computes projections of 3D points to the image plane given intrinsic and extrinsic
+    camera parameters. Optionally, the function computes Jacobians - matrices of partial derivatives of
+    image points coordinates (as functions of all the input parameters) with respect to the particular
+    parameters, intrinsic and/or extrinsic.
+     */
+    CV_EXPORTS void projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine,
+        InputArray K, InputArray D, double alpha = 0, OutputArray jacobian = noArray());
+
+    /** @overload */
+    CV_EXPORTS_W void projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec,
+        InputArray K, InputArray D, double alpha = 0, OutputArray jacobian = noArray());
+
+    /** @brief Distorts 2D points using fisheye model.
+
+    @param undistorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is
+    the number of points in the view.
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param alpha The skew coefficient.
+    @param distorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
+     */
+    CV_EXPORTS_W void distortPoints(InputArray undistorted, OutputArray distorted, InputArray K, InputArray D, double alpha = 0);
+
+    /** @brief Undistorts 2D points using fisheye model
+
+    @param distorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is the
+    number of points in the view.
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+    1-channel or 1x1 3-channel
+    @param P New camera matrix (3x3) or new projection matrix (3x4)
+    @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
+     */
+    CV_EXPORTS_W void undistortPoints(InputArray distorted, OutputArray undistorted,
+        InputArray K, InputArray D, InputArray R = noArray(), InputArray P  = noArray());
+
+    /** @brief Computes undistortion and rectification maps for image transform by cv::remap(). If D is empty zero
+    distortion is used, if R or P is empty identity matrixes are used.
+
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+    1-channel or 1x1 3-channel
+    @param P New camera matrix (3x3) or new projection matrix (3x4)
+    @param size Undistorted image size.
+    @param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2 . See convertMaps()
+    for details.
+    @param map1 The first output map.
+    @param map2 The second output map.
+     */
+    CV_EXPORTS_W void initUndistortRectifyMap(InputArray K, InputArray D, InputArray R, InputArray P,
+        const cv::Size& size, int m1type, OutputArray map1, OutputArray map2);
+
+    /** @brief Transforms an image to compensate for fisheye lens distortion.
+
+    @param distorted image with fisheye lens distortion.
+    @param undistorted Output image with compensated fisheye lens distortion.
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param Knew Camera matrix of the distorted image. By default, it is the identity matrix but you
+    may additionally scale and shift the result by using a different matrix.
+    @param new_size
+
+    The function transforms an image to compensate radial and tangential lens distortion.
+
+    The function is simply a combination of fisheye::initUndistortRectifyMap (with unity R ) and remap
+    (with bilinear interpolation). See the former function for details of the transformation being
+    performed.
+
+    See below the results of undistortImage.
+       -   a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3,
+            k_4, k_5, k_6) of distortion were optimized under calibration)
+        -   b\) result of fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2,
+            k_3, k_4) of fisheye distortion were optimized under calibration)
+        -   c\) original image was captured with fisheye lens
+
+    Pictures a) and b) almost the same. But if we consider points of image located far from the center
+    of image, we can notice that on image a) these points are distorted.
+
+    ![image](pics/fisheye_undistorted.jpg)
+     */
+    CV_EXPORTS_W void undistortImage(InputArray distorted, OutputArray undistorted,
+        InputArray K, InputArray D, InputArray Knew = cv::noArray(), const Size& new_size = Size());
+
+    /** @brief Estimates new camera matrix for undistortion or rectification.
+
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param image_size
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+    1-channel or 1x1 3-channel
+    @param P New camera matrix (3x3) or new projection matrix (3x4)
+    @param balance Sets the new focal length in range between the min focal length and the max focal
+    length. Balance is in range of [0, 1].
+    @param new_size
+    @param fov_scale Divisor for new focal length.
+     */
+    CV_EXPORTS_W void estimateNewCameraMatrixForUndistortRectify(InputArray K, InputArray D, const Size &image_size, InputArray R,
+        OutputArray P, double balance = 0.0, const Size& new_size = Size(), double fov_scale = 1.0);
+
+    /** @brief Performs camera calibaration
+
+    @param objectPoints vector of vectors of calibration pattern points in the calibration pattern
+    coordinate space.
+    @param imagePoints vector of vectors of the projections of calibration pattern points.
+    imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to
+    objectPoints[i].size() for each i.
+    @param image_size Size of the image used only to initialize the intrinsic camera matrix.
+    @param K Output 3x3 floating-point camera matrix
+    \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . If
+    fisheye::CALIB_USE_INTRINSIC_GUESS/ is specified, some or all of fx, fy, cx, cy must be
+    initialized before calling the function.
+    @param D Output vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
+    That is, each k-th rotation vector together with the corresponding k-th translation vector (see
+    the next output parameter description) brings the calibration pattern from the model coordinate
+    space (in which object points are specified) to the world coordinate space, that is, a real
+    position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
+    @param tvecs Output vector of translation vectors estimated for each pattern view.
+    @param flags Different flags that may be zero or a combination of the following values:
+    -   **fisheye::CALIB_USE_INTRINSIC_GUESS** cameraMatrix contains valid initial values of
+    fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+    center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+    -   **fisheye::CALIB_RECOMPUTE_EXTRINSIC** Extrinsic will be recomputed after each iteration
+    of intrinsic optimization.
+    -   **fisheye::CALIB_CHECK_COND** The functions will check validity of condition number.
+    -   **fisheye::CALIB_FIX_SKEW** Skew coefficient (alpha) is set to zero and stay zero.
+    -   **fisheye::CALIB_FIX_K1..4** Selected distortion coefficients are set to zeros and stay
+    zero.
+    @param criteria Termination criteria for the iterative optimization algorithm.
+     */
+    CV_EXPORTS_W double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size,
+        InputOutputArray K, InputOutputArray D, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags = 0,
+            TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
+
+    /** @brief Stereo rectification for fisheye camera model
+
+    @param K1 First camera matrix.
+    @param D1 First camera distortion parameters.
+    @param K2 Second camera matrix.
+    @param D2 Second camera distortion parameters.
+    @param imageSize Size of the image used for stereo calibration.
+    @param R Rotation matrix between the coordinate systems of the first and the second
+    cameras.
+    @param tvec Translation vector between coordinate systems of the cameras.
+    @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
+    @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
+    @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+    camera.
+    @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+    camera.
+    @param Q Output \f$4 \times 4\f$ disparity-to-depth mapping matrix (see reprojectImageTo3D ).
+    @param flags Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY . If the flag is set,
+    the function makes the principal points of each camera have the same pixel coordinates in the
+    rectified views. And if the flag is not set, the function may still shift the images in the
+    horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+    useful image area.
+    @param newImageSize New image resolution after rectification. The same size should be passed to
+    initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+    is passed (default), it is set to the original imageSize . Setting it to larger value can help you
+    preserve details in the original image, especially when there is a big radial distortion.
+    @param balance Sets the new focal length in range between the min focal length and the max focal
+    length. Balance is in range of [0, 1].
+    @param fov_scale Divisor for new focal length.
+     */
+    CV_EXPORTS_W void stereoRectify(InputArray K1, InputArray D1, InputArray K2, InputArray D2, const Size &imageSize, InputArray R, InputArray tvec,
+        OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags, const Size &newImageSize = Size(),
+        double balance = 0.0, double fov_scale = 1.0);
+
+    /** @brief Performs stereo calibration
+
+    @param objectPoints Vector of vectors of the calibration pattern points.
+    @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+    observed by the first camera.
+    @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+    observed by the second camera.
+    @param K1 Input/output first camera matrix:
+    \f$\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\f$ , \f$j = 0,\, 1\f$ . If
+    any of fisheye::CALIB_USE_INTRINSIC_GUESS , fisheye::CV_CALIB_FIX_INTRINSIC are specified,
+    some or all of the matrix components must be initialized.
+    @param D1 Input/output vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$ of 4 elements.
+    @param K2 Input/output second camera matrix. The parameter is similar to K1 .
+    @param D2 Input/output lens distortion coefficients for the second camera. The parameter is
+    similar to D1 .
+    @param imageSize Size of the image used only to initialize intrinsic camera matrix.
+    @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
+    @param T Output translation vector between the coordinate systems of the cameras.
+    @param flags Different flags that may be zero or a combination of the following values:
+    -   **fisheye::CV_CALIB_FIX_INTRINSIC** Fix K1, K2? and D1, D2? so that only R, T matrices
+    are estimated.
+    -   **fisheye::CALIB_USE_INTRINSIC_GUESS** K1, K2 contains valid initial values of
+    fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+    center (imageSize is used), and focal distances are computed in a least-squares fashion.
+    -   **fisheye::CALIB_RECOMPUTE_EXTRINSIC** Extrinsic will be recomputed after each iteration
+    of intrinsic optimization.
+    -   **fisheye::CALIB_CHECK_COND** The functions will check validity of condition number.
+    -   **fisheye::CALIB_FIX_SKEW** Skew coefficient (alpha) is set to zero and stay zero.
+    -   **fisheye::CALIB_FIX_K1..4** Selected distortion coefficients are set to zeros and stay
+    zero.
+    @param criteria Termination criteria for the iterative optimization algorithm.
+     */
+    CV_EXPORTS_W double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
+                                  InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize,
+                                  OutputArray R, OutputArray T, int flags = fisheye::CALIB_FIX_INTRINSIC,
+                                  TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
+
+//! @} calib3d_fisheye
+}
+
+} // cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/calib3d/calib3d_c.h"
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp
new file mode 100644
index 0000000..b3da45e
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/calib3d.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h
new file mode 100644
index 0000000..0e77aa8
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h
@@ -0,0 +1,425 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CALIB3D_C_H__
+#define __OPENCV_CALIB3D_C_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup calib3d_c
+  @{
+  */
+
+/****************************************************************************************\
+*                      Camera Calibration, Pose Estimation and Stereo                    *
+\****************************************************************************************/
+
+typedef struct CvPOSITObject CvPOSITObject;
+
+/* Allocates and initializes CvPOSITObject structure before doing cvPOSIT */
+CVAPI(CvPOSITObject*)  cvCreatePOSITObject( CvPoint3D32f* points, int point_count );
+
+
+/* Runs POSIT (POSe from ITeration) algorithm for determining 3d position of
+   an object given its model and projection in a weak-perspective case */
+CVAPI(void)  cvPOSIT(  CvPOSITObject* posit_object, CvPoint2D32f* image_points,
+                       double focal_length, CvTermCriteria criteria,
+                       float* rotation_matrix, float* translation_vector);
+
+/* Releases CvPOSITObject structure */
+CVAPI(void)  cvReleasePOSITObject( CvPOSITObject**  posit_object );
+
+/* updates the number of RANSAC iterations */
+CVAPI(int) cvRANSACUpdateNumIters( double p, double err_prob,
+                                   int model_points, int max_iters );
+
+CVAPI(void) cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst );
+
+/* Calculates fundamental matrix given a set of corresponding points */
+#define CV_FM_7POINT 1
+#define CV_FM_8POINT 2
+
+#define CV_LMEDS 4
+#define CV_RANSAC 8
+
+#define CV_FM_LMEDS_ONLY  CV_LMEDS
+#define CV_FM_RANSAC_ONLY CV_RANSAC
+#define CV_FM_LMEDS CV_LMEDS
+#define CV_FM_RANSAC CV_RANSAC
+
+enum
+{
+    CV_ITERATIVE = 0,
+    CV_EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation"
+    CV_P3P = 2, // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem"
+    CV_DLS = 3 // Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP"
+};
+
+CVAPI(int) cvFindFundamentalMat( const CvMat* points1, const CvMat* points2,
+                                 CvMat* fundamental_matrix,
+                                 int method CV_DEFAULT(CV_FM_RANSAC),
+                                 double param1 CV_DEFAULT(3.), double param2 CV_DEFAULT(0.99),
+                                 CvMat* status CV_DEFAULT(NULL) );
+
+/* For each input point on one of images
+   computes parameters of the corresponding
+   epipolar line on the other image */
+CVAPI(void) cvComputeCorrespondEpilines( const CvMat* points,
+                                         int which_image,
+                                         const CvMat* fundamental_matrix,
+                                         CvMat* correspondent_lines );
+
+/* Triangulation functions */
+
+CVAPI(void) cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2,
+                                CvMat* projPoints1, CvMat* projPoints2,
+                                CvMat* points4D);
+
+CVAPI(void) cvCorrectMatches(CvMat* F, CvMat* points1, CvMat* points2,
+                             CvMat* new_points1, CvMat* new_points2);
+
+
+/* Computes the optimal new camera matrix according to the free scaling parameter alpha:
+   alpha=0 - only valid pixels will be retained in the undistorted image
+   alpha=1 - all the source image pixels will be retained in the undistorted image
+*/
+CVAPI(void) cvGetOptimalNewCameraMatrix( const CvMat* camera_matrix,
+                                         const CvMat* dist_coeffs,
+                                         CvSize image_size, double alpha,
+                                         CvMat* new_camera_matrix,
+                                         CvSize new_imag_size CV_DEFAULT(cvSize(0,0)),
+                                         CvRect* valid_pixel_ROI CV_DEFAULT(0),
+                                         int center_principal_point CV_DEFAULT(0));
+
+/* Converts rotation vector to rotation matrix or vice versa */
+CVAPI(int) cvRodrigues2( const CvMat* src, CvMat* dst,
+                         CvMat* jacobian CV_DEFAULT(0) );
+
+/* Finds perspective transformation between the object plane and image (view) plane */
+CVAPI(int) cvFindHomography( const CvMat* src_points,
+                             const CvMat* dst_points,
+                             CvMat* homography,
+                             int method CV_DEFAULT(0),
+                             double ransacReprojThreshold CV_DEFAULT(3),
+                             CvMat* mask CV_DEFAULT(0),
+                             int maxIters CV_DEFAULT(2000),
+                             double confidence CV_DEFAULT(0.995));
+
+/* Computes RQ decomposition for 3x3 matrices */
+CVAPI(void) cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
+                           CvMat *matrixQx CV_DEFAULT(NULL),
+                           CvMat *matrixQy CV_DEFAULT(NULL),
+                           CvMat *matrixQz CV_DEFAULT(NULL),
+                           CvPoint3D64f *eulerAngles CV_DEFAULT(NULL));
+
+/* Computes projection matrix decomposition */
+CVAPI(void) cvDecomposeProjectionMatrix( const CvMat *projMatr, CvMat *calibMatr,
+                                         CvMat *rotMatr, CvMat *posVect,
+                                         CvMat *rotMatrX CV_DEFAULT(NULL),
+                                         CvMat *rotMatrY CV_DEFAULT(NULL),
+                                         CvMat *rotMatrZ CV_DEFAULT(NULL),
+                                         CvPoint3D64f *eulerAngles CV_DEFAULT(NULL));
+
+/* Computes d(AB)/dA and d(AB)/dB */
+CVAPI(void) cvCalcMatMulDeriv( const CvMat* A, const CvMat* B, CvMat* dABdA, CvMat* dABdB );
+
+/* Computes r3 = rodrigues(rodrigues(r2)*rodrigues(r1)),
+   t3 = rodrigues(r2)*t1 + t2 and the respective derivatives */
+CVAPI(void) cvComposeRT( const CvMat* _rvec1, const CvMat* _tvec1,
+                         const CvMat* _rvec2, const CvMat* _tvec2,
+                         CvMat* _rvec3, CvMat* _tvec3,
+                         CvMat* dr3dr1 CV_DEFAULT(0), CvMat* dr3dt1 CV_DEFAULT(0),
+                         CvMat* dr3dr2 CV_DEFAULT(0), CvMat* dr3dt2 CV_DEFAULT(0),
+                         CvMat* dt3dr1 CV_DEFAULT(0), CvMat* dt3dt1 CV_DEFAULT(0),
+                         CvMat* dt3dr2 CV_DEFAULT(0), CvMat* dt3dt2 CV_DEFAULT(0) );
+
+/* Projects object points to the view plane using
+   the specified extrinsic and intrinsic camera parameters */
+CVAPI(void) cvProjectPoints2( const CvMat* object_points, const CvMat* rotation_vector,
+                              const CvMat* translation_vector, const CvMat* camera_matrix,
+                              const CvMat* distortion_coeffs, CvMat* image_points,
+                              CvMat* dpdrot CV_DEFAULT(NULL), CvMat* dpdt CV_DEFAULT(NULL),
+                              CvMat* dpdf CV_DEFAULT(NULL), CvMat* dpdc CV_DEFAULT(NULL),
+                              CvMat* dpddist CV_DEFAULT(NULL),
+                              double aspect_ratio CV_DEFAULT(0));
+
+/* Finds extrinsic camera parameters from
+   a few known corresponding point pairs and intrinsic parameters */
+CVAPI(void) cvFindExtrinsicCameraParams2( const CvMat* object_points,
+                                          const CvMat* image_points,
+                                          const CvMat* camera_matrix,
+                                          const CvMat* distortion_coeffs,
+                                          CvMat* rotation_vector,
+                                          CvMat* translation_vector,
+                                          int use_extrinsic_guess CV_DEFAULT(0) );
+
+/* Computes initial estimate of the intrinsic camera parameters
+   in case of planar calibration target (e.g. chessboard) */
+CVAPI(void) cvInitIntrinsicParams2D( const CvMat* object_points,
+                                     const CvMat* image_points,
+                                     const CvMat* npoints, CvSize image_size,
+                                     CvMat* camera_matrix,
+                                     double aspect_ratio CV_DEFAULT(1.) );
+
+#define CV_CALIB_CB_ADAPTIVE_THRESH  1
+#define CV_CALIB_CB_NORMALIZE_IMAGE  2
+#define CV_CALIB_CB_FILTER_QUADS     4
+#define CV_CALIB_CB_FAST_CHECK       8
+
+// Performs a fast check if a chessboard is in the input image. This is a workaround to
+// a problem of cvFindChessboardCorners being slow on images with no chessboard
+// - src: input image
+// - size: chessboard size
+// Returns 1 if a chessboard can be in this image and findChessboardCorners should be called,
+// 0 if there is no chessboard, -1 in case of error
+CVAPI(int) cvCheckChessboard(IplImage* src, CvSize size);
+
+    /* Detects corners on a chessboard calibration pattern */
+CVAPI(int) cvFindChessboardCorners( const void* image, CvSize pattern_size,
+                                    CvPoint2D32f* corners,
+                                    int* corner_count CV_DEFAULT(NULL),
+                                    int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE) );
+
+/* Draws individual chessboard corners or the whole chessboard detected */
+CVAPI(void) cvDrawChessboardCorners( CvArr* image, CvSize pattern_size,
+                                     CvPoint2D32f* corners,
+                                     int count, int pattern_was_found );
+
+#define CV_CALIB_USE_INTRINSIC_GUESS  1
+#define CV_CALIB_FIX_ASPECT_RATIO     2
+#define CV_CALIB_FIX_PRINCIPAL_POINT  4
+#define CV_CALIB_ZERO_TANGENT_DIST    8
+#define CV_CALIB_FIX_FOCAL_LENGTH 16
+#define CV_CALIB_FIX_K1  32
+#define CV_CALIB_FIX_K2  64
+#define CV_CALIB_FIX_K3  128
+#define CV_CALIB_FIX_K4  2048
+#define CV_CALIB_FIX_K5  4096
+#define CV_CALIB_FIX_K6  8192
+#define CV_CALIB_RATIONAL_MODEL 16384
+#define CV_CALIB_THIN_PRISM_MODEL 32768
+#define CV_CALIB_FIX_S1_S2_S3_S4  65536
+#define CV_CALIB_TILTED_MODEL  262144
+#define CV_CALIB_FIX_TAUX_TAUY  524288
+
+
+/* Finds intrinsic and extrinsic camera parameters
+   from a few views of known calibration pattern */
+CVAPI(double) cvCalibrateCamera2( const CvMat* object_points,
+                                const CvMat* image_points,
+                                const CvMat* point_counts,
+                                CvSize image_size,
+                                CvMat* camera_matrix,
+                                CvMat* distortion_coeffs,
+                                CvMat* rotation_vectors CV_DEFAULT(NULL),
+                                CvMat* translation_vectors CV_DEFAULT(NULL),
+                                int flags CV_DEFAULT(0),
+                                CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
+                                    CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) );
+
+/* Computes various useful characteristics of the camera from the data computed by
+   cvCalibrateCamera2 */
+CVAPI(void) cvCalibrationMatrixValues( const CvMat *camera_matrix,
+                                CvSize image_size,
+                                double aperture_width CV_DEFAULT(0),
+                                double aperture_height CV_DEFAULT(0),
+                                double *fovx CV_DEFAULT(NULL),
+                                double *fovy CV_DEFAULT(NULL),
+                                double *focal_length CV_DEFAULT(NULL),
+                                CvPoint2D64f *principal_point CV_DEFAULT(NULL),
+                                double *pixel_aspect_ratio CV_DEFAULT(NULL));
+
+#define CV_CALIB_FIX_INTRINSIC  256
+#define CV_CALIB_SAME_FOCAL_LENGTH 512
+
+/* Computes the transformation from one camera coordinate system to another one
+   from a few correspondent views of the same calibration target. Optionally, calibrates
+   both cameras */
+CVAPI(double) cvStereoCalibrate( const CvMat* object_points, const CvMat* image_points1,
+                               const CvMat* image_points2, const CvMat* npoints,
+                               CvMat* camera_matrix1, CvMat* dist_coeffs1,
+                               CvMat* camera_matrix2, CvMat* dist_coeffs2,
+                               CvSize image_size, CvMat* R, CvMat* T,
+                               CvMat* E CV_DEFAULT(0), CvMat* F CV_DEFAULT(0),
+                               int flags CV_DEFAULT(CV_CALIB_FIX_INTRINSIC),
+                               CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
+                                   CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6)) );
+
+#define CV_CALIB_ZERO_DISPARITY 1024
+
+/* Computes 3D rotations (+ optional shift) for each camera coordinate system to make both
+   views parallel (=> to make all the epipolar lines horizontal or vertical) */
+CVAPI(void) cvStereoRectify( const CvMat* camera_matrix1, const CvMat* camera_matrix2,
+                             const CvMat* dist_coeffs1, const CvMat* dist_coeffs2,
+                             CvSize image_size, const CvMat* R, const CvMat* T,
+                             CvMat* R1, CvMat* R2, CvMat* P1, CvMat* P2,
+                             CvMat* Q CV_DEFAULT(0),
+                             int flags CV_DEFAULT(CV_CALIB_ZERO_DISPARITY),
+                             double alpha CV_DEFAULT(-1),
+                             CvSize new_image_size CV_DEFAULT(cvSize(0,0)),
+                             CvRect* valid_pix_ROI1 CV_DEFAULT(0),
+                             CvRect* valid_pix_ROI2 CV_DEFAULT(0));
+
+/* Computes rectification transformations for uncalibrated pair of images using a set
+   of point correspondences */
+CVAPI(int) cvStereoRectifyUncalibrated( const CvMat* points1, const CvMat* points2,
+                                        const CvMat* F, CvSize img_size,
+                                        CvMat* H1, CvMat* H2,
+                                        double threshold CV_DEFAULT(5));
+
+
+
+/* stereo correspondence parameters and functions */
+
+#define CV_STEREO_BM_NORMALIZED_RESPONSE  0
+#define CV_STEREO_BM_XSOBEL               1
+
+/* Block matching algorithm structure */
+typedef struct CvStereoBMState
+{
+    // pre-filtering (normalization of input images)
+    int preFilterType; // =CV_STEREO_BM_NORMALIZED_RESPONSE now
+    int preFilterSize; // averaging window size: ~5x5..21x21
+    int preFilterCap; // the output of pre-filtering is clipped by [-preFilterCap,preFilterCap]
+
+    // correspondence using Sum of Absolute Difference (SAD)
+    int SADWindowSize; // ~5x5..21x21
+    int minDisparity;  // minimum disparity (can be negative)
+    int numberOfDisparities; // maximum disparity - minimum disparity (> 0)
+
+    // post-filtering
+    int textureThreshold;  // the disparity is only computed for pixels
+                           // with textured enough neighborhood
+    int uniquenessRatio;   // accept the computed disparity d* only if
+                           // SAD(d) >= SAD(d*)*(1 + uniquenessRatio/100.)
+                           // for any d != d*+/-1 within the search range.
+    int speckleWindowSize; // disparity variation window
+    int speckleRange; // acceptable range of variation in window
+
+    int trySmallerWindows; // if 1, the results may be more accurate,
+                           // at the expense of slower processing
+    CvRect roi1, roi2;
+    int disp12MaxDiff;
+
+    // temporary buffers
+    CvMat* preFilteredImg0;
+    CvMat* preFilteredImg1;
+    CvMat* slidingSumBuf;
+    CvMat* cost;
+    CvMat* disp;
+} CvStereoBMState;
+
+#define CV_STEREO_BM_BASIC 0
+#define CV_STEREO_BM_FISH_EYE 1
+#define CV_STEREO_BM_NARROW 2
+
+CVAPI(CvStereoBMState*) cvCreateStereoBMState(int preset CV_DEFAULT(CV_STEREO_BM_BASIC),
+                                              int numberOfDisparities CV_DEFAULT(0));
+
+CVAPI(void) cvReleaseStereoBMState( CvStereoBMState** state );
+
+CVAPI(void) cvFindStereoCorrespondenceBM( const CvArr* left, const CvArr* right,
+                                          CvArr* disparity, CvStereoBMState* state );
+
+CVAPI(CvRect) cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity,
+                                      int numberOfDisparities, int SADWindowSize );
+
+CVAPI(void) cvValidateDisparity( CvArr* disparity, const CvArr* cost,
+                                 int minDisparity, int numberOfDisparities,
+                                 int disp12MaxDiff CV_DEFAULT(1) );
+
+/* Reprojects the computed disparity image to the 3D space using the specified 4x4 matrix */
+CVAPI(void)  cvReprojectImageTo3D( const CvArr* disparityImage,
+                                   CvArr* _3dImage, const CvMat* Q,
+                                   int handleMissingValues CV_DEFAULT(0) );
+
+/** @} calib3d_c */
+
+#ifdef __cplusplus
+} // extern "C"
+
+//////////////////////////////////////////////////////////////////////////////////////////
+class CV_EXPORTS CvLevMarq
+{
+public:
+    CvLevMarq();
+    CvLevMarq( int nparams, int nerrs, CvTermCriteria criteria=
+              cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
+              bool completeSymmFlag=false );
+    ~CvLevMarq();
+    void init( int nparams, int nerrs, CvTermCriteria criteria=
+              cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
+              bool completeSymmFlag=false );
+    bool update( const CvMat*& param, CvMat*& J, CvMat*& err );
+    bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm );
+
+    void clear();
+    void step();
+    enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 };
+
+    cv::Ptr<CvMat> mask;
+    cv::Ptr<CvMat> prevParam;
+    cv::Ptr<CvMat> param;
+    cv::Ptr<CvMat> J;
+    cv::Ptr<CvMat> err;
+    cv::Ptr<CvMat> JtJ;
+    cv::Ptr<CvMat> JtJN;
+    cv::Ptr<CvMat> JtErr;
+    cv::Ptr<CvMat> JtJV;
+    cv::Ptr<CvMat> JtJW;
+    double prevErrNorm, errNorm;
+    int lambdaLg10;
+    CvTermCriteria criteria;
+    int state;
+    int iters;
+    bool completeSymmFlag;
+    int solveMethod;
+};
+
+#endif
+
+#endif /* __OPENCV_CALIB3D_C_H__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core.hpp
new file mode 100644
index 0000000..5592260
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core.hpp
@@ -0,0 +1,3168 @@
+/*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-2015, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Copyright (C) 2015, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_HPP__
+#define __OPENCV_CORE_HPP__
+
+#ifndef __cplusplus
+#  error core.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/version.hpp"
+#include "opencv2/core/base.hpp"
+#include "opencv2/core/cvstd.hpp"
+#include "opencv2/core/traits.hpp"
+#include "opencv2/core/matx.hpp"
+#include "opencv2/core/types.hpp"
+#include "opencv2/core/mat.hpp"
+#include "opencv2/core/persistence.hpp"
+
+/**
+@defgroup core Core functionality
+@{
+    @defgroup core_basic Basic structures
+    @defgroup core_c C structures and operations
+    @{
+        @defgroup core_c_glue Connections with C++
+    @}
+    @defgroup core_array Operations on arrays
+    @defgroup core_xml XML/YAML Persistence
+    @defgroup core_cluster Clustering
+    @defgroup core_utils Utility and system functions and macros
+    @{
+        @defgroup core_utils_sse SSE utilities
+        @defgroup core_utils_neon NEON utilities
+    @}
+    @defgroup core_opengl OpenGL interoperability
+    @defgroup core_ipp Intel IPP Asynchronous C/C++ Converters
+    @defgroup core_optim Optimization Algorithms
+    @defgroup core_directx DirectX interoperability
+    @defgroup core_eigen Eigen support
+    @defgroup core_opencl OpenCL support
+    @defgroup core_va_intel Intel VA-API/OpenCL (CL-VA) interoperability
+    @defgroup core_hal Hardware Acceleration Layer
+    @{
+        @defgroup core_hal_functions Functions
+        @defgroup core_hal_interface Interface
+        @defgroup core_hal_intrin Universal intrinsics
+        @{
+            @defgroup core_hal_intrin_impl Private implementation helpers
+        @}
+    @}
+@}
+ */
+
+namespace cv {
+
+//! @addtogroup core_utils
+//! @{
+
+/*! @brief Class passed to an error.
+
+This class encapsulates all or almost all necessary
+information about the error happened in the program. The exception is
+usually constructed and thrown implicitly via CV_Error and CV_Error_ macros.
+@see error
+ */
+class CV_EXPORTS Exception : public std::exception
+{
+public:
+    /*!
+     Default constructor
+     */
+    Exception();
+    /*!
+     Full constructor. Normally the constuctor is not called explicitly.
+     Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used.
+    */
+    Exception(int _code, const String& _err, const String& _func, const String& _file, int _line);
+    virtual ~Exception() throw();
+
+    /*!
+     \return the error description and the context as a text string.
+    */
+    virtual const char *what() const throw();
+    void formatMessage();
+
+    String msg; ///< the formatted error message
+
+    int code; ///< error code @see CVStatus
+    String err; ///< error description
+    String func; ///< function name. Available only when the compiler supports getting it
+    String file; ///< source file name where the error has occured
+    int line; ///< line number in the source file where the error has occured
+};
+
+/*! @brief Signals an error and raises the exception.
+
+By default the function prints information about the error to stderr,
+then it either stops if cv::setBreakOnError() had been called before or raises the exception.
+It is possible to alternate error processing by using cv::redirectError().
+@param exc the exception raisen.
+@deprecated drop this version
+ */
+CV_EXPORTS void error( const Exception& exc );
+
+enum SortFlags { SORT_EVERY_ROW    = 0, //!< each matrix row is sorted independently
+                 SORT_EVERY_COLUMN = 1, //!< each matrix column is sorted
+                                        //!< independently; this flag and the previous one are
+                                        //!< mutually exclusive.
+                 SORT_ASCENDING    = 0, //!< each matrix row is sorted in the ascending
+                                        //!< order.
+                 SORT_DESCENDING   = 16 //!< each matrix row is sorted in the
+                                        //!< descending order; this flag and the previous one are also
+                                        //!< mutually exclusive.
+               };
+
+//! @} core_utils
+
+//! @addtogroup core
+//! @{
+
+//! Covariation flags
+enum CovarFlags {
+    /** The output covariance matrix is calculated as:
+       \f[\texttt{scale}   \cdot  [  \texttt{vects}  [0]-  \texttt{mean}  , \texttt{vects}  [1]-  \texttt{mean}  ,...]^T  \cdot  [ \texttt{vects}  [0]- \texttt{mean}  , \texttt{vects}  [1]- \texttt{mean}  ,...],\f]
+       The covariance matrix will be nsamples x nsamples. Such an unusual covariance matrix is used
+       for fast PCA of a set of very large vectors (see, for example, the EigenFaces technique for
+       face recognition). Eigenvalues of this "scrambled" matrix match the eigenvalues of the true
+       covariance matrix. The "true" eigenvectors can be easily calculated from the eigenvectors of
+       the "scrambled" covariance matrix. */
+    COVAR_SCRAMBLED = 0,
+    /**The output covariance matrix is calculated as:
+        \f[\texttt{scale}   \cdot  [  \texttt{vects}  [0]-  \texttt{mean}  , \texttt{vects}  [1]-  \texttt{mean}  ,...]  \cdot  [ \texttt{vects}  [0]- \texttt{mean}  , \texttt{vects}  [1]- \texttt{mean}  ,...]^T,\f]
+        covar will be a square matrix of the same size as the total number of elements in each input
+        vector. One and only one of COVAR_SCRAMBLED and COVAR_NORMAL must be specified.*/
+    COVAR_NORMAL    = 1,
+    /** If the flag is specified, the function does not calculate mean from
+        the input vectors but, instead, uses the passed mean vector. This is useful if mean has been
+        pre-calculated or known in advance, or if the covariance matrix is calculated by parts. In
+        this case, mean is not a mean vector of the input sub-set of vectors but rather the mean
+        vector of the whole set.*/
+    COVAR_USE_AVG   = 2,
+    /** If the flag is specified, the covariance matrix is scaled. In the
+        "normal" mode, scale is 1./nsamples . In the "scrambled" mode, scale is the reciprocal of the
+        total number of elements in each input vector. By default (if the flag is not specified), the
+        covariance matrix is not scaled ( scale=1 ).*/
+    COVAR_SCALE     = 4,
+    /** If the flag is
+        specified, all the input vectors are stored as rows of the samples matrix. mean should be a
+        single-row vector in this case.*/
+    COVAR_ROWS      = 8,
+    /** If the flag is
+        specified, all the input vectors are stored as columns of the samples matrix. mean should be a
+        single-column vector in this case.*/
+    COVAR_COLS      = 16
+};
+
+//! k-Means flags
+enum KmeansFlags {
+    /** Select random initial centers in each attempt.*/
+    KMEANS_RANDOM_CENTERS     = 0,
+    /** Use kmeans++ center initialization by Arthur and Vassilvitskii [Arthur2007].*/
+    KMEANS_PP_CENTERS         = 2,
+    /** During the first (and possibly the only) attempt, use the
+        user-supplied labels instead of computing them from the initial centers. For the second and
+        further attempts, use the random or semi-random centers. Use one of KMEANS_\*_CENTERS flag
+        to specify the exact method.*/
+    KMEANS_USE_INITIAL_LABELS = 1
+};
+
+//! type of line
+enum LineTypes {
+    FILLED  = -1,
+    LINE_4  = 4, //!< 4-connected line
+    LINE_8  = 8, //!< 8-connected line
+    LINE_AA = 16 //!< antialiased line
+};
+
+//! Only a subset of Hershey fonts
+//! <http://sources.isc.org/utils/misc/hershey-font.txt> are supported
+enum HersheyFonts {
+    FONT_HERSHEY_SIMPLEX        = 0, //!< normal size sans-serif font
+    FONT_HERSHEY_PLAIN          = 1, //!< small size sans-serif font
+    FONT_HERSHEY_DUPLEX         = 2, //!< normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)
+    FONT_HERSHEY_COMPLEX        = 3, //!< normal size serif font
+    FONT_HERSHEY_TRIPLEX        = 4, //!< normal size serif font (more complex than FONT_HERSHEY_COMPLEX)
+    FONT_HERSHEY_COMPLEX_SMALL  = 5, //!< smaller version of FONT_HERSHEY_COMPLEX
+    FONT_HERSHEY_SCRIPT_SIMPLEX = 6, //!< hand-writing style font
+    FONT_HERSHEY_SCRIPT_COMPLEX = 7, //!< more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX
+    FONT_ITALIC                 = 16 //!< flag for italic font
+};
+
+enum ReduceTypes { REDUCE_SUM = 0, //!< the output is the sum of all rows/columns of the matrix.
+                   REDUCE_AVG = 1, //!< the output is the mean vector of all rows/columns of the matrix.
+                   REDUCE_MAX = 2, //!< the output is the maximum (column/row-wise) of all rows/columns of the matrix.
+                   REDUCE_MIN = 3  //!< the output is the minimum (column/row-wise) of all rows/columns of the matrix.
+                 };
+
+
+/** @brief Swaps two matrices
+*/
+CV_EXPORTS void swap(Mat& a, Mat& b);
+/** @overload */
+CV_EXPORTS void swap( UMat& a, UMat& b );
+
+//! @} core
+
+//! @addtogroup core_array
+//! @{
+
+/** @brief Computes the source location of an extrapolated pixel.
+
+The function computes and returns the coordinate of a donor pixel corresponding to the specified
+extrapolated pixel when using the specified extrapolation border mode. For example, if you use
+cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and
+want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img , it
+looks like:
+@code{.cpp}
+    float val = img.at<float>(borderInterpolate(100, img.rows, cv::BORDER_REFLECT_101),
+                              borderInterpolate(-5, img.cols, cv::BORDER_WRAP));
+@endcode
+Normally, the function is not called directly. It is used inside filtering functions and also in
+copyMakeBorder.
+@param p 0-based coordinate of the extrapolated pixel along one of the axes, likely \<0 or \>= len
+@param len Length of the array along the corresponding axis.
+@param borderType Border type, one of the cv::BorderTypes, except for cv::BORDER_TRANSPARENT and
+cv::BORDER_ISOLATED . When borderType==cv::BORDER_CONSTANT , the function always returns -1, regardless
+of p and len.
+
+@sa copyMakeBorder
+*/
+CV_EXPORTS_W int borderInterpolate(int p, int len, int borderType);
+
+/** @brief Forms a border around an image.
+
+The function copies the source image into the middle of the destination image. The areas to the
+left, to the right, above and below the copied source image will be filled with extrapolated
+pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but
+what other more complex functions, including your own, may do to simplify image boundary handling.
+
+The function supports the mode when src is already in the middle of dst . In this case, the
+function does not copy src itself but simply constructs the border, for example:
+
+@code{.cpp}
+    // let border be the same in all directions
+    int border=2;
+    // constructs a larger image to fit both the image and the border
+    Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth());
+    // select the middle part of it w/o copying data
+    Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
+    // convert image from RGB to grayscale
+    cvtColor(rgb, gray, COLOR_RGB2GRAY);
+    // form a border in-place
+    copyMakeBorder(gray, gray_buf, border, border,
+                   border, border, BORDER_REPLICATE);
+    // now do some custom filtering ...
+    ...
+@endcode
+@note When the source image is a part (ROI) of a bigger image, the function will try to use the
+pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as
+if src was not a ROI, use borderType | BORDER_ISOLATED.
+
+@param src Source image.
+@param dst Destination image of the same type as src and the size Size(src.cols+left+right,
+src.rows+top+bottom) .
+@param top
+@param bottom
+@param left
+@param right Parameter specifying how many pixels in each direction from the source image rectangle
+to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs
+to be built.
+@param borderType Border type. See borderInterpolate for details.
+@param value Border value if borderType==BORDER_CONSTANT .
+
+@sa  borderInterpolate
+*/
+CV_EXPORTS_W void copyMakeBorder(InputArray src, OutputArray dst,
+                                 int top, int bottom, int left, int right,
+                                 int borderType, const Scalar& value = Scalar() );
+
+/** @brief Calculates the per-element sum of two arrays or an array and a scalar.
+
+The function add calculates:
+- Sum of two arrays when both input arrays have the same size and the same number of channels:
+\f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
+- Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of
+elements as `src1.channels()`:
+\f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]
+- Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of
+elements as `src2.channels()`:
+\f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} +  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f]
+where `I` is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+channel is processed independently.
+
+The first function in the list above can be replaced with matrix expressions:
+@code{.cpp}
+    dst = src1 + src2;
+    dst += src1; // equivalent to add(dst, src1, dst);
+@endcode
+The input arrays and the output array can all have the same or different depths. For example, you
+can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
+floating-point array. Depth of the output array is determined by the dtype parameter. In the second
+and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
+be set to the default -1. In this case, the output array will have the same depth as the input
+array, be it src1, src2 or both.
+@note Saturation is not applied when the output array has the depth CV_32S. You may even get
+result of an incorrect sign in the case of overflow.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and number of channels as the input array(s); the
+depth is defined by dtype or src1/src2.
+@param mask optional operation mask - 8-bit single channel array, that specifies elements of the
+output array to be changed.
+@param dtype optional depth of the output array (see the discussion below).
+@sa subtract, addWeighted, scaleAdd, Mat::convertTo
+*/
+CV_EXPORTS_W void add(InputArray src1, InputArray src2, OutputArray dst,
+                      InputArray mask = noArray(), int dtype = -1);
+
+/** @brief Calculates the per-element difference between two arrays or array and a scalar.
+
+The function subtract calculates:
+- Difference between two arrays, when both input arrays have the same size and the same number of
+channels:
+    \f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
+- Difference between an array and a scalar, when src2 is constructed from Scalar or has the same
+number of elements as `src1.channels()`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]
+- Difference between a scalar and an array, when src1 is constructed from Scalar or has the same
+number of elements as `src2.channels()`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} -  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f]
+- The reverse difference between a scalar and an array in the case of `SubRS`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src2} -  \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\f]
+where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+channel is processed independently.
+
+The first function in the list above can be replaced with matrix expressions:
+@code{.cpp}
+    dst = src1 - src2;
+    dst -= src1; // equivalent to subtract(dst, src1, dst);
+@endcode
+The input arrays and the output array can all have the same or different depths. For example, you
+can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of
+the output array is determined by dtype parameter. In the second and third cases above, as well as
+in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this
+case the output array will have the same depth as the input array, be it src1, src2 or both.
+@note Saturation is not applied when the output array has the depth CV_32S. You may even get
+result of an incorrect sign in the case of overflow.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array of the same size and the same number of channels as the input array.
+@param mask optional operation mask; this is an 8-bit single channel array that specifies elements
+of the output array to be changed.
+@param dtype optional depth of the output array
+@sa  add, addWeighted, scaleAdd, Mat::convertTo
+  */
+CV_EXPORTS_W void subtract(InputArray src1, InputArray src2, OutputArray dst,
+                           InputArray mask = noArray(), int dtype = -1);
+
+
+/** @brief Calculates the per-element scaled product of two arrays.
+
+The function multiply calculates the per-element product of two arrays:
+
+\f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I)  \cdot \texttt{src2} (I))\f]
+
+There is also a @ref MatrixExpressions -friendly variant of the first function. See Mat::mul .
+
+For a not-per-element matrix product, see gemm .
+
+@note Saturation is not applied when the output array has the depth
+CV_32S. You may even get result of an incorrect sign in the case of
+overflow.
+@param src1 first input array.
+@param src2 second input array of the same size and the same type as src1.
+@param dst output array of the same size and type as src1.
+@param scale optional scale factor.
+@param dtype optional depth of the output array
+@sa add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare,
+Mat::convertTo
+*/
+CV_EXPORTS_W void multiply(InputArray src1, InputArray src2,
+                           OutputArray dst, double scale = 1, int dtype = -1);
+
+/** @brief Performs per-element division of two arrays or a scalar by an array.
+
+The functions divide divide one array by another:
+\f[\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\f]
+or a scalar by an array when there is no src1 :
+\f[\texttt{dst(I) = saturate(scale/src2(I))}\f]
+
+When src2(I) is zero, dst(I) will also be zero. Different channels of
+multi-channel arrays are processed independently.
+
+@note Saturation is not applied when the output array has the depth CV_32S. You may even get
+result of an incorrect sign in the case of overflow.
+@param src1 first input array.
+@param src2 second input array of the same size and type as src1.
+@param scale scalar factor.
+@param dst output array of the same size and type as src2.
+@param dtype optional depth of the output array; if -1, dst will have depth src2.depth(), but in
+case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
+@sa  multiply, add, subtract
+*/
+CV_EXPORTS_W void divide(InputArray src1, InputArray src2, OutputArray dst,
+                         double scale = 1, int dtype = -1);
+
+/** @overload */
+CV_EXPORTS_W void divide(double scale, InputArray src2,
+                         OutputArray dst, int dtype = -1);
+
+/** @brief Calculates the sum of a scaled array and another array.
+
+The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY
+or SAXPY in [BLAS](http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms). It calculates
+the sum of a scaled array and another array:
+\f[\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) +  \texttt{src2} (I)\f]
+The function can also be emulated with a matrix expression, for example:
+@code{.cpp}
+    Mat A(3, 3, CV_64F);
+    ...
+    A.row(0) = A.row(1)*2 + A.row(2);
+@endcode
+@param src1 first input array.
+@param alpha scale factor for the first array.
+@param src2 second input array of the same size and type as src1.
+@param dst output array of the same size and type as src1.
+@sa add, addWeighted, subtract, Mat::dot, Mat::convertTo
+*/
+CV_EXPORTS_W void scaleAdd(InputArray src1, double alpha, InputArray src2, OutputArray dst);
+
+/** @brief Calculates the weighted sum of two arrays.
+
+The function addWeighted calculates the weighted sum of two arrays as follows:
+\f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} +  \texttt{src2} (I)* \texttt{beta} +  \texttt{gamma} )\f]
+where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+channel is processed independently.
+The function can be replaced with a matrix expression:
+@code{.cpp}
+    dst = src1*alpha + src2*beta + gamma;
+@endcode
+@note Saturation is not applied when the output array has the depth CV_32S. You may even get
+result of an incorrect sign in the case of overflow.
+@param src1 first input array.
+@param alpha weight of the first array elements.
+@param src2 second input array of the same size and channel number as src1.
+@param beta weight of the second array elements.
+@param gamma scalar added to each sum.
+@param dst output array that has the same size and number of channels as the input arrays.
+@param dtype optional depth of the output array; when both input arrays have the same depth, dtype
+can be set to -1, which will be equivalent to src1.depth().
+@sa  add, subtract, scaleAdd, Mat::convertTo
+*/
+CV_EXPORTS_W void addWeighted(InputArray src1, double alpha, InputArray src2,
+                              double beta, double gamma, OutputArray dst, int dtype = -1);
+
+/** @brief Scales, calculates absolute values, and converts the result to 8-bit.
+
+On each element of the input array, the function convertScaleAbs
+performs three operations sequentially: scaling, taking an absolute
+value, conversion to an unsigned 8-bit type:
+\f[\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} +  \texttt{beta} |)\f]
+In case of multi-channel arrays, the function processes each channel
+independently. When the output is not 8-bit, the operation can be
+emulated by calling the Mat::convertTo method (or by using matrix
+expressions) and then by calculating an absolute value of the result.
+For example:
+@code{.cpp}
+    Mat_<float> A(30,30);
+    randu(A, Scalar(-100), Scalar(100));
+    Mat_<float> B = A*5 + 3;
+    B = abs(B);
+    // Mat_<float> B = abs(A*5+3) will also do the job,
+    // but it will allocate a temporary matrix
+@endcode
+@param src input array.
+@param dst output array.
+@param alpha optional scale factor.
+@param beta optional delta added to the scaled values.
+@sa  Mat::convertTo, cv::abs(const Mat&)
+*/
+CV_EXPORTS_W void convertScaleAbs(InputArray src, OutputArray dst,
+                                  double alpha = 1, double beta = 0);
+
+/** @brief Performs a look-up table transform of an array.
+
+The function LUT fills the output array with values from the look-up table. Indices of the entries
+are taken from the input array. That is, the function processes each element of src as follows:
+\f[\texttt{dst} (I)  \leftarrow \texttt{lut(src(I) + d)}\f]
+where
+\f[d =  \fork{0}{if \(\texttt{src}\) has depth \(\texttt{CV_8U}\)}{128}{if \(\texttt{src}\) has depth \(\texttt{CV_8S}\)}\f]
+@param src input array of 8-bit elements.
+@param lut look-up table of 256 elements; in case of multi-channel input array, the table should
+either have a single channel (in this case the same table is used for all channels) or the same
+number of channels as in the input array.
+@param dst output array of the same size and number of channels as src, and the same depth as lut.
+@sa  convertScaleAbs, Mat::convertTo
+*/
+CV_EXPORTS_W void LUT(InputArray src, InputArray lut, OutputArray dst);
+
+/** @brief Calculates the sum of array elements.
+
+The functions sum calculate and return the sum of array elements,
+independently for each channel.
+@param src input array that must have from 1 to 4 channels.
+@sa  countNonZero, mean, meanStdDev, norm, minMaxLoc, reduce
+*/
+CV_EXPORTS_AS(sumElems) Scalar sum(InputArray src);
+
+/** @brief Counts non-zero array elements.
+
+The function returns the number of non-zero elements in src :
+\f[\sum _{I: \; \texttt{src} (I) \ne0 } 1\f]
+@param src single-channel array.
+@sa  mean, meanStdDev, norm, minMaxLoc, calcCovarMatrix
+*/
+CV_EXPORTS_W int countNonZero( InputArray src );
+
+/** @brief Returns the list of locations of non-zero pixels
+
+Given a binary matrix (likely returned from an operation such
+as threshold(), compare(), >, ==, etc, return all of
+the non-zero indices as a cv::Mat or std::vector<cv::Point> (x,y)
+For example:
+@code{.cpp}
+    cv::Mat binaryImage; // input, binary image
+    cv::Mat locations;   // output, locations of non-zero pixels
+    cv::findNonZero(binaryImage, locations);
+
+    // access pixel coordinates
+    Point pnt = locations.at<Point>(i);
+@endcode
+or
+@code{.cpp}
+    cv::Mat binaryImage; // input, binary image
+    vector<Point> locations;   // output, locations of non-zero pixels
+    cv::findNonZero(binaryImage, locations);
+
+    // access pixel coordinates
+    Point pnt = locations[i];
+@endcode
+@param src single-channel array (type CV_8UC1)
+@param idx the output array, type of cv::Mat or std::vector<Point>, corresponding to non-zero indices in the input
+*/
+CV_EXPORTS_W void findNonZero( InputArray src, OutputArray idx );
+
+/** @brief Calculates an average (mean) of array elements.
+
+The function mean calculates the mean value M of array elements,
+independently for each channel, and return it:
+\f[\begin{array}{l} N =  \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c =  \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\f]
+When all the mask elements are 0's, the functions return Scalar::all(0)
+@param src input array that should have from 1 to 4 channels so that the result can be stored in
+Scalar_ .
+@param mask optional operation mask.
+@sa  countNonZero, meanStdDev, norm, minMaxLoc
+*/
+CV_EXPORTS_W Scalar mean(InputArray src, InputArray mask = noArray());
+
+/** Calculates a mean and standard deviation of array elements.
+
+The function meanStdDev calculates the mean and the standard deviation M
+of array elements independently for each channel and returns it via the
+output parameters:
+\f[\begin{array}{l} N =  \sum _{I, \texttt{mask} (I)  \ne 0} 1 \\ \texttt{mean} _c =  \frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \texttt{src} (I)_c}{N} \\ \texttt{stddev} _c =  \sqrt{\frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \left ( \texttt{src} (I)_c -  \texttt{mean} _c \right )^2}{N}} \end{array}\f]
+When all the mask elements are 0's, the functions return
+mean=stddev=Scalar::all(0).
+@note The calculated standard deviation is only the diagonal of the
+complete normalized covariance matrix. If the full matrix is needed, you
+can reshape the multi-channel array M x N to the single-channel array
+M\*N x mtx.channels() (only possible when the matrix is continuous) and
+then pass the matrix to calcCovarMatrix .
+@param src input array that should have from 1 to 4 channels so that the results can be stored in
+Scalar_ 's.
+@param mean output parameter: calculated mean value.
+@param stddev output parameter: calculateded standard deviation.
+@param mask optional operation mask.
+@sa  countNonZero, mean, norm, minMaxLoc, calcCovarMatrix
+*/
+CV_EXPORTS_W void meanStdDev(InputArray src, OutputArray mean, OutputArray stddev,
+                             InputArray mask=noArray());
+
+/** @brief Calculates an absolute array norm, an absolute difference norm, or a
+relative difference norm.
+
+The functions norm calculate an absolute norm of src1 (when there is no
+src2 ):
+
+\f[norm =  \forkthree{\|\texttt{src1}\|_{L_{\infty}} =  \max _I | \texttt{src1} (I)|}{if  \(\texttt{normType} = \texttt{NORM_INF}\) }
+{ \| \texttt{src1} \| _{L_1} =  \sum _I | \texttt{src1} (I)|}{if  \(\texttt{normType} = \texttt{NORM_L1}\) }
+{ \| \texttt{src1} \| _{L_2} =  \sqrt{\sum_I \texttt{src1}(I)^2} }{if  \(\texttt{normType} = \texttt{NORM_L2}\) }\f]
+
+or an absolute or relative difference norm if src2 is there:
+
+\f[norm =  \forkthree{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} =  \max _I | \texttt{src1} (I) -  \texttt{src2} (I)|}{if  \(\texttt{normType} = \texttt{NORM_INF}\) }
+{ \| \texttt{src1} - \texttt{src2} \| _{L_1} =  \sum _I | \texttt{src1} (I) -  \texttt{src2} (I)|}{if  \(\texttt{normType} = \texttt{NORM_L1}\) }
+{ \| \texttt{src1} - \texttt{src2} \| _{L_2} =  \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if  \(\texttt{normType} = \texttt{NORM_L2}\) }\f]
+
+or
+
+\f[norm =  \forkthree{\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}}    }{\|\texttt{src2}\|_{L_{\infty}} }}{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_INF}\) }
+{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_L1}\) }
+{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_L2}\) }\f]
+
+The functions norm return the calculated norm.
+
+When the mask parameter is specified and it is not empty, the norm is
+calculated only over the region specified by the mask.
+
+A multi-channel input arrays are treated as a single-channel, that is,
+the results for all channels are combined.
+
+@param src1 first input array.
+@param normType type of the norm (see cv::NormTypes).
+@param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type.
+*/
+CV_EXPORTS_W double norm(InputArray src1, int normType = NORM_L2, InputArray mask = noArray());
+
+/** @overload
+@param src1 first input array.
+@param src2 second input array of the same size and the same type as src1.
+@param normType type of the norm (cv::NormTypes).
+@param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type.
+*/
+CV_EXPORTS_W double norm(InputArray src1, InputArray src2,
+                         int normType = NORM_L2, InputArray mask = noArray());
+/** @overload
+@param src first input array.
+@param normType type of the norm (see cv::NormTypes).
+*/
+CV_EXPORTS double norm( const SparseMat& src, int normType );
+
+/** @brief computes PSNR image/video quality metric
+
+see http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio for details
+@todo document
+  */
+CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2);
+
+/** @brief naive nearest neighbor finder
+
+see http://en.wikipedia.org/wiki/Nearest_neighbor_search
+@todo document
+  */
+CV_EXPORTS_W void batchDistance(InputArray src1, InputArray src2,
+                                OutputArray dist, int dtype, OutputArray nidx,
+                                int normType = NORM_L2, int K = 0,
+                                InputArray mask = noArray(), int update = 0,
+                                bool crosscheck = false);
+
+/** @brief Normalizes the norm or value range of an array.
+
+The functions normalize scale and shift the input array elements so that
+\f[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\f]
+(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
+\f[\min _I  \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I  \texttt{dst} (I)= \texttt{beta}\f]
+
+when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
+normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
+sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
+min-max but modify the whole array, you can use norm and Mat::convertTo.
+
+In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
+the range transformation for sparse matrices is not allowed since it can shift the zero level.
+
+Possible usage with some positive example data:
+@code{.cpp}
+    vector<double> positiveData = { 2.0, 8.0, 10.0 };
+    vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
+
+    // Norm to probability (total count)
+    // sum(numbers) = 20.0
+    // 2.0      0.1     (2.0/20.0)
+    // 8.0      0.4     (8.0/20.0)
+    // 10.0     0.5     (10.0/20.0)
+    normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
+
+    // Norm to unit vector: ||positiveData|| = 1.0
+    // 2.0      0.15
+    // 8.0      0.62
+    // 10.0     0.77
+    normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
+
+    // Norm to max element
+    // 2.0      0.2     (2.0/10.0)
+    // 8.0      0.8     (8.0/10.0)
+    // 10.0     1.0     (10.0/10.0)
+    normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
+
+    // Norm to range [0.0;1.0]
+    // 2.0      0.0     (shift to left border)
+    // 8.0      0.75    (6.0/8.0)
+    // 10.0     1.0     (shift to right border)
+    normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
+@endcode
+
+@param src input array.
+@param dst output array of the same size as src .
+@param alpha norm value to normalize to or the lower range boundary in case of the range
+normalization.
+@param beta upper range boundary in case of the range normalization; it is not used for the norm
+normalization.
+@param norm_type normalization type (see cv::NormTypes).
+@param dtype when negative, the output array has the same type as src; otherwise, it has the same
+number of channels as src and the depth =CV_MAT_DEPTH(dtype).
+@param mask optional operation mask.
+@sa norm, Mat::convertTo, SparseMat::convertTo
+*/
+CV_EXPORTS_W void normalize( InputArray src, InputOutputArray dst, double alpha = 1, double beta = 0,
+                             int norm_type = NORM_L2, int dtype = -1, InputArray mask = noArray());
+
+/** @overload
+@param src input array.
+@param dst output array of the same size as src .
+@param alpha norm value to normalize to or the lower range boundary in case of the range
+normalization.
+@param normType normalization type (see cv::NormTypes).
+*/
+CV_EXPORTS void normalize( const SparseMat& src, SparseMat& dst, double alpha, int normType );
+
+/** @brief Finds the global minimum and maximum in an array.
+
+The functions minMaxLoc find the minimum and maximum element values and their positions. The
+extremums are searched across the whole array or, if mask is not an empty array, in the specified
+array region.
+
+The functions do not work with multi-channel arrays. If you need to find minimum or maximum
+elements across all the channels, use Mat::reshape first to reinterpret the array as
+single-channel. Or you may extract the particular channel using either extractImageCOI , or
+mixChannels , or split .
+@param src input single-channel array.
+@param minVal pointer to the returned minimum value; NULL is used if not required.
+@param maxVal pointer to the returned maximum value; NULL is used if not required.
+@param minLoc pointer to the returned minimum location (in 2D case); NULL is used if not required.
+@param maxLoc pointer to the returned maximum location (in 2D case); NULL is used if not required.
+@param mask optional mask used to select a sub-array.
+@sa max, min, compare, inRange, extractImageCOI, mixChannels, split, Mat::reshape
+*/
+CV_EXPORTS_W void minMaxLoc(InputArray src, CV_OUT double* minVal,
+                            CV_OUT double* maxVal = 0, CV_OUT Point* minLoc = 0,
+                            CV_OUT Point* maxLoc = 0, InputArray mask = noArray());
+
+
+/** @brief Finds the global minimum and maximum in an array
+
+The function minMaxIdx finds the minimum and maximum element values and their positions. The
+extremums are searched across the whole array or, if mask is not an empty array, in the specified
+array region. The function does not work with multi-channel arrays. If you need to find minimum or
+maximum elements across all the channels, use Mat::reshape first to reinterpret the array as
+single-channel. Or you may extract the particular channel using either extractImageCOI , or
+mixChannels , or split . In case of a sparse matrix, the minimum is found among non-zero elements
+only.
+@note When minIdx is not NULL, it must have at least 2 elements (as well as maxIdx), even if src is
+a single-row or single-column matrix. In OpenCV (following MATLAB) each array has at least 2
+dimensions, i.e. single-column matrix is Mx1 matrix (and therefore minIdx/maxIdx will be
+(i1,0)/(i2,0)) and single-row matrix is 1xN matrix (and therefore minIdx/maxIdx will be
+(0,j1)/(0,j2)).
+@param src input single-channel array.
+@param minVal pointer to the returned minimum value; NULL is used if not required.
+@param maxVal pointer to the returned maximum value; NULL is used if not required.
+@param minIdx pointer to the returned minimum location (in nD case); NULL is used if not required;
+Otherwise, it must point to an array of src.dims elements, the coordinates of the minimum element
+in each dimension are stored there sequentially.
+@param maxIdx pointer to the returned maximum location (in nD case). NULL is used if not required.
+@param mask specified array region
+*/
+CV_EXPORTS void minMaxIdx(InputArray src, double* minVal, double* maxVal = 0,
+                          int* minIdx = 0, int* maxIdx = 0, InputArray mask = noArray());
+
+/** @overload
+@param a input single-channel array.
+@param minVal pointer to the returned minimum value; NULL is used if not required.
+@param maxVal pointer to the returned maximum value; NULL is used if not required.
+@param minIdx pointer to the returned minimum location (in nD case); NULL is used if not required;
+Otherwise, it must point to an array of src.dims elements, the coordinates of the minimum element
+in each dimension are stored there sequentially.
+@param maxIdx pointer to the returned maximum location (in nD case). NULL is used if not required.
+*/
+CV_EXPORTS void minMaxLoc(const SparseMat& a, double* minVal,
+                          double* maxVal, int* minIdx = 0, int* maxIdx = 0);
+
+/** @brief Reduces a matrix to a vector.
+
+The function reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of
+1D vectors and performing the specified operation on the vectors until a single row/column is
+obtained. For example, the function can be used to compute horizontal and vertical projections of a
+raster image. In case of REDUCE_SUM and REDUCE_AVG , the output may have a larger element
+bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction
+modes.
+@param src input 2D matrix.
+@param dst output vector. Its size and type is defined by dim and dtype parameters.
+@param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to
+a single row. 1 means that the matrix is reduced to a single column.
+@param rtype reduction operation that could be one of cv::ReduceTypes
+@param dtype when negative, the output vector will have the same type as the input matrix,
+otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).
+@sa repeat
+*/
+CV_EXPORTS_W void reduce(InputArray src, OutputArray dst, int dim, int rtype, int dtype = -1);
+
+/** @brief Creates one multi-channel array out of several single-channel ones.
+
+The function merge merges several arrays to make a single multi-channel array. That is, each
+element of the output array will be a concatenation of the elements of the input arrays, where
+elements of i-th input array are treated as mv[i].channels()-element vectors.
+
+The function cv::split does the reverse operation. If you need to shuffle channels in some other
+advanced way, use cv::mixChannels.
+@param mv input array of matrices to be merged; all the matrices in mv must have the same
+size and the same depth.
+@param count number of input matrices when mv is a plain C array; it must be greater than zero.
+@param dst output array of the same size and the same depth as mv[0]; The number of channels will
+be equal to the parameter count.
+@sa  mixChannels, split, Mat::reshape
+*/
+CV_EXPORTS void merge(const Mat* mv, size_t count, OutputArray dst);
+
+/** @overload
+@param mv input vector of matrices to be merged; all the matrices in mv must have the same
+size and the same depth.
+@param dst output array of the same size and the same depth as mv[0]; The number of channels will
+be the total number of channels in the matrix array.
+  */
+CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst);
+
+/** @brief Divides a multi-channel array into several single-channel arrays.
+
+The functions split split a multi-channel array into separate single-channel arrays:
+\f[\texttt{mv} [c](I) =  \texttt{src} (I)_c\f]
+If you need to extract a single channel or do some other sophisticated channel permutation, use
+mixChannels .
+@param src input multi-channel array.
+@param mvbegin output array; the number of arrays must match src.channels(); the arrays themselves are
+reallocated, if needed.
+@sa merge, mixChannels, cvtColor
+*/
+CV_EXPORTS void split(const Mat& src, Mat* mvbegin);
+
+/** @overload
+@param m input multi-channel array.
+@param mv output vector of arrays; the arrays themselves are reallocated, if needed.
+*/
+CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv);
+
+/** @brief Copies specified channels from input arrays to the specified channels of
+output arrays.
+
+The function cv::mixChannels provides an advanced mechanism for shuffling image channels.
+
+cv::split and cv::merge and some forms of cv::cvtColor are partial cases of cv::mixChannels .
+
+In the example below, the code splits a 4-channel BGRA image into a 3-channel BGR (with B and R
+channels swapped) and a separate alpha-channel image:
+@code{.cpp}
+    Mat bgra( 100, 100, CV_8UC4, Scalar(255,0,0,255) );
+    Mat bgr( bgra.rows, bgra.cols, CV_8UC3 );
+    Mat alpha( bgra.rows, bgra.cols, CV_8UC1 );
+
+    // forming an array of matrices is a quite efficient operation,
+    // because the matrix data is not copied, only the headers
+    Mat out[] = { bgr, alpha };
+    // bgra[0] -> bgr[2], bgra[1] -> bgr[1],
+    // bgra[2] -> bgr[0], bgra[3] -> alpha[0]
+    int from_to[] = { 0,2, 1,1, 2,0, 3,3 };
+    mixChannels( &bgra, 1, out, 2, from_to, 4 );
+@endcode
+@note Unlike many other new-style C++ functions in OpenCV (see the introduction section and
+Mat::create ), cv::mixChannels requires the output arrays to be pre-allocated before calling the
+function.
+@param src input array or vector of matrices; all of the matrices must have the same size and the
+same depth.
+@param nsrcs number of matrices in `src`.
+@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and
+depth must be the same as in `src[0]`.
+@param ndsts number of matrices in `dst`.
+@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is
+a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
+dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
+src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
+src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
+channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
+filled with zero .
+@param npairs number of index pairs in `fromTo`.
+@sa cv::split, cv::merge, cv::cvtColor
+*/
+CV_EXPORTS void mixChannels(const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts,
+                            const int* fromTo, size_t npairs);
+
+/** @overload
+@param src input array or vector of matrices; all of the matrices must have the same size and the
+same depth.
+@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and
+depth must be the same as in src[0].
+@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is
+a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
+dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
+src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
+src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
+channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
+filled with zero .
+@param npairs number of index pairs in fromTo.
+*/
+CV_EXPORTS void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
+                            const int* fromTo, size_t npairs);
+
+/** @overload
+@param src input array or vector of matrices; all of the matrices must have the same size and the
+same depth.
+@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and
+depth must be the same as in src[0].
+@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is
+a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
+dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
+src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
+src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
+channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
+filled with zero .
+*/
+CV_EXPORTS_W void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
+                              const std::vector<int>& fromTo);
+
+/** @brief extracts a single channel from src (coi is 0-based index)
+@todo document
+*/
+CV_EXPORTS_W void extractChannel(InputArray src, OutputArray dst, int coi);
+
+/** @brief inserts a single channel to dst (coi is 0-based index)
+@todo document
+*/
+CV_EXPORTS_W void insertChannel(InputArray src, InputOutputArray dst, int coi);
+
+/** @brief Flips a 2D array around vertical, horizontal, or both axes.
+
+The function flip flips the array in one of three different ways (row
+and column indices are 0-based):
+\f[\texttt{dst} _{ij} =
+\left\{
+\begin{array}{l l}
+\texttt{src} _{\texttt{src.rows}-i-1,j} & if\;  \texttt{flipCode} = 0 \\
+\texttt{src} _{i, \texttt{src.cols} -j-1} & if\;  \texttt{flipCode} > 0 \\
+\texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\
+\end{array}
+\right.\f]
+The example scenarios of using the function are the following:
+*   Vertical flipping of the image (flipCode == 0) to switch between
+    top-left and bottom-left image origin. This is a typical operation
+    in video processing on Microsoft Windows\* OS.
+*   Horizontal flipping of the image with the subsequent horizontal
+    shift and absolute difference calculation to check for a
+    vertical-axis symmetry (flipCode \> 0).
+*   Simultaneous horizontal and vertical flipping of the image with
+    the subsequent shift and absolute difference calculation to check
+    for a central symmetry (flipCode \< 0).
+*   Reversing the order of point arrays (flipCode \> 0 or
+    flipCode == 0).
+@param src input array.
+@param dst output array of the same size and type as src.
+@param flipCode a flag to specify how to flip the array; 0 means
+flipping around the x-axis and positive value (for example, 1) means
+flipping around y-axis. Negative value (for example, -1) means flipping
+around both axes.
+@sa transpose , repeat , completeSymm
+*/
+CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
+
+/** @brief Fills the output array with repeated copies of the input array.
+
+The functions repeat duplicate the input array one or more times along each of the two axes:
+\f[\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }\f]
+The second variant of the function is more convenient to use with @ref MatrixExpressions.
+@param src input array to replicate.
+@param dst output array of the same type as src.
+@param ny Flag to specify how many times the src is repeated along the
+vertical axis.
+@param nx Flag to specify how many times the src is repeated along the
+horizontal axis.
+@sa reduce
+*/
+CV_EXPORTS_W void repeat(InputArray src, int ny, int nx, OutputArray dst);
+
+/** @overload
+@param src input array to replicate.
+@param ny Flag to specify how many times the src is repeated along the
+vertical axis.
+@param nx Flag to specify how many times the src is repeated along the
+horizontal axis.
+  */
+CV_EXPORTS Mat repeat(const Mat& src, int ny, int nx);
+
+/** @brief Applies horizontal concatenation to given matrices.
+
+The function horizontally concatenates two or more cv::Mat matrices (with the same number of rows).
+@code{.cpp}
+    cv::Mat matArray[] = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
+                           cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
+                           cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
+
+    cv::Mat out;
+    cv::hconcat( matArray, 3, out );
+    //out:
+    //[1, 2, 3;
+    // 1, 2, 3;
+    // 1, 2, 3;
+    // 1, 2, 3]
+@endcode
+@param src input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.
+@param nsrc number of matrices in src.
+@param dst output array. It has the same number of rows and depth as the src, and the sum of cols of the src.
+@sa cv::vconcat(const Mat*, size_t, OutputArray), @sa cv::vconcat(InputArrayOfArrays, OutputArray) and @sa cv::vconcat(InputArray, InputArray, OutputArray)
+*/
+CV_EXPORTS void hconcat(const Mat* src, size_t nsrc, OutputArray dst);
+/** @overload
+ @code{.cpp}
+    cv::Mat_<float> A = (cv::Mat_<float>(3, 2) << 1, 4,
+                                                  2, 5,
+                                                  3, 6);
+    cv::Mat_<float> B = (cv::Mat_<float>(3, 2) << 7, 10,
+                                                  8, 11,
+                                                  9, 12);
+
+    cv::Mat C;
+    cv::hconcat(A, B, C);
+    //C:
+    //[1, 4, 7, 10;
+    // 2, 5, 8, 11;
+    // 3, 6, 9, 12]
+ @endcode
+ @param src1 first input array to be considered for horizontal concatenation.
+ @param src2 second input array to be considered for horizontal concatenation.
+ @param dst output array. It has the same number of rows and depth as the src1 and src2, and the sum of cols of the src1 and src2.
+ */
+CV_EXPORTS void hconcat(InputArray src1, InputArray src2, OutputArray dst);
+/** @overload
+ @code{.cpp}
+    std::vector<cv::Mat> matrices = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
+                                      cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
+                                      cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
+
+    cv::Mat out;
+    cv::hconcat( matrices, out );
+    //out:
+    //[1, 2, 3;
+    // 1, 2, 3;
+    // 1, 2, 3;
+    // 1, 2, 3]
+ @endcode
+ @param src input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.
+ @param dst output array. It has the same number of rows and depth as the src, and the sum of cols of the src.
+same depth.
+ */
+CV_EXPORTS_W void hconcat(InputArrayOfArrays src, OutputArray dst);
+
+/** @brief Applies vertical concatenation to given matrices.
+
+The function vertically concatenates two or more cv::Mat matrices (with the same number of cols).
+@code{.cpp}
+    cv::Mat matArray[] = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)),
+                           cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)),
+                           cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),};
+
+    cv::Mat out;
+    cv::vconcat( matArray, 3, out );
+    //out:
+    //[1,   1,   1,   1;
+    // 2,   2,   2,   2;
+    // 3,   3,   3,   3]
+@endcode
+@param src input array or vector of matrices. all of the matrices must have the same number of cols and the same depth.
+@param nsrc number of matrices in src.
+@param dst output array. It has the same number of cols and depth as the src, and the sum of rows of the src.
+@sa cv::hconcat(const Mat*, size_t, OutputArray), @sa cv::hconcat(InputArrayOfArrays, OutputArray) and @sa cv::hconcat(InputArray, InputArray, OutputArray)
+*/
+CV_EXPORTS void vconcat(const Mat* src, size_t nsrc, OutputArray dst);
+/** @overload
+ @code{.cpp}
+    cv::Mat_<float> A = (cv::Mat_<float>(3, 2) << 1, 7,
+                                                  2, 8,
+                                                  3, 9);
+    cv::Mat_<float> B = (cv::Mat_<float>(3, 2) << 4, 10,
+                                                  5, 11,
+                                                  6, 12);
+
+    cv::Mat C;
+    cv::vconcat(A, B, C);
+    //C:
+    //[1, 7;
+    // 2, 8;
+    // 3, 9;
+    // 4, 10;
+    // 5, 11;
+    // 6, 12]
+ @endcode
+ @param src1 first input array to be considered for vertical concatenation.
+ @param src2 second input array to be considered for vertical concatenation.
+ @param dst output array. It has the same number of cols and depth as the src1 and src2, and the sum of rows of the src1 and src2.
+ */
+CV_EXPORTS void vconcat(InputArray src1, InputArray src2, OutputArray dst);
+/** @overload
+ @code{.cpp}
+    std::vector<cv::Mat> matrices = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)),
+                                      cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)),
+                                      cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),};
+
+    cv::Mat out;
+    cv::vconcat( matrices, out );
+    //out:
+    //[1,   1,   1,   1;
+    // 2,   2,   2,   2;
+    // 3,   3,   3,   3]
+ @endcode
+ @param src input array or vector of matrices. all of the matrices must have the same number of cols and the same depth
+ @param dst output array. It has the same number of cols and depth as the src, and the sum of rows of the src.
+same depth.
+ */
+CV_EXPORTS_W void vconcat(InputArrayOfArrays src, OutputArray dst);
+
+/** @brief computes bitwise conjunction of the two arrays (dst = src1 & src2)
+Calculates the per-element bit-wise conjunction of two arrays or an
+array and a scalar.
+
+The function calculates the per-element bit-wise logical conjunction for:
+*   Two arrays when src1 and src2 have the same size:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+*   An array and a scalar when src2 is constructed from Scalar or has
+    the same number of elements as `src1.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \wedge \texttt{src2} \quad \texttt{if mask} (I) \ne0\f]
+*   A scalar and an array when src1 is constructed from Scalar or has
+    the same number of elements as `src2.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1}  \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+In case of floating-point arrays, their machine-specific bit
+representations (usually IEEE754-compliant) are used for the operation.
+In case of multi-channel arrays, each channel is processed
+independently. In the second and third cases above, the scalar is first
+converted to the array type.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and type as the input
+arrays.
+@param mask optional operation mask, 8-bit single channel array, that
+specifies elements of the output array to be changed.
+*/
+CV_EXPORTS_W void bitwise_and(InputArray src1, InputArray src2,
+                              OutputArray dst, InputArray mask = noArray());
+
+/** @brief Calculates the per-element bit-wise disjunction of two arrays or an
+array and a scalar.
+
+The function calculates the per-element bit-wise logical disjunction for:
+*   Two arrays when src1 and src2 have the same size:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+*   An array and a scalar when src2 is constructed from Scalar or has
+    the same number of elements as `src1.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \vee \texttt{src2} \quad \texttt{if mask} (I) \ne0\f]
+*   A scalar and an array when src1 is constructed from Scalar or has
+    the same number of elements as `src2.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1}  \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+In case of floating-point arrays, their machine-specific bit
+representations (usually IEEE754-compliant) are used for the operation.
+In case of multi-channel arrays, each channel is processed
+independently. In the second and third cases above, the scalar is first
+converted to the array type.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and type as the input
+arrays.
+@param mask optional operation mask, 8-bit single channel array, that
+specifies elements of the output array to be changed.
+*/
+CV_EXPORTS_W void bitwise_or(InputArray src1, InputArray src2,
+                             OutputArray dst, InputArray mask = noArray());
+
+/** @brief Calculates the per-element bit-wise "exclusive or" operation on two
+arrays or an array and a scalar.
+
+The function calculates the per-element bit-wise logical "exclusive-or"
+operation for:
+*   Two arrays when src1 and src2 have the same size:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+*   An array and a scalar when src2 is constructed from Scalar or has
+    the same number of elements as `src1.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \oplus \texttt{src2} \quad \texttt{if mask} (I) \ne0\f]
+*   A scalar and an array when src1 is constructed from Scalar or has
+    the same number of elements as `src2.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1}  \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+In case of floating-point arrays, their machine-specific bit
+representations (usually IEEE754-compliant) are used for the operation.
+In case of multi-channel arrays, each channel is processed
+independently. In the 2nd and 3rd cases above, the scalar is first
+converted to the array type.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and type as the input
+arrays.
+@param mask optional operation mask, 8-bit single channel array, that
+specifies elements of the output array to be changed.
+*/
+CV_EXPORTS_W void bitwise_xor(InputArray src1, InputArray src2,
+                              OutputArray dst, InputArray mask = noArray());
+
+/** @brief  Inverts every bit of an array.
+
+The function calculates per-element bit-wise inversion of the input
+array:
+\f[\texttt{dst} (I) =  \neg \texttt{src} (I)\f]
+In case of a floating-point input array, its machine-specific bit
+representation (usually IEEE754-compliant) is used for the operation. In
+case of multi-channel arrays, each channel is processed independently.
+@param src input array.
+@param dst output array that has the same size and type as the input
+array.
+@param mask optional operation mask, 8-bit single channel array, that
+specifies elements of the output array to be changed.
+*/
+CV_EXPORTS_W void bitwise_not(InputArray src, OutputArray dst,
+                              InputArray mask = noArray());
+
+/** @brief Calculates the per-element absolute difference between two arrays or between an array and a scalar.
+
+The function absdiff calculates:
+*   Absolute difference between two arrays when they have the same
+    size and type:
+    \f[\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1}(I) -  \texttt{src2}(I)|)\f]
+*   Absolute difference between an array and a scalar when the second
+    array is constructed from Scalar or has as many elements as the
+    number of channels in `src1`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1}(I) -  \texttt{src2} |)\f]
+*   Absolute difference between a scalar and an array when the first
+    array is constructed from Scalar or has as many elements as the
+    number of channels in `src2`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1} -  \texttt{src2}(I) |)\f]
+    where I is a multi-dimensional index of array elements. In case of
+    multi-channel arrays, each channel is processed independently.
+@note Saturation is not applied when the arrays have the depth CV_32S.
+You may even get a negative value in the case of overflow.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and type as input arrays.
+@sa cv::abs(const Mat&)
+*/
+CV_EXPORTS_W void absdiff(InputArray src1, InputArray src2, OutputArray dst);
+
+/** @brief  Checks if array elements lie between the elements of two other arrays.
+
+The function checks the range as follows:
+-   For every element of a single-channel input array:
+    \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0  \leq \texttt{src} (I)_0 \leq  \texttt{upperb} (I)_0\f]
+-   For two-channel arrays:
+    \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0  \leq \texttt{src} (I)_0 \leq  \texttt{upperb} (I)_0  \land \texttt{lowerb} (I)_1  \leq \texttt{src} (I)_1 \leq  \texttt{upperb} (I)_1\f]
+-   and so forth.
+
+That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the
+specified 1D, 2D, 3D, ... box and 0 otherwise.
+
+When the lower and/or upper boundary parameters are scalars, the indexes
+(I) at lowerb and upperb in the above formulas should be omitted.
+@param src first input array.
+@param lowerb inclusive lower boundary array or a scalar.
+@param upperb inclusive upper boundary array or a scalar.
+@param dst output array of the same size as src and CV_8U type.
+*/
+CV_EXPORTS_W void inRange(InputArray src, InputArray lowerb,
+                          InputArray upperb, OutputArray dst);
+
+/** @brief Performs the per-element comparison of two arrays or an array and scalar value.
+
+The function compares:
+*   Elements of two arrays when src1 and src2 have the same size:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \,\texttt{cmpop}\, \texttt{src2} (I)\f]
+*   Elements of src1 with a scalar src2 when src2 is constructed from
+    Scalar or has a single element:
+    \f[\texttt{dst} (I) =  \texttt{src1}(I) \,\texttt{cmpop}\,  \texttt{src2}\f]
+*   src1 with elements of src2 when src1 is constructed from Scalar or
+    has a single element:
+    \f[\texttt{dst} (I) =  \texttt{src1}  \,\texttt{cmpop}\, \texttt{src2} (I)\f]
+When the comparison result is true, the corresponding element of output
+array is set to 255. The comparison operations can be replaced with the
+equivalent matrix expressions:
+@code{.cpp}
+    Mat dst1 = src1 >= src2;
+    Mat dst2 = src1 < 8;
+    ...
+@endcode
+@param src1 first input array or a scalar; when it is an array, it must have a single channel.
+@param src2 second input array or a scalar; when it is an array, it must have a single channel.
+@param dst output array of type ref CV_8U that has the same size and the same number of channels as
+    the input arrays.
+@param cmpop a flag, that specifies correspondence between the arrays (cv::CmpTypes)
+@sa checkRange, min, max, threshold
+*/
+CV_EXPORTS_W void compare(InputArray src1, InputArray src2, OutputArray dst, int cmpop);
+
+/** @brief Calculates per-element minimum of two arrays or an array and a scalar.
+
+The functions min calculate the per-element minimum of two arrays:
+\f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\f]
+or array and a scalar:
+\f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\f]
+@param src1 first input array.
+@param src2 second input array of the same size and type as src1.
+@param dst output array of the same size and type as src1.
+@sa max, compare, inRange, minMaxLoc
+*/
+CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray dst);
+/** @overload
+needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
+*/
+CV_EXPORTS void min(const Mat& src1, const Mat& src2, Mat& dst);
+/** @overload
+needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
+*/
+CV_EXPORTS void min(const UMat& src1, const UMat& src2, UMat& dst);
+
+/** @brief Calculates per-element maximum of two arrays or an array and a scalar.
+
+The functions max calculate the per-element maximum of two arrays:
+\f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\f]
+or array and a scalar:
+\f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\f]
+@param src1 first input array.
+@param src2 second input array of the same size and type as src1 .
+@param dst output array of the same size and type as src1.
+@sa  min, compare, inRange, minMaxLoc, @ref MatrixExpressions
+*/
+CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst);
+/** @overload
+needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
+*/
+CV_EXPORTS void max(const Mat& src1, const Mat& src2, Mat& dst);
+/** @overload
+needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
+*/
+CV_EXPORTS void max(const UMat& src1, const UMat& src2, UMat& dst);
+
+/** @brief Calculates a square root of array elements.
+
+The functions sqrt calculate a square root of each input array element.
+In case of multi-channel arrays, each channel is processed
+independently. The accuracy is approximately the same as of the built-in
+std::sqrt .
+@param src input floating-point array.
+@param dst output array of the same size and type as src.
+*/
+CV_EXPORTS_W void sqrt(InputArray src, OutputArray dst);
+
+/** @brief Raises every array element to a power.
+
+The function pow raises every element of the input array to power :
+\f[\texttt{dst} (I) =  \fork{\texttt{src}(I)^{power}}{if \(\texttt{power}\) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\f]
+
+So, for a non-integer power exponent, the absolute values of input array
+elements are used. However, it is possible to get true values for
+negative values using some extra operations. In the example below,
+computing the 5th root of array src shows:
+@code{.cpp}
+    Mat mask = src < 0;
+    pow(src, 1./5, dst);
+    subtract(Scalar::all(0), dst, dst, mask);
+@endcode
+For some values of power, such as integer values, 0.5 and -0.5,
+specialized faster algorithms are used.
+
+Special values (NaN, Inf) are not handled.
+@param src input array.
+@param power exponent of power.
+@param dst output array of the same size and type as src.
+@sa sqrt, exp, log, cartToPolar, polarToCart
+*/
+CV_EXPORTS_W void pow(InputArray src, double power, OutputArray dst);
+
+/** @brief Calculates the exponent of every array element.
+
+The function exp calculates the exponent of every element of the input
+array:
+\f[\texttt{dst} [I] = e^{ src(I) }\f]
+
+The maximum relative error is about 7e-6 for single-precision input and
+less than 1e-10 for double-precision input. Currently, the function
+converts denormalized values to zeros on output. Special values (NaN,
+Inf) are not handled.
+@param src input array.
+@param dst output array of the same size and type as src.
+@sa log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude
+*/
+CV_EXPORTS_W void exp(InputArray src, OutputArray dst);
+
+/** @brief Calculates the natural logarithm of every array element.
+
+The function log calculates the natural logarithm of the absolute value
+of every element of the input array:
+\f[\texttt{dst} (I) =  \fork{\log |\texttt{src}(I)|}{if \(\texttt{src}(I) \ne 0\) }{\texttt{C}}{otherwise}\f]
+
+where C is a large negative number (about -700 in the current
+implementation). The maximum relative error is about 7e-6 for
+single-precision input and less than 1e-10 for double-precision input.
+Special values (NaN, Inf) are not handled.
+@param src input array.
+@param dst output array of the same size and type as src .
+@sa exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude
+*/
+CV_EXPORTS_W void log(InputArray src, OutputArray dst);
+
+/** @brief Calculates x and y coordinates of 2D vectors from their magnitude and angle.
+
+The function polarToCart calculates the Cartesian coordinates of each 2D
+vector represented by the corresponding elements of magnitude and angle:
+\f[\begin{array}{l} \texttt{x} (I) =  \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) =  \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\f]
+
+The relative accuracy of the estimated coordinates is about 1e-6.
+@param magnitude input floating-point array of magnitudes of 2D vectors;
+it can be an empty matrix (=Mat()), in this case, the function assumes
+that all the magnitudes are =1; if it is not empty, it must have the
+same size and type as angle.
+@param angle input floating-point array of angles of 2D vectors.
+@param x output array of x-coordinates of 2D vectors; it has the same
+size and type as angle.
+@param y output array of y-coordinates of 2D vectors; it has the same
+size and type as angle.
+@param angleInDegrees when true, the input angles are measured in
+degrees, otherwise, they are measured in radians.
+@sa cartToPolar, magnitude, phase, exp, log, pow, sqrt
+*/
+CV_EXPORTS_W void polarToCart(InputArray magnitude, InputArray angle,
+                              OutputArray x, OutputArray y, bool angleInDegrees = false);
+
+/** @brief Calculates the magnitude and angle of 2D vectors.
+
+The function cartToPolar calculates either the magnitude, angle, or both
+for every 2D vector (x(I),y(I)):
+\f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f]
+
+The angles are calculated with accuracy about 0.3 degrees. For the point
+(0,0), the angle is set to 0.
+@param x array of x-coordinates; this must be a single-precision or
+double-precision floating-point array.
+@param y array of y-coordinates, that must have the same size and same type as x.
+@param magnitude output array of magnitudes of the same size and type as x.
+@param angle output array of angles that has the same size and type as
+x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees).
+@param angleInDegrees a flag, indicating whether the angles are measured
+in radians (which is by default), or in degrees.
+@sa Sobel, Scharr
+*/
+CV_EXPORTS_W void cartToPolar(InputArray x, InputArray y,
+                              OutputArray magnitude, OutputArray angle,
+                              bool angleInDegrees = false);
+
+/** @brief Calculates the rotation angle of 2D vectors.
+
+The function phase calculates the rotation angle of each 2D vector that
+is formed from the corresponding elements of x and y :
+\f[\texttt{angle} (I) =  \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\f]
+
+The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 ,
+the corresponding angle(I) is set to 0.
+@param x input floating-point array of x-coordinates of 2D vectors.
+@param y input array of y-coordinates of 2D vectors; it must have the
+same size and the same type as x.
+@param angle output array of vector angles; it has the same size and
+same type as x .
+@param angleInDegrees when true, the function calculates the angle in
+degrees, otherwise, they are measured in radians.
+*/
+CV_EXPORTS_W void phase(InputArray x, InputArray y, OutputArray angle,
+                        bool angleInDegrees = false);
+
+/** @brief Calculates the magnitude of 2D vectors.
+
+The function magnitude calculates the magnitude of 2D vectors formed
+from the corresponding elements of x and y arrays:
+\f[\texttt{dst} (I) =  \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\f]
+@param x floating-point array of x-coordinates of the vectors.
+@param y floating-point array of y-coordinates of the vectors; it must
+have the same size as x.
+@param magnitude output array of the same size and type as x.
+@sa cartToPolar, polarToCart, phase, sqrt
+*/
+CV_EXPORTS_W void magnitude(InputArray x, InputArray y, OutputArray magnitude);
+
+/** @brief Checks every element of an input array for invalid values.
+
+The functions checkRange check that every array element is neither NaN nor infinite. When minVal \>
+-DBL_MAX and maxVal \< DBL_MAX, the functions also check that each value is between minVal and
+maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
+are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
+functions either return false (when quiet=true) or throw an exception.
+@param a input array.
+@param quiet a flag, indicating whether the functions quietly return false when the array elements
+are out of range or they throw an exception.
+@param pos optional output parameter, when not NULL, must be a pointer to array of src.dims
+elements.
+@param minVal inclusive lower boundary of valid values range.
+@param maxVal exclusive upper boundary of valid values range.
+*/
+CV_EXPORTS_W bool checkRange(InputArray a, bool quiet = true, CV_OUT Point* pos = 0,
+                            double minVal = -DBL_MAX, double maxVal = DBL_MAX);
+
+/** @brief converts NaN's to the given number
+*/
+CV_EXPORTS_W void patchNaNs(InputOutputArray a, double val = 0);
+
+/** @brief Performs generalized matrix multiplication.
+
+The function performs generalized matrix multiplication similar to the
+gemm functions in BLAS level 3. For example,
+`gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)`
+corresponds to
+\f[\texttt{dst} =  \texttt{alpha} \cdot \texttt{src1} ^T  \cdot \texttt{src2} +  \texttt{beta} \cdot \texttt{src3} ^T\f]
+
+In case of complex (two-channel) data, performed a complex matrix
+multiplication.
+
+The function can be replaced with a matrix expression. For example, the
+above call can be replaced with:
+@code{.cpp}
+    dst = alpha*src1.t()*src2 + beta*src3.t();
+@endcode
+@param src1 first multiplied input matrix that could be real(CV_32FC1,
+CV_64FC1) or complex(CV_32FC2, CV_64FC2).
+@param src2 second multiplied input matrix of the same type as src1.
+@param alpha weight of the matrix product.
+@param src3 third optional delta matrix added to the matrix product; it
+should have the same type as src1 and src2.
+@param beta weight of src3.
+@param dst output matrix; it has the proper size and the same type as
+input matrices.
+@param flags operation flags (cv::GemmFlags)
+@sa mulTransposed , transform
+*/
+CV_EXPORTS_W void gemm(InputArray src1, InputArray src2, double alpha,
+                       InputArray src3, double beta, OutputArray dst, int flags = 0);
+
+/** @brief Calculates the product of a matrix and its transposition.
+
+The function mulTransposed calculates the product of src and its
+transposition:
+\f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\f]
+if aTa=true , and
+\f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\f]
+otherwise. The function is used to calculate the covariance matrix. With
+zero delta, it can be used as a faster substitute for general matrix
+product A\*B when B=A'
+@param src input single-channel matrix. Note that unlike gemm, the
+function can multiply not only floating-point matrices.
+@param dst output square matrix.
+@param aTa Flag specifying the multiplication ordering. See the
+description below.
+@param delta Optional delta matrix subtracted from src before the
+multiplication. When the matrix is empty ( delta=noArray() ), it is
+assumed to be zero, that is, nothing is subtracted. If it has the same
+size as src , it is simply subtracted. Otherwise, it is "repeated" (see
+repeat ) to cover the full src and then subtracted. Type of the delta
+matrix, when it is not empty, must be the same as the type of created
+output matrix. See the dtype parameter description below.
+@param scale Optional scale factor for the matrix product.
+@param dtype Optional type of the output matrix. When it is negative,
+the output matrix will have the same type as src . Otherwise, it will be
+type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
+@sa calcCovarMatrix, gemm, repeat, reduce
+*/
+CV_EXPORTS_W void mulTransposed( InputArray src, OutputArray dst, bool aTa,
+                                 InputArray delta = noArray(),
+                                 double scale = 1, int dtype = -1 );
+
+/** @brief Transposes a matrix.
+
+The function transpose transposes the matrix src :
+\f[\texttt{dst} (i,j) =  \texttt{src} (j,i)\f]
+@note No complex conjugation is done in case of a complex matrix. It it
+should be done separately if needed.
+@param src input array.
+@param dst output array of the same type as src.
+*/
+CV_EXPORTS_W void transpose(InputArray src, OutputArray dst);
+
+/** @brief Performs the matrix transformation of every array element.
+
+The function transform performs the matrix transformation of every
+element of the array src and stores the results in dst :
+\f[\texttt{dst} (I) =  \texttt{m} \cdot \texttt{src} (I)\f]
+(when m.cols=src.channels() ), or
+\f[\texttt{dst} (I) =  \texttt{m} \cdot [ \texttt{src} (I); 1]\f]
+(when m.cols=src.channels()+1 )
+
+Every element of the N -channel array src is interpreted as N -element
+vector that is transformed using the M x N or M x (N+1) matrix m to
+M-element vector - the corresponding element of the output array dst .
+
+The function may be used for geometrical transformation of
+N -dimensional points, arbitrary linear color space transformation (such
+as various kinds of RGB to YUV transforms), shuffling the image
+channels, and so forth.
+@param src input array that must have as many channels (1 to 4) as
+m.cols or m.cols-1.
+@param dst output array of the same size and depth as src; it has as
+many channels as m.rows.
+@param m transformation 2x2 or 2x3 floating-point matrix.
+@sa perspectiveTransform, getAffineTransform, estimateRigidTransform, warpAffine, warpPerspective
+*/
+CV_EXPORTS_W void transform(InputArray src, OutputArray dst, InputArray m );
+
+/** @brief Performs the perspective matrix transformation of vectors.
+
+The function perspectiveTransform transforms every element of src by
+treating it as a 2D or 3D vector, in the following way:
+\f[(x, y, z)  \rightarrow (x'/w, y'/w, z'/w)\f]
+where
+\f[(x', y', z', w') =  \texttt{mat} \cdot \begin{bmatrix} x & y & z & 1  \end{bmatrix}\f]
+and
+\f[w =  \fork{w'}{if \(w' \ne 0\)}{\infty}{otherwise}\f]
+
+Here a 3D vector transformation is shown. In case of a 2D vector
+transformation, the z component is omitted.
+
+@note The function transforms a sparse set of 2D or 3D vectors. If you
+want to transform an image using perspective transformation, use
+warpPerspective . If you have an inverse problem, that is, you want to
+compute the most probable perspective transformation out of several
+pairs of corresponding points, you can use getPerspectiveTransform or
+findHomography .
+@param src input two-channel or three-channel floating-point array; each
+element is a 2D/3D vector to be transformed.
+@param dst output array of the same size and type as src.
+@param m 3x3 or 4x4 floating-point transformation matrix.
+@sa  transform, warpPerspective, getPerspectiveTransform, findHomography
+*/
+CV_EXPORTS_W void perspectiveTransform(InputArray src, OutputArray dst, InputArray m );
+
+/** @brief Copies the lower or the upper half of a square matrix to another half.
+
+The function completeSymm copies the lower half of a square matrix to
+its another half. The matrix diagonal remains unchanged:
+*   \f$\texttt{mtx}_{ij}=\texttt{mtx}_{ji}\f$ for \f$i > j\f$ if
+    lowerToUpper=false
+*   \f$\texttt{mtx}_{ij}=\texttt{mtx}_{ji}\f$ for \f$i < j\f$ if
+    lowerToUpper=true
+@param mtx input-output floating-point square matrix.
+@param lowerToUpper operation flag; if true, the lower half is copied to
+the upper half. Otherwise, the upper half is copied to the lower half.
+@sa flip, transpose
+*/
+CV_EXPORTS_W void completeSymm(InputOutputArray mtx, bool lowerToUpper = false);
+
+/** @brief Initializes a scaled identity matrix.
+
+The function setIdentity initializes a scaled identity matrix:
+\f[\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if \(i=j\)}{0}{otherwise}\f]
+
+The function can also be emulated using the matrix initializers and the
+matrix expressions:
+@code
+    Mat A = Mat::eye(4, 3, CV_32F)*5;
+    // A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]
+@endcode
+@param mtx matrix to initialize (not necessarily square).
+@param s value to assign to diagonal elements.
+@sa Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=
+*/
+CV_EXPORTS_W void setIdentity(InputOutputArray mtx, const Scalar& s = Scalar(1));
+
+/** @brief Returns the determinant of a square floating-point matrix.
+
+The function determinant calculates and returns the determinant of the
+specified matrix. For small matrices ( mtx.cols=mtx.rows\<=3 ), the
+direct method is used. For larger matrices, the function uses LU
+factorization with partial pivoting.
+
+For symmetric positively-determined matrices, it is also possible to use
+eigen decomposition to calculate the determinant.
+@param mtx input matrix that must have CV_32FC1 or CV_64FC1 type and
+square size.
+@sa trace, invert, solve, eigen, @ref MatrixExpressions
+*/
+CV_EXPORTS_W double determinant(InputArray mtx);
+
+/** @brief Returns the trace of a matrix.
+
+The function trace returns the sum of the diagonal elements of the
+matrix mtx .
+\f[\mathrm{tr} ( \texttt{mtx} ) =  \sum _i  \texttt{mtx} (i,i)\f]
+@param mtx input matrix.
+*/
+CV_EXPORTS_W Scalar trace(InputArray mtx);
+
+/** @brief Finds the inverse or pseudo-inverse of a matrix.
+
+The function invert inverts the matrix src and stores the result in dst
+. When the matrix src is singular or non-square, the function calculates
+the pseudo-inverse matrix (the dst matrix) so that norm(src\*dst - I) is
+minimal, where I is an identity matrix.
+
+In case of the DECOMP_LU method, the function returns non-zero value if
+the inverse has been successfully calculated and 0 if src is singular.
+
+In case of the DECOMP_SVD method, the function returns the inverse
+condition number of src (the ratio of the smallest singular value to the
+largest singular value) and 0 if src is singular. The SVD method
+calculates a pseudo-inverse matrix if src is singular.
+
+Similarly to DECOMP_LU, the method DECOMP_CHOLESKY works only with
+non-singular square matrices that should also be symmetrical and
+positively defined. In this case, the function stores the inverted
+matrix in dst and returns non-zero. Otherwise, it returns 0.
+
+@param src input floating-point M x N matrix.
+@param dst output matrix of N x M size and the same type as src.
+@param flags inversion method (cv::DecompTypes)
+@sa solve, SVD
+*/
+CV_EXPORTS_W double invert(InputArray src, OutputArray dst, int flags = DECOMP_LU);
+
+/** @brief Solves one or more linear systems or least-squares problems.
+
+The function solve solves a linear system or least-squares problem (the
+latter is possible with SVD or QR methods, or by specifying the flag
+DECOMP_NORMAL ):
+\f[\texttt{dst} =  \arg \min _X \| \texttt{src1} \cdot \texttt{X} -  \texttt{src2} \|\f]
+
+If DECOMP_LU or DECOMP_CHOLESKY method is used, the function returns 1
+if src1 (or \f$\texttt{src1}^T\texttt{src1}\f$ ) is non-singular. Otherwise,
+it returns 0. In the latter case, dst is not valid. Other methods find a
+pseudo-solution in case of a singular left-hand side part.
+
+@note If you want to find a unity-norm solution of an under-defined
+singular system \f$\texttt{src1}\cdot\texttt{dst}=0\f$ , the function solve
+will not do the work. Use SVD::solveZ instead.
+
+@param src1 input matrix on the left-hand side of the system.
+@param src2 input matrix on the right-hand side of the system.
+@param dst output solution.
+@param flags solution (matrix inversion) method (cv::DecompTypes)
+@sa invert, SVD, eigen
+*/
+CV_EXPORTS_W bool solve(InputArray src1, InputArray src2,
+                        OutputArray dst, int flags = DECOMP_LU);
+
+/** @brief Sorts each row or each column of a matrix.
+
+The function sort sorts each matrix row or each matrix column in
+ascending or descending order. So you should pass two operation flags to
+get desired behaviour. If you want to sort matrix rows or columns
+lexicographically, you can use STL std::sort generic function with the
+proper comparison predicate.
+
+@param src input single-channel array.
+@param dst output array of the same size and type as src.
+@param flags operation flags, a combination of cv::SortFlags
+@sa sortIdx, randShuffle
+*/
+CV_EXPORTS_W void sort(InputArray src, OutputArray dst, int flags);
+
+/** @brief Sorts each row or each column of a matrix.
+
+The function sortIdx sorts each matrix row or each matrix column in the
+ascending or descending order. So you should pass two operation flags to
+get desired behaviour. Instead of reordering the elements themselves, it
+stores the indices of sorted elements in the output array. For example:
+@code
+    Mat A = Mat::eye(3,3,CV_32F), B;
+    sortIdx(A, B, SORT_EVERY_ROW + SORT_ASCENDING);
+    // B will probably contain
+    // (because of equal elements in A some permutations are possible):
+    // [[1, 2, 0], [0, 2, 1], [0, 1, 2]]
+@endcode
+@param src input single-channel array.
+@param dst output integer array of the same size as src.
+@param flags operation flags that could be a combination of cv::SortFlags
+@sa sort, randShuffle
+*/
+CV_EXPORTS_W void sortIdx(InputArray src, OutputArray dst, int flags);
+
+/** @brief Finds the real roots of a cubic equation.
+
+The function solveCubic finds the real roots of a cubic equation:
+-   if coeffs is a 4-element vector:
+\f[\texttt{coeffs} [0] x^3 +  \texttt{coeffs} [1] x^2 +  \texttt{coeffs} [2] x +  \texttt{coeffs} [3] = 0\f]
+-   if coeffs is a 3-element vector:
+\f[x^3 +  \texttt{coeffs} [0] x^2 +  \texttt{coeffs} [1] x +  \texttt{coeffs} [2] = 0\f]
+
+The roots are stored in the roots array.
+@param coeffs equation coefficients, an array of 3 or 4 elements.
+@param roots output array of real roots that has 1 or 3 elements.
+*/
+CV_EXPORTS_W int solveCubic(InputArray coeffs, OutputArray roots);
+
+/** @brief Finds the real or complex roots of a polynomial equation.
+
+The function solvePoly finds real and complex roots of a polynomial equation:
+\f[\texttt{coeffs} [n] x^{n} +  \texttt{coeffs} [n-1] x^{n-1} + ... +  \texttt{coeffs} [1] x +  \texttt{coeffs} [0] = 0\f]
+@param coeffs array of polynomial coefficients.
+@param roots output (complex) array of roots.
+@param maxIters maximum number of iterations the algorithm does.
+*/
+CV_EXPORTS_W double solvePoly(InputArray coeffs, OutputArray roots, int maxIters = 300);
+
+/** @brief Calculates eigenvalues and eigenvectors of a symmetric matrix.
+
+The functions eigen calculate just eigenvalues, or eigenvalues and eigenvectors of the symmetric
+matrix src:
+@code
+    src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()
+@endcode
+@note in the new and the old interfaces different ordering of eigenvalues and eigenvectors
+parameters is used.
+@param src input matrix that must have CV_32FC1 or CV_64FC1 type, square size and be symmetrical
+(src ^T^ == src).
+@param eigenvalues output vector of eigenvalues of the same type as src; the eigenvalues are stored
+in the descending order.
+@param eigenvectors output matrix of eigenvectors; it has the same size and type as src; the
+eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding
+eigenvalues.
+@sa completeSymm , PCA
+*/
+CV_EXPORTS_W bool eigen(InputArray src, OutputArray eigenvalues,
+                        OutputArray eigenvectors = noArray());
+
+/** @brief Calculates the covariance matrix of a set of vectors.
+
+The functions calcCovarMatrix calculate the covariance matrix and, optionally, the mean vector of
+the set of input vectors.
+@param samples samples stored as separate matrices
+@param nsamples number of samples
+@param covar output covariance matrix of the type ctype and square size.
+@param mean input or output (depending on the flags) array as the average value of the input vectors.
+@param flags operation flags as a combination of cv::CovarFlags
+@param ctype type of the matrixl; it equals 'CV_64F' by default.
+@sa PCA, mulTransposed, Mahalanobis
+@todo InputArrayOfArrays
+*/
+CV_EXPORTS void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, Mat& mean,
+                                 int flags, int ctype = CV_64F);
+
+/** @overload
+@note use cv::COVAR_ROWS or cv::COVAR_COLS flag
+@param samples samples stored as rows/columns of a single matrix.
+@param covar output covariance matrix of the type ctype and square size.
+@param mean input or output (depending on the flags) array as the average value of the input vectors.
+@param flags operation flags as a combination of cv::CovarFlags
+@param ctype type of the matrixl; it equals 'CV_64F' by default.
+*/
+CV_EXPORTS_W void calcCovarMatrix( InputArray samples, OutputArray covar,
+                                   InputOutputArray mean, int flags, int ctype = CV_64F);
+
+/** wrap PCA::operator() */
+CV_EXPORTS_W void PCACompute(InputArray data, InputOutputArray mean,
+                             OutputArray eigenvectors, int maxComponents = 0);
+
+/** wrap PCA::operator() */
+CV_EXPORTS_W void PCACompute(InputArray data, InputOutputArray mean,
+                             OutputArray eigenvectors, double retainedVariance);
+
+/** wrap PCA::project */
+CV_EXPORTS_W void PCAProject(InputArray data, InputArray mean,
+                             InputArray eigenvectors, OutputArray result);
+
+/** wrap PCA::backProject */
+CV_EXPORTS_W void PCABackProject(InputArray data, InputArray mean,
+                                 InputArray eigenvectors, OutputArray result);
+
+/** wrap SVD::compute */
+CV_EXPORTS_W void SVDecomp( InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags = 0 );
+
+/** wrap SVD::backSubst */
+CV_EXPORTS_W void SVBackSubst( InputArray w, InputArray u, InputArray vt,
+                               InputArray rhs, OutputArray dst );
+
+/** @brief Calculates the Mahalanobis distance between two vectors.
+
+The function Mahalanobis calculates and returns the weighted distance between two vectors:
+\f[d( \texttt{vec1} , \texttt{vec2} )= \sqrt{\sum_{i,j}{\texttt{icovar(i,j)}\cdot(\texttt{vec1}(I)-\texttt{vec2}(I))\cdot(\texttt{vec1(j)}-\texttt{vec2(j)})} }\f]
+The covariance matrix may be calculated using the cv::calcCovarMatrix function and then inverted using
+the invert function (preferably using the cv::DECOMP_SVD method, as the most accurate).
+@param v1 first 1D input vector.
+@param v2 second 1D input vector.
+@param icovar inverse covariance matrix.
+*/
+CV_EXPORTS_W double Mahalanobis(InputArray v1, InputArray v2, InputArray icovar);
+
+/** @brief Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
+
+The function performs one of the following:
+-   Forward the Fourier transform of a 1D vector of N elements:
+    \f[Y = F^{(N)}  \cdot X,\f]
+    where \f$F^{(N)}_{jk}=\exp(-2\pi i j k/N)\f$ and \f$i=\sqrt{-1}\f$
+-   Inverse the Fourier transform of a 1D vector of N elements:
+    \f[\begin{array}{l} X'=  \left (F^{(N)} \right )^{-1}  \cdot Y =  \left (F^{(N)} \right )^*  \cdot y  \\ X = (1/N)  \cdot X, \end{array}\f]
+    where \f$F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\f$
+-   Forward the 2D Fourier transform of a M x N matrix:
+    \f[Y = F^{(M)}  \cdot X  \cdot F^{(N)}\f]
+-   Inverse the 2D Fourier transform of a M x N matrix:
+    \f[\begin{array}{l} X'=  \left (F^{(M)} \right )^*  \cdot Y  \cdot \left (F^{(N)} \right )^* \\ X =  \frac{1}{M \cdot N} \cdot X' \end{array}\f]
+
+In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input
+spectrum of the inverse Fourier transform can be represented in a packed format called *CCS*
+(complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here
+is how 2D *CCS* spectrum looks:
+\f[\begin{bmatrix} Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} &  \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2}  \\ Re Y_{1,0} & Re Y_{1,1} & Im Y_{1,1} & Re Y_{1,2} & Im Y_{1,2} &  \cdots & Re Y_{1,N/2-1} & Im Y_{1,N/2-1} & Re Y_{1,N/2}  \\ Im Y_{1,0} & Re Y_{2,1} & Im Y_{2,1} & Re Y_{2,2} & Im Y_{2,2} &  \cdots & Re Y_{2,N/2-1} & Im Y_{2,N/2-1} & Im Y_{1,N/2}  \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} &  Re Y_{M-3,1}  & Im Y_{M-3,1} &  \hdotsfor{3} & Re Y_{M-3,N/2-1} & Im Y_{M-3,N/2-1}& Re Y_{M/2-1,N/2}  \\ Im Y_{M/2-1,0} &  Re Y_{M-2,1}  & Im Y_{M-2,1} &  \hdotsfor{3} & Re Y_{M-2,N/2-1} & Im Y_{M-2,N/2-1}& Im Y_{M/2-1,N/2}  \\ Re Y_{M/2,0}  &  Re Y_{M-1,1} &  Im Y_{M-1,1} &  \hdotsfor{3} & Re Y_{M-1,N/2-1} & Im Y_{M-1,N/2-1}& Re Y_{M/2,N/2} \end{bmatrix}\f]
+
+In case of 1D transform of a real vector, the output looks like the first row of the matrix above.
+
+So, the function chooses an operation mode depending on the flags and size of the input array:
+-   If DFT_ROWS is set or the input array has a single row or single column, the function
+    performs a 1D forward or inverse transform of each row of a matrix when DFT_ROWS is set.
+    Otherwise, it performs a 2D transform.
+-   If the input array is real and DFT_INVERSE is not set, the function performs a forward 1D or
+    2D transform:
+    -   When DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as
+        input.
+    -   When DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as
+        input. In case of 2D transform, it uses the packed format as shown above. In case of a
+        single 1D transform, it looks like the first row of the matrix above. In case of
+        multiple 1D transforms (when using the DFT_ROWS flag), each row of the output matrix
+        looks like the first row of the matrix above.
+-   If the input array is complex and either DFT_INVERSE or DFT_REAL_OUTPUT are not set, the
+    output is a complex array of the same size as input. The function performs a forward or
+    inverse 1D or 2D transform of the whole input array or each row of the input array
+    independently, depending on the flags DFT_INVERSE and DFT_ROWS.
+-   When DFT_INVERSE is set and the input array is real, or it is complex but DFT_REAL_OUTPUT
+    is set, the output is a real array of the same size as input. The function performs a 1D or 2D
+    inverse transformation of the whole input array or each individual row, depending on the flags
+    DFT_INVERSE and DFT_ROWS.
+
+If DFT_SCALE is set, the scaling is done after the transformation.
+
+Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed
+efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the
+current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize
+method.
+
+The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
+@code
+    void convolveDFT(InputArray A, InputArray B, OutputArray C)
+    {
+        // reallocate the output array if needed
+        C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
+        Size dftSize;
+        // calculate the size of DFT transform
+        dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
+        dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
+
+        // allocate temporary buffers and initialize them with 0's
+        Mat tempA(dftSize, A.type(), Scalar::all(0));
+        Mat tempB(dftSize, B.type(), Scalar::all(0));
+
+        // copy A and B to the top-left corners of tempA and tempB, respectively
+        Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
+        A.copyTo(roiA);
+        Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
+        B.copyTo(roiB);
+
+        // now transform the padded A & B in-place;
+        // use "nonzeroRows" hint for faster processing
+        dft(tempA, tempA, 0, A.rows);
+        dft(tempB, tempB, 0, B.rows);
+
+        // multiply the spectrums;
+        // the function handles packed spectrum representations well
+        mulSpectrums(tempA, tempB, tempA);
+
+        // transform the product back from the frequency domain.
+        // Even though all the result rows will be non-zero,
+        // you need only the first C.rows of them, and thus you
+        // pass nonzeroRows == C.rows
+        dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
+
+        // now copy the result back to C.
+        tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
+
+        // all the temporary buffers will be deallocated automatically
+    }
+@endcode
+To optimize this sample, consider the following approaches:
+-   Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to
+    the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole
+    tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols)
+    rightmost columns of the matrices.
+-   This DFT-based convolution does not have to be applied to the whole big arrays, especially if B
+    is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts.
+    To do this, you need to split the output array C into multiple tiles. For each tile, estimate
+    which parts of A and B are required to calculate convolution in this tile. If the tiles in C are
+    too small, the speed will decrease a lot because of repeated work. In the ultimate case, when
+    each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution
+    algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and
+    there is also a slowdown because of bad cache locality. So, there is an optimal tile size
+    somewhere in the middle.
+-   If different tiles in C can be calculated in parallel and, thus, the convolution is done by
+    parts, the loop can be threaded.
+
+All of the above improvements have been implemented in matchTemplate and filter2D . Therefore, by
+using them, you can get the performance even better than with the above theoretically optimal
+implementation. Though, those two functions actually calculate cross-correlation, not convolution,
+so you need to "flip" the second convolution operand B vertically and horizontally using flip .
+@note
+-   An example using the discrete fourier transform can be found at
+    opencv_source_code/samples/cpp/dft.cpp
+-   (Python) An example using the dft functionality to perform Wiener deconvolution can be found
+    at opencv_source/samples/python/deconvolution.py
+-   (Python) An example rearranging the quadrants of a Fourier image can be found at
+    opencv_source/samples/python/dft.py
+@param src input array that could be real or complex.
+@param dst output array whose size and type depends on the flags .
+@param flags transformation flags, representing a combination of the cv::DftFlags
+@param nonzeroRows when the parameter is not zero, the function assumes that only the first
+nonzeroRows rows of the input array (DFT_INVERSE is not set) or only the first nonzeroRows of the
+output array (DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the
+rows more efficiently and save some time; this technique is very useful for calculating array
+cross-correlation or convolution using DFT.
+@sa dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar ,
+magnitude , phase
+*/
+CV_EXPORTS_W void dft(InputArray src, OutputArray dst, int flags = 0, int nonzeroRows = 0);
+
+/** @brief Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
+
+idft(src, dst, flags) is equivalent to dft(src, dst, flags | DFT_INVERSE) .
+@note None of dft and idft scales the result by default. So, you should pass DFT_SCALE to one of
+dft or idft explicitly to make these transforms mutually inverse.
+@sa dft, dct, idct, mulSpectrums, getOptimalDFTSize
+@param src input floating-point real or complex array.
+@param dst output array whose size and type depend on the flags.
+@param flags operation flags (see dft and cv::DftFlags).
+@param nonzeroRows number of dst rows to process; the rest of the rows have undefined content (see
+the convolution sample in dft description.
+*/
+CV_EXPORTS_W void idft(InputArray src, OutputArray dst, int flags = 0, int nonzeroRows = 0);
+
+/** @brief Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
+
+The function dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D
+floating-point array:
+-   Forward Cosine transform of a 1D vector of N elements:
+    \f[Y = C^{(N)}  \cdot X\f]
+    where
+    \f[C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\f]
+    and
+    \f$\alpha_0=1\f$, \f$\alpha_j=2\f$ for *j \> 0*.
+-   Inverse Cosine transform of a 1D vector of N elements:
+    \f[X =  \left (C^{(N)} \right )^{-1}  \cdot Y =  \left (C^{(N)} \right )^T  \cdot Y\f]
+    (since \f$C^{(N)}\f$ is an orthogonal matrix, \f$C^{(N)} \cdot \left(C^{(N)}\right)^T = I\f$ )
+-   Forward 2D Cosine transform of M x N matrix:
+    \f[Y = C^{(N)}  \cdot X  \cdot \left (C^{(N)} \right )^T\f]
+-   Inverse 2D Cosine transform of M x N matrix:
+    \f[X =  \left (C^{(N)} \right )^T  \cdot X  \cdot C^{(N)}\f]
+
+The function chooses the mode of operation by looking at the flags and size of the input array:
+-   If (flags & DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it
+    is an inverse 1D or 2D transform.
+-   If (flags & DCT_ROWS) != 0 , the function performs a 1D transform of each row.
+-   If the array is a single column or a single row, the function performs a 1D transform.
+-   If none of the above is true, the function performs a 2D transform.
+
+@note Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you
+can pad the array when necessary.
+Also, the function performance depends very much, and not monotonically, on the array size (see
+getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT
+of a vector of size N/2 . Thus, the optimal DCT size N1 \>= N can be calculated as:
+@code
+    size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); }
+    N1 = getOptimalDCTSize(N);
+@endcode
+@param src input floating-point array.
+@param dst output array of the same size and type as src .
+@param flags transformation flags as a combination of cv::DftFlags (DCT_*)
+@sa dft , getOptimalDFTSize , idct
+*/
+CV_EXPORTS_W void dct(InputArray src, OutputArray dst, int flags = 0);
+
+/** @brief Calculates the inverse Discrete Cosine Transform of a 1D or 2D array.
+
+idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE).
+@param src input floating-point single-channel array.
+@param dst output array of the same size and type as src.
+@param flags operation flags.
+@sa  dct, dft, idft, getOptimalDFTSize
+*/
+CV_EXPORTS_W void idct(InputArray src, OutputArray dst, int flags = 0);
+
+/** @brief Performs the per-element multiplication of two Fourier spectrums.
+
+The function mulSpectrums performs the per-element multiplication of the two CCS-packed or complex
+matrices that are results of a real or complex Fourier transform.
+
+The function, together with dft and idft , may be used to calculate convolution (pass conjB=false )
+or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are
+simply multiplied (per element) with an optional conjugation of the second-array elements. When the
+arrays are real, they are assumed to be CCS-packed (see dft for details).
+@param a first input array.
+@param b second input array of the same size and type as src1 .
+@param c output array of the same size and type as src1 .
+@param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that
+each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value.
+@param conjB optional flag that conjugates the second input array before the multiplication (true)
+or not (false).
+*/
+CV_EXPORTS_W void mulSpectrums(InputArray a, InputArray b, OutputArray c,
+                               int flags, bool conjB = false);
+
+/** @brief Returns the optimal DFT size for a given vector size.
+
+DFT performance is not a monotonic function of a vector size. Therefore, when you calculate
+convolution of two arrays or perform the spectral analysis of an array, it usually makes sense to
+pad the input data with zeros to get a bit larger array that can be transformed much faster than the
+original one. Arrays whose size is a power-of-two (2, 4, 8, 16, 32, ...) are the fastest to process.
+Though, the arrays whose size is a product of 2's, 3's, and 5's (for example, 300 = 5\*5\*3\*2\*2)
+are also processed quite efficiently.
+
+The function getOptimalDFTSize returns the minimum number N that is greater than or equal to vecsize
+so that the DFT of a vector of size N can be processed efficiently. In the current implementation N
+= 2 ^p^ \* 3 ^q^ \* 5 ^r^ for some integer p, q, r.
+
+The function returns a negative number if vecsize is too large (very close to INT_MAX ).
+
+While the function cannot be used directly to estimate the optimal vector size for DCT transform
+(since the current DCT implementation supports only even-size vectors), it can be easily processed
+as getOptimalDFTSize((vecsize+1)/2)\*2.
+@param vecsize vector size.
+@sa dft , dct , idft , idct , mulSpectrums
+*/
+CV_EXPORTS_W int getOptimalDFTSize(int vecsize);
+
+/** @brief Returns the default random number generator.
+
+The function theRNG returns the default random number generator. For each thread, there is a
+separate random number generator, so you can use the function safely in multi-thread environments.
+If you just need to get a single random number using this generator or initialize an array, you can
+use randu or randn instead. But if you are going to generate many random numbers inside a loop, it
+is much faster to use this function to retrieve the generator and then use RNG::operator _Tp() .
+@sa RNG, randu, randn
+*/
+CV_EXPORTS RNG& theRNG();
+
+/** @brief Generates a single uniformly-distributed random number or an array of random numbers.
+
+Non-template variant of the function fills the matrix dst with uniformly-distributed
+random numbers from the specified range:
+\f[\texttt{low} _c  \leq \texttt{dst} (I)_c <  \texttt{high} _c\f]
+@param dst output array of random numbers; the array must be pre-allocated.
+@param low inclusive lower boundary of the generated random numbers.
+@param high exclusive upper boundary of the generated random numbers.
+@sa RNG, randn, theRNG
+*/
+CV_EXPORTS_W void randu(InputOutputArray dst, InputArray low, InputArray high);
+
+/** @brief Fills the array with normally distributed random numbers.
+
+The function randn fills the matrix dst with normally distributed random numbers with the specified
+mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the
+value range of the output array data type.
+@param dst output array of random numbers; the array must be pre-allocated and have 1 to 4 channels.
+@param mean mean value (expectation) of the generated random numbers.
+@param stddev standard deviation of the generated random numbers; it can be either a vector (in
+which case a diagonal standard deviation matrix is assumed) or a square matrix.
+@sa RNG, randu
+*/
+CV_EXPORTS_W void randn(InputOutputArray dst, InputArray mean, InputArray stddev);
+
+/** @brief Shuffles the array elements randomly.
+
+The function randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and
+swapping them. The number of such swap operations will be dst.rows\*dst.cols\*iterFactor .
+@param dst input/output numerical 1D array.
+@param iterFactor scale factor that determines the number of random swap operations (see the details
+below).
+@param rng optional random number generator used for shuffling; if it is zero, theRNG () is used
+instead.
+@sa RNG, sort
+*/
+CV_EXPORTS_W void randShuffle(InputOutputArray dst, double iterFactor = 1., RNG* rng = 0);
+
+/** @brief Principal Component Analysis
+
+The class is used to calculate a special basis for a set of vectors. The
+basis will consist of eigenvectors of the covariance matrix calculated
+from the input set of vectors. The class %PCA can also transform
+vectors to/from the new coordinate space defined by the basis. Usually,
+in this new coordinate system, each vector from the original set (and
+any linear combination of such vectors) can be quite accurately
+approximated by taking its first few components, corresponding to the
+eigenvectors of the largest eigenvalues of the covariance matrix.
+Geometrically it means that you calculate a projection of the vector to
+a subspace formed by a few eigenvectors corresponding to the dominant
+eigenvalues of the covariance matrix. And usually such a projection is
+very close to the original vector. So, you can represent the original
+vector from a high-dimensional space with a much shorter vector
+consisting of the projected vector's coordinates in the subspace. Such a
+transformation is also known as Karhunen-Loeve Transform, or KLT.
+See http://en.wikipedia.org/wiki/Principal_component_analysis
+
+The sample below is the function that takes two matrices. The first
+function stores a set of vectors (a row per vector) that is used to
+calculate PCA. The second function stores another "test" set of vectors
+(a row per vector). First, these vectors are compressed with PCA, then
+reconstructed back, and then the reconstruction error norm is computed
+and printed for each vector. :
+
+@code{.cpp}
+using namespace cv;
+
+PCA compressPCA(const Mat& pcaset, int maxComponents,
+                const Mat& testset, Mat& compressed)
+{
+    PCA pca(pcaset, // pass the data
+            Mat(), // we do not have a pre-computed mean vector,
+                   // so let the PCA engine to compute it
+            PCA::DATA_AS_ROW, // indicate that the vectors
+                                // are stored as matrix rows
+                                // (use PCA::DATA_AS_COL if the vectors are
+                                // the matrix columns)
+            maxComponents // specify, how many principal components to retain
+            );
+    // if there is no test data, just return the computed basis, ready-to-use
+    if( !testset.data )
+        return pca;
+    CV_Assert( testset.cols == pcaset.cols );
+
+    compressed.create(testset.rows, maxComponents, testset.type());
+
+    Mat reconstructed;
+    for( int i = 0; i < testset.rows; i++ )
+    {
+        Mat vec = testset.row(i), coeffs = compressed.row(i), reconstructed;
+        // compress the vector, the result will be stored
+        // in the i-th row of the output matrix
+        pca.project(vec, coeffs);
+        // and then reconstruct it
+        pca.backProject(coeffs, reconstructed);
+        // and measure the error
+        printf("%d. diff = %g\n", i, norm(vec, reconstructed, NORM_L2));
+    }
+    return pca;
+}
+@endcode
+@sa calcCovarMatrix, mulTransposed, SVD, dft, dct
+*/
+class CV_EXPORTS PCA
+{
+public:
+    enum Flags { DATA_AS_ROW = 0, //!< indicates that the input samples are stored as matrix rows
+                 DATA_AS_COL = 1, //!< indicates that the input samples are stored as matrix columns
+                 USE_AVG     = 2  //!
+               };
+
+    /** @brief default constructor
+
+    The default constructor initializes an empty %PCA structure. The other
+    constructors initialize the structure and call PCA::operator()().
+    */
+    PCA();
+
+    /** @overload
+    @param data input samples stored as matrix rows or matrix columns.
+    @param mean optional mean value; if the matrix is empty (@c noArray()),
+    the mean is computed from the data.
+    @param flags operation flags; currently the parameter is only used to
+    specify the data layout (PCA::Flags)
+    @param maxComponents maximum number of components that %PCA should
+    retain; by default, all the components are retained.
+    */
+    PCA(InputArray data, InputArray mean, int flags, int maxComponents = 0);
+
+    /** @overload
+    @param data input samples stored as matrix rows or matrix columns.
+    @param mean optional mean value; if the matrix is empty (noArray()),
+    the mean is computed from the data.
+    @param flags operation flags; currently the parameter is only used to
+    specify the data layout (PCA::Flags)
+    @param retainedVariance Percentage of variance that PCA should retain.
+    Using this parameter will let the PCA decided how many components to
+    retain but it will always keep at least 2.
+    */
+    PCA(InputArray data, InputArray mean, int flags, double retainedVariance);
+
+    /** @brief performs %PCA
+
+    The operator performs %PCA of the supplied dataset. It is safe to reuse
+    the same PCA structure for multiple datasets. That is, if the structure
+    has been previously used with another dataset, the existing internal
+    data is reclaimed and the new eigenvalues, @ref eigenvectors , and @ref
+    mean are allocated and computed.
+
+    The computed eigenvalues are sorted from the largest to the smallest and
+    the corresponding eigenvectors are stored as eigenvectors rows.
+
+    @param data input samples stored as the matrix rows or as the matrix
+    columns.
+    @param mean optional mean value; if the matrix is empty (noArray()),
+    the mean is computed from the data.
+    @param flags operation flags; currently the parameter is only used to
+    specify the data layout. (Flags)
+    @param maxComponents maximum number of components that PCA should
+    retain; by default, all the components are retained.
+    */
+    PCA& operator()(InputArray data, InputArray mean, int flags, int maxComponents = 0);
+
+    /** @overload
+    @param data input samples stored as the matrix rows or as the matrix
+    columns.
+    @param mean optional mean value; if the matrix is empty (noArray()),
+    the mean is computed from the data.
+    @param flags operation flags; currently the parameter is only used to
+    specify the data layout. (PCA::Flags)
+    @param retainedVariance Percentage of variance that %PCA should retain.
+    Using this parameter will let the %PCA decided how many components to
+    retain but it will always keep at least 2.
+     */
+    PCA& operator()(InputArray data, InputArray mean, int flags, double retainedVariance);
+
+    /** @brief Projects vector(s) to the principal component subspace.
+
+    The methods project one or more vectors to the principal component
+    subspace, where each vector projection is represented by coefficients in
+    the principal component basis. The first form of the method returns the
+    matrix that the second form writes to the result. So the first form can
+    be used as a part of expression while the second form can be more
+    efficient in a processing loop.
+    @param vec input vector(s); must have the same dimensionality and the
+    same layout as the input data used at %PCA phase, that is, if
+    DATA_AS_ROW are specified, then `vec.cols==data.cols`
+    (vector dimensionality) and `vec.rows` is the number of vectors to
+    project, and the same is true for the PCA::DATA_AS_COL case.
+    */
+    Mat project(InputArray vec) const;
+
+    /** @overload
+    @param vec input vector(s); must have the same dimensionality and the
+    same layout as the input data used at PCA phase, that is, if
+    DATA_AS_ROW are specified, then `vec.cols==data.cols`
+    (vector dimensionality) and `vec.rows` is the number of vectors to
+    project, and the same is true for the PCA::DATA_AS_COL case.
+    @param result output vectors; in case of PCA::DATA_AS_COL, the
+    output matrix has as many columns as the number of input vectors, this
+    means that `result.cols==vec.cols` and the number of rows match the
+    number of principal components (for example, `maxComponents` parameter
+    passed to the constructor).
+     */
+    void project(InputArray vec, OutputArray result) const;
+
+    /** @brief Reconstructs vectors from their PC projections.
+
+    The methods are inverse operations to PCA::project. They take PC
+    coordinates of projected vectors and reconstruct the original vectors.
+    Unless all the principal components have been retained, the
+    reconstructed vectors are different from the originals. But typically,
+    the difference is small if the number of components is large enough (but
+    still much smaller than the original vector dimensionality). As a
+    result, PCA is used.
+    @param vec coordinates of the vectors in the principal component
+    subspace, the layout and size are the same as of PCA::project output
+    vectors.
+     */
+    Mat backProject(InputArray vec) const;
+
+    /** @overload
+    @param vec coordinates of the vectors in the principal component
+    subspace, the layout and size are the same as of PCA::project output
+    vectors.
+    @param result reconstructed vectors; the layout and size are the same as
+    of PCA::project input vectors.
+     */
+    void backProject(InputArray vec, OutputArray result) const;
+
+    /** @brief write and load PCA matrix
+
+*/
+    void write(FileStorage& fs ) const;
+    void read(const FileNode& fs);
+
+    Mat eigenvectors; //!< eigenvectors of the covariation matrix
+    Mat eigenvalues; //!< eigenvalues of the covariation matrix
+    Mat mean; //!< mean value subtracted before the projection and added after the back projection
+};
+
+/** @example pca.cpp
+  An example using %PCA for dimensionality reduction while maintaining an amount of variance
+ */
+
+/**
+   @brief Linear Discriminant Analysis
+   @todo document this class
+ */
+class CV_EXPORTS LDA
+{
+public:
+    /** @brief constructor
+    Initializes a LDA with num_components (default 0).
+    */
+    explicit LDA(int num_components = 0);
+
+    /** Initializes and performs a Discriminant Analysis with Fisher's
+     Optimization Criterion on given data in src and corresponding labels
+     in labels. If 0 (or less) number of components are given, they are
+     automatically determined for given data in computation.
+    */
+    LDA(InputArrayOfArrays src, InputArray labels, int num_components = 0);
+
+    /** Serializes this object to a given filename.
+      */
+    void save(const String& filename) const;
+
+    /** Deserializes this object from a given filename.
+      */
+    void load(const String& filename);
+
+    /** Serializes this object to a given cv::FileStorage.
+      */
+    void save(FileStorage& fs) const;
+
+    /** Deserializes this object from a given cv::FileStorage.
+      */
+    void load(const FileStorage& node);
+
+    /** destructor
+      */
+    ~LDA();
+
+    /** Compute the discriminants for data in src (row aligned) and labels.
+      */
+    void compute(InputArrayOfArrays src, InputArray labels);
+
+    /** Projects samples into the LDA subspace.
+        src may be one or more row aligned samples.
+      */
+    Mat project(InputArray src);
+
+    /** Reconstructs projections from the LDA subspace.
+        src may be one or more row aligned projections.
+      */
+    Mat reconstruct(InputArray src);
+
+    /** Returns the eigenvectors of this LDA.
+      */
+    Mat eigenvectors() const { return _eigenvectors; }
+
+    /** Returns the eigenvalues of this LDA.
+      */
+    Mat eigenvalues() const { return _eigenvalues; }
+
+    static Mat subspaceProject(InputArray W, InputArray mean, InputArray src);
+    static Mat subspaceReconstruct(InputArray W, InputArray mean, InputArray src);
+
+protected:
+    bool _dataAsRow; // unused, but needed for 3.0 ABI compatibility.
+    int _num_components;
+    Mat _eigenvectors;
+    Mat _eigenvalues;
+    void lda(InputArrayOfArrays src, InputArray labels);
+};
+
+/** @brief Singular Value Decomposition
+
+Class for computing Singular Value Decomposition of a floating-point
+matrix. The Singular Value Decomposition is used to solve least-square
+problems, under-determined linear systems, invert matrices, compute
+condition numbers, and so on.
+
+If you want to compute a condition number of a matrix or an absolute value of
+its determinant, you do not need `u` and `vt`. You can pass
+flags=SVD::NO_UV|... . Another flag SVD::FULL_UV indicates that full-size u
+and vt must be computed, which is not necessary most of the time.
+
+@sa invert, solve, eigen, determinant
+*/
+class CV_EXPORTS SVD
+{
+public:
+    enum Flags {
+        /** allow the algorithm to modify the decomposed matrix; it can save space and speed up
+            processing. currently ignored. */
+        MODIFY_A = 1,
+        /** indicates that only a vector of singular values `w` is to be processed, while u and vt
+            will be set to empty matrices */
+        NO_UV    = 2,
+        /** when the matrix is not square, by default the algorithm produces u and vt matrices of
+            sufficiently large size for the further A reconstruction; if, however, FULL_UV flag is
+            specified, u and vt will be full-size square orthogonal matrices.*/
+        FULL_UV  = 4
+    };
+
+    /** @brief the default constructor
+
+    initializes an empty SVD structure
+      */
+    SVD();
+
+    /** @overload
+    initializes an empty SVD structure and then calls SVD::operator()
+    @param src decomposed matrix.
+    @param flags operation flags (SVD::Flags)
+      */
+    SVD( InputArray src, int flags = 0 );
+
+    /** @brief the operator that performs SVD. The previously allocated u, w and vt are released.
+
+    The operator performs the singular value decomposition of the supplied
+    matrix. The u,`vt` , and the vector of singular values w are stored in
+    the structure. The same SVD structure can be reused many times with
+    different matrices. Each time, if needed, the previous u,`vt` , and w
+    are reclaimed and the new matrices are created, which is all handled by
+    Mat::create.
+    @param src decomposed matrix.
+    @param flags operation flags (SVD::Flags)
+      */
+    SVD& operator ()( InputArray src, int flags = 0 );
+
+    /** @brief decomposes matrix and stores the results to user-provided matrices
+
+    The methods/functions perform SVD of matrix. Unlike SVD::SVD constructor
+    and SVD::operator(), they store the results to the user-provided
+    matrices:
+
+    @code{.cpp}
+    Mat A, w, u, vt;
+    SVD::compute(A, w, u, vt);
+    @endcode
+
+    @param src decomposed matrix
+    @param w calculated singular values
+    @param u calculated left singular vectors
+    @param vt transposed matrix of right singular values
+    @param flags operation flags - see SVD::SVD.
+      */
+    static void compute( InputArray src, OutputArray w,
+                         OutputArray u, OutputArray vt, int flags = 0 );
+
+    /** @overload
+    computes singular values of a matrix
+    @param src decomposed matrix
+    @param w calculated singular values
+    @param flags operation flags - see SVD::Flags.
+      */
+    static void compute( InputArray src, OutputArray w, int flags = 0 );
+
+    /** @brief performs back substitution
+      */
+    static void backSubst( InputArray w, InputArray u,
+                           InputArray vt, InputArray rhs,
+                           OutputArray dst );
+
+    /** @brief solves an under-determined singular linear system
+
+    The method finds a unit-length solution x of a singular linear system
+    A\*x = 0. Depending on the rank of A, there can be no solutions, a
+    single solution or an infinite number of solutions. In general, the
+    algorithm solves the following problem:
+    \f[dst =  \arg \min _{x:  \| x \| =1}  \| src  \cdot x  \|\f]
+    @param src left-hand-side matrix.
+    @param dst found solution.
+      */
+    static void solveZ( InputArray src, OutputArray dst );
+
+    /** @brief performs a singular value back substitution.
+
+    The method calculates a back substitution for the specified right-hand
+    side:
+
+    \f[\texttt{x} =  \texttt{vt} ^T  \cdot diag( \texttt{w} )^{-1}  \cdot \texttt{u} ^T  \cdot \texttt{rhs} \sim \texttt{A} ^{-1}  \cdot \texttt{rhs}\f]
+
+    Using this technique you can either get a very accurate solution of the
+    convenient linear system, or the best (in the least-squares terms)
+    pseudo-solution of an overdetermined linear system.
+
+    @param rhs right-hand side of a linear system (u\*w\*v')\*dst = rhs to
+    be solved, where A has been previously decomposed.
+
+    @param dst found solution of the system.
+
+    @note Explicit SVD with the further back substitution only makes sense
+    if you need to solve many linear systems with the same left-hand side
+    (for example, src ). If all you need is to solve a single system
+    (possibly with multiple rhs immediately available), simply call solve
+    add pass DECOMP_SVD there. It does absolutely the same thing.
+      */
+    void backSubst( InputArray rhs, OutputArray dst ) const;
+
+    /** @todo document */
+    template<typename _Tp, int m, int n, int nm> static
+    void compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w, Matx<_Tp, m, nm>& u, Matx<_Tp, n, nm>& vt );
+
+    /** @todo document */
+    template<typename _Tp, int m, int n, int nm> static
+    void compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w );
+
+    /** @todo document */
+    template<typename _Tp, int m, int n, int nm, int nb> static
+    void backSubst( const Matx<_Tp, nm, 1>& w, const Matx<_Tp, m, nm>& u, const Matx<_Tp, n, nm>& vt, const Matx<_Tp, m, nb>& rhs, Matx<_Tp, n, nb>& dst );
+
+    Mat u, w, vt;
+};
+
+/** @brief Random Number Generator
+
+Random number generator. It encapsulates the state (currently, a 64-bit
+integer) and has methods to return scalar random values and to fill
+arrays with random values. Currently it supports uniform and Gaussian
+(normal) distributions. The generator uses Multiply-With-Carry
+algorithm, introduced by G. Marsaglia (
+<http://en.wikipedia.org/wiki/Multiply-with-carry> ).
+Gaussian-distribution random numbers are generated using the Ziggurat
+algorithm ( <http://en.wikipedia.org/wiki/Ziggurat_algorithm> ),
+introduced by G. Marsaglia and W. W. Tsang.
+*/
+class CV_EXPORTS RNG
+{
+public:
+    enum { UNIFORM = 0,
+           NORMAL  = 1
+         };
+
+    /** @brief constructor
+
+    These are the RNG constructors. The first form sets the state to some
+    pre-defined value, equal to 2\*\*32-1 in the current implementation. The
+    second form sets the state to the specified value. If you passed state=0
+    , the constructor uses the above default value instead to avoid the
+    singular random number sequence, consisting of all zeros.
+    */
+    RNG();
+    /** @overload
+    @param state 64-bit value used to initialize the RNG.
+    */
+    RNG(uint64 state);
+    /**The method updates the state using the MWC algorithm and returns the
+    next 32-bit random number.*/
+    unsigned next();
+
+    /**Each of the methods updates the state using the MWC algorithm and
+    returns the next random number of the specified type. In case of integer
+    types, the returned number is from the available value range for the
+    specified type. In case of floating-point types, the returned value is
+    from [0,1) range.
+    */
+    operator uchar();
+    /** @overload */
+    operator schar();
+    /** @overload */
+    operator ushort();
+    /** @overload */
+    operator short();
+    /** @overload */
+    operator unsigned();
+    /** @overload */
+    operator int();
+    /** @overload */
+    operator float();
+    /** @overload */
+    operator double();
+
+    /** @brief returns a random integer sampled uniformly from [0, N).
+
+    The methods transform the state using the MWC algorithm and return the
+    next random number. The first form is equivalent to RNG::next . The
+    second form returns the random number modulo N , which means that the
+    result is in the range [0, N) .
+    */
+    unsigned operator ()();
+    /** @overload
+    @param N upper non-inclusive boundary of the returned random number.
+    */
+    unsigned operator ()(unsigned N);
+
+    /** @brief returns uniformly distributed integer random number from [a,b) range
+
+    The methods transform the state using the MWC algorithm and return the
+    next uniformly-distributed random number of the specified type, deduced
+    from the input parameter type, from the range [a, b) . There is a nuance
+    illustrated by the following sample:
+
+    @code{.cpp}
+    RNG rng;
+
+    // always produces 0
+    double a = rng.uniform(0, 1);
+
+    // produces double from [0, 1)
+    double a1 = rng.uniform((double)0, (double)1);
+
+    // produces float from [0, 1)
+    double b = rng.uniform(0.f, 1.f);
+
+    // produces double from [0, 1)
+    double c = rng.uniform(0., 1.);
+
+    // may cause compiler error because of ambiguity:
+    //  RNG::uniform(0, (int)0.999999)? or RNG::uniform((double)0, 0.99999)?
+    double d = rng.uniform(0, 0.999999);
+    @endcode
+
+    The compiler does not take into account the type of the variable to
+    which you assign the result of RNG::uniform . The only thing that
+    matters to the compiler is the type of a and b parameters. So, if you
+    want a floating-point random number, but the range boundaries are
+    integer numbers, either put dots in the end, if they are constants, or
+    use explicit type cast operators, as in the a1 initialization above.
+    @param a lower inclusive boundary of the returned random numbers.
+    @param b upper non-inclusive boundary of the returned random numbers.
+      */
+    int uniform(int a, int b);
+    /** @overload */
+    float uniform(float a, float b);
+    /** @overload */
+    double uniform(double a, double b);
+
+    /** @brief Fills arrays with random numbers.
+
+    @param mat 2D or N-dimensional matrix; currently matrices with more than
+    4 channels are not supported by the methods, use Mat::reshape as a
+    possible workaround.
+    @param distType distribution type, RNG::UNIFORM or RNG::NORMAL.
+    @param a first distribution parameter; in case of the uniform
+    distribution, this is an inclusive lower boundary, in case of the normal
+    distribution, this is a mean value.
+    @param b second distribution parameter; in case of the uniform
+    distribution, this is a non-inclusive upper boundary, in case of the
+    normal distribution, this is a standard deviation (diagonal of the
+    standard deviation matrix or the full standard deviation matrix).
+    @param saturateRange pre-saturation flag; for uniform distribution only;
+    if true, the method will first convert a and b to the acceptable value
+    range (according to the mat datatype) and then will generate uniformly
+    distributed random numbers within the range [saturate(a), saturate(b)),
+    if saturateRange=false, the method will generate uniformly distributed
+    random numbers in the original range [a, b) and then will saturate them,
+    it means, for example, that
+    <tt>theRNG().fill(mat_8u, RNG::UNIFORM, -DBL_MAX, DBL_MAX)</tt> will likely
+    produce array mostly filled with 0's and 255's, since the range (0, 255)
+    is significantly smaller than [-DBL_MAX, DBL_MAX).
+
+    Each of the methods fills the matrix with the random values from the
+    specified distribution. As the new numbers are generated, the RNG state
+    is updated accordingly. In case of multiple-channel images, every
+    channel is filled independently, which means that RNG cannot generate
+    samples from the multi-dimensional Gaussian distribution with
+    non-diagonal covariance matrix directly. To do that, the method
+    generates samples from multi-dimensional standard Gaussian distribution
+    with zero mean and identity covariation matrix, and then transforms them
+    using transform to get samples from the specified Gaussian distribution.
+    */
+    void fill( InputOutputArray mat, int distType, InputArray a, InputArray b, bool saturateRange = false );
+
+    /** @brief Returns the next random number sampled from the Gaussian distribution
+    @param sigma standard deviation of the distribution.
+
+    The method transforms the state using the MWC algorithm and returns the
+    next random number from the Gaussian distribution N(0,sigma) . That is,
+    the mean value of the returned random numbers is zero and the standard
+    deviation is the specified sigma .
+    */
+    double gaussian(double sigma);
+
+    uint64 state;
+};
+
+/** @brief Mersenne Twister random number generator
+
+Inspired by http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c
+@todo document
+ */
+class CV_EXPORTS RNG_MT19937
+{
+public:
+    RNG_MT19937();
+    RNG_MT19937(unsigned s);
+    void seed(unsigned s);
+
+    unsigned next();
+
+    operator int();
+    operator unsigned();
+    operator float();
+    operator double();
+
+    unsigned operator ()(unsigned N);
+    unsigned operator ()();
+
+    /** @brief returns uniformly distributed integer random number from [a,b) range
+
+*/
+    int uniform(int a, int b);
+    /** @brief returns uniformly distributed floating-point random number from [a,b) range
+
+*/
+    float uniform(float a, float b);
+    /** @brief returns uniformly distributed double-precision floating-point random number from [a,b) range
+
+*/
+    double uniform(double a, double b);
+
+private:
+    enum PeriodParameters {N = 624, M = 397};
+    unsigned state[N];
+    int mti;
+};
+
+//! @} core_array
+
+//! @addtogroup core_cluster
+//!  @{
+
+/** @example kmeans.cpp
+  An example on K-means clustering
+*/
+
+/** @brief Finds centers of clusters and groups input samples around the clusters.
+
+The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
+and groups the input samples around the clusters. As an output, \f$\texttt{labels}_i\f$ contains a
+0-based cluster index for the sample stored in the \f$i^{th}\f$ row of the samples matrix.
+
+@note
+-   (Python) An example on K-means clustering can be found at
+    opencv_source_code/samples/python/kmeans.py
+@param data Data for clustering. An array of N-Dimensional points with float coordinates is needed.
+Examples of this array can be:
+-   Mat points(count, 2, CV_32F);
+-   Mat points(count, 1, CV_32FC2);
+-   Mat points(1, count, CV_32FC2);
+-   std::vector\<cv::Point2f\> points(sampleCount);
+@param K Number of clusters to split the set by.
+@param bestLabels Input/output integer array that stores the cluster indices for every sample.
+@param criteria The algorithm termination criteria, that is, the maximum number of iterations and/or
+the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster
+centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
+@param attempts Flag to specify the number of times the algorithm is executed using different
+initial labellings. The algorithm returns the labels that yield the best compactness (see the last
+function parameter).
+@param flags Flag that can take values of cv::KmeansFlags
+@param centers Output matrix of the cluster centers, one row per each cluster center.
+@return The function returns the compactness measure that is computed as
+\f[\sum _i  \| \texttt{samples} _i -  \texttt{centers} _{ \texttt{labels} _i} \| ^2\f]
+after every attempt. The best (minimum) value is chosen and the corresponding labels and the
+compactness value are returned by the function. Basically, you can use only the core of the
+function, set the number of attempts to 1, initialize labels each time using a custom algorithm,
+pass them with the ( flags = KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best
+(most-compact) clustering.
+*/
+CV_EXPORTS_W double kmeans( InputArray data, int K, InputOutputArray bestLabels,
+                            TermCriteria criteria, int attempts,
+                            int flags, OutputArray centers = noArray() );
+
+//! @} core_cluster
+
+//! @addtogroup core_basic
+//! @{
+
+/////////////////////////////// Formatted output of cv::Mat ///////////////////////////
+
+/** @todo document */
+class CV_EXPORTS Formatted
+{
+public:
+    virtual const char* next() = 0;
+    virtual void reset() = 0;
+    virtual ~Formatted();
+};
+
+/** @todo document */
+class CV_EXPORTS Formatter
+{
+public:
+    enum { FMT_DEFAULT = 0,
+           FMT_MATLAB  = 1,
+           FMT_CSV     = 2,
+           FMT_PYTHON  = 3,
+           FMT_NUMPY   = 4,
+           FMT_C       = 5
+         };
+
+    virtual ~Formatter();
+
+    virtual Ptr<Formatted> format(const Mat& mtx) const = 0;
+
+    virtual void set32fPrecision(int p = 8) = 0;
+    virtual void set64fPrecision(int p = 16) = 0;
+    virtual void setMultiline(bool ml = true) = 0;
+
+    static Ptr<Formatter> get(int fmt = FMT_DEFAULT);
+
+};
+
+static inline
+String& operator << (String& out, Ptr<Formatted> fmtd)
+{
+    fmtd->reset();
+    for(const char* str = fmtd->next(); str; str = fmtd->next())
+        out += cv::String(str);
+    return out;
+}
+
+static inline
+String& operator << (String& out, const Mat& mtx)
+{
+    return out << Formatter::get()->format(mtx);
+}
+
+//////////////////////////////////////// Algorithm ////////////////////////////////////
+
+class CV_EXPORTS Algorithm;
+
+template<typename _Tp> struct ParamType {};
+
+
+/** @brief This is a base class for all more or less complex algorithms in OpenCV
+
+especially for classes of algorithms, for which there can be multiple implementations. The examples
+are stereo correspondence (for which there are algorithms like block matching, semi-global block
+matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians
+models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck
+etc.).
+
+Here is example of SIFT use in your application via Algorithm interface:
+@code
+    #include "opencv2/opencv.hpp"
+    #include "opencv2/xfeatures2d.hpp"
+    using namespace cv::xfeatures2d;
+
+    Ptr<Feature2D> sift = SIFT::create();
+    FileStorage fs("sift_params.xml", FileStorage::READ);
+    if( fs.isOpened() ) // if we have file with parameters, read them
+    {
+        sift->read(fs["sift_params"]);
+        fs.release();
+    }
+    else // else modify the parameters and store them; user can later edit the file to use different parameters
+    {
+        sift->setContrastThreshold(0.01f); // lower the contrast threshold, compared to the default value
+        {
+            WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
+            sift->write(fs);
+        }
+    }
+    Mat image = imread("myimage.png", 0), descriptors;
+    vector<KeyPoint> keypoints;
+    sift->detectAndCompute(image, noArray(), keypoints, descriptors);
+@endcode
+ */
+class CV_EXPORTS_W Algorithm
+{
+public:
+    Algorithm();
+    virtual ~Algorithm();
+
+    /** @brief Clears the algorithm state
+    */
+    CV_WRAP virtual void clear() {}
+
+    /** @brief Stores algorithm parameters in a file storage
+    */
+    virtual void write(FileStorage& fs) const { (void)fs; }
+
+    /** @brief Reads algorithm parameters from a file storage
+    */
+    virtual void read(const FileNode& fn) { (void)fn; }
+
+    /** @brief Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
+     */
+    virtual bool empty() const { return false; }
+
+    /** @brief Reads algorithm from the file node
+
+     This is static template method of Algorithm. It's usage is following (in the case of SVM):
+     @code
+     Ptr<SVM> svm = Algorithm::read<SVM>(fn);
+     @endcode
+     In order to make this method work, the derived class must overwrite Algorithm::read(const
+     FileNode& fn) and also have static create() method without parameters
+     (or with all the optional parameters)
+     */
+    template<typename _Tp> static Ptr<_Tp> read(const FileNode& fn)
+    {
+        Ptr<_Tp> obj = _Tp::create();
+        obj->read(fn);
+        return !obj->empty() ? obj : Ptr<_Tp>();
+    }
+
+    /** @brief Loads algorithm from the file
+
+     @param filename Name of the file to read.
+     @param objname The optional name of the node to read (if empty, the first top-level node will be used)
+
+     This is static template method of Algorithm. It's usage is following (in the case of SVM):
+     @code
+     Ptr<SVM> svm = Algorithm::load<SVM>("my_svm_model.xml");
+     @endcode
+     In order to make this method work, the derived class must overwrite Algorithm::read(const
+     FileNode& fn).
+     */
+    template<typename _Tp> static Ptr<_Tp> load(const String& filename, const String& objname=String())
+    {
+        FileStorage fs(filename, FileStorage::READ);
+        FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
+        Ptr<_Tp> obj = _Tp::create();
+        obj->read(fn);
+        return !obj->empty() ? obj : Ptr<_Tp>();
+    }
+
+    /** @brief Loads algorithm from a String
+
+     @param strModel The string variable containing the model you want to load.
+     @param objname The optional name of the node to read (if empty, the first top-level node will be used)
+
+     This is static template method of Algorithm. It's usage is following (in the case of SVM):
+     @code
+     Ptr<SVM> svm = Algorithm::loadFromString<SVM>(myStringModel);
+     @endcode
+     */
+    template<typename _Tp> static Ptr<_Tp> loadFromString(const String& strModel, const String& objname=String())
+    {
+        FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY);
+        FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
+        Ptr<_Tp> obj = _Tp::create();
+        obj->read(fn);
+        return !obj->empty() ? obj : Ptr<_Tp>();
+    }
+
+    /** Saves the algorithm to a file.
+     In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs). */
+    CV_WRAP virtual void save(const String& filename) const;
+
+    /** Returns the algorithm string identifier.
+     This string is used as top level xml/yml node tag when the object is saved to a file or string. */
+    CV_WRAP virtual String getDefaultName() const;
+};
+
+struct Param {
+    enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7,
+           UNSIGNED_INT=8, UINT64=9, UCHAR=11 };
+};
+
+
+
+template<> struct ParamType<bool>
+{
+    typedef bool const_param_type;
+    typedef bool member_type;
+
+    enum { type = Param::BOOLEAN };
+};
+
+template<> struct ParamType<int>
+{
+    typedef int const_param_type;
+    typedef int member_type;
+
+    enum { type = Param::INT };
+};
+
+template<> struct ParamType<double>
+{
+    typedef double const_param_type;
+    typedef double member_type;
+
+    enum { type = Param::REAL };
+};
+
+template<> struct ParamType<String>
+{
+    typedef const String& const_param_type;
+    typedef String member_type;
+
+    enum { type = Param::STRING };
+};
+
+template<> struct ParamType<Mat>
+{
+    typedef const Mat& const_param_type;
+    typedef Mat member_type;
+
+    enum { type = Param::MAT };
+};
+
+template<> struct ParamType<std::vector<Mat> >
+{
+    typedef const std::vector<Mat>& const_param_type;
+    typedef std::vector<Mat> member_type;
+
+    enum { type = Param::MAT_VECTOR };
+};
+
+template<> struct ParamType<Algorithm>
+{
+    typedef const Ptr<Algorithm>& const_param_type;
+    typedef Ptr<Algorithm> member_type;
+
+    enum { type = Param::ALGORITHM };
+};
+
+template<> struct ParamType<float>
+{
+    typedef float const_param_type;
+    typedef float member_type;
+
+    enum { type = Param::FLOAT };
+};
+
+template<> struct ParamType<unsigned>
+{
+    typedef unsigned const_param_type;
+    typedef unsigned member_type;
+
+    enum { type = Param::UNSIGNED_INT };
+};
+
+template<> struct ParamType<uint64>
+{
+    typedef uint64 const_param_type;
+    typedef uint64 member_type;
+
+    enum { type = Param::UINT64 };
+};
+
+template<> struct ParamType<uchar>
+{
+    typedef uchar const_param_type;
+    typedef uchar member_type;
+
+    enum { type = Param::UCHAR };
+};
+
+//! @} core_basic
+
+} //namespace cv
+
+#include "opencv2/core/operations.hpp"
+#include "opencv2/core/cvstd.inl.hpp"
+#include "opencv2/core/utility.hpp"
+#include "opencv2/core/optim.hpp"
+
+#endif /*__OPENCV_CORE_HPP__*/
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp
new file mode 100644
index 0000000..2bce5b9
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp
@@ -0,0 +1,522 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_AFFINE3_HPP__
+#define __OPENCV_CORE_AFFINE3_HPP__
+
+#ifdef __cplusplus
+
+#include <opencv2/core.hpp>
+
+namespace cv
+{
+
+//! @addtogroup core
+//! @{
+
+    /** @brief Affine transform
+      @todo document
+     */
+    template<typename T>
+    class Affine3
+    {
+    public:
+        typedef T float_type;
+        typedef Matx<float_type, 3, 3> Mat3;
+        typedef Matx<float_type, 4, 4> Mat4;
+        typedef Vec<float_type, 3> Vec3;
+
+        Affine3();
+
+        //! Augmented affine matrix
+        Affine3(const Mat4& affine);
+
+        //! Rotation matrix
+        Affine3(const Mat3& R, const Vec3& t = Vec3::all(0));
+
+        //! Rodrigues vector
+        Affine3(const Vec3& rvec, const Vec3& t = Vec3::all(0));
+
+        //! Combines all contructors above. Supports 4x4, 4x3, 3x3, 1x3, 3x1 sizes of data matrix
+        explicit Affine3(const Mat& data, const Vec3& t = Vec3::all(0));
+
+        //! From 16th element array
+        explicit Affine3(const float_type* vals);
+
+        //! Create identity transform
+        static Affine3 Identity();
+
+        //! Rotation matrix
+        void rotation(const Mat3& R);
+
+        //! Rodrigues vector
+        void rotation(const Vec3& rvec);
+
+        //! Combines rotation methods above. Suports 3x3, 1x3, 3x1 sizes of data matrix;
+        void rotation(const Mat& data);
+
+        void linear(const Mat3& L);
+        void translation(const Vec3& t);
+
+        Mat3 rotation() const;
+        Mat3 linear() const;
+        Vec3 translation() const;
+
+        //! Rodrigues vector
+        Vec3 rvec() const;
+
+        Affine3 inv(int method = cv::DECOMP_SVD) const;
+
+        //! a.rotate(R) is equivalent to Affine(R, 0) * a;
+        Affine3 rotate(const Mat3& R) const;
+
+        //! a.rotate(rvec) is equivalent to Affine(rvec, 0) * a;
+        Affine3 rotate(const Vec3& rvec) const;
+
+        //! a.translate(t) is equivalent to Affine(E, t) * a;
+        Affine3 translate(const Vec3& t) const;
+
+        //! a.concatenate(affine) is equivalent to affine * a;
+        Affine3 concatenate(const Affine3& affine) const;
+
+        template <typename Y> operator Affine3<Y>() const;
+
+        template <typename Y> Affine3<Y> cast() const;
+
+        Mat4 matrix;
+
+#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
+        Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine);
+        Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine);
+        operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const;
+        operator Eigen::Transform<T, 3, Eigen::Affine>() const;
+#endif
+    };
+
+    template<typename T> static
+    Affine3<T> operator*(const Affine3<T>& affine1, const Affine3<T>& affine2);
+
+    template<typename T, typename V> static
+    V operator*(const Affine3<T>& affine, const V& vector);
+
+    typedef Affine3<float> Affine3f;
+    typedef Affine3<double> Affine3d;
+
+    static Vec3f operator*(const Affine3f& affine, const Vec3f& vector);
+    static Vec3d operator*(const Affine3d& affine, const Vec3d& vector);
+
+    template<typename _Tp> class DataType< Affine3<_Tp> >
+    {
+    public:
+        typedef Affine3<_Tp>                               value_type;
+        typedef Affine3<typename DataType<_Tp>::work_type> work_type;
+        typedef _Tp                                        channel_type;
+
+        enum { generic_type = 0,
+               depth        = DataType<channel_type>::depth,
+               channels     = 16,
+               fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+               type         = CV_MAKETYPE(depth, channels)
+             };
+
+        typedef Vec<channel_type, channels> vec_type;
+    };
+
+//! @} core
+
+}
+
+//! @cond IGNORED
+
+///////////////////////////////////////////////////////////////////////////////////
+// Implementaiton
+
+template<typename T> inline
+cv::Affine3<T>::Affine3()
+    : matrix(Mat4::eye())
+{}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Mat4& affine)
+    : matrix(affine)
+{}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Mat3& R, const Vec3& t)
+{
+    rotation(R);
+    translation(t);
+    matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
+    matrix.val[15] = 1;
+}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Vec3& _rvec, const Vec3& t)
+{
+    rotation(_rvec);
+    translation(t);
+    matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
+    matrix.val[15] = 1;
+}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
+{
+    CV_Assert(data.type() == cv::DataType<T>::type);
+
+    if (data.cols == 4 && data.rows == 4)
+    {
+        data.copyTo(matrix);
+        return;
+    }
+    else if (data.cols == 4 && data.rows == 3)
+    {
+        rotation(data(Rect(0, 0, 3, 3)));
+        translation(data(Rect(3, 0, 1, 3)));
+        return;
+    }
+
+    rotation(data);
+    translation(t);
+    matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
+    matrix.val[15] = 1;
+}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const float_type* vals) : matrix(vals)
+{}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::Identity()
+{
+    return Affine3<T>(cv::Affine3<T>::Mat4::eye());
+}
+
+template<typename T> inline
+void cv::Affine3<T>::rotation(const Mat3& R)
+{
+    linear(R);
+}
+
+template<typename T> inline
+void cv::Affine3<T>::rotation(const Vec3& _rvec)
+{
+    double rx = _rvec[0], ry = _rvec[1], rz = _rvec[2];
+    double theta = std::sqrt(rx*rx + ry*ry + rz*rz);
+
+    if (theta < DBL_EPSILON)
+        rotation(Mat3::eye());
+    else
+    {
+        const double I[] = { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
+
+        double c = std::cos(theta);
+        double s = std::sin(theta);
+        double c1 = 1. - c;
+        double itheta = (theta != 0) ? 1./theta : 0.;
+
+        rx *= itheta; ry *= itheta; rz *= itheta;
+
+        double rrt[] = { rx*rx, rx*ry, rx*rz, rx*ry, ry*ry, ry*rz, rx*rz, ry*rz, rz*rz };
+        double _r_x_[] = { 0, -rz, ry, rz, 0, -rx, -ry, rx, 0 };
+        Mat3 R;
+
+        // R = cos(theta)*I + (1 - cos(theta))*r*rT + sin(theta)*[r_x]
+        // where [r_x] is [0 -rz ry; rz 0 -rx; -ry rx 0]
+        for(int k = 0; k < 9; ++k)
+            R.val[k] = static_cast<float_type>(c*I[k] + c1*rrt[k] + s*_r_x_[k]);
+
+        rotation(R);
+    }
+}
+
+//Combines rotation methods above. Suports 3x3, 1x3, 3x1 sizes of data matrix;
+template<typename T> inline
+void cv::Affine3<T>::rotation(const cv::Mat& data)
+{
+    CV_Assert(data.type() == cv::DataType<T>::type);
+
+    if (data.cols == 3 && data.rows == 3)
+    {
+        Mat3 R;
+        data.copyTo(R);
+        rotation(R);
+    }
+    else if ((data.cols == 3 && data.rows == 1) || (data.cols == 1 && data.rows == 3))
+    {
+        Vec3 _rvec;
+        data.reshape(1, 3).copyTo(_rvec);
+        rotation(_rvec);
+    }
+    else
+        CV_Assert(!"Input marix can be 3x3, 1x3 or 3x1");
+}
+
+template<typename T> inline
+void cv::Affine3<T>::linear(const Mat3& L)
+{
+    matrix.val[0] = L.val[0]; matrix.val[1] = L.val[1];  matrix.val[ 2] = L.val[2];
+    matrix.val[4] = L.val[3]; matrix.val[5] = L.val[4];  matrix.val[ 6] = L.val[5];
+    matrix.val[8] = L.val[6]; matrix.val[9] = L.val[7];  matrix.val[10] = L.val[8];
+}
+
+template<typename T> inline
+void cv::Affine3<T>::translation(const Vec3& t)
+{
+    matrix.val[3] = t[0]; matrix.val[7] = t[1]; matrix.val[11] = t[2];
+}
+
+template<typename T> inline
+typename cv::Affine3<T>::Mat3 cv::Affine3<T>::rotation() const
+{
+    return linear();
+}
+
+template<typename T> inline
+typename cv::Affine3<T>::Mat3 cv::Affine3<T>::linear() const
+{
+    typename cv::Affine3<T>::Mat3 R;
+    R.val[0] = matrix.val[0];  R.val[1] = matrix.val[1];  R.val[2] = matrix.val[ 2];
+    R.val[3] = matrix.val[4];  R.val[4] = matrix.val[5];  R.val[5] = matrix.val[ 6];
+    R.val[6] = matrix.val[8];  R.val[7] = matrix.val[9];  R.val[8] = matrix.val[10];
+    return R;
+}
+
+template<typename T> inline
+typename cv::Affine3<T>::Vec3 cv::Affine3<T>::translation() const
+{
+    return Vec3(matrix.val[3], matrix.val[7], matrix.val[11]);
+}
+
+template<typename T> inline
+typename cv::Affine3<T>::Vec3 cv::Affine3<T>::rvec() const
+{
+    cv::Vec3d w;
+    cv::Matx33d u, vt, R = rotation();
+    cv::SVD::compute(R, w, u, vt, cv::SVD::FULL_UV + cv::SVD::MODIFY_A);
+    R = u * vt;
+
+    double rx = R.val[7] - R.val[5];
+    double ry = R.val[2] - R.val[6];
+    double rz = R.val[3] - R.val[1];
+
+    double s = std::sqrt((rx*rx + ry*ry + rz*rz)*0.25);
+    double c = (R.val[0] + R.val[4] + R.val[8] - 1) * 0.5;
+    c = c > 1.0 ? 1.0 : c < -1.0 ? -1.0 : c;
+    double theta = acos(c);
+
+    if( s < 1e-5 )
+    {
+        if( c > 0 )
+            rx = ry = rz = 0;
+        else
+        {
+            double t;
+            t = (R.val[0] + 1) * 0.5;
+            rx = std::sqrt(std::max(t, 0.0));
+            t = (R.val[4] + 1) * 0.5;
+            ry = std::sqrt(std::max(t, 0.0)) * (R.val[1] < 0 ? -1.0 : 1.0);
+            t = (R.val[8] + 1) * 0.5;
+            rz = std::sqrt(std::max(t, 0.0)) * (R.val[2] < 0 ? -1.0 : 1.0);
+
+            if( fabs(rx) < fabs(ry) && fabs(rx) < fabs(rz) && (R.val[5] > 0) != (ry*rz > 0) )
+                rz = -rz;
+            theta /= std::sqrt(rx*rx + ry*ry + rz*rz);
+            rx *= theta;
+            ry *= theta;
+            rz *= theta;
+        }
+    }
+    else
+    {
+        double vth = 1/(2*s);
+        vth *= theta;
+        rx *= vth; ry *= vth; rz *= vth;
+    }
+
+    return cv::Vec3d(rx, ry, rz);
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::inv(int method) const
+{
+    return matrix.inv(method);
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::rotate(const Mat3& R) const
+{
+    Mat3 Lc = linear();
+    Vec3 tc = translation();
+    Mat4 result;
+    result.val[12] = result.val[13] = result.val[14] = 0;
+    result.val[15] = 1;
+
+    for(int j = 0; j < 3; ++j)
+    {
+        for(int i = 0; i < 3; ++i)
+        {
+            float_type value = 0;
+            for(int k = 0; k < 3; ++k)
+                value += R(j, k) * Lc(k, i);
+            result(j, i) = value;
+        }
+
+        result(j, 3) = R.row(j).dot(tc.t());
+    }
+    return result;
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::rotate(const Vec3& _rvec) const
+{
+    return rotate(Affine3f(_rvec).rotation());
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::translate(const Vec3& t) const
+{
+    Mat4 m = matrix;
+    m.val[ 3] += t[0];
+    m.val[ 7] += t[1];
+    m.val[11] += t[2];
+    return m;
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::concatenate(const Affine3<T>& affine) const
+{
+    return (*this).rotate(affine.rotation()).translate(affine.translation());
+}
+
+template<typename T> template <typename Y> inline
+cv::Affine3<T>::operator Affine3<Y>() const
+{
+    return Affine3<Y>(matrix);
+}
+
+template<typename T> template <typename Y> inline
+cv::Affine3<Y> cv::Affine3<T>::cast() const
+{
+    return Affine3<Y>(matrix);
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::operator*(const cv::Affine3<T>& affine1, const cv::Affine3<T>& affine2)
+{
+    return affine2.concatenate(affine1);
+}
+
+template<typename T, typename V> inline
+V cv::operator*(const cv::Affine3<T>& affine, const V& v)
+{
+    const typename Affine3<T>::Mat4& m = affine.matrix;
+
+    V r;
+    r.x = m.val[0] * v.x + m.val[1] * v.y + m.val[ 2] * v.z + m.val[ 3];
+    r.y = m.val[4] * v.x + m.val[5] * v.y + m.val[ 6] * v.z + m.val[ 7];
+    r.z = m.val[8] * v.x + m.val[9] * v.y + m.val[10] * v.z + m.val[11];
+    return r;
+}
+
+static inline
+cv::Vec3f cv::operator*(const cv::Affine3f& affine, const cv::Vec3f& v)
+{
+    const cv::Matx44f& m = affine.matrix;
+    cv::Vec3f r;
+    r.val[0] = m.val[0] * v[0] + m.val[1] * v[1] + m.val[ 2] * v[2] + m.val[ 3];
+    r.val[1] = m.val[4] * v[0] + m.val[5] * v[1] + m.val[ 6] * v[2] + m.val[ 7];
+    r.val[2] = m.val[8] * v[0] + m.val[9] * v[1] + m.val[10] * v[2] + m.val[11];
+    return r;
+}
+
+static inline
+cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
+{
+    const cv::Matx44d& m = affine.matrix;
+    cv::Vec3d r;
+    r.val[0] = m.val[0] * v[0] + m.val[1] * v[1] + m.val[ 2] * v[2] + m.val[ 3];
+    r.val[1] = m.val[4] * v[0] + m.val[5] * v[1] + m.val[ 6] * v[2] + m.val[ 7];
+    r.val[2] = m.val[8] * v[0] + m.val[9] * v[1] + m.val[10] * v[2] + m.val[11];
+    return r;
+}
+
+
+
+#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine)
+{
+    cv::Mat(4, 4, cv::DataType<T>::type, affine.matrix().data()).copyTo(matrix);
+}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine)
+{
+    Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> a = affine;
+    cv::Mat(4, 4, cv::DataType<T>::type, a.matrix().data()).copyTo(matrix);
+}
+
+template<typename T> inline
+cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const
+{
+    Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> r;
+    cv::Mat hdr(4, 4, cv::DataType<T>::type, r.matrix().data());
+    cv::Mat(matrix, false).copyTo(hdr);
+    return r;
+}
+
+template<typename T> inline
+cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine>() const
+{
+    return this->operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>();
+}
+
+#endif /* defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H */
+
+//! @endcond
+
+#endif /* __cplusplus */
+
+#endif /* __OPENCV_CORE_AFFINE3_HPP__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/base.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/base.hpp
new file mode 100644
index 0000000..ed633f5
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/base.hpp
@@ -0,0 +1,689 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2014, Itseez 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*/
+
+#ifndef __OPENCV_CORE_BASE_HPP__
+#define __OPENCV_CORE_BASE_HPP__
+
+#ifndef __cplusplus
+#  error base.hpp header must be compiled as C++
+#endif
+
+#include <climits>
+#include <algorithm>
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/cvstd.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_utils
+//! @{
+
+namespace Error {
+//! error codes
+enum Code {
+    StsOk=                       0,  //!< everithing is ok
+    StsBackTrace=               -1,  //!< pseudo error for back trace
+    StsError=                   -2,  //!< unknown /unspecified error
+    StsInternal=                -3,  //!< internal error (bad state)
+    StsNoMem=                   -4,  //!< insufficient memory
+    StsBadArg=                  -5,  //!< function arg/param is bad
+    StsBadFunc=                 -6,  //!< unsupported function
+    StsNoConv=                  -7,  //!< iter. didn't converge
+    StsAutoTrace=               -8,  //!< tracing
+    HeaderIsNull=               -9,  //!< image header is NULL
+    BadImageSize=              -10,  //!< image size is invalid
+    BadOffset=                 -11,  //!< offset is invalid
+    BadDataPtr=                -12,  //!<
+    BadStep=                   -13,  //!<
+    BadModelOrChSeq=           -14,  //!<
+    BadNumChannels=            -15,  //!<
+    BadNumChannel1U=           -16,  //!<
+    BadDepth=                  -17,  //!<
+    BadAlphaChannel=           -18,  //!<
+    BadOrder=                  -19,  //!<
+    BadOrigin=                 -20,  //!<
+    BadAlign=                  -21,  //!<
+    BadCallBack=               -22,  //!<
+    BadTileSize=               -23,  //!<
+    BadCOI=                    -24,  //!<
+    BadROISize=                -25,  //!<
+    MaskIsTiled=               -26,  //!<
+    StsNullPtr=                -27,  //!< null pointer
+    StsVecLengthErr=           -28,  //!< incorrect vector length
+    StsFilterStructContentErr= -29,  //!< incorr. filter structure content
+    StsKernelStructContentErr= -30,  //!< incorr. transform kernel content
+    StsFilterOffsetErr=        -31,  //!< incorrect filter ofset value
+    StsBadSize=                -201, //!< the input/output structure size is incorrect
+    StsDivByZero=              -202, //!< division by zero
+    StsInplaceNotSupported=    -203, //!< in-place operation is not supported
+    StsObjectNotFound=         -204, //!< request can't be completed
+    StsUnmatchedFormats=       -205, //!< formats of input/output arrays differ
+    StsBadFlag=                -206, //!< flag is wrong or not supported
+    StsBadPoint=               -207, //!< bad CvPoint
+    StsBadMask=                -208, //!< bad format of mask (neither 8uC1 nor 8sC1)
+    StsUnmatchedSizes=         -209, //!< sizes of input/output structures do not match
+    StsUnsupportedFormat=      -210, //!< the data format/type is not supported by the function
+    StsOutOfRange=             -211, //!< some of parameters are out of range
+    StsParseError=             -212, //!< invalid syntax/structure of the parsed file
+    StsNotImplemented=         -213, //!< the requested function/feature is not implemented
+    StsBadMemBlock=            -214, //!< an allocated block has been corrupted
+    StsAssert=                 -215, //!< assertion failed
+    GpuNotSupported=           -216,
+    GpuApiCallError=           -217,
+    OpenGlNotSupported=        -218,
+    OpenGlApiCallError=        -219,
+    OpenCLApiCallError=        -220,
+    OpenCLDoubleNotSupported=  -221,
+    OpenCLInitError=           -222,
+    OpenCLNoAMDBlasFft=        -223
+};
+} //Error
+
+//! @} core_utils
+
+//! @addtogroup core_array
+//! @{
+
+//! matrix decomposition types
+enum DecompTypes {
+    /** Gaussian elimination with the optimal pivot element chosen. */
+    DECOMP_LU       = 0,
+    /** singular value decomposition (SVD) method; the system can be over-defined and/or the matrix
+    src1 can be singular */
+    DECOMP_SVD      = 1,
+    /** eigenvalue decomposition; the matrix src1 must be symmetrical */
+    DECOMP_EIG      = 2,
+    /** Cholesky \f$LL^T\f$ factorization; the matrix src1 must be symmetrical and positively
+    defined */
+    DECOMP_CHOLESKY = 3,
+    /** QR factorization; the system can be over-defined and/or the matrix src1 can be singular */
+    DECOMP_QR       = 4,
+    /** while all the previous flags are mutually exclusive, this flag can be used together with
+    any of the previous; it means that the normal equations
+    \f$\texttt{src1}^T\cdot\texttt{src1}\cdot\texttt{dst}=\texttt{src1}^T\texttt{src2}\f$ are
+    solved instead of the original system
+    \f$\texttt{src1}\cdot\texttt{dst}=\texttt{src2}\f$ */
+    DECOMP_NORMAL   = 16
+};
+
+/** norm types
+- For one array:
+\f[norm =  \forkthree{\|\texttt{src1}\|_{L_{\infty}} =  \max _I | \texttt{src1} (I)|}{if  \(\texttt{normType} = \texttt{NORM_INF}\) }
+{ \| \texttt{src1} \| _{L_1} =  \sum _I | \texttt{src1} (I)|}{if  \(\texttt{normType} = \texttt{NORM_L1}\) }
+{ \| \texttt{src1} \| _{L_2} =  \sqrt{\sum_I \texttt{src1}(I)^2} }{if  \(\texttt{normType} = \texttt{NORM_L2}\) }\f]
+
+- Absolute norm for two arrays
+\f[norm =  \forkthree{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} =  \max _I | \texttt{src1} (I) -  \texttt{src2} (I)|}{if  \(\texttt{normType} = \texttt{NORM_INF}\) }
+{ \| \texttt{src1} - \texttt{src2} \| _{L_1} =  \sum _I | \texttt{src1} (I) -  \texttt{src2} (I)|}{if  \(\texttt{normType} = \texttt{NORM_L1}\) }
+{ \| \texttt{src1} - \texttt{src2} \| _{L_2} =  \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if  \(\texttt{normType} = \texttt{NORM_L2}\) }\f]
+
+- Relative norm for two arrays
+\f[norm =  \forkthree{\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}}    }{\|\texttt{src2}\|_{L_{\infty}} }}{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_INF}\) }
+{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_L1}\) }
+{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_L2}\) }\f]
+
+As example for one array consider the function \f$r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\f$.
+The \f$ L_{1}, L_{2} \f$ and \f$ L_{\infty} \f$ norm for the sample value \f$r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\f$
+is calculated as follows
+\f{align*}
+    \| r(-1) \|_{L_1} &= |-1| + |2| = 3 \\
+    \| r(-1) \|_{L_2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\
+    \| r(-1) \|_{L_\infty} &= \max(|-1|,|2|) = 2
+\f}
+and for \f$r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\f$ the calculation is
+\f{align*}
+    \| r(0.5) \|_{L_1} &= |0.5| + |0.5| = 1 \\
+    \| r(0.5) \|_{L_2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\
+    \| r(0.5) \|_{L_\infty} &= \max(|0.5|,|0.5|) = 0.5.
+\f}
+The following graphic shows all values for the three norm functions \f$\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\f$ and \f$\| r(x) \|_{L_\infty}\f$.
+It is notable that the \f$ L_{1} \f$ norm forms the upper and the \f$ L_{\infty} \f$ norm forms the lower border for the example function \f$ r(x) \f$.
+![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png)
+ */
+enum NormTypes { NORM_INF       = 1,
+                 NORM_L1        = 2,
+                 NORM_L2        = 4,
+                 NORM_L2SQR     = 5,
+                 NORM_HAMMING   = 6,
+                 NORM_HAMMING2  = 7,
+                 NORM_TYPE_MASK = 7,
+                 NORM_RELATIVE  = 8, //!< flag
+                 NORM_MINMAX    = 32 //!< flag
+               };
+
+//! comparison types
+enum CmpTypes { CMP_EQ = 0, //!< src1 is equal to src2.
+                CMP_GT = 1, //!< src1 is greater than src2.
+                CMP_GE = 2, //!< src1 is greater than or equal to src2.
+                CMP_LT = 3, //!< src1 is less than src2.
+                CMP_LE = 4, //!< src1 is less than or equal to src2.
+                CMP_NE = 5  //!< src1 is unequal to src2.
+              };
+
+//! generalized matrix multiplication flags
+enum GemmFlags { GEMM_1_T = 1, //!< transposes src1
+                 GEMM_2_T = 2, //!< transposes src2
+                 GEMM_3_T = 4 //!< transposes src3
+               };
+
+enum DftFlags {
+    /** performs an inverse 1D or 2D transform instead of the default forward
+        transform. */
+    DFT_INVERSE        = 1,
+    /** scales the result: divide it by the number of array elements. Normally, it is
+        combined with DFT_INVERSE. */
+    DFT_SCALE          = 2,
+    /** performs a forward or inverse transform of every individual row of the input
+        matrix; this flag enables you to transform multiple vectors simultaneously and can be used to
+        decrease the overhead (which is sometimes several times larger than the processing itself) to
+        perform 3D and higher-dimensional transformations and so forth.*/
+    DFT_ROWS           = 4,
+    /** performs a forward transformation of 1D or 2D real array; the result,
+        though being a complex array, has complex-conjugate symmetry (*CCS*, see the function
+        description below for details), and such an array can be packed into a real array of the same
+        size as input, which is the fastest option and which is what the function does by default;
+        however, you may wish to get a full complex array (for simpler spectrum analysis, and so on) -
+        pass the flag to enable the function to produce a full-size complex output array. */
+    DFT_COMPLEX_OUTPUT = 16,
+    /** performs an inverse transformation of a 1D or 2D complex array; the
+        result is normally a complex array of the same size, however, if the input array has
+        conjugate-complex symmetry (for example, it is a result of forward transformation with
+        DFT_COMPLEX_OUTPUT flag), the output is a real array; while the function itself does not
+        check whether the input is symmetrical or not, you can pass the flag and then the function
+        will assume the symmetry and produce the real output array (note that when the input is packed
+        into a real array and inverse transformation is executed, the function treats the input as a
+        packed complex-conjugate symmetrical array, and the output will also be a real array). */
+    DFT_REAL_OUTPUT    = 32,
+    /** performs an inverse 1D or 2D transform instead of the default forward transform. */
+    DCT_INVERSE        = DFT_INVERSE,
+    /** performs a forward or inverse transform of every individual row of the input
+        matrix. This flag enables you to transform multiple vectors simultaneously and can be used to
+        decrease the overhead (which is sometimes several times larger than the processing itself) to
+        perform 3D and higher-dimensional transforms and so forth.*/
+    DCT_ROWS           = DFT_ROWS
+};
+
+//! Various border types, image boundaries are denoted with `|`
+//! @see borderInterpolate, copyMakeBorder
+enum BorderTypes {
+    BORDER_CONSTANT    = 0, //!< `iiiiii|abcdefgh|iiiiiii`  with some specified `i`
+    BORDER_REPLICATE   = 1, //!< `aaaaaa|abcdefgh|hhhhhhh`
+    BORDER_REFLECT     = 2, //!< `fedcba|abcdefgh|hgfedcb`
+    BORDER_WRAP        = 3, //!< `cdefgh|abcdefgh|abcdefg`
+    BORDER_REFLECT_101 = 4, //!< `gfedcb|abcdefgh|gfedcba`
+    BORDER_TRANSPARENT = 5, //!< `uvwxyz|absdefgh|ijklmno`
+
+    BORDER_REFLECT101  = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101
+    BORDER_DEFAULT     = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101
+    BORDER_ISOLATED    = 16 //!< do not look outside of ROI
+};
+
+//! @} core_array
+
+//! @addtogroup core_utils
+//! @{
+
+//! @cond IGNORED
+
+//////////////// static assert /////////////////
+#define CVAUX_CONCAT_EXP(a, b) a##b
+#define CVAUX_CONCAT(a, b) CVAUX_CONCAT_EXP(a,b)
+
+#if defined(__clang__)
+#  ifndef __has_extension
+#    define __has_extension __has_feature /* compatibility, for older versions of clang */
+#  endif
+#  if __has_extension(cxx_static_assert)
+#    define CV_StaticAssert(condition, reason)    static_assert((condition), reason " " #condition)
+#  elif __has_extension(c_static_assert)
+#    define CV_StaticAssert(condition, reason)    _Static_assert((condition), reason " " #condition)
+#  endif
+#elif defined(__GNUC__)
+#  if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
+#    define CV_StaticAssert(condition, reason)    static_assert((condition), reason " " #condition)
+#  endif
+#elif defined(_MSC_VER)
+#  if _MSC_VER >= 1600 /* MSVC 10 */
+#    define CV_StaticAssert(condition, reason)    static_assert((condition), reason " " #condition)
+#  endif
+#endif
+#ifndef CV_StaticAssert
+#  if !defined(__clang__) && defined(__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 302)
+#    define CV_StaticAssert(condition, reason) ({ extern int __attribute__((error("CV_StaticAssert: " reason " " #condition))) CV_StaticAssert(); ((condition) ? 0 : CV_StaticAssert()); })
+#  else
+     template <bool x> struct CV_StaticAssert_failed;
+     template <> struct CV_StaticAssert_failed<true> { enum { val = 1 }; };
+     template<int x> struct CV_StaticAssert_test {};
+#    define CV_StaticAssert(condition, reason)\
+       typedef cv::CV_StaticAssert_test< sizeof(cv::CV_StaticAssert_failed< static_cast<bool>(condition) >) > CVAUX_CONCAT(CV_StaticAssert_failed_at_, __LINE__)
+#  endif
+#endif
+
+// Suppress warning "-Wdeprecated-declarations" / C4996
+#if defined(_MSC_VER)
+    #define CV_DO_PRAGMA(x) __pragma(x)
+#elif defined(__GNUC__)
+    #define CV_DO_PRAGMA(x) _Pragma (#x)
+#else
+    #define CV_DO_PRAGMA(x)
+#endif
+
+#ifdef _MSC_VER
+#define CV_SUPPRESS_DEPRECATED_START \
+    CV_DO_PRAGMA(warning(push)) \
+    CV_DO_PRAGMA(warning(disable: 4996))
+#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(warning(pop))
+#elif defined (__clang__) || ((__GNUC__)  && (__GNUC__*100 + __GNUC_MINOR__ > 405))
+#define CV_SUPPRESS_DEPRECATED_START \
+    CV_DO_PRAGMA(GCC diagnostic push) \
+    CV_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
+#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(GCC diagnostic pop)
+#else
+#define CV_SUPPRESS_DEPRECATED_START
+#define CV_SUPPRESS_DEPRECATED_END
+#endif
+#define CV_UNUSED(name) (void)name
+//! @endcond
+
+/*! @brief Signals an error and raises the exception.
+
+By default the function prints information about the error to stderr,
+then it either stops if setBreakOnError() had been called before or raises the exception.
+It is possible to alternate error processing by using redirectError().
+@param _code - error code (Error::Code)
+@param _err - error description
+@param _func - function name. Available only when the compiler supports getting it
+@param _file - source file name where the error has occured
+@param _line - line number in the source file where the error has occured
+@see CV_Error, CV_Error_, CV_ErrorNoReturn, CV_ErrorNoReturn_, CV_Assert, CV_DbgAssert
+ */
+CV_EXPORTS void error(int _code, const String& _err, const char* _func, const char* _file, int _line);
+
+#ifdef __GNUC__
+# if defined __clang__ || defined __APPLE__
+#   pragma GCC diagnostic push
+#   pragma GCC diagnostic ignored "-Winvalid-noreturn"
+# endif
+#endif
+
+/** same as cv::error, but does not return */
+CV_INLINE CV_NORETURN void errorNoReturn(int _code, const String& _err, const char* _func, const char* _file, int _line)
+{
+    error(_code, _err, _func, _file, _line);
+#ifdef __GNUC__
+# if !defined __clang__ && !defined __APPLE__
+    // this suppresses this warning: "noreturn" function does return [enabled by default]
+    __builtin_trap();
+    // or use infinite loop: for (;;) {}
+# endif
+#endif
+}
+#ifdef __GNUC__
+# if defined __clang__ || defined __APPLE__
+#   pragma GCC diagnostic pop
+# endif
+#endif
+
+#if defined __GNUC__
+#define CV_Func __func__
+#elif defined _MSC_VER
+#define CV_Func __FUNCTION__
+#else
+#define CV_Func ""
+#endif
+
+/** @brief Call the error handler.
+
+Currently, the error handler prints the error code and the error message to the standard
+error stream `stderr`. In the Debug configuration, it then provokes memory access violation, so that
+the execution stack and all the parameters can be analyzed by the debugger. In the Release
+configuration, the exception is thrown.
+
+@param code one of Error::Code
+@param msg error message
+*/
+#define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
+
+/**  @brief Call the error handler.
+
+This macro can be used to construct an error message on-fly to include some dynamic information,
+for example:
+@code
+    // note the extra parentheses around the formatted text message
+    CV_Error_( CV_StsOutOfRange,
+    ("the value at (%d, %d)=%g is out of range", badPt.x, badPt.y, badValue));
+@endcode
+@param code one of Error::Code
+@param args printf-like formatted error message in parentheses
+*/
+#define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ )
+
+/** @brief Checks a condition at runtime and throws exception if it fails
+
+The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression. If it is 0, the macros
+raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release
+configurations while CV_DbgAssert is only retained in the Debug configuration.
+*/
+#define CV_Assert( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
+
+/** same as CV_Error(code,msg), but does not return */
+#define CV_ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
+
+/** same as CV_Error_(code,args), but does not return */
+#define CV_ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
+
+/** replaced with CV_Assert(expr) in Debug configuration */
+#ifdef _DEBUG
+#  define CV_DbgAssert(expr) CV_Assert(expr)
+#else
+#  define CV_DbgAssert(expr)
+#endif
+
+/*
+ * Hamming distance functor - counts the bit differences between two strings - useful for the Brief descriptor
+ * bit count of A exclusive XOR'ed with B
+ */
+struct CV_EXPORTS Hamming
+{
+    enum { normType = NORM_HAMMING };
+    typedef unsigned char ValueType;
+    typedef int ResultType;
+
+    /** this will count the bits in a ^ b
+     */
+    ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const;
+};
+
+typedef Hamming HammingLUT;
+
+/////////////////////////////////// inline norms ////////////////////////////////////
+
+template<typename _Tp> inline _Tp cv_abs(_Tp x) { return std::abs(x); }
+inline int cv_abs(uchar x) { return x; }
+inline int cv_abs(schar x) { return std::abs(x); }
+inline int cv_abs(ushort x) { return x; }
+inline int cv_abs(short x) { return std::abs(x); }
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normL2Sqr(const _Tp* a, int n)
+{
+    _AccTp s = 0;
+    int i=0;
+#if CV_ENABLE_UNROLLED
+    for( ; i <= n - 4; i += 4 )
+    {
+        _AccTp v0 = a[i], v1 = a[i+1], v2 = a[i+2], v3 = a[i+3];
+        s += v0*v0 + v1*v1 + v2*v2 + v3*v3;
+    }
+#endif
+    for( ; i < n; i++ )
+    {
+        _AccTp v = a[i];
+        s += v*v;
+    }
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normL1(const _Tp* a, int n)
+{
+    _AccTp s = 0;
+    int i = 0;
+#if CV_ENABLE_UNROLLED
+    for(; i <= n - 4; i += 4 )
+    {
+        s += (_AccTp)cv_abs(a[i]) + (_AccTp)cv_abs(a[i+1]) +
+            (_AccTp)cv_abs(a[i+2]) + (_AccTp)cv_abs(a[i+3]);
+    }
+#endif
+    for( ; i < n; i++ )
+        s += cv_abs(a[i]);
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normInf(const _Tp* a, int n)
+{
+    _AccTp s = 0;
+    for( int i = 0; i < n; i++ )
+        s = std::max(s, (_AccTp)cv_abs(a[i]));
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normL2Sqr(const _Tp* a, const _Tp* b, int n)
+{
+    _AccTp s = 0;
+    int i= 0;
+#if CV_ENABLE_UNROLLED
+    for(; i <= n - 4; i += 4 )
+    {
+        _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]);
+        s += v0*v0 + v1*v1 + v2*v2 + v3*v3;
+    }
+#endif
+    for( ; i < n; i++ )
+    {
+        _AccTp v = _AccTp(a[i] - b[i]);
+        s += v*v;
+    }
+    return s;
+}
+
+static inline float normL2Sqr(const float* a, const float* b, int n)
+{
+    float s = 0.f;
+    for( int i = 0; i < n; i++ )
+    {
+        float v = a[i] - b[i];
+        s += v*v;
+    }
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normL1(const _Tp* a, const _Tp* b, int n)
+{
+    _AccTp s = 0;
+    int i= 0;
+#if CV_ENABLE_UNROLLED
+    for(; i <= n - 4; i += 4 )
+    {
+        _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]);
+        s += std::abs(v0) + std::abs(v1) + std::abs(v2) + std::abs(v3);
+    }
+#endif
+    for( ; i < n; i++ )
+    {
+        _AccTp v = _AccTp(a[i] - b[i]);
+        s += std::abs(v);
+    }
+    return s;
+}
+
+inline float normL1(const float* a, const float* b, int n)
+{
+    float s = 0.f;
+    for( int i = 0; i < n; i++ )
+    {
+        s += std::abs(a[i] - b[i]);
+    }
+    return s;
+}
+
+inline int normL1(const uchar* a, const uchar* b, int n)
+{
+    int s = 0;
+    for( int i = 0; i < n; i++ )
+    {
+        s += std::abs(a[i] - b[i]);
+    }
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normInf(const _Tp* a, const _Tp* b, int n)
+{
+    _AccTp s = 0;
+    for( int i = 0; i < n; i++ )
+    {
+        _AccTp v0 = a[i] - b[i];
+        s = std::max(s, std::abs(v0));
+    }
+    return s;
+}
+
+/** @brief Computes the cube root of an argument.
+
+ The function cubeRoot computes \f$\sqrt[3]{\texttt{val}}\f$. Negative arguments are handled correctly.
+ NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for
+ single-precision data.
+ @param val A function argument.
+ */
+CV_EXPORTS_W float cubeRoot(float val);
+
+/** @brief Calculates the angle of a 2D vector in degrees.
+
+ The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured
+ in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees.
+ @param x x-coordinate of the vector.
+ @param y y-coordinate of the vector.
+ */
+CV_EXPORTS_W float fastAtan2(float y, float x);
+
+/** proxy for hal::LU */
+CV_EXPORTS int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+/** proxy for hal::LU */
+CV_EXPORTS int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+/** proxy for hal::Cholesky */
+CV_EXPORTS bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+/** proxy for hal::Cholesky */
+CV_EXPORTS bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+
+////////////////// forward declarations for important OpenCV types //////////////////
+
+//! @cond IGNORED
+
+template<typename _Tp, int cn> class Vec;
+template<typename _Tp, int m, int n> class Matx;
+
+template<typename _Tp> class Complex;
+template<typename _Tp> class Point_;
+template<typename _Tp> class Point3_;
+template<typename _Tp> class Size_;
+template<typename _Tp> class Rect_;
+template<typename _Tp> class Scalar_;
+
+class CV_EXPORTS RotatedRect;
+class CV_EXPORTS Range;
+class CV_EXPORTS TermCriteria;
+class CV_EXPORTS KeyPoint;
+class CV_EXPORTS DMatch;
+class CV_EXPORTS RNG;
+
+class CV_EXPORTS Mat;
+class CV_EXPORTS MatExpr;
+
+class CV_EXPORTS UMat;
+
+class CV_EXPORTS SparseMat;
+typedef Mat MatND;
+
+template<typename _Tp> class Mat_;
+template<typename _Tp> class SparseMat_;
+
+class CV_EXPORTS MatConstIterator;
+class CV_EXPORTS SparseMatIterator;
+class CV_EXPORTS SparseMatConstIterator;
+template<typename _Tp> class MatIterator_;
+template<typename _Tp> class MatConstIterator_;
+template<typename _Tp> class SparseMatIterator_;
+template<typename _Tp> class SparseMatConstIterator_;
+
+namespace ogl
+{
+    class CV_EXPORTS Buffer;
+    class CV_EXPORTS Texture2D;
+    class CV_EXPORTS Arrays;
+}
+
+namespace cuda
+{
+    class CV_EXPORTS GpuMat;
+    class CV_EXPORTS HostMem;
+    class CV_EXPORTS Stream;
+    class CV_EXPORTS Event;
+}
+
+namespace cudev
+{
+    template <typename _Tp> class GpuMat_;
+}
+
+namespace ipp
+{
+CV_EXPORTS int getIppFeatures();
+CV_EXPORTS void setIppStatus(int status, const char * const funcname = NULL, const char * const filename = NULL,
+                             int line = 0);
+CV_EXPORTS int getIppStatus();
+CV_EXPORTS String getIppErrorLocation();
+CV_EXPORTS bool useIPP();
+CV_EXPORTS void setUseIPP(bool flag);
+
+} // ipp
+
+//! @endcond
+
+//! @} core_utils
+
+
+
+
+} // cv
+
+#include "opencv2/core/neon_utils.hpp"
+
+#endif //__OPENCV_CORE_BASE_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp
new file mode 100644
index 0000000..76df2d2
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp
@@ -0,0 +1,31 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
+
+#ifndef __OPENCV_CORE_BUFFER_POOL_HPP__
+#define __OPENCV_CORE_BUFFER_POOL_HPP__
+
+namespace cv
+{
+
+//! @addtogroup core
+//! @{
+
+class BufferPoolController
+{
+protected:
+    ~BufferPoolController() { }
+public:
+    virtual size_t getReservedSize() const = 0;
+    virtual size_t getMaxReservedSize() const = 0;
+    virtual void setMaxReservedSize(size_t size) = 0;
+    virtual void freeAllReservedBuffers() = 0;
+};
+
+//! @}
+
+}
+
+#endif // __OPENCV_CORE_BUFFER_POOL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core.hpp
new file mode 100644
index 0000000..4389183
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/core.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core_c.h
new file mode 100644
index 0000000..a0ed632
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/core_c.h
@@ -0,0 +1,3152 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+
+#ifndef __OPENCV_CORE_C_H__
+#define __OPENCV_CORE_C_H__
+
+#include "opencv2/core/types_c.h"
+
+#ifdef __cplusplus
+#  ifdef _MSC_VER
+/* disable warning C4190: 'function' has C-linkage specified, but returns UDT 'typename'
+                          which is incompatible with C
+
+   It is OK to disable it because we only extend few plain structures with
+   C++ construrtors for simpler interoperability with C++ API of the library
+*/
+#    pragma warning(disable:4190)
+#  elif defined __clang__ && __clang_major__ >= 3
+#    pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup core_c
+    @{
+*/
+
+/****************************************************************************************\
+*          Array allocation, deallocation, initialization and access to elements         *
+\****************************************************************************************/
+
+/** `malloc` wrapper.
+   If there is no enough memory, the function
+   (as well as other OpenCV functions that call cvAlloc)
+   raises an error. */
+CVAPI(void*)  cvAlloc( size_t size );
+
+/** `free` wrapper.
+   Here and further all the memory releasing functions
+   (that all call cvFree) take double pointer in order to
+   to clear pointer to the data after releasing it.
+   Passing pointer to NULL pointer is Ok: nothing happens in this case
+*/
+CVAPI(void)   cvFree_( void* ptr );
+#define cvFree(ptr) (cvFree_(*(ptr)), *(ptr)=0)
+
+/** @brief Creates an image header but does not allocate the image data.
+
+@param size Image width and height
+@param depth Image depth (see cvCreateImage )
+@param channels Number of channels (see cvCreateImage )
+ */
+CVAPI(IplImage*)  cvCreateImageHeader( CvSize size, int depth, int channels );
+
+/** @brief Initializes an image header that was previously allocated.
+
+The returned IplImage\* points to the initialized header.
+@param image Image header to initialize
+@param size Image width and height
+@param depth Image depth (see cvCreateImage )
+@param channels Number of channels (see cvCreateImage )
+@param origin Top-left IPL_ORIGIN_TL or bottom-left IPL_ORIGIN_BL
+@param align Alignment for image rows, typically 4 or 8 bytes
+ */
+CVAPI(IplImage*) cvInitImageHeader( IplImage* image, CvSize size, int depth,
+                                   int channels, int origin CV_DEFAULT(0),
+                                   int align CV_DEFAULT(4));
+
+/** @brief Creates an image header and allocates the image data.
+
+This function call is equivalent to the following code:
+@code
+    header = cvCreateImageHeader(size, depth, channels);
+    cvCreateData(header);
+@endcode
+@param size Image width and height
+@param depth Bit depth of image elements. See IplImage for valid depths.
+@param channels Number of channels per pixel. See IplImage for details. This function only creates
+images with interleaved channels.
+ */
+CVAPI(IplImage*)  cvCreateImage( CvSize size, int depth, int channels );
+
+/** @brief Deallocates an image header.
+
+This call is an analogue of :
+@code
+    if(image )
+    {
+        iplDeallocate(*image, IPL_IMAGE_HEADER | IPL_IMAGE_ROI);
+        *image = 0;
+    }
+@endcode
+but it does not use IPL functions by default (see the CV_TURN_ON_IPL_COMPATIBILITY macro).
+@param image Double pointer to the image header
+ */
+CVAPI(void)  cvReleaseImageHeader( IplImage** image );
+
+/** @brief Deallocates the image header and the image data.
+
+This call is a shortened form of :
+@code
+    if(*image )
+    {
+        cvReleaseData(*image);
+        cvReleaseImageHeader(image);
+    }
+@endcode
+@param image Double pointer to the image header
+*/
+CVAPI(void)  cvReleaseImage( IplImage** image );
+
+/** Creates a copy of IPL image (widthStep may differ) */
+CVAPI(IplImage*) cvCloneImage( const IplImage* image );
+
+/** @brief Sets the channel of interest in an IplImage.
+
+If the ROI is set to NULL and the coi is *not* 0, the ROI is allocated. Most OpenCV functions do
+*not* support the COI setting, so to process an individual image/matrix channel one may copy (via
+cvCopy or cvSplit) the channel to a separate image/matrix, process it and then copy the result
+back (via cvCopy or cvMerge) if needed.
+@param image A pointer to the image header
+@param coi The channel of interest. 0 - all channels are selected, 1 - first channel is selected,
+etc. Note that the channel indices become 1-based.
+ */
+CVAPI(void)  cvSetImageCOI( IplImage* image, int coi );
+
+/** @brief Returns the index of the channel of interest.
+
+Returns the channel of interest of in an IplImage. Returned values correspond to the coi in
+cvSetImageCOI.
+@param image A pointer to the image header
+ */
+CVAPI(int)  cvGetImageCOI( const IplImage* image );
+
+/** @brief Sets an image Region Of Interest (ROI) for a given rectangle.
+
+If the original image ROI was NULL and the rect is not the whole image, the ROI structure is
+allocated.
+
+Most OpenCV functions support the use of ROI and treat the image rectangle as a separate image. For
+example, all of the pixel coordinates are counted from the top-left (or bottom-left) corner of the
+ROI, not the original image.
+@param image A pointer to the image header
+@param rect The ROI rectangle
+ */
+CVAPI(void)  cvSetImageROI( IplImage* image, CvRect rect );
+
+/** @brief Resets the image ROI to include the entire image and releases the ROI structure.
+
+This produces a similar result to the following, but in addition it releases the ROI structure. :
+@code
+    cvSetImageROI(image, cvRect(0, 0, image->width, image->height ));
+    cvSetImageCOI(image, 0);
+@endcode
+@param image A pointer to the image header
+ */
+CVAPI(void)  cvResetImageROI( IplImage* image );
+
+/** @brief Returns the image ROI.
+
+If there is no ROI set, cvRect(0,0,image-\>width,image-\>height) is returned.
+@param image A pointer to the image header
+ */
+CVAPI(CvRect) cvGetImageROI( const IplImage* image );
+
+/** @brief Creates a matrix header but does not allocate the matrix data.
+
+The function allocates a new matrix header and returns a pointer to it. The matrix data can then be
+allocated using cvCreateData or set explicitly to user-allocated data via cvSetData.
+@param rows Number of rows in the matrix
+@param cols Number of columns in the matrix
+@param type Type of the matrix elements, see cvCreateMat
+ */
+CVAPI(CvMat*)  cvCreateMatHeader( int rows, int cols, int type );
+
+#define CV_AUTOSTEP  0x7fffffff
+
+/** @brief Initializes a pre-allocated matrix header.
+
+This function is often used to process raw data with OpenCV matrix functions. For example, the
+following code computes the matrix product of two matrices, stored as ordinary arrays:
+@code
+    double a[] = { 1, 2, 3, 4,
+                   5, 6, 7, 8,
+                   9, 10, 11, 12 };
+
+    double b[] = { 1, 5, 9,
+                   2, 6, 10,
+                   3, 7, 11,
+                   4, 8, 12 };
+
+    double c[9];
+    CvMat Ma, Mb, Mc ;
+
+    cvInitMatHeader(&Ma, 3, 4, CV_64FC1, a);
+    cvInitMatHeader(&Mb, 4, 3, CV_64FC1, b);
+    cvInitMatHeader(&Mc, 3, 3, CV_64FC1, c);
+
+    cvMatMulAdd(&Ma, &Mb, 0, &Mc);
+    // the c array now contains the product of a (3x4) and b (4x3)
+@endcode
+@param mat A pointer to the matrix header to be initialized
+@param rows Number of rows in the matrix
+@param cols Number of columns in the matrix
+@param type Type of the matrix elements, see cvCreateMat .
+@param data Optional: data pointer assigned to the matrix header
+@param step Optional: full row width in bytes of the assigned data. By default, the minimal
+possible step is used which assumes there are no gaps between subsequent rows of the matrix.
+ */
+CVAPI(CvMat*) cvInitMatHeader( CvMat* mat, int rows, int cols,
+                              int type, void* data CV_DEFAULT(NULL),
+                              int step CV_DEFAULT(CV_AUTOSTEP) );
+
+/** @brief Creates a matrix header and allocates the matrix data.
+
+The function call is equivalent to the following code:
+@code
+    CvMat* mat = cvCreateMatHeader(rows, cols, type);
+    cvCreateData(mat);
+@endcode
+@param rows Number of rows in the matrix
+@param cols Number of columns in the matrix
+@param type The type of the matrix elements in the form
+CV_\<bit depth\>\<S|U|F\>C\<number of channels\> , where S=signed, U=unsigned, F=float. For
+example, CV _ 8UC1 means the elements are 8-bit unsigned and the there is 1 channel, and CV _
+32SC2 means the elements are 32-bit signed and there are 2 channels.
+ */
+CVAPI(CvMat*)  cvCreateMat( int rows, int cols, int type );
+
+/** @brief Deallocates a matrix.
+
+The function decrements the matrix data reference counter and deallocates matrix header. If the data
+reference counter is 0, it also deallocates the data. :
+@code
+    if(*mat )
+        cvDecRefData(*mat);
+    cvFree((void**)mat);
+@endcode
+@param mat Double pointer to the matrix
+ */
+CVAPI(void)  cvReleaseMat( CvMat** mat );
+
+/** @brief Decrements an array data reference counter.
+
+The function decrements the data reference counter in a CvMat or CvMatND if the reference counter
+
+pointer is not NULL. If the counter reaches zero, the data is deallocated. In the current
+implementation the reference counter is not NULL only if the data was allocated using the
+cvCreateData function. The counter will be NULL in other cases such as: external data was assigned
+to the header using cvSetData, header is part of a larger matrix or image, or the header was
+converted from an image or n-dimensional matrix header.
+@param arr Pointer to an array header
+ */
+CV_INLINE  void  cvDecRefData( CvArr* arr )
+{
+    if( CV_IS_MAT( arr ))
+    {
+        CvMat* mat = (CvMat*)arr;
+        mat->data.ptr = NULL;
+        if( mat->refcount != NULL && --*mat->refcount == 0 )
+            cvFree( &mat->refcount );
+        mat->refcount = NULL;
+    }
+    else if( CV_IS_MATND( arr ))
+    {
+        CvMatND* mat = (CvMatND*)arr;
+        mat->data.ptr = NULL;
+        if( mat->refcount != NULL && --*mat->refcount == 0 )
+            cvFree( &mat->refcount );
+        mat->refcount = NULL;
+    }
+}
+
+/** @brief Increments array data reference counter.
+
+The function increments CvMat or CvMatND data reference counter and returns the new counter value if
+the reference counter pointer is not NULL, otherwise it returns zero.
+@param arr Array header
+ */
+CV_INLINE  int  cvIncRefData( CvArr* arr )
+{
+    int refcount = 0;
+    if( CV_IS_MAT( arr ))
+    {
+        CvMat* mat = (CvMat*)arr;
+        if( mat->refcount != NULL )
+            refcount = ++*mat->refcount;
+    }
+    else if( CV_IS_MATND( arr ))
+    {
+        CvMatND* mat = (CvMatND*)arr;
+        if( mat->refcount != NULL )
+            refcount = ++*mat->refcount;
+    }
+    return refcount;
+}
+
+
+/** Creates an exact copy of the input matrix (except, may be, step value) */
+CVAPI(CvMat*) cvCloneMat( const CvMat* mat );
+
+
+/** @brief Returns matrix header corresponding to the rectangular sub-array of input image or matrix.
+
+The function returns header, corresponding to a specified rectangle of the input array. In other
+
+words, it allows the user to treat a rectangular part of input array as a stand-alone array. ROI is
+taken into account by the function so the sub-array of ROI is actually extracted.
+@param arr Input array
+@param submat Pointer to the resultant sub-array header
+@param rect Zero-based coordinates of the rectangle of interest
+ */
+CVAPI(CvMat*) cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect );
+#define cvGetSubArr cvGetSubRect
+
+/** @brief Returns array row or row span.
+
+The functions return the header, corresponding to a specified row/row span of the input array.
+cvGetRow(arr, submat, row) is a shortcut for cvGetRows(arr, submat, row, row+1).
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param start_row Zero-based index of the starting row (inclusive) of the span
+@param end_row Zero-based index of the ending row (exclusive) of the span
+@param delta_row Index step in the row span. That is, the function extracts every delta_row -th
+row from start_row and up to (but not including) end_row .
+ */
+CVAPI(CvMat*) cvGetRows( const CvArr* arr, CvMat* submat,
+                        int start_row, int end_row,
+                        int delta_row CV_DEFAULT(1));
+
+/** @overload
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param row Zero-based index of the selected row
+*/
+CV_INLINE  CvMat*  cvGetRow( const CvArr* arr, CvMat* submat, int row )
+{
+    return cvGetRows( arr, submat, row, row + 1, 1 );
+}
+
+
+/** @brief Returns one of more array columns.
+
+The functions return the header, corresponding to a specified column span of the input array. That
+
+is, no data is copied. Therefore, any modifications of the submatrix will affect the original array.
+If you need to copy the columns, use cvCloneMat. cvGetCol(arr, submat, col) is a shortcut for
+cvGetCols(arr, submat, col, col+1).
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param start_col Zero-based index of the starting column (inclusive) of the span
+@param end_col Zero-based index of the ending column (exclusive) of the span
+ */
+CVAPI(CvMat*) cvGetCols( const CvArr* arr, CvMat* submat,
+                        int start_col, int end_col );
+
+/** @overload
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param col Zero-based index of the selected column
+*/
+CV_INLINE  CvMat*  cvGetCol( const CvArr* arr, CvMat* submat, int col )
+{
+    return cvGetCols( arr, submat, col, col + 1 );
+}
+
+/** @brief Returns one of array diagonals.
+
+The function returns the header, corresponding to a specified diagonal of the input array.
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param diag Index of the array diagonal. Zero value corresponds to the main diagonal, -1
+corresponds to the diagonal above the main, 1 corresponds to the diagonal below the main, and so
+forth.
+ */
+CVAPI(CvMat*) cvGetDiag( const CvArr* arr, CvMat* submat,
+                            int diag CV_DEFAULT(0));
+
+/** low-level scalar <-> raw data conversion functions */
+CVAPI(void) cvScalarToRawData( const CvScalar* scalar, void* data, int type,
+                              int extend_to_12 CV_DEFAULT(0) );
+
+CVAPI(void) cvRawDataToScalar( const void* data, int type, CvScalar* scalar );
+
+/** @brief Creates a new matrix header but does not allocate the matrix data.
+
+The function allocates a header for a multi-dimensional dense array. The array data can further be
+allocated using cvCreateData or set explicitly to user-allocated data via cvSetData.
+@param dims Number of array dimensions
+@param sizes Array of dimension sizes
+@param type Type of array elements, see cvCreateMat
+ */
+CVAPI(CvMatND*)  cvCreateMatNDHeader( int dims, const int* sizes, int type );
+
+/** @brief Creates the header and allocates the data for a multi-dimensional dense array.
+
+This function call is equivalent to the following code:
+@code
+    CvMatND* mat = cvCreateMatNDHeader(dims, sizes, type);
+    cvCreateData(mat);
+@endcode
+@param dims Number of array dimensions. This must not exceed CV_MAX_DIM (32 by default, but can be
+changed at build time).
+@param sizes Array of dimension sizes.
+@param type Type of array elements, see cvCreateMat .
+ */
+CVAPI(CvMatND*)  cvCreateMatND( int dims, const int* sizes, int type );
+
+/** @brief Initializes a pre-allocated multi-dimensional array header.
+
+@param mat A pointer to the array header to be initialized
+@param dims The number of array dimensions
+@param sizes An array of dimension sizes
+@param type Type of array elements, see cvCreateMat
+@param data Optional data pointer assigned to the matrix header
+ */
+CVAPI(CvMatND*)  cvInitMatNDHeader( CvMatND* mat, int dims, const int* sizes,
+                                    int type, void* data CV_DEFAULT(NULL) );
+
+/** @brief Deallocates a multi-dimensional array.
+
+The function decrements the array data reference counter and releases the array header. If the
+reference counter reaches 0, it also deallocates the data. :
+@code
+    if(*mat )
+        cvDecRefData(*mat);
+    cvFree((void**)mat);
+@endcode
+@param mat Double pointer to the array
+ */
+CV_INLINE  void  cvReleaseMatND( CvMatND** mat )
+{
+    cvReleaseMat( (CvMat**)mat );
+}
+
+/** Creates a copy of CvMatND (except, may be, steps) */
+CVAPI(CvMatND*) cvCloneMatND( const CvMatND* mat );
+
+/** @brief Creates sparse array.
+
+The function allocates a multi-dimensional sparse array. Initially the array contain no elements,
+that is PtrND and other related functions will return 0 for every index.
+@param dims Number of array dimensions. In contrast to the dense matrix, the number of dimensions is
+practically unlimited (up to \f$2^{16}\f$ ).
+@param sizes Array of dimension sizes
+@param type Type of array elements. The same as for CvMat
+ */
+CVAPI(CvSparseMat*)  cvCreateSparseMat( int dims, const int* sizes, int type );
+
+/** @brief Deallocates sparse array.
+
+The function releases the sparse array and clears the array pointer upon exit.
+@param mat Double pointer to the array
+ */
+CVAPI(void)  cvReleaseSparseMat( CvSparseMat** mat );
+
+/** Creates a copy of CvSparseMat (except, may be, zero items) */
+CVAPI(CvSparseMat*) cvCloneSparseMat( const CvSparseMat* mat );
+
+/** @brief Initializes sparse array elements iterator.
+
+The function initializes iterator of sparse array elements and returns pointer to the first element,
+or NULL if the array is empty.
+@param mat Input array
+@param mat_iterator Initialized iterator
+ */
+CVAPI(CvSparseNode*) cvInitSparseMatIterator( const CvSparseMat* mat,
+                                              CvSparseMatIterator* mat_iterator );
+
+/** @brief Returns the next sparse matrix element
+
+The function moves iterator to the next sparse matrix element and returns pointer to it. In the
+current version there is no any particular order of the elements, because they are stored in the
+hash table. The sample below demonstrates how to iterate through the sparse matrix:
+@code
+    // print all the non-zero sparse matrix elements and compute their sum
+    double sum = 0;
+    int i, dims = cvGetDims(sparsemat);
+    CvSparseMatIterator it;
+    CvSparseNode* node = cvInitSparseMatIterator(sparsemat, &it);
+
+    for(; node != 0; node = cvGetNextSparseNode(&it))
+    {
+        int* idx = CV_NODE_IDX(array, node);
+        float val = *(float*)CV_NODE_VAL(array, node);
+        printf("M");
+        for(i = 0; i < dims; i++ )
+            printf("[%d]", idx[i]);
+        printf("=%g\n", val);
+
+        sum += val;
+    }
+
+    printf("nTotal sum = %g\n", sum);
+@endcode
+@param mat_iterator Sparse array iterator
+ */
+CV_INLINE CvSparseNode* cvGetNextSparseNode( CvSparseMatIterator* mat_iterator )
+{
+    if( mat_iterator->node->next )
+        return mat_iterator->node = mat_iterator->node->next;
+    else
+    {
+        int idx;
+        for( idx = ++mat_iterator->curidx; idx < mat_iterator->mat->hashsize; idx++ )
+        {
+            CvSparseNode* node = (CvSparseNode*)mat_iterator->mat->hashtable[idx];
+            if( node )
+            {
+                mat_iterator->curidx = idx;
+                return mat_iterator->node = node;
+            }
+        }
+        return NULL;
+    }
+}
+
+
+#define CV_MAX_ARR 10
+
+/** matrix iterator: used for n-ary operations on dense arrays */
+typedef struct CvNArrayIterator
+{
+    int count; /**< number of arrays */
+    int dims; /**< number of dimensions to iterate */
+    CvSize size; /**< maximal common linear size: { width = size, height = 1 } */
+    uchar* ptr[CV_MAX_ARR]; /**< pointers to the array slices */
+    int stack[CV_MAX_DIM]; /**< for internal use */
+    CvMatND* hdr[CV_MAX_ARR]; /**< pointers to the headers of the
+                                 matrices that are processed */
+}
+CvNArrayIterator;
+
+#define CV_NO_DEPTH_CHECK     1
+#define CV_NO_CN_CHECK        2
+#define CV_NO_SIZE_CHECK      4
+
+/** initializes iterator that traverses through several arrays simulteneously
+   (the function together with cvNextArraySlice is used for
+    N-ari element-wise operations) */
+CVAPI(int) cvInitNArrayIterator( int count, CvArr** arrs,
+                                 const CvArr* mask, CvMatND* stubs,
+                                 CvNArrayIterator* array_iterator,
+                                 int flags CV_DEFAULT(0) );
+
+/** returns zero value if iteration is finished, non-zero (slice length) otherwise */
+CVAPI(int) cvNextNArraySlice( CvNArrayIterator* array_iterator );
+
+
+/** @brief Returns type of array elements.
+
+The function returns type of the array elements. In the case of IplImage the type is converted to
+CvMat-like representation. For example, if the image has been created as:
+@code
+    IplImage* img = cvCreateImage(cvSize(640, 480), IPL_DEPTH_8U, 3);
+@endcode
+The code cvGetElemType(img) will return CV_8UC3.
+@param arr Input array
+ */
+CVAPI(int) cvGetElemType( const CvArr* arr );
+
+/** @brief Return number of array dimensions
+
+The function returns the array dimensionality and the array of dimension sizes. In the case of
+IplImage or CvMat it always returns 2 regardless of number of image/matrix rows. For example, the
+following code calculates total number of array elements:
+@code
+    int sizes[CV_MAX_DIM];
+    int i, total = 1;
+    int dims = cvGetDims(arr, size);
+    for(i = 0; i < dims; i++ )
+        total *= sizes[i];
+@endcode
+@param arr Input array
+@param sizes Optional output vector of the array dimension sizes. For 2d arrays the number of rows
+(height) goes first, number of columns (width) next.
+ */
+CVAPI(int) cvGetDims( const CvArr* arr, int* sizes CV_DEFAULT(NULL) );
+
+
+/** @brief Returns array size along the specified dimension.
+
+@param arr Input array
+@param index Zero-based dimension index (for matrices 0 means number of rows, 1 means number of
+columns; for images 0 means height, 1 means width)
+ */
+CVAPI(int) cvGetDimSize( const CvArr* arr, int index );
+
+
+/** @brief Return pointer to a particular array element.
+
+The functions return a pointer to a specific array element. Number of array dimension should match
+to the number of indices passed to the function except for cvPtr1D function that can be used for
+sequential access to 1D, 2D or nD dense arrays.
+
+The functions can be used for sparse arrays as well - if the requested node does not exist they
+create it and set it to zero.
+
+All these as well as other functions accessing array elements ( cvGetND , cvGetRealND , cvSet
+, cvSetND , cvSetRealND ) raise an error in case if the element index is out of range.
+@param arr Input array
+@param idx0 The first zero-based component of the element index
+@param type Optional output parameter: type of matrix elements
+ */
+CVAPI(uchar*) cvPtr1D( const CvArr* arr, int idx0, int* type CV_DEFAULT(NULL));
+/** @overload */
+CVAPI(uchar*) cvPtr2D( const CvArr* arr, int idx0, int idx1, int* type CV_DEFAULT(NULL) );
+/** @overload */
+CVAPI(uchar*) cvPtr3D( const CvArr* arr, int idx0, int idx1, int idx2,
+                      int* type CV_DEFAULT(NULL));
+/** @overload
+@param arr Input array
+@param idx Array of the element indices
+@param type Optional output parameter: type of matrix elements
+@param create_node Optional input parameter for sparse matrices. Non-zero value of the parameter
+means that the requested element is created if it does not exist already.
+@param precalc_hashval Optional input parameter for sparse matrices. If the pointer is not NULL,
+the function does not recalculate the node hash value, but takes it from the specified location.
+It is useful for speeding up pair-wise operations (TODO: provide an example)
+*/
+CVAPI(uchar*) cvPtrND( const CvArr* arr, const int* idx, int* type CV_DEFAULT(NULL),
+                      int create_node CV_DEFAULT(1),
+                      unsigned* precalc_hashval CV_DEFAULT(NULL));
+
+/** @brief Return a specific array element.
+
+The functions return a specific array element. In the case of a sparse array the functions return 0
+if the requested node does not exist (no new node is created by the functions).
+@param arr Input array
+@param idx0 The first zero-based component of the element index
+ */
+CVAPI(CvScalar) cvGet1D( const CvArr* arr, int idx0 );
+/** @overload */
+CVAPI(CvScalar) cvGet2D( const CvArr* arr, int idx0, int idx1 );
+/** @overload */
+CVAPI(CvScalar) cvGet3D( const CvArr* arr, int idx0, int idx1, int idx2 );
+/** @overload
+@param arr Input array
+@param idx Array of the element indices
+*/
+CVAPI(CvScalar) cvGetND( const CvArr* arr, const int* idx );
+
+/** @brief Return a specific element of single-channel 1D, 2D, 3D or nD array.
+
+Returns a specific element of a single-channel array. If the array has multiple channels, a runtime
+error is raised. Note that Get?D functions can be used safely for both single-channel and
+multiple-channel arrays though they are a bit slower.
+
+In the case of a sparse array the functions return 0 if the requested node does not exist (no new
+node is created by the functions).
+@param arr Input array. Must have a single channel.
+@param idx0 The first zero-based component of the element index
+ */
+CVAPI(double) cvGetReal1D( const CvArr* arr, int idx0 );
+/** @overload */
+CVAPI(double) cvGetReal2D( const CvArr* arr, int idx0, int idx1 );
+/** @overload */
+CVAPI(double) cvGetReal3D( const CvArr* arr, int idx0, int idx1, int idx2 );
+/** @overload
+@param arr Input array. Must have a single channel.
+@param idx Array of the element indices
+*/
+CVAPI(double) cvGetRealND( const CvArr* arr, const int* idx );
+
+/** @brief Change the particular array element.
+
+The functions assign the new value to a particular array element. In the case of a sparse array the
+functions create the node if it does not exist yet.
+@param arr Input array
+@param idx0 The first zero-based component of the element index
+@param value The assigned value
+ */
+CVAPI(void) cvSet1D( CvArr* arr, int idx0, CvScalar value );
+/** @overload */
+CVAPI(void) cvSet2D( CvArr* arr, int idx0, int idx1, CvScalar value );
+/** @overload */
+CVAPI(void) cvSet3D( CvArr* arr, int idx0, int idx1, int idx2, CvScalar value );
+/** @overload
+@param arr Input array
+@param idx Array of the element indices
+@param value The assigned value
+*/
+CVAPI(void) cvSetND( CvArr* arr, const int* idx, CvScalar value );
+
+/** @brief Change a specific array element.
+
+The functions assign a new value to a specific element of a single-channel array. If the array has
+multiple channels, a runtime error is raised. Note that the Set\*D function can be used safely for
+both single-channel and multiple-channel arrays, though they are a bit slower.
+
+In the case of a sparse array the functions create the node if it does not yet exist.
+@param arr Input array
+@param idx0 The first zero-based component of the element index
+@param value The assigned value
+ */
+CVAPI(void) cvSetReal1D( CvArr* arr, int idx0, double value );
+/** @overload */
+CVAPI(void) cvSetReal2D( CvArr* arr, int idx0, int idx1, double value );
+/** @overload */
+CVAPI(void) cvSetReal3D( CvArr* arr, int idx0,
+                        int idx1, int idx2, double value );
+/** @overload
+@param arr Input array
+@param idx Array of the element indices
+@param value The assigned value
+*/
+CVAPI(void) cvSetRealND( CvArr* arr, const int* idx, double value );
+
+/** clears element of ND dense array,
+   in case of sparse arrays it deletes the specified node */
+CVAPI(void) cvClearND( CvArr* arr, const int* idx );
+
+/** @brief Returns matrix header for arbitrary array.
+
+The function returns a matrix header for the input array that can be a matrix - CvMat, an image -
+IplImage, or a multi-dimensional dense array - CvMatND (the third option is allowed only if
+allowND != 0) . In the case of matrix the function simply returns the input pointer. In the case of
+IplImage\* or CvMatND it initializes the header structure with parameters of the current image ROI
+and returns &header. Because COI is not supported by CvMat, it is returned separately.
+
+The function provides an easy way to handle both types of arrays - IplImage and CvMat using the same
+code. Input array must have non-zero data pointer, otherwise the function will report an error.
+
+@note If the input array is IplImage with planar data layout and COI set, the function returns the
+pointer to the selected plane and COI == 0. This feature allows user to process IplImage structures
+with planar data layout, even though OpenCV does not support such images.
+@param arr Input array
+@param header Pointer to CvMat structure used as a temporary buffer
+@param coi Optional output parameter for storing COI
+@param allowND If non-zero, the function accepts multi-dimensional dense arrays (CvMatND\*) and
+returns 2D matrix (if CvMatND has two dimensions) or 1D matrix (when CvMatND has 1 dimension or
+more than 2 dimensions). The CvMatND array must be continuous.
+@sa cvGetImage, cvarrToMat.
+ */
+CVAPI(CvMat*) cvGetMat( const CvArr* arr, CvMat* header,
+                       int* coi CV_DEFAULT(NULL),
+                       int allowND CV_DEFAULT(0));
+
+/** @brief Returns image header for arbitrary array.
+
+The function returns the image header for the input array that can be a matrix (CvMat) or image
+(IplImage). In the case of an image the function simply returns the input pointer. In the case of
+CvMat it initializes an image_header structure with the parameters of the input matrix. Note that
+if we transform IplImage to CvMat using cvGetMat and then transform CvMat back to IplImage using
+this function, we will get different headers if the ROI is set in the original image.
+@param arr Input array
+@param image_header Pointer to IplImage structure used as a temporary buffer
+ */
+CVAPI(IplImage*) cvGetImage( const CvArr* arr, IplImage* image_header );
+
+
+/** @brief Changes the shape of a multi-dimensional array without copying the data.
+
+The function is an advanced version of cvReshape that can work with multi-dimensional arrays as
+well (though it can work with ordinary images and matrices) and change the number of dimensions.
+
+Below are the two samples from the cvReshape description rewritten using cvReshapeMatND:
+@code
+    IplImage* color_img = cvCreateImage(cvSize(320,240), IPL_DEPTH_8U, 3);
+    IplImage gray_img_hdr, *gray_img;
+    gray_img = (IplImage*)cvReshapeMatND(color_img, sizeof(gray_img_hdr), &gray_img_hdr, 1, 0, 0);
+    ...
+    int size[] = { 2, 2, 2 };
+    CvMatND* mat = cvCreateMatND(3, size, CV_32F);
+    CvMat row_header, *row;
+    row = (CvMat*)cvReshapeMatND(mat, sizeof(row_header), &row_header, 0, 1, 0);
+@endcode
+In C, the header file for this function includes a convenient macro cvReshapeND that does away with
+the sizeof_header parameter. So, the lines containing the call to cvReshapeMatND in the examples
+may be replaced as follow:
+@code
+    gray_img = (IplImage*)cvReshapeND(color_img, &gray_img_hdr, 1, 0, 0);
+    ...
+    row = (CvMat*)cvReshapeND(mat, &row_header, 0, 1, 0);
+@endcode
+@param arr Input array
+@param sizeof_header Size of output header to distinguish between IplImage, CvMat and CvMatND
+output headers
+@param header Output header to be filled
+@param new_cn New number of channels. new_cn = 0 means that the number of channels remains
+unchanged.
+@param new_dims New number of dimensions. new_dims = 0 means that the number of dimensions
+remains the same.
+@param new_sizes Array of new dimension sizes. Only new_dims-1 values are used, because the
+total number of elements must remain the same. Thus, if new_dims = 1, new_sizes array is not
+used.
+ */
+CVAPI(CvArr*) cvReshapeMatND( const CvArr* arr,
+                             int sizeof_header, CvArr* header,
+                             int new_cn, int new_dims, int* new_sizes );
+
+#define cvReshapeND( arr, header, new_cn, new_dims, new_sizes )   \
+      cvReshapeMatND( (arr), sizeof(*(header)), (header),         \
+                      (new_cn), (new_dims), (new_sizes))
+
+/** @brief Changes shape of matrix/image without copying data.
+
+The function initializes the CvMat header so that it points to the same data as the original array
+but has a different shape - different number of channels, different number of rows, or both.
+
+The following example code creates one image buffer and two image headers, the first is for a
+320x240x3 image and the second is for a 960x240x1 image:
+@code
+    IplImage* color_img = cvCreateImage(cvSize(320,240), IPL_DEPTH_8U, 3);
+    CvMat gray_mat_hdr;
+    IplImage gray_img_hdr, *gray_img;
+    cvReshape(color_img, &gray_mat_hdr, 1);
+    gray_img = cvGetImage(&gray_mat_hdr, &gray_img_hdr);
+@endcode
+And the next example converts a 3x3 matrix to a single 1x9 vector:
+@code
+    CvMat* mat = cvCreateMat(3, 3, CV_32F);
+    CvMat row_header, *row;
+    row = cvReshape(mat, &row_header, 0, 1);
+@endcode
+@param arr Input array
+@param header Output header to be filled
+@param new_cn New number of channels. 'new_cn = 0' means that the number of channels remains
+unchanged.
+@param new_rows New number of rows. 'new_rows = 0' means that the number of rows remains
+unchanged unless it needs to be changed according to new_cn value.
+*/
+CVAPI(CvMat*) cvReshape( const CvArr* arr, CvMat* header,
+                        int new_cn, int new_rows CV_DEFAULT(0) );
+
+/** Repeats source 2d array several times in both horizontal and
+   vertical direction to fill destination array */
+CVAPI(void) cvRepeat( const CvArr* src, CvArr* dst );
+
+/** @brief Allocates array data
+
+The function allocates image, matrix or multi-dimensional dense array data. Note that in the case of
+matrix types OpenCV allocation functions are used. In the case of IplImage they are used unless
+CV_TURN_ON_IPL_COMPATIBILITY() has been called before. In the latter case IPL functions are used
+to allocate the data.
+@param arr Array header
+ */
+CVAPI(void)  cvCreateData( CvArr* arr );
+
+/** @brief Releases array data.
+
+The function releases the array data. In the case of CvMat or CvMatND it simply calls
+cvDecRefData(), that is the function can not deallocate external data. See also the note to
+cvCreateData .
+@param arr Array header
+ */
+CVAPI(void)  cvReleaseData( CvArr* arr );
+
+/** @brief Assigns user data to the array header.
+
+The function assigns user data to the array header. Header should be initialized before using
+cvCreateMatHeader, cvCreateImageHeader, cvCreateMatNDHeader, cvInitMatHeader,
+cvInitImageHeader or cvInitMatNDHeader.
+@param arr Array header
+@param data User data
+@param step Full row length in bytes
+ */
+CVAPI(void)  cvSetData( CvArr* arr, void* data, int step );
+
+/** @brief Retrieves low-level information about the array.
+
+The function fills output variables with low-level information about the array data. All output
+
+parameters are optional, so some of the pointers may be set to NULL. If the array is IplImage with
+ROI set, the parameters of ROI are returned.
+
+The following example shows how to get access to array elements. It computes absolute values of the
+array elements :
+@code
+    float* data;
+    int step;
+    CvSize size;
+
+    cvGetRawData(array, (uchar**)&data, &step, &size);
+    step /= sizeof(data[0]);
+
+    for(int y = 0; y < size.height; y++, data += step )
+        for(int x = 0; x < size.width; x++ )
+            data[x] = (float)fabs(data[x]);
+@endcode
+@param arr Array header
+@param data Output pointer to the whole image origin or ROI origin if ROI is set
+@param step Output full row length in bytes
+@param roi_size Output ROI size
+ */
+CVAPI(void) cvGetRawData( const CvArr* arr, uchar** data,
+                         int* step CV_DEFAULT(NULL),
+                         CvSize* roi_size CV_DEFAULT(NULL));
+
+/** @brief Returns size of matrix or image ROI.
+
+The function returns number of rows (CvSize::height) and number of columns (CvSize::width) of the
+input matrix or image. In the case of image the size of ROI is returned.
+@param arr array header
+ */
+CVAPI(CvSize) cvGetSize( const CvArr* arr );
+
+/** @brief Copies one array to another.
+
+The function copies selected elements from an input array to an output array:
+
+\f[\texttt{dst} (I)= \texttt{src} (I)  \quad \text{if} \quad \texttt{mask} (I)  \ne 0.\f]
+
+If any of the passed arrays is of IplImage type, then its ROI and COI fields are used. Both arrays
+must have the same type, the same number of dimensions, and the same size. The function can also
+copy sparse arrays (mask is not supported in this case).
+@param src The source array
+@param dst The destination array
+@param mask Operation mask, 8-bit single channel array; specifies elements of the destination array
+to be changed
+ */
+CVAPI(void)  cvCopy( const CvArr* src, CvArr* dst,
+                     const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Sets every element of an array to a given value.
+
+The function copies the scalar value to every selected element of the destination array:
+\f[\texttt{arr} (I)= \texttt{value} \quad \text{if} \quad \texttt{mask} (I)  \ne 0\f]
+If array arr is of IplImage type, then is ROI used, but COI must not be set.
+@param arr The destination array
+@param value Fill value
+@param mask Operation mask, 8-bit single channel array; specifies elements of the destination
+array to be changed
+ */
+CVAPI(void)  cvSet( CvArr* arr, CvScalar value,
+                    const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Clears the array.
+
+The function clears the array. In the case of dense arrays (CvMat, CvMatND or IplImage),
+cvZero(array) is equivalent to cvSet(array,cvScalarAll(0),0). In the case of sparse arrays all the
+elements are removed.
+@param arr Array to be cleared
+ */
+CVAPI(void)  cvSetZero( CvArr* arr );
+#define cvZero  cvSetZero
+
+
+/** Splits a multi-channel array into the set of single-channel arrays or
+   extracts particular [color] plane */
+CVAPI(void)  cvSplit( const CvArr* src, CvArr* dst0, CvArr* dst1,
+                      CvArr* dst2, CvArr* dst3 );
+
+/** Merges a set of single-channel arrays into the single multi-channel array
+   or inserts one particular [color] plane to the array */
+CVAPI(void)  cvMerge( const CvArr* src0, const CvArr* src1,
+                      const CvArr* src2, const CvArr* src3,
+                      CvArr* dst );
+
+/** Copies several channels from input arrays to
+   certain channels of output arrays */
+CVAPI(void)  cvMixChannels( const CvArr** src, int src_count,
+                            CvArr** dst, int dst_count,
+                            const int* from_to, int pair_count );
+
+/** @brief Converts one array to another with optional linear transformation.
+
+The function has several different purposes, and thus has several different names. It copies one
+array to another with optional scaling, which is performed first, and/or optional type conversion,
+performed after:
+
+\f[\texttt{dst} (I) =  \texttt{scale} \texttt{src} (I) + ( \texttt{shift} _0, \texttt{shift} _1,...)\f]
+
+All the channels of multi-channel arrays are processed independently.
+
+The type of conversion is done with rounding and saturation, that is if the result of scaling +
+conversion can not be represented exactly by a value of the destination array element type, it is
+set to the nearest representable value on the real axis.
+@param src Source array
+@param dst Destination array
+@param scale Scale factor
+@param shift Value added to the scaled source array elements
+ */
+CVAPI(void)  cvConvertScale( const CvArr* src, CvArr* dst,
+                             double scale CV_DEFAULT(1),
+                             double shift CV_DEFAULT(0) );
+#define cvCvtScale cvConvertScale
+#define cvScale  cvConvertScale
+#define cvConvert( src, dst )  cvConvertScale( (src), (dst), 1, 0 )
+
+
+/** Performs linear transformation on every source array element,
+   stores absolute value of the result:
+   dst(x,y,c) = abs(scale*src(x,y,c)+shift).
+   destination array must have 8u type.
+   In other cases one may use cvConvertScale + cvAbsDiffS */
+CVAPI(void)  cvConvertScaleAbs( const CvArr* src, CvArr* dst,
+                                double scale CV_DEFAULT(1),
+                                double shift CV_DEFAULT(0) );
+#define cvCvtScaleAbs  cvConvertScaleAbs
+
+
+/** checks termination criteria validity and
+   sets eps to default_eps (if it is not set),
+   max_iter to default_max_iters (if it is not set)
+*/
+CVAPI(CvTermCriteria) cvCheckTermCriteria( CvTermCriteria criteria,
+                                           double default_eps,
+                                           int default_max_iters );
+
+/****************************************************************************************\
+*                   Arithmetic, logic and comparison operations                          *
+\****************************************************************************************/
+
+/** dst(mask) = src1(mask) + src2(mask) */
+CVAPI(void)  cvAdd( const CvArr* src1, const CvArr* src2, CvArr* dst,
+                    const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(mask) = src(mask) + value */
+CVAPI(void)  cvAddS( const CvArr* src, CvScalar value, CvArr* dst,
+                     const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(mask) = src1(mask) - src2(mask) */
+CVAPI(void)  cvSub( const CvArr* src1, const CvArr* src2, CvArr* dst,
+                    const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(mask) = src(mask) - value = src(mask) + (-value) */
+CV_INLINE  void  cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
+                         const CvArr* mask CV_DEFAULT(NULL))
+{
+    cvAddS( src, cvScalar( -value.val[0], -value.val[1], -value.val[2], -value.val[3]),
+            dst, mask );
+}
+
+/** dst(mask) = value - src(mask) */
+CVAPI(void)  cvSubRS( const CvArr* src, CvScalar value, CvArr* dst,
+                      const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src1(idx) * src2(idx) * scale
+   (scaled element-wise multiplication of 2 arrays) */
+CVAPI(void)  cvMul( const CvArr* src1, const CvArr* src2,
+                    CvArr* dst, double scale CV_DEFAULT(1) );
+
+/** element-wise division/inversion with scaling:
+    dst(idx) = src1(idx) * scale / src2(idx)
+    or dst(idx) = scale / src2(idx) if src1 == 0 */
+CVAPI(void)  cvDiv( const CvArr* src1, const CvArr* src2,
+                    CvArr* dst, double scale CV_DEFAULT(1));
+
+/** dst = src1 * scale + src2 */
+CVAPI(void)  cvScaleAdd( const CvArr* src1, CvScalar scale,
+                         const CvArr* src2, CvArr* dst );
+#define cvAXPY( A, real_scalar, B, C ) cvScaleAdd(A, cvRealScalar(real_scalar), B, C)
+
+/** dst = src1 * alpha + src2 * beta + gamma */
+CVAPI(void)  cvAddWeighted( const CvArr* src1, double alpha,
+                            const CvArr* src2, double beta,
+                            double gamma, CvArr* dst );
+
+/** @brief Calculates the dot product of two arrays in Euclidean metrics.
+
+The function calculates and returns the Euclidean dot product of two arrays.
+
+\f[src1  \bullet src2 =  \sum _I ( \texttt{src1} (I)  \texttt{src2} (I))\f]
+
+In the case of multiple channel arrays, the results for all channels are accumulated. In particular,
+cvDotProduct(a,a) where a is a complex vector, will return \f$||\texttt{a}||^2\f$. The function can
+process multi-dimensional arrays, row by row, layer by layer, and so on.
+@param src1 The first source array
+@param src2 The second source array
+ */
+CVAPI(double)  cvDotProduct( const CvArr* src1, const CvArr* src2 );
+
+/** dst(idx) = src1(idx) & src2(idx) */
+CVAPI(void) cvAnd( const CvArr* src1, const CvArr* src2,
+                  CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src(idx) & value */
+CVAPI(void) cvAndS( const CvArr* src, CvScalar value,
+                   CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src1(idx) | src2(idx) */
+CVAPI(void) cvOr( const CvArr* src1, const CvArr* src2,
+                 CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src(idx) | value */
+CVAPI(void) cvOrS( const CvArr* src, CvScalar value,
+                  CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src1(idx) ^ src2(idx) */
+CVAPI(void) cvXor( const CvArr* src1, const CvArr* src2,
+                  CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src(idx) ^ value */
+CVAPI(void) cvXorS( const CvArr* src, CvScalar value,
+                   CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = ~src(idx) */
+CVAPI(void) cvNot( const CvArr* src, CvArr* dst );
+
+/** dst(idx) = lower(idx) <= src(idx) < upper(idx) */
+CVAPI(void) cvInRange( const CvArr* src, const CvArr* lower,
+                      const CvArr* upper, CvArr* dst );
+
+/** dst(idx) = lower <= src(idx) < upper */
+CVAPI(void) cvInRangeS( const CvArr* src, CvScalar lower,
+                       CvScalar upper, CvArr* dst );
+
+#define CV_CMP_EQ   0
+#define CV_CMP_GT   1
+#define CV_CMP_GE   2
+#define CV_CMP_LT   3
+#define CV_CMP_LE   4
+#define CV_CMP_NE   5
+
+/** The comparison operation support single-channel arrays only.
+   Destination image should be 8uC1 or 8sC1 */
+
+/** dst(idx) = src1(idx) _cmp_op_ src2(idx) */
+CVAPI(void) cvCmp( const CvArr* src1, const CvArr* src2, CvArr* dst, int cmp_op );
+
+/** dst(idx) = src1(idx) _cmp_op_ value */
+CVAPI(void) cvCmpS( const CvArr* src, double value, CvArr* dst, int cmp_op );
+
+/** dst(idx) = min(src1(idx),src2(idx)) */
+CVAPI(void) cvMin( const CvArr* src1, const CvArr* src2, CvArr* dst );
+
+/** dst(idx) = max(src1(idx),src2(idx)) */
+CVAPI(void) cvMax( const CvArr* src1, const CvArr* src2, CvArr* dst );
+
+/** dst(idx) = min(src(idx),value) */
+CVAPI(void) cvMinS( const CvArr* src, double value, CvArr* dst );
+
+/** dst(idx) = max(src(idx),value) */
+CVAPI(void) cvMaxS( const CvArr* src, double value, CvArr* dst );
+
+/** dst(x,y,c) = abs(src1(x,y,c) - src2(x,y,c)) */
+CVAPI(void) cvAbsDiff( const CvArr* src1, const CvArr* src2, CvArr* dst );
+
+/** dst(x,y,c) = abs(src(x,y,c) - value(c)) */
+CVAPI(void) cvAbsDiffS( const CvArr* src, CvArr* dst, CvScalar value );
+#define cvAbs( src, dst ) cvAbsDiffS( (src), (dst), cvScalarAll(0))
+
+/****************************************************************************************\
+*                                Math operations                                         *
+\****************************************************************************************/
+
+/** Does cartesian->polar coordinates conversion.
+   Either of output components (magnitude or angle) is optional */
+CVAPI(void)  cvCartToPolar( const CvArr* x, const CvArr* y,
+                            CvArr* magnitude, CvArr* angle CV_DEFAULT(NULL),
+                            int angle_in_degrees CV_DEFAULT(0));
+
+/** Does polar->cartesian coordinates conversion.
+   Either of output components (magnitude or angle) is optional.
+   If magnitude is missing it is assumed to be all 1's */
+CVAPI(void)  cvPolarToCart( const CvArr* magnitude, const CvArr* angle,
+                            CvArr* x, CvArr* y,
+                            int angle_in_degrees CV_DEFAULT(0));
+
+/** Does powering: dst(idx) = src(idx)^power */
+CVAPI(void)  cvPow( const CvArr* src, CvArr* dst, double power );
+
+/** Does exponention: dst(idx) = exp(src(idx)).
+   Overflow is not handled yet. Underflow is handled.
+   Maximal relative error is ~7e-6 for single-precision input */
+CVAPI(void)  cvExp( const CvArr* src, CvArr* dst );
+
+/** Calculates natural logarithms: dst(idx) = log(abs(src(idx))).
+   Logarithm of 0 gives large negative number(~-700)
+   Maximal relative error is ~3e-7 for single-precision output
+*/
+CVAPI(void)  cvLog( const CvArr* src, CvArr* dst );
+
+/** Fast arctangent calculation */
+CVAPI(float) cvFastArctan( float y, float x );
+
+/** Fast cubic root calculation */
+CVAPI(float)  cvCbrt( float value );
+
+#define  CV_CHECK_RANGE    1
+#define  CV_CHECK_QUIET    2
+/** Checks array values for NaNs, Infs or simply for too large numbers
+   (if CV_CHECK_RANGE is set). If CV_CHECK_QUIET is set,
+   no runtime errors is raised (function returns zero value in case of "bad" values).
+   Otherwise cvError is called */
+CVAPI(int)  cvCheckArr( const CvArr* arr, int flags CV_DEFAULT(0),
+                        double min_val CV_DEFAULT(0), double max_val CV_DEFAULT(0));
+#define cvCheckArray cvCheckArr
+
+#define CV_RAND_UNI      0
+#define CV_RAND_NORMAL   1
+
+/** @brief Fills an array with random numbers and updates the RNG state.
+
+The function fills the destination array with uniformly or normally distributed random numbers.
+@param rng CvRNG state initialized by cvRNG
+@param arr The destination array
+@param dist_type Distribution type
+> -   **CV_RAND_UNI** uniform distribution
+> -   **CV_RAND_NORMAL** normal or Gaussian distribution
+@param param1 The first parameter of the distribution. In the case of a uniform distribution it is
+the inclusive lower boundary of the random numbers range. In the case of a normal distribution it
+is the mean value of the random numbers.
+@param param2 The second parameter of the distribution. In the case of a uniform distribution it
+is the exclusive upper boundary of the random numbers range. In the case of a normal distribution
+it is the standard deviation of the random numbers.
+@sa randu, randn, RNG::fill.
+ */
+CVAPI(void) cvRandArr( CvRNG* rng, CvArr* arr, int dist_type,
+                      CvScalar param1, CvScalar param2 );
+
+CVAPI(void) cvRandShuffle( CvArr* mat, CvRNG* rng,
+                           double iter_factor CV_DEFAULT(1.));
+
+#define CV_SORT_EVERY_ROW 0
+#define CV_SORT_EVERY_COLUMN 1
+#define CV_SORT_ASCENDING 0
+#define CV_SORT_DESCENDING 16
+
+CVAPI(void) cvSort( const CvArr* src, CvArr* dst CV_DEFAULT(NULL),
+                    CvArr* idxmat CV_DEFAULT(NULL),
+                    int flags CV_DEFAULT(0));
+
+/** Finds real roots of a cubic equation */
+CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots );
+
+/** Finds all real and complex roots of a polynomial equation */
+CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots2,
+      int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100));
+
+/****************************************************************************************\
+*                                Matrix operations                                       *
+\****************************************************************************************/
+
+/** @brief Calculates the cross product of two 3D vectors.
+
+The function calculates the cross product of two 3D vectors:
+\f[\texttt{dst} =  \texttt{src1} \times \texttt{src2}\f]
+or:
+\f[\begin{array}{l} \texttt{dst} _1 =  \texttt{src1} _2  \texttt{src2} _3 -  \texttt{src1} _3  \texttt{src2} _2 \\ \texttt{dst} _2 =  \texttt{src1} _3  \texttt{src2} _1 -  \texttt{src1} _1  \texttt{src2} _3 \\ \texttt{dst} _3 =  \texttt{src1} _1  \texttt{src2} _2 -  \texttt{src1} _2  \texttt{src2} _1 \end{array}\f]
+@param src1 The first source vector
+@param src2 The second source vector
+@param dst The destination vector
+ */
+CVAPI(void)  cvCrossProduct( const CvArr* src1, const CvArr* src2, CvArr* dst );
+
+/** Matrix transform: dst = A*B + C, C is optional */
+#define cvMatMulAdd( src1, src2, src3, dst ) cvGEMM( (src1), (src2), 1., (src3), 1., (dst), 0 )
+#define cvMatMul( src1, src2, dst )  cvMatMulAdd( (src1), (src2), NULL, (dst))
+
+#define CV_GEMM_A_T 1
+#define CV_GEMM_B_T 2
+#define CV_GEMM_C_T 4
+/** Extended matrix transform:
+   dst = alpha*op(A)*op(B) + beta*op(C), where op(X) is X or X^T */
+CVAPI(void)  cvGEMM( const CvArr* src1, const CvArr* src2, double alpha,
+                     const CvArr* src3, double beta, CvArr* dst,
+                     int tABC CV_DEFAULT(0));
+#define cvMatMulAddEx cvGEMM
+
+/** Transforms each element of source array and stores
+   resultant vectors in destination array */
+CVAPI(void)  cvTransform( const CvArr* src, CvArr* dst,
+                          const CvMat* transmat,
+                          const CvMat* shiftvec CV_DEFAULT(NULL));
+#define cvMatMulAddS cvTransform
+
+/** Does perspective transform on every element of input array */
+CVAPI(void)  cvPerspectiveTransform( const CvArr* src, CvArr* dst,
+                                     const CvMat* mat );
+
+/** Calculates (A-delta)*(A-delta)^T (order=0) or (A-delta)^T*(A-delta) (order=1) */
+CVAPI(void) cvMulTransposed( const CvArr* src, CvArr* dst, int order,
+                             const CvArr* delta CV_DEFAULT(NULL),
+                             double scale CV_DEFAULT(1.) );
+
+/** Tranposes matrix. Square matrices can be transposed in-place */
+CVAPI(void)  cvTranspose( const CvArr* src, CvArr* dst );
+#define cvT cvTranspose
+
+/** Completes the symmetric matrix from the lower (LtoR=0) or from the upper (LtoR!=0) part */
+CVAPI(void)  cvCompleteSymm( CvMat* matrix, int LtoR CV_DEFAULT(0) );
+
+/** Mirror array data around horizontal (flip=0),
+   vertical (flip=1) or both(flip=-1) axises:
+   cvFlip(src) flips images vertically and sequences horizontally (inplace) */
+CVAPI(void)  cvFlip( const CvArr* src, CvArr* dst CV_DEFAULT(NULL),
+                     int flip_mode CV_DEFAULT(0));
+#define cvMirror cvFlip
+
+
+#define CV_SVD_MODIFY_A   1
+#define CV_SVD_U_T        2
+#define CV_SVD_V_T        4
+
+/** Performs Singular Value Decomposition of a matrix */
+CVAPI(void)   cvSVD( CvArr* A, CvArr* W, CvArr* U CV_DEFAULT(NULL),
+                     CvArr* V CV_DEFAULT(NULL), int flags CV_DEFAULT(0));
+
+/** Performs Singular Value Back Substitution (solves A*X = B):
+   flags must be the same as in cvSVD */
+CVAPI(void)   cvSVBkSb( const CvArr* W, const CvArr* U,
+                        const CvArr* V, const CvArr* B,
+                        CvArr* X, int flags );
+
+#define CV_LU  0
+#define CV_SVD 1
+#define CV_SVD_SYM 2
+#define CV_CHOLESKY 3
+#define CV_QR  4
+#define CV_NORMAL 16
+
+/** Inverts matrix */
+CVAPI(double)  cvInvert( const CvArr* src, CvArr* dst,
+                         int method CV_DEFAULT(CV_LU));
+#define cvInv cvInvert
+
+/** Solves linear system (src1)*(dst) = (src2)
+   (returns 0 if src1 is a singular and CV_LU method is used) */
+CVAPI(int)  cvSolve( const CvArr* src1, const CvArr* src2, CvArr* dst,
+                     int method CV_DEFAULT(CV_LU));
+
+/** Calculates determinant of input matrix */
+CVAPI(double) cvDet( const CvArr* mat );
+
+/** Calculates trace of the matrix (sum of elements on the main diagonal) */
+CVAPI(CvScalar) cvTrace( const CvArr* mat );
+
+/** Finds eigen values and vectors of a symmetric matrix */
+CVAPI(void)  cvEigenVV( CvArr* mat, CvArr* evects, CvArr* evals,
+                        double eps CV_DEFAULT(0),
+                        int lowindex CV_DEFAULT(-1),
+                        int highindex CV_DEFAULT(-1));
+
+///* Finds selected eigen values and vectors of a symmetric matrix */
+//CVAPI(void)  cvSelectedEigenVV( CvArr* mat, CvArr* evects, CvArr* evals,
+//                                int lowindex, int highindex );
+
+/** Makes an identity matrix (mat_ij = i == j) */
+CVAPI(void)  cvSetIdentity( CvArr* mat, CvScalar value CV_DEFAULT(cvRealScalar(1)) );
+
+/** Fills matrix with given range of numbers */
+CVAPI(CvArr*)  cvRange( CvArr* mat, double start, double end );
+
+/**   @anchor core_c_CovarFlags
+@name Flags for cvCalcCovarMatrix
+@see cvCalcCovarMatrix
+  @{
+*/
+
+/** flag for cvCalcCovarMatrix, transpose([v1-avg, v2-avg,...]) * [v1-avg,v2-avg,...] */
+#define CV_COVAR_SCRAMBLED 0
+
+/** flag for cvCalcCovarMatrix, [v1-avg, v2-avg,...] * transpose([v1-avg,v2-avg,...]) */
+#define CV_COVAR_NORMAL    1
+
+/** flag for cvCalcCovarMatrix, do not calc average (i.e. mean vector) - use the input vector instead
+   (useful for calculating covariance matrix by parts) */
+#define CV_COVAR_USE_AVG   2
+
+/** flag for cvCalcCovarMatrix, scale the covariance matrix coefficients by number of the vectors */
+#define CV_COVAR_SCALE     4
+
+/** flag for cvCalcCovarMatrix, all the input vectors are stored in a single matrix, as its rows */
+#define CV_COVAR_ROWS      8
+
+/** flag for cvCalcCovarMatrix, all the input vectors are stored in a single matrix, as its columns */
+#define CV_COVAR_COLS     16
+
+/** @} */
+
+/** Calculates covariation matrix for a set of vectors
+@see @ref core_c_CovarFlags "flags"
+*/
+CVAPI(void)  cvCalcCovarMatrix( const CvArr** vects, int count,
+                                CvArr* cov_mat, CvArr* avg, int flags );
+
+#define CV_PCA_DATA_AS_ROW 0
+#define CV_PCA_DATA_AS_COL 1
+#define CV_PCA_USE_AVG 2
+CVAPI(void)  cvCalcPCA( const CvArr* data, CvArr* mean,
+                        CvArr* eigenvals, CvArr* eigenvects, int flags );
+
+CVAPI(void)  cvProjectPCA( const CvArr* data, const CvArr* mean,
+                           const CvArr* eigenvects, CvArr* result );
+
+CVAPI(void)  cvBackProjectPCA( const CvArr* proj, const CvArr* mean,
+                               const CvArr* eigenvects, CvArr* result );
+
+/** Calculates Mahalanobis(weighted) distance */
+CVAPI(double)  cvMahalanobis( const CvArr* vec1, const CvArr* vec2, const CvArr* mat );
+#define cvMahalonobis  cvMahalanobis
+
+/****************************************************************************************\
+*                                    Array Statistics                                    *
+\****************************************************************************************/
+
+/** Finds sum of array elements */
+CVAPI(CvScalar)  cvSum( const CvArr* arr );
+
+/** Calculates number of non-zero pixels */
+CVAPI(int)  cvCountNonZero( const CvArr* arr );
+
+/** Calculates mean value of array elements */
+CVAPI(CvScalar)  cvAvg( const CvArr* arr, const CvArr* mask CV_DEFAULT(NULL) );
+
+/** Calculates mean and standard deviation of pixel values */
+CVAPI(void)  cvAvgSdv( const CvArr* arr, CvScalar* mean, CvScalar* std_dev,
+                       const CvArr* mask CV_DEFAULT(NULL) );
+
+/** Finds global minimum, maximum and their positions */
+CVAPI(void)  cvMinMaxLoc( const CvArr* arr, double* min_val, double* max_val,
+                          CvPoint* min_loc CV_DEFAULT(NULL),
+                          CvPoint* max_loc CV_DEFAULT(NULL),
+                          const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @anchor core_c_NormFlags
+  @name Flags for cvNorm and cvNormalize
+  @{
+*/
+#define CV_C            1
+#define CV_L1           2
+#define CV_L2           4
+#define CV_NORM_MASK    7
+#define CV_RELATIVE     8
+#define CV_DIFF         16
+#define CV_MINMAX       32
+
+#define CV_DIFF_C       (CV_DIFF | CV_C)
+#define CV_DIFF_L1      (CV_DIFF | CV_L1)
+#define CV_DIFF_L2      (CV_DIFF | CV_L2)
+#define CV_RELATIVE_C   (CV_RELATIVE | CV_C)
+#define CV_RELATIVE_L1  (CV_RELATIVE | CV_L1)
+#define CV_RELATIVE_L2  (CV_RELATIVE | CV_L2)
+/** @} */
+
+/** Finds norm, difference norm or relative difference norm for an array (or two arrays)
+@see ref core_c_NormFlags "flags"
+*/
+CVAPI(double)  cvNorm( const CvArr* arr1, const CvArr* arr2 CV_DEFAULT(NULL),
+                       int norm_type CV_DEFAULT(CV_L2),
+                       const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @see ref core_c_NormFlags "flags" */
+CVAPI(void)  cvNormalize( const CvArr* src, CvArr* dst,
+                          double a CV_DEFAULT(1.), double b CV_DEFAULT(0.),
+                          int norm_type CV_DEFAULT(CV_L2),
+                          const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @anchor core_c_ReduceFlags
+  @name Flags for cvReduce
+  @{
+*/
+#define CV_REDUCE_SUM 0
+#define CV_REDUCE_AVG 1
+#define CV_REDUCE_MAX 2
+#define CV_REDUCE_MIN 3
+/** @} */
+
+/** @see @ref core_c_ReduceFlags "flags" */
+CVAPI(void)  cvReduce( const CvArr* src, CvArr* dst, int dim CV_DEFAULT(-1),
+                       int op CV_DEFAULT(CV_REDUCE_SUM) );
+
+/****************************************************************************************\
+*                      Discrete Linear Transforms and Related Functions                  *
+\****************************************************************************************/
+
+/** @anchor core_c_DftFlags
+  @name Flags for cvDFT, cvDCT and cvMulSpectrums
+  @{
+  */
+#define CV_DXT_FORWARD  0
+#define CV_DXT_INVERSE  1
+#define CV_DXT_SCALE    2 /**< divide result by size of array */
+#define CV_DXT_INV_SCALE (CV_DXT_INVERSE + CV_DXT_SCALE)
+#define CV_DXT_INVERSE_SCALE CV_DXT_INV_SCALE
+#define CV_DXT_ROWS     4 /**< transform each row individually */
+#define CV_DXT_MUL_CONJ 8 /**< conjugate the second argument of cvMulSpectrums */
+/** @} */
+
+/** Discrete Fourier Transform:
+    complex->complex,
+    real->ccs (forward),
+    ccs->real (inverse)
+@see core_c_DftFlags "flags"
+*/
+CVAPI(void)  cvDFT( const CvArr* src, CvArr* dst, int flags,
+                    int nonzero_rows CV_DEFAULT(0) );
+#define cvFFT cvDFT
+
+/** Multiply results of DFTs: DFT(X)*DFT(Y) or DFT(X)*conj(DFT(Y))
+@see core_c_DftFlags "flags"
+*/
+CVAPI(void)  cvMulSpectrums( const CvArr* src1, const CvArr* src2,
+                             CvArr* dst, int flags );
+
+/** Finds optimal DFT vector size >= size0 */
+CVAPI(int)  cvGetOptimalDFTSize( int size0 );
+
+/** Discrete Cosine Transform
+@see core_c_DftFlags "flags"
+*/
+CVAPI(void)  cvDCT( const CvArr* src, CvArr* dst, int flags );
+
+/****************************************************************************************\
+*                              Dynamic data structures                                   *
+\****************************************************************************************/
+
+/** Calculates length of sequence slice (with support of negative indices). */
+CVAPI(int) cvSliceLength( CvSlice slice, const CvSeq* seq );
+
+
+/** Creates new memory storage.
+   block_size == 0 means that default,
+   somewhat optimal size, is used (currently, it is 64K) */
+CVAPI(CvMemStorage*)  cvCreateMemStorage( int block_size CV_DEFAULT(0));
+
+
+/** Creates a memory storage that will borrow memory blocks from parent storage */
+CVAPI(CvMemStorage*)  cvCreateChildMemStorage( CvMemStorage* parent );
+
+
+/** Releases memory storage. All the children of a parent must be released before
+   the parent. A child storage returns all the blocks to parent when it is released */
+CVAPI(void)  cvReleaseMemStorage( CvMemStorage** storage );
+
+
+/** Clears memory storage. This is the only way(!!!) (besides cvRestoreMemStoragePos)
+   to reuse memory allocated for the storage - cvClearSeq,cvClearSet ...
+   do not free any memory.
+   A child storage returns all the blocks to the parent when it is cleared */
+CVAPI(void)  cvClearMemStorage( CvMemStorage* storage );
+
+/** Remember a storage "free memory" position */
+CVAPI(void)  cvSaveMemStoragePos( const CvMemStorage* storage, CvMemStoragePos* pos );
+
+/** Restore a storage "free memory" position */
+CVAPI(void)  cvRestoreMemStoragePos( CvMemStorage* storage, CvMemStoragePos* pos );
+
+/** Allocates continuous buffer of the specified size in the storage */
+CVAPI(void*) cvMemStorageAlloc( CvMemStorage* storage, size_t size );
+
+/** Allocates string in memory storage */
+CVAPI(CvString) cvMemStorageAllocString( CvMemStorage* storage, const char* ptr,
+                                         int len CV_DEFAULT(-1) );
+
+/** Creates new empty sequence that will reside in the specified storage */
+CVAPI(CvSeq*)  cvCreateSeq( int seq_flags, size_t header_size,
+                            size_t elem_size, CvMemStorage* storage );
+
+/** Changes default size (granularity) of sequence blocks.
+   The default size is ~1Kbyte */
+CVAPI(void)  cvSetSeqBlockSize( CvSeq* seq, int delta_elems );
+
+
+/** Adds new element to the end of sequence. Returns pointer to the element */
+CVAPI(schar*)  cvSeqPush( CvSeq* seq, const void* element CV_DEFAULT(NULL));
+
+
+/** Adds new element to the beginning of sequence. Returns pointer to it */
+CVAPI(schar*)  cvSeqPushFront( CvSeq* seq, const void* element CV_DEFAULT(NULL));
+
+
+/** Removes the last element from sequence and optionally saves it */
+CVAPI(void)  cvSeqPop( CvSeq* seq, void* element CV_DEFAULT(NULL));
+
+
+/** Removes the first element from sequence and optioanally saves it */
+CVAPI(void)  cvSeqPopFront( CvSeq* seq, void* element CV_DEFAULT(NULL));
+
+
+#define CV_FRONT 1
+#define CV_BACK 0
+/** Adds several new elements to the end of sequence */
+CVAPI(void)  cvSeqPushMulti( CvSeq* seq, const void* elements,
+                             int count, int in_front CV_DEFAULT(0) );
+
+/** Removes several elements from the end of sequence and optionally saves them */
+CVAPI(void)  cvSeqPopMulti( CvSeq* seq, void* elements,
+                            int count, int in_front CV_DEFAULT(0) );
+
+/** Inserts a new element in the middle of sequence.
+   cvSeqInsert(seq,0,elem) == cvSeqPushFront(seq,elem) */
+CVAPI(schar*)  cvSeqInsert( CvSeq* seq, int before_index,
+                            const void* element CV_DEFAULT(NULL));
+
+/** Removes specified sequence element */
+CVAPI(void)  cvSeqRemove( CvSeq* seq, int index );
+
+
+/** Removes all the elements from the sequence. The freed memory
+   can be reused later only by the same sequence unless cvClearMemStorage
+   or cvRestoreMemStoragePos is called */
+CVAPI(void)  cvClearSeq( CvSeq* seq );
+
+
+/** Retrieves pointer to specified sequence element.
+   Negative indices are supported and mean counting from the end
+   (e.g -1 means the last sequence element) */
+CVAPI(schar*)  cvGetSeqElem( const CvSeq* seq, int index );
+
+/** Calculates index of the specified sequence element.
+   Returns -1 if element does not belong to the sequence */
+CVAPI(int)  cvSeqElemIdx( const CvSeq* seq, const void* element,
+                         CvSeqBlock** block CV_DEFAULT(NULL) );
+
+/** Initializes sequence writer. The new elements will be added to the end of sequence */
+CVAPI(void)  cvStartAppendToSeq( CvSeq* seq, CvSeqWriter* writer );
+
+
+/** Combination of cvCreateSeq and cvStartAppendToSeq */
+CVAPI(void)  cvStartWriteSeq( int seq_flags, int header_size,
+                              int elem_size, CvMemStorage* storage,
+                              CvSeqWriter* writer );
+
+/** Closes sequence writer, updates sequence header and returns pointer
+   to the resultant sequence
+   (which may be useful if the sequence was created using cvStartWriteSeq))
+*/
+CVAPI(CvSeq*)  cvEndWriteSeq( CvSeqWriter* writer );
+
+
+/** Updates sequence header. May be useful to get access to some of previously
+   written elements via cvGetSeqElem or sequence reader */
+CVAPI(void)   cvFlushSeqWriter( CvSeqWriter* writer );
+
+
+/** Initializes sequence reader.
+   The sequence can be read in forward or backward direction */
+CVAPI(void) cvStartReadSeq( const CvSeq* seq, CvSeqReader* reader,
+                           int reverse CV_DEFAULT(0) );
+
+
+/** Returns current sequence reader position (currently observed sequence element) */
+CVAPI(int)  cvGetSeqReaderPos( CvSeqReader* reader );
+
+
+/** Changes sequence reader position. It may seek to an absolute or
+   to relative to the current position */
+CVAPI(void)   cvSetSeqReaderPos( CvSeqReader* reader, int index,
+                                 int is_relative CV_DEFAULT(0));
+
+/** Copies sequence content to a continuous piece of memory */
+CVAPI(void*)  cvCvtSeqToArray( const CvSeq* seq, void* elements,
+                               CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ) );
+
+/** Creates sequence header for array.
+   After that all the operations on sequences that do not alter the content
+   can be applied to the resultant sequence */
+CVAPI(CvSeq*) cvMakeSeqHeaderForArray( int seq_type, int header_size,
+                                       int elem_size, void* elements, int total,
+                                       CvSeq* seq, CvSeqBlock* block );
+
+/** Extracts sequence slice (with or without copying sequence elements) */
+CVAPI(CvSeq*) cvSeqSlice( const CvSeq* seq, CvSlice slice,
+                         CvMemStorage* storage CV_DEFAULT(NULL),
+                         int copy_data CV_DEFAULT(0));
+
+CV_INLINE CvSeq* cvCloneSeq( const CvSeq* seq, CvMemStorage* storage CV_DEFAULT(NULL))
+{
+    return cvSeqSlice( seq, CV_WHOLE_SEQ, storage, 1 );
+}
+
+/** Removes sequence slice */
+CVAPI(void)  cvSeqRemoveSlice( CvSeq* seq, CvSlice slice );
+
+/** Inserts a sequence or array into another sequence */
+CVAPI(void)  cvSeqInsertSlice( CvSeq* seq, int before_index, const CvArr* from_arr );
+
+/** a < b ? -1 : a > b ? 1 : 0 */
+typedef int (CV_CDECL* CvCmpFunc)(const void* a, const void* b, void* userdata );
+
+/** Sorts sequence in-place given element comparison function */
+CVAPI(void) cvSeqSort( CvSeq* seq, CvCmpFunc func, void* userdata CV_DEFAULT(NULL) );
+
+/** Finds element in a [sorted] sequence */
+CVAPI(schar*) cvSeqSearch( CvSeq* seq, const void* elem, CvCmpFunc func,
+                           int is_sorted, int* elem_idx,
+                           void* userdata CV_DEFAULT(NULL) );
+
+/** Reverses order of sequence elements in-place */
+CVAPI(void) cvSeqInvert( CvSeq* seq );
+
+/** Splits sequence into one or more equivalence classes using the specified criteria */
+CVAPI(int)  cvSeqPartition( const CvSeq* seq, CvMemStorage* storage,
+                            CvSeq** labels, CvCmpFunc is_equal, void* userdata );
+
+/************ Internal sequence functions ************/
+CVAPI(void)  cvChangeSeqBlock( void* reader, int direction );
+CVAPI(void)  cvCreateSeqBlock( CvSeqWriter* writer );
+
+
+/** Creates a new set */
+CVAPI(CvSet*)  cvCreateSet( int set_flags, int header_size,
+                            int elem_size, CvMemStorage* storage );
+
+/** Adds new element to the set and returns pointer to it */
+CVAPI(int)  cvSetAdd( CvSet* set_header, CvSetElem* elem CV_DEFAULT(NULL),
+                      CvSetElem** inserted_elem CV_DEFAULT(NULL) );
+
+/** Fast variant of cvSetAdd */
+CV_INLINE  CvSetElem* cvSetNew( CvSet* set_header )
+{
+    CvSetElem* elem = set_header->free_elems;
+    if( elem )
+    {
+        set_header->free_elems = elem->next_free;
+        elem->flags = elem->flags & CV_SET_ELEM_IDX_MASK;
+        set_header->active_count++;
+    }
+    else
+        cvSetAdd( set_header, NULL, &elem );
+    return elem;
+}
+
+/** Removes set element given its pointer */
+CV_INLINE  void cvSetRemoveByPtr( CvSet* set_header, void* elem )
+{
+    CvSetElem* _elem = (CvSetElem*)elem;
+    assert( _elem->flags >= 0 /*&& (elem->flags & CV_SET_ELEM_IDX_MASK) < set_header->total*/ );
+    _elem->next_free = set_header->free_elems;
+    _elem->flags = (_elem->flags & CV_SET_ELEM_IDX_MASK) | CV_SET_ELEM_FREE_FLAG;
+    set_header->free_elems = _elem;
+    set_header->active_count--;
+}
+
+/** Removes element from the set by its index  */
+CVAPI(void)   cvSetRemove( CvSet* set_header, int index );
+
+/** Returns a set element by index. If the element doesn't belong to the set,
+   NULL is returned */
+CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int idx )
+{
+    CvSetElem* elem = (CvSetElem*)(void *)cvGetSeqElem( (CvSeq*)set_header, idx );
+    return elem && CV_IS_SET_ELEM( elem ) ? elem : 0;
+}
+
+/** Removes all the elements from the set */
+CVAPI(void)  cvClearSet( CvSet* set_header );
+
+/** Creates new graph */
+CVAPI(CvGraph*)  cvCreateGraph( int graph_flags, int header_size,
+                                int vtx_size, int edge_size,
+                                CvMemStorage* storage );
+
+/** Adds new vertex to the graph */
+CVAPI(int)  cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* vtx CV_DEFAULT(NULL),
+                           CvGraphVtx** inserted_vtx CV_DEFAULT(NULL) );
+
+
+/** Removes vertex from the graph together with all incident edges */
+CVAPI(int)  cvGraphRemoveVtx( CvGraph* graph, int index );
+CVAPI(int)  cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx );
+
+
+/** Link two vertices specifed by indices or pointers if they
+   are not connected or return pointer to already existing edge
+   connecting the vertices.
+   Functions return 1 if a new edge was created, 0 otherwise */
+CVAPI(int)  cvGraphAddEdge( CvGraph* graph,
+                            int start_idx, int end_idx,
+                            const CvGraphEdge* edge CV_DEFAULT(NULL),
+                            CvGraphEdge** inserted_edge CV_DEFAULT(NULL) );
+
+CVAPI(int)  cvGraphAddEdgeByPtr( CvGraph* graph,
+                               CvGraphVtx* start_vtx, CvGraphVtx* end_vtx,
+                               const CvGraphEdge* edge CV_DEFAULT(NULL),
+                               CvGraphEdge** inserted_edge CV_DEFAULT(NULL) );
+
+/** Remove edge connecting two vertices */
+CVAPI(void)  cvGraphRemoveEdge( CvGraph* graph, int start_idx, int end_idx );
+CVAPI(void)  cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx,
+                                     CvGraphVtx* end_vtx );
+
+/** Find edge connecting two vertices */
+CVAPI(CvGraphEdge*)  cvFindGraphEdge( const CvGraph* graph, int start_idx, int end_idx );
+CVAPI(CvGraphEdge*)  cvFindGraphEdgeByPtr( const CvGraph* graph,
+                                           const CvGraphVtx* start_vtx,
+                                           const CvGraphVtx* end_vtx );
+#define cvGraphFindEdge cvFindGraphEdge
+#define cvGraphFindEdgeByPtr cvFindGraphEdgeByPtr
+
+/** Remove all vertices and edges from the graph */
+CVAPI(void)  cvClearGraph( CvGraph* graph );
+
+
+/** Count number of edges incident to the vertex */
+CVAPI(int)  cvGraphVtxDegree( const CvGraph* graph, int vtx_idx );
+CVAPI(int)  cvGraphVtxDegreeByPtr( const CvGraph* graph, const CvGraphVtx* vtx );
+
+
+/** Retrieves graph vertex by given index */
+#define cvGetGraphVtx( graph, idx ) (CvGraphVtx*)cvGetSetElem((CvSet*)(graph), (idx))
+
+/** Retrieves index of a graph vertex given its pointer */
+#define cvGraphVtxIdx( graph, vtx ) ((vtx)->flags & CV_SET_ELEM_IDX_MASK)
+
+/** Retrieves index of a graph edge given its pointer */
+#define cvGraphEdgeIdx( graph, edge ) ((edge)->flags & CV_SET_ELEM_IDX_MASK)
+
+#define cvGraphGetVtxCount( graph ) ((graph)->active_count)
+#define cvGraphGetEdgeCount( graph ) ((graph)->edges->active_count)
+
+#define  CV_GRAPH_VERTEX        1
+#define  CV_GRAPH_TREE_EDGE     2
+#define  CV_GRAPH_BACK_EDGE     4
+#define  CV_GRAPH_FORWARD_EDGE  8
+#define  CV_GRAPH_CROSS_EDGE    16
+#define  CV_GRAPH_ANY_EDGE      30
+#define  CV_GRAPH_NEW_TREE      32
+#define  CV_GRAPH_BACKTRACKING  64
+#define  CV_GRAPH_OVER          -1
+
+#define  CV_GRAPH_ALL_ITEMS    -1
+
+/** flags for graph vertices and edges */
+#define  CV_GRAPH_ITEM_VISITED_FLAG  (1 << 30)
+#define  CV_IS_GRAPH_VERTEX_VISITED(vtx) \
+    (((CvGraphVtx*)(vtx))->flags & CV_GRAPH_ITEM_VISITED_FLAG)
+#define  CV_IS_GRAPH_EDGE_VISITED(edge) \
+    (((CvGraphEdge*)(edge))->flags & CV_GRAPH_ITEM_VISITED_FLAG)
+#define  CV_GRAPH_SEARCH_TREE_NODE_FLAG   (1 << 29)
+#define  CV_GRAPH_FORWARD_EDGE_FLAG       (1 << 28)
+
+typedef struct CvGraphScanner
+{
+    CvGraphVtx* vtx;       /* current graph vertex (or current edge origin) */
+    CvGraphVtx* dst;       /* current graph edge destination vertex */
+    CvGraphEdge* edge;     /* current edge */
+
+    CvGraph* graph;        /* the graph */
+    CvSeq*   stack;        /* the graph vertex stack */
+    int      index;        /* the lower bound of certainly visited vertices */
+    int      mask;         /* event mask */
+}
+CvGraphScanner;
+
+/** Creates new graph scanner. */
+CVAPI(CvGraphScanner*)  cvCreateGraphScanner( CvGraph* graph,
+                                             CvGraphVtx* vtx CV_DEFAULT(NULL),
+                                             int mask CV_DEFAULT(CV_GRAPH_ALL_ITEMS));
+
+/** Releases graph scanner. */
+CVAPI(void) cvReleaseGraphScanner( CvGraphScanner** scanner );
+
+/** Get next graph element */
+CVAPI(int)  cvNextGraphItem( CvGraphScanner* scanner );
+
+/** Creates a copy of graph */
+CVAPI(CvGraph*) cvCloneGraph( const CvGraph* graph, CvMemStorage* storage );
+
+
+/** Does look-up transformation. Elements of the source array
+   (that should be 8uC1 or 8sC1) are used as indexes in lutarr 256-element table */
+CVAPI(void) cvLUT( const CvArr* src, CvArr* dst, const CvArr* lut );
+
+
+/******************* Iteration through the sequence tree *****************/
+typedef struct CvTreeNodeIterator
+{
+    const void* node;
+    int level;
+    int max_level;
+}
+CvTreeNodeIterator;
+
+CVAPI(void) cvInitTreeNodeIterator( CvTreeNodeIterator* tree_iterator,
+                                   const void* first, int max_level );
+CVAPI(void*) cvNextTreeNode( CvTreeNodeIterator* tree_iterator );
+CVAPI(void*) cvPrevTreeNode( CvTreeNodeIterator* tree_iterator );
+
+/** Inserts sequence into tree with specified "parent" sequence.
+   If parent is equal to frame (e.g. the most external contour),
+   then added contour will have null pointer to parent. */
+CVAPI(void) cvInsertNodeIntoTree( void* node, void* parent, void* frame );
+
+/** Removes contour from tree (together with the contour children). */
+CVAPI(void) cvRemoveNodeFromTree( void* node, void* frame );
+
+/** Gathers pointers to all the sequences,
+   accessible from the `first`, to the single sequence */
+CVAPI(CvSeq*) cvTreeToNodeSeq( const void* first, int header_size,
+                              CvMemStorage* storage );
+
+/** The function implements the K-means algorithm for clustering an array of sample
+   vectors in a specified number of classes */
+#define CV_KMEANS_USE_INITIAL_LABELS    1
+CVAPI(int) cvKMeans2( const CvArr* samples, int cluster_count, CvArr* labels,
+                      CvTermCriteria termcrit, int attempts CV_DEFAULT(1),
+                      CvRNG* rng CV_DEFAULT(0), int flags CV_DEFAULT(0),
+                      CvArr* _centers CV_DEFAULT(0), double* compactness CV_DEFAULT(0) );
+
+/****************************************************************************************\
+*                                    System functions                                    *
+\****************************************************************************************/
+
+/** Loads optimized functions from IPP, MKL etc. or switches back to pure C code */
+CVAPI(int)  cvUseOptimized( int on_off );
+
+typedef IplImage* (CV_STDCALL* Cv_iplCreateImageHeader)
+                            (int,int,int,char*,char*,int,int,int,int,int,
+                            IplROI*,IplImage*,void*,IplTileInfo*);
+typedef void (CV_STDCALL* Cv_iplAllocateImageData)(IplImage*,int,int);
+typedef void (CV_STDCALL* Cv_iplDeallocate)(IplImage*,int);
+typedef IplROI* (CV_STDCALL* Cv_iplCreateROI)(int,int,int,int,int);
+typedef IplImage* (CV_STDCALL* Cv_iplCloneImage)(const IplImage*);
+
+/** @brief Makes OpenCV use IPL functions for allocating IplImage and IplROI structures.
+
+Normally, the function is not called directly. Instead, a simple macro
+CV_TURN_ON_IPL_COMPATIBILITY() is used that calls cvSetIPLAllocators and passes there pointers
+to IPL allocation functions. :
+@code
+    ...
+    CV_TURN_ON_IPL_COMPATIBILITY()
+    ...
+@endcode
+@param create_header pointer to a function, creating IPL image header.
+@param allocate_data pointer to a function, allocating IPL image data.
+@param deallocate pointer to a function, deallocating IPL image.
+@param create_roi pointer to a function, creating IPL image ROI (i.e. Region of Interest).
+@param clone_image pointer to a function, cloning an IPL image.
+ */
+CVAPI(void) cvSetIPLAllocators( Cv_iplCreateImageHeader create_header,
+                               Cv_iplAllocateImageData allocate_data,
+                               Cv_iplDeallocate deallocate,
+                               Cv_iplCreateROI create_roi,
+                               Cv_iplCloneImage clone_image );
+
+#define CV_TURN_ON_IPL_COMPATIBILITY()                                  \
+    cvSetIPLAllocators( iplCreateImageHeader, iplAllocateImage,         \
+                        iplDeallocate, iplCreateROI, iplCloneImage )
+
+/****************************************************************************************\
+*                                    Data Persistence                                    *
+\****************************************************************************************/
+
+/********************************** High-level functions ********************************/
+
+/** @brief Opens file storage for reading or writing data.
+
+The function opens file storage for reading or writing data. In the latter case, a new file is
+created or an existing file is rewritten. The type of the read or written file is determined by the
+filename extension: .xml for XML and .yml or .yaml for YAML. The function returns a pointer to the
+CvFileStorage structure. If the file cannot be opened then the function returns NULL.
+@param filename Name of the file associated with the storage
+@param memstorage Memory storage used for temporary data and for
+:   storing dynamic structures, such as CvSeq or CvGraph . If it is NULL, a temporary memory
+    storage is created and used.
+@param flags Can be one of the following:
+> -   **CV_STORAGE_READ** the storage is open for reading
+> -   **CV_STORAGE_WRITE** the storage is open for writing
+@param encoding
+ */
+CVAPI(CvFileStorage*)  cvOpenFileStorage( const char* filename, CvMemStorage* memstorage,
+                                          int flags, const char* encoding CV_DEFAULT(NULL) );
+
+/** @brief Releases file storage.
+
+The function closes the file associated with the storage and releases all the temporary structures.
+It must be called after all I/O operations with the storage are finished.
+@param fs Double pointer to the released file storage
+ */
+CVAPI(void) cvReleaseFileStorage( CvFileStorage** fs );
+
+/** returns attribute value or 0 (NULL) if there is no such attribute */
+CVAPI(const char*) cvAttrValue( const CvAttrList* attr, const char* attr_name );
+
+/** @brief Starts writing a new structure.
+
+The function starts writing a compound structure (collection) that can be a sequence or a map. After
+all the structure fields, which can be scalars or structures, are written, cvEndWriteStruct should
+be called. The function can be used to group some objects or to implement the write function for a
+some user object (see CvTypeInfo).
+@param fs File storage
+@param name Name of the written structure. The structure can be accessed by this name when the
+storage is read.
+@param struct_flags A combination one of the following values:
+-   **CV_NODE_SEQ** the written structure is a sequence (see discussion of CvFileStorage ),
+    that is, its elements do not have a name.
+-   **CV_NODE_MAP** the written structure is a map (see discussion of CvFileStorage ), that
+    is, all its elements have names.
+One and only one of the two above flags must be specified
+-   **CV_NODE_FLOW** the optional flag that makes sense only for YAML streams. It means that
+     the structure is written as a flow (not as a block), which is more compact. It is
+     recommended to use this flag for structures or arrays whose elements are all scalars.
+@param type_name Optional parameter - the object type name. In
+    case of XML it is written as a type_id attribute of the structure opening tag. In the case of
+    YAML it is written after a colon following the structure name (see the example in
+    CvFileStorage description). Mainly it is used with user objects. When the storage is read, the
+    encoded type name is used to determine the object type (see CvTypeInfo and cvFindType ).
+@param attributes This parameter is not used in the current implementation
+ */
+CVAPI(void) cvStartWriteStruct( CvFileStorage* fs, const char* name,
+                                int struct_flags, const char* type_name CV_DEFAULT(NULL),
+                                CvAttrList attributes CV_DEFAULT(cvAttrList()));
+
+/** @brief Finishes writing to a file node collection.
+@param fs File storage
+@sa cvStartWriteStruct.
+ */
+CVAPI(void) cvEndWriteStruct( CvFileStorage* fs );
+
+/** @brief Writes an integer value.
+
+The function writes a single integer value (with or without a name) to the file storage.
+@param fs File storage
+@param name Name of the written value. Should be NULL if and only if the parent structure is a
+sequence.
+@param value The written value
+ */
+CVAPI(void) cvWriteInt( CvFileStorage* fs, const char* name, int value );
+
+/** @brief Writes a floating-point value.
+
+The function writes a single floating-point value (with or without a name) to file storage. Special
+values are encoded as follows: NaN (Not A Number) as .NaN, infinity as +.Inf or -.Inf.
+
+The following example shows how to use the low-level writing functions to store custom structures,
+such as termination criteria, without registering a new type. :
+@code
+    void write_termcriteria( CvFileStorage* fs, const char* struct_name,
+                             CvTermCriteria* termcrit )
+    {
+        cvStartWriteStruct( fs, struct_name, CV_NODE_MAP, NULL, cvAttrList(0,0));
+        cvWriteComment( fs, "termination criteria", 1 ); // just a description
+        if( termcrit->type & CV_TERMCRIT_ITER )
+            cvWriteInteger( fs, "max_iterations", termcrit->max_iter );
+        if( termcrit->type & CV_TERMCRIT_EPS )
+            cvWriteReal( fs, "accuracy", termcrit->epsilon );
+        cvEndWriteStruct( fs );
+    }
+@endcode
+@param fs File storage
+@param name Name of the written value. Should be NULL if and only if the parent structure is a
+sequence.
+@param value The written value
+*/
+CVAPI(void) cvWriteReal( CvFileStorage* fs, const char* name, double value );
+
+/** @brief Writes a text string.
+
+The function writes a text string to file storage.
+@param fs File storage
+@param name Name of the written string . Should be NULL if and only if the parent structure is a
+sequence.
+@param str The written text string
+@param quote If non-zero, the written string is put in quotes, regardless of whether they are
+required. Otherwise, if the flag is zero, quotes are used only when they are required (e.g. when
+the string starts with a digit or contains spaces).
+ */
+CVAPI(void) cvWriteString( CvFileStorage* fs, const char* name,
+                           const char* str, int quote CV_DEFAULT(0) );
+
+/** @brief Writes a comment.
+
+The function writes a comment into file storage. The comments are skipped when the storage is read.
+@param fs File storage
+@param comment The written comment, single-line or multi-line
+@param eol_comment If non-zero, the function tries to put the comment at the end of current line.
+If the flag is zero, if the comment is multi-line, or if it does not fit at the end of the current
+line, the comment starts a new line.
+ */
+CVAPI(void) cvWriteComment( CvFileStorage* fs, const char* comment,
+                            int eol_comment );
+
+/** @brief Writes an object to file storage.
+
+The function writes an object to file storage. First, the appropriate type info is found using
+cvTypeOf. Then, the write method associated with the type info is called.
+
+Attributes are used to customize the writing procedure. The standard types support the following
+attributes (all the dt attributes have the same format as in cvWriteRawData):
+
+-# CvSeq
+    -   **header_dt** description of user fields of the sequence header that follow CvSeq, or
+        CvChain (if the sequence is a Freeman chain) or CvContour (if the sequence is a contour or
+        point sequence)
+    -   **dt** description of the sequence elements.
+    -   **recursive** if the attribute is present and is not equal to "0" or "false", the whole
+        tree of sequences (contours) is stored.
+-# CvGraph
+    -   **header_dt** description of user fields of the graph header that follows CvGraph;
+    -   **vertex_dt** description of user fields of graph vertices
+    -   **edge_dt** description of user fields of graph edges (note that the edge weight is
+        always written, so there is no need to specify it explicitly)
+
+Below is the code that creates the YAML file shown in the CvFileStorage description:
+@code
+    #include "cxcore.h"
+
+    int main( int argc, char** argv )
+    {
+        CvMat* mat = cvCreateMat( 3, 3, CV_32F );
+        CvFileStorage* fs = cvOpenFileStorage( "example.yml", 0, CV_STORAGE_WRITE );
+
+        cvSetIdentity( mat );
+        cvWrite( fs, "A", mat, cvAttrList(0,0) );
+
+        cvReleaseFileStorage( &fs );
+        cvReleaseMat( &mat );
+        return 0;
+    }
+@endcode
+@param fs File storage
+@param name Name of the written object. Should be NULL if and only if the parent structure is a
+sequence.
+@param ptr Pointer to the object
+@param attributes The attributes of the object. They are specific for each particular type (see
+the discussion below).
+ */
+CVAPI(void) cvWrite( CvFileStorage* fs, const char* name, const void* ptr,
+                         CvAttrList attributes CV_DEFAULT(cvAttrList()));
+
+/** @brief Starts the next stream.
+
+The function finishes the currently written stream and starts the next stream. In the case of XML
+the file with multiple streams looks like this:
+@code{.xml}
+    <opencv_storage>
+    <!-- stream #1 data -->
+    </opencv_storage>
+    <opencv_storage>
+    <!-- stream #2 data -->
+    </opencv_storage>
+    ...
+@endcode
+The YAML file will look like this:
+@code{.yaml}
+    %YAML:1.0
+    # stream #1 data
+    ...
+    ---
+    # stream #2 data
+@endcode
+This is useful for concatenating files or for resuming the writing process.
+@param fs File storage
+ */
+CVAPI(void) cvStartNextStream( CvFileStorage* fs );
+
+/** @brief Writes multiple numbers.
+
+The function writes an array, whose elements consist of single or multiple numbers. The function
+call can be replaced with a loop containing a few cvWriteInt and cvWriteReal calls, but a single
+call is more efficient. Note that because none of the elements have a name, they should be written
+to a sequence rather than a map.
+@param fs File storage
+@param src Pointer to the written array
+@param len Number of the array elements to write
+@param dt Specification of each array element, see @ref format_spec "format specification"
+ */
+CVAPI(void) cvWriteRawData( CvFileStorage* fs, const void* src,
+                                int len, const char* dt );
+
+/** @brief Returns a unique pointer for a given name.
+
+The function returns a unique pointer for each particular file node name. This pointer can be then
+passed to the cvGetFileNode function that is faster than cvGetFileNodeByName because it compares
+text strings by comparing pointers rather than the strings' content.
+
+Consider the following example where an array of points is encoded as a sequence of 2-entry maps:
+@code
+    points:
+      - { x: 10, y: 10 }
+      - { x: 20, y: 20 }
+      - { x: 30, y: 30 }
+      # ...
+@endcode
+Then, it is possible to get hashed "x" and "y" pointers to speed up decoding of the points. :
+@code
+    #include "cxcore.h"
+
+    int main( int argc, char** argv )
+    {
+        CvFileStorage* fs = cvOpenFileStorage( "points.yml", 0, CV_STORAGE_READ );
+        CvStringHashNode* x_key = cvGetHashedNode( fs, "x", -1, 1 );
+        CvStringHashNode* y_key = cvGetHashedNode( fs, "y", -1, 1 );
+        CvFileNode* points = cvGetFileNodeByName( fs, 0, "points" );
+
+        if( CV_NODE_IS_SEQ(points->tag) )
+        {
+            CvSeq* seq = points->data.seq;
+            int i, total = seq->total;
+            CvSeqReader reader;
+            cvStartReadSeq( seq, &reader, 0 );
+            for( i = 0; i < total; i++ )
+            {
+                CvFileNode* pt = (CvFileNode*)reader.ptr;
+    #if 1 // faster variant
+                CvFileNode* xnode = cvGetFileNode( fs, pt, x_key, 0 );
+                CvFileNode* ynode = cvGetFileNode( fs, pt, y_key, 0 );
+                assert( xnode && CV_NODE_IS_INT(xnode->tag) &&
+                        ynode && CV_NODE_IS_INT(ynode->tag));
+                int x = xnode->data.i; // or x = cvReadInt( xnode, 0 );
+                int y = ynode->data.i; // or y = cvReadInt( ynode, 0 );
+    #elif 1 // slower variant; does not use x_key & y_key
+                CvFileNode* xnode = cvGetFileNodeByName( fs, pt, "x" );
+                CvFileNode* ynode = cvGetFileNodeByName( fs, pt, "y" );
+                assert( xnode && CV_NODE_IS_INT(xnode->tag) &&
+                        ynode && CV_NODE_IS_INT(ynode->tag));
+                int x = xnode->data.i; // or x = cvReadInt( xnode, 0 );
+                int y = ynode->data.i; // or y = cvReadInt( ynode, 0 );
+    #else // the slowest yet the easiest to use variant
+                int x = cvReadIntByName( fs, pt, "x", 0 );
+                int y = cvReadIntByName( fs, pt, "y", 0 );
+    #endif
+                CV_NEXT_SEQ_ELEM( seq->elem_size, reader );
+                printf("
+            }
+        }
+        cvReleaseFileStorage( &fs );
+        return 0;
+    }
+@endcode
+Please note that whatever method of accessing a map you are using, it is still much slower than
+using plain sequences; for example, in the above example, it is more efficient to encode the points
+as pairs of integers in a single numeric sequence.
+@param fs File storage
+@param name Literal node name
+@param len Length of the name (if it is known apriori), or -1 if it needs to be calculated
+@param create_missing Flag that specifies, whether an absent key should be added into the hash table
+*/
+CVAPI(CvStringHashNode*) cvGetHashedKey( CvFileStorage* fs, const char* name,
+                                        int len CV_DEFAULT(-1),
+                                        int create_missing CV_DEFAULT(0));
+
+/** @brief Retrieves one of the top-level nodes of the file storage.
+
+The function returns one of the top-level file nodes. The top-level nodes do not have a name, they
+correspond to the streams that are stored one after another in the file storage. If the index is out
+of range, the function returns a NULL pointer, so all the top-level nodes can be iterated by
+subsequent calls to the function with stream_index=0,1,..., until the NULL pointer is returned.
+This function can be used as a base for recursive traversal of the file storage.
+@param fs File storage
+@param stream_index Zero-based index of the stream. See cvStartNextStream . In most cases,
+there is only one stream in the file; however, there can be several.
+ */
+CVAPI(CvFileNode*) cvGetRootFileNode( const CvFileStorage* fs,
+                                     int stream_index CV_DEFAULT(0) );
+
+/** @brief Finds a node in a map or file storage.
+
+The function finds a file node. It is a faster version of cvGetFileNodeByName (see
+cvGetHashedKey discussion). Also, the function can insert a new node, if it is not in the map yet.
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node. If both map and
+key are NULLs, the function returns the root file node - a map that contains top-level nodes.
+@param key Unique pointer to the node name, retrieved with cvGetHashedKey
+@param create_missing Flag that specifies whether an absent node should be added to the map
+ */
+CVAPI(CvFileNode*) cvGetFileNode( CvFileStorage* fs, CvFileNode* map,
+                                 const CvStringHashNode* key,
+                                 int create_missing CV_DEFAULT(0) );
+
+/** @brief Finds a node in a map or file storage.
+
+The function finds a file node by name. The node is searched either in map or, if the pointer is
+NULL, among the top-level file storage nodes. Using this function for maps and cvGetSeqElem (or
+sequence reader) for sequences, it is possible to navigate through the file storage. To speed up
+multiple queries for a certain key (e.g., in the case of an array of structures) one may use a
+combination of cvGetHashedKey and cvGetFileNode.
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches in all the top-level nodes
+(streams), starting with the first one.
+@param name The file node name
+ */
+CVAPI(CvFileNode*) cvGetFileNodeByName( const CvFileStorage* fs,
+                                       const CvFileNode* map,
+                                       const char* name );
+
+/** @brief Retrieves an integer value from a file node.
+
+The function returns an integer that is represented by the file node. If the file node is NULL, the
+default_value is returned (thus, it is convenient to call the function right after cvGetFileNode
+without checking for a NULL pointer). If the file node has type CV_NODE_INT, then node-\>data.i is
+returned. If the file node has type CV_NODE_REAL, then node-\>data.f is converted to an integer
+and returned. Otherwise the error is reported.
+@param node File node
+@param default_value The value that is returned if node is NULL
+ */
+CV_INLINE int cvReadInt( const CvFileNode* node, int default_value CV_DEFAULT(0) )
+{
+    return !node ? default_value :
+        CV_NODE_IS_INT(node->tag) ? node->data.i :
+        CV_NODE_IS_REAL(node->tag) ? cvRound(node->data.f) : 0x7fffffff;
+}
+
+/** @brief Finds a file node and returns its value.
+
+The function is a simple superposition of cvGetFileNodeByName and cvReadInt.
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node.
+@param name The node name
+@param default_value The value that is returned if the file node is not found
+ */
+CV_INLINE int cvReadIntByName( const CvFileStorage* fs, const CvFileNode* map,
+                         const char* name, int default_value CV_DEFAULT(0) )
+{
+    return cvReadInt( cvGetFileNodeByName( fs, map, name ), default_value );
+}
+
+/** @brief Retrieves a floating-point value from a file node.
+
+The function returns a floating-point value that is represented by the file node. If the file node
+is NULL, the default_value is returned (thus, it is convenient to call the function right after
+cvGetFileNode without checking for a NULL pointer). If the file node has type CV_NODE_REAL ,
+then node-\>data.f is returned. If the file node has type CV_NODE_INT , then node-:math:\>data.f
+is converted to floating-point and returned. Otherwise the result is not determined.
+@param node File node
+@param default_value The value that is returned if node is NULL
+ */
+CV_INLINE double cvReadReal( const CvFileNode* node, double default_value CV_DEFAULT(0.) )
+{
+    return !node ? default_value :
+        CV_NODE_IS_INT(node->tag) ? (double)node->data.i :
+        CV_NODE_IS_REAL(node->tag) ? node->data.f : 1e300;
+}
+
+/** @brief Finds a file node and returns its value.
+
+The function is a simple superposition of cvGetFileNodeByName and cvReadReal .
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node.
+@param name The node name
+@param default_value The value that is returned if the file node is not found
+ */
+CV_INLINE double cvReadRealByName( const CvFileStorage* fs, const CvFileNode* map,
+                        const char* name, double default_value CV_DEFAULT(0.) )
+{
+    return cvReadReal( cvGetFileNodeByName( fs, map, name ), default_value );
+}
+
+/** @brief Retrieves a text string from a file node.
+
+The function returns a text string that is represented by the file node. If the file node is NULL,
+the default_value is returned (thus, it is convenient to call the function right after
+cvGetFileNode without checking for a NULL pointer). If the file node has type CV_NODE_STR , then
+node-:math:\>data.str.ptr is returned. Otherwise the result is not determined.
+@param node File node
+@param default_value The value that is returned if node is NULL
+ */
+CV_INLINE const char* cvReadString( const CvFileNode* node,
+                        const char* default_value CV_DEFAULT(NULL) )
+{
+    return !node ? default_value : CV_NODE_IS_STRING(node->tag) ? node->data.str.ptr : 0;
+}
+
+/** @brief Finds a file node by its name and returns its value.
+
+The function is a simple superposition of cvGetFileNodeByName and cvReadString .
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node.
+@param name The node name
+@param default_value The value that is returned if the file node is not found
+ */
+CV_INLINE const char* cvReadStringByName( const CvFileStorage* fs, const CvFileNode* map,
+                        const char* name, const char* default_value CV_DEFAULT(NULL) )
+{
+    return cvReadString( cvGetFileNodeByName( fs, map, name ), default_value );
+}
+
+
+/** @brief Decodes an object and returns a pointer to it.
+
+The function decodes a user object (creates an object in a native representation from the file
+storage subtree) and returns it. The object to be decoded must be an instance of a registered type
+that supports the read method (see CvTypeInfo). The type of the object is determined by the type
+name that is encoded in the file. If the object is a dynamic structure, it is created either in
+memory storage and passed to cvOpenFileStorage or, if a NULL pointer was passed, in temporary
+memory storage, which is released when cvReleaseFileStorage is called. Otherwise, if the object is
+not a dynamic structure, it is created in a heap and should be released with a specialized function
+or by using the generic cvRelease.
+@param fs File storage
+@param node The root object node
+@param attributes Unused parameter
+ */
+CVAPI(void*) cvRead( CvFileStorage* fs, CvFileNode* node,
+                        CvAttrList* attributes CV_DEFAULT(NULL));
+
+/** @brief Finds an object by name and decodes it.
+
+The function is a simple superposition of cvGetFileNodeByName and cvRead.
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node.
+@param name The node name
+@param attributes Unused parameter
+ */
+CV_INLINE void* cvReadByName( CvFileStorage* fs, const CvFileNode* map,
+                              const char* name, CvAttrList* attributes CV_DEFAULT(NULL) )
+{
+    return cvRead( fs, cvGetFileNodeByName( fs, map, name ), attributes );
+}
+
+
+/** @brief Initializes the file node sequence reader.
+
+The function initializes the sequence reader to read data from a file node. The initialized reader
+can be then passed to cvReadRawDataSlice.
+@param fs File storage
+@param src The file node (a sequence) to read numbers from
+@param reader Pointer to the sequence reader
+ */
+CVAPI(void) cvStartReadRawData( const CvFileStorage* fs, const CvFileNode* src,
+                               CvSeqReader* reader );
+
+/** @brief Initializes file node sequence reader.
+
+The function reads one or more elements from the file node, representing a sequence, to a
+user-specified array. The total number of read sequence elements is a product of total and the
+number of components in each array element. For example, if dt=2if, the function will read total\*3
+sequence elements. As with any sequence, some parts of the file node sequence can be skipped or read
+repeatedly by repositioning the reader using cvSetSeqReaderPos.
+@param fs File storage
+@param reader The sequence reader. Initialize it with cvStartReadRawData .
+@param count The number of elements to read
+@param dst Pointer to the destination array
+@param dt Specification of each array element. It has the same format as in cvWriteRawData .
+ */
+CVAPI(void) cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader,
+                               int count, void* dst, const char* dt );
+
+/** @brief Reads multiple numbers.
+
+The function reads elements from a file node that represents a sequence of scalars.
+@param fs File storage
+@param src The file node (a sequence) to read numbers from
+@param dst Pointer to the destination array
+@param dt Specification of each array element. It has the same format as in cvWriteRawData .
+ */
+CVAPI(void) cvReadRawData( const CvFileStorage* fs, const CvFileNode* src,
+                          void* dst, const char* dt );
+
+/** @brief Writes a file node to another file storage.
+
+The function writes a copy of a file node to file storage. Possible applications of the function are
+merging several file storages into one and conversion between XML and YAML formats.
+@param fs Destination file storage
+@param new_node_name New name of the file node in the destination file storage. To keep the
+existing name, use cvcvGetFileNodeName
+@param node The written node
+@param embed If the written node is a collection and this parameter is not zero, no extra level of
+hierarchy is created. Instead, all the elements of node are written into the currently written
+structure. Of course, map elements can only be embedded into another map, and sequence elements
+can only be embedded into another sequence.
+ */
+CVAPI(void) cvWriteFileNode( CvFileStorage* fs, const char* new_node_name,
+                            const CvFileNode* node, int embed );
+
+/** @brief Returns the name of a file node.
+
+The function returns the name of a file node or NULL, if the file node does not have a name or if
+node is NULL.
+@param node File node
+ */
+CVAPI(const char*) cvGetFileNodeName( const CvFileNode* node );
+
+/*********************************** Adding own types ***********************************/
+
+/** @brief Registers a new type.
+
+The function registers a new type, which is described by info . The function creates a copy of the
+structure, so the user should delete it after calling the function.
+@param info Type info structure
+ */
+CVAPI(void) cvRegisterType( const CvTypeInfo* info );
+
+/** @brief Unregisters the type.
+
+The function unregisters a type with a specified name. If the name is unknown, it is possible to
+locate the type info by an instance of the type using cvTypeOf or by iterating the type list,
+starting from cvFirstType, and then calling cvUnregisterType(info-\>typeName).
+@param type_name Name of an unregistered type
+ */
+CVAPI(void) cvUnregisterType( const char* type_name );
+
+/** @brief Returns the beginning of a type list.
+
+The function returns the first type in the list of registered types. Navigation through the list can
+be done via the prev and next fields of the CvTypeInfo structure.
+ */
+CVAPI(CvTypeInfo*) cvFirstType(void);
+
+/** @brief Finds a type by its name.
+
+The function finds a registered type by its name. It returns NULL if there is no type with the
+specified name.
+@param type_name Type name
+ */
+CVAPI(CvTypeInfo*) cvFindType( const char* type_name );
+
+/** @brief Returns the type of an object.
+
+The function finds the type of a given object. It iterates through the list of registered types and
+calls the is_instance function/method for every type info structure with that object until one of
+them returns non-zero or until the whole list has been traversed. In the latter case, the function
+returns NULL.
+@param struct_ptr The object pointer
+ */
+CVAPI(CvTypeInfo*) cvTypeOf( const void* struct_ptr );
+
+/** @brief Releases an object.
+
+The function finds the type of a given object and calls release with the double pointer.
+@param struct_ptr Double pointer to the object
+ */
+CVAPI(void) cvRelease( void** struct_ptr );
+
+/** @brief Makes a clone of an object.
+
+The function finds the type of a given object and calls clone with the passed object. Of course, if
+you know the object type, for example, struct_ptr is CvMat\*, it is faster to call the specific
+function, like cvCloneMat.
+@param struct_ptr The object to clone
+ */
+CVAPI(void*) cvClone( const void* struct_ptr );
+
+/** @brief Saves an object to a file.
+
+The function saves an object to a file. It provides a simple interface to cvWrite .
+@param filename File name
+@param struct_ptr Object to save
+@param name Optional object name. If it is NULL, the name will be formed from filename .
+@param comment Optional comment to put in the beginning of the file
+@param attributes Optional attributes passed to cvWrite
+ */
+CVAPI(void) cvSave( const char* filename, const void* struct_ptr,
+                    const char* name CV_DEFAULT(NULL),
+                    const char* comment CV_DEFAULT(NULL),
+                    CvAttrList attributes CV_DEFAULT(cvAttrList()));
+
+/** @brief Loads an object from a file.
+
+The function loads an object from a file. It basically reads the specified file, find the first
+top-level node and calls cvRead for that node. If the file node does not have type information or
+the type information can not be found by the type name, the function returns NULL. After the object
+is loaded, the file storage is closed and all the temporary buffers are deleted. Thus, to load a
+dynamic structure, such as a sequence, contour, or graph, one should pass a valid memory storage
+destination to the function.
+@param filename File name
+@param memstorage Memory storage for dynamic structures, such as CvSeq or CvGraph . It is not used
+for matrices or images.
+@param name Optional object name. If it is NULL, the first top-level object in the storage will be
+loaded.
+@param real_name Optional output parameter that will contain the name of the loaded object
+(useful if name=NULL )
+ */
+CVAPI(void*) cvLoad( const char* filename,
+                     CvMemStorage* memstorage CV_DEFAULT(NULL),
+                     const char* name CV_DEFAULT(NULL),
+                     const char** real_name CV_DEFAULT(NULL) );
+
+/*********************************** Measuring Execution Time ***************************/
+
+/** helper functions for RNG initialization and accurate time measurement:
+   uses internal clock counter on x86 */
+CVAPI(int64)  cvGetTickCount( void );
+CVAPI(double) cvGetTickFrequency( void );
+
+/*********************************** CPU capabilities ***********************************/
+
+CVAPI(int) cvCheckHardwareSupport(int feature);
+
+/*********************************** Multi-Threading ************************************/
+
+/** retrieve/set the number of threads used in OpenMP implementations */
+CVAPI(int)  cvGetNumThreads( void );
+CVAPI(void) cvSetNumThreads( int threads CV_DEFAULT(0) );
+/** get index of the thread being executed */
+CVAPI(int)  cvGetThreadNum( void );
+
+
+/********************************** Error Handling **************************************/
+
+/** Get current OpenCV error status */
+CVAPI(int) cvGetErrStatus( void );
+
+/** Sets error status silently */
+CVAPI(void) cvSetErrStatus( int status );
+
+#define CV_ErrModeLeaf     0   /* Print error and exit program */
+#define CV_ErrModeParent   1   /* Print error and continue */
+#define CV_ErrModeSilent   2   /* Don't print and continue */
+
+/** Retrives current error processing mode */
+CVAPI(int)  cvGetErrMode( void );
+
+/** Sets error processing mode, returns previously used mode */
+CVAPI(int) cvSetErrMode( int mode );
+
+/** Sets error status and performs some additonal actions (displaying message box,
+ writing message to stderr, terminating application etc.)
+ depending on the current error mode */
+CVAPI(void) cvError( int status, const char* func_name,
+                    const char* err_msg, const char* file_name, int line );
+
+/** Retrieves textual description of the error given its code */
+CVAPI(const char*) cvErrorStr( int status );
+
+/** Retrieves detailed information about the last error occured */
+CVAPI(int) cvGetErrInfo( const char** errcode_desc, const char** description,
+                        const char** filename, int* line );
+
+/** Maps IPP error codes to the counterparts from OpenCV */
+CVAPI(int) cvErrorFromIppStatus( int ipp_status );
+
+typedef int (CV_CDECL *CvErrorCallback)( int status, const char* func_name,
+                                        const char* err_msg, const char* file_name, int line, void* userdata );
+
+/** Assigns a new error-handling function */
+CVAPI(CvErrorCallback) cvRedirectError( CvErrorCallback error_handler,
+                                       void* userdata CV_DEFAULT(NULL),
+                                       void** prev_userdata CV_DEFAULT(NULL) );
+
+/** Output nothing */
+CVAPI(int) cvNulDevReport( int status, const char* func_name, const char* err_msg,
+                          const char* file_name, int line, void* userdata );
+
+/** Output to console(fprintf(stderr,...)) */
+CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_msg,
+                          const char* file_name, int line, void* userdata );
+
+/** Output to MessageBox(WIN32) */
+CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg,
+                          const char* file_name, int line, void* userdata );
+
+#define OPENCV_ERROR(status,func,context)                           \
+cvError((status),(func),(context),__FILE__,__LINE__)
+
+#define OPENCV_ASSERT(expr,func,context)                            \
+{if (! (expr))                                      \
+{OPENCV_ERROR(CV_StsInternal,(func),(context));}}
+
+#define OPENCV_CALL( Func )                                         \
+{                                                                   \
+Func;                                                           \
+}
+
+
+/** CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
+#ifdef CV_NO_FUNC_NAMES
+#define CV_FUNCNAME( Name )
+#define cvFuncName ""
+#else
+#define CV_FUNCNAME( Name )  \
+static char cvFuncName[] = Name
+#endif
+
+
+/**
+ CV_ERROR macro unconditionally raises error with passed code and message.
+ After raising error, control will be transferred to the exit label.
+ */
+#define CV_ERROR( Code, Msg )                                       \
+{                                                                   \
+    cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ );        \
+    __CV_EXIT__;                                                   \
+}
+
+/**
+ CV_CHECK macro checks error status after CV (or IPL)
+ function call. If error detected, control will be transferred to the exit
+ label.
+ */
+#define CV_CHECK()                                                  \
+{                                                                   \
+    if( cvGetErrStatus() < 0 )                                      \
+        CV_ERROR( CV_StsBackTrace, "Inner function failed." );      \
+}
+
+
+/**
+ CV_CALL macro calls CV (or IPL) function, checks error status and
+ signals a error if the function failed. Useful in "parent node"
+ error procesing mode
+ */
+#define CV_CALL( Func )                                             \
+{                                                                   \
+    Func;                                                           \
+    CV_CHECK();                                                     \
+}
+
+
+/** Runtime assertion macro */
+#define CV_ASSERT( Condition )                                          \
+{                                                                       \
+    if( !(Condition) )                                                  \
+        CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \
+}
+
+#define __CV_BEGIN__       {
+#define __CV_END__         goto exit; exit: ; }
+#define __CV_EXIT__        goto exit
+
+/** @} core_c */
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#ifdef __cplusplus
+
+//! @addtogroup core_c_glue
+//! @{
+
+//! class for automatic module/RTTI data registration/unregistration
+struct CV_EXPORTS CvType
+{
+    CvType( const char* type_name,
+            CvIsInstanceFunc is_instance, CvReleaseFunc release=0,
+            CvReadFunc read=0, CvWriteFunc write=0, CvCloneFunc clone=0 );
+    ~CvType();
+    CvTypeInfo* info;
+
+    static CvTypeInfo* first;
+    static CvTypeInfo* last;
+};
+
+//! @}
+
+#include "opencv2/core/utility.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_c_glue
+//! @{
+
+/////////////////////////////////////////// glue ///////////////////////////////////////////
+
+//! converts array (CvMat or IplImage) to cv::Mat
+CV_EXPORTS Mat cvarrToMat(const CvArr* arr, bool copyData=false,
+                          bool allowND=true, int coiMode=0,
+                          AutoBuffer<double>* buf=0);
+
+static inline Mat cvarrToMatND(const CvArr* arr, bool copyData=false, int coiMode=0)
+{
+    return cvarrToMat(arr, copyData, true, coiMode);
+}
+
+
+//! extracts Channel of Interest from CvMat or IplImage and makes cv::Mat out of it.
+CV_EXPORTS void extractImageCOI(const CvArr* arr, OutputArray coiimg, int coi=-1);
+//! inserts single-channel cv::Mat into a multi-channel CvMat or IplImage
+CV_EXPORTS void insertImageCOI(InputArray coiimg, CvArr* arr, int coi=-1);
+
+
+
+////// specialized implementations of DefaultDeleter::operator() for classic OpenCV types //////
+
+template<> CV_EXPORTS void DefaultDeleter<CvMat>::operator ()(CvMat* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<IplImage>::operator ()(IplImage* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<CvMatND>::operator ()(CvMatND* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<CvSparseMat>::operator ()(CvSparseMat* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<CvMemStorage>::operator ()(CvMemStorage* obj) const;
+
+////////////// convenient wrappers for operating old-style dynamic structures //////////////
+
+template<typename _Tp> class SeqIterator;
+
+typedef Ptr<CvMemStorage> MemStorage;
+
+/*!
+ Template Sequence Class derived from CvSeq
+
+ The class provides more convenient access to sequence elements,
+ STL-style operations and iterators.
+
+ \note The class is targeted for simple data types,
+    i.e. no constructors or destructors
+    are called for the sequence elements.
+*/
+template<typename _Tp> class Seq
+{
+public:
+    typedef SeqIterator<_Tp> iterator;
+    typedef SeqIterator<_Tp> const_iterator;
+
+    //! the default constructor
+    Seq();
+    //! the constructor for wrapping CvSeq structure. The real element type in CvSeq should match _Tp.
+    Seq(const CvSeq* seq);
+    //! creates the empty sequence that resides in the specified storage
+    Seq(MemStorage& storage, int headerSize = sizeof(CvSeq));
+    //! returns read-write reference to the specified element
+    _Tp& operator [](int idx);
+    //! returns read-only reference to the specified element
+    const _Tp& operator[](int idx) const;
+    //! returns iterator pointing to the beginning of the sequence
+    SeqIterator<_Tp> begin() const;
+    //! returns iterator pointing to the element following the last sequence element
+    SeqIterator<_Tp> end() const;
+    //! returns the number of elements in the sequence
+    size_t size() const;
+    //! returns the type of sequence elements (CV_8UC1 ... CV_64FC(CV_CN_MAX) ...)
+    int type() const;
+    //! returns the depth of sequence elements (CV_8U ... CV_64F)
+    int depth() const;
+    //! returns the number of channels in each sequence element
+    int channels() const;
+    //! returns the size of each sequence element
+    size_t elemSize() const;
+    //! returns index of the specified sequence element
+    size_t index(const _Tp& elem) const;
+    //! appends the specified element to the end of the sequence
+    void push_back(const _Tp& elem);
+    //! appends the specified element to the front of the sequence
+    void push_front(const _Tp& elem);
+    //! appends zero or more elements to the end of the sequence
+    void push_back(const _Tp* elems, size_t count);
+    //! appends zero or more elements to the front of the sequence
+    void push_front(const _Tp* elems, size_t count);
+    //! inserts the specified element to the specified position
+    void insert(int idx, const _Tp& elem);
+    //! inserts zero or more elements to the specified position
+    void insert(int idx, const _Tp* elems, size_t count);
+    //! removes element at the specified position
+    void remove(int idx);
+    //! removes the specified subsequence
+    void remove(const Range& r);
+
+    //! returns reference to the first sequence element
+    _Tp& front();
+    //! returns read-only reference to the first sequence element
+    const _Tp& front() const;
+    //! returns reference to the last sequence element
+    _Tp& back();
+    //! returns read-only reference to the last sequence element
+    const _Tp& back() const;
+    //! returns true iff the sequence contains no elements
+    bool empty() const;
+
+    //! removes all the elements from the sequence
+    void clear();
+    //! removes the first element from the sequence
+    void pop_front();
+    //! removes the last element from the sequence
+    void pop_back();
+    //! removes zero or more elements from the beginning of the sequence
+    void pop_front(_Tp* elems, size_t count);
+    //! removes zero or more elements from the end of the sequence
+    void pop_back(_Tp* elems, size_t count);
+
+    //! copies the whole sequence or the sequence slice to the specified vector
+    void copyTo(std::vector<_Tp>& vec, const Range& range=Range::all()) const;
+    //! returns the vector containing all the sequence elements
+    operator std::vector<_Tp>() const;
+
+    CvSeq* seq;
+};
+
+
+/*!
+ STL-style Sequence Iterator inherited from the CvSeqReader structure
+*/
+template<typename _Tp> class SeqIterator : public CvSeqReader
+{
+public:
+    //! the default constructor
+    SeqIterator();
+    //! the constructor setting the iterator to the beginning or to the end of the sequence
+    SeqIterator(const Seq<_Tp>& seq, bool seekEnd=false);
+    //! positions the iterator within the sequence
+    void seek(size_t pos);
+    //! reports the current iterator position
+    size_t tell() const;
+    //! returns reference to the current sequence element
+    _Tp& operator *();
+    //! returns read-only reference to the current sequence element
+    const _Tp& operator *() const;
+    //! moves iterator to the next sequence element
+    SeqIterator& operator ++();
+    //! moves iterator to the next sequence element
+    SeqIterator operator ++(int) const;
+    //! moves iterator to the previous sequence element
+    SeqIterator& operator --();
+    //! moves iterator to the previous sequence element
+    SeqIterator operator --(int) const;
+
+    //! moves iterator forward by the specified offset (possibly negative)
+    SeqIterator& operator +=(int);
+    //! moves iterator backward by the specified offset (possibly negative)
+    SeqIterator& operator -=(int);
+
+    // this is index of the current element module seq->total*2
+    // (to distinguish between 0 and seq->total)
+    int index;
+};
+
+
+
+// bridge C++ => C Seq API
+CV_EXPORTS schar*  seqPush( CvSeq* seq, const void* element=0);
+CV_EXPORTS schar*  seqPushFront( CvSeq* seq, const void* element=0);
+CV_EXPORTS void  seqPop( CvSeq* seq, void* element=0);
+CV_EXPORTS void  seqPopFront( CvSeq* seq, void* element=0);
+CV_EXPORTS void  seqPopMulti( CvSeq* seq, void* elements,
+                              int count, int in_front=0 );
+CV_EXPORTS void  seqRemove( CvSeq* seq, int index );
+CV_EXPORTS void  clearSeq( CvSeq* seq );
+CV_EXPORTS schar*  getSeqElem( const CvSeq* seq, int index );
+CV_EXPORTS void  seqRemoveSlice( CvSeq* seq, CvSlice slice );
+CV_EXPORTS void  seqInsertSlice( CvSeq* seq, int before_index, const CvArr* from_arr );
+
+template<typename _Tp> inline Seq<_Tp>::Seq() : seq(0) {}
+template<typename _Tp> inline Seq<_Tp>::Seq( const CvSeq* _seq ) : seq((CvSeq*)_seq)
+{
+    CV_Assert(!_seq || _seq->elem_size == sizeof(_Tp));
+}
+
+template<typename _Tp> inline Seq<_Tp>::Seq( MemStorage& storage,
+                                             int headerSize )
+{
+    CV_Assert(headerSize >= (int)sizeof(CvSeq));
+    seq = cvCreateSeq(DataType<_Tp>::type, headerSize, sizeof(_Tp), storage);
+}
+
+template<typename _Tp> inline _Tp& Seq<_Tp>::operator [](int idx)
+{ return *(_Tp*)getSeqElem(seq, idx); }
+
+template<typename _Tp> inline const _Tp& Seq<_Tp>::operator [](int idx) const
+{ return *(_Tp*)getSeqElem(seq, idx); }
+
+template<typename _Tp> inline SeqIterator<_Tp> Seq<_Tp>::begin() const
+{ return SeqIterator<_Tp>(*this); }
+
+template<typename _Tp> inline SeqIterator<_Tp> Seq<_Tp>::end() const
+{ return SeqIterator<_Tp>(*this, true); }
+
+template<typename _Tp> inline size_t Seq<_Tp>::size() const
+{ return seq ? seq->total : 0; }
+
+template<typename _Tp> inline int Seq<_Tp>::type() const
+{ return seq ? CV_MAT_TYPE(seq->flags) : 0; }
+
+template<typename _Tp> inline int Seq<_Tp>::depth() const
+{ return seq ? CV_MAT_DEPTH(seq->flags) : 0; }
+
+template<typename _Tp> inline int Seq<_Tp>::channels() const
+{ return seq ? CV_MAT_CN(seq->flags) : 0; }
+
+template<typename _Tp> inline size_t Seq<_Tp>::elemSize() const
+{ return seq ? seq->elem_size : 0; }
+
+template<typename _Tp> inline size_t Seq<_Tp>::index(const _Tp& elem) const
+{ return cvSeqElemIdx(seq, &elem); }
+
+template<typename _Tp> inline void Seq<_Tp>::push_back(const _Tp& elem)
+{ cvSeqPush(seq, &elem); }
+
+template<typename _Tp> inline void Seq<_Tp>::push_front(const _Tp& elem)
+{ cvSeqPushFront(seq, &elem); }
+
+template<typename _Tp> inline void Seq<_Tp>::push_back(const _Tp* elem, size_t count)
+{ cvSeqPushMulti(seq, elem, (int)count, 0); }
+
+template<typename _Tp> inline void Seq<_Tp>::push_front(const _Tp* elem, size_t count)
+{ cvSeqPushMulti(seq, elem, (int)count, 1); }
+
+template<typename _Tp> inline _Tp& Seq<_Tp>::back()
+{ return *(_Tp*)getSeqElem(seq, -1); }
+
+template<typename _Tp> inline const _Tp& Seq<_Tp>::back() const
+{ return *(const _Tp*)getSeqElem(seq, -1); }
+
+template<typename _Tp> inline _Tp& Seq<_Tp>::front()
+{ return *(_Tp*)getSeqElem(seq, 0); }
+
+template<typename _Tp> inline const _Tp& Seq<_Tp>::front() const
+{ return *(const _Tp*)getSeqElem(seq, 0); }
+
+template<typename _Tp> inline bool Seq<_Tp>::empty() const
+{ return !seq || seq->total == 0; }
+
+template<typename _Tp> inline void Seq<_Tp>::clear()
+{ if(seq) clearSeq(seq); }
+
+template<typename _Tp> inline void Seq<_Tp>::pop_back()
+{ seqPop(seq); }
+
+template<typename _Tp> inline void Seq<_Tp>::pop_front()
+{ seqPopFront(seq); }
+
+template<typename _Tp> inline void Seq<_Tp>::pop_back(_Tp* elem, size_t count)
+{ seqPopMulti(seq, elem, (int)count, 0); }
+
+template<typename _Tp> inline void Seq<_Tp>::pop_front(_Tp* elem, size_t count)
+{ seqPopMulti(seq, elem, (int)count, 1); }
+
+template<typename _Tp> inline void Seq<_Tp>::insert(int idx, const _Tp& elem)
+{ seqInsert(seq, idx, &elem); }
+
+template<typename _Tp> inline void Seq<_Tp>::insert(int idx, const _Tp* elems, size_t count)
+{
+    CvMat m = cvMat(1, count, DataType<_Tp>::type, elems);
+    seqInsertSlice(seq, idx, &m);
+}
+
+template<typename _Tp> inline void Seq<_Tp>::remove(int idx)
+{ seqRemove(seq, idx); }
+
+template<typename _Tp> inline void Seq<_Tp>::remove(const Range& r)
+{ seqRemoveSlice(seq, cvSlice(r.start, r.end)); }
+
+template<typename _Tp> inline void Seq<_Tp>::copyTo(std::vector<_Tp>& vec, const Range& range) const
+{
+    size_t len = !seq ? 0 : range == Range::all() ? seq->total : range.end - range.start;
+    vec.resize(len);
+    if( seq && len )
+        cvCvtSeqToArray(seq, &vec[0], range);
+}
+
+template<typename _Tp> inline Seq<_Tp>::operator std::vector<_Tp>() const
+{
+    std::vector<_Tp> vec;
+    copyTo(vec);
+    return vec;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp>::SeqIterator()
+{ memset(this, 0, sizeof(*this)); }
+
+template<typename _Tp> inline SeqIterator<_Tp>::SeqIterator(const Seq<_Tp>& _seq, bool seekEnd)
+{
+    cvStartReadSeq(_seq.seq, this);
+    index = seekEnd ? _seq.seq->total : 0;
+}
+
+template<typename _Tp> inline void SeqIterator<_Tp>::seek(size_t pos)
+{
+    cvSetSeqReaderPos(this, (int)pos, false);
+    index = pos;
+}
+
+template<typename _Tp> inline size_t SeqIterator<_Tp>::tell() const
+{ return index; }
+
+template<typename _Tp> inline _Tp& SeqIterator<_Tp>::operator *()
+{ return *(_Tp*)ptr; }
+
+template<typename _Tp> inline const _Tp& SeqIterator<_Tp>::operator *() const
+{ return *(const _Tp*)ptr; }
+
+template<typename _Tp> inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator ++()
+{
+    CV_NEXT_SEQ_ELEM(sizeof(_Tp), *this);
+    if( ++index >= seq->total*2 )
+        index = 0;
+    return *this;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp> SeqIterator<_Tp>::operator ++(int) const
+{
+    SeqIterator<_Tp> it = *this;
+    ++*this;
+    return it;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator --()
+{
+    CV_PREV_SEQ_ELEM(sizeof(_Tp), *this);
+    if( --index < 0 )
+        index = seq->total*2-1;
+    return *this;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp> SeqIterator<_Tp>::operator --(int) const
+{
+    SeqIterator<_Tp> it = *this;
+    --*this;
+    return it;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator +=(int delta)
+{
+    cvSetSeqReaderPos(this, delta, 1);
+    index += delta;
+    int n = seq->total*2;
+    if( index < 0 )
+        index += n;
+    if( index >= n )
+        index -= n;
+    return *this;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator -=(int delta)
+{
+    return (*this += -delta);
+}
+
+template<typename _Tp> inline ptrdiff_t operator - (const SeqIterator<_Tp>& a,
+                                                    const SeqIterator<_Tp>& b)
+{
+    ptrdiff_t delta = a.index - b.index, n = a.seq->total;
+    if( delta > n || delta < -n )
+        delta += delta < 0 ? n : -n;
+    return delta;
+}
+
+template<typename _Tp> inline bool operator == (const SeqIterator<_Tp>& a,
+                                                const SeqIterator<_Tp>& b)
+{
+    return a.seq == b.seq && a.index == b.index;
+}
+
+template<typename _Tp> inline bool operator != (const SeqIterator<_Tp>& a,
+                                                const SeqIterator<_Tp>& b)
+{
+    return !(a == b);
+}
+
+//! @}
+
+} // cv
+
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp
new file mode 100644
index 0000000..64bc53e
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp
@@ -0,0 +1,846 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_CUDA_HPP__
+#define __OPENCV_CORE_CUDA_HPP__
+
+#ifndef __cplusplus
+#  error cuda.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core.hpp"
+#include "opencv2/core/cuda_types.hpp"
+
+/**
+  @defgroup cuda CUDA-accelerated Computer Vision
+  @{
+    @defgroup cudacore Core part
+    @{
+      @defgroup cudacore_init Initalization and Information
+      @defgroup cudacore_struct Data Structures
+    @}
+  @}
+ */
+
+namespace cv { namespace cuda {
+
+//! @addtogroup cudacore_struct
+//! @{
+
+//===================================================================================
+// GpuMat
+//===================================================================================
+
+/** @brief Base storage class for GPU memory with reference counting.
+
+Its interface matches the Mat interface with the following limitations:
+
+-   no arbitrary dimensions support (only 2D)
+-   no functions that return references to their data (because references on GPU are not valid for
+    CPU)
+-   no expression templates technique support
+
+Beware that the latter limitation may lead to overloaded matrix operators that cause memory
+allocations. The GpuMat class is convertible to cuda::PtrStepSz and cuda::PtrStep so it can be
+passed directly to the kernel.
+
+@note In contrast with Mat, in most cases GpuMat::isContinuous() == false . This means that rows are
+aligned to a size depending on the hardware. Single-row GpuMat is always a continuous matrix.
+
+@note You are not recommended to leave static or global GpuMat variables allocated, that is, to rely
+on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory
+release function returns error if the CUDA context has been destroyed before.
+
+@sa Mat
+ */
+class CV_EXPORTS GpuMat
+{
+public:
+    class CV_EXPORTS Allocator
+    {
+    public:
+        virtual ~Allocator() {}
+
+        // allocator must fill data, step and refcount fields
+        virtual bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize) = 0;
+        virtual void free(GpuMat* mat) = 0;
+    };
+
+    //! default allocator
+    static Allocator* defaultAllocator();
+    static void setDefaultAllocator(Allocator* allocator);
+
+    //! default constructor
+    explicit GpuMat(Allocator* allocator = defaultAllocator());
+
+    //! constructs GpuMat of the specified size and type
+    GpuMat(int rows, int cols, int type, Allocator* allocator = defaultAllocator());
+    GpuMat(Size size, int type, Allocator* allocator = defaultAllocator());
+
+    //! constucts GpuMat and fills it with the specified value _s
+    GpuMat(int rows, int cols, int type, Scalar s, Allocator* allocator = defaultAllocator());
+    GpuMat(Size size, int type, Scalar s, Allocator* allocator = defaultAllocator());
+
+    //! copy constructor
+    GpuMat(const GpuMat& m);
+
+    //! constructor for GpuMat headers pointing to user-allocated data
+    GpuMat(int rows, int cols, int type, void* data, size_t step = Mat::AUTO_STEP);
+    GpuMat(Size size, int type, void* data, size_t step = Mat::AUTO_STEP);
+
+    //! creates a GpuMat header for a part of the bigger matrix
+    GpuMat(const GpuMat& m, Range rowRange, Range colRange);
+    GpuMat(const GpuMat& m, Rect roi);
+
+    //! builds GpuMat from host memory (Blocking call)
+    explicit GpuMat(InputArray arr, Allocator* allocator = defaultAllocator());
+
+    //! destructor - calls release()
+    ~GpuMat();
+
+    //! assignment operators
+    GpuMat& operator =(const GpuMat& m);
+
+    //! allocates new GpuMat data unless the GpuMat already has specified size and type
+    void create(int rows, int cols, int type);
+    void create(Size size, int type);
+
+    //! decreases reference counter, deallocate the data when reference counter reaches 0
+    void release();
+
+    //! swaps with other smart pointer
+    void swap(GpuMat& mat);
+
+    //! pefroms upload data to GpuMat (Blocking call)
+    void upload(InputArray arr);
+
+    //! pefroms upload data to GpuMat (Non-Blocking call)
+    void upload(InputArray arr, Stream& stream);
+
+    //! pefroms download data from device to host memory (Blocking call)
+    void download(OutputArray dst) const;
+
+    //! pefroms download data from device to host memory (Non-Blocking call)
+    void download(OutputArray dst, Stream& stream) const;
+
+    //! returns deep copy of the GpuMat, i.e. the data is copied
+    GpuMat clone() const;
+
+    //! copies the GpuMat content to device memory (Blocking call)
+    void copyTo(OutputArray dst) const;
+
+    //! copies the GpuMat content to device memory (Non-Blocking call)
+    void copyTo(OutputArray dst, Stream& stream) const;
+
+    //! copies those GpuMat elements to "m" that are marked with non-zero mask elements (Blocking call)
+    void copyTo(OutputArray dst, InputArray mask) const;
+
+    //! copies those GpuMat elements to "m" that are marked with non-zero mask elements (Non-Blocking call)
+    void copyTo(OutputArray dst, InputArray mask, Stream& stream) const;
+
+    //! sets some of the GpuMat elements to s (Blocking call)
+    GpuMat& setTo(Scalar s);
+
+    //! sets some of the GpuMat elements to s (Non-Blocking call)
+    GpuMat& setTo(Scalar s, Stream& stream);
+
+    //! sets some of the GpuMat elements to s, according to the mask (Blocking call)
+    GpuMat& setTo(Scalar s, InputArray mask);
+
+    //! sets some of the GpuMat elements to s, according to the mask (Non-Blocking call)
+    GpuMat& setTo(Scalar s, InputArray mask, Stream& stream);
+
+    //! converts GpuMat to another datatype (Blocking call)
+    void convertTo(OutputArray dst, int rtype) const;
+
+    //! converts GpuMat to another datatype (Non-Blocking call)
+    void convertTo(OutputArray dst, int rtype, Stream& stream) const;
+
+    //! converts GpuMat to another datatype with scaling (Blocking call)
+    void convertTo(OutputArray dst, int rtype, double alpha, double beta = 0.0) const;
+
+    //! converts GpuMat to another datatype with scaling (Non-Blocking call)
+    void convertTo(OutputArray dst, int rtype, double alpha, Stream& stream) const;
+
+    //! converts GpuMat to another datatype with scaling (Non-Blocking call)
+    void convertTo(OutputArray dst, int rtype, double alpha, double beta, Stream& stream) const;
+
+    void assignTo(GpuMat& m, int type=-1) const;
+
+    //! returns pointer to y-th row
+    uchar* ptr(int y = 0);
+    const uchar* ptr(int y = 0) const;
+
+    //! template version of the above method
+    template<typename _Tp> _Tp* ptr(int y = 0);
+    template<typename _Tp> const _Tp* ptr(int y = 0) const;
+
+    template <typename _Tp> operator PtrStepSz<_Tp>() const;
+    template <typename _Tp> operator PtrStep<_Tp>() const;
+
+    //! returns a new GpuMat header for the specified row
+    GpuMat row(int y) const;
+
+    //! returns a new GpuMat header for the specified column
+    GpuMat col(int x) const;
+
+    //! ... for the specified row span
+    GpuMat rowRange(int startrow, int endrow) const;
+    GpuMat rowRange(Range r) const;
+
+    //! ... for the specified column span
+    GpuMat colRange(int startcol, int endcol) const;
+    GpuMat colRange(Range r) const;
+
+    //! extracts a rectangular sub-GpuMat (this is a generalized form of row, rowRange etc.)
+    GpuMat operator ()(Range rowRange, Range colRange) const;
+    GpuMat operator ()(Rect roi) const;
+
+    //! creates alternative GpuMat header for the same data, with different
+    //! number of channels and/or different number of rows
+    GpuMat reshape(int cn, int rows = 0) const;
+
+    //! locates GpuMat header within a parent GpuMat
+    void locateROI(Size& wholeSize, Point& ofs) const;
+
+    //! moves/resizes the current GpuMat ROI inside the parent GpuMat
+    GpuMat& adjustROI(int dtop, int dbottom, int dleft, int dright);
+
+    //! returns true iff the GpuMat data is continuous
+    //! (i.e. when there are no gaps between successive rows)
+    bool isContinuous() const;
+
+    //! returns element size in bytes
+    size_t elemSize() const;
+
+    //! returns the size of element channel in bytes
+    size_t elemSize1() const;
+
+    //! returns element type
+    int type() const;
+
+    //! returns element type
+    int depth() const;
+
+    //! returns number of channels
+    int channels() const;
+
+    //! returns step/elemSize1()
+    size_t step1() const;
+
+    //! returns GpuMat size : width == number of columns, height == number of rows
+    Size size() const;
+
+    //! returns true if GpuMat data is NULL
+    bool empty() const;
+
+    /*! includes several bit-fields:
+    - the magic signature
+    - continuity flag
+    - depth
+    - number of channels
+    */
+    int flags;
+
+    //! the number of rows and columns
+    int rows, cols;
+
+    //! a distance between successive rows in bytes; includes the gap if any
+    size_t step;
+
+    //! pointer to the data
+    uchar* data;
+
+    //! pointer to the reference counter;
+    //! when GpuMat points to user-allocated data, the pointer is NULL
+    int* refcount;
+
+    //! helper fields used in locateROI and adjustROI
+    uchar* datastart;
+    const uchar* dataend;
+
+    //! allocator
+    Allocator* allocator;
+};
+
+/** @brief Creates a continuous matrix.
+
+@param rows Row count.
+@param cols Column count.
+@param type Type of the matrix.
+@param arr Destination matrix. This parameter changes only if it has a proper type and area (
+\f$\texttt{rows} \times \texttt{cols}\f$ ).
+
+Matrix is called continuous if its elements are stored continuously, that is, without gaps at the
+end of each row.
+ */
+CV_EXPORTS void createContinuous(int rows, int cols, int type, OutputArray arr);
+
+/** @brief Ensures that the size of a matrix is big enough and the matrix has a proper type.
+
+@param rows Minimum desired number of rows.
+@param cols Minimum desired number of columns.
+@param type Desired matrix type.
+@param arr Destination matrix.
+
+The function does not reallocate memory if the matrix has proper attributes already.
+ */
+CV_EXPORTS void ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr);
+
+//! BufferPool management (must be called before Stream creation)
+CV_EXPORTS void setBufferPoolUsage(bool on);
+CV_EXPORTS void setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount);
+
+//===================================================================================
+// HostMem
+//===================================================================================
+
+/** @brief Class with reference counting wrapping special memory type allocation functions from CUDA.
+
+Its interface is also Mat-like but with additional memory type parameters.
+
+-   **PAGE_LOCKED** sets a page locked memory type used commonly for fast and asynchronous
+    uploading/downloading data from/to GPU.
+-   **SHARED** specifies a zero copy memory allocation that enables mapping the host memory to GPU
+    address space, if supported.
+-   **WRITE_COMBINED** sets the write combined buffer that is not cached by CPU. Such buffers are
+    used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache
+    utilization.
+
+@note Allocation size of such memory types is usually limited. For more details, see *CUDA 2.2
+Pinned Memory APIs* document or *CUDA C Programming Guide*.
+ */
+class CV_EXPORTS HostMem
+{
+public:
+    enum AllocType { PAGE_LOCKED = 1, SHARED = 2, WRITE_COMBINED = 4 };
+
+    static MatAllocator* getAllocator(AllocType alloc_type = PAGE_LOCKED);
+
+    explicit HostMem(AllocType alloc_type = PAGE_LOCKED);
+
+    HostMem(const HostMem& m);
+
+    HostMem(int rows, int cols, int type, AllocType alloc_type = PAGE_LOCKED);
+    HostMem(Size size, int type, AllocType alloc_type = PAGE_LOCKED);
+
+    //! creates from host memory with coping data
+    explicit HostMem(InputArray arr, AllocType alloc_type = PAGE_LOCKED);
+
+    ~HostMem();
+
+    HostMem& operator =(const HostMem& m);
+
+    //! swaps with other smart pointer
+    void swap(HostMem& b);
+
+    //! returns deep copy of the matrix, i.e. the data is copied
+    HostMem clone() const;
+
+    //! allocates new matrix data unless the matrix already has specified size and type.
+    void create(int rows, int cols, int type);
+    void create(Size size, int type);
+
+    //! creates alternative HostMem header for the same data, with different
+    //! number of channels and/or different number of rows
+    HostMem reshape(int cn, int rows = 0) const;
+
+    //! decrements reference counter and released memory if needed.
+    void release();
+
+    //! returns matrix header with disabled reference counting for HostMem data.
+    Mat createMatHeader() const;
+
+    /** @brief Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting
+    for it.
+
+    This can be done only if memory was allocated with the SHARED flag and if it is supported by the
+    hardware. Laptops often share video and CPU memory, so address spaces can be mapped, which
+    eliminates an extra copy.
+     */
+    GpuMat createGpuMatHeader() const;
+
+    // Please see cv::Mat for descriptions
+    bool isContinuous() const;
+    size_t elemSize() const;
+    size_t elemSize1() const;
+    int type() const;
+    int depth() const;
+    int channels() const;
+    size_t step1() const;
+    Size size() const;
+    bool empty() const;
+
+    // Please see cv::Mat for descriptions
+    int flags;
+    int rows, cols;
+    size_t step;
+
+    uchar* data;
+    int* refcount;
+
+    uchar* datastart;
+    const uchar* dataend;
+
+    AllocType alloc_type;
+};
+
+/** @brief Page-locks the memory of matrix and maps it for the device(s).
+
+@param m Input matrix.
+ */
+CV_EXPORTS void registerPageLocked(Mat& m);
+
+/** @brief Unmaps the memory of matrix and makes it pageable again.
+
+@param m Input matrix.
+ */
+CV_EXPORTS void unregisterPageLocked(Mat& m);
+
+//===================================================================================
+// Stream
+//===================================================================================
+
+/** @brief This class encapsulates a queue of asynchronous calls.
+
+@note Currently, you may face problems if an operation is enqueued twice with different data. Some
+functions use the constant GPU memory, and next call may update the memory before the previous one
+has been finished. But calling different operations asynchronously is safe because each operation
+has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are
+also safe. :
+ */
+class CV_EXPORTS Stream
+{
+    typedef void (Stream::*bool_type)() const;
+    void this_type_does_not_support_comparisons() const {}
+
+public:
+    typedef void (*StreamCallback)(int status, void* userData);
+
+    //! creates a new asynchronous stream
+    Stream();
+
+    /** @brief Returns true if the current stream queue is finished. Otherwise, it returns false.
+    */
+    bool queryIfComplete() const;
+
+    /** @brief Blocks the current CPU thread until all operations in the stream are complete.
+    */
+    void waitForCompletion();
+
+    /** @brief Makes a compute stream wait on an event.
+    */
+    void waitEvent(const Event& event);
+
+    /** @brief Adds a callback to be called on the host after all currently enqueued items in the stream have
+    completed.
+
+    @note Callbacks must not make any CUDA API calls. Callbacks must not perform any synchronization
+    that may depend on outstanding device work or other callbacks that are not mandated to run earlier.
+    Callbacks without a mandated order (in independent streams) execute in undefined order and may be
+    serialized.
+     */
+    void enqueueHostCallback(StreamCallback callback, void* userData);
+
+    //! return Stream object for default CUDA stream
+    static Stream& Null();
+
+    //! returns true if stream object is not default (!= 0)
+    operator bool_type() const;
+
+    class Impl;
+
+private:
+    Ptr<Impl> impl_;
+    Stream(const Ptr<Impl>& impl);
+
+    friend struct StreamAccessor;
+    friend class BufferPool;
+    friend class DefaultDeviceInitializer;
+};
+
+class CV_EXPORTS Event
+{
+public:
+    enum CreateFlags
+    {
+        DEFAULT        = 0x00,  /**< Default event flag */
+        BLOCKING_SYNC  = 0x01,  /**< Event uses blocking synchronization */
+        DISABLE_TIMING = 0x02,  /**< Event will not record timing data */
+        INTERPROCESS   = 0x04   /**< Event is suitable for interprocess use. DisableTiming must be set */
+    };
+
+    explicit Event(CreateFlags flags = DEFAULT);
+
+    //! records an event
+    void record(Stream& stream = Stream::Null());
+
+    //! queries an event's status
+    bool queryIfComplete() const;
+
+    //! waits for an event to complete
+    void waitForCompletion();
+
+    //! computes the elapsed time between events
+    static float elapsedTime(const Event& start, const Event& end);
+
+    class Impl;
+
+private:
+    Ptr<Impl> impl_;
+    Event(const Ptr<Impl>& impl);
+
+    friend struct EventAccessor;
+};
+
+//! @} cudacore_struct
+
+//===================================================================================
+// Initialization & Info
+//===================================================================================
+
+//! @addtogroup cudacore_init
+//! @{
+
+/** @brief Returns the number of installed CUDA-enabled devices.
+
+Use this function before any other CUDA functions calls. If OpenCV is compiled without CUDA support,
+this function returns 0.
+ */
+CV_EXPORTS int getCudaEnabledDeviceCount();
+
+/** @brief Sets a device and initializes it for the current thread.
+
+@param device System index of a CUDA device starting with 0.
+
+If the call of this function is omitted, a default device is initialized at the fist CUDA usage.
+ */
+CV_EXPORTS void setDevice(int device);
+
+/** @brief Returns the current device index set by cuda::setDevice or initialized by default.
+ */
+CV_EXPORTS int getDevice();
+
+/** @brief Explicitly destroys and cleans up all resources associated with the current device in the current
+process.
+
+Any subsequent API call to this device will reinitialize the device.
+ */
+CV_EXPORTS void resetDevice();
+
+/** @brief Enumeration providing CUDA computing features.
+ */
+enum FeatureSet
+{
+    FEATURE_SET_COMPUTE_10 = 10,
+    FEATURE_SET_COMPUTE_11 = 11,
+    FEATURE_SET_COMPUTE_12 = 12,
+    FEATURE_SET_COMPUTE_13 = 13,
+    FEATURE_SET_COMPUTE_20 = 20,
+    FEATURE_SET_COMPUTE_21 = 21,
+    FEATURE_SET_COMPUTE_30 = 30,
+    FEATURE_SET_COMPUTE_32 = 32,
+    FEATURE_SET_COMPUTE_35 = 35,
+    FEATURE_SET_COMPUTE_50 = 50,
+
+    GLOBAL_ATOMICS = FEATURE_SET_COMPUTE_11,
+    SHARED_ATOMICS = FEATURE_SET_COMPUTE_12,
+    NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13,
+    WARP_SHUFFLE_FUNCTIONS = FEATURE_SET_COMPUTE_30,
+    DYNAMIC_PARALLELISM = FEATURE_SET_COMPUTE_35
+};
+
+//! checks whether current device supports the given feature
+CV_EXPORTS bool deviceSupports(FeatureSet feature_set);
+
+/** @brief Class providing a set of static methods to check what NVIDIA\* card architecture the CUDA module was
+built for.
+
+According to the CUDA C Programming Guide Version 3.2: "PTX code produced for some specific compute
+capability can always be compiled to binary code of greater or equal compute capability".
+ */
+class CV_EXPORTS TargetArchs
+{
+public:
+    /** @brief The following method checks whether the module was built with the support of the given feature:
+
+    @param feature_set Features to be checked. See :ocvcuda::FeatureSet.
+     */
+    static bool builtWith(FeatureSet feature_set);
+
+    /** @brief There is a set of methods to check whether the module contains intermediate (PTX) or binary CUDA
+    code for the given architecture(s):
+
+    @param major Major compute capability version.
+    @param minor Minor compute capability version.
+     */
+    static bool has(int major, int minor);
+    static bool hasPtx(int major, int minor);
+    static bool hasBin(int major, int minor);
+
+    static bool hasEqualOrLessPtx(int major, int minor);
+    static bool hasEqualOrGreater(int major, int minor);
+    static bool hasEqualOrGreaterPtx(int major, int minor);
+    static bool hasEqualOrGreaterBin(int major, int minor);
+};
+
+/** @brief Class providing functionality for querying the specified GPU properties.
+ */
+class CV_EXPORTS DeviceInfo
+{
+public:
+    //! creates DeviceInfo object for the current GPU
+    DeviceInfo();
+
+    /** @brief The constructors.
+
+    @param device_id System index of the CUDA device starting with 0.
+
+    Constructs the DeviceInfo object for the specified device. If device_id parameter is missed, it
+    constructs an object for the current device.
+     */
+    DeviceInfo(int device_id);
+
+    /** @brief Returns system index of the CUDA device starting with 0.
+    */
+    int deviceID() const;
+
+    //! ASCII string identifying device
+    const char* name() const;
+
+    //! global memory available on device in bytes
+    size_t totalGlobalMem() const;
+
+    //! shared memory available per block in bytes
+    size_t sharedMemPerBlock() const;
+
+    //! 32-bit registers available per block
+    int regsPerBlock() const;
+
+    //! warp size in threads
+    int warpSize() const;
+
+    //! maximum pitch in bytes allowed by memory copies
+    size_t memPitch() const;
+
+    //! maximum number of threads per block
+    int maxThreadsPerBlock() const;
+
+    //! maximum size of each dimension of a block
+    Vec3i maxThreadsDim() const;
+
+    //! maximum size of each dimension of a grid
+    Vec3i maxGridSize() const;
+
+    //! clock frequency in kilohertz
+    int clockRate() const;
+
+    //! constant memory available on device in bytes
+    size_t totalConstMem() const;
+
+    //! major compute capability
+    int majorVersion() const;
+
+    //! minor compute capability
+    int minorVersion() const;
+
+    //! alignment requirement for textures
+    size_t textureAlignment() const;
+
+    //! pitch alignment requirement for texture references bound to pitched memory
+    size_t texturePitchAlignment() const;
+
+    //! number of multiprocessors on device
+    int multiProcessorCount() const;
+
+    //! specified whether there is a run time limit on kernels
+    bool kernelExecTimeoutEnabled() const;
+
+    //! device is integrated as opposed to discrete
+    bool integrated() const;
+
+    //! device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer
+    bool canMapHostMemory() const;
+
+    enum ComputeMode
+    {
+        ComputeModeDefault,         /**< default compute mode (Multiple threads can use cudaSetDevice with this device) */
+        ComputeModeExclusive,       /**< compute-exclusive-thread mode (Only one thread in one process will be able to use cudaSetDevice with this device) */
+        ComputeModeProhibited,      /**< compute-prohibited mode (No threads can use cudaSetDevice with this device) */
+        ComputeModeExclusiveProcess /**< compute-exclusive-process mode (Many threads in one process will be able to use cudaSetDevice with this device) */
+    };
+
+    //! compute mode
+    ComputeMode computeMode() const;
+
+    //! maximum 1D texture size
+    int maxTexture1D() const;
+
+    //! maximum 1D mipmapped texture size
+    int maxTexture1DMipmap() const;
+
+    //! maximum size for 1D textures bound to linear memory
+    int maxTexture1DLinear() const;
+
+    //! maximum 2D texture dimensions
+    Vec2i maxTexture2D() const;
+
+    //! maximum 2D mipmapped texture dimensions
+    Vec2i maxTexture2DMipmap() const;
+
+    //! maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory
+    Vec3i maxTexture2DLinear() const;
+
+    //! maximum 2D texture dimensions if texture gather operations have to be performed
+    Vec2i maxTexture2DGather() const;
+
+    //! maximum 3D texture dimensions
+    Vec3i maxTexture3D() const;
+
+    //! maximum Cubemap texture dimensions
+    int maxTextureCubemap() const;
+
+    //! maximum 1D layered texture dimensions
+    Vec2i maxTexture1DLayered() const;
+
+    //! maximum 2D layered texture dimensions
+    Vec3i maxTexture2DLayered() const;
+
+    //! maximum Cubemap layered texture dimensions
+    Vec2i maxTextureCubemapLayered() const;
+
+    //! maximum 1D surface size
+    int maxSurface1D() const;
+
+    //! maximum 2D surface dimensions
+    Vec2i maxSurface2D() const;
+
+    //! maximum 3D surface dimensions
+    Vec3i maxSurface3D() const;
+
+    //! maximum 1D layered surface dimensions
+    Vec2i maxSurface1DLayered() const;
+
+    //! maximum 2D layered surface dimensions
+    Vec3i maxSurface2DLayered() const;
+
+    //! maximum Cubemap surface dimensions
+    int maxSurfaceCubemap() const;
+
+    //! maximum Cubemap layered surface dimensions
+    Vec2i maxSurfaceCubemapLayered() const;
+
+    //! alignment requirements for surfaces
+    size_t surfaceAlignment() const;
+
+    //! device can possibly execute multiple kernels concurrently
+    bool concurrentKernels() const;
+
+    //! device has ECC support enabled
+    bool ECCEnabled() const;
+
+    //! PCI bus ID of the device
+    int pciBusID() const;
+
+    //! PCI device ID of the device
+    int pciDeviceID() const;
+
+    //! PCI domain ID of the device
+    int pciDomainID() const;
+
+    //! true if device is a Tesla device using TCC driver, false otherwise
+    bool tccDriver() const;
+
+    //! number of asynchronous engines
+    int asyncEngineCount() const;
+
+    //! device shares a unified address space with the host
+    bool unifiedAddressing() const;
+
+    //! peak memory clock frequency in kilohertz
+    int memoryClockRate() const;
+
+    //! global memory bus width in bits
+    int memoryBusWidth() const;
+
+    //! size of L2 cache in bytes
+    int l2CacheSize() const;
+
+    //! maximum resident threads per multiprocessor
+    int maxThreadsPerMultiProcessor() const;
+
+    //! gets free and total device memory
+    void queryMemory(size_t& totalMemory, size_t& freeMemory) const;
+    size_t freeMemory() const;
+    size_t totalMemory() const;
+
+    /** @brief Provides information on CUDA feature support.
+
+    @param feature_set Features to be checked. See cuda::FeatureSet.
+
+    This function returns true if the device has the specified CUDA feature. Otherwise, it returns false
+     */
+    bool supports(FeatureSet feature_set) const;
+
+    /** @brief Checks the CUDA module and device compatibility.
+
+    This function returns true if the CUDA module can be run on the specified device. Otherwise, it
+    returns false .
+     */
+    bool isCompatible() const;
+
+private:
+    int device_id_;
+};
+
+CV_EXPORTS void printCudaDeviceInfo(int device);
+CV_EXPORTS void printShortCudaDeviceInfo(int device);
+
+//! @} cudacore_init
+
+}} // namespace cv { namespace cuda {
+
+
+#include "opencv2/core/cuda.inl.hpp"
+
+#endif /* __OPENCV_CORE_CUDA_HPP__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp
new file mode 100644
index 0000000..01dc6d7
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp
@@ -0,0 +1,631 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_CUDAINL_HPP__
+#define __OPENCV_CORE_CUDAINL_HPP__
+
+#include "opencv2/core/cuda.hpp"
+
+//! @cond IGNORED
+
+namespace cv { namespace cuda {
+
+//===================================================================================
+// GpuMat
+//===================================================================================
+
+inline
+GpuMat::GpuMat(Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{}
+
+inline
+GpuMat::GpuMat(int rows_, int cols_, int type_, Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    if (rows_ > 0 && cols_ > 0)
+        create(rows_, cols_, type_);
+}
+
+inline
+GpuMat::GpuMat(Size size_, int type_, Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    if (size_.height > 0 && size_.width > 0)
+        create(size_.height, size_.width, type_);
+}
+
+inline
+GpuMat::GpuMat(int rows_, int cols_, int type_, Scalar s_, Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    if (rows_ > 0 && cols_ > 0)
+    {
+        create(rows_, cols_, type_);
+        setTo(s_);
+    }
+}
+
+inline
+GpuMat::GpuMat(Size size_, int type_, Scalar s_, Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    if (size_.height > 0 && size_.width > 0)
+    {
+        create(size_.height, size_.width, type_);
+        setTo(s_);
+    }
+}
+
+inline
+GpuMat::GpuMat(const GpuMat& m)
+    : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount), datastart(m.datastart), dataend(m.dataend), allocator(m.allocator)
+{
+    if (refcount)
+        CV_XADD(refcount, 1);
+}
+
+inline
+GpuMat::GpuMat(InputArray arr, Allocator* allocator_) :
+    flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    upload(arr);
+}
+
+inline
+GpuMat::~GpuMat()
+{
+    release();
+}
+
+inline
+GpuMat& GpuMat::operator =(const GpuMat& m)
+{
+    if (this != &m)
+    {
+        GpuMat temp(m);
+        swap(temp);
+    }
+
+    return *this;
+}
+
+inline
+void GpuMat::create(Size size_, int type_)
+{
+    create(size_.height, size_.width, type_);
+}
+
+inline
+void GpuMat::swap(GpuMat& b)
+{
+    std::swap(flags, b.flags);
+    std::swap(rows, b.rows);
+    std::swap(cols, b.cols);
+    std::swap(step, b.step);
+    std::swap(data, b.data);
+    std::swap(datastart, b.datastart);
+    std::swap(dataend, b.dataend);
+    std::swap(refcount, b.refcount);
+    std::swap(allocator, b.allocator);
+}
+
+inline
+GpuMat GpuMat::clone() const
+{
+    GpuMat m;
+    copyTo(m);
+    return m;
+}
+
+inline
+void GpuMat::copyTo(OutputArray dst, InputArray mask) const
+{
+    copyTo(dst, mask, Stream::Null());
+}
+
+inline
+GpuMat& GpuMat::setTo(Scalar s)
+{
+    return setTo(s, Stream::Null());
+}
+
+inline
+GpuMat& GpuMat::setTo(Scalar s, InputArray mask)
+{
+    return setTo(s, mask, Stream::Null());
+}
+
+inline
+void GpuMat::convertTo(OutputArray dst, int rtype) const
+{
+    convertTo(dst, rtype, Stream::Null());
+}
+
+inline
+void GpuMat::convertTo(OutputArray dst, int rtype, double alpha, double beta) const
+{
+    convertTo(dst, rtype, alpha, beta, Stream::Null());
+}
+
+inline
+void GpuMat::convertTo(OutputArray dst, int rtype, double alpha, Stream& stream) const
+{
+    convertTo(dst, rtype, alpha, 0.0, stream);
+}
+
+inline
+void GpuMat::assignTo(GpuMat& m, int _type) const
+{
+    if (_type < 0)
+        m = *this;
+    else
+        convertTo(m, _type);
+}
+
+inline
+uchar* GpuMat::ptr(int y)
+{
+    CV_DbgAssert( (unsigned)y < (unsigned)rows );
+    return data + step * y;
+}
+
+inline
+const uchar* GpuMat::ptr(int y) const
+{
+    CV_DbgAssert( (unsigned)y < (unsigned)rows );
+    return data + step * y;
+}
+
+template<typename _Tp> inline
+_Tp* GpuMat::ptr(int y)
+{
+    return (_Tp*)ptr(y);
+}
+
+template<typename _Tp> inline
+const _Tp* GpuMat::ptr(int y) const
+{
+    return (const _Tp*)ptr(y);
+}
+
+template <class T> inline
+GpuMat::operator PtrStepSz<T>() const
+{
+    return PtrStepSz<T>(rows, cols, (T*)data, step);
+}
+
+template <class T> inline
+GpuMat::operator PtrStep<T>() const
+{
+    return PtrStep<T>((T*)data, step);
+}
+
+inline
+GpuMat GpuMat::row(int y) const
+{
+    return GpuMat(*this, Range(y, y+1), Range::all());
+}
+
+inline
+GpuMat GpuMat::col(int x) const
+{
+    return GpuMat(*this, Range::all(), Range(x, x+1));
+}
+
+inline
+GpuMat GpuMat::rowRange(int startrow, int endrow) const
+{
+    return GpuMat(*this, Range(startrow, endrow), Range::all());
+}
+
+inline
+GpuMat GpuMat::rowRange(Range r) const
+{
+    return GpuMat(*this, r, Range::all());
+}
+
+inline
+GpuMat GpuMat::colRange(int startcol, int endcol) const
+{
+    return GpuMat(*this, Range::all(), Range(startcol, endcol));
+}
+
+inline
+GpuMat GpuMat::colRange(Range r) const
+{
+    return GpuMat(*this, Range::all(), r);
+}
+
+inline
+GpuMat GpuMat::operator ()(Range rowRange_, Range colRange_) const
+{
+    return GpuMat(*this, rowRange_, colRange_);
+}
+
+inline
+GpuMat GpuMat::operator ()(Rect roi) const
+{
+    return GpuMat(*this, roi);
+}
+
+inline
+bool GpuMat::isContinuous() const
+{
+    return (flags & Mat::CONTINUOUS_FLAG) != 0;
+}
+
+inline
+size_t GpuMat::elemSize() const
+{
+    return CV_ELEM_SIZE(flags);
+}
+
+inline
+size_t GpuMat::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int GpuMat::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int GpuMat::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int GpuMat::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+size_t GpuMat::step1() const
+{
+    return step / elemSize1();
+}
+
+inline
+Size GpuMat::size() const
+{
+    return Size(cols, rows);
+}
+
+inline
+bool GpuMat::empty() const
+{
+    return data == 0;
+}
+
+static inline
+GpuMat createContinuous(int rows, int cols, int type)
+{
+    GpuMat m;
+    createContinuous(rows, cols, type, m);
+    return m;
+}
+
+static inline
+void createContinuous(Size size, int type, OutputArray arr)
+{
+    createContinuous(size.height, size.width, type, arr);
+}
+
+static inline
+GpuMat createContinuous(Size size, int type)
+{
+    GpuMat m;
+    createContinuous(size, type, m);
+    return m;
+}
+
+static inline
+void ensureSizeIsEnough(Size size, int type, OutputArray arr)
+{
+    ensureSizeIsEnough(size.height, size.width, type, arr);
+}
+
+static inline
+void swap(GpuMat& a, GpuMat& b)
+{
+    a.swap(b);
+}
+
+//===================================================================================
+// HostMem
+//===================================================================================
+
+inline
+HostMem::HostMem(AllocType alloc_type_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
+{
+}
+
+inline
+HostMem::HostMem(const HostMem& m)
+    : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount), datastart(m.datastart), dataend(m.dataend), alloc_type(m.alloc_type)
+{
+    if( refcount )
+        CV_XADD(refcount, 1);
+}
+
+inline
+HostMem::HostMem(int rows_, int cols_, int type_, AllocType alloc_type_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
+{
+    if (rows_ > 0 && cols_ > 0)
+        create(rows_, cols_, type_);
+}
+
+inline
+HostMem::HostMem(Size size_, int type_, AllocType alloc_type_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
+{
+    if (size_.height > 0 && size_.width > 0)
+        create(size_.height, size_.width, type_);
+}
+
+inline
+HostMem::HostMem(InputArray arr, AllocType alloc_type_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
+{
+    arr.getMat().copyTo(*this);
+}
+
+inline
+HostMem::~HostMem()
+{
+    release();
+}
+
+inline
+HostMem& HostMem::operator =(const HostMem& m)
+{
+    if (this != &m)
+    {
+        HostMem temp(m);
+        swap(temp);
+    }
+
+    return *this;
+}
+
+inline
+void HostMem::swap(HostMem& b)
+{
+    std::swap(flags, b.flags);
+    std::swap(rows, b.rows);
+    std::swap(cols, b.cols);
+    std::swap(step, b.step);
+    std::swap(data, b.data);
+    std::swap(datastart, b.datastart);
+    std::swap(dataend, b.dataend);
+    std::swap(refcount, b.refcount);
+    std::swap(alloc_type, b.alloc_type);
+}
+
+inline
+HostMem HostMem::clone() const
+{
+    HostMem m(size(), type(), alloc_type);
+    createMatHeader().copyTo(m);
+    return m;
+}
+
+inline
+void HostMem::create(Size size_, int type_)
+{
+    create(size_.height, size_.width, type_);
+}
+
+inline
+Mat HostMem::createMatHeader() const
+{
+    return Mat(size(), type(), data, step);
+}
+
+inline
+bool HostMem::isContinuous() const
+{
+    return (flags & Mat::CONTINUOUS_FLAG) != 0;
+}
+
+inline
+size_t HostMem::elemSize() const
+{
+    return CV_ELEM_SIZE(flags);
+}
+
+inline
+size_t HostMem::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int HostMem::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int HostMem::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int HostMem::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+size_t HostMem::step1() const
+{
+    return step / elemSize1();
+}
+
+inline
+Size HostMem::size() const
+{
+    return Size(cols, rows);
+}
+
+inline
+bool HostMem::empty() const
+{
+    return data == 0;
+}
+
+static inline
+void swap(HostMem& a, HostMem& b)
+{
+    a.swap(b);
+}
+
+//===================================================================================
+// Stream
+//===================================================================================
+
+inline
+Stream::Stream(const Ptr<Impl>& impl)
+    : impl_(impl)
+{
+}
+
+//===================================================================================
+// Event
+//===================================================================================
+
+inline
+Event::Event(const Ptr<Impl>& impl)
+    : impl_(impl)
+{
+}
+
+//===================================================================================
+// Initialization & Info
+//===================================================================================
+
+inline
+bool TargetArchs::has(int major, int minor)
+{
+    return hasPtx(major, minor) || hasBin(major, minor);
+}
+
+inline
+bool TargetArchs::hasEqualOrGreater(int major, int minor)
+{
+    return hasEqualOrGreaterPtx(major, minor) || hasEqualOrGreaterBin(major, minor);
+}
+
+inline
+DeviceInfo::DeviceInfo()
+{
+    device_id_ = getDevice();
+}
+
+inline
+DeviceInfo::DeviceInfo(int device_id)
+{
+    CV_Assert( device_id >= 0 && device_id < getCudaEnabledDeviceCount() );
+    device_id_ = device_id;
+}
+
+inline
+int DeviceInfo::deviceID() const
+{
+    return device_id_;
+}
+
+inline
+size_t DeviceInfo::freeMemory() const
+{
+    size_t _totalMemory = 0, _freeMemory = 0;
+    queryMemory(_totalMemory, _freeMemory);
+    return _freeMemory;
+}
+
+inline
+size_t DeviceInfo::totalMemory() const
+{
+    size_t _totalMemory = 0, _freeMemory = 0;
+    queryMemory(_totalMemory, _freeMemory);
+    return _totalMemory;
+}
+
+inline
+bool DeviceInfo::supports(FeatureSet feature_set) const
+{
+    int version = majorVersion() * 10 + minorVersion();
+    return version >= feature_set;
+}
+
+
+}} // namespace cv { namespace cuda {
+
+//===================================================================================
+// Mat
+//===================================================================================
+
+namespace cv {
+
+inline
+Mat::Mat(const cuda::GpuMat& m)
+    : flags(0), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows)
+{
+    m.download(*this);
+}
+
+}
+
+//! @endcond
+
+#endif // __OPENCV_CORE_CUDAINL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp
new file mode 100644
index 0000000..0f8ee9b
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp
@@ -0,0 +1,86 @@
+/*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*/
+
+#ifndef __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__
+#define __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__
+
+#ifndef __cplusplus
+#  error cuda_stream_accessor.hpp header must be compiled as C++
+#endif
+
+/** @file cuda_stream_accessor.hpp
+ * This is only header file that depends on CUDA Runtime API. All other headers are independent.
+ */
+
+#include <cuda_runtime.h>
+#include "opencv2/core/cuda.hpp"
+
+namespace cv
+{
+    namespace cuda
+    {
+
+//! @addtogroup cudacore_struct
+//! @{
+
+        /** @brief Class that enables getting cudaStream_t from cuda::Stream
+         */
+        struct StreamAccessor
+        {
+            CV_EXPORTS static cudaStream_t getStream(const Stream& stream);
+            CV_EXPORTS static Stream wrapStream(cudaStream_t stream);
+        };
+
+        /** @brief Class that enables getting cudaEvent_t from cuda::Event
+         */
+        struct EventAccessor
+        {
+            CV_EXPORTS static cudaEvent_t getEvent(const Event& event);
+            CV_EXPORTS static Event wrapEvent(cudaEvent_t event);
+        };
+
+//! @}
+
+    }
+}
+
+#endif /* __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp
new file mode 100644
index 0000000..8df816e
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp
@@ -0,0 +1,135 @@
+/*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*/
+
+#ifndef __OPENCV_CORE_CUDA_TYPES_HPP__
+#define __OPENCV_CORE_CUDA_TYPES_HPP__
+
+#ifndef __cplusplus
+#  error cuda_types.hpp header must be compiled as C++
+#endif
+
+/** @file
+ * @deprecated Use @ref cudev instead.
+ */
+
+//! @cond IGNORED
+
+#ifdef __CUDACC__
+    #define __CV_CUDA_HOST_DEVICE__ __host__ __device__ __forceinline__
+#else
+    #define __CV_CUDA_HOST_DEVICE__
+#endif
+
+namespace cv
+{
+    namespace cuda
+    {
+
+        // Simple lightweight structures that encapsulates information about an image on device.
+        // It is intended to pass to nvcc-compiled code. GpuMat depends on headers that nvcc can't compile
+
+        template <typename T> struct DevPtr
+        {
+            typedef T elem_type;
+            typedef int index_type;
+
+            enum { elem_size = sizeof(elem_type) };
+
+            T* data;
+
+            __CV_CUDA_HOST_DEVICE__ DevPtr() : data(0) {}
+            __CV_CUDA_HOST_DEVICE__ DevPtr(T* data_) : data(data_) {}
+
+            __CV_CUDA_HOST_DEVICE__ size_t elemSize() const { return elem_size; }
+            __CV_CUDA_HOST_DEVICE__ operator       T*()       { return data; }
+            __CV_CUDA_HOST_DEVICE__ operator const T*() const { return data; }
+        };
+
+        template <typename T> struct PtrSz : public DevPtr<T>
+        {
+            __CV_CUDA_HOST_DEVICE__ PtrSz() : size(0) {}
+            __CV_CUDA_HOST_DEVICE__ PtrSz(T* data_, size_t size_) : DevPtr<T>(data_), size(size_) {}
+
+            size_t size;
+        };
+
+        template <typename T> struct PtrStep : public DevPtr<T>
+        {
+            __CV_CUDA_HOST_DEVICE__ PtrStep() : step(0) {}
+            __CV_CUDA_HOST_DEVICE__ PtrStep(T* data_, size_t step_) : DevPtr<T>(data_), step(step_) {}
+
+            size_t step;
+
+            __CV_CUDA_HOST_DEVICE__       T* ptr(int y = 0)       { return (      T*)( (      char*)DevPtr<T>::data + y * step); }
+            __CV_CUDA_HOST_DEVICE__ const T* ptr(int y = 0) const { return (const T*)( (const char*)DevPtr<T>::data + y * step); }
+
+            __CV_CUDA_HOST_DEVICE__       T& operator ()(int y, int x)       { return ptr(y)[x]; }
+            __CV_CUDA_HOST_DEVICE__ const T& operator ()(int y, int x) const { return ptr(y)[x]; }
+        };
+
+        template <typename T> struct PtrStepSz : public PtrStep<T>
+        {
+            __CV_CUDA_HOST_DEVICE__ PtrStepSz() : cols(0), rows(0) {}
+            __CV_CUDA_HOST_DEVICE__ PtrStepSz(int rows_, int cols_, T* data_, size_t step_)
+                : PtrStep<T>(data_, step_), cols(cols_), rows(rows_) {}
+
+            template <typename U>
+            explicit PtrStepSz(const PtrStepSz<U>& d) : PtrStep<T>((T*)d.data, d.step), cols(d.cols), rows(d.rows){}
+
+            int cols;
+            int rows;
+        };
+
+        typedef PtrStepSz<unsigned char> PtrStepSzb;
+        typedef PtrStepSz<float> PtrStepSzf;
+        typedef PtrStepSz<int> PtrStepSzi;
+
+        typedef PtrStep<unsigned char> PtrStepb;
+        typedef PtrStep<float> PtrStepf;
+        typedef PtrStep<int> PtrStepi;
+
+    }
+}
+
+//! @endcond
+
+#endif /* __OPENCV_CORE_CUDA_TYPES_HPP__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h
new file mode 100644
index 0000000..af2abfb
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h
@@ -0,0 +1,515 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_CVDEF_H__
+#define __OPENCV_CORE_CVDEF_H__
+
+//! @addtogroup core_utils
+//! @{
+
+#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER && _MSC_VER > 1300
+#  define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio warnings */
+#endif
+
+// undef problematic defines sometimes defined by system headers (windows.h in particular)
+#undef small
+#undef min
+#undef max
+#undef abs
+#undef Complex
+
+#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER && _MSC_VER > 1300
+#  define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio warnings */
+#endif
+
+#include <limits.h>
+#include "opencv2/core/hal/interface.h"
+
+#if defined __ICL
+#  define CV_ICC   __ICL
+#elif defined __ICC
+#  define CV_ICC   __ICC
+#elif defined __ECL
+#  define CV_ICC   __ECL
+#elif defined __ECC
+#  define CV_ICC   __ECC
+#elif defined __INTEL_COMPILER
+#  define CV_ICC   __INTEL_COMPILER
+#endif
+
+#ifndef CV_INLINE
+#  if defined __cplusplus
+#    define CV_INLINE static inline
+#  elif defined _MSC_VER
+#    define CV_INLINE __inline
+#  else
+#    define CV_INLINE static
+#  endif
+#endif
+
+#if defined CV_ICC && !defined CV_ENABLE_UNROLLED
+#  define CV_ENABLE_UNROLLED 0
+#else
+#  define CV_ENABLE_UNROLLED 1
+#endif
+
+#ifdef __GNUC__
+#  define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
+#elif defined _MSC_VER
+#  define CV_DECL_ALIGNED(x) __declspec(align(x))
+#else
+#  define CV_DECL_ALIGNED(x)
+#endif
+
+/* CPU features and intrinsics support */
+#define CV_CPU_NONE             0
+#define CV_CPU_MMX              1
+#define CV_CPU_SSE              2
+#define CV_CPU_SSE2             3
+#define CV_CPU_SSE3             4
+#define CV_CPU_SSSE3            5
+#define CV_CPU_SSE4_1           6
+#define CV_CPU_SSE4_2           7
+#define CV_CPU_POPCNT           8
+
+#define CV_CPU_AVX              10
+#define CV_CPU_AVX2             11
+#define CV_CPU_FMA3             12
+
+#define CV_CPU_AVX_512F         13
+#define CV_CPU_AVX_512BW        14
+#define CV_CPU_AVX_512CD        15
+#define CV_CPU_AVX_512DQ        16
+#define CV_CPU_AVX_512ER        17
+#define CV_CPU_AVX_512IFMA512   18
+#define CV_CPU_AVX_512PF        19
+#define CV_CPU_AVX_512VBMI      20
+#define CV_CPU_AVX_512VL        21
+
+#define CV_CPU_NEON   100
+
+// when adding to this list remember to update the following enum
+#define CV_HARDWARE_MAX_FEATURE 255
+
+/** @brief Available CPU features.
+*/
+enum CpuFeatures {
+    CPU_MMX             = 1,
+    CPU_SSE             = 2,
+    CPU_SSE2            = 3,
+    CPU_SSE3            = 4,
+    CPU_SSSE3           = 5,
+    CPU_SSE4_1          = 6,
+    CPU_SSE4_2          = 7,
+    CPU_POPCNT          = 8,
+
+    CPU_AVX             = 10,
+    CPU_AVX2            = 11,
+    CPU_FMA3            = 12,
+
+    CPU_AVX_512F        = 13,
+    CPU_AVX_512BW       = 14,
+    CPU_AVX_512CD       = 15,
+    CPU_AVX_512DQ       = 16,
+    CPU_AVX_512ER       = 17,
+    CPU_AVX_512IFMA512  = 18,
+    CPU_AVX_512PF       = 19,
+    CPU_AVX_512VBMI     = 20,
+    CPU_AVX_512VL       = 21,
+
+    CPU_NEON            = 100
+};
+
+// do not include SSE/AVX/NEON headers for NVCC compiler
+#ifndef __CUDACC__
+
+#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
+#  include <emmintrin.h>
+#  define CV_MMX 1
+#  define CV_SSE 1
+#  define CV_SSE2 1
+#  if defined __SSE3__ || (defined _MSC_VER && _MSC_VER >= 1500)
+#    include <pmmintrin.h>
+#    define CV_SSE3 1
+#  endif
+#  if defined __SSSE3__  || (defined _MSC_VER && _MSC_VER >= 1500)
+#    include <tmmintrin.h>
+#    define CV_SSSE3 1
+#  endif
+#  if defined __SSE4_1__ || (defined _MSC_VER && _MSC_VER >= 1500)
+#    include <smmintrin.h>
+#    define CV_SSE4_1 1
+#  endif
+#  if defined __SSE4_2__ || (defined _MSC_VER && _MSC_VER >= 1500)
+#    include <nmmintrin.h>
+#    define CV_SSE4_2 1
+#  endif
+#  if defined __POPCNT__ || (defined _MSC_VER && _MSC_VER >= 1500)
+#    ifdef _MSC_VER
+#      include <nmmintrin.h>
+#    else
+#      include <popcntintrin.h>
+#    endif
+#    define CV_POPCNT 1
+#  endif
+#  if defined __AVX__ || (defined _MSC_VER && _MSC_VER >= 1600 && 0)
+// MS Visual Studio 2010 (2012?) has no macro pre-defined to identify the use of /arch:AVX
+// See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32
+#    include <immintrin.h>
+#    define CV_AVX 1
+#    if defined(_XCR_XFEATURE_ENABLED_MASK)
+#      define __xgetbv() _xgetbv(_XCR_XFEATURE_ENABLED_MASK)
+#    else
+#      define __xgetbv() 0
+#    endif
+#  endif
+#  if defined __AVX2__ || (defined _MSC_VER && _MSC_VER >= 1800 && 0)
+#    include <immintrin.h>
+#    define CV_AVX2 1
+#    if defined __FMA__
+#      define CV_FMA3 1
+#    endif
+#  endif
+#endif
+
+#if (defined WIN32 || defined _WIN32) && defined(_M_ARM)
+# include <Intrin.h>
+# include "arm_neon.h"
+# define CV_NEON 1
+# define CPU_HAS_NEON_FEATURE (true)
+#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__))
+#  include <arm_neon.h>
+#  define CV_NEON 1
+#endif
+
+#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__
+#  define CV_VFP 1
+#endif
+
+#endif // __CUDACC__
+
+#ifndef CV_POPCNT
+#define CV_POPCNT 0
+#endif
+#ifndef CV_MMX
+#  define CV_MMX 0
+#endif
+#ifndef CV_SSE
+#  define CV_SSE 0
+#endif
+#ifndef CV_SSE2
+#  define CV_SSE2 0
+#endif
+#ifndef CV_SSE3
+#  define CV_SSE3 0
+#endif
+#ifndef CV_SSSE3
+#  define CV_SSSE3 0
+#endif
+#ifndef CV_SSE4_1
+#  define CV_SSE4_1 0
+#endif
+#ifndef CV_SSE4_2
+#  define CV_SSE4_2 0
+#endif
+#ifndef CV_AVX
+#  define CV_AVX 0
+#endif
+#ifndef CV_AVX2
+#  define CV_AVX2 0
+#endif
+#ifndef CV_FMA3
+#  define CV_FMA3 0
+#endif
+#ifndef CV_AVX_512F
+#  define CV_AVX_512F 0
+#endif
+#ifndef CV_AVX_512BW
+#  define CV_AVX_512BW 0
+#endif
+#ifndef CV_AVX_512CD
+#  define CV_AVX_512CD 0
+#endif
+#ifndef CV_AVX_512DQ
+#  define CV_AVX_512DQ 0
+#endif
+#ifndef CV_AVX_512ER
+#  define CV_AVX_512ER 0
+#endif
+#ifndef CV_AVX_512IFMA512
+#  define CV_AVX_512IFMA512 0
+#endif
+#ifndef CV_AVX_512PF
+#  define CV_AVX_512PF 0
+#endif
+#ifndef CV_AVX_512VBMI
+#  define CV_AVX_512VBMI 0
+#endif
+#ifndef CV_AVX_512VL
+#  define CV_AVX_512VL 0
+#endif
+
+#ifndef CV_NEON
+#  define CV_NEON 0
+#endif
+
+#ifndef CV_VFP
+#  define CV_VFP 0
+#endif
+
+/* fundamental constants */
+#define CV_PI   3.1415926535897932384626433832795
+#define CV_2PI 6.283185307179586476925286766559
+#define CV_LOG2 0.69314718055994530941723212145818
+
+typedef union Cv32suf
+{
+    int i;
+    unsigned u;
+    float f;
+}
+Cv32suf;
+
+typedef union Cv64suf
+{
+    int64 i;
+    uint64 u;
+    double f;
+}
+Cv64suf;
+
+#define OPENCV_ABI_COMPATIBILITY 300
+
+#ifdef __OPENCV_BUILD
+#  define DISABLE_OPENCV_24_COMPATIBILITY
+#endif
+
+#if (defined WIN32 || defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined CVAPI_EXPORTS
+#  define CV_EXPORTS __declspec(dllexport)
+#elif defined __GNUC__ && __GNUC__ >= 4
+#  define CV_EXPORTS __attribute__ ((visibility ("default")))
+#else
+#  define CV_EXPORTS
+#endif
+
+#ifndef CV_EXTERN_C
+#  ifdef __cplusplus
+#    define CV_EXTERN_C extern "C"
+#  else
+#    define CV_EXTERN_C
+#  endif
+#endif
+
+/* special informative macros for wrapper generators */
+#define CV_EXPORTS_W CV_EXPORTS
+#define CV_EXPORTS_W_SIMPLE CV_EXPORTS
+#define CV_EXPORTS_AS(synonym) CV_EXPORTS
+#define CV_EXPORTS_W_MAP CV_EXPORTS
+#define CV_IN_OUT
+#define CV_OUT
+#define CV_PROP
+#define CV_PROP_RW
+#define CV_WRAP
+#define CV_WRAP_AS(synonym)
+
+/****************************************************************************************\
+*                                  Matrix type (Mat)                                     *
+\****************************************************************************************/
+
+#define CV_CN_MAX     512
+#define CV_CN_SHIFT   3
+#define CV_DEPTH_MAX  (1 << CV_CN_SHIFT)
+
+#define CV_8U   0
+#define CV_8S   1
+#define CV_16U  2
+#define CV_16S  3
+#define CV_32S  4
+#define CV_32F  5
+#define CV_64F  6
+#define CV_USRTYPE1 7
+
+#define CV_MAT_DEPTH_MASK       (CV_DEPTH_MAX - 1)
+#define CV_MAT_DEPTH(flags)     ((flags) & CV_MAT_DEPTH_MASK)
+
+#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
+#define CV_MAKE_TYPE CV_MAKETYPE
+
+#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
+#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
+#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
+#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
+#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
+
+#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
+#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
+#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
+#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
+#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
+
+#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
+#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
+#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
+#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
+#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
+
+#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
+#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
+#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
+#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
+#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
+
+#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
+#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
+#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
+#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
+#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
+
+#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
+#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
+#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
+#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
+#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
+
+#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
+#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
+#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
+#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
+#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
+
+#define CV_MAT_CN_MASK          ((CV_CN_MAX - 1) << CV_CN_SHIFT)
+#define CV_MAT_CN(flags)        ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
+#define CV_MAT_TYPE_MASK        (CV_DEPTH_MAX*CV_CN_MAX - 1)
+#define CV_MAT_TYPE(flags)      ((flags) & CV_MAT_TYPE_MASK)
+#define CV_MAT_CONT_FLAG_SHIFT  14
+#define CV_MAT_CONT_FLAG        (1 << CV_MAT_CONT_FLAG_SHIFT)
+#define CV_IS_MAT_CONT(flags)   ((flags) & CV_MAT_CONT_FLAG)
+#define CV_IS_CONT_MAT          CV_IS_MAT_CONT
+#define CV_SUBMAT_FLAG_SHIFT    15
+#define CV_SUBMAT_FLAG          (1 << CV_SUBMAT_FLAG_SHIFT)
+#define CV_IS_SUBMAT(flags)     ((flags) & CV_MAT_SUBMAT_FLAG)
+
+/** Size of each channel item,
+   0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
+#define CV_ELEM_SIZE1(type) \
+    ((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15)
+
+/** 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
+#define CV_ELEM_SIZE(type) \
+    (CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
+
+#ifndef MIN
+#  define MIN(a,b)  ((a) > (b) ? (b) : (a))
+#endif
+
+#ifndef MAX
+#  define MAX(a,b)  ((a) < (b) ? (b) : (a))
+#endif
+
+/****************************************************************************************\
+*          exchange-add operation for atomic operations on reference counters            *
+\****************************************************************************************/
+
+#if defined __INTEL_COMPILER && !(defined WIN32 || defined _WIN32)
+   // atomic increment on the linux version of the Intel(tm) compiler
+#  define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(addr)), delta)
+#elif defined __GNUC__
+#  if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__)
+#    ifdef __ATOMIC_ACQ_REL
+#      define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL)
+#    else
+#      define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int)*)(addr), delta, 4)
+#    endif
+#  else
+#    if defined __ATOMIC_ACQ_REL && !defined __clang__
+       // version for gcc >= 4.7
+#      define CV_XADD(addr, delta) (int)__atomic_fetch_add((unsigned*)(addr), (unsigned)(delta), __ATOMIC_ACQ_REL)
+#    else
+#      define CV_XADD(addr, delta) (int)__sync_fetch_and_add((unsigned*)(addr), (unsigned)(delta))
+#    endif
+#  endif
+#elif defined _MSC_VER && !defined RC_INVOKED
+#  include <intrin.h>
+#  define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd((long volatile*)addr, delta)
+#else
+   CV_INLINE CV_XADD(int* addr, int delta) { int tmp = *addr; *addr += delta; return tmp; }
+#endif
+
+
+/****************************************************************************************\
+*                                  CV_NORETURN attribute                                 *
+\****************************************************************************************/
+
+#ifndef CV_NORETURN
+#  if defined(__GNUC__)
+#    define CV_NORETURN __attribute__((__noreturn__))
+#  elif defined(_MSC_VER) && (_MSC_VER >= 1300)
+#    define CV_NORETURN __declspec(noreturn)
+#  else
+#    define CV_NORETURN /* nothing by default */
+#  endif
+#endif
+
+
+/****************************************************************************************\
+*                                    C++ Move semantics                                  *
+\****************************************************************************************/
+
+#ifndef CV_CXX_MOVE_SEMANTICS
+#  if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(_MSC_VER) && _MSC_VER >= 1600
+#    define CV_CXX_MOVE_SEMANTICS 1
+#  elif defined(__clang)
+#    if __has_feature(cxx_rvalue_references)
+#      define CV_CXX_MOVE_SEMANTICS 1
+#    endif
+#  endif
+#else
+#  if CV_CXX_MOVE_SEMANTICS == 0
+#    undef CV_CXX_MOVE_SEMANTICS
+#  endif
+#endif
+
+//! @}
+
+#endif // __OPENCV_CORE_CVDEF_H__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp
new file mode 100644
index 0000000..edae954
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp
@@ -0,0 +1,1069 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_CVSTD_HPP__
+#define __OPENCV_CORE_CVSTD_HPP__
+
+#ifndef __cplusplus
+#  error cvstd.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/cvdef.h"
+
+#include <cstddef>
+#include <cstring>
+#include <cctype>
+
+#ifndef OPENCV_NOSTL
+#  include <string>
+#endif
+
+// import useful primitives from stl
+#ifndef OPENCV_NOSTL_TRANSITIONAL
+#  include <algorithm>
+#  include <utility>
+#  include <cstdlib> //for abs(int)
+#  include <cmath>
+
+namespace cv
+{
+    using std::min;
+    using std::max;
+    using std::abs;
+    using std::swap;
+    using std::sqrt;
+    using std::exp;
+    using std::pow;
+    using std::log;
+}
+
+namespace std
+{
+    static inline uchar abs(uchar a) { return a; }
+    static inline ushort abs(ushort a) { return a; }
+    static inline unsigned abs(unsigned a) { return a; }
+    static inline uint64 abs(uint64 a) { return a; }
+}
+
+#else
+namespace cv
+{
+    template<typename T> static inline T min(T a, T b) { return a < b ? a : b; }
+    template<typename T> static inline T max(T a, T b) { return a > b ? a : b; }
+    template<typename T> static inline T abs(T a) { return a < 0 ? -a : a; }
+    template<typename T> static inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
+
+    template<> inline uchar abs(uchar a) { return a; }
+    template<> inline ushort abs(ushort a) { return a; }
+    template<> inline unsigned abs(unsigned a) { return a; }
+    template<> inline uint64 abs(uint64 a) { return a; }
+}
+#endif
+
+namespace cv {
+
+//! @addtogroup core_utils
+//! @{
+
+//////////////////////////// memory management functions ////////////////////////////
+
+/** @brief Allocates an aligned memory buffer.
+
+The function allocates the buffer of the specified size and returns it. When the buffer size is 16
+bytes or more, the returned buffer is aligned to 16 bytes.
+@param bufSize Allocated buffer size.
+ */
+CV_EXPORTS void* fastMalloc(size_t bufSize);
+
+/** @brief Deallocates a memory buffer.
+
+The function deallocates the buffer allocated with fastMalloc . If NULL pointer is passed, the
+function does nothing. C version of the function clears the pointer *pptr* to avoid problems with
+double memory deallocation.
+@param ptr Pointer to the allocated buffer.
+ */
+CV_EXPORTS void fastFree(void* ptr);
+
+/*!
+  The STL-compilant memory Allocator based on cv::fastMalloc() and cv::fastFree()
+*/
+template<typename _Tp> class Allocator
+{
+public:
+    typedef _Tp value_type;
+    typedef value_type* pointer;
+    typedef const value_type* const_pointer;
+    typedef value_type& reference;
+    typedef const value_type& const_reference;
+    typedef size_t size_type;
+    typedef ptrdiff_t difference_type;
+    template<typename U> class rebind { typedef Allocator<U> other; };
+
+    explicit Allocator() {}
+    ~Allocator() {}
+    explicit Allocator(Allocator const&) {}
+    template<typename U>
+    explicit Allocator(Allocator<U> const&) {}
+
+    // address
+    pointer address(reference r) { return &r; }
+    const_pointer address(const_reference r) { return &r; }
+
+    pointer allocate(size_type count, const void* =0) { return reinterpret_cast<pointer>(fastMalloc(count * sizeof (_Tp))); }
+    void deallocate(pointer p, size_type) { fastFree(p); }
+
+    void construct(pointer p, const _Tp& v) { new(static_cast<void*>(p)) _Tp(v); }
+    void destroy(pointer p) { p->~_Tp(); }
+
+    size_type max_size() const { return cv::max(static_cast<_Tp>(-1)/sizeof(_Tp), 1); }
+};
+
+//! @} core_utils
+
+//! @cond IGNORED
+
+namespace detail
+{
+
+// Metafunction to avoid taking a reference to void.
+template<typename T>
+struct RefOrVoid { typedef T& type; };
+
+template<>
+struct RefOrVoid<void>{ typedef void type; };
+
+template<>
+struct RefOrVoid<const void>{ typedef const void type; };
+
+template<>
+struct RefOrVoid<volatile void>{ typedef volatile void type; };
+
+template<>
+struct RefOrVoid<const volatile void>{ typedef const volatile void type; };
+
+// This class would be private to Ptr, if it didn't have to be a non-template.
+struct PtrOwner;
+
+}
+
+template<typename Y>
+struct DefaultDeleter
+{
+    void operator () (Y* p) const;
+};
+
+//! @endcond
+
+//! @addtogroup core_basic
+//! @{
+
+/** @brief Template class for smart pointers with shared ownership
+
+A Ptr\<T\> pretends to be a pointer to an object of type T. Unlike an ordinary pointer, however, the
+object will be automatically cleaned up once all Ptr instances pointing to it are destroyed.
+
+Ptr is similar to boost::shared_ptr that is part of the Boost library
+(<http://www.boost.org/doc/libs/release/libs/smart_ptr/shared_ptr.htm>) and std::shared_ptr from
+the [C++11](http://en.wikipedia.org/wiki/C++11) standard.
+
+This class provides the following advantages:
+-   Default constructor, copy constructor, and assignment operator for an arbitrary C++ class or C
+    structure. For some objects, like files, windows, mutexes, sockets, and others, a copy
+    constructor or an assignment operator are difficult to define. For some other objects, like
+    complex classifiers in OpenCV, copy constructors are absent and not easy to implement. Finally,
+    some of complex OpenCV and your own data structures may be written in C. However, copy
+    constructors and default constructors can simplify programming a lot. Besides, they are often
+    required (for example, by STL containers). By using a Ptr to such an object instead of the
+    object itself, you automatically get all of the necessary constructors and the assignment
+    operator.
+-   *O(1)* complexity of the above-mentioned operations. While some structures, like std::vector,
+    provide a copy constructor and an assignment operator, the operations may take a considerable
+    amount of time if the data structures are large. But if the structures are put into a Ptr, the
+    overhead is small and independent of the data size.
+-   Automatic and customizable cleanup, even for C structures. See the example below with FILE\*.
+-   Heterogeneous collections of objects. The standard STL and most other C++ and OpenCV containers
+    can store only objects of the same type and the same size. The classical solution to store
+    objects of different types in the same container is to store pointers to the base class (Base\*)
+    instead but then you lose the automatic memory management. Again, by using Ptr\<Base\> instead
+    of raw pointers, you can solve the problem.
+
+A Ptr is said to *own* a pointer - that is, for each Ptr there is a pointer that will be deleted
+once all Ptr instances that own it are destroyed. The owned pointer may be null, in which case
+nothing is deleted. Each Ptr also *stores* a pointer. The stored pointer is the pointer the Ptr
+pretends to be; that is, the one you get when you use Ptr::get or the conversion to T\*. It's
+usually the same as the owned pointer, but if you use casts or the general shared-ownership
+constructor, the two may diverge: the Ptr will still own the original pointer, but will itself point
+to something else.
+
+The owned pointer is treated as a black box. The only thing Ptr needs to know about it is how to
+delete it. This knowledge is encapsulated in the *deleter* - an auxiliary object that is associated
+with the owned pointer and shared between all Ptr instances that own it. The default deleter is an
+instance of DefaultDeleter, which uses the standard C++ delete operator; as such it will work with
+any pointer allocated with the standard new operator.
+
+However, if the pointer must be deleted in a different way, you must specify a custom deleter upon
+Ptr construction. A deleter is simply a callable object that accepts the pointer as its sole
+argument. For example, if you want to wrap FILE, you may do so as follows:
+@code
+    Ptr<FILE> f(fopen("myfile.txt", "w"), fclose);
+    if(!f) throw ...;
+    fprintf(f, ....);
+    ...
+    // the file will be closed automatically by f's destructor.
+@endcode
+Alternatively, if you want all pointers of a particular type to be deleted the same way, you can
+specialize DefaultDeleter<T>::operator() for that type, like this:
+@code
+    namespace cv {
+    template<> void DefaultDeleter<FILE>::operator ()(FILE * obj) const
+    {
+        fclose(obj);
+    }
+    }
+@endcode
+For convenience, the following types from the OpenCV C API already have such a specialization that
+calls the appropriate release function:
+-   CvCapture
+-   CvFileStorage
+-   CvHaarClassifierCascade
+-   CvMat
+-   CvMatND
+-   CvMemStorage
+-   CvSparseMat
+-   CvVideoWriter
+-   IplImage
+@note The shared ownership mechanism is implemented with reference counting. As such, cyclic
+ownership (e.g. when object a contains a Ptr to object b, which contains a Ptr to object a) will
+lead to all involved objects never being cleaned up. Avoid such situations.
+@note It is safe to concurrently read (but not write) a Ptr instance from multiple threads and
+therefore it is normally safe to use it in multi-threaded applications. The same is true for Mat and
+other C++ OpenCV classes that use internal reference counts.
+*/
+template<typename T>
+struct Ptr
+{
+    /** Generic programming support. */
+    typedef T element_type;
+
+    /** The default constructor creates a null Ptr - one that owns and stores a null pointer.
+    */
+    Ptr();
+
+    /**
+    If p is null, these are equivalent to the default constructor.
+    Otherwise, these constructors assume ownership of p - that is, the created Ptr owns and stores p
+    and assumes it is the sole owner of it. Don't use them if p is already owned by another Ptr, or
+    else p will get deleted twice.
+    With the first constructor, DefaultDeleter\<Y\>() becomes the associated deleter (so p will
+    eventually be deleted with the standard delete operator). Y must be a complete type at the point
+    of invocation.
+    With the second constructor, d becomes the associated deleter.
+    Y\* must be convertible to T\*.
+    @param p Pointer to own.
+    @note It is often easier to use makePtr instead.
+     */
+    template<typename Y>
+#ifdef DISABLE_OPENCV_24_COMPATIBILITY
+    explicit
+#endif
+    Ptr(Y* p);
+
+    /** @overload
+    @param d Deleter to use for the owned pointer.
+    @param p Pointer to own.
+    */
+    template<typename Y, typename D>
+    Ptr(Y* p, D d);
+
+    /**
+    These constructors create a Ptr that shares ownership with another Ptr - that is, own the same
+    pointer as o.
+    With the first two, the same pointer is stored, as well; for the second, Y\* must be convertible
+    to T\*.
+    With the third, p is stored, and Y may be any type. This constructor allows to have completely
+    unrelated owned and stored pointers, and should be used with care to avoid confusion. A relatively
+    benign use is to create a non-owning Ptr, like this:
+    @code
+        ptr = Ptr<T>(Ptr<T>(), dont_delete_me); // owns nothing; will not delete the pointer.
+    @endcode
+    @param o Ptr to share ownership with.
+    */
+    Ptr(const Ptr& o);
+
+    /** @overload
+    @param o Ptr to share ownership with.
+    */
+    template<typename Y>
+    Ptr(const Ptr<Y>& o);
+
+    /** @overload
+    @param o Ptr to share ownership with.
+    @param p Pointer to store.
+    */
+    template<typename Y>
+    Ptr(const Ptr<Y>& o, T* p);
+
+    /** The destructor is equivalent to calling Ptr::release. */
+    ~Ptr();
+
+    /**
+    Assignment replaces the current Ptr instance with one that owns and stores same pointers as o and
+    then destroys the old instance.
+    @param o Ptr to share ownership with.
+     */
+    Ptr& operator = (const Ptr& o);
+
+    /** @overload */
+    template<typename Y>
+    Ptr& operator = (const Ptr<Y>& o);
+
+    /** If no other Ptr instance owns the owned pointer, deletes it with the associated deleter. Then sets
+    both the owned and the stored pointers to NULL.
+    */
+    void release();
+
+    /**
+    `ptr.reset(...)` is equivalent to `ptr = Ptr<T>(...)`.
+    @param p Pointer to own.
+    */
+    template<typename Y>
+    void reset(Y* p);
+
+    /** @overload
+    @param d Deleter to use for the owned pointer.
+    @param p Pointer to own.
+    */
+    template<typename Y, typename D>
+    void reset(Y* p, D d);
+
+    /**
+    Swaps the owned and stored pointers (and deleters, if any) of this and o.
+    @param o Ptr to swap with.
+    */
+    void swap(Ptr& o);
+
+    /** Returns the stored pointer. */
+    T* get() const;
+
+    /** Ordinary pointer emulation. */
+    typename detail::RefOrVoid<T>::type operator * () const;
+
+    /** Ordinary pointer emulation. */
+    T* operator -> () const;
+
+    /** Equivalent to get(). */
+    operator T* () const;
+
+    /** ptr.empty() is equivalent to `!ptr.get()`. */
+    bool empty() const;
+
+    /** Returns a Ptr that owns the same pointer as this, and stores the same
+       pointer as this, except converted via static_cast to Y*.
+    */
+    template<typename Y>
+    Ptr<Y> staticCast() const;
+
+    /** Ditto for const_cast. */
+    template<typename Y>
+    Ptr<Y> constCast() const;
+
+    /** Ditto for dynamic_cast. */
+    template<typename Y>
+    Ptr<Y> dynamicCast() const;
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+    Ptr(Ptr&& o);
+    Ptr& operator = (Ptr&& o);
+#endif
+
+private:
+    detail::PtrOwner* owner;
+    T* stored;
+
+    template<typename Y>
+    friend struct Ptr; // have to do this for the cross-type copy constructor
+};
+
+/** Equivalent to ptr1.swap(ptr2). Provided to help write generic algorithms. */
+template<typename T>
+void swap(Ptr<T>& ptr1, Ptr<T>& ptr2);
+
+/** Return whether ptr1.get() and ptr2.get() are equal and not equal, respectively. */
+template<typename T>
+bool operator == (const Ptr<T>& ptr1, const Ptr<T>& ptr2);
+template<typename T>
+bool operator != (const Ptr<T>& ptr1, const Ptr<T>& ptr2);
+
+/** `makePtr<T>(...)` is equivalent to `Ptr<T>(new T(...))`. It is shorter than the latter, and it's
+marginally safer than using a constructor or Ptr::reset, since it ensures that the owned pointer
+is new and thus not owned by any other Ptr instance.
+Unfortunately, perfect forwarding is impossible to implement in C++03, and so makePtr is limited
+to constructors of T that have up to 10 arguments, none of which are non-const references.
+ */
+template<typename T>
+Ptr<T> makePtr();
+/** @overload */
+template<typename T, typename A1>
+Ptr<T> makePtr(const A1& a1);
+/** @overload */
+template<typename T, typename A1, typename A2>
+Ptr<T> makePtr(const A1& a1, const A2& a2);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10);
+
+//////////////////////////////// string class ////////////////////////////////
+
+class CV_EXPORTS FileNode; //for string constructor from FileNode
+
+class CV_EXPORTS String
+{
+public:
+    typedef char value_type;
+    typedef char& reference;
+    typedef const char& const_reference;
+    typedef char* pointer;
+    typedef const char* const_pointer;
+    typedef ptrdiff_t difference_type;
+    typedef size_t size_type;
+    typedef char* iterator;
+    typedef const char* const_iterator;
+
+    static const size_t npos = size_t(-1);
+
+    explicit String();
+    String(const String& str);
+    String(const String& str, size_t pos, size_t len = npos);
+    String(const char* s);
+    String(const char* s, size_t n);
+    String(size_t n, char c);
+    String(const char* first, const char* last);
+    template<typename Iterator> String(Iterator first, Iterator last);
+    explicit String(const FileNode& fn);
+    ~String();
+
+    String& operator=(const String& str);
+    String& operator=(const char* s);
+    String& operator=(char c);
+
+    String& operator+=(const String& str);
+    String& operator+=(const char* s);
+    String& operator+=(char c);
+
+    size_t size() const;
+    size_t length() const;
+
+    char operator[](size_t idx) const;
+    char operator[](int idx) const;
+
+    const char* begin() const;
+    const char* end() const;
+
+    const char* c_str() const;
+
+    bool empty() const;
+    void clear();
+
+    int compare(const char* s) const;
+    int compare(const String& str) const;
+
+    void swap(String& str);
+    String substr(size_t pos = 0, size_t len = npos) const;
+
+    size_t find(const char* s, size_t pos, size_t n) const;
+    size_t find(char c, size_t pos = 0) const;
+    size_t find(const String& str, size_t pos = 0) const;
+    size_t find(const char* s, size_t pos = 0) const;
+
+    size_t rfind(const char* s, size_t pos, size_t n) const;
+    size_t rfind(char c, size_t pos = npos) const;
+    size_t rfind(const String& str, size_t pos = npos) const;
+    size_t rfind(const char* s, size_t pos = npos) const;
+
+    size_t find_first_of(const char* s, size_t pos, size_t n) const;
+    size_t find_first_of(char c, size_t pos = 0) const;
+    size_t find_first_of(const String& str, size_t pos = 0) const;
+    size_t find_first_of(const char* s, size_t pos = 0) const;
+
+    size_t find_last_of(const char* s, size_t pos, size_t n) const;
+    size_t find_last_of(char c, size_t pos = npos) const;
+    size_t find_last_of(const String& str, size_t pos = npos) const;
+    size_t find_last_of(const char* s, size_t pos = npos) const;
+
+    friend String operator+ (const String& lhs, const String& rhs);
+    friend String operator+ (const String& lhs, const char*   rhs);
+    friend String operator+ (const char*   lhs, const String& rhs);
+    friend String operator+ (const String& lhs, char          rhs);
+    friend String operator+ (char          lhs, const String& rhs);
+
+    String toLowerCase() const;
+
+#ifndef OPENCV_NOSTL
+    String(const std::string& str);
+    String(const std::string& str, size_t pos, size_t len = npos);
+    String& operator=(const std::string& str);
+    String& operator+=(const std::string& str);
+    operator std::string() const;
+
+    friend String operator+ (const String& lhs, const std::string& rhs);
+    friend String operator+ (const std::string& lhs, const String& rhs);
+#endif
+
+private:
+    char*  cstr_;
+    size_t len_;
+
+    char* allocate(size_t len); // len without trailing 0
+    void deallocate();
+
+    String(int); // disabled and invalid. Catch invalid usages like, commandLineParser.has(0) problem
+};
+
+//! @} core_basic
+
+////////////////////////// cv::String implementation /////////////////////////
+
+//! @cond IGNORED
+
+inline
+String::String()
+    : cstr_(0), len_(0)
+{}
+
+inline
+String::String(const String& str)
+    : cstr_(str.cstr_), len_(str.len_)
+{
+    if (cstr_)
+        CV_XADD(((int*)cstr_)-1, 1);
+}
+
+inline
+String::String(const String& str, size_t pos, size_t len)
+    : cstr_(0), len_(0)
+{
+    pos = min(pos, str.len_);
+    len = min(str.len_ - pos, len);
+    if (!len) return;
+    if (len == str.len_)
+    {
+        CV_XADD(((int*)str.cstr_)-1, 1);
+        cstr_ = str.cstr_;
+        len_ = str.len_;
+        return;
+    }
+    memcpy(allocate(len), str.cstr_ + pos, len);
+}
+
+inline
+String::String(const char* s)
+    : cstr_(0), len_(0)
+{
+    if (!s) return;
+    size_t len = strlen(s);
+    memcpy(allocate(len), s, len);
+}
+
+inline
+String::String(const char* s, size_t n)
+    : cstr_(0), len_(0)
+{
+    if (!n) return;
+    memcpy(allocate(n), s, n);
+}
+
+inline
+String::String(size_t n, char c)
+    : cstr_(0), len_(0)
+{
+    memset(allocate(n), c, n);
+}
+
+inline
+String::String(const char* first, const char* last)
+    : cstr_(0), len_(0)
+{
+    size_t len = (size_t)(last - first);
+    memcpy(allocate(len), first, len);
+}
+
+template<typename Iterator> inline
+String::String(Iterator first, Iterator last)
+    : cstr_(0), len_(0)
+{
+    size_t len = (size_t)(last - first);
+    char* str = allocate(len);
+    while (first != last)
+    {
+        *str++ = *first;
+        ++first;
+    }
+}
+
+inline
+String::~String()
+{
+    deallocate();
+}
+
+inline
+String& String::operator=(const String& str)
+{
+    if (&str == this) return *this;
+
+    deallocate();
+    if (str.cstr_) CV_XADD(((int*)str.cstr_)-1, 1);
+    cstr_ = str.cstr_;
+    len_ = str.len_;
+    return *this;
+}
+
+inline
+String& String::operator=(const char* s)
+{
+    deallocate();
+    if (!s) return *this;
+    size_t len = strlen(s);
+    memcpy(allocate(len), s, len);
+    return *this;
+}
+
+inline
+String& String::operator=(char c)
+{
+    deallocate();
+    allocate(1)[0] = c;
+    return *this;
+}
+
+inline
+String& String::operator+=(const String& str)
+{
+    *this = *this + str;
+    return *this;
+}
+
+inline
+String& String::operator+=(const char* s)
+{
+    *this = *this + s;
+    return *this;
+}
+
+inline
+String& String::operator+=(char c)
+{
+    *this = *this + c;
+    return *this;
+}
+
+inline
+size_t String::size() const
+{
+    return len_;
+}
+
+inline
+size_t String::length() const
+{
+    return len_;
+}
+
+inline
+char String::operator[](size_t idx) const
+{
+    return cstr_[idx];
+}
+
+inline
+char String::operator[](int idx) const
+{
+    return cstr_[idx];
+}
+
+inline
+const char* String::begin() const
+{
+    return cstr_;
+}
+
+inline
+const char* String::end() const
+{
+    return len_ ? cstr_ + 1 : 0;
+}
+
+inline
+bool String::empty() const
+{
+    return len_ == 0;
+}
+
+inline
+const char* String::c_str() const
+{
+    return cstr_ ? cstr_ : "";
+}
+
+inline
+void String::swap(String& str)
+{
+    cv::swap(cstr_, str.cstr_);
+    cv::swap(len_, str.len_);
+}
+
+inline
+void String::clear()
+{
+    deallocate();
+}
+
+inline
+int String::compare(const char* s) const
+{
+    if (cstr_ == s) return 0;
+    return strcmp(c_str(), s);
+}
+
+inline
+int String::compare(const String& str) const
+{
+    if (cstr_ == str.cstr_) return 0;
+    return strcmp(c_str(), str.c_str());
+}
+
+inline
+String String::substr(size_t pos, size_t len) const
+{
+    return String(*this, pos, len);
+}
+
+inline
+size_t String::find(const char* s, size_t pos, size_t n) const
+{
+    if (n == 0 || pos + n > len_) return npos;
+    const char* lmax = cstr_ + len_ - n;
+    for (const char* i = cstr_ + pos; i <= lmax; ++i)
+    {
+        size_t j = 0;
+        while (j < n && s[j] == i[j]) ++j;
+        if (j == n) return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::find(char c, size_t pos) const
+{
+    return find(&c, pos, 1);
+}
+
+inline
+size_t String::find(const String& str, size_t pos) const
+{
+    return find(str.c_str(), pos, str.len_);
+}
+
+inline
+size_t String::find(const char* s, size_t pos) const
+{
+    if (pos >= len_ || !s[0]) return npos;
+    const char* lmax = cstr_ + len_;
+    for (const char* i = cstr_ + pos; i < lmax; ++i)
+    {
+        size_t j = 0;
+        while (s[j] && s[j] == i[j])
+        {   if(i + j >= lmax) return npos;
+            ++j;
+        }
+        if (!s[j]) return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::rfind(const char* s, size_t pos, size_t n) const
+{
+    if (n > len_) return npos;
+    if (pos > len_ - n) pos = len_ - n;
+    for (const char* i = cstr_ + pos; i >= cstr_; --i)
+    {
+        size_t j = 0;
+        while (j < n && s[j] == i[j]) ++j;
+        if (j == n) return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::rfind(char c, size_t pos) const
+{
+    return rfind(&c, pos, 1);
+}
+
+inline
+size_t String::rfind(const String& str, size_t pos) const
+{
+    return rfind(str.c_str(), pos, str.len_);
+}
+
+inline
+size_t String::rfind(const char* s, size_t pos) const
+{
+    return rfind(s, pos, strlen(s));
+}
+
+inline
+size_t String::find_first_of(const char* s, size_t pos, size_t n) const
+{
+    if (n == 0 || pos + n > len_) return npos;
+    const char* lmax = cstr_ + len_;
+    for (const char* i = cstr_ + pos; i < lmax; ++i)
+    {
+        for (size_t j = 0; j < n; ++j)
+            if (s[j] == *i)
+                return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::find_first_of(char c, size_t pos) const
+{
+    return find_first_of(&c, pos, 1);
+}
+
+inline
+size_t String::find_first_of(const String& str, size_t pos) const
+{
+    return find_first_of(str.c_str(), pos, str.len_);
+}
+
+inline
+size_t String::find_first_of(const char* s, size_t pos) const
+{
+    if (len_ == 0) return npos;
+    if (pos >= len_ || !s[0]) return npos;
+    const char* lmax = cstr_ + len_;
+    for (const char* i = cstr_ + pos; i < lmax; ++i)
+    {
+        for (size_t j = 0; s[j]; ++j)
+            if (s[j] == *i)
+                return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::find_last_of(const char* s, size_t pos, size_t n) const
+{
+    if (len_ == 0) return npos;
+    if (pos >= len_) pos = len_ - 1;
+    for (const char* i = cstr_ + pos; i >= cstr_; --i)
+    {
+        for (size_t j = 0; j < n; ++j)
+            if (s[j] == *i)
+                return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::find_last_of(char c, size_t pos) const
+{
+    return find_last_of(&c, pos, 1);
+}
+
+inline
+size_t String::find_last_of(const String& str, size_t pos) const
+{
+    return find_last_of(str.c_str(), pos, str.len_);
+}
+
+inline
+size_t String::find_last_of(const char* s, size_t pos) const
+{
+    if (len_ == 0) return npos;
+    if (pos >= len_) pos = len_ - 1;
+    for (const char* i = cstr_ + pos; i >= cstr_; --i)
+    {
+        for (size_t j = 0; s[j]; ++j)
+            if (s[j] == *i)
+                return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+String String::toLowerCase() const
+{
+    String res(cstr_, len_);
+
+    for (size_t i = 0; i < len_; ++i)
+        res.cstr_[i] = (char) ::tolower(cstr_[i]);
+
+    return res;
+}
+
+//! @endcond
+
+// ************************* cv::String non-member functions *************************
+
+//! @relates cv::String
+//! @{
+
+inline
+String operator + (const String& lhs, const String& rhs)
+{
+    String s;
+    s.allocate(lhs.len_ + rhs.len_);
+    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
+    memcpy(s.cstr_ + lhs.len_, rhs.cstr_, rhs.len_);
+    return s;
+}
+
+inline
+String operator + (const String& lhs, const char* rhs)
+{
+    String s;
+    size_t rhslen = strlen(rhs);
+    s.allocate(lhs.len_ + rhslen);
+    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
+    memcpy(s.cstr_ + lhs.len_, rhs, rhslen);
+    return s;
+}
+
+inline
+String operator + (const char* lhs, const String& rhs)
+{
+    String s;
+    size_t lhslen = strlen(lhs);
+    s.allocate(lhslen + rhs.len_);
+    memcpy(s.cstr_, lhs, lhslen);
+    memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
+    return s;
+}
+
+inline
+String operator + (const String& lhs, char rhs)
+{
+    String s;
+    s.allocate(lhs.len_ + 1);
+    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
+    s.cstr_[lhs.len_] = rhs;
+    return s;
+}
+
+inline
+String operator + (char lhs, const String& rhs)
+{
+    String s;
+    s.allocate(rhs.len_ + 1);
+    s.cstr_[0] = lhs;
+    memcpy(s.cstr_ + 1, rhs.cstr_, rhs.len_);
+    return s;
+}
+
+static inline bool operator== (const String& lhs, const String& rhs) { return 0 == lhs.compare(rhs); }
+static inline bool operator== (const char*   lhs, const String& rhs) { return 0 == rhs.compare(lhs); }
+static inline bool operator== (const String& lhs, const char*   rhs) { return 0 == lhs.compare(rhs); }
+static inline bool operator!= (const String& lhs, const String& rhs) { return 0 != lhs.compare(rhs); }
+static inline bool operator!= (const char*   lhs, const String& rhs) { return 0 != rhs.compare(lhs); }
+static inline bool operator!= (const String& lhs, const char*   rhs) { return 0 != lhs.compare(rhs); }
+static inline bool operator<  (const String& lhs, const String& rhs) { return lhs.compare(rhs) <  0; }
+static inline bool operator<  (const char*   lhs, const String& rhs) { return rhs.compare(lhs) >  0; }
+static inline bool operator<  (const String& lhs, const char*   rhs) { return lhs.compare(rhs) <  0; }
+static inline bool operator<= (const String& lhs, const String& rhs) { return lhs.compare(rhs) <= 0; }
+static inline bool operator<= (const char*   lhs, const String& rhs) { return rhs.compare(lhs) >= 0; }
+static inline bool operator<= (const String& lhs, const char*   rhs) { return lhs.compare(rhs) <= 0; }
+static inline bool operator>  (const String& lhs, const String& rhs) { return lhs.compare(rhs) >  0; }
+static inline bool operator>  (const char*   lhs, const String& rhs) { return rhs.compare(lhs) <  0; }
+static inline bool operator>  (const String& lhs, const char*   rhs) { return lhs.compare(rhs) >  0; }
+static inline bool operator>= (const String& lhs, const String& rhs) { return lhs.compare(rhs) >= 0; }
+static inline bool operator>= (const char*   lhs, const String& rhs) { return rhs.compare(lhs) <= 0; }
+static inline bool operator>= (const String& lhs, const char*   rhs) { return lhs.compare(rhs) >= 0; }
+
+//! @} relates cv::String
+
+} // cv
+
+#ifndef OPENCV_NOSTL_TRANSITIONAL
+namespace std
+{
+    static inline void swap(cv::String& a, cv::String& b) { a.swap(b); }
+}
+#else
+namespace cv
+{
+    template<> inline
+    void swap<cv::String>(cv::String& a, cv::String& b)
+    {
+        a.swap(b);
+    }
+}
+#endif
+
+#include "opencv2/core/ptr.inl.hpp"
+
+#endif //__OPENCV_CORE_CVSTD_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp
new file mode 100644
index 0000000..ad15406
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp
@@ -0,0 +1,267 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_CVSTDINL_HPP__
+#define __OPENCV_CORE_CVSTDINL_HPP__
+
+#ifndef OPENCV_NOSTL
+#  include <complex>
+#  include <ostream>
+#endif
+
+//! @cond IGNORED
+
+namespace cv
+{
+#ifndef OPENCV_NOSTL
+
+template<typename _Tp> class DataType< std::complex<_Tp> >
+{
+public:
+    typedef std::complex<_Tp>  value_type;
+    typedef value_type         work_type;
+    typedef _Tp                channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels) };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+inline
+String::String(const std::string& str)
+    : cstr_(0), len_(0)
+{
+    if (!str.empty())
+    {
+        size_t len = str.size();
+        memcpy(allocate(len), str.c_str(), len);
+    }
+}
+
+inline
+String::String(const std::string& str, size_t pos, size_t len)
+    : cstr_(0), len_(0)
+{
+    size_t strlen = str.size();
+    pos = min(pos, strlen);
+    len = min(strlen - pos, len);
+    if (!len) return;
+    memcpy(allocate(len), str.c_str() + pos, len);
+}
+
+inline
+String& String::operator = (const std::string& str)
+{
+    deallocate();
+    if (!str.empty())
+    {
+        size_t len = str.size();
+        memcpy(allocate(len), str.c_str(), len);
+    }
+    return *this;
+}
+
+inline
+String& String::operator += (const std::string& str)
+{
+    *this = *this + str;
+    return *this;
+}
+
+inline
+String::operator std::string() const
+{
+    return std::string(cstr_, len_);
+}
+
+inline
+String operator + (const String& lhs, const std::string& rhs)
+{
+    String s;
+    size_t rhslen = rhs.size();
+    s.allocate(lhs.len_ + rhslen);
+    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
+    memcpy(s.cstr_ + lhs.len_, rhs.c_str(), rhslen);
+    return s;
+}
+
+inline
+String operator + (const std::string& lhs, const String& rhs)
+{
+    String s;
+    size_t lhslen = lhs.size();
+    s.allocate(lhslen + rhs.len_);
+    memcpy(s.cstr_, lhs.c_str(), lhslen);
+    memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
+    return s;
+}
+
+inline
+FileNode::operator std::string() const
+{
+    String value;
+    read(*this, value, value);
+    return value;
+}
+
+template<> inline
+void operator >> (const FileNode& n, std::string& value)
+{
+    String val;
+    read(n, val, val);
+    value = val;
+}
+
+template<> inline
+FileStorage& operator << (FileStorage& fs, const std::string& value)
+{
+    return fs << cv::String(value);
+}
+
+static inline
+std::ostream& operator << (std::ostream& os, const String& str)
+{
+    return os << str.c_str();
+}
+
+static inline
+std::ostream& operator << (std::ostream& out, Ptr<Formatted> fmtd)
+{
+    fmtd->reset();
+    for(const char* str = fmtd->next(); str; str = fmtd->next())
+        out << str;
+    return out;
+}
+
+static inline
+std::ostream& operator << (std::ostream& out, const Mat& mtx)
+{
+    return out << Formatter::get()->format(mtx);
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const std::vector<Point_<_Tp> >& vec)
+{
+    return out << Formatter::get()->format(Mat(vec));
+}
+
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const std::vector<Point3_<_Tp> >& vec)
+{
+    return out << Formatter::get()->format(Mat(vec));
+}
+
+
+template<typename _Tp, int m, int n> static inline
+std::ostream& operator << (std::ostream& out, const Matx<_Tp, m, n>& matx)
+{
+    return out << Formatter::get()->format(Mat(matx));
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Point_<_Tp>& p)
+{
+    out << "[" << p.x << ", " << p.y << "]";
+    return out;
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Point3_<_Tp>& p)
+{
+    out << "[" << p.x << ", " << p.y << ", " << p.z << "]";
+    return out;
+}
+
+template<typename _Tp, int n> static inline
+std::ostream& operator << (std::ostream& out, const Vec<_Tp, n>& vec)
+{
+    out << "[";
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable: 4127 )
+#endif
+    if(Vec<_Tp, n>::depth < CV_32F)
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+    {
+        for (int i = 0; i < n - 1; ++i) {
+            out << (int)vec[i] << ", ";
+        }
+        out << (int)vec[n-1] << "]";
+    }
+    else
+    {
+        for (int i = 0; i < n - 1; ++i) {
+            out << vec[i] << ", ";
+        }
+        out << vec[n-1] << "]";
+    }
+
+    return out;
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Size_<_Tp>& size)
+{
+    return out << "[" << size.width << " x " << size.height << "]";
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Rect_<_Tp>& rect)
+{
+    return out << "[" << rect.width << " x " << rect.height << " from (" << rect.x << ", " << rect.y << ")]";
+}
+
+
+#endif // OPENCV_NOSTL
+} // cv
+
+//! @endcond
+
+#endif // __OPENCV_CORE_CVSTDINL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp
new file mode 100644
index 0000000..764af74
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp
@@ -0,0 +1,184 @@
+/*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) 2010-2013, Advanced Micro Devices, 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 copyright holders 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*/
+
+#ifndef __OPENCV_CORE_DIRECTX_HPP__
+#define __OPENCV_CORE_DIRECTX_HPP__
+
+#include "mat.hpp"
+#include "ocl.hpp"
+
+#if !defined(__d3d11_h__)
+struct ID3D11Device;
+struct ID3D11Texture2D;
+#endif
+
+#if !defined(__d3d10_h__)
+struct ID3D10Device;
+struct ID3D10Texture2D;
+#endif
+
+#if !defined(_D3D9_H_)
+struct IDirect3DDevice9;
+struct IDirect3DDevice9Ex;
+struct IDirect3DSurface9;
+#endif
+
+
+namespace cv { namespace directx {
+
+namespace ocl {
+using namespace cv::ocl;
+
+//! @addtogroup core_directx
+// This section describes OpenCL and DirectX interoperability.
+//
+// To enable DirectX support, configure OpenCV using CMake with WITH_DIRECTX=ON . Note, DirectX is
+// supported only on Windows.
+//
+// To use OpenCL functionality you should first initialize OpenCL context from DirectX resource.
+//
+//! @{
+
+// TODO static functions in the Context class
+//! @brief Creates OpenCL context from D3D11 device
+//
+//! @param pD3D11Device - pointer to D3D11 device
+//! @return Returns reference to OpenCL Context
+CV_EXPORTS Context& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device);
+
+//! @brief Creates OpenCL context from D3D10 device
+//
+//! @param pD3D10Device - pointer to D3D10 device
+//! @return Returns reference to OpenCL Context
+CV_EXPORTS Context& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device);
+
+//! @brief Creates OpenCL context from Direct3DDevice9Ex device
+//
+//! @param pDirect3DDevice9Ex - pointer to Direct3DDevice9Ex device
+//! @return Returns reference to OpenCL Context
+CV_EXPORTS Context& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDevice9Ex);
+
+//! @brief Creates OpenCL context from Direct3DDevice9 device
+//
+//! @param pDirect3DDevice9 - pointer to Direct3Device9 device
+//! @return Returns reference to OpenCL Context
+CV_EXPORTS Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9);
+
+//! @}
+
+} // namespace cv::directx::ocl
+
+//! @addtogroup core_directx
+//! @{
+
+//! @brief Converts InputArray to ID3D11Texture2D. If destination texture format is DXGI_FORMAT_NV12 then
+//!        input UMat expected to be in BGR format and data will be downsampled and color-converted to NV12.
+//
+//! @note Note: Destination texture must be allocated by application. Function does memory copy from src to
+//!             pD3D11Texture2D
+//
+//! @param src - source InputArray
+//! @param pD3D11Texture2D - destination D3D11 texture
+CV_EXPORTS void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D);
+
+//! @brief Converts ID3D11Texture2D to OutputArray. If input texture format is DXGI_FORMAT_NV12 then
+//!        data will be upsampled and color-converted to BGR format.
+//
+//! @note Note: Destination matrix will be re-allocated if it has not enough memory to match texture size.
+//!             function does memory copy from pD3D11Texture2D to dst
+//
+//! @param pD3D11Texture2D - source D3D11 texture
+//! @param dst             - destination OutputArray
+CV_EXPORTS void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst);
+
+//! @brief Converts InputArray to ID3D10Texture2D
+//
+//! @note Note: function does memory copy from src to
+//!             pD3D10Texture2D
+//
+//! @param src             - source InputArray
+//! @param pD3D10Texture2D - destination D3D10 texture
+CV_EXPORTS void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D);
+
+//! @brief Converts ID3D10Texture2D to OutputArray
+//
+//! @note Note: function does memory copy from pD3D10Texture2D
+//!             to dst
+//
+//! @param pD3D10Texture2D - source D3D10 texture
+//! @param dst             - destination OutputArray
+CV_EXPORTS void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst);
+
+//! @brief Converts InputArray to IDirect3DSurface9
+//
+//! @note Note: function does memory copy from src to
+//!             pDirect3DSurface9
+//
+//! @param src                 - source InputArray
+//! @param pDirect3DSurface9   - destination D3D10 texture
+//! @param surfaceSharedHandle - shared handle
+CV_EXPORTS void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurface9, void* surfaceSharedHandle = NULL);
+
+//! @brief Converts IDirect3DSurface9 to OutputArray
+//
+//! @note Note: function does memory copy from pDirect3DSurface9
+//!             to dst
+//
+//! @param pDirect3DSurface9   - source D3D10 texture
+//! @param dst                 - destination OutputArray
+//! @param surfaceSharedHandle - shared handle
+CV_EXPORTS void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArray dst, void* surfaceSharedHandle = NULL);
+
+//! @brief Get OpenCV type from DirectX type
+//! @param iDXGI_FORMAT - enum DXGI_FORMAT for D3D10/D3D11
+//! @return OpenCV type or -1 if there is no equivalent
+CV_EXPORTS int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT); // enum DXGI_FORMAT for D3D10/D3D11
+
+//! @brief Get OpenCV type from DirectX type
+//! @param iD3DFORMAT - enum D3DTYPE for D3D9
+//! @return OpenCV type or -1 if there is no equivalent
+CV_EXPORTS int getTypeFromD3DFORMAT(const int iD3DFORMAT); // enum D3DTYPE for D3D9
+
+//! @}
+
+} } // namespace cv::directx
+
+#endif // __OPENCV_CORE_DIRECTX_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp
new file mode 100644
index 0000000..44df04c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp
@@ -0,0 +1,280 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+
+#ifndef __OPENCV_CORE_EIGEN_HPP__
+#define __OPENCV_CORE_EIGEN_HPP__
+
+#include "opencv2/core.hpp"
+
+#if defined _MSC_VER && _MSC_VER >= 1200
+#pragma warning( disable: 4714 ) //__forceinline is not inlined
+#pragma warning( disable: 4127 ) //conditional expression is constant
+#pragma warning( disable: 4244 ) //conversion from '__int64' to 'int', possible loss of data
+#endif
+
+namespace cv
+{
+
+//! @addtogroup core_eigen
+//! @{
+
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
+void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, Mat& dst )
+{
+    if( !(src.Flags & Eigen::RowMajorBit) )
+    {
+        Mat _src(src.cols(), src.rows(), DataType<_Tp>::type,
+              (void*)src.data(), src.stride()*sizeof(_Tp));
+        transpose(_src, dst);
+    }
+    else
+    {
+        Mat _src(src.rows(), src.cols(), DataType<_Tp>::type,
+                 (void*)src.data(), src.stride()*sizeof(_Tp));
+        _src.copyTo(dst);
+    }
+}
+
+// Matx case
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
+void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
+               Matx<_Tp, _rows, _cols>& dst )
+{
+    if( !(src.Flags & Eigen::RowMajorBit) )
+    {
+        dst = Matx<_Tp, _cols, _rows>(static_cast<const _Tp*>(src.data())).t();
+    }
+    else
+    {
+        dst = Matx<_Tp, _rows, _cols>(static_cast<const _Tp*>(src.data()));
+    }
+}
+
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
+void cv2eigen( const Mat& src,
+               Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
+{
+    CV_DbgAssert(src.rows == _rows && src.cols == _cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        if( src.type() == _dst.type() )
+            transpose(src, _dst);
+        else if( src.cols == src.rows )
+        {
+            src.convertTo(_dst, _dst.type());
+            transpose(_dst, _dst);
+        }
+        else
+            Mat(src.t()).convertTo(_dst, _dst.type());
+    }
+    else
+    {
+        const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.convertTo(_dst, _dst.type());
+    }
+}
+
+// Matx case
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
+void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
+               Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
+{
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(_cols, _rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        transpose(src, _dst);
+    }
+    else
+    {
+        const Mat _dst(_rows, _cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        Mat(src).copyTo(_dst);
+    }
+}
+
+template<typename _Tp>  static inline
+void cv2eigen( const Mat& src,
+               Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
+{
+    dst.resize(src.rows, src.cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
+             dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        if( src.type() == _dst.type() )
+            transpose(src, _dst);
+        else if( src.cols == src.rows )
+        {
+            src.convertTo(_dst, _dst.type());
+            transpose(_dst, _dst);
+        }
+        else
+            Mat(src.t()).convertTo(_dst, _dst.type());
+    }
+    else
+    {
+        const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.convertTo(_dst, _dst.type());
+    }
+}
+
+// Matx case
+template<typename _Tp, int _rows, int _cols> static inline
+void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
+               Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
+{
+    dst.resize(_rows, _cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(_cols, _rows, DataType<_Tp>::type,
+             dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        transpose(src, _dst);
+    }
+    else
+    {
+        const Mat _dst(_rows, _cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        Mat(src).copyTo(_dst);
+    }
+}
+
+template<typename _Tp> static inline
+void cv2eigen( const Mat& src,
+               Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
+{
+    CV_Assert(src.cols == 1);
+    dst.resize(src.rows);
+
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        if( src.type() == _dst.type() )
+            transpose(src, _dst);
+        else
+            Mat(src.t()).convertTo(_dst, _dst.type());
+    }
+    else
+    {
+        const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.convertTo(_dst, _dst.type());
+    }
+}
+
+// Matx case
+template<typename _Tp, int _rows> static inline
+void cv2eigen( const Matx<_Tp, _rows, 1>& src,
+               Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
+{
+    dst.resize(_rows);
+
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(1, _rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        transpose(src, _dst);
+    }
+    else
+    {
+        const Mat _dst(_rows, 1, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.copyTo(_dst);
+    }
+}
+
+
+template<typename _Tp> static inline
+void cv2eigen( const Mat& src,
+               Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
+{
+    CV_Assert(src.rows == 1);
+    dst.resize(src.cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        if( src.type() == _dst.type() )
+            transpose(src, _dst);
+        else
+            Mat(src.t()).convertTo(_dst, _dst.type());
+    }
+    else
+    {
+        const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.convertTo(_dst, _dst.type());
+    }
+}
+
+//Matx
+template<typename _Tp, int _cols> static inline
+void cv2eigen( const Matx<_Tp, 1, _cols>& src,
+               Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
+{
+    dst.resize(_cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(_cols, 1, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        transpose(src, _dst);
+    }
+    else
+    {
+        const Mat _dst(1, _cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        Mat(src).copyTo(_dst);
+    }
+}
+
+//! @}
+
+} // cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp
new file mode 100644
index 0000000..b8b241b
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp
@@ -0,0 +1,302 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_FAST_MATH_HPP__
+#define __OPENCV_CORE_FAST_MATH_HPP__
+
+#include "opencv2/core/cvdef.h"
+
+//! @addtogroup core_utils
+//! @{
+
+/****************************************************************************************\
+*                                      fast math                                         *
+\****************************************************************************************/
+
+#if defined __BORLANDC__
+#  include <fastmath.h>
+#elif defined __cplusplus
+#  include <cmath>
+#else
+#  include <math.h>
+#endif
+
+#ifdef HAVE_TEGRA_OPTIMIZATION
+#  include "tegra_round.hpp"
+#endif
+
+#if CV_VFP
+    // 1. general scheme
+    #define ARM_ROUND(_value, _asm_string) \
+        int res; \
+        float temp; \
+        asm(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \
+        return res
+    // 2. version for double
+    #ifdef __clang__
+        #define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]")
+    #else
+        #define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]")
+    #endif
+    // 3. version for float
+    #define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]")
+#endif // CV_VFP
+
+/** @brief Rounds floating-point number to the nearest integer
+
+ @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
+ result is not defined.
+ */
+CV_INLINE int
+cvRound( double value )
+{
+#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \
+    && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128d t = _mm_set_sd( value );
+    return _mm_cvtsd_si32(t);
+#elif defined _MSC_VER && defined _M_IX86
+    int t;
+    __asm
+    {
+        fld value;
+        fistp t;
+    }
+    return t;
+#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \
+        defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
+    TEGRA_ROUND_DBL(value);
+#elif defined CV_ICC || defined __GNUC__
+# if CV_VFP
+    ARM_ROUND_DBL(value);
+# else
+    return (int)lrint(value);
+# endif
+#else
+    /* it's ok if round does not comply with IEEE754 standard;
+       the tests should allow +/-1 difference when the tested functions use round */
+    return (int)(value + (value >= 0 ? 0.5 : -0.5));
+#endif
+}
+
+
+/** @brief Rounds floating-point number to the nearest integer not larger than the original.
+
+ The function computes an integer i such that:
+ \f[i \le \texttt{value} < i+1\f]
+ @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
+ result is not defined.
+ */
+CV_INLINE int cvFloor( double value )
+{
+#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128d t = _mm_set_sd( value );
+    int i = _mm_cvtsd_si32(t);
+    return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i)));
+#elif defined __GNUC__
+    int i = (int)value;
+    return i - (i > value);
+#else
+    int i = cvRound(value);
+    float diff = (float)(value - i);
+    return i - (diff < 0);
+#endif
+}
+
+/** @brief Rounds floating-point number to the nearest integer not smaller than the original.
+
+ The function computes an integer i such that:
+ \f[i \le \texttt{value} < i+1\f]
+ @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
+ result is not defined.
+ */
+CV_INLINE int cvCeil( double value )
+{
+#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128d t = _mm_set_sd( value );
+    int i = _mm_cvtsd_si32(t);
+    return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t));
+#elif defined __GNUC__
+    int i = (int)value;
+    return i + (i < value);
+#else
+    int i = cvRound(value);
+    float diff = (float)(i - value);
+    return i + (diff < 0);
+#endif
+}
+
+/** @brief Determines if the argument is Not A Number.
+
+ @param value The input floating-point value
+
+ The function returns 1 if the argument is Not A Number (as defined by IEEE754 standard), 0
+ otherwise. */
+CV_INLINE int cvIsNaN( double value )
+{
+    Cv64suf ieee754;
+    ieee754.f = value;
+    return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) +
+           ((unsigned)ieee754.u != 0) > 0x7ff00000;
+}
+
+/** @brief Determines if the argument is Infinity.
+
+ @param value The input floating-point value
+
+ The function returns 1 if the argument is a plus or minus infinity (as defined by IEEE754 standard)
+ and 0 otherwise. */
+CV_INLINE int cvIsInf( double value )
+{
+    Cv64suf ieee754;
+    ieee754.f = value;
+    return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 &&
+            (unsigned)ieee754.u == 0;
+}
+
+#ifdef __cplusplus
+
+/** @overload */
+CV_INLINE int cvRound(float value)
+{
+#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && \
+      defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128 t = _mm_set_ss( value );
+    return _mm_cvtss_si32(t);
+#elif defined _MSC_VER && defined _M_IX86
+    int t;
+    __asm
+    {
+        fld value;
+        fistp t;
+    }
+    return t;
+#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \
+        defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
+    TEGRA_ROUND_FLT(value);
+#elif defined CV_ICC || defined __GNUC__
+# if CV_VFP
+    ARM_ROUND_FLT(value);
+# else
+    return (int)lrintf(value);
+# endif
+#else
+    /* it's ok if round does not comply with IEEE754 standard;
+     the tests should allow +/-1 difference when the tested functions use round */
+    return (int)(value + (value >= 0 ? 0.5f : -0.5f));
+#endif
+}
+
+/** @overload */
+CV_INLINE int cvRound( int value )
+{
+    return value;
+}
+
+/** @overload */
+CV_INLINE int cvFloor( float value )
+{
+#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128 t = _mm_set_ss( value );
+    int i = _mm_cvtss_si32(t);
+    return i - _mm_movemask_ps(_mm_cmplt_ss(t, _mm_cvtsi32_ss(t,i)));
+#elif defined __GNUC__
+    int i = (int)value;
+    return i - (i > value);
+#else
+    int i = cvRound(value);
+    float diff = (float)(value - i);
+    return i - (diff < 0);
+#endif
+}
+
+/** @overload */
+CV_INLINE int cvFloor( int value )
+{
+    return value;
+}
+
+/** @overload */
+CV_INLINE int cvCeil( float value )
+{
+#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128 t = _mm_set_ss( value );
+    int i = _mm_cvtss_si32(t);
+    return i + _mm_movemask_ps(_mm_cmplt_ss(_mm_cvtsi32_ss(t,i), t));
+#elif defined __GNUC__
+    int i = (int)value;
+    return i + (i < value);
+#else
+    int i = cvRound(value);
+    float diff = (float)(i - value);
+    return i + (diff < 0);
+#endif
+}
+
+/** @overload */
+CV_INLINE int cvCeil( int value )
+{
+    return value;
+}
+
+/** @overload */
+CV_INLINE int cvIsNaN( float value )
+{
+    Cv32suf ieee754;
+    ieee754.f = value;
+    return (ieee754.u & 0x7fffffff) > 0x7f800000;
+}
+
+/** @overload */
+CV_INLINE int cvIsInf( float value )
+{
+    Cv32suf ieee754;
+    ieee754.f = value;
+    return (ieee754.u & 0x7fffffff) == 0x7f800000;
+}
+
+#endif // __cplusplus
+
+//! @} core_utils
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp
new file mode 100644
index 0000000..118913e
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp
@@ -0,0 +1,218 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_HPP__
+#define __OPENCV_HAL_HPP__
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/hal/interface.h"
+
+//! @cond IGNORED
+#define CALL_HAL(name, fun, ...) \
+    int res = fun(__VA_ARGS__); \
+    if (res == CV_HAL_ERROR_OK) \
+        return; \
+    else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) \
+        CV_Error_(cv::Error::StsInternal, \
+            ("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res));
+//! @endcond
+
+
+namespace cv { namespace hal {
+
+//! @addtogroup core_hal_functions
+//! @{
+
+CV_EXPORTS int normHamming(const uchar* a, int n);
+CV_EXPORTS int normHamming(const uchar* a, const uchar* b, int n);
+
+CV_EXPORTS int normHamming(const uchar* a, int n, int cellSize);
+CV_EXPORTS int normHamming(const uchar* a, const uchar* b, int n, int cellSize);
+
+CV_EXPORTS int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+CV_EXPORTS int LU64f(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+CV_EXPORTS bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+CV_EXPORTS bool Cholesky64f(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+
+CV_EXPORTS int normL1_(const uchar* a, const uchar* b, int n);
+CV_EXPORTS float normL1_(const float* a, const float* b, int n);
+CV_EXPORTS float normL2Sqr_(const float* a, const float* b, int n);
+
+CV_EXPORTS void exp32f(const float* src, float* dst, int n);
+CV_EXPORTS void exp64f(const double* src, double* dst, int n);
+CV_EXPORTS void log32f(const float* src, float* dst, int n);
+CV_EXPORTS void log64f(const double* src, double* dst, int n);
+
+CV_EXPORTS void fastAtan2(const float* y, const float* x, float* dst, int n, bool angleInDegrees);
+CV_EXPORTS void magnitude32f(const float* x, const float* y, float* dst, int n);
+CV_EXPORTS void magnitude64f(const double* x, const double* y, double* dst, int n);
+CV_EXPORTS void sqrt32f(const float* src, float* dst, int len);
+CV_EXPORTS void sqrt64f(const double* src, double* dst, int len);
+CV_EXPORTS void invSqrt32f(const float* src, float* dst, int len);
+CV_EXPORTS void invSqrt64f(const double* src, double* dst, int len);
+
+CV_EXPORTS void split8u(const uchar* src, uchar** dst, int len, int cn );
+CV_EXPORTS void split16u(const ushort* src, ushort** dst, int len, int cn );
+CV_EXPORTS void split32s(const int* src, int** dst, int len, int cn );
+CV_EXPORTS void split64s(const int64* src, int64** dst, int len, int cn );
+
+CV_EXPORTS void merge8u(const uchar** src, uchar* dst, int len, int cn );
+CV_EXPORTS void merge16u(const ushort** src, ushort* dst, int len, int cn );
+CV_EXPORTS void merge32s(const int** src, int* dst, int len, int cn );
+CV_EXPORTS void merge64s(const int64** src, int64* dst, int len, int cn );
+
+CV_EXPORTS void add8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void sub8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void max8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void min8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void absdiff8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void and8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void or8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void xor8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void not8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp8s(const schar* src1, size_t step1, const schar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp16s(const short* src1, size_t step1, const short* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp32s(const int* src1, size_t step1, const int* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp32f(const float* src1, size_t step1, const float* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+
+CV_EXPORTS void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale);
+
+CV_EXPORTS void div8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale);
+
+CV_EXPORTS void recip8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale);
+
+CV_EXPORTS void addWeighted8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _scalars );
+CV_EXPORTS void addWeighted8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scalars );
+
+//! @} core_hal
+
+//=============================================================================
+// for binary compatibility with 3.0
+
+//! @cond IGNORED
+
+CV_EXPORTS int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+CV_EXPORTS int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+CV_EXPORTS bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+CV_EXPORTS bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+
+CV_EXPORTS void exp(const float* src, float* dst, int n);
+CV_EXPORTS void exp(const double* src, double* dst, int n);
+CV_EXPORTS void log(const float* src, float* dst, int n);
+CV_EXPORTS void log(const double* src, double* dst, int n);
+
+CV_EXPORTS void magnitude(const float* x, const float* y, float* dst, int n);
+CV_EXPORTS void magnitude(const double* x, const double* y, double* dst, int n);
+CV_EXPORTS void sqrt(const float* src, float* dst, int len);
+CV_EXPORTS void sqrt(const double* src, double* dst, int len);
+CV_EXPORTS void invSqrt(const float* src, float* dst, int len);
+CV_EXPORTS void invSqrt(const double* src, double* dst, int len);
+
+//! @endcond
+
+}} //cv::hal
+
+#endif //__OPENCV_HAL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h
new file mode 100644
index 0000000..51f7606
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h
@@ -0,0 +1,69 @@
+#ifndef _HAL_INTERFACE_HPP_INCLUDED_
+#define _HAL_INTERFACE_HPP_INCLUDED_
+
+//! @addtogroup core_hal_interface
+//! @{
+
+#define CV_HAL_ERROR_OK 0
+#define CV_HAL_ERROR_NOT_IMPLEMENTED 1
+#define CV_HAL_ERROR_UNKNOWN -1
+
+#define CV_HAL_CMP_EQ 0
+#define CV_HAL_CMP_GT 1
+#define CV_HAL_CMP_GE 2
+#define CV_HAL_CMP_LT 3
+#define CV_HAL_CMP_LE 4
+#define CV_HAL_CMP_NE 5
+
+#ifdef __cplusplus
+#include <cstddef>
+#else
+#include <stddef.h>
+#endif
+
+/* primitive types */
+/*
+  schar  - signed 1 byte integer
+  uchar  - unsigned 1 byte integer
+  short  - signed 2 byte integer
+  ushort - unsigned 2 byte integer
+  int    - signed 4 byte integer
+  uint   - unsigned 4 byte integer
+  int64  - signed 8 byte integer
+  uint64 - unsigned 8 byte integer
+*/
+
+#if !defined _MSC_VER && !defined __BORLANDC__
+#  if defined __cplusplus && __cplusplus >= 201103L && !defined __APPLE__
+#    include <cstdint>
+     typedef std::uint32_t uint;
+#  else
+#    include <stdint.h>
+     typedef uint32_t uint;
+#  endif
+#else
+   typedef unsigned uint;
+#endif
+
+typedef signed char schar;
+
+#ifndef __IPL_H__
+   typedef unsigned char uchar;
+   typedef unsigned short ushort;
+#endif
+
+#if defined _MSC_VER || defined __BORLANDC__
+   typedef __int64 int64;
+   typedef unsigned __int64 uint64;
+#  define CV_BIG_INT(n)   n##I64
+#  define CV_BIG_UINT(n)  n##UI64
+#else
+   typedef int64_t int64;
+   typedef uint64_t uint64;
+#  define CV_BIG_INT(n)   n##LL
+#  define CV_BIG_UINT(n)  n##ULL
+#endif
+
+//! @}
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp
new file mode 100644
index 0000000..33e14b4
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp
@@ -0,0 +1,320 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_INTRIN_HPP__
+#define __OPENCV_HAL_INTRIN_HPP__
+
+#include <cmath>
+#include <float.h>
+#include <stdlib.h>
+#include "opencv2/core/cvdef.h"
+
+#define OPENCV_HAL_ADD(a, b) ((a) + (b))
+#define OPENCV_HAL_AND(a, b) ((a) & (b))
+#define OPENCV_HAL_NOP(a) (a)
+#define OPENCV_HAL_1ST(a, b) (a)
+
+// unlike HAL API, which is in cv::hal,
+// we put intrinsics into cv namespace to make its
+// access from within opencv code more accessible
+namespace cv {
+
+//! @addtogroup core_hal_intrin
+//! @{
+
+//! @cond IGNORED
+template<typename _Tp> struct V_TypeTraits
+{
+    typedef _Tp int_type;
+    typedef _Tp uint_type;
+    typedef _Tp abs_type;
+    typedef _Tp sum_type;
+
+    enum { delta = 0, shift = 0 };
+
+    static int_type reinterpret_int(_Tp x) { return x; }
+    static uint_type reinterpet_uint(_Tp x) { return x; }
+    static _Tp reinterpret_from_int(int_type x) { return (_Tp)x; }
+};
+
+template<> struct V_TypeTraits<uchar>
+{
+    typedef uchar value_type;
+    typedef schar int_type;
+    typedef uchar uint_type;
+    typedef uchar abs_type;
+    typedef int sum_type;
+
+    typedef ushort w_type;
+    typedef unsigned q_type;
+
+    enum { delta = 128, shift = 8 };
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<schar>
+{
+    typedef schar value_type;
+    typedef schar int_type;
+    typedef uchar uint_type;
+    typedef uchar abs_type;
+    typedef int sum_type;
+
+    typedef short w_type;
+    typedef int q_type;
+
+    enum { delta = 128, shift = 8 };
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<ushort>
+{
+    typedef ushort value_type;
+    typedef short int_type;
+    typedef ushort uint_type;
+    typedef ushort abs_type;
+    typedef int sum_type;
+
+    typedef unsigned w_type;
+    typedef uchar nu_type;
+
+    enum { delta = 32768, shift = 16 };
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<short>
+{
+    typedef short value_type;
+    typedef short int_type;
+    typedef ushort uint_type;
+    typedef ushort abs_type;
+    typedef int sum_type;
+
+    typedef int w_type;
+    typedef uchar nu_type;
+    typedef schar n_type;
+
+    enum { delta = 128, shift = 8 };
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<unsigned>
+{
+    typedef unsigned value_type;
+    typedef int int_type;
+    typedef unsigned uint_type;
+    typedef unsigned abs_type;
+    typedef unsigned sum_type;
+
+    typedef uint64 w_type;
+    typedef ushort nu_type;
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<int>
+{
+    typedef int value_type;
+    typedef int int_type;
+    typedef unsigned uint_type;
+    typedef unsigned abs_type;
+    typedef int sum_type;
+
+    typedef int64 w_type;
+    typedef short n_type;
+    typedef ushort nu_type;
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<uint64>
+{
+    typedef uint64 value_type;
+    typedef int64 int_type;
+    typedef uint64 uint_type;
+    typedef uint64 abs_type;
+    typedef uint64 sum_type;
+
+    typedef unsigned nu_type;
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<int64>
+{
+    typedef int64 value_type;
+    typedef int64 int_type;
+    typedef uint64 uint_type;
+    typedef uint64 abs_type;
+    typedef int64 sum_type;
+
+    typedef int nu_type;
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+
+template<> struct V_TypeTraits<float>
+{
+    typedef float value_type;
+    typedef int int_type;
+    typedef unsigned uint_type;
+    typedef float abs_type;
+    typedef float sum_type;
+
+    typedef double w_type;
+
+    static int_type reinterpret_int(value_type x)
+    {
+        Cv32suf u;
+        u.f = x;
+        return u.i;
+    }
+    static uint_type reinterpet_uint(value_type x)
+    {
+        Cv32suf u;
+        u.f = x;
+        return u.u;
+    }
+    static value_type reinterpret_from_int(int_type x)
+    {
+        Cv32suf u;
+        u.i = x;
+        return u.f;
+    }
+};
+
+template<> struct V_TypeTraits<double>
+{
+    typedef double value_type;
+    typedef int64 int_type;
+    typedef uint64 uint_type;
+    typedef double abs_type;
+    typedef double sum_type;
+    static int_type reinterpret_int(value_type x)
+    {
+        Cv64suf u;
+        u.f = x;
+        return u.i;
+    }
+    static uint_type reinterpet_uint(value_type x)
+    {
+        Cv64suf u;
+        u.f = x;
+        return u.u;
+    }
+    static value_type reinterpret_from_int(int_type x)
+    {
+        Cv64suf u;
+        u.i = x;
+        return u.f;
+    }
+};
+
+template <typename T> struct V_SIMD128Traits
+{
+    enum { nlanes = 16 / sizeof(T) };
+};
+
+//! @endcond
+
+//! @}
+
+}
+
+#ifdef CV_DOXYGEN
+#   undef CV_SSE2
+#   undef CV_NEON
+#endif
+
+#if CV_SSE2
+
+#include "opencv2/core/hal/intrin_sse.hpp"
+
+#elif CV_NEON
+
+#include "opencv2/core/hal/intrin_neon.hpp"
+
+#else
+
+#include "opencv2/core/hal/intrin_cpp.hpp"
+
+#endif
+
+//! @addtogroup core_hal_intrin
+//! @{
+
+#ifndef CV_SIMD128
+//! Set to 1 if current compiler supports vector extensions (NEON or SSE is enabled)
+#define CV_SIMD128 0
+#endif
+
+#ifndef CV_SIMD128_64F
+//! Set to 1 if current intrinsics implementation supports 64-bit float vectors
+#define CV_SIMD128_64F 0
+#endif
+
+//! @}
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp
new file mode 100644
index 0000000..3929e0d
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp
@@ -0,0 +1,1738 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_INTRIN_CPP_HPP__
+#define __OPENCV_HAL_INTRIN_CPP_HPP__
+
+#include <limits>
+#include <cstring>
+#include <algorithm>
+#include "opencv2/core/saturate.hpp"
+
+namespace cv
+{
+
+/** @addtogroup core_hal_intrin
+
+"Universal intrinsics" is a types and functions set intended to simplify vectorization of code on
+different platforms. Currently there are two supported SIMD extensions: __SSE/SSE2__ on x86
+architectures and __NEON__ on ARM architectures, both allow working with 128 bit registers
+containing packed values of different types. In case when there is no SIMD extension available
+during compilation, fallback C++ implementation of intrinsics will be chosen and code will work as
+expected although it could be slower.
+
+### Types
+
+There are several types representing 128-bit register as a vector of packed values, each type is
+implemented as a structure based on a one SIMD register.
+
+- cv::v_uint8x16 and cv::v_int8x16: sixteen 8-bit integer values (unsigned/signed) - char
+- cv::v_uint16x8 and cv::v_int16x8: eight 16-bit integer values (unsigned/signed) - short
+- cv::v_uint32x4 and cv::v_int32x4: four 32-bit integer values (unsgined/signed) - int
+- cv::v_uint64x2 and cv::v_int64x2: two 64-bit integer values (unsigned/signed) - int64
+- cv::v_float32x4: four 32-bit floating point values (signed) - float
+- cv::v_float64x2: two 64-bit floating point valies (signed) - double
+
+@note
+cv::v_float64x2 is not implemented in NEON variant, if you want to use this type, don't forget to
+check the CV_SIMD128_64F preprocessor definition:
+@code
+#if CV_SIMD128_64F
+//...
+#endif
+@endcode
+
+### Load and store operations
+
+These operations allow to set contents of the register explicitly or by loading it from some memory
+block and to save contents of the register to memory block.
+
+- Constructors:
+@ref v_reg::v_reg(const _Tp *ptr) "from memory",
+@ref v_reg::v_reg(_Tp s0, _Tp s1) "from two values", ...
+- Other create methods:
+@ref v_setall_s8, @ref v_setall_u8, ...,
+@ref v_setzero_u8, @ref v_setzero_s8, ...
+- Memory operations:
+@ref v_load, @ref v_load_aligned, @ref v_load_halves,
+@ref v_store, @ref v_store_aligned,
+@ref v_store_high, @ref v_store_low
+
+### Value reordering
+
+These operations allow to reorder or recombine elements in one or multiple vectors.
+
+- Interleave, deinterleave (3 and 4 channels): @ref v_load_deinterleave, @ref v_store_interleave
+- Expand: @ref v_load_expand, @ref v_load_expand_q, @ref v_expand
+- Pack: @ref v_pack, @ref v_pack_u, @ref v_rshr_pack, @ref v_rshr_pack_u,
+@ref v_pack_store, @ref v_pack_u_store, @ref v_rshr_pack_store, @ref v_rshr_pack_u_store
+- Recombine: @ref v_zip, @ref v_recombine, @ref v_combine_low, @ref v_combine_high
+- Extract: @ref v_extract
+
+
+### Arithmetic, bitwise and comparison operations
+
+Element-wise binary and unary operations.
+
+- Arithmetics:
+@ref operator+(const v_reg &a, const v_reg &b) "+",
+@ref operator-(const v_reg &a, const v_reg &b) "-",
+@ref operator*(const v_reg &a, const v_reg &b) "*",
+@ref operator/(const v_reg &a, const v_reg &b) "/",
+@ref v_mul_expand
+
+- Non-saturating arithmetics: @ref v_add_wrap, @ref v_sub_wrap
+
+- Bitwise shifts:
+@ref operator<<(const v_reg &a, int s) "<<",
+@ref operator>>(const v_reg &a, int s) ">>",
+@ref v_shl, @ref v_shr
+
+- Bitwise logic:
+@ref operator&(const v_reg &a, const v_reg &b) "&",
+@ref operator|(const v_reg &a, const v_reg &b) "|",
+@ref operator^(const v_reg &a, const v_reg &b) "^",
+@ref operator~(const v_reg &a) "~"
+
+- Comparison:
+@ref operator>(const v_reg &a, const v_reg &b) ">",
+@ref operator>=(const v_reg &a, const v_reg &b) ">=",
+@ref operator<(const v_reg &a, const v_reg &b) "<",
+@ref operator<=(const v_reg &a, const v_reg &b) "<=",
+@ref operator==(const v_reg &a, const v_reg &b) "==",
+@ref operator!=(const v_reg &a, const v_reg &b) "!="
+
+- min/max: @ref v_min, @ref v_max
+
+### Reduce and mask
+
+Most of these operations return only one value.
+
+- Reduce: @ref v_reduce_min, @ref v_reduce_max, @ref v_reduce_sum
+- Mask: @ref v_signmask, @ref v_check_all, @ref v_check_any, @ref v_select
+
+### Other math
+
+- Some frequent operations: @ref v_sqrt, @ref v_invsqrt, @ref v_magnitude, @ref v_sqr_magnitude
+- Absolute values: @ref v_abs, @ref v_absdiff
+
+### Conversions
+
+Different type conversions and casts:
+
+- Rounding: @ref v_round, @ref v_floor, @ref v_ceil, @ref v_trunc,
+- To float: @ref v_cvt_f32, @ref v_cvt_f64
+- Reinterpret: @ref v_reinterpret_as_u8, @ref v_reinterpret_as_s8, ...
+
+### Matrix operations
+
+In these operations vectors represent matrix rows/columns: @ref v_dotprod, @ref v_matmul, @ref v_transpose4x4
+
+### Usability
+
+Most operations are implemented only for some subset of the available types, following matrices
+shows the applicability of different operations to the types.
+
+Regular integers:
+
+| Operations\\Types | uint 8x16 | int 8x16 | uint 16x8 | int 16x8 | uint 32x4 | int 32x4 |
+|-------------------|:-:|:-:|:-:|:-:|:-:|:-:|
+|load, store        | x | x | x | x | x | x |
+|interleave         | x | x | x | x | x | x |
+|expand             | x | x | x | x | x | x |
+|expand_q           | x | x |   |   |   |   |
+|add, sub           | x | x | x | x | x | x |
+|add_wrap, sub_wrap | x | x | x | x |   |   |
+|mul                |   |   | x | x | x | x |
+|mul_expand         |   |   | x | x | x |   |
+|compare            | x | x | x | x | x | x |
+|shift              |   |   | x | x | x | x |
+|dotprod            |   |   |   | x |   |   |
+|logical            | x | x | x | x | x | x |
+|min, max           | x | x | x | x | x | x |
+|absdiff            | x | x | x | x | x | x |
+|reduce             |   |   |   |   | x | x |
+|mask               | x | x | x | x | x | x |
+|pack               | x | x | x | x | x | x |
+|pack_u             | x |   | x |   |   |   |
+|unpack             | x | x | x | x | x | x |
+|extract            | x | x | x | x | x | x |
+|cvt_flt32          |   |   |   |   |   | x |
+|cvt_flt64          |   |   |   |   |   | x |
+|transpose4x4       |   |   |   |   | x | x |
+
+Big integers:
+
+| Operations\\Types | uint 64x2 | int 64x2 |
+|-------------------|:-:|:-:|
+|load, store        | x | x |
+|add, sub           | x | x |
+|shift              | x | x |
+|logical            | x | x |
+|extract            | x | x |
+
+Floating point:
+
+| Operations\\Types | float 32x4 | float 64x2 |
+|-------------------|:-:|:-:|
+|load, store        | x | x |
+|interleave         | x |   |
+|add, sub           | x | x |
+|mul                | x | x |
+|div                | x | x |
+|compare            | x | x |
+|min, max           | x | x |
+|absdiff            | x | x |
+|reduce             | x |   |
+|mask               | x | x |
+|unpack             | x | x |
+|cvt_flt32          |   | x |
+|cvt_flt64          | x |   |
+|sqrt, abs          | x | x |
+|float math         | x | x |
+|transpose4x4       | x |   |
+
+
+ @{ */
+
+template<typename _Tp, int n> struct v_reg
+{
+//! @cond IGNORED
+    typedef _Tp lane_type;
+    typedef v_reg<typename V_TypeTraits<_Tp>::int_type, n> int_vec;
+    typedef v_reg<typename V_TypeTraits<_Tp>::abs_type, n> abs_vec;
+    enum { nlanes = n };
+// !@endcond
+
+    /** @brief Constructor
+
+    Initializes register with data from memory
+    @param ptr pointer to memory block with data for register */
+    explicit v_reg(const _Tp* ptr) { for( int i = 0; i < n; i++ ) s[i] = ptr[i]; }
+
+    /** @brief Constructor
+
+    Initializes register with two 64-bit values */
+    v_reg(_Tp s0, _Tp s1) { s[0] = s0; s[1] = s1; }
+
+    /** @brief Constructor
+
+    Initializes register with four 32-bit values */
+    v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3) { s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3; }
+
+    /** @brief Constructor
+
+    Initializes register with eight 16-bit values */
+    v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3,
+           _Tp s4, _Tp s5, _Tp s6, _Tp s7)
+    {
+        s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3;
+        s[4] = s4; s[5] = s5; s[6] = s6; s[7] = s7;
+    }
+
+    /** @brief Constructor
+
+    Initializes register with sixteen 8-bit values */
+    v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3,
+           _Tp s4, _Tp s5, _Tp s6, _Tp s7,
+           _Tp s8, _Tp s9, _Tp s10, _Tp s11,
+           _Tp s12, _Tp s13, _Tp s14, _Tp s15)
+    {
+        s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3;
+        s[4] = s4; s[5] = s5; s[6] = s6; s[7] = s7;
+        s[8] = s8; s[9] = s9; s[10] = s10; s[11] = s11;
+        s[12] = s12; s[13] = s13; s[14] = s14; s[15] = s15;
+    }
+
+    /** @brief Default constructor
+
+    Does not initialize anything*/
+    v_reg() {}
+
+    /** @brief Copy constructor */
+    v_reg(const v_reg<_Tp, n> & r)
+    {
+        for( int i = 0; i < n; i++ )
+            s[i] = r.s[i];
+    }
+    /** @brief Access first value
+
+    Returns value of the first lane according to register type, for example:
+    @code{.cpp}
+    v_int32x4 r(1, 2, 3, 4);
+    int v = r.get0(); // returns 1
+    v_uint64x2 r(1, 2);
+    uint64_t v = r.get0(); // returns 1
+    @endcode
+    */
+    _Tp get0() const { return s[0]; }
+
+//! @cond IGNORED
+    _Tp get(const int i) const { return s[i]; }
+    v_reg<_Tp, n> high() const
+    {
+        v_reg<_Tp, n> c;
+        int i;
+        for( i = 0; i < n/2; i++ )
+        {
+            c.s[i] = s[i+(n/2)];
+            c.s[i+(n/2)] = 0;
+        }
+        return c;
+    }
+
+    static v_reg<_Tp, n> zero()
+    {
+        v_reg<_Tp, n> c;
+        for( int i = 0; i < n; i++ )
+            c.s[i] = (_Tp)0;
+        return c;
+    }
+
+    static v_reg<_Tp, n> all(_Tp s)
+    {
+        v_reg<_Tp, n> c;
+        for( int i = 0; i < n; i++ )
+            c.s[i] = s;
+        return c;
+    }
+
+    template<typename _Tp2, int n2> v_reg<_Tp2, n2> reinterpret_as() const
+    {
+        size_t bytes = std::min(sizeof(_Tp2)*n2, sizeof(_Tp)*n);
+        v_reg<_Tp2, n2> c;
+        std::memcpy(&c.s[0], &s[0], bytes);
+        return c;
+    }
+
+    _Tp s[n];
+//! @endcond
+};
+
+/** @brief Sixteen 8-bit unsigned integer values */
+typedef v_reg<uchar, 16> v_uint8x16;
+/** @brief Sixteen 8-bit signed integer values */
+typedef v_reg<schar, 16> v_int8x16;
+/** @brief Eight 16-bit unsigned integer values */
+typedef v_reg<ushort, 8> v_uint16x8;
+/** @brief Eight 16-bit signed integer values */
+typedef v_reg<short, 8> v_int16x8;
+/** @brief Four 32-bit unsigned integer values */
+typedef v_reg<unsigned, 4> v_uint32x4;
+/** @brief Four 32-bit signed integer values */
+typedef v_reg<int, 4> v_int32x4;
+/** @brief Four 32-bit floating point values (single precision) */
+typedef v_reg<float, 4> v_float32x4;
+/** @brief Two 64-bit floating point values (double precision) */
+typedef v_reg<double, 2> v_float64x2;
+/** @brief Two 64-bit unsigned integer values */
+typedef v_reg<uint64, 2> v_uint64x2;
+/** @brief Two 64-bit signed integer values */
+typedef v_reg<int64, 2> v_int64x2;
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_BIN_OP(bin_op) \
+template<typename _Tp, int n> inline v_reg<_Tp, n> \
+    operator bin_op (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    v_reg<_Tp, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = saturate_cast<_Tp>(a.s[i] bin_op b.s[i]); \
+    return c; \
+} \
+template<typename _Tp, int n> inline v_reg<_Tp, n>& \
+    operator bin_op##= (v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    for( int i = 0; i < n; i++ ) \
+        a.s[i] = saturate_cast<_Tp>(a.s[i] bin_op b.s[i]); \
+    return a; \
+}
+
+/** @brief Add values
+
+For all types. */
+OPENCV_HAL_IMPL_BIN_OP(+)
+
+/** @brief Subtract values
+
+For all types. */
+OPENCV_HAL_IMPL_BIN_OP(-)
+
+/** @brief Multiply values
+
+For 16- and 32-bit integer types and floating types. */
+OPENCV_HAL_IMPL_BIN_OP(*)
+
+/** @brief Divide values
+
+For floating types only. */
+OPENCV_HAL_IMPL_BIN_OP(/)
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_BIT_OP(bit_op) \
+template<typename _Tp, int n> inline v_reg<_Tp, n> operator bit_op \
+    (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    v_reg<_Tp, n> c; \
+    typedef typename V_TypeTraits<_Tp>::int_type itype; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)(V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) bit_op \
+                                                        V_TypeTraits<_Tp>::reinterpret_int(b.s[i]))); \
+    return c; \
+} \
+template<typename _Tp, int n> inline v_reg<_Tp, n>& operator \
+    bit_op##= (v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    typedef typename V_TypeTraits<_Tp>::int_type itype; \
+    for( int i = 0; i < n; i++ ) \
+        a.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)(V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) bit_op \
+                                                        V_TypeTraits<_Tp>::reinterpret_int(b.s[i]))); \
+    return a; \
+}
+
+/** @brief Bitwise AND
+
+Only for integer types. */
+OPENCV_HAL_IMPL_BIT_OP(&)
+
+/** @brief Bitwise OR
+
+Only for integer types. */
+OPENCV_HAL_IMPL_BIT_OP(|)
+
+/** @brief Bitwise XOR
+
+Only for integer types.*/
+OPENCV_HAL_IMPL_BIT_OP(^)
+
+/** @brief Bitwise NOT
+
+Only for integer types.*/
+template<typename _Tp, int n> inline v_reg<_Tp, n> operator ~ (const v_reg<_Tp, n>& a)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int(~V_TypeTraits<_Tp>::reinterpret_int(a.s[i]));
+        return c;
+}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_MATH_FUNC(func, cfunc, _Tp2) \
+template<typename _Tp, int n> inline v_reg<_Tp2, n> func(const v_reg<_Tp, n>& a) \
+{ \
+    v_reg<_Tp2, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = cfunc(a.s[i]); \
+    return c; \
+}
+
+/** @brief Square root of elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_sqrt, std::sqrt, _Tp)
+
+//! @cond IGNORED
+OPENCV_HAL_IMPL_MATH_FUNC(v_sin, std::sin, _Tp)
+OPENCV_HAL_IMPL_MATH_FUNC(v_cos, std::cos, _Tp)
+OPENCV_HAL_IMPL_MATH_FUNC(v_exp, std::exp, _Tp)
+OPENCV_HAL_IMPL_MATH_FUNC(v_log, std::log, _Tp)
+//! @endcond
+
+/** @brief Absolute value of elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_abs, (typename V_TypeTraits<_Tp>::abs_type)std::abs,
+                          typename V_TypeTraits<_Tp>::abs_type)
+
+/** @brief Round elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_round, cvRound, int)
+
+/** @brief Floor elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_floor, cvFloor, int)
+
+/** @brief Ceil elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_ceil, cvCeil, int)
+
+/** @brief Truncate elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_trunc, int, int)
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_MINMAX_FUNC(func, cfunc) \
+template<typename _Tp, int n> inline v_reg<_Tp, n> func(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    v_reg<_Tp, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = cfunc(a.s[i], b.s[i]); \
+    return c; \
+}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(func, cfunc) \
+template<typename _Tp, int n> inline _Tp func(const v_reg<_Tp, n>& a) \
+{ \
+    _Tp c = a.s[0]; \
+    for( int i = 1; i < n; i++ ) \
+        c = cfunc(c, a.s[i]); \
+    return c; \
+}
+
+/** @brief Choose min values for each pair
+
+Scheme:
+@code
+{A1 A2 ...}
+{B1 B2 ...}
+--------------
+{min(A1,B1) min(A2,B2) ...}
+@endcode
+For all types except 64-bit integer. */
+OPENCV_HAL_IMPL_MINMAX_FUNC(v_min, std::min)
+
+/** @brief Choose max values for each pair
+
+Scheme:
+@code
+{A1 A2 ...}
+{B1 B2 ...}
+--------------
+{max(A1,B1) max(A2,B2) ...}
+@endcode
+For all types except 64-bit integer. */
+OPENCV_HAL_IMPL_MINMAX_FUNC(v_max, std::max)
+
+/** @brief Find one min value
+
+Scheme:
+@code
+{A1 A2 A3 ...} => min(A1,A2,A3,...)
+@endcode
+For 32-bit integer and 32-bit floating point types. */
+OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(v_reduce_min, std::min)
+
+/** @brief Find one max value
+
+Scheme:
+@code
+{A1 A2 A3 ...} => max(A1,A2,A3,...)
+@endcode
+For 32-bit integer and 32-bit floating point types. */
+OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(v_reduce_max, std::max)
+
+//! @cond IGNORED
+template<typename _Tp, int n>
+inline void v_minmax( const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
+                      v_reg<_Tp, n>& minval, v_reg<_Tp, n>& maxval )
+{
+    for( int i = 0; i < n; i++ )
+    {
+        minval.s[i] = std::min(a.s[i], b.s[i]);
+        maxval.s[i] = std::max(a.s[i], b.s[i]);
+    }
+}
+//! @endcond
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_CMP_OP(cmp_op) \
+template<typename _Tp, int n> \
+inline v_reg<_Tp, n> operator cmp_op(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    typedef typename V_TypeTraits<_Tp>::int_type itype; \
+    v_reg<_Tp, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)-(int)(a.s[i] cmp_op b.s[i])); \
+    return c; \
+}
+
+/** @brief Less-than comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(<)
+
+/** @brief Greater-than comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(>)
+
+/** @brief Less-than or equal comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(<=)
+
+/** @brief Greater-than or equal comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(>=)
+
+/** @brief Equal comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(==)
+
+/** @brief Not equal comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(!=)
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_ADD_SUB_OP(func, bin_op, cast_op, _Tp2) \
+template<typename _Tp, int n> \
+inline v_reg<_Tp2, n> func(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    typedef _Tp2 rtype; \
+    v_reg<rtype, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = cast_op(a.s[i] bin_op b.s[i]); \
+    return c; \
+}
+
+/** @brief Add values without saturation
+
+For 8- and 16-bit integer values. */
+OPENCV_HAL_IMPL_ADD_SUB_OP(v_add_wrap, +, (_Tp), _Tp)
+
+/** @brief Subtract values without saturation
+
+For 8- and 16-bit integer values. */
+OPENCV_HAL_IMPL_ADD_SUB_OP(v_sub_wrap, -, (_Tp), _Tp)
+
+//! @cond IGNORED
+template<typename T> inline T _absdiff(T a, T b)
+{
+    return a > b ? a - b : b - a;
+}
+//! @endcond
+
+/** @brief Absolute difference
+
+Returns \f$ |a - b| \f$ converted to corresponding unsigned type.
+Example:
+@code{.cpp}
+v_int32x4 a, b; // {1, 2, 3, 4} and {4, 3, 2, 1}
+v_uint32x4 c = v_absdiff(a, b); // result is {3, 1, 1, 3}
+@endcode
+For 8-, 16-, 32-bit integer source types. */
+template<typename _Tp, int n>
+inline v_reg<typename V_TypeTraits<_Tp>::abs_type, n> v_absdiff(const v_reg<_Tp, n>& a, const v_reg<_Tp, n> & b)
+{
+    typedef typename V_TypeTraits<_Tp>::abs_type rtype;
+    v_reg<rtype, n> c;
+    const rtype mask = std::numeric_limits<_Tp>::is_signed ? (1 << (sizeof(rtype)*8 - 1)) : 0;
+    for( int i = 0; i < n; i++ )
+    {
+        rtype ua = a.s[i] ^ mask;
+        rtype ub = b.s[i] ^ mask;
+        c.s[i] = _absdiff(ua, ub);
+    }
+    return c;
+}
+
+/** @overload
+
+For 32-bit floating point values */
+inline v_float32x4 v_absdiff(const v_float32x4& a, const v_float32x4& b)
+{
+    v_float32x4 c;
+    for( int i = 0; i < c.nlanes; i++ )
+        c.s[i] = _absdiff(a.s[i], b.s[i]);
+    return c;
+}
+
+/** @overload
+
+For 64-bit floating point values */
+inline v_float64x2 v_absdiff(const v_float64x2& a, const v_float64x2& b)
+{
+    v_float64x2 c;
+    for( int i = 0; i < c.nlanes; i++ )
+        c.s[i] = _absdiff(a.s[i], b.s[i]);
+    return c;
+}
+
+/** @brief Inversed square root
+
+Returns \f$ 1/sqrt(a) \f$
+For floating point types only. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_invsqrt(const v_reg<_Tp, n>& a)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = 1.f/std::sqrt(a.s[i]);
+    return c;
+}
+
+/** @brief Magnitude
+
+Returns \f$ sqrt(a^2 + b^2) \f$
+For floating point types only. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_magnitude(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = std::sqrt(a.s[i]*a.s[i] + b.s[i]*b.s[i]);
+    return c;
+}
+
+/** @brief Square of the magnitude
+
+Returns \f$ a^2 + b^2 \f$
+For floating point types only. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_sqr_magnitude(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = a.s[i]*a.s[i] + b.s[i]*b.s[i];
+    return c;
+}
+
+/** @brief Multiply and add
+
+Returns \f$ a*b + c \f$
+For floating point types only. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_muladd(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
+                              const v_reg<_Tp, n>& c)
+{
+    v_reg<_Tp, n> d;
+    for( int i = 0; i < n; i++ )
+        d.s[i] = a.s[i]*b.s[i] + c.s[i];
+    return d;
+}
+
+/** @brief Dot product of elements
+
+Multiply values in two registers and sum adjacent result pairs.
+Scheme:
+@code
+  {A1 A2 ...} // 16-bit
+x {B1 B2 ...} // 16-bit
+-------------
+{A1B1+A2B2 ...} // 32-bit
+@endcode
+Implemented only for 16-bit signed source type (v_int16x8).
+*/
+template<typename _Tp, int n> inline v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>
+    v_dotprod(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    typedef typename V_TypeTraits<_Tp>::w_type w_type;
+    v_reg<w_type, n/2> c;
+    for( int i = 0; i < (n/2); i++ )
+        c.s[i] = (w_type)a.s[i*2]*b.s[i*2] + (w_type)a.s[i*2+1]*b.s[i*2+1];
+    return c;
+}
+
+/** @brief Multiply and expand
+
+Multiply values two registers and store results in two registers with wider pack type.
+Scheme:
+@code
+  {A B C D} // 32-bit
+x {E F G H} // 32-bit
+---------------
+{AE BF}         // 64-bit
+        {CG DH} // 64-bit
+@endcode
+Example:
+@code{.cpp}
+v_uint32x4 a, b; // {1,2,3,4} and {2,2,2,2}
+v_uint64x2 c, d; // results
+v_mul_expand(a, b, c, d); // c, d = {2,4}, {6, 8}
+@endcode
+Implemented only for 16- and unsigned 32-bit source types (v_int16x8, v_uint16x8, v_uint32x4).
+*/
+template<typename _Tp, int n> inline void v_mul_expand(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
+                                                       v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& c,
+                                                       v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& d)
+{
+    typedef typename V_TypeTraits<_Tp>::w_type w_type;
+    for( int i = 0; i < (n/2); i++ )
+    {
+        c.s[i] = (w_type)a.s[i]*b.s[i];
+        d.s[i] = (w_type)a.s[i+(n/2)]*b.s[i+(n/2)];
+    }
+}
+
+//! @cond IGNORED
+template<typename _Tp, int n> inline void v_hsum(const v_reg<_Tp, n>& a,
+                                                 v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& c)
+{
+    typedef typename V_TypeTraits<_Tp>::w_type w_type;
+    for( int i = 0; i < (n/2); i++ )
+    {
+        c.s[i] = (w_type)a.s[i*2] + a.s[i*2+1];
+    }
+}
+//! @endcond
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_SHIFT_OP(shift_op) \
+template<typename _Tp, int n> inline v_reg<_Tp, n> operator shift_op(const v_reg<_Tp, n>& a, int imm) \
+{ \
+    v_reg<_Tp, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = (_Tp)(a.s[i] shift_op imm); \
+    return c; \
+}
+
+/** @brief Bitwise shift left
+
+For 16-, 32- and 64-bit integer values. */
+OPENCV_HAL_IMPL_SHIFT_OP(<<)
+
+/** @brief Bitwise shift right
+
+For 16-, 32- and 64-bit integer values. */
+OPENCV_HAL_IMPL_SHIFT_OP(>>)
+
+/** @brief Sum packed values
+
+Scheme:
+@code
+{A1 A2 A3 ...} => sum{A1,A2,A3,...}
+@endcode
+For 32-bit integer and 32-bit floating point types.*/
+template<typename _Tp, int n> inline typename V_TypeTraits<_Tp>::sum_type v_reduce_sum(const v_reg<_Tp, n>& a)
+{
+    typename V_TypeTraits<_Tp>::sum_type c = a.s[0];
+    for( int i = 1; i < n; i++ )
+        c += a.s[i];
+    return c;
+}
+
+/** @brief Get negative values mask
+
+Returned value is a bit mask with bits set to 1 on places corresponding to negative packed values indexes.
+Example:
+@code{.cpp}
+v_int32x4 r; // set to {-1, -1, 1, 1}
+int mask = v_signmask(r); // mask = 3 <== 00000000 00000000 00000000 00000011
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n> inline int v_signmask(const v_reg<_Tp, n>& a)
+{
+    int mask = 0;
+    for( int i = 0; i < n; i++ )
+        mask |= (V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) < 0) << i;
+    return mask;
+}
+
+/** @brief Check if all packed values are less than zero
+
+Unsigned values will be casted to signed: `uchar 254 => char -2`.
+For all types except 64-bit. */
+template<typename _Tp, int n> inline bool v_check_all(const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < n; i++ )
+        if( V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) >= 0 )
+            return false;
+    return true;
+}
+
+/** @brief Check if any of packed values is less than zero
+
+Unsigned values will be casted to signed: `uchar 254 => char -2`.
+For all types except 64-bit. */
+template<typename _Tp, int n> inline bool v_check_any(const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < n; i++ )
+        if( V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) < 0 )
+            return true;
+    return false;
+}
+
+/** @brief Bitwise select
+
+Return value will be built by combining values a and b using the following scheme:
+If the i-th bit in _mask_ is 1
+    select i-th bit from _a_
+else
+    select i-th bit from _b_ */
+template<typename _Tp, int n> inline v_reg<_Tp, n> v_select(const v_reg<_Tp, n>& mask,
+                                                           const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    typedef V_TypeTraits<_Tp> Traits;
+    typedef typename Traits::int_type int_type;
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+    {
+        int_type m = Traits::reinterpret_int(mask.s[i]);
+        c.s[i] =  Traits::reinterpret_from_int((Traits::reinterpret_int(a.s[i]) & m)
+                                             | (Traits::reinterpret_int(b.s[i]) & ~m));
+    }
+    return c;
+}
+
+/** @brief Expand values to the wider pack type
+
+Copy contents of register to two registers with 2x wider pack type.
+Scheme:
+@code
+ int32x4     int64x2 int64x2
+{A B C D} ==> {A B} , {C D}
+@endcode */
+template<typename _Tp, int n> inline void v_expand(const v_reg<_Tp, n>& a,
+                            v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& b0,
+                            v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& b1)
+{
+    for( int i = 0; i < (n/2); i++ )
+    {
+        b0.s[i] = a.s[i];
+        b1.s[i] = a.s[i+(n/2)];
+    }
+}
+
+//! @cond IGNORED
+template<typename _Tp, int n> inline v_reg<typename V_TypeTraits<_Tp>::int_type, n>
+    v_reinterpret_as_int(const v_reg<_Tp, n>& a)
+{
+    v_reg<typename V_TypeTraits<_Tp>::int_type, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_int(a.s[i]);
+    return c;
+}
+
+template<typename _Tp, int n> inline v_reg<typename V_TypeTraits<_Tp>::uint_type, n>
+    v_reinterpret_as_uint(const v_reg<_Tp, n>& a)
+{
+    v_reg<typename V_TypeTraits<_Tp>::uint_type, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_uint(a.s[i]);
+    return c;
+}
+//! @endcond
+
+/** @brief Interleave two vectors
+
+Scheme:
+@code
+  {A1 A2 A3 A4}
+  {B1 B2 B3 B4}
+---------------
+  {A1 B1 A2 B2} and {A3 B3 A4 B4}
+@endcode
+For all types except 64-bit.
+*/
+template<typename _Tp, int n> inline void v_zip( const v_reg<_Tp, n>& a0, const v_reg<_Tp, n>& a1,
+                                               v_reg<_Tp, n>& b0, v_reg<_Tp, n>& b1 )
+{
+    int i;
+    for( i = 0; i < n/2; i++ )
+    {
+        b0.s[i*2] = a0.s[i];
+        b0.s[i*2+1] = a1.s[i];
+    }
+    for( ; i < n; i++ )
+    {
+        b1.s[i*2-n] = a0.s[i];
+        b1.s[i*2-n+1] = a1.s[i];
+    }
+}
+
+/** @brief Load register contents from memory
+
+@param ptr pointer to memory block with data
+@return register object
+
+@note Returned type will be detected from passed pointer type, for example uchar ==> cv::v_uint8x16, int ==> cv::v_int32x4, etc.
+ */
+template<typename _Tp>
+inline v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes> v_load(const _Tp* ptr)
+{
+    return v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes>(ptr);
+}
+
+/** @brief Load register contents from memory (aligned)
+
+similar to cv::v_load, but source memory block should be aligned (to 16-byte boundary)
+ */
+template<typename _Tp>
+inline v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes> v_load_aligned(const _Tp* ptr)
+{
+    return v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes>(ptr);
+}
+
+/** @brief Load register contents from two memory blocks
+
+@param loptr memory block containing data for first half (0..n/2)
+@param hiptr memory block containing data for second half (n/2..n)
+
+@code{.cpp}
+int lo[2] = { 1, 2 }, hi[2] = { 3, 4 };
+v_int32x4 r = v_load_halves(lo, hi);
+@endcode
+ */
+template<typename _Tp>
+inline v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes> v_load_halves(const _Tp* loptr, const _Tp* hiptr)
+{
+    v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes> c;
+    for( int i = 0; i < c.nlanes/2; i++ )
+    {
+        c.s[i] = loptr[i];
+        c.s[i+c.nlanes/2] = hiptr[i];
+    }
+    return c;
+}
+
+/** @brief Load register contents from memory with double expand
+
+Same as cv::v_load, but result pack type will be 2x wider than memory type.
+
+@code{.cpp}
+short buf[4] = {1, 2, 3, 4}; // type is int16
+v_int32x4 r = v_load_expand(buf); // r = {1, 2, 3, 4} - type is int32
+@endcode
+For 8-, 16-, 32-bit integer source types. */
+template<typename _Tp>
+inline v_reg<typename V_TypeTraits<_Tp>::w_type, V_SIMD128Traits<_Tp>::nlanes / 2>
+v_load_expand(const _Tp* ptr)
+{
+    typedef typename V_TypeTraits<_Tp>::w_type w_type;
+    v_reg<w_type, V_SIMD128Traits<w_type>::nlanes> c;
+    for( int i = 0; i < c.nlanes; i++ )
+    {
+        c.s[i] = ptr[i];
+    }
+    return c;
+}
+
+/** @brief Load register contents from memory with quad expand
+
+Same as cv::v_load_expand, but result type is 4 times wider than source.
+@code{.cpp}
+char buf[4] = {1, 2, 3, 4}; // type is int8
+v_int32x4 r = v_load_q(buf); // r = {1, 2, 3, 4} - type is int32
+@endcode
+For 8-bit integer source types. */
+template<typename _Tp>
+inline v_reg<typename V_TypeTraits<_Tp>::q_type, V_SIMD128Traits<_Tp>::nlanes / 4>
+v_load_expand_q(const _Tp* ptr)
+{
+    typedef typename V_TypeTraits<_Tp>::q_type q_type;
+    v_reg<q_type, V_SIMD128Traits<q_type>::nlanes> c;
+    for( int i = 0; i < c.nlanes; i++ )
+    {
+        c.s[i] = ptr[i];
+    }
+    return c;
+}
+
+/** @brief Load and deinterleave (4 channels)
+
+Load data from memory deinterleave and store to 4 registers.
+Scheme:
+@code
+{A1 B1 C1 D1 A2 B2 C2 D2 ...} ==> {A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n> inline void v_load_deinterleave(const _Tp* ptr, v_reg<_Tp, n>& a,
+                                                            v_reg<_Tp, n>& b, v_reg<_Tp, n>& c)
+{
+    int i, i3;
+    for( i = i3 = 0; i < n; i++, i3 += 3 )
+    {
+        a.s[i] = ptr[i3];
+        b.s[i] = ptr[i3+1];
+        c.s[i] = ptr[i3+2];
+    }
+}
+
+/** @brief Load and deinterleave (3 channels)
+
+Load data from memory deinterleave and store to 3 registers.
+Scheme:
+@code
+{A1 B1 C1 A2 B2 C2 ...} ==> {A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n>
+inline void v_load_deinterleave(const _Tp* ptr, v_reg<_Tp, n>& a,
+                                v_reg<_Tp, n>& b, v_reg<_Tp, n>& c,
+                                v_reg<_Tp, n>& d)
+{
+    int i, i4;
+    for( i = i4 = 0; i < n; i++, i4 += 4 )
+    {
+        a.s[i] = ptr[i4];
+        b.s[i] = ptr[i4+1];
+        c.s[i] = ptr[i4+2];
+        d.s[i] = ptr[i4+3];
+    }
+}
+
+/** @brief Interleave and store (3 channels)
+
+Interleave and store data from 3 registers to memory.
+Scheme:
+@code
+{A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...} ==> {A1 B1 C1 D1 A2 B2 C2 D2 ...}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n>
+inline void v_store_interleave( _Tp* ptr, const v_reg<_Tp, n>& a,
+                                const v_reg<_Tp, n>& b, const v_reg<_Tp, n>& c)
+{
+    int i, i3;
+    for( i = i3 = 0; i < n; i++, i3 += 3 )
+    {
+        ptr[i3] = a.s[i];
+        ptr[i3+1] = b.s[i];
+        ptr[i3+2] = c.s[i];
+    }
+}
+
+/** @brief Interleave and store (4 channels)
+
+Interleave and store data from 4 registers to memory.
+Scheme:
+@code
+{A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...} ==> {A1 B1 C1 D1 A2 B2 C2 D2 ...}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n> inline void v_store_interleave( _Tp* ptr, const v_reg<_Tp, n>& a,
+                                                            const v_reg<_Tp, n>& b, const v_reg<_Tp, n>& c,
+                                                            const v_reg<_Tp, n>& d)
+{
+    int i, i4;
+    for( i = i4 = 0; i < n; i++, i4 += 4 )
+    {
+        ptr[i4] = a.s[i];
+        ptr[i4+1] = b.s[i];
+        ptr[i4+2] = c.s[i];
+        ptr[i4+3] = d.s[i];
+    }
+}
+
+/** @brief Store data to memory
+
+Store register contents to memory.
+Scheme:
+@code
+  REG {A B C D} ==> MEM {A B C D}
+@endcode
+Pointer can be unaligned. */
+template<typename _Tp, int n>
+inline void v_store(_Tp* ptr, const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < n; i++ )
+        ptr[i] = a.s[i];
+}
+
+/** @brief Store data to memory (lower half)
+
+Store lower half of register contents to memory.
+Scheme:
+@code
+  REG {A B C D} ==> MEM {A B}
+@endcode */
+template<typename _Tp, int n>
+inline void v_store_low(_Tp* ptr, const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < (n/2); i++ )
+        ptr[i] = a.s[i];
+}
+
+/** @brief Store data to memory (higher half)
+
+Store higher half of register contents to memory.
+Scheme:
+@code
+  REG {A B C D} ==> MEM {C D}
+@endcode */
+template<typename _Tp, int n>
+inline void v_store_high(_Tp* ptr, const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < (n/2); i++ )
+        ptr[i] = a.s[i+(n/2)];
+}
+
+/** @brief Store data to memory (aligned)
+
+Store register contents to memory.
+Scheme:
+@code
+  REG {A B C D} ==> MEM {A B C D}
+@endcode
+Pointer __should__ be aligned by 16-byte boundary. */
+template<typename _Tp, int n>
+inline void v_store_aligned(_Tp* ptr, const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < n; i++ )
+        ptr[i] = a.s[i];
+}
+
+/** @brief Combine vector from first elements of two vectors
+
+Scheme:
+@code
+  {A1 A2 A3 A4}
+  {B1 B2 B3 B4}
+---------------
+  {A1 A2 B1 B2}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_combine_low(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < (n/2); i++ )
+    {
+        c.s[i] = a.s[i];
+        c.s[i+(n/2)] = b.s[i];
+    }
+    return c;
+}
+
+/** @brief Combine vector from last elements of two vectors
+
+Scheme:
+@code
+  {A1 A2 A3 A4}
+  {B1 B2 B3 B4}
+---------------
+  {A3 A4 B3 B4}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_combine_high(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < (n/2); i++ )
+    {
+        c.s[i] = a.s[i+(n/2)];
+        c.s[i+(n/2)] = b.s[i+(n/2)];
+    }
+    return c;
+}
+
+/** @brief Combine two vectors from lower and higher parts of two other vectors
+
+@code{.cpp}
+low = cv::v_combine_low(a, b);
+high = cv::v_combine_high(a, b);
+@endcode */
+template<typename _Tp, int n>
+inline void v_recombine(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
+                        v_reg<_Tp, n>& low, v_reg<_Tp, n>& high)
+{
+    for( int i = 0; i < (n/2); i++ )
+    {
+        low.s[i] = a.s[i];
+        low.s[i+(n/2)] = b.s[i];
+        high.s[i] = a.s[i+(n/2)];
+        high.s[i+(n/2)] = b.s[i+(n/2)];
+    }
+}
+
+/** @brief Vector extract
+
+Scheme:
+@code
+  {A1 A2 A3 A4}
+  {B1 B2 B3 B4}
+========================
+shift = 1  {A2 A3 A4 B1}
+shift = 2  {A3 A4 B1 B2}
+shift = 3  {A4 B1 B2 B3}
+@endcode
+Restriction: 0 <= shift < nlanes
+
+Usage:
+@code
+v_int32x4 a, b, c;
+c = v_extract<2>(a, b);
+@endcode
+For integer types only. */
+template<int s, typename _Tp, int n>
+inline v_reg<_Tp, n> v_extract(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> r;
+    const int shift = n - s;
+    int i = 0;
+    for (; i < shift; ++i)
+        r.s[i] = a.s[i+s];
+    for (; i < n; ++i)
+        r.s[i] = b.s[i-shift];
+    return r;
+}
+
+/** @brief Round
+
+Rounds each value. Input type is float vector ==> output type is int vector.*/
+template<int n> inline v_reg<int, n> v_round(const v_reg<float, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = cvRound(a.s[i]);
+    return c;
+}
+
+/** @brief Floor
+
+Floor each value. Input type is float vector ==> output type is int vector.*/
+template<int n> inline v_reg<int, n> v_floor(const v_reg<float, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = cvFloor(a.s[i]);
+    return c;
+}
+
+/** @brief Ceil
+
+Ceil each value. Input type is float vector ==> output type is int vector.*/
+template<int n> inline v_reg<int, n> v_ceil(const v_reg<float, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = cvCeil(a.s[i]);
+    return c;
+}
+
+/** @brief Trunc
+
+Truncate each value. Input type is float vector ==> output type is int vector.*/
+template<int n> inline v_reg<int, n> v_trunc(const v_reg<float, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = (int)(a.s[i]);
+    return c;
+}
+
+/** @overload */
+template<int n> inline v_reg<int, n*2> v_round(const v_reg<double, n>& a)
+{
+    v_reg<int, n*2> c;
+    for( int i = 0; i < n; i++ )
+    {
+        c.s[i] = cvRound(a.s[i]);
+        c.s[i+n] = 0;
+    }
+    return c;
+}
+
+/** @overload */
+template<int n> inline v_reg<int, n*2> v_floor(const v_reg<double, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+    {
+        c.s[i] = cvFloor(a.s[i]);
+        c.s[i+n] = 0;
+    }
+    return c;
+}
+
+/** @overload */
+template<int n> inline v_reg<int, n*2> v_ceil(const v_reg<double, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+    {
+        c.s[i] = cvCeil(a.s[i]);
+        c.s[i+n] = 0;
+    }
+    return c;
+}
+
+/** @overload */
+template<int n> inline v_reg<int, n*2> v_trunc(const v_reg<double, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+    {
+        c.s[i] = cvCeil(a.s[i]);
+        c.s[i+n] = 0;
+    }
+    return c;
+}
+
+/** @brief Convert to float
+
+Supported input type is cv::v_int32x4. */
+template<int n> inline v_reg<float, n> v_cvt_f32(const v_reg<int, n>& a)
+{
+    v_reg<float, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = (float)a.s[i];
+    return c;
+}
+
+/** @brief Convert to double
+
+Supported input type is cv::v_int32x4. */
+template<int n> inline v_reg<double, n> v_cvt_f64(const v_reg<int, n*2>& a)
+{
+    v_reg<double, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = (double)a.s[i];
+    return c;
+}
+
+/** @brief Convert to double
+
+Supported input type is cv::v_float32x4. */
+template<int n> inline v_reg<double, n> v_cvt_f64(const v_reg<float, n*2>& a)
+{
+    v_reg<double, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = (double)a.s[i];
+    return c;
+}
+
+/** @brief Transpose 4x4 matrix
+
+Scheme:
+@code
+a0  {A1 A2 A3 A4}
+a1  {B1 B2 B3 B4}
+a2  {C1 C2 C3 C4}
+a3  {D1 D2 D3 D4}
+===============
+b0  {A1 B1 C1 D1}
+b1  {A2 B2 C2 D2}
+b2  {A3 B3 C3 D3}
+b3  {A4 B4 C4 D4}
+@endcode
+*/
+template<typename _Tp>
+inline void v_transpose4x4( v_reg<_Tp, 4>& a0, const v_reg<_Tp, 4>& a1,
+                            const v_reg<_Tp, 4>& a2, const v_reg<_Tp, 4>& a3,
+                            v_reg<_Tp, 4>& b0, v_reg<_Tp, 4>& b1,
+                            v_reg<_Tp, 4>& b2, v_reg<_Tp, 4>& b3 )
+{
+    b0 = v_reg<_Tp, 4>(a0.s[0], a1.s[0], a2.s[0], a3.s[0]);
+    b1 = v_reg<_Tp, 4>(a0.s[1], a1.s[1], a2.s[1], a3.s[1]);
+    b2 = v_reg<_Tp, 4>(a0.s[2], a1.s[2], a2.s[2], a3.s[2]);
+    b3 = v_reg<_Tp, 4>(a0.s[3], a1.s[3], a2.s[3], a3.s[3]);
+}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_INIT_ZERO(_Tpvec, _Tp, suffix) \
+inline _Tpvec v_setzero_##suffix() { return _Tpvec::zero(); }
+
+//! @name Init with zero
+//! @{
+//! @brief Create new vector with zero elements
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_int8x16, schar, s8)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_int16x8, short, s16)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_int32x4, int, s32)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_float32x4, float, f32)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_float64x2, double, f64)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_int64x2, int64, s64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_INIT_VAL(_Tpvec, _Tp, suffix) \
+inline _Tpvec v_setall_##suffix(_Tp val) { return _Tpvec::all(val); }
+
+//! @name Init with value
+//! @{
+//! @brief Create new vector with elements set to a specific value
+OPENCV_HAL_IMPL_C_INIT_VAL(v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_int8x16, schar, s8)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_int16x8, short, s16)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_int32x4, int, s32)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_float32x4, float, f32)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_float64x2, double, f64)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_int64x2, int64, s64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_REINTERPRET(_Tpvec, _Tp, suffix) \
+template<typename _Tp0, int n0> inline _Tpvec \
+    v_reinterpret_as_##suffix(const v_reg<_Tp0, n0>& a) \
+{ return a.template reinterpret_as<_Tp, _Tpvec::nlanes>(); }
+
+//! @name Reinterpret
+//! @{
+//! @brief Convert vector to different type without modifying underlying data.
+OPENCV_HAL_IMPL_C_REINTERPRET(v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_int8x16, schar, s8)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_int16x8, short, s16)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_int32x4, int, s32)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_float32x4, float, f32)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_float64x2, double, f64)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_int64x2, int64, s64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_SHIFTL(_Tpvec, _Tp) \
+template<int n> inline _Tpvec v_shl(const _Tpvec& a) \
+{ return a << n; }
+
+//! @name Left shift
+//! @{
+//! @brief Shift left
+OPENCV_HAL_IMPL_C_SHIFTL(v_uint16x8, ushort)
+OPENCV_HAL_IMPL_C_SHIFTL(v_int16x8, short)
+OPENCV_HAL_IMPL_C_SHIFTL(v_uint32x4, unsigned)
+OPENCV_HAL_IMPL_C_SHIFTL(v_int32x4, int)
+OPENCV_HAL_IMPL_C_SHIFTL(v_uint64x2, uint64)
+OPENCV_HAL_IMPL_C_SHIFTL(v_int64x2, int64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_SHIFTR(_Tpvec, _Tp) \
+template<int n> inline _Tpvec v_shr(const _Tpvec& a) \
+{ return a >> n; }
+
+//! @name Right shift
+//! @{
+//! @brief Shift right
+OPENCV_HAL_IMPL_C_SHIFTR(v_uint16x8, ushort)
+OPENCV_HAL_IMPL_C_SHIFTR(v_int16x8, short)
+OPENCV_HAL_IMPL_C_SHIFTR(v_uint32x4, unsigned)
+OPENCV_HAL_IMPL_C_SHIFTR(v_int32x4, int)
+OPENCV_HAL_IMPL_C_SHIFTR(v_uint64x2, uint64)
+OPENCV_HAL_IMPL_C_SHIFTR(v_int64x2, int64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_RSHIFTR(_Tpvec, _Tp) \
+template<int n> inline _Tpvec v_rshr(const _Tpvec& a) \
+{ \
+    _Tpvec c; \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+        c.s[i] = (_Tp)((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \
+    return c; \
+}
+
+//! @name Rounding shift
+//! @{
+//! @brief Rounding shift right
+OPENCV_HAL_IMPL_C_RSHIFTR(v_uint16x8, ushort)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_int16x8, short)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_uint32x4, unsigned)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_int32x4, int)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_uint64x2, uint64)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_int64x2, int64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_PACK(_Tpvec, _Tpnvec, _Tpn, pack_suffix) \
+inline _Tpnvec v_##pack_suffix(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpnvec c; \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+    { \
+        c.s[i] = saturate_cast<_Tpn>(a.s[i]); \
+        c.s[i+_Tpvec::nlanes] = saturate_cast<_Tpn>(b.s[i]); \
+    } \
+    return c; \
+}
+
+//! @name Pack
+//! @{
+//! @brief Pack values from two vectors to one
+//!
+//! Return vector type have twice more elements than input vector types. Variant with _u_ suffix also
+//! converts to corresponding unsigned type.
+//!
+//! - pack: for 16-, 32- and 64-bit integer input types
+//! - pack_u: for 16- and 32-bit signed integer input types
+OPENCV_HAL_IMPL_C_PACK(v_uint16x8, v_uint8x16, uchar, pack)
+OPENCV_HAL_IMPL_C_PACK(v_int16x8, v_int8x16, schar, pack)
+OPENCV_HAL_IMPL_C_PACK(v_uint32x4, v_uint16x8, ushort, pack)
+OPENCV_HAL_IMPL_C_PACK(v_int32x4, v_int16x8, short, pack)
+OPENCV_HAL_IMPL_C_PACK(v_uint64x2, v_uint32x4, unsigned, pack)
+OPENCV_HAL_IMPL_C_PACK(v_int64x2, v_int32x4, int, pack)
+OPENCV_HAL_IMPL_C_PACK(v_int16x8, v_uint8x16, uchar, pack_u)
+OPENCV_HAL_IMPL_C_PACK(v_int32x4, v_uint16x8, ushort, pack_u)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_RSHR_PACK(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix) \
+template<int n> inline _Tpnvec v_rshr_##pack_suffix(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpnvec c; \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+    { \
+        c.s[i] = saturate_cast<_Tpn>((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \
+        c.s[i+_Tpvec::nlanes] = saturate_cast<_Tpn>((b.s[i] + ((_Tp)1 << (n - 1))) >> n); \
+    } \
+    return c; \
+}
+
+//! @name Pack with rounding shift
+//! @{
+//! @brief Pack values from two vectors to one with rounding shift
+//!
+//! Values from the input vectors will be shifted right by _n_ bits with rounding, converted to narrower
+//! type and returned in the result vector. Variant with _u_ suffix converts to unsigned type.
+//!
+//! - pack: for 16-, 32- and 64-bit integer input types
+//! - pack_u: for 16- and 32-bit signed integer input types
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint16x8, ushort, v_uint8x16, uchar, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int16x8, short, v_int8x16, schar, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint32x4, unsigned, v_uint16x8, ushort, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int32x4, int, v_int16x8, short, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint64x2, uint64, v_uint32x4, unsigned, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int64x2, int64, v_int32x4, int, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int16x8, short, v_uint8x16, uchar, pack_u)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int32x4, int, v_uint16x8, ushort, pack_u)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_PACK_STORE(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix) \
+inline void v_##pack_suffix##_store(_Tpn* ptr, const _Tpvec& a) \
+{ \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+        ptr[i] = saturate_cast<_Tpn>(a.s[i]); \
+}
+
+//! @name Pack and store
+//! @{
+//! @brief Store values from the input vector into memory with pack
+//!
+//! Values will be stored into memory with saturating conversion to narrower type.
+//! Variant with _u_ suffix converts to corresponding unsigned type.
+//!
+//! - pack: for 16-, 32- and 64-bit integer input types
+//! - pack_u: for 16- and 32-bit signed integer input types
+OPENCV_HAL_IMPL_C_PACK_STORE(v_uint16x8, ushort, v_uint8x16, uchar, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int16x8, short, v_int8x16, schar, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_uint32x4, unsigned, v_uint16x8, ushort, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int32x4, int, v_int16x8, short, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_uint64x2, uint64, v_uint32x4, unsigned, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int64x2, int64, v_int32x4, int, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int16x8, short, v_uint8x16, uchar, pack_u)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int32x4, int, v_uint16x8, ushort, pack_u)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix) \
+template<int n> inline void v_rshr_##pack_suffix##_store(_Tpn* ptr, const _Tpvec& a) \
+{ \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+        ptr[i] = saturate_cast<_Tpn>((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \
+}
+
+//! @name Pack and store with rounding shift
+//! @{
+//! @brief Store values from the input vector into memory with pack
+//!
+//! Values will be shifted _n_ bits right with rounding, converted to narrower type and stored into
+//! memory. Variant with _u_ suffix converts to unsigned type.
+//!
+//! - pack: for 16-, 32- and 64-bit integer input types
+//! - pack_u: for 16- and 32-bit signed integer input types
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint16x8, ushort, v_uint8x16, uchar, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int16x8, short, v_int8x16, schar, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint32x4, unsigned, v_uint16x8, ushort, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int32x4, int, v_int16x8, short, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint64x2, uint64, v_uint32x4, unsigned, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int64x2, int64, v_int32x4, int, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int16x8, short, v_uint8x16, uchar, pack_u)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int32x4, int, v_uint16x8, ushort, pack_u)
+//! @}
+
+/** @brief Matrix multiplication
+
+Scheme:
+@code
+{A0 A1 A2 A3}   |V0|
+{B0 B1 B2 B3}   |V1|
+{C0 C1 C2 C3}   |V2|
+{D0 D1 D2 D3} x |V3|
+====================
+{R0 R1 R2 R3}, where:
+R0 = A0V0 + A1V1 + A2V2 + A3V3,
+R1 = B0V0 + B1V1 + B2V2 + B3V3
+...
+@endcode
+*/
+inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0,
+                            const v_float32x4& m1, const v_float32x4& m2,
+                            const v_float32x4& m3)
+{
+    return v_float32x4(v.s[0]*m0.s[0] + v.s[1]*m1.s[0] + v.s[2]*m2.s[0] + v.s[3]*m3.s[0],
+                       v.s[0]*m0.s[1] + v.s[1]*m1.s[1] + v.s[2]*m2.s[1] + v.s[3]*m3.s[1],
+                       v.s[0]*m0.s[2] + v.s[1]*m1.s[2] + v.s[2]*m2.s[2] + v.s[3]*m3.s[2],
+                       v.s[0]*m0.s[3] + v.s[1]*m1.s[3] + v.s[2]*m2.s[3] + v.s[3]*m3.s[3]);
+}
+
+//! @}
+
+}
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp
new file mode 100644
index 0000000..f3e47ca
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp
@@ -0,0 +1,864 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_INTRIN_NEON_HPP__
+#define __OPENCV_HAL_INTRIN_NEON_HPP__
+
+#include <algorithm>
+
+namespace cv
+{
+
+//! @cond IGNORED
+
+#define CV_SIMD128 1
+
+struct v_uint8x16
+{
+    typedef uchar lane_type;
+    enum { nlanes = 16 };
+
+    v_uint8x16() {}
+    explicit v_uint8x16(uint8x16_t v) : val(v) {}
+    v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7,
+               uchar v8, uchar v9, uchar v10, uchar v11, uchar v12, uchar v13, uchar v14, uchar v15)
+    {
+        uchar v[] = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15};
+        val = vld1q_u8(v);
+    }
+    uchar get0() const
+    {
+        return vgetq_lane_u8(val, 0);
+    }
+
+    uint8x16_t val;
+};
+
+struct v_int8x16
+{
+    typedef schar lane_type;
+    enum { nlanes = 16 };
+
+    v_int8x16() {}
+    explicit v_int8x16(int8x16_t v) : val(v) {}
+    v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7,
+               schar v8, schar v9, schar v10, schar v11, schar v12, schar v13, schar v14, schar v15)
+    {
+        schar v[] = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15};
+        val = vld1q_s8(v);
+    }
+    schar get0() const
+    {
+        return vgetq_lane_s8(val, 0);
+    }
+
+    int8x16_t val;
+};
+
+struct v_uint16x8
+{
+    typedef ushort lane_type;
+    enum { nlanes = 8 };
+
+    v_uint16x8() {}
+    explicit v_uint16x8(uint16x8_t v) : val(v) {}
+    v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7)
+    {
+        ushort v[] = {v0, v1, v2, v3, v4, v5, v6, v7};
+        val = vld1q_u16(v);
+    }
+    ushort get0() const
+    {
+        return vgetq_lane_u16(val, 0);
+    }
+
+    uint16x8_t val;
+};
+
+struct v_int16x8
+{
+    typedef short lane_type;
+    enum { nlanes = 8 };
+
+    v_int16x8() {}
+    explicit v_int16x8(int16x8_t v) : val(v) {}
+    v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7)
+    {
+        short v[] = {v0, v1, v2, v3, v4, v5, v6, v7};
+        val = vld1q_s16(v);
+    }
+    short get0() const
+    {
+        return vgetq_lane_s16(val, 0);
+    }
+
+    int16x8_t val;
+};
+
+struct v_uint32x4
+{
+    typedef unsigned lane_type;
+    enum { nlanes = 4 };
+
+    v_uint32x4() {}
+    explicit v_uint32x4(uint32x4_t v) : val(v) {}
+    v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3)
+    {
+        unsigned v[] = {v0, v1, v2, v3};
+        val = vld1q_u32(v);
+    }
+    unsigned get0() const
+    {
+        return vgetq_lane_u32(val, 0);
+    }
+
+    uint32x4_t val;
+};
+
+struct v_int32x4
+{
+    typedef int lane_type;
+    enum { nlanes = 4 };
+
+    v_int32x4() {}
+    explicit v_int32x4(int32x4_t v) : val(v) {}
+    v_int32x4(int v0, int v1, int v2, int v3)
+    {
+        int v[] = {v0, v1, v2, v3};
+        val = vld1q_s32(v);
+    }
+    int get0() const
+    {
+        return vgetq_lane_s32(val, 0);
+    }
+    int32x4_t val;
+};
+
+struct v_float32x4
+{
+    typedef float lane_type;
+    enum { nlanes = 4 };
+
+    v_float32x4() {}
+    explicit v_float32x4(float32x4_t v) : val(v) {}
+    v_float32x4(float v0, float v1, float v2, float v3)
+    {
+        float v[] = {v0, v1, v2, v3};
+        val = vld1q_f32(v);
+    }
+    float get0() const
+    {
+        return vgetq_lane_f32(val, 0);
+    }
+    float32x4_t val;
+};
+
+struct v_uint64x2
+{
+    typedef uint64 lane_type;
+    enum { nlanes = 2 };
+
+    v_uint64x2() {}
+    explicit v_uint64x2(uint64x2_t v) : val(v) {}
+    v_uint64x2(unsigned v0, unsigned v1)
+    {
+        uint64 v[] = {v0, v1};
+        val = vld1q_u64(v);
+    }
+    uint64 get0() const
+    {
+        return vgetq_lane_u64(val, 0);
+    }
+    uint64x2_t val;
+};
+
+struct v_int64x2
+{
+    typedef int64 lane_type;
+    enum { nlanes = 2 };
+
+    v_int64x2() {}
+    explicit v_int64x2(int64x2_t v) : val(v) {}
+    v_int64x2(int v0, int v1)
+    {
+        int64 v[] = {v0, v1};
+        val = vld1q_s64(v);
+    }
+    int64 get0() const
+    {
+        return vgetq_lane_s64(val, 0);
+    }
+    int64x2_t val;
+};
+
+#define OPENCV_HAL_IMPL_NEON_INIT(_Tpv, _Tp, suffix) \
+inline v_##_Tpv v_setzero_##suffix() { return v_##_Tpv(vdupq_n_##suffix((_Tp)0)); } \
+inline v_##_Tpv v_setall_##suffix(_Tp v) { return v_##_Tpv(vdupq_n_##suffix(v)); } \
+inline _Tpv##_t vreinterpretq_##suffix##_##suffix(_Tpv##_t v) { return v; } \
+inline v_uint8x16 v_reinterpret_as_u8(const v_##_Tpv& v) { return v_uint8x16(vreinterpretq_u8_##suffix(v.val)); } \
+inline v_int8x16 v_reinterpret_as_s8(const v_##_Tpv& v) { return v_int8x16(vreinterpretq_s8_##suffix(v.val)); } \
+inline v_uint16x8 v_reinterpret_as_u16(const v_##_Tpv& v) { return v_uint16x8(vreinterpretq_u16_##suffix(v.val)); } \
+inline v_int16x8 v_reinterpret_as_s16(const v_##_Tpv& v) { return v_int16x8(vreinterpretq_s16_##suffix(v.val)); } \
+inline v_uint32x4 v_reinterpret_as_u32(const v_##_Tpv& v) { return v_uint32x4(vreinterpretq_u32_##suffix(v.val)); } \
+inline v_int32x4 v_reinterpret_as_s32(const v_##_Tpv& v) { return v_int32x4(vreinterpretq_s32_##suffix(v.val)); } \
+inline v_uint64x2 v_reinterpret_as_u64(const v_##_Tpv& v) { return v_uint64x2(vreinterpretq_u64_##suffix(v.val)); } \
+inline v_int64x2 v_reinterpret_as_s64(const v_##_Tpv& v) { return v_int64x2(vreinterpretq_s64_##suffix(v.val)); } \
+inline v_float32x4 v_reinterpret_as_f32(const v_##_Tpv& v) { return v_float32x4(vreinterpretq_f32_##suffix(v.val)); }
+
+OPENCV_HAL_IMPL_NEON_INIT(uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_NEON_INIT(int8x16, schar, s8)
+OPENCV_HAL_IMPL_NEON_INIT(uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_NEON_INIT(int16x8, short, s16)
+OPENCV_HAL_IMPL_NEON_INIT(uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_NEON_INIT(int32x4, int, s32)
+OPENCV_HAL_IMPL_NEON_INIT(uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_NEON_INIT(int64x2, int64, s64)
+OPENCV_HAL_IMPL_NEON_INIT(float32x4, float, f32)
+
+#define OPENCV_HAL_IMPL_NEON_PACK(_Tpvec, _Tp, hreg, suffix, _Tpwvec, wsuffix, pack, op) \
+inline _Tpvec v_##pack(const _Tpwvec& a, const _Tpwvec& b) \
+{ \
+    hreg a1 = vqmov##op##_##wsuffix(a.val), b1 = vqmov##op##_##wsuffix(b.val); \
+    return _Tpvec(vcombine_##suffix(a1, b1)); \
+} \
+inline void v_##pack##_store(_Tp* ptr, const _Tpwvec& a) \
+{ \
+    hreg a1 = vqmov##op##_##wsuffix(a.val); \
+    vst1_##suffix(ptr, a1); \
+} \
+template<int n> inline \
+_Tpvec v_rshr_##pack(const _Tpwvec& a, const _Tpwvec& b) \
+{ \
+    hreg a1 = vqrshr##op##_n_##wsuffix(a.val, n); \
+    hreg b1 = vqrshr##op##_n_##wsuffix(b.val, n); \
+    return _Tpvec(vcombine_##suffix(a1, b1)); \
+} \
+template<int n> inline \
+void v_rshr_##pack##_store(_Tp* ptr, const _Tpwvec& a) \
+{ \
+    hreg a1 = vqrshr##op##_n_##wsuffix(a.val, n); \
+    vst1_##suffix(ptr, a1); \
+}
+
+OPENCV_HAL_IMPL_NEON_PACK(v_uint8x16, uchar, uint8x8_t, u8, v_uint16x8, u16, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_int8x16, schar, int8x8_t, s8, v_int16x8, s16, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_uint16x8, ushort, uint16x4_t, u16, v_uint32x4, u32, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_int16x8, short, int16x4_t, s16, v_int32x4, s32, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_uint32x4, unsigned, uint32x2_t, u32, v_uint64x2, u64, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_int32x4, int, int32x2_t, s32, v_int64x2, s64, pack, n)
+
+OPENCV_HAL_IMPL_NEON_PACK(v_uint8x16, uchar, uint8x8_t, u8, v_int16x8, s16, pack_u, un)
+OPENCV_HAL_IMPL_NEON_PACK(v_uint16x8, ushort, uint16x4_t, u16, v_int32x4, s32, pack_u, un)
+
+inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0,
+                            const v_float32x4& m1, const v_float32x4& m2,
+                            const v_float32x4& m3)
+{
+    float32x2_t vl = vget_low_f32(v.val), vh = vget_high_f32(v.val);
+    float32x4_t res = vmulq_lane_f32(m0.val, vl, 0);
+    res = vmlaq_lane_f32(res, m1.val, vl, 1);
+    res = vmlaq_lane_f32(res, m2.val, vh, 0);
+    res = vmlaq_lane_f32(res, m3.val, vh, 1);
+    return v_float32x4(res);
+}
+
+#define OPENCV_HAL_IMPL_NEON_BIN_OP(bin_op, _Tpvec, intrin) \
+inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(intrin(a.val, b.val)); \
+} \
+inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \
+{ \
+    a.val = intrin(a.val, b.val); \
+    return a; \
+}
+
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint8x16, vqaddq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint8x16, vqsubq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int8x16, vqaddq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int8x16, vqsubq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint16x8, vqaddq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint16x8, vqsubq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_uint16x8, vmulq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int16x8, vqaddq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int16x8, vqsubq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_int16x8, vmulq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int32x4, vaddq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int32x4, vsubq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_int32x4, vmulq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint32x4, vaddq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint32x4, vsubq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_uint32x4, vmulq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_float32x4, vaddq_f32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_float32x4, vsubq_f32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_float32x4, vmulq_f32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int64x2, vaddq_s64)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int64x2, vsubq_s64)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint64x2, vaddq_u64)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint64x2, vsubq_u64)
+
+inline v_float32x4 operator / (const v_float32x4& a, const v_float32x4& b)
+{
+    float32x4_t reciprocal = vrecpeq_f32(b.val);
+    reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
+    reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
+    return v_float32x4(vmulq_f32(a.val, reciprocal));
+}
+inline v_float32x4& operator /= (v_float32x4& a, const v_float32x4& b)
+{
+    float32x4_t reciprocal = vrecpeq_f32(b.val);
+    reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
+    reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
+    a.val = vmulq_f32(a.val, reciprocal);
+    return a;
+}
+
+inline void v_mul_expand(const v_int16x8& a, const v_int16x8& b,
+                         v_int32x4& c, v_int32x4& d)
+{
+    c.val = vmull_s16(vget_low_s16(a.val), vget_low_s16(b.val));
+    d.val = vmull_s16(vget_high_s16(a.val), vget_high_s16(b.val));
+}
+
+inline void v_mul_expand(const v_uint16x8& a, const v_uint16x8& b,
+                         v_uint32x4& c, v_uint32x4& d)
+{
+    c.val = vmull_u16(vget_low_u16(a.val), vget_low_u16(b.val));
+    d.val = vmull_u16(vget_high_u16(a.val), vget_high_u16(b.val));
+}
+
+inline void v_mul_expand(const v_uint32x4& a, const v_uint32x4& b,
+                         v_uint64x2& c, v_uint64x2& d)
+{
+    c.val = vmull_u32(vget_low_u32(a.val), vget_low_u32(b.val));
+    d.val = vmull_u32(vget_high_u32(a.val), vget_high_u32(b.val));
+}
+
+inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b)
+{
+    int32x4_t c = vmull_s16(vget_low_s16(a.val), vget_low_s16(b.val));
+    int32x4_t d = vmull_s16(vget_high_s16(a.val), vget_high_s16(b.val));
+    int32x4x2_t cd = vuzpq_s32(c, d);
+    return v_int32x4(vaddq_s32(cd.val[0], cd.val[1]));
+}
+
+#define OPENCV_HAL_IMPL_NEON_LOGIC_OP(_Tpvec, suffix) \
+    OPENCV_HAL_IMPL_NEON_BIN_OP(&, _Tpvec, vandq_##suffix) \
+    OPENCV_HAL_IMPL_NEON_BIN_OP(|, _Tpvec, vorrq_##suffix) \
+    OPENCV_HAL_IMPL_NEON_BIN_OP(^, _Tpvec, veorq_##suffix) \
+    inline _Tpvec operator ~ (const _Tpvec& a) \
+    { \
+        return _Tpvec(vreinterpretq_##suffix##_u8(vmvnq_u8(vreinterpretq_u8_##suffix(a.val)))); \
+    }
+
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint8x16, u8)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int8x16, s8)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint16x8, u16)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int16x8, s16)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint32x4, u32)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int32x4, s32)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint64x2, u64)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int64x2, s64)
+
+#define OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(bin_op, intrin) \
+inline v_float32x4 operator bin_op (const v_float32x4& a, const v_float32x4& b) \
+{ \
+    return v_float32x4(vreinterpretq_f32_s32(intrin(vreinterpretq_s32_f32(a.val), vreinterpretq_s32_f32(b.val)))); \
+} \
+inline v_float32x4& operator bin_op##= (v_float32x4& a, const v_float32x4& b) \
+{ \
+    a.val = vreinterpretq_f32_s32(intrin(vreinterpretq_s32_f32(a.val), vreinterpretq_s32_f32(b.val))); \
+    return a; \
+}
+
+OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(&, vandq_s32)
+OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(|, vorrq_s32)
+OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(^, veorq_s32)
+
+inline v_float32x4 operator ~ (const v_float32x4& a)
+{
+    return v_float32x4(vreinterpretq_f32_s32(vmvnq_s32(vreinterpretq_s32_f32(a.val))));
+}
+
+inline v_float32x4 v_sqrt(const v_float32x4& x)
+{
+    float32x4_t x1 = vmaxq_f32(x.val, vdupq_n_f32(FLT_MIN));
+    float32x4_t e = vrsqrteq_f32(x1);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x1, e), e), e);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x1, e), e), e);
+    return v_float32x4(vmulq_f32(x.val, e));
+}
+
+inline v_float32x4 v_invsqrt(const v_float32x4& x)
+{
+    float32x4_t e = vrsqrteq_f32(x.val);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x.val, e), e), e);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x.val, e), e), e);
+    return v_float32x4(e);
+}
+
+inline v_float32x4 v_abs(v_float32x4 x)
+{ return v_float32x4(vabsq_f32(x.val)); }
+
+// TODO: exp, log, sin, cos
+
+#define OPENCV_HAL_IMPL_NEON_BIN_FUNC(_Tpvec, func, intrin) \
+inline _Tpvec func(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(intrin(a.val, b.val)); \
+}
+
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_min, vminq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_max, vmaxq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_min, vminq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_max, vmaxq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_min, vminq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_max, vmaxq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_min, vminq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_max, vmaxq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_min, vminq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_max, vmaxq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int32x4, v_min, vminq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int32x4, v_max, vmaxq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_min, vminq_f32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_max, vmaxq_f32)
+
+
+#define OPENCV_HAL_IMPL_NEON_INT_CMP_OP(_Tpvec, cast, suffix, not_suffix) \
+inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vceqq_##suffix(a.val, b.val))); } \
+inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vmvnq_##not_suffix(vceqq_##suffix(a.val, b.val)))); } \
+inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vcltq_##suffix(a.val, b.val))); } \
+inline _Tpvec operator > (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vcgtq_##suffix(a.val, b.val))); } \
+inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vcleq_##suffix(a.val, b.val))); } \
+inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vcgeq_##suffix(a.val, b.val))); }
+
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint8x16, OPENCV_HAL_NOP, u8, u8)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int8x16, vreinterpretq_s8_u8, s8, u8)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint16x8, OPENCV_HAL_NOP, u16, u16)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int16x8, vreinterpretq_s16_u16, s16, u16)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint32x4, OPENCV_HAL_NOP, u32, u32)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int32x4, vreinterpretq_s32_u32, s32, u32)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_float32x4, vreinterpretq_f32_u32, f32, u32)
+
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_add_wrap, vaddq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_add_wrap, vaddq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_add_wrap, vaddq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_add_wrap, vaddq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_sub_wrap, vsubq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_sub_wrap, vsubq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_sub_wrap, vsubq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_sub_wrap, vsubq_s16)
+
+// TODO: absdiff for signed integers
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_absdiff, vabdq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_absdiff, vabdq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_absdiff, vabdq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_absdiff, vabdq_f32)
+
+#define OPENCV_HAL_IMPL_NEON_BIN_FUNC2(_Tpvec, _Tpvec2, cast, func, intrin) \
+inline _Tpvec2 func(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec2(cast(intrin(a.val, b.val))); \
+}
+
+OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int8x16, v_uint8x16, vreinterpretq_u8_s8, v_absdiff, vabdq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int16x8, v_uint16x8, vreinterpretq_u16_s16, v_absdiff, vabdq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int32x4, v_uint32x4, vreinterpretq_u32_s32, v_absdiff, vabdq_s32)
+
+inline v_float32x4 v_magnitude(const v_float32x4& a, const v_float32x4& b)
+{
+    v_float32x4 x(vmlaq_f32(vmulq_f32(a.val, a.val), b.val, b.val));
+    return v_sqrt(x);
+}
+
+inline v_float32x4 v_sqr_magnitude(const v_float32x4& a, const v_float32x4& b)
+{
+    return v_float32x4(vmlaq_f32(vmulq_f32(a.val, a.val), b.val, b.val));
+}
+
+inline v_float32x4 v_muladd(const v_float32x4& a, const v_float32x4& b, const v_float32x4& c)
+{
+    return v_float32x4(vmlaq_f32(c.val, a.val, b.val));
+}
+
+// trade efficiency for convenience
+#define OPENCV_HAL_IMPL_NEON_SHIFT_OP(_Tpvec, suffix, _Tps, ssuffix) \
+inline _Tpvec operator << (const _Tpvec& a, int n) \
+{ return _Tpvec(vshlq_##suffix(a.val, vdupq_n_##ssuffix((_Tps)n))); } \
+inline _Tpvec operator >> (const _Tpvec& a, int n) \
+{ return _Tpvec(vshlq_##suffix(a.val, vdupq_n_##ssuffix((_Tps)-n))); } \
+template<int n> inline _Tpvec v_shl(const _Tpvec& a) \
+{ return _Tpvec(vshlq_n_##suffix(a.val, n)); } \
+template<int n> inline _Tpvec v_shr(const _Tpvec& a) \
+{ return _Tpvec(vshrq_n_##suffix(a.val, n)); } \
+template<int n> inline _Tpvec v_rshr(const _Tpvec& a) \
+{ return _Tpvec(vrshrq_n_##suffix(a.val, n)); }
+
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint8x16, u8, schar, s8)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int8x16, s8, schar, s8)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint16x8, u16, short, s16)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int16x8, s16, short, s16)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint32x4, u32, int, s32)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int32x4, s32, int, s32)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint64x2, u64, int64, s64)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int64x2, s64, int64, s64)
+
+#define OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(_Tpvec, _Tp, suffix) \
+inline _Tpvec v_load(const _Tp* ptr) \
+{ return _Tpvec(vld1q_##suffix(ptr)); } \
+inline _Tpvec v_load_aligned(const _Tp* ptr) \
+{ return _Tpvec(vld1q_##suffix(ptr)); } \
+inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \
+{ return _Tpvec(vcombine_##suffix(vld1_##suffix(ptr0), vld1_##suffix(ptr1))); } \
+inline void v_store(_Tp* ptr, const _Tpvec& a) \
+{ vst1q_##suffix(ptr, a.val); } \
+inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \
+{ vst1q_##suffix(ptr, a.val); } \
+inline void v_store_low(_Tp* ptr, const _Tpvec& a) \
+{ vst1_##suffix(ptr, vget_low_##suffix(a.val)); } \
+inline void v_store_high(_Tp* ptr, const _Tpvec& a) \
+{ vst1_##suffix(ptr, vget_high_##suffix(a.val)); }
+
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int8x16, schar, s8)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int16x8, short, s16)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int32x4, int, s32)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int64x2, int64, s64)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_float32x4, float, f32)
+
+#define OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(_Tpvec, scalartype, func, scalar_func) \
+inline scalartype v_reduce_##func(const _Tpvec& a) \
+{ \
+    scalartype CV_DECL_ALIGNED(16) buf[4]; \
+    v_store_aligned(buf, a); \
+    scalartype s0 = scalar_func(buf[0], buf[1]); \
+    scalartype s1 = scalar_func(buf[2], buf[3]); \
+    return scalar_func(s0, s1); \
+}
+
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, unsigned, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, unsigned, max, std::max)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, unsigned, min, std::min)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int, max, std::max)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int, min, std::min)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float, max, std::max)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float, min, std::min)
+
+inline int v_signmask(const v_uint8x16& a)
+{
+    int8x8_t m0 = vcreate_s8(CV_BIG_UINT(0x0706050403020100));
+    uint8x16_t v0 = vshlq_u8(vshrq_n_u8(a.val, 7), vcombine_s8(m0, m0));
+    uint64x2_t v1 = vpaddlq_u32(vpaddlq_u16(vpaddlq_u8(v0)));
+    return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 8);
+}
+inline int v_signmask(const v_int8x16& a)
+{ return v_signmask(v_reinterpret_as_u8(a)); }
+
+inline int v_signmask(const v_uint16x8& a)
+{
+    int16x4_t m0 = vcreate_s16(CV_BIG_UINT(0x0003000200010000));
+    uint16x8_t v0 = vshlq_u16(vshrq_n_u16(a.val, 15), vcombine_s16(m0, m0));
+    uint64x2_t v1 = vpaddlq_u32(vpaddlq_u16(v0));
+    return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 4);
+}
+inline int v_signmask(const v_int16x8& a)
+{ return v_signmask(v_reinterpret_as_u16(a)); }
+
+inline int v_signmask(const v_uint32x4& a)
+{
+    int32x2_t m0 = vcreate_s32(CV_BIG_UINT(0x0000000100000000));
+    uint32x4_t v0 = vshlq_u32(vshrq_n_u32(a.val, 31), vcombine_s32(m0, m0));
+    uint64x2_t v1 = vpaddlq_u32(v0);
+    return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 2);
+}
+inline int v_signmask(const v_int32x4& a)
+{ return v_signmask(v_reinterpret_as_u32(a)); }
+inline int v_signmask(const v_float32x4& a)
+{ return v_signmask(v_reinterpret_as_u32(a)); }
+
+#define OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(_Tpvec, suffix, shift) \
+inline bool v_check_all(const v_##_Tpvec& a) \
+{ \
+    _Tpvec##_t v0 = vshrq_n_##suffix(vmvnq_##suffix(a.val), shift); \
+    uint64x2_t v1 = vreinterpretq_u64_##suffix(v0); \
+    return (vgetq_lane_u64(v1, 0) | vgetq_lane_u64(v1, 1)) == 0; \
+} \
+inline bool v_check_any(const v_##_Tpvec& a) \
+{ \
+    _Tpvec##_t v0 = vshrq_n_##suffix(a.val, shift); \
+    uint64x2_t v1 = vreinterpretq_u64_##suffix(v0); \
+    return (vgetq_lane_u64(v1, 0) | vgetq_lane_u64(v1, 1)) != 0; \
+}
+
+OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint8x16, u8, 7)
+OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint16x8, u16, 15)
+OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint32x4, u32, 31)
+
+inline bool v_check_all(const v_int8x16& a)
+{ return v_check_all(v_reinterpret_as_u8(a)); }
+inline bool v_check_all(const v_int16x8& a)
+{ return v_check_all(v_reinterpret_as_u16(a)); }
+inline bool v_check_all(const v_int32x4& a)
+{ return v_check_all(v_reinterpret_as_u32(a)); }
+inline bool v_check_all(const v_float32x4& a)
+{ return v_check_all(v_reinterpret_as_u32(a)); }
+
+inline bool v_check_any(const v_int8x16& a)
+{ return v_check_any(v_reinterpret_as_u8(a)); }
+inline bool v_check_any(const v_int16x8& a)
+{ return v_check_any(v_reinterpret_as_u16(a)); }
+inline bool v_check_any(const v_int32x4& a)
+{ return v_check_any(v_reinterpret_as_u32(a)); }
+inline bool v_check_any(const v_float32x4& a)
+{ return v_check_any(v_reinterpret_as_u32(a)); }
+
+#define OPENCV_HAL_IMPL_NEON_SELECT(_Tpvec, suffix, usuffix) \
+inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(vbslq_##suffix(vreinterpretq_##usuffix##_##suffix(mask.val), a.val, b.val)); \
+}
+
+OPENCV_HAL_IMPL_NEON_SELECT(v_uint8x16, u8, u8)
+OPENCV_HAL_IMPL_NEON_SELECT(v_int8x16, s8, u8)
+OPENCV_HAL_IMPL_NEON_SELECT(v_uint16x8, u16, u16)
+OPENCV_HAL_IMPL_NEON_SELECT(v_int16x8, s16, u16)
+OPENCV_HAL_IMPL_NEON_SELECT(v_uint32x4, u32, u32)
+OPENCV_HAL_IMPL_NEON_SELECT(v_int32x4, s32, u32)
+OPENCV_HAL_IMPL_NEON_SELECT(v_float32x4, f32, u32)
+
+#define OPENCV_HAL_IMPL_NEON_EXPAND(_Tpvec, _Tpwvec, _Tp, suffix) \
+inline void v_expand(const _Tpvec& a, _Tpwvec& b0, _Tpwvec& b1) \
+{ \
+    b0.val = vmovl_##suffix(vget_low_##suffix(a.val)); \
+    b1.val = vmovl_##suffix(vget_high_##suffix(a.val)); \
+} \
+inline _Tpwvec v_load_expand(const _Tp* ptr) \
+{ \
+    return _Tpwvec(vmovl_##suffix(vld1_##suffix(ptr))); \
+}
+
+OPENCV_HAL_IMPL_NEON_EXPAND(v_uint8x16, v_uint16x8, uchar, u8)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_int8x16, v_int16x8, schar, s8)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_uint16x8, v_uint32x4, ushort, u16)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_int16x8, v_int32x4, short, s16)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_uint32x4, v_uint64x2, uint, u32)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_int32x4, v_int64x2, int, s32)
+
+inline v_uint32x4 v_load_expand_q(const uchar* ptr)
+{
+    uint8x8_t v0 = vcreate_u8(*(unsigned*)ptr);
+    uint16x4_t v1 = vget_low_u16(vmovl_u8(v0));
+    return v_uint32x4(vmovl_u16(v1));
+}
+
+inline v_int32x4 v_load_expand_q(const schar* ptr)
+{
+    int8x8_t v0 = vcreate_s8(*(unsigned*)ptr);
+    int16x4_t v1 = vget_low_s16(vmovl_s8(v0));
+    return v_int32x4(vmovl_s16(v1));
+}
+
+#define OPENCV_HAL_IMPL_NEON_UNPACKS(_Tpvec, suffix) \
+inline void v_zip(const v_##_Tpvec& a0, const v_##_Tpvec& a1, v_##_Tpvec& b0, v_##_Tpvec& b1) \
+{ \
+    _Tpvec##x2_t p = vzipq_##suffix(a0.val, a1.val); \
+    b0.val = p.val[0]; \
+    b1.val = p.val[1]; \
+} \
+inline v_##_Tpvec v_combine_low(const v_##_Tpvec& a, const v_##_Tpvec& b) \
+{ \
+    return v_##_Tpvec(vcombine_##suffix(vget_low_##suffix(a.val), vget_low_##suffix(b.val))); \
+} \
+inline v_##_Tpvec v_combine_high(const v_##_Tpvec& a, const v_##_Tpvec& b) \
+{ \
+    return v_##_Tpvec(vcombine_##suffix(vget_high_##suffix(a.val), vget_high_##suffix(b.val))); \
+} \
+inline void v_recombine(const v_##_Tpvec& a, const v_##_Tpvec& b, v_##_Tpvec& c, v_##_Tpvec& d) \
+{ \
+    c.val = vcombine_##suffix(vget_low_##suffix(a.val), vget_low_##suffix(b.val)); \
+    d.val = vcombine_##suffix(vget_high_##suffix(a.val), vget_high_##suffix(b.val)); \
+}
+
+OPENCV_HAL_IMPL_NEON_UNPACKS(uint8x16, u8)
+OPENCV_HAL_IMPL_NEON_UNPACKS(int8x16, s8)
+OPENCV_HAL_IMPL_NEON_UNPACKS(uint16x8, u16)
+OPENCV_HAL_IMPL_NEON_UNPACKS(int16x8, s16)
+OPENCV_HAL_IMPL_NEON_UNPACKS(uint32x4, u32)
+OPENCV_HAL_IMPL_NEON_UNPACKS(int32x4, s32)
+OPENCV_HAL_IMPL_NEON_UNPACKS(float32x4, f32)
+
+#define OPENCV_HAL_IMPL_NEON_EXTRACT(_Tpvec, suffix) \
+template <int s> \
+inline v_##_Tpvec v_extract(const v_##_Tpvec& a, const v_##_Tpvec& b) \
+{ \
+    return v_##_Tpvec(vextq_##suffix(a.val, b.val, s)); \
+}
+
+OPENCV_HAL_IMPL_NEON_EXTRACT(uint8x16, u8)
+OPENCV_HAL_IMPL_NEON_EXTRACT(int8x16, s8)
+OPENCV_HAL_IMPL_NEON_EXTRACT(uint16x8, u16)
+OPENCV_HAL_IMPL_NEON_EXTRACT(int16x8, s16)
+OPENCV_HAL_IMPL_NEON_EXTRACT(uint32x4, u32)
+OPENCV_HAL_IMPL_NEON_EXTRACT(int32x4, s32)
+OPENCV_HAL_IMPL_NEON_EXTRACT(uint64x2, u64)
+OPENCV_HAL_IMPL_NEON_EXTRACT(int64x2, s64)
+OPENCV_HAL_IMPL_NEON_EXTRACT(float32x4, f32)
+
+inline v_int32x4 v_round(const v_float32x4& a)
+{
+    static const int32x4_t v_sign = vdupq_n_s32(1 << 31),
+        v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f));
+
+    int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(a.val)));
+    return v_int32x4(vcvtq_s32_f32(vaddq_f32(a.val, vreinterpretq_f32_s32(v_addition))));
+}
+
+inline v_int32x4 v_floor(const v_float32x4& a)
+{
+    int32x4_t a1 = vcvtq_s32_f32(a.val);
+    uint32x4_t mask = vcgtq_f32(vcvtq_f32_s32(a1), a.val);
+    return v_int32x4(vaddq_s32(a1, vreinterpretq_s32_u32(mask)));
+}
+
+inline v_int32x4 v_ceil(const v_float32x4& a)
+{
+    int32x4_t a1 = vcvtq_s32_f32(a.val);
+    uint32x4_t mask = vcgtq_f32(a.val, vcvtq_f32_s32(a1));
+    return v_int32x4(vsubq_s32(a1, vreinterpretq_s32_u32(mask)));
+}
+
+inline v_int32x4 v_trunc(const v_float32x4& a)
+{ return v_int32x4(vcvtq_s32_f32(a.val)); }
+
+#define OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(_Tpvec, suffix) \
+inline void v_transpose4x4(const v_##_Tpvec& a0, const v_##_Tpvec& a1, \
+                         const v_##_Tpvec& a2, const v_##_Tpvec& a3, \
+                         v_##_Tpvec& b0, v_##_Tpvec& b1, \
+                         v_##_Tpvec& b2, v_##_Tpvec& b3) \
+{ \
+    /* m00 m01 m02 m03 */ \
+    /* m10 m11 m12 m13 */ \
+    /* m20 m21 m22 m23 */ \
+    /* m30 m31 m32 m33 */ \
+    _Tpvec##x2_t t0 = vtrnq_##suffix(a0.val, a1.val); \
+    _Tpvec##x2_t t1 = vtrnq_##suffix(a2.val, a3.val); \
+    /* m00 m10 m02 m12 */ \
+    /* m01 m11 m03 m13 */ \
+    /* m20 m30 m22 m32 */ \
+    /* m21 m31 m23 m33 */ \
+    b0.val = vcombine_##suffix(vget_low_##suffix(t0.val[0]), vget_low_##suffix(t1.val[0])); \
+    b1.val = vcombine_##suffix(vget_low_##suffix(t0.val[1]), vget_low_##suffix(t1.val[1])); \
+    b2.val = vcombine_##suffix(vget_high_##suffix(t0.val[0]), vget_high_##suffix(t1.val[0])); \
+    b3.val = vcombine_##suffix(vget_high_##suffix(t0.val[1]), vget_high_##suffix(t1.val[1])); \
+}
+
+OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(uint32x4, u32)
+OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(int32x4, s32)
+OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(float32x4, f32)
+
+#define OPENCV_HAL_IMPL_NEON_INTERLEAVED(_Tpvec, _Tp, suffix) \
+inline void v_load_deinterleave(const _Tp* ptr, v_##_Tpvec& a, v_##_Tpvec& b, v_##_Tpvec& c) \
+{ \
+    _Tpvec##x3_t v = vld3q_##suffix(ptr); \
+    a.val = v.val[0]; \
+    b.val = v.val[1]; \
+    c.val = v.val[2]; \
+} \
+inline void v_load_deinterleave(const _Tp* ptr, v_##_Tpvec& a, v_##_Tpvec& b, \
+                                v_##_Tpvec& c, v_##_Tpvec& d) \
+{ \
+    _Tpvec##x4_t v = vld4q_##suffix(ptr); \
+    a.val = v.val[0]; \
+    b.val = v.val[1]; \
+    c.val = v.val[2]; \
+    d.val = v.val[3]; \
+} \
+inline void v_store_interleave( _Tp* ptr, const v_##_Tpvec& a, const v_##_Tpvec& b, const v_##_Tpvec& c) \
+{ \
+    _Tpvec##x3_t v; \
+    v.val[0] = a.val; \
+    v.val[1] = b.val; \
+    v.val[2] = c.val; \
+    vst3q_##suffix(ptr, v); \
+} \
+inline void v_store_interleave( _Tp* ptr, const v_##_Tpvec& a, const v_##_Tpvec& b, \
+                               const v_##_Tpvec& c, const v_##_Tpvec& d) \
+{ \
+    _Tpvec##x4_t v; \
+    v.val[0] = a.val; \
+    v.val[1] = b.val; \
+    v.val[2] = c.val; \
+    v.val[3] = d.val; \
+    vst4q_##suffix(ptr, v); \
+}
+
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(int8x16, schar, s8)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(int16x8, short, s16)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(int32x4, int, s32)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(float32x4, float, f32)
+
+inline v_float32x4 v_cvt_f32(const v_int32x4& a)
+{
+    return v_float32x4(vcvtq_f32_s32(a.val));
+}
+
+//! @endcond
+
+}
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp
new file mode 100644
index 0000000..1840e03
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp
@@ -0,0 +1,1599 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_SSE_HPP__
+#define __OPENCV_HAL_SSE_HPP__
+
+#include <algorithm>
+
+#define CV_SIMD128 1
+#define CV_SIMD128_64F 1
+
+namespace cv
+{
+
+//! @cond IGNORED
+
+struct v_uint8x16
+{
+    typedef uchar lane_type;
+    enum { nlanes = 16 };
+
+    v_uint8x16() {}
+    explicit v_uint8x16(__m128i v) : val(v) {}
+    v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7,
+               uchar v8, uchar v9, uchar v10, uchar v11, uchar v12, uchar v13, uchar v14, uchar v15)
+    {
+        val = _mm_setr_epi8((char)v0, (char)v1, (char)v2, (char)v3,
+                            (char)v4, (char)v5, (char)v6, (char)v7,
+                            (char)v8, (char)v9, (char)v10, (char)v11,
+                            (char)v12, (char)v13, (char)v14, (char)v15);
+    }
+    uchar get0() const
+    {
+        return (uchar)_mm_cvtsi128_si32(val);
+    }
+
+    __m128i val;
+};
+
+struct v_int8x16
+{
+    typedef schar lane_type;
+    enum { nlanes = 16 };
+
+    v_int8x16() {}
+    explicit v_int8x16(__m128i v) : val(v) {}
+    v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7,
+              schar v8, schar v9, schar v10, schar v11, schar v12, schar v13, schar v14, schar v15)
+    {
+        val = _mm_setr_epi8((char)v0, (char)v1, (char)v2, (char)v3,
+                            (char)v4, (char)v5, (char)v6, (char)v7,
+                            (char)v8, (char)v9, (char)v10, (char)v11,
+                            (char)v12, (char)v13, (char)v14, (char)v15);
+    }
+    schar get0() const
+    {
+        return (schar)_mm_cvtsi128_si32(val);
+    }
+
+    __m128i val;
+};
+
+struct v_uint16x8
+{
+    typedef ushort lane_type;
+    enum { nlanes = 8 };
+
+    v_uint16x8() {}
+    explicit v_uint16x8(__m128i v) : val(v) {}
+    v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7)
+    {
+        val = _mm_setr_epi16((short)v0, (short)v1, (short)v2, (short)v3,
+                             (short)v4, (short)v5, (short)v6, (short)v7);
+    }
+    ushort get0() const
+    {
+        return (ushort)_mm_cvtsi128_si32(val);
+    }
+
+    __m128i val;
+};
+
+struct v_int16x8
+{
+    typedef short lane_type;
+    enum { nlanes = 8 };
+
+    v_int16x8() {}
+    explicit v_int16x8(__m128i v) : val(v) {}
+    v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7)
+    {
+        val = _mm_setr_epi16((short)v0, (short)v1, (short)v2, (short)v3,
+                             (short)v4, (short)v5, (short)v6, (short)v7);
+    }
+    short get0() const
+    {
+        return (short)_mm_cvtsi128_si32(val);
+    }
+    __m128i val;
+};
+
+struct v_uint32x4
+{
+    typedef unsigned lane_type;
+    enum { nlanes = 4 };
+
+    v_uint32x4() {}
+    explicit v_uint32x4(__m128i v) : val(v) {}
+    v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3)
+    {
+        val = _mm_setr_epi32((int)v0, (int)v1, (int)v2, (int)v3);
+    }
+    unsigned get0() const
+    {
+        return (unsigned)_mm_cvtsi128_si32(val);
+    }
+    __m128i val;
+};
+
+struct v_int32x4
+{
+    typedef int lane_type;
+    enum { nlanes = 4 };
+
+    v_int32x4() {}
+    explicit v_int32x4(__m128i v) : val(v) {}
+    v_int32x4(int v0, int v1, int v2, int v3)
+    {
+        val = _mm_setr_epi32(v0, v1, v2, v3);
+    }
+    int get0() const
+    {
+        return _mm_cvtsi128_si32(val);
+    }
+    __m128i val;
+};
+
+struct v_float32x4
+{
+    typedef float lane_type;
+    enum { nlanes = 4 };
+
+    v_float32x4() {}
+    explicit v_float32x4(__m128 v) : val(v) {}
+    v_float32x4(float v0, float v1, float v2, float v3)
+    {
+        val = _mm_setr_ps(v0, v1, v2, v3);
+    }
+    float get0() const
+    {
+        return _mm_cvtss_f32(val);
+    }
+    __m128 val;
+};
+
+struct v_uint64x2
+{
+    typedef uint64 lane_type;
+    enum { nlanes = 2 };
+
+    v_uint64x2() {}
+    explicit v_uint64x2(__m128i v) : val(v) {}
+    v_uint64x2(uint64 v0, uint64 v1)
+    {
+        val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32));
+    }
+    uint64 get0() const
+    {
+        int a = _mm_cvtsi128_si32(val);
+        int b = _mm_cvtsi128_si32(_mm_srli_epi64(val, 32));
+        return (unsigned)a | ((uint64)(unsigned)b << 32);
+    }
+    __m128i val;
+};
+
+struct v_int64x2
+{
+    typedef int64 lane_type;
+    enum { nlanes = 2 };
+
+    v_int64x2() {}
+    explicit v_int64x2(__m128i v) : val(v) {}
+    v_int64x2(int64 v0, int64 v1)
+    {
+        val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32));
+    }
+    int64 get0() const
+    {
+        int a = _mm_cvtsi128_si32(val);
+        int b = _mm_cvtsi128_si32(_mm_srli_epi64(val, 32));
+        return (int64)((unsigned)a | ((uint64)(unsigned)b << 32));
+    }
+    __m128i val;
+};
+
+struct v_float64x2
+{
+    typedef double lane_type;
+    enum { nlanes = 2 };
+
+    v_float64x2() {}
+    explicit v_float64x2(__m128d v) : val(v) {}
+    v_float64x2(double v0, double v1)
+    {
+        val = _mm_setr_pd(v0, v1);
+    }
+    double get0() const
+    {
+        return _mm_cvtsd_f64(val);
+    }
+    __m128d val;
+};
+
+#define OPENCV_HAL_IMPL_SSE_INITVEC(_Tpvec, _Tp, suffix, zsuffix, ssuffix, _Tps, cast) \
+inline _Tpvec v_setzero_##suffix() { return _Tpvec(_mm_setzero_##zsuffix()); } \
+inline _Tpvec v_setall_##suffix(_Tp v) { return _Tpvec(_mm_set1_##ssuffix((_Tps)v)); } \
+template<typename _Tpvec0> inline _Tpvec v_reinterpret_as_##suffix(const _Tpvec0& a) \
+{ return _Tpvec(cast(a.val)); }
+
+OPENCV_HAL_IMPL_SSE_INITVEC(v_uint8x16, uchar, u8, si128, epi8, char, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_int8x16, schar, s8, si128, epi8, char, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_uint16x8, ushort, u16, si128, epi16, short, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_int16x8, short, s16, si128, epi16, short, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_uint32x4, unsigned, u32, si128, epi32, int, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_int32x4, int, s32, si128, epi32, int, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_float32x4, float, f32, ps, ps, float, _mm_castsi128_ps)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_float64x2, double, f64, pd, pd, double, _mm_castsi128_pd)
+
+inline v_uint64x2 v_setzero_u64() { return v_uint64x2(_mm_setzero_si128()); }
+inline v_int64x2 v_setzero_s64() { return v_int64x2(_mm_setzero_si128()); }
+inline v_uint64x2 v_setall_u64(uint64 val) { return v_uint64x2(val, val); }
+inline v_int64x2 v_setall_s64(int64 val) { return v_int64x2(val, val); }
+
+template<typename _Tpvec> inline
+v_uint64x2 v_reinterpret_as_u64(const _Tpvec& a) { return v_uint64x2(a.val); }
+template<typename _Tpvec> inline
+v_int64x2 v_reinterpret_as_s64(const _Tpvec& a) { return v_int64x2(a.val); }
+inline v_float32x4 v_reinterpret_as_f32(const v_uint64x2& a)
+{ return v_float32x4(_mm_castsi128_ps(a.val)); }
+inline v_float32x4 v_reinterpret_as_f32(const v_int64x2& a)
+{ return v_float32x4(_mm_castsi128_ps(a.val)); }
+inline v_float64x2 v_reinterpret_as_f64(const v_uint64x2& a)
+{ return v_float64x2(_mm_castsi128_pd(a.val)); }
+inline v_float64x2 v_reinterpret_as_f64(const v_int64x2& a)
+{ return v_float64x2(_mm_castsi128_pd(a.val)); }
+
+#define OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(_Tpvec, suffix) \
+inline _Tpvec v_reinterpret_as_##suffix(const v_float32x4& a) \
+{ return _Tpvec(_mm_castps_si128(a.val)); } \
+inline _Tpvec v_reinterpret_as_##suffix(const v_float64x2& a) \
+{ return _Tpvec(_mm_castpd_si128(a.val)); }
+
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint8x16, u8)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int8x16, s8)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint16x8, u16)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int16x8, s16)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint32x4, u32)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int32x4, s32)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint64x2, u64)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int64x2, s64)
+
+inline v_float32x4 v_reinterpret_as_f32(const v_float32x4& a) {return a; }
+inline v_float64x2 v_reinterpret_as_f64(const v_float64x2& a) {return a; }
+inline v_float32x4 v_reinterpret_as_f32(const v_float64x2& a) {return v_float32x4(_mm_castpd_ps(a.val)); }
+inline v_float64x2 v_reinterpret_as_f64(const v_float32x4& a) {return v_float64x2(_mm_castps_pd(a.val)); }
+
+//////////////// PACK ///////////////
+inline v_uint8x16 v_pack(const v_uint16x8& a, const v_uint16x8& b)
+{
+    __m128i delta = _mm_set1_epi16(255);
+    return v_uint8x16(_mm_packus_epi16(_mm_subs_epu16(a.val, _mm_subs_epu16(a.val, delta)),
+                                       _mm_subs_epu16(b.val, _mm_subs_epu16(b.val, delta))));
+}
+
+inline void v_pack_store(uchar* ptr, const v_uint16x8& a)
+{
+    __m128i delta = _mm_set1_epi16(255);
+    __m128i a1 = _mm_subs_epu16(a.val, _mm_subs_epu16(a.val, delta));
+    _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1));
+}
+
+inline v_uint8x16 v_pack_u(const v_int16x8& a, const v_int16x8& b)
+{ return v_uint8x16(_mm_packus_epi16(a.val, b.val)); }
+
+inline void v_pack_u_store(uchar* ptr, const v_int16x8& a)
+{ _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a.val, a.val)); }
+
+template<int n> inline
+v_uint8x16 v_rshr_pack(const v_uint16x8& a, const v_uint16x8& b)
+{
+    // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers.
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    return v_uint8x16(_mm_packus_epi16(_mm_srli_epi16(_mm_adds_epu16(a.val, delta), n),
+                                       _mm_srli_epi16(_mm_adds_epu16(b.val, delta), n)));
+}
+
+template<int n> inline
+void v_rshr_pack_store(uchar* ptr, const v_uint16x8& a)
+{
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    __m128i a1 = _mm_srli_epi16(_mm_adds_epu16(a.val, delta), n);
+    _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1));
+}
+
+template<int n> inline
+v_uint8x16 v_rshr_pack_u(const v_int16x8& a, const v_int16x8& b)
+{
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    return v_uint8x16(_mm_packus_epi16(_mm_srai_epi16(_mm_adds_epi16(a.val, delta), n),
+                                       _mm_srai_epi16(_mm_adds_epi16(b.val, delta), n)));
+}
+
+template<int n> inline
+void v_rshr_pack_u_store(uchar* ptr, const v_int16x8& a)
+{
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    __m128i a1 = _mm_srai_epi16(_mm_adds_epi16(a.val, delta), n);
+    _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1));
+}
+
+inline v_int8x16 v_pack(const v_int16x8& a, const v_int16x8& b)
+{ return v_int8x16(_mm_packs_epi16(a.val, b.val)); }
+
+inline void v_pack_store(schar* ptr, v_int16x8& a)
+{ _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi16(a.val, a.val)); }
+
+template<int n> inline
+v_int8x16 v_rshr_pack(const v_int16x8& a, const v_int16x8& b)
+{
+    // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers.
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    return v_int8x16(_mm_packs_epi16(_mm_srai_epi16(_mm_adds_epi16(a.val, delta), n),
+                                     _mm_srai_epi16(_mm_adds_epi16(b.val, delta), n)));
+}
+template<int n> inline
+void v_rshr_pack_store(schar* ptr, const v_int16x8& a)
+{
+    // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers.
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    __m128i a1 = _mm_srai_epi16(_mm_adds_epi16(a.val, delta), n);
+    _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi16(a1, a1));
+}
+
+
+// bit-wise "mask ? a : b"
+inline __m128i v_select_si128(__m128i mask, __m128i a, __m128i b)
+{
+    return _mm_xor_si128(b, _mm_and_si128(_mm_xor_si128(a, b), mask));
+}
+
+inline v_uint16x8 v_pack(const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i z = _mm_setzero_si128(), maxval32 = _mm_set1_epi32(65535), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(v_select_si128(_mm_cmpgt_epi32(z, a.val), maxval32, a.val), delta32);
+    __m128i b1 = _mm_sub_epi32(v_select_si128(_mm_cmpgt_epi32(z, b.val), maxval32, b.val), delta32);
+    __m128i r = _mm_packs_epi32(a1, b1);
+    return v_uint16x8(_mm_sub_epi16(r, _mm_set1_epi16(-32768)));
+}
+
+inline void v_pack_store(ushort* ptr, const v_uint32x4& a)
+{
+    __m128i z = _mm_setzero_si128(), maxval32 = _mm_set1_epi32(65535), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(v_select_si128(_mm_cmpgt_epi32(z, a.val), maxval32, a.val), delta32);
+    __m128i r = _mm_packs_epi32(a1, a1);
+    _mm_storel_epi64((__m128i*)ptr, _mm_sub_epi16(r, _mm_set1_epi16(-32768)));
+}
+
+template<int n> inline
+v_uint16x8 v_rshr_pack(const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(a.val, delta), n), delta32);
+    __m128i b1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(b.val, delta), n), delta32);
+    return v_uint16x8(_mm_sub_epi16(_mm_packs_epi32(a1, b1), _mm_set1_epi16(-32768)));
+}
+
+template<int n> inline
+void v_rshr_pack_store(ushort* ptr, const v_uint32x4& a)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(a.val, delta), n), delta32);
+    __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768));
+    _mm_storel_epi64((__m128i*)ptr, a2);
+}
+
+inline v_uint16x8 v_pack_u(const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i delta32 = _mm_set1_epi32(32768);
+    __m128i r = _mm_packs_epi32(_mm_sub_epi32(a.val, delta32), _mm_sub_epi32(b.val, delta32));
+    return v_uint16x8(_mm_sub_epi16(r, _mm_set1_epi16(-32768)));
+}
+
+inline void v_pack_u_store(ushort* ptr, const v_int32x4& a)
+{
+    __m128i delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(a.val, delta32);
+    __m128i r = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768));
+    _mm_storel_epi64((__m128i*)ptr, r);
+}
+
+template<int n> inline
+v_uint16x8 v_rshr_pack_u(const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n), delta32);
+    __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768));
+    __m128i b1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(b.val, delta), n), delta32);
+    __m128i b2 = _mm_sub_epi16(_mm_packs_epi32(b1, b1), _mm_set1_epi16(-32768));
+    return v_uint16x8(_mm_unpacklo_epi64(a2, b2));
+}
+
+template<int n> inline
+void v_rshr_pack_u_store(ushort* ptr, const v_int32x4& a)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n), delta32);
+    __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768));
+    _mm_storel_epi64((__m128i*)ptr, a2);
+}
+
+inline v_int16x8 v_pack(const v_int32x4& a, const v_int32x4& b)
+{ return v_int16x8(_mm_packs_epi32(a.val, b.val)); }
+
+inline void v_pack_store(short* ptr, const v_int32x4& a)
+{
+    _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi32(a.val, a.val));
+}
+
+template<int n> inline
+v_int16x8 v_rshr_pack(const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1));
+    return v_int16x8(_mm_packs_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n),
+                                     _mm_srai_epi32(_mm_add_epi32(b.val, delta), n)));
+}
+
+template<int n> inline
+void v_rshr_pack_store(short* ptr, const v_int32x4& a)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1));
+    __m128i a1 = _mm_srai_epi32(_mm_add_epi32(a.val, delta), n);
+    _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi32(a1, a1));
+}
+
+
+// [a0 0 | b0 0]  [a1 0 | b1 0]
+inline v_uint32x4 v_pack(const v_uint64x2& a, const v_uint64x2& b)
+{
+    __m128i v0 = _mm_unpacklo_epi32(a.val, b.val); // a0 a1 0 0
+    __m128i v1 = _mm_unpackhi_epi32(a.val, b.val); // b0 b1 0 0
+    return v_uint32x4(_mm_unpacklo_epi32(v0, v1));
+}
+
+inline void v_pack_store(unsigned* ptr, const v_uint64x2& a)
+{
+    __m128i a1 = _mm_shuffle_epi32(a.val, _MM_SHUFFLE(0, 2, 2, 0));
+    _mm_storel_epi64((__m128i*)ptr, a1);
+}
+
+// [a0 0 | b0 0]  [a1 0 | b1 0]
+inline v_int32x4 v_pack(const v_int64x2& a, const v_int64x2& b)
+{
+    __m128i v0 = _mm_unpacklo_epi32(a.val, b.val); // a0 a1 0 0
+    __m128i v1 = _mm_unpackhi_epi32(a.val, b.val); // b0 b1 0 0
+    return v_int32x4(_mm_unpacklo_epi32(v0, v1));
+}
+
+inline void v_pack_store(int* ptr, const v_int64x2& a)
+{
+    __m128i a1 = _mm_shuffle_epi32(a.val, _MM_SHUFFLE(0, 2, 2, 0));
+    _mm_storel_epi64((__m128i*)ptr, a1);
+}
+
+template<int n> inline
+v_uint32x4 v_rshr_pack(const v_uint64x2& a, const v_uint64x2& b)
+{
+    uint64 delta = (uint64)1 << (n-1);
+    v_uint64x2 delta2(delta, delta);
+    __m128i a1 = _mm_srli_epi64(_mm_add_epi64(a.val, delta2.val), n);
+    __m128i b1 = _mm_srli_epi64(_mm_add_epi64(b.val, delta2.val), n);
+    __m128i v0 = _mm_unpacklo_epi32(a1, b1); // a0 a1 0 0
+    __m128i v1 = _mm_unpackhi_epi32(a1, b1); // b0 b1 0 0
+    return v_uint32x4(_mm_unpacklo_epi32(v0, v1));
+}
+
+template<int n> inline
+void v_rshr_pack_store(unsigned* ptr, const v_uint64x2& a)
+{
+    uint64 delta = (uint64)1 << (n-1);
+    v_uint64x2 delta2(delta, delta);
+    __m128i a1 = _mm_srli_epi64(_mm_add_epi64(a.val, delta2.val), n);
+    __m128i a2 = _mm_shuffle_epi32(a1, _MM_SHUFFLE(0, 2, 2, 0));
+    _mm_storel_epi64((__m128i*)ptr, a2);
+}
+
+inline __m128i v_sign_epi64(__m128i a)
+{
+    return _mm_shuffle_epi32(_mm_srai_epi32(a, 31), _MM_SHUFFLE(3, 3, 1, 1)); // x m0 | x m1
+}
+
+inline __m128i v_srai_epi64(__m128i a, int imm)
+{
+    __m128i smask = v_sign_epi64(a);
+    return _mm_xor_si128(_mm_srli_epi64(_mm_xor_si128(a, smask), imm), smask);
+}
+
+template<int n> inline
+v_int32x4 v_rshr_pack(const v_int64x2& a, const v_int64x2& b)
+{
+    int64 delta = (int64)1 << (n-1);
+    v_int64x2 delta2(delta, delta);
+    __m128i a1 = v_srai_epi64(_mm_add_epi64(a.val, delta2.val), n);
+    __m128i b1 = v_srai_epi64(_mm_add_epi64(b.val, delta2.val), n);
+    __m128i v0 = _mm_unpacklo_epi32(a1, b1); // a0 a1 0 0
+    __m128i v1 = _mm_unpackhi_epi32(a1, b1); // b0 b1 0 0
+    return v_int32x4(_mm_unpacklo_epi32(v0, v1));
+}
+
+template<int n> inline
+void v_rshr_pack_store(int* ptr, const v_int64x2& a)
+{
+    int64 delta = (int64)1 << (n-1);
+    v_int64x2 delta2(delta, delta);
+    __m128i a1 = v_srai_epi64(_mm_add_epi64(a.val, delta2.val), n);
+    __m128i a2 = _mm_shuffle_epi32(a1, _MM_SHUFFLE(0, 2, 2, 0));
+    _mm_storel_epi64((__m128i*)ptr, a2);
+}
+
+inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0,
+                            const v_float32x4& m1, const v_float32x4& m2,
+                            const v_float32x4& m3)
+{
+    __m128 v0 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(0, 0, 0, 0)), m0.val);
+    __m128 v1 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(1, 1, 1, 1)), m1.val);
+    __m128 v2 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(2, 2, 2, 2)), m2.val);
+    __m128 v3 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(3, 3, 3, 3)), m3.val);
+
+    return v_float32x4(_mm_add_ps(_mm_add_ps(v0, v1), _mm_add_ps(v2, v3)));
+}
+
+
+#define OPENCV_HAL_IMPL_SSE_BIN_OP(bin_op, _Tpvec, intrin) \
+    inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \
+    { \
+        return _Tpvec(intrin(a.val, b.val)); \
+    } \
+    inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \
+    { \
+        a.val = intrin(a.val, b.val); \
+        return a; \
+    }
+
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint8x16, _mm_adds_epu8)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint8x16, _mm_subs_epu8)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int8x16, _mm_adds_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int8x16, _mm_subs_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint16x8, _mm_adds_epu16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint16x8, _mm_subs_epu16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_uint16x8, _mm_mullo_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int16x8, _mm_adds_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int16x8, _mm_subs_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_int16x8, _mm_mullo_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint32x4, _mm_add_epi32)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint32x4, _mm_sub_epi32)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int32x4, _mm_add_epi32)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int32x4, _mm_sub_epi32)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_float32x4, _mm_add_ps)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_float32x4, _mm_sub_ps)
+OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_float32x4, _mm_mul_ps)
+OPENCV_HAL_IMPL_SSE_BIN_OP(/, v_float32x4, _mm_div_ps)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_float64x2, _mm_add_pd)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_float64x2, _mm_sub_pd)
+OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_float64x2, _mm_mul_pd)
+OPENCV_HAL_IMPL_SSE_BIN_OP(/, v_float64x2, _mm_div_pd)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint64x2, _mm_add_epi64)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint64x2, _mm_sub_epi64)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int64x2, _mm_add_epi64)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int64x2, _mm_sub_epi64)
+
+inline v_uint32x4 operator * (const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i c0 = _mm_mul_epu32(a.val, b.val);
+    __m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a.val, 32), _mm_srli_epi64(b.val, 32));
+    __m128i d0 = _mm_unpacklo_epi32(c0, c1);
+    __m128i d1 = _mm_unpackhi_epi32(c0, c1);
+    return v_uint32x4(_mm_unpacklo_epi64(d0, d1));
+}
+inline v_int32x4 operator * (const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i c0 = _mm_mul_epu32(a.val, b.val);
+    __m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a.val, 32), _mm_srli_epi64(b.val, 32));
+    __m128i d0 = _mm_unpacklo_epi32(c0, c1);
+    __m128i d1 = _mm_unpackhi_epi32(c0, c1);
+    return v_int32x4(_mm_unpacklo_epi64(d0, d1));
+}
+inline v_uint32x4& operator *= (v_uint32x4& a, const v_uint32x4& b)
+{
+    a = a * b;
+    return a;
+}
+inline v_int32x4& operator *= (v_int32x4& a, const v_int32x4& b)
+{
+    a = a * b;
+    return a;
+}
+
+inline void v_mul_expand(const v_int16x8& a, const v_int16x8& b,
+                         v_int32x4& c, v_int32x4& d)
+{
+    __m128i v0 = _mm_mullo_epi16(a.val, b.val);
+    __m128i v1 = _mm_mulhi_epi16(a.val, b.val);
+    c.val = _mm_unpacklo_epi16(v0, v1);
+    d.val = _mm_unpackhi_epi16(v0, v1);
+}
+
+inline void v_mul_expand(const v_uint16x8& a, const v_uint16x8& b,
+                         v_uint32x4& c, v_uint32x4& d)
+{
+    __m128i v0 = _mm_mullo_epi16(a.val, b.val);
+    __m128i v1 = _mm_mulhi_epu16(a.val, b.val);
+    c.val = _mm_unpacklo_epi16(v0, v1);
+    d.val = _mm_unpackhi_epi16(v0, v1);
+}
+
+inline void v_mul_expand(const v_uint32x4& a, const v_uint32x4& b,
+                         v_uint64x2& c, v_uint64x2& d)
+{
+    __m128i c0 = _mm_mul_epu32(a.val, b.val);
+    __m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a.val, 32), _mm_srli_epi64(b.val, 32));
+    c.val = _mm_unpacklo_epi64(c0, c1);
+    d.val = _mm_unpackhi_epi64(c0, c1);
+}
+
+inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b)
+{
+    return v_int32x4(_mm_madd_epi16(a.val, b.val));
+}
+
+#define OPENCV_HAL_IMPL_SSE_LOGIC_OP(_Tpvec, suffix, not_const) \
+    OPENCV_HAL_IMPL_SSE_BIN_OP(&, _Tpvec, _mm_and_##suffix) \
+    OPENCV_HAL_IMPL_SSE_BIN_OP(|, _Tpvec, _mm_or_##suffix) \
+    OPENCV_HAL_IMPL_SSE_BIN_OP(^, _Tpvec, _mm_xor_##suffix) \
+    inline _Tpvec operator ~ (const _Tpvec& a) \
+    { \
+        return _Tpvec(_mm_xor_##suffix(a.val, not_const)); \
+    }
+
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint8x16, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int8x16, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint16x8, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int16x8, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint32x4, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int32x4, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint64x2, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int64x2, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_float32x4, ps, _mm_castsi128_ps(_mm_set1_epi32(-1)))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_float64x2, pd, _mm_castsi128_pd(_mm_set1_epi32(-1)))
+
+inline v_float32x4 v_sqrt(const v_float32x4& x)
+{ return v_float32x4(_mm_sqrt_ps(x.val)); }
+
+inline v_float32x4 v_invsqrt(const v_float32x4& x)
+{
+    static const __m128 _0_5 = _mm_set1_ps(0.5f), _1_5 = _mm_set1_ps(1.5f);
+    __m128 t = x.val;
+    __m128 h = _mm_mul_ps(t, _0_5);
+    t = _mm_rsqrt_ps(t);
+    t = _mm_mul_ps(t, _mm_sub_ps(_1_5, _mm_mul_ps(_mm_mul_ps(t, t), h)));
+    return v_float32x4(t);
+}
+
+inline v_float64x2 v_sqrt(const v_float64x2& x)
+{ return v_float64x2(_mm_sqrt_pd(x.val)); }
+
+inline v_float64x2 v_invsqrt(const v_float64x2& x)
+{
+    static const __m128d v_1 = _mm_set1_pd(1.);
+    return v_float64x2(_mm_div_pd(v_1, _mm_sqrt_pd(x.val)));
+}
+
+inline v_float32x4 v_abs(const v_float32x4& x)
+{ return v_float32x4(_mm_and_ps(x.val, _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff)))); }
+inline v_float64x2 v_abs(const v_float64x2& x)
+{
+    return v_float64x2(_mm_and_pd(x.val,
+        _mm_castsi128_pd(_mm_srli_epi64(_mm_set1_epi32(-1), 1))));
+}
+
+// TODO: exp, log, sin, cos
+
+#define OPENCV_HAL_IMPL_SSE_BIN_FUNC(_Tpvec, func, intrin) \
+inline _Tpvec func(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(intrin(a.val, b.val)); \
+}
+
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_min, _mm_min_epu8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_max, _mm_max_epu8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_min, _mm_min_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_max, _mm_max_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float32x4, v_min, _mm_min_ps)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float32x4, v_max, _mm_max_ps)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float64x2, v_min, _mm_min_pd)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float64x2, v_max, _mm_max_pd)
+
+inline v_int8x16 v_min(const v_int8x16& a, const v_int8x16& b)
+{
+    __m128i delta = _mm_set1_epi8((char)-128);
+    return v_int8x16(_mm_xor_si128(delta, _mm_min_epu8(_mm_xor_si128(a.val, delta),
+                                                       _mm_xor_si128(b.val, delta))));
+}
+inline v_int8x16 v_max(const v_int8x16& a, const v_int8x16& b)
+{
+    __m128i delta = _mm_set1_epi8((char)-128);
+    return v_int8x16(_mm_xor_si128(delta, _mm_max_epu8(_mm_xor_si128(a.val, delta),
+                                                       _mm_xor_si128(b.val, delta))));
+}
+inline v_uint16x8 v_min(const v_uint16x8& a, const v_uint16x8& b)
+{
+    return v_uint16x8(_mm_subs_epu16(a.val, _mm_subs_epu16(a.val, b.val)));
+}
+inline v_uint16x8 v_max(const v_uint16x8& a, const v_uint16x8& b)
+{
+    return v_uint16x8(_mm_adds_epu16(_mm_subs_epu16(a.val, b.val), b.val));
+}
+inline v_uint32x4 v_min(const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i delta = _mm_set1_epi32((int)0x80000000);
+    __m128i mask = _mm_cmpgt_epi32(_mm_xor_si128(a.val, delta), _mm_xor_si128(b.val, delta));
+    return v_uint32x4(v_select_si128(mask, b.val, a.val));
+}
+inline v_uint32x4 v_max(const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i delta = _mm_set1_epi32((int)0x80000000);
+    __m128i mask = _mm_cmpgt_epi32(_mm_xor_si128(a.val, delta), _mm_xor_si128(b.val, delta));
+    return v_uint32x4(v_select_si128(mask, a.val, b.val));
+}
+inline v_int32x4 v_min(const v_int32x4& a, const v_int32x4& b)
+{
+    return v_int32x4(v_select_si128(_mm_cmpgt_epi32(a.val, b.val), b.val, a.val));
+}
+inline v_int32x4 v_max(const v_int32x4& a, const v_int32x4& b)
+{
+    return v_int32x4(v_select_si128(_mm_cmpgt_epi32(a.val, b.val), a.val, b.val));
+}
+
+#define OPENCV_HAL_IMPL_SSE_INT_CMP_OP(_Tpuvec, _Tpsvec, suffix, sbit) \
+inline _Tpuvec operator == (const _Tpuvec& a, const _Tpuvec& b) \
+{ return _Tpuvec(_mm_cmpeq_##suffix(a.val, b.val)); } \
+inline _Tpuvec operator != (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    return _Tpuvec(_mm_xor_si128(_mm_cmpeq_##suffix(a.val, b.val), not_mask)); \
+} \
+inline _Tpsvec operator == (const _Tpsvec& a, const _Tpsvec& b) \
+{ return _Tpsvec(_mm_cmpeq_##suffix(a.val, b.val)); } \
+inline _Tpsvec operator != (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    return _Tpsvec(_mm_xor_si128(_mm_cmpeq_##suffix(a.val, b.val), not_mask)); \
+} \
+inline _Tpuvec operator < (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i smask = _mm_set1_##suffix(sbit); \
+    return _Tpuvec(_mm_cmpgt_##suffix(_mm_xor_si128(b.val, smask), _mm_xor_si128(a.val, smask))); \
+} \
+inline _Tpuvec operator > (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i smask = _mm_set1_##suffix(sbit); \
+    return _Tpuvec(_mm_cmpgt_##suffix(_mm_xor_si128(a.val, smask), _mm_xor_si128(b.val, smask))); \
+} \
+inline _Tpuvec operator <= (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i smask = _mm_set1_##suffix(sbit); \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    __m128i res = _mm_cmpgt_##suffix(_mm_xor_si128(a.val, smask), _mm_xor_si128(b.val, smask)); \
+    return _Tpuvec(_mm_xor_si128(res, not_mask)); \
+} \
+inline _Tpuvec operator >= (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i smask = _mm_set1_##suffix(sbit); \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    __m128i res = _mm_cmpgt_##suffix(_mm_xor_si128(b.val, smask), _mm_xor_si128(a.val, smask)); \
+    return _Tpuvec(_mm_xor_si128(res, not_mask)); \
+} \
+inline _Tpsvec operator < (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    return _Tpsvec(_mm_cmpgt_##suffix(b.val, a.val)); \
+} \
+inline _Tpsvec operator > (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    return _Tpsvec(_mm_cmpgt_##suffix(a.val, b.val)); \
+} \
+inline _Tpsvec operator <= (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    return _Tpsvec(_mm_xor_si128(_mm_cmpgt_##suffix(a.val, b.val), not_mask)); \
+} \
+inline _Tpsvec operator >= (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    return _Tpsvec(_mm_xor_si128(_mm_cmpgt_##suffix(b.val, a.val), not_mask)); \
+}
+
+OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint8x16, v_int8x16, epi8, (char)-128)
+OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint16x8, v_int16x8, epi16, (short)-32768)
+OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint32x4, v_int32x4, epi32, (int)0x80000000)
+
+#define OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(_Tpvec, suffix) \
+inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmpeq_##suffix(a.val, b.val)); } \
+inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmpneq_##suffix(a.val, b.val)); } \
+inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmplt_##suffix(a.val, b.val)); } \
+inline _Tpvec operator > (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmpgt_##suffix(a.val, b.val)); } \
+inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmple_##suffix(a.val, b.val)); } \
+inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmpge_##suffix(a.val, b.val)); }
+
+OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(v_float32x4, ps)
+OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(v_float64x2, pd)
+
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_add_wrap, _mm_add_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int8x16, v_add_wrap, _mm_add_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint16x8, v_add_wrap, _mm_add_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_add_wrap, _mm_add_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_sub_wrap, _mm_sub_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int8x16, v_sub_wrap, _mm_sub_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint16x8, v_sub_wrap, _mm_sub_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_sub_wrap, _mm_sub_epi16)
+
+#define OPENCV_HAL_IMPL_SSE_ABSDIFF_8_16(_Tpuvec, _Tpsvec, bits, smask32) \
+inline _Tpuvec v_absdiff(const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    return _Tpuvec(_mm_add_epi##bits(_mm_subs_epu##bits(a.val, b.val), _mm_subs_epu##bits(b.val, a.val))); \
+} \
+inline _Tpuvec v_absdiff(const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    __m128i smask = _mm_set1_epi32(smask32); \
+    __m128i a1 = _mm_xor_si128(a.val, smask); \
+    __m128i b1 = _mm_xor_si128(b.val, smask); \
+    return _Tpuvec(_mm_add_epi##bits(_mm_subs_epu##bits(a1, b1), _mm_subs_epu##bits(b1, a1))); \
+}
+
+OPENCV_HAL_IMPL_SSE_ABSDIFF_8_16(v_uint8x16, v_int8x16, 8, (int)0x80808080)
+OPENCV_HAL_IMPL_SSE_ABSDIFF_8_16(v_uint16x8, v_int16x8, 16, (int)0x80008000)
+
+inline v_uint32x4 v_absdiff(const v_uint32x4& a, const v_uint32x4& b)
+{
+    return v_max(a, b) - v_min(a, b);
+}
+
+inline v_uint32x4 v_absdiff(const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i d = _mm_sub_epi32(a.val, b.val);
+    __m128i m = _mm_cmpgt_epi32(b.val, a.val);
+    return v_uint32x4(_mm_sub_epi32(_mm_xor_si128(d, m), m));
+}
+
+#define OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(_Tpvec, _Tp, _Tpreg, suffix, absmask_vec) \
+inline _Tpvec v_absdiff(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpreg absmask = _mm_castsi128_##suffix(absmask_vec); \
+    return _Tpvec(_mm_and_##suffix(_mm_sub_##suffix(a.val, b.val), absmask)); \
+} \
+inline _Tpvec v_magnitude(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpreg res = _mm_add_##suffix(_mm_mul_##suffix(a.val, a.val), _mm_mul_##suffix(b.val, b.val)); \
+    return _Tpvec(_mm_sqrt_##suffix(res)); \
+} \
+inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpreg res = _mm_add_##suffix(_mm_mul_##suffix(a.val, a.val), _mm_mul_##suffix(b.val, b.val)); \
+    return _Tpvec(res); \
+} \
+inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
+{ \
+    return _Tpvec(_mm_add_##suffix(_mm_mul_##suffix(a.val, b.val), c.val)); \
+}
+
+OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(v_float32x4, float, __m128, ps, _mm_set1_epi32((int)0x7fffffff))
+OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(v_float64x2, double, __m128d, pd, _mm_srli_epi64(_mm_set1_epi32(-1), 1))
+
+#define OPENCV_HAL_IMPL_SSE_SHIFT_OP(_Tpuvec, _Tpsvec, suffix, srai) \
+inline _Tpuvec operator << (const _Tpuvec& a, int imm) \
+{ \
+    return _Tpuvec(_mm_slli_##suffix(a.val, imm)); \
+} \
+inline _Tpsvec operator << (const _Tpsvec& a, int imm) \
+{ \
+    return _Tpsvec(_mm_slli_##suffix(a.val, imm)); \
+} \
+inline _Tpuvec operator >> (const _Tpuvec& a, int imm) \
+{ \
+    return _Tpuvec(_mm_srli_##suffix(a.val, imm)); \
+} \
+inline _Tpsvec operator >> (const _Tpsvec& a, int imm) \
+{ \
+    return _Tpsvec(srai(a.val, imm)); \
+} \
+template<int imm> \
+inline _Tpuvec v_shl(const _Tpuvec& a) \
+{ \
+    return _Tpuvec(_mm_slli_##suffix(a.val, imm)); \
+} \
+template<int imm> \
+inline _Tpsvec v_shl(const _Tpsvec& a) \
+{ \
+    return _Tpsvec(_mm_slli_##suffix(a.val, imm)); \
+} \
+template<int imm> \
+inline _Tpuvec v_shr(const _Tpuvec& a) \
+{ \
+    return _Tpuvec(_mm_srli_##suffix(a.val, imm)); \
+} \
+template<int imm> \
+inline _Tpsvec v_shr(const _Tpsvec& a) \
+{ \
+    return _Tpsvec(srai(a.val, imm)); \
+}
+
+OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint16x8, v_int16x8, epi16, _mm_srai_epi16)
+OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint32x4, v_int32x4, epi32, _mm_srai_epi32)
+OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint64x2, v_int64x2, epi64, v_srai_epi64)
+
+#define OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(_Tpvec, _Tp) \
+inline _Tpvec v_load(const _Tp* ptr) \
+{ return _Tpvec(_mm_loadu_si128((const __m128i*)ptr)); } \
+inline _Tpvec v_load_aligned(const _Tp* ptr) \
+{ return _Tpvec(_mm_load_si128((const __m128i*)ptr)); } \
+inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \
+{ \
+    return _Tpvec(_mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i*)ptr0), \
+                                     _mm_loadl_epi64((const __m128i*)ptr1))); \
+} \
+inline void v_store(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storeu_si128((__m128i*)ptr, a.val); } \
+inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \
+{ _mm_store_si128((__m128i*)ptr, a.val); } \
+inline void v_store_low(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storel_epi64((__m128i*)ptr, a.val); } \
+inline void v_store_high(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storel_epi64((__m128i*)ptr, _mm_unpackhi_epi64(a.val, a.val)); }
+
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint8x16, uchar)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int8x16, schar)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint16x8, ushort)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int16x8, short)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint32x4, unsigned)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int32x4, int)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint64x2, uint64)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int64x2, int64)
+
+#define OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(_Tpvec, _Tp, suffix) \
+inline _Tpvec v_load(const _Tp* ptr) \
+{ return _Tpvec(_mm_loadu_##suffix(ptr)); } \
+inline _Tpvec v_load_aligned(const _Tp* ptr) \
+{ return _Tpvec(_mm_load_##suffix(ptr)); } \
+inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \
+{ \
+    return _Tpvec(_mm_castsi128_##suffix( \
+        _mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i*)ptr0), \
+                           _mm_loadl_epi64((const __m128i*)ptr1)))); \
+} \
+inline void v_store(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storeu_##suffix(ptr, a.val); } \
+inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \
+{ _mm_store_##suffix(ptr, a.val); } \
+inline void v_store_low(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storel_epi64((__m128i*)ptr, _mm_cast##suffix##_si128(a.val)); } \
+inline void v_store_high(_Tp* ptr, const _Tpvec& a) \
+{ \
+    __m128i a1 = _mm_cast##suffix##_si128(a.val); \
+    _mm_storel_epi64((__m128i*)ptr, _mm_unpackhi_epi64(a1, a1)); \
+}
+
+OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(v_float32x4, float, ps)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(v_float64x2, double, pd)
+
+#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(_Tpvec, scalartype, func, scalar_func) \
+inline scalartype v_reduce_##func(const _Tpvec& a) \
+{ \
+    scalartype CV_DECL_ALIGNED(16) buf[4]; \
+    v_store_aligned(buf, a); \
+    scalartype s0 = scalar_func(buf[0], buf[1]); \
+    scalartype s1 = scalar_func(buf[2], buf[3]); \
+    return scalar_func(s0, s1); \
+}
+
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_uint32x4, unsigned, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_uint32x4, unsigned, max, std::max)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_uint32x4, unsigned, min, std::min)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_int32x4, int, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_int32x4, int, max, std::max)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_int32x4, int, min, std::min)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_float32x4, float, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_float32x4, float, max, std::max)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_float32x4, float, min, std::min)
+
+#define OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(_Tpvec, suffix, pack_op, and_op, signmask, allmask) \
+inline int v_signmask(const _Tpvec& a) \
+{ \
+    return and_op(_mm_movemask_##suffix(pack_op(a.val)), signmask); \
+} \
+inline bool v_check_all(const _Tpvec& a) \
+{ return and_op(_mm_movemask_##suffix(a.val), allmask) == allmask; } \
+inline bool v_check_any(const _Tpvec& a) \
+{ return and_op(_mm_movemask_##suffix(a.val), allmask) != 0; }
+
+#define OPENCV_HAL_PACKS(a) _mm_packs_epi16(a, a)
+inline __m128i v_packq_epi32(__m128i a)
+{
+    __m128i b = _mm_packs_epi32(a, a);
+    return _mm_packs_epi16(b, b);
+}
+
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 65535, 65535)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 65535, 65535)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint16x8, epi8, OPENCV_HAL_PACKS, OPENCV_HAL_AND, 255, (int)0xaaaa)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int16x8, epi8, OPENCV_HAL_PACKS, OPENCV_HAL_AND, 255, (int)0xaaaa)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint32x4, epi8, v_packq_epi32, OPENCV_HAL_AND, 15, (int)0x8888)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int32x4, epi8, v_packq_epi32, OPENCV_HAL_AND, 15, (int)0x8888)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_float32x4, ps, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 15, 15)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_float64x2, pd, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 3, 3)
+
+#define OPENCV_HAL_IMPL_SSE_SELECT(_Tpvec, suffix) \
+inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(_mm_xor_##suffix(b.val, _mm_and_##suffix(_mm_xor_##suffix(b.val, a.val), mask.val))); \
+}
+
+OPENCV_HAL_IMPL_SSE_SELECT(v_uint8x16, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_int8x16, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_uint16x8, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_int16x8, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_uint32x4, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_int32x4, si128)
+// OPENCV_HAL_IMPL_SSE_SELECT(v_uint64x2, si128)
+// OPENCV_HAL_IMPL_SSE_SELECT(v_int64x2, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_float32x4, ps)
+OPENCV_HAL_IMPL_SSE_SELECT(v_float64x2, pd)
+
+#define OPENCV_HAL_IMPL_SSE_EXPAND(_Tpuvec, _Tpwuvec, _Tpu, _Tpsvec, _Tpwsvec, _Tps, suffix, wsuffix, shift) \
+inline void v_expand(const _Tpuvec& a, _Tpwuvec& b0, _Tpwuvec& b1) \
+{ \
+    __m128i z = _mm_setzero_si128(); \
+    b0.val = _mm_unpacklo_##suffix(a.val, z); \
+    b1.val = _mm_unpackhi_##suffix(a.val, z); \
+} \
+inline _Tpwuvec v_load_expand(const _Tpu* ptr) \
+{ \
+    __m128i z = _mm_setzero_si128(); \
+    return _Tpwuvec(_mm_unpacklo_##suffix(_mm_loadl_epi64((const __m128i*)ptr), z)); \
+} \
+inline void v_expand(const _Tpsvec& a, _Tpwsvec& b0, _Tpwsvec& b1) \
+{ \
+    b0.val = _mm_srai_##wsuffix(_mm_unpacklo_##suffix(a.val, a.val), shift); \
+    b1.val = _mm_srai_##wsuffix(_mm_unpackhi_##suffix(a.val, a.val), shift); \
+} \
+inline _Tpwsvec v_load_expand(const _Tps* ptr) \
+{ \
+    __m128i a = _mm_loadl_epi64((const __m128i*)ptr); \
+    return _Tpwsvec(_mm_srai_##wsuffix(_mm_unpacklo_##suffix(a, a), shift)); \
+}
+
+OPENCV_HAL_IMPL_SSE_EXPAND(v_uint8x16, v_uint16x8, uchar, v_int8x16, v_int16x8, schar, epi8, epi16, 8)
+OPENCV_HAL_IMPL_SSE_EXPAND(v_uint16x8, v_uint32x4, ushort, v_int16x8, v_int32x4, short, epi16, epi32, 16)
+
+inline void v_expand(const v_uint32x4& a, v_uint64x2& b0, v_uint64x2& b1)
+{
+    __m128i z = _mm_setzero_si128();
+    b0.val = _mm_unpacklo_epi32(a.val, z);
+    b1.val = _mm_unpackhi_epi32(a.val, z);
+}
+inline v_uint64x2 v_load_expand(const unsigned* ptr)
+{
+    __m128i z = _mm_setzero_si128();
+    return v_uint64x2(_mm_unpacklo_epi32(_mm_loadl_epi64((const __m128i*)ptr), z));
+}
+inline void v_expand(const v_int32x4& a, v_int64x2& b0, v_int64x2& b1)
+{
+    __m128i s = _mm_srai_epi32(a.val, 31);
+    b0.val = _mm_unpacklo_epi32(a.val, s);
+    b1.val = _mm_unpackhi_epi32(a.val, s);
+}
+inline v_int64x2 v_load_expand(const int* ptr)
+{
+    __m128i a = _mm_loadl_epi64((const __m128i*)ptr);
+    __m128i s = _mm_srai_epi32(a, 31);
+    return v_int64x2(_mm_unpacklo_epi32(a, s));
+}
+
+inline v_uint32x4 v_load_expand_q(const uchar* ptr)
+{
+    __m128i z = _mm_setzero_si128();
+    __m128i a = _mm_cvtsi32_si128(*(const int*)ptr);
+    return v_uint32x4(_mm_unpacklo_epi16(_mm_unpacklo_epi8(a, z), z));
+}
+
+inline v_int32x4 v_load_expand_q(const schar* ptr)
+{
+    __m128i a = _mm_cvtsi32_si128(*(const int*)ptr);
+    a = _mm_unpacklo_epi8(a, a);
+    a = _mm_unpacklo_epi8(a, a);
+    return v_int32x4(_mm_srai_epi32(a, 24));
+}
+
+#define OPENCV_HAL_IMPL_SSE_UNPACKS(_Tpvec, suffix, cast_from, cast_to) \
+inline void v_zip(const _Tpvec& a0, const _Tpvec& a1, _Tpvec& b0, _Tpvec& b1) \
+{ \
+    b0.val = _mm_unpacklo_##suffix(a0.val, a1.val); \
+    b1.val = _mm_unpackhi_##suffix(a0.val, a1.val); \
+} \
+inline _Tpvec v_combine_low(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \
+    return _Tpvec(cast_to(_mm_unpacklo_epi64(a1, b1))); \
+} \
+inline _Tpvec v_combine_high(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \
+    return _Tpvec(cast_to(_mm_unpackhi_epi64(a1, b1))); \
+} \
+inline void v_recombine(const _Tpvec& a, const _Tpvec& b, _Tpvec& c, _Tpvec& d) \
+{ \
+    __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \
+    c.val = cast_to(_mm_unpacklo_epi64(a1, b1)); \
+    d.val = cast_to(_mm_unpackhi_epi64(a1, b1)); \
+}
+
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_int8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint16x8, epi16, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_int16x8, epi16, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_int32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_float32x4, ps, _mm_castps_si128, _mm_castsi128_ps)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_float64x2, pd, _mm_castpd_si128, _mm_castsi128_pd)
+
+template<int s, typename _Tpvec>
+inline _Tpvec v_extract(const _Tpvec& a, const _Tpvec& b)
+{
+    const int w = sizeof(typename _Tpvec::lane_type);
+    const int n = _Tpvec::nlanes;
+    __m128i ra, rb;
+    ra = _mm_srli_si128(a.val, s*w);
+    rb = _mm_slli_si128(b.val, (n-s)*w);
+    return _Tpvec(_mm_or_si128(ra, rb));
+}
+
+inline v_int32x4 v_round(const v_float32x4& a)
+{ return v_int32x4(_mm_cvtps_epi32(a.val)); }
+
+inline v_int32x4 v_floor(const v_float32x4& a)
+{
+    __m128i a1 = _mm_cvtps_epi32(a.val);
+    __m128i mask = _mm_castps_si128(_mm_cmpgt_ps(_mm_cvtepi32_ps(a1), a.val));
+    return v_int32x4(_mm_add_epi32(a1, mask));
+}
+
+inline v_int32x4 v_ceil(const v_float32x4& a)
+{
+    __m128i a1 = _mm_cvtps_epi32(a.val);
+    __m128i mask = _mm_castps_si128(_mm_cmpgt_ps(a.val, _mm_cvtepi32_ps(a1)));
+    return v_int32x4(_mm_sub_epi32(a1, mask));
+}
+
+inline v_int32x4 v_trunc(const v_float32x4& a)
+{ return v_int32x4(_mm_cvttps_epi32(a.val)); }
+
+inline v_int32x4 v_round(const v_float64x2& a)
+{ return v_int32x4(_mm_cvtpd_epi32(a.val)); }
+
+inline v_int32x4 v_floor(const v_float64x2& a)
+{
+    __m128i a1 = _mm_cvtpd_epi32(a.val);
+    __m128i mask = _mm_castpd_si128(_mm_cmpgt_pd(_mm_cvtepi32_pd(a1), a.val));
+    mask = _mm_srli_si128(_mm_slli_si128(mask, 4), 8); // m0 m0 m1 m1 => m0 m1 0 0
+    return v_int32x4(_mm_add_epi32(a1, mask));
+}
+
+inline v_int32x4 v_ceil(const v_float64x2& a)
+{
+    __m128i a1 = _mm_cvtpd_epi32(a.val);
+    __m128i mask = _mm_castpd_si128(_mm_cmpgt_pd(a.val, _mm_cvtepi32_pd(a1)));
+    mask = _mm_srli_si128(_mm_slli_si128(mask, 4), 8); // m0 m0 m1 m1 => m0 m1 0 0
+    return v_int32x4(_mm_sub_epi32(a1, mask));
+}
+
+inline v_int32x4 v_trunc(const v_float64x2& a)
+{ return v_int32x4(_mm_cvttpd_epi32(a.val)); }
+
+#define OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(_Tpvec, suffix, cast_from, cast_to) \
+inline void v_transpose4x4(const _Tpvec& a0, const _Tpvec& a1, \
+                           const _Tpvec& a2, const _Tpvec& a3, \
+                           _Tpvec& b0, _Tpvec& b1, \
+                           _Tpvec& b2, _Tpvec& b3) \
+{ \
+    __m128i t0 = cast_from(_mm_unpacklo_##suffix(a0.val, a1.val)); \
+    __m128i t1 = cast_from(_mm_unpacklo_##suffix(a2.val, a3.val)); \
+    __m128i t2 = cast_from(_mm_unpackhi_##suffix(a0.val, a1.val)); \
+    __m128i t3 = cast_from(_mm_unpackhi_##suffix(a2.val, a3.val)); \
+\
+    b0.val = cast_to(_mm_unpacklo_epi64(t0, t1)); \
+    b1.val = cast_to(_mm_unpackhi_epi64(t0, t1)); \
+    b2.val = cast_to(_mm_unpacklo_epi64(t2, t3)); \
+    b3.val = cast_to(_mm_unpackhi_epi64(t2, t3)); \
+}
+
+OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_uint32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_int32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_float32x4, ps, _mm_castps_si128, _mm_castsi128_ps)
+
+// adopted from sse_utils.hpp
+inline void v_load_deinterleave(const uchar* ptr, v_uint8x16& a, v_uint8x16& b, v_uint8x16& c)
+{
+    __m128i t00 = _mm_loadu_si128((const __m128i*)ptr);
+    __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 16));
+    __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 32));
+
+    __m128i t10 = _mm_unpacklo_epi8(t00, _mm_unpackhi_epi64(t01, t01));
+    __m128i t11 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t00, t00), t02);
+    __m128i t12 = _mm_unpacklo_epi8(t01, _mm_unpackhi_epi64(t02, t02));
+
+    __m128i t20 = _mm_unpacklo_epi8(t10, _mm_unpackhi_epi64(t11, t11));
+    __m128i t21 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t10, t10), t12);
+    __m128i t22 = _mm_unpacklo_epi8(t11, _mm_unpackhi_epi64(t12, t12));
+
+    __m128i t30 = _mm_unpacklo_epi8(t20, _mm_unpackhi_epi64(t21, t21));
+    __m128i t31 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t20, t20), t22);
+    __m128i t32 = _mm_unpacklo_epi8(t21, _mm_unpackhi_epi64(t22, t22));
+
+    a.val = _mm_unpacklo_epi8(t30, _mm_unpackhi_epi64(t31, t31));
+    b.val = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t30, t30), t32);
+    c.val = _mm_unpacklo_epi8(t31, _mm_unpackhi_epi64(t32, t32));
+}
+
+inline void v_load_deinterleave(const uchar* ptr, v_uint8x16& a, v_uint8x16& b, v_uint8x16& c, v_uint8x16& d)
+{
+    __m128i u0 = _mm_loadu_si128((const __m128i*)ptr); // a0 b0 c0 d0 a1 b1 c1 d1 ...
+    __m128i u1 = _mm_loadu_si128((const __m128i*)(ptr + 16)); // a4 b4 c4 d4 ...
+    __m128i u2 = _mm_loadu_si128((const __m128i*)(ptr + 32)); // a8 b8 c8 d8 ...
+    __m128i u3 = _mm_loadu_si128((const __m128i*)(ptr + 48)); // a12 b12 c12 d12 ...
+
+    __m128i v0 = _mm_unpacklo_epi8(u0, u2); // a0 a8 b0 b8 ...
+    __m128i v1 = _mm_unpackhi_epi8(u0, u2); // a2 a10 b2 b10 ...
+    __m128i v2 = _mm_unpacklo_epi8(u1, u3); // a4 a12 b4 b12 ...
+    __m128i v3 = _mm_unpackhi_epi8(u1, u3); // a6 a14 b6 b14 ...
+
+    u0 = _mm_unpacklo_epi8(v0, v2); // a0 a4 a8 a12 ...
+    u1 = _mm_unpacklo_epi8(v1, v3); // a2 a6 a10 a14 ...
+    u2 = _mm_unpackhi_epi8(v0, v2); // a1 a5 a9 a13 ...
+    u3 = _mm_unpackhi_epi8(v1, v3); // a3 a7 a11 a15 ...
+
+    v0 = _mm_unpacklo_epi8(u0, u1); // a0 a2 a4 a6 ...
+    v1 = _mm_unpacklo_epi8(u2, u3); // a1 a3 a5 a7 ...
+    v2 = _mm_unpackhi_epi8(u0, u1); // c0 c2 c4 c6 ...
+    v3 = _mm_unpackhi_epi8(u2, u3); // c1 c3 c5 c7 ...
+
+    a.val = _mm_unpacklo_epi8(v0, v1);
+    b.val = _mm_unpackhi_epi8(v0, v1);
+    c.val = _mm_unpacklo_epi8(v2, v3);
+    d.val = _mm_unpackhi_epi8(v2, v3);
+}
+
+inline void v_load_deinterleave(const ushort* ptr, v_uint16x8& a, v_uint16x8& b, v_uint16x8& c)
+{
+    __m128i t00 = _mm_loadu_si128((const __m128i*)ptr);
+    __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 8));
+    __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 16));
+
+    __m128i t10 = _mm_unpacklo_epi16(t00, _mm_unpackhi_epi64(t01, t01));
+    __m128i t11 = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t00, t00), t02);
+    __m128i t12 = _mm_unpacklo_epi16(t01, _mm_unpackhi_epi64(t02, t02));
+
+    __m128i t20 = _mm_unpacklo_epi16(t10, _mm_unpackhi_epi64(t11, t11));
+    __m128i t21 = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t10, t10), t12);
+    __m128i t22 = _mm_unpacklo_epi16(t11, _mm_unpackhi_epi64(t12, t12));
+
+    a.val = _mm_unpacklo_epi16(t20, _mm_unpackhi_epi64(t21, t21));
+    b.val = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t20, t20), t22);
+    c.val = _mm_unpacklo_epi16(t21, _mm_unpackhi_epi64(t22, t22));
+}
+
+inline void v_load_deinterleave(const ushort* ptr, v_uint16x8& a, v_uint16x8& b, v_uint16x8& c, v_uint16x8& d)
+{
+    __m128i u0 = _mm_loadu_si128((const __m128i*)ptr); // a0 b0 c0 d0 a1 b1 c1 d1
+    __m128i u1 = _mm_loadu_si128((const __m128i*)(ptr + 8)); // a2 b2 c2 d2 ...
+    __m128i u2 = _mm_loadu_si128((const __m128i*)(ptr + 16)); // a4 b4 c4 d4 ...
+    __m128i u3 = _mm_loadu_si128((const __m128i*)(ptr + 24)); // a6 b6 c6 d6 ...
+
+    __m128i v0 = _mm_unpacklo_epi16(u0, u2); // a0 a4 b0 b4 ...
+    __m128i v1 = _mm_unpackhi_epi16(u0, u2); // a1 a5 b1 b5 ...
+    __m128i v2 = _mm_unpacklo_epi16(u1, u3); // a2 a6 b2 b6 ...
+    __m128i v3 = _mm_unpackhi_epi16(u1, u3); // a3 a7 b3 b7 ...
+
+    u0 = _mm_unpacklo_epi16(v0, v2); // a0 a2 a4 a6 ...
+    u1 = _mm_unpacklo_epi16(v1, v3); // a1 a3 a5 a7 ...
+    u2 = _mm_unpackhi_epi16(v0, v2); // c0 c2 c4 c6 ...
+    u3 = _mm_unpackhi_epi16(v1, v3); // c1 c3 c5 c7 ...
+
+    a.val = _mm_unpacklo_epi16(u0, u1);
+    b.val = _mm_unpackhi_epi16(u0, u1);
+    c.val = _mm_unpacklo_epi16(u2, u3);
+    d.val = _mm_unpackhi_epi16(u2, u3);
+}
+
+inline void v_load_deinterleave(const unsigned* ptr, v_uint32x4& a, v_uint32x4& b, v_uint32x4& c)
+{
+    __m128i t00 = _mm_loadu_si128((const __m128i*)ptr);
+    __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 4));
+    __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 8));
+
+    __m128i t10 = _mm_unpacklo_epi32(t00, _mm_unpackhi_epi64(t01, t01));
+    __m128i t11 = _mm_unpacklo_epi32(_mm_unpackhi_epi64(t00, t00), t02);
+    __m128i t12 = _mm_unpacklo_epi32(t01, _mm_unpackhi_epi64(t02, t02));
+
+    a.val = _mm_unpacklo_epi32(t10, _mm_unpackhi_epi64(t11, t11));
+    b.val = _mm_unpacklo_epi32(_mm_unpackhi_epi64(t10, t10), t12);
+    c.val = _mm_unpacklo_epi32(t11, _mm_unpackhi_epi64(t12, t12));
+}
+
+inline void v_load_deinterleave(const unsigned* ptr, v_uint32x4& a, v_uint32x4& b, v_uint32x4& c, v_uint32x4& d)
+{
+    v_uint32x4 u0(_mm_loadu_si128((const __m128i*)ptr));        // a0 b0 c0 d0
+    v_uint32x4 u1(_mm_loadu_si128((const __m128i*)(ptr + 4))); // a1 b1 c1 d1
+    v_uint32x4 u2(_mm_loadu_si128((const __m128i*)(ptr + 8))); // a2 b2 c2 d2
+    v_uint32x4 u3(_mm_loadu_si128((const __m128i*)(ptr + 12))); // a3 b3 c3 d3
+
+    v_transpose4x4(u0, u1, u2, u3, a, b, c, d);
+}
+
+inline void v_store_interleave( uchar* ptr, const v_uint8x16& a, const v_uint8x16& b,
+                                const v_uint8x16& c )
+{
+    __m128i z = _mm_setzero_si128();
+    __m128i ab0 = _mm_unpacklo_epi8(a.val, b.val);
+    __m128i ab1 = _mm_unpackhi_epi8(a.val, b.val);
+    __m128i c0 = _mm_unpacklo_epi8(c.val, z);
+    __m128i c1 = _mm_unpackhi_epi8(c.val, z);
+
+    __m128i p00 = _mm_unpacklo_epi16(ab0, c0);
+    __m128i p01 = _mm_unpackhi_epi16(ab0, c0);
+    __m128i p02 = _mm_unpacklo_epi16(ab1, c1);
+    __m128i p03 = _mm_unpackhi_epi16(ab1, c1);
+
+    __m128i p10 = _mm_unpacklo_epi32(p00, p01);
+    __m128i p11 = _mm_unpackhi_epi32(p00, p01);
+    __m128i p12 = _mm_unpacklo_epi32(p02, p03);
+    __m128i p13 = _mm_unpackhi_epi32(p02, p03);
+
+    __m128i p20 = _mm_unpacklo_epi64(p10, p11);
+    __m128i p21 = _mm_unpackhi_epi64(p10, p11);
+    __m128i p22 = _mm_unpacklo_epi64(p12, p13);
+    __m128i p23 = _mm_unpackhi_epi64(p12, p13);
+
+    p20 = _mm_slli_si128(p20, 1);
+    p22 = _mm_slli_si128(p22, 1);
+
+    __m128i p30 = _mm_slli_epi64(_mm_unpacklo_epi32(p20, p21), 8);
+    __m128i p31 = _mm_srli_epi64(_mm_unpackhi_epi32(p20, p21), 8);
+    __m128i p32 = _mm_slli_epi64(_mm_unpacklo_epi32(p22, p23), 8);
+    __m128i p33 = _mm_srli_epi64(_mm_unpackhi_epi32(p22, p23), 8);
+
+    __m128i p40 = _mm_unpacklo_epi64(p30, p31);
+    __m128i p41 = _mm_unpackhi_epi64(p30, p31);
+    __m128i p42 = _mm_unpacklo_epi64(p32, p33);
+    __m128i p43 = _mm_unpackhi_epi64(p32, p33);
+
+    __m128i v0 = _mm_or_si128(_mm_srli_si128(p40, 2), _mm_slli_si128(p41, 10));
+    __m128i v1 = _mm_or_si128(_mm_srli_si128(p41, 6), _mm_slli_si128(p42, 6));
+    __m128i v2 = _mm_or_si128(_mm_srli_si128(p42, 10), _mm_slli_si128(p43, 2));
+
+    _mm_storeu_si128((__m128i*)(ptr), v0);
+    _mm_storeu_si128((__m128i*)(ptr + 16), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 32), v2);
+}
+
+inline void v_store_interleave( uchar* ptr, const v_uint8x16& a, const v_uint8x16& b,
+                                const v_uint8x16& c, const v_uint8x16& d)
+{
+    // a0 a1 a2 a3 ....
+    // b0 b1 b2 b3 ....
+    // c0 c1 c2 c3 ....
+    // d0 d1 d2 d3 ....
+    __m128i u0 = _mm_unpacklo_epi8(a.val, c.val); // a0 c0 a1 c1 ...
+    __m128i u1 = _mm_unpackhi_epi8(a.val, c.val); // a8 c8 a9 c9 ...
+    __m128i u2 = _mm_unpacklo_epi8(b.val, d.val); // b0 d0 b1 d1 ...
+    __m128i u3 = _mm_unpackhi_epi8(b.val, d.val); // b8 d8 b9 d9 ...
+
+    __m128i v0 = _mm_unpacklo_epi8(u0, u2); // a0 b0 c0 d0 ...
+    __m128i v1 = _mm_unpacklo_epi8(u1, u3); // a8 b8 c8 d8 ...
+    __m128i v2 = _mm_unpackhi_epi8(u0, u2); // a4 b4 c4 d4 ...
+    __m128i v3 = _mm_unpackhi_epi8(u1, u3); // a12 b12 c12 d12 ...
+
+    _mm_storeu_si128((__m128i*)ptr, v0);
+    _mm_storeu_si128((__m128i*)(ptr + 16), v2);
+    _mm_storeu_si128((__m128i*)(ptr + 32), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 48), v3);
+}
+
+inline void v_store_interleave( ushort* ptr, const v_uint16x8& a,
+                                const v_uint16x8& b,
+                                const v_uint16x8& c )
+{
+    __m128i z = _mm_setzero_si128();
+    __m128i ab0 = _mm_unpacklo_epi16(a.val, b.val);
+    __m128i ab1 = _mm_unpackhi_epi16(a.val, b.val);
+    __m128i c0 = _mm_unpacklo_epi16(c.val, z);
+    __m128i c1 = _mm_unpackhi_epi16(c.val, z);
+
+    __m128i p10 = _mm_unpacklo_epi32(ab0, c0);
+    __m128i p11 = _mm_unpackhi_epi32(ab0, c0);
+    __m128i p12 = _mm_unpacklo_epi32(ab1, c1);
+    __m128i p13 = _mm_unpackhi_epi32(ab1, c1);
+
+    __m128i p20 = _mm_unpacklo_epi64(p10, p11);
+    __m128i p21 = _mm_unpackhi_epi64(p10, p11);
+    __m128i p22 = _mm_unpacklo_epi64(p12, p13);
+    __m128i p23 = _mm_unpackhi_epi64(p12, p13);
+
+    p20 = _mm_slli_si128(p20, 2);
+    p22 = _mm_slli_si128(p22, 2);
+
+    __m128i p30 = _mm_unpacklo_epi64(p20, p21);
+    __m128i p31 = _mm_unpackhi_epi64(p20, p21);
+    __m128i p32 = _mm_unpacklo_epi64(p22, p23);
+    __m128i p33 = _mm_unpackhi_epi64(p22, p23);
+
+    __m128i v0 = _mm_or_si128(_mm_srli_si128(p30, 2), _mm_slli_si128(p31, 10));
+    __m128i v1 = _mm_or_si128(_mm_srli_si128(p31, 6), _mm_slli_si128(p32, 6));
+    __m128i v2 = _mm_or_si128(_mm_srli_si128(p32, 10), _mm_slli_si128(p33, 2));
+
+    _mm_storeu_si128((__m128i*)(ptr), v0);
+    _mm_storeu_si128((__m128i*)(ptr + 8), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 16), v2);
+}
+
+inline void v_store_interleave( ushort* ptr, const v_uint16x8& a, const v_uint16x8& b,
+                                const v_uint16x8& c, const v_uint16x8& d)
+{
+    // a0 a1 a2 a3 ....
+    // b0 b1 b2 b3 ....
+    // c0 c1 c2 c3 ....
+    // d0 d1 d2 d3 ....
+    __m128i u0 = _mm_unpacklo_epi16(a.val, c.val); // a0 c0 a1 c1 ...
+    __m128i u1 = _mm_unpackhi_epi16(a.val, c.val); // a4 c4 a5 c5 ...
+    __m128i u2 = _mm_unpacklo_epi16(b.val, d.val); // b0 d0 b1 d1 ...
+    __m128i u3 = _mm_unpackhi_epi16(b.val, d.val); // b4 d4 b5 d5 ...
+
+    __m128i v0 = _mm_unpacklo_epi16(u0, u2); // a0 b0 c0 d0 ...
+    __m128i v1 = _mm_unpacklo_epi16(u1, u3); // a4 b4 c4 d4 ...
+    __m128i v2 = _mm_unpackhi_epi16(u0, u2); // a2 b2 c2 d2 ...
+    __m128i v3 = _mm_unpackhi_epi16(u1, u3); // a6 b6 c6 d6 ...
+
+    _mm_storeu_si128((__m128i*)ptr, v0);
+    _mm_storeu_si128((__m128i*)(ptr + 8), v2);
+    _mm_storeu_si128((__m128i*)(ptr + 16), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 24), v3);
+}
+
+inline void v_store_interleave( unsigned* ptr, const v_uint32x4& a, const v_uint32x4& b,
+                                const v_uint32x4& c )
+{
+    v_uint32x4 z = v_setzero_u32(), u0, u1, u2, u3;
+    v_transpose4x4(a, b, c, z, u0, u1, u2, u3);
+
+    __m128i v0 = _mm_or_si128(u0.val, _mm_slli_si128(u1.val, 12));
+    __m128i v1 = _mm_or_si128(_mm_srli_si128(u1.val, 4), _mm_slli_si128(u2.val, 8));
+    __m128i v2 = _mm_or_si128(_mm_srli_si128(u2.val, 8), _mm_slli_si128(u3.val, 4));
+
+    _mm_storeu_si128((__m128i*)ptr, v0);
+    _mm_storeu_si128((__m128i*)(ptr + 4), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 8), v2);
+}
+
+inline void v_store_interleave(unsigned* ptr, const v_uint32x4& a, const v_uint32x4& b,
+                               const v_uint32x4& c, const v_uint32x4& d)
+{
+    v_uint32x4 t0, t1, t2, t3;
+    v_transpose4x4(a, b, c, d, t0, t1, t2, t3);
+    v_store(ptr, t0);
+    v_store(ptr + 4, t1);
+    v_store(ptr + 8, t2);
+    v_store(ptr + 12, t3);
+}
+
+#define OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(_Tpvec, _Tp, suffix, _Tpuvec, _Tpu, usuffix) \
+inline void v_load_deinterleave( const _Tp* ptr, _Tpvec& a0, \
+                                 _Tpvec& b0, _Tpvec& c0 ) \
+{ \
+    _Tpuvec a1, b1, c1; \
+    v_load_deinterleave((const _Tpu*)ptr, a1, b1, c1); \
+    a0 = v_reinterpret_as_##suffix(a1); \
+    b0 = v_reinterpret_as_##suffix(b1); \
+    c0 = v_reinterpret_as_##suffix(c1); \
+} \
+inline void v_load_deinterleave( const _Tp* ptr, _Tpvec& a0, \
+                                 _Tpvec& b0, _Tpvec& c0, _Tpvec& d0 ) \
+{ \
+    _Tpuvec a1, b1, c1, d1; \
+    v_load_deinterleave((const _Tpu*)ptr, a1, b1, c1, d1); \
+    a0 = v_reinterpret_as_##suffix(a1); \
+    b0 = v_reinterpret_as_##suffix(b1); \
+    c0 = v_reinterpret_as_##suffix(c1); \
+    d0 = v_reinterpret_as_##suffix(d1); \
+} \
+inline void v_store_interleave( _Tp* ptr, const _Tpvec& a0, \
+                               const _Tpvec& b0, const _Tpvec& c0 ) \
+{ \
+    _Tpuvec a1 = v_reinterpret_as_##usuffix(a0); \
+    _Tpuvec b1 = v_reinterpret_as_##usuffix(b0); \
+    _Tpuvec c1 = v_reinterpret_as_##usuffix(c0); \
+    v_store_interleave((_Tpu*)ptr, a1, b1, c1); \
+} \
+inline void v_store_interleave( _Tp* ptr, const _Tpvec& a0, const _Tpvec& b0, \
+                               const _Tpvec& c0, const _Tpvec& d0 ) \
+{ \
+    _Tpuvec a1 = v_reinterpret_as_##usuffix(a0); \
+    _Tpuvec b1 = v_reinterpret_as_##usuffix(b0); \
+    _Tpuvec c1 = v_reinterpret_as_##usuffix(c0); \
+    _Tpuvec d1 = v_reinterpret_as_##usuffix(d0); \
+    v_store_interleave((_Tpu*)ptr, a1, b1, c1, d1); \
+}
+
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int8x16, schar, s8, v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int16x8, short, s16, v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int32x4, int, s32, v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_float32x4, float, f32, v_uint32x4, unsigned, u32)
+
+inline v_float32x4 v_cvt_f32(const v_int32x4& a)
+{
+    return v_float32x4(_mm_cvtepi32_ps(a.val));
+}
+
+inline v_float32x4 v_cvt_f32(const v_float64x2& a)
+{
+    return v_float32x4(_mm_cvtpd_ps(a.val));
+}
+
+inline v_float64x2 v_cvt_f64(const v_int32x4& a)
+{
+    return v_float64x2(_mm_cvtepi32_pd(a.val));
+}
+
+inline v_float64x2 v_cvt_f64(const v_float32x4& a)
+{
+    return v_float64x2(_mm_cvtps_pd(a.val));
+}
+
+//! @endcond
+
+}
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp
new file mode 100644
index 0000000..4de8611
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp
@@ -0,0 +1,195 @@
+/*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-2015, Intel Corporation, all rights reserved.
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_IPPASYNC_HPP__
+#define __OPENCV_CORE_IPPASYNC_HPP__
+
+#ifdef HAVE_IPP_A
+
+#include "opencv2/core.hpp"
+#include <ipp_async_op.h>
+#include <ipp_async_accel.h>
+
+namespace cv
+{
+
+namespace hpp
+{
+
+/** @addtogroup core_ipp
+This section describes conversion between OpenCV and [Intel&reg; IPP Asynchronous
+C/C++](http://software.intel.com/en-us/intel-ipp-preview) library. [Getting Started
+Guide](http://registrationcenter.intel.com/irc_nas/3727/ipp_async_get_started.htm) help you to
+install the library, configure header and library build paths.
+ */
+//! @{
+
+    //! convert OpenCV data type to hppDataType
+    inline int toHppType(const int cvType)
+    {
+        int depth = CV_MAT_DEPTH(cvType);
+        int hppType = depth == CV_8U ? HPP_DATA_TYPE_8U :
+                     depth == CV_16U ? HPP_DATA_TYPE_16U :
+                     depth == CV_16S ? HPP_DATA_TYPE_16S :
+                     depth == CV_32S ? HPP_DATA_TYPE_32S :
+                     depth == CV_32F ? HPP_DATA_TYPE_32F :
+                     depth == CV_64F ? HPP_DATA_TYPE_64F : -1;
+        CV_Assert( hppType >= 0 );
+        return hppType;
+    }
+
+    //! convert hppDataType to OpenCV data type
+    inline int toCvType(const int hppType)
+    {
+        int cvType = hppType == HPP_DATA_TYPE_8U ? CV_8U :
+                    hppType == HPP_DATA_TYPE_16U ? CV_16U :
+                    hppType == HPP_DATA_TYPE_16S ? CV_16S :
+                    hppType == HPP_DATA_TYPE_32S ? CV_32S :
+                    hppType == HPP_DATA_TYPE_32F ? CV_32F :
+                    hppType == HPP_DATA_TYPE_64F ? CV_64F : -1;
+        CV_Assert( cvType >= 0 );
+        return cvType;
+    }
+
+    /** @brief Convert hppiMatrix to Mat.
+
+    This function allocates and initializes new matrix (if needed) that has the same size and type as
+    input matrix. Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F.
+    @param src input hppiMatrix.
+    @param dst output matrix.
+    @param accel accelerator instance (see hpp::getHpp for the list of acceleration framework types).
+    @param cn number of channels.
+     */
+    inline void copyHppToMat(hppiMatrix* src, Mat& dst, hppAccel accel, int cn)
+    {
+        hppDataType type;
+        hpp32u width, height;
+        hppStatus sts;
+
+        if (src == NULL)
+            return dst.release();
+
+        sts = hppiInquireMatrix(src, &type, &width, &height);
+
+        CV_Assert( sts == HPP_STATUS_NO_ERROR);
+
+        int matType = CV_MAKETYPE(toCvType(type), cn);
+
+        CV_Assert(width%cn == 0);
+
+        width /= cn;
+
+        dst.create((int)height, (int)width, (int)matType);
+
+        size_t newSize = (size_t)(height*(hpp32u)(dst.step));
+
+        sts = hppiGetMatrixData(accel,src,(hpp32u)(dst.step),dst.data,&newSize);
+
+        CV_Assert( sts == HPP_STATUS_NO_ERROR);
+    }
+
+    /** @brief Create Mat from hppiMatrix.
+
+    This function allocates and initializes the Mat that has the same size and type as input matrix.
+    Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F.
+    @param src input hppiMatrix.
+    @param accel accelerator instance (see hpp::getHpp for the list of acceleration framework types).
+    @param cn number of channels.
+    @sa howToUseIPPAconversion, hpp::copyHppToMat, hpp::getHpp.
+     */
+    inline Mat getMat(hppiMatrix* src, hppAccel accel, int cn)
+    {
+        Mat dst;
+        copyHppToMat(src, dst, accel, cn);
+        return dst;
+    }
+
+    /** @brief Create hppiMatrix from Mat.
+
+    This function allocates and initializes the hppiMatrix that has the same size and type as input
+    matrix, returns the hppiMatrix*.
+
+    If you want to use zero-copy for GPU you should to have 4KB aligned matrix data. See details
+    [hppiCreateSharedMatrix](http://software.intel.com/ru-ru/node/501697).
+
+    Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F.
+
+    @note The hppiMatrix pointer to the image buffer in system memory refers to the src.data. Control
+    the lifetime of the matrix and don't change its data, if there is no special need.
+    @param src input matrix.
+    @param accel accelerator instance. Supports type:
+    -   **HPP_ACCEL_TYPE_CPU** - accelerated by optimized CPU instructions.
+    -   **HPP_ACCEL_TYPE_GPU** - accelerated by GPU programmable units or fixed-function
+        accelerators.
+    -   **HPP_ACCEL_TYPE_ANY** - any acceleration or no acceleration available.
+    @sa howToUseIPPAconversion, hpp::getMat
+     */
+    inline hppiMatrix* getHpp(const Mat& src, hppAccel accel)
+    {
+        int htype = toHppType(src.type());
+        int cn = src.channels();
+
+        CV_Assert(src.data);
+        hppAccelType accelType = hppQueryAccelType(accel);
+
+        if (accelType!=HPP_ACCEL_TYPE_CPU)
+        {
+            hpp32u pitch, size;
+            hppQueryMatrixAllocParams(accel, src.cols*cn, src.rows, htype, &pitch, &size);
+            if (pitch!=0 && size!=0)
+                if ((int)(src.data)%4096==0 && pitch==(hpp32u)(src.step))
+                {
+                    return hppiCreateSharedMatrix(htype, src.cols*cn, src.rows, src.data, pitch, size);
+                }
+        }
+
+        return hppiCreateMatrix(htype, src.cols*cn, src.rows, src.data, (hpp32s)(src.step));;
+    }
+
+//! @}
+}}
+
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp
new file mode 100644
index 0000000..ffec538
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp
@@ -0,0 +1,3431 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_MAT_HPP__
+#define __OPENCV_CORE_MAT_HPP__
+
+#ifndef __cplusplus
+#  error mat.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/matx.hpp"
+#include "opencv2/core/types.hpp"
+
+#include "opencv2/core/bufferpool.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_basic
+//! @{
+
+enum { ACCESS_READ=1<<24, ACCESS_WRITE=1<<25,
+    ACCESS_RW=3<<24, ACCESS_MASK=ACCESS_RW, ACCESS_FAST=1<<26 };
+
+class CV_EXPORTS _OutputArray;
+
+//////////////////////// Input/Output Array Arguments /////////////////////////////////
+
+/** @brief This is the proxy class for passing read-only input arrays into OpenCV functions.
+
+It is defined as:
+@code
+    typedef const _InputArray& InputArray;
+@endcode
+where _InputArray is a class that can be constructed from `Mat`, `Mat_<T>`, `Matx<T, m, n>`,
+`std::vector<T>`, `std::vector<std::vector<T> >` or `std::vector<Mat>`. It can also be constructed
+from a matrix expression.
+
+Since this is mostly implementation-level class, and its interface may change in future versions, we
+do not describe it in details. There are a few key things, though, that should be kept in mind:
+
+-   When you see in the reference manual or in OpenCV source code a function that takes
+    InputArray, it means that you can actually pass `Mat`, `Matx`, `vector<T>` etc. (see above the
+    complete list).
+-   Optional input arguments: If some of the input arrays may be empty, pass cv::noArray() (or
+    simply cv::Mat() as you probably did before).
+-   The class is designed solely for passing parameters. That is, normally you *should not*
+    declare class members, local and global variables of this type.
+-   If you want to design your own function or a class method that can operate of arrays of
+    multiple types, you can use InputArray (or OutputArray) for the respective parameters. Inside
+    a function you should use _InputArray::getMat() method to construct a matrix header for the
+    array (without copying data). _InputArray::kind() can be used to distinguish Mat from
+    `vector<>` etc., but normally it is not needed.
+
+Here is how you can use a function that takes InputArray :
+@code
+    std::vector<Point2f> vec;
+    // points or a circle
+    for( int i = 0; i < 30; i++ )
+        vec.push_back(Point2f((float)(100 + 30*cos(i*CV_PI*2/5)),
+                              (float)(100 - 30*sin(i*CV_PI*2/5))));
+    cv::transform(vec, vec, cv::Matx23f(0.707, -0.707, 10, 0.707, 0.707, 20));
+@endcode
+That is, we form an STL vector containing points, and apply in-place affine transformation to the
+vector using the 2x3 matrix created inline as `Matx<float, 2, 3>` instance.
+
+Here is how such a function can be implemented (for simplicity, we implement a very specific case of
+it, according to the assertion statement inside) :
+@code
+    void myAffineTransform(InputArray _src, OutputArray _dst, InputArray _m)
+    {
+        // get Mat headers for input arrays. This is O(1) operation,
+        // unless _src and/or _m are matrix expressions.
+        Mat src = _src.getMat(), m = _m.getMat();
+        CV_Assert( src.type() == CV_32FC2 && m.type() == CV_32F && m.size() == Size(3, 2) );
+
+        // [re]create the output array so that it has the proper size and type.
+        // In case of Mat it calls Mat::create, in case of STL vector it calls vector::resize.
+        _dst.create(src.size(), src.type());
+        Mat dst = _dst.getMat();
+
+        for( int i = 0; i < src.rows; i++ )
+            for( int j = 0; j < src.cols; j++ )
+            {
+                Point2f pt = src.at<Point2f>(i, j);
+                dst.at<Point2f>(i, j) = Point2f(m.at<float>(0, 0)*pt.x +
+                                                m.at<float>(0, 1)*pt.y +
+                                                m.at<float>(0, 2),
+                                                m.at<float>(1, 0)*pt.x +
+                                                m.at<float>(1, 1)*pt.y +
+                                                m.at<float>(1, 2));
+            }
+    }
+@endcode
+There is another related type, InputArrayOfArrays, which is currently defined as a synonym for
+InputArray:
+@code
+    typedef InputArray InputArrayOfArrays;
+@endcode
+It denotes function arguments that are either vectors of vectors or vectors of matrices. A separate
+synonym is needed to generate Python/Java etc. wrappers properly. At the function implementation
+level their use is similar, but _InputArray::getMat(idx) should be used to get header for the
+idx-th component of the outer vector and _InputArray::size().area() should be used to find the
+number of components (vectors/matrices) of the outer vector.
+ */
+class CV_EXPORTS _InputArray
+{
+public:
+    enum {
+        KIND_SHIFT = 16,
+        FIXED_TYPE = 0x8000 << KIND_SHIFT,
+        FIXED_SIZE = 0x4000 << KIND_SHIFT,
+        KIND_MASK = 31 << KIND_SHIFT,
+
+        NONE              = 0 << KIND_SHIFT,
+        MAT               = 1 << KIND_SHIFT,
+        MATX              = 2 << KIND_SHIFT,
+        STD_VECTOR        = 3 << KIND_SHIFT,
+        STD_VECTOR_VECTOR = 4 << KIND_SHIFT,
+        STD_VECTOR_MAT    = 5 << KIND_SHIFT,
+        EXPR              = 6 << KIND_SHIFT,
+        OPENGL_BUFFER     = 7 << KIND_SHIFT,
+        CUDA_HOST_MEM     = 8 << KIND_SHIFT,
+        CUDA_GPU_MAT      = 9 << KIND_SHIFT,
+        UMAT              =10 << KIND_SHIFT,
+        STD_VECTOR_UMAT   =11 << KIND_SHIFT,
+        STD_BOOL_VECTOR   =12 << KIND_SHIFT,
+        STD_VECTOR_CUDA_GPU_MAT = 13 << KIND_SHIFT
+    };
+
+    _InputArray();
+    _InputArray(int _flags, void* _obj);
+    _InputArray(const Mat& m);
+    _InputArray(const MatExpr& expr);
+    _InputArray(const std::vector<Mat>& vec);
+    template<typename _Tp> _InputArray(const Mat_<_Tp>& m);
+    template<typename _Tp> _InputArray(const std::vector<_Tp>& vec);
+    _InputArray(const std::vector<bool>& vec);
+    template<typename _Tp> _InputArray(const std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _InputArray(const std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _InputArray(const _Tp* vec, int n);
+    template<typename _Tp, int m, int n> _InputArray(const Matx<_Tp, m, n>& matx);
+    _InputArray(const double& val);
+    _InputArray(const cuda::GpuMat& d_mat);
+    _InputArray(const std::vector<cuda::GpuMat>& d_mat_array);
+    _InputArray(const ogl::Buffer& buf);
+    _InputArray(const cuda::HostMem& cuda_mem);
+    template<typename _Tp> _InputArray(const cudev::GpuMat_<_Tp>& m);
+    _InputArray(const UMat& um);
+    _InputArray(const std::vector<UMat>& umv);
+
+    Mat getMat(int idx=-1) const;
+    Mat getMat_(int idx=-1) const;
+    UMat getUMat(int idx=-1) const;
+    void getMatVector(std::vector<Mat>& mv) const;
+    void getUMatVector(std::vector<UMat>& umv) const;
+    void getGpuMatVector(std::vector<cuda::GpuMat>& gpumv) const;
+    cuda::GpuMat getGpuMat() const;
+    ogl::Buffer getOGlBuffer() const;
+
+    int getFlags() const;
+    void* getObj() const;
+    Size getSz() const;
+
+    int kind() const;
+    int dims(int i=-1) const;
+    int cols(int i=-1) const;
+    int rows(int i=-1) const;
+    Size size(int i=-1) const;
+    int sizend(int* sz, int i=-1) const;
+    bool sameSize(const _InputArray& arr) const;
+    size_t total(int i=-1) const;
+    int type(int i=-1) const;
+    int depth(int i=-1) const;
+    int channels(int i=-1) const;
+    bool isContinuous(int i=-1) const;
+    bool isSubmatrix(int i=-1) const;
+    bool empty() const;
+    void copyTo(const _OutputArray& arr) const;
+    void copyTo(const _OutputArray& arr, const _InputArray & mask) const;
+    size_t offset(int i=-1) const;
+    size_t step(int i=-1) const;
+    bool isMat() const;
+    bool isUMat() const;
+    bool isMatVector() const;
+    bool isUMatVector() const;
+    bool isMatx() const;
+    bool isVector() const;
+    bool isGpuMatVector() const;
+    ~_InputArray();
+
+protected:
+    int flags;
+    void* obj;
+    Size sz;
+
+    void init(int _flags, const void* _obj);
+    void init(int _flags, const void* _obj, Size _sz);
+};
+
+
+/** @brief This type is very similar to InputArray except that it is used for input/output and output function
+parameters.
+
+Just like with InputArray, OpenCV users should not care about OutputArray, they just pass `Mat`,
+`vector<T>` etc. to the functions. The same limitation as for `InputArray`: *Do not explicitly
+create OutputArray instances* applies here too.
+
+If you want to make your function polymorphic (i.e. accept different arrays as output parameters),
+it is also not very difficult. Take the sample above as the reference. Note that
+_OutputArray::create() needs to be called before _OutputArray::getMat(). This way you guarantee
+that the output array is properly allocated.
+
+Optional output parameters. If you do not need certain output array to be computed and returned to
+you, pass cv::noArray(), just like you would in the case of optional input array. At the
+implementation level, use _OutputArray::needed() to check if certain output array needs to be
+computed or not.
+
+There are several synonyms for OutputArray that are used to assist automatic Python/Java/... wrapper
+generators:
+@code
+    typedef OutputArray OutputArrayOfArrays;
+    typedef OutputArray InputOutputArray;
+    typedef OutputArray InputOutputArrayOfArrays;
+@endcode
+ */
+class CV_EXPORTS _OutputArray : public _InputArray
+{
+public:
+    enum
+    {
+        DEPTH_MASK_8U = 1 << CV_8U,
+        DEPTH_MASK_8S = 1 << CV_8S,
+        DEPTH_MASK_16U = 1 << CV_16U,
+        DEPTH_MASK_16S = 1 << CV_16S,
+        DEPTH_MASK_32S = 1 << CV_32S,
+        DEPTH_MASK_32F = 1 << CV_32F,
+        DEPTH_MASK_64F = 1 << CV_64F,
+        DEPTH_MASK_ALL = (DEPTH_MASK_64F<<1)-1,
+        DEPTH_MASK_ALL_BUT_8S = DEPTH_MASK_ALL & ~DEPTH_MASK_8S,
+        DEPTH_MASK_FLT = DEPTH_MASK_32F + DEPTH_MASK_64F
+    };
+
+    _OutputArray();
+    _OutputArray(int _flags, void* _obj);
+    _OutputArray(Mat& m);
+    _OutputArray(std::vector<Mat>& vec);
+    _OutputArray(cuda::GpuMat& d_mat);
+    _OutputArray(std::vector<cuda::GpuMat>& d_mat);
+    _OutputArray(ogl::Buffer& buf);
+    _OutputArray(cuda::HostMem& cuda_mem);
+    template<typename _Tp> _OutputArray(cudev::GpuMat_<_Tp>& m);
+    template<typename _Tp> _OutputArray(std::vector<_Tp>& vec);
+    _OutputArray(std::vector<bool>& vec);
+    template<typename _Tp> _OutputArray(std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _OutputArray(std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _OutputArray(Mat_<_Tp>& m);
+    template<typename _Tp> _OutputArray(_Tp* vec, int n);
+    template<typename _Tp, int m, int n> _OutputArray(Matx<_Tp, m, n>& matx);
+    _OutputArray(UMat& m);
+    _OutputArray(std::vector<UMat>& vec);
+
+    _OutputArray(const Mat& m);
+    _OutputArray(const std::vector<Mat>& vec);
+    _OutputArray(const cuda::GpuMat& d_mat);
+    _OutputArray(const std::vector<cuda::GpuMat>& d_mat);
+    _OutputArray(const ogl::Buffer& buf);
+    _OutputArray(const cuda::HostMem& cuda_mem);
+    template<typename _Tp> _OutputArray(const cudev::GpuMat_<_Tp>& m);
+    template<typename _Tp> _OutputArray(const std::vector<_Tp>& vec);
+    template<typename _Tp> _OutputArray(const std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _OutputArray(const std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _OutputArray(const Mat_<_Tp>& m);
+    template<typename _Tp> _OutputArray(const _Tp* vec, int n);
+    template<typename _Tp, int m, int n> _OutputArray(const Matx<_Tp, m, n>& matx);
+    _OutputArray(const UMat& m);
+    _OutputArray(const std::vector<UMat>& vec);
+
+    bool fixedSize() const;
+    bool fixedType() const;
+    bool needed() const;
+    Mat& getMatRef(int i=-1) const;
+    UMat& getUMatRef(int i=-1) const;
+    cuda::GpuMat& getGpuMatRef() const;
+    std::vector<cuda::GpuMat>& getGpuMatVecRef() const;
+    ogl::Buffer& getOGlBufferRef() const;
+    cuda::HostMem& getHostMemRef() const;
+    void create(Size sz, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
+    void create(int rows, int cols, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
+    void create(int dims, const int* size, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
+    void createSameSize(const _InputArray& arr, int mtype) const;
+    void release() const;
+    void clear() const;
+    void setTo(const _InputArray& value, const _InputArray & mask = _InputArray()) const;
+
+    void assign(const UMat& u) const;
+    void assign(const Mat& m) const;
+};
+
+
+class CV_EXPORTS _InputOutputArray : public _OutputArray
+{
+public:
+    _InputOutputArray();
+    _InputOutputArray(int _flags, void* _obj);
+    _InputOutputArray(Mat& m);
+    _InputOutputArray(std::vector<Mat>& vec);
+    _InputOutputArray(cuda::GpuMat& d_mat);
+    _InputOutputArray(ogl::Buffer& buf);
+    _InputOutputArray(cuda::HostMem& cuda_mem);
+    template<typename _Tp> _InputOutputArray(cudev::GpuMat_<_Tp>& m);
+    template<typename _Tp> _InputOutputArray(std::vector<_Tp>& vec);
+    _InputOutputArray(std::vector<bool>& vec);
+    template<typename _Tp> _InputOutputArray(std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _InputOutputArray(std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _InputOutputArray(Mat_<_Tp>& m);
+    template<typename _Tp> _InputOutputArray(_Tp* vec, int n);
+    template<typename _Tp, int m, int n> _InputOutputArray(Matx<_Tp, m, n>& matx);
+    _InputOutputArray(UMat& m);
+    _InputOutputArray(std::vector<UMat>& vec);
+
+    _InputOutputArray(const Mat& m);
+    _InputOutputArray(const std::vector<Mat>& vec);
+    _InputOutputArray(const cuda::GpuMat& d_mat);
+    _InputOutputArray(const std::vector<cuda::GpuMat>& d_mat);
+    _InputOutputArray(const ogl::Buffer& buf);
+    _InputOutputArray(const cuda::HostMem& cuda_mem);
+    template<typename _Tp> _InputOutputArray(const cudev::GpuMat_<_Tp>& m);
+    template<typename _Tp> _InputOutputArray(const std::vector<_Tp>& vec);
+    template<typename _Tp> _InputOutputArray(const std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _InputOutputArray(const std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _InputOutputArray(const Mat_<_Tp>& m);
+    template<typename _Tp> _InputOutputArray(const _Tp* vec, int n);
+    template<typename _Tp, int m, int n> _InputOutputArray(const Matx<_Tp, m, n>& matx);
+    _InputOutputArray(const UMat& m);
+    _InputOutputArray(const std::vector<UMat>& vec);
+};
+
+typedef const _InputArray& InputArray;
+typedef InputArray InputArrayOfArrays;
+typedef const _OutputArray& OutputArray;
+typedef OutputArray OutputArrayOfArrays;
+typedef const _InputOutputArray& InputOutputArray;
+typedef InputOutputArray InputOutputArrayOfArrays;
+
+CV_EXPORTS InputOutputArray noArray();
+
+/////////////////////////////////// MatAllocator //////////////////////////////////////
+
+//! Usage flags for allocator
+enum UMatUsageFlags
+{
+    USAGE_DEFAULT = 0,
+
+    // buffer allocation policy is platform and usage specific
+    USAGE_ALLOCATE_HOST_MEMORY = 1 << 0,
+    USAGE_ALLOCATE_DEVICE_MEMORY = 1 << 1,
+    USAGE_ALLOCATE_SHARED_MEMORY = 1 << 2, // It is not equal to: USAGE_ALLOCATE_HOST_MEMORY | USAGE_ALLOCATE_DEVICE_MEMORY
+
+    __UMAT_USAGE_FLAGS_32BIT = 0x7fffffff // Binary compatibility hint
+};
+
+struct CV_EXPORTS UMatData;
+
+/** @brief  Custom array allocator
+*/
+class CV_EXPORTS MatAllocator
+{
+public:
+    MatAllocator() {}
+    virtual ~MatAllocator() {}
+
+    // let's comment it off for now to detect and fix all the uses of allocator
+    //virtual void allocate(int dims, const int* sizes, int type, int*& refcount,
+    //                      uchar*& datastart, uchar*& data, size_t* step) = 0;
+    //virtual void deallocate(int* refcount, uchar* datastart, uchar* data) = 0;
+    virtual UMatData* allocate(int dims, const int* sizes, int type,
+                               void* data, size_t* step, int flags, UMatUsageFlags usageFlags) const = 0;
+    virtual bool allocate(UMatData* data, int accessflags, UMatUsageFlags usageFlags) const = 0;
+    virtual void deallocate(UMatData* data) const = 0;
+    virtual void map(UMatData* data, int accessflags) const;
+    virtual void unmap(UMatData* data) const;
+    virtual void download(UMatData* data, void* dst, int dims, const size_t sz[],
+                          const size_t srcofs[], const size_t srcstep[],
+                          const size_t dststep[]) const;
+    virtual void upload(UMatData* data, const void* src, int dims, const size_t sz[],
+                        const size_t dstofs[], const size_t dststep[],
+                        const size_t srcstep[]) const;
+    virtual void copy(UMatData* srcdata, UMatData* dstdata, int dims, const size_t sz[],
+                      const size_t srcofs[], const size_t srcstep[],
+                      const size_t dstofs[], const size_t dststep[], bool sync) const;
+
+    // default implementation returns DummyBufferPoolController
+    virtual BufferPoolController* getBufferPoolController(const char* id = NULL) const;
+};
+
+
+//////////////////////////////// MatCommaInitializer //////////////////////////////////
+
+/** @brief  Comma-separated Matrix Initializer
+
+ The class instances are usually not created explicitly.
+ Instead, they are created on "matrix << firstValue" operator.
+
+ The sample below initializes 2x2 rotation matrix:
+
+ \code
+ double angle = 30, a = cos(angle*CV_PI/180), b = sin(angle*CV_PI/180);
+ Mat R = (Mat_<double>(2,2) << a, -b, b, a);
+ \endcode
+*/
+template<typename _Tp> class MatCommaInitializer_
+{
+public:
+    //! the constructor, created by "matrix << firstValue" operator, where matrix is cv::Mat
+    MatCommaInitializer_(Mat_<_Tp>* _m);
+    //! the operator that takes the next value and put it to the matrix
+    template<typename T2> MatCommaInitializer_<_Tp>& operator , (T2 v);
+    //! another form of conversion operator
+    operator Mat_<_Tp>() const;
+protected:
+    MatIterator_<_Tp> it;
+};
+
+
+/////////////////////////////////////// Mat ///////////////////////////////////////////
+
+// note that umatdata might be allocated together
+// with the matrix data, not as a separate object.
+// therefore, it does not have constructor or destructor;
+// it should be explicitly initialized using init().
+struct CV_EXPORTS UMatData
+{
+    enum { COPY_ON_MAP=1, HOST_COPY_OBSOLETE=2,
+        DEVICE_COPY_OBSOLETE=4, TEMP_UMAT=8, TEMP_COPIED_UMAT=24,
+        USER_ALLOCATED=32, DEVICE_MEM_MAPPED=64};
+    UMatData(const MatAllocator* allocator);
+    ~UMatData();
+
+    // provide atomic access to the structure
+    void lock();
+    void unlock();
+
+    bool hostCopyObsolete() const;
+    bool deviceCopyObsolete() const;
+    bool deviceMemMapped() const;
+    bool copyOnMap() const;
+    bool tempUMat() const;
+    bool tempCopiedUMat() const;
+    void markHostCopyObsolete(bool flag);
+    void markDeviceCopyObsolete(bool flag);
+    void markDeviceMemMapped(bool flag);
+
+    const MatAllocator* prevAllocator;
+    const MatAllocator* currAllocator;
+    int urefcount;
+    int refcount;
+    uchar* data;
+    uchar* origdata;
+    size_t size;
+
+    int flags;
+    void* handle;
+    void* userdata;
+    int allocatorFlags_;
+    int mapcount;
+    UMatData* originalUMatData;
+};
+
+
+struct CV_EXPORTS UMatDataAutoLock
+{
+    explicit UMatDataAutoLock(UMatData* u);
+    ~UMatDataAutoLock();
+    UMatData* u;
+};
+
+
+struct CV_EXPORTS MatSize
+{
+    explicit MatSize(int* _p);
+    Size operator()() const;
+    const int& operator[](int i) const;
+    int& operator[](int i);
+    operator const int*() const;
+    bool operator == (const MatSize& sz) const;
+    bool operator != (const MatSize& sz) const;
+
+    int* p;
+};
+
+struct CV_EXPORTS MatStep
+{
+    MatStep();
+    explicit MatStep(size_t s);
+    const size_t& operator[](int i) const;
+    size_t& operator[](int i);
+    operator size_t() const;
+    MatStep& operator = (size_t s);
+
+    size_t* p;
+    size_t buf[2];
+protected:
+    MatStep& operator = (const MatStep&);
+};
+
+/** @example cout_mat.cpp
+An example demonstrating the serial out capabilities of cv::Mat
+*/
+
+ /** @brief n-dimensional dense array class
+
+The class Mat represents an n-dimensional dense numerical single-channel or multi-channel array. It
+can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel
+volumes, vector fields, point clouds, tensors, histograms (though, very high-dimensional histograms
+may be better stored in a SparseMat ). The data layout of the array `M` is defined by the array
+`M.step[]`, so that the address of element \f$(i_0,...,i_{M.dims-1})\f$, where \f$0\leq i_k<M.size[k]\f$, is
+computed as:
+\f[addr(M_{i_0,...,i_{M.dims-1}}) = M.data + M.step[0]*i_0 + M.step[1]*i_1 + ... + M.step[M.dims-1]*i_{M.dims-1}\f]
+In case of a 2-dimensional array, the above formula is reduced to:
+\f[addr(M_{i,j}) = M.data + M.step[0]*i + M.step[1]*j\f]
+Note that `M.step[i] >= M.step[i+1]` (in fact, `M.step[i] >= M.step[i+1]*M.size[i+1]` ). This means
+that 2-dimensional matrices are stored row-by-row, 3-dimensional matrices are stored plane-by-plane,
+and so on. M.step[M.dims-1] is minimal and always equal to the element size M.elemSize() .
+
+So, the data layout in Mat is fully compatible with CvMat, IplImage, and CvMatND types from OpenCV
+1.x. It is also compatible with the majority of dense array types from the standard toolkits and
+SDKs, such as Numpy (ndarray), Win32 (independent device bitmaps), and others, that is, with any
+array that uses *steps* (or *strides*) to compute the position of a pixel. Due to this
+compatibility, it is possible to make a Mat header for user-allocated data and process it in-place
+using OpenCV functions.
+
+There are many different ways to create a Mat object. The most popular options are listed below:
+
+- Use the create(nrows, ncols, type) method or the similar Mat(nrows, ncols, type[, fillValue])
+constructor. A new array of the specified size and type is allocated. type has the same meaning as
+in the cvCreateMat method. For example, CV_8UC1 means a 8-bit single-channel array, CV_32FC2
+means a 2-channel (complex) floating-point array, and so on.
+@code
+    // make a 7x7 complex matrix filled with 1+3j.
+    Mat M(7,7,CV_32FC2,Scalar(1,3));
+    // and now turn M to a 100x60 15-channel 8-bit matrix.
+    // The old content will be deallocated
+    M.create(100,60,CV_8UC(15));
+@endcode
+As noted in the introduction to this chapter, create() allocates only a new array when the shape
+or type of the current array are different from the specified ones.
+
+- Create a multi-dimensional array:
+@code
+    // create a 100x100x100 8-bit array
+    int sz[] = {100, 100, 100};
+    Mat bigCube(3, sz, CV_8U, Scalar::all(0));
+@endcode
+It passes the number of dimensions =1 to the Mat constructor but the created array will be
+2-dimensional with the number of columns set to 1. So, Mat::dims is always \>= 2 (can also be 0
+when the array is empty).
+
+- Use a copy constructor or assignment operator where there can be an array or expression on the
+right side (see below). As noted in the introduction, the array assignment is an O(1) operation
+because it only copies the header and increases the reference counter. The Mat::clone() method can
+be used to get a full (deep) copy of the array when you need it.
+
+- Construct a header for a part of another array. It can be a single row, single column, several
+rows, several columns, rectangular region in the array (called a *minor* in algebra) or a
+diagonal. Such operations are also O(1) because the new header references the same data. You can
+actually modify a part of the array using this feature, for example:
+@code
+    // add the 5-th row, multiplied by 3 to the 3rd row
+    M.row(3) = M.row(3) + M.row(5)*3;
+    // now copy the 7-th column to the 1-st column
+    // M.col(1) = M.col(7); // this will not work
+    Mat M1 = M.col(1);
+    M.col(7).copyTo(M1);
+    // create a new 320x240 image
+    Mat img(Size(320,240),CV_8UC3);
+    // select a ROI
+    Mat roi(img, Rect(10,10,100,100));
+    // fill the ROI with (0,255,0) (which is green in RGB space);
+    // the original 320x240 image will be modified
+    roi = Scalar(0,255,0);
+@endcode
+Due to the additional datastart and dataend members, it is possible to compute a relative
+sub-array position in the main *container* array using locateROI():
+@code
+    Mat A = Mat::eye(10, 10, CV_32S);
+    // extracts A columns, 1 (inclusive) to 3 (exclusive).
+    Mat B = A(Range::all(), Range(1, 3));
+    // extracts B rows, 5 (inclusive) to 9 (exclusive).
+    // that is, C \~ A(Range(5, 9), Range(1, 3))
+    Mat C = B(Range(5, 9), Range::all());
+    Size size; Point ofs;
+    C.locateROI(size, ofs);
+    // size will be (width=10,height=10) and the ofs will be (x=1, y=5)
+@endcode
+As in case of whole matrices, if you need a deep copy, use the `clone()` method of the extracted
+sub-matrices.
+
+- Make a header for user-allocated data. It can be useful to do the following:
+    -# Process "foreign" data using OpenCV (for example, when you implement a DirectShow\* filter or
+    a processing module for gstreamer, and so on). For example:
+    @code
+        void process_video_frame(const unsigned char* pixels,
+                                 int width, int height, int step)
+        {
+            Mat img(height, width, CV_8UC3, pixels, step);
+            GaussianBlur(img, img, Size(7,7), 1.5, 1.5);
+        }
+    @endcode
+    -# Quickly initialize small matrices and/or get a super-fast element access.
+    @code
+        double m[3][3] = {{a, b, c}, {d, e, f}, {g, h, i}};
+        Mat M = Mat(3, 3, CV_64F, m).inv();
+    @endcode
+    .
+    Partial yet very common cases of this *user-allocated data* case are conversions from CvMat and
+    IplImage to Mat. For this purpose, there is function cv::cvarrToMat taking pointers to CvMat or
+    IplImage and the optional flag indicating whether to copy the data or not.
+    @snippet samples/cpp/image.cpp iplimage
+
+- Use MATLAB-style array initializers, zeros(), ones(), eye(), for example:
+@code
+    // create a double-precision identity martix and add it to M.
+    M += Mat::eye(M.rows, M.cols, CV_64F);
+@endcode
+
+- Use a comma-separated initializer:
+@code
+    // create a 3x3 double-precision identity matrix
+    Mat M = (Mat_<double>(3,3) << 1, 0, 0, 0, 1, 0, 0, 0, 1);
+@endcode
+With this approach, you first call a constructor of the Mat class with the proper parameters, and
+then you just put `<< operator` followed by comma-separated values that can be constants,
+variables, expressions, and so on. Also, note the extra parentheses required to avoid compilation
+errors.
+
+Once the array is created, it is automatically managed via a reference-counting mechanism. If the
+array header is built on top of user-allocated data, you should handle the data by yourself. The
+array data is deallocated when no one points to it. If you want to release the data pointed by a
+array header before the array destructor is called, use Mat::release().
+
+The next important thing to learn about the array class is element access. This manual already
+described how to compute an address of each array element. Normally, you are not required to use the
+formula directly in the code. If you know the array element type (which can be retrieved using the
+method Mat::type() ), you can access the element \f$M_{ij}\f$ of a 2-dimensional array as:
+@code
+    M.at<double>(i,j) += 1.f;
+@endcode
+assuming that `M` is a double-precision floating-point array. There are several variants of the method
+at for a different number of dimensions.
+
+If you need to process a whole row of a 2D array, the most efficient way is to get the pointer to
+the row first, and then just use the plain C operator [] :
+@code
+    // compute sum of positive matrix elements
+    // (assuming that M isa double-precision matrix)
+    double sum=0;
+    for(int i = 0; i < M.rows; i++)
+    {
+        const double* Mi = M.ptr<double>(i);
+        for(int j = 0; j < M.cols; j++)
+            sum += std::max(Mi[j], 0.);
+    }
+@endcode
+Some operations, like the one above, do not actually depend on the array shape. They just process
+elements of an array one by one (or elements from multiple arrays that have the same coordinates,
+for example, array addition). Such operations are called *element-wise*. It makes sense to check
+whether all the input/output arrays are continuous, namely, have no gaps at the end of each row. If
+yes, process them as a long single row:
+@code
+    // compute the sum of positive matrix elements, optimized variant
+    double sum=0;
+    int cols = M.cols, rows = M.rows;
+    if(M.isContinuous())
+    {
+        cols *= rows;
+        rows = 1;
+    }
+    for(int i = 0; i < rows; i++)
+    {
+        const double* Mi = M.ptr<double>(i);
+        for(int j = 0; j < cols; j++)
+            sum += std::max(Mi[j], 0.);
+    }
+@endcode
+In case of the continuous matrix, the outer loop body is executed just once. So, the overhead is
+smaller, which is especially noticeable in case of small matrices.
+
+Finally, there are STL-style iterators that are smart enough to skip gaps between successive rows:
+@code
+    // compute sum of positive matrix elements, iterator-based variant
+    double sum=0;
+    MatConstIterator_<double> it = M.begin<double>(), it_end = M.end<double>();
+    for(; it != it_end; ++it)
+        sum += std::max(*it, 0.);
+@endcode
+The matrix iterators are random-access iterators, so they can be passed to any STL algorithm,
+including std::sort().
+*/
+class CV_EXPORTS Mat
+{
+public:
+    /**
+    These are various constructors that form a matrix. As noted in the AutomaticAllocation, often
+    the default constructor is enough, and the proper matrix will be allocated by an OpenCV function.
+    The constructed matrix can further be assigned to another matrix or matrix expression or can be
+    allocated with Mat::create . In the former case, the old content is de-referenced.
+     */
+    Mat();
+
+    /** @overload
+    @param rows Number of rows in a 2D array.
+    @param cols Number of columns in a 2D array.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    */
+    Mat(int rows, int cols, int type);
+
+    /** @overload
+    @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the
+    number of columns go in the reverse order.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+      */
+    Mat(Size size, int type);
+
+    /** @overload
+    @param rows Number of rows in a 2D array.
+    @param cols Number of columns in a 2D array.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param s An optional value to initialize each matrix element with. To set all the matrix elements to
+    the particular value after the construction, use the assignment operator
+    Mat::operator=(const Scalar& value) .
+    */
+    Mat(int rows, int cols, int type, const Scalar& s);
+
+    /** @overload
+    @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the
+    number of columns go in the reverse order.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param s An optional value to initialize each matrix element with. To set all the matrix elements to
+    the particular value after the construction, use the assignment operator
+    Mat::operator=(const Scalar& value) .
+      */
+    Mat(Size size, int type, const Scalar& s);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sizes Array of integers specifying an n-dimensional array shape.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    */
+    Mat(int ndims, const int* sizes, int type);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sizes Array of integers specifying an n-dimensional array shape.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param s An optional value to initialize each matrix element with. To set all the matrix elements to
+    the particular value after the construction, use the assignment operator
+    Mat::operator=(const Scalar& value) .
+    */
+    Mat(int ndims, const int* sizes, int type, const Scalar& s);
+
+    /** @overload
+    @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied
+    by these constructors. Instead, the header pointing to m data or its sub-array is constructed and
+    associated with it. The reference counter, if any, is incremented. So, when you modify the matrix
+    formed using such a constructor, you also modify the corresponding elements of m . If you want to
+    have an independent copy of the sub-array, use Mat::clone() .
+    */
+    Mat(const Mat& m);
+
+    /** @overload
+    @param rows Number of rows in a 2D array.
+    @param cols Number of columns in a 2D array.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param data Pointer to the user data. Matrix constructors that take data and step parameters do not
+    allocate matrix data. Instead, they just initialize the matrix header that points to the specified
+    data, which means that no data is copied. This operation is very efficient and can be used to
+    process external data using OpenCV functions. The external data is not automatically deallocated, so
+    you should take care of it.
+    @param step Number of bytes each matrix row occupies. The value should include the padding bytes at
+    the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed
+    and the actual step is calculated as cols*elemSize(). See Mat::elemSize.
+    */
+    Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);
+
+    /** @overload
+    @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the
+    number of columns go in the reverse order.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param data Pointer to the user data. Matrix constructors that take data and step parameters do not
+    allocate matrix data. Instead, they just initialize the matrix header that points to the specified
+    data, which means that no data is copied. This operation is very efficient and can be used to
+    process external data using OpenCV functions. The external data is not automatically deallocated, so
+    you should take care of it.
+    @param step Number of bytes each matrix row occupies. The value should include the padding bytes at
+    the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed
+    and the actual step is calculated as cols*elemSize(). See Mat::elemSize.
+    */
+    Mat(Size size, int type, void* data, size_t step=AUTO_STEP);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sizes Array of integers specifying an n-dimensional array shape.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param data Pointer to the user data. Matrix constructors that take data and step parameters do not
+    allocate matrix data. Instead, they just initialize the matrix header that points to the specified
+    data, which means that no data is copied. This operation is very efficient and can be used to
+    process external data using OpenCV functions. The external data is not automatically deallocated, so
+    you should take care of it.
+    @param steps Array of ndims-1 steps in case of a multi-dimensional array (the last step is always
+    set to the element size). If not specified, the matrix is assumed to be continuous.
+    */
+    Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);
+
+    /** @overload
+    @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied
+    by these constructors. Instead, the header pointing to m data or its sub-array is constructed and
+    associated with it. The reference counter, if any, is incremented. So, when you modify the matrix
+    formed using such a constructor, you also modify the corresponding elements of m . If you want to
+    have an independent copy of the sub-array, use Mat::clone() .
+    @param rowRange Range of the m rows to take. As usual, the range start is inclusive and the range
+    end is exclusive. Use Range::all() to take all the rows.
+    @param colRange Range of the m columns to take. Use Range::all() to take all the columns.
+    */
+    Mat(const Mat& m, const Range& rowRange, const Range& colRange=Range::all());
+
+    /** @overload
+    @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied
+    by these constructors. Instead, the header pointing to m data or its sub-array is constructed and
+    associated with it. The reference counter, if any, is incremented. So, when you modify the matrix
+    formed using such a constructor, you also modify the corresponding elements of m . If you want to
+    have an independent copy of the sub-array, use Mat::clone() .
+    @param roi Region of interest.
+    */
+    Mat(const Mat& m, const Rect& roi);
+
+    /** @overload
+    @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied
+    by these constructors. Instead, the header pointing to m data or its sub-array is constructed and
+    associated with it. The reference counter, if any, is incremented. So, when you modify the matrix
+    formed using such a constructor, you also modify the corresponding elements of m . If you want to
+    have an independent copy of the sub-array, use Mat::clone() .
+    @param ranges Array of selected ranges of m along each dimensionality.
+    */
+    Mat(const Mat& m, const Range* ranges);
+
+    /** @overload
+    @param vec STL vector whose elements form the matrix. The matrix has a single column and the number
+    of rows equal to the number of vector elements. Type of the matrix matches the type of vector
+    elements. The constructor can handle arbitrary types, for which there is a properly declared
+    DataType . This means that the vector elements must be primitive numbers or uni-type numerical
+    tuples of numbers. Mixed-type structures are not supported. The corresponding constructor is
+    explicit. Since STL vectors are not automatically converted to Mat instances, you should write
+    Mat(vec) explicitly. Unless you copy the data into the matrix ( copyData=true ), no new elements
+    will be added to the vector because it can potentially yield vector data reallocation, and, thus,
+    the matrix data pointer will be invalid.
+    @param copyData Flag to specify whether the underlying data of the STL vector should be copied
+    to (true) or shared with (false) the newly constructed matrix. When the data is copied, the
+    allocated buffer is managed using Mat reference counting mechanism. While the data is shared,
+    the reference counter is NULL, and you should not deallocate the data until the matrix is not
+    destructed.
+    */
+    template<typename _Tp> explicit Mat(const std::vector<_Tp>& vec, bool copyData=false);
+
+    /** @overload
+    */
+    template<typename _Tp, int n> explicit Mat(const Vec<_Tp, n>& vec, bool copyData=true);
+
+    /** @overload
+    */
+    template<typename _Tp, int m, int n> explicit Mat(const Matx<_Tp, m, n>& mtx, bool copyData=true);
+
+    /** @overload
+    */
+    template<typename _Tp> explicit Mat(const Point_<_Tp>& pt, bool copyData=true);
+
+    /** @overload
+    */
+    template<typename _Tp> explicit Mat(const Point3_<_Tp>& pt, bool copyData=true);
+
+    /** @overload
+    */
+    template<typename _Tp> explicit Mat(const MatCommaInitializer_<_Tp>& commaInitializer);
+
+    //! download data from GpuMat
+    explicit Mat(const cuda::GpuMat& m);
+
+    //! destructor - calls release()
+    ~Mat();
+
+    /** @brief assignment operators
+
+    These are available assignment operators. Since they all are very different, make sure to read the
+    operator parameters description.
+    @param m Assigned, right-hand-side matrix. Matrix assignment is an O(1) operation. This means that
+    no data is copied but the data is shared and the reference counter, if any, is incremented. Before
+    assigning new data, the old data is de-referenced via Mat::release .
+     */
+    Mat& operator = (const Mat& m);
+
+    /** @overload
+    @param expr Assigned matrix expression object. As opposite to the first form of the assignment
+    operation, the second form can reuse already allocated matrix if it has the right size and type to
+    fit the matrix expression result. It is automatically handled by the real function that the matrix
+    expressions is expanded to. For example, C=A+B is expanded to add(A, B, C), and add takes care of
+    automatic C reallocation.
+    */
+    Mat& operator = (const MatExpr& expr);
+
+    //! retrieve UMat from Mat
+    UMat getUMat(int accessFlags, UMatUsageFlags usageFlags = USAGE_DEFAULT) const;
+
+    /** @brief Creates a matrix header for the specified matrix row.
+
+    The method makes a new header for the specified matrix row and returns it. This is an O(1)
+    operation, regardless of the matrix size. The underlying data of the new matrix is shared with the
+    original matrix. Here is the example of one of the classical basic matrix processing operations,
+    axpy, used by LU and many other algorithms:
+    @code
+        inline void matrix_axpy(Mat& A, int i, int j, double alpha)
+        {
+            A.row(i) += A.row(j)*alpha;
+        }
+    @endcode
+    @note In the current implementation, the following code does not work as expected:
+    @code
+        Mat A;
+        ...
+        A.row(i) = A.row(j); // will not work
+    @endcode
+    This happens because A.row(i) forms a temporary header that is further assigned to another header.
+    Remember that each of these operations is O(1), that is, no data is copied. Thus, the above
+    assignment is not true if you may have expected the j-th row to be copied to the i-th row. To
+    achieve that, you should either turn this simple assignment into an expression or use the
+    Mat::copyTo method:
+    @code
+        Mat A;
+        ...
+        // works, but looks a bit obscure.
+        A.row(i) = A.row(j) + 0;
+        // this is a bit longer, but the recommended method.
+        A.row(j).copyTo(A.row(i));
+    @endcode
+    @param y A 0-based row index.
+     */
+    Mat row(int y) const;
+
+    /** @brief Creates a matrix header for the specified matrix column.
+
+    The method makes a new header for the specified matrix column and returns it. This is an O(1)
+    operation, regardless of the matrix size. The underlying data of the new matrix is shared with the
+    original matrix. See also the Mat::row description.
+    @param x A 0-based column index.
+     */
+    Mat col(int x) const;
+
+    /** @brief Creates a matrix header for the specified row span.
+
+    The method makes a new header for the specified row span of the matrix. Similarly to Mat::row and
+    Mat::col , this is an O(1) operation.
+    @param startrow An inclusive 0-based start index of the row span.
+    @param endrow An exclusive 0-based ending index of the row span.
+     */
+    Mat rowRange(int startrow, int endrow) const;
+
+    /** @overload
+    @param r Range structure containing both the start and the end indices.
+    */
+    Mat rowRange(const Range& r) const;
+
+    /** @brief Creates a matrix header for the specified column span.
+
+    The method makes a new header for the specified column span of the matrix. Similarly to Mat::row and
+    Mat::col , this is an O(1) operation.
+    @param startcol An inclusive 0-based start index of the column span.
+    @param endcol An exclusive 0-based ending index of the column span.
+     */
+    Mat colRange(int startcol, int endcol) const;
+
+    /** @overload
+    @param r Range structure containing both the start and the end indices.
+    */
+    Mat colRange(const Range& r) const;
+
+    /** @brief Extracts a diagonal from a matrix
+
+    The method makes a new header for the specified matrix diagonal. The new matrix is represented as a
+    single-column matrix. Similarly to Mat::row and Mat::col, this is an O(1) operation.
+    @param d index of the diagonal, with the following values:
+    - `d=0` is the main diagonal.
+    - `d>0` is a diagonal from the lower half. For example, d=1 means the diagonal is set
+      immediately below the main one.
+    - `d<0` is a diagonal from the upper half. For example, d=-1 means the diagonal is set
+      immediately above the main one.
+     */
+    Mat diag(int d=0) const;
+
+    /** @brief creates a diagonal matrix
+
+    The method makes a new header for the specified matrix diagonal. The new matrix is represented as a
+    single-column matrix. Similarly to Mat::row and Mat::col, this is an O(1) operation.
+    @param d Single-column matrix that forms a diagonal matrix
+     */
+    static Mat diag(const Mat& d);
+
+    /** @brief Creates a full copy of the array and the underlying data.
+
+    The method creates a full copy of the array. The original step[] is not taken into account. So, the
+    array copy is a continuous array occupying total()*elemSize() bytes.
+     */
+    Mat clone() const;
+
+    /** @brief Copies the matrix to another one.
+
+    The method copies the matrix data to another matrix. Before copying the data, the method invokes :
+    @code
+        m.create(this->size(), this->type());
+    @endcode
+    so that the destination matrix is reallocated if needed. While m.copyTo(m); works flawlessly, the
+    function does not handle the case of a partial overlap between the source and the destination
+    matrices.
+
+    When the operation mask is specified, if the Mat::create call shown above reallocates the matrix,
+    the newly allocated matrix is initialized with all zeros before copying the data.
+    @param m Destination matrix. If it does not have a proper size or type before the operation, it is
+    reallocated.
+     */
+    void copyTo( OutputArray m ) const;
+
+    /** @overload
+    @param m Destination matrix. If it does not have a proper size or type before the operation, it is
+    reallocated.
+    @param mask Operation mask. Its non-zero elements indicate which matrix elements need to be copied.
+    The mask has to be of type CV_8U and can have 1 or multiple channels.
+    */
+    void copyTo( OutputArray m, InputArray mask ) const;
+
+    /** @brief Converts an array to another data type with optional scaling.
+
+    The method converts source pixel values to the target data type. saturate_cast\<\> is applied at
+    the end to avoid possible overflows:
+
+    \f[m(x,y) = saturate \_ cast<rType>( \alpha (*this)(x,y) +  \beta )\f]
+    @param m output matrix; if it does not have a proper size or type before the operation, it is
+    reallocated.
+    @param rtype desired output matrix type or, rather, the depth since the number of channels are the
+    same as the input has; if rtype is negative, the output matrix will have the same type as the input.
+    @param alpha optional scale factor.
+    @param beta optional delta added to the scaled values.
+     */
+    void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;
+
+    /** @brief Provides a functional form of convertTo.
+
+    This is an internally used method called by the @ref MatrixExpressions engine.
+    @param m Destination array.
+    @param type Desired destination array depth (or -1 if it should be the same as the source type).
+     */
+    void assignTo( Mat& m, int type=-1 ) const;
+
+    /** @brief Sets all or some of the array elements to the specified value.
+    @param s Assigned scalar converted to the actual array type.
+    */
+    Mat& operator = (const Scalar& s);
+
+    /** @brief Sets all or some of the array elements to the specified value.
+
+    This is an advanced variant of the Mat::operator=(const Scalar& s) operator.
+    @param value Assigned scalar converted to the actual array type.
+    @param mask Operation mask of the same size as \*this.
+     */
+    Mat& setTo(InputArray value, InputArray mask=noArray());
+
+    /** @brief Changes the shape and/or the number of channels of a 2D matrix without copying the data.
+
+    The method makes a new matrix header for \*this elements. The new matrix may have a different size
+    and/or different number of channels. Any combination is possible if:
+    -   No extra elements are included into the new matrix and no elements are excluded. Consequently,
+        the product rows\*cols\*channels() must stay the same after the transformation.
+    -   No data is copied. That is, this is an O(1) operation. Consequently, if you change the number of
+        rows, or the operation changes the indices of elements row in some other way, the matrix must be
+        continuous. See Mat::isContinuous .
+
+    For example, if there is a set of 3D points stored as an STL vector, and you want to represent the
+    points as a 3xN matrix, do the following:
+    @code
+        std::vector<Point3f> vec;
+        ...
+        Mat pointMat = Mat(vec). // convert vector to Mat, O(1) operation
+                          reshape(1). // make Nx3 1-channel matrix out of Nx1 3-channel.
+                                      // Also, an O(1) operation
+                             t(); // finally, transpose the Nx3 matrix.
+                                  // This involves copying all the elements
+    @endcode
+    @param cn New number of channels. If the parameter is 0, the number of channels remains the same.
+    @param rows New number of rows. If the parameter is 0, the number of rows remains the same.
+     */
+    Mat reshape(int cn, int rows=0) const;
+
+    /** @overload */
+    Mat reshape(int cn, int newndims, const int* newsz) const;
+
+    /** @brief Transposes a matrix.
+
+    The method performs matrix transposition by means of matrix expressions. It does not perform the
+    actual transposition but returns a temporary matrix transposition object that can be further used as
+    a part of more complex matrix expressions or can be assigned to a matrix:
+    @code
+        Mat A1 = A + Mat::eye(A.size(), A.type())*lambda;
+        Mat C = A1.t()*A1; // compute (A + lambda*I)^t * (A + lamda*I)
+    @endcode
+     */
+    MatExpr t() const;
+
+    /** @brief Inverses a matrix.
+
+    The method performs a matrix inversion by means of matrix expressions. This means that a temporary
+    matrix inversion object is returned by the method and can be used further as a part of more complex
+    matrix expressions or can be assigned to a matrix.
+    @param method Matrix inversion method. One of cv::DecompTypes
+     */
+    MatExpr inv(int method=DECOMP_LU) const;
+
+    /** @brief Performs an element-wise multiplication or division of the two matrices.
+
+    The method returns a temporary object encoding per-element array multiplication, with optional
+    scale. Note that this is not a matrix multiplication that corresponds to a simpler "\*" operator.
+
+    Example:
+    @code
+        Mat C = A.mul(5/B); // equivalent to divide(A, B, C, 5)
+    @endcode
+    @param m Another array of the same type and the same size as \*this, or a matrix expression.
+    @param scale Optional scale factor.
+     */
+    MatExpr mul(InputArray m, double scale=1) const;
+
+    /** @brief Computes a cross-product of two 3-element vectors.
+
+    The method computes a cross-product of two 3-element vectors. The vectors must be 3-element
+    floating-point vectors of the same shape and size. The result is another 3-element vector of the
+    same shape and type as operands.
+    @param m Another cross-product operand.
+     */
+    Mat cross(InputArray m) const;
+
+    /** @brief Computes a dot-product of two vectors.
+
+    The method computes a dot-product of two matrices. If the matrices are not single-column or
+    single-row vectors, the top-to-bottom left-to-right scan ordering is used to treat them as 1D
+    vectors. The vectors must have the same size and type. If the matrices have more than one channel,
+    the dot products from all the channels are summed together.
+    @param m another dot-product operand.
+     */
+    double dot(InputArray m) const;
+
+    /** @brief Returns a zero array of the specified size and type.
+
+    The method returns a Matlab-style zero array initializer. It can be used to quickly form a constant
+    array as a function parameter, part of a matrix expression, or as a matrix initializer. :
+    @code
+        Mat A;
+        A = Mat::zeros(3, 3, CV_32F);
+    @endcode
+    In the example above, a new matrix is allocated only if A is not a 3x3 floating-point matrix.
+    Otherwise, the existing matrix A is filled with zeros.
+    @param rows Number of rows.
+    @param cols Number of columns.
+    @param type Created matrix type.
+     */
+    static MatExpr zeros(int rows, int cols, int type);
+
+    /** @overload
+    @param size Alternative to the matrix size specification Size(cols, rows) .
+    @param type Created matrix type.
+    */
+    static MatExpr zeros(Size size, int type);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sz Array of integers specifying the array shape.
+    @param type Created matrix type.
+    */
+    static MatExpr zeros(int ndims, const int* sz, int type);
+
+    /** @brief Returns an array of all 1's of the specified size and type.
+
+    The method returns a Matlab-style 1's array initializer, similarly to Mat::zeros. Note that using
+    this method you can initialize an array with an arbitrary value, using the following Matlab idiom:
+    @code
+        Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.
+    @endcode
+    The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it
+    just remembers the scale factor (3 in this case) and use it when actually invoking the matrix
+    initializer.
+    @param rows Number of rows.
+    @param cols Number of columns.
+    @param type Created matrix type.
+     */
+    static MatExpr ones(int rows, int cols, int type);
+
+    /** @overload
+    @param size Alternative to the matrix size specification Size(cols, rows) .
+    @param type Created matrix type.
+    */
+    static MatExpr ones(Size size, int type);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sz Array of integers specifying the array shape.
+    @param type Created matrix type.
+    */
+    static MatExpr ones(int ndims, const int* sz, int type);
+
+    /** @brief Returns an identity matrix of the specified size and type.
+
+    The method returns a Matlab-style identity matrix initializer, similarly to Mat::zeros. Similarly to
+    Mat::ones, you can use a scale operation to create a scaled identity matrix efficiently:
+    @code
+        // make a 4x4 diagonal matrix with 0.1's on the diagonal.
+        Mat A = Mat::eye(4, 4, CV_32F)*0.1;
+    @endcode
+    @param rows Number of rows.
+    @param cols Number of columns.
+    @param type Created matrix type.
+     */
+    static MatExpr eye(int rows, int cols, int type);
+
+    /** @overload
+    @param size Alternative matrix size specification as Size(cols, rows) .
+    @param type Created matrix type.
+    */
+    static MatExpr eye(Size size, int type);
+
+    /** @brief Allocates new array data if needed.
+
+    This is one of the key Mat methods. Most new-style OpenCV functions and methods that produce arrays
+    call this method for each output array. The method uses the following algorithm:
+
+    -# If the current array shape and the type match the new ones, return immediately. Otherwise,
+       de-reference the previous data by calling Mat::release.
+    -# Initialize the new header.
+    -# Allocate the new data of total()\*elemSize() bytes.
+    -# Allocate the new, associated with the data, reference counter and set it to 1.
+
+    Such a scheme makes the memory management robust and efficient at the same time and helps avoid
+    extra typing for you. This means that usually there is no need to explicitly allocate output arrays.
+    That is, instead of writing:
+    @code
+        Mat color;
+        ...
+        Mat gray(color.rows, color.cols, color.depth());
+        cvtColor(color, gray, COLOR_BGR2GRAY);
+    @endcode
+    you can simply write:
+    @code
+        Mat color;
+        ...
+        Mat gray;
+        cvtColor(color, gray, COLOR_BGR2GRAY);
+    @endcode
+    because cvtColor, as well as the most of OpenCV functions, calls Mat::create() for the output array
+    internally.
+    @param rows New number of rows.
+    @param cols New number of columns.
+    @param type New matrix type.
+     */
+    void create(int rows, int cols, int type);
+
+    /** @overload
+    @param size Alternative new matrix size specification: Size(cols, rows)
+    @param type New matrix type.
+    */
+    void create(Size size, int type);
+
+    /** @overload
+    @param ndims New array dimensionality.
+    @param sizes Array of integers specifying a new array shape.
+    @param type New matrix type.
+    */
+    void create(int ndims, const int* sizes, int type);
+
+    /** @brief Increments the reference counter.
+
+    The method increments the reference counter associated with the matrix data. If the matrix header
+    points to an external data set (see Mat::Mat ), the reference counter is NULL, and the method has no
+    effect in this case. Normally, to avoid memory leaks, the method should not be called explicitly. It
+    is called implicitly by the matrix assignment operator. The reference counter increment is an atomic
+    operation on the platforms that support it. Thus, it is safe to operate on the same matrices
+    asynchronously in different threads.
+     */
+    void addref();
+
+    /** @brief Decrements the reference counter and deallocates the matrix if needed.
+
+    The method decrements the reference counter associated with the matrix data. When the reference
+    counter reaches 0, the matrix data is deallocated and the data and the reference counter pointers
+    are set to NULL's. If the matrix header points to an external data set (see Mat::Mat ), the
+    reference counter is NULL, and the method has no effect in this case.
+
+    This method can be called manually to force the matrix data deallocation. But since this method is
+    automatically called in the destructor, or by any other method that changes the data pointer, it is
+    usually not needed. The reference counter decrement and check for 0 is an atomic operation on the
+    platforms that support it. Thus, it is safe to operate on the same matrices asynchronously in
+    different threads.
+     */
+    void release();
+
+    //! deallocates the matrix data
+    void deallocate();
+    //! internal use function; properly re-allocates _size, _step arrays
+    void copySize(const Mat& m);
+
+    /** @brief Reserves space for the certain number of rows.
+
+    The method reserves space for sz rows. If the matrix already has enough space to store sz rows,
+    nothing happens. If the matrix is reallocated, the first Mat::rows rows are preserved. The method
+    emulates the corresponding method of the STL vector class.
+    @param sz Number of rows.
+     */
+    void reserve(size_t sz);
+
+    /** @brief Changes the number of matrix rows.
+
+    The methods change the number of matrix rows. If the matrix is reallocated, the first
+    min(Mat::rows, sz) rows are preserved. The methods emulate the corresponding methods of the STL
+    vector class.
+    @param sz New number of rows.
+     */
+    void resize(size_t sz);
+
+    /** @overload
+    @param sz New number of rows.
+    @param s Value assigned to the newly added elements.
+     */
+    void resize(size_t sz, const Scalar& s);
+
+    //! internal function
+    void push_back_(const void* elem);
+
+    /** @brief Adds elements to the bottom of the matrix.
+
+    The methods add one or more elements to the bottom of the matrix. They emulate the corresponding
+    method of the STL vector class. When elem is Mat , its type and the number of columns must be the
+    same as in the container matrix.
+    @param elem Added element(s).
+     */
+    template<typename _Tp> void push_back(const _Tp& elem);
+
+    /** @overload
+    @param elem Added element(s).
+    */
+    template<typename _Tp> void push_back(const Mat_<_Tp>& elem);
+
+    /** @overload
+    @param m Added line(s).
+    */
+    void push_back(const Mat& m);
+
+    /** @brief Removes elements from the bottom of the matrix.
+
+    The method removes one or more rows from the bottom of the matrix.
+    @param nelems Number of removed rows. If it is greater than the total number of rows, an exception
+    is thrown.
+     */
+    void pop_back(size_t nelems=1);
+
+    /** @brief Locates the matrix header within a parent matrix.
+
+    After you extracted a submatrix from a matrix using Mat::row, Mat::col, Mat::rowRange,
+    Mat::colRange, and others, the resultant submatrix points just to the part of the original big
+    matrix. However, each submatrix contains information (represented by datastart and dataend
+    fields) that helps reconstruct the original matrix size and the position of the extracted
+    submatrix within the original matrix. The method locateROI does exactly that.
+    @param wholeSize Output parameter that contains the size of the whole matrix containing *this*
+    as a part.
+    @param ofs Output parameter that contains an offset of *this* inside the whole matrix.
+     */
+    void locateROI( Size& wholeSize, Point& ofs ) const;
+
+    /** @brief Adjusts a submatrix size and position within the parent matrix.
+
+    The method is complimentary to Mat::locateROI . The typical use of these functions is to determine
+    the submatrix position within the parent matrix and then shift the position somehow. Typically, it
+    can be required for filtering operations when pixels outside of the ROI should be taken into
+    account. When all the method parameters are positive, the ROI needs to grow in all directions by the
+    specified amount, for example:
+    @code
+        A.adjustROI(2, 2, 2, 2);
+    @endcode
+    In this example, the matrix size is increased by 4 elements in each direction. The matrix is shifted
+    by 2 elements to the left and 2 elements up, which brings in all the necessary pixels for the
+    filtering with the 5x5 kernel.
+
+    adjustROI forces the adjusted ROI to be inside of the parent matrix that is boundaries of the
+    adjusted ROI are constrained by boundaries of the parent matrix. For example, if the submatrix A is
+    located in the first row of a parent matrix and you called A.adjustROI(2, 2, 2, 2) then A will not
+    be increased in the upward direction.
+
+    The function is used internally by the OpenCV filtering functions, like filter2D , morphological
+    operations, and so on.
+    @param dtop Shift of the top submatrix boundary upwards.
+    @param dbottom Shift of the bottom submatrix boundary downwards.
+    @param dleft Shift of the left submatrix boundary to the left.
+    @param dright Shift of the right submatrix boundary to the right.
+    @sa copyMakeBorder
+     */
+    Mat& adjustROI( int dtop, int dbottom, int dleft, int dright );
+
+    /** @brief Extracts a rectangular submatrix.
+
+    The operators make a new header for the specified sub-array of \*this . They are the most
+    generalized forms of Mat::row, Mat::col, Mat::rowRange, and Mat::colRange . For example,
+    `A(Range(0, 10), Range::all())` is equivalent to `A.rowRange(0, 10)`. Similarly to all of the above,
+    the operators are O(1) operations, that is, no matrix data is copied.
+    @param rowRange Start and end row of the extracted submatrix. The upper boundary is not included. To
+    select all the rows, use Range::all().
+    @param colRange Start and end column of the extracted submatrix. The upper boundary is not included.
+    To select all the columns, use Range::all().
+     */
+    Mat operator()( Range rowRange, Range colRange ) const;
+
+    /** @overload
+    @param roi Extracted submatrix specified as a rectangle.
+    */
+    Mat operator()( const Rect& roi ) const;
+
+    /** @overload
+    @param ranges Array of selected ranges along each array dimension.
+    */
+    Mat operator()( const Range* ranges ) const;
+
+    // //! converts header to CvMat; no data is copied
+    // operator CvMat() const;
+    // //! converts header to CvMatND; no data is copied
+    // operator CvMatND() const;
+    // //! converts header to IplImage; no data is copied
+    // operator IplImage() const;
+
+    template<typename _Tp> operator std::vector<_Tp>() const;
+    template<typename _Tp, int n> operator Vec<_Tp, n>() const;
+    template<typename _Tp, int m, int n> operator Matx<_Tp, m, n>() const;
+
+    /** @brief Reports whether the matrix is continuous or not.
+
+    The method returns true if the matrix elements are stored continuously without gaps at the end of
+    each row. Otherwise, it returns false. Obviously, 1x1 or 1xN matrices are always continuous.
+    Matrices created with Mat::create are always continuous. But if you extract a part of the matrix
+    using Mat::col, Mat::diag, and so on, or constructed a matrix header for externally allocated data,
+    such matrices may no longer have this property.
+
+    The continuity flag is stored as a bit in the Mat::flags field and is computed automatically when
+    you construct a matrix header. Thus, the continuity check is a very fast operation, though
+    theoretically it could be done as follows:
+    @code
+        // alternative implementation of Mat::isContinuous()
+        bool myCheckMatContinuity(const Mat& m)
+        {
+            //return (m.flags & Mat::CONTINUOUS_FLAG) != 0;
+            return m.rows == 1 || m.step == m.cols*m.elemSize();
+        }
+    @endcode
+    The method is used in quite a few of OpenCV functions. The point is that element-wise operations
+    (such as arithmetic and logical operations, math functions, alpha blending, color space
+    transformations, and others) do not depend on the image geometry. Thus, if all the input and output
+    arrays are continuous, the functions can process them as very long single-row vectors. The example
+    below illustrates how an alpha-blending function can be implemented:
+    @code
+        template<typename T>
+        void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst)
+        {
+            const float alpha_scale = (float)std::numeric_limits<T>::max(),
+                        inv_scale = 1.f/alpha_scale;
+
+            CV_Assert( src1.type() == src2.type() &&
+                       src1.type() == CV_MAKETYPE(DataType<T>::depth, 4) &&
+                       src1.size() == src2.size());
+            Size size = src1.size();
+            dst.create(size, src1.type());
+
+            // here is the idiom: check the arrays for continuity and,
+            // if this is the case,
+            // treat the arrays as 1D vectors
+            if( src1.isContinuous() && src2.isContinuous() && dst.isContinuous() )
+            {
+                size.width *= size.height;
+                size.height = 1;
+            }
+            size.width *= 4;
+
+            for( int i = 0; i < size.height; i++ )
+            {
+                // when the arrays are continuous,
+                // the outer loop is executed only once
+                const T* ptr1 = src1.ptr<T>(i);
+                const T* ptr2 = src2.ptr<T>(i);
+                T* dptr = dst.ptr<T>(i);
+
+                for( int j = 0; j < size.width; j += 4 )
+                {
+                    float alpha = ptr1[j+3]*inv_scale, beta = ptr2[j+3]*inv_scale;
+                    dptr[j] = saturate_cast<T>(ptr1[j]*alpha + ptr2[j]*beta);
+                    dptr[j+1] = saturate_cast<T>(ptr1[j+1]*alpha + ptr2[j+1]*beta);
+                    dptr[j+2] = saturate_cast<T>(ptr1[j+2]*alpha + ptr2[j+2]*beta);
+                    dptr[j+3] = saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale);
+                }
+            }
+        }
+    @endcode
+    This approach, while being very simple, can boost the performance of a simple element-operation by
+    10-20 percents, especially if the image is rather small and the operation is quite simple.
+
+    Another OpenCV idiom in this function, a call of Mat::create for the destination array, that
+    allocates the destination array unless it already has the proper size and type. And while the newly
+    allocated arrays are always continuous, you still need to check the destination array because
+    Mat::create does not always allocate a new matrix.
+     */
+    bool isContinuous() const;
+
+    //! returns true if the matrix is a submatrix of another matrix
+    bool isSubmatrix() const;
+
+    /** @brief Returns the matrix element size in bytes.
+
+    The method returns the matrix element size in bytes. For example, if the matrix type is CV_16SC3 ,
+    the method returns 3\*sizeof(short) or 6.
+     */
+    size_t elemSize() const;
+
+    /** @brief Returns the size of each matrix element channel in bytes.
+
+    The method returns the matrix element channel size in bytes, that is, it ignores the number of
+    channels. For example, if the matrix type is CV_16SC3 , the method returns sizeof(short) or 2.
+     */
+    size_t elemSize1() const;
+
+    /** @brief Returns the type of a matrix element.
+
+    The method returns a matrix element type. This is an identifier compatible with the CvMat type
+    system, like CV_16SC3 or 16-bit signed 3-channel array, and so on.
+     */
+    int type() const;
+
+    /** @brief Returns the depth of a matrix element.
+
+    The method returns the identifier of the matrix element depth (the type of each individual channel).
+    For example, for a 16-bit signed element array, the method returns CV_16S . A complete list of
+    matrix types contains the following values:
+    -   CV_8U - 8-bit unsigned integers ( 0..255 )
+    -   CV_8S - 8-bit signed integers ( -128..127 )
+    -   CV_16U - 16-bit unsigned integers ( 0..65535 )
+    -   CV_16S - 16-bit signed integers ( -32768..32767 )
+    -   CV_32S - 32-bit signed integers ( -2147483648..2147483647 )
+    -   CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )
+    -   CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )
+     */
+    int depth() const;
+
+    /** @brief Returns the number of matrix channels.
+
+    The method returns the number of matrix channels.
+     */
+    int channels() const;
+
+    /** @brief Returns a normalized step.
+
+    The method returns a matrix step divided by Mat::elemSize1() . It can be useful to quickly access an
+    arbitrary matrix element.
+     */
+    size_t step1(int i=0) const;
+
+    /** @brief Returns true if the array has no elements.
+
+    The method returns true if Mat::total() is 0 or if Mat::data is NULL. Because of pop_back() and
+    resize() methods `M.total() == 0` does not imply that `M.data == NULL`.
+     */
+    bool empty() const;
+
+    /** @brief Returns the total number of array elements.
+
+    The method returns the number of array elements (a number of pixels if the array represents an
+    image).
+     */
+    size_t total() const;
+
+    //! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise
+    int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const;
+
+    /** @brief Returns a pointer to the specified matrix row.
+
+    The methods return `uchar*` or typed pointer to the specified matrix row. See the sample in
+    Mat::isContinuous to know how to use these methods.
+    @param i0 A 0-based row index.
+     */
+    uchar* ptr(int i0=0);
+    /** @overload */
+    const uchar* ptr(int i0=0) const;
+
+    /** @overload */
+    uchar* ptr(int i0, int i1);
+    /** @overload */
+    const uchar* ptr(int i0, int i1) const;
+
+    /** @overload */
+    uchar* ptr(int i0, int i1, int i2);
+    /** @overload */
+    const uchar* ptr(int i0, int i1, int i2) const;
+
+    /** @overload */
+    uchar* ptr(const int* idx);
+    /** @overload */
+    const uchar* ptr(const int* idx) const;
+    /** @overload */
+    template<int n> uchar* ptr(const Vec<int, n>& idx);
+    /** @overload */
+    template<int n> const uchar* ptr(const Vec<int, n>& idx) const;
+
+    /** @overload */
+    template<typename _Tp> _Tp* ptr(int i0=0);
+    /** @overload */
+    template<typename _Tp> const _Tp* ptr(int i0=0) const;
+    /** @overload */
+    template<typename _Tp> _Tp* ptr(int i0, int i1);
+    /** @overload */
+    template<typename _Tp> const _Tp* ptr(int i0, int i1) const;
+    /** @overload */
+    template<typename _Tp> _Tp* ptr(int i0, int i1, int i2);
+    /** @overload */
+    template<typename _Tp> const _Tp* ptr(int i0, int i1, int i2) const;
+    /** @overload */
+    template<typename _Tp> _Tp* ptr(const int* idx);
+    /** @overload */
+    template<typename _Tp> const _Tp* ptr(const int* idx) const;
+    /** @overload */
+    template<typename _Tp, int n> _Tp* ptr(const Vec<int, n>& idx);
+    /** @overload */
+    template<typename _Tp, int n> const _Tp* ptr(const Vec<int, n>& idx) const;
+
+    /** @brief Returns a reference to the specified array element.
+
+    The template methods return a reference to the specified array element. For the sake of higher
+    performance, the index range checks are only performed in the Debug configuration.
+
+    Note that the variants with a single index (i) can be used to access elements of single-row or
+    single-column 2-dimensional arrays. That is, if, for example, A is a 1 x N floating-point matrix and
+    B is an M x 1 integer matrix, you can simply write `A.at<float>(k+4)` and `B.at<int>(2*i+1)`
+    instead of `A.at<float>(0,k+4)` and `B.at<int>(2*i+1,0)`, respectively.
+
+    The example below initializes a Hilbert matrix:
+    @code
+        Mat H(100, 100, CV_64F);
+        for(int i = 0; i < H.rows; i++)
+            for(int j = 0; j < H.cols; j++)
+                H.at<double>(i,j)=1./(i+j+1);
+    @endcode
+    @param i0 Index along the dimension 0
+     */
+    template<typename _Tp> _Tp& at(int i0=0);
+    /** @overload
+    @param i0 Index along the dimension 0
+    */
+    template<typename _Tp> const _Tp& at(int i0=0) const;
+    /** @overload
+    @param i0 Index along the dimension 0
+    @param i1 Index along the dimension 1
+    */
+    template<typename _Tp> _Tp& at(int i0, int i1);
+    /** @overload
+    @param i0 Index along the dimension 0
+    @param i1 Index along the dimension 1
+    */
+    template<typename _Tp> const _Tp& at(int i0, int i1) const;
+
+    /** @overload
+    @param i0 Index along the dimension 0
+    @param i1 Index along the dimension 1
+    @param i2 Index along the dimension 2
+    */
+    template<typename _Tp> _Tp& at(int i0, int i1, int i2);
+    /** @overload
+    @param i0 Index along the dimension 0
+    @param i1 Index along the dimension 1
+    @param i2 Index along the dimension 2
+    */
+    template<typename _Tp> const _Tp& at(int i0, int i1, int i2) const;
+
+    /** @overload
+    @param idx Array of Mat::dims indices.
+    */
+    template<typename _Tp> _Tp& at(const int* idx);
+    /** @overload
+    @param idx Array of Mat::dims indices.
+    */
+    template<typename _Tp> const _Tp& at(const int* idx) const;
+
+    /** @overload */
+    template<typename _Tp, int n> _Tp& at(const Vec<int, n>& idx);
+    /** @overload */
+    template<typename _Tp, int n> const _Tp& at(const Vec<int, n>& idx) const;
+
+    /** @overload
+    special versions for 2D arrays (especially convenient for referencing image pixels)
+    @param pt Element position specified as Point(j,i) .
+    */
+    template<typename _Tp> _Tp& at(Point pt);
+    /** @overload
+    special versions for 2D arrays (especially convenient for referencing image pixels)
+    @param pt Element position specified as Point(j,i) .
+    */
+    template<typename _Tp> const _Tp& at(Point pt) const;
+
+    /** @brief Returns the matrix iterator and sets it to the first matrix element.
+
+    The methods return the matrix read-only or read-write iterators. The use of matrix iterators is very
+    similar to the use of bi-directional STL iterators. In the example below, the alpha blending
+    function is rewritten using the matrix iterators:
+    @code
+        template<typename T>
+        void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst)
+        {
+            typedef Vec<T, 4> VT;
+
+            const float alpha_scale = (float)std::numeric_limits<T>::max(),
+                        inv_scale = 1.f/alpha_scale;
+
+            CV_Assert( src1.type() == src2.type() &&
+                       src1.type() == DataType<VT>::type &&
+                       src1.size() == src2.size());
+            Size size = src1.size();
+            dst.create(size, src1.type());
+
+            MatConstIterator_<VT> it1 = src1.begin<VT>(), it1_end = src1.end<VT>();
+            MatConstIterator_<VT> it2 = src2.begin<VT>();
+            MatIterator_<VT> dst_it = dst.begin<VT>();
+
+            for( ; it1 != it1_end; ++it1, ++it2, ++dst_it )
+            {
+                VT pix1 = *it1, pix2 = *it2;
+                float alpha = pix1[3]*inv_scale, beta = pix2[3]*inv_scale;
+                *dst_it = VT(saturate_cast<T>(pix1[0]*alpha + pix2[0]*beta),
+                             saturate_cast<T>(pix1[1]*alpha + pix2[1]*beta),
+                             saturate_cast<T>(pix1[2]*alpha + pix2[2]*beta),
+                             saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale));
+            }
+        }
+    @endcode
+     */
+    template<typename _Tp> MatIterator_<_Tp> begin();
+    template<typename _Tp> MatConstIterator_<_Tp> begin() const;
+
+    /** @brief Returns the matrix iterator and sets it to the after-last matrix element.
+
+    The methods return the matrix read-only or read-write iterators, set to the point following the last
+    matrix element.
+     */
+    template<typename _Tp> MatIterator_<_Tp> end();
+    template<typename _Tp> MatConstIterator_<_Tp> end() const;
+
+    /** @brief Invoke with arguments functor, and runs the functor over all matrix element.
+
+    The methods runs operation in parallel. Operation is passed by arguments. Operation have to be a
+    function pointer, a function object or a lambda(C++11).
+
+    All of below operation is equal. Put 0xFF to first channel of all matrix elements:
+    @code
+        Mat image(1920, 1080, CV_8UC3);
+        typedef cv::Point3_<uint8_t> Pixel;
+
+        // first. raw pointer access.
+        for (int r = 0; r < image.rows; ++r) {
+            Pixel* ptr = image.ptr<Pixel>(0, r);
+            const Pixel* ptr_end = ptr + image.cols;
+            for (; ptr != ptr_end; ++ptr) {
+                ptr->x = 255;
+            }
+        }
+
+        // Using MatIterator. (Simple but there are a Iterator's overhead)
+        for (Pixel &p : cv::Mat_<Pixel>(image)) {
+            p.x = 255;
+        }
+
+        // Parallel execution with function object.
+        struct Operator {
+            void operator ()(Pixel &pixel, const int * position) {
+                pixel.x = 255;
+            }
+        };
+        image.forEach<Pixel>(Operator());
+
+        // Parallel execution using C++11 lambda.
+        image.forEach<Pixel>([](Pixel &p, const int * position) -> void {
+            p.x = 255;
+        });
+    @endcode
+    position parameter is index of current pixel:
+    @code
+        // Creating 3D matrix (255 x 255 x 255) typed uint8_t,
+        //  and initialize all elements by the value which equals elements position.
+        //  i.e. pixels (x,y,z) = (1,2,3) is (b,g,r) = (1,2,3).
+
+        int sizes[] = { 255, 255, 255 };
+        typedef cv::Point3_<uint8_t> Pixel;
+
+        Mat_<Pixel> image = Mat::zeros(3, sizes, CV_8UC3);
+
+        image.forEachWithPosition([&](Pixel& pixel, const int position[]) -> void{
+            pixel.x = position[0];
+            pixel.y = position[1];
+            pixel.z = position[2];
+        });
+    @endcode
+     */
+    template<typename _Tp, typename Functor> void forEach(const Functor& operation);
+    /** @overload */
+    template<typename _Tp, typename Functor> void forEach(const Functor& operation) const;
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+    Mat(Mat&& m);
+    Mat& operator = (Mat&& m);
+#endif
+
+    enum { MAGIC_VAL  = 0x42FF0000, AUTO_STEP = 0, CONTINUOUS_FLAG = CV_MAT_CONT_FLAG, SUBMATRIX_FLAG = CV_SUBMAT_FLAG };
+    enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 };
+
+    /*! includes several bit-fields:
+         - the magic signature
+         - continuity flag
+         - depth
+         - number of channels
+     */
+    int flags;
+    //! the matrix dimensionality, >= 2
+    int dims;
+    //! the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
+    int rows, cols;
+    //! pointer to the data
+    uchar* data;
+
+    //! helper fields used in locateROI and adjustROI
+    const uchar* datastart;
+    const uchar* dataend;
+    const uchar* datalimit;
+
+    //! custom allocator
+    MatAllocator* allocator;
+    //! and the standard allocator
+    static MatAllocator* getStdAllocator();
+    static MatAllocator* getDefaultAllocator();
+    static void setDefaultAllocator(MatAllocator* allocator);
+
+    //! interaction with UMat
+    UMatData* u;
+
+    MatSize size;
+    MatStep step;
+
+protected:
+    template<typename _Tp, typename Functor> void forEach_impl(const Functor& operation);
+};
+
+
+///////////////////////////////// Mat_<_Tp> ////////////////////////////////////
+
+/** @brief Template matrix class derived from Mat
+
+@code
+    template<typename _Tp> class Mat_ : public Mat
+    {
+    public:
+        // ... some specific methods
+        //         and
+        // no new extra fields
+    };
+@endcode
+The class `Mat_<_Tp>` is a *thin* template wrapper on top of the Mat class. It does not have any
+extra data fields. Nor this class nor Mat has any virtual methods. Thus, references or pointers to
+these two classes can be freely but carefully converted one to another. For example:
+@code
+    // create a 100x100 8-bit matrix
+    Mat M(100,100,CV_8U);
+    // this will be compiled fine. no any data conversion will be done.
+    Mat_<float>& M1 = (Mat_<float>&)M;
+    // the program is likely to crash at the statement below
+    M1(99,99) = 1.f;
+@endcode
+While Mat is sufficient in most cases, Mat_ can be more convenient if you use a lot of element
+access operations and if you know matrix type at the compilation time. Note that
+`Mat::at(int y,int x)` and `Mat_::operator()(int y,int x)` do absolutely the same
+and run at the same speed, but the latter is certainly shorter:
+@code
+    Mat_<double> M(20,20);
+    for(int i = 0; i < M.rows; i++)
+        for(int j = 0; j < M.cols; j++)
+            M(i,j) = 1./(i+j+1);
+    Mat E, V;
+    eigen(M,E,V);
+    cout << E.at<double>(0,0)/E.at<double>(M.rows-1,0);
+@endcode
+To use Mat_ for multi-channel images/matrices, pass Vec as a Mat_ parameter:
+@code
+    // allocate a 320x240 color image and fill it with green (in RGB space)
+    Mat_<Vec3b> img(240, 320, Vec3b(0,255,0));
+    // now draw a diagonal white line
+    for(int i = 0; i < 100; i++)
+        img(i,i)=Vec3b(255,255,255);
+    // and now scramble the 2nd (red) channel of each pixel
+    for(int i = 0; i < img.rows; i++)
+        for(int j = 0; j < img.cols; j++)
+            img(i,j)[2] ^= (uchar)(i ^ j);
+@endcode
+ */
+template<typename _Tp> class Mat_ : public Mat
+{
+public:
+    typedef _Tp value_type;
+    typedef typename DataType<_Tp>::channel_type channel_type;
+    typedef MatIterator_<_Tp> iterator;
+    typedef MatConstIterator_<_Tp> const_iterator;
+
+    //! default constructor
+    Mat_();
+    //! equivalent to Mat(_rows, _cols, DataType<_Tp>::type)
+    Mat_(int _rows, int _cols);
+    //! constructor that sets each matrix element to specified value
+    Mat_(int _rows, int _cols, const _Tp& value);
+    //! equivalent to Mat(_size, DataType<_Tp>::type)
+    explicit Mat_(Size _size);
+    //! constructor that sets each matrix element to specified value
+    Mat_(Size _size, const _Tp& value);
+    //! n-dim array constructor
+    Mat_(int _ndims, const int* _sizes);
+    //! n-dim array constructor that sets each matrix element to specified value
+    Mat_(int _ndims, const int* _sizes, const _Tp& value);
+    //! copy/conversion contructor. If m is of different type, it's converted
+    Mat_(const Mat& m);
+    //! copy constructor
+    Mat_(const Mat_& m);
+    //! constructs a matrix on top of user-allocated data. step is in bytes(!!!), regardless of the type
+    Mat_(int _rows, int _cols, _Tp* _data, size_t _step=AUTO_STEP);
+    //! constructs n-dim matrix on top of user-allocated data. steps are in bytes(!!!), regardless of the type
+    Mat_(int _ndims, const int* _sizes, _Tp* _data, const size_t* _steps=0);
+    //! selects a submatrix
+    Mat_(const Mat_& m, const Range& rowRange, const Range& colRange=Range::all());
+    //! selects a submatrix
+    Mat_(const Mat_& m, const Rect& roi);
+    //! selects a submatrix, n-dim version
+    Mat_(const Mat_& m, const Range* ranges);
+    //! from a matrix expression
+    explicit Mat_(const MatExpr& e);
+    //! makes a matrix out of Vec, std::vector, Point_ or Point3_. The matrix will have a single column
+    explicit Mat_(const std::vector<_Tp>& vec, bool copyData=false);
+    template<int n> explicit Mat_(const Vec<typename DataType<_Tp>::channel_type, n>& vec, bool copyData=true);
+    template<int m, int n> explicit Mat_(const Matx<typename DataType<_Tp>::channel_type, m, n>& mtx, bool copyData=true);
+    explicit Mat_(const Point_<typename DataType<_Tp>::channel_type>& pt, bool copyData=true);
+    explicit Mat_(const Point3_<typename DataType<_Tp>::channel_type>& pt, bool copyData=true);
+    explicit Mat_(const MatCommaInitializer_<_Tp>& commaInitializer);
+
+    Mat_& operator = (const Mat& m);
+    Mat_& operator = (const Mat_& m);
+    //! set all the elements to s.
+    Mat_& operator = (const _Tp& s);
+    //! assign a matrix expression
+    Mat_& operator = (const MatExpr& e);
+
+    //! iterators; they are smart enough to skip gaps in the end of rows
+    iterator begin();
+    iterator end();
+    const_iterator begin() const;
+    const_iterator end() const;
+
+    //! template methods for for operation over all matrix elements.
+    // the operations take care of skipping gaps in the end of rows (if any)
+    template<typename Functor> void forEach(const Functor& operation);
+    template<typename Functor> void forEach(const Functor& operation) const;
+
+    //! equivalent to Mat::create(_rows, _cols, DataType<_Tp>::type)
+    void create(int _rows, int _cols);
+    //! equivalent to Mat::create(_size, DataType<_Tp>::type)
+    void create(Size _size);
+    //! equivalent to Mat::create(_ndims, _sizes, DatType<_Tp>::type)
+    void create(int _ndims, const int* _sizes);
+    //! cross-product
+    Mat_ cross(const Mat_& m) const;
+    //! data type conversion
+    template<typename T2> operator Mat_<T2>() const;
+    //! overridden forms of Mat::row() etc.
+    Mat_ row(int y) const;
+    Mat_ col(int x) const;
+    Mat_ diag(int d=0) const;
+    Mat_ clone() const;
+
+    //! overridden forms of Mat::elemSize() etc.
+    size_t elemSize() const;
+    size_t elemSize1() const;
+    int type() const;
+    int depth() const;
+    int channels() const;
+    size_t step1(int i=0) const;
+    //! returns step()/sizeof(_Tp)
+    size_t stepT(int i=0) const;
+
+    //! overridden forms of Mat::zeros() etc. Data type is omitted, of course
+    static MatExpr zeros(int rows, int cols);
+    static MatExpr zeros(Size size);
+    static MatExpr zeros(int _ndims, const int* _sizes);
+    static MatExpr ones(int rows, int cols);
+    static MatExpr ones(Size size);
+    static MatExpr ones(int _ndims, const int* _sizes);
+    static MatExpr eye(int rows, int cols);
+    static MatExpr eye(Size size);
+
+    //! some more overriden methods
+    Mat_& adjustROI( int dtop, int dbottom, int dleft, int dright );
+    Mat_ operator()( const Range& rowRange, const Range& colRange ) const;
+    Mat_ operator()( const Rect& roi ) const;
+    Mat_ operator()( const Range* ranges ) const;
+
+    //! more convenient forms of row and element access operators
+    _Tp* operator [](int y);
+    const _Tp* operator [](int y) const;
+
+    //! returns reference to the specified element
+    _Tp& operator ()(const int* idx);
+    //! returns read-only reference to the specified element
+    const _Tp& operator ()(const int* idx) const;
+
+    //! returns reference to the specified element
+    template<int n> _Tp& operator ()(const Vec<int, n>& idx);
+    //! returns read-only reference to the specified element
+    template<int n> const _Tp& operator ()(const Vec<int, n>& idx) const;
+
+    //! returns reference to the specified element (1D case)
+    _Tp& operator ()(int idx0);
+    //! returns read-only reference to the specified element (1D case)
+    const _Tp& operator ()(int idx0) const;
+    //! returns reference to the specified element (2D case)
+    _Tp& operator ()(int idx0, int idx1);
+    //! returns read-only reference to the specified element (2D case)
+    const _Tp& operator ()(int idx0, int idx1) const;
+    //! returns reference to the specified element (3D case)
+    _Tp& operator ()(int idx0, int idx1, int idx2);
+    //! returns read-only reference to the specified element (3D case)
+    const _Tp& operator ()(int idx0, int idx1, int idx2) const;
+
+    _Tp& operator ()(Point pt);
+    const _Tp& operator ()(Point pt) const;
+
+    //! conversion to vector.
+    operator std::vector<_Tp>() const;
+    //! conversion to Vec
+    template<int n> operator Vec<typename DataType<_Tp>::channel_type, n>() const;
+    //! conversion to Matx
+    template<int m, int n> operator Matx<typename DataType<_Tp>::channel_type, m, n>() const;
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+    Mat_(Mat_&& m);
+    Mat_& operator = (Mat_&& m);
+
+    Mat_(Mat&& m);
+    Mat_& operator = (Mat&& m);
+
+    Mat_(MatExpr&& e);
+#endif
+};
+
+typedef Mat_<uchar> Mat1b;
+typedef Mat_<Vec2b> Mat2b;
+typedef Mat_<Vec3b> Mat3b;
+typedef Mat_<Vec4b> Mat4b;
+
+typedef Mat_<short> Mat1s;
+typedef Mat_<Vec2s> Mat2s;
+typedef Mat_<Vec3s> Mat3s;
+typedef Mat_<Vec4s> Mat4s;
+
+typedef Mat_<ushort> Mat1w;
+typedef Mat_<Vec2w> Mat2w;
+typedef Mat_<Vec3w> Mat3w;
+typedef Mat_<Vec4w> Mat4w;
+
+typedef Mat_<int>   Mat1i;
+typedef Mat_<Vec2i> Mat2i;
+typedef Mat_<Vec3i> Mat3i;
+typedef Mat_<Vec4i> Mat4i;
+
+typedef Mat_<float> Mat1f;
+typedef Mat_<Vec2f> Mat2f;
+typedef Mat_<Vec3f> Mat3f;
+typedef Mat_<Vec4f> Mat4f;
+
+typedef Mat_<double> Mat1d;
+typedef Mat_<Vec2d> Mat2d;
+typedef Mat_<Vec3d> Mat3d;
+typedef Mat_<Vec4d> Mat4d;
+
+/** @todo document */
+class CV_EXPORTS UMat
+{
+public:
+    //! default constructor
+    UMat(UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    //! constructs 2D matrix of the specified size and type
+    // (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
+    UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    UMat(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    //! constucts 2D matrix and fills it with the specified value _s.
+    UMat(int rows, int cols, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    UMat(Size size, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+
+    //! constructs n-dimensional matrix
+    UMat(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    UMat(int ndims, const int* sizes, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+
+    //! copy constructor
+    UMat(const UMat& m);
+
+    //! creates a matrix header for a part of the bigger matrix
+    UMat(const UMat& m, const Range& rowRange, const Range& colRange=Range::all());
+    UMat(const UMat& m, const Rect& roi);
+    UMat(const UMat& m, const Range* ranges);
+    //! builds matrix from std::vector with or without copying the data
+    template<typename _Tp> explicit UMat(const std::vector<_Tp>& vec, bool copyData=false);
+    //! builds matrix from cv::Vec; the data is copied by default
+    template<typename _Tp, int n> explicit UMat(const Vec<_Tp, n>& vec, bool copyData=true);
+    //! builds matrix from cv::Matx; the data is copied by default
+    template<typename _Tp, int m, int n> explicit UMat(const Matx<_Tp, m, n>& mtx, bool copyData=true);
+    //! builds matrix from a 2D point
+    template<typename _Tp> explicit UMat(const Point_<_Tp>& pt, bool copyData=true);
+    //! builds matrix from a 3D point
+    template<typename _Tp> explicit UMat(const Point3_<_Tp>& pt, bool copyData=true);
+    //! builds matrix from comma initializer
+    template<typename _Tp> explicit UMat(const MatCommaInitializer_<_Tp>& commaInitializer);
+
+    //! destructor - calls release()
+    ~UMat();
+    //! assignment operators
+    UMat& operator = (const UMat& m);
+
+    Mat getMat(int flags) const;
+
+    //! returns a new matrix header for the specified row
+    UMat row(int y) const;
+    //! returns a new matrix header for the specified column
+    UMat col(int x) const;
+    //! ... for the specified row span
+    UMat rowRange(int startrow, int endrow) const;
+    UMat rowRange(const Range& r) const;
+    //! ... for the specified column span
+    UMat colRange(int startcol, int endcol) const;
+    UMat colRange(const Range& r) const;
+    //! ... for the specified diagonal
+    // (d=0 - the main diagonal,
+    //  >0 - a diagonal from the lower half,
+    //  <0 - a diagonal from the upper half)
+    UMat diag(int d=0) const;
+    //! constructs a square diagonal matrix which main diagonal is vector "d"
+    static UMat diag(const UMat& d);
+
+    //! returns deep copy of the matrix, i.e. the data is copied
+    UMat clone() const;
+    //! copies the matrix content to "m".
+    // It calls m.create(this->size(), this->type()).
+    void copyTo( OutputArray m ) const;
+    //! copies those matrix elements to "m" that are marked with non-zero mask elements.
+    void copyTo( OutputArray m, InputArray mask ) const;
+    //! converts matrix to another datatype with optional scalng. See cvConvertScale.
+    void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;
+
+    void assignTo( UMat& m, int type=-1 ) const;
+
+    //! sets every matrix element to s
+    UMat& operator = (const Scalar& s);
+    //! sets some of the matrix elements to s, according to the mask
+    UMat& setTo(InputArray value, InputArray mask=noArray());
+    //! creates alternative matrix header for the same data, with different
+    // number of channels and/or different number of rows. see cvReshape.
+    UMat reshape(int cn, int rows=0) const;
+    UMat reshape(int cn, int newndims, const int* newsz) const;
+
+    //! matrix transposition by means of matrix expressions
+    UMat t() const;
+    //! matrix inversion by means of matrix expressions
+    UMat inv(int method=DECOMP_LU) const;
+    //! per-element matrix multiplication by means of matrix expressions
+    UMat mul(InputArray m, double scale=1) const;
+
+    //! computes dot-product
+    double dot(InputArray m) const;
+
+    //! Matlab-style matrix initialization
+    static UMat zeros(int rows, int cols, int type);
+    static UMat zeros(Size size, int type);
+    static UMat zeros(int ndims, const int* sz, int type);
+    static UMat ones(int rows, int cols, int type);
+    static UMat ones(Size size, int type);
+    static UMat ones(int ndims, const int* sz, int type);
+    static UMat eye(int rows, int cols, int type);
+    static UMat eye(Size size, int type);
+
+    //! allocates new matrix data unless the matrix already has specified size and type.
+    // previous data is unreferenced if needed.
+    void create(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    void create(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    void create(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+
+    //! increases the reference counter; use with care to avoid memleaks
+    void addref();
+    //! decreases reference counter;
+    // deallocates the data when reference counter reaches 0.
+    void release();
+
+    //! deallocates the matrix data
+    void deallocate();
+    //! internal use function; properly re-allocates _size, _step arrays
+    void copySize(const UMat& m);
+
+    //! locates matrix header within a parent matrix. See below
+    void locateROI( Size& wholeSize, Point& ofs ) const;
+    //! moves/resizes the current matrix ROI inside the parent matrix.
+    UMat& adjustROI( int dtop, int dbottom, int dleft, int dright );
+    //! extracts a rectangular sub-matrix
+    // (this is a generalized form of row, rowRange etc.)
+    UMat operator()( Range rowRange, Range colRange ) const;
+    UMat operator()( const Rect& roi ) const;
+    UMat operator()( const Range* ranges ) const;
+
+    //! returns true iff the matrix data is continuous
+    // (i.e. when there are no gaps between successive rows).
+    // similar to CV_IS_MAT_CONT(cvmat->type)
+    bool isContinuous() const;
+
+    //! returns true if the matrix is a submatrix of another matrix
+    bool isSubmatrix() const;
+
+    //! returns element size in bytes,
+    // similar to CV_ELEM_SIZE(cvmat->type)
+    size_t elemSize() const;
+    //! returns the size of element channel in bytes.
+    size_t elemSize1() const;
+    //! returns element type, similar to CV_MAT_TYPE(cvmat->type)
+    int type() const;
+    //! returns element type, similar to CV_MAT_DEPTH(cvmat->type)
+    int depth() const;
+    //! returns element type, similar to CV_MAT_CN(cvmat->type)
+    int channels() const;
+    //! returns step/elemSize1()
+    size_t step1(int i=0) const;
+    //! returns true if matrix data is NULL
+    bool empty() const;
+    //! returns the total number of matrix elements
+    size_t total() const;
+
+    //! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise
+    int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const;
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+    UMat(UMat&& m);
+    UMat& operator = (UMat&& m);
+#endif
+
+    void* handle(int accessFlags) const;
+    void ndoffset(size_t* ofs) const;
+
+    enum { MAGIC_VAL  = 0x42FF0000, AUTO_STEP = 0, CONTINUOUS_FLAG = CV_MAT_CONT_FLAG, SUBMATRIX_FLAG = CV_SUBMAT_FLAG };
+    enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 };
+
+    /*! includes several bit-fields:
+         - the magic signature
+         - continuity flag
+         - depth
+         - number of channels
+     */
+    int flags;
+    //! the matrix dimensionality, >= 2
+    int dims;
+    //! the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
+    int rows, cols;
+
+    //! custom allocator
+    MatAllocator* allocator;
+    UMatUsageFlags usageFlags; // usage flags for allocator
+    //! and the standard allocator
+    static MatAllocator* getStdAllocator();
+
+    // black-box container of UMat data
+    UMatData* u;
+
+    // offset of the submatrix (or 0)
+    size_t offset;
+
+    MatSize size;
+    MatStep step;
+
+protected:
+};
+
+
+/////////////////////////// multi-dimensional sparse matrix //////////////////////////
+
+/** @brief The class SparseMat represents multi-dimensional sparse numerical arrays.
+
+Such a sparse array can store elements of any type that Mat can store. *Sparse* means that only
+non-zero elements are stored (though, as a result of operations on a sparse matrix, some of its
+stored elements can actually become 0. It is up to you to detect such elements and delete them
+using SparseMat::erase ). The non-zero elements are stored in a hash table that grows when it is
+filled so that the search time is O(1) in average (regardless of whether element is there or not).
+Elements can be accessed using the following methods:
+-   Query operations (SparseMat::ptr and the higher-level SparseMat::ref, SparseMat::value and
+    SparseMat::find), for example:
+    @code
+        const int dims = 5;
+        int size[] = {10, 10, 10, 10, 10};
+        SparseMat sparse_mat(dims, size, CV_32F);
+        for(int i = 0; i < 1000; i++)
+        {
+            int idx[dims];
+            for(int k = 0; k < dims; k++)
+                idx[k] = rand()
+            sparse_mat.ref<float>(idx) += 1.f;
+        }
+    @endcode
+-   Sparse matrix iterators. They are similar to MatIterator but different from NAryMatIterator.
+    That is, the iteration loop is familiar to STL users:
+    @code
+        // prints elements of a sparse floating-point matrix
+        // and the sum of elements.
+        SparseMatConstIterator_<float>
+            it = sparse_mat.begin<float>(),
+            it_end = sparse_mat.end<float>();
+        double s = 0;
+        int dims = sparse_mat.dims();
+        for(; it != it_end; ++it)
+        {
+            // print element indices and the element value
+            const SparseMat::Node* n = it.node();
+            printf("(");
+            for(int i = 0; i < dims; i++)
+                printf("%d%s", n->idx[i], i < dims-1 ? ", " : ")");
+            printf(": %g\n", it.value<float>());
+            s += *it;
+        }
+        printf("Element sum is %g\n", s);
+    @endcode
+    If you run this loop, you will notice that elements are not enumerated in a logical order
+    (lexicographical, and so on). They come in the same order as they are stored in the hash table
+    (semi-randomly). You may collect pointers to the nodes and sort them to get the proper ordering.
+    Note, however, that pointers to the nodes may become invalid when you add more elements to the
+    matrix. This may happen due to possible buffer reallocation.
+-   Combination of the above 2 methods when you need to process 2 or more sparse matrices
+    simultaneously. For example, this is how you can compute unnormalized cross-correlation of the 2
+    floating-point sparse matrices:
+    @code
+        double cross_corr(const SparseMat& a, const SparseMat& b)
+        {
+            const SparseMat *_a = &a, *_b = &b;
+            // if b contains less elements than a,
+            // it is faster to iterate through b
+            if(_a->nzcount() > _b->nzcount())
+                std::swap(_a, _b);
+            SparseMatConstIterator_<float> it = _a->begin<float>(),
+                                           it_end = _a->end<float>();
+            double ccorr = 0;
+            for(; it != it_end; ++it)
+            {
+                // take the next element from the first matrix
+                float avalue = *it;
+                const Node* anode = it.node();
+                // and try to find an element with the same index in the second matrix.
+                // since the hash value depends only on the element index,
+                // reuse the hash value stored in the node
+                float bvalue = _b->value<float>(anode->idx,&anode->hashval);
+                ccorr += avalue*bvalue;
+            }
+            return ccorr;
+        }
+    @endcode
+ */
+class CV_EXPORTS SparseMat
+{
+public:
+    typedef SparseMatIterator iterator;
+    typedef SparseMatConstIterator const_iterator;
+
+    enum { MAGIC_VAL=0x42FD0000, MAX_DIM=32, HASH_SCALE=0x5bd1e995, HASH_BIT=0x80000000 };
+
+    //! the sparse matrix header
+    struct CV_EXPORTS Hdr
+    {
+        Hdr(int _dims, const int* _sizes, int _type);
+        void clear();
+        int refcount;
+        int dims;
+        int valueOffset;
+        size_t nodeSize;
+        size_t nodeCount;
+        size_t freeList;
+        std::vector<uchar> pool;
+        std::vector<size_t> hashtab;
+        int size[MAX_DIM];
+    };
+
+    //! sparse matrix node - element of a hash table
+    struct CV_EXPORTS Node
+    {
+        //! hash value
+        size_t hashval;
+        //! index of the next node in the same hash table entry
+        size_t next;
+        //! index of the matrix element
+        int idx[MAX_DIM];
+    };
+
+    /** @brief Various SparseMat constructors.
+     */
+    SparseMat();
+
+    /** @overload
+    @param dims Array dimensionality.
+    @param _sizes Sparce matrix size on all dementions.
+    @param _type Sparse matrix data type.
+    */
+    SparseMat(int dims, const int* _sizes, int _type);
+
+    /** @overload
+    @param m Source matrix for copy constructor. If m is dense matrix (ocvMat) then it will be converted
+    to sparse representation.
+    */
+    SparseMat(const SparseMat& m);
+
+    /** @overload
+    @param m Source matrix for copy constructor. If m is dense matrix (ocvMat) then it will be converted
+    to sparse representation.
+    */
+    explicit SparseMat(const Mat& m);
+
+    //! the destructor
+    ~SparseMat();
+
+    //! assignment operator. This is O(1) operation, i.e. no data is copied
+    SparseMat& operator = (const SparseMat& m);
+    //! equivalent to the corresponding constructor
+    SparseMat& operator = (const Mat& m);
+
+    //! creates full copy of the matrix
+    SparseMat clone() const;
+
+    //! copies all the data to the destination matrix. All the previous content of m is erased
+    void copyTo( SparseMat& m ) const;
+    //! converts sparse matrix to dense matrix.
+    void copyTo( Mat& m ) const;
+    //! multiplies all the matrix elements by the specified scale factor alpha and converts the results to the specified data type
+    void convertTo( SparseMat& m, int rtype, double alpha=1 ) const;
+    //! converts sparse matrix to dense n-dim matrix with optional type conversion and scaling.
+    /*!
+        @param [out] m - output matrix; if it does not have a proper size or type before the operation,
+            it is reallocated
+        @param [in] rtype 鈥� desired output matrix type or, rather, the depth since the number of channels
+            are the same as the input has; if rtype is negative, the output matrix will have the
+            same type as the input.
+        @param [in] alpha 鈥� optional scale factor
+        @param [in] beta 鈥� optional delta added to the scaled values
+    */
+    void convertTo( Mat& m, int rtype, double alpha=1, double beta=0 ) const;
+
+    // not used now
+    void assignTo( SparseMat& m, int type=-1 ) const;
+
+    //! reallocates sparse matrix.
+    /*!
+        If the matrix already had the proper size and type,
+        it is simply cleared with clear(), otherwise,
+        the old matrix is released (using release()) and the new one is allocated.
+    */
+    void create(int dims, const int* _sizes, int _type);
+    //! sets all the sparse matrix elements to 0, which means clearing the hash table.
+    void clear();
+    //! manually increments the reference counter to the header.
+    void addref();
+    // decrements the header reference counter. When the counter reaches 0, the header and all the underlying data are deallocated.
+    void release();
+
+    //! converts sparse matrix to the old-style representation; all the elements are copied.
+    //operator CvSparseMat*() const;
+    //! returns the size of each element in bytes (not including the overhead - the space occupied by SparseMat::Node elements)
+    size_t elemSize() const;
+    //! returns elemSize()/channels()
+    size_t elemSize1() const;
+
+    //! returns type of sparse matrix elements
+    int type() const;
+    //! returns the depth of sparse matrix elements
+    int depth() const;
+    //! returns the number of channels
+    int channels() const;
+
+    //! returns the array of sizes, or NULL if the matrix is not allocated
+    const int* size() const;
+    //! returns the size of i-th matrix dimension (or 0)
+    int size(int i) const;
+    //! returns the matrix dimensionality
+    int dims() const;
+    //! returns the number of non-zero elements (=the number of hash table nodes)
+    size_t nzcount() const;
+
+    //! computes the element hash value (1D case)
+    size_t hash(int i0) const;
+    //! computes the element hash value (2D case)
+    size_t hash(int i0, int i1) const;
+    //! computes the element hash value (3D case)
+    size_t hash(int i0, int i1, int i2) const;
+    //! computes the element hash value (nD case)
+    size_t hash(const int* idx) const;
+
+    //!@{
+    /*!
+     specialized variants for 1D, 2D, 3D cases and the generic_type one for n-D case.
+     return pointer to the matrix element.
+      - if the element is there (it's non-zero), the pointer to it is returned
+      - if it's not there and createMissing=false, NULL pointer is returned
+      - if it's not there and createMissing=true, then the new element
+        is created and initialized with 0. Pointer to it is returned
+      - if the optional hashval pointer is not NULL, the element hash value is
+        not computed, but *hashval is taken instead.
+    */
+    //! returns pointer to the specified element (1D case)
+    uchar* ptr(int i0, bool createMissing, size_t* hashval=0);
+    //! returns pointer to the specified element (2D case)
+    uchar* ptr(int i0, int i1, bool createMissing, size_t* hashval=0);
+    //! returns pointer to the specified element (3D case)
+    uchar* ptr(int i0, int i1, int i2, bool createMissing, size_t* hashval=0);
+    //! returns pointer to the specified element (nD case)
+    uchar* ptr(const int* idx, bool createMissing, size_t* hashval=0);
+    //!@}
+
+    //!@{
+    /*!
+     return read-write reference to the specified sparse matrix element.
+
+     `ref<_Tp>(i0,...[,hashval])` is equivalent to `*(_Tp*)ptr(i0,...,true[,hashval])`.
+     The methods always return a valid reference.
+     If the element did not exist, it is created and initialiazed with 0.
+    */
+    //! returns reference to the specified element (1D case)
+    template<typename _Tp> _Tp& ref(int i0, size_t* hashval=0);
+    //! returns reference to the specified element (2D case)
+    template<typename _Tp> _Tp& ref(int i0, int i1, size_t* hashval=0);
+    //! returns reference to the specified element (3D case)
+    template<typename _Tp> _Tp& ref(int i0, int i1, int i2, size_t* hashval=0);
+    //! returns reference to the specified element (nD case)
+    template<typename _Tp> _Tp& ref(const int* idx, size_t* hashval=0);
+    //!@}
+
+    //!@{
+    /*!
+     return value of the specified sparse matrix element.
+
+     `value<_Tp>(i0,...[,hashval])` is equivalent to
+     @code
+     { const _Tp* p = find<_Tp>(i0,...[,hashval]); return p ? *p : _Tp(); }
+     @endcode
+
+     That is, if the element did not exist, the methods return 0.
+     */
+    //! returns value of the specified element (1D case)
+    template<typename _Tp> _Tp value(int i0, size_t* hashval=0) const;
+    //! returns value of the specified element (2D case)
+    template<typename _Tp> _Tp value(int i0, int i1, size_t* hashval=0) const;
+    //! returns value of the specified element (3D case)
+    template<typename _Tp> _Tp value(int i0, int i1, int i2, size_t* hashval=0) const;
+    //! returns value of the specified element (nD case)
+    template<typename _Tp> _Tp value(const int* idx, size_t* hashval=0) const;
+    //!@}
+
+    //!@{
+    /*!
+     Return pointer to the specified sparse matrix element if it exists
+
+     `find<_Tp>(i0,...[,hashval])` is equivalent to `(_const Tp*)ptr(i0,...false[,hashval])`.
+
+     If the specified element does not exist, the methods return NULL.
+    */
+    //! returns pointer to the specified element (1D case)
+    template<typename _Tp> const _Tp* find(int i0, size_t* hashval=0) const;
+    //! returns pointer to the specified element (2D case)
+    template<typename _Tp> const _Tp* find(int i0, int i1, size_t* hashval=0) const;
+    //! returns pointer to the specified element (3D case)
+    template<typename _Tp> const _Tp* find(int i0, int i1, int i2, size_t* hashval=0) const;
+    //! returns pointer to the specified element (nD case)
+    template<typename _Tp> const _Tp* find(const int* idx, size_t* hashval=0) const;
+    //!@}
+
+    //! erases the specified element (2D case)
+    void erase(int i0, int i1, size_t* hashval=0);
+    //! erases the specified element (3D case)
+    void erase(int i0, int i1, int i2, size_t* hashval=0);
+    //! erases the specified element (nD case)
+    void erase(const int* idx, size_t* hashval=0);
+
+    //!@{
+    /*!
+       return the sparse matrix iterator pointing to the first sparse matrix element
+    */
+    //! returns the sparse matrix iterator at the matrix beginning
+    SparseMatIterator begin();
+    //! returns the sparse matrix iterator at the matrix beginning
+    template<typename _Tp> SparseMatIterator_<_Tp> begin();
+    //! returns the read-only sparse matrix iterator at the matrix beginning
+    SparseMatConstIterator begin() const;
+    //! returns the read-only sparse matrix iterator at the matrix beginning
+    template<typename _Tp> SparseMatConstIterator_<_Tp> begin() const;
+    //!@}
+    /*!
+       return the sparse matrix iterator pointing to the element following the last sparse matrix element
+    */
+    //! returns the sparse matrix iterator at the matrix end
+    SparseMatIterator end();
+    //! returns the read-only sparse matrix iterator at the matrix end
+    SparseMatConstIterator end() const;
+    //! returns the typed sparse matrix iterator at the matrix end
+    template<typename _Tp> SparseMatIterator_<_Tp> end();
+    //! returns the typed read-only sparse matrix iterator at the matrix end
+    template<typename _Tp> SparseMatConstIterator_<_Tp> end() const;
+
+    //! returns the value stored in the sparse martix node
+    template<typename _Tp> _Tp& value(Node* n);
+    //! returns the value stored in the sparse martix node
+    template<typename _Tp> const _Tp& value(const Node* n) const;
+
+    ////////////// some internal-use methods ///////////////
+    Node* node(size_t nidx);
+    const Node* node(size_t nidx) const;
+
+    uchar* newNode(const int* idx, size_t hashval);
+    void removeNode(size_t hidx, size_t nidx, size_t previdx);
+    void resizeHashTab(size_t newsize);
+
+    int flags;
+    Hdr* hdr;
+};
+
+
+
+///////////////////////////////// SparseMat_<_Tp> ////////////////////////////////////
+
+/** @brief Template sparse n-dimensional array class derived from SparseMat
+
+SparseMat_ is a thin wrapper on top of SparseMat created in the same way as Mat_ . It simplifies
+notation of some operations:
+@code
+    int sz[] = {10, 20, 30};
+    SparseMat_<double> M(3, sz);
+    ...
+    M.ref(1, 2, 3) = M(4, 5, 6) + M(7, 8, 9);
+@endcode
+ */
+template<typename _Tp> class SparseMat_ : public SparseMat
+{
+public:
+    typedef SparseMatIterator_<_Tp> iterator;
+    typedef SparseMatConstIterator_<_Tp> const_iterator;
+
+    //! the default constructor
+    SparseMat_();
+    //! the full constructor equivelent to SparseMat(dims, _sizes, DataType<_Tp>::type)
+    SparseMat_(int dims, const int* _sizes);
+    //! the copy constructor. If DataType<_Tp>.type != m.type(), the m elements are converted
+    SparseMat_(const SparseMat& m);
+    //! the copy constructor. This is O(1) operation - no data is copied
+    SparseMat_(const SparseMat_& m);
+    //! converts dense matrix to the sparse form
+    SparseMat_(const Mat& m);
+    //! converts the old-style sparse matrix to the C++ class. All the elements are copied
+    //SparseMat_(const CvSparseMat* m);
+    //! the assignment operator. If DataType<_Tp>.type != m.type(), the m elements are converted
+    SparseMat_& operator = (const SparseMat& m);
+    //! the assignment operator. This is O(1) operation - no data is copied
+    SparseMat_& operator = (const SparseMat_& m);
+    //! converts dense matrix to the sparse form
+    SparseMat_& operator = (const Mat& m);
+
+    //! makes full copy of the matrix. All the elements are duplicated
+    SparseMat_ clone() const;
+    //! equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type)
+    void create(int dims, const int* _sizes);
+    //! converts sparse matrix to the old-style CvSparseMat. All the elements are copied
+    //operator CvSparseMat*() const;
+
+    //! returns type of the matrix elements
+    int type() const;
+    //! returns depth of the matrix elements
+    int depth() const;
+    //! returns the number of channels in each matrix element
+    int channels() const;
+
+    //! equivalent to SparseMat::ref<_Tp>(i0, hashval)
+    _Tp& ref(int i0, size_t* hashval=0);
+    //! equivalent to SparseMat::ref<_Tp>(i0, i1, hashval)
+    _Tp& ref(int i0, int i1, size_t* hashval=0);
+    //! equivalent to SparseMat::ref<_Tp>(i0, i1, i2, hashval)
+    _Tp& ref(int i0, int i1, int i2, size_t* hashval=0);
+    //! equivalent to SparseMat::ref<_Tp>(idx, hashval)
+    _Tp& ref(const int* idx, size_t* hashval=0);
+
+    //! equivalent to SparseMat::value<_Tp>(i0, hashval)
+    _Tp operator()(int i0, size_t* hashval=0) const;
+    //! equivalent to SparseMat::value<_Tp>(i0, i1, hashval)
+    _Tp operator()(int i0, int i1, size_t* hashval=0) const;
+    //! equivalent to SparseMat::value<_Tp>(i0, i1, i2, hashval)
+    _Tp operator()(int i0, int i1, int i2, size_t* hashval=0) const;
+    //! equivalent to SparseMat::value<_Tp>(idx, hashval)
+    _Tp operator()(const int* idx, size_t* hashval=0) const;
+
+    //! returns sparse matrix iterator pointing to the first sparse matrix element
+    SparseMatIterator_<_Tp> begin();
+    //! returns read-only sparse matrix iterator pointing to the first sparse matrix element
+    SparseMatConstIterator_<_Tp> begin() const;
+    //! returns sparse matrix iterator pointing to the element following the last sparse matrix element
+    SparseMatIterator_<_Tp> end();
+    //! returns read-only sparse matrix iterator pointing to the element following the last sparse matrix element
+    SparseMatConstIterator_<_Tp> end() const;
+};
+
+
+
+////////////////////////////////// MatConstIterator //////////////////////////////////
+
+class CV_EXPORTS MatConstIterator
+{
+public:
+    typedef uchar* value_type;
+    typedef ptrdiff_t difference_type;
+    typedef const uchar** pointer;
+    typedef uchar* reference;
+
+#ifndef OPENCV_NOSTL
+    typedef std::random_access_iterator_tag iterator_category;
+#endif
+
+    //! default constructor
+    MatConstIterator();
+    //! constructor that sets the iterator to the beginning of the matrix
+    MatConstIterator(const Mat* _m);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator(const Mat* _m, int _row, int _col=0);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator(const Mat* _m, Point _pt);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator(const Mat* _m, const int* _idx);
+    //! copy constructor
+    MatConstIterator(const MatConstIterator& it);
+
+    //! copy operator
+    MatConstIterator& operator = (const MatConstIterator& it);
+    //! returns the current matrix element
+    const uchar* operator *() const;
+    //! returns the i-th matrix element, relative to the current
+    const uchar* operator [](ptrdiff_t i) const;
+
+    //! shifts the iterator forward by the specified number of elements
+    MatConstIterator& operator += (ptrdiff_t ofs);
+    //! shifts the iterator backward by the specified number of elements
+    MatConstIterator& operator -= (ptrdiff_t ofs);
+    //! decrements the iterator
+    MatConstIterator& operator --();
+    //! decrements the iterator
+    MatConstIterator operator --(int);
+    //! increments the iterator
+    MatConstIterator& operator ++();
+    //! increments the iterator
+    MatConstIterator operator ++(int);
+    //! returns the current iterator position
+    Point pos() const;
+    //! returns the current iterator position
+    void pos(int* _idx) const;
+
+    ptrdiff_t lpos() const;
+    void seek(ptrdiff_t ofs, bool relative = false);
+    void seek(const int* _idx, bool relative = false);
+
+    const Mat* m;
+    size_t elemSize;
+    const uchar* ptr;
+    const uchar* sliceStart;
+    const uchar* sliceEnd;
+};
+
+
+
+////////////////////////////////// MatConstIterator_ /////////////////////////////////
+
+/** @brief Matrix read-only iterator
+ */
+template<typename _Tp>
+class MatConstIterator_ : public MatConstIterator
+{
+public:
+    typedef _Tp value_type;
+    typedef ptrdiff_t difference_type;
+    typedef const _Tp* pointer;
+    typedef const _Tp& reference;
+
+#ifndef OPENCV_NOSTL
+    typedef std::random_access_iterator_tag iterator_category;
+#endif
+
+    //! default constructor
+    MatConstIterator_();
+    //! constructor that sets the iterator to the beginning of the matrix
+    MatConstIterator_(const Mat_<_Tp>* _m);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator_(const Mat_<_Tp>* _m, int _row, int _col=0);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator_(const Mat_<_Tp>* _m, Point _pt);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator_(const Mat_<_Tp>* _m, const int* _idx);
+    //! copy constructor
+    MatConstIterator_(const MatConstIterator_& it);
+
+    //! copy operator
+    MatConstIterator_& operator = (const MatConstIterator_& it);
+    //! returns the current matrix element
+    _Tp operator *() const;
+    //! returns the i-th matrix element, relative to the current
+    _Tp operator [](ptrdiff_t i) const;
+
+    //! shifts the iterator forward by the specified number of elements
+    MatConstIterator_& operator += (ptrdiff_t ofs);
+    //! shifts the iterator backward by the specified number of elements
+    MatConstIterator_& operator -= (ptrdiff_t ofs);
+    //! decrements the iterator
+    MatConstIterator_& operator --();
+    //! decrements the iterator
+    MatConstIterator_ operator --(int);
+    //! increments the iterator
+    MatConstIterator_& operator ++();
+    //! increments the iterator
+    MatConstIterator_ operator ++(int);
+    //! returns the current iterator position
+    Point pos() const;
+};
+
+
+
+//////////////////////////////////// MatIterator_ ////////////////////////////////////
+
+/** @brief Matrix read-write iterator
+*/
+template<typename _Tp>
+class MatIterator_ : public MatConstIterator_<_Tp>
+{
+public:
+    typedef _Tp* pointer;
+    typedef _Tp& reference;
+
+#ifndef OPENCV_NOSTL
+    typedef std::random_access_iterator_tag iterator_category;
+#endif
+
+    //! the default constructor
+    MatIterator_();
+    //! constructor that sets the iterator to the beginning of the matrix
+    MatIterator_(Mat_<_Tp>* _m);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatIterator_(Mat_<_Tp>* _m, int _row, int _col=0);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatIterator_(Mat_<_Tp>* _m, Point _pt);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatIterator_(Mat_<_Tp>* _m, const int* _idx);
+    //! copy constructor
+    MatIterator_(const MatIterator_& it);
+    //! copy operator
+    MatIterator_& operator = (const MatIterator_<_Tp>& it );
+
+    //! returns the current matrix element
+    _Tp& operator *() const;
+    //! returns the i-th matrix element, relative to the current
+    _Tp& operator [](ptrdiff_t i) const;
+
+    //! shifts the iterator forward by the specified number of elements
+    MatIterator_& operator += (ptrdiff_t ofs);
+    //! shifts the iterator backward by the specified number of elements
+    MatIterator_& operator -= (ptrdiff_t ofs);
+    //! decrements the iterator
+    MatIterator_& operator --();
+    //! decrements the iterator
+    MatIterator_ operator --(int);
+    //! increments the iterator
+    MatIterator_& operator ++();
+    //! increments the iterator
+    MatIterator_ operator ++(int);
+};
+
+
+
+/////////////////////////////// SparseMatConstIterator ///////////////////////////////
+
+/**  @brief Read-Only Sparse Matrix Iterator.
+
+ Here is how to use the iterator to compute the sum of floating-point sparse matrix elements:
+
+ \code
+ SparseMatConstIterator it = m.begin(), it_end = m.end();
+ double s = 0;
+ CV_Assert( m.type() == CV_32F );
+ for( ; it != it_end; ++it )
+    s += it.value<float>();
+ \endcode
+*/
+class CV_EXPORTS SparseMatConstIterator
+{
+public:
+    //! the default constructor
+    SparseMatConstIterator();
+    //! the full constructor setting the iterator to the first sparse matrix element
+    SparseMatConstIterator(const SparseMat* _m);
+    //! the copy constructor
+    SparseMatConstIterator(const SparseMatConstIterator& it);
+
+    //! the assignment operator
+    SparseMatConstIterator& operator = (const SparseMatConstIterator& it);
+
+    //! template method returning the current matrix element
+    template<typename _Tp> const _Tp& value() const;
+    //! returns the current node of the sparse matrix. it.node->idx is the current element index
+    const SparseMat::Node* node() const;
+
+    //! moves iterator to the previous element
+    SparseMatConstIterator& operator --();
+    //! moves iterator to the previous element
+    SparseMatConstIterator operator --(int);
+    //! moves iterator to the next element
+    SparseMatConstIterator& operator ++();
+    //! moves iterator to the next element
+    SparseMatConstIterator operator ++(int);
+
+    //! moves iterator to the element after the last element
+    void seekEnd();
+
+    const SparseMat* m;
+    size_t hashidx;
+    uchar* ptr;
+};
+
+
+
+////////////////////////////////// SparseMatIterator /////////////////////////////////
+
+/** @brief  Read-write Sparse Matrix Iterator
+
+ The class is similar to cv::SparseMatConstIterator,
+ but can be used for in-place modification of the matrix elements.
+*/
+class CV_EXPORTS SparseMatIterator : public SparseMatConstIterator
+{
+public:
+    //! the default constructor
+    SparseMatIterator();
+    //! the full constructor setting the iterator to the first sparse matrix element
+    SparseMatIterator(SparseMat* _m);
+    //! the full constructor setting the iterator to the specified sparse matrix element
+    SparseMatIterator(SparseMat* _m, const int* idx);
+    //! the copy constructor
+    SparseMatIterator(const SparseMatIterator& it);
+
+    //! the assignment operator
+    SparseMatIterator& operator = (const SparseMatIterator& it);
+    //! returns read-write reference to the current sparse matrix element
+    template<typename _Tp> _Tp& value() const;
+    //! returns pointer to the current sparse matrix node. it.node->idx is the index of the current element (do not modify it!)
+    SparseMat::Node* node() const;
+
+    //! moves iterator to the next element
+    SparseMatIterator& operator ++();
+    //! moves iterator to the next element
+    SparseMatIterator operator ++(int);
+};
+
+
+
+/////////////////////////////// SparseMatConstIterator_ //////////////////////////////
+
+/** @brief  Template Read-Only Sparse Matrix Iterator Class.
+
+ This is the derived from SparseMatConstIterator class that
+ introduces more convenient operator *() for accessing the current element.
+*/
+template<typename _Tp> class SparseMatConstIterator_ : public SparseMatConstIterator
+{
+public:
+
+#ifndef OPENCV_NOSTL
+    typedef std::forward_iterator_tag iterator_category;
+#endif
+
+    //! the default constructor
+    SparseMatConstIterator_();
+    //! the full constructor setting the iterator to the first sparse matrix element
+    SparseMatConstIterator_(const SparseMat_<_Tp>* _m);
+    SparseMatConstIterator_(const SparseMat* _m);
+    //! the copy constructor
+    SparseMatConstIterator_(const SparseMatConstIterator_& it);
+
+    //! the assignment operator
+    SparseMatConstIterator_& operator = (const SparseMatConstIterator_& it);
+    //! the element access operator
+    const _Tp& operator *() const;
+
+    //! moves iterator to the next element
+    SparseMatConstIterator_& operator ++();
+    //! moves iterator to the next element
+    SparseMatConstIterator_ operator ++(int);
+};
+
+
+
+///////////////////////////////// SparseMatIterator_ /////////////////////////////////
+
+/** @brief  Template Read-Write Sparse Matrix Iterator Class.
+
+ This is the derived from cv::SparseMatConstIterator_ class that
+ introduces more convenient operator *() for accessing the current element.
+*/
+template<typename _Tp> class SparseMatIterator_ : public SparseMatConstIterator_<_Tp>
+{
+public:
+
+#ifndef OPENCV_NOSTL
+    typedef std::forward_iterator_tag iterator_category;
+#endif
+
+    //! the default constructor
+    SparseMatIterator_();
+    //! the full constructor setting the iterator to the first sparse matrix element
+    SparseMatIterator_(SparseMat_<_Tp>* _m);
+    SparseMatIterator_(SparseMat* _m);
+    //! the copy constructor
+    SparseMatIterator_(const SparseMatIterator_& it);
+
+    //! the assignment operator
+    SparseMatIterator_& operator = (const SparseMatIterator_& it);
+    //! returns the reference to the current element
+    _Tp& operator *() const;
+
+    //! moves the iterator to the next element
+    SparseMatIterator_& operator ++();
+    //! moves the iterator to the next element
+    SparseMatIterator_ operator ++(int);
+};
+
+
+
+/////////////////////////////////// NAryMatIterator //////////////////////////////////
+
+/** @brief n-ary multi-dimensional array iterator.
+
+Use the class to implement unary, binary, and, generally, n-ary element-wise operations on
+multi-dimensional arrays. Some of the arguments of an n-ary function may be continuous arrays, some
+may be not. It is possible to use conventional MatIterator 's for each array but incrementing all of
+the iterators after each small operations may be a big overhead. In this case consider using
+NAryMatIterator to iterate through several matrices simultaneously as long as they have the same
+geometry (dimensionality and all the dimension sizes are the same). On each iteration `it.planes[0]`,
+`it.planes[1]`,... will be the slices of the corresponding matrices.
+
+The example below illustrates how you can compute a normalized and threshold 3D color histogram:
+@code
+    void computeNormalizedColorHist(const Mat& image, Mat& hist, int N, double minProb)
+    {
+        const int histSize[] = {N, N, N};
+
+        // make sure that the histogram has a proper size and type
+        hist.create(3, histSize, CV_32F);
+
+        // and clear it
+        hist = Scalar(0);
+
+        // the loop below assumes that the image
+        // is a 8-bit 3-channel. check it.
+        CV_Assert(image.type() == CV_8UC3);
+        MatConstIterator_<Vec3b> it = image.begin<Vec3b>(),
+                                 it_end = image.end<Vec3b>();
+        for( ; it != it_end; ++it )
+        {
+            const Vec3b& pix = *it;
+            hist.at<float>(pix[0]*N/256, pix[1]*N/256, pix[2]*N/256) += 1.f;
+        }
+
+        minProb *= image.rows*image.cols;
+        Mat plane;
+        NAryMatIterator it(&hist, &plane, 1);
+        double s = 0;
+        // iterate through the matrix. on each iteration
+        // it.planes[*] (of type Mat) will be set to the current plane.
+        for(int p = 0; p < it.nplanes; p++, ++it)
+        {
+            threshold(it.planes[0], it.planes[0], minProb, 0, THRESH_TOZERO);
+            s += sum(it.planes[0])[0];
+        }
+
+        s = 1./s;
+        it = NAryMatIterator(&hist, &plane, 1);
+        for(int p = 0; p < it.nplanes; p++, ++it)
+            it.planes[0] *= s;
+    }
+@endcode
+ */
+class CV_EXPORTS NAryMatIterator
+{
+public:
+    //! the default constructor
+    NAryMatIterator();
+    //! the full constructor taking arbitrary number of n-dim matrices
+    NAryMatIterator(const Mat** arrays, uchar** ptrs, int narrays=-1);
+    //! the full constructor taking arbitrary number of n-dim matrices
+    NAryMatIterator(const Mat** arrays, Mat* planes, int narrays=-1);
+    //! the separate iterator initialization method
+    void init(const Mat** arrays, Mat* planes, uchar** ptrs, int narrays=-1);
+
+    //! proceeds to the next plane of every iterated matrix
+    NAryMatIterator& operator ++();
+    //! proceeds to the next plane of every iterated matrix (postfix increment operator)
+    NAryMatIterator operator ++(int);
+
+    //! the iterated arrays
+    const Mat** arrays;
+    //! the current planes
+    Mat* planes;
+    //! data pointers
+    uchar** ptrs;
+    //! the number of arrays
+    int narrays;
+    //! the number of hyper-planes that the iterator steps through
+    size_t nplanes;
+    //! the size of each segment (in elements)
+    size_t size;
+protected:
+    int iterdepth;
+    size_t idx;
+};
+
+
+
+///////////////////////////////// Matrix Expressions /////////////////////////////////
+
+class CV_EXPORTS MatOp
+{
+public:
+    MatOp();
+    virtual ~MatOp();
+
+    virtual bool elementWise(const MatExpr& expr) const;
+    virtual void assign(const MatExpr& expr, Mat& m, int type=-1) const = 0;
+    virtual void roi(const MatExpr& expr, const Range& rowRange,
+                     const Range& colRange, MatExpr& res) const;
+    virtual void diag(const MatExpr& expr, int d, MatExpr& res) const;
+    virtual void augAssignAdd(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignSubtract(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignMultiply(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignDivide(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignAnd(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignOr(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignXor(const MatExpr& expr, Mat& m) const;
+
+    virtual void add(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
+    virtual void add(const MatExpr& expr1, const Scalar& s, MatExpr& res) const;
+
+    virtual void subtract(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
+    virtual void subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const;
+
+    virtual void multiply(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res, double scale=1) const;
+    virtual void multiply(const MatExpr& expr1, double s, MatExpr& res) const;
+
+    virtual void divide(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res, double scale=1) const;
+    virtual void divide(double s, const MatExpr& expr, MatExpr& res) const;
+
+    virtual void abs(const MatExpr& expr, MatExpr& res) const;
+
+    virtual void transpose(const MatExpr& expr, MatExpr& res) const;
+    virtual void matmul(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
+    virtual void invert(const MatExpr& expr, int method, MatExpr& res) const;
+
+    virtual Size size(const MatExpr& expr) const;
+    virtual int type(const MatExpr& expr) const;
+};
+
+/** @brief Matrix expression representation
+@anchor MatrixExpressions
+This is a list of implemented matrix operations that can be combined in arbitrary complex
+expressions (here A, B stand for matrices ( Mat ), s for a scalar ( Scalar ), alpha for a
+real-valued scalar ( double )):
+-   Addition, subtraction, negation: `A+B`, `A-B`, `A+s`, `A-s`, `s+A`, `s-A`, `-A`
+-   Scaling: `A*alpha`
+-   Per-element multiplication and division: `A.mul(B)`, `A/B`, `alpha/A`
+-   Matrix multiplication: `A*B`
+-   Transposition: `A.t()` (means A<sup>T</sup>)
+-   Matrix inversion and pseudo-inversion, solving linear systems and least-squares problems:
+    `A.inv([method]) (~ A<sup>-1</sup>)`,   `A.inv([method])*B (~ X: AX=B)`
+-   Comparison: `A cmpop B`, `A cmpop alpha`, `alpha cmpop A`, where *cmpop* is one of
+  `>`, `>=`, `==`, `!=`, `<=`, `<`. The result of comparison is an 8-bit single channel mask whose
+    elements are set to 255 (if the particular element or pair of elements satisfy the condition) or
+    0.
+-   Bitwise logical operations: `A logicop B`, `A logicop s`, `s logicop A`, `~A`, where *logicop* is one of
+  `&`, `|`, `^`.
+-   Element-wise minimum and maximum: `min(A, B)`, `min(A, alpha)`, `max(A, B)`, `max(A, alpha)`
+-   Element-wise absolute value: `abs(A)`
+-   Cross-product, dot-product: `A.cross(B)`, `A.dot(B)`
+-   Any function of matrix or matrices and scalars that returns a matrix or a scalar, such as norm,
+    mean, sum, countNonZero, trace, determinant, repeat, and others.
+-   Matrix initializers ( Mat::eye(), Mat::zeros(), Mat::ones() ), matrix comma-separated
+    initializers, matrix constructors and operators that extract sub-matrices (see Mat description).
+-   Mat_<destination_type>() constructors to cast the result to the proper type.
+@note Comma-separated initializers and probably some other operations may require additional
+explicit Mat() or Mat_<T>() constructor calls to resolve a possible ambiguity.
+
+Here are examples of matrix expressions:
+@code
+    // compute pseudo-inverse of A, equivalent to A.inv(DECOMP_SVD)
+    SVD svd(A);
+    Mat pinvA = svd.vt.t()*Mat::diag(1./svd.w)*svd.u.t();
+
+    // compute the new vector of parameters in the Levenberg-Marquardt algorithm
+    x -= (A.t()*A + lambda*Mat::eye(A.cols,A.cols,A.type())).inv(DECOMP_CHOLESKY)*(A.t()*err);
+
+    // sharpen image using "unsharp mask" algorithm
+    Mat blurred; double sigma = 1, threshold = 5, amount = 1;
+    GaussianBlur(img, blurred, Size(), sigma, sigma);
+    Mat lowContrastMask = abs(img - blurred) < threshold;
+    Mat sharpened = img*(1+amount) + blurred*(-amount);
+    img.copyTo(sharpened, lowContrastMask);
+@endcode
+*/
+class CV_EXPORTS MatExpr
+{
+public:
+    MatExpr();
+    explicit MatExpr(const Mat& m);
+
+    MatExpr(const MatOp* _op, int _flags, const Mat& _a = Mat(), const Mat& _b = Mat(),
+            const Mat& _c = Mat(), double _alpha = 1, double _beta = 1, const Scalar& _s = Scalar());
+
+    operator Mat() const;
+    template<typename _Tp> operator Mat_<_Tp>() const;
+
+    Size size() const;
+    int type() const;
+
+    MatExpr row(int y) const;
+    MatExpr col(int x) const;
+    MatExpr diag(int d = 0) const;
+    MatExpr operator()( const Range& rowRange, const Range& colRange ) const;
+    MatExpr operator()( const Rect& roi ) const;
+
+    MatExpr t() const;
+    MatExpr inv(int method = DECOMP_LU) const;
+    MatExpr mul(const MatExpr& e, double scale=1) const;
+    MatExpr mul(const Mat& m, double scale=1) const;
+
+    Mat cross(const Mat& m) const;
+    double dot(const Mat& m) const;
+
+    const MatOp* op;
+    int flags;
+
+    Mat a, b, c;
+    double alpha, beta;
+    Scalar s;
+};
+
+//! @} core_basic
+
+//! @relates cv::MatExpr
+//! @{
+CV_EXPORTS MatExpr operator + (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator + (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator + (const Scalar& s, const Mat& a);
+CV_EXPORTS MatExpr operator + (const MatExpr& e, const Mat& m);
+CV_EXPORTS MatExpr operator + (const Mat& m, const MatExpr& e);
+CV_EXPORTS MatExpr operator + (const MatExpr& e, const Scalar& s);
+CV_EXPORTS MatExpr operator + (const Scalar& s, const MatExpr& e);
+CV_EXPORTS MatExpr operator + (const MatExpr& e1, const MatExpr& e2);
+
+CV_EXPORTS MatExpr operator - (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator - (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator - (const Scalar& s, const Mat& a);
+CV_EXPORTS MatExpr operator - (const MatExpr& e, const Mat& m);
+CV_EXPORTS MatExpr operator - (const Mat& m, const MatExpr& e);
+CV_EXPORTS MatExpr operator - (const MatExpr& e, const Scalar& s);
+CV_EXPORTS MatExpr operator - (const Scalar& s, const MatExpr& e);
+CV_EXPORTS MatExpr operator - (const MatExpr& e1, const MatExpr& e2);
+
+CV_EXPORTS MatExpr operator - (const Mat& m);
+CV_EXPORTS MatExpr operator - (const MatExpr& e);
+
+CV_EXPORTS MatExpr operator * (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator * (const Mat& a, double s);
+CV_EXPORTS MatExpr operator * (double s, const Mat& a);
+CV_EXPORTS MatExpr operator * (const MatExpr& e, const Mat& m);
+CV_EXPORTS MatExpr operator * (const Mat& m, const MatExpr& e);
+CV_EXPORTS MatExpr operator * (const MatExpr& e, double s);
+CV_EXPORTS MatExpr operator * (double s, const MatExpr& e);
+CV_EXPORTS MatExpr operator * (const MatExpr& e1, const MatExpr& e2);
+
+CV_EXPORTS MatExpr operator / (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator / (const Mat& a, double s);
+CV_EXPORTS MatExpr operator / (double s, const Mat& a);
+CV_EXPORTS MatExpr operator / (const MatExpr& e, const Mat& m);
+CV_EXPORTS MatExpr operator / (const Mat& m, const MatExpr& e);
+CV_EXPORTS MatExpr operator / (const MatExpr& e, double s);
+CV_EXPORTS MatExpr operator / (double s, const MatExpr& e);
+CV_EXPORTS MatExpr operator / (const MatExpr& e1, const MatExpr& e2);
+
+CV_EXPORTS MatExpr operator < (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator < (const Mat& a, double s);
+CV_EXPORTS MatExpr operator < (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator <= (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator <= (const Mat& a, double s);
+CV_EXPORTS MatExpr operator <= (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator == (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator == (const Mat& a, double s);
+CV_EXPORTS MatExpr operator == (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator != (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator != (const Mat& a, double s);
+CV_EXPORTS MatExpr operator != (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator >= (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator >= (const Mat& a, double s);
+CV_EXPORTS MatExpr operator >= (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator > (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator > (const Mat& a, double s);
+CV_EXPORTS MatExpr operator > (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator & (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator & (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator & (const Scalar& s, const Mat& a);
+
+CV_EXPORTS MatExpr operator | (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator | (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator | (const Scalar& s, const Mat& a);
+
+CV_EXPORTS MatExpr operator ^ (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator ^ (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator ^ (const Scalar& s, const Mat& a);
+
+CV_EXPORTS MatExpr operator ~(const Mat& m);
+
+CV_EXPORTS MatExpr min(const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr min(const Mat& a, double s);
+CV_EXPORTS MatExpr min(double s, const Mat& a);
+
+CV_EXPORTS MatExpr max(const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr max(const Mat& a, double s);
+CV_EXPORTS MatExpr max(double s, const Mat& a);
+
+/** @brief Calculates an absolute value of each matrix element.
+
+abs is a meta-function that is expanded to one of absdiff or convertScaleAbs forms:
+- C = abs(A-B) is equivalent to `absdiff(A, B, C)`
+- C = abs(A) is equivalent to `absdiff(A, Scalar::all(0), C)`
+- C = `Mat_<Vec<uchar,n> >(abs(A*alpha + beta))` is equivalent to `convertScaleAbs(A, C, alpha,
+beta)`
+
+The output matrix has the same size and the same type as the input one except for the last case,
+where C is depth=CV_8U .
+@param m matrix.
+@sa @ref MatrixExpressions, absdiff, convertScaleAbs
+ */
+CV_EXPORTS MatExpr abs(const Mat& m);
+/** @overload
+@param e matrix expression.
+*/
+CV_EXPORTS MatExpr abs(const MatExpr& e);
+//! @} relates cv::MatExpr
+
+} // cv
+
+#include "opencv2/core/mat.inl.hpp"
+
+#endif // __OPENCV_CORE_MAT_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp
new file mode 100644
index 0000000..5410340
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp
@@ -0,0 +1,3668 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_MATRIX_OPERATIONS_HPP__
+#define __OPENCV_CORE_MATRIX_OPERATIONS_HPP__
+
+#ifndef __cplusplus
+#  error mat.inl.hpp header must be compiled as C++
+#endif
+
+namespace cv
+{
+
+//! @cond IGNORED
+
+//////////////////////// Input/Output Arrays ////////////////////////
+
+inline void _InputArray::init(int _flags, const void* _obj)
+{ flags = _flags; obj = (void*)_obj; }
+
+inline void _InputArray::init(int _flags, const void* _obj, Size _sz)
+{ flags = _flags; obj = (void*)_obj; sz = _sz; }
+
+inline void* _InputArray::getObj() const { return obj; }
+inline int _InputArray::getFlags() const { return flags; }
+inline Size _InputArray::getSz() const { return sz; }
+
+inline _InputArray::_InputArray() { init(NONE, 0); }
+inline _InputArray::_InputArray(int _flags, void* _obj) { init(_flags, _obj); }
+inline _InputArray::_InputArray(const Mat& m) { init(MAT+ACCESS_READ, &m); }
+inline _InputArray::_InputArray(const std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_READ, &vec); }
+inline _InputArray::_InputArray(const UMat& m) { init(UMAT+ACCESS_READ, &m); }
+inline _InputArray::_InputArray(const std::vector<UMat>& vec) { init(STD_VECTOR_UMAT+ACCESS_READ, &vec); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + STD_VECTOR + DataType<_Tp>::type + ACCESS_READ, &vec); }
+
+inline
+_InputArray::_InputArray(const std::vector<bool>& vec)
+{ init(FIXED_TYPE + STD_BOOL_VECTOR + DataType<bool>::type + ACCESS_READ, &vec); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_READ, &vec); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_READ, &vec); }
+
+template<typename _Tp, int m, int n> inline
+_InputArray::_InputArray(const Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_READ, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const _Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_READ, vec, Size(n, 1)); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const Mat_<_Tp>& m)
+{ init(FIXED_TYPE + MAT + DataType<_Tp>::type + ACCESS_READ, &m); }
+
+inline _InputArray::_InputArray(const double& val)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + CV_64F + ACCESS_READ, &val, Size(1,1)); }
+
+inline _InputArray::_InputArray(const MatExpr& expr)
+{ init(FIXED_TYPE + FIXED_SIZE + EXPR + ACCESS_READ, &expr); }
+
+inline _InputArray::_InputArray(const cuda::GpuMat& d_mat)
+{ init(CUDA_GPU_MAT + ACCESS_READ, &d_mat); }
+
+inline _InputArray::_InputArray(const std::vector<cuda::GpuMat>& d_mat)
+{	init(STD_VECTOR_CUDA_GPU_MAT + ACCESS_READ, &d_mat);}
+
+inline _InputArray::_InputArray(const ogl::Buffer& buf)
+{ init(OPENGL_BUFFER + ACCESS_READ, &buf); }
+
+inline _InputArray::_InputArray(const cuda::HostMem& cuda_mem)
+{ init(CUDA_HOST_MEM + ACCESS_READ, &cuda_mem); }
+
+inline _InputArray::~_InputArray() {}
+
+inline Mat _InputArray::getMat(int i) const
+{
+    if( kind() == MAT && i < 0 )
+        return *(const Mat*)obj;
+    return getMat_(i);
+}
+
+inline bool _InputArray::isMat() const { return kind() == _InputArray::MAT; }
+inline bool _InputArray::isUMat() const  { return kind() == _InputArray::UMAT; }
+inline bool _InputArray::isMatVector() const { return kind() == _InputArray::STD_VECTOR_MAT; }
+inline bool _InputArray::isUMatVector() const  { return kind() == _InputArray::STD_VECTOR_UMAT; }
+inline bool _InputArray::isMatx() const { return kind() == _InputArray::MATX; }
+inline bool _InputArray::isVector() const { return kind() == _InputArray::STD_VECTOR || kind() == _InputArray::STD_BOOL_VECTOR; }
+inline bool _InputArray::isGpuMatVector() const { return kind() == _InputArray::STD_VECTOR_CUDA_GPU_MAT; }
+
+////////////////////////////////////////////////////////////////////////////////////////
+
+inline _OutputArray::_OutputArray() { init(ACCESS_WRITE, 0); }
+inline _OutputArray::_OutputArray(int _flags, void* _obj) { init(_flags|ACCESS_WRITE, _obj); }
+inline _OutputArray::_OutputArray(Mat& m) { init(MAT+ACCESS_WRITE, &m); }
+inline _OutputArray::_OutputArray(std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_WRITE, &vec); }
+inline _OutputArray::_OutputArray(UMat& m) { init(UMAT+ACCESS_WRITE, &m); }
+inline _OutputArray::_OutputArray(std::vector<UMat>& vec) { init(STD_VECTOR_UMAT+ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + STD_VECTOR + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+inline
+_OutputArray::_OutputArray(std::vector<bool>&)
+{ CV_Error(Error::StsUnsupportedFormat, "std::vector<bool> cannot be an output array\n"); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(Mat_<_Tp>& m)
+{ init(FIXED_TYPE + MAT + DataType<_Tp>::type + ACCESS_WRITE, &m); }
+
+template<typename _Tp, int m, int n> inline
+_OutputArray::_OutputArray(Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_WRITE, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(_Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_WRITE, vec, Size(n, 1)); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const Mat_<_Tp>& m)
+{ init(FIXED_TYPE + FIXED_SIZE + MAT + DataType<_Tp>::type + ACCESS_WRITE, &m); }
+
+template<typename _Tp, int m, int n> inline
+_OutputArray::_OutputArray(const Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_WRITE, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const _Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_WRITE, vec, Size(n, 1)); }
+
+inline _OutputArray::_OutputArray(cuda::GpuMat& d_mat)
+{ init(CUDA_GPU_MAT + ACCESS_WRITE, &d_mat); }
+
+inline _OutputArray::_OutputArray(std::vector<cuda::GpuMat>& d_mat)
+{	init(STD_VECTOR_CUDA_GPU_MAT + ACCESS_WRITE, &d_mat);}
+
+inline _OutputArray::_OutputArray(ogl::Buffer& buf)
+{ init(OPENGL_BUFFER + ACCESS_WRITE, &buf); }
+
+inline _OutputArray::_OutputArray(cuda::HostMem& cuda_mem)
+{ init(CUDA_HOST_MEM + ACCESS_WRITE, &cuda_mem); }
+
+inline _OutputArray::_OutputArray(const Mat& m)
+{ init(FIXED_TYPE + FIXED_SIZE + MAT + ACCESS_WRITE, &m); }
+
+inline _OutputArray::_OutputArray(const std::vector<Mat>& vec)
+{ init(FIXED_SIZE + STD_VECTOR_MAT + ACCESS_WRITE, &vec); }
+
+inline _OutputArray::_OutputArray(const UMat& m)
+{ init(FIXED_TYPE + FIXED_SIZE + UMAT + ACCESS_WRITE, &m); }
+
+inline _OutputArray::_OutputArray(const std::vector<UMat>& vec)
+{ init(FIXED_SIZE + STD_VECTOR_UMAT + ACCESS_WRITE, &vec); }
+
+inline _OutputArray::_OutputArray(const cuda::GpuMat& d_mat)
+{ init(FIXED_TYPE + FIXED_SIZE + CUDA_GPU_MAT + ACCESS_WRITE, &d_mat); }
+
+
+inline _OutputArray::_OutputArray(const ogl::Buffer& buf)
+{ init(FIXED_TYPE + FIXED_SIZE + OPENGL_BUFFER + ACCESS_WRITE, &buf); }
+
+inline _OutputArray::_OutputArray(const cuda::HostMem& cuda_mem)
+{ init(FIXED_TYPE + FIXED_SIZE + CUDA_HOST_MEM + ACCESS_WRITE, &cuda_mem); }
+
+///////////////////////////////////////////////////////////////////////////////////////////
+
+inline _InputOutputArray::_InputOutputArray() { init(ACCESS_RW, 0); }
+inline _InputOutputArray::_InputOutputArray(int _flags, void* _obj) { init(_flags|ACCESS_RW, _obj); }
+inline _InputOutputArray::_InputOutputArray(Mat& m) { init(MAT+ACCESS_RW, &m); }
+inline _InputOutputArray::_InputOutputArray(std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_RW, &vec); }
+inline _InputOutputArray::_InputOutputArray(UMat& m) { init(UMAT+ACCESS_RW, &m); }
+inline _InputOutputArray::_InputOutputArray(std::vector<UMat>& vec) { init(STD_VECTOR_UMAT+ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + STD_VECTOR + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+inline _InputOutputArray::_InputOutputArray(std::vector<bool>&)
+{ CV_Error(Error::StsUnsupportedFormat, "std::vector<bool> cannot be an input/output array\n"); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(Mat_<_Tp>& m)
+{ init(FIXED_TYPE + MAT + DataType<_Tp>::type + ACCESS_RW, &m); }
+
+template<typename _Tp, int m, int n> inline
+_InputOutputArray::_InputOutputArray(Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_RW, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(_Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_RW, vec, Size(n, 1)); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const Mat_<_Tp>& m)
+{ init(FIXED_TYPE + FIXED_SIZE + MAT + DataType<_Tp>::type + ACCESS_RW, &m); }
+
+template<typename _Tp, int m, int n> inline
+_InputOutputArray::_InputOutputArray(const Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_RW, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const _Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_RW, vec, Size(n, 1)); }
+
+inline _InputOutputArray::_InputOutputArray(cuda::GpuMat& d_mat)
+{ init(CUDA_GPU_MAT + ACCESS_RW, &d_mat); }
+
+inline _InputOutputArray::_InputOutputArray(ogl::Buffer& buf)
+{ init(OPENGL_BUFFER + ACCESS_RW, &buf); }
+
+inline _InputOutputArray::_InputOutputArray(cuda::HostMem& cuda_mem)
+{ init(CUDA_HOST_MEM + ACCESS_RW, &cuda_mem); }
+
+inline _InputOutputArray::_InputOutputArray(const Mat& m)
+{ init(FIXED_TYPE + FIXED_SIZE + MAT + ACCESS_RW, &m); }
+
+inline _InputOutputArray::_InputOutputArray(const std::vector<Mat>& vec)
+{ init(FIXED_SIZE + STD_VECTOR_MAT + ACCESS_RW, &vec); }
+
+inline _InputOutputArray::_InputOutputArray(const UMat& m)
+{ init(FIXED_TYPE + FIXED_SIZE + UMAT + ACCESS_RW, &m); }
+
+inline _InputOutputArray::_InputOutputArray(const std::vector<UMat>& vec)
+{ init(FIXED_SIZE + STD_VECTOR_UMAT + ACCESS_RW, &vec); }
+
+inline _InputOutputArray::_InputOutputArray(const cuda::GpuMat& d_mat)
+{ init(FIXED_TYPE + FIXED_SIZE + CUDA_GPU_MAT + ACCESS_RW, &d_mat); }
+inline _InputOutputArray::_InputOutputArray(const std::vector<cuda::GpuMat>& d_mat)
+{	init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_CUDA_GPU_MAT + ACCESS_RW, &d_mat);}
+
+inline _InputOutputArray::_InputOutputArray(const ogl::Buffer& buf)
+{ init(FIXED_TYPE + FIXED_SIZE + OPENGL_BUFFER + ACCESS_RW, &buf); }
+
+inline _InputOutputArray::_InputOutputArray(const cuda::HostMem& cuda_mem)
+{ init(FIXED_TYPE + FIXED_SIZE + CUDA_HOST_MEM + ACCESS_RW, &cuda_mem); }
+
+//////////////////////////////////////////// Mat //////////////////////////////////////////
+
+inline
+Mat::Mat()
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{}
+
+inline
+Mat::Mat(int _rows, int _cols, int _type)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_rows, _cols, _type);
+}
+
+inline
+Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_rows, _cols, _type);
+    *this = _s;
+}
+
+inline
+Mat::Mat(Size _sz, int _type)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create( _sz.height, _sz.width, _type );
+}
+
+inline
+Mat::Mat(Size _sz, int _type, const Scalar& _s)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_sz.height, _sz.width, _type);
+    *this = _s;
+}
+
+inline
+Mat::Mat(int _dims, const int* _sz, int _type)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_dims, _sz, _type);
+}
+
+inline
+Mat::Mat(int _dims, const int* _sz, int _type, const Scalar& _s)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_dims, _sz, _type);
+    *this = _s;
+}
+
+inline
+Mat::Mat(const Mat& m)
+    : flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), data(m.data),
+      datastart(m.datastart), dataend(m.dataend), datalimit(m.datalimit), allocator(m.allocator),
+      u(m.u), size(&rows)
+{
+    if( u )
+        CV_XADD(&u->refcount, 1);
+    if( m.dims <= 2 )
+    {
+        step[0] = m.step[0]; step[1] = m.step[1];
+    }
+    else
+    {
+        dims = 0;
+        copySize(m);
+    }
+}
+
+inline
+Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
+    : flags(MAGIC_VAL + (_type & TYPE_MASK)), dims(2), rows(_rows), cols(_cols),
+      data((uchar*)_data), datastart((uchar*)_data), dataend(0), datalimit(0),
+      allocator(0), u(0), size(&rows)
+{
+    CV_Assert(total() == 0 || data != NULL);
+
+    size_t esz = CV_ELEM_SIZE(_type), esz1 = CV_ELEM_SIZE1(_type);
+    size_t minstep = cols * esz;
+    if( _step == AUTO_STEP )
+    {
+        _step = minstep;
+        flags |= CONTINUOUS_FLAG;
+    }
+    else
+    {
+        if( rows == 1 ) _step = minstep;
+        CV_DbgAssert( _step >= minstep );
+
+        if (_step % esz1 != 0)
+        {
+            CV_Error(Error::BadStep, "Step must be a multiple of esz1");
+        }
+
+        flags |= _step == minstep ? CONTINUOUS_FLAG : 0;
+    }
+    step[0] = _step;
+    step[1] = esz;
+    datalimit = datastart + _step * rows;
+    dataend = datalimit - _step + minstep;
+}
+
+inline
+Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
+    : flags(MAGIC_VAL + (_type & TYPE_MASK)), dims(2), rows(_sz.height), cols(_sz.width),
+      data((uchar*)_data), datastart((uchar*)_data), dataend(0), datalimit(0),
+      allocator(0), u(0), size(&rows)
+{
+    CV_Assert(total() == 0 || data != NULL);
+
+    size_t esz = CV_ELEM_SIZE(_type), esz1 = CV_ELEM_SIZE1(_type);
+    size_t minstep = cols*esz;
+    if( _step == AUTO_STEP )
+    {
+        _step = minstep;
+        flags |= CONTINUOUS_FLAG;
+    }
+    else
+    {
+        if( rows == 1 ) _step = minstep;
+        CV_DbgAssert( _step >= minstep );
+
+        if (_step % esz1 != 0)
+        {
+            CV_Error(Error::BadStep, "Step must be a multiple of esz1");
+        }
+
+        flags |= _step == minstep ? CONTINUOUS_FLAG : 0;
+    }
+    step[0] = _step;
+    step[1] = esz;
+    datalimit = datastart + _step*rows;
+    dataend = datalimit - _step + minstep;
+}
+
+template<typename _Tp> inline
+Mat::Mat(const std::vector<_Tp>& vec, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows((int)vec.size()),
+      cols(1), data(0), datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if(vec.empty())
+        return;
+    if( !copyData )
+    {
+        step[0] = step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)&vec[0];
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+        Mat((int)vec.size(), 1, DataType<_Tp>::type, (uchar*)&vec[0]).copyTo(*this);
+}
+
+template<typename _Tp, int n> inline
+Mat::Mat(const Vec<_Tp, n>& vec, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows(n), cols(1), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if( !copyData )
+    {
+        step[0] = step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)vec.val;
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+        Mat(n, 1, DataType<_Tp>::type, (void*)vec.val).copyTo(*this);
+}
+
+
+template<typename _Tp, int m, int n> inline
+Mat::Mat(const Matx<_Tp,m,n>& M, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows(m), cols(n), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if( !copyData )
+    {
+        step[0] = cols * sizeof(_Tp);
+        step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)M.val;
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+        Mat(m, n, DataType<_Tp>::type, (uchar*)M.val).copyTo(*this);
+}
+
+template<typename _Tp> inline
+Mat::Mat(const Point_<_Tp>& pt, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows(2), cols(1), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if( !copyData )
+    {
+        step[0] = step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)&pt.x;
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+    {
+        create(2, 1, DataType<_Tp>::type);
+        ((_Tp*)data)[0] = pt.x;
+        ((_Tp*)data)[1] = pt.y;
+    }
+}
+
+template<typename _Tp> inline
+Mat::Mat(const Point3_<_Tp>& pt, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows(3), cols(1), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if( !copyData )
+    {
+        step[0] = step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)&pt.x;
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+    {
+        create(3, 1, DataType<_Tp>::type);
+        ((_Tp*)data)[0] = pt.x;
+        ((_Tp*)data)[1] = pt.y;
+        ((_Tp*)data)[2] = pt.z;
+    }
+}
+
+template<typename _Tp> inline
+Mat::Mat(const MatCommaInitializer_<_Tp>& commaInitializer)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(0), rows(0), cols(0), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    *this = commaInitializer.operator Mat_<_Tp>();
+}
+
+inline
+Mat::~Mat()
+{
+    release();
+    if( step.p != step.buf )
+        fastFree(step.p);
+}
+
+inline
+Mat& Mat::operator = (const Mat& m)
+{
+    if( this != &m )
+    {
+        if( m.u )
+            CV_XADD(&m.u->refcount, 1);
+        release();
+        flags = m.flags;
+        if( dims <= 2 && m.dims <= 2 )
+        {
+            dims = m.dims;
+            rows = m.rows;
+            cols = m.cols;
+            step[0] = m.step[0];
+            step[1] = m.step[1];
+        }
+        else
+            copySize(m);
+        data = m.data;
+        datastart = m.datastart;
+        dataend = m.dataend;
+        datalimit = m.datalimit;
+        allocator = m.allocator;
+        u = m.u;
+    }
+    return *this;
+}
+
+inline
+Mat Mat::row(int y) const
+{
+    return Mat(*this, Range(y, y + 1), Range::all());
+}
+
+inline
+Mat Mat::col(int x) const
+{
+    return Mat(*this, Range::all(), Range(x, x + 1));
+}
+
+inline
+Mat Mat::rowRange(int startrow, int endrow) const
+{
+    return Mat(*this, Range(startrow, endrow), Range::all());
+}
+
+inline
+Mat Mat::rowRange(const Range& r) const
+{
+    return Mat(*this, r, Range::all());
+}
+
+inline
+Mat Mat::colRange(int startcol, int endcol) const
+{
+    return Mat(*this, Range::all(), Range(startcol, endcol));
+}
+
+inline
+Mat Mat::colRange(const Range& r) const
+{
+    return Mat(*this, Range::all(), r);
+}
+
+inline
+Mat Mat::clone() const
+{
+    Mat m;
+    copyTo(m);
+    return m;
+}
+
+inline
+void Mat::assignTo( Mat& m, int _type ) const
+{
+    if( _type < 0 )
+        m = *this;
+    else
+        convertTo(m, _type);
+}
+
+inline
+void Mat::create(int _rows, int _cols, int _type)
+{
+    _type &= TYPE_MASK;
+    if( dims <= 2 && rows == _rows && cols == _cols && type() == _type && data )
+        return;
+    int sz[] = {_rows, _cols};
+    create(2, sz, _type);
+}
+
+inline
+void Mat::create(Size _sz, int _type)
+{
+    create(_sz.height, _sz.width, _type);
+}
+
+inline
+void Mat::addref()
+{
+    if( u )
+        CV_XADD(&u->refcount, 1);
+}
+
+inline void Mat::release()
+{
+    if( u && CV_XADD(&u->refcount, -1) == 1 )
+        deallocate();
+    u = NULL;
+    datastart = dataend = datalimit = data = 0;
+    for(int i = 0; i < dims; i++)
+        size.p[i] = 0;
+}
+
+inline
+Mat Mat::operator()( Range _rowRange, Range _colRange ) const
+{
+    return Mat(*this, _rowRange, _colRange);
+}
+
+inline
+Mat Mat::operator()( const Rect& roi ) const
+{
+    return Mat(*this, roi);
+}
+
+inline
+Mat Mat::operator()(const Range* ranges) const
+{
+    return Mat(*this, ranges);
+}
+
+inline
+bool Mat::isContinuous() const
+{
+    return (flags & CONTINUOUS_FLAG) != 0;
+}
+
+inline
+bool Mat::isSubmatrix() const
+{
+    return (flags & SUBMATRIX_FLAG) != 0;
+}
+
+inline
+size_t Mat::elemSize() const
+{
+    return dims > 0 ? step.p[dims - 1] : 0;
+}
+
+inline
+size_t Mat::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int Mat::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int Mat::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int Mat::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+size_t Mat::step1(int i) const
+{
+    return step.p[i] / elemSize1();
+}
+
+inline
+bool Mat::empty() const
+{
+    return data == 0 || total() == 0;
+}
+
+inline
+size_t Mat::total() const
+{
+    if( dims <= 2 )
+        return (size_t)rows * cols;
+    size_t p = 1;
+    for( int i = 0; i < dims; i++ )
+        p *= size[i];
+    return p;
+}
+
+inline
+uchar* Mat::ptr(int y)
+{
+    CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
+    return data + step.p[0] * y;
+}
+
+inline
+const uchar* Mat::ptr(int y) const
+{
+    CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
+    return data + step.p[0] * y;
+}
+
+template<typename _Tp> inline
+_Tp* Mat::ptr(int y)
+{
+    CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
+    return (_Tp*)(data + step.p[0] * y);
+}
+
+template<typename _Tp> inline
+const _Tp* Mat::ptr(int y) const
+{
+    CV_DbgAssert( y == 0 || (data && dims >= 1 && data && (unsigned)y < (unsigned)size.p[0]) );
+    return (const _Tp*)(data + step.p[0] * y);
+}
+
+inline
+uchar* Mat::ptr(int i0, int i1)
+{
+    CV_DbgAssert(dims >= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    return data + i0 * step.p[0] + i1 * step.p[1];
+}
+
+inline
+const uchar* Mat::ptr(int i0, int i1) const
+{
+    CV_DbgAssert(dims >= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    return data + i0 * step.p[0] + i1 * step.p[1];
+}
+
+template<typename _Tp> inline
+_Tp* Mat::ptr(int i0, int i1)
+{
+    CV_DbgAssert(dims >= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    return (_Tp*)(data + i0 * step.p[0] + i1 * step.p[1]);
+}
+
+template<typename _Tp> inline
+const _Tp* Mat::ptr(int i0, int i1) const
+{
+    CV_DbgAssert(dims >= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    return (const _Tp*)(data + i0 * step.p[0] + i1 * step.p[1]);
+}
+
+inline
+uchar* Mat::ptr(int i0, int i1, int i2)
+{
+    CV_DbgAssert(dims >= 3);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
+    return data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2];
+}
+
+inline
+const uchar* Mat::ptr(int i0, int i1, int i2) const
+{
+    CV_DbgAssert(dims >= 3);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
+    return data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2];
+}
+
+template<typename _Tp> inline
+_Tp* Mat::ptr(int i0, int i1, int i2)
+{
+    CV_DbgAssert(dims >= 3);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
+    return (_Tp*)(data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]);
+}
+
+template<typename _Tp> inline
+const _Tp* Mat::ptr(int i0, int i1, int i2) const
+{
+    CV_DbgAssert(dims >= 3);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
+    return (const _Tp*)(data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]);
+}
+
+inline
+uchar* Mat::ptr(const int* idx)
+{
+    int i, d = dims;
+    uchar* p = data;
+    CV_DbgAssert( d >= 1 && p );
+    for( i = 0; i < d; i++ )
+    {
+        CV_DbgAssert( (unsigned)idx[i] < (unsigned)size.p[i] );
+        p += idx[i] * step.p[i];
+    }
+    return p;
+}
+
+inline
+const uchar* Mat::ptr(const int* idx) const
+{
+    int i, d = dims;
+    uchar* p = data;
+    CV_DbgAssert( d >= 1 && p );
+    for( i = 0; i < d; i++ )
+    {
+        CV_DbgAssert( (unsigned)idx[i] < (unsigned)size.p[i] );
+        p += idx[i] * step.p[i];
+    }
+    return p;
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(int i0, int i1)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
+    CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
+    return ((_Tp*)(data + step.p[0] * i0))[i1];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(int i0, int i1) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
+    CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
+    return ((const _Tp*)(data + step.p[0] * i0))[i1];
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(Point pt)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
+    CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
+    return ((_Tp*)(data + step.p[0] * pt.y))[pt.x];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(Point pt) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
+    CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
+    return ((const _Tp*)(data + step.p[0] * pt.y))[pt.x];
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(int i0)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)(size.p[0] * size.p[1]));
+    CV_DbgAssert(elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type));
+    if( isContinuous() || size.p[0] == 1 )
+        return ((_Tp*)data)[i0];
+    if( size.p[1] == 1 )
+        return *(_Tp*)(data + step.p[0] * i0);
+    int i = i0 / cols, j = i0 - i * cols;
+    return ((_Tp*)(data + step.p[0] * i))[j];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(int i0) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)(size.p[0] * size.p[1]));
+    CV_DbgAssert(elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type));
+    if( isContinuous() || size.p[0] == 1 )
+        return ((const _Tp*)data)[i0];
+    if( size.p[1] == 1 )
+        return *(const _Tp*)(data + step.p[0] * i0);
+    int i = i0 / cols, j = i0 - i * cols;
+    return ((const _Tp*)(data + step.p[0] * i))[j];
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(int i0, int i1, int i2)
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(_Tp*)ptr(i0, i1, i2);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(int i0, int i1, int i2) const
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(const _Tp*)ptr(i0, i1, i2);
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(const int* idx)
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(_Tp*)ptr(idx);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(const int* idx) const
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(const _Tp*)ptr(idx);
+}
+
+template<typename _Tp, int n> inline
+_Tp& Mat::at(const Vec<int, n>& idx)
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(_Tp*)ptr(idx.val);
+}
+
+template<typename _Tp, int n> inline
+const _Tp& Mat::at(const Vec<int, n>& idx) const
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(const _Tp*)ptr(idx.val);
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> Mat::begin() const
+{
+    CV_DbgAssert( elemSize() == sizeof(_Tp) );
+    return MatConstIterator_<_Tp>((const Mat_<_Tp>*)this);
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> Mat::end() const
+{
+    CV_DbgAssert( elemSize() == sizeof(_Tp) );
+    MatConstIterator_<_Tp> it((const Mat_<_Tp>*)this);
+    it += total();
+    return it;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> Mat::begin()
+{
+    CV_DbgAssert( elemSize() == sizeof(_Tp) );
+    return MatIterator_<_Tp>((Mat_<_Tp>*)this);
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> Mat::end()
+{
+    CV_DbgAssert( elemSize() == sizeof(_Tp) );
+    MatIterator_<_Tp> it((Mat_<_Tp>*)this);
+    it += total();
+    return it;
+}
+
+template<typename _Tp, typename Functor> inline
+void Mat::forEach(const Functor& operation) {
+    this->forEach_impl<_Tp>(operation);
+}
+
+template<typename _Tp, typename Functor> inline
+void Mat::forEach(const Functor& operation) const {
+    // call as not const
+    (const_cast<Mat*>(this))->forEach<const _Tp>(operation);
+}
+
+template<typename _Tp> inline
+Mat::operator std::vector<_Tp>() const
+{
+    std::vector<_Tp> v;
+    copyTo(v);
+    return v;
+}
+
+template<typename _Tp, int n> inline
+Mat::operator Vec<_Tp, n>() const
+{
+    CV_Assert( data && dims <= 2 && (rows == 1 || cols == 1) &&
+               rows + cols - 1 == n && channels() == 1 );
+
+    if( isContinuous() && type() == DataType<_Tp>::type )
+        return Vec<_Tp, n>((_Tp*)data);
+    Vec<_Tp, n> v;
+    Mat tmp(rows, cols, DataType<_Tp>::type, v.val);
+    convertTo(tmp, tmp.type());
+    return v;
+}
+
+template<typename _Tp, int m, int n> inline
+Mat::operator Matx<_Tp, m, n>() const
+{
+    CV_Assert( data && dims <= 2 && rows == m && cols == n && channels() == 1 );
+
+    if( isContinuous() && type() == DataType<_Tp>::type )
+        return Matx<_Tp, m, n>((_Tp*)data);
+    Matx<_Tp, m, n> mtx;
+    Mat tmp(rows, cols, DataType<_Tp>::type, mtx.val);
+    convertTo(tmp, tmp.type());
+    return mtx;
+}
+
+template<typename _Tp> inline
+void Mat::push_back(const _Tp& elem)
+{
+    if( !data )
+    {
+        *this = Mat(1, 1, DataType<_Tp>::type, (void*)&elem).clone();
+        return;
+    }
+    CV_Assert(DataType<_Tp>::type == type() && cols == 1
+              /* && dims == 2 (cols == 1 implies dims == 2) */);
+    const uchar* tmp = dataend + step[0];
+    if( !isSubmatrix() && isContinuous() && tmp <= datalimit )
+    {
+        *(_Tp*)(data + (size.p[0]++) * step.p[0]) = elem;
+        dataend = tmp;
+    }
+    else
+        push_back_(&elem);
+}
+
+template<typename _Tp> inline
+void Mat::push_back(const Mat_<_Tp>& m)
+{
+    push_back((const Mat&)m);
+}
+
+template<> inline
+void Mat::push_back(const MatExpr& expr)
+{
+    push_back(static_cast<Mat>(expr));
+}
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+
+inline
+Mat::Mat(Mat&& m)
+    : flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), data(m.data),
+      datastart(m.datastart), dataend(m.dataend), datalimit(m.datalimit), allocator(m.allocator),
+      u(m.u), size(&rows)
+{
+    if (m.dims <= 2)  // move new step/size info
+    {
+        step[0] = m.step[0];
+        step[1] = m.step[1];
+    }
+    else
+    {
+        CV_DbgAssert(m.step.p != m.step.buf);
+        step.p = m.step.p;
+        size.p = m.size.p;
+        m.step.p = m.step.buf;
+        m.size.p = &m.rows;
+    }
+    m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0;
+    m.data = NULL; m.datastart = NULL; m.dataend = NULL; m.datalimit = NULL;
+    m.allocator = NULL;
+    m.u = NULL;
+}
+
+inline
+Mat& Mat::operator = (Mat&& m)
+{
+    release();
+    flags = m.flags; dims = m.dims; rows = m.rows; cols = m.cols; data = m.data;
+    datastart = m.datastart; dataend = m.dataend; datalimit = m.datalimit; allocator = m.allocator;
+    u = m.u;
+    if (step.p != step.buf) // release self step/size
+    {
+        fastFree(step.p);
+        step.p = step.buf;
+        size.p = &rows;
+    }
+    if (m.dims <= 2) // move new step/size info
+    {
+        step[0] = m.step[0];
+        step[1] = m.step[1];
+    }
+    else
+    {
+        CV_DbgAssert(m.step.p != m.step.buf);
+        step.p = m.step.p;
+        size.p = m.size.p;
+        m.step.p = m.step.buf;
+        m.size.p = &m.rows;
+    }
+    m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0;
+    m.data = NULL; m.datastart = NULL; m.dataend = NULL; m.datalimit = NULL;
+    m.allocator = NULL;
+    m.u = NULL;
+    return *this;
+}
+
+#endif
+
+
+///////////////////////////// MatSize ////////////////////////////
+
+inline
+MatSize::MatSize(int* _p)
+    : p(_p) {}
+
+inline
+Size MatSize::operator()() const
+{
+    CV_DbgAssert(p[-1] <= 2);
+    return Size(p[1], p[0]);
+}
+
+inline
+const int& MatSize::operator[](int i) const
+{
+    return p[i];
+}
+
+inline
+int& MatSize::operator[](int i)
+{
+    return p[i];
+}
+
+inline
+MatSize::operator const int*() const
+{
+    return p;
+}
+
+inline
+bool MatSize::operator == (const MatSize& sz) const
+{
+    int d = p[-1];
+    int dsz = sz.p[-1];
+    if( d != dsz )
+        return false;
+    if( d == 2 )
+        return p[0] == sz.p[0] && p[1] == sz.p[1];
+
+    for( int i = 0; i < d; i++ )
+        if( p[i] != sz.p[i] )
+            return false;
+    return true;
+}
+
+inline
+bool MatSize::operator != (const MatSize& sz) const
+{
+    return !(*this == sz);
+}
+
+
+
+///////////////////////////// MatStep ////////////////////////////
+
+inline
+MatStep::MatStep()
+{
+    p = buf; p[0] = p[1] = 0;
+}
+
+inline
+MatStep::MatStep(size_t s)
+{
+    p = buf; p[0] = s; p[1] = 0;
+}
+
+inline
+const size_t& MatStep::operator[](int i) const
+{
+    return p[i];
+}
+
+inline
+size_t& MatStep::operator[](int i)
+{
+    return p[i];
+}
+
+inline MatStep::operator size_t() const
+{
+    CV_DbgAssert( p == buf );
+    return buf[0];
+}
+
+inline MatStep& MatStep::operator = (size_t s)
+{
+    CV_DbgAssert( p == buf );
+    buf[0] = s;
+    return *this;
+}
+
+
+
+////////////////////////////// Mat_<_Tp> ////////////////////////////
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_()
+    : Mat()
+{
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _rows, int _cols)
+    : Mat(_rows, _cols, DataType<_Tp>::type)
+{
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _rows, int _cols, const _Tp& value)
+    : Mat(_rows, _cols, DataType<_Tp>::type)
+{
+    *this = value;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(Size _sz)
+    : Mat(_sz.height, _sz.width, DataType<_Tp>::type)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(Size _sz, const _Tp& value)
+    : Mat(_sz.height, _sz.width, DataType<_Tp>::type)
+{
+    *this = value;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _dims, const int* _sz)
+    : Mat(_dims, _sz, DataType<_Tp>::type)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _dims, const int* _sz, const _Tp& _s)
+    : Mat(_dims, _sz, DataType<_Tp>::type, Scalar(_s))
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat_<_Tp>& m, const Range* ranges)
+    : Mat(m, ranges)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat& m)
+    : Mat()
+{
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+    *this = m;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat_& m)
+    : Mat(m)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _rows, int _cols, _Tp* _data, size_t steps)
+    : Mat(_rows, _cols, DataType<_Tp>::type, _data, steps)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat_& m, const Range& _rowRange, const Range& _colRange)
+    : Mat(m, _rowRange, _colRange)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat_& m, const Rect& roi)
+    : Mat(m, roi)
+{}
+
+template<typename _Tp> template<int n> inline
+Mat_<_Tp>::Mat_(const Vec<typename DataType<_Tp>::channel_type, n>& vec, bool copyData)
+    : Mat(n / DataType<_Tp>::channels, 1, DataType<_Tp>::type, (void*)&vec)
+{
+    CV_Assert(n%DataType<_Tp>::channels == 0);
+    if( copyData )
+        *this = clone();
+}
+
+template<typename _Tp> template<int m, int n> inline
+Mat_<_Tp>::Mat_(const Matx<typename DataType<_Tp>::channel_type, m, n>& M, bool copyData)
+    : Mat(m, n / DataType<_Tp>::channels, DataType<_Tp>::type, (void*)&M)
+{
+    CV_Assert(n % DataType<_Tp>::channels == 0);
+    if( copyData )
+        *this = clone();
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Point_<typename DataType<_Tp>::channel_type>& pt, bool copyData)
+    : Mat(2 / DataType<_Tp>::channels, 1, DataType<_Tp>::type, (void*)&pt)
+{
+    CV_Assert(2 % DataType<_Tp>::channels == 0);
+    if( copyData )
+        *this = clone();
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Point3_<typename DataType<_Tp>::channel_type>& pt, bool copyData)
+    : Mat(3 / DataType<_Tp>::channels, 1, DataType<_Tp>::type, (void*)&pt)
+{
+    CV_Assert(3 % DataType<_Tp>::channels == 0);
+    if( copyData )
+        *this = clone();
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const MatCommaInitializer_<_Tp>& commaInitializer)
+    : Mat(commaInitializer)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const std::vector<_Tp>& vec, bool copyData)
+    : Mat(vec, copyData)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m)
+{
+    if( DataType<_Tp>::type == m.type() )
+    {
+        Mat::operator = (m);
+        return *this;
+    }
+    if( DataType<_Tp>::depth == m.depth() )
+    {
+        return (*this = m.reshape(DataType<_Tp>::channels, m.dims, 0));
+    }
+    CV_DbgAssert(DataType<_Tp>::channels == m.channels());
+    m.convertTo(*this, type());
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat_& m)
+{
+    Mat::operator=(m);
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (const _Tp& s)
+{
+    typedef typename DataType<_Tp>::vec_type VT;
+    Mat::operator=(Scalar((const VT&)s));
+    return *this;
+}
+
+template<typename _Tp> inline
+void Mat_<_Tp>::create(int _rows, int _cols)
+{
+    Mat::create(_rows, _cols, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+void Mat_<_Tp>::create(Size _sz)
+{
+    Mat::create(_sz, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+void Mat_<_Tp>::create(int _dims, const int* _sz)
+{
+    Mat::create(_dims, _sz, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::cross(const Mat_& m) const
+{
+    return Mat_<_Tp>(Mat::cross(m));
+}
+
+template<typename _Tp> template<typename T2> inline
+Mat_<_Tp>::operator Mat_<T2>() const
+{
+    return Mat_<T2>(*this);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::row(int y) const
+{
+    return Mat_(*this, Range(y, y+1), Range::all());
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::col(int x) const
+{
+    return Mat_(*this, Range::all(), Range(x, x+1));
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::diag(int d) const
+{
+    return Mat_(Mat::diag(d));
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::clone() const
+{
+    return Mat_(Mat::clone());
+}
+
+template<typename _Tp> inline
+size_t Mat_<_Tp>::elemSize() const
+{
+    CV_DbgAssert( Mat::elemSize() == sizeof(_Tp) );
+    return sizeof(_Tp);
+}
+
+template<typename _Tp> inline
+size_t Mat_<_Tp>::elemSize1() const
+{
+    CV_DbgAssert( Mat::elemSize1() == sizeof(_Tp) / DataType<_Tp>::channels );
+    return sizeof(_Tp) / DataType<_Tp>::channels;
+}
+
+template<typename _Tp> inline
+int Mat_<_Tp>::type() const
+{
+    CV_DbgAssert( Mat::type() == DataType<_Tp>::type );
+    return DataType<_Tp>::type;
+}
+
+template<typename _Tp> inline
+int Mat_<_Tp>::depth() const
+{
+    CV_DbgAssert( Mat::depth() == DataType<_Tp>::depth );
+    return DataType<_Tp>::depth;
+}
+
+template<typename _Tp> inline
+int Mat_<_Tp>::channels() const
+{
+    CV_DbgAssert( Mat::channels() == DataType<_Tp>::channels );
+    return DataType<_Tp>::channels;
+}
+
+template<typename _Tp> inline
+size_t Mat_<_Tp>::stepT(int i) const
+{
+    return step.p[i] / elemSize();
+}
+
+template<typename _Tp> inline
+size_t Mat_<_Tp>::step1(int i) const
+{
+    return step.p[i] / elemSize1();
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::adjustROI( int dtop, int dbottom, int dleft, int dright )
+{
+    return (Mat_<_Tp>&)(Mat::adjustROI(dtop, dbottom, dleft, dright));
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::operator()( const Range& _rowRange, const Range& _colRange ) const
+{
+    return Mat_<_Tp>(*this, _rowRange, _colRange);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::operator()( const Rect& roi ) const
+{
+    return Mat_<_Tp>(*this, roi);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::operator()( const Range* ranges ) const
+{
+    return Mat_<_Tp>(*this, ranges);
+}
+
+template<typename _Tp> inline
+_Tp* Mat_<_Tp>::operator [](int y)
+{
+    CV_DbgAssert( 0 <= y && y < rows );
+    return (_Tp*)(data + y*step.p[0]);
+}
+
+template<typename _Tp> inline
+const _Tp* Mat_<_Tp>::operator [](int y) const
+{
+    CV_DbgAssert( 0 <= y && y < rows );
+    return (const _Tp*)(data + y*step.p[0]);
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(int i0, int i1)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert(type() == DataType<_Tp>::type);
+    return ((_Tp*)(data + step.p[0] * i0))[i1];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(int i0, int i1) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert(type() == DataType<_Tp>::type);
+    return ((const _Tp*)(data + step.p[0] * i0))[i1];
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(Point pt)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)pt.x < (unsigned)size.p[1]);
+    CV_DbgAssert(type() == DataType<_Tp>::type);
+    return ((_Tp*)(data + step.p[0] * pt.y))[pt.x];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(Point pt) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)pt.x < (unsigned)size.p[1]);
+    CV_DbgAssert(type() == DataType<_Tp>::type);
+    return ((const _Tp*)(data + step.p[0] * pt.y))[pt.x];
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(const int* idx)
+{
+    return Mat::at<_Tp>(idx);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(const int* idx) const
+{
+    return Mat::at<_Tp>(idx);
+}
+
+template<typename _Tp> template<int n> inline
+_Tp& Mat_<_Tp>::operator ()(const Vec<int, n>& idx)
+{
+    return Mat::at<_Tp>(idx);
+}
+
+template<typename _Tp> template<int n> inline
+const _Tp& Mat_<_Tp>::operator ()(const Vec<int, n>& idx) const
+{
+    return Mat::at<_Tp>(idx);
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(int i0)
+{
+    return this->at<_Tp>(i0);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(int i0) const
+{
+    return this->at<_Tp>(i0);
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(int i0, int i1, int i2)
+{
+    return this->at<_Tp>(i0, i1, i2);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(int i0, int i1, int i2) const
+{
+    return this->at<_Tp>(i0, i1, i2);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::operator std::vector<_Tp>() const
+{
+    std::vector<_Tp> v;
+    copyTo(v);
+    return v;
+}
+
+template<typename _Tp> template<int n> inline
+Mat_<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const
+{
+    CV_Assert(n % DataType<_Tp>::channels == 0);
+
+#if defined _MSC_VER
+    const Mat* pMat = (const Mat*)this; // workaround for MSVS <= 2012 compiler bugs (but GCC 4.6 dislikes this workaround)
+    return pMat->operator Vec<typename DataType<_Tp>::channel_type, n>();
+#else
+    return this->Mat::operator Vec<typename DataType<_Tp>::channel_type, n>();
+#endif
+}
+
+template<typename _Tp> template<int m, int n> inline
+Mat_<_Tp>::operator Matx<typename DataType<_Tp>::channel_type, m, n>() const
+{
+    CV_Assert(n % DataType<_Tp>::channels == 0);
+
+#if defined _MSC_VER
+    const Mat* pMat = (const Mat*)this; // workaround for MSVS <= 2012 compiler bugs (but GCC 4.6 dislikes this workaround)
+    Matx<typename DataType<_Tp>::channel_type, m, n> res = pMat->operator Matx<typename DataType<_Tp>::channel_type, m, n>();
+    return res;
+#else
+    Matx<typename DataType<_Tp>::channel_type, m, n> res = this->Mat::operator Matx<typename DataType<_Tp>::channel_type, m, n>();
+    return res;
+#endif
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> Mat_<_Tp>::begin() const
+{
+    return Mat::begin<_Tp>();
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> Mat_<_Tp>::end() const
+{
+    return Mat::end<_Tp>();
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> Mat_<_Tp>::begin()
+{
+    return Mat::begin<_Tp>();
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> Mat_<_Tp>::end()
+{
+    return Mat::end<_Tp>();
+}
+
+template<typename _Tp> template<typename Functor> inline
+void Mat_<_Tp>::forEach(const Functor& operation) {
+    Mat::forEach<_Tp, Functor>(operation);
+}
+
+template<typename _Tp> template<typename Functor> inline
+void Mat_<_Tp>::forEach(const Functor& operation) const {
+    Mat::forEach<_Tp, Functor>(operation);
+}
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(Mat_&& m)
+    : Mat(m)
+{
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (Mat_&& m)
+{
+    Mat::operator = (m);
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(Mat&& m)
+    : Mat()
+{
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+    *this = m;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (Mat&& m)
+{
+    if( DataType<_Tp>::type == m.type() )
+    {
+        Mat::operator = ((Mat&&)m);
+        return *this;
+    }
+    if( DataType<_Tp>::depth == m.depth() )
+    {
+        Mat::operator = ((Mat&&)m.reshape(DataType<_Tp>::channels, m.dims, 0));
+        return *this;
+    }
+    CV_DbgAssert(DataType<_Tp>::channels == m.channels());
+    m.convertTo(*this, type());
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(MatExpr&& e)
+    : Mat()
+{
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+    *this = Mat(e);
+}
+
+#endif
+
+///////////////////////////// SparseMat /////////////////////////////
+
+inline
+SparseMat::SparseMat()
+    : flags(MAGIC_VAL), hdr(0)
+{}
+
+inline
+SparseMat::SparseMat(int _dims, const int* _sizes, int _type)
+    : flags(MAGIC_VAL), hdr(0)
+{
+    create(_dims, _sizes, _type);
+}
+
+inline
+SparseMat::SparseMat(const SparseMat& m)
+    : flags(m.flags), hdr(m.hdr)
+{
+    addref();
+}
+
+inline
+SparseMat::~SparseMat()
+{
+    release();
+}
+
+inline
+SparseMat& SparseMat::operator = (const SparseMat& m)
+{
+    if( this != &m )
+    {
+        if( m.hdr )
+            CV_XADD(&m.hdr->refcount, 1);
+        release();
+        flags = m.flags;
+        hdr = m.hdr;
+    }
+    return *this;
+}
+
+inline
+SparseMat& SparseMat::operator = (const Mat& m)
+{
+    return (*this = SparseMat(m));
+}
+
+inline
+SparseMat SparseMat::clone() const
+{
+    SparseMat temp;
+    this->copyTo(temp);
+    return temp;
+}
+
+inline
+void SparseMat::assignTo( SparseMat& m, int _type ) const
+{
+    if( _type < 0 )
+        m = *this;
+    else
+        convertTo(m, _type);
+}
+
+inline
+void SparseMat::addref()
+{
+    if( hdr )
+        CV_XADD(&hdr->refcount, 1);
+}
+
+inline
+void SparseMat::release()
+{
+    if( hdr && CV_XADD(&hdr->refcount, -1) == 1 )
+        delete hdr;
+    hdr = 0;
+}
+
+inline
+size_t SparseMat::elemSize() const
+{
+    return CV_ELEM_SIZE(flags);
+}
+
+inline
+size_t SparseMat::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int SparseMat::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int SparseMat::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int SparseMat::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+const int* SparseMat::size() const
+{
+    return hdr ? hdr->size : 0;
+}
+
+inline
+int SparseMat::size(int i) const
+{
+    if( hdr )
+    {
+        CV_DbgAssert((unsigned)i < (unsigned)hdr->dims);
+        return hdr->size[i];
+    }
+    return 0;
+}
+
+inline
+int SparseMat::dims() const
+{
+    return hdr ? hdr->dims : 0;
+}
+
+inline
+size_t SparseMat::nzcount() const
+{
+    return hdr ? hdr->nodeCount : 0;
+}
+
+inline
+size_t SparseMat::hash(int i0) const
+{
+    return (size_t)i0;
+}
+
+inline
+size_t SparseMat::hash(int i0, int i1) const
+{
+    return (size_t)(unsigned)i0 * HASH_SCALE + (unsigned)i1;
+}
+
+inline
+size_t SparseMat::hash(int i0, int i1, int i2) const
+{
+    return ((size_t)(unsigned)i0 * HASH_SCALE + (unsigned)i1) * HASH_SCALE + (unsigned)i2;
+}
+
+inline
+size_t SparseMat::hash(const int* idx) const
+{
+    size_t h = (unsigned)idx[0];
+    if( !hdr )
+        return 0;
+    int d = hdr->dims;
+    for(int i = 1; i < d; i++ )
+        h = h * HASH_SCALE + (unsigned)idx[i];
+    return h;
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::ref(int i0, size_t* hashval)
+{
+    return *(_Tp*)((SparseMat*)this)->ptr(i0, true, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::ref(int i0, int i1, size_t* hashval)
+{
+    return *(_Tp*)((SparseMat*)this)->ptr(i0, i1, true, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::ref(int i0, int i1, int i2, size_t* hashval)
+{
+    return *(_Tp*)((SparseMat*)this)->ptr(i0, i1, i2, true, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::ref(const int* idx, size_t* hashval)
+{
+    return *(_Tp*)((SparseMat*)this)->ptr(idx, true, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat::value(int i0, size_t* hashval) const
+{
+    const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, false, hashval);
+    return p ? *p : _Tp();
+}
+
+template<typename _Tp> inline
+_Tp SparseMat::value(int i0, int i1, size_t* hashval) const
+{
+    const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, i1, false, hashval);
+    return p ? *p : _Tp();
+}
+
+template<typename _Tp> inline
+_Tp SparseMat::value(int i0, int i1, int i2, size_t* hashval) const
+{
+    const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, i1, i2, false, hashval);
+    return p ? *p : _Tp();
+}
+
+template<typename _Tp> inline
+_Tp SparseMat::value(const int* idx, size_t* hashval) const
+{
+    const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(idx, false, hashval);
+    return p ? *p : _Tp();
+}
+
+template<typename _Tp> inline
+const _Tp* SparseMat::find(int i0, size_t* hashval) const
+{
+    return (const _Tp*)((SparseMat*)this)->ptr(i0, false, hashval);
+}
+
+template<typename _Tp> inline
+const _Tp* SparseMat::find(int i0, int i1, size_t* hashval) const
+{
+    return (const _Tp*)((SparseMat*)this)->ptr(i0, i1, false, hashval);
+}
+
+template<typename _Tp> inline
+const _Tp* SparseMat::find(int i0, int i1, int i2, size_t* hashval) const
+{
+    return (const _Tp*)((SparseMat*)this)->ptr(i0, i1, i2, false, hashval);
+}
+
+template<typename _Tp> inline
+const _Tp* SparseMat::find(const int* idx, size_t* hashval) const
+{
+    return (const _Tp*)((SparseMat*)this)->ptr(idx, false, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::value(Node* n)
+{
+    return *(_Tp*)((uchar*)n + hdr->valueOffset);
+}
+
+template<typename _Tp> inline
+const _Tp& SparseMat::value(const Node* n) const
+{
+    return *(const _Tp*)((const uchar*)n + hdr->valueOffset);
+}
+
+inline
+SparseMat::Node* SparseMat::node(size_t nidx)
+{
+    return (Node*)(void*)&hdr->pool[nidx];
+}
+
+inline
+const SparseMat::Node* SparseMat::node(size_t nidx) const
+{
+    return (const Node*)(const void*)&hdr->pool[nidx];
+}
+
+inline
+SparseMatIterator SparseMat::begin()
+{
+    return SparseMatIterator(this);
+}
+
+inline
+SparseMatConstIterator SparseMat::begin() const
+{
+    return SparseMatConstIterator(this);
+}
+
+inline
+SparseMatIterator SparseMat::end()
+{
+    SparseMatIterator it(this);
+    it.seekEnd();
+    return it;
+}
+
+inline
+SparseMatConstIterator SparseMat::end() const
+{
+    SparseMatConstIterator it(this);
+    it.seekEnd();
+    return it;
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMat::begin()
+{
+    return SparseMatIterator_<_Tp>(this);
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMat::begin() const
+{
+    return SparseMatConstIterator_<_Tp>(this);
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMat::end()
+{
+    SparseMatIterator_<_Tp> it(this);
+    it.seekEnd();
+    return it;
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMat::end() const
+{
+    SparseMatConstIterator_<_Tp> it(this);
+    it.seekEnd();
+    return it;
+}
+
+
+
+///////////////////////////// SparseMat_ ////////////////////////////
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_()
+{
+    flags = MAGIC_VAL | DataType<_Tp>::type;
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_(int _dims, const int* _sizes)
+    : SparseMat(_dims, _sizes, DataType<_Tp>::type)
+{}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_(const SparseMat& m)
+{
+    if( m.type() == DataType<_Tp>::type )
+        *this = (const SparseMat_<_Tp>&)m;
+    else
+        m.convertTo(*this, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_(const SparseMat_<_Tp>& m)
+{
+    this->flags = m.flags;
+    this->hdr = m.hdr;
+    if( this->hdr )
+        CV_XADD(&this->hdr->refcount, 1);
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_(const Mat& m)
+{
+    SparseMat sm(m);
+    *this = sm;
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const SparseMat_<_Tp>& m)
+{
+    if( this != &m )
+    {
+        if( m.hdr ) CV_XADD(&m.hdr->refcount, 1);
+        release();
+        flags = m.flags;
+        hdr = m.hdr;
+    }
+    return *this;
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const SparseMat& m)
+{
+    if( m.type() == DataType<_Tp>::type )
+        return (*this = (const SparseMat_<_Tp>&)m);
+    m.convertTo(*this, DataType<_Tp>::type);
+    return *this;
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const Mat& m)
+{
+    return (*this = SparseMat(m));
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp> SparseMat_<_Tp>::clone() const
+{
+    SparseMat_<_Tp> m;
+    this->copyTo(m);
+    return m;
+}
+
+template<typename _Tp> inline
+void SparseMat_<_Tp>::create(int _dims, const int* _sizes)
+{
+    SparseMat::create(_dims, _sizes, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+int SparseMat_<_Tp>::type() const
+{
+    return DataType<_Tp>::type;
+}
+
+template<typename _Tp> inline
+int SparseMat_<_Tp>::depth() const
+{
+    return DataType<_Tp>::depth;
+}
+
+template<typename _Tp> inline
+int SparseMat_<_Tp>::channels() const
+{
+    return DataType<_Tp>::channels;
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat_<_Tp>::ref(int i0, size_t* hashval)
+{
+    return SparseMat::ref<_Tp>(i0, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat_<_Tp>::operator()(int i0, size_t* hashval) const
+{
+    return SparseMat::value<_Tp>(i0, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat_<_Tp>::ref(int i0, int i1, size_t* hashval)
+{
+    return SparseMat::ref<_Tp>(i0, i1, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat_<_Tp>::operator()(int i0, int i1, size_t* hashval) const
+{
+    return SparseMat::value<_Tp>(i0, i1, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat_<_Tp>::ref(int i0, int i1, int i2, size_t* hashval)
+{
+    return SparseMat::ref<_Tp>(i0, i1, i2, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat_<_Tp>::operator()(int i0, int i1, int i2, size_t* hashval) const
+{
+    return SparseMat::value<_Tp>(i0, i1, i2, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat_<_Tp>::ref(const int* idx, size_t* hashval)
+{
+    return SparseMat::ref<_Tp>(idx, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat_<_Tp>::operator()(const int* idx, size_t* hashval) const
+{
+    return SparseMat::value<_Tp>(idx, hashval);
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMat_<_Tp>::begin()
+{
+    return SparseMatIterator_<_Tp>(this);
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMat_<_Tp>::begin() const
+{
+    return SparseMatConstIterator_<_Tp>(this);
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMat_<_Tp>::end()
+{
+    SparseMatIterator_<_Tp> it(this);
+    it.seekEnd();
+    return it;
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMat_<_Tp>::end() const
+{
+    SparseMatConstIterator_<_Tp> it(this);
+    it.seekEnd();
+    return it;
+}
+
+
+
+////////////////////////// MatConstIterator /////////////////////////
+
+inline
+MatConstIterator::MatConstIterator()
+    : m(0), elemSize(0), ptr(0), sliceStart(0), sliceEnd(0)
+{}
+
+inline
+MatConstIterator::MatConstIterator(const Mat* _m)
+    : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0)
+{
+    if( m && m->isContinuous() )
+    {
+        sliceStart = m->ptr();
+        sliceEnd = sliceStart + m->total()*elemSize;
+    }
+    seek((const int*)0);
+}
+
+inline
+MatConstIterator::MatConstIterator(const Mat* _m, int _row, int _col)
+    : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0)
+{
+    CV_Assert(m && m->dims <= 2);
+    if( m->isContinuous() )
+    {
+        sliceStart = m->ptr();
+        sliceEnd = sliceStart + m->total()*elemSize;
+    }
+    int idx[] = {_row, _col};
+    seek(idx);
+}
+
+inline
+MatConstIterator::MatConstIterator(const Mat* _m, Point _pt)
+    : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0)
+{
+    CV_Assert(m && m->dims <= 2);
+    if( m->isContinuous() )
+    {
+        sliceStart = m->ptr();
+        sliceEnd = sliceStart + m->total()*elemSize;
+    }
+    int idx[] = {_pt.y, _pt.x};
+    seek(idx);
+}
+
+inline
+MatConstIterator::MatConstIterator(const MatConstIterator& it)
+    : m(it.m), elemSize(it.elemSize), ptr(it.ptr), sliceStart(it.sliceStart), sliceEnd(it.sliceEnd)
+{}
+
+inline
+MatConstIterator& MatConstIterator::operator = (const MatConstIterator& it )
+{
+    m = it.m; elemSize = it.elemSize; ptr = it.ptr;
+    sliceStart = it.sliceStart; sliceEnd = it.sliceEnd;
+    return *this;
+}
+
+inline
+const uchar* MatConstIterator::operator *() const
+{
+    return ptr;
+}
+
+inline MatConstIterator& MatConstIterator::operator += (ptrdiff_t ofs)
+{
+    if( !m || ofs == 0 )
+        return *this;
+    ptrdiff_t ofsb = ofs*elemSize;
+    ptr += ofsb;
+    if( ptr < sliceStart || sliceEnd <= ptr )
+    {
+        ptr -= ofsb;
+        seek(ofs, true);
+    }
+    return *this;
+}
+
+inline
+MatConstIterator& MatConstIterator::operator -= (ptrdiff_t ofs)
+{
+    return (*this += -ofs);
+}
+
+inline
+MatConstIterator& MatConstIterator::operator --()
+{
+    if( m && (ptr -= elemSize) < sliceStart )
+    {
+        ptr += elemSize;
+        seek(-1, true);
+    }
+    return *this;
+}
+
+inline
+MatConstIterator MatConstIterator::operator --(int)
+{
+    MatConstIterator b = *this;
+    *this += -1;
+    return b;
+}
+
+inline
+MatConstIterator& MatConstIterator::operator ++()
+{
+    if( m && (ptr += elemSize) >= sliceEnd )
+    {
+        ptr -= elemSize;
+        seek(1, true);
+    }
+    return *this;
+}
+
+inline MatConstIterator MatConstIterator::operator ++(int)
+{
+    MatConstIterator b = *this;
+    *this += 1;
+    return b;
+}
+
+
+static inline
+bool operator == (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.m == b.m && a.ptr == b.ptr;
+}
+
+static inline
+bool operator != (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return !(a == b);
+}
+
+static inline
+bool operator < (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.ptr < b.ptr;
+}
+
+static inline
+bool operator > (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.ptr > b.ptr;
+}
+
+static inline
+bool operator <= (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.ptr <= b.ptr;
+}
+
+static inline
+bool operator >= (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.ptr >= b.ptr;
+}
+
+static inline
+ptrdiff_t operator - (const MatConstIterator& b, const MatConstIterator& a)
+{
+    if( a.m != b.m )
+        return ((size_t)(-1) >> 1);
+    if( a.sliceEnd == b.sliceEnd )
+        return (b.ptr - a.ptr)/b.elemSize;
+
+    return b.lpos() - a.lpos();
+}
+
+static inline
+MatConstIterator operator + (const MatConstIterator& a, ptrdiff_t ofs)
+{
+    MatConstIterator b = a;
+    return b += ofs;
+}
+
+static inline
+MatConstIterator operator + (ptrdiff_t ofs, const MatConstIterator& a)
+{
+    MatConstIterator b = a;
+    return b += ofs;
+}
+
+static inline
+MatConstIterator operator - (const MatConstIterator& a, ptrdiff_t ofs)
+{
+    MatConstIterator b = a;
+    return b += -ofs;
+}
+
+
+inline
+const uchar* MatConstIterator::operator [](ptrdiff_t i) const
+{
+    return *(*this + i);
+}
+
+
+
+///////////////////////// MatConstIterator_ /////////////////////////
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_()
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m)
+    : MatConstIterator(_m)
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m, int _row, int _col)
+    : MatConstIterator(_m, _row, _col)
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m, Point _pt)
+    : MatConstIterator(_m, _pt)
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_(const MatConstIterator_& it)
+    : MatConstIterator(it)
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator = (const MatConstIterator_& it )
+{
+    MatConstIterator::operator = (it);
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp MatConstIterator_<_Tp>::operator *() const
+{
+    return *(_Tp*)(this->ptr);
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator += (ptrdiff_t ofs)
+{
+    MatConstIterator::operator += (ofs);
+    return *this;
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator -= (ptrdiff_t ofs)
+{
+    return (*this += -ofs);
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator --()
+{
+    MatConstIterator::operator --();
+    return *this;
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> MatConstIterator_<_Tp>::operator --(int)
+{
+    MatConstIterator_ b = *this;
+    MatConstIterator::operator --();
+    return b;
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator ++()
+{
+    MatConstIterator::operator ++();
+    return *this;
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> MatConstIterator_<_Tp>::operator ++(int)
+{
+    MatConstIterator_ b = *this;
+    MatConstIterator::operator ++();
+    return b;
+}
+
+
+template<typename _Tp> inline
+Point MatConstIterator_<_Tp>::pos() const
+{
+    if( !m )
+        return Point();
+    CV_DbgAssert( m->dims <= 2 );
+    if( m->isContinuous() )
+    {
+        ptrdiff_t ofs = (const _Tp*)ptr - (const _Tp*)m->data;
+        int y = (int)(ofs / m->cols);
+        int x = (int)(ofs - (ptrdiff_t)y * m->cols);
+        return Point(x, y);
+    }
+    else
+    {
+        ptrdiff_t ofs = (uchar*)ptr - m->data;
+        int y = (int)(ofs / m->step);
+        int x = (int)((ofs - y * m->step)/sizeof(_Tp));
+        return Point(x, y);
+    }
+}
+
+
+template<typename _Tp> static inline
+bool operator == (const MatConstIterator_<_Tp>& a, const MatConstIterator_<_Tp>& b)
+{
+    return a.m == b.m && a.ptr == b.ptr;
+}
+
+template<typename _Tp> static inline
+bool operator != (const MatConstIterator_<_Tp>& a, const MatConstIterator_<_Tp>& b)
+{
+    return a.m != b.m || a.ptr != b.ptr;
+}
+
+template<typename _Tp> static inline
+MatConstIterator_<_Tp> operator + (const MatConstIterator_<_Tp>& a, ptrdiff_t ofs)
+{
+    MatConstIterator t = (const MatConstIterator&)a + ofs;
+    return (MatConstIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> static inline
+MatConstIterator_<_Tp> operator + (ptrdiff_t ofs, const MatConstIterator_<_Tp>& a)
+{
+    MatConstIterator t = (const MatConstIterator&)a + ofs;
+    return (MatConstIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> static inline
+MatConstIterator_<_Tp> operator - (const MatConstIterator_<_Tp>& a, ptrdiff_t ofs)
+{
+    MatConstIterator t = (const MatConstIterator&)a - ofs;
+    return (MatConstIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> inline
+_Tp MatConstIterator_<_Tp>::operator [](ptrdiff_t i) const
+{
+    return *(_Tp*)MatConstIterator::operator [](i);
+}
+
+
+
+//////////////////////////// MatIterator_ ///////////////////////////
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_()
+    : MatConstIterator_<_Tp>()
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m)
+    : MatConstIterator_<_Tp>(_m)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, int _row, int _col)
+    : MatConstIterator_<_Tp>(_m, _row, _col)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, Point _pt)
+    : MatConstIterator_<_Tp>(_m, _pt)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, const int* _idx)
+    : MatConstIterator_<_Tp>(_m, _idx)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(const MatIterator_& it)
+    : MatConstIterator_<_Tp>(it)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator = (const MatIterator_<_Tp>& it )
+{
+    MatConstIterator::operator = (it);
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp& MatIterator_<_Tp>::operator *() const
+{
+    return *(_Tp*)(this->ptr);
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator += (ptrdiff_t ofs)
+{
+    MatConstIterator::operator += (ofs);
+    return *this;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator -= (ptrdiff_t ofs)
+{
+    MatConstIterator::operator += (-ofs);
+    return *this;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator --()
+{
+    MatConstIterator::operator --();
+    return *this;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> MatIterator_<_Tp>::operator --(int)
+{
+    MatIterator_ b = *this;
+    MatConstIterator::operator --();
+    return b;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator ++()
+{
+    MatConstIterator::operator ++();
+    return *this;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> MatIterator_<_Tp>::operator ++(int)
+{
+    MatIterator_ b = *this;
+    MatConstIterator::operator ++();
+    return b;
+}
+
+template<typename _Tp> inline
+_Tp& MatIterator_<_Tp>::operator [](ptrdiff_t i) const
+{
+    return *(*this + i);
+}
+
+
+template<typename _Tp> static inline
+bool operator == (const MatIterator_<_Tp>& a, const MatIterator_<_Tp>& b)
+{
+    return a.m == b.m && a.ptr == b.ptr;
+}
+
+template<typename _Tp> static inline
+bool operator != (const MatIterator_<_Tp>& a, const MatIterator_<_Tp>& b)
+{
+    return a.m != b.m || a.ptr != b.ptr;
+}
+
+template<typename _Tp> static inline
+MatIterator_<_Tp> operator + (const MatIterator_<_Tp>& a, ptrdiff_t ofs)
+{
+    MatConstIterator t = (const MatConstIterator&)a + ofs;
+    return (MatIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> static inline
+MatIterator_<_Tp> operator + (ptrdiff_t ofs, const MatIterator_<_Tp>& a)
+{
+    MatConstIterator t = (const MatConstIterator&)a + ofs;
+    return (MatIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> static inline
+MatIterator_<_Tp> operator - (const MatIterator_<_Tp>& a, ptrdiff_t ofs)
+{
+    MatConstIterator t = (const MatConstIterator&)a - ofs;
+    return (MatIterator_<_Tp>&)t;
+}
+
+
+
+/////////////////////// SparseMatConstIterator //////////////////////
+
+inline
+SparseMatConstIterator::SparseMatConstIterator()
+    : m(0), hashidx(0), ptr(0)
+{}
+
+inline
+SparseMatConstIterator::SparseMatConstIterator(const SparseMatConstIterator& it)
+    : m(it.m), hashidx(it.hashidx), ptr(it.ptr)
+{}
+
+inline SparseMatConstIterator& SparseMatConstIterator::operator = (const SparseMatConstIterator& it)
+{
+    if( this != &it )
+    {
+        m = it.m;
+        hashidx = it.hashidx;
+        ptr = it.ptr;
+    }
+    return *this;
+}
+
+template<typename _Tp> inline
+const _Tp& SparseMatConstIterator::value() const
+{
+    return *(const _Tp*)ptr;
+}
+
+inline
+const SparseMat::Node* SparseMatConstIterator::node() const
+{
+    return (ptr && m && m->hdr) ? (const SparseMat::Node*)(const void*)(ptr - m->hdr->valueOffset) : 0;
+}
+
+inline
+SparseMatConstIterator SparseMatConstIterator::operator ++(int)
+{
+    SparseMatConstIterator it = *this;
+    ++*this;
+    return it;
+}
+
+inline
+void SparseMatConstIterator::seekEnd()
+{
+    if( m && m->hdr )
+    {
+        hashidx = m->hdr->hashtab.size();
+        ptr = 0;
+    }
+}
+
+
+static inline
+bool operator == (const SparseMatConstIterator& it1, const SparseMatConstIterator& it2)
+{
+    return it1.m == it2.m && it1.ptr == it2.ptr;
+}
+
+static inline
+bool operator != (const SparseMatConstIterator& it1, const SparseMatConstIterator& it2)
+{
+    return !(it1 == it2);
+}
+
+
+
+///////////////////////// SparseMatIterator /////////////////////////
+
+inline
+SparseMatIterator::SparseMatIterator()
+{}
+
+inline
+SparseMatIterator::SparseMatIterator(SparseMat* _m)
+    : SparseMatConstIterator(_m)
+{}
+
+inline
+SparseMatIterator::SparseMatIterator(const SparseMatIterator& it)
+    : SparseMatConstIterator(it)
+{}
+
+inline
+SparseMatIterator& SparseMatIterator::operator = (const SparseMatIterator& it)
+{
+    (SparseMatConstIterator&)*this = it;
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp& SparseMatIterator::value() const
+{
+    return *(_Tp*)ptr;
+}
+
+inline
+SparseMat::Node* SparseMatIterator::node() const
+{
+    return (SparseMat::Node*)SparseMatConstIterator::node();
+}
+
+inline
+SparseMatIterator& SparseMatIterator::operator ++()
+{
+    SparseMatConstIterator::operator ++();
+    return *this;
+}
+
+inline
+SparseMatIterator SparseMatIterator::operator ++(int)
+{
+    SparseMatIterator it = *this;
+    ++*this;
+    return it;
+}
+
+
+
+////////////////////// SparseMatConstIterator_ //////////////////////
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>::SparseMatConstIterator_()
+{}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMat_<_Tp>* _m)
+    : SparseMatConstIterator(_m)
+{}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMat* _m)
+    : SparseMatConstIterator(_m)
+{
+    CV_Assert( _m->type() == DataType<_Tp>::type );
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMatConstIterator_<_Tp>& it)
+    : SparseMatConstIterator(it)
+{}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>& SparseMatConstIterator_<_Tp>::operator = (const SparseMatConstIterator_<_Tp>& it)
+{
+    return reinterpret_cast<SparseMatConstIterator_<_Tp>&>
+         (*reinterpret_cast<SparseMatConstIterator*>(this) =
+           reinterpret_cast<const SparseMatConstIterator&>(it));
+}
+
+template<typename _Tp> inline
+const _Tp& SparseMatConstIterator_<_Tp>::operator *() const
+{
+    return *(const _Tp*)this->ptr;
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>& SparseMatConstIterator_<_Tp>::operator ++()
+{
+    SparseMatConstIterator::operator ++();
+    return *this;
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMatConstIterator_<_Tp>::operator ++(int)
+{
+    SparseMatConstIterator_<_Tp> it = *this;
+    SparseMatConstIterator::operator ++();
+    return it;
+}
+
+
+
+///////////////////////// SparseMatIterator_ ////////////////////////
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>::SparseMatIterator_()
+{}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat_<_Tp>* _m)
+    : SparseMatConstIterator_<_Tp>(_m)
+{}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat* _m)
+    : SparseMatConstIterator_<_Tp>(_m)
+{}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>::SparseMatIterator_(const SparseMatIterator_<_Tp>& it)
+    : SparseMatConstIterator_<_Tp>(it)
+{}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>& SparseMatIterator_<_Tp>::operator = (const SparseMatIterator_<_Tp>& it)
+{
+    return reinterpret_cast<SparseMatIterator_<_Tp>&>
+         (*reinterpret_cast<SparseMatConstIterator*>(this) =
+           reinterpret_cast<const SparseMatConstIterator&>(it));
+}
+
+template<typename _Tp> inline
+_Tp& SparseMatIterator_<_Tp>::operator *() const
+{
+    return *(_Tp*)this->ptr;
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>& SparseMatIterator_<_Tp>::operator ++()
+{
+    SparseMatConstIterator::operator ++();
+    return *this;
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMatIterator_<_Tp>::operator ++(int)
+{
+    SparseMatIterator_<_Tp> it = *this;
+    SparseMatConstIterator::operator ++();
+    return it;
+}
+
+
+
+//////////////////////// MatCommaInitializer_ ///////////////////////
+
+template<typename _Tp> inline
+MatCommaInitializer_<_Tp>::MatCommaInitializer_(Mat_<_Tp>* _m)
+    : it(_m)
+{}
+
+template<typename _Tp> template<typename T2> inline
+MatCommaInitializer_<_Tp>& MatCommaInitializer_<_Tp>::operator , (T2 v)
+{
+    CV_DbgAssert( this->it < ((const Mat_<_Tp>*)this->it.m)->end() );
+    *this->it = _Tp(v);
+    ++this->it;
+    return *this;
+}
+
+template<typename _Tp> inline
+MatCommaInitializer_<_Tp>::operator Mat_<_Tp>() const
+{
+    CV_DbgAssert( this->it == ((const Mat_<_Tp>*)this->it.m)->end() );
+    return Mat_<_Tp>(*this->it.m);
+}
+
+
+template<typename _Tp, typename T2> static inline
+MatCommaInitializer_<_Tp> operator << (const Mat_<_Tp>& m, T2 val)
+{
+    MatCommaInitializer_<_Tp> commaInitializer((Mat_<_Tp>*)&m);
+    return (commaInitializer, val);
+}
+
+
+
+///////////////////////// Matrix Expressions ////////////////////////
+
+inline
+Mat& Mat::operator = (const MatExpr& e)
+{
+    e.op->assign(e, *this);
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const MatExpr& e)
+{
+    e.op->assign(e, *this, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (const MatExpr& e)
+{
+    e.op->assign(e, *this, DataType<_Tp>::type);
+    return *this;
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::zeros(int rows, int cols)
+{
+    return Mat::zeros(rows, cols, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::zeros(Size sz)
+{
+    return Mat::zeros(sz, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::ones(int rows, int cols)
+{
+    return Mat::ones(rows, cols, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::ones(Size sz)
+{
+    return Mat::ones(sz, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::eye(int rows, int cols)
+{
+    return Mat::eye(rows, cols, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::eye(Size sz)
+{
+    return Mat::eye(sz, DataType<_Tp>::type);
+}
+
+inline
+MatExpr::MatExpr()
+    : op(0), flags(0), a(Mat()), b(Mat()), c(Mat()), alpha(0), beta(0), s()
+{}
+
+inline
+MatExpr::MatExpr(const MatOp* _op, int _flags, const Mat& _a, const Mat& _b,
+                 const Mat& _c, double _alpha, double _beta, const Scalar& _s)
+    : op(_op), flags(_flags), a(_a), b(_b), c(_c), alpha(_alpha), beta(_beta), s(_s)
+{}
+
+inline
+MatExpr::operator Mat() const
+{
+    Mat m;
+    op->assign(*this, m);
+    return m;
+}
+
+template<typename _Tp> inline
+MatExpr::operator Mat_<_Tp>() const
+{
+    Mat_<_Tp> m;
+    op->assign(*this, m, DataType<_Tp>::type);
+    return m;
+}
+
+
+template<typename _Tp> static inline
+MatExpr min(const Mat_<_Tp>& a, const Mat_<_Tp>& b)
+{
+    return cv::min((const Mat&)a, (const Mat&)b);
+}
+
+template<typename _Tp> static inline
+MatExpr min(const Mat_<_Tp>& a, double s)
+{
+    return cv::min((const Mat&)a, s);
+}
+
+template<typename _Tp> static inline
+MatExpr min(double s, const Mat_<_Tp>& a)
+{
+    return cv::min((const Mat&)a, s);
+}
+
+template<typename _Tp> static inline
+MatExpr max(const Mat_<_Tp>& a, const Mat_<_Tp>& b)
+{
+    return cv::max((const Mat&)a, (const Mat&)b);
+}
+
+template<typename _Tp> static inline
+MatExpr max(const Mat_<_Tp>& a, double s)
+{
+    return cv::max((const Mat&)a, s);
+}
+
+template<typename _Tp> static inline
+MatExpr max(double s, const Mat_<_Tp>& a)
+{
+    return cv::max((const Mat&)a, s);
+}
+
+template<typename _Tp> static inline
+MatExpr abs(const Mat_<_Tp>& m)
+{
+    return cv::abs((const Mat&)m);
+}
+
+
+static inline
+Mat& operator += (Mat& a, const MatExpr& b)
+{
+    b.op->augAssignAdd(b, a);
+    return a;
+}
+
+static inline
+const Mat& operator += (const Mat& a, const MatExpr& b)
+{
+    b.op->augAssignAdd(b, (Mat&)a);
+    return a;
+}
+
+template<typename _Tp> static inline
+Mat_<_Tp>& operator += (Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignAdd(b, a);
+    return a;
+}
+
+template<typename _Tp> static inline
+const Mat_<_Tp>& operator += (const Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignAdd(b, (Mat&)a);
+    return a;
+}
+
+static inline
+Mat& operator -= (Mat& a, const MatExpr& b)
+{
+    b.op->augAssignSubtract(b, a);
+    return a;
+}
+
+static inline
+const Mat& operator -= (const Mat& a, const MatExpr& b)
+{
+    b.op->augAssignSubtract(b, (Mat&)a);
+    return a;
+}
+
+template<typename _Tp> static inline
+Mat_<_Tp>& operator -= (Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignSubtract(b, a);
+    return a;
+}
+
+template<typename _Tp> static inline
+const Mat_<_Tp>& operator -= (const Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignSubtract(b, (Mat&)a);
+    return a;
+}
+
+static inline
+Mat& operator *= (Mat& a, const MatExpr& b)
+{
+    b.op->augAssignMultiply(b, a);
+    return a;
+}
+
+static inline
+const Mat& operator *= (const Mat& a, const MatExpr& b)
+{
+    b.op->augAssignMultiply(b, (Mat&)a);
+    return a;
+}
+
+template<typename _Tp> static inline
+Mat_<_Tp>& operator *= (Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignMultiply(b, a);
+    return a;
+}
+
+template<typename _Tp> static inline
+const Mat_<_Tp>& operator *= (const Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignMultiply(b, (Mat&)a);
+    return a;
+}
+
+static inline
+Mat& operator /= (Mat& a, const MatExpr& b)
+{
+    b.op->augAssignDivide(b, a);
+    return a;
+}
+
+static inline
+const Mat& operator /= (const Mat& a, const MatExpr& b)
+{
+    b.op->augAssignDivide(b, (Mat&)a);
+    return a;
+}
+
+template<typename _Tp> static inline
+Mat_<_Tp>& operator /= (Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignDivide(b, a);
+    return a;
+}
+
+template<typename _Tp> static inline
+const Mat_<_Tp>& operator /= (const Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignDivide(b, (Mat&)a);
+    return a;
+}
+
+
+//////////////////////////////// UMat ////////////////////////////////
+
+inline
+UMat::UMat(UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{}
+
+inline
+UMat::UMat(int _rows, int _cols, int _type, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_rows, _cols, _type);
+}
+
+inline
+UMat::UMat(int _rows, int _cols, int _type, const Scalar& _s, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_rows, _cols, _type);
+    *this = _s;
+}
+
+inline
+UMat::UMat(Size _sz, int _type, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create( _sz.height, _sz.width, _type );
+}
+
+inline
+UMat::UMat(Size _sz, int _type, const Scalar& _s, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_sz.height, _sz.width, _type);
+    *this = _s;
+}
+
+inline
+UMat::UMat(int _dims, const int* _sz, int _type, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_dims, _sz, _type);
+}
+
+inline
+UMat::UMat(int _dims, const int* _sz, int _type, const Scalar& _s, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_dims, _sz, _type);
+    *this = _s;
+}
+
+inline
+UMat::UMat(const UMat& m)
+: flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), allocator(m.allocator),
+  usageFlags(m.usageFlags), u(m.u), offset(m.offset), size(&rows)
+{
+    addref();
+    if( m.dims <= 2 )
+    {
+        step[0] = m.step[0]; step[1] = m.step[1];
+    }
+    else
+    {
+        dims = 0;
+        copySize(m);
+    }
+}
+
+
+template<typename _Tp> inline
+UMat::UMat(const std::vector<_Tp>& vec, bool copyData)
+: flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows((int)vec.size()),
+cols(1), allocator(0), usageFlags(USAGE_DEFAULT), u(0), offset(0), size(&rows)
+{
+    if(vec.empty())
+        return;
+    if( !copyData )
+    {
+        // !!!TODO!!!
+        CV_Error(Error::StsNotImplemented, "");
+    }
+    else
+        Mat((int)vec.size(), 1, DataType<_Tp>::type, (uchar*)&vec[0]).copyTo(*this);
+}
+
+
+inline
+UMat& UMat::operator = (const UMat& m)
+{
+    if( this != &m )
+    {
+        const_cast<UMat&>(m).addref();
+        release();
+        flags = m.flags;
+        if( dims <= 2 && m.dims <= 2 )
+        {
+            dims = m.dims;
+            rows = m.rows;
+            cols = m.cols;
+            step[0] = m.step[0];
+            step[1] = m.step[1];
+        }
+        else
+            copySize(m);
+        allocator = m.allocator;
+        if (usageFlags == USAGE_DEFAULT)
+            usageFlags = m.usageFlags;
+        u = m.u;
+        offset = m.offset;
+    }
+    return *this;
+}
+
+inline
+UMat UMat::row(int y) const
+{
+    return UMat(*this, Range(y, y + 1), Range::all());
+}
+
+inline
+UMat UMat::col(int x) const
+{
+    return UMat(*this, Range::all(), Range(x, x + 1));
+}
+
+inline
+UMat UMat::rowRange(int startrow, int endrow) const
+{
+    return UMat(*this, Range(startrow, endrow), Range::all());
+}
+
+inline
+UMat UMat::rowRange(const Range& r) const
+{
+    return UMat(*this, r, Range::all());
+}
+
+inline
+UMat UMat::colRange(int startcol, int endcol) const
+{
+    return UMat(*this, Range::all(), Range(startcol, endcol));
+}
+
+inline
+UMat UMat::colRange(const Range& r) const
+{
+    return UMat(*this, Range::all(), r);
+}
+
+inline
+UMat UMat::clone() const
+{
+    UMat m;
+    copyTo(m);
+    return m;
+}
+
+inline
+void UMat::assignTo( UMat& m, int _type ) const
+{
+    if( _type < 0 )
+        m = *this;
+    else
+        convertTo(m, _type);
+}
+
+inline
+void UMat::create(int _rows, int _cols, int _type, UMatUsageFlags _usageFlags)
+{
+    _type &= TYPE_MASK;
+    if( dims <= 2 && rows == _rows && cols == _cols && type() == _type && u )
+        return;
+    int sz[] = {_rows, _cols};
+    create(2, sz, _type, _usageFlags);
+}
+
+inline
+void UMat::create(Size _sz, int _type, UMatUsageFlags _usageFlags)
+{
+    create(_sz.height, _sz.width, _type, _usageFlags);
+}
+
+inline
+void UMat::addref()
+{
+    if( u )
+        CV_XADD(&(u->urefcount), 1);
+}
+
+inline void UMat::release()
+{
+    if( u && CV_XADD(&(u->urefcount), -1) == 1 )
+        deallocate();
+    for(int i = 0; i < dims; i++)
+        size.p[i] = 0;
+    u = 0;
+}
+
+inline
+UMat UMat::operator()( Range _rowRange, Range _colRange ) const
+{
+    return UMat(*this, _rowRange, _colRange);
+}
+
+inline
+UMat UMat::operator()( const Rect& roi ) const
+{
+    return UMat(*this, roi);
+}
+
+inline
+UMat UMat::operator()(const Range* ranges) const
+{
+    return UMat(*this, ranges);
+}
+
+inline
+bool UMat::isContinuous() const
+{
+    return (flags & CONTINUOUS_FLAG) != 0;
+}
+
+inline
+bool UMat::isSubmatrix() const
+{
+    return (flags & SUBMATRIX_FLAG) != 0;
+}
+
+inline
+size_t UMat::elemSize() const
+{
+    return dims > 0 ? step.p[dims - 1] : 0;
+}
+
+inline
+size_t UMat::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int UMat::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int UMat::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int UMat::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+size_t UMat::step1(int i) const
+{
+    return step.p[i] / elemSize1();
+}
+
+inline
+bool UMat::empty() const
+{
+    return u == 0 || total() == 0;
+}
+
+inline
+size_t UMat::total() const
+{
+    if( dims <= 2 )
+        return (size_t)rows * cols;
+    size_t p = 1;
+    for( int i = 0; i < dims; i++ )
+        p *= size[i];
+    return p;
+}
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+
+inline
+UMat::UMat(UMat&& m)
+: flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), allocator(m.allocator),
+  usageFlags(m.usageFlags), u(m.u), offset(m.offset), size(&rows)
+{
+    if (m.dims <= 2)  // move new step/size info
+    {
+        step[0] = m.step[0];
+        step[1] = m.step[1];
+    }
+    else
+    {
+        CV_DbgAssert(m.step.p != m.step.buf);
+        step.p = m.step.p;
+        size.p = m.size.p;
+        m.step.p = m.step.buf;
+        m.size.p = &m.rows;
+    }
+    m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0;
+    m.allocator = NULL;
+    m.u = NULL;
+    m.offset = 0;
+}
+
+inline
+UMat& UMat::operator = (UMat&& m)
+{
+    release();
+    flags = m.flags; dims = m.dims; rows = m.rows; cols = m.cols;
+    allocator = m.allocator; usageFlags = m.usageFlags;
+    u = m.u;
+    offset = m.offset;
+    if (step.p != step.buf) // release self step/size
+    {
+        fastFree(step.p);
+        step.p = step.buf;
+        size.p = &rows;
+    }
+    if (m.dims <= 2) // move new step/size info
+    {
+        step[0] = m.step[0];
+        step[1] = m.step[1];
+    }
+    else
+    {
+        CV_DbgAssert(m.step.p != m.step.buf);
+        step.p = m.step.p;
+        size.p = m.size.p;
+        m.step.p = m.step.buf;
+        m.size.p = &m.rows;
+    }
+    m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0;
+    m.allocator = NULL;
+    m.u = NULL;
+    m.offset = 0;
+    return *this;
+}
+
+#endif
+
+
+inline bool UMatData::hostCopyObsolete() const { return (flags & HOST_COPY_OBSOLETE) != 0; }
+inline bool UMatData::deviceCopyObsolete() const { return (flags & DEVICE_COPY_OBSOLETE) != 0; }
+inline bool UMatData::deviceMemMapped() const { return (flags & DEVICE_MEM_MAPPED) != 0; }
+inline bool UMatData::copyOnMap() const { return (flags & COPY_ON_MAP) != 0; }
+inline bool UMatData::tempUMat() const { return (flags & TEMP_UMAT) != 0; }
+inline bool UMatData::tempCopiedUMat() const { return (flags & TEMP_COPIED_UMAT) == TEMP_COPIED_UMAT; }
+
+inline void UMatData::markDeviceMemMapped(bool flag)
+{
+  if(flag)
+    flags |= DEVICE_MEM_MAPPED;
+  else
+    flags &= ~DEVICE_MEM_MAPPED;
+}
+
+inline void UMatData::markHostCopyObsolete(bool flag)
+{
+    if(flag)
+        flags |= HOST_COPY_OBSOLETE;
+    else
+        flags &= ~HOST_COPY_OBSOLETE;
+}
+inline void UMatData::markDeviceCopyObsolete(bool flag)
+{
+    if(flag)
+        flags |= DEVICE_COPY_OBSOLETE;
+    else
+        flags &= ~DEVICE_COPY_OBSOLETE;
+}
+
+inline UMatDataAutoLock::UMatDataAutoLock(UMatData* _u) : u(_u) { u->lock(); }
+inline UMatDataAutoLock::~UMatDataAutoLock() { u->unlock(); }
+
+//! @endcond
+
+} //cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp
new file mode 100644
index 0000000..ca5f261
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp
@@ -0,0 +1,1407 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_MATX_HPP__
+#define __OPENCV_CORE_MATX_HPP__
+
+#ifndef __cplusplus
+#  error matx.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/base.hpp"
+#include "opencv2/core/traits.hpp"
+#include "opencv2/core/saturate.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_basic
+//! @{
+
+////////////////////////////// Small Matrix ///////////////////////////
+
+//! @cond IGNORED
+struct CV_EXPORTS Matx_AddOp {};
+struct CV_EXPORTS Matx_SubOp {};
+struct CV_EXPORTS Matx_ScaleOp {};
+struct CV_EXPORTS Matx_MulOp {};
+struct CV_EXPORTS Matx_DivOp {};
+struct CV_EXPORTS Matx_MatMulOp {};
+struct CV_EXPORTS Matx_TOp {};
+//! @endcond
+
+/** @brief Template class for small matrices whose type and size are known at compilation time
+
+If you need a more flexible type, use Mat . The elements of the matrix M are accessible using the
+M(i,j) notation. Most of the common matrix operations (see also @ref MatrixExpressions ) are
+available. To do an operation on Matx that is not implemented, you can easily convert the matrix to
+Mat and backwards:
+@code
+    Matx33f m(1, 2, 3,
+              4, 5, 6,
+              7, 8, 9);
+    cout << sum(Mat(m*m.t())) << endl;
+ @endcode
+ */
+template<typename _Tp, int m, int n> class Matx
+{
+public:
+    enum { depth    = DataType<_Tp>::depth,
+           rows     = m,
+           cols     = n,
+           channels = rows*cols,
+           type     = CV_MAKETYPE(depth, channels),
+           shortdim = (m < n ? m : n)
+         };
+
+    typedef _Tp                           value_type;
+    typedef Matx<_Tp, m, n>               mat_type;
+    typedef Matx<_Tp, shortdim, 1> diag_type;
+
+    //! default constructor
+    Matx();
+
+    Matx(_Tp v0); //!< 1x1 matrix
+    Matx(_Tp v0, _Tp v1); //!< 1x2 or 2x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2); //!< 1x3 or 3x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3); //!< 1x4, 2x2 or 4x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4); //!< 1x5 or 5x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5); //!< 1x6, 2x3, 3x2 or 6x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6); //!< 1x7 or 7x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7); //!< 1x8, 2x4, 4x2 or 8x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8); //!< 1x9, 3x3 or 9x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9); //!< 1x10, 2x5 or 5x2 or 10x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
+         _Tp v4, _Tp v5, _Tp v6, _Tp v7,
+         _Tp v8, _Tp v9, _Tp v10, _Tp v11); //!< 1x12, 2x6, 3x4, 4x3, 6x2 or 12x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
+         _Tp v4, _Tp v5, _Tp v6, _Tp v7,
+         _Tp v8, _Tp v9, _Tp v10, _Tp v11,
+         _Tp v12, _Tp v13); //!< 1x14, 2x7, 7x2 or 14x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
+         _Tp v4, _Tp v5, _Tp v6, _Tp v7,
+         _Tp v8, _Tp v9, _Tp v10, _Tp v11,
+         _Tp v12, _Tp v13, _Tp v14, _Tp v15); //!< 1x16, 4x4 or 16x1 matrix
+    explicit Matx(const _Tp* vals); //!< initialize from a plain array
+
+    static Matx all(_Tp alpha);
+    static Matx zeros();
+    static Matx ones();
+    static Matx eye();
+    static Matx diag(const diag_type& d);
+    static Matx randu(_Tp a, _Tp b);
+    static Matx randn(_Tp a, _Tp b);
+
+    //! dot product computed with the default precision
+    _Tp dot(const Matx<_Tp, m, n>& v) const;
+
+    //! dot product computed in double-precision arithmetics
+    double ddot(const Matx<_Tp, m, n>& v) const;
+
+    //! conversion to another data type
+    template<typename T2> operator Matx<T2, m, n>() const;
+
+    //! change the matrix shape
+    template<int m1, int n1> Matx<_Tp, m1, n1> reshape() const;
+
+    //! extract part of the matrix
+    template<int m1, int n1> Matx<_Tp, m1, n1> get_minor(int i, int j) const;
+
+    //! extract the matrix row
+    Matx<_Tp, 1, n> row(int i) const;
+
+    //! extract the matrix column
+    Matx<_Tp, m, 1> col(int i) const;
+
+    //! extract the matrix diagonal
+    diag_type diag() const;
+
+    //! transpose the matrix
+    Matx<_Tp, n, m> t() const;
+
+    //! invert the matrix
+    Matx<_Tp, n, m> inv(int method=DECOMP_LU, bool *p_is_ok = NULL) const;
+
+    //! solve linear system
+    template<int l> Matx<_Tp, n, l> solve(const Matx<_Tp, m, l>& rhs, int flags=DECOMP_LU) const;
+    Vec<_Tp, n> solve(const Vec<_Tp, m>& rhs, int method) const;
+
+    //! multiply two matrices element-wise
+    Matx<_Tp, m, n> mul(const Matx<_Tp, m, n>& a) const;
+
+    //! divide two matrices element-wise
+    Matx<_Tp, m, n> div(const Matx<_Tp, m, n>& a) const;
+
+    //! element access
+    const _Tp& operator ()(int i, int j) const;
+    _Tp& operator ()(int i, int j);
+
+    //! 1D element access
+    const _Tp& operator ()(int i) const;
+    _Tp& operator ()(int i);
+
+    Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_AddOp);
+    Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_SubOp);
+    template<typename _T2> Matx(const Matx<_Tp, m, n>& a, _T2 alpha, Matx_ScaleOp);
+    Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_MulOp);
+    Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_DivOp);
+    template<int l> Matx(const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b, Matx_MatMulOp);
+    Matx(const Matx<_Tp, n, m>& a, Matx_TOp);
+
+    _Tp val[m*n]; //< matrix elements
+};
+
+typedef Matx<float, 1, 2> Matx12f;
+typedef Matx<double, 1, 2> Matx12d;
+typedef Matx<float, 1, 3> Matx13f;
+typedef Matx<double, 1, 3> Matx13d;
+typedef Matx<float, 1, 4> Matx14f;
+typedef Matx<double, 1, 4> Matx14d;
+typedef Matx<float, 1, 6> Matx16f;
+typedef Matx<double, 1, 6> Matx16d;
+
+typedef Matx<float, 2, 1> Matx21f;
+typedef Matx<double, 2, 1> Matx21d;
+typedef Matx<float, 3, 1> Matx31f;
+typedef Matx<double, 3, 1> Matx31d;
+typedef Matx<float, 4, 1> Matx41f;
+typedef Matx<double, 4, 1> Matx41d;
+typedef Matx<float, 6, 1> Matx61f;
+typedef Matx<double, 6, 1> Matx61d;
+
+typedef Matx<float, 2, 2> Matx22f;
+typedef Matx<double, 2, 2> Matx22d;
+typedef Matx<float, 2, 3> Matx23f;
+typedef Matx<double, 2, 3> Matx23d;
+typedef Matx<float, 3, 2> Matx32f;
+typedef Matx<double, 3, 2> Matx32d;
+
+typedef Matx<float, 3, 3> Matx33f;
+typedef Matx<double, 3, 3> Matx33d;
+
+typedef Matx<float, 3, 4> Matx34f;
+typedef Matx<double, 3, 4> Matx34d;
+typedef Matx<float, 4, 3> Matx43f;
+typedef Matx<double, 4, 3> Matx43d;
+
+typedef Matx<float, 4, 4> Matx44f;
+typedef Matx<double, 4, 4> Matx44d;
+typedef Matx<float, 6, 6> Matx66f;
+typedef Matx<double, 6, 6> Matx66d;
+
+/*!
+  traits
+*/
+template<typename _Tp, int m, int n> class DataType< Matx<_Tp, m, n> >
+{
+public:
+    typedef Matx<_Tp, m, n>                               value_type;
+    typedef Matx<typename DataType<_Tp>::work_type, m, n> work_type;
+    typedef _Tp                                           channel_type;
+    typedef value_type                                    vec_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = m * n,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+/** @brief  Comma-separated Matrix Initializer
+*/
+template<typename _Tp, int m, int n> class MatxCommaInitializer
+{
+public:
+    MatxCommaInitializer(Matx<_Tp, m, n>* _mtx);
+    template<typename T2> MatxCommaInitializer<_Tp, m, n>& operator , (T2 val);
+    Matx<_Tp, m, n> operator *() const;
+
+    Matx<_Tp, m, n>* dst;
+    int idx;
+};
+
+/*
+ Utility methods
+*/
+template<typename _Tp, int m> static double determinant(const Matx<_Tp, m, m>& a);
+template<typename _Tp, int m, int n> static double trace(const Matx<_Tp, m, n>& a);
+template<typename _Tp, int m, int n> static double norm(const Matx<_Tp, m, n>& M);
+template<typename _Tp, int m, int n> static double norm(const Matx<_Tp, m, n>& M, int normType);
+
+
+
+/////////////////////// Vec (used as element of multi-channel images /////////////////////
+
+/** @brief Template class for short numerical vectors, a partial case of Matx
+
+This template class represents short numerical vectors (of 1, 2, 3, 4 ... elements) on which you
+can perform basic arithmetical operations, access individual elements using [] operator etc. The
+vectors are allocated on stack, as opposite to std::valarray, std::vector, cv::Mat etc., which
+elements are dynamically allocated in the heap.
+
+The template takes 2 parameters:
+@tparam _Tp element type
+@tparam cn the number of elements
+
+In addition to the universal notation like Vec<float, 3>, you can use shorter aliases
+for the most popular specialized variants of Vec, e.g. Vec3f ~ Vec<float, 3>.
+
+It is possible to convert Vec\<T,2\> to/from Point_, Vec\<T,3\> to/from Point3_ , and Vec\<T,4\>
+to CvScalar or Scalar_. Use operator[] to access the elements of Vec.
+
+All the expected vector operations are also implemented:
+-   v1 = v2 + v3
+-   v1 = v2 - v3
+-   v1 = v2 \* scale
+-   v1 = scale \* v2
+-   v1 = -v2
+-   v1 += v2 and other augmenting operations
+-   v1 == v2, v1 != v2
+-   norm(v1) (euclidean norm)
+The Vec class is commonly used to describe pixel types of multi-channel arrays. See Mat for details.
+*/
+template<typename _Tp, int cn> class Vec : public Matx<_Tp, cn, 1>
+{
+public:
+    typedef _Tp value_type;
+    enum { depth    = Matx<_Tp, cn, 1>::depth,
+           channels = cn,
+           type     = CV_MAKETYPE(depth, channels)
+         };
+
+    //! default constructor
+    Vec();
+
+    Vec(_Tp v0); //!< 1-element vector constructor
+    Vec(_Tp v0, _Tp v1); //!< 2-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2); //!< 3-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3); //!< 4-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4); //!< 5-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5); //!< 6-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6); //!< 7-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7); //!< 8-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8); //!< 9-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9); //!< 10-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13); //!< 14-element vector constructor
+    explicit Vec(const _Tp* values);
+
+    Vec(const Vec<_Tp, cn>& v);
+
+    static Vec all(_Tp alpha);
+
+    //! per-element multiplication
+    Vec mul(const Vec<_Tp, cn>& v) const;
+
+    //! conjugation (makes sense for complex numbers and quaternions)
+    Vec conj() const;
+
+    /*!
+      cross product of the two 3D vectors.
+
+      For other dimensionalities the exception is raised
+    */
+    Vec cross(const Vec& v) const;
+    //! conversion to another data type
+    template<typename T2> operator Vec<T2, cn>() const;
+
+    /*! element access */
+    const _Tp& operator [](int i) const;
+    _Tp& operator[](int i);
+    const _Tp& operator ()(int i) const;
+    _Tp& operator ()(int i);
+
+    Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_AddOp);
+    Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_SubOp);
+    template<typename _T2> Vec(const Matx<_Tp, cn, 1>& a, _T2 alpha, Matx_ScaleOp);
+};
+
+/** @name Shorter aliases for the most popular specializations of Vec<T,n>
+  @{
+*/
+typedef Vec<uchar, 2> Vec2b;
+typedef Vec<uchar, 3> Vec3b;
+typedef Vec<uchar, 4> Vec4b;
+
+typedef Vec<short, 2> Vec2s;
+typedef Vec<short, 3> Vec3s;
+typedef Vec<short, 4> Vec4s;
+
+typedef Vec<ushort, 2> Vec2w;
+typedef Vec<ushort, 3> Vec3w;
+typedef Vec<ushort, 4> Vec4w;
+
+typedef Vec<int, 2> Vec2i;
+typedef Vec<int, 3> Vec3i;
+typedef Vec<int, 4> Vec4i;
+typedef Vec<int, 6> Vec6i;
+typedef Vec<int, 8> Vec8i;
+
+typedef Vec<float, 2> Vec2f;
+typedef Vec<float, 3> Vec3f;
+typedef Vec<float, 4> Vec4f;
+typedef Vec<float, 6> Vec6f;
+
+typedef Vec<double, 2> Vec2d;
+typedef Vec<double, 3> Vec3d;
+typedef Vec<double, 4> Vec4d;
+typedef Vec<double, 6> Vec6d;
+/** @} */
+
+/*!
+  traits
+*/
+template<typename _Tp, int cn> class DataType< Vec<_Tp, cn> >
+{
+public:
+    typedef Vec<_Tp, cn>                               value_type;
+    typedef Vec<typename DataType<_Tp>::work_type, cn> work_type;
+    typedef _Tp                                        channel_type;
+    typedef value_type                                 vec_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = cn,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+/** @brief  Comma-separated Vec Initializer
+*/
+template<typename _Tp, int m> class VecCommaInitializer : public MatxCommaInitializer<_Tp, m, 1>
+{
+public:
+    VecCommaInitializer(Vec<_Tp, m>* _vec);
+    template<typename T2> VecCommaInitializer<_Tp, m>& operator , (T2 val);
+    Vec<_Tp, m> operator *() const;
+};
+
+template<typename _Tp, int cn> static Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v);
+
+//! @} core_basic
+
+//! @cond IGNORED
+
+///////////////////////////////////// helper classes /////////////////////////////////////
+namespace internal
+{
+
+template<typename _Tp, int m> struct Matx_DetOp
+{
+    double operator ()(const Matx<_Tp, m, m>& a) const
+    {
+        Matx<_Tp, m, m> temp = a;
+        double p = LU(temp.val, m*sizeof(_Tp), m, 0, 0, 0);
+        if( p == 0 )
+            return p;
+        for( int i = 0; i < m; i++ )
+            p *= temp(i, i);
+        return 1./p;
+    }
+};
+
+template<typename _Tp> struct Matx_DetOp<_Tp, 1>
+{
+    double operator ()(const Matx<_Tp, 1, 1>& a) const
+    {
+        return a(0,0);
+    }
+};
+
+template<typename _Tp> struct Matx_DetOp<_Tp, 2>
+{
+    double operator ()(const Matx<_Tp, 2, 2>& a) const
+    {
+        return a(0,0)*a(1,1) - a(0,1)*a(1,0);
+    }
+};
+
+template<typename _Tp> struct Matx_DetOp<_Tp, 3>
+{
+    double operator ()(const Matx<_Tp, 3, 3>& a) const
+    {
+        return a(0,0)*(a(1,1)*a(2,2) - a(2,1)*a(1,2)) -
+            a(0,1)*(a(1,0)*a(2,2) - a(2,0)*a(1,2)) +
+            a(0,2)*(a(1,0)*a(2,1) - a(2,0)*a(1,1));
+    }
+};
+
+template<typename _Tp> Vec<_Tp, 2> inline conjugate(const Vec<_Tp, 2>& v)
+{
+    return Vec<_Tp, 2>(v[0], -v[1]);
+}
+
+template<typename _Tp> Vec<_Tp, 4> inline conjugate(const Vec<_Tp, 4>& v)
+{
+    return Vec<_Tp, 4>(v[0], -v[1], -v[2], -v[3]);
+}
+
+} // internal
+
+
+
+////////////////////////////////// Matx Implementation ///////////////////////////////////
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx()
+{
+    for(int i = 0; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0)
+{
+    val[0] = v0;
+    for(int i = 1; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1)
+{
+    CV_StaticAssert(channels >= 2, "Matx should have at least 2 elements.");
+    val[0] = v0; val[1] = v1;
+    for(int i = 2; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2)
+{
+    CV_StaticAssert(channels >= 3, "Matx should have at least 3 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2;
+    for(int i = 3; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3)
+{
+    CV_StaticAssert(channels >= 4, "Matx should have at least 4 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    for(int i = 4; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4)
+{
+    CV_StaticAssert(channels >= 5, "Matx should have at least 5 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; val[4] = v4;
+    for(int i = 5; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5)
+{
+    CV_StaticAssert(channels >= 6, "Matx should have at least 6 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5;
+    for(int i = 6; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6)
+{
+    CV_StaticAssert(channels >= 7, "Matx should have at least 7 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6;
+    for(int i = 7; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7)
+{
+    CV_StaticAssert(channels >= 8, "Matx should have at least 8 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    for(int i = 8; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8)
+{
+    CV_StaticAssert(channels >= 9, "Matx should have at least 9 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8;
+    for(int i = 9; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9)
+{
+    CV_StaticAssert(channels >= 10, "Matx should have at least 10 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8; val[9] = v9;
+    for(int i = 10; i < channels; i++) val[i] = _Tp(0);
+}
+
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11)
+{
+    CV_StaticAssert(channels >= 12, "Matx should have at least 12 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
+    for(int i = 12; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13)
+{
+    CV_StaticAssert(channels == 14, "Matx should have at least 14 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
+    val[12] = v12; val[13] = v13;
+}
+
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13, _Tp v14, _Tp v15)
+{
+    CV_StaticAssert(channels >= 16, "Matx should have at least 16 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
+    val[12] = v12; val[13] = v13; val[14] = v14; val[15] = v15;
+    for(int i = 16; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(const _Tp* values)
+{
+    for( int i = 0; i < channels; i++ ) val[i] = values[i];
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n> Matx<_Tp, m, n>::all(_Tp alpha)
+{
+    Matx<_Tp, m, n> M;
+    for( int i = 0; i < m*n; i++ ) M.val[i] = alpha;
+    return M;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::zeros()
+{
+    return all(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::ones()
+{
+    return all(1);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::eye()
+{
+    Matx<_Tp,m,n> M;
+    for(int i = 0; i < shortdim; i++)
+        M(i,i) = 1;
+    return M;
+}
+
+template<typename _Tp, int m, int n> inline
+_Tp Matx<_Tp, m, n>::dot(const Matx<_Tp, m, n>& M) const
+{
+    _Tp s = 0;
+    for( int i = 0; i < channels; i++ ) s += val[i]*M.val[i];
+    return s;
+}
+
+template<typename _Tp, int m, int n> inline
+double Matx<_Tp, m, n>::ddot(const Matx<_Tp, m, n>& M) const
+{
+    double s = 0;
+    for( int i = 0; i < channels; i++ ) s += (double)val[i]*M.val[i];
+    return s;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const typename Matx<_Tp,m,n>::diag_type& d)
+{
+    Matx<_Tp,m,n> M;
+    for(int i = 0; i < shortdim; i++)
+        M(i,i) = d(i, 0);
+    return M;
+}
+
+template<typename _Tp, int m, int n> template<typename T2>
+inline Matx<_Tp, m, n>::operator Matx<T2, m, n>() const
+{
+    Matx<T2, m, n> M;
+    for( int i = 0; i < m*n; i++ ) M.val[i] = saturate_cast<T2>(val[i]);
+    return M;
+}
+
+template<typename _Tp, int m, int n> template<int m1, int n1> inline
+Matx<_Tp, m1, n1> Matx<_Tp, m, n>::reshape() const
+{
+    CV_StaticAssert(m1*n1 == m*n, "Input and destnarion matrices must have the same number of elements");
+    return (const Matx<_Tp, m1, n1>&)*this;
+}
+
+template<typename _Tp, int m, int n>
+template<int m1, int n1> inline
+Matx<_Tp, m1, n1> Matx<_Tp, m, n>::get_minor(int i, int j) const
+{
+    CV_DbgAssert(0 <= i && i+m1 <= m && 0 <= j && j+n1 <= n);
+    Matx<_Tp, m1, n1> s;
+    for( int di = 0; di < m1; di++ )
+        for( int dj = 0; dj < n1; dj++ )
+            s(di, dj) = (*this)(i+di, j+dj);
+    return s;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, 1, n> Matx<_Tp, m, n>::row(int i) const
+{
+    CV_DbgAssert((unsigned)i < (unsigned)m);
+    return Matx<_Tp, 1, n>(&val[i*n]);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, 1> Matx<_Tp, m, n>::col(int j) const
+{
+    CV_DbgAssert((unsigned)j < (unsigned)n);
+    Matx<_Tp, m, 1> v;
+    for( int i = 0; i < m; i++ )
+        v.val[i] = val[i*n + j];
+    return v;
+}
+
+template<typename _Tp, int m, int n> inline
+typename Matx<_Tp, m, n>::diag_type Matx<_Tp, m, n>::diag() const
+{
+    diag_type d;
+    for( int i = 0; i < shortdim; i++ )
+        d.val[i] = val[i*n + i];
+    return d;
+}
+
+template<typename _Tp, int m, int n> inline
+const _Tp& Matx<_Tp, m, n>::operator()(int i, int j) const
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)m && (unsigned)j < (unsigned)n );
+    return this->val[i*n + j];
+}
+
+template<typename _Tp, int m, int n> inline
+_Tp& Matx<_Tp, m, n>::operator ()(int i, int j)
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)m && (unsigned)j < (unsigned)n );
+    return val[i*n + j];
+}
+
+template<typename _Tp, int m, int n> inline
+const _Tp& Matx<_Tp, m, n>::operator ()(int i) const
+{
+    CV_StaticAssert(m == 1 || n == 1, "Single index indexation requires matrix to be a column or a row");
+    CV_DbgAssert( (unsigned)i < (unsigned)(m+n-1) );
+    return val[i];
+}
+
+template<typename _Tp, int m, int n> inline
+_Tp& Matx<_Tp, m, n>::operator ()(int i)
+{
+    CV_StaticAssert(m == 1 || n == 1, "Single index indexation requires matrix to be a column or a row");
+    CV_DbgAssert( (unsigned)i < (unsigned)(m+n-1) );
+    return val[i];
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_AddOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] + b.val[i]);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_SubOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] - b.val[i]);
+}
+
+template<typename _Tp, int m, int n> template<typename _T2> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, _T2 alpha, Matx_ScaleOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] * alpha);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_MulOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] * b.val[i]);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_DivOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] / b.val[i]);
+}
+
+template<typename _Tp, int m, int n> template<int l> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b, Matx_MatMulOp)
+{
+    for( int i = 0; i < m; i++ )
+        for( int j = 0; j < n; j++ )
+        {
+            _Tp s = 0;
+            for( int k = 0; k < l; k++ )
+                s += a(i, k) * b(k, j);
+            val[i*n + j] = s;
+        }
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, n, m>& a, Matx_TOp)
+{
+    for( int i = 0; i < m; i++ )
+        for( int j = 0; j < n; j++ )
+            val[i*n + j] = a(j, i);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n> Matx<_Tp, m, n>::mul(const Matx<_Tp, m, n>& a) const
+{
+    return Matx<_Tp, m, n>(*this, a, Matx_MulOp());
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n> Matx<_Tp, m, n>::div(const Matx<_Tp, m, n>& a) const
+{
+    return Matx<_Tp, m, n>(*this, a, Matx_DivOp());
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, n, m> Matx<_Tp, m, n>::t() const
+{
+    return Matx<_Tp, n, m>(*this, Matx_TOp());
+}
+
+template<typename _Tp, int m, int n> inline
+Vec<_Tp, n> Matx<_Tp, m, n>::solve(const Vec<_Tp, m>& rhs, int method) const
+{
+    Matx<_Tp, n, 1> x = solve((const Matx<_Tp, m, 1>&)(rhs), method);
+    return (Vec<_Tp, n>&)(x);
+}
+
+template<typename _Tp, int m> static inline
+double determinant(const Matx<_Tp, m, m>& a)
+{
+    return cv::internal::Matx_DetOp<_Tp, m>()(a);
+}
+
+template<typename _Tp, int m, int n> static inline
+double trace(const Matx<_Tp, m, n>& a)
+{
+    _Tp s = 0;
+    for( int i = 0; i < std::min(m, n); i++ )
+        s += a(i,i);
+    return s;
+}
+
+template<typename _Tp, int m, int n> static inline
+double norm(const Matx<_Tp, m, n>& M)
+{
+    return std::sqrt(normL2Sqr<_Tp, double>(M.val, m*n));
+}
+
+template<typename _Tp, int m, int n> static inline
+double norm(const Matx<_Tp, m, n>& M, int normType)
+{
+    switch(normType) {
+    case NORM_INF:
+        return (double)normInf<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
+    case NORM_L1:
+        return (double)normL1<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
+    case NORM_L2SQR:
+        return (double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
+    default:
+    case NORM_L2:
+        return std::sqrt((double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n));
+    }
+}
+
+
+
+//////////////////////////////// matx comma initializer //////////////////////////////////
+
+template<typename _Tp, typename _T2, int m, int n> static inline
+MatxCommaInitializer<_Tp, m, n> operator << (const Matx<_Tp, m, n>& mtx, _T2 val)
+{
+    MatxCommaInitializer<_Tp, m, n> commaInitializer((Matx<_Tp, m, n>*)&mtx);
+    return (commaInitializer, val);
+}
+
+template<typename _Tp, int m, int n> inline
+MatxCommaInitializer<_Tp, m, n>::MatxCommaInitializer(Matx<_Tp, m, n>* _mtx)
+    : dst(_mtx), idx(0)
+{}
+
+template<typename _Tp, int m, int n> template<typename _T2> inline
+MatxCommaInitializer<_Tp, m, n>& MatxCommaInitializer<_Tp, m, n>::operator , (_T2 value)
+{
+    CV_DbgAssert( idx < m*n );
+    dst->val[idx++] = saturate_cast<_Tp>(value);
+    return *this;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n> MatxCommaInitializer<_Tp, m, n>::operator *() const
+{
+    CV_DbgAssert( idx == n*m );
+    return *dst;
+}
+
+
+
+/////////////////////////////////// Vec Implementation ///////////////////////////////////
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec() {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0)
+    : Matx<_Tp, cn, 1>(v0) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1)
+    : Matx<_Tp, cn, 1>(v0, v1) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2)
+    : Matx<_Tp, cn, 1>(v0, v1, v2) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(const _Tp* values)
+    : Matx<_Tp, cn, 1>(values) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(const Vec<_Tp, cn>& m)
+    : Matx<_Tp, cn, 1>(m.val) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_AddOp op)
+    : Matx<_Tp, cn, 1>(a, b, op) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_SubOp op)
+    : Matx<_Tp, cn, 1>(a, b, op) {}
+
+template<typename _Tp, int cn> template<typename _T2> inline
+Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, _T2 alpha, Matx_ScaleOp op)
+    : Matx<_Tp, cn, 1>(a, alpha, op) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> Vec<_Tp, cn>::all(_Tp alpha)
+{
+    Vec v;
+    for( int i = 0; i < cn; i++ ) v.val[i] = alpha;
+    return v;
+}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> Vec<_Tp, cn>::mul(const Vec<_Tp, cn>& v) const
+{
+    Vec<_Tp, cn> w;
+    for( int i = 0; i < cn; i++ ) w.val[i] = saturate_cast<_Tp>(this->val[i]*v.val[i]);
+    return w;
+}
+
+template<> inline
+Vec<float, 2> Vec<float, 2>::conj() const
+{
+    return cv::internal::conjugate(*this);
+}
+
+template<> inline
+Vec<double, 2> Vec<double, 2>::conj() const
+{
+    return cv::internal::conjugate(*this);
+}
+
+template<> inline
+Vec<float, 4> Vec<float, 4>::conj() const
+{
+    return cv::internal::conjugate(*this);
+}
+
+template<> inline
+Vec<double, 4> Vec<double, 4>::conj() const
+{
+    return cv::internal::conjugate(*this);
+}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> Vec<_Tp, cn>::cross(const Vec<_Tp, cn>&) const
+{
+    CV_StaticAssert(cn == 3, "for arbitrary-size vector there is no cross-product defined");
+    return Vec<_Tp, cn>();
+}
+
+template<> inline
+Vec<float, 3> Vec<float, 3>::cross(const Vec<float, 3>& v) const
+{
+    return Vec<float,3>(val[1]*v.val[2] - val[2]*v.val[1],
+                     val[2]*v.val[0] - val[0]*v.val[2],
+                     val[0]*v.val[1] - val[1]*v.val[0]);
+}
+
+template<> inline
+Vec<double, 3> Vec<double, 3>::cross(const Vec<double, 3>& v) const
+{
+    return Vec<double,3>(val[1]*v.val[2] - val[2]*v.val[1],
+                     val[2]*v.val[0] - val[0]*v.val[2],
+                     val[0]*v.val[1] - val[1]*v.val[0]);
+}
+
+template<typename _Tp, int cn> template<typename T2> inline
+Vec<_Tp, cn>::operator Vec<T2, cn>() const
+{
+    Vec<T2, cn> v;
+    for( int i = 0; i < cn; i++ ) v.val[i] = saturate_cast<T2>(this->val[i]);
+    return v;
+}
+
+template<typename _Tp, int cn> inline
+const _Tp& Vec<_Tp, cn>::operator [](int i) const
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)cn );
+    return this->val[i];
+}
+
+template<typename _Tp, int cn> inline
+_Tp& Vec<_Tp, cn>::operator [](int i)
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)cn );
+    return this->val[i];
+}
+
+template<typename _Tp, int cn> inline
+const _Tp& Vec<_Tp, cn>::operator ()(int i) const
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)cn );
+    return this->val[i];
+}
+
+template<typename _Tp, int cn> inline
+_Tp& Vec<_Tp, cn>::operator ()(int i)
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)cn );
+    return this->val[i];
+}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v)
+{
+    double nv = norm(v);
+    return v * (nv ? 1./nv : 0.);
+}
+
+
+
+//////////////////////////////// matx comma initializer //////////////////////////////////
+
+
+template<typename _Tp, typename _T2, int cn> static inline
+VecCommaInitializer<_Tp, cn> operator << (const Vec<_Tp, cn>& vec, _T2 val)
+{
+    VecCommaInitializer<_Tp, cn> commaInitializer((Vec<_Tp, cn>*)&vec);
+    return (commaInitializer, val);
+}
+
+template<typename _Tp, int cn> inline
+VecCommaInitializer<_Tp, cn>::VecCommaInitializer(Vec<_Tp, cn>* _vec)
+    : MatxCommaInitializer<_Tp, cn, 1>(_vec)
+{}
+
+template<typename _Tp, int cn> template<typename _T2> inline
+VecCommaInitializer<_Tp, cn>& VecCommaInitializer<_Tp, cn>::operator , (_T2 value)
+{
+    CV_DbgAssert( this->idx < cn );
+    this->dst->val[this->idx++] = saturate_cast<_Tp>(value);
+    return *this;
+}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> VecCommaInitializer<_Tp, cn>::operator *() const
+{
+    CV_DbgAssert( this->idx == cn );
+    return *this->dst;
+}
+
+//! @endcond
+
+///////////////////////////// Matx out-of-class operators ////////////////////////////////
+
+//! @relates cv::Matx
+//! @{
+
+template<typename _Tp1, typename _Tp2, int m, int n> static inline
+Matx<_Tp1, m, n>& operator += (Matx<_Tp1, m, n>& a, const Matx<_Tp2, m, n>& b)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp1>(a.val[i] + b.val[i]);
+    return a;
+}
+
+template<typename _Tp1, typename _Tp2, int m, int n> static inline
+Matx<_Tp1, m, n>& operator -= (Matx<_Tp1, m, n>& a, const Matx<_Tp2, m, n>& b)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp1>(a.val[i] - b.val[i]);
+    return a;
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator + (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b)
+{
+    return Matx<_Tp, m, n>(a, b, Matx_AddOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator - (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b)
+{
+    return Matx<_Tp, m, n>(a, b, Matx_SubOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, int alpha)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha);
+    return a;
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, float alpha)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha);
+    return a;
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, double alpha)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha);
+    return a;
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, int alpha)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, float alpha)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, double alpha)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (int alpha, const Matx<_Tp, m, n>& a)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (float alpha, const Matx<_Tp, m, n>& a)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (double alpha, const Matx<_Tp, m, n>& a)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator - (const Matx<_Tp, m, n>& a)
+{
+    return Matx<_Tp, m, n>(a, -1, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n, int l> static inline
+Matx<_Tp, m, n> operator * (const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b)
+{
+    return Matx<_Tp, m, n>(a, b, Matx_MatMulOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Vec<_Tp, m> operator * (const Matx<_Tp, m, n>& a, const Vec<_Tp, n>& b)
+{
+    Matx<_Tp, m, 1> c(a, b, Matx_MatMulOp());
+    return (const Vec<_Tp, m>&)(c);
+}
+
+template<typename _Tp, int m, int n> static inline
+bool operator == (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b)
+{
+    for( int i = 0; i < m*n; i++ )
+        if( a.val[i] != b.val[i] ) return false;
+    return true;
+}
+
+template<typename _Tp, int m, int n> static inline
+bool operator != (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b)
+{
+    return !(a == b);
+}
+
+//! @}
+
+////////////////////////////// Vec out-of-class operators ////////////////////////////////
+
+//! @relates cv::Vec
+//! @{
+
+template<typename _Tp1, typename _Tp2, int cn> static inline
+Vec<_Tp1, cn>& operator += (Vec<_Tp1, cn>& a, const Vec<_Tp2, cn>& b)
+{
+    for( int i = 0; i < cn; i++ )
+        a.val[i] = saturate_cast<_Tp1>(a.val[i] + b.val[i]);
+    return a;
+}
+
+template<typename _Tp1, typename _Tp2, int cn> static inline
+Vec<_Tp1, cn>& operator -= (Vec<_Tp1, cn>& a, const Vec<_Tp2, cn>& b)
+{
+    for( int i = 0; i < cn; i++ )
+        a.val[i] = saturate_cast<_Tp1>(a.val[i] - b.val[i]);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator + (const Vec<_Tp, cn>& a, const Vec<_Tp, cn>& b)
+{
+    return Vec<_Tp, cn>(a, b, Matx_AddOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator - (const Vec<_Tp, cn>& a, const Vec<_Tp, cn>& b)
+{
+    return Vec<_Tp, cn>(a, b, Matx_SubOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, int alpha)
+{
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*alpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, float alpha)
+{
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*alpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, double alpha)
+{
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*alpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, int alpha)
+{
+    double ialpha = 1./alpha;
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*ialpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, float alpha)
+{
+    float ialpha = 1.f/alpha;
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*ialpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, double alpha)
+{
+    double ialpha = 1./alpha;
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*ialpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, int alpha)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (int alpha, const Vec<_Tp, cn>& a)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, float alpha)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (float alpha, const Vec<_Tp, cn>& a)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, double alpha)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (double alpha, const Vec<_Tp, cn>& a)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, int alpha)
+{
+    return Vec<_Tp, cn>(a, 1./alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, float alpha)
+{
+    return Vec<_Tp, cn>(a, 1.f/alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, double alpha)
+{
+    return Vec<_Tp, cn>(a, 1./alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator - (const Vec<_Tp, cn>& a)
+{
+    Vec<_Tp,cn> t;
+    for( int i = 0; i < cn; i++ ) t.val[i] = saturate_cast<_Tp>(-a.val[i]);
+    return t;
+}
+
+template<typename _Tp> inline Vec<_Tp, 4> operator * (const Vec<_Tp, 4>& v1, const Vec<_Tp, 4>& v2)
+{
+    return Vec<_Tp, 4>(saturate_cast<_Tp>(v1[0]*v2[0] - v1[1]*v2[1] - v1[2]*v2[2] - v1[3]*v2[3]),
+                       saturate_cast<_Tp>(v1[0]*v2[1] + v1[1]*v2[0] + v1[2]*v2[3] - v1[3]*v2[2]),
+                       saturate_cast<_Tp>(v1[0]*v2[2] - v1[1]*v2[3] + v1[2]*v2[0] + v1[3]*v2[1]),
+                       saturate_cast<_Tp>(v1[0]*v2[3] + v1[1]*v2[2] - v1[2]*v2[1] + v1[3]*v2[0]));
+}
+
+template<typename _Tp> inline Vec<_Tp, 4>& operator *= (Vec<_Tp, 4>& v1, const Vec<_Tp, 4>& v2)
+{
+    v1 = v1 * v2;
+    return v1;
+}
+
+//! @}
+
+} // cv
+
+#endif // __OPENCV_CORE_MATX_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp
new file mode 100644
index 0000000..adb750f
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp
@@ -0,0 +1,128 @@
+/*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) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_NEON_UTILS_HPP__
+#define __OPENCV_HAL_NEON_UTILS_HPP__
+
+#include "opencv2/core/cvdef.h"
+
+//! @addtogroup core_utils_neon
+//! @{
+
+#if CV_NEON
+
+inline int32x2_t cv_vrnd_s32_f32(float32x2_t v)
+{
+    static int32x2_t v_sign = vdup_n_s32(1 << 31),
+        v_05 = vreinterpret_s32_f32(vdup_n_f32(0.5f));
+
+    int32x2_t v_addition = vorr_s32(v_05, vand_s32(v_sign, vreinterpret_s32_f32(v)));
+    return vcvt_s32_f32(vadd_f32(v, vreinterpret_f32_s32(v_addition)));
+}
+
+inline int32x4_t cv_vrndq_s32_f32(float32x4_t v)
+{
+    static int32x4_t v_sign = vdupq_n_s32(1 << 31),
+        v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f));
+
+    int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(v)));
+    return vcvtq_s32_f32(vaddq_f32(v, vreinterpretq_f32_s32(v_addition)));
+}
+
+inline uint32x2_t cv_vrnd_u32_f32(float32x2_t v)
+{
+    static float32x2_t v_05 = vdup_n_f32(0.5f);
+    return vcvt_u32_f32(vadd_f32(v, v_05));
+}
+
+inline uint32x4_t cv_vrndq_u32_f32(float32x4_t v)
+{
+    static float32x4_t v_05 = vdupq_n_f32(0.5f);
+    return vcvtq_u32_f32(vaddq_f32(v, v_05));
+}
+
+inline float32x4_t cv_vrecpq_f32(float32x4_t val)
+{
+    float32x4_t reciprocal = vrecpeq_f32(val);
+    reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal);
+    reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal);
+    return reciprocal;
+}
+
+inline float32x2_t cv_vrecp_f32(float32x2_t val)
+{
+    float32x2_t reciprocal = vrecpe_f32(val);
+    reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal);
+    reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal);
+    return reciprocal;
+}
+
+inline float32x4_t cv_vrsqrtq_f32(float32x4_t val)
+{
+    float32x4_t e = vrsqrteq_f32(val);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e);
+    return e;
+}
+
+inline float32x2_t cv_vrsqrt_f32(float32x2_t val)
+{
+    float32x2_t e = vrsqrte_f32(val);
+    e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e);
+    e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e);
+    return e;
+}
+
+inline float32x4_t cv_vsqrtq_f32(float32x4_t val)
+{
+    return cv_vrecpq_f32(cv_vrsqrtq_f32(val));
+}
+
+inline float32x2_t cv_vsqrt_f32(float32x2_t val)
+{
+    return cv_vrecp_f32(cv_vrsqrt_f32(val));
+}
+
+#endif
+
+//! @}
+
+#endif // __OPENCV_HAL_NEON_UTILS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp
new file mode 100644
index 0000000..bc989a3
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp
@@ -0,0 +1,743 @@
+/*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) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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 OpenCV Foundation 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*/
+
+#ifndef __OPENCV_OPENCL_HPP__
+#define __OPENCV_OPENCL_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv { namespace ocl {
+
+//! @addtogroup core_opencl
+//! @{
+
+CV_EXPORTS_W bool haveOpenCL();
+CV_EXPORTS_W bool useOpenCL();
+CV_EXPORTS_W bool haveAmdBlas();
+CV_EXPORTS_W bool haveAmdFft();
+CV_EXPORTS_W void setUseOpenCL(bool flag);
+CV_EXPORTS_W void finish();
+
+CV_EXPORTS bool haveSVM();
+
+class CV_EXPORTS Context;
+class CV_EXPORTS Device;
+class CV_EXPORTS Kernel;
+class CV_EXPORTS Program;
+class CV_EXPORTS ProgramSource;
+class CV_EXPORTS Queue;
+class CV_EXPORTS PlatformInfo;
+class CV_EXPORTS Image2D;
+
+class CV_EXPORTS Device
+{
+public:
+    Device();
+    explicit Device(void* d);
+    Device(const Device& d);
+    Device& operator = (const Device& d);
+    ~Device();
+
+    void set(void* d);
+
+    enum
+    {
+        TYPE_DEFAULT     = (1 << 0),
+        TYPE_CPU         = (1 << 1),
+        TYPE_GPU         = (1 << 2),
+        TYPE_ACCELERATOR = (1 << 3),
+        TYPE_DGPU        = TYPE_GPU + (1 << 16),
+        TYPE_IGPU        = TYPE_GPU + (1 << 17),
+        TYPE_ALL         = 0xFFFFFFFF
+    };
+
+    String name() const;
+    String extensions() const;
+    String version() const;
+    String vendorName() const;
+    String OpenCL_C_Version() const;
+    String OpenCLVersion() const;
+    int deviceVersionMajor() const;
+    int deviceVersionMinor() const;
+    String driverVersion() const;
+    void* ptr() const;
+
+    int type() const;
+
+    int addressBits() const;
+    bool available() const;
+    bool compilerAvailable() const;
+    bool linkerAvailable() const;
+
+    enum
+    {
+        FP_DENORM=(1 << 0),
+        FP_INF_NAN=(1 << 1),
+        FP_ROUND_TO_NEAREST=(1 << 2),
+        FP_ROUND_TO_ZERO=(1 << 3),
+        FP_ROUND_TO_INF=(1 << 4),
+        FP_FMA=(1 << 5),
+        FP_SOFT_FLOAT=(1 << 6),
+        FP_CORRECTLY_ROUNDED_DIVIDE_SQRT=(1 << 7)
+    };
+    int doubleFPConfig() const;
+    int singleFPConfig() const;
+    int halfFPConfig() const;
+
+    bool endianLittle() const;
+    bool errorCorrectionSupport() const;
+
+    enum
+    {
+        EXEC_KERNEL=(1 << 0),
+        EXEC_NATIVE_KERNEL=(1 << 1)
+    };
+    int executionCapabilities() const;
+
+    size_t globalMemCacheSize() const;
+
+    enum
+    {
+        NO_CACHE=0,
+        READ_ONLY_CACHE=1,
+        READ_WRITE_CACHE=2
+    };
+    int globalMemCacheType() const;
+    int globalMemCacheLineSize() const;
+    size_t globalMemSize() const;
+
+    size_t localMemSize() const;
+    enum
+    {
+        NO_LOCAL_MEM=0,
+        LOCAL_IS_LOCAL=1,
+        LOCAL_IS_GLOBAL=2
+    };
+    int localMemType() const;
+    bool hostUnifiedMemory() const;
+
+    bool imageSupport() const;
+
+    bool imageFromBufferSupport() const;
+    uint imagePitchAlignment() const;
+    uint imageBaseAddressAlignment() const;
+
+    size_t image2DMaxWidth() const;
+    size_t image2DMaxHeight() const;
+
+    size_t image3DMaxWidth() const;
+    size_t image3DMaxHeight() const;
+    size_t image3DMaxDepth() const;
+
+    size_t imageMaxBufferSize() const;
+    size_t imageMaxArraySize() const;
+
+    enum
+    {
+        UNKNOWN_VENDOR=0,
+        VENDOR_AMD=1,
+        VENDOR_INTEL=2,
+        VENDOR_NVIDIA=3
+    };
+    int vendorID() const;
+    // FIXIT
+    // dev.isAMD() doesn't work for OpenCL CPU devices from AMD OpenCL platform.
+    // This method should use platform name instead of vendor name.
+    // After fix restore code in arithm.cpp: ocl_compare()
+    inline bool isAMD() const { return vendorID() == VENDOR_AMD; }
+    inline bool isIntel() const { return vendorID() == VENDOR_INTEL; }
+    inline bool isNVidia() const { return vendorID() == VENDOR_NVIDIA; }
+
+    int maxClockFrequency() const;
+    int maxComputeUnits() const;
+    int maxConstantArgs() const;
+    size_t maxConstantBufferSize() const;
+
+    size_t maxMemAllocSize() const;
+    size_t maxParameterSize() const;
+
+    int maxReadImageArgs() const;
+    int maxWriteImageArgs() const;
+    int maxSamplers() const;
+
+    size_t maxWorkGroupSize() const;
+    int maxWorkItemDims() const;
+    void maxWorkItemSizes(size_t*) const;
+
+    int memBaseAddrAlign() const;
+
+    int nativeVectorWidthChar() const;
+    int nativeVectorWidthShort() const;
+    int nativeVectorWidthInt() const;
+    int nativeVectorWidthLong() const;
+    int nativeVectorWidthFloat() const;
+    int nativeVectorWidthDouble() const;
+    int nativeVectorWidthHalf() const;
+
+    int preferredVectorWidthChar() const;
+    int preferredVectorWidthShort() const;
+    int preferredVectorWidthInt() const;
+    int preferredVectorWidthLong() const;
+    int preferredVectorWidthFloat() const;
+    int preferredVectorWidthDouble() const;
+    int preferredVectorWidthHalf() const;
+
+    size_t printfBufferSize() const;
+    size_t profilingTimerResolution() const;
+
+    static const Device& getDefault();
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+
+class CV_EXPORTS Context
+{
+public:
+    Context();
+    explicit Context(int dtype);
+    ~Context();
+    Context(const Context& c);
+    Context& operator = (const Context& c);
+
+    bool create();
+    bool create(int dtype);
+    size_t ndevices() const;
+    const Device& device(size_t idx) const;
+    Program getProg(const ProgramSource& prog,
+                    const String& buildopt, String& errmsg);
+
+    static Context& getDefault(bool initialize = true);
+    void* ptr() const;
+
+    friend void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device);
+
+    bool useSVM() const;
+    void setUseSVM(bool enabled);
+
+    struct Impl;
+    Impl* p;
+};
+
+class CV_EXPORTS Platform
+{
+public:
+    Platform();
+    ~Platform();
+    Platform(const Platform& p);
+    Platform& operator = (const Platform& p);
+
+    void* ptr() const;
+    static Platform& getDefault();
+
+    friend void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device);
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+/*
+//! @brief Attaches OpenCL context to OpenCV
+//
+//! @note Note:
+//    OpenCV will check if available OpenCL platform has platformName name,
+//    then assign context to OpenCV and call clRetainContext function.
+//    The deviceID device will be used as target device and new command queue
+//    will be created.
+//
+// Params:
+//! @param platformName - name of OpenCL platform to attach,
+//!                       this string is used to check if platform is available
+//!                       to OpenCV at runtime
+//! @param platfromID   - ID of platform attached context was created for
+//! @param context      - OpenCL context to be attached to OpenCV
+//! @param deviceID     - ID of device, must be created from attached context
+*/
+CV_EXPORTS void attachContext(const String& platformName, void* platformID, void* context, void* deviceID);
+
+/*
+//! @brief Convert OpenCL buffer to UMat
+//
+//! @note Note:
+//   OpenCL buffer (cl_mem_buffer) should contain 2D image data, compatible with OpenCV.
+//   Memory content is not copied from clBuffer to UMat. Instead, buffer handle assigned
+//   to UMat and clRetainMemObject is called.
+//
+// Params:
+//! @param  cl_mem_buffer - source clBuffer handle
+//! @param  step          - num of bytes in single row
+//! @param  rows          - number of rows
+//! @param  cols          - number of cols
+//! @param  type          - OpenCV type of image
+//! @param  dst           - destination UMat
+*/
+CV_EXPORTS void convertFromBuffer(void* cl_mem_buffer, size_t step, int rows, int cols, int type, UMat& dst);
+
+/*
+//! @brief Convert OpenCL image2d_t to UMat
+//
+//! @note Note:
+//   OpenCL image2d_t (cl_mem_image), should be compatible with OpenCV
+//   UMat formats.
+//   Memory content is copied from image to UMat with
+//   clEnqueueCopyImageToBuffer function.
+//
+// Params:
+//! @param  cl_mem_image - source image2d_t handle
+//! @param  dst          - destination UMat
+*/
+CV_EXPORTS void convertFromImage(void* cl_mem_image, UMat& dst);
+
+// TODO Move to internal header
+void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device);
+
+class CV_EXPORTS Queue
+{
+public:
+    Queue();
+    explicit Queue(const Context& c, const Device& d=Device());
+    ~Queue();
+    Queue(const Queue& q);
+    Queue& operator = (const Queue& q);
+
+    bool create(const Context& c=Context(), const Device& d=Device());
+    void finish();
+    void* ptr() const;
+    static Queue& getDefault();
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+
+class CV_EXPORTS KernelArg
+{
+public:
+    enum { LOCAL=1, READ_ONLY=2, WRITE_ONLY=4, READ_WRITE=6, CONSTANT=8, PTR_ONLY = 16, NO_SIZE=256 };
+    KernelArg(int _flags, UMat* _m, int wscale=1, int iwscale=1, const void* _obj=0, size_t _sz=0);
+    KernelArg();
+
+    static KernelArg Local() { return KernelArg(LOCAL, 0); }
+    static KernelArg PtrWriteOnly(const UMat& m)
+    { return KernelArg(PTR_ONLY+WRITE_ONLY, (UMat*)&m); }
+    static KernelArg PtrReadOnly(const UMat& m)
+    { return KernelArg(PTR_ONLY+READ_ONLY, (UMat*)&m); }
+    static KernelArg PtrReadWrite(const UMat& m)
+    { return KernelArg(PTR_ONLY+READ_WRITE, (UMat*)&m); }
+    static KernelArg ReadWrite(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(READ_WRITE, (UMat*)&m, wscale, iwscale); }
+    static KernelArg ReadWriteNoSize(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(READ_WRITE+NO_SIZE, (UMat*)&m, wscale, iwscale); }
+    static KernelArg ReadOnly(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(READ_ONLY, (UMat*)&m, wscale, iwscale); }
+    static KernelArg WriteOnly(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(WRITE_ONLY, (UMat*)&m, wscale, iwscale); }
+    static KernelArg ReadOnlyNoSize(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(READ_ONLY+NO_SIZE, (UMat*)&m, wscale, iwscale); }
+    static KernelArg WriteOnlyNoSize(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(WRITE_ONLY+NO_SIZE, (UMat*)&m, wscale, iwscale); }
+    static KernelArg Constant(const Mat& m);
+    template<typename _Tp> static KernelArg Constant(const _Tp* arr, size_t n)
+    { return KernelArg(CONSTANT, 0, 1, 1, (void*)arr, n); }
+
+    int flags;
+    UMat* m;
+    const void* obj;
+    size_t sz;
+    int wscale, iwscale;
+};
+
+
+class CV_EXPORTS Kernel
+{
+public:
+    Kernel();
+    Kernel(const char* kname, const Program& prog);
+    Kernel(const char* kname, const ProgramSource& prog,
+           const String& buildopts = String(), String* errmsg=0);
+    ~Kernel();
+    Kernel(const Kernel& k);
+    Kernel& operator = (const Kernel& k);
+
+    bool empty() const;
+    bool create(const char* kname, const Program& prog);
+    bool create(const char* kname, const ProgramSource& prog,
+                const String& buildopts, String* errmsg=0);
+
+    int set(int i, const void* value, size_t sz);
+    int set(int i, const Image2D& image2D);
+    int set(int i, const UMat& m);
+    int set(int i, const KernelArg& arg);
+    template<typename _Tp> int set(int i, const _Tp& value)
+    { return set(i, &value, sizeof(value)); }
+
+    template<typename _Tp0>
+    Kernel& args(const _Tp0& a0)
+    {
+        set(0, a0); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1)
+    {
+        int i = set(0, a0); set(i, a1); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2)
+    {
+        int i = set(0, a0); i = set(i, a1); set(i, a2); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2,
+                 const _Tp3& a3, const _Tp4& a4)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2);
+        i = set(i, a3); set(i, a4); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2,
+             typename _Tp3, typename _Tp4, typename _Tp5>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2,
+                 const _Tp3& a3, const _Tp4& a4, const _Tp5& a5)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2);
+        i = set(i, a3); i = set(i, a4); set(i, a5); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3);
+        i = set(i, a4); i = set(i, a5); set(i, a6); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3);
+        i = set(i, a4); i = set(i, a5); i = set(i, a6); set(i, a7); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4,
+             typename _Tp5, typename _Tp6, typename _Tp7, typename _Tp8>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4);
+        i = set(i, a5); i = set(i, a6); i = set(i, a7); set(i, a8); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4,
+             typename _Tp5, typename _Tp6, typename _Tp7, typename _Tp8, typename _Tp9>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); set(i, a9); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); set(i, a10); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); set(i, a11); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11, typename _Tp12>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11,
+                 const _Tp12& a12)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
+        set(i, a12); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11, typename _Tp12,
+             typename _Tp13>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11,
+                 const _Tp12& a12, const _Tp13& a13)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
+        i = set(i, a12); set(i, a13); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11, typename _Tp12,
+             typename _Tp13, typename _Tp14>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11,
+                 const _Tp12& a12, const _Tp13& a13, const _Tp14& a14)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
+        i = set(i, a12); i = set(i, a13); set(i, a14); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11, typename _Tp12,
+             typename _Tp13, typename _Tp14, typename _Tp15>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11,
+                 const _Tp12& a12, const _Tp13& a13, const _Tp14& a14, const _Tp15& a15)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
+        i = set(i, a12); i = set(i, a13); i = set(i, a14); set(i, a15); return *this;
+    }
+
+    bool run(int dims, size_t globalsize[],
+             size_t localsize[], bool sync, const Queue& q=Queue());
+    bool runTask(bool sync, const Queue& q=Queue());
+
+    size_t workGroupSize() const;
+    size_t preferedWorkGroupSizeMultiple() const;
+    bool compileWorkGroupSize(size_t wsz[]) const;
+    size_t localMemSize() const;
+
+    void* ptr() const;
+    struct Impl;
+
+protected:
+    Impl* p;
+};
+
+class CV_EXPORTS Program
+{
+public:
+    Program();
+    Program(const ProgramSource& src,
+            const String& buildflags, String& errmsg);
+    explicit Program(const String& buf);
+    Program(const Program& prog);
+
+    Program& operator = (const Program& prog);
+    ~Program();
+
+    bool create(const ProgramSource& src,
+                const String& buildflags, String& errmsg);
+    bool read(const String& buf, const String& buildflags);
+    bool write(String& buf) const;
+
+    const ProgramSource& source() const;
+    void* ptr() const;
+
+    String getPrefix() const;
+    static String getPrefix(const String& buildflags);
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+
+class CV_EXPORTS ProgramSource
+{
+public:
+    typedef uint64 hash_t;
+
+    ProgramSource();
+    explicit ProgramSource(const String& prog);
+    explicit ProgramSource(const char* prog);
+    ~ProgramSource();
+    ProgramSource(const ProgramSource& prog);
+    ProgramSource& operator = (const ProgramSource& prog);
+
+    const String& source() const;
+    hash_t hash() const;
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+class CV_EXPORTS PlatformInfo
+{
+public:
+    PlatformInfo();
+    explicit PlatformInfo(void* id);
+    ~PlatformInfo();
+
+    PlatformInfo(const PlatformInfo& i);
+    PlatformInfo& operator =(const PlatformInfo& i);
+
+    String name() const;
+    String vendor() const;
+    String version() const;
+    int deviceNumber() const;
+    void getDevice(Device& device, int d) const;
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+CV_EXPORTS const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf);
+CV_EXPORTS const char* typeToStr(int t);
+CV_EXPORTS const char* memopTypeToStr(int t);
+CV_EXPORTS const char* vecopTypeToStr(int t);
+CV_EXPORTS String kernelToStr(InputArray _kernel, int ddepth = -1, const char * name = NULL);
+CV_EXPORTS void getPlatfomsInfo(std::vector<PlatformInfo>& platform_info);
+
+
+enum OclVectorStrategy
+{
+    // all matrices have its own vector width
+    OCL_VECTOR_OWN = 0,
+    // all matrices have maximal vector width among all matrices
+    // (useful for cases when matrices have different data types)
+    OCL_VECTOR_MAX = 1,
+
+    // default strategy
+    OCL_VECTOR_DEFAULT = OCL_VECTOR_OWN
+};
+
+CV_EXPORTS int predictOptimalVectorWidth(InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(),
+                                         InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
+                                         InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray(),
+                                         OclVectorStrategy strat = OCL_VECTOR_DEFAULT);
+
+CV_EXPORTS int checkOptimalVectorWidth(const int *vectorWidths,
+                                       InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(),
+                                       InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
+                                       InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray(),
+                                       OclVectorStrategy strat = OCL_VECTOR_DEFAULT);
+
+// with OCL_VECTOR_MAX strategy
+CV_EXPORTS int predictOptimalVectorWidthMax(InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(),
+                                            InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
+                                            InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray());
+
+CV_EXPORTS void buildOptionsAddMatrixDescription(String& buildOptions, const String& name, InputArray _m);
+
+class CV_EXPORTS Image2D
+{
+public:
+    Image2D();
+
+    // src:     The UMat from which to get image properties and data
+    // norm:    Flag to enable the use of normalized channel data types
+    // alias:   Flag indicating that the image should alias the src UMat.
+    //          If true, changes to the image or src will be reflected in
+    //          both objects.
+    explicit Image2D(const UMat &src, bool norm = false, bool alias = false);
+    Image2D(const Image2D & i);
+    ~Image2D();
+
+    Image2D & operator = (const Image2D & i);
+
+    // Indicates if creating an aliased image should succeed.  Depends on the
+    // underlying platform and the dimensions of the UMat.
+    static bool canCreateAlias(const UMat &u);
+
+    // Indicates if the image format is supported.
+    static bool isFormatSupported(int depth, int cn, bool norm);
+
+    void* ptr() const;
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+
+CV_EXPORTS MatAllocator* getOpenCLAllocator();
+
+
+#ifdef __OPENCV_BUILD
+namespace internal {
+
+CV_EXPORTS bool isPerformanceCheckBypassed();
+#define OCL_PERFORMANCE_CHECK(condition) (cv::ocl::internal::isPerformanceCheckBypassed() || (condition))
+
+CV_EXPORTS bool isCLBuffer(UMat& u);
+
+} // namespace internal
+#endif
+
+//! @}
+
+}}
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp
new file mode 100644
index 0000000..d53bc1a
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp
@@ -0,0 +1,64 @@
+/*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) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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 OpenCV Foundation 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*/
+
+#ifndef __OPENCV_OPENCL_GENBASE_HPP__
+#define __OPENCV_OPENCL_GENBASE_HPP__
+
+namespace cv
+{
+namespace ocl
+{
+
+//! @cond IGNORED
+
+struct ProgramEntry
+{
+    const char* name;
+    const char* programStr;
+    const char* programHash;
+};
+
+//! @endcond
+
+}
+}
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp
new file mode 100644
index 0000000..fd47c52
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp
@@ -0,0 +1,729 @@
+/*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*/
+
+#ifndef __OPENCV_CORE_OPENGL_HPP__
+#define __OPENCV_CORE_OPENGL_HPP__
+
+#ifndef __cplusplus
+#  error opengl.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core.hpp"
+#include "ocl.hpp"
+
+namespace cv { namespace ogl {
+
+/** @addtogroup core_opengl
+This section describes OpenGL interoperability.
+
+To enable OpenGL support, configure OpenCV using CMake with WITH_OPENGL=ON . Currently OpenGL is
+supported only with WIN32, GTK and Qt backends on Windows and Linux (MacOS and Android are not
+supported). For GTK backend gtkglext-1.0 library is required.
+
+To use OpenGL functionality you should first create OpenGL context (window or frame buffer). You can
+do this with namedWindow function or with other OpenGL toolkit (GLUT, for example).
+*/
+//! @{
+
+/////////////////// OpenGL Objects ///////////////////
+
+/** @brief Smart pointer for OpenGL buffer object with reference counting.
+
+Buffer Objects are OpenGL objects that store an array of unformatted memory allocated by the OpenGL
+context. These can be used to store vertex data, pixel data retrieved from images or the
+framebuffer, and a variety of other things.
+
+ogl::Buffer has interface similar with Mat interface and represents 2D array memory.
+
+ogl::Buffer supports memory transfers between host and device and also can be mapped to CUDA memory.
+ */
+class CV_EXPORTS Buffer
+{
+public:
+    /** @brief The target defines how you intend to use the buffer object.
+    */
+    enum Target
+    {
+        ARRAY_BUFFER         = 0x8892, //!< The buffer will be used as a source for vertex data
+        ELEMENT_ARRAY_BUFFER = 0x8893, //!< The buffer will be used for indices (in glDrawElements, for example)
+        PIXEL_PACK_BUFFER    = 0x88EB, //!< The buffer will be used for reading from OpenGL textures
+        PIXEL_UNPACK_BUFFER  = 0x88EC  //!< The buffer will be used for writing to OpenGL textures
+    };
+
+    enum Access
+    {
+        READ_ONLY  = 0x88B8,
+        WRITE_ONLY = 0x88B9,
+        READ_WRITE = 0x88BA
+    };
+
+    /** @brief The constructors.
+
+    Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId
+    parameter), allocates memory for ogl::Buffer object or copies from host/device memory.
+     */
+    Buffer();
+
+    /** @overload
+    @param arows Number of rows in a 2D array.
+    @param acols Number of columns in a 2D array.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param abufId Buffer object name.
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Buffer(int arows, int acols, int atype, unsigned int abufId, bool autoRelease = false);
+
+    /** @overload
+    @param asize 2D array size.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param abufId Buffer object name.
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Buffer(Size asize, int atype, unsigned int abufId, bool autoRelease = false);
+
+    /** @overload
+    @param arows Number of rows in a 2D array.
+    @param acols Number of columns in a 2D array.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Buffer(int arows, int acols, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @overload
+    @param asize 2D array size.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Buffer(Size asize, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @overload
+    @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ).
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    explicit Buffer(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @brief Allocates memory for ogl::Buffer object.
+
+    @param arows Number of rows in a 2D array.
+    @param acols Number of columns in a 2D array.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+     */
+    void create(int arows, int acols, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @overload
+    @param asize 2D array size.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    void create(Size asize, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @brief Decrements the reference counter and destroys the buffer object if needed.
+
+    The function will call setAutoRelease(true) .
+     */
+    void release();
+
+    /** @brief Sets auto release mode.
+
+    The lifetime of the OpenGL object is tied to the lifetime of the context. If OpenGL context was
+    bound to a window it could be released at any time (user can close a window). If object's destructor
+    is called after destruction of the context it will cause an error. Thus ogl::Buffer doesn't destroy
+    OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL context).
+    This function can force ogl::Buffer destructor to destroy OpenGL object.
+    @param flag Auto release mode (if true, release will be called in object's destructor).
+     */
+    void setAutoRelease(bool flag);
+
+    /** @brief Copies from host/device memory to OpenGL buffer.
+    @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ).
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+     */
+    void copyFrom(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @overload */
+    void copyFrom(InputArray arr, cuda::Stream& stream, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @brief Copies from OpenGL buffer to host/device memory or another OpenGL buffer object.
+
+    @param arr Destination array (host or device memory, can be Mat , cuda::GpuMat , std::vector or
+    ogl::Buffer ).
+     */
+    void copyTo(OutputArray arr) const;
+
+    /** @overload */
+    void copyTo(OutputArray arr, cuda::Stream& stream) const;
+
+    /** @brief Creates a full copy of the buffer object and the underlying data.
+
+    @param target Buffer usage for destination buffer.
+    @param autoRelease Auto release mode for destination buffer.
+     */
+    Buffer clone(Target target = ARRAY_BUFFER, bool autoRelease = false) const;
+
+    /** @brief Binds OpenGL buffer to the specified buffer binding point.
+
+    @param target Binding point. See cv::ogl::Buffer::Target .
+     */
+    void bind(Target target) const;
+
+    /** @brief Unbind any buffers from the specified binding point.
+
+    @param target Binding point. See cv::ogl::Buffer::Target .
+     */
+    static void unbind(Target target);
+
+    /** @brief Maps OpenGL buffer to host memory.
+
+    mapHost maps to the client's address space the entire data store of the buffer object. The data can
+    then be directly read and/or written relative to the returned pointer, depending on the specified
+    access policy.
+
+    A mapped data store must be unmapped with ogl::Buffer::unmapHost before its buffer object is used.
+
+    This operation can lead to memory transfers between host and device.
+
+    Only one buffer object can be mapped at a time.
+    @param access Access policy, indicating whether it will be possible to read from, write to, or both
+    read from and write to the buffer object's mapped data store. The symbolic constant must be
+    ogl::Buffer::READ_ONLY , ogl::Buffer::WRITE_ONLY or ogl::Buffer::READ_WRITE .
+     */
+    Mat mapHost(Access access);
+
+    /** @brief Unmaps OpenGL buffer.
+    */
+    void unmapHost();
+
+    //! map to device memory (blocking)
+    cuda::GpuMat mapDevice();
+    void unmapDevice();
+
+    /** @brief Maps OpenGL buffer to CUDA device memory.
+
+    This operatation doesn't copy data. Several buffer objects can be mapped to CUDA memory at a time.
+
+    A mapped data store must be unmapped with ogl::Buffer::unmapDevice before its buffer object is used.
+     */
+    cuda::GpuMat mapDevice(cuda::Stream& stream);
+
+    /** @brief Unmaps OpenGL buffer.
+    */
+    void unmapDevice(cuda::Stream& stream);
+
+    int rows() const;
+    int cols() const;
+    Size size() const;
+    bool empty() const;
+
+    int type() const;
+    int depth() const;
+    int channels() const;
+    int elemSize() const;
+    int elemSize1() const;
+
+    //! get OpenGL opject id
+    unsigned int bufId() const;
+
+    class Impl;
+
+private:
+    Ptr<Impl> impl_;
+    int rows_;
+    int cols_;
+    int type_;
+};
+
+/** @brief Smart pointer for OpenGL 2D texture memory with reference counting.
+ */
+class CV_EXPORTS Texture2D
+{
+public:
+    /** @brief An Image Format describes the way that the images in Textures store their data.
+    */
+    enum Format
+    {
+        NONE            = 0,
+        DEPTH_COMPONENT = 0x1902, //!< Depth
+        RGB             = 0x1907, //!< Red, Green, Blue
+        RGBA            = 0x1908  //!< Red, Green, Blue, Alpha
+    };
+
+    /** @brief The constructors.
+
+    Creates empty ogl::Texture2D object, allocates memory for ogl::Texture2D object or copies from
+    host/device memory.
+     */
+    Texture2D();
+
+    /** @overload */
+    Texture2D(int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease = false);
+
+    /** @overload */
+    Texture2D(Size asize, Format aformat, unsigned int atexId, bool autoRelease = false);
+
+    /** @overload
+    @param arows Number of rows.
+    @param acols Number of columns.
+    @param aformat Image format. See cv::ogl::Texture2D::Format .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Texture2D(int arows, int acols, Format aformat, bool autoRelease = false);
+
+    /** @overload
+    @param asize 2D array size.
+    @param aformat Image format. See cv::ogl::Texture2D::Format .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Texture2D(Size asize, Format aformat, bool autoRelease = false);
+
+    /** @overload
+    @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or ogl::Buffer ).
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    explicit Texture2D(InputArray arr, bool autoRelease = false);
+
+    /** @brief Allocates memory for ogl::Texture2D object.
+
+    @param arows Number of rows.
+    @param acols Number of columns.
+    @param aformat Image format. See cv::ogl::Texture2D::Format .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+     */
+    void create(int arows, int acols, Format aformat, bool autoRelease = false);
+    /** @overload
+    @param asize 2D array size.
+    @param aformat Image format. See cv::ogl::Texture2D::Format .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    void create(Size asize, Format aformat, bool autoRelease = false);
+
+    /** @brief Decrements the reference counter and destroys the texture object if needed.
+
+    The function will call setAutoRelease(true) .
+     */
+    void release();
+
+    /** @brief Sets auto release mode.
+
+    @param flag Auto release mode (if true, release will be called in object's destructor).
+
+    The lifetime of the OpenGL object is tied to the lifetime of the context. If OpenGL context was
+    bound to a window it could be released at any time (user can close a window). If object's destructor
+    is called after destruction of the context it will cause an error. Thus ogl::Texture2D doesn't
+    destroy OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL
+    context). This function can force ogl::Texture2D destructor to destroy OpenGL object.
+     */
+    void setAutoRelease(bool flag);
+
+    /** @brief Copies from host/device memory to OpenGL texture.
+
+    @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or ogl::Buffer ).
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+     */
+    void copyFrom(InputArray arr, bool autoRelease = false);
+
+    /** @brief Copies from OpenGL texture to host/device memory or another OpenGL texture object.
+
+    @param arr Destination array (host or device memory, can be Mat , cuda::GpuMat , ogl::Buffer or
+    ogl::Texture2D ).
+    @param ddepth Destination depth.
+    @param autoRelease Auto release mode for destination buffer (if arr is OpenGL buffer or texture).
+     */
+    void copyTo(OutputArray arr, int ddepth = CV_32F, bool autoRelease = false) const;
+
+    /** @brief Binds texture to current active texture unit for GL_TEXTURE_2D target.
+    */
+    void bind() const;
+
+    int rows() const;
+    int cols() const;
+    Size size() const;
+    bool empty() const;
+
+    Format format() const;
+
+    //! get OpenGL opject id
+    unsigned int texId() const;
+
+    class Impl;
+
+private:
+    Ptr<Impl> impl_;
+    int rows_;
+    int cols_;
+    Format format_;
+};
+
+/** @brief Wrapper for OpenGL Client-Side Vertex arrays.
+
+ogl::Arrays stores vertex data in ogl::Buffer objects.
+ */
+class CV_EXPORTS Arrays
+{
+public:
+    /** @brief Default constructor
+     */
+    Arrays();
+
+    /** @brief Sets an array of vertex coordinates.
+    @param vertex array with vertex coordinates, can be both host and device memory.
+    */
+    void setVertexArray(InputArray vertex);
+
+    /** @brief Resets vertex coordinates.
+    */
+    void resetVertexArray();
+
+    /** @brief Sets an array of vertex colors.
+    @param color array with vertex colors, can be both host and device memory.
+     */
+    void setColorArray(InputArray color);
+
+    /** @brief Resets vertex colors.
+    */
+    void resetColorArray();
+
+    /** @brief Sets an array of vertex normals.
+    @param normal array with vertex normals, can be both host and device memory.
+     */
+    void setNormalArray(InputArray normal);
+
+    /** @brief Resets vertex normals.
+    */
+    void resetNormalArray();
+
+    /** @brief Sets an array of vertex texture coordinates.
+    @param texCoord array with vertex texture coordinates, can be both host and device memory.
+     */
+    void setTexCoordArray(InputArray texCoord);
+
+    /** @brief Resets vertex texture coordinates.
+    */
+    void resetTexCoordArray();
+
+    /** @brief Releases all inner buffers.
+    */
+    void release();
+
+    /** @brief Sets auto release mode all inner buffers.
+    @param flag Auto release mode.
+     */
+    void setAutoRelease(bool flag);
+
+    /** @brief Binds all vertex arrays.
+    */
+    void bind() const;
+
+    /** @brief Returns the vertex count.
+    */
+    int size() const;
+    bool empty() const;
+
+private:
+    int size_;
+    Buffer vertex_;
+    Buffer color_;
+    Buffer normal_;
+    Buffer texCoord_;
+};
+
+/////////////////// Render Functions ///////////////////
+
+//! render mode
+enum RenderModes {
+    POINTS         = 0x0000,
+    LINES          = 0x0001,
+    LINE_LOOP      = 0x0002,
+    LINE_STRIP     = 0x0003,
+    TRIANGLES      = 0x0004,
+    TRIANGLE_STRIP = 0x0005,
+    TRIANGLE_FAN   = 0x0006,
+    QUADS          = 0x0007,
+    QUAD_STRIP     = 0x0008,
+    POLYGON        = 0x0009
+};
+
+/** @brief Render OpenGL texture or primitives.
+@param tex Texture to draw.
+@param wndRect Region of window, where to draw a texture (normalized coordinates).
+@param texRect Region of texture to draw (normalized coordinates).
+ */
+CV_EXPORTS void render(const Texture2D& tex,
+    Rect_<double> wndRect = Rect_<double>(0.0, 0.0, 1.0, 1.0),
+    Rect_<double> texRect = Rect_<double>(0.0, 0.0, 1.0, 1.0));
+
+/** @overload
+@param arr Array of privitives vertices.
+@param mode Render mode. One of cv::ogl::RenderModes
+@param color Color for all vertices. Will be used if arr doesn't contain color array.
+*/
+CV_EXPORTS void render(const Arrays& arr, int mode = POINTS, Scalar color = Scalar::all(255));
+
+/** @overload
+@param arr Array of privitives vertices.
+@param indices Array of vertices indices (host or device memory).
+@param mode Render mode. One of cv::ogl::RenderModes
+@param color Color for all vertices. Will be used if arr doesn't contain color array.
+*/
+CV_EXPORTS void render(const Arrays& arr, InputArray indices, int mode = POINTS, Scalar color = Scalar::all(255));
+
+/////////////////// CL-GL Interoperability Functions ///////////////////
+
+namespace ocl {
+using namespace cv::ocl;
+
+// TODO static functions in the Context class
+/** @brief Creates OpenCL context from GL.
+@return Returns reference to OpenCL Context
+ */
+CV_EXPORTS Context& initializeContextFromGL();
+
+} // namespace cv::ogl::ocl
+
+/** @brief Converts InputArray to Texture2D object.
+@param src     - source InputArray.
+@param texture - destination Texture2D object.
+ */
+CV_EXPORTS void convertToGLTexture2D(InputArray src, Texture2D& texture);
+
+/** @brief Converts Texture2D object to OutputArray.
+@param texture - source Texture2D object.
+@param dst     - destination OutputArray.
+ */
+CV_EXPORTS void convertFromGLTexture2D(const Texture2D& texture, OutputArray dst);
+
+/** @brief Maps Buffer object to process on CL side (convert to UMat).
+
+Function creates CL buffer from GL one, and then constructs UMat that can be used
+to process buffer data with OpenCV functions. Note that in current implementation
+UMat constructed this way doesn't own corresponding GL buffer object, so it is
+the user responsibility to close down CL/GL buffers relationships by explicitly
+calling unmapGLBuffer() function.
+@param buffer      - source Buffer object.
+@param accessFlags - data access flags (ACCESS_READ|ACCESS_WRITE).
+@return Returns UMat object
+ */
+CV_EXPORTS UMat mapGLBuffer(const Buffer& buffer, int accessFlags = ACCESS_READ|ACCESS_WRITE);
+
+/** @brief Unmaps Buffer object (releases UMat, previously mapped from Buffer).
+
+Function must be called explicitly by the user for each UMat previously constructed
+by the call to mapGLBuffer() function.
+@param u           - source UMat, created by mapGLBuffer().
+ */
+CV_EXPORTS void unmapGLBuffer(UMat& u);
+
+}} // namespace cv::ogl
+
+namespace cv { namespace cuda {
+
+//! @addtogroup cuda
+//! @{
+
+/** @brief Sets a CUDA device and initializes it for the current thread with OpenGL interoperability.
+
+This function should be explicitly called after OpenGL context creation and before any CUDA calls.
+@param device System index of a CUDA device starting with 0.
+@ingroup core_opengl
+ */
+CV_EXPORTS void setGlDevice(int device = 0);
+
+//! @}
+
+}}
+
+//! @cond IGNORED
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+inline
+cv::ogl::Buffer::Buffer(int arows, int acols, int atype, Target target, bool autoRelease) : rows_(0), cols_(0), type_(0)
+{
+    create(arows, acols, atype, target, autoRelease);
+}
+
+inline
+cv::ogl::Buffer::Buffer(Size asize, int atype, Target target, bool autoRelease) : rows_(0), cols_(0), type_(0)
+{
+    create(asize, atype, target, autoRelease);
+}
+
+inline
+void cv::ogl::Buffer::create(Size asize, int atype, Target target, bool autoRelease)
+{
+    create(asize.height, asize.width, atype, target, autoRelease);
+}
+
+inline
+int cv::ogl::Buffer::rows() const
+{
+    return rows_;
+}
+
+inline
+int cv::ogl::Buffer::cols() const
+{
+    return cols_;
+}
+
+inline
+cv::Size cv::ogl::Buffer::size() const
+{
+    return Size(cols_, rows_);
+}
+
+inline
+bool cv::ogl::Buffer::empty() const
+{
+    return rows_ == 0 || cols_ == 0;
+}
+
+inline
+int cv::ogl::Buffer::type() const
+{
+    return type_;
+}
+
+inline
+int cv::ogl::Buffer::depth() const
+{
+    return CV_MAT_DEPTH(type_);
+}
+
+inline
+int cv::ogl::Buffer::channels() const
+{
+    return CV_MAT_CN(type_);
+}
+
+inline
+int cv::ogl::Buffer::elemSize() const
+{
+    return CV_ELEM_SIZE(type_);
+}
+
+inline
+int cv::ogl::Buffer::elemSize1() const
+{
+    return CV_ELEM_SIZE1(type_);
+}
+
+///////
+
+inline
+cv::ogl::Texture2D::Texture2D(int arows, int acols, Format aformat, bool autoRelease) : rows_(0), cols_(0), format_(NONE)
+{
+    create(arows, acols, aformat, autoRelease);
+}
+
+inline
+cv::ogl::Texture2D::Texture2D(Size asize, Format aformat, bool autoRelease) : rows_(0), cols_(0), format_(NONE)
+{
+    create(asize, aformat, autoRelease);
+}
+
+inline
+void cv::ogl::Texture2D::create(Size asize, Format aformat, bool autoRelease)
+{
+    create(asize.height, asize.width, aformat, autoRelease);
+}
+
+inline
+int cv::ogl::Texture2D::rows() const
+{
+    return rows_;
+}
+
+inline
+int cv::ogl::Texture2D::cols() const
+{
+    return cols_;
+}
+
+inline
+cv::Size cv::ogl::Texture2D::size() const
+{
+    return Size(cols_, rows_);
+}
+
+inline
+bool cv::ogl::Texture2D::empty() const
+{
+    return rows_ == 0 || cols_ == 0;
+}
+
+inline
+cv::ogl::Texture2D::Format cv::ogl::Texture2D::format() const
+{
+    return format_;
+}
+
+///////
+
+inline
+cv::ogl::Arrays::Arrays() : size_(0)
+{
+}
+
+inline
+int cv::ogl::Arrays::size() const
+{
+    return size_;
+}
+
+inline
+bool cv::ogl::Arrays::empty() const
+{
+    return size_ == 0;
+}
+
+//! @endcond
+
+#endif /* __OPENCV_CORE_OPENGL_HPP__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp
new file mode 100644
index 0000000..bced1a7
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp
@@ -0,0 +1,530 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_OPERATIONS_HPP__
+#define __OPENCV_CORE_OPERATIONS_HPP__
+
+#ifndef __cplusplus
+#  error operations.hpp header must be compiled as C++
+#endif
+
+#include <cstdio>
+
+//! @cond IGNORED
+
+namespace cv
+{
+
+////////////////////////////// Matx methods depending on core API /////////////////////////////
+
+namespace internal
+{
+
+template<typename _Tp, int m> struct Matx_FastInvOp
+{
+    bool operator()(const Matx<_Tp, m, m>& a, Matx<_Tp, m, m>& b, int method) const
+    {
+        Matx<_Tp, m, m> temp = a;
+
+        // assume that b is all 0's on input => make it a unity matrix
+        for( int i = 0; i < m; i++ )
+            b(i, i) = (_Tp)1;
+
+        if( method == DECOMP_CHOLESKY )
+            return Cholesky(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m);
+
+        return LU(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m) != 0;
+    }
+};
+
+template<typename _Tp> struct Matx_FastInvOp<_Tp, 2>
+{
+    bool operator()(const Matx<_Tp, 2, 2>& a, Matx<_Tp, 2, 2>& b, int) const
+    {
+        _Tp d = determinant(a);
+        if( d == 0 )
+            return false;
+        d = 1/d;
+        b(1,1) = a(0,0)*d;
+        b(0,0) = a(1,1)*d;
+        b(0,1) = -a(0,1)*d;
+        b(1,0) = -a(1,0)*d;
+        return true;
+    }
+};
+
+template<typename _Tp> struct Matx_FastInvOp<_Tp, 3>
+{
+    bool operator()(const Matx<_Tp, 3, 3>& a, Matx<_Tp, 3, 3>& b, int) const
+    {
+        _Tp d = (_Tp)determinant(a);
+        if( d == 0 )
+            return false;
+        d = 1/d;
+        b(0,0) = (a(1,1) * a(2,2) - a(1,2) * a(2,1)) * d;
+        b(0,1) = (a(0,2) * a(2,1) - a(0,1) * a(2,2)) * d;
+        b(0,2) = (a(0,1) * a(1,2) - a(0,2) * a(1,1)) * d;
+
+        b(1,0) = (a(1,2) * a(2,0) - a(1,0) * a(2,2)) * d;
+        b(1,1) = (a(0,0) * a(2,2) - a(0,2) * a(2,0)) * d;
+        b(1,2) = (a(0,2) * a(1,0) - a(0,0) * a(1,2)) * d;
+
+        b(2,0) = (a(1,0) * a(2,1) - a(1,1) * a(2,0)) * d;
+        b(2,1) = (a(0,1) * a(2,0) - a(0,0) * a(2,1)) * d;
+        b(2,2) = (a(0,0) * a(1,1) - a(0,1) * a(1,0)) * d;
+        return true;
+    }
+};
+
+
+template<typename _Tp, int m, int n> struct Matx_FastSolveOp
+{
+    bool operator()(const Matx<_Tp, m, m>& a, const Matx<_Tp, m, n>& b,
+                    Matx<_Tp, m, n>& x, int method) const
+    {
+        Matx<_Tp, m, m> temp = a;
+        x = b;
+        if( method == DECOMP_CHOLESKY )
+            return Cholesky(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n);
+
+        return LU(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n) != 0;
+    }
+};
+
+template<typename _Tp> struct Matx_FastSolveOp<_Tp, 2, 1>
+{
+    bool operator()(const Matx<_Tp, 2, 2>& a, const Matx<_Tp, 2, 1>& b,
+                    Matx<_Tp, 2, 1>& x, int) const
+    {
+        _Tp d = determinant(a);
+        if( d == 0 )
+            return false;
+        d = 1/d;
+        x(0) = (b(0)*a(1,1) - b(1)*a(0,1))*d;
+        x(1) = (b(1)*a(0,0) - b(0)*a(1,0))*d;
+        return true;
+    }
+};
+
+template<typename _Tp> struct Matx_FastSolveOp<_Tp, 3, 1>
+{
+    bool operator()(const Matx<_Tp, 3, 3>& a, const Matx<_Tp, 3, 1>& b,
+                    Matx<_Tp, 3, 1>& x, int) const
+    {
+        _Tp d = (_Tp)determinant(a);
+        if( d == 0 )
+            return false;
+        d = 1/d;
+        x(0) = d*(b(0)*(a(1,1)*a(2,2) - a(1,2)*a(2,1)) -
+                a(0,1)*(b(1)*a(2,2) - a(1,2)*b(2)) +
+                a(0,2)*(b(1)*a(2,1) - a(1,1)*b(2)));
+
+        x(1) = d*(a(0,0)*(b(1)*a(2,2) - a(1,2)*b(2)) -
+                b(0)*(a(1,0)*a(2,2) - a(1,2)*a(2,0)) +
+                a(0,2)*(a(1,0)*b(2) - b(1)*a(2,0)));
+
+        x(2) = d*(a(0,0)*(a(1,1)*b(2) - b(1)*a(2,1)) -
+                a(0,1)*(a(1,0)*b(2) - b(1)*a(2,0)) +
+                b(0)*(a(1,0)*a(2,1) - a(1,1)*a(2,0)));
+        return true;
+    }
+};
+
+} // internal
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::randu(_Tp a, _Tp b)
+{
+    Matx<_Tp,m,n> M;
+    cv::randu(M, Scalar(a), Scalar(b));
+    return M;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::randn(_Tp a, _Tp b)
+{
+    Matx<_Tp,m,n> M;
+    cv::randn(M, Scalar(a), Scalar(b));
+    return M;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, n, m> Matx<_Tp, m, n>::inv(int method, bool *p_is_ok /*= NULL*/) const
+{
+    Matx<_Tp, n, m> b;
+    bool ok;
+    if( method == DECOMP_LU || method == DECOMP_CHOLESKY )
+        ok = cv::internal::Matx_FastInvOp<_Tp, m>()(*this, b, method);
+    else
+    {
+        Mat A(*this, false), B(b, false);
+        ok = (invert(A, B, method) != 0);
+    }
+    if( NULL != p_is_ok ) { *p_is_ok = ok; }
+    return ok ? b : Matx<_Tp, n, m>::zeros();
+}
+
+template<typename _Tp, int m, int n> template<int l> inline
+Matx<_Tp, n, l> Matx<_Tp, m, n>::solve(const Matx<_Tp, m, l>& rhs, int method) const
+{
+    Matx<_Tp, n, l> x;
+    bool ok;
+    if( method == DECOMP_LU || method == DECOMP_CHOLESKY )
+        ok = cv::internal::Matx_FastSolveOp<_Tp, m, l>()(*this, rhs, x, method);
+    else
+    {
+        Mat A(*this, false), B(rhs, false), X(x, false);
+        ok = cv::solve(A, B, X, method);
+    }
+
+    return ok ? x : Matx<_Tp, n, l>::zeros();
+}
+
+
+
+////////////////////////// Augmenting algebraic & logical operations //////////////////////////
+
+#define CV_MAT_AUG_OPERATOR1(op, cvop, A, B) \
+    static inline A& operator op (A& a, const B& b) { cvop; return a; }
+
+#define CV_MAT_AUG_OPERATOR(op, cvop, A, B)   \
+    CV_MAT_AUG_OPERATOR1(op, cvop, A, B)      \
+    CV_MAT_AUG_OPERATOR1(op, cvop, const A, B)
+
+#define CV_MAT_AUG_OPERATOR_T(op, cvop, A, B)                   \
+    template<typename _Tp> CV_MAT_AUG_OPERATOR1(op, cvop, A, B) \
+    template<typename _Tp> CV_MAT_AUG_OPERATOR1(op, cvop, const A, B)
+
+CV_MAT_AUG_OPERATOR  (+=, cv::add(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (+=, cv::add(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+CV_MAT_AUG_OPERATOR  (-=, cv::subtract(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (-=, cv::subtract(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+CV_MAT_AUG_OPERATOR  (*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat, Mat)
+CV_MAT_AUG_OPERATOR_T(*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat_<_Tp>, Mat_<_Tp>)
+CV_MAT_AUG_OPERATOR  (*=, a.convertTo(a, -1, b), Mat, double)
+CV_MAT_AUG_OPERATOR_T(*=, a.convertTo(a, -1, b), Mat_<_Tp>, double)
+
+CV_MAT_AUG_OPERATOR  (/=, cv::divide(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR_T(/=, cv::divide(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(/=, cv::divide(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+CV_MAT_AUG_OPERATOR  (/=, a.convertTo((Mat&)a, -1, 1./b), Mat, double)
+CV_MAT_AUG_OPERATOR_T(/=, a.convertTo((Mat&)a, -1, 1./b), Mat_<_Tp>, double)
+
+CV_MAT_AUG_OPERATOR  (&=, cv::bitwise_and(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (&=, cv::bitwise_and(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+CV_MAT_AUG_OPERATOR  (|=, cv::bitwise_or(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (|=, cv::bitwise_or(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+CV_MAT_AUG_OPERATOR  (^=, cv::bitwise_xor(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (^=, cv::bitwise_xor(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+#undef CV_MAT_AUG_OPERATOR_T
+#undef CV_MAT_AUG_OPERATOR
+#undef CV_MAT_AUG_OPERATOR1
+
+
+
+///////////////////////////////////////////// SVD /////////////////////////////////////////////
+
+inline SVD::SVD() {}
+inline SVD::SVD( InputArray m, int flags ) { operator ()(m, flags); }
+inline void SVD::solveZ( InputArray m, OutputArray _dst )
+{
+    Mat mtx = m.getMat();
+    SVD svd(mtx, (mtx.rows >= mtx.cols ? 0 : SVD::FULL_UV));
+    _dst.create(svd.vt.cols, 1, svd.vt.type());
+    Mat dst = _dst.getMat();
+    svd.vt.row(svd.vt.rows-1).reshape(1,svd.vt.cols).copyTo(dst);
+}
+
+template<typename _Tp, int m, int n, int nm> inline void
+    SVD::compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w, Matx<_Tp, m, nm>& u, Matx<_Tp, n, nm>& vt )
+{
+    CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector.");
+    Mat _a(a, false), _u(u, false), _w(w, false), _vt(vt, false);
+    SVD::compute(_a, _w, _u, _vt);
+    CV_Assert(_w.data == (uchar*)&w.val[0] && _u.data == (uchar*)&u.val[0] && _vt.data == (uchar*)&vt.val[0]);
+}
+
+template<typename _Tp, int m, int n, int nm> inline void
+SVD::compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w )
+{
+    CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector.");
+    Mat _a(a, false), _w(w, false);
+    SVD::compute(_a, _w);
+    CV_Assert(_w.data == (uchar*)&w.val[0]);
+}
+
+template<typename _Tp, int m, int n, int nm, int nb> inline void
+SVD::backSubst( const Matx<_Tp, nm, 1>& w, const Matx<_Tp, m, nm>& u,
+                const Matx<_Tp, n, nm>& vt, const Matx<_Tp, m, nb>& rhs,
+                Matx<_Tp, n, nb>& dst )
+{
+    CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector.");
+    Mat _u(u, false), _w(w, false), _vt(vt, false), _rhs(rhs, false), _dst(dst, false);
+    SVD::backSubst(_w, _u, _vt, _rhs, _dst);
+    CV_Assert(_dst.data == (uchar*)&dst.val[0]);
+}
+
+
+
+/////////////////////////////////// Multiply-with-Carry RNG ///////////////////////////////////
+
+inline RNG::RNG()              { state = 0xffffffff; }
+inline RNG::RNG(uint64 _state) { state = _state ? _state : 0xffffffff; }
+
+inline RNG::operator uchar()    { return (uchar)next(); }
+inline RNG::operator schar()    { return (schar)next(); }
+inline RNG::operator ushort()   { return (ushort)next(); }
+inline RNG::operator short()    { return (short)next(); }
+inline RNG::operator int()      { return (int)next(); }
+inline RNG::operator unsigned() { return next(); }
+inline RNG::operator float()    { return next()*2.3283064365386962890625e-10f; }
+inline RNG::operator double()   { unsigned t = next(); return (((uint64)t << 32) | next()) * 5.4210108624275221700372640043497e-20; }
+
+inline unsigned RNG::operator ()(unsigned N) { return (unsigned)uniform(0,N); }
+inline unsigned RNG::operator ()()           { return next(); }
+
+inline int    RNG::uniform(int a, int b)       { return a == b ? a : (int)(next() % (b - a) + a); }
+inline float  RNG::uniform(float a, float b)   { return ((float)*this)*(b - a) + a; }
+inline double RNG::uniform(double a, double b) { return ((double)*this)*(b - a) + a; }
+
+inline unsigned RNG::next()
+{
+    state = (uint64)(unsigned)state* /*CV_RNG_COEFF*/ 4164903690U + (unsigned)(state >> 32);
+    return (unsigned)state;
+}
+
+//! returns the next unifomly-distributed random number of the specified type
+template<typename _Tp> static inline _Tp randu()
+{
+  return (_Tp)theRNG();
+}
+
+///////////////////////////////// Formatted string generation /////////////////////////////////
+
+CV_EXPORTS String format( const char* fmt, ... );
+
+///////////////////////////////// Formatted output of cv::Mat /////////////////////////////////
+
+static inline
+Ptr<Formatted> format(InputArray mtx, int fmt)
+{
+    return Formatter::get(fmt)->format(mtx.getMat());
+}
+
+static inline
+int print(Ptr<Formatted> fmtd, FILE* stream = stdout)
+{
+    int written = 0;
+    fmtd->reset();
+    for(const char* str = fmtd->next(); str; str = fmtd->next())
+        written += fputs(str, stream);
+
+    return written;
+}
+
+static inline
+int print(const Mat& mtx, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(mtx), stream);
+}
+
+static inline
+int print(const UMat& mtx, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(mtx.getMat(ACCESS_READ)), stream);
+}
+
+template<typename _Tp> static inline
+int print(const std::vector<Point_<_Tp> >& vec, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(Mat(vec)), stream);
+}
+
+template<typename _Tp> static inline
+int print(const std::vector<Point3_<_Tp> >& vec, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(Mat(vec)), stream);
+}
+
+template<typename _Tp, int m, int n> static inline
+int print(const Matx<_Tp, m, n>& matx, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(cv::Mat(matx)), stream);
+}
+
+//! @endcond
+
+/****************************************************************************************\
+*                                  Auxiliary algorithms                                  *
+\****************************************************************************************/
+
+/** @brief Splits an element set into equivalency classes.
+
+The generic function partition implements an \f$O(N^2)\f$ algorithm for splitting a set of \f$N\f$ elements
+into one or more equivalency classes, as described in
+<http://en.wikipedia.org/wiki/Disjoint-set_data_structure> . The function returns the number of
+equivalency classes.
+@param _vec Set of elements stored as a vector.
+@param labels Output vector of labels. It contains as many elements as vec. Each label labels[i] is
+a 0-based cluster index of `vec[i]`.
+@param predicate Equivalence predicate (pointer to a boolean function of two arguments or an
+instance of the class that has the method bool operator()(const _Tp& a, const _Tp& b) ). The
+predicate returns true when the elements are certainly in the same class, and returns false if they
+may or may not be in the same class.
+@ingroup core_cluster
+*/
+template<typename _Tp, class _EqPredicate> int
+partition( const std::vector<_Tp>& _vec, std::vector<int>& labels,
+          _EqPredicate predicate=_EqPredicate())
+{
+    int i, j, N = (int)_vec.size();
+    const _Tp* vec = &_vec[0];
+
+    const int PARENT=0;
+    const int RANK=1;
+
+    std::vector<int> _nodes(N*2);
+    int (*nodes)[2] = (int(*)[2])&_nodes[0];
+
+    // The first O(N) pass: create N single-vertex trees
+    for(i = 0; i < N; i++)
+    {
+        nodes[i][PARENT]=-1;
+        nodes[i][RANK] = 0;
+    }
+
+    // The main O(N^2) pass: merge connected components
+    for( i = 0; i < N; i++ )
+    {
+        int root = i;
+
+        // find root
+        while( nodes[root][PARENT] >= 0 )
+            root = nodes[root][PARENT];
+
+        for( j = 0; j < N; j++ )
+        {
+            if( i == j || !predicate(vec[i], vec[j]))
+                continue;
+            int root2 = j;
+
+            while( nodes[root2][PARENT] >= 0 )
+                root2 = nodes[root2][PARENT];
+
+            if( root2 != root )
+            {
+                // unite both trees
+                int rank = nodes[root][RANK], rank2 = nodes[root2][RANK];
+                if( rank > rank2 )
+                    nodes[root2][PARENT] = root;
+                else
+                {
+                    nodes[root][PARENT] = root2;
+                    nodes[root2][RANK] += rank == rank2;
+                    root = root2;
+                }
+                CV_Assert( nodes[root][PARENT] < 0 );
+
+                int k = j, parent;
+
+                // compress the path from node2 to root
+                while( (parent = nodes[k][PARENT]) >= 0 )
+                {
+                    nodes[k][PARENT] = root;
+                    k = parent;
+                }
+
+                // compress the path from node to root
+                k = i;
+                while( (parent = nodes[k][PARENT]) >= 0 )
+                {
+                    nodes[k][PARENT] = root;
+                    k = parent;
+                }
+            }
+        }
+    }
+
+    // Final O(N) pass: enumerate classes
+    labels.resize(N);
+    int nclasses = 0;
+
+    for( i = 0; i < N; i++ )
+    {
+        int root = i;
+        while( nodes[root][PARENT] >= 0 )
+            root = nodes[root][PARENT];
+        // re-use the rank as the class label
+        if( nodes[root][RANK] >= 0 )
+            nodes[root][RANK] = ~nclasses++;
+        labels[i] = ~nodes[root][RANK];
+    }
+
+    return nclasses;
+}
+
+} // cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp
new file mode 100644
index 0000000..23e2155
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp
@@ -0,0 +1,302 @@
+/*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) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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 OpenCV Foundation 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*/
+
+#ifndef __OPENCV_OPTIM_HPP__
+#define __OPENCV_OPTIM_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+
+/** @addtogroup core_optim
+The algorithms in this section minimize or maximize function value within specified constraints or
+without any constraints.
+@{
+*/
+
+/** @brief Basic interface for all solvers
+ */
+class CV_EXPORTS MinProblemSolver : public Algorithm
+{
+public:
+    /** @brief Represents function being optimized
+     */
+    class CV_EXPORTS Function
+    {
+    public:
+        virtual ~Function() {}
+        virtual int getDims() const = 0;
+        virtual double getGradientEps() const;
+        virtual double calc(const double* x) const = 0;
+        virtual void getGradient(const double* x,double* grad);
+    };
+
+    /** @brief Getter for the optimized function.
+
+    The optimized function is represented by Function interface, which requires derivatives to
+    implement the sole method calc(double*) to evaluate the function.
+
+    @return Smart-pointer to an object that implements Function interface - it represents the
+    function that is being optimized. It can be empty, if no function was given so far.
+     */
+    virtual Ptr<Function> getFunction() const = 0;
+
+    /** @brief Setter for the optimized function.
+
+    *It should be called at least once before the call to* minimize(), as default value is not usable.
+
+    @param f The new function to optimize.
+     */
+    virtual void setFunction(const Ptr<Function>& f) = 0;
+
+    /** @brief Getter for the previously set terminal criteria for this algorithm.
+
+    @return Deep copy of the terminal criteria used at the moment.
+     */
+    virtual TermCriteria getTermCriteria() const = 0;
+
+    /** @brief Set terminal criteria for solver.
+
+    This method *is not necessary* to be called before the first call to minimize(), as the default
+    value is sensible.
+
+    Algorithm stops when the number of function evaluations done exceeds termcrit.maxCount, when
+    the function values at the vertices of simplex are within termcrit.epsilon range or simplex
+    becomes so small that it can enclosed in a box with termcrit.epsilon sides, whatever comes
+    first.
+    @param termcrit Terminal criteria to be used, represented as cv::TermCriteria structure.
+     */
+    virtual void setTermCriteria(const TermCriteria& termcrit) = 0;
+
+    /** @brief actually runs the algorithm and performs the minimization.
+
+    The sole input parameter determines the centroid of the starting simplex (roughly, it tells
+    where to start), all the others (terminal criteria, initial step, function to be minimized) are
+    supposed to be set via the setters before the call to this method or the default values (not
+    always sensible) will be used.
+
+    @param x The initial point, that will become a centroid of an initial simplex. After the algorithm
+    will terminate, it will be setted to the point where the algorithm stops, the point of possible
+    minimum.
+    @return The value of a function at the point found.
+     */
+    virtual double minimize(InputOutputArray x) = 0;
+};
+
+/** @brief This class is used to perform the non-linear non-constrained minimization of a function,
+
+defined on an `n`-dimensional Euclidean space, using the **Nelder-Mead method**, also known as
+**downhill simplex method**. The basic idea about the method can be obtained from
+<http://en.wikipedia.org/wiki/Nelder-Mead_method>.
+
+It should be noted, that this method, although deterministic, is rather a heuristic and therefore
+may converge to a local minima, not necessary a global one. It is iterative optimization technique,
+which at each step uses an information about the values of a function evaluated only at `n+1`
+points, arranged as a *simplex* in `n`-dimensional space (hence the second name of the method). At
+each step new point is chosen to evaluate function at, obtained value is compared with previous
+ones and based on this information simplex changes it's shape , slowly moving to the local minimum.
+Thus this method is using *only* function values to make decision, on contrary to, say, Nonlinear
+Conjugate Gradient method (which is also implemented in optim).
+
+Algorithm stops when the number of function evaluations done exceeds termcrit.maxCount, when the
+function values at the vertices of simplex are within termcrit.epsilon range or simplex becomes so
+small that it can enclosed in a box with termcrit.epsilon sides, whatever comes first, for some
+defined by user positive integer termcrit.maxCount and positive non-integer termcrit.epsilon.
+
+@note DownhillSolver is a derivative of the abstract interface
+cv::MinProblemSolver, which in turn is derived from the Algorithm interface and is used to
+encapsulate the functionality, common to all non-linear optimization algorithms in the optim
+module.
+
+@note term criteria should meet following condition:
+@code
+    termcrit.type == (TermCriteria::MAX_ITER + TermCriteria::EPS) && termcrit.epsilon > 0 && termcrit.maxCount > 0
+@endcode
+ */
+class CV_EXPORTS DownhillSolver : public MinProblemSolver
+{
+public:
+    /** @brief Returns the initial step that will be used in downhill simplex algorithm.
+
+    @param step Initial step that will be used in algorithm. Note, that although corresponding setter
+    accepts column-vectors as well as row-vectors, this method will return a row-vector.
+    @see DownhillSolver::setInitStep
+     */
+    virtual void getInitStep(OutputArray step) const=0;
+
+    /** @brief Sets the initial step that will be used in downhill simplex algorithm.
+
+    Step, together with initial point (givin in DownhillSolver::minimize) are two `n`-dimensional
+    vectors that are used to determine the shape of initial simplex. Roughly said, initial point
+    determines the position of a simplex (it will become simplex's centroid), while step determines the
+    spread (size in each dimension) of a simplex. To be more precise, if \f$s,x_0\in\mathbb{R}^n\f$ are
+    the initial step and initial point respectively, the vertices of a simplex will be:
+    \f$v_0:=x_0-\frac{1}{2} s\f$ and \f$v_i:=x_0+s_i\f$ for \f$i=1,2,\dots,n\f$ where \f$s_i\f$ denotes
+    projections of the initial step of *n*-th coordinate (the result of projection is treated to be
+    vector given by \f$s_i:=e_i\cdot\left<e_i\cdot s\right>\f$, where \f$e_i\f$ form canonical basis)
+
+    @param step Initial step that will be used in algorithm. Roughly said, it determines the spread
+    (size in each dimension) of an initial simplex.
+     */
+    virtual void setInitStep(InputArray step)=0;
+
+    /** @brief This function returns the reference to the ready-to-use DownhillSolver object.
+
+    All the parameters are optional, so this procedure can be called even without parameters at
+    all. In this case, the default values will be used. As default value for terminal criteria are
+    the only sensible ones, MinProblemSolver::setFunction() and DownhillSolver::setInitStep()
+    should be called upon the obtained object, if the respective parameters were not given to
+    create(). Otherwise, the two ways (give parameters to createDownhillSolver() or miss them out
+    and call the MinProblemSolver::setFunction() and DownhillSolver::setInitStep()) are absolutely
+    equivalent (and will drop the same errors in the same way, should invalid input be detected).
+    @param f Pointer to the function that will be minimized, similarly to the one you submit via
+    MinProblemSolver::setFunction.
+    @param initStep Initial step, that will be used to construct the initial simplex, similarly to the one
+    you submit via MinProblemSolver::setInitStep.
+    @param termcrit Terminal criteria to the algorithm, similarly to the one you submit via
+    MinProblemSolver::setTermCriteria.
+     */
+    static Ptr<DownhillSolver> create(const Ptr<MinProblemSolver::Function>& f=Ptr<MinProblemSolver::Function>(),
+                                      InputArray initStep=Mat_<double>(1,1,0.0),
+                                      TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001));
+};
+
+/** @brief This class is used to perform the non-linear non-constrained minimization of a function
+with known gradient,
+
+defined on an *n*-dimensional Euclidean space, using the **Nonlinear Conjugate Gradient method**.
+The implementation was done based on the beautifully clear explanatory article [An Introduction to
+the Conjugate Gradient Method Without the Agonizing
+Pain](http://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf) by Jonathan Richard
+Shewchuk. The method can be seen as an adaptation of a standard Conjugate Gradient method (see, for
+example <http://en.wikipedia.org/wiki/Conjugate_gradient_method>) for numerically solving the
+systems of linear equations.
+
+It should be noted, that this method, although deterministic, is rather a heuristic method and
+therefore may converge to a local minima, not necessary a global one. What is even more disastrous,
+most of its behaviour is ruled by gradient, therefore it essentially cannot distinguish between
+local minima and maxima. Therefore, if it starts sufficiently near to the local maximum, it may
+converge to it. Another obvious restriction is that it should be possible to compute the gradient of
+a function at any point, thus it is preferable to have analytic expression for gradient and
+computational burden should be born by the user.
+
+The latter responsibility is accompilished via the getGradient method of a
+MinProblemSolver::Function interface (which represents function being optimized). This method takes
+point a point in *n*-dimensional space (first argument represents the array of coordinates of that
+point) and comput its gradient (it should be stored in the second argument as an array).
+
+@note class ConjGradSolver thus does not add any new methods to the basic MinProblemSolver interface.
+
+@note term criteria should meet following condition:
+@code
+    termcrit.type == (TermCriteria::MAX_ITER + TermCriteria::EPS) && termcrit.epsilon > 0 && termcrit.maxCount > 0
+    // or
+    termcrit.type == TermCriteria::MAX_ITER) && termcrit.maxCount > 0
+@endcode
+ */
+class CV_EXPORTS ConjGradSolver : public MinProblemSolver
+{
+public:
+    /** @brief This function returns the reference to the ready-to-use ConjGradSolver object.
+
+    All the parameters are optional, so this procedure can be called even without parameters at
+    all. In this case, the default values will be used. As default value for terminal criteria are
+    the only sensible ones, MinProblemSolver::setFunction() should be called upon the obtained
+    object, if the function was not given to create(). Otherwise, the two ways (submit it to
+    create() or miss it out and call the MinProblemSolver::setFunction()) are absolutely equivalent
+    (and will drop the same errors in the same way, should invalid input be detected).
+    @param f Pointer to the function that will be minimized, similarly to the one you submit via
+    MinProblemSolver::setFunction.
+    @param termcrit Terminal criteria to the algorithm, similarly to the one you submit via
+    MinProblemSolver::setTermCriteria.
+    */
+    static Ptr<ConjGradSolver> create(const Ptr<MinProblemSolver::Function>& f=Ptr<ConjGradSolver::Function>(),
+                                      TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001));
+};
+
+//! return codes for cv::solveLP() function
+enum SolveLPResult
+{
+    SOLVELP_UNBOUNDED    = -2, //!< problem is unbounded (target function can achieve arbitrary high values)
+    SOLVELP_UNFEASIBLE    = -1, //!< problem is unfeasible (there are no points that satisfy all the constraints imposed)
+    SOLVELP_SINGLE    = 0, //!< there is only one maximum for target function
+    SOLVELP_MULTI    = 1 //!< there are multiple maxima for target function - the arbitrary one is returned
+};
+
+/** @brief Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method).
+
+What we mean here by "linear programming problem" (or LP problem, for short) can be formulated as:
+
+\f[\mbox{Maximize } c\cdot x\\
+ \mbox{Subject to:}\\
+ Ax\leq b\\
+ x\geq 0\f]
+
+Where \f$c\f$ is fixed `1`-by-`n` row-vector, \f$A\f$ is fixed `m`-by-`n` matrix, \f$b\f$ is fixed `m`-by-`1`
+column vector and \f$x\f$ is an arbitrary `n`-by-`1` column vector, which satisfies the constraints.
+
+Simplex algorithm is one of many algorithms that are designed to handle this sort of problems
+efficiently. Although it is not optimal in theoretical sense (there exist algorithms that can solve
+any problem written as above in polynomial time, while simplex method degenerates to exponential
+time for some special cases), it is well-studied, easy to implement and is shown to work well for
+real-life purposes.
+
+The particular implementation is taken almost verbatim from **Introduction to Algorithms, third
+edition** by T. H. Cormen, C. E. Leiserson, R. L. Rivest and Clifford Stein. In particular, the
+Bland's rule <http://en.wikipedia.org/wiki/Bland%27s_rule> is used to prevent cycling.
+
+@param Func This row-vector corresponds to \f$c\f$ in the LP problem formulation (see above). It should
+contain 32- or 64-bit floating point numbers. As a convenience, column-vector may be also submitted,
+in the latter case it is understood to correspond to \f$c^T\f$.
+@param Constr `m`-by-`n+1` matrix, whose rightmost column corresponds to \f$b\f$ in formulation above
+and the remaining to \f$A\f$. It should containt 32- or 64-bit floating point numbers.
+@param z The solution will be returned here as a column-vector - it corresponds to \f$c\f$ in the
+formulation above. It will contain 64-bit floating point numbers.
+@return One of cv::SolveLPResult
+ */
+CV_EXPORTS_W int solveLP(const Mat& Func, const Mat& Constr, Mat& z);
+
+//! @}
+
+}// cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp
new file mode 100644
index 0000000..17686dd
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp
@@ -0,0 +1,1195 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_PERSISTENCE_HPP__
+#define __OPENCV_CORE_PERSISTENCE_HPP__
+
+#ifndef __cplusplus
+#  error persistence.hpp header must be compiled as C++
+#endif
+
+//! @addtogroup core_c
+//! @{
+
+/** @brief "black box" representation of the file storage associated with a file on disk.
+
+Several functions that are described below take CvFileStorage\* as inputs and allow the user to
+save or to load hierarchical collections that consist of scalar values, standard CXCore objects
+(such as matrices, sequences, graphs), and user-defined objects.
+
+OpenCV can read and write data in XML (<http://www.w3c.org/XML>) or YAML (<http://www.yaml.org>)
+formats. Below is an example of 3x3 floating-point identity matrix A, stored in XML and YAML files
+using CXCore functions:
+XML:
+@code{.xml}
+    <?xml version="1.0">
+    <opencv_storage>
+    <A type_id="opencv-matrix">
+      <rows>3</rows>
+      <cols>3</cols>
+      <dt>f</dt>
+      <data>1. 0. 0. 0. 1. 0. 0. 0. 1.</data>
+    </A>
+    </opencv_storage>
+@endcode
+YAML:
+@code{.yaml}
+    %YAML:1.0
+    A: !!opencv-matrix
+      rows: 3
+      cols: 3
+      dt: f
+      data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1.]
+@endcode
+As it can be seen from the examples, XML uses nested tags to represent hierarchy, while YAML uses
+indentation for that purpose (similar to the Python programming language).
+
+The same functions can read and write data in both formats; the particular format is determined by
+the extension of the opened file, ".xml" for XML files and ".yml" or ".yaml" for YAML.
+ */
+typedef struct CvFileStorage CvFileStorage;
+typedef struct CvFileNode CvFileNode;
+
+//! @} core_c
+
+#include "opencv2/core/types.hpp"
+#include "opencv2/core/mat.hpp"
+
+namespace cv {
+
+/** @addtogroup core_xml
+
+XML/YAML file storages.     {#xml_storage}
+=======================
+Writing to a file storage.
+--------------------------
+You can store and then restore various OpenCV data structures to/from XML (<http://www.w3c.org/XML>)
+or YAML (<http://www.yaml.org>) formats. Also, it is possible store and load arbitrarily complex
+data structures, which include OpenCV data structures, as well as primitive data types (integer and
+floating-point numbers and text strings) as their elements.
+
+Use the following procedure to write something to XML or YAML:
+-# Create new FileStorage and open it for writing. It can be done with a single call to
+FileStorage::FileStorage constructor that takes a filename, or you can use the default constructor
+and then call FileStorage::open. Format of the file (XML or YAML) is determined from the filename
+extension (".xml" and ".yml"/".yaml", respectively)
+-# Write all the data you want using the streaming operator `<<`, just like in the case of STL
+streams.
+-# Close the file using FileStorage::release. FileStorage destructor also closes the file.
+
+Here is an example:
+@code
+    #include "opencv2/opencv.hpp"
+    #include <time.h>
+
+    using namespace cv;
+
+    int main(int, char** argv)
+    {
+        FileStorage fs("test.yml", FileStorage::WRITE);
+
+        fs << "frameCount" << 5;
+        time_t rawtime; time(&rawtime);
+        fs << "calibrationDate" << asctime(localtime(&rawtime));
+        Mat cameraMatrix = (Mat_<double>(3,3) << 1000, 0, 320, 0, 1000, 240, 0, 0, 1);
+        Mat distCoeffs = (Mat_<double>(5,1) << 0.1, 0.01, -0.001, 0, 0);
+        fs << "cameraMatrix" << cameraMatrix << "distCoeffs" << distCoeffs;
+        fs << "features" << "[";
+        for( int i = 0; i < 3; i++ )
+        {
+            int x = rand() % 640;
+            int y = rand() % 480;
+            uchar lbp = rand() % 256;
+
+            fs << "{:" << "x" << x << "y" << y << "lbp" << "[:";
+            for( int j = 0; j < 8; j++ )
+                fs << ((lbp >> j) & 1);
+            fs << "]" << "}";
+        }
+        fs << "]";
+        fs.release();
+        return 0;
+    }
+@endcode
+The sample above stores to XML and integer, text string (calibration date), 2 matrices, and a custom
+structure "feature", which includes feature coordinates and LBP (local binary pattern) value. Here
+is output of the sample:
+@code{.yaml}
+%YAML:1.0
+frameCount: 5
+calibrationDate: "Fri Jun 17 14:09:29 2011\n"
+cameraMatrix: !!opencv-matrix
+   rows: 3
+   cols: 3
+   dt: d
+   data: [ 1000., 0., 320., 0., 1000., 240., 0., 0., 1. ]
+distCoeffs: !!opencv-matrix
+   rows: 5
+   cols: 1
+   dt: d
+   data: [ 1.0000000000000001e-01, 1.0000000000000000e-02,
+       -1.0000000000000000e-03, 0., 0. ]
+features:
+   - { x:167, y:49, lbp:[ 1, 0, 0, 1, 1, 0, 1, 1 ] }
+   - { x:298, y:130, lbp:[ 0, 0, 0, 1, 0, 0, 1, 1 ] }
+   - { x:344, y:158, lbp:[ 1, 1, 0, 0, 0, 0, 1, 0 ] }
+@endcode
+
+As an exercise, you can replace ".yml" with ".xml" in the sample above and see, how the
+corresponding XML file will look like.
+
+Several things can be noted by looking at the sample code and the output:
+
+-   The produced YAML (and XML) consists of heterogeneous collections that can be nested. There are 2
+    types of collections: named collections (mappings) and unnamed collections (sequences). In mappings
+    each element has a name and is accessed by name. This is similar to structures and std::map in
+    C/C++ and dictionaries in Python. In sequences elements do not have names, they are accessed by
+    indices. This is similar to arrays and std::vector in C/C++ and lists, tuples in Python.
+    "Heterogeneous" means that elements of each single collection can have different types.
+
+    Top-level collection in YAML/XML is a mapping. Each matrix is stored as a mapping, and the matrix
+    elements are stored as a sequence. Then, there is a sequence of features, where each feature is
+    represented a mapping, and lbp value in a nested sequence.
+
+-   When you write to a mapping (a structure), you write element name followed by its value. When you
+    write to a sequence, you simply write the elements one by one. OpenCV data structures (such as
+    cv::Mat) are written in absolutely the same way as simple C data structures - using `<<`
+    operator.
+
+-   To write a mapping, you first write the special string `{` to the storage, then write the
+    elements as pairs (`fs << <element_name> << <element_value>`) and then write the closing
+    `}`.
+
+-   To write a sequence, you first write the special string `[`, then write the elements, then
+    write the closing `]`.
+
+-   In YAML (but not XML), mappings and sequences can be written in a compact Python-like inline
+    form. In the sample above matrix elements, as well as each feature, including its lbp value, is
+    stored in such inline form. To store a mapping/sequence in a compact form, put `:` after the
+    opening character, e.g. use `{:` instead of `{` and `[:` instead of `[`. When the
+    data is written to XML, those extra `:` are ignored.
+
+Reading data from a file storage.
+---------------------------------
+To read the previously written XML or YAML file, do the following:
+-#  Open the file storage using FileStorage::FileStorage constructor or FileStorage::open method.
+    In the current implementation the whole file is parsed and the whole representation of file
+    storage is built in memory as a hierarchy of file nodes (see FileNode)
+
+-#  Read the data you are interested in. Use FileStorage::operator [], FileNode::operator []
+    and/or FileNodeIterator.
+
+-#  Close the storage using FileStorage::release.
+
+Here is how to read the file created by the code sample above:
+@code
+    FileStorage fs2("test.yml", FileStorage::READ);
+
+    // first method: use (type) operator on FileNode.
+    int frameCount = (int)fs2["frameCount"];
+
+    String date;
+    // second method: use FileNode::operator >>
+    fs2["calibrationDate"] >> date;
+
+    Mat cameraMatrix2, distCoeffs2;
+    fs2["cameraMatrix"] >> cameraMatrix2;
+    fs2["distCoeffs"] >> distCoeffs2;
+
+    cout << "frameCount: " << frameCount << endl
+         << "calibration date: " << date << endl
+         << "camera matrix: " << cameraMatrix2 << endl
+         << "distortion coeffs: " << distCoeffs2 << endl;
+
+    FileNode features = fs2["features"];
+    FileNodeIterator it = features.begin(), it_end = features.end();
+    int idx = 0;
+    std::vector<uchar> lbpval;
+
+    // iterate through a sequence using FileNodeIterator
+    for( ; it != it_end; ++it, idx++ )
+    {
+        cout << "feature #" << idx << ": ";
+        cout << "x=" << (int)(*it)["x"] << ", y=" << (int)(*it)["y"] << ", lbp: (";
+        // you can also easily read numerical arrays using FileNode >> std::vector operator.
+        (*it)["lbp"] >> lbpval;
+        for( int i = 0; i < (int)lbpval.size(); i++ )
+            cout << " " << (int)lbpval[i];
+        cout << ")" << endl;
+    }
+    fs2.release();
+@endcode
+
+Format specification    {#format_spec}
+--------------------
+`([count]{u|c|w|s|i|f|d})`... where the characters correspond to fundamental C++ types:
+-   `u` 8-bit unsigned number
+-   `c` 8-bit signed number
+-   `w` 16-bit unsigned number
+-   `s` 16-bit signed number
+-   `i` 32-bit signed number
+-   `f` single precision floating-point number
+-   `d` double precision floating-point number
+-   `r` pointer, 32 lower bits of which are written as a signed integer. The type can be used to
+    store structures with links between the elements.
+
+`count` is the optional counter of values of a given type. For example, `2if` means that each array
+element is a structure of 2 integers, followed by a single-precision floating-point number. The
+equivalent notations of the above specification are `iif`, `2i1f` and so forth. Other examples: `u`
+means that the array consists of bytes, and `2d` means the array consists of pairs of doubles.
+
+@see @ref filestorage.cpp
+*/
+
+//! @{
+
+/** @example filestorage.cpp
+A complete example using the FileStorage interface
+*/
+
+////////////////////////// XML & YAML I/O //////////////////////////
+
+class CV_EXPORTS FileNode;
+class CV_EXPORTS FileNodeIterator;
+
+/** @brief XML/YAML file storage class that encapsulates all the information necessary for writing or reading
+data to/from a file.
+ */
+class CV_EXPORTS_W FileStorage
+{
+public:
+    //! file storage mode
+    enum Mode
+    {
+        READ        = 0, //!< value, open the file for reading
+        WRITE       = 1, //!< value, open the file for writing
+        APPEND      = 2, //!< value, open the file for appending
+        MEMORY      = 4, //!< flag, read data from source or write data to the internal buffer (which is
+                         //!< returned by FileStorage::release)
+        FORMAT_MASK = (7<<3), //!< mask for format flags
+        FORMAT_AUTO = 0,      //!< flag, auto format
+        FORMAT_XML  = (1<<3), //!< flag, XML format
+        FORMAT_YAML = (2<<3)  //!< flag, YAML format
+    };
+    enum
+    {
+        UNDEFINED      = 0,
+        VALUE_EXPECTED = 1,
+        NAME_EXPECTED  = 2,
+        INSIDE_MAP     = 4
+    };
+
+    /** @brief The constructors.
+
+    The full constructor opens the file. Alternatively you can use the default constructor and then
+    call FileStorage::open.
+     */
+    CV_WRAP FileStorage();
+
+    /** @overload
+    @param source Name of the file to open or the text string to read the data from. Extension of the
+    file (.xml or .yml/.yaml) determines its format (XML or YAML respectively). Also you can append .gz
+    to work with compressed files, for example myHugeMatrix.xml.gz. If both FileStorage::WRITE and
+    FileStorage::MEMORY flags are specified, source is used just to specify the output file format (e.g.
+    mydata.xml, .yml etc.).
+    @param flags Mode of operation. See  FileStorage::Mode
+    @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.
+    */
+    CV_WRAP FileStorage(const String& source, int flags, const String& encoding=String());
+
+    /** @overload */
+    FileStorage(CvFileStorage* fs, bool owning=true);
+
+    //! the destructor. calls release()
+    virtual ~FileStorage();
+
+    /** @brief Opens a file.
+
+    See description of parameters in FileStorage::FileStorage. The method calls FileStorage::release
+    before opening the file.
+    @param filename Name of the file to open or the text string to read the data from.
+       Extension of the file (.xml or .yml/.yaml) determines its format (XML or YAML respectively).
+        Also you can append .gz to work with compressed files, for example myHugeMatrix.xml.gz. If both
+        FileStorage::WRITE and FileStorage::MEMORY flags are specified, source is used just to specify
+        the output file format (e.g. mydata.xml, .yml etc.).
+    @param flags Mode of operation. One of FileStorage::Mode
+    @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.
+     */
+    CV_WRAP virtual bool open(const String& filename, int flags, const String& encoding=String());
+
+    /** @brief Checks whether the file is opened.
+
+    @returns true if the object is associated with the current file and false otherwise. It is a
+    good practice to call this method after you tried to open a file.
+     */
+    CV_WRAP virtual bool isOpened() const;
+
+    /** @brief Closes the file and releases all the memory buffers.
+
+    Call this method after all I/O operations with the storage are finished.
+     */
+    CV_WRAP virtual void release();
+
+    /** @brief Closes the file and releases all the memory buffers.
+
+    Call this method after all I/O operations with the storage are finished. If the storage was
+    opened for writing data and FileStorage::WRITE was specified
+     */
+    CV_WRAP virtual String releaseAndGetString();
+
+    /** @brief Returns the first element of the top-level mapping.
+    @returns The first element of the top-level mapping.
+     */
+    CV_WRAP FileNode getFirstTopLevelNode() const;
+
+    /** @brief Returns the top-level mapping
+    @param streamidx Zero-based index of the stream. In most cases there is only one stream in the file.
+    However, YAML supports multiple streams and so there can be several.
+    @returns The top-level mapping.
+     */
+    CV_WRAP FileNode root(int streamidx=0) const;
+
+    /** @brief Returns the specified element of the top-level mapping.
+    @param nodename Name of the file node.
+    @returns Node with the given name.
+     */
+    FileNode operator[](const String& nodename) const;
+
+    /** @overload */
+    CV_WRAP FileNode operator[](const char* nodename) const;
+
+    /** @brief Returns the obsolete C FileStorage structure.
+    @returns Pointer to the underlying C FileStorage structure
+     */
+    CvFileStorage* operator *() { return fs.get(); }
+
+    /** @overload */
+    const CvFileStorage* operator *() const { return fs.get(); }
+
+    /** @brief Writes multiple numbers.
+
+    Writes one or more numbers of the specified format to the currently written structure. Usually it is
+    more convenient to use operator `<<` instead of this method.
+    @param fmt Specification of each array element, see @ref format_spec "format specification"
+    @param vec Pointer to the written array.
+    @param len Number of the uchar elements to write.
+     */
+    void writeRaw( const String& fmt, const uchar* vec, size_t len );
+
+    /** @brief Writes the registered C structure (CvMat, CvMatND, CvSeq).
+    @param name Name of the written object.
+    @param obj Pointer to the object.
+    @see ocvWrite for details.
+     */
+    void writeObj( const String& name, const void* obj );
+
+    /** @brief Returns the normalized object name for the specified name of a file.
+    @param filename Name of a file
+    @returns The normalized object name.
+     */
+    static String getDefaultObjectName(const String& filename);
+
+    Ptr<CvFileStorage> fs; //!< the underlying C FileStorage structure
+    String elname; //!< the currently written element
+    std::vector<char> structs; //!< the stack of written structures
+    int state; //!< the writer state
+};
+
+template<> CV_EXPORTS void DefaultDeleter<CvFileStorage>::operator ()(CvFileStorage* obj) const;
+
+/** @brief File Storage Node class.
+
+The node is used to store each and every element of the file storage opened for reading. When
+XML/YAML file is read, it is first parsed and stored in the memory as a hierarchical collection of
+nodes. Each node can be a 鈥渓eaf鈥� that is contain a single number or a string, or be a collection of
+other nodes. There can be named collections (mappings) where each element has a name and it is
+accessed by a name, and ordered collections (sequences) where elements do not have names but rather
+accessed by index. Type of the file node can be determined using FileNode::type method.
+
+Note that file nodes are only used for navigating file storages opened for reading. When a file
+storage is opened for writing, no data is stored in memory after it is written.
+ */
+class CV_EXPORTS_W_SIMPLE FileNode
+{
+public:
+    //! type of the file storage node
+    enum Type
+    {
+        NONE      = 0, //!< empty node
+        INT       = 1, //!< an integer
+        REAL      = 2, //!< floating-point number
+        FLOAT     = REAL, //!< synonym or REAL
+        STR       = 3, //!< text string in UTF-8 encoding
+        STRING    = STR, //!< synonym for STR
+        REF       = 4, //!< integer of size size_t. Typically used for storing complex dynamic structures where some elements reference the others
+        SEQ       = 5, //!< sequence
+        MAP       = 6, //!< mapping
+        TYPE_MASK = 7,
+        FLOW      = 8,  //!< compact representation of a sequence or mapping. Used only by YAML writer
+        USER      = 16, //!< a registered object (e.g. a matrix)
+        EMPTY     = 32, //!< empty structure (sequence or mapping)
+        NAMED     = 64  //!< the node has a name (i.e. it is element of a mapping)
+    };
+    /** @brief The constructors.
+
+    These constructors are used to create a default file node, construct it from obsolete structures or
+    from the another file node.
+     */
+    CV_WRAP FileNode();
+
+    /** @overload
+    @param fs Pointer to the obsolete file storage structure.
+    @param node File node to be used as initialization for the created file node.
+    */
+    FileNode(const CvFileStorage* fs, const CvFileNode* node);
+
+    /** @overload
+    @param node File node to be used as initialization for the created file node.
+    */
+    FileNode(const FileNode& node);
+
+    /** @brief Returns element of a mapping node or a sequence node.
+    @param nodename Name of an element in the mapping node.
+    @returns Returns the element with the given identifier.
+     */
+    FileNode operator[](const String& nodename) const;
+
+    /** @overload
+    @param nodename Name of an element in the mapping node.
+    */
+    CV_WRAP FileNode operator[](const char* nodename) const;
+
+    /** @overload
+    @param i Index of an element in the sequence node.
+    */
+    CV_WRAP FileNode operator[](int i) const;
+
+    /** @brief Returns type of the node.
+    @returns Type of the node. See FileNode::Type
+     */
+    CV_WRAP int type() const;
+
+    //! returns true if the node is empty
+    CV_WRAP bool empty() const;
+    //! returns true if the node is a "none" object
+    CV_WRAP bool isNone() const;
+    //! returns true if the node is a sequence
+    CV_WRAP bool isSeq() const;
+    //! returns true if the node is a mapping
+    CV_WRAP bool isMap() const;
+    //! returns true if the node is an integer
+    CV_WRAP bool isInt() const;
+    //! returns true if the node is a floating-point number
+    CV_WRAP bool isReal() const;
+    //! returns true if the node is a text string
+    CV_WRAP bool isString() const;
+    //! returns true if the node has a name
+    CV_WRAP bool isNamed() const;
+    //! returns the node name or an empty string if the node is nameless
+    CV_WRAP String name() const;
+    //! returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
+    CV_WRAP size_t size() const;
+    //! returns the node content as an integer. If the node stores floating-point number, it is rounded.
+    operator int() const;
+    //! returns the node content as float
+    operator float() const;
+    //! returns the node content as double
+    operator double() const;
+    //! returns the node content as text string
+    operator String() const;
+#ifndef OPENCV_NOSTL
+    operator std::string() const;
+#endif
+
+    //! returns pointer to the underlying file node
+    CvFileNode* operator *();
+    //! returns pointer to the underlying file node
+    const CvFileNode* operator* () const;
+
+    //! returns iterator pointing to the first node element
+    FileNodeIterator begin() const;
+    //! returns iterator pointing to the element following the last node element
+    FileNodeIterator end() const;
+
+    /** @brief Reads node elements to the buffer with the specified format.
+
+    Usually it is more convenient to use operator `>>` instead of this method.
+    @param fmt Specification of each array element. See @ref format_spec "format specification"
+    @param vec Pointer to the destination array.
+    @param len Number of elements to read. If it is greater than number of remaining elements then all
+    of them will be read.
+     */
+    void readRaw( const String& fmt, uchar* vec, size_t len ) const;
+
+    //! reads the registered object and returns pointer to it
+    void* readObj() const;
+
+    // do not use wrapper pointer classes for better efficiency
+    const CvFileStorage* fs;
+    const CvFileNode* node;
+};
+
+
+/** @brief used to iterate through sequences and mappings.
+
+A standard STL notation, with node.begin(), node.end() denoting the beginning and the end of a
+sequence, stored in node. See the data reading sample in the beginning of the section.
+ */
+class CV_EXPORTS FileNodeIterator
+{
+public:
+    /** @brief The constructors.
+
+    These constructors are used to create a default iterator, set it to specific element in a file node
+    or construct it from another iterator.
+     */
+    FileNodeIterator();
+
+    /** @overload
+    @param fs File storage for the iterator.
+    @param node File node for the iterator.
+    @param ofs Index of the element in the node. The created iterator will point to this element.
+    */
+    FileNodeIterator(const CvFileStorage* fs, const CvFileNode* node, size_t ofs=0);
+
+    /** @overload
+    @param it Iterator to be used as initialization for the created iterator.
+    */
+    FileNodeIterator(const FileNodeIterator& it);
+
+    //! returns the currently observed element
+    FileNode operator *() const;
+    //! accesses the currently observed element methods
+    FileNode operator ->() const;
+
+    //! moves iterator to the next node
+    FileNodeIterator& operator ++ ();
+    //! moves iterator to the next node
+    FileNodeIterator operator ++ (int);
+    //! moves iterator to the previous node
+    FileNodeIterator& operator -- ();
+    //! moves iterator to the previous node
+    FileNodeIterator operator -- (int);
+    //! moves iterator forward by the specified offset (possibly negative)
+    FileNodeIterator& operator += (int ofs);
+    //! moves iterator backward by the specified offset (possibly negative)
+    FileNodeIterator& operator -= (int ofs);
+
+    /** @brief Reads node elements to the buffer with the specified format.
+
+    Usually it is more convenient to use operator `>>` instead of this method.
+    @param fmt Specification of each array element. See @ref format_spec "format specification"
+    @param vec Pointer to the destination array.
+    @param maxCount Number of elements to read. If it is greater than number of remaining elements then
+    all of them will be read.
+     */
+    FileNodeIterator& readRaw( const String& fmt, uchar* vec,
+                               size_t maxCount=(size_t)INT_MAX );
+
+    struct SeqReader
+    {
+      int          header_size;
+      void*        seq;        /* sequence, beign read; CvSeq      */
+      void*        block;      /* current block;        CvSeqBlock */
+      schar*       ptr;        /* pointer to element be read next */
+      schar*       block_min;  /* pointer to the beginning of block */
+      schar*       block_max;  /* pointer to the end of block */
+      int          delta_index;/* = seq->first->start_index   */
+      schar*       prev_elem;  /* pointer to previous element */
+    };
+
+    const CvFileStorage* fs;
+    const CvFileNode* container;
+    SeqReader reader;
+    size_t remaining;
+};
+
+//! @} core_xml
+
+/////////////////// XML & YAML I/O implementation //////////////////
+
+//! @relates cv::FileStorage
+//! @{
+
+CV_EXPORTS void write( FileStorage& fs, const String& name, int value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, float value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, double value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, const String& value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, const Mat& value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, const SparseMat& value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, const std::vector<KeyPoint>& value);
+CV_EXPORTS void write( FileStorage& fs, const String& name, const std::vector<DMatch>& value);
+
+CV_EXPORTS void writeScalar( FileStorage& fs, int value );
+CV_EXPORTS void writeScalar( FileStorage& fs, float value );
+CV_EXPORTS void writeScalar( FileStorage& fs, double value );
+CV_EXPORTS void writeScalar( FileStorage& fs, const String& value );
+
+//! @}
+
+//! @relates cv::FileNode
+//! @{
+
+CV_EXPORTS void read(const FileNode& node, int& value, int default_value);
+CV_EXPORTS void read(const FileNode& node, float& value, float default_value);
+CV_EXPORTS void read(const FileNode& node, double& value, double default_value);
+CV_EXPORTS void read(const FileNode& node, String& value, const String& default_value);
+CV_EXPORTS void read(const FileNode& node, Mat& mat, const Mat& default_mat = Mat() );
+CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat = SparseMat() );
+CV_EXPORTS void read(const FileNode& node, std::vector<KeyPoint>& keypoints);
+CV_EXPORTS void read(const FileNode& node, std::vector<DMatch>& matches);
+
+template<typename _Tp> static inline void read(const FileNode& node, Point_<_Tp>& value, const Point_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 2 ? default_value : Point_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Point3_<_Tp>& value, const Point3_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 3 ? default_value : Point3_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
+                                                            saturate_cast<_Tp>(temp[2]));
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Size_<_Tp>& value, const Size_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 2 ? default_value : Size_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Complex<_Tp>& value, const Complex<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 2 ? default_value : Complex<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Rect_<_Tp>& value, const Rect_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 4 ? default_value : Rect_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
+                                                          saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
+}
+
+template<typename _Tp, int cn> static inline void read(const FileNode& node, Vec<_Tp, cn>& value, const Vec<_Tp, cn>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != cn ? default_value : Vec<_Tp, cn>(&temp[0]);
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Scalar_<_Tp>& value, const Scalar_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 4 ? default_value : Scalar_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
+                                                            saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
+}
+
+static inline void read(const FileNode& node, Range& value, const Range& default_value)
+{
+    Point2i temp(value.start, value.end); const Point2i default_temp = Point2i(default_value.start, default_value.end);
+    read(node, temp, default_temp);
+    value.start = temp.x; value.end = temp.y;
+}
+
+//! @}
+
+/** @brief Writes string to a file storage.
+@relates cv::FileStorage
+ */
+CV_EXPORTS FileStorage& operator << (FileStorage& fs, const String& str);
+
+//! @cond IGNORED
+
+namespace internal
+{
+    class CV_EXPORTS WriteStructContext
+    {
+    public:
+        WriteStructContext(FileStorage& _fs, const String& name, int flags, const String& typeName = String());
+        ~WriteStructContext();
+    private:
+        FileStorage* fs;
+    };
+
+    template<typename _Tp, int numflag> class VecWriterProxy
+    {
+    public:
+        VecWriterProxy( FileStorage* _fs ) : fs(_fs) {}
+        void operator()(const std::vector<_Tp>& vec) const
+        {
+            size_t count = vec.size();
+            for (size_t i = 0; i < count; i++)
+                write(*fs, vec[i]);
+        }
+    private:
+        FileStorage* fs;
+    };
+
+    template<typename _Tp> class VecWriterProxy<_Tp, 1>
+    {
+    public:
+        VecWriterProxy( FileStorage* _fs ) : fs(_fs) {}
+        void operator()(const std::vector<_Tp>& vec) const
+        {
+            int _fmt = DataType<_Tp>::fmt;
+            char fmt[] = { (char)((_fmt >> 8) + '1'), (char)_fmt, '\0' };
+            fs->writeRaw(fmt, !vec.empty() ? (uchar*)&vec[0] : 0, vec.size() * sizeof(_Tp));
+        }
+    private:
+        FileStorage* fs;
+    };
+
+    template<typename _Tp, int numflag> class VecReaderProxy
+    {
+    public:
+        VecReaderProxy( FileNodeIterator* _it ) : it(_it) {}
+        void operator()(std::vector<_Tp>& vec, size_t count) const
+        {
+            count = std::min(count, it->remaining);
+            vec.resize(count);
+            for (size_t i = 0; i < count; i++, ++(*it))
+                read(**it, vec[i], _Tp());
+        }
+    private:
+        FileNodeIterator* it;
+    };
+
+    template<typename _Tp> class VecReaderProxy<_Tp, 1>
+    {
+    public:
+        VecReaderProxy( FileNodeIterator* _it ) : it(_it) {}
+        void operator()(std::vector<_Tp>& vec, size_t count) const
+        {
+            size_t remaining = it->remaining;
+            size_t cn = DataType<_Tp>::channels;
+            int _fmt = DataType<_Tp>::fmt;
+            char fmt[] = { (char)((_fmt >> 8)+'1'), (char)_fmt, '\0' };
+            size_t remaining1 = remaining / cn;
+            count = count < remaining1 ? count : remaining1;
+            vec.resize(count);
+            it->readRaw(fmt, !vec.empty() ? (uchar*)&vec[0] : 0, count*sizeof(_Tp));
+        }
+    private:
+        FileNodeIterator* it;
+    };
+
+} // internal
+
+//! @endcond
+
+//! @relates cv::FileStorage
+//! @{
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const _Tp& value)
+{
+    write(fs, String(), value);
+}
+
+template<> inline
+void write( FileStorage& fs, const int& value )
+{
+    writeScalar(fs, value);
+}
+
+template<> inline
+void write( FileStorage& fs, const float& value )
+{
+    writeScalar(fs, value);
+}
+
+template<> inline
+void write( FileStorage& fs, const double& value )
+{
+    writeScalar(fs, value);
+}
+
+template<> inline
+void write( FileStorage& fs, const String& value )
+{
+    writeScalar(fs, value);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Point_<_Tp>& pt )
+{
+    write(fs, pt.x);
+    write(fs, pt.y);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Point3_<_Tp>& pt )
+{
+    write(fs, pt.x);
+    write(fs, pt.y);
+    write(fs, pt.z);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Size_<_Tp>& sz )
+{
+    write(fs, sz.width);
+    write(fs, sz.height);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Complex<_Tp>& c )
+{
+    write(fs, c.re);
+    write(fs, c.im);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Rect_<_Tp>& r )
+{
+    write(fs, r.x);
+    write(fs, r.y);
+    write(fs, r.width);
+    write(fs, r.height);
+}
+
+template<typename _Tp, int cn> static inline
+void write(FileStorage& fs, const Vec<_Tp, cn>& v )
+{
+    for(int i = 0; i < cn; i++)
+        write(fs, v.val[i]);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Scalar_<_Tp>& s )
+{
+    write(fs, s.val[0]);
+    write(fs, s.val[1]);
+    write(fs, s.val[2]);
+    write(fs, s.val[3]);
+}
+
+static inline
+void write(FileStorage& fs, const Range& r )
+{
+    write(fs, r.start);
+    write(fs, r.end);
+}
+
+template<typename _Tp> static inline
+void write( FileStorage& fs, const std::vector<_Tp>& vec )
+{
+    cv::internal::VecWriterProxy<_Tp, DataType<_Tp>::fmt != 0> w(&fs);
+    w(vec);
+}
+
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Point_<_Tp>& pt )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, pt);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Point3_<_Tp>& pt )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, pt);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Size_<_Tp>& sz )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, sz);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Complex<_Tp>& c )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, c);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Rect_<_Tp>& r )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, r);
+}
+
+template<typename _Tp, int cn> static inline
+void write(FileStorage& fs, const String& name, const Vec<_Tp, cn>& v )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, v);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Scalar_<_Tp>& s )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, s);
+}
+
+static inline
+void write(FileStorage& fs, const String& name, const Range& r )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, r);
+}
+
+template<typename _Tp> static inline
+void write( FileStorage& fs, const String& name, const std::vector<_Tp>& vec )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+(DataType<_Tp>::fmt != 0 ? FileNode::FLOW : 0));
+    write(fs, vec);
+}
+
+//! @} FileStorage
+
+//! @relates cv::FileNode
+//! @{
+
+static inline
+void read(const FileNode& node, bool& value, bool default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = temp != 0;
+}
+
+static inline
+void read(const FileNode& node, uchar& value, uchar default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = saturate_cast<uchar>(temp);
+}
+
+static inline
+void read(const FileNode& node, schar& value, schar default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = saturate_cast<schar>(temp);
+}
+
+static inline
+void read(const FileNode& node, ushort& value, ushort default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = saturate_cast<ushort>(temp);
+}
+
+static inline
+void read(const FileNode& node, short& value, short default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = saturate_cast<short>(temp);
+}
+
+template<typename _Tp> static inline
+void read( FileNodeIterator& it, std::vector<_Tp>& vec, size_t maxCount = (size_t)INT_MAX )
+{
+    cv::internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
+    r(vec, maxCount);
+}
+
+template<typename _Tp> static inline
+void read( const FileNode& node, std::vector<_Tp>& vec, const std::vector<_Tp>& default_value = std::vector<_Tp>() )
+{
+    if(!node.node)
+        vec = default_value;
+    else
+    {
+        FileNodeIterator it = node.begin();
+        read( it, vec );
+    }
+}
+
+//! @} FileNode
+
+//! @relates cv::FileStorage
+//! @{
+
+/** @brief Writes data to a file storage.
+ */
+template<typename _Tp> static inline
+FileStorage& operator << (FileStorage& fs, const _Tp& value)
+{
+    if( !fs.isOpened() )
+        return fs;
+    if( fs.state == FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP )
+        CV_Error( Error::StsError, "No element name has been given" );
+    write( fs, fs.elname, value );
+    if( fs.state & FileStorage::INSIDE_MAP )
+        fs.state = FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP;
+    return fs;
+}
+
+/** @brief Writes data to a file storage.
+ */
+static inline
+FileStorage& operator << (FileStorage& fs, const char* str)
+{
+    return (fs << String(str));
+}
+
+/** @brief Writes data to a file storage.
+ */
+static inline
+FileStorage& operator << (FileStorage& fs, char* value)
+{
+    return (fs << String(value));
+}
+
+//! @} FileStorage
+
+//! @relates cv::FileNodeIterator
+//! @{
+
+/** @brief Reads data from a file storage.
+ */
+template<typename _Tp> static inline
+FileNodeIterator& operator >> (FileNodeIterator& it, _Tp& value)
+{
+    read( *it, value, _Tp());
+    return ++it;
+}
+
+/** @brief Reads data from a file storage.
+ */
+template<typename _Tp> static inline
+FileNodeIterator& operator >> (FileNodeIterator& it, std::vector<_Tp>& vec)
+{
+    cv::internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
+    r(vec, (size_t)INT_MAX);
+    return it;
+}
+
+//! @} FileNodeIterator
+
+//! @relates cv::FileNode
+//! @{
+
+/** @brief Reads data from a file storage.
+ */
+template<typename _Tp> static inline
+void operator >> (const FileNode& n, _Tp& value)
+{
+    read( n, value, _Tp());
+}
+
+/** @brief Reads data from a file storage.
+ */
+template<typename _Tp> static inline
+void operator >> (const FileNode& n, std::vector<_Tp>& vec)
+{
+    FileNodeIterator it = n.begin();
+    it >> vec;
+}
+
+//! @} FileNode
+
+//! @relates cv::FileNodeIterator
+//! @{
+
+static inline
+bool operator == (const FileNodeIterator& it1, const FileNodeIterator& it2)
+{
+    return it1.fs == it2.fs && it1.container == it2.container &&
+        it1.reader.ptr == it2.reader.ptr && it1.remaining == it2.remaining;
+}
+
+static inline
+bool operator != (const FileNodeIterator& it1, const FileNodeIterator& it2)
+{
+    return !(it1 == it2);
+}
+
+static inline
+ptrdiff_t operator - (const FileNodeIterator& it1, const FileNodeIterator& it2)
+{
+    return it2.remaining - it1.remaining;
+}
+
+static inline
+bool operator < (const FileNodeIterator& it1, const FileNodeIterator& it2)
+{
+    return it1.remaining > it2.remaining;
+}
+
+//! @} FileNodeIterator
+
+//! @cond IGNORED
+
+inline FileNode FileStorage::getFirstTopLevelNode() const { FileNode r = root(); FileNodeIterator it = r.begin(); return it != r.end() ? *it : FileNode(); }
+inline FileNode::FileNode() : fs(0), node(0) {}
+inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node) : fs(_fs), node(_node) {}
+inline FileNode::FileNode(const FileNode& _node) : fs(_node.fs), node(_node.node) {}
+inline bool FileNode::empty() const    { return node   == 0;    }
+inline bool FileNode::isNone() const   { return type() == NONE; }
+inline bool FileNode::isSeq() const    { return type() == SEQ;  }
+inline bool FileNode::isMap() const    { return type() == MAP;  }
+inline bool FileNode::isInt() const    { return type() == INT;  }
+inline bool FileNode::isReal() const   { return type() == REAL; }
+inline bool FileNode::isString() const { return type() == STR;  }
+inline CvFileNode* FileNode::operator *() { return (CvFileNode*)node; }
+inline const CvFileNode* FileNode::operator* () const { return node; }
+inline FileNode::operator int() const    { int value;    read(*this, value, 0);     return value; }
+inline FileNode::operator float() const  { float value;  read(*this, value, 0.f);   return value; }
+inline FileNode::operator double() const { double value; read(*this, value, 0.);    return value; }
+inline FileNode::operator String() const { String value; read(*this, value, value); return value; }
+inline FileNodeIterator FileNode::begin() const { return FileNodeIterator(fs, node); }
+inline FileNodeIterator FileNode::end() const   { return FileNodeIterator(fs, node, size()); }
+inline void FileNode::readRaw( const String& fmt, uchar* vec, size_t len ) const { begin().readRaw( fmt, vec, len ); }
+inline FileNode FileNodeIterator::operator *() const  { return FileNode(fs, (const CvFileNode*)(const void*)reader.ptr); }
+inline FileNode FileNodeIterator::operator ->() const { return FileNode(fs, (const CvFileNode*)(const void*)reader.ptr); }
+inline String::String(const FileNode& fn): cstr_(0), len_(0) { read(fn, *this, *this); }
+
+//! @endcond
+
+} // cv
+
+#endif // __OPENCV_CORE_PERSISTENCE_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp
new file mode 100644
index 0000000..d676ce8
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp
@@ -0,0 +1,172 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_PRIVATE_CUDA_HPP__
+#define __OPENCV_CORE_PRIVATE_CUDA_HPP__
+
+#ifndef __OPENCV_BUILD
+#  error this is a private header which should not be used from outside of the OpenCV library
+#endif
+
+#include "cvconfig.h"
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/base.hpp"
+
+#include "opencv2/core/cuda.hpp"
+
+#ifdef HAVE_CUDA
+#  include <cuda.h>
+#  include <cuda_runtime.h>
+#  include <npp.h>
+#  include "opencv2/core/cuda_stream_accessor.hpp"
+#  include "opencv2/core/cuda/common.hpp"
+
+#  define NPP_VERSION (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD)
+
+#  define CUDART_MINIMUM_REQUIRED_VERSION 4020
+
+#  if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION)
+#    error "Insufficient Cuda Runtime library version, please update it."
+#  endif
+
+#  if defined(CUDA_ARCH_BIN_OR_PTX_10)
+#    error "OpenCV CUDA module doesn't support NVIDIA compute capability 1.0"
+#  endif
+#endif
+
+//! @cond IGNORED
+
+namespace cv { namespace cuda {
+    CV_EXPORTS cv::String getNppErrorMessage(int code);
+    CV_EXPORTS cv::String getCudaDriverApiErrorMessage(int code);
+
+    CV_EXPORTS GpuMat getInputMat(InputArray _src, Stream& stream);
+
+    CV_EXPORTS GpuMat getOutputMat(OutputArray _dst, int rows, int cols, int type, Stream& stream);
+    static inline GpuMat getOutputMat(OutputArray _dst, Size size, int type, Stream& stream)
+    {
+        return getOutputMat(_dst, size.height, size.width, type, stream);
+    }
+
+    CV_EXPORTS void syncOutput(const GpuMat& dst, OutputArray _dst, Stream& stream);
+}}
+
+#ifndef HAVE_CUDA
+
+static inline void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The library is compiled without CUDA support"); }
+
+#else // HAVE_CUDA
+
+static inline void throw_no_cuda() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); }
+
+namespace cv { namespace cuda
+{
+    class CV_EXPORTS BufferPool
+    {
+    public:
+        explicit BufferPool(Stream& stream);
+
+        GpuMat getBuffer(int rows, int cols, int type);
+        GpuMat getBuffer(Size size, int type) { return getBuffer(size.height, size.width, type); }
+
+        GpuMat::Allocator* getAllocator() const { return allocator_; }
+
+    private:
+        GpuMat::Allocator* allocator_;
+    };
+
+    static inline void checkNppError(int code, const char* file, const int line, const char* func)
+    {
+        if (code < 0)
+            cv::error(cv::Error::GpuApiCallError, getNppErrorMessage(code), func, file, line);
+    }
+
+    static inline void checkCudaDriverApiError(int code, const char* file, const int line, const char* func)
+    {
+        if (code != CUDA_SUCCESS)
+            cv::error(cv::Error::GpuApiCallError, getCudaDriverApiErrorMessage(code), func, file, line);
+    }
+
+    template<int n> struct NPPTypeTraits;
+    template<> struct NPPTypeTraits<CV_8U>  { typedef Npp8u npp_type; };
+    template<> struct NPPTypeTraits<CV_8S>  { typedef Npp8s npp_type; };
+    template<> struct NPPTypeTraits<CV_16U> { typedef Npp16u npp_type; };
+    template<> struct NPPTypeTraits<CV_16S> { typedef Npp16s npp_type; };
+    template<> struct NPPTypeTraits<CV_32S> { typedef Npp32s npp_type; };
+    template<> struct NPPTypeTraits<CV_32F> { typedef Npp32f npp_type; };
+    template<> struct NPPTypeTraits<CV_64F> { typedef Npp64f npp_type; };
+
+    class NppStreamHandler
+    {
+    public:
+        inline explicit NppStreamHandler(Stream& newStream)
+        {
+            oldStream = nppGetStream();
+            nppSetStream(StreamAccessor::getStream(newStream));
+        }
+
+        inline explicit NppStreamHandler(cudaStream_t newStream)
+        {
+            oldStream = nppGetStream();
+            nppSetStream(newStream);
+        }
+
+        inline ~NppStreamHandler()
+        {
+            nppSetStream(oldStream);
+        }
+
+    private:
+        cudaStream_t oldStream;
+    };
+}}
+
+#define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
+#define cuSafeCall(expr)  cv::cuda::checkCudaDriverApiError(expr, __FILE__, __LINE__, CV_Func)
+
+#endif // HAVE_CUDA
+
+//! @endcond
+
+#endif // __OPENCV_CORE_CUDA_PRIVATE_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.hpp
new file mode 100644
index 0000000..c71ec62
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/private.hpp
@@ -0,0 +1,425 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_PRIVATE_HPP__
+#define __OPENCV_CORE_PRIVATE_HPP__
+
+#ifndef __OPENCV_BUILD
+#  error this is a private header which should not be used from outside of the OpenCV library
+#endif
+
+#include "opencv2/core.hpp"
+#include "cvconfig.h"
+
+#ifdef HAVE_EIGEN
+#  if defined __GNUC__ && defined __APPLE__
+#    pragma GCC diagnostic ignored "-Wshadow"
+#  endif
+#  include <Eigen/Core>
+#  include "opencv2/core/eigen.hpp"
+#endif
+
+#ifdef HAVE_TBB
+#  include "tbb/tbb_stddef.h"
+#  if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
+#    include "tbb/tbb.h"
+#    include "tbb/task.h"
+#    undef min
+#    undef max
+#  else
+#    undef HAVE_TBB
+#  endif
+#endif
+
+//! @cond IGNORED
+
+namespace cv
+{
+#ifdef HAVE_TBB
+
+    typedef tbb::blocked_range<int> BlockedRange;
+
+    template<typename Body> static inline
+    void parallel_for( const BlockedRange& range, const Body& body )
+    {
+        tbb::parallel_for(range, body);
+    }
+
+    typedef tbb::split Split;
+
+    template<typename Body> static inline
+    void parallel_reduce( const BlockedRange& range, Body& body )
+    {
+        tbb::parallel_reduce(range, body);
+    }
+
+    typedef tbb::concurrent_vector<Rect> ConcurrentRectVector;
+#else
+    class BlockedRange
+    {
+    public:
+        BlockedRange() : _begin(0), _end(0), _grainsize(0) {}
+        BlockedRange(int b, int e, int g=1) : _begin(b), _end(e), _grainsize(g) {}
+        int begin() const { return _begin; }
+        int end() const { return _end; }
+        int grainsize() const { return _grainsize; }
+
+    protected:
+        int _begin, _end, _grainsize;
+    };
+
+    template<typename Body> static inline
+    void parallel_for( const BlockedRange& range, const Body& body )
+    {
+        body(range);
+    }
+    typedef std::vector<Rect> ConcurrentRectVector;
+
+    class Split {};
+
+    template<typename Body> static inline
+    void parallel_reduce( const BlockedRange& range, Body& body )
+    {
+        body(range);
+    }
+#endif
+
+    // Returns a static string if there is a parallel framework,
+    // NULL otherwise.
+    CV_EXPORTS const char* currentParallelFramework();
+} //namespace cv
+
+/****************************************************************************************\
+*                                  Common declarations                                   *
+\****************************************************************************************/
+
+/* the alignment of all the allocated buffers */
+#define  CV_MALLOC_ALIGN    16
+
+/* IEEE754 constants and macros */
+#define  CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
+#define  CV_TOGGLE_DBL(x) ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
+
+static inline void* cvAlignPtr( const void* ptr, int align = 32 )
+{
+    CV_DbgAssert ( (align & (align-1)) == 0 );
+    return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
+}
+
+static inline int cvAlign( int size, int align )
+{
+    CV_DbgAssert( (align & (align-1)) == 0 && size < INT_MAX );
+    return (size + align - 1) & -align;
+}
+
+#ifdef IPL_DEPTH_8U
+static inline cv::Size cvGetMatSize( const CvMat* mat )
+{
+    return cv::Size(mat->cols, mat->rows);
+}
+#endif
+
+namespace cv
+{
+CV_EXPORTS void scalarToRawData(const cv::Scalar& s, void* buf, int type, int unroll_to = 0);
+}
+
+// property implementation macros
+
+#define CV_IMPL_PROPERTY_RO(type, name, member) \
+    inline type get##name() const { return member; }
+
+#define CV_HELP_IMPL_PROPERTY(r_type, w_type, name, member) \
+    CV_IMPL_PROPERTY_RO(r_type, name, member) \
+    inline void set##name(w_type val) { member = val; }
+
+#define CV_HELP_WRAP_PROPERTY(r_type, w_type, name, internal_name, internal_obj) \
+    r_type get##name() const { return internal_obj.get##internal_name(); } \
+    void set##name(w_type val) { internal_obj.set##internal_name(val); }
+
+#define CV_IMPL_PROPERTY(type, name, member) CV_HELP_IMPL_PROPERTY(type, type, name, member)
+#define CV_IMPL_PROPERTY_S(type, name, member) CV_HELP_IMPL_PROPERTY(type, const type &, name, member)
+
+#define CV_WRAP_PROPERTY(type, name, internal_name, internal_obj)  CV_HELP_WRAP_PROPERTY(type, type, name, internal_name, internal_obj)
+#define CV_WRAP_PROPERTY_S(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, const type &, name, internal_name, internal_obj)
+
+#define CV_WRAP_SAME_PROPERTY(type, name, internal_obj) CV_WRAP_PROPERTY(type, name, name, internal_obj)
+#define CV_WRAP_SAME_PROPERTY_S(type, name, internal_obj) CV_WRAP_PROPERTY_S(type, name, name, internal_obj)
+
+/****************************************************************************************\
+*                     Structures and macros for integration with IPP                     *
+\****************************************************************************************/
+
+#ifdef HAVE_IPP
+#include "ipp.h"
+
+#ifndef IPP_VERSION_UPDATE // prior to 7.1
+#define IPP_VERSION_UPDATE 0
+#endif
+
+#define IPP_VERSION_X100 (IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR*10 + IPP_VERSION_UPDATE)
+
+// General define for ipp function disabling
+#define IPP_DISABLE_BLOCK 0
+
+#ifdef CV_MALLOC_ALIGN
+#undef CV_MALLOC_ALIGN
+#endif
+#define CV_MALLOC_ALIGN 32 // required for AVX optimization
+
+#define setIppErrorStatus() cv::ipp::setIppStatus(-1, CV_Func, __FILE__, __LINE__)
+
+static inline IppiSize ippiSize(int width, int height)
+{
+    IppiSize size = { width, height };
+    return size;
+}
+
+static inline IppiSize ippiSize(const cv::Size & _size)
+{
+    IppiSize size = { _size.width, _size.height };
+    return size;
+}
+
+static inline IppiBorderType ippiGetBorderType(int borderTypeNI)
+{
+    return borderTypeNI == cv::BORDER_CONSTANT ? ippBorderConst :
+        borderTypeNI == cv::BORDER_WRAP ? ippBorderWrap :
+        borderTypeNI == cv::BORDER_REPLICATE ? ippBorderRepl :
+        borderTypeNI == cv::BORDER_REFLECT_101 ? ippBorderMirror :
+        borderTypeNI == cv::BORDER_REFLECT ? ippBorderMirrorR : (IppiBorderType)-1;
+}
+
+static inline IppDataType ippiGetDataType(int depth)
+{
+    return depth == CV_8U ? ipp8u :
+        depth == CV_8S ? ipp8s :
+        depth == CV_16U ? ipp16u :
+        depth == CV_16S ? ipp16s :
+        depth == CV_32S ? ipp32s :
+        depth == CV_32F ? ipp32f :
+        depth == CV_64F ? ipp64f : (IppDataType)-1;
+}
+
+// IPP temporary buffer hepler
+template<typename T>
+class IppAutoBuffer
+{
+public:
+    IppAutoBuffer() { m_pBuffer = NULL; }
+    IppAutoBuffer(int size) { Alloc(size); }
+    ~IppAutoBuffer() { Release(); }
+    T* Alloc(int size) { m_pBuffer = (T*)ippMalloc(size); return m_pBuffer; }
+    void Release() { if(m_pBuffer) ippFree(m_pBuffer); }
+    inline operator T* () { return (T*)m_pBuffer;}
+    inline operator const T* () const { return (const T*)m_pBuffer;}
+private:
+    // Disable copy operations
+    IppAutoBuffer(IppAutoBuffer &) {};
+    IppAutoBuffer& operator =(const IppAutoBuffer &) {return *this;};
+
+    T* m_pBuffer;
+};
+
+#else
+#define IPP_VERSION_X100 0
+#endif
+
+// There shoud be no API difference in OpenCV between ICV and IPP since 9.0
+#if (defined HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 900
+#undef HAVE_IPP_ICV_ONLY
+#endif
+
+#ifdef HAVE_IPP_ICV_ONLY
+#define HAVE_ICV 1
+#else
+#define HAVE_ICV 0
+#endif
+
+#if defined HAVE_IPP
+#if IPP_VERSION_X100 >= 900
+#define IPP_INITIALIZER(FEAT)                           \
+{                                                       \
+    if(FEAT)                                            \
+        ippSetCpuFeatures(FEAT);                        \
+    else                                                \
+        ippInit();                                      \
+}
+#elif IPP_VERSION_X100 >= 800
+#define IPP_INITIALIZER(FEAT)                           \
+{                                                       \
+    ippInit();                                          \
+}
+#else
+#define IPP_INITIALIZER(FEAT)                           \
+{                                                       \
+    ippStaticInit();                                    \
+}
+#endif
+
+#ifdef CVAPI_EXPORTS
+#define IPP_INITIALIZER_AUTO                            \
+struct __IppInitializer__                               \
+{                                                       \
+    __IppInitializer__()                                \
+    {IPP_INITIALIZER(cv::ipp::getIppFeatures())}        \
+};                                                      \
+static struct __IppInitializer__ __ipp_initializer__;
+#else
+#define IPP_INITIALIZER_AUTO
+#endif
+#else
+#define IPP_INITIALIZER
+#define IPP_INITIALIZER_AUTO
+#endif
+
+#define CV_IPP_CHECK_COND (cv::ipp::useIPP())
+#define CV_IPP_CHECK() if(CV_IPP_CHECK_COND)
+
+#ifdef HAVE_IPP
+
+#ifdef CV_IPP_RUN_VERBOSE
+#define CV_IPP_RUN_(condition, func, ...)                                   \
+    {                                                                       \
+        if (cv::ipp::useIPP() && (condition) && func)                       \
+        {                                                                   \
+            printf("%s: IPP implementation is running\n", CV_Func);         \
+            fflush(stdout);                                                 \
+            CV_IMPL_ADD(CV_IMPL_IPP);                                       \
+            return __VA_ARGS__;                                             \
+        }                                                                   \
+        else                                                                \
+        {                                                                   \
+            printf("%s: Plain implementation is running\n", CV_Func);       \
+            fflush(stdout);                                                 \
+        }                                                                   \
+    }
+#elif defined CV_IPP_RUN_ASSERT
+#define CV_IPP_RUN_(condition, func, ...)                                   \
+    {                                                                       \
+        if (cv::ipp::useIPP() && (condition))                               \
+        {                                                                   \
+            if(func)                                                        \
+            {                                                               \
+                CV_IMPL_ADD(CV_IMPL_IPP);                                   \
+            }                                                               \
+            else                                                            \
+            {                                                               \
+                setIppErrorStatus();                                        \
+                CV_Error(cv::Error::StsAssert, #func);                      \
+            }                                                               \
+            return __VA_ARGS__;                                             \
+        }                                                                   \
+    }
+#else
+#define CV_IPP_RUN_(condition, func, ...)                                   \
+    if (cv::ipp::useIPP() && (condition) && func)                           \
+    {                                                                       \
+        CV_IMPL_ADD(CV_IMPL_IPP);                                           \
+        return __VA_ARGS__;                                                 \
+    }
+#endif
+
+#else
+#define CV_IPP_RUN_(condition, func, ...)
+#endif
+
+#define CV_IPP_RUN(condition, func, ...) CV_IPP_RUN_(condition, func, __VA_ARGS__)
+
+
+#ifndef IPPI_CALL
+#  define IPPI_CALL(func) CV_Assert((func) >= 0)
+#endif
+
+/* IPP-compatible return codes */
+typedef enum CvStatus
+{
+    CV_BADMEMBLOCK_ERR          = -113,
+    CV_INPLACE_NOT_SUPPORTED_ERR= -112,
+    CV_UNMATCHED_ROI_ERR        = -111,
+    CV_NOTFOUND_ERR             = -110,
+    CV_BADCONVERGENCE_ERR       = -109,
+
+    CV_BADDEPTH_ERR             = -107,
+    CV_BADROI_ERR               = -106,
+    CV_BADHEADER_ERR            = -105,
+    CV_UNMATCHED_FORMATS_ERR    = -104,
+    CV_UNSUPPORTED_COI_ERR      = -103,
+    CV_UNSUPPORTED_CHANNELS_ERR = -102,
+    CV_UNSUPPORTED_DEPTH_ERR    = -101,
+    CV_UNSUPPORTED_FORMAT_ERR   = -100,
+
+    CV_BADARG_ERR               = -49,  //ipp comp
+    CV_NOTDEFINED_ERR           = -48,  //ipp comp
+
+    CV_BADCHANNELS_ERR          = -47,  //ipp comp
+    CV_BADRANGE_ERR             = -44,  //ipp comp
+    CV_BADSTEP_ERR              = -29,  //ipp comp
+
+    CV_BADFLAG_ERR              =  -12,
+    CV_DIV_BY_ZERO_ERR          =  -11, //ipp comp
+    CV_BADCOEF_ERR              =  -10,
+
+    CV_BADFACTOR_ERR            =  -7,
+    CV_BADPOINT_ERR             =  -6,
+    CV_BADSCALE_ERR             =  -4,
+    CV_OUTOFMEM_ERR             =  -3,
+    CV_NULLPTR_ERR              =  -2,
+    CV_BADSIZE_ERR              =  -1,
+    CV_NO_ERR                   =   0,
+    CV_OK                       =   CV_NO_ERR
+}
+CvStatus;
+
+#ifdef HAVE_TEGRA_OPTIMIZATION
+namespace tegra {
+
+CV_EXPORTS bool useTegra();
+CV_EXPORTS void setUseTegra(bool flag);
+
+}
+#endif
+
+//! @endcond
+
+#endif // __OPENCV_CORE_PRIVATE_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp
new file mode 100644
index 0000000..3f6f214
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp
@@ -0,0 +1,365 @@
+/*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) 2013, NVIDIA Corporation, 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 copyright holders 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*/
+
+#ifndef __OPENCV_CORE_PTR_INL_HPP__
+#define __OPENCV_CORE_PTR_INL_HPP__
+
+#include <algorithm>
+
+//! @cond IGNORED
+
+namespace cv {
+
+template<typename Y>
+void DefaultDeleter<Y>::operator () (Y* p) const
+{
+    delete p;
+}
+
+namespace detail
+{
+
+struct PtrOwner
+{
+    PtrOwner() : refCount(1)
+    {}
+
+    void incRef()
+    {
+        CV_XADD(&refCount, 1);
+    }
+
+    void decRef()
+    {
+        if (CV_XADD(&refCount, -1) == 1) deleteSelf();
+    }
+
+protected:
+    /* This doesn't really need to be virtual, since PtrOwner is never deleted
+       directly, but it doesn't hurt and it helps avoid warnings. */
+    virtual ~PtrOwner()
+    {}
+
+    virtual void deleteSelf() = 0;
+
+private:
+    unsigned int refCount;
+
+    // noncopyable
+    PtrOwner(const PtrOwner&);
+    PtrOwner& operator = (const PtrOwner&);
+};
+
+template<typename Y, typename D>
+struct PtrOwnerImpl : PtrOwner
+{
+    PtrOwnerImpl(Y* p, D d) : owned(p), deleter(d)
+    {}
+
+    void deleteSelf()
+    {
+        deleter(owned);
+        delete this;
+    }
+
+private:
+    Y* owned;
+    D deleter;
+};
+
+
+}
+
+template<typename T>
+Ptr<T>::Ptr() : owner(NULL), stored(NULL)
+{}
+
+template<typename T>
+template<typename Y>
+Ptr<T>::Ptr(Y* p)
+  : owner(p
+      ? new detail::PtrOwnerImpl<Y, DefaultDeleter<Y> >(p, DefaultDeleter<Y>())
+      : NULL),
+    stored(p)
+{}
+
+template<typename T>
+template<typename Y, typename D>
+Ptr<T>::Ptr(Y* p, D d)
+  : owner(p
+      ? new detail::PtrOwnerImpl<Y, D>(p, d)
+      : NULL),
+    stored(p)
+{}
+
+template<typename T>
+Ptr<T>::Ptr(const Ptr& o) : owner(o.owner), stored(o.stored)
+{
+    if (owner) owner->incRef();
+}
+
+template<typename T>
+template<typename Y>
+Ptr<T>::Ptr(const Ptr<Y>& o) : owner(o.owner), stored(o.stored)
+{
+    if (owner) owner->incRef();
+}
+
+template<typename T>
+template<typename Y>
+Ptr<T>::Ptr(const Ptr<Y>& o, T* p) : owner(o.owner), stored(p)
+{
+    if (owner) owner->incRef();
+}
+
+template<typename T>
+Ptr<T>::~Ptr()
+{
+    release();
+}
+
+template<typename T>
+Ptr<T>& Ptr<T>::operator = (const Ptr<T>& o)
+{
+    Ptr(o).swap(*this);
+    return *this;
+}
+
+template<typename T>
+template<typename Y>
+Ptr<T>& Ptr<T>::operator = (const Ptr<Y>& o)
+{
+    Ptr(o).swap(*this);
+    return *this;
+}
+
+template<typename T>
+void Ptr<T>::release()
+{
+    if (owner) owner->decRef();
+    owner = NULL;
+    stored = NULL;
+}
+
+template<typename T>
+template<typename Y>
+void Ptr<T>::reset(Y* p)
+{
+    Ptr(p).swap(*this);
+}
+
+template<typename T>
+template<typename Y, typename D>
+void Ptr<T>::reset(Y* p, D d)
+{
+    Ptr(p, d).swap(*this);
+}
+
+template<typename T>
+void Ptr<T>::swap(Ptr<T>& o)
+{
+    std::swap(owner, o.owner);
+    std::swap(stored, o.stored);
+}
+
+template<typename T>
+T* Ptr<T>::get() const
+{
+    return stored;
+}
+
+template<typename T>
+typename detail::RefOrVoid<T>::type Ptr<T>::operator * () const
+{
+    return *stored;
+}
+
+template<typename T>
+T* Ptr<T>::operator -> () const
+{
+    return stored;
+}
+
+template<typename T>
+Ptr<T>::operator T* () const
+{
+    return stored;
+}
+
+
+template<typename T>
+bool Ptr<T>::empty() const
+{
+    return !stored;
+}
+
+template<typename T>
+template<typename Y>
+Ptr<Y> Ptr<T>::staticCast() const
+{
+    return Ptr<Y>(*this, static_cast<Y*>(stored));
+}
+
+template<typename T>
+template<typename Y>
+Ptr<Y> Ptr<T>::constCast() const
+{
+    return Ptr<Y>(*this, const_cast<Y*>(stored));
+}
+
+template<typename T>
+template<typename Y>
+Ptr<Y> Ptr<T>::dynamicCast() const
+{
+    return Ptr<Y>(*this, dynamic_cast<Y*>(stored));
+}
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+
+template<typename T>
+Ptr<T>::Ptr(Ptr&& o) : owner(o.owner), stored(o.stored)
+{
+    o.owner = NULL;
+    o.stored = NULL;
+}
+
+template<typename T>
+Ptr<T>& Ptr<T>::operator = (Ptr<T>&& o)
+{
+    release();
+    owner = o.owner;
+    stored = o.stored;
+    o.owner = NULL;
+    o.stored = NULL;
+    return *this;
+}
+
+#endif
+
+
+template<typename T>
+void swap(Ptr<T>& ptr1, Ptr<T>& ptr2){
+    ptr1.swap(ptr2);
+}
+
+template<typename T>
+bool operator == (const Ptr<T>& ptr1, const Ptr<T>& ptr2)
+{
+    return ptr1.get() == ptr2.get();
+}
+
+template<typename T>
+bool operator != (const Ptr<T>& ptr1, const Ptr<T>& ptr2)
+{
+    return ptr1.get() != ptr2.get();
+}
+
+template<typename T>
+Ptr<T> makePtr()
+{
+    return Ptr<T>(new T());
+}
+
+template<typename T, typename A1>
+Ptr<T> makePtr(const A1& a1)
+{
+    return Ptr<T>(new T(a1));
+}
+
+template<typename T, typename A1, typename A2>
+Ptr<T> makePtr(const A1& a1, const A2& a2)
+{
+    return Ptr<T>(new T(a1, a2));
+}
+
+template<typename T, typename A1, typename A2, typename A3>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3)
+{
+    return Ptr<T>(new T(a1, a2, a3));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10));
+}
+
+} // namespace cv
+
+//! @endcond
+
+#endif // __OPENCV_CORE_PTR_INL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp
new file mode 100644
index 0000000..1442eab
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp
@@ -0,0 +1,150 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2014, Itseez 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*/
+
+#ifndef __OPENCV_CORE_SATURATE_HPP__
+#define __OPENCV_CORE_SATURATE_HPP__
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/fast_math.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_utils
+//! @{
+
+/////////////// saturate_cast (used in image & signal processing) ///////////////////
+
+/** @brief Template function for accurate conversion from one primitive type to another.
+
+ The functions saturate_cast resemble the standard C++ cast operations, such as static_cast\<T\>()
+ and others. They perform an efficient and accurate conversion from one primitive type to another
+ (see the introduction chapter). saturate in the name means that when the input value v is out of the
+ range of the target type, the result is not formed just by taking low bits of the input, but instead
+ the value is clipped. For example:
+ @code
+ uchar a = saturate_cast<uchar>(-100); // a = 0 (UCHAR_MIN)
+ short b = saturate_cast<short>(33333.33333); // b = 32767 (SHRT_MAX)
+ @endcode
+ Such clipping is done when the target type is unsigned char , signed char , unsigned short or
+ signed short . For 32-bit integers, no clipping is done.
+
+ When the parameter is a floating-point value and the target type is an integer (8-, 16- or 32-bit),
+ the floating-point value is first rounded to the nearest integer and then clipped if needed (when
+ the target type is 8- or 16-bit).
+
+ This operation is used in the simplest or most complex image processing functions in OpenCV.
+
+ @param v Function parameter.
+ @sa add, subtract, multiply, divide, Mat::convertTo
+ */
+template<typename _Tp> static inline _Tp saturate_cast(uchar v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(schar v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(ushort v)   { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(short v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(unsigned v) { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(int v)      { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(float v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(double v)   { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(int64 v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(uint64 v)   { return _Tp(v); }
+
+template<> inline uchar saturate_cast<uchar>(schar v)        { return (uchar)std::max((int)v, 0); }
+template<> inline uchar saturate_cast<uchar>(ushort v)       { return (uchar)std::min((unsigned)v, (unsigned)UCHAR_MAX); }
+template<> inline uchar saturate_cast<uchar>(int v)          { return (uchar)((unsigned)v <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); }
+template<> inline uchar saturate_cast<uchar>(short v)        { return saturate_cast<uchar>((int)v); }
+template<> inline uchar saturate_cast<uchar>(unsigned v)     { return (uchar)std::min(v, (unsigned)UCHAR_MAX); }
+template<> inline uchar saturate_cast<uchar>(float v)        { int iv = cvRound(v); return saturate_cast<uchar>(iv); }
+template<> inline uchar saturate_cast<uchar>(double v)       { int iv = cvRound(v); return saturate_cast<uchar>(iv); }
+template<> inline uchar saturate_cast<uchar>(int64 v)        { return (uchar)((uint64)v <= (uint64)UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); }
+template<> inline uchar saturate_cast<uchar>(uint64 v)       { return (uchar)std::min(v, (uint64)UCHAR_MAX); }
+
+template<> inline schar saturate_cast<schar>(uchar v)        { return (schar)std::min((int)v, SCHAR_MAX); }
+template<> inline schar saturate_cast<schar>(ushort v)       { return (schar)std::min((unsigned)v, (unsigned)SCHAR_MAX); }
+template<> inline schar saturate_cast<schar>(int v)          { return (schar)((unsigned)(v-SCHAR_MIN) <= (unsigned)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); }
+template<> inline schar saturate_cast<schar>(short v)        { return saturate_cast<schar>((int)v); }
+template<> inline schar saturate_cast<schar>(unsigned v)     { return (schar)std::min(v, (unsigned)SCHAR_MAX); }
+template<> inline schar saturate_cast<schar>(float v)        { int iv = cvRound(v); return saturate_cast<schar>(iv); }
+template<> inline schar saturate_cast<schar>(double v)       { int iv = cvRound(v); return saturate_cast<schar>(iv); }
+template<> inline schar saturate_cast<schar>(int64 v)        { return (schar)((uint64)((int64)v-SCHAR_MIN) <= (uint64)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); }
+template<> inline schar saturate_cast<schar>(uint64 v)       { return (schar)std::min(v, (uint64)SCHAR_MAX); }
+
+template<> inline ushort saturate_cast<ushort>(schar v)      { return (ushort)std::max((int)v, 0); }
+template<> inline ushort saturate_cast<ushort>(short v)      { return (ushort)std::max((int)v, 0); }
+template<> inline ushort saturate_cast<ushort>(int v)        { return (ushort)((unsigned)v <= (unsigned)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); }
+template<> inline ushort saturate_cast<ushort>(unsigned v)   { return (ushort)std::min(v, (unsigned)USHRT_MAX); }
+template<> inline ushort saturate_cast<ushort>(float v)      { int iv = cvRound(v); return saturate_cast<ushort>(iv); }
+template<> inline ushort saturate_cast<ushort>(double v)     { int iv = cvRound(v); return saturate_cast<ushort>(iv); }
+template<> inline ushort saturate_cast<ushort>(int64 v)      { return (ushort)((uint64)v <= (uint64)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); }
+template<> inline ushort saturate_cast<ushort>(uint64 v)     { return (ushort)std::min(v, (uint64)USHRT_MAX); }
+
+template<> inline short saturate_cast<short>(ushort v)       { return (short)std::min((int)v, SHRT_MAX); }
+template<> inline short saturate_cast<short>(int v)          { return (short)((unsigned)(v - SHRT_MIN) <= (unsigned)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); }
+template<> inline short saturate_cast<short>(unsigned v)     { return (short)std::min(v, (unsigned)SHRT_MAX); }
+template<> inline short saturate_cast<short>(float v)        { int iv = cvRound(v); return saturate_cast<short>(iv); }
+template<> inline short saturate_cast<short>(double v)       { int iv = cvRound(v); return saturate_cast<short>(iv); }
+template<> inline short saturate_cast<short>(int64 v)        { return (short)((uint64)((int64)v - SHRT_MIN) <= (uint64)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); }
+template<> inline short saturate_cast<short>(uint64 v)       { return (short)std::min(v, (uint64)SHRT_MAX); }
+
+template<> inline int saturate_cast<int>(float v)            { return cvRound(v); }
+template<> inline int saturate_cast<int>(double v)           { return cvRound(v); }
+
+// we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
+template<> inline unsigned saturate_cast<unsigned>(float v)  { return cvRound(v); }
+template<> inline unsigned saturate_cast<unsigned>(double v) { return cvRound(v); }
+
+//! @}
+
+} // cv
+
+#endif // __OPENCV_CORE_SATURATE_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp
new file mode 100644
index 0000000..c87b029
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp
@@ -0,0 +1,652 @@
+/*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) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_SSE_UTILS_HPP__
+#define __OPENCV_CORE_SSE_UTILS_HPP__
+
+#ifndef __cplusplus
+#  error sse_utils.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/cvdef.h"
+
+//! @addtogroup core_utils_sse
+//! @{
+
+#if CV_SSE2
+
+inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_g0);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_g0);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_g1);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_g1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk2);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk2);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk3);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk3);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk2);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk2);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk3);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk3);
+
+    __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk2);
+    __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk2);
+    __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk3);
+    __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk3);
+
+    v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk2);
+    v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk2);
+    v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk3);
+    v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk3);
+}
+
+inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0,
+                                  __m128i & v_g1, __m128i & v_b0, __m128i & v_b1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_g1);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_g1);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_b0);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_b0);
+    __m128i layer1_chunk4 = _mm_unpacklo_epi8(v_g0, v_b1);
+    __m128i layer1_chunk5 = _mm_unpackhi_epi8(v_g0, v_b1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk3);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk3);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk4);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk4);
+    __m128i layer2_chunk4 = _mm_unpacklo_epi8(layer1_chunk2, layer1_chunk5);
+    __m128i layer2_chunk5 = _mm_unpackhi_epi8(layer1_chunk2, layer1_chunk5);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk3);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk3);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk4);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk4);
+    __m128i layer3_chunk4 = _mm_unpacklo_epi8(layer2_chunk2, layer2_chunk5);
+    __m128i layer3_chunk5 = _mm_unpackhi_epi8(layer2_chunk2, layer2_chunk5);
+
+    __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk3);
+    __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk3);
+    __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk4);
+    __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk4);
+    __m128i layer4_chunk4 = _mm_unpacklo_epi8(layer3_chunk2, layer3_chunk5);
+    __m128i layer4_chunk5 = _mm_unpackhi_epi8(layer3_chunk2, layer3_chunk5);
+
+    v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk3);
+    v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk3);
+    v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk4);
+    v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk4);
+    v_b0 = _mm_unpacklo_epi8(layer4_chunk2, layer4_chunk5);
+    v_b1 = _mm_unpackhi_epi8(layer4_chunk2, layer4_chunk5);
+}
+
+inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1,
+                                  __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_b0);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_b0);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_b1);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_b1);
+    __m128i layer1_chunk4 = _mm_unpacklo_epi8(v_g0, v_a0);
+    __m128i layer1_chunk5 = _mm_unpackhi_epi8(v_g0, v_a0);
+    __m128i layer1_chunk6 = _mm_unpacklo_epi8(v_g1, v_a1);
+    __m128i layer1_chunk7 = _mm_unpackhi_epi8(v_g1, v_a1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk4);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk4);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk5);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk5);
+    __m128i layer2_chunk4 = _mm_unpacklo_epi8(layer1_chunk2, layer1_chunk6);
+    __m128i layer2_chunk5 = _mm_unpackhi_epi8(layer1_chunk2, layer1_chunk6);
+    __m128i layer2_chunk6 = _mm_unpacklo_epi8(layer1_chunk3, layer1_chunk7);
+    __m128i layer2_chunk7 = _mm_unpackhi_epi8(layer1_chunk3, layer1_chunk7);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk4);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk4);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk5);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk5);
+    __m128i layer3_chunk4 = _mm_unpacklo_epi8(layer2_chunk2, layer2_chunk6);
+    __m128i layer3_chunk5 = _mm_unpackhi_epi8(layer2_chunk2, layer2_chunk6);
+    __m128i layer3_chunk6 = _mm_unpacklo_epi8(layer2_chunk3, layer2_chunk7);
+    __m128i layer3_chunk7 = _mm_unpackhi_epi8(layer2_chunk3, layer2_chunk7);
+
+    __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk4);
+    __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk4);
+    __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk5);
+    __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk5);
+    __m128i layer4_chunk4 = _mm_unpacklo_epi8(layer3_chunk2, layer3_chunk6);
+    __m128i layer4_chunk5 = _mm_unpackhi_epi8(layer3_chunk2, layer3_chunk6);
+    __m128i layer4_chunk6 = _mm_unpacklo_epi8(layer3_chunk3, layer3_chunk7);
+    __m128i layer4_chunk7 = _mm_unpackhi_epi8(layer3_chunk3, layer3_chunk7);
+
+    v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk4);
+    v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk4);
+    v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk5);
+    v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk5);
+    v_b0 = _mm_unpacklo_epi8(layer4_chunk2, layer4_chunk6);
+    v_b1 = _mm_unpackhi_epi8(layer4_chunk2, layer4_chunk6);
+    v_a0 = _mm_unpacklo_epi8(layer4_chunk3, layer4_chunk7);
+    v_a1 = _mm_unpackhi_epi8(layer4_chunk3, layer4_chunk7);
+}
+
+inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
+{
+    __m128i v_mask = _mm_set1_epi16(0x00ff);
+
+    __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer4_chunk2 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8));
+    __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer4_chunk3 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8));
+
+    __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask));
+    __m128i layer3_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8));
+    __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask));
+    __m128i layer3_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8));
+
+    __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8));
+    __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8));
+
+    __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8));
+    __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8));
+
+    v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_g0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8));
+    v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_g1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8));
+}
+
+inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0,
+                                __m128i & v_g1, __m128i & v_b0, __m128i & v_b1)
+{
+    __m128i v_mask = _mm_set1_epi16(0x00ff);
+
+    __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer4_chunk3 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8));
+    __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer4_chunk4 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8));
+    __m128i layer4_chunk2 = _mm_packus_epi16(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask));
+    __m128i layer4_chunk5 = _mm_packus_epi16(_mm_srli_epi16(v_b0, 8), _mm_srli_epi16(v_b1, 8));
+
+    __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask));
+    __m128i layer3_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8));
+    __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask));
+    __m128i layer3_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8));
+    __m128i layer3_chunk2 = _mm_packus_epi16(_mm_and_si128(layer4_chunk4, v_mask), _mm_and_si128(layer4_chunk5, v_mask));
+    __m128i layer3_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk4, 8), _mm_srli_epi16(layer4_chunk5, 8));
+
+    __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8));
+    __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8));
+    __m128i layer2_chunk2 = _mm_packus_epi16(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask));
+    __m128i layer2_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk4, 8), _mm_srli_epi16(layer3_chunk5, 8));
+
+    __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8));
+    __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8));
+    __m128i layer1_chunk2 = _mm_packus_epi16(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask));
+    __m128i layer1_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk4, 8), _mm_srli_epi16(layer2_chunk5, 8));
+
+    v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_g1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8));
+    v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_b0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8));
+    v_g0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask));
+    v_b1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk4, 8), _mm_srli_epi16(layer1_chunk5, 8));
+}
+
+inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1,
+                                __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1)
+{
+    __m128i v_mask = _mm_set1_epi16(0x00ff);
+
+    __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer4_chunk4 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8));
+    __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer4_chunk5 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8));
+    __m128i layer4_chunk2 = _mm_packus_epi16(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask));
+    __m128i layer4_chunk6 = _mm_packus_epi16(_mm_srli_epi16(v_b0, 8), _mm_srli_epi16(v_b1, 8));
+    __m128i layer4_chunk3 = _mm_packus_epi16(_mm_and_si128(v_a0, v_mask), _mm_and_si128(v_a1, v_mask));
+    __m128i layer4_chunk7 = _mm_packus_epi16(_mm_srli_epi16(v_a0, 8), _mm_srli_epi16(v_a1, 8));
+
+    __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask));
+    __m128i layer3_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8));
+    __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask));
+    __m128i layer3_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8));
+    __m128i layer3_chunk2 = _mm_packus_epi16(_mm_and_si128(layer4_chunk4, v_mask), _mm_and_si128(layer4_chunk5, v_mask));
+    __m128i layer3_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk4, 8), _mm_srli_epi16(layer4_chunk5, 8));
+    __m128i layer3_chunk3 = _mm_packus_epi16(_mm_and_si128(layer4_chunk6, v_mask), _mm_and_si128(layer4_chunk7, v_mask));
+    __m128i layer3_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk6, 8), _mm_srli_epi16(layer4_chunk7, 8));
+
+    __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8));
+    __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8));
+    __m128i layer2_chunk2 = _mm_packus_epi16(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask));
+    __m128i layer2_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk4, 8), _mm_srli_epi16(layer3_chunk5, 8));
+    __m128i layer2_chunk3 = _mm_packus_epi16(_mm_and_si128(layer3_chunk6, v_mask), _mm_and_si128(layer3_chunk7, v_mask));
+    __m128i layer2_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk6, 8), _mm_srli_epi16(layer3_chunk7, 8));
+
+    __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8));
+    __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8));
+    __m128i layer1_chunk2 = _mm_packus_epi16(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask));
+    __m128i layer1_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk4, 8), _mm_srli_epi16(layer2_chunk5, 8));
+    __m128i layer1_chunk3 = _mm_packus_epi16(_mm_and_si128(layer2_chunk6, v_mask), _mm_and_si128(layer2_chunk7, v_mask));
+    __m128i layer1_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk6, 8), _mm_srli_epi16(layer2_chunk7, 8));
+
+    v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_b0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8));
+    v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_b1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8));
+    v_g0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask));
+    v_a0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk4, 8), _mm_srli_epi16(layer1_chunk5, 8));
+    v_g1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk6, v_mask), _mm_and_si128(layer1_chunk7, v_mask));
+    v_a1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk6, 8), _mm_srli_epi16(layer1_chunk7, 8));
+}
+
+inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_g0);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_g0);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_g1);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_g1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk2);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk2);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk3);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk3);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk2);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk2);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk3);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk3);
+
+    v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk2);
+    v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk2);
+    v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk3);
+    v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk3);
+}
+
+inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0,
+                                   __m128i & v_g1, __m128i & v_b0, __m128i & v_b1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_g1);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_g1);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_b0);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_b0);
+    __m128i layer1_chunk4 = _mm_unpacklo_epi16(v_g0, v_b1);
+    __m128i layer1_chunk5 = _mm_unpackhi_epi16(v_g0, v_b1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk3);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk3);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk4);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk4);
+    __m128i layer2_chunk4 = _mm_unpacklo_epi16(layer1_chunk2, layer1_chunk5);
+    __m128i layer2_chunk5 = _mm_unpackhi_epi16(layer1_chunk2, layer1_chunk5);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk3);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk3);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk4);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk4);
+    __m128i layer3_chunk4 = _mm_unpacklo_epi16(layer2_chunk2, layer2_chunk5);
+    __m128i layer3_chunk5 = _mm_unpackhi_epi16(layer2_chunk2, layer2_chunk5);
+
+    v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk3);
+    v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk3);
+    v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk4);
+    v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk4);
+    v_b0 = _mm_unpacklo_epi16(layer3_chunk2, layer3_chunk5);
+    v_b1 = _mm_unpackhi_epi16(layer3_chunk2, layer3_chunk5);
+}
+
+inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1,
+                                   __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_b0);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_b0);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_b1);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_b1);
+    __m128i layer1_chunk4 = _mm_unpacklo_epi16(v_g0, v_a0);
+    __m128i layer1_chunk5 = _mm_unpackhi_epi16(v_g0, v_a0);
+    __m128i layer1_chunk6 = _mm_unpacklo_epi16(v_g1, v_a1);
+    __m128i layer1_chunk7 = _mm_unpackhi_epi16(v_g1, v_a1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk4);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk4);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk5);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk5);
+    __m128i layer2_chunk4 = _mm_unpacklo_epi16(layer1_chunk2, layer1_chunk6);
+    __m128i layer2_chunk5 = _mm_unpackhi_epi16(layer1_chunk2, layer1_chunk6);
+    __m128i layer2_chunk6 = _mm_unpacklo_epi16(layer1_chunk3, layer1_chunk7);
+    __m128i layer2_chunk7 = _mm_unpackhi_epi16(layer1_chunk3, layer1_chunk7);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk4);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk4);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk5);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk5);
+    __m128i layer3_chunk4 = _mm_unpacklo_epi16(layer2_chunk2, layer2_chunk6);
+    __m128i layer3_chunk5 = _mm_unpackhi_epi16(layer2_chunk2, layer2_chunk6);
+    __m128i layer3_chunk6 = _mm_unpacklo_epi16(layer2_chunk3, layer2_chunk7);
+    __m128i layer3_chunk7 = _mm_unpackhi_epi16(layer2_chunk3, layer2_chunk7);
+
+    v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk4);
+    v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk4);
+    v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk5);
+    v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk5);
+    v_b0 = _mm_unpacklo_epi16(layer3_chunk2, layer3_chunk6);
+    v_b1 = _mm_unpackhi_epi16(layer3_chunk2, layer3_chunk6);
+    v_a0 = _mm_unpacklo_epi16(layer3_chunk3, layer3_chunk7);
+    v_a1 = _mm_unpackhi_epi16(layer3_chunk3, layer3_chunk7);
+}
+
+#if CV_SSE4_1
+
+inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
+{
+    __m128i v_mask = _mm_set1_epi32(0x0000ffff);
+
+    __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer3_chunk2 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16));
+    __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer3_chunk3 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16));
+
+    __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk2 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16));
+    __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16));
+
+    __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk2 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16));
+    __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16));
+
+    v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_g0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16));
+    v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_g1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16));
+}
+
+inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0,
+                                 __m128i & v_g1, __m128i & v_b0, __m128i & v_b1)
+{
+    __m128i v_mask = _mm_set1_epi32(0x0000ffff);
+
+    __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer3_chunk3 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16));
+    __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer3_chunk4 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16));
+    __m128i layer3_chunk2 = _mm_packus_epi32(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask));
+    __m128i layer3_chunk5 = _mm_packus_epi32(_mm_srli_epi32(v_b0, 16), _mm_srli_epi32(v_b1, 16));
+
+    __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16));
+    __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16));
+    __m128i layer2_chunk2 = _mm_packus_epi32(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask));
+    __m128i layer2_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk4, 16), _mm_srli_epi32(layer3_chunk5, 16));
+
+    __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16));
+    __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16));
+    __m128i layer1_chunk2 = _mm_packus_epi32(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask));
+    __m128i layer1_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk4, 16), _mm_srli_epi32(layer2_chunk5, 16));
+
+    v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_g1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16));
+    v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_b0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16));
+    v_g0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask));
+    v_b1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk4, 16), _mm_srli_epi32(layer1_chunk5, 16));
+}
+
+inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1,
+                                 __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1)
+{
+    __m128i v_mask = _mm_set1_epi32(0x0000ffff);
+
+    __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer3_chunk4 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16));
+    __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer3_chunk5 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16));
+    __m128i layer3_chunk2 = _mm_packus_epi32(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask));
+    __m128i layer3_chunk6 = _mm_packus_epi32(_mm_srli_epi32(v_b0, 16), _mm_srli_epi32(v_b1, 16));
+    __m128i layer3_chunk3 = _mm_packus_epi32(_mm_and_si128(v_a0, v_mask), _mm_and_si128(v_a1, v_mask));
+    __m128i layer3_chunk7 = _mm_packus_epi32(_mm_srli_epi32(v_a0, 16), _mm_srli_epi32(v_a1, 16));
+
+    __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16));
+    __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16));
+    __m128i layer2_chunk2 = _mm_packus_epi32(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask));
+    __m128i layer2_chunk6 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk4, 16), _mm_srli_epi32(layer3_chunk5, 16));
+    __m128i layer2_chunk3 = _mm_packus_epi32(_mm_and_si128(layer3_chunk6, v_mask), _mm_and_si128(layer3_chunk7, v_mask));
+    __m128i layer2_chunk7 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk6, 16), _mm_srli_epi32(layer3_chunk7, 16));
+
+    __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16));
+    __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16));
+    __m128i layer1_chunk2 = _mm_packus_epi32(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask));
+    __m128i layer1_chunk6 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk4, 16), _mm_srli_epi32(layer2_chunk5, 16));
+    __m128i layer1_chunk3 = _mm_packus_epi32(_mm_and_si128(layer2_chunk6, v_mask), _mm_and_si128(layer2_chunk7, v_mask));
+    __m128i layer1_chunk7 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk6, 16), _mm_srli_epi32(layer2_chunk7, 16));
+
+    v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_b0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16));
+    v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_b1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16));
+    v_g0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask));
+    v_a0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk4, 16), _mm_srli_epi32(layer1_chunk5, 16));
+    v_g1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk6, v_mask), _mm_and_si128(layer1_chunk7, v_mask));
+    v_a1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk6, 16), _mm_srli_epi32(layer1_chunk7, 16));
+}
+
+#endif // CV_SSE4_1
+
+inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1)
+{
+    __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_g0);
+    __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_g0);
+    __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_g1);
+    __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_g1);
+
+    __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk2);
+    __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk2);
+    __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk3);
+    __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk3);
+
+    v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk2);
+    v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk2);
+    v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk3);
+    v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk3);
+}
+
+inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0,
+                                __m128 & v_g1, __m128 & v_b0, __m128 & v_b1)
+{
+    __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_g1);
+    __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_g1);
+    __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_b0);
+    __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_b0);
+    __m128 layer1_chunk4 = _mm_unpacklo_ps(v_g0, v_b1);
+    __m128 layer1_chunk5 = _mm_unpackhi_ps(v_g0, v_b1);
+
+    __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk3);
+    __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk3);
+    __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk4);
+    __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk4);
+    __m128 layer2_chunk4 = _mm_unpacklo_ps(layer1_chunk2, layer1_chunk5);
+    __m128 layer2_chunk5 = _mm_unpackhi_ps(layer1_chunk2, layer1_chunk5);
+
+    v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk3);
+    v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk3);
+    v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk4);
+    v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk4);
+    v_b0 = _mm_unpacklo_ps(layer2_chunk2, layer2_chunk5);
+    v_b1 = _mm_unpackhi_ps(layer2_chunk2, layer2_chunk5);
+}
+
+inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1,
+                                __m128 & v_b0, __m128 & v_b1, __m128 & v_a0, __m128 & v_a1)
+{
+    __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_b0);
+    __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_b0);
+    __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_b1);
+    __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_b1);
+    __m128 layer1_chunk4 = _mm_unpacklo_ps(v_g0, v_a0);
+    __m128 layer1_chunk5 = _mm_unpackhi_ps(v_g0, v_a0);
+    __m128 layer1_chunk6 = _mm_unpacklo_ps(v_g1, v_a1);
+    __m128 layer1_chunk7 = _mm_unpackhi_ps(v_g1, v_a1);
+
+    __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk4);
+    __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk4);
+    __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk5);
+    __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk5);
+    __m128 layer2_chunk4 = _mm_unpacklo_ps(layer1_chunk2, layer1_chunk6);
+    __m128 layer2_chunk5 = _mm_unpackhi_ps(layer1_chunk2, layer1_chunk6);
+    __m128 layer2_chunk6 = _mm_unpacklo_ps(layer1_chunk3, layer1_chunk7);
+    __m128 layer2_chunk7 = _mm_unpackhi_ps(layer1_chunk3, layer1_chunk7);
+
+    v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk4);
+    v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk4);
+    v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk5);
+    v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk5);
+    v_b0 = _mm_unpacklo_ps(layer2_chunk2, layer2_chunk6);
+    v_b1 = _mm_unpackhi_ps(layer2_chunk2, layer2_chunk6);
+    v_a0 = _mm_unpacklo_ps(layer2_chunk3, layer2_chunk7);
+    v_a1 = _mm_unpackhi_ps(layer2_chunk3, layer2_chunk7);
+}
+
+inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1)
+{
+    const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
+
+    __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
+    __m128 layer2_chunk2 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
+    __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo);
+    __m128 layer2_chunk3 = _mm_shuffle_ps(v_g0, v_g1, mask_hi);
+
+    __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo);
+    __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi);
+    __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo);
+    __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi);
+
+    v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo);
+    v_g0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi);
+    v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo);
+    v_g1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi);
+}
+
+inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0,
+                              __m128 & v_g1, __m128 & v_b0, __m128 & v_b1)
+{
+    const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
+
+    __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
+    __m128 layer2_chunk3 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
+    __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo);
+    __m128 layer2_chunk4 = _mm_shuffle_ps(v_g0, v_g1, mask_hi);
+    __m128 layer2_chunk2 = _mm_shuffle_ps(v_b0, v_b1, mask_lo);
+    __m128 layer2_chunk5 = _mm_shuffle_ps(v_b0, v_b1, mask_hi);
+
+    __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo);
+    __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi);
+    __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo);
+    __m128 layer1_chunk4 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi);
+    __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_lo);
+    __m128 layer1_chunk5 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_hi);
+
+    v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo);
+    v_g1 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi);
+    v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo);
+    v_b0 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi);
+    v_g0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_lo);
+    v_b1 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_hi);
+}
+
+inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1,
+                              __m128 & v_b0, __m128 & v_b1, __m128 & v_a0, __m128 & v_a1)
+{
+    const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
+
+    __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
+    __m128 layer2_chunk4 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
+    __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo);
+    __m128 layer2_chunk5 = _mm_shuffle_ps(v_g0, v_g1, mask_hi);
+    __m128 layer2_chunk2 = _mm_shuffle_ps(v_b0, v_b1, mask_lo);
+    __m128 layer2_chunk6 = _mm_shuffle_ps(v_b0, v_b1, mask_hi);
+    __m128 layer2_chunk3 = _mm_shuffle_ps(v_a0, v_a1, mask_lo);
+    __m128 layer2_chunk7 = _mm_shuffle_ps(v_a0, v_a1, mask_hi);
+
+    __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo);
+    __m128 layer1_chunk4 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi);
+    __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo);
+    __m128 layer1_chunk5 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi);
+    __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_lo);
+    __m128 layer1_chunk6 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_hi);
+    __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk6, layer2_chunk7, mask_lo);
+    __m128 layer1_chunk7 = _mm_shuffle_ps(layer2_chunk6, layer2_chunk7, mask_hi);
+
+    v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo);
+    v_b0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi);
+    v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo);
+    v_b1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi);
+    v_g0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_lo);
+    v_a0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_hi);
+    v_g1 = _mm_shuffle_ps(layer1_chunk6, layer1_chunk7, mask_lo);
+    v_a1 = _mm_shuffle_ps(layer1_chunk6, layer1_chunk7, mask_hi);
+}
+
+#endif // CV_SSE2
+
+//! @}
+
+#endif //__OPENCV_CORE_SSE_UTILS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp
new file mode 100644
index 0000000..49bc844
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp
@@ -0,0 +1,326 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_TRAITS_HPP__
+#define __OPENCV_CORE_TRAITS_HPP__
+
+#include "opencv2/core/cvdef.h"
+
+namespace cv
+{
+
+//! @addtogroup core_basic
+//! @{
+
+/** @brief Template "trait" class for OpenCV primitive data types.
+
+A primitive OpenCV data type is one of unsigned char, bool, signed char, unsigned short, signed
+short, int, float, double, or a tuple of values of one of these types, where all the values in the
+tuple have the same type. Any primitive type from the list can be defined by an identifier in the
+form CV_\<bit-depth\>{U|S|F}C(\<number_of_channels\>), for example: uchar \~ CV_8UC1, 3-element
+floating-point tuple \~ CV_32FC3, and so on. A universal OpenCV structure that is able to store a
+single instance of such a primitive data type is Vec. Multiple instances of such a type can be
+stored in a std::vector, Mat, Mat_, SparseMat, SparseMat_, or any other container that is able to
+store Vec instances.
+
+The DataType class is basically used to provide a description of such primitive data types without
+adding any fields or methods to the corresponding classes (and it is actually impossible to add
+anything to primitive C/C++ data types). This technique is known in C++ as class traits. It is not
+DataType itself that is used but its specialized versions, such as:
+@code
+    template<> class DataType<uchar>
+    {
+        typedef uchar value_type;
+        typedef int work_type;
+        typedef uchar channel_type;
+        enum { channel_type = CV_8U, channels = 1, fmt='u', type = CV_8U };
+    };
+    ...
+    template<typename _Tp> DataType<std::complex<_Tp> >
+    {
+        typedef std::complex<_Tp> value_type;
+        typedef std::complex<_Tp> work_type;
+        typedef _Tp channel_type;
+        // DataDepth is another helper trait class
+        enum { depth = DataDepth<_Tp>::value, channels=2,
+            fmt=(channels-1)*256+DataDepth<_Tp>::fmt,
+            type=CV_MAKETYPE(depth, channels) };
+    };
+    ...
+@endcode
+The main purpose of this class is to convert compilation-time type information to an
+OpenCV-compatible data type identifier, for example:
+@code
+    // allocates a 30x40 floating-point matrix
+    Mat A(30, 40, DataType<float>::type);
+
+    Mat B = Mat_<std::complex<double> >(3, 3);
+    // the statement below will print 6, 2 , that is depth == CV_64F, channels == 2
+    cout << B.depth() << ", " << B.channels() << endl;
+@endcode
+So, such traits are used to tell OpenCV which data type you are working with, even if such a type is
+not native to OpenCV. For example, the matrix B initialization above is compiled because OpenCV
+defines the proper specialized template class DataType\<complex\<_Tp\> \> . This mechanism is also
+useful (and used in OpenCV this way) for generic algorithms implementations.
+*/
+template<typename _Tp> class DataType
+{
+public:
+    typedef _Tp         value_type;
+    typedef value_type  work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 1,
+           depth        = -1,
+           channels     = 1,
+           fmt          = 0,
+           type = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<bool>
+{
+public:
+    typedef bool        value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_8U,
+           channels     = 1,
+           fmt          = (int)'u',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<uchar>
+{
+public:
+    typedef uchar       value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_8U,
+           channels     = 1,
+           fmt          = (int)'u',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<schar>
+{
+public:
+    typedef schar       value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_8S,
+           channels     = 1,
+           fmt          = (int)'c',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<char>
+{
+public:
+    typedef schar       value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_8S,
+           channels     = 1,
+           fmt          = (int)'c',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<ushort>
+{
+public:
+    typedef ushort      value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_16U,
+           channels     = 1,
+           fmt          = (int)'w',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<short>
+{
+public:
+    typedef short       value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_16S,
+           channels     = 1,
+           fmt          = (int)'s',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<int>
+{
+public:
+    typedef int         value_type;
+    typedef value_type  work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_32S,
+           channels     = 1,
+           fmt          = (int)'i',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<float>
+{
+public:
+    typedef float       value_type;
+    typedef value_type  work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_32F,
+           channels     = 1,
+           fmt          = (int)'f',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<double>
+{
+public:
+    typedef double      value_type;
+    typedef value_type  work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_64F,
+           channels     = 1,
+           fmt          = (int)'d',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+
+/** @brief A helper class for cv::DataType
+
+The class is specialized for each fundamental numerical data type supported by OpenCV. It provides
+DataDepth<T>::value constant.
+*/
+template<typename _Tp> class DataDepth
+{
+public:
+    enum
+    {
+        value = DataType<_Tp>::depth,
+        fmt   = DataType<_Tp>::fmt
+    };
+};
+
+
+
+template<int _depth> class TypeDepth
+{
+    enum { depth = CV_USRTYPE1 };
+    typedef void value_type;
+};
+
+template<> class TypeDepth<CV_8U>
+{
+    enum { depth = CV_8U };
+    typedef uchar value_type;
+};
+
+template<> class TypeDepth<CV_8S>
+{
+    enum { depth = CV_8S };
+    typedef schar value_type;
+};
+
+template<> class TypeDepth<CV_16U>
+{
+    enum { depth = CV_16U };
+    typedef ushort value_type;
+};
+
+template<> class TypeDepth<CV_16S>
+{
+    enum { depth = CV_16S };
+    typedef short value_type;
+};
+
+template<> class TypeDepth<CV_32S>
+{
+    enum { depth = CV_32S };
+    typedef int value_type;
+};
+
+template<> class TypeDepth<CV_32F>
+{
+    enum { depth = CV_32F };
+    typedef float value_type;
+};
+
+template<> class TypeDepth<CV_64F>
+{
+    enum { depth = CV_64F };
+    typedef double value_type;
+};
+
+//! @}
+
+} // cv
+
+#endif // __OPENCV_CORE_TRAITS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types.hpp
new file mode 100644
index 0000000..e166556
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types.hpp
@@ -0,0 +1,2228 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_TYPES_HPP__
+#define __OPENCV_CORE_TYPES_HPP__
+
+#ifndef __cplusplus
+#  error types.hpp header must be compiled as C++
+#endif
+
+#include <climits>
+#include <cfloat>
+#include <vector>
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/cvstd.hpp"
+#include "opencv2/core/matx.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_basic
+//! @{
+
+//////////////////////////////// Complex //////////////////////////////
+
+/** @brief  A complex number class.
+
+  The template class is similar and compatible with std::complex, however it provides slightly
+  more convenient access to the real and imaginary parts using through the simple field access, as opposite
+  to std::complex::real() and std::complex::imag().
+*/
+template<typename _Tp> class Complex
+{
+public:
+
+    //! constructors
+    Complex();
+    Complex( _Tp _re, _Tp _im = 0 );
+
+    //! conversion to another data type
+    template<typename T2> operator Complex<T2>() const;
+    //! conjugation
+    Complex conj() const;
+
+    _Tp re, im; //< the real and the imaginary parts
+};
+
+typedef Complex<float> Complexf;
+typedef Complex<double> Complexd;
+
+template<typename _Tp> class DataType< Complex<_Tp> >
+{
+public:
+    typedef Complex<_Tp> value_type;
+    typedef value_type   work_type;
+    typedef _Tp          channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels) };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Point_ ////////////////////////////////
+
+/** @brief Template class for 2D points specified by its coordinates `x` and `y`.
+
+An instance of the class is interchangeable with C structures, CvPoint and CvPoint2D32f . There is
+also a cast operator to convert point coordinates to the specified type. The conversion from
+floating-point coordinates to integer coordinates is done by rounding. Commonly, the conversion
+uses this operation for each of the coordinates. Besides the class members listed in the
+declaration above, the following operations on points are implemented:
+@code
+    pt1 = pt2 + pt3;
+    pt1 = pt2 - pt3;
+    pt1 = pt2 * a;
+    pt1 = a * pt2;
+    pt1 = pt2 / a;
+    pt1 += pt2;
+    pt1 -= pt2;
+    pt1 *= a;
+    pt1 /= a;
+    double value = norm(pt); // L2 norm
+    pt1 == pt2;
+    pt1 != pt2;
+@endcode
+For your convenience, the following type aliases are defined:
+@code
+    typedef Point_<int> Point2i;
+    typedef Point2i Point;
+    typedef Point_<float> Point2f;
+    typedef Point_<double> Point2d;
+@endcode
+Example:
+@code
+    Point2f a(0.3f, 0.f), b(0.f, 0.4f);
+    Point pt = (a + b)*10.f;
+    cout << pt.x << ", " << pt.y << endl;
+@endcode
+*/
+template<typename _Tp> class Point_
+{
+public:
+    typedef _Tp value_type;
+
+    // various constructors
+    Point_();
+    Point_(_Tp _x, _Tp _y);
+    Point_(const Point_& pt);
+    Point_(const Size_<_Tp>& sz);
+    Point_(const Vec<_Tp, 2>& v);
+
+    Point_& operator = (const Point_& pt);
+    //! conversion to another data type
+    template<typename _Tp2> operator Point_<_Tp2>() const;
+
+    //! conversion to the old-style C structures
+    operator Vec<_Tp, 2>() const;
+
+    //! dot product
+    _Tp dot(const Point_& pt) const;
+    //! dot product computed in double-precision arithmetics
+    double ddot(const Point_& pt) const;
+    //! cross-product
+    double cross(const Point_& pt) const;
+    //! checks whether the point is inside the specified rectangle
+    bool inside(const Rect_<_Tp>& r) const;
+
+    _Tp x, y; //< the point coordinates
+};
+
+typedef Point_<int> Point2i;
+typedef Point_<float> Point2f;
+typedef Point_<double> Point2d;
+typedef Point2i Point;
+
+template<typename _Tp> class DataType< Point_<_Tp> >
+{
+public:
+    typedef Point_<_Tp>                               value_type;
+    typedef Point_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                       channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Point3_ ////////////////////////////////
+
+/** @brief Template class for 3D points specified by its coordinates `x`, `y` and `z`.
+
+An instance of the class is interchangeable with the C structure CvPoint2D32f . Similarly to
+Point_ , the coordinates of 3D points can be converted to another type. The vector arithmetic and
+comparison operations are also supported.
+
+The following Point3_\<\> aliases are available:
+@code
+    typedef Point3_<int> Point3i;
+    typedef Point3_<float> Point3f;
+    typedef Point3_<double> Point3d;
+@endcode
+@see cv::Point3i, cv::Point3f and cv::Point3d
+*/
+template<typename _Tp> class Point3_
+{
+public:
+    typedef _Tp value_type;
+
+    // various constructors
+    Point3_();
+    Point3_(_Tp _x, _Tp _y, _Tp _z);
+    Point3_(const Point3_& pt);
+    explicit Point3_(const Point_<_Tp>& pt);
+    Point3_(const Vec<_Tp, 3>& v);
+
+    Point3_& operator = (const Point3_& pt);
+    //! conversion to another data type
+    template<typename _Tp2> operator Point3_<_Tp2>() const;
+    //! conversion to cv::Vec<>
+    operator Vec<_Tp, 3>() const;
+
+    //! dot product
+    _Tp dot(const Point3_& pt) const;
+    //! dot product computed in double-precision arithmetics
+    double ddot(const Point3_& pt) const;
+    //! cross product of the 2 3D points
+    Point3_ cross(const Point3_& pt) const;
+
+    _Tp x, y, z; //< the point coordinates
+};
+
+typedef Point3_<int> Point3i;
+typedef Point3_<float> Point3f;
+typedef Point3_<double> Point3d;
+
+template<typename _Tp> class DataType< Point3_<_Tp> >
+{
+public:
+    typedef Point3_<_Tp>                               value_type;
+    typedef Point3_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                        channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 3,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Size_ ////////////////////////////////
+
+/** @brief Template class for specifying the size of an image or rectangle.
+
+The class includes two members called width and height. The structure can be converted to and from
+the old OpenCV structures CvSize and CvSize2D32f . The same set of arithmetic and comparison
+operations as for Point_ is available.
+
+OpenCV defines the following Size_\<\> aliases:
+@code
+    typedef Size_<int> Size2i;
+    typedef Size2i Size;
+    typedef Size_<float> Size2f;
+@endcode
+*/
+template<typename _Tp> class Size_
+{
+public:
+    typedef _Tp value_type;
+
+    //! various constructors
+    Size_();
+    Size_(_Tp _width, _Tp _height);
+    Size_(const Size_& sz);
+    Size_(const Point_<_Tp>& pt);
+
+    Size_& operator = (const Size_& sz);
+    //! the area (width*height)
+    _Tp area() const;
+
+    //! conversion of another data type.
+    template<typename _Tp2> operator Size_<_Tp2>() const;
+
+    _Tp width, height; // the width and the height
+};
+
+typedef Size_<int> Size2i;
+typedef Size_<float> Size2f;
+typedef Size_<double> Size2d;
+typedef Size2i Size;
+
+template<typename _Tp> class DataType< Size_<_Tp> >
+{
+public:
+    typedef Size_<_Tp>                               value_type;
+    typedef Size_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                      channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Rect_ ////////////////////////////////
+
+/** @brief Template class for 2D rectangles
+
+described by the following parameters:
+-   Coordinates of the top-left corner. This is a default interpretation of Rect_::x and Rect_::y
+    in OpenCV. Though, in your algorithms you may count x and y from the bottom-left corner.
+-   Rectangle width and height.
+
+OpenCV typically assumes that the top and left boundary of the rectangle are inclusive, while the
+right and bottom boundaries are not. For example, the method Rect_::contains returns true if
+
+\f[x  \leq pt.x < x+width,
+      y  \leq pt.y < y+height\f]
+
+Virtually every loop over an image ROI in OpenCV (where ROI is specified by Rect_\<int\> ) is
+implemented as:
+@code
+    for(int y = roi.y; y < roi.y + roi.height; y++)
+        for(int x = roi.x; x < roi.x + roi.width; x++)
+        {
+            // ...
+        }
+@endcode
+In addition to the class members, the following operations on rectangles are implemented:
+-   \f$\texttt{rect} = \texttt{rect} \pm \texttt{point}\f$ (shifting a rectangle by a certain offset)
+-   \f$\texttt{rect} = \texttt{rect} \pm \texttt{size}\f$ (expanding or shrinking a rectangle by a
+    certain amount)
+-   rect += point, rect -= point, rect += size, rect -= size (augmenting operations)
+-   rect = rect1 & rect2 (rectangle intersection)
+-   rect = rect1 | rect2 (minimum area rectangle containing rect1 and rect2 )
+-   rect &= rect1, rect |= rect1 (and the corresponding augmenting operations)
+-   rect == rect1, rect != rect1 (rectangle comparison)
+
+This is an example how the partial ordering on rectangles can be established (rect1 \f$\subseteq\f$
+rect2):
+@code
+    template<typename _Tp> inline bool
+    operator <= (const Rect_<_Tp>& r1, const Rect_<_Tp>& r2)
+    {
+        return (r1 & r2) == r1;
+    }
+@endcode
+For your convenience, the Rect_\<\> alias is available: cv::Rect
+*/
+template<typename _Tp> class Rect_
+{
+public:
+    typedef _Tp value_type;
+
+    //! various constructors
+    Rect_();
+    Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height);
+    Rect_(const Rect_& r);
+    Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz);
+    Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2);
+
+    Rect_& operator = ( const Rect_& r );
+    //! the top-left corner
+    Point_<_Tp> tl() const;
+    //! the bottom-right corner
+    Point_<_Tp> br() const;
+
+    //! size (width, height) of the rectangle
+    Size_<_Tp> size() const;
+    //! area (width*height) of the rectangle
+    _Tp area() const;
+
+    //! conversion to another data type
+    template<typename _Tp2> operator Rect_<_Tp2>() const;
+
+    //! checks whether the rectangle contains the point
+    bool contains(const Point_<_Tp>& pt) const;
+
+    _Tp x, y, width, height; //< the top-left corner, as well as width and height of the rectangle
+};
+
+typedef Rect_<int> Rect2i;
+typedef Rect_<float> Rect2f;
+typedef Rect_<double> Rect2d;
+typedef Rect2i Rect;
+
+template<typename _Tp> class DataType< Rect_<_Tp> >
+{
+public:
+    typedef Rect_<_Tp>                               value_type;
+    typedef Rect_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                      channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 4,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+///////////////////////////// RotatedRect /////////////////////////////
+
+/** @brief The class represents rotated (i.e. not up-right) rectangles on a plane.
+
+Each rectangle is specified by the center point (mass center), length of each side (represented by
+cv::Size2f structure) and the rotation angle in degrees.
+
+The sample below demonstrates how to use RotatedRect:
+@code
+    Mat image(200, 200, CV_8UC3, Scalar(0));
+    RotatedRect rRect = RotatedRect(Point2f(100,100), Size2f(100,50), 30);
+
+    Point2f vertices[4];
+    rRect.points(vertices);
+    for (int i = 0; i < 4; i++)
+        line(image, vertices[i], vertices[(i+1)%4], Scalar(0,255,0));
+
+    Rect brect = rRect.boundingRect();
+    rectangle(image, brect, Scalar(255,0,0));
+
+    imshow("rectangles", image);
+    waitKey(0);
+@endcode
+![image](pics/rotatedrect.png)
+
+@sa CamShift, fitEllipse, minAreaRect, CvBox2D
+*/
+class CV_EXPORTS RotatedRect
+{
+public:
+    //! various constructors
+    RotatedRect();
+    /**
+    @param center The rectangle mass center.
+    @param size Width and height of the rectangle.
+    @param angle The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc.,
+    the rectangle becomes an up-right rectangle.
+    */
+    RotatedRect(const Point2f& center, const Size2f& size, float angle);
+    /**
+    Any 3 end points of the RotatedRect. They must be given in order (either clockwise or
+    anticlockwise).
+     */
+    RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3);
+
+    /** returns 4 vertices of the rectangle
+    @param pts The points array for storing rectangle vertices.
+    */
+    void points(Point2f pts[]) const;
+    //! returns the minimal up-right rectangle containing the rotated rectangle
+    Rect boundingRect() const;
+
+    Point2f center; //< the rectangle mass center
+    Size2f size;    //< width and height of the rectangle
+    float angle;    //< the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
+};
+
+template<> class DataType< RotatedRect >
+{
+public:
+    typedef RotatedRect  value_type;
+    typedef value_type   work_type;
+    typedef float        channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = (int)sizeof(value_type)/sizeof(channel_type), // 5
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Range /////////////////////////////////
+
+/** @brief Template class specifying a continuous subsequence (slice) of a sequence.
+
+The class is used to specify a row or a column span in a matrix ( Mat ) and for many other purposes.
+Range(a,b) is basically the same as a:b in Matlab or a..b in Python. As in Python, start is an
+inclusive left boundary of the range and end is an exclusive right boundary of the range. Such a
+half-opened interval is usually denoted as \f$[start,end)\f$ .
+
+The static method Range::all() returns a special variable that means "the whole sequence" or "the
+whole range", just like " : " in Matlab or " ... " in Python. All the methods and functions in
+OpenCV that take Range support this special Range::all() value. But, of course, in case of your own
+custom processing, you will probably have to check and handle it explicitly:
+@code
+    void my_function(..., const Range& r, ....)
+    {
+        if(r == Range::all()) {
+            // process all the data
+        }
+        else {
+            // process [r.start, r.end)
+        }
+    }
+@endcode
+*/
+class CV_EXPORTS Range
+{
+public:
+    Range();
+    Range(int _start, int _end);
+    int size() const;
+    bool empty() const;
+    static Range all();
+
+    int start, end;
+};
+
+template<> class DataType<Range>
+{
+public:
+    typedef Range      value_type;
+    typedef value_type work_type;
+    typedef int        channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Scalar_ ///////////////////////////////
+
+/** @brief Template class for a 4-element vector derived from Vec.
+
+Being derived from Vec\<_Tp, 4\> , Scalar_ and Scalar can be used just as typical 4-element
+vectors. In addition, they can be converted to/from CvScalar . The type Scalar is widely used in
+OpenCV to pass pixel values.
+*/
+template<typename _Tp> class Scalar_ : public Vec<_Tp, 4>
+{
+public:
+    //! various constructors
+    Scalar_();
+    Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
+    Scalar_(_Tp v0);
+
+    template<typename _Tp2, int cn>
+    Scalar_(const Vec<_Tp2, cn>& v);
+
+    //! returns a scalar with all elements set to v0
+    static Scalar_<_Tp> all(_Tp v0);
+
+    //! conversion to another data type
+    template<typename T2> operator Scalar_<T2>() const;
+
+    //! per-element product
+    Scalar_<_Tp> mul(const Scalar_<_Tp>& a, double scale=1 ) const;
+
+    // returns (v0, -v1, -v2, -v3)
+    Scalar_<_Tp> conj() const;
+
+    // returns true iff v1 == v2 == v3 == 0
+    bool isReal() const;
+};
+
+typedef Scalar_<double> Scalar;
+
+template<typename _Tp> class DataType< Scalar_<_Tp> >
+{
+public:
+    typedef Scalar_<_Tp>                               value_type;
+    typedef Scalar_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                        channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 4,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+/////////////////////////////// KeyPoint ////////////////////////////////
+
+/** @brief Data structure for salient point detectors.
+
+The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint
+detectors, such as Harris corner detector, cv::FAST, cv::StarDetector, cv::SURF, cv::SIFT,
+cv::LDetector etc.
+
+The keypoint is characterized by the 2D position, scale (proportional to the diameter of the
+neighborhood that needs to be taken into account), orientation and some other parameters. The
+keypoint neighborhood is then analyzed by another algorithm that builds a descriptor (usually
+represented as a feature vector). The keypoints representing the same object in different images
+can then be matched using cv::KDTree or another method.
+*/
+class CV_EXPORTS_W_SIMPLE KeyPoint
+{
+public:
+    //! the default constructor
+    CV_WRAP KeyPoint();
+    /**
+    @param _pt x & y coordinates of the keypoint
+    @param _size keypoint diameter
+    @param _angle keypoint orientation
+    @param _response keypoint detector response on the keypoint (that is, strength of the keypoint)
+    @param _octave pyramid octave in which the keypoint has been detected
+    @param _class_id object id
+     */
+    KeyPoint(Point2f _pt, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1);
+    /**
+    @param x x-coordinate of the keypoint
+    @param y y-coordinate of the keypoint
+    @param _size keypoint diameter
+    @param _angle keypoint orientation
+    @param _response keypoint detector response on the keypoint (that is, strength of the keypoint)
+    @param _octave pyramid octave in which the keypoint has been detected
+    @param _class_id object id
+     */
+    CV_WRAP KeyPoint(float x, float y, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1);
+
+    size_t hash() const;
+
+    /**
+    This method converts vector of keypoints to vector of points or the reverse, where each keypoint is
+    assigned the same size and the same orientation.
+
+    @param keypoints Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
+    @param points2f Array of (x,y) coordinates of each keypoint
+    @param keypointIndexes Array of indexes of keypoints to be converted to points. (Acts like a mask to
+    convert only specified keypoints)
+    */
+    CV_WRAP static void convert(const std::vector<KeyPoint>& keypoints,
+                                CV_OUT std::vector<Point2f>& points2f,
+                                const std::vector<int>& keypointIndexes=std::vector<int>());
+    /** @overload
+    @param points2f Array of (x,y) coordinates of each keypoint
+    @param keypoints Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
+    @param size keypoint diameter
+    @param response keypoint detector response on the keypoint (that is, strength of the keypoint)
+    @param octave pyramid octave in which the keypoint has been detected
+    @param class_id object id
+    */
+    CV_WRAP static void convert(const std::vector<Point2f>& points2f,
+                                CV_OUT std::vector<KeyPoint>& keypoints,
+                                float size=1, float response=1, int octave=0, int class_id=-1);
+
+    /**
+    This method computes overlap for pair of keypoints. Overlap is the ratio between area of keypoint
+    regions' intersection and area of keypoint regions' union (considering keypoint region as circle).
+    If they don't overlap, we get zero. If they coincide at same location with same size, we get 1.
+    @param kp1 First keypoint
+    @param kp2 Second keypoint
+    */
+    CV_WRAP static float overlap(const KeyPoint& kp1, const KeyPoint& kp2);
+
+    CV_PROP_RW Point2f pt; //!< coordinates of the keypoints
+    CV_PROP_RW float size; //!< diameter of the meaningful keypoint neighborhood
+    CV_PROP_RW float angle; //!< computed orientation of the keypoint (-1 if not applicable);
+                            //!< it's in [0,360) degrees and measured relative to
+                            //!< image coordinate system, ie in clockwise.
+    CV_PROP_RW float response; //!< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
+    CV_PROP_RW int octave; //!< octave (pyramid layer) from which the keypoint has been extracted
+    CV_PROP_RW int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to)
+};
+
+template<> class DataType<KeyPoint>
+{
+public:
+    typedef KeyPoint      value_type;
+    typedef float         work_type;
+    typedef float         channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = (int)(sizeof(value_type)/sizeof(channel_type)), // 7
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// DMatch /////////////////////////////////
+
+/** @brief Class for matching keypoint descriptors
+
+query descriptor index, train descriptor index, train image index, and distance between
+descriptors.
+*/
+class CV_EXPORTS_W_SIMPLE DMatch
+{
+public:
+    CV_WRAP DMatch();
+    CV_WRAP DMatch(int _queryIdx, int _trainIdx, float _distance);
+    CV_WRAP DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance);
+
+    CV_PROP_RW int queryIdx; // query descriptor index
+    CV_PROP_RW int trainIdx; // train descriptor index
+    CV_PROP_RW int imgIdx;   // train image index
+
+    CV_PROP_RW float distance;
+
+    // less is better
+    bool operator<(const DMatch &m) const;
+};
+
+template<> class DataType<DMatch>
+{
+public:
+    typedef DMatch      value_type;
+    typedef int         work_type;
+    typedef int         channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = (int)(sizeof(value_type)/sizeof(channel_type)), // 4
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+///////////////////////////// TermCriteria //////////////////////////////
+
+/** @brief The class defining termination criteria for iterative algorithms.
+
+You can initialize it by default constructor and then override any parameters, or the structure may
+be fully initialized using the advanced variant of the constructor.
+*/
+class CV_EXPORTS TermCriteria
+{
+public:
+    /**
+      Criteria type, can be one of: COUNT, EPS or COUNT + EPS
+    */
+    enum Type
+    {
+        COUNT=1, //!< the maximum number of iterations or elements to compute
+        MAX_ITER=COUNT, //!< ditto
+        EPS=2 //!< the desired accuracy or change in parameters at which the iterative algorithm stops
+    };
+
+    //! default constructor
+    TermCriteria();
+    /**
+    @param type The type of termination criteria, one of TermCriteria::Type
+    @param maxCount The maximum number of iterations or elements to compute.
+    @param epsilon The desired accuracy or change in parameters at which the iterative algorithm stops.
+    */
+    TermCriteria(int type, int maxCount, double epsilon);
+
+    int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPS
+    int maxCount; // the maximum number of iterations/elements
+    double epsilon; // the desired accuracy
+};
+
+
+//! @} core_basic
+
+///////////////////////// raster image moments //////////////////////////
+
+//! @addtogroup imgproc_shape
+//! @{
+
+/** @brief struct returned by cv::moments
+
+The spatial moments \f$\texttt{Moments::m}_{ji}\f$ are computed as:
+
+\f[\texttt{m} _{ji}= \sum _{x,y}  \left ( \texttt{array} (x,y)  \cdot x^j  \cdot y^i \right )\f]
+
+The central moments \f$\texttt{Moments::mu}_{ji}\f$ are computed as:
+
+\f[\texttt{mu} _{ji}= \sum _{x,y}  \left ( \texttt{array} (x,y)  \cdot (x -  \bar{x} )^j  \cdot (y -  \bar{y} )^i \right )\f]
+
+where \f$(\bar{x}, \bar{y})\f$ is the mass center:
+
+\f[\bar{x} = \frac{\texttt{m}_{10}}{\texttt{m}_{00}} , \; \bar{y} = \frac{\texttt{m}_{01}}{\texttt{m}_{00}}\f]
+
+The normalized central moments \f$\texttt{Moments::nu}_{ij}\f$ are computed as:
+
+\f[\texttt{nu} _{ji}= \frac{\texttt{mu}_{ji}}{\texttt{m}_{00}^{(i+j)/2+1}} .\f]
+
+@note
+\f$\texttt{mu}_{00}=\texttt{m}_{00}\f$, \f$\texttt{nu}_{00}=1\f$
+\f$\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\f$ , hence the values are not
+stored.
+
+The moments of a contour are defined in the same way but computed using the Green's formula (see
+<http://en.wikipedia.org/wiki/Green_theorem>). So, due to a limited raster resolution, the moments
+computed for a contour are slightly different from the moments computed for the same rasterized
+contour.
+
+@note
+Since the contour moments are computed using Green formula, you may get seemingly odd results for
+contours with self-intersections, e.g. a zero area (m00) for butterfly-shaped contours.
+ */
+class CV_EXPORTS_W_MAP Moments
+{
+public:
+    //! the default constructor
+    Moments();
+    //! the full constructor
+    Moments(double m00, double m10, double m01, double m20, double m11,
+            double m02, double m30, double m21, double m12, double m03 );
+    ////! the conversion from CvMoments
+    //Moments( const CvMoments& moments );
+    ////! the conversion to CvMoments
+    //operator CvMoments() const;
+
+    //! @name spatial moments
+    //! @{
+    CV_PROP_RW double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
+    //! @}
+
+    //! @name central moments
+    //! @{
+    CV_PROP_RW double  mu20, mu11, mu02, mu30, mu21, mu12, mu03;
+    //! @}
+
+    //! @name central normalized moments
+    //! @{
+    CV_PROP_RW double  nu20, nu11, nu02, nu30, nu21, nu12, nu03;
+    //! @}
+};
+
+template<> class DataType<Moments>
+{
+public:
+    typedef Moments     value_type;
+    typedef double      work_type;
+    typedef double      channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = (int)(sizeof(value_type)/sizeof(channel_type)), // 24
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+//! @} imgproc_shape
+
+//! @cond IGNORED
+
+/////////////////////////////////////////////////////////////////////////
+///////////////////////////// Implementation ////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////// Complex ////////////////////////////////
+
+template<typename _Tp> inline
+Complex<_Tp>::Complex()
+    : re(0), im(0) {}
+
+template<typename _Tp> inline
+Complex<_Tp>::Complex( _Tp _re, _Tp _im )
+    : re(_re), im(_im) {}
+
+template<typename _Tp> template<typename T2> inline
+Complex<_Tp>::operator Complex<T2>() const
+{
+    return Complex<T2>(saturate_cast<T2>(re), saturate_cast<T2>(im));
+}
+
+template<typename _Tp> inline
+Complex<_Tp> Complex<_Tp>::conj() const
+{
+    return Complex<_Tp>(re, -im);
+}
+
+
+template<typename _Tp> static inline
+bool operator == (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return a.re == b.re && a.im == b.im;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return a.re != b.re || a.im != b.im;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator + (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return Complex<_Tp>( a.re + b.re, a.im + b.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator += (Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    a.re += b.re; a.im += b.im;
+    return a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator - (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return Complex<_Tp>( a.re - b.re, a.im - b.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator -= (Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    a.re -= b.re; a.im -= b.im;
+    return a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator - (const Complex<_Tp>& a)
+{
+    return Complex<_Tp>(-a.re, -a.im);
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator * (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return Complex<_Tp>( a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator * (const Complex<_Tp>& a, _Tp b)
+{
+    return Complex<_Tp>( a.re*b, a.im*b );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator * (_Tp b, const Complex<_Tp>& a)
+{
+    return Complex<_Tp>( a.re*b, a.im*b );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator + (const Complex<_Tp>& a, _Tp b)
+{
+    return Complex<_Tp>( a.re + b, a.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator - (const Complex<_Tp>& a, _Tp b)
+{ return Complex<_Tp>( a.re - b, a.im ); }
+
+template<typename _Tp> static inline
+Complex<_Tp> operator + (_Tp b, const Complex<_Tp>& a)
+{
+    return Complex<_Tp>( a.re + b, a.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator - (_Tp b, const Complex<_Tp>& a)
+{
+    return Complex<_Tp>( b - a.re, -a.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator += (Complex<_Tp>& a, _Tp b)
+{
+    a.re += b; return a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator -= (Complex<_Tp>& a, _Tp b)
+{
+    a.re -= b; return a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator *= (Complex<_Tp>& a, _Tp b)
+{
+    a.re *= b; a.im *= b; return a;
+}
+
+template<typename _Tp> static inline
+double abs(const Complex<_Tp>& a)
+{
+    return std::sqrt( (double)a.re*a.re + (double)a.im*a.im);
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator / (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    double t = 1./((double)b.re*b.re + (double)b.im*b.im);
+    return Complex<_Tp>( (_Tp)((a.re*b.re + a.im*b.im)*t),
+                        (_Tp)((-a.re*b.im + a.im*b.re)*t) );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator /= (Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return (a = a / b);
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator / (const Complex<_Tp>& a, _Tp b)
+{
+    _Tp t = (_Tp)1/b;
+    return Complex<_Tp>( a.re*t, a.im*t );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator / (_Tp b, const Complex<_Tp>& a)
+{
+    return Complex<_Tp>(b)/a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator /= (const Complex<_Tp>& a, _Tp b)
+{
+    _Tp t = (_Tp)1/b;
+    a.re *= t; a.im *= t; return a;
+}
+
+
+
+//////////////////////////////// 2D Point ///////////////////////////////
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_()
+    : x(0), y(0) {}
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_(_Tp _x, _Tp _y)
+    : x(_x), y(_y) {}
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_(const Point_& pt)
+    : x(pt.x), y(pt.y) {}
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_(const Size_<_Tp>& sz)
+    : x(sz.width), y(sz.height) {}
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_(const Vec<_Tp,2>& v)
+    : x(v[0]), y(v[1]) {}
+
+template<typename _Tp> inline
+Point_<_Tp>& Point_<_Tp>::operator = (const Point_& pt)
+{
+    x = pt.x; y = pt.y;
+    return *this;
+}
+
+template<typename _Tp> template<typename _Tp2> inline
+Point_<_Tp>::operator Point_<_Tp2>() const
+{
+    return Point_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y));
+}
+
+template<typename _Tp> inline
+Point_<_Tp>::operator Vec<_Tp, 2>() const
+{
+    return Vec<_Tp, 2>(x, y);
+}
+
+template<typename _Tp> inline
+_Tp Point_<_Tp>::dot(const Point_& pt) const
+{
+    return saturate_cast<_Tp>(x*pt.x + y*pt.y);
+}
+
+template<typename _Tp> inline
+double Point_<_Tp>::ddot(const Point_& pt) const
+{
+    return (double)x*pt.x + (double)y*pt.y;
+}
+
+template<typename _Tp> inline
+double Point_<_Tp>::cross(const Point_& pt) const
+{
+    return (double)x*pt.y - (double)y*pt.x;
+}
+
+template<typename _Tp> inline bool
+Point_<_Tp>::inside( const Rect_<_Tp>& r ) const
+{
+    return r.contains(*this);
+}
+
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator += (Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    a.x += b.x;
+    a.y += b.y;
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator -= (Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    a.x -= b.x;
+    a.y -= b.y;
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator *= (Point_<_Tp>& a, int b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator *= (Point_<_Tp>& a, float b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator *= (Point_<_Tp>& a, double b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator /= (Point_<_Tp>& a, int b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator /= (Point_<_Tp>& a, float b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator /= (Point_<_Tp>& a, double b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+double norm(const Point_<_Tp>& pt)
+{
+    return std::sqrt((double)pt.x*pt.x + (double)pt.y*pt.y);
+}
+
+template<typename _Tp> static inline
+bool operator == (const Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return a.x == b.x && a.y == b.y;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return a.x != b.x || a.y != b.y;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator + (const Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x + b.x), saturate_cast<_Tp>(a.y + b.y) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator - (const Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x - b.x), saturate_cast<_Tp>(a.y - b.y) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator - (const Point_<_Tp>& a)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(-a.x), saturate_cast<_Tp>(-a.y) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (const Point_<_Tp>& a, int b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (int a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (const Point_<_Tp>& a, float b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (float a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (const Point_<_Tp>& a, double b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (double a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (const Matx<_Tp, 2, 2>& a, const Point_<_Tp>& b)
+{
+    Matx<_Tp, 2, 1> tmp = a * Vec<_Tp,2>(b.x, b.y);
+    return Point_<_Tp>(tmp.val[0], tmp.val[1]);
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Matx<_Tp, 3, 3>& a, const Point_<_Tp>& b)
+{
+    Matx<_Tp, 3, 1> tmp = a * Vec<_Tp,3>(b.x, b.y, 1);
+    return Point3_<_Tp>(tmp.val[0], tmp.val[1], tmp.val[2]);
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator / (const Point_<_Tp>& a, int b)
+{
+    Point_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator / (const Point_<_Tp>& a, float b)
+{
+    Point_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator / (const Point_<_Tp>& a, double b)
+{
+    Point_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+
+
+//////////////////////////////// 3D Point ///////////////////////////////
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_()
+    : x(0), y(0), z(0) {}
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_(_Tp _x, _Tp _y, _Tp _z)
+    : x(_x), y(_y), z(_z) {}
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_(const Point3_& pt)
+    : x(pt.x), y(pt.y), z(pt.z) {}
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_(const Point_<_Tp>& pt)
+    : x(pt.x), y(pt.y), z(_Tp()) {}
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_(const Vec<_Tp, 3>& v)
+    : x(v[0]), y(v[1]), z(v[2]) {}
+
+template<typename _Tp> template<typename _Tp2> inline
+Point3_<_Tp>::operator Point3_<_Tp2>() const
+{
+    return Point3_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y), saturate_cast<_Tp2>(z));
+}
+
+template<typename _Tp> inline
+Point3_<_Tp>::operator Vec<_Tp, 3>() const
+{
+    return Vec<_Tp, 3>(x, y, z);
+}
+
+template<typename _Tp> inline
+Point3_<_Tp>& Point3_<_Tp>::operator = (const Point3_& pt)
+{
+    x = pt.x; y = pt.y; z = pt.z;
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp Point3_<_Tp>::dot(const Point3_& pt) const
+{
+    return saturate_cast<_Tp>(x*pt.x + y*pt.y + z*pt.z);
+}
+
+template<typename _Tp> inline
+double Point3_<_Tp>::ddot(const Point3_& pt) const
+{
+    return (double)x*pt.x + (double)y*pt.y + (double)z*pt.z;
+}
+
+template<typename _Tp> inline
+Point3_<_Tp> Point3_<_Tp>::cross(const Point3_<_Tp>& pt) const
+{
+    return Point3_<_Tp>(y*pt.z - z*pt.y, z*pt.x - x*pt.z, x*pt.y - y*pt.x);
+}
+
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator += (Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    a.x += b.x;
+    a.y += b.y;
+    a.z += b.z;
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator -= (Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    a.x -= b.x;
+    a.y -= b.y;
+    a.z -= b.z;
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator *= (Point3_<_Tp>& a, int b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    a.z = saturate_cast<_Tp>(a.z * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator *= (Point3_<_Tp>& a, float b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    a.z = saturate_cast<_Tp>(a.z * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator *= (Point3_<_Tp>& a, double b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    a.z = saturate_cast<_Tp>(a.z * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator /= (Point3_<_Tp>& a, int b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    a.z = saturate_cast<_Tp>(a.z / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator /= (Point3_<_Tp>& a, float b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    a.z = saturate_cast<_Tp>(a.z / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator /= (Point3_<_Tp>& a, double b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    a.z = saturate_cast<_Tp>(a.z / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+double norm(const Point3_<_Tp>& pt)
+{
+    return std::sqrt((double)pt.x*pt.x + (double)pt.y*pt.y + (double)pt.z*pt.z);
+}
+
+template<typename _Tp> static inline
+bool operator == (const Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    return a.x == b.x && a.y == b.y && a.z == b.z;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    return a.x != b.x || a.y != b.y || a.z != b.z;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator + (const Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x + b.x), saturate_cast<_Tp>(a.y + b.y), saturate_cast<_Tp>(a.z + b.z));
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator - (const Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x - b.x), saturate_cast<_Tp>(a.y - b.y), saturate_cast<_Tp>(a.z - b.z));
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator - (const Point3_<_Tp>& a)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(-a.x), saturate_cast<_Tp>(-a.y), saturate_cast<_Tp>(-a.z) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Point3_<_Tp>& a, int b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b), saturate_cast<_Tp>(a.z*b) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (int a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Point3_<_Tp>& a, float b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x * b), saturate_cast<_Tp>(a.y * b), saturate_cast<_Tp>(a.z * b) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (float a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Point3_<_Tp>& a, double b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x * b), saturate_cast<_Tp>(a.y * b), saturate_cast<_Tp>(a.z * b) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (double a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Matx<_Tp, 3, 3>& a, const Point3_<_Tp>& b)
+{
+    Matx<_Tp, 3, 1> tmp = a * Vec<_Tp,3>(b.x, b.y, b.z);
+    return Point3_<_Tp>(tmp.val[0], tmp.val[1], tmp.val[2]);
+}
+
+template<typename _Tp> static inline
+Matx<_Tp, 4, 1> operator * (const Matx<_Tp, 4, 4>& a, const Point3_<_Tp>& b)
+{
+    return a * Matx<_Tp, 4, 1>(b.x, b.y, b.z, 1);
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator / (const Point3_<_Tp>& a, int b)
+{
+    Point3_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator / (const Point3_<_Tp>& a, float b)
+{
+    Point3_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator / (const Point3_<_Tp>& a, double b)
+{
+    Point3_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+
+
+////////////////////////////////// Size /////////////////////////////////
+
+template<typename _Tp> inline
+Size_<_Tp>::Size_()
+    : width(0), height(0) {}
+
+template<typename _Tp> inline
+Size_<_Tp>::Size_(_Tp _width, _Tp _height)
+    : width(_width), height(_height) {}
+
+template<typename _Tp> inline
+Size_<_Tp>::Size_(const Size_& sz)
+    : width(sz.width), height(sz.height) {}
+
+template<typename _Tp> inline
+Size_<_Tp>::Size_(const Point_<_Tp>& pt)
+    : width(pt.x), height(pt.y) {}
+
+template<typename _Tp> template<typename _Tp2> inline
+Size_<_Tp>::operator Size_<_Tp2>() const
+{
+    return Size_<_Tp2>(saturate_cast<_Tp2>(width), saturate_cast<_Tp2>(height));
+}
+
+template<typename _Tp> inline
+Size_<_Tp>& Size_<_Tp>::operator = (const Size_<_Tp>& sz)
+{
+    width = sz.width; height = sz.height;
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp Size_<_Tp>::area() const
+{
+    return width * height;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp>& operator *= (Size_<_Tp>& a, _Tp b)
+{
+    a.width *= b;
+    a.height *= b;
+    return a;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp> operator * (const Size_<_Tp>& a, _Tp b)
+{
+    Size_<_Tp> tmp(a);
+    tmp *= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp>& operator /= (Size_<_Tp>& a, _Tp b)
+{
+    a.width /= b;
+    a.height /= b;
+    return a;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp> operator / (const Size_<_Tp>& a, _Tp b)
+{
+    Size_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp>& operator += (Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    a.width += b.width;
+    a.height += b.height;
+    return a;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp> operator + (const Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    Size_<_Tp> tmp(a);
+    tmp += b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp>& operator -= (Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    a.width -= b.width;
+    a.height -= b.height;
+    return a;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp> operator - (const Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    Size_<_Tp> tmp(a);
+    tmp -= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+bool operator == (const Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    return a.width == b.width && a.height == b.height;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    return !(a == b);
+}
+
+
+
+////////////////////////////////// Rect /////////////////////////////////
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_()
+    : x(0), y(0), width(0), height(0) {}
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height)
+    : x(_x), y(_y), width(_width), height(_height) {}
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_(const Rect_<_Tp>& r)
+    : x(r.x), y(r.y), width(r.width), height(r.height) {}
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz)
+    : x(org.x), y(org.y), width(sz.width), height(sz.height) {}
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2)
+{
+    x = std::min(pt1.x, pt2.x);
+    y = std::min(pt1.y, pt2.y);
+    width = std::max(pt1.x, pt2.x) - x;
+    height = std::max(pt1.y, pt2.y) - y;
+}
+
+template<typename _Tp> inline
+Rect_<_Tp>& Rect_<_Tp>::operator = ( const Rect_<_Tp>& r )
+{
+    x = r.x;
+    y = r.y;
+    width = r.width;
+    height = r.height;
+    return *this;
+}
+
+template<typename _Tp> inline
+Point_<_Tp> Rect_<_Tp>::tl() const
+{
+    return Point_<_Tp>(x,y);
+}
+
+template<typename _Tp> inline
+Point_<_Tp> Rect_<_Tp>::br() const
+{
+    return Point_<_Tp>(x + width, y + height);
+}
+
+template<typename _Tp> inline
+Size_<_Tp> Rect_<_Tp>::size() const
+{
+    return Size_<_Tp>(width, height);
+}
+
+template<typename _Tp> inline
+_Tp Rect_<_Tp>::area() const
+{
+    return width * height;
+}
+
+template<typename _Tp> template<typename _Tp2> inline
+Rect_<_Tp>::operator Rect_<_Tp2>() const
+{
+    return Rect_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y), saturate_cast<_Tp2>(width), saturate_cast<_Tp2>(height));
+}
+
+template<typename _Tp> inline
+bool Rect_<_Tp>::contains(const Point_<_Tp>& pt) const
+{
+    return x <= pt.x && pt.x < x + width && y <= pt.y && pt.y < y + height;
+}
+
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator += ( Rect_<_Tp>& a, const Point_<_Tp>& b )
+{
+    a.x += b.x;
+    a.y += b.y;
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator -= ( Rect_<_Tp>& a, const Point_<_Tp>& b )
+{
+    a.x -= b.x;
+    a.y -= b.y;
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator += ( Rect_<_Tp>& a, const Size_<_Tp>& b )
+{
+    a.width += b.width;
+    a.height += b.height;
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator -= ( Rect_<_Tp>& a, const Size_<_Tp>& b )
+{
+    a.width -= b.width;
+    a.height -= b.height;
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator &= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
+{
+    _Tp x1 = std::max(a.x, b.x);
+    _Tp y1 = std::max(a.y, b.y);
+    a.width = std::min(a.x + a.width, b.x + b.width) - x1;
+    a.height = std::min(a.y + a.height, b.y + b.height) - y1;
+    a.x = x1;
+    a.y = y1;
+    if( a.width <= 0 || a.height <= 0 )
+        a = Rect();
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator |= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
+{
+    _Tp x1 = std::min(a.x, b.x);
+    _Tp y1 = std::min(a.y, b.y);
+    a.width = std::max(a.x + a.width, b.x + b.width) - x1;
+    a.height = std::max(a.y + a.height, b.y + b.height) - y1;
+    a.x = x1;
+    a.y = y1;
+    return a;
+}
+
+template<typename _Tp> static inline
+bool operator == (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
+{
+    return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
+{
+    return a.x != b.x || a.y != b.y || a.width != b.width || a.height != b.height;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator + (const Rect_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return Rect_<_Tp>( a.x + b.x, a.y + b.y, a.width, a.height );
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator - (const Rect_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return Rect_<_Tp>( a.x - b.x, a.y - b.y, a.width, a.height );
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator + (const Rect_<_Tp>& a, const Size_<_Tp>& b)
+{
+    return Rect_<_Tp>( a.x, a.y, a.width + b.width, a.height + b.height );
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator & (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
+{
+    Rect_<_Tp> c = a;
+    return c &= b;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator | (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
+{
+    Rect_<_Tp> c = a;
+    return c |= b;
+}
+
+
+
+////////////////////////////// RotatedRect //////////////////////////////
+
+inline
+RotatedRect::RotatedRect()
+    : center(), size(), angle(0) {}
+
+inline
+RotatedRect::RotatedRect(const Point2f& _center, const Size2f& _size, float _angle)
+    : center(_center), size(_size), angle(_angle) {}
+
+
+
+///////////////////////////////// Range /////////////////////////////////
+
+inline
+Range::Range()
+    : start(0), end(0) {}
+
+inline
+Range::Range(int _start, int _end)
+    : start(_start), end(_end) {}
+
+inline
+int Range::size() const
+{
+    return end - start;
+}
+
+inline
+bool Range::empty() const
+{
+    return start == end;
+}
+
+inline
+Range Range::all()
+{
+    return Range(INT_MIN, INT_MAX);
+}
+
+
+static inline
+bool operator == (const Range& r1, const Range& r2)
+{
+    return r1.start == r2.start && r1.end == r2.end;
+}
+
+static inline
+bool operator != (const Range& r1, const Range& r2)
+{
+    return !(r1 == r2);
+}
+
+static inline
+bool operator !(const Range& r)
+{
+    return r.start == r.end;
+}
+
+static inline
+Range operator & (const Range& r1, const Range& r2)
+{
+    Range r(std::max(r1.start, r2.start), std::min(r1.end, r2.end));
+    r.end = std::max(r.end, r.start);
+    return r;
+}
+
+static inline
+Range& operator &= (Range& r1, const Range& r2)
+{
+    r1 = r1 & r2;
+    return r1;
+}
+
+static inline
+Range operator + (const Range& r1, int delta)
+{
+    return Range(r1.start + delta, r1.end + delta);
+}
+
+static inline
+Range operator + (int delta, const Range& r1)
+{
+    return Range(r1.start + delta, r1.end + delta);
+}
+
+static inline
+Range operator - (const Range& r1, int delta)
+{
+    return r1 + (-delta);
+}
+
+
+
+///////////////////////////////// Scalar ////////////////////////////////
+
+template<typename _Tp> inline
+Scalar_<_Tp>::Scalar_()
+{
+    this->val[0] = this->val[1] = this->val[2] = this->val[3] = 0;
+}
+
+template<typename _Tp> inline
+Scalar_<_Tp>::Scalar_(_Tp v0, _Tp v1, _Tp v2, _Tp v3)
+{
+    this->val[0] = v0;
+    this->val[1] = v1;
+    this->val[2] = v2;
+    this->val[3] = v3;
+}
+
+template<typename _Tp> template<typename _Tp2, int cn> inline
+Scalar_<_Tp>::Scalar_(const Vec<_Tp2, cn>& v)
+{
+    int i;
+    for( i = 0; i < (cn < 4 ? cn : 4); i++ )
+        this->val[i] = cv::saturate_cast<_Tp>(v.val[i]);
+    for( ; i < 4; i++ )
+        this->val[i] = 0;
+}
+
+template<typename _Tp> inline
+Scalar_<_Tp>::Scalar_(_Tp v0)
+{
+    this->val[0] = v0;
+    this->val[1] = this->val[2] = this->val[3] = 0;
+}
+
+template<typename _Tp> inline
+Scalar_<_Tp> Scalar_<_Tp>::all(_Tp v0)
+{
+    return Scalar_<_Tp>(v0, v0, v0, v0);
+}
+
+
+template<typename _Tp> inline
+Scalar_<_Tp> Scalar_<_Tp>::mul(const Scalar_<_Tp>& a, double scale ) const
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>(this->val[0] * a.val[0] * scale),
+                        saturate_cast<_Tp>(this->val[1] * a.val[1] * scale),
+                        saturate_cast<_Tp>(this->val[2] * a.val[2] * scale),
+                        saturate_cast<_Tp>(this->val[3] * a.val[3] * scale));
+}
+
+template<typename _Tp> inline
+Scalar_<_Tp> Scalar_<_Tp>::conj() const
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>( this->val[0]),
+                        saturate_cast<_Tp>(-this->val[1]),
+                        saturate_cast<_Tp>(-this->val[2]),
+                        saturate_cast<_Tp>(-this->val[3]));
+}
+
+template<typename _Tp> inline
+bool Scalar_<_Tp>::isReal() const
+{
+    return this->val[1] == 0 && this->val[2] == 0 && this->val[3] == 0;
+}
+
+
+template<typename _Tp> template<typename T2> inline
+Scalar_<_Tp>::operator Scalar_<T2>() const
+{
+    return Scalar_<T2>(saturate_cast<T2>(this->val[0]),
+                       saturate_cast<T2>(this->val[1]),
+                       saturate_cast<T2>(this->val[2]),
+                       saturate_cast<T2>(this->val[3]));
+}
+
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator += (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    a.val[0] += b.val[0];
+    a.val[1] += b.val[1];
+    a.val[2] += b.val[2];
+    a.val[3] += b.val[3];
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator -= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    a.val[0] -= b.val[0];
+    a.val[1] -= b.val[1];
+    a.val[2] -= b.val[2];
+    a.val[3] -= b.val[3];
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator *= ( Scalar_<_Tp>& a, _Tp v )
+{
+    a.val[0] *= v;
+    a.val[1] *= v;
+    a.val[2] *= v;
+    a.val[3] *= v;
+    return a;
+}
+
+template<typename _Tp> static inline
+bool operator == ( const Scalar_<_Tp>& a, const Scalar_<_Tp>& b )
+{
+    return a.val[0] == b.val[0] && a.val[1] == b.val[1] &&
+           a.val[2] == b.val[2] && a.val[3] == b.val[3];
+}
+
+template<typename _Tp> static inline
+bool operator != ( const Scalar_<_Tp>& a, const Scalar_<_Tp>& b )
+{
+    return a.val[0] != b.val[0] || a.val[1] != b.val[1] ||
+           a.val[2] != b.val[2] || a.val[3] != b.val[3];
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator + (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    return Scalar_<_Tp>(a.val[0] + b.val[0],
+                        a.val[1] + b.val[1],
+                        a.val[2] + b.val[2],
+                        a.val[3] + b.val[3]);
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator - (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>(a.val[0] - b.val[0]),
+                        saturate_cast<_Tp>(a.val[1] - b.val[1]),
+                        saturate_cast<_Tp>(a.val[2] - b.val[2]),
+                        saturate_cast<_Tp>(a.val[3] - b.val[3]));
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator * (const Scalar_<_Tp>& a, _Tp alpha)
+{
+    return Scalar_<_Tp>(a.val[0] * alpha,
+                        a.val[1] * alpha,
+                        a.val[2] * alpha,
+                        a.val[3] * alpha);
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator * (_Tp alpha, const Scalar_<_Tp>& a)
+{
+    return a*alpha;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator - (const Scalar_<_Tp>& a)
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>(-a.val[0]),
+                        saturate_cast<_Tp>(-a.val[1]),
+                        saturate_cast<_Tp>(-a.val[2]),
+                        saturate_cast<_Tp>(-a.val[3]));
+}
+
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator * (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>(a[0]*b[0] - a[1]*b[1] - a[2]*b[2] - a[3]*b[3]),
+                        saturate_cast<_Tp>(a[0]*b[1] + a[1]*b[0] + a[2]*b[3] - a[3]*b[2]),
+                        saturate_cast<_Tp>(a[0]*b[2] - a[1]*b[3] + a[2]*b[0] + a[3]*b[1]),
+                        saturate_cast<_Tp>(a[0]*b[3] + a[1]*b[2] - a[2]*b[1] + a[3]*b[0]));
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator *= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    a = a * b;
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator / (const Scalar_<_Tp>& a, _Tp alpha)
+{
+    return Scalar_<_Tp>(a.val[0] / alpha,
+                        a.val[1] / alpha,
+                        a.val[2] / alpha,
+                        a.val[3] / alpha);
+}
+
+template<typename _Tp> static inline
+Scalar_<float> operator / (const Scalar_<float>& a, float alpha)
+{
+    float s = 1 / alpha;
+    return Scalar_<float>(a.val[0] * s, a.val[1] * s, a.val[2] * s, a.val[3] * s);
+}
+
+template<typename _Tp> static inline
+Scalar_<double> operator / (const Scalar_<double>& a, double alpha)
+{
+    double s = 1 / alpha;
+    return Scalar_<double>(a.val[0] * s, a.val[1] * s, a.val[2] * s, a.val[3] * s);
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator /= (Scalar_<_Tp>& a, _Tp alpha)
+{
+    a = a / alpha;
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator / (_Tp a, const Scalar_<_Tp>& b)
+{
+    _Tp s = a / (b[0]*b[0] + b[1]*b[1] + b[2]*b[2] + b[3]*b[3]);
+    return b.conj() * s;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator / (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    return a * ((_Tp)1 / b);
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator /= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    a = a / b;
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar operator * (const Matx<_Tp, 4, 4>& a, const Scalar& b)
+{
+    Matx<double, 4, 1> c((Matx<double, 4, 4>)a, b, Matx_MatMulOp());
+    return reinterpret_cast<const Scalar&>(c);
+}
+
+template<> inline
+Scalar operator * (const Matx<double, 4, 4>& a, const Scalar& b)
+{
+    Matx<double, 4, 1> c(a, b, Matx_MatMulOp());
+    return reinterpret_cast<const Scalar&>(c);
+}
+
+
+
+//////////////////////////////// KeyPoint ///////////////////////////////
+
+inline
+KeyPoint::KeyPoint()
+    : pt(0,0), size(0), angle(-1), response(0), octave(0), class_id(-1) {}
+
+inline
+KeyPoint::KeyPoint(Point2f _pt, float _size, float _angle, float _response, int _octave, int _class_id)
+    : pt(_pt), size(_size), angle(_angle), response(_response), octave(_octave), class_id(_class_id) {}
+
+inline
+KeyPoint::KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id)
+    : pt(x, y), size(_size), angle(_angle), response(_response), octave(_octave), class_id(_class_id) {}
+
+
+
+///////////////////////////////// DMatch ////////////////////////////////
+
+inline
+DMatch::DMatch()
+    : queryIdx(-1), trainIdx(-1), imgIdx(-1), distance(FLT_MAX) {}
+
+inline
+DMatch::DMatch(int _queryIdx, int _trainIdx, float _distance)
+    : queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(-1), distance(_distance) {}
+
+inline
+DMatch::DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance)
+    : queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(_imgIdx), distance(_distance) {}
+
+inline
+bool DMatch::operator < (const DMatch &m) const
+{
+    return distance < m.distance;
+}
+
+
+
+////////////////////////////// TermCriteria /////////////////////////////
+
+inline
+TermCriteria::TermCriteria()
+    : type(0), maxCount(0), epsilon(0) {}
+
+inline
+TermCriteria::TermCriteria(int _type, int _maxCount, double _epsilon)
+    : type(_type), maxCount(_maxCount), epsilon(_epsilon) {}
+
+//! @endcond
+
+} // cv
+
+#endif //__OPENCV_CORE_TYPES_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types_c.h
new file mode 100644
index 0000000..cb39587
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/types_c.h
@@ -0,0 +1,1834 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_TYPES_H__
+#define __OPENCV_CORE_TYPES_H__
+
+#ifdef HAVE_IPL
+#  ifndef __IPL_H__
+#    if defined WIN32 || defined _WIN32
+#      include <ipl.h>
+#    else
+#      include <ipl/ipl.h>
+#    endif
+#  endif
+#elif defined __IPL_H__
+#  define HAVE_IPL
+#endif
+
+#include "opencv2/core/cvdef.h"
+
+#ifndef SKIP_INCLUDES
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <float.h>
+#endif // SKIP_INCLUDES
+
+#if defined WIN32 || defined _WIN32
+#  define CV_CDECL __cdecl
+#  define CV_STDCALL __stdcall
+#else
+#  define CV_CDECL
+#  define CV_STDCALL
+#endif
+
+#ifndef CV_DEFAULT
+#  ifdef __cplusplus
+#    define CV_DEFAULT(val) = val
+#  else
+#    define CV_DEFAULT(val)
+#  endif
+#endif
+
+#ifndef CV_EXTERN_C_FUNCPTR
+#  ifdef __cplusplus
+#    define CV_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; }
+#  else
+#    define CV_EXTERN_C_FUNCPTR(x) typedef x
+#  endif
+#endif
+
+#ifndef CVAPI
+#  define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
+#endif
+
+#ifndef CV_IMPL
+#  define CV_IMPL CV_EXTERN_C
+#endif
+
+#ifdef __cplusplus
+#  include "opencv2/core.hpp"
+#endif
+
+/** @addtogroup core_c
+    @{
+*/
+
+/** @brief This is the "metatype" used *only* as a function parameter.
+
+It denotes that the function accepts arrays of multiple types, such as IplImage*, CvMat* or even
+CvSeq* sometimes. The particular array type is determined at runtime by analyzing the first 4
+bytes of the header. In C++ interface the role of CvArr is played by InputArray and OutputArray.
+ */
+typedef void CvArr;
+
+typedef int CVStatus;
+
+/** @see cv::Error::Code */
+enum {
+ CV_StsOk=                       0,  /**< everything is ok                */
+ CV_StsBackTrace=               -1,  /**< pseudo error for back trace     */
+ CV_StsError=                   -2,  /**< unknown /unspecified error      */
+ CV_StsInternal=                -3,  /**< internal error (bad state)      */
+ CV_StsNoMem=                   -4,  /**< insufficient memory             */
+ CV_StsBadArg=                  -5,  /**< function arg/param is bad       */
+ CV_StsBadFunc=                 -6,  /**< unsupported function            */
+ CV_StsNoConv=                  -7,  /**< iter. didn't converge           */
+ CV_StsAutoTrace=               -8,  /**< tracing                         */
+ CV_HeaderIsNull=               -9,  /**< image header is NULL            */
+ CV_BadImageSize=              -10,  /**< image size is invalid           */
+ CV_BadOffset=                 -11,  /**< offset is invalid               */
+ CV_BadDataPtr=                -12,  /**/
+ CV_BadStep=                   -13,  /**/
+ CV_BadModelOrChSeq=           -14,  /**/
+ CV_BadNumChannels=            -15,  /**/
+ CV_BadNumChannel1U=           -16,  /**/
+ CV_BadDepth=                  -17,  /**/
+ CV_BadAlphaChannel=           -18,  /**/
+ CV_BadOrder=                  -19,  /**/
+ CV_BadOrigin=                 -20,  /**/
+ CV_BadAlign=                  -21,  /**/
+ CV_BadCallBack=               -22,  /**/
+ CV_BadTileSize=               -23,  /**/
+ CV_BadCOI=                    -24,  /**/
+ CV_BadROISize=                -25,  /**/
+ CV_MaskIsTiled=               -26,  /**/
+ CV_StsNullPtr=                -27,  /**< null pointer */
+ CV_StsVecLengthErr=           -28,  /**< incorrect vector length */
+ CV_StsFilterStructContentErr= -29,  /**< incorr. filter structure content */
+ CV_StsKernelStructContentErr= -30,  /**< incorr. transform kernel content */
+ CV_StsFilterOffsetErr=        -31,  /**< incorrect filter offset value */
+ CV_StsBadSize=                -201, /**< the input/output structure size is incorrect  */
+ CV_StsDivByZero=              -202, /**< division by zero */
+ CV_StsInplaceNotSupported=    -203, /**< in-place operation is not supported */
+ CV_StsObjectNotFound=         -204, /**< request can't be completed */
+ CV_StsUnmatchedFormats=       -205, /**< formats of input/output arrays differ */
+ CV_StsBadFlag=                -206, /**< flag is wrong or not supported */
+ CV_StsBadPoint=               -207, /**< bad CvPoint */
+ CV_StsBadMask=                -208, /**< bad format of mask (neither 8uC1 nor 8sC1)*/
+ CV_StsUnmatchedSizes=         -209, /**< sizes of input/output structures do not match */
+ CV_StsUnsupportedFormat=      -210, /**< the data format/type is not supported by the function*/
+ CV_StsOutOfRange=             -211, /**< some of parameters are out of range */
+ CV_StsParseError=             -212, /**< invalid syntax/structure of the parsed file */
+ CV_StsNotImplemented=         -213, /**< the requested function/feature is not implemented */
+ CV_StsBadMemBlock=            -214, /**< an allocated block has been corrupted */
+ CV_StsAssert=                 -215, /**< assertion failed */
+ CV_GpuNotSupported=           -216,
+ CV_GpuApiCallError=           -217,
+ CV_OpenGlNotSupported=        -218,
+ CV_OpenGlApiCallError=        -219,
+ CV_OpenCLApiCallError=        -220,
+ CV_OpenCLDoubleNotSupported=  -221,
+ CV_OpenCLInitError=           -222,
+ CV_OpenCLNoAMDBlasFft=        -223
+};
+
+/****************************************************************************************\
+*                             Common macros and inline functions                         *
+\****************************************************************************************/
+
+#define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t))
+
+/** min & max without jumps */
+#define  CV_IMIN(a, b)  ((a) ^ (((a)^(b)) & (((a) < (b)) - 1)))
+
+#define  CV_IMAX(a, b)  ((a) ^ (((a)^(b)) & (((a) > (b)) - 1)))
+
+/** absolute value without jumps */
+#ifndef __cplusplus
+#  define  CV_IABS(a)     (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
+#else
+#  define  CV_IABS(a)     abs(a)
+#endif
+#define  CV_CMP(a,b)    (((a) > (b)) - ((a) < (b)))
+#define  CV_SIGN(a)     CV_CMP((a),0)
+
+#define cvInvSqrt(value) ((float)(1./sqrt(value)))
+#define cvSqrt(value)  ((float)sqrt(value))
+
+
+/*************** Random number generation *******************/
+
+typedef uint64 CvRNG;
+
+#define CV_RNG_COEFF 4164903690U
+
+/** @brief Initializes a random number generator state.
+
+The function initializes a random number generator and returns the state. The pointer to the state
+can be then passed to the cvRandInt, cvRandReal and cvRandArr functions. In the current
+implementation a multiply-with-carry generator is used.
+@param seed 64-bit value used to initiate a random sequence
+@sa the C++ class RNG replaced CvRNG.
+ */
+CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1))
+{
+    CvRNG rng = seed ? (uint64)seed : (uint64)(int64)-1;
+    return rng;
+}
+
+/** @brief Returns a 32-bit unsigned integer and updates RNG.
+
+The function returns a uniformly-distributed random 32-bit unsigned integer and updates the RNG
+state. It is similar to the rand() function from the C runtime library, except that OpenCV functions
+always generates a 32-bit random number, regardless of the platform.
+@param rng CvRNG state initialized by cvRNG.
+ */
+CV_INLINE unsigned cvRandInt( CvRNG* rng )
+{
+    uint64 temp = *rng;
+    temp = (uint64)(unsigned)temp*CV_RNG_COEFF + (temp >> 32);
+    *rng = temp;
+    return (unsigned)temp;
+}
+
+/** @brief Returns a floating-point random number and updates RNG.
+
+The function returns a uniformly-distributed random floating-point number between 0 and 1 (1 is not
+included).
+@param rng RNG state initialized by cvRNG
+ */
+CV_INLINE double cvRandReal( CvRNG* rng )
+{
+    return cvRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */;
+}
+
+/****************************************************************************************\
+*                                  Image type (IplImage)                                 *
+\****************************************************************************************/
+
+#ifndef HAVE_IPL
+
+/*
+ * The following definitions (until #endif)
+ * is an extract from IPL headers.
+ * Copyright (c) 1995 Intel Corporation.
+ */
+#define IPL_DEPTH_SIGN 0x80000000
+
+#define IPL_DEPTH_1U     1
+#define IPL_DEPTH_8U     8
+#define IPL_DEPTH_16U   16
+#define IPL_DEPTH_32F   32
+
+#define IPL_DEPTH_8S  (IPL_DEPTH_SIGN| 8)
+#define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16)
+#define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32)
+
+#define IPL_DATA_ORDER_PIXEL  0
+#define IPL_DATA_ORDER_PLANE  1
+
+#define IPL_ORIGIN_TL 0
+#define IPL_ORIGIN_BL 1
+
+#define IPL_ALIGN_4BYTES   4
+#define IPL_ALIGN_8BYTES   8
+#define IPL_ALIGN_16BYTES 16
+#define IPL_ALIGN_32BYTES 32
+
+#define IPL_ALIGN_DWORD   IPL_ALIGN_4BYTES
+#define IPL_ALIGN_QWORD   IPL_ALIGN_8BYTES
+
+#define IPL_BORDER_CONSTANT   0
+#define IPL_BORDER_REPLICATE  1
+#define IPL_BORDER_REFLECT    2
+#define IPL_BORDER_WRAP       3
+
+/** The IplImage is taken from the Intel Image Processing Library, in which the format is native. OpenCV
+only supports a subset of possible IplImage formats, as outlined in the parameter list above.
+
+In addition to the above restrictions, OpenCV handles ROIs differently. OpenCV functions require
+that the image size or ROI size of all source and destination images match exactly. On the other
+hand, the Intel Image Processing Library processes the area of intersection between the source and
+destination images (or ROIs), allowing them to vary independently.
+*/
+typedef struct
+#ifdef __cplusplus
+  CV_EXPORTS
+#endif
+_IplImage
+{
+    int  nSize;             /**< sizeof(IplImage) */
+    int  ID;                /**< version (=0)*/
+    int  nChannels;         /**< Most of OpenCV functions support 1,2,3 or 4 channels */
+    int  alphaChannel;      /**< Ignored by OpenCV */
+    int  depth;             /**< Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
+                               IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported.  */
+    char colorModel[4];     /**< Ignored by OpenCV */
+    char channelSeq[4];     /**< ditto */
+    int  dataOrder;         /**< 0 - interleaved color channels, 1 - separate color channels.
+                               cvCreateImage can only create interleaved images */
+    int  origin;            /**< 0 - top-left origin,
+                               1 - bottom-left origin (Windows bitmaps style).  */
+    int  align;             /**< Alignment of image rows (4 or 8).
+                               OpenCV ignores it and uses widthStep instead.    */
+    int  width;             /**< Image width in pixels.                           */
+    int  height;            /**< Image height in pixels.                          */
+    struct _IplROI *roi;    /**< Image ROI. If NULL, the whole image is selected. */
+    struct _IplImage *maskROI;      /**< Must be NULL. */
+    void  *imageId;                 /**< "           " */
+    struct _IplTileInfo *tileInfo;  /**< "           " */
+    int  imageSize;         /**< Image data size in bytes
+                               (==image->height*image->widthStep
+                               in case of interleaved data)*/
+    char *imageData;        /**< Pointer to aligned image data.         */
+    int  widthStep;         /**< Size of aligned image row in bytes.    */
+    int  BorderMode[4];     /**< Ignored by OpenCV.                     */
+    int  BorderConst[4];    /**< Ditto.                                 */
+    char *imageDataOrigin;  /**< Pointer to very origin of image data
+                               (not necessarily aligned) -
+                               needed for correct deallocation */
+
+#ifdef __cplusplus
+    _IplImage() {}
+    _IplImage(const cv::Mat& m);
+#endif
+}
+IplImage;
+
+typedef struct _IplTileInfo IplTileInfo;
+
+typedef struct _IplROI
+{
+    int  coi; /**< 0 - no COI (all channels are selected), 1 - 0th channel is selected ...*/
+    int  xOffset;
+    int  yOffset;
+    int  width;
+    int  height;
+}
+IplROI;
+
+typedef struct _IplConvKernel
+{
+    int  nCols;
+    int  nRows;
+    int  anchorX;
+    int  anchorY;
+    int *values;
+    int  nShiftR;
+}
+IplConvKernel;
+
+typedef struct _IplConvKernelFP
+{
+    int  nCols;
+    int  nRows;
+    int  anchorX;
+    int  anchorY;
+    float *values;
+}
+IplConvKernelFP;
+
+#define IPL_IMAGE_HEADER 1
+#define IPL_IMAGE_DATA   2
+#define IPL_IMAGE_ROI    4
+
+#endif/*HAVE_IPL*/
+
+/** extra border mode */
+#define IPL_BORDER_REFLECT_101    4
+#define IPL_BORDER_TRANSPARENT    5
+
+#define IPL_IMAGE_MAGIC_VAL  ((int)sizeof(IplImage))
+#define CV_TYPE_NAME_IMAGE "opencv-image"
+
+#define CV_IS_IMAGE_HDR(img) \
+    ((img) != NULL && ((const IplImage*)(img))->nSize == sizeof(IplImage))
+
+#define CV_IS_IMAGE(img) \
+    (CV_IS_IMAGE_HDR(img) && ((IplImage*)img)->imageData != NULL)
+
+/** for storing double-precision
+   floating point data in IplImage's */
+#define IPL_DEPTH_64F  64
+
+/** get reference to pixel at (col,row),
+   for multi-channel images (col) should be multiplied by number of channels */
+#define CV_IMAGE_ELEM( image, elemtype, row, col )       \
+    (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)])
+
+/****************************************************************************************\
+*                                  Matrix type (CvMat)                                   *
+\****************************************************************************************/
+
+#define CV_AUTO_STEP  0x7fffffff
+#define CV_WHOLE_ARR  cvSlice( 0, 0x3fffffff )
+
+#define CV_MAGIC_MASK       0xFFFF0000
+#define CV_MAT_MAGIC_VAL    0x42420000
+#define CV_TYPE_NAME_MAT    "opencv-matrix"
+
+/** Matrix elements are stored row by row. Element (i, j) (i - 0-based row index, j - 0-based column
+index) of a matrix can be retrieved or modified using CV_MAT_ELEM macro:
+
+    uchar pixval = CV_MAT_ELEM(grayimg, uchar, i, j)
+    CV_MAT_ELEM(cameraMatrix, float, 0, 2) = image.width*0.5f;
+
+To access multiple-channel matrices, you can use
+CV_MAT_ELEM(matrix, type, i, j\*nchannels + channel_idx).
+
+@deprecated CvMat is now obsolete; consider using Mat instead.
+ */
+typedef struct CvMat
+{
+    int type;
+    int step;
+
+    /* for internal use only */
+    int* refcount;
+    int hdr_refcount;
+
+    union
+    {
+        uchar* ptr;
+        short* s;
+        int* i;
+        float* fl;
+        double* db;
+    } data;
+
+#ifdef __cplusplus
+    union
+    {
+        int rows;
+        int height;
+    };
+
+    union
+    {
+        int cols;
+        int width;
+    };
+#else
+    int rows;
+    int cols;
+#endif
+
+
+#ifdef __cplusplus
+    CvMat() {}
+    CvMat(const CvMat& m) { memcpy(this, &m, sizeof(CvMat));}
+    CvMat(const cv::Mat& m);
+#endif
+
+}
+CvMat;
+
+
+#define CV_IS_MAT_HDR(mat) \
+    ((mat) != NULL && \
+    (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
+    ((const CvMat*)(mat))->cols > 0 && ((const CvMat*)(mat))->rows > 0)
+
+#define CV_IS_MAT_HDR_Z(mat) \
+    ((mat) != NULL && \
+    (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
+    ((const CvMat*)(mat))->cols >= 0 && ((const CvMat*)(mat))->rows >= 0)
+
+#define CV_IS_MAT(mat) \
+    (CV_IS_MAT_HDR(mat) && ((const CvMat*)(mat))->data.ptr != NULL)
+
+#define CV_IS_MASK_ARR(mat) \
+    (((mat)->type & (CV_MAT_TYPE_MASK & ~CV_8SC1)) == 0)
+
+#define CV_ARE_TYPES_EQ(mat1, mat2) \
+    ((((mat1)->type ^ (mat2)->type) & CV_MAT_TYPE_MASK) == 0)
+
+#define CV_ARE_CNS_EQ(mat1, mat2) \
+    ((((mat1)->type ^ (mat2)->type) & CV_MAT_CN_MASK) == 0)
+
+#define CV_ARE_DEPTHS_EQ(mat1, mat2) \
+    ((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0)
+
+#define CV_ARE_SIZES_EQ(mat1, mat2) \
+    ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols)
+
+#define CV_IS_MAT_CONST(mat)  \
+    (((mat)->rows|(mat)->cols) == 1)
+
+#define IPL2CV_DEPTH(depth) \
+    ((((CV_8U)+(CV_16U<<4)+(CV_32F<<8)+(CV_64F<<16)+(CV_8S<<20)+ \
+    (CV_16S<<24)+(CV_32S<<28)) >> ((((depth) & 0xF0) >> 2) + \
+    (((depth) & IPL_DEPTH_SIGN) ? 20 : 0))) & 15)
+
+/** Inline constructor. No data is allocated internally!!!
+ * (Use together with cvCreateData, or use cvCreateMat instead to
+ * get a matrix with allocated data):
+ */
+CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL))
+{
+    CvMat m;
+
+    assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F );
+    type = CV_MAT_TYPE(type);
+    m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type;
+    m.cols = cols;
+    m.rows = rows;
+    m.step = m.cols*CV_ELEM_SIZE(type);
+    m.data.ptr = (uchar*)data;
+    m.refcount = NULL;
+    m.hdr_refcount = 0;
+
+    return m;
+}
+
+#ifdef __cplusplus
+inline CvMat::CvMat(const cv::Mat& m)
+{
+    CV_DbgAssert(m.dims <= 2);
+    *this = cvMat(m.rows, m.dims == 1 ? 1 : m.cols, m.type(), m.data);
+    step = (int)m.step[0];
+    type = (type & ~cv::Mat::CONTINUOUS_FLAG) | (m.flags & cv::Mat::CONTINUOUS_FLAG);
+}
+#endif
+
+
+#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size )  \
+    (assert( (unsigned)(row) < (unsigned)(mat).rows &&   \
+             (unsigned)(col) < (unsigned)(mat).cols ),   \
+     (mat).data.ptr + (size_t)(mat).step*(row) + (pix_size)*(col))
+
+#define CV_MAT_ELEM_PTR( mat, row, col )                 \
+    CV_MAT_ELEM_PTR_FAST( mat, row, col, CV_ELEM_SIZE((mat).type) )
+
+#define CV_MAT_ELEM( mat, elemtype, row, col )           \
+    (*(elemtype*)CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype)))
+
+/** @brief Returns the particular element of single-channel floating-point matrix.
+
+The function is a fast replacement for cvGetReal2D in the case of single-channel floating-point
+matrices. It is faster because it is inline, it does fewer checks for array type and array element
+type, and it checks for the row and column ranges only in debug mode.
+@param mat Input matrix
+@param row The zero-based index of row
+@param col The zero-based index of column
+ */
+CV_INLINE  double  cvmGet( const CvMat* mat, int row, int col )
+{
+    int type;
+
+    type = CV_MAT_TYPE(mat->type);
+    assert( (unsigned)row < (unsigned)mat->rows &&
+            (unsigned)col < (unsigned)mat->cols );
+
+    if( type == CV_32FC1 )
+        return ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col];
+    else
+    {
+        assert( type == CV_64FC1 );
+        return ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col];
+    }
+}
+
+/** @brief Sets a specific element of a single-channel floating-point matrix.
+
+The function is a fast replacement for cvSetReal2D in the case of single-channel floating-point
+matrices. It is faster because it is inline, it does fewer checks for array type and array element
+type, and it checks for the row and column ranges only in debug mode.
+@param mat The matrix
+@param row The zero-based index of row
+@param col The zero-based index of column
+@param value The new value of the matrix element
+ */
+CV_INLINE  void  cvmSet( CvMat* mat, int row, int col, double value )
+{
+    int type;
+    type = CV_MAT_TYPE(mat->type);
+    assert( (unsigned)row < (unsigned)mat->rows &&
+            (unsigned)col < (unsigned)mat->cols );
+
+    if( type == CV_32FC1 )
+        ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value;
+    else
+    {
+        assert( type == CV_64FC1 );
+        ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = value;
+    }
+}
+
+
+CV_INLINE int cvIplDepth( int type )
+{
+    int depth = CV_MAT_DEPTH(type);
+    return CV_ELEM_SIZE1(depth)*8 | (depth == CV_8S || depth == CV_16S ||
+           depth == CV_32S ? IPL_DEPTH_SIGN : 0);
+}
+
+
+/****************************************************************************************\
+*                       Multi-dimensional dense array (CvMatND)                          *
+\****************************************************************************************/
+
+#define CV_MATND_MAGIC_VAL    0x42430000
+#define CV_TYPE_NAME_MATND    "opencv-nd-matrix"
+
+#define CV_MAX_DIM            32
+#define CV_MAX_DIM_HEAP       1024
+
+/**
+  @deprecated consider using cv::Mat instead
+  */
+typedef struct
+#ifdef __cplusplus
+  CV_EXPORTS
+#endif
+CvMatND
+{
+    int type;
+    int dims;
+
+    int* refcount;
+    int hdr_refcount;
+
+    union
+    {
+        uchar* ptr;
+        float* fl;
+        double* db;
+        int* i;
+        short* s;
+    } data;
+
+    struct
+    {
+        int size;
+        int step;
+    }
+    dim[CV_MAX_DIM];
+
+#ifdef __cplusplus
+    CvMatND() {}
+    CvMatND(const cv::Mat& m);
+#endif
+}
+CvMatND;
+
+#define CV_IS_MATND_HDR(mat) \
+    ((mat) != NULL && (((const CvMatND*)(mat))->type & CV_MAGIC_MASK) == CV_MATND_MAGIC_VAL)
+
+#define CV_IS_MATND(mat) \
+    (CV_IS_MATND_HDR(mat) && ((const CvMatND*)(mat))->data.ptr != NULL)
+
+
+/****************************************************************************************\
+*                      Multi-dimensional sparse array (CvSparseMat)                      *
+\****************************************************************************************/
+
+#define CV_SPARSE_MAT_MAGIC_VAL    0x42440000
+#define CV_TYPE_NAME_SPARSE_MAT    "opencv-sparse-matrix"
+
+struct CvSet;
+
+typedef struct
+#ifdef __cplusplus
+  CV_EXPORTS
+#endif
+CvSparseMat
+{
+    int type;
+    int dims;
+    int* refcount;
+    int hdr_refcount;
+
+    struct CvSet* heap;
+    void** hashtable;
+    int hashsize;
+    int valoffset;
+    int idxoffset;
+    int size[CV_MAX_DIM];
+
+#ifdef __cplusplus
+    void copyToSparseMat(cv::SparseMat& m) const;
+#endif
+}
+CvSparseMat;
+
+#ifdef __cplusplus
+    CV_EXPORTS CvSparseMat* cvCreateSparseMat(const cv::SparseMat& m);
+#endif
+
+#define CV_IS_SPARSE_MAT_HDR(mat) \
+    ((mat) != NULL && \
+    (((const CvSparseMat*)(mat))->type & CV_MAGIC_MASK) == CV_SPARSE_MAT_MAGIC_VAL)
+
+#define CV_IS_SPARSE_MAT(mat) \
+    CV_IS_SPARSE_MAT_HDR(mat)
+
+/**************** iteration through a sparse array *****************/
+
+typedef struct CvSparseNode
+{
+    unsigned hashval;
+    struct CvSparseNode* next;
+}
+CvSparseNode;
+
+typedef struct CvSparseMatIterator
+{
+    CvSparseMat* mat;
+    CvSparseNode* node;
+    int curidx;
+}
+CvSparseMatIterator;
+
+#define CV_NODE_VAL(mat,node)   ((void*)((uchar*)(node) + (mat)->valoffset))
+#define CV_NODE_IDX(mat,node)   ((int*)((uchar*)(node) + (mat)->idxoffset))
+
+/****************************************************************************************\
+*                                         Histogram                                      *
+\****************************************************************************************/
+
+typedef int CvHistType;
+
+#define CV_HIST_MAGIC_VAL     0x42450000
+#define CV_HIST_UNIFORM_FLAG  (1 << 10)
+
+/** indicates whether bin ranges are set already or not */
+#define CV_HIST_RANGES_FLAG   (1 << 11)
+
+#define CV_HIST_ARRAY         0
+#define CV_HIST_SPARSE        1
+#define CV_HIST_TREE          CV_HIST_SPARSE
+
+/** should be used as a parameter only,
+   it turns to CV_HIST_UNIFORM_FLAG of hist->type */
+#define CV_HIST_UNIFORM       1
+
+typedef struct CvHistogram
+{
+    int     type;
+    CvArr*  bins;
+    float   thresh[CV_MAX_DIM][2];  /**< For uniform histograms.                      */
+    float** thresh2;                /**< For non-uniform histograms.                  */
+    CvMatND mat;                    /**< Embedded matrix header for array histograms. */
+}
+CvHistogram;
+
+#define CV_IS_HIST( hist ) \
+    ((hist) != NULL  && \
+     (((CvHistogram*)(hist))->type & CV_MAGIC_MASK) == CV_HIST_MAGIC_VAL && \
+     (hist)->bins != NULL)
+
+#define CV_IS_UNIFORM_HIST( hist ) \
+    (((hist)->type & CV_HIST_UNIFORM_FLAG) != 0)
+
+#define CV_IS_SPARSE_HIST( hist ) \
+    CV_IS_SPARSE_MAT((hist)->bins)
+
+#define CV_HIST_HAS_RANGES( hist ) \
+    (((hist)->type & CV_HIST_RANGES_FLAG) != 0)
+
+/****************************************************************************************\
+*                      Other supplementary data type definitions                         *
+\****************************************************************************************/
+
+/*************************************** CvRect *****************************************/
+/** @sa Rect_ */
+typedef struct CvRect
+{
+    int x;
+    int y;
+    int width;
+    int height;
+
+#ifdef __cplusplus
+    CvRect(int _x = 0, int _y = 0, int w = 0, int h = 0): x(_x), y(_y), width(w), height(h) {}
+    template<typename _Tp>
+    CvRect(const cv::Rect_<_Tp>& r): x(cv::saturate_cast<int>(r.x)), y(cv::saturate_cast<int>(r.y)), width(cv::saturate_cast<int>(r.width)), height(cv::saturate_cast<int>(r.height)) {}
+    template<typename _Tp>
+    operator cv::Rect_<_Tp>() const { return cv::Rect_<_Tp>((_Tp)x, (_Tp)y, (_Tp)width, (_Tp)height); }
+#endif
+}
+CvRect;
+
+/** constructs CvRect structure. */
+CV_INLINE  CvRect  cvRect( int x, int y, int width, int height )
+{
+    CvRect r;
+
+    r.x = x;
+    r.y = y;
+    r.width = width;
+    r.height = height;
+
+    return r;
+}
+
+
+CV_INLINE  IplROI  cvRectToROI( CvRect rect, int coi )
+{
+    IplROI roi;
+    roi.xOffset = rect.x;
+    roi.yOffset = rect.y;
+    roi.width = rect.width;
+    roi.height = rect.height;
+    roi.coi = coi;
+
+    return roi;
+}
+
+
+CV_INLINE  CvRect  cvROIToRect( IplROI roi )
+{
+    return cvRect( roi.xOffset, roi.yOffset, roi.width, roi.height );
+}
+
+/*********************************** CvTermCriteria *************************************/
+
+#define CV_TERMCRIT_ITER    1
+#define CV_TERMCRIT_NUMBER  CV_TERMCRIT_ITER
+#define CV_TERMCRIT_EPS     2
+
+/** @sa TermCriteria
+ */
+typedef struct CvTermCriteria
+{
+    int    type;  /**< may be combination of
+                     CV_TERMCRIT_ITER
+                     CV_TERMCRIT_EPS */
+    int    max_iter;
+    double epsilon;
+
+#ifdef __cplusplus
+    CvTermCriteria(int _type = 0, int _iter = 0, double _eps = 0) : type(_type), max_iter(_iter), epsilon(_eps)  {}
+    CvTermCriteria(const cv::TermCriteria& t) : type(t.type), max_iter(t.maxCount), epsilon(t.epsilon)  {}
+    operator cv::TermCriteria() const { return cv::TermCriteria(type, max_iter, epsilon); }
+#endif
+
+}
+CvTermCriteria;
+
+CV_INLINE  CvTermCriteria  cvTermCriteria( int type, int max_iter, double epsilon )
+{
+    CvTermCriteria t;
+
+    t.type = type;
+    t.max_iter = max_iter;
+    t.epsilon = (float)epsilon;
+
+    return t;
+}
+
+
+/******************************* CvPoint and variants ***********************************/
+
+typedef struct CvPoint
+{
+    int x;
+    int y;
+
+#ifdef __cplusplus
+    CvPoint(int _x = 0, int _y = 0): x(_x), y(_y) {}
+    template<typename _Tp>
+    CvPoint(const cv::Point_<_Tp>& pt): x((int)pt.x), y((int)pt.y) {}
+    template<typename _Tp>
+    operator cv::Point_<_Tp>() const { return cv::Point_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y)); }
+#endif
+}
+CvPoint;
+
+/** constructs CvPoint structure. */
+CV_INLINE  CvPoint  cvPoint( int x, int y )
+{
+    CvPoint p;
+
+    p.x = x;
+    p.y = y;
+
+    return p;
+}
+
+
+typedef struct CvPoint2D32f
+{
+    float x;
+    float y;
+
+#ifdef __cplusplus
+    CvPoint2D32f(float _x = 0, float _y = 0): x(_x), y(_y) {}
+    template<typename _Tp>
+    CvPoint2D32f(const cv::Point_<_Tp>& pt): x((float)pt.x), y((float)pt.y) {}
+    template<typename _Tp>
+    operator cv::Point_<_Tp>() const { return cv::Point_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y)); }
+#endif
+}
+CvPoint2D32f;
+
+/** constructs CvPoint2D32f structure. */
+CV_INLINE  CvPoint2D32f  cvPoint2D32f( double x, double y )
+{
+    CvPoint2D32f p;
+
+    p.x = (float)x;
+    p.y = (float)y;
+
+    return p;
+}
+
+/** converts CvPoint to CvPoint2D32f. */
+CV_INLINE  CvPoint2D32f  cvPointTo32f( CvPoint point )
+{
+    return cvPoint2D32f( (float)point.x, (float)point.y );
+}
+
+/** converts CvPoint2D32f to CvPoint. */
+CV_INLINE  CvPoint  cvPointFrom32f( CvPoint2D32f point )
+{
+    CvPoint ipt;
+    ipt.x = cvRound(point.x);
+    ipt.y = cvRound(point.y);
+
+    return ipt;
+}
+
+
+typedef struct CvPoint3D32f
+{
+    float x;
+    float y;
+    float z;
+
+#ifdef __cplusplus
+    CvPoint3D32f(float _x = 0, float _y = 0, float _z = 0): x(_x), y(_y), z(_z) {}
+    template<typename _Tp>
+    CvPoint3D32f(const cv::Point3_<_Tp>& pt): x((float)pt.x), y((float)pt.y), z((float)pt.z) {}
+    template<typename _Tp>
+    operator cv::Point3_<_Tp>() const { return cv::Point3_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y), cv::saturate_cast<_Tp>(z)); }
+#endif
+}
+CvPoint3D32f;
+
+/** constructs CvPoint3D32f structure. */
+CV_INLINE  CvPoint3D32f  cvPoint3D32f( double x, double y, double z )
+{
+    CvPoint3D32f p;
+
+    p.x = (float)x;
+    p.y = (float)y;
+    p.z = (float)z;
+
+    return p;
+}
+
+
+typedef struct CvPoint2D64f
+{
+    double x;
+    double y;
+}
+CvPoint2D64f;
+
+/** constructs CvPoint2D64f structure.*/
+CV_INLINE  CvPoint2D64f  cvPoint2D64f( double x, double y )
+{
+    CvPoint2D64f p;
+
+    p.x = x;
+    p.y = y;
+
+    return p;
+}
+
+
+typedef struct CvPoint3D64f
+{
+    double x;
+    double y;
+    double z;
+}
+CvPoint3D64f;
+
+/** constructs CvPoint3D64f structure. */
+CV_INLINE  CvPoint3D64f  cvPoint3D64f( double x, double y, double z )
+{
+    CvPoint3D64f p;
+
+    p.x = x;
+    p.y = y;
+    p.z = z;
+
+    return p;
+}
+
+
+/******************************** CvSize's & CvBox **************************************/
+
+typedef struct CvSize
+{
+    int width;
+    int height;
+
+#ifdef __cplusplus
+    CvSize(int w = 0, int h = 0): width(w), height(h) {}
+    template<typename _Tp>
+    CvSize(const cv::Size_<_Tp>& sz): width(cv::saturate_cast<int>(sz.width)), height(cv::saturate_cast<int>(sz.height)) {}
+    template<typename _Tp>
+    operator cv::Size_<_Tp>() const { return cv::Size_<_Tp>(cv::saturate_cast<_Tp>(width), cv::saturate_cast<_Tp>(height)); }
+#endif
+}
+CvSize;
+
+/** constructs CvSize structure. */
+CV_INLINE  CvSize  cvSize( int width, int height )
+{
+    CvSize s;
+
+    s.width = width;
+    s.height = height;
+
+    return s;
+}
+
+typedef struct CvSize2D32f
+{
+    float width;
+    float height;
+
+#ifdef __cplusplus
+    CvSize2D32f(float w = 0, float h = 0): width(w), height(h) {}
+    template<typename _Tp>
+    CvSize2D32f(const cv::Size_<_Tp>& sz): width(cv::saturate_cast<float>(sz.width)), height(cv::saturate_cast<float>(sz.height)) {}
+    template<typename _Tp>
+    operator cv::Size_<_Tp>() const { return cv::Size_<_Tp>(cv::saturate_cast<_Tp>(width), cv::saturate_cast<_Tp>(height)); }
+#endif
+}
+CvSize2D32f;
+
+/** constructs CvSize2D32f structure. */
+CV_INLINE  CvSize2D32f  cvSize2D32f( double width, double height )
+{
+    CvSize2D32f s;
+
+    s.width = (float)width;
+    s.height = (float)height;
+
+    return s;
+}
+
+/** @sa RotatedRect
+ */
+typedef struct CvBox2D
+{
+    CvPoint2D32f center;  /**< Center of the box.                          */
+    CvSize2D32f  size;    /**< Box width and length.                       */
+    float angle;          /**< Angle between the horizontal axis           */
+                          /**< and the first side (i.e. length) in degrees */
+
+#ifdef __cplusplus
+    CvBox2D(CvPoint2D32f c = CvPoint2D32f(), CvSize2D32f s = CvSize2D32f(), float a = 0) : center(c), size(s), angle(a) {}
+    CvBox2D(const cv::RotatedRect& rr) : center(rr.center), size(rr.size), angle(rr.angle) {}
+    operator cv::RotatedRect() const { return cv::RotatedRect(center, size, angle); }
+#endif
+}
+CvBox2D;
+
+
+/** Line iterator state: */
+typedef struct CvLineIterator
+{
+    /** Pointer to the current point: */
+    uchar* ptr;
+
+    /* Bresenham algorithm state: */
+    int  err;
+    int  plus_delta;
+    int  minus_delta;
+    int  plus_step;
+    int  minus_step;
+}
+CvLineIterator;
+
+
+
+/************************************* CvSlice ******************************************/
+#define CV_WHOLE_SEQ_END_INDEX 0x3fffffff
+#define CV_WHOLE_SEQ  cvSlice(0, CV_WHOLE_SEQ_END_INDEX)
+
+typedef struct CvSlice
+{
+    int  start_index, end_index;
+
+#if defined(__cplusplus) && !defined(__CUDACC__)
+    CvSlice(int start = 0, int end = 0) : start_index(start), end_index(end) {}
+    CvSlice(const cv::Range& r) { *this = (r.start != INT_MIN && r.end != INT_MAX) ? CvSlice(r.start, r.end) : CvSlice(0, CV_WHOLE_SEQ_END_INDEX); }
+    operator cv::Range() const { return (start_index == 0 && end_index == CV_WHOLE_SEQ_END_INDEX ) ? cv::Range::all() : cv::Range(start_index, end_index); }
+#endif
+}
+CvSlice;
+
+CV_INLINE  CvSlice  cvSlice( int start, int end )
+{
+    CvSlice slice;
+    slice.start_index = start;
+    slice.end_index = end;
+
+    return slice;
+}
+
+
+
+/************************************* CvScalar *****************************************/
+/** @sa Scalar_
+ */
+typedef struct CvScalar
+{
+    double val[4];
+
+#ifdef __cplusplus
+    CvScalar() {}
+    CvScalar(double d0, double d1 = 0, double d2 = 0, double d3 = 0) { val[0] = d0; val[1] = d1; val[2] = d2; val[3] = d3; }
+    template<typename _Tp>
+    CvScalar(const cv::Scalar_<_Tp>& s) { val[0] = s.val[0]; val[1] = s.val[1]; val[2] = s.val[2]; val[3] = s.val[3]; }
+    template<typename _Tp>
+    operator cv::Scalar_<_Tp>() const { return cv::Scalar_<_Tp>(cv::saturate_cast<_Tp>(val[0]), cv::saturate_cast<_Tp>(val[1]), cv::saturate_cast<_Tp>(val[2]), cv::saturate_cast<_Tp>(val[3])); }
+    template<typename _Tp, int cn>
+    CvScalar(const cv::Vec<_Tp, cn>& v)
+    {
+        int i;
+        for( i = 0; i < (cn < 4 ? cn : 4); i++ ) val[i] = v.val[i];
+        for( ; i < 4; i++ ) val[i] = 0;
+    }
+#endif
+}
+CvScalar;
+
+CV_INLINE  CvScalar  cvScalar( double val0, double val1 CV_DEFAULT(0),
+                               double val2 CV_DEFAULT(0), double val3 CV_DEFAULT(0))
+{
+    CvScalar scalar;
+    scalar.val[0] = val0; scalar.val[1] = val1;
+    scalar.val[2] = val2; scalar.val[3] = val3;
+    return scalar;
+}
+
+
+CV_INLINE  CvScalar  cvRealScalar( double val0 )
+{
+    CvScalar scalar;
+    scalar.val[0] = val0;
+    scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
+    return scalar;
+}
+
+CV_INLINE  CvScalar  cvScalarAll( double val0123 )
+{
+    CvScalar scalar;
+    scalar.val[0] = val0123;
+    scalar.val[1] = val0123;
+    scalar.val[2] = val0123;
+    scalar.val[3] = val0123;
+    return scalar;
+}
+
+/****************************************************************************************\
+*                                   Dynamic Data structures                              *
+\****************************************************************************************/
+
+/******************************** Memory storage ****************************************/
+
+typedef struct CvMemBlock
+{
+    struct CvMemBlock*  prev;
+    struct CvMemBlock*  next;
+}
+CvMemBlock;
+
+#define CV_STORAGE_MAGIC_VAL    0x42890000
+
+typedef struct CvMemStorage
+{
+    int signature;
+    CvMemBlock* bottom;           /**< First allocated block.                   */
+    CvMemBlock* top;              /**< Current memory block - top of the stack. */
+    struct  CvMemStorage* parent; /**< We get new blocks from parent as needed. */
+    int block_size;               /**< Block size.                              */
+    int free_space;               /**< Remaining free space in current block.   */
+}
+CvMemStorage;
+
+#define CV_IS_STORAGE(storage)  \
+    ((storage) != NULL &&       \
+    (((CvMemStorage*)(storage))->signature & CV_MAGIC_MASK) == CV_STORAGE_MAGIC_VAL)
+
+
+typedef struct CvMemStoragePos
+{
+    CvMemBlock* top;
+    int free_space;
+}
+CvMemStoragePos;
+
+
+/*********************************** Sequence *******************************************/
+
+typedef struct CvSeqBlock
+{
+    struct CvSeqBlock*  prev; /**< Previous sequence block.                   */
+    struct CvSeqBlock*  next; /**< Next sequence block.                       */
+  int    start_index;         /**< Index of the first element in the block +  */
+                              /**< sequence->first->start_index.              */
+    int    count;             /**< Number of elements in the block.           */
+    schar* data;              /**< Pointer to the first element of the block. */
+}
+CvSeqBlock;
+
+
+#define CV_TREE_NODE_FIELDS(node_type)                               \
+    int       flags;             /**< Miscellaneous flags.     */      \
+    int       header_size;       /**< Size of sequence header. */      \
+    struct    node_type* h_prev; /**< Previous sequence.       */      \
+    struct    node_type* h_next; /**< Next sequence.           */      \
+    struct    node_type* v_prev; /**< 2nd previous sequence.   */      \
+    struct    node_type* v_next  /**< 2nd next sequence.       */
+
+/**
+   Read/Write sequence.
+   Elements can be dynamically inserted to or deleted from the sequence.
+*/
+#define CV_SEQUENCE_FIELDS()                                              \
+    CV_TREE_NODE_FIELDS(CvSeq);                                           \
+    int       total;          /**< Total number of elements.            */  \
+    int       elem_size;      /**< Size of sequence element in bytes.   */  \
+    schar*    block_max;      /**< Maximal bound of the last block.     */  \
+    schar*    ptr;            /**< Current write pointer.               */  \
+    int       delta_elems;    /**< Grow seq this many at a time.        */  \
+    CvMemStorage* storage;    /**< Where the seq is stored.             */  \
+    CvSeqBlock* free_blocks;  /**< Free blocks list.                    */  \
+    CvSeqBlock* first;        /**< Pointer to the first sequence block. */
+
+typedef struct CvSeq
+{
+    CV_SEQUENCE_FIELDS()
+}
+CvSeq;
+
+#define CV_TYPE_NAME_SEQ             "opencv-sequence"
+#define CV_TYPE_NAME_SEQ_TREE        "opencv-sequence-tree"
+
+/*************************************** Set ********************************************/
+/** @brief Set
+  Order is not preserved. There can be gaps between sequence elements.
+  After the element has been inserted it stays in the same place all the time.
+  The MSB(most-significant or sign bit) of the first field (flags) is 0 iff the element exists.
+*/
+#define CV_SET_ELEM_FIELDS(elem_type)   \
+    int  flags;                         \
+    struct elem_type* next_free;
+
+typedef struct CvSetElem
+{
+    CV_SET_ELEM_FIELDS(CvSetElem)
+}
+CvSetElem;
+
+#define CV_SET_FIELDS()      \
+    CV_SEQUENCE_FIELDS()     \
+    CvSetElem* free_elems;   \
+    int active_count;
+
+typedef struct CvSet
+{
+    CV_SET_FIELDS()
+}
+CvSet;
+
+
+#define CV_SET_ELEM_IDX_MASK   ((1 << 26) - 1)
+#define CV_SET_ELEM_FREE_FLAG  (1 << (sizeof(int)*8-1))
+
+/** Checks whether the element pointed by ptr belongs to a set or not */
+#define CV_IS_SET_ELEM( ptr )  (((CvSetElem*)(ptr))->flags >= 0)
+
+/************************************* Graph ********************************************/
+
+/** @name Graph
+
+We represent a graph as a set of vertices. Vertices contain their adjacency lists (more exactly,
+pointers to first incoming or outcoming edge (or 0 if isolated vertex)). Edges are stored in
+another set. There is a singly-linked list of incoming/outcoming edges for each vertex.
+
+Each edge consists of:
+
+- Two pointers to the starting and ending vertices (vtx[0] and vtx[1] respectively).
+
+    A graph may be oriented or not. In the latter case, edges between vertex i to vertex j are not
+distinguished during search operations.
+
+- Two pointers to next edges for the starting and ending vertices, where next[0] points to the
+next edge in the vtx[0] adjacency list and next[1] points to the next edge in the vtx[1]
+adjacency list.
+
+@see CvGraphEdge, CvGraphVtx, CvGraphVtx2D, CvGraph
+@{
+*/
+#define CV_GRAPH_EDGE_FIELDS()      \
+    int flags;                      \
+    float weight;                   \
+    struct CvGraphEdge* next[2];    \
+    struct CvGraphVtx* vtx[2];
+
+
+#define CV_GRAPH_VERTEX_FIELDS()    \
+    int flags;                      \
+    struct CvGraphEdge* first;
+
+
+typedef struct CvGraphEdge
+{
+    CV_GRAPH_EDGE_FIELDS()
+}
+CvGraphEdge;
+
+typedef struct CvGraphVtx
+{
+    CV_GRAPH_VERTEX_FIELDS()
+}
+CvGraphVtx;
+
+typedef struct CvGraphVtx2D
+{
+    CV_GRAPH_VERTEX_FIELDS()
+    CvPoint2D32f* ptr;
+}
+CvGraphVtx2D;
+
+/**
+   Graph is "derived" from the set (this is set a of vertices)
+   and includes another set (edges)
+*/
+#define  CV_GRAPH_FIELDS()   \
+    CV_SET_FIELDS()          \
+    CvSet* edges;
+
+typedef struct CvGraph
+{
+    CV_GRAPH_FIELDS()
+}
+CvGraph;
+
+#define CV_TYPE_NAME_GRAPH "opencv-graph"
+
+/** @} */
+
+/*********************************** Chain/Countour *************************************/
+
+typedef struct CvChain
+{
+    CV_SEQUENCE_FIELDS()
+    CvPoint  origin;
+}
+CvChain;
+
+#define CV_CONTOUR_FIELDS()  \
+    CV_SEQUENCE_FIELDS()     \
+    CvRect rect;             \
+    int color;               \
+    int reserved[3];
+
+typedef struct CvContour
+{
+    CV_CONTOUR_FIELDS()
+}
+CvContour;
+
+typedef CvContour CvPoint2DSeq;
+
+/****************************************************************************************\
+*                                    Sequence types                                      *
+\****************************************************************************************/
+
+#define CV_SEQ_MAGIC_VAL             0x42990000
+
+#define CV_IS_SEQ(seq) \
+    ((seq) != NULL && (((CvSeq*)(seq))->flags & CV_MAGIC_MASK) == CV_SEQ_MAGIC_VAL)
+
+#define CV_SET_MAGIC_VAL             0x42980000
+#define CV_IS_SET(set) \
+    ((set) != NULL && (((CvSeq*)(set))->flags & CV_MAGIC_MASK) == CV_SET_MAGIC_VAL)
+
+#define CV_SEQ_ELTYPE_BITS           12
+#define CV_SEQ_ELTYPE_MASK           ((1 << CV_SEQ_ELTYPE_BITS) - 1)
+
+#define CV_SEQ_ELTYPE_POINT          CV_32SC2  /**< (x,y) */
+#define CV_SEQ_ELTYPE_CODE           CV_8UC1   /**< freeman code: 0..7 */
+#define CV_SEQ_ELTYPE_GENERIC        0
+#define CV_SEQ_ELTYPE_PTR            CV_USRTYPE1
+#define CV_SEQ_ELTYPE_PPOINT         CV_SEQ_ELTYPE_PTR  /**< &(x,y) */
+#define CV_SEQ_ELTYPE_INDEX          CV_32SC1  /**< #(x,y) */
+#define CV_SEQ_ELTYPE_GRAPH_EDGE     0  /**< &next_o, &next_d, &vtx_o, &vtx_d */
+#define CV_SEQ_ELTYPE_GRAPH_VERTEX   0  /**< first_edge, &(x,y) */
+#define CV_SEQ_ELTYPE_TRIAN_ATR      0  /**< vertex of the binary tree   */
+#define CV_SEQ_ELTYPE_CONNECTED_COMP 0  /**< connected component  */
+#define CV_SEQ_ELTYPE_POINT3D        CV_32FC3  /**< (x,y,z)  */
+
+#define CV_SEQ_KIND_BITS        2
+#define CV_SEQ_KIND_MASK        (((1 << CV_SEQ_KIND_BITS) - 1)<<CV_SEQ_ELTYPE_BITS)
+
+/** types of sequences */
+#define CV_SEQ_KIND_GENERIC     (0 << CV_SEQ_ELTYPE_BITS)
+#define CV_SEQ_KIND_CURVE       (1 << CV_SEQ_ELTYPE_BITS)
+#define CV_SEQ_KIND_BIN_TREE    (2 << CV_SEQ_ELTYPE_BITS)
+
+/** types of sparse sequences (sets) */
+#define CV_SEQ_KIND_GRAPH       (1 << CV_SEQ_ELTYPE_BITS)
+#define CV_SEQ_KIND_SUBDIV2D    (2 << CV_SEQ_ELTYPE_BITS)
+
+#define CV_SEQ_FLAG_SHIFT       (CV_SEQ_KIND_BITS + CV_SEQ_ELTYPE_BITS)
+
+/** flags for curves */
+#define CV_SEQ_FLAG_CLOSED     (1 << CV_SEQ_FLAG_SHIFT)
+#define CV_SEQ_FLAG_SIMPLE     (0 << CV_SEQ_FLAG_SHIFT)
+#define CV_SEQ_FLAG_CONVEX     (0 << CV_SEQ_FLAG_SHIFT)
+#define CV_SEQ_FLAG_HOLE       (2 << CV_SEQ_FLAG_SHIFT)
+
+/** flags for graphs */
+#define CV_GRAPH_FLAG_ORIENTED (1 << CV_SEQ_FLAG_SHIFT)
+
+#define CV_GRAPH               CV_SEQ_KIND_GRAPH
+#define CV_ORIENTED_GRAPH      (CV_SEQ_KIND_GRAPH|CV_GRAPH_FLAG_ORIENTED)
+
+/** point sets */
+#define CV_SEQ_POINT_SET       (CV_SEQ_KIND_GENERIC| CV_SEQ_ELTYPE_POINT)
+#define CV_SEQ_POINT3D_SET     (CV_SEQ_KIND_GENERIC| CV_SEQ_ELTYPE_POINT3D)
+#define CV_SEQ_POLYLINE        (CV_SEQ_KIND_CURVE  | CV_SEQ_ELTYPE_POINT)
+#define CV_SEQ_POLYGON         (CV_SEQ_FLAG_CLOSED | CV_SEQ_POLYLINE )
+#define CV_SEQ_CONTOUR         CV_SEQ_POLYGON
+#define CV_SEQ_SIMPLE_POLYGON  (CV_SEQ_FLAG_SIMPLE | CV_SEQ_POLYGON  )
+
+/** chain-coded curves */
+#define CV_SEQ_CHAIN           (CV_SEQ_KIND_CURVE  | CV_SEQ_ELTYPE_CODE)
+#define CV_SEQ_CHAIN_CONTOUR   (CV_SEQ_FLAG_CLOSED | CV_SEQ_CHAIN)
+
+/** binary tree for the contour */
+#define CV_SEQ_POLYGON_TREE    (CV_SEQ_KIND_BIN_TREE  | CV_SEQ_ELTYPE_TRIAN_ATR)
+
+/** sequence of the connected components */
+#define CV_SEQ_CONNECTED_COMP  (CV_SEQ_KIND_GENERIC  | CV_SEQ_ELTYPE_CONNECTED_COMP)
+
+/** sequence of the integer numbers */
+#define CV_SEQ_INDEX           (CV_SEQ_KIND_GENERIC  | CV_SEQ_ELTYPE_INDEX)
+
+#define CV_SEQ_ELTYPE( seq )   ((seq)->flags & CV_SEQ_ELTYPE_MASK)
+#define CV_SEQ_KIND( seq )     ((seq)->flags & CV_SEQ_KIND_MASK )
+
+/** flag checking */
+#define CV_IS_SEQ_INDEX( seq )      ((CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_INDEX) && \
+                                     (CV_SEQ_KIND(seq) == CV_SEQ_KIND_GENERIC))
+
+#define CV_IS_SEQ_CURVE( seq )      (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE)
+#define CV_IS_SEQ_CLOSED( seq )     (((seq)->flags & CV_SEQ_FLAG_CLOSED) != 0)
+#define CV_IS_SEQ_CONVEX( seq )     0
+#define CV_IS_SEQ_HOLE( seq )       (((seq)->flags & CV_SEQ_FLAG_HOLE) != 0)
+#define CV_IS_SEQ_SIMPLE( seq )     1
+
+/** type checking macros */
+#define CV_IS_SEQ_POINT_SET( seq ) \
+    ((CV_SEQ_ELTYPE(seq) == CV_32SC2 || CV_SEQ_ELTYPE(seq) == CV_32FC2))
+
+#define CV_IS_SEQ_POINT_SUBSET( seq ) \
+    (CV_IS_SEQ_INDEX( seq ) || CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_PPOINT)
+
+#define CV_IS_SEQ_POLYLINE( seq )   \
+    (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && CV_IS_SEQ_POINT_SET(seq))
+
+#define CV_IS_SEQ_POLYGON( seq )   \
+    (CV_IS_SEQ_POLYLINE(seq) && CV_IS_SEQ_CLOSED(seq))
+
+#define CV_IS_SEQ_CHAIN( seq )   \
+    (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && (seq)->elem_size == 1)
+
+#define CV_IS_SEQ_CONTOUR( seq )   \
+    (CV_IS_SEQ_CLOSED(seq) && (CV_IS_SEQ_POLYLINE(seq) || CV_IS_SEQ_CHAIN(seq)))
+
+#define CV_IS_SEQ_CHAIN_CONTOUR( seq ) \
+    (CV_IS_SEQ_CHAIN( seq ) && CV_IS_SEQ_CLOSED( seq ))
+
+#define CV_IS_SEQ_POLYGON_TREE( seq ) \
+    (CV_SEQ_ELTYPE (seq) ==  CV_SEQ_ELTYPE_TRIAN_ATR &&    \
+    CV_SEQ_KIND( seq ) ==  CV_SEQ_KIND_BIN_TREE )
+
+#define CV_IS_GRAPH( seq )    \
+    (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_GRAPH)
+
+#define CV_IS_GRAPH_ORIENTED( seq )   \
+    (((seq)->flags & CV_GRAPH_FLAG_ORIENTED) != 0)
+
+#define CV_IS_SUBDIV2D( seq )  \
+    (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_SUBDIV2D)
+
+/****************************************************************************************/
+/*                            Sequence writer & reader                                  */
+/****************************************************************************************/
+
+#define CV_SEQ_WRITER_FIELDS()                                     \
+    int          header_size;                                      \
+    CvSeq*       seq;        /**< the sequence written */            \
+    CvSeqBlock*  block;      /**< current block */                   \
+    schar*       ptr;        /**< pointer to free space */           \
+    schar*       block_min;  /**< pointer to the beginning of block*/\
+    schar*       block_max;  /**< pointer to the end of block */
+
+typedef struct CvSeqWriter
+{
+    CV_SEQ_WRITER_FIELDS()
+}
+CvSeqWriter;
+
+
+#define CV_SEQ_READER_FIELDS()                                      \
+    int          header_size;                                       \
+    CvSeq*       seq;        /**< sequence, beign read */             \
+    CvSeqBlock*  block;      /**< current block */                    \
+    schar*       ptr;        /**< pointer to element be read next */  \
+    schar*       block_min;  /**< pointer to the beginning of block */\
+    schar*       block_max;  /**< pointer to the end of block */      \
+    int          delta_index;/**< = seq->first->start_index   */      \
+    schar*       prev_elem;  /**< pointer to previous element */
+
+typedef struct CvSeqReader
+{
+    CV_SEQ_READER_FIELDS()
+}
+CvSeqReader;
+
+/****************************************************************************************/
+/*                                Operations on sequences                               */
+/****************************************************************************************/
+
+#define  CV_SEQ_ELEM( seq, elem_type, index )                    \
+/** assert gives some guarantee that <seq> parameter is valid */  \
+(   assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) &&      \
+    (seq)->elem_size == sizeof(elem_type)),                      \
+    (elem_type*)((seq)->first && (unsigned)index <               \
+    (unsigned)((seq)->first->count) ?                            \
+    (seq)->first->data + (index) * sizeof(elem_type) :           \
+    cvGetSeqElem( (CvSeq*)(seq), (index) )))
+#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )
+
+/** Add element to sequence: */
+#define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer )     \
+{                                                     \
+    if( (writer).ptr >= (writer).block_max )          \
+    {                                                 \
+        cvCreateSeqBlock( &writer);                   \
+    }                                                 \
+    memcpy((writer).ptr, elem_ptr, (writer).seq->elem_size);\
+    (writer).ptr += (writer).seq->elem_size;          \
+}
+
+#define CV_WRITE_SEQ_ELEM( elem, writer )             \
+{                                                     \
+    assert( (writer).seq->elem_size == sizeof(elem)); \
+    if( (writer).ptr >= (writer).block_max )          \
+    {                                                 \
+        cvCreateSeqBlock( &writer);                   \
+    }                                                 \
+    assert( (writer).ptr <= (writer).block_max - sizeof(elem));\
+    memcpy((writer).ptr, &(elem), sizeof(elem));      \
+    (writer).ptr += sizeof(elem);                     \
+}
+
+
+/** Move reader position forward: */
+#define CV_NEXT_SEQ_ELEM( elem_size, reader )                 \
+{                                                             \
+    if( ((reader).ptr += (elem_size)) >= (reader).block_max ) \
+    {                                                         \
+        cvChangeSeqBlock( &(reader), 1 );                     \
+    }                                                         \
+}
+
+
+/** Move reader position backward: */
+#define CV_PREV_SEQ_ELEM( elem_size, reader )                \
+{                                                            \
+    if( ((reader).ptr -= (elem_size)) < (reader).block_min ) \
+    {                                                        \
+        cvChangeSeqBlock( &(reader), -1 );                   \
+    }                                                        \
+}
+
+/** Read element and move read position forward: */
+#define CV_READ_SEQ_ELEM( elem, reader )                       \
+{                                                              \
+    assert( (reader).seq->elem_size == sizeof(elem));          \
+    memcpy( &(elem), (reader).ptr, sizeof((elem)));            \
+    CV_NEXT_SEQ_ELEM( sizeof(elem), reader )                   \
+}
+
+/** Read element and move read position backward: */
+#define CV_REV_READ_SEQ_ELEM( elem, reader )                     \
+{                                                                \
+    assert( (reader).seq->elem_size == sizeof(elem));            \
+    memcpy(&(elem), (reader).ptr, sizeof((elem)));               \
+    CV_PREV_SEQ_ELEM( sizeof(elem), reader )                     \
+}
+
+
+#define CV_READ_CHAIN_POINT( _pt, reader )                              \
+{                                                                       \
+    (_pt) = (reader).pt;                                                \
+    if( (reader).ptr )                                                  \
+    {                                                                   \
+        CV_READ_SEQ_ELEM( (reader).code, (reader));                     \
+        assert( ((reader).code & ~7) == 0 );                            \
+        (reader).pt.x += (reader).deltas[(int)(reader).code][0];        \
+        (reader).pt.y += (reader).deltas[(int)(reader).code][1];        \
+    }                                                                   \
+}
+
+#define CV_CURRENT_POINT( reader )  (*((CvPoint*)((reader).ptr)))
+#define CV_PREV_POINT( reader )     (*((CvPoint*)((reader).prev_elem)))
+
+#define CV_READ_EDGE( pt1, pt2, reader )               \
+{                                                      \
+    assert( sizeof(pt1) == sizeof(CvPoint) &&          \
+            sizeof(pt2) == sizeof(CvPoint) &&          \
+            reader.seq->elem_size == sizeof(CvPoint)); \
+    (pt1) = CV_PREV_POINT( reader );                   \
+    (pt2) = CV_CURRENT_POINT( reader );                \
+    (reader).prev_elem = (reader).ptr;                 \
+    CV_NEXT_SEQ_ELEM( sizeof(CvPoint), (reader));      \
+}
+
+/************ Graph macros ************/
+
+/** Return next graph edge for given vertex: */
+#define  CV_NEXT_GRAPH_EDGE( edge, vertex )                              \
+     (assert((edge)->vtx[0] == (vertex) || (edge)->vtx[1] == (vertex)),  \
+      (edge)->next[(edge)->vtx[1] == (vertex)])
+
+
+
+/****************************************************************************************\
+*             Data structures for persistence (a.k.a serialization) functionality        *
+\****************************************************************************************/
+
+/** "black box" file storage */
+typedef struct CvFileStorage CvFileStorage;
+
+/** Storage flags: */
+#define CV_STORAGE_READ          0
+#define CV_STORAGE_WRITE         1
+#define CV_STORAGE_WRITE_TEXT    CV_STORAGE_WRITE
+#define CV_STORAGE_WRITE_BINARY  CV_STORAGE_WRITE
+#define CV_STORAGE_APPEND        2
+#define CV_STORAGE_MEMORY        4
+#define CV_STORAGE_FORMAT_MASK   (7<<3)
+#define CV_STORAGE_FORMAT_AUTO   0
+#define CV_STORAGE_FORMAT_XML    8
+#define CV_STORAGE_FORMAT_YAML  16
+
+/** @brief List of attributes. :
+
+In the current implementation, attributes are used to pass extra parameters when writing user
+objects (see cvWrite). XML attributes inside tags are not supported, aside from the object type
+specification (type_id attribute).
+@see cvAttrList, cvAttrValue
+ */
+typedef struct CvAttrList
+{
+    const char** attr;         /**< NULL-terminated array of (attribute_name,attribute_value) pairs. */
+    struct CvAttrList* next;   /**< Pointer to next chunk of the attributes list.                    */
+}
+CvAttrList;
+
+/** initializes CvAttrList structure */
+CV_INLINE CvAttrList cvAttrList( const char** attr CV_DEFAULT(NULL),
+                                 CvAttrList* next CV_DEFAULT(NULL) )
+{
+    CvAttrList l;
+    l.attr = attr;
+    l.next = next;
+
+    return l;
+}
+
+struct CvTypeInfo;
+
+#define CV_NODE_NONE        0
+#define CV_NODE_INT         1
+#define CV_NODE_INTEGER     CV_NODE_INT
+#define CV_NODE_REAL        2
+#define CV_NODE_FLOAT       CV_NODE_REAL
+#define CV_NODE_STR         3
+#define CV_NODE_STRING      CV_NODE_STR
+#define CV_NODE_REF         4 /**< not used */
+#define CV_NODE_SEQ         5
+#define CV_NODE_MAP         6
+#define CV_NODE_TYPE_MASK   7
+
+#define CV_NODE_TYPE(flags)  ((flags) & CV_NODE_TYPE_MASK)
+
+/** file node flags */
+#define CV_NODE_FLOW        8 /**<Used only for writing structures in YAML format. */
+#define CV_NODE_USER        16
+#define CV_NODE_EMPTY       32
+#define CV_NODE_NAMED       64
+
+#define CV_NODE_IS_INT(flags)        (CV_NODE_TYPE(flags) == CV_NODE_INT)
+#define CV_NODE_IS_REAL(flags)       (CV_NODE_TYPE(flags) == CV_NODE_REAL)
+#define CV_NODE_IS_STRING(flags)     (CV_NODE_TYPE(flags) == CV_NODE_STRING)
+#define CV_NODE_IS_SEQ(flags)        (CV_NODE_TYPE(flags) == CV_NODE_SEQ)
+#define CV_NODE_IS_MAP(flags)        (CV_NODE_TYPE(flags) == CV_NODE_MAP)
+#define CV_NODE_IS_COLLECTION(flags) (CV_NODE_TYPE(flags) >= CV_NODE_SEQ)
+#define CV_NODE_IS_FLOW(flags)       (((flags) & CV_NODE_FLOW) != 0)
+#define CV_NODE_IS_EMPTY(flags)      (((flags) & CV_NODE_EMPTY) != 0)
+#define CV_NODE_IS_USER(flags)       (((flags) & CV_NODE_USER) != 0)
+#define CV_NODE_HAS_NAME(flags)      (((flags) & CV_NODE_NAMED) != 0)
+
+#define CV_NODE_SEQ_SIMPLE 256
+#define CV_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & CV_NODE_SEQ_SIMPLE) != 0)
+
+typedef struct CvString
+{
+    int len;
+    char* ptr;
+}
+CvString;
+
+/** All the keys (names) of elements in the readed file storage
+   are stored in the hash to speed up the lookup operations: */
+typedef struct CvStringHashNode
+{
+    unsigned hashval;
+    CvString str;
+    struct CvStringHashNode* next;
+}
+CvStringHashNode;
+
+typedef struct CvGenericHash CvFileNodeHash;
+
+/** Basic element of the file storage - scalar or collection: */
+typedef struct CvFileNode
+{
+    int tag;
+    struct CvTypeInfo* info; /**< type information
+            (only for user-defined object, for others it is 0) */
+    union
+    {
+        double f; /**< scalar floating-point number */
+        int i;    /**< scalar integer number */
+        CvString str; /**< text string */
+        CvSeq* seq; /**< sequence (ordered collection of file nodes) */
+        CvFileNodeHash* map; /**< map (collection of named file nodes) */
+    } data;
+}
+CvFileNode;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CV_CDECL *CvIsInstanceFunc)( const void* struct_ptr );
+typedef void (CV_CDECL *CvReleaseFunc)( void** struct_dblptr );
+typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage, CvFileNode* node );
+typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage, const char* name,
+                                      const void* struct_ptr, CvAttrList attributes );
+typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr );
+#ifdef __cplusplus
+}
+#endif
+
+/** @brief Type information
+
+The structure contains information about one of the standard or user-defined types. Instances of the
+type may or may not contain a pointer to the corresponding CvTypeInfo structure. In any case, there
+is a way to find the type info structure for a given object using the cvTypeOf function.
+Alternatively, type info can be found by type name using cvFindType, which is used when an object
+is read from file storage. The user can register a new type with cvRegisterType that adds the type
+information structure into the beginning of the type list. Thus, it is possible to create
+specialized types from generic standard types and override the basic methods.
+ */
+typedef struct CvTypeInfo
+{
+    int flags; /**< not used */
+    int header_size; /**< sizeof(CvTypeInfo) */
+    struct CvTypeInfo* prev; /**< previous registered type in the list */
+    struct CvTypeInfo* next; /**< next registered type in the list */
+    const char* type_name; /**< type name, written to file storage */
+    CvIsInstanceFunc is_instance; /**< checks if the passed object belongs to the type */
+    CvReleaseFunc release; /**< releases object (memory etc.) */
+    CvReadFunc read; /**< reads object from file storage */
+    CvWriteFunc write; /**< writes object to file storage */
+    CvCloneFunc clone; /**< creates a copy of the object */
+}
+CvTypeInfo;
+
+
+/**** System data types ******/
+
+typedef struct CvPluginFuncInfo
+{
+    void** func_addr;
+    void* default_func_addr;
+    const char* func_names;
+    int search_modules;
+    int loaded_from;
+}
+CvPluginFuncInfo;
+
+typedef struct CvModuleInfo
+{
+    struct CvModuleInfo* next;
+    const char* name;
+    const char* version;
+    CvPluginFuncInfo* func_tab;
+}
+CvModuleInfo;
+
+/** @} */
+
+#endif /*__OPENCV_CORE_TYPES_H__*/
+
+/* End of file. */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp
new file mode 100644
index 0000000..b66ade5
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp
@@ -0,0 +1,889 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_UTILITY_H__
+#define __OPENCV_CORE_UTILITY_H__
+
+#ifndef __cplusplus
+#  error utility.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+
+#ifdef CV_COLLECT_IMPL_DATA
+CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays
+CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays
+// Get stored implementation flags and fucntions names arrays
+// Each implementation entry correspond to function name entry, so you can find which implementation was executed in which fucntion
+CV_EXPORTS int getImpl(std::vector<int> &impl, std::vector<String> &funName);
+
+CV_EXPORTS bool useCollection(); // return implementation collection state
+CV_EXPORTS void setUseCollection(bool flag); // set implementation collection state
+
+#define CV_IMPL_PLAIN  0x01 // native CPU OpenCV implementation
+#define CV_IMPL_OCL    0x02 // OpenCL implementation
+#define CV_IMPL_IPP    0x04 // IPP implementation
+#define CV_IMPL_MT     0x10 // multithreaded implementation
+
+#define CV_IMPL_ADD(impl)                                                   \
+    if(cv::useCollection())                                                 \
+    {                                                                       \
+        cv::addImpl(impl, CV_Func);                                         \
+    }
+#else
+#define CV_IMPL_ADD(impl)
+#endif
+
+//! @addtogroup core_utils
+//! @{
+
+/** @brief  Automatically Allocated Buffer Class
+
+ The class is used for temporary buffers in functions and methods.
+ If a temporary buffer is usually small (a few K's of memory),
+ but its size depends on the parameters, it makes sense to create a small
+ fixed-size array on stack and use it if it's large enough. If the required buffer size
+ is larger than the fixed size, another buffer of sufficient size is allocated dynamically
+ and released after the processing. Therefore, in typical cases, when the buffer size is small,
+ there is no overhead associated with malloc()/free().
+ At the same time, there is no limit on the size of processed data.
+
+ This is what AutoBuffer does. The template takes 2 parameters - type of the buffer elements and
+ the number of stack-allocated elements. Here is how the class is used:
+
+ \code
+ void my_func(const cv::Mat& m)
+ {
+    cv::AutoBuffer<float> buf; // create automatic buffer containing 1000 floats
+
+    buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used,
+                          // otherwise the buffer of "m.rows" floats will be allocated
+                          // dynamically and deallocated in cv::AutoBuffer destructor
+    ...
+ }
+ \endcode
+*/
+template<typename _Tp, size_t fixed_size = 1024/sizeof(_Tp)+8> class AutoBuffer
+{
+public:
+    typedef _Tp value_type;
+
+    //! the default constructor
+    AutoBuffer();
+    //! constructor taking the real buffer size
+    AutoBuffer(size_t _size);
+
+    //! the copy constructor
+    AutoBuffer(const AutoBuffer<_Tp, fixed_size>& buf);
+    //! the assignment operator
+    AutoBuffer<_Tp, fixed_size>& operator = (const AutoBuffer<_Tp, fixed_size>& buf);
+
+    //! destructor. calls deallocate()
+    ~AutoBuffer();
+
+    //! allocates the new buffer of size _size. if the _size is small enough, stack-allocated buffer is used
+    void allocate(size_t _size);
+    //! deallocates the buffer if it was dynamically allocated
+    void deallocate();
+    //! resizes the buffer and preserves the content
+    void resize(size_t _size);
+    //! returns the current buffer size
+    size_t size() const;
+    //! returns pointer to the real buffer, stack-allocated or head-allocated
+    operator _Tp* ();
+    //! returns read-only pointer to the real buffer, stack-allocated or head-allocated
+    operator const _Tp* () const;
+
+protected:
+    //! pointer to the real buffer, can point to buf if the buffer is small enough
+    _Tp* ptr;
+    //! size of the real buffer
+    size_t sz;
+    //! pre-allocated buffer. At least 1 element to confirm C++ standard reqirements
+    _Tp buf[(fixed_size > 0) ? fixed_size : 1];
+};
+
+/**  @brief Sets/resets the break-on-error mode.
+
+When the break-on-error mode is set, the default error handler issues a hardware exception, which
+can make debugging more convenient.
+
+\return the previous state
+ */
+CV_EXPORTS bool setBreakOnError(bool flag);
+
+extern "C" typedef int (*ErrorCallback)( int status, const char* func_name,
+                                       const char* err_msg, const char* file_name,
+                                       int line, void* userdata );
+
+
+/** @brief Sets the new error handler and the optional user data.
+
+  The function sets the new error handler, called from cv::error().
+
+  \param errCallback the new error handler. If NULL, the default error handler is used.
+  \param userdata the optional user data pointer, passed to the callback.
+  \param prevUserdata the optional output parameter where the previous user data pointer is stored
+
+  \return the previous error handler
+*/
+CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback, void* userdata=0, void** prevUserdata=0);
+
+/** @brief Returns a text string formatted using the printf-like expression.
+
+The function acts like sprintf but forms and returns an STL string. It can be used to form an error
+message in the Exception constructor.
+@param fmt printf-compatible formatting specifiers.
+ */
+CV_EXPORTS String format( const char* fmt, ... );
+CV_EXPORTS String tempfile( const char* suffix = 0);
+CV_EXPORTS void glob(String pattern, std::vector<String>& result, bool recursive = false);
+
+/** @brief OpenCV will try to set the number of threads for the next parallel region.
+
+If threads == 0, OpenCV will disable threading optimizations and run all it's functions
+sequentially. Passing threads \< 0 will reset threads number to system default. This function must
+be called outside of parallel region.
+
+OpenCV will try to run it's functions with specified threads number, but some behaviour differs from
+framework:
+-   `TBB` 鈥� User-defined parallel constructions will run with the same threads number, if
+    another does not specified. If late on user creates own scheduler, OpenCV will be use it.
+-   `OpenMP` 鈥� No special defined behaviour.
+-   `Concurrency` 鈥� If threads == 1, OpenCV will disable threading optimizations and run it's
+    functions sequentially.
+-   `GCD` 鈥� Supports only values \<= 0.
+-   `C=` 鈥� No special defined behaviour.
+@param nthreads Number of threads used by OpenCV.
+@sa getNumThreads, getThreadNum
+ */
+CV_EXPORTS_W void setNumThreads(int nthreads);
+
+/** @brief Returns the number of threads used by OpenCV for parallel regions.
+
+Always returns 1 if OpenCV is built without threading support.
+
+The exact meaning of return value depends on the threading framework used by OpenCV library:
+- `TBB` 鈥� The number of threads, that OpenCV will try to use for parallel regions. If there is
+  any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns
+  default number of threads used by TBB library.
+- `OpenMP` 鈥� An upper bound on the number of threads that could be used to form a new team.
+- `Concurrency` 鈥� The number of threads, that OpenCV will try to use for parallel regions.
+- `GCD` 鈥� Unsupported; returns the GCD thread pool limit (512) for compatibility.
+- `C=` 鈥� The number of threads, that OpenCV will try to use for parallel regions, if before
+  called setNumThreads with threads \> 0, otherwise returns the number of logical CPUs,
+  available for the process.
+@sa setNumThreads, getThreadNum
+ */
+CV_EXPORTS_W int getNumThreads();
+
+/** @brief Returns the index of the currently executed thread within the current parallel region. Always
+returns 0 if called outside of parallel region.
+
+The exact meaning of return value depends on the threading framework used by OpenCV library:
+- `TBB` 鈥� Unsupported with current 4.1 TBB release. May be will be supported in future.
+- `OpenMP` 鈥� The thread number, within the current team, of the calling thread.
+- `Concurrency` 鈥� An ID for the virtual processor that the current context is executing on (0
+  for master thread and unique number for others, but not necessary 1,2,3,...).
+- `GCD` 鈥� System calling thread's ID. Never returns 0 inside parallel region.
+- `C=` 鈥� The index of the current parallel task.
+@sa setNumThreads, getNumThreads
+ */
+CV_EXPORTS_W int getThreadNum();
+
+/** @brief Returns full configuration time cmake output.
+
+Returned value is raw cmake output including version control system revision, compiler version,
+compiler flags, enabled modules and third party libraries, etc. Output format depends on target
+architecture.
+ */
+CV_EXPORTS_W const String& getBuildInformation();
+
+/** @brief Returns the number of ticks.
+
+The function returns the number of ticks after the certain event (for example, when the machine was
+turned on). It can be used to initialize RNG or to measure a function execution time by reading the
+tick count before and after the function call. See also the tick frequency.
+ */
+CV_EXPORTS_W int64 getTickCount();
+
+/** @brief Returns the number of ticks per second.
+
+The function returns the number of ticks per second. That is, the following code computes the
+execution time in seconds:
+@code
+    double t = (double)getTickCount();
+    // do something ...
+    t = ((double)getTickCount() - t)/getTickFrequency();
+@endcode
+ */
+CV_EXPORTS_W double getTickFrequency();
+
+/** @brief Returns the number of CPU ticks.
+
+The function returns the current number of CPU ticks on some architectures (such as x86, x64,
+PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for
+very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU
+systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU
+with its own counter. So, theoretically (and practically) the subsequent calls to the function do
+not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU
+frequency depending on the load, the number of CPU clocks spent in some code cannot be directly
+converted to time units. Therefore, getTickCount is generally a preferable solution for measuring
+execution time.
+ */
+CV_EXPORTS_W int64 getCPUTickCount();
+
+/** @brief Returns true if the specified feature is supported by the host hardware.
+
+The function returns true if the host hardware supports the specified feature. When user calls
+setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until
+setUseOptimized(true) is called. This way user can dynamically switch on and off the optimized code
+in OpenCV.
+@param feature The feature of interest, one of cv::CpuFeatures
+ */
+CV_EXPORTS_W bool checkHardwareSupport(int feature);
+
+/** @brief Returns the number of logical CPUs available for the process.
+ */
+CV_EXPORTS_W int getNumberOfCPUs();
+
+
+/** @brief Aligns a pointer to the specified number of bytes.
+
+The function returns the aligned pointer of the same type as the input pointer:
+\f[\texttt{(_Tp*)(((size_t)ptr + n-1) & -n)}\f]
+@param ptr Aligned pointer.
+@param n Alignment size that must be a power of two.
+ */
+template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_Tp))
+{
+    return (_Tp*)(((size_t)ptr + n-1) & -n);
+}
+
+/** @brief Aligns a buffer size to the specified number of bytes.
+
+The function returns the minimum number that is greater or equal to sz and is divisible by n :
+\f[\texttt{(sz + n-1) & -n}\f]
+@param sz Buffer size to align.
+@param n Alignment size that must be a power of two.
+ */
+static inline size_t alignSize(size_t sz, int n)
+{
+    CV_DbgAssert((n & (n - 1)) == 0); // n is a power of 2
+    return (sz + n-1) & -n;
+}
+
+/** @brief Enables or disables the optimized code.
+
+The function can be used to dynamically turn on and off optimized code (code that uses SSE2, AVX,
+and other instructions on the platforms that support it). It sets a global flag that is further
+checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only
+safe to call the function on the very top level in your application where you can be sure that no
+other OpenCV function is currently executed.
+
+By default, the optimized code is enabled unless you disable it in CMake. The current status can be
+retrieved using useOptimized.
+@param onoff The boolean flag specifying whether the optimized code should be used (onoff=true)
+or not (onoff=false).
+ */
+CV_EXPORTS_W void setUseOptimized(bool onoff);
+
+/** @brief Returns the status of optimized code usage.
+
+The function returns true if the optimized code is enabled. Otherwise, it returns false.
+ */
+CV_EXPORTS_W bool useOptimized();
+
+static inline size_t getElemSize(int type) { return CV_ELEM_SIZE(type); }
+
+/////////////////////////////// Parallel Primitives //////////////////////////////////
+
+/** @brief Base class for parallel data processors
+*/
+class CV_EXPORTS ParallelLoopBody
+{
+public:
+    virtual ~ParallelLoopBody();
+    virtual void operator() (const Range& range) const = 0;
+};
+
+/** @brief Parallel data processor
+*/
+CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body, double nstripes=-1.);
+
+/////////////////////////////// forEach method of cv::Mat ////////////////////////////
+template<typename _Tp, typename Functor> inline
+void Mat::forEach_impl(const Functor& operation) {
+    if (false) {
+        operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(NULL));
+        // If your compiler fail in this line.
+        // Please check that your functor signature is
+        //     (_Tp&, const int*)   <- multidimential
+        //  or (_Tp&, void*)        <- in case of you don't need current idx.
+    }
+
+    CV_Assert(this->total() / this->size[this->dims - 1] <= INT_MAX);
+    const int LINES = static_cast<int>(this->total() / this->size[this->dims - 1]);
+
+    class PixelOperationWrapper :public ParallelLoopBody
+    {
+    public:
+        PixelOperationWrapper(Mat_<_Tp>* const frame, const Functor& _operation)
+            : mat(frame), op(_operation) {};
+        virtual ~PixelOperationWrapper(){};
+        // ! Overloaded virtual operator
+        // convert range call to row call.
+        virtual void operator()(const Range &range) const {
+            const int DIMS = mat->dims;
+            const int COLS = mat->size[DIMS - 1];
+            if (DIMS <= 2) {
+                for (int row = range.start; row < range.end; ++row) {
+                    this->rowCall2(row, COLS);
+                }
+            } else {
+                std::vector<int> idx(COLS); /// idx is modified in this->rowCall
+                idx[DIMS - 2] = range.start - 1;
+
+                for (int line_num = range.start; line_num < range.end; ++line_num) {
+                    idx[DIMS - 2]++;
+                    for (int i = DIMS - 2; i >= 0; --i) {
+                        if (idx[i] >= mat->size[i]) {
+                            idx[i - 1] += idx[i] / mat->size[i];
+                            idx[i] %= mat->size[i];
+                            continue; // carry-over;
+                        }
+                        else {
+                            break;
+                        }
+                    }
+                    this->rowCall(&idx[0], COLS, DIMS);
+                }
+            }
+        };
+    private:
+        Mat_<_Tp>* const mat;
+        const Functor op;
+        // ! Call operator for each elements in this row.
+        inline void rowCall(int* const idx, const int COLS, const int DIMS) const {
+            int &col = idx[DIMS - 1];
+            col = 0;
+            _Tp* pixel = &(mat->template at<_Tp>(idx));
+
+            while (col < COLS) {
+                op(*pixel, const_cast<const int*>(idx));
+                pixel++; col++;
+            }
+            col = 0;
+        }
+        // ! Call operator for each elements in this row. 2d mat special version.
+        inline void rowCall2(const int row, const int COLS) const {
+            union Index{
+                int body[2];
+                operator const int*() const {
+                    return reinterpret_cast<const int*>(this);
+                }
+                int& operator[](const int i) {
+                    return body[i];
+                }
+            } idx = {{row, 0}};
+            // Special union is needed to avoid
+            // "error: array subscript is above array bounds [-Werror=array-bounds]"
+            // when call the functor `op` such that access idx[3].
+
+            _Tp* pixel = &(mat->template at<_Tp>(idx));
+            const _Tp* const pixel_end = pixel + COLS;
+            while(pixel < pixel_end) {
+                op(*pixel++, static_cast<const int*>(idx));
+                idx[1]++;
+            }
+        };
+        PixelOperationWrapper& operator=(const PixelOperationWrapper &) {
+            CV_Assert(false);
+            // We can not remove this implementation because Visual Studio warning C4822.
+            return *this;
+        };
+    };
+
+    parallel_for_(cv::Range(0, LINES), PixelOperationWrapper(reinterpret_cast<Mat_<_Tp>*>(this), operation));
+}
+
+/////////////////////////// Synchronization Primitives ///////////////////////////////
+
+class CV_EXPORTS Mutex
+{
+public:
+    Mutex();
+    ~Mutex();
+    Mutex(const Mutex& m);
+    Mutex& operator = (const Mutex& m);
+
+    void lock();
+    bool trylock();
+    void unlock();
+
+    struct Impl;
+protected:
+    Impl* impl;
+};
+
+class CV_EXPORTS AutoLock
+{
+public:
+    AutoLock(Mutex& m) : mutex(&m) { mutex->lock(); }
+    ~AutoLock() { mutex->unlock(); }
+protected:
+    Mutex* mutex;
+private:
+    AutoLock(const AutoLock&);
+    AutoLock& operator = (const AutoLock&);
+};
+
+// TLS interface
+class CV_EXPORTS TLSDataContainer
+{
+protected:
+    TLSDataContainer();
+    virtual ~TLSDataContainer();
+
+    void  gatherData(std::vector<void*> &data) const;
+#if OPENCV_ABI_COMPATIBILITY > 300
+    void* getData() const;
+    void  release();
+
+private:
+#else
+    void  release();
+
+public:
+    void* getData() const;
+#endif
+    virtual void* createDataInstance() const = 0;
+    virtual void  deleteDataInstance(void* pData) const = 0;
+
+    int key_;
+};
+
+// Main TLS data class
+template <typename T>
+class TLSData : protected TLSDataContainer
+{
+public:
+    inline TLSData()        {}
+    inline ~TLSData()       { release();            } // Release key and delete associated data
+    inline T* get() const   { return (T*)getData(); } // Get data assosiated with key
+
+     // Get data from all threads
+    inline void gather(std::vector<T*> &data) const
+    {
+        std::vector<void*> &dataVoid = reinterpret_cast<std::vector<void*>&>(data);
+        gatherData(dataVoid);
+    }
+
+private:
+    virtual void* createDataInstance() const {return new T;}                // Wrapper to allocate data by template
+    virtual void  deleteDataInstance(void* pData) const {delete (T*)pData;} // Wrapper to release data by template
+
+    // Disable TLS copy operations
+    TLSData(TLSData &) {};
+    TLSData& operator =(const TLSData &) {return *this;};
+};
+
+/** @brief Designed for command line parsing
+
+The sample below demonstrates how to use CommandLineParser:
+@code
+    CommandLineParser parser(argc, argv, keys);
+    parser.about("Application name v1.0.0");
+
+    if (parser.has("help"))
+    {
+        parser.printMessage();
+        return 0;
+    }
+
+    int N = parser.get<int>("N");
+    double fps = parser.get<double>("fps");
+    String path = parser.get<String>("path");
+
+    use_time_stamp = parser.has("timestamp");
+
+    String img1 = parser.get<String>(0);
+    String img2 = parser.get<String>(1);
+
+    int repeat = parser.get<int>(2);
+
+    if (!parser.check())
+    {
+        parser.printErrors();
+        return 0;
+    }
+@endcode
+
+### Keys syntax
+
+The keys parameter is a string containing several blocks, each one is enclosed in curley braces and
+describes one argument. Each argument contains three parts separated by the `|` symbol:
+
+-# argument names is a space-separated list of option synonyms (to mark argument as positional, prefix it with the `@` symbol)
+-# default value will be used if the argument was not provided (can be empty)
+-# help message (can be empty)
+
+For example:
+
+@code{.cpp}
+    const String keys =
+        "{help h usage ? |      | print this message   }"
+        "{@image1        |      | image1 for compare   }"
+        "{@image2        |<none>| image2 for compare   }"
+        "{@repeat        |1     | number               }"
+        "{path           |.     | path to file         }"
+        "{fps            | -1.0 | fps for output video }"
+        "{N count        |100   | count of objects     }"
+        "{ts timestamp   |      | use time stamp       }"
+        ;
+}
+@endcode
+
+Note that there are no default values for `help` and `timestamp` so we can check their presence using the `has()` method.
+Arguments with default values are considered to be always present. Use the `get()` method in these cases to check their
+actual value instead.
+
+String keys like `get<String>("@image1")` return the empty string `""` by default - even with an empty default value.
+Use the special `<none>` default value to enforce that the returned string must not be empty. (like in `get<String>("@image2")`)
+
+### Usage
+
+For the described keys:
+
+@code{.sh}
+    # Good call (3 positional parameters: image1, image2 and repeat; N is 200, ts is true)
+    $ ./app -N=200 1.png 2.jpg 19 -ts
+
+    # Bad call
+    $ ./app -fps=aaa
+    ERRORS:
+    Parameter 'fps': can not convert: [aaa] to [double]
+@endcode
+ */
+class CV_EXPORTS CommandLineParser
+{
+public:
+
+    /** @brief Constructor
+
+    Initializes command line parser object
+
+    @param argc number of command line arguments (from main())
+    @param argv array of command line arguments (from main())
+    @param keys string describing acceptable command line parameters (see class description for syntax)
+    */
+    CommandLineParser(int argc, const char* const argv[], const String& keys);
+
+    /** @brief Copy constructor */
+    CommandLineParser(const CommandLineParser& parser);
+
+    /** @brief Assignment operator */
+    CommandLineParser& operator = (const CommandLineParser& parser);
+
+    /** @brief Destructor */
+    ~CommandLineParser();
+
+    /** @brief Returns application path
+
+    This method returns the path to the executable from the command line (`argv[0]`).
+
+    For example, if the application has been started with such command:
+    @code{.sh}
+    $ ./bin/my-executable
+    @endcode
+    this method will return `./bin`.
+    */
+    String getPathToApplication() const;
+
+    /** @brief Access arguments by name
+
+    Returns argument converted to selected type. If the argument is not known or can not be
+    converted to selected type, the error flag is set (can be checked with @ref check).
+
+    For example, define:
+    @code{.cpp}
+    String keys = "{N count||}";
+    @endcode
+
+    Call:
+    @code{.sh}
+    $ ./my-app -N=20
+    # or
+    $ ./my-app --count=20
+    @endcode
+
+    Access:
+    @code{.cpp}
+    int N = parser.get<int>("N");
+    @endcode
+
+    @param name name of the argument
+    @param space_delete remove spaces from the left and right of the string
+    @tparam T the argument will be converted to this type if possible
+
+    @note You can access positional arguments by their `@`-prefixed name:
+    @code{.cpp}
+    parser.get<String>("@image");
+    @endcode
+     */
+    template <typename T>
+    T get(const String& name, bool space_delete = true) const
+    {
+        T val = T();
+        getByName(name, space_delete, ParamType<T>::type, (void*)&val);
+        return val;
+    }
+
+    /** @brief Access positional arguments by index
+
+    Returns argument converted to selected type. Indexes are counted from zero.
+
+    For example, define:
+    @code{.cpp}
+    String keys = "{@arg1||}{@arg2||}"
+    @endcode
+
+    Call:
+    @code{.sh}
+    ./my-app abc qwe
+    @endcode
+
+    Access arguments:
+    @code{.cpp}
+    String val_1 = parser.get<String>(0); // returns "abc", arg1
+    String val_2 = parser.get<String>(1); // returns "qwe", arg2
+    @endcode
+
+    @param index index of the argument
+    @param space_delete remove spaces from the left and right of the string
+    @tparam T the argument will be converted to this type if possible
+     */
+    template <typename T>
+    T get(int index, bool space_delete = true) const
+    {
+        T val = T();
+        getByIndex(index, space_delete, ParamType<T>::type, (void*)&val);
+        return val;
+    }
+
+    /** @brief Check if field was provided in the command line
+
+    @param name argument name to check
+    */
+    bool has(const String& name) const;
+
+    /** @brief Check for parsing errors
+
+    Returns true if error occured while accessing the parameters (bad conversion, missing arguments,
+    etc.). Call @ref printErrors to print error messages list.
+     */
+    bool check() const;
+
+    /** @brief Set the about message
+
+    The about message will be shown when @ref printMessage is called, right before arguments table.
+     */
+    void about(const String& message);
+
+    /** @brief Print help message
+
+    This method will print standard help message containing the about message and arguments description.
+
+    @sa about
+    */
+    void printMessage() const;
+
+    /** @brief Print list of errors occured
+
+    @sa check
+    */
+    void printErrors() const;
+
+protected:
+    void getByName(const String& name, bool space_delete, int type, void* dst) const;
+    void getByIndex(int index, bool space_delete, int type, void* dst) const;
+
+    struct Impl;
+    Impl* impl;
+};
+
+//! @} core_utils
+
+//! @cond IGNORED
+
+/////////////////////////////// AutoBuffer implementation ////////////////////////////////////////
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::AutoBuffer()
+{
+    ptr = buf;
+    sz = fixed_size;
+}
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::AutoBuffer(size_t _size)
+{
+    ptr = buf;
+    sz = fixed_size;
+    allocate(_size);
+}
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::AutoBuffer(const AutoBuffer<_Tp, fixed_size>& abuf )
+{
+    ptr = buf;
+    sz = fixed_size;
+    allocate(abuf.size());
+    for( size_t i = 0; i < sz; i++ )
+        ptr[i] = abuf.ptr[i];
+}
+
+template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>&
+AutoBuffer<_Tp, fixed_size>::operator = (const AutoBuffer<_Tp, fixed_size>& abuf)
+{
+    if( this != &abuf )
+    {
+        deallocate();
+        allocate(abuf.size());
+        for( size_t i = 0; i < sz; i++ )
+            ptr[i] = abuf.ptr[i];
+    }
+    return *this;
+}
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::~AutoBuffer()
+{ deallocate(); }
+
+template<typename _Tp, size_t fixed_size> inline void
+AutoBuffer<_Tp, fixed_size>::allocate(size_t _size)
+{
+    if(_size <= sz)
+    {
+        sz = _size;
+        return;
+    }
+    deallocate();
+    if(_size > fixed_size)
+    {
+        ptr = new _Tp[_size];
+        sz = _size;
+    }
+}
+
+template<typename _Tp, size_t fixed_size> inline void
+AutoBuffer<_Tp, fixed_size>::deallocate()
+{
+    if( ptr != buf )
+    {
+        delete[] ptr;
+        ptr = buf;
+        sz = fixed_size;
+    }
+}
+
+template<typename _Tp, size_t fixed_size> inline void
+AutoBuffer<_Tp, fixed_size>::resize(size_t _size)
+{
+    if(_size <= sz)
+    {
+        sz = _size;
+        return;
+    }
+    size_t i, prevsize = sz, minsize = MIN(prevsize, _size);
+    _Tp* prevptr = ptr;
+
+    ptr = _size > fixed_size ? new _Tp[_size] : buf;
+    sz = _size;
+
+    if( ptr != prevptr )
+        for( i = 0; i < minsize; i++ )
+            ptr[i] = prevptr[i];
+    for( i = prevsize; i < _size; i++ )
+        ptr[i] = _Tp();
+
+    if( prevptr != buf )
+        delete[] prevptr;
+}
+
+template<typename _Tp, size_t fixed_size> inline size_t
+AutoBuffer<_Tp, fixed_size>::size() const
+{ return sz; }
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::operator _Tp* ()
+{ return ptr; }
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::operator const _Tp* () const
+{ return ptr; }
+
+#ifndef OPENCV_NOSTL
+template<> inline std::string CommandLineParser::get<std::string>(int index, bool space_delete) const
+{
+    return get<String>(index, space_delete);
+}
+template<> inline std::string CommandLineParser::get<std::string>(const String& name, bool space_delete) const
+{
+    return get<String>(name, space_delete);
+}
+#endif // OPENCV_NOSTL
+
+//! @endcond
+
+} //namespace cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/core/core_c.h"
+#endif
+
+#endif //__OPENCV_CORE_UTILITY_H__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp
new file mode 100644
index 0000000..f4bb8a6
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp
@@ -0,0 +1,77 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// Copyright (C) 2015, Itseez, Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#ifndef __OPENCV_CORE_VA_INTEL_HPP__
+#define __OPENCV_CORE_VA_INTEL_HPP__
+
+#ifndef __cplusplus
+#  error va_intel.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core.hpp"
+#include "ocl.hpp"
+
+#if defined(HAVE_VA)
+# include "va/va.h"
+#else  // HAVE_VA
+# if !defined(_VA_H_)
+    typedef void* VADisplay;
+    typedef unsigned int VASurfaceID;
+# endif // !_VA_H_
+#endif // HAVE_VA
+
+namespace cv { namespace va_intel {
+
+/** @addtogroup core_va_intel
+This section describes Intel VA-API/OpenCL (CL-VA) interoperability.
+
+To enable CL-VA interoperability support, configure OpenCV using CMake with WITH_VA_INTEL=ON . Currently VA-API is
+supported on Linux only. You should also install Intel Media Server Studio (MSS) to use this feature. You may
+have to specify the path(s) to MSS components for cmake in environment variables: VA_INTEL_MSDK_ROOT for Media SDK
+(default is "/opt/intel/mediasdk"), and VA_INTEL_IOCL_ROOT for Intel OpenCL (default is "/opt/intel/opencl").
+
+To use CL-VA interoperability you should first create VADisplay (libva), and then call initializeContextFromVA()
+function to create OpenCL context and set up interoperability.
+*/
+//! @{
+
+/////////////////// CL-VA Interoperability Functions ///////////////////
+
+namespace ocl {
+using namespace cv::ocl;
+
+// TODO static functions in the Context class
+/** @brief Creates OpenCL context from VA.
+@param display    - VADisplay for which CL interop should be established.
+@param tryInterop - try to set up for interoperability, if true; set up for use slow copy if false.
+@return Returns reference to OpenCL Context
+ */
+CV_EXPORTS Context& initializeContextFromVA(VADisplay display, bool tryInterop = true);
+
+} // namespace cv::va_intel::ocl
+
+/** @brief Converts InputArray to VASurfaceID object.
+@param display - VADisplay object.
+@param src     - source InputArray.
+@param surface - destination VASurfaceID object.
+@param size    - size of image represented by VASurfaceID object.
+ */
+CV_EXPORTS void convertToVASurface(VADisplay display, InputArray src, VASurfaceID surface, Size size);
+
+/** @brief Converts VASurfaceID object to OutputArray.
+@param display - VADisplay object.
+@param surface - source VASurfaceID object.
+@param size    - size of image represented by VASurfaceID object.
+@param dst     - destination OutputArray.
+ */
+CV_EXPORTS void convertFromVASurface(VADisplay display, VASurfaceID surface, Size size, OutputArray dst);
+
+//! @}
+
+}} // namespace cv::va_intel
+
+#endif /* __OPENCV_CORE_VA_INTEL_HPP__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/version.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/version.hpp
new file mode 100644
index 0000000..cf1442b
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/version.hpp
@@ -0,0 +1,71 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright( C) 2000-2015, Intel Corporation, all rights reserved.
+// Copyright (C) 2011-2013, NVIDIA Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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 Intel Corporation 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*/
+
+/*
+  definition of the current version of OpenCV
+  Usefull to test in user programs
+*/
+
+#ifndef __OPENCV_VERSION_HPP__
+#define __OPENCV_VERSION_HPP__
+
+#define CV_VERSION_MAJOR    3
+#define CV_VERSION_MINOR    1
+#define CV_VERSION_REVISION 0
+#define CV_VERSION_STATUS   ""
+
+#define CVAUX_STR_EXP(__A)  #__A
+#define CVAUX_STR(__A)      CVAUX_STR_EXP(__A)
+
+#define CVAUX_STRW_EXP(__A)  L#__A
+#define CVAUX_STRW(__A)      CVAUX_STRW_EXP(__A)
+
+#define CV_VERSION          CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS
+
+/* old  style version constants*/
+#define CV_MAJOR_VERSION    CV_VERSION_MAJOR
+#define CV_MINOR_VERSION    CV_VERSION_MINOR
+#define CV_SUBMINOR_VERSION CV_VERSION_REVISION
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp
new file mode 100644
index 0000000..ef9d398
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp
@@ -0,0 +1,603 @@
+/*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) 2008, Google, 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 Intel Corporation or contributors 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*/
+
+#ifndef __OPENCV_CORE_WIMAGE_HPP__
+#define __OPENCV_CORE_WIMAGE_HPP__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+
+namespace cv {
+
+//! @addtogroup core
+//! @{
+
+template <typename T> class WImage;
+template <typename T> class WImageBuffer;
+template <typename T> class WImageView;
+
+template<typename T, int C> class WImageC;
+template<typename T, int C> class WImageBufferC;
+template<typename T, int C> class WImageViewC;
+
+// Commonly used typedefs.
+typedef WImage<uchar>            WImage_b;
+typedef WImageView<uchar>        WImageView_b;
+typedef WImageBuffer<uchar>      WImageBuffer_b;
+
+typedef WImageC<uchar, 1>        WImage1_b;
+typedef WImageViewC<uchar, 1>    WImageView1_b;
+typedef WImageBufferC<uchar, 1>  WImageBuffer1_b;
+
+typedef WImageC<uchar, 3>        WImage3_b;
+typedef WImageViewC<uchar, 3>    WImageView3_b;
+typedef WImageBufferC<uchar, 3>  WImageBuffer3_b;
+
+typedef WImage<float>            WImage_f;
+typedef WImageView<float>        WImageView_f;
+typedef WImageBuffer<float>      WImageBuffer_f;
+
+typedef WImageC<float, 1>        WImage1_f;
+typedef WImageViewC<float, 1>    WImageView1_f;
+typedef WImageBufferC<float, 1>  WImageBuffer1_f;
+
+typedef WImageC<float, 3>        WImage3_f;
+typedef WImageViewC<float, 3>    WImageView3_f;
+typedef WImageBufferC<float, 3>  WImageBuffer3_f;
+
+// There isn't a standard for signed and unsigned short so be more
+// explicit in the typename for these cases.
+typedef WImage<short>            WImage_16s;
+typedef WImageView<short>        WImageView_16s;
+typedef WImageBuffer<short>      WImageBuffer_16s;
+
+typedef WImageC<short, 1>        WImage1_16s;
+typedef WImageViewC<short, 1>    WImageView1_16s;
+typedef WImageBufferC<short, 1>  WImageBuffer1_16s;
+
+typedef WImageC<short, 3>        WImage3_16s;
+typedef WImageViewC<short, 3>    WImageView3_16s;
+typedef WImageBufferC<short, 3>  WImageBuffer3_16s;
+
+typedef WImage<ushort>            WImage_16u;
+typedef WImageView<ushort>        WImageView_16u;
+typedef WImageBuffer<ushort>      WImageBuffer_16u;
+
+typedef WImageC<ushort, 1>        WImage1_16u;
+typedef WImageViewC<ushort, 1>    WImageView1_16u;
+typedef WImageBufferC<ushort, 1>  WImageBuffer1_16u;
+
+typedef WImageC<ushort, 3>        WImage3_16u;
+typedef WImageViewC<ushort, 3>    WImageView3_16u;
+typedef WImageBufferC<ushort, 3>  WImageBuffer3_16u;
+
+/** @brief Image class which provides a thin layer around an IplImage.
+
+The goals of the class design are:
+
+    -# All the data has explicit ownership to avoid memory leaks
+    -# No hidden allocations or copies for performance.
+    -# Easy access to OpenCV methods (which will access IPP if available)
+    -# Can easily treat external data as an image
+    -# Easy to create images which are subsets of other images
+    -# Fast pixel access which can take advantage of number of channels if known at compile time.
+
+The WImage class is the image class which provides the data accessors. The 'W' comes from the fact
+that it is also a wrapper around the popular but inconvenient IplImage class. A WImage can be
+constructed either using a WImageBuffer class which allocates and frees the data, or using a
+WImageView class which constructs a subimage or a view into external data. The view class does no
+memory management. Each class actually has two versions, one when the number of channels is known
+at compile time and one when it isn't. Using the one with the number of channels specified can
+provide some compile time optimizations by using the fact that the number of channels is a
+constant.
+
+We use the convention (c,r) to refer to column c and row r with (0,0) being the upper left corner.
+This is similar to standard Euclidean coordinates with the first coordinate varying in the
+horizontal direction and the second coordinate varying in the vertical direction. Thus (c,r) is
+usually in the domain [0, width) X [0, height)
+
+Example usage:
+@code
+WImageBuffer3_b  im(5,7);  // Make a 5X7 3 channel image of type uchar
+WImageView3_b  sub_im(im, 2,2, 3,3); // 3X3 submatrix
+vector<float> vec(10, 3.0f);
+WImageView1_f user_im(&vec[0], 2, 5);  // 2X5 image w/ supplied data
+
+im.SetZero();  // same as cvSetZero(im.Ipl())
+*im(2, 3) = 15;  // Modify the element at column 2, row 3
+MySetRand(&sub_im);
+
+// Copy the second row into the first.  This can be done with no memory
+// allocation and will use SSE if IPP is available.
+int w = im.Width();
+im.View(0,0, w,1).CopyFrom(im.View(0,1, w,1));
+
+// Doesn't care about source of data since using WImage
+void MySetRand(WImage_b* im) { // Works with any number of channels
+for (int r = 0; r < im->Height(); ++r) {
+ float* row = im->Row(r);
+ for (int c = 0; c < im->Width(); ++c) {
+    for (int ch = 0; ch < im->Channels(); ++ch, ++row) {
+      *row = uchar(rand() & 255);
+    }
+ }
+}
+}
+@endcode
+
+Functions that are not part of the basic image allocation, viewing, and access should come from
+OpenCV, except some useful functions that are not part of OpenCV can be found in wimage_util.h
+*/
+template<typename T>
+class WImage
+{
+public:
+    typedef T BaseType;
+
+    // WImage is an abstract class with no other virtual methods so make the
+    // destructor virtual.
+    virtual ~WImage() = 0;
+
+    // Accessors
+    IplImage* Ipl() {return image_; }
+    const IplImage* Ipl() const {return image_; }
+    T* ImageData() { return reinterpret_cast<T*>(image_->imageData); }
+    const T* ImageData() const {
+        return reinterpret_cast<const T*>(image_->imageData);
+    }
+
+    int Width() const {return image_->width; }
+    int Height() const {return image_->height; }
+
+    // WidthStep is the number of bytes to go to the pixel with the next y coord
+    int WidthStep() const {return image_->widthStep; }
+
+    int Channels() const {return image_->nChannels; }
+    int ChannelSize() const {return sizeof(T); }  // number of bytes per channel
+
+    // Number of bytes per pixel
+    int PixelSize() const {return Channels() * ChannelSize(); }
+
+    // Return depth type (e.g. IPL_DEPTH_8U, IPL_DEPTH_32F) which is the number
+    // of bits per channel and with the signed bit set.
+    // This is known at compile time using specializations.
+    int Depth() const;
+
+    inline const T* Row(int r) const {
+        return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep);
+    }
+
+    inline T* Row(int r) {
+        return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep);
+    }
+
+    // Pixel accessors which returns a pointer to the start of the channel
+    inline T* operator() (int c, int r)  {
+        return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep) +
+            c*Channels();
+    }
+
+    inline const T* operator() (int c, int r) const  {
+        return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep) +
+            c*Channels();
+    }
+
+    // Copy the contents from another image which is just a convenience to cvCopy
+    void CopyFrom(const WImage<T>& src) { cvCopy(src.Ipl(), image_); }
+
+    // Set contents to zero which is just a convenient to cvSetZero
+    void SetZero() { cvSetZero(image_); }
+
+    // Construct a view into a region of this image
+    WImageView<T> View(int c, int r, int width, int height);
+
+protected:
+    // Disallow copy and assignment
+    WImage(const WImage&);
+    void operator=(const WImage&);
+
+    explicit WImage(IplImage* img) : image_(img) {
+        assert(!img || img->depth == Depth());
+    }
+
+    void SetIpl(IplImage* image) {
+        assert(!image || image->depth == Depth());
+        image_ = image;
+    }
+
+    IplImage* image_;
+};
+
+
+/** Image class when both the pixel type and number of channels
+are known at compile time.  This wrapper will speed up some of the operations
+like accessing individual pixels using the () operator.
+*/
+template<typename T, int C>
+class WImageC : public WImage<T>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+    enum { kChannels = C };
+
+    explicit WImageC(IplImage* img) : WImage<T>(img) {
+        assert(!img || img->nChannels == Channels());
+    }
+
+    // Construct a view into a region of this image
+    WImageViewC<T, C> View(int c, int r, int width, int height);
+
+    // Copy the contents from another image which is just a convenience to cvCopy
+    void CopyFrom(const WImageC<T, C>& src) {
+        cvCopy(src.Ipl(), WImage<T>::image_);
+    }
+
+    // WImageC is an abstract class with no other virtual methods so make the
+    // destructor virtual.
+    virtual ~WImageC() = 0;
+
+    int Channels() const {return C; }
+
+protected:
+    // Disallow copy and assignment
+    WImageC(const WImageC&);
+    void operator=(const WImageC&);
+
+    void SetIpl(IplImage* image) {
+        assert(!image || image->depth == WImage<T>::Depth());
+        WImage<T>::SetIpl(image);
+    }
+};
+
+/** Image class which owns the data, so it can be allocated and is always
+freed.  It cannot be copied but can be explicity cloned.
+*/
+template<typename T>
+class WImageBuffer : public WImage<T>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+
+    // Default constructor which creates an object that can be
+    WImageBuffer() : WImage<T>(0) {}
+
+    WImageBuffer(int width, int height, int nchannels) : WImage<T>(0) {
+        Allocate(width, height, nchannels);
+    }
+
+    // Constructor which takes ownership of a given IplImage so releases
+    // the image on destruction.
+    explicit WImageBuffer(IplImage* img) : WImage<T>(img) {}
+
+    // Allocate an image.  Does nothing if current size is the same as
+    // the new size.
+    void Allocate(int width, int height, int nchannels);
+
+    // Set the data to point to an image, releasing the old data
+    void SetIpl(IplImage* img) {
+        ReleaseImage();
+        WImage<T>::SetIpl(img);
+    }
+
+    // Clone an image which reallocates the image if of a different dimension.
+    void CloneFrom(const WImage<T>& src) {
+        Allocate(src.Width(), src.Height(), src.Channels());
+        CopyFrom(src);
+    }
+
+    ~WImageBuffer() {
+        ReleaseImage();
+    }
+
+    // Release the image if it isn't null.
+    void ReleaseImage() {
+        if (WImage<T>::image_) {
+            IplImage* image = WImage<T>::image_;
+            cvReleaseImage(&image);
+            WImage<T>::SetIpl(0);
+        }
+    }
+
+    bool IsNull() const {return WImage<T>::image_ == NULL; }
+
+private:
+    // Disallow copy and assignment
+    WImageBuffer(const WImageBuffer&);
+    void operator=(const WImageBuffer&);
+};
+
+/** Like a WImageBuffer class but when the number of channels is known at compile time.
+*/
+template<typename T, int C>
+class WImageBufferC : public WImageC<T, C>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+    enum { kChannels = C };
+
+    // Default constructor which creates an object that can be
+    WImageBufferC() : WImageC<T, C>(0) {}
+
+    WImageBufferC(int width, int height) : WImageC<T, C>(0) {
+        Allocate(width, height);
+    }
+
+    // Constructor which takes ownership of a given IplImage so releases
+    // the image on destruction.
+    explicit WImageBufferC(IplImage* img) : WImageC<T, C>(img) {}
+
+    // Allocate an image.  Does nothing if current size is the same as
+    // the new size.
+    void Allocate(int width, int height);
+
+    // Set the data to point to an image, releasing the old data
+    void SetIpl(IplImage* img) {
+        ReleaseImage();
+        WImageC<T, C>::SetIpl(img);
+    }
+
+    // Clone an image which reallocates the image if of a different dimension.
+    void CloneFrom(const WImageC<T, C>& src) {
+        Allocate(src.Width(), src.Height());
+        CopyFrom(src);
+    }
+
+    ~WImageBufferC() {
+        ReleaseImage();
+    }
+
+    // Release the image if it isn't null.
+    void ReleaseImage() {
+        if (WImage<T>::image_) {
+            IplImage* image = WImage<T>::image_;
+            cvReleaseImage(&image);
+            WImageC<T, C>::SetIpl(0);
+        }
+    }
+
+    bool IsNull() const {return WImage<T>::image_ == NULL; }
+
+private:
+    // Disallow copy and assignment
+    WImageBufferC(const WImageBufferC&);
+    void operator=(const WImageBufferC&);
+};
+
+/** View into an image class which allows treating a subimage as an image or treating external data
+as an image
+*/
+template<typename T> class WImageView : public WImage<T>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+
+    // Construct a subimage.  No checks are done that the subimage lies
+    // completely inside the original image.
+    WImageView(WImage<T>* img, int c, int r, int width, int height);
+
+    // Refer to external data.
+    // If not given width_step assumed to be same as width.
+    WImageView(T* data, int width, int height, int channels, int width_step = -1);
+
+    // Refer to external data.  This does NOT take ownership
+    // of the supplied IplImage.
+    WImageView(IplImage* img) : WImage<T>(img) {}
+
+    // Copy constructor
+    WImageView(const WImage<T>& img) : WImage<T>(0) {
+        header_ = *(img.Ipl());
+        WImage<T>::SetIpl(&header_);
+    }
+
+    WImageView& operator=(const WImage<T>& img) {
+        header_ = *(img.Ipl());
+        WImage<T>::SetIpl(&header_);
+        return *this;
+    }
+
+protected:
+    IplImage header_;
+};
+
+
+template<typename T, int C>
+class WImageViewC : public WImageC<T, C>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+    enum { kChannels = C };
+
+    // Default constructor needed for vectors of views.
+    WImageViewC();
+
+    virtual ~WImageViewC() {}
+
+    // Construct a subimage.  No checks are done that the subimage lies
+    // completely inside the original image.
+    WImageViewC(WImageC<T, C>* img,
+        int c, int r, int width, int height);
+
+    // Refer to external data
+    WImageViewC(T* data, int width, int height, int width_step = -1);
+
+    // Refer to external data.  This does NOT take ownership
+    // of the supplied IplImage.
+    WImageViewC(IplImage* img) : WImageC<T, C>(img) {}
+
+    // Copy constructor which does a shallow copy to allow multiple views
+    // of same data.  gcc-4.1.1 gets confused if both versions of
+    // the constructor and assignment operator are not provided.
+    WImageViewC(const WImageC<T, C>& img) : WImageC<T, C>(0) {
+        header_ = *(img.Ipl());
+        WImageC<T, C>::SetIpl(&header_);
+    }
+    WImageViewC(const WImageViewC<T, C>& img) : WImageC<T, C>(0) {
+        header_ = *(img.Ipl());
+        WImageC<T, C>::SetIpl(&header_);
+    }
+
+    WImageViewC& operator=(const WImageC<T, C>& img) {
+        header_ = *(img.Ipl());
+        WImageC<T, C>::SetIpl(&header_);
+        return *this;
+    }
+    WImageViewC& operator=(const WImageViewC<T, C>& img) {
+        header_ = *(img.Ipl());
+        WImageC<T, C>::SetIpl(&header_);
+        return *this;
+    }
+
+protected:
+    IplImage header_;
+};
+
+
+// Specializations for depth
+template<>
+inline int WImage<uchar>::Depth() const {return IPL_DEPTH_8U; }
+template<>
+inline int WImage<signed char>::Depth() const {return IPL_DEPTH_8S; }
+template<>
+inline int WImage<short>::Depth() const {return IPL_DEPTH_16S; }
+template<>
+inline int WImage<ushort>::Depth() const {return IPL_DEPTH_16U; }
+template<>
+inline int WImage<int>::Depth() const {return IPL_DEPTH_32S; }
+template<>
+inline int WImage<float>::Depth() const {return IPL_DEPTH_32F; }
+template<>
+inline int WImage<double>::Depth() const {return IPL_DEPTH_64F; }
+
+template<typename T> inline WImage<T>::~WImage() {}
+template<typename T, int C> inline WImageC<T, C>::~WImageC() {}
+
+template<typename T>
+inline void WImageBuffer<T>::Allocate(int width, int height, int nchannels)
+{
+    if (IsNull() || WImage<T>::Width() != width ||
+        WImage<T>::Height() != height || WImage<T>::Channels() != nchannels) {
+        ReleaseImage();
+        WImage<T>::image_ = cvCreateImage(cvSize(width, height),
+            WImage<T>::Depth(), nchannels);
+    }
+}
+
+template<typename T, int C>
+inline void WImageBufferC<T, C>::Allocate(int width, int height)
+{
+    if (IsNull() || WImage<T>::Width() != width || WImage<T>::Height() != height) {
+        ReleaseImage();
+        WImageC<T, C>::SetIpl(cvCreateImage(cvSize(width, height),WImage<T>::Depth(), C));
+    }
+}
+
+template<typename T>
+WImageView<T>::WImageView(WImage<T>* img, int c, int r, int width, int height)
+        : WImage<T>(0)
+{
+    header_ = *(img->Ipl());
+    header_.imageData = reinterpret_cast<char*>((*img)(c, r));
+    header_.width = width;
+    header_.height = height;
+    WImage<T>::SetIpl(&header_);
+}
+
+template<typename T>
+WImageView<T>::WImageView(T* data, int width, int height, int nchannels, int width_step)
+          : WImage<T>(0)
+{
+    cvInitImageHeader(&header_, cvSize(width, height), WImage<T>::Depth(), nchannels);
+    header_.imageData = reinterpret_cast<char*>(data);
+    if (width_step > 0) {
+        header_.widthStep = width_step;
+    }
+    WImage<T>::SetIpl(&header_);
+}
+
+template<typename T, int C>
+WImageViewC<T, C>::WImageViewC(WImageC<T, C>* img, int c, int r, int width, int height)
+        : WImageC<T, C>(0)
+{
+    header_ = *(img->Ipl());
+    header_.imageData = reinterpret_cast<char*>((*img)(c, r));
+    header_.width = width;
+    header_.height = height;
+    WImageC<T, C>::SetIpl(&header_);
+}
+
+template<typename T, int C>
+WImageViewC<T, C>::WImageViewC() : WImageC<T, C>(0) {
+    cvInitImageHeader(&header_, cvSize(0, 0), WImage<T>::Depth(), C);
+    header_.imageData = reinterpret_cast<char*>(0);
+    WImageC<T, C>::SetIpl(&header_);
+}
+
+template<typename T, int C>
+WImageViewC<T, C>::WImageViewC(T* data, int width, int height, int width_step)
+    : WImageC<T, C>(0)
+{
+    cvInitImageHeader(&header_, cvSize(width, height), WImage<T>::Depth(), C);
+    header_.imageData = reinterpret_cast<char*>(data);
+    if (width_step > 0) {
+        header_.widthStep = width_step;
+    }
+    WImageC<T, C>::SetIpl(&header_);
+}
+
+// Construct a view into a region of an image
+template<typename T>
+WImageView<T> WImage<T>::View(int c, int r, int width, int height) {
+    return WImageView<T>(this, c, r, width, height);
+}
+
+template<typename T, int C>
+WImageViewC<T, C> WImageC<T, C>::View(int c, int r, int width, int height) {
+    return WImageViewC<T, C>(this, c, r, width, height);
+}
+
+//! @} core
+
+}  // end of namespace
+
+#endif // __cplusplus
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/cvconfig.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/cvconfig.h
new file mode 100644
index 0000000..da75317
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/cvconfig.h
@@ -0,0 +1,196 @@
+/* OpenCV compiled as static or dynamic libs */
+#define BUILD_SHARED_LIBS
+
+/* Compile for 'real' NVIDIA GPU architectures */
+#define CUDA_ARCH_BIN ""
+
+/* Create PTX or BIN for 1.0 compute capability */
+/* #undef CUDA_ARCH_BIN_OR_PTX_10 */
+
+/* NVIDIA GPU features are used */
+#define CUDA_ARCH_FEATURES ""
+
+/* Compile for 'virtual' NVIDIA PTX architectures */
+#define CUDA_ARCH_PTX ""
+
+/* AVFoundation video libraries */
+/* #undef HAVE_AVFOUNDATION */
+
+/* V4L capturing support */
+/* #undef HAVE_CAMV4L */
+
+/* V4L2 capturing support */
+/* #undef HAVE_CAMV4L2 */
+
+/* Carbon windowing environment */
+/* #undef HAVE_CARBON */
+
+/* AMD's Basic Linear Algebra Subprograms Library*/
+#define HAVE_CLAMDBLAS
+
+/* AMD's OpenCL Fast Fourier Transform Library*/
+#define HAVE_CLAMDFFT
+
+/* Clp support */
+/* #undef HAVE_CLP */
+
+/* Cocoa API */
+/* #undef HAVE_COCOA */
+
+/* C= */
+/* #undef HAVE_CSTRIPES */
+
+/* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/
+/* #undef HAVE_CUBLAS */
+
+/* NVidia Cuda Runtime API*/
+/* #undef HAVE_CUDA */
+
+/* NVidia Cuda Fast Fourier Transform (FFT) API*/
+/* #undef HAVE_CUFFT */
+
+/* IEEE1394 capturing support */
+/* #undef HAVE_DC1394 */
+
+/* IEEE1394 capturing support - libdc1394 v2.x */
+/* #undef HAVE_DC1394_2 */
+
+/* DirectX */
+#define HAVE_DIRECTX
+#define HAVE_DIRECTX_NV12
+#define HAVE_D3D11
+#define HAVE_D3D10
+#define HAVE_D3D9
+
+/* DirectShow Video Capture library */
+#define HAVE_DSHOW
+
+/* Eigen Matrix & Linear Algebra Library */
+/* #undef HAVE_EIGEN */
+
+/* FFMpeg video library */
+#define HAVE_FFMPEG
+
+/* ffmpeg's libswscale */
+#define HAVE_FFMPEG_SWSCALE
+
+/* ffmpeg in Gentoo */
+#define HAVE_GENTOO_FFMPEG
+
+/* Geospatial Data Abstraction Library */
+/* #undef HAVE_GDAL */
+
+/* GStreamer multimedia framework */
+/* #undef HAVE_GSTREAMER */
+
+/* GTK+ 2.0 Thread support */
+/* #undef HAVE_GTHREAD */
+
+/* GTK+ 2.x toolkit */
+/* #undef HAVE_GTK */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Intel Perceptual Computing SDK library */
+/* #undef HAVE_INTELPERC */
+
+/* Intel Integrated Performance Primitives */
+#define HAVE_IPP
+#define HAVE_IPP_ICV_ONLY
+
+/* Intel IPP Async */
+/* #undef HAVE_IPP_A */
+
+/* JPEG-2000 codec */
+#define HAVE_JASPER
+
+/* IJG JPEG codec */
+#define HAVE_JPEG
+
+/* libpng/png.h needs to be included */
+/* #undef HAVE_LIBPNG_PNG_H */
+
+/* V4L/V4L2 capturing support via libv4l */
+/* #undef HAVE_LIBV4L */
+
+/* Microsoft Media Foundation Capture library */
+/* #undef HAVE_MSMF */
+
+/* NVidia Video Decoding API*/
+/* #undef HAVE_NVCUVID */
+
+/* OpenCL Support */
+#define HAVE_OPENCL
+/* #undef HAVE_OPENCL_STATIC */
+/* #undef HAVE_OPENCL_SVM */
+
+/* OpenEXR codec */
+#define HAVE_OPENEXR
+
+/* OpenGL support*/
+/* #undef HAVE_OPENGL */
+
+/* OpenNI library */
+/* #undef HAVE_OPENNI */
+
+/* OpenNI library */
+/* #undef HAVE_OPENNI2 */
+
+/* PNG codec */
+#define HAVE_PNG
+
+/* Posix threads (pthreads) */
+/* #undef HAVE_PTHREADS */
+
+/* parallel_for with pthreads */
+/* #undef HAVE_PTHREADS_PF */
+
+/* Qt support */
+/* #undef HAVE_QT */
+
+/* Qt OpenGL support */
+/* #undef HAVE_QT_OPENGL */
+
+/* QuickTime video libraries */
+/* #undef HAVE_QUICKTIME */
+
+/* QTKit video libraries */
+/* #undef HAVE_QTKIT */
+
+/* Intel Threading Building Blocks */
+/* #undef HAVE_TBB */
+
+/* TIFF codec */
+#define HAVE_TIFF
+
+/* Unicap video capture library */
+/* #undef HAVE_UNICAP */
+
+/* Video for Windows support */
+#define HAVE_VFW
+
+/* V4L2 capturing support in videoio.h */
+/* #undef HAVE_VIDEOIO */
+
+/* Win32 UI */
+#define HAVE_WIN32UI
+
+/* XIMEA camera support */
+/* #undef HAVE_XIMEA */
+
+/* Xine video library */
+/* #undef HAVE_XINE */
+
+/* Define if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* gPhoto2 library */
+/* #undef HAVE_GPHOTO2 */
+
+/* VA library (libva) */
+/* #undef HAVE_VA */
+
+/* Intel VA-API/OpenCL */
+/* #undef HAVE_VA_INTEL */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d.hpp
new file mode 100644
index 0000000..692d3d9
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d.hpp
@@ -0,0 +1,1325 @@
+/*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*/
+
+#ifndef __OPENCV_FEATURES_2D_HPP__
+#define __OPENCV_FEATURES_2D_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/flann/miniflann.hpp"
+
+/**
+  @defgroup features2d 2D Features Framework
+  @{
+    @defgroup features2d_main Feature Detection and Description
+    @defgroup features2d_match Descriptor Matchers
+
+Matchers of keypoint descriptors in OpenCV have wrappers with a common interface that enables you to
+easily switch between different algorithms solving the same problem. This section is devoted to
+matching descriptors that are represented as vectors in a multidimensional space. All objects that
+implement vector descriptor matchers inherit the DescriptorMatcher interface.
+
+@note
+   -   An example explaining keypoint matching can be found at
+        opencv_source_code/samples/cpp/descriptor_extractor_matcher.cpp
+    -   An example on descriptor matching evaluation can be found at
+        opencv_source_code/samples/cpp/detector_descriptor_matcher_evaluation.cpp
+    -   An example on one to many image matching can be found at
+        opencv_source_code/samples/cpp/matching_to_many_images.cpp
+
+    @defgroup features2d_draw Drawing Function of Keypoints and Matches
+    @defgroup features2d_category Object Categorization
+
+This section describes approaches based on local 2D features and used to categorize objects.
+
+@note
+   -   A complete Bag-Of-Words sample can be found at
+        opencv_source_code/samples/cpp/bagofwords_classification.cpp
+    -   (Python) An example using the features2D framework to perform object categorization can be
+        found at opencv_source_code/samples/python/find_obj.py
+
+  @}
+ */
+
+namespace cv
+{
+
+//! @addtogroup features2d
+//! @{
+
+// //! writes vector of keypoints to the file storage
+// CV_EXPORTS void write(FileStorage& fs, const String& name, const std::vector<KeyPoint>& keypoints);
+// //! reads vector of keypoints from the specified file storage node
+// CV_EXPORTS void read(const FileNode& node, CV_OUT std::vector<KeyPoint>& keypoints);
+
+/** @brief A class filters a vector of keypoints.
+
+ Because now it is difficult to provide a convenient interface for all usage scenarios of the
+ keypoints filter class, it has only several needed by now static methods.
+ */
+class CV_EXPORTS KeyPointsFilter
+{
+public:
+    KeyPointsFilter(){}
+
+    /*
+     * Remove keypoints within borderPixels of an image edge.
+     */
+    static void runByImageBorder( std::vector<KeyPoint>& keypoints, Size imageSize, int borderSize );
+    /*
+     * Remove keypoints of sizes out of range.
+     */
+    static void runByKeypointSize( std::vector<KeyPoint>& keypoints, float minSize,
+                                   float maxSize=FLT_MAX );
+    /*
+     * Remove keypoints from some image by mask for pixels of this image.
+     */
+    static void runByPixelsMask( std::vector<KeyPoint>& keypoints, const Mat& mask );
+    /*
+     * Remove duplicated keypoints.
+     */
+    static void removeDuplicated( std::vector<KeyPoint>& keypoints );
+
+    /*
+     * Retain the specified number of the best keypoints (according to the response)
+     */
+    static void retainBest( std::vector<KeyPoint>& keypoints, int npoints );
+};
+
+
+/************************************ Base Classes ************************************/
+
+/** @brief Abstract base class for 2D image feature detectors and descriptor extractors
+*/
+class CV_EXPORTS_W Feature2D : public virtual Algorithm
+{
+public:
+    virtual ~Feature2D();
+
+    /** @brief Detects keypoints in an image (first variant) or image set (second variant).
+
+    @param image Image.
+    @param keypoints The detected keypoints. In the second variant of the method keypoints[i] is a set
+    of keypoints detected in images[i] .
+    @param mask Mask specifying where to look for keypoints (optional). It must be a 8-bit integer
+    matrix with non-zero values in the region of interest.
+     */
+    CV_WRAP virtual void detect( InputArray image,
+                                 CV_OUT std::vector<KeyPoint>& keypoints,
+                                 InputArray mask=noArray() );
+
+    /** @overload
+    @param images Image set.
+    @param keypoints The detected keypoints. In the second variant of the method keypoints[i] is a set
+    of keypoints detected in images[i] .
+    @param masks Masks for each input image specifying where to look for keypoints (optional).
+    masks[i] is a mask for images[i].
+    */
+    virtual void detect( InputArrayOfArrays images,
+                         std::vector<std::vector<KeyPoint> >& keypoints,
+                         InputArrayOfArrays masks=noArray() );
+
+    /** @brief Computes the descriptors for a set of keypoints detected in an image (first variant) or image set
+    (second variant).
+
+    @param image Image.
+    @param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be
+    computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint
+    with several dominant orientations (for each orientation).
+    @param descriptors Computed descriptors. In the second variant of the method descriptors[i] are
+    descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the
+    descriptor for keypoint j-th keypoint.
+     */
+    CV_WRAP virtual void compute( InputArray image,
+                                  CV_OUT CV_IN_OUT std::vector<KeyPoint>& keypoints,
+                                  OutputArray descriptors );
+
+    /** @overload
+
+    @param images Image set.
+    @param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be
+    computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint
+    with several dominant orientations (for each orientation).
+    @param descriptors Computed descriptors. In the second variant of the method descriptors[i] are
+    descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the
+    descriptor for keypoint j-th keypoint.
+    */
+    virtual void compute( InputArrayOfArrays images,
+                          std::vector<std::vector<KeyPoint> >& keypoints,
+                          OutputArrayOfArrays descriptors );
+
+    /** Detects keypoints and computes the descriptors */
+    CV_WRAP virtual void detectAndCompute( InputArray image, InputArray mask,
+                                           CV_OUT std::vector<KeyPoint>& keypoints,
+                                           OutputArray descriptors,
+                                           bool useProvidedKeypoints=false );
+
+    CV_WRAP virtual int descriptorSize() const;
+    CV_WRAP virtual int descriptorType() const;
+    CV_WRAP virtual int defaultNorm() const;
+
+    //! Return true if detector object is empty
+    CV_WRAP virtual bool empty() const;
+};
+
+/** Feature detectors in OpenCV have wrappers with a common interface that enables you to easily switch
+between different algorithms solving the same problem. All objects that implement keypoint detectors
+inherit the FeatureDetector interface. */
+typedef Feature2D FeatureDetector;
+
+/** Extractors of keypoint descriptors in OpenCV have wrappers with a common interface that enables you
+to easily switch between different algorithms solving the same problem. This section is devoted to
+computing descriptors represented as vectors in a multidimensional space. All objects that implement
+the vector descriptor extractors inherit the DescriptorExtractor interface.
+ */
+typedef Feature2D DescriptorExtractor;
+
+//! @addtogroup features2d_main
+//! @{
+
+/** @brief Class implementing the BRISK keypoint detector and descriptor extractor, described in @cite LCS11 .
+ */
+class CV_EXPORTS_W BRISK : public Feature2D
+{
+public:
+    /** @brief The BRISK constructor
+
+    @param thresh AGAST detection threshold score.
+    @param octaves detection octaves. Use 0 to do single scale.
+    @param patternScale apply this scale to the pattern used for sampling the neighbourhood of a
+    keypoint.
+     */
+    CV_WRAP static Ptr<BRISK> create(int thresh=30, int octaves=3, float patternScale=1.0f);
+
+    /** @brief The BRISK constructor for a custom pattern
+
+    @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+    keypoint scale 1).
+    @param numberList defines the number of sampling points on the sampling circle. Must be the same
+    size as radiusList..
+    @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
+    scale 1).
+    @param dMin threshold for the long pairings used for orientation determination (in pixels for
+    keypoint scale 1).
+    @param indexChange index remapping of the bits. */
+    CV_WRAP static Ptr<BRISK> create(const std::vector<float> &radiusList, const std::vector<int> &numberList,
+        float dMax=5.85f, float dMin=8.2f, const std::vector<int>& indexChange=std::vector<int>());
+};
+
+/** @brief Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor
+
+described in @cite RRKB11 . The algorithm uses FAST in pyramids to detect stable keypoints, selects
+the strongest features using FAST or Harris response, finds their orientation using first-order
+moments and computes the descriptors using BRIEF (where the coordinates of random point pairs (or
+k-tuples) are rotated according to the measured orientation).
+ */
+class CV_EXPORTS_W ORB : public Feature2D
+{
+public:
+    enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };
+
+    /** @brief The ORB constructor
+
+    @param nfeatures The maximum number of features to retain.
+    @param scaleFactor Pyramid decimation ratio, greater than 1. scaleFactor==2 means the classical
+    pyramid, where each next level has 4x less pixels than the previous, but such a big scale factor
+    will degrade feature matching scores dramatically. On the other hand, too close to 1 scale factor
+    will mean that to cover certain scale range you will need more pyramid levels and so the speed
+    will suffer.
+    @param nlevels The number of pyramid levels. The smallest level will have linear size equal to
+    input_image_linear_size/pow(scaleFactor, nlevels).
+    @param edgeThreshold This is size of the border where the features are not detected. It should
+    roughly match the patchSize parameter.
+    @param firstLevel It should be 0 in the current implementation.
+    @param WTA_K The number of points that produce each element of the oriented BRIEF descriptor. The
+    default value 2 means the BRIEF where we take a random point pair and compare their brightnesses,
+    so we get 0/1 response. Other possible values are 3 and 4. For example, 3 means that we take 3
+    random points (of course, those point coordinates are random, but they are generated from the
+    pre-defined seed, so each element of BRIEF descriptor is computed deterministically from the pixel
+    rectangle), find point of maximum brightness and output index of the winner (0, 1 or 2). Such
+    output will occupy 2 bits, and therefore it will need a special variant of Hamming distance,
+    denoted as NORM_HAMMING2 (2 bits per bin). When WTA_K=4, we take 4 random points to compute each
+    bin (that will also occupy 2 bits with possible values 0, 1, 2 or 3).
+    @param scoreType The default HARRIS_SCORE means that Harris algorithm is used to rank features
+    (the score is written to KeyPoint::score and is used to retain best nfeatures features);
+    FAST_SCORE is alternative value of the parameter that produces slightly less stable keypoints,
+    but it is a little faster to compute.
+    @param patchSize size of the patch used by the oriented BRIEF descriptor. Of course, on smaller
+    pyramid layers the perceived image area covered by a feature will be larger.
+    @param fastThreshold
+     */
+    CV_WRAP static Ptr<ORB> create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31,
+        int firstLevel=0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20);
+
+    CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
+    CV_WRAP virtual int getMaxFeatures() const = 0;
+
+    CV_WRAP virtual void setScaleFactor(double scaleFactor) = 0;
+    CV_WRAP virtual double getScaleFactor() const = 0;
+
+    CV_WRAP virtual void setNLevels(int nlevels) = 0;
+    CV_WRAP virtual int getNLevels() const = 0;
+
+    CV_WRAP virtual void setEdgeThreshold(int edgeThreshold) = 0;
+    CV_WRAP virtual int getEdgeThreshold() const = 0;
+
+    CV_WRAP virtual void setFirstLevel(int firstLevel) = 0;
+    CV_WRAP virtual int getFirstLevel() const = 0;
+
+    CV_WRAP virtual void setWTA_K(int wta_k) = 0;
+    CV_WRAP virtual int getWTA_K() const = 0;
+
+    CV_WRAP virtual void setScoreType(int scoreType) = 0;
+    CV_WRAP virtual int getScoreType() const = 0;
+
+    CV_WRAP virtual void setPatchSize(int patchSize) = 0;
+    CV_WRAP virtual int getPatchSize() const = 0;
+
+    CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0;
+    CV_WRAP virtual int getFastThreshold() const = 0;
+};
+
+/** @brief Maximally stable extremal region extractor
+
+The class encapsulates all the parameters of the %MSER extraction algorithm (see [wiki
+article](http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions)).
+
+- there are two different implementation of %MSER: one for grey image, one for color image
+
+- the grey image algorithm is taken from: @cite nister2008linear ;  the paper claims to be faster
+than union-find method; it actually get 1.5~2m/s on my centrino L7200 1.2GHz laptop.
+
+- the color image algorithm is taken from: @cite forssen2007maximally ; it should be much slower
+than grey image method ( 3~4 times ); the chi_table.h file is taken directly from paper's source
+code which is distributed under GPL.
+
+- (Python) A complete example showing the use of the %MSER detector can be found at samples/python/mser.py
+*/
+class CV_EXPORTS_W MSER : public Feature2D
+{
+public:
+    /** @brief Full consturctor for %MSER detector
+
+    @param _delta it compares \f$(size_{i}-size_{i-delta})/size_{i-delta}\f$
+    @param _min_area prune the area which smaller than minArea
+    @param _max_area prune the area which bigger than maxArea
+    @param _max_variation prune the area have simliar size to its children
+    @param _min_diversity for color image, trace back to cut off mser with diversity less than min_diversity
+    @param _max_evolution  for color image, the evolution steps
+    @param _area_threshold for color image, the area threshold to cause re-initialize
+    @param _min_margin for color image, ignore too small margin
+    @param _edge_blur_size for color image, the aperture size for edge blur
+     */
+    CV_WRAP static Ptr<MSER> create( int _delta=5, int _min_area=60, int _max_area=14400,
+          double _max_variation=0.25, double _min_diversity=.2,
+          int _max_evolution=200, double _area_threshold=1.01,
+          double _min_margin=0.003, int _edge_blur_size=5 );
+
+    /** @brief Detect %MSER regions
+
+    @param image input image (8UC1, 8UC3 or 8UC4)
+    @param msers resulting list of point sets
+    @param bboxes resulting bounding boxes
+    */
+    CV_WRAP virtual void detectRegions( InputArray image,
+                                        CV_OUT std::vector<std::vector<Point> >& msers,
+                                        std::vector<Rect>& bboxes ) = 0;
+
+    CV_WRAP virtual void setDelta(int delta) = 0;
+    CV_WRAP virtual int getDelta() const = 0;
+
+    CV_WRAP virtual void setMinArea(int minArea) = 0;
+    CV_WRAP virtual int getMinArea() const = 0;
+
+    CV_WRAP virtual void setMaxArea(int maxArea) = 0;
+    CV_WRAP virtual int getMaxArea() const = 0;
+
+    CV_WRAP virtual void setPass2Only(bool f) = 0;
+    CV_WRAP virtual bool getPass2Only() const = 0;
+};
+
+/** @overload */
+CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
+                      int threshold, bool nonmaxSuppression=true );
+
+/** @brief Detects corners using the FAST algorithm
+
+@param image grayscale image where keypoints (corners) are detected.
+@param keypoints keypoints detected on the image.
+@param threshold threshold on difference between intensity of the central pixel and pixels of a
+circle around this pixel.
+@param nonmaxSuppression if true, non-maximum suppression is applied to detected corners
+(keypoints).
+@param type one of the three neighborhoods as defined in the paper:
+FastFeatureDetector::TYPE_9_16, FastFeatureDetector::TYPE_7_12,
+FastFeatureDetector::TYPE_5_8
+
+Detects corners using the FAST algorithm by @cite Rosten06 .
+
+@note In Python API, types are given as cv2.FAST_FEATURE_DETECTOR_TYPE_5_8,
+cv2.FAST_FEATURE_DETECTOR_TYPE_7_12 and cv2.FAST_FEATURE_DETECTOR_TYPE_9_16. For corner
+detection, use cv2.FAST.detect() method.
+ */
+CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
+                      int threshold, bool nonmaxSuppression, int type );
+
+//! @} features2d_main
+
+//! @addtogroup features2d_main
+//! @{
+
+/** @brief Wrapping class for feature detection using the FAST method. :
+ */
+class CV_EXPORTS_W FastFeatureDetector : public Feature2D
+{
+public:
+    enum
+    {
+        TYPE_5_8 = 0, TYPE_7_12 = 1, TYPE_9_16 = 2,
+        THRESHOLD = 10000, NONMAX_SUPPRESSION=10001, FAST_N=10002,
+    };
+
+    CV_WRAP static Ptr<FastFeatureDetector> create( int threshold=10,
+                                                    bool nonmaxSuppression=true,
+                                                    int type=FastFeatureDetector::TYPE_9_16 );
+
+    CV_WRAP virtual void setThreshold(int threshold) = 0;
+    CV_WRAP virtual int getThreshold() const = 0;
+
+    CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
+    CV_WRAP virtual bool getNonmaxSuppression() const = 0;
+
+    CV_WRAP virtual void setType(int type) = 0;
+    CV_WRAP virtual int getType() const = 0;
+};
+
+/** @overload */
+CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
+                      int threshold, bool nonmaxSuppression=true );
+
+/** @brief Detects corners using the AGAST algorithm
+
+@param image grayscale image where keypoints (corners) are detected.
+@param keypoints keypoints detected on the image.
+@param threshold threshold on difference between intensity of the central pixel and pixels of a
+circle around this pixel.
+@param nonmaxSuppression if true, non-maximum suppression is applied to detected corners
+(keypoints).
+@param type one of the four neighborhoods as defined in the paper:
+AgastFeatureDetector::AGAST_5_8, AgastFeatureDetector::AGAST_7_12d,
+AgastFeatureDetector::AGAST_7_12s, AgastFeatureDetector::OAST_9_16
+
+For non-Intel platforms, there is a tree optimised variant of AGAST with same numerical results.
+The 32-bit binary tree tables were generated automatically from original code using perl script.
+The perl script and examples of tree generation are placed in features2d/doc folder.
+Detects corners using the AGAST algorithm by @cite mair2010_agast .
+
+ */
+CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
+                      int threshold, bool nonmaxSuppression, int type );
+//! @} features2d_main
+
+//! @addtogroup features2d_main
+//! @{
+
+/** @brief Wrapping class for feature detection using the AGAST method. :
+ */
+class CV_EXPORTS_W AgastFeatureDetector : public Feature2D
+{
+public:
+    enum
+    {
+        AGAST_5_8 = 0, AGAST_7_12d = 1, AGAST_7_12s = 2, OAST_9_16 = 3,
+        THRESHOLD = 10000, NONMAX_SUPPRESSION = 10001,
+    };
+
+    CV_WRAP static Ptr<AgastFeatureDetector> create( int threshold=10,
+                                                     bool nonmaxSuppression=true,
+                                                     int type=AgastFeatureDetector::OAST_9_16 );
+
+    CV_WRAP virtual void setThreshold(int threshold) = 0;
+    CV_WRAP virtual int getThreshold() const = 0;
+
+    CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
+    CV_WRAP virtual bool getNonmaxSuppression() const = 0;
+
+    CV_WRAP virtual void setType(int type) = 0;
+    CV_WRAP virtual int getType() const = 0;
+};
+
+/** @brief Wrapping class for feature detection using the goodFeaturesToTrack function. :
+ */
+class CV_EXPORTS_W GFTTDetector : public Feature2D
+{
+public:
+    CV_WRAP static Ptr<GFTTDetector> create( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
+                                             int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
+    CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
+    CV_WRAP virtual int getMaxFeatures() const = 0;
+
+    CV_WRAP virtual void setQualityLevel(double qlevel) = 0;
+    CV_WRAP virtual double getQualityLevel() const = 0;
+
+    CV_WRAP virtual void setMinDistance(double minDistance) = 0;
+    CV_WRAP virtual double getMinDistance() const = 0;
+
+    CV_WRAP virtual void setBlockSize(int blockSize) = 0;
+    CV_WRAP virtual int getBlockSize() const = 0;
+
+    CV_WRAP virtual void setHarrisDetector(bool val) = 0;
+    CV_WRAP virtual bool getHarrisDetector() const = 0;
+
+    CV_WRAP virtual void setK(double k) = 0;
+    CV_WRAP virtual double getK() const = 0;
+};
+
+/** @brief Class for extracting blobs from an image. :
+
+The class implements a simple algorithm for extracting blobs from an image:
+
+1.  Convert the source image to binary images by applying thresholding with several thresholds from
+    minThreshold (inclusive) to maxThreshold (exclusive) with distance thresholdStep between
+    neighboring thresholds.
+2.  Extract connected components from every binary image by findContours and calculate their
+    centers.
+3.  Group centers from several binary images by their coordinates. Close centers form one group that
+    corresponds to one blob, which is controlled by the minDistBetweenBlobs parameter.
+4.  From the groups, estimate final centers of blobs and their radiuses and return as locations and
+    sizes of keypoints.
+
+This class performs several filtrations of returned blobs. You should set filterBy\* to true/false
+to turn on/off corresponding filtration. Available filtrations:
+
+-   **By color**. This filter compares the intensity of a binary image at the center of a blob to
+blobColor. If they differ, the blob is filtered out. Use blobColor = 0 to extract dark blobs
+and blobColor = 255 to extract light blobs.
+-   **By area**. Extracted blobs have an area between minArea (inclusive) and maxArea (exclusive).
+-   **By circularity**. Extracted blobs have circularity
+(\f$\frac{4*\pi*Area}{perimeter * perimeter}\f$) between minCircularity (inclusive) and
+maxCircularity (exclusive).
+-   **By ratio of the minimum inertia to maximum inertia**. Extracted blobs have this ratio
+between minInertiaRatio (inclusive) and maxInertiaRatio (exclusive).
+-   **By convexity**. Extracted blobs have convexity (area / area of blob convex hull) between
+minConvexity (inclusive) and maxConvexity (exclusive).
+
+Default values of parameters are tuned to extract dark circular blobs.
+ */
+class CV_EXPORTS_W SimpleBlobDetector : public Feature2D
+{
+public:
+  struct CV_EXPORTS_W_SIMPLE Params
+  {
+      CV_WRAP Params();
+      CV_PROP_RW float thresholdStep;
+      CV_PROP_RW float minThreshold;
+      CV_PROP_RW float maxThreshold;
+      CV_PROP_RW size_t minRepeatability;
+      CV_PROP_RW float minDistBetweenBlobs;
+
+      CV_PROP_RW bool filterByColor;
+      CV_PROP_RW uchar blobColor;
+
+      CV_PROP_RW bool filterByArea;
+      CV_PROP_RW float minArea, maxArea;
+
+      CV_PROP_RW bool filterByCircularity;
+      CV_PROP_RW float minCircularity, maxCircularity;
+
+      CV_PROP_RW bool filterByInertia;
+      CV_PROP_RW float minInertiaRatio, maxInertiaRatio;
+
+      CV_PROP_RW bool filterByConvexity;
+      CV_PROP_RW float minConvexity, maxConvexity;
+
+      void read( const FileNode& fn );
+      void write( FileStorage& fs ) const;
+  };
+
+  CV_WRAP static Ptr<SimpleBlobDetector>
+    create(const SimpleBlobDetector::Params &parameters = SimpleBlobDetector::Params());
+};
+
+//! @} features2d_main
+
+//! @addtogroup features2d_main
+//! @{
+
+/** @brief Class implementing the KAZE keypoint detector and descriptor extractor, described in @cite ABD12 .
+
+@note AKAZE descriptor can only be used with KAZE or AKAZE keypoints .. [ABD12] KAZE Features. Pablo
+F. Alcantarilla, Adrien Bartoli and Andrew J. Davison. In European Conference on Computer Vision
+(ECCV), Fiorenze, Italy, October 2012.
+*/
+class CV_EXPORTS_W KAZE : public Feature2D
+{
+public:
+    enum
+    {
+        DIFF_PM_G1 = 0,
+        DIFF_PM_G2 = 1,
+        DIFF_WEICKERT = 2,
+        DIFF_CHARBONNIER = 3
+    };
+
+    /** @brief The KAZE constructor
+
+    @param extended Set to enable extraction of extended (128-byte) descriptor.
+    @param upright Set to enable use of upright descriptors (non rotation-invariant).
+    @param threshold Detector response threshold to accept point
+    @param nOctaves Maximum octave evolution of the image
+    @param nOctaveLayers Default number of sublevels per scale level
+    @param diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or
+    DIFF_CHARBONNIER
+     */
+    CV_WRAP static Ptr<KAZE> create(bool extended=false, bool upright=false,
+                                    float threshold = 0.001f,
+                                    int nOctaves = 4, int nOctaveLayers = 4,
+                                    int diffusivity = KAZE::DIFF_PM_G2);
+
+    CV_WRAP virtual void setExtended(bool extended) = 0;
+    CV_WRAP virtual bool getExtended() const = 0;
+
+    CV_WRAP virtual void setUpright(bool upright) = 0;
+    CV_WRAP virtual bool getUpright() const = 0;
+
+    CV_WRAP virtual void setThreshold(double threshold) = 0;
+    CV_WRAP virtual double getThreshold() const = 0;
+
+    CV_WRAP virtual void setNOctaves(int octaves) = 0;
+    CV_WRAP virtual int getNOctaves() const = 0;
+
+    CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
+    CV_WRAP virtual int getNOctaveLayers() const = 0;
+
+    CV_WRAP virtual void setDiffusivity(int diff) = 0;
+    CV_WRAP virtual int getDiffusivity() const = 0;
+};
+
+/** @brief Class implementing the AKAZE keypoint detector and descriptor extractor, described in @cite ANB13 . :
+
+@note AKAZE descriptors can only be used with KAZE or AKAZE keypoints. Try to avoid using *extract*
+and *detect* instead of *operator()* due to performance reasons. .. [ANB13] Fast Explicit Diffusion
+for Accelerated Features in Nonlinear Scale Spaces. Pablo F. Alcantarilla, Jes煤s Nuevo and Adrien
+Bartoli. In British Machine Vision Conference (BMVC), Bristol, UK, September 2013.
+ */
+class CV_EXPORTS_W AKAZE : public Feature2D
+{
+public:
+    // AKAZE descriptor type
+    enum
+    {
+        DESCRIPTOR_KAZE_UPRIGHT = 2, ///< Upright descriptors, not invariant to rotation
+        DESCRIPTOR_KAZE = 3,
+        DESCRIPTOR_MLDB_UPRIGHT = 4, ///< Upright descriptors, not invariant to rotation
+        DESCRIPTOR_MLDB = 5
+    };
+
+    /** @brief The AKAZE constructor
+
+    @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+    DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+    @param descriptor_size Size of the descriptor in bits. 0 -\> Full size
+    @param descriptor_channels Number of channels in the descriptor (1, 2, 3)
+    @param threshold Detector response threshold to accept point
+    @param nOctaves Maximum octave evolution of the image
+    @param nOctaveLayers Default number of sublevels per scale level
+    @param diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or
+    DIFF_CHARBONNIER
+     */
+    CV_WRAP static Ptr<AKAZE> create(int descriptor_type=AKAZE::DESCRIPTOR_MLDB,
+                                     int descriptor_size = 0, int descriptor_channels = 3,
+                                     float threshold = 0.001f, int nOctaves = 4,
+                                     int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2);
+
+    CV_WRAP virtual void setDescriptorType(int dtype) = 0;
+    CV_WRAP virtual int getDescriptorType() const = 0;
+
+    CV_WRAP virtual void setDescriptorSize(int dsize) = 0;
+    CV_WRAP virtual int getDescriptorSize() const = 0;
+
+    CV_WRAP virtual void setDescriptorChannels(int dch) = 0;
+    CV_WRAP virtual int getDescriptorChannels() const = 0;
+
+    CV_WRAP virtual void setThreshold(double threshold) = 0;
+    CV_WRAP virtual double getThreshold() const = 0;
+
+    CV_WRAP virtual void setNOctaves(int octaves) = 0;
+    CV_WRAP virtual int getNOctaves() const = 0;
+
+    CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
+    CV_WRAP virtual int getNOctaveLayers() const = 0;
+
+    CV_WRAP virtual void setDiffusivity(int diff) = 0;
+    CV_WRAP virtual int getDiffusivity() const = 0;
+};
+
+//! @} features2d_main
+
+/****************************************************************************************\
+*                                      Distance                                          *
+\****************************************************************************************/
+
+template<typename T>
+struct CV_EXPORTS Accumulator
+{
+    typedef T Type;
+};
+
+template<> struct Accumulator<unsigned char>  { typedef float Type; };
+template<> struct Accumulator<unsigned short> { typedef float Type; };
+template<> struct Accumulator<char>   { typedef float Type; };
+template<> struct Accumulator<short>  { typedef float Type; };
+
+/*
+ * Squared Euclidean distance functor
+ */
+template<class T>
+struct CV_EXPORTS SL2
+{
+    enum { normType = NORM_L2SQR };
+    typedef T ValueType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    ResultType operator()( const T* a, const T* b, int size ) const
+    {
+        return normL2Sqr<ValueType, ResultType>(a, b, size);
+    }
+};
+
+/*
+ * Euclidean distance functor
+ */
+template<class T>
+struct CV_EXPORTS L2
+{
+    enum { normType = NORM_L2 };
+    typedef T ValueType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    ResultType operator()( const T* a, const T* b, int size ) const
+    {
+        return (ResultType)std::sqrt((double)normL2Sqr<ValueType, ResultType>(a, b, size));
+    }
+};
+
+/*
+ * Manhattan distance (city block distance) functor
+ */
+template<class T>
+struct CV_EXPORTS L1
+{
+    enum { normType = NORM_L1 };
+    typedef T ValueType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    ResultType operator()( const T* a, const T* b, int size ) const
+    {
+        return normL1<ValueType, ResultType>(a, b, size);
+    }
+};
+
+/****************************************************************************************\
+*                                  DescriptorMatcher                                     *
+\****************************************************************************************/
+
+//! @addtogroup features2d_match
+//! @{
+
+/** @brief Abstract base class for matching keypoint descriptors.
+
+It has two groups of match methods: for matching descriptors of an image with another image or with
+an image set.
+ */
+class CV_EXPORTS_W DescriptorMatcher : public Algorithm
+{
+public:
+    virtual ~DescriptorMatcher();
+
+    /** @brief Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor
+    collection.
+
+    If the collection is not empty, the new descriptors are added to existing train descriptors.
+
+    @param descriptors Descriptors to add. Each descriptors[i] is a set of descriptors from the same
+    train image.
+     */
+    CV_WRAP virtual void add( InputArrayOfArrays descriptors );
+
+    /** @brief Returns a constant link to the train descriptor collection trainDescCollection .
+     */
+    CV_WRAP const std::vector<Mat>& getTrainDescriptors() const;
+
+    /** @brief Clears the train descriptor collections.
+     */
+    CV_WRAP virtual void clear();
+
+    /** @brief Returns true if there are no train descriptors in the both collections.
+     */
+    CV_WRAP virtual bool empty() const;
+
+    /** @brief Returns true if the descriptor matcher supports masking permissible matches.
+     */
+    CV_WRAP virtual bool isMaskSupported() const = 0;
+
+    /** @brief Trains a descriptor matcher
+
+    Trains a descriptor matcher (for example, the flann index). In all methods to match, the method
+    train() is run every time before matching. Some descriptor matchers (for example, BruteForceMatcher)
+    have an empty implementation of this method. Other matchers really train their inner structures (for
+    example, FlannBasedMatcher trains flann::Index ).
+     */
+    CV_WRAP virtual void train();
+
+    /** @brief Finds the best match for each descriptor from a query set.
+
+    @param queryDescriptors Query set of descriptors.
+    @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+    collection stored in the class object.
+    @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
+    descriptor. So, matches size may be smaller than the query descriptors count.
+    @param mask Mask specifying permissible matches between an input query and train matrices of
+    descriptors.
+
+    In the first variant of this method, the train descriptors are passed as an input argument. In the
+    second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is
+    used. Optional mask (or masks) can be passed to specify which query and training descriptors can be
+    matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if
+    mask.at\<uchar\>(i,j) is non-zero.
+     */
+    CV_WRAP void match( InputArray queryDescriptors, InputArray trainDescriptors,
+                CV_OUT std::vector<DMatch>& matches, InputArray mask=noArray() ) const;
+
+    /** @brief Finds the k best matches for each descriptor from a query set.
+
+    @param queryDescriptors Query set of descriptors.
+    @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+    collection stored in the class object.
+    @param mask Mask specifying permissible matches between an input query and train matrices of
+    descriptors.
+    @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+    @param k Count of best matches found per each query descriptor or less if a query descriptor has
+    less than k possible matches in total.
+    @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+    false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+    the matches vector does not contain matches for fully masked-out query descriptors.
+
+    These extended variants of DescriptorMatcher::match methods find several best matches for each query
+    descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match
+    for the details about query and train descriptors.
+     */
+    CV_WRAP void knnMatch( InputArray queryDescriptors, InputArray trainDescriptors,
+                   CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
+                   InputArray mask=noArray(), bool compactResult=false ) const;
+
+    /** @brief For each query descriptor, finds the training descriptors not farther than the specified distance.
+
+    @param queryDescriptors Query set of descriptors.
+    @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+    collection stored in the class object.
+    @param matches Found matches.
+    @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+    false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+    the matches vector does not contain matches for fully masked-out query descriptors.
+    @param maxDistance Threshold for the distance between matched descriptors. Distance means here
+    metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured
+    in Pixels)!
+    @param mask Mask specifying permissible matches between an input query and train matrices of
+    descriptors.
+
+    For each query descriptor, the methods find such training descriptors that the distance between the
+    query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are
+    returned in the distance increasing order.
+     */
+    void radiusMatch( InputArray queryDescriptors, InputArray trainDescriptors,
+                      std::vector<std::vector<DMatch> >& matches, float maxDistance,
+                      InputArray mask=noArray(), bool compactResult=false ) const;
+
+    /** @overload
+    @param queryDescriptors Query set of descriptors.
+    @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
+    descriptor. So, matches size may be smaller than the query descriptors count.
+    @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+    descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+    */
+    CV_WRAP void match( InputArray queryDescriptors, CV_OUT std::vector<DMatch>& matches,
+                        InputArrayOfArrays masks=noArray() );
+    /** @overload
+    @param queryDescriptors Query set of descriptors.
+    @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+    @param k Count of best matches found per each query descriptor or less if a query descriptor has
+    less than k possible matches in total.
+    @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+    descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+    @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+    false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+    the matches vector does not contain matches for fully masked-out query descriptors.
+    */
+    CV_WRAP void knnMatch( InputArray queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
+                           InputArrayOfArrays masks=noArray(), bool compactResult=false );
+    /** @overload
+    @param queryDescriptors Query set of descriptors.
+    @param matches Found matches.
+    @param maxDistance Threshold for the distance between matched descriptors. Distance means here
+    metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured
+    in Pixels)!
+    @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+    descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+    @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+    false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+    the matches vector does not contain matches for fully masked-out query descriptors.
+    */
+    void radiusMatch( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
+                      InputArrayOfArrays masks=noArray(), bool compactResult=false );
+
+    // Reads matcher object from a file node
+    virtual void read( const FileNode& );
+    // Writes matcher object to a file storage
+    virtual void write( FileStorage& ) const;
+
+    /** @brief Clones the matcher.
+
+    @param emptyTrainData If emptyTrainData is false, the method creates a deep copy of the object,
+    that is, copies both parameters and train data. If emptyTrainData is true, the method creates an
+    object copy with the current parameters but with empty train data.
+     */
+    virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const = 0;
+
+    /** @brief Creates a descriptor matcher of a given type with the default parameters (using default
+    constructor).
+
+    @param descriptorMatcherType Descriptor matcher type. Now the following matcher types are
+    supported:
+    -   `BruteForce` (it uses L2 )
+    -   `BruteForce-L1`
+    -   `BruteForce-Hamming`
+    -   `BruteForce-Hamming(2)`
+    -   `FlannBased`
+     */
+    CV_WRAP static Ptr<DescriptorMatcher> create( const String& descriptorMatcherType );
+protected:
+    /**
+     * Class to work with descriptors from several images as with one merged matrix.
+     * It is used e.g. in FlannBasedMatcher.
+     */
+    class CV_EXPORTS DescriptorCollection
+    {
+    public:
+        DescriptorCollection();
+        DescriptorCollection( const DescriptorCollection& collection );
+        virtual ~DescriptorCollection();
+
+        // Vector of matrices "descriptors" will be merged to one matrix "mergedDescriptors" here.
+        void set( const std::vector<Mat>& descriptors );
+        virtual void clear();
+
+        const Mat& getDescriptors() const;
+        const Mat getDescriptor( int imgIdx, int localDescIdx ) const;
+        const Mat getDescriptor( int globalDescIdx ) const;
+        void getLocalIdx( int globalDescIdx, int& imgIdx, int& localDescIdx ) const;
+
+        int size() const;
+
+    protected:
+        Mat mergedDescriptors;
+        std::vector<int> startIdxs;
+    };
+
+    //! In fact the matching is implemented only by the following two methods. These methods suppose
+    //! that the class object has been trained already. Public match methods call these methods
+    //! after calling train().
+    virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
+    virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
+
+    static bool isPossibleMatch( InputArray mask, int queryIdx, int trainIdx );
+    static bool isMaskedOut( InputArrayOfArrays masks, int queryIdx );
+
+    static Mat clone_op( Mat m ) { return m.clone(); }
+    void checkMasks( InputArrayOfArrays masks, int queryDescriptorsCount ) const;
+
+    //! Collection of descriptors from train images.
+    std::vector<Mat> trainDescCollection;
+    std::vector<UMat> utrainDescCollection;
+};
+
+/** @brief Brute-force descriptor matcher.
+
+For each descriptor in the first set, this matcher finds the closest descriptor in the second set
+by trying each one. This descriptor matcher supports masking permissible matches of descriptor
+sets.
+ */
+class CV_EXPORTS_W BFMatcher : public DescriptorMatcher
+{
+public:
+    /** @brief Brute-force matcher constructor.
+
+    @param normType One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are
+    preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and
+    BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor
+    description).
+    @param crossCheck If it is false, this is will be default BFMatcher behaviour when it finds the k
+    nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with
+    k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the
+    matcher's collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent
+    pairs. Such technique usually produces best results with minimal number of outliers when there are
+    enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
+     */
+    CV_WRAP BFMatcher( int normType=NORM_L2, bool crossCheck=false );
+    virtual ~BFMatcher() {}
+
+    virtual bool isMaskSupported() const { return true; }
+
+    virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
+protected:
+    virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false );
+    virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false );
+
+    int normType;
+    bool crossCheck;
+};
+
+
+/** @brief Flann-based descriptor matcher.
+
+This matcher trains flann::Index_ on a train descriptor collection and calls its nearest search
+methods to find the best matches. So, this matcher may be faster when matching a large train
+collection than the brute force matcher. FlannBasedMatcher does not support masking permissible
+matches of descriptor sets because flann::Index does not support this. :
+ */
+class CV_EXPORTS_W FlannBasedMatcher : public DescriptorMatcher
+{
+public:
+    CV_WRAP FlannBasedMatcher( const Ptr<flann::IndexParams>& indexParams=makePtr<flann::KDTreeIndexParams>(),
+                       const Ptr<flann::SearchParams>& searchParams=makePtr<flann::SearchParams>() );
+
+    virtual void add( InputArrayOfArrays descriptors );
+    virtual void clear();
+
+    // Reads matcher object from a file node
+    virtual void read( const FileNode& );
+    // Writes matcher object to a file storage
+    virtual void write( FileStorage& ) const;
+
+    virtual void train();
+    virtual bool isMaskSupported() const;
+
+    virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
+protected:
+    static void convertToDMatches( const DescriptorCollection& descriptors,
+                                   const Mat& indices, const Mat& distances,
+                                   std::vector<std::vector<DMatch> >& matches );
+
+    virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false );
+    virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false );
+
+    Ptr<flann::IndexParams> indexParams;
+    Ptr<flann::SearchParams> searchParams;
+    Ptr<flann::Index> flannIndex;
+
+    DescriptorCollection mergedDescriptors;
+    int addedDescCount;
+};
+
+//! @} features2d_match
+
+/****************************************************************************************\
+*                                   Drawing functions                                    *
+\****************************************************************************************/
+
+//! @addtogroup features2d_draw
+//! @{
+
+struct CV_EXPORTS DrawMatchesFlags
+{
+    enum{ DEFAULT = 0, //!< Output image matrix will be created (Mat::create),
+                       //!< i.e. existing memory of output image may be reused.
+                       //!< Two source image, matches and single keypoints will be drawn.
+                       //!< For each keypoint only the center point will be drawn (without
+                       //!< the circle around keypoint with keypoint size and orientation).
+          DRAW_OVER_OUTIMG = 1, //!< Output image matrix will not be created (Mat::create).
+                                //!< Matches will be drawn on existing content of output image.
+          NOT_DRAW_SINGLE_POINTS = 2, //!< Single keypoints will not be drawn.
+          DRAW_RICH_KEYPOINTS = 4 //!< For each keypoint the circle around keypoint with keypoint size and
+                                  //!< orientation will be drawn.
+        };
+};
+
+/** @brief Draws keypoints.
+
+@param image Source image.
+@param keypoints Keypoints from the source image.
+@param outImage Output image. Its content depends on the flags value defining what is drawn in the
+output image. See possible flags bit values below.
+@param color Color of keypoints.
+@param flags Flags setting drawing features. Possible flags bit values are defined by
+DrawMatchesFlags. See details above in drawMatches .
+
+@note
+For Python API, flags are modified as cv2.DRAW_MATCHES_FLAGS_DEFAULT,
+cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv2.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG,
+cv2.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS
+ */
+CV_EXPORTS_W void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,
+                               const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT );
+
+/** @brief Draws the found matches of keypoints from two images.
+
+@param img1 First source image.
+@param keypoints1 Keypoints from the first source image.
+@param img2 Second source image.
+@param keypoints2 Keypoints from the second source image.
+@param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
+has a corresponding point in keypoints2[matches[i]] .
+@param outImg Output image. Its content depends on the flags value defining what is drawn in the
+output image. See possible flags bit values below.
+@param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1)
+, the color is generated randomly.
+@param singlePointColor Color of single keypoints (circles), which means that keypoints do not
+have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
+@param matchesMask Mask determining which matches are drawn. If the mask is empty, all matches are
+drawn.
+@param flags Flags setting drawing features. Possible flags bit values are defined by
+DrawMatchesFlags.
+
+This function draws matches of keypoints from two images in the output image. Match is a line
+connecting two keypoints (circles). See cv::DrawMatchesFlags.
+ */
+CV_EXPORTS_W void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
+                             InputArray img2, const std::vector<KeyPoint>& keypoints2,
+                             const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
+                             const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
+                             const std::vector<char>& matchesMask=std::vector<char>(), int flags=DrawMatchesFlags::DEFAULT );
+
+/** @overload */
+CV_EXPORTS_AS(drawMatchesKnn) void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
+                             InputArray img2, const std::vector<KeyPoint>& keypoints2,
+                             const std::vector<std::vector<DMatch> >& matches1to2, InputOutputArray outImg,
+                             const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
+                             const std::vector<std::vector<char> >& matchesMask=std::vector<std::vector<char> >(), int flags=DrawMatchesFlags::DEFAULT );
+
+//! @} features2d_draw
+
+/****************************************************************************************\
+*   Functions to evaluate the feature detectors and [generic] descriptor extractors      *
+\****************************************************************************************/
+
+CV_EXPORTS void evaluateFeatureDetector( const Mat& img1, const Mat& img2, const Mat& H1to2,
+                                         std::vector<KeyPoint>* keypoints1, std::vector<KeyPoint>* keypoints2,
+                                         float& repeatability, int& correspCount,
+                                         const Ptr<FeatureDetector>& fdetector=Ptr<FeatureDetector>() );
+
+CV_EXPORTS void computeRecallPrecisionCurve( const std::vector<std::vector<DMatch> >& matches1to2,
+                                             const std::vector<std::vector<uchar> >& correctMatches1to2Mask,
+                                             std::vector<Point2f>& recallPrecisionCurve );
+
+CV_EXPORTS float getRecall( const std::vector<Point2f>& recallPrecisionCurve, float l_precision );
+CV_EXPORTS int getNearestPoint( const std::vector<Point2f>& recallPrecisionCurve, float l_precision );
+
+/****************************************************************************************\
+*                                     Bag of visual words                                *
+\****************************************************************************************/
+
+//! @addtogroup features2d_category
+//! @{
+
+/** @brief Abstract base class for training the *bag of visual words* vocabulary from a set of descriptors.
+
+For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka,
+Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :
+ */
+class CV_EXPORTS_W BOWTrainer
+{
+public:
+    BOWTrainer();
+    virtual ~BOWTrainer();
+
+    /** @brief Adds descriptors to a training set.
+
+    @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a
+    descriptor.
+
+    The training set is clustered using clustermethod to construct the vocabulary.
+     */
+    CV_WRAP void add( const Mat& descriptors );
+
+    /** @brief Returns a training set of descriptors.
+    */
+    CV_WRAP const std::vector<Mat>& getDescriptors() const;
+
+    /** @brief Returns the count of all descriptors stored in the training set.
+    */
+    CV_WRAP int descriptorsCount() const;
+
+    CV_WRAP virtual void clear();
+
+    /** @overload */
+    CV_WRAP virtual Mat cluster() const = 0;
+
+    /** @brief Clusters train descriptors.
+
+    @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor.
+    Descriptors are not added to the inner train descriptor set.
+
+    The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first
+    variant of the method, train descriptors stored in the object are clustered. In the second variant,
+    input descriptors are clustered.
+     */
+    CV_WRAP virtual Mat cluster( const Mat& descriptors ) const = 0;
+
+protected:
+    std::vector<Mat> descriptors;
+    int size;
+};
+
+/** @brief kmeans -based class to train visual vocabulary using the *bag of visual words* approach. :
+ */
+class CV_EXPORTS_W BOWKMeansTrainer : public BOWTrainer
+{
+public:
+    /** @brief The constructor.
+
+    @see cv::kmeans
+    */
+    CV_WRAP BOWKMeansTrainer( int clusterCount, const TermCriteria& termcrit=TermCriteria(),
+                      int attempts=3, int flags=KMEANS_PP_CENTERS );
+    virtual ~BOWKMeansTrainer();
+
+    // Returns trained vocabulary (i.e. cluster centers).
+    CV_WRAP virtual Mat cluster() const;
+    CV_WRAP virtual Mat cluster( const Mat& descriptors ) const;
+
+protected:
+
+    int clusterCount;
+    TermCriteria termcrit;
+    int attempts;
+    int flags;
+};
+
+/** @brief Class to compute an image descriptor using the *bag of visual words*.
+
+Such a computation consists of the following steps:
+
+1.  Compute descriptors for a given image and its keypoints set.
+2.  Find the nearest visual words from the vocabulary for each keypoint descriptor.
+3.  Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words
+encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the
+vocabulary in the given image.
+ */
+class CV_EXPORTS_W BOWImgDescriptorExtractor
+{
+public:
+    /** @brief The constructor.
+
+    @param dextractor Descriptor extractor that is used to compute descriptors for an input image and
+    its keypoints.
+    @param dmatcher Descriptor matcher that is used to find the nearest word of the trained vocabulary
+    for each keypoint descriptor of the image.
+     */
+    CV_WRAP BOWImgDescriptorExtractor( const Ptr<DescriptorExtractor>& dextractor,
+                               const Ptr<DescriptorMatcher>& dmatcher );
+    /** @overload */
+    BOWImgDescriptorExtractor( const Ptr<DescriptorMatcher>& dmatcher );
+    virtual ~BOWImgDescriptorExtractor();
+
+    /** @brief Sets a visual vocabulary.
+
+    @param vocabulary Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the
+    vocabulary is a visual word (cluster center).
+     */
+    CV_WRAP void setVocabulary( const Mat& vocabulary );
+
+    /** @brief Returns the set vocabulary.
+    */
+    CV_WRAP const Mat& getVocabulary() const;
+
+    /** @brief Computes an image descriptor using the set visual vocabulary.
+
+    @param image Image, for which the descriptor is computed.
+    @param keypoints Keypoints detected in the input image.
+    @param imgDescriptor Computed output image descriptor.
+    @param pointIdxsOfClusters Indices of keypoints that belong to the cluster. This means that
+    pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary)
+    returned if it is non-zero.
+    @param descriptors Descriptors of the image keypoints that are returned if they are non-zero.
+     */
+    void compute( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray imgDescriptor,
+                  std::vector<std::vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 );
+    /** @overload
+    @param keypointDescriptors Computed descriptors to match with vocabulary.
+    @param imgDescriptor Computed output image descriptor.
+    @param pointIdxsOfClusters Indices of keypoints that belong to the cluster. This means that
+    pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary)
+    returned if it is non-zero.
+    */
+    void compute( InputArray keypointDescriptors, OutputArray imgDescriptor,
+                  std::vector<std::vector<int> >* pointIdxsOfClusters=0 );
+    // compute() is not constant because DescriptorMatcher::match is not constant
+
+    CV_WRAP_AS(compute) void compute2( const Mat& image, std::vector<KeyPoint>& keypoints, CV_OUT Mat& imgDescriptor )
+    { compute(image,keypoints,imgDescriptor); }
+
+    /** @brief Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.
+    */
+    CV_WRAP int descriptorSize() const;
+
+    /** @brief Returns an image descriptor type.
+     */
+    CV_WRAP int descriptorType() const;
+
+protected:
+    Mat vocabulary;
+    Ptr<DescriptorExtractor> dextractor;
+    Ptr<DescriptorMatcher> dmatcher;
+};
+
+//! @} features2d_category
+
+//! @} features2d
+
+} /* namespace cv */
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp
new file mode 100644
index 0000000..e81df0a
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/features2d.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann.hpp
new file mode 100644
index 0000000..4f92d57
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann.hpp
@@ -0,0 +1,561 @@
+/*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*/
+
+#ifndef _OPENCV_FLANN_HPP_
+#define _OPENCV_FLANN_HPP_
+
+#include "opencv2/core.hpp"
+#include "opencv2/flann/miniflann.hpp"
+#include "opencv2/flann/flann_base.hpp"
+
+/**
+@defgroup flann Clustering and Search in Multi-Dimensional Spaces
+
+This section documents OpenCV's interface to the FLANN library. FLANN (Fast Library for Approximate
+Nearest Neighbors) is a library that contains a collection of algorithms optimized for fast nearest
+neighbor search in large datasets and for high dimensional features. More information about FLANN
+can be found in @cite Muja2009 .
+*/
+
+namespace cvflann
+{
+    CV_EXPORTS flann_distance_t flann_distance_type();
+    FLANN_DEPRECATED CV_EXPORTS void set_distance_type(flann_distance_t distance_type, int order);
+}
+
+
+namespace cv
+{
+namespace flann
+{
+
+
+//! @addtogroup flann
+//! @{
+
+template <typename T> struct CvType {};
+template <> struct CvType<unsigned char> { static int type() { return CV_8U; } };
+template <> struct CvType<char> { static int type() { return CV_8S; } };
+template <> struct CvType<unsigned short> { static int type() { return CV_16U; } };
+template <> struct CvType<short> { static int type() { return CV_16S; } };
+template <> struct CvType<int> { static int type() { return CV_32S; } };
+template <> struct CvType<float> { static int type() { return CV_32F; } };
+template <> struct CvType<double> { static int type() { return CV_64F; } };
+
+
+// bring the flann parameters into this namespace
+using ::cvflann::get_param;
+using ::cvflann::print_params;
+
+// bring the flann distances into this namespace
+using ::cvflann::L2_Simple;
+using ::cvflann::L2;
+using ::cvflann::L1;
+using ::cvflann::MinkowskiDistance;
+using ::cvflann::MaxDistance;
+using ::cvflann::HammingLUT;
+using ::cvflann::Hamming;
+using ::cvflann::Hamming2;
+using ::cvflann::HistIntersectionDistance;
+using ::cvflann::HellingerDistance;
+using ::cvflann::ChiSquareDistance;
+using ::cvflann::KL_Divergence;
+
+
+/** @brief The FLANN nearest neighbor index class. This class is templated with the type of elements for which
+the index is built.
+ */
+template <typename Distance>
+class GenericIndex
+{
+public:
+        typedef typename Distance::ElementType ElementType;
+        typedef typename Distance::ResultType DistanceType;
+
+        /** @brief Constructs a nearest neighbor search index for a given dataset.
+
+        @param features Matrix of containing the features(points) to index. The size of the matrix is
+        num_features x feature_dimensionality and the data type of the elements in the matrix must
+        coincide with the type of the index.
+        @param params Structure containing the index parameters. The type of index that will be
+        constructed depends on the type of this parameter. See the description.
+        @param distance
+
+        The method constructs a fast search structure from a set of features using the specified algorithm
+        with specified parameters, as defined by params. params is a reference to one of the following class
+        IndexParams descendants:
+
+        - **LinearIndexParams** When passing an object of this type, the index will perform a linear,
+        brute-force search. :
+        @code
+        struct LinearIndexParams : public IndexParams
+        {
+        };
+        @endcode
+        - **KDTreeIndexParams** When passing an object of this type the index constructed will consist of
+        a set of randomized kd-trees which will be searched in parallel. :
+        @code
+        struct KDTreeIndexParams : public IndexParams
+        {
+            KDTreeIndexParams( int trees = 4 );
+        };
+        @endcode
+        - **KMeansIndexParams** When passing an object of this type the index constructed will be a
+        hierarchical k-means tree. :
+        @code
+        struct KMeansIndexParams : public IndexParams
+        {
+            KMeansIndexParams(
+                int branching = 32,
+                int iterations = 11,
+                flann_centers_init_t centers_init = CENTERS_RANDOM,
+                float cb_index = 0.2 );
+        };
+        @endcode
+        - **CompositeIndexParams** When using a parameters object of this type the index created
+        combines the randomized kd-trees and the hierarchical k-means tree. :
+        @code
+        struct CompositeIndexParams : public IndexParams
+        {
+            CompositeIndexParams(
+                int trees = 4,
+                int branching = 32,
+                int iterations = 11,
+                flann_centers_init_t centers_init = CENTERS_RANDOM,
+                float cb_index = 0.2 );
+        };
+        @endcode
+        - **LshIndexParams** When using a parameters object of this type the index created uses
+        multi-probe LSH (by Multi-Probe LSH: Efficient Indexing for High-Dimensional Similarity Search
+        by Qin Lv, William Josephson, Zhe Wang, Moses Charikar, Kai Li., Proceedings of the 33rd
+        International Conference on Very Large Data Bases (VLDB). Vienna, Austria. September 2007) :
+        @code
+        struct LshIndexParams : public IndexParams
+        {
+            LshIndexParams(
+                unsigned int table_number,
+                unsigned int key_size,
+                unsigned int multi_probe_level );
+        };
+        @endcode
+        - **AutotunedIndexParams** When passing an object of this type the index created is
+        automatically tuned to offer the best performance, by choosing the optimal index type
+        (randomized kd-trees, hierarchical kmeans, linear) and parameters for the dataset provided. :
+        @code
+        struct AutotunedIndexParams : public IndexParams
+        {
+            AutotunedIndexParams(
+                float target_precision = 0.9,
+                float build_weight = 0.01,
+                float memory_weight = 0,
+                float sample_fraction = 0.1 );
+        };
+        @endcode
+        - **SavedIndexParams** This object type is used for loading a previously saved index from the
+        disk. :
+        @code
+        struct SavedIndexParams : public IndexParams
+        {
+            SavedIndexParams( String filename );
+        };
+        @endcode
+         */
+        GenericIndex(const Mat& features, const ::cvflann::IndexParams& params, Distance distance = Distance());
+
+        ~GenericIndex();
+
+        /** @brief Performs a K-nearest neighbor search for a given query point using the index.
+
+        @param query The query point
+        @param indices Vector that will contain the indices of the K-nearest neighbors found. It must have
+        at least knn size.
+        @param dists Vector that will contain the distances to the K-nearest neighbors found. It must have
+        at least knn size.
+        @param knn Number of nearest neighbors to search for.
+        @param params SearchParams
+         */
+        void knnSearch(const std::vector<ElementType>& query, std::vector<int>& indices,
+                       std::vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& params);
+        void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& params);
+
+        int radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices,
+                         std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params);
+        int radiusSearch(const Mat& query, Mat& indices, Mat& dists,
+                         DistanceType radius, const ::cvflann::SearchParams& params);
+
+        void save(String filename) { nnIndex->save(filename); }
+
+        int veclen() const { return nnIndex->veclen(); }
+
+        int size() const { return nnIndex->size(); }
+
+        ::cvflann::IndexParams getParameters() { return nnIndex->getParameters(); }
+
+        FLANN_DEPRECATED const ::cvflann::IndexParams* getIndexParameters() { return nnIndex->getIndexParameters(); }
+
+private:
+        ::cvflann::Index<Distance>* nnIndex;
+};
+
+//! @cond IGNORED
+
+#define FLANN_DISTANCE_CHECK \
+    if ( ::cvflann::flann_distance_type() != cvflann::FLANN_DIST_L2) { \
+        printf("[WARNING] You are using cv::flann::Index (or cv::flann::GenericIndex) and have also changed "\
+        "the distance using cvflann::set_distance_type. This is no longer working as expected "\
+        "(cv::flann::Index always uses L2). You should create the index templated on the distance, "\
+        "for example for L1 distance use: GenericIndex< L1<float> > \n"); \
+    }
+
+
+template <typename Distance>
+GenericIndex<Distance>::GenericIndex(const Mat& dataset, const ::cvflann::IndexParams& params, Distance distance)
+{
+    CV_Assert(dataset.type() == CvType<ElementType>::type());
+    CV_Assert(dataset.isContinuous());
+    ::cvflann::Matrix<ElementType> m_dataset((ElementType*)dataset.ptr<ElementType>(0), dataset.rows, dataset.cols);
+
+    nnIndex = new ::cvflann::Index<Distance>(m_dataset, params, distance);
+
+    FLANN_DISTANCE_CHECK
+
+    nnIndex->buildIndex();
+}
+
+template <typename Distance>
+GenericIndex<Distance>::~GenericIndex()
+{
+    delete nnIndex;
+}
+
+template <typename Distance>
+void GenericIndex<Distance>::knnSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& searchParams)
+{
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)&query[0], 1, query.size());
+    ::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
+    ::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
+
+    FLANN_DISTANCE_CHECK
+
+    nnIndex->knnSearch(m_query,m_indices,m_dists,knn,searchParams);
+}
+
+
+template <typename Distance>
+void GenericIndex<Distance>::knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& searchParams)
+{
+    CV_Assert(queries.type() == CvType<ElementType>::type());
+    CV_Assert(queries.isContinuous());
+    ::cvflann::Matrix<ElementType> m_queries((ElementType*)queries.ptr<ElementType>(0), queries.rows, queries.cols);
+
+    CV_Assert(indices.type() == CV_32S);
+    CV_Assert(indices.isContinuous());
+    ::cvflann::Matrix<int> m_indices((int*)indices.ptr<int>(0), indices.rows, indices.cols);
+
+    CV_Assert(dists.type() == CvType<DistanceType>::type());
+    CV_Assert(dists.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
+
+    FLANN_DISTANCE_CHECK
+
+    nnIndex->knnSearch(m_queries,m_indices,m_dists,knn, searchParams);
+}
+
+template <typename Distance>
+int GenericIndex<Distance>::radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
+{
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)&query[0], 1, query.size());
+    ::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
+    ::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
+
+    FLANN_DISTANCE_CHECK
+
+    return nnIndex->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+}
+
+template <typename Distance>
+int GenericIndex<Distance>::radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
+{
+    CV_Assert(query.type() == CvType<ElementType>::type());
+    CV_Assert(query.isContinuous());
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)query.ptr<ElementType>(0), query.rows, query.cols);
+
+    CV_Assert(indices.type() == CV_32S);
+    CV_Assert(indices.isContinuous());
+    ::cvflann::Matrix<int> m_indices((int*)indices.ptr<int>(0), indices.rows, indices.cols);
+
+    CV_Assert(dists.type() == CvType<DistanceType>::type());
+    CV_Assert(dists.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
+
+    FLANN_DISTANCE_CHECK
+
+    return nnIndex->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+}
+
+//! @endcond
+
+/**
+ * @deprecated Use GenericIndex class instead
+ */
+template <typename T>
+class
+#ifndef _MSC_VER
+ FLANN_DEPRECATED
+#endif
+ Index_ {
+public:
+        typedef typename L2<T>::ElementType ElementType;
+        typedef typename L2<T>::ResultType DistanceType;
+
+    Index_(const Mat& features, const ::cvflann::IndexParams& params);
+
+    ~Index_();
+
+    void knnSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& params);
+    void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& params);
+
+    int radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params);
+    int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& params);
+
+    void save(String filename)
+        {
+            if (nnIndex_L1) nnIndex_L1->save(filename);
+            if (nnIndex_L2) nnIndex_L2->save(filename);
+        }
+
+    int veclen() const
+    {
+            if (nnIndex_L1) return nnIndex_L1->veclen();
+            if (nnIndex_L2) return nnIndex_L2->veclen();
+        }
+
+    int size() const
+    {
+            if (nnIndex_L1) return nnIndex_L1->size();
+            if (nnIndex_L2) return nnIndex_L2->size();
+        }
+
+        ::cvflann::IndexParams getParameters()
+        {
+            if (nnIndex_L1) return nnIndex_L1->getParameters();
+            if (nnIndex_L2) return nnIndex_L2->getParameters();
+
+        }
+
+        FLANN_DEPRECATED const ::cvflann::IndexParams* getIndexParameters()
+        {
+            if (nnIndex_L1) return nnIndex_L1->getIndexParameters();
+            if (nnIndex_L2) return nnIndex_L2->getIndexParameters();
+        }
+
+private:
+        // providing backwards compatibility for L2 and L1 distances (most common)
+        ::cvflann::Index< L2<ElementType> >* nnIndex_L2;
+        ::cvflann::Index< L1<ElementType> >* nnIndex_L1;
+};
+
+#ifdef _MSC_VER
+template <typename T>
+class FLANN_DEPRECATED Index_;
+#endif
+
+//! @cond IGNORED
+
+template <typename T>
+Index_<T>::Index_(const Mat& dataset, const ::cvflann::IndexParams& params)
+{
+    printf("[WARNING] The cv::flann::Index_<T> class is deperecated, use cv::flann::GenericIndex<Distance> instead\n");
+
+    CV_Assert(dataset.type() == CvType<ElementType>::type());
+    CV_Assert(dataset.isContinuous());
+    ::cvflann::Matrix<ElementType> m_dataset((ElementType*)dataset.ptr<ElementType>(0), dataset.rows, dataset.cols);
+
+    if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L2 ) {
+        nnIndex_L1 = NULL;
+        nnIndex_L2 = new ::cvflann::Index< L2<ElementType> >(m_dataset, params);
+    }
+    else if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L1 ) {
+        nnIndex_L1 = new ::cvflann::Index< L1<ElementType> >(m_dataset, params);
+        nnIndex_L2 = NULL;
+    }
+    else {
+        printf("[ERROR] cv::flann::Index_<T> only provides backwards compatibility for the L1 and L2 distances. "
+        "For other distance types you must use cv::flann::GenericIndex<Distance>\n");
+        CV_Assert(0);
+    }
+    if (nnIndex_L1) nnIndex_L1->buildIndex();
+    if (nnIndex_L2) nnIndex_L2->buildIndex();
+}
+
+template <typename T>
+Index_<T>::~Index_()
+{
+    if (nnIndex_L1) delete nnIndex_L1;
+    if (nnIndex_L2) delete nnIndex_L2;
+}
+
+template <typename T>
+void Index_<T>::knnSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& searchParams)
+{
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)&query[0], 1, query.size());
+    ::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
+    ::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
+
+    if (nnIndex_L1) nnIndex_L1->knnSearch(m_query,m_indices,m_dists,knn,searchParams);
+    if (nnIndex_L2) nnIndex_L2->knnSearch(m_query,m_indices,m_dists,knn,searchParams);
+}
+
+
+template <typename T>
+void Index_<T>::knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& searchParams)
+{
+    CV_Assert(queries.type() == CvType<ElementType>::type());
+    CV_Assert(queries.isContinuous());
+    ::cvflann::Matrix<ElementType> m_queries((ElementType*)queries.ptr<ElementType>(0), queries.rows, queries.cols);
+
+    CV_Assert(indices.type() == CV_32S);
+    CV_Assert(indices.isContinuous());
+    ::cvflann::Matrix<int> m_indices((int*)indices.ptr<int>(0), indices.rows, indices.cols);
+
+    CV_Assert(dists.type() == CvType<DistanceType>::type());
+    CV_Assert(dists.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
+
+    if (nnIndex_L1) nnIndex_L1->knnSearch(m_queries,m_indices,m_dists,knn, searchParams);
+    if (nnIndex_L2) nnIndex_L2->knnSearch(m_queries,m_indices,m_dists,knn, searchParams);
+}
+
+template <typename T>
+int Index_<T>::radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
+{
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)&query[0], 1, query.size());
+    ::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
+    ::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
+
+    if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+    if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+}
+
+template <typename T>
+int Index_<T>::radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
+{
+    CV_Assert(query.type() == CvType<ElementType>::type());
+    CV_Assert(query.isContinuous());
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)query.ptr<ElementType>(0), query.rows, query.cols);
+
+    CV_Assert(indices.type() == CV_32S);
+    CV_Assert(indices.isContinuous());
+    ::cvflann::Matrix<int> m_indices((int*)indices.ptr<int>(0), indices.rows, indices.cols);
+
+    CV_Assert(dists.type() == CvType<DistanceType>::type());
+    CV_Assert(dists.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
+
+    if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+    if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+}
+
+//! @endcond
+
+/** @brief Clusters features using hierarchical k-means algorithm.
+
+@param features The points to be clustered. The matrix must have elements of type
+Distance::ElementType.
+@param centers The centers of the clusters obtained. The matrix must have type
+Distance::ResultType. The number of rows in this matrix represents the number of clusters desired,
+however, because of the way the cut in the hierarchical tree is chosen, the number of clusters
+computed will be the highest number of the form (branching-1)\*k+1 that's lower than the number of
+clusters desired, where branching is the tree's branching factor (see description of the
+KMeansIndexParams).
+@param params Parameters used in the construction of the hierarchical k-means tree.
+@param d Distance to be used for clustering.
+
+The method clusters the given feature vectors by constructing a hierarchical k-means tree and
+choosing a cut in the tree that minimizes the cluster's variance. It returns the number of clusters
+found.
+ */
+template <typename Distance>
+int hierarchicalClustering(const Mat& features, Mat& centers, const ::cvflann::KMeansIndexParams& params,
+                           Distance d = Distance())
+{
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    CV_Assert(features.type() == CvType<ElementType>::type());
+    CV_Assert(features.isContinuous());
+    ::cvflann::Matrix<ElementType> m_features((ElementType*)features.ptr<ElementType>(0), features.rows, features.cols);
+
+    CV_Assert(centers.type() == CvType<DistanceType>::type());
+    CV_Assert(centers.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_centers((DistanceType*)centers.ptr<DistanceType>(0), centers.rows, centers.cols);
+
+    return ::cvflann::hierarchicalClustering<Distance>(m_features, m_centers, params, d);
+}
+
+/** @deprecated
+*/
+template <typename ELEM_TYPE, typename DIST_TYPE>
+FLANN_DEPRECATED int hierarchicalClustering(const Mat& features, Mat& centers, const ::cvflann::KMeansIndexParams& params)
+{
+    printf("[WARNING] cv::flann::hierarchicalClustering<ELEM_TYPE,DIST_TYPE> is deprecated, use "
+        "cv::flann::hierarchicalClustering<Distance> instead\n");
+
+    if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L2 ) {
+        return hierarchicalClustering< L2<ELEM_TYPE> >(features, centers, params);
+    }
+    else if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L1 ) {
+        return hierarchicalClustering< L1<ELEM_TYPE> >(features, centers, params);
+    }
+    else {
+        printf("[ERROR] cv::flann::hierarchicalClustering<ELEM_TYPE,DIST_TYPE> only provides backwards "
+        "compatibility for the L1 and L2 distances. "
+        "For other distance types you must use cv::flann::hierarchicalClustering<Distance>\n");
+        CV_Assert(0);
+    }
+}
+
+//! @} flann
+
+} } // namespace cv::flann
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h
new file mode 100644
index 0000000..ff53fd8
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h
@@ -0,0 +1,155 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_ALL_INDICES_H_
+#define OPENCV_FLANN_ALL_INDICES_H_
+
+#include "general.h"
+
+#include "nn_index.h"
+#include "kdtree_index.h"
+#include "kdtree_single_index.h"
+#include "kmeans_index.h"
+#include "composite_index.h"
+#include "linear_index.h"
+#include "hierarchical_clustering_index.h"
+#include "lsh_index.h"
+#include "autotuned_index.h"
+
+
+namespace cvflann
+{
+
+template<typename KDTreeCapability, typename VectorSpace, typename Distance>
+struct index_creator
+{
+    static NNIndex<Distance>* create(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance)
+    {
+        flann_algorithm_t index_type = get_param<flann_algorithm_t>(params, "algorithm");
+
+        NNIndex<Distance>* nnIndex;
+        switch (index_type) {
+        case FLANN_INDEX_LINEAR:
+            nnIndex = new LinearIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_KDTREE_SINGLE:
+            nnIndex = new KDTreeSingleIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_KDTREE:
+            nnIndex = new KDTreeIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_KMEANS:
+            nnIndex = new KMeansIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_COMPOSITE:
+            nnIndex = new CompositeIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_AUTOTUNED:
+            nnIndex = new AutotunedIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_HIERARCHICAL:
+            nnIndex = new HierarchicalClusteringIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_LSH:
+            nnIndex = new LshIndex<Distance>(dataset, params, distance);
+            break;
+        default:
+            throw FLANNException("Unknown index type");
+        }
+
+        return nnIndex;
+    }
+};
+
+template<typename VectorSpace, typename Distance>
+struct index_creator<False,VectorSpace,Distance>
+{
+    static NNIndex<Distance>* create(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance)
+    {
+        flann_algorithm_t index_type = get_param<flann_algorithm_t>(params, "algorithm");
+
+        NNIndex<Distance>* nnIndex;
+        switch (index_type) {
+        case FLANN_INDEX_LINEAR:
+            nnIndex = new LinearIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_KMEANS:
+            nnIndex = new KMeansIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_HIERARCHICAL:
+            nnIndex = new HierarchicalClusteringIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_LSH:
+            nnIndex = new LshIndex<Distance>(dataset, params, distance);
+            break;
+        default:
+            throw FLANNException("Unknown index type");
+        }
+
+        return nnIndex;
+    }
+};
+
+template<typename Distance>
+struct index_creator<False,False,Distance>
+{
+    static NNIndex<Distance>* create(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance)
+    {
+        flann_algorithm_t index_type = get_param<flann_algorithm_t>(params, "algorithm");
+
+        NNIndex<Distance>* nnIndex;
+        switch (index_type) {
+        case FLANN_INDEX_LINEAR:
+            nnIndex = new LinearIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_HIERARCHICAL:
+            nnIndex = new HierarchicalClusteringIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_LSH:
+            nnIndex = new LshIndex<Distance>(dataset, params, distance);
+            break;
+        default:
+            throw FLANNException("Unknown index type");
+        }
+
+        return nnIndex;
+    }
+};
+
+template<typename Distance>
+NNIndex<Distance>* create_index_by_type(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance)
+{
+    return index_creator<typename Distance::is_kdtree_distance,
+                         typename Distance::is_vector_space_distance,
+                         Distance>::create(dataset, params,distance);
+}
+
+}
+
+#endif /* OPENCV_FLANN_ALL_INDICES_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h
new file mode 100644
index 0000000..26091d0
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h
@@ -0,0 +1,188 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_ALLOCATOR_H_
+#define OPENCV_FLANN_ALLOCATOR_H_
+
+#include <stdlib.h>
+#include <stdio.h>
+
+
+namespace cvflann
+{
+
+/**
+ * Allocates (using C's malloc) a generic type T.
+ *
+ * Params:
+ *     count = number of instances to allocate.
+ * Returns: pointer (of type T*) to memory buffer
+ */
+template <typename T>
+T* allocate(size_t count = 1)
+{
+    T* mem = (T*) ::malloc(sizeof(T)*count);
+    return mem;
+}
+
+
+/**
+ * Pooled storage allocator
+ *
+ * The following routines allow for the efficient allocation of storage in
+ * small chunks from a specified pool.  Rather than allowing each structure
+ * to be freed individually, an entire pool of storage is freed at once.
+ * This method has two advantages over just using malloc() and free().  First,
+ * it is far more efficient for allocating small objects, as there is
+ * no overhead for remembering all the information needed to free each
+ * object or consolidating fragmented memory.  Second, the decision about
+ * how long to keep an object is made at the time of allocation, and there
+ * is no need to track down all the objects to free them.
+ *
+ */
+
+const size_t     WORDSIZE=16;
+const  size_t     BLOCKSIZE=8192;
+
+class PooledAllocator
+{
+    /* We maintain memory alignment to word boundaries by requiring that all
+        allocations be in multiples of the machine wordsize.  */
+    /* Size of machine word in bytes.  Must be power of 2. */
+    /* Minimum number of bytes requested at a time from	the system.  Must be multiple of WORDSIZE. */
+
+
+    int     remaining;  /* Number of bytes left in current block of storage. */
+    void*   base;     /* Pointer to base of current block of storage. */
+    void*   loc;      /* Current location in block to next allocate memory. */
+    int     blocksize;
+
+
+public:
+    int     usedMemory;
+    int     wastedMemory;
+
+    /**
+        Default constructor. Initializes a new pool.
+     */
+    PooledAllocator(int blockSize = BLOCKSIZE)
+    {
+        blocksize = blockSize;
+        remaining = 0;
+        base = NULL;
+
+        usedMemory = 0;
+        wastedMemory = 0;
+    }
+
+    /**
+     * Destructor. Frees all the memory allocated in this pool.
+     */
+    ~PooledAllocator()
+    {
+        void* prev;
+
+        while (base != NULL) {
+            prev = *((void**) base); /* Get pointer to prev block. */
+            ::free(base);
+            base = prev;
+        }
+    }
+
+    /**
+     * Returns a pointer to a piece of new memory of the given size in bytes
+     * allocated from the pool.
+     */
+    void* allocateMemory(int size)
+    {
+        int blockSize;
+
+        /* Round size up to a multiple of wordsize.  The following expression
+            only works for WORDSIZE that is a power of 2, by masking last bits of
+            incremented size to zero.
+         */
+        size = (size + (WORDSIZE - 1)) & ~(WORDSIZE - 1);
+
+        /* Check whether a new block must be allocated.  Note that the first word
+            of a block is reserved for a pointer to the previous block.
+         */
+        if (size > remaining) {
+
+            wastedMemory += remaining;
+
+            /* Allocate new storage. */
+            blockSize = (size + sizeof(void*) + (WORDSIZE-1) > BLOCKSIZE) ?
+                        size + sizeof(void*) + (WORDSIZE-1) : BLOCKSIZE;
+
+            // use the standard C malloc to allocate memory
+            void* m = ::malloc(blockSize);
+            if (!m) {
+                fprintf(stderr,"Failed to allocate memory.\n");
+                return NULL;
+            }
+
+            /* Fill first word of new block with pointer to previous block. */
+            ((void**) m)[0] = base;
+            base = m;
+
+            int shift = 0;
+            //int shift = (WORDSIZE - ( (((size_t)m) + sizeof(void*)) & (WORDSIZE-1))) & (WORDSIZE-1);
+
+            remaining = blockSize - sizeof(void*) - shift;
+            loc = ((char*)m + sizeof(void*) + shift);
+        }
+        void* rloc = loc;
+        loc = (char*)loc + size;
+        remaining -= size;
+
+        usedMemory += size;
+
+        return rloc;
+    }
+
+    /**
+     * Allocates (using this pool) a generic type T.
+     *
+     * Params:
+     *     count = number of instances to allocate.
+     * Returns: pointer (of type T*) to memory buffer
+     */
+    template <typename T>
+    T* allocate(size_t count = 1)
+    {
+        T* mem = (T*) this->allocateMemory((int)(sizeof(T)*count));
+        return mem;
+    }
+
+};
+
+}
+
+#endif //OPENCV_FLANN_ALLOCATOR_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/any.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/any.h
new file mode 100644
index 0000000..8c2edaa
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/any.h
@@ -0,0 +1,323 @@
+#ifndef OPENCV_FLANN_ANY_H_
+#define OPENCV_FLANN_ANY_H_
+/*
+ * (C) Copyright Christopher Diggins 2005-2011
+ * (C) Copyright Pablo Aguilar 2005
+ * (C) Copyright Kevlin Henney 2001
+ *
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt
+ *
+ * Adapted for FLANN by Marius Muja
+ */
+
+#include "defines.h"
+#include <stdexcept>
+#include <ostream>
+#include <typeinfo>
+
+namespace cvflann
+{
+
+namespace anyimpl
+{
+
+struct bad_any_cast
+{
+};
+
+struct empty_any
+{
+};
+
+inline std::ostream& operator <<(std::ostream& out, const empty_any&)
+{
+    out << "[empty_any]";
+    return out;
+}
+
+struct base_any_policy
+{
+    virtual void static_delete(void** x) = 0;
+    virtual void copy_from_value(void const* src, void** dest) = 0;
+    virtual void clone(void* const* src, void** dest) = 0;
+    virtual void move(void* const* src, void** dest) = 0;
+    virtual void* get_value(void** src) = 0;
+    virtual const void* get_value(void* const * src) = 0;
+    virtual ::size_t get_size() = 0;
+    virtual const std::type_info& type() = 0;
+    virtual void print(std::ostream& out, void* const* src) = 0;
+    virtual ~base_any_policy() {}
+};
+
+template<typename T>
+struct typed_base_any_policy : base_any_policy
+{
+    virtual ::size_t get_size() { return sizeof(T); }
+    virtual const std::type_info& type() { return typeid(T); }
+
+};
+
+template<typename T>
+struct small_any_policy : typed_base_any_policy<T>
+{
+    virtual void static_delete(void**) { }
+    virtual void copy_from_value(void const* src, void** dest)
+    {
+        new (dest) T(* reinterpret_cast<T const*>(src));
+    }
+    virtual void clone(void* const* src, void** dest) { *dest = *src; }
+    virtual void move(void* const* src, void** dest) { *dest = *src; }
+    virtual void* get_value(void** src) { return reinterpret_cast<void*>(src); }
+    virtual const void* get_value(void* const * src) { return reinterpret_cast<const void*>(src); }
+    virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(src); }
+};
+
+template<typename T>
+struct big_any_policy : typed_base_any_policy<T>
+{
+    virtual void static_delete(void** x)
+    {
+        if (* x) delete (* reinterpret_cast<T**>(x)); *x = NULL;
+    }
+    virtual void copy_from_value(void const* src, void** dest)
+    {
+        *dest = new T(*reinterpret_cast<T const*>(src));
+    }
+    virtual void clone(void* const* src, void** dest)
+    {
+        *dest = new T(**reinterpret_cast<T* const*>(src));
+    }
+    virtual void move(void* const* src, void** dest)
+    {
+        (*reinterpret_cast<T**>(dest))->~T();
+        **reinterpret_cast<T**>(dest) = **reinterpret_cast<T* const*>(src);
+    }
+    virtual void* get_value(void** src) { return *src; }
+    virtual const void* get_value(void* const * src) { return *src; }
+    virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(*src); }
+};
+
+template<> inline void big_any_policy<flann_centers_init_t>::print(std::ostream& out, void* const* src)
+{
+    out << int(*reinterpret_cast<flann_centers_init_t const*>(*src));
+}
+
+template<> inline void big_any_policy<flann_algorithm_t>::print(std::ostream& out, void* const* src)
+{
+    out << int(*reinterpret_cast<flann_algorithm_t const*>(*src));
+}
+
+template<> inline void big_any_policy<cv::String>::print(std::ostream& out, void* const* src)
+{
+    out << (*reinterpret_cast<cv::String const*>(*src)).c_str();
+}
+
+template<typename T>
+struct choose_policy
+{
+    typedef big_any_policy<T> type;
+};
+
+template<typename T>
+struct choose_policy<T*>
+{
+    typedef small_any_policy<T*> type;
+};
+
+struct any;
+
+/// Choosing the policy for an any type is illegal, but should never happen.
+/// This is designed to throw a compiler error.
+template<>
+struct choose_policy<any>
+{
+    typedef void type;
+};
+
+/// Specializations for small types.
+#define SMALL_POLICY(TYPE) \
+    template<> \
+    struct choose_policy<TYPE> { typedef small_any_policy<TYPE> type; \
+    }
+
+SMALL_POLICY(signed char);
+SMALL_POLICY(unsigned char);
+SMALL_POLICY(signed short);
+SMALL_POLICY(unsigned short);
+SMALL_POLICY(signed int);
+SMALL_POLICY(unsigned int);
+SMALL_POLICY(signed long);
+SMALL_POLICY(unsigned long);
+SMALL_POLICY(float);
+SMALL_POLICY(bool);
+
+#undef SMALL_POLICY
+
+template <typename T>
+class SinglePolicy
+{
+    SinglePolicy();
+    SinglePolicy(const SinglePolicy& other);
+    SinglePolicy& operator=(const SinglePolicy& other);
+
+public:
+    static base_any_policy* get_policy();
+
+private:
+    static typename choose_policy<T>::type policy;
+};
+
+template <typename T>
+typename choose_policy<T>::type SinglePolicy<T>::policy;
+
+/// This function will return a different policy for each type.
+template <typename T>
+inline base_any_policy* SinglePolicy<T>::get_policy() { return &policy; }
+
+} // namespace anyimpl
+
+struct any
+{
+private:
+    // fields
+    anyimpl::base_any_policy* policy;
+    void* object;
+
+public:
+    /// Initializing constructor.
+    template <typename T>
+    any(const T& x)
+        : policy(anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy()), object(NULL)
+    {
+        assign(x);
+    }
+
+    /// Empty constructor.
+    any()
+        : policy(anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy()), object(NULL)
+    { }
+
+    /// Special initializing constructor for string literals.
+    any(const char* x)
+        : policy(anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy()), object(NULL)
+    {
+        assign(x);
+    }
+
+    /// Copy constructor.
+    any(const any& x)
+        : policy(anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy()), object(NULL)
+    {
+        assign(x);
+    }
+
+    /// Destructor.
+    ~any()
+    {
+        policy->static_delete(&object);
+    }
+
+    /// Assignment function from another any.
+    any& assign(const any& x)
+    {
+        reset();
+        policy = x.policy;
+        policy->clone(&x.object, &object);
+        return *this;
+    }
+
+    /// Assignment function.
+    template <typename T>
+    any& assign(const T& x)
+    {
+        reset();
+        policy = anyimpl::SinglePolicy<T>::get_policy();
+        policy->copy_from_value(&x, &object);
+        return *this;
+    }
+
+    /// Assignment operator.
+    template<typename T>
+    any& operator=(const T& x)
+    {
+        return assign(x);
+    }
+
+    /// Assignment operator, specialed for literal strings.
+    /// They have types like const char [6] which don't work as expected.
+    any& operator=(const char* x)
+    {
+        return assign(x);
+    }
+
+    /// Utility functions
+    any& swap(any& x)
+    {
+        std::swap(policy, x.policy);
+        std::swap(object, x.object);
+        return *this;
+    }
+
+    /// Cast operator. You can only cast to the original type.
+    template<typename T>
+    T& cast()
+    {
+        if (policy->type() != typeid(T)) throw anyimpl::bad_any_cast();
+        T* r = reinterpret_cast<T*>(policy->get_value(&object));
+        return *r;
+    }
+
+    /// Cast operator. You can only cast to the original type.
+    template<typename T>
+    const T& cast() const
+    {
+        if (policy->type() != typeid(T)) throw anyimpl::bad_any_cast();
+        const T* r = reinterpret_cast<const T*>(policy->get_value(&object));
+        return *r;
+    }
+
+    /// Returns true if the any contains no value.
+    bool empty() const
+    {
+        return policy->type() == typeid(anyimpl::empty_any);
+    }
+
+    /// Frees any allocated memory, and sets the value to NULL.
+    void reset()
+    {
+        policy->static_delete(&object);
+        policy = anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy();
+    }
+
+    /// Returns true if the two types are the same.
+    bool compatible(const any& x) const
+    {
+        return policy->type() == x.policy->type();
+    }
+
+    /// Returns if the type is compatible with the policy
+    template<typename T>
+    bool has_type()
+    {
+        return policy->type() == typeid(T);
+    }
+
+    const std::type_info& type() const
+    {
+        return policy->type();
+    }
+
+    friend std::ostream& operator <<(std::ostream& out, const any& any_val);
+};
+
+inline std::ostream& operator <<(std::ostream& out, const any& any_val)
+{
+    any_val.policy->print(out,&any_val.object);
+    return out;
+}
+
+}
+
+#endif // OPENCV_FLANN_ANY_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h
new file mode 100644
index 0000000..6ffb929
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h
@@ -0,0 +1,588 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+#ifndef OPENCV_FLANN_AUTOTUNED_INDEX_H_
+#define OPENCV_FLANN_AUTOTUNED_INDEX_H_
+
+#include "general.h"
+#include "nn_index.h"
+#include "ground_truth.h"
+#include "index_testing.h"
+#include "sampling.h"
+#include "kdtree_index.h"
+#include "kdtree_single_index.h"
+#include "kmeans_index.h"
+#include "composite_index.h"
+#include "linear_index.h"
+#include "logger.h"
+
+namespace cvflann
+{
+
+template<typename Distance>
+NNIndex<Distance>* create_index_by_type(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance);
+
+
+struct AutotunedIndexParams : public IndexParams
+{
+    AutotunedIndexParams(float target_precision = 0.8, float build_weight = 0.01, float memory_weight = 0, float sample_fraction = 0.1)
+    {
+        (*this)["algorithm"] = FLANN_INDEX_AUTOTUNED;
+        // precision desired (used for autotuning, -1 otherwise)
+        (*this)["target_precision"] = target_precision;
+        // build tree time weighting factor
+        (*this)["build_weight"] = build_weight;
+        // index memory weighting factor
+        (*this)["memory_weight"] = memory_weight;
+        // what fraction of the dataset to use for autotuning
+        (*this)["sample_fraction"] = sample_fraction;
+    }
+};
+
+
+template <typename Distance>
+class AutotunedIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    AutotunedIndex(const Matrix<ElementType>& inputData, const IndexParams& params = AutotunedIndexParams(), Distance d = Distance()) :
+        dataset_(inputData), distance_(d)
+    {
+        target_precision_ = get_param(params, "target_precision",0.8f);
+        build_weight_ =  get_param(params,"build_weight", 0.01f);
+        memory_weight_ = get_param(params, "memory_weight", 0.0f);
+        sample_fraction_ = get_param(params,"sample_fraction", 0.1f);
+        bestIndex_ = NULL;
+    }
+
+    AutotunedIndex(const AutotunedIndex&);
+    AutotunedIndex& operator=(const AutotunedIndex&);
+
+    virtual ~AutotunedIndex()
+    {
+        if (bestIndex_ != NULL) {
+            delete bestIndex_;
+            bestIndex_ = NULL;
+        }
+    }
+
+    /**
+     *          Method responsible with building the index.
+     */
+    virtual void buildIndex()
+    {
+        std::ostringstream stream;
+        bestParams_ = estimateBuildParams();
+        print_params(bestParams_, stream);
+        Logger::info("----------------------------------------------------\n");
+        Logger::info("Autotuned parameters:\n");
+        Logger::info("%s", stream.str().c_str());
+        Logger::info("----------------------------------------------------\n");
+
+        bestIndex_ = create_index_by_type(dataset_, bestParams_, distance_);
+        bestIndex_->buildIndex();
+        speedup_ = estimateSearchParams(bestSearchParams_);
+        stream.str(std::string());
+        print_params(bestSearchParams_, stream);
+        Logger::info("----------------------------------------------------\n");
+        Logger::info("Search parameters:\n");
+        Logger::info("%s", stream.str().c_str());
+        Logger::info("----------------------------------------------------\n");
+    }
+
+    /**
+     *  Saves the index to a stream
+     */
+    virtual void saveIndex(FILE* stream)
+    {
+        save_value(stream, (int)bestIndex_->getType());
+        bestIndex_->saveIndex(stream);
+        save_value(stream, get_param<int>(bestSearchParams_, "checks"));
+    }
+
+    /**
+     *  Loads the index from a stream
+     */
+    virtual void loadIndex(FILE* stream)
+    {
+        int index_type;
+
+        load_value(stream, index_type);
+        IndexParams params;
+        params["algorithm"] = (flann_algorithm_t)index_type;
+        bestIndex_ = create_index_by_type<Distance>(dataset_, params, distance_);
+        bestIndex_->loadIndex(stream);
+        int checks;
+        load_value(stream, checks);
+        bestSearchParams_["checks"] = checks;
+    }
+
+    /**
+     *      Method that searches for nearest-neighbors
+     */
+    virtual void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        int checks = get_param<int>(searchParams,"checks",FLANN_CHECKS_AUTOTUNED);
+        if (checks == FLANN_CHECKS_AUTOTUNED) {
+            bestIndex_->findNeighbors(result, vec, bestSearchParams_);
+        }
+        else {
+            bestIndex_->findNeighbors(result, vec, searchParams);
+        }
+    }
+
+
+    IndexParams getParameters() const
+    {
+        return bestIndex_->getParameters();
+    }
+
+    SearchParams getSearchParameters() const
+    {
+        return bestSearchParams_;
+    }
+
+    float getSpeedup() const
+    {
+        return speedup_;
+    }
+
+
+    /**
+     *      Number of features in this index.
+     */
+    virtual size_t size() const
+    {
+        return bestIndex_->size();
+    }
+
+    /**
+     *  The length of each vector in this index.
+     */
+    virtual size_t veclen() const
+    {
+        return bestIndex_->veclen();
+    }
+
+    /**
+     * The amount of memory (in bytes) this index uses.
+     */
+    virtual int usedMemory() const
+    {
+        return bestIndex_->usedMemory();
+    }
+
+    /**
+     * Algorithm name
+     */
+    virtual flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_AUTOTUNED;
+    }
+
+private:
+
+    struct CostData
+    {
+        float searchTimeCost;
+        float buildTimeCost;
+        float memoryCost;
+        float totalCost;
+        IndexParams params;
+    };
+
+    void evaluate_kmeans(CostData& cost)
+    {
+        StartStopTimer t;
+        int checks;
+        const int nn = 1;
+
+        Logger::info("KMeansTree using params: max_iterations=%d, branching=%d\n",
+                     get_param<int>(cost.params,"iterations"),
+                     get_param<int>(cost.params,"branching"));
+        KMeansIndex<Distance> kmeans(sampledDataset_, cost.params, distance_);
+        // measure index build time
+        t.start();
+        kmeans.buildIndex();
+        t.stop();
+        float buildTime = (float)t.value;
+
+        // measure search time
+        float searchTime = test_index_precision(kmeans, sampledDataset_, testDataset_, gt_matches_, target_precision_, checks, distance_, nn);
+
+        float datasetMemory = float(sampledDataset_.rows * sampledDataset_.cols * sizeof(float));
+        cost.memoryCost = (kmeans.usedMemory() + datasetMemory) / datasetMemory;
+        cost.searchTimeCost = searchTime;
+        cost.buildTimeCost = buildTime;
+        Logger::info("KMeansTree buildTime=%g, searchTime=%g, build_weight=%g\n", buildTime, searchTime, build_weight_);
+    }
+
+
+    void evaluate_kdtree(CostData& cost)
+    {
+        StartStopTimer t;
+        int checks;
+        const int nn = 1;
+
+        Logger::info("KDTree using params: trees=%d\n", get_param<int>(cost.params,"trees"));
+        KDTreeIndex<Distance> kdtree(sampledDataset_, cost.params, distance_);
+
+        t.start();
+        kdtree.buildIndex();
+        t.stop();
+        float buildTime = (float)t.value;
+
+        //measure search time
+        float searchTime = test_index_precision(kdtree, sampledDataset_, testDataset_, gt_matches_, target_precision_, checks, distance_, nn);
+
+        float datasetMemory = float(sampledDataset_.rows * sampledDataset_.cols * sizeof(float));
+        cost.memoryCost = (kdtree.usedMemory() + datasetMemory) / datasetMemory;
+        cost.searchTimeCost = searchTime;
+        cost.buildTimeCost = buildTime;
+        Logger::info("KDTree buildTime=%g, searchTime=%g\n", buildTime, searchTime);
+    }
+
+
+    //    struct KMeansSimpleDownhillFunctor {
+    //
+    //        Autotune& autotuner;
+    //        KMeansSimpleDownhillFunctor(Autotune& autotuner_) : autotuner(autotuner_) {}
+    //
+    //        float operator()(int* params) {
+    //
+    //            float maxFloat = numeric_limits<float>::max();
+    //
+    //            if (params[0]<2) return maxFloat;
+    //            if (params[1]<0) return maxFloat;
+    //
+    //            CostData c;
+    //            c.params["algorithm"] = KMEANS;
+    //            c.params["centers-init"] = CENTERS_RANDOM;
+    //            c.params["branching"] = params[0];
+    //            c.params["max-iterations"] = params[1];
+    //
+    //            autotuner.evaluate_kmeans(c);
+    //
+    //            return c.timeCost;
+    //
+    //        }
+    //    };
+    //
+    //    struct KDTreeSimpleDownhillFunctor {
+    //
+    //        Autotune& autotuner;
+    //        KDTreeSimpleDownhillFunctor(Autotune& autotuner_) : autotuner(autotuner_) {}
+    //
+    //        float operator()(int* params) {
+    //            float maxFloat = numeric_limits<float>::max();
+    //
+    //            if (params[0]<1) return maxFloat;
+    //
+    //            CostData c;
+    //            c.params["algorithm"] = KDTREE;
+    //            c.params["trees"] = params[0];
+    //
+    //            autotuner.evaluate_kdtree(c);
+    //
+    //            return c.timeCost;
+    //
+    //        }
+    //    };
+
+
+
+    void optimizeKMeans(std::vector<CostData>& costs)
+    {
+        Logger::info("KMEANS, Step 1: Exploring parameter space\n");
+
+        // explore kmeans parameters space using combinations of the parameters below
+        int maxIterations[] = { 1, 5, 10, 15 };
+        int branchingFactors[] = { 16, 32, 64, 128, 256 };
+
+        int kmeansParamSpaceSize = FLANN_ARRAY_LEN(maxIterations) * FLANN_ARRAY_LEN(branchingFactors);
+        costs.reserve(costs.size() + kmeansParamSpaceSize);
+
+        // evaluate kmeans for all parameter combinations
+        for (size_t i = 0; i < FLANN_ARRAY_LEN(maxIterations); ++i) {
+            for (size_t j = 0; j < FLANN_ARRAY_LEN(branchingFactors); ++j) {
+                CostData cost;
+                cost.params["algorithm"] = FLANN_INDEX_KMEANS;
+                cost.params["centers_init"] = FLANN_CENTERS_RANDOM;
+                cost.params["iterations"] = maxIterations[i];
+                cost.params["branching"] = branchingFactors[j];
+
+                evaluate_kmeans(cost);
+                costs.push_back(cost);
+            }
+        }
+
+        //         Logger::info("KMEANS, Step 2: simplex-downhill optimization\n");
+        //
+        //         const int n = 2;
+        //         // choose initial simplex points as the best parameters so far
+        //         int kmeansNMPoints[n*(n+1)];
+        //         float kmeansVals[n+1];
+        //         for (int i=0;i<n+1;++i) {
+        //             kmeansNMPoints[i*n] = (int)kmeansCosts[i].params["branching"];
+        //             kmeansNMPoints[i*n+1] = (int)kmeansCosts[i].params["max-iterations"];
+        //             kmeansVals[i] = kmeansCosts[i].timeCost;
+        //         }
+        //         KMeansSimpleDownhillFunctor kmeans_cost_func(*this);
+        //         // run optimization
+        //         optimizeSimplexDownhill(kmeansNMPoints,n,kmeans_cost_func,kmeansVals);
+        //         // store results
+        //         for (int i=0;i<n+1;++i) {
+        //             kmeansCosts[i].params["branching"] = kmeansNMPoints[i*2];
+        //             kmeansCosts[i].params["max-iterations"] = kmeansNMPoints[i*2+1];
+        //             kmeansCosts[i].timeCost = kmeansVals[i];
+        //         }
+    }
+
+
+    void optimizeKDTree(std::vector<CostData>& costs)
+    {
+        Logger::info("KD-TREE, Step 1: Exploring parameter space\n");
+
+        // explore kd-tree parameters space using the parameters below
+        int testTrees[] = { 1, 4, 8, 16, 32 };
+
+        // evaluate kdtree for all parameter combinations
+        for (size_t i = 0; i < FLANN_ARRAY_LEN(testTrees); ++i) {
+            CostData cost;
+            cost.params["algorithm"] = FLANN_INDEX_KDTREE;
+            cost.params["trees"] = testTrees[i];
+
+            evaluate_kdtree(cost);
+            costs.push_back(cost);
+        }
+
+        //         Logger::info("KD-TREE, Step 2: simplex-downhill optimization\n");
+        //
+        //         const int n = 1;
+        //         // choose initial simplex points as the best parameters so far
+        //         int kdtreeNMPoints[n*(n+1)];
+        //         float kdtreeVals[n+1];
+        //         for (int i=0;i<n+1;++i) {
+        //             kdtreeNMPoints[i] = (int)kdtreeCosts[i].params["trees"];
+        //             kdtreeVals[i] = kdtreeCosts[i].timeCost;
+        //         }
+        //         KDTreeSimpleDownhillFunctor kdtree_cost_func(*this);
+        //         // run optimization
+        //         optimizeSimplexDownhill(kdtreeNMPoints,n,kdtree_cost_func,kdtreeVals);
+        //         // store results
+        //         for (int i=0;i<n+1;++i) {
+        //             kdtreeCosts[i].params["trees"] = kdtreeNMPoints[i];
+        //             kdtreeCosts[i].timeCost = kdtreeVals[i];
+        //         }
+    }
+
+    /**
+     *  Chooses the best nearest-neighbor algorithm and estimates the optimal
+     *  parameters to use when building the index (for a given precision).
+     *  Returns a dictionary with the optimal parameters.
+     */
+    IndexParams estimateBuildParams()
+    {
+        std::vector<CostData> costs;
+
+        int sampleSize = int(sample_fraction_ * dataset_.rows);
+        int testSampleSize = std::min(sampleSize / 10, 1000);
+
+        Logger::info("Entering autotuning, dataset size: %d, sampleSize: %d, testSampleSize: %d, target precision: %g\n", dataset_.rows, sampleSize, testSampleSize, target_precision_);
+
+        // For a very small dataset, it makes no sense to build any fancy index, just
+        // use linear search
+        if (testSampleSize < 10) {
+            Logger::info("Choosing linear, dataset too small\n");
+            return LinearIndexParams();
+        }
+
+        // We use a fraction of the original dataset to speedup the autotune algorithm
+        sampledDataset_ = random_sample(dataset_, sampleSize);
+        // We use a cross-validation approach, first we sample a testset from the dataset
+        testDataset_ = random_sample(sampledDataset_, testSampleSize, true);
+
+        // We compute the ground truth using linear search
+        Logger::info("Computing ground truth... \n");
+        gt_matches_ = Matrix<int>(new int[testDataset_.rows], testDataset_.rows, 1);
+        StartStopTimer t;
+        t.start();
+        compute_ground_truth<Distance>(sampledDataset_, testDataset_, gt_matches_, 0, distance_);
+        t.stop();
+
+        CostData linear_cost;
+        linear_cost.searchTimeCost = (float)t.value;
+        linear_cost.buildTimeCost = 0;
+        linear_cost.memoryCost = 0;
+        linear_cost.params["algorithm"] = FLANN_INDEX_LINEAR;
+
+        costs.push_back(linear_cost);
+
+        // Start parameter autotune process
+        Logger::info("Autotuning parameters...\n");
+
+        optimizeKMeans(costs);
+        optimizeKDTree(costs);
+
+        float bestTimeCost = costs[0].searchTimeCost;
+        for (size_t i = 0; i < costs.size(); ++i) {
+            float timeCost = costs[i].buildTimeCost * build_weight_ + costs[i].searchTimeCost;
+            if (timeCost < bestTimeCost) {
+                bestTimeCost = timeCost;
+            }
+        }
+
+        float bestCost = costs[0].searchTimeCost / bestTimeCost;
+        IndexParams bestParams = costs[0].params;
+        if (bestTimeCost > 0) {
+            for (size_t i = 0; i < costs.size(); ++i) {
+                float crtCost = (costs[i].buildTimeCost * build_weight_ + costs[i].searchTimeCost) / bestTimeCost +
+                                memory_weight_ * costs[i].memoryCost;
+                if (crtCost < bestCost) {
+                    bestCost = crtCost;
+                    bestParams = costs[i].params;
+                }
+            }
+        }
+
+        delete[] gt_matches_.data;
+        delete[] testDataset_.data;
+        delete[] sampledDataset_.data;
+
+        return bestParams;
+    }
+
+
+
+    /**
+     *  Estimates the search time parameters needed to get the desired precision.
+     *  Precondition: the index is built
+     *  Postcondition: the searchParams will have the optimum params set, also the speedup obtained over linear search.
+     */
+    float estimateSearchParams(SearchParams& searchParams)
+    {
+        const int nn = 1;
+        const size_t SAMPLE_COUNT = 1000;
+
+        assert(bestIndex_ != NULL); // must have a valid index
+
+        float speedup = 0;
+
+        int samples = (int)std::min(dataset_.rows / 10, SAMPLE_COUNT);
+        if (samples > 0) {
+            Matrix<ElementType> testDataset = random_sample(dataset_, samples);
+
+            Logger::info("Computing ground truth\n");
+
+            // we need to compute the ground truth first
+            Matrix<int> gt_matches(new int[testDataset.rows], testDataset.rows, 1);
+            StartStopTimer t;
+            t.start();
+            compute_ground_truth<Distance>(dataset_, testDataset, gt_matches, 1, distance_);
+            t.stop();
+            float linear = (float)t.value;
+
+            int checks;
+            Logger::info("Estimating number of checks\n");
+
+            float searchTime;
+            float cb_index;
+            if (bestIndex_->getType() == FLANN_INDEX_KMEANS) {
+                Logger::info("KMeans algorithm, estimating cluster border factor\n");
+                KMeansIndex<Distance>* kmeans = (KMeansIndex<Distance>*)bestIndex_;
+                float bestSearchTime = -1;
+                float best_cb_index = -1;
+                int best_checks = -1;
+                for (cb_index = 0; cb_index < 1.1f; cb_index += 0.2f) {
+                    kmeans->set_cb_index(cb_index);
+                    searchTime = test_index_precision(*kmeans, dataset_, testDataset, gt_matches, target_precision_, checks, distance_, nn, 1);
+                    if ((searchTime < bestSearchTime) || (bestSearchTime == -1)) {
+                        bestSearchTime = searchTime;
+                        best_cb_index = cb_index;
+                        best_checks = checks;
+                    }
+                }
+                searchTime = bestSearchTime;
+                cb_index = best_cb_index;
+                checks = best_checks;
+
+                kmeans->set_cb_index(best_cb_index);
+                Logger::info("Optimum cb_index: %g\n", cb_index);
+                bestParams_["cb_index"] = cb_index;
+            }
+            else {
+                searchTime = test_index_precision(*bestIndex_, dataset_, testDataset, gt_matches, target_precision_, checks, distance_, nn, 1);
+            }
+
+            Logger::info("Required number of checks: %d \n", checks);
+            searchParams["checks"] = checks;
+
+            speedup = linear / searchTime;
+
+            delete[] gt_matches.data;
+            delete[] testDataset.data;
+        }
+
+        return speedup;
+    }
+
+private:
+    NNIndex<Distance>* bestIndex_;
+
+    IndexParams bestParams_;
+    SearchParams bestSearchParams_;
+
+    Matrix<ElementType> sampledDataset_;
+    Matrix<ElementType> testDataset_;
+    Matrix<int> gt_matches_;
+
+    float speedup_;
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset_;
+
+    /**
+     * Index parameters
+     */
+    float target_precision_;
+    float build_weight_;
+    float memory_weight_;
+    float sample_fraction_;
+
+    Distance distance_;
+
+
+};
+}
+
+#endif /* OPENCV_FLANN_AUTOTUNED_INDEX_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h
new file mode 100644
index 0000000..527ca1a
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h
@@ -0,0 +1,194 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_COMPOSITE_INDEX_H_
+#define OPENCV_FLANN_COMPOSITE_INDEX_H_
+
+#include "general.h"
+#include "nn_index.h"
+#include "kdtree_index.h"
+#include "kmeans_index.h"
+
+namespace cvflann
+{
+
+/**
+ * Index parameters for the CompositeIndex.
+ */
+struct CompositeIndexParams : public IndexParams
+{
+    CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11,
+                         flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, float cb_index = 0.2 )
+    {
+        (*this)["algorithm"] = FLANN_INDEX_KMEANS;
+        // number of randomized trees to use (for kdtree)
+        (*this)["trees"] = trees;
+        // branching factor
+        (*this)["branching"] = branching;
+        // max iterations to perform in one kmeans clustering (kmeans tree)
+        (*this)["iterations"] = iterations;
+        // algorithm used for picking the initial cluster centers for kmeans tree
+        (*this)["centers_init"] = centers_init;
+        // cluster boundary index. Used when searching the kmeans tree
+        (*this)["cb_index"] = cb_index;
+    }
+};
+
+
+/**
+ * This index builds a kd-tree index and a k-means index and performs nearest
+ * neighbour search both indexes. This gives a slight boost in search performance
+ * as some of the neighbours that are missed by one index are found by the other.
+ */
+template <typename Distance>
+class CompositeIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    /**
+     * Index constructor
+     * @param inputData dataset containing the points to index
+     * @param params Index parameters
+     * @param d Distance functor
+     * @return
+     */
+    CompositeIndex(const Matrix<ElementType>& inputData, const IndexParams& params = CompositeIndexParams(),
+                   Distance d = Distance()) : index_params_(params)
+    {
+        kdtree_index_ = new KDTreeIndex<Distance>(inputData, params, d);
+        kmeans_index_ = new KMeansIndex<Distance>(inputData, params, d);
+
+    }
+
+    CompositeIndex(const CompositeIndex&);
+    CompositeIndex& operator=(const CompositeIndex&);
+
+    virtual ~CompositeIndex()
+    {
+        delete kdtree_index_;
+        delete kmeans_index_;
+    }
+
+    /**
+     * @return The index type
+     */
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_COMPOSITE;
+    }
+
+    /**
+     * @return Size of the index
+     */
+    size_t size() const
+    {
+        return kdtree_index_->size();
+    }
+
+    /**
+     * \returns The dimensionality of the features in this index.
+     */
+    size_t veclen() const
+    {
+        return kdtree_index_->veclen();
+    }
+
+    /**
+     * \returns The amount of memory (in bytes) used by the index.
+     */
+    int usedMemory() const
+    {
+        return kmeans_index_->usedMemory() + kdtree_index_->usedMemory();
+    }
+
+    /**
+     * \brief Builds the index
+     */
+    void buildIndex()
+    {
+        Logger::info("Building kmeans tree...\n");
+        kmeans_index_->buildIndex();
+        Logger::info("Building kdtree tree...\n");
+        kdtree_index_->buildIndex();
+    }
+
+    /**
+     * \brief Saves the index to a stream
+     * \param stream The stream to save the index to
+     */
+    void saveIndex(FILE* stream)
+    {
+        kmeans_index_->saveIndex(stream);
+        kdtree_index_->saveIndex(stream);
+    }
+
+    /**
+     * \brief Loads the index from a stream
+     * \param stream The stream from which the index is loaded
+     */
+    void loadIndex(FILE* stream)
+    {
+        kmeans_index_->loadIndex(stream);
+        kdtree_index_->loadIndex(stream);
+    }
+
+    /**
+     * \returns The index parameters
+     */
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+    /**
+     * \brief Method that searches for nearest-neighbours
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        kmeans_index_->findNeighbors(result, vec, searchParams);
+        kdtree_index_->findNeighbors(result, vec, searchParams);
+    }
+
+private:
+    /** The k-means index */
+    KMeansIndex<Distance>* kmeans_index_;
+
+    /** The kd-tree index */
+    KDTreeIndex<Distance>* kdtree_index_;
+
+    /** The index parameters */
+    const IndexParams index_params_;
+};
+
+}
+
+#endif //OPENCV_FLANN_COMPOSITE_INDEX_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/config.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/config.h
new file mode 100644
index 0000000..56832fd
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/config.h
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2011  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2011  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_CONFIG_H_
+#define OPENCV_FLANN_CONFIG_H_
+
+#ifdef FLANN_VERSION_
+#undef FLANN_VERSION_
+#endif
+#define FLANN_VERSION_ "1.6.10"
+
+#endif /* OPENCV_FLANN_CONFIG_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/defines.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/defines.h
new file mode 100644
index 0000000..f0264f7
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/defines.h
@@ -0,0 +1,177 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2011  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2011  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_DEFINES_H_
+#define OPENCV_FLANN_DEFINES_H_
+
+#include "config.h"
+
+#ifdef FLANN_EXPORT
+#undef FLANN_EXPORT
+#endif
+#ifdef WIN32
+/* win32 dll export/import directives */
+ #ifdef FLANN_EXPORTS
+  #define FLANN_EXPORT __declspec(dllexport)
+ #elif defined(FLANN_STATIC)
+  #define FLANN_EXPORT
+ #else
+  #define FLANN_EXPORT __declspec(dllimport)
+ #endif
+#else
+/* unix needs nothing */
+ #define FLANN_EXPORT
+#endif
+
+
+#ifdef FLANN_DEPRECATED
+#undef FLANN_DEPRECATED
+#endif
+#ifdef __GNUC__
+#define FLANN_DEPRECATED __attribute__ ((deprecated))
+#elif defined(_MSC_VER)
+#define FLANN_DEPRECATED __declspec(deprecated)
+#else
+#pragma message("WARNING: You need to implement FLANN_DEPRECATED for this compiler")
+#define FLANN_DEPRECATED
+#endif
+
+
+#undef FLANN_PLATFORM_32_BIT
+#undef FLANN_PLATFORM_64_BIT
+#if defined __amd64__ || defined __x86_64__ || defined _WIN64 || defined _M_X64
+#define FLANN_PLATFORM_64_BIT
+#else
+#define FLANN_PLATFORM_32_BIT
+#endif
+
+
+#undef FLANN_ARRAY_LEN
+#define FLANN_ARRAY_LEN(a) (sizeof(a)/sizeof(a[0]))
+
+namespace cvflann {
+
+/* Nearest neighbour index algorithms */
+enum flann_algorithm_t
+{
+    FLANN_INDEX_LINEAR = 0,
+    FLANN_INDEX_KDTREE = 1,
+    FLANN_INDEX_KMEANS = 2,
+    FLANN_INDEX_COMPOSITE = 3,
+    FLANN_INDEX_KDTREE_SINGLE = 4,
+    FLANN_INDEX_HIERARCHICAL = 5,
+    FLANN_INDEX_LSH = 6,
+    FLANN_INDEX_SAVED = 254,
+    FLANN_INDEX_AUTOTUNED = 255,
+
+    // deprecated constants, should use the FLANN_INDEX_* ones instead
+    LINEAR = 0,
+    KDTREE = 1,
+    KMEANS = 2,
+    COMPOSITE = 3,
+    KDTREE_SINGLE = 4,
+    SAVED = 254,
+    AUTOTUNED = 255
+};
+
+
+
+enum flann_centers_init_t
+{
+    FLANN_CENTERS_RANDOM = 0,
+    FLANN_CENTERS_GONZALES = 1,
+    FLANN_CENTERS_KMEANSPP = 2,
+    FLANN_CENTERS_GROUPWISE = 3,
+
+    // deprecated constants, should use the FLANN_CENTERS_* ones instead
+    CENTERS_RANDOM = 0,
+    CENTERS_GONZALES = 1,
+    CENTERS_KMEANSPP = 2
+};
+
+enum flann_log_level_t
+{
+    FLANN_LOG_NONE = 0,
+    FLANN_LOG_FATAL = 1,
+    FLANN_LOG_ERROR = 2,
+    FLANN_LOG_WARN = 3,
+    FLANN_LOG_INFO = 4
+};
+
+enum flann_distance_t
+{
+    FLANN_DIST_EUCLIDEAN = 1,
+    FLANN_DIST_L2 = 1,
+    FLANN_DIST_MANHATTAN = 2,
+    FLANN_DIST_L1 = 2,
+    FLANN_DIST_MINKOWSKI = 3,
+    FLANN_DIST_MAX   = 4,
+    FLANN_DIST_HIST_INTERSECT   = 5,
+    FLANN_DIST_HELLINGER = 6,
+    FLANN_DIST_CHI_SQUARE = 7,
+    FLANN_DIST_CS         = 7,
+    FLANN_DIST_KULLBACK_LEIBLER  = 8,
+    FLANN_DIST_KL                = 8,
+    FLANN_DIST_HAMMING          = 9,
+
+    // deprecated constants, should use the FLANN_DIST_* ones instead
+    EUCLIDEAN = 1,
+    MANHATTAN = 2,
+    MINKOWSKI = 3,
+    MAX_DIST   = 4,
+    HIST_INTERSECT   = 5,
+    HELLINGER = 6,
+    CS         = 7,
+    KL         = 8,
+    KULLBACK_LEIBLER  = 8
+};
+
+enum flann_datatype_t
+{
+    FLANN_INT8 = 0,
+    FLANN_INT16 = 1,
+    FLANN_INT32 = 2,
+    FLANN_INT64 = 3,
+    FLANN_UINT8 = 4,
+    FLANN_UINT16 = 5,
+    FLANN_UINT32 = 6,
+    FLANN_UINT64 = 7,
+    FLANN_FLOAT32 = 8,
+    FLANN_FLOAT64 = 9
+};
+
+enum
+{
+    FLANN_CHECKS_UNLIMITED = -1,
+    FLANN_CHECKS_AUTOTUNED = -2
+};
+
+}
+
+#endif /* OPENCV_FLANN_DEFINES_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dist.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dist.h
new file mode 100644
index 0000000..9dbe527
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dist.h
@@ -0,0 +1,905 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_DIST_H_
+#define OPENCV_FLANN_DIST_H_
+
+#include <cmath>
+#include <cstdlib>
+#include <string.h>
+#ifdef _MSC_VER
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
+#else
+#include <stdint.h>
+#endif
+
+#include "defines.h"
+
+#if (defined WIN32 || defined _WIN32) && defined(_M_ARM)
+# include <Intrin.h>
+#endif
+
+#ifdef __ARM_NEON__
+# include "arm_neon.h"
+#endif
+
+namespace cvflann
+{
+
+template<typename T>
+inline T abs(T x) { return (x<0) ? -x : x; }
+
+template<>
+inline int abs<int>(int x) { return ::abs(x); }
+
+template<>
+inline float abs<float>(float x) { return fabsf(x); }
+
+template<>
+inline double abs<double>(double x) { return fabs(x); }
+
+template<typename T>
+struct Accumulator { typedef T Type; };
+template<>
+struct Accumulator<unsigned char>  { typedef float Type; };
+template<>
+struct Accumulator<unsigned short> { typedef float Type; };
+template<>
+struct Accumulator<unsigned int> { typedef float Type; };
+template<>
+struct Accumulator<char>   { typedef float Type; };
+template<>
+struct Accumulator<short>  { typedef float Type; };
+template<>
+struct Accumulator<int> { typedef float Type; };
+
+#undef True
+#undef False
+
+class True
+{
+};
+
+class False
+{
+};
+
+
+/**
+ * Squared Euclidean distance functor.
+ *
+ * This is the simpler, unrolled version. This is preferable for
+ * very low dimensionality data (eg 3D points)
+ */
+template<class T>
+struct L2_Simple
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff;
+        for(size_t i = 0; i < size; ++i ) {
+            diff = *a++ - *b++;
+            result += diff*diff;
+        }
+        return result;
+    }
+
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return (a-b)*(a-b);
+    }
+};
+
+
+
+/**
+ * Squared Euclidean distance functor, optimized version
+ */
+template<class T>
+struct L2
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the squared Euclidean distance between two vectors.
+     *
+     *	This is highly optimised, with loop unrolling, as it is one
+     *	of the most expensive inner loops.
+     *
+     *	The computation of squared root at the end is omitted for
+     *	efficiency.
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = (ResultType)(a[0] - b[0]);
+            diff1 = (ResultType)(a[1] - b[1]);
+            diff2 = (ResultType)(a[2] - b[2]);
+            diff3 = (ResultType)(a[3] - b[3]);
+            result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3;
+            a += 4;
+            b += 4;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            diff0 = (ResultType)(*a++ - *b++);
+            result += diff0 * diff0;
+        }
+        return result;
+    }
+
+    /**
+     *	Partial euclidean distance, using just one dimension. This is used by the
+     *	kd-tree when computing partial distances while traversing the tree.
+     *
+     *	Squared root is omitted for efficiency.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return (a-b)*(a-b);
+    }
+};
+
+
+/*
+ * Manhattan distance functor, optimized version
+ */
+template<class T>
+struct L1
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the Manhattan (L_1) distance between two vectors.
+     *
+     *	This is highly optimised, with loop unrolling, as it is one
+     *	of the most expensive inner loops.
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = (ResultType)abs(a[0] - b[0]);
+            diff1 = (ResultType)abs(a[1] - b[1]);
+            diff2 = (ResultType)abs(a[2] - b[2]);
+            diff3 = (ResultType)abs(a[3] - b[3]);
+            result += diff0 + diff1 + diff2 + diff3;
+            a += 4;
+            b += 4;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            diff0 = (ResultType)abs(*a++ - *b++);
+            result += diff0;
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return abs(a-b);
+    }
+};
+
+
+
+template<class T>
+struct MinkowskiDistance
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    int order;
+
+    MinkowskiDistance(int order_) : order(order_) {}
+
+    /**
+     *  Compute the Minkowsky (L_p) distance between two vectors.
+     *
+     *	This is highly optimised, with loop unrolling, as it is one
+     *	of the most expensive inner loops.
+     *
+     *	The computation of squared root at the end is omitted for
+     *	efficiency.
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = (ResultType)abs(a[0] - b[0]);
+            diff1 = (ResultType)abs(a[1] - b[1]);
+            diff2 = (ResultType)abs(a[2] - b[2]);
+            diff3 = (ResultType)abs(a[3] - b[3]);
+            result += pow(diff0,order) + pow(diff1,order) + pow(diff2,order) + pow(diff3,order);
+            a += 4;
+            b += 4;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            diff0 = (ResultType)abs(*a++ - *b++);
+            result += pow(diff0,order);
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return pow(static_cast<ResultType>(abs(a-b)),order);
+    }
+};
+
+
+
+template<class T>
+struct MaxDistance
+{
+    typedef False is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the max distance (L_infinity) between two vectors.
+     *
+     *  This distance is not a valid kdtree distance, it's not dimensionwise additive.
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = abs(a[0] - b[0]);
+            diff1 = abs(a[1] - b[1]);
+            diff2 = abs(a[2] - b[2]);
+            diff3 = abs(a[3] - b[3]);
+            if (diff0>result) {result = diff0; }
+            if (diff1>result) {result = diff1; }
+            if (diff2>result) {result = diff2; }
+            if (diff3>result) {result = diff3; }
+            a += 4;
+            b += 4;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            diff0 = abs(*a++ - *b++);
+            result = (diff0>result) ? diff0 : result;
+        }
+        return result;
+    }
+
+    /* This distance functor is not dimension-wise additive, which
+     * makes it an invalid kd-tree distance, not implementing the accum_dist method */
+
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Hamming distance functor - counts the bit differences between two strings - useful for the Brief descriptor
+ * bit count of A exclusive XOR'ed with B
+ */
+struct HammingLUT
+{
+    typedef False is_kdtree_distance;
+    typedef False is_vector_space_distance;
+
+    typedef unsigned char ElementType;
+    typedef int ResultType;
+
+    /** this will count the bits in a ^ b
+     */
+    ResultType operator()(const unsigned char* a, const unsigned char* b, size_t size) const
+    {
+        static const uchar popCountTable[] =
+        {
+            0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+            1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+            1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+            2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+            1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+            2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+            2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+            3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
+        };
+        ResultType result = 0;
+        for (size_t i = 0; i < size; i++) {
+            result += popCountTable[a[i] ^ b[i]];
+        }
+        return result;
+    }
+};
+
+/**
+ * Hamming distance functor (pop count between two binary vectors, i.e. xor them and count the number of bits set)
+ * That code was taken from brief.cpp in OpenCV
+ */
+template<class T>
+struct Hamming
+{
+    typedef False is_kdtree_distance;
+    typedef False is_vector_space_distance;
+
+
+    typedef T ElementType;
+    typedef int ResultType;
+
+    template<typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
+    {
+        ResultType result = 0;
+#ifdef __ARM_NEON__
+        {
+            uint32x4_t bits = vmovq_n_u32(0);
+            for (size_t i = 0; i < size; i += 16) {
+                uint8x16_t A_vec = vld1q_u8 (a + i);
+                uint8x16_t B_vec = vld1q_u8 (b + i);
+                uint8x16_t AxorB = veorq_u8 (A_vec, B_vec);
+                uint8x16_t bitsSet = vcntq_u8 (AxorB);
+                uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet);
+                uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8);
+                bits = vaddq_u32(bits, bitSet4);
+            }
+            uint64x2_t bitSet2 = vpaddlq_u32 (bits);
+            result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
+            result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
+        }
+#elif __GNUC__
+        {
+            //for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll)
+            typedef unsigned long long pop_t;
+            const size_t modulo = size % sizeof(pop_t);
+            const pop_t* a2 = reinterpret_cast<const pop_t*> (a);
+            const pop_t* b2 = reinterpret_cast<const pop_t*> (b);
+            const pop_t* a2_end = a2 + (size / sizeof(pop_t));
+
+            for (; a2 != a2_end; ++a2, ++b2) result += __builtin_popcountll((*a2) ^ (*b2));
+
+            if (modulo) {
+                //in the case where size is not dividable by sizeof(size_t)
+                //need to mask off the bits at the end
+                pop_t a_final = 0, b_final = 0;
+                memcpy(&a_final, a2, modulo);
+                memcpy(&b_final, b2, modulo);
+                result += __builtin_popcountll(a_final ^ b_final);
+            }
+        }
+#else // NO NEON and NOT GNUC
+        typedef unsigned long long pop_t;
+        HammingLUT lut;
+        result = lut(reinterpret_cast<const unsigned char*> (a),
+                     reinterpret_cast<const unsigned char*> (b), size * sizeof(pop_t));
+#endif
+        return result;
+    }
+};
+
+template<typename T>
+struct Hamming2
+{
+    typedef False is_kdtree_distance;
+    typedef False is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef int ResultType;
+
+    /** This is popcount_3() from:
+     * http://en.wikipedia.org/wiki/Hamming_weight */
+    unsigned int popcnt32(uint32_t n) const
+    {
+        n -= ((n >> 1) & 0x55555555);
+        n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
+        return (((n + (n >> 4))& 0xF0F0F0F)* 0x1010101) >> 24;
+    }
+
+#ifdef FLANN_PLATFORM_64_BIT
+    unsigned int popcnt64(uint64_t n) const
+    {
+        n -= ((n >> 1) & 0x5555555555555555);
+        n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333);
+        return (((n + (n >> 4))& 0x0f0f0f0f0f0f0f0f)* 0x0101010101010101) >> 56;
+    }
+#endif
+
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
+    {
+#ifdef FLANN_PLATFORM_64_BIT
+        const uint64_t* pa = reinterpret_cast<const uint64_t*>(a);
+        const uint64_t* pb = reinterpret_cast<const uint64_t*>(b);
+        ResultType result = 0;
+        size /= (sizeof(uint64_t)/sizeof(unsigned char));
+        for(size_t i = 0; i < size; ++i ) {
+            result += popcnt64(*pa ^ *pb);
+            ++pa;
+            ++pb;
+        }
+#else
+        const uint32_t* pa = reinterpret_cast<const uint32_t*>(a);
+        const uint32_t* pb = reinterpret_cast<const uint32_t*>(b);
+        ResultType result = 0;
+        size /= (sizeof(uint32_t)/sizeof(unsigned char));
+        for(size_t i = 0; i < size; ++i ) {
+            result += popcnt32(*pa ^ *pb);
+            ++pa;
+            ++pb;
+        }
+#endif
+        return result;
+    }
+};
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+template<class T>
+struct HistIntersectionDistance
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the histogram intersection distance
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType min0, min1, min2, min3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            min0 = (ResultType)(a[0] < b[0] ? a[0] : b[0]);
+            min1 = (ResultType)(a[1] < b[1] ? a[1] : b[1]);
+            min2 = (ResultType)(a[2] < b[2] ? a[2] : b[2]);
+            min3 = (ResultType)(a[3] < b[3] ? a[3] : b[3]);
+            result += min0 + min1 + min2 + min3;
+            a += 4;
+            b += 4;
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            min0 = (ResultType)(*a < *b ? *a : *b);
+            result += min0;
+            ++a;
+            ++b;
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return a<b ? a : b;
+    }
+};
+
+
+
+template<class T>
+struct HellingerDistance
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the Hellinger distance
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = sqrt(static_cast<ResultType>(a[0])) - sqrt(static_cast<ResultType>(b[0]));
+            diff1 = sqrt(static_cast<ResultType>(a[1])) - sqrt(static_cast<ResultType>(b[1]));
+            diff2 = sqrt(static_cast<ResultType>(a[2])) - sqrt(static_cast<ResultType>(b[2]));
+            diff3 = sqrt(static_cast<ResultType>(a[3])) - sqrt(static_cast<ResultType>(b[3]));
+            result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3;
+            a += 4;
+            b += 4;
+        }
+        while (a < last) {
+            diff0 = sqrt(static_cast<ResultType>(*a++)) - sqrt(static_cast<ResultType>(*b++));
+            result += diff0 * diff0;
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        ResultType diff = sqrt(static_cast<ResultType>(a)) - sqrt(static_cast<ResultType>(b));
+        return diff * diff;
+    }
+};
+
+
+template<class T>
+struct ChiSquareDistance
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the chi-square distance
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType sum, diff;
+        Iterator1 last = a + size;
+
+        while (a < last) {
+            sum = (ResultType)(*a + *b);
+            if (sum>0) {
+                diff = (ResultType)(*a - *b);
+                result += diff*diff/sum;
+            }
+            ++a;
+            ++b;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        ResultType result = ResultType();
+        ResultType sum, diff;
+
+        sum = (ResultType)(a+b);
+        if (sum>0) {
+            diff = (ResultType)(a-b);
+            result = diff*diff/sum;
+        }
+        return result;
+    }
+};
+
+
+template<class T>
+struct KL_Divergence
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the Kullback鈥揕eibler divergence
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        Iterator1 last = a + size;
+
+        while (a < last) {
+            if (* b != 0) {
+                ResultType ratio = (ResultType)(*a / *b);
+                if (ratio>0) {
+                    result += *a * log(ratio);
+                }
+            }
+            ++a;
+            ++b;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        ResultType result = ResultType();
+        if( *b != 0 ) {
+            ResultType ratio = (ResultType)(a / b);
+            if (ratio>0) {
+                result = a * log(ratio);
+            }
+        }
+        return result;
+    }
+};
+
+
+
+/*
+ * This is a "zero iterator". It basically behaves like a zero filled
+ * array to all algorithms that use arrays as iterators (STL style).
+ * It's useful when there's a need to compute the distance between feature
+ * and origin it and allows for better compiler optimisation than using a
+ * zero-filled array.
+ */
+template <typename T>
+struct ZeroIterator
+{
+
+    T operator*()
+    {
+        return 0;
+    }
+
+    T operator[](int)
+    {
+        return 0;
+    }
+
+    const ZeroIterator<T>& operator ++()
+    {
+        return *this;
+    }
+
+    ZeroIterator<T> operator ++(int)
+    {
+        return *this;
+    }
+
+    ZeroIterator<T>& operator+=(int)
+    {
+        return *this;
+    }
+
+};
+
+
+/*
+ * Depending on processed distances, some of them are already squared (e.g. L2)
+ * and some are not (e.g.Hamming). In KMeans++ for instance we want to be sure
+ * we are working on ^2 distances, thus following templates to ensure that.
+ */
+template <typename Distance, typename ElementType>
+struct squareDistance
+{
+    typedef typename Distance::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist*dist; }
+};
+
+
+template <typename ElementType>
+struct squareDistance<L2_Simple<ElementType>, ElementType>
+{
+    typedef typename L2_Simple<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+template <typename ElementType>
+struct squareDistance<L2<ElementType>, ElementType>
+{
+    typedef typename L2<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+
+template <typename ElementType>
+struct squareDistance<MinkowskiDistance<ElementType>, ElementType>
+{
+    typedef typename MinkowskiDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+template <typename ElementType>
+struct squareDistance<HellingerDistance<ElementType>, ElementType>
+{
+    typedef typename HellingerDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+template <typename ElementType>
+struct squareDistance<ChiSquareDistance<ElementType>, ElementType>
+{
+    typedef typename ChiSquareDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+
+template <typename Distance>
+typename Distance::ResultType ensureSquareDistance( typename Distance::ResultType dist )
+{
+    typedef typename Distance::ElementType ElementType;
+
+    squareDistance<Distance, ElementType> dummy;
+    return dummy( dist );
+}
+
+
+/*
+ * ...and a template to ensure the user that he will process the normal distance,
+ * and not squared distance, without loosing processing time calling sqrt(ensureSquareDistance)
+ * that will result in doing actually sqrt(dist*dist) for L1 distance for instance.
+ */
+template <typename Distance, typename ElementType>
+struct simpleDistance
+{
+    typedef typename Distance::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+
+template <typename ElementType>
+struct simpleDistance<L2_Simple<ElementType>, ElementType>
+{
+    typedef typename L2_Simple<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+template <typename ElementType>
+struct simpleDistance<L2<ElementType>, ElementType>
+{
+    typedef typename L2<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+
+template <typename ElementType>
+struct simpleDistance<MinkowskiDistance<ElementType>, ElementType>
+{
+    typedef typename MinkowskiDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+template <typename ElementType>
+struct simpleDistance<HellingerDistance<ElementType>, ElementType>
+{
+    typedef typename HellingerDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+template <typename ElementType>
+struct simpleDistance<ChiSquareDistance<ElementType>, ElementType>
+{
+    typedef typename ChiSquareDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+
+template <typename Distance>
+typename Distance::ResultType ensureSimpleDistance( typename Distance::ResultType dist )
+{
+    typedef typename Distance::ElementType ElementType;
+
+    simpleDistance<Distance, ElementType> dummy;
+    return dummy( dist );
+}
+
+}
+
+#endif //OPENCV_FLANN_DIST_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h
new file mode 100644
index 0000000..26bd3fa
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h
@@ -0,0 +1,16 @@
+
+#ifndef OPENCV_FLANN_DUMMY_H_
+#define OPENCV_FLANN_DUMMY_H_
+
+namespace cvflann
+{
+
+#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS
+__declspec(dllexport)
+#endif
+void dummyfunc();
+
+}
+
+
+#endif  /* OPENCV_FLANN_DUMMY_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h
new file mode 100644
index 0000000..d795b5d
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h
@@ -0,0 +1,159 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+/***********************************************************************
+ * Author: Vincent Rabaud
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_DYNAMIC_BITSET_H_
+#define OPENCV_FLANN_DYNAMIC_BITSET_H_
+
+#ifndef FLANN_USE_BOOST
+#  define FLANN_USE_BOOST 0
+#endif
+//#define FLANN_USE_BOOST 1
+#if FLANN_USE_BOOST
+#include <boost/dynamic_bitset.hpp>
+typedef boost::dynamic_bitset<> DynamicBitset;
+#else
+
+#include <limits.h>
+
+#include "dist.h"
+
+namespace cvflann {
+
+/** Class re-implementing the boost version of it
+ * This helps not depending on boost, it also does not do the bound checks
+ * and has a way to reset a block for speed
+ */
+class DynamicBitset
+{
+public:
+    /** default constructor
+     */
+    DynamicBitset()
+    {
+    }
+
+    /** only constructor we use in our code
+     * @param sz the size of the bitset (in bits)
+     */
+    DynamicBitset(size_t sz)
+    {
+        resize(sz);
+        reset();
+    }
+
+    /** Sets all the bits to 0
+     */
+    void clear()
+    {
+        std::fill(bitset_.begin(), bitset_.end(), 0);
+    }
+
+    /** @brief checks if the bitset is empty
+     * @return true if the bitset is empty
+     */
+    bool empty() const
+    {
+        return bitset_.empty();
+    }
+
+    /** set all the bits to 0
+     */
+    void reset()
+    {
+        std::fill(bitset_.begin(), bitset_.end(), 0);
+    }
+
+    /** @brief set one bit to 0
+     * @param index
+     */
+    void reset(size_t index)
+    {
+        bitset_[index / cell_bit_size_] &= ~(size_t(1) << (index % cell_bit_size_));
+    }
+
+    /** @brief sets a specific bit to 0, and more bits too
+     * This function is useful when resetting a given set of bits so that the
+     * whole bitset ends up being 0: if that's the case, we don't care about setting
+     * other bits to 0
+     * @param index
+     */
+    void reset_block(size_t index)
+    {
+        bitset_[index / cell_bit_size_] = 0;
+    }
+
+    /** resize the bitset so that it contains at least sz bits
+     * @param sz
+     */
+    void resize(size_t sz)
+    {
+        size_ = sz;
+        bitset_.resize(sz / cell_bit_size_ + 1);
+    }
+
+    /** set a bit to true
+     * @param index the index of the bit to set to 1
+     */
+    void set(size_t index)
+    {
+        bitset_[index / cell_bit_size_] |= size_t(1) << (index % cell_bit_size_);
+    }
+
+    /** gives the number of contained bits
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /** check if a bit is set
+     * @param index the index of the bit to check
+     * @return true if the bit is set
+     */
+    bool test(size_t index) const
+    {
+        return (bitset_[index / cell_bit_size_] & (size_t(1) << (index % cell_bit_size_))) != 0;
+    }
+
+private:
+    std::vector<size_t> bitset_;
+    size_t size_;
+    static const unsigned int cell_bit_size_ = CHAR_BIT * sizeof(size_t);
+};
+
+} // namespace cvflann
+
+#endif
+
+#endif // OPENCV_FLANN_DYNAMIC_BITSET_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp
new file mode 100644
index 0000000..227683f
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/flann.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp
new file mode 100644
index 0000000..98c33cf
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp
@@ -0,0 +1,290 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_BASE_HPP_
+#define OPENCV_FLANN_BASE_HPP_
+
+#include <vector>
+#include <cassert>
+#include <cstdio>
+
+#include "general.h"
+#include "matrix.h"
+#include "params.h"
+#include "saving.h"
+
+#include "all_indices.h"
+
+namespace cvflann
+{
+
+/**
+ * Sets the log level used for all flann functions
+ * @param level Verbosity level
+ */
+inline void log_verbosity(int level)
+{
+    if (level >= 0) {
+        Logger::setLevel(level);
+    }
+}
+
+/**
+ * (Deprecated) Index parameters for creating a saved index.
+ */
+struct SavedIndexParams : public IndexParams
+{
+    SavedIndexParams(cv::String filename)
+    {
+        (* this)["algorithm"] = FLANN_INDEX_SAVED;
+        (*this)["filename"] = filename;
+    }
+};
+
+
+template<typename Distance>
+NNIndex<Distance>* load_saved_index(const Matrix<typename Distance::ElementType>& dataset, const cv::String& filename, Distance distance)
+{
+    typedef typename Distance::ElementType ElementType;
+
+    FILE* fin = fopen(filename.c_str(), "rb");
+    if (fin == NULL) {
+        return NULL;
+    }
+    IndexHeader header = load_header(fin);
+    if (header.data_type != Datatype<ElementType>::type()) {
+        throw FLANNException("Datatype of saved index is different than of the one to be created.");
+    }
+    if ((size_t(header.rows) != dataset.rows)||(size_t(header.cols) != dataset.cols)) {
+        throw FLANNException("The index saved belongs to a different dataset");
+    }
+
+    IndexParams params;
+    params["algorithm"] = header.index_type;
+    NNIndex<Distance>* nnIndex = create_index_by_type<Distance>(dataset, params, distance);
+    nnIndex->loadIndex(fin);
+    fclose(fin);
+
+    return nnIndex;
+}
+
+
+template<typename Distance>
+class Index : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    Index(const Matrix<ElementType>& features, const IndexParams& params, Distance distance = Distance() )
+        : index_params_(params)
+    {
+        flann_algorithm_t index_type = get_param<flann_algorithm_t>(params,"algorithm");
+        loaded_ = false;
+
+        if (index_type == FLANN_INDEX_SAVED) {
+            nnIndex_ = load_saved_index<Distance>(features, get_param<cv::String>(params,"filename"), distance);
+            loaded_ = true;
+        }
+        else {
+            nnIndex_ = create_index_by_type<Distance>(features, params, distance);
+        }
+    }
+
+    ~Index()
+    {
+        delete nnIndex_;
+    }
+
+    /**
+     * Builds the index.
+     */
+    void buildIndex()
+    {
+        if (!loaded_) {
+            nnIndex_->buildIndex();
+        }
+    }
+
+    void save(cv::String filename)
+    {
+        FILE* fout = fopen(filename.c_str(), "wb");
+        if (fout == NULL) {
+            throw FLANNException("Cannot open file");
+        }
+        save_header(fout, *nnIndex_);
+        saveIndex(fout);
+        fclose(fout);
+    }
+
+    /**
+     * \brief Saves the index to a stream
+     * \param stream The stream to save the index to
+     */
+    virtual void saveIndex(FILE* stream)
+    {
+        nnIndex_->saveIndex(stream);
+    }
+
+    /**
+     * \brief Loads the index from a stream
+     * \param stream The stream from which the index is loaded
+     */
+    virtual void loadIndex(FILE* stream)
+    {
+        nnIndex_->loadIndex(stream);
+    }
+
+    /**
+     * \returns number of features in this index.
+     */
+    size_t veclen() const
+    {
+        return nnIndex_->veclen();
+    }
+
+    /**
+     * \returns The dimensionality of the features in this index.
+     */
+    size_t size() const
+    {
+        return nnIndex_->size();
+    }
+
+    /**
+     * \returns The index type (kdtree, kmeans,...)
+     */
+    flann_algorithm_t getType() const
+    {
+        return nnIndex_->getType();
+    }
+
+    /**
+     * \returns The amount of memory (in bytes) used by the index.
+     */
+    virtual int usedMemory() const
+    {
+        return nnIndex_->usedMemory();
+    }
+
+
+    /**
+     * \returns The index parameters
+     */
+    IndexParams getParameters() const
+    {
+        return nnIndex_->getParameters();
+    }
+
+    /**
+     * \brief Perform k-nearest neighbor search
+     * \param[in] queries The query points for which to find the nearest neighbors
+     * \param[out] indices The indices of the nearest neighbors found
+     * \param[out] dists Distances to the nearest neighbors found
+     * \param[in] knn Number of nearest neighbors to return
+     * \param[in] params Search parameters
+     */
+    void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
+    {
+        nnIndex_->knnSearch(queries, indices, dists, knn, params);
+    }
+
+    /**
+     * \brief Perform radius search
+     * \param[in] query The query point
+     * \param[out] indices The indinces of the neighbors found within the given radius
+     * \param[out] dists The distances to the nearest neighbors found
+     * \param[in] radius The radius used for search
+     * \param[in] params Search parameters
+     * \returns Number of neighbors found
+     */
+    int radiusSearch(const Matrix<ElementType>& query, Matrix<int>& indices, Matrix<DistanceType>& dists, float radius, const SearchParams& params)
+    {
+        return nnIndex_->radiusSearch(query, indices, dists, radius, params);
+    }
+
+    /**
+     * \brief Method that searches for nearest-neighbours
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        nnIndex_->findNeighbors(result, vec, searchParams);
+    }
+
+    /**
+     * \brief Returns actual index
+     */
+    FLANN_DEPRECATED NNIndex<Distance>* getIndex()
+    {
+        return nnIndex_;
+    }
+
+    /**
+     * \brief Returns index parameters.
+     * \deprecated use getParameters() instead.
+     */
+    FLANN_DEPRECATED  const IndexParams* getIndexParameters()
+    {
+        return &index_params_;
+    }
+
+private:
+    /** Pointer to actual index class */
+    NNIndex<Distance>* nnIndex_;
+    /** Indices if the index was loaded from a file */
+    bool loaded_;
+    /** Parameters passed to the index */
+    IndexParams index_params_;
+};
+
+/**
+ * Performs a hierarchical clustering of the points passed as argument and then takes a cut in the
+ * the clustering tree to return a flat clustering.
+ * @param[in] points Points to be clustered
+ * @param centers The computed cluster centres. Matrix should be preallocated and centers.rows is the
+ *  number of clusters requested.
+ * @param params Clustering parameters (The same as for cvflann::KMeansIndex)
+ * @param d Distance to be used for clustering (eg: cvflann::L2)
+ * @return number of clusters computed (can be different than clusters.rows and is the highest number
+ * of the form (branching-1)*K+1 smaller than clusters.rows).
+ */
+template <typename Distance>
+int hierarchicalClustering(const Matrix<typename Distance::ElementType>& points, Matrix<typename Distance::ResultType>& centers,
+                           const KMeansIndexParams& params, Distance d = Distance())
+{
+    KMeansIndex<Distance> kmeans(points, params, d);
+    kmeans.buildIndex();
+
+    int clusterNum = kmeans.getClusterCenters(centers);
+    return clusterNum;
+}
+
+}
+#endif /* OPENCV_FLANN_BASE_HPP_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/general.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/general.h
new file mode 100644
index 0000000..9d5402a
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/general.h
@@ -0,0 +1,50 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_GENERAL_H_
+#define OPENCV_FLANN_GENERAL_H_
+
+#include "opencv2/core.hpp"
+
+namespace cvflann
+{
+
+class FLANNException : public cv::Exception
+{
+public:
+    FLANNException(const char* message) : cv::Exception(0, message, "", __FILE__, __LINE__) { }
+
+    FLANNException(const cv::String& message) : cv::Exception(0, message, "", __FILE__, __LINE__) { }
+};
+
+}
+
+
+#endif  /* OPENCV_FLANN_GENERAL_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h
new file mode 100644
index 0000000..fd8f3ae
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h
@@ -0,0 +1,94 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_GROUND_TRUTH_H_
+#define OPENCV_FLANN_GROUND_TRUTH_H_
+
+#include "dist.h"
+#include "matrix.h"
+
+
+namespace cvflann
+{
+
+template <typename Distance>
+void find_nearest(const Matrix<typename Distance::ElementType>& dataset, typename Distance::ElementType* query, int* matches, int nn,
+                  int skip = 0, Distance distance = Distance())
+{
+    typedef typename Distance::ResultType DistanceType;
+    int n = nn + skip;
+
+    std::vector<int> match(n);
+    std::vector<DistanceType> dists(n);
+
+    dists[0] = distance(dataset[0], query, dataset.cols);
+    match[0] = 0;
+    int dcnt = 1;
+
+    for (size_t i=1; i<dataset.rows; ++i) {
+        DistanceType tmp = distance(dataset[i], query, dataset.cols);
+
+        if (dcnt<n) {
+            match[dcnt] = (int)i;
+            dists[dcnt++] = tmp;
+        }
+        else if (tmp < dists[dcnt-1]) {
+            dists[dcnt-1] = tmp;
+            match[dcnt-1] = (int)i;
+        }
+
+        int j = dcnt-1;
+        // bubble up
+        while (j>=1 && dists[j]<dists[j-1]) {
+            std::swap(dists[j],dists[j-1]);
+            std::swap(match[j],match[j-1]);
+            j--;
+        }
+    }
+
+    for (int i=0; i<nn; ++i) {
+        matches[i] = match[i+skip];
+    }
+}
+
+
+template <typename Distance>
+void compute_ground_truth(const Matrix<typename Distance::ElementType>& dataset, const Matrix<typename Distance::ElementType>& testset, Matrix<int>& matches,
+                          int skip=0, Distance d = Distance())
+{
+    for (size_t i=0; i<testset.rows; ++i) {
+        find_nearest<Distance>(dataset, testset[i], matches[i], (int)matches.cols, skip, d);
+    }
+}
+
+
+}
+
+#endif //OPENCV_FLANN_GROUND_TRUTH_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h
new file mode 100644
index 0000000..80d23b9
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h
@@ -0,0 +1,231 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_HDF5_H_
+#define OPENCV_FLANN_HDF5_H_
+
+#include <hdf5.h>
+
+#include "matrix.h"
+
+
+namespace cvflann
+{
+
+namespace
+{
+
+template<typename T>
+hid_t get_hdf5_type()
+{
+    throw FLANNException("Unsupported type for IO operations");
+}
+
+template<>
+hid_t get_hdf5_type<char>() { return H5T_NATIVE_CHAR; }
+template<>
+hid_t get_hdf5_type<unsigned char>() { return H5T_NATIVE_UCHAR; }
+template<>
+hid_t get_hdf5_type<short int>() { return H5T_NATIVE_SHORT; }
+template<>
+hid_t get_hdf5_type<unsigned short int>() { return H5T_NATIVE_USHORT; }
+template<>
+hid_t get_hdf5_type<int>() { return H5T_NATIVE_INT; }
+template<>
+hid_t get_hdf5_type<unsigned int>() { return H5T_NATIVE_UINT; }
+template<>
+hid_t get_hdf5_type<long>() { return H5T_NATIVE_LONG; }
+template<>
+hid_t get_hdf5_type<unsigned long>() { return H5T_NATIVE_ULONG; }
+template<>
+hid_t get_hdf5_type<float>() { return H5T_NATIVE_FLOAT; }
+template<>
+hid_t get_hdf5_type<double>() { return H5T_NATIVE_DOUBLE; }
+}
+
+
+#define CHECK_ERROR(x,y) if ((x)<0) throw FLANNException((y));
+
+template<typename T>
+void save_to_file(const cvflann::Matrix<T>& dataset, const String& filename, const String& name)
+{
+
+#if H5Eset_auto_vers == 2
+    H5Eset_auto( H5E_DEFAULT, NULL, NULL );
+#else
+    H5Eset_auto( NULL, NULL );
+#endif
+
+    herr_t status;
+    hid_t file_id;
+    file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
+    if (file_id < 0) {
+        file_id = H5Fcreate(filename.c_str(), H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
+    }
+    CHECK_ERROR(file_id,"Error creating hdf5 file.");
+
+    hsize_t     dimsf[2];              // dataset dimensions
+    dimsf[0] = dataset.rows;
+    dimsf[1] = dataset.cols;
+
+    hid_t space_id = H5Screate_simple(2, dimsf, NULL);
+    hid_t memspace_id = H5Screate_simple(2, dimsf, NULL);
+
+    hid_t dataset_id;
+#if H5Dcreate_vers == 2
+    dataset_id = H5Dcreate2(file_id, name.c_str(), get_hdf5_type<T>(), space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+    dataset_id = H5Dcreate(file_id, name.c_str(), get_hdf5_type<T>(), space_id, H5P_DEFAULT);
+#endif
+
+    if (dataset_id<0) {
+#if H5Dopen_vers == 2
+        dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
+#else
+        dataset_id = H5Dopen(file_id, name.c_str());
+#endif
+    }
+    CHECK_ERROR(dataset_id,"Error creating or opening dataset in file.");
+
+    status = H5Dwrite(dataset_id, get_hdf5_type<T>(), memspace_id, space_id, H5P_DEFAULT, dataset.data );
+    CHECK_ERROR(status, "Error writing to dataset");
+
+    H5Sclose(memspace_id);
+    H5Sclose(space_id);
+    H5Dclose(dataset_id);
+    H5Fclose(file_id);
+
+}
+
+
+template<typename T>
+void load_from_file(cvflann::Matrix<T>& dataset, const String& filename, const String& name)
+{
+    herr_t status;
+    hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
+    CHECK_ERROR(file_id,"Error opening hdf5 file.");
+
+    hid_t dataset_id;
+#if H5Dopen_vers == 2
+    dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
+#else
+    dataset_id = H5Dopen(file_id, name.c_str());
+#endif
+    CHECK_ERROR(dataset_id,"Error opening dataset in file.");
+
+    hid_t space_id = H5Dget_space(dataset_id);
+
+    hsize_t dims_out[2];
+    H5Sget_simple_extent_dims(space_id, dims_out, NULL);
+
+    dataset = cvflann::Matrix<T>(new T[dims_out[0]*dims_out[1]], dims_out[0], dims_out[1]);
+
+    status = H5Dread(dataset_id, get_hdf5_type<T>(), H5S_ALL, H5S_ALL, H5P_DEFAULT, dataset[0]);
+    CHECK_ERROR(status, "Error reading dataset");
+
+    H5Sclose(space_id);
+    H5Dclose(dataset_id);
+    H5Fclose(file_id);
+}
+
+
+#ifdef HAVE_MPI
+
+namespace mpi
+{
+/**
+ * Loads a the hyperslice corresponding to this processor from a hdf5 file.
+ * @param flann_dataset Dataset where the data is loaded
+ * @param filename HDF5 file name
+ * @param name Name of dataset inside file
+ */
+template<typename T>
+void load_from_file(cvflann::Matrix<T>& dataset, const String& filename, const String& name)
+{
+    MPI_Comm comm  = MPI_COMM_WORLD;
+    MPI_Info info  = MPI_INFO_NULL;
+
+    int mpi_size, mpi_rank;
+    MPI_Comm_size(comm, &mpi_size);
+    MPI_Comm_rank(comm, &mpi_rank);
+
+    herr_t status;
+
+    hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS);
+    H5Pset_fapl_mpio(plist_id, comm, info);
+    hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, plist_id);
+    CHECK_ERROR(file_id,"Error opening hdf5 file.");
+    H5Pclose(plist_id);
+    hid_t dataset_id;
+#if H5Dopen_vers == 2
+    dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
+#else
+    dataset_id = H5Dopen(file_id, name.c_str());
+#endif
+    CHECK_ERROR(dataset_id,"Error opening dataset in file.");
+
+    hid_t space_id = H5Dget_space(dataset_id);
+    hsize_t dims[2];
+    H5Sget_simple_extent_dims(space_id, dims, NULL);
+
+    hsize_t count[2];
+    hsize_t offset[2];
+
+    hsize_t item_cnt = dims[0]/mpi_size+(dims[0]%mpi_size==0 ? 0 : 1);
+    hsize_t cnt = (mpi_rank<mpi_size-1 ? item_cnt : dims[0]-item_cnt*(mpi_size-1));
+
+    count[0] = cnt;
+    count[1] = dims[1];
+    offset[0] = mpi_rank*item_cnt;
+    offset[1] = 0;
+
+    hid_t memspace_id = H5Screate_simple(2,count,NULL);
+
+    H5Sselect_hyperslab(space_id, H5S_SELECT_SET, offset, NULL, count, NULL);
+
+    dataset.rows = count[0];
+    dataset.cols = count[1];
+    dataset.data = new T[dataset.rows*dataset.cols];
+
+    plist_id = H5Pcreate(H5P_DATASET_XFER);
+    H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
+    status = H5Dread(dataset_id, get_hdf5_type<T>(), memspace_id, space_id, plist_id, dataset.data);
+    CHECK_ERROR(status, "Error reading dataset");
+
+    H5Pclose(plist_id);
+    H5Sclose(space_id);
+    H5Sclose(memspace_id);
+    H5Dclose(dataset_id);
+    H5Fclose(file_id);
+}
+}
+#endif // HAVE_MPI
+} // namespace cvflann::mpi
+
+#endif /* OPENCV_FLANN_HDF5_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/heap.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/heap.h
new file mode 100644
index 0000000..92a6ea6
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/heap.h
@@ -0,0 +1,165 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_HEAP_H_
+#define OPENCV_FLANN_HEAP_H_
+
+#include <algorithm>
+#include <vector>
+
+namespace cvflann
+{
+
+/**
+ * Priority Queue Implementation
+ *
+ * The priority queue is implemented with a heap.  A heap is a complete
+ * (full) binary tree in which each parent is less than both of its
+ * children, but the order of the children is unspecified.
+ */
+template <typename T>
+class Heap
+{
+
+    /**
+     * Storage array for the heap.
+     * Type T must be comparable.
+     */
+    std::vector<T> heap;
+    int length;
+
+    /**
+     * Number of element in the heap
+     */
+    int count;
+
+
+
+public:
+    /**
+     * Constructor.
+     *
+     * Params:
+     *     sz = heap size
+     */
+
+    Heap(int sz)
+    {
+        length = sz;
+        heap.reserve(length);
+        count = 0;
+    }
+
+    /**
+     *
+     * Returns: heap size
+     */
+    int size()
+    {
+        return count;
+    }
+
+    /**
+     * Tests if the heap is empty
+     *
+     * Returns: true is heap empty, false otherwise
+     */
+    bool empty()
+    {
+        return size()==0;
+    }
+
+    /**
+     * Clears the heap.
+     */
+    void clear()
+    {
+        heap.clear();
+        count = 0;
+    }
+
+    struct CompareT
+    {
+        bool operator()(const T& t_1, const T& t_2) const
+        {
+            return t_2 < t_1;
+        }
+    };
+
+    /**
+     * Insert a new element in the heap.
+     *
+     * We select the next empty leaf node, and then keep moving any larger
+     * parents down until the right location is found to store this element.
+     *
+     * Params:
+     *     value = the new element to be inserted in the heap
+     */
+    void insert(T value)
+    {
+        /* If heap is full, then return without adding this element. */
+        if (count == length) {
+            return;
+        }
+
+        heap.push_back(value);
+        static CompareT compareT;
+        std::push_heap(heap.begin(), heap.end(), compareT);
+        ++count;
+    }
+
+
+
+    /**
+     * Returns the node of minimum value from the heap (top of the heap).
+     *
+     * Params:
+     *     value = out parameter used to return the min element
+     * Returns: false if heap empty
+     */
+    bool popMin(T& value)
+    {
+        if (count == 0) {
+            return false;
+        }
+
+        value = heap[0];
+        static CompareT compareT;
+        std::pop_heap(heap.begin(), heap.end(), compareT);
+        heap.pop_back();
+        --count;
+
+        return true;  /* Return old last node. */
+    }
+};
+
+}
+
+#endif //OPENCV_FLANN_HEAP_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h
new file mode 100644
index 0000000..9d890d4
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h
@@ -0,0 +1,848 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2011  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2011  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_
+#define OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_
+
+#include <algorithm>
+#include <map>
+#include <cassert>
+#include <limits>
+#include <cmath>
+
+#include "general.h"
+#include "nn_index.h"
+#include "dist.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+
+
+namespace cvflann
+{
+
+struct HierarchicalClusteringIndexParams : public IndexParams
+{
+    HierarchicalClusteringIndexParams(int branching = 32,
+                                      flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM,
+                                      int trees = 4, int leaf_size = 100)
+    {
+        (*this)["algorithm"] = FLANN_INDEX_HIERARCHICAL;
+        // The branching factor used in the hierarchical clustering
+        (*this)["branching"] = branching;
+        // Algorithm used for picking the initial cluster centers
+        (*this)["centers_init"] = centers_init;
+        // number of parallel trees to build
+        (*this)["trees"] = trees;
+        // maximum leaf size
+        (*this)["leaf_size"] = leaf_size;
+    }
+};
+
+
+/**
+ * Hierarchical index
+ *
+ * Contains a tree constructed through a hierarchical clustering
+ * and other information for indexing a set of points for nearest-neighbour matching.
+ */
+template <typename Distance>
+class HierarchicalClusteringIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+private:
+
+
+    typedef void (HierarchicalClusteringIndex::* centersAlgFunction)(int, int*, int, int*, int&);
+
+    /**
+     * The function used for choosing the cluster centers.
+     */
+    centersAlgFunction chooseCenters;
+
+
+
+    /**
+     * Chooses the initial centers in the k-means clustering in a random manner.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     *     indices_length = length of indices vector
+     *
+     */
+    void chooseCentersRandom(int k, int* dsindices, int indices_length, int* centers, int& centers_length)
+    {
+        UniqueRandom r(indices_length);
+
+        int index;
+        for (index=0; index<k; ++index) {
+            bool duplicate = true;
+            int rnd;
+            while (duplicate) {
+                duplicate = false;
+                rnd = r.next();
+                if (rnd<0) {
+                    centers_length = index;
+                    return;
+                }
+
+                centers[index] = dsindices[rnd];
+
+                for (int j=0; j<index; ++j) {
+                    DistanceType sq = distance(dataset[centers[index]], dataset[centers[j]], dataset.cols);
+                    if (sq<1e-16) {
+                        duplicate = true;
+                    }
+                }
+            }
+        }
+
+        centers_length = index;
+    }
+
+
+    /**
+     * Chooses the initial centers in the k-means using Gonzales' algorithm
+     * so that the centers are spaced apart from each other.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void chooseCentersGonzales(int k, int* dsindices, int indices_length, int* centers, int& centers_length)
+    {
+        int n = indices_length;
+
+        int rnd = rand_int(n);
+        assert(rnd >=0 && rnd < n);
+
+        centers[0] = dsindices[rnd];
+
+        int index;
+        for (index=1; index<k; ++index) {
+
+            int best_index = -1;
+            DistanceType best_val = 0;
+            for (int j=0; j<n; ++j) {
+                DistanceType dist = distance(dataset[centers[0]],dataset[dsindices[j]],dataset.cols);
+                for (int i=1; i<index; ++i) {
+                    DistanceType tmp_dist = distance(dataset[centers[i]],dataset[dsindices[j]],dataset.cols);
+                    if (tmp_dist<dist) {
+                        dist = tmp_dist;
+                    }
+                }
+                if (dist>best_val) {
+                    best_val = dist;
+                    best_index = j;
+                }
+            }
+            if (best_index!=-1) {
+                centers[index] = dsindices[best_index];
+            }
+            else {
+                break;
+            }
+        }
+        centers_length = index;
+    }
+
+
+    /**
+     * Chooses the initial centers in the k-means using the algorithm
+     * proposed in the KMeans++ paper:
+     * Arthur, David; Vassilvitskii, Sergei - k-means++: The Advantages of Careful Seeding
+     *
+     * Implementation of this function was converted from the one provided in Arthur's code.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void chooseCentersKMeanspp(int k, int* dsindices, int indices_length, int* centers, int& centers_length)
+    {
+        int n = indices_length;
+
+        double currentPot = 0;
+        DistanceType* closestDistSq = new DistanceType[n];
+
+        // Choose one random center and set the closestDistSq values
+        int index = rand_int(n);
+        assert(index >=0 && index < n);
+        centers[0] = dsindices[index];
+
+        // Computing distance^2 will have the advantage of even higher probability further to pick new centers
+        // far from previous centers (and this complies to "k-means++: the advantages of careful seeding" article)
+        for (int i = 0; i < n; i++) {
+            closestDistSq[i] = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols);
+            closestDistSq[i] = ensureSquareDistance<Distance>( closestDistSq[i] );
+            currentPot += closestDistSq[i];
+        }
+
+
+        const int numLocalTries = 1;
+
+        // Choose each center
+        int centerCount;
+        for (centerCount = 1; centerCount < k; centerCount++) {
+
+            // Repeat several trials
+            double bestNewPot = -1;
+            int bestNewIndex = 0;
+            for (int localTrial = 0; localTrial < numLocalTries; localTrial++) {
+
+                // Choose our center - have to be slightly careful to return a valid answer even accounting
+                // for possible rounding errors
+                double randVal = rand_double(currentPot);
+                for (index = 0; index < n-1; index++) {
+                    if (randVal <= closestDistSq[index]) break;
+                    else randVal -= closestDistSq[index];
+                }
+
+                // Compute the new potential
+                double newPot = 0;
+                for (int i = 0; i < n; i++) {
+                    DistanceType dist = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols);
+                    newPot += std::min( ensureSquareDistance<Distance>(dist), closestDistSq[i] );
+                }
+
+                // Store the best result
+                if ((bestNewPot < 0)||(newPot < bestNewPot)) {
+                    bestNewPot = newPot;
+                    bestNewIndex = index;
+                }
+            }
+
+            // Add the appropriate center
+            centers[centerCount] = dsindices[bestNewIndex];
+            currentPot = bestNewPot;
+            for (int i = 0; i < n; i++) {
+                DistanceType dist = distance(dataset[dsindices[i]], dataset[dsindices[bestNewIndex]], dataset.cols);
+                closestDistSq[i] = std::min( ensureSquareDistance<Distance>(dist), closestDistSq[i] );
+            }
+        }
+
+        centers_length = centerCount;
+
+        delete[] closestDistSq;
+    }
+
+
+    /**
+     * Chooses the initial centers in a way inspired by Gonzales (by Pierre-Emmanuel Viel):
+     * select the first point of the list as a candidate, then parse the points list. If another
+     * point is further than current candidate from the other centers, test if it is a good center
+     * of a local aggregation. If it is, replace current candidate by this point. And so on...
+     *
+     * Used with KMeansIndex that computes centers coordinates by averaging positions of clusters points,
+     * this doesn't make a real difference with previous methods. But used with HierarchicalClusteringIndex
+     * class that pick centers among existing points instead of computing the barycenters, there is a real
+     * improvement.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void GroupWiseCenterChooser(int k, int* dsindices, int indices_length, int* centers, int& centers_length)
+    {
+        const float kSpeedUpFactor = 1.3f;
+
+        int n = indices_length;
+
+        DistanceType* closestDistSq = new DistanceType[n];
+
+        // Choose one random center and set the closestDistSq values
+        int index = rand_int(n);
+        assert(index >=0 && index < n);
+        centers[0] = dsindices[index];
+
+        for (int i = 0; i < n; i++) {
+            closestDistSq[i] = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols);
+        }
+
+
+        // Choose each center
+        int centerCount;
+        for (centerCount = 1; centerCount < k; centerCount++) {
+
+            // Repeat several trials
+            double bestNewPot = -1;
+            int bestNewIndex = 0;
+            DistanceType furthest = 0;
+            for (index = 0; index < n; index++) {
+
+                // We will test only the potential of the points further than current candidate
+                if( closestDistSq[index] > kSpeedUpFactor * (float)furthest ) {
+
+                    // Compute the new potential
+                    double newPot = 0;
+                    for (int i = 0; i < n; i++) {
+                        newPot += std::min( distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols)
+                                            , closestDistSq[i] );
+                    }
+
+                    // Store the best result
+                    if ((bestNewPot < 0)||(newPot <= bestNewPot)) {
+                        bestNewPot = newPot;
+                        bestNewIndex = index;
+                        furthest = closestDistSq[index];
+                    }
+                }
+            }
+
+            // Add the appropriate center
+            centers[centerCount] = dsindices[bestNewIndex];
+            for (int i = 0; i < n; i++) {
+                closestDistSq[i] = std::min( distance(dataset[dsindices[i]], dataset[dsindices[bestNewIndex]], dataset.cols)
+                                             , closestDistSq[i] );
+            }
+        }
+
+        centers_length = centerCount;
+
+        delete[] closestDistSq;
+    }
+
+
+public:
+
+
+    /**
+     * Index constructor
+     *
+     * Params:
+     *          inputData = dataset with the input features
+     *          params = parameters passed to the hierarchical k-means algorithm
+     */
+    HierarchicalClusteringIndex(const Matrix<ElementType>& inputData, const IndexParams& index_params = HierarchicalClusteringIndexParams(),
+                                Distance d = Distance())
+        : dataset(inputData), params(index_params), root(NULL), indices(NULL), distance(d)
+    {
+        memoryCounter = 0;
+
+        size_ = dataset.rows;
+        veclen_ = dataset.cols;
+
+        branching_ = get_param(params,"branching",32);
+        centers_init_ = get_param(params,"centers_init", FLANN_CENTERS_RANDOM);
+        trees_ = get_param(params,"trees",4);
+        leaf_size_ = get_param(params,"leaf_size",100);
+
+        if (centers_init_==FLANN_CENTERS_RANDOM) {
+            chooseCenters = &HierarchicalClusteringIndex::chooseCentersRandom;
+        }
+        else if (centers_init_==FLANN_CENTERS_GONZALES) {
+            chooseCenters = &HierarchicalClusteringIndex::chooseCentersGonzales;
+        }
+        else if (centers_init_==FLANN_CENTERS_KMEANSPP) {
+            chooseCenters = &HierarchicalClusteringIndex::chooseCentersKMeanspp;
+        }
+        else if (centers_init_==FLANN_CENTERS_GROUPWISE) {
+            chooseCenters = &HierarchicalClusteringIndex::GroupWiseCenterChooser;
+        }
+        else {
+            throw FLANNException("Unknown algorithm for choosing initial centers.");
+        }
+
+        trees_ = get_param(params,"trees",4);
+        root = new NodePtr[trees_];
+        indices = new int*[trees_];
+
+        for (int i=0; i<trees_; ++i) {
+            root[i] = NULL;
+            indices[i] = NULL;
+        }
+    }
+
+    HierarchicalClusteringIndex(const HierarchicalClusteringIndex&);
+    HierarchicalClusteringIndex& operator=(const HierarchicalClusteringIndex&);
+
+    /**
+     * Index destructor.
+     *
+     * Release the memory used by the index.
+     */
+    virtual ~HierarchicalClusteringIndex()
+    {
+        free_elements();
+
+        if (root!=NULL) {
+            delete[] root;
+        }
+
+        if (indices!=NULL) {
+            delete[] indices;
+        }
+    }
+
+
+    /**
+     * Release the inner elements of indices[]
+     */
+    void free_elements()
+    {
+        if (indices!=NULL) {
+            for(int i=0; i<trees_; ++i) {
+                if (indices[i]!=NULL) {
+                    delete[] indices[i];
+                    indices[i] = NULL;
+                }
+            }
+        }
+    }
+
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return veclen_;
+    }
+
+
+    /**
+     * Computes the inde memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return pool.usedMemory+pool.wastedMemory+memoryCounter;
+    }
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        if (branching_<2) {
+            throw FLANNException("Branching factor must be at least 2");
+        }
+
+        free_elements();
+
+        for (int i=0; i<trees_; ++i) {
+            indices[i] = new int[size_];
+            for (size_t j=0; j<size_; ++j) {
+                indices[i][j] = (int)j;
+            }
+            root[i] = pool.allocate<Node>();
+            computeClustering(root[i], indices[i], (int)size_, branching_,0);
+        }
+    }
+
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_HIERARCHICAL;
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream, branching_);
+        save_value(stream, trees_);
+        save_value(stream, centers_init_);
+        save_value(stream, leaf_size_);
+        save_value(stream, memoryCounter);
+        for (int i=0; i<trees_; ++i) {
+            save_value(stream, *indices[i], size_);
+            save_tree(stream, root[i], i);
+        }
+
+    }
+
+
+    void loadIndex(FILE* stream)
+    {
+        free_elements();
+
+        if (root!=NULL) {
+            delete[] root;
+        }
+
+        if (indices!=NULL) {
+            delete[] indices;
+        }
+
+        load_value(stream, branching_);
+        load_value(stream, trees_);
+        load_value(stream, centers_init_);
+        load_value(stream, leaf_size_);
+        load_value(stream, memoryCounter);
+
+        indices = new int*[trees_];
+        root = new NodePtr[trees_];
+        for (int i=0; i<trees_; ++i) {
+            indices[i] = new int[size_];
+            load_value(stream, *indices[i], size_);
+            load_tree(stream, root[i], i);
+        }
+
+        params["algorithm"] = getType();
+        params["branching"] = branching_;
+        params["trees"] = trees_;
+        params["centers_init"] = centers_init_;
+        params["leaf_size"] = leaf_size_;
+    }
+
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     searchParams = parameters that influence the search algorithm (checks)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+
+        int maxChecks = get_param(searchParams,"checks",32);
+
+        // Priority queue storing intermediate branches in the best-bin-first search
+        Heap<BranchSt>* heap = new Heap<BranchSt>((int)size_);
+
+        std::vector<bool> checked(size_,false);
+        int checks = 0;
+        for (int i=0; i<trees_; ++i) {
+            findNN(root[i], result, vec, checks, maxChecks, heap, checked);
+        }
+
+        BranchSt branch;
+        while (heap->popMin(branch) && (checks<maxChecks || !result.full())) {
+            NodePtr node = branch.node;
+            findNN(node, result, vec, checks, maxChecks, heap, checked);
+        }
+        assert(result.full());
+
+        delete heap;
+
+    }
+
+    IndexParams getParameters() const
+    {
+        return params;
+    }
+
+
+private:
+
+    /**
+     * Struture representing a node in the hierarchical k-means tree.
+     */
+    struct Node
+    {
+        /**
+         * The cluster center index
+         */
+        int pivot;
+        /**
+         * The cluster size (number of points in the cluster)
+         */
+        int size;
+        /**
+         * Child nodes (only for non-terminal nodes)
+         */
+        Node** childs;
+        /**
+         * Node points (only for terminal nodes)
+         */
+        int* indices;
+        /**
+         * Level
+         */
+        int level;
+    };
+    typedef Node* NodePtr;
+
+
+
+    /**
+     * Alias definition for a nicer syntax.
+     */
+    typedef BranchStruct<NodePtr, DistanceType> BranchSt;
+
+
+
+    void save_tree(FILE* stream, NodePtr node, int num)
+    {
+        save_value(stream, *node);
+        if (node->childs==NULL) {
+            int indices_offset = (int)(node->indices - indices[num]);
+            save_value(stream, indices_offset);
+        }
+        else {
+            for(int i=0; i<branching_; ++i) {
+                save_tree(stream, node->childs[i], num);
+            }
+        }
+    }
+
+
+    void load_tree(FILE* stream, NodePtr& node, int num)
+    {
+        node = pool.allocate<Node>();
+        load_value(stream, *node);
+        if (node->childs==NULL) {
+            int indices_offset;
+            load_value(stream, indices_offset);
+            node->indices = indices[num] + indices_offset;
+        }
+        else {
+            node->childs = pool.allocate<NodePtr>(branching_);
+            for(int i=0; i<branching_; ++i) {
+                load_tree(stream, node->childs[i], num);
+            }
+        }
+    }
+
+
+
+
+    void computeLabels(int* dsindices, int indices_length,  int* centers, int centers_length, int* labels, DistanceType& cost)
+    {
+        cost = 0;
+        for (int i=0; i<indices_length; ++i) {
+            ElementType* point = dataset[dsindices[i]];
+            DistanceType dist = distance(point, dataset[centers[0]], veclen_);
+            labels[i] = 0;
+            for (int j=1; j<centers_length; ++j) {
+                DistanceType new_dist = distance(point, dataset[centers[j]], veclen_);
+                if (dist>new_dist) {
+                    labels[i] = j;
+                    dist = new_dist;
+                }
+            }
+            cost += dist;
+        }
+    }
+
+    /**
+     * The method responsible with actually doing the recursive hierarchical
+     * clustering
+     *
+     * Params:
+     *     node = the node to cluster
+     *     indices = indices of the points belonging to the current node
+     *     branching = the branching factor to use in the clustering
+     *
+     * TODO: for 1-sized clusters don't store a cluster center (it's the same as the single cluster point)
+     */
+    void computeClustering(NodePtr node, int* dsindices, int indices_length, int branching, int level)
+    {
+        node->size = indices_length;
+        node->level = level;
+
+        if (indices_length < leaf_size_) { // leaf node
+            node->indices = dsindices;
+            std::sort(node->indices,node->indices+indices_length);
+            node->childs = NULL;
+            return;
+        }
+
+        std::vector<int> centers(branching);
+        std::vector<int> labels(indices_length);
+
+        int centers_length;
+        (this->*chooseCenters)(branching, dsindices, indices_length, &centers[0], centers_length);
+
+        if (centers_length<branching) {
+            node->indices = dsindices;
+            std::sort(node->indices,node->indices+indices_length);
+            node->childs = NULL;
+            return;
+        }
+
+
+        //	assign points to clusters
+        DistanceType cost;
+        computeLabels(dsindices, indices_length, &centers[0], centers_length, &labels[0], cost);
+
+        node->childs = pool.allocate<NodePtr>(branching);
+        int start = 0;
+        int end = start;
+        for (int i=0; i<branching; ++i) {
+            for (int j=0; j<indices_length; ++j) {
+                if (labels[j]==i) {
+                    std::swap(dsindices[j],dsindices[end]);
+                    std::swap(labels[j],labels[end]);
+                    end++;
+                }
+            }
+
+            node->childs[i] = pool.allocate<Node>();
+            node->childs[i]->pivot = centers[i];
+            node->childs[i]->indices = NULL;
+            computeClustering(node->childs[i],dsindices+start, end-start, branching, level+1);
+            start=end;
+        }
+    }
+
+
+
+    /**
+     * Performs one descent in the hierarchical k-means tree. The branches not
+     * visited are stored in a priority queue.
+     *
+     * Params:
+     *      node = node to explore
+     *      result = container for the k-nearest neighbors found
+     *      vec = query points
+     *      checks = how many points in the dataset have been checked so far
+     *      maxChecks = maximum dataset points to checks
+     */
+
+
+    void findNN(NodePtr node, ResultSet<DistanceType>& result, const ElementType* vec, int& checks, int maxChecks,
+                Heap<BranchSt>* heap, std::vector<bool>& checked)
+    {
+        if (node->childs==NULL) {
+            if (checks>=maxChecks) {
+                if (result.full()) return;
+            }
+            for (int i=0; i<node->size; ++i) {
+                int index = node->indices[i];
+                if (!checked[index]) {
+                    DistanceType dist = distance(dataset[index], vec, veclen_);
+                    result.addPoint(dist, index);
+                    checked[index] = true;
+                    ++checks;
+                }
+            }
+        }
+        else {
+            DistanceType* domain_distances = new DistanceType[branching_];
+            int best_index = 0;
+            domain_distances[best_index] = distance(vec, dataset[node->childs[best_index]->pivot], veclen_);
+            for (int i=1; i<branching_; ++i) {
+                domain_distances[i] = distance(vec, dataset[node->childs[i]->pivot], veclen_);
+                if (domain_distances[i]<domain_distances[best_index]) {
+                    best_index = i;
+                }
+            }
+            for (int i=0; i<branching_; ++i) {
+                if (i!=best_index) {
+                    heap->insert(BranchSt(node->childs[i],domain_distances[i]));
+                }
+            }
+            delete[] domain_distances;
+            findNN(node->childs[best_index],result,vec, checks, maxChecks, heap, checked);
+        }
+    }
+
+private:
+
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset;
+
+    /**
+     * Parameters used by this index
+     */
+    IndexParams params;
+
+
+    /**
+     * Number of features in the dataset.
+     */
+    size_t size_;
+
+    /**
+     * Length of each feature.
+     */
+    size_t veclen_;
+
+    /**
+     * The root node in the tree.
+     */
+    NodePtr* root;
+
+    /**
+     *  Array of indices to vectors in the dataset.
+     */
+    int** indices;
+
+
+    /**
+     * The distance
+     */
+    Distance distance;
+
+    /**
+     * Pooled memory allocator.
+     *
+     * Using a pooled memory allocator is more efficient
+     * than allocating memory directly when there is a large
+     * number small of memory allocations.
+     */
+    PooledAllocator pool;
+
+    /**
+     * Memory occupied by the index.
+     */
+    int memoryCounter;
+
+    /** index parameters */
+    int branching_;
+    int trees_;
+    flann_centers_init_t centers_init_;
+    int leaf_size_;
+
+
+};
+
+}
+
+#endif /* OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h
new file mode 100644
index 0000000..d764004
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h
@@ -0,0 +1,318 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_INDEX_TESTING_H_
+#define OPENCV_FLANN_INDEX_TESTING_H_
+
+#include <cstring>
+#include <cassert>
+#include <cmath>
+
+#include "matrix.h"
+#include "nn_index.h"
+#include "result_set.h"
+#include "logger.h"
+#include "timer.h"
+
+
+namespace cvflann
+{
+
+inline int countCorrectMatches(int* neighbors, int* groundTruth, int n)
+{
+    int count = 0;
+    for (int i=0; i<n; ++i) {
+        for (int k=0; k<n; ++k) {
+            if (neighbors[i]==groundTruth[k]) {
+                count++;
+                break;
+            }
+        }
+    }
+    return count;
+}
+
+
+template <typename Distance>
+typename Distance::ResultType computeDistanceRaport(const Matrix<typename Distance::ElementType>& inputData, typename Distance::ElementType* target,
+                                                    int* neighbors, int* groundTruth, int veclen, int n, const Distance& distance)
+{
+    typedef typename Distance::ResultType DistanceType;
+
+    DistanceType ret = 0;
+    for (int i=0; i<n; ++i) {
+        DistanceType den = distance(inputData[groundTruth[i]], target, veclen);
+        DistanceType num = distance(inputData[neighbors[i]], target, veclen);
+
+        if ((den==0)&&(num==0)) {
+            ret += 1;
+        }
+        else {
+            ret += num/den;
+        }
+    }
+
+    return ret;
+}
+
+template <typename Distance>
+float search_with_ground_truth(NNIndex<Distance>& index, const Matrix<typename Distance::ElementType>& inputData,
+                               const Matrix<typename Distance::ElementType>& testData, const Matrix<int>& matches, int nn, int checks,
+                               float& time, typename Distance::ResultType& dist, const Distance& distance, int skipMatches)
+{
+    typedef typename Distance::ResultType DistanceType;
+
+    if (matches.cols<size_t(nn)) {
+        Logger::info("matches.cols=%d, nn=%d\n",matches.cols,nn);
+
+        throw FLANNException("Ground truth is not computed for as many neighbors as requested");
+    }
+
+    KNNResultSet<DistanceType> resultSet(nn+skipMatches);
+    SearchParams searchParams(checks);
+
+    std::vector<int> indices(nn+skipMatches);
+    std::vector<DistanceType> dists(nn+skipMatches);
+    int* neighbors = &indices[skipMatches];
+
+    int correct = 0;
+    DistanceType distR = 0;
+    StartStopTimer t;
+    int repeats = 0;
+    while (t.value<0.2) {
+        repeats++;
+        t.start();
+        correct = 0;
+        distR = 0;
+        for (size_t i = 0; i < testData.rows; i++) {
+            resultSet.init(&indices[0], &dists[0]);
+            index.findNeighbors(resultSet, testData[i], searchParams);
+
+            correct += countCorrectMatches(neighbors,matches[i], nn);
+            distR += computeDistanceRaport<Distance>(inputData, testData[i], neighbors, matches[i], (int)testData.cols, nn, distance);
+        }
+        t.stop();
+    }
+    time = float(t.value/repeats);
+
+    float precicion = (float)correct/(nn*testData.rows);
+
+    dist = distR/(testData.rows*nn);
+
+    Logger::info("%8d %10.4g %10.5g %10.5g %10.5g\n",
+                 checks, precicion, time, 1000.0 * time / testData.rows, dist);
+
+    return precicion;
+}
+
+
+template <typename Distance>
+float test_index_checks(NNIndex<Distance>& index, const Matrix<typename Distance::ElementType>& inputData,
+                        const Matrix<typename Distance::ElementType>& testData, const Matrix<int>& matches,
+                        int checks, float& precision, const Distance& distance, int nn = 1, int skipMatches = 0)
+{
+    typedef typename Distance::ResultType DistanceType;
+
+    Logger::info("  Nodes  Precision(%)   Time(s)   Time/vec(ms)  Mean dist\n");
+    Logger::info("---------------------------------------------------------\n");
+
+    float time = 0;
+    DistanceType dist = 0;
+    precision = search_with_ground_truth(index, inputData, testData, matches, nn, checks, time, dist, distance, skipMatches);
+
+    return time;
+}
+
+template <typename Distance>
+float test_index_precision(NNIndex<Distance>& index, const Matrix<typename Distance::ElementType>& inputData,
+                           const Matrix<typename Distance::ElementType>& testData, const Matrix<int>& matches,
+                           float precision, int& checks, const Distance& distance, int nn = 1, int skipMatches = 0)
+{
+    typedef typename Distance::ResultType DistanceType;
+    const float SEARCH_EPS = 0.001f;
+
+    Logger::info("  Nodes  Precision(%)   Time(s)   Time/vec(ms)  Mean dist\n");
+    Logger::info("---------------------------------------------------------\n");
+
+    int c2 = 1;
+    float p2;
+    int c1 = 1;
+    //float p1;
+    float time;
+    DistanceType dist;
+
+    p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
+
+    if (p2>precision) {
+        Logger::info("Got as close as I can\n");
+        checks = c2;
+        return time;
+    }
+
+    while (p2<precision) {
+        c1 = c2;
+        //p1 = p2;
+        c2 *=2;
+        p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
+    }
+
+    int cx;
+    float realPrecision;
+    if (fabs(p2-precision)>SEARCH_EPS) {
+        Logger::info("Start linear estimation\n");
+        // after we got to values in the vecinity of the desired precision
+        // use linear approximation get a better estimation
+
+        cx = (c1+c2)/2;
+        realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches);
+        while (fabs(realPrecision-precision)>SEARCH_EPS) {
+
+            if (realPrecision<precision) {
+                c1 = cx;
+            }
+            else {
+                c2 = cx;
+            }
+            cx = (c1+c2)/2;
+            if (cx==c1) {
+                Logger::info("Got as close as I can\n");
+                break;
+            }
+            realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches);
+        }
+
+        c2 = cx;
+        p2 = realPrecision;
+
+    }
+    else {
+        Logger::info("No need for linear estimation\n");
+        cx = c2;
+        realPrecision = p2;
+    }
+
+    checks = cx;
+    return time;
+}
+
+
+template <typename Distance>
+void test_index_precisions(NNIndex<Distance>& index, const Matrix<typename Distance::ElementType>& inputData,
+                           const Matrix<typename Distance::ElementType>& testData, const Matrix<int>& matches,
+                           float* precisions, int precisions_length, const Distance& distance, int nn = 1, int skipMatches = 0, float maxTime = 0)
+{
+    typedef typename Distance::ResultType DistanceType;
+
+    const float SEARCH_EPS = 0.001;
+
+    // make sure precisions array is sorted
+    std::sort(precisions, precisions+precisions_length);
+
+    int pindex = 0;
+    float precision = precisions[pindex];
+
+    Logger::info("  Nodes  Precision(%)   Time(s)   Time/vec(ms)  Mean dist\n");
+    Logger::info("---------------------------------------------------------\n");
+
+    int c2 = 1;
+    float p2;
+
+    int c1 = 1;
+    float p1;
+
+    float time;
+    DistanceType dist;
+
+    p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
+
+    // if precision for 1 run down the tree is already
+    // better then some of the requested precisions, then
+    // skip those
+    while (precisions[pindex]<p2 && pindex<precisions_length) {
+        pindex++;
+    }
+
+    if (pindex==precisions_length) {
+        Logger::info("Got as close as I can\n");
+        return;
+    }
+
+    for (int i=pindex; i<precisions_length; ++i) {
+
+        precision = precisions[i];
+        while (p2<precision) {
+            c1 = c2;
+            p1 = p2;
+            c2 *=2;
+            p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
+            if ((maxTime> 0)&&(time > maxTime)&&(p2<precision)) return;
+        }
+
+        int cx;
+        float realPrecision;
+        if (fabs(p2-precision)>SEARCH_EPS) {
+            Logger::info("Start linear estimation\n");
+            // after we got to values in the vecinity of the desired precision
+            // use linear approximation get a better estimation
+
+            cx = (c1+c2)/2;
+            realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches);
+            while (fabs(realPrecision-precision)>SEARCH_EPS) {
+
+                if (realPrecision<precision) {
+                    c1 = cx;
+                }
+                else {
+                    c2 = cx;
+                }
+                cx = (c1+c2)/2;
+                if (cx==c1) {
+                    Logger::info("Got as close as I can\n");
+                    break;
+                }
+                realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches);
+            }
+
+            c2 = cx;
+            p2 = realPrecision;
+
+        }
+        else {
+            Logger::info("No need for linear estimation\n");
+            cx = c2;
+            realPrecision = p2;
+        }
+
+    }
+}
+
+}
+
+#endif //OPENCV_FLANN_INDEX_TESTING_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h
new file mode 100644
index 0000000..dc0971c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h
@@ -0,0 +1,621 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_KDTREE_INDEX_H_
+#define OPENCV_FLANN_KDTREE_INDEX_H_
+
+#include <algorithm>
+#include <map>
+#include <cassert>
+#include <cstring>
+
+#include "general.h"
+#include "nn_index.h"
+#include "dynamic_bitset.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+
+
+namespace cvflann
+{
+
+struct KDTreeIndexParams : public IndexParams
+{
+    KDTreeIndexParams(int trees = 4)
+    {
+        (*this)["algorithm"] = FLANN_INDEX_KDTREE;
+        (*this)["trees"] = trees;
+    }
+};
+
+
+/**
+ * Randomized kd-tree index
+ *
+ * Contains the k-d trees and other information for indexing a set of points
+ * for nearest-neighbor matching.
+ */
+template <typename Distance>
+class KDTreeIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+
+    /**
+     * KDTree constructor
+     *
+     * Params:
+     *          inputData = dataset with the input features
+     *          params = parameters passed to the kdtree algorithm
+     */
+    KDTreeIndex(const Matrix<ElementType>& inputData, const IndexParams& params = KDTreeIndexParams(),
+                Distance d = Distance() ) :
+        dataset_(inputData), index_params_(params), distance_(d)
+    {
+        size_ = dataset_.rows;
+        veclen_ = dataset_.cols;
+
+        trees_ = get_param(index_params_,"trees",4);
+        tree_roots_ = new NodePtr[trees_];
+
+        // Create a permutable array of indices to the input vectors.
+        vind_.resize(size_);
+        for (size_t i = 0; i < size_; ++i) {
+            vind_[i] = int(i);
+        }
+
+        mean_ = new DistanceType[veclen_];
+        var_ = new DistanceType[veclen_];
+    }
+
+
+    KDTreeIndex(const KDTreeIndex&);
+    KDTreeIndex& operator=(const KDTreeIndex&);
+
+    /**
+     * Standard destructor
+     */
+    ~KDTreeIndex()
+    {
+        if (tree_roots_!=NULL) {
+            delete[] tree_roots_;
+        }
+        delete[] mean_;
+        delete[] var_;
+    }
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        /* Construct the randomized trees. */
+        for (int i = 0; i < trees_; i++) {
+            /* Randomize the order of vectors to allow for unbiased sampling. */
+            std::random_shuffle(vind_.begin(), vind_.end());
+            tree_roots_[i] = divideTree(&vind_[0], int(size_) );
+        }
+    }
+
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_KDTREE;
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream, trees_);
+        for (int i=0; i<trees_; ++i) {
+            save_tree(stream, tree_roots_[i]);
+        }
+    }
+
+
+
+    void loadIndex(FILE* stream)
+    {
+        load_value(stream, trees_);
+        if (tree_roots_!=NULL) {
+            delete[] tree_roots_;
+        }
+        tree_roots_ = new NodePtr[trees_];
+        for (int i=0; i<trees_; ++i) {
+            load_tree(stream,tree_roots_[i]);
+        }
+
+        index_params_["algorithm"] = getType();
+        index_params_["trees"] = tree_roots_;
+    }
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return veclen_;
+    }
+
+    /**
+     * Computes the inde memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return int(pool_.usedMemory+pool_.wastedMemory+dataset_.rows*sizeof(int));  // pool memory and vind array memory
+    }
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     maxCheck = the maximum number of restarts (in a best-bin-first manner)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        int maxChecks = get_param(searchParams,"checks", 32);
+        float epsError = 1+get_param(searchParams,"eps",0.0f);
+
+        if (maxChecks==FLANN_CHECKS_UNLIMITED) {
+            getExactNeighbors(result, vec, epsError);
+        }
+        else {
+            getNeighbors(result, vec, maxChecks, epsError);
+        }
+    }
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+private:
+
+
+    /*--------------------- Internal Data Structures --------------------------*/
+    struct Node
+    {
+        /**
+         * Dimension used for subdivision.
+         */
+        int divfeat;
+        /**
+         * The values used for subdivision.
+         */
+        DistanceType divval;
+        /**
+         * The child nodes.
+         */
+        Node* child1, * child2;
+    };
+    typedef Node* NodePtr;
+    typedef BranchStruct<NodePtr, DistanceType> BranchSt;
+    typedef BranchSt* Branch;
+
+
+
+    void save_tree(FILE* stream, NodePtr tree)
+    {
+        save_value(stream, *tree);
+        if (tree->child1!=NULL) {
+            save_tree(stream, tree->child1);
+        }
+        if (tree->child2!=NULL) {
+            save_tree(stream, tree->child2);
+        }
+    }
+
+
+    void load_tree(FILE* stream, NodePtr& tree)
+    {
+        tree = pool_.allocate<Node>();
+        load_value(stream, *tree);
+        if (tree->child1!=NULL) {
+            load_tree(stream, tree->child1);
+        }
+        if (tree->child2!=NULL) {
+            load_tree(stream, tree->child2);
+        }
+    }
+
+
+    /**
+     * Create a tree node that subdivides the list of vecs from vind[first]
+     * to vind[last].  The routine is called recursively on each sublist.
+     * Place a pointer to this new tree node in the location pTree.
+     *
+     * Params: pTree = the new node to create
+     *                  first = index of the first vector
+     *                  last = index of the last vector
+     */
+    NodePtr divideTree(int* ind, int count)
+    {
+        NodePtr node = pool_.allocate<Node>(); // allocate memory
+
+        /* If too few exemplars remain, then make this a leaf node. */
+        if ( count == 1) {
+            node->child1 = node->child2 = NULL;    /* Mark as leaf node. */
+            node->divfeat = *ind;    /* Store index of this vec. */
+        }
+        else {
+            int idx;
+            int cutfeat;
+            DistanceType cutval;
+            meanSplit(ind, count, idx, cutfeat, cutval);
+
+            node->divfeat = cutfeat;
+            node->divval = cutval;
+            node->child1 = divideTree(ind, idx);
+            node->child2 = divideTree(ind+idx, count-idx);
+        }
+
+        return node;
+    }
+
+
+    /**
+     * Choose which feature to use in order to subdivide this set of vectors.
+     * Make a random choice among those with the highest variance, and use
+     * its variance as the threshold value.
+     */
+    void meanSplit(int* ind, int count, int& index, int& cutfeat, DistanceType& cutval)
+    {
+        memset(mean_,0,veclen_*sizeof(DistanceType));
+        memset(var_,0,veclen_*sizeof(DistanceType));
+
+        /* Compute mean values.  Only the first SAMPLE_MEAN values need to be
+            sampled to get a good estimate.
+         */
+        int cnt = std::min((int)SAMPLE_MEAN+1, count);
+        for (int j = 0; j < cnt; ++j) {
+            ElementType* v = dataset_[ind[j]];
+            for (size_t k=0; k<veclen_; ++k) {
+                mean_[k] += v[k];
+            }
+        }
+        for (size_t k=0; k<veclen_; ++k) {
+            mean_[k] /= cnt;
+        }
+
+        /* Compute variances (no need to divide by count). */
+        for (int j = 0; j < cnt; ++j) {
+            ElementType* v = dataset_[ind[j]];
+            for (size_t k=0; k<veclen_; ++k) {
+                DistanceType dist = v[k] - mean_[k];
+                var_[k] += dist * dist;
+            }
+        }
+        /* Select one of the highest variance indices at random. */
+        cutfeat = selectDivision(var_);
+        cutval = mean_[cutfeat];
+
+        int lim1, lim2;
+        planeSplit(ind, count, cutfeat, cutval, lim1, lim2);
+
+        if (lim1>count/2) index = lim1;
+        else if (lim2<count/2) index = lim2;
+        else index = count/2;
+
+        /* If either list is empty, it means that all remaining features
+         * are identical. Split in the middle to maintain a balanced tree.
+         */
+        if ((lim1==count)||(lim2==0)) index = count/2;
+    }
+
+
+    /**
+     * Select the top RAND_DIM largest values from v and return the index of
+     * one of these selected at random.
+     */
+    int selectDivision(DistanceType* v)
+    {
+        int num = 0;
+        size_t topind[RAND_DIM];
+
+        /* Create a list of the indices of the top RAND_DIM values. */
+        for (size_t i = 0; i < veclen_; ++i) {
+            if ((num < RAND_DIM)||(v[i] > v[topind[num-1]])) {
+                /* Put this element at end of topind. */
+                if (num < RAND_DIM) {
+                    topind[num++] = i;            /* Add to list. */
+                }
+                else {
+                    topind[num-1] = i;         /* Replace last element. */
+                }
+                /* Bubble end value down to right location by repeated swapping. */
+                int j = num - 1;
+                while (j > 0  &&  v[topind[j]] > v[topind[j-1]]) {
+                    std::swap(topind[j], topind[j-1]);
+                    --j;
+                }
+            }
+        }
+        /* Select a random integer in range [0,num-1], and return that index. */
+        int rnd = rand_int(num);
+        return (int)topind[rnd];
+    }
+
+
+    /**
+     *  Subdivide the list of points by a plane perpendicular on axe corresponding
+     *  to the 'cutfeat' dimension at 'cutval' position.
+     *
+     *  On return:
+     *  dataset[ind[0..lim1-1]][cutfeat]<cutval
+     *  dataset[ind[lim1..lim2-1]][cutfeat]==cutval
+     *  dataset[ind[lim2..count]][cutfeat]>cutval
+     */
+    void planeSplit(int* ind, int count, int cutfeat, DistanceType cutval, int& lim1, int& lim2)
+    {
+        /* Move vector indices for left subtree to front of list. */
+        int left = 0;
+        int right = count-1;
+        for (;; ) {
+            while (left<=right && dataset_[ind[left]][cutfeat]<cutval) ++left;
+            while (left<=right && dataset_[ind[right]][cutfeat]>=cutval) --right;
+            if (left>right) break;
+            std::swap(ind[left], ind[right]); ++left; --right;
+        }
+        lim1 = left;
+        right = count-1;
+        for (;; ) {
+            while (left<=right && dataset_[ind[left]][cutfeat]<=cutval) ++left;
+            while (left<=right && dataset_[ind[right]][cutfeat]>cutval) --right;
+            if (left>right) break;
+            std::swap(ind[left], ind[right]); ++left; --right;
+        }
+        lim2 = left;
+    }
+
+    /**
+     * Performs an exact nearest neighbor search. The exact search performs a full
+     * traversal of the tree.
+     */
+    void getExactNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, float epsError)
+    {
+        //		checkID -= 1;  /* Set a different unique ID for each search. */
+
+        if (trees_ > 1) {
+            fprintf(stderr,"It doesn't make any sense to use more than one tree for exact search");
+        }
+        if (trees_>0) {
+            searchLevelExact(result, vec, tree_roots_[0], 0.0, epsError);
+        }
+        assert(result.full());
+    }
+
+    /**
+     * Performs the approximate nearest-neighbor search. The search is approximate
+     * because the tree traversal is abandoned after a given number of descends in
+     * the tree.
+     */
+    void getNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, int maxCheck, float epsError)
+    {
+        int i;
+        BranchSt branch;
+
+        int checkCount = 0;
+        Heap<BranchSt>* heap = new Heap<BranchSt>((int)size_);
+        DynamicBitset checked(size_);
+
+        /* Search once through each tree down to root. */
+        for (i = 0; i < trees_; ++i) {
+            searchLevel(result, vec, tree_roots_[i], 0, checkCount, maxCheck, epsError, heap, checked);
+        }
+
+        /* Keep searching other branches from heap until finished. */
+        while ( heap->popMin(branch) && (checkCount < maxCheck || !result.full() )) {
+            searchLevel(result, vec, branch.node, branch.mindist, checkCount, maxCheck, epsError, heap, checked);
+        }
+
+        delete heap;
+
+        assert(result.full());
+    }
+
+
+    /**
+     *  Search starting from a given node of the tree.  Based on any mismatches at
+     *  higher levels, all exemplars below this level must have a distance of
+     *  at least "mindistsq".
+     */
+    void searchLevel(ResultSet<DistanceType>& result_set, const ElementType* vec, NodePtr node, DistanceType mindist, int& checkCount, int maxCheck,
+                     float epsError, Heap<BranchSt>* heap, DynamicBitset& checked)
+    {
+        if (result_set.worstDist()<mindist) {
+            //			printf("Ignoring branch, too far\n");
+            return;
+        }
+
+        /* If this is a leaf node, then do check and return. */
+        if ((node->child1 == NULL)&&(node->child2 == NULL)) {
+            /*  Do not check same node more than once when searching multiple trees.
+                Once a vector is checked, we set its location in vind to the
+                current checkID.
+             */
+            int index = node->divfeat;
+            if ( checked.test(index) || ((checkCount>=maxCheck)&& result_set.full()) ) return;
+            checked.set(index);
+            checkCount++;
+
+            DistanceType dist = distance_(dataset_[index], vec, veclen_);
+            result_set.addPoint(dist,index);
+
+            return;
+        }
+
+        /* Which child branch should be taken first? */
+        ElementType val = vec[node->divfeat];
+        DistanceType diff = val - node->divval;
+        NodePtr bestChild = (diff < 0) ? node->child1 : node->child2;
+        NodePtr otherChild = (diff < 0) ? node->child2 : node->child1;
+
+        /* Create a branch record for the branch not taken.  Add distance
+            of this feature boundary (we don't attempt to correct for any
+            use of this feature in a parent node, which is unlikely to
+            happen and would have only a small effect).  Don't bother
+            adding more branches to heap after halfway point, as cost of
+            adding exceeds their value.
+         */
+
+        DistanceType new_distsq = mindist + distance_.accum_dist(val, node->divval, node->divfeat);
+        //		if (2 * checkCount < maxCheck  ||  !result.full()) {
+        if ((new_distsq*epsError < result_set.worstDist())||  !result_set.full()) {
+            heap->insert( BranchSt(otherChild, new_distsq) );
+        }
+
+        /* Call recursively to search next level down. */
+        searchLevel(result_set, vec, bestChild, mindist, checkCount, maxCheck, epsError, heap, checked);
+    }
+
+    /**
+     * Performs an exact search in the tree starting from a node.
+     */
+    void searchLevelExact(ResultSet<DistanceType>& result_set, const ElementType* vec, const NodePtr node, DistanceType mindist, const float epsError)
+    {
+        /* If this is a leaf node, then do check and return. */
+        if ((node->child1 == NULL)&&(node->child2 == NULL)) {
+            int index = node->divfeat;
+            DistanceType dist = distance_(dataset_[index], vec, veclen_);
+            result_set.addPoint(dist,index);
+            return;
+        }
+
+        /* Which child branch should be taken first? */
+        ElementType val = vec[node->divfeat];
+        DistanceType diff = val - node->divval;
+        NodePtr bestChild = (diff < 0) ? node->child1 : node->child2;
+        NodePtr otherChild = (diff < 0) ? node->child2 : node->child1;
+
+        /* Create a branch record for the branch not taken.  Add distance
+            of this feature boundary (we don't attempt to correct for any
+            use of this feature in a parent node, which is unlikely to
+            happen and would have only a small effect).  Don't bother
+            adding more branches to heap after halfway point, as cost of
+            adding exceeds their value.
+         */
+
+        DistanceType new_distsq = mindist + distance_.accum_dist(val, node->divval, node->divfeat);
+
+        /* Call recursively to search next level down. */
+        searchLevelExact(result_set, vec, bestChild, mindist, epsError);
+
+        if (new_distsq*epsError<=result_set.worstDist()) {
+            searchLevelExact(result_set, vec, otherChild, new_distsq, epsError);
+        }
+    }
+
+
+private:
+
+    enum
+    {
+        /**
+         * To improve efficiency, only SAMPLE_MEAN random values are used to
+         * compute the mean and variance at each level when building a tree.
+         * A value of 100 seems to perform as well as using all values.
+         */
+        SAMPLE_MEAN = 100,
+        /**
+         * Top random dimensions to consider
+         *
+         * When creating random trees, the dimension on which to subdivide is
+         * selected at random from among the top RAND_DIM dimensions with the
+         * highest variance.  A value of 5 works well.
+         */
+        RAND_DIM=5
+    };
+
+
+    /**
+     * Number of randomized trees that are used
+     */
+    int trees_;
+
+    /**
+     *  Array of indices to vectors in the dataset.
+     */
+    std::vector<int> vind_;
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset_;
+
+    IndexParams index_params_;
+
+    size_t size_;
+    size_t veclen_;
+
+
+    DistanceType* mean_;
+    DistanceType* var_;
+
+
+    /**
+     * Array of k-d trees used to find neighbours.
+     */
+    NodePtr* tree_roots_;
+
+    /**
+     * Pooled memory allocator.
+     *
+     * Using a pooled memory allocator is more efficient
+     * than allocating memory directly when there is a large
+     * number small of memory allocations.
+     */
+    PooledAllocator pool_;
+
+    Distance distance_;
+
+
+};   // class KDTreeForest
+
+}
+
+#endif //OPENCV_FLANN_KDTREE_INDEX_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h
new file mode 100644
index 0000000..30488ad
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h
@@ -0,0 +1,634 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_
+#define OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_
+
+#include <algorithm>
+#include <map>
+#include <cassert>
+#include <cstring>
+
+#include "general.h"
+#include "nn_index.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+
+namespace cvflann
+{
+
+struct KDTreeSingleIndexParams : public IndexParams
+{
+    KDTreeSingleIndexParams(int leaf_max_size = 10, bool reorder = true, int dim = -1)
+    {
+        (*this)["algorithm"] = FLANN_INDEX_KDTREE_SINGLE;
+        (*this)["leaf_max_size"] = leaf_max_size;
+        (*this)["reorder"] = reorder;
+        (*this)["dim"] = dim;
+    }
+};
+
+
+/**
+ * Randomized kd-tree index
+ *
+ * Contains the k-d trees and other information for indexing a set of points
+ * for nearest-neighbor matching.
+ */
+template <typename Distance>
+class KDTreeSingleIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+
+    /**
+     * KDTree constructor
+     *
+     * Params:
+     *          inputData = dataset with the input features
+     *          params = parameters passed to the kdtree algorithm
+     */
+    KDTreeSingleIndex(const Matrix<ElementType>& inputData, const IndexParams& params = KDTreeSingleIndexParams(),
+                      Distance d = Distance() ) :
+        dataset_(inputData), index_params_(params), distance_(d)
+    {
+        size_ = dataset_.rows;
+        dim_ = dataset_.cols;
+        int dim_param = get_param(params,"dim",-1);
+        if (dim_param>0) dim_ = dim_param;
+        leaf_max_size_ = get_param(params,"leaf_max_size",10);
+        reorder_ = get_param(params,"reorder",true);
+
+        // Create a permutable array of indices to the input vectors.
+        vind_.resize(size_);
+        for (size_t i = 0; i < size_; i++) {
+            vind_[i] = (int)i;
+        }
+    }
+
+    KDTreeSingleIndex(const KDTreeSingleIndex&);
+    KDTreeSingleIndex& operator=(const KDTreeSingleIndex&);
+
+    /**
+     * Standard destructor
+     */
+    ~KDTreeSingleIndex()
+    {
+        if (reorder_) delete[] data_.data;
+    }
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        computeBoundingBox(root_bbox_);
+        root_node_ = divideTree(0, (int)size_, root_bbox_ );   // construct the tree
+
+        if (reorder_) {
+            delete[] data_.data;
+            data_ = cvflann::Matrix<ElementType>(new ElementType[size_*dim_], size_, dim_);
+            for (size_t i=0; i<size_; ++i) {
+                for (size_t j=0; j<dim_; ++j) {
+                    data_[i][j] = dataset_[vind_[i]][j];
+                }
+            }
+        }
+        else {
+            data_ = dataset_;
+        }
+    }
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_KDTREE_SINGLE;
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream, size_);
+        save_value(stream, dim_);
+        save_value(stream, root_bbox_);
+        save_value(stream, reorder_);
+        save_value(stream, leaf_max_size_);
+        save_value(stream, vind_);
+        if (reorder_) {
+            save_value(stream, data_);
+        }
+        save_tree(stream, root_node_);
+    }
+
+
+    void loadIndex(FILE* stream)
+    {
+        load_value(stream, size_);
+        load_value(stream, dim_);
+        load_value(stream, root_bbox_);
+        load_value(stream, reorder_);
+        load_value(stream, leaf_max_size_);
+        load_value(stream, vind_);
+        if (reorder_) {
+            load_value(stream, data_);
+        }
+        else {
+            data_ = dataset_;
+        }
+        load_tree(stream, root_node_);
+
+
+        index_params_["algorithm"] = getType();
+        index_params_["leaf_max_size"] = leaf_max_size_;
+        index_params_["reorder"] = reorder_;
+    }
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return dim_;
+    }
+
+    /**
+     * Computes the inde memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return (int)(pool_.usedMemory+pool_.wastedMemory+dataset_.rows*sizeof(int));  // pool memory and vind array memory
+    }
+
+
+    /**
+     * \brief Perform k-nearest neighbor search
+     * \param[in] queries The query points for which to find the nearest neighbors
+     * \param[out] indices The indices of the nearest neighbors found
+     * \param[out] dists Distances to the nearest neighbors found
+     * \param[in] knn Number of nearest neighbors to return
+     * \param[in] params Search parameters
+     */
+    void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
+    {
+        assert(queries.cols == veclen());
+        assert(indices.rows >= queries.rows);
+        assert(dists.rows >= queries.rows);
+        assert(int(indices.cols) >= knn);
+        assert(int(dists.cols) >= knn);
+
+        KNNSimpleResultSet<DistanceType> resultSet(knn);
+        for (size_t i = 0; i < queries.rows; i++) {
+            resultSet.init(indices[i], dists[i]);
+            findNeighbors(resultSet, queries[i], params);
+        }
+    }
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     maxCheck = the maximum number of restarts (in a best-bin-first manner)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        float epsError = 1+get_param(searchParams,"eps",0.0f);
+
+        std::vector<DistanceType> dists(dim_,0);
+        DistanceType distsq = computeInitialDistances(vec, dists);
+        searchLevel(result, vec, root_node_, distsq, dists, epsError);
+    }
+
+private:
+
+
+    /*--------------------- Internal Data Structures --------------------------*/
+    struct Node
+    {
+        /**
+         * Indices of points in leaf node
+         */
+        int left, right;
+        /**
+         * Dimension used for subdivision.
+         */
+        int divfeat;
+        /**
+         * The values used for subdivision.
+         */
+        DistanceType divlow, divhigh;
+        /**
+         * The child nodes.
+         */
+        Node* child1, * child2;
+    };
+    typedef Node* NodePtr;
+
+
+    struct Interval
+    {
+        DistanceType low, high;
+    };
+
+    typedef std::vector<Interval> BoundingBox;
+
+    typedef BranchStruct<NodePtr, DistanceType> BranchSt;
+    typedef BranchSt* Branch;
+
+
+
+
+    void save_tree(FILE* stream, NodePtr tree)
+    {
+        save_value(stream, *tree);
+        if (tree->child1!=NULL) {
+            save_tree(stream, tree->child1);
+        }
+        if (tree->child2!=NULL) {
+            save_tree(stream, tree->child2);
+        }
+    }
+
+
+    void load_tree(FILE* stream, NodePtr& tree)
+    {
+        tree = pool_.allocate<Node>();
+        load_value(stream, *tree);
+        if (tree->child1!=NULL) {
+            load_tree(stream, tree->child1);
+        }
+        if (tree->child2!=NULL) {
+            load_tree(stream, tree->child2);
+        }
+    }
+
+
+    void computeBoundingBox(BoundingBox& bbox)
+    {
+        bbox.resize(dim_);
+        for (size_t i=0; i<dim_; ++i) {
+            bbox[i].low = (DistanceType)dataset_[0][i];
+            bbox[i].high = (DistanceType)dataset_[0][i];
+        }
+        for (size_t k=1; k<dataset_.rows; ++k) {
+            for (size_t i=0; i<dim_; ++i) {
+                if (dataset_[k][i]<bbox[i].low) bbox[i].low = (DistanceType)dataset_[k][i];
+                if (dataset_[k][i]>bbox[i].high) bbox[i].high = (DistanceType)dataset_[k][i];
+            }
+        }
+    }
+
+
+    /**
+     * Create a tree node that subdivides the list of vecs from vind[first]
+     * to vind[last].  The routine is called recursively on each sublist.
+     * Place a pointer to this new tree node in the location pTree.
+     *
+     * Params: pTree = the new node to create
+     *                  first = index of the first vector
+     *                  last = index of the last vector
+     */
+    NodePtr divideTree(int left, int right, BoundingBox& bbox)
+    {
+        NodePtr node = pool_.allocate<Node>(); // allocate memory
+
+        /* If too few exemplars remain, then make this a leaf node. */
+        if ( (right-left) <= leaf_max_size_) {
+            node->child1 = node->child2 = NULL;    /* Mark as leaf node. */
+            node->left = left;
+            node->right = right;
+
+            // compute bounding-box of leaf points
+            for (size_t i=0; i<dim_; ++i) {
+                bbox[i].low = (DistanceType)dataset_[vind_[left]][i];
+                bbox[i].high = (DistanceType)dataset_[vind_[left]][i];
+            }
+            for (int k=left+1; k<right; ++k) {
+                for (size_t i=0; i<dim_; ++i) {
+                    if (bbox[i].low>dataset_[vind_[k]][i]) bbox[i].low=(DistanceType)dataset_[vind_[k]][i];
+                    if (bbox[i].high<dataset_[vind_[k]][i]) bbox[i].high=(DistanceType)dataset_[vind_[k]][i];
+                }
+            }
+        }
+        else {
+            int idx;
+            int cutfeat;
+            DistanceType cutval;
+            middleSplit_(&vind_[0]+left, right-left, idx, cutfeat, cutval, bbox);
+
+            node->divfeat = cutfeat;
+
+            BoundingBox left_bbox(bbox);
+            left_bbox[cutfeat].high = cutval;
+            node->child1 = divideTree(left, left+idx, left_bbox);
+
+            BoundingBox right_bbox(bbox);
+            right_bbox[cutfeat].low = cutval;
+            node->child2 = divideTree(left+idx, right, right_bbox);
+
+            node->divlow = left_bbox[cutfeat].high;
+            node->divhigh = right_bbox[cutfeat].low;
+
+            for (size_t i=0; i<dim_; ++i) {
+                bbox[i].low = std::min(left_bbox[i].low, right_bbox[i].low);
+                bbox[i].high = std::max(left_bbox[i].high, right_bbox[i].high);
+            }
+        }
+
+        return node;
+    }
+
+    void computeMinMax(int* ind, int count, int dim, ElementType& min_elem, ElementType& max_elem)
+    {
+        min_elem = dataset_[ind[0]][dim];
+        max_elem = dataset_[ind[0]][dim];
+        for (int i=1; i<count; ++i) {
+            ElementType val = dataset_[ind[i]][dim];
+            if (val<min_elem) min_elem = val;
+            if (val>max_elem) max_elem = val;
+        }
+    }
+
+    void middleSplit(int* ind, int count, int& index, int& cutfeat, DistanceType& cutval, const BoundingBox& bbox)
+    {
+        // find the largest span from the approximate bounding box
+        ElementType max_span = bbox[0].high-bbox[0].low;
+        cutfeat = 0;
+        cutval = (bbox[0].high+bbox[0].low)/2;
+        for (size_t i=1; i<dim_; ++i) {
+            ElementType span = bbox[i].high-bbox[i].low;
+            if (span>max_span) {
+                max_span = span;
+                cutfeat = i;
+                cutval = (bbox[i].high+bbox[i].low)/2;
+            }
+        }
+
+        // compute exact span on the found dimension
+        ElementType min_elem, max_elem;
+        computeMinMax(ind, count, cutfeat, min_elem, max_elem);
+        cutval = (min_elem+max_elem)/2;
+        max_span = max_elem - min_elem;
+
+        // check if a dimension of a largest span exists
+        size_t k = cutfeat;
+        for (size_t i=0; i<dim_; ++i) {
+            if (i==k) continue;
+            ElementType span = bbox[i].high-bbox[i].low;
+            if (span>max_span) {
+                computeMinMax(ind, count, i, min_elem, max_elem);
+                span = max_elem - min_elem;
+                if (span>max_span) {
+                    max_span = span;
+                    cutfeat = i;
+                    cutval = (min_elem+max_elem)/2;
+                }
+            }
+        }
+        int lim1, lim2;
+        planeSplit(ind, count, cutfeat, cutval, lim1, lim2);
+
+        if (lim1>count/2) index = lim1;
+        else if (lim2<count/2) index = lim2;
+        else index = count/2;
+    }
+
+
+    void middleSplit_(int* ind, int count, int& index, int& cutfeat, DistanceType& cutval, const BoundingBox& bbox)
+    {
+        const float EPS=0.00001f;
+        DistanceType max_span = bbox[0].high-bbox[0].low;
+        for (size_t i=1; i<dim_; ++i) {
+            DistanceType span = bbox[i].high-bbox[i].low;
+            if (span>max_span) {
+                max_span = span;
+            }
+        }
+        DistanceType max_spread = -1;
+        cutfeat = 0;
+        for (size_t i=0; i<dim_; ++i) {
+            DistanceType span = bbox[i].high-bbox[i].low;
+            if (span>(DistanceType)((1-EPS)*max_span)) {
+                ElementType min_elem, max_elem;
+                computeMinMax(ind, count, cutfeat, min_elem, max_elem);
+                DistanceType spread = (DistanceType)(max_elem-min_elem);
+                if (spread>max_spread) {
+                    cutfeat = (int)i;
+                    max_spread = spread;
+                }
+            }
+        }
+        // split in the middle
+        DistanceType split_val = (bbox[cutfeat].low+bbox[cutfeat].high)/2;
+        ElementType min_elem, max_elem;
+        computeMinMax(ind, count, cutfeat, min_elem, max_elem);
+
+        if (split_val<min_elem) cutval = (DistanceType)min_elem;
+        else if (split_val>max_elem) cutval = (DistanceType)max_elem;
+        else cutval = split_val;
+
+        int lim1, lim2;
+        planeSplit(ind, count, cutfeat, cutval, lim1, lim2);
+
+        if (lim1>count/2) index = lim1;
+        else if (lim2<count/2) index = lim2;
+        else index = count/2;
+    }
+
+
+    /**
+     *  Subdivide the list of points by a plane perpendicular on axe corresponding
+     *  to the 'cutfeat' dimension at 'cutval' position.
+     *
+     *  On return:
+     *  dataset[ind[0..lim1-1]][cutfeat]<cutval
+     *  dataset[ind[lim1..lim2-1]][cutfeat]==cutval
+     *  dataset[ind[lim2..count]][cutfeat]>cutval
+     */
+    void planeSplit(int* ind, int count, int cutfeat, DistanceType cutval, int& lim1, int& lim2)
+    {
+        /* Move vector indices for left subtree to front of list. */
+        int left = 0;
+        int right = count-1;
+        for (;; ) {
+            while (left<=right && dataset_[ind[left]][cutfeat]<cutval) ++left;
+            while (left<=right && dataset_[ind[right]][cutfeat]>=cutval) --right;
+            if (left>right) break;
+            std::swap(ind[left], ind[right]); ++left; --right;
+        }
+        /* If either list is empty, it means that all remaining features
+         * are identical. Split in the middle to maintain a balanced tree.
+         */
+        lim1 = left;
+        right = count-1;
+        for (;; ) {
+            while (left<=right && dataset_[ind[left]][cutfeat]<=cutval) ++left;
+            while (left<=right && dataset_[ind[right]][cutfeat]>cutval) --right;
+            if (left>right) break;
+            std::swap(ind[left], ind[right]); ++left; --right;
+        }
+        lim2 = left;
+    }
+
+    DistanceType computeInitialDistances(const ElementType* vec, std::vector<DistanceType>& dists)
+    {
+        DistanceType distsq = 0.0;
+
+        for (size_t i = 0; i < dim_; ++i) {
+            if (vec[i] < root_bbox_[i].low) {
+                dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].low, (int)i);
+                distsq += dists[i];
+            }
+            if (vec[i] > root_bbox_[i].high) {
+                dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].high, (int)i);
+                distsq += dists[i];
+            }
+        }
+
+        return distsq;
+    }
+
+    /**
+     * Performs an exact search in the tree starting from a node.
+     */
+    void searchLevel(ResultSet<DistanceType>& result_set, const ElementType* vec, const NodePtr node, DistanceType mindistsq,
+                     std::vector<DistanceType>& dists, const float epsError)
+    {
+        /* If this is a leaf node, then do check and return. */
+        if ((node->child1 == NULL)&&(node->child2 == NULL)) {
+            DistanceType worst_dist = result_set.worstDist();
+            for (int i=node->left; i<node->right; ++i) {
+                int index = reorder_ ? i : vind_[i];
+                DistanceType dist = distance_(vec, data_[index], dim_, worst_dist);
+                if (dist<worst_dist) {
+                    result_set.addPoint(dist,vind_[i]);
+                }
+            }
+            return;
+        }
+
+        /* Which child branch should be taken first? */
+        int idx = node->divfeat;
+        ElementType val = vec[idx];
+        DistanceType diff1 = val - node->divlow;
+        DistanceType diff2 = val - node->divhigh;
+
+        NodePtr bestChild;
+        NodePtr otherChild;
+        DistanceType cut_dist;
+        if ((diff1+diff2)<0) {
+            bestChild = node->child1;
+            otherChild = node->child2;
+            cut_dist = distance_.accum_dist(val, node->divhigh, idx);
+        }
+        else {
+            bestChild = node->child2;
+            otherChild = node->child1;
+            cut_dist = distance_.accum_dist( val, node->divlow, idx);
+        }
+
+        /* Call recursively to search next level down. */
+        searchLevel(result_set, vec, bestChild, mindistsq, dists, epsError);
+
+        DistanceType dst = dists[idx];
+        mindistsq = mindistsq + cut_dist - dst;
+        dists[idx] = cut_dist;
+        if (mindistsq*epsError<=result_set.worstDist()) {
+            searchLevel(result_set, vec, otherChild, mindistsq, dists, epsError);
+        }
+        dists[idx] = dst;
+    }
+
+private:
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset_;
+
+    IndexParams index_params_;
+
+    int leaf_max_size_;
+    bool reorder_;
+
+
+    /**
+     *  Array of indices to vectors in the dataset.
+     */
+    std::vector<int> vind_;
+
+    Matrix<ElementType> data_;
+
+    size_t size_;
+    size_t dim_;
+
+    /**
+     * Array of k-d trees used to find neighbours.
+     */
+    NodePtr root_node_;
+
+    BoundingBox root_bbox_;
+
+    /**
+     * Pooled memory allocator.
+     *
+     * Using a pooled memory allocator is more efficient
+     * than allocating memory directly when there is a large
+     * number small of memory allocations.
+     */
+    PooledAllocator pool_;
+
+    Distance distance_;
+};   // class KDTree
+
+}
+
+#endif //OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h
new file mode 100644
index 0000000..226fc71
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h
@@ -0,0 +1,1169 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_KMEANS_INDEX_H_
+#define OPENCV_FLANN_KMEANS_INDEX_H_
+
+#include <algorithm>
+#include <map>
+#include <cassert>
+#include <limits>
+#include <cmath>
+
+#include "general.h"
+#include "nn_index.h"
+#include "dist.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+#include "logger.h"
+
+
+namespace cvflann
+{
+
+struct KMeansIndexParams : public IndexParams
+{
+    KMeansIndexParams(int branching = 32, int iterations = 11,
+                      flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, float cb_index = 0.2 )
+    {
+        (*this)["algorithm"] = FLANN_INDEX_KMEANS;
+        // branching factor
+        (*this)["branching"] = branching;
+        // max iterations to perform in one kmeans clustering (kmeans tree)
+        (*this)["iterations"] = iterations;
+        // algorithm used for picking the initial cluster centers for kmeans tree
+        (*this)["centers_init"] = centers_init;
+        // cluster boundary index. Used when searching the kmeans tree
+        (*this)["cb_index"] = cb_index;
+    }
+};
+
+
+/**
+ * Hierarchical kmeans index
+ *
+ * Contains a tree constructed through a hierarchical kmeans clustering
+ * and other information for indexing a set of points for nearest-neighbour matching.
+ */
+template <typename Distance>
+class KMeansIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+
+
+    typedef void (KMeansIndex::* centersAlgFunction)(int, int*, int, int*, int&);
+
+    /**
+     * The function used for choosing the cluster centers.
+     */
+    centersAlgFunction chooseCenters;
+
+
+
+    /**
+     * Chooses the initial centers in the k-means clustering in a random manner.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     *     indices_length = length of indices vector
+     *
+     */
+    void chooseCentersRandom(int k, int* indices, int indices_length, int* centers, int& centers_length)
+    {
+        UniqueRandom r(indices_length);
+
+        int index;
+        for (index=0; index<k; ++index) {
+            bool duplicate = true;
+            int rnd;
+            while (duplicate) {
+                duplicate = false;
+                rnd = r.next();
+                if (rnd<0) {
+                    centers_length = index;
+                    return;
+                }
+
+                centers[index] = indices[rnd];
+
+                for (int j=0; j<index; ++j) {
+                    DistanceType sq = distance_(dataset_[centers[index]], dataset_[centers[j]], dataset_.cols);
+                    if (sq<1e-16) {
+                        duplicate = true;
+                    }
+                }
+            }
+        }
+
+        centers_length = index;
+    }
+
+
+    /**
+     * Chooses the initial centers in the k-means using Gonzales' algorithm
+     * so that the centers are spaced apart from each other.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void chooseCentersGonzales(int k, int* indices, int indices_length, int* centers, int& centers_length)
+    {
+        int n = indices_length;
+
+        int rnd = rand_int(n);
+        assert(rnd >=0 && rnd < n);
+
+        centers[0] = indices[rnd];
+
+        int index;
+        for (index=1; index<k; ++index) {
+
+            int best_index = -1;
+            DistanceType best_val = 0;
+            for (int j=0; j<n; ++j) {
+                DistanceType dist = distance_(dataset_[centers[0]],dataset_[indices[j]],dataset_.cols);
+                for (int i=1; i<index; ++i) {
+                    DistanceType tmp_dist = distance_(dataset_[centers[i]],dataset_[indices[j]],dataset_.cols);
+                    if (tmp_dist<dist) {
+                        dist = tmp_dist;
+                    }
+                }
+                if (dist>best_val) {
+                    best_val = dist;
+                    best_index = j;
+                }
+            }
+            if (best_index!=-1) {
+                centers[index] = indices[best_index];
+            }
+            else {
+                break;
+            }
+        }
+        centers_length = index;
+    }
+
+
+    /**
+     * Chooses the initial centers in the k-means using the algorithm
+     * proposed in the KMeans++ paper:
+     * Arthur, David; Vassilvitskii, Sergei - k-means++: The Advantages of Careful Seeding
+     *
+     * Implementation of this function was converted from the one provided in Arthur's code.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void chooseCentersKMeanspp(int k, int* indices, int indices_length, int* centers, int& centers_length)
+    {
+        int n = indices_length;
+
+        double currentPot = 0;
+        DistanceType* closestDistSq = new DistanceType[n];
+
+        // Choose one random center and set the closestDistSq values
+        int index = rand_int(n);
+        assert(index >=0 && index < n);
+        centers[0] = indices[index];
+
+        for (int i = 0; i < n; i++) {
+            closestDistSq[i] = distance_(dataset_[indices[i]], dataset_[indices[index]], dataset_.cols);
+            closestDistSq[i] = ensureSquareDistance<Distance>( closestDistSq[i] );
+            currentPot += closestDistSq[i];
+        }
+
+
+        const int numLocalTries = 1;
+
+        // Choose each center
+        int centerCount;
+        for (centerCount = 1; centerCount < k; centerCount++) {
+
+            // Repeat several trials
+            double bestNewPot = -1;
+            int bestNewIndex = -1;
+            for (int localTrial = 0; localTrial < numLocalTries; localTrial++) {
+
+                // Choose our center - have to be slightly careful to return a valid answer even accounting
+                // for possible rounding errors
+                double randVal = rand_double(currentPot);
+                for (index = 0; index < n-1; index++) {
+                    if (randVal <= closestDistSq[index]) break;
+                    else randVal -= closestDistSq[index];
+                }
+
+                // Compute the new potential
+                double newPot = 0;
+                for (int i = 0; i < n; i++) {
+                    DistanceType dist = distance_(dataset_[indices[i]], dataset_[indices[index]], dataset_.cols);
+                    newPot += std::min( ensureSquareDistance<Distance>(dist), closestDistSq[i] );
+                }
+
+                // Store the best result
+                if ((bestNewPot < 0)||(newPot < bestNewPot)) {
+                    bestNewPot = newPot;
+                    bestNewIndex = index;
+                }
+            }
+
+            // Add the appropriate center
+            centers[centerCount] = indices[bestNewIndex];
+            currentPot = bestNewPot;
+            for (int i = 0; i < n; i++) {
+                DistanceType dist = distance_(dataset_[indices[i]], dataset_[indices[bestNewIndex]], dataset_.cols);
+                closestDistSq[i] = std::min( ensureSquareDistance<Distance>(dist), closestDistSq[i] );
+            }
+        }
+
+        centers_length = centerCount;
+
+        delete[] closestDistSq;
+    }
+
+
+
+public:
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_KMEANS;
+    }
+
+    class KMeansDistanceComputer : public cv::ParallelLoopBody
+    {
+    public:
+        KMeansDistanceComputer(Distance _distance, const Matrix<ElementType>& _dataset,
+            const int _branching, const int* _indices, const Matrix<double>& _dcenters, const size_t _veclen,
+            int* _count, int* _belongs_to, std::vector<DistanceType>& _radiuses, bool& _converged, cv::Mutex& _mtx)
+            : distance(_distance)
+            , dataset(_dataset)
+            , branching(_branching)
+            , indices(_indices)
+            , dcenters(_dcenters)
+            , veclen(_veclen)
+            , count(_count)
+            , belongs_to(_belongs_to)
+            , radiuses(_radiuses)
+            , converged(_converged)
+            , mtx(_mtx)
+        {
+        }
+
+        void operator()(const cv::Range& range) const
+        {
+            const int begin = range.start;
+            const int end = range.end;
+
+            for( int i = begin; i<end; ++i)
+            {
+                DistanceType sq_dist = distance(dataset[indices[i]], dcenters[0], veclen);
+                int new_centroid = 0;
+                for (int j=1; j<branching; ++j) {
+                    DistanceType new_sq_dist = distance(dataset[indices[i]], dcenters[j], veclen);
+                    if (sq_dist>new_sq_dist) {
+                        new_centroid = j;
+                        sq_dist = new_sq_dist;
+                    }
+                }
+                if (sq_dist > radiuses[new_centroid]) {
+                    radiuses[new_centroid] = sq_dist;
+                }
+                if (new_centroid != belongs_to[i]) {
+                    count[belongs_to[i]]--;
+                    count[new_centroid]++;
+                    belongs_to[i] = new_centroid;
+                    mtx.lock();
+                    converged = false;
+                    mtx.unlock();
+                }
+            }
+        }
+
+    private:
+        Distance distance;
+        const Matrix<ElementType>& dataset;
+        const int branching;
+        const int* indices;
+        const Matrix<double>& dcenters;
+        const size_t veclen;
+        int* count;
+        int* belongs_to;
+        std::vector<DistanceType>& radiuses;
+        bool& converged;
+        cv::Mutex& mtx;
+        KMeansDistanceComputer& operator=( const KMeansDistanceComputer & ) { return *this; }
+    };
+
+    /**
+     * Index constructor
+     *
+     * Params:
+     *          inputData = dataset with the input features
+     *          params = parameters passed to the hierarchical k-means algorithm
+     */
+    KMeansIndex(const Matrix<ElementType>& inputData, const IndexParams& params = KMeansIndexParams(),
+                Distance d = Distance())
+        : dataset_(inputData), index_params_(params), root_(NULL), indices_(NULL), distance_(d)
+    {
+        memoryCounter_ = 0;
+
+        size_ = dataset_.rows;
+        veclen_ = dataset_.cols;
+
+        branching_ = get_param(params,"branching",32);
+        iterations_ = get_param(params,"iterations",11);
+        if (iterations_<0) {
+            iterations_ = (std::numeric_limits<int>::max)();
+        }
+        centers_init_  = get_param(params,"centers_init",FLANN_CENTERS_RANDOM);
+
+        if (centers_init_==FLANN_CENTERS_RANDOM) {
+            chooseCenters = &KMeansIndex::chooseCentersRandom;
+        }
+        else if (centers_init_==FLANN_CENTERS_GONZALES) {
+            chooseCenters = &KMeansIndex::chooseCentersGonzales;
+        }
+        else if (centers_init_==FLANN_CENTERS_KMEANSPP) {
+            chooseCenters = &KMeansIndex::chooseCentersKMeanspp;
+        }
+        else {
+            throw FLANNException("Unknown algorithm for choosing initial centers.");
+        }
+        cb_index_ = 0.4f;
+
+    }
+
+
+    KMeansIndex(const KMeansIndex&);
+    KMeansIndex& operator=(const KMeansIndex&);
+
+
+    /**
+     * Index destructor.
+     *
+     * Release the memory used by the index.
+     */
+    virtual ~KMeansIndex()
+    {
+        if (root_ != NULL) {
+            free_centers(root_);
+        }
+        if (indices_!=NULL) {
+            delete[] indices_;
+        }
+    }
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return veclen_;
+    }
+
+
+    void set_cb_index( float index)
+    {
+        cb_index_ = index;
+    }
+
+    /**
+     * Computes the inde memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return pool_.usedMemory+pool_.wastedMemory+memoryCounter_;
+    }
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        if (branching_<2) {
+            throw FLANNException("Branching factor must be at least 2");
+        }
+
+        indices_ = new int[size_];
+        for (size_t i=0; i<size_; ++i) {
+            indices_[i] = int(i);
+        }
+
+        root_ = pool_.allocate<KMeansNode>();
+        std::memset(root_, 0, sizeof(KMeansNode));
+
+        computeNodeStatistics(root_, indices_, (int)size_);
+        computeClustering(root_, indices_, (int)size_, branching_,0);
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream, branching_);
+        save_value(stream, iterations_);
+        save_value(stream, memoryCounter_);
+        save_value(stream, cb_index_);
+        save_value(stream, *indices_, (int)size_);
+
+        save_tree(stream, root_);
+    }
+
+
+    void loadIndex(FILE* stream)
+    {
+        load_value(stream, branching_);
+        load_value(stream, iterations_);
+        load_value(stream, memoryCounter_);
+        load_value(stream, cb_index_);
+        if (indices_!=NULL) {
+            delete[] indices_;
+        }
+        indices_ = new int[size_];
+        load_value(stream, *indices_, size_);
+
+        if (root_!=NULL) {
+            free_centers(root_);
+        }
+        load_tree(stream, root_);
+
+        index_params_["algorithm"] = getType();
+        index_params_["branching"] = branching_;
+        index_params_["iterations"] = iterations_;
+        index_params_["centers_init"] = centers_init_;
+        index_params_["cb_index"] = cb_index_;
+
+    }
+
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     searchParams = parameters that influence the search algorithm (checks, cb_index)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+
+        int maxChecks = get_param(searchParams,"checks",32);
+
+        if (maxChecks==FLANN_CHECKS_UNLIMITED) {
+            findExactNN(root_, result, vec);
+        }
+        else {
+            // Priority queue storing intermediate branches in the best-bin-first search
+            Heap<BranchSt>* heap = new Heap<BranchSt>((int)size_);
+
+            int checks = 0;
+            findNN(root_, result, vec, checks, maxChecks, heap);
+
+            BranchSt branch;
+            while (heap->popMin(branch) && (checks<maxChecks || !result.full())) {
+                KMeansNodePtr node = branch.node;
+                findNN(node, result, vec, checks, maxChecks, heap);
+            }
+            assert(result.full());
+
+            delete heap;
+        }
+
+    }
+
+    /**
+     * Clustering function that takes a cut in the hierarchical k-means
+     * tree and return the clusters centers of that clustering.
+     * Params:
+     *     numClusters = number of clusters to have in the clustering computed
+     * Returns: number of cluster centers
+     */
+    int getClusterCenters(Matrix<DistanceType>& centers)
+    {
+        int numClusters = centers.rows;
+        if (numClusters<1) {
+            throw FLANNException("Number of clusters must be at least 1");
+        }
+
+        DistanceType variance;
+        KMeansNodePtr* clusters = new KMeansNodePtr[numClusters];
+
+        int clusterCount = getMinVarianceClusters(root_, clusters, numClusters, variance);
+
+        Logger::info("Clusters requested: %d, returning %d\n",numClusters, clusterCount);
+
+        for (int i=0; i<clusterCount; ++i) {
+            DistanceType* center = clusters[i]->pivot;
+            for (size_t j=0; j<veclen_; ++j) {
+                centers[i][j] = center[j];
+            }
+        }
+        delete[] clusters;
+
+        return clusterCount;
+    }
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+
+private:
+    /**
+     * Struture representing a node in the hierarchical k-means tree.
+     */
+    struct KMeansNode
+    {
+        /**
+         * The cluster center.
+         */
+        DistanceType* pivot;
+        /**
+         * The cluster radius.
+         */
+        DistanceType radius;
+        /**
+         * The cluster mean radius.
+         */
+        DistanceType mean_radius;
+        /**
+         * The cluster variance.
+         */
+        DistanceType variance;
+        /**
+         * The cluster size (number of points in the cluster)
+         */
+        int size;
+        /**
+         * Child nodes (only for non-terminal nodes)
+         */
+        KMeansNode** childs;
+        /**
+         * Node points (only for terminal nodes)
+         */
+        int* indices;
+        /**
+         * Level
+         */
+        int level;
+    };
+    typedef KMeansNode* KMeansNodePtr;
+
+    /**
+     * Alias definition for a nicer syntax.
+     */
+    typedef BranchStruct<KMeansNodePtr, DistanceType> BranchSt;
+
+
+
+
+    void save_tree(FILE* stream, KMeansNodePtr node)
+    {
+        save_value(stream, *node);
+        save_value(stream, *(node->pivot), (int)veclen_);
+        if (node->childs==NULL) {
+            int indices_offset = (int)(node->indices - indices_);
+            save_value(stream, indices_offset);
+        }
+        else {
+            for(int i=0; i<branching_; ++i) {
+                save_tree(stream, node->childs[i]);
+            }
+        }
+    }
+
+
+    void load_tree(FILE* stream, KMeansNodePtr& node)
+    {
+        node = pool_.allocate<KMeansNode>();
+        load_value(stream, *node);
+        node->pivot = new DistanceType[veclen_];
+        load_value(stream, *(node->pivot), (int)veclen_);
+        if (node->childs==NULL) {
+            int indices_offset;
+            load_value(stream, indices_offset);
+            node->indices = indices_ + indices_offset;
+        }
+        else {
+            node->childs = pool_.allocate<KMeansNodePtr>(branching_);
+            for(int i=0; i<branching_; ++i) {
+                load_tree(stream, node->childs[i]);
+            }
+        }
+    }
+
+
+    /**
+     * Helper function
+     */
+    void free_centers(KMeansNodePtr node)
+    {
+        delete[] node->pivot;
+        if (node->childs!=NULL) {
+            for (int k=0; k<branching_; ++k) {
+                free_centers(node->childs[k]);
+            }
+        }
+    }
+
+    /**
+     * Computes the statistics of a node (mean, radius, variance).
+     *
+     * Params:
+     *     node = the node to use
+     *     indices = the indices of the points belonging to the node
+     */
+    void computeNodeStatistics(KMeansNodePtr node, int* indices, int indices_length)
+    {
+
+        DistanceType radius = 0;
+        DistanceType variance = 0;
+        DistanceType* mean = new DistanceType[veclen_];
+        memoryCounter_ += int(veclen_*sizeof(DistanceType));
+
+        memset(mean,0,veclen_*sizeof(DistanceType));
+
+        for (size_t i=0; i<size_; ++i) {
+            ElementType* vec = dataset_[indices[i]];
+            for (size_t j=0; j<veclen_; ++j) {
+                mean[j] += vec[j];
+            }
+            variance += distance_(vec, ZeroIterator<ElementType>(), veclen_);
+        }
+        for (size_t j=0; j<veclen_; ++j) {
+            mean[j] /= size_;
+        }
+        variance /= size_;
+        variance -= distance_(mean, ZeroIterator<ElementType>(), veclen_);
+
+        DistanceType tmp = 0;
+        for (int i=0; i<indices_length; ++i) {
+            tmp = distance_(mean, dataset_[indices[i]], veclen_);
+            if (tmp>radius) {
+                radius = tmp;
+            }
+        }
+
+        node->variance = variance;
+        node->radius = radius;
+        node->pivot = mean;
+    }
+
+
+    /**
+     * The method responsible with actually doing the recursive hierarchical
+     * clustering
+     *
+     * Params:
+     *     node = the node to cluster
+     *     indices = indices of the points belonging to the current node
+     *     branching = the branching factor to use in the clustering
+     *
+     * TODO: for 1-sized clusters don't store a cluster center (it's the same as the single cluster point)
+     */
+    void computeClustering(KMeansNodePtr node, int* indices, int indices_length, int branching, int level)
+    {
+        node->size = indices_length;
+        node->level = level;
+
+        if (indices_length < branching) {
+            node->indices = indices;
+            std::sort(node->indices,node->indices+indices_length);
+            node->childs = NULL;
+            return;
+        }
+
+        cv::AutoBuffer<int> centers_idx_buf(branching);
+        int* centers_idx = (int*)centers_idx_buf;
+        int centers_length;
+        (this->*chooseCenters)(branching, indices, indices_length, centers_idx, centers_length);
+
+        if (centers_length<branching) {
+            node->indices = indices;
+            std::sort(node->indices,node->indices+indices_length);
+            node->childs = NULL;
+            return;
+        }
+
+
+        cv::AutoBuffer<double> dcenters_buf(branching*veclen_);
+        Matrix<double> dcenters((double*)dcenters_buf,branching,veclen_);
+        for (int i=0; i<centers_length; ++i) {
+            ElementType* vec = dataset_[centers_idx[i]];
+            for (size_t k=0; k<veclen_; ++k) {
+                dcenters[i][k] = double(vec[k]);
+            }
+        }
+
+        std::vector<DistanceType> radiuses(branching);
+        cv::AutoBuffer<int> count_buf(branching);
+        int* count = (int*)count_buf;
+        for (int i=0; i<branching; ++i) {
+            radiuses[i] = 0;
+            count[i] = 0;
+        }
+
+        //	assign points to clusters
+        cv::AutoBuffer<int> belongs_to_buf(indices_length);
+        int* belongs_to = (int*)belongs_to_buf;
+        for (int i=0; i<indices_length; ++i) {
+
+            DistanceType sq_dist = distance_(dataset_[indices[i]], dcenters[0], veclen_);
+            belongs_to[i] = 0;
+            for (int j=1; j<branching; ++j) {
+                DistanceType new_sq_dist = distance_(dataset_[indices[i]], dcenters[j], veclen_);
+                if (sq_dist>new_sq_dist) {
+                    belongs_to[i] = j;
+                    sq_dist = new_sq_dist;
+                }
+            }
+            if (sq_dist>radiuses[belongs_to[i]]) {
+                radiuses[belongs_to[i]] = sq_dist;
+            }
+            count[belongs_to[i]]++;
+        }
+
+        bool converged = false;
+        int iteration = 0;
+        while (!converged && iteration<iterations_) {
+            converged = true;
+            iteration++;
+
+            // compute the new cluster centers
+            for (int i=0; i<branching; ++i) {
+                memset(dcenters[i],0,sizeof(double)*veclen_);
+                radiuses[i] = 0;
+            }
+            for (int i=0; i<indices_length; ++i) {
+                ElementType* vec = dataset_[indices[i]];
+                double* center = dcenters[belongs_to[i]];
+                for (size_t k=0; k<veclen_; ++k) {
+                    center[k] += vec[k];
+                }
+            }
+            for (int i=0; i<branching; ++i) {
+                int cnt = count[i];
+                for (size_t k=0; k<veclen_; ++k) {
+                    dcenters[i][k] /= cnt;
+                }
+            }
+
+            // reassign points to clusters
+            cv::Mutex mtx;
+            KMeansDistanceComputer invoker(distance_, dataset_, branching, indices, dcenters, veclen_, count, belongs_to, radiuses, converged, mtx);
+            parallel_for_(cv::Range(0, (int)indices_length), invoker);
+
+            for (int i=0; i<branching; ++i) {
+                // if one cluster converges to an empty cluster,
+                // move an element into that cluster
+                if (count[i]==0) {
+                    int j = (i+1)%branching;
+                    while (count[j]<=1) {
+                        j = (j+1)%branching;
+                    }
+
+                    for (int k=0; k<indices_length; ++k) {
+                        if (belongs_to[k]==j) {
+                            // for cluster j, we move the furthest element from the center to the empty cluster i
+                            if ( distance_(dataset_[indices[k]], dcenters[j], veclen_) == radiuses[j] ) {
+                                belongs_to[k] = i;
+                                count[j]--;
+                                count[i]++;
+                                break;
+                            }
+                        }
+                    }
+                    converged = false;
+                }
+            }
+
+        }
+
+        DistanceType** centers = new DistanceType*[branching];
+
+        for (int i=0; i<branching; ++i) {
+            centers[i] = new DistanceType[veclen_];
+            memoryCounter_ += (int)(veclen_*sizeof(DistanceType));
+            for (size_t k=0; k<veclen_; ++k) {
+                centers[i][k] = (DistanceType)dcenters[i][k];
+            }
+        }
+
+
+        // compute kmeans clustering for each of the resulting clusters
+        node->childs = pool_.allocate<KMeansNodePtr>(branching);
+        int start = 0;
+        int end = start;
+        for (int c=0; c<branching; ++c) {
+            int s = count[c];
+
+            DistanceType variance = 0;
+            DistanceType mean_radius =0;
+            for (int i=0; i<indices_length; ++i) {
+                if (belongs_to[i]==c) {
+                    DistanceType d = distance_(dataset_[indices[i]], ZeroIterator<ElementType>(), veclen_);
+                    variance += d;
+                    mean_radius += sqrt(d);
+                    std::swap(indices[i],indices[end]);
+                    std::swap(belongs_to[i],belongs_to[end]);
+                    end++;
+                }
+            }
+            variance /= s;
+            mean_radius /= s;
+            variance -= distance_(centers[c], ZeroIterator<ElementType>(), veclen_);
+
+            node->childs[c] = pool_.allocate<KMeansNode>();
+            std::memset(node->childs[c], 0, sizeof(KMeansNode));
+            node->childs[c]->radius = radiuses[c];
+            node->childs[c]->pivot = centers[c];
+            node->childs[c]->variance = variance;
+            node->childs[c]->mean_radius = mean_radius;
+            computeClustering(node->childs[c],indices+start, end-start, branching, level+1);
+            start=end;
+        }
+    }
+
+
+
+    /**
+     * Performs one descent in the hierarchical k-means tree. The branches not
+     * visited are stored in a priority queue.
+     *
+     * Params:
+     *      node = node to explore
+     *      result = container for the k-nearest neighbors found
+     *      vec = query points
+     *      checks = how many points in the dataset have been checked so far
+     *      maxChecks = maximum dataset points to checks
+     */
+
+
+    void findNN(KMeansNodePtr node, ResultSet<DistanceType>& result, const ElementType* vec, int& checks, int maxChecks,
+                Heap<BranchSt>* heap)
+    {
+        // Ignore those clusters that are too far away
+        {
+            DistanceType bsq = distance_(vec, node->pivot, veclen_);
+            DistanceType rsq = node->radius;
+            DistanceType wsq = result.worstDist();
+
+            DistanceType val = bsq-rsq-wsq;
+            DistanceType val2 = val*val-4*rsq*wsq;
+
+            //if (val>0) {
+            if ((val>0)&&(val2>0)) {
+                return;
+            }
+        }
+
+        if (node->childs==NULL) {
+            if (checks>=maxChecks) {
+                if (result.full()) return;
+            }
+            checks += node->size;
+            for (int i=0; i<node->size; ++i) {
+                int index = node->indices[i];
+                DistanceType dist = distance_(dataset_[index], vec, veclen_);
+                result.addPoint(dist, index);
+            }
+        }
+        else {
+            DistanceType* domain_distances = new DistanceType[branching_];
+            int closest_center = exploreNodeBranches(node, vec, domain_distances, heap);
+            delete[] domain_distances;
+            findNN(node->childs[closest_center],result,vec, checks, maxChecks, heap);
+        }
+    }
+
+    /**
+     * Helper function that computes the nearest childs of a node to a given query point.
+     * Params:
+     *     node = the node
+     *     q = the query point
+     *     distances = array with the distances to each child node.
+     * Returns:
+     */
+    int exploreNodeBranches(KMeansNodePtr node, const ElementType* q, DistanceType* domain_distances, Heap<BranchSt>* heap)
+    {
+
+        int best_index = 0;
+        domain_distances[best_index] = distance_(q, node->childs[best_index]->pivot, veclen_);
+        for (int i=1; i<branching_; ++i) {
+            domain_distances[i] = distance_(q, node->childs[i]->pivot, veclen_);
+            if (domain_distances[i]<domain_distances[best_index]) {
+                best_index = i;
+            }
+        }
+
+        //		float* best_center = node->childs[best_index]->pivot;
+        for (int i=0; i<branching_; ++i) {
+            if (i != best_index) {
+                domain_distances[i] -= cb_index_*node->childs[i]->variance;
+
+                //				float dist_to_border = getDistanceToBorder(node.childs[i].pivot,best_center,q);
+                //				if (domain_distances[i]<dist_to_border) {
+                //					domain_distances[i] = dist_to_border;
+                //				}
+                heap->insert(BranchSt(node->childs[i],domain_distances[i]));
+            }
+        }
+
+        return best_index;
+    }
+
+
+    /**
+     * Function the performs exact nearest neighbor search by traversing the entire tree.
+     */
+    void findExactNN(KMeansNodePtr node, ResultSet<DistanceType>& result, const ElementType* vec)
+    {
+        // Ignore those clusters that are too far away
+        {
+            DistanceType bsq = distance_(vec, node->pivot, veclen_);
+            DistanceType rsq = node->radius;
+            DistanceType wsq = result.worstDist();
+
+            DistanceType val = bsq-rsq-wsq;
+            DistanceType val2 = val*val-4*rsq*wsq;
+
+            //                  if (val>0) {
+            if ((val>0)&&(val2>0)) {
+                return;
+            }
+        }
+
+
+        if (node->childs==NULL) {
+            for (int i=0; i<node->size; ++i) {
+                int index = node->indices[i];
+                DistanceType dist = distance_(dataset_[index], vec, veclen_);
+                result.addPoint(dist, index);
+            }
+        }
+        else {
+            int* sort_indices = new int[branching_];
+
+            getCenterOrdering(node, vec, sort_indices);
+
+            for (int i=0; i<branching_; ++i) {
+                findExactNN(node->childs[sort_indices[i]],result,vec);
+            }
+
+            delete[] sort_indices;
+        }
+    }
+
+
+    /**
+     * Helper function.
+     *
+     * I computes the order in which to traverse the child nodes of a particular node.
+     */
+    void getCenterOrdering(KMeansNodePtr node, const ElementType* q, int* sort_indices)
+    {
+        DistanceType* domain_distances = new DistanceType[branching_];
+        for (int i=0; i<branching_; ++i) {
+            DistanceType dist = distance_(q, node->childs[i]->pivot, veclen_);
+
+            int j=0;
+            while (domain_distances[j]<dist && j<i) j++;
+            for (int k=i; k>j; --k) {
+                domain_distances[k] = domain_distances[k-1];
+                sort_indices[k] = sort_indices[k-1];
+            }
+            domain_distances[j] = dist;
+            sort_indices[j] = i;
+        }
+        delete[] domain_distances;
+    }
+
+    /**
+     * Method that computes the squared distance from the query point q
+     * from inside region with center c to the border between this
+     * region and the region with center p
+     */
+    DistanceType getDistanceToBorder(DistanceType* p, DistanceType* c, DistanceType* q)
+    {
+        DistanceType sum = 0;
+        DistanceType sum2 = 0;
+
+        for (int i=0; i<veclen_; ++i) {
+            DistanceType t = c[i]-p[i];
+            sum += t*(q[i]-(c[i]+p[i])/2);
+            sum2 += t*t;
+        }
+
+        return sum*sum/sum2;
+    }
+
+
+    /**
+     * Helper function the descends in the hierarchical k-means tree by spliting those clusters that minimize
+     * the overall variance of the clustering.
+     * Params:
+     *     root = root node
+     *     clusters = array with clusters centers (return value)
+     *     varianceValue = variance of the clustering (return value)
+     * Returns:
+     */
+    int getMinVarianceClusters(KMeansNodePtr root, KMeansNodePtr* clusters, int clusters_length, DistanceType& varianceValue)
+    {
+        int clusterCount = 1;
+        clusters[0] = root;
+
+        DistanceType meanVariance = root->variance*root->size;
+
+        while (clusterCount<clusters_length) {
+            DistanceType minVariance = (std::numeric_limits<DistanceType>::max)();
+            int splitIndex = -1;
+
+            for (int i=0; i<clusterCount; ++i) {
+                if (clusters[i]->childs != NULL) {
+
+                    DistanceType variance = meanVariance - clusters[i]->variance*clusters[i]->size;
+
+                    for (int j=0; j<branching_; ++j) {
+                        variance += clusters[i]->childs[j]->variance*clusters[i]->childs[j]->size;
+                    }
+                    if (variance<minVariance) {
+                        minVariance = variance;
+                        splitIndex = i;
+                    }
+                }
+            }
+
+            if (splitIndex==-1) break;
+            if ( (branching_+clusterCount-1) > clusters_length) break;
+
+            meanVariance = minVariance;
+
+            // split node
+            KMeansNodePtr toSplit = clusters[splitIndex];
+            clusters[splitIndex] = toSplit->childs[0];
+            for (int i=1; i<branching_; ++i) {
+                clusters[clusterCount++] = toSplit->childs[i];
+            }
+        }
+
+        varianceValue = meanVariance/root->size;
+        return clusterCount;
+    }
+
+private:
+    /** The branching factor used in the hierarchical k-means clustering */
+    int branching_;
+
+    /** Maximum number of iterations to use when performing k-means clustering */
+    int iterations_;
+
+    /** Algorithm for choosing the cluster centers */
+    flann_centers_init_t centers_init_;
+
+    /**
+     * Cluster border index. This is used in the tree search phase when determining
+     * the closest cluster to explore next. A zero value takes into account only
+     * the cluster centres, a value greater then zero also take into account the size
+     * of the cluster.
+     */
+    float cb_index_;
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset_;
+
+    /** Index parameters */
+    IndexParams index_params_;
+
+    /**
+     * Number of features in the dataset.
+     */
+    size_t size_;
+
+    /**
+     * Length of each feature.
+     */
+    size_t veclen_;
+
+    /**
+     * The root node in the tree.
+     */
+    KMeansNodePtr root_;
+
+    /**
+     *  Array of indices to vectors in the dataset.
+     */
+    int* indices_;
+
+    /**
+     * The distance
+     */
+    Distance distance_;
+
+    /**
+     * Pooled memory allocator.
+     */
+    PooledAllocator pool_;
+
+    /**
+     * Memory occupied by the index.
+     */
+    int memoryCounter_;
+};
+
+}
+
+#endif //OPENCV_FLANN_KMEANS_INDEX_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h
new file mode 100644
index 0000000..5aa7a5c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h
@@ -0,0 +1,132 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_LINEAR_INDEX_H_
+#define OPENCV_FLANN_LINEAR_INDEX_H_
+
+#include "general.h"
+#include "nn_index.h"
+
+namespace cvflann
+{
+
+struct LinearIndexParams : public IndexParams
+{
+    LinearIndexParams()
+    {
+        (* this)["algorithm"] = FLANN_INDEX_LINEAR;
+    }
+};
+
+template <typename Distance>
+class LinearIndex : public NNIndex<Distance>
+{
+public:
+
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+
+    LinearIndex(const Matrix<ElementType>& inputData, const IndexParams& params = LinearIndexParams(),
+                Distance d = Distance()) :
+        dataset_(inputData), index_params_(params), distance_(d)
+    {
+    }
+
+    LinearIndex(const LinearIndex&);
+    LinearIndex& operator=(const LinearIndex&);
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_LINEAR;
+    }
+
+
+    size_t size() const
+    {
+        return dataset_.rows;
+    }
+
+    size_t veclen() const
+    {
+        return dataset_.cols;
+    }
+
+
+    int usedMemory() const
+    {
+        return 0;
+    }
+
+    void buildIndex()
+    {
+        /* nothing to do here for linear search */
+    }
+
+    void saveIndex(FILE*)
+    {
+        /* nothing to do here for linear search */
+    }
+
+
+    void loadIndex(FILE*)
+    {
+        /* nothing to do here for linear search */
+
+        index_params_["algorithm"] = getType();
+    }
+
+    void findNeighbors(ResultSet<DistanceType>& resultSet, const ElementType* vec, const SearchParams& /*searchParams*/)
+    {
+        ElementType* data = dataset_.data;
+        for (size_t i = 0; i < dataset_.rows; ++i, data += dataset_.cols) {
+            DistanceType dist = distance_(data, vec, dataset_.cols);
+            resultSet.addPoint(dist, (int)i);
+        }
+    }
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+private:
+    /** The dataset */
+    const Matrix<ElementType> dataset_;
+    /** Index parameters */
+    IndexParams index_params_;
+    /** Index distance */
+    Distance distance_;
+
+};
+
+}
+
+#endif // OPENCV_FLANN_LINEAR_INDEX_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/logger.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/logger.h
new file mode 100644
index 0000000..24f3fb6
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/logger.h
@@ -0,0 +1,130 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_LOGGER_H
+#define OPENCV_FLANN_LOGGER_H
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "defines.h"
+
+
+namespace cvflann
+{
+
+class Logger
+{
+    Logger() : stream(stdout), logLevel(FLANN_LOG_WARN) {}
+
+    ~Logger()
+    {
+        if ((stream!=NULL)&&(stream!=stdout)) {
+            fclose(stream);
+        }
+    }
+
+    static Logger& instance()
+    {
+        static Logger logger;
+        return logger;
+    }
+
+    void _setDestination(const char* name)
+    {
+        if (name==NULL) {
+            stream = stdout;
+        }
+        else {
+            stream = fopen(name,"w");
+            if (stream == NULL) {
+                stream = stdout;
+            }
+        }
+    }
+
+    int _log(int level, const char* fmt, va_list arglist)
+    {
+        if (level > logLevel ) return -1;
+        int ret = vfprintf(stream, fmt, arglist);
+        return ret;
+    }
+
+public:
+    /**
+     * Sets the logging level. All messages with lower priority will be ignored.
+     * @param level Logging level
+     */
+    static void setLevel(int level) { instance().logLevel = level; }
+
+    /**
+     * Sets the logging destination
+     * @param name Filename or NULL for console
+     */
+    static void setDestination(const char* name) { instance()._setDestination(name); }
+
+    /**
+     * Print log message
+     * @param level Log level
+     * @param fmt Message format
+     * @return
+     */
+    static int log(int level, const char* fmt, ...)
+    {
+        va_list arglist;
+        va_start(arglist, fmt);
+        int ret = instance()._log(level,fmt,arglist);
+        va_end(arglist);
+        return ret;
+    }
+
+#define LOG_METHOD(NAME,LEVEL) \
+    static int NAME(const char* fmt, ...) \
+    { \
+        va_list ap; \
+        va_start(ap, fmt); \
+        int ret = instance()._log(LEVEL, fmt, ap); \
+        va_end(ap); \
+        return ret; \
+    }
+
+    LOG_METHOD(fatal, FLANN_LOG_FATAL)
+    LOG_METHOD(error, FLANN_LOG_ERROR)
+    LOG_METHOD(warn, FLANN_LOG_WARN)
+    LOG_METHOD(info, FLANN_LOG_INFO)
+
+private:
+    FILE* stream;
+    int logLevel;
+};
+
+}
+
+#endif //OPENCV_FLANN_LOGGER_H
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h
new file mode 100644
index 0000000..4d4670e
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h
@@ -0,0 +1,392 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+/***********************************************************************
+ * Author: Vincent Rabaud
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_LSH_INDEX_H_
+#define OPENCV_FLANN_LSH_INDEX_H_
+
+#include <algorithm>
+#include <cassert>
+#include <cstring>
+#include <map>
+#include <vector>
+
+#include "general.h"
+#include "nn_index.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "lsh_table.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+
+namespace cvflann
+{
+
+struct LshIndexParams : public IndexParams
+{
+    LshIndexParams(unsigned int table_number = 12, unsigned int key_size = 20, unsigned int multi_probe_level = 2)
+    {
+        (* this)["algorithm"] = FLANN_INDEX_LSH;
+        // The number of hash tables to use
+        (*this)["table_number"] = table_number;
+        // The length of the key in the hash tables
+        (*this)["key_size"] = key_size;
+        // Number of levels to use in multi-probe (0 for standard LSH)
+        (*this)["multi_probe_level"] = multi_probe_level;
+    }
+};
+
+/**
+ * Randomized kd-tree index
+ *
+ * Contains the k-d trees and other information for indexing a set of points
+ * for nearest-neighbor matching.
+ */
+template<typename Distance>
+class LshIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    /** Constructor
+     * @param input_data dataset with the input features
+     * @param params parameters passed to the LSH algorithm
+     * @param d the distance used
+     */
+    LshIndex(const Matrix<ElementType>& input_data, const IndexParams& params = LshIndexParams(),
+             Distance d = Distance()) :
+        dataset_(input_data), index_params_(params), distance_(d)
+    {
+        // cv::flann::IndexParams sets integer params as 'int', so it is used with get_param
+        // in place of 'unsigned int'
+        table_number_ = (unsigned int)get_param<int>(index_params_,"table_number",12);
+        key_size_ = (unsigned int)get_param<int>(index_params_,"key_size",20);
+        multi_probe_level_ = (unsigned int)get_param<int>(index_params_,"multi_probe_level",2);
+
+        feature_size_ = (unsigned)dataset_.cols;
+        fill_xor_mask(0, key_size_, multi_probe_level_, xor_masks_);
+    }
+
+
+    LshIndex(const LshIndex&);
+    LshIndex& operator=(const LshIndex&);
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        tables_.resize(table_number_);
+        for (unsigned int i = 0; i < table_number_; ++i) {
+            lsh::LshTable<ElementType>& table = tables_[i];
+            table = lsh::LshTable<ElementType>(feature_size_, key_size_);
+
+            // Add the features to the table
+            table.add(dataset_);
+        }
+    }
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_LSH;
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream,table_number_);
+        save_value(stream,key_size_);
+        save_value(stream,multi_probe_level_);
+        save_value(stream, dataset_);
+    }
+
+    void loadIndex(FILE* stream)
+    {
+        load_value(stream, table_number_);
+        load_value(stream, key_size_);
+        load_value(stream, multi_probe_level_);
+        load_value(stream, dataset_);
+        // Building the index is so fast we can afford not storing it
+        buildIndex();
+
+        index_params_["algorithm"] = getType();
+        index_params_["table_number"] = table_number_;
+        index_params_["key_size"] = key_size_;
+        index_params_["multi_probe_level"] = multi_probe_level_;
+    }
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return dataset_.rows;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return feature_size_;
+    }
+
+    /**
+     * Computes the index memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return (int)(dataset_.rows * sizeof(int));
+    }
+
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+    /**
+     * \brief Perform k-nearest neighbor search
+     * \param[in] queries The query points for which to find the nearest neighbors
+     * \param[out] indices The indices of the nearest neighbors found
+     * \param[out] dists Distances to the nearest neighbors found
+     * \param[in] knn Number of nearest neighbors to return
+     * \param[in] params Search parameters
+     */
+    virtual void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
+    {
+        assert(queries.cols == veclen());
+        assert(indices.rows >= queries.rows);
+        assert(dists.rows >= queries.rows);
+        assert(int(indices.cols) >= knn);
+        assert(int(dists.cols) >= knn);
+
+
+        KNNUniqueResultSet<DistanceType> resultSet(knn);
+        for (size_t i = 0; i < queries.rows; i++) {
+            resultSet.clear();
+            std::fill_n(indices[i], knn, -1);
+            std::fill_n(dists[i], knn, std::numeric_limits<DistanceType>::max());
+            findNeighbors(resultSet, queries[i], params);
+            if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices[i], dists[i], knn);
+            else resultSet.copy(indices[i], dists[i], knn);
+        }
+    }
+
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     maxCheck = the maximum number of restarts (in a best-bin-first manner)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& /*searchParams*/)
+    {
+        getNeighbors(vec, result);
+    }
+
+private:
+    /** Defines the comparator on score and index
+     */
+    typedef std::pair<float, unsigned int> ScoreIndexPair;
+    struct SortScoreIndexPairOnSecond
+    {
+        bool operator()(const ScoreIndexPair& left, const ScoreIndexPair& right) const
+        {
+            return left.second < right.second;
+        }
+    };
+
+    /** Fills the different xor masks to use when getting the neighbors in multi-probe LSH
+     * @param key the key we build neighbors from
+     * @param lowest_index the lowest index of the bit set
+     * @param level the multi-probe level we are at
+     * @param xor_masks all the xor mask
+     */
+    void fill_xor_mask(lsh::BucketKey key, int lowest_index, unsigned int level,
+                       std::vector<lsh::BucketKey>& xor_masks)
+    {
+        xor_masks.push_back(key);
+        if (level == 0) return;
+        for (int index = lowest_index - 1; index >= 0; --index) {
+            // Create a new key
+            lsh::BucketKey new_key = key | (1 << index);
+            fill_xor_mask(new_key, index, level - 1, xor_masks);
+        }
+    }
+
+    /** Performs the approximate nearest-neighbor search.
+     * @param vec the feature to analyze
+     * @param do_radius flag indicating if we check the radius too
+     * @param radius the radius if it is a radius search
+     * @param do_k flag indicating if we limit the number of nn
+     * @param k_nn the number of nearest neighbors
+     * @param checked_average used for debugging
+     */
+    void getNeighbors(const ElementType* vec, bool /*do_radius*/, float radius, bool do_k, unsigned int k_nn,
+                      float& /*checked_average*/)
+    {
+        static std::vector<ScoreIndexPair> score_index_heap;
+
+        if (do_k) {
+            unsigned int worst_score = std::numeric_limits<unsigned int>::max();
+            typename std::vector<lsh::LshTable<ElementType> >::const_iterator table = tables_.begin();
+            typename std::vector<lsh::LshTable<ElementType> >::const_iterator table_end = tables_.end();
+            for (; table != table_end; ++table) {
+                size_t key = table->getKey(vec);
+                std::vector<lsh::BucketKey>::const_iterator xor_mask = xor_masks_.begin();
+                std::vector<lsh::BucketKey>::const_iterator xor_mask_end = xor_masks_.end();
+                for (; xor_mask != xor_mask_end; ++xor_mask) {
+                    size_t sub_key = key ^ (*xor_mask);
+                    const lsh::Bucket* bucket = table->getBucketFromKey(sub_key);
+                    if (bucket == 0) continue;
+
+                    // Go over each descriptor index
+                    std::vector<lsh::FeatureIndex>::const_iterator training_index = bucket->begin();
+                    std::vector<lsh::FeatureIndex>::const_iterator last_training_index = bucket->end();
+                    DistanceType hamming_distance;
+
+                    // Process the rest of the candidates
+                    for (; training_index < last_training_index; ++training_index) {
+                        hamming_distance = distance_(vec, dataset_[*training_index], dataset_.cols);
+
+                        if (hamming_distance < worst_score) {
+                            // Insert the new element
+                            score_index_heap.push_back(ScoreIndexPair(hamming_distance, training_index));
+                            std::push_heap(score_index_heap.begin(), score_index_heap.end());
+
+                            if (score_index_heap.size() > (unsigned int)k_nn) {
+                                // Remove the highest distance value as we have too many elements
+                                std::pop_heap(score_index_heap.begin(), score_index_heap.end());
+                                score_index_heap.pop_back();
+                                // Keep track of the worst score
+                                worst_score = score_index_heap.front().first;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        else {
+            typename std::vector<lsh::LshTable<ElementType> >::const_iterator table = tables_.begin();
+            typename std::vector<lsh::LshTable<ElementType> >::const_iterator table_end = tables_.end();
+            for (; table != table_end; ++table) {
+                size_t key = table->getKey(vec);
+                std::vector<lsh::BucketKey>::const_iterator xor_mask = xor_masks_.begin();
+                std::vector<lsh::BucketKey>::const_iterator xor_mask_end = xor_masks_.end();
+                for (; xor_mask != xor_mask_end; ++xor_mask) {
+                    size_t sub_key = key ^ (*xor_mask);
+                    const lsh::Bucket* bucket = table->getBucketFromKey(sub_key);
+                    if (bucket == 0) continue;
+
+                    // Go over each descriptor index
+                    std::vector<lsh::FeatureIndex>::const_iterator training_index = bucket->begin();
+                    std::vector<lsh::FeatureIndex>::const_iterator last_training_index = bucket->end();
+                    DistanceType hamming_distance;
+
+                    // Process the rest of the candidates
+                    for (; training_index < last_training_index; ++training_index) {
+                        // Compute the Hamming distance
+                        hamming_distance = distance_(vec, dataset_[*training_index], dataset_.cols);
+                        if (hamming_distance < radius) score_index_heap.push_back(ScoreIndexPair(hamming_distance, training_index));
+                    }
+                }
+            }
+        }
+    }
+
+    /** Performs the approximate nearest-neighbor search.
+     * This is a slower version than the above as it uses the ResultSet
+     * @param vec the feature to analyze
+     */
+    void getNeighbors(const ElementType* vec, ResultSet<DistanceType>& result)
+    {
+        typename std::vector<lsh::LshTable<ElementType> >::const_iterator table = tables_.begin();
+        typename std::vector<lsh::LshTable<ElementType> >::const_iterator table_end = tables_.end();
+        for (; table != table_end; ++table) {
+            size_t key = table->getKey(vec);
+            std::vector<lsh::BucketKey>::const_iterator xor_mask = xor_masks_.begin();
+            std::vector<lsh::BucketKey>::const_iterator xor_mask_end = xor_masks_.end();
+            for (; xor_mask != xor_mask_end; ++xor_mask) {
+                size_t sub_key = key ^ (*xor_mask);
+                const lsh::Bucket* bucket = table->getBucketFromKey((lsh::BucketKey)sub_key);
+                if (bucket == 0) continue;
+
+                // Go over each descriptor index
+                std::vector<lsh::FeatureIndex>::const_iterator training_index = bucket->begin();
+                std::vector<lsh::FeatureIndex>::const_iterator last_training_index = bucket->end();
+                DistanceType hamming_distance;
+
+                // Process the rest of the candidates
+                for (; training_index < last_training_index; ++training_index) {
+                    // Compute the Hamming distance
+                    hamming_distance = distance_(vec, dataset_[*training_index], (int)dataset_.cols);
+                    result.addPoint(hamming_distance, *training_index);
+                }
+            }
+        }
+    }
+
+    /** The different hash tables */
+    std::vector<lsh::LshTable<ElementType> > tables_;
+
+    /** The data the LSH tables where built from */
+    Matrix<ElementType> dataset_;
+
+    /** The size of the features (as ElementType[]) */
+    unsigned int feature_size_;
+
+    IndexParams index_params_;
+
+    /** table number */
+    unsigned int table_number_;
+    /** key size */
+    unsigned int key_size_;
+    /** How far should we look for neighbors in multi-probe LSH */
+    unsigned int multi_probe_level_;
+
+    /** The XOR masks to apply to a key to get the neighboring buckets */
+    std::vector<lsh::BucketKey> xor_masks_;
+
+    Distance distance_;
+};
+}
+
+#endif //OPENCV_FLANN_LSH_INDEX_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h
new file mode 100644
index 0000000..582dcdb
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h
@@ -0,0 +1,492 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+/***********************************************************************
+ * Author: Vincent Rabaud
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_LSH_TABLE_H_
+#define OPENCV_FLANN_LSH_TABLE_H_
+
+#include <algorithm>
+#include <iostream>
+#include <iomanip>
+#include <limits.h>
+// TODO as soon as we use C++0x, use the code in USE_UNORDERED_MAP
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#  define USE_UNORDERED_MAP 1
+#else
+#  define USE_UNORDERED_MAP 0
+#endif
+#if USE_UNORDERED_MAP
+#include <unordered_map>
+#else
+#include <map>
+#endif
+#include <math.h>
+#include <stddef.h>
+
+#include "dynamic_bitset.h"
+#include "matrix.h"
+
+namespace cvflann
+{
+
+namespace lsh
+{
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** What is stored in an LSH bucket
+ */
+typedef uint32_t FeatureIndex;
+/** The id from which we can get a bucket back in an LSH table
+ */
+typedef unsigned int BucketKey;
+
+/** A bucket in an LSH table
+ */
+typedef std::vector<FeatureIndex> Bucket;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** POD for stats about an LSH table
+ */
+struct LshStats
+{
+    std::vector<unsigned int> bucket_sizes_;
+    size_t n_buckets_;
+    size_t bucket_size_mean_;
+    size_t bucket_size_median_;
+    size_t bucket_size_min_;
+    size_t bucket_size_max_;
+    size_t bucket_size_std_dev;
+    /** Each contained vector contains three value: beginning/end for interval, number of elements in the bin
+     */
+    std::vector<std::vector<unsigned int> > size_histogram_;
+};
+
+/** Overload the << operator for LshStats
+ * @param out the streams
+ * @param stats the stats to display
+ * @return the streams
+ */
+inline std::ostream& operator <<(std::ostream& out, const LshStats& stats)
+{
+    int w = 20;
+    out << "Lsh Table Stats:\n" << std::setw(w) << std::setiosflags(std::ios::right) << "N buckets : "
+    << stats.n_buckets_ << "\n" << std::setw(w) << std::setiosflags(std::ios::right) << "mean size : "
+    << std::setiosflags(std::ios::left) << stats.bucket_size_mean_ << "\n" << std::setw(w)
+    << std::setiosflags(std::ios::right) << "median size : " << stats.bucket_size_median_ << "\n" << std::setw(w)
+    << std::setiosflags(std::ios::right) << "min size : " << std::setiosflags(std::ios::left)
+    << stats.bucket_size_min_ << "\n" << std::setw(w) << std::setiosflags(std::ios::right) << "max size : "
+    << std::setiosflags(std::ios::left) << stats.bucket_size_max_;
+
+    // Display the histogram
+    out << std::endl << std::setw(w) << std::setiosflags(std::ios::right) << "histogram : "
+    << std::setiosflags(std::ios::left);
+    for (std::vector<std::vector<unsigned int> >::const_iterator iterator = stats.size_histogram_.begin(), end =
+             stats.size_histogram_.end(); iterator != end; ++iterator) out << (*iterator)[0] << "-" << (*iterator)[1] << ": " << (*iterator)[2] << ",  ";
+
+    return out;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Lsh hash table. As its key is a sub-feature, and as usually
+ * the size of it is pretty small, we keep it as a continuous memory array.
+ * The value is an index in the corpus of features (we keep it as an unsigned
+ * int for pure memory reasons, it could be a size_t)
+ */
+template<typename ElementType>
+class LshTable
+{
+public:
+    /** A container of all the feature indices. Optimized for space
+     */
+#if USE_UNORDERED_MAP
+    typedef std::unordered_map<BucketKey, Bucket> BucketsSpace;
+#else
+    typedef std::map<BucketKey, Bucket> BucketsSpace;
+#endif
+
+    /** A container of all the feature indices. Optimized for speed
+     */
+    typedef std::vector<Bucket> BucketsSpeed;
+
+    /** Default constructor
+     */
+    LshTable()
+    {
+    }
+
+    /** Default constructor
+     * Create the mask and allocate the memory
+     * @param feature_size is the size of the feature (considered as a ElementType[])
+     * @param key_size is the number of bits that are turned on in the feature
+     */
+    LshTable(unsigned int feature_size, unsigned int key_size)
+    {
+        (void)feature_size;
+        (void)key_size;
+        std::cerr << "LSH is not implemented for that type" << std::endl;
+        assert(0);
+    }
+
+    /** Add a feature to the table
+     * @param value the value to store for that feature
+     * @param feature the feature itself
+     */
+    void add(unsigned int value, const ElementType* feature)
+    {
+        // Add the value to the corresponding bucket
+        BucketKey key = (lsh::BucketKey)getKey(feature);
+
+        switch (speed_level_) {
+        case kArray:
+            // That means we get the buckets from an array
+            buckets_speed_[key].push_back(value);
+            break;
+        case kBitsetHash:
+            // That means we can check the bitset for the presence of a key
+            key_bitset_.set(key);
+            buckets_space_[key].push_back(value);
+            break;
+        case kHash:
+        {
+            // That means we have to check for the hash table for the presence of a key
+            buckets_space_[key].push_back(value);
+            break;
+        }
+        }
+    }
+
+    /** Add a set of features to the table
+     * @param dataset the values to store
+     */
+    void add(Matrix<ElementType> dataset)
+    {
+#if USE_UNORDERED_MAP
+        buckets_space_.rehash((buckets_space_.size() + dataset.rows) * 1.2);
+#endif
+        // Add the features to the table
+        for (unsigned int i = 0; i < dataset.rows; ++i) add(i, dataset[i]);
+        // Now that the table is full, optimize it for speed/space
+        optimize();
+    }
+
+    /** Get a bucket given the key
+     * @param key
+     * @return
+     */
+    inline const Bucket* getBucketFromKey(BucketKey key) const
+    {
+        // Generate other buckets
+        switch (speed_level_) {
+        case kArray:
+            // That means we get the buckets from an array
+            return &buckets_speed_[key];
+            break;
+        case kBitsetHash:
+            // That means we can check the bitset for the presence of a key
+            if (key_bitset_.test(key)) return &buckets_space_.find(key)->second;
+            else return 0;
+            break;
+        case kHash:
+        {
+            // That means we have to check for the hash table for the presence of a key
+            BucketsSpace::const_iterator bucket_it, bucket_end = buckets_space_.end();
+            bucket_it = buckets_space_.find(key);
+            // Stop here if that bucket does not exist
+            if (bucket_it == bucket_end) return 0;
+            else return &bucket_it->second;
+            break;
+        }
+        }
+        return 0;
+    }
+
+    /** Compute the sub-signature of a feature
+     */
+    size_t getKey(const ElementType* /*feature*/) const
+    {
+        std::cerr << "LSH is not implemented for that type" << std::endl;
+        assert(0);
+        return 1;
+    }
+
+    /** Get statistics about the table
+     * @return
+     */
+    LshStats getStats() const;
+
+private:
+    /** defines the speed fo the implementation
+     * kArray uses a vector for storing data
+     * kBitsetHash uses a hash map but checks for the validity of a key with a bitset
+     * kHash uses a hash map only
+     */
+    enum SpeedLevel
+    {
+        kArray, kBitsetHash, kHash
+    };
+
+    /** Initialize some variables
+     */
+    void initialize(size_t key_size)
+    {
+        const size_t key_size_lower_bound = 1;
+        //a value (size_t(1) << key_size) must fit the size_t type so key_size has to be strictly less than size of size_t
+        const size_t key_size_upper_bound = std::min(sizeof(BucketKey) * CHAR_BIT + 1, sizeof(size_t) * CHAR_BIT);
+        if (key_size < key_size_lower_bound || key_size >= key_size_upper_bound)
+        {
+            CV_Error(cv::Error::StsBadArg, cv::format("Invalid key_size (=%d). Valid values for your system are %d <= key_size < %d.", (int)key_size, (int)key_size_lower_bound, (int)key_size_upper_bound));
+        }
+
+        speed_level_ = kHash;
+        key_size_ = (unsigned)key_size;
+    }
+
+    /** Optimize the table for speed/space
+     */
+    void optimize()
+    {
+        // If we are already using the fast storage, no need to do anything
+        if (speed_level_ == kArray) return;
+
+        // Use an array if it will be more than half full
+        if (buckets_space_.size() > ((size_t(1) << key_size_) / 2)) {
+            speed_level_ = kArray;
+            // Fill the array version of it
+            buckets_speed_.resize(size_t(1) << key_size_);
+            for (BucketsSpace::const_iterator key_bucket = buckets_space_.begin(); key_bucket != buckets_space_.end(); ++key_bucket) buckets_speed_[key_bucket->first] = key_bucket->second;
+
+            // Empty the hash table
+            buckets_space_.clear();
+            return;
+        }
+
+        // If the bitset is going to use less than 10% of the RAM of the hash map (at least 1 size_t for the key and two
+        // for the vector) or less than 512MB (key_size_ <= 30)
+        if (((std::max(buckets_space_.size(), buckets_speed_.size()) * CHAR_BIT * 3 * sizeof(BucketKey)) / 10
+             >= (size_t(1) << key_size_)) || (key_size_ <= 32)) {
+            speed_level_ = kBitsetHash;
+            key_bitset_.resize(size_t(1) << key_size_);
+            key_bitset_.reset();
+            // Try with the BucketsSpace
+            for (BucketsSpace::const_iterator key_bucket = buckets_space_.begin(); key_bucket != buckets_space_.end(); ++key_bucket) key_bitset_.set(key_bucket->first);
+        }
+        else {
+            speed_level_ = kHash;
+            key_bitset_.clear();
+        }
+    }
+
+    /** The vector of all the buckets if they are held for speed
+     */
+    BucketsSpeed buckets_speed_;
+
+    /** The hash table of all the buckets in case we cannot use the speed version
+     */
+    BucketsSpace buckets_space_;
+
+    /** What is used to store the data */
+    SpeedLevel speed_level_;
+
+    /** If the subkey is small enough, it will keep track of which subkeys are set through that bitset
+     * That is just a speedup so that we don't look in the hash table (which can be mush slower that checking a bitset)
+     */
+    DynamicBitset key_bitset_;
+
+    /** The size of the sub-signature in bits
+     */
+    unsigned int key_size_;
+
+    // Members only used for the unsigned char specialization
+    /** The mask to apply to a feature to get the hash key
+     * Only used in the unsigned char case
+     */
+    std::vector<size_t> mask_;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Specialization for unsigned char
+
+template<>
+inline LshTable<unsigned char>::LshTable(unsigned int feature_size, unsigned int subsignature_size)
+{
+    initialize(subsignature_size);
+    // Allocate the mask
+    mask_ = std::vector<size_t>((size_t)ceil((float)(feature_size * sizeof(char)) / (float)sizeof(size_t)), 0);
+
+    // A bit brutal but fast to code
+    std::vector<size_t> indices(feature_size * CHAR_BIT);
+    for (size_t i = 0; i < feature_size * CHAR_BIT; ++i) indices[i] = i;
+    std::random_shuffle(indices.begin(), indices.end());
+
+    // Generate a random set of order of subsignature_size_ bits
+    for (unsigned int i = 0; i < key_size_; ++i) {
+        size_t index = indices[i];
+
+        // Set that bit in the mask
+        size_t divisor = CHAR_BIT * sizeof(size_t);
+        size_t idx = index / divisor; //pick the right size_t index
+        mask_[idx] |= size_t(1) << (index % divisor); //use modulo to find the bit offset
+    }
+
+    // Set to 1 if you want to display the mask for debug
+#if 0
+    {
+        size_t bcount = 0;
+        BOOST_FOREACH(size_t mask_block, mask_){
+            out << std::setw(sizeof(size_t) * CHAR_BIT / 4) << std::setfill('0') << std::hex << mask_block
+                << std::endl;
+            bcount += __builtin_popcountll(mask_block);
+        }
+        out << "bit count : " << std::dec << bcount << std::endl;
+        out << "mask size : " << mask_.size() << std::endl;
+        return out;
+    }
+#endif
+}
+
+/** Return the Subsignature of a feature
+ * @param feature the feature to analyze
+ */
+template<>
+inline size_t LshTable<unsigned char>::getKey(const unsigned char* feature) const
+{
+    // no need to check if T is dividable by sizeof(size_t) like in the Hamming
+    // distance computation as we have a mask
+    const size_t* feature_block_ptr = reinterpret_cast<const size_t*> ((const void*)feature);
+
+    // Figure out the subsignature of the feature
+    // Given the feature ABCDEF, and the mask 001011, the output will be
+    // 000CEF
+    size_t subsignature = 0;
+    size_t bit_index = 1;
+
+    for (std::vector<size_t>::const_iterator pmask_block = mask_.begin(); pmask_block != mask_.end(); ++pmask_block) {
+        // get the mask and signature blocks
+        size_t feature_block = *feature_block_ptr;
+        size_t mask_block = *pmask_block;
+        while (mask_block) {
+            // Get the lowest set bit in the mask block
+            size_t lowest_bit = mask_block & (-(ptrdiff_t)mask_block);
+            // Add it to the current subsignature if necessary
+            subsignature += (feature_block & lowest_bit) ? bit_index : 0;
+            // Reset the bit in the mask block
+            mask_block ^= lowest_bit;
+            // increment the bit index for the subsignature
+            bit_index <<= 1;
+        }
+        // Check the next feature block
+        ++feature_block_ptr;
+    }
+    return subsignature;
+}
+
+template<>
+inline LshStats LshTable<unsigned char>::getStats() const
+{
+    LshStats stats;
+    stats.bucket_size_mean_ = 0;
+    if ((buckets_speed_.empty()) && (buckets_space_.empty())) {
+        stats.n_buckets_ = 0;
+        stats.bucket_size_median_ = 0;
+        stats.bucket_size_min_ = 0;
+        stats.bucket_size_max_ = 0;
+        return stats;
+    }
+
+    if (!buckets_speed_.empty()) {
+        for (BucketsSpeed::const_iterator pbucket = buckets_speed_.begin(); pbucket != buckets_speed_.end(); ++pbucket) {
+            stats.bucket_sizes_.push_back((lsh::FeatureIndex)pbucket->size());
+            stats.bucket_size_mean_ += pbucket->size();
+        }
+        stats.bucket_size_mean_ /= buckets_speed_.size();
+        stats.n_buckets_ = buckets_speed_.size();
+    }
+    else {
+        for (BucketsSpace::const_iterator x = buckets_space_.begin(); x != buckets_space_.end(); ++x) {
+            stats.bucket_sizes_.push_back((lsh::FeatureIndex)x->second.size());
+            stats.bucket_size_mean_ += x->second.size();
+        }
+        stats.bucket_size_mean_ /= buckets_space_.size();
+        stats.n_buckets_ = buckets_space_.size();
+    }
+
+    std::sort(stats.bucket_sizes_.begin(), stats.bucket_sizes_.end());
+
+    //  BOOST_FOREACH(int size, stats.bucket_sizes_)
+    //          std::cout << size << " ";
+    //  std::cout << std::endl;
+    stats.bucket_size_median_ = stats.bucket_sizes_[stats.bucket_sizes_.size() / 2];
+    stats.bucket_size_min_ = stats.bucket_sizes_.front();
+    stats.bucket_size_max_ = stats.bucket_sizes_.back();
+
+    // TODO compute mean and std
+    /*float mean, stddev;
+       stats.bucket_size_mean_ = mean;
+       stats.bucket_size_std_dev = stddev;*/
+
+    // Include a histogram of the buckets
+    unsigned int bin_start = 0;
+    unsigned int bin_end = 20;
+    bool is_new_bin = true;
+    for (std::vector<unsigned int>::iterator iterator = stats.bucket_sizes_.begin(), end = stats.bucket_sizes_.end(); iterator
+         != end; )
+        if (*iterator < bin_end) {
+            if (is_new_bin) {
+                stats.size_histogram_.push_back(std::vector<unsigned int>(3, 0));
+                stats.size_histogram_.back()[0] = bin_start;
+                stats.size_histogram_.back()[1] = bin_end - 1;
+                is_new_bin = false;
+            }
+            ++stats.size_histogram_.back()[2];
+            ++iterator;
+        }
+        else {
+            bin_start += 20;
+            bin_end += 20;
+            is_new_bin = true;
+        }
+
+    return stats;
+}
+
+// End the two namespaces
+}
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif /* OPENCV_FLANN_LSH_TABLE_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h
new file mode 100644
index 0000000..51b6c63
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h
@@ -0,0 +1,116 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_DATASET_H_
+#define OPENCV_FLANN_DATASET_H_
+
+#include <stdio.h>
+
+#include "general.h"
+
+namespace cvflann
+{
+
+/**
+ * Class that implements a simple rectangular matrix stored in a memory buffer and
+ * provides convenient matrix-like access using the [] operators.
+ */
+template <typename T>
+class Matrix
+{
+public:
+    typedef T type;
+
+    size_t rows;
+    size_t cols;
+    size_t stride;
+    T* data;
+
+    Matrix() : rows(0), cols(0), stride(0), data(NULL)
+    {
+    }
+
+    Matrix(T* data_, size_t rows_, size_t cols_, size_t stride_ = 0) :
+        rows(rows_), cols(cols_),  stride(stride_), data(data_)
+    {
+        if (stride==0) stride = cols;
+    }
+
+    /**
+     * Convenience function for deallocating the storage data.
+     */
+    FLANN_DEPRECATED void free()
+    {
+        fprintf(stderr, "The cvflann::Matrix<T>::free() method is deprecated "
+                "and it does not do any memory deallocation any more.  You are"
+                "responsible for deallocating the matrix memory (by doing"
+                "'delete[] matrix.data' for example)");
+    }
+
+    /**
+     * Operator that return a (pointer to a) row of the data.
+     */
+    T* operator[](size_t index) const
+    {
+        return data+index*stride;
+    }
+};
+
+
+class UntypedMatrix
+{
+public:
+    size_t rows;
+    size_t cols;
+    void* data;
+    flann_datatype_t type;
+
+    UntypedMatrix(void* data_, long rows_, long cols_) :
+        rows(rows_), cols(cols_), data(data_)
+    {
+    }
+
+    ~UntypedMatrix()
+    {
+    }
+
+
+    template<typename T>
+    Matrix<T> as()
+    {
+        return Matrix<T>((T*)data, rows, cols);
+    }
+};
+
+
+
+}
+
+#endif //OPENCV_FLANN_DATASET_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp
new file mode 100644
index 0000000..02fa236
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp
@@ -0,0 +1,158 @@
+/*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*/
+
+#ifndef _OPENCV_MINIFLANN_HPP_
+#define _OPENCV_MINIFLANN_HPP_
+
+#include "opencv2/core.hpp"
+#include "opencv2/flann/defines.h"
+
+namespace cv
+{
+
+namespace flann
+{
+
+struct CV_EXPORTS IndexParams
+{
+    IndexParams();
+    ~IndexParams();
+
+    String getString(const String& key, const String& defaultVal=String()) const;
+    int getInt(const String& key, int defaultVal=-1) const;
+    double getDouble(const String& key, double defaultVal=-1) const;
+
+    void setString(const String& key, const String& value);
+    void setInt(const String& key, int value);
+    void setDouble(const String& key, double value);
+    void setFloat(const String& key, float value);
+    void setBool(const String& key, bool value);
+    void setAlgorithm(int value);
+
+    void getAll(std::vector<String>& names,
+                std::vector<int>& types,
+                std::vector<String>& strValues,
+                std::vector<double>& numValues) const;
+
+    void* params;
+};
+
+struct CV_EXPORTS KDTreeIndexParams : public IndexParams
+{
+    KDTreeIndexParams(int trees=4);
+};
+
+struct CV_EXPORTS LinearIndexParams : public IndexParams
+{
+    LinearIndexParams();
+};
+
+struct CV_EXPORTS CompositeIndexParams : public IndexParams
+{
+    CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11,
+                         cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2f );
+};
+
+struct CV_EXPORTS AutotunedIndexParams : public IndexParams
+{
+    AutotunedIndexParams(float target_precision = 0.8f, float build_weight = 0.01f,
+                         float memory_weight = 0, float sample_fraction = 0.1f);
+};
+
+struct CV_EXPORTS HierarchicalClusteringIndexParams : public IndexParams
+{
+    HierarchicalClusteringIndexParams(int branching = 32,
+                      cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, int trees = 4, int leaf_size = 100 );
+};
+
+struct CV_EXPORTS KMeansIndexParams : public IndexParams
+{
+    KMeansIndexParams(int branching = 32, int iterations = 11,
+                      cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2f );
+};
+
+struct CV_EXPORTS LshIndexParams : public IndexParams
+{
+    LshIndexParams(int table_number, int key_size, int multi_probe_level);
+};
+
+struct CV_EXPORTS SavedIndexParams : public IndexParams
+{
+    SavedIndexParams(const String& filename);
+};
+
+struct CV_EXPORTS SearchParams : public IndexParams
+{
+    SearchParams( int checks = 32, float eps = 0, bool sorted = true );
+};
+
+class CV_EXPORTS_W Index
+{
+public:
+    CV_WRAP Index();
+    CV_WRAP Index(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2);
+    virtual ~Index();
+
+    CV_WRAP virtual void build(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2);
+    CV_WRAP virtual void knnSearch(InputArray query, OutputArray indices,
+                   OutputArray dists, int knn, const SearchParams& params=SearchParams());
+
+    CV_WRAP virtual int radiusSearch(InputArray query, OutputArray indices,
+                             OutputArray dists, double radius, int maxResults,
+                             const SearchParams& params=SearchParams());
+
+    CV_WRAP virtual void save(const String& filename) const;
+    CV_WRAP virtual bool load(InputArray features, const String& filename);
+    CV_WRAP virtual void release();
+    CV_WRAP cvflann::flann_distance_t getDistance() const;
+    CV_WRAP cvflann::flann_algorithm_t getAlgorithm() const;
+
+protected:
+    cvflann::flann_distance_t distType;
+    cvflann::flann_algorithm_t algo;
+    int featureType;
+    void* index;
+};
+
+} } // namespace cv::flann
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h
new file mode 100644
index 0000000..381d4bc
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h
@@ -0,0 +1,177 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_NNINDEX_H
+#define OPENCV_FLANN_NNINDEX_H
+
+#include "general.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "params.h"
+
+namespace cvflann
+{
+
+/**
+ * Nearest-neighbour index base class
+ */
+template <typename Distance>
+class NNIndex
+{
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+public:
+
+    virtual ~NNIndex() {}
+
+    /**
+     * \brief Builds the index
+     */
+    virtual void buildIndex() = 0;
+
+    /**
+     * \brief Perform k-nearest neighbor search
+     * \param[in] queries The query points for which to find the nearest neighbors
+     * \param[out] indices The indices of the nearest neighbors found
+     * \param[out] dists Distances to the nearest neighbors found
+     * \param[in] knn Number of nearest neighbors to return
+     * \param[in] params Search parameters
+     */
+    virtual void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
+    {
+        assert(queries.cols == veclen());
+        assert(indices.rows >= queries.rows);
+        assert(dists.rows >= queries.rows);
+        assert(int(indices.cols) >= knn);
+        assert(int(dists.cols) >= knn);
+
+#if 0
+        KNNResultSet<DistanceType> resultSet(knn);
+        for (size_t i = 0; i < queries.rows; i++) {
+            resultSet.init(indices[i], dists[i]);
+            findNeighbors(resultSet, queries[i], params);
+        }
+#else
+        KNNUniqueResultSet<DistanceType> resultSet(knn);
+        for (size_t i = 0; i < queries.rows; i++) {
+            resultSet.clear();
+            findNeighbors(resultSet, queries[i], params);
+            if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices[i], dists[i], knn);
+            else resultSet.copy(indices[i], dists[i], knn);
+        }
+#endif
+    }
+
+    /**
+     * \brief Perform radius search
+     * \param[in] query The query point
+     * \param[out] indices The indinces of the neighbors found within the given radius
+     * \param[out] dists The distances to the nearest neighbors found
+     * \param[in] radius The radius used for search
+     * \param[in] params Search parameters
+     * \returns Number of neighbors found
+     */
+    virtual int radiusSearch(const Matrix<ElementType>& query, Matrix<int>& indices, Matrix<DistanceType>& dists, float radius, const SearchParams& params)
+    {
+        if (query.rows != 1) {
+            fprintf(stderr, "I can only search one feature at a time for range search\n");
+            return -1;
+        }
+        assert(query.cols == veclen());
+        assert(indices.cols == dists.cols);
+
+        int n = 0;
+        int* indices_ptr = NULL;
+        DistanceType* dists_ptr = NULL;
+        if (indices.cols > 0) {
+            n = (int)indices.cols;
+            indices_ptr = indices[0];
+            dists_ptr = dists[0];
+        }
+
+        RadiusUniqueResultSet<DistanceType> resultSet((DistanceType)radius);
+        resultSet.clear();
+        findNeighbors(resultSet, query[0], params);
+        if (n>0) {
+            if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices_ptr, dists_ptr, n);
+            else resultSet.copy(indices_ptr, dists_ptr, n);
+        }
+
+        return (int)resultSet.size();
+    }
+
+    /**
+     * \brief Saves the index to a stream
+     * \param stream The stream to save the index to
+     */
+    virtual void saveIndex(FILE* stream) = 0;
+
+    /**
+     * \brief Loads the index from a stream
+     * \param stream The stream from which the index is loaded
+     */
+    virtual void loadIndex(FILE* stream) = 0;
+
+    /**
+     * \returns number of features in this index.
+     */
+    virtual size_t size() const = 0;
+
+    /**
+     * \returns The dimensionality of the features in this index.
+     */
+    virtual size_t veclen() const = 0;
+
+    /**
+     * \returns The amount of memory (in bytes) used by the index.
+     */
+    virtual int usedMemory() const = 0;
+
+    /**
+     * \returns The index type (kdtree, kmeans,...)
+     */
+    virtual flann_algorithm_t getType() const = 0;
+
+    /**
+     * \returns The index parameters
+     */
+    virtual IndexParams getParameters() const = 0;
+
+
+    /**
+     * \brief Method that searches for nearest-neighbours
+     */
+    virtual void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) = 0;
+};
+
+}
+
+#endif //OPENCV_FLANN_NNINDEX_H
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h
new file mode 100644
index 0000000..7f971c5
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h
@@ -0,0 +1,91 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_OBJECT_FACTORY_H_
+#define OPENCV_FLANN_OBJECT_FACTORY_H_
+
+#include <map>
+
+namespace cvflann
+{
+
+class CreatorNotFound
+{
+};
+
+template<typename BaseClass,
+         typename UniqueIdType,
+         typename ObjectCreator = BaseClass* (*)()>
+class ObjectFactory
+{
+    typedef ObjectFactory<BaseClass,UniqueIdType,ObjectCreator> ThisClass;
+    typedef std::map<UniqueIdType, ObjectCreator> ObjectRegistry;
+
+    // singleton class, private constructor
+    ObjectFactory() {}
+
+public:
+
+    bool subscribe(UniqueIdType id, ObjectCreator creator)
+    {
+        if (object_registry.find(id) != object_registry.end()) return false;
+
+        object_registry[id] = creator;
+        return true;
+    }
+
+    bool unregister(UniqueIdType id)
+    {
+        return object_registry.erase(id) == 1;
+    }
+
+    ObjectCreator create(UniqueIdType id)
+    {
+        typename ObjectRegistry::const_iterator iter = object_registry.find(id);
+
+        if (iter == object_registry.end()) {
+            throw CreatorNotFound();
+        }
+
+        return iter->second;
+    }
+
+    static ThisClass& instance()
+    {
+        static ThisClass the_factory;
+        return the_factory;
+    }
+private:
+    ObjectRegistry object_registry;
+};
+
+}
+
+#endif /* OPENCV_FLANN_OBJECT_FACTORY_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/params.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/params.h
new file mode 100644
index 0000000..95ef4cd
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/params.h
@@ -0,0 +1,99 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2011  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2011  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_PARAMS_H_
+#define OPENCV_FLANN_PARAMS_H_
+
+#include "any.h"
+#include "general.h"
+#include <iostream>
+#include <map>
+
+
+namespace cvflann
+{
+
+typedef std::map<cv::String, any> IndexParams;
+
+struct SearchParams : public IndexParams
+{
+    SearchParams(int checks = 32, float eps = 0, bool sorted = true )
+    {
+        // how many leafs to visit when searching for neighbours (-1 for unlimited)
+        (*this)["checks"] = checks;
+        // search for eps-approximate neighbours (default: 0)
+        (*this)["eps"] = eps;
+        // only for radius search, require neighbours sorted by distance (default: true)
+        (*this)["sorted"] = sorted;
+    }
+};
+
+
+template<typename T>
+T get_param(const IndexParams& params, cv::String name, const T& default_value)
+{
+    IndexParams::const_iterator it = params.find(name);
+    if (it != params.end()) {
+        return it->second.cast<T>();
+    }
+    else {
+        return default_value;
+    }
+}
+
+template<typename T>
+T get_param(const IndexParams& params, cv::String name)
+{
+    IndexParams::const_iterator it = params.find(name);
+    if (it != params.end()) {
+        return it->second.cast<T>();
+    }
+    else {
+        throw FLANNException(cv::String("Missing parameter '")+name+cv::String("' in the parameters given"));
+    }
+}
+
+inline void print_params(const IndexParams& params, std::ostream& stream)
+{
+    IndexParams::const_iterator it;
+
+    for(it=params.begin(); it!=params.end(); ++it) {
+        stream << it->first << " : " << it->second << std::endl;
+    }
+}
+
+inline void print_params(const IndexParams& params)
+{
+    print_params(params, std::cout);
+}
+
+}
+
+
+#endif /* OPENCV_FLANN_PARAMS_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/random.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/random.h
new file mode 100644
index 0000000..a3cf5ec
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/random.h
@@ -0,0 +1,133 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_RANDOM_H
+#define OPENCV_FLANN_RANDOM_H
+
+#include <algorithm>
+#include <cstdlib>
+#include <vector>
+
+#include "general.h"
+
+namespace cvflann
+{
+
+/**
+ * Seeds the random number generator
+ *  @param seed Random seed
+ */
+inline void seed_random(unsigned int seed)
+{
+    srand(seed);
+}
+
+/*
+ * Generates a random double value.
+ */
+/**
+ * Generates a random double value.
+ * @param high Upper limit
+ * @param low Lower limit
+ * @return Random double value
+ */
+inline double rand_double(double high = 1.0, double low = 0)
+{
+    return low + ((high-low) * (std::rand() / (RAND_MAX + 1.0)));
+}
+
+/**
+ * Generates a random integer value.
+ * @param high Upper limit
+ * @param low Lower limit
+ * @return Random integer value
+ */
+inline int rand_int(int high = RAND_MAX, int low = 0)
+{
+    return low + (int) ( double(high-low) * (std::rand() / (RAND_MAX + 1.0)));
+}
+
+/**
+ * Random number generator that returns a distinct number from
+ * the [0,n) interval each time.
+ */
+class UniqueRandom
+{
+    std::vector<int> vals_;
+    int size_;
+    int counter_;
+
+public:
+    /**
+     * Constructor.
+     * @param n Size of the interval from which to generate
+     * @return
+     */
+    UniqueRandom(int n)
+    {
+        init(n);
+    }
+
+    /**
+     * Initializes the number generator.
+     * @param n the size of the interval from which to generate random numbers.
+     */
+    void init(int n)
+    {
+        // create and initialize an array of size n
+        vals_.resize(n);
+        size_ = n;
+        for (int i = 0; i < size_; ++i) vals_[i] = i;
+
+        // shuffle the elements in the array
+        std::random_shuffle(vals_.begin(), vals_.end());
+
+        counter_ = 0;
+    }
+
+    /**
+     * Return a distinct random integer in greater or equal to 0 and less
+     * than 'n' on each call. It should be called maximum 'n' times.
+     * Returns: a random integer
+     */
+    int next()
+    {
+        if (counter_ == size_) {
+            return -1;
+        }
+        else {
+            return vals_[counter_++];
+        }
+    }
+};
+
+}
+
+#endif //OPENCV_FLANN_RANDOM_H
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h
new file mode 100644
index 0000000..9750019
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h
@@ -0,0 +1,543 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_RESULTSET_H
+#define OPENCV_FLANN_RESULTSET_H
+
+#include <algorithm>
+#include <cstring>
+#include <iostream>
+#include <limits>
+#include <set>
+#include <vector>
+
+namespace cvflann
+{
+
+/* This record represents a branch point when finding neighbors in
+    the tree.  It contains a record of the minimum distance to the query
+    point, as well as the node at which the search resumes.
+ */
+
+template <typename T, typename DistanceType>
+struct BranchStruct
+{
+    T node;           /* Tree node at which search resumes */
+    DistanceType mindist;     /* Minimum distance to query for all nodes below. */
+
+    BranchStruct() {}
+    BranchStruct(const T& aNode, DistanceType dist) : node(aNode), mindist(dist) {}
+
+    bool operator<(const BranchStruct<T, DistanceType>& rhs) const
+    {
+        return mindist<rhs.mindist;
+    }
+};
+
+
+template <typename DistanceType>
+class ResultSet
+{
+public:
+    virtual ~ResultSet() {}
+
+    virtual bool full() const = 0;
+
+    virtual void addPoint(DistanceType dist, int index) = 0;
+
+    virtual DistanceType worstDist() const = 0;
+
+};
+
+/**
+ * KNNSimpleResultSet does not ensure that the element it holds are unique.
+ * Is used in those cases where the nearest neighbour algorithm used does not
+ * attempt to insert the same element multiple times.
+ */
+template <typename DistanceType>
+class KNNSimpleResultSet : public ResultSet<DistanceType>
+{
+    int* indices;
+    DistanceType* dists;
+    int capacity;
+    int count;
+    DistanceType worst_distance_;
+
+public:
+    KNNSimpleResultSet(int capacity_) : capacity(capacity_), count(0)
+    {
+    }
+
+    void init(int* indices_, DistanceType* dists_)
+    {
+        indices = indices_;
+        dists = dists_;
+        count = 0;
+        worst_distance_ = (std::numeric_limits<DistanceType>::max)();
+        dists[capacity-1] = worst_distance_;
+    }
+
+    size_t size() const
+    {
+        return count;
+    }
+
+    bool full() const
+    {
+        return count == capacity;
+    }
+
+
+    void addPoint(DistanceType dist, int index)
+    {
+        if (dist >= worst_distance_) return;
+        int i;
+        for (i=count; i>0; --i) {
+#ifdef FLANN_FIRST_MATCH
+            if ( (dists[i-1]>dist) || ((dist==dists[i-1])&&(indices[i-1]>index)) )
+#else
+            if (dists[i-1]>dist)
+#endif
+            {
+                if (i<capacity) {
+                    dists[i] = dists[i-1];
+                    indices[i] = indices[i-1];
+                }
+            }
+            else break;
+        }
+        if (count < capacity) ++count;
+        dists[i] = dist;
+        indices[i] = index;
+        worst_distance_ = dists[capacity-1];
+    }
+
+    DistanceType worstDist() const
+    {
+        return worst_distance_;
+    }
+};
+
+/**
+ * K-Nearest neighbour result set. Ensures that the elements inserted are unique
+ */
+template <typename DistanceType>
+class KNNResultSet : public ResultSet<DistanceType>
+{
+    int* indices;
+    DistanceType* dists;
+    int capacity;
+    int count;
+    DistanceType worst_distance_;
+
+public:
+    KNNResultSet(int capacity_) : capacity(capacity_), count(0)
+    {
+    }
+
+    void init(int* indices_, DistanceType* dists_)
+    {
+        indices = indices_;
+        dists = dists_;
+        count = 0;
+        worst_distance_ = (std::numeric_limits<DistanceType>::max)();
+        dists[capacity-1] = worst_distance_;
+    }
+
+    size_t size() const
+    {
+        return count;
+    }
+
+    bool full() const
+    {
+        return count == capacity;
+    }
+
+
+    void addPoint(DistanceType dist, int index)
+    {
+        if (dist >= worst_distance_) return;
+        int i;
+        for (i = count; i > 0; --i) {
+#ifdef FLANN_FIRST_MATCH
+            if ( (dists[i-1]<=dist) && ((dist!=dists[i-1])||(indices[i-1]<=index)) )
+#else
+            if (dists[i-1]<=dist)
+#endif
+            {
+                // Check for duplicate indices
+                int j = i - 1;
+                while ((j >= 0) && (dists[j] == dist)) {
+                    if (indices[j] == index) {
+                        return;
+                    }
+                    --j;
+                }
+                break;
+            }
+        }
+
+        if (count < capacity) ++count;
+        for (int j = count-1; j > i; --j) {
+            dists[j] = dists[j-1];
+            indices[j] = indices[j-1];
+        }
+        dists[i] = dist;
+        indices[i] = index;
+        worst_distance_ = dists[capacity-1];
+    }
+
+    DistanceType worstDist() const
+    {
+        return worst_distance_;
+    }
+};
+
+
+/**
+ * A result-set class used when performing a radius based search.
+ */
+template <typename DistanceType>
+class RadiusResultSet : public ResultSet<DistanceType>
+{
+    DistanceType radius;
+    int* indices;
+    DistanceType* dists;
+    size_t capacity;
+    size_t count;
+
+public:
+    RadiusResultSet(DistanceType radius_, int* indices_, DistanceType* dists_, int capacity_) :
+        radius(radius_), indices(indices_), dists(dists_), capacity(capacity_)
+    {
+        init();
+    }
+
+    ~RadiusResultSet()
+    {
+    }
+
+    void init()
+    {
+        count = 0;
+    }
+
+    size_t size() const
+    {
+        return count;
+    }
+
+    bool full() const
+    {
+        return true;
+    }
+
+    void addPoint(DistanceType dist, int index)
+    {
+        if (dist<radius) {
+            if ((capacity>0)&&(count < capacity)) {
+                dists[count] = dist;
+                indices[count] = index;
+            }
+            count++;
+        }
+    }
+
+    DistanceType worstDist() const
+    {
+        return radius;
+    }
+
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Class that holds the k NN neighbors
+ * Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays
+ */
+template<typename DistanceType>
+class UniqueResultSet : public ResultSet<DistanceType>
+{
+public:
+    struct DistIndex
+    {
+        DistIndex(DistanceType dist, unsigned int index) :
+            dist_(dist), index_(index)
+        {
+        }
+        bool operator<(const DistIndex dist_index) const
+        {
+            return (dist_ < dist_index.dist_) || ((dist_ == dist_index.dist_) && index_ < dist_index.index_);
+        }
+        DistanceType dist_;
+        unsigned int index_;
+    };
+
+    /** Default cosntructor */
+    UniqueResultSet() :
+        worst_distance_(std::numeric_limits<DistanceType>::max())
+    {
+    }
+
+    /** Check the status of the set
+     * @return true if we have k NN
+     */
+    inline bool full() const
+    {
+        return is_full_;
+    }
+
+    /** Remove all elements in the set
+     */
+    virtual void clear() = 0;
+
+    /** Copy the set to two C arrays
+     * @param indices pointer to a C array of indices
+     * @param dist pointer to a C array of distances
+     * @param n_neighbors the number of neighbors to copy
+     */
+    virtual void copy(int* indices, DistanceType* dist, int n_neighbors = -1) const
+    {
+        if (n_neighbors < 0) {
+            for (typename std::set<DistIndex>::const_iterator dist_index = dist_indices_.begin(), dist_index_end =
+                     dist_indices_.end(); dist_index != dist_index_end; ++dist_index, ++indices, ++dist) {
+                *indices = dist_index->index_;
+                *dist = dist_index->dist_;
+            }
+        }
+        else {
+            int i = 0;
+            for (typename std::set<DistIndex>::const_iterator dist_index = dist_indices_.begin(), dist_index_end =
+                     dist_indices_.end(); (dist_index != dist_index_end) && (i < n_neighbors); ++dist_index, ++indices, ++dist, ++i) {
+                *indices = dist_index->index_;
+                *dist = dist_index->dist_;
+            }
+        }
+    }
+
+    /** Copy the set to two C arrays but sort it according to the distance first
+     * @param indices pointer to a C array of indices
+     * @param dist pointer to a C array of distances
+     * @param n_neighbors the number of neighbors to copy
+     */
+    virtual void sortAndCopy(int* indices, DistanceType* dist, int n_neighbors = -1) const
+    {
+        copy(indices, dist, n_neighbors);
+    }
+
+    /** The number of neighbors in the set
+     * @return
+     */
+    size_t size() const
+    {
+        return dist_indices_.size();
+    }
+
+    /** The distance of the furthest neighbor
+     * If we don't have enough neighbors, it returns the max possible value
+     * @return
+     */
+    inline DistanceType worstDist() const
+    {
+        return worst_distance_;
+    }
+protected:
+    /** Flag to say if the set is full */
+    bool is_full_;
+
+    /** The worst distance found so far */
+    DistanceType worst_distance_;
+
+    /** The best candidates so far */
+    std::set<DistIndex> dist_indices_;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Class that holds the k NN neighbors
+ * Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays
+ */
+template<typename DistanceType>
+class KNNUniqueResultSet : public UniqueResultSet<DistanceType>
+{
+public:
+    /** Constructor
+     * @param capacity the number of neighbors to store at max
+     */
+    KNNUniqueResultSet(unsigned int capacity) : capacity_(capacity)
+    {
+        this->is_full_ = false;
+        this->clear();
+    }
+
+    /** Add a possible candidate to the best neighbors
+     * @param dist distance for that neighbor
+     * @param index index of that neighbor
+     */
+    inline void addPoint(DistanceType dist, int index)
+    {
+        // Don't do anything if we are worse than the worst
+        if (dist >= worst_distance_) return;
+        dist_indices_.insert(DistIndex(dist, index));
+
+        if (is_full_) {
+            if (dist_indices_.size() > capacity_) {
+                dist_indices_.erase(*dist_indices_.rbegin());
+                worst_distance_ = dist_indices_.rbegin()->dist_;
+            }
+        }
+        else if (dist_indices_.size() == capacity_) {
+            is_full_ = true;
+            worst_distance_ = dist_indices_.rbegin()->dist_;
+        }
+    }
+
+    /** Remove all elements in the set
+     */
+    void clear()
+    {
+        dist_indices_.clear();
+        worst_distance_ = std::numeric_limits<DistanceType>::max();
+        is_full_ = false;
+    }
+
+protected:
+    typedef typename UniqueResultSet<DistanceType>::DistIndex DistIndex;
+    using UniqueResultSet<DistanceType>::is_full_;
+    using UniqueResultSet<DistanceType>::worst_distance_;
+    using UniqueResultSet<DistanceType>::dist_indices_;
+
+    /** The number of neighbors to keep */
+    unsigned int capacity_;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Class that holds the radius nearest neighbors
+ * It is more accurate than RadiusResult as it is not limited in the number of neighbors
+ */
+template<typename DistanceType>
+class RadiusUniqueResultSet : public UniqueResultSet<DistanceType>
+{
+public:
+    /** Constructor
+     * @param radius the maximum distance of a neighbor
+     */
+    RadiusUniqueResultSet(DistanceType radius) :
+        radius_(radius)
+    {
+        is_full_ = true;
+    }
+
+    /** Add a possible candidate to the best neighbors
+     * @param dist distance for that neighbor
+     * @param index index of that neighbor
+     */
+    void addPoint(DistanceType dist, int index)
+    {
+        if (dist <= radius_) dist_indices_.insert(DistIndex(dist, index));
+    }
+
+    /** Remove all elements in the set
+     */
+    inline void clear()
+    {
+        dist_indices_.clear();
+    }
+
+
+    /** Check the status of the set
+     * @return alwys false
+     */
+    inline bool full() const
+    {
+        return true;
+    }
+
+    /** The distance of the furthest neighbor
+     * If we don't have enough neighbors, it returns the max possible value
+     * @return
+     */
+    inline DistanceType worstDist() const
+    {
+        return radius_;
+    }
+private:
+    typedef typename UniqueResultSet<DistanceType>::DistIndex DistIndex;
+    using UniqueResultSet<DistanceType>::dist_indices_;
+    using UniqueResultSet<DistanceType>::is_full_;
+
+    /** The furthest distance a neighbor can be */
+    DistanceType radius_;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Class that holds the k NN neighbors within a radius distance
+ */
+template<typename DistanceType>
+class KNNRadiusUniqueResultSet : public KNNUniqueResultSet<DistanceType>
+{
+public:
+    /** Constructor
+     * @param capacity the number of neighbors to store at max
+     * @param radius the maximum distance of a neighbor
+     */
+    KNNRadiusUniqueResultSet(unsigned int capacity, DistanceType radius)
+    {
+        this->capacity_ = capacity;
+        this->radius_ = radius;
+        this->dist_indices_.reserve(capacity_);
+        this->clear();
+    }
+
+    /** Remove all elements in the set
+     */
+    void clear()
+    {
+        dist_indices_.clear();
+        worst_distance_ = radius_;
+        is_full_ = false;
+    }
+private:
+    using KNNUniqueResultSet<DistanceType>::dist_indices_;
+    using KNNUniqueResultSet<DistanceType>::is_full_;
+    using KNNUniqueResultSet<DistanceType>::worst_distance_;
+
+    /** The maximum number of neighbors to consider */
+    unsigned int capacity_;
+
+    /** The maximum distance of a neighbor */
+    DistanceType radius_;
+};
+}
+
+#endif //OPENCV_FLANN_RESULTSET_H
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h
new file mode 100644
index 0000000..396f177
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h
@@ -0,0 +1,81 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_SAMPLING_H_
+#define OPENCV_FLANN_SAMPLING_H_
+
+#include "matrix.h"
+#include "random.h"
+
+namespace cvflann
+{
+
+template<typename T>
+Matrix<T> random_sample(Matrix<T>& srcMatrix, long size, bool remove = false)
+{
+    Matrix<T> newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols);
+
+    T* src,* dest;
+    for (long i=0; i<size; ++i) {
+        long r = rand_int((int)(srcMatrix.rows-i));
+        dest = newSet[i];
+        src = srcMatrix[r];
+        std::copy(src, src+srcMatrix.cols, dest);
+        if (remove) {
+            src = srcMatrix[srcMatrix.rows-i-1];
+            dest = srcMatrix[r];
+            std::copy(src, src+srcMatrix.cols, dest);
+        }
+    }
+    if (remove) {
+        srcMatrix.rows -= size;
+    }
+    return newSet;
+}
+
+template<typename T>
+Matrix<T> random_sample(const Matrix<T>& srcMatrix, size_t size)
+{
+    UniqueRandom rand((int)srcMatrix.rows);
+    Matrix<T> newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols);
+
+    T* src,* dest;
+    for (size_t i=0; i<size; ++i) {
+        long r = rand.next();
+        dest = newSet[i];
+        src = srcMatrix[r];
+        std::copy(src, src+srcMatrix.cols, dest);
+    }
+    return newSet;
+}
+
+} // namespace
+
+
+#endif /* OPENCV_FLANN_SAMPLING_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/saving.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/saving.h
new file mode 100644
index 0000000..7e3bea5
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/saving.h
@@ -0,0 +1,187 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE NNIndexGOODS 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_SAVING_H_
+#define OPENCV_FLANN_SAVING_H_
+
+#include <cstring>
+#include <vector>
+
+#include "general.h"
+#include "nn_index.h"
+
+#ifdef FLANN_SIGNATURE_
+#undef FLANN_SIGNATURE_
+#endif
+#define FLANN_SIGNATURE_ "FLANN_INDEX"
+
+namespace cvflann
+{
+
+template <typename T>
+struct Datatype {};
+template<>
+struct Datatype<char> { static flann_datatype_t type() { return FLANN_INT8; } };
+template<>
+struct Datatype<short> { static flann_datatype_t type() { return FLANN_INT16; } };
+template<>
+struct Datatype<int> { static flann_datatype_t type() { return FLANN_INT32; } };
+template<>
+struct Datatype<unsigned char> { static flann_datatype_t type() { return FLANN_UINT8; } };
+template<>
+struct Datatype<unsigned short> { static flann_datatype_t type() { return FLANN_UINT16; } };
+template<>
+struct Datatype<unsigned int> { static flann_datatype_t type() { return FLANN_UINT32; } };
+template<>
+struct Datatype<float> { static flann_datatype_t type() { return FLANN_FLOAT32; } };
+template<>
+struct Datatype<double> { static flann_datatype_t type() { return FLANN_FLOAT64; } };
+
+
+/**
+ * Structure representing the index header.
+ */
+struct IndexHeader
+{
+    char signature[16];
+    char version[16];
+    flann_datatype_t data_type;
+    flann_algorithm_t index_type;
+    size_t rows;
+    size_t cols;
+};
+
+/**
+ * Saves index header to stream
+ *
+ * @param stream - Stream to save to
+ * @param index - The index to save
+ */
+template<typename Distance>
+void save_header(FILE* stream, const NNIndex<Distance>& index)
+{
+    IndexHeader header;
+    memset(header.signature, 0, sizeof(header.signature));
+    strcpy(header.signature, FLANN_SIGNATURE_);
+    memset(header.version, 0, sizeof(header.version));
+    strcpy(header.version, FLANN_VERSION_);
+    header.data_type = Datatype<typename Distance::ElementType>::type();
+    header.index_type = index.getType();
+    header.rows = index.size();
+    header.cols = index.veclen();
+
+    std::fwrite(&header, sizeof(header),1,stream);
+}
+
+
+/**
+ *
+ * @param stream - Stream to load from
+ * @return Index header
+ */
+inline IndexHeader load_header(FILE* stream)
+{
+    IndexHeader header;
+    size_t read_size = fread(&header,sizeof(header),1,stream);
+
+    if (read_size!=(size_t)1) {
+        throw FLANNException("Invalid index file, cannot read");
+    }
+
+    if (strcmp(header.signature,FLANN_SIGNATURE_)!=0) {
+        throw FLANNException("Invalid index file, wrong signature");
+    }
+
+    return header;
+
+}
+
+
+template<typename T>
+void save_value(FILE* stream, const T& value, size_t count = 1)
+{
+    fwrite(&value, sizeof(value),count, stream);
+}
+
+template<typename T>
+void save_value(FILE* stream, const cvflann::Matrix<T>& value)
+{
+    fwrite(&value, sizeof(value),1, stream);
+    fwrite(value.data, sizeof(T),value.rows*value.cols, stream);
+}
+
+template<typename T>
+void save_value(FILE* stream, const std::vector<T>& value)
+{
+    size_t size = value.size();
+    fwrite(&size, sizeof(size_t), 1, stream);
+    fwrite(&value[0], sizeof(T), size, stream);
+}
+
+template<typename T>
+void load_value(FILE* stream, T& value, size_t count = 1)
+{
+    size_t read_cnt = fread(&value, sizeof(value), count, stream);
+    if (read_cnt != count) {
+        throw FLANNException("Cannot read from file");
+    }
+}
+
+template<typename T>
+void load_value(FILE* stream, cvflann::Matrix<T>& value)
+{
+    size_t read_cnt = fread(&value, sizeof(value), 1, stream);
+    if (read_cnt != 1) {
+        throw FLANNException("Cannot read from file");
+    }
+    value.data = new T[value.rows*value.cols];
+    read_cnt = fread(value.data, sizeof(T), value.rows*value.cols, stream);
+    if (read_cnt != (size_t)(value.rows*value.cols)) {
+        throw FLANNException("Cannot read from file");
+    }
+}
+
+
+template<typename T>
+void load_value(FILE* stream, std::vector<T>& value)
+{
+    size_t size;
+    size_t read_cnt = fread(&size, sizeof(size_t), 1, stream);
+    if (read_cnt!=1) {
+        throw FLANNException("Cannot read from file");
+    }
+    value.resize(size);
+    read_cnt = fread(&value[0], sizeof(T), size, stream);
+    if (read_cnt != size) {
+        throw FLANNException("Cannot read from file");
+    }
+}
+
+}
+
+#endif /* OPENCV_FLANN_SAVING_H_ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h
new file mode 100644
index 0000000..145901a
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h
@@ -0,0 +1,186 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_SIMPLEX_DOWNHILL_H_
+#define OPENCV_FLANN_SIMPLEX_DOWNHILL_H_
+
+namespace cvflann
+{
+
+/**
+    Adds val to array vals (and point to array points) and keeping the arrays sorted by vals.
+ */
+template <typename T>
+void addValue(int pos, float val, float* vals, T* point, T* points, int n)
+{
+    vals[pos] = val;
+    for (int i=0; i<n; ++i) {
+        points[pos*n+i] = point[i];
+    }
+
+    // bubble down
+    int j=pos;
+    while (j>0 && vals[j]<vals[j-1]) {
+        swap(vals[j],vals[j-1]);
+        for (int i=0; i<n; ++i) {
+            swap(points[j*n+i],points[(j-1)*n+i]);
+        }
+        --j;
+    }
+}
+
+
+/**
+    Simplex downhill optimization function.
+    Preconditions: points is a 2D mattrix of size (n+1) x n
+                    func is the cost function taking n an array of n params and returning float
+                    vals is the cost function in the n+1 simplex points, if NULL it will be computed
+
+    Postcondition: returns optimum value and points[0..n] are the optimum parameters
+ */
+template <typename T, typename F>
+float optimizeSimplexDownhill(T* points, int n, F func, float* vals = NULL )
+{
+    const int MAX_ITERATIONS = 10;
+
+    assert(n>0);
+
+    T* p_o = new T[n];
+    T* p_r = new T[n];
+    T* p_e = new T[n];
+
+    int alpha = 1;
+
+    int iterations = 0;
+
+    bool ownVals = false;
+    if (vals == NULL) {
+        ownVals = true;
+        vals = new float[n+1];
+        for (int i=0; i<n+1; ++i) {
+            float val = func(points+i*n);
+            addValue(i, val, vals, points+i*n, points, n);
+        }
+    }
+    int nn = n*n;
+
+    while (true) {
+
+        if (iterations++ > MAX_ITERATIONS) break;
+
+        // compute average of simplex points (except the highest point)
+        for (int j=0; j<n; ++j) {
+            p_o[j] = 0;
+            for (int i=0; i<n; ++i) {
+                p_o[i] += points[j*n+i];
+            }
+        }
+        for (int i=0; i<n; ++i) {
+            p_o[i] /= n;
+        }
+
+        bool converged = true;
+        for (int i=0; i<n; ++i) {
+            if (p_o[i] != points[nn+i]) {
+                converged = false;
+            }
+        }
+        if (converged) break;
+
+        // trying a reflection
+        for (int i=0; i<n; ++i) {
+            p_r[i] = p_o[i] + alpha*(p_o[i]-points[nn+i]);
+        }
+        float val_r = func(p_r);
+
+        if ((val_r>=vals[0])&&(val_r<vals[n])) {
+            // reflection between second highest and lowest
+            // add it to the simplex
+            Logger::info("Choosing reflection\n");
+            addValue(n, val_r,vals, p_r, points, n);
+            continue;
+        }
+
+        if (val_r<vals[0]) {
+            // value is smaller than smalest in simplex
+
+            // expand some more to see if it drops further
+            for (int i=0; i<n; ++i) {
+                p_e[i] = 2*p_r[i]-p_o[i];
+            }
+            float val_e = func(p_e);
+
+            if (val_e<val_r) {
+                Logger::info("Choosing reflection and expansion\n");
+                addValue(n, val_e,vals,p_e,points,n);
+            }
+            else {
+                Logger::info("Choosing reflection\n");
+                addValue(n, val_r,vals,p_r,points,n);
+            }
+            continue;
+        }
+        if (val_r>=vals[n]) {
+            for (int i=0; i<n; ++i) {
+                p_e[i] = (p_o[i]+points[nn+i])/2;
+            }
+            float val_e = func(p_e);
+
+            if (val_e<vals[n]) {
+                Logger::info("Choosing contraction\n");
+                addValue(n,val_e,vals,p_e,points,n);
+                continue;
+            }
+        }
+        {
+            Logger::info("Full contraction\n");
+            for (int j=1; j<=n; ++j) {
+                for (int i=0; i<n; ++i) {
+                    points[j*n+i] = (points[j*n+i]+points[i])/2;
+                }
+                float val = func(points+j*n);
+                addValue(j,val,vals,points+j*n,points,n);
+            }
+        }
+    }
+
+    float bestVal = vals[0];
+
+    delete[] p_r;
+    delete[] p_o;
+    delete[] p_e;
+    if (ownVals) delete[] vals;
+
+    return bestVal;
+}
+
+}
+
+#endif //OPENCV_FLANN_SIMPLEX_DOWNHILL_H_
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/timer.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/timer.h
new file mode 100644
index 0000000..f771a34
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/flann/timer.h
@@ -0,0 +1,94 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_TIMER_H
+#define OPENCV_FLANN_TIMER_H
+
+#include <time.h>
+#include "opencv2/core.hpp"
+#include "opencv2/core/utility.hpp"
+
+namespace cvflann
+{
+
+/**
+ * A start-stop timer class.
+ *
+ * Can be used to time portions of code.
+ */
+class StartStopTimer
+{
+    int64 startTime;
+
+public:
+    /**
+     * Value of the timer.
+     */
+    double value;
+
+
+    /**
+     * Constructor.
+     */
+    StartStopTimer()
+    {
+        reset();
+    }
+
+    /**
+     * Starts the timer.
+     */
+    void start()
+    {
+        startTime = cv::getTickCount();
+    }
+
+    /**
+     * Stops the timer and updates timer value.
+     */
+    void stop()
+    {
+        int64 stopTime = cv::getTickCount();
+        value += ( (double)stopTime - startTime) / cv::getTickFrequency();
+    }
+
+    /**
+     * Resets the timer value to 0.
+     */
+    void reset()
+    {
+        value = 0;
+    }
+
+};
+
+}
+
+#endif // FLANN_TIMER_H
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui.hpp
new file mode 100644
index 0000000..41bd8af
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui.hpp
@@ -0,0 +1,754 @@
+/*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*/
+
+#ifndef __OPENCV_HIGHGUI_HPP__
+#define __OPENCV_HIGHGUI_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/imgcodecs.hpp"
+#include "opencv2/videoio.hpp"
+
+/**
+@defgroup highgui High-level GUI
+
+While OpenCV was designed for use in full-scale applications and can be used within functionally
+rich UI frameworks (such as Qt\*, WinForms\*, or Cocoa\*) or without any UI at all, sometimes there
+it is required to try functionality quickly and visualize the results. This is what the HighGUI
+module has been designed for.
+
+It provides easy interface to:
+
+-   Create and manipulate windows that can display images and "remember" their content (no need to
+    handle repaint events from OS).
+-   Add trackbars to the windows, handle simple mouse events as well as keyboard commands.
+
+@{
+    @defgroup highgui_opengl OpenGL support
+    @defgroup highgui_qt Qt New Functions
+
+    ![image](pics/qtgui.png)
+
+    This figure explains new functionality implemented with Qt\* GUI. The new GUI provides a statusbar,
+    a toolbar, and a control panel. The control panel can have trackbars and buttonbars attached to it.
+    If you cannot see the control panel, press Ctrl+P or right-click any Qt window and select **Display
+    properties window**.
+
+    -   To attach a trackbar, the window name parameter must be NULL.
+
+    -   To attach a buttonbar, a button must be created. If the last bar attached to the control panel
+        is a buttonbar, the new button is added to the right of the last button. If the last bar
+        attached to the control panel is a trackbar, or the control panel is empty, a new buttonbar is
+        created. Then, a new button is attached to it.
+
+    See below the example used to generate the figure:
+    @code
+        int main(int argc, char *argv[])
+        {
+
+            int value = 50;
+            int value2 = 0;
+
+
+            namedWindow("main1",WINDOW_NORMAL);
+            namedWindow("main2",WINDOW_AUTOSIZE | CV_GUI_NORMAL);
+            createTrackbar( "track1", "main1", &value, 255,  NULL);
+
+            String nameb1 = "button1";
+            String nameb2 = "button2";
+
+            createButton(nameb1,callbackButton,&nameb1,QT_CHECKBOX,1);
+            createButton(nameb2,callbackButton,NULL,QT_CHECKBOX,0);
+            createTrackbar( "track2", NULL, &value2, 255, NULL);
+            createButton("button5",callbackButton1,NULL,QT_RADIOBOX,0);
+            createButton("button6",callbackButton2,NULL,QT_RADIOBOX,1);
+
+            setMouseCallback( "main2",on_mouse,NULL );
+
+            Mat img1 = imread("files/flower.jpg");
+            VideoCapture video;
+            video.open("files/hockey.avi");
+
+            Mat img2,img3;
+
+            while( waitKey(33) != 27 )
+            {
+                img1.convertTo(img2,-1,1,value);
+                video >> img3;
+
+                imshow("main1",img2);
+                imshow("main2",img3);
+            }
+
+            destroyAllWindows();
+
+            return 0;
+        }
+    @endcode
+
+
+    @defgroup highgui_winrt WinRT support
+
+    This figure explains new functionality implemented with WinRT GUI. The new GUI provides an Image control,
+    and a slider panel. Slider panel holds trackbars attached to it.
+
+    Sliders are attached below the image control. Every new slider is added below the previous one.
+
+    See below the example used to generate the figure:
+    @code
+        void sample_app::MainPage::ShowWindow()
+        {
+            static cv::String windowName("sample");
+            cv::winrt_initContainer(this->cvContainer);
+            cv::namedWindow(windowName); // not required
+
+            cv::Mat image = cv::imread("Assets/sample.jpg");
+            cv::Mat converted = cv::Mat(image.rows, image.cols, CV_8UC4);
+            cv::cvtColor(image, converted, COLOR_BGR2BGRA);
+            cv::imshow(windowName, converted); // this will create window if it hasn't been created before
+
+            int state = 42;
+            cv::TrackbarCallback callback = [](int pos, void* userdata)
+            {
+                if (pos == 0) {
+                    cv::destroyWindow(windowName);
+                }
+            };
+            cv::TrackbarCallback callbackTwin = [](int pos, void* userdata)
+            {
+                if (pos >= 70) {
+                    cv::destroyAllWindows();
+                }
+            };
+            cv::createTrackbar("Sample trackbar", windowName, &state, 100, callback);
+            cv::createTrackbar("Twin brother", windowName, &state, 100, callbackTwin);
+        }
+    @endcode
+
+    @defgroup highgui_c C API
+@}
+*/
+
+///////////////////////// graphical user interface //////////////////////////
+namespace cv
+{
+
+//! @addtogroup highgui
+//! @{
+
+//! Flags for cv::namedWindow
+enum WindowFlags {
+       WINDOW_NORMAL     = 0x00000000, //!< the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size.
+       WINDOW_AUTOSIZE   = 0x00000001, //!< the user cannot resize the window, the size is constrainted by the image displayed.
+       WINDOW_OPENGL     = 0x00001000, //!< window with opengl support.
+
+       WINDOW_FULLSCREEN = 1,          //!< change the window to fullscreen.
+       WINDOW_FREERATIO  = 0x00000100, //!< the image expends as much as it can (no ratio constraint).
+       WINDOW_KEEPRATIO  = 0x00000000  //!< the ratio of the image is respected.
+     };
+
+//! Flags for cv::setWindowProperty / cv::getWindowProperty
+enum WindowPropertyFlags {
+       WND_PROP_FULLSCREEN   = 0, //!< fullscreen property    (can be WINDOW_NORMAL or WINDOW_FULLSCREEN).
+       WND_PROP_AUTOSIZE     = 1, //!< autosize property      (can be WINDOW_NORMAL or WINDOW_AUTOSIZE).
+       WND_PROP_ASPECT_RATIO = 2, //!< window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO).
+       WND_PROP_OPENGL       = 3  //!< opengl support.
+     };
+
+//! Mouse Events see cv::MouseCallback
+enum MouseEventTypes {
+       EVENT_MOUSEMOVE      = 0, //!< indicates that the mouse pointer has moved over the window.
+       EVENT_LBUTTONDOWN    = 1, //!< indicates that the left mouse button is pressed.
+       EVENT_RBUTTONDOWN    = 2, //!< indicates that the right mouse button is pressed.
+       EVENT_MBUTTONDOWN    = 3, //!< indicates that the middle mouse button is pressed.
+       EVENT_LBUTTONUP      = 4, //!< indicates that left mouse button is released.
+       EVENT_RBUTTONUP      = 5, //!< indicates that right mouse button is released.
+       EVENT_MBUTTONUP      = 6, //!< indicates that middle mouse button is released.
+       EVENT_LBUTTONDBLCLK  = 7, //!< indicates that left mouse button is double clicked.
+       EVENT_RBUTTONDBLCLK  = 8, //!< indicates that right mouse button is double clicked.
+       EVENT_MBUTTONDBLCLK  = 9, //!< indicates that middle mouse button is double clicked.
+       EVENT_MOUSEWHEEL     = 10,//!< positive and negative values mean forward and backward scrolling, respectively.
+       EVENT_MOUSEHWHEEL    = 11 //!< positive and negative values mean right and left scrolling, respectively.
+     };
+
+//! Mouse Event Flags see cv::MouseCallback
+enum MouseEventFlags {
+       EVENT_FLAG_LBUTTON   = 1, //!< indicates that the left mouse button is down.
+       EVENT_FLAG_RBUTTON   = 2, //!< indicates that the right mouse button is down.
+       EVENT_FLAG_MBUTTON   = 4, //!< indicates that the middle mouse button is down.
+       EVENT_FLAG_CTRLKEY   = 8, //!< indicates that CTRL Key is pressed.
+       EVENT_FLAG_SHIFTKEY  = 16,//!< indicates that SHIFT Key is pressed.
+       EVENT_FLAG_ALTKEY    = 32 //!< indicates that ALT Key is pressed.
+     };
+
+//! Qt font weight
+enum QtFontWeights {
+        QT_FONT_LIGHT           = 25, //!< Weight of 25
+        QT_FONT_NORMAL          = 50, //!< Weight of 50
+        QT_FONT_DEMIBOLD        = 63, //!< Weight of 63
+        QT_FONT_BOLD            = 75, //!< Weight of 75
+        QT_FONT_BLACK           = 87  //!< Weight of 87
+     };
+
+//! Qt font style
+enum QtFontStyles {
+        QT_STYLE_NORMAL         = 0, //!< Normal font.
+        QT_STYLE_ITALIC         = 1, //!< Italic font.
+        QT_STYLE_OBLIQUE        = 2  //!< Oblique font.
+     };
+
+//! Qt "button" type
+enum QtButtonTypes {
+       QT_PUSH_BUTTON = 0, //!< Push button.
+       QT_CHECKBOX    = 1, //!< Checkbox button.
+       QT_RADIOBOX    = 2  //!< Radiobox button.
+     };
+
+/** @brief Callback function for mouse events. see cv::setMouseCallback
+@param event one of the cv::MouseEventTypes constants.
+@param x The x-coordinate of the mouse event.
+@param y The y-coordinate of the mouse event.
+@param flags one of the cv::MouseEventFlags constants.
+@param userdata The optional parameter.
+ */
+typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata);
+
+/** @brief Callback function for Trackbar see cv::createTrackbar
+@param pos current position of the specified trackbar.
+@param userdata The optional parameter.
+ */
+typedef void (*TrackbarCallback)(int pos, void* userdata);
+
+/** @brief Callback function defined to be called every frame. See cv::setOpenGlDrawCallback
+@param userdata The optional parameter.
+ */
+typedef void (*OpenGlDrawCallback)(void* userdata);
+
+/** @brief Callback function for a button created by cv::createButton
+@param state current state of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button.
+@param userdata The optional parameter.
+ */
+typedef void (*ButtonCallback)(int state, void* userdata);
+
+/** @brief Creates a window.
+
+The function namedWindow creates a window that can be used as a placeholder for images and
+trackbars. Created windows are referred to by their names.
+
+If a window with the same name already exists, the function does nothing.
+
+You can call cv::destroyWindow or cv::destroyAllWindows to close the window and de-allocate any associated
+memory usage. For a simple program, you do not really have to call these functions because all the
+resources and windows of the application are closed automatically by the operating system upon exit.
+
+@note
+
+Qt backend supports additional flags:
+ -   **WINDOW_NORMAL or WINDOW_AUTOSIZE:** WINDOW_NORMAL enables you to resize the
+     window, whereas WINDOW_AUTOSIZE adjusts automatically the window size to fit the
+     displayed image (see imshow ), and you cannot change the window size manually.
+ -   **WINDOW_FREERATIO or WINDOW_KEEPRATIO:** WINDOW_FREERATIO adjusts the image
+     with no respect to its ratio, whereas WINDOW_KEEPRATIO keeps the image ratio.
+ -   **CV_GUI_NORMAL or CV_GUI_EXPANDED:** CV_GUI_NORMAL is the old way to draw the window
+     without statusbar and toolbar, whereas CV_GUI_EXPANDED is a new enhanced GUI.
+By default, flags == WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | CV_GUI_EXPANDED
+
+@param winname Name of the window in the window caption that may be used as a window identifier.
+@param flags Flags of the window. The supported flags are: (cv::WindowFlags)
+ */
+CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
+
+/** @brief Destroys the specified window.
+
+The function destroyWindow destroys the window with the given name.
+
+@param winname Name of the window to be destroyed.
+ */
+CV_EXPORTS_W void destroyWindow(const String& winname);
+
+/** @brief Destroys all of the HighGUI windows.
+
+The function destroyAllWindows destroys all of the opened HighGUI windows.
+ */
+CV_EXPORTS_W void destroyAllWindows();
+
+CV_EXPORTS_W int startWindowThread();
+
+/** @brief Waits for a pressed key.
+
+The function waitKey waits for a key event infinitely (when \f$\texttt{delay}\leq 0\f$ ) or for delay
+milliseconds, when it is positive. Since the OS has a minimum time between switching threads, the
+function will not wait exactly delay ms, it will wait at least delay ms, depending on what else is
+running on your computer at that time. It returns the code of the pressed key or -1 if no key was
+pressed before the specified time had elapsed.
+
+@note
+
+This function is the only method in HighGUI that can fetch and handle events, so it needs to be
+called periodically for normal event processing unless HighGUI is used within an environment that
+takes care of event processing.
+
+@note
+
+The function only works if there is at least one HighGUI window created and the window is active.
+If there are several HighGUI windows, any of them can be active.
+
+@param delay Delay in milliseconds. 0 is the special value that means "forever".
+ */
+CV_EXPORTS_W int waitKey(int delay = 0);
+
+/** @brief Displays an image in the specified window.
+
+The function imshow displays an image in the specified window. If the window was created with the
+cv::WINDOW_AUTOSIZE flag, the image is shown with its original size, however it is still limited by the screen resolution.
+Otherwise, the image is scaled to fit the window. The function may scale the image, depending on its depth:
+
+-   If the image is 8-bit unsigned, it is displayed as is.
+-   If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the
+    value range [0,255\*256] is mapped to [0,255].
+-   If the image is 32-bit floating-point, the pixel values are multiplied by 255. That is, the
+    value range [0,1] is mapped to [0,255].
+
+If window was created with OpenGL support, cv::imshow also support ogl::Buffer , ogl::Texture2D and
+cuda::GpuMat as input.
+
+If the window was not created before this function, it is assumed creating a window with cv::WINDOW_AUTOSIZE.
+
+If you need to show an image that is bigger than the screen resolution, you will need to call namedWindow("", WINDOW_NORMAL) before the imshow.
+
+@note This function should be followed by cv::waitKey function which displays the image for specified
+milliseconds. Otherwise, it won't display the image. For example, **waitKey(0)** will display the window
+infinitely until any keypress (it is suitable for image display). **waitKey(25)** will display a frame
+for 25 ms, after which display will be automatically closed. (If you put it in a loop to read
+videos, it will display the video frame-by-frame)
+
+@note
+
+[__Windows Backend Only__] Pressing Ctrl+C will copy the image to the clipboard.
+
+[__Windows Backend Only__] Pressing Ctrl+S will show a dialog to save the image.
+
+@param winname Name of the window.
+@param mat Image to be shown.
+ */
+CV_EXPORTS_W void imshow(const String& winname, InputArray mat);
+
+/** @brief Resizes window to the specified size
+
+@note
+
+-   The specified window size is for the image area. Toolbars are not counted.
+-   Only windows created without cv::WINDOW_AUTOSIZE flag can be resized.
+
+@param winname Window name.
+@param width The new window width.
+@param height The new window height.
+ */
+CV_EXPORTS_W void resizeWindow(const String& winname, int width, int height);
+
+/** @brief Moves window to the specified position
+
+@param winname Name of the window.
+@param x The new x-coordinate of the window.
+@param y The new y-coordinate of the window.
+ */
+CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
+
+/** @brief Changes parameters of a window dynamically.
+
+The function setWindowProperty enables changing properties of a window.
+
+@param winname Name of the window.
+@param prop_id Window property to edit. The supported operation flags are: (cv::WindowPropertyFlags)
+@param prop_value New value of the window property. The supported flags are: (cv::WindowFlags)
+ */
+CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);
+
+/** @brief Updates window title
+@param winname Name of the window.
+@param title New title.
+*/
+CV_EXPORTS_W void setWindowTitle(const String& winname, const String& title);
+
+/** @brief Provides parameters of a window.
+
+The function getWindowProperty returns properties of a window.
+
+@param winname Name of the window.
+@param prop_id Window property to retrieve. The following operation flags are available: (cv::WindowPropertyFlags)
+
+@sa setWindowProperty
+ */
+CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);
+
+/** @brief Sets mouse handler for the specified window
+
+@param winname Name of the window.
+@param onMouse Mouse callback. See OpenCV samples, such as
+<https://github.com/Itseez/opencv/tree/master/samples/cpp/ffilldemo.cpp>, on how to specify and
+use the callback.
+@param userdata The optional parameter passed to the callback.
+ */
+CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0);
+
+/** @brief Gets the mouse-wheel motion delta, when handling mouse-wheel events cv::EVENT_MOUSEWHEEL and
+cv::EVENT_MOUSEHWHEEL.
+
+For regular mice with a scroll-wheel, delta will be a multiple of 120. The value 120 corresponds to
+a one notch rotation of the wheel or the threshold for action to be taken and one such action should
+occur for each delta. Some high-precision mice with higher-resolution freely-rotating wheels may
+generate smaller values.
+
+For cv::EVENT_MOUSEWHEEL positive and negative values mean forward and backward scrolling,
+respectively. For cv::EVENT_MOUSEHWHEEL, where available, positive and negative values mean right and
+left scrolling, respectively.
+
+With the C API, the macro CV_GET_WHEEL_DELTA(flags) can be used alternatively.
+
+@note
+
+Mouse-wheel events are currently supported only on Windows.
+
+@param flags The mouse callback flags parameter.
+ */
+CV_EXPORTS int getMouseWheelDelta(int flags);
+
+/** @brief Creates a trackbar and attaches it to the specified window.
+
+The function createTrackbar creates a trackbar (a slider or range control) with the specified name
+and range, assigns a variable value to be a position synchronized with the trackbar and specifies
+the callback function onChange to be called on the trackbar position change. The created trackbar is
+displayed in the specified window winname.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar should be attached to the
+control panel.
+
+Clicking the label of each trackbar enables editing the trackbar values manually.
+
+@param trackbarname Name of the created trackbar.
+@param winname Name of the window that will be used as a parent of the created trackbar.
+@param value Optional pointer to an integer variable whose value reflects the position of the
+slider. Upon creation, the slider position is defined by this variable.
+@param count Maximal position of the slider. The minimal position is always 0.
+@param onChange Pointer to the function to be called every time the slider changes position. This
+function should be prototyped as void Foo(int,void\*); , where the first parameter is the trackbar
+position and the second parameter is the user data (see the next parameter). If the callback is
+the NULL pointer, no callbacks are called, but only value is updated.
+@param userdata User data that is passed as is to the callback. It can be used to handle trackbar
+events without using global variables.
+ */
+CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname,
+                              int* value, int count,
+                              TrackbarCallback onChange = 0,
+                              void* userdata = 0);
+
+/** @brief Returns the trackbar position.
+
+The function returns the current position of the specified trackbar.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control
+panel.
+
+@param trackbarname Name of the trackbar.
+@param winname Name of the window that is the parent of the trackbar.
+ */
+CV_EXPORTS_W int getTrackbarPos(const String& trackbarname, const String& winname);
+
+/** @brief Sets the trackbar position.
+
+The function sets the position of the specified trackbar in the specified window.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control
+panel.
+
+@param trackbarname Name of the trackbar.
+@param winname Name of the window that is the parent of trackbar.
+@param pos New position.
+ */
+CV_EXPORTS_W void setTrackbarPos(const String& trackbarname, const String& winname, int pos);
+
+/** @brief Sets the trackbar maximum position.
+
+The function sets the maximum position of the specified trackbar in the specified window.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control
+panel.
+
+@param trackbarname Name of the trackbar.
+@param winname Name of the window that is the parent of trackbar.
+@param maxval New maximum position.
+ */
+CV_EXPORTS_W void setTrackbarMax(const String& trackbarname, const String& winname, int maxval);
+
+/** @brief Sets the trackbar minimum position.
+
+The function sets the minimum position of the specified trackbar in the specified window.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control
+panel.
+
+@param trackbarname Name of the trackbar.
+@param winname Name of the window that is the parent of trackbar.
+@param minval New maximum position.
+ */
+CV_EXPORTS_W void setTrackbarMin(const String& trackbarname, const String& winname, int minval);
+
+//! @addtogroup highgui_opengl OpenGL support
+//! @{
+
+/** @brief Displays OpenGL 2D texture in the specified window.
+
+@param winname Name of the window.
+@param tex OpenGL 2D texture data.
+ */
+CV_EXPORTS void imshow(const String& winname, const ogl::Texture2D& tex);
+
+/** @brief Sets a callback function to be called to draw on top of displayed image.
+
+The function setOpenGlDrawCallback can be used to draw 3D data on the window. See the example of
+callback function below:
+@code
+    void on_opengl(void* param)
+    {
+        glLoadIdentity();
+
+        glTranslated(0.0, 0.0, -1.0);
+
+        glRotatef( 55, 1, 0, 0 );
+        glRotatef( 45, 0, 1, 0 );
+        glRotatef( 0, 0, 0, 1 );
+
+        static const int coords[6][4][3] = {
+            { { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } },
+            { { +1, +1, -1 }, { -1, +1, -1 }, { -1, +1, +1 }, { +1, +1, +1 } },
+            { { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } },
+            { { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } },
+            { { +1, -1, +1 }, { -1, -1, +1 }, { -1, -1, -1 }, { +1, -1, -1 } },
+            { { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } }
+        };
+
+        for (int i = 0; i < 6; ++i) {
+                    glColor3ub( i*20, 100+i*10, i*42 );
+                    glBegin(GL_QUADS);
+                    for (int j = 0; j < 4; ++j) {
+                            glVertex3d(0.2 * coords[i][j][0], 0.2 * coords[i][j][1], 0.2 * coords[i][j][2]);
+                    }
+                    glEnd();
+        }
+    }
+@endcode
+
+@param winname Name of the window.
+@param onOpenGlDraw Pointer to the function to be called every frame. This function should be
+prototyped as void Foo(void\*) .
+@param userdata Pointer passed to the callback function.(__Optional__)
+ */
+CV_EXPORTS void setOpenGlDrawCallback(const String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0);
+
+/** @brief Sets the specified window as current OpenGL context.
+
+@param winname Name of the window.
+ */
+CV_EXPORTS void setOpenGlContext(const String& winname);
+
+/** @brief Force window to redraw its context and call draw callback ( See cv::setOpenGlDrawCallback ).
+
+@param winname Name of the window.
+ */
+CV_EXPORTS void updateWindow(const String& winname);
+
+//! @} highgui_opengl
+
+//! @addtogroup highgui_qt
+//! @{
+
+/** @brief QtFont available only for Qt. See cv::fontQt
+ */
+struct QtFont
+{
+    const char* nameFont;  //!< Name of the font
+    Scalar      color;     //!< Color of the font. Scalar(blue_component, green_component, red_component[, alpha_component])
+    int         font_face; //!< See cv::QtFontStyles
+    const int*  ascii;     //!< font data and metrics
+    const int*  greek;
+    const int*  cyrillic;
+    float       hscale, vscale;
+    float       shear;     //!< slope coefficient: 0 - normal, >0 - italic
+    int         thickness; //!< See cv::QtFontWeights
+    float       dx;        //!< horizontal interval between letters
+    int         line_type; //!< PointSize
+};
+
+/** @brief Creates the font to draw a text on an image.
+
+The function fontQt creates a cv::QtFont object. This cv::QtFont is not compatible with putText .
+
+A basic usage of this function is the following: :
+@code
+    QtFont font = fontQt("Times");
+    addText( img1, "Hello World !", Point(50,50), font);
+@endcode
+
+@param nameFont Name of the font. The name should match the name of a system font (such as
+*Times*). If the font is not found, a default one is used.
+@param pointSize Size of the font. If not specified, equal zero or negative, the point size of the
+font is set to a system-dependent default value. Generally, this is 12 points.
+@param color Color of the font in BGRA where A = 255 is fully transparent. Use the macro CV_RGB
+for simplicity.
+@param weight Font weight. Available operation flags are : cv::QtFontWeights You can also specify a positive integer for better control.
+@param style Font style. Available operation flags are : cv::QtFontStyles
+@param spacing Spacing between characters. It can be negative or positive.
+ */
+CV_EXPORTS QtFont fontQt(const String& nameFont, int pointSize = -1,
+                         Scalar color = Scalar::all(0), int weight = QT_FONT_NORMAL,
+                         int style = QT_STYLE_NORMAL, int spacing = 0);
+
+/** @brief Draws a text on the image.
+
+The function addText draws *text* on the image *img* using a specific font *font* (see example cv::fontQt
+)
+
+@param img 8-bit 3-channel image where the text should be drawn.
+@param text Text to write on an image.
+@param org Point(x,y) where the text should start on an image.
+@param font Font to use to draw a text.
+ */
+CV_EXPORTS void addText( const Mat& img, const String& text, Point org, const QtFont& font);
+
+/** @brief Displays a text on a window image as an overlay for a specified duration.
+
+The function displayOverlay displays useful information/tips on top of the window for a certain
+amount of time *delayms*. The function does not modify the image, displayed in the window, that is,
+after the specified delay the original content of the window is restored.
+
+@param winname Name of the window.
+@param text Overlay text to write on a window image.
+@param delayms The period (in milliseconds), during which the overlay text is displayed. If this
+function is called before the previous overlay text timed out, the timer is restarted and the text
+is updated. If this value is zero, the text never disappears.
+ */
+CV_EXPORTS void displayOverlay(const String& winname, const String& text, int delayms = 0);
+
+/** @brief Displays a text on the window statusbar during the specified period of time.
+
+The function displayStatusBar displays useful information/tips on top of the window for a certain
+amount of time *delayms* . This information is displayed on the window statusbar (the window must be
+created with the CV_GUI_EXPANDED flags).
+
+@param winname Name of the window.
+@param text Text to write on the window statusbar.
+@param delayms Duration (in milliseconds) to display the text. If this function is called before
+the previous text timed out, the timer is restarted and the text is updated. If this value is
+zero, the text never disappears.
+ */
+CV_EXPORTS void displayStatusBar(const String& winname, const String& text, int delayms = 0);
+
+/** @brief Saves parameters of the specified window.
+
+The function saveWindowParameters saves size, location, flags, trackbars value, zoom and panning
+location of the window windowName.
+
+@param windowName Name of the window.
+ */
+CV_EXPORTS void saveWindowParameters(const String& windowName);
+
+/** @brief Loads parameters of the specified window.
+
+The function loadWindowParameters loads size, location, flags, trackbars value, zoom and panning
+location of the window windowName.
+
+@param windowName Name of the window.
+ */
+CV_EXPORTS void loadWindowParameters(const String& windowName);
+
+CV_EXPORTS  int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
+
+CV_EXPORTS  void stopLoop();
+
+/** @brief Attaches a button to the control panel.
+
+The function createButton attaches a button to the control panel. Each button is added to a
+buttonbar to the right of the last button. A new buttonbar is created if nothing was attached to the
+control panel before, or if the last element attached to the control panel was a trackbar.
+
+See below various examples of the cv::createButton function call: :
+@code
+    createButton(NULL,callbackButton);//create a push button "button 0", that will call callbackButton.
+    createButton("button2",callbackButton,NULL,QT_CHECKBOX,0);
+    createButton("button3",callbackButton,&value);
+    createButton("button5",callbackButton1,NULL,QT_RADIOBOX);
+    createButton("button6",callbackButton2,NULL,QT_PUSH_BUTTON,1);
+@endcode
+
+@param  bar_name Name of the button.
+@param on_change Pointer to the function to be called every time the button changes its state.
+This function should be prototyped as void Foo(int state,\*void); . *state* is the current state
+of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button.
+@param userdata Pointer passed to the callback function.
+@param type Optional type of the button. Available types are: (cv::QtButtonTypes)
+@param initial_button_state Default state of the button. Use for checkbox and radiobox. Its
+value could be 0 or 1. (__Optional__)
+*/
+CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change,
+                             void* userdata = 0, int type = QT_PUSH_BUTTON,
+                             bool initial_button_state = false);
+
+//! @} highgui_qt
+
+//! @} highgui
+
+} // cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/highgui/highgui_c.h"
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp
new file mode 100644
index 0000000..160c9cf
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/highgui.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h
new file mode 100644
index 0000000..47fdb84
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h
@@ -0,0 +1,252 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_HIGHGUI_H__
+#define __OPENCV_HIGHGUI_H__
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/imgproc/imgproc_c.h"
+#include "opencv2/imgcodecs/imgcodecs_c.h"
+#include "opencv2/videoio/videoio_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** @addtogroup highgui_c
+  @{
+  */
+
+/****************************************************************************************\
+*                                  Basic GUI functions                                   *
+\****************************************************************************************/
+//YV
+//-----------New for Qt
+/* For font */
+enum {  CV_FONT_LIGHT           = 25,//QFont::Light,
+        CV_FONT_NORMAL          = 50,//QFont::Normal,
+        CV_FONT_DEMIBOLD        = 63,//QFont::DemiBold,
+        CV_FONT_BOLD            = 75,//QFont::Bold,
+        CV_FONT_BLACK           = 87 //QFont::Black
+};
+
+enum {  CV_STYLE_NORMAL         = 0,//QFont::StyleNormal,
+        CV_STYLE_ITALIC         = 1,//QFont::StyleItalic,
+        CV_STYLE_OBLIQUE        = 2 //QFont::StyleOblique
+};
+/* ---------*/
+
+//for color cvScalar(blue_component, green_component, red_component[, alpha_component])
+//and alpha= 0 <-> 0xFF (not transparent <-> transparent)
+CVAPI(CvFont) cvFontQt(const char* nameFont, int pointSize CV_DEFAULT(-1), CvScalar color CV_DEFAULT(cvScalarAll(0)), int weight CV_DEFAULT(CV_FONT_NORMAL),  int style CV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0));
+
+CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2);
+
+CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0));
+CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0));
+
+CVAPI(void) cvSaveWindowParameters(const char* name);
+CVAPI(void) cvLoadWindowParameters(const char* name);
+CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
+CVAPI(void) cvStopLoop( void );
+
+typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
+enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2};
+CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0));
+//----------------------
+
+
+/* this function is used to set some external parameters in case of X Window */
+CVAPI(int) cvInitSystem( int argc, char** argv );
+
+CVAPI(int) cvStartWindowThread( void );
+
+// ---------  YV ---------
+enum
+{
+    //These 3 flags are used by cvSet/GetWindowProperty
+    CV_WND_PROP_FULLSCREEN = 0, //to change/get window's fullscreen property
+    CV_WND_PROP_AUTOSIZE   = 1, //to change/get window's autosize property
+    CV_WND_PROP_ASPECTRATIO= 2, //to change/get window's aspectratio property
+    CV_WND_PROP_OPENGL     = 3, //to change/get window's opengl support
+
+    //These 2 flags are used by cvNamedWindow and cvSet/GetWindowProperty
+    CV_WINDOW_NORMAL       = 0x00000000, //the user can resize the window (no constraint)  / also use to switch a fullscreen window to a normal size
+    CV_WINDOW_AUTOSIZE     = 0x00000001, //the user cannot resize the window, the size is constrainted by the image displayed
+    CV_WINDOW_OPENGL       = 0x00001000, //window with opengl support
+
+    //Those flags are only for Qt
+    CV_GUI_EXPANDED         = 0x00000000, //status bar and tool bar
+    CV_GUI_NORMAL           = 0x00000010, //old fashious way
+
+    //These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty
+    CV_WINDOW_FULLSCREEN   = 1,//change the window to fullscreen
+    CV_WINDOW_FREERATIO    = 0x00000100,//the image expends as much as it can (no ratio constraint)
+    CV_WINDOW_KEEPRATIO    = 0x00000000//the ration image is respected.
+};
+
+/* create window */
+CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) );
+
+/* Set and Get Property of the window */
+CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
+CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
+
+/* display image within window (highgui windows remember their content) */
+CVAPI(void) cvShowImage( const char* name, const CvArr* image );
+
+/* resize/move window */
+CVAPI(void) cvResizeWindow( const char* name, int width, int height );
+CVAPI(void) cvMoveWindow( const char* name, int x, int y );
+
+
+/* destroy window and all the trackers associated with it */
+CVAPI(void) cvDestroyWindow( const char* name );
+
+CVAPI(void) cvDestroyAllWindows(void);
+
+/* get native window handle (HWND in case of Win32 and Widget in case of X Window) */
+CVAPI(void*) cvGetWindowHandle( const char* name );
+
+/* get name of highgui window given its native handle */
+CVAPI(const char*) cvGetWindowName( void* window_handle );
+
+
+typedef void (CV_CDECL *CvTrackbarCallback)(int pos);
+
+/* create trackbar and display it on top of given window, set callback */
+CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
+                             int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
+
+typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata);
+
+CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name,
+                              int* value, int count, CvTrackbarCallback2 on_change,
+                              void* userdata CV_DEFAULT(0));
+
+/* retrieve or set trackbar position */
+CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name );
+CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos );
+CVAPI(void) cvSetTrackbarMax(const char* trackbar_name, const char* window_name, int maxval);
+CVAPI(void) cvSetTrackbarMin(const char* trackbar_name, const char* window_name, int minval);
+
+enum
+{
+    CV_EVENT_MOUSEMOVE      =0,
+    CV_EVENT_LBUTTONDOWN    =1,
+    CV_EVENT_RBUTTONDOWN    =2,
+    CV_EVENT_MBUTTONDOWN    =3,
+    CV_EVENT_LBUTTONUP      =4,
+    CV_EVENT_RBUTTONUP      =5,
+    CV_EVENT_MBUTTONUP      =6,
+    CV_EVENT_LBUTTONDBLCLK  =7,
+    CV_EVENT_RBUTTONDBLCLK  =8,
+    CV_EVENT_MBUTTONDBLCLK  =9,
+    CV_EVENT_MOUSEWHEEL     =10,
+    CV_EVENT_MOUSEHWHEEL    =11
+};
+
+enum
+{
+    CV_EVENT_FLAG_LBUTTON   =1,
+    CV_EVENT_FLAG_RBUTTON   =2,
+    CV_EVENT_FLAG_MBUTTON   =4,
+    CV_EVENT_FLAG_CTRLKEY   =8,
+    CV_EVENT_FLAG_SHIFTKEY  =16,
+    CV_EVENT_FLAG_ALTKEY    =32
+};
+
+
+#define CV_GET_WHEEL_DELTA(flags) ((short)((flags >> 16) & 0xffff)) // upper 16 bits
+
+typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param);
+
+/* assign callback for mouse events */
+CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse,
+                                void* param CV_DEFAULT(NULL));
+
+/* wait for key event infinitely (delay<=0) or for "delay" milliseconds */
+CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
+
+// OpenGL support
+
+typedef void (CV_CDECL *CvOpenGlDrawCallback)(void* userdata);
+CVAPI(void) cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata CV_DEFAULT(NULL));
+
+CVAPI(void) cvSetOpenGlContext(const char* window_name);
+CVAPI(void) cvUpdateWindow(const char* window_name);
+
+
+/****************************************************************************************\
+
+*                              Obsolete functions/synonyms                               *
+\****************************************************************************************/
+
+#define cvAddSearchPath(path)
+#define cvvInitSystem cvInitSystem
+#define cvvNamedWindow cvNamedWindow
+#define cvvShowImage cvShowImage
+#define cvvResizeWindow cvResizeWindow
+#define cvvDestroyWindow cvDestroyWindow
+#define cvvCreateTrackbar cvCreateTrackbar
+#define cvvAddSearchPath cvAddSearchPath
+#define cvvWaitKey(name) cvWaitKey(0)
+#define cvvWaitKeyEx(name,delay) cvWaitKey(delay)
+#define HG_AUTOSIZE CV_WINDOW_AUTOSIZE
+#define set_preprocess_func cvSetPreprocessFuncWin32
+#define set_postprocess_func cvSetPostprocessFuncWin32
+
+#if defined WIN32 || defined _WIN32
+
+CVAPI(void) cvSetPreprocessFuncWin32_(const void* callback);
+CVAPI(void) cvSetPostprocessFuncWin32_(const void* callback);
+#define cvSetPreprocessFuncWin32(callback) cvSetPreprocessFuncWin32_((const void*)(callback))
+#define cvSetPostprocessFuncWin32(callback) cvSetPostprocessFuncWin32_((const void*)(callback))
+
+#endif
+
+/** @} highgui_c */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp
new file mode 100644
index 0000000..ac0fd24
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp
@@ -0,0 +1,267 @@
+/*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*/
+
+#ifndef __OPENCV_IMGCODECS_HPP__
+#define __OPENCV_IMGCODECS_HPP__
+
+#include "opencv2/core.hpp"
+
+/**
+  @defgroup imgcodecs Image file reading and writing
+  @{
+    @defgroup imgcodecs_c C API
+    @defgroup imgcodecs_ios iOS glue
+  @}
+*/
+
+//////////////////////////////// image codec ////////////////////////////////
+namespace cv
+{
+
+//! @addtogroup imgcodecs
+//! @{
+
+//! Imread flags
+enum ImreadModes {
+       IMREAD_UNCHANGED            = -1, //!< If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).
+       IMREAD_GRAYSCALE            = 0,  //!< If set, always convert image to the single channel grayscale image.
+       IMREAD_COLOR                = 1,  //!< If set, always convert image to the 3 channel BGR color image.
+       IMREAD_ANYDEPTH             = 2,  //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.
+       IMREAD_ANYCOLOR             = 4,  //!< If set, the image is read in any possible color format.
+       IMREAD_LOAD_GDAL            = 8,  //!< If set, use the gdal driver for loading the image.
+       IMREAD_REDUCED_GRAYSCALE_2  = 16, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/2.
+       IMREAD_REDUCED_COLOR_2      = 17, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2.
+       IMREAD_REDUCED_GRAYSCALE_4  = 32, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/4.
+       IMREAD_REDUCED_COLOR_4      = 33, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4.
+       IMREAD_REDUCED_GRAYSCALE_8  = 64, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/8.
+       IMREAD_REDUCED_COLOR_8      = 65  //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8.
+     };
+
+//! Imwrite flags
+enum ImwriteFlags {
+       IMWRITE_JPEG_QUALITY        = 1,  //!< For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95.
+       IMWRITE_JPEG_PROGRESSIVE    = 2,  //!< Enable JPEG features, 0 or 1, default is False.
+       IMWRITE_JPEG_OPTIMIZE       = 3,  //!< Enable JPEG features, 0 or 1, default is False.
+       IMWRITE_JPEG_RST_INTERVAL   = 4,  //!< JPEG restart interval, 0 - 65535, default is 0 - no restart.
+       IMWRITE_JPEG_LUMA_QUALITY   = 5,  //!< Separate luma quality level, 0 - 100, default is 0 - don't use.
+       IMWRITE_JPEG_CHROMA_QUALITY = 6,  //!< Separate chroma quality level, 0 - 100, default is 0 - don't use.
+       IMWRITE_PNG_COMPRESSION     = 16, //!< For PNG, it can be the compression level from 0 to 9. A higher value means a smaller size and longer compression time. Default value is 3.
+       IMWRITE_PNG_STRATEGY        = 17, //!< One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_DEFAULT.
+       IMWRITE_PNG_BILEVEL         = 18, //!< Binary level PNG, 0 or 1, default is 0.
+       IMWRITE_PXM_BINARY          = 32, //!< For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1.
+       IMWRITE_WEBP_QUALITY        = 64  //!< For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used.
+     };
+
+//! Imwrite PNG specific flags used to tune the compression algorithm.
+/** These flags will be modify the way of PNG image compression and will be passed to the underlying zlib processing stage.
+
+-   The effect of IMWRITE_PNG_STRATEGY_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between IMWRITE_PNG_STRATEGY_DEFAULT and IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY.
+-   IMWRITE_PNG_STRATEGY_RLE is designed to be almost as fast as IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY, but give better compression for PNG image data.
+-   The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately.
+-   IMWRITE_PNG_STRATEGY_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
+*/
+enum ImwritePNGFlags {
+       IMWRITE_PNG_STRATEGY_DEFAULT      = 0, //!< Use this value for normal data.
+       IMWRITE_PNG_STRATEGY_FILTERED     = 1, //!< Use this value for data produced by a filter (or predictor).Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better.
+       IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2, //!< Use this value to force Huffman encoding only (no string match).
+       IMWRITE_PNG_STRATEGY_RLE          = 3, //!< Use this value to limit match distances to one (run-length encoding).
+       IMWRITE_PNG_STRATEGY_FIXED        = 4  //!< Using this value prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
+     };
+
+/** @brief Loads an image from a file.
+
+@anchor imread
+
+The function imread loads an image from the specified file and returns it. If the image cannot be
+read (because of missing file, improper permissions, unsupported or invalid format), the function
+returns an empty matrix ( Mat::data==NULL ).
+
+Currently, the following file formats are supported:
+
+-   Windows bitmaps - \*.bmp, \*.dib (always supported)
+-   JPEG files - \*.jpeg, \*.jpg, \*.jpe (see the *Notes* section)
+-   JPEG 2000 files - \*.jp2 (see the *Notes* section)
+-   Portable Network Graphics - \*.png (see the *Notes* section)
+-   WebP - \*.webp (see the *Notes* section)
+-   Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported)
+-   Sun rasters - \*.sr, \*.ras (always supported)
+-   TIFF files - \*.tiff, \*.tif (see the *Notes* section)
+-   OpenEXR Image files - \*.exr (see the *Notes* section)
+-   Radiance HDR - \*.hdr, \*.pic (always supported)
+-   Raster and Vector geospatial data supported by Gdal (see the *Notes* section)
+
+@note
+
+-   The function determines the type of an image by the content, not by the file extension.
+-   In the case of color images, the decoded images will have the channels stored in **B G R** order.
+-   On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg,
+    libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs,
+    and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware
+    that currently these native image loaders give images with different pixel values because of
+    the color management embedded into MacOSX.
+-   On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for
+    codecs supplied with an OS image. Install the relevant packages (do not forget the development
+    files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn
+    on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
+-   In the case you set *WITH_GDAL* flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image,
+    then [GDAL](http://www.gdal.org) driver will be used in order to decode the image by supporting
+    the following formats: [Raster](http://www.gdal.org/formats_list.html),
+    [Vector](http://www.gdal.org/ogr_formats.html).
+@param filename Name of file to be loaded.
+@param flags Flag that can take values of cv::ImreadModes
+*/
+CV_EXPORTS_W Mat imread( const String& filename, int flags = IMREAD_COLOR );
+
+/** @brief Loads a multi-page image from a file.
+
+The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects.
+@param filename Name of file to be loaded.
+@param flags Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR.
+@param mats A vector of Mat objects holding each page, if more than one.
+@sa cv::imread
+*/
+CV_EXPORTS_W bool imreadmulti(const String& filename, std::vector<Mat>& mats, int flags = IMREAD_ANYCOLOR);
+
+/** @brief Saves an image to a specified file.
+
+The function imwrite saves the image to the specified file. The image format is chosen based on the
+filename extension (see cv::imread for the list of extensions). Only 8-bit (or 16-bit unsigned (CV_16U)
+in case of PNG, JPEG 2000, and TIFF) single-channel or 3-channel (with 'BGR' channel order) images
+can be saved using this function. If the format, depth or channel order is different, use
+Mat::convertTo , and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O
+functions to save the image to XML or YAML format.
+
+It is possible to store PNG images with an alpha channel using this function. To do this, create
+8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels
+should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535.
+
+The sample below shows how to create such a BGRA image and store to PNG file. It also demonstrates how to set custom
+compression parameters :
+@code
+    #include <opencv2/opencv.hpp>
+
+    using namespace cv;
+    using namespace std;
+
+    void createAlphaMat(Mat &mat)
+    {
+        CV_Assert(mat.channels() == 4);
+        for (int i = 0; i < mat.rows; ++i) {
+            for (int j = 0; j < mat.cols; ++j) {
+                Vec4b& bgra = mat.at<Vec4b>(i, j);
+                bgra[0] = UCHAR_MAX; // Blue
+                bgra[1] = saturate_cast<uchar>((float (mat.cols - j)) / ((float)mat.cols) * UCHAR_MAX); // Green
+                bgra[2] = saturate_cast<uchar>((float (mat.rows - i)) / ((float)mat.rows) * UCHAR_MAX); // Red
+                bgra[3] = saturate_cast<uchar>(0.5 * (bgra[1] + bgra[2])); // Alpha
+            }
+        }
+    }
+
+    int main(int argv, char **argc)
+    {
+        // Create mat with alpha channel
+        Mat mat(480, 640, CV_8UC4);
+        createAlphaMat(mat);
+
+        vector<int> compression_params;
+        compression_params.push_back(IMWRITE_PNG_COMPRESSION);
+        compression_params.push_back(9);
+
+        try {
+            imwrite("alpha.png", mat, compression_params);
+        }
+        catch (cv::Exception& ex) {
+            fprintf(stderr, "Exception converting image to PNG format: %s\n", ex.what());
+            return 1;
+        }
+
+        fprintf(stdout, "Saved PNG file with alpha data.\n");
+        return 0;
+    }
+@endcode
+@param filename Name of the file.
+@param img Image to be saved.
+@param params Format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::ImwriteFlags
+*/
+CV_EXPORTS_W bool imwrite( const String& filename, InputArray img,
+              const std::vector<int>& params = std::vector<int>());
+
+/** @brief Reads an image from a buffer in memory.
+
+The function imdecode reads an image from the specified buffer in the memory. If the buffer is too short or
+contains invalid data, the function returns an empty matrix ( Mat::data==NULL ).
+
+See cv::imread for the list of supported formats and flags description.
+
+@note In the case of color images, the decoded images will have the channels stored in **B G R** order.
+@param buf Input array or vector of bytes.
+@param flags The same flags as in cv::imread, see cv::ImreadModes.
+*/
+CV_EXPORTS_W Mat imdecode( InputArray buf, int flags );
+
+/** @overload
+@param buf
+@param flags
+@param dst The optional output placeholder for the decoded matrix. It can save the image
+reallocations when the function is called repeatedly for images of the same size.
+*/
+CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst);
+
+/** @brief Encodes an image into a memory buffer.
+
+The function imencode compresses the image and stores it in the memory buffer that is resized to fit the
+result. See cv::imwrite for the list of supported formats and flags description.
+
+@param ext File extension that defines the output format.
+@param img Image to be written.
+@param buf Output buffer resized to fit the compressed image.
+@param params Format-specific parameters. See cv::imwrite and cv::ImwriteFlags.
+*/
+CV_EXPORTS_W bool imencode( const String& ext, InputArray img,
+                            CV_OUT std::vector<uchar>& buf,
+                            const std::vector<int>& params = std::vector<int>());
+
+//! @} imgcodecs
+
+} // cv
+
+#endif //__OPENCV_IMGCODECS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp
new file mode 100644
index 0000000..a3cd232
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/imgcodecs.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h
new file mode 100644
index 0000000..ad793cc
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h
@@ -0,0 +1,137 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_IMGCODECS_H__
+#define __OPENCV_IMGCODECS_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** @addtogroup imgcodecs_c
+  @{
+  */
+
+enum
+{
+/* 8bit, color or not */
+    CV_LOAD_IMAGE_UNCHANGED  =-1,
+/* 8bit, gray */
+    CV_LOAD_IMAGE_GRAYSCALE  =0,
+/* ?, color */
+    CV_LOAD_IMAGE_COLOR      =1,
+/* any depth, ? */
+    CV_LOAD_IMAGE_ANYDEPTH   =2,
+/* ?, any color */
+    CV_LOAD_IMAGE_ANYCOLOR   =4
+};
+
+/* load image from file
+  iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED
+  overrides the other flags
+  using CV_LOAD_IMAGE_ANYCOLOR alone is equivalent to CV_LOAD_IMAGE_UNCHANGED
+  unless CV_LOAD_IMAGE_ANYDEPTH is specified images are converted to 8bit
+*/
+CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
+CVAPI(CvMat*) cvLoadImageM( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
+
+enum
+{
+    CV_IMWRITE_JPEG_QUALITY =1,
+    CV_IMWRITE_JPEG_PROGRESSIVE =2,
+    CV_IMWRITE_JPEG_OPTIMIZE =3,
+    CV_IMWRITE_JPEG_RST_INTERVAL =4,
+    CV_IMWRITE_JPEG_LUMA_QUALITY =5,
+    CV_IMWRITE_JPEG_CHROMA_QUALITY =6,
+    CV_IMWRITE_PNG_COMPRESSION =16,
+    CV_IMWRITE_PNG_STRATEGY =17,
+    CV_IMWRITE_PNG_BILEVEL =18,
+    CV_IMWRITE_PNG_STRATEGY_DEFAULT =0,
+    CV_IMWRITE_PNG_STRATEGY_FILTERED =1,
+    CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2,
+    CV_IMWRITE_PNG_STRATEGY_RLE =3,
+    CV_IMWRITE_PNG_STRATEGY_FIXED =4,
+    CV_IMWRITE_PXM_BINARY =32,
+    CV_IMWRITE_WEBP_QUALITY =64
+};
+
+/* save image to file */
+CVAPI(int) cvSaveImage( const char* filename, const CvArr* image,
+                        const int* params CV_DEFAULT(0) );
+
+/* decode image stored in the buffer */
+CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
+CVAPI(CvMat*) cvDecodeImageM( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
+
+/* encode image and store the result as a byte vector (single-row 8uC1 matrix) */
+CVAPI(CvMat*) cvEncodeImage( const char* ext, const CvArr* image,
+                             const int* params CV_DEFAULT(0) );
+
+enum
+{
+    CV_CVTIMG_FLIP      =1,
+    CV_CVTIMG_SWAP_RB   =2
+};
+
+/* utility function: convert one image to another with optional vertical flip */
+CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0));
+
+CVAPI(int) cvHaveImageReader(const char* filename);
+CVAPI(int) cvHaveImageWriter(const char* filename);
+
+
+/****************************************************************************************\
+*                              Obsolete functions/synonyms                               *
+\****************************************************************************************/
+
+#define cvvLoadImage(name) cvLoadImage((name),1)
+#define cvvSaveImage cvSaveImage
+#define cvvConvertImage cvConvertImage
+
+/** @} imgcodecs_c */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __OPENCV_IMGCODECS_H__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h
new file mode 100644
index 0000000..fbd6371
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h
@@ -0,0 +1,57 @@
+
+/*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*/
+
+#import <UIKit/UIKit.h>
+#import <Accelerate/Accelerate.h>
+#import <AVFoundation/AVFoundation.h>
+#import <ImageIO/ImageIO.h>
+#include "opencv2/core/core.hpp"
+
+//! @addtogroup imgcodecs_ios
+//! @{
+
+UIImage* MatToUIImage(const cv::Mat& image);
+void UIImageToMat(const UIImage* image,
+                         cv::Mat& m, bool alphaExist = false);
+
+//! @}
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp
new file mode 100644
index 0000000..717dcf5
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp
@@ -0,0 +1,4330 @@
+/*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*/
+
+#ifndef __OPENCV_IMGPROC_HPP__
+#define __OPENCV_IMGPROC_HPP__
+
+#include "opencv2/core.hpp"
+
+/**
+  @defgroup imgproc Image processing
+  @{
+    @defgroup imgproc_filter Image Filtering
+
+Functions and classes described in this section are used to perform various linear or non-linear
+filtering operations on 2D images (represented as Mat's). It means that for each pixel location
+\f$(x,y)\f$ in the source image (normally, rectangular), its neighborhood is considered and used to
+compute the response. In case of a linear filter, it is a weighted sum of pixel values. In case of
+morphological operations, it is the minimum or maximum values, and so on. The computed response is
+stored in the destination image at the same location \f$(x,y)\f$. It means that the output image
+will be of the same size as the input image. Normally, the functions support multi-channel arrays,
+in which case every channel is processed independently. Therefore, the output image will also have
+the same number of channels as the input one.
+
+Another common feature of the functions and classes described in this section is that, unlike
+simple arithmetic functions, they need to extrapolate values of some non-existing pixels. For
+example, if you want to smooth an image using a Gaussian \f$3 \times 3\f$ filter, then, when
+processing the left-most pixels in each row, you need pixels to the left of them, that is, outside
+of the image. You can let these pixels be the same as the left-most image pixels ("replicated
+border" extrapolation method), or assume that all the non-existing pixels are zeros ("constant
+border" extrapolation method), and so on. OpenCV enables you to specify the extrapolation method.
+For details, see cv::BorderTypes
+
+@anchor filter_depths
+### Depth combinations
+Input depth (src.depth()) | Output depth (ddepth)
+--------------------------|----------------------
+CV_8U                     | -1/CV_16S/CV_32F/CV_64F
+CV_16U/CV_16S             | -1/CV_32F/CV_64F
+CV_32F                    | -1/CV_32F/CV_64F
+CV_64F                    | -1/CV_64F
+
+@note when ddepth=-1, the output image will have the same depth as the source.
+
+    @defgroup imgproc_transform Geometric Image Transformations
+
+The functions in this section perform various geometrical transformations of 2D images. They do not
+change the image content but deform the pixel grid and map this deformed grid to the destination
+image. In fact, to avoid sampling artifacts, the mapping is done in the reverse order, from
+destination to the source. That is, for each pixel \f$(x, y)\f$ of the destination image, the
+functions compute coordinates of the corresponding "donor" pixel in the source image and copy the
+pixel value:
+
+\f[\texttt{dst} (x,y)= \texttt{src} (f_x(x,y), f_y(x,y))\f]
+
+In case when you specify the forward mapping \f$\left<g_x, g_y\right>: \texttt{src} \rightarrow
+\texttt{dst}\f$, the OpenCV functions first compute the corresponding inverse mapping
+\f$\left<f_x, f_y\right>: \texttt{dst} \rightarrow \texttt{src}\f$ and then use the above formula.
+
+The actual implementations of the geometrical transformations, from the most generic remap and to
+the simplest and the fastest resize, need to solve two main problems with the above formula:
+
+- Extrapolation of non-existing pixels. Similarly to the filtering functions described in the
+previous section, for some \f$(x,y)\f$, either one of \f$f_x(x,y)\f$, or \f$f_y(x,y)\f$, or both
+of them may fall outside of the image. In this case, an extrapolation method needs to be used.
+OpenCV provides the same selection of extrapolation methods as in the filtering functions. In
+addition, it provides the method BORDER_TRANSPARENT. This means that the corresponding pixels in
+the destination image will not be modified at all.
+
+- Interpolation of pixel values. Usually \f$f_x(x,y)\f$ and \f$f_y(x,y)\f$ are floating-point
+numbers. This means that \f$\left<f_x, f_y\right>\f$ can be either an affine or perspective
+transformation, or radial lens distortion correction, and so on. So, a pixel value at fractional
+coordinates needs to be retrieved. In the simplest case, the coordinates can be just rounded to the
+nearest integer coordinates and the corresponding pixel can be used. This is called a
+nearest-neighbor interpolation. However, a better result can be achieved by using more
+sophisticated [interpolation methods](http://en.wikipedia.org/wiki/Multivariate_interpolation) ,
+where a polynomial function is fit into some neighborhood of the computed pixel \f$(f_x(x,y),
+f_y(x,y))\f$, and then the value of the polynomial at \f$(f_x(x,y), f_y(x,y))\f$ is taken as the
+interpolated pixel value. In OpenCV, you can choose between several interpolation methods. See
+resize for details.
+
+    @defgroup imgproc_misc Miscellaneous Image Transformations
+    @defgroup imgproc_draw Drawing Functions
+
+Drawing functions work with matrices/images of arbitrary depth. The boundaries of the shapes can be
+rendered with antialiasing (implemented only for 8-bit images for now). All the functions include
+the parameter color that uses an RGB value (that may be constructed with the Scalar constructor )
+for color images and brightness for grayscale images. For color images, the channel ordering is
+normally *Blue, Green, Red*. This is what imshow, imread, and imwrite expect. So, if you form a
+color using the Scalar constructor, it should look like:
+
+\f[\texttt{Scalar} (blue \_ component, green \_ component, red \_ component[, alpha \_ component])\f]
+
+If you are using your own image rendering and I/O functions, you can use any channel ordering. The
+drawing functions process each channel independently and do not depend on the channel order or even
+on the used color space. The whole image can be converted from BGR to RGB or to a different color
+space using cvtColor .
+
+If a drawn figure is partially or completely outside the image, the drawing functions clip it. Also,
+many drawing functions can handle pixel coordinates specified with sub-pixel accuracy. This means
+that the coordinates can be passed as fixed-point numbers encoded as integers. The number of
+fractional bits is specified by the shift parameter and the real point coordinates are calculated as
+\f$\texttt{Point}(x,y)\rightarrow\texttt{Point2f}(x*2^{-shift},y*2^{-shift})\f$ . This feature is
+especially effective when rendering antialiased shapes.
+
+@note The functions do not support alpha-transparency when the target image is 4-channel. In this
+case, the color[3] is simply copied to the repainted pixels. Thus, if you want to paint
+semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main
+image.
+
+    @defgroup imgproc_colormap ColorMaps in OpenCV
+
+The human perception isn't built for observing fine changes in grayscale images. Human eyes are more
+sensitive to observing changes between colors, so you often need to recolor your grayscale images to
+get a clue about them. OpenCV now comes with various colormaps to enhance the visualization in your
+computer vision application.
+
+In OpenCV you only need applyColorMap to apply a colormap on a given image. The following sample
+code reads the path to an image from command line, applies a Jet colormap on it and shows the
+result:
+
+@code
+#include <opencv2/core.hpp>
+#include <opencv2/imgproc.hpp>
+#include <opencv2/imgcodecs.hpp>
+#include <opencv2/highgui.hpp>
+using namespace cv;
+
+#include <iostream>
+using namespace std;
+
+int main(int argc, const char *argv[])
+{
+    // We need an input image. (can be grayscale or color)
+    if (argc < 2)
+    {
+        cerr << "We need an image to process here. Please run: colorMap [path_to_image]" << endl;
+        return -1;
+    }
+    Mat img_in = imread(argv[1]);
+    if(img_in.empty())
+    {
+        cerr << "Sample image (" << argv[1] << ") is empty. Please adjust your path, so it points to a valid input image!" << endl;
+        return -1;
+    }
+    // Holds the colormap version of the image:
+    Mat img_color;
+    // Apply the colormap:
+    applyColorMap(img_in, img_color, COLORMAP_JET);
+    // Show the result:
+    imshow("colorMap", img_color);
+    waitKey(0);
+    return 0;
+}
+@endcode
+
+@see cv::ColormapTypes
+
+    @defgroup imgproc_hist Histograms
+    @defgroup imgproc_shape Structural Analysis and Shape Descriptors
+    @defgroup imgproc_motion Motion Analysis and Object Tracking
+    @defgroup imgproc_feature Feature Detection
+    @defgroup imgproc_object Object Detection
+    @defgroup imgproc_c C API
+  @}
+*/
+
+namespace cv
+{
+
+/** @addtogroup imgproc
+@{
+*/
+
+//! @addtogroup imgproc_filter
+//! @{
+
+//! type of morphological operation
+enum MorphTypes{
+    MORPH_ERODE    = 0, //!< see cv::erode
+    MORPH_DILATE   = 1, //!< see cv::dilate
+    MORPH_OPEN     = 2, //!< an opening operation
+                        //!< \f[\texttt{dst} = \mathrm{open} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \mathrm{erode} ( \texttt{src} , \texttt{element} ))\f]
+    MORPH_CLOSE    = 3, //!< a closing operation
+                        //!< \f[\texttt{dst} = \mathrm{close} ( \texttt{src} , \texttt{element} )= \mathrm{erode} ( \mathrm{dilate} ( \texttt{src} , \texttt{element} ))\f]
+    MORPH_GRADIENT = 4, //!< a morphological gradient
+                        //!< \f[\texttt{dst} = \mathrm{morph\_grad} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \texttt{src} , \texttt{element} )- \mathrm{erode} ( \texttt{src} , \texttt{element} )\f]
+    MORPH_TOPHAT   = 5, //!< "top hat"
+                        //!< \f[\texttt{dst} = \mathrm{tophat} ( \texttt{src} , \texttt{element} )= \texttt{src} - \mathrm{open} ( \texttt{src} , \texttt{element} )\f]
+    MORPH_BLACKHAT = 6, //!< "black hat"
+                        //!< \f[\texttt{dst} = \mathrm{blackhat} ( \texttt{src} , \texttt{element} )= \mathrm{close} ( \texttt{src} , \texttt{element} )- \texttt{src}\f]
+    MORPH_HITMISS  = 7  //!< "hit and miss"
+                        //!<   .- Only supported for CV_8UC1 binary images. Tutorial can be found in [this page](http://opencv-code.com/tutorials/hit-or-miss-transform-in-opencv/)
+};
+
+//! shape of the structuring element
+enum MorphShapes {
+    MORPH_RECT    = 0, //!< a rectangular structuring element:  \f[E_{ij}=1\f]
+    MORPH_CROSS   = 1, //!< a cross-shaped structuring element:
+                       //!< \f[E_{ij} =  \fork{1}{if i=\texttt{anchor.y} or j=\texttt{anchor.x}}{0}{otherwise}\f]
+    MORPH_ELLIPSE = 2 //!< an elliptic structuring element, that is, a filled ellipse inscribed
+                      //!< into the rectangle Rect(0, 0, esize.width, 0.esize.height)
+};
+
+//! @} imgproc_filter
+
+//! @addtogroup imgproc_transform
+//! @{
+
+//! interpolation algorithm
+enum InterpolationFlags{
+    /** nearest neighbor interpolation */
+    INTER_NEAREST        = 0,
+    /** bilinear interpolation */
+    INTER_LINEAR         = 1,
+    /** bicubic interpolation */
+    INTER_CUBIC          = 2,
+    /** resampling using pixel area relation. It may be a preferred method for image decimation, as
+    it gives moire'-free results. But when the image is zoomed, it is similar to the INTER_NEAREST
+    method. */
+    INTER_AREA           = 3,
+    /** Lanczos interpolation over 8x8 neighborhood */
+    INTER_LANCZOS4       = 4,
+    /** mask for interpolation codes */
+    INTER_MAX            = 7,
+    /** flag, fills all of the destination image pixels. If some of them correspond to outliers in the
+    source image, they are set to zero */
+    WARP_FILL_OUTLIERS   = 8,
+    /** flag, inverse transformation
+
+    For example, polar transforms:
+    - flag is __not__ set: \f$dst( \phi , \rho ) = src(x,y)\f$
+    - flag is set: \f$dst(x,y) = src( \phi , \rho )\f$
+    */
+    WARP_INVERSE_MAP     = 16
+};
+
+enum InterpolationMasks {
+       INTER_BITS      = 5,
+       INTER_BITS2     = INTER_BITS * 2,
+       INTER_TAB_SIZE  = 1 << INTER_BITS,
+       INTER_TAB_SIZE2 = INTER_TAB_SIZE * INTER_TAB_SIZE
+     };
+
+//! @} imgproc_transform
+
+//! @addtogroup imgproc_misc
+//! @{
+
+//! Distance types for Distance Transform and M-estimators
+//! @see cv::distanceTransform, cv::fitLine
+enum DistanceTypes {
+    DIST_USER    = -1,  //!< User defined distance
+    DIST_L1      = 1,   //!< distance = |x1-x2| + |y1-y2|
+    DIST_L2      = 2,   //!< the simple euclidean distance
+    DIST_C       = 3,   //!< distance = max(|x1-x2|,|y1-y2|)
+    DIST_L12     = 4,   //!< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1))
+    DIST_FAIR    = 5,   //!< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998
+    DIST_WELSCH  = 6,   //!< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846
+    DIST_HUBER   = 7    //!< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345
+};
+
+//! Mask size for distance transform
+enum DistanceTransformMasks {
+    DIST_MASK_3       = 3, //!< mask=3
+    DIST_MASK_5       = 5, //!< mask=5
+    DIST_MASK_PRECISE = 0  //!<
+};
+
+//! type of the threshold operation
+//! ![threshold types](pics/threshold.png)
+enum ThresholdTypes {
+    THRESH_BINARY     = 0, //!< \f[\texttt{dst} (x,y) =  \fork{\texttt{maxval}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f]
+    THRESH_BINARY_INV = 1, //!< \f[\texttt{dst} (x,y) =  \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{maxval}}{otherwise}\f]
+    THRESH_TRUNC      = 2, //!< \f[\texttt{dst} (x,y) =  \fork{\texttt{threshold}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f]
+    THRESH_TOZERO     = 3, //!< \f[\texttt{dst} (x,y) =  \fork{\texttt{src}(x,y)}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f]
+    THRESH_TOZERO_INV = 4, //!< \f[\texttt{dst} (x,y) =  \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f]
+    THRESH_MASK       = 7,
+    THRESH_OTSU       = 8, //!< flag, use Otsu algorithm to choose the optimal threshold value
+    THRESH_TRIANGLE   = 16 //!< flag, use Triangle algorithm to choose the optimal threshold value
+};
+
+//! adaptive threshold algorithm
+//! see cv::adaptiveThreshold
+enum AdaptiveThresholdTypes {
+    /** the threshold value \f$T(x,y)\f$ is a mean of the \f$\texttt{blockSize} \times
+    \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$ minus C */
+    ADAPTIVE_THRESH_MEAN_C     = 0,
+    /** the threshold value \f$T(x, y)\f$ is a weighted sum (cross-correlation with a Gaussian
+    window) of the \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$
+    minus C . The default sigma (standard deviation) is used for the specified blockSize . See
+    cv::getGaussianKernel*/
+    ADAPTIVE_THRESH_GAUSSIAN_C = 1
+};
+
+//! cv::undistort mode
+enum UndistortTypes {
+       PROJ_SPHERICAL_ORTHO  = 0,
+       PROJ_SPHERICAL_EQRECT = 1
+     };
+
+//! class of the pixel in GrabCut algorithm
+enum GrabCutClasses {
+    GC_BGD    = 0,  //!< an obvious background pixels
+    GC_FGD    = 1,  //!< an obvious foreground (object) pixel
+    GC_PR_BGD = 2,  //!< a possible background pixel
+    GC_PR_FGD = 3   //!< a possible foreground pixel
+};
+
+//! GrabCut algorithm flags
+enum GrabCutModes {
+    /** The function initializes the state and the mask using the provided rectangle. After that it
+    runs iterCount iterations of the algorithm. */
+    GC_INIT_WITH_RECT  = 0,
+    /** The function initializes the state using the provided mask. Note that GC_INIT_WITH_RECT
+    and GC_INIT_WITH_MASK can be combined. Then, all the pixels outside of the ROI are
+    automatically initialized with GC_BGD .*/
+    GC_INIT_WITH_MASK  = 1,
+    /** The value means that the algorithm should just resume. */
+    GC_EVAL            = 2
+};
+
+//! distanceTransform algorithm flags
+enum DistanceTransformLabelTypes {
+    /** each connected component of zeros in src (as well as all the non-zero pixels closest to the
+    connected component) will be assigned the same label */
+    DIST_LABEL_CCOMP = 0,
+    /** each zero pixel (and all the non-zero pixels closest to it) gets its own label. */
+    DIST_LABEL_PIXEL = 1
+};
+
+//! floodfill algorithm flags
+enum FloodFillFlags {
+    /** If set, the difference between the current pixel and seed pixel is considered. Otherwise,
+    the difference between neighbor pixels is considered (that is, the range is floating). */
+    FLOODFILL_FIXED_RANGE = 1 << 16,
+    /** If set, the function does not change the image ( newVal is ignored), and only fills the
+    mask with the value specified in bits 8-16 of flags as described above. This option only make
+    sense in function variants that have the mask parameter. */
+    FLOODFILL_MASK_ONLY   = 1 << 17
+};
+
+//! @} imgproc_misc
+
+//! @addtogroup imgproc_shape
+//! @{
+
+//! connected components algorithm output formats
+enum ConnectedComponentsTypes {
+    CC_STAT_LEFT   = 0, //!< The leftmost (x) coordinate which is the inclusive start of the bounding
+                        //!< box in the horizontal direction.
+    CC_STAT_TOP    = 1, //!< The topmost (y) coordinate which is the inclusive start of the bounding
+                        //!< box in the vertical direction.
+    CC_STAT_WIDTH  = 2, //!< The horizontal size of the bounding box
+    CC_STAT_HEIGHT = 3, //!< The vertical size of the bounding box
+    CC_STAT_AREA   = 4, //!< The total area (in pixels) of the connected component
+    CC_STAT_MAX    = 5
+};
+
+//! mode of the contour retrieval algorithm
+enum RetrievalModes {
+    /** retrieves only the extreme outer contours. It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for
+    all the contours. */
+    RETR_EXTERNAL  = 0,
+    /** retrieves all of the contours without establishing any hierarchical relationships. */
+    RETR_LIST      = 1,
+    /** retrieves all of the contours and organizes them into a two-level hierarchy. At the top
+    level, there are external boundaries of the components. At the second level, there are
+    boundaries of the holes. If there is another contour inside a hole of a connected component, it
+    is still put at the top level. */
+    RETR_CCOMP     = 2,
+    /** retrieves all of the contours and reconstructs a full hierarchy of nested contours.*/
+    RETR_TREE      = 3,
+    RETR_FLOODFILL = 4 //!<
+};
+
+//! the contour approximation algorithm
+enum ContourApproximationModes {
+    /** stores absolutely all the contour points. That is, any 2 subsequent points (x1,y1) and
+    (x2,y2) of the contour will be either horizontal, vertical or diagonal neighbors, that is,
+    max(abs(x1-x2),abs(y2-y1))==1. */
+    CHAIN_APPROX_NONE      = 1,
+    /** compresses horizontal, vertical, and diagonal segments and leaves only their end points.
+    For example, an up-right rectangular contour is encoded with 4 points. */
+    CHAIN_APPROX_SIMPLE    = 2,
+    /** applies one of the flavors of the Teh-Chin chain approximation algorithm @cite TehChin89 */
+    CHAIN_APPROX_TC89_L1   = 3,
+    /** applies one of the flavors of the Teh-Chin chain approximation algorithm @cite TehChin89 */
+    CHAIN_APPROX_TC89_KCOS = 4
+};
+
+//! @} imgproc_shape
+
+//! Variants of a Hough transform
+enum HoughModes {
+
+    /** classical or standard Hough transform. Every line is represented by two floating-point
+    numbers \f$(\rho, \theta)\f$ , where \f$\rho\f$ is a distance between (0,0) point and the line,
+    and \f$\theta\f$ is the angle between x-axis and the normal to the line. Thus, the matrix must
+    be (the created sequence will be) of CV_32FC2 type */
+    HOUGH_STANDARD      = 0,
+    /** probabilistic Hough transform (more efficient in case if the picture contains a few long
+    linear segments). It returns line segments rather than the whole line. Each segment is
+    represented by starting and ending points, and the matrix must be (the created sequence will
+    be) of the CV_32SC4 type. */
+    HOUGH_PROBABILISTIC = 1,
+    /** multi-scale variant of the classical Hough transform. The lines are encoded the same way as
+    HOUGH_STANDARD. */
+    HOUGH_MULTI_SCALE   = 2,
+    HOUGH_GRADIENT      = 3 //!< basically *21HT*, described in @cite Yuen90
+};
+
+//! Variants of Line Segment %Detector
+//! @ingroup imgproc_feature
+enum LineSegmentDetectorModes {
+    LSD_REFINE_NONE = 0, //!< No refinement applied
+    LSD_REFINE_STD  = 1, //!< Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations.
+    LSD_REFINE_ADV  = 2  //!< Advanced refinement. Number of false alarms is calculated, lines are
+                         //!< refined through increase of precision, decrement in size, etc.
+};
+
+/** Histogram comparison methods
+  @ingroup imgproc_hist
+*/
+enum HistCompMethods {
+    /** Correlation
+    \f[d(H_1,H_2) =  \frac{\sum_I (H_1(I) - \bar{H_1}) (H_2(I) - \bar{H_2})}{\sqrt{\sum_I(H_1(I) - \bar{H_1})^2 \sum_I(H_2(I) - \bar{H_2})^2}}\f]
+    where
+    \f[\bar{H_k} =  \frac{1}{N} \sum _J H_k(J)\f]
+    and \f$N\f$ is a total number of histogram bins. */
+    HISTCMP_CORREL        = 0,
+    /** Chi-Square
+    \f[d(H_1,H_2) =  \sum _I  \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)}\f] */
+    HISTCMP_CHISQR        = 1,
+    /** Intersection
+    \f[d(H_1,H_2) =  \sum _I  \min (H_1(I), H_2(I))\f] */
+    HISTCMP_INTERSECT     = 2,
+    /** Bhattacharyya distance
+    (In fact, OpenCV computes Hellinger distance, which is related to Bhattacharyya coefficient.)
+    \f[d(H_1,H_2) =  \sqrt{1 - \frac{1}{\sqrt{\bar{H_1} \bar{H_2} N^2}} \sum_I \sqrt{H_1(I) \cdot H_2(I)}}\f] */
+    HISTCMP_BHATTACHARYYA = 3,
+    HISTCMP_HELLINGER     = HISTCMP_BHATTACHARYYA, //!< Synonym for HISTCMP_BHATTACHARYYA
+    /** Alternative Chi-Square
+    \f[d(H_1,H_2) =  2 * \sum _I  \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)+H_2(I)}\f]
+    This alternative formula is regularly used for texture comparison. See e.g. @cite Puzicha1997 */
+    HISTCMP_CHISQR_ALT    = 4,
+    /** Kullback-Leibler divergence
+    \f[d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)\f] */
+    HISTCMP_KL_DIV        = 5
+};
+
+/** the color conversion code
+@see @ref imgproc_color_conversions
+@ingroup imgproc_misc
+ */
+enum ColorConversionCodes {
+    COLOR_BGR2BGRA     = 0, //!< add alpha channel to RGB or BGR image
+    COLOR_RGB2RGBA     = COLOR_BGR2BGRA,
+
+    COLOR_BGRA2BGR     = 1, //!< remove alpha channel from RGB or BGR image
+    COLOR_RGBA2RGB     = COLOR_BGRA2BGR,
+
+    COLOR_BGR2RGBA     = 2, //!< convert between RGB and BGR color spaces (with or without alpha channel)
+    COLOR_RGB2BGRA     = COLOR_BGR2RGBA,
+
+    COLOR_RGBA2BGR     = 3,
+    COLOR_BGRA2RGB     = COLOR_RGBA2BGR,
+
+    COLOR_BGR2RGB      = 4,
+    COLOR_RGB2BGR      = COLOR_BGR2RGB,
+
+    COLOR_BGRA2RGBA    = 5,
+    COLOR_RGBA2BGRA    = COLOR_BGRA2RGBA,
+
+    COLOR_BGR2GRAY     = 6, //!< convert between RGB/BGR and grayscale, @ref color_convert_rgb_gray "color conversions"
+    COLOR_RGB2GRAY     = 7,
+    COLOR_GRAY2BGR     = 8,
+    COLOR_GRAY2RGB     = COLOR_GRAY2BGR,
+    COLOR_GRAY2BGRA    = 9,
+    COLOR_GRAY2RGBA    = COLOR_GRAY2BGRA,
+    COLOR_BGRA2GRAY    = 10,
+    COLOR_RGBA2GRAY    = 11,
+
+    COLOR_BGR2BGR565   = 12, //!< convert between RGB/BGR and BGR565 (16-bit images)
+    COLOR_RGB2BGR565   = 13,
+    COLOR_BGR5652BGR   = 14,
+    COLOR_BGR5652RGB   = 15,
+    COLOR_BGRA2BGR565  = 16,
+    COLOR_RGBA2BGR565  = 17,
+    COLOR_BGR5652BGRA  = 18,
+    COLOR_BGR5652RGBA  = 19,
+
+    COLOR_GRAY2BGR565  = 20, //!< convert between grayscale to BGR565 (16-bit images)
+    COLOR_BGR5652GRAY  = 21,
+
+    COLOR_BGR2BGR555   = 22,  //!< convert between RGB/BGR and BGR555 (16-bit images)
+    COLOR_RGB2BGR555   = 23,
+    COLOR_BGR5552BGR   = 24,
+    COLOR_BGR5552RGB   = 25,
+    COLOR_BGRA2BGR555  = 26,
+    COLOR_RGBA2BGR555  = 27,
+    COLOR_BGR5552BGRA  = 28,
+    COLOR_BGR5552RGBA  = 29,
+
+    COLOR_GRAY2BGR555  = 30, //!< convert between grayscale and BGR555 (16-bit images)
+    COLOR_BGR5552GRAY  = 31,
+
+    COLOR_BGR2XYZ      = 32, //!< convert RGB/BGR to CIE XYZ, @ref color_convert_rgb_xyz "color conversions"
+    COLOR_RGB2XYZ      = 33,
+    COLOR_XYZ2BGR      = 34,
+    COLOR_XYZ2RGB      = 35,
+
+    COLOR_BGR2YCrCb    = 36, //!< convert RGB/BGR to luma-chroma (aka YCC), @ref color_convert_rgb_ycrcb "color conversions"
+    COLOR_RGB2YCrCb    = 37,
+    COLOR_YCrCb2BGR    = 38,
+    COLOR_YCrCb2RGB    = 39,
+
+    COLOR_BGR2HSV      = 40, //!< convert RGB/BGR to HSV (hue saturation value), @ref color_convert_rgb_hsv "color conversions"
+    COLOR_RGB2HSV      = 41,
+
+    COLOR_BGR2Lab      = 44, //!< convert RGB/BGR to CIE Lab, @ref color_convert_rgb_lab "color conversions"
+    COLOR_RGB2Lab      = 45,
+
+    COLOR_BGR2Luv      = 50, //!< convert RGB/BGR to CIE Luv, @ref color_convert_rgb_luv "color conversions"
+    COLOR_RGB2Luv      = 51,
+    COLOR_BGR2HLS      = 52, //!< convert RGB/BGR to HLS (hue lightness saturation), @ref color_convert_rgb_hls "color conversions"
+    COLOR_RGB2HLS      = 53,
+
+    COLOR_HSV2BGR      = 54, //!< backward conversions to RGB/BGR
+    COLOR_HSV2RGB      = 55,
+
+    COLOR_Lab2BGR      = 56,
+    COLOR_Lab2RGB      = 57,
+    COLOR_Luv2BGR      = 58,
+    COLOR_Luv2RGB      = 59,
+    COLOR_HLS2BGR      = 60,
+    COLOR_HLS2RGB      = 61,
+
+    COLOR_BGR2HSV_FULL = 66, //!<
+    COLOR_RGB2HSV_FULL = 67,
+    COLOR_BGR2HLS_FULL = 68,
+    COLOR_RGB2HLS_FULL = 69,
+
+    COLOR_HSV2BGR_FULL = 70,
+    COLOR_HSV2RGB_FULL = 71,
+    COLOR_HLS2BGR_FULL = 72,
+    COLOR_HLS2RGB_FULL = 73,
+
+    COLOR_LBGR2Lab     = 74,
+    COLOR_LRGB2Lab     = 75,
+    COLOR_LBGR2Luv     = 76,
+    COLOR_LRGB2Luv     = 77,
+
+    COLOR_Lab2LBGR     = 78,
+    COLOR_Lab2LRGB     = 79,
+    COLOR_Luv2LBGR     = 80,
+    COLOR_Luv2LRGB     = 81,
+
+    COLOR_BGR2YUV      = 82, //!< convert between RGB/BGR and YUV
+    COLOR_RGB2YUV      = 83,
+    COLOR_YUV2BGR      = 84,
+    COLOR_YUV2RGB      = 85,
+
+    //! YUV 4:2:0 family to RGB
+    COLOR_YUV2RGB_NV12  = 90,
+    COLOR_YUV2BGR_NV12  = 91,
+    COLOR_YUV2RGB_NV21  = 92,
+    COLOR_YUV2BGR_NV21  = 93,
+    COLOR_YUV420sp2RGB  = COLOR_YUV2RGB_NV21,
+    COLOR_YUV420sp2BGR  = COLOR_YUV2BGR_NV21,
+
+    COLOR_YUV2RGBA_NV12 = 94,
+    COLOR_YUV2BGRA_NV12 = 95,
+    COLOR_YUV2RGBA_NV21 = 96,
+    COLOR_YUV2BGRA_NV21 = 97,
+    COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21,
+    COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21,
+
+    COLOR_YUV2RGB_YV12  = 98,
+    COLOR_YUV2BGR_YV12  = 99,
+    COLOR_YUV2RGB_IYUV  = 100,
+    COLOR_YUV2BGR_IYUV  = 101,
+    COLOR_YUV2RGB_I420  = COLOR_YUV2RGB_IYUV,
+    COLOR_YUV2BGR_I420  = COLOR_YUV2BGR_IYUV,
+    COLOR_YUV420p2RGB   = COLOR_YUV2RGB_YV12,
+    COLOR_YUV420p2BGR   = COLOR_YUV2BGR_YV12,
+
+    COLOR_YUV2RGBA_YV12 = 102,
+    COLOR_YUV2BGRA_YV12 = 103,
+    COLOR_YUV2RGBA_IYUV = 104,
+    COLOR_YUV2BGRA_IYUV = 105,
+    COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV,
+    COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV,
+    COLOR_YUV420p2RGBA  = COLOR_YUV2RGBA_YV12,
+    COLOR_YUV420p2BGRA  = COLOR_YUV2BGRA_YV12,
+
+    COLOR_YUV2GRAY_420  = 106,
+    COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420,
+    COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420,
+    COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420,
+    COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420,
+    COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420,
+    COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420,
+    COLOR_YUV420p2GRAY  = COLOR_YUV2GRAY_420,
+
+    //! YUV 4:2:2 family to RGB
+    COLOR_YUV2RGB_UYVY = 107,
+    COLOR_YUV2BGR_UYVY = 108,
+    //COLOR_YUV2RGB_VYUY = 109,
+    //COLOR_YUV2BGR_VYUY = 110,
+    COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY,
+    COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY,
+    COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY,
+    COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY,
+
+    COLOR_YUV2RGBA_UYVY = 111,
+    COLOR_YUV2BGRA_UYVY = 112,
+    //COLOR_YUV2RGBA_VYUY = 113,
+    //COLOR_YUV2BGRA_VYUY = 114,
+    COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY,
+    COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY,
+    COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY,
+    COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY,
+
+    COLOR_YUV2RGB_YUY2 = 115,
+    COLOR_YUV2BGR_YUY2 = 116,
+    COLOR_YUV2RGB_YVYU = 117,
+    COLOR_YUV2BGR_YVYU = 118,
+    COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2,
+    COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2,
+    COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2,
+    COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2,
+
+    COLOR_YUV2RGBA_YUY2 = 119,
+    COLOR_YUV2BGRA_YUY2 = 120,
+    COLOR_YUV2RGBA_YVYU = 121,
+    COLOR_YUV2BGRA_YVYU = 122,
+    COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2,
+    COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2,
+    COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2,
+    COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2,
+
+    COLOR_YUV2GRAY_UYVY = 123,
+    COLOR_YUV2GRAY_YUY2 = 124,
+    //CV_YUV2GRAY_VYUY    = CV_YUV2GRAY_UYVY,
+    COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY,
+    COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY,
+    COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2,
+    COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2,
+    COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2,
+
+    //! alpha premultiplication
+    COLOR_RGBA2mRGBA    = 125,
+    COLOR_mRGBA2RGBA    = 126,
+
+    //! RGB to YUV 4:2:0 family
+    COLOR_RGB2YUV_I420  = 127,
+    COLOR_BGR2YUV_I420  = 128,
+    COLOR_RGB2YUV_IYUV  = COLOR_RGB2YUV_I420,
+    COLOR_BGR2YUV_IYUV  = COLOR_BGR2YUV_I420,
+
+    COLOR_RGBA2YUV_I420 = 129,
+    COLOR_BGRA2YUV_I420 = 130,
+    COLOR_RGBA2YUV_IYUV = COLOR_RGBA2YUV_I420,
+    COLOR_BGRA2YUV_IYUV = COLOR_BGRA2YUV_I420,
+    COLOR_RGB2YUV_YV12  = 131,
+    COLOR_BGR2YUV_YV12  = 132,
+    COLOR_RGBA2YUV_YV12 = 133,
+    COLOR_BGRA2YUV_YV12 = 134,
+
+    //! Demosaicing
+    COLOR_BayerBG2BGR = 46,
+    COLOR_BayerGB2BGR = 47,
+    COLOR_BayerRG2BGR = 48,
+    COLOR_BayerGR2BGR = 49,
+
+    COLOR_BayerBG2RGB = COLOR_BayerRG2BGR,
+    COLOR_BayerGB2RGB = COLOR_BayerGR2BGR,
+    COLOR_BayerRG2RGB = COLOR_BayerBG2BGR,
+    COLOR_BayerGR2RGB = COLOR_BayerGB2BGR,
+
+    COLOR_BayerBG2GRAY = 86,
+    COLOR_BayerGB2GRAY = 87,
+    COLOR_BayerRG2GRAY = 88,
+    COLOR_BayerGR2GRAY = 89,
+
+    //! Demosaicing using Variable Number of Gradients
+    COLOR_BayerBG2BGR_VNG = 62,
+    COLOR_BayerGB2BGR_VNG = 63,
+    COLOR_BayerRG2BGR_VNG = 64,
+    COLOR_BayerGR2BGR_VNG = 65,
+
+    COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG,
+    COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG,
+    COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG,
+    COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG,
+
+    //! Edge-Aware Demosaicing
+    COLOR_BayerBG2BGR_EA  = 135,
+    COLOR_BayerGB2BGR_EA  = 136,
+    COLOR_BayerRG2BGR_EA  = 137,
+    COLOR_BayerGR2BGR_EA  = 138,
+
+    COLOR_BayerBG2RGB_EA  = COLOR_BayerRG2BGR_EA,
+    COLOR_BayerGB2RGB_EA  = COLOR_BayerGR2BGR_EA,
+    COLOR_BayerRG2RGB_EA  = COLOR_BayerBG2BGR_EA,
+    COLOR_BayerGR2RGB_EA  = COLOR_BayerGB2BGR_EA,
+
+
+    COLOR_COLORCVT_MAX  = 139
+};
+
+/** types of intersection between rectangles
+@ingroup imgproc_shape
+*/
+enum RectanglesIntersectTypes {
+    INTERSECT_NONE = 0, //!< No intersection
+    INTERSECT_PARTIAL  = 1, //!< There is a partial intersection
+    INTERSECT_FULL  = 2 //!< One of the rectangle is fully enclosed in the other
+};
+
+//! finds arbitrary template in the grayscale image using Generalized Hough Transform
+class CV_EXPORTS GeneralizedHough : public Algorithm
+{
+public:
+    //! set template to search
+    virtual void setTemplate(InputArray templ, Point templCenter = Point(-1, -1)) = 0;
+    virtual void setTemplate(InputArray edges, InputArray dx, InputArray dy, Point templCenter = Point(-1, -1)) = 0;
+
+    //! find template on image
+    virtual void detect(InputArray image, OutputArray positions, OutputArray votes = noArray()) = 0;
+    virtual void detect(InputArray edges, InputArray dx, InputArray dy, OutputArray positions, OutputArray votes = noArray()) = 0;
+
+    //! Canny low threshold.
+    virtual void setCannyLowThresh(int cannyLowThresh) = 0;
+    virtual int getCannyLowThresh() const = 0;
+
+    //! Canny high threshold.
+    virtual void setCannyHighThresh(int cannyHighThresh) = 0;
+    virtual int getCannyHighThresh() const = 0;
+
+    //! Minimum distance between the centers of the detected objects.
+    virtual void setMinDist(double minDist) = 0;
+    virtual double getMinDist() const = 0;
+
+    //! Inverse ratio of the accumulator resolution to the image resolution.
+    virtual void setDp(double dp) = 0;
+    virtual double getDp() const = 0;
+
+    //! Maximal size of inner buffers.
+    virtual void setMaxBufferSize(int maxBufferSize) = 0;
+    virtual int getMaxBufferSize() const = 0;
+};
+
+//! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122.
+//! Detects position only without traslation and rotation
+class CV_EXPORTS GeneralizedHoughBallard : public GeneralizedHough
+{
+public:
+    //! R-Table levels.
+    virtual void setLevels(int levels) = 0;
+    virtual int getLevels() const = 0;
+
+    //! The accumulator threshold for the template centers at the detection stage. The smaller it is, the more false positions may be detected.
+    virtual void setVotesThreshold(int votesThreshold) = 0;
+    virtual int getVotesThreshold() const = 0;
+};
+
+//! Guil, N., Gonz谩lez-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038.
+//! Detects position, traslation and rotation
+class CV_EXPORTS GeneralizedHoughGuil : public GeneralizedHough
+{
+public:
+    //! Angle difference in degrees between two points in feature.
+    virtual void setXi(double xi) = 0;
+    virtual double getXi() const = 0;
+
+    //! Feature table levels.
+    virtual void setLevels(int levels) = 0;
+    virtual int getLevels() const = 0;
+
+    //! Maximal difference between angles that treated as equal.
+    virtual void setAngleEpsilon(double angleEpsilon) = 0;
+    virtual double getAngleEpsilon() const = 0;
+
+    //! Minimal rotation angle to detect in degrees.
+    virtual void setMinAngle(double minAngle) = 0;
+    virtual double getMinAngle() const = 0;
+
+    //! Maximal rotation angle to detect in degrees.
+    virtual void setMaxAngle(double maxAngle) = 0;
+    virtual double getMaxAngle() const = 0;
+
+    //! Angle step in degrees.
+    virtual void setAngleStep(double angleStep) = 0;
+    virtual double getAngleStep() const = 0;
+
+    //! Angle votes threshold.
+    virtual void setAngleThresh(int angleThresh) = 0;
+    virtual int getAngleThresh() const = 0;
+
+    //! Minimal scale to detect.
+    virtual void setMinScale(double minScale) = 0;
+    virtual double getMinScale() const = 0;
+
+    //! Maximal scale to detect.
+    virtual void setMaxScale(double maxScale) = 0;
+    virtual double getMaxScale() const = 0;
+
+    //! Scale step.
+    virtual void setScaleStep(double scaleStep) = 0;
+    virtual double getScaleStep() const = 0;
+
+    //! Scale votes threshold.
+    virtual void setScaleThresh(int scaleThresh) = 0;
+    virtual int getScaleThresh() const = 0;
+
+    //! Position votes threshold.
+    virtual void setPosThresh(int posThresh) = 0;
+    virtual int getPosThresh() const = 0;
+};
+
+
+class CV_EXPORTS_W CLAHE : public Algorithm
+{
+public:
+    CV_WRAP virtual void apply(InputArray src, OutputArray dst) = 0;
+
+    CV_WRAP virtual void setClipLimit(double clipLimit) = 0;
+    CV_WRAP virtual double getClipLimit() const = 0;
+
+    CV_WRAP virtual void setTilesGridSize(Size tileGridSize) = 0;
+    CV_WRAP virtual Size getTilesGridSize() const = 0;
+
+    CV_WRAP virtual void collectGarbage() = 0;
+};
+
+
+class CV_EXPORTS_W Subdiv2D
+{
+public:
+    enum { PTLOC_ERROR        = -2,
+           PTLOC_OUTSIDE_RECT = -1,
+           PTLOC_INSIDE       = 0,
+           PTLOC_VERTEX       = 1,
+           PTLOC_ON_EDGE      = 2
+         };
+
+    enum { NEXT_AROUND_ORG   = 0x00,
+           NEXT_AROUND_DST   = 0x22,
+           PREV_AROUND_ORG   = 0x11,
+           PREV_AROUND_DST   = 0x33,
+           NEXT_AROUND_LEFT  = 0x13,
+           NEXT_AROUND_RIGHT = 0x31,
+           PREV_AROUND_LEFT  = 0x20,
+           PREV_AROUND_RIGHT = 0x02
+         };
+
+    CV_WRAP Subdiv2D();
+    CV_WRAP Subdiv2D(Rect rect);
+    CV_WRAP void initDelaunay(Rect rect);
+
+    CV_WRAP int insert(Point2f pt);
+    CV_WRAP void insert(const std::vector<Point2f>& ptvec);
+    CV_WRAP int locate(Point2f pt, CV_OUT int& edge, CV_OUT int& vertex);
+
+    CV_WRAP int findNearest(Point2f pt, CV_OUT Point2f* nearestPt = 0);
+    CV_WRAP void getEdgeList(CV_OUT std::vector<Vec4f>& edgeList) const;
+    CV_WRAP void getTriangleList(CV_OUT std::vector<Vec6f>& triangleList) const;
+    CV_WRAP void getVoronoiFacetList(const std::vector<int>& idx, CV_OUT std::vector<std::vector<Point2f> >& facetList,
+                                     CV_OUT std::vector<Point2f>& facetCenters);
+
+    CV_WRAP Point2f getVertex(int vertex, CV_OUT int* firstEdge = 0) const;
+
+    CV_WRAP int getEdge( int edge, int nextEdgeType ) const;
+    CV_WRAP int nextEdge(int edge) const;
+    CV_WRAP int rotateEdge(int edge, int rotate) const;
+    CV_WRAP int symEdge(int edge) const;
+    CV_WRAP int edgeOrg(int edge, CV_OUT Point2f* orgpt = 0) const;
+    CV_WRAP int edgeDst(int edge, CV_OUT Point2f* dstpt = 0) const;
+
+protected:
+    int newEdge();
+    void deleteEdge(int edge);
+    int newPoint(Point2f pt, bool isvirtual, int firstEdge = 0);
+    void deletePoint(int vtx);
+    void setEdgePoints( int edge, int orgPt, int dstPt );
+    void splice( int edgeA, int edgeB );
+    int connectEdges( int edgeA, int edgeB );
+    void swapEdges( int edge );
+    int isRightOf(Point2f pt, int edge) const;
+    void calcVoronoi();
+    void clearVoronoi();
+    void checkSubdiv() const;
+
+    struct CV_EXPORTS Vertex
+    {
+        Vertex();
+        Vertex(Point2f pt, bool _isvirtual, int _firstEdge=0);
+        bool isvirtual() const;
+        bool isfree() const;
+
+        int firstEdge;
+        int type;
+        Point2f pt;
+    };
+
+    struct CV_EXPORTS QuadEdge
+    {
+        QuadEdge();
+        QuadEdge(int edgeidx);
+        bool isfree() const;
+
+        int next[4];
+        int pt[4];
+    };
+
+    std::vector<Vertex> vtx;
+    std::vector<QuadEdge> qedges;
+    int freeQEdge;
+    int freePoint;
+    bool validGeometry;
+
+    int recentEdge;
+    Point2f topLeft;
+    Point2f bottomRight;
+};
+
+//! @addtogroup imgproc_feature
+//! @{
+
+/** @example lsd_lines.cpp
+An example using the LineSegmentDetector
+*/
+
+/** @brief Line segment detector class
+
+following the algorithm described at @cite Rafael12 .
+*/
+class CV_EXPORTS_W LineSegmentDetector : public Algorithm
+{
+public:
+
+    /** @brief Finds lines in the input image.
+
+    This is the output of the default parameters of the algorithm on the above shown image.
+
+    ![image](pics/building_lsd.png)
+
+    @param _image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use:
+    `lsd_ptr-\>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);`
+    @param _lines A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where
+    Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly
+    oriented depending on the gradient.
+    @param width Vector of widths of the regions, where the lines are found. E.g. Width of line.
+    @param prec Vector of precisions with which the lines are found.
+    @param nfa Vector containing number of false alarms in the line region, with precision of 10%. The
+    bigger the value, logarithmically better the detection.
+    - -1 corresponds to 10 mean false alarms
+    - 0 corresponds to 1 mean false alarm
+    - 1 corresponds to 0.1 mean false alarms
+    This vector will be calculated only when the objects type is LSD_REFINE_ADV.
+    */
+    CV_WRAP virtual void detect(InputArray _image, OutputArray _lines,
+                        OutputArray width = noArray(), OutputArray prec = noArray(),
+                        OutputArray nfa = noArray()) = 0;
+
+    /** @brief Draws the line segments on a given image.
+    @param _image The image, where the liens will be drawn. Should be bigger or equal to the image,
+    where the lines were found.
+    @param lines A vector of the lines that needed to be drawn.
+     */
+    CV_WRAP virtual void drawSegments(InputOutputArray _image, InputArray lines) = 0;
+
+    /** @brief Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels.
+
+    @param size The size of the image, where lines1 and lines2 were found.
+    @param lines1 The first group of lines that needs to be drawn. It is visualized in blue color.
+    @param lines2 The second group of lines. They visualized in red color.
+    @param _image Optional image, where the lines will be drawn. The image should be color(3-channel)
+    in order for lines1 and lines2 to be drawn in the above mentioned colors.
+     */
+    CV_WRAP virtual int compareSegments(const Size& size, InputArray lines1, InputArray lines2, InputOutputArray _image = noArray()) = 0;
+
+    virtual ~LineSegmentDetector() { }
+};
+
+/** @brief Creates a smart pointer to a LineSegmentDetector object and initializes it.
+
+The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
+to edit those, as to tailor it for their own application.
+
+@param _refine The way found lines will be refined, see cv::LineSegmentDetectorModes
+@param _scale The scale of the image that will be used to find the lines. Range (0..1].
+@param _sigma_scale Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale.
+@param _quant Bound to the quantization error on the gradient norm.
+@param _ang_th Gradient angle tolerance in degrees.
+@param _log_eps Detection threshold: -log10(NFA) \> log_eps. Used only when advancent refinement
+is chosen.
+@param _density_th Minimal density of aligned region points in the enclosing rectangle.
+@param _n_bins Number of bins in pseudo-ordering of gradient modulus.
+ */
+CV_EXPORTS_W Ptr<LineSegmentDetector> createLineSegmentDetector(
+    int _refine = LSD_REFINE_STD, double _scale = 0.8,
+    double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5,
+    double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024);
+
+//! @} imgproc_feature
+
+//! @addtogroup imgproc_filter
+//! @{
+
+/** @brief Returns Gaussian filter coefficients.
+
+The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter
+coefficients:
+
+\f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f]
+
+where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$.
+
+Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize
+smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly.
+You may also use the higher-level GaussianBlur.
+@param ksize Aperture size. It should be odd ( \f$\texttt{ksize} \mod 2 = 1\f$ ) and positive.
+@param sigma Gaussian standard deviation. If it is non-positive, it is computed from ksize as
+`sigma = 0.3\*((ksize-1)\*0.5 - 1) + 0.8`.
+@param ktype Type of filter coefficients. It can be CV_32F or CV_64F .
+@sa  sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur
+ */
+CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype = CV_64F );
+
+/** @brief Returns filter coefficients for computing spatial image derivatives.
+
+The function computes and returns the filter coefficients for spatial image derivatives. When
+`ksize=CV_SCHARR`, the Scharr \f$3 \times 3\f$ kernels are generated (see cv::Scharr). Otherwise, Sobel
+kernels are generated (see cv::Sobel). The filters are normally passed to sepFilter2D or to
+
+@param kx Output matrix of row filter coefficients. It has the type ktype .
+@param ky Output matrix of column filter coefficients. It has the type ktype .
+@param dx Derivative order in respect of x.
+@param dy Derivative order in respect of y.
+@param ksize Aperture size. It can be CV_SCHARR, 1, 3, 5, or 7.
+@param normalize Flag indicating whether to normalize (scale down) the filter coefficients or not.
+Theoretically, the coefficients should have the denominator \f$=2^{ksize*2-dx-dy-2}\f$. If you are
+going to filter floating-point images, you are likely to use the normalized kernels. But if you
+compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
+all the fractional bits, you may want to set normalize=false .
+@param ktype Type of filter coefficients. It can be CV_32f or CV_64F .
+ */
+CV_EXPORTS_W void getDerivKernels( OutputArray kx, OutputArray ky,
+                                   int dx, int dy, int ksize,
+                                   bool normalize = false, int ktype = CV_32F );
+
+/** @brief Returns Gabor filter coefficients.
+
+For more details about gabor filter equations and parameters, see: [Gabor
+Filter](http://en.wikipedia.org/wiki/Gabor_filter).
+
+@param ksize Size of the filter returned.
+@param sigma Standard deviation of the gaussian envelope.
+@param theta Orientation of the normal to the parallel stripes of a Gabor function.
+@param lambd Wavelength of the sinusoidal factor.
+@param gamma Spatial aspect ratio.
+@param psi Phase offset.
+@param ktype Type of filter coefficients. It can be CV_32F or CV_64F .
+ */
+CV_EXPORTS_W Mat getGaborKernel( Size ksize, double sigma, double theta, double lambd,
+                                 double gamma, double psi = CV_PI*0.5, int ktype = CV_64F );
+
+//! returns "magic" border value for erosion and dilation. It is automatically transformed to Scalar::all(-DBL_MAX) for dilation.
+static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
+
+/** @brief Returns a structuring element of the specified size and shape for morphological operations.
+
+The function constructs and returns the structuring element that can be further passed to cv::erode,
+cv::dilate or cv::morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as
+the structuring element.
+
+@param shape Element shape that could be one of cv::MorphShapes
+@param ksize Size of the structuring element.
+@param anchor Anchor position within the element. The default value \f$(-1, -1)\f$ means that the
+anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor
+position. In other cases the anchor just regulates how much the result of the morphological
+operation is shifted.
+ */
+CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor = Point(-1,-1));
+
+/** @brief Blurs an image using the median filter.
+
+The function smoothes an image using the median filter with the \f$\texttt{ksize} \times
+\texttt{ksize}\f$ aperture. Each channel of a multi-channel image is processed independently.
+In-place operation is supported.
+
+@param src input 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be
+CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.
+@param dst destination array of the same size and type as src.
+@param ksize aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ...
+@sa  bilateralFilter, blur, boxFilter, GaussianBlur
+ */
+CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize );
+
+/** @brief Blurs an image using a Gaussian filter.
+
+The function convolves the source image with the specified Gaussian kernel. In-place filtering is
+supported.
+
+@param src input image; the image can have any number of channels, which are processed
+independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst output image of the same size and type as src.
+@param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
+positive and odd. Or, they can be zero's and then they are computed from sigma.
+@param sigmaX Gaussian kernel standard deviation in X direction.
+@param sigmaY Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be
+equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
+respectively (see cv::getGaussianKernel for details); to fully control the result regardless of
+possible future modifications of all this semantics, it is recommended to specify all of ksize,
+sigmaX, and sigmaY.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+
+@sa  sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur
+ */
+CV_EXPORTS_W void GaussianBlur( InputArray src, OutputArray dst, Size ksize,
+                                double sigmaX, double sigmaY = 0,
+                                int borderType = BORDER_DEFAULT );
+
+/** @brief Applies the bilateral filter to an image.
+
+The function applies bilateral filtering to the input image, as described in
+http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html
+bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is
+very slow compared to most filters.
+
+_Sigma values_: For simplicity, you can set the 2 sigma values to be the same. If they are small (\<
+10), the filter will not have much effect, whereas if they are large (\> 150), they will have a very
+strong effect, making the image look "cartoonish".
+
+_Filter size_: Large filters (d \> 5) are very slow, so it is recommended to use d=5 for real-time
+applications, and perhaps d=9 for offline applications that need heavy noise filtering.
+
+This filter does not work inplace.
+@param src Source 8-bit or floating-point, 1-channel or 3-channel image.
+@param dst Destination image of the same size and type as src .
+@param d Diameter of each pixel neighborhood that is used during filtering. If it is non-positive,
+it is computed from sigmaSpace.
+@param sigmaColor Filter sigma in the color space. A larger value of the parameter means that
+farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting
+in larger areas of semi-equal color.
+@param sigmaSpace Filter sigma in the coordinate space. A larger value of the parameter means that
+farther pixels will influence each other as long as their colors are close enough (see sigmaColor
+). When d\>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is
+proportional to sigmaSpace.
+@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
+ */
+CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d,
+                                   double sigmaColor, double sigmaSpace,
+                                   int borderType = BORDER_DEFAULT );
+
+/** @brief Blurs an image using the box filter.
+
+The function smoothes an image using the kernel:
+
+\f[\texttt{K} =  \alpha \begin{bmatrix} 1 & 1 & 1 &  \cdots & 1 & 1  \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \hdotsfor{6} \\ 1 & 1 & 1 &  \cdots & 1 & 1 \end{bmatrix}\f]
+
+where
+
+\f[\alpha = \fork{\frac{1}{\texttt{ksize.width*ksize.height}}}{when \texttt{normalize=true}}{1}{otherwise}\f]
+
+Unnormalized box filter is useful for computing various integral characteristics over each pixel
+neighborhood, such as covariance matrices of image derivatives (used in dense optical flow
+algorithms, and so on). If you need to compute pixel sums over variable-size windows, use cv::integral.
+
+@param src input image.
+@param dst output image of the same size and type as src.
+@param ddepth the output image depth (-1 to use src.depth()).
+@param ksize blurring kernel size.
+@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
+center.
+@param normalize flag, specifying whether the kernel is normalized by its area or not.
+@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
+@sa  blur, bilateralFilter, GaussianBlur, medianBlur, integral
+ */
+CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth,
+                             Size ksize, Point anchor = Point(-1,-1),
+                             bool normalize = true,
+                             int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates the normalized sum of squares of the pixel values overlapping the filter.
+
+For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring
+pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$.
+
+The unnormalized square box filter can be useful in computing local image statistics such as the the local
+variance and standard deviation around the neighborhood of a pixel.
+
+@param _src input image
+@param _dst output image of the same size and type as _src
+@param ddepth the output image depth (-1 to use src.depth())
+@param ksize kernel size
+@param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
+center.
+@param normalize flag, specifying whether the kernel is to be normalized by it's area or not.
+@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
+@sa boxFilter
+*/
+CV_EXPORTS_W void sqrBoxFilter( InputArray _src, OutputArray _dst, int ddepth,
+                                Size ksize, Point anchor = Point(-1, -1),
+                                bool normalize = true,
+                                int borderType = BORDER_DEFAULT );
+
+/** @brief Blurs an image using the normalized box filter.
+
+The function smoothes an image using the kernel:
+
+\f[\texttt{K} =  \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 &  \cdots & 1 & 1  \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \hdotsfor{6} \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \end{bmatrix}\f]
+
+The call `blur(src, dst, ksize, anchor, borderType)` is equivalent to `boxFilter(src, dst, src.type(),
+anchor, true, borderType)`.
+
+@param src input image; it can have any number of channels, which are processed independently, but
+the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst output image of the same size and type as src.
+@param ksize blurring kernel size.
+@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
+center.
+@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
+@sa  boxFilter, bilateralFilter, GaussianBlur, medianBlur
+ */
+CV_EXPORTS_W void blur( InputArray src, OutputArray dst,
+                        Size ksize, Point anchor = Point(-1,-1),
+                        int borderType = BORDER_DEFAULT );
+
+/** @brief Convolves an image with the kernel.
+
+The function applies an arbitrary linear filter to an image. In-place operation is supported. When
+the aperture is partially outside the image, the function interpolates outlier pixel values
+according to the specified border mode.
+
+The function does actually compute correlation, not the convolution:
+
+\f[\texttt{dst} (x,y) =  \sum _{ \stackrel{0\leq x' < \texttt{kernel.cols},}{0\leq y' < \texttt{kernel.rows}} }  \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f]
+
+That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip
+the kernel using cv::flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows -
+anchor.y - 1)`.
+
+The function uses the DFT-based algorithm in case of sufficiently large kernels (~`11 x 11` or
+larger) and the direct algorithm for small kernels.
+
+@param src input image.
+@param dst output image of the same size and the same number of channels as src.
+@param ddepth desired depth of the destination image, see @ref filter_depths "combinations"
+@param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
+matrix; if you want to apply different kernels to different channels, split the image into
+separate color planes using split and process them individually.
+@param anchor anchor of the kernel that indicates the relative position of a filtered point within
+the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
+is at the kernel center.
+@param delta optional value added to the filtered pixels before storing them in dst.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@sa  sepFilter2D, dft, matchTemplate
+ */
+CV_EXPORTS_W void filter2D( InputArray src, OutputArray dst, int ddepth,
+                            InputArray kernel, Point anchor = Point(-1,-1),
+                            double delta = 0, int borderType = BORDER_DEFAULT );
+
+/** @brief Applies a separable linear filter to an image.
+
+The function applies a separable linear filter to the image. That is, first, every row of src is
+filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D
+kernel kernelY. The final result shifted by delta is stored in dst .
+
+@param src Source image.
+@param dst Destination image of the same size and the same number of channels as src .
+@param ddepth Destination image depth, see @ref filter_depths "combinations"
+@param kernelX Coefficients for filtering each row.
+@param kernelY Coefficients for filtering each column.
+@param anchor Anchor position within the kernel. The default value \f$(-1,-1)\f$ means that the anchor
+is at the kernel center.
+@param delta Value added to the filtered results before storing them.
+@param borderType Pixel extrapolation method, see cv::BorderTypes
+@sa  filter2D, Sobel, GaussianBlur, boxFilter, blur
+ */
+CV_EXPORTS_W void sepFilter2D( InputArray src, OutputArray dst, int ddepth,
+                               InputArray kernelX, InputArray kernelY,
+                               Point anchor = Point(-1,-1),
+                               double delta = 0, int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
+
+In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to
+calculate the derivative. When \f$\texttt{ksize = 1}\f$, the \f$3 \times 1\f$ or \f$1 \times 3\f$
+kernel is used (that is, no Gaussian smoothing is done). `ksize = 1` can only be used for the first
+or the second x- or y- derivatives.
+
+There is also the special value `ksize = CV_SCHARR (-1)` that corresponds to the \f$3\times3\f$ Scharr
+filter that may give more accurate results than the \f$3\times3\f$ Sobel. The Scharr aperture is
+
+\f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f]
+
+for the x-derivative, or transposed for the y-derivative.
+
+The function calculates an image derivative by convolving the image with the appropriate kernel:
+
+\f[\texttt{dst} =  \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f]
+
+The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
+resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
+or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
+case corresponds to a kernel of:
+
+\f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f]
+
+The second case corresponds to a kernel of:
+
+\f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f]
+
+@param src input image.
+@param dst output image of the same size and the same number of channels as src .
+@param ddepth output image depth, see @ref filter_depths "combinations"; in the case of
+    8-bit input images it will result in truncated derivatives.
+@param dx order of the derivative x.
+@param dy order of the derivative y.
+@param ksize size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
+@param scale optional scale factor for the computed derivative values; by default, no scaling is
+applied (see cv::getDerivKernels for details).
+@param delta optional delta value that is added to the results prior to storing them in dst.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@sa  Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
+ */
+CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth,
+                         int dx, int dy, int ksize = 3,
+                         double scale = 1, double delta = 0,
+                         int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates the first order image derivative in both x and y using a Sobel operator
+
+Equivalent to calling:
+
+@code
+Sobel( src, dx, CV_16SC1, 1, 0, 3 );
+Sobel( src, dy, CV_16SC1, 0, 1, 3 );
+@endcode
+
+@param src input image.
+@param dx output image with first-order derivative in x.
+@param dy output image with first-order derivative in y.
+@param ksize size of Sobel kernel. It must be 3.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+
+@sa Sobel
+ */
+
+CV_EXPORTS_W void spatialGradient( InputArray src, OutputArray dx,
+                                   OutputArray dy, int ksize = 3,
+                                   int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates the first x- or y- image derivative using Scharr operator.
+
+The function computes the first x- or y- spatial image derivative using the Scharr operator. The
+call
+
+\f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f]
+
+is equivalent to
+
+\f[\texttt{Sobel(src, dst, ddepth, dx, dy, CV\_SCHARR, scale, delta, borderType)} .\f]
+
+@param src input image.
+@param dst output image of the same size and the same number of channels as src.
+@param ddepth output image depth, see @ref filter_depths "combinations"
+@param dx order of the derivative x.
+@param dy order of the derivative y.
+@param scale optional scale factor for the computed derivative values; by default, no scaling is
+applied (see getDerivKernels for details).
+@param delta optional delta value that is added to the results prior to storing them in dst.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@sa  cartToPolar
+ */
+CV_EXPORTS_W void Scharr( InputArray src, OutputArray dst, int ddepth,
+                          int dx, int dy, double scale = 1, double delta = 0,
+                          int borderType = BORDER_DEFAULT );
+
+/** @example laplace.cpp
+  An example using Laplace transformations for edge detection
+*/
+
+/** @brief Calculates the Laplacian of an image.
+
+The function calculates the Laplacian of the source image by adding up the second x and y
+derivatives calculated using the Sobel operator:
+
+\f[\texttt{dst} =  \Delta \texttt{src} =  \frac{\partial^2 \texttt{src}}{\partial x^2} +  \frac{\partial^2 \texttt{src}}{\partial y^2}\f]
+
+This is done when `ksize > 1`. When `ksize == 1`, the Laplacian is computed by filtering the image
+with the following \f$3 \times 3\f$ aperture:
+
+\f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f]
+
+@param src Source image.
+@param dst Destination image of the same size and the same number of channels as src .
+@param ddepth Desired depth of the destination image.
+@param ksize Aperture size used to compute the second-derivative filters. See getDerivKernels for
+details. The size must be positive and odd.
+@param scale Optional scale factor for the computed Laplacian values. By default, no scaling is
+applied. See getDerivKernels for details.
+@param delta Optional delta value that is added to the results prior to storing them in dst .
+@param borderType Pixel extrapolation method, see cv::BorderTypes
+@sa  Sobel, Scharr
+ */
+CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth,
+                             int ksize = 1, double scale = 1, double delta = 0,
+                             int borderType = BORDER_DEFAULT );
+
+//! @} imgproc_filter
+
+//! @addtogroup imgproc_feature
+//! @{
+
+/** @example edge.cpp
+  An example on using the canny edge detector
+*/
+
+/** @brief Finds edges in an image using the Canny algorithm @cite Canny86 .
+
+The function finds edges in the input image image and marks them in the output map edges using the
+Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The
+largest value is used to find initial segments of strong edges. See
+<http://en.wikipedia.org/wiki/Canny_edge_detector>
+
+@param image 8-bit input image.
+@param edges output edge map; single channels 8-bit image, which has the same size as image .
+@param threshold1 first threshold for the hysteresis procedure.
+@param threshold2 second threshold for the hysteresis procedure.
+@param apertureSize aperture size for the Sobel operator.
+@param L2gradient a flag, indicating whether a more accurate \f$L_2\f$ norm
+\f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude (
+L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough (
+L2gradient=false ).
+ */
+CV_EXPORTS_W void Canny( InputArray image, OutputArray edges,
+                         double threshold1, double threshold2,
+                         int apertureSize = 3, bool L2gradient = false );
+
+/** @brief Calculates the minimal eigenvalue of gradient matrices for corner detection.
+
+The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal
+eigenvalue of the covariance matrix of derivatives, that is, \f$\min(\lambda_1, \lambda_2)\f$ in terms
+of the formulae in the cornerEigenValsAndVecs description.
+
+@param src Input single-channel 8-bit or floating-point image.
+@param dst Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as
+src .
+@param blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ).
+@param ksize Aperture parameter for the Sobel operator.
+@param borderType Pixel extrapolation method. See cv::BorderTypes.
+ */
+CV_EXPORTS_W void cornerMinEigenVal( InputArray src, OutputArray dst,
+                                     int blockSize, int ksize = 3,
+                                     int borderType = BORDER_DEFAULT );
+
+/** @brief Harris corner detector.
+
+The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and
+cornerEigenValsAndVecs , for each pixel \f$(x, y)\f$ it calculates a \f$2\times2\f$ gradient covariance
+matrix \f$M^{(x,y)}\f$ over a \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood. Then, it
+computes the following characteristic:
+
+\f[\texttt{dst} (x,y) =  \mathrm{det} M^{(x,y)} - k  \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f]
+
+Corners in the image can be found as the local maxima of this response map.
+
+@param src Input single-channel 8-bit or floating-point image.
+@param dst Image to store the Harris detector responses. It has the type CV_32FC1 and the same
+size as src .
+@param blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ).
+@param ksize Aperture parameter for the Sobel operator.
+@param k Harris detector free parameter. See the formula below.
+@param borderType Pixel extrapolation method. See cv::BorderTypes.
+ */
+CV_EXPORTS_W void cornerHarris( InputArray src, OutputArray dst, int blockSize,
+                                int ksize, double k,
+                                int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates eigenvalues and eigenvectors of image blocks for corner detection.
+
+For every pixel \f$p\f$ , the function cornerEigenValsAndVecs considers a blockSize \f$\times\f$ blockSize
+neighborhood \f$S(p)\f$ . It calculates the covariation matrix of derivatives over the neighborhood as:
+
+\f[M =  \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 &  \sum _{S(p)}dI/dx dI/dy  \\ \sum _{S(p)}dI/dx dI/dy &  \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f]
+
+where the derivatives are computed using the Sobel operator.
+
+After that, it finds eigenvectors and eigenvalues of \f$M\f$ and stores them in the destination image as
+\f$(\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\f$ where
+
+-   \f$\lambda_1, \lambda_2\f$ are the non-sorted eigenvalues of \f$M\f$
+-   \f$x_1, y_1\f$ are the eigenvectors corresponding to \f$\lambda_1\f$
+-   \f$x_2, y_2\f$ are the eigenvectors corresponding to \f$\lambda_2\f$
+
+The output of the function can be used for robust edge or corner detection.
+
+@param src Input single-channel 8-bit or floating-point image.
+@param dst Image to store the results. It has the same size as src and the type CV_32FC(6) .
+@param blockSize Neighborhood size (see details below).
+@param ksize Aperture parameter for the Sobel operator.
+@param borderType Pixel extrapolation method. See cv::BorderTypes.
+
+@sa  cornerMinEigenVal, cornerHarris, preCornerDetect
+ */
+CV_EXPORTS_W void cornerEigenValsAndVecs( InputArray src, OutputArray dst,
+                                          int blockSize, int ksize,
+                                          int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates a feature map for corner detection.
+
+The function calculates the complex spatial derivative-based function of the source image
+
+\f[\texttt{dst} = (D_x  \texttt{src} )^2  \cdot D_{yy}  \texttt{src} + (D_y  \texttt{src} )^2  \cdot D_{xx}  \texttt{src} - 2 D_x  \texttt{src} \cdot D_y  \texttt{src} \cdot D_{xy}  \texttt{src}\f]
+
+where \f$D_x\f$,\f$D_y\f$ are the first image derivatives, \f$D_{xx}\f$,\f$D_{yy}\f$ are the second image
+derivatives, and \f$D_{xy}\f$ is the mixed derivative.
+
+The corners can be found as local maximums of the functions, as shown below:
+@code
+    Mat corners, dilated_corners;
+    preCornerDetect(image, corners, 3);
+    // dilation with 3x3 rectangular structuring element
+    dilate(corners, dilated_corners, Mat(), 1);
+    Mat corner_mask = corners == dilated_corners;
+@endcode
+
+@param src Source single-channel 8-bit of floating-point image.
+@param dst Output image that has the type CV_32F and the same size as src .
+@param ksize %Aperture size of the Sobel .
+@param borderType Pixel extrapolation method. See cv::BorderTypes.
+ */
+CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize,
+                                   int borderType = BORDER_DEFAULT );
+
+/** @brief Refines the corner locations.
+
+The function iterates to find the sub-pixel accurate location of corners or radial saddle points, as
+shown on the figure below.
+
+![image](pics/cornersubpix.png)
+
+Sub-pixel accurate corner locator is based on the observation that every vector from the center \f$q\f$
+to a point \f$p\f$ located within a neighborhood of \f$q\f$ is orthogonal to the image gradient at \f$p\f$
+subject to image and measurement noise. Consider the expression:
+
+\f[\epsilon _i = {DI_{p_i}}^T  \cdot (q - p_i)\f]
+
+where \f${DI_{p_i}}\f$ is an image gradient at one of the points \f$p_i\f$ in a neighborhood of \f$q\f$ . The
+value of \f$q\f$ is to be found so that \f$\epsilon_i\f$ is minimized. A system of equations may be set up
+with \f$\epsilon_i\f$ set to zero:
+
+\f[\sum _i(DI_{p_i}  \cdot {DI_{p_i}}^T) -  \sum _i(DI_{p_i}  \cdot {DI_{p_i}}^T  \cdot p_i)\f]
+
+where the gradients are summed within a neighborhood ("search window") of \f$q\f$ . Calling the first
+gradient term \f$G\f$ and the second gradient term \f$b\f$ gives:
+
+\f[q = G^{-1}  \cdot b\f]
+
+The algorithm sets the center of the neighborhood window at this new center \f$q\f$ and then iterates
+until the center stays within a set threshold.
+
+@param image Input image.
+@param corners Initial coordinates of the input corners and refined coordinates provided for
+output.
+@param winSize Half of the side length of the search window. For example, if winSize=Size(5,5) ,
+then a \f$5*2+1 \times 5*2+1 = 11 \times 11\f$ search window is used.
+@param zeroZone Half of the size of the dead region in the middle of the search zone over which
+the summation in the formula below is not done. It is used sometimes to avoid possible
+singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such
+a size.
+@param criteria Criteria for termination of the iterative process of corner refinement. That is,
+the process of corner position refinement stops either after criteria.maxCount iterations or when
+the corner position moves by less than criteria.epsilon on some iteration.
+ */
+CV_EXPORTS_W void cornerSubPix( InputArray image, InputOutputArray corners,
+                                Size winSize, Size zeroZone,
+                                TermCriteria criteria );
+
+/** @brief Determines strong corners on an image.
+
+The function finds the most prominent corners in the image or in the specified image region, as
+described in @cite Shi94
+
+-   Function calculates the corner quality measure at every source image pixel using the
+    cornerMinEigenVal or cornerHarris .
+-   Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are
+    retained).
+-   The corners with the minimal eigenvalue less than
+    \f$\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\f$ are rejected.
+-   The remaining corners are sorted by the quality measure in the descending order.
+-   Function throws away each corner for which there is a stronger corner at a distance less than
+    maxDistance.
+
+The function can be used to initialize a point-based tracker of an object.
+
+@note If the function is called with different values A and B of the parameter qualityLevel , and
+A \> B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector
+with qualityLevel=B .
+
+@param image Input 8-bit or floating-point 32-bit, single-channel image.
+@param corners Output vector of detected corners.
+@param maxCorners Maximum number of corners to return. If there are more corners than are found,
+the strongest of them is returned.
+@param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
+parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
+(see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the
+quality measure less than the product are rejected. For example, if the best corner has the
+quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
+less than 15 are rejected.
+@param minDistance Minimum possible Euclidean distance between the returned corners.
+@param mask Optional region of interest. If the image is not empty (it needs to have the type
+CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
+@param blockSize Size of an average block for computing a derivative covariation matrix over each
+pixel neighborhood. See cornerEigenValsAndVecs .
+@param useHarrisDetector Parameter indicating whether to use a Harris detector (see cornerHarris)
+or cornerMinEigenVal.
+@param k Free parameter of the Harris detector.
+
+@sa  cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,
+ */
+CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners,
+                                     int maxCorners, double qualityLevel, double minDistance,
+                                     InputArray mask = noArray(), int blockSize = 3,
+                                     bool useHarrisDetector = false, double k = 0.04 );
+
+/** @example houghlines.cpp
+An example using the Hough line detector
+*/
+
+/** @brief Finds lines in a binary image using the standard Hough transform.
+
+The function implements the standard or standard multi-scale Hough transform algorithm for line
+detection. See <http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm> for a good explanation of Hough
+transform.
+
+@param image 8-bit, single-channel binary source image. The image may be modified by the function.
+@param lines Output vector of lines. Each line is represented by a two-element vector
+\f$(\rho, \theta)\f$ . \f$\rho\f$ is the distance from the coordinate origin \f$(0,0)\f$ (top-left corner of
+the image). \f$\theta\f$ is the line rotation angle in radians (
+\f$0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\f$ ).
+@param rho Distance resolution of the accumulator in pixels.
+@param theta Angle resolution of the accumulator in radians.
+@param threshold Accumulator threshold parameter. Only those lines are returned that get enough
+votes ( \f$>\texttt{threshold}\f$ ).
+@param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho .
+The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
+rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
+parameters should be positive.
+@param stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
+@param min_theta For standard and multi-scale Hough transform, minimum angle to check for lines.
+Must fall between 0 and max_theta.
+@param max_theta For standard and multi-scale Hough transform, maximum angle to check for lines.
+Must fall between min_theta and CV_PI.
+ */
+CV_EXPORTS_W void HoughLines( InputArray image, OutputArray lines,
+                              double rho, double theta, int threshold,
+                              double srn = 0, double stn = 0,
+                              double min_theta = 0, double max_theta = CV_PI );
+
+/** @brief Finds line segments in a binary image using the probabilistic Hough transform.
+
+The function implements the probabilistic Hough transform algorithm for line detection, described
+in @cite Matas00
+
+See the line detection example below:
+
+@code
+    #include <opencv2/imgproc.hpp>
+    #include <opencv2/highgui.hpp>
+
+    using namespace cv;
+    using namespace std;
+
+    int main(int argc, char** argv)
+    {
+        Mat src, dst, color_dst;
+        if( argc != 2 || !(src=imread(argv[1], 0)).data)
+            return -1;
+
+        Canny( src, dst, 50, 200, 3 );
+        cvtColor( dst, color_dst, COLOR_GRAY2BGR );
+
+    #if 0
+        vector<Vec2f> lines;
+        HoughLines( dst, lines, 1, CV_PI/180, 100 );
+
+        for( size_t i = 0; i < lines.size(); i++ )
+        {
+            float rho = lines[i][0];
+            float theta = lines[i][1];
+            double a = cos(theta), b = sin(theta);
+            double x0 = a*rho, y0 = b*rho;
+            Point pt1(cvRound(x0 + 1000*(-b)),
+                      cvRound(y0 + 1000*(a)));
+            Point pt2(cvRound(x0 - 1000*(-b)),
+                      cvRound(y0 - 1000*(a)));
+            line( color_dst, pt1, pt2, Scalar(0,0,255), 3, 8 );
+        }
+    #else
+        vector<Vec4i> lines;
+        HoughLinesP( dst, lines, 1, CV_PI/180, 80, 30, 10 );
+        for( size_t i = 0; i < lines.size(); i++ )
+        {
+            line( color_dst, Point(lines[i][0], lines[i][1]),
+                Point(lines[i][2], lines[i][3]), Scalar(0,0,255), 3, 8 );
+        }
+    #endif
+        namedWindow( "Source", 1 );
+        imshow( "Source", src );
+
+        namedWindow( "Detected Lines", 1 );
+        imshow( "Detected Lines", color_dst );
+
+        waitKey(0);
+        return 0;
+    }
+@endcode
+This is a sample picture the function parameters have been tuned for:
+
+![image](pics/building.jpg)
+
+And this is the output of the above program in case of the probabilistic Hough transform:
+
+![image](pics/houghp.png)
+
+@param image 8-bit, single-channel binary source image. The image may be modified by the function.
+@param lines Output vector of lines. Each line is represented by a 4-element vector
+\f$(x_1, y_1, x_2, y_2)\f$ , where \f$(x_1,y_1)\f$ and \f$(x_2, y_2)\f$ are the ending points of each detected
+line segment.
+@param rho Distance resolution of the accumulator in pixels.
+@param theta Angle resolution of the accumulator in radians.
+@param threshold Accumulator threshold parameter. Only those lines are returned that get enough
+votes ( \f$>\texttt{threshold}\f$ ).
+@param minLineLength Minimum line length. Line segments shorter than that are rejected.
+@param maxLineGap Maximum allowed gap between points on the same line to link them.
+
+@sa LineSegmentDetector
+ */
+CV_EXPORTS_W void HoughLinesP( InputArray image, OutputArray lines,
+                               double rho, double theta, int threshold,
+                               double minLineLength = 0, double maxLineGap = 0 );
+
+/** @example houghcircles.cpp
+An example using the Hough circle detector
+*/
+
+/** @brief Finds circles in a grayscale image using the Hough transform.
+
+The function finds circles in a grayscale image using a modification of the Hough transform.
+
+Example: :
+@code
+    #include <opencv2/imgproc.hpp>
+    #include <opencv2/highgui.hpp>
+    #include <math.h>
+
+    using namespace cv;
+    using namespace std;
+
+    int main(int argc, char** argv)
+    {
+        Mat img, gray;
+        if( argc != 2 || !(img=imread(argv[1], 1)).data)
+            return -1;
+        cvtColor(img, gray, COLOR_BGR2GRAY);
+        // smooth it, otherwise a lot of false circles may be detected
+        GaussianBlur( gray, gray, Size(9, 9), 2, 2 );
+        vector<Vec3f> circles;
+        HoughCircles(gray, circles, HOUGH_GRADIENT,
+                     2, gray.rows/4, 200, 100 );
+        for( size_t i = 0; i < circles.size(); i++ )
+        {
+             Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
+             int radius = cvRound(circles[i][2]);
+             // draw the circle center
+             circle( img, center, 3, Scalar(0,255,0), -1, 8, 0 );
+             // draw the circle outline
+             circle( img, center, radius, Scalar(0,0,255), 3, 8, 0 );
+        }
+        namedWindow( "circles", 1 );
+        imshow( "circles", img );
+
+        waitKey(0);
+        return 0;
+    }
+@endcode
+
+@note Usually the function detects the centers of circles well. However, it may fail to find correct
+radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if
+you know it. Or, you may ignore the returned radius, use only the center, and find the correct
+radius using an additional procedure.
+
+@param image 8-bit, single-channel, grayscale input image.
+@param circles Output vector of found circles. Each vector is encoded as a 3-element
+floating-point vector \f$(x, y, radius)\f$ .
+@param method Detection method, see cv::HoughModes. Currently, the only implemented method is HOUGH_GRADIENT
+@param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if
+dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
+half as big width and height.
+@param minDist Minimum distance between the centers of the detected circles. If the parameter is
+too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
+too large, some circles may be missed.
+@param param1 First method-specific parameter. In case of CV_HOUGH_GRADIENT , it is the higher
+threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
+@param param2 Second method-specific parameter. In case of CV_HOUGH_GRADIENT , it is the
+accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
+false circles may be detected. Circles, corresponding to the larger accumulator values, will be
+returned first.
+@param minRadius Minimum circle radius.
+@param maxRadius Maximum circle radius.
+
+@sa fitEllipse, minEnclosingCircle
+ */
+CV_EXPORTS_W void HoughCircles( InputArray image, OutputArray circles,
+                               int method, double dp, double minDist,
+                               double param1 = 100, double param2 = 100,
+                               int minRadius = 0, int maxRadius = 0 );
+
+//! @} imgproc_feature
+
+//! @addtogroup imgproc_filter
+//! @{
+
+/** @example morphology2.cpp
+  An example using the morphological operations
+*/
+
+/** @brief Erodes an image by using a specific structuring element.
+
+The function erodes the source image using the specified structuring element that determines the
+shape of a pixel neighborhood over which the minimum is taken:
+
+\f[\texttt{dst} (x,y) =  \min _{(x',y'):  \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f]
+
+The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In
+case of multi-channel images, each channel is processed independently.
+
+@param src input image; the number of channels can be arbitrary, but the depth should be one of
+CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst output image of the same size and type as src.
+@param kernel structuring element used for erosion; if `element=Mat()`, a `3 x 3` rectangular
+structuring element is used. Kernel can be created using getStructuringElement.
+@param anchor position of the anchor within the element; default value (-1, -1) means that the
+anchor is at the element center.
+@param iterations number of times erosion is applied.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@param borderValue border value in case of a constant border
+@sa  dilate, morphologyEx, getStructuringElement
+ */
+CV_EXPORTS_W void erode( InputArray src, OutputArray dst, InputArray kernel,
+                         Point anchor = Point(-1,-1), int iterations = 1,
+                         int borderType = BORDER_CONSTANT,
+                         const Scalar& borderValue = morphologyDefaultBorderValue() );
+
+/** @brief Dilates an image by using a specific structuring element.
+
+The function dilates the source image using the specified structuring element that determines the
+shape of a pixel neighborhood over which the maximum is taken:
+\f[\texttt{dst} (x,y) =  \max _{(x',y'):  \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f]
+
+The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In
+case of multi-channel images, each channel is processed independently.
+
+@param src input image; the number of channels can be arbitrary, but the depth should be one of
+CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst output image of the same size and type as src\`.
+@param kernel structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
+structuring element is used. Kernel can be created using getStructuringElement
+@param anchor position of the anchor within the element; default value (-1, -1) means that the
+anchor is at the element center.
+@param iterations number of times dilation is applied.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@param borderValue border value in case of a constant border
+@sa  erode, morphologyEx, getStructuringElement
+ */
+CV_EXPORTS_W void dilate( InputArray src, OutputArray dst, InputArray kernel,
+                          Point anchor = Point(-1,-1), int iterations = 1,
+                          int borderType = BORDER_CONSTANT,
+                          const Scalar& borderValue = morphologyDefaultBorderValue() );
+
+/** @brief Performs advanced morphological transformations.
+
+The function morphologyEx can perform advanced morphological transformations using an erosion and dilation as
+basic operations.
+
+Any of the operations can be done in-place. In case of multi-channel images, each channel is
+processed independently.
+
+@param src Source image. The number of channels can be arbitrary. The depth should be one of
+CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst Destination image of the same size and type as source image.
+@param op Type of a morphological operation, see cv::MorphTypes
+@param kernel Structuring element. It can be created using cv::getStructuringElement.
+@param anchor Anchor position with the kernel. Negative values mean that the anchor is at the
+kernel center.
+@param iterations Number of times erosion and dilation are applied.
+@param borderType Pixel extrapolation method, see cv::BorderTypes
+@param borderValue Border value in case of a constant border. The default value has a special
+meaning.
+@sa  dilate, erode, getStructuringElement
+ */
+CV_EXPORTS_W void morphologyEx( InputArray src, OutputArray dst,
+                                int op, InputArray kernel,
+                                Point anchor = Point(-1,-1), int iterations = 1,
+                                int borderType = BORDER_CONSTANT,
+                                const Scalar& borderValue = morphologyDefaultBorderValue() );
+
+//! @} imgproc_filter
+
+//! @addtogroup imgproc_transform
+//! @{
+
+/** @brief Resizes an image.
+
+The function resize resizes the image src down to or up to the specified size. Note that the
+initial dst type or size are not taken into account. Instead, the size and type are derived from
+the `src`,`dsize`,`fx`, and `fy`. If you want to resize src so that it fits the pre-created dst,
+you may call the function as follows:
+@code
+    // explicitly specify dsize=dst.size(); fx and fy will be computed from that.
+    resize(src, dst, dst.size(), 0, 0, interpolation);
+@endcode
+If you want to decimate the image by factor of 2 in each direction, you can call the function this
+way:
+@code
+    // specify fx and fy and let the function compute the destination image size.
+    resize(src, dst, Size(), 0.5, 0.5, interpolation);
+@endcode
+To shrink an image, it will generally look best with cv::INTER_AREA interpolation, whereas to
+enlarge an image, it will generally look best with cv::INTER_CUBIC (slow) or cv::INTER_LINEAR
+(faster but still looks OK).
+
+@param src input image.
+@param dst output image; it has the size dsize (when it is non-zero) or the size computed from
+src.size(), fx, and fy; the type of dst is the same as of src.
+@param dsize output image size; if it equals zero, it is computed as:
+ \f[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\f]
+ Either dsize or both fx and fy must be non-zero.
+@param fx scale factor along the horizontal axis; when it equals 0, it is computed as
+\f[\texttt{(double)dsize.width/src.cols}\f]
+@param fy scale factor along the vertical axis; when it equals 0, it is computed as
+\f[\texttt{(double)dsize.height/src.rows}\f]
+@param interpolation interpolation method, see cv::InterpolationFlags
+
+@sa  warpAffine, warpPerspective, remap
+ */
+CV_EXPORTS_W void resize( InputArray src, OutputArray dst,
+                          Size dsize, double fx = 0, double fy = 0,
+                          int interpolation = INTER_LINEAR );
+
+/** @brief Applies an affine transformation to an image.
+
+The function warpAffine transforms the source image using the specified matrix:
+
+\f[\texttt{dst} (x,y) =  \texttt{src} ( \texttt{M} _{11} x +  \texttt{M} _{12} y +  \texttt{M} _{13}, \texttt{M} _{21} x +  \texttt{M} _{22} y +  \texttt{M} _{23})\f]
+
+when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted
+with cv::invertAffineTransform and then put in the formula above instead of M. The function cannot
+operate in-place.
+
+@param src input image.
+@param dst output image that has the size dsize and the same type as src .
+@param M \f$2\times 3\f$ transformation matrix.
+@param dsize size of the output image.
+@param flags combination of interpolation methods (see cv::InterpolationFlags) and the optional
+flag WARP_INVERSE_MAP that means that M is the inverse transformation (
+\f$\texttt{dst}\rightarrow\texttt{src}\f$ ).
+@param borderMode pixel extrapolation method (see cv::BorderTypes); when
+borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
+the "outliers" in the source image are not modified by the function.
+@param borderValue value used in case of a constant border; by default, it is 0.
+
+@sa  warpPerspective, resize, remap, getRectSubPix, transform
+ */
+CV_EXPORTS_W void warpAffine( InputArray src, OutputArray dst,
+                              InputArray M, Size dsize,
+                              int flags = INTER_LINEAR,
+                              int borderMode = BORDER_CONSTANT,
+                              const Scalar& borderValue = Scalar());
+
+/** @brief Applies a perspective transformation to an image.
+
+The function warpPerspective transforms the source image using the specified matrix:
+
+\f[\texttt{dst} (x,y) =  \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} ,
+     \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f]
+
+when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert
+and then put in the formula above instead of M. The function cannot operate in-place.
+
+@param src input image.
+@param dst output image that has the size dsize and the same type as src .
+@param M \f$3\times 3\f$ transformation matrix.
+@param dsize size of the output image.
+@param flags combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the
+optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (
+\f$\texttt{dst}\rightarrow\texttt{src}\f$ ).
+@param borderMode pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).
+@param borderValue value used in case of a constant border; by default, it equals 0.
+
+@sa  warpAffine, resize, remap, getRectSubPix, perspectiveTransform
+ */
+CV_EXPORTS_W void warpPerspective( InputArray src, OutputArray dst,
+                                   InputArray M, Size dsize,
+                                   int flags = INTER_LINEAR,
+                                   int borderMode = BORDER_CONSTANT,
+                                   const Scalar& borderValue = Scalar());
+
+/** @brief Applies a generic geometrical transformation to an image.
+
+The function remap transforms the source image using the specified map:
+
+\f[\texttt{dst} (x,y) =  \texttt{src} (map_x(x,y),map_y(x,y))\f]
+
+where values of pixels with non-integer coordinates are computed using one of available
+interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps
+in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in
+\f$map_1\f$, or fixed-point maps created by using convertMaps. The reason you might want to
+convert from floating to fixed-point representations of a map is that they can yield much faster
+(\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x),
+cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients.
+
+This function cannot operate in-place.
+
+@param src Source image.
+@param dst Destination image. It has the same size as map1 and the same type as src .
+@param map1 The first map of either (x,y) points or just x values having the type CV_16SC2 ,
+CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point
+representation to fixed-point for speed.
+@param map2 The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map
+if map1 is (x,y) points), respectively.
+@param interpolation Interpolation method (see cv::InterpolationFlags). The method INTER_AREA is
+not supported by this function.
+@param borderMode Pixel extrapolation method (see cv::BorderTypes). When
+borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image that
+corresponds to the "outliers" in the source image are not modified by the function.
+@param borderValue Value used in case of a constant border. By default, it is 0.
+ */
+CV_EXPORTS_W void remap( InputArray src, OutputArray dst,
+                         InputArray map1, InputArray map2,
+                         int interpolation, int borderMode = BORDER_CONSTANT,
+                         const Scalar& borderValue = Scalar());
+
+/** @brief Converts image transformation maps from one representation to another.
+
+The function converts a pair of maps for remap from one representation to another. The following
+options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are
+supported:
+
+- \f$\texttt{(CV\_32FC1, CV\_32FC1)} \rightarrow \texttt{(CV\_16SC2, CV\_16UC1)}\f$. This is the
+most frequently used conversion operation, in which the original floating-point maps (see remap )
+are converted to a more compact and much faster fixed-point representation. The first output array
+contains the rounded coordinates and the second array (created only when nninterpolation=false )
+contains indices in the interpolation tables.
+
+- \f$\texttt{(CV\_32FC2)} \rightarrow \texttt{(CV\_16SC2, CV\_16UC1)}\f$. The same as above but
+the original maps are stored in one 2-channel matrix.
+
+- Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same
+as the originals.
+
+@param map1 The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .
+@param map2 The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix),
+respectively.
+@param dstmap1 The first output map that has the type dstmap1type and the same size as src .
+@param dstmap2 The second output map.
+@param dstmap1type Type of the first output map that should be CV_16SC2, CV_32FC1, or
+CV_32FC2 .
+@param nninterpolation Flag indicating whether the fixed-point maps are used for the
+nearest-neighbor or for a more complex interpolation.
+
+@sa  remap, undistort, initUndistortRectifyMap
+ */
+CV_EXPORTS_W void convertMaps( InputArray map1, InputArray map2,
+                               OutputArray dstmap1, OutputArray dstmap2,
+                               int dstmap1type, bool nninterpolation = false );
+
+/** @brief Calculates an affine matrix of 2D rotation.
+
+The function calculates the following matrix:
+
+\f[\begin{bmatrix} \alpha &  \beta & (1- \alpha )  \cdot \texttt{center.x} -  \beta \cdot \texttt{center.y} \\ - \beta &  \alpha &  \beta \cdot \texttt{center.x} + (1- \alpha )  \cdot \texttt{center.y} \end{bmatrix}\f]
+
+where
+
+\f[\begin{array}{l} \alpha =  \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta =  \texttt{scale} \cdot \sin \texttt{angle} \end{array}\f]
+
+The transformation maps the rotation center to itself. If this is not the target, adjust the shift.
+
+@param center Center of the rotation in the source image.
+@param angle Rotation angle in degrees. Positive values mean counter-clockwise rotation (the
+coordinate origin is assumed to be the top-left corner).
+@param scale Isotropic scale factor.
+
+@sa  getAffineTransform, warpAffine, transform
+ */
+CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
+
+//! returns 3x3 perspective transformation for the corresponding 4 point pairs.
+CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
+
+/** @brief Calculates an affine transform from three pairs of the corresponding points.
+
+The function calculates the \f$2 \times 3\f$ matrix of an affine transform so that:
+
+\f[\begin{bmatrix} x'_i \\ y'_i \end{bmatrix} = \texttt{map\_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f]
+
+where
+
+\f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2\f]
+
+@param src Coordinates of triangle vertices in the source image.
+@param dst Coordinates of the corresponding triangle vertices in the destination image.
+
+@sa  warpAffine, transform
+ */
+CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
+
+/** @brief Inverts an affine transformation.
+
+The function computes an inverse affine transformation represented by \f$2 \times 3\f$ matrix M:
+
+\f[\begin{bmatrix} a_{11} & a_{12} & b_1  \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f]
+
+The result is also a \f$2 \times 3\f$ matrix of the same type as M.
+
+@param M Original affine transformation.
+@param iM Output reverse affine transformation.
+ */
+CV_EXPORTS_W void invertAffineTransform( InputArray M, OutputArray iM );
+
+/** @brief Calculates a perspective transform from four pairs of the corresponding points.
+
+The function calculates the \f$3 \times 3\f$ matrix of a perspective transform so that:
+
+\f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map\_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f]
+
+where
+
+\f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f]
+
+@param src Coordinates of quadrangle vertices in the source image.
+@param dst Coordinates of the corresponding quadrangle vertices in the destination image.
+
+@sa  findHomography, warpPerspective, perspectiveTransform
+ */
+CV_EXPORTS_W Mat getPerspectiveTransform( InputArray src, InputArray dst );
+
+CV_EXPORTS_W Mat getAffineTransform( InputArray src, InputArray dst );
+
+/** @brief Retrieves a pixel rectangle from an image with sub-pixel accuracy.
+
+The function getRectSubPix extracts pixels from src:
+
+\f[dst(x, y) = src(x +  \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y +  \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f]
+
+where the values of the pixels at non-integer coordinates are retrieved using bilinear
+interpolation. Every channel of multi-channel images is processed independently. While the center of
+the rectangle must be inside the image, parts of the rectangle may be outside. In this case, the
+replication border mode (see cv::BorderTypes) is used to extrapolate the pixel values outside of
+the image.
+
+@param image Source image.
+@param patchSize Size of the extracted patch.
+@param center Floating point coordinates of the center of the extracted rectangle within the
+source image. The center must be inside the image.
+@param patch Extracted patch that has the size patchSize and the same number of channels as src .
+@param patchType Depth of the extracted pixels. By default, they have the same depth as src .
+
+@sa  warpAffine, warpPerspective
+ */
+CV_EXPORTS_W void getRectSubPix( InputArray image, Size patchSize,
+                                 Point2f center, OutputArray patch, int patchType = -1 );
+
+/** @example polar_transforms.cpp
+An example using the cv::linearPolar and cv::logPolar operations
+*/
+
+/** @brief Remaps an image to log-polar space.
+
+transforms the source image using the following transformation:
+\f[dst( \phi , \rho ) = src(x,y)\f]
+where
+\f[\rho = M  \cdot \log{\sqrt{x^2 + y^2}} , \phi =atan(y/x)\f]
+
+The function emulates the human "foveal" vision and can be used for fast scale and
+rotation-invariant template matching, for object tracking and so forth. The function can not operate
+in-place.
+
+@param src Source image
+@param dst Destination image
+@param center The transformation center; where the output precision is maximal
+@param M Magnitude scale parameter.
+@param flags A combination of interpolation methods, see cv::InterpolationFlags
+ */
+CV_EXPORTS_W void logPolar( InputArray src, OutputArray dst,
+                            Point2f center, double M, int flags );
+
+/** @brief Remaps an image to polar space.
+
+transforms the source image using the following transformation:
+\f[dst( \phi , \rho ) = src(x,y)\f]
+where
+\f[\rho = (src.width/maxRadius)  \cdot \sqrt{x^2 + y^2} , \phi =atan(y/x)\f]
+
+The function can not operate in-place.
+
+@param src Source image
+@param dst Destination image
+@param center The transformation center;
+@param maxRadius Inverse magnitude scale parameter
+@param flags A combination of interpolation methods, see cv::InterpolationFlags
+ */
+CV_EXPORTS_W void linearPolar( InputArray src, OutputArray dst,
+                               Point2f center, double maxRadius, int flags );
+
+//! @} imgproc_transform
+
+//! @addtogroup imgproc_misc
+//! @{
+
+/** @overload */
+CV_EXPORTS_W void integral( InputArray src, OutputArray sum, int sdepth = -1 );
+
+/** @overload */
+CV_EXPORTS_AS(integral2) void integral( InputArray src, OutputArray sum,
+                                        OutputArray sqsum, int sdepth = -1, int sqdepth = -1 );
+
+/** @brief Calculates the integral of an image.
+
+The functions calculate one or more integral images for the source image as follows:
+
+\f[\texttt{sum} (X,Y) =  \sum _{x<X,y<Y}  \texttt{image} (x,y)\f]
+
+\f[\texttt{sqsum} (X,Y) =  \sum _{x<X,y<Y}  \texttt{image} (x,y)^2\f]
+
+\f[\texttt{tilted} (X,Y) =  \sum _{y<Y,abs(x-X+1) \leq Y-y-1}  \texttt{image} (x,y)\f]
+
+Using these integral images, you can calculate sum, mean, and standard deviation over a specific
+up-right or rotated rectangular region of the image in a constant time, for example:
+
+\f[\sum _{x_1 \leq x < x_2,  \, y_1  \leq y < y_2}  \texttt{image} (x,y) =  \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\f]
+
+It makes possible to do a fast blurring or fast block correlation with a variable window size, for
+example. In case of multi-channel images, sums for each channel are accumulated independently.
+
+As a practical example, the next figure shows the calculation of the integral of a straight
+rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the
+original image are shown, as well as the relative pixels in the integral images sum and tilted .
+
+![integral calculation example](pics/integral.png)
+
+@param src input image as \f$W \times H\f$, 8-bit or floating-point (32f or 64f).
+@param sum integral image as \f$(W+1)\times (H+1)\f$ , 32-bit integer or floating-point (32f or 64f).
+@param sqsum integral image for squared pixel values; it is \f$(W+1)\times (H+1)\f$, double-precision
+floating-point (64f) array.
+@param tilted integral for the image rotated by 45 degrees; it is \f$(W+1)\times (H+1)\f$ array with
+the same data type as sum.
+@param sdepth desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or
+CV_64F.
+@param sqdepth desired depth of the integral image of squared pixel values, CV_32F or CV_64F.
+ */
+CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum,
+                                        OutputArray sqsum, OutputArray tilted,
+                                        int sdepth = -1, int sqdepth = -1 );
+
+//! @} imgproc_misc
+
+//! @addtogroup imgproc_motion
+//! @{
+
+/** @brief Adds an image to the accumulator.
+
+The function adds src or some of its elements to dst :
+
+\f[\texttt{dst} (x,y)  \leftarrow \texttt{dst} (x,y) +  \texttt{src} (x,y)  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0\f]
+
+The function supports multi-channel images. Each channel is processed independently.
+
+The functions accumulate\* can be used, for example, to collect statistics of a scene background
+viewed by a still camera and for the further foreground-background segmentation.
+
+@param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
+@param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
+floating-point.
+@param mask Optional operation mask.
+
+@sa  accumulateSquare, accumulateProduct, accumulateWeighted
+ */
+CV_EXPORTS_W void accumulate( InputArray src, InputOutputArray dst,
+                              InputArray mask = noArray() );
+
+/** @brief Adds the square of a source image to the accumulator.
+
+The function adds the input image src or its selected region, raised to a power of 2, to the
+accumulator dst :
+
+\f[\texttt{dst} (x,y)  \leftarrow \texttt{dst} (x,y) +  \texttt{src} (x,y)^2  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0\f]
+
+The function supports multi-channel images. Each channel is processed independently.
+
+@param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
+@param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
+floating-point.
+@param mask Optional operation mask.
+
+@sa  accumulateSquare, accumulateProduct, accumulateWeighted
+ */
+CV_EXPORTS_W void accumulateSquare( InputArray src, InputOutputArray dst,
+                                    InputArray mask = noArray() );
+
+/** @brief Adds the per-element product of two input images to the accumulator.
+
+The function adds the product of two images or their selected regions to the accumulator dst :
+
+\f[\texttt{dst} (x,y)  \leftarrow \texttt{dst} (x,y) +  \texttt{src1} (x,y)  \cdot \texttt{src2} (x,y)  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0\f]
+
+The function supports multi-channel images. Each channel is processed independently.
+
+@param src1 First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
+@param src2 Second input image of the same type and the same size as src1 .
+@param dst %Accumulator with the same number of channels as input images, 32-bit or 64-bit
+floating-point.
+@param mask Optional operation mask.
+
+@sa  accumulate, accumulateSquare, accumulateWeighted
+ */
+CV_EXPORTS_W void accumulateProduct( InputArray src1, InputArray src2,
+                                     InputOutputArray dst, InputArray mask=noArray() );
+
+/** @brief Updates a running average.
+
+The function calculates the weighted sum of the input image src and the accumulator dst so that dst
+becomes a running average of a frame sequence:
+
+\f[\texttt{dst} (x,y)  \leftarrow (1- \texttt{alpha} )  \cdot \texttt{dst} (x,y) +  \texttt{alpha} \cdot \texttt{src} (x,y)  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0\f]
+
+That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images).
+The function supports multi-channel images. Each channel is processed independently.
+
+@param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
+@param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
+floating-point.
+@param alpha Weight of the input image.
+@param mask Optional operation mask.
+
+@sa  accumulate, accumulateSquare, accumulateProduct
+ */
+CV_EXPORTS_W void accumulateWeighted( InputArray src, InputOutputArray dst,
+                                      double alpha, InputArray mask = noArray() );
+
+/** @brief The function is used to detect translational shifts that occur between two images.
+
+The operation takes advantage of the Fourier shift theorem for detecting the translational shift in
+the frequency domain. It can be used for fast image registration as well as motion estimation. For
+more information please see <http://en.wikipedia.org/wiki/Phase_correlation>
+
+Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed
+with getOptimalDFTSize.
+
+The function performs the following equations:
+- First it applies a Hanning window (see <http://en.wikipedia.org/wiki/Hann_function>) to each
+image to remove possible edge effects. This window is cached until the array size changes to speed
+up processing time.
+- Next it computes the forward DFTs of each source array:
+\f[\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\f]
+where \f$\mathcal{F}\f$ is the forward DFT.
+- It then computes the cross-power spectrum of each frequency domain array:
+\f[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\f]
+- Next the cross-correlation is converted back into the time domain via the inverse DFT:
+\f[r = \mathcal{F}^{-1}\{R\}\f]
+- Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to
+achieve sub-pixel accuracy.
+\f[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\f]
+- If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5
+centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single
+peak) and will be smaller when there are multiple peaks.
+
+@param src1 Source floating point array (CV_32FC1 or CV_64FC1)
+@param src2 Source floating point array (CV_32FC1 or CV_64FC1)
+@param window Floating point array with windowing coefficients to reduce edge effects (optional).
+@param response Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional).
+@returns detected phase shift (sub-pixel) between the two arrays.
+
+@sa dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow
+ */
+CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2,
+                                    InputArray window = noArray(), CV_OUT double* response = 0);
+
+/** @brief This function computes a Hanning window coefficients in two dimensions.
+
+See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function)
+for more information.
+
+An example is shown below:
+@code
+    // create hanning window of size 100x100 and type CV_32F
+    Mat hann;
+    createHanningWindow(hann, Size(100, 100), CV_32F);
+@endcode
+@param dst Destination array to place Hann coefficients in
+@param winSize The window size specifications
+@param type Created array type
+ */
+CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type);
+
+//! @} imgproc_motion
+
+//! @addtogroup imgproc_misc
+//! @{
+
+/** @brief Applies a fixed-level threshold to each array element.
+
+The function applies fixed-level thresholding to a single-channel array. The function is typically
+used to get a bi-level (binary) image out of a grayscale image ( cv::compare could be also used for
+this purpose) or for removing a noise, that is, filtering out pixels with too small or too large
+values. There are several types of thresholding supported by the function. They are determined by
+type parameter.
+
+Also, the special values cv::THRESH_OTSU or cv::THRESH_TRIANGLE may be combined with one of the
+above values. In these cases, the function determines the optimal threshold value using the Otsu's
+or Triangle algorithm and uses it instead of the specified thresh . The function returns the
+computed threshold value. Currently, the Otsu's and Triangle methods are implemented only for 8-bit
+images.
+
+@param src input array (single-channel, 8-bit or 32-bit floating point).
+@param dst output array of the same size and type as src.
+@param thresh threshold value.
+@param maxval maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding
+types.
+@param type thresholding type (see the cv::ThresholdTypes).
+
+@sa  adaptiveThreshold, findContours, compare, min, max
+ */
+CV_EXPORTS_W double threshold( InputArray src, OutputArray dst,
+                               double thresh, double maxval, int type );
+
+
+/** @brief Applies an adaptive threshold to an array.
+
+The function transforms a grayscale image to a binary image according to the formulae:
+-   **THRESH_BINARY**
+    \f[dst(x,y) =  \fork{\texttt{maxValue}}{if \(src(x,y) > T(x,y)\)}{0}{otherwise}\f]
+-   **THRESH_BINARY_INV**
+    \f[dst(x,y) =  \fork{0}{if \(src(x,y) > T(x,y)\)}{\texttt{maxValue}}{otherwise}\f]
+where \f$T(x,y)\f$ is a threshold calculated individually for each pixel (see adaptiveMethod parameter).
+
+The function can process the image in-place.
+
+@param src Source 8-bit single-channel image.
+@param dst Destination image of the same size and the same type as src.
+@param maxValue Non-zero value assigned to the pixels for which the condition is satisfied
+@param adaptiveMethod Adaptive thresholding algorithm to use, see cv::AdaptiveThresholdTypes
+@param thresholdType Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV,
+see cv::ThresholdTypes.
+@param blockSize Size of a pixel neighborhood that is used to calculate a threshold value for the
+pixel: 3, 5, 7, and so on.
+@param C Constant subtracted from the mean or weighted mean (see the details below). Normally, it
+is positive but may be zero or negative as well.
+
+@sa  threshold, blur, GaussianBlur
+ */
+CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst,
+                                     double maxValue, int adaptiveMethod,
+                                     int thresholdType, int blockSize, double C );
+
+//! @} imgproc_misc
+
+//! @addtogroup imgproc_filter
+//! @{
+
+/** @brief Blurs an image and downsamples it.
+
+By default, size of the output image is computed as `Size((src.cols+1)/2, (src.rows+1)/2)`, but in
+any case, the following conditions should be satisfied:
+
+\f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f]
+
+The function performs the downsampling step of the Gaussian pyramid construction. First, it
+convolves the source image with the kernel:
+
+\f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1  \\ 4 & 16 & 24 & 16 & 4  \\ 6 & 24 & 36 & 24 & 6  \\ 4 & 16 & 24 & 16 & 4  \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f]
+
+Then, it downsamples the image by rejecting even rows and columns.
+
+@param src input image.
+@param dst output image; it has the specified size and the same type as src.
+@param dstsize size of the output image.
+@param borderType Pixel extrapolation method, see cv::BorderTypes (BORDER_CONSTANT isn't supported)
+ */
+CV_EXPORTS_W void pyrDown( InputArray src, OutputArray dst,
+                           const Size& dstsize = Size(), int borderType = BORDER_DEFAULT );
+
+/** @brief Upsamples an image and then blurs it.
+
+By default, size of the output image is computed as `Size(src.cols\*2, (src.rows\*2)`, but in any
+case, the following conditions should be satisfied:
+
+\f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq  ( \texttt{dstsize.width}   \mod  2)  \\ | \texttt{dstsize.height} -src.rows*2| \leq  ( \texttt{dstsize.height}   \mod  2) \end{array}\f]
+
+The function performs the upsampling step of the Gaussian pyramid construction, though it can
+actually be used to construct the Laplacian pyramid. First, it upsamples the source image by
+injecting even zero rows and columns and then convolves the result with the same kernel as in
+pyrDown multiplied by 4.
+
+@param src input image.
+@param dst output image. It has the specified size and the same type as src .
+@param dstsize size of the output image.
+@param borderType Pixel extrapolation method, see cv::BorderTypes (only BORDER_DEFAULT is supported)
+ */
+CV_EXPORTS_W void pyrUp( InputArray src, OutputArray dst,
+                         const Size& dstsize = Size(), int borderType = BORDER_DEFAULT );
+
+/** @brief Constructs the Gaussian pyramid for an image.
+
+The function constructs a vector of images and builds the Gaussian pyramid by recursively applying
+pyrDown to the previously built pyramid layers, starting from `dst[0]==src`.
+
+@param src Source image. Check pyrDown for the list of supported types.
+@param dst Destination vector of maxlevel+1 images of the same type as src. dst[0] will be the
+same as src. dst[1] is the next pyramid layer, a smoothed and down-sized src, and so on.
+@param maxlevel 0-based index of the last (the smallest) pyramid layer. It must be non-negative.
+@param borderType Pixel extrapolation method, see cv::BorderTypes (BORDER_CONSTANT isn't supported)
+ */
+CV_EXPORTS void buildPyramid( InputArray src, OutputArrayOfArrays dst,
+                              int maxlevel, int borderType = BORDER_DEFAULT );
+
+//! @} imgproc_filter
+
+//! @addtogroup imgproc_transform
+//! @{
+
+/** @brief Transforms an image to compensate for lens distortion.
+
+The function transforms an image to compensate radial and tangential lens distortion.
+
+The function is simply a combination of cv::initUndistortRectifyMap (with unity R ) and cv::remap
+(with bilinear interpolation). See the former function for details of the transformation being
+performed.
+
+Those pixels in the destination image, for which there is no correspondent pixels in the source
+image, are filled with zeros (black color).
+
+A particular subset of the source image that will be visible in the corrected image can be regulated
+by newCameraMatrix. You can use cv::getOptimalNewCameraMatrix to compute the appropriate
+newCameraMatrix depending on your requirements.
+
+The camera matrix and the distortion parameters can be determined using cv::calibrateCamera. If
+the resolution of images is different from the resolution used at the calibration stage, \f$f_x,
+f_y, c_x\f$ and \f$c_y\f$ need to be scaled accordingly, while the distortion coefficients remain
+the same.
+
+@param src Input (distorted) image.
+@param dst Output (corrected) image that has the same size and type as src .
+@param cameraMatrix Input camera matrix \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$
+of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
+@param newCameraMatrix Camera matrix of the distorted image. By default, it is the same as
+cameraMatrix but you may additionally scale and shift the result by using a different matrix.
+ */
+CV_EXPORTS_W void undistort( InputArray src, OutputArray dst,
+                             InputArray cameraMatrix,
+                             InputArray distCoeffs,
+                             InputArray newCameraMatrix = noArray() );
+
+/** @brief Computes the undistortion and rectification transformation map.
+
+The function computes the joint undistortion and rectification transformation and represents the
+result in the form of maps for remap. The undistorted image looks like original, as if it is
+captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a
+monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by
+cv::getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera,
+newCameraMatrix is normally set to P1 or P2 computed by cv::stereoRectify .
+
+Also, this new camera is oriented differently in the coordinate space, according to R. That, for
+example, helps to align two heads of a stereo camera so that the epipolar lines on both images
+become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera).
+
+The function actually builds the maps for the inverse mapping algorithm that is used by remap. That
+is, for each pixel \f$(u, v)\f$ in the destination (corrected and rectified) image, the function
+computes the corresponding coordinates in the source image (that is, in the original image from
+camera). The following process is applied:
+\f[
+\begin{array}{l}
+x  \leftarrow (u - {c'}_x)/{f'}_x  \\
+y  \leftarrow (v - {c'}_y)/{f'}_y  \\
+{[X\,Y\,W]} ^T  \leftarrow R^{-1}*[x \, y \, 1]^T  \\
+x'  \leftarrow X/W  \\
+y'  \leftarrow Y/W  \\
+r^2  \leftarrow x'^2 + y'^2 \\
+x''  \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}
++ 2p_1 x' y' + p_2(r^2 + 2 x'^2)  + s_1 r^2 + s_2 r^4\\
+y''  \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}
++ p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\
+s\vecthree{x'''}{y'''}{1} =
+\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)}
+{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)}
+{0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\
+map_x(u,v)  \leftarrow x''' f_x + c_x  \\
+map_y(u,v)  \leftarrow y''' f_y + c_y
+\end{array}
+\f]
+where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$
+are the distortion coefficients.
+
+In case of a stereo camera, this function is called twice: once for each camera head, after
+stereoRectify, which in its turn is called after cv::stereoCalibrate. But if the stereo camera
+was not calibrated, it is still possible to compute the rectification transformations directly from
+the fundamental matrix using cv::stereoRectifyUncalibrated. For each camera, the function computes
+homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D
+space. R can be computed from H as
+\f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f]
+where cameraMatrix can be chosen arbitrarily.
+
+@param cameraMatrix Input camera matrix \f$A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$
+of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
+@param R Optional rectification transformation in the object space (3x3 matrix). R1 or R2 ,
+computed by stereoRectify can be passed here. If the matrix is empty, the identity transformation
+is assumed. In cvInitUndistortMap R assumed to be an identity matrix.
+@param newCameraMatrix New camera matrix \f$A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}\f$.
+@param size Undistorted image size.
+@param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2, see cv::convertMaps
+@param map1 The first output map.
+@param map2 The second output map.
+ */
+CV_EXPORTS_W void initUndistortRectifyMap( InputArray cameraMatrix, InputArray distCoeffs,
+                           InputArray R, InputArray newCameraMatrix,
+                           Size size, int m1type, OutputArray map1, OutputArray map2 );
+
+//! initializes maps for cv::remap() for wide-angle
+CV_EXPORTS_W float initWideAngleProjMap( InputArray cameraMatrix, InputArray distCoeffs,
+                                         Size imageSize, int destImageWidth,
+                                         int m1type, OutputArray map1, OutputArray map2,
+                                         int projType = PROJ_SPHERICAL_EQRECT, double alpha = 0);
+
+/** @brief Returns the default new camera matrix.
+
+The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when
+centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true).
+
+In the latter case, the new camera matrix will be:
+
+\f[\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5  \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5  \\ 0 && 0 && 1 \end{bmatrix} ,\f]
+
+where \f$f_x\f$ and \f$f_y\f$ are \f$(0,0)\f$ and \f$(1,1)\f$ elements of cameraMatrix, respectively.
+
+By default, the undistortion functions in OpenCV (see initUndistortRectifyMap, undistort) do not
+move the principal point. However, when you work with stereo, it is important to move the principal
+points in both views to the same y-coordinate (which is required by most of stereo correspondence
+algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for
+each view where the principal points are located at the center.
+
+@param cameraMatrix Input camera matrix.
+@param imgsize Camera view image size in pixels.
+@param centerPrincipalPoint Location of the principal point in the new camera matrix. The
+parameter indicates whether this location should be at the image center or not.
+ */
+CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsize = Size(),
+                                            bool centerPrincipalPoint = false );
+
+/** @brief Computes the ideal point coordinates from the observed point coordinates.
+
+The function is similar to cv::undistort and cv::initUndistortRectifyMap but it operates on a
+sparse set of points instead of a raster image. Also the function performs a reverse transformation
+to projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a
+planar object, it does, up to a translation vector, if the proper R is specified.
+@code
+    // (u,v) is the input point, (u', v') is the output point
+    // camera_matrix=[fx 0 cx; 0 fy cy; 0 0 1]
+    // P=[fx' 0 cx' tx; 0 fy' cy' ty; 0 0 1 tz]
+    x" = (u - cx)/fx
+    y" = (v - cy)/fy
+    (x',y') = undistort(x",y",dist_coeffs)
+    [X,Y,W]T = R*[x' y' 1]T
+    x = X/W, y = Y/W
+    // only performed if P=[fx' 0 cx' [tx]; 0 fy' cy' [ty]; 0 0 1 [tz]] is specified
+    u' = x*fx' + cx'
+    v' = y*fy' + cy',
+@endcode
+where cv::undistort is an approximate iterative algorithm that estimates the normalized original
+point coordinates out of the normalized distorted point coordinates ("normalized" means that the
+coordinates do not depend on the camera matrix).
+
+The function can be used for both a stereo camera head or a monocular camera (when R is empty).
+
+@param src Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2).
+@param dst Output ideal point coordinates after undistortion and reverse perspective
+transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.
+@param cameraMatrix Camera matrix \f$\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$
+of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
+@param R Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by
+cv::stereoRectify can be passed here. If the matrix is empty, the identity transformation is used.
+@param P New camera matrix (3x3) or new projection matrix (3x4). P1 or P2 computed by
+cv::stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used.
+ */
+CV_EXPORTS_W void undistortPoints( InputArray src, OutputArray dst,
+                                   InputArray cameraMatrix, InputArray distCoeffs,
+                                   InputArray R = noArray(), InputArray P = noArray());
+
+//! @} imgproc_transform
+
+//! @addtogroup imgproc_hist
+//! @{
+
+/** @example demhist.cpp
+An example for creating histograms of an image
+*/
+
+/** @brief Calculates a histogram of a set of arrays.
+
+The functions calcHist calculate the histogram of one or more arrays. The elements of a tuple used
+to increment a histogram bin are taken from the corresponding input arrays at the same location. The
+sample below shows how to compute a 2D Hue-Saturation histogram for a color image. :
+@code
+    #include <opencv2/imgproc.hpp>
+    #include <opencv2/highgui.hpp>
+
+    using namespace cv;
+
+    int main( int argc, char** argv )
+    {
+        Mat src, hsv;
+        if( argc != 2 || !(src=imread(argv[1], 1)).data )
+            return -1;
+
+        cvtColor(src, hsv, COLOR_BGR2HSV);
+
+        // Quantize the hue to 30 levels
+        // and the saturation to 32 levels
+        int hbins = 30, sbins = 32;
+        int histSize[] = {hbins, sbins};
+        // hue varies from 0 to 179, see cvtColor
+        float hranges[] = { 0, 180 };
+        // saturation varies from 0 (black-gray-white) to
+        // 255 (pure spectrum color)
+        float sranges[] = { 0, 256 };
+        const float* ranges[] = { hranges, sranges };
+        MatND hist;
+        // we compute the histogram from the 0-th and 1-st channels
+        int channels[] = {0, 1};
+
+        calcHist( &hsv, 1, channels, Mat(), // do not use mask
+                 hist, 2, histSize, ranges,
+                 true, // the histogram is uniform
+                 false );
+        double maxVal=0;
+        minMaxLoc(hist, 0, &maxVal, 0, 0);
+
+        int scale = 10;
+        Mat histImg = Mat::zeros(sbins*scale, hbins*10, CV_8UC3);
+
+        for( int h = 0; h < hbins; h++ )
+            for( int s = 0; s < sbins; s++ )
+            {
+                float binVal = hist.at<float>(h, s);
+                int intensity = cvRound(binVal*255/maxVal);
+                rectangle( histImg, Point(h*scale, s*scale),
+                            Point( (h+1)*scale - 1, (s+1)*scale - 1),
+                            Scalar::all(intensity),
+                            CV_FILLED );
+            }
+
+        namedWindow( "Source", 1 );
+        imshow( "Source", src );
+
+        namedWindow( "H-S Histogram", 1 );
+        imshow( "H-S Histogram", histImg );
+        waitKey();
+    }
+@endcode
+
+@param images Source arrays. They all should have the same depth, CV_8U or CV_32F , and the same
+size. Each of them can have an arbitrary number of channels.
+@param nimages Number of source images.
+@param channels List of the dims channels used to compute the histogram. The first array channels
+are numerated from 0 to images[0].channels()-1 , the second array channels are counted from
+images[0].channels() to images[0].channels() + images[1].channels()-1, and so on.
+@param mask Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size
+as images[i] . The non-zero mask elements mark the array elements counted in the histogram.
+@param hist Output histogram, which is a dense or sparse dims -dimensional array.
+@param dims Histogram dimensionality that must be positive and not greater than CV_MAX_DIMS
+(equal to 32 in the current OpenCV version).
+@param histSize Array of histogram sizes in each dimension.
+@param ranges Array of the dims arrays of the histogram bin boundaries in each dimension. When the
+histogram is uniform ( uniform =true), then for each dimension i it is enough to specify the lower
+(inclusive) boundary \f$L_0\f$ of the 0-th histogram bin and the upper (exclusive) boundary
+\f$U_{\texttt{histSize}[i]-1}\f$ for the last histogram bin histSize[i]-1 . That is, in case of a
+uniform histogram each of ranges[i] is an array of 2 elements. When the histogram is not uniform (
+uniform=false ), then each of ranges[i] contains histSize[i]+1 elements:
+\f$L_0, U_0=L_1, U_1=L_2, ..., U_{\texttt{histSize[i]}-2}=L_{\texttt{histSize[i]}-1}, U_{\texttt{histSize[i]}-1}\f$
+. The array elements, that are not between \f$L_0\f$ and \f$U_{\texttt{histSize[i]}-1}\f$ , are not
+counted in the histogram.
+@param uniform Flag indicating whether the histogram is uniform or not (see above).
+@param accumulate Accumulation flag. If it is set, the histogram is not cleared in the beginning
+when it is allocated. This feature enables you to compute a single histogram from several sets of
+arrays, or to update the histogram in time.
+*/
+CV_EXPORTS void calcHist( const Mat* images, int nimages,
+                          const int* channels, InputArray mask,
+                          OutputArray hist, int dims, const int* histSize,
+                          const float** ranges, bool uniform = true, bool accumulate = false );
+
+/** @overload
+
+this variant uses cv::SparseMat for output
+*/
+CV_EXPORTS void calcHist( const Mat* images, int nimages,
+                          const int* channels, InputArray mask,
+                          SparseMat& hist, int dims,
+                          const int* histSize, const float** ranges,
+                          bool uniform = true, bool accumulate = false );
+
+/** @overload */
+CV_EXPORTS_W void calcHist( InputArrayOfArrays images,
+                            const std::vector<int>& channels,
+                            InputArray mask, OutputArray hist,
+                            const std::vector<int>& histSize,
+                            const std::vector<float>& ranges,
+                            bool accumulate = false );
+
+/** @brief Calculates the back projection of a histogram.
+
+The functions calcBackProject calculate the back project of the histogram. That is, similarly to
+cv::calcHist , at each location (x, y) the function collects the values from the selected channels
+in the input images and finds the corresponding histogram bin. But instead of incrementing it, the
+function reads the bin value, scales it by scale , and stores in backProject(x,y) . In terms of
+statistics, the function computes probability of each element value in respect with the empirical
+probability distribution represented by the histogram. See how, for example, you can find and track
+a bright-colored object in a scene:
+
+- Before tracking, show the object to the camera so that it covers almost the whole frame.
+Calculate a hue histogram. The histogram may have strong maximums, corresponding to the dominant
+colors in the object.
+
+- When tracking, calculate a back projection of a hue plane of each input video frame using that
+pre-computed histogram. Threshold the back projection to suppress weak colors. It may also make
+sense to suppress pixels with non-sufficient color saturation and too dark or too bright pixels.
+
+- Find connected components in the resulting picture and choose, for example, the largest
+component.
+
+This is an approximate algorithm of the CamShift color object tracker.
+
+@param images Source arrays. They all should have the same depth, CV_8U or CV_32F , and the same
+size. Each of them can have an arbitrary number of channels.
+@param nimages Number of source images.
+@param channels The list of channels used to compute the back projection. The number of channels
+must match the histogram dimensionality. The first array channels are numerated from 0 to
+images[0].channels()-1 , the second array channels are counted from images[0].channels() to
+images[0].channels() + images[1].channels()-1, and so on.
+@param hist Input histogram that can be dense or sparse.
+@param backProject Destination back projection array that is a single-channel array of the same
+size and depth as images[0] .
+@param ranges Array of arrays of the histogram bin boundaries in each dimension. See calcHist .
+@param scale Optional scale factor for the output back projection.
+@param uniform Flag indicating whether the histogram is uniform or not (see above).
+
+@sa cv::calcHist, cv::compareHist
+ */
+CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
+                                 const int* channels, InputArray hist,
+                                 OutputArray backProject, const float** ranges,
+                                 double scale = 1, bool uniform = true );
+
+/** @overload */
+CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
+                                 const int* channels, const SparseMat& hist,
+                                 OutputArray backProject, const float** ranges,
+                                 double scale = 1, bool uniform = true );
+
+/** @overload */
+CV_EXPORTS_W void calcBackProject( InputArrayOfArrays images, const std::vector<int>& channels,
+                                   InputArray hist, OutputArray dst,
+                                   const std::vector<float>& ranges,
+                                   double scale );
+
+/** @brief Compares two histograms.
+
+The function compare two dense or two sparse histograms using the specified method.
+
+The function returns \f$d(H_1, H_2)\f$ .
+
+While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable
+for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling
+problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms
+or more general sparse configurations of weighted points, consider using the cv::EMD function.
+
+@param H1 First compared histogram.
+@param H2 Second compared histogram of the same size as H1 .
+@param method Comparison method, see cv::HistCompMethods
+ */
+CV_EXPORTS_W double compareHist( InputArray H1, InputArray H2, int method );
+
+/** @overload */
+CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
+
+/** @brief Equalizes the histogram of a grayscale image.
+
+The function equalizes the histogram of the input image using the following algorithm:
+
+- Calculate the histogram \f$H\f$ for src .
+- Normalize the histogram so that the sum of histogram bins is 255.
+- Compute the integral of the histogram:
+\f[H'_i =  \sum _{0  \le j < i} H(j)\f]
+- Transform the image using \f$H'\f$ as a look-up table: \f$\texttt{dst}(x,y) = H'(\texttt{src}(x,y))\f$
+
+The algorithm normalizes the brightness and increases the contrast of the image.
+
+@param src Source 8-bit single channel image.
+@param dst Destination image of the same size and type as src .
+ */
+CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
+
+/** @brief Computes the "minimal work" distance between two weighted point configurations.
+
+The function computes the earth mover distance and/or a lower boundary of the distance between the
+two weighted point configurations. One of the applications described in @cite RubnerSept98,
+@cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation
+problem that is solved using some modification of a simplex algorithm, thus the complexity is
+exponential in the worst case, though, on average it is much faster. In the case of a real metric
+the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used
+to determine roughly whether the two signatures are far enough so that they cannot relate to the
+same object.
+
+@param signature1 First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix.
+Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
+a single column (weights only) if the user-defined cost matrix is used.
+@param signature2 Second signature of the same format as signature1 , though the number of rows
+may be different. The total weights may be different. In this case an extra "dummy" point is added
+to either signature1 or signature2 .
+@param distType Used metric. See cv::DistanceTypes.
+@param cost User-defined \f$\texttt{size1}\times \texttt{size2}\f$ cost matrix. Also, if a cost matrix
+is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
+@param lowerBound Optional input/output parameter: lower boundary of a distance between the two
+signatures that is a distance between mass centers. The lower boundary may not be calculated if
+the user-defined cost matrix is used, the total weights of point configurations are not equal, or
+if the signatures consist of weights only (the signature matrices have a single column). You
+**must** initialize \*lowerBound . If the calculated distance between mass centers is greater or
+equal to \*lowerBound (it means that the signatures are far enough), the function does not
+calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
+return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
+should be set to 0.
+@param flow Resultant \f$\texttt{size1} \times \texttt{size2}\f$ flow matrix: \f$\texttt{flow}_{i,j}\f$ is
+a flow from \f$i\f$ -th point of signature1 to \f$j\f$ -th point of signature2 .
+ */
+CV_EXPORTS float EMD( InputArray signature1, InputArray signature2,
+                      int distType, InputArray cost=noArray(),
+                      float* lowerBound = 0, OutputArray flow = noArray() );
+
+//! @} imgproc_hist
+
+/** @example watershed.cpp
+An example using the watershed algorithm
+ */
+
+/** @brief Performs a marker-based image segmentation using the watershed algorithm.
+
+The function implements one of the variants of watershed, non-parametric marker-based segmentation
+algorithm, described in @cite Meyer92 .
+
+Before passing the image to the function, you have to roughly outline the desired regions in the
+image markers with positive (\>0) indices. So, every region is represented as one or more connected
+components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary
+mask using findContours and drawContours (see the watershed.cpp demo). The markers are "seeds" of
+the future image regions. All the other pixels in markers , whose relation to the outlined regions
+is not known and should be defined by the algorithm, should be set to 0's. In the function output,
+each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the
+regions.
+
+@note Any two neighbor connected components are not necessarily separated by a watershed boundary
+(-1's pixels); for example, they can touch each other in the initial marker image passed to the
+function.
+
+@param image Input 8-bit 3-channel image.
+@param markers Input/output 32-bit single-channel image (map) of markers. It should have the same
+size as image .
+
+@sa findContours
+
+@ingroup imgproc_misc
+ */
+CV_EXPORTS_W void watershed( InputArray image, InputOutputArray markers );
+
+//! @addtogroup imgproc_filter
+//! @{
+
+/** @brief Performs initial step of meanshift segmentation of an image.
+
+The function implements the filtering stage of meanshift segmentation, that is, the output of the
+function is the filtered "posterized" image with color gradients and fine-grain texture flattened.
+At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes
+meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is
+considered:
+
+\f[(x,y): X- \texttt{sp} \le x  \le X+ \texttt{sp} , Y- \texttt{sp} \le y  \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)||   \le \texttt{sr}\f]
+
+where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively
+(though, the algorithm does not depend on the color space used, so any 3-component color space can
+be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector
+(R',G',B') are found and they act as the neighborhood center on the next iteration:
+
+\f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f]
+
+After the iterations over, the color components of the initial pixel (that is, the pixel from where
+the iterations started) are set to the final value (average color at the last iteration):
+
+\f[I(X,Y) <- (R*,G*,B*)\f]
+
+When maxLevel \> 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is
+run on the smallest layer first. After that, the results are propagated to the larger layer and the
+iterations are run again only on those pixels where the layer colors differ by more than sr from the
+lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the
+results will be actually different from the ones obtained by running the meanshift procedure on the
+whole original image (i.e. when maxLevel==0).
+
+@param src The source 8-bit, 3-channel image.
+@param dst The destination image of the same format and the same size as the source.
+@param sp The spatial window radius.
+@param sr The color window radius.
+@param maxLevel Maximum level of the pyramid for the segmentation.
+@param termcrit Termination criteria: when to stop meanshift iterations.
+ */
+CV_EXPORTS_W void pyrMeanShiftFiltering( InputArray src, OutputArray dst,
+                                         double sp, double sr, int maxLevel = 1,
+                                         TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
+
+//! @}
+
+//! @addtogroup imgproc_misc
+//! @{
+
+/** @example grabcut.cpp
+An example using the GrabCut algorithm
+ */
+
+/** @brief Runs the GrabCut algorithm.
+
+The function implements the [GrabCut image segmentation algorithm](http://en.wikipedia.org/wiki/GrabCut).
+
+@param img Input 8-bit 3-channel image.
+@param mask Input/output 8-bit single-channel mask. The mask is initialized by the function when
+mode is set to GC_INIT_WITH_RECT. Its elements may have one of the cv::GrabCutClasses.
+@param rect ROI containing a segmented object. The pixels outside of the ROI are marked as
+"obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT .
+@param bgdModel Temporary array for the background model. Do not modify it while you are
+processing the same image.
+@param fgdModel Temporary arrays for the foreground model. Do not modify it while you are
+processing the same image.
+@param iterCount Number of iterations the algorithm should make before returning the result. Note
+that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or
+mode==GC_EVAL .
+@param mode Operation mode that could be one of the cv::GrabCutModes
+ */
+CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect,
+                           InputOutputArray bgdModel, InputOutputArray fgdModel,
+                           int iterCount, int mode = GC_EVAL );
+
+/** @example distrans.cpp
+An example on using the distance transform\
+*/
+
+
+/** @brief Calculates the distance to the closest zero pixel for each pixel of the source image.
+
+The functions distanceTransform calculate the approximate or precise distance from every binary
+image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero.
+
+When maskSize == DIST_MASK_PRECISE and distanceType == DIST_L2 , the function runs the
+algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library.
+
+In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function
+finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical,
+diagonal, or knight's move (the latest is available for a \f$5\times 5\f$ mask). The overall
+distance is calculated as a sum of these basic distances. Since the distance function should be
+symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all
+the diagonal shifts must have the same cost (denoted as `b`), and all knight's moves must have the
+same cost (denoted as `c`). For the cv::DIST_C and cv::DIST_L1 types, the distance is calculated
+precisely, whereas for cv::DIST_L2 (Euclidean distance) the distance can be calculated only with a
+relative error (a \f$5\times 5\f$ mask gives more accurate results). For `a`,`b`, and `c`, OpenCV
+uses the values suggested in the original paper:
+- DIST_L1: `a = 1, b = 2`
+- DIST_L2:
+    - `3 x 3`: `a=0.955, b=1.3693`
+    - `5 x 5`: `a=1, b=1.4, c=2.1969`
+- DIST_C: `a = 1, b = 1`
+
+Typically, for a fast, coarse distance estimation DIST_L2, a \f$3\times 3\f$ mask is used. For a
+more accurate distance estimation DIST_L2, a \f$5\times 5\f$ mask or the precise algorithm is used.
+Note that both the precise and the approximate algorithms are linear on the number of pixels.
+
+This variant of the function does not only compute the minimum distance for each pixel \f$(x, y)\f$
+but also identifies the nearest connected component consisting of zero pixels
+(labelType==DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==DIST_LABEL_PIXEL). Index of the
+component/pixel is stored in `labels(x, y)`. When labelType==DIST_LABEL_CCOMP, the function
+automatically finds connected components of zero pixels in the input image and marks them with
+distinct labels. When labelType==DIST_LABEL_CCOMP, the function scans through the input image and
+marks all the zero pixels with distinct labels.
+
+In this mode, the complexity is still linear. That is, the function provides a very fast way to
+compute the Voronoi diagram for a binary image. Currently, the second variant can use only the
+approximate distance transform algorithm, i.e. maskSize=DIST_MASK_PRECISE is not supported
+yet.
+
+@param src 8-bit, single-channel (binary) source image.
+@param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
+single-channel image of the same size as src.
+@param labels Output 2D array of labels (the discrete Voronoi diagram). It has the type
+CV_32SC1 and the same size as src.
+@param distanceType Type of distance, see cv::DistanceTypes
+@param maskSize Size of the distance transform mask, see cv::DistanceTransformMasks.
+DIST_MASK_PRECISE is not supported by this variant. In case of the DIST_L1 or DIST_C distance type,
+the parameter is forced to 3 because a \f$3\times 3\f$ mask gives the same result as \f$5\times
+5\f$ or any larger aperture.
+@param labelType Type of the label array to build, see cv::DistanceTransformLabelTypes.
+ */
+CV_EXPORTS_AS(distanceTransformWithLabels) void distanceTransform( InputArray src, OutputArray dst,
+                                     OutputArray labels, int distanceType, int maskSize,
+                                     int labelType = DIST_LABEL_CCOMP );
+
+/** @overload
+@param src 8-bit, single-channel (binary) source image.
+@param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
+single-channel image of the same size as src .
+@param distanceType Type of distance, see cv::DistanceTypes
+@param maskSize Size of the distance transform mask, see cv::DistanceTransformMasks. In case of the
+DIST_L1 or DIST_C distance type, the parameter is forced to 3 because a \f$3\times 3\f$ mask gives
+the same result as \f$5\times 5\f$ or any larger aperture.
+@param dstType Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for
+the first variant of the function and distanceType == DIST_L1.
+*/
+CV_EXPORTS_W void distanceTransform( InputArray src, OutputArray dst,
+                                     int distanceType, int maskSize, int dstType=CV_32F);
+
+/** @example ffilldemo.cpp
+  An example using the FloodFill technique
+*/
+
+/** @overload
+
+variant without `mask` parameter
+*/
+CV_EXPORTS int floodFill( InputOutputArray image,
+                          Point seedPoint, Scalar newVal, CV_OUT Rect* rect = 0,
+                          Scalar loDiff = Scalar(), Scalar upDiff = Scalar(),
+                          int flags = 4 );
+
+/** @brief Fills a connected component with the given color.
+
+The functions floodFill fill a connected component starting from the seed point with the specified
+color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The
+pixel at \f$(x,y)\f$ is considered to belong to the repainted domain if:
+
+- in case of a grayscale image and floating range
+\f[\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y)  \leq \texttt{src} (x',y')+ \texttt{upDiff}\f]
+
+
+- in case of a grayscale image and fixed range
+\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y)  \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\f]
+
+
+- in case of a color image and floating range
+\f[\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\f]
+\f[\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\f]
+and
+\f[\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\f]
+
+
+- in case of a color image and fixed range
+\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\f]
+\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\f]
+and
+\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\f]
+
+
+where \f$src(x',y')\f$ is the value of one of pixel neighbors that is already known to belong to the
+component. That is, to be added to the connected component, a color/brightness of the pixel should
+be close enough to:
+- Color/brightness of one of its neighbors that already belong to the connected component in case
+of a floating range.
+- Color/brightness of the seed point in case of a fixed range.
+
+Use these functions to either mark a connected component with the specified color in-place, or build
+a mask and then extract the contour, or copy the region to another image, and so on.
+
+@param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
+function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
+the details below.
+@param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
+taller than image. Since this is both an input and output parameter, you must take responsibility
+of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example,
+an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
+mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags
+as described below. It is therefore possible to use the same mask in multiple calls to the function
+to make sure the filled areas do not overlap.
+@param seedPoint Starting point.
+@param newVal New value of the repainted domain pixels.
+@param loDiff Maximal lower brightness/color difference between the currently observed pixel and
+one of its neighbors belonging to the component, or a seed pixel being added to the component.
+@param upDiff Maximal upper brightness/color difference between the currently observed pixel and
+one of its neighbors belonging to the component, or a seed pixel being added to the component.
+@param rect Optional output parameter set by the function to the minimum bounding rectangle of the
+repainted domain.
+@param flags Operation flags. The first 8 bits contain a connectivity value. The default value of
+4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
+connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
+will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
+the mask (the default value is 1). For example, 4 | ( 255 \<\< 8 ) will consider 4 nearest
+neighbours and fill the mask with a value of 255. The following additional options occupy higher
+bits and therefore may be further combined with the connectivity and mask fill values using
+bit-wise or (|), see cv::FloodFillFlags.
+
+@note Since the mask is larger than the filled image, a pixel \f$(x, y)\f$ in image corresponds to the
+pixel \f$(x+1, y+1)\f$ in the mask .
+
+@sa findContours
+ */
+CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask,
+                            Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
+                            Scalar loDiff = Scalar(), Scalar upDiff = Scalar(),
+                            int flags = 4 );
+
+/** @brief Converts an image from one color space to another.
+
+The function converts an input image from one color space to another. In case of a transformation
+to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note
+that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the
+bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue
+component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and
+sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on.
+
+The conventional ranges for R, G, and B channel values are:
+-   0 to 255 for CV_8U images
+-   0 to 65535 for CV_16U images
+-   0 to 1 for CV_32F images
+
+In case of linear transformations, the range does not matter. But in case of a non-linear
+transformation, an input RGB image should be normalized to the proper value range to get the correct
+results, for example, for RGB \f$\rightarrow\f$ L\*u\*v\* transformation. For example, if you have a
+32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will
+have the 0..255 value range instead of 0..1 assumed by the function. So, before calling cvtColor ,
+you need first to scale the image down:
+@code
+    img *= 1./255;
+    cvtColor(img, img, COLOR_BGR2Luv);
+@endcode
+If you use cvtColor with 8-bit images, the conversion will have some information lost. For many
+applications, this will not be noticeable but it is recommended to use 32-bit images in applications
+that need the full range of colors or that convert an image before an operation and then convert
+back.
+
+If conversion adds the alpha channel, its value will set to the maximum of corresponding channel
+range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F.
+
+@param src input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision
+floating-point.
+@param dst output image of the same size and depth as src.
+@param code color space conversion code (see cv::ColorConversionCodes).
+@param dstCn number of channels in the destination image; if the parameter is 0, the number of the
+channels is derived automatically from src and code.
+
+@see @ref imgproc_color_conversions
+ */
+CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn = 0 );
+
+//! @} imgproc_misc
+
+// main function for all demosaicing procceses
+CV_EXPORTS_W void demosaicing(InputArray _src, OutputArray _dst, int code, int dcn = 0);
+
+//! @addtogroup imgproc_shape
+//! @{
+
+/** @brief Calculates all of the moments up to the third order of a polygon or rasterized shape.
+
+The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The
+results are returned in the structure cv::Moments.
+
+@param array Raster image (single-channel, 8-bit or floating-point 2D array) or an array (
+\f$1 \times N\f$ or \f$N \times 1\f$ ) of 2D points (Point or Point2f ).
+@param binaryImage If it is true, all non-zero image pixels are treated as 1's. The parameter is
+used for images only.
+@returns moments.
+
+@sa  contourArea, arcLength
+ */
+CV_EXPORTS_W Moments moments( InputArray array, bool binaryImage = false );
+
+/** @brief Calculates seven Hu invariants.
+
+The function calculates seven Hu invariants (introduced in @cite Hu62; see also
+<http://en.wikipedia.org/wiki/Image_moment>) defined as:
+
+\f[\begin{array}{l} hu[0]= \eta _{20}+ \eta _{02} \\ hu[1]=( \eta _{20}- \eta _{02})^{2}+4 \eta _{11}^{2} \\ hu[2]=( \eta _{30}-3 \eta _{12})^{2}+ (3 \eta _{21}- \eta _{03})^{2} \\ hu[3]=( \eta _{30}+ \eta _{12})^{2}+ ( \eta _{21}+ \eta _{03})^{2} \\ hu[4]=( \eta _{30}-3 \eta _{12})( \eta _{30}+ \eta _{12})[( \eta _{30}+ \eta _{12})^{2}-3( \eta _{21}+ \eta _{03})^{2}]+(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ hu[5]=( \eta _{20}- \eta _{02})[( \eta _{30}+ \eta _{12})^{2}- ( \eta _{21}+ \eta _{03})^{2}]+4 \eta _{11}( \eta _{30}+ \eta _{12})( \eta _{21}+ \eta _{03}) \\ hu[6]=(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}]-( \eta _{30}-3 \eta _{12})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ \end{array}\f]
+
+where \f$\eta_{ji}\f$ stands for \f$\texttt{Moments::nu}_{ji}\f$ .
+
+These values are proved to be invariants to the image scale, rotation, and reflection except the
+seventh one, whose sign is changed by reflection. This invariance is proved with the assumption of
+infinite image resolution. In case of raster images, the computed Hu invariants for the original and
+transformed images are a bit different.
+
+@param moments Input moments computed with moments .
+@param hu Output Hu invariants.
+
+@sa matchShapes
+ */
+CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
+
+/** @overload */
+CV_EXPORTS_W void HuMoments( const Moments& m, OutputArray hu );
+
+//! @} imgproc_shape
+
+//! @addtogroup imgproc_object
+//! @{
+
+//! type of the template matching operation
+enum TemplateMatchModes {
+    TM_SQDIFF        = 0, //!< \f[R(x,y)= \sum _{x',y'} (T(x',y')-I(x+x',y+y'))^2\f]
+    TM_SQDIFF_NORMED = 1, //!< \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y')-I(x+x',y+y'))^2}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f]
+    TM_CCORR         = 2, //!< \f[R(x,y)= \sum _{x',y'} (T(x',y')  \cdot I(x+x',y+y'))\f]
+    TM_CCORR_NORMED  = 3, //!< \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f]
+    TM_CCOEFF        = 4, //!< \f[R(x,y)= \sum _{x',y'} (T'(x',y')  \cdot I'(x+x',y+y'))\f]
+                          //!< where
+                          //!< \f[\begin{array}{l} T'(x',y')=T(x',y') - 1/(w  \cdot h)  \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w  \cdot h)  \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array}\f]
+    TM_CCOEFF_NORMED = 5  //!< \f[R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} }\f]
+};
+
+/** @brief Compares a template against overlapped image regions.
+
+The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against
+templ using the specified method and stores the comparison results in result . Here are the formulae
+for the available comparison methods ( \f$I\f$ denotes image, \f$T\f$ template, \f$R\f$ result ). The summation
+is done over template and/or the image patch: \f$x' = 0...w-1, y' = 0...h-1\f$
+
+After the function finishes the comparison, the best matches can be found as global minimums (when
+TM_SQDIFF was used) or maximums (when TM_CCORR or TM_CCOEFF was used) using the
+minMaxLoc function. In case of a color image, template summation in the numerator and each sum in
+the denominator is done over all of the channels and separate mean values are used for each channel.
+That is, the function can take a color template and a color image. The result will still be a
+single-channel image, which is easier to analyze.
+
+@param image Image where the search is running. It must be 8-bit or 32-bit floating-point.
+@param templ Searched template. It must be not greater than the source image and have the same
+data type.
+@param result Map of comparison results. It must be single-channel 32-bit floating-point. If image
+is \f$W \times H\f$ and templ is \f$w \times h\f$ , then result is \f$(W-w+1) \times (H-h+1)\f$ .
+@param method Parameter specifying the comparison method, see cv::TemplateMatchModes
+@param mask Mask of searched template. It must have the same datatype and size with templ. It is
+not set by default.
+ */
+CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ,
+                                 OutputArray result, int method, InputArray mask = noArray() );
+
+//! @}
+
+//! @addtogroup imgproc_shape
+//! @{
+
+/** @brief computes the connected components labeled image of boolean image
+
+image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
+represents the background label. ltype specifies the output label image type, an important
+consideration based on the total number of labels or alternatively the total number of pixels in
+the source image.
+
+@param image the 8-bit single-channel image to be labeled
+@param labels destination labeled image
+@param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
+@param ltype output image label type. Currently CV_32S and CV_16U are supported.
+ */
+CV_EXPORTS_W int connectedComponents(InputArray image, OutputArray labels,
+                                     int connectivity = 8, int ltype = CV_32S);
+
+/** @overload
+@param image the 8-bit single-channel image to be labeled
+@param labels destination labeled image
+@param stats statistics output for each label, including the background label, see below for
+available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
+cv::ConnectedComponentsTypes. The data type is CV_32S.
+@param centroids centroid output for each label, including the background label. Centroids are
+accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
+@param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
+@param ltype output image label type. Currently CV_32S and CV_16U are supported.
+*/
+CV_EXPORTS_W int connectedComponentsWithStats(InputArray image, OutputArray labels,
+                                              OutputArray stats, OutputArray centroids,
+                                              int connectivity = 8, int ltype = CV_32S);
+
+
+/** @brief Finds contours in a binary image.
+
+The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours
+are a useful tool for shape analysis and object detection and recognition. See squares.c in the
+OpenCV sample directory.
+
+@note Source image is modified by this function. Also, the function does not take into account
+1-pixel border of the image (it's filled with 0's and used for neighbor analysis in the algorithm),
+therefore the contours touching the image border will be clipped.
+
+@param image Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero
+pixels remain 0's, so the image is treated as binary . You can use compare , inRange , threshold ,
+adaptiveThreshold , Canny , and others to create a binary image out of a grayscale or color one.
+The function modifies the image while extracting the contours. If mode equals to RETR_CCOMP
+or RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).
+@param contours Detected contours. Each contour is stored as a vector of points.
+@param hierarchy Optional output vector, containing information about the image topology. It has
+as many elements as the number of contours. For each i-th contour contours[i] , the elements
+hierarchy[i][0] , hiearchy[i][1] , hiearchy[i][2] , and hiearchy[i][3] are set to 0-based indices
+in contours of the next and previous contours at the same hierarchical level, the first child
+contour and the parent contour, respectively. If for the contour i there are no next, previous,
+parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
+@param mode Contour retrieval mode, see cv::RetrievalModes
+@param method Contour approximation method, see cv::ContourApproximationModes
+@param offset Optional offset by which every contour point is shifted. This is useful if the
+contours are extracted from the image ROI and then they should be analyzed in the whole image
+context.
+ */
+CV_EXPORTS_W void findContours( InputOutputArray image, OutputArrayOfArrays contours,
+                              OutputArray hierarchy, int mode,
+                              int method, Point offset = Point());
+
+/** @overload */
+CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours,
+                              int mode, int method, Point offset = Point());
+
+/** @brief Approximates a polygonal curve(s) with the specified precision.
+
+The functions approxPolyDP approximate a curve or a polygon with another curve/polygon with less
+vertices so that the distance between them is less or equal to the specified precision. It uses the
+Douglas-Peucker algorithm <http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm>
+
+@param curve Input vector of a 2D point stored in std::vector or Mat
+@param approxCurve Result of the approximation. The type should match the type of the input curve.
+@param epsilon Parameter specifying the approximation accuracy. This is the maximum distance
+between the original curve and its approximation.
+@param closed If true, the approximated curve is closed (its first and last vertices are
+connected). Otherwise, it is not closed.
+ */
+CV_EXPORTS_W void approxPolyDP( InputArray curve,
+                                OutputArray approxCurve,
+                                double epsilon, bool closed );
+
+/** @brief Calculates a contour perimeter or a curve length.
+
+The function computes a curve length or a closed contour perimeter.
+
+@param curve Input vector of 2D points, stored in std::vector or Mat.
+@param closed Flag indicating whether the curve is closed or not.
+ */
+CV_EXPORTS_W double arcLength( InputArray curve, bool closed );
+
+/** @brief Calculates the up-right bounding rectangle of a point set.
+
+The function calculates and returns the minimal up-right bounding rectangle for the specified point set.
+
+@param points Input 2D point set, stored in std::vector or Mat.
+ */
+CV_EXPORTS_W Rect boundingRect( InputArray points );
+
+/** @brief Calculates a contour area.
+
+The function computes a contour area. Similarly to moments , the area is computed using the Green
+formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using
+drawContours or fillPoly , can be different. Also, the function will most certainly give a wrong
+results for contours with self-intersections.
+
+Example:
+@code
+    vector<Point> contour;
+    contour.push_back(Point2f(0, 0));
+    contour.push_back(Point2f(10, 0));
+    contour.push_back(Point2f(10, 10));
+    contour.push_back(Point2f(5, 4));
+
+    double area0 = contourArea(contour);
+    vector<Point> approx;
+    approxPolyDP(contour, approx, 5, true);
+    double area1 = contourArea(approx);
+
+    cout << "area0 =" << area0 << endl <<
+            "area1 =" << area1 << endl <<
+            "approx poly vertices" << approx.size() << endl;
+@endcode
+@param contour Input vector of 2D points (contour vertices), stored in std::vector or Mat.
+@param oriented Oriented area flag. If it is true, the function returns a signed area value,
+depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can
+determine orientation of a contour by taking the sign of an area. By default, the parameter is
+false, which means that the absolute value is returned.
+ */
+CV_EXPORTS_W double contourArea( InputArray contour, bool oriented = false );
+
+/** @brief Finds a rotated rectangle of the minimum area enclosing the input 2D point set.
+
+The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a
+specified point set. See the OpenCV sample minarea.cpp . Developer should keep in mind that the
+returned rotatedRect can contain negative indices when data is close to the containing Mat element
+boundary.
+
+@param points Input vector of 2D points, stored in std::vector\<\> or Mat
+ */
+CV_EXPORTS_W RotatedRect minAreaRect( InputArray points );
+
+/** @brief Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.
+
+The function finds the four vertices of a rotated rectangle. This function is useful to draw the
+rectangle. In C++, instead of using this function, you can directly use box.points() method. Please
+visit the [tutorial on bounding
+rectangle](http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html#bounding-rects-circles)
+for more information.
+
+@param box The input rotated rectangle. It may be the output of
+@param points The output array of four vertices of rectangles.
+ */
+CV_EXPORTS_W void boxPoints(RotatedRect box, OutputArray points);
+
+/** @brief Finds a circle of the minimum area enclosing a 2D point set.
+
+The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm. See
+the OpenCV sample minarea.cpp .
+
+@param points Input vector of 2D points, stored in std::vector\<\> or Mat
+@param center Output center of the circle.
+@param radius Output radius of the circle.
+ */
+CV_EXPORTS_W void minEnclosingCircle( InputArray points,
+                                      CV_OUT Point2f& center, CV_OUT float& radius );
+
+/** @example minarea.cpp
+  */
+
+/** @brief Finds a triangle of minimum area enclosing a 2D point set and returns its area.
+
+The function finds a triangle of minimum area enclosing the given set of 2D points and returns its
+area. The output for a given 2D point set is shown in the image below. 2D points are depicted in
+*red* and the enclosing triangle in *yellow*.
+
+![Sample output of the minimum enclosing triangle function](pics/minenclosingtriangle.png)
+
+The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's
+@cite KleeLaskowski85 papers. O'Rourke provides a \f$\theta(n)\f$ algorithm for finding the minimal
+enclosing triangle of a 2D convex polygon with n vertices. Since the minEnclosingTriangle function
+takes a 2D point set as input an additional preprocessing step of computing the convex hull of the
+2D point set is required. The complexity of the convexHull function is \f$O(n log(n))\f$ which is higher
+than \f$\theta(n)\f$. Thus the overall complexity of the function is \f$O(n log(n))\f$.
+
+@param points Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector\<\> or Mat
+@param triangle Output vector of three 2D points defining the vertices of the triangle. The depth
+of the OutputArray must be CV_32F.
+ */
+CV_EXPORTS_W double minEnclosingTriangle( InputArray points, CV_OUT OutputArray triangle );
+
+/** @brief Compares two shapes.
+
+The function compares two shapes. All three implemented methods use the Hu invariants (see cv::HuMoments)
+
+@param contour1 First contour or grayscale image.
+@param contour2 Second contour or grayscale image.
+@param method Comparison method, see ::ShapeMatchModes
+@param parameter Method-specific parameter (not supported now).
+ */
+CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,
+                                 int method, double parameter );
+
+/** @example convexhull.cpp
+An example using the convexHull functionality
+*/
+
+/** @brief Finds the convex hull of a point set.
+
+The functions find the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82
+that has *O(N logN)* complexity in the current implementation. See the OpenCV sample convexhull.cpp
+that demonstrates the usage of different function variants.
+
+@param points Input 2D point set, stored in std::vector or Mat.
+@param hull Output convex hull. It is either an integer vector of indices or vector of points. In
+the first case, the hull elements are 0-based indices of the convex hull points in the original
+array (since the set of convex hull points is a subset of the original point set). In the second
+case, hull elements are the convex hull points themselves.
+@param clockwise Orientation flag. If it is true, the output convex hull is oriented clockwise.
+Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing
+to the right, and its Y axis pointing upwards.
+@param returnPoints Operation flag. In case of a matrix, when the flag is true, the function
+returns convex hull points. Otherwise, it returns indices of the convex hull points. When the
+output array is std::vector, the flag is ignored, and the output depends on the type of the
+vector: std::vector\<int\> implies returnPoints=true, std::vector\<Point\> implies
+returnPoints=false.
+ */
+CV_EXPORTS_W void convexHull( InputArray points, OutputArray hull,
+                              bool clockwise = false, bool returnPoints = true );
+
+/** @brief Finds the convexity defects of a contour.
+
+The figure below displays convexity defects of a hand contour:
+
+![image](pics/defects.png)
+
+@param contour Input contour.
+@param convexhull Convex hull obtained using convexHull that should contain indices of the contour
+points that make the hull.
+@param convexityDefects The output vector of convexity defects. In C++ and the new Python/Java
+interface each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i):
+(start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices
+in the original contour of the convexity defect beginning, end and the farthest point, and
+fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the
+farthest contour point and the hull. That is, to get the floating-point value of the depth will be
+fixpt_depth/256.0.
+ */
+CV_EXPORTS_W void convexityDefects( InputArray contour, InputArray convexhull, OutputArray convexityDefects );
+
+/** @brief Tests a contour convexity.
+
+The function tests whether the input contour is convex or not. The contour must be simple, that is,
+without self-intersections. Otherwise, the function output is undefined.
+
+@param contour Input vector of 2D points, stored in std::vector\<\> or Mat
+ */
+CV_EXPORTS_W bool isContourConvex( InputArray contour );
+
+//! finds intersection of two convex polygons
+CV_EXPORTS_W float intersectConvexConvex( InputArray _p1, InputArray _p2,
+                                          OutputArray _p12, bool handleNested = true );
+
+/** @example fitellipse.cpp
+  An example using the fitEllipse technique
+*/
+
+/** @brief Fits an ellipse around a set of 2D points.
+
+The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of
+all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by @cite Fitzgibbon95
+is used. Developer should keep in mind that it is possible that the returned
+ellipse/rotatedRect data contains negative indices, due to the data points being close to the
+border of the containing Mat element.
+
+@param points Input 2D point set, stored in std::vector\<\> or Mat
+ */
+CV_EXPORTS_W RotatedRect fitEllipse( InputArray points );
+
+/** @brief Fits a line to a 2D or 3D point set.
+
+The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where
+\f$r_i\f$ is a distance between the \f$i^{th}\f$ point, the line and \f$\rho(r)\f$ is a distance function, one
+of the following:
+-  DIST_L2
+\f[\rho (r) = r^2/2  \quad \text{(the simplest and the fastest least-squares method)}\f]
+- DIST_L1
+\f[\rho (r) = r\f]
+- DIST_L12
+\f[\rho (r) = 2  \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\f]
+- DIST_FAIR
+\f[\rho \left (r \right ) = C^2  \cdot \left (  \frac{r}{C} -  \log{\left(1 + \frac{r}{C}\right)} \right )  \quad \text{where} \quad C=1.3998\f]
+- DIST_WELSCH
+\f[\rho \left (r \right ) =  \frac{C^2}{2} \cdot \left ( 1 -  \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right )  \quad \text{where} \quad C=2.9846\f]
+- DIST_HUBER
+\f[\rho (r) =  \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\f]
+
+The algorithm is based on the M-estimator ( <http://en.wikipedia.org/wiki/M-estimator> ) technique
+that iteratively fits the line using the weighted least-squares algorithm. After each iteration the
+weights \f$w_i\f$ are adjusted to be inversely proportional to \f$\rho(r_i)\f$ .
+
+@param points Input vector of 2D or 3D points, stored in std::vector\<\> or Mat.
+@param line Output line parameters. In case of 2D fitting, it should be a vector of 4 elements
+(like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and
+(x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like
+Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line
+and (x0, y0, z0) is a point on the line.
+@param distType Distance used by the M-estimator, see cv::DistanceTypes
+@param param Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value
+is chosen.
+@param reps Sufficient accuracy for the radius (distance between the coordinate origin and the line).
+@param aeps Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.
+ */
+CV_EXPORTS_W void fitLine( InputArray points, OutputArray line, int distType,
+                           double param, double reps, double aeps );
+
+/** @brief Performs a point-in-contour test.
+
+The function determines whether the point is inside a contour, outside, or lies on an edge (or
+coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge)
+value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively.
+Otherwise, the return value is a signed distance between the point and the nearest contour edge.
+
+See below a sample output of the function where each image pixel is tested against the contour:
+
+![sample output](pics/pointpolygon.png)
+
+@param contour Input contour.
+@param pt Point tested against the contour.
+@param measureDist If true, the function estimates the signed distance from the point to the
+nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.
+ */
+CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist );
+
+/** @brief Finds out if there is any intersection between two rotated rectangles.
+
+If there is then the vertices of the interesecting region are returned as well.
+
+Below are some examples of intersection configurations. The hatched pattern indicates the
+intersecting region and the red vertices are returned by the function.
+
+![intersection examples](pics/intersection.png)
+
+@param rect1 First rectangle
+@param rect2 Second rectangle
+@param intersectingRegion The output array of the verticies of the intersecting region. It returns
+at most 8 vertices. Stored as std::vector\<cv::Point2f\> or cv::Mat as Mx1 of type CV_32FC2.
+@returns One of cv::RectanglesIntersectTypes
+ */
+CV_EXPORTS_W int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion  );
+
+//! @} imgproc_shape
+
+CV_EXPORTS_W Ptr<CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
+
+//! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122.
+//! Detects position only without traslation and rotation
+CV_EXPORTS Ptr<GeneralizedHoughBallard> createGeneralizedHoughBallard();
+
+//! Guil, N., Gonz谩lez-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038.
+//! Detects position, traslation and rotation
+CV_EXPORTS Ptr<GeneralizedHoughGuil> createGeneralizedHoughGuil();
+
+//! Performs linear blending of two images
+CV_EXPORTS void blendLinear(InputArray src1, InputArray src2, InputArray weights1, InputArray weights2, OutputArray dst);
+
+//! @addtogroup imgproc_colormap
+//! @{
+
+//! GNU Octave/MATLAB equivalent colormaps
+enum ColormapTypes
+{
+    COLORMAP_AUTUMN = 0, //!< ![autumn](pics/colormaps/colorscale_autumn.jpg)
+    COLORMAP_BONE = 1, //!< ![bone](pics/colormaps/colorscale_bone.jpg)
+    COLORMAP_JET = 2, //!< ![jet](pics/colormaps/colorscale_jet.jpg)
+    COLORMAP_WINTER = 3, //!< ![winter](pics/colormaps/colorscale_winter.jpg)
+    COLORMAP_RAINBOW = 4, //!< ![rainbow](pics/colormaps/colorscale_rainbow.jpg)
+    COLORMAP_OCEAN = 5, //!< ![ocean](pics/colormaps/colorscale_ocean.jpg)
+    COLORMAP_SUMMER = 6, //!< ![summer](pics/colormaps/colorscale_summer.jpg)
+    COLORMAP_SPRING = 7, //!< ![spring](pics/colormaps/colorscale_spring.jpg)
+    COLORMAP_COOL = 8, //!< ![cool](pics/colormaps/colorscale_cool.jpg)
+    COLORMAP_HSV = 9, //!< ![HSV](pics/colormaps/colorscale_hsv.jpg)
+    COLORMAP_PINK = 10, //!< ![pink](pics/colormaps/colorscale_pink.jpg)
+    COLORMAP_HOT = 11, //!< ![hot](pics/colormaps/colorscale_hot.jpg)
+    COLORMAP_PARULA = 12 //!< ![parula](pics/colormaps/colorscale_parula.jpg)
+};
+
+/** @brief Applies a GNU Octave/MATLAB equivalent colormap on a given image.
+
+@param src The source image, grayscale or colored does not matter.
+@param dst The result is the colormapped source image. Note: Mat::create is called on dst.
+@param colormap The colormap to apply, see cv::ColormapTypes
+ */
+CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, int colormap);
+
+//! @} imgproc_colormap
+
+//! @addtogroup imgproc_draw
+//! @{
+
+/** @brief Draws a line segment connecting two points.
+
+The function line draws the line segment between pt1 and pt2 points in the image. The line is
+clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected
+or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased
+lines are drawn using Gaussian filtering.
+
+@param img Image.
+@param pt1 First point of the line segment.
+@param pt2 Second point of the line segment.
+@param color Line color.
+@param thickness Line thickness.
+@param lineType Type of the line, see cv::LineTypes.
+@param shift Number of fractional bits in the point coordinates.
+ */
+CV_EXPORTS_W void line(InputOutputArray img, Point pt1, Point pt2, const Scalar& color,
+                     int thickness = 1, int lineType = LINE_8, int shift = 0);
+
+/** @brief Draws a arrow segment pointing from the first point to the second one.
+
+The function arrowedLine draws an arrow between pt1 and pt2 points in the image. See also cv::line.
+
+@param img Image.
+@param pt1 The point the arrow starts from.
+@param pt2 The point the arrow points to.
+@param color Line color.
+@param thickness Line thickness.
+@param line_type Type of the line, see cv::LineTypes
+@param shift Number of fractional bits in the point coordinates.
+@param tipLength The length of the arrow tip in relation to the arrow length
+ */
+CV_EXPORTS_W void arrowedLine(InputOutputArray img, Point pt1, Point pt2, const Scalar& color,
+                     int thickness=1, int line_type=8, int shift=0, double tipLength=0.1);
+
+/** @brief Draws a simple, thick, or filled up-right rectangle.
+
+The function rectangle draws a rectangle outline or a filled rectangle whose two opposite corners
+are pt1 and pt2.
+
+@param img Image.
+@param pt1 Vertex of the rectangle.
+@param pt2 Vertex of the rectangle opposite to pt1 .
+@param color Rectangle color or brightness (grayscale image).
+@param thickness Thickness of lines that make up the rectangle. Negative values, like CV_FILLED ,
+mean that the function has to draw a filled rectangle.
+@param lineType Type of the line. See the line description.
+@param shift Number of fractional bits in the point coordinates.
+ */
+CV_EXPORTS_W void rectangle(InputOutputArray img, Point pt1, Point pt2,
+                          const Scalar& color, int thickness = 1,
+                          int lineType = LINE_8, int shift = 0);
+
+/** @overload
+
+use `rec` parameter as alternative specification of the drawn rectangle: `r.tl() and
+r.br()-Point(1,1)` are opposite corners
+*/
+CV_EXPORTS void rectangle(CV_IN_OUT Mat& img, Rect rec,
+                          const Scalar& color, int thickness = 1,
+                          int lineType = LINE_8, int shift = 0);
+
+/** @brief Draws a circle.
+
+The function circle draws a simple or filled circle with a given center and radius.
+@param img Image where the circle is drawn.
+@param center Center of the circle.
+@param radius Radius of the circle.
+@param color Circle color.
+@param thickness Thickness of the circle outline, if positive. Negative thickness means that a
+filled circle is to be drawn.
+@param lineType Type of the circle boundary. See the line description.
+@param shift Number of fractional bits in the coordinates of the center and in the radius value.
+ */
+CV_EXPORTS_W void circle(InputOutputArray img, Point center, int radius,
+                       const Scalar& color, int thickness = 1,
+                       int lineType = LINE_8, int shift = 0);
+
+/** @brief Draws a simple or thick elliptic arc or fills an ellipse sector.
+
+The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic
+arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc
+boundary. If you need more control of the ellipse rendering, you can retrieve the curve using
+ellipse2Poly and then render it with polylines or fill it with fillPoly . If you use the first
+variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and
+endAngle=360 . The figure below explains the meaning of the parameters.
+
+![Parameters of Elliptic Arc](pics/ellipse.png)
+
+@param img Image.
+@param center Center of the ellipse.
+@param axes Half of the size of the ellipse main axes.
+@param angle Ellipse rotation angle in degrees.
+@param startAngle Starting angle of the elliptic arc in degrees.
+@param endAngle Ending angle of the elliptic arc in degrees.
+@param color Ellipse color.
+@param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
+a filled ellipse sector is to be drawn.
+@param lineType Type of the ellipse boundary. See the line description.
+@param shift Number of fractional bits in the coordinates of the center and values of axes.
+ */
+CV_EXPORTS_W void ellipse(InputOutputArray img, Point center, Size axes,
+                        double angle, double startAngle, double endAngle,
+                        const Scalar& color, int thickness = 1,
+                        int lineType = LINE_8, int shift = 0);
+
+/** @overload
+@param img Image.
+@param box Alternative ellipse representation via RotatedRect. This means that the function draws
+an ellipse inscribed in the rotated rectangle.
+@param color Ellipse color.
+@param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
+a filled ellipse sector is to be drawn.
+@param lineType Type of the ellipse boundary. See the line description.
+*/
+CV_EXPORTS_W void ellipse(InputOutputArray img, const RotatedRect& box, const Scalar& color,
+                        int thickness = 1, int lineType = LINE_8);
+
+/* ----------------------------------------------------------------------------------------- */
+/* ADDING A SET OF PREDEFINED MARKERS WHICH COULD BE USED TO HIGHLIGHT POSITIONS IN AN IMAGE */
+/* ----------------------------------------------------------------------------------------- */
+
+//! Possible set of marker types used for the cv::drawMarker function
+enum MarkerTypes
+{
+    MARKER_CROSS = 0,           //!< A crosshair marker shape
+    MARKER_TILTED_CROSS = 1,    //!< A 45 degree tilted crosshair marker shape
+    MARKER_STAR = 2,            //!< A star marker shape, combination of cross and tilted cross
+    MARKER_DIAMOND = 3,         //!< A diamond marker shape
+    MARKER_SQUARE = 4,          //!< A square marker shape
+    MARKER_TRIANGLE_UP = 5,     //!< An upwards pointing triangle marker shape
+    MARKER_TRIANGLE_DOWN = 6    //!< A downwards pointing triangle marker shape
+};
+
+/** @brief Draws a marker on a predefined position in an image.
+
+The function drawMarker draws a marker on a given position in the image. For the moment several
+marker types are supported, see cv::MarkerTypes for more information.
+
+@param img Image.
+@param position The point where the crosshair is positioned.
+@param markerType The specific type of marker you want to use, see cv::MarkerTypes
+@param color Line color.
+@param thickness Line thickness.
+@param line_type Type of the line, see cv::LineTypes
+@param markerSize The length of the marker axis [default = 20 pixels]
+ */
+CV_EXPORTS_W void drawMarker(CV_IN_OUT Mat& img, Point position, const Scalar& color,
+                             int markerType = MARKER_CROSS, int markerSize=20, int thickness=1,
+                             int line_type=8);
+
+/* ----------------------------------------------------------------------------------------- */
+/* END OF MARKER SECTION */
+/* ----------------------------------------------------------------------------------------- */
+
+/** @overload */
+CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts,
+                               const Scalar& color, int lineType = LINE_8,
+                               int shift = 0);
+
+/** @brief Fills a convex polygon.
+
+The function fillConvexPoly draws a filled convex polygon. This function is much faster than the
+function cv::fillPoly . It can fill not only convex polygons but any monotonic polygon without
+self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line)
+twice at the most (though, its top-most and/or the bottom edge could be horizontal).
+
+@param img Image.
+@param points Polygon vertices.
+@param color Polygon color.
+@param lineType Type of the polygon boundaries. See the line description.
+@param shift Number of fractional bits in the vertex coordinates.
+ */
+CV_EXPORTS_W void fillConvexPoly(InputOutputArray img, InputArray points,
+                                 const Scalar& color, int lineType = LINE_8,
+                                 int shift = 0);
+
+/** @overload */
+CV_EXPORTS void fillPoly(Mat& img, const Point** pts,
+                         const int* npts, int ncontours,
+                         const Scalar& color, int lineType = LINE_8, int shift = 0,
+                         Point offset = Point() );
+
+/** @brief Fills the area bounded by one or more polygons.
+
+The function fillPoly fills an area bounded by several polygonal contours. The function can fill
+complex areas, for example, areas with holes, contours with self-intersections (some of their
+parts), and so forth.
+
+@param img Image.
+@param pts Array of polygons where each polygon is represented as an array of points.
+@param color Polygon color.
+@param lineType Type of the polygon boundaries. See the line description.
+@param shift Number of fractional bits in the vertex coordinates.
+@param offset Optional offset of all points of the contours.
+ */
+CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts,
+                           const Scalar& color, int lineType = LINE_8, int shift = 0,
+                           Point offset = Point() );
+
+/** @overload */
+CV_EXPORTS void polylines(Mat& img, const Point* const* pts, const int* npts,
+                          int ncontours, bool isClosed, const Scalar& color,
+                          int thickness = 1, int lineType = LINE_8, int shift = 0 );
+
+/** @brief Draws several polygonal curves.
+
+@param img Image.
+@param pts Array of polygonal curves.
+@param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed,
+the function draws a line from the last vertex of each curve to its first vertex.
+@param color Polyline color.
+@param thickness Thickness of the polyline edges.
+@param lineType Type of the line segments. See the line description.
+@param shift Number of fractional bits in the vertex coordinates.
+
+The function polylines draws one or more polygonal curves.
+ */
+CV_EXPORTS_W void polylines(InputOutputArray img, InputArrayOfArrays pts,
+                            bool isClosed, const Scalar& color,
+                            int thickness = 1, int lineType = LINE_8, int shift = 0 );
+
+/** @example contours2.cpp
+  An example using the drawContour functionality
+*/
+
+/** @example segment_objects.cpp
+An example using drawContours to clean up a background segmentation result
+ */
+
+/** @brief Draws contours outlines or filled contours.
+
+The function draws contour outlines in the image if \f$\texttt{thickness} \ge 0\f$ or fills the area
+bounded by the contours if \f$\texttt{thickness}<0\f$ . The example below shows how to retrieve
+connected components from the binary image and label them: :
+@code
+    #include "opencv2/imgproc.hpp"
+    #include "opencv2/highgui.hpp"
+
+    using namespace cv;
+    using namespace std;
+
+    int main( int argc, char** argv )
+    {
+        Mat src;
+        // the first command-line parameter must be a filename of the binary
+        // (black-n-white) image
+        if( argc != 2 || !(src=imread(argv[1], 0)).data)
+            return -1;
+
+        Mat dst = Mat::zeros(src.rows, src.cols, CV_8UC3);
+
+        src = src > 1;
+        namedWindow( "Source", 1 );
+        imshow( "Source", src );
+
+        vector<vector<Point> > contours;
+        vector<Vec4i> hierarchy;
+
+        findContours( src, contours, hierarchy,
+            RETR_CCOMP, CHAIN_APPROX_SIMPLE );
+
+        // iterate through all the top-level contours,
+        // draw each connected component with its own random color
+        int idx = 0;
+        for( ; idx >= 0; idx = hierarchy[idx][0] )
+        {
+            Scalar color( rand()&255, rand()&255, rand()&255 );
+            drawContours( dst, contours, idx, color, FILLED, 8, hierarchy );
+        }
+
+        namedWindow( "Components", 1 );
+        imshow( "Components", dst );
+        waitKey(0);
+    }
+@endcode
+
+@param image Destination image.
+@param contours All the input contours. Each contour is stored as a point vector.
+@param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
+@param color Color of the contours.
+@param thickness Thickness of lines the contours are drawn with. If it is negative (for example,
+thickness=CV_FILLED ), the contour interiors are drawn.
+@param lineType Line connectivity. See cv::LineTypes.
+@param hierarchy Optional information about hierarchy. It is only needed if you want to draw only
+some of the contours (see maxLevel ).
+@param maxLevel Maximal level for drawn contours. If it is 0, only the specified contour is drawn.
+If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
+draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
+parameter is only taken into account when there is hierarchy available.
+@param offset Optional contour shift parameter. Shift all the drawn contours by the specified
+\f$\texttt{offset}=(dx,dy)\f$ .
+ */
+CV_EXPORTS_W void drawContours( InputOutputArray image, InputArrayOfArrays contours,
+                              int contourIdx, const Scalar& color,
+                              int thickness = 1, int lineType = LINE_8,
+                              InputArray hierarchy = noArray(),
+                              int maxLevel = INT_MAX, Point offset = Point() );
+
+/** @brief Clips the line against the image rectangle.
+
+The functions clipLine calculate a part of the line segment that is entirely within the specified
+rectangle. They return false if the line segment is completely outside the rectangle. Otherwise,
+they return true .
+@param imgSize Image size. The image rectangle is Rect(0, 0, imgSize.width, imgSize.height) .
+@param pt1 First line point.
+@param pt2 Second line point.
+ */
+CV_EXPORTS bool clipLine(Size imgSize, CV_IN_OUT Point& pt1, CV_IN_OUT Point& pt2);
+
+/** @overload
+@param imgRect Image rectangle.
+@param pt1 First line point.
+@param pt2 Second line point.
+*/
+CV_EXPORTS_W bool clipLine(Rect imgRect, CV_OUT CV_IN_OUT Point& pt1, CV_OUT CV_IN_OUT Point& pt2);
+
+/** @brief Approximates an elliptic arc with a polyline.
+
+The function ellipse2Poly computes the vertices of a polyline that approximates the specified
+elliptic arc. It is used by cv::ellipse.
+
+@param center Center of the arc.
+@param axes Half of the size of the ellipse main axes. See the ellipse for details.
+@param angle Rotation angle of the ellipse in degrees. See the ellipse for details.
+@param arcStart Starting angle of the elliptic arc in degrees.
+@param arcEnd Ending angle of the elliptic arc in degrees.
+@param delta Angle between the subsequent polyline vertices. It defines the approximation
+accuracy.
+@param pts Output vector of polyline vertices.
+ */
+CV_EXPORTS_W void ellipse2Poly( Point center, Size axes, int angle,
+                                int arcStart, int arcEnd, int delta,
+                                CV_OUT std::vector<Point>& pts );
+
+/** @brief Draws a text string.
+
+The function putText renders the specified text string in the image. Symbols that cannot be rendered
+using the specified font are replaced by question marks. See getTextSize for a text rendering code
+example.
+
+@param img Image.
+@param text Text string to be drawn.
+@param org Bottom-left corner of the text string in the image.
+@param fontFace Font type, see cv::HersheyFonts.
+@param fontScale Font scale factor that is multiplied by the font-specific base size.
+@param color Text color.
+@param thickness Thickness of the lines used to draw a text.
+@param lineType Line type. See the line for details.
+@param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise,
+it is at the top-left corner.
+ */
+CV_EXPORTS_W void putText( InputOutputArray img, const String& text, Point org,
+                         int fontFace, double fontScale, Scalar color,
+                         int thickness = 1, int lineType = LINE_8,
+                         bool bottomLeftOrigin = false );
+
+/** @brief Calculates the width and height of a text string.
+
+The function getTextSize calculates and returns the size of a box that contains the specified text.
+That is, the following code renders some text, the tight box surrounding it, and the baseline: :
+@code
+    String text = "Funny text inside the box";
+    int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX;
+    double fontScale = 2;
+    int thickness = 3;
+
+    Mat img(600, 800, CV_8UC3, Scalar::all(0));
+
+    int baseline=0;
+    Size textSize = getTextSize(text, fontFace,
+                                fontScale, thickness, &baseline);
+    baseline += thickness;
+
+    // center the text
+    Point textOrg((img.cols - textSize.width)/2,
+                  (img.rows + textSize.height)/2);
+
+    // draw the box
+    rectangle(img, textOrg + Point(0, baseline),
+              textOrg + Point(textSize.width, -textSize.height),
+              Scalar(0,0,255));
+    // ... and the baseline first
+    line(img, textOrg + Point(0, thickness),
+         textOrg + Point(textSize.width, thickness),
+         Scalar(0, 0, 255));
+
+    // then put the text itself
+    putText(img, text, textOrg, fontFace, fontScale,
+            Scalar::all(255), thickness, 8);
+@endcode
+
+@param text Input text string.
+@param fontFace Font to use, see cv::HersheyFonts.
+@param fontScale Font scale factor that is multiplied by the font-specific base size.
+@param thickness Thickness of lines used to render the text. See putText for details.
+@param[out] baseLine y-coordinate of the baseline relative to the bottom-most text
+point.
+@return The size of a box that contains the specified text.
+
+@see cv::putText
+ */
+CV_EXPORTS_W Size getTextSize(const String& text, int fontFace,
+                            double fontScale, int thickness,
+                            CV_OUT int* baseLine);
+
+/** @brief Line iterator
+
+The class is used to iterate over all the pixels on the raster line
+segment connecting two specified points.
+
+The class LineIterator is used to get each pixel of a raster line. It
+can be treated as versatile implementation of the Bresenham algorithm
+where you can stop at each pixel and do some extra processing, for
+example, grab pixel values along the line or draw a line with an effect
+(for example, with XOR operation).
+
+The number of pixels along the line is stored in LineIterator::count.
+The method LineIterator::pos returns the current position in the image:
+
+@code{.cpp}
+// grabs pixels along the line (pt1, pt2)
+// from 8-bit 3-channel image to the buffer
+LineIterator it(img, pt1, pt2, 8);
+LineIterator it2 = it;
+vector<Vec3b> buf(it.count);
+
+for(int i = 0; i < it.count; i++, ++it)
+    buf[i] = *(const Vec3b)*it;
+
+// alternative way of iterating through the line
+for(int i = 0; i < it2.count; i++, ++it2)
+{
+    Vec3b val = img.at<Vec3b>(it2.pos());
+    CV_Assert(buf[i] == val);
+}
+@endcode
+*/
+class CV_EXPORTS LineIterator
+{
+public:
+    /** @brief intializes the iterator
+
+    creates iterators for the line connecting pt1 and pt2
+    the line will be clipped on the image boundaries
+    the line is 8-connected or 4-connected
+    If leftToRight=true, then the iteration is always done
+    from the left-most point to the right most,
+    not to depend on the ordering of pt1 and pt2 parameters
+    */
+    LineIterator( const Mat& img, Point pt1, Point pt2,
+                  int connectivity = 8, bool leftToRight = false );
+    /** @brief returns pointer to the current pixel
+    */
+    uchar* operator *();
+    /** @brief prefix increment operator (++it). shifts iterator to the next pixel
+    */
+    LineIterator& operator ++();
+    /** @brief postfix increment operator (it++). shifts iterator to the next pixel
+    */
+    LineIterator operator ++(int);
+    /** @brief returns coordinates of the current pixel
+    */
+    Point pos() const;
+
+    uchar* ptr;
+    const uchar* ptr0;
+    int step, elemSize;
+    int err, count;
+    int minusDelta, plusDelta;
+    int minusStep, plusStep;
+};
+
+//! @cond IGNORED
+
+// === LineIterator implementation ===
+
+inline
+uchar* LineIterator::operator *()
+{
+    return ptr;
+}
+
+inline
+LineIterator& LineIterator::operator ++()
+{
+    int mask = err < 0 ? -1 : 0;
+    err += minusDelta + (plusDelta & mask);
+    ptr += minusStep + (plusStep & mask);
+    return *this;
+}
+
+inline
+LineIterator LineIterator::operator ++(int)
+{
+    LineIterator it = *this;
+    ++(*this);
+    return it;
+}
+
+inline
+Point LineIterator::pos() const
+{
+    Point p;
+    p.y = (int)((ptr - ptr0)/step);
+    p.x = (int)(((ptr - ptr0) - p.y*step)/elemSize);
+    return p;
+}
+
+//! @endcond
+
+//! @} imgproc_draw
+
+//! @} imgproc
+
+} // cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/imgproc/imgproc_c.h"
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp
new file mode 100644
index 0000000..ca29304
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp
@@ -0,0 +1,123 @@
+/*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*/
+
+#ifndef __OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP__
+#define __OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP__
+
+//! @cond IGNORED
+
+namespace cv { namespace detail {
+/**
+Computes the matrix for the projection onto a tilted image sensor
+\param tauX angular parameter rotation around x-axis
+\param tauY angular parameter rotation around y-axis
+\param matTilt if not NULL returns the matrix
+\f[
+\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)}
+{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)}
+{0}{0}{1} R(\tau_x, \tau_y)
+\f]
+where
+\f[
+R(\tau_x, \tau_y) =
+\vecthreethree{\cos(\tau_y)}{0}{-\sin(\tau_y)}{0}{1}{0}{\sin(\tau_y)}{0}{\cos(\tau_y)}
+\vecthreethree{1}{0}{0}{0}{\cos(\tau_x)}{\sin(\tau_x)}{0}{-\sin(\tau_x)}{\cos(\tau_x)} =
+\vecthreethree{\cos(\tau_y)}{\sin(\tau_y)\sin(\tau_x)}{-\sin(\tau_y)\cos(\tau_x)}
+{0}{\cos(\tau_x)}{\sin(\tau_x)}
+{\sin(\tau_y)}{-\cos(\tau_y)\sin(\tau_x)}{\cos(\tau_y)\cos(\tau_x)}.
+\f]
+\param dMatTiltdTauX if not NULL it returns the derivative of matTilt with
+respect to \f$\tau_x\f$.
+\param dMatTiltdTauY if not NULL it returns the derivative of matTilt with
+respect to \f$\tau_y\f$.
+\param invMatTilt if not NULL it returns the inverse of matTilt
+**/
+template <typename FLOAT>
+void computeTiltProjectionMatrix(FLOAT tauX,
+    FLOAT tauY,
+    Matx<FLOAT, 3, 3>* matTilt = 0,
+    Matx<FLOAT, 3, 3>* dMatTiltdTauX = 0,
+    Matx<FLOAT, 3, 3>* dMatTiltdTauY = 0,
+    Matx<FLOAT, 3, 3>* invMatTilt = 0)
+{
+    FLOAT cTauX = cos(tauX);
+    FLOAT sTauX = sin(tauX);
+    FLOAT cTauY = cos(tauY);
+    FLOAT sTauY = sin(tauY);
+    Matx<FLOAT, 3, 3> matRotX = Matx<FLOAT, 3, 3>(1,0,0,0,cTauX,sTauX,0,-sTauX,cTauX);
+    Matx<FLOAT, 3, 3> matRotY = Matx<FLOAT, 3, 3>(cTauY,0,-sTauY,0,1,0,sTauY,0,cTauY);
+    Matx<FLOAT, 3, 3> matRotXY = matRotY * matRotX;
+    Matx<FLOAT, 3, 3> matProjZ = Matx<FLOAT, 3, 3>(matRotXY(2,2),0,-matRotXY(0,2),0,matRotXY(2,2),-matRotXY(1,2),0,0,1);
+    if (matTilt)
+    {
+        // Matrix for trapezoidal distortion of tilted image sensor
+        *matTilt = matProjZ * matRotXY;
+    }
+    if (dMatTiltdTauX)
+    {
+        // Derivative with respect to tauX
+        Matx<FLOAT, 3, 3> dMatRotXYdTauX = matRotY * Matx<FLOAT, 3, 3>(0,0,0,0,-sTauX,cTauX,0,-cTauX,-sTauX);
+        Matx<FLOAT, 3, 3> dMatProjZdTauX = Matx<FLOAT, 3, 3>(dMatRotXYdTauX(2,2),0,-dMatRotXYdTauX(0,2),
+          0,dMatRotXYdTauX(2,2),-dMatRotXYdTauX(1,2),0,0,0);
+        *dMatTiltdTauX = (matProjZ * dMatRotXYdTauX) + (dMatProjZdTauX * matRotXY);
+    }
+    if (dMatTiltdTauY)
+    {
+        // Derivative with respect to tauY
+        Matx<FLOAT, 3, 3> dMatRotXYdTauY = Matx<FLOAT, 3, 3>(-sTauY,0,-cTauY,0,0,0,cTauY,0,-sTauY) * matRotX;
+        Matx<FLOAT, 3, 3> dMatProjZdTauY = Matx<FLOAT, 3, 3>(dMatRotXYdTauY(2,2),0,-dMatRotXYdTauY(0,2),
+          0,dMatRotXYdTauY(2,2),-dMatRotXYdTauY(1,2),0,0,0);
+        *dMatTiltdTauY = (matProjZ * dMatRotXYdTauY) + (dMatProjZdTauY * matRotXY);
+    }
+    if (invMatTilt)
+    {
+        FLOAT inv = 1./matRotXY(2,2);
+        Matx<FLOAT, 3, 3> invMatProjZ = Matx<FLOAT, 3, 3>(inv,0,inv*matRotXY(0,2),0,inv,inv*matRotXY(1,2),0,0,1);
+        *invMatTilt = matRotXY.t()*invMatProjZ;
+    }
+}
+}} // namespace detail, cv
+
+
+//! @endcond
+
+#endif // __OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp
new file mode 100644
index 0000000..4175bd0
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/imgproc.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h
new file mode 100644
index 0000000..87518d7
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h
@@ -0,0 +1,1210 @@
+/*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*/
+
+#ifndef __OPENCV_IMGPROC_IMGPROC_C_H__
+#define __OPENCV_IMGPROC_IMGPROC_C_H__
+
+#include "opencv2/imgproc/types_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup imgproc_c
+@{
+*/
+
+/*********************** Background statistics accumulation *****************************/
+
+/** @brief Adds image to accumulator
+@see cv::accumulate
+*/
+CVAPI(void)  cvAcc( const CvArr* image, CvArr* sum,
+                   const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Adds squared image to accumulator
+@see cv::accumulateSquare
+*/
+CVAPI(void)  cvSquareAcc( const CvArr* image, CvArr* sqsum,
+                         const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Adds a product of two images to accumulator
+@see cv::accumulateProduct
+*/
+CVAPI(void)  cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc,
+                           const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha
+@see cv::accumulateWeighted
+*/
+CVAPI(void)  cvRunningAvg( const CvArr* image, CvArr* acc, double alpha,
+                          const CvArr* mask CV_DEFAULT(NULL) );
+
+/****************************************************************************************\
+*                                    Image Processing                                    *
+\****************************************************************************************/
+
+/** Copies source 2D array inside of the larger destination array and
+   makes a border of the specified type (IPL_BORDER_*) around the copied area. */
+CVAPI(void) cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset,
+                              int bordertype, CvScalar value CV_DEFAULT(cvScalarAll(0)));
+
+/** @brief Smooths the image in one of several ways.
+
+@param src The source image
+@param dst The destination image
+@param smoothtype Type of the smoothing, see SmoothMethod_c
+@param size1 The first parameter of the smoothing operation, the aperture width. Must be a
+positive odd number (1, 3, 5, ...)
+@param size2 The second parameter of the smoothing operation, the aperture height. Ignored by
+CV_MEDIAN and CV_BILATERAL methods. In the case of simple scaled/non-scaled and Gaussian blur if
+size2 is zero, it is set to size1. Otherwise it must be a positive odd number.
+@param sigma1 In the case of a Gaussian parameter this parameter may specify Gaussian \f$\sigma\f$
+(standard deviation). If it is zero, it is calculated from the kernel size:
+\f[\sigma  = 0.3 (n/2 - 1) + 0.8  \quad   \text{where}   \quad  n= \begin{array}{l l} \mbox{\texttt{size1} for horizontal kernel} \\ \mbox{\texttt{size2} for vertical kernel} \end{array}\f]
+Using standard sigma for small kernels ( \f$3\times 3\f$ to \f$7\times 7\f$ ) gives better speed. If
+sigma1 is not zero, while size1 and size2 are zeros, the kernel size is calculated from the
+sigma (to provide accurate enough operation).
+@param sigma2 additional parameter for bilateral filtering
+
+@see cv::GaussianBlur, cv::blur, cv::medianBlur, cv::bilateralFilter.
+ */
+CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst,
+                      int smoothtype CV_DEFAULT(CV_GAUSSIAN),
+                      int size1 CV_DEFAULT(3),
+                      int size2 CV_DEFAULT(0),
+                      double sigma1 CV_DEFAULT(0),
+                      double sigma2 CV_DEFAULT(0));
+
+/** @brief Convolves an image with the kernel.
+
+@param src input image.
+@param dst output image of the same size and the same number of channels as src.
+@param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
+matrix; if you want to apply different kernels to different channels, split the image into
+separate color planes using split and process them individually.
+@param anchor anchor of the kernel that indicates the relative position of a filtered point within
+the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
+is at the kernel center.
+
+@see cv::filter2D
+ */
+CVAPI(void) cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel,
+                        CvPoint anchor CV_DEFAULT(cvPoint(-1,-1)));
+
+/** @brief Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y)
+@see cv::integral
+*/
+CVAPI(void) cvIntegral( const CvArr* image, CvArr* sum,
+                       CvArr* sqsum CV_DEFAULT(NULL),
+                       CvArr* tilted_sum CV_DEFAULT(NULL));
+
+/** @brief Smoothes the input image with gaussian kernel and then down-samples it.
+
+   dst_width = floor(src_width/2)[+1],
+   dst_height = floor(src_height/2)[+1]
+   @see cv::pyrDown
+*/
+CVAPI(void)  cvPyrDown( const CvArr* src, CvArr* dst,
+                        int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
+
+/** @brief Up-samples image and smoothes the result with gaussian kernel.
+
+   dst_width = src_width*2,
+   dst_height = src_height*2
+   @see cv::pyrUp
+*/
+CVAPI(void)  cvPyrUp( const CvArr* src, CvArr* dst,
+                      int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
+
+/** @brief Builds pyramid for an image
+@see buildPyramid
+*/
+CVAPI(CvMat**) cvCreatePyramid( const CvArr* img, int extra_layers, double rate,
+                                const CvSize* layer_sizes CV_DEFAULT(0),
+                                CvArr* bufarr CV_DEFAULT(0),
+                                int calc CV_DEFAULT(1),
+                                int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
+
+/** @brief Releases pyramid */
+CVAPI(void)  cvReleasePyramid( CvMat*** pyramid, int extra_layers );
+
+
+/** @brief Filters image using meanshift algorithm
+@see cv::pyrMeanShiftFiltering
+*/
+CVAPI(void) cvPyrMeanShiftFiltering( const CvArr* src, CvArr* dst,
+    double sp, double sr, int max_level CV_DEFAULT(1),
+    CvTermCriteria termcrit CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,5,1)));
+
+/** @brief Segments image using seed "markers"
+@see cv::watershed
+*/
+CVAPI(void) cvWatershed( const CvArr* image, CvArr* markers );
+
+/** @brief Calculates an image derivative using generalized Sobel
+
+   (aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator.
+   Scharr can be used only for the first dx or dy derivative
+@see cv::Sobel
+*/
+CVAPI(void) cvSobel( const CvArr* src, CvArr* dst,
+                    int xorder, int yorder,
+                    int aperture_size CV_DEFAULT(3));
+
+/** @brief Calculates the image Laplacian: (d2/dx + d2/dy)I
+@see cv::Laplacian
+*/
+CVAPI(void) cvLaplace( const CvArr* src, CvArr* dst,
+                      int aperture_size CV_DEFAULT(3) );
+
+/** @brief Converts input array pixels from one color space to another
+@see cv::cvtColor
+*/
+CVAPI(void)  cvCvtColor( const CvArr* src, CvArr* dst, int code );
+
+
+/** @brief Resizes image (input array is resized to fit the destination array)
+@see cv::resize
+*/
+CVAPI(void)  cvResize( const CvArr* src, CvArr* dst,
+                       int interpolation CV_DEFAULT( CV_INTER_LINEAR ));
+
+/** @brief Warps image with affine transform
+@note ::cvGetQuadrangleSubPix is similar to ::cvWarpAffine, but the outliers are extrapolated using
+replication border mode.
+@see cv::warpAffine
+*/
+CVAPI(void)  cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
+                           int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
+                           CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
+
+/** @brief Computes affine transform matrix for mapping src[i] to dst[i] (i=0,1,2)
+@see cv::getAffineTransform
+*/
+CVAPI(CvMat*) cvGetAffineTransform( const CvPoint2D32f * src,
+                                    const CvPoint2D32f * dst,
+                                    CvMat * map_matrix );
+
+/** @brief Computes rotation_matrix matrix
+@see cv::getRotationMatrix2D
+*/
+CVAPI(CvMat*)  cv2DRotationMatrix( CvPoint2D32f center, double angle,
+                                   double scale, CvMat* map_matrix );
+
+/** @brief Warps image with perspective (projective) transform
+@see cv::warpPerspective
+*/
+CVAPI(void)  cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
+                                int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
+                                CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
+
+/** @brief Computes perspective transform matrix for mapping src[i] to dst[i] (i=0,1,2,3)
+@see cv::getPerspectiveTransform
+*/
+CVAPI(CvMat*) cvGetPerspectiveTransform( const CvPoint2D32f* src,
+                                         const CvPoint2D32f* dst,
+                                         CvMat* map_matrix );
+
+/** @brief Performs generic geometric transformation using the specified coordinate maps
+@see cv::remap
+*/
+CVAPI(void)  cvRemap( const CvArr* src, CvArr* dst,
+                      const CvArr* mapx, const CvArr* mapy,
+                      int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
+                      CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
+
+/** @brief Converts mapx & mapy from floating-point to integer formats for cvRemap
+@see cv::convertMaps
+*/
+CVAPI(void)  cvConvertMaps( const CvArr* mapx, const CvArr* mapy,
+                            CvArr* mapxy, CvArr* mapalpha );
+
+/** @brief Performs forward or inverse log-polar image transform
+@see cv::logPolar
+*/
+CVAPI(void)  cvLogPolar( const CvArr* src, CvArr* dst,
+                         CvPoint2D32f center, double M,
+                         int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
+
+/** Performs forward or inverse linear-polar image transform
+@see cv::linearPolar
+*/
+CVAPI(void)  cvLinearPolar( const CvArr* src, CvArr* dst,
+                         CvPoint2D32f center, double maxRadius,
+                         int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
+
+/** @brief Transforms the input image to compensate lens distortion
+@see cv::undistort
+*/
+CVAPI(void) cvUndistort2( const CvArr* src, CvArr* dst,
+                          const CvMat* camera_matrix,
+                          const CvMat* distortion_coeffs,
+                          const CvMat* new_camera_matrix CV_DEFAULT(0) );
+
+/** @brief Computes transformation map from intrinsic camera parameters
+   that can used by cvRemap
+*/
+CVAPI(void) cvInitUndistortMap( const CvMat* camera_matrix,
+                                const CvMat* distortion_coeffs,
+                                CvArr* mapx, CvArr* mapy );
+
+/** @brief Computes undistortion+rectification map for a head of stereo camera
+@see cv::initUndistortRectifyMap
+*/
+CVAPI(void) cvInitUndistortRectifyMap( const CvMat* camera_matrix,
+                                       const CvMat* dist_coeffs,
+                                       const CvMat *R, const CvMat* new_camera_matrix,
+                                       CvArr* mapx, CvArr* mapy );
+
+/** @brief Computes the original (undistorted) feature coordinates
+   from the observed (distorted) coordinates
+@see cv::undistortPoints
+*/
+CVAPI(void) cvUndistortPoints( const CvMat* src, CvMat* dst,
+                               const CvMat* camera_matrix,
+                               const CvMat* dist_coeffs,
+                               const CvMat* R CV_DEFAULT(0),
+                               const CvMat* P CV_DEFAULT(0));
+
+/** @brief Returns a structuring element of the specified size and shape for morphological operations.
+
+@note the created structuring element IplConvKernel\* element must be released in the end using
+`cvReleaseStructuringElement(&element)`.
+
+@param cols Width of the structuring element
+@param rows Height of the structuring element
+@param anchor_x x-coordinate of the anchor
+@param anchor_y y-coordinate of the anchor
+@param shape element shape that could be one of the cv::MorphShapes_c
+@param values integer array of cols*rows elements that specifies the custom shape of the
+structuring element, when shape=CV_SHAPE_CUSTOM.
+
+@see cv::getStructuringElement
+ */
+ CVAPI(IplConvKernel*)  cvCreateStructuringElementEx(
+            int cols, int  rows, int  anchor_x, int  anchor_y,
+            int shape, int* values CV_DEFAULT(NULL) );
+
+/** @brief releases structuring element
+@see cvCreateStructuringElementEx
+*/
+CVAPI(void)  cvReleaseStructuringElement( IplConvKernel** element );
+
+/** @brief erodes input image (applies minimum filter) one or more times.
+   If element pointer is NULL, 3x3 rectangular element is used
+@see cv::erode
+*/
+CVAPI(void)  cvErode( const CvArr* src, CvArr* dst,
+                      IplConvKernel* element CV_DEFAULT(NULL),
+                      int iterations CV_DEFAULT(1) );
+
+/** @brief dilates input image (applies maximum filter) one or more times.
+
+   If element pointer is NULL, 3x3 rectangular element is used
+@see cv::dilate
+*/
+CVAPI(void)  cvDilate( const CvArr* src, CvArr* dst,
+                       IplConvKernel* element CV_DEFAULT(NULL),
+                       int iterations CV_DEFAULT(1) );
+
+/** @brief Performs complex morphological transformation
+@see cv::morphologyEx
+*/
+CVAPI(void)  cvMorphologyEx( const CvArr* src, CvArr* dst,
+                             CvArr* temp, IplConvKernel* element,
+                             int operation, int iterations CV_DEFAULT(1) );
+
+/** @brief Calculates all spatial and central moments up to the 3rd order
+@see cv::moments
+*/
+CVAPI(void) cvMoments( const CvArr* arr, CvMoments* moments, int binary CV_DEFAULT(0));
+
+/** @brief Retrieve spatial moments */
+CVAPI(double)  cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order );
+/** @brief Retrieve central moments */
+CVAPI(double)  cvGetCentralMoment( CvMoments* moments, int x_order, int y_order );
+/** @brief Retrieve normalized central moments */
+CVAPI(double)  cvGetNormalizedCentralMoment( CvMoments* moments,
+                                             int x_order, int y_order );
+
+/** @brief Calculates 7 Hu's invariants from precalculated spatial and central moments
+@see cv::HuMoments
+*/
+CVAPI(void) cvGetHuMoments( CvMoments*  moments, CvHuMoments*  hu_moments );
+
+/*********************************** data sampling **************************************/
+
+/** @brief Fetches pixels that belong to the specified line segment and stores them to the buffer.
+
+   Returns the number of retrieved points.
+@see cv::LineSegmentDetector
+*/
+CVAPI(int)  cvSampleLine( const CvArr* image, CvPoint pt1, CvPoint pt2, void* buffer,
+                          int connectivity CV_DEFAULT(8));
+
+/** @brief Retrieves the rectangular image region with specified center from the input array.
+
+ dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2).
+ Values of pixels with fractional coordinates are retrieved using bilinear interpolation
+@see cv::getRectSubPix
+*/
+CVAPI(void)  cvGetRectSubPix( const CvArr* src, CvArr* dst, CvPoint2D32f center );
+
+
+/** @brief Retrieves quadrangle from the input array.
+
+    matrixarr = ( a11  a12 | b1 )   dst(x,y) <- src(A[x y]' + b)
+                ( a21  a22 | b2 )   (bilinear interpolation is used to retrieve pixels
+                                     with fractional coordinates)
+@see cvWarpAffine
+*/
+CVAPI(void)  cvGetQuadrangleSubPix( const CvArr* src, CvArr* dst,
+                                    const CvMat* map_matrix );
+
+/** @brief Measures similarity between template and overlapped windows in the source image
+   and fills the resultant image with the measurements
+@see cv::matchTemplate
+*/
+CVAPI(void)  cvMatchTemplate( const CvArr* image, const CvArr* templ,
+                              CvArr* result, int method );
+
+/** @brief Computes earth mover distance between
+   two weighted point sets (called signatures)
+@see cv::EMD
+*/
+CVAPI(float)  cvCalcEMD2( const CvArr* signature1,
+                          const CvArr* signature2,
+                          int distance_type,
+                          CvDistanceFunction distance_func CV_DEFAULT(NULL),
+                          const CvArr* cost_matrix CV_DEFAULT(NULL),
+                          CvArr* flow CV_DEFAULT(NULL),
+                          float* lower_bound CV_DEFAULT(NULL),
+                          void* userdata CV_DEFAULT(NULL));
+
+/****************************************************************************************\
+*                              Contours retrieving                                       *
+\****************************************************************************************/
+
+/** @brief Retrieves outer and optionally inner boundaries of white (non-zero) connected
+   components in the black (zero) background
+@see cv::findContours, cvStartFindContours, cvFindNextContour, cvSubstituteContour, cvEndFindContours
+*/
+CVAPI(int)  cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** first_contour,
+                            int header_size CV_DEFAULT(sizeof(CvContour)),
+                            int mode CV_DEFAULT(CV_RETR_LIST),
+                            int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
+                            CvPoint offset CV_DEFAULT(cvPoint(0,0)));
+
+/** @brief Initializes contour retrieving process.
+
+   Calls cvStartFindContours.
+   Calls cvFindNextContour until null pointer is returned
+   or some other condition becomes true.
+   Calls cvEndFindContours at the end.
+@see cvFindContours
+*/
+CVAPI(CvContourScanner)  cvStartFindContours( CvArr* image, CvMemStorage* storage,
+                            int header_size CV_DEFAULT(sizeof(CvContour)),
+                            int mode CV_DEFAULT(CV_RETR_LIST),
+                            int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
+                            CvPoint offset CV_DEFAULT(cvPoint(0,0)));
+
+/** @brief Retrieves next contour
+@see cvFindContours
+*/
+CVAPI(CvSeq*)  cvFindNextContour( CvContourScanner scanner );
+
+
+/** @brief Substitutes the last retrieved contour with the new one
+
+   (if the substitutor is null, the last retrieved contour is removed from the tree)
+@see cvFindContours
+*/
+CVAPI(void)   cvSubstituteContour( CvContourScanner scanner, CvSeq* new_contour );
+
+
+/** @brief Releases contour scanner and returns pointer to the first outer contour
+@see cvFindContours
+*/
+CVAPI(CvSeq*)  cvEndFindContours( CvContourScanner* scanner );
+
+/** @brief Approximates Freeman chain(s) with a polygonal curve.
+
+This is a standalone contour approximation routine, not represented in the new interface. When
+cvFindContours retrieves contours as Freeman chains, it calls the function to get approximated
+contours, represented as polygons.
+
+@param src_seq Pointer to the approximated Freeman chain that can refer to other chains.
+@param storage Storage location for the resulting polylines.
+@param method Approximation method (see the description of the function :ocvFindContours ).
+@param parameter Method parameter (not used now).
+@param minimal_perimeter Approximates only those contours whose perimeters are not less than
+minimal_perimeter . Other chains are removed from the resulting structure.
+@param recursive Recursion flag. If it is non-zero, the function approximates all chains that can
+be obtained from chain by using the h_next or v_next links. Otherwise, the single input chain is
+approximated.
+@see cvStartReadChainPoints, cvReadChainPoint
+ */
+CVAPI(CvSeq*) cvApproxChains( CvSeq* src_seq, CvMemStorage* storage,
+                            int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
+                            double parameter CV_DEFAULT(0),
+                            int  minimal_perimeter CV_DEFAULT(0),
+                            int  recursive CV_DEFAULT(0));
+
+/** @brief Initializes Freeman chain reader.
+
+   The reader is used to iteratively get coordinates of all the chain points.
+   If the Freeman codes should be read as is, a simple sequence reader should be used
+@see cvApproxChains
+*/
+CVAPI(void) cvStartReadChainPoints( CvChain* chain, CvChainPtReader* reader );
+
+/** @brief Retrieves the next chain point
+@see cvApproxChains
+*/
+CVAPI(CvPoint) cvReadChainPoint( CvChainPtReader* reader );
+
+
+/****************************************************************************************\
+*                            Contour Processing and Shape Analysis                       *
+\****************************************************************************************/
+
+/** @brief Approximates a single polygonal curve (contour) or
+   a tree of polygonal curves (contours)
+@see cv::approxPolyDP
+*/
+CVAPI(CvSeq*)  cvApproxPoly( const void* src_seq,
+                             int header_size, CvMemStorage* storage,
+                             int method, double eps,
+                             int recursive CV_DEFAULT(0));
+
+/** @brief Calculates perimeter of a contour or length of a part of contour
+@see cv::arcLength
+*/
+CVAPI(double)  cvArcLength( const void* curve,
+                            CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
+                            int is_closed CV_DEFAULT(-1));
+
+/** same as cvArcLength for closed contour
+*/
+CV_INLINE double cvContourPerimeter( const void* contour )
+{
+    return cvArcLength( contour, CV_WHOLE_SEQ, 1 );
+}
+
+
+/** @brief Calculates contour bounding rectangle (update=1) or
+   just retrieves pre-calculated rectangle (update=0)
+@see cv::boundingRect
+*/
+CVAPI(CvRect)  cvBoundingRect( CvArr* points, int update CV_DEFAULT(0) );
+
+/** @brief Calculates area of a contour or contour segment
+@see cv::contourArea
+*/
+CVAPI(double)  cvContourArea( const CvArr* contour,
+                              CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
+                              int oriented CV_DEFAULT(0));
+
+/** @brief Finds minimum area rotated rectangle bounding a set of points
+@see cv::minAreaRect
+*/
+CVAPI(CvBox2D)  cvMinAreaRect2( const CvArr* points,
+                                CvMemStorage* storage CV_DEFAULT(NULL));
+
+/** @brief Finds minimum enclosing circle for a set of points
+@see cv::minEnclosingCircle
+*/
+CVAPI(int)  cvMinEnclosingCircle( const CvArr* points,
+                                  CvPoint2D32f* center, float* radius );
+
+/** @brief Compares two contours by matching their moments
+@see cv::matchShapes
+*/
+CVAPI(double)  cvMatchShapes( const void* object1, const void* object2,
+                              int method, double parameter CV_DEFAULT(0));
+
+/** @brief Calculates exact convex hull of 2d point set
+@see cv::convexHull
+*/
+CVAPI(CvSeq*) cvConvexHull2( const CvArr* input,
+                             void* hull_storage CV_DEFAULT(NULL),
+                             int orientation CV_DEFAULT(CV_CLOCKWISE),
+                             int return_points CV_DEFAULT(0));
+
+/** @brief Checks whether the contour is convex or not (returns 1 if convex, 0 if not)
+@see cv::isContourConvex
+*/
+CVAPI(int)  cvCheckContourConvexity( const CvArr* contour );
+
+
+/** @brief Finds convexity defects for the contour
+@see cv::convexityDefects
+*/
+CVAPI(CvSeq*)  cvConvexityDefects( const CvArr* contour, const CvArr* convexhull,
+                                   CvMemStorage* storage CV_DEFAULT(NULL));
+
+/** @brief Fits ellipse into a set of 2d points
+@see cv::fitEllipse
+*/
+CVAPI(CvBox2D) cvFitEllipse2( const CvArr* points );
+
+/** @brief Finds minimum rectangle containing two given rectangles */
+CVAPI(CvRect)  cvMaxRect( const CvRect* rect1, const CvRect* rect2 );
+
+/** @brief Finds coordinates of the box vertices */
+CVAPI(void) cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] );
+
+/** @brief Initializes sequence header for a matrix (column or row vector) of points
+
+   a wrapper for cvMakeSeqHeaderForArray (it does not initialize bounding rectangle!!!) */
+CVAPI(CvSeq*) cvPointSeqFromMat( int seq_kind, const CvArr* mat,
+                                 CvContour* contour_header,
+                                 CvSeqBlock* block );
+
+/** @brief Checks whether the point is inside polygon, outside, on an edge (at a vertex).
+
+   Returns positive, negative or zero value, correspondingly.
+   Optionally, measures a signed distance between
+   the point and the nearest polygon edge (measure_dist=1)
+@see cv::pointPolygonTest
+*/
+CVAPI(double) cvPointPolygonTest( const CvArr* contour,
+                                  CvPoint2D32f pt, int measure_dist );
+
+/****************************************************************************************\
+*                                  Histogram functions                                   *
+\****************************************************************************************/
+
+/** @brief Creates a histogram.
+
+The function creates a histogram of the specified size and returns a pointer to the created
+histogram. If the array ranges is 0, the histogram bin ranges must be specified later via the
+function cvSetHistBinRanges. Though cvCalcHist and cvCalcBackProject may process 8-bit images
+without setting bin ranges, they assume they are equally spaced in 0 to 255 bins.
+
+@param dims Number of histogram dimensions.
+@param sizes Array of the histogram dimension sizes.
+@param type Histogram representation format. CV_HIST_ARRAY means that the histogram data is
+represented as a multi-dimensional dense array CvMatND. CV_HIST_SPARSE means that histogram data
+is represented as a multi-dimensional sparse array CvSparseMat.
+@param ranges Array of ranges for the histogram bins. Its meaning depends on the uniform parameter
+value. The ranges are used when the histogram is calculated or backprojected to determine which
+histogram bin corresponds to which value/tuple of values from the input image(s).
+@param uniform Uniformity flag. If not zero, the histogram has evenly spaced bins and for every
+\f$0<=i<cDims\f$ ranges[i] is an array of two numbers: lower and upper boundaries for the i-th
+histogram dimension. The whole range [lower,upper] is then split into dims[i] equal parts to
+determine the i-th input tuple value ranges for every histogram bin. And if uniform=0 , then the
+i-th element of the ranges array contains dims[i]+1 elements: \f$\texttt{lower}_0,
+\texttt{upper}_0, \texttt{lower}_1, \texttt{upper}_1 = \texttt{lower}_2,
+...
+\texttt{upper}_{dims[i]-1}\f$ where \f$\texttt{lower}_j\f$ and \f$\texttt{upper}_j\f$ are lower
+and upper boundaries of the i-th input tuple value for the j-th bin, respectively. In either
+case, the input values that are beyond the specified range for a histogram bin are not counted
+by cvCalcHist and filled with 0 by cvCalcBackProject.
+ */
+CVAPI(CvHistogram*)  cvCreateHist( int dims, int* sizes, int type,
+                                   float** ranges CV_DEFAULT(NULL),
+                                   int uniform CV_DEFAULT(1));
+
+/** @brief Sets the bounds of the histogram bins.
+
+This is a standalone function for setting bin ranges in the histogram. For a more detailed
+description of the parameters ranges and uniform, see the :ocvCalcHist function that can initialize
+the ranges as well. Ranges for the histogram bins must be set before the histogram is calculated or
+the backproject of the histogram is calculated.
+
+@param hist Histogram.
+@param ranges Array of bin ranges arrays. See :ocvCreateHist for details.
+@param uniform Uniformity flag. See :ocvCreateHist for details.
+ */
+CVAPI(void)  cvSetHistBinRanges( CvHistogram* hist, float** ranges,
+                                int uniform CV_DEFAULT(1));
+
+/** @brief Makes a histogram out of an array.
+
+The function initializes the histogram, whose header and bins are allocated by the user.
+cvReleaseHist does not need to be called afterwards. Only dense histograms can be initialized this
+way. The function returns hist.
+
+@param dims Number of the histogram dimensions.
+@param sizes Array of the histogram dimension sizes.
+@param hist Histogram header initialized by the function.
+@param data Array used to store histogram bins.
+@param ranges Histogram bin ranges. See cvCreateHist for details.
+@param uniform Uniformity flag. See cvCreateHist for details.
+ */
+CVAPI(CvHistogram*)  cvMakeHistHeaderForArray(
+                            int  dims, int* sizes, CvHistogram* hist,
+                            float* data, float** ranges CV_DEFAULT(NULL),
+                            int uniform CV_DEFAULT(1));
+
+/** @brief Releases the histogram.
+
+The function releases the histogram (header and the data). The pointer to the histogram is cleared
+by the function. If \*hist pointer is already NULL, the function does nothing.
+
+@param hist Double pointer to the released histogram.
+ */
+CVAPI(void)  cvReleaseHist( CvHistogram** hist );
+
+/** @brief Clears the histogram.
+
+The function sets all of the histogram bins to 0 in case of a dense histogram and removes all
+histogram bins in case of a sparse array.
+
+@param hist Histogram.
+ */
+CVAPI(void)  cvClearHist( CvHistogram* hist );
+
+/** @brief Finds the minimum and maximum histogram bins.
+
+The function finds the minimum and maximum histogram bins and their positions. All of output
+arguments are optional. Among several extremas with the same value the ones with the minimum index
+(in the lexicographical order) are returned. In case of several maximums or minimums, the earliest
+in the lexicographical order (extrema locations) is returned.
+
+@param hist Histogram.
+@param min_value Pointer to the minimum value of the histogram.
+@param max_value Pointer to the maximum value of the histogram.
+@param min_idx Pointer to the array of coordinates for the minimum.
+@param max_idx Pointer to the array of coordinates for the maximum.
+ */
+CVAPI(void)  cvGetMinMaxHistValue( const CvHistogram* hist,
+                                   float* min_value, float* max_value,
+                                   int* min_idx CV_DEFAULT(NULL),
+                                   int* max_idx CV_DEFAULT(NULL));
+
+
+/** @brief Normalizes the histogram.
+
+The function normalizes the histogram bins by scaling them so that the sum of the bins becomes equal
+to factor.
+
+@param hist Pointer to the histogram.
+@param factor Normalization factor.
+ */
+CVAPI(void)  cvNormalizeHist( CvHistogram* hist, double factor );
+
+
+/** @brief Thresholds the histogram.
+
+The function clears histogram bins that are below the specified threshold.
+
+@param hist Pointer to the histogram.
+@param threshold Threshold level.
+ */
+CVAPI(void)  cvThreshHist( CvHistogram* hist, double threshold );
+
+
+/** Compares two histogram */
+CVAPI(double)  cvCompareHist( const CvHistogram* hist1,
+                              const CvHistogram* hist2,
+                              int method);
+
+/** @brief Copies a histogram.
+
+The function makes a copy of the histogram. If the second histogram pointer \*dst is NULL, a new
+histogram of the same size as src is created. Otherwise, both histograms must have equal types and
+sizes. Then the function copies the bin values of the source histogram to the destination histogram
+and sets the same bin value ranges as in src.
+
+@param src Source histogram.
+@param dst Pointer to the destination histogram.
+ */
+CVAPI(void)  cvCopyHist( const CvHistogram* src, CvHistogram** dst );
+
+
+/** @brief Calculates bayesian probabilistic histograms
+   (each or src and dst is an array of _number_ histograms */
+CVAPI(void)  cvCalcBayesianProb( CvHistogram** src, int number,
+                                CvHistogram** dst);
+
+/** @brief Calculates array histogram
+@see cv::calcHist
+*/
+CVAPI(void)  cvCalcArrHist( CvArr** arr, CvHistogram* hist,
+                            int accumulate CV_DEFAULT(0),
+                            const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @overload */
+CV_INLINE  void  cvCalcHist( IplImage** image, CvHistogram* hist,
+                             int accumulate CV_DEFAULT(0),
+                             const CvArr* mask CV_DEFAULT(NULL) )
+{
+    cvCalcArrHist( (CvArr**)image, hist, accumulate, mask );
+}
+
+/** @brief Calculates back project
+@see cvCalcBackProject, cv::calcBackProject
+*/
+CVAPI(void)  cvCalcArrBackProject( CvArr** image, CvArr* dst,
+                                   const CvHistogram* hist );
+
+#define  cvCalcBackProject(image, dst, hist) cvCalcArrBackProject((CvArr**)image, dst, hist)
+
+
+/** @brief Locates a template within an image by using a histogram comparison.
+
+The function calculates the back projection by comparing histograms of the source image patches with
+the given histogram. The function is similar to matchTemplate, but instead of comparing the raster
+patch with all its possible positions within the search window, the function CalcBackProjectPatch
+compares histograms. See the algorithm diagram below:
+
+![image](pics/backprojectpatch.png)
+
+@param image Source images (though, you may pass CvMat\*\* as well).
+@param dst Destination image.
+@param range
+@param hist Histogram.
+@param method Comparison method passed to cvCompareHist (see the function description).
+@param factor Normalization factor for histograms that affects the normalization scale of the
+destination image. Pass 1 if not sure.
+
+@see cvCalcBackProjectPatch
+ */
+CVAPI(void)  cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range,
+                                        CvHistogram* hist, int method,
+                                        double factor );
+
+#define  cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) \
+     cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor )
+
+
+/** @brief Divides one histogram by another.
+
+The function calculates the object probability density from two histograms as:
+
+\f[\texttt{disthist} (I)= \forkthree{0}{if \(\texttt{hist1}(I)=0\)}{\texttt{scale}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) > \texttt{hist1}(I)\)}{\frac{\texttt{hist2}(I) \cdot \texttt{scale}}{\texttt{hist1}(I)}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) \le \texttt{hist1}(I)\)}\f]
+
+@param hist1 First histogram (the divisor).
+@param hist2 Second histogram.
+@param dst_hist Destination histogram.
+@param scale Scale factor for the destination histogram.
+ */
+CVAPI(void)  cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2,
+                                CvHistogram* dst_hist, double scale CV_DEFAULT(255) );
+
+/** @brief equalizes histogram of 8-bit single-channel image
+@see cv::equalizeHist
+*/
+CVAPI(void)  cvEqualizeHist( const CvArr* src, CvArr* dst );
+
+
+/** @brief Applies distance transform to binary image
+@see cv::distanceTransform
+*/
+CVAPI(void)  cvDistTransform( const CvArr* src, CvArr* dst,
+                              int distance_type CV_DEFAULT(CV_DIST_L2),
+                              int mask_size CV_DEFAULT(3),
+                              const float* mask CV_DEFAULT(NULL),
+                              CvArr* labels CV_DEFAULT(NULL),
+                              int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP));
+
+
+/** @brief Applies fixed-level threshold to grayscale image.
+
+   This is a basic operation applied before retrieving contours
+@see cv::threshold
+*/
+CVAPI(double)  cvThreshold( const CvArr*  src, CvArr*  dst,
+                            double  threshold, double  max_value,
+                            int threshold_type );
+
+/** @brief Applies adaptive threshold to grayscale image.
+
+   The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and
+   CV_ADAPTIVE_THRESH_GAUSSIAN_C are:
+   neighborhood size (3, 5, 7 etc.),
+   and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...)
+@see cv::adaptiveThreshold
+*/
+CVAPI(void)  cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value,
+                                  int adaptive_method CV_DEFAULT(CV_ADAPTIVE_THRESH_MEAN_C),
+                                  int threshold_type CV_DEFAULT(CV_THRESH_BINARY),
+                                  int block_size CV_DEFAULT(3),
+                                  double param1 CV_DEFAULT(5));
+
+/** @brief Fills the connected component until the color difference gets large enough
+@see cv::floodFill
+*/
+CVAPI(void)  cvFloodFill( CvArr* image, CvPoint seed_point,
+                          CvScalar new_val, CvScalar lo_diff CV_DEFAULT(cvScalarAll(0)),
+                          CvScalar up_diff CV_DEFAULT(cvScalarAll(0)),
+                          CvConnectedComp* comp CV_DEFAULT(NULL),
+                          int flags CV_DEFAULT(4),
+                          CvArr* mask CV_DEFAULT(NULL));
+
+/****************************************************************************************\
+*                                  Feature detection                                     *
+\****************************************************************************************/
+
+/** @brief Runs canny edge detector
+@see cv::Canny
+*/
+CVAPI(void)  cvCanny( const CvArr* image, CvArr* edges, double threshold1,
+                      double threshold2, int  aperture_size CV_DEFAULT(3) );
+
+/** @brief Calculates constraint image for corner detection
+
+   Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy.
+   Applying threshold to the result gives coordinates of corners
+@see cv::preCornerDetect
+*/
+CVAPI(void) cvPreCornerDetect( const CvArr* image, CvArr* corners,
+                               int aperture_size CV_DEFAULT(3) );
+
+/** @brief Calculates eigen values and vectors of 2x2
+   gradient covariation matrix at every image pixel
+@see cv::cornerEigenValsAndVecs
+*/
+CVAPI(void)  cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv,
+                                       int block_size, int aperture_size CV_DEFAULT(3) );
+
+/** @brief Calculates minimal eigenvalue for 2x2 gradient covariation matrix at
+   every image pixel
+@see cv::cornerMinEigenVal
+*/
+CVAPI(void)  cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval,
+                                  int block_size, int aperture_size CV_DEFAULT(3) );
+
+/** @brief Harris corner detector:
+
+   Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel
+@see cv::cornerHarris
+*/
+CVAPI(void)  cvCornerHarris( const CvArr* image, CvArr* harris_response,
+                             int block_size, int aperture_size CV_DEFAULT(3),
+                             double k CV_DEFAULT(0.04) );
+
+/** @brief Adjust corner position using some sort of gradient search
+@see cv::cornerSubPix
+*/
+CVAPI(void)  cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners,
+                                 int count, CvSize win, CvSize zero_zone,
+                                 CvTermCriteria  criteria );
+
+/** @brief Finds a sparse set of points within the selected region
+   that seem to be easy to track
+@see cv::goodFeaturesToTrack
+*/
+CVAPI(void)  cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image,
+                                    CvArr* temp_image, CvPoint2D32f* corners,
+                                    int* corner_count, double  quality_level,
+                                    double  min_distance,
+                                    const CvArr* mask CV_DEFAULT(NULL),
+                                    int block_size CV_DEFAULT(3),
+                                    int use_harris CV_DEFAULT(0),
+                                    double k CV_DEFAULT(0.04) );
+
+/** @brief Finds lines on binary image using one of several methods.
+
+   line_storage is either memory storage or 1 x _max number of lines_ CvMat, its
+   number of columns is changed by the function.
+   method is one of CV_HOUGH_*;
+   rho, theta and threshold are used for each of those methods;
+   param1 ~ line length, param2 ~ line gap - for probabilistic,
+   param1 ~ srn, param2 ~ stn - for multi-scale
+@see cv::HoughLines
+*/
+CVAPI(CvSeq*)  cvHoughLines2( CvArr* image, void* line_storage, int method,
+                              double rho, double theta, int threshold,
+                              double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0),
+                              double min_theta CV_DEFAULT(0), double max_theta CV_DEFAULT(CV_PI));
+
+/** @brief Finds circles in the image
+@see cv::HoughCircles
+*/
+CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage,
+                              int method, double dp, double min_dist,
+                              double param1 CV_DEFAULT(100),
+                              double param2 CV_DEFAULT(100),
+                              int min_radius CV_DEFAULT(0),
+                              int max_radius CV_DEFAULT(0));
+
+/** @brief Fits a line into set of 2d or 3d points in a robust way (M-estimator technique)
+@see cv::fitLine
+*/
+CVAPI(void)  cvFitLine( const CvArr* points, int dist_type, double param,
+                        double reps, double aeps, float* line );
+
+/****************************************************************************************\
+*                                     Drawing                                            *
+\****************************************************************************************/
+
+/****************************************************************************************\
+*       Drawing functions work with images/matrices of arbitrary type.                   *
+*       For color images the channel order is BGR[A]                                     *
+*       Antialiasing is supported only for 8-bit image now.                              *
+*       All the functions include parameter color that means rgb value (that may be      *
+*       constructed with CV_RGB macro) for color images and brightness                   *
+*       for grayscale images.                                                            *
+*       If a drawn figure is partially or completely outside of the image, it is clipped.*
+\****************************************************************************************/
+
+#define CV_RGB( r, g, b )  cvScalar( (b), (g), (r), 0 )
+#define CV_FILLED -1
+
+#define CV_AA 16
+
+/** @brief Draws 4-connected, 8-connected or antialiased line segment connecting two points
+@see cv::line
+*/
+CVAPI(void)  cvLine( CvArr* img, CvPoint pt1, CvPoint pt2,
+                     CvScalar color, int thickness CV_DEFAULT(1),
+                     int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
+
+/** @brief Draws a rectangle given two opposite corners of the rectangle (pt1 & pt2)
+
+   if thickness<0 (e.g. thickness == CV_FILLED), the filled box is drawn
+@see cv::rectangle
+*/
+CVAPI(void)  cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2,
+                          CvScalar color, int thickness CV_DEFAULT(1),
+                          int line_type CV_DEFAULT(8),
+                          int shift CV_DEFAULT(0));
+
+/** @brief Draws a rectangle specified by a CvRect structure
+@see cv::rectangle
+*/
+CVAPI(void)  cvRectangleR( CvArr* img, CvRect r,
+                           CvScalar color, int thickness CV_DEFAULT(1),
+                           int line_type CV_DEFAULT(8),
+                           int shift CV_DEFAULT(0));
+
+
+/** @brief Draws a circle with specified center and radius.
+
+   Thickness works in the same way as with cvRectangle
+@see cv::circle
+*/
+CVAPI(void)  cvCircle( CvArr* img, CvPoint center, int radius,
+                       CvScalar color, int thickness CV_DEFAULT(1),
+                       int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
+
+/** @brief Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector
+
+   depending on _thickness_, _start_angle_ and _end_angle_ parameters. The resultant figure
+   is rotated by _angle_. All the angles are in degrees
+@see cv::ellipse
+*/
+CVAPI(void)  cvEllipse( CvArr* img, CvPoint center, CvSize axes,
+                        double angle, double start_angle, double end_angle,
+                        CvScalar color, int thickness CV_DEFAULT(1),
+                        int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
+
+CV_INLINE  void  cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color,
+                               int thickness CV_DEFAULT(1),
+                               int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) )
+{
+    CvSize axes;
+    axes.width = cvRound(box.size.width*0.5);
+    axes.height = cvRound(box.size.height*0.5);
+
+    cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle,
+               0, 360, color, thickness, line_type, shift );
+}
+
+/** @brief Fills convex or monotonous polygon.
+@see cv::fillConvexPoly
+*/
+CVAPI(void)  cvFillConvexPoly( CvArr* img, const CvPoint* pts, int npts, CvScalar color,
+                               int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
+
+/** @brief Fills an area bounded by one or more arbitrary polygons
+@see cv::fillPoly
+*/
+CVAPI(void)  cvFillPoly( CvArr* img, CvPoint** pts, const int* npts,
+                         int contours, CvScalar color,
+                         int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
+
+/** @brief Draws one or more polygonal curves
+@see cv::polylines
+*/
+CVAPI(void)  cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contours,
+                         int is_closed, CvScalar color, int thickness CV_DEFAULT(1),
+                         int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
+
+#define cvDrawRect cvRectangle
+#define cvDrawLine cvLine
+#define cvDrawCircle cvCircle
+#define cvDrawEllipse cvEllipse
+#define cvDrawPolyLine cvPolyLine
+
+/** @brief Clips the line segment connecting *pt1 and *pt2
+   by the rectangular window
+
+   (0<=x<img_size.width, 0<=y<img_size.height).
+@see cv::clipLine
+*/
+CVAPI(int) cvClipLine( CvSize img_size, CvPoint* pt1, CvPoint* pt2 );
+
+/** @brief Initializes line iterator.
+
+Initially, line_iterator->ptr will point to pt1 (or pt2, see left_to_right description) location in
+the image. Returns the number of pixels on the line between the ending points.
+@see cv::LineIterator
+*/
+CVAPI(int)  cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
+                                CvLineIterator* line_iterator,
+                                int connectivity CV_DEFAULT(8),
+                                int left_to_right CV_DEFAULT(0));
+
+#define CV_NEXT_LINE_POINT( line_iterator )                     \
+{                                                               \
+    int _line_iterator_mask = (line_iterator).err < 0 ? -1 : 0; \
+    (line_iterator).err += (line_iterator).minus_delta +        \
+        ((line_iterator).plus_delta & _line_iterator_mask);     \
+    (line_iterator).ptr += (line_iterator).minus_step +         \
+        ((line_iterator).plus_step & _line_iterator_mask);      \
+}
+
+
+#define CV_FONT_HERSHEY_SIMPLEX         0
+#define CV_FONT_HERSHEY_PLAIN           1
+#define CV_FONT_HERSHEY_DUPLEX          2
+#define CV_FONT_HERSHEY_COMPLEX         3
+#define CV_FONT_HERSHEY_TRIPLEX         4
+#define CV_FONT_HERSHEY_COMPLEX_SMALL   5
+#define CV_FONT_HERSHEY_SCRIPT_SIMPLEX  6
+#define CV_FONT_HERSHEY_SCRIPT_COMPLEX  7
+
+#define CV_FONT_ITALIC                 16
+
+#define CV_FONT_VECTOR0    CV_FONT_HERSHEY_SIMPLEX
+
+
+/** Font structure */
+typedef struct CvFont
+{
+  const char* nameFont;   //Qt:nameFont
+  CvScalar color;       //Qt:ColorFont -> cvScalar(blue_component, green_component, red_component[, alpha_component])
+    int         font_face;    //Qt: bool italic         /** =CV_FONT_* */
+    const int*  ascii;      //!< font data and metrics
+    const int*  greek;
+    const int*  cyrillic;
+    float       hscale, vscale;
+    float       shear;      //!< slope coefficient: 0 - normal, >0 - italic
+    int         thickness;    //!< Qt: weight               /** letters thickness */
+    float       dx;       //!< horizontal interval between letters
+    int         line_type;    //!< Qt: PointSize
+}
+CvFont;
+
+/** @brief Initializes font structure (OpenCV 1.x API).
+
+The function initializes the font structure that can be passed to text rendering functions.
+
+@param font Pointer to the font structure initialized by the function
+@param font_face Font name identifier. See cv::HersheyFonts and corresponding old CV_* identifiers.
+@param hscale Horizontal scale. If equal to 1.0f , the characters have the original width
+depending on the font type. If equal to 0.5f , the characters are of half the original width.
+@param vscale Vertical scale. If equal to 1.0f , the characters have the original height depending
+on the font type. If equal to 0.5f , the characters are of half the original height.
+@param shear Approximate tangent of the character slope relative to the vertical line. A zero
+value means a non-italic font, 1.0f means about a 45 degree slope, etc.
+@param thickness Thickness of the text strokes
+@param line_type Type of the strokes, see line description
+
+@sa cvPutText
+ */
+CVAPI(void)  cvInitFont( CvFont* font, int font_face,
+                         double hscale, double vscale,
+                         double shear CV_DEFAULT(0),
+                         int thickness CV_DEFAULT(1),
+                         int line_type CV_DEFAULT(8));
+
+CV_INLINE CvFont cvFont( double scale, int thickness CV_DEFAULT(1) )
+{
+    CvFont font;
+    cvInitFont( &font, CV_FONT_HERSHEY_PLAIN, scale, scale, 0, thickness, CV_AA );
+    return font;
+}
+
+/** @brief Renders text stroke with specified font and color at specified location.
+   CvFont should be initialized with cvInitFont
+@see cvInitFont, cvGetTextSize, cvFont, cv::putText
+*/
+CVAPI(void)  cvPutText( CvArr* img, const char* text, CvPoint org,
+                        const CvFont* font, CvScalar color );
+
+/** @brief Calculates bounding box of text stroke (useful for alignment)
+@see cv::getTextSize
+*/
+CVAPI(void)  cvGetTextSize( const char* text_string, const CvFont* font,
+                            CvSize* text_size, int* baseline );
+
+/** @brief Unpacks color value
+
+if arrtype is CV_8UC?, _color_ is treated as packed color value, otherwise the first channels
+(depending on arrtype) of destination scalar are set to the same value = _color_
+*/
+CVAPI(CvScalar)  cvColorToScalar( double packed_color, int arrtype );
+
+/** @brief Returns the polygon points which make up the given ellipse.
+
+The ellipse is define by the box of size 'axes' rotated 'angle' around the 'center'. A partial
+sweep of the ellipse arc can be done by spcifying arc_start and arc_end to be something other than
+0 and 360, respectively. The input array 'pts' must be large enough to hold the result. The total
+number of points stored into 'pts' is returned by this function.
+@see cv::ellipse2Poly
+*/
+CVAPI(int) cvEllipse2Poly( CvPoint center, CvSize axes,
+                 int angle, int arc_start, int arc_end, CvPoint * pts, int delta );
+
+/** @brief Draws contour outlines or filled interiors on the image
+@see cv::drawContours
+*/
+CVAPI(void)  cvDrawContours( CvArr *img, CvSeq* contour,
+                             CvScalar external_color, CvScalar hole_color,
+                             int max_level, int thickness CV_DEFAULT(1),
+                             int line_type CV_DEFAULT(8),
+                             CvPoint offset CV_DEFAULT(cvPoint(0,0)));
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h
new file mode 100644
index 0000000..5ecb460
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h
@@ -0,0 +1,626 @@
+/*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*/
+
+#ifndef __OPENCV_IMGPROC_TYPES_C_H__
+#define __OPENCV_IMGPROC_TYPES_C_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup imgproc_c
+  @{
+*/
+
+/** Connected component structure */
+typedef struct CvConnectedComp
+{
+    double area;    /**<area of the connected component  */
+    CvScalar value; /**<average color of the connected component */
+    CvRect rect;    /**<ROI of the component  */
+    CvSeq* contour; /**<optional component boundary
+                      (the contour might have child contours corresponding to the holes)*/
+}
+CvConnectedComp;
+
+/** Image smooth methods */
+enum SmoothMethod_c
+{
+    /** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all 1's). If
+    you want to smooth different pixels with different-size box kernels, you can use the integral
+    image that is computed using integral */
+    CV_BLUR_NO_SCALE =0,
+    /** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all
+    1's) with subsequent scaling by \f$1/(\texttt{size1}\cdot\texttt{size2})\f$ */
+    CV_BLUR  =1,
+    /** linear convolution with a \f$\texttt{size1}\times\texttt{size2}\f$ Gaussian kernel */
+    CV_GAUSSIAN  =2,
+    /** median filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture */
+    CV_MEDIAN =3,
+    /** bilateral filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture, color
+    sigma= sigma1 and spatial sigma= sigma2. If size1=0, the aperture square side is set to
+    cvRound(sigma2\*1.5)\*2+1. See cv::bilateralFilter */
+    CV_BILATERAL =4
+};
+
+/** Filters used in pyramid decomposition */
+enum
+{
+    CV_GAUSSIAN_5x5 = 7
+};
+
+/** Special filters */
+enum
+{
+    CV_SCHARR =-1,
+    CV_MAX_SOBEL_KSIZE =7
+};
+
+/** Constants for color conversion */
+enum
+{
+    CV_BGR2BGRA    =0,
+    CV_RGB2RGBA    =CV_BGR2BGRA,
+
+    CV_BGRA2BGR    =1,
+    CV_RGBA2RGB    =CV_BGRA2BGR,
+
+    CV_BGR2RGBA    =2,
+    CV_RGB2BGRA    =CV_BGR2RGBA,
+
+    CV_RGBA2BGR    =3,
+    CV_BGRA2RGB    =CV_RGBA2BGR,
+
+    CV_BGR2RGB     =4,
+    CV_RGB2BGR     =CV_BGR2RGB,
+
+    CV_BGRA2RGBA   =5,
+    CV_RGBA2BGRA   =CV_BGRA2RGBA,
+
+    CV_BGR2GRAY    =6,
+    CV_RGB2GRAY    =7,
+    CV_GRAY2BGR    =8,
+    CV_GRAY2RGB    =CV_GRAY2BGR,
+    CV_GRAY2BGRA   =9,
+    CV_GRAY2RGBA   =CV_GRAY2BGRA,
+    CV_BGRA2GRAY   =10,
+    CV_RGBA2GRAY   =11,
+
+    CV_BGR2BGR565  =12,
+    CV_RGB2BGR565  =13,
+    CV_BGR5652BGR  =14,
+    CV_BGR5652RGB  =15,
+    CV_BGRA2BGR565 =16,
+    CV_RGBA2BGR565 =17,
+    CV_BGR5652BGRA =18,
+    CV_BGR5652RGBA =19,
+
+    CV_GRAY2BGR565 =20,
+    CV_BGR5652GRAY =21,
+
+    CV_BGR2BGR555  =22,
+    CV_RGB2BGR555  =23,
+    CV_BGR5552BGR  =24,
+    CV_BGR5552RGB  =25,
+    CV_BGRA2BGR555 =26,
+    CV_RGBA2BGR555 =27,
+    CV_BGR5552BGRA =28,
+    CV_BGR5552RGBA =29,
+
+    CV_GRAY2BGR555 =30,
+    CV_BGR5552GRAY =31,
+
+    CV_BGR2XYZ     =32,
+    CV_RGB2XYZ     =33,
+    CV_XYZ2BGR     =34,
+    CV_XYZ2RGB     =35,
+
+    CV_BGR2YCrCb   =36,
+    CV_RGB2YCrCb   =37,
+    CV_YCrCb2BGR   =38,
+    CV_YCrCb2RGB   =39,
+
+    CV_BGR2HSV     =40,
+    CV_RGB2HSV     =41,
+
+    CV_BGR2Lab     =44,
+    CV_RGB2Lab     =45,
+
+    CV_BayerBG2BGR =46,
+    CV_BayerGB2BGR =47,
+    CV_BayerRG2BGR =48,
+    CV_BayerGR2BGR =49,
+
+    CV_BayerBG2RGB =CV_BayerRG2BGR,
+    CV_BayerGB2RGB =CV_BayerGR2BGR,
+    CV_BayerRG2RGB =CV_BayerBG2BGR,
+    CV_BayerGR2RGB =CV_BayerGB2BGR,
+
+    CV_BGR2Luv     =50,
+    CV_RGB2Luv     =51,
+    CV_BGR2HLS     =52,
+    CV_RGB2HLS     =53,
+
+    CV_HSV2BGR     =54,
+    CV_HSV2RGB     =55,
+
+    CV_Lab2BGR     =56,
+    CV_Lab2RGB     =57,
+    CV_Luv2BGR     =58,
+    CV_Luv2RGB     =59,
+    CV_HLS2BGR     =60,
+    CV_HLS2RGB     =61,
+
+    CV_BayerBG2BGR_VNG =62,
+    CV_BayerGB2BGR_VNG =63,
+    CV_BayerRG2BGR_VNG =64,
+    CV_BayerGR2BGR_VNG =65,
+
+    CV_BayerBG2RGB_VNG =CV_BayerRG2BGR_VNG,
+    CV_BayerGB2RGB_VNG =CV_BayerGR2BGR_VNG,
+    CV_BayerRG2RGB_VNG =CV_BayerBG2BGR_VNG,
+    CV_BayerGR2RGB_VNG =CV_BayerGB2BGR_VNG,
+
+    CV_BGR2HSV_FULL = 66,
+    CV_RGB2HSV_FULL = 67,
+    CV_BGR2HLS_FULL = 68,
+    CV_RGB2HLS_FULL = 69,
+
+    CV_HSV2BGR_FULL = 70,
+    CV_HSV2RGB_FULL = 71,
+    CV_HLS2BGR_FULL = 72,
+    CV_HLS2RGB_FULL = 73,
+
+    CV_LBGR2Lab     = 74,
+    CV_LRGB2Lab     = 75,
+    CV_LBGR2Luv     = 76,
+    CV_LRGB2Luv     = 77,
+
+    CV_Lab2LBGR     = 78,
+    CV_Lab2LRGB     = 79,
+    CV_Luv2LBGR     = 80,
+    CV_Luv2LRGB     = 81,
+
+    CV_BGR2YUV      = 82,
+    CV_RGB2YUV      = 83,
+    CV_YUV2BGR      = 84,
+    CV_YUV2RGB      = 85,
+
+    CV_BayerBG2GRAY = 86,
+    CV_BayerGB2GRAY = 87,
+    CV_BayerRG2GRAY = 88,
+    CV_BayerGR2GRAY = 89,
+
+    //YUV 4:2:0 formats family
+    CV_YUV2RGB_NV12 = 90,
+    CV_YUV2BGR_NV12 = 91,
+    CV_YUV2RGB_NV21 = 92,
+    CV_YUV2BGR_NV21 = 93,
+    CV_YUV420sp2RGB = CV_YUV2RGB_NV21,
+    CV_YUV420sp2BGR = CV_YUV2BGR_NV21,
+
+    CV_YUV2RGBA_NV12 = 94,
+    CV_YUV2BGRA_NV12 = 95,
+    CV_YUV2RGBA_NV21 = 96,
+    CV_YUV2BGRA_NV21 = 97,
+    CV_YUV420sp2RGBA = CV_YUV2RGBA_NV21,
+    CV_YUV420sp2BGRA = CV_YUV2BGRA_NV21,
+
+    CV_YUV2RGB_YV12 = 98,
+    CV_YUV2BGR_YV12 = 99,
+    CV_YUV2RGB_IYUV = 100,
+    CV_YUV2BGR_IYUV = 101,
+    CV_YUV2RGB_I420 = CV_YUV2RGB_IYUV,
+    CV_YUV2BGR_I420 = CV_YUV2BGR_IYUV,
+    CV_YUV420p2RGB = CV_YUV2RGB_YV12,
+    CV_YUV420p2BGR = CV_YUV2BGR_YV12,
+
+    CV_YUV2RGBA_YV12 = 102,
+    CV_YUV2BGRA_YV12 = 103,
+    CV_YUV2RGBA_IYUV = 104,
+    CV_YUV2BGRA_IYUV = 105,
+    CV_YUV2RGBA_I420 = CV_YUV2RGBA_IYUV,
+    CV_YUV2BGRA_I420 = CV_YUV2BGRA_IYUV,
+    CV_YUV420p2RGBA = CV_YUV2RGBA_YV12,
+    CV_YUV420p2BGRA = CV_YUV2BGRA_YV12,
+
+    CV_YUV2GRAY_420 = 106,
+    CV_YUV2GRAY_NV21 = CV_YUV2GRAY_420,
+    CV_YUV2GRAY_NV12 = CV_YUV2GRAY_420,
+    CV_YUV2GRAY_YV12 = CV_YUV2GRAY_420,
+    CV_YUV2GRAY_IYUV = CV_YUV2GRAY_420,
+    CV_YUV2GRAY_I420 = CV_YUV2GRAY_420,
+    CV_YUV420sp2GRAY = CV_YUV2GRAY_420,
+    CV_YUV420p2GRAY = CV_YUV2GRAY_420,
+
+    //YUV 4:2:2 formats family
+    CV_YUV2RGB_UYVY = 107,
+    CV_YUV2BGR_UYVY = 108,
+    //CV_YUV2RGB_VYUY = 109,
+    //CV_YUV2BGR_VYUY = 110,
+    CV_YUV2RGB_Y422 = CV_YUV2RGB_UYVY,
+    CV_YUV2BGR_Y422 = CV_YUV2BGR_UYVY,
+    CV_YUV2RGB_UYNV = CV_YUV2RGB_UYVY,
+    CV_YUV2BGR_UYNV = CV_YUV2BGR_UYVY,
+
+    CV_YUV2RGBA_UYVY = 111,
+    CV_YUV2BGRA_UYVY = 112,
+    //CV_YUV2RGBA_VYUY = 113,
+    //CV_YUV2BGRA_VYUY = 114,
+    CV_YUV2RGBA_Y422 = CV_YUV2RGBA_UYVY,
+    CV_YUV2BGRA_Y422 = CV_YUV2BGRA_UYVY,
+    CV_YUV2RGBA_UYNV = CV_YUV2RGBA_UYVY,
+    CV_YUV2BGRA_UYNV = CV_YUV2BGRA_UYVY,
+
+    CV_YUV2RGB_YUY2 = 115,
+    CV_YUV2BGR_YUY2 = 116,
+    CV_YUV2RGB_YVYU = 117,
+    CV_YUV2BGR_YVYU = 118,
+    CV_YUV2RGB_YUYV = CV_YUV2RGB_YUY2,
+    CV_YUV2BGR_YUYV = CV_YUV2BGR_YUY2,
+    CV_YUV2RGB_YUNV = CV_YUV2RGB_YUY2,
+    CV_YUV2BGR_YUNV = CV_YUV2BGR_YUY2,
+
+    CV_YUV2RGBA_YUY2 = 119,
+    CV_YUV2BGRA_YUY2 = 120,
+    CV_YUV2RGBA_YVYU = 121,
+    CV_YUV2BGRA_YVYU = 122,
+    CV_YUV2RGBA_YUYV = CV_YUV2RGBA_YUY2,
+    CV_YUV2BGRA_YUYV = CV_YUV2BGRA_YUY2,
+    CV_YUV2RGBA_YUNV = CV_YUV2RGBA_YUY2,
+    CV_YUV2BGRA_YUNV = CV_YUV2BGRA_YUY2,
+
+    CV_YUV2GRAY_UYVY = 123,
+    CV_YUV2GRAY_YUY2 = 124,
+    //CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY,
+    CV_YUV2GRAY_Y422 = CV_YUV2GRAY_UYVY,
+    CV_YUV2GRAY_UYNV = CV_YUV2GRAY_UYVY,
+    CV_YUV2GRAY_YVYU = CV_YUV2GRAY_YUY2,
+    CV_YUV2GRAY_YUYV = CV_YUV2GRAY_YUY2,
+    CV_YUV2GRAY_YUNV = CV_YUV2GRAY_YUY2,
+
+    // alpha premultiplication
+    CV_RGBA2mRGBA = 125,
+    CV_mRGBA2RGBA = 126,
+
+    CV_RGB2YUV_I420 = 127,
+    CV_BGR2YUV_I420 = 128,
+    CV_RGB2YUV_IYUV = CV_RGB2YUV_I420,
+    CV_BGR2YUV_IYUV = CV_BGR2YUV_I420,
+
+    CV_RGBA2YUV_I420 = 129,
+    CV_BGRA2YUV_I420 = 130,
+    CV_RGBA2YUV_IYUV = CV_RGBA2YUV_I420,
+    CV_BGRA2YUV_IYUV = CV_BGRA2YUV_I420,
+    CV_RGB2YUV_YV12  = 131,
+    CV_BGR2YUV_YV12  = 132,
+    CV_RGBA2YUV_YV12 = 133,
+    CV_BGRA2YUV_YV12 = 134,
+
+    // Edge-Aware Demosaicing
+    CV_BayerBG2BGR_EA = 135,
+    CV_BayerGB2BGR_EA = 136,
+    CV_BayerRG2BGR_EA = 137,
+    CV_BayerGR2BGR_EA = 138,
+
+    CV_BayerBG2RGB_EA = CV_BayerRG2BGR_EA,
+    CV_BayerGB2RGB_EA = CV_BayerGR2BGR_EA,
+    CV_BayerRG2RGB_EA = CV_BayerBG2BGR_EA,
+    CV_BayerGR2RGB_EA = CV_BayerGB2BGR_EA,
+
+    CV_COLORCVT_MAX  = 139
+};
+
+
+/** Sub-pixel interpolation methods */
+enum
+{
+    CV_INTER_NN        =0,
+    CV_INTER_LINEAR    =1,
+    CV_INTER_CUBIC     =2,
+    CV_INTER_AREA      =3,
+    CV_INTER_LANCZOS4  =4
+};
+
+/** ... and other image warping flags */
+enum
+{
+    CV_WARP_FILL_OUTLIERS =8,
+    CV_WARP_INVERSE_MAP  =16
+};
+
+/** Shapes of a structuring element for morphological operations
+@see cv::MorphShapes, cv::getStructuringElement
+*/
+enum MorphShapes_c
+{
+    CV_SHAPE_RECT      =0,
+    CV_SHAPE_CROSS     =1,
+    CV_SHAPE_ELLIPSE   =2,
+    CV_SHAPE_CUSTOM    =100 //!< custom structuring element
+};
+
+/** Morphological operations */
+enum
+{
+    CV_MOP_ERODE        =0,
+    CV_MOP_DILATE       =1,
+    CV_MOP_OPEN         =2,
+    CV_MOP_CLOSE        =3,
+    CV_MOP_GRADIENT     =4,
+    CV_MOP_TOPHAT       =5,
+    CV_MOP_BLACKHAT     =6
+};
+
+/** Spatial and central moments */
+typedef struct CvMoments
+{
+    double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /**< spatial moments */
+    double  mu20, mu11, mu02, mu30, mu21, mu12, mu03; /**< central moments */
+    double  inv_sqrt_m00; /**< m00 != 0 ? 1/sqrt(m00) : 0 */
+
+#ifdef __cplusplus
+    CvMoments(){}
+    CvMoments(const cv::Moments& m)
+    {
+        m00 = m.m00; m10 = m.m10; m01 = m.m01;
+        m20 = m.m20; m11 = m.m11; m02 = m.m02;
+        m30 = m.m30; m21 = m.m21; m12 = m.m12; m03 = m.m03;
+        mu20 = m.mu20; mu11 = m.mu11; mu02 = m.mu02;
+        mu30 = m.mu30; mu21 = m.mu21; mu12 = m.mu12; mu03 = m.mu03;
+        double am00 = std::abs(m.m00);
+        inv_sqrt_m00 = am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0;
+    }
+    operator cv::Moments() const
+    {
+        return cv::Moments(m00, m10, m01, m20, m11, m02, m30, m21, m12, m03);
+    }
+#endif
+}
+CvMoments;
+
+/** Hu invariants */
+typedef struct CvHuMoments
+{
+    double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /**< Hu invariants */
+}
+CvHuMoments;
+
+/** Template matching methods */
+enum
+{
+    CV_TM_SQDIFF        =0,
+    CV_TM_SQDIFF_NORMED =1,
+    CV_TM_CCORR         =2,
+    CV_TM_CCORR_NORMED  =3,
+    CV_TM_CCOEFF        =4,
+    CV_TM_CCOEFF_NORMED =5
+};
+
+typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param );
+
+/** Contour retrieval modes */
+enum
+{
+    CV_RETR_EXTERNAL=0,
+    CV_RETR_LIST=1,
+    CV_RETR_CCOMP=2,
+    CV_RETR_TREE=3,
+    CV_RETR_FLOODFILL=4
+};
+
+/** Contour approximation methods */
+enum
+{
+    CV_CHAIN_CODE=0,
+    CV_CHAIN_APPROX_NONE=1,
+    CV_CHAIN_APPROX_SIMPLE=2,
+    CV_CHAIN_APPROX_TC89_L1=3,
+    CV_CHAIN_APPROX_TC89_KCOS=4,
+    CV_LINK_RUNS=5
+};
+
+/*
+Internal structure that is used for sequential retrieving contours from the image.
+It supports both hierarchical and plane variants of Suzuki algorithm.
+*/
+typedef struct _CvContourScanner* CvContourScanner;
+
+/** Freeman chain reader state */
+typedef struct CvChainPtReader
+{
+    CV_SEQ_READER_FIELDS()
+    char      code;
+    CvPoint   pt;
+    schar     deltas[8][2];
+}
+CvChainPtReader;
+
+/** initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
+#define  CV_INIT_3X3_DELTAS( deltas, step, nch )            \
+    ((deltas)[0] =  (nch),  (deltas)[1] = -(step) + (nch),  \
+     (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch),  \
+     (deltas)[4] = -(nch),  (deltas)[5] =  (step) - (nch),  \
+     (deltas)[6] =  (step), (deltas)[7] =  (step) + (nch))
+
+
+/** Contour approximation algorithms */
+enum
+{
+    CV_POLY_APPROX_DP = 0
+};
+
+/** @brief Shape matching methods
+
+\f$A\f$ denotes object1,\f$B\f$ denotes object2
+
+\f$\begin{array}{l} m^A_i =  \mathrm{sign} (h^A_i)  \cdot \log{h^A_i} \\ m^B_i =  \mathrm{sign} (h^B_i)  \cdot \log{h^B_i} \end{array}\f$
+
+and \f$h^A_i, h^B_i\f$ are the Hu moments of \f$A\f$ and \f$B\f$ , respectively.
+*/
+enum ShapeMatchModes
+{
+    CV_CONTOURS_MATCH_I1  =1, //!< \f[I_1(A,B) =  \sum _{i=1...7}  \left |  \frac{1}{m^A_i} -  \frac{1}{m^B_i} \right |\f]
+    CV_CONTOURS_MATCH_I2  =2, //!< \f[I_2(A,B) =  \sum _{i=1...7}  \left | m^A_i - m^B_i  \right |\f]
+    CV_CONTOURS_MATCH_I3  =3  //!< \f[I_3(A,B) =  \max _{i=1...7}  \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f]
+};
+
+/** Shape orientation */
+enum
+{
+    CV_CLOCKWISE         =1,
+    CV_COUNTER_CLOCKWISE =2
+};
+
+
+/** Convexity defect */
+typedef struct CvConvexityDefect
+{
+    CvPoint* start; /**< point of the contour where the defect begins */
+    CvPoint* end; /**< point of the contour where the defect ends */
+    CvPoint* depth_point; /**< the farthest from the convex hull point within the defect */
+    float depth; /**< distance between the farthest point and the convex hull */
+} CvConvexityDefect;
+
+
+/** Histogram comparison methods */
+enum
+{
+    CV_COMP_CORREL        =0,
+    CV_COMP_CHISQR        =1,
+    CV_COMP_INTERSECT     =2,
+    CV_COMP_BHATTACHARYYA =3,
+    CV_COMP_HELLINGER     =CV_COMP_BHATTACHARYYA,
+    CV_COMP_CHISQR_ALT    =4,
+    CV_COMP_KL_DIV        =5
+};
+
+/** Mask size for distance transform */
+enum
+{
+    CV_DIST_MASK_3   =3,
+    CV_DIST_MASK_5   =5,
+    CV_DIST_MASK_PRECISE =0
+};
+
+/** Content of output label array: connected components or pixels */
+enum
+{
+  CV_DIST_LABEL_CCOMP = 0,
+  CV_DIST_LABEL_PIXEL = 1
+};
+
+/** Distance types for Distance Transform and M-estimators */
+enum
+{
+    CV_DIST_USER    =-1,  /**< User defined distance */
+    CV_DIST_L1      =1,   /**< distance = |x1-x2| + |y1-y2| */
+    CV_DIST_L2      =2,   /**< the simple euclidean distance */
+    CV_DIST_C       =3,   /**< distance = max(|x1-x2|,|y1-y2|) */
+    CV_DIST_L12     =4,   /**< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */
+    CV_DIST_FAIR    =5,   /**< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */
+    CV_DIST_WELSCH  =6,   /**< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */
+    CV_DIST_HUBER   =7    /**< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
+};
+
+
+/** Threshold types */
+enum
+{
+    CV_THRESH_BINARY      =0,  /**< value = value > threshold ? max_value : 0       */
+    CV_THRESH_BINARY_INV  =1,  /**< value = value > threshold ? 0 : max_value       */
+    CV_THRESH_TRUNC       =2,  /**< value = value > threshold ? threshold : value   */
+    CV_THRESH_TOZERO      =3,  /**< value = value > threshold ? value : 0           */
+    CV_THRESH_TOZERO_INV  =4,  /**< value = value > threshold ? 0 : value           */
+    CV_THRESH_MASK        =7,
+    CV_THRESH_OTSU        =8, /**< use Otsu algorithm to choose the optimal threshold value;
+                                 combine the flag with one of the above CV_THRESH_* values */
+    CV_THRESH_TRIANGLE    =16  /**< use Triangle algorithm to choose the optimal threshold value;
+                                 combine the flag with one of the above CV_THRESH_* values, but not
+                                 with CV_THRESH_OTSU */
+};
+
+/** Adaptive threshold methods */
+enum
+{
+    CV_ADAPTIVE_THRESH_MEAN_C  =0,
+    CV_ADAPTIVE_THRESH_GAUSSIAN_C  =1
+};
+
+/** FloodFill flags */
+enum
+{
+    CV_FLOODFILL_FIXED_RANGE =(1 << 16),
+    CV_FLOODFILL_MASK_ONLY   =(1 << 17)
+};
+
+
+/** Canny edge detector flags */
+enum
+{
+    CV_CANNY_L2_GRADIENT  =(1 << 31)
+};
+
+/** Variants of a Hough transform */
+enum
+{
+    CV_HOUGH_STANDARD =0,
+    CV_HOUGH_PROBABILISTIC =1,
+    CV_HOUGH_MULTI_SCALE =2,
+    CV_HOUGH_GRADIENT =3
+};
+
+
+/* Fast search data structures  */
+struct CvFeatureTree;
+struct CvLSH;
+struct CvLSHOperations;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/ml.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/ml.hpp
new file mode 100644
index 0000000..862f3f9
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/ml.hpp
@@ -0,0 +1,1505 @@
+/*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, Intel Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2014, Itseez 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*/
+
+#ifndef __OPENCV_ML_HPP__
+#define __OPENCV_ML_HPP__
+
+#ifdef __cplusplus
+#  include "opencv2/core.hpp"
+#endif
+
+#ifdef __cplusplus
+
+#include <float.h>
+#include <map>
+#include <iostream>
+
+/**
+  @defgroup ml Machine Learning
+
+  The Machine Learning Library (MLL) is a set of classes and functions for statistical
+  classification, regression, and clustering of data.
+
+  Most of the classification and regression algorithms are implemented as C++ classes. As the
+  algorithms have different sets of features (like an ability to handle missing measurements or
+  categorical input variables), there is a little common ground between the classes. This common
+  ground is defined by the class cv::ml::StatModel that all the other ML classes are derived from.
+
+  See detailed overview here: @ref ml_intro.
+ */
+
+namespace cv
+{
+
+namespace ml
+{
+
+//! @addtogroup ml
+//! @{
+
+/** @brief Variable types */
+enum VariableTypes
+{
+    VAR_NUMERICAL    =0, //!< same as VAR_ORDERED
+    VAR_ORDERED      =0, //!< ordered variables
+    VAR_CATEGORICAL  =1  //!< categorical variables
+};
+
+/** @brief %Error types */
+enum ErrorTypes
+{
+    TEST_ERROR = 0,
+    TRAIN_ERROR = 1
+};
+
+/** @brief Sample types */
+enum SampleTypes
+{
+    ROW_SAMPLE = 0, //!< each training sample is a row of samples
+    COL_SAMPLE = 1  //!< each training sample occupies a column of samples
+};
+
+/** @brief The structure represents the logarithmic grid range of statmodel parameters.
+
+It is used for optimizing statmodel accuracy by varying model parameters, the accuracy estimate
+being computed by cross-validation.
+ */
+class CV_EXPORTS ParamGrid
+{
+public:
+    /** @brief Default constructor */
+    ParamGrid();
+    /** @brief Constructor with parameters */
+    ParamGrid(double _minVal, double _maxVal, double _logStep);
+
+    double minVal; //!< Minimum value of the statmodel parameter. Default value is 0.
+    double maxVal; //!< Maximum value of the statmodel parameter. Default value is 0.
+    /** @brief Logarithmic step for iterating the statmodel parameter.
+
+    The grid determines the following iteration sequence of the statmodel parameter values:
+    \f[(minVal, minVal*step, minVal*{step}^2, \dots,  minVal*{logStep}^n),\f]
+    where \f$n\f$ is the maximal index satisfying
+    \f[\texttt{minVal} * \texttt{logStep} ^n <  \texttt{maxVal}\f]
+    The grid is logarithmic, so logStep must always be greater then 1. Default value is 1.
+    */
+    double logStep;
+};
+
+/** @brief Class encapsulating training data.
+
+Please note that the class only specifies the interface of training data, but not implementation.
+All the statistical model classes in _ml_ module accepts Ptr\<TrainData\> as parameter. In other
+words, you can create your own class derived from TrainData and pass smart pointer to the instance
+of this class into StatModel::train.
+
+@sa @ref ml_intro_data
+ */
+class CV_EXPORTS_W TrainData
+{
+public:
+    static inline float missingValue() { return FLT_MAX; }
+    virtual ~TrainData();
+
+    CV_WRAP virtual int getLayout() const = 0;
+    CV_WRAP virtual int getNTrainSamples() const = 0;
+    CV_WRAP virtual int getNTestSamples() const = 0;
+    CV_WRAP virtual int getNSamples() const = 0;
+    CV_WRAP virtual int getNVars() const = 0;
+    CV_WRAP virtual int getNAllVars() const = 0;
+
+    CV_WRAP virtual void getSample(InputArray varIdx, int sidx, float* buf) const = 0;
+    CV_WRAP virtual Mat getSamples() const = 0;
+    CV_WRAP virtual Mat getMissing() const = 0;
+
+    /** @brief Returns matrix of train samples
+
+    @param layout The requested layout. If it's different from the initial one, the matrix is
+        transposed. See ml::SampleTypes.
+    @param compressSamples if true, the function returns only the training samples (specified by
+        sampleIdx)
+    @param compressVars if true, the function returns the shorter training samples, containing only
+        the active variables.
+
+    In current implementation the function tries to avoid physical data copying and returns the
+    matrix stored inside TrainData (unless the transposition or compression is needed).
+     */
+    CV_WRAP virtual Mat getTrainSamples(int layout=ROW_SAMPLE,
+                                bool compressSamples=true,
+                                bool compressVars=true) const = 0;
+
+    /** @brief Returns the vector of responses
+
+    The function returns ordered or the original categorical responses. Usually it's used in
+    regression algorithms.
+     */
+    CV_WRAP virtual Mat getTrainResponses() const = 0;
+
+    /** @brief Returns the vector of normalized categorical responses
+
+    The function returns vector of responses. Each response is integer from `0` to `<number of
+    classes>-1`. The actual label value can be retrieved then from the class label vector, see
+    TrainData::getClassLabels.
+     */
+    CV_WRAP virtual Mat getTrainNormCatResponses() const = 0;
+    CV_WRAP virtual Mat getTestResponses() const = 0;
+    CV_WRAP virtual Mat getTestNormCatResponses() const = 0;
+    CV_WRAP virtual Mat getResponses() const = 0;
+    CV_WRAP virtual Mat getNormCatResponses() const = 0;
+    CV_WRAP virtual Mat getSampleWeights() const = 0;
+    CV_WRAP virtual Mat getTrainSampleWeights() const = 0;
+    CV_WRAP virtual Mat getTestSampleWeights() const = 0;
+    CV_WRAP virtual Mat getVarIdx() const = 0;
+    CV_WRAP virtual Mat getVarType() const = 0;
+    CV_WRAP virtual int getResponseType() const = 0;
+    CV_WRAP virtual Mat getTrainSampleIdx() const = 0;
+    CV_WRAP virtual Mat getTestSampleIdx() const = 0;
+    CV_WRAP virtual void getValues(int vi, InputArray sidx, float* values) const = 0;
+    virtual void getNormCatValues(int vi, InputArray sidx, int* values) const = 0;
+    CV_WRAP virtual Mat getDefaultSubstValues() const = 0;
+
+    CV_WRAP virtual int getCatCount(int vi) const = 0;
+
+    /** @brief Returns the vector of class labels
+
+    The function returns vector of unique labels occurred in the responses.
+     */
+    CV_WRAP virtual Mat getClassLabels() const = 0;
+
+    CV_WRAP virtual Mat getCatOfs() const = 0;
+    CV_WRAP virtual Mat getCatMap() const = 0;
+
+    /** @brief Splits the training data into the training and test parts
+    @sa TrainData::setTrainTestSplitRatio
+     */
+    CV_WRAP virtual void setTrainTestSplit(int count, bool shuffle=true) = 0;
+
+    /** @brief Splits the training data into the training and test parts
+
+    The function selects a subset of specified relative size and then returns it as the training
+    set. If the function is not called, all the data is used for training. Please, note that for
+    each of TrainData::getTrain\* there is corresponding TrainData::getTest\*, so that the test
+    subset can be retrieved and processed as well.
+    @sa TrainData::setTrainTestSplit
+     */
+    CV_WRAP virtual void setTrainTestSplitRatio(double ratio, bool shuffle=true) = 0;
+    CV_WRAP virtual void shuffleTrainTest() = 0;
+
+    CV_WRAP static Mat getSubVector(const Mat& vec, const Mat& idx);
+
+    /** @brief Reads the dataset from a .csv file and returns the ready-to-use training data.
+
+    @param filename The input file name
+    @param headerLineCount The number of lines in the beginning to skip; besides the header, the
+        function also skips empty lines and lines staring with `#`
+    @param responseStartIdx Index of the first output variable. If -1, the function considers the
+        last variable as the response
+    @param responseEndIdx Index of the last output variable + 1. If -1, then there is single
+        response variable at responseStartIdx.
+    @param varTypeSpec The optional text string that specifies the variables' types. It has the
+        format `ord[n1-n2,n3,n4-n5,...]cat[n6,n7-n8,...]`. That is, variables from `n1 to n2`
+        (inclusive range), `n3`, `n4 to n5` ... are considered ordered and `n6`, `n7 to n8` ... are
+        considered as categorical. The range `[n1..n2] + [n3] + [n4..n5] + ... + [n6] + [n7..n8]`
+        should cover all the variables. If varTypeSpec is not specified, then algorithm uses the
+        following rules:
+        - all input variables are considered ordered by default. If some column contains has non-
+          numerical values, e.g. 'apple', 'pear', 'apple', 'apple', 'mango', the corresponding
+          variable is considered categorical.
+        - if there are several output variables, they are all considered as ordered. Error is
+          reported when non-numerical values are used.
+        - if there is a single output variable, then if its values are non-numerical or are all
+          integers, then it's considered categorical. Otherwise, it's considered ordered.
+    @param delimiter The character used to separate values in each line.
+    @param missch The character used to specify missing measurements. It should not be a digit.
+        Although it's a non-numerical value, it surely does not affect the decision of whether the
+        variable ordered or categorical.
+    @note If the dataset only contains input variables and no responses, use responseStartIdx = -2
+        and responseEndIdx = 0. The output variables vector will just contain zeros.
+     */
+    static Ptr<TrainData> loadFromCSV(const String& filename,
+                                      int headerLineCount,
+                                      int responseStartIdx=-1,
+                                      int responseEndIdx=-1,
+                                      const String& varTypeSpec=String(),
+                                      char delimiter=',',
+                                      char missch='?');
+
+    /** @brief Creates training data from in-memory arrays.
+
+    @param samples matrix of samples. It should have CV_32F type.
+    @param layout see ml::SampleTypes.
+    @param responses matrix of responses. If the responses are scalar, they should be stored as a
+        single row or as a single column. The matrix should have type CV_32F or CV_32S (in the
+        former case the responses are considered as ordered by default; in the latter case - as
+        categorical)
+    @param varIdx vector specifying which variables to use for training. It can be an integer vector
+        (CV_32S) containing 0-based variable indices or byte vector (CV_8U) containing a mask of
+        active variables.
+    @param sampleIdx vector specifying which samples to use for training. It can be an integer
+        vector (CV_32S) containing 0-based sample indices or byte vector (CV_8U) containing a mask
+        of training samples.
+    @param sampleWeights optional vector with weights for each sample. It should have CV_32F type.
+    @param varType optional vector of type CV_8U and size `<number_of_variables_in_samples> +
+        <number_of_variables_in_responses>`, containing types of each input and output variable. See
+        ml::VariableTypes.
+     */
+    CV_WRAP static Ptr<TrainData> create(InputArray samples, int layout, InputArray responses,
+                                 InputArray varIdx=noArray(), InputArray sampleIdx=noArray(),
+                                 InputArray sampleWeights=noArray(), InputArray varType=noArray());
+};
+
+/** @brief Base class for statistical models in OpenCV ML.
+ */
+class CV_EXPORTS_W StatModel : public Algorithm
+{
+public:
+    /** Predict options */
+    enum Flags {
+        UPDATE_MODEL = 1,
+        RAW_OUTPUT=1, //!< makes the method return the raw results (the sum), not the class label
+        COMPRESSED_INPUT=2,
+        PREPROCESSED_INPUT=4
+    };
+
+    /** @brief Returns the number of variables in training samples */
+    CV_WRAP virtual int getVarCount() const = 0;
+
+    CV_WRAP virtual bool empty() const;
+
+    /** @brief Returns true if the model is trained */
+    CV_WRAP virtual bool isTrained() const = 0;
+    /** @brief Returns true if the model is classifier */
+    CV_WRAP virtual bool isClassifier() const = 0;
+
+    /** @brief Trains the statistical model
+
+    @param trainData training data that can be loaded from file using TrainData::loadFromCSV or
+        created with TrainData::create.
+    @param flags optional flags, depending on the model. Some of the models can be updated with the
+        new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP).
+     */
+    CV_WRAP virtual bool train( const Ptr<TrainData>& trainData, int flags=0 );
+
+    /** @brief Trains the statistical model
+
+    @param samples training samples
+    @param layout See ml::SampleTypes.
+    @param responses vector of responses associated with the training samples.
+    */
+    CV_WRAP virtual bool train( InputArray samples, int layout, InputArray responses );
+
+    /** @brief Computes error on the training or test dataset
+
+    @param data the training data
+    @param test if true, the error is computed over the test subset of the data, otherwise it's
+        computed over the training subset of the data. Please note that if you loaded a completely
+        different dataset to evaluate already trained classifier, you will probably want not to set
+        the test subset at all with TrainData::setTrainTestSplitRatio and specify test=false, so
+        that the error is computed for the whole new set. Yes, this sounds a bit confusing.
+    @param resp the optional output responses.
+
+    The method uses StatModel::predict to compute the error. For regression models the error is
+    computed as RMS, for classifiers - as a percent of missclassified samples (0%-100%).
+     */
+    CV_WRAP virtual float calcError( const Ptr<TrainData>& data, bool test, OutputArray resp ) const;
+
+    /** @brief Predicts response(s) for the provided sample(s)
+
+    @param samples The input samples, floating-point matrix
+    @param results The optional output matrix of results.
+    @param flags The optional flags, model-dependent. See cv::ml::StatModel::Flags.
+     */
+    CV_WRAP virtual float predict( InputArray samples, OutputArray results=noArray(), int flags=0 ) const = 0;
+
+    /** @brief Create and train model with default parameters
+
+    The class must implement static `create()` method with no parameters or with all default parameter values
+    */
+    template<typename _Tp> static Ptr<_Tp> train(const Ptr<TrainData>& data, int flags=0)
+    {
+        Ptr<_Tp> model = _Tp::create();
+        return !model.empty() && model->train(data, flags) ? model : Ptr<_Tp>();
+    }
+};
+
+/****************************************************************************************\
+*                                 Normal Bayes Classifier                                *
+\****************************************************************************************/
+
+/** @brief Bayes classifier for normally distributed data.
+
+@sa @ref ml_intro_bayes
+ */
+class CV_EXPORTS_W NormalBayesClassifier : public StatModel
+{
+public:
+    /** @brief Predicts the response for sample(s).
+
+    The method estimates the most probable classes for input vectors. Input vectors (one or more)
+    are stored as rows of the matrix inputs. In case of multiple input vectors, there should be one
+    output vector outputs. The predicted class for a single input vector is returned by the method.
+    The vector outputProbs contains the output probabilities corresponding to each element of
+    result.
+     */
+    CV_WRAP virtual float predictProb( InputArray inputs, OutputArray outputs,
+                               OutputArray outputProbs, int flags=0 ) const = 0;
+
+    /** Creates empty model
+    Use StatModel::train to train the model after creation. */
+    CV_WRAP static Ptr<NormalBayesClassifier> create();
+};
+
+/****************************************************************************************\
+*                          K-Nearest Neighbour Classifier                                *
+\****************************************************************************************/
+
+/** @brief The class implements K-Nearest Neighbors model
+
+@sa @ref ml_intro_knn
+ */
+class CV_EXPORTS_W KNearest : public StatModel
+{
+public:
+
+    /** Default number of neighbors to use in predict method. */
+    /** @see setDefaultK */
+    CV_WRAP virtual int getDefaultK() const = 0;
+    /** @copybrief getDefaultK @see getDefaultK */
+    CV_WRAP virtual void setDefaultK(int val) = 0;
+
+    /** Whether classification or regression model should be trained. */
+    /** @see setIsClassifier */
+    CV_WRAP virtual bool getIsClassifier() const = 0;
+    /** @copybrief getIsClassifier @see getIsClassifier */
+    CV_WRAP virtual void setIsClassifier(bool val) = 0;
+
+    /** Parameter for KDTree implementation. */
+    /** @see setEmax */
+    CV_WRAP virtual int getEmax() const = 0;
+    /** @copybrief getEmax @see getEmax */
+    CV_WRAP virtual void setEmax(int val) = 0;
+
+    /** %Algorithm type, one of KNearest::Types. */
+    /** @see setAlgorithmType */
+    CV_WRAP virtual int getAlgorithmType() const = 0;
+    /** @copybrief getAlgorithmType @see getAlgorithmType */
+    CV_WRAP virtual void setAlgorithmType(int val) = 0;
+
+    /** @brief Finds the neighbors and predicts responses for input vectors.
+
+    @param samples Input samples stored by rows. It is a single-precision floating-point matrix of
+        `<number_of_samples> * k` size.
+    @param k Number of used nearest neighbors. Should be greater than 1.
+    @param results Vector with results of prediction (regression or classification) for each input
+        sample. It is a single-precision floating-point vector with `<number_of_samples>` elements.
+    @param neighborResponses Optional output values for corresponding neighbors. It is a single-
+        precision floating-point matrix of `<number_of_samples> * k` size.
+    @param dist Optional output distances from the input vectors to the corresponding neighbors. It
+        is a single-precision floating-point matrix of `<number_of_samples> * k` size.
+
+    For each input vector (a row of the matrix samples), the method finds the k nearest neighbors.
+    In case of regression, the predicted result is a mean value of the particular vector's neighbor
+    responses. In case of classification, the class is determined by voting.
+
+    For each input vector, the neighbors are sorted by their distances to the vector.
+
+    In case of C++ interface you can use output pointers to empty matrices and the function will
+    allocate memory itself.
+
+    If only a single input vector is passed, all output matrices are optional and the predicted
+    value is returned by the method.
+
+    The function is parallelized with the TBB library.
+     */
+    CV_WRAP virtual float findNearest( InputArray samples, int k,
+                               OutputArray results,
+                               OutputArray neighborResponses=noArray(),
+                               OutputArray dist=noArray() ) const = 0;
+
+    /** @brief Implementations of KNearest algorithm
+       */
+    enum Types
+    {
+        BRUTE_FORCE=1,
+        KDTREE=2
+    };
+
+    /** @brief Creates the empty model
+
+    The static method creates empty %KNearest classifier. It should be then trained using StatModel::train method.
+     */
+    CV_WRAP static Ptr<KNearest> create();
+};
+
+/****************************************************************************************\
+*                                   Support Vector Machines                              *
+\****************************************************************************************/
+
+/** @brief Support Vector Machines.
+
+@sa @ref ml_intro_svm
+ */
+class CV_EXPORTS_W SVM : public StatModel
+{
+public:
+
+    class CV_EXPORTS Kernel : public Algorithm
+    {
+    public:
+        virtual int getType() const = 0;
+        virtual void calc( int vcount, int n, const float* vecs, const float* another, float* results ) = 0;
+    };
+
+    /** Type of a %SVM formulation.
+    See SVM::Types. Default value is SVM::C_SVC. */
+    /** @see setType */
+    CV_WRAP virtual int getType() const = 0;
+    /** @copybrief getType @see getType */
+    CV_WRAP virtual void setType(int val) = 0;
+
+    /** Parameter \f$\gamma\f$ of a kernel function.
+    For SVM::POLY, SVM::RBF, SVM::SIGMOID or SVM::CHI2. Default value is 1. */
+    /** @see setGamma */
+    CV_WRAP virtual double getGamma() const = 0;
+    /** @copybrief getGamma @see getGamma */
+    CV_WRAP virtual void setGamma(double val) = 0;
+
+    /** Parameter _coef0_ of a kernel function.
+    For SVM::POLY or SVM::SIGMOID. Default value is 0.*/
+    /** @see setCoef0 */
+    CV_WRAP virtual double getCoef0() const = 0;
+    /** @copybrief getCoef0 @see getCoef0 */
+    CV_WRAP virtual void setCoef0(double val) = 0;
+
+    /** Parameter _degree_ of a kernel function.
+    For SVM::POLY. Default value is 0. */
+    /** @see setDegree */
+    CV_WRAP virtual double getDegree() const = 0;
+    /** @copybrief getDegree @see getDegree */
+    CV_WRAP virtual void setDegree(double val) = 0;
+
+    /** Parameter _C_ of a %SVM optimization problem.
+    For SVM::C_SVC, SVM::EPS_SVR or SVM::NU_SVR. Default value is 0. */
+    /** @see setC */
+    CV_WRAP virtual double getC() const = 0;
+    /** @copybrief getC @see getC */
+    CV_WRAP virtual void setC(double val) = 0;
+
+    /** Parameter \f$\nu\f$ of a %SVM optimization problem.
+    For SVM::NU_SVC, SVM::ONE_CLASS or SVM::NU_SVR. Default value is 0. */
+    /** @see setNu */
+    CV_WRAP virtual double getNu() const = 0;
+    /** @copybrief getNu @see getNu */
+    CV_WRAP virtual void setNu(double val) = 0;
+
+    /** Parameter \f$\epsilon\f$ of a %SVM optimization problem.
+    For SVM::EPS_SVR. Default value is 0. */
+    /** @see setP */
+    CV_WRAP virtual double getP() const = 0;
+    /** @copybrief getP @see getP */
+    CV_WRAP virtual void setP(double val) = 0;
+
+    /** Optional weights in the SVM::C_SVC problem, assigned to particular classes.
+    They are multiplied by _C_ so the parameter _C_ of class _i_ becomes `classWeights(i) * C`. Thus
+    these weights affect the misclassification penalty for different classes. The larger weight,
+    the larger penalty on misclassification of data from the corresponding class. Default value is
+    empty Mat. */
+    /** @see setClassWeights */
+    CV_WRAP virtual cv::Mat getClassWeights() const = 0;
+    /** @copybrief getClassWeights @see getClassWeights */
+    CV_WRAP virtual void setClassWeights(const cv::Mat &val) = 0;
+
+    /** Termination criteria of the iterative %SVM training procedure which solves a partial
+    case of constrained quadratic optimization problem.
+    You can specify tolerance and/or the maximum number of iterations. Default value is
+    `TermCriteria( TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, FLT_EPSILON )`; */
+    /** @see setTermCriteria */
+    CV_WRAP virtual cv::TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(const cv::TermCriteria &val) = 0;
+
+    /** Type of a %SVM kernel.
+    See SVM::KernelTypes. Default value is SVM::RBF. */
+    CV_WRAP virtual int getKernelType() const = 0;
+
+    /** Initialize with one of predefined kernels.
+    See SVM::KernelTypes. */
+    CV_WRAP virtual void setKernel(int kernelType) = 0;
+
+    /** Initialize with custom kernel.
+    See SVM::Kernel class for implementation details */
+    virtual void setCustomKernel(const Ptr<Kernel> &_kernel) = 0;
+
+    //! %SVM type
+    enum Types {
+        /** C-Support Vector Classification. n-class classification (n \f$\geq\f$ 2), allows
+        imperfect separation of classes with penalty multiplier C for outliers. */
+        C_SVC=100,
+        /** \f$\nu\f$-Support Vector Classification. n-class classification with possible
+        imperfect separation. Parameter \f$\nu\f$ (in the range 0..1, the larger the value, the smoother
+        the decision boundary) is used instead of C. */
+        NU_SVC=101,
+        /** Distribution Estimation (One-class %SVM). All the training data are from
+        the same class, %SVM builds a boundary that separates the class from the rest of the feature
+        space. */
+        ONE_CLASS=102,
+        /** \f$\epsilon\f$-Support Vector Regression. The distance between feature vectors
+        from the training set and the fitting hyper-plane must be less than p. For outliers the
+        penalty multiplier C is used. */
+        EPS_SVR=103,
+        /** \f$\nu\f$-Support Vector Regression. \f$\nu\f$ is used instead of p.
+        See @cite LibSVM for details. */
+        NU_SVR=104
+    };
+
+    /** @brief %SVM kernel type
+
+    A comparison of different kernels on the following 2D test case with four classes. Four
+    SVM::C_SVC SVMs have been trained (one against rest) with auto_train. Evaluation on three
+    different kernels (SVM::CHI2, SVM::INTER, SVM::RBF). The color depicts the class with max score.
+    Bright means max-score \> 0, dark means max-score \< 0.
+    ![image](pics/SVM_Comparison.png)
+    */
+    enum KernelTypes {
+        /** Returned by SVM::getKernelType in case when custom kernel has been set */
+        CUSTOM=-1,
+        /** Linear kernel. No mapping is done, linear discrimination (or regression) is
+        done in the original feature space. It is the fastest option. \f$K(x_i, x_j) = x_i^T x_j\f$. */
+        LINEAR=0,
+        /** Polynomial kernel:
+        \f$K(x_i, x_j) = (\gamma x_i^T x_j + coef0)^{degree}, \gamma > 0\f$. */
+        POLY=1,
+        /** Radial basis function (RBF), a good choice in most cases.
+        \f$K(x_i, x_j) = e^{-\gamma ||x_i - x_j||^2}, \gamma > 0\f$. */
+        RBF=2,
+        /** Sigmoid kernel: \f$K(x_i, x_j) = \tanh(\gamma x_i^T x_j + coef0)\f$. */
+        SIGMOID=3,
+        /** Exponential Chi2 kernel, similar to the RBF kernel:
+        \f$K(x_i, x_j) = e^{-\gamma \chi^2(x_i,x_j)}, \chi^2(x_i,x_j) = (x_i-x_j)^2/(x_i+x_j), \gamma > 0\f$. */
+        CHI2=4,
+        /** Histogram intersection kernel. A fast kernel. \f$K(x_i, x_j) = min(x_i,x_j)\f$. */
+        INTER=5
+    };
+
+    //! %SVM params type
+    enum ParamTypes {
+        C=0,
+        GAMMA=1,
+        P=2,
+        NU=3,
+        COEF=4,
+        DEGREE=5
+    };
+
+    /** @brief Trains an %SVM with optimal parameters.
+
+    @param data the training data that can be constructed using TrainData::create or
+        TrainData::loadFromCSV.
+    @param kFold Cross-validation parameter. The training set is divided into kFold subsets. One
+        subset is used to test the model, the others form the train set. So, the %SVM algorithm is
+        executed kFold times.
+    @param Cgrid grid for C
+    @param gammaGrid grid for gamma
+    @param pGrid grid for p
+    @param nuGrid grid for nu
+    @param coeffGrid grid for coeff
+    @param degreeGrid grid for degree
+    @param balanced If true and the problem is 2-class classification then the method creates more
+        balanced cross-validation subsets that is proportions between classes in subsets are close
+        to such proportion in the whole train dataset.
+
+    The method trains the %SVM model automatically by choosing the optimal parameters C, gamma, p,
+    nu, coef0, degree. Parameters are considered optimal when the cross-validation
+    estimate of the test set error is minimal.
+
+    If there is no need to optimize a parameter, the corresponding grid step should be set to any
+    value less than or equal to 1. For example, to avoid optimization in gamma, set `gammaGrid.step
+    = 0`, `gammaGrid.minVal`, `gamma_grid.maxVal` as arbitrary numbers. In this case, the value
+    `Gamma` is taken for gamma.
+
+    And, finally, if the optimization in a parameter is required but the corresponding grid is
+    unknown, you may call the function SVM::getDefaultGrid. To generate a grid, for example, for
+    gamma, call `SVM::getDefaultGrid(SVM::GAMMA)`.
+
+    This function works for the classification (SVM::C_SVC or SVM::NU_SVC) as well as for the
+    regression (SVM::EPS_SVR or SVM::NU_SVR). If it is SVM::ONE_CLASS, no optimization is made and
+    the usual %SVM with parameters specified in params is executed.
+     */
+    virtual bool trainAuto( const Ptr<TrainData>& data, int kFold = 10,
+                    ParamGrid Cgrid = SVM::getDefaultGrid(SVM::C),
+                    ParamGrid gammaGrid  = SVM::getDefaultGrid(SVM::GAMMA),
+                    ParamGrid pGrid      = SVM::getDefaultGrid(SVM::P),
+                    ParamGrid nuGrid     = SVM::getDefaultGrid(SVM::NU),
+                    ParamGrid coeffGrid  = SVM::getDefaultGrid(SVM::COEF),
+                    ParamGrid degreeGrid = SVM::getDefaultGrid(SVM::DEGREE),
+                    bool balanced=false) = 0;
+
+    /** @brief Retrieves all the support vectors
+
+    The method returns all the support vectors as a floating-point matrix, where support vectors are
+    stored as matrix rows.
+     */
+    CV_WRAP virtual Mat getSupportVectors() const = 0;
+
+    /** @brief Retrieves all the uncompressed support vectors of a linear %SVM
+
+    The method returns all the uncompressed support vectors of a linear %SVM that the compressed
+    support vector, used for prediction, was derived from. They are returned in a floating-point
+    matrix, where the support vectors are stored as matrix rows.
+     */
+    CV_WRAP Mat getUncompressedSupportVectors() const;
+
+    /** @brief Retrieves the decision function
+
+    @param i the index of the decision function. If the problem solved is regression, 1-class or
+        2-class classification, then there will be just one decision function and the index should
+        always be 0. Otherwise, in the case of N-class classification, there will be \f$N(N-1)/2\f$
+        decision functions.
+    @param alpha the optional output vector for weights, corresponding to different support vectors.
+        In the case of linear %SVM all the alpha's will be 1's.
+    @param svidx the optional output vector of indices of support vectors within the matrix of
+        support vectors (which can be retrieved by SVM::getSupportVectors). In the case of linear
+        %SVM each decision function consists of a single "compressed" support vector.
+
+    The method returns rho parameter of the decision function, a scalar subtracted from the weighted
+    sum of kernel responses.
+     */
+    CV_WRAP virtual double getDecisionFunction(int i, OutputArray alpha, OutputArray svidx) const = 0;
+
+    /** @brief Generates a grid for %SVM parameters.
+
+    @param param_id %SVM parameters IDs that must be one of the SVM::ParamTypes. The grid is
+    generated for the parameter with this ID.
+
+    The function generates a grid for the specified parameter of the %SVM algorithm. The grid may be
+    passed to the function SVM::trainAuto.
+     */
+    static ParamGrid getDefaultGrid( int param_id );
+
+    /** Creates empty model.
+    Use StatModel::train to train the model. Since %SVM has several parameters, you may want to
+    find the best parameters for your problem, it can be done with SVM::trainAuto. */
+    CV_WRAP static Ptr<SVM> create();
+};
+
+/****************************************************************************************\
+*                              Expectation - Maximization                                *
+\****************************************************************************************/
+
+/** @brief The class implements the Expectation Maximization algorithm.
+
+@sa @ref ml_intro_em
+ */
+class CV_EXPORTS_W EM : public StatModel
+{
+public:
+    //! Type of covariation matrices
+    enum Types {
+        /** A scaled identity matrix \f$\mu_k * I\f$. There is the only
+        parameter \f$\mu_k\f$ to be estimated for each matrix. The option may be used in special cases,
+        when the constraint is relevant, or as a first step in the optimization (for example in case
+        when the data is preprocessed with PCA). The results of such preliminary estimation may be
+        passed again to the optimization procedure, this time with
+        covMatType=EM::COV_MAT_DIAGONAL. */
+        COV_MAT_SPHERICAL=0,
+        /** A diagonal matrix with positive diagonal elements. The number of
+        free parameters is d for each matrix. This is most commonly used option yielding good
+        estimation results. */
+        COV_MAT_DIAGONAL=1,
+        /** A symmetric positively defined matrix. The number of free
+        parameters in each matrix is about \f$d^2/2\f$. It is not recommended to use this option, unless
+        there is pretty accurate initial estimation of the parameters and/or a huge number of
+        training samples. */
+        COV_MAT_GENERIC=2,
+        COV_MAT_DEFAULT=COV_MAT_DIAGONAL
+    };
+
+    //! Default parameters
+    enum {DEFAULT_NCLUSTERS=5, DEFAULT_MAX_ITERS=100};
+
+    //! The initial step
+    enum {START_E_STEP=1, START_M_STEP=2, START_AUTO_STEP=0};
+
+    /** The number of mixture components in the Gaussian mixture model.
+    Default value of the parameter is EM::DEFAULT_NCLUSTERS=5. Some of %EM implementation could
+    determine the optimal number of mixtures within a specified value range, but that is not the
+    case in ML yet. */
+    /** @see setClustersNumber */
+    CV_WRAP virtual int getClustersNumber() const = 0;
+    /** @copybrief getClustersNumber @see getClustersNumber */
+    CV_WRAP virtual void setClustersNumber(int val) = 0;
+
+    /** Constraint on covariance matrices which defines type of matrices.
+    See EM::Types. */
+    /** @see setCovarianceMatrixType */
+    CV_WRAP virtual int getCovarianceMatrixType() const = 0;
+    /** @copybrief getCovarianceMatrixType @see getCovarianceMatrixType */
+    CV_WRAP virtual void setCovarianceMatrixType(int val) = 0;
+
+    /** The termination criteria of the %EM algorithm.
+    The %EM algorithm can be terminated by the number of iterations termCrit.maxCount (number of
+    M-steps) or when relative change of likelihood logarithm is less than termCrit.epsilon. Default
+    maximum number of iterations is EM::DEFAULT_MAX_ITERS=100. */
+    /** @see setTermCriteria */
+    CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(const TermCriteria &val) = 0;
+
+    /** @brief Returns weights of the mixtures
+
+    Returns vector with the number of elements equal to the number of mixtures.
+     */
+    CV_WRAP virtual Mat getWeights() const = 0;
+    /** @brief Returns the cluster centers (means of the Gaussian mixture)
+
+    Returns matrix with the number of rows equal to the number of mixtures and number of columns
+    equal to the space dimensionality.
+     */
+    CV_WRAP virtual Mat getMeans() const = 0;
+    /** @brief Returns covariation matrices
+
+    Returns vector of covariation matrices. Number of matrices is the number of gaussian mixtures,
+    each matrix is a square floating-point matrix NxN, where N is the space dimensionality.
+     */
+    CV_WRAP virtual void getCovs(CV_OUT std::vector<Mat>& covs) const = 0;
+
+    /** @brief Returns a likelihood logarithm value and an index of the most probable mixture component
+    for the given sample.
+
+    @param sample A sample for classification. It should be a one-channel matrix of
+        \f$1 \times dims\f$ or \f$dims \times 1\f$ size.
+    @param probs Optional output matrix that contains posterior probabilities of each component
+        given the sample. It has \f$1 \times nclusters\f$ size and CV_64FC1 type.
+
+    The method returns a two-element double vector. Zero element is a likelihood logarithm value for
+    the sample. First element is an index of the most probable mixture component for the given
+    sample.
+     */
+    CV_WRAP virtual Vec2d predict2(InputArray sample, OutputArray probs) const = 0;
+
+    /** @brief Estimate the Gaussian mixture parameters from a samples set.
+
+    This variation starts with Expectation step. Initial values of the model parameters will be
+    estimated by the k-means algorithm.
+
+    Unlike many of the ML models, %EM is an unsupervised learning algorithm and it does not take
+    responses (class labels or function values) as input. Instead, it computes the *Maximum
+    Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the
+    parameters inside the structure: \f$p_{i,k}\f$ in probs, \f$a_k\f$ in means , \f$S_k\f$ in
+    covs[k], \f$\pi_k\f$ in weights , and optionally computes the output "class label" for each
+    sample: \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most
+    probable mixture component for each sample).
+
+    The trained model can be used further for prediction, just like any other classifier. The
+    trained model is similar to the NormalBayesClassifier.
+
+    @param samples Samples from which the Gaussian mixture model will be estimated. It should be a
+        one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
+        it will be converted to the inner matrix of such type for the further computing.
+    @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for
+        each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.
+    @param labels The optional output "class label" for each sample:
+        \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
+        mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.
+    @param probs The optional output matrix that contains posterior probabilities of each Gaussian
+        mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
+        CV_64FC1 type.
+     */
+    CV_WRAP virtual bool trainEM(InputArray samples,
+                         OutputArray logLikelihoods=noArray(),
+                         OutputArray labels=noArray(),
+                         OutputArray probs=noArray()) = 0;
+
+    /** @brief Estimate the Gaussian mixture parameters from a samples set.
+
+    This variation starts with Expectation step. You need to provide initial means \f$a_k\f$ of
+    mixture components. Optionally you can pass initial weights \f$\pi_k\f$ and covariance matrices
+    \f$S_k\f$ of mixture components.
+
+    @param samples Samples from which the Gaussian mixture model will be estimated. It should be a
+        one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
+        it will be converted to the inner matrix of such type for the further computing.
+    @param means0 Initial means \f$a_k\f$ of mixture components. It is a one-channel matrix of
+        \f$nclusters \times dims\f$ size. If the matrix does not have CV_64F type it will be
+        converted to the inner matrix of such type for the further computing.
+    @param covs0 The vector of initial covariance matrices \f$S_k\f$ of mixture components. Each of
+        covariance matrices is a one-channel matrix of \f$dims \times dims\f$ size. If the matrices
+        do not have CV_64F type they will be converted to the inner matrices of such type for the
+        further computing.
+    @param weights0 Initial weights \f$\pi_k\f$ of mixture components. It should be a one-channel
+        floating-point matrix with \f$1 \times nclusters\f$ or \f$nclusters \times 1\f$ size.
+    @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for
+        each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.
+    @param labels The optional output "class label" for each sample:
+        \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
+        mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.
+    @param probs The optional output matrix that contains posterior probabilities of each Gaussian
+        mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
+        CV_64FC1 type.
+    */
+    CV_WRAP virtual bool trainE(InputArray samples, InputArray means0,
+                        InputArray covs0=noArray(),
+                        InputArray weights0=noArray(),
+                        OutputArray logLikelihoods=noArray(),
+                        OutputArray labels=noArray(),
+                        OutputArray probs=noArray()) = 0;
+
+    /** @brief Estimate the Gaussian mixture parameters from a samples set.
+
+    This variation starts with Maximization step. You need to provide initial probabilities
+    \f$p_{i,k}\f$ to use this option.
+
+    @param samples Samples from which the Gaussian mixture model will be estimated. It should be a
+        one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
+        it will be converted to the inner matrix of such type for the further computing.
+    @param probs0
+    @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for
+        each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.
+    @param labels The optional output "class label" for each sample:
+        \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
+        mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.
+    @param probs The optional output matrix that contains posterior probabilities of each Gaussian
+        mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
+        CV_64FC1 type.
+    */
+    CV_WRAP virtual bool trainM(InputArray samples, InputArray probs0,
+                        OutputArray logLikelihoods=noArray(),
+                        OutputArray labels=noArray(),
+                        OutputArray probs=noArray()) = 0;
+
+    /** Creates empty %EM model.
+    The model should be trained then using StatModel::train(traindata, flags) method. Alternatively, you
+    can use one of the EM::train\* methods or load it from file using Algorithm::load\<EM\>(filename).
+     */
+    CV_WRAP static Ptr<EM> create();
+};
+
+/****************************************************************************************\
+*                                      Decision Tree                                     *
+\****************************************************************************************/
+
+/** @brief The class represents a single decision tree or a collection of decision trees.
+
+The current public interface of the class allows user to train only a single decision tree, however
+the class is capable of storing multiple decision trees and using them for prediction (by summing
+responses or using a voting schemes), and the derived from DTrees classes (such as RTrees and Boost)
+use this capability to implement decision tree ensembles.
+
+@sa @ref ml_intro_trees
+*/
+class CV_EXPORTS_W DTrees : public StatModel
+{
+public:
+    /** Predict options */
+    enum Flags { PREDICT_AUTO=0, PREDICT_SUM=(1<<8), PREDICT_MAX_VOTE=(2<<8), PREDICT_MASK=(3<<8) };
+
+    /** Cluster possible values of a categorical variable into K\<=maxCategories clusters to
+    find a suboptimal split.
+    If a discrete variable, on which the training procedure tries to make a split, takes more than
+    maxCategories values, the precise best subset estimation may take a very long time because the
+    algorithm is exponential. Instead, many decision trees engines (including our implementation)
+    try to find sub-optimal split in this case by clustering all the samples into maxCategories
+    clusters that is some categories are merged together. The clustering is applied only in n \>
+    2-class classification problems for categorical variables with N \> max_categories possible
+    values. In case of regression and 2-class classification the optimal split can be found
+    efficiently without employing clustering, thus the parameter is not used in these cases.
+    Default value is 10.*/
+    /** @see setMaxCategories */
+    CV_WRAP virtual int getMaxCategories() const = 0;
+    /** @copybrief getMaxCategories @see getMaxCategories */
+    CV_WRAP virtual void setMaxCategories(int val) = 0;
+
+    /** The maximum possible depth of the tree.
+    That is the training algorithms attempts to split a node while its depth is less than maxDepth.
+    The root node has zero depth. The actual depth may be smaller if the other termination criteria
+    are met (see the outline of the training procedure @ref ml_intro_trees "here"), and/or if the
+    tree is pruned. Default value is INT_MAX.*/
+    /** @see setMaxDepth */
+    CV_WRAP virtual int getMaxDepth() const = 0;
+    /** @copybrief getMaxDepth @see getMaxDepth */
+    CV_WRAP virtual void setMaxDepth(int val) = 0;
+
+    /** If the number of samples in a node is less than this parameter then the node will not be split.
+
+    Default value is 10.*/
+    /** @see setMinSampleCount */
+    CV_WRAP virtual int getMinSampleCount() const = 0;
+    /** @copybrief getMinSampleCount @see getMinSampleCount */
+    CV_WRAP virtual void setMinSampleCount(int val) = 0;
+
+    /** If CVFolds \> 1 then algorithms prunes the built decision tree using K-fold
+    cross-validation procedure where K is equal to CVFolds.
+    Default value is 10.*/
+    /** @see setCVFolds */
+    CV_WRAP virtual int getCVFolds() const = 0;
+    /** @copybrief getCVFolds @see getCVFolds */
+    CV_WRAP virtual void setCVFolds(int val) = 0;
+
+    /** If true then surrogate splits will be built.
+    These splits allow to work with missing data and compute variable importance correctly.
+    Default value is false.
+    @note currently it's not implemented.*/
+    /** @see setUseSurrogates */
+    CV_WRAP virtual bool getUseSurrogates() const = 0;
+    /** @copybrief getUseSurrogates @see getUseSurrogates */
+    CV_WRAP virtual void setUseSurrogates(bool val) = 0;
+
+    /** If true then a pruning will be harsher.
+    This will make a tree more compact and more resistant to the training data noise but a bit less
+    accurate. Default value is true.*/
+    /** @see setUse1SERule */
+    CV_WRAP virtual bool getUse1SERule() const = 0;
+    /** @copybrief getUse1SERule @see getUse1SERule */
+    CV_WRAP virtual void setUse1SERule(bool val) = 0;
+
+    /** If true then pruned branches are physically removed from the tree.
+    Otherwise they are retained and it is possible to get results from the original unpruned (or
+    pruned less aggressively) tree. Default value is true.*/
+    /** @see setTruncatePrunedTree */
+    CV_WRAP virtual bool getTruncatePrunedTree() const = 0;
+    /** @copybrief getTruncatePrunedTree @see getTruncatePrunedTree */
+    CV_WRAP virtual void setTruncatePrunedTree(bool val) = 0;
+
+    /** Termination criteria for regression trees.
+    If all absolute differences between an estimated value in a node and values of train samples
+    in this node are less than this parameter then the node will not be split further. Default
+    value is 0.01f*/
+    /** @see setRegressionAccuracy */
+    CV_WRAP virtual float getRegressionAccuracy() const = 0;
+    /** @copybrief getRegressionAccuracy @see getRegressionAccuracy */
+    CV_WRAP virtual void setRegressionAccuracy(float val) = 0;
+
+    /** @brief The array of a priori class probabilities, sorted by the class label value.
+
+    The parameter can be used to tune the decision tree preferences toward a certain class. For
+    example, if you want to detect some rare anomaly occurrence, the training base will likely
+    contain much more normal cases than anomalies, so a very good classification performance
+    will be achieved just by considering every case as normal. To avoid this, the priors can be
+    specified, where the anomaly probability is artificially increased (up to 0.5 or even
+    greater), so the weight of the misclassified anomalies becomes much bigger, and the tree is
+    adjusted properly.
+
+    You can also think about this parameter as weights of prediction categories which determine
+    relative weights that you give to misclassification. That is, if the weight of the first
+    category is 1 and the weight of the second category is 10, then each mistake in predicting
+    the second category is equivalent to making 10 mistakes in predicting the first category.
+    Default value is empty Mat.*/
+    /** @see setPriors */
+    CV_WRAP virtual cv::Mat getPriors() const = 0;
+    /** @copybrief getPriors @see getPriors */
+    CV_WRAP virtual void setPriors(const cv::Mat &val) = 0;
+
+    /** @brief The class represents a decision tree node.
+     */
+    class CV_EXPORTS Node
+    {
+    public:
+        Node();
+        double value; //!< Value at the node: a class label in case of classification or estimated
+                      //!< function value in case of regression.
+        int classIdx; //!< Class index normalized to 0..class_count-1 range and assigned to the
+                      //!< node. It is used internally in classification trees and tree ensembles.
+        int parent; //!< Index of the parent node
+        int left; //!< Index of the left child node
+        int right; //!< Index of right child node
+        int defaultDir; //!< Default direction where to go (-1: left or +1: right). It helps in the
+                        //!< case of missing values.
+        int split; //!< Index of the first split
+    };
+
+    /** @brief The class represents split in a decision tree.
+     */
+    class CV_EXPORTS Split
+    {
+    public:
+        Split();
+        int varIdx; //!< Index of variable on which the split is created.
+        bool inversed; //!< If true, then the inverse split rule is used (i.e. left and right
+                       //!< branches are exchanged in the rule expressions below).
+        float quality; //!< The split quality, a positive number. It is used to choose the best split.
+        int next; //!< Index of the next split in the list of splits for the node
+        float c; /**< The threshold value in case of split on an ordered variable.
+                      The rule is:
+                      @code{.none}
+                      if var_value < c
+                        then next_node <- left
+                        else next_node <- right
+                      @endcode */
+        int subsetOfs; /**< Offset of the bitset used by the split on a categorical variable.
+                            The rule is:
+                            @code{.none}
+                            if bitset[var_value] == 1
+                                then next_node <- left
+                                else next_node <- right
+                            @endcode */
+    };
+
+    /** @brief Returns indices of root nodes
+    */
+    virtual const std::vector<int>& getRoots() const = 0;
+    /** @brief Returns all the nodes
+
+    all the node indices are indices in the returned vector
+     */
+    virtual const std::vector<Node>& getNodes() const = 0;
+    /** @brief Returns all the splits
+
+    all the split indices are indices in the returned vector
+     */
+    virtual const std::vector<Split>& getSplits() const = 0;
+    /** @brief Returns all the bitsets for categorical splits
+
+    Split::subsetOfs is an offset in the returned vector
+     */
+    virtual const std::vector<int>& getSubsets() const = 0;
+
+    /** @brief Creates the empty model
+
+    The static method creates empty decision tree with the specified parameters. It should be then
+    trained using train method (see StatModel::train). Alternatively, you can load the model from
+    file using Algorithm::load\<DTrees\>(filename).
+     */
+    CV_WRAP static Ptr<DTrees> create();
+};
+
+/****************************************************************************************\
+*                                   Random Trees Classifier                              *
+\****************************************************************************************/
+
+/** @brief The class implements the random forest predictor.
+
+@sa @ref ml_intro_rtrees
+ */
+class CV_EXPORTS_W RTrees : public DTrees
+{
+public:
+
+    /** If true then variable importance will be calculated and then it can be retrieved by RTrees::getVarImportance.
+    Default value is false.*/
+    /** @see setCalculateVarImportance */
+    CV_WRAP virtual bool getCalculateVarImportance() const = 0;
+    /** @copybrief getCalculateVarImportance @see getCalculateVarImportance */
+    CV_WRAP virtual void setCalculateVarImportance(bool val) = 0;
+
+    /** The size of the randomly selected subset of features at each tree node and that are used
+    to find the best split(s).
+    If you set it to 0 then the size will be set to the square root of the total number of
+    features. Default value is 0.*/
+    /** @see setActiveVarCount */
+    CV_WRAP virtual int getActiveVarCount() const = 0;
+    /** @copybrief getActiveVarCount @see getActiveVarCount */
+    CV_WRAP virtual void setActiveVarCount(int val) = 0;
+
+    /** The termination criteria that specifies when the training algorithm stops.
+    Either when the specified number of trees is trained and added to the ensemble or when
+    sufficient accuracy (measured as OOB error) is achieved. Typically the more trees you have the
+    better the accuracy. However, the improvement in accuracy generally diminishes and asymptotes
+    pass a certain number of trees. Also to keep in mind, the number of tree increases the
+    prediction time linearly. Default value is TermCriteria(TermCriteria::MAX_ITERS +
+    TermCriteria::EPS, 50, 0.1)*/
+    /** @see setTermCriteria */
+    CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(const TermCriteria &val) = 0;
+
+    /** Returns the variable importance array.
+    The method returns the variable importance vector, computed at the training stage when
+    CalculateVarImportance is set to true. If this flag was set to false, the empty matrix is
+    returned.
+     */
+    CV_WRAP virtual Mat getVarImportance() const = 0;
+
+    /** Creates the empty model.
+    Use StatModel::train to train the model, StatModel::train to create and train the model,
+    Algorithm::load to load the pre-trained model.
+     */
+    CV_WRAP static Ptr<RTrees> create();
+};
+
+/****************************************************************************************\
+*                                   Boosted tree classifier                              *
+\****************************************************************************************/
+
+/** @brief Boosted tree classifier derived from DTrees
+
+@sa @ref ml_intro_boost
+ */
+class CV_EXPORTS_W Boost : public DTrees
+{
+public:
+    /** Type of the boosting algorithm.
+    See Boost::Types. Default value is Boost::REAL. */
+    /** @see setBoostType */
+    CV_WRAP virtual int getBoostType() const = 0;
+    /** @copybrief getBoostType @see getBoostType */
+    CV_WRAP virtual void setBoostType(int val) = 0;
+
+    /** The number of weak classifiers.
+    Default value is 100. */
+    /** @see setWeakCount */
+    CV_WRAP virtual int getWeakCount() const = 0;
+    /** @copybrief getWeakCount @see getWeakCount */
+    CV_WRAP virtual void setWeakCount(int val) = 0;
+
+    /** A threshold between 0 and 1 used to save computational time.
+    Samples with summary weight \f$\leq 1 - weight_trim_rate\f$ do not participate in the *next*
+    iteration of training. Set this parameter to 0 to turn off this functionality. Default value is 0.95.*/
+    /** @see setWeightTrimRate */
+    CV_WRAP virtual double getWeightTrimRate() const = 0;
+    /** @copybrief getWeightTrimRate @see getWeightTrimRate */
+    CV_WRAP virtual void setWeightTrimRate(double val) = 0;
+
+    /** Boosting type.
+    Gentle AdaBoost and Real AdaBoost are often the preferable choices. */
+    enum Types {
+        DISCRETE=0, //!< Discrete AdaBoost.
+        REAL=1, //!< Real AdaBoost. It is a technique that utilizes confidence-rated predictions
+                //!< and works well with categorical data.
+        LOGIT=2, //!< LogitBoost. It can produce good regression fits.
+        GENTLE=3 //!< Gentle AdaBoost. It puts less weight on outlier data points and for that
+                 //!<reason is often good with regression data.
+    };
+
+    /** Creates the empty model.
+    Use StatModel::train to train the model, Algorithm::load\<Boost\>(filename) to load the pre-trained model. */
+    CV_WRAP static Ptr<Boost> create();
+};
+
+/****************************************************************************************\
+*                                   Gradient Boosted Trees                               *
+\****************************************************************************************/
+
+/*class CV_EXPORTS_W GBTrees : public DTrees
+{
+public:
+    struct CV_EXPORTS_W_MAP Params : public DTrees::Params
+    {
+        CV_PROP_RW int weakCount;
+        CV_PROP_RW int lossFunctionType;
+        CV_PROP_RW float subsamplePortion;
+        CV_PROP_RW float shrinkage;
+
+        Params();
+        Params( int lossFunctionType, int weakCount, float shrinkage,
+                float subsamplePortion, int maxDepth, bool useSurrogates );
+    };
+
+    enum {SQUARED_LOSS=0, ABSOLUTE_LOSS, HUBER_LOSS=3, DEVIANCE_LOSS};
+
+    virtual void setK(int k) = 0;
+
+    virtual float predictSerial( InputArray samples,
+                                 OutputArray weakResponses, int flags) const = 0;
+
+    static Ptr<GBTrees> create(const Params& p);
+};*/
+
+/****************************************************************************************\
+*                              Artificial Neural Networks (ANN)                          *
+\****************************************************************************************/
+
+/////////////////////////////////// Multi-Layer Perceptrons //////////////////////////////
+
+/** @brief Artificial Neural Networks - Multi-Layer Perceptrons.
+
+Unlike many other models in ML that are constructed and trained at once, in the MLP model these
+steps are separated. First, a network with the specified topology is created using the non-default
+constructor or the method ANN_MLP::create. All the weights are set to zeros. Then, the network is
+trained using a set of input and output vectors. The training procedure can be repeated more than
+once, that is, the weights can be adjusted based on the new training data.
+
+Additional flags for StatModel::train are available: ANN_MLP::TrainFlags.
+
+@sa @ref ml_intro_ann
+ */
+class CV_EXPORTS_W ANN_MLP : public StatModel
+{
+public:
+    /** Available training methods */
+    enum TrainingMethods {
+        BACKPROP=0, //!< The back-propagation algorithm.
+        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+    };
+
+    /** Sets training method and common parameters.
+    @param method Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods.
+    @param param1 passed to setRpropDW0 for ANN_MLP::RPROP and to setBackpropWeightScale for ANN_MLP::BACKPROP
+    @param param2 passed to setRpropDWMin for ANN_MLP::RPROP and to setBackpropMomentumScale for ANN_MLP::BACKPROP.
+    */
+    CV_WRAP virtual void setTrainMethod(int method, double param1 = 0, double param2 = 0) = 0;
+
+    /** Returns current training method */
+    CV_WRAP virtual int getTrainMethod() const = 0;
+
+    /** Initialize the activation function for each neuron.
+    Currently the default and the only fully supported activation function is ANN_MLP::SIGMOID_SYM.
+    @param type The type of activation function. See ANN_MLP::ActivationFunctions.
+    @param param1 The first parameter of the activation function, \f$\alpha\f$. Default value is 0.
+    @param param2 The second parameter of the activation function, \f$\beta\f$. Default value is 0.
+    */
+    CV_WRAP virtual void setActivationFunction(int type, double param1 = 0, double param2 = 0) = 0;
+
+    /**  Integer vector specifying the number of neurons in each layer including the input and output layers.
+    The very first element specifies the number of elements in the input layer.
+    The last element - number of elements in the output layer. Default value is empty Mat.
+    @sa getLayerSizes */
+    CV_WRAP virtual void setLayerSizes(InputArray _layer_sizes) = 0;
+
+    /**  Integer vector specifying the number of neurons in each layer including the input and output layers.
+    The very first element specifies the number of elements in the input layer.
+    The last element - number of elements in the output layer.
+    @sa setLayerSizes */
+    CV_WRAP virtual cv::Mat getLayerSizes() const = 0;
+
+    /** Termination criteria of the training algorithm.
+    You can specify the maximum number of iterations (maxCount) and/or how much the error could
+    change between the iterations to make the algorithm continue (epsilon). Default value is
+    TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, 0.01).*/
+    /** @see setTermCriteria */
+    CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(TermCriteria val) = 0;
+
+    /** BPROP: Strength of the weight gradient term.
+    The recommended value is about 0.1. Default value is 0.1.*/
+    /** @see setBackpropWeightScale */
+    CV_WRAP virtual double getBackpropWeightScale() const = 0;
+    /** @copybrief getBackpropWeightScale @see getBackpropWeightScale */
+    CV_WRAP virtual void setBackpropWeightScale(double val) = 0;
+
+    /** BPROP: Strength of the momentum term (the difference between weights on the 2 previous iterations).
+    This parameter provides some inertia to smooth the random fluctuations of the weights. It can
+    vary from 0 (the feature is disabled) to 1 and beyond. The value 0.1 or so is good enough.
+    Default value is 0.1.*/
+    /** @see setBackpropMomentumScale */
+    CV_WRAP virtual double getBackpropMomentumScale() const = 0;
+    /** @copybrief getBackpropMomentumScale @see getBackpropMomentumScale */
+    CV_WRAP virtual void setBackpropMomentumScale(double val) = 0;
+
+    /** RPROP: Initial value \f$\Delta_0\f$ of update-values \f$\Delta_{ij}\f$.
+    Default value is 0.1.*/
+    /** @see setRpropDW0 */
+    CV_WRAP virtual double getRpropDW0() const = 0;
+    /** @copybrief getRpropDW0 @see getRpropDW0 */
+    CV_WRAP virtual void setRpropDW0(double val) = 0;
+
+    /** RPROP: Increase factor \f$\eta^+\f$.
+    It must be \>1. Default value is 1.2.*/
+    /** @see setRpropDWPlus */
+    CV_WRAP virtual double getRpropDWPlus() const = 0;
+    /** @copybrief getRpropDWPlus @see getRpropDWPlus */
+    CV_WRAP virtual void setRpropDWPlus(double val) = 0;
+
+    /** RPROP: Decrease factor \f$\eta^-\f$.
+    It must be \<1. Default value is 0.5.*/
+    /** @see setRpropDWMinus */
+    CV_WRAP virtual double getRpropDWMinus() const = 0;
+    /** @copybrief getRpropDWMinus @see getRpropDWMinus */
+    CV_WRAP virtual void setRpropDWMinus(double val) = 0;
+
+    /** RPROP: Update-values lower limit \f$\Delta_{min}\f$.
+    It must be positive. Default value is FLT_EPSILON.*/
+    /** @see setRpropDWMin */
+    CV_WRAP virtual double getRpropDWMin() const = 0;
+    /** @copybrief getRpropDWMin @see getRpropDWMin */
+    CV_WRAP virtual void setRpropDWMin(double val) = 0;
+
+    /** RPROP: Update-values upper limit \f$\Delta_{max}\f$.
+    It must be \>1. Default value is 50.*/
+    /** @see setRpropDWMax */
+    CV_WRAP virtual double getRpropDWMax() const = 0;
+    /** @copybrief getRpropDWMax @see getRpropDWMax */
+    CV_WRAP virtual void setRpropDWMax(double val) = 0;
+
+    /** possible activation functions */
+    enum ActivationFunctions {
+        /** Identity function: \f$f(x)=x\f$ */
+        IDENTITY = 0,
+        /** Symmetrical sigmoid: \f$f(x)=\beta*(1-e^{-\alpha x})/(1+e^{-\alpha x}\f$
+        @note
+        If you are using the default sigmoid activation function with the default parameter values
+        fparam1=0 and fparam2=0 then the function used is y = 1.7159\*tanh(2/3 \* x), so the output
+        will range from [-1.7159, 1.7159], instead of [0,1].*/
+        SIGMOID_SYM = 1,
+        /** Gaussian function: \f$f(x)=\beta e^{-\alpha x*x}\f$ */
+        GAUSSIAN = 2
+    };
+
+    /** Train options */
+    enum TrainFlags {
+        /** Update the network weights, rather than compute them from scratch. In the latter case
+        the weights are initialized using the Nguyen-Widrow algorithm. */
+        UPDATE_WEIGHTS = 1,
+        /** Do not normalize the input vectors. If this flag is not set, the training algorithm
+        normalizes each input feature independently, shifting its mean value to 0 and making the
+        standard deviation equal to 1. If the network is assumed to be updated frequently, the new
+        training data could be much different from original one. In this case, you should take care
+        of proper normalization. */
+        NO_INPUT_SCALE = 2,
+        /** Do not normalize the output vectors. If the flag is not set, the training algorithm
+        normalizes each output feature independently, by transforming it to the certain range
+        depending on the used activation function. */
+        NO_OUTPUT_SCALE = 4
+    };
+
+    CV_WRAP virtual Mat getWeights(int layerIdx) const = 0;
+
+    /** @brief Creates empty model
+
+    Use StatModel::train to train the model, Algorithm::load\<ANN_MLP\>(filename) to load the pre-trained model.
+    Note that the train method has optional flags: ANN_MLP::TrainFlags.
+     */
+    CV_WRAP static Ptr<ANN_MLP> create();
+};
+
+/****************************************************************************************\
+*                           Logistic Regression                                          *
+\****************************************************************************************/
+
+/** @brief Implements Logistic Regression classifier.
+
+@sa @ref ml_intro_lr
+ */
+class CV_EXPORTS_W LogisticRegression : public StatModel
+{
+public:
+
+    /** Learning rate. */
+    /** @see setLearningRate */
+    CV_WRAP virtual double getLearningRate() const = 0;
+    /** @copybrief getLearningRate @see getLearningRate */
+    CV_WRAP virtual void setLearningRate(double val) = 0;
+
+    /** Number of iterations. */
+    /** @see setIterations */
+    CV_WRAP virtual int getIterations() const = 0;
+    /** @copybrief getIterations @see getIterations */
+    CV_WRAP virtual void setIterations(int val) = 0;
+
+    /** Kind of regularization to be applied. See LogisticRegression::RegKinds. */
+    /** @see setRegularization */
+    CV_WRAP virtual int getRegularization() const = 0;
+    /** @copybrief getRegularization @see getRegularization */
+    CV_WRAP virtual void setRegularization(int val) = 0;
+
+    /** Kind of training method used. See LogisticRegression::Methods. */
+    /** @see setTrainMethod */
+    CV_WRAP virtual int getTrainMethod() const = 0;
+    /** @copybrief getTrainMethod @see getTrainMethod */
+    CV_WRAP virtual void setTrainMethod(int val) = 0;
+
+    /** Specifies the number of training samples taken in each step of Mini-Batch Gradient
+    Descent. Will only be used if using LogisticRegression::MINI_BATCH training algorithm. It
+    has to take values less than the total number of training samples. */
+    /** @see setMiniBatchSize */
+    CV_WRAP virtual int getMiniBatchSize() const = 0;
+    /** @copybrief getMiniBatchSize @see getMiniBatchSize */
+    CV_WRAP virtual void setMiniBatchSize(int val) = 0;
+
+    /** Termination criteria of the algorithm. */
+    /** @see setTermCriteria */
+    CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(TermCriteria val) = 0;
+
+    //! Regularization kinds
+    enum RegKinds {
+        REG_DISABLE = -1, //!< Regularization disabled
+        REG_L1 = 0, //!< %L1 norm
+        REG_L2 = 1 //!< %L2 norm
+    };
+
+    //! Training methods
+    enum Methods {
+        BATCH = 0,
+        MINI_BATCH = 1 //!< Set MiniBatchSize to a positive integer when using this method.
+    };
+
+    /** @brief Predicts responses for input samples and returns a float type.
+
+    @param samples The input data for the prediction algorithm. Matrix [m x n], where each row
+        contains variables (features) of one object being classified. Should have data type CV_32F.
+    @param results Predicted labels as a column matrix of type CV_32S.
+    @param flags Not used.
+     */
+    CV_WRAP virtual float predict( InputArray samples, OutputArray results=noArray(), int flags=0 ) const = 0;
+
+    /** @brief This function returns the trained paramters arranged across rows.
+
+    For a two class classifcation problem, it returns a row matrix. It returns learnt paramters of
+    the Logistic Regression as a matrix of type CV_32F.
+     */
+    CV_WRAP virtual Mat get_learnt_thetas() const = 0;
+
+    /** @brief Creates empty model.
+
+    Creates Logistic Regression model with parameters given.
+     */
+    CV_WRAP static Ptr<LogisticRegression> create();
+};
+
+/****************************************************************************************\
+*                           Auxilary functions declarations                              *
+\****************************************************************************************/
+
+/** @brief Generates _sample_ from multivariate normal distribution
+
+@param mean an average row vector
+@param cov symmetric covariation matrix
+@param nsamples returned samples count
+@param samples returned samples array
+*/
+CV_EXPORTS void randMVNormal( InputArray mean, InputArray cov, int nsamples, OutputArray samples);
+
+/** @brief Creates test set */
+CV_EXPORTS void createConcentricSpheresTestSet( int nsamples, int nfeatures, int nclasses,
+                                                OutputArray samples, OutputArray responses);
+
+//! @} ml
+
+}
+}
+
+#endif // __cplusplus
+#endif // __OPENCV_ML_HPP__
+
+/* End of file. */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp
new file mode 100644
index 0000000..f6f9cd8
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/ml.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp
new file mode 100644
index 0000000..f2fc211
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp
@@ -0,0 +1,468 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_OBJDETECT_HPP__
+#define __OPENCV_OBJDETECT_HPP__
+
+#include "opencv2/core.hpp"
+
+/**
+@defgroup objdetect Object Detection
+
+Haar Feature-based Cascade Classifier for Object Detection
+----------------------------------------------------------
+
+The object detector described below has been initially proposed by Paul Viola @cite Viola01 and
+improved by Rainer Lienhart @cite Lienhart02 .
+
+First, a classifier (namely a *cascade of boosted classifiers working with haar-like features*) is
+trained with a few hundred sample views of a particular object (i.e., a face or a car), called
+positive examples, that are scaled to the same size (say, 20x20), and negative examples - arbitrary
+images of the same size.
+
+After a classifier is trained, it can be applied to a region of interest (of the same size as used
+during the training) in an input image. The classifier outputs a "1" if the region is likely to show
+the object (i.e., face/car), and "0" otherwise. To search for the object in the whole image one can
+move the search window across the image and check every location using the classifier. The
+classifier is designed so that it can be easily "resized" in order to be able to find the objects of
+interest at different sizes, which is more efficient than resizing the image itself. So, to find an
+object of an unknown size in the image the scan procedure should be done several times at different
+scales.
+
+The word "cascade" in the classifier name means that the resultant classifier consists of several
+simpler classifiers (*stages*) that are applied subsequently to a region of interest until at some
+stage the candidate is rejected or all the stages are passed. The word "boosted" means that the
+classifiers at every stage of the cascade are complex themselves and they are built out of basic
+classifiers using one of four different boosting techniques (weighted voting). Currently Discrete
+Adaboost, Real Adaboost, Gentle Adaboost and Logitboost are supported. The basic classifiers are
+decision-tree classifiers with at least 2 leaves. Haar-like features are the input to the basic
+classifiers, and are calculated as described below. The current algorithm uses the following
+Haar-like features:
+
+![image](pics/haarfeatures.png)
+
+The feature used in a particular classifier is specified by its shape (1a, 2b etc.), position within
+the region of interest and the scale (this scale is not the same as the scale used at the detection
+stage, though these two scales are multiplied). For example, in the case of the third line feature
+(2c) the response is calculated as the difference between the sum of image pixels under the
+rectangle covering the whole feature (including the two white stripes and the black stripe in the
+middle) and the sum of the image pixels under the black stripe multiplied by 3 in order to
+compensate for the differences in the size of areas. The sums of pixel values over a rectangular
+regions are calculated rapidly using integral images (see below and the integral description).
+
+To see the object detector at work, have a look at the facedetect demo:
+<https://github.com/Itseez/opencv/tree/master/samples/cpp/dbt_face_detection.cpp>
+
+The following reference is for the detection part only. There is a separate application called
+opencv_traincascade that can train a cascade of boosted classifiers from a set of samples.
+
+@note In the new C++ interface it is also possible to use LBP (local binary pattern) features in
+addition to Haar-like features. .. [Viola01] Paul Viola and Michael J. Jones. Rapid Object Detection
+using a Boosted Cascade of Simple Features. IEEE CVPR, 2001. The paper is available online at
+<http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_CVPR2001.pdf>
+
+@{
+    @defgroup objdetect_c C API
+@}
+ */
+
+typedef struct CvHaarClassifierCascade CvHaarClassifierCascade;
+
+namespace cv
+{
+
+//! @addtogroup objdetect
+//! @{
+
+///////////////////////////// Object Detection ////////////////////////////
+
+//! class for grouping object candidates, detected by Cascade Classifier, HOG etc.
+//! instance of the class is to be passed to cv::partition (see cxoperations.hpp)
+class CV_EXPORTS SimilarRects
+{
+public:
+    SimilarRects(double _eps) : eps(_eps) {}
+    inline bool operator()(const Rect& r1, const Rect& r2) const
+    {
+		/*
+        double delta = eps*(std::min(r1.width, r2.width) + std::min(r1.height, r2.height))*0.5;
+        return std::abs(r1.x - r2.x) <= delta &&
+            std::abs(r1.y - r2.y) <= delta &&
+            std::abs(r1.x + r1.width - r2.x - r2.width) <= delta &&
+            std::abs(r1.y + r1.height - r2.y - r2.height) <= delta;
+			*/
+    }
+    double eps;
+};
+
+/** @brief Groups the object candidate rectangles.
+
+@param rectList Input/output vector of rectangles. Output vector includes retained and grouped
+rectangles. (The Python list is not modified in place.)
+@param groupThreshold Minimum possible number of rectangles minus 1. The threshold is used in a
+group of rectangles to retain it.
+@param eps Relative difference between sides of the rectangles to merge them into a group.
+
+The function is a wrapper for the generic function partition . It clusters all the input rectangles
+using the rectangle equivalence criteria that combines rectangles with similar sizes and similar
+locations. The similarity is defined by eps. When eps=0 , no clustering is done at all. If
+\f$\texttt{eps}\rightarrow +\inf\f$ , all the rectangles are put in one cluster. Then, the small
+clusters containing less than or equal to groupThreshold rectangles are rejected. In each other
+cluster, the average rectangle is computed and put into the output rectangle list.
+ */
+CV_EXPORTS   void groupRectangles(std::vector<Rect>& rectList, int groupThreshold, double eps = 0.2);
+/** @overload */
+CV_EXPORTS_W void groupRectangles(CV_IN_OUT std::vector<Rect>& rectList, CV_OUT std::vector<int>& weights,
+                                  int groupThreshold, double eps = 0.2);
+/** @overload */
+CV_EXPORTS   void groupRectangles(std::vector<Rect>& rectList, int groupThreshold,
+                                  double eps, std::vector<int>* weights, std::vector<double>* levelWeights );
+/** @overload */
+CV_EXPORTS   void groupRectangles(std::vector<Rect>& rectList, std::vector<int>& rejectLevels,
+                                  std::vector<double>& levelWeights, int groupThreshold, double eps = 0.2);
+/** @overload */
+CV_EXPORTS   void groupRectangles_meanshift(std::vector<Rect>& rectList, std::vector<double>& foundWeights,
+                                            std::vector<double>& foundScales,
+                                            double detectThreshold = 0.0, Size winDetSize = Size(64, 128));
+
+template<> CV_EXPORTS void DefaultDeleter<CvHaarClassifierCascade>::operator ()(CvHaarClassifierCascade* obj) const;
+
+enum { CASCADE_DO_CANNY_PRUNING    = 1,
+       CASCADE_SCALE_IMAGE         = 2,
+       CASCADE_FIND_BIGGEST_OBJECT = 4,
+       CASCADE_DO_ROUGH_SEARCH     = 8
+     };
+
+class CV_EXPORTS_W BaseCascadeClassifier : public Algorithm
+{
+public:
+    virtual ~BaseCascadeClassifier();
+    virtual bool empty() const = 0;
+    virtual bool load( const String& filename ) = 0;
+    virtual void detectMultiScale( InputArray image,
+                           CV_OUT std::vector<Rect>& objects,
+                           double scaleFactor,
+                           int minNeighbors, int flags,
+                           Size minSize, Size maxSize ) = 0;
+
+    virtual void detectMultiScale( InputArray image,
+                           CV_OUT std::vector<Rect>& objects,
+                           CV_OUT std::vector<int>& numDetections,
+                           double scaleFactor,
+                           int minNeighbors, int flags,
+                           Size minSize, Size maxSize ) = 0;
+
+    virtual void detectMultiScale( InputArray image,
+                                   CV_OUT std::vector<Rect>& objects,
+                                   CV_OUT std::vector<int>& rejectLevels,
+                                   CV_OUT std::vector<double>& levelWeights,
+                                   double scaleFactor,
+                                   int minNeighbors, int flags,
+                                   Size minSize, Size maxSize,
+                                   bool outputRejectLevels ) = 0;
+
+    virtual bool isOldFormatCascade() const = 0;
+    virtual Size getOriginalWindowSize() const = 0;
+    virtual int getFeatureType() const = 0;
+    virtual void* getOldCascade() = 0;
+
+    class CV_EXPORTS MaskGenerator
+    {
+    public:
+        virtual ~MaskGenerator() {}
+        virtual Mat generateMask(const Mat& src)=0;
+        virtual void initializeMask(const Mat& /*src*/) { }
+    };
+    virtual void setMaskGenerator(const Ptr<MaskGenerator>& maskGenerator) = 0;
+    virtual Ptr<MaskGenerator> getMaskGenerator() = 0;
+};
+
+/** @brief Cascade classifier class for object detection.
+ */
+class CV_EXPORTS_W CascadeClassifier
+{
+public:
+    CV_WRAP CascadeClassifier();
+    /** @brief Loads a classifier from a file.
+
+    @param filename Name of the file from which the classifier is loaded.
+     */
+    CV_WRAP CascadeClassifier(const String& filename);
+    ~CascadeClassifier();
+    /** @brief Checks whether the classifier has been loaded.
+    */
+    CV_WRAP bool empty() const;
+    /** @brief Loads a classifier from a file.
+
+    @param filename Name of the file from which the classifier is loaded. The file may contain an old
+    HAAR classifier trained by the haartraining application or a new cascade classifier trained by the
+    traincascade application.
+     */
+    CV_WRAP bool load( const String& filename );
+    /** @brief Reads a classifier from a FileStorage node.
+
+    @note The file may contain a new cascade classifier (trained traincascade application) only.
+     */
+    CV_WRAP bool read( const FileNode& node );
+
+    /** @brief Detects objects of different sizes in the input image. The detected objects are returned as a list
+    of rectangles.
+
+    @param image Matrix of the type CV_8U containing an image where objects are detected.
+    @param objects Vector of rectangles where each rectangle contains the detected object, the
+    rectangles may be partially outside the original image.
+    @param scaleFactor Parameter specifying how much the image size is reduced at each image scale.
+    @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have
+    to retain it.
+    @param flags Parameter with the same meaning for an old cascade as in the function
+    cvHaarDetectObjects. It is not used for a new cascade.
+    @param minSize Minimum possible object size. Objects smaller than that are ignored.
+    @param maxSize Maximum possible object size. Objects larger than that are ignored.
+
+    The function is parallelized with the TBB library.
+
+    @note
+       -   (Python) A face detection example using cascade classifiers can be found at
+            opencv_source_code/samples/python/facedetect.py
+    */
+    CV_WRAP void detectMultiScale( InputArray image,
+                          CV_OUT std::vector<Rect>& objects,
+                          double scaleFactor = 1.1,
+                          int minNeighbors = 3, int flags = 0,
+                          Size minSize = Size(),
+                          Size maxSize = Size() );
+
+    /** @overload
+    @param image Matrix of the type CV_8U containing an image where objects are detected.
+    @param objects Vector of rectangles where each rectangle contains the detected object, the
+    rectangles may be partially outside the original image.
+    @param numDetections Vector of detection numbers for the corresponding objects. An object's number
+    of detections is the number of neighboring positively classified rectangles that were joined
+    together to form the object.
+    @param scaleFactor Parameter specifying how much the image size is reduced at each image scale.
+    @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have
+    to retain it.
+    @param flags Parameter with the same meaning for an old cascade as in the function
+    cvHaarDetectObjects. It is not used for a new cascade.
+    @param minSize Minimum possible object size. Objects smaller than that are ignored.
+    @param maxSize Maximum possible object size. Objects larger than that are ignored.
+    */
+    CV_WRAP_AS(detectMultiScale2) void detectMultiScale( InputArray image,
+                          CV_OUT std::vector<Rect>& objects,
+                          CV_OUT std::vector<int>& numDetections,
+                          double scaleFactor=1.1,
+                          int minNeighbors=3, int flags=0,
+                          Size minSize=Size(),
+                          Size maxSize=Size() );
+
+    /** @overload
+    if `outputRejectLevels` is `true` returns `rejectLevels` and `levelWeights`
+    */
+    CV_WRAP_AS(detectMultiScale3) void detectMultiScale( InputArray image,
+                                  CV_OUT std::vector<Rect>& objects,
+                                  CV_OUT std::vector<int>& rejectLevels,
+                                  CV_OUT std::vector<double>& levelWeights,
+                                  double scaleFactor = 1.1,
+                                  int minNeighbors = 3, int flags = 0,
+                                  Size minSize = Size(),
+                                  Size maxSize = Size(),
+                                  bool outputRejectLevels = false );
+
+    CV_WRAP bool isOldFormatCascade() const;
+    CV_WRAP Size getOriginalWindowSize() const;
+    CV_WRAP int getFeatureType() const;
+    void* getOldCascade();
+
+    CV_WRAP static bool convert(const String& oldcascade, const String& newcascade);
+
+    void setMaskGenerator(const Ptr<BaseCascadeClassifier::MaskGenerator>& maskGenerator);
+    Ptr<BaseCascadeClassifier::MaskGenerator> getMaskGenerator();
+
+    Ptr<BaseCascadeClassifier> cc;
+};
+
+CV_EXPORTS Ptr<BaseCascadeClassifier::MaskGenerator> createFaceDetectionMaskGenerator();
+
+//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
+
+//! struct for detection region of interest (ROI)
+struct DetectionROI
+{
+   //! scale(size) of the bounding box
+   double scale;
+   //! set of requrested locations to be evaluated
+   std::vector<cv::Point> locations;
+   //! vector that will contain confidence values for each location
+   std::vector<double> confidences;
+};
+
+struct CV_EXPORTS_W HOGDescriptor
+{
+public:
+    enum { L2Hys = 0
+         };
+    enum { DEFAULT_NLEVELS = 64
+         };
+
+    CV_WRAP HOGDescriptor() : winSize(64,128), blockSize(16,16), blockStride(8,8),
+        cellSize(8,8), nbins(9), derivAperture(1), winSigma(-1),
+        histogramNormType(HOGDescriptor::L2Hys), L2HysThreshold(0.2), gammaCorrection(true),
+        free_coef(-1.f), nlevels(HOGDescriptor::DEFAULT_NLEVELS), signedGradient(false)
+    {}
+
+    CV_WRAP HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride,
+                  Size _cellSize, int _nbins, int _derivAperture=1, double _winSigma=-1,
+                  int _histogramNormType=HOGDescriptor::L2Hys,
+                  double _L2HysThreshold=0.2, bool _gammaCorrection=false,
+                  int _nlevels=HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient=false)
+    : winSize(_winSize), blockSize(_blockSize), blockStride(_blockStride), cellSize(_cellSize),
+    nbins(_nbins), derivAperture(_derivAperture), winSigma(_winSigma),
+    histogramNormType(_histogramNormType), L2HysThreshold(_L2HysThreshold),
+    gammaCorrection(_gammaCorrection), free_coef(-1.f), nlevels(_nlevels), signedGradient(_signedGradient)
+    {}
+
+    CV_WRAP HOGDescriptor(const String& filename)
+    {
+        load(filename);
+    }
+
+    HOGDescriptor(const HOGDescriptor& d)
+    {
+        d.copyTo(*this);
+    }
+
+    virtual ~HOGDescriptor() {}
+
+    CV_WRAP size_t getDescriptorSize() const;
+    CV_WRAP bool checkDetectorSize() const;
+    CV_WRAP double getWinSigma() const;
+
+    CV_WRAP virtual void setSVMDetector(InputArray _svmdetector);
+
+    virtual bool read(FileNode& fn);
+    virtual void write(FileStorage& fs, const String& objname) const;
+
+    CV_WRAP virtual bool load(const String& filename, const String& objname = String());
+    CV_WRAP virtual void save(const String& filename, const String& objname = String()) const;
+    virtual void copyTo(HOGDescriptor& c) const;
+
+    CV_WRAP virtual void compute(InputArray img,
+                         CV_OUT std::vector<float>& descriptors,
+                         Size winStride = Size(), Size padding = Size(),
+                         const std::vector<Point>& locations = std::vector<Point>()) const;
+
+    //! with found weights output
+    CV_WRAP virtual void detect(const Mat& img, CV_OUT std::vector<Point>& foundLocations,
+                        CV_OUT std::vector<double>& weights,
+                        double hitThreshold = 0, Size winStride = Size(),
+                        Size padding = Size(),
+                        const std::vector<Point>& searchLocations = std::vector<Point>()) const;
+    //! without found weights output
+    virtual void detect(const Mat& img, CV_OUT std::vector<Point>& foundLocations,
+                        double hitThreshold = 0, Size winStride = Size(),
+                        Size padding = Size(),
+                        const std::vector<Point>& searchLocations=std::vector<Point>()) const;
+
+    //! with result weights output
+    CV_WRAP virtual void detectMultiScale(InputArray img, CV_OUT std::vector<Rect>& foundLocations,
+                                  CV_OUT std::vector<double>& foundWeights, double hitThreshold = 0,
+                                  Size winStride = Size(), Size padding = Size(), double scale = 1.05,
+                                  double finalThreshold = 2.0,bool useMeanshiftGrouping = false) const;
+    //! without found weights output
+    virtual void detectMultiScale(InputArray img, CV_OUT std::vector<Rect>& foundLocations,
+                                  double hitThreshold = 0, Size winStride = Size(),
+                                  Size padding = Size(), double scale = 1.05,
+                                  double finalThreshold = 2.0, bool useMeanshiftGrouping = false) const;
+
+    CV_WRAP virtual void computeGradient(const Mat& img, CV_OUT Mat& grad, CV_OUT Mat& angleOfs,
+                                 Size paddingTL = Size(), Size paddingBR = Size()) const;
+
+    CV_WRAP static std::vector<float> getDefaultPeopleDetector();
+    CV_WRAP static std::vector<float> getDaimlerPeopleDetector();
+
+    CV_PROP Size winSize;
+    CV_PROP Size blockSize;
+    CV_PROP Size blockStride;
+    CV_PROP Size cellSize;
+    CV_PROP int nbins;
+    CV_PROP int derivAperture;
+    CV_PROP double winSigma;
+    CV_PROP int histogramNormType;
+    CV_PROP double L2HysThreshold;
+    CV_PROP bool gammaCorrection;
+    CV_PROP std::vector<float> svmDetector;
+    UMat oclSvmDetector;
+    float free_coef;
+    CV_PROP int nlevels;
+    CV_PROP bool signedGradient;
+
+
+    //! evaluate specified ROI and return confidence value for each location
+    virtual void detectROI(const cv::Mat& img, const std::vector<cv::Point> &locations,
+                                   CV_OUT std::vector<cv::Point>& foundLocations, CV_OUT std::vector<double>& confidences,
+                                   double hitThreshold = 0, cv::Size winStride = Size(),
+                                   cv::Size padding = Size()) const;
+
+    //! evaluate specified ROI and return confidence value for each location in multiple scales
+    virtual void detectMultiScaleROI(const cv::Mat& img,
+                                                       CV_OUT std::vector<cv::Rect>& foundLocations,
+                                                       std::vector<DetectionROI>& locations,
+                                                       double hitThreshold = 0,
+                                                       int groupThreshold = 0) const;
+
+    //! read/parse Dalal's alt model file
+    void readALTModel(String modelfile);
+    void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
+};
+
+//! @} objdetect
+
+}
+
+#include "opencv2/objdetect/detection_based_tracker.hpp"
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/objdetect/objdetect_c.h"
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp
new file mode 100644
index 0000000..1f5f1d3
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp
@@ -0,0 +1,225 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_OBJDETECT_DBT_HPP__
+#define __OPENCV_OBJDETECT_DBT_HPP__
+
+// After this condition removal update blacklist for bindings: modules/python/common.cmake
+#if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(__ANDROID__) || \
+  (defined(__cplusplus) &&  __cplusplus > 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1700)
+
+#include <vector>
+
+namespace cv
+{
+
+//! @addtogroup objdetect
+//! @{
+
+class CV_EXPORTS DetectionBasedTracker
+{
+    public:
+        struct Parameters
+        {
+            int maxTrackLifetime;
+            int minDetectionPeriod; //the minimal time between run of the big object detector (on the whole frame) in ms (1000 mean 1 sec), default=0
+
+            Parameters();
+        };
+
+        class IDetector
+        {
+            public:
+                IDetector():
+                    minObjSize(96, 96),
+                    maxObjSize(INT_MAX, INT_MAX),
+                    minNeighbours(2),
+                    scaleFactor(1.1f)
+                {}
+
+                virtual void detect(const cv::Mat& image, std::vector<cv::Rect>& objects) = 0;
+
+                void setMinObjectSize(const cv::Size& min)
+                {
+                    minObjSize = min;
+                }
+                void setMaxObjectSize(const cv::Size& max)
+                {
+                    maxObjSize = max;
+                }
+                cv::Size getMinObjectSize() const
+                {
+                    return minObjSize;
+                }
+                cv::Size getMaxObjectSize() const
+                {
+                    return maxObjSize;
+                }
+                float getScaleFactor()
+                {
+                    return scaleFactor;
+                }
+                void setScaleFactor(float value)
+                {
+                    scaleFactor = value;
+                }
+                int getMinNeighbours()
+                {
+                    return minNeighbours;
+                }
+                void setMinNeighbours(int value)
+                {
+                    minNeighbours = value;
+                }
+                virtual ~IDetector() {}
+
+            protected:
+                cv::Size minObjSize;
+                cv::Size maxObjSize;
+                int minNeighbours;
+                float scaleFactor;
+        };
+
+        DetectionBasedTracker(cv::Ptr<IDetector> mainDetector, cv::Ptr<IDetector> trackingDetector, const Parameters& params);
+        virtual ~DetectionBasedTracker();
+
+        virtual bool run();
+        virtual void stop();
+        virtual void resetTracking();
+
+        virtual void process(const cv::Mat& imageGray);
+
+        bool setParameters(const Parameters& params);
+        const Parameters& getParameters() const;
+
+
+        typedef std::pair<cv::Rect, int> Object;
+        virtual void getObjects(std::vector<cv::Rect>& result) const;
+        virtual void getObjects(std::vector<Object>& result) const;
+
+        enum ObjectStatus
+        {
+            DETECTED_NOT_SHOWN_YET,
+            DETECTED,
+            DETECTED_TEMPORARY_LOST,
+            WRONG_OBJECT
+        };
+        struct ExtObject
+        {
+            int id;
+            cv::Rect location;
+            ObjectStatus status;
+            ExtObject(int _id, cv::Rect _location, ObjectStatus _status)
+                :id(_id), location(_location), status(_status)
+            {
+            }
+        };
+        virtual void getObjects(std::vector<ExtObject>& result) const;
+
+
+        virtual int addObject(const cv::Rect& location); //returns id of the new object
+
+    protected:
+        class SeparateDetectionWork;
+        cv::Ptr<SeparateDetectionWork> separateDetectionWork;
+        friend void* workcycleObjectDetectorFunction(void* p);
+
+        struct InnerParameters
+        {
+            int numLastPositionsToTrack;
+            int numStepsToWaitBeforeFirstShow;
+            int numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown;
+            int numStepsToShowWithoutDetecting;
+
+            float coeffTrackingWindowSize;
+            float coeffObjectSizeToTrack;
+            float coeffObjectSpeedUsingInPrediction;
+
+            InnerParameters();
+        };
+        Parameters parameters;
+        InnerParameters innerParameters;
+
+        struct TrackedObject
+        {
+            typedef std::vector<cv::Rect> PositionsVector;
+
+            PositionsVector lastPositions;
+
+            int numDetectedFrames;
+            int numFramesNotDetected;
+            int id;
+
+            TrackedObject(const cv::Rect& rect):numDetectedFrames(1), numFramesNotDetected(0)
+            {
+                lastPositions.push_back(rect);
+                id=getNextId();
+            };
+
+            static int getNextId()
+            {
+                static int _id=0;
+                return _id++;
+            }
+        };
+
+        int numTrackedSteps;
+        std::vector<TrackedObject> trackedObjects;
+
+        std::vector<float> weightsPositionsSmoothing;
+        std::vector<float> weightsSizesSmoothing;
+
+        cv::Ptr<IDetector> cascadeForTracking;
+
+        void updateTrackedObjects(const std::vector<cv::Rect>& detectedObjects);
+        cv::Rect calcTrackedObjectPositionToShow(int i) const;
+        cv::Rect calcTrackedObjectPositionToShow(int i, ObjectStatus& status) const;
+        void detectInRegion(const cv::Mat& img, const cv::Rect& r, std::vector<cv::Rect>& detectedObjectsInRegions);
+};
+
+//! @} objdetect
+
+} //end of cv namespace
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp
new file mode 100644
index 0000000..3ee284f
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/objdetect.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h
new file mode 100644
index 0000000..632a438
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h
@@ -0,0 +1,165 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_OBJDETECT_C_H__
+#define __OPENCV_OBJDETECT_C_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+#include <deque>
+#include <vector>
+
+extern "C" {
+#endif
+
+/** @addtogroup objdetect_c
+  @{
+  */
+
+/****************************************************************************************\
+*                         Haar-like Object Detection functions                           *
+\****************************************************************************************/
+
+#define CV_HAAR_MAGIC_VAL    0x42500000
+#define CV_TYPE_NAME_HAAR    "opencv-haar-classifier"
+
+#define CV_IS_HAAR_CLASSIFIER( haar )                                                    \
+    ((haar) != NULL &&                                                                   \
+    (((const CvHaarClassifierCascade*)(haar))->flags & CV_MAGIC_MASK)==CV_HAAR_MAGIC_VAL)
+
+#define CV_HAAR_FEATURE_MAX  3
+
+typedef struct CvHaarFeature
+{
+    int tilted;
+    struct
+    {
+        CvRect r;
+        float weight;
+    } rect[CV_HAAR_FEATURE_MAX];
+} CvHaarFeature;
+
+typedef struct CvHaarClassifier
+{
+    int count;
+    CvHaarFeature* haar_feature;
+    float* threshold;
+    int* left;
+    int* right;
+    float* alpha;
+} CvHaarClassifier;
+
+typedef struct CvHaarStageClassifier
+{
+    int  count;
+    float threshold;
+    CvHaarClassifier* classifier;
+
+    int next;
+    int child;
+    int parent;
+} CvHaarStageClassifier;
+
+typedef struct CvHidHaarClassifierCascade CvHidHaarClassifierCascade;
+
+typedef struct CvHaarClassifierCascade
+{
+    int  flags;
+    int  count;
+    CvSize orig_window_size;
+    CvSize real_window_size;
+    double scale;
+    CvHaarStageClassifier* stage_classifier;
+    CvHidHaarClassifierCascade* hid_cascade;
+} CvHaarClassifierCascade;
+
+typedef struct CvAvgComp
+{
+    CvRect rect;
+    int neighbors;
+} CvAvgComp;
+
+/* Loads haar classifier cascade from a directory.
+   It is obsolete: convert your cascade to xml and use cvLoad instead */
+CVAPI(CvHaarClassifierCascade*) cvLoadHaarClassifierCascade(
+                    const char* directory, CvSize orig_window_size);
+
+CVAPI(void) cvReleaseHaarClassifierCascade( CvHaarClassifierCascade** cascade );
+
+#define CV_HAAR_DO_CANNY_PRUNING    1
+#define CV_HAAR_SCALE_IMAGE         2
+#define CV_HAAR_FIND_BIGGEST_OBJECT 4
+#define CV_HAAR_DO_ROUGH_SEARCH     8
+
+CVAPI(CvSeq*) cvHaarDetectObjects( const CvArr* image,
+                     CvHaarClassifierCascade* cascade, CvMemStorage* storage,
+                     double scale_factor CV_DEFAULT(1.1),
+                     int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0),
+                     CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0)));
+
+/* sets images for haar classifier cascade */
+CVAPI(void) cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade,
+                                                const CvArr* sum, const CvArr* sqsum,
+                                                const CvArr* tilted_sum, double scale );
+
+/* runs the cascade on the specified window */
+CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade,
+                                       CvPoint pt, int start_stage CV_DEFAULT(0));
+
+/** @} objdetect_c */
+
+#ifdef __cplusplus
+}
+
+CV_EXPORTS CvSeq* cvHaarDetectObjectsForROC( const CvArr* image,
+                     CvHaarClassifierCascade* cascade, CvMemStorage* storage,
+                     std::vector<int>& rejectLevels, std::vector<double>& levelWeightds,
+                     double scale_factor = 1.1,
+                     int min_neighbors = 3, int flags = 0,
+                     CvSize min_size = cvSize(0, 0), CvSize max_size = cvSize(0, 0),
+                     bool outputRejectLevels = false );
+
+#endif
+
+#endif /* __OPENCV_OBJDETECT_C_H__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv.hpp
new file mode 100644
index 0000000..fd9ca58
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv.hpp
@@ -0,0 +1,58 @@
+/*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-2010, 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*/
+
+#ifndef __OPENCV_ALL_HPP__
+#define __OPENCV_ALL_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/photo.hpp"
+#include "opencv2/video.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/objdetect.hpp"
+#include "opencv2/calib3d.hpp"
+#include "opencv2/imgcodecs.hpp"
+#include "opencv2/videoio.hpp"
+#include "opencv2/highgui.hpp"
+#include "opencv2/ml.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp
new file mode 100644
index 0000000..42dd908
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp
@@ -0,0 +1,27 @@
+/*
+ *      ** File generated automatically, do not modify **
+ *
+ * This file defines the list of modules available in current build configuration
+ *
+ *
+*/
+
+#define HAVE_OPENCV_CALIB3D
+#define HAVE_OPENCV_CORE
+#define HAVE_OPENCV_FEATURES2D
+#define HAVE_OPENCV_FLANN
+#define HAVE_OPENCV_HIGHGUI
+#define HAVE_OPENCV_IMGCODECS
+#define HAVE_OPENCV_IMGPROC
+#define HAVE_OPENCV_ML
+#define HAVE_OPENCV_OBJDETECT
+#define HAVE_OPENCV_PHOTO
+#define HAVE_OPENCV_SHAPE
+#define HAVE_OPENCV_STITCHING
+#define HAVE_OPENCV_SUPERRES
+#define HAVE_OPENCV_VIDEO
+#define HAVE_OPENCV_VIDEOIO
+#define HAVE_OPENCV_VIDEOSTAB
+#define HAVE_OPENCV_WORLD
+
+
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo.hpp
new file mode 100644
index 0000000..c093f65
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo.hpp
@@ -0,0 +1,870 @@
+/*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) 2008-2012, 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*/
+
+#ifndef __OPENCV_PHOTO_HPP__
+#define __OPENCV_PHOTO_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+
+/**
+@defgroup photo Computational Photography
+@{
+    @defgroup photo_denoise Denoising
+    @defgroup photo_hdr HDR imaging
+
+This section describes high dynamic range imaging algorithms namely tonemapping, exposure alignment,
+camera calibration with multiple exposures and exposure fusion.
+
+    @defgroup photo_clone Seamless Cloning
+    @defgroup photo_render Non-Photorealistic Rendering
+    @defgroup photo_c C API
+@}
+  */
+
+namespace cv
+{
+
+//! @addtogroup photo
+//! @{
+
+//! the inpainting algorithm
+enum
+{
+    INPAINT_NS    = 0, // Navier-Stokes algorithm
+    INPAINT_TELEA = 1 // A. Telea algorithm
+};
+
+enum
+{
+    NORMAL_CLONE = 1,
+    MIXED_CLONE  = 2,
+    MONOCHROME_TRANSFER = 3
+};
+
+enum
+{
+    RECURS_FILTER = 1,
+    NORMCONV_FILTER = 2
+};
+
+/** @brief Restores the selected region in an image using the region neighborhood.
+
+@param src Input 8-bit 1-channel or 3-channel image.
+@param inpaintMask Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that
+needs to be inpainted.
+@param dst Output image with the same size and type as src .
+@param inpaintRadius Radius of a circular neighborhood of each point inpainted that is considered
+by the algorithm.
+@param flags Inpainting method that could be one of the following:
+-   **INPAINT_NS** Navier-Stokes based method [Navier01]
+-   **INPAINT_TELEA** Method by Alexandru Telea @cite Telea04 .
+
+The function reconstructs the selected image area from the pixel near the area boundary. The
+function may be used to remove dust and scratches from a scanned photo, or to remove undesirable
+objects from still images or video. See <http://en.wikipedia.org/wiki/Inpainting> for more details.
+
+@note
+   -   An example using the inpainting technique can be found at
+        opencv_source_code/samples/cpp/inpaint.cpp
+    -   (Python) An example using the inpainting technique can be found at
+        opencv_source_code/samples/python/inpaint.py
+ */
+CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask,
+        OutputArray dst, double inpaintRadius, int flags );
+
+//! @addtogroup photo_denoise
+//! @{
+
+/** @brief Perform image denoising using Non-local Means Denoising algorithm
+<http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/> with several computational
+optimizations. Noise expected to be a gaussian white noise
+
+@param src Input 8-bit 1-channel, 2-channel, 3-channel or 4-channel image.
+@param dst Output image with the same size and type as src .
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Parameter regulating filter strength. Big h value perfectly removes noise but also
+removes image details, smaller h value preserves details but also preserves some noise
+
+This function expected to be applied to grayscale images. For colored images look at
+fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored
+image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting
+image to CIELAB colorspace and then separately denoise L and AB components with different h
+parameter.
+ */
+CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, float h = 3,
+        int templateWindowSize = 7, int searchWindowSize = 21);
+
+/** @brief Perform image denoising using Non-local Means Denoising algorithm
+<http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/> with several computational
+optimizations. Noise expected to be a gaussian white noise
+
+@param src Input 8-bit or 16-bit (only with NORM_L1) 1-channel,
+2-channel, 3-channel or 4-channel image.
+@param dst Output image with the same size and type as src .
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Array of parameters regulating filter strength, either one
+parameter applied to all channels or one per channel in dst. Big h value
+perfectly removes noise but also removes image details, smaller h
+value preserves details but also preserves some noise
+@param normType Type of norm used for weight calculation. Can be either NORM_L2 or NORM_L1
+
+This function expected to be applied to grayscale images. For colored images look at
+fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored
+image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting
+image to CIELAB colorspace and then separately denoise L and AB components with different h
+parameter.
+ */
+CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst,
+                                        const std::vector<float>& h,
+                                        int templateWindowSize = 7, int searchWindowSize = 21,
+                                        int normType = NORM_L2);
+
+/** @brief Modification of fastNlMeansDenoising function for colored images
+
+@param src Input 8-bit 3-channel image.
+@param dst Output image with the same size and type as src .
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Parameter regulating filter strength for luminance component. Bigger h value perfectly
+removes noise but also removes image details, smaller h value preserves details but also preserves
+some noise
+@param hColor The same as h but for color components. For most images value equals 10
+will be enough to remove colored noise and do not distort colors
+
+The function converts image to CIELAB colorspace and then separately denoise L and AB components
+with given h parameters using fastNlMeansDenoising function.
+ */
+CV_EXPORTS_W void fastNlMeansDenoisingColored( InputArray src, OutputArray dst,
+        float h = 3, float hColor = 3,
+        int templateWindowSize = 7, int searchWindowSize = 21);
+
+/** @brief Modification of fastNlMeansDenoising function for images sequence where consequtive images have been
+captured in small period of time. For example video. This version of the function is for grayscale
+images or for manual manipulation with colorspaces. For more details see
+<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394>
+
+@param srcImgs Input 8-bit 1-channel, 2-channel, 3-channel or
+4-channel images sequence. All images should have the same type and
+size.
+@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence
+@param temporalWindowSize Number of surrounding images to use for target image denoising. Should
+be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
+imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
+srcImgs[imgToDenoiseIndex] image.
+@param dst Output image with the same size and type as srcImgs images.
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Parameter regulating filter strength. Bigger h value
+perfectly removes noise but also removes image details, smaller h
+value preserves details but also preserves some noise
+ */
+CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst,
+        int imgToDenoiseIndex, int temporalWindowSize,
+        float h = 3, int templateWindowSize = 7, int searchWindowSize = 21);
+
+/** @brief Modification of fastNlMeansDenoising function for images sequence where consequtive images have been
+captured in small period of time. For example video. This version of the function is for grayscale
+images or for manual manipulation with colorspaces. For more details see
+<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394>
+
+@param srcImgs Input 8-bit or 16-bit (only with NORM_L1) 1-channel,
+2-channel, 3-channel or 4-channel images sequence. All images should
+have the same type and size.
+@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence
+@param temporalWindowSize Number of surrounding images to use for target image denoising. Should
+be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
+imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
+srcImgs[imgToDenoiseIndex] image.
+@param dst Output image with the same size and type as srcImgs images.
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Array of parameters regulating filter strength, either one
+parameter applied to all channels or one per channel in dst. Big h value
+perfectly removes noise but also removes image details, smaller h
+value preserves details but also preserves some noise
+@param normType Type of norm used for weight calculation. Can be either NORM_L2 or NORM_L1
+ */
+CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst,
+                                             int imgToDenoiseIndex, int temporalWindowSize,
+                                             const std::vector<float>& h,
+                                             int templateWindowSize = 7, int searchWindowSize = 21,
+                                             int normType = NORM_L2);
+
+/** @brief Modification of fastNlMeansDenoisingMulti function for colored images sequences
+
+@param srcImgs Input 8-bit 3-channel images sequence. All images should have the same type and
+size.
+@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence
+@param temporalWindowSize Number of surrounding images to use for target image denoising. Should
+be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
+imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
+srcImgs[imgToDenoiseIndex] image.
+@param dst Output image with the same size and type as srcImgs images.
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Parameter regulating filter strength for luminance component. Bigger h value perfectly
+removes noise but also removes image details, smaller h value preserves details but also preserves
+some noise.
+@param hColor The same as h but for color components.
+
+The function converts images to CIELAB colorspace and then separately denoise L and AB components
+with given h parameters using fastNlMeansDenoisingMulti function.
+ */
+CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst,
+        int imgToDenoiseIndex, int temporalWindowSize,
+        float h = 3, float hColor = 3,
+        int templateWindowSize = 7, int searchWindowSize = 21);
+
+/** @brief Primal-dual algorithm is an algorithm for solving special types of variational problems (that is,
+finding a function to minimize some functional). As the image denoising, in particular, may be seen
+as the variational problem, primal-dual algorithm then can be used to perform denoising and this is
+exactly what is implemented.
+
+It should be noted, that this implementation was taken from the July 2013 blog entry
+@cite MA13 , which also contained (slightly more general) ready-to-use source code on Python.
+Subsequently, that code was rewritten on C++ with the usage of openCV by Vadim Pisarevsky at the end
+of July 2013 and finally it was slightly adapted by later authors.
+
+Although the thorough discussion and justification of the algorithm involved may be found in
+@cite ChambolleEtAl, it might make sense to skim over it here, following @cite MA13 . To begin
+with, we consider the 1-byte gray-level images as the functions from the rectangular domain of
+pixels (it may be seen as set
+\f$\left\{(x,y)\in\mathbb{N}\times\mathbb{N}\mid 1\leq x\leq n,\;1\leq y\leq m\right\}\f$ for some
+\f$m,\;n\in\mathbb{N}\f$) into \f$\{0,1,\dots,255\}\f$. We shall denote the noised images as \f$f_i\f$ and with
+this view, given some image \f$x\f$ of the same size, we may measure how bad it is by the formula
+
+\f[\left\|\left\|\nabla x\right\|\right\| + \lambda\sum_i\left\|\left\|x-f_i\right\|\right\|\f]
+
+\f$\|\|\cdot\|\|\f$ here denotes \f$L_2\f$-norm and as you see, the first addend states that we want our
+image to be smooth (ideally, having zero gradient, thus being constant) and the second states that
+we want our result to be close to the observations we've got. If we treat \f$x\f$ as a function, this is
+exactly the functional what we seek to minimize and here the Primal-Dual algorithm comes into play.
+
+@param observations This array should contain one or more noised versions of the image that is to
+be restored.
+@param result Here the denoised image will be stored. There is no need to do pre-allocation of
+storage space, as it will be automatically allocated, if necessary.
+@param lambda Corresponds to \f$\lambda\f$ in the formulas above. As it is enlarged, the smooth
+(blurred) images are treated more favorably than detailed (but maybe more noised) ones. Roughly
+speaking, as it becomes smaller, the result will be more blur but more sever outliers will be
+removed.
+@param niters Number of iterations that the algorithm will run. Of course, as more iterations as
+better, but it is hard to quantitatively refine this statement, so just use the default and
+increase it if the results are poor.
+ */
+CV_EXPORTS_W void denoise_TVL1(const std::vector<Mat>& observations,Mat& result, double lambda=1.0, int niters=30);
+
+//! @} photo_denoise
+
+//! @addtogroup photo_hdr
+//! @{
+
+enum { LDR_SIZE = 256 };
+
+/** @brief Base class for tonemapping algorithms - tools that are used to map HDR image to 8-bit range.
+ */
+class CV_EXPORTS_W Tonemap : public Algorithm
+{
+public:
+    /** @brief Tonemaps image
+
+    @param src source image - 32-bit 3-channel Mat
+    @param dst destination image - 32-bit 3-channel Mat with values in [0, 1] range
+     */
+    CV_WRAP virtual void process(InputArray src, OutputArray dst) = 0;
+
+    CV_WRAP virtual float getGamma() const = 0;
+    CV_WRAP virtual void setGamma(float gamma) = 0;
+};
+
+/** @brief Creates simple linear mapper with gamma correction
+
+@param gamma positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma
+equal to 2.2f is suitable for most displays.
+Generally gamma \> 1 brightens the image and gamma \< 1 darkens it.
+ */
+CV_EXPORTS_W Ptr<Tonemap> createTonemap(float gamma = 1.0f);
+
+/** @brief Adaptive logarithmic mapping is a fast global tonemapping algorithm that scales the image in
+logarithmic domain.
+
+Since it's a global operator the same function is applied to all the pixels, it is controlled by the
+bias parameter.
+
+Optional saturation enhancement is possible as described in @cite FL02 .
+
+For more information see @cite DM03 .
+ */
+class CV_EXPORTS_W TonemapDrago : public Tonemap
+{
+public:
+
+    CV_WRAP virtual float getSaturation() const = 0;
+    CV_WRAP virtual void setSaturation(float saturation) = 0;
+
+    CV_WRAP virtual float getBias() const = 0;
+    CV_WRAP virtual void setBias(float bias) = 0;
+};
+
+/** @brief Creates TonemapDrago object
+
+@param gamma gamma value for gamma correction. See createTonemap
+@param saturation positive saturation enhancement value. 1.0 preserves saturation, values greater
+than 1 increase saturation and values less than 1 decrease it.
+@param bias value for bias function in [0, 1] range. Values from 0.7 to 0.9 usually give best
+results, default value is 0.85.
+ */
+CV_EXPORTS_W Ptr<TonemapDrago> createTonemapDrago(float gamma = 1.0f, float saturation = 1.0f, float bias = 0.85f);
+
+/** @brief This algorithm decomposes image into two layers: base layer and detail layer using bilateral filter
+and compresses contrast of the base layer thus preserving all the details.
+
+This implementation uses regular bilateral filter from opencv.
+
+Saturation enhancement is possible as in ocvTonemapDrago.
+
+For more information see @cite DD02 .
+ */
+class CV_EXPORTS_W TonemapDurand : public Tonemap
+{
+public:
+
+    CV_WRAP virtual float getSaturation() const = 0;
+    CV_WRAP virtual void setSaturation(float saturation) = 0;
+
+    CV_WRAP virtual float getContrast() const = 0;
+    CV_WRAP virtual void setContrast(float contrast) = 0;
+
+    CV_WRAP virtual float getSigmaSpace() const = 0;
+    CV_WRAP virtual void setSigmaSpace(float sigma_space) = 0;
+
+    CV_WRAP virtual float getSigmaColor() const = 0;
+    CV_WRAP virtual void setSigmaColor(float sigma_color) = 0;
+};
+
+/** @brief Creates TonemapDurand object
+
+@param gamma gamma value for gamma correction. See createTonemap
+@param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
+are maximum and minimum luminance values of the resulting image.
+@param saturation saturation enhancement value. See createTonemapDrago
+@param sigma_space bilateral filter sigma in color space
+@param sigma_color bilateral filter sigma in coordinate space
+ */
+CV_EXPORTS_W Ptr<TonemapDurand>
+createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_space = 2.0f, float sigma_color = 2.0f);
+
+/** @brief This is a global tonemapping operator that models human visual system.
+
+Mapping function is controlled by adaptation parameter, that is computed using light adaptation and
+color adaptation.
+
+For more information see @cite RD05 .
+ */
+class CV_EXPORTS_W TonemapReinhard : public Tonemap
+{
+public:
+    CV_WRAP virtual float getIntensity() const = 0;
+    CV_WRAP virtual void setIntensity(float intensity) = 0;
+
+    CV_WRAP virtual float getLightAdaptation() const = 0;
+    CV_WRAP virtual void setLightAdaptation(float light_adapt) = 0;
+
+    CV_WRAP virtual float getColorAdaptation() const = 0;
+    CV_WRAP virtual void setColorAdaptation(float color_adapt) = 0;
+};
+
+/** @brief Creates TonemapReinhard object
+
+@param gamma gamma value for gamma correction. See createTonemap
+@param intensity result intensity in [-8, 8] range. Greater intensity produces brighter results.
+@param light_adapt light adaptation in [0, 1] range. If 1 adaptation is based only on pixel
+value, if 0 it's global, otherwise it's a weighted mean of this two cases.
+@param color_adapt chromatic adaptation in [0, 1] range. If 1 channels are treated independently,
+if 0 adaptation level is the same for each channel.
+ */
+CV_EXPORTS_W Ptr<TonemapReinhard>
+createTonemapReinhard(float gamma = 1.0f, float intensity = 0.0f, float light_adapt = 1.0f, float color_adapt = 0.0f);
+
+/** @brief This algorithm transforms image to contrast using gradients on all levels of gaussian pyramid,
+transforms contrast values to HVS response and scales the response. After this the image is
+reconstructed from new contrast values.
+
+For more information see @cite MM06 .
+ */
+class CV_EXPORTS_W TonemapMantiuk : public Tonemap
+{
+public:
+    CV_WRAP virtual float getScale() const = 0;
+    CV_WRAP virtual void setScale(float scale) = 0;
+
+    CV_WRAP virtual float getSaturation() const = 0;
+    CV_WRAP virtual void setSaturation(float saturation) = 0;
+};
+
+/** @brief Creates TonemapMantiuk object
+
+@param gamma gamma value for gamma correction. See createTonemap
+@param scale contrast scale factor. HVS response is multiplied by this parameter, thus compressing
+dynamic range. Values from 0.6 to 0.9 produce best results.
+@param saturation saturation enhancement value. See createTonemapDrago
+ */
+CV_EXPORTS_W Ptr<TonemapMantiuk>
+createTonemapMantiuk(float gamma = 1.0f, float scale = 0.7f, float saturation = 1.0f);
+
+/** @brief The base class for algorithms that align images of the same scene with different exposures
+ */
+class CV_EXPORTS_W AlignExposures : public Algorithm
+{
+public:
+    /** @brief Aligns images
+
+    @param src vector of input images
+    @param dst vector of aligned images
+    @param times vector of exposure time values for each image
+    @param response 256x1 matrix with inverse camera response function for each pixel value, it should
+    have the same number of channels as images.
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst,
+                                 InputArray times, InputArray response) = 0;
+};
+
+/** @brief This algorithm converts images to median threshold bitmaps (1 for pixels brighter than median
+luminance and 0 otherwise) and than aligns the resulting bitmaps using bit operations.
+
+It is invariant to exposure, so exposure values and camera response are not necessary.
+
+In this implementation new image regions are filled with zeros.
+
+For more information see @cite GW03 .
+ */
+class CV_EXPORTS_W AlignMTB : public AlignExposures
+{
+public:
+    CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst,
+                                 InputArray times, InputArray response) = 0;
+
+    /** @brief Short version of process, that doesn't take extra arguments.
+
+    @param src vector of input images
+    @param dst vector of aligned images
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst) = 0;
+
+    /** @brief Calculates shift between two images, i. e. how to shift the second image to correspond it with the
+    first.
+
+    @param img0 first image
+    @param img1 second image
+     */
+    CV_WRAP virtual Point calculateShift(InputArray img0, InputArray img1) = 0;
+    /** @brief Helper function, that shift Mat filling new regions with zeros.
+
+    @param src input image
+    @param dst result image
+    @param shift shift value
+     */
+    CV_WRAP virtual void shiftMat(InputArray src, OutputArray dst, const Point shift) = 0;
+    /** @brief Computes median threshold and exclude bitmaps of given image.
+
+    @param img input image
+    @param tb median threshold bitmap
+    @param eb exclude bitmap
+     */
+    CV_WRAP virtual void computeBitmaps(InputArray img, OutputArray tb, OutputArray eb) = 0;
+
+    CV_WRAP virtual int getMaxBits() const = 0;
+    CV_WRAP virtual void setMaxBits(int max_bits) = 0;
+
+    CV_WRAP virtual int getExcludeRange() const = 0;
+    CV_WRAP virtual void setExcludeRange(int exclude_range) = 0;
+
+    CV_WRAP virtual bool getCut() const = 0;
+    CV_WRAP virtual void setCut(bool value) = 0;
+};
+
+/** @brief Creates AlignMTB object
+
+@param max_bits logarithm to the base 2 of maximal shift in each dimension. Values of 5 and 6 are
+usually good enough (31 and 63 pixels shift respectively).
+@param exclude_range range for exclusion bitmap that is constructed to suppress noise around the
+median value.
+@param cut if true cuts images, otherwise fills the new regions with zeros.
+ */
+CV_EXPORTS_W Ptr<AlignMTB> createAlignMTB(int max_bits = 6, int exclude_range = 4, bool cut = true);
+
+/** @brief The base class for camera response calibration algorithms.
+ */
+class CV_EXPORTS_W CalibrateCRF : public Algorithm
+{
+public:
+    /** @brief Recovers inverse camera response.
+
+    @param src vector of input images
+    @param dst 256x1 matrix with inverse camera response function
+    @param times vector of exposure time values for each image
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0;
+};
+
+/** @brief Inverse camera response function is extracted for each brightness value by minimizing an objective
+function as linear system. Objective function is constructed using pixel values on the same position
+in all images, extra term is added to make the result smoother.
+
+For more information see @cite DM97 .
+ */
+class CV_EXPORTS_W CalibrateDebevec : public CalibrateCRF
+{
+public:
+    CV_WRAP virtual float getLambda() const = 0;
+    CV_WRAP virtual void setLambda(float lambda) = 0;
+
+    CV_WRAP virtual int getSamples() const = 0;
+    CV_WRAP virtual void setSamples(int samples) = 0;
+
+    CV_WRAP virtual bool getRandom() const = 0;
+    CV_WRAP virtual void setRandom(bool random) = 0;
+};
+
+/** @brief Creates CalibrateDebevec object
+
+@param samples number of pixel locations to use
+@param lambda smoothness term weight. Greater values produce smoother results, but can alter the
+response.
+@param random if true sample pixel locations are chosen at random, otherwise the form a
+rectangular grid.
+ */
+CV_EXPORTS_W Ptr<CalibrateDebevec> createCalibrateDebevec(int samples = 70, float lambda = 10.0f, bool random = false);
+
+/** @brief Inverse camera response function is extracted for each brightness value by minimizing an objective
+function as linear system. This algorithm uses all image pixels.
+
+For more information see @cite RB99 .
+ */
+class CV_EXPORTS_W CalibrateRobertson : public CalibrateCRF
+{
+public:
+    CV_WRAP virtual int getMaxIter() const = 0;
+    CV_WRAP virtual void setMaxIter(int max_iter) = 0;
+
+    CV_WRAP virtual float getThreshold() const = 0;
+    CV_WRAP virtual void setThreshold(float threshold) = 0;
+
+    CV_WRAP virtual Mat getRadiance() const = 0;
+};
+
+/** @brief Creates CalibrateRobertson object
+
+@param max_iter maximal number of Gauss-Seidel solver iterations.
+@param threshold target difference between results of two successive steps of the minimization.
+ */
+CV_EXPORTS_W Ptr<CalibrateRobertson> createCalibrateRobertson(int max_iter = 30, float threshold = 0.01f);
+
+/** @brief The base class algorithms that can merge exposure sequence to a single image.
+ */
+class CV_EXPORTS_W MergeExposures : public Algorithm
+{
+public:
+    /** @brief Merges images.
+
+    @param src vector of input images
+    @param dst result image
+    @param times vector of exposure time values for each image
+    @param response 256x1 matrix with inverse camera response function for each pixel value, it should
+    have the same number of channels as images.
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
+                                 InputArray times, InputArray response) = 0;
+};
+
+/** @brief The resulting HDR image is calculated as weighted average of the exposures considering exposure
+values and camera response.
+
+For more information see @cite DM97 .
+ */
+class CV_EXPORTS_W MergeDebevec : public MergeExposures
+{
+public:
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
+                                 InputArray times, InputArray response) = 0;
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0;
+};
+
+/** @brief Creates MergeDebevec object
+ */
+CV_EXPORTS_W Ptr<MergeDebevec> createMergeDebevec();
+
+/** @brief Pixels are weighted using contrast, saturation and well-exposedness measures, than images are
+combined using laplacian pyramids.
+
+The resulting image weight is constructed as weighted average of contrast, saturation and
+well-exposedness measures.
+
+The resulting image doesn't require tonemapping and can be converted to 8-bit image by multiplying
+by 255, but it's recommended to apply gamma correction and/or linear tonemapping.
+
+For more information see @cite MK07 .
+ */
+class CV_EXPORTS_W MergeMertens : public MergeExposures
+{
+public:
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
+                                 InputArray times, InputArray response) = 0;
+    /** @brief Short version of process, that doesn't take extra arguments.
+
+    @param src vector of input images
+    @param dst result image
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst) = 0;
+
+    CV_WRAP virtual float getContrastWeight() const = 0;
+    CV_WRAP virtual void setContrastWeight(float contrast_weiht) = 0;
+
+    CV_WRAP virtual float getSaturationWeight() const = 0;
+    CV_WRAP virtual void setSaturationWeight(float saturation_weight) = 0;
+
+    CV_WRAP virtual float getExposureWeight() const = 0;
+    CV_WRAP virtual void setExposureWeight(float exposure_weight) = 0;
+};
+
+/** @brief Creates MergeMertens object
+
+@param contrast_weight contrast measure weight. See MergeMertens.
+@param saturation_weight saturation measure weight
+@param exposure_weight well-exposedness measure weight
+ */
+CV_EXPORTS_W Ptr<MergeMertens>
+createMergeMertens(float contrast_weight = 1.0f, float saturation_weight = 1.0f, float exposure_weight = 0.0f);
+
+/** @brief The resulting HDR image is calculated as weighted average of the exposures considering exposure
+values and camera response.
+
+For more information see @cite RB99 .
+ */
+class CV_EXPORTS_W MergeRobertson : public MergeExposures
+{
+public:
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
+                                 InputArray times, InputArray response) = 0;
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0;
+};
+
+/** @brief Creates MergeRobertson object
+ */
+CV_EXPORTS_W Ptr<MergeRobertson> createMergeRobertson();
+
+//! @} photo_hdr
+
+/** @brief Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized
+black-and-white photograph rendering, and in many single channel image processing applications
+@cite CL12 .
+
+@param src Input 8-bit 3-channel image.
+@param grayscale Output 8-bit 1-channel image.
+@param color_boost Output 8-bit 3-channel image.
+
+This function is to be applied on color images.
+ */
+CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray color_boost);
+
+//! @addtogroup photo_clone
+//! @{
+
+/** @brief Image editing tasks concern either global changes (color/intensity corrections, filters,
+deformations) or local changes concerned to a selection. Here we are interested in achieving local
+changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless
+manner. The extent of the changes ranges from slight distortions to complete replacement by novel
+content @cite PM03 .
+
+@param src Input 8-bit 3-channel image.
+@param dst Input 8-bit 3-channel image.
+@param mask Input 8-bit 1 or 3-channel image.
+@param p Point in dst image where object is placed.
+@param blend Output image with the same size and type as dst.
+@param flags Cloning method that could be one of the following:
+-   **NORMAL_CLONE** The power of the method is fully expressed when inserting objects with
+complex outlines into a new background
+-   **MIXED_CLONE** The classic method, color-based selection and alpha masking might be time
+consuming and often leaves an undesirable halo. Seamless cloning, even averaged with the
+original image, is not effective. Mixed seamless cloning based on a loose selection proves
+effective.
+-   **FEATURE_EXCHANGE** Feature exchange allows the user to easily replace certain features of
+one object by alternative features.
+ */
+CV_EXPORTS_W void seamlessClone( InputArray src, InputArray dst, InputArray mask, Point p,
+        OutputArray blend, int flags);
+
+/** @brief Given an original color image, two differently colored versions of this image can be mixed
+seamlessly.
+
+@param src Input 8-bit 3-channel image.
+@param mask Input 8-bit 1 or 3-channel image.
+@param dst Output image with the same size and type as src .
+@param red_mul R-channel multiply factor.
+@param green_mul G-channel multiply factor.
+@param blue_mul B-channel multiply factor.
+
+Multiplication factor is between .5 to 2.5.
+ */
+CV_EXPORTS_W void colorChange(InputArray src, InputArray mask, OutputArray dst, float red_mul = 1.0f,
+        float green_mul = 1.0f, float blue_mul = 1.0f);
+
+/** @brief Applying an appropriate non-linear transformation to the gradient field inside the selection and
+then integrating back with a Poisson solver, modifies locally the apparent illumination of an image.
+
+@param src Input 8-bit 3-channel image.
+@param mask Input 8-bit 1 or 3-channel image.
+@param dst Output image with the same size and type as src.
+@param alpha Value ranges between 0-2.
+@param beta Value ranges between 0-2.
+
+This is useful to highlight under-exposed foreground objects or to reduce specular reflections.
+ */
+CV_EXPORTS_W void illuminationChange(InputArray src, InputArray mask, OutputArray dst,
+        float alpha = 0.2f, float beta = 0.4f);
+
+/** @brief By retaining only the gradients at edge locations, before integrating with the Poisson solver, one
+washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge
+Detector is used.
+
+@param src Input 8-bit 3-channel image.
+@param mask Input 8-bit 1 or 3-channel image.
+@param dst Output image with the same size and type as src.
+@param low_threshold Range from 0 to 100.
+@param high_threshold Value \> 100.
+@param kernel_size The size of the Sobel kernel to be used.
+
+**NOTE:**
+
+The algorithm assumes that the color of the source image is close to that of the destination. This
+assumption means that when the colors don't match, the source image color gets tinted toward the
+color of the destination image.
+ */
+CV_EXPORTS_W void textureFlattening(InputArray src, InputArray mask, OutputArray dst,
+        float low_threshold = 30, float high_threshold = 45,
+        int kernel_size = 3);
+
+//! @} photo_clone
+
+//! @addtogroup photo_render
+//! @{
+
+/** @brief Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing
+filters are used in many different applications @cite EM11 .
+
+@param src Input 8-bit 3-channel image.
+@param dst Output 8-bit 3-channel image.
+@param flags Edge preserving filters:
+-   **RECURS_FILTER** = 1
+-   **NORMCONV_FILTER** = 2
+@param sigma_s Range between 0 to 200.
+@param sigma_r Range between 0 to 1.
+ */
+CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flags = 1,
+        float sigma_s = 60, float sigma_r = 0.4f);
+
+/** @brief This filter enhances the details of a particular image.
+
+@param src Input 8-bit 3-channel image.
+@param dst Output image with the same size and type as src.
+@param sigma_s Range between 0 to 200.
+@param sigma_r Range between 0 to 1.
+ */
+CV_EXPORTS_W void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10,
+        float sigma_r = 0.15f);
+
+/** @brief Pencil-like non-photorealistic line drawing
+
+@param src Input 8-bit 3-channel image.
+@param dst1 Output 8-bit 1-channel image.
+@param dst2 Output image with the same size and type as src.
+@param sigma_s Range between 0 to 200.
+@param sigma_r Range between 0 to 1.
+@param shade_factor Range between 0 to 0.1.
+ */
+CV_EXPORTS_W void pencilSketch(InputArray src, OutputArray dst1, OutputArray dst2,
+        float sigma_s = 60, float sigma_r = 0.07f, float shade_factor = 0.02f);
+
+/** @brief Stylization aims to produce digital imagery with a wide variety of effects not focused on
+photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low
+contrast while preserving, or enhancing, high-contrast features.
+
+@param src Input 8-bit 3-channel image.
+@param dst Output image with the same size and type as src.
+@param sigma_s Range between 0 to 200.
+@param sigma_r Range between 0 to 1.
+ */
+CV_EXPORTS_W void stylization(InputArray src, OutputArray dst, float sigma_s = 60,
+        float sigma_r = 0.45f);
+
+//! @} photo_render
+
+//! @} photo
+
+} // cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/photo/photo_c.h"
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp
new file mode 100644
index 0000000..aeac1fa
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp
@@ -0,0 +1,132 @@
+/*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) 2008-2012, 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*/
+
+#ifndef __OPENCV_PHOTO_CUDA_HPP__
+#define __OPENCV_PHOTO_CUDA_HPP__
+
+#include "opencv2/core/cuda.hpp"
+
+namespace cv { namespace cuda {
+
+//! @addtogroup photo_denoise
+//! @{
+
+/** @brief Performs pure non local means denoising without any simplification, and thus it is not fast.
+
+@param src Source image. Supports only CV_8UC1, CV_8UC2 and CV_8UC3.
+@param dst Destination image.
+@param h Filter sigma regulating filter strength for color.
+@param search_window Size of search window.
+@param block_size Size of block used for computing weights.
+@param borderMode Border type. See borderInterpolate for details. BORDER_REFLECT101 ,
+BORDER_REPLICATE , BORDER_CONSTANT , BORDER_REFLECT and BORDER_WRAP are supported for now.
+@param stream Stream for the asynchronous version.
+
+@sa
+   fastNlMeansDenoising
+ */
+CV_EXPORTS void nonLocalMeans(InputArray src, OutputArray dst,
+                              float h,
+                              int search_window = 21,
+                              int block_size = 7,
+                              int borderMode = BORDER_DEFAULT,
+                              Stream& stream = Stream::Null());
+
+/** @brief Perform image denoising using Non-local Means Denoising algorithm
+<http://www.ipol.im/pub/algo/bcm_non_local_means_denoising> with several computational
+optimizations. Noise expected to be a gaussian white noise
+
+@param src Input 8-bit 1-channel, 2-channel or 3-channel image.
+@param dst Output image with the same size and type as src .
+@param h Parameter regulating filter strength. Big h value perfectly removes noise but also
+removes image details, smaller h value preserves details but also preserves some noise
+@param search_window Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater search_window - greater
+denoising time. Recommended value 21 pixels
+@param block_size Size in pixels of the template patch that is used to compute weights. Should be
+odd. Recommended value 7 pixels
+@param stream Stream for the asynchronous invocations.
+
+This function expected to be applied to grayscale images. For colored images look at
+FastNonLocalMeansDenoising::labMethod.
+
+@sa
+   fastNlMeansDenoising
+ */
+CV_EXPORTS void fastNlMeansDenoising(InputArray src, OutputArray dst,
+                                     float h,
+                                     int search_window = 21,
+                                     int block_size = 7,
+                                     Stream& stream = Stream::Null());
+
+/** @brief Modification of fastNlMeansDenoising function for colored images
+
+@param src Input 8-bit 3-channel image.
+@param dst Output image with the same size and type as src .
+@param h_luminance Parameter regulating filter strength. Big h value perfectly removes noise but
+also removes image details, smaller h value preserves details but also preserves some noise
+@param photo_render float The same as h but for color components. For most images value equals 10 will be
+enough to remove colored noise and do not distort colors
+@param search_window Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater search_window - greater
+denoising time. Recommended value 21 pixels
+@param block_size Size in pixels of the template patch that is used to compute weights. Should be
+odd. Recommended value 7 pixels
+@param stream Stream for the asynchronous invocations.
+
+The function converts image to CIELAB colorspace and then separately denoise L and AB components
+with given h parameters using FastNonLocalMeansDenoising::simpleMethod function.
+
+@sa
+   fastNlMeansDenoisingColored
+ */
+CV_EXPORTS void fastNlMeansDenoisingColored(InputArray src, OutputArray dst,
+                                            float h_luminance, float photo_render,
+                                            int search_window = 21,
+                                            int block_size = 7,
+                                            Stream& stream = Stream::Null());
+
+//! @} photo
+
+}} // namespace cv { namespace cuda {
+
+#endif /* __OPENCV_PHOTO_CUDA_HPP__ */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp
new file mode 100644
index 0000000..8af5e9f
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/photo.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h
new file mode 100644
index 0000000..07ca9b3
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h
@@ -0,0 +1,74 @@
+/*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) 2008-2012, 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*/
+
+#ifndef __OPENCV_PHOTO_C_H__
+#define __OPENCV_PHOTO_C_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup photo_c
+  @{
+  */
+
+/* Inpainting algorithms */
+enum InpaintingModes
+{
+    CV_INPAINT_NS      =0,
+    CV_INPAINT_TELEA   =1
+};
+
+
+/* Inpaints the selected region in the image */
+CVAPI(void) cvInpaint( const CvArr* src, const CvArr* inpaint_mask,
+                       CvArr* dst, double inpaintRange, int flags );
+
+/** @} */
+
+#ifdef __cplusplus
+} //extern "C"
+#endif
+
+#endif //__OPENCV_PHOTO_C_H__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape.hpp
new file mode 100644
index 0000000..6999476
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape.hpp
@@ -0,0 +1,57 @@
+/*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-2012, 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*/
+
+#ifndef __OPENCV_SHAPE_HPP__
+#define __OPENCV_SHAPE_HPP__
+
+#include "opencv2/shape/emdL1.hpp"
+#include "opencv2/shape/shape_transformer.hpp"
+#include "opencv2/shape/hist_cost.hpp"
+#include "opencv2/shape/shape_distance.hpp"
+
+/**
+  @defgroup shape Shape Distance and Matching
+ */
+
+#endif
+
+/* End of file. */
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp
new file mode 100644
index 0000000..1dfa758
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp
@@ -0,0 +1,72 @@
+/*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-2012, 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*/
+
+#ifndef __OPENCV_EMD_L1_HPP__
+#define __OPENCV_EMD_L1_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+/****************************************************************************************\
+*                                   EMDL1 Function                                      *
+\****************************************************************************************/
+
+//! @addtogroup shape
+//! @{
+
+/** @brief Computes the "minimal work" distance between two weighted point configurations base on the papers
+"EMD-L1: An efficient and Robust Algorithm for comparing histogram-based descriptors", by Haibin
+Ling and Kazunori Okuda; and "The Earth Mover's Distance is the Mallows Distance: Some Insights from
+Statistics", by Elizaveta Levina and Peter Bickel.
+
+@param signature1 First signature, a single column floating-point matrix. Each row is the value of
+the histogram in each bin.
+@param signature2 Second signature of the same format and size as signature1.
+ */
+CV_EXPORTS float EMDL1(InputArray signature1, InputArray signature2);
+
+//! @}
+
+}//namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp
new file mode 100644
index 0000000..15c0a87
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp
@@ -0,0 +1,111 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_HIST_COST_HPP__
+#define __OPENCV_HIST_COST_HPP__
+
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+
+//! @addtogroup shape
+//! @{
+
+/** @brief Abstract base class for histogram cost algorithms.
+ */
+class CV_EXPORTS_W HistogramCostExtractor : public Algorithm
+{
+public:
+    CV_WRAP virtual void buildCostMatrix(InputArray descriptors1, InputArray descriptors2, OutputArray costMatrix) = 0;
+
+    CV_WRAP virtual void setNDummies(int nDummies) = 0;
+    CV_WRAP virtual int getNDummies() const = 0;
+
+    CV_WRAP virtual void setDefaultCost(float defaultCost) = 0;
+    CV_WRAP virtual float getDefaultCost() const = 0;
+};
+
+/** @brief A norm based cost extraction. :
+ */
+class CV_EXPORTS_W NormHistogramCostExtractor : public HistogramCostExtractor
+{
+public:
+    CV_WRAP virtual void setNormFlag(int flag) = 0;
+    CV_WRAP virtual int getNormFlag() const = 0;
+};
+
+CV_EXPORTS_W Ptr<HistogramCostExtractor>
+    createNormHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f);
+
+/** @brief An EMD based cost extraction. :
+ */
+class CV_EXPORTS_W EMDHistogramCostExtractor : public HistogramCostExtractor
+{
+public:
+    CV_WRAP virtual void setNormFlag(int flag) = 0;
+    CV_WRAP virtual int getNormFlag() const = 0;
+};
+
+CV_EXPORTS_W Ptr<HistogramCostExtractor>
+    createEMDHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f);
+
+/** @brief An Chi based cost extraction. :
+ */
+class CV_EXPORTS_W ChiHistogramCostExtractor : public HistogramCostExtractor
+{};
+
+CV_EXPORTS_W Ptr<HistogramCostExtractor> createChiHistogramCostExtractor(int nDummies=25, float defaultCost=0.2f);
+
+/** @brief An EMD-L1 based cost extraction. :
+ */
+class CV_EXPORTS_W EMDL1HistogramCostExtractor : public HistogramCostExtractor
+{};
+
+CV_EXPORTS_W Ptr<HistogramCostExtractor>
+    createEMDL1HistogramCostExtractor(int nDummies=25, float defaultCost=0.2f);
+
+//! @}
+
+} // cv
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp
new file mode 100644
index 0000000..5c4da3c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/shape.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp
new file mode 100644
index 0000000..4b0c3b5
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp
@@ -0,0 +1,224 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_SHAPE_SHAPE_DISTANCE_HPP__
+#define __OPENCV_SHAPE_SHAPE_DISTANCE_HPP__
+#include "opencv2/core.hpp"
+#include "opencv2/shape/hist_cost.hpp"
+#include "opencv2/shape/shape_transformer.hpp"
+
+namespace cv
+{
+
+//! @addtogroup shape
+//! @{
+
+/** @brief Abstract base class for shape distance algorithms.
+ */
+class CV_EXPORTS_W ShapeDistanceExtractor : public Algorithm
+{
+public:
+    /** @brief Compute the shape distance between two shapes defined by its contours.
+
+    @param contour1 Contour defining first shape.
+    @param contour2 Contour defining second shape.
+     */
+    CV_WRAP virtual float computeDistance(InputArray contour1, InputArray contour2) = 0;
+};
+
+/***********************************************************************************/
+/***********************************************************************************/
+/***********************************************************************************/
+/** @brief Implementation of the Shape Context descriptor and matching algorithm
+
+proposed by Belongie et al. in "Shape Matching and Object Recognition Using Shape Contexts" (PAMI
+2002). This implementation is packaged in a generic scheme, in order to allow you the
+implementation of the common variations of the original pipeline.
+*/
+class CV_EXPORTS_W ShapeContextDistanceExtractor : public ShapeDistanceExtractor
+{
+public:
+    /** @brief Establish the number of angular bins for the Shape Context Descriptor used in the shape matching
+    pipeline.
+
+    @param nAngularBins The number of angular bins in the shape context descriptor.
+     */
+    CV_WRAP virtual void setAngularBins(int nAngularBins) = 0;
+    CV_WRAP virtual int getAngularBins() const = 0;
+
+    /** @brief Establish the number of radial bins for the Shape Context Descriptor used in the shape matching
+    pipeline.
+
+    @param nRadialBins The number of radial bins in the shape context descriptor.
+     */
+    CV_WRAP virtual void setRadialBins(int nRadialBins) = 0;
+    CV_WRAP virtual int getRadialBins() const = 0;
+
+    /** @brief Set the inner radius of the shape context descriptor.
+
+    @param innerRadius The value of the inner radius.
+     */
+    CV_WRAP virtual void setInnerRadius(float innerRadius) = 0;
+    CV_WRAP virtual float getInnerRadius() const = 0;
+
+    /** @brief Set the outer radius of the shape context descriptor.
+
+    @param outerRadius The value of the outer radius.
+     */
+    CV_WRAP virtual void setOuterRadius(float outerRadius) = 0;
+    CV_WRAP virtual float getOuterRadius() const = 0;
+
+    CV_WRAP virtual void setRotationInvariant(bool rotationInvariant) = 0;
+    CV_WRAP virtual bool getRotationInvariant() const = 0;
+
+    /** @brief Set the weight of the shape context distance in the final value of the shape distance. The shape
+    context distance between two shapes is defined as the symmetric sum of shape context matching costs
+    over best matching points. The final value of the shape distance is a user-defined linear
+    combination of the shape context distance, an image appearance distance, and a bending energy.
+
+    @param shapeContextWeight The weight of the shape context distance in the final distance value.
+     */
+    CV_WRAP virtual void setShapeContextWeight(float shapeContextWeight) = 0;
+    CV_WRAP virtual float getShapeContextWeight() const = 0;
+
+    /** @brief Set the weight of the Image Appearance cost in the final value of the shape distance. The image
+    appearance cost is defined as the sum of squared brightness differences in Gaussian windows around
+    corresponding image points. The final value of the shape distance is a user-defined linear
+    combination of the shape context distance, an image appearance distance, and a bending energy. If
+    this value is set to a number different from 0, is mandatory to set the images that correspond to
+    each shape.
+
+    @param imageAppearanceWeight The weight of the appearance cost in the final distance value.
+     */
+    CV_WRAP virtual void setImageAppearanceWeight(float imageAppearanceWeight) = 0;
+    CV_WRAP virtual float getImageAppearanceWeight() const = 0;
+
+    /** @brief Set the weight of the Bending Energy in the final value of the shape distance. The bending energy
+    definition depends on what transformation is being used to align the shapes. The final value of the
+    shape distance is a user-defined linear combination of the shape context distance, an image
+    appearance distance, and a bending energy.
+
+    @param bendingEnergyWeight The weight of the Bending Energy in the final distance value.
+     */
+    CV_WRAP virtual void setBendingEnergyWeight(float bendingEnergyWeight) = 0;
+    CV_WRAP virtual float getBendingEnergyWeight() const = 0;
+
+    /** @brief Set the images that correspond to each shape. This images are used in the calculation of the Image
+    Appearance cost.
+
+    @param image1 Image corresponding to the shape defined by contours1.
+    @param image2 Image corresponding to the shape defined by contours2.
+     */
+    CV_WRAP virtual void setImages(InputArray image1, InputArray image2) = 0;
+    CV_WRAP virtual void getImages(OutputArray image1, OutputArray image2) const = 0;
+
+    CV_WRAP virtual void setIterations(int iterations) = 0;
+    CV_WRAP virtual int getIterations() const = 0;
+
+    /** @brief Set the algorithm used for building the shape context descriptor cost matrix.
+
+    @param comparer Smart pointer to a HistogramCostExtractor, an algorithm that defines the cost
+    matrix between descriptors.
+     */
+    CV_WRAP virtual void setCostExtractor(Ptr<HistogramCostExtractor> comparer) = 0;
+    CV_WRAP virtual Ptr<HistogramCostExtractor> getCostExtractor() const = 0;
+
+    /** @brief Set the value of the standard deviation for the Gaussian window for the image appearance cost.
+
+    @param sigma Standard Deviation.
+     */
+    CV_WRAP virtual void setStdDev(float sigma) = 0;
+    CV_WRAP virtual float getStdDev() const = 0;
+
+    /** @brief Set the algorithm used for aligning the shapes.
+
+    @param transformer Smart pointer to a ShapeTransformer, an algorithm that defines the aligning
+    transformation.
+     */
+    CV_WRAP virtual void setTransformAlgorithm(Ptr<ShapeTransformer> transformer) = 0;
+    CV_WRAP virtual Ptr<ShapeTransformer> getTransformAlgorithm() const = 0;
+};
+
+/* Complete constructor */
+CV_EXPORTS_W Ptr<ShapeContextDistanceExtractor>
+    createShapeContextDistanceExtractor(int nAngularBins=12, int nRadialBins=4,
+                                        float innerRadius=0.2f, float outerRadius=2, int iterations=3,
+                                        const Ptr<HistogramCostExtractor> &comparer = createChiHistogramCostExtractor(),
+                                        const Ptr<ShapeTransformer> &transformer = createThinPlateSplineShapeTransformer());
+
+/***********************************************************************************/
+/***********************************************************************************/
+/***********************************************************************************/
+/** @brief A simple Hausdorff distance measure between shapes defined by contours
+
+according to the paper "Comparing Images using the Hausdorff distance." by D.P. Huttenlocher, G.A.
+Klanderman, and W.J. Rucklidge. (PAMI 1993). :
+ */
+class CV_EXPORTS_W HausdorffDistanceExtractor : public ShapeDistanceExtractor
+{
+public:
+    /** @brief Set the norm used to compute the Hausdorff value between two shapes. It can be L1 or L2 norm.
+
+    @param distanceFlag Flag indicating which norm is used to compute the Hausdorff distance
+    (NORM_L1, NORM_L2).
+     */
+    CV_WRAP virtual void setDistanceFlag(int distanceFlag) = 0;
+    CV_WRAP virtual int getDistanceFlag() const = 0;
+
+    /** @brief This method sets the rank proportion (or fractional value) that establish the Kth ranked value of
+    the partial Hausdorff distance. Experimentally had been shown that 0.6 is a good value to compare
+    shapes.
+
+    @param rankProportion fractional value (between 0 and 1).
+     */
+    CV_WRAP virtual void setRankProportion(float rankProportion) = 0;
+    CV_WRAP virtual float getRankProportion() const = 0;
+};
+
+/* Constructor */
+CV_EXPORTS_W Ptr<HausdorffDistanceExtractor> createHausdorffDistanceExtractor(int distanceFlag=cv::NORM_L2, float rankProp=0.6f);
+
+//! @}
+
+} // cv
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp
new file mode 100644
index 0000000..2180613
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp
@@ -0,0 +1,132 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_SHAPE_SHAPE_TRANSFORM_HPP__
+#define __OPENCV_SHAPE_SHAPE_TRANSFORM_HPP__
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+
+//! @addtogroup shape
+//! @{
+
+/** @brief Abstract base class for shape transformation algorithms.
+ */
+class CV_EXPORTS_W ShapeTransformer : public Algorithm
+{
+public:
+    /** @brief Estimate the transformation parameters of the current transformer algorithm, based on point matches.
+
+    @param transformingShape Contour defining first shape.
+    @param targetShape Contour defining second shape (Target).
+    @param matches Standard vector of Matches between points.
+     */
+    CV_WRAP virtual void estimateTransformation(InputArray transformingShape, InputArray targetShape,
+                                                 std::vector<DMatch>& matches) = 0;
+
+    /** @brief Apply a transformation, given a pre-estimated transformation parameters.
+
+    @param input Contour (set of points) to apply the transformation.
+    @param output Output contour.
+     */
+    CV_WRAP virtual float applyTransformation(InputArray input, OutputArray output=noArray()) = 0;
+
+    /** @brief Apply a transformation, given a pre-estimated transformation parameters, to an Image.
+
+    @param transformingImage Input image.
+    @param output Output image.
+    @param flags Image interpolation method.
+    @param borderMode border style.
+    @param borderValue border value.
+     */
+    CV_WRAP virtual void warpImage(InputArray transformingImage, OutputArray output,
+                                   int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT,
+                                   const Scalar& borderValue=Scalar()) const = 0;
+};
+
+/***********************************************************************************/
+/***********************************************************************************/
+
+/** @brief Definition of the transformation
+
+ocupied in the paper "Principal Warps: Thin-Plate Splines and Decomposition of Deformations", by
+F.L. Bookstein (PAMI 1989). :
+ */
+class CV_EXPORTS_W ThinPlateSplineShapeTransformer : public ShapeTransformer
+{
+public:
+    /** @brief Set the regularization parameter for relaxing the exact interpolation requirements of the TPS
+    algorithm.
+
+    @param beta value of the regularization parameter.
+     */
+    CV_WRAP virtual void setRegularizationParameter(double beta) = 0;
+    CV_WRAP virtual double getRegularizationParameter() const = 0;
+};
+
+/** Complete constructor */
+CV_EXPORTS_W Ptr<ThinPlateSplineShapeTransformer>
+    createThinPlateSplineShapeTransformer(double regularizationParameter=0);
+
+/***********************************************************************************/
+/***********************************************************************************/
+
+/** @brief Wrapper class for the OpenCV Affine Transformation algorithm. :
+ */
+class CV_EXPORTS_W AffineTransformer : public ShapeTransformer
+{
+public:
+    CV_WRAP virtual void setFullAffine(bool fullAffine) = 0;
+    CV_WRAP virtual bool getFullAffine() const = 0;
+};
+
+/** Complete constructor */
+CV_EXPORTS_W Ptr<AffineTransformer> createAffineTransformer(bool fullAffine);
+
+//! @}
+
+} // cv
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching.hpp
new file mode 100644
index 0000000..96cde14
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching.hpp
@@ -0,0 +1,257 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_STITCHER_HPP__
+#define __OPENCV_STITCHING_STITCHER_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/stitching/warpers.hpp"
+#include "opencv2/stitching/detail/matchers.hpp"
+#include "opencv2/stitching/detail/motion_estimators.hpp"
+#include "opencv2/stitching/detail/exposure_compensate.hpp"
+#include "opencv2/stitching/detail/seam_finders.hpp"
+#include "opencv2/stitching/detail/blenders.hpp"
+#include "opencv2/stitching/detail/camera.hpp"
+
+/**
+@defgroup stitching Images stitching
+
+This figure illustrates the stitching module pipeline implemented in the Stitcher class. Using that
+class it's possible to configure/remove some steps, i.e. adjust the stitching pipeline according to
+the particular needs. All building blocks from the pipeline are available in the detail namespace,
+one can combine and use them separately.
+
+The implemented stitching pipeline is very similar to the one proposed in @cite BL07 .
+
+![image](StitchingPipeline.jpg)
+
+@{
+    @defgroup stitching_match Features Finding and Images Matching
+    @defgroup stitching_rotation Rotation Estimation
+    @defgroup stitching_autocalib Autocalibration
+    @defgroup stitching_warp Images Warping
+    @defgroup stitching_seam Seam Estimation
+    @defgroup stitching_exposure Exposure Compensation
+    @defgroup stitching_blend Image Blenders
+@}
+  */
+
+namespace cv {
+
+//! @addtogroup stitching
+//! @{
+
+/** @brief High level image stitcher.
+
+It's possible to use this class without being aware of the entire stitching pipeline. However, to
+be able to achieve higher stitching stability and quality of the final images at least being
+familiar with the theory is recommended.
+
+@note
+   -   A basic example on image stitching can be found at
+        opencv_source_code/samples/cpp/stitching.cpp
+    -   A detailed example on image stitching can be found at
+        opencv_source_code/samples/cpp/stitching_detailed.cpp
+ */
+class CV_EXPORTS_W Stitcher
+{
+public:
+    enum { ORIG_RESOL = -1 };
+    enum Status
+    {
+        OK = 0,
+        ERR_NEED_MORE_IMGS = 1,
+        ERR_HOMOGRAPHY_EST_FAIL = 2,
+        ERR_CAMERA_PARAMS_ADJUST_FAIL = 3
+    };
+
+   // Stitcher() {}
+    /** @brief Creates a stitcher with the default parameters.
+
+    @param try_use_gpu Flag indicating whether GPU should be used whenever it's possible.
+    @return Stitcher class instance.
+     */
+    static Stitcher createDefault(bool try_use_gpu = false);
+
+    CV_WRAP double registrationResol() const { return registr_resol_; }
+    CV_WRAP void setRegistrationResol(double resol_mpx) { registr_resol_ = resol_mpx; }
+
+    CV_WRAP double seamEstimationResol() const { return seam_est_resol_; }
+    CV_WRAP void setSeamEstimationResol(double resol_mpx) { seam_est_resol_ = resol_mpx; }
+
+    CV_WRAP double compositingResol() const { return compose_resol_; }
+    CV_WRAP void setCompositingResol(double resol_mpx) { compose_resol_ = resol_mpx; }
+
+    CV_WRAP double panoConfidenceThresh() const { return conf_thresh_; }
+    CV_WRAP void setPanoConfidenceThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }
+
+    CV_WRAP bool waveCorrection() const { return do_wave_correct_; }
+    CV_WRAP void setWaveCorrection(bool flag) { do_wave_correct_ = flag; }
+
+    detail::WaveCorrectKind waveCorrectKind() const { return wave_correct_kind_; }
+    void setWaveCorrectKind(detail::WaveCorrectKind kind) { wave_correct_kind_ = kind; }
+
+    Ptr<detail::FeaturesFinder> featuresFinder() { return features_finder_; }
+    const Ptr<detail::FeaturesFinder> featuresFinder() const { return features_finder_; }
+    void setFeaturesFinder(Ptr<detail::FeaturesFinder> features_finder)
+        { features_finder_ = features_finder; }
+
+    Ptr<detail::FeaturesMatcher> featuresMatcher() { return features_matcher_; }
+    const Ptr<detail::FeaturesMatcher> featuresMatcher() const { return features_matcher_; }
+    void setFeaturesMatcher(Ptr<detail::FeaturesMatcher> features_matcher)
+        { features_matcher_ = features_matcher; }
+
+    const cv::UMat& matchingMask() const { return matching_mask_; }
+    void setMatchingMask(const cv::UMat &mask)
+    {
+        CV_Assert(mask.type() == CV_8U && mask.cols == mask.rows);
+        matching_mask_ = mask.clone();
+    }
+
+    Ptr<detail::BundleAdjusterBase> bundleAdjuster() { return bundle_adjuster_; }
+    const Ptr<detail::BundleAdjusterBase> bundleAdjuster() const { return bundle_adjuster_; }
+    void setBundleAdjuster(Ptr<detail::BundleAdjusterBase> bundle_adjuster)
+        { bundle_adjuster_ = bundle_adjuster; }
+
+    Ptr<WarperCreator> warper() { return warper_; }
+    const Ptr<WarperCreator> warper() const { return warper_; }
+    void setWarper(Ptr<WarperCreator> creator) { warper_ = creator; }
+
+    Ptr<detail::ExposureCompensator> exposureCompensator() { return exposure_comp_; }
+    const Ptr<detail::ExposureCompensator> exposureCompensator() const { return exposure_comp_; }
+    void setExposureCompensator(Ptr<detail::ExposureCompensator> exposure_comp)
+        { exposure_comp_ = exposure_comp; }
+
+    Ptr<detail::SeamFinder> seamFinder() { return seam_finder_; }
+    const Ptr<detail::SeamFinder> seamFinder() const { return seam_finder_; }
+    void setSeamFinder(Ptr<detail::SeamFinder> seam_finder) { seam_finder_ = seam_finder; }
+
+    Ptr<detail::Blender> blender() { return blender_; }
+    const Ptr<detail::Blender> blender() const { return blender_; }
+    void setBlender(Ptr<detail::Blender> b) { blender_ = b; }
+
+    /** @overload */
+    CV_WRAP Status estimateTransform(InputArrayOfArrays images);
+    /** @brief These functions try to match the given images and to estimate rotations of each camera.
+
+    @note Use the functions only if you're aware of the stitching pipeline, otherwise use
+    Stitcher::stitch.
+
+    @param images Input images.
+    @param rois Region of interest rectangles.
+    @return Status code.
+     */
+    Status estimateTransform(InputArrayOfArrays images, const std::vector<std::vector<Rect> > &rois);
+
+    /** @overload */
+    CV_WRAP Status composePanorama(OutputArray pano);
+    /** @brief These functions try to compose the given images (or images stored internally from the other function
+    calls) into the final pano under the assumption that the image transformations were estimated
+    before.
+
+    @note Use the functions only if you're aware of the stitching pipeline, otherwise use
+    Stitcher::stitch.
+
+    @param images Input images.
+    @param pano Final pano.
+    @return Status code.
+     */
+    Status composePanorama(InputArrayOfArrays images, OutputArray pano);
+
+    /** @overload */
+    CV_WRAP Status stitch(InputArrayOfArrays images, OutputArray pano);
+    /** @brief These functions try to stitch the given images.
+
+    @param images Input images.
+    @param rois Region of interest rectangles.
+    @param pano Final pano.
+    @return Status code.
+     */
+    Status stitch(InputArrayOfArrays images, const std::vector<std::vector<Rect> > &rois, OutputArray pano);
+
+    std::vector<int> component() const { return indices_; }
+    std::vector<detail::CameraParams> cameras() const { return cameras_; }
+    CV_WRAP double workScale() const { return work_scale_; }
+
+private:
+    //Stitcher() {}
+
+    Status matchImages();
+    Status estimateCameraParams();
+
+    double registr_resol_;
+    double seam_est_resol_;
+    double compose_resol_;
+    double conf_thresh_;
+    Ptr<detail::FeaturesFinder> features_finder_;
+    Ptr<detail::FeaturesMatcher> features_matcher_;
+    cv::UMat matching_mask_;
+    Ptr<detail::BundleAdjusterBase> bundle_adjuster_;
+    bool do_wave_correct_;
+    detail::WaveCorrectKind wave_correct_kind_;
+    Ptr<WarperCreator> warper_;
+    Ptr<detail::ExposureCompensator> exposure_comp_;
+    Ptr<detail::SeamFinder> seam_finder_;
+    Ptr<detail::Blender> blender_;
+
+    std::vector<cv::UMat> imgs_;
+    std::vector<std::vector<cv::Rect> > rois_;
+    std::vector<cv::Size> full_img_sizes_;
+    std::vector<detail::ImageFeatures> features_;
+    std::vector<detail::MatchesInfo> pairwise_matches_;
+    std::vector<cv::UMat> seam_est_imgs_;
+    std::vector<int> indices_;
+    std::vector<detail::CameraParams> cameras_;
+    double work_scale_;
+    double seam_scale_;
+    double seam_work_aspect_;
+    double warped_image_scale_;
+};
+
+CV_EXPORTS_W Ptr<Stitcher> createStitcher(bool try_use_gpu = false);
+
+//! @} stitching
+
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_STITCHER_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp
new file mode 100644
index 0000000..ccc0aa1
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp
@@ -0,0 +1,86 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_AUTOCALIB_HPP__
+#define __OPENCV_STITCHING_AUTOCALIB_HPP__
+
+#include "opencv2/core.hpp"
+#include "matchers.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_autocalib
+//! @{
+
+/** @brief Tries to estimate focal lengths from the given homography under the assumption that the camera
+undergoes rotations around its centre only.
+
+@param H Homography.
+@param f0 Estimated focal length along X axis.
+@param f1 Estimated focal length along Y axis.
+@param f0_ok True, if f0 was estimated successfully, false otherwise.
+@param f1_ok True, if f1 was estimated successfully, false otherwise.
+
+See "Construction of Panoramic Image Mosaics with Global and Local Alignment"
+by Heung-Yeung Shum and Richard Szeliski.
+ */
+void CV_EXPORTS focalsFromHomography(const Mat &H, double &f0, double &f1, bool &f0_ok, bool &f1_ok);
+
+/** @brief Estimates focal lengths for each given camera.
+
+@param features Features of images.
+@param pairwise_matches Matches between all image pairs.
+@param focals Estimated focal lengths for each camera.
+ */
+void CV_EXPORTS estimateFocal(const std::vector<ImageFeatures> &features,
+                              const std::vector<MatchesInfo> &pairwise_matches,
+                              std::vector<double> &focals);
+
+bool CV_EXPORTS calibrateRotatingCamera(const std::vector<Mat> &Hs, Mat &K);
+
+//! @} stitching_autocalib
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_AUTOCALIB_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp
new file mode 100644
index 0000000..0e60725
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp
@@ -0,0 +1,163 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_BLENDERS_HPP__
+#define __OPENCV_STITCHING_BLENDERS_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_blend
+//! @{
+
+/** @brief Base class for all blenders.
+
+Simple blender which puts one image over another
+*/
+class CV_EXPORTS Blender
+{
+public:
+    virtual ~Blender() {}
+
+    enum { NO, FEATHER, MULTI_BAND };
+    static Ptr<Blender> createDefault(int type, bool try_gpu = false);
+
+    /** @brief Prepares the blender for blending.
+
+    @param corners Source images top-left corners
+    @param sizes Source image sizes
+     */
+    void prepare(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+    /** @overload */
+    virtual void prepare(Rect dst_roi);
+    /** @brief Processes the image.
+
+    @param img Source image
+    @param mask Source image mask
+    @param tl Source image top-left corners
+     */
+    virtual void feed(InputArray img, InputArray mask, Point tl);
+    /** @brief Blends and returns the final pano.
+
+    @param dst Final pano
+    @param dst_mask Final pano mask
+     */
+    virtual void blend(InputOutputArray dst, InputOutputArray dst_mask);
+
+protected:
+    UMat dst_, dst_mask_;
+    Rect dst_roi_;
+};
+
+/** @brief Simple blender which mixes images at its borders.
+ */
+class CV_EXPORTS FeatherBlender : public Blender
+{
+public:
+    FeatherBlender(float sharpness = 0.02f);
+
+    float sharpness() const { return sharpness_; }
+    void setSharpness(float val) { sharpness_ = val; }
+
+    void prepare(Rect dst_roi);
+    void feed(InputArray img, InputArray mask, Point tl);
+    void blend(InputOutputArray dst, InputOutputArray dst_mask);
+
+    //! Creates weight maps for fixed set of source images by their masks and top-left corners.
+    //! Final image can be obtained by simple weighting of the source images.
+    Rect createWeightMaps(const std::vector<UMat> &masks, const std::vector<Point> &corners,
+                          std::vector<UMat> &weight_maps);
+
+private:
+    float sharpness_;
+    UMat weight_map_;
+    UMat dst_weight_map_;
+};
+
+inline FeatherBlender::FeatherBlender(float _sharpness) { setSharpness(_sharpness); }
+
+/** @brief Blender which uses multi-band blending algorithm (see @cite BA83).
+ */
+class CV_EXPORTS MultiBandBlender : public Blender
+{
+public:
+    MultiBandBlender(int try_gpu = false, int num_bands = 5, int weight_type = CV_32F);
+
+    int numBands() const { return actual_num_bands_; }
+    void setNumBands(int val) { actual_num_bands_ = val; }
+
+    void prepare(Rect dst_roi);
+    void feed(InputArray img, InputArray mask, Point tl);
+    void blend(InputOutputArray dst, InputOutputArray dst_mask);
+
+private:
+    int actual_num_bands_, num_bands_;
+    std::vector<UMat> dst_pyr_laplace_;
+    std::vector<UMat> dst_band_weights_;
+    Rect dst_roi_final_;
+    bool can_use_gpu_;
+    int weight_type_; //CV_32F or CV_16S
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Auxiliary functions
+
+void CV_EXPORTS normalizeUsingWeightMap(InputArray weight, InputOutputArray src);
+
+void CV_EXPORTS createWeightMap(InputArray mask, float sharpness, InputOutputArray weight);
+
+void CV_EXPORTS createLaplacePyr(InputArray img, int num_levels, std::vector<UMat>& pyr);
+void CV_EXPORTS createLaplacePyrGpu(InputArray img, int num_levels, std::vector<UMat>& pyr);
+
+// Restores source image
+void CV_EXPORTS restoreImageFromLaplacePyr(std::vector<UMat>& pyr);
+void CV_EXPORTS restoreImageFromLaplacePyrGpu(std::vector<UMat>& pyr);
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_BLENDERS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp
new file mode 100644
index 0000000..c231ba5
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp
@@ -0,0 +1,78 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_CAMERA_HPP__
+#define __OPENCV_STITCHING_CAMERA_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching
+//! @{
+
+/** @brief Describes camera parameters.
+
+@note Translation is assumed to be zero during the whole stitching pipeline. :
+ */
+struct CV_EXPORTS CameraParams
+{
+    CameraParams();
+    CameraParams(const CameraParams& other);
+    const CameraParams& operator =(const CameraParams& other);
+    Mat K() const;
+
+    double focal; // Focal length
+    double aspect; // Aspect ratio
+    double ppx; // Principal point X
+    double ppy; // Principal point Y
+    Mat R; // Rotation
+    Mat t; // Translation
+};
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // #ifndef __OPENCV_STITCHING_CAMERA_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp
new file mode 100644
index 0000000..ef64e12
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp
@@ -0,0 +1,132 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP__
+#define __OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_exposure
+//! @{
+
+/** @brief Base class for all exposure compensators.
+ */
+class CV_EXPORTS ExposureCompensator
+{
+public:
+    virtual ~ExposureCompensator() {}
+
+    enum { NO, GAIN, GAIN_BLOCKS };
+    static Ptr<ExposureCompensator> createDefault(int type);
+
+    /**
+    @param corners Source image top-left corners
+    @param images Source images
+    @param masks Image masks to update (second value in pair specifies the value which should be used
+    to detect where image is)
+     */
+    void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
+              const std::vector<UMat> &masks);
+    /** @overload */
+    virtual void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
+                      const std::vector<std::pair<UMat,uchar> > &masks) = 0;
+    /** @brief Compensate exposure in the specified image.
+
+    @param index Image index
+    @param corner Image top-left corner
+    @param image Image to process
+    @param mask Image mask
+     */
+    virtual void apply(int index, Point corner, InputOutputArray image, InputArray mask) = 0;
+};
+
+/** @brief Stub exposure compensator which does nothing.
+ */
+class CV_EXPORTS NoExposureCompensator : public ExposureCompensator
+{
+public:
+    void feed(const std::vector<Point> &/*corners*/, const std::vector<UMat> &/*images*/,
+              const std::vector<std::pair<UMat,uchar> > &/*masks*/) { }
+    void apply(int /*index*/, Point /*corner*/, InputOutputArray /*image*/, InputArray /*mask*/) { }
+};
+
+/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image
+intensities, see @cite BL07 and @cite WJ10 for details.
+ */
+class CV_EXPORTS GainCompensator : public ExposureCompensator
+{
+public:
+    void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
+              const std::vector<std::pair<UMat,uchar> > &masks);
+    void apply(int index, Point corner, InputOutputArray image, InputArray mask);
+    std::vector<double> gains() const;
+
+private:
+    Mat_<double> gains_;
+};
+
+/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image block
+intensities, see @cite UES01 for details.
+ */
+class CV_EXPORTS BlocksGainCompensator : public ExposureCompensator
+{
+public:
+    BlocksGainCompensator(int bl_width = 32, int bl_height = 32)
+            : bl_width_(bl_width), bl_height_(bl_height) {}
+    void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
+              const std::vector<std::pair<UMat,uchar> > &masks);
+    void apply(int index, Point corner, InputOutputArray image, InputArray mask);
+
+private:
+    int bl_width_, bl_height_;
+    std::vector<UMat> gain_maps_;
+};
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp
new file mode 100644
index 0000000..8f34bd2
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp
@@ -0,0 +1,275 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_MATCHERS_HPP__
+#define __OPENCV_STITCHING_MATCHERS_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+
+#include "opencv2/opencv_modules.hpp"
+
+#ifdef HAVE_OPENCV_XFEATURES2D
+#  include "opencv2/xfeatures2d/cuda.hpp"
+#endif
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_match
+//! @{
+
+/** @brief Structure containing image keypoints and descriptors. */
+struct CV_EXPORTS ImageFeatures
+{
+    int img_idx;
+    Size img_size;
+    std::vector<KeyPoint> keypoints;
+    UMat descriptors;
+};
+
+/** @brief Feature finders base class */
+class CV_EXPORTS FeaturesFinder
+{
+public:
+    virtual ~FeaturesFinder() {}
+    /** @overload */
+    void operator ()(InputArray image, ImageFeatures &features);
+    /** @brief Finds features in the given image.
+
+    @param image Source image
+    @param features Found features
+    @param rois Regions of interest
+
+    @sa detail::ImageFeatures, Rect_
+    */
+    void operator ()(InputArray image, ImageFeatures &features, const std::vector<cv::Rect> &rois);
+    /** @brief Frees unused memory allocated before if there is any. */
+    virtual void collectGarbage() {}
+
+protected:
+    /** @brief This method must implement features finding logic in order to make the wrappers
+    detail::FeaturesFinder::operator()_ work.
+
+    @param image Source image
+    @param features Found features
+
+    @sa detail::ImageFeatures */
+    virtual void find(InputArray image, ImageFeatures &features) = 0;
+};
+
+/** @brief SURF features finder.
+
+@sa detail::FeaturesFinder, SURF
+*/
+class CV_EXPORTS SurfFeaturesFinder : public FeaturesFinder
+{
+public:
+    SurfFeaturesFinder(double hess_thresh = 300., int num_octaves = 3, int num_layers = 4,
+                       int num_octaves_descr = /*4*/3, int num_layers_descr = /*2*/4);
+
+private:
+    void find(InputArray image, ImageFeatures &features);
+
+    Ptr<FeatureDetector> detector_;
+    Ptr<DescriptorExtractor> extractor_;
+    Ptr<Feature2D> surf;
+};
+
+/** @brief ORB features finder. :
+
+@sa detail::FeaturesFinder, ORB
+*/
+class CV_EXPORTS OrbFeaturesFinder : public FeaturesFinder
+{
+public:
+    OrbFeaturesFinder(Size _grid_size = Size(3,1), int nfeatures=1500, float scaleFactor=1.3f, int nlevels=5);
+
+private:
+    void find(InputArray image, ImageFeatures &features);
+
+    Ptr<ORB> orb;
+    Size grid_size;
+};
+
+
+#ifdef HAVE_OPENCV_XFEATURES2D
+class CV_EXPORTS SurfFeaturesFinderGpu : public FeaturesFinder
+{
+public:
+    SurfFeaturesFinderGpu(double hess_thresh = 300., int num_octaves = 3, int num_layers = 4,
+                          int num_octaves_descr = 4, int num_layers_descr = 2);
+
+    void collectGarbage();
+
+private:
+    void find(InputArray image, ImageFeatures &features);
+
+    cuda::GpuMat image_;
+    cuda::GpuMat gray_image_;
+    cuda::SURF_CUDA surf_;
+    cuda::GpuMat keypoints_;
+    cuda::GpuMat descriptors_;
+    int num_octaves_, num_layers_;
+    int num_octaves_descr_, num_layers_descr_;
+};
+#endif
+
+/** @brief Structure containing information about matches between two images.
+
+It's assumed that there is a homography between those images.
+*/
+struct CV_EXPORTS MatchesInfo
+{
+    MatchesInfo();
+    MatchesInfo(const MatchesInfo &other);
+    const MatchesInfo& operator =(const MatchesInfo &other);
+
+    int src_img_idx, dst_img_idx;       //!< Images indices (optional)
+    std::vector<DMatch> matches;
+    std::vector<uchar> inliers_mask;    //!< Geometrically consistent matches mask
+    int num_inliers;                    //!< Number of geometrically consistent matches
+    Mat H;                              //!< Estimated homography
+    double confidence;                  //!< Confidence two images are from the same panorama
+};
+
+/** @brief Feature matchers base class. */
+class CV_EXPORTS FeaturesMatcher
+{
+public:
+    virtual ~FeaturesMatcher() {}
+
+    /** @overload
+    @param features1 First image features
+    @param features2 Second image features
+    @param matches_info Found matches
+    */
+    void operator ()(const ImageFeatures &features1, const ImageFeatures &features2,
+                     MatchesInfo& matches_info) { match(features1, features2, matches_info); }
+
+    /** @brief Performs images matching.
+
+    @param features Features of the source images
+    @param pairwise_matches Found pairwise matches
+    @param mask Mask indicating which image pairs must be matched
+
+    The function is parallelized with the TBB library.
+
+    @sa detail::MatchesInfo
+    */
+    void operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
+                     const cv::UMat &mask = cv::UMat());
+
+    /** @return True, if it's possible to use the same matcher instance in parallel, false otherwise
+    */
+    bool isThreadSafe() const { return is_thread_safe_; }
+
+    /** @brief Frees unused memory allocated before if there is any.
+    */
+    virtual void collectGarbage() {}
+
+protected:
+    FeaturesMatcher(bool is_thread_safe = false) : is_thread_safe_(is_thread_safe) {}
+
+    /** @brief This method must implement matching logic in order to make the wrappers
+    detail::FeaturesMatcher::operator()_ work.
+
+    @param features1 first image features
+    @param features2 second image features
+    @param matches_info found matches
+     */
+    virtual void match(const ImageFeatures &features1, const ImageFeatures &features2,
+                       MatchesInfo& matches_info) = 0;
+
+    bool is_thread_safe_;
+};
+
+/** @brief Features matcher which finds two best matches for each feature and leaves the best one only if the
+ratio between descriptor distances is greater than the threshold match_conf
+
+@sa detail::FeaturesMatcher
+ */
+class CV_EXPORTS BestOf2NearestMatcher : public FeaturesMatcher
+{
+public:
+    /** @brief Constructs a "best of 2 nearest" matcher.
+
+    @param try_use_gpu Should try to use GPU or not
+    @param match_conf Match distances ration threshold
+    @param num_matches_thresh1 Minimum number of matches required for the 2D projective transform
+    estimation used in the inliers classification step
+    @param num_matches_thresh2 Minimum number of matches required for the 2D projective transform
+    re-estimation on inliers
+     */
+    BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.3f, int num_matches_thresh1 = 6,
+                          int num_matches_thresh2 = 6);
+
+    void collectGarbage();
+
+protected:
+    void match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo &matches_info);
+
+    int num_matches_thresh1_;
+    int num_matches_thresh2_;
+    Ptr<FeaturesMatcher> impl_;
+};
+
+class CV_EXPORTS BestOf2NearestRangeMatcher : public BestOf2NearestMatcher
+{
+public:
+    BestOf2NearestRangeMatcher(int range_width = 5, bool try_use_gpu = false, float match_conf = 0.3f,
+                            int num_matches_thresh1 = 6, int num_matches_thresh2 = 6);
+
+    void operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
+                     const cv::UMat &mask = cv::UMat());
+
+
+protected:
+    int range_width_;
+};
+
+//! @} stitching_match
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_MATCHERS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp
new file mode 100644
index 0000000..2c86e63
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp
@@ -0,0 +1,274 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_MOTION_ESTIMATORS_HPP__
+#define __OPENCV_STITCHING_MOTION_ESTIMATORS_HPP__
+
+#include "opencv2/core.hpp"
+#include "matchers.hpp"
+#include "util.hpp"
+#include "camera.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_rotation
+//! @{
+
+/** @brief Rotation estimator base class.
+
+It takes features of all images, pairwise matches between all images and estimates rotations of all
+cameras.
+
+@note The coordinate system origin is implementation-dependent, but you can always normalize the
+rotations in respect to the first camera, for instance. :
+ */
+class CV_EXPORTS Estimator
+{
+public:
+    virtual ~Estimator() {}
+
+    /** @brief Estimates camera parameters.
+
+    @param features Features of images
+    @param pairwise_matches Pairwise matches of images
+    @param cameras Estimated camera parameters
+    @return True in case of success, false otherwise
+     */
+    bool operator ()(const std::vector<ImageFeatures> &features,
+                     const std::vector<MatchesInfo> &pairwise_matches,
+                     std::vector<CameraParams> &cameras)
+        { return estimate(features, pairwise_matches, cameras); }
+
+protected:
+    /** @brief This method must implement camera parameters estimation logic in order to make the wrapper
+    detail::Estimator::operator()_ work.
+
+    @param features Features of images
+    @param pairwise_matches Pairwise matches of images
+    @param cameras Estimated camera parameters
+    @return True in case of success, false otherwise
+     */
+    virtual bool estimate(const std::vector<ImageFeatures> &features,
+                          const std::vector<MatchesInfo> &pairwise_matches,
+                          std::vector<CameraParams> &cameras) = 0;
+};
+
+/** @brief Homography based rotation estimator.
+ */
+class CV_EXPORTS HomographyBasedEstimator : public Estimator
+{
+public:
+    HomographyBasedEstimator(bool is_focals_estimated = false)
+        : is_focals_estimated_(is_focals_estimated) {}
+
+private:
+    virtual bool estimate(const std::vector<ImageFeatures> &features,
+                          const std::vector<MatchesInfo> &pairwise_matches,
+                          std::vector<CameraParams> &cameras);
+
+    bool is_focals_estimated_;
+};
+
+/** @brief Base class for all camera parameters refinement methods.
+ */
+class CV_EXPORTS BundleAdjusterBase : public Estimator
+{
+public:
+    const Mat refinementMask() const { return refinement_mask_.clone(); }
+    void setRefinementMask(const Mat &mask)
+    {
+        CV_Assert(mask.type() == CV_8U && mask.size() == Size(3, 3));
+        refinement_mask_ = mask.clone();
+    }
+
+    double confThresh() const { return conf_thresh_; }
+    void setConfThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }
+
+    TermCriteria termCriteria() { return term_criteria_; }
+    void setTermCriteria(const TermCriteria& term_criteria) { term_criteria_ = term_criteria; }
+
+protected:
+    /** @brief Construct a bundle adjuster base instance.
+
+    @param num_params_per_cam Number of parameters per camera
+    @param num_errs_per_measurement Number of error terms (components) per match
+     */
+    BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
+        : num_params_per_cam_(num_params_per_cam),
+          num_errs_per_measurement_(num_errs_per_measurement)
+    {
+        setRefinementMask(Mat::ones(3, 3, CV_8U));
+        setConfThresh(1.);
+        setTermCriteria(TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 1000, DBL_EPSILON));
+    }
+
+    // Runs bundle adjustment
+    virtual bool estimate(const std::vector<ImageFeatures> &features,
+                          const std::vector<MatchesInfo> &pairwise_matches,
+                          std::vector<CameraParams> &cameras);
+
+    /** @brief Sets initial camera parameter to refine.
+
+    @param cameras Camera parameters
+     */
+    virtual void setUpInitialCameraParams(const std::vector<CameraParams> &cameras) = 0;
+    /** @brief Gets the refined camera parameters.
+
+    @param cameras Refined camera parameters
+     */
+    virtual void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) const = 0;
+    /** @brief Calculates error vector.
+
+    @param err Error column-vector of length total_num_matches \* num_errs_per_measurement
+     */
+    virtual void calcError(Mat &err) = 0;
+    /** @brief Calculates the cost function jacobian.
+
+    @param jac Jacobian matrix of dimensions
+    (total_num_matches \* num_errs_per_measurement) x (num_images \* num_params_per_cam)
+     */
+    virtual void calcJacobian(Mat &jac) = 0;
+
+    // 3x3 8U mask, where 0 means don't refine respective parameter, != 0 means refine
+    Mat refinement_mask_;
+
+    int num_images_;
+    int total_num_matches_;
+
+    int num_params_per_cam_;
+    int num_errs_per_measurement_;
+
+    const ImageFeatures *features_;
+    const MatchesInfo *pairwise_matches_;
+
+    // Threshold to filter out poorly matched image pairs
+    double conf_thresh_;
+
+    //Levenberg鈥揗arquardt algorithm termination criteria
+    TermCriteria term_criteria_;
+
+    // Camera parameters matrix (CV_64F)
+    Mat cam_params_;
+
+    // Connected images pairs
+    std::vector<std::pair<int,int> > edges_;
+};
+
+
+/** @brief Implementation of the camera parameters refinement algorithm which minimizes sum of the reprojection
+error squares
+
+It can estimate focal length, aspect ratio, principal point.
+You can affect only on them via the refinement mask.
+ */
+class CV_EXPORTS BundleAdjusterReproj : public BundleAdjusterBase
+{
+public:
+    BundleAdjusterReproj() : BundleAdjusterBase(7, 2) {}
+
+private:
+    void setUpInitialCameraParams(const std::vector<CameraParams> &cameras);
+    void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) const;
+    void calcError(Mat &err);
+    void calcJacobian(Mat &jac);
+
+    Mat err1_, err2_;
+};
+
+
+/** @brief Implementation of the camera parameters refinement algorithm which minimizes sum of the distances
+between the rays passing through the camera center and a feature. :
+
+It can estimate focal length. It ignores the refinement mask for now.
+ */
+class CV_EXPORTS BundleAdjusterRay : public BundleAdjusterBase
+{
+public:
+    BundleAdjusterRay() : BundleAdjusterBase(4, 3) {}
+
+private:
+    void setUpInitialCameraParams(const std::vector<CameraParams> &cameras);
+    void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) const;
+    void calcError(Mat &err);
+    void calcJacobian(Mat &jac);
+
+    Mat err1_, err2_;
+};
+
+
+enum WaveCorrectKind
+{
+    WAVE_CORRECT_HORIZ,
+    WAVE_CORRECT_VERT
+};
+
+/** @brief Tries to make panorama more horizontal (or vertical).
+
+@param rmats Camera rotation matrices.
+@param kind Correction kind, see detail::WaveCorrectKind.
+ */
+void CV_EXPORTS waveCorrect(std::vector<Mat> &rmats, WaveCorrectKind kind);
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Auxiliary functions
+
+// Returns matches graph representation in DOT language
+String CV_EXPORTS matchesGraphAsString(std::vector<String> &pathes, std::vector<MatchesInfo> &pairwise_matches,
+                                            float conf_threshold);
+
+std::vector<int> CV_EXPORTS leaveBiggestComponent(
+        std::vector<ImageFeatures> &features,
+        std::vector<MatchesInfo> &pairwise_matches,
+        float conf_threshold);
+
+void CV_EXPORTS findMaxSpanningTree(
+        int num_images, const std::vector<MatchesInfo> &pairwise_matches,
+        Graph &span_tree, std::vector<int> &centers);
+
+//! @} stitching_rotation
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_MOTION_ESTIMATORS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp
new file mode 100644
index 0000000..4ff22c4
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp
@@ -0,0 +1,285 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_SEAM_FINDERS_HPP__
+#define __OPENCV_STITCHING_SEAM_FINDERS_HPP__
+
+#include <set>
+#include "opencv2/core.hpp"
+#include "opencv2/opencv_modules.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_seam
+//! @{
+
+/** @brief Base class for a seam estimator.
+ */
+class CV_EXPORTS SeamFinder
+{
+public:
+    virtual ~SeamFinder() {}
+    /** @brief Estimates seams.
+
+    @param src Source images
+    @param corners Source image top-left corners
+    @param masks Source image masks to update
+     */
+    virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks) = 0;
+};
+
+/** @brief Stub seam estimator which does nothing.
+ */
+class CV_EXPORTS NoSeamFinder : public SeamFinder
+{
+public:
+    void find(const std::vector<UMat>&, const std::vector<Point>&, std::vector<UMat>&) {}
+};
+
+/** @brief Base class for all pairwise seam estimators.
+ */
+class CV_EXPORTS PairwiseSeamFinder : public SeamFinder
+{
+public:
+    virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks);
+
+protected:
+    void run();
+    /** @brief Resolves masks intersection of two specified images in the given ROI.
+
+    @param first First image index
+    @param second Second image index
+    @param roi Region of interest
+     */
+    virtual void findInPair(size_t first, size_t second, Rect roi) = 0;
+
+    std::vector<UMat> images_;
+    std::vector<Size> sizes_;
+    std::vector<Point> corners_;
+    std::vector<UMat> masks_;
+};
+
+/** @brief Voronoi diagram-based seam estimator.
+ */
+class CV_EXPORTS VoronoiSeamFinder : public PairwiseSeamFinder
+{
+public:
+    virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks);
+    virtual void find(const std::vector<Size> &size, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks);
+private:
+    void findInPair(size_t first, size_t second, Rect roi);
+};
+
+
+class CV_EXPORTS DpSeamFinder : public SeamFinder
+{
+public:
+    enum CostFunction { COLOR, COLOR_GRAD };
+
+    DpSeamFinder(CostFunction costFunc = COLOR);
+
+    CostFunction costFunction() const { return costFunc_; }
+    void setCostFunction(CostFunction val) { costFunc_ = val; }
+
+    virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks);
+
+private:
+    enum ComponentState
+    {
+        FIRST = 1, SECOND = 2, INTERS = 4,
+        INTERS_FIRST = INTERS | FIRST,
+        INTERS_SECOND = INTERS | SECOND
+    };
+
+    class ImagePairLess
+    {
+    public:
+        ImagePairLess(const std::vector<Mat> &images, const std::vector<Point> &corners)
+            : src_(&images[0]), corners_(&corners[0]) {}
+
+        bool operator() (const std::pair<size_t, size_t> &l, const std::pair<size_t, size_t> &r) const
+        {
+            Point c1 = corners_[l.first] + Point(src_[l.first].cols / 2, src_[l.first].rows / 2);
+            Point c2 = corners_[l.second] + Point(src_[l.second].cols / 2, src_[l.second].rows / 2);
+            int d1 = (c1 - c2).dot(c1 - c2);
+
+            c1 = corners_[r.first] + Point(src_[r.first].cols / 2, src_[r.first].rows / 2);
+            c2 = corners_[r.second] + Point(src_[r.second].cols / 2, src_[r.second].rows / 2);
+            int d2 = (c1 - c2).dot(c1 - c2);
+
+            return d1 < d2;
+        }
+
+    private:
+        const Mat *src_;
+        const Point *corners_;
+    };
+
+    class ClosePoints
+    {
+    public:
+        ClosePoints(int minDist) : minDist_(minDist) {}
+
+        bool operator() (const Point &p1, const Point &p2) const
+        {
+            int dist2 = (p1.x-p2.x) * (p1.x-p2.x) + (p1.y-p2.y) * (p1.y-p2.y);
+            return dist2 < minDist_ * minDist_;
+        }
+
+    private:
+        int minDist_;
+    };
+
+    void process(
+            const Mat &image1, const Mat &image2, Point tl1, Point tl2,  Mat &mask1, Mat &mask2);
+
+    void findComponents();
+
+    void findEdges();
+
+    void resolveConflicts(
+            const Mat &image1, const Mat &image2, Point tl1, Point tl2, Mat &mask1, Mat &mask2);
+
+    void computeGradients(const Mat &image1, const Mat &image2);
+
+    bool hasOnlyOneNeighbor(int comp);
+
+    bool closeToContour(int y, int x, const Mat_<uchar> &contourMask);
+
+    bool getSeamTips(int comp1, int comp2, Point &p1, Point &p2);
+
+    void computeCosts(
+            const Mat &image1, const Mat &image2, Point tl1, Point tl2,
+            int comp, Mat_<float> &costV, Mat_<float> &costH);
+
+    bool estimateSeam(
+            const Mat &image1, const Mat &image2, Point tl1, Point tl2, int comp,
+            Point p1, Point p2, std::vector<Point> &seam, bool &isHorizontal);
+
+    void updateLabelsUsingSeam(
+            int comp1, int comp2, const std::vector<Point> &seam, bool isHorizontalSeam);
+
+    CostFunction costFunc_;
+
+    // processing images pair data
+    Point unionTl_, unionBr_;
+    Size unionSize_;
+    Mat_<uchar> mask1_, mask2_;
+    Mat_<uchar> contour1mask_, contour2mask_;
+    Mat_<float> gradx1_, grady1_;
+    Mat_<float> gradx2_, grady2_;
+
+    // components data
+    int ncomps_;
+    Mat_<int> labels_;
+    std::vector<ComponentState> states_;
+    std::vector<Point> tls_, brs_;
+    std::vector<std::vector<Point> > contours_;
+    std::set<std::pair<int, int> > edges_;
+};
+
+/** @brief Base class for all minimum graph-cut-based seam estimators.
+ */
+class CV_EXPORTS GraphCutSeamFinderBase
+{
+public:
+    enum CostType { COST_COLOR, COST_COLOR_GRAD };
+};
+
+/** @brief Minimum graph cut-based seam estimator. See details in @cite V03 .
+ */
+class CV_EXPORTS GraphCutSeamFinder : public GraphCutSeamFinderBase, public SeamFinder
+{
+public:
+    GraphCutSeamFinder(int cost_type = COST_COLOR_GRAD, float terminal_cost = 10000.f,
+                       float bad_region_penalty = 1000.f);
+
+    ~GraphCutSeamFinder();
+
+    void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+              std::vector<UMat> &masks);
+
+private:
+    // To avoid GCGraph dependency
+    class Impl;
+    Ptr<PairwiseSeamFinder> impl_;
+};
+
+
+#ifdef HAVE_OPENCV_CUDALEGACY
+class CV_EXPORTS GraphCutSeamFinderGpu : public GraphCutSeamFinderBase, public PairwiseSeamFinder
+{
+public:
+    GraphCutSeamFinderGpu(int cost_type = COST_COLOR_GRAD, float terminal_cost = 10000.f,
+                          float bad_region_penalty = 1000.f)
+                          : cost_type_(cost_type), terminal_cost_(terminal_cost),
+                            bad_region_penalty_(bad_region_penalty) {}
+
+    void find(const std::vector<cv::UMat> &src, const std::vector<cv::Point> &corners,
+              std::vector<cv::UMat> &masks);
+    void findInPair(size_t first, size_t second, Rect roi);
+
+private:
+    void setGraphWeightsColor(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &mask1, const cv::Mat &mask2,
+                              cv::Mat &terminals, cv::Mat &leftT, cv::Mat &rightT, cv::Mat &top, cv::Mat &bottom);
+    void setGraphWeightsColorGrad(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &dx1, const cv::Mat &dx2,
+                                  const cv::Mat &dy1, const cv::Mat &dy2, const cv::Mat &mask1, const cv::Mat &mask2,
+                                  cv::Mat &terminals, cv::Mat &leftT, cv::Mat &rightT, cv::Mat &top, cv::Mat &bottom);
+    std::vector<Mat> dx_, dy_;
+    int cost_type_;
+    float terminal_cost_;
+    float bad_region_penalty_;
+};
+#endif
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_SEAM_FINDERS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp
new file mode 100644
index 0000000..d64c03c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp
@@ -0,0 +1,91 @@
+/*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*/
+
+
+#ifndef __OPENCV_STITCHING_TIMELAPSERS_HPP__
+#define __OPENCV_STITCHING_TIMELAPSERS_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching
+//! @{
+
+//  Base Timelapser class, takes a sequence of images, applies appropriate shift, stores result in dst_.
+
+class CV_EXPORTS Timelapser
+{
+public:
+
+    enum {AS_IS, CROP};
+
+    virtual ~Timelapser() {}
+
+    static Ptr<Timelapser> createDefault(int type);
+
+    virtual void initialize(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+    virtual void process(InputArray img, InputArray mask, Point tl);
+    virtual const UMat& getDst() {return dst_;}
+
+protected:
+
+    virtual bool test_point(Point pt);
+
+    UMat dst_;
+    Rect dst_roi_;
+};
+
+
+class CV_EXPORTS TimelapserCrop : public Timelapser
+{
+public:
+    virtual void initialize(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+};
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_TIMELAPSERS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp
new file mode 100644
index 0000000..3845ba5
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp
@@ -0,0 +1,171 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_UTIL_HPP__
+#define __OPENCV_STITCHING_UTIL_HPP__
+
+#include <list>
+#include "opencv2/core.hpp"
+
+#ifndef ENABLE_LOG
+#define ENABLE_LOG 0
+#endif
+
+// TODO remove LOG macros, add logging class
+#if ENABLE_LOG
+#ifdef ANDROID
+  #include <iostream>
+  #include <sstream>
+  #include <android/log.h>
+  #define LOG_STITCHING_MSG(msg) \
+    do { \
+        Stringstream _os; \
+        _os << msg; \
+       __android_log_print(ANDROID_LOG_DEBUG, "STITCHING", "%s", _os.str().c_str()); \
+    } while(0);
+#else
+  #include <iostream>
+  #define LOG_STITCHING_MSG(msg) for(;;) { std::cout << msg; std::cout.flush(); break; }
+#endif
+#else
+  #define LOG_STITCHING_MSG(msg)
+#endif
+
+#define LOG_(_level, _msg)                     \
+    for(;;)                                    \
+    {                                          \
+        using namespace std;                   \
+        if ((_level) >= ::cv::detail::stitchingLogLevel()) \
+        {                                      \
+            LOG_STITCHING_MSG(_msg);           \
+        }                                      \
+    break;                                 \
+    }
+
+
+#define LOG(msg) LOG_(1, msg)
+#define LOG_CHAT(msg) LOG_(0, msg)
+
+#define LOGLN(msg) LOG(msg << std::endl)
+#define LOGLN_CHAT(msg) LOG_CHAT(msg << std::endl)
+
+//#if DEBUG_LOG_CHAT
+//  #define LOG_CHAT(msg) LOG(msg)
+//  #define LOGLN_CHAT(msg) LOGLN(msg)
+//#else
+//  #define LOG_CHAT(msg) do{}while(0)
+//  #define LOGLN_CHAT(msg) do{}while(0)
+//#endif
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching
+//! @{
+
+class CV_EXPORTS DisjointSets
+{
+public:
+    DisjointSets(int elem_count = 0) { createOneElemSets(elem_count); }
+
+    void createOneElemSets(int elem_count);
+    int findSetByElem(int elem);
+    int mergeSets(int set1, int set2);
+
+    std::vector<int> parent;
+    std::vector<int> size;
+
+private:
+    std::vector<int> rank_;
+};
+
+
+struct CV_EXPORTS GraphEdge
+{
+    GraphEdge(int from, int to, float weight);
+    bool operator <(const GraphEdge& other) const { return weight < other.weight; }
+    bool operator >(const GraphEdge& other) const { return weight > other.weight; }
+
+    int from, to;
+    float weight;
+};
+
+inline GraphEdge::GraphEdge(int _from, int _to, float _weight) : from(_from), to(_to), weight(_weight) {}
+
+
+class CV_EXPORTS Graph
+{
+public:
+    Graph(int num_vertices = 0) { create(num_vertices); }
+    void create(int num_vertices) { edges_.assign(num_vertices, std::list<GraphEdge>()); }
+    int numVertices() const { return static_cast<int>(edges_.size()); }
+    void addEdge(int from, int to, float weight);
+    template <typename B> B forEach(B body) const;
+    template <typename B> B walkBreadthFirst(int from, B body) const;
+
+private:
+    std::vector< std::list<GraphEdge> > edges_;
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Auxiliary functions
+
+CV_EXPORTS bool overlapRoi(Point tl1, Point tl2, Size sz1, Size sz2, Rect &roi);
+CV_EXPORTS Rect resultRoi(const std::vector<Point> &corners, const std::vector<UMat> &images);
+CV_EXPORTS Rect resultRoi(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+CV_EXPORTS Rect resultRoiIntersection(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+CV_EXPORTS Point resultTl(const std::vector<Point> &corners);
+
+// Returns random 'count' element subset of the {0,1,...,size-1} set
+CV_EXPORTS void selectRandomSubset(int count, int size, std::vector<int> &subset);
+
+CV_EXPORTS int& stitchingLogLevel();
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#include "util_inl.hpp"
+
+#endif // __OPENCV_STITCHING_UTIL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp
new file mode 100644
index 0000000..6ac6f8e
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp
@@ -0,0 +1,131 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_UTIL_INL_HPP__
+#define __OPENCV_STITCHING_UTIL_INL_HPP__
+
+#include <queue>
+#include "opencv2/core.hpp"
+#include "util.hpp" // Make your IDE see declarations
+
+//! @cond IGNORED
+
+namespace cv {
+namespace detail {
+
+template <typename B>
+B Graph::forEach(B body) const
+{
+    for (int i = 0; i < numVertices(); ++i)
+    {
+        std::list<GraphEdge>::const_iterator edge = edges_[i].begin();
+        for (; edge != edges_[i].end(); ++edge)
+            body(*edge);
+    }
+    return body;
+}
+
+
+template <typename B>
+B Graph::walkBreadthFirst(int from, B body) const
+{
+    std::vector<bool> was(numVertices(), false);
+    std::queue<int> vertices;
+
+    was[from] = true;
+    vertices.push(from);
+
+    while (!vertices.empty())
+    {
+        int vertex = vertices.front();
+        vertices.pop();
+
+        std::list<GraphEdge>::const_iterator edge = edges_[vertex].begin();
+        for (; edge != edges_[vertex].end(); ++edge)
+        {
+            if (!was[edge->to])
+            {
+                body(*edge);
+                was[edge->to] = true;
+                vertices.push(edge->to);
+            }
+        }
+    }
+
+    return body;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Some auxiliary math functions
+
+static inline
+float normL2(const Point3f& a)
+{
+    return a.x * a.x + a.y * a.y + a.z * a.z;
+}
+
+
+static inline
+float normL2(const Point3f& a, const Point3f& b)
+{
+    return normL2(a - b);
+}
+
+
+static inline
+double normL2sq(const Mat &r)
+{
+    return r.dot(r);
+}
+
+
+static inline int sqr(int x) { return x * x; }
+static inline float sqr(float x) { return x * x; }
+static inline double sqr(double x) { return x * x; }
+
+} // namespace detail
+} // namespace cv
+
+//! @endcond
+
+#endif // __OPENCV_STITCHING_UTIL_INL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp
new file mode 100644
index 0000000..ee8e824
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp
@@ -0,0 +1,586 @@
+ /*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*/
+
+#ifndef __OPENCV_STITCHING_WARPERS_HPP__
+#define __OPENCV_STITCHING_WARPERS_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/core/cuda.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/opencv_modules.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_warp
+//! @{
+
+/** @brief Rotation-only model image warper interface.
+ */
+class CV_EXPORTS RotationWarper
+{
+public:
+    virtual ~RotationWarper() {}
+
+    /** @brief Projects the image point.
+
+    @param pt Source point
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @return Projected point
+     */
+    virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) = 0;
+
+    /** @brief Builds the projection maps according to the given camera data.
+
+    @param src_size Source image size
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @param xmap Projection map for the x axis
+    @param ymap Projection map for the y axis
+    @return Projected image minimum bounding box
+     */
+    virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) = 0;
+
+    /** @brief Projects the image.
+
+    @param src Source image
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @param interp_mode Interpolation mode
+    @param border_mode Border extrapolation mode
+    @param dst Projected image
+    @return Project image top-left corner
+     */
+    virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                       OutputArray dst) = 0;
+
+    /** @brief Projects the image backward.
+
+    @param src Projected image
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @param interp_mode Interpolation mode
+    @param border_mode Border extrapolation mode
+    @param dst_size Backward-projected image size
+    @param dst Backward-projected image
+     */
+    virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                              Size dst_size, OutputArray dst) = 0;
+
+    /**
+    @param src_size Source image bounding box
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @return Projected image minimum bounding box
+     */
+    virtual Rect warpRoi(Size src_size, InputArray K, InputArray R) = 0;
+
+    virtual float getScale() const { return 1.f; }
+    virtual void setScale(float) {}
+};
+
+/** @brief Base class for warping logic implementation.
+ */
+struct CV_EXPORTS ProjectorBase
+{
+    void setCameraParams(InputArray K = Mat::eye(3, 3, CV_32F),
+                         InputArray R = Mat::eye(3, 3, CV_32F),
+                         InputArray T = Mat::zeros(3, 1, CV_32F));
+
+    float scale;
+    float k[9];
+    float rinv[9];
+    float r_kinv[9];
+    float k_rinv[9];
+    float t[3];
+};
+
+/** @brief Base class for rotation-based warper using a detail::ProjectorBase_ derived class.
+ */
+template <class P>
+class CV_EXPORTS RotationWarperBase : public RotationWarper
+{
+public:
+    Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
+
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               OutputArray dst);
+
+    void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                      Size dst_size, OutputArray dst);
+
+    Rect warpRoi(Size src_size, InputArray K, InputArray R);
+
+    float getScale() const { return projector_.scale; }
+    void setScale(float val) { projector_.scale = val; }
+
+protected:
+
+    // Detects ROI of the destination image. It's correct for any projection.
+    virtual void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
+
+    // Detects ROI of the destination image by walking over image border.
+    // Correctness for any projection isn't guaranteed.
+    void detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br);
+
+    P projector_;
+};
+
+
+struct CV_EXPORTS PlaneProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+/** @brief Warper that maps an image onto the z = 1 plane.
+ */
+class CV_EXPORTS PlaneWarper : public RotationWarperBase<PlaneProjector>
+{
+public:
+    /** @brief Construct an instance of the plane warper class.
+
+    @param scale Projected image scale multiplier
+     */
+    PlaneWarper(float scale = 1.f) { projector_.scale = scale; }
+
+    Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
+    Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R, InputArray T);
+
+    virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap);
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
+
+    Point warp(InputArray src, InputArray K, InputArray R,
+               int interp_mode, int border_mode, OutputArray dst);
+    virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
+               OutputArray dst);
+
+    Rect warpRoi(Size src_size, InputArray K, InputArray R);
+    Rect warpRoi(Size src_size, InputArray K, InputArray R, InputArray T);
+
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
+};
+
+
+struct CV_EXPORTS SphericalProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+/** @brief Warper that maps an image onto the unit sphere located at the origin.
+
+ Projects image onto unit sphere with origin at (0, 0, 0).
+ Poles are located at (0, -1, 0) and (0, 1, 0) points.
+*/
+class CV_EXPORTS SphericalWarper : public RotationWarperBase<SphericalProjector>
+{
+public:
+    /** @brief Construct an instance of the spherical warper class.
+
+    @param scale Projected image scale multiplier
+     */
+    SphericalWarper(float scale) { projector_.scale = scale; }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst);
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
+};
+
+
+struct CV_EXPORTS CylindricalProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+/** @brief Warper that maps an image onto the x\*x + z\*z = 1 cylinder.
+ */
+class CV_EXPORTS CylindricalWarper : public RotationWarperBase<CylindricalProjector>
+{
+public:
+    /** @brief Construct an instance of the cylindrical warper class.
+
+    @param scale Projected image scale multiplier
+     */
+    CylindricalWarper(float scale) { projector_.scale = scale; }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst);
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
+    {
+        RotationWarperBase<CylindricalProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
+    }
+};
+
+
+struct CV_EXPORTS FisheyeProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS FisheyeWarper : public RotationWarperBase<FisheyeProjector>
+{
+public:
+    FisheyeWarper(float scale) { projector_.scale = scale; }
+};
+
+
+struct CV_EXPORTS StereographicProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS StereographicWarper : public RotationWarperBase<StereographicProjector>
+{
+public:
+    StereographicWarper(float scale) { projector_.scale = scale; }
+};
+
+
+struct CV_EXPORTS CompressedRectilinearProjector : ProjectorBase
+{
+    float a, b;
+
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase<CompressedRectilinearProjector>
+{
+public:
+    CompressedRectilinearWarper(float scale, float A = 1, float B = 1)
+    {
+        projector_.a = A;
+        projector_.b = B;
+        projector_.scale = scale;
+    }
+};
+
+
+struct CV_EXPORTS CompressedRectilinearPortraitProjector : ProjectorBase
+{
+    float a, b;
+
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS CompressedRectilinearPortraitWarper : public RotationWarperBase<CompressedRectilinearPortraitProjector>
+{
+public:
+   CompressedRectilinearPortraitWarper(float scale, float A = 1, float B = 1)
+   {
+       projector_.a = A;
+       projector_.b = B;
+       projector_.scale = scale;
+   }
+};
+
+
+struct CV_EXPORTS PaniniProjector : ProjectorBase
+{
+    float a, b;
+
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS PaniniWarper : public RotationWarperBase<PaniniProjector>
+{
+public:
+   PaniniWarper(float scale, float A = 1, float B = 1)
+   {
+       projector_.a = A;
+       projector_.b = B;
+       projector_.scale = scale;
+   }
+};
+
+
+struct CV_EXPORTS PaniniPortraitProjector : ProjectorBase
+{
+    float a, b;
+
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS PaniniPortraitWarper : public RotationWarperBase<PaniniPortraitProjector>
+{
+public:
+   PaniniPortraitWarper(float scale, float A = 1, float B = 1)
+   {
+       projector_.a = A;
+       projector_.b = B;
+       projector_.scale = scale;
+   }
+
+};
+
+
+struct CV_EXPORTS MercatorProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS MercatorWarper : public RotationWarperBase<MercatorProjector>
+{
+public:
+    MercatorWarper(float scale) { projector_.scale = scale; }
+};
+
+
+struct CV_EXPORTS TransverseMercatorProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS TransverseMercatorWarper : public RotationWarperBase<TransverseMercatorProjector>
+{
+public:
+    TransverseMercatorWarper(float scale) { projector_.scale = scale; }
+};
+
+
+class CV_EXPORTS PlaneWarperGpu : public PlaneWarper
+{
+public:
+    PlaneWarperGpu(float scale = 1.f) : PlaneWarper(scale) {}
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
+    {
+        Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
+        d_xmap_.download(xmap);
+        d_ymap_.download(ymap);
+        return result;
+    }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap)
+    {
+        Rect result = buildMaps(src_size, K, R, T, d_xmap_, d_ymap_);
+        d_xmap_.download(xmap);
+        d_ymap_.download(ymap);
+        return result;
+    }
+
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               OutputArray dst)
+    {
+        d_src_.upload(src);
+        Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
+        d_dst_.download(dst);
+        return result;
+    }
+
+    Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
+               OutputArray dst)
+    {
+        d_src_.upload(src);
+        Point result = warp(d_src_, K, R, T, interp_mode, border_mode, d_dst_);
+        d_dst_.download(dst);
+        return result;
+    }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
+
+    Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               cuda::GpuMat & dst);
+
+    Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
+               cuda::GpuMat & dst);
+
+private:
+    cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
+};
+
+
+class CV_EXPORTS SphericalWarperGpu : public SphericalWarper
+{
+public:
+    SphericalWarperGpu(float scale) : SphericalWarper(scale) {}
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
+    {
+        Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
+        d_xmap_.download(xmap);
+        d_ymap_.download(ymap);
+        return result;
+    }
+
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               OutputArray dst)
+    {
+        d_src_.upload(src);
+        Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
+        d_dst_.download(dst);
+        return result;
+    }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
+
+    Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               cuda::GpuMat & dst);
+
+private:
+    cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
+};
+
+
+class CV_EXPORTS CylindricalWarperGpu : public CylindricalWarper
+{
+public:
+    CylindricalWarperGpu(float scale) : CylindricalWarper(scale) {}
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
+    {
+        Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
+        d_xmap_.download(xmap);
+        d_ymap_.download(ymap);
+        return result;
+    }
+
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               OutputArray dst)
+    {
+        d_src_.upload(src);
+        Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
+        d_dst_.download(dst);
+        return result;
+    }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
+
+    Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               cuda::GpuMat & dst);
+
+private:
+    cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
+};
+
+
+struct SphericalPortraitProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+// Projects image onto unit sphere with origin at (0, 0, 0).
+// Poles are located NOT at (0, -1, 0) and (0, 1, 0) points, BUT at (1, 0, 0) and (-1, 0, 0) points.
+class CV_EXPORTS SphericalPortraitWarper : public RotationWarperBase<SphericalPortraitProjector>
+{
+public:
+    SphericalPortraitWarper(float scale) { projector_.scale = scale; }
+
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
+};
+
+struct CylindricalPortraitProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS CylindricalPortraitWarper : public RotationWarperBase<CylindricalPortraitProjector>
+{
+public:
+    CylindricalPortraitWarper(float scale) { projector_.scale = scale; }
+
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
+    {
+        RotationWarperBase<CylindricalPortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
+    }
+};
+
+struct PlanePortraitProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS PlanePortraitWarper : public RotationWarperBase<PlanePortraitProjector>
+{
+public:
+    PlanePortraitWarper(float scale) { projector_.scale = scale; }
+
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
+    {
+        RotationWarperBase<PlanePortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
+    }
+};
+
+//! @} stitching_warp
+
+} // namespace detail
+} // namespace cv
+
+#include "warpers_inl.hpp"
+
+#endif // __OPENCV_STITCHING_WARPERS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp
new file mode 100644
index 0000000..0416ecb
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp
@@ -0,0 +1,774 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_WARPERS_INL_HPP__
+#define __OPENCV_STITCHING_WARPERS_INL_HPP__
+
+#include "opencv2/core.hpp"
+#include "warpers.hpp" // Make your IDE see declarations
+#include <limits>
+
+//! @cond IGNORED
+
+namespace cv {
+namespace detail {
+
+template <class P>
+Point2f RotationWarperBase<P>::warpPoint(const Point2f &pt, InputArray K, InputArray R)
+{
+    projector_.setCameraParams(K, R);
+    Point2f uv;
+    projector_.mapForward(pt.x, pt.y, uv.x, uv.y);
+    return uv;
+}
+
+
+template <class P>
+Rect RotationWarperBase<P>::buildMaps(Size src_size, InputArray K, InputArray R, OutputArray _xmap, OutputArray _ymap)
+{
+    projector_.setCameraParams(K, R);
+
+    Point dst_tl, dst_br;
+    detectResultRoi(src_size, dst_tl, dst_br);
+
+    _xmap.create(dst_br.y - dst_tl.y + 1, dst_br.x - dst_tl.x + 1, CV_32F);
+    _ymap.create(dst_br.y - dst_tl.y + 1, dst_br.x - dst_tl.x + 1, CV_32F);
+
+    Mat xmap = _xmap.getMat(), ymap = _ymap.getMat();
+
+    float x, y;
+    for (int v = dst_tl.y; v <= dst_br.y; ++v)
+    {
+        for (int u = dst_tl.x; u <= dst_br.x; ++u)
+        {
+            projector_.mapBackward(static_cast<float>(u), static_cast<float>(v), x, y);
+            xmap.at<float>(v - dst_tl.y, u - dst_tl.x) = x;
+            ymap.at<float>(v - dst_tl.y, u - dst_tl.x) = y;
+        }
+    }
+
+    return Rect(dst_tl, dst_br);
+}
+
+
+template <class P>
+Point RotationWarperBase<P>::warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                                  OutputArray dst)
+{
+    UMat xmap, ymap;
+    Rect dst_roi = buildMaps(src.size(), K, R, xmap, ymap);
+
+    dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type());
+    remap(src, dst, xmap, ymap, interp_mode, border_mode);
+
+    return dst_roi.tl();
+}
+
+
+template <class P>
+void RotationWarperBase<P>::warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                                         Size dst_size, OutputArray dst)
+{
+    projector_.setCameraParams(K, R);
+
+    Point src_tl, src_br;
+    detectResultRoi(dst_size, src_tl, src_br);
+
+    Size size = src.size();
+    CV_Assert(src_br.x - src_tl.x + 1 == size.width && src_br.y - src_tl.y + 1 == size.height);
+
+    Mat xmap(dst_size, CV_32F);
+    Mat ymap(dst_size, CV_32F);
+
+    float u, v;
+    for (int y = 0; y < dst_size.height; ++y)
+    {
+        for (int x = 0; x < dst_size.width; ++x)
+        {
+            projector_.mapForward(static_cast<float>(x), static_cast<float>(y), u, v);
+            xmap.at<float>(y, x) = u - src_tl.x;
+            ymap.at<float>(y, x) = v - src_tl.y;
+        }
+    }
+
+    dst.create(dst_size, src.type());
+    remap(src, dst, xmap, ymap, interp_mode, border_mode);
+}
+
+
+template <class P>
+Rect RotationWarperBase<P>::warpRoi(Size src_size, InputArray K, InputArray R)
+{
+    projector_.setCameraParams(K, R);
+
+    Point dst_tl, dst_br;
+    detectResultRoi(src_size, dst_tl, dst_br);
+
+    return Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1));
+}
+
+
+template <class P>
+void RotationWarperBase<P>::detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
+{
+    float tl_uf = std::numeric_limits<float>::max();
+    float tl_vf = std::numeric_limits<float>::max();
+    float br_uf = -std::numeric_limits<float>::max();
+    float br_vf = -std::numeric_limits<float>::max();
+
+    float u, v;
+    for (int y = 0; y < src_size.height; ++y)
+    {
+        for (int x = 0; x < src_size.width; ++x)
+        {
+            projector_.mapForward(static_cast<float>(x), static_cast<float>(y), u, v);
+            tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+            br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+        }
+    }
+
+    dst_tl.x = static_cast<int>(tl_uf);
+    dst_tl.y = static_cast<int>(tl_vf);
+    dst_br.x = static_cast<int>(br_uf);
+    dst_br.y = static_cast<int>(br_vf);
+}
+
+
+template <class P>
+void RotationWarperBase<P>::detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br)
+{
+    float tl_uf = std::numeric_limits<float>::max();
+    float tl_vf = std::numeric_limits<float>::max();
+    float br_uf = -std::numeric_limits<float>::max();
+    float br_vf = -std::numeric_limits<float>::max();
+
+    float u, v;
+    for (float x = 0; x < src_size.width; ++x)
+    {
+        projector_.mapForward(static_cast<float>(x), 0, u, v);
+        tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+        br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+
+        projector_.mapForward(static_cast<float>(x), static_cast<float>(src_size.height - 1), u, v);
+        tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+        br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+    }
+    for (int y = 0; y < src_size.height; ++y)
+    {
+        projector_.mapForward(0, static_cast<float>(y), u, v);
+        tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+        br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+
+        projector_.mapForward(static_cast<float>(src_size.width - 1), static_cast<float>(y), u, v);
+        tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+        br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+    }
+
+    dst_tl.x = static_cast<int>(tl_uf);
+    dst_tl.y = static_cast<int>(tl_vf);
+    dst_br.x = static_cast<int>(br_uf);
+    dst_br.y = static_cast<int>(br_vf);
+}
+
+
+inline
+void PlaneProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    x_ = t[0] + x_ / z_ * (1 - t[2]);
+    y_ = t[1] + y_ / z_ * (1 - t[2]);
+
+    u = scale * x_;
+    v = scale * y_;
+}
+
+
+inline
+void PlaneProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u = u / scale - t[0];
+    v = v / scale - t[1];
+
+    float z;
+    x = k_rinv[0] * u + k_rinv[1] * v + k_rinv[2] * (1 - t[2]);
+    y = k_rinv[3] * u + k_rinv[4] * v + k_rinv[5] * (1 - t[2]);
+    z = k_rinv[6] * u + k_rinv[7] * v + k_rinv[8] * (1 - t[2]);
+
+    x /= z;
+    y /= z;
+}
+
+
+inline
+void SphericalProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    u = scale * atan2f(x_, z_);
+    float w = y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_);
+    v = scale * (static_cast<float>(CV_PI) - acosf(w == w ? w : 0));
+}
+
+
+inline
+void SphericalProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float sinv = sinf(static_cast<float>(CV_PI) - v);
+    float x_ = sinv * sinf(u);
+    float y_ = cosf(static_cast<float>(CV_PI) - v);
+    float z_ = sinv * cosf(u);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+
+inline
+void CylindricalProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    u = scale * atan2f(x_, z_);
+    v = scale * y_ / sqrtf(x_ * x_ + z_ * z_);
+}
+
+
+inline
+void CylindricalProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float x_ = sinf(u);
+    float y_ = v;
+    float z_ = cosf(u);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void FisheyeProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = (float)CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    u = scale * v_ * cosf(u_);
+    v = scale * v_ * sinf(u_);
+}
+
+inline
+void FisheyeProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float u_ = atan2f(v, u);
+    float v_ = sqrtf(u*u + v*v);
+
+    float sinv = sinf((float)CV_PI - v_);
+    float x_ = sinv * sinf(u_);
+    float y_ = cosf((float)CV_PI - v_);
+    float z_ = sinv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void StereographicProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = (float)CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    float r = sinf(v_) / (1 - cosf(v_));
+
+    u = scale * r * cos(u_);
+    v = scale * r * sin(u_);
+}
+
+inline
+void StereographicProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float u_ = atan2f(v, u);
+    float r = sqrtf(u*u + v*v);
+    float v_ = 2 * atanf(1.f / r);
+
+    float sinv = sinf((float)CV_PI - v_);
+    float x_ = sinv * sinf(u_);
+    float y_ = cosf((float)CV_PI - v_);
+    float z_ = sinv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void CompressedRectilinearProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    u = scale * a * tanf(u_ / a);
+    v = scale * b * tanf(v_) / cosf(u_);
+}
+
+inline
+void CompressedRectilinearProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float aatg = a * atanf(u / a);
+    float u_ = aatg;
+    float v_ = atanf(v * cosf(aatg) / b);
+
+    float cosv = cosf(v_);
+    float x_ = cosv * sinf(u_);
+    float y_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void CompressedRectilinearPortraitProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float y_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float x_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    u = - scale * a * tanf(u_ / a);
+    v = scale * b * tanf(v_) / cosf(u_);
+}
+
+inline
+void CompressedRectilinearPortraitProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= - scale;
+    v /= scale;
+
+    float aatg = a * atanf(u / a);
+    float u_ = aatg;
+    float v_ = atanf(v * cosf( aatg ) / b);
+
+    float cosv = cosf(v_);
+    float y_ = cosv * sinf(u_);
+    float x_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void PaniniProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    float tg = a * tanf(u_ / a);
+    u = scale * tg;
+
+    float sinu = sinf(u_);
+    if ( fabs(sinu) < 1E-7 )
+        v = scale * b * tanf(v_);
+    else
+        v = scale * b * tg * tanf(v_) / sinu;
+}
+
+inline
+void PaniniProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float lamda = a * atanf(u / a);
+    float u_ = lamda;
+
+    float v_;
+    if ( fabs(lamda) > 1E-7)
+        v_ = atanf(v * sinf(lamda) / (b * a * tanf(lamda / a)));
+    else
+        v_ = atanf(v / b);
+
+    float cosv = cosf(v_);
+    float x_ = cosv * sinf(u_);
+    float y_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void PaniniPortraitProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float y_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float x_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    float tg = a * tanf(u_ / a);
+    u = - scale * tg;
+
+    float sinu = sinf( u_ );
+    if ( fabs(sinu) < 1E-7 )
+        v = scale * b * tanf(v_);
+    else
+        v = scale * b * tg * tanf(v_) / sinu;
+}
+
+inline
+void PaniniPortraitProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= - scale;
+    v /= scale;
+
+    float lamda = a * atanf(u / a);
+    float u_ = lamda;
+
+    float v_;
+    if ( fabs(lamda) > 1E-7)
+        v_ = atanf(v * sinf(lamda) / (b * a * tanf(lamda/a)));
+    else
+        v_ = atanf(v / b);
+
+    float cosv = cosf(v_);
+    float y_ = cosv * sinf(u_);
+    float x_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void MercatorProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    u = scale * u_;
+    v = scale * logf( tanf( (float)(CV_PI/4) + v_/2 ) );
+}
+
+inline
+void MercatorProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float v_ = atanf( sinhf(v) );
+    float u_ = u;
+
+    float cosv = cosf(v_);
+    float x_ = cosv * sinf(u_);
+    float y_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void TransverseMercatorProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    float B = cosf(v_) * sinf(u_);
+
+    u = scale / 2 * logf( (1+B) / (1-B) );
+    v = scale * atan2f(tanf(v_), cosf(u_));
+}
+
+inline
+void TransverseMercatorProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float v_ = asinf( sinf(v) / coshf(u) );
+    float u_ = atan2f( sinhf(u), cos(v) );
+
+    float cosv = cosf(v_);
+    float x_ = cosv * sinf(u_);
+    float y_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void SphericalPortraitProjector::mapForward(float x, float y, float &u0, float &v0)
+{
+    float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float x_ = y0_;
+    float y_ = x0_;
+    float u, v;
+
+    u = scale * atan2f(x_, z_);
+    v = scale * (static_cast<float>(CV_PI) - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)));
+
+    u0 = -u;//v;
+    v0 = v;//u;
+}
+
+
+inline
+void SphericalPortraitProjector::mapBackward(float u0, float v0, float &x, float &y)
+{
+    float u, v;
+    u = -u0;//v0;
+    v = v0;//u0;
+
+    u /= scale;
+    v /= scale;
+
+    float sinv = sinf(static_cast<float>(CV_PI) - v);
+    float x0_ = sinv * sinf(u);
+    float y0_ = cosf(static_cast<float>(CV_PI) - v);
+    float z_ = sinv * cosf(u);
+
+    float x_ = y0_;
+    float y_ = x0_;
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void CylindricalPortraitProjector::mapForward(float x, float y, float &u0, float &v0)
+{
+    float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_  = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float x_ = y0_;
+    float y_ = x0_;
+    float u, v;
+
+    u = scale * atan2f(x_, z_);
+    v = scale * y_ / sqrtf(x_ * x_ + z_ * z_);
+
+    u0 = -u;//v;
+    v0 = v;//u;
+}
+
+
+inline
+void CylindricalPortraitProjector::mapBackward(float u0, float v0, float &x, float &y)
+{
+    float u, v;
+    u = -u0;//v0;
+    v = v0;//u0;
+
+    u /= scale;
+    v /= scale;
+
+    float x0_ = sinf(u);
+    float y0_ = v;
+    float z_  = cosf(u);
+
+    float x_ = y0_;
+    float y_ = x0_;
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void PlanePortraitProjector::mapForward(float x, float y, float &u0, float &v0)
+{
+    float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_  = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float x_ = y0_;
+    float y_ = x0_;
+
+    x_ = t[0] + x_ / z_ * (1 - t[2]);
+    y_ = t[1] + y_ / z_ * (1 - t[2]);
+
+    float u,v;
+    u = scale * x_;
+    v = scale * y_;
+
+    u0 = -u;
+    v0 = v;
+}
+
+
+inline
+void PlanePortraitProjector::mapBackward(float u0, float v0, float &x, float &y)
+{
+    float u, v;
+    u = -u0;
+    v = v0;
+
+    u = u / scale - t[0];
+    v = v / scale - t[1];
+
+    float z;
+    x = k_rinv[0] * v + k_rinv[1] * u + k_rinv[2] * (1 - t[2]);
+    y = k_rinv[3] * v + k_rinv[4] * u + k_rinv[5] * (1 - t[2]);
+    z = k_rinv[6] * v + k_rinv[7] * u + k_rinv[8] * (1 - t[2]);
+
+    x /= z;
+    y /= z;
+}
+
+
+} // namespace detail
+} // namespace cv
+
+//! @endcond
+
+#endif // __OPENCV_STITCHING_WARPERS_INL_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp
new file mode 100644
index 0000000..7e570d3
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp
@@ -0,0 +1,183 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_WARPER_CREATORS_HPP__
+#define __OPENCV_STITCHING_WARPER_CREATORS_HPP__
+
+#include "opencv2/stitching/detail/warpers.hpp"
+
+namespace cv {
+
+//! @addtogroup stitching_warp
+//! @{
+
+/** @brief Image warper factories base class.
+ */
+class WarperCreator
+{
+public:
+    virtual ~WarperCreator() {}
+    virtual Ptr<detail::RotationWarper> create(float scale) const = 0;
+};
+
+/** @brief Plane warper factory class.
+  @sa detail::PlaneWarper
+ */
+class PlaneWarper : public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PlaneWarper>(scale); }
+};
+
+/** @brief Cylindrical warper factory class.
+@sa detail::CylindricalWarper
+*/
+class CylindricalWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarper>(scale); }
+};
+
+/** @brief Spherical warper factory class */
+class SphericalWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarper>(scale); }
+};
+
+class FisheyeWarper : public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::FisheyeWarper>(scale); }
+};
+
+class StereographicWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::StereographicWarper>(scale); }
+};
+
+class CompressedRectilinearWarper: public WarperCreator
+{
+    float a, b;
+public:
+    CompressedRectilinearWarper(float A = 1, float B = 1)
+    {
+        a = A; b = B;
+    }
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CompressedRectilinearWarper>(scale, a, b); }
+};
+
+class CompressedRectilinearPortraitWarper: public WarperCreator
+{
+    float a, b;
+public:
+    CompressedRectilinearPortraitWarper(float A = 1, float B = 1)
+    {
+        a = A; b = B;
+    }
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CompressedRectilinearPortraitWarper>(scale, a, b); }
+};
+
+class PaniniWarper: public WarperCreator
+{
+    float a, b;
+public:
+    PaniniWarper(float A = 1, float B = 1)
+    {
+        a = A; b = B;
+    }
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PaniniWarper>(scale, a, b); }
+};
+
+class PaniniPortraitWarper: public WarperCreator
+{
+    float a, b;
+public:
+    PaniniPortraitWarper(float A = 1, float B = 1)
+    {
+        a = A; b = B;
+    }
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PaniniPortraitWarper>(scale, a, b); }
+};
+
+class MercatorWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::MercatorWarper>(scale); }
+};
+
+class TransverseMercatorWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::TransverseMercatorWarper>(scale); }
+};
+
+
+
+#ifdef HAVE_OPENCV_CUDAWARPING
+class PlaneWarperGpu: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PlaneWarperGpu>(scale); }
+};
+
+
+class CylindricalWarperGpu: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarperGpu>(scale); }
+};
+
+
+class SphericalWarperGpu: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarperGpu>(scale); }
+};
+#endif
+
+//! @} stitching_warp
+
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_WARPER_CREATORS_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/superres.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/superres.hpp
new file mode 100644
index 0000000..dec8e4e
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/superres.hpp
@@ -0,0 +1,207 @@
+/*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*/
+
+#ifndef __OPENCV_SUPERRES_HPP__
+#define __OPENCV_SUPERRES_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/superres/optical_flow.hpp"
+
+/**
+  @defgroup superres Super Resolution
+
+The Super Resolution module contains a set of functions and classes that can be used to solve the
+problem of resolution enhancement. There are a few methods implemented, most of them are descibed in
+the papers @cite Farsiu03 and @cite Mitzel09 .
+
+ */
+
+namespace cv
+{
+    namespace superres
+    {
+
+//! @addtogroup superres
+//! @{
+
+        class CV_EXPORTS FrameSource
+        {
+        public:
+            virtual ~FrameSource();
+
+            virtual void nextFrame(OutputArray frame) = 0;
+            virtual void reset() = 0;
+        };
+
+        CV_EXPORTS Ptr<FrameSource> createFrameSource_Empty();
+
+        CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const String& fileName);
+        CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_CUDA(const String& fileName);
+
+        CV_EXPORTS Ptr<FrameSource> createFrameSource_Camera(int deviceId = 0);
+
+        /** @brief Base class for Super Resolution algorithms.
+
+        The class is only used to define the common interface for the whole family of Super Resolution
+        algorithms.
+         */
+        class CV_EXPORTS SuperResolution : public cv::Algorithm, public FrameSource
+        {
+        public:
+            /** @brief Set input frame source for Super Resolution algorithm.
+
+            @param frameSource Input frame source
+             */
+            void setInput(const Ptr<FrameSource>& frameSource);
+
+            /** @brief Process next frame from input and return output result.
+
+            @param frame Output result
+             */
+            void nextFrame(OutputArray frame);
+            void reset();
+
+            /** @brief Clear all inner buffers.
+            */
+            virtual void collectGarbage();
+
+            //! @brief Scale factor
+            /** @see setScale */
+            virtual int getScale() const = 0;
+            /** @copybrief getScale @see getScale */
+            virtual void setScale(int val) = 0;
+
+            //! @brief Iterations count
+            /** @see setIterations */
+            virtual int getIterations() const = 0;
+            /** @copybrief getIterations @see getIterations */
+            virtual void setIterations(int val) = 0;
+
+            //! @brief Asymptotic value of steepest descent method
+            /** @see setTau */
+            virtual double getTau() const = 0;
+            /** @copybrief getTau @see getTau */
+            virtual void setTau(double val) = 0;
+
+            //! @brief Weight parameter to balance data term and smoothness term
+            /** @see setLabmda */
+            virtual double getLabmda() const = 0;
+            /** @copybrief getLabmda @see getLabmda */
+            virtual void setLabmda(double val) = 0;
+
+            //! @brief Parameter of spacial distribution in Bilateral-TV
+            /** @see setAlpha */
+            virtual double getAlpha() const = 0;
+            /** @copybrief getAlpha @see getAlpha */
+            virtual void setAlpha(double val) = 0;
+
+            //! @brief Kernel size of Bilateral-TV filter
+            /** @see setKernelSize */
+            virtual int getKernelSize() const = 0;
+            /** @copybrief getKernelSize @see getKernelSize */
+            virtual void setKernelSize(int val) = 0;
+
+            //! @brief Gaussian blur kernel size
+            /** @see setBlurKernelSize */
+            virtual int getBlurKernelSize() const = 0;
+            /** @copybrief getBlurKernelSize @see getBlurKernelSize */
+            virtual void setBlurKernelSize(int val) = 0;
+
+            //! @brief Gaussian blur sigma
+            /** @see setBlurSigma */
+            virtual double getBlurSigma() const = 0;
+            /** @copybrief getBlurSigma @see getBlurSigma */
+            virtual void setBlurSigma(double val) = 0;
+
+            //! @brief Radius of the temporal search area
+            /** @see setTemporalAreaRadius */
+            virtual int getTemporalAreaRadius() const = 0;
+            /** @copybrief getTemporalAreaRadius @see getTemporalAreaRadius */
+            virtual void setTemporalAreaRadius(int val) = 0;
+
+            //! @brief Dense optical flow algorithm
+            /** @see setOpticalFlow */
+            virtual Ptr<cv::superres::DenseOpticalFlowExt> getOpticalFlow() const = 0;
+            /** @copybrief getOpticalFlow @see getOpticalFlow */
+            virtual void setOpticalFlow(const Ptr<cv::superres::DenseOpticalFlowExt> &val) = 0;
+
+        protected:
+            SuperResolution();
+
+            virtual void initImpl(Ptr<FrameSource>& frameSource) = 0;
+            virtual void processImpl(Ptr<FrameSource>& frameSource, OutputArray output) = 0;
+
+            bool isUmat_;
+
+        private:
+            Ptr<FrameSource> frameSource_;
+            bool firstCall_;
+        };
+
+        /** @brief Create Bilateral TV-L1 Super Resolution.
+
+        This class implements Super Resolution algorithm described in the papers @cite Farsiu03 and
+        @cite Mitzel09 .
+
+        Here are important members of the class that control the algorithm, which you can set after
+        constructing the class instance:
+
+        -   **int scale** Scale factor.
+        -   **int iterations** Iteration count.
+        -   **double tau** Asymptotic value of steepest descent method.
+        -   **double lambda** Weight parameter to balance data term and smoothness term.
+        -   **double alpha** Parameter of spacial distribution in Bilateral-TV.
+        -   **int btvKernelSize** Kernel size of Bilateral-TV filter.
+        -   **int blurKernelSize** Gaussian blur kernel size.
+        -   **double blurSigma** Gaussian blur sigma.
+        -   **int temporalAreaRadius** Radius of the temporal search area.
+        -   **Ptr\<DenseOpticalFlowExt\> opticalFlow** Dense optical flow algorithm.
+         */
+        CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1();
+        CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1_CUDA();
+
+//! @} superres
+
+    }
+}
+
+#endif // __OPENCV_SUPERRES_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp
new file mode 100644
index 0000000..d2f29a3
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp
@@ -0,0 +1,203 @@
+/*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*/
+
+#ifndef __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
+#define __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+    namespace superres
+    {
+
+//! @addtogroup superres
+//! @{
+
+        class CV_EXPORTS DenseOpticalFlowExt : public cv::Algorithm
+        {
+        public:
+            virtual void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2 = noArray()) = 0;
+            virtual void collectGarbage() = 0;
+        };
+
+
+        class CV_EXPORTS FarnebackOpticalFlow : public virtual DenseOpticalFlowExt
+        {
+        public:
+            /** @see setPyrScale */
+            virtual double getPyrScale() const = 0;
+            /** @copybrief getPyrScale @see getPyrScale */
+            virtual void setPyrScale(double val) = 0;
+            /** @see setLevelsNumber */
+            virtual int getLevelsNumber() const = 0;
+            /** @copybrief getLevelsNumber @see getLevelsNumber */
+            virtual void setLevelsNumber(int val) = 0;
+            /** @see setWindowSize */
+            virtual int getWindowSize() const = 0;
+            /** @copybrief getWindowSize @see getWindowSize */
+            virtual void setWindowSize(int val) = 0;
+            /** @see setIterations */
+            virtual int getIterations() const = 0;
+            /** @copybrief getIterations @see getIterations */
+            virtual void setIterations(int val) = 0;
+            /** @see setPolyN */
+            virtual int getPolyN() const = 0;
+            /** @copybrief getPolyN @see getPolyN */
+            virtual void setPolyN(int val) = 0;
+            /** @see setPolySigma */
+            virtual double getPolySigma() const = 0;
+            /** @copybrief getPolySigma @see getPolySigma */
+            virtual void setPolySigma(double val) = 0;
+            /** @see setFlags */
+            virtual int getFlags() const = 0;
+            /** @copybrief getFlags @see getFlags */
+            virtual void setFlags(int val) = 0;
+        };
+        CV_EXPORTS Ptr<FarnebackOpticalFlow> createOptFlow_Farneback();
+        CV_EXPORTS Ptr<FarnebackOpticalFlow> createOptFlow_Farneback_CUDA();
+
+
+//        CV_EXPORTS Ptr<DenseOpticalFlowExt> createOptFlow_Simple();
+
+
+        class CV_EXPORTS DualTVL1OpticalFlow : public virtual DenseOpticalFlowExt
+        {
+        public:
+            /** @see setTau */
+            virtual double getTau() const = 0;
+            /** @copybrief getTau @see getTau */
+            virtual void setTau(double val) = 0;
+            /** @see setLambda */
+            virtual double getLambda() const = 0;
+            /** @copybrief getLambda @see getLambda */
+            virtual void setLambda(double val) = 0;
+            /** @see setTheta */
+            virtual double getTheta() const = 0;
+            /** @copybrief getTheta @see getTheta */
+            virtual void setTheta(double val) = 0;
+            /** @see setScalesNumber */
+            virtual int getScalesNumber() const = 0;
+            /** @copybrief getScalesNumber @see getScalesNumber */
+            virtual void setScalesNumber(int val) = 0;
+            /** @see setWarpingsNumber */
+            virtual int getWarpingsNumber() const = 0;
+            /** @copybrief getWarpingsNumber @see getWarpingsNumber */
+            virtual void setWarpingsNumber(int val) = 0;
+            /** @see setEpsilon */
+            virtual double getEpsilon() const = 0;
+            /** @copybrief getEpsilon @see getEpsilon */
+            virtual void setEpsilon(double val) = 0;
+            /** @see setIterations */
+            virtual int getIterations() const = 0;
+            /** @copybrief getIterations @see getIterations */
+            virtual void setIterations(int val) = 0;
+            /** @see setUseInitialFlow */
+            virtual bool getUseInitialFlow() const = 0;
+            /** @copybrief getUseInitialFlow @see getUseInitialFlow */
+            virtual void setUseInitialFlow(bool val) = 0;
+        };
+        CV_EXPORTS Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1();
+        CV_EXPORTS Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1_CUDA();
+
+
+        class CV_EXPORTS BroxOpticalFlow : public virtual DenseOpticalFlowExt
+        {
+        public:
+            //! @brief Flow smoothness
+            /** @see setAlpha */
+            virtual double getAlpha() const = 0;
+            /** @copybrief getAlpha @see getAlpha */
+            virtual void setAlpha(double val) = 0;
+            //! @brief Gradient constancy importance
+            /** @see setGamma */
+            virtual double getGamma() const = 0;
+            /** @copybrief getGamma @see getGamma */
+            virtual void setGamma(double val) = 0;
+            //! @brief Pyramid scale factor
+            /** @see setScaleFactor */
+            virtual double getScaleFactor() const = 0;
+            /** @copybrief getScaleFactor @see getScaleFactor */
+            virtual void setScaleFactor(double val) = 0;
+            //! @brief Number of lagged non-linearity iterations (inner loop)
+            /** @see setInnerIterations */
+            virtual int getInnerIterations() const = 0;
+            /** @copybrief getInnerIterations @see getInnerIterations */
+            virtual void setInnerIterations(int val) = 0;
+            //! @brief Number of warping iterations (number of pyramid levels)
+            /** @see setOuterIterations */
+            virtual int getOuterIterations() const = 0;
+            /** @copybrief getOuterIterations @see getOuterIterations */
+            virtual void setOuterIterations(int val) = 0;
+            //! @brief Number of linear system solver iterations
+            /** @see setSolverIterations */
+            virtual int getSolverIterations() const = 0;
+            /** @copybrief getSolverIterations @see getSolverIterations */
+            virtual void setSolverIterations(int val) = 0;
+        };
+        CV_EXPORTS Ptr<BroxOpticalFlow> createOptFlow_Brox_CUDA();
+
+
+        class PyrLKOpticalFlow : public virtual DenseOpticalFlowExt
+        {
+        public:
+            /** @see setWindowSize */
+            virtual int getWindowSize() const = 0;
+            /** @copybrief getWindowSize @see getWindowSize */
+            virtual void setWindowSize(int val) = 0;
+            /** @see setMaxLevel */
+            virtual int getMaxLevel() const = 0;
+            /** @copybrief getMaxLevel @see getMaxLevel */
+            virtual void setMaxLevel(int val) = 0;
+            /** @see setIterations */
+            virtual int getIterations() const = 0;
+            /** @copybrief getIterations @see getIterations */
+            virtual void setIterations(int val) = 0;
+        };
+        CV_EXPORTS Ptr<PyrLKOpticalFlow> createOptFlow_PyrLK_CUDA();
+
+//! @}
+
+    }
+}
+
+#endif // __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/video.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video.hpp
new file mode 100644
index 0000000..a593815
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video.hpp
@@ -0,0 +1,63 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_VIDEO_HPP__
+#define __OPENCV_VIDEO_HPP__
+
+/**
+  @defgroup video Video Analysis
+  @{
+    @defgroup video_motion Motion Analysis
+    @defgroup video_track Object Tracking
+    @defgroup video_c C API
+  @}
+*/
+
+#include "opencv2/video/tracking.hpp"
+#include "opencv2/video/background_segm.hpp"
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/video/tracking_c.h"
+#endif
+
+#endif //__OPENCV_VIDEO_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp
new file mode 100644
index 0000000..dbeccbd
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp
@@ -0,0 +1,306 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_BACKGROUND_SEGM_HPP__
+#define __OPENCV_BACKGROUND_SEGM_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+
+//! @addtogroup video_motion
+//! @{
+
+/** @brief Base class for background/foreground segmentation. :
+
+The class is only used to define the common interface for the whole family of background/foreground
+segmentation algorithms.
+ */
+class CV_EXPORTS_W BackgroundSubtractor : public Algorithm
+{
+public:
+    /** @brief Computes a foreground mask.
+
+    @param image Next video frame.
+    @param fgmask The output foreground mask as an 8-bit binary image.
+    @param learningRate The value between 0 and 1 that indicates how fast the background model is
+    learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
+    rate. 0 means that the background model is not updated at all, 1 means that the background model
+    is completely reinitialized from the last frame.
+     */
+    CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0;
+
+    /** @brief Computes a background image.
+
+    @param backgroundImage The output background image.
+
+    @note Sometimes the background image can be very blurry, as it contain the average background
+    statistics.
+     */
+    CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0;
+};
+
+
+/** @brief Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
+
+The class implements the Gaussian mixture model background subtraction described in @cite Zivkovic2004
+and @cite Zivkovic2006 .
+ */
+class CV_EXPORTS_W BackgroundSubtractorMOG2 : public BackgroundSubtractor
+{
+public:
+    /** @brief Returns the number of last frames that affect the background model
+    */
+    CV_WRAP virtual int getHistory() const = 0;
+    /** @brief Sets the number of last frames that affect the background model
+    */
+    CV_WRAP virtual void setHistory(int history) = 0;
+
+    /** @brief Returns the number of gaussian components in the background model
+    */
+    CV_WRAP virtual int getNMixtures() const = 0;
+    /** @brief Sets the number of gaussian components in the background model.
+
+    The model needs to be reinitalized to reserve memory.
+    */
+    CV_WRAP virtual void setNMixtures(int nmixtures) = 0;//needs reinitialization!
+
+    /** @brief Returns the "background ratio" parameter of the algorithm
+
+    If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's
+    considered background and added to the model as a center of a new component. It corresponds to TB
+    parameter in the paper.
+     */
+    CV_WRAP virtual double getBackgroundRatio() const = 0;
+    /** @brief Sets the "background ratio" parameter of the algorithm
+    */
+    CV_WRAP virtual void setBackgroundRatio(double ratio) = 0;
+
+    /** @brief Returns the variance threshold for the pixel-model match
+
+    The main threshold on the squared Mahalanobis distance to decide if the sample is well described by
+    the background model or not. Related to Cthr from the paper.
+     */
+    CV_WRAP virtual double getVarThreshold() const = 0;
+    /** @brief Sets the variance threshold for the pixel-model match
+    */
+    CV_WRAP virtual void setVarThreshold(double varThreshold) = 0;
+
+    /** @brief Returns the variance threshold for the pixel-model match used for new mixture component generation
+
+    Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the
+    existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it
+    is considered foreground or added as a new component. 3 sigma =\> Tg=3\*3=9 is default. A smaller Tg
+    value generates more components. A higher Tg value may result in a small number of components but
+    they can grow too large.
+     */
+    CV_WRAP virtual double getVarThresholdGen() const = 0;
+    /** @brief Sets the variance threshold for the pixel-model match used for new mixture component generation
+    */
+    CV_WRAP virtual void setVarThresholdGen(double varThresholdGen) = 0;
+
+    /** @brief Returns the initial variance of each gaussian component
+    */
+    CV_WRAP virtual double getVarInit() const = 0;
+    /** @brief Sets the initial variance of each gaussian component
+    */
+    CV_WRAP virtual void setVarInit(double varInit) = 0;
+
+    CV_WRAP virtual double getVarMin() const = 0;
+    CV_WRAP virtual void setVarMin(double varMin) = 0;
+
+    CV_WRAP virtual double getVarMax() const = 0;
+    CV_WRAP virtual void setVarMax(double varMax) = 0;
+
+    /** @brief Returns the complexity reduction threshold
+
+    This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05
+    is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the
+    standard Stauffer&Grimson algorithm.
+     */
+    CV_WRAP virtual double getComplexityReductionThreshold() const = 0;
+    /** @brief Sets the complexity reduction threshold
+    */
+    CV_WRAP virtual void setComplexityReductionThreshold(double ct) = 0;
+
+    /** @brief Returns the shadow detection flag
+
+    If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 for
+    details.
+     */
+    CV_WRAP virtual bool getDetectShadows() const = 0;
+    /** @brief Enables or disables shadow detection
+    */
+    CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0;
+
+    /** @brief Returns the shadow value
+
+    Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
+    in the mask always means background, 255 means foreground.
+     */
+    CV_WRAP virtual int getShadowValue() const = 0;
+    /** @brief Sets the shadow value
+    */
+    CV_WRAP virtual void setShadowValue(int value) = 0;
+
+    /** @brief Returns the shadow threshold
+
+    A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
+    the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
+    is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiarra,
+    *Detecting Moving Shadows...*, IEEE PAMI,2003.
+     */
+    CV_WRAP virtual double getShadowThreshold() const = 0;
+    /** @brief Sets the shadow threshold
+    */
+    CV_WRAP virtual void setShadowThreshold(double threshold) = 0;
+};
+
+/** @brief Creates MOG2 Background Subtractor
+
+@param history Length of the history.
+@param varThreshold Threshold on the squared Mahalanobis distance between the pixel and the model
+to decide whether a pixel is well described by the background model. This parameter does not
+affect the background update.
+@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
+speed a bit, so if you do not need this feature, set the parameter to false.
+ */
+CV_EXPORTS_W Ptr<BackgroundSubtractorMOG2>
+    createBackgroundSubtractorMOG2(int history=500, double varThreshold=16,
+                                   bool detectShadows=true);
+
+/** @brief K-nearest neigbours - based Background/Foreground Segmentation Algorithm.
+
+The class implements the K-nearest neigbours background subtraction described in @cite Zivkovic2006 .
+Very efficient if number of foreground pixels is low.
+ */
+class CV_EXPORTS_W BackgroundSubtractorKNN : public BackgroundSubtractor
+{
+public:
+    /** @brief Returns the number of last frames that affect the background model
+    */
+    CV_WRAP virtual int getHistory() const = 0;
+    /** @brief Sets the number of last frames that affect the background model
+    */
+    CV_WRAP virtual void setHistory(int history) = 0;
+
+    /** @brief Returns the number of data samples in the background model
+    */
+    CV_WRAP virtual int getNSamples() const = 0;
+    /** @brief Sets the number of data samples in the background model.
+
+    The model needs to be reinitalized to reserve memory.
+    */
+    CV_WRAP virtual void setNSamples(int _nN) = 0;//needs reinitialization!
+
+    /** @brief Returns the threshold on the squared distance between the pixel and the sample
+
+    The threshold on the squared distance between the pixel and the sample to decide whether a pixel is
+    close to a data sample.
+     */
+    CV_WRAP virtual double getDist2Threshold() const = 0;
+    /** @brief Sets the threshold on the squared distance
+    */
+    CV_WRAP virtual void setDist2Threshold(double _dist2Threshold) = 0;
+
+    /** @brief Returns the number of neighbours, the k in the kNN.
+
+    K is the number of samples that need to be within dist2Threshold in order to decide that that
+    pixel is matching the kNN background model.
+     */
+    CV_WRAP virtual int getkNNSamples() const = 0;
+    /** @brief Sets the k in the kNN. How many nearest neigbours need to match.
+    */
+    CV_WRAP virtual void setkNNSamples(int _nkNN) = 0;
+
+    /** @brief Returns the shadow detection flag
+
+    If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for
+    details.
+     */
+    CV_WRAP virtual bool getDetectShadows() const = 0;
+    /** @brief Enables or disables shadow detection
+    */
+    CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0;
+
+    /** @brief Returns the shadow value
+
+    Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
+    in the mask always means background, 255 means foreground.
+     */
+    CV_WRAP virtual int getShadowValue() const = 0;
+    /** @brief Sets the shadow value
+    */
+    CV_WRAP virtual void setShadowValue(int value) = 0;
+
+    /** @brief Returns the shadow threshold
+
+    A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
+    the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
+    is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiarra,
+    *Detecting Moving Shadows...*, IEEE PAMI,2003.
+     */
+    CV_WRAP virtual double getShadowThreshold() const = 0;
+    /** @brief Sets the shadow threshold
+     */
+    CV_WRAP virtual void setShadowThreshold(double threshold) = 0;
+};
+
+/** @brief Creates KNN Background Subtractor
+
+@param history Length of the history.
+@param dist2Threshold Threshold on the squared distance between the pixel and the sample to decide
+whether a pixel is close to that sample. This parameter does not affect the background update.
+@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
+speed a bit, so if you do not need this feature, set the parameter to false.
+ */
+CV_EXPORTS_W Ptr<BackgroundSubtractorKNN>
+    createBackgroundSubtractorKNN(int history=500, double dist2Threshold=400.0,
+                                   bool detectShadows=true);
+
+//! @} video_motion
+
+} // cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp
new file mode 100644
index 0000000..d6954fe
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp
@@ -0,0 +1,515 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_TRACKING_HPP__
+#define __OPENCV_TRACKING_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+
+//! @addtogroup video_track
+//! @{
+
+enum { OPTFLOW_USE_INITIAL_FLOW     = 4,
+       OPTFLOW_LK_GET_MIN_EIGENVALS = 8,
+       OPTFLOW_FARNEBACK_GAUSSIAN   = 256
+     };
+
+/** @brief Finds an object center, size, and orientation.
+
+@param probImage Back projection of the object histogram. See calcBackProject.
+@param window Initial search window.
+@param criteria Stop criteria for the underlying meanShift.
+returns
+(in old interfaces) Number of iterations CAMSHIFT took to converge
+The function implements the CAMSHIFT object tracking algorithm @cite Bradski98 . First, it finds an
+object center using meanShift and then adjusts the window size and finds the optimal rotation. The
+function returns the rotated rectangle structure that includes the object position, size, and
+orientation. The next position of the search window can be obtained with RotatedRect::boundingRect()
+
+See the OpenCV sample camshiftdemo.c that tracks colored objects.
+
+@note
+-   (Python) A sample explaining the camshift tracking algorithm can be found at
+    opencv_source_code/samples/python/camshift.py
+ */
+CV_EXPORTS_W RotatedRect CamShift( InputArray probImage, CV_IN_OUT Rect& window,
+                                   TermCriteria criteria );
+
+/** @brief Finds an object on a back projection image.
+
+@param probImage Back projection of the object histogram. See calcBackProject for details.
+@param window Initial search window.
+@param criteria Stop criteria for the iterative search algorithm.
+returns
+:   Number of iterations CAMSHIFT took to converge.
+The function implements the iterative object search algorithm. It takes the input back projection of
+an object and the initial position. The mass center in window of the back projection image is
+computed and the search window center shifts to the mass center. The procedure is repeated until the
+specified number of iterations criteria.maxCount is done or until the window center shifts by less
+than criteria.epsilon. The algorithm is used inside CamShift and, unlike CamShift , the search
+window size or orientation do not change during the search. You can simply pass the output of
+calcBackProject to this function. But better results can be obtained if you pre-filter the back
+projection and remove the noise. For example, you can do this by retrieving connected components
+with findContours , throwing away contours with small area ( contourArea ), and rendering the
+remaining contours with drawContours.
+
+@note
+-   A mean-shift tracking sample can be found at opencv_source_code/samples/cpp/camshiftdemo.cpp
+ */
+CV_EXPORTS_W int meanShift( InputArray probImage, CV_IN_OUT Rect& window, TermCriteria criteria );
+
+/** @brief Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.
+
+@param img 8-bit input image.
+@param pyramid output pyramid.
+@param winSize window size of optical flow algorithm. Must be not less than winSize argument of
+calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels.
+@param maxLevel 0-based maximal pyramid level number.
+@param withDerivatives set to precompute gradients for the every pyramid level. If pyramid is
+constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally.
+@param pyrBorder the border mode for pyramid layers.
+@param derivBorder the border mode for gradients.
+@param tryReuseInputImage put ROI of input image into the pyramid if possible. You can pass false
+to force data copying.
+@return number of levels in constructed pyramid. Can be less than maxLevel.
+ */
+CV_EXPORTS_W int buildOpticalFlowPyramid( InputArray img, OutputArrayOfArrays pyramid,
+                                          Size winSize, int maxLevel, bool withDerivatives = true,
+                                          int pyrBorder = BORDER_REFLECT_101,
+                                          int derivBorder = BORDER_CONSTANT,
+                                          bool tryReuseInputImage = true );
+
+/** @brief Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with
+pyramids.
+
+@param prevImg first 8-bit input image or pyramid constructed by buildOpticalFlowPyramid.
+@param nextImg second input image or pyramid of the same size and the same type as prevImg.
+@param prevPts vector of 2D points for which the flow needs to be found; point coordinates must be
+single-precision floating-point numbers.
+@param nextPts output vector of 2D points (with single-precision floating-point coordinates)
+containing the calculated new positions of input features in the second image; when
+OPTFLOW_USE_INITIAL_FLOW flag is passed, the vector must have the same size as in the input.
+@param status output status vector (of unsigned chars); each element of the vector is set to 1 if
+the flow for the corresponding features has been found, otherwise, it is set to 0.
+@param err output vector of errors; each element of the vector is set to an error for the
+corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't
+found then the error is not defined (use the status parameter to find such cases).
+@param winSize size of the search window at each pyramid level.
+@param maxLevel 0-based maximal pyramid level number; if set to 0, pyramids are not used (single
+level), if set to 1, two levels are used, and so on; if pyramids are passed to input then
+algorithm will use as many levels as pyramids have but no more than maxLevel.
+@param criteria parameter, specifying the termination criteria of the iterative search algorithm
+(after the specified maximum number of iterations criteria.maxCount or when the search window
+moves by less than criteria.epsilon.
+@param flags operation flags:
+ -   **OPTFLOW_USE_INITIAL_FLOW** uses initial estimations, stored in nextPts; if the flag is
+     not set, then prevPts is copied to nextPts and is considered the initial estimate.
+ -   **OPTFLOW_LK_GET_MIN_EIGENVALS** use minimum eigen values as an error measure (see
+     minEigThreshold description); if the flag is not set, then L1 distance between patches
+     around the original and a moved point, divided by number of pixels in a window, is used as a
+     error measure.
+@param minEigThreshold the algorithm calculates the minimum eigen value of a 2x2 normal matrix of
+optical flow equations (this matrix is called a spatial gradient matrix in @cite Bouguet00), divided
+by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding
+feature is filtered out and its flow is not processed, so it allows to remove bad points and get a
+performance boost.
+
+The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See
+@cite Bouguet00 . The function is parallelized with the TBB library.
+
+@note
+
+-   An example using the Lucas-Kanade optical flow algorithm can be found at
+    opencv_source_code/samples/cpp/lkdemo.cpp
+-   (Python) An example using the Lucas-Kanade optical flow algorithm can be found at
+    opencv_source_code/samples/python/lk_track.py
+-   (Python) An example using the Lucas-Kanade tracker for homography matching can be found at
+    opencv_source_code/samples/python/lk_homography.py
+ */
+CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg,
+                                        InputArray prevPts, InputOutputArray nextPts,
+                                        OutputArray status, OutputArray err,
+                                        Size winSize = Size(21,21), int maxLevel = 3,
+                                        TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01),
+                                        int flags = 0, double minEigThreshold = 1e-4 );
+
+/** @brief Computes a dense optical flow using the Gunnar Farneback's algorithm.
+
+@param prev first 8-bit single-channel input image.
+@param next second input image of the same size and the same type as prev.
+@param flow computed flow image that has the same size as prev and type CV_32FC2.
+@param pyr_scale parameter, specifying the image scale (\<1) to build pyramids for each image;
+pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous
+one.
+@param levels number of pyramid layers including the initial image; levels=1 means that no extra
+layers are created and only the original images are used.
+@param winsize averaging window size; larger values increase the algorithm robustness to image
+noise and give more chances for fast motion detection, but yield more blurred motion field.
+@param iterations number of iterations the algorithm does at each pyramid level.
+@param poly_n size of the pixel neighborhood used to find polynomial expansion in each pixel;
+larger values mean that the image will be approximated with smoother surfaces, yielding more
+robust algorithm and more blurred motion field, typically poly_n =5 or 7.
+@param poly_sigma standard deviation of the Gaussian that is used to smooth derivatives used as a
+basis for the polynomial expansion; for poly_n=5, you can set poly_sigma=1.1, for poly_n=7, a
+good value would be poly_sigma=1.5.
+@param flags operation flags that can be a combination of the following:
+ -   **OPTFLOW_USE_INITIAL_FLOW** uses the input flow as an initial flow approximation.
+ -   **OPTFLOW_FARNEBACK_GAUSSIAN** uses the Gaussian \f$\texttt{winsize}\times\texttt{winsize}\f$
+     filter instead of a box filter of the same size for optical flow estimation; usually, this
+     option gives z more accurate flow than with a box filter, at the cost of lower speed;
+     normally, winsize for a Gaussian window should be set to a larger value to achieve the same
+     level of robustness.
+
+The function finds an optical flow for each prev pixel using the @cite Farneback2003 algorithm so that
+
+\f[\texttt{prev} (y,x)  \sim \texttt{next} ( y + \texttt{flow} (y,x)[1],  x + \texttt{flow} (y,x)[0])\f]
+
+@note
+
+-   An example using the optical flow algorithm described by Gunnar Farneback can be found at
+    opencv_source_code/samples/cpp/fback.cpp
+-   (Python) An example using the optical flow algorithm described by Gunnar Farneback can be
+    found at opencv_source_code/samples/python/opt_flow.py
+ */
+CV_EXPORTS_W void calcOpticalFlowFarneback( InputArray prev, InputArray next, InputOutputArray flow,
+                                            double pyr_scale, int levels, int winsize,
+                                            int iterations, int poly_n, double poly_sigma,
+                                            int flags );
+
+/** @brief Computes an optimal affine transformation between two 2D point sets.
+
+@param src First input 2D point set stored in std::vector or Mat, or an image stored in Mat.
+@param dst Second input 2D point set of the same size and the same type as A, or another image.
+@param fullAffine If true, the function finds an optimal affine transformation with no additional
+restrictions (6 degrees of freedom). Otherwise, the class of transformations to choose from is
+limited to combinations of translation, rotation, and uniform scaling (5 degrees of freedom).
+
+The function finds an optimal affine transform *[A|b]* (a 2 x 3 floating-point matrix) that
+approximates best the affine transformation between:
+
+*   Two point sets
+*   Two raster images. In this case, the function first finds some features in the src image and
+    finds the corresponding features in dst image. After that, the problem is reduced to the first
+    case.
+In case of point sets, the problem is formulated as follows: you need to find a 2x2 matrix *A* and
+2x1 vector *b* so that:
+
+\f[[A^*|b^*] = arg  \min _{[A|b]}  \sum _i  \| \texttt{dst}[i] - A { \texttt{src}[i]}^T - b  \| ^2\f]
+where src[i] and dst[i] are the i-th points in src and dst, respectively
+\f$[A|b]\f$ can be either arbitrary (when fullAffine=true ) or have a form of
+\f[\begin{bmatrix} a_{11} & a_{12} & b_1  \\ -a_{12} & a_{11} & b_2  \end{bmatrix}\f]
+when fullAffine=false.
+
+@sa
+getAffineTransform, getPerspectiveTransform, findHomography
+ */
+CV_EXPORTS_W Mat estimateRigidTransform( InputArray src, InputArray dst, bool fullAffine );
+
+
+enum
+{
+    MOTION_TRANSLATION = 0,
+    MOTION_EUCLIDEAN   = 1,
+    MOTION_AFFINE      = 2,
+    MOTION_HOMOGRAPHY  = 3
+};
+
+/** @brief Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .
+
+@param templateImage single-channel template image; CV_8U or CV_32F array.
+@param inputImage single-channel input image which should be warped with the final warpMatrix in
+order to provide an image similar to templateImage, same type as temlateImage.
+@param warpMatrix floating-point \f$2\times 3\f$ or \f$3\times 3\f$ mapping matrix (warp).
+@param motionType parameter, specifying the type of motion:
+ -   **MOTION_TRANSLATION** sets a translational motion model; warpMatrix is \f$2\times 3\f$ with
+     the first \f$2\times 2\f$ part being the unity matrix and the rest two parameters being
+     estimated.
+ -   **MOTION_EUCLIDEAN** sets a Euclidean (rigid) transformation as motion model; three
+     parameters are estimated; warpMatrix is \f$2\times 3\f$.
+ -   **MOTION_AFFINE** sets an affine motion model (DEFAULT); six parameters are estimated;
+     warpMatrix is \f$2\times 3\f$.
+ -   **MOTION_HOMOGRAPHY** sets a homography as a motion model; eight parameters are
+     estimated;\`warpMatrix\` is \f$3\times 3\f$.
+@param criteria parameter, specifying the termination criteria of the ECC algorithm;
+criteria.epsilon defines the threshold of the increment in the correlation coefficient between two
+iterations (a negative criteria.epsilon makes criteria.maxcount the only termination criterion).
+Default values are shown in the declaration above.
+@param inputMask An optional mask to indicate valid values of inputImage.
+
+The function estimates the optimum transformation (warpMatrix) with respect to ECC criterion
+(@cite EP08), that is
+
+\f[\texttt{warpMatrix} = \texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\f]
+
+where
+
+\f[\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\f]
+
+(the equation holds with homogeneous coordinates for homography). It returns the final enhanced
+correlation coefficient, that is the correlation coefficient between the template image and the
+final warped input image. When a \f$3\times 3\f$ matrix is given with motionType =0, 1 or 2, the third
+row is ignored.
+
+Unlike findHomography and estimateRigidTransform, the function findTransformECC implements an
+area-based alignment that builds on intensity similarities. In essence, the function updates the
+initial transformation that roughly aligns the images. If this information is missing, the identity
+warp (unity matrix) should be given as input. Note that if images undergo strong
+displacements/rotations, an initial transformation that roughly aligns the images is necessary
+(e.g., a simple euclidean/similarity transform that allows for the images showing the same image
+content approximately). Use inverse warping in the second image to take an image close to the first
+one, i.e. use the flag WARP_INVERSE_MAP with warpAffine or warpPerspective. See also the OpenCV
+sample image_alignment.cpp that demonstrates the use of the function. Note that the function throws
+an exception if algorithm does not converges.
+
+@sa
+estimateRigidTransform, findHomography
+ */
+CV_EXPORTS_W double findTransformECC( InputArray templateImage, InputArray inputImage,
+                                      InputOutputArray warpMatrix, int motionType = MOTION_AFFINE,
+                                      TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 50, 0.001),
+                                      InputArray inputMask = noArray());
+
+/** @brief Kalman filter class.
+
+The class implements a standard Kalman filter <http://en.wikipedia.org/wiki/Kalman_filter>,
+@cite Welch95 . However, you can modify transitionMatrix, controlMatrix, and measurementMatrix to get
+an extended Kalman filter functionality. See the OpenCV sample kalman.cpp.
+
+@note
+
+-   An example using the standard Kalman filter can be found at
+    opencv_source_code/samples/cpp/kalman.cpp
+ */
+class CV_EXPORTS_W KalmanFilter
+{
+public:
+    /** @brief The constructors.
+
+    @note In C API when CvKalman\* kalmanFilter structure is not needed anymore, it should be released
+    with cvReleaseKalman(&kalmanFilter)
+     */
+    CV_WRAP KalmanFilter();
+    /** @overload
+    @param dynamParams Dimensionality of the state.
+    @param measureParams Dimensionality of the measurement.
+    @param controlParams Dimensionality of the control vector.
+    @param type Type of the created matrices that should be CV_32F or CV_64F.
+    */
+    CV_WRAP KalmanFilter( int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F );
+
+    /** @brief Re-initializes Kalman filter. The previous content is destroyed.
+
+    @param dynamParams Dimensionality of the state.
+    @param measureParams Dimensionality of the measurement.
+    @param controlParams Dimensionality of the control vector.
+    @param type Type of the created matrices that should be CV_32F or CV_64F.
+     */
+    void init( int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F );
+
+    /** @brief Computes a predicted state.
+
+    @param control The optional input control
+     */
+    CV_WRAP const Mat& predict( const Mat& control = Mat() );
+
+    /** @brief Updates the predicted state from the measurement.
+
+    @param measurement The measured system parameters
+     */
+    CV_WRAP const Mat& correct( const Mat& measurement );
+
+    CV_PROP_RW Mat statePre;           //!< predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
+    CV_PROP_RW Mat statePost;          //!< corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
+    CV_PROP_RW Mat transitionMatrix;   //!< state transition matrix (A)
+    CV_PROP_RW Mat controlMatrix;      //!< control matrix (B) (not used if there is no control)
+    CV_PROP_RW Mat measurementMatrix;  //!< measurement matrix (H)
+    CV_PROP_RW Mat processNoiseCov;    //!< process noise covariance matrix (Q)
+    CV_PROP_RW Mat measurementNoiseCov;//!< measurement noise covariance matrix (R)
+    CV_PROP_RW Mat errorCovPre;        //!< priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
+    CV_PROP_RW Mat gain;               //!< Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
+    CV_PROP_RW Mat errorCovPost;       //!< posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)
+
+    // temporary matrices
+    Mat temp1;
+    Mat temp2;
+    Mat temp3;
+    Mat temp4;
+    Mat temp5;
+};
+
+
+class CV_EXPORTS_W DenseOpticalFlow : public Algorithm
+{
+public:
+    /** @brief Calculates an optical flow.
+
+    @param I0 first 8-bit single-channel input image.
+    @param I1 second input image of the same size and the same type as prev.
+    @param flow computed flow image that has the same size as prev and type CV_32FC2.
+     */
+    CV_WRAP virtual void calc( InputArray I0, InputArray I1, InputOutputArray flow ) = 0;
+    /** @brief Releases all inner buffers.
+    */
+    CV_WRAP virtual void collectGarbage() = 0;
+};
+
+/** @brief "Dual TV L1" Optical Flow Algorithm.
+
+The class implements the "Dual TV L1" optical flow algorithm described in @cite Zach2007 and
+@cite Javier2012 .
+Here are important members of the class that control the algorithm, which you can set after
+constructing the class instance:
+
+-   member double tau
+    Time step of the numerical scheme.
+
+-   member double lambda
+    Weight parameter for the data term, attachment parameter. This is the most relevant
+    parameter, which determines the smoothness of the output. The smaller this parameter is,
+    the smoother the solutions we obtain. It depends on the range of motions of the images, so
+    its value should be adapted to each image sequence.
+
+-   member double theta
+    Weight parameter for (u - v)\^2, tightness parameter. It serves as a link between the
+    attachment and the regularization terms. In theory, it should have a small value in order
+    to maintain both parts in correspondence. The method is stable for a large range of values
+    of this parameter.
+
+-   member int nscales
+    Number of scales used to create the pyramid of images.
+
+-   member int warps
+    Number of warpings per scale. Represents the number of times that I1(x+u0) and grad(
+    I1(x+u0) ) are computed per scale. This is a parameter that assures the stability of the
+    method. It also affects the running time, so it is a compromise between speed and
+    accuracy.
+
+-   member double epsilon
+    Stopping criterion threshold used in the numerical scheme, which is a trade-off between
+    precision and running time. A small value will yield more accurate solutions at the
+    expense of a slower convergence.
+
+-   member int iterations
+    Stopping criterion iterations number used in the numerical scheme.
+
+C. Zach, T. Pock and H. Bischof, "A Duality Based Approach for Realtime TV-L1 Optical Flow".
+Javier Sanchez, Enric Meinhardt-Llopis and Gabriele Facciolo. "TV-L1 Optical Flow Estimation".
+*/
+class CV_EXPORTS_W DualTVL1OpticalFlow : public DenseOpticalFlow
+{
+public:
+    //! @brief Time step of the numerical scheme
+    /** @see setTau */
+    virtual double getTau() const = 0;
+    /** @copybrief getTau @see getTau */
+    virtual void setTau(double val) = 0;
+    //! @brief Weight parameter for the data term, attachment parameter
+    /** @see setLambda */
+    virtual double getLambda() const = 0;
+    /** @copybrief getLambda @see getLambda */
+    virtual void setLambda(double val) = 0;
+    //! @brief Weight parameter for (u - v)^2, tightness parameter
+    /** @see setTheta */
+    virtual double getTheta() const = 0;
+    /** @copybrief getTheta @see getTheta */
+    virtual void setTheta(double val) = 0;
+    //! @brief coefficient for additional illumination variation term
+    /** @see setGamma */
+    virtual double getGamma() const = 0;
+    /** @copybrief getGamma @see getGamma */
+    virtual void setGamma(double val) = 0;
+    //! @brief Number of scales used to create the pyramid of images
+    /** @see setScalesNumber */
+    virtual int getScalesNumber() const = 0;
+    /** @copybrief getScalesNumber @see getScalesNumber */
+    virtual void setScalesNumber(int val) = 0;
+    //! @brief Number of warpings per scale
+    /** @see setWarpingsNumber */
+    virtual int getWarpingsNumber() const = 0;
+    /** @copybrief getWarpingsNumber @see getWarpingsNumber */
+    virtual void setWarpingsNumber(int val) = 0;
+    //! @brief Stopping criterion threshold used in the numerical scheme, which is a trade-off between precision and running time
+    /** @see setEpsilon */
+    virtual double getEpsilon() const = 0;
+    /** @copybrief getEpsilon @see getEpsilon */
+    virtual void setEpsilon(double val) = 0;
+    //! @brief Inner iterations (between outlier filtering) used in the numerical scheme
+    /** @see setInnerIterations */
+    virtual int getInnerIterations() const = 0;
+    /** @copybrief getInnerIterations @see getInnerIterations */
+    virtual void setInnerIterations(int val) = 0;
+    //! @brief Outer iterations (number of inner loops) used in the numerical scheme
+    /** @see setOuterIterations */
+    virtual int getOuterIterations() const = 0;
+    /** @copybrief getOuterIterations @see getOuterIterations */
+    virtual void setOuterIterations(int val) = 0;
+    //! @brief Use initial flow
+    /** @see setUseInitialFlow */
+    virtual bool getUseInitialFlow() const = 0;
+    /** @copybrief getUseInitialFlow @see getUseInitialFlow */
+    virtual void setUseInitialFlow(bool val) = 0;
+    //! @brief Step between scales (<1)
+    /** @see setScaleStep */
+    virtual double getScaleStep() const = 0;
+    /** @copybrief getScaleStep @see getScaleStep */
+    virtual void setScaleStep(double val) = 0;
+    //! @brief Median filter kernel size (1 = no filter) (3 or 5)
+    /** @see setMedianFiltering */
+    virtual int getMedianFiltering() const = 0;
+    /** @copybrief getMedianFiltering @see getMedianFiltering */
+    virtual void setMedianFiltering(int val) = 0;
+};
+
+/** @brief Creates instance of cv::DenseOpticalFlow
+*/
+CV_EXPORTS_W Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1();
+
+//! @} video_track
+
+} // cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h
new file mode 100644
index 0000000..b355352
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h
@@ -0,0 +1,232 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_TRACKING_C_H__
+#define __OPENCV_TRACKING_C_H__
+
+#include "opencv2/imgproc/types_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup video_c
+  @{
+*/
+
+/****************************************************************************************\
+*                                  Motion Analysis                                       *
+\****************************************************************************************/
+
+/************************************ optical flow ***************************************/
+
+#define CV_LKFLOW_PYR_A_READY       1
+#define CV_LKFLOW_PYR_B_READY       2
+#define CV_LKFLOW_INITIAL_GUESSES   4
+#define CV_LKFLOW_GET_MIN_EIGENVALS 8
+
+/* It is Lucas & Kanade method, modified to use pyramids.
+   Also it does several iterations to get optical flow for
+   every point at every pyramid level.
+   Calculates optical flow between two images for certain set of points (i.e.
+   it is a "sparse" optical flow, which is opposite to the previous 3 methods) */
+CVAPI(void)  cvCalcOpticalFlowPyrLK( const CvArr*  prev, const CvArr*  curr,
+                                     CvArr*  prev_pyr, CvArr*  curr_pyr,
+                                     const CvPoint2D32f* prev_features,
+                                     CvPoint2D32f* curr_features,
+                                     int       count,
+                                     CvSize    win_size,
+                                     int       level,
+                                     char*     status,
+                                     float*    track_error,
+                                     CvTermCriteria criteria,
+                                     int       flags );
+
+
+/* Modification of a previous sparse optical flow algorithm to calculate
+   affine flow */
+CVAPI(void)  cvCalcAffineFlowPyrLK( const CvArr*  prev, const CvArr*  curr,
+                                    CvArr*  prev_pyr, CvArr*  curr_pyr,
+                                    const CvPoint2D32f* prev_features,
+                                    CvPoint2D32f* curr_features,
+                                    float* matrices, int  count,
+                                    CvSize win_size, int  level,
+                                    char* status, float* track_error,
+                                    CvTermCriteria criteria, int flags );
+
+/* Estimate rigid transformation between 2 images or 2 point sets */
+CVAPI(int)  cvEstimateRigidTransform( const CvArr* A, const CvArr* B,
+                                      CvMat* M, int full_affine );
+
+/* Estimate optical flow for each pixel using the two-frame G. Farneback algorithm */
+CVAPI(void) cvCalcOpticalFlowFarneback( const CvArr* prev, const CvArr* next,
+                                        CvArr* flow, double pyr_scale, int levels,
+                                        int winsize, int iterations, int poly_n,
+                                        double poly_sigma, int flags );
+
+/********************************* motion templates *************************************/
+
+/****************************************************************************************\
+*        All the motion template functions work only with single channel images.         *
+*        Silhouette image must have depth IPL_DEPTH_8U or IPL_DEPTH_8S                   *
+*        Motion history image must have depth IPL_DEPTH_32F,                             *
+*        Gradient mask - IPL_DEPTH_8U or IPL_DEPTH_8S,                                   *
+*        Motion orientation image - IPL_DEPTH_32F                                        *
+*        Segmentation mask - IPL_DEPTH_32F                                               *
+*        All the angles are in degrees, all the times are in milliseconds                *
+\****************************************************************************************/
+
+/* Updates motion history image given motion silhouette */
+CVAPI(void)    cvUpdateMotionHistory( const CvArr* silhouette, CvArr* mhi,
+                                      double timestamp, double duration );
+
+/* Calculates gradient of the motion history image and fills
+   a mask indicating where the gradient is valid */
+CVAPI(void)    cvCalcMotionGradient( const CvArr* mhi, CvArr* mask, CvArr* orientation,
+                                     double delta1, double delta2,
+                                     int aperture_size CV_DEFAULT(3));
+
+/* Calculates average motion direction within a selected motion region
+   (region can be selected by setting ROIs and/or by composing a valid gradient mask
+   with the region mask) */
+CVAPI(double)  cvCalcGlobalOrientation( const CvArr* orientation, const CvArr* mask,
+                                        const CvArr* mhi, double timestamp,
+                                        double duration );
+
+/* Splits a motion history image into a few parts corresponding to separate independent motions
+   (e.g. left hand, right hand) */
+CVAPI(CvSeq*)  cvSegmentMotion( const CvArr* mhi, CvArr* seg_mask,
+                                CvMemStorage* storage,
+                                double timestamp, double seg_thresh );
+
+/****************************************************************************************\
+*                                       Tracking                                         *
+\****************************************************************************************/
+
+/* Implements CAMSHIFT algorithm - determines object position, size and orientation
+   from the object histogram back project (extension of meanshift) */
+CVAPI(int)  cvCamShift( const CvArr* prob_image, CvRect  window,
+                        CvTermCriteria criteria, CvConnectedComp* comp,
+                        CvBox2D* box CV_DEFAULT(NULL) );
+
+/* Implements MeanShift algorithm - determines object position
+   from the object histogram back project */
+CVAPI(int)  cvMeanShift( const CvArr* prob_image, CvRect  window,
+                         CvTermCriteria criteria, CvConnectedComp* comp );
+
+/*
+standard Kalman filter (in G. Welch' and G. Bishop's notation):
+
+  x(k)=A*x(k-1)+B*u(k)+w(k)  p(w)~N(0,Q)
+  z(k)=H*x(k)+v(k),   p(v)~N(0,R)
+*/
+typedef struct CvKalman
+{
+    int MP;                     /* number of measurement vector dimensions */
+    int DP;                     /* number of state vector dimensions */
+    int CP;                     /* number of control vector dimensions */
+
+    /* backward compatibility fields */
+#if 1
+    float* PosterState;         /* =state_pre->data.fl */
+    float* PriorState;          /* =state_post->data.fl */
+    float* DynamMatr;           /* =transition_matrix->data.fl */
+    float* MeasurementMatr;     /* =measurement_matrix->data.fl */
+    float* MNCovariance;        /* =measurement_noise_cov->data.fl */
+    float* PNCovariance;        /* =process_noise_cov->data.fl */
+    float* KalmGainMatr;        /* =gain->data.fl */
+    float* PriorErrorCovariance;/* =error_cov_pre->data.fl */
+    float* PosterErrorCovariance;/* =error_cov_post->data.fl */
+    float* Temp1;               /* temp1->data.fl */
+    float* Temp2;               /* temp2->data.fl */
+#endif
+
+    CvMat* state_pre;           /* predicted state (x'(k)):
+                                    x(k)=A*x(k-1)+B*u(k) */
+    CvMat* state_post;          /* corrected state (x(k)):
+                                    x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) */
+    CvMat* transition_matrix;   /* state transition matrix (A) */
+    CvMat* control_matrix;      /* control matrix (B)
+                                   (it is not used if there is no control)*/
+    CvMat* measurement_matrix;  /* measurement matrix (H) */
+    CvMat* process_noise_cov;   /* process noise covariance matrix (Q) */
+    CvMat* measurement_noise_cov; /* measurement noise covariance matrix (R) */
+    CvMat* error_cov_pre;       /* priori error estimate covariance matrix (P'(k)):
+                                    P'(k)=A*P(k-1)*At + Q)*/
+    CvMat* gain;                /* Kalman gain matrix (K(k)):
+                                    K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)*/
+    CvMat* error_cov_post;      /* posteriori error estimate covariance matrix (P(k)):
+                                    P(k)=(I-K(k)*H)*P'(k) */
+    CvMat* temp1;               /* temporary matrices */
+    CvMat* temp2;
+    CvMat* temp3;
+    CvMat* temp4;
+    CvMat* temp5;
+} CvKalman;
+
+/* Creates Kalman filter and sets A, B, Q, R and state to some initial values */
+CVAPI(CvKalman*) cvCreateKalman( int dynam_params, int measure_params,
+                                 int control_params CV_DEFAULT(0));
+
+/* Releases Kalman filter state */
+CVAPI(void)  cvReleaseKalman( CvKalman** kalman);
+
+/* Updates Kalman filter by time (predicts future state of the system) */
+CVAPI(const CvMat*)  cvKalmanPredict( CvKalman* kalman,
+                                      const CvMat* control CV_DEFAULT(NULL));
+
+/* Updates Kalman filter by measurement
+   (corrects state of the system and internal matrices) */
+CVAPI(const CvMat*)  cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement );
+
+#define cvKalmanUpdateByTime  cvKalmanPredict
+#define cvKalmanUpdateByMeasurement cvKalmanCorrect
+
+/** @} video_c */
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+
+#endif // __OPENCV_TRACKING_C_H__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/video.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/video.hpp
new file mode 100644
index 0000000..8267b85
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/video/video.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/video.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio.hpp
new file mode 100644
index 0000000..ccd6c06
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio.hpp
@@ -0,0 +1,680 @@
+/*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*/
+
+#ifndef __OPENCV_VIDEOIO_HPP__
+#define __OPENCV_VIDEOIO_HPP__
+
+#include "opencv2/core.hpp"
+
+/**
+  @defgroup videoio Media I/O
+  @{
+    @defgroup videoio_c C API
+    @defgroup videoio_ios iOS glue
+    @defgroup videoio_winrt WinRT glue
+  @}
+*/
+
+////////////////////////////////// video io /////////////////////////////////
+
+typedef struct CvCapture CvCapture;
+typedef struct CvVideoWriter CvVideoWriter;
+
+namespace cv
+{
+
+//! @addtogroup videoio
+//! @{
+
+// Camera API
+enum { CAP_ANY          = 0,     // autodetect
+       CAP_VFW          = 200,   // platform native
+       CAP_V4L          = 200,
+       CAP_V4L2         = CAP_V4L,
+       CAP_FIREWARE     = 300,   // IEEE 1394 drivers
+       CAP_FIREWIRE     = CAP_FIREWARE,
+       CAP_IEEE1394     = CAP_FIREWARE,
+       CAP_DC1394       = CAP_FIREWARE,
+       CAP_CMU1394      = CAP_FIREWARE,
+       CAP_QT           = 500,   // QuickTime
+       CAP_UNICAP       = 600,   // Unicap drivers
+       CAP_DSHOW        = 700,   // DirectShow (via videoInput)
+       CAP_PVAPI        = 800,   // PvAPI, Prosilica GigE SDK
+       CAP_OPENNI       = 900,   // OpenNI (for Kinect)
+       CAP_OPENNI_ASUS  = 910,   // OpenNI (for Asus Xtion)
+       CAP_ANDROID      = 1000,  // Android - not used
+       CAP_XIAPI        = 1100,  // XIMEA Camera API
+       CAP_AVFOUNDATION = 1200,  // AVFoundation framework for iOS (OS X Lion will have the same API)
+       CAP_GIGANETIX    = 1300,  // Smartek Giganetix GigEVisionSDK
+       CAP_MSMF         = 1400,  // Microsoft Media Foundation (via videoInput)
+       CAP_WINRT        = 1410,  // Microsoft Windows Runtime using Media Foundation
+       CAP_INTELPERC    = 1500,  // Intel Perceptual Computing SDK
+       CAP_OPENNI2      = 1600,  // OpenNI2 (for Kinect)
+       CAP_OPENNI2_ASUS = 1610,  // OpenNI2 (for Asus Xtion and Occipital Structure sensors)
+       CAP_GPHOTO2      = 1700,  // gPhoto2 connection
+       CAP_GSTREAMER    = 1800,  // GStreamer
+       CAP_FFMPEG       = 1900,  // FFMPEG
+       CAP_IMAGES       = 2000   // OpenCV Image Sequence (e.g. img_%02d.jpg)
+     };
+
+// generic properties (based on DC1394 properties)
+enum { CAP_PROP_POS_MSEC       =0,
+       CAP_PROP_POS_FRAMES     =1,
+       CAP_PROP_POS_AVI_RATIO  =2,
+       CAP_PROP_FRAME_WIDTH    =3,
+       CAP_PROP_FRAME_HEIGHT   =4,
+       CAP_PROP_FPS            =5,
+       CAP_PROP_FOURCC         =6,
+       CAP_PROP_FRAME_COUNT    =7,
+       CAP_PROP_FORMAT         =8,
+       CAP_PROP_MODE           =9,
+       CAP_PROP_BRIGHTNESS    =10,
+       CAP_PROP_CONTRAST      =11,
+       CAP_PROP_SATURATION    =12,
+       CAP_PROP_HUE           =13,
+       CAP_PROP_GAIN          =14,
+       CAP_PROP_EXPOSURE      =15,
+       CAP_PROP_CONVERT_RGB   =16,
+       CAP_PROP_WHITE_BALANCE_BLUE_U =17,
+       CAP_PROP_RECTIFICATION =18,
+       CAP_PROP_MONOCHROME    =19,
+       CAP_PROP_SHARPNESS     =20,
+       CAP_PROP_AUTO_EXPOSURE =21, // DC1394: exposure control done by camera, user can adjust refernce level using this feature
+       CAP_PROP_GAMMA         =22,
+       CAP_PROP_TEMPERATURE   =23,
+       CAP_PROP_TRIGGER       =24,
+       CAP_PROP_TRIGGER_DELAY =25,
+       CAP_PROP_WHITE_BALANCE_RED_V =26,
+       CAP_PROP_ZOOM          =27,
+       CAP_PROP_FOCUS         =28,
+       CAP_PROP_GUID          =29,
+       CAP_PROP_ISO_SPEED     =30,
+       CAP_PROP_BACKLIGHT     =32,
+       CAP_PROP_PAN           =33,
+       CAP_PROP_TILT          =34,
+       CAP_PROP_ROLL          =35,
+       CAP_PROP_IRIS          =36,
+       CAP_PROP_SETTINGS      =37,
+       CAP_PROP_BUFFERSIZE    =38,
+       CAP_PROP_AUTOFOCUS     =39
+     };
+
+
+// Generic camera output modes.
+// Currently, these are supported through the libv4l interface only.
+enum { CAP_MODE_BGR  = 0, // BGR24 (default)
+       CAP_MODE_RGB  = 1, // RGB24
+       CAP_MODE_GRAY = 2, // Y8
+       CAP_MODE_YUYV = 3  // YUYV
+     };
+
+
+// DC1394 only
+// modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode)
+// every feature can have only one mode turned on at a time
+enum { CAP_PROP_DC1394_OFF                = -4, //turn the feature off (not controlled manually nor automatically)
+       CAP_PROP_DC1394_MODE_MANUAL        = -3, //set automatically when a value of the feature is set by the user
+       CAP_PROP_DC1394_MODE_AUTO          = -2,
+       CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
+       CAP_PROP_DC1394_MAX                = 31
+     };
+
+
+// OpenNI map generators
+enum { CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
+       CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
+       CAP_OPENNI_GENERATORS_MASK = CAP_OPENNI_DEPTH_GENERATOR + CAP_OPENNI_IMAGE_GENERATOR
+     };
+
+// Properties of cameras available through OpenNI interfaces
+enum { CAP_PROP_OPENNI_OUTPUT_MODE       = 100,
+       CAP_PROP_OPENNI_FRAME_MAX_DEPTH   = 101, // in mm
+       CAP_PROP_OPENNI_BASELINE          = 102, // in mm
+       CAP_PROP_OPENNI_FOCAL_LENGTH      = 103, // in pixels
+       CAP_PROP_OPENNI_REGISTRATION      = 104, // flag that synchronizes the remapping depth map to image map
+                                                // by changing depth generator's view point (if the flag is "on") or
+                                                // sets this view point to its normal one (if the flag is "off").
+       CAP_PROP_OPENNI_REGISTRATION_ON   = CAP_PROP_OPENNI_REGISTRATION,
+       CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
+       CAP_PROP_OPENNI_MAX_BUFFER_SIZE   = 106,
+       CAP_PROP_OPENNI_CIRCLE_BUFFER     = 107,
+       CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
+       CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
+       CAP_PROP_OPENNI2_SYNC             = 110,
+       CAP_PROP_OPENNI2_MIRROR           = 111
+     };
+
+// OpenNI shortcats
+enum { CAP_OPENNI_IMAGE_GENERATOR_PRESENT         = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
+       CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE     = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE,
+       CAP_OPENNI_DEPTH_GENERATOR_BASELINE        = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,
+       CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH    = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH,
+       CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION    = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION,
+       CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
+     };
+
+// OpenNI data given from depth generator
+enum { CAP_OPENNI_DEPTH_MAP         = 0, // Depth values in mm (CV_16UC1)
+       CAP_OPENNI_POINT_CLOUD_MAP   = 1, // XYZ in meters (CV_32FC3)
+       CAP_OPENNI_DISPARITY_MAP     = 2, // Disparity in pixels (CV_8UC1)
+       CAP_OPENNI_DISPARITY_MAP_32F = 3, // Disparity in pixels (CV_32FC1)
+       CAP_OPENNI_VALID_DEPTH_MASK  = 4, // CV_8UC1
+
+       // Data given from RGB image generator
+       CAP_OPENNI_BGR_IMAGE         = 5,
+       CAP_OPENNI_GRAY_IMAGE        = 6
+     };
+
+// Supported output modes of OpenNI image generator
+enum { CAP_OPENNI_VGA_30HZ  = 0,
+       CAP_OPENNI_SXGA_15HZ = 1,
+       CAP_OPENNI_SXGA_30HZ = 2,
+       CAP_OPENNI_QVGA_30HZ = 3,
+       CAP_OPENNI_QVGA_60HZ = 4
+     };
+
+
+// GStreamer
+enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 // default is 1
+     };
+
+
+// PVAPI
+enum { CAP_PROP_PVAPI_MULTICASTIP           = 300, // ip for anable multicast master mode. 0 for disable multicast
+       CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, // FrameStartTriggerMode: Determines how a frame is initiated
+       CAP_PROP_PVAPI_DECIMATIONHORIZONTAL  = 302, // Horizontal sub-sampling of the image
+       CAP_PROP_PVAPI_DECIMATIONVERTICAL    = 303, // Vertical sub-sampling of the image
+       CAP_PROP_PVAPI_BINNINGX              = 304, // Horizontal binning factor
+       CAP_PROP_PVAPI_BINNINGY              = 305, // Vertical binning factor
+       CAP_PROP_PVAPI_PIXELFORMAT           = 306  // Pixel format
+     };
+
+// PVAPI: FrameStartTriggerMode
+enum { CAP_PVAPI_FSTRIGMODE_FREERUN     = 0,    // Freerun
+       CAP_PVAPI_FSTRIGMODE_SYNCIN1     = 1,    // SyncIn1
+       CAP_PVAPI_FSTRIGMODE_SYNCIN2     = 2,    // SyncIn2
+       CAP_PVAPI_FSTRIGMODE_FIXEDRATE   = 3,    // FixedRate
+       CAP_PVAPI_FSTRIGMODE_SOFTWARE    = 4     // Software
+     };
+
+// PVAPI: DecimationHorizontal, DecimationVertical
+enum { CAP_PVAPI_DECIMATION_OFF       = 1,    // Off
+       CAP_PVAPI_DECIMATION_2OUTOF4   = 2,    // 2 out of 4 decimation
+       CAP_PVAPI_DECIMATION_2OUTOF8   = 4,    // 2 out of 8 decimation
+       CAP_PVAPI_DECIMATION_2OUTOF16  = 8     // 2 out of 16 decimation
+     };
+
+// PVAPI: PixelFormat
+enum { CAP_PVAPI_PIXELFORMAT_MONO8    = 1,    // Mono8
+       CAP_PVAPI_PIXELFORMAT_MONO16   = 2,    // Mono16
+       CAP_PVAPI_PIXELFORMAT_BAYER8   = 3,    // Bayer8
+       CAP_PVAPI_PIXELFORMAT_BAYER16  = 4,    // Bayer16
+       CAP_PVAPI_PIXELFORMAT_RGB24    = 5,    // Rgb24
+       CAP_PVAPI_PIXELFORMAT_BGR24    = 6,    // Bgr24
+       CAP_PVAPI_PIXELFORMAT_RGBA32   = 7,    // Rgba32
+       CAP_PVAPI_PIXELFORMAT_BGRA32   = 8,    // Bgra32
+     };
+
+// Properties of cameras available through XIMEA SDK interface
+enum { CAP_PROP_XI_DOWNSAMPLING  = 400, // Change image resolution by binning or skipping.
+       CAP_PROP_XI_DATA_FORMAT   = 401, // Output data format.
+       CAP_PROP_XI_OFFSET_X      = 402, // Horizontal offset from the origin to the area of interest (in pixels).
+       CAP_PROP_XI_OFFSET_Y      = 403, // Vertical offset from the origin to the area of interest (in pixels).
+       CAP_PROP_XI_TRG_SOURCE    = 404, // Defines source of trigger.
+       CAP_PROP_XI_TRG_SOFTWARE  = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.
+       CAP_PROP_XI_GPI_SELECTOR  = 406, // Selects general purpose input
+       CAP_PROP_XI_GPI_MODE      = 407, // Set general purpose input mode
+       CAP_PROP_XI_GPI_LEVEL     = 408, // Get general purpose level
+       CAP_PROP_XI_GPO_SELECTOR  = 409, // Selects general purpose output
+       CAP_PROP_XI_GPO_MODE      = 410, // Set general purpose output mode
+       CAP_PROP_XI_LED_SELECTOR  = 411, // Selects camera signalling LED
+       CAP_PROP_XI_LED_MODE      = 412, // Define camera signalling LED functionality
+       CAP_PROP_XI_MANUAL_WB     = 413, // Calculates White Balance(must be called during acquisition)
+       CAP_PROP_XI_AUTO_WB       = 414, // Automatic white balance
+       CAP_PROP_XI_AEAG          = 415, // Automatic exposure/gain
+       CAP_PROP_XI_EXP_PRIORITY  = 416, // Exposure priority (0.5 - exposure 50%, gain 50%).
+       CAP_PROP_XI_AE_MAX_LIMIT  = 417, // Maximum limit of exposure in AEAG procedure
+       CAP_PROP_XI_AG_MAX_LIMIT  = 418, // Maximum limit of gain in AEAG procedure
+       CAP_PROP_XI_AEAG_LEVEL    = 419, // Average intensity of output signal AEAG should achieve(in %)
+       CAP_PROP_XI_TIMEOUT       = 420  // Image capture timeout in milliseconds
+     };
+
+// Properties of cameras available through AVFOUNDATION interface
+enum { CAP_PROP_IOS_DEVICE_FOCUS        = 9001,
+       CAP_PROP_IOS_DEVICE_EXPOSURE     = 9002,
+       CAP_PROP_IOS_DEVICE_FLASH        = 9003,
+       CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
+       CAP_PROP_IOS_DEVICE_TORCH        = 9005
+     };
+
+
+// Properties of cameras available through Smartek Giganetix Ethernet Vision interface
+/* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */
+enum { CAP_PROP_GIGA_FRAME_OFFSET_X   = 10001,
+       CAP_PROP_GIGA_FRAME_OFFSET_Y   = 10002,
+       CAP_PROP_GIGA_FRAME_WIDTH_MAX  = 10003,
+       CAP_PROP_GIGA_FRAME_HEIGH_MAX  = 10004,
+       CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
+       CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006
+     };
+
+enum { CAP_PROP_INTELPERC_PROFILE_COUNT               = 11001,
+       CAP_PROP_INTELPERC_PROFILE_IDX                 = 11002,
+       CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE  = 11003,
+       CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE      = 11004,
+       CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD  = 11005,
+       CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ     = 11006,
+       CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT     = 11007
+     };
+
+// Intel PerC streams
+enum { CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,
+       CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,
+       CAP_INTELPERC_GENERATORS_MASK = CAP_INTELPERC_DEPTH_GENERATOR + CAP_INTELPERC_IMAGE_GENERATOR
+     };
+
+enum { CAP_INTELPERC_DEPTH_MAP              = 0, // Each pixel is a 16-bit integer. The value indicates the distance from an object to the camera's XY plane or the Cartesian depth.
+       CAP_INTELPERC_UVDEPTH_MAP            = 1, // Each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates.
+       CAP_INTELPERC_IR_MAP                 = 2, // Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam.
+       CAP_INTELPERC_IMAGE                  = 3
+     };
+
+enum { VIDEOWRITER_PROP_QUALITY = 1,    // Quality (0..100%) of the videostream encoded
+       VIDEOWRITER_PROP_FRAMEBYTES = 2, // (Read-only): Size of just encoded video frame
+       VIDEOWRITER_PROP_NSTRIPES = 3    // Number of stripes for parallel encoding. -1 for auto detection
+     };
+
+// gPhoto2 properties, if propertyId is less than 0 then work on widget with that __additive inversed__ camera setting ID
+// Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE.
+// @see CvCaptureCAM_GPHOTO2 for more info
+enum { CAP_PROP_GPHOTO2_PREVIEW           = 17001, // Capture only preview from liveview mode.
+       CAP_PROP_GPHOTO2_WIDGET_ENUMERATE  = 17002, // Readonly, returns (const char *).
+       CAP_PROP_GPHOTO2_RELOAD_CONFIG     = 17003, // Trigger, only by set. Reload camera settings.
+       CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE  = 17004, // Reload all settings on set.
+       CAP_PROP_GPHOTO2_COLLECT_MSGS      = 17005, // Collect messages with details.
+       CAP_PROP_GPHOTO2_FLUSH_MSGS        = 17006, // Readonly, returns (const char *).
+       CAP_PROP_SPEED                     = 17007, // Exposure speed. Can be readonly, depends on camera program.
+       CAP_PROP_APERTURE                  = 17008, // Aperture. Can be readonly, depends on camera program.
+       CAP_PROP_EXPOSUREPROGRAM           = 17009, // Camera exposure program.
+       CAP_PROP_VIEWFINDER                = 17010  // Enter liveview mode.
+     };
+
+//enum {
+
+class IVideoCapture;
+
+/** @brief Class for video capturing from video files, image sequences or cameras. The class provides C++ API
+for capturing video from cameras or for reading video files and image sequences. Here is how the
+class can be used: :
+@code
+    #include "opencv2/opencv.hpp"
+
+    using namespace cv;
+
+    int main(int, char**)
+    {
+        VideoCapture cap(0); // open the default camera
+        if(!cap.isOpened())  // check if we succeeded
+            return -1;
+
+        Mat edges;
+        namedWindow("edges",1);
+        for(;;)
+        {
+            Mat frame;
+            cap >> frame; // get a new frame from camera
+            cvtColor(frame, edges, COLOR_BGR2GRAY);
+            GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
+            Canny(edges, edges, 0, 30, 3);
+            imshow("edges", edges);
+            if(waitKey(30) >= 0) break;
+        }
+        // the camera will be deinitialized automatically in VideoCapture destructor
+        return 0;
+    }
+@endcode
+@note In C API the black-box structure CvCapture is used instead of VideoCapture.
+
+@note
+-   A basic sample on using the VideoCapture interface can be found at
+    opencv_source_code/samples/cpp/starter_video.cpp
+-   Another basic video processing sample can be found at
+    opencv_source_code/samples/cpp/video_dmtx.cpp
+-   (Python) A basic sample on using the VideoCapture interface can be found at
+    opencv_source_code/samples/python/video.py
+-   (Python) Another basic video processing sample can be found at
+    opencv_source_code/samples/python/video_dmtx.py
+-   (Python) A multi threaded video processing sample can be found at
+    opencv_source_code/samples/python/video_threaded.py
+ */
+class CV_EXPORTS_W VideoCapture
+{
+public:
+    /** @brief
+    @note In C API, when you finished working with video, release CvCapture structure with
+    cvReleaseCapture(), or use Ptr\<CvCapture\> that calls cvReleaseCapture() automatically in the
+    destructor.
+     */
+    CV_WRAP VideoCapture();
+
+    /** @overload
+    @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
+    img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
+    */
+    CV_WRAP VideoCapture(const String& filename);
+
+    /** @overload
+    @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
+    img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
+
+    @param apiPreference preferred Capture API to use. Can be used to enforce a specific reader
+    implementation if multiple are available: e.g. CAP_FFMPEG or CAP_IMAGES
+    */
+    CV_WRAP VideoCapture(const String& filename, int apiPreference);
+
+    /** @overload
+    @param index = camera_id + domain_offset (CAP_*). id of the video capturing device to open. If there is a single
+    camera connected, just pass 0. Advanced Usage: to open Camera 1 using the MS Media Foundation API: index = 1 + CAP_MSMF
+    */
+    CV_WRAP VideoCapture(int index);
+
+    virtual ~VideoCapture();
+
+    /** @brief Open video file or a capturing device for video capturing
+
+    @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
+    img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
+
+    The methods first call VideoCapture::release to close the already opened file or camera.
+     */
+    CV_WRAP virtual bool open(const String& filename);
+
+    /** @overload
+    @param index = camera_id + domain_offset (CAP_*). id of the video capturing device to open. If there is a single
+    camera connected, just pass 0. Advanced Usage: to open Camera 1 using the MS Media Foundation API: index = 1 + CAP_MSMF
+    */
+    CV_WRAP virtual bool open(int index);
+
+    /** @brief Returns true if video capturing has been initialized already.
+
+    If the previous call to VideoCapture constructor or VideoCapture::open succeeded, the method returns
+    true.
+     */
+    CV_WRAP virtual bool isOpened() const;
+
+    /** @brief Closes video file or capturing device.
+
+    The methods are automatically called by subsequent VideoCapture::open and by VideoCapture
+    destructor.
+
+    The C function also deallocates memory and clears \*capture pointer.
+     */
+    CV_WRAP virtual void release();
+
+    /** @brief Grabs the next frame from video file or capturing device.
+
+    The methods/functions grab the next frame from video file or camera and return true (non-zero) in
+    the case of success.
+
+    The primary use of the function is in multi-camera environments, especially when the cameras do not
+    have hardware synchronization. That is, you call VideoCapture::grab() for each camera and after that
+    call the slower method VideoCapture::retrieve() to decode and get frame from each camera. This way
+    the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames
+    from different cameras will be closer in time.
+
+    Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the
+    correct way of retrieving data from it is to call VideoCapture::grab first and then call
+    VideoCapture::retrieve one or more times with different values of the channel parameter. See
+    <https://github.com/Itseez/opencv/tree/master/samples/cpp/openni_capture.cpp>
+     */
+    CV_WRAP virtual bool grab();
+
+    /** @brief Decodes and returns the grabbed video frame.
+
+    The methods/functions decode and return the just grabbed frame. If no frames has been grabbed
+    (camera has been disconnected, or there are no more frames in video file), the methods return false
+    and the functions return NULL pointer.
+
+    @note OpenCV 1.x functions cvRetrieveFrame and cv.RetrieveFrame return image stored inside the video
+    capturing structure. It is not allowed to modify or release the image! You can copy the frame using
+    :ocvcvCloneImage and then do whatever you want with the copy.
+     */
+    CV_WRAP virtual bool retrieve(OutputArray image, int flag = 0);
+    virtual VideoCapture& operator >> (CV_OUT Mat& image);
+    virtual VideoCapture& operator >> (CV_OUT UMat& image);
+
+    /** @brief Grabs, decodes and returns the next video frame.
+
+    The methods/functions combine VideoCapture::grab and VideoCapture::retrieve in one call. This is the
+    most convenient method for reading video files or capturing data from decode and return the just
+    grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more
+    frames in video file), the methods return false and the functions return NULL pointer.
+
+    @note OpenCV 1.x functions cvRetrieveFrame and cv.RetrieveFrame return image stored inside the video
+    capturing structure. It is not allowed to modify or release the image! You can copy the frame using
+    :ocvcvCloneImage and then do whatever you want with the copy.
+     */
+    CV_WRAP virtual bool read(OutputArray image);
+
+    /** @brief Sets a property in the VideoCapture.
+
+    @param propId Property identifier. It can be one of the following:
+     -   **CAP_PROP_POS_MSEC** Current position of the video file in milliseconds.
+     -   **CAP_PROP_POS_FRAMES** 0-based index of the frame to be decoded/captured next.
+     -   **CAP_PROP_POS_AVI_RATIO** Relative position of the video file: 0 - start of the
+         film, 1 - end of the film.
+     -   **CAP_PROP_FRAME_WIDTH** Width of the frames in the video stream.
+     -   **CAP_PROP_FRAME_HEIGHT** Height of the frames in the video stream.
+     -   **CAP_PROP_FPS** Frame rate.
+     -   **CAP_PROP_FOURCC** 4-character code of codec.
+     -   **CAP_PROP_FRAME_COUNT** Number of frames in the video file.
+     -   **CAP_PROP_FORMAT** Format of the Mat objects returned by retrieve() .
+     -   **CAP_PROP_MODE** Backend-specific value indicating the current capture mode.
+     -   **CAP_PROP_BRIGHTNESS** Brightness of the image (only for cameras).
+     -   **CAP_PROP_CONTRAST** Contrast of the image (only for cameras).
+     -   **CAP_PROP_SATURATION** Saturation of the image (only for cameras).
+     -   **CAP_PROP_HUE** Hue of the image (only for cameras).
+     -   **CAP_PROP_GAIN** Gain of the image (only for cameras).
+     -   **CAP_PROP_EXPOSURE** Exposure (only for cameras).
+     -   **CAP_PROP_CONVERT_RGB** Boolean flags indicating whether images should be converted
+         to RGB.
+     -   **CAP_PROP_WHITE_BALANCE** Currently unsupported
+     -   **CAP_PROP_RECTIFICATION** Rectification flag for stereo cameras (note: only supported
+         by DC1394 v 2.x backend currently)
+    @param value Value of the property.
+     */
+    CV_WRAP virtual bool set(int propId, double value);
+
+    /** @brief Returns the specified VideoCapture property
+
+    @param propId Property identifier. It can be one of the following:
+     -   **CAP_PROP_POS_MSEC** Current position of the video file in milliseconds or video
+         capture timestamp.
+     -   **CAP_PROP_POS_FRAMES** 0-based index of the frame to be decoded/captured next.
+     -   **CAP_PROP_POS_AVI_RATIO** Relative position of the video file: 0 - start of the
+         film, 1 - end of the film.
+     -   **CAP_PROP_FRAME_WIDTH** Width of the frames in the video stream.
+     -   **CAP_PROP_FRAME_HEIGHT** Height of the frames in the video stream.
+     -   **CAP_PROP_FPS** Frame rate.
+     -   **CAP_PROP_FOURCC** 4-character code of codec.
+     -   **CAP_PROP_FRAME_COUNT** Number of frames in the video file.
+     -   **CAP_PROP_FORMAT** Format of the Mat objects returned by retrieve() .
+     -   **CAP_PROP_MODE** Backend-specific value indicating the current capture mode.
+     -   **CAP_PROP_BRIGHTNESS** Brightness of the image (only for cameras).
+     -   **CAP_PROP_CONTRAST** Contrast of the image (only for cameras).
+     -   **CAP_PROP_SATURATION** Saturation of the image (only for cameras).
+     -   **CAP_PROP_HUE** Hue of the image (only for cameras).
+     -   **CAP_PROP_GAIN** Gain of the image (only for cameras).
+     -   **CAP_PROP_EXPOSURE** Exposure (only for cameras).
+     -   **CAP_PROP_CONVERT_RGB** Boolean flags indicating whether images should be converted
+         to RGB.
+     -   **CAP_PROP_WHITE_BALANCE** Currently not supported
+     -   **CAP_PROP_RECTIFICATION** Rectification flag for stereo cameras (note: only supported
+         by DC1394 v 2.x backend currently)
+
+    @note When querying a property that is not supported by the backend used by the VideoCapture
+    class, value 0 is returned.
+     */
+    CV_WRAP virtual double get(int propId) const;
+
+    /** @overload
+
+    @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
+    img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
+
+    @param apiPreference preferred Capture API to use. Can be used to enforce a specific reader
+    implementation if multiple are available: e.g. CAP_FFMPEG or CAP_IMAGES
+
+    The methods first call VideoCapture::release to close the already opened file or camera.
+     */
+    CV_WRAP virtual bool open(const String& filename, int apiPreference);
+
+protected:
+    Ptr<CvCapture> cap;
+    Ptr<IVideoCapture> icap;
+};
+
+class IVideoWriter;
+
+/** @brief Video writer class.
+ */
+class CV_EXPORTS_W VideoWriter
+{
+public:
+    /** @brief VideoWriter constructors
+
+    The constructors/functions initialize video writers. On Linux FFMPEG is used to write videos; on
+    Windows FFMPEG or VFW is used; on MacOSX QTKit is used.
+     */
+    CV_WRAP VideoWriter();
+
+    /** @overload
+    @param filename Name of the output video file.
+    @param fourcc 4-character code of codec used to compress the frames. For example,
+    VideoWriter::fourcc('P','I','M','1') is a MPEG-1 codec, VideoWriter::fourcc('M','J','P','G') is a
+    motion-jpeg codec etc. List of codes can be obtained at [Video Codecs by
+    FOURCC](http://www.fourcc.org/codecs.php) page. FFMPEG backend with MP4 container natively uses
+    other values as fourcc code: see [ObjectType](http://www.mp4ra.org/codecs.html),
+    so you may receive a warning message from OpenCV about fourcc code conversion.
+    @param fps Framerate of the created video stream.
+    @param frameSize Size of the video frames.
+    @param isColor If it is not zero, the encoder will expect and encode color frames, otherwise it
+    will work with grayscale frames (the flag is currently supported on Windows only).
+    */
+    CV_WRAP VideoWriter(const String& filename, int fourcc, double fps,
+                Size frameSize, bool isColor = true);
+
+    virtual ~VideoWriter();
+
+    /** @brief Initializes or reinitializes video writer.
+
+    The method opens video writer. Parameters are the same as in the constructor
+    VideoWriter::VideoWriter.
+     */
+    CV_WRAP virtual bool open(const String& filename, int fourcc, double fps,
+                      Size frameSize, bool isColor = true);
+
+    /** @brief Returns true if video writer has been successfully initialized.
+    */
+    CV_WRAP virtual bool isOpened() const;
+
+    /** @brief Closes the video writer.
+
+    The methods are automatically called by subsequent VideoWriter::open and by the VideoWriter
+    destructor.
+     */
+    CV_WRAP virtual void release();
+    virtual VideoWriter& operator << (const Mat& image);
+
+    /** @brief Writes the next video frame
+
+    @param image The written frame
+
+    The functions/methods write the specified image to video file. It must have the same size as has
+    been specified when opening the video writer.
+     */
+    CV_WRAP virtual void write(const Mat& image);
+
+    /** @brief Sets a property in the VideoWriter.
+
+     @param propId Property identifier. It can be one of the following:
+     -   **VIDEOWRITER_PROP_QUALITY** Quality (0..100%) of the videostream encoded. Can be adjusted dynamically in some codecs.
+     -   **VIDEOWRITER_PROP_NSTRIPES** Number of stripes for parallel encoding
+     @param value Value of the property.
+     */
+    CV_WRAP virtual bool set(int propId, double value);
+
+    /** @brief Returns the specified VideoWriter property
+
+     @param propId Property identifier. It can be one of the following:
+     -   **VIDEOWRITER_PROP_QUALITY** Current quality of the encoded videostream.
+     -   **VIDEOWRITER_PROP_FRAMEBYTES** (Read-only) Size of just encoded video frame; note that the encoding order may be different from representation order.
+     -   **VIDEOWRITER_PROP_NSTRIPES** Number of stripes for parallel encoding
+
+     @note When querying a property that is not supported by the backend used by the VideoWriter
+     class, value 0 is returned.
+     */
+    CV_WRAP virtual double get(int propId) const;
+
+    /** @brief Concatenates 4 chars to a fourcc code
+
+    This static method constructs the fourcc code of the codec to be used in the constructor
+    VideoWriter::VideoWriter or VideoWriter::open.
+     */
+    CV_WRAP static int fourcc(char c1, char c2, char c3, char c4);
+
+protected:
+    Ptr<CvVideoWriter> writer;
+    Ptr<IVideoWriter> iwriter;
+
+    static Ptr<IVideoWriter> create(const String& filename, int fourcc, double fps,
+                                    Size frameSize, bool isColor = true);
+};
+
+template<> CV_EXPORTS void DefaultDeleter<CvCapture>::operator ()(CvCapture* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<CvVideoWriter>::operator ()(CvVideoWriter* obj) const;
+
+//! @} videoio
+
+} // cv
+
+#endif //__OPENCV_VIDEOIO_HPP__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h
new file mode 100644
index 0000000..1a9875b
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h
@@ -0,0 +1,176 @@
+/*  For iOS video I/O
+ *  by Eduard Feicho on 29/07/12
+ *  Copyright 2012. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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.
+ *
+ */
+
+#import <UIKit/UIKit.h>
+#import <Accelerate/Accelerate.h>
+#import <AVFoundation/AVFoundation.h>
+#import <ImageIO/ImageIO.h>
+#include "opencv2/core.hpp"
+
+//! @addtogroup videoio_ios
+//! @{
+
+/////////////////////////////////////// CvAbstractCamera /////////////////////////////////////
+
+@class CvAbstractCamera;
+
+@interface CvAbstractCamera : NSObject
+{
+    AVCaptureSession* captureSession;
+    AVCaptureConnection* videoCaptureConnection;
+    AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
+
+    UIDeviceOrientation currentDeviceOrientation;
+
+    BOOL cameraAvailable;
+    BOOL captureSessionLoaded;
+    BOOL running;
+    BOOL useAVCaptureVideoPreviewLayer;
+
+    AVCaptureDevicePosition defaultAVCaptureDevicePosition;
+    AVCaptureVideoOrientation defaultAVCaptureVideoOrientation;
+    NSString *const defaultAVCaptureSessionPreset;
+
+    int defaultFPS;
+
+    UIView* parentView;
+
+    int imageWidth;
+    int imageHeight;
+}
+
+@property (nonatomic, retain) AVCaptureSession* captureSession;
+@property (nonatomic, retain) AVCaptureConnection* videoCaptureConnection;
+
+@property (nonatomic, readonly) BOOL running;
+@property (nonatomic, readonly) BOOL captureSessionLoaded;
+
+@property (nonatomic, assign) int defaultFPS;
+@property (nonatomic, readonly) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
+@property (nonatomic, assign) AVCaptureDevicePosition defaultAVCaptureDevicePosition;
+@property (nonatomic, assign) AVCaptureVideoOrientation defaultAVCaptureVideoOrientation;
+@property (nonatomic, assign) BOOL useAVCaptureVideoPreviewLayer;
+@property (nonatomic, strong) NSString *const defaultAVCaptureSessionPreset;
+
+@property (nonatomic, assign) int imageWidth;
+@property (nonatomic, assign) int imageHeight;
+
+@property (nonatomic, retain) UIView* parentView;
+
+- (void)start;
+- (void)stop;
+- (void)switchCameras;
+
+- (id)initWithParentView:(UIView*)parent;
+
+- (void)createCaptureOutput;
+- (void)createVideoPreviewLayer;
+- (void)updateOrientation;
+
+- (void)lockFocus;
+- (void)unlockFocus;
+- (void)lockExposure;
+- (void)unlockExposure;
+- (void)lockBalance;
+- (void)unlockBalance;
+
+@end
+
+///////////////////////////////// CvVideoCamera ///////////////////////////////////////////
+
+@class CvVideoCamera;
+
+@protocol CvVideoCameraDelegate <NSObject>
+
+#ifdef __cplusplus
+// delegate method for processing image frames
+- (void)processImage:(cv::Mat&)image;
+#endif
+
+@end
+
+@interface CvVideoCamera : CvAbstractCamera<AVCaptureVideoDataOutputSampleBufferDelegate>
+{
+    AVCaptureVideoDataOutput *videoDataOutput;
+
+    dispatch_queue_t videoDataOutputQueue;
+    CALayer *customPreviewLayer;
+
+    BOOL grayscaleMode;
+
+    BOOL recordVideo;
+    BOOL rotateVideo;
+    AVAssetWriterInput* recordAssetWriterInput;
+    AVAssetWriterInputPixelBufferAdaptor* recordPixelBufferAdaptor;
+    AVAssetWriter* recordAssetWriter;
+
+    CMTime lastSampleTime;
+
+}
+
+@property (nonatomic, assign) id<CvVideoCameraDelegate> delegate;
+@property (nonatomic, assign) BOOL grayscaleMode;
+
+@property (nonatomic, assign) BOOL recordVideo;
+@property (nonatomic, assign) BOOL rotateVideo;
+@property (nonatomic, retain) AVAssetWriterInput* recordAssetWriterInput;
+@property (nonatomic, retain) AVAssetWriterInputPixelBufferAdaptor* recordPixelBufferAdaptor;
+@property (nonatomic, retain) AVAssetWriter* recordAssetWriter;
+
+- (void)adjustLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
+- (void)layoutPreviewLayer;
+- (void)saveVideo;
+- (NSURL *)videoFileURL;
+- (NSString *)videoFileString;
+
+
+@end
+
+///////////////////////////////// CvPhotoCamera ///////////////////////////////////////////
+
+@class CvPhotoCamera;
+
+@protocol CvPhotoCameraDelegate <NSObject>
+
+- (void)photoCamera:(CvPhotoCamera*)photoCamera capturedImage:(UIImage *)image;
+- (void)photoCameraCancel:(CvPhotoCamera*)photoCamera;
+
+@end
+
+@interface CvPhotoCamera : CvAbstractCamera
+{
+    AVCaptureStillImageOutput *stillImageOutput;
+}
+
+@property (nonatomic, assign) id<CvPhotoCameraDelegate> delegate;
+
+- (void)takePicture;
+
+@end
+
+//! @} videoio_ios
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp
new file mode 100644
index 0000000..ec84cf7
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/videoio.hpp"
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h
new file mode 100644
index 0000000..47f46fa
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h
@@ -0,0 +1,533 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_VIDEOIO_H__
+#define __OPENCV_VIDEOIO_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+  @addtogroup videoio_c
+  @{
+*/
+
+/****************************************************************************************\
+*                         Working with Video Files and Cameras                           *
+\****************************************************************************************/
+
+/* "black box" capture structure */
+typedef struct CvCapture CvCapture;
+
+/* start capturing frames from video file */
+CVAPI(CvCapture*) cvCreateFileCapture( const char* filename );
+
+/* start capturing frames from video file. allows specifying a preferred API to use */
+CVAPI(CvCapture*) cvCreateFileCaptureWithPreference( const char* filename , int apiPreference);
+
+enum
+{
+    CV_CAP_ANY      =0,     // autodetect
+
+    CV_CAP_MIL      =100,   // MIL proprietary drivers
+
+    CV_CAP_VFW      =200,   // platform native
+    CV_CAP_V4L      =200,
+    CV_CAP_V4L2     =200,
+
+    CV_CAP_FIREWARE =300,   // IEEE 1394 drivers
+    CV_CAP_FIREWIRE =300,
+    CV_CAP_IEEE1394 =300,
+    CV_CAP_DC1394   =300,
+    CV_CAP_CMU1394  =300,
+
+    CV_CAP_STEREO   =400,   // TYZX proprietary drivers
+    CV_CAP_TYZX     =400,
+    CV_TYZX_LEFT    =400,
+    CV_TYZX_RIGHT   =401,
+    CV_TYZX_COLOR   =402,
+    CV_TYZX_Z       =403,
+
+    CV_CAP_QT       =500,   // QuickTime
+
+    CV_CAP_UNICAP   =600,   // Unicap drivers
+
+    CV_CAP_DSHOW    =700,   // DirectShow (via videoInput)
+    CV_CAP_MSMF     =1400,  // Microsoft Media Foundation (via videoInput)
+
+    CV_CAP_PVAPI    =800,   // PvAPI, Prosilica GigE SDK
+
+    CV_CAP_OPENNI   =900,   // OpenNI (for Kinect)
+    CV_CAP_OPENNI_ASUS =910,   // OpenNI (for Asus Xtion)
+
+    CV_CAP_ANDROID  =1000,  // Android - not used
+    CV_CAP_ANDROID_BACK =CV_CAP_ANDROID+99, // Android back camera - not used
+    CV_CAP_ANDROID_FRONT =CV_CAP_ANDROID+98, // Android front camera - not used
+
+    CV_CAP_XIAPI    =1100,   // XIMEA Camera API
+
+    CV_CAP_AVFOUNDATION = 1200,  // AVFoundation framework for iOS (OS X Lion will have the same API)
+
+    CV_CAP_GIGANETIX = 1300,  // Smartek Giganetix GigEVisionSDK
+
+    CV_CAP_INTELPERC = 1500, // Intel Perceptual Computing
+
+    CV_CAP_OPENNI2 = 1600,   // OpenNI2 (for Kinect)
+    CV_CAP_GPHOTO2 = 1700,
+    CV_CAP_GSTREAMER = 1800, // GStreamer
+    CV_CAP_FFMPEG = 1900,    // FFMPEG
+    CV_CAP_IMAGES = 2000     // OpenCV Image Sequence (e.g. img_%02d.jpg)
+};
+
+/* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */
+CVAPI(CvCapture*) cvCreateCameraCapture( int index );
+
+/* grab a frame, return 1 on success, 0 on fail.
+  this function is thought to be fast               */
+CVAPI(int) cvGrabFrame( CvCapture* capture );
+
+/* get the frame grabbed with cvGrabFrame(..)
+  This function may apply some frame processing like
+  frame decompression, flipping etc.
+  !!!DO NOT RELEASE or MODIFY the retrieved frame!!! */
+CVAPI(IplImage*) cvRetrieveFrame( CvCapture* capture, int streamIdx CV_DEFAULT(0) );
+
+/* Just a combination of cvGrabFrame and cvRetrieveFrame
+   !!!DO NOT RELEASE or MODIFY the retrieved frame!!!      */
+CVAPI(IplImage*) cvQueryFrame( CvCapture* capture );
+
+/* stop capturing/reading and free resources */
+CVAPI(void) cvReleaseCapture( CvCapture** capture );
+
+enum
+{
+    // modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode)
+    // every feature can have only one mode turned on at a time
+    CV_CAP_PROP_DC1394_OFF         = -4,  //turn the feature off (not controlled manually nor automatically)
+    CV_CAP_PROP_DC1394_MODE_MANUAL = -3, //set automatically when a value of the feature is set by the user
+    CV_CAP_PROP_DC1394_MODE_AUTO = -2,
+    CV_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
+    CV_CAP_PROP_POS_MSEC       =0,
+    CV_CAP_PROP_POS_FRAMES     =1,
+    CV_CAP_PROP_POS_AVI_RATIO  =2,
+    CV_CAP_PROP_FRAME_WIDTH    =3,
+    CV_CAP_PROP_FRAME_HEIGHT   =4,
+    CV_CAP_PROP_FPS            =5,
+    CV_CAP_PROP_FOURCC         =6,
+    CV_CAP_PROP_FRAME_COUNT    =7,
+    CV_CAP_PROP_FORMAT         =8,
+    CV_CAP_PROP_MODE           =9,
+    CV_CAP_PROP_BRIGHTNESS    =10,
+    CV_CAP_PROP_CONTRAST      =11,
+    CV_CAP_PROP_SATURATION    =12,
+    CV_CAP_PROP_HUE           =13,
+    CV_CAP_PROP_GAIN          =14,
+    CV_CAP_PROP_EXPOSURE      =15,
+    CV_CAP_PROP_CONVERT_RGB   =16,
+    CV_CAP_PROP_WHITE_BALANCE_BLUE_U =17,
+    CV_CAP_PROP_RECTIFICATION =18,
+    CV_CAP_PROP_MONOCHROME    =19,
+    CV_CAP_PROP_SHARPNESS     =20,
+    CV_CAP_PROP_AUTO_EXPOSURE =21, // exposure control done by camera,
+                                   // user can adjust refernce level
+                                   // using this feature
+    CV_CAP_PROP_GAMMA         =22,
+    CV_CAP_PROP_TEMPERATURE   =23,
+    CV_CAP_PROP_TRIGGER       =24,
+    CV_CAP_PROP_TRIGGER_DELAY =25,
+    CV_CAP_PROP_WHITE_BALANCE_RED_V =26,
+    CV_CAP_PROP_ZOOM          =27,
+    CV_CAP_PROP_FOCUS         =28,
+    CV_CAP_PROP_GUID          =29,
+    CV_CAP_PROP_ISO_SPEED     =30,
+    CV_CAP_PROP_MAX_DC1394    =31,
+    CV_CAP_PROP_BACKLIGHT     =32,
+    CV_CAP_PROP_PAN           =33,
+    CV_CAP_PROP_TILT          =34,
+    CV_CAP_PROP_ROLL          =35,
+    CV_CAP_PROP_IRIS          =36,
+    CV_CAP_PROP_SETTINGS      =37,
+    CV_CAP_PROP_BUFFERSIZE    =38,
+    CV_CAP_PROP_AUTOFOCUS     =39,
+    CV_CAP_PROP_SAR_NUM       =40,
+    CV_CAP_PROP_SAR_DEN       =41,
+
+    CV_CAP_PROP_AUTOGRAB      =1024, // property for videoio class CvCapture_Android only
+    CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING=1025, // readonly, tricky property, returns cpnst char* indeed
+    CV_CAP_PROP_PREVIEW_FORMAT=1026, // readonly, tricky property, returns cpnst char* indeed
+
+    // OpenNI map generators
+    CV_CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
+    CV_CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
+    CV_CAP_OPENNI_GENERATORS_MASK = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_OPENNI_IMAGE_GENERATOR,
+
+    // Properties of cameras available through OpenNI interfaces
+    CV_CAP_PROP_OPENNI_OUTPUT_MODE     = 100,
+    CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, // in mm
+    CV_CAP_PROP_OPENNI_BASELINE        = 102, // in mm
+    CV_CAP_PROP_OPENNI_FOCAL_LENGTH    = 103, // in pixels
+    CV_CAP_PROP_OPENNI_REGISTRATION    = 104, // flag
+    CV_CAP_PROP_OPENNI_REGISTRATION_ON = CV_CAP_PROP_OPENNI_REGISTRATION, // flag that synchronizes the remapping depth map to image map
+                                                                          // by changing depth generator's view point (if the flag is "on") or
+                                                                          // sets this view point to its normal one (if the flag is "off").
+    CV_CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
+    CV_CAP_PROP_OPENNI_MAX_BUFFER_SIZE   = 106,
+    CV_CAP_PROP_OPENNI_CIRCLE_BUFFER     = 107,
+    CV_CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
+
+    CV_CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
+    CV_CAP_PROP_OPENNI2_SYNC = 110,
+    CV_CAP_PROP_OPENNI2_MIRROR = 111,
+
+    CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT         = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT,
+    CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE     = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE,
+    CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE        = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE,
+    CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH    = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH,
+    CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION    = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION,
+    CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION,
+
+    // Properties of cameras available through GStreamer interface
+    CV_CAP_GSTREAMER_QUEUE_LENGTH           = 200, // default is 1
+
+    // PVAPI
+    CV_CAP_PROP_PVAPI_MULTICASTIP           = 300, // ip for anable multicast master mode. 0 for disable multicast
+    CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, // FrameStartTriggerMode: Determines how a frame is initiated
+    CV_CAP_PROP_PVAPI_DECIMATIONHORIZONTAL  = 302, // Horizontal sub-sampling of the image
+    CV_CAP_PROP_PVAPI_DECIMATIONVERTICAL    = 303, // Vertical sub-sampling of the image
+    CV_CAP_PROP_PVAPI_BINNINGX              = 304, // Horizontal binning factor
+    CV_CAP_PROP_PVAPI_BINNINGY              = 305, // Vertical binning factor
+    CV_CAP_PROP_PVAPI_PIXELFORMAT           = 306, // Pixel format
+
+    // Properties of cameras available through XIMEA SDK interface
+    CV_CAP_PROP_XI_DOWNSAMPLING                                 = 400, // Change image resolution by binning or skipping.
+    CV_CAP_PROP_XI_DATA_FORMAT                                  = 401, // Output data format.
+    CV_CAP_PROP_XI_OFFSET_X                                     = 402, // Horizontal offset from the origin to the area of interest (in pixels).
+    CV_CAP_PROP_XI_OFFSET_Y                                     = 403, // Vertical offset from the origin to the area of interest (in pixels).
+    CV_CAP_PROP_XI_TRG_SOURCE                                   = 404, // Defines source of trigger.
+    CV_CAP_PROP_XI_TRG_SOFTWARE                                 = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.
+    CV_CAP_PROP_XI_GPI_SELECTOR                                 = 406, // Selects general purpose input
+    CV_CAP_PROP_XI_GPI_MODE                                     = 407, // Set general purpose input mode
+    CV_CAP_PROP_XI_GPI_LEVEL                                    = 408, // Get general purpose level
+    CV_CAP_PROP_XI_GPO_SELECTOR                                 = 409, // Selects general purpose output
+    CV_CAP_PROP_XI_GPO_MODE                                     = 410, // Set general purpose output mode
+    CV_CAP_PROP_XI_LED_SELECTOR                                 = 411, // Selects camera signalling LED
+    CV_CAP_PROP_XI_LED_MODE                                     = 412, // Define camera signalling LED functionality
+    CV_CAP_PROP_XI_MANUAL_WB                                    = 413, // Calculates White Balance(must be called during acquisition)
+    CV_CAP_PROP_XI_AUTO_WB                                      = 414, // Automatic white balance
+    CV_CAP_PROP_XI_AEAG                                         = 415, // Automatic exposure/gain
+    CV_CAP_PROP_XI_EXP_PRIORITY                                 = 416, // Exposure priority (0.5 - exposure 50%, gain 50%).
+    CV_CAP_PROP_XI_AE_MAX_LIMIT                                 = 417, // Maximum limit of exposure in AEAG procedure
+    CV_CAP_PROP_XI_AG_MAX_LIMIT                                 = 418,  // Maximum limit of gain in AEAG procedure
+    CV_CAP_PROP_XI_AEAG_LEVEL                                   = 419, // Average intensity of output signal AEAG should achieve(in %)
+    CV_CAP_PROP_XI_TIMEOUT                                      = 420, // Image capture timeout in milliseconds
+    CV_CAP_PROP_XI_EXPOSURE                                     = 421, // Exposure time in microseconds
+    CV_CAP_PROP_XI_EXPOSURE_BURST_COUNT                         = 422, // Sets the number of times of exposure in one frame.
+    CV_CAP_PROP_XI_GAIN_SELECTOR                                = 423, // Gain selector for parameter Gain allows to select different type of gains.
+    CV_CAP_PROP_XI_GAIN                                         = 424, // Gain in dB
+    CV_CAP_PROP_XI_DOWNSAMPLING_TYPE                            = 426, // Change image downsampling type.
+    CV_CAP_PROP_XI_BINNING_SELECTOR                             = 427, // Binning engine selector.
+    CV_CAP_PROP_XI_BINNING_VERTICAL                             = 428, // Vertical Binning - number of vertical photo-sensitive cells to combine together.
+    CV_CAP_PROP_XI_BINNING_HORIZONTAL                           = 429, // Horizontal Binning - number of horizontal photo-sensitive cells to combine together.
+    CV_CAP_PROP_XI_BINNING_PATTERN                              = 430, // Binning pattern type.
+    CV_CAP_PROP_XI_DECIMATION_SELECTOR                          = 431, // Decimation engine selector.
+    CV_CAP_PROP_XI_DECIMATION_VERTICAL                          = 432, // Vertical Decimation - vertical sub-sampling of the image - reduces the vertical resolution of the image by the specified vertical decimation factor.
+    CV_CAP_PROP_XI_DECIMATION_HORIZONTAL                        = 433, // Horizontal Decimation - horizontal sub-sampling of the image - reduces the horizontal resolution of the image by the specified vertical decimation factor.
+    CV_CAP_PROP_XI_DECIMATION_PATTERN                           = 434, // Decimation pattern type.
+    CV_CAP_PROP_XI_IMAGE_DATA_FORMAT                            = 435, // Output data format.
+    CV_CAP_PROP_XI_SHUTTER_TYPE                                 = 436, // Change sensor shutter type(CMOS sensor).
+    CV_CAP_PROP_XI_SENSOR_TAPS                                  = 437, // Number of taps
+    CV_CAP_PROP_XI_AEAG_ROI_OFFSET_X                            = 439, // Automatic exposure/gain ROI offset X
+    CV_CAP_PROP_XI_AEAG_ROI_OFFSET_Y                            = 440, // Automatic exposure/gain ROI offset Y
+    CV_CAP_PROP_XI_AEAG_ROI_WIDTH                               = 441, // Automatic exposure/gain ROI Width
+    CV_CAP_PROP_XI_AEAG_ROI_HEIGHT                              = 442, // Automatic exposure/gain ROI Height
+    CV_CAP_PROP_XI_BPC                                          = 445, // Correction of bad pixels
+    CV_CAP_PROP_XI_WB_KR                                        = 448, // White balance red coefficient
+    CV_CAP_PROP_XI_WB_KG                                        = 449, // White balance green coefficient
+    CV_CAP_PROP_XI_WB_KB                                        = 450, // White balance blue coefficient
+    CV_CAP_PROP_XI_WIDTH                                        = 451, // Width of the Image provided by the device (in pixels).
+    CV_CAP_PROP_XI_HEIGHT                                       = 452, // Height of the Image provided by the device (in pixels).
+    CV_CAP_PROP_XI_LIMIT_BANDWIDTH                              = 459, // Set/get bandwidth(datarate)(in Megabits)
+    CV_CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH                        = 460, // Sensor output data bit depth.
+    CV_CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH                        = 461, // Device output data bit depth.
+    CV_CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH                         = 462, // bitdepth of data returned by function xiGetImage
+    CV_CAP_PROP_XI_OUTPUT_DATA_PACKING                          = 463, // Device output data packing (or grouping) enabled. Packing could be enabled if output_data_bit_depth > 8 and packing capability is available.
+    CV_CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE                     = 464, // Data packing type. Some cameras supports only specific packing type.
+    CV_CAP_PROP_XI_IS_COOLED                                    = 465, // Returns 1 for cameras that support cooling.
+    CV_CAP_PROP_XI_COOLING                                      = 466, // Start camera cooling.
+    CV_CAP_PROP_XI_TARGET_TEMP                                  = 467, // Set sensor target temperature for cooling.
+    CV_CAP_PROP_XI_CHIP_TEMP                                    = 468, // Camera sensor temperature
+    CV_CAP_PROP_XI_HOUS_TEMP                                    = 469, // Camera housing tepmerature
+    CV_CAP_PROP_XI_CMS                                          = 470, // Mode of color management system.
+    CV_CAP_PROP_XI_APPLY_CMS                                    = 471, // Enable applying of CMS profiles to xiGetImage (see XI_PRM_INPUT_CMS_PROFILE, XI_PRM_OUTPUT_CMS_PROFILE).
+    CV_CAP_PROP_XI_IMAGE_IS_COLOR                               = 474, // Returns 1 for color cameras.
+    CV_CAP_PROP_XI_COLOR_FILTER_ARRAY                           = 475, // Returns color filter array type of RAW data.
+    CV_CAP_PROP_XI_GAMMAY                                       = 476, // Luminosity gamma
+    CV_CAP_PROP_XI_GAMMAC                                       = 477, // Chromaticity gamma
+    CV_CAP_PROP_XI_SHARPNESS                                    = 478, // Sharpness Strenght
+    CV_CAP_PROP_XI_CC_MATRIX_00                                 = 479, // Color Correction Matrix element [0][0]
+    CV_CAP_PROP_XI_CC_MATRIX_01                                 = 480, // Color Correction Matrix element [0][1]
+    CV_CAP_PROP_XI_CC_MATRIX_02                                 = 481, // Color Correction Matrix element [0][2]
+    CV_CAP_PROP_XI_CC_MATRIX_03                                 = 482, // Color Correction Matrix element [0][3]
+    CV_CAP_PROP_XI_CC_MATRIX_10                                 = 483, // Color Correction Matrix element [1][0]
+    CV_CAP_PROP_XI_CC_MATRIX_11                                 = 484, // Color Correction Matrix element [1][1]
+    CV_CAP_PROP_XI_CC_MATRIX_12                                 = 485, // Color Correction Matrix element [1][2]
+    CV_CAP_PROP_XI_CC_MATRIX_13                                 = 486, // Color Correction Matrix element [1][3]
+    CV_CAP_PROP_XI_CC_MATRIX_20                                 = 487, // Color Correction Matrix element [2][0]
+    CV_CAP_PROP_XI_CC_MATRIX_21                                 = 488, // Color Correction Matrix element [2][1]
+    CV_CAP_PROP_XI_CC_MATRIX_22                                 = 489, // Color Correction Matrix element [2][2]
+    CV_CAP_PROP_XI_CC_MATRIX_23                                 = 490, // Color Correction Matrix element [2][3]
+    CV_CAP_PROP_XI_CC_MATRIX_30                                 = 491, // Color Correction Matrix element [3][0]
+    CV_CAP_PROP_XI_CC_MATRIX_31                                 = 492, // Color Correction Matrix element [3][1]
+    CV_CAP_PROP_XI_CC_MATRIX_32                                 = 493, // Color Correction Matrix element [3][2]
+    CV_CAP_PROP_XI_CC_MATRIX_33                                 = 494, // Color Correction Matrix element [3][3]
+    CV_CAP_PROP_XI_DEFAULT_CC_MATRIX                            = 495, // Set default Color Correction Matrix
+    CV_CAP_PROP_XI_TRG_SELECTOR                                 = 498, // Selects the type of trigger.
+    CV_CAP_PROP_XI_ACQ_FRAME_BURST_COUNT                        = 499, // Sets number of frames acquired by burst. This burst is used only if trigger is set to FrameBurstStart
+    CV_CAP_PROP_XI_DEBOUNCE_EN                                  = 507, // Enable/Disable debounce to selected GPI
+    CV_CAP_PROP_XI_DEBOUNCE_T0                                  = 508, // Debounce time (x * 10us)
+    CV_CAP_PROP_XI_DEBOUNCE_T1                                  = 509, // Debounce time (x * 10us)
+    CV_CAP_PROP_XI_DEBOUNCE_POL                                 = 510, // Debounce polarity (pol = 1 t0 - falling edge, t1 - rising edge)
+    CV_CAP_PROP_XI_LENS_MODE                                    = 511, // Status of lens control interface. This shall be set to XI_ON before any Lens operations.
+    CV_CAP_PROP_XI_LENS_APERTURE_VALUE                          = 512, // Current lens aperture value in stops. Examples: 2.8, 4, 5.6, 8, 11
+    CV_CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE                    = 513, // Lens current focus movement value to be used by XI_PRM_LENS_FOCUS_MOVE in motor steps.
+    CV_CAP_PROP_XI_LENS_FOCUS_MOVE                              = 514, // Moves lens focus motor by steps set in XI_PRM_LENS_FOCUS_MOVEMENT_VALUE.
+    CV_CAP_PROP_XI_LENS_FOCUS_DISTANCE                          = 515, // Lens focus distance in cm.
+    CV_CAP_PROP_XI_LENS_FOCAL_LENGTH                            = 516, // Lens focal distance in mm.
+    CV_CAP_PROP_XI_LENS_FEATURE_SELECTOR                        = 517, // Selects the current feature which is accessible by XI_PRM_LENS_FEATURE.
+    CV_CAP_PROP_XI_LENS_FEATURE                                 = 518, // Allows access to lens feature value currently selected by XI_PRM_LENS_FEATURE_SELECTOR.
+    CV_CAP_PROP_XI_DEVICE_MODEL_ID                              = 521, // Return device model id
+    CV_CAP_PROP_XI_DEVICE_SN                                    = 522, // Return device serial number
+    CV_CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA                = 529, // The alpha channel of RGB32 output image format.
+    CV_CAP_PROP_XI_IMAGE_PAYLOAD_SIZE                           = 530, // Buffer size in bytes sufficient for output image returned by xiGetImage
+    CV_CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT                       = 531, // Current format of pixels on transport layer.
+    CV_CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ                         = 532, // Sensor clock frequency in Hz.
+    CV_CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX                      = 533, // Sensor clock frequency index. Sensor with selected frequencies have possibility to set the frequency only by this index.
+    CV_CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT                  = 534, // Number of output channels from sensor used for data transfer.
+    CV_CAP_PROP_XI_FRAMERATE                                    = 535, // Define framerate in Hz
+    CV_CAP_PROP_XI_COUNTER_SELECTOR                             = 536, // Select counter
+    CV_CAP_PROP_XI_COUNTER_VALUE                                = 537, // Counter status
+    CV_CAP_PROP_XI_ACQ_TIMING_MODE                              = 538, // Type of sensor frames timing.
+    CV_CAP_PROP_XI_AVAILABLE_BANDWIDTH                          = 539, // Calculate and return available interface bandwidth(int Megabits)
+    CV_CAP_PROP_XI_BUFFER_POLICY                                = 540, // Data move policy
+    CV_CAP_PROP_XI_LUT_EN                                       = 541, // Activates LUT.
+    CV_CAP_PROP_XI_LUT_INDEX                                    = 542, // Control the index (offset) of the coefficient to access in the LUT.
+    CV_CAP_PROP_XI_LUT_VALUE                                    = 543, // Value at entry LUTIndex of the LUT
+    CV_CAP_PROP_XI_TRG_DELAY                                    = 544, // Specifies the delay in microseconds (us) to apply after the trigger reception before activating it.
+    CV_CAP_PROP_XI_TS_RST_MODE                                  = 545, // Defines how time stamp reset engine will be armed
+    CV_CAP_PROP_XI_TS_RST_SOURCE                                = 546, // Defines which source will be used for timestamp reset. Writing this parameter will trigger settings of engine (arming)
+    CV_CAP_PROP_XI_IS_DEVICE_EXIST                              = 547, // Returns 1 if camera connected and works properly.
+    CV_CAP_PROP_XI_ACQ_BUFFER_SIZE                              = 548, // Acquisition buffer size in buffer_size_unit. Default bytes.
+    CV_CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT                         = 549, // Acquisition buffer size unit in bytes. Default 1. E.g. Value 1024 means that buffer_size is in KiBytes
+    CV_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE                    = 550, // Acquisition transport buffer size in bytes
+    CV_CAP_PROP_XI_BUFFERS_QUEUE_SIZE                           = 551, // Queue of field/frame buffers
+    CV_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT                  = 552, // Number of buffers to commit to low level
+    CV_CAP_PROP_XI_RECENT_FRAME                                 = 553, // GetImage returns most recent frame
+    CV_CAP_PROP_XI_DEVICE_RESET                                 = 554, // Resets the camera to default state.
+    CV_CAP_PROP_XI_COLUMN_FPN_CORRECTION                        = 555, // Correction of column FPN
+    CV_CAP_PROP_XI_SENSOR_MODE                                  = 558, // Current sensor mode. Allows to select sensor mode by one integer. Setting of this parameter affects: image dimensions and downsampling.
+    CV_CAP_PROP_XI_HDR                                          = 559, // Enable High Dynamic Range feature.
+    CV_CAP_PROP_XI_HDR_KNEEPOINT_COUNT                          = 560, // The number of kneepoints in the PWLR.
+    CV_CAP_PROP_XI_HDR_T1                                       = 561, // position of first kneepoint(in % of XI_PRM_EXPOSURE)
+    CV_CAP_PROP_XI_HDR_T2                                       = 562, // position of second kneepoint (in % of XI_PRM_EXPOSURE)
+    CV_CAP_PROP_XI_KNEEPOINT1                                   = 563, // value of first kneepoint (% of sensor saturation)
+    CV_CAP_PROP_XI_KNEEPOINT2                                   = 564, // value of second kneepoint (% of sensor saturation)
+    CV_CAP_PROP_XI_IMAGE_BLACK_LEVEL                            = 565, // Last image black level counts. Can be used for Offline processing to recall it.
+    CV_CAP_PROP_XI_HW_REVISION                                  = 571, // Returns hardware revision number.
+    CV_CAP_PROP_XI_DEBUG_LEVEL                                  = 572, // Set debug level
+    CV_CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION                   = 573, // Automatic bandwidth calculation,
+    CV_CAP_PROP_XI_FREE_FFS_SIZE                                = 581, // Size of free camera FFS.
+    CV_CAP_PROP_XI_USED_FFS_SIZE                                = 582, // Size of used camera FFS.
+    CV_CAP_PROP_XI_FFS_ACCESS_KEY                               = 583, // Setting of key enables file operations on some cameras.
+    CV_CAP_PROP_XI_SENSOR_FEATURE_SELECTOR                      = 585, // Selects the current feature which is accessible by XI_PRM_SENSOR_FEATURE_VALUE.
+    CV_CAP_PROP_XI_SENSOR_FEATURE_VALUE                         = 586, // Allows access to sensor feature value currently selected by XI_PRM_SENSOR_FEATURE_SELECTOR.
+
+    // Properties for Android cameras
+    CV_CAP_PROP_ANDROID_FLASH_MODE = 8001,
+    CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002,
+    CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003,
+    CV_CAP_PROP_ANDROID_ANTIBANDING = 8004,
+    CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005,
+    CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006,
+    CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007,
+    CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008,
+    CV_CAP_PROP_ANDROID_EXPOSE_LOCK = 8009,
+    CV_CAP_PROP_ANDROID_WHITEBALANCE_LOCK = 8010,
+
+    // Properties of cameras available through AVFOUNDATION interface
+    CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001,
+    CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,
+    CV_CAP_PROP_IOS_DEVICE_FLASH = 9003,
+    CV_CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
+    CV_CAP_PROP_IOS_DEVICE_TORCH = 9005,
+
+    // Properties of cameras available through Smartek Giganetix Ethernet Vision interface
+    /* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */
+    CV_CAP_PROP_GIGA_FRAME_OFFSET_X = 10001,
+    CV_CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002,
+    CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003,
+    CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004,
+    CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
+    CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006,
+
+    CV_CAP_PROP_INTELPERC_PROFILE_COUNT               = 11001,
+    CV_CAP_PROP_INTELPERC_PROFILE_IDX                 = 11002,
+    CV_CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE  = 11003,
+    CV_CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE      = 11004,
+    CV_CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD  = 11005,
+    CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ     = 11006,
+    CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT     = 11007,
+
+    // Intel PerC streams
+    CV_CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,
+    CV_CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,
+    CV_CAP_INTELPERC_GENERATORS_MASK = CV_CAP_INTELPERC_DEPTH_GENERATOR + CV_CAP_INTELPERC_IMAGE_GENERATOR
+};
+
+// Generic camera output modes.
+// Currently, these are supported through the libv4l interface only.
+enum
+{
+    CV_CAP_MODE_BGR  = 0, // BGR24 (default)
+    CV_CAP_MODE_RGB  = 1, // RGB24
+    CV_CAP_MODE_GRAY = 2, // Y8
+    CV_CAP_MODE_YUYV = 3  // YUYV
+};
+
+enum
+{
+    // Data given from depth generator.
+    CV_CAP_OPENNI_DEPTH_MAP                 = 0, // Depth values in mm (CV_16UC1)
+    CV_CAP_OPENNI_POINT_CLOUD_MAP           = 1, // XYZ in meters (CV_32FC3)
+    CV_CAP_OPENNI_DISPARITY_MAP             = 2, // Disparity in pixels (CV_8UC1)
+    CV_CAP_OPENNI_DISPARITY_MAP_32F         = 3, // Disparity in pixels (CV_32FC1)
+    CV_CAP_OPENNI_VALID_DEPTH_MASK          = 4, // CV_8UC1
+
+    // Data given from RGB image generator.
+    CV_CAP_OPENNI_BGR_IMAGE                 = 5,
+    CV_CAP_OPENNI_GRAY_IMAGE                = 6
+};
+
+// Supported output modes of OpenNI image generator
+enum
+{
+    CV_CAP_OPENNI_VGA_30HZ     = 0,
+    CV_CAP_OPENNI_SXGA_15HZ    = 1,
+    CV_CAP_OPENNI_SXGA_30HZ    = 2,
+    CV_CAP_OPENNI_QVGA_30HZ    = 3,
+    CV_CAP_OPENNI_QVGA_60HZ    = 4
+};
+
+enum
+{
+    CV_CAP_INTELPERC_DEPTH_MAP              = 0, // Each pixel is a 16-bit integer. The value indicates the distance from an object to the camera's XY plane or the Cartesian depth.
+    CV_CAP_INTELPERC_UVDEPTH_MAP            = 1, // Each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates.
+    CV_CAP_INTELPERC_IR_MAP                 = 2, // Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam.
+    CV_CAP_INTELPERC_IMAGE                  = 3
+};
+
+// gPhoto2 properties, if propertyId is less than 0 then work on widget with that __additive inversed__ camera setting ID
+// Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE.
+// @see CvCaptureCAM_GPHOTO2 for more info
+enum
+{
+    CV_CAP_PROP_GPHOTO2_PREVIEW           = 17001, // Capture only preview from liveview mode.
+    CV_CAP_PROP_GPHOTO2_WIDGET_ENUMERATE  = 17002, // Readonly, returns (const char *).
+    CV_CAP_PROP_GPHOTO2_RELOAD_CONFIG     = 17003, // Trigger, only by set. Reload camera settings.
+    CV_CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE  = 17004, // Reload all settings on set.
+    CV_CAP_PROP_GPHOTO2_COLLECT_MSGS      = 17005, // Collect messages with details.
+    CV_CAP_PROP_GPHOTO2_FLUSH_MSGS        = 17006, // Readonly, returns (const char *).
+    CV_CAP_PROP_SPEED                     = 17007, // Exposure speed. Can be readonly, depends on camera program.
+    CV_CAP_PROP_APERTURE                  = 17008, // Aperture. Can be readonly, depends on camera program.
+    CV_CAP_PROP_EXPOSUREPROGRAM           = 17009, // Camera exposure program.
+    CV_CAP_PROP_VIEWFINDER                = 17010  // Enter liveview mode.
+};
+
+/* retrieve or set capture properties */
+CVAPI(double) cvGetCaptureProperty( CvCapture* capture, int property_id );
+CVAPI(int)    cvSetCaptureProperty( CvCapture* capture, int property_id, double value );
+
+// Return the type of the capturer (eg, CV_CAP_V4W, CV_CAP_UNICAP), which is unknown if created with CV_CAP_ANY
+CVAPI(int)    cvGetCaptureDomain( CvCapture* capture);
+
+/* "black box" video file writer structure */
+typedef struct CvVideoWriter CvVideoWriter;
+
+#define CV_FOURCC_MACRO(c1, c2, c3, c4) (((c1) & 255) + (((c2) & 255) << 8) + (((c3) & 255) << 16) + (((c4) & 255) << 24))
+
+CV_INLINE int CV_FOURCC(char c1, char c2, char c3, char c4)
+{
+    return CV_FOURCC_MACRO(c1, c2, c3, c4);
+}
+
+#define CV_FOURCC_PROMPT -1  /* Open Codec Selection Dialog (Windows only) */
+#define CV_FOURCC_DEFAULT CV_FOURCC('I', 'Y', 'U', 'V') /* Use default codec for specified filename (Linux only) */
+
+/* initialize video file writer */
+CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc,
+                                           double fps, CvSize frame_size,
+                                           int is_color CV_DEFAULT(1));
+
+/* write frame to video file */
+CVAPI(int) cvWriteFrame( CvVideoWriter* writer, const IplImage* image );
+
+/* close video file writer */
+CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer );
+
+/****************************************************************************************\
+*                              Obsolete functions/synonyms                               *
+\****************************************************************************************/
+
+#define cvCaptureFromFile cvCreateFileCapture
+#define cvCaptureFromCAM cvCreateCameraCapture
+#define cvCaptureFromAVI cvCaptureFromFile
+#define cvCreateAVIWriter cvCreateVideoWriter
+#define cvWriteToAVI cvWriteFrame
+
+/** @} videoio_c */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__OPENCV_VIDEOIO_H__
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab.hpp
new file mode 100644
index 0000000..17b061f
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab.hpp
@@ -0,0 +1,81 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_HPP__
+#define __OPENCV_VIDEOSTAB_HPP__
+
+/**
+  @defgroup videostab Video Stabilization
+
+The video stabilization module contains a set of functions and classes that can be used to solve the
+problem of video stabilization. There are a few methods implemented, most of them are descibed in
+the papers @cite OF06 and @cite G11 . However, there are some extensions and deviations from the orginal
+paper methods.
+
+### References
+
+ 1. "Full-Frame Video Stabilization with Motion Inpainting"
+     Yasuyuki Matsushita, Eyal Ofek, Weina Ge, Xiaoou Tang, Senior Member, and Heung-Yeung Shum
+ 2. "Auto-Directed Video Stabilization with Robust L1 Optimal Camera Paths"
+     Matthias Grundmann, Vivek Kwatra, Irfan Essa
+
+     @{
+         @defgroup videostab_motion Global Motion Estimation
+
+The video stabilization module contains a set of functions and classes for global motion estimation
+between point clouds or between images. In the last case features are extracted and matched
+internally. For the sake of convenience the motion estimation functions are wrapped into classes.
+Both the functions and the classes are available.
+
+         @defgroup videostab_marching Fast Marching Method
+
+The Fast Marching Method @cite Telea04 is used in of the video stabilization routines to do motion and
+color inpainting. The method is implemented is a flexible way and it's made public for other users.
+
+     @}
+
+*/
+
+#include "opencv2/videostab/stabilizer.hpp"
+#include "opencv2/videostab/ring_buffer.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp
new file mode 100644
index 0000000..8028c1d
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp
@@ -0,0 +1,116 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_DEBLURRING_HPP__
+#define __OPENCV_VIDEOSTAB_DEBLURRING_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+CV_EXPORTS float calcBlurriness(const Mat &frame);
+
+class CV_EXPORTS DeblurerBase
+{
+public:
+    DeblurerBase() : radius_(0), frames_(0), motions_(0), blurrinessRates_(0) {}
+
+    virtual ~DeblurerBase() {}
+
+    virtual void setRadius(int val) { radius_ = val; }
+    virtual int radius() const { return radius_; }
+
+    virtual void deblur(int idx, Mat &frame) = 0;
+
+
+    // data from stabilizer
+
+    virtual void setFrames(const std::vector<Mat> &val) { frames_ = &val; }
+    virtual const std::vector<Mat>& frames() const { return *frames_; }
+
+    virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+    virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+    virtual void setBlurrinessRates(const std::vector<float> &val) { blurrinessRates_ = &val; }
+    virtual const std::vector<float>& blurrinessRates() const { return *blurrinessRates_; }
+
+protected:
+    int radius_;
+    const std::vector<Mat> *frames_;
+    const std::vector<Mat> *motions_;
+    const std::vector<float> *blurrinessRates_;
+};
+
+class CV_EXPORTS NullDeblurer : public DeblurerBase
+{
+public:
+    virtual void deblur(int /*idx*/, Mat &/*frame*/) {}
+};
+
+class CV_EXPORTS WeightingDeblurer : public DeblurerBase
+{
+public:
+    WeightingDeblurer();
+
+    void setSensitivity(float val) { sensitivity_ = val; }
+    float sensitivity() const { return sensitivity_; }
+
+    virtual void deblur(int idx, Mat &frame);
+
+private:
+    float sensitivity_;
+    Mat_<float> bSum_, gSum_, rSum_, wSum_;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp
new file mode 100644
index 0000000..c0c7985
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp
@@ -0,0 +1,121 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_FAST_MARCHING_HPP__
+#define __OPENCV_VIDEOSTAB_FAST_MARCHING_HPP__
+
+#include <cmath>
+#include <queue>
+#include <algorithm>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_marching
+//! @{
+
+/** @brief Describes the Fast Marching Method implementation.
+
+  See http://iwi.eldoc.ub.rug.nl/FILES/root/2004/JGraphToolsTelea/2004JGraphToolsTelea.pdf
+ */
+class CV_EXPORTS FastMarchingMethod
+{
+public:
+    FastMarchingMethod() : inf_(1e6f) {}
+
+    /** @brief Template method that runs the Fast Marching Method.
+
+    @param mask Image mask. 0 value indicates that the pixel value must be inpainted, 255 indicates
+    that the pixel value is known, other values aren't acceptable.
+    @param inpaint Inpainting functor that overloads void operator ()(int x, int y).
+    @return Inpainting functor.
+     */
+    template <typename Inpaint>
+    Inpaint run(const Mat &mask, Inpaint inpaint);
+
+    /**
+    @return Distance map that's created during working of the method.
+    */
+    Mat distanceMap() const { return dist_; }
+
+private:
+    enum { INSIDE = 0, BAND = 1, KNOWN = 255 };
+
+    struct DXY
+    {
+        float dist;
+        int x, y;
+
+        DXY() : dist(0), x(0), y(0) {}
+        DXY(float _dist, int _x, int _y) : dist(_dist), x(_x), y(_y) {}
+        bool operator <(const DXY &dxy) const { return dist < dxy.dist; }
+    };
+
+    float solve(int x1, int y1, int x2, int y2) const;
+    int& indexOf(const DXY &dxy) { return index_(dxy.y, dxy.x); }
+
+    void heapUp(int idx);
+    void heapDown(int idx);
+    void heapAdd(const DXY &dxy);
+    void heapRemoveMin();
+
+    float inf_;
+
+    cv::Mat_<uchar> flag_; // flag map
+    cv::Mat_<float> dist_; // distance map
+
+    cv::Mat_<int> index_; // index of point in the narrow band
+    std::vector<DXY> narrowBand_; // narrow band heap
+    int size_; // narrow band size
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#include "fast_marching_inl.hpp"
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp
new file mode 100644
index 0000000..6388e69
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp
@@ -0,0 +1,165 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_FAST_MARCHING_INL_HPP__
+#define __OPENCV_VIDEOSTAB_FAST_MARCHING_INL_HPP__
+
+#include "opencv2/videostab/fast_marching.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+template <typename Inpaint>
+Inpaint FastMarchingMethod::run(const cv::Mat &mask, Inpaint inpaint)
+{
+    using namespace cv;
+
+    CV_Assert(mask.type() == CV_8U);
+
+    static const int lut[4][2] = {{-1,0}, {0,-1}, {1,0}, {0,1}};
+
+    mask.copyTo(flag_);
+    flag_.create(mask.size());
+    dist_.create(mask.size());
+    index_.create(mask.size());
+    narrowBand_.clear();
+    size_ = 0;
+
+    // init
+    for (int y = 0; y < flag_.rows; ++y)
+    {
+        for (int x = 0; x < flag_.cols; ++x)
+        {
+            if (flag_(y,x) == KNOWN)
+                dist_(y,x) = 0.f;
+            else
+            {
+                int n = 0;
+                int nunknown = 0;
+
+                for (int i = 0; i < 4; ++i)
+                {
+                    int xn = x + lut[i][0];
+                    int yn = y + lut[i][1];
+
+                    if (xn >= 0 && xn < flag_.cols && yn >= 0 && yn < flag_.rows)
+                    {
+                        n++;
+                        if (flag_(yn,xn) != KNOWN)
+                            nunknown++;
+                    }
+                }
+
+                if (n>0 && nunknown == n)
+                {
+                    dist_(y,x) = inf_;
+                    flag_(y,x) = INSIDE;
+                }
+                else
+                {
+                    dist_(y,x) = 0.f;
+                    flag_(y,x) = BAND;
+                    inpaint(x, y);
+
+                    narrowBand_.push_back(DXY(0.f,x,y));
+                    index_(y,x) = size_++;
+                }
+            }
+        }
+    }
+
+    // make heap
+    for (int i = size_/2-1; i >= 0; --i)
+        heapDown(i);
+
+    // main cycle
+    while (size_ > 0)
+    {
+        int x = narrowBand_[0].x;
+        int y = narrowBand_[0].y;
+        heapRemoveMin();
+
+        flag_(y,x) = KNOWN;
+        for (int n = 0; n < 4; ++n)
+        {
+            int xn = x + lut[n][0];
+            int yn = y + lut[n][1];
+
+            if (xn >= 0 && xn < flag_.cols && yn >= 0 && yn < flag_.rows && flag_(yn,xn) != KNOWN)
+            {
+                dist_(yn,xn) = std::min(std::min(solve(xn-1, yn, xn, yn-1), solve(xn+1, yn, xn, yn-1)),
+                                        std::min(solve(xn-1, yn, xn, yn+1), solve(xn+1, yn, xn, yn+1)));
+
+                if (flag_(yn,xn) == INSIDE)
+                {
+                    flag_(yn,xn) = BAND;
+                    inpaint(xn, yn);
+                    heapAdd(DXY(dist_(yn,xn),xn,yn));
+                }
+                else
+                {
+                    int i = index_(yn,xn);
+                    if (dist_(yn,xn) < narrowBand_[i].dist)
+                    {
+                        narrowBand_[i].dist = dist_(yn,xn);
+                        heapUp(i);
+                    }
+                    // works better if it's commented out
+                    /*else if (dist(yn,xn) > narrowBand[i].dist)
+                    {
+                        narrowBand[i].dist = dist(yn,xn);
+                        heapDown(i);
+                    }*/
+                }
+            }
+        }
+    }
+
+    return inpaint;
+}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp
new file mode 100644
index 0000000..612fbdb
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp
@@ -0,0 +1,94 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP__
+#define __OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS IFrameSource
+{
+public:
+    virtual ~IFrameSource() {}
+    virtual void reset() = 0;
+    virtual Mat nextFrame() = 0;
+};
+
+class CV_EXPORTS NullFrameSource : public IFrameSource
+{
+public:
+    virtual void reset() {}
+    virtual Mat nextFrame() { return Mat(); }
+};
+
+class CV_EXPORTS VideoFileSource : public IFrameSource
+{
+public:
+    VideoFileSource(const String &path, bool volatileFrame = false);
+
+    virtual void reset();
+    virtual Mat nextFrame();
+
+    int width();
+    int height();
+    int count();
+    double fps();
+
+private:
+    Ptr<IFrameSource> impl;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp
new file mode 100644
index 0000000..5d51e42
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp
@@ -0,0 +1,299 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_GLOBAL_MOTION_HPP__
+#define __OPENCV_VIDEOSTAB_GLOBAL_MOTION_HPP__
+
+#include <vector>
+#include <fstream>
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/opencv_modules.hpp"
+#include "opencv2/videostab/optical_flow.hpp"
+#include "opencv2/videostab/motion_core.hpp"
+#include "opencv2/videostab/outlier_rejection.hpp"
+
+#ifdef HAVE_OPENCV_CUDAIMGPROC
+#  include "opencv2/cudaimgproc.hpp"
+#endif
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+/** @brief Estimates best global motion between two 2D point clouds in the least-squares sense.
+
+@note Works in-place and changes input point arrays.
+
+@param points0 Source set of 2D points (32F).
+@param points1 Destination set of 2D points (32F).
+@param model Motion model (up to MM_AFFINE).
+@param rmse Final root-mean-square error.
+@return 3x3 2D transformation matrix (32F).
+ */
+CV_EXPORTS Mat estimateGlobalMotionLeastSquares(
+        InputOutputArray points0, InputOutputArray points1, int model = MM_AFFINE,
+        float *rmse = 0);
+
+/** @brief Estimates best global motion between two 2D point clouds robustly (using RANSAC method).
+
+@param points0 Source set of 2D points (32F).
+@param points1 Destination set of 2D points (32F).
+@param model Motion model. See cv::videostab::MotionModel.
+@param params RANSAC method parameters. See videostab::RansacParams.
+@param rmse Final root-mean-square error.
+@param ninliers Final number of inliers.
+ */
+CV_EXPORTS Mat estimateGlobalMotionRansac(
+        InputArray points0, InputArray points1, int model = MM_AFFINE,
+        const RansacParams &params = RansacParams::default2dMotion(MM_AFFINE),
+        float *rmse = 0, int *ninliers = 0);
+
+/** @brief Base class for all global motion estimation methods.
+ */
+class CV_EXPORTS MotionEstimatorBase
+{
+public:
+    virtual ~MotionEstimatorBase() {}
+
+    /** @brief Sets motion model.
+
+    @param val Motion model. See cv::videostab::MotionModel.
+     */
+    virtual void setMotionModel(MotionModel val) { motionModel_ = val; }
+
+    /**
+    @return Motion model. See cv::videostab::MotionModel.
+    */
+    virtual MotionModel motionModel() const { return motionModel_; }
+
+    /** @brief Estimates global motion between two 2D point clouds.
+
+    @param points0 Source set of 2D points (32F).
+    @param points1 Destination set of 2D points (32F).
+    @param ok Indicates whether motion was estimated successfully.
+    @return 3x3 2D transformation matrix (32F).
+     */
+    virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0) = 0;
+
+protected:
+    MotionEstimatorBase(MotionModel model) { setMotionModel(model); }
+
+private:
+    MotionModel motionModel_;
+};
+
+/** @brief Describes a robust RANSAC-based global 2D motion estimation method which minimizes L2 error.
+ */
+class CV_EXPORTS MotionEstimatorRansacL2 : public MotionEstimatorBase
+{
+public:
+    MotionEstimatorRansacL2(MotionModel model = MM_AFFINE);
+
+    void setRansacParams(const RansacParams &val) { ransacParams_ = val; }
+    RansacParams ransacParams() const { return ransacParams_; }
+
+    void setMinInlierRatio(float val) { minInlierRatio_ = val; }
+    float minInlierRatio() const { return minInlierRatio_; }
+
+    virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0);
+
+private:
+    RansacParams ransacParams_;
+    float minInlierRatio_;
+};
+
+/** @brief Describes a global 2D motion estimation method which minimizes L1 error.
+
+@note To be able to use this method you must build OpenCV with CLP library support. :
+ */
+class CV_EXPORTS MotionEstimatorL1 : public MotionEstimatorBase
+{
+public:
+    MotionEstimatorL1(MotionModel model = MM_AFFINE);
+
+    virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0);
+
+private:
+    std::vector<double> obj_, collb_, colub_;
+    std::vector<double> elems_, rowlb_, rowub_;
+    std::vector<int> rows_, cols_;
+
+    void set(int row, int col, double coef)
+    {
+        rows_.push_back(row);
+        cols_.push_back(col);
+        elems_.push_back(coef);
+    }
+};
+
+/** @brief Base class for global 2D motion estimation methods which take frames as input.
+ */
+class CV_EXPORTS ImageMotionEstimatorBase
+{
+public:
+    virtual ~ImageMotionEstimatorBase() {}
+
+    virtual void setMotionModel(MotionModel val) { motionModel_ = val; }
+    virtual MotionModel motionModel() const { return motionModel_; }
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) = 0;
+
+protected:
+    ImageMotionEstimatorBase(MotionModel model) { setMotionModel(model); }
+
+private:
+    MotionModel motionModel_;
+};
+
+class CV_EXPORTS FromFileMotionReader : public ImageMotionEstimatorBase
+{
+public:
+    FromFileMotionReader(const String &path);
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+    std::ifstream file_;
+};
+
+class CV_EXPORTS ToFileMotionWriter : public ImageMotionEstimatorBase
+{
+public:
+    ToFileMotionWriter(const String &path, Ptr<ImageMotionEstimatorBase> estimator);
+
+    virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+    virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+    std::ofstream file_;
+    Ptr<ImageMotionEstimatorBase> motionEstimator_;
+};
+
+/** @brief Describes a global 2D motion estimation method which uses keypoints detection and optical flow for
+matching.
+ */
+class CV_EXPORTS KeypointBasedMotionEstimator : public ImageMotionEstimatorBase
+{
+public:
+    KeypointBasedMotionEstimator(Ptr<MotionEstimatorBase> estimator);
+
+    virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+    virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+    void setDetector(Ptr<FeatureDetector> val) { detector_ = val; }
+    Ptr<FeatureDetector> detector() const { return detector_; }
+
+    void setOpticalFlowEstimator(Ptr<ISparseOptFlowEstimator> val) { optFlowEstimator_ = val; }
+    Ptr<ISparseOptFlowEstimator> opticalFlowEstimator() const { return optFlowEstimator_; }
+
+    void setOutlierRejector(Ptr<IOutlierRejector> val) { outlierRejector_ = val; }
+    Ptr<IOutlierRejector> outlierRejector() const { return outlierRejector_; }
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+    Ptr<MotionEstimatorBase> motionEstimator_;
+    Ptr<FeatureDetector> detector_;
+    Ptr<ISparseOptFlowEstimator> optFlowEstimator_;
+    Ptr<IOutlierRejector> outlierRejector_;
+
+    std::vector<uchar> status_;
+    std::vector<KeyPoint> keypointsPrev_;
+    std::vector<Point2f> pointsPrev_, points_;
+    std::vector<Point2f> pointsPrevGood_, pointsGood_;
+};
+
+#if defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW)
+
+class CV_EXPORTS KeypointBasedMotionEstimatorGpu : public ImageMotionEstimatorBase
+{
+public:
+    KeypointBasedMotionEstimatorGpu(Ptr<MotionEstimatorBase> estimator);
+
+    virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+    virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+    void setOutlierRejector(Ptr<IOutlierRejector> val) { outlierRejector_ = val; }
+    Ptr<IOutlierRejector> outlierRejector() const { return outlierRejector_; }
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+    Mat estimate(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, bool *ok = 0);
+
+private:
+    Ptr<MotionEstimatorBase> motionEstimator_;
+    Ptr<cuda::CornersDetector> detector_;
+    SparsePyrLkOptFlowEstimatorGpu optFlowEstimator_;
+    Ptr<IOutlierRejector> outlierRejector_;
+
+    cuda::GpuMat frame0_, grayFrame0_, frame1_;
+    cuda::GpuMat pointsPrev_, points_;
+    cuda::GpuMat status_;
+
+    Mat hostPointsPrev_, hostPoints_;
+    std::vector<Point2f> hostPointsPrevTmp_, hostPointsTmp_;
+    std::vector<uchar> rejectionStatus_;
+};
+
+#endif // defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW)
+
+/** @brief Computes motion between two frames assuming that all the intermediate motions are known.
+
+@param from Source frame index.
+@param to Destination frame index.
+@param motions Pair-wise motions. motions[i] denotes motion from the frame i to the frame i+1
+@return Motion from the frame from to the frame to.
+ */
+CV_EXPORTS Mat getMotion(int from, int to, const std::vector<Mat> &motions);
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp
new file mode 100644
index 0000000..844c68c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp
@@ -0,0 +1,212 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_INPAINTINT_HPP__
+#define __OPENCV_VIDEOSTAB_INPAINTINT_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/videostab/optical_flow.hpp"
+#include "opencv2/videostab/fast_marching.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/photo.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS InpainterBase
+{
+public:
+    InpainterBase()
+        : radius_(0), motionModel_(MM_UNKNOWN), frames_(0), motions_(0),
+          stabilizedFrames_(0), stabilizationMotions_(0) {}
+
+    virtual ~InpainterBase() {}
+
+    virtual void setRadius(int val) { radius_ = val; }
+    virtual int radius() const { return radius_; }
+
+    virtual void setMotionModel(MotionModel val) { motionModel_ = val; }
+    virtual MotionModel motionModel() const { return motionModel_; }
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask) = 0;
+
+
+    // data from stabilizer
+
+    virtual void setFrames(const std::vector<Mat> &val) { frames_ = &val; }
+    virtual const std::vector<Mat>& frames() const { return *frames_; }
+
+    virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+    virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+    virtual void setStabilizedFrames(const std::vector<Mat> &val) { stabilizedFrames_ = &val; }
+    virtual const std::vector<Mat>& stabilizedFrames() const { return *stabilizedFrames_; }
+
+    virtual void setStabilizationMotions(const std::vector<Mat> &val) { stabilizationMotions_ = &val; }
+    virtual const std::vector<Mat>& stabilizationMotions() const { return *stabilizationMotions_; }
+
+protected:
+    int radius_;
+    MotionModel motionModel_;
+    const std::vector<Mat> *frames_;
+    const std::vector<Mat> *motions_;
+    const std::vector<Mat> *stabilizedFrames_;
+    const std::vector<Mat> *stabilizationMotions_;
+};
+
+class CV_EXPORTS NullInpainter : public InpainterBase
+{
+public:
+    virtual void inpaint(int /*idx*/, Mat &/*frame*/, Mat &/*mask*/) {}
+};
+
+class CV_EXPORTS InpaintingPipeline : public InpainterBase
+{
+public:
+    void pushBack(Ptr<InpainterBase> inpainter) { inpainters_.push_back(inpainter); }
+    bool empty() const { return inpainters_.empty(); }
+
+    virtual void setRadius(int val);
+    virtual void setMotionModel(MotionModel val);
+    virtual void setFrames(const std::vector<Mat> &val);
+    virtual void setMotions(const std::vector<Mat> &val);
+    virtual void setStabilizedFrames(const std::vector<Mat> &val);
+    virtual void setStabilizationMotions(const std::vector<Mat> &val);
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    std::vector<Ptr<InpainterBase> > inpainters_;
+};
+
+class CV_EXPORTS ConsistentMosaicInpainter : public InpainterBase
+{
+public:
+    ConsistentMosaicInpainter();
+
+    void setStdevThresh(float val) { stdevThresh_ = val; }
+    float stdevThresh() const { return stdevThresh_; }
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    float stdevThresh_;
+};
+
+class CV_EXPORTS MotionInpainter : public InpainterBase
+{
+public:
+    MotionInpainter();
+
+    void setOptFlowEstimator(Ptr<IDenseOptFlowEstimator> val) { optFlowEstimator_ = val; }
+    Ptr<IDenseOptFlowEstimator> optFlowEstimator() const { return optFlowEstimator_; }
+
+    void setFlowErrorThreshold(float val) { flowErrorThreshold_ = val; }
+    float flowErrorThreshold() const { return flowErrorThreshold_; }
+
+    void setDistThreshold(float val) { distThresh_ = val; }
+    float distThresh() const { return distThresh_; }
+
+    void setBorderMode(int val) { borderMode_ = val; }
+    int borderMode() const { return borderMode_; }
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    FastMarchingMethod fmm_;
+    Ptr<IDenseOptFlowEstimator> optFlowEstimator_;
+    float flowErrorThreshold_;
+    float distThresh_;
+    int borderMode_;
+
+    Mat frame1_, transformedFrame1_;
+    Mat_<uchar> grayFrame_, transformedGrayFrame1_;
+    Mat_<uchar> mask1_, transformedMask1_;
+    Mat_<float> flowX_, flowY_, flowErrors_;
+    Mat_<uchar> flowMask_;
+};
+
+class CV_EXPORTS ColorAverageInpainter : public InpainterBase
+{
+public:
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    FastMarchingMethod fmm_;
+};
+
+class CV_EXPORTS ColorInpainter : public InpainterBase
+{
+public:
+    ColorInpainter(int method = INPAINT_TELEA, double radius = 2.);
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    int method_;
+    double radius_;
+    Mat invMask_;
+};
+
+inline ColorInpainter::ColorInpainter(int _method, double _radius)
+        : method_(_method), radius_(_radius) {}
+
+CV_EXPORTS void calcFlowMask(
+        const Mat &flowX, const Mat &flowY, const Mat &errors, float maxError,
+        const Mat &mask0, const Mat &mask1, Mat &flowMask);
+
+CV_EXPORTS void completeFrameAccordingToFlow(
+        const Mat &flowMask, const Mat &flowX, const Mat &flowY, const Mat &frame1, const Mat &mask1,
+        float distThresh, Mat& frame0, Mat &mask0);
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp
new file mode 100644
index 0000000..28625ed
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp
@@ -0,0 +1,80 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_LOG_HPP__
+#define __OPENCV_VIDEOSTAB_LOG_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS ILog
+{
+public:
+    virtual ~ILog() {}
+    virtual void print(const char *format, ...) = 0;
+};
+
+class CV_EXPORTS NullLog : public ILog
+{
+public:
+    virtual void print(const char * /*format*/, ...) {}
+};
+
+class CV_EXPORTS LogToStdout : public ILog
+{
+public:
+    virtual void print(const char *format, ...);
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp
new file mode 100644
index 0000000..17448e3
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp
@@ -0,0 +1,129 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_MOTION_CORE_HPP__
+#define __OPENCV_VIDEOSTAB_MOTION_CORE_HPP__
+
+#include <cmath>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+/** @brief Describes motion model between two point clouds.
+ */
+enum MotionModel
+{
+    MM_TRANSLATION = 0,
+    MM_TRANSLATION_AND_SCALE = 1,
+    MM_ROTATION = 2,
+    MM_RIGID = 3,
+    MM_SIMILARITY = 4,
+    MM_AFFINE = 5,
+    MM_HOMOGRAPHY = 6,
+    MM_UNKNOWN = 7
+};
+
+/** @brief Describes RANSAC method parameters.
+ */
+struct CV_EXPORTS RansacParams
+{
+    int size; //!< subset size
+    float thresh; //!< max error to classify as inlier
+    float eps; //!< max outliers ratio
+    float prob; //!< probability of success
+
+    RansacParams() : size(0), thresh(0), eps(0), prob(0) {}
+    /** @brief Constructor
+    @param size Subset size.
+    @param thresh Maximum re-projection error value to classify as inlier.
+    @param eps Maximum ratio of incorrect correspondences.
+    @param prob Required success probability.
+     */
+    RansacParams(int size, float thresh, float eps, float prob);
+
+    /**
+    @return Number of iterations that'll be performed by RANSAC method.
+    */
+    int niters() const
+    {
+        return static_cast<int>(
+                std::ceil(std::log(1 - prob) / std::log(1 - std::pow(1 - eps, size))));
+    }
+
+    /**
+    @param model Motion model. See cv::videostab::MotionModel.
+    @return Default RANSAC method parameters for the given motion model.
+    */
+    static RansacParams default2dMotion(MotionModel model)
+    {
+        CV_Assert(model < MM_UNKNOWN);
+        if (model == MM_TRANSLATION)
+            return RansacParams(1, 0.5f, 0.5f, 0.99f);
+        if (model == MM_TRANSLATION_AND_SCALE)
+            return RansacParams(2, 0.5f, 0.5f, 0.99f);
+        if (model == MM_ROTATION)
+            return RansacParams(1, 0.5f, 0.5f, 0.99f);
+        if (model == MM_RIGID)
+            return RansacParams(2, 0.5f, 0.5f, 0.99f);
+        if (model == MM_SIMILARITY)
+            return RansacParams(2, 0.5f, 0.5f, 0.99f);
+        if (model == MM_AFFINE)
+            return RansacParams(3, 0.5f, 0.5f, 0.99f);
+        return RansacParams(4, 0.5f, 0.5f, 0.99f);
+    }
+};
+
+inline RansacParams::RansacParams(int _size, float _thresh, float _eps, float _prob)
+    : size(_size), thresh(_thresh), eps(_eps), prob(_prob) {}
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp
new file mode 100644
index 0000000..3bdbfbd
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp
@@ -0,0 +1,174 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_MOTION_STABILIZING_HPP__
+#define __OPENCV_VIDEOSTAB_MOTION_STABILIZING_HPP__
+
+#include <vector>
+#include <utility>
+#include "opencv2/core.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+class CV_EXPORTS IMotionStabilizer
+{
+public:
+    virtual ~IMotionStabilizer() {}
+
+    //! assumes that [0, size-1) is in or equals to [range.first, range.second)
+    virtual void stabilize(
+            int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+            Mat *stabilizationMotions) = 0;
+};
+
+class CV_EXPORTS MotionStabilizationPipeline : public IMotionStabilizer
+{
+public:
+    void pushBack(Ptr<IMotionStabilizer> stabilizer) { stabilizers_.push_back(stabilizer); }
+    bool empty() const { return stabilizers_.empty(); }
+
+    virtual void stabilize(
+            int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+            Mat *stabilizationMotions);
+
+private:
+    std::vector<Ptr<IMotionStabilizer> > stabilizers_;
+};
+
+class CV_EXPORTS MotionFilterBase : public IMotionStabilizer
+{
+public:
+    virtual ~MotionFilterBase() {}
+
+    virtual Mat stabilize(
+            int idx, const std::vector<Mat> &motions, std::pair<int,int> range) = 0;
+
+    virtual void stabilize(
+            int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+            Mat *stabilizationMotions);
+};
+
+class CV_EXPORTS GaussianMotionFilter : public MotionFilterBase
+{
+public:
+    GaussianMotionFilter(int radius = 15, float stdev = -1.f);
+
+    void setParams(int radius, float stdev = -1.f);
+    int radius() const { return radius_; }
+    float stdev() const { return stdev_; }
+
+    virtual Mat stabilize(
+            int idx, const std::vector<Mat> &motions, std::pair<int,int> range);
+
+private:
+    int radius_;
+    float stdev_;
+    std::vector<float> weight_;
+};
+
+inline GaussianMotionFilter::GaussianMotionFilter(int _radius, float _stdev) { setParams(_radius, _stdev); }
+
+class CV_EXPORTS LpMotionStabilizer : public IMotionStabilizer
+{
+public:
+    LpMotionStabilizer(MotionModel model = MM_SIMILARITY);
+
+    void setMotionModel(MotionModel val) { model_ = val; }
+    MotionModel motionModel() const { return model_; }
+
+    void setFrameSize(Size val) { frameSize_ = val; }
+    Size frameSize() const { return frameSize_; }
+
+    void setTrimRatio(float val) { trimRatio_ = val; }
+    float trimRatio() const { return trimRatio_; }
+
+    void setWeight1(float val) { w1_ = val; }
+    float weight1() const { return w1_; }
+
+    void setWeight2(float val) { w2_ = val; }
+    float weight2() const { return w2_; }
+
+    void setWeight3(float val) { w3_ = val; }
+    float weight3() const { return w3_; }
+
+    void setWeight4(float val) { w4_ = val; }
+    float weight4() const { return w4_; }
+
+    virtual void stabilize(
+            int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+            Mat *stabilizationMotions);
+
+private:
+    MotionModel model_;
+    Size frameSize_;
+    float trimRatio_;
+    float w1_, w2_, w3_, w4_;
+
+    std::vector<double> obj_, collb_, colub_;
+    std::vector<int> rows_, cols_;
+    std::vector<double> elems_, rowlb_, rowub_;
+
+    void set(int row, int col, double coef)
+    {
+        rows_.push_back(row);
+        cols_.push_back(col);
+        elems_.push_back(coef);
+    }
+};
+
+CV_EXPORTS Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio);
+
+CV_EXPORTS float estimateOptimalTrimRatio(const Mat &M, Size size);
+
+//! @}
+
+} // namespace videostab
+} // namespace
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp
new file mode 100644
index 0000000..41d1953
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp
@@ -0,0 +1,150 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
+#define __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/opencv_modules.hpp"
+
+#ifdef HAVE_OPENCV_CUDAOPTFLOW
+  #include "opencv2/cudaoptflow.hpp"
+#endif
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS ISparseOptFlowEstimator
+{
+public:
+    virtual ~ISparseOptFlowEstimator() {}
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+            OutputArray status, OutputArray errors) = 0;
+};
+
+class CV_EXPORTS IDenseOptFlowEstimator
+{
+public:
+    virtual ~IDenseOptFlowEstimator() {}
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
+            OutputArray errors) = 0;
+};
+
+class CV_EXPORTS PyrLkOptFlowEstimatorBase
+{
+public:
+    PyrLkOptFlowEstimatorBase() { setWinSize(Size(21, 21)); setMaxLevel(3); }
+
+    virtual void setWinSize(Size val) { winSize_ = val; }
+    virtual Size winSize() const { return winSize_; }
+
+    virtual void setMaxLevel(int val) { maxLevel_ = val; }
+    virtual int maxLevel() const { return maxLevel_; }
+    virtual ~PyrLkOptFlowEstimatorBase() {}
+
+protected:
+    Size winSize_;
+    int maxLevel_;
+};
+
+class CV_EXPORTS SparsePyrLkOptFlowEstimator
+        : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator
+{
+public:
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+            OutputArray status, OutputArray errors);
+};
+
+#ifdef HAVE_OPENCV_CUDAOPTFLOW
+
+class CV_EXPORTS SparsePyrLkOptFlowEstimatorGpu
+        : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator
+{
+public:
+    SparsePyrLkOptFlowEstimatorGpu();
+
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+            OutputArray status, OutputArray errors);
+
+    void run(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, const cuda::GpuMat &points0, cuda::GpuMat &points1,
+             cuda::GpuMat &status, cuda::GpuMat &errors);
+
+    void run(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, const cuda::GpuMat &points0, cuda::GpuMat &points1,
+             cuda::GpuMat &status);
+
+private:
+    Ptr<cuda::SparsePyrLKOpticalFlow> optFlowEstimator_;
+    cuda::GpuMat frame0_, frame1_, points0_, points1_, status_, errors_;
+};
+
+class CV_EXPORTS DensePyrLkOptFlowEstimatorGpu
+        : public PyrLkOptFlowEstimatorBase, public IDenseOptFlowEstimator
+{
+public:
+    DensePyrLkOptFlowEstimatorGpu();
+
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
+            OutputArray errors);
+
+private:
+    Ptr<cuda::DensePyrLKOpticalFlow> optFlowEstimator_;
+    cuda::GpuMat frame0_, frame1_, flowX_, flowY_, errors_;
+};
+
+#endif
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp
new file mode 100644
index 0000000..9e40f85
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp
@@ -0,0 +1,101 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_OUTLIER_REJECTION_HPP__
+#define __OPENCV_VIDEOSTAB_OUTLIER_REJECTION_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/videostab/motion_core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS IOutlierRejector
+{
+public:
+    virtual ~IOutlierRejector() {}
+
+    virtual void process(
+            Size frameSize, InputArray points0, InputArray points1, OutputArray mask) = 0;
+};
+
+class CV_EXPORTS NullOutlierRejector : public IOutlierRejector
+{
+public:
+    virtual void process(
+            Size frameSize, InputArray points0, InputArray points1, OutputArray mask);
+};
+
+class CV_EXPORTS TranslationBasedLocalOutlierRejector : public IOutlierRejector
+{
+public:
+    TranslationBasedLocalOutlierRejector();
+
+    void setCellSize(Size val) { cellSize_ = val; }
+    Size cellSize() const { return cellSize_; }
+
+    void setRansacParams(RansacParams val) { ransacParams_ = val; }
+    RansacParams ransacParams() const { return ransacParams_; }
+
+    virtual void process(
+            Size frameSize, InputArray points0, InputArray points1, OutputArray mask);
+
+private:
+    Size cellSize_;
+    RansacParams ransacParams_;
+
+    typedef std::vector<int> Cell;
+    std::vector<Cell> grid_;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp
new file mode 100644
index 0000000..7cc3f03
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp
@@ -0,0 +1,72 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_RING_BUFFER_HPP__
+#define __OPENCV_VIDEOSTAB_RING_BUFFER_HPP__
+
+#include <vector>
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+template <typename T> inline T& at(int idx, std::vector<T> &items)
+{
+    return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
+}
+
+template <typename T> inline const T& at(int idx, const std::vector<T> &items)
+{
+    return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
+}
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp
new file mode 100644
index 0000000..c18d314
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp
@@ -0,0 +1,200 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_STABILIZER_HPP__
+#define __OPENCV_VIDEOSTAB_STABILIZER_HPP__
+
+#include <vector>
+#include <ctime>
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/videostab/motion_stabilizing.hpp"
+#include "opencv2/videostab/frame_source.hpp"
+#include "opencv2/videostab/log.hpp"
+#include "opencv2/videostab/inpainting.hpp"
+#include "opencv2/videostab/deblurring.hpp"
+#include "opencv2/videostab/wobble_suppression.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS StabilizerBase
+{
+public:
+    virtual ~StabilizerBase() {}
+
+    void setLog(Ptr<ILog> ilog) { log_ = ilog; }
+    Ptr<ILog> log() const { return log_; }
+
+    void setRadius(int val) { radius_ = val; }
+    int radius() const { return radius_; }
+
+    void setFrameSource(Ptr<IFrameSource> val) { frameSource_ = val; }
+    Ptr<IFrameSource> frameSource() const { return frameSource_; }
+
+    void setMotionEstimator(Ptr<ImageMotionEstimatorBase> val) { motionEstimator_ = val; }
+    Ptr<ImageMotionEstimatorBase> motionEstimator() const { return motionEstimator_; }
+
+    void setDeblurer(Ptr<DeblurerBase> val) { deblurer_ = val; }
+    Ptr<DeblurerBase> deblurrer() const { return deblurer_; }
+
+    void setTrimRatio(float val) { trimRatio_ = val; }
+    float trimRatio() const { return trimRatio_; }
+
+    void setCorrectionForInclusion(bool val) { doCorrectionForInclusion_ = val; }
+    bool doCorrectionForInclusion() const { return doCorrectionForInclusion_; }
+
+    void setBorderMode(int val) { borderMode_ = val; }
+    int borderMode() const { return borderMode_; }
+
+    void setInpainter(Ptr<InpainterBase> val) { inpainter_ = val; }
+    Ptr<InpainterBase> inpainter() const { return inpainter_; }
+
+protected:
+    StabilizerBase();
+
+    void reset();
+    Mat nextStabilizedFrame();
+    bool doOneIteration();
+    virtual void setUp(const Mat &firstFrame);
+    virtual Mat estimateMotion() = 0;
+    virtual Mat estimateStabilizationMotion() = 0;
+    void stabilizeFrame();
+    virtual Mat postProcessFrame(const Mat &frame);
+    void logProcessingTime();
+
+    Ptr<ILog> log_;
+    Ptr<IFrameSource> frameSource_;
+    Ptr<ImageMotionEstimatorBase> motionEstimator_;
+    Ptr<DeblurerBase> deblurer_;
+    Ptr<InpainterBase> inpainter_;
+    int radius_;
+    float trimRatio_;
+    bool doCorrectionForInclusion_;
+    int borderMode_;
+
+    Size frameSize_;
+    Mat frameMask_;
+    int curPos_;
+    int curStabilizedPos_;
+    bool doDeblurring_;
+    Mat preProcessedFrame_;
+    bool doInpainting_;
+    Mat inpaintingMask_;
+    Mat finalFrame_;
+    std::vector<Mat> frames_;
+    std::vector<Mat> motions_; // motions_[i] is the motion from i-th to i+1-th frame
+    std::vector<float> blurrinessRates_;
+    std::vector<Mat> stabilizedFrames_;
+    std::vector<Mat> stabilizedMasks_;
+    std::vector<Mat> stabilizationMotions_;
+    clock_t processingStartTime_;
+};
+
+class CV_EXPORTS OnePassStabilizer : public StabilizerBase, public IFrameSource
+{
+public:
+    OnePassStabilizer();
+
+    void setMotionFilter(Ptr<MotionFilterBase> val) { motionFilter_ = val; }
+    Ptr<MotionFilterBase> motionFilter() const { return motionFilter_; }
+
+    virtual void reset();
+    virtual Mat nextFrame() { return nextStabilizedFrame(); }
+
+protected:
+    virtual void setUp(const Mat &firstFrame);
+    virtual Mat estimateMotion();
+    virtual Mat estimateStabilizationMotion();
+    virtual Mat postProcessFrame(const Mat &frame);
+
+    Ptr<MotionFilterBase> motionFilter_;
+};
+
+class CV_EXPORTS TwoPassStabilizer : public StabilizerBase, public IFrameSource
+{
+public:
+    TwoPassStabilizer();
+
+    void setMotionStabilizer(Ptr<IMotionStabilizer> val) { motionStabilizer_ = val; }
+    Ptr<IMotionStabilizer> motionStabilizer() const { return motionStabilizer_; }
+
+    void setWobbleSuppressor(Ptr<WobbleSuppressorBase> val) { wobbleSuppressor_ = val; }
+    Ptr<WobbleSuppressorBase> wobbleSuppressor() const { return wobbleSuppressor_; }
+
+    void setEstimateTrimRatio(bool val) { mustEstTrimRatio_ = val; }
+    bool mustEstimateTrimaRatio() const { return mustEstTrimRatio_; }
+
+    virtual void reset();
+    virtual Mat nextFrame();
+
+protected:
+    void runPrePassIfNecessary();
+
+    virtual void setUp(const Mat &firstFrame);
+    virtual Mat estimateMotion();
+    virtual Mat estimateStabilizationMotion();
+    virtual Mat postProcessFrame(const Mat &frame);
+
+    Ptr<IMotionStabilizer> motionStabilizer_;
+    Ptr<WobbleSuppressorBase> wobbleSuppressor_;
+    bool mustEstTrimRatio_;
+
+    int frameCount_;
+    bool isPrePassDone_;
+    bool doWobbleSuppression_;
+    std::vector<Mat> motions2_;
+    Mat suppressedFrame_;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp
new file mode 100644
index 0000000..3f0a943
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp
@@ -0,0 +1,140 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_WOBBLE_SUPPRESSION_HPP__
+#define __OPENCV_VIDEOSTAB_WOBBLE_SUPPRESSION_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/core/cuda.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/videostab/log.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS WobbleSuppressorBase
+{
+public:
+    WobbleSuppressorBase();
+
+    virtual ~WobbleSuppressorBase() {}
+
+    void setMotionEstimator(Ptr<ImageMotionEstimatorBase> val) { motionEstimator_ = val; }
+    Ptr<ImageMotionEstimatorBase> motionEstimator() const { return motionEstimator_; }
+
+    virtual void suppress(int idx, const Mat &frame, Mat &result) = 0;
+
+
+    // data from stabilizer
+
+    virtual void setFrameCount(int val) { frameCount_ = val; }
+    virtual int frameCount() const { return frameCount_; }
+
+    virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+    virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+    virtual void setMotions2(const std::vector<Mat> &val) { motions2_ = &val; }
+    virtual const std::vector<Mat>& motions2() const { return *motions2_; }
+
+    virtual void setStabilizationMotions(const std::vector<Mat> &val) { stabilizationMotions_ = &val; }
+    virtual const std::vector<Mat>& stabilizationMotions() const { return *stabilizationMotions_; }
+
+protected:
+    Ptr<ImageMotionEstimatorBase> motionEstimator_;
+    int frameCount_;
+    const std::vector<Mat> *motions_;
+    const std::vector<Mat> *motions2_;
+    const std::vector<Mat> *stabilizationMotions_;
+};
+
+class CV_EXPORTS NullWobbleSuppressor : public WobbleSuppressorBase
+{
+public:
+    virtual void suppress(int idx, const Mat &frame, Mat &result);
+};
+
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressorBase : public WobbleSuppressorBase
+{
+public:
+    virtual void setPeriod(int val) { period_ = val; }
+    virtual int period() const { return period_; }
+
+protected:
+    MoreAccurateMotionWobbleSuppressorBase() { setPeriod(30); }
+
+    int period_;
+};
+
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressor : public MoreAccurateMotionWobbleSuppressorBase
+{
+public:
+    virtual void suppress(int idx, const Mat &frame, Mat &result);
+
+private:
+    Mat_<float> mapx_, mapy_;
+};
+
+#if defined(HAVE_OPENCV_CUDAWARPING)
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressorGpu : public MoreAccurateMotionWobbleSuppressorBase
+{
+public:
+    void suppress(int idx, const cuda::GpuMat &frame, cuda::GpuMat &result);
+    virtual void suppress(int idx, const Mat &frame, Mat &result);
+
+private:
+    cuda::GpuMat frameDevice_, resultDevice_;
+    cuda::GpuMat mapx_, mapy_;
+};
+#endif
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/include/opencv2/world.hpp b/Common_Class/OpenCV/opencv_3.1/include/opencv2/world.hpp
new file mode 100644
index 0000000..2442f2c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/include/opencv2/world.hpp
@@ -0,0 +1,58 @@
+/*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-2010, 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*/
+
+#ifndef __OPENCV_WORLD_HPP__
+#define __OPENCV_WORLD_HPP__
+
+#include "opencv2/core.hpp"
+
+#ifdef __cplusplus
+namespace cv
+{
+
+CV_EXPORTS_W bool initAll();
+
+}
+
+#endif
+
+#endif
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib
new file mode 100644
index 0000000..1557bb0
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_core310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_core310.lib
new file mode 100644
index 0000000..de74d11
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_core310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_features2d310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_features2d310.lib
new file mode 100644
index 0000000..dc16896
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_features2d310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_flann310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_flann310.lib
new file mode 100644
index 0000000..319460a
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_flann310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_highgui310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_highgui310.lib
new file mode 100644
index 0000000..c629b04
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_highgui310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib
new file mode 100644
index 0000000..ee4a374
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib
new file mode 100644
index 0000000..1d60ed2
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_ml310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_ml310.lib
new file mode 100644
index 0000000..164030c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_ml310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib
new file mode 100644
index 0000000..11ff06c
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_photo310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_photo310.lib
new file mode 100644
index 0000000..4fca666
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_photo310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_shape310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_shape310.lib
new file mode 100644
index 0000000..f9ca7e7
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_shape310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_stitching310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_stitching310.lib
new file mode 100644
index 0000000..7bc2497
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_stitching310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_superres310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_superres310.lib
new file mode 100644
index 0000000..f9c6035
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_superres310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_ts310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_ts310.lib
new file mode 100644
index 0000000..e8894f8
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_ts310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_video310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_video310.lib
new file mode 100644
index 0000000..dfce359
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_video310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_videoio310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_videoio310.lib
new file mode 100644
index 0000000..5e2a3e2
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_videoio310.lib
Binary files differ
diff --git a/Common_Class/OpenCV/opencv_3.1/lib/opencv_videostab310.lib b/Common_Class/OpenCV/opencv_3.1/lib/opencv_videostab310.lib
new file mode 100644
index 0000000..c62d1f3
--- /dev/null
+++ b/Common_Class/OpenCV/opencv_3.1/lib/opencv_videostab310.lib
Binary files differ
diff --git a/Common_Class/PLCConnector/MainFrm.cpp b/Common_Class/PLCConnector/MainFrm.cpp
new file mode 100644
index 0000000..7075b44
--- /dev/null
+++ b/Common_Class/PLCConnector/MainFrm.cpp
@@ -0,0 +1,390 @@
+
+// MainFrm.cpp : CMainFrame 努贰胶狼 备泅
+//
+
+#include "stdafx.h"
+#include "PLCConnector.h"
+
+#include "MainFrm.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+// CMainFrame
+
+IMPLEMENT_DYNCREATE(CMainFrame, CFrameWndEx)
+
+const int  iMaxUserToolbars = 10;
+const UINT uiFirstUserToolBarId = AFX_IDW_CONTROLBAR_FIRST + 40;
+const UINT uiLastUserToolBarId = uiFirstUserToolBarId + iMaxUserToolbars - 1;
+
+BEGIN_MESSAGE_MAP(CMainFrame, CFrameWndEx)
+	ON_WM_CREATE()
+	ON_COMMAND(ID_VIEW_CUSTOMIZE, &CMainFrame::OnViewCustomize)
+	ON_MESSAGE(UM_TRAY, &CMainFrame::OnTray)
+	ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR, &CMainFrame::OnToolbarCreateNew)
+	ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_OFF_2007_AQUA, &CMainFrame::OnApplicationLook)
+	ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_OFF_2007_AQUA, &CMainFrame::OnUpdateApplicationLook)
+	ON_WM_DESTROY()
+	ON_WM_CLOSE()
+	ON_COMMAND(ID_APP_EXIT, &CMainFrame::OnAppExit)
+	ON_COMMAND(ID_APP_SHOWAPPLICATION, &CMainFrame::OnAppShowapplication)
+END_MESSAGE_MAP()
+
+static UINT indicators[] =
+{
+	ID_SEPARATOR,           // 惑怕 临 钎矫扁
+	ID_INDICATOR_CAPS,
+	ID_INDICATOR_NUM,
+	ID_INDICATOR_SCRL,
+};
+
+// CMainFrame 积己/家戈
+
+CMainFrame::CMainFrame()
+{
+	// TODO: 咯扁俊 糕滚 檬扁拳 内靛甫 眠啊钦聪促.
+	theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_VS_2005);
+}
+
+CMainFrame::~CMainFrame()
+{
+}
+
+int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
+		return -1;
+/*
+	BOOL bNameValid;
+	// 焊包等 蔼俊 蝶扼 厚林倔 包府磊 棺 胶鸥老阑 汲沥钦聪促.
+	OnApplicationLook(theApp.m_nAppLook);
+
+	if (!m_wndMenuBar.Create(this))
+	{
+		
+		return -1;      // 父甸瘤 给沁嚼聪促.
+	}
+
+	m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);
+
+	// 皋春 葛澜阑 劝己拳秦档 器目胶啊 捞悼窍瘤 臼霸 钦聪促.
+	CMFCPopupMenu::SetForceMenuFocus(FALSE);
+
+	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
+		!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))
+	{
+		
+		return -1;      // 父甸瘤 给沁嚼聪促.
+	}
+
+	CString strToolBarName;
+	bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);
+	ASSERT(bNameValid);
+	m_wndToolBar.SetWindowText(strToolBarName);
+
+	CString strCustomize;
+	bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
+	ASSERT(bNameValid);
+	m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
+
+	// 荤侩磊 沥狼 档备 葛澜 累诀阑 倾侩钦聪促.
+	InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId);
+
+	if (!m_wndStatusBar.Create(this))
+	{
+		
+		return -1;      // 父甸瘤 给沁嚼聪促.
+	}
+	m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
+
+	// TODO: 档备 葛澜 棺 皋春 葛澜阑 档欧且 荐 绝霸 窍妨搁 捞 促几 临阑 昏力窍绞矫坷.
+	m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
+	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
+	EnableDocking(CBRS_ALIGN_ANY);
+	DockPane(&m_wndMenuBar);
+	DockPane(&m_wndToolBar);
+
+
+	// Visual Studio 2005 胶鸥老 档欧 芒 悼累阑 劝己拳钦聪促.
+	CDockingManager::SetDockingMode(DT_SMART);
+	// Visual Studio 2005 胶鸥老 档欧 芒 磊悼 见辫 悼累阑 劝己拳钦聪促.
+	EnableAutoHidePanes(CBRS_ALIGN_ANY);
+
+	// 档备 葛澜 棺 档欧 芒 皋春 官操扁甫 劝己拳钦聪促.
+	EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);
+
+	// 狐弗(<Alt> 虐甫 穿弗 盲 缠扁) 档备 葛澜 荤侩磊 瘤沥阑 劝己拳钦聪促.
+	CMFCToolBar::EnableQuickCustomization();
+
+	if (CMFCToolBar::GetUserImages() == NULL)
+	{
+		// 荤侩磊 沥狼 档备 葛澜 捞固瘤甫 肺靛钦聪促.
+		if (m_UserImages.Load(_T(".\\UserImages.bmp")))
+		{
+			m_UserImages.SetImageSize(CSize(16, 16), FALSE);
+			CMFCToolBar::SetUserImages(&m_UserImages);
+		}
+	}
+
+	// 皋春 俺牢 汲沥阑 劝己拳钦聪促(啊厘 弥辟俊 荤侩茄 疙飞).
+	// TODO: 荤侩磊狼 扁夯 疙飞阑 沥狼窍咯 阿 钱促款 皋春俊 窍唱 捞惑狼 扁夯 疙飞阑 器窃矫诺聪促.
+	CList<UINT, UINT> lstBasicCommands;
+
+	lstBasicCommands.AddTail(ID_FILE_NEW);
+	lstBasicCommands.AddTail(ID_FILE_OPEN);
+	lstBasicCommands.AddTail(ID_FILE_SAVE);
+	lstBasicCommands.AddTail(ID_FILE_PRINT);
+	lstBasicCommands.AddTail(ID_APP_EXIT);
+	lstBasicCommands.AddTail(ID_EDIT_CUT);
+	lstBasicCommands.AddTail(ID_EDIT_PASTE);
+	lstBasicCommands.AddTail(ID_EDIT_UNDO);
+	lstBasicCommands.AddTail(ID_APP_ABOUT);
+	lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR);
+	lstBasicCommands.AddTail(ID_VIEW_TOOLBAR);
+	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003);
+	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005);
+	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE);
+	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER);
+	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK);
+	lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA);
+
+	CMFCToolBar::SetBasicCommands(lstBasicCommands);
+*/
+	GotoTray();
+
+	return 0;
+}
+
+BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+	if( !CFrameWndEx::PreCreateWindow(cs) )
+		return FALSE;
+
+	cs.style = cs.style & ~FWS_ADDTOTITLE;
+	cs.lpszName = _T("PLCConnector");
+	this->SetTitle(_T("PLCConnector"));
+	// TODO: CREATESTRUCT cs甫 荐沥窍咯 咯扁俊辑
+	//  Window 努贰胶 肚绰 胶鸥老阑 荐沥钦聪促.
+
+	return TRUE;
+}
+
+// CMainFrame 柳窜
+
+#ifdef _DEBUG
+void CMainFrame::AssertValid() const
+{
+	CFrameWndEx::AssertValid();
+}
+
+void CMainFrame::Dump(CDumpContext& dc) const
+{
+	CFrameWndEx::Dump(dc);
+}
+#endif //_DEBUG
+
+
+// CMainFrame 皋矫瘤 贸府扁
+
+void CMainFrame::OnViewCustomize()
+{
+	CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog(this, TRUE /* 皋春甫 八祸钦聪促. */);
+	pDlgCust->EnableUserDefinedToolbars();
+	pDlgCust->Create();
+}
+
+LRESULT CMainFrame::OnToolbarCreateNew(WPARAM wp,LPARAM lp)
+{
+	LRESULT lres = CFrameWndEx::OnToolbarCreateNew(wp,lp);
+	if (lres == 0)
+	{
+		return 0;
+	}
+
+	CMFCToolBar* pUserToolbar = (CMFCToolBar*)lres;
+	ASSERT_VALID(pUserToolbar);
+
+	BOOL bNameValid;
+	CString strCustomize;
+	bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
+	ASSERT(bNameValid);
+
+	pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
+	return lres;
+}
+
+void CMainFrame::OnApplicationLook(UINT id)
+{
+	CWaitCursor wait;
+
+	theApp.m_nAppLook = id;
+
+	switch (theApp.m_nAppLook)
+	{
+	case ID_VIEW_APPLOOK_WIN_2000:
+		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager));
+		break;
+
+	case ID_VIEW_APPLOOK_OFF_XP:
+		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP));
+		break;
+
+	case ID_VIEW_APPLOOK_WIN_XP:
+		CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE;
+		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
+		break;
+
+	case ID_VIEW_APPLOOK_OFF_2003:
+		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003));
+		CDockingManager::SetDockingMode(DT_SMART);
+		break;
+
+	case ID_VIEW_APPLOOK_VS_2005:
+		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005));
+		CDockingManager::SetDockingMode(DT_SMART);
+		break;
+
+	default:
+		switch (theApp.m_nAppLook)
+		{
+		case ID_VIEW_APPLOOK_OFF_2007_BLUE:
+			CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue);
+			break;
+
+		case ID_VIEW_APPLOOK_OFF_2007_BLACK:
+			CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
+			break;
+
+		case ID_VIEW_APPLOOK_OFF_2007_SILVER:
+			CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver);
+			break;
+
+		case ID_VIEW_APPLOOK_OFF_2007_AQUA:
+			CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua);
+			break;
+		}
+
+		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007));
+		CDockingManager::SetDockingMode(DT_SMART);
+	}
+
+	RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE);
+
+	theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook);
+}
+
+void CMainFrame::OnUpdateApplicationLook(CCmdUI* pCmdUI)
+{
+	pCmdUI->SetRadio(theApp.m_nAppLook == pCmdUI->m_nID);
+}
+
+BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext) 
+{
+	// 扁夯 努贰胶啊 角力 累诀阑 荐青钦聪促.
+
+	if (!CFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
+	{
+		return FALSE;
+	}
+
+
+	// 葛电 荤侩磊 档备 葛澜俊 荤侩磊 瘤沥 窜眠甫 劝己拳钦聪促.
+	BOOL bNameValid;
+	CString strCustomize;
+	bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
+	ASSERT(bNameValid);
+
+	for (int i = 0; i < iMaxUserToolbars; i ++)
+	{
+		CMFCToolBar* pUserToolbar = GetUserToolBarByIndex(i);
+		if (pUserToolbar != NULL)
+		{
+			pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
+		}
+	}
+
+	return TRUE;
+}
+
+
+void CMainFrame::GotoTray(void)
+{
+	NOTIFYICONDATA nid;
+	::ZeroMemory(&nid, sizeof(nid));
+	nid.cbSize = sizeof(nid);
+	nid.hWnd = m_hWnd;
+	nid.uID = IDR_MAINFRAME;
+	nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
+	nid.uCallbackMessage = UM_TRAY;
+	nid.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+	wsprintf(nid.szTip, _T("%s"), _T("PLCConnector"));
+
+	::Shell_NotifyIcon(NIM_ADD, &nid);
+}
+
+void CMainFrame::OnDestroy()
+{
+
+	NOTIFYICONDATA nid;
+	nid.cbSize = sizeof(nid);
+	nid.hWnd = m_hWnd;
+	nid.uID = IDR_MAINFRAME;
+
+	::Shell_NotifyIcon(NIM_DELETE, &nid);
+
+
+	CFrameWndEx::OnDestroy();
+
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊钦聪促.
+}
+
+void CMainFrame::OnClose()
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+	ShowWindow(SW_HIDE);
+	//CFrameWndEx::OnClose();
+}
+
+LRESULT CMainFrame::OnTray(WPARAM wParam, LPARAM lParam)
+{
+	if(lParam == WM_RBUTTONDOWN)
+	{
+		SetCapture();
+	}
+	else if(lParam == WM_RBUTTONUP)
+	{
+		CMenu menu, *pMenu = NULL;
+		CPoint pt;
+
+		menu.LoadMenu(IDR_Tray);
+		pMenu = menu.GetSubMenu(0);
+
+		GetCursorPos(&pt);
+		SetForegroundWindow();
+		pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,
+								pt.x, pt.y, this);
+		::PostMessage(m_hWnd, WM_NULL, 0, 0);
+
+		ReleaseCapture();
+	}
+	else if(lParam == WM_LBUTTONDBLCLK)
+	{
+		ShowWindow(SW_SHOW);
+		SetForegroundWindow();
+	}
+
+	return 0;
+}
+void CMainFrame::OnAppExit()
+{
+	// TODO: 咯扁俊 疙飞 贸府扁 内靛甫 眠啊钦聪促.
+	CFrameWndEx::OnClose();
+}
+
+void CMainFrame::OnAppShowapplication()
+{
+	// TODO: 咯扁俊 疙飞 贸府扁 内靛甫 眠啊钦聪促.
+	ShowWindow(SW_SHOW);
+}
diff --git a/Common_Class/PLCConnector/MainFrm.h b/Common_Class/PLCConnector/MainFrm.h
new file mode 100644
index 0000000..119406a
--- /dev/null
+++ b/Common_Class/PLCConnector/MainFrm.h
@@ -0,0 +1,57 @@
+
+// MainFrm.h : CMainFrame 努贰胶狼 牢磐其捞胶
+//
+
+#pragma once
+
+class CMainFrame : public CFrameWndEx
+{
+	
+protected: // serialization俊辑父 父甸绢笼聪促.
+	CMainFrame();
+	DECLARE_DYNCREATE(CMainFrame)
+
+// 漂己涝聪促.
+public:
+
+// 累诀涝聪促.
+public:
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+	virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL);
+
+// 备泅涝聪促.
+public:
+	virtual ~CMainFrame();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:  // 牧飘费 葛澜捞 器窃等 糕滚涝聪促.
+	CMFCMenuBar       m_wndMenuBar;
+	CMFCToolBar       m_wndToolBar;
+	CMFCStatusBar     m_wndStatusBar;
+	CMFCToolBarImages m_UserImages;
+
+// 积己等 皋矫瘤 甘 窃荐
+protected:
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnViewCustomize();
+	afx_msg LRESULT OnToolbarCreateNew(WPARAM wp, LPARAM lp);
+	afx_msg LRESULT OnTray(WPARAM wParam, LPARAM lParam);
+	afx_msg void OnApplicationLook(UINT id);
+	afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI);
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void GotoTray(void);
+	afx_msg void OnDestroy();
+	afx_msg void OnClose();
+	afx_msg void OnAppExit();
+	afx_msg void OnAppShowapplication();
+};
+
+
diff --git a/Common_Class/PLCConnector/PLCConnector.cpp b/Common_Class/PLCConnector/PLCConnector.cpp
new file mode 100644
index 0000000..f2473d0
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnector.cpp
@@ -0,0 +1,198 @@
+
+// PLCConnector.cpp : 览侩 橇肺弊伐俊 措茄 努贰胶 悼累阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+#include "afxwinappex.h"
+#include "PLCConnector.h"
+#include "MainFrm.h"
+
+#include "PLCConnectorDoc.h"
+#include "PLCConnectorView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CPLCConnectorApp
+
+BEGIN_MESSAGE_MAP(CPLCConnectorApp, CWinAppEx)
+	ON_COMMAND(ID_APP_ABOUT, &CPLCConnectorApp::OnAppAbout)
+	// 钎霖 颇老阑 扁檬肺 窍绰 巩辑 疙飞涝聪促.
+	ON_COMMAND(ID_FILE_NEW, &CWinAppEx::OnFileNew)
+	ON_COMMAND(ID_FILE_OPEN, &CWinAppEx::OnFileOpen)
+END_MESSAGE_MAP()
+
+
+// CPLCConnectorApp 积己
+
+CPLCConnectorApp::CPLCConnectorApp()
+{
+
+	m_bHiColorIcons = TRUE;
+	m_hDupCheck = NULL;
+
+	// TODO: 咯扁俊 积己 内靛甫 眠啊钦聪促.
+	// InitInstance俊 葛电 吝夸茄 檬扁拳 累诀阑 硅摹钦聪促.
+}
+
+// 蜡老茄 CPLCConnectorApp 俺眉涝聪促.
+
+CPLCConnectorApp theApp;
+
+
+// CPLCConnectorApp 檬扁拳
+
+BOOL CPLCConnectorApp::InitInstance()
+{
+	// 览侩 橇肺弊伐 概聪其胶飘啊 ComCtl32.dll 滚傈 6 捞惑阑 荤侩窍咯 厚林倔 胶鸥老阑
+	// 荤侩窍档废 瘤沥窍绰 版快, Windows XP 惑俊辑 馆靛矫 InitCommonControlsEx()啊 鞘夸钦聪促. 
+	// InitCommonControlsEx()甫 荤侩窍瘤 臼栏搁 芒阑 父甸 荐 绝嚼聪促.
+	INITCOMMONCONTROLSEX InitCtrls;
+	InitCtrls.dwSize = sizeof(InitCtrls);
+	// 览侩 橇肺弊伐俊辑 荤侩且 葛电 傍侩 牧飘费 努贰胶甫 器窃窍档废
+	// 捞 亲格阑 汲沥窍绞矫坷.
+	InitCtrls.dwICC = ICC_WIN95_CLASSES;
+	InitCommonControlsEx(&InitCtrls);
+
+	CWinAppEx::InitInstance();
+
+	// OLE 扼捞宏矾府甫 檬扁拳钦聪促.
+	if (!AfxOleInit())
+	{
+		AfxMessageBox(IDP_OLE_INIT_FAILED);
+		return FALSE;
+	}
+	AfxEnableControlContainer();
+	// 钎霖 檬扁拳
+	// 捞甸 扁瓷阑 荤侩窍瘤 臼绊 弥辆 角青 颇老狼 农扁甫 临捞妨搁
+	// 酒贰俊辑 鞘夸 绝绰 漂沥 檬扁拳
+	// 风凭阑 力芭秦具 钦聪促.
+	// 秦寸 汲沥捞 历厘等 饭瘤胶飘府 虐甫 函版窍绞矫坷.
+
+	m_hDupCheck = ::CreateEvent(NULL,FALSE, FALSE,
+								_T("DUPLICATION_CHECK_EVENT"));
+	if(::GetLastError() == ERROR_ALREADY_EXISTS)
+	{
+		//AfxMessageBox(_T("ERROR::Application is running!"));
+		return FALSE;
+	}
+	// TODO: 捞 巩磊凯阑 雀荤 肚绰 炼流狼 捞抚苞 鞍篮
+	// 利例茄 郴侩栏肺 荐沥秦具 钦聪促.
+	SetRegistryKey(_T("肺拿 览侩 橇肺弊伐 付过荤俊辑 积己等 览侩 橇肺弊伐"));
+	LoadStdProfileSettings(4);  // MRU甫 器窃窍咯 钎霖 INI 颇老 可记阑 肺靛钦聪促.
+
+	InitContextMenuManager();
+
+	InitKeyboardManager();
+
+	InitTooltipManager();
+	CMFCToolTipInfo ttParams;
+	ttParams.m_bVislManagerTheme = TRUE;
+	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
+		RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
+
+	// 览侩 橇肺弊伐狼 巩辑 袍敲复阑 殿废钦聪促. 巩辑 袍敲复篮
+	//  巩辑, 橇饭烙 芒 棺 轰 荤捞狼 楷搬 开且阑 钦聪促.
+	CSingleDocTemplate* pDocTemplate;
+	pDocTemplate = new CSingleDocTemplate(
+		IDR_MAINFRAME,
+		RUNTIME_CLASS(CPLCConnectorDoc),
+		RUNTIME_CLASS(CMainFrame),       // 林 SDI 橇饭烙 芒涝聪促.
+		RUNTIME_CLASS(CPLCConnectorView));
+	if (!pDocTemplate)
+		return FALSE;
+	AddDocTemplate(pDocTemplate);
+
+
+
+	// 钎霖 夹 疙飞, DDE, 颇老 凯扁俊 措茄 疙飞临阑 备巩 盒籍钦聪促.
+	CCommandLineInfo cmdInfo;
+	ParseCommandLine(cmdInfo);
+
+
+	// 疙飞临俊 瘤沥等 疙飞阑 叼胶菩摹钦聪促.
+	// 览侩 橇肺弊伐捞 /RegServer, /Register, /Unregserver 肚绰 /Unregister肺 矫累等 版快 FALSE甫 馆券钦聪促.
+	if (!ProcessShellCommand(cmdInfo))
+		return FALSE;
+
+	// 芒 窍唱父 檬扁拳登菌栏骨肺 捞甫 钎矫窍绊 诀单捞飘钦聪促.
+	m_pMainWnd->ShowWindow(SW_SHOW);
+	m_pMainWnd->UpdateWindow();
+	// 立固荤啊 乐阑 版快俊父 DragAcceptFiles甫 龋免钦聪促.
+	//  SDI 览侩 橇肺弊伐俊辑绰 ProcessShellCommand 饶俊 捞矾茄 龋免捞 惯积秦具 钦聪促.
+	return TRUE;
+}
+
+
+
+// 览侩 橇肺弊伐 沥焊俊 荤侩登绰 CAboutDlg 措拳 惑磊涝聪促.
+
+class CAboutDlg : public CDialog
+{
+public:
+	CAboutDlg();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_ABOUTBOX };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+// 备泅涝聪促.
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+END_MESSAGE_MAP()
+
+// 措拳 惑磊甫 角青窍扁 困茄 览侩 橇肺弊伐 疙飞涝聪促.
+void CPLCConnectorApp::OnAppAbout()
+{
+	CAboutDlg aboutDlg;
+	aboutDlg.DoModal();
+}
+
+// CPLCConnectorApp 荤侩磊 瘤沥 肺靛/历厘 皋辑靛
+
+void CPLCConnectorApp::PreLoadState()
+{
+	BOOL bNameValid;
+	CString strName;
+	bNameValid = strName.LoadString(IDS_EDIT_MENU);
+	ASSERT(bNameValid);
+	GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT);
+}
+
+void CPLCConnectorApp::LoadCustomState()
+{
+}
+
+void CPLCConnectorApp::SaveCustomState()
+{
+}
+
+// CPLCConnectorApp 皋矫瘤 贸府扁
+
+
+
+
+int CPLCConnectorApp::ExitInstance()
+{
+	// TODO: 咯扁俊 漂荐拳等 内靛甫 眠啊 棺/肚绰 扁夯 努贰胶甫 龋免钦聪促.
+	if( m_hDupCheck != NULL)
+		::CloseHandle(m_hDupCheck);
+
+	return CWinAppEx::ExitInstance();
+}
diff --git a/Common_Class/PLCConnector/PLCConnector.h b/Common_Class/PLCConnector/PLCConnector.h
new file mode 100644
index 0000000..f35d9c2
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnector.h
@@ -0,0 +1,41 @@
+
+// PLCConnector.h : PLCConnector 览侩 橇肺弊伐俊 措茄 林 庆歹 颇老
+//
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "PCH俊 措秦 捞 颇老阑 器窃窍扁 傈俊 'stdafx.h'甫 器窃钦聪促."
+#endif
+
+#include "resource.h"       // 林 扁龋涝聪促.
+
+
+// CPLCConnectorApp:
+// 捞 努贰胶狼 备泅俊 措秦辑绰 PLCConnector.cpp阑 曼炼窍绞矫坷.
+//
+
+class CPLCConnectorApp : public CWinAppEx
+{
+public:
+	CPLCConnectorApp();
+
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL InitInstance();
+
+// 备泅涝聪促.
+	HANDLE m_hDupCheck;
+	UINT  m_nAppLook;
+	BOOL  m_bHiColorIcons;
+
+	virtual void PreLoadState();
+	virtual void LoadCustomState();
+	virtual void SaveCustomState();
+
+	afx_msg void OnAppAbout();
+	DECLARE_MESSAGE_MAP()
+	virtual int ExitInstance();
+};
+
+extern CPLCConnectorApp theApp;
diff --git a/Common_Class/PLCConnector/PLCConnector.ini b/Common_Class/PLCConnector/PLCConnector.ini
new file mode 100644
index 0000000..af5bb4e
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnector.ini
@@ -0,0 +1,17 @@
+[SAVE_OPTION]
+ADDRESS_TOREAD_SIGNAL0=D2300
+USEREADSIGNAL0=1
+ADDRESS_TOREAD_SIGNAL1=D2300
+USEREADSIGNAL1=0
+ADDRESS_TOREAD_SIGNAL2=D2300
+USEREADSIGNAL2=0
+ADDRESS_TOREAD_SIGNAL3=D2300
+USEREADSIGNAL3=0
+ADDRESS_TOREAD_SIGNAL4=D2300
+USEREADSIGNAL4=0
+USE_AOISIGNAL=1
+STATION_NO=10
+AOISERVER_CAPTION=RCutInspector
+PROTOCOL=1
+IP_ADDRESS=2120508466
+PORT_NO=4096
diff --git a/Common_Class/PLCConnector/PLCConnector.rc b/Common_Class/PLCConnector/PLCConnector.rc
new file mode 100644
index 0000000..357c32c
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnector.rc
@@ -0,0 +1,540 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// 茄惫绢(措茄刮惫) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
+#pragma code_page(949)
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#ifndef APSTUDIO_INVOKED\r\n"
+    "#include ""targetver.h""\r\n"
+    "#endif\r\n"
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
+    "LANGUAGE 18, 1\r\n"
+    "#pragma code_page(949)\r\n"
+    "#include ""res\\PLCConnector.rc2""  // Microsoft Visual C++ AIUAC ⅴU⊥ レレ【々 āiAyCN ㈢OìAOⅴIⅴU.\r\n"
+    "#include ""l.KOR\\afxres.rc""          // C⊥Aí 【ì aOAOⅴIⅴU.\r\n"
+    "#if !defined(_AFXDLL)\r\n"
+    "#include ""l.KOR\\afxprint.rc""                // AIa I㈢ ì【a ㈢Oì\r\n"
+    "#include ""l.KOR\\afxribbon.rc""               // MFC ㈢ì№ 】 AAā㈢·N ·ⅴe ㈢Oì\r\n"
+    "#endif\r\n"
+    "#endif\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME           ICON                    "res\\PLCConnector.ico"
+IDR_PLCConnectorTYPE    ICON                    "res\\PLCConnectorDoc.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDR_MAINFRAME           BITMAP                  "res\\Toolbar.bmp"
+IDR_MAINFRAME_256       BITMAP                  "res\\Toolbar256.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Toolbar
+//
+
+IDR_MAINFRAME TOOLBAR 16, 16
+BEGIN
+    BUTTON      ID_FILE_NEW
+    BUTTON      ID_FILE_OPEN
+    BUTTON      ID_FILE_SAVE
+    SEPARATOR
+    BUTTON      ID_EDIT_CUT
+    BUTTON      ID_EDIT_COPY
+    BUTTON      ID_EDIT_PASTE
+    SEPARATOR
+    BUTTON      ID_FILE_PRINT
+    BUTTON      ID_APP_ABOUT
+END
+
+IDR_MAINFRAME_256 TOOLBAR 16, 16
+BEGIN
+    BUTTON      ID_FILE_NEW
+    BUTTON      ID_FILE_OPEN
+    BUTTON      ID_FILE_SAVE
+    SEPARATOR
+    BUTTON      ID_EDIT_CUT
+    BUTTON      ID_EDIT_COPY
+    BUTTON      ID_EDIT_PASTE
+    SEPARATOR
+    BUTTON      ID_FILE_PRINT
+    BUTTON      ID_APP_ABOUT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MAINFRAME MENU
+BEGIN
+    POPUP "颇老(&F)", INACTIVE
+    BEGIN
+        MENUITEM "货肺 父甸扁(&N)\tCtrl+N",          ID_FILE_NEW
+        MENUITEM "凯扁(&O)...\tCtrl+O",           ID_FILE_OPEN
+        MENUITEM "历厘(&S)\tCtrl+S",              ID_FILE_SAVE
+        MENUITEM "促弗 捞抚栏肺 历厘(&A)...",           ID_FILE_SAVE_AS
+        MENUITEM SEPARATOR
+        MENUITEM "弥辟俊 荤侩茄 颇老",                  ID_FILE_MRU_FILE1, GRAYED
+        MENUITEM SEPARATOR
+        MENUITEM "场郴扁(&X)",                     ID_APP_EXIT
+    END
+    POPUP "祈笼(&E)", INACTIVE
+    BEGIN
+        MENUITEM "角青 秒家(&U)\tCtrl+Z",           ID_EDIT_UNDO
+        MENUITEM SEPARATOR
+        MENUITEM "肋扼郴扁(&T)\tCtrl+X",            ID_EDIT_CUT
+        MENUITEM "汗荤(&C)\tCtrl+C",              ID_EDIT_COPY
+        MENUITEM "嘿咯持扁(&P)\tCtrl+V",            ID_EDIT_PASTE
+    END
+    POPUP "焊扁(&V)", INACTIVE
+    BEGIN
+        POPUP "档备 葛澜 棺 档欧 芒(&T)"
+        BEGIN
+            MENUITEM "<磊府 钎矫磊>",                    ID_VIEW_TOOLBAR
+        END
+        MENUITEM "惑怕 钎矫临(&S)",                  ID_VIEW_STATUS_BAR
+        POPUP "览侩 橇肺弊伐 葛剧(&A)"
+        BEGIN
+            MENUITEM "Windows 2000(&2)",            ID_VIEW_APPLOOK_WIN_2000
+            MENUITEM "Office XP(&X)",               ID_VIEW_APPLOOK_OFF_XP
+            MENUITEM "Windows XP(&W)",              ID_VIEW_APPLOOK_WIN_XP
+            MENUITEM "Office 2003(&3)",             ID_VIEW_APPLOOK_OFF_2003
+            MENUITEM "Visual Studio.NET 2005(&5)",  ID_VIEW_APPLOOK_VS_2005
+            POPUP "Office 2007(&7)"
+            BEGIN
+                MENUITEM "颇尔 胶鸥老(&B)",                  ID_VIEW_APPLOOK_OFF_2007_BLUE
+                MENUITEM "八沥 胶鸥老(&L)",                  ID_VIEW_APPLOOK_OFF_2007_BLACK
+                MENUITEM "篮祸 胶鸥老(&S)",                  ID_VIEW_APPLOOK_OFF_2007_SILVER
+                MENUITEM "官促祸 胶鸥老(&A)",                 ID_VIEW_APPLOOK_OFF_2007_AQUA
+            END
+        END
+    END
+    POPUP "券版汲沥"
+    BEGIN
+        MENUITEM "券版汲沥",                        ID_SET_OPTION
+    END
+    POPUP "档框富(&H)"
+    BEGIN
+        MENUITEM "PLCConnector 沥焊(&A)...",      ID_APP_ABOUT
+    END
+END
+
+IDR_POPUP_EDIT MENU
+BEGIN
+    POPUP "祈笼"
+    BEGIN
+        MENUITEM "肋扼郴扁(&T)\tCtrl+X",            ID_EDIT_CUT
+        MENUITEM "汗荤(&C)\tCtrl+C",              ID_EDIT_COPY
+        MENUITEM "嘿咯持扁(&P)\tCtrl+V",            ID_EDIT_PASTE
+    END
+END
+
+IDR_THEME_MENU MENU
+BEGIN
+    MENUITEM "Office 2007(颇尔 胶鸥老)(&B)",     ID_VIEW_APPLOOK_OFF_2007_BLUE
+    MENUITEM "Office 2007(八沥 胶鸥老)(&L)",     ID_VIEW_APPLOOK_OFF_2007_BLACK
+    MENUITEM "Office 2007(篮祸 胶鸥老)(&S)",     ID_VIEW_APPLOOK_OFF_2007_SILVER
+    MENUITEM "Office 2007(官促祸 胶鸥老)(&A)",    ID_VIEW_APPLOOK_OFF_2007_AQUA
+END
+
+IDR_Tray MENU
+BEGIN
+    POPUP "_TRAY_MENU_"
+    BEGIN
+        MENUITEM "Show Application",            ID_APP_SHOWAPPLICATION
+        MENUITEM SEPARATOR
+        MENUITEM "EXIT",                        ID_APP_EXIT
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_MAINFRAME ACCELERATORS
+BEGIN
+    "N",            ID_FILE_NEW,            VIRTKEY, CONTROL
+    "O",            ID_FILE_OPEN,           VIRTKEY, CONTROL
+    "S",            ID_FILE_SAVE,           VIRTKEY, CONTROL
+    "Z",            ID_EDIT_UNDO,           VIRTKEY, CONTROL
+    "X",            ID_EDIT_CUT,            VIRTKEY, CONTROL
+    "C",            ID_EDIT_COPY,           VIRTKEY, CONTROL
+    "V",            ID_EDIT_PASTE,          VIRTKEY, CONTROL
+    VK_BACK,        ID_EDIT_UNDO,           VIRTKEY, ALT
+    VK_DELETE,      ID_EDIT_CUT,            VIRTKEY, SHIFT
+    VK_INSERT,      ID_EDIT_COPY,           VIRTKEY, CONTROL
+    VK_INSERT,      ID_EDIT_PASTE,          VIRTKEY, SHIFT
+    VK_F6,          ID_NEXT_PANE,           VIRTKEY 
+    VK_F6,          ID_PREV_PANE,           VIRTKEY, SHIFT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "PLCConnector 沥焊"
+FONT 9, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+    ICON            IDR_MAINFRAME,IDC_STATIC,14,14,21,20
+    LTEXT           "PLCConnector, 滚傈 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
+    LTEXT           "Copyright (C) 2011",IDC_STATIC,42,26,114,8
+    DEFPUSHBUTTON   "犬牢",IDOK,113,41,50,14,WS_GROUP
+END
+
+IDD_PLCCONNECTOR_FORM DIALOGEX 0, 0, 364, 279
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 9, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+    LISTBOX         IDC_ConnetorSatate,7,7,291,265,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "磊悼胶农费",IDC_CHECK_Scroll,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,304,7,50,10
+    CONTROL         "",IDC_ACTUTLTYPE1,
+                    "{63885648-1785-41A4-82D5-C578D29E4DA8}",WS_TABSTOP,339,58,18,18
+END
+
+IDD_SET_OPTION DIALOGEX 0, 0, 345, 184
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "券版汲沥"
+FONT 8, "奔覆", 400, 0, 0x81
+BEGIN
+    DEFPUSHBUTTON   "犬牢",IDOK,224,163,50,14
+    PUSHBUTTON      "秒家",IDCANCEL,287,163,50,14
+    EDITTEXT        IDC_PLCAddress0,53,27,57,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_PLCAddress1,53,45,57,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_PLCAddress2,53,63,57,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_PLCAddress3,53,81,57,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_PLCAddress4,53,99,57,14,ES_AUTOHSCROLL
+    LTEXT           "Read PLC 林家",IDC_STATIC,58,14,50,8
+    LTEXT           "Signal 1 :",IDC_STATIC,15,30,30,8
+    LTEXT           "Signal 3 :",IDC_STATIC,15,65,30,8
+    LTEXT           "Signal 4 :",IDC_STATIC,15,83,30,8
+    LTEXT           "Signal 5 :",IDC_STATIC,15,102,30,8
+    CONTROL         "荤侩",IDC_CHECK_Signal0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,29,32,10
+    CONTROL         "荤侩",IDC_CHECK_Signal1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,47,32,10
+    CONTROL         "荤侩",IDC_CHECK_Signal2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,65,32,10
+    CONTROL         "荤侩",IDC_CHECK_Signal3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,83,32,10
+    CONTROL         "荤侩",IDC_CHECK_Signal4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,116,101,32,10
+    CONTROL         "MC Protocol",IDC_RADIO_MCProtocol,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_GROUP,218,21,54,10
+    CONTROL         "MX Component",IDC_RADIO_MXComponent,"Button",BS_AUTORADIOBUTTON,218,35,64,10
+    CONTROL         "",IDC_IPPLCAddress,"SysIPAddress32",NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,217,56,100,15
+    EDITTEXT        IDC_EDIT_PLCPort,218,78,40,14,ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED
+    EDITTEXT        IDC_EDIT_StationNo,218,99,40,14,ES_AUTOHSCROLL
+    LTEXT           "Signal 2 :",IDC_STATIC,15,49,30,8
+    LTEXT           "PLC IP :",IDC_STATIC,172,59,26,8,NOT WS_VISIBLE
+    LTEXT           "Port :",IDC_STATIC,172,81,19,8,NOT WS_VISIBLE
+    LTEXT           "Station No. :",IDC_STATIC,173,101,42,8
+    EDITTEXT        IDC_EDIT_AOISERVER_CAPTION,218,128,102,14,ES_AUTOHSCROLL
+    LTEXT           "AOIServer Caption :",IDC_STATIC,149,130,66,8
+    CONTROL         "AOIServer 烹脚荤侩",IDC_CHECK_AOISIGNAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,117,96,10
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "041203b5"
+        BEGIN
+            VALUE "CompanyName", "TODO: <雀荤 捞抚>"
+            VALUE "FileDescription", "TODO: <颇老 汲疙>"
+            VALUE "FileVersion", "1.0.0.1"
+            VALUE "InternalName", "PLCConnector.exe"
+            VALUE "LegalCopyright", "TODO: (c) <雀荤 捞抚>.  All rights reserved."
+            VALUE "OriginalFilename", "PLCConnector.exe"
+            VALUE "ProductName", "TODO: <力前 捞抚>"
+            VALUE "ProductVersion", "1.0.0.1"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x412, 949
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+    IDD_ABOUTBOX, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 163
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 55
+    END
+
+    IDD_PLCCONNECTOR_FORM, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 357
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 272
+    END
+
+    IDD_SET_OPTION, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 338
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 177
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_PLCCONNECTOR_FORM DLGINIT
+BEGIN
+    IDC_ACTUTLTYPE1, 0x376, 30, 0
+0x0000, 0x0000, 0x0a00, 0x0000, 0x034f, 0x0000, 0x034f, 0x0000, 0x0003, 
+0x0000, 0x0000, 0x0008, 0x0002, 0x0000, 0x0000, 
+    0
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+    IDP_OLE_INIT_FAILED     "OLE甫 檬扁拳且 荐 绝嚼聪促. OLE 扼捞宏矾府 滚傈捞 棵官弗瘤 犬牢窍绞矫坷."
+    IDS_STRING101           "IDS_STRING104"
+    IDS_STRING102           "Not Enter DeviceName Error."
+    IDS_STRING103           "Open OLE IDispatch Interface Error!"
+    IDS_STRING104           "Close OLE IDispatch Interface Error!"
+    IDS_STRING105           "CPUType OLE IDispatch Interface Error!"
+END
+
+STRINGTABLE
+BEGIN
+    IDR_MAINFRAME           "PLCConnector\n\nPLCConnector\n\n\nPLCConnector.Document\nPLCConnector.Document"
+END
+
+STRINGTABLE
+BEGIN
+    AFX_IDS_APP_TITLE       "PLCConnector"
+    AFX_IDS_IDLEMESSAGE     "霖厚"
+END
+
+STRINGTABLE
+BEGIN
+    ID_INDICATOR_EXT        "EXT"
+    ID_INDICATOR_CAPS       "CAP"
+    ID_INDICATOR_NUM        "NUM"
+    ID_INDICATOR_SCRL       "SCRL"
+    ID_INDICATOR_OVR        "OVR"
+    ID_INDICATOR_REC        "REC"
+END
+
+STRINGTABLE
+BEGIN
+    ID_FILE_NEW             "货 巩辑甫 父奠聪促.\n货肺 父甸扁"
+    ID_FILE_OPEN            "扁粮 巩辑甫 勘聪促.\n凯扁"
+    ID_FILE_CLOSE           "劝己 巩辑甫 摧嚼聪促.\n摧扁"
+    ID_FILE_SAVE            "劝己 巩辑甫 历厘钦聪促.\n历厘"
+    ID_FILE_SAVE_AS         "劝己 巩辑甫 货 捞抚栏肺 历厘钦聪促.\n促弗 捞抚栏肺 历厘"
+END
+
+STRINGTABLE
+BEGIN
+    ID_APP_ABOUT            "橇肺弊伐 沥焊, 滚傈 锅龋, 历累鼻阑 钎矫钦聪促.\n沥焊"
+    ID_APP_EXIT             "巩辑甫 历厘且瘤甫 汞绊 览侩 橇肺弊伐阑 场忱聪促.\n场郴扁"
+END
+
+STRINGTABLE
+BEGIN
+    ID_FILE_MRU_FILE1       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE2       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE3       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE4       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE5       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE6       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE7       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE8       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE9       "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE10      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE11      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE12      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE13      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE14      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE15      "泅犁 巩辑甫 勘聪促."
+    ID_FILE_MRU_FILE16      "泅犁 巩辑甫 勘聪促."
+END
+
+STRINGTABLE
+BEGIN
+    ID_NEXT_PANE            "促澜 芒栏肺 傈券钦聪促.\n促澜 芒"
+    ID_PREV_PANE            "捞傈 芒栏肺 傈券钦聪促.\n捞傈 芒"
+END
+
+STRINGTABLE
+BEGIN
+    ID_WINDOW_SPLIT         "劝己 芒阑 咯矾 俺狼 芒栏肺 盒且钦聪促.\n盒且"
+END
+
+STRINGTABLE
+BEGIN
+    ID_EDIT_CLEAR           "急琶 康开阑 瘤矿聪促.\n瘤快扁"
+    ID_EDIT_CLEAR_ALL       "葛滴 瘤矿聪促.\n葛滴 瘤快扁"
+    ID_EDIT_COPY            "急琶 康开阑 汗荤窍咯 努赋焊靛俊 持嚼聪促.\n汗荤"
+    ID_EDIT_CUT             "急琶 康开阑 肋扼郴绢 努赋焊靛俊 持嚼聪促.\n肋扼郴扁"
+    ID_EDIT_FIND            "瘤沥茄 咆胶飘甫 茫嚼聪促.\n茫扁"
+    ID_EDIT_PASTE           "努赋焊靛 郴侩阑 火涝钦聪促.\n嘿咯持扁"
+    ID_EDIT_REPEAT          "付瘤阜 累诀阑 馆汗钦聪促.\n馆汗"
+    ID_EDIT_REPLACE         "漂沥 咆胶飘甫 促弗 咆胶飘肺 官策聪促.\n官操扁"
+    ID_EDIT_SELECT_ALL      "傈眉 巩辑甫 急琶钦聪促.\n葛滴 急琶"
+    ID_EDIT_UNDO            "付瘤阜 累诀 角青阑 秒家钦聪促.\n角青 秒家"
+    ID_EDIT_REDO            "捞傈俊 角青 秒家等 累诀阑 促矫 角青钦聪促.\n促矫 角青"
+END
+
+STRINGTABLE
+BEGIN
+    ID_VIEW_STATUS_BAR      "惑怕 钎矫临阑 钎矫窍芭唱 见遍聪促.\n惑怕 钎矫临 汲沥/秦力"
+END
+
+STRINGTABLE
+BEGIN
+    AFX_IDS_SCSIZE          "芒 农扁甫 函版钦聪促."
+    AFX_IDS_SCMOVE          "芒 困摹甫 函版钦聪促."
+    AFX_IDS_SCMINIMIZE      "芒阑 酒捞能栏肺 绵家钦聪促."
+    AFX_IDS_SCMAXIMIZE      "芒阑 傈眉 拳搁 农扁肺 犬措钦聪促."
+    AFX_IDS_SCNEXTWINDOW    "促澜 巩辑 芒栏肺 傈券钦聪促."
+    AFX_IDS_SCPREVWINDOW    "捞傈 巩辑 芒栏肺 傈券钦聪促."
+    AFX_IDS_SCCLOSE         "巩辑甫 历厘且 巴牢瘤 犬牢窍绊 劝己 芒阑 摧嚼聪促."
+END
+
+STRINGTABLE
+BEGIN
+    AFX_IDS_SCRESTORE       "芒阑 焊烹 农扁肺 汗盔钦聪促."
+    AFX_IDS_SCTASKLIST      "累诀 格废阑 劝己拳钦聪促."
+END
+
+STRINGTABLE
+BEGIN
+    IDS_STATUS_PANE1        "芒 1"
+    IDS_STATUS_PANE2        "芒 2"
+    IDS_TOOLBAR_STANDARD    "钎霖"
+    IDS_TOOLBAR_CUSTOMIZE   "荤侩磊 瘤沥..."
+END
+
+STRINGTABLE
+BEGIN
+    IDS_EDIT_MENU           "祈笼"
+END
+
+#endif    // 茄惫绢(措茄刮惫) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE 18, 1
+#pragma code_page(949)
+#include "res\PLCConnector.rc2"  // Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶涝聪促.
+#include "l.KOR\afxres.rc"          // 钎霖 备己 夸家涝聪促.
+#if !defined(_AFXDLL)
+#include "l.KOR\afxprint.rc"                // 牢尖 固府 焊扁 府家胶
+#include "l.KOR\afxribbon.rc"               // MFC 府夯 棺 牧飘费 阜措 府家胶
+#endif
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/Common_Class/PLCConnector/PLCConnector.vcxproj b/Common_Class/PLCConnector/PLCConnector.vcxproj
new file mode 100644
index 0000000..3ea5e61
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnector.vcxproj
@@ -0,0 +1,490 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug_B5_RCut|Win32">
+      <Configuration>Debug_B5_RCut</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug_B5_RCut|x64">
+      <Configuration>Debug_B5_RCut</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release_B5_RCut|Win32">
+      <Configuration>Release_B5_RCut</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release_B5_RCut|x64">
+      <Configuration>Release_B5_RCut</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Template|Win32">
+      <Configuration>Template</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Template|x64">
+      <Configuration>Template</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}</ProjectGuid>
+    <RootNamespace>PLCConnector</RootNamespace>
+    <Keyword>MFCProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x64\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|Win32'">$(SolutionDir)x64\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">x64\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|Win32'">x64\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\鞁ろ枆韺岇澕\Debug\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|x64'">..\..\鞁ろ枆韺岇澕\Debug\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x64\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|Win32'">$(SolutionDir)x64\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">x64\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|Win32'">x64\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\鞁ろ枆韺岇澕\Release\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|x64'">..\..\鞁ろ枆韺岇澕\Release\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|x64'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>../../Global_Include</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>../RCut_Include</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>../../Global_Include</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>../RCut_Include</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
+    <Link>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+      <OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
+    </Link>
+    <ClCompile>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="acteasyif1.cpp" />
+    <ClCompile Include="MainFrm.cpp" />
+    <ClCompile Include="PLCConnector.cpp" />
+    <ClCompile Include="PLCConnectorDoc.cpp" />
+    <ClCompile Include="PLCConnectorView.cpp" />
+    <ClCompile Include="SetOptionDlg.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug_B5_RCut|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_B5_RCut|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="acteasyif1.h" />
+    <ClInclude Include="MainFrm.h" />
+    <ClInclude Include="PLCConnector.h" />
+    <ClInclude Include="PLCConnectorDoc.h" />
+    <ClInclude Include="PLCConnectorView.h" />
+    <ClInclude Include="resource.h" />
+    <ClInclude Include="SetOptionDlg.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\PLCConnector.ico" />
+    <None Include="res\PLCConnector.rc2" />
+    <None Include="res\PLCConnectorDoc.ico" />
+    <None Include="res\Toolbar.bmp" />
+    <None Include="res\Toolbar256.bmp" />
+    <None Include="UserImages.bmp" />
+    <None Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="PLCConnector.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="PLCConnector.rc" _x007B_5AF69F12-AE9B-11D3-83AE-00A024BDBF2B_x007D_="CActeasyif1" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/PLCConnector/PLCConnector.vcxproj.filters b/Common_Class/PLCConnector/PLCConnector.vcxproj.filters
new file mode 100644
index 0000000..40424f8
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnector.vcxproj.filters
@@ -0,0 +1,95 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="acteasyif1.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="MainFrm.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="PLCConnector.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="PLCConnectorDoc.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="PLCConnectorView.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SetOptionDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="acteasyif1.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="MainFrm.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="PLCConnector.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="PLCConnectorDoc.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="PLCConnectorView.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="SetOptionDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\PLCConnector.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\PLCConnector.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\PLCConnectorDoc.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Toolbar.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Toolbar256.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="UserImages.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="PLCConnector.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/PLCConnector/PLCConnectorDoc.cpp b/Common_Class/PLCConnector/PLCConnectorDoc.cpp
new file mode 100644
index 0000000..6352e37
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnectorDoc.cpp
@@ -0,0 +1,79 @@
+
+// PLCConnectorDoc.cpp : CPLCConnectorDoc 努贰胶狼 备泅
+//
+
+#include "stdafx.h"
+#include "PLCConnector.h"
+
+#include "PLCConnectorDoc.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CPLCConnectorDoc
+
+IMPLEMENT_DYNCREATE(CPLCConnectorDoc, CDocument)
+
+BEGIN_MESSAGE_MAP(CPLCConnectorDoc, CDocument)
+END_MESSAGE_MAP()
+
+
+// CPLCConnectorDoc 积己/家戈
+
+CPLCConnectorDoc::CPLCConnectorDoc()
+{
+	// TODO: 咯扁俊 老雀己 积己 内靛甫 眠啊钦聪促.
+
+}
+
+CPLCConnectorDoc::~CPLCConnectorDoc()
+{
+}
+
+BOOL CPLCConnectorDoc::OnNewDocument()
+{
+	if (!CDocument::OnNewDocument())
+		return FALSE;
+
+	// TODO: 咯扁俊 犁檬扁拳 内靛甫 眠啊钦聪促.
+	// SDI 巩辑绰 捞 巩辑甫 促矫 荤侩钦聪促.
+
+	return TRUE;
+}
+
+
+
+
+// CPLCConnectorDoc serialization
+
+void CPLCConnectorDoc::Serialize(CArchive& ar)
+{
+	if (ar.IsStoring())
+	{
+		// TODO: 咯扁俊 历厘 内靛甫 眠啊钦聪促.
+	}
+	else
+	{
+		// TODO: 咯扁俊 肺爹 内靛甫 眠啊钦聪促.
+	}
+}
+
+
+// CPLCConnectorDoc 柳窜
+
+#ifdef _DEBUG
+void CPLCConnectorDoc::AssertValid() const
+{
+	CDocument::AssertValid();
+}
+
+void CPLCConnectorDoc::Dump(CDumpContext& dc) const
+{
+	CDocument::Dump(dc);
+}
+#endif //_DEBUG
+
+
+// CPLCConnectorDoc 疙飞
diff --git a/Common_Class/PLCConnector/PLCConnectorDoc.h b/Common_Class/PLCConnector/PLCConnectorDoc.h
new file mode 100644
index 0000000..5b0e227
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnectorDoc.h
@@ -0,0 +1,41 @@
+
+// PLCConnectorDoc.h : CPLCConnectorDoc 努贰胶狼 牢磐其捞胶
+//
+
+
+#pragma once
+
+
+class CPLCConnectorDoc : public CDocument
+{
+protected: // serialization俊辑父 父甸绢笼聪促.
+	CPLCConnectorDoc();
+	DECLARE_DYNCREATE(CPLCConnectorDoc)
+
+// 漂己涝聪促.
+public:
+
+// 累诀涝聪促.
+public:
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL OnNewDocument();
+	virtual void Serialize(CArchive& ar);
+
+// 备泅涝聪促.
+public:
+	virtual ~CPLCConnectorDoc();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// 积己等 皋矫瘤 甘 窃荐
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+
diff --git a/Common_Class/PLCConnector/PLCConnectorView.cpp b/Common_Class/PLCConnector/PLCConnectorView.cpp
new file mode 100644
index 0000000..aeb84ac
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnectorView.cpp
@@ -0,0 +1,1358 @@
+
+// PLCConnectorView.cpp : CPLCConnectorView 努贰胶狼 备泅
+//
+
+#include "stdafx.h"
+#include "PLCConnector.h"
+
+#include "PLCConnectorDoc.h"
+#include "PLCConnectorView.h"
+
+#include "SetOptionDlg.h"
+
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+#define		ID_TIMER_PLCCONNECTOR		1010
+#define		COPYDATA_PLCCONNECTOR		2421
+
+// CPLCConnectorView
+
+IMPLEMENT_DYNCREATE(CPLCConnectorView, CFormView)
+
+BEGIN_MESSAGE_MAP(CPLCConnectorView, CFormView)
+	ON_WM_DESTROY()
+	ON_COMMAND(ID_SET_OPTION, &CPLCConnectorView::OnSetOption)
+	ON_MESSAGE(UM_EXITPROGRAM,&CPLCConnectorView::OnExitProgram)
+	ON_MESSAGE(UM_PRINTPLCDATA,&CPLCConnectorView::OnPrintListPLCData)
+	ON_BN_CLICKED(IDC_CHECK_Scroll, &CPLCConnectorView::OnBnClickedCheckScroll)
+	ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+// CPLCConnectorView 积己/家戈
+bool CPLCConnectorView::m_bThreadEnd = false;
+
+CPLCConnectorView::CPLCConnectorView()
+: CFormView(CPLCConnectorView::IDD)
+, m_bExit(false)
+,m_ReadEvent_1(FALSE,FALSE,_T("PLCConnector_Event_1"))
+,m_ReadEvent_2(FALSE,FALSE,_T("PLCConnector_Event_2"))
+,m_ReadEvent_3(FALSE,FALSE,_T("PLCConnector_Event_3"))
+, m_bAutoScroll(TRUE)
+{
+	//拱幅 单捞磐甫 淬绊 乐绰 PLC 林家 蔼
+	memset(m_AddressToReadLongData,0x00,7*sizeof(TCHAR));
+	m_ReadCount = 0;
+	m_pSharedMemory = NULL;
+}
+
+CPLCConnectorView::~CPLCConnectorView()
+{
+	
+}
+
+void CPLCConnectorView::DoDataExchange(CDataExchange* pDX)
+{
+	CFormView::DoDataExchange(pDX);
+	//DDX_Control(pDX, IDC_ACTEASYIF1, m_MXComponent);
+	DDX_Control(pDX, IDC_ACTUTLTYPE1, m_MXComponent);
+	DDX_Control(pDX, IDC_ConnetorSatate, m_ConnectorState);
+	DDX_Check(pDX, IDC_CHECK_Scroll, m_bAutoScroll);
+}
+
+BOOL CPLCConnectorView::PreCreateWindow(CREATESTRUCT& cs)
+{
+	// TODO: CREATESTRUCT cs甫 荐沥窍咯 咯扁俊辑
+	//  Window 努贰胶 肚绰 胶鸥老阑 荐沥钦聪促.
+
+	return CFormView::PreCreateWindow(cs);
+}
+
+void CPLCConnectorView::OnInitialUpdate()
+{
+	CFormView::OnInitialUpdate();
+	GetParentFrame()->RecalcLayout();
+	ResizeParentToFit();
+
+	//阿 糕滚函荐甫 檬扁拳
+	InitValue();
+
+	//橇肺弊伐 汲沥阑 佬绢柯促.
+	LoadINIFile();
+
+	OpenPLCConnection();
+
+	//辑滚客 烹脚阑 困茄 傍蜡 皋葛府 甘 积己
+	if (!InitSharedMemory()) 
+	{
+		//角菩矫 橇肺弊伐 辆丰
+		PostMessage(UM_EXITPROGRAM);
+		return;
+	}
+
+	//Read 胶饭靛 积己
+	AfxBeginThread(CPLCConnectorView::ReadPLCWorkerThread,(LPVOID)(this));
+
+	//Write 胶饭靛 积己
+	AfxBeginThread(CPLCConnectorView::WritePLCWorkerThread,(LPVOID)(this));	
+
+	SetTimer(ID_TIMER_PLCCONNECTOR,1000,NULL);	
+}
+
+void CPLCConnectorView::InitValue(void)
+{
+	//PLC Signal阑 佬绢甸老 林家啊 汲沥凳
+	::ZeroMemory( m_AddressToReadSignal0, sizeof(TCHAR)*7);
+	::ZeroMemory( m_AddressToReadSignal1, sizeof(TCHAR)*7);
+	::ZeroMemory( m_AddressToReadSignal2, sizeof(TCHAR)*7);
+	::ZeroMemory( m_AddressToReadSignal3, sizeof(TCHAR)*7);
+	::ZeroMemory( m_AddressToReadSignal4, sizeof(TCHAR)*7);
+
+	int i = 0;
+	//PLC Read Signal阑 荤侩且 瘤 咯何啊 汲沥等 敲贰弊
+	for(i = 0; i < MAX_READSIGNAL; i++)
+		m_bUseReadSignal[i] = 0;
+
+	//PLC Connector 荤侩 葛靛 : 0 MC Protocol, 1: MX Componnet
+	m_nPLCConnectMode = MC_Protocol;
+}
+
+
+void CPLCConnectorView::OnRButtonUp(UINT nFlags, CPoint point)
+{
+	ClientToScreen(&point);
+	OnContextMenu(this, point);
+}
+
+void CPLCConnectorView::OnContextMenu(CWnd* pWnd, CPoint point)
+{
+	theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
+}
+
+
+// CPLCConnectorView 柳窜
+
+#ifdef _DEBUG
+void CPLCConnectorView::AssertValid() const
+{
+	CFormView::AssertValid();
+}
+
+void CPLCConnectorView::Dump(CDumpContext& dc) const
+{
+	CFormView::Dump(dc);
+}
+
+CPLCConnectorDoc* CPLCConnectorView::GetDocument() const // 叼滚弊登瘤 臼篮 滚傈篮 牢扼牢栏肺 瘤沥邓聪促.
+{
+	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPLCConnectorDoc)));
+	return (CPLCConnectorDoc*)m_pDocument;
+}
+#endif //_DEBUG
+
+
+// CPLCConnectorView 皋矫瘤 贸府扁
+
+void CPLCConnectorView::LoadINIFile(void)
+{
+	CString Path;
+	GetModulePath(Path);
+
+	CString INIFilePath;
+	INIFilePath.Format(_T("%sPLCConnector.ini"),Path);
+
+	CFileFind finder;
+
+	if(TRUE == finder.FindFile(INIFilePath))
+	{
+		::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL0"),_T("D0"), m_AddressToReadSignal0,6,INIFilePath);
+		m_bUseReadSignal[0] = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL0"),0,INIFilePath);
+		::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL1"),_T("D1"), m_AddressToReadSignal1,6,INIFilePath);
+		m_bUseReadSignal[1] = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL1"),0,INIFilePath);
+		::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL2"),_T("D2"), m_AddressToReadSignal2,6,INIFilePath);
+		m_bUseReadSignal[2] = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL2"),0,INIFilePath);
+		::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL3"),_T("D3"), m_AddressToReadSignal3,6,INIFilePath);
+		m_bUseReadSignal[3] = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL3"),0,INIFilePath);
+		::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL4"),_T("D4"), m_AddressToReadSignal4,6,INIFilePath);
+		m_bUseReadSignal[4] = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL4"),0,INIFilePath);
+
+		m_nPLCConnectMode = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("PROTOCOL"),0,INIFilePath);
+		m_dwAddress = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("IP_ADDRESS"),htonl(inet_addr("126.100.100.50")),INIFilePath);
+		m_nPort = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("PORT_NO"),4096,INIFilePath);
+		m_StationNumber = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("STATION_NO"),11,INIFilePath);
+
+		m_bUseAOISignal = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USE_AOISIGNAL"),0,INIFilePath);
+		::GetPrivateProfileString(_T("SAVE_OPTION"),_T("AOISERVER_CAPTION"),_T("! Inspection ! D.I.T"), m_strAOICaption,100,INIFilePath);
+	}
+	else
+	{
+		CString			str;
+
+		str.Format(_T("D2300"));
+		CopyMemory(m_AddressToReadSignal0,str.GetBuffer(0),sizeof(TCHAR)*str.GetLength());		 
+		CopyMemory(m_AddressToReadSignal1,str.GetBuffer(0),sizeof(TCHAR)*str.GetLength());
+		CopyMemory(m_AddressToReadSignal2,str.GetBuffer(0),sizeof(TCHAR)*str.GetLength());
+		CopyMemory(m_AddressToReadSignal3,str.GetBuffer(0),sizeof(TCHAR)*str.GetLength());
+		CopyMemory(m_AddressToReadSignal4,str.GetBuffer(0),sizeof(TCHAR)*str.GetLength());
+		m_bUseReadSignal[0] = FALSE;
+		m_bUseReadSignal[1] = FALSE;
+		m_bUseReadSignal[2] = FALSE;
+		m_bUseReadSignal[3] = FALSE;
+		m_bUseReadSignal[4] = FALSE;
+		m_StationNumber = 11;
+
+		m_bUseAOISignal = FALSE;		
+		SaveINIFile();
+	}	
+}
+
+
+void CPLCConnectorView::SaveINIFile(void)
+{
+	CString Path;
+	GetModulePath(Path);
+
+	CString INIFilePath;
+	INIFilePath.Format(_T("%sPLCConnector.ini"),Path);
+
+	//Signal0
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL0"),m_AddressToReadSignal0,INIFilePath);
+	CString ValueOfSetting;
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseReadSignal[0]);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL0"),ValueOfSetting,INIFilePath);
+
+	//Signal1
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL1"),m_AddressToReadSignal1,INIFilePath);
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseReadSignal[1]);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL1"),ValueOfSetting,INIFilePath);
+
+	//Signal2
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL2"),m_AddressToReadSignal2,INIFilePath);
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseReadSignal[2]);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL2"),ValueOfSetting,INIFilePath);
+
+	//Signal3
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL3"),m_AddressToReadSignal3,INIFilePath);
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseReadSignal[3]);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL3"),ValueOfSetting,INIFilePath);
+
+	//Signal4
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL4"),m_AddressToReadSignal4,INIFilePath);
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseReadSignal[4]);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL4"),ValueOfSetting,INIFilePath);
+
+	ValueOfSetting.Format(_T("%d"),m_bUseAOISignal);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USE_AOISIGNAL"),ValueOfSetting,INIFilePath);
+
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("AOISERVER_CAPTION"),m_strAOICaption,INIFilePath);	
+}
+
+
+bool CPLCConnectorView::GetModulePath(CString& strPath)
+{
+	TCHAR szBuffer[MAX_PATH]= {0};
+
+	::GetModuleFileName(NULL,szBuffer,MAX_PATH);
+
+	for(int i = lstrlen(szBuffer) -1; i>=0; --i)
+	{
+		if(szBuffer[i] == '\\')
+		{
+			int j = lstrlen(szBuffer)-1;
+			for(;j>=i;--j)
+			{
+				szBuffer[j] = NULL;
+			}
+
+			if(szBuffer[j] == ';') szBuffer[j+1] = '\\';
+
+			szBuffer[j+1] = '\\';
+
+			strPath = szBuffer;
+			return true;
+		}
+	}
+	return false;
+}
+
+
+void CPLCConnectorView::OnDestroy()
+{
+	ExitPLCProgram();
+
+	CFormView::OnDestroy();
+}
+
+void CPLCConnectorView::OnSetOption()
+{
+	// TODO: 咯扁俊 疙飞 贸府扁 内靛甫 眠啊钦聪促.
+	CSetOptionDlg OptionDlg;
+	OptionDlg.DoModal();
+}
+
+LRESULT CPLCConnectorView::OnExitProgram(WPARAM wParam, LPARAM lParam)
+{
+	CFrameWnd *pMainFrame = GetParentFrame();
+	if (pMainFrame != NULL)
+	{	
+		if (!m_bExit)
+		{
+			WriteLocalLog(FALSE, _T("OnExitProgram"));
+			ExitPLCProgram(false);
+			m_bExit = true;
+			pMainFrame->PostMessage(WM_COMMAND,ID_APP_EXIT);
+		}
+	}
+
+	return 0;
+}
+
+bool CPLCConnectorView::InitSharedMemory(void)
+{
+	m_hMap = ::CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE
+								, 0, SHARED_MEMORY_SIZE, _T("MX_COMPONENT_SHARED_MEMORY"));
+	if (::GetLastError() == ERROR_ALREADY_EXISTS)
+	{
+		m_hMap = ::OpenFileMapping(FILE_MAP_ALL_ACCESS,FALSE,_T("MX_COMPONENT_SHARED_MEMORY"));
+	}
+
+	if (m_hMap == NULL)
+	{
+		WriteLocalLog(FALSE, _T("ERROR: Failed to create(open) file mapping object!"));		
+		return false;
+	}
+
+	m_pSharedMemory = (char*)::MapViewOfFile(m_hMap, FILE_MAP_ALL_ACCESS, 0, 0, SHARED_MEMORY_SIZE);
+
+	if (m_pSharedMemory == NULL)
+	{
+		WriteLocalLog(FALSE, _T("ERROR: Failed to get shared memory!"));		
+		return false;
+	}
+
+
+	ZeroMemory(m_pSharedMemory,SHARED_MEMORY_SIZE);
+	return true;
+}
+
+void CPLCConnectorView::ExitPLCProgram(bool close)
+{
+	m_bThreadEnd = true;
+	WriteLocalLog(FALSE, _T("ExitPLCProgram"));
+	Sleep(500);
+	if (m_pSharedMemory!=NULL)
+	{
+		::UnmapViewOfFile(m_pSharedMemory);
+		m_pSharedMemory = NULL;
+	}
+
+	if (m_hMap != NULL )	
+	{
+		::CloseHandle(m_hMap);
+		m_hMap = NULL;
+	}
+
+	for (m_itorList = m_ListWriteData.begin();m_itorList != m_ListWriteData.end(); m_itorList++)
+	{
+		if ((*m_itorList))
+		{
+			delete (*m_itorList);
+			(*m_itorList) = NULL;
+		}
+	}
+	m_ListWriteData.clear();
+
+
+	if (close)
+	{
+		ClosePLCConnection();
+	}
+	
+	Sleep(100);
+}
+
+UINT CPLCConnectorView::WritePLCWorkerThread(LPVOID pParam)
+{
+	CPLCConnectorView* pView = (CPLCConnectorView*)pParam;
+	while (true)
+	{
+		Sleep(20);
+		if (m_bThreadEnd) break;
+
+		//PLC 静扁 脚龋啊 乐栏搁 蔼阑 利绰促.
+		pView->WritePLCDataTimer();
+
+		//PLC 静扁 脚龋啊 乐栏搁 蔼阑 利绰促.
+		pView->WritePLCData();
+
+		//PLC Timer俊 汲沥等 矫埃捞 瘤唱搁 府悸 蔼阑 利绰促.
+		pView->ResetPLCData();
+	}
+	return 0;
+}
+
+bool CPLCConnectorView::CheckRequestToWritePLC(int iAddr)
+{
+	//PLC 静扁 脚龋啊 吭绰瘤 眉农茄促. 
+	if (m_pSharedMemory != NULL && m_pSharedMemory[iAddr])
+	{
+		m_pSharedMemory[iAddr] = 0;
+		return true;
+	}
+	else return false;
+}
+
+void CPLCConnectorView::WritePLCDataTimer(void)
+{
+	int			iSignal,iAddr;
+
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH];
+
+	//矫弊澄 静扁 10俺 犬厘
+	for(iSignal=0;iSignal<PLC_WRITEWORD_TIMER_COUNT;iSignal++)
+	{
+		iAddr = PLC_WRITEWORD_SIGNAL+iSignal*PLC_WRITEWORD_TIMER_SIZE;
+		if (CheckRequestToWritePLC(iAddr))
+		{
+			//OutputDebugString(_T("WritePLCData1!\n"));
+			PLCWRITE_DATA* pWriteData1 = new PLCWRITE_DATA;
+			
+			iAddr+=1;
+			memset(pWriteData1->WriteAddress,0x00,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+			memcpy(pWriteData1->WriteAddress, m_pSharedMemory+iAddr, (PLC_READ_ADDRESS_LENGTH-1)*sizeof(TCHAR));
+			iAddr+=14;
+			memcpy(&(pWriteData1->WriteValue), m_pSharedMemory+iAddr, sizeof(WORD));
+			iAddr+=2;
+			memcpy(&(pWriteData1->EndTickCount), m_pSharedMemory+iAddr, sizeof(DWORD));			
+
+			if(pWriteData1->EndTickCount < 0 || pWriteData1->EndTickCount >= 10000)
+				pWriteData1->EndTickCount = 1000;
+
+			if( pWriteData1->EndTickCount != 0)
+				pWriteData1->EndTickCount += GetTickCount();			
+
+//			WriteLocalLog(_T("Write Timer Signal[%d],Addr[%s],Val[%d],Time[%d]"),iSignal,pWriteData1->WriteAddress,pWriteData1->WriteValue,pWriteData1->EndTickCount);
+
+			WORD ReadData = 0;
+			
+			ZeroMemory(NULLCHECK,sizeof(TCHAR)*7);
+			memcpy(NULLCHECK,pWriteData1->WriteAddress,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+			if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) 
+			{
+				WriteLocalLog(FALSE, _T("Write Timer Signal[%d],Addr[%s],Val[%d],Time[%d] : Check Addr Err"),iSignal,pWriteData1->WriteAddress,pWriteData1->WriteValue,pWriteData1->EndTickCount);
+				if (pWriteData1)
+				{
+					delete pWriteData1;
+					pWriteData1 = NULL;
+				}
+				return;
+			}
+
+			//悼扁拳窍瘤 臼栏搁 橇肺弊伐 坷幅 惯积
+			m_PLCSection.Lock();
+			//鞍篮 林家狼 单捞磐甫 佬绢柯促.
+			long lRet =	m_MXComponent.ReadDeviceBlock2(pWriteData1->WriteAddress, 1,
+											(short*)&(ReadData));
+
+			//佬篮 单捞磐客 镜 单捞磐 埃 or 楷魂
+			ReadData |= pWriteData1->WriteValue;
+			//1 WORD甫 敬促.
+			//MX Component 窃荐 荤侩
+			lRet =	m_MXComponent.WriteDeviceBlock2(pWriteData1->WriteAddress, 1,
+											(short*)&(ReadData));
+			m_PLCSection.Unlock();
+
+			if (lRet == 0x00)	//success
+			{
+				//OutputDebugString(_T("successWritePLCData1!\n"));
+				if( pWriteData1->EndTickCount != 0)
+					m_ListWriteData.push_back(pWriteData1);
+				else
+				{
+					if (pWriteData1)
+					{
+						delete pWriteData1;
+						pWriteData1 = NULL;
+					}
+				}
+
+		//		WriteLocalLog(_T("Write Timer Signal[%d],Addr[%s],Val[%d],Time[%d] : Write Success"),iSignal,pWriteData1->WriteAddress,pWriteData1->WriteValue,pWriteData1->EndTickCount);
+			}
+			else	//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+			{
+				//OutputDebugString(_T("FailWritePLCData1!\n"));
+				WriteLocalLog(FALSE, _T("Write Timer Signal[%d],Addr[%s],Val[%d],Time[%d] : Write Fail"),iSignal,pWriteData1->WriteAddress,pWriteData1->WriteValue,pWriteData1->EndTickCount);
+				if (pWriteData1)
+				{
+					delete pWriteData1;
+					pWriteData1 = NULL;
+				}
+				//ReConnectionPLC();
+			}
+		}
+	}
+}
+
+void CPLCConnectorView::WritePLCData(void)
+{
+	int			iSignal,iAddr;
+
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH];
+
+	for(iSignal=0;iSignal<PLC_WRITEWORD_LONGDATA_COUNT;iSignal++)
+	{
+		iAddr = PLC_WRITELONG_SIGNAL+iSignal*PLC_LONGDATA_MAXSIZE;
+		if (CheckRequestToWritePLC(iAddr))
+		{
+			memset(m_AddressToWriteLongData,0x00,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+			iAddr+=1;
+			memcpy(m_AddressToWriteLongData, m_pSharedMemory+iAddr, (PLC_READ_ADDRESS_LENGTH-1)*sizeof(TCHAR));
+			iAddr+=14;
+			memcpy(&(m_SizeOfWriteLongData), m_pSharedMemory+iAddr, sizeof(UINT));			
+
+			// WriteLocalLog(FALSE, _T("Write Long Data Signal[%d],Addr[%s],Size[%d]"),iSignal,m_AddressToWriteLongData,m_SizeOfWriteLongData);
+
+			if(m_SizeOfWriteLongData <= 0 || m_SizeOfWriteLongData > PLC_LONGDATA_MAXSIZE)
+			{
+				WriteLocalLog(FALSE, _T("Write Long Data Signal[%d],Addr[%s],Size[%d] : Check Size Err"),iSignal,m_AddressToWriteLongData,m_SizeOfWriteLongData);
+				return;
+			}
+
+			ZeroMemory(NULLCHECK,sizeof(TCHAR)*7);
+			memcpy(NULLCHECK,m_AddressToWriteLongData,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+			if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) 
+			{
+				WriteLocalLog(FALSE, _T("Write Long Data Signal[%d],Addr[%s],Size[%d] : Check Addr Err"),iSignal,m_AddressToWriteLongData,m_SizeOfWriteLongData);
+				return;
+			}
+
+			//悼扁拳窍瘤 臼栏搁 橇肺弊伐 坷幅 惯积
+			m_PLCSection.Lock();
+			iAddr+=4;
+			long lRet =	m_MXComponent.WriteDeviceBlock2(m_AddressToWriteLongData, m_SizeOfWriteLongData,
+				(short*)(m_pSharedMemory+iAddr));
+
+			m_PLCSection.Unlock();
+			if (lRet == 0x00)	//success
+			{
+				// WriteLocalLog(FALSE, _T("Write Long Data Signal[%d],Addr[%s],Size[%d] : Write Success"),iSignal,m_AddressToWriteLongData,m_SizeOfWriteLongData);
+			}
+			else	//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+			{
+				WriteLocalLog(FALSE, _T("Write Long Data Signal[%d],Addr[%s],Size[%d] : Write Fail"),iSignal,m_AddressToWriteLongData,m_SizeOfWriteLongData);
+				//ReConnectionPLC();
+			}
+		}
+	}
+}
+
+void CPLCConnectorView::ResetPLCData(void)
+{
+	DWORD CurrentTime = GetTickCount();
+	WORD  ResetData = 0;
+	WORD ReadData = 0;
+	WORD WriteData = 0;
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH] = {0};
+	for (m_itorList = m_ListWriteData.begin();m_itorList != m_ListWriteData.end(); m_itorList++)
+	{
+		//府悸 矫埃捞 瘤车绰瘤 眉农
+		if ((*m_itorList)->EndTickCount < CurrentTime)
+		{
+			//矫埃捞 瘤唱 瘤况具且 单捞磐
+			ResetData = (*m_itorList)->WriteValue;
+
+			//PLC俊 静咯廉 乐绰 蔼阑 佬绢柯促.
+			ReadData = 0;
+
+			ZeroMemory(NULLCHECK,sizeof(TCHAR)*7);
+			memcpy(NULLCHECK,(*m_itorList)->WriteAddress,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+			if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) return;
+
+			m_PLCSection.Lock();
+			long lRet =	m_MXComponent.ReadDeviceBlock2((*m_itorList)->WriteAddress, 1,
+										(short*)&(ReadData));
+
+			ResetData = ~ResetData;
+			//佬绢柯 单捞磐客 瘤匡 单捞磐甫 XOR楷魂阑 茄促.
+			ReadData &= ResetData;
+
+			//鞍篮 林家蔼俊辑 酒流 巢酒乐绢具 窍绰 蔼阑 备茄促.
+			WriteData = GetWriteData((*m_itorList)->WriteAddress);
+
+			//巢酒乐绢具 且 蔼 | (PLC俊辑 佬绢柯蔼 ^ 府悸且 蔼)
+			WriteData = WriteData | ReadData;
+		
+			 lRet =
+				m_MXComponent.WriteDeviceBlock2((*m_itorList)->WriteAddress, 1,	(short*)&(WriteData));
+
+			m_PLCSection.Unlock();
+			if (lRet == 0x00)	//success
+			{
+				//OutputDebugString(_T("successResetWritePLCData1!\n"));
+				if ((*m_itorList))
+				{
+					delete (*m_itorList);
+					(*m_itorList) = NULL;
+				}
+				
+				m_ListWriteData.erase(m_itorList);
+				return;
+			}
+			else	//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+			{
+				//OutputDebugString(_T("FailResetWritePLCData1!\n"));
+				WriteLocalLog(FALSE, _T("Write Timer Addr[%s],Val[%d],Time[%d] : Reset Fail"),(*m_itorList)->WriteAddress,(*m_itorList)->WriteValue,(*m_itorList)->EndTickCount);
+				ClosePLCConnection();
+				OpenPLCConnection();
+			}
+		}
+	}
+}
+
+UINT CPLCConnectorView::ReadPLCWorkerThread(LPVOID pParam)
+{
+	CPLCConnectorView* pView = (CPLCConnectorView*)pParam;
+	while (true)
+	{
+		pView->ReadPLC();
+
+		pView->ReadLongData(0);
+
+		pView->ReadLongData(1);
+
+		pView->ReadLongData(2);
+
+		Sleep(5);
+		if (m_bThreadEnd) break;
+	}
+	return 0;
+}
+
+void CPLCConnectorView::ReadLongData(int nID)
+{
+	long lRet;
+	CString	MsgStr;
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH] = {0};
+
+	if (CheckRequestToReadLongData(nID))
+	{	
+		int			nAddrLength,nAddrAddress,nAddrValue;
+		switch(nID)
+		{
+		case 0:
+			nAddrLength = PLC_READ_LONGDATA_LENGTH_1;
+			nAddrAddress = PLC_READ_LONGDATA_ADDRESS_1;
+			nAddrValue = PLC_READ_LONGDATA_VALUE_1;
+			break;
+		case 1:
+			nAddrLength = PLC_READ_LONGDATA_LENGTH_2;
+			nAddrAddress = PLC_READ_LONGDATA_ADDRESS_2;
+			nAddrValue = PLC_READ_LONGDATA_VALUE_2;
+			break;
+		case 2:
+			nAddrLength = PLC_READ_LONGDATA_LENGTH_3;
+			nAddrAddress = PLC_READ_LONGDATA_ADDRESS_3;
+			nAddrValue = PLC_READ_LONGDATA_VALUE_3;
+			break;
+		default:
+			return;
+		}
+
+		memcpy(&m_SizeOfLongData ,m_pSharedMemory+nAddrLength,2);
+		memcpy(m_AddressToReadLongData ,m_pSharedMemory+nAddrAddress,sizeof(TCHAR)*PLC_READ_ADDRESS_LENGTH);
+
+		WriteLocalLog(FALSE, _T("Read Long Data Start : Addr[%s] Size[%d]"),m_AddressToReadLongData,m_SizeOfLongData);
+
+		ZeroMemory(m_pSharedMemory+nAddrValue,sizeof(BYTE)*PLC_LONGDATA_MAXSIZE);
+
+		//OutputDebugString(_T("StartReadLongData!\n"));
+		if (m_AddressToReadLongData == _T("")){
+			// Not Enter DeviceName Error
+
+			WriteLocalLog(FALSE, _T("Not Enter DeviceName Error."));			
+
+			PostMessage(UM_EXITPROGRAM);
+			return;
+		}
+
+		memcpy(NULLCHECK,m_AddressToReadLongData,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+		if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) return;
+
+		//PLC俊辑 佬绢棵 单捞磐绰 512 word甫 逞阑 荐 绝促.
+		if(	m_SizeOfLongData > PLC_LONGDATA_MAXSIZE) m_SizeOfLongData = PLC_LONGDATA_MAXSIZE;
+
+		m_PLCSection.Lock();
+		lRet = m_MXComponent.ReadDeviceBlock2(m_AddressToReadLongData,m_SizeOfLongData,(short*)(m_pSharedMemory+nAddrValue));
+		m_PLCSection.Unlock();
+
+		if (lRet == 0x00)	//success			
+		{
+			WriteLocalLog(FALSE, _T("Read Long Data Success : Addr[%s] Size[%d]"),m_AddressToReadLongData,m_SizeOfLongData);
+
+			if(nID == 0)
+				RestString((char*)(m_pSharedMemory+nAddrValue),m_SizeOfLongData);
+			PostMessage(UM_PRINTPLCDATA,0xffff,nID);
+
+			switch(nID)
+			{
+			case 0:
+				m_ReadEvent_1.SetEvent();
+				break;
+			case 1:
+				m_ReadEvent_2.SetEvent();
+				break;
+			case 2:
+				m_ReadEvent_3.SetEvent();
+				break;
+			default:
+				return;
+			}			
+		}
+		else
+		{//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+			//OutputDebugString(_T("ReadLongDataSuccess!\n"));
+			WriteLocalLog(FALSE, _T("ReadLongDataFail"));
+			//ReConnectionPLC();
+		}
+	}
+}
+
+bool CPLCConnectorView::CheckRequestToReadLongData(int nID)
+{
+	if(m_pSharedMemory != NULL)
+	{
+		switch(nID)
+		{
+		case 0:
+			if (m_pSharedMemory[PLC_READ_LONGDATA_SIGNAL_1])
+			{
+				m_pSharedMemory[PLC_READ_LONGDATA_SIGNAL_1] = 0;
+				return true;
+			}
+			break;
+		case 1:
+			if (m_pSharedMemory[PLC_READ_LONGDATA_SIGNAL_2])
+			{
+				m_pSharedMemory[PLC_READ_LONGDATA_SIGNAL_2] = 0;
+				return true;
+			}
+			break;
+		case 2:
+			if (m_pSharedMemory[PLC_READ_LONGDATA_SIGNAL_3])
+			{
+				m_pSharedMemory[PLC_READ_LONGDATA_SIGNAL_3] = 0;
+				return true;
+			}
+			break;
+		}		
+	}
+	
+	return false;
+}
+
+void CPLCConnectorView::ReadPLC(void)
+{
+	m_ReadCount++;
+	if(m_bUseReadSignal[0])
+		ReadPLCSignal0();
+	if(m_bUseReadSignal[1])
+		ReadPLCSignal1();
+	if(m_bUseReadSignal[2])
+		ReadPLCSignal2();
+	if(m_bUseReadSignal[3])
+		ReadPLCSignal3();
+	if(m_bUseReadSignal[4])
+		ReadPLCSignal4();
+}
+
+void CPLCConnectorView::ReadPLCSignal0(void)
+{	
+	long lRet;
+	CString	MsgStr;
+
+	if (m_AddressToReadSignal0 == _T("")){
+		// Not Enter DeviceName Error
+		WriteLocalLog(FALSE, _T("Not Enter DeviceName Error."));	
+
+		PostMessage(UM_EXITPROGRAM);
+		return;
+	}
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH] = {0};
+	memcpy(NULLCHECK,m_AddressToReadSignal0,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+	if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) return;
+
+	//DWORD dwTick = GetTickCount();
+	//佬绊 静扁 悼扁拳 鞘夸
+	m_PLCSection.Lock();
+	//DWORD 荤捞令 父怒 佬绢柯促.
+	lRet = m_MXComponent.ReadDeviceBlock2(m_AddressToReadSignal0,1,(short*)&m_lReadPLCWORD0);
+	m_PLCSection.Unlock();
+	//if(m_ReadCount%Print_Delay == 0)
+	//	WriteLocalLog(TRUE, "ReadPLCSignal0 Time [%d]", GetTickCount()-dwTick);
+	
+	if (lRet == 0x00)	//success
+	{
+		memcpy(m_pSharedMemory+PLC_READ_SIGNAL0, &m_lReadPLCWORD0, 2);
+
+		if(m_ReadCount%Print_Delay == 0)
+			PostMessage(UM_PRINTPLCDATA,m_lReadPLCWORD0,0);
+	}
+	else	//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+	{
+		WriteLocalLog(FALSE, _T("Readsignal0 角菩"));
+	//	ReConnectionPLC();
+	}
+}
+
+
+void CPLCConnectorView::ReConnectionPLC(void)
+{
+	m_PLCSection.Lock();
+	Sleep(1000);
+		ClosePLCConnection();
+		Sleep(1000);
+		OpenPLCConnection();
+	m_PLCSection.Unlock();
+}
+
+
+void CPLCConnectorView::ReadPLCSignal1(void)
+{
+	long lRet;
+	CString	MsgStr;
+
+	if (m_AddressToReadSignal1 == _T("")){
+		// Not Enter DeviceName Error
+		WriteLocalLog(FALSE, _T("Not Enter DeviceName Error."));	
+
+		PostMessage(UM_EXITPROGRAM);
+		return;
+	}
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH] = {0};
+	memcpy(NULLCHECK,m_AddressToReadSignal1,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+	if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) return;
+
+	//DWORD dwTick = GetTickCount();
+	//佬绊 静扁 悼扁拳 鞘夸
+	m_PLCSection.Lock();
+	//DWORD 荤捞令 父怒 佬绢柯促.
+	lRet = m_MXComponent.ReadDeviceBlock2(m_AddressToReadSignal1,1,(short*)&m_lReadPLCWORD1);
+	m_PLCSection.Unlock();
+	//if(m_ReadCount%Print_Delay == (Print_Delay/5))
+	//	WriteLocalLog(TRUE, "ReadPLCSignal1 Time [%d]", GetTickCount()-dwTick);		
+	
+	BOOL bLotStart, bLotEnd;	//儿浚靛尔 儿胶鸥飘 鳖冈唱 救鳖冈唱 犬牢
+	if (lRet == 0x00)	//success
+	{
+		(m_lReadPLCWORD1 & 0x01)?bLotStart=TRUE:bLotStart=FALSE;
+		(m_lReadPLCWORD1 & 0x02)?bLotEnd=TRUE:bLotEnd=FALSE;
+
+		if(bLotStart)
+			WriteLocalLog(FALSE, _T("Receive Lot Start!"));
+		if(bLotEnd)
+			WriteLocalLog(FALSE, _T("Receive Lot End!"));
+
+		memcpy(m_pSharedMemory+PLC_READ_SIGNAL1, &m_lReadPLCWORD1, 2);
+
+		if(m_ReadCount%Print_Delay == (Print_Delay/5))
+			PostMessage(UM_PRINTPLCDATA,m_lReadPLCWORD1,1);
+	}
+	else	//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+	{
+		WriteLocalLog(FALSE, _T("Readsignal1 角菩"));
+		//ReConnectionPLC();
+	}
+}
+
+void CPLCConnectorView::ReadPLCSignal2(void)
+{
+	long lRet;
+	CString	MsgStr;
+
+	if (m_AddressToReadSignal2 == _T("")){
+		// Not Enter DeviceName Error
+		WriteLocalLog(FALSE, _T("Not Enter DeviceName Error."));	
+
+		PostMessage(UM_EXITPROGRAM);
+		return;
+	}
+
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH] = {0};
+	memcpy(NULLCHECK,m_AddressToReadSignal2,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+	if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) return;
+
+	//DWORD dwTick = GetTickCount();
+	//佬绊 静扁 悼扁拳 鞘夸
+	m_PLCSection.Lock();
+	//DWORD 荤捞令 父怒 佬绢柯促.
+	lRet = m_MXComponent.ReadDeviceBlock2(m_AddressToReadSignal2,1,(short*)&m_lReadPLCWORD2);
+	m_PLCSection.Unlock();
+	//if(m_ReadCount%Print_Delay == (Print_Delay/5)*2)
+	//	WriteLocalLog(TRUE, "ReadPLCSignal2 Time [%d]", GetTickCount()-dwTick);
+	
+	if (lRet == 0x00)	//success
+	{
+		memcpy(m_pSharedMemory+PLC_READ_SIGNAL2, &m_lReadPLCWORD2, 2);
+
+		if(m_ReadCount%Print_Delay == (Print_Delay/5)*2)
+			PostMessage(UM_PRINTPLCDATA,m_lReadPLCWORD2,2);
+	}
+	else	//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+	{
+		WriteLocalLog(FALSE, _T("Readsignal2 角菩"));
+		//ReConnectionPLC();
+	}
+}
+
+void CPLCConnectorView::ReadPLCSignal3(void)
+{
+	long lRet;
+	CString	MsgStr;
+
+	if (m_AddressToReadSignal3 == _T("")){
+		// Not Enter DeviceName Error
+		WriteLocalLog(FALSE, _T("Not Enter DeviceName Error."));	
+
+		PostMessage(UM_EXITPROGRAM);
+		return;
+	}
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH] = {0};
+	memcpy(NULLCHECK,m_AddressToReadSignal3,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+	if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) return;
+	
+	//DWORD dwTick = GetTickCount();
+	//佬绊 静扁 悼扁拳 鞘夸
+	m_PLCSection.Lock();
+	//DWORD 荤捞令 父怒 佬绢柯促.
+	lRet = m_MXComponent.ReadDeviceBlock2(m_AddressToReadSignal3,1,(short*)&m_lReadPLCWORD3);
+	m_PLCSection.Unlock();
+	//if(m_ReadCount%Print_Delay == (Print_Delay/5)*3)
+	//	WriteLocalLog(TRUE, "ReadPLCSignal3 Time [%d]", GetTickCount()-dwTick);
+	
+	if (lRet == 0x00)	//success
+	{
+		memcpy(m_pSharedMemory+PLC_READ_SIGNAL3, &m_lReadPLCWORD3, 2);
+
+		if(m_ReadCount%Print_Delay == (Print_Delay/5)*3)
+			PostMessage(UM_PRINTPLCDATA,m_lReadPLCWORD3,3);
+	}
+	else	//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+	{
+		WriteLocalLog(FALSE, _T("Readsignal3 角菩"));
+		//ReConnectionPLC();
+	}
+}
+
+void CPLCConnectorView::ReadPLCSignal4(void)
+{
+	long lRet;
+	CString	MsgStr;
+
+	if (m_AddressToReadSignal4 == _T("")){
+		// Not Enter DeviceName Error
+		WriteLocalLog(FALSE, _T("Not Enter DeviceName Error."));	
+
+		PostMessage(UM_EXITPROGRAM);
+		return;
+	}
+	TCHAR NULLCHECK[PLC_READ_ADDRESS_LENGTH] = {0};
+	memcpy(NULLCHECK,m_AddressToReadSignal4,PLC_READ_ADDRESS_LENGTH*sizeof(TCHAR));
+	if( (NULLCHECK[0]|NULLCHECK[1]|NULLCHECK[2]|NULLCHECK[3]|NULLCHECK[4]|NULLCHECK[5]|NULLCHECK[6])==0) return;
+	
+	//DWORD dwTick = GetTickCount();
+	//佬绊 静扁 悼扁拳 鞘夸
+	m_PLCSection.Lock();
+	//DWORD 荤捞令 父怒 佬绢柯促.
+	lRet = m_MXComponent.ReadDeviceBlock2(m_AddressToReadSignal4,1,(short*)&m_lReadPLCWORD4);
+	m_PLCSection.Unlock();
+	//if(m_ReadCount%Print_Delay == (Print_Delay/5)*4)
+	//	WriteLocalLog(TRUE, "ReadPLCSignal4 Time [%d]", GetTickCount()-dwTick);
+	
+	if (lRet == 0x00)	//success
+	{
+		memcpy(m_pSharedMemory+PLC_READ_SIGNAL4, &m_lReadPLCWORD4, 2);
+
+		if(m_ReadCount%Print_Delay == (Print_Delay/5)*4)
+			PostMessage(UM_PRINTPLCDATA,m_lReadPLCWORD4,4);
+	}
+	else	//楷搬捞 谗绢脸阑锭 焊救内靛 鞘夸
+	{
+		WriteLocalLog(FALSE, _T("Readsignal4 角菩"));
+		//ReConnectionPLC();
+	}
+}
+
+#define MAX_STRING_SIZE 256
+void CPLCConnectorView::WriteLocalLog(TCHAR* str,...)
+{
+	//荤侩 绢敲府纳捞记俊辑 肺拿肺 官肺 肺弊 颇老阑 累己钦聪促.
+	va_list list;
+	TCHAR szText[MAX_STRING_SIZE] = {0, };
+
+	va_start(list, str);
+	_vstprintf_s(szText, str, list);
+	va_end(list);
+
+	CString strPath;
+	GetModulePath(strPath);
+
+	// 颇老俊 静扁
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+
+	static TCHAR strMessage[MAX_STRING_SIZE];
+	memset(strMessage, 0x00, MAX_STRING_SIZE*sizeof(TCHAR));
+	_stprintf_s(strMessage, _T("[%02d:%02d:%02d] %s\r\n"), st.wHour, st.wMinute, st.wSecond, szText);
+
+	//肺弊 颇老疙苞 困摹 积己
+	static TCHAR strFileName[MAX_PATH];
+	memset(strFileName, 0x00, MAX_PATH*sizeof(TCHAR));
+	_stprintf_s(strFileName, _T("%s%d%02d%02d.log"), strPath, st.wYear, st.wMonth, st.wDay);
+
+	DWORD dwWritten;
+	HANDLE hFile;
+
+	//版里惑怕 规瘤甫 困茄 农府萍拿 按眉 荤侩
+	m_LogSection.Lock();
+	hFile = CreateFile(strFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+	int nFilePointer = SetFilePointer(hFile, 0, NULL, FILE_END);
+
+#ifdef UNICODE
+	if(!nFilePointer)
+	{
+		// 蜡聪内靛 颇老狼 矫累篮 BOM(0xFEFF) 捞绢具 茄促.
+		TCHAR strCommand = 0xFEFF;
+		WriteFile(hFile, &strCommand, sizeof(TCHAR), &dwWritten, NULL);
+	}
+#endif
+
+	//肺拿 肺弊颇老 累己
+	WriteFile(hFile, strMessage, _tcslen(strMessage)*sizeof(TCHAR), &dwWritten, NULL);
+	CloseHandle(hFile);
+	m_LogSection.Unlock();
+
+	CString		strLog;
+	strLog.Format(_T("%s"),strMessage);
+	AddLogList(strLog);	
+}
+
+void CPLCConnectorView::WriteLocalLog(BOOL bFile, TCHAR* str,...)
+{
+	//荤侩 绢敲府纳捞记俊辑 肺拿肺 官肺 肺弊 颇老阑 累己钦聪促.
+	va_list list;
+	TCHAR szText[MAX_STRING_SIZE] = {0, };
+
+	va_start(list, str);
+	_vstprintf_s(szText, str, list);
+	va_end(list);
+
+	CString strPath;
+	GetModulePath(strPath);
+
+	// 颇老俊 静扁
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+
+	static TCHAR strMessage[MAX_STRING_SIZE];
+	memset(strMessage, 0x00, MAX_STRING_SIZE*sizeof(TCHAR));
+	_stprintf_s(strMessage, _T("[%02d:%02d:%02d] %s\r\n"), st.wHour, st.wMinute, st.wSecond, szText);
+
+	//肺弊 颇老疙苞 困摹 积己
+	static TCHAR strFileName[MAX_PATH];
+	memset(strFileName, 0x00, MAX_PATH*sizeof(TCHAR));
+	_stprintf_s(strFileName, _T("%s%d%02d%02d.log"), strPath, st.wYear, st.wMonth, st.wDay);
+
+	DWORD dwWritten;
+	HANDLE hFile;
+
+	//版里惑怕 规瘤甫 困茄 农府萍拿 按眉 荤侩
+	if(bFile)
+	{
+		m_LogSection.Lock();
+		hFile = CreateFile(strFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+		int nFilePointer = SetFilePointer(hFile, 0, NULL, FILE_END);
+
+#ifdef UNICODE
+		if(!nFilePointer)
+		{
+			// 蜡聪内靛 颇老狼 矫累篮 BOM(0xFEFF) 捞绢具 茄促.
+			TCHAR strCommand = 0xFEFF;
+			WriteFile(hFile, &strCommand, sizeof(TCHAR), &dwWritten, NULL);
+		}
+#endif
+
+		//肺拿 肺弊颇老 累己
+		WriteFile(hFile, strMessage, _tcslen(strMessage)*sizeof(TCHAR), &dwWritten, NULL);
+		CloseHandle(hFile);
+		m_LogSection.Unlock();		
+	}	
+
+	CString		strLog;
+	strLog.Format(_T("%s"),strMessage);
+	AddLogList(strLog);	
+}
+
+bool CPLCConnectorView::OpenPLCConnection(void)
+{
+	long lRet = INT_MAX;
+	CString	MsgStr;
+	// Clear ReturnValue Display
+	m_RetVal= _T("");
+	m_RetVal2 = _T("");
+	m_RetVal3 = _T("");
+
+	try{
+		// ActEasyIF Control
+		// If you don't use default values, please set their properties before OPEN method call.
+		// ---> Example: Change the Logical station number to "1" from default value.
+		m_PLCSection.Lock();
+		//MX Component Open阑 困秦辑绰 Logical Station 蔼阑 涝仿秦具 茄促.
+		//MX Component 汲摹矫 悸泼窍绰 蔼栏肺 八荤扁 辑滚绰 11捞 利钦窃
+		m_MXComponent.put_ActLogicalStationNumber(m_StationNumber);	// Exec set-property method 
+
+		//Logical Station 蔼 汲沥饶 PLC客 烹脚 楷搬 Open
+		
+		lRet = m_MXComponent.Open();	// Open method exec
+
+		m_PLCSection.Unlock();
+		// Renew ReturnValue 
+		m_RetVal.Format(_T("0x%08x"),lRet);
+
+		if (lRet != 0x00)
+		{
+			//俊矾 惯积
+			MsgStr.Format(_T("楷搬角菩!\n Station No 眉农 :%d"), m_StationNumber);
+			WriteLocalLog(FALSE, (TCHAR*)(LPCTSTR)MsgStr);			
+			//橇肺弊伐 辆丰 皋矫瘤 傈崔
+			PostMessage(UM_EXITPROGRAM);
+			return false;
+		}
+	}
+	catch(COleDispatchException *Exception){
+		// OLE IDispatch Interface Error
+		MsgStr.LoadString(IDS_STRING103);
+	//	AfxMessageBox(MsgStr, MB_ICONINFORMATION);
+		//MX Component坷幅 内靛 肺弊 累己 饶 橇肺弊伐 辆丰
+		WriteLocalLog(FALSE, (TCHAR*)(LPCTSTR)MsgStr);
+		Exception->Delete();
+		//橇肺弊伐 辆丰 皋矫瘤 傈崔
+		PostMessage(UM_EXITPROGRAM);
+
+		return false;
+	}	
+	return true;
+}
+
+void CPLCConnectorView::ClosePLCConnection(void)
+{
+	long lRet;
+	CString	MsgStr;
+
+	// Clear ReturnValue Display
+	m_RetVal= "";
+	m_RetVal2 = "";
+	m_RetVal3 = "";
+
+	try{
+		// ActEasyIF Control
+		m_PLCSection.Lock();
+		
+		lRet = m_MXComponent.Close();	// Exec Close Method
+		m_PLCSection.Unlock();
+		// Renew ReturnValue 
+		m_RetVal.Format(_T("0x%08x"),lRet);
+	}
+	catch(COleDispatchException *Exception){
+		// OLE IDispatch Interface Error
+		MsgStr.LoadString(IDS_STRING104);
+		//AfxMessageBox(MsgStr, MB_ICONINFORMATION);
+		WriteLocalLog(FALSE, (TCHAR*)(LPCTSTR)MsgStr);
+		Exception->Delete();
+	}
+}
+
+//沥惑 Open饶 PLC CPU Type阑 舅酒坷绰 抛胶飘 内靛
+void CPLCConnectorView::GetPLCCPUType(void)
+{
+	long	lRet;
+	long	lCpuCode	= 0;
+	BSTR	szCpuName	= NULL;
+	CString	MsgStr;
+
+	// Clear ReturnValue Display
+	CString m_RetVal= _T("");
+	CString m_RetVal2 = _T("");
+	CString m_RetVal3 = _T("");
+
+	try{
+		// ActEasyIF Control
+		m_PLCSection.Lock();
+		lRet = m_MXComponent.GetCpuType(&szCpuName,&lCpuCode);// Exec GetCpuType Method
+		m_PLCSection.Unlock();
+
+		if(lRet == 0x00){	// Success 
+			m_RetVal2.Format(_T("0x%x(%d)"),lCpuCode,lCpuCode);	// Cpu Code
+			m_RetVal3 = szCpuName;							// Cpu Name
+		}
+		// Renew ReturnValue 
+		m_RetVal.Format(_T("0x%08x"),lRet);
+
+	}
+	catch(COleDispatchException *Exception){
+		// OLE IDispatch Interface Error
+		MsgStr.LoadString(IDS_STRING105);
+		WriteLocalLog(FALSE, (TCHAR*)(LPCTSTR)MsgStr);		
+		Exception->Delete();
+
+		PostMessage(UM_EXITPROGRAM);
+	}
+
+	MsgStr.Format(_T("%s 楷搬 己傍"),m_RetVal3);
+	m_ConnectorState.AddString(MsgStr);
+	WriteLocalLog(FALSE, (TCHAR*)(LPCTSTR)MsgStr);
+	//AfxMessageBox(MsgStr);
+	// If the Method has Output value of BSTR type, you have to free the allocated BSTR area.
+	::SysFreeString(szCpuName);
+}
+
+LRESULT CPLCConnectorView::OnPrintListPLCData(WPARAM wParam, LPARAM lParam)
+{
+	//沥惑 悼累窍绰瘤 肺弊肺 嘛绢夯促.
+	static unsigned int index = 0;
+	index ++;
+	if (index%MaxPrintCount == 0)
+	{
+		m_ConnectorState.ResetContent();
+	}
+	long ResultToRead = (long)wParam;
+	long Signal = (long)lParam;
+	CString Result;
+
+	if (ResultToRead == 0xffff)
+	{
+		int		nAddrVal=0;
+		switch(Signal)
+		{
+		case 0: nAddrVal = PLC_READ_LONGDATA_VALUE_1; break;
+		case 1: nAddrVal = PLC_READ_LONGDATA_VALUE_2; break;
+		}
+		short* pData = (short*)(m_pSharedMemory+nAddrVal);
+		Result.Format(_T("%x%x%x%x%x%x%x%x%x%x%x%x%x"),pData[0],pData[1],pData[2],pData[3],pData[4],pData[5],pData[6],
+			pData[7],pData[8],pData[9],pData[10],pData[11],pData[12]);
+	}
+	else
+	{
+		switch(Signal)
+		{
+		case 0:
+			Result.Format(_T("Sigal0 %s : %x"),m_AddressToReadSignal0,ResultToRead);
+			break;
+		case 1:
+			Result.Format(_T("Sigal1 %s : %x"),m_AddressToReadSignal1,ResultToRead);
+			break;
+		case 2:
+			Result.Format(_T("Sigal2 %s : %x"),m_AddressToReadSignal2,ResultToRead);
+			break;
+		case 3:
+			Result.Format(_T("Sigal3 %s : %x"),m_AddressToReadSignal3,ResultToRead);
+			break;
+		case 4:
+			Result.Format(_T("Sigal4 %s : %x"),m_AddressToReadSignal4,ResultToRead);
+			break;
+		}
+		
+	}
+	m_ConnectorState.AddString(Result);
+
+	if(m_bAutoScroll)
+		m_ConnectorState.SetCurSel(m_ConnectorState.GetCount()-1);  
+
+
+	return 0;
+}
+
+void CPLCConnectorView::AddLogList(CString strMsg)
+{
+	if(m_ConnectorState.GetCount() >= 2000)
+		m_ConnectorState.ResetContent();
+
+	m_ConnectorState.AddString(strMsg);
+
+	if(m_bAutoScroll)
+		m_ConnectorState.SetCurSel(m_ConnectorState.GetCount()-1);  
+}
+
+WORD CPLCConnectorView::GetWriteData(TCHAR* AddressToGetData)
+{
+	WORD RetData = 0;
+
+	std::vector<PPLCWRITE_DATA>::iterator itorList;
+	for (itorList = m_ListWriteData.begin();itorList != m_ListWriteData.end(); itorList++)
+	{
+		if( itorList == m_itorList ) continue;
+		//府悸 矫埃捞 瘤车绰瘤 眉农
+		if(0== _tcscmp((*itorList)->WriteAddress,AddressToGetData))
+		{
+			//OutputDebugString(_T("ResetWritePLCData1!\n"));
+			RetData = RetData | (*itorList)->WriteValue;
+		}
+	}
+	return RetData;
+}
+
+
+
+void CPLCConnectorView::OnBnClickedCheckScroll()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+	UpdateData();
+}
+
+
+
+void CPLCConnectorView::OnTimer(UINT_PTR nIDEvent)
+{
+	if(m_bUseAOISignal == TRUE && nIDEvent == ID_TIMER_PLCCONNECTOR)
+	{
+		CString			strCaption;
+		HWND hWnd = NULL;
+		COPYDATASTRUCT cds;
+
+		cds.dwData = COPYDATA_PLCCONNECTOR;
+		cds.cbData = 0;
+		cds.lpData = 0;
+
+		strCaption.Format(_T("%s"),m_strAOICaption);
+		hWnd = ::FindWindow(strCaption, NULL);
+	//	hWnd = ::FindWindow(NULL, strCaption);
+
+		if (hWnd) 
+		{
+			PDWORD_PTR nReturn = NULL;
+			LRESULT Res = ::SendMessageTimeout(hWnd, WM_COPYDATA, COPYDATA_PLCCONNECTOR, (LPARAM)(LPVOID)&cds, 
+				SMTO_NORMAL, 1000, nReturn);
+		}
+	}
+	
+	CFormView::OnTimer(nIDEvent);
+}
+
+void CPLCConnectorView::RestString(char* RestPoint, int DataLength)
+{
+	char sData = 0;
+	for(int i =0; i < DataLength; i++)
+	{
+		sData = RestPoint[i];
+		if(sData == 0x00) //佬绢柯 拱幅 单捞磐啊 NULL捞搁 傍归栏肺 措眉
+			RestPoint[i] = 0x00;
+			//RestPoint[i] = 0x20;
+	}
+}
diff --git a/Common_Class/PLCConnector/PLCConnectorView.h b/Common_Class/PLCConnector/PLCConnectorView.h
new file mode 100644
index 0000000..574a599
--- /dev/null
+++ b/Common_Class/PLCConnector/PLCConnectorView.h
@@ -0,0 +1,208 @@
+
+// PLCConnectorView.h : CPLCConnectorView 努贰胶狼 牢磐其捞胶
+//
+
+
+#pragma once
+#include "acteasyif1.h"
+#include <vector>
+#include "afxwin.h"
+#include "SharedMemoryDefine.h"
+
+
+#define Print_Delay		40
+#define MaxPrintCount  2000
+typedef struct _PLCWRITE_DATA
+{
+	TCHAR WriteAddress[PLC_READ_ADDRESS_LENGTH];
+	DWORD EndTickCount;
+	WORD WriteValue;
+} PLCWRITE_DATA, *PPLCWRITE_DATA;
+
+class CPLCConnectorView : public CFormView
+{
+protected: // serialization俊辑父 父甸绢笼聪促.
+	CPLCConnectorView();
+	DECLARE_DYNCREATE(CPLCConnectorView)
+
+public:
+	enum{ IDD = IDD_PLCCONNECTOR_FORM };
+
+// 漂己涝聪促.
+public:
+	CPLCConnectorDoc* GetDocument() const;
+
+// 累诀涝聪促.
+public:
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual void OnInitialUpdate(); // 积己 饶 贸澜 龋免登菌嚼聪促.
+
+// 备泅涝聪促.
+public:
+	virtual ~CPLCConnectorView();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// 积己等 皋矫瘤 甘 窃荐
+protected:
+	afx_msg void OnFilePrintPreview();
+	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
+		//橇肺弊伐 辆丰
+	LRESULT afx_msg OnExitProgram(WPARAM wParam, LPARAM lParam);
+	DECLARE_MESSAGE_MAP()
+public:
+	static bool m_bThreadEnd;
+	static bool m_bThreadEnd2;
+private:
+	//拱幅单捞磐 佬扁绰 悼扁拳肺 悼累茄促.
+	//拱幅单捞磐甫 佬绢甸牢饶 辑滚俊 舅妨林扁 困茄 捞亥飘 按眉
+	CEvent	m_ReadEvent_1,m_ReadEvent_2,m_ReadEvent_3;
+	//拱幅 单捞磐甫 淬绊 乐绰 PLC 林家 蔼
+	TCHAR m_AddressToReadLongData[PLC_READ_ADDRESS_LENGTH];
+	//拱幅 单捞磐狼 农扁
+	UINT	m_SizeOfLongData; 
+
+	//变 荤捞令 单捞磐 PLC俊 静扁
+	TCHAR m_AddressToWriteLongData[PLC_READ_ADDRESS_LENGTH];
+	//拱幅 单捞磐狼 农扁
+	UINT	m_SizeOfWriteLongData; 
+
+	//PLC Signal阑 佬绢甸老 林家啊 汲沥凳
+	TCHAR m_AddressToReadSignal0[PLC_READ_ADDRESS_LENGTH];
+	TCHAR m_AddressToReadSignal1[PLC_READ_ADDRESS_LENGTH];
+	TCHAR m_AddressToReadSignal2[PLC_READ_ADDRESS_LENGTH];
+	TCHAR m_AddressToReadSignal3[PLC_READ_ADDRESS_LENGTH];
+	TCHAR m_AddressToReadSignal4[PLC_READ_ADDRESS_LENGTH];
+
+	WORD m_lReadPLCWORD0;	//佬绢甸牢 2byte PLC 矫弊澄 蔼
+	WORD m_lReadPLCWORD1;	//佬绢甸牢 2byte PLC 矫弊澄 蔼
+	WORD m_lReadPLCWORD2;	//佬绢甸牢 2byte PLC 矫弊澄 蔼
+	WORD m_lReadPLCWORD3;	//佬绢甸牢 2byte PLC 矫弊澄 蔼
+	WORD m_lReadPLCWORD4;	//佬绢甸牢 2byte PLC 矫弊澄 蔼
+
+	//PLC Read Signal阑 荤侩且 瘤 咯何啊 汲沥等 敲贰弊
+	BOOL m_bUseReadSignal[MAX_READSIGNAL];
+
+	//PLC Connector 荤侩 葛靛 : 0 MC Protocol, 1: MX Componnet
+	unsigned char m_nPLCConnectMode;
+
+	//MC Protocol IP林家
+	DWORD m_dwAddress;
+	//MC Protocol Port
+	int m_nPort;
+	//MX Component Station 锅龋
+	long m_StationNumber;
+	//傍蜡皋葛府 甘 颇老
+	HANDLE m_hMap;
+	//64bit 辑滚客 烹脚窍扁 困茄 傍蜡 皋葛府 甘 颇老
+	char* m_pSharedMemory;
+
+	unsigned int m_ReadCount;
+	unsigned int m_ReadCount2;
+
+	BOOL		m_bUseAOISignal;
+	TCHAR		m_strAOICaption[100];
+	
+
+	//PLC俊 蔼阑 静绊 鸥捞赣甫 积己窍咯 府悸窍扁 困茄 沥焊甫 淬绊 乐绰 牧抛捞呈
+	std::vector<PPLCWRITE_DATA> m_ListWriteData;
+	//PLC 府悸 磊丰备炼甫 力绢窍绰 itorator
+	std::vector<PPLCWRITE_DATA>::iterator m_itorList;
+public:
+	void LoadINIFile(void);
+	bool GetModulePath(CString& strPath);
+	void InitValue(void);
+	void SaveINIFile(void);
+	afx_msg void OnDestroy();
+	afx_msg void OnSetOption();
+	//PLC肺 何磐 4byte甫 佬绢柯促. 窃荐疙 坷幅
+	LRESULT afx_msg OnPrintListPLCData(WPARAM wParam, LPARAM lParam);
+	//辑滚肺 何磐 拱幅 单捞磐甫 佬扁 困茄 夸没捞 吭绰瘤 眉农窍绰 窃荐
+	bool CheckRequestToReadLongData(int nID);
+
+	bool InitSharedMemory(void);
+	//橇肺弊伐 辆丰
+	void ExitPLCProgram(bool close = false);
+	//橇肺弊伐 捞惑矫 肺弊甫 累己茄促.
+	void WriteLocalLog(TCHAR* str,...);
+	void WriteLocalLog(BOOL bFile, TCHAR* str,...);
+
+	//PLC客 立加阑 Open
+	bool OpenPLCConnection(void);
+	//PLC CPU Type阑 舅酒坷绰 窃荐, 窜鉴洒 沥昏 矫累窍看绰瘤 舅酒夯促.
+	void GetPLCCPUType(void);
+	//PLC客 立加阑 辆丰茄促.
+	void ClosePLCConnection(void);
+	
+	//PLC俊 蔼阑 敬促.
+	void WritePLCDataTimer(void);
+	//PLC俊 蔼阑 敬促.
+	void WritePLCData(void);
+
+	bool CheckRequestToWritePLC(int iAddr);
+
+	//拱幅单捞磐甫 佬扁困茄 窃荐
+	void ReadLongData(int nID);
+	//2byte佬扁甫 窍扁 困茄 窃荐
+	void ReadPLC(void);
+	void ReadPLC2(void);
+	//矫埃捞 瘤唱搁 timer 饶 府悸
+	void ResetPLCData();
+
+	WORD GetWriteData(TCHAR* AddressToGetData);
+
+	void ReadPLCSignal0(void);
+	void ReadPLCSignal1(void);
+	void ReadPLCSignal2(void);
+	void ReadPLCSignal3(void);
+	void ReadPLCSignal4(void);
+
+	//PLC 俊矾 惯积矫 犁楷搬矫档
+	void ReConnectionPLC(void);
+
+	//PLC俊辑 矫弊澄阑 拌加 罐扁 困茄 Worker 胶饭靛 窃荐
+	static UINT ReadPLCWorkerThread(LPVOID pParam);
+	static UINT ReadPLCWorkerThread2(LPVOID pParam);
+	//PLC俊 蔼 静扁甫 瘤盔窍绰 Worker 胶饭靛 窃荐
+	static UINT WritePLCWorkerThread(LPVOID pParam);
+
+	void AddLogList(CString strMsg);
+
+	
+private:
+	bool m_bExit;
+
+	CString m_RetVal;
+	CString m_RetVal2;
+	CString m_RetVal3;
+
+	//MX Componet绰 鉴瞒 贸府秦具窃
+	//佬扁 胶饭靛, 静扁 胶饭靛 罚待 立辟阑 贸府窍扁 困茄 农府萍拿 冀记
+	CCriticalSection m_PLCSection;
+	//PLC Connector 捞惑 惯积矫 肺弊甫 累己窍扁 困茄 农府萍拿 冀记
+	CCriticalSection m_LogSection;
+public:
+	CActeasyif1 m_MXComponent;
+	CListBox m_ConnectorState;
+
+
+	BOOL m_bAutoScroll;
+	afx_msg void OnBnClickedCheckScroll();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	void RestString(char* RestPoint, int DataLength);
+};
+
+#ifndef _DEBUG  // PLCConnectorView.cpp狼 叼滚弊 滚傈
+inline CPLCConnectorDoc* CPLCConnectorView::GetDocument() const
+   { return reinterpret_cast<CPLCConnectorDoc*>(m_pDocument); }
+#endif
\ No newline at end of file
diff --git a/Common_Class/PLCConnector/ReadMe.txt b/Common_Class/PLCConnector/ReadMe.txt
new file mode 100644
index 0000000..0f24061
--- /dev/null
+++ b/Common_Class/PLCConnector/ReadMe.txt
@@ -0,0 +1,114 @@
+================================================================================
+    MFC 扼捞宏矾府 : PLCConnector 橇肺璃飘 俺夸
+===============================================================================
+
+览侩 橇肺弊伐 付过荤俊辑 捞 PLCConnector 览侩 橇肺弊伐阑 
+父甸菌嚼聪促.  捞 览侩 橇肺弊伐篮 MFC(Microsoft Foundation Classes)狼
+扁夯利牢 荤侩过阑 焊咯 林哥 览侩 橇肺弊伐 累己阑 困茄 免惯痢阑 力傍钦聪促.
+
+捞 颇老俊绰 PLCConnector 览侩 橇肺弊伐阑 备己窍绰 阿 颇老俊 措茄
+夸距 汲疙捞 器窃登绢 乐嚼聪促.
+
+PLCConnector.vcproj
+    览侩 橇肺弊伐 付过荤甫 荤侩窍咯 积己等 VC++ 橇肺璃飘狼 林 橇肺璃飘 颇老涝聪促.
+    颇老阑 积己茄 Visual C++ 滚傈俊 措茄 沥焊客
+    览侩 橇肺弊伐 付过荤甫 荤侩窍咯 急琶茄 敲阀汽, 备己 棺 橇肺璃飘
+    扁瓷俊 措茄 沥焊啊 甸绢 乐嚼聪促.
+
+PLCConnector.h
+    览侩 橇肺弊伐狼 扁夯 庆歹 颇老涝聪促.  咯扁俊绰 促弗 橇肺璃飘 包访
+    庆歹(Resource.h 器窃)啊 甸绢 乐绊 CPLCConnectorApp 览侩 橇肺弊伐
+    努贰胶甫 急攫钦聪促.
+
+PLCConnector.cpp
+    览侩 橇肺弊伐 努贰胶 CPLCConnectorApp捞(啊) 甸绢 乐绰 扁夯 览侩 橇肺弊伐
+    家胶 颇老涝聪促.
+
+PLCConnector.rc
+    橇肺弊伐俊辑 荤侩窍绰 葛电 Microsoft Windows 府家胶狼 格废涝聪促.
+  咯扁俊绰 RES 窍困 叼泛磐府俊 历厘等 酒捞能, 厚飘甘 棺 目辑啊
+    器窃邓聪促.  捞 颇老篮 Microsoft Visual C++俊辑
+    流立 祈笼且 荐 乐嚼聪促. 橇肺璃飘 府家胶绰 1042俊 乐嚼聪促.
+
+res\PLCConnector.ico
+    览侩 橇肺弊伐狼 酒捞能栏肺 荤侩登绰 酒捞能 颇老涝聪促.  捞 酒捞能篮
+    林 府家胶 颇老牢 PLCConnector.rc俊 狼秦 器窃邓聪促.
+
+res\PLCConnector.rc2
+    捞 颇老俊绰 Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶啊
+    器窃登绢 乐嚼聪促. 府家胶 祈笼扁肺 祈笼且 荐 绝绰 葛电 府家胶绰
+    捞 颇老俊 持绢具 钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
+
+林 橇饭烙 芒狼 版快:
+    橇肺璃飘俊绰 钎霖 MFC 牢磐其捞胶啊 器窃邓聪促.
+
+MainFrm.h, MainFrm.cpp
+    捞 颇老俊绰 橇饭烙 努贰胶 CMainFrame捞(啊) 甸绢 乐嚼聪促.
+    捞 努贰胶绰CFrameWnd俊辑 颇积登哥 葛电 SDI 橇饭烙 扁瓷阑 力绢钦聪促.
+
+res\Toolbar.bmp
+    捞 厚飘甘 颇老篮 档备 葛澜阑 困茄 官迪魄侥 捞固瘤甫 父靛绰 单 荤侩邓聪促.
+    檬扁 档备 葛澜苞 惑怕 钎矫临篮 CMainFrame
+    努贰胶俊辑 积己邓聪促. 府家胶 祈笼扁甫 荤侩窍咯 捞 档备 葛澜 厚飘甘阑 祈笼窍绊
+    PLCConnector.rc狼 IDR_MAINFRAME TOOLBAR 硅凯阑 诀单捞飘窍咯 档备 葛澜
+    窜眠甫 眠啊钦聪促.
+/////////////////////////////////////////////////////////////////////////////
+
+览侩 橇肺弊伐 付过荤俊辑 窍唱狼 巩辑 屈侥苞 窍唱狼 轰啊 父甸绢笼聪促.
+
+PLCConnectorDoc.h, PLCConnectorDoc.cpp - 巩辑
+    捞 颇老俊绰 CPLCConnectorDoc 努贰胶啊 甸绢 乐嚼聪促.  捞 颇老阑 祈笼窍咯
+    漂荐茄 巩辑 单捞磐甫 眠啊窍绊 CPLCConnectorDoc::Serialize甫 烹秦 颇老
+    历厘 棺 肺靛甫 备泅钦聪促.
+
+PLCConnectorView.h, PLCConnectorView.cpp - 巩辑 轰
+    捞 颇老俊绰 CPLCConnectorView 努贰胶啊 甸绢 乐嚼聪促.
+    CPLCConnectorView 俺眉绰 CPLCConnectorDoc 俺眉甫 焊绰 单 荤侩邓聪促.
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 扁瓷:
+
+ActiveX 牧飘费
+    览侩 橇肺弊伐俊辑 ActiveX 牧飘费阑 荤侩且 荐 乐档废 瘤盔钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 钎霖 颇老:
+
+StdAfx.h, StdAfx.cpp
+    捞 颇老篮 固府 哪颇老等 庆歹(PCH) 颇老牢 PLCConnector.pch客
+    固府 哪颇老等 屈侥 颇老牢 StdAfx.obj甫 呼靛窍绰 单 荤侩邓聪促.
+
+Resource.h
+    货 府家胶 ID甫 沥狼窍绰 钎霖 庆歹 颇老涝聪促.
+    Microsoft Visual C++俊辑 捞 颇老阑 佬绊 诀单捞飘钦聪促.
+
+PLCConnector.manifest
+	览侩 橇肺弊伐 概聪其胶飘 颇老篮 Windows XP俊辑 漂沥 滚傈狼 Side-by-Side
+	绢祭喉府俊 措茄 览侩 橇肺弊伐 辆加己阑 汲疙窍绰 单 荤侩邓聪促. 肺歹绰 捞 沥焊甫
+	荤侩窍咯 绢祭喉府 某矫俊辑 利例茄 绢祭喉府甫 肺靛窍芭唱 览侩 橇肺弊伐俊辑 傈侩
+	绢祭喉府甫 肺靛钦聪促. 览侩 橇肺弊伐 概聪其胶飘绰 览侩 橇肺弊伐 角青 颇老苞 鞍篮
+	弃歹俊 汲摹等 寇何 .manifest 颇老肺 犁硅器甫 困秦 器窃登芭唱 府家胶狼 屈怕肺
+	角青 颇老俊 器窃瞪 荐 乐嚼聪促.
+/////////////////////////////////////////////////////////////////////////////
+
+扁鸥 曼绊:
+
+览侩 橇肺弊伐 付过荤绰 "TODO:"甫 荤侩窍咯 眠啊窍芭唱 荤侩磊 瘤沥秦具 窍绰
+家胶 内靛 何盒阑 唱鸥忱聪促.
+
+览侩 橇肺弊伐俊辑 傍蜡 DLL狼 MFC甫 荤侩窍绰 版快
+秦寸 MFC DLL阑 促矫 硅器秦具 钦聪促. 览侩 橇肺弊伐狼 攫绢啊
+款康 眉力狼 肺亩苞 促弗 版快
+瘤开拳等 秦寸 府家胶 MFC90XXX.DLL档 促矫 硅器秦具 钦聪促.
+捞 滴 啊瘤 亲格俊 措茄 磊技茄 郴侩篮 MSDN 汲疙辑俊辑
+Visual C++ 览侩 橇肺弊伐 促矫 硅器俊 措茄 窜盔阑 曼炼窍绞矫坷.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/PLCConnector/SetOptionDlg.cpp b/Common_Class/PLCConnector/SetOptionDlg.cpp
new file mode 100644
index 0000000..7737436
--- /dev/null
+++ b/Common_Class/PLCConnector/SetOptionDlg.cpp
@@ -0,0 +1,221 @@
+// SetOptionDlg.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "PLCConnector.h"
+#include "SetOptionDlg.h"
+
+
+// CSetOptionDlg 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CSetOptionDlg, CDialog)
+
+CSetOptionDlg::CSetOptionDlg(CWnd* pParent /*=NULL*/)
+	: CDialog(CSetOptionDlg::IDD, pParent)	
+{	
+	InitValue();
+}
+
+CSetOptionDlg::~CSetOptionDlg()
+{
+}
+
+void CSetOptionDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+	DDX_Text(pDX, IDC_PLCAddress0, m_PLCAddress0);
+	DDX_Text(pDX, IDC_PLCAddress1, m_PLCAddress1);
+	DDX_Text(pDX, IDC_PLCAddress2, m_PLCAddress2);
+	DDX_Text(pDX, IDC_PLCAddress3, m_PLCAddress3);
+	DDX_Text(pDX, IDC_PLCAddress4, m_PLCAddress4);
+
+	DDX_Check(pDX, IDC_CHECK_Signal0, m_bUseSignal0);
+	DDX_Check(pDX, IDC_CHECK_Signal1, m_bUseSignal1);
+	DDX_Check(pDX, IDC_CHECK_Signal2, m_bUseSignal2);
+	DDX_Check(pDX, IDC_CHECK_Signal3, m_bUseSignal3);
+	DDX_Check(pDX, IDC_CHECK_Signal4, m_bUseSignal4);
+
+	DDX_Radio(pDX, IDC_RADIO_MCProtocol, m_Protocol);
+	DDX_Text(pDX, IDC_EDIT_PLCPort, m_nPort);
+	DDX_Text(pDX, IDC_EDIT_StationNo, m_nStationNo);
+	DDX_IPAddress(pDX, IDC_IPPLCAddress, m_dwAddress);
+
+	DDX_Check(pDX, IDC_CHECK_AOISIGNAL, m_bUseAOISignal);	
+	DDX_Text(pDX, IDC_EDIT_AOISERVER_CAPTION, m_strAOICaption);
+	
+}
+
+
+BEGIN_MESSAGE_MAP(CSetOptionDlg, CDialog)
+	ON_BN_CLICKED(IDOK, &CSetOptionDlg::OnBnClickedOk)
+END_MESSAGE_MAP()
+
+
+// CSetOptionDlg 皋矫瘤 贸府扁涝聪促.
+
+
+void CSetOptionDlg::OnBnClickedOk()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+	UpdateData(TRUE);
+
+	//PLC Signal阑 佬绢甸老 林家啊 汲沥凳
+	SaveINIFile();
+
+	AfxMessageBox(_T("橇肺弊伐阑 犁啊悼窍搁 汲沥蔼捞 利侩邓聪促."));
+	OnOK();
+}
+
+void CSetOptionDlg::InitValue()
+{
+	::ZeroMemory( m_AddressToReadSignal0, sizeof(TCHAR)*7);
+	::ZeroMemory( m_AddressToReadSignal1, sizeof(TCHAR)*7);
+	::ZeroMemory( m_AddressToReadSignal2, sizeof(TCHAR)*7);
+	::ZeroMemory( m_AddressToReadSignal3, sizeof(TCHAR)*7);
+	::ZeroMemory( m_AddressToReadSignal4, sizeof(TCHAR)*7);
+
+	m_PLCAddress0 = m_PLCAddress1 = m_PLCAddress2 = m_PLCAddress3 = m_PLCAddress4 = _T("");	
+	m_strAOICaption = _T("");
+	m_bUseSignal0 = m_bUseSignal1 = m_bUseSignal2 = m_bUseSignal3 = m_bUseSignal4 = FALSE;
+	m_Protocol = m_nPort = m_nStationNo = 0;
+	m_dwAddress = 0;
+	m_bUseAOISignal = FALSE;
+}
+
+void CSetOptionDlg::LoadINIFile(void)
+{
+	CString Path;
+	GetModulePath(Path);
+
+	CString INIFilePath;
+	INIFilePath.Format(_T("%sPLCConnector.ini"),Path);
+
+	InitValue();
+
+	::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL0"),_T("D0"), m_AddressToReadSignal0,6,INIFilePath);
+	m_bUseSignal0 = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL0"),0,INIFilePath);
+	::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL1"),_T("D1"), m_AddressToReadSignal1,6,INIFilePath);
+	m_bUseSignal1 = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL1"),0,INIFilePath);
+	::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL2"),_T("D2"), m_AddressToReadSignal2,6,INIFilePath);
+	m_bUseSignal2 = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL2"),0,INIFilePath);
+	::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL3"),_T("D3"), m_AddressToReadSignal3,6,INIFilePath);
+	m_bUseSignal3 = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL3"),0,INIFilePath);
+	::GetPrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL4"),_T("D4"), m_AddressToReadSignal4,6,INIFilePath);
+	m_bUseSignal4 = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USEREADSIGNAL4"),0,INIFilePath);
+
+	m_PLCAddress0.Format(_T("%s"),m_AddressToReadSignal0 );
+	m_PLCAddress1.Format(_T("%s"),m_AddressToReadSignal1 );
+	m_PLCAddress2.Format(_T("%s"),m_AddressToReadSignal2 );
+	m_PLCAddress3.Format(_T("%s"),m_AddressToReadSignal3 );
+	m_PLCAddress4.Format(_T("%s"),m_AddressToReadSignal4 );
+
+	m_Protocol = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("PROTOCOL"),0,INIFilePath);
+	m_dwAddress = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("IP_ADDRESS"),htonl(inet_addr("126.100.100.50")),INIFilePath);
+	m_nPort = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("PORT_NO"),4096,INIFilePath);
+	m_nStationNo = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("STATION_NO"),11,INIFilePath);
+
+	m_bUseAOISignal = ::GetPrivateProfileInt(_T("SAVE_OPTION"),_T("USE_AOISIGNAL"),0,INIFilePath);
+	::GetPrivateProfileString(_T("SAVE_OPTION"),_T("AOISERVER_CAPTION"),_T("! Inspection ! D.I.T"), m_TstrAOICaption,50,INIFilePath);
+	m_strAOICaption.Format(_T("%s"),m_TstrAOICaption);
+}
+
+void CSetOptionDlg::SaveINIFile(void)
+{
+	CString Path;
+	GetModulePath(Path);
+
+	CString INIFilePath;
+	INIFilePath.Format(_T("%sPLCConnector.ini"),Path);
+
+	//Signal0
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL0"),m_PLCAddress0,INIFilePath);
+	CString ValueOfSetting;
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseSignal0);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL0"),ValueOfSetting,INIFilePath);
+
+	//Signal1
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL1"),m_PLCAddress1,INIFilePath);
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseSignal1);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL1"),ValueOfSetting,INIFilePath);
+
+	//Signal2
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL2"),m_PLCAddress2,INIFilePath);
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseSignal2);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL2"),ValueOfSetting,INIFilePath);
+
+	//Signal3
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL3"),m_PLCAddress3,INIFilePath);
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseSignal3);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL3"),ValueOfSetting,INIFilePath);
+
+	//Signal4
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("ADDRESS_TOREAD_SIGNAL4"),m_PLCAddress4,INIFilePath);
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_bUseSignal4);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USEREADSIGNAL4"),ValueOfSetting,INIFilePath);
+
+
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_Protocol);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("PROTOCOL"),ValueOfSetting,INIFilePath);
+
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_dwAddress);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("IP_ADDRESS"),ValueOfSetting,INIFilePath);
+	
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_nPort);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("PORT_NO"),ValueOfSetting,INIFilePath);
+	
+	ValueOfSetting = _T("");
+	ValueOfSetting.Format(_T("%d"),m_nStationNo);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("STATION_NO"),ValueOfSetting,INIFilePath);
+
+	ValueOfSetting.Format(_T("%d"),m_bUseAOISignal);
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("USE_AOISIGNAL"),ValueOfSetting,INIFilePath);
+	
+	WritePrivateProfileString(_T("SAVE_OPTION"),_T("AOISERVER_CAPTION"),m_strAOICaption,INIFilePath);	
+}
+
+bool CSetOptionDlg::GetModulePath(CString& strPath)
+{
+	TCHAR szBuffer[MAX_PATH]= {0};
+
+	::GetModuleFileName(NULL,szBuffer,MAX_PATH);
+
+	for(int i = lstrlen(szBuffer) -1; i>=0; --i)
+	{
+		if(szBuffer[i] == '\\')
+		{
+			int j = lstrlen(szBuffer)-1;
+			for(;j>=i;--j)
+			{
+				szBuffer[j] = NULL;
+			}
+
+			if(szBuffer[j] == ';') szBuffer[j+1] = '\\';
+
+			szBuffer[j+1] = '\\';
+
+			strPath = szBuffer;
+			return true;
+		}
+	}
+	return false;
+}
+BOOL CSetOptionDlg::OnInitDialog()
+{
+	CDialog::OnInitDialog();
+
+	// TODO:  咯扁俊 眠啊 檬扁拳 累诀阑 眠啊钦聪促.
+	LoadINIFile();
+
+	UpdateData(false);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+	// 抗寇: OCX 加己 其捞瘤绰 FALSE甫 馆券秦具 钦聪促.
+}
diff --git a/Common_Class/PLCConnector/SetOptionDlg.h b/Common_Class/PLCConnector/SetOptionDlg.h
new file mode 100644
index 0000000..8644b04
--- /dev/null
+++ b/Common_Class/PLCConnector/SetOptionDlg.h
@@ -0,0 +1,55 @@
+#pragma once
+
+
+// CSetOptionDlg 措拳 惑磊涝聪促.
+
+class CSetOptionDlg : public CDialog
+{
+	DECLARE_DYNAMIC(CSetOptionDlg)
+
+public:
+	CSetOptionDlg(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CSetOptionDlg();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_SET_OPTION };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+	DECLARE_MESSAGE_MAP()
+public:
+	CString m_PLCAddress0;
+	CString m_PLCAddress1;
+	CString m_PLCAddress2;
+	CString m_PLCAddress3;
+	CString m_PLCAddress4;
+	
+	TCHAR m_AddressToReadSignal0[7];
+	TCHAR m_AddressToReadSignal1[7];
+	TCHAR m_AddressToReadSignal2[7];
+	TCHAR m_AddressToReadSignal3[7];
+	TCHAR m_AddressToReadSignal4[7];
+
+	BOOL m_bUseSignal0;
+	BOOL m_bUseSignal1;
+	BOOL m_bUseSignal2;
+	BOOL m_bUseSignal3;
+	BOOL m_bUseSignal4;
+
+	void LoadINIFile(void);
+	void SaveINIFile(void);
+	bool GetModulePath(CString& strPath);
+	afx_msg void OnBnClickedOk();
+	virtual BOOL OnInitDialog();
+	int m_Protocol;
+	int m_nPort;
+	int m_nStationNo;
+	DWORD m_dwAddress;
+	BOOL		m_bUseAOISignal;
+	CString		m_strAOICaption;
+	TCHAR		m_TstrAOICaption[100];
+
+protected:
+	void		InitValue();
+};
diff --git a/Common_Class/PLCConnector/UserImages.bmp b/Common_Class/PLCConnector/UserImages.bmp
new file mode 100644
index 0000000..affe657
--- /dev/null
+++ b/Common_Class/PLCConnector/UserImages.bmp
Binary files differ
diff --git a/Common_Class/PLCConnector/acteasyif1.cpp b/Common_Class/PLCConnector/acteasyif1.cpp
new file mode 100644
index 0000000..2d4dbbb
--- /dev/null
+++ b/Common_Class/PLCConnector/acteasyif1.cpp
@@ -0,0 +1,19 @@
+// 哪腔磐俊辑 Microsoft Visual C++甫 荤侩窍咯 积己茄 IDispatch 贰欺 努贰胶涝聪促.
+
+// 曼绊: 捞 颇老狼 郴侩阑 荐沥窍瘤 付绞矫坷. Microsoft Visual C++俊辑
+//  捞 努贰胶甫 促矫 积己且 锭 荐沥茄 郴侩阑 丹绢竟聪促.
+
+
+#include "stdafx.h"
+#include "acteasyif1.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CActeasyif1
+
+IMPLEMENT_DYNCREATE(CActeasyif1, CWnd)
+
+/////////////////////////////////////////////////////////////////////////////
+// CActeasyif1 加己涝聪促.
+
+/////////////////////////////////////////////////////////////////////////////
+// CActeasyif1 累诀涝聪促.
diff --git a/Common_Class/PLCConnector/acteasyif1.h b/Common_Class/PLCConnector/acteasyif1.h
new file mode 100644
index 0000000..57ac147
--- /dev/null
+++ b/Common_Class/PLCConnector/acteasyif1.h
@@ -0,0 +1,247 @@
+#pragma once
+
+// 哪腔磐俊辑 Microsoft Visual C++甫 荤侩窍咯 积己茄 IDispatch 贰欺 努贰胶涝聪促.
+
+// 曼绊: 捞 颇老狼 郴侩阑 荐沥窍瘤 付绞矫坷. Microsoft Visual C++俊辑
+//  捞 努贰胶甫 促矫 积己且 锭 荐沥茄 郴侩阑 丹绢竟聪促.
+
+/////////////////////////////////////////////////////////////////////////////
+// CActeasyif1 贰欺 努贰胶涝聪促.
+
+class CActeasyif1 : public CWnd
+{
+protected:
+	DECLARE_DYNCREATE(CActeasyif1)
+public:
+	CLSID const& GetClsid()
+	{
+		static CLSID const clsid
+			= { 0x5AF69F12, 0xAE9B, 0x11D3, { 0x83, 0xAE, 0x0, 0xA0, 0x24, 0xBD, 0xBF, 0x2B } };
+		return clsid;
+	}
+	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
+						const RECT& rect, CWnd* pParentWnd, UINT nID, 
+						CCreateContext* pContext = NULL)
+	{ 
+		return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); 
+	}
+
+    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, 
+				UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
+				BSTR bstrLicKey = NULL)
+	{ 
+		return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
+		pPersist, bStorage, bstrLicKey); 
+	}
+
+// 漂己涝聪促.
+public:
+
+
+// 累诀涝聪促.
+public:
+
+// IActEasyIF3
+
+// Functions
+//
+
+	long get_ActLogicalStationNumber()
+	{
+		long result;
+		InvokeHelper(0x1, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
+		return result;
+	}
+	void put_ActLogicalStationNumber(long newValue)
+	{
+		static BYTE parms[] = VTS_I4 ;
+		InvokeHelper(0x1, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+	}
+	long Open()
+	{
+		long result;
+		InvokeHelper(0x2, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+		return result;
+	}
+	long Close()
+	{
+		long result;
+		InvokeHelper(0x3, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+		return result;
+	}
+	long GetCpuType(BSTR * szCpuName, long * lplCpuCode)
+	{
+		long result;
+		static BYTE parms[] = VTS_PBSTR VTS_PI4 ;
+		InvokeHelper(0x4, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szCpuName, lplCpuCode);
+		return result;
+	}
+	long SetCpuStatus(long lOperation)
+	{
+		long result;
+		static BYTE parms[] = VTS_I4 ;
+		InvokeHelper(0x5, DISPATCH_METHOD, VT_I4, (void*)&result, parms, lOperation);
+		return result;
+	}
+	long ReadDeviceBlock(LPCTSTR szDevice, long lSize, long * lplData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_PI4 ;
+		InvokeHelper(0x6, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, lSize, lplData);
+		return result;
+	}
+	long WriteDeviceBlock(LPCTSTR szDevice, long lSize, long * lplData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_PI4 ;
+		InvokeHelper(0x7, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, lSize, lplData);
+		return result;
+	}
+	long ReadDeviceRandom(LPCTSTR szDeviceList, long lSize, long * lplData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_PI4 ;
+		InvokeHelper(0x8, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDeviceList, lSize, lplData);
+		return result;
+	}
+	long WriteDeviceRandom(LPCTSTR szDeviceList, long lSize, long * lplData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_PI4 ;
+		InvokeHelper(0x9, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDeviceList, lSize, lplData);
+		return result;
+	}
+	long ReadBuffer(long lStartIO, long lAddress, long lSize, short * lpsData)
+	{
+		long result;
+		static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 VTS_PI2 ;
+		InvokeHelper(0xa, DISPATCH_METHOD, VT_I4, (void*)&result, parms, lStartIO, lAddress, lSize, lpsData);
+		return result;
+	}
+	long WriteBuffer(long lStartIO, long lAddress, long lSize, short * lpsData)
+	{
+		long result;
+		static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 VTS_PI2 ;
+		InvokeHelper(0xb, DISPATCH_METHOD, VT_I4, (void*)&result, parms, lStartIO, lAddress, lSize, lpsData);
+		return result;
+	}
+	long GetClockData(short * lpsYear, short * lpsMonth, short * lpsDay, short * lpsDayOfWeek, short * lpsHour, short * lpsMinute, short * lpsSecond)
+	{
+		long result;
+		static BYTE parms[] = VTS_PI2 VTS_PI2 VTS_PI2 VTS_PI2 VTS_PI2 VTS_PI2 VTS_PI2 ;
+		InvokeHelper(0xc, DISPATCH_METHOD, VT_I4, (void*)&result, parms, lpsYear, lpsMonth, lpsDay, lpsDayOfWeek, lpsHour, lpsMinute, lpsSecond);
+		return result;
+	}
+	long SetClockData(short sYear, short sMonth, short sDay, short sDayOfWeek, short sHour, short sMinute, short sSecond)
+	{
+		long result;
+		static BYTE parms[] = VTS_I2 VTS_I2 VTS_I2 VTS_I2 VTS_I2 VTS_I2 VTS_I2 ;
+		InvokeHelper(0xd, DISPATCH_METHOD, VT_I4, (void*)&result, parms, sYear, sMonth, sDay, sDayOfWeek, sHour, sMinute, sSecond);
+		return result;
+	}
+	long SetDevice(LPCTSTR szDevice, long lData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 ;
+		InvokeHelper(0xe, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, lData);
+		return result;
+	}
+	long GetDevice(LPCTSTR szDevice, long * lplData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_PI4 ;
+		InvokeHelper(0xf, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, lplData);
+		return result;
+	}
+	long CheckDeviceString(LPCTSTR szDevice, long lCheckType, long lSize, long * lplDeviceType, BSTR * lpszDeviceName, long * lplDeviceNumber, long * lplDeviceRadix)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_I4 VTS_PI4 VTS_PBSTR VTS_PI4 VTS_PI4 ;
+		InvokeHelper(0x10, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, lCheckType, lSize, lplDeviceType, lpszDeviceName, lplDeviceNumber, lplDeviceRadix);
+		return result;
+	}
+	long EntryDeviceStatus(LPCTSTR szDeviceList, long lSize, long lMonitorCycle, long * lplData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_I4 VTS_PI4 ;
+		InvokeHelper(0x11, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDeviceList, lSize, lMonitorCycle, lplData);
+		return result;
+	}
+	long FreeDeviceStatus()
+	{
+		long result;
+		InvokeHelper(0x12, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+		return result;
+	}
+	CString get_ActPassword()
+	{
+		CString result;
+		InvokeHelper(0x14, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+		return result;
+	}
+	void put_ActPassword(LPCTSTR newValue)
+	{
+		static BYTE parms[] = VTS_BSTR ;
+		InvokeHelper(0x14, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+	}
+	long ReadDeviceBlock2(LPCTSTR szDevice, long lSize, short * lpsData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_PI2 ;
+		InvokeHelper(0x15, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, lSize, lpsData);
+		return result;
+	}
+	long WriteDeviceBlock2(LPCTSTR szDevice, long lSize, short * lpsData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_PI2 ;
+		InvokeHelper(0x16, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, lSize, lpsData);
+		return result;
+	}
+	long ReadDeviceRandom2(LPCTSTR szDeviceList, long lSize, short * lpsData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_PI2 ;
+		InvokeHelper(0x17, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDeviceList, lSize, lpsData);
+		return result;
+	}
+	long WriteDeviceRandom2(LPCTSTR szDeviceList, long lSize, short * lpsData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I4 VTS_PI2 ;
+		InvokeHelper(0x18, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDeviceList, lSize, lpsData);
+		return result;
+	}
+	long GetDevice2(LPCTSTR szDevice, short * lpsData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_PI2 ;
+		InvokeHelper(0x19, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, lpsData);
+		return result;
+	}
+	long SetDevice2(LPCTSTR szDevice, short sData)
+	{
+		long result;
+		static BYTE parms[] = VTS_BSTR VTS_I2 ;
+		InvokeHelper(0x1a, DISPATCH_METHOD, VT_I4, (void*)&result, parms, szDevice, sData);
+		return result;
+	}
+	long Connect()
+	{
+		long result;
+		InvokeHelper(0x1b, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+		return result;
+	}
+	long Disconnect()
+	{
+		long result;
+		InvokeHelper(0x1c, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+		return result;
+	}
+
+// Properties
+//
+
+
+
+};
diff --git a/Common_Class/PLCConnector/res/PLCConnector.ico b/Common_Class/PLCConnector/res/PLCConnector.ico
new file mode 100644
index 0000000..a2e618d
--- /dev/null
+++ b/Common_Class/PLCConnector/res/PLCConnector.ico
Binary files differ
diff --git a/Common_Class/PLCConnector/res/PLCConnector.rc2 b/Common_Class/PLCConnector/res/PLCConnector.rc2
new file mode 100644
index 0000000..17be30c
--- /dev/null
+++ b/Common_Class/PLCConnector/res/PLCConnector.rc2
@@ -0,0 +1,13 @@
+//
+// PLCConnector.RC2 - Microsoft Visual C++俊辑 流立 祈笼窍瘤 臼绰 府家胶
+//
+
+#ifdef APSTUDIO_INVOKED
+#error 捞 颇老篮 Microsoft Visual C++俊辑 祈笼且 荐 绝嚼聪促.
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// 咯扁俊 荐悼栏肺 祈笼茄 府家胶甫 眠啊钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/PLCConnector/res/PLCConnectorDoc.ico b/Common_Class/PLCConnector/res/PLCConnectorDoc.ico
new file mode 100644
index 0000000..96365d4
--- /dev/null
+++ b/Common_Class/PLCConnector/res/PLCConnectorDoc.ico
Binary files differ
diff --git a/Common_Class/PLCConnector/res/Toolbar.bmp b/Common_Class/PLCConnector/res/Toolbar.bmp
new file mode 100644
index 0000000..d501723
--- /dev/null
+++ b/Common_Class/PLCConnector/res/Toolbar.bmp
Binary files differ
diff --git a/Common_Class/PLCConnector/res/Toolbar256.bmp b/Common_Class/PLCConnector/res/Toolbar256.bmp
new file mode 100644
index 0000000..91a2553
--- /dev/null
+++ b/Common_Class/PLCConnector/res/Toolbar256.bmp
Binary files differ
diff --git a/Common_Class/PLCConnector/resource.h b/Common_Class/PLCConnector/resource.h
new file mode 100644
index 0000000..f72280d
--- /dev/null
+++ b/Common_Class/PLCConnector/resource.h
@@ -0,0 +1,76 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by PLCConnector.rc
+//
+#define IDD_ABOUTBOX                    100
+#define IDP_OLE_INIT_FAILED             100
+#define IDD_PLCCONNECTOR_FORM           101
+#define IDS_STRING101                   101
+#define IDS_STRING102                   102
+#define IDS_STRING103                   103
+#define IDS_STRING104                   104
+#define IDS_STRING105                   105
+#define IDR_POPUP_EDIT                  119
+#define ID_STATUSBAR_PANE1              120
+#define ID_STATUSBAR_PANE2              121
+#define IDS_STATUS_PANE1                122
+#define IDS_STATUS_PANE2                123
+#define IDS_TOOLBAR_STANDARD            124
+#define IDS_TOOLBAR_CUSTOMIZE           125
+#define ID_VIEW_CUSTOMIZE               126
+#define IDR_MAINFRAME                   128
+#define IDR_MAINFRAME_256               129
+#define IDR_PLCConnectorTYPE            130
+#define IDR_THEME_MENU                  200
+#define ID_SET_STYLE                    201
+#define ID_VIEW_APPLOOK_WIN_2000        210
+#define ID_VIEW_APPLOOK_OFF_XP          211
+#define ID_VIEW_APPLOOK_WIN_XP          212
+#define ID_VIEW_APPLOOK_OFF_2003        213
+#define ID_VIEW_APPLOOK_VS_2005         214
+#define ID_VIEW_APPLOOK_OFF_2007_BLUE   215
+#define ID_VIEW_APPLOOK_OFF_2007_BLACK  216
+#define ID_VIEW_APPLOOK_OFF_2007_SILVER 217
+#define ID_VIEW_APPLOOK_OFF_2007_AQUA   218
+#define IDS_EDIT_MENU                   306
+#define IDD_SET_OPTION                  310
+#define IDR_Tray                        312
+#define IDC_PLCAddress0                 1000
+#define IDC_PLCAddress1                 1001
+#define IDC_PLCAddress2                 1002
+#define IDC_PLCAddress3                 1003
+#define IDC_PLCAddress4                 1004
+#define IDC_CHECK_Signal0               1005
+#define IDC_CHECK_Signal1               1006
+#define IDC_CHECK_Signal2               1007
+#define IDC_CHECK_Signal3               1008
+#define IDC_CHECK_Signal4               1009
+#define IDC_RADIO_MCProtocol            1010
+#define IDC_RADIO_MXComponent           1011
+#define IDC_IPPLCAddress                1012
+#define IDC_EDIT_PLCPort                1013
+#define IDC_EDIT_StationNo              1014
+#define IDC_ACTEASYIF1                  1015
+#define IDC_EDIT_AOISERVER_CAPTION      1015
+#define IDC_ConnetorSatate              1016
+#define IDC_CHECK_Signal5               1016
+#define IDC_CHECK_AOISIGNAL             1016
+#define IDC_CHECK_Scroll                1017
+#define IDC_WRITE_PLCAddress_0          1017
+#define IDC_ACTUTLTYPE1                 1018
+#define ID_32771                        32771
+#define ID_SET_OPTION                   32772
+#define ID__SHOWAPPLICATION             32773
+#define ID__EXIT                        32774
+#define ID_APP_SHOWAPPLICATION          32775
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        313
+#define _APS_NEXT_COMMAND_VALUE         32776
+#define _APS_NEXT_CONTROL_VALUE         1019
+#define _APS_NEXT_SYMED_VALUE           310
+#endif
+#endif
diff --git a/Common_Class/PLCConnector/stdafx.cpp b/Common_Class/PLCConnector/stdafx.cpp
new file mode 100644
index 0000000..8e7d6ba
--- /dev/null
+++ b/Common_Class/PLCConnector/stdafx.cpp
@@ -0,0 +1,8 @@
+
+// stdafx.cpp : 钎霖 器窃 颇老父 甸绢 乐绰 家胶 颇老涝聪促.
+// PLCConnector.pch绰 固府 哪颇老等 庆歹啊 邓聪促.
+// stdafx.obj俊绰 固府 哪颇老等 屈侥 沥焊啊 器窃邓聪促.
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/PLCConnector/stdafx.h b/Common_Class/PLCConnector/stdafx.h
new file mode 100644
index 0000000..2fb4c48
--- /dev/null
+++ b/Common_Class/PLCConnector/stdafx.h
@@ -0,0 +1,66 @@
+
+// stdafx.h : 磊林 荤侩窍瘤父 磊林 函版登瘤绰 臼绰
+// 钎霖 矫胶袍 器窃 颇老 棺 橇肺璃飘 包访 器窃 颇老捞 
+// 甸绢 乐绰 器窃 颇老涝聪促.
+
+#pragma once
+
+#ifndef _SECURE_ATL
+#define _SECURE_ATL 1
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 芭狼 荤侩登瘤 臼绰 郴侩篮 Windows 庆歹俊辑 力寇钦聪促.
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 老何 CString 积己磊绰 疙矫利栏肺 急攫邓聪促.
+
+// MFC狼 傍烹 何盒苞 公矫 啊瓷茄 版绊 皋矫瘤俊 措茄 见扁扁甫 秦力钦聪促.
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h>         // MFC 琴缴 棺 钎霖 备己 夸家涝聪促.
+#include <afxext.h>         // MFC 犬厘涝聪促.
+
+
+#include <afxdisp.h>        // MFC 磊悼拳 努贰胶涝聪促.
+
+#define MAX_READSIGNAL	5
+#define MC_Protocol 1
+#define MX_Componnet 2
+
+#define UM_PRINTPLCDATA	WM_USER+100
+#define UM_EXITPROGRAM		WM_USER+101
+#define UM_TRAY			WM_USER + 102
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // Internet Explorer 4 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>             // Windows 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxcontrolbars.h>     // MFC狼 府夯 棺 牧飘费 阜措 瘤盔
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_IA64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+
diff --git a/Common_Class/PLCConnector/targetver.h b/Common_Class/PLCConnector/targetver.h
new file mode 100644
index 0000000..ad5ca61
--- /dev/null
+++ b/Common_Class/PLCConnector/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 器窃 SDKDDKVer.h绰 荤侩 啊瓷茄 Windows 敲阀汽 吝 滚傈捞 啊厘 臭篮 敲阀汽阑 沥狼钦聪促.
+
+// 捞傈 Windows 敲阀汽俊 措秦 览侩 橇肺弊伐阑 呼靛窍妨绰 版快俊绰 SDKDDKVer.h甫 器窃窍扁 傈俊
+// WinSDKVer.h甫 器窃窍绊 _WIN32_WINNT 概农肺甫 瘤盔窍妨绰 敲阀汽栏肺 汲沥窍绞矫坷.
+
+#include <SDKDDKVer.h>
diff --git a/Common_Class/SISAssem/.gitignore b/Common_Class/SISAssem/.gitignore
new file mode 100644
index 0000000..ea782f7
--- /dev/null
+++ b/Common_Class/SISAssem/.gitignore
@@ -0,0 +1,29 @@
+*.user
+*.opensdf
+*.sdf
+*.obj
+*.tlog
+*.pdb
+*.log
+*.manifest
+*.lst
+*.pch
+*.unsuccessfulbuild
+*.res
+*.cache
+*.lastbuildstate
+*_manifest.rc
+*.idb
+*.sbr
+*.ilk
+*.exp
+*.bsc
+*.ipch
+*.suo
+*.aps
+*.bak
+*.rej
+x64/Debug/
+x64/Release/
+*.suo
+ipch/
\ No newline at end of file
diff --git a/Common_Class/SISAssem/20101008_ConvFloat.asm b/Common_Class/SISAssem/20101008_ConvFloat.asm
new file mode 100644
index 0000000..145702f
--- /dev/null
+++ b/Common_Class/SISAssem/20101008_ConvFloat.asm
@@ -0,0 +1,995 @@
+; Copyright (c) Microsoft Corporation.  All rights reserved.
+
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; but without Source Browser information
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; and Source Browser information also placed in intermediate directory
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+; $(IntDir)\$(InputName).sbr
+
+;.386
+
+;.MODEL FLAT, C
+
+PBYTE	TYPEDEF		PTR BYTE
+PWORD	TYPEDEF		PTR	WORD
+PDWORD	TYPEDEF		PTR DWORD
+
+.data
+	
+
+.code
+
+ImgAddr		equ		r14
+ConAddr		equ		r15
+; maxDefect	equ		r8	; parameterr 3
+; nDefect	equ		r9	; parameter 4
+DefectX		equ		qword ptr[rbp+ 30h]
+DefectY		equ		qword ptr[rbp+ 38h]
+DefectType	equ		qword ptr[rbp+ 40h]
+DefectVal	equ		qword ptr[rbp+ 48h]
+
+iPitch		equ		qword Ptr[rbp+ 50h]
+fSPR		equ		qword ptr[rbp+ 58h]
+sSPR		equ		qword ptr[rbp+ 60h]
+Suppress	equ		qword ptr[rbp+ 68h]
+
+DTH_Val		equ		qword ptr[rbp+ 70h]
+DTH_Add		equ		qword ptr[rbp+ 78h]
+ConvWidth	equ		qword ptr[rbp+ 80h]
+ConvHeight	equ		qword ptr[rbp+ 88h]
+
+InspLeft	equ		qword ptr[rbp+ 90h]
+InspRight	equ		qword ptr[rbp+ 98h]
+InspTop		equ		qword ptr[rbp+ 0a0h]
+InspBottom	equ		qword ptr[rbp+ 0a8h]
+
+BuffWidth	equ		qword ptr[rbp+ 0b0h]
+Threshold	equ		qword ptr[rbp+ 0b8h]
+SPR			equ		qword ptr[rbp+ 0c0h]
+
+Test2		equ		dword ptr[rbp+ 0c0h]
+
+ix			equ		rdx
+iy			equ		rcx
+
+
+ConvFloat PROC
+	local	ConAddrO:	Qword
+	local	WidthV:		Qword
+	local	FAA:		Qword
+	local	FAB:		Qword
+	local	FBB:		Qword
+	local	FCC:		Qword 
+	local	FD:			qword ; PITCH + conv_Width
+	local	ImgAddrAdd:	qword
+	local	SPRV:		qword
+	
+	mov		rax, spr
+	mov		sprv, rax
+
+
+	mov		ImgAddr, rcx
+	mov		ConAddr, rdx
+	mov		ConAddrO, rdx
+
+	
+	mov		rax, BuffWidth
+	mov		rcx, InspTop
+	mul		rcx
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgAddr, rax
+
+
+
+	mov		rax, BuffWidth
+	mov		rcx, ConvHeight
+	mul		rcx
+	mov		WidthV, rax
+
+	;jmp		END_BUFFER
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	
+	mov		r10, DefectX
+	mov		r11, DefectY
+	mov		r12, DefectType
+	mov		r13, DefectVal
+
+
+
+	mov		rax, BuffWidth			; 捞固瘤 器牢磐 捞悼蔼 拌魂(茄青 八荤 场抄 饶 器牢磐 捞悼.)
+	add		rax, InspLeft
+	sub		rax, InspRight
+	mov		ImgAddrAdd, rax
+
+	mov		rax, ConvWidth			; FAA
+	shl		rax, 1
+	mov		FAA, rax
+
+	mov		FAB, rax				; FAB
+	sub		FAB, 2h
+
+	mov		rax, iPitch				; FBB
+	sub		rax, ConvWidth
+	shl		rax, 1
+	mov		FBB, rax
+
+	mov		rax, FAA				; FCC
+	add		rax, FAB
+	add		rax, FBB
+	add		rax, 4
+	mov		FCC, rax
+
+	mov		rax, InspLeft			; FD
+	add		rax, iPitch
+	add		rax, ConvWidth
+	mov		FD, rax
+
+
+	mov			rax, fSPR			; 16bit
+	movd		xmm11, eax
+	movdqa		xmm0, xmm11
+	punpcklwd	xmm0, xmm11
+	pshufd		xmm11, xmm0, 0
+	
+	mov			rax, sSPR			; 16bit
+	movd		xmm12, eax
+	movdqa		xmm0, xmm12
+	punpcklwd	xmm0, xmm12
+	pshufd		xmm12, xmm0, 0
+	
+	movdqa		xmm10, xmm11
+	paddw		xmm10, xmm12
+	
+
+	mov			rax, Suppress		; supress 8bit
+	movd		xmm13, eax
+	movdqa		xmm0, xmm13
+	punpcklbw	xmm13, xmm0
+	movdqa		xmm0, xmm13
+	punpcklbw	xmm0, xmm13
+	pshufd		xmm13, xmm0, 0
+
+	mov			rax, DTH_Val		; 16bit
+	movd		xmm14, eax
+	movdqa		xmm0, xmm14
+	punpcklwd	xmm0, xmm14
+	pshufd		xmm14, xmm0, 0
+
+	mov			rax, DTH_Add		; 16bit
+	movd		xmm15, eax
+	movdqa		xmm0, xmm15
+	punpcklwd	xmm0, xmm15
+	pshufd		xmm15, xmm0, 0
+
+
+
+	mov			rax, Threshold		; 16bit
+	movd		xmm1, eax
+	movdqa		xmm0, xmm1
+	punpcklwd	xmm0, xmm1
+	pshufd		xmm1, xmm0, 0
+
+
+
+	pxor	xmm0, xmm0
+	pxor	xmm4, xmm4
+	pxor	xmm5, xmm5
+
+;LOOP_Y:
+
+LOOP_XY:									; START_16PIXEL:
+	
+	movdqu		xmm8, [ImgAddr]			; 捞固瘤 肺爹
+	movdqa		xmm2, xmm8				; Threshold 父甸扁
+	movdqa		xmm3, xmm8
+	
+	punpcklbw	xmm2, xmm0
+	punpckhbw	xmm3, xmm0
+
+	pcmpgtw		xmm2, XMM14				; 2瞒 巩盼蔼 灌扁
+	pand		xmm2, xmm15				; 2瞒 巩盼蔼 眠啊
+	paddw		xmm2, xmm1				; 2瞒 巩盼蔼 利侩
+	
+	pcmpgtw		xmm3, XMM14				; 2瞒 巩盼蔼 灌扁
+	pand		xmm3, xmm15				; 2瞒 巩盼蔼 眠啊
+	paddw		xmm3, xmm1				; 2瞒 巩盼蔼 利侩
+
+	
+	pxor		xmm6, xmm6			; Set Zero (Vertical Add 蔼 历厘)
+	pxor		xmm7, xmm7
+	
+	xor			rdi, rdi			; Set Zero (Vertical Add count)
+	jmp			VERT_ADD				; 捞固瘤啊 肺爹等 惑怕捞骨肺 ADD肺 免辟.
+
+
+VERT_LOAD:
+	movdqu		xmm8, [ImgAddr]			; 捞固瘤 肺爹
+
+VERT_ADD:
+	
+	movdqa		xmm9, xmm8			; suppress
+	psubusb		xmm9, xmm13			; suppress 焊促 臭篮 蔼 父甸扁 (saturation 0 捞窍绰 0)
+	psubusb		xmm8, xmm9			; suppress 蔼 焊促 臭篮 蔼篮 哗霖促.
+
+	movdqa		xmm9, xmm8			; word肺 攫蒲
+	punpcklbw	xmm8, xmm0
+	punpckhbw	xmm9, xmm0
+	paddw		xmm6, xmm8			; 钦魂 - vertical
+	paddw		xmm7, xmm9
+	add			ImgAddr, BuffWidth
+	
+	inc			rdi					; Vertical LOOP
+	cmp			rdi, ConvHeight
+	jl			VERT_LOAD
+	sub			ImgAddr, WidthV
+	
+	movdqu		[ConAddr], xmm6			; Con_Buff俊 持扁.
+	movdqu		[ConAddr+ 10h], xmm7
+
+;CONV:
+	pxor		xmm8, xmm8			; zero buff
+	pxor		xmm9, xmm9
+	
+	; 哗扁							; STEP 1
+	pmullw		xmm6, xmm10			; *mulFactorOrg
+	pmullw		xmm7, xmm10
+	psubw		xmm8, xmm6			; 穿利 眠啊蔼 拌魂
+	psubw		xmm9, xmm7
+	
+	; 歹窍扁
+	sub			ConAddr, FAA			; STEP 2
+	movdqu		xmm6, [ConAddr]
+	movdqu		xmm7, [ConAddr+10h]
+	pmullw		xmm6, xmm10
+	pmullw		xmm7, xmm10
+	paddw		xmm8, xmm6
+	paddw		xmm9, xmm7
+	
+	; 哗扁 & 哗扁 => 歹窍扁
+	sub			ConAddr, FBB			; STEP 3
+	movdqu		xmm6, [ConAddr]
+	movdqu		xmm7, [ConAddr+10h]
+	pmullw		xmm6, XMM11
+	pmullw		xmm7, XMM11
+	paddw		xmm8, xmm6
+	paddw		xmm9, xmm7
+	
+	sub			ConAddr, 2				; STEP 4
+	movdqu		xmm6, [ConAddr]
+	movdqu		xmm7, [ConAddr+10h]
+	pmullw		xmm6, XMM12
+	pmullw		xmm7, XMM12
+	paddw		xmm8, xmm6
+	paddw		xmm9, xmm7
+
+	sub			ConAddr, FAB			; STEP 5
+	movdqu		xmm6, [ConAddr]
+	movdqu		xmm7, [ConAddr+10h]
+	pmullw		xmm6, XMM11
+	pmullw		xmm7, XMM11
+	psubw		xmm8, xmm6
+	psubw		xmm9, xmm7
+
+	sub			ConAddr, 2				; STEP 6
+	movdqu		xmm6, [ConAddr]
+	movdqu		xmm7, [ConAddr+10h]
+	pmullw		xmm6, XMM12
+	pmullw		xmm7, XMM12
+	psubw		xmm8, xmm6
+	psubw		xmm9, xmm7
+
+	add			ConAddr, FCC			; ADDRESS 盔汗
+
+	
+	movdqu		xmm6, xmm8			; 穿利 矫累.
+	movdqu		xmm7, xmm9
+	
+	pslldq		xmm8, 2				; low 穿利
+	paddw		xmm6, xmm8
+	pslldq		xmm8, 2
+	paddw		xmm6, xmm8
+	pslldq		xmm8, 2
+	paddw		xmm6, xmm8
+	pslldq		xmm8, 2
+	paddw		xmm6, xmm8
+	pslldq		xmm8, 2
+	paddw		xmm6, xmm8
+	pslldq		xmm8, 2
+	paddw		xmm6, xmm8
+	pslldq		xmm8, 2
+	paddw		xmm6, xmm8
+
+	pslldq		xmm9, 2				; hi 穿利
+	paddw		xmm7, xmm9
+	pslldq		xmm9, 2
+	paddw		xmm7, xmm9
+	pslldq		xmm9, 2
+	paddw		xmm7, xmm9
+	pslldq		xmm9, 2
+	paddw		xmm7, xmm9
+	pslldq		xmm9, 2
+	paddw		xmm7, xmm9
+	pslldq		xmm9, 2
+	paddw		xmm7, xmm9
+	pslldq		xmm9, 2
+	paddw		xmm7, xmm9
+	
+	pshufhw		xmm4, xmm5, 0ffh
+	pshufd		xmm4, xmm4, 0ffh	
+	paddw		xmm4, xmm6			; 6苞 7阑 4客 5俊 穿利 (4,5 绰 函版登搁 救登绰 xmm)
+	
+	pshufhw		xmm5, xmm4, 0ffh
+	pshufd		xmm5, xmm5, 0ffh
+	paddw		xmm5, xmm7
+	
+	
+	movdqu		xmm6, xmm4			; 楷魂 困秦 copy (6,7篮 唱窗祭栏肺 CONV 滚欺父甸绊, 8,9绰 SPR 滚欺 弊措肺)
+	movdqu		xmm7, xmm5
+	movdqu		xmm8, xmm4
+	movdqu		xmm9, xmm5
+	
+	psraw		xmm6, spr				; SPR 力芭等 蔼 历厘.蚌祭滚欺甫 钦滚欺肺 父甸扁.
+	psraw		xmm7, spr
+	
+	;ADD			IX, 15
+	;jmp			END_16_PIXEL
+	
+INS_WHITE_DEFECT:
+	pcmpgtw		xmm8, xmm2						; 归搬窃 备盒, threshold 焊促 臭篮 巴篮 1111
+	pcmpgtw		xmm9, xmm3
+	
+	orpd		xmm8, xmm9			; 搬窃捞 茄俺档 绝绰瘤 快急 八荤.
+	pmovmskb	eax,	xmm8
+	cmp			eax, 0
+	jz			INS_WHITE_PASS
+	
+	movdqu		xmm8, xmm4
+	pcmpgtw		xmm8, xmm2
+	
+WHITE_0:
+	pextrw		rdi, xmm8, 0h
+	cmp			rdi, 0
+	je			WHITE_1
+	
+	cmp			rdx, FD
+	jl			WHITE_1
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 0h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+
+WHITE_1:
+	inc			ix
+	pextrw		rdi, xmm8, 1h
+	cmp			rdi, 0
+	je			WHITE_2
+	
+	cmp			rdx, FD
+	jl			WHITE_2
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 1h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_2:
+	inc			ix
+	pextrw		rdi, xmm8, 2h
+	cmp			rdi, 0
+	je			WHITE_3
+	
+	cmp			rdx, FD
+	jl			WHITE_3
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 2h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_3:
+	inc			ix
+	pextrw		rdi, xmm8, 3h
+	cmp			rdi, 0
+	je			WHITE_4
+	
+	cmp			rdx, FD
+	jl			WHITE_4
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 3h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_4:
+	inc			ix
+	pextrw		rdi, xmm8, 4h
+	cmp			rdi, 0
+	je			WHITE_5
+	
+	cmp			rdx, FD
+	jl			WHITE_5
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 4h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_5:
+	inc			ix
+	pextrw		rdi, xmm8, 5h
+	cmp			rdi, 0
+	je			WHITE_6
+	
+	cmp			rdx, FD
+	jl			WHITE_6
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 5h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_6:
+	inc			ix
+	pextrw		rdi, xmm8, 6h
+	cmp			rdi, 0
+	je			WHITE_7
+	
+	cmp			rdx, FD
+	jl			WHITE_7
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 6h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_7:
+	inc			ix
+	pextrw		rdi, xmm8, 7h
+	cmp			rdi, 0
+	je			WHITE_8
+	
+	cmp			rdx, FD
+	jl			WHITE_8
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 7h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_8:
+	inc			ix
+	pextrw		edi, xmm9, 0h
+	cmp			edi, 0
+	je			WHITE_9
+	
+	cmp			rdx, FD
+	jl			WHITE_9
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm7, 0h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_9:
+	inc			ix
+	pextrw		rdi, xmm9, 1h
+	cmp			rdi, 0
+	je			WHITE_10
+	
+	cmp			rdx, FD
+	jl			WHITE_10
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm7, 1h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_10:
+	inc			ix
+	pextrw		rdi, xmm9, 2h
+	cmp			rdi, 0
+	je			WHITE_11
+	
+	cmp			rdx, FD
+	jl			WHITE_11
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm7, 2h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_11:
+	inc			ix
+	pextrw		rdi, xmm9, 3h
+	cmp			rdi, 0
+	je			WHITE_12
+	
+	cmp			rdx, FD
+	jl			WHITE_12
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm7, 3h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_12:
+	inc			ix
+	pextrw		rdi, xmm9, 4h
+	cmp			rdi, 0
+	je			WHITE_13
+	
+	cmp			rdx, FD
+	jl			WHITE_13
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm7, 4h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_13:
+	inc			ix
+	pextrw		rdi, xmm9, 5h
+	cmp			rdi, 0
+	je			WHITE_14
+	
+	cmp			rdx, FD
+	jl			WHITE_14
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm7, 5h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_14:
+	inc			ix
+	pextrw		rdi, xmm9, 6h
+	cmp			rdi, 0
+	je			WHITE_15
+	
+	cmp			rdx, FD
+	jl			WHITE_15
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm7, 6h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+WHITE_15:
+	inc			ix
+	pextrw		edi, xmm9, 7h
+	cmp			edi, 0
+	je			INS_BLACK_DEFECT
+	
+	cmp			rdx, FD
+	jl			END_16_PIXEL
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm7, 7h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 0
+	inc			r9
+	
+	jmp			INS_BLACK_DEFECT
+
+INS_WHITE_PASS:
+	add			ix, 15
+	
+INS_BLACK_DEFECT:
+	cmp			ix, FD
+	jle			END_16_PIXEL
+	
+	
+	psubw		xmm0, xmm2			; minus Threshold 父甸扁.
+	movdqu		xmm2, xmm0
+	pxor		xmm0, xmm0
+	psubw		xmm0, xmm3
+	movdqu		xmm3, xmm0
+	pxor		xmm0, xmm0			; xmm0 绰 亲惑 0栏肺 悸
+	
+	pcmpgtw		xmm2, xmm4			; 孺搬窃 备盒, threshold 焊促 撤篮 巴篮 1111
+	pcmpgtw		xmm3, xmm5
+	
+	movdqu		xmm8, xmm2			; 搬窃捞 茄俺档 绝绰瘤 快急 八荤.
+	orpd		xmm8, xmm3
+	pmovmskb	edi, xmm8
+	cmp			edi, 0
+	jz			END_16_PIXEL
+	
+	sub			ix, 15
+
+BLACK_0:
+	pextrw		edi, xmm2, 0h
+	cmp			edi, 0
+	je			BLACK_1
+	
+	cmp			ix, FD
+	jl			BLACK_1
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 0h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_1:
+	inc			ix
+	pextrw		edi, xmm2, 1h
+	cmp			edi, 0
+	je			BLACK_2
+	
+	cmp			ix, FD
+	jl			BLACK_2
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 1h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_2:
+	inc			ix
+	pextrw		edi, xmm2, 2h
+	cmp			edi, 0
+	je			BLACK_3
+	
+	cmp			ix, FD
+	jl			BLACK_3
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 2h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_3:
+	inc			ix
+	pextrw		edi, xmm2, 3h
+	cmp			edi, 0
+	je			BLACK_4
+	
+	cmp			ix, FD
+	jl			BLACK_4
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 3h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_4:
+	inc			ix
+	pextrw		edi, xmm2, 4h
+	cmp			edi, 0
+	je			BLACK_5
+	
+	cmp			ix, FD
+	jl			BLACK_5
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 4h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_5:
+	inc			ix
+	pextrw		edi, xmm2, 5h
+	cmp			edi, 0
+	je			BLACK_6
+	
+	cmp			ix, FD
+	jl			BLACK_6
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 5h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_6:
+	inc			ix
+	pextrw		edi, xmm2, 6h
+	cmp			edi, 0
+	je			BLACK_7
+	
+	cmp			ix, FD
+	jl			BLACK_7
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 6h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_7:
+	inc			ix
+	pextrw		edi, xmm2, 7h
+	cmp			edi, 0
+	je			BLACK_8
+	
+	cmp			ix, FD
+	jl			BLACK_8
+	
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+	
+	pextrw		edi, xmm6, 7h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+
+BLACK_8:
+	inc			ix
+	pextrw		edi, xmm3, 0h
+	cmp			edi, 0
+	je			BLACK_9
+
+	cmp			ix, FD
+	jl			BLACK_9
+
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+
+	pextrw		edi, xmm7, 0h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_9:
+	inc			ix
+	pextrw		edi, xmm3, 1h
+	cmp			edi, 0
+	je			BLACK_10
+
+	cmp			ix, FD
+	jl			BLACK_10
+
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+
+	pextrw		edi, xmm7, 1h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_10:
+	inc			ix
+	pextrw		edi, xmm3, 2h
+	cmp			edi, 0
+	je			BLACK_11
+
+	cmp			ix, FD
+	jl			BLACK_11
+
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+
+	pextrw		edi, xmm7, 2h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_11:
+	inc			ix
+	pextrw		edi, xmm3, 3h
+	cmp			edi, 0
+	je			BLACK_12
+
+	cmp			ix, FD
+	jl			BLACK_12
+
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+
+	pextrw		edi, xmm7, 3h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_12:
+	inc			ix
+	pextrw		edi, xmm3, 4h
+	cmp			edi, 0
+	je			BLACK_13
+
+	cmp			ix, FD
+	jl			BLACK_13
+
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+
+	pextrw		edi, xmm7, 4h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_13:
+	inc			ix
+	pextrw		edi, xmm3, 5h
+	cmp			edi, 0
+	je			BLACK_14
+
+	cmp			ix, FD
+	jl			BLACK_14
+
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+
+	pextrw		edi, xmm7, 5h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_14:
+	inc			ix
+	pextrw		edi, xmm3, 6h
+	cmp			edi, 0
+	je			BLACK_15
+
+	cmp			ix, FD
+	jl			BLACK_15
+
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+
+	pextrw		edi, xmm7, 6h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+BLACK_15:
+	inc			ix
+	pextrw		edi, xmm3, 7h
+	cmp			edi, 0
+	je			END_16_PIXEL
+
+	cmp			ix, FD
+	jl			END_16_PIXEL
+
+	cmp			r8, r9				; 搬窃滚欺啊 菜瞒搁. 场
+	je			END_BUFFER
+
+	pextrw		edi, xmm7, 7h
+	mov			[r10+ 4*r9], edx
+	mov			[r11+ 4*r9], ecx
+	mov			[r13+ 2*r9], di
+	mov			word ptr [r12+ 2*r9], 1
+	inc			r9
+
+END_16_PIXEL:
+	add		ImgAddr, 10h
+	add		ConAddr, 20h
+	inc		ix						; x Loop
+	cmp		ix, InspRight
+	jl		LOOP_XY
+
+	pxor	xmm4, xmm4
+	pxor	xmm5, xmm5
+	mov		ConAddr, ConAddrO
+	mov		ix, InspLeft
+	add		ImgAddr, ImgAddrAdd
+	inc		iy						; y Loop
+	cmp		iy, InspBottom	
+	jl		LOOP_XY
+
+END_BUFFER:
+
+	mov		rax, r9					; return nDefect
+RET
+ConvFloat ENDP
+
+end
diff --git a/Common_Class/SISAssem/20101008_ConvPixel.asm b/Common_Class/SISAssem/20101008_ConvPixel.asm
new file mode 100644
index 0000000..5651c7f
--- /dev/null
+++ b/Common_Class/SISAssem/20101008_ConvPixel.asm
@@ -0,0 +1,649 @@
+; Copyright (c) Microsoft Corporation.  All rights reserved.
+
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; but without Source Browser information
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; and Source Browser information also placed in intermediate directory
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+; $(IntDir)\$(InputName).sbr
+
+;.386
+
+;.MODEL FLAT, C
+
+PBYTE	TYPEDEF		PTR BYTE
+PWORD	TYPEDEF		PTR	WORD
+PDWORD	TYPEDEF		PTR DWORD
+
+.data
+	
+
+.code
+
+ImgAddr		equ		rsi
+nDefect		equ		rdi
+; maxDefect	equ		r8	; parameterr 3
+; nDefect	equ		r9	; parameter 4
+
+InspLeft	equ		qword ptr[rbp+ 30h]
+InspRight	equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom	equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType	equ		qword ptr[rbp+ 60h]
+DefectVal	equ		qword ptr[rbp+ 68h]
+
+
+GraySrc		equ		qword ptr[rbp+ 70h]
+GrayCmp		equ		qword ptr[rbp+ 78h]
+ZoneId		equ		qword ptr[rbp+ 80h]
+ZoneTh		equ		qword ptr[rbp+ 88h]
+
+BuffWidth	equ		qword ptr[rbp+ 90h]
+iPitch		equ		qword ptr[rbp+ 98h]
+fSPR		equ		qword ptr[rbp+ 0a0h]
+sSPR		equ		qword ptr[rbp+ 0a8h]
+
+Suppress	equ		qword ptr[rbp+ 0b0h]
+DTH_StartTh			equ		qword ptr[rbp+ 0b8h]; StartTh		x 例祈				xmm13 (扁粮 捞抚 ADD)
+DTH_Gradient		equ		qword ptr[rbp+ 0c0h]; Gradient		扁匡扁				xmm14 (扁粮, 绊沥摹)
+DTH_SectionStart	equ		qword ptr[rbp+ 0c8h]; SectionStart	利侩 备埃 弥家摹	xmm15 (扁粮 捞抚 VAL)
+
+ShiftCount	equ		qword ptr[rbp+ 0d0h]
+
+
+ix			equ		rcx
+iy			equ		rdx
+
+
+ConvPixel PROC
+	local	ImgAddrAdd:	qword
+	local	maxDefect:	qword
+	local	Threshold: dword
+	local	ZoneID_Def: dword
+	local	Count2: dword
+	local	ImgAddrOri: qword
+
+	mov		maxDefect, r8
+	mov		nDefect, r9
+	mov		Threshold, edx
+	mov		ZoneID_Def, 0
+	mov		ImgAddr, rcx
+	mov		ImgAddrOri, ImgAddr
+
+
+	mov			rax, Suppress		; supress
+	movd		xmm12, eax
+	movdqa		xmm0, xmm12
+	punpcklbw	xmm12, xmm0
+	movdqa		xmm0, xmm12
+	punpcklbw	xmm0, xmm12
+	pshufd		xmm12, xmm0, 0
+	
+	mov			rax, fSPR		; fSPR
+	movd		xmm10, eax
+	movdqa		xmm0, xmm10
+	punpcklwd	xmm0, xmm10
+	pshufd		xmm10, xmm0, 0
+	
+	mov			rax, sSPR		; sSPR
+	movd		xmm11, eax
+	movdqa		xmm0, xmm11
+	punpcklwd	xmm0, xmm11
+	pshufd		xmm11, xmm0, 0
+
+	
+	movd		xmm2, Threshold		; Threshold
+	movdqa		xmm0, xmm2
+	punpcklwd	xmm0, xmm2
+	pshufd		xmm2, xmm0, 0
+
+
+
+	mov			rax, DTH_StartTh			; 例祈
+	movd		xmm13, eax
+	movdqa		xmm0, xmm13
+	punpcklwd	xmm0, xmm13
+	pshufd		xmm13, xmm0, 0
+
+
+	mov			rax, DTH_Gradient			; 扁匡扁
+	movd		xmm14, eax
+	movdqa		xmm0, xmm14
+	punpcklwd	xmm0, xmm14
+	pshufd		xmm14, xmm0, 0
+
+
+	mov			rax, DTH_SectionStart		; 利侩 备埃 弥家摹 ( :110 捞惑俊辑 DTH 利侩)
+	movd		xmm15, eax
+	movdqa		xmm0, xmm15
+	punpcklwd	xmm0, xmm15
+	pshufd		xmm15, xmm0, 0
+
+
+;	mov			rax, 
+
+
+	
+	mov		rax, BuffWidth	; ImgAddr= ImgAddr+ BuffWidth*InspTop + InspLeft;
+;	mov		rcx, InspTop
+	mul		InspTop
+	add		rax, InspLeft
+;	add		rax, ImgAddr
+	add		ImgAddr, rax
+
+
+
+
+	;jmp		END_BUFFER
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+	sar		rax, 4
+	sal		rax, 4
+	mov		InspRight, rax
+	mov		rax, inspLeft
+	add		InspRight, rax
+
+	mov		rax, BuffWidth			; 捞固瘤 器牢磐 捞悼蔼 拌魂(茄青 八荤 场抄 饶 器牢磐 捞悼.)
+	add		rax, InspLeft
+	sub		rax, InspRight
+	mov		ImgAddrAdd, rax
+	
+	
+	mov		r8, DefectX
+	mov		r9, DefectY
+	mov		r10, DefectType
+	mov		r11, DefectVal
+
+	mov		r12, GraySrc
+	mov		r13, GrayCmp
+	mov		r14, ZoneID
+	mov		r15, ZoneTh
+
+
+
+	
+
+
+LOOP_XY:									; START_16PIXEL:
+	
+	pxor	xmm0, xmm0
+	
+	movdqu	xmm4, [ImgAddr]				; Src Buffer (Value*SPR) - Suppress - Unpack - *SPR
+	movdqa	xmm5, xmm4					; Copy
+	psubusb	xmm4, xmm12					; Suppress
+	psubusb xmm5, xmm4
+	movdqa	xmm4, xmm5					; Src Buff	
+	punpcklbw	xmm4, xmm0				; Unpack
+	punpckhbw	xmm5, xmm0
+	
+	psllw	xmm4, ShiftCount	; Multiply
+	psllw	xmm5, ShiftCount
+
+	
+	mov		rax, iPitch				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	
+	movdqu	xmm6, [ImgAddr+ rax]
+	movdqa	xmm7, xmm6
+	psubusb	xmm6, xmm12					; Suppress
+	psubusb	xmm7, xmm6
+	movdqa	xmm6, xmm7
+	
+	inc		rax
+	movdqu	xmm8, [ImgAddr+ rax]
+	movdqu	xmm9, xmm8
+	psubusb	xmm8, xmm12					; Suppress
+	psubusb	xmm9, xmm8
+	movdqa	xmm8, xmm9
+	
+	punpcklbw	xmm6, xmm0				; Unpack
+	punpckhbw	xmm7, xmm0
+	punpcklbw	xmm8, xmm0
+	punpckhbw	xmm9, xmm0
+	
+	pmullw	xmm6, xmm10					; Compare SPR (fSPR, sSPR)
+	pmullw	xmm7, xmm10
+	pmullw	xmm8, xmm11
+	pmullw	xmm9, xmm11
+	paddw	xmm6, xmm8
+	paddw	xmm7, xmm9
+	
+	mov		Count2, 2
+INSPECT_FIRST8:
+
+	pxor	xmm1, xmm1
+										; Dynamic Threshold 眠免
+	pmaxsw	xmm1, xmm4					; 厚背 侨伎吝 灌篮 侨伎 蔼 茫扁.
+	pmaxsw	xmm1, xmm6
+	psraw	xmm1, ShiftCount				; *SPR
+	movdqa	xmm3, xmm1
+	pcmpgtw	xmm3, xmm15						; DTH_Start 焊促 灌篮 侨伎 茫扁
+	pand	xmm1, xmm3
+	pmullw	xmm1, xmm14						; 扁匡扁利侩 = *slide/256
+	psraw	xmm1, 8
+	pand	xmm3, xmm13						; DTH_Val
+	paddw	xmm1, xmm3					;DTH 眠免
+	
+	movdqa	xmm8, xmm4					; Peak xmm
+	psubw	xmm8, xmm6	
+	psraw	xmm8, ShiftCount
+	
+	movdqa	xmm3, xmm2					; Zone Threshold 利侩
+	pmaxsw	xmm3, xmm1
+	pxor	xmm9, xmm9
+	psubw	xmm9, xmm8
+	pmaxsw	xmm9, xmm8
+	movdqa	xmm0, xmm9
+	pcmpgtw	xmm0, xmm3
+	pmovmskb	rax, xmm0
+	cmp		rax, 0
+	jne		DEFECT_0
+	
+	add		ix, 7
+INSPECT_SECOND8:
+	dec		Count2
+	jz		END_16_PIXEL
+	
+	inc		ix
+
+	pxor	xmm1, xmm1
+										; Dynamic Threshold 眠免
+	pmaxsw	xmm1, xmm5					; 厚背 侨伎吝 灌篮 侨伎 蔼 茫扁.
+	pmaxsw	xmm1, xmm7
+	psraw	xmm1, ShiftCount				; *SPR
+	movdqa	xmm3, xmm1
+	pcmpgtw	xmm3, xmm15						; DTH_Start 焊促 灌篮 侨伎 茫扁
+	pand	xmm1, xmm3
+	pmullw	xmm1, xmm14						; 扁匡扁利侩 = *slide/256
+	psraw	xmm1, 8
+	pand	xmm3, xmm13						; DTH_Val
+	paddw	xmm1, xmm3					;DTH 眠免
+	
+	
+	movdqa	xmm4, xmm5					; Defect 沥焊 眠免阑 犁荤侩 窍扁困秦(low, high)
+	movdqa	xmm6, xmm7
+	
+	movdqa	xmm8, xmm5					; Peak xmm
+	psubw	xmm8, xmm7	
+	psraw	xmm8, ShiftCount
+	
+	movdqa	xmm3, xmm2					; Zone Threshold 利侩
+	pmaxsw	xmm3, xmm1
+	pxor	xmm9, xmm9
+	psubw	xmm9, xmm8
+	pmaxsw	xmm9, xmm8
+	movdqa	xmm0, xmm9
+	pcmpgtw	xmm0, xmm3
+	pmovmskb	rax, xmm0
+	cmp		rax, 0
+	jne		DEFECT_0
+	
+	add		ix, 7
+
+END_16_PIXEL:
+	inc		ix
+	add		ImgAddr, 16
+	cmp		ix, InspRight
+	jl		LOOP_XY
+
+	inc		iy
+	cmp		iy, InspBottom
+	jge		END_BUFFER
+	
+	mov		ix, InspLeft
+	add		ImgAddr, ImgAddrAdd
+	jmp		LOOP_XY
+
+DEFECT_0:
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	psraw	xmm4, ShiftCount
+	psraw	xmm6, ShiftCount
+	
+	
+	pextrw	rax, xmm0, 0h
+	cmp		rax, 0
+	je		DEFECT_1
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 0h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 0h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	rax, xmm8, 0h
+	pextrw	rbx, xmm9, 0h
+	cmp		ax, bx
+	je		POSITIVE_0
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_1
+	
+POSITIVE_0:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+DEFECT_1:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	pextrw	rax, xmm0, 1h
+	cmp		rax, 0
+	je		DEFECT_2
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 1h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 1h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 1h
+	pextrw	ebx, xmm9, 1h
+	cmp		eax, ebx
+	je		POSITIVE_1
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_2
+	
+POSITIVE_1:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_2:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	
+	pextrw	rax, xmm0, 2h
+	cmp		rax, 0
+	je		DEFECT_3
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 2h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 2h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 2h
+	pextrw	ebx, xmm9, 2h
+	cmp		eax, ebx
+	je		POSITIVE_2
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_3
+	
+POSITIVE_2:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_3:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	
+	pextrw	rax, xmm0, 3h
+	cmp		rax, 0
+	je		DEFECT_4
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 3h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 3h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 3h
+	pextrw	ebx, xmm9, 3h
+	cmp		eax, ebx
+	je		POSITIVE_3
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_4
+	
+POSITIVE_3:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_4:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	pextrw	rax, xmm0, 4h
+	cmp		rax, 0
+	je		DEFECT_5
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 4h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 4h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 4h
+	pextrw	ebx, xmm9, 4h
+	cmp		eax, ebx
+	je		POSITIVE_4
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_5
+	
+POSITIVE_4:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_5:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	pextrw	rax, xmm0, 5h
+	cmp		rax, 0
+	je		DEFECT_6
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 5h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 5h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 5h
+	pextrw	ebx, xmm9, 5h
+	cmp		eax, ebx
+	je		POSITIVE_5
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_6
+	
+POSITIVE_5:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+
+DEFECT_6:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	pextrw	rax, xmm0, 6h
+	cmp		rax, 0
+	je		DEFECT_7
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 6h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 6h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 6h
+	pextrw	ebx, xmm9, 6h
+	cmp		eax, ebx
+	je		POSITIVE_6
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_7
+	
+POSITIVE_6:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+
+DEFECT_7:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+
+	pextrw	rax, xmm0, 7h
+	cmp		rax, 0
+	je		INSPECT_SECOND8
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 7h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 7h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 7h
+	pextrw	ebx, xmm9, 7h
+	cmp		eax, ebx
+	je		POSITIVE_7
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+
+	jmp		INSPECT_SECOND8
+	
+POSITIVE_7:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+	jmp		INSPECT_SECOND8
+	
+
+
+
+END_BUFFER:
+
+	mov		rax, nDefect					; return nDefect
+RET
+ConvPixel ENDP
+
+end
diff --git a/Common_Class/SISAssem/20101008_ConvZone.asm b/Common_Class/SISAssem/20101008_ConvZone.asm
new file mode 100644
index 0000000..47d653f
--- /dev/null
+++ b/Common_Class/SISAssem/20101008_ConvZone.asm
@@ -0,0 +1,730 @@
+; Copyright (c) Microsoft Corporation.  All rights reserved.
+
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; but without Source Browser information
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; and Source Browser information also placed in intermediate directory
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+; $(IntDir)\$(InputName).sbr
+
+;.386
+
+;.MODEL FLAT, C
+
+PBYTE	TYPEDEF		PTR BYTE
+PWORD	TYPEDEF		PTR	WORD
+PDWORD	TYPEDEF		PTR DWORD
+
+.data
+	
+
+.code
+
+ImgAddr		equ		rsi
+nDefect		equ		rdi
+; maxDefect	equ		r8	; parameterr 3
+; nDefect	equ		r9	; parameter 4
+
+InspLeft	equ		qword ptr[rbp+ 30h]
+InspRight	equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom	equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType	equ		qword ptr[rbp+ 60h]
+DefectVal	equ		qword ptr[rbp+ 68h]
+
+
+GraySrc		equ		qword ptr[rbp+ 70h]
+GrayCmp		equ		qword ptr[rbp+ 78h]
+ZoneId		equ		qword ptr[rbp+ 80h]
+ZoneTh		equ		qword ptr[rbp+ 88h]
+
+BuffWidth	equ		qword ptr[rbp+ 90h]
+iPitch		equ		qword ptr[rbp+ 98h]
+fSPR		equ		qword ptr[rbp+ 0a0h]
+sSPR		equ		qword ptr[rbp+ 0a8h]
+
+Suppress	equ		qword ptr[rbp+ 0b0h]
+DTH_StartTh			equ		qword ptr[rbp+ 0b8h]; StartTh		x 例祈				xmm13 (扁粮 捞抚 ADD)
+DTH_Gradient		equ		qword ptr[rbp+ 0c0h]; Gradient		扁匡扁				xmm14 (扁粮, 绊沥摹)
+DTH_SectionStart	equ		qword ptr[rbp+ 0c8h]; SectionStart	利侩 备埃 弥家摹	xmm15 (扁粮 捞抚 VAL)
+
+ShiftCount	equ		qword ptr[rbp+ 0d0h]
+ZoneThAddr	equ		qword ptr[rbp+ 0d8h]
+ZoneIdAddr	equ		qword ptr[rbp+ 0e0h]
+ZoneTableW	equ		qword ptr[rbp+ 0e8h]
+
+ZoneTableX	equ		qword ptr[rbp+ 0f0h]
+ZoneTableY	equ		qword ptr[rbp+ 0f8h]
+
+
+ix			equ		rcx
+iy			equ		rdx
+
+
+ConvZone PROC
+	local	ImgAddrAdd:	qword
+	local	ZoneAddrAdd:	qword
+	local	maxDefect:	qword
+	local	Threshold: dword
+	local	ZoneID_Def: dword
+	local	Count2: dword
+	local	ImgAddrOri: qword
+	local	InspWidth2: qword
+
+	mov		maxDefect, r8
+	mov		nDefect, r9
+	mov		Threshold, edx
+	mov		ZoneID_Def, 0
+	mov		ImgAddr, rcx
+	mov		ImgAddrOri, ImgAddr
+
+
+	mov			rax, Suppress		; supress
+	movd		xmm12, eax
+	movdqa		xmm0, xmm12
+	punpcklbw	xmm12, xmm0
+	movdqa		xmm0, xmm12
+	punpcklbw	xmm0, xmm12
+	pshufd		xmm12, xmm0, 0
+	
+	mov			rax, fSPR		; fSPR
+	movd		xmm10, eax
+	movdqa		xmm0, xmm10
+	punpcklwd	xmm0, xmm10
+	pshufd		xmm10, xmm0, 0
+	
+	mov			rax, sSPR		; sSPR
+	movd		xmm11, eax
+	movdqa		xmm0, xmm11
+	punpcklwd	xmm0, xmm11
+	pshufd		xmm11, xmm0, 0
+
+	
+;	movd		xmm2, Threshold		; Threshold
+;	movdqa		xmm0, xmm2
+;	punpcklwd	xmm0, xmm2
+;	pshufd		xmm2, xmm0, 0
+
+
+
+	mov			rax, DTH_StartTh			; 例祈
+	movd		xmm13, eax
+	movdqa		xmm0, xmm13
+	punpcklwd	xmm0, xmm13
+	pshufd		xmm13, xmm0, 0
+
+
+	mov			rax, DTH_Gradient			; 扁匡扁
+	movd		xmm14, eax
+	movdqa		xmm0, xmm14
+	punpcklwd	xmm0, xmm14
+	pshufd		xmm14, xmm0, 0
+
+
+	mov			rax, DTH_SectionStart		; 利侩 备埃 弥家摹 ( :110 捞惑俊辑 DTH 利侩)
+	movd		xmm15, eax
+	movdqa		xmm0, xmm15
+	punpcklwd	xmm0, xmm15
+	pshufd		xmm15, xmm0, 0
+
+
+;	mov			rax, 
+
+
+	mov		rax, ZoneTableW
+	add		ZoneTableW, rax
+	
+	mov		rax, ZoneTableX
+	add		ZoneTableX, rax
+	
+	mov		rax, ZoneTableW
+	mul		ZoneTableY
+	add		rax, ZoneTableX
+	add		ZoneThAddr, rax
+
+	
+	mov		rax, BuffWidth	; ImgAddr= ImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		ImgAddr, rax
+
+
+
+
+	;jmp		END_BUFFER
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+	sar		rax, 4
+	sal		rax, 4
+	mov		InspRight, rax
+	mov		rax, inspLeft
+	add		InspRight, rax
+	
+	
+	;ZoneAddrAdd
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	add		rax, rax
+	mov		InspWidth2, rax
+	
+	mov		rax, ZoneTableW
+	sub		rax, InspWidth2
+	mov		ZoneAddrAdd, rax
+
+	mov		rax, BuffWidth			; 捞固瘤 器牢磐 捞悼蔼 拌魂(茄青 八荤 场抄 饶 器牢磐 捞悼.)
+	sub		rax, InspRight
+	add		rax, InspLeft
+	mov		ImgAddrAdd, rax
+	
+	
+	mov		r8, DefectX
+	mov		r9, DefectY
+	mov		r10, DefectType
+	mov		r11, DefectVal
+
+	mov		r12, GraySrc
+	mov		r13, GrayCmp
+	mov		r14, ZoneID
+	mov		r15, ZoneTh
+
+
+
+	
+
+
+LOOP_XY:									; START_16PIXEL:
+	
+	pxor	xmm0, xmm0
+	
+	movdqu	xmm4, [ImgAddr]				; Src Buffer (Value*SPR) - Suppress - Unpack - *SPR
+	movdqa	xmm5, xmm4					; Copy
+	psubusb	xmm4, xmm12					; Suppress
+	psubusb xmm5, xmm4
+	movdqa	xmm4, xmm5					; Src Buff	
+	punpcklbw	xmm4, xmm0				; Unpack
+	punpckhbw	xmm5, xmm0
+	
+	psllw	xmm4, ShiftCount	; Multiply
+	psllw	xmm5, ShiftCount
+
+	
+	mov		rax, iPitch				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	
+	movdqu	xmm6, [ImgAddr+ rax]
+	movdqa	xmm7, xmm6
+	psubusb	xmm6, xmm12					; Suppress
+	psubusb	xmm7, xmm6
+	movdqa	xmm6, xmm7
+	
+	inc		rax
+	movdqu	xmm8, [ImgAddr+ rax]
+	movdqu	xmm9, xmm8
+	psubusb	xmm8, xmm12					; Suppress
+	psubusb	xmm9, xmm8
+	movdqa	xmm8, xmm9
+	
+	punpcklbw	xmm6, xmm0				; Unpack
+	punpckhbw	xmm7, xmm0
+	punpcklbw	xmm8, xmm0
+	punpckhbw	xmm9, xmm0
+	
+	pmullw	xmm6, xmm10					; Compare SPR (fSPR, sSPR)
+	pmullw	xmm7, xmm10
+	pmullw	xmm8, xmm11
+	pmullw	xmm9, xmm11
+	paddw	xmm6, xmm8
+	paddw	xmm7, xmm9
+	
+	mov		Count2, 1
+INSPECT_FIRST8:
+
+	pxor	xmm1, xmm1
+										; Dynamic Threshold 眠免
+	pmaxsw	xmm1, xmm4					; 厚背 侨伎吝 灌篮 侨伎 蔼 茫扁.
+	pmaxsw	xmm1, xmm6
+	psraw	xmm1, ShiftCount				; *SPR
+	movdqa	xmm3, xmm1
+	pcmpgtw	xmm3, xmm15						; DTH_Start 焊促 灌篮 侨伎 茫扁
+	pand	xmm1, xmm3
+	pmullw	xmm1, xmm14						; 扁匡扁利侩 = *slide/256
+	psraw	xmm1, 8
+	pand	xmm3, xmm13						; DTH_Val
+	paddw	xmm1, xmm3					;DTH 眠免
+	
+	movdqa	xmm8, xmm4					; Peak xmm
+	psubw	xmm8, xmm6	
+	psraw	xmm8, ShiftCount
+	
+	mov		rax, ZoneThAddr
+	movdqu	xmm2, [rax]
+	movdqa	xmm3, xmm2					; Zone Threshold 利侩
+	pmaxsw	xmm3, xmm1
+	pxor	xmm9, xmm9
+	psubw	xmm9, xmm8
+	pmaxsw	xmm9, xmm8
+	movdqa	xmm0, xmm9
+	pcmpgtw	xmm0, xmm3
+	pmovmskb	rax, xmm0
+	cmp		rax, 0
+	jne		DEFECT_0
+	
+	add		ix, 7
+INSPECT_SECOND8:
+	add		ZoneThAddr, 16
+	add		ZoneIdAddr, 16
+	dec		Count2
+	jnz		END_16_PIXEL
+	
+	inc		ix
+
+	pxor	xmm1, xmm1
+										; Dynamic Threshold 眠免
+	pmaxsw	xmm1, xmm5					; 厚背 侨伎吝 灌篮 侨伎 蔼 茫扁.
+	pmaxsw	xmm1, xmm7
+	psraw	xmm1, ShiftCount				; *SPR
+	movdqa	xmm3, xmm1
+	pcmpgtw	xmm3, xmm13						; DTH_Start 焊促 灌篮 侨伎 茫扁
+	pand	xmm1, xmm3
+	pmullw	xmm1, xmm15						; 扁匡扁利侩 = *slide/256
+	psraw	xmm1, 8
+	pand	xmm3, xmm14						; DTH_Val
+	paddw	xmm1, xmm3					;DTH 眠免
+	
+	
+	movdqa	xmm4, xmm5					; Defect 沥焊 眠免阑 犁荤侩 窍扁困秦(low, high)
+	movdqa	xmm6, xmm7
+	
+	movdqa	xmm8, xmm5					; Peak xmm
+	psubw	xmm8, xmm7	
+	psraw	xmm8, ShiftCount
+	
+	mov		rax, ZoneThAddr
+	movdqu	xmm2, [rax]
+	movdqa	xmm3, xmm2					; Zone Threshold 利侩
+	pmaxsw	xmm3, xmm1
+	pxor	xmm9, xmm9
+	psubw	xmm9, xmm8
+	pmaxsw	xmm9, xmm8
+	movdqa	xmm0, xmm9
+	pcmpgtw	xmm0, xmm3
+	pmovmskb	rax, xmm0
+	cmp		rax, 0
+	jne		DEFECT_0
+	
+	add		ix, 7
+	add		ZoneThAddr, 16
+	add		ZoneIdAddr, 16
+
+END_16_PIXEL:
+	inc		ix
+	add		ImgAddr, 16
+	cmp		ix, InspRight
+	jl		LOOP_XY
+
+	inc		iy
+	cmp		iy, InspBottom
+	jge		END_BUFFER
+	
+	mov		ix, InspLeft
+	add		ImgAddr, ImgAddrAdd
+	mov		rax, ZoneAddrAdd
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	jmp		LOOP_XY
+
+DEFECT_0:
+	cmp		nDefect, maxDefect
+	je		END_BUFFER
+	
+	psraw	xmm4, ShiftCount
+	psraw	xmm6, ShiftCount
+	
+	mov		rax, ZoneIdAddr
+	movdqu	xmm3, [rax]
+	
+	
+	pextrw	rax, xmm0, 0h
+	cmp		rax, 0
+	je		DEFECT_1
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	
+	pextrw	eax, xmm4, 0h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 0h
+	mov		[r13+ 4*nDefect], eax
+	
+	pextrw	eax, xmm3, 0h
+	mov		dword ptr [r14+ 4*nDefect], eax
+	
+	pextrw	eax, xmm2, 0h
+	mov		Threshold, eax
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	rax, xmm8, 0h
+	pextrw	rbx, xmm9, 0h
+	cmp		ax, bx
+	je		POSITIVE_0
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_1
+	
+POSITIVE_0:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+DEFECT_1:
+	inc		ix
+	cmp		nDefect, maxDefect
+	je		END_BUFFER
+	
+	pextrw	rax, xmm0, 1h
+	cmp		rax, 0
+	je		DEFECT_2
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 1h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 1h
+	mov		[r13+ 4*nDefect], eax
+	
+	pextrw	eax, xmm3, 1h
+	mov		dword ptr [r14+ 4*nDefect], eax
+	
+	pextrw	eax, xmm2, 1h
+	mov		Threshold, eax
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 1h
+	pextrw	ebx, xmm9, 1h
+	cmp		eax, ebx
+	je		POSITIVE_1
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_2
+	
+POSITIVE_1:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_2:
+	inc		ix
+	cmp		nDefect, maxDefect
+	je		END_BUFFER
+	
+	
+	pextrw	rax, xmm0, 2h
+	cmp		rax, 0
+	je		DEFECT_3
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 2h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 2h
+	mov		[r13+ 4*nDefect], eax
+		
+	pextrw	eax, xmm3, 2h
+	mov		dword ptr [r14+ 4*nDefect], eax
+	
+	pextrw	eax, xmm2, 2h
+	mov		Threshold, eax
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+
+	
+	pextrw	eax, xmm8, 2h
+	pextrw	ebx, xmm9, 2h
+	cmp		eax, ebx
+	je		POSITIVE_2
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_3
+	
+POSITIVE_2:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_3:
+	inc		ix
+	cmp		nDefect, maxDefect
+	je		END_BUFFER
+	
+	
+	pextrw	rax, xmm0, 3h
+	cmp		rax, 0
+	je		DEFECT_4
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 3h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 3h
+	mov		[r13+ 4*nDefect], eax
+		
+	pextrw	eax, xmm3, 3h
+	mov		dword ptr [r14+ 4*nDefect], eax
+	
+	pextrw	eax, xmm2, 3h
+	mov		Threshold, eax
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+
+	
+	pextrw	eax, xmm8, 3h
+	pextrw	ebx, xmm9, 3h
+	cmp		eax, ebx
+	je		POSITIVE_3
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_4
+	
+POSITIVE_3:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_4:
+	inc		ix
+	cmp		nDefect, maxDefect
+	je		END_BUFFER
+	
+	pextrw	rax, xmm0, 4h
+	cmp		rax, 0
+	je		DEFECT_5
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 4h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 4h
+	mov		[r13+ 4*nDefect], eax
+		
+	pextrw	eax, xmm3, 4h
+	mov		dword ptr [r14+ 4*nDefect], eax
+	
+	pextrw	eax, xmm2, 4h
+	mov		Threshold, eax
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+
+	
+	pextrw	eax, xmm8, 4h
+	pextrw	ebx, xmm9, 4h
+	cmp		eax, ebx
+	je		POSITIVE_4
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_5
+	
+POSITIVE_4:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_5:
+	inc		ix
+	cmp		nDefect, maxDefect
+	je		END_BUFFER
+	
+	pextrw	rax, xmm0, 5h
+	cmp		rax, 0
+	je		DEFECT_6
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 5h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 5h
+	mov		[r13+ 4*nDefect], eax
+		
+	pextrw	eax, xmm3, 5h
+	mov		dword ptr [r14+ 4*nDefect], eax
+	
+	pextrw	eax, xmm2, 5h
+	mov		Threshold, eax
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+
+	
+	pextrw	eax, xmm8, 5h
+	pextrw	ebx, xmm9, 5h
+	cmp		eax, ebx
+	je		POSITIVE_5
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_6
+	
+POSITIVE_5:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+
+DEFECT_6:
+	inc		ix
+	cmp		nDefect, maxDefect
+	je		END_BUFFER
+	
+	pextrw	rax, xmm0, 6h
+	cmp		rax, 0
+	je		DEFECT_7
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 6h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 6h
+	mov		[r13+ 4*nDefect], eax
+		
+	pextrw	eax, xmm3, 6h
+	mov		dword ptr [r14+ 4*nDefect], eax
+	
+	pextrw	eax, xmm2, 6h
+	mov		Threshold, eax
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+
+	
+	pextrw	eax, xmm8, 6h
+	pextrw	ebx, xmm9, 6h
+	cmp		eax, ebx
+	je		POSITIVE_6
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_7
+	
+POSITIVE_6:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+
+DEFECT_7:
+	inc		ix
+	cmp		nDefect, maxDefect
+	je		END_BUFFER
+	
+
+	pextrw	rax, xmm0, 7h
+	cmp		rax, 0
+	je		INSPECT_SECOND8
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 7h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 7h
+	mov		[r13+ 4*nDefect], eax
+		
+	pextrw	eax, xmm3, 7h
+	mov		dword ptr [r14+ 4*nDefect], eax
+	
+	pextrw	eax, xmm2, 7h
+	mov		Threshold, eax
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+
+	
+	pextrw	eax, xmm8, 7h
+	pextrw	ebx, xmm9, 7h
+	cmp		eax, ebx
+	je		POSITIVE_7
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+
+	jmp		INSPECT_SECOND8
+	
+POSITIVE_7:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+	jmp		INSPECT_SECOND8
+	
+
+
+
+END_BUFFER:
+
+	mov		rax, nDefect					; return nDefect
+RET
+ConvZone ENDP
+
+end
diff --git a/Common_Class/SISAssem/ASGInspection.cpp b/Common_Class/SISAssem/ASGInspection.cpp
new file mode 100644
index 0000000..fea5fd5
--- /dev/null
+++ b/Common_Class/SISAssem/ASGInspection.cpp
@@ -0,0 +1,278 @@
+#include "stdafx.h"
+#include "ASGInspection.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CASGInspection
+
+CASGInspection::CASGInspection()
+{		
+	m_pPixelX = m_pPixelY = m_nPixelCnt = NULL;
+	m_pPixelType = m_pPixelValue = NULL;
+	m_pDefectParing = NULL;
+	m_nDefectParingCnt = 0;
+
+	InitializeCriticalSection(&m_csDefect);
+}
+
+CASGInspection::~CASGInspection()
+{
+	DeleteCriticalSection(&m_csDefect);
+}
+
+BOOL CASGInspection::GetBufferCheck()
+{
+	if(m_pPixelX == NULL || m_pPixelY == NULL || m_pPixelType == NULL || m_pPixelValue == NULL || m_nPixelCnt == NULL)
+		return FALSE;
+
+	return TRUE;
+}
+
+void CASGInspection::SetPixelData(int x, int y, int sub, int threshold)
+{
+	m_pPixelX[*m_nPixelCnt] = x;
+	m_pPixelY[*m_nPixelCnt] = y;
+
+	if(sub > 0)
+		m_pPixelType[*m_nPixelCnt] = 0;
+	else
+		m_pPixelType[*m_nPixelCnt] = 1;
+	m_pPixelValue[*m_nPixelCnt] = abs(sub);	
+
+	*m_nPixelCnt++;
+}
+
+BOOL CASGInspection::InsertPairing(int x, int y, int sub, int threshold, int graySrc, int grayRef)
+{
+	EnterCriticalSection(&m_csDefect);
+
+	if(m_pDefectParing == NULL || 
+		m_nDefectParingCnt >= MAX_DEFECTPIX_NUM || m_nDefectParingCnt < 0)
+	{
+		LeaveCriticalSection(&m_csDefect);
+		return FALSE;
+	}
+
+	int			nCnt = m_nDefectParingCnt;
+	m_pDefectParing[nCnt].s_DefectPair= DEFPAIR_PPAIR;
+	if(sub > 0)
+		m_pDefectParing[nCnt].s_DefectType= DEFTYPE_BLACK;
+	else
+		m_pDefectParing[nCnt].s_DefectType= DEFTYPE_WHITE;
+
+	m_pDefectParing[nCnt].s_fDefectPeak= abs(sub);
+
+	m_pDefectParing[nCnt].s_nDefectX= x;
+	m_pDefectParing[nCnt].s_nDefectY= y;
+	m_pDefectParing[nCnt].s_nGraySrc= graySrc;
+	m_pDefectParing[nCnt].s_nGrayRef= grayRef;
+	m_nDefectParingCnt++;
+
+	LeaveCriticalSection(&m_csDefect);
+
+	return TRUE;
+}
+
+void CASGInspection::VConvolutionConvC(CConvParam *pParam)
+{
+	if(m_pDefectParing == NULL)
+		return;
+
+	m_nDefectParingCnt = 0;
+
+	int sx, ex, sy, ey;
+	sx=	pParam->s_RectConv.left;
+	ex= pParam->s_RectConv.right;
+	sy= pParam->s_RectConv.top;
+	ey= pParam->s_RectConv.bottom;
+
+	int nPitch = (int)pParam->GetRealScanPitch();	
+	int nPitch_p = nPitch+1;
+	int nConvWidth = pParam->s_nConvWidth;
+	int nConvHeight = pParam->s_nConvHeight;
+	int	nHalfConvWidth = nConvWidth/2;
+	int	nHalfConvHeight = nConvHeight/2;
+
+	ex -= nConvWidth;
+	ey -= nConvHeight;
+
+#define CONV_PIXEL_DIVIDE 16
+
+	int Threshold = pParam->s_nThreshold;
+	int SubPixel = (int)((pParam->GetRealScanPitch()-nPitch)*CONV_PIXEL_DIVIDE+ 0.5);
+	int SubPixel_DIVIDE =  CONV_PIXEL_DIVIDE - SubPixel;
+	int NegThres = Threshold*-1;
+
+	double f2pitch = pParam->GetRealScanPitch()*2;
+	int n2Pitch = (int)f2pitch;	
+	int n2Pitch_p = n2Pitch+1;
+	int Sub2Pixel = (int)((f2pitch-n2Pitch)*CONV_PIXEL_DIVIDE+ 0.5);
+	int Sub2Pixel_DIVIDE = CONV_PIXEL_DIVIDE - Sub2Pixel;
+
+	int		SrcValue = 0;
+	int		DestValue = 0;
+	int		DestValue1 = 0;
+	int		DestValue2 = 0;
+	int		SubValue = 0;	
+	int		i = 0;
+
+	int		iLoopX,iLoopY;
+	int		DestValue2Pitch,SubValue2Pitch;	
+	int		j;
+	int		nImageWidth = pParam->s_nFrameWidth;
+	LPBYTE	pSrc = pParam->s_lpBuffer;	
+	int		nRefVal;
+
+	//0~pitch 芭府鳖瘤
+	for( j = sy; j < sy+ nPitch_p; j++)
+	{
+		for( i = sx; i < ex; i++)	
+		{
+			SrcValue = DestValue = DestValue2Pitch = 0;			
+			for(iLoopX=i;iLoopX<i+nConvWidth;iLoopX++)
+			{
+				for(iLoopY=j;iLoopY<j+nConvHeight;iLoopY++)
+				{	
+					nRefVal = *(pSrc+iLoopX+iLoopY*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					SrcValue += nRefVal;
+
+					nRefVal = *(pSrc+iLoopX+(iLoopY+nPitch)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue1 = nRefVal;
+					nRefVal = *(pSrc+iLoopX+(iLoopY+nPitch_p)*nImageWidth);	
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue2 = nRefVal;					
+					DestValue += (DestValue1*(SubPixel_DIVIDE) + DestValue2*(SubPixel))/CONV_PIXEL_DIVIDE;	
+
+					nRefVal = *(pSrc+iLoopX+(iLoopY+n2Pitch)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue1 = nRefVal;
+					nRefVal = *(pSrc+iLoopX+(iLoopY+n2Pitch_p)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue2 = nRefVal;			
+					DestValue2Pitch += (DestValue1*(Sub2Pixel_DIVIDE) + DestValue2*Sub2Pixel)/CONV_PIXEL_DIVIDE;
+				}
+			}
+
+			SubValue = DestValue - SrcValue;
+			SubValue2Pitch = DestValue2Pitch - SrcValue;
+
+			if ((SubValue > Threshold && SubValue2Pitch > Threshold) ||
+				(SubValue < NegThres && SubValue2Pitch < NegThres))
+			{	
+
+				if(!InsertPairing(i+nHalfConvWidth,j+nHalfConvHeight,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2Pitch))
+					return;
+			}
+		}
+	}
+
+	//pitch~pitch 芭府鳖瘤
+	for( j = sy+ nPitch+1; j < ey-nPitch_p; j++)
+	{
+		for( i = sx; i < ex; i++)	
+		{
+			SrcValue = DestValue = DestValue2Pitch = 0;			
+			for(iLoopX=i;iLoopX<i+nConvWidth;iLoopX++)
+			{
+				for(iLoopY=j;iLoopY<j+nConvHeight;iLoopY++)
+				{					
+					nRefVal = *(pSrc+iLoopX+iLoopY*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					SrcValue += nRefVal;
+
+					nRefVal = *(pSrc+iLoopX+(iLoopY+nPitch)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue1 = nRefVal;
+					nRefVal = *(pSrc+iLoopX+(iLoopY+nPitch_p)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue2 = nRefVal;												
+					DestValue += (DestValue1*(SubPixel_DIVIDE) + DestValue2*(SubPixel))/CONV_PIXEL_DIVIDE;
+
+					nRefVal = *(pSrc+iLoopX+(iLoopY-nPitch)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue1 = nRefVal;
+					nRefVal = *(pSrc+iLoopX+(iLoopY-nPitch_p)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue2 = nRefVal;		
+					DestValue2Pitch += (DestValue1*(SubPixel_DIVIDE) + DestValue2*SubPixel)/CONV_PIXEL_DIVIDE;						
+				}
+			}
+
+			SubValue = DestValue - SrcValue;
+			SubValue2Pitch = DestValue2Pitch - SrcValue;
+
+			if ((SubValue > Threshold && SubValue2Pitch > Threshold) ||
+				(SubValue < NegThres && SubValue2Pitch < NegThres))
+			{					
+				if(!InsertPairing(i+nHalfConvWidth,j+nHalfConvHeight,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2Pitch))
+					return;
+			}	
+		}
+	}
+
+	//0~pitch 芭府鳖瘤
+	for( j = ey-nPitch_p; j < ey; j++)
+	{
+		for( i = sx; i < ex; i++)	
+		{
+			SrcValue = DestValue = DestValue2Pitch = 0;			
+			for(iLoopX=i;iLoopX<i+nConvWidth;iLoopX++)
+			{
+				for(iLoopY=j;iLoopY<j+nConvHeight;iLoopY++)
+				{				
+					nRefVal = *(pSrc+iLoopX+iLoopY*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					SrcValue += nRefVal;
+
+					nRefVal = *(pSrc+iLoopX+(iLoopY-nPitch)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue1 = nRefVal;
+					nRefVal = *(pSrc+iLoopX+(iLoopY-nPitch_p)*nImageWidth);	
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue2 = nRefVal;						
+					DestValue += (DestValue1*(SubPixel_DIVIDE) + DestValue2*(SubPixel))/CONV_PIXEL_DIVIDE;
+
+					nRefVal = *(pSrc+iLoopX+(iLoopY-n2Pitch)*nImageWidth);
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue1 = nRefVal;
+					nRefVal = *(pSrc+iLoopX+(iLoopY-n2Pitch_p)*nImageWidth);	
+					if(nRefVal >= pParam->s_nThresholdSupress)
+						nRefVal = pParam->s_nThresholdSupress;
+					DestValue2 = nRefVal;					
+					DestValue2Pitch += (DestValue1*(Sub2Pixel_DIVIDE) + DestValue2*Sub2Pixel)/CONV_PIXEL_DIVIDE;					
+				}
+			}
+
+			SubValue = DestValue - SrcValue;
+			SubValue2Pitch = DestValue2Pitch - SrcValue;
+
+			if ((SubValue > Threshold && SubValue2Pitch > Threshold) ||
+				(SubValue < NegThres && SubValue2Pitch < NegThres))
+			{					
+				if(!InsertPairing(i+nHalfConvWidth,j+nHalfConvHeight,abs(SubValue)>abs(SubValue2Pitch)?SubValue:SubValue2Pitch,Threshold,SrcValue, DestValue2Pitch))
+					return;
+			}	
+		}
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/SISAssem/AssemDefect.cpp b/Common_Class/SISAssem/AssemDefect.cpp
new file mode 100644
index 0000000..054fc2a
--- /dev/null
+++ b/Common_Class/SISAssem/AssemDefect.cpp
@@ -0,0 +1,228 @@
+#include "StdAfx.h"
+#include "AssemDefect.h"
+
+
+void CDefectBlob::CreateBlob(CDefectPair *pPair, int id)
+{
+	ResetReuse();
+
+	CheckDefectRect(pPair->s_nDefectX, pPair->s_nDefectY);
+	s_sZonePixelCount[pPair->s_nZone] = 1;
+	//SetDefectPos(pPair->s_DefectPos);
+	s_DefectPos= pPair->s_DefectPos;
+	//SetDefectPair(pPair->s_DefectPair);
+	s_DefectPair= pPair->s_DefectPair;
+	s_nIndex			= id;
+	s_nDefectArea	= 1;
+	s_nPadRegionIdx	= -1;
+	s_nDefectX		= pPair->s_nDefectX;
+	s_nDefectY		= pPair->s_nDefectY;
+	s_DefectType		= pPair->s_DefectType;			//角力 归搬窃篮 1,孺搬窃篮 0
+	s_sThreshold		= pPair->s_nThresold;
+	s_nThresholdSum		= pPair->s_nThresold;
+	// Gray 备窍扁
+	s_sLevelSrcMax = pPair->s_nGraySrc;
+	s_xLevelSrcMax = pPair->s_nDefectX;
+	s_yLevelSrcMax = pPair->s_nDefectY;
+
+	s_sLevelSrcMin = pPair->s_nGraySrc;
+	s_nLevelSrcSum = pPair->s_nGraySrc;
+
+	s_sLevelRefMax = pPair->s_nGrayRef;
+	s_sLevelRefMin = pPair->s_nGrayRef;
+	s_nLevelRefSum = pPair->s_nGrayRef;
+
+	int nDiffGray;
+//	nDiffGray= abs(7);
+
+	//BOE Float 葛碘俊辑 Th甫 救哗辑 唱柯促.(Pixel, Zone 篮 哗辑 唱咳)
+	//nDiffGray= abs(pPair->s_fDefectPeak);//abs(pPair->s_nGraySrc - pPair->s_nGrayRef);
+	nDiffGray= pPair->s_fDefectPeak;
+
+	s_sLevelDiffMax = nDiffGray+ s_sThreshold;
+	s_sDefectPeak = nDiffGray;//abs(s_sLevelDiffMax) - nThres;
+	//s_sDefectPeak = abs(s_sLevelDiffMax / 8) - nThres;
+	s_xMaxPeak= pPair->s_nDefectX;
+	s_yMaxPeak= pPair->s_nDefectY;
+
+	s_sLevelDiffMin = nDiffGray+ s_sThreshold;
+	s_nLevelDiffSum = nDiffGray+ s_sThreshold;
+	s_sZoneValueMin[pPair->s_nZone] = s_sZoneValueMax[pPair->s_nZone] = s_sZoneValueSum[pPair->s_nZone] = nDiffGray;
+}
+
+void CDefectBlob::IncludePair(CDefectPair *pPair)
+{
+	s_sZonePixelCount[pPair->s_nZone]++;
+
+	CheckDefectRect(pPair->s_nDefectX, pPair->s_nDefectY);
+
+	SetDefectPos(pPair->s_DefectPos);
+	SetDefectPair(pPair->s_DefectPair);
+	s_nDefectArea++;
+	s_nDefectX += pPair->s_nDefectX;
+	s_nDefectY += pPair->s_nDefectY;
+	int nThres= pPair->s_nThresold;
+	if (nThres > s_sThreshold)
+		s_sThreshold = nThres;
+	s_nThresholdSum += pPair->s_nThresold;
+
+	// Gray 备窍扁
+	if (pPair->s_nGraySrc > s_sLevelSrcMax)
+	{
+		s_sLevelSrcMax = pPair->s_nGraySrc;
+		s_xLevelSrcMax = pPair->s_nDefectX;
+		s_yLevelSrcMax = pPair->s_nDefectY;
+	}
+	if (pPair->s_nGraySrc < s_sLevelSrcMin)
+		s_sLevelSrcMin = pPair->s_nGraySrc;
+	s_nLevelSrcSum += pPair->s_nGraySrc;
+
+	if (pPair->s_nGrayRef > s_sLevelRefMax)
+		s_sLevelRefMax = pPair->s_nGrayRef;
+	if (pPair->s_nGrayRef < s_sLevelRefMin)
+		s_sLevelRefMin = pPair->s_nGrayRef;
+	s_nLevelRefSum += pPair->s_nGrayRef;
+
+	//BOE Float 葛碘俊辑 Th甫 救哗辑 唱柯促.(Pixel, Zone 篮 哗辑 唱咳)
+	//int nDiffGray = abs(pPair->s_fDefectPeak);//abs(pPair->s_nGraySrc - pPair->s_nGrayRef);
+	int nDiffGray = pPair->s_fDefectPeak;
+	if (nDiffGray > s_sDefectPeak)
+	{
+		s_sLevelDiffMax = nDiffGray+ nThres;
+		s_sDefectPeak = nDiffGray;
+		s_xMaxPeak= pPair->s_nDefectX;
+		s_yMaxPeak= pPair->s_nDefectY;
+		//s_sDefectPeak = abs(s_sLevelDiffMax / 8) - nThres;
+	}
+	if (nDiffGray < s_sLevelDiffMin)
+		s_sLevelDiffMin = nDiffGray+ nThres;
+	s_nLevelDiffSum += (nDiffGray+ nThres);
+
+	s_sZoneValueMin[pPair->s_nZone] = min(s_sZoneValueMin[pPair->s_nZone],nDiffGray);
+	s_sZoneValueMax[pPair->s_nZone] = max(s_sZoneValueMax[pPair->s_nZone],nDiffGray);
+	s_sZoneValueSum[pPair->s_nZone] = (s_sZoneValueSum[pPair->s_nZone]+nDiffGray);
+
+}
+void CDefectBlob::CheckDefectRect(int nX, int nY)
+{
+	if (nY <= s_DefectRect.top)
+	{
+		s_DefectRect.top = nY;
+		if (s_ptVertex[2].y == nY)	// Top Left
+		{
+			if (nX < s_ptVertex[2].x)
+			{
+				s_ptVertex[2].x = nX;
+				s_ptVertex[2].y = nY;
+			}
+		}
+		else
+		{
+			s_ptVertex[2].x = nX;
+			s_ptVertex[2].y = nY;
+		}
+		if (s_ptVertex[3].y == nY)	// Top Right
+		{
+			if (nX + 1 > s_ptVertex[3].x)
+			{
+				s_ptVertex[3].x = nX + 1;
+				s_ptVertex[3].y = nY;
+			}
+		}
+		else
+		{
+			s_ptVertex[3].x = nX + 1;
+			s_ptVertex[3].y = nY;
+		}
+	}
+	if (nY + 1 >= s_DefectRect.bottom)
+	{
+		s_DefectRect.bottom = nY + 1;
+		if (s_ptVertex[6].y == nY + 1)	// Bottom Left
+		{
+			if (nX < s_ptVertex[6].x)
+			{
+				s_ptVertex[6].x = nX;
+				s_ptVertex[6].y = nY + 1;
+			}
+		}
+		else
+		{
+			s_ptVertex[6].x = nX;
+			s_ptVertex[6].y = nY + 1;
+		}
+		if (s_ptVertex[7].y == nY + 1)	// Bottom Right
+		{
+			if (nX + 1 > s_ptVertex[7].x)
+			{
+				s_ptVertex[7].x = nX + 1;
+				s_ptVertex[7].y = nY + 1;
+			}
+		}
+		else
+		{
+			s_ptVertex[7].x = nX + 1;
+			s_ptVertex[7].y = nY + 1;
+		}
+	}
+	if (nX <= s_DefectRect.left)
+	{
+		s_DefectRect.left = nX;
+		if (s_ptVertex[1].x == nX)	// Left Bottom
+		{
+			if (nY + 1 > s_ptVertex[1].y)
+			{
+				s_ptVertex[1].x = nX;
+				s_ptVertex[1].y = nY + 1;
+			}
+		}
+		else
+		{
+			s_ptVertex[1].x = nX;
+			s_ptVertex[1].y = nY + 1;
+		}
+		if (s_ptVertex[0].x == nX)	// Left Top
+		{
+			if (nY < s_ptVertex[0].y)
+			{
+				s_ptVertex[0].x = nX;
+				s_ptVertex[0].y = nY;
+			}
+		}
+		else
+		{
+			s_ptVertex[0].x = nX;
+			s_ptVertex[0].y = nY;
+		}
+	}
+	if (nX + 1 >= s_DefectRect.right)
+	{
+		s_DefectRect.right = nX + 1;
+		if (s_ptVertex[5].x == nX + 1)	// Right Bottom
+		{
+			if (nY + 1 > s_ptVertex[5].y)
+			{
+				s_ptVertex[5].x = nX + 1;
+				s_ptVertex[5].y = nY + 1;
+			}
+		}
+		else
+		{
+			s_ptVertex[5].x = nX + 1;
+			s_ptVertex[5].y = nY + 1;
+		}
+		if (s_ptVertex[4].x == nX + 1)	// Right Top
+		{
+			if (nY < s_ptVertex[4].y)
+			{
+				s_ptVertex[4].x = nX + 1;
+				s_ptVertex[4].y = nY;
+			}
+		}
+		else
+		{
+			s_ptVertex[4].x = nX + 1;
+			s_ptVertex[4].y = nY;
+		}
+	}
+}
diff --git a/Common_Class/SISAssem/AssemParam.cpp b/Common_Class/SISAssem/AssemParam.cpp
new file mode 100644
index 0000000..33e5bd7
--- /dev/null
+++ b/Common_Class/SISAssem/AssemParam.cpp
@@ -0,0 +1,3 @@
+#include "StdAfx.h"
+#include "AssemParam.h"
+
diff --git a/Common_Class/SISAssem/AssemPitch.asm b/Common_Class/SISAssem/AssemPitch.asm
new file mode 100644
index 0000000..4201cd5
--- /dev/null
+++ b/Common_Class/SISAssem/AssemPitch.asm
@@ -0,0 +1,318 @@
+
+; CheckPitchAsmVTD 俺惯 - 2011.08.31
+; CheckPitchAsmVTD 肯丰 - 2011.09.02
+
+.data
+
+.code
+
+
+rrImgAddr	equ		r8
+rrPitch16	equ		r9
+
+
+rrConAddr	equ		r12
+rrConAddr2	equ		r13
+rrTiltAddr	equ		r14
+
+ix			equ		rsi
+iy			equ		rdi
+
+SprShift			equ		4
+SprMulti			equ		16
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+ConAddr			equ		qword ptr[rbp+ 50h]
+ConAddr2		equ		qword ptr[rbp+ 58h]
+TestTest		equ		qword ptr[rbp+ 60h]
+TestTest		equ		qword ptr[rpb+ 68h]
+
+
+xxOne		equ		xmm1
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+xxSrc2		equ		xmm4
+xxCmp2		equ		xmm5
+xxTmp		equ		xmm6
+xxTmp2		equ		xmm7
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+xxfSprt		equ		xmm12
+xxsSprt		equ		xmm13
+
+xxRslt		equ		xmm14
+
+
+
+
+
+
+CheckPitchAsmVTD		PROC
+	local	ImgAddr		: qword
+	local	tilt16		: qword
+	local	BuffWidth	: qword
+	local	ConEnd		: qword
+	local	RefAdd		: qword
+	local	fHalf		: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	add		rbp, 08h
+	add		rbp, 30h
+
+	mov		BuffWidth,	rcx
+	mov		ImgAddr,	rrImgAddr
+	
+;----------------------- tilt Spr
+	mov		rcx, rdx				; tilt Spr
+	sar		rdx, SprShift
+	mov		Tilt16, rdx
+	and		rcx, 0fh
+	
+	movd		xxsSPRt, rcx				; sSpr
+	movdqa		xmm0, xxsSPRt
+	punpcklwd	xmm0, xxsSPRt
+	pshufd		xxsSPRt, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPRt, rax
+	movdqa		xmm0, xxfSPRt
+	punpcklwd	xmm0, xxfSPrt
+	pshufd		xxfSPrt, xmm0, 0
+
+
+;----------------------- Pitch Spr
+	mov		rcx, rrPitch16			; Pitch Spr
+	sar		rrPitch16, SprShift
+	and		rcx, 0fh
+	
+	movd		xxsSPR, rcx				; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+	mov		rax, rrPitch16
+	mul		BuffWidth
+	mov		RefAdd, rax
+
+
+;----------------------- 扁鸥 檬扁拳
+	mov			rax, 1
+	movd		xxOne, rax		; 1肺 盲款促.(word)
+	movdqa		xmm0, xxOne
+	punpcklwd	xmm0, xxOne
+	pshufd		xxOne, xmm0, 0
+
+	pxor		xmm0, xmm0
+	pxor		xxRslt, xxRslt
+	
+	mov		rax, InspBottom
+	add		rax, 2
+	mov		ConEnd, rax
+
+
+
+
+;------------------------ PROC_START
+
+;----------------------- 林家 檬扁拳
+	mov		rax, BuffWidth
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgAddr, rax
+	mov		ix, InspLeft
+	
+jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	add		ix, 10h
+	add		ImgAddr, 10h
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		PROC_END
+
+LOOP_X:
+	jmp		LOOP_CON_HEAD
+LOOP_CON_RETURN:
+	jmp		LOOP_CMP_HEAD
+LOOP_CMP_RETURN:
+
+LOOP_X_END:
+	jmp		LOOP_X_TAIL
+
+
+;---------------- Make Con Buff Loop ------------------
+LOOP_CON_HEAD:
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddr
+	mov		rrTiltAddr, rrImgAddr
+	add		rrTiltAddr, RefAdd
+	add		rrTiltAddr, tilt16
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	jmp		LOOP_CON_CHECK
+
+LOOP_CON_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	add		rrTiltAddr, BuffWidth
+	add		rrConAddr, 20h
+	add		rrConAddr2, 20h
+LOOP_CON_CHECK:
+	cmp		iy, ConEnd
+	jge		LOOP_CON_RETURN
+
+LOOP_CON:
+	movdqu		xxSrc, [rrImgAddr]			; ConBuff
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxSrc2, xxSrc
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc2, xmm0
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc2, xxCmp2
+
+
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc2
+
+
+	movdqu		xxSrc, [rrTiltAddr]				; ConBuff2
+	movdqu		xxCmp, [rrTiltAddr+ 1]
+	movdqu		xxTmp, [rrTiltAddr+ 2]
+	movdqa		xxSrc2, xxSrc
+	movdqa		xxCmp2, xxCmp
+	movdqa		xxTmp2, xxTmp
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc2, xmm0
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	punpcklbw	xxTmp, xmm0
+	punpckhbw	xxTmp2, xmm0
+
+	pmullw		xxSrc, xxfSprt
+	pmullw		xxSrc2, xxfSprt
+
+	pmullw		xxTmp, xxsSprt
+	pmullw		xxTmp2, xxsSprt
+
+	paddw		xxSrc, xxTmp
+	paddw		xxSrc2, xxTmp2
+
+	psrlw		xxSrc, SprShift
+	psrlw		xxSrc2, SprShift
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc2, xxCmp2
+
+	movdqu		[rrConAddr2], xxSrc
+	movdqu		[rrConAddr2+ 10h], xxSrc2
+
+	jmp		LOOP_CON_TAIL
+;================== Make Con Buff Loop ==================
+
+
+;---------------- Make Compare(subtract) Loop ------------------
+LOOP_CMP_HEAD:
+	mov		fHalf, 0
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	jmp		LOOP_CMP_CHECK
+LOOP_CMP_TAIL:
+	mov		fHalf, 0
+	inc		iy
+	add		rrConAddr, 10h
+	add		rrConAddr2, 10h
+
+LOOP_CMP_CHECK:
+	cmp		iy, InspBottom
+	jge		LOOP_CMP_RETURN
+
+LOOP_CMP:
+	movdqu	xxSrc,	[rrConAddr]
+	movdqu	xxSrc2,	[rrConAddr+ 20h]
+	movdqu	xxCmp,	[rrConAddr2]
+	movdqu	xxCmp2, [rrconAddr2+ 20h]
+	movdqu	xxTmp,	[rrConAddr2+ 40h]
+	
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+	
+	pmullw	xxCmp, xxfSpr
+	pmullw	xxTmp, xxsSpr
+	psllw	xxCmp2, SprShift
+	
+	psubw	xxSrc, xxCmp
+	psubw	xxSrc, xxTmp
+	psubw	xxSrc, xxCmp2
+	pabsw	xxSrc, xxSrc
+	
+	pmaddwd	xxSrc, xxOne
+	
+	movdqa	xxCmp, xxSrc
+	punpckldq	xxSrc, xmm0
+	punpckhdq	xxCmp, xmm0
+	
+	paddq	xxRslt, xxSrc
+	paddq	xxRslt, xxCmp
+
+	cmp		fHalf, 1
+	jge		LOOP_CMP_TAIL
+	mov		fHalf, 1
+	add		rrConAddr, 10h
+	add		rrConAddr2, 10h
+	jmp		LOOP_CMP
+;================== Make Compare(subtract) Loop ==================
+
+
+
+PROC_END:
+	pextrq	rax, xxRslt, 0
+	pextrq	rdx, xxRslt, 1
+	add		rax, rdx
+
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+ret
+CheckPitchAsmVTD		ENDP
+
+
+end
diff --git a/Common_Class/SISAssem/AssemPitch_BOE.asm b/Common_Class/SISAssem/AssemPitch_BOE.asm
new file mode 100644
index 0000000..fb38653
--- /dev/null
+++ b/Common_Class/SISAssem/AssemPitch_BOE.asm
@@ -0,0 +1,347 @@
+
+; CheckPitchAsmVTD 俺惯 - 2011.08.31
+; CheckPitchAsmVTD 肯丰 - 2011.09.02
+; CheckPitchAsmVTD_BOE 履父 荐沥 - 2015.05.04
+
+.data
+
+.code
+
+
+rrImgAddr	equ		r8
+rrPitch16	equ		r9
+
+
+rrConAddr	equ		r12
+rrConAddr2	equ		r13
+rrTiltAddr	equ		r14
+
+rrMaxAddr	equ		r15
+rrMinAddr	equ		r10
+rrResult	equ		r11
+
+ix			equ		rsi
+iy			equ		rdi
+
+SprShift			equ		4
+SprMulti			equ		16
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+MAXImgAddr		equ		qword ptr[rbp+ 50h]
+ResultAddr		equ		qword ptr[rbp+ 58h]
+
+ConAddr			equ		qword ptr[rbp+ 60h]
+ConAddr2		equ		qword ptr[rbp+ 68h]
+
+xxOne		equ		xmm1
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+xxSrc2		equ		xmm4
+xxCmp2		equ		xmm5
+xxTmp		equ		xmm6
+xxTmp2		equ		xmm7
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+xxfSprt		equ		xmm12
+xxsSprt		equ		xmm13
+
+xxRslt		equ		xmm14
+
+
+CheckPitchAsmVTD_BOE		PROC
+	local	ImgAddr		: qword
+	local	tilt16		: qword
+	local	BuffWidth	: qword
+	local	ConEnd		: qword
+	local	RefAdd		: qword
+	local	fHalf		: qword
+	local	CurAddr		: qword
+	
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	add		rbp, 08h
+	add		rbp, 38h
+
+	mov		BuffWidth,	rcx
+	mov		ImgAddr,	rrImgAddr
+;------- Image Buffer Check -------(BOE)
+	mov		rcx,	rrImgAddr
+	mov		rrMinAddr, rcx
+	mov		rcx,	MAXImgAddr
+	sub		rcx,	11h
+	mov		rrMaxAddr, rcx
+	mov		rrResult, ResultAddr
+;----------------------- tilt Spr
+	mov		rcx, rdx				; tilt Spr
+	sar		rdx, SprShift
+	mov		Tilt16, rdx
+	and		rcx, 0fh
+	
+	movd		xxsSPRt, rcx				; sSpr
+	movdqa		xmm0, xxsSPRt
+	punpcklwd	xmm0, xxsSPRt
+	pshufd		xxsSPRt, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPRt, rax
+	movdqa		xmm0, xxfSPRt
+	punpcklwd	xmm0, xxfSPrt
+	pshufd		xxfSPrt, xmm0, 0
+
+
+;----------------------- Pitch Spr
+	mov		rcx, rrPitch16			; Pitch Spr
+	sar		rrPitch16, SprShift
+	and		rcx, 0fh
+	
+	movd		xxsSPR, rcx				; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+	mov		rax, rrPitch16
+	mul		BuffWidth
+	mov		RefAdd, rax
+	
+;------- Image Buffer Check -------(BOE)
+	mov		rcx,	MAXImgAddr
+	sub		rcx,	RefAdd
+	mov		rrMaxAddr, rcx
+
+
+;----------------------- 扁鸥 檬扁拳
+	mov			rax, 1
+	movd		xxOne, rax		; 1肺 盲款促.(word)
+	movdqa		xmm0, xxOne
+	punpcklwd	xmm0, xxOne
+	pshufd		xxOne, xmm0, 0
+
+	pxor		xmm0, xmm0
+	pxor		xxRslt, xxRslt
+	
+	mov		rax, InspBottom
+	add		rax, 2
+	mov		ConEnd, rax
+
+
+
+
+;------------------------ PROC_START
+
+;----------------------- 林家 檬扁拳
+	mov		rax, BuffWidth
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgAddr, rax
+	mov		ix, InspLeft
+	
+jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	add		ix, 10h
+	add		ImgAddr, 10h
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		PROC_END
+
+LOOP_X:
+	jmp		LOOP_CON_HEAD
+LOOP_CON_RETURN:
+	jmp		LOOP_CMP_HEAD
+LOOP_CMP_RETURN:
+
+LOOP_X_END:
+	jmp		LOOP_X_TAIL
+
+
+;---------------- Make Con Buff Loop ------------------
+LOOP_CON_HEAD:
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddr
+	mov		rrTiltAddr, rrImgAddr
+	add		rrTiltAddr, RefAdd
+	add		rrTiltAddr, tilt16
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	jmp		LOOP_CON_CHECK
+
+LOOP_CON_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	add		rrTiltAddr, BuffWidth
+	add		rrConAddr, 20h
+	add		rrConAddr2, 20h
+LOOP_CON_CHECK:
+	cmp		iy, ConEnd
+	jge		LOOP_CON_RETURN
+
+LOOP_CON:
+;------- Image Buffer Check -------(BOE)
+	mov		CurAddr, rrImgAddr
+	cmp		CurAddr, rrMaxAddr
+	jl		YJM_MIN_CHECK
+	mov		rcx, 1
+	mov		[rrResult], rcx
+	jmp		PROC_END
+	
+YJM_MIN_CHECK:	
+	cmp		CurAddr, rrMinAddr
+	jge		YJM_IMAGE_CHECK_OK
+	mov		rcx, 2
+	mov		[rrResult], rcx
+	jmp		PROC_END
+
+YJM_IMAGE_CHECK_OK:
+	movdqu		xxSrc, [rrImgAddr]			; ConBuff
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxSrc2, xxSrc
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc2, xmm0
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc2, xxCmp2
+
+
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc2
+
+
+	movdqu		xxSrc, [rrTiltAddr]				; ConBuff2
+	movdqu		xxCmp, [rrTiltAddr+ 1]
+	movdqu		xxTmp, [rrTiltAddr+ 2]
+	movdqa		xxSrc2, xxSrc
+	movdqa		xxCmp2, xxCmp
+	movdqa		xxTmp2, xxTmp
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc2, xmm0
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	punpcklbw	xxTmp, xmm0
+	punpckhbw	xxTmp2, xmm0
+
+	pmullw		xxSrc, xxfSprt
+	pmullw		xxSrc2, xxfSprt
+
+	pmullw		xxTmp, xxsSprt
+	pmullw		xxTmp2, xxsSprt
+
+	paddw		xxSrc, xxTmp
+	paddw		xxSrc2, xxTmp2
+
+	psrlw		xxSrc, SprShift
+	psrlw		xxSrc2, SprShift
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc2, xxCmp2
+
+	movdqu		[rrConAddr2], xxSrc
+	movdqu		[rrConAddr2+ 10h], xxSrc2
+
+	jmp		LOOP_CON_TAIL
+;================== Make Con Buff Loop ==================
+
+
+;---------------- Make Compare(subtract) Loop ------------------
+LOOP_CMP_HEAD:
+	mov		fHalf, 0
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	jmp		LOOP_CMP_CHECK
+LOOP_CMP_TAIL:
+	mov		fHalf, 0
+	inc		iy
+	add		rrConAddr, 10h
+	add		rrConAddr2, 10h
+
+LOOP_CMP_CHECK:
+	cmp		iy, InspBottom
+	jge		LOOP_CMP_RETURN
+
+LOOP_CMP:
+	movdqu	xxSrc,	[rrConAddr]
+	movdqu	xxSrc2,	[rrConAddr+ 20h]
+	movdqu	xxCmp,	[rrConAddr2]
+	movdqu	xxCmp2, [rrconAddr2+ 20h]
+	movdqu	xxTmp,	[rrConAddr2+ 40h]
+	
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+	
+	pmullw	xxCmp, xxfSpr
+	pmullw	xxTmp, xxsSpr
+	psllw	xxCmp2, SprShift
+	
+	psubw	xxSrc, xxCmp
+	psubw	xxSrc, xxTmp
+	psubw	xxSrc, xxCmp2
+	pabsw	xxSrc, xxSrc
+	
+	pmaddwd	xxSrc, xxOne
+	
+	movdqa	xxCmp, xxSrc
+	punpckldq	xxSrc, xmm0
+	punpckhdq	xxCmp, xmm0
+	
+	paddq	xxRslt, xxSrc
+	paddq	xxRslt, xxCmp
+
+	cmp		fHalf, 1
+	jge		LOOP_CMP_TAIL
+	mov		fHalf, 1
+	add		rrConAddr, 10h
+	add		rrConAddr2, 10h
+	jmp		LOOP_CMP
+;================== Make Compare(subtract) Loop ==================
+
+
+
+PROC_END:
+	pextrq	rax, xxRslt, 0
+	pextrq	rdx, xxRslt, 1
+	add		rax, rdx
+
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+ret
+CheckPitchAsmVTD_BOE		ENDP
+
+
+end
diff --git a/Common_Class/SISAssem/AssemUtil.cpp b/Common_Class/SISAssem/AssemUtil.cpp
new file mode 100644
index 0000000..51b9a0d
--- /dev/null
+++ b/Common_Class/SISAssem/AssemUtil.cpp
@@ -0,0 +1,275 @@
+#include "StdAfx.h"
+
+#include "AssemUtil.h"
+//#include <emmintrin.h>
+//#include <tmmintrin.h>
+
+//#include "SISBuffer.h"
+
+extern "C"{
+
+	void Byte_To_Short(unsigned char* pSrc, short* pDest, int nSize);
+
+	__int64 CheckPitchAsm(__int64 iPitch16, __int64 DPC_SUPPRESS, BYTE *pData, __int64 buffWidth
+					  , __int64 left, __int64 top, __int64 width, __int64 height
+					  );
+	__int64 CheckPitchAsmVert(__int64 iPitch16, __int64 DPC_SUPPRESS, BYTE *pData, __int64 buffWidth
+					  , __int64 left, __int64 top, __int64 width, __int64 height
+					  );
+	__int64 CheckPitchAsmVTD(__int64 BuffWidth, __int64	tilt16, BYTE* pData, __int64 iPitch16
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, short* pConBuff, short* pConBuff2
+		);
+	__int64 CheckPitchAsmVTD_BOE(__int64 BuffWidth, __int64	tilt16, BYTE* pData, __int64 iPitch16
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, __int64 nMAXImgAddr, __int64 *pResult, short* pConBuff, short* pConBuff2
+		);
+};
+
+// Not Use Below
+extern "C"{
+	__int64 CheckPitchPixelAsm(__int64 startPitch, __int64 endPitch, BYTE *pData, __int64 buffWidth
+		, __int64 left, __int64 top, __int64 width, __int64 height
+		, __int64 DPC_SUPPRESS);
+
+	__int64 CheckPitchAsmEcho(__int64 iPitch, __int64 Spr, __int64 fSpr, __int64 sSpr
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, BYTE *pData, __int64 buffWidth, __int64 DPC_SUPPRESS);
+
+	__int64 CheckPitchAsmFast(__int64 StartSpr, __int64 EndSpr, BYTE *pData, __int64 buffWidth
+		, __int64 left, __int64 top, __int64 width, __int64 height
+		, __int64 DPC_SUPPRESS);
+};
+
+void CAssemUtil::ByteToShort(unsigned char* pSrc, short* pDest, int nSize)
+{
+	Byte_To_Short(pSrc, pDest, nSize);
+}
+
+void CAssemUtil::CheckPitchPixel(int startPitch, int endPitch, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &iPitch)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	__int64 sPitch;
+	int i;
+
+	for(i= startPitch; i<= endPitch; i++)
+	{
+		sPitch= i*16;
+		ConvSum= CheckPitchAsm(i, Dpc_suppress, pData, buffWidth, left, top, width, height);
+		if(ConvSum < minConvSum)
+		{
+			minConvSum= ConvSum;
+			iPitch= (int)(i/16);
+		}
+	}
+}
+
+void CAssemUtil::CheckPitchSmall16(__int64 pitch16, int searchCount, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &findPitch16, int &fiPitch, int &fspr)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	__int64 sPitch, ePitch, iPitch, spr;
+	sPitch= pitch16- searchCount;
+	ePitch= pitch16+ searchCount;
+
+	for(; sPitch <= ePitch; sPitch++)
+	{
+		ConvSum= CheckPitchAsm(sPitch, Dpc_suppress, pData, buffWidth, left, top, width, height);
+		if(ConvSum < minConvSum)
+		{
+			minConvSum= ConvSum;
+			findPitch16= (int)sPitch;
+			iPitch= sPitch/16;
+			spr= sPitch%16;
+			fiPitch= (int)iPitch;
+			fspr= (int)spr;
+		}
+	}
+}
+
+void CAssemUtil::CheckPitchSmallVert16(__int64 pitch16, int searchCount, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &findPitch16, int &fiPitch, int &fspr)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	__int64 sPitch, ePitch, iPitch, spr;
+	sPitch= pitch16- searchCount;
+	ePitch= pitch16+ searchCount;
+
+	for(; sPitch <= ePitch; sPitch++)
+	{
+		ConvSum= CheckPitchAsmVert(sPitch, (__int64)Dpc_suppress, pData, (__int64)buffWidth, (__int64)left, (__int64)top, (__int64)width, (__int64)height);
+		if(ConvSum < minConvSum)
+		{
+			minConvSum= ConvSum;
+			findPitch16= (int)sPitch;
+			iPitch= sPitch/16;
+			spr= sPitch%16;
+			fiPitch= (int)iPitch;
+			fspr= (int)spr;
+		}
+	}
+}
+
+void CAssemUtil::CheckPitchSmallVPT16(int pitchStart16, int pitchEnd16, int tiltStart16, int tiltEnd16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16, int &findTilt16)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	int tilt, pitch;
+
+	for(pitch= pitchStart16 ; pitch <= pitchEnd16; pitch++)
+	{
+		for(tilt= tiltStart16; tilt <= tiltEnd16; tilt++)
+		{
+			ConvSum= CheckPitchAsmVTD((__int64)buffWidth, (__int64)tilt, pData, (__int64)pitch, (__int64)left, (__int64)right, (__int64)top, (__int64)bottom, conBuff, conBuff2);
+			if(ConvSum < minConvSum)
+			{
+				minConvSum= ConvSum;
+				findTilt16= tilt;
+				findPitch16= pitch;
+			}
+		}
+	}
+}
+
+void CAssemUtil::CheckPitchSmallVP_T16(int pitch16, int tiltStart16, int tiltEnd16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findTilt16)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	int tilt;
+
+	for(tilt= tiltStart16; tilt <= tiltEnd16; tilt++)
+	{
+		ConvSum= CheckPitchAsmVTD((__int64)buffWidth, (__int64)tilt, pData, (__int64)pitch16, (__int64)left, (__int64)right, (__int64)top, (__int64)bottom, conBuff, conBuff2);
+		if(ConvSum < minConvSum)
+		{
+			minConvSum= ConvSum;
+			findTilt16= tilt;
+		}
+	}
+}
+
+void CAssemUtil::CheckPitchSmallVT_P16(int pitchStart16, int pitchEnd16, int Tilt16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	int pitch;
+
+	for(pitch= pitchStart16 ; pitch <= pitchEnd16; pitch++)
+	{
+		ConvSum= CheckPitchAsmVTD((__int64)buffWidth, (__int64)Tilt16, pData, (__int64)pitch, (__int64)left, (__int64)right, (__int64)top, (__int64)bottom, conBuff, conBuff2);
+		if(ConvSum < minConvSum)
+		{
+			minConvSum= ConvSum;
+			findPitch16= pitch;
+		}
+	}
+}
+
+int CAssemUtil::CheckPitchSmallVT_P16_BOE(int pitchStart16, int pitchEnd16, int Tilt16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int buffHeight, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	int pitch;
+	__int64 MaxImgAddr = (__int64)(pData + buffWidth * buffHeight);
+	__int64 nResult = -1;
+	for(pitch= pitchStart16 ; pitch <= pitchEnd16; pitch++)
+	{
+		ConvSum= CheckPitchAsmVTD_BOE((__int64)buffWidth, (__int64)Tilt16, pData, (__int64)pitch, (__int64)left, (__int64)right, (__int64)top, (__int64)bottom, MaxImgAddr,(__int64*)&nResult, conBuff, conBuff2);
+		if(nResult != -1)
+			return (int)nResult;
+		if(ConvSum < minConvSum)
+		{
+			minConvSum= ConvSum;
+			findPitch16= pitch;
+		}		
+	}
+
+	return (int)nResult;
+}
+
+/*
+void CAssemUtil::CheckPitchSmall(int StartPitch, int EndPitch, int Spr, int fSpr, int sSpr, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &rPitch, int &rfSpr)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	int iPitch=0;
+	int iSpr=0;
+
+	if(StartPitch == EndPitch)
+	{
+		iPitch= StartPitch;
+		for(iSpr= sSpr; iSpr >= fSpr; iSpr--)
+		{
+			ConvSum= CheckPitchAsm((__int64)iPitch, (__int64)Spr, (__int64)iSpr, (__int64)(Spr- iSpr), (__int64)left, (__int64)(left+ width), (__int64)top, (__int64)(top+ height), pData, (__int64)buffWidth, (__int64)Dpc_suppress);
+			if(ConvSum < minConvSum)
+			{
+				minConvSum= ConvSum;
+				rfSpr= iSpr;
+				rPitch= iPitch;
+			}
+		}
+		return;
+	}
+
+	iPitch= StartPitch;
+	for(iSpr= sSpr; iSpr > 0; iSpr--)
+	{
+		ConvSum= CheckPitchAsm((__int64)iPitch, (__int64)Spr, (__int64)iSpr, (__int64)(Spr- iSpr), (__int64)left, (__int64)(left+ width), (__int64)top, (__int64)(top+ height), pData, (__int64)buffWidth, (__int64)Dpc_suppress);
+		if(ConvSum < minConvSum)
+		{
+			minConvSum= ConvSum;
+			rfSpr= iSpr;
+			rPitch= iPitch;
+		}
+	}
+	for( iPitch= StartPitch+1; iPitch < EndPitch;iPitch++)
+	{
+		for(iSpr= Spr; iSpr > 0; iSpr--)
+		{
+			ConvSum= CheckPitchAsm((__int64)iPitch, (__int64)Spr, (__int64)iSpr, (__int64)(Spr- iSpr), (__int64)left, (__int64)(left+ width), (__int64)top, (__int64)(top+ height), pData, (__int64)buffWidth, (__int64)Dpc_suppress);
+
+			if(ConvSum < minConvSum)
+			{
+				minConvSum= ConvSum;
+				rfSpr= iSpr;
+				rPitch= iPitch;
+			}
+		}
+	}
+	iPitch= EndPitch;
+	for(iSpr= Spr; iSpr >= fSpr; iSpr--)
+	{
+		ConvSum= CheckPitchAsm((__int64)iPitch, (__int64)Spr, (__int64)iSpr, (__int64)(Spr- iSpr), (__int64)left, (__int64)(left+ width), (__int64)top, (__int64)(top+ height), pData, (__int64)buffWidth, (__int64)Dpc_suppress);
+		if(ConvSum < minConvSum)
+		{
+			minConvSum= ConvSum;
+			rfSpr= iSpr;
+			rPitch= iPitch;
+		}
+	}
+}
+
+void CAssemUtil::CheckPitch(int StartPitch, int EndPitch, int Spr, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &rPitch, int &rfSpr)
+{
+	__int64	minConvSum= 0x0FFFFFFFFFFFFFFF;
+	__int64 ConvSum= 0;
+	int iPitch=0;
+	int iSpr=0;
+
+	for( iPitch= StartPitch; iPitch <= EndPitch;iPitch++)
+	{
+		for(iSpr= Spr; iSpr > 0; iSpr--)
+		{
+			ConvSum= CheckPitchAsm((__int64)iPitch, (__int64)Spr, (__int64)iSpr, (__int64)(Spr- iSpr), (__int64)left, (__int64)(left+ width), (__int64)top, (__int64)(top+ height), pData, (__int64)buffWidth, (__int64)Dpc_suppress);
+
+			if(ConvSum < minConvSum)
+			{
+				minConvSum= ConvSum;
+				rfSpr= iSpr;
+				rPitch= iPitch;
+			}
+		}
+	}
+}
+*/
\ No newline at end of file
diff --git a/Common_Class/SISAssem/AssemUtil2.asm b/Common_Class/SISAssem/AssemUtil2.asm
new file mode 100644
index 0000000..d12aadb
--- /dev/null
+++ b/Common_Class/SISAssem/AssemUtil2.asm
@@ -0,0 +1,634 @@
+
+; CheckPitchAsm 荐沥 - 2011.02.14
+; 乔摹 沥焊甫 pitch16 扁馆栏肺 荐沥
+; CheckPitchPixelAsm 眠啊 - 2011.02.14
+; 眠啊吝 吝窜.. 加档啊 瘤必洒 鞘夸窍搁 肯己 窍带瘤.
+; CheckPitchAsmVert 眠啊 - 2011.02.16
+
+
+.data
+
+.code
+
+
+ImgAddr		equ		r14
+
+ByteAddr	equ		rcx
+ShortAddr	equ		rdx
+nByte		equ		r8
+
+iByte		equ		r9
+
+
+Byte_To_Short PROC
+
+	pxor	xmm0, xmm0
+
+	cmp		nByte, 10h
+	jl		START_EXTRA
+
+	mov		iByte, 10h
+
+LOOP_SIMD:
+
+	movdqu	xmm1, [ByteAddr]
+	movdqa	xmm2, xmm1
+
+	punpcklbw	xmm1, xmm0
+	punpckhbw	xmm2, xmm0
+
+	movntdq	[ShortAddr], xmm1
+	movntdq	[ShortAddr+10h], xmm2
+
+	add		ByteAddr, 10h
+	add		ShortAddr, 20h
+
+	add		iByte, 10h
+	cmp		iByte, nByte
+	jle		LOOP_SIMD
+	sub		iByte, 10h
+
+START_EXTRA:
+	xor		rax, rax
+
+	cmp		iByte, nByte
+	jge		LOOP_END
+
+LOOP_EXTRA:
+
+	mov		al, [ByteAddr]
+	mov		[ShortAddr], ax
+
+
+	inc		ByteAddr
+	add		ShortAddr, 2
+	inc		iByte
+
+	cmp		iByte, nByte
+	jl		LOOP_EXTRA
+
+LOOP_END:
+
+RET
+Byte_To_Short ENDP
+
+
+
+;==========================================================
+
+iPitch16	equ		rcx
+rrImgAddr	equ		r8
+rrBW		equ		r9
+
+rrPitch		equ		r10
+rrPitch1	equ		r11
+rrPitch2	equ		r12
+rrPitch3	equ		r13
+rrInspBot	equ		r15
+
+ix			equ		rsi
+iy			equ		rdi
+
+ConvShift			equ		1
+SprShift			equ		4
+ConvNSprShift		equ		5
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspTop			equ		qword ptr[rbp+ 38h]
+InspWidth		equ		qword ptr[rbp+ 40h]
+InspHeight		equ		qword ptr[rbp+ 48h]
+
+DPC_SUPP		EQU		QWORD PTR[RBP+ 50H]
+
+
+xxSupp2		equ		xmm3
+xxSrc		equ		xmm4
+xxSrc2		equ		xmm5
+xxCmp		equ		xmm6
+xxCmp2		equ		xmm7
+xxSpr		equ		xmm8
+xxOne		equ		xmm9
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+xxMinus		equ		xmm12
+xxMinus2	equ		xmm13
+xxRslt		equ		xmm14
+
+
+
+CheckPitchAsm	PROC
+	local ImgAddrLine			:qword
+	local ImgAddrLineEnd		:qword
+	local InspBottom			:qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 020h
+
+
+	mov		rrPitch, rcx
+	sar		rrPitch, SprShift
+
+	mov		rax, 2					; Suppress
+	mul		rdx
+	sal		rax, 4
+	movd	xxSupp2, rax
+	movdqa	xmm0, xxSupp2
+	punpcklwd	xmm0, xxSupp2
+	pshufd	xxSupp2, xmm0, 0
+
+	mov			rax, 10h			; spr
+	movd		xxSpr, rax
+	movdqa		xmm0, xxSpr
+	punpcklwd	xmm0, xxSpr
+	pshufd		xxSpr, xmm0, 0
+
+	mov		rax, rcx				; sSpr
+	and		rax, 0fh
+	movd		xxsSpr, rax
+	movdqa		xmm0, xxsSpr
+	punpcklwd	xmm0, xxsSpr
+	pshufd		xxsSpr, xmm0, 0
+
+	movdqa	xxfSpr, xxSpr			; fSpr
+	psubw	xxfSpr, xxsSpr
+
+	mov		rax, InspTop
+	add		rax, InspHeight
+	mov		InspBottom, rax
+
+
+	mov		rrPitch2, rrPitch
+	add		rrPitch2, 1h
+	mov		rrPitch3, rrPitch
+	add		rrPitch3, 2h
+
+
+
+	mov		rax, 1
+	movd		xxOne, rax		; 1肺 盲款促.(word)
+	movdqa		xmm0, xxOne
+	punpcklwd	xmm0, xxOne
+	pshufd		xxOne, xmm0, 0
+	
+
+
+; 捞固瘤 林家 父甸扁
+	mov		rax, rrBW		; ImgAddr= ImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rrImgAddr, rax
+	mov		ImgAddrLine, rrImgAddr
+
+	mov		rax, ImgAddrLine
+	add		rax, InspWidth
+	mov		ImgAddrLineEnd, rax
+
+	mov		iy, InspTop
+	pxor	xxRslt, xxRslt
+	pxor	xmm0, xmm0
+
+Cmp_16:
+										; 1. Src Buffer
+	movdqu	xxSrc, [rrImgAddr]			; Load
+	movdqa	xxSrc2, xxSrc
+	punpcklbw	xxSrc, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	movdqu	xxMinus, [rrImgAddr+ 1]			; Load
+	movdqa	xxMinus2, xxMinus
+	punpcklbw	xxMinus, xmm0				; Unpack
+	punpckhbw	xxMinus2, xmm0
+	paddw	xxSrc, xxMinus
+	paddw	xxSrc2, xxMinus2
+
+	pmullw	xxSrc, xxSpr				; SPR
+	pmullw	xxSrc2, xxSpr
+
+
+										;	2. Compare Buffer
+	movdqu	xxCmp, [rrImgAddr+ rrPitch]	; Load
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxfSpr				; fSpr
+	pmullw	xxCmp2, xxfSpr
+
+	psubw	xxSrc, xxCmp				; SPR - fSpr
+	psubw	xxSrc2, xxCmp2
+
+	movdqu	xxCmp, [rrImgAddr+ rrPitch2]
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxSpr
+	pmullw	xxCmp2, xxSpr
+
+	psubw	xxSrc, xxCmp
+	psubw	xxSrc2, xxCmp2
+
+	movdqu	xxCmp, [rrImgAddr+ rrPitch3]		; Load
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxsSpr				; sSpr
+	pmullw	xxCmp2, xxsSpr
+
+	psubw	xxSrc, xxCmp				; (SPR- fSpr) - sSpr
+	psubw	xxSrc2, xxCmp2
+
+
+	pabsw	xxSrc, xxSrc				; 例措蔼
+	psubusw	xxSrc, xxSupp2
+	pmaddwd	xxSrc, xxOne				; multiply and add ( 16 -> 32)
+	pabsw	xxSrc2, xxSrc2				; 例措蔼
+	psubusw	xxSrc2, xxSupp2
+	pmaddwd	xxSrc2, xxOne				; multiply and add ( 16 -> 32)
+
+	movdqa	xxCmp, xxSrc
+	punpckldq	xxCmp, xmm0				; unpack 32 -> 64
+	punpckhdq	xxSrc, xmm0
+	
+	paddq	xxRslt, xxSrc				; add to Result(64)
+	paddq	xxRslt, xxCmp				; add to Result(64)
+
+	movdqa	xxCmp, xxSrc2
+	punpckldq	xxCmp, xmm0				; unpack 32 -> 64
+	punpckhdq	xxSrc2, xmm0
+
+	paddq	xxRslt, xxSrc2				; add to Result(64)
+	paddq	xxRslt, xxCmp				; add to Result(64)
+
+
+	add	rrImgAddr, 10h
+	cmp	rrImgAddr, ImgAddrLineEnd
+	jl	Cmp_16
+
+	inc	iy
+	cmp	iy, InspBottom
+	jge	End_Buff
+
+
+	mov	rax, ImgAddrLine
+	add	rax, rrBW
+	mov	ImgAddrLine, rax
+	mov	rrImgAddr, rax
+
+	add	rax, InspWidth
+	mov	ImgAddrLineEnd, rax
+
+	jmp	Cmp_16
+
+
+End_Buff:
+
+	pextrq	rax, xxRslt, 0
+	pextrq	rcx, xxRslt, 1
+	add		rax, rcx
+
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+
+CheckPitchAsm	ENDP
+
+
+
+CheckPitchPixelAsm PROC
+	local ImgAddrLine			:qword
+	local ImgAddrLineEnd		:qword
+	local InspBottom			:qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 020h
+
+	mov		rax, InspTop
+	add		rax, InspHeight
+	mov		InspBottom, rax
+
+	mov		rax, rrBW
+	mul		InspTop
+	add		rax, InspLeft
+	add		rrImgAddr, rax
+	mov		ImgAddrLine, rrImgAddr
+
+
+	add		rax, rrImgAddr
+	mov		ImgAddrLineEnd, rax
+
+	mov		iy, InspTop
+	pxor	xxRslt, xxRslt
+	pxor	xmm0, xmm0
+
+Cmp_16:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ rrPitch]
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+
+	psubw		xxSrc, xxCmp
+	pabsw		xxSrc, xxSrc
+	psubusw	xxSrc, xxSupp2
+
+	pmaddwd	xxSrc, xxOne			; multiply and add ( 16bit -> 32bit)
+	movdqa		xxCmp, xxSrc
+	punpckldq	xxSrc, xmm0			; unpack (32bit -> 64bit)
+	punpckhdq	xxCmp, xmm0
+	paddq		xxRslt, xxSrc
+	paddq		xxRslt, xxCmp
+
+	psubw		xxSrc2, xxCmp2
+	pabsw		xxSrc2, xxSrc2
+	psubusw	xxSrc2, xxSupp2
+	pmaddwd	xxSrc2, xxOne
+	movdqa		xxCmp, xxSrc2
+	punpckldq	xxSrc2, xmm0
+	punpckhdq	xxCmp, xmm0
+	paddq		xxRslt, xxSrc2
+	paddq		xxRslt, xxCmp
+
+	add		rrImgAddr, 10h
+	cmp		rrImgAddr, ImgAddrLineEnd
+	jl		Cmp_16
+
+	inc		iy
+	cmp		iy, InspBottom
+	jge		End_Buff
+
+	mov		rax, ImgAddrLine
+	add		rax, rrBW
+	mov		ImgAddrLine, rax
+	mov		rrImgAddr, rax
+
+	add		rax, InspWidth
+	mov		ImgAddrLineEnd, rax
+
+	jmp		Cmp_16
+
+End_Buff:
+
+	pextrq	rax, xxRslt, 0
+	pextrq	rcx, xxRslt, 1
+	add		rax, rcx
+
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+ret
+CheckPitchPixelAsm ENDP
+
+
+
+CheckPitchAsmVert		PROC
+	local ImgAddrLine			:qword
+	local InspBottom			:qword
+	local InspRight			:qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 020h
+
+	mov		rrPitch, rcx
+	sar		rrPitch, SprShift
+
+	sal		rdx, ConvNSprShift		; Suppress
+	movd	xxSupp2, rdx
+	movdqa	xmm0, xxSupp2
+	punpcklwd	xmm0, xxSupp2
+	pshufd	xxSupp2, xmm0, 0
+
+	mov			rax, 10h			; spr
+	movd		xxSpr, rax
+	movdqa		xmm0, xxSpr
+	punpcklwd	xmm0, xxSpr
+	pshufd		xxSpr, xmm0, 0
+
+	mov		rax, rcx				; sSpr
+	and		rax, 0fh
+	movd		xxsSpr, rax
+	movdqa		xmm0, xxsSpr
+	punpcklwd	xmm0, xxsSpr
+	pshufd		xxsSpr, xmm0, 0
+
+	movdqa	xxfSpr, xxSpr			; fSpr
+	psubw	xxfSpr, xxsSpr
+
+	mov		rax, InspTop
+	add		rax, InspHeight
+	mov		InspBottom, rax
+
+	mov		rax, InspWidth
+	sar		rax, SprShift
+	sal		rax, SprShift
+	add		rax, InspLeft
+	mov		InspRight, rax
+
+	mov		rax, 1
+	movd		xxOne, rax		; 1肺 盲款促.(word)
+	movdqa		xmm0, xxOne
+	punpcklwd	xmm0, xxOne
+	pshufd		xxOne, xmm0, 0
+
+
+	mov		rax, rrBW
+	mul		rrPitch
+	mov		rrPitch1, rax
+	add		rax, rrBW
+	mov		rrPitch2, rax
+	add		rax, rrBW
+	mov		rrPitch3, rax
+
+	mov		rax, rrBW		; ImgAddr= ImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rrImgAddr, rax
+	mov		ImgAddrLine, rrImgAddr
+
+	pxor	xxRslt, xxRslt
+	pxor	xmm0, xmm0
+
+
+START:
+
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	add		ix, 10h
+
+	mov		rrImgAddr, ImgAddrLine
+	add		rrImgAddr, 10h
+	mov		ImgAddrLine, rrImgAddr
+
+	mov		rax, rrImgAddr
+
+	mov		iy, InspTop
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		End_Buff
+
+	jmp		LOOP_X_BODY
+
+LOOP_X_BODY:
+	jmp		LOOP_Y_CHECK
+
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrImgAddr, rrBW
+LOOP_Y_CHECK:
+	cmp		iy, InspBottom
+	jge		LOOP_X_TAIL	
+
+
+
+LOOP_Y_BODY:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ rrBW]
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc2, xxCmp2
+
+	psllw		xxSrc, SprShift		; spr Shift
+	psllw		xxSrc2, SprShift
+
+
+	movdqu		xxCmp, [rrImgAddr+ rrPitch1]
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp, xxfSpr				; fSpr
+	pmullw		xxCmp2, xxfSpr
+
+	psubw	xxSrc, xxCmp				; SPR - fSpr
+	psubw	xxSrc2, xxCmp2
+
+
+	movdqu		xxCmp, [rrImgAddr+ rrPitch2]
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	psllw		xxCmp, SprShift
+	psllw		xxCmp2, SprShift
+
+	psubw	xxSrc, xxCmp
+	psubw	xxSrc2, xxCmp2
+
+	movdqu		xxCmp, [rrImgAddr+ rrPitch3]		; Load
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp, xxsSpr				; sSpr
+	pmullw		xxCmp2, xxsSpr
+
+	psubw	xxSrc, xxCmp				; (SPR- fSpr) - sSpr
+	psubw	xxSrc2, xxCmp2
+
+	pabsw		xxSrc, xxSrc				; 例措蔼
+	pabsw		xxSrc2, xxSrc2				; 例措蔼
+	psubusw	xxSrc, xxSupp2
+	psubusw	xxSrc2, xxSupp2
+	pmaddwd	xxSrc, xxOne				; multiply and add ( 16 -> 32)
+	pmaddwd	xxSrc2, xxOne				; multiply and add ( 16 -> 32)
+
+	movdqa		xxCmp, xxSrc
+	punpckldq	xxCmp, xmm0				; unpack 32 -> 64
+	punpckhdq	xxSrc, xmm0
+
+	paddq	xxRslt, xxSrc				; add to Result(64)
+	paddq	xxRslt, xxCmp				; add to Result(64)
+
+	movdqa		xxCmp, xxSrc2
+	punpckldq	xxCmp, xmm0				; unpack 32 -> 64
+	punpckhdq	xxSrc2, xmm0
+
+	paddq	xxRslt, xxSrc2				; add to Result(64)
+	paddq	xxRslt, xxCmp				; add to Result(64)
+
+	jmp		LOOP_Y_TAIL
+
+
+End_Buff:
+
+
+	
+	pextrq	rax, xxRslt, 0
+	pextrq	rcx, xxRslt, 1
+	add		rax, rcx
+
+
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+ret
+CheckPitchAsmVert		ENDP
+
+
+
+
+
+end
diff --git a/Common_Class/SISAssem/AssemUtil2E.asm b/Common_Class/SISAssem/AssemUtil2E.asm
new file mode 100644
index 0000000..57d1a1d
--- /dev/null
+++ b/Common_Class/SISAssem/AssemUtil2E.asm
@@ -0,0 +1,276 @@
+
+.data
+SprShift	equ		4
+SprMulti	equ		16
+
+
+.code
+
+
+
+StartSpr		equ		rcx
+EndSpr			equ		rdx
+pData			equ		r8
+wBuffer			equ		r9
+
+;4 Param		rbp+ [10h, 18h, 20h, 28h]
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspTop			equ		qword ptr[rbp+ 38h]
+InspRight		equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DPC_SUPP		equ		qword ptr[rbp+ 50h]
+
+iy			equ		r10
+rrImgAddr	equ		r11
+rrPitch		equ		r12
+rrPitch2	equ		r13
+
+rrSSpr		equ		r14
+rrESpr		equ		r15
+
+xxSupp2		equ		xmm3
+xxSrc		equ		xmm4
+xxSrc2		equ		xmm5
+xxCmp		equ		xmm6
+xxCmp2		equ		xmm7
+xxSpr		equ		xmm8
+xxOne		equ		xmm9
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+xxMinus		equ		xmm12
+xxMinus2	equ		xmm13
+xxRslt		equ		xmm14
+
+
+
+CheckPitchAsmFast		PROC
+	local	Result64[2]	:qword
+	local	ImgAddrLine	: qword
+	local	ImgLineEnd		: qword
+	local	ImgLineLength	: qword
+	
+	local	iPitch			: qword
+	local	SPR				: qword
+	local	fSpr			: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 030h
+
+	mov		rrPitch, iPitch
+	mov		rrPitch2, rrPitch
+	add		rrPitch2, 1h
+	
+
+	mov		rax, 1
+	movd		xxOne, rax		; 1肺 盲款促.(word)
+	movdqa		xmm0, xxOne
+	punpcklwd	xmm0, xxOne
+	pshufd		xxOne, xmm0, 0
+	
+	mov		rax, SPR
+	movd		xxSpr, rax
+	movdqa		xmm0, xxSpr
+	punpcklwd	xmm0, xxSpr
+	pshufd		xxSpr, xmm0, 0
+
+	mov		rax, fSpr
+	movd		xxfSpr, rax
+	movdqa		xmm0, xxfSpr
+	punpcklwd	xmm0, xxfSpr
+	pshufd		xxfSpr, xmm0, 0
+	
+	movdqa	xxsSpr, xxSpr
+	psubw	xxsSpr, xxfSpr
+
+	mov		rax, 32 ; 2侨伎*16spr= 32
+	mul		DPC_SUPP
+
+	movd		xxSupp2, rax
+	movdqa		xmm0, xxSupp2
+	punpcklwd	xmm0, xxSupp2
+	pshufd		xxSupp2, xmm0, 0
+
+; 捞固瘤 林家 父甸扁
+	mov		rrImgAddr, pData
+	mov		rax, wBuffer	; ImgAddr= ImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rrImgAddr, rax
+	mov		ImgAddrLine, rrImgAddr
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	mov		ImgLineLength, rax
+	
+	add		rax, rrImgAddr
+	mov		ImgLineEnd, rax
+
+	mov		iy, InspTop
+	pxor	xxRslt, xxRslt
+	pxor	xmm0, xmm0
+
+Cmp_16:
+										; 1. Src Buffer
+	movdqu	xxSrc, [rrImgAddr]			; Load
+	movdqa	xxSrc2, xxSrc	
+	punpcklbw	xxSrc, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0	
+
+	movdqu	xxMinus, [rrImgAddr+ 1]			; Load
+	movdqa	xxMinus2, xxMinus	
+	punpcklbw	xxMinus, xmm0				; Unpack
+	punpckhbw	xxMinus2, xmm0	
+	paddw	xxSrc, xxMinus
+	paddw	xxSrc2, xxMinus2
+
+
+	pmullw	xxSrc, xxSpr				; SPR
+	pmullw	xxSrc2, xxSpr
+
+
+										;	2. Compare Buffer
+	movdqu	xxCmp, [rrImgAddr+ rrPitch]	; Load
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxfSpr				; fSpr
+	pmullw	xxCmp2, xxfSpr
+
+	psubw	xxSrc, xxCmp				; SPR - fSpr
+	psubw	xxSrc2, xxCmp2
+
+	movdqu	xxCmp, [rrImgAddr+ rrPitch2]
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxSpr
+	pmullw	xxCmp2, xxSpr
+
+	psubw	xxSrc, xxCmp
+	psubw	xxSrc2, xxCmp2
+
+
+	movdqu	xxCmp, [rrImgAddr+ rrPitch2+ 1]		; Load
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxsSpr				; sSpr
+	pmullw	xxCmp2, xxsSpr
+
+	psubw	xxSrc, xxCmp				; (SPR- fSpr) - sSpr
+	psubw	xxSrc2, xxCmp2
+
+
+	pabsw	xxSrc, xxSrc				; 例措蔼
+	psubusw	xxSrc, xxSupp2
+	pmaddwd	xxSrc, xxOne				; multiply and add ( 16 -> 32)
+	pabsw	xxSrc2, xxSrc2				; 例措蔼
+	psubusw	xxSrc2, xxSupp2
+	pmaddwd	xxSrc2, xxOne				; multiply and add ( 16 -> 32)
+
+	movdqa	xxCmp, xxSrc
+	punpckldq	xxCmp, xmm0				; unpack 32 -> 64
+	punpckhdq	xxSrc, xmm0
+	
+	paddq	xxRslt, xxSrc				; add to Result(64)
+	paddq	xxRslt, xxCmp				; add to Result(64)
+
+	movdqa	xxCmp, xxSrc2
+	punpckldq	xxCmp, xmm0				; unpack 32 -> 64
+	punpckhdq	xxSrc2, xmm0
+
+	paddq	xxRslt, xxSrc2				; add to Result(64)
+	paddq	xxRslt, xxCmp				; add to Result(64)
+
+
+	add	rrImgAddr, 10h
+	cmp	rrImgAddr, ImgLineEnd
+	jl	Cmp_16
+	
+	inc	iy
+	cmp	iy, InspBottom
+	jge	End_Buff
+
+
+	mov	rax, ImgAddrLine
+	add	rax, wBuffer
+	mov	ImgAddrLine, rax
+	mov	rrImgAddr, rax
+	
+	add	rax, ImgLineLength
+	mov	ImgLineEnd, rax
+	
+	jmp	Cmp_16
+
+
+End_Buff:
+
+	lea		rcx, Result64
+	movdqu	[rcx], xxRslt
+	mov		rax, [rcx]
+	add		rax, [rcx+8h]
+	
+	
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+
+CheckPitchAsmFast	ENDP
+
+
+
+
+
+
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+rrBW		equ		r9
+rrImgAddr	equ		r10
+rrNoise	equ		r11		; Noise Value at Current Pitch
+rrLeast	equ		r12		; Least Noise Value
+rrPitch	equ		r13		; Pitch at Least Noise Value
+
+
+xxTemp		equ		xmm1
+xxOne		equ		xmm11
+xxSrc		equ		xmm2
+xxSrc2		equ		xmm3
+xxCmp		equ		xmm4
+xxRef0		equ		xmm5
+xxRef1		equ		xmm6
+xxRef2		equ		xmm7
+xxRef3		equ		xmm8
+
+xxZeroBack	equ		xmm10
+xxNoise	equ		xmm15
+
+
+
+
+
+end
diff --git a/Common_Class/SISAssem/AssemUtil2_1by1.asm b/Common_Class/SISAssem/AssemUtil2_1by1.asm
new file mode 100644
index 0000000..6d19d67
--- /dev/null
+++ b/Common_Class/SISAssem/AssemUtil2_1by1.asm
@@ -0,0 +1,292 @@
+; Copyright (c) Microsoft Corporation.  All rights reserved.
+
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; but without Source Browser information
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; and Source Browser information also placed in intermediate directory
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+; $(IntDir)\$(InputName).sbr
+
+;.386
+
+;.MODEL FLAT, C
+
+PBYTE	TYPEDEF		PTR BYTE
+PWORD	TYPEDEF		PTR	WORD
+PDWORD	TYPEDEF		PTR DWORD
+
+.data
+
+
+.code
+
+; Euclid's algorithm finds the greatest common divisor by repeatedly
+; subtracting the smaller number from the larger number until zero
+; is reached. The number remaining is the greatest common divisor.
+
+ImgAddr		equ		r14
+
+ByteAddr	equ		ecx
+ShortAddr	equ		edx
+nByte		equ		r8
+
+iByte		equ		rsi
+
+Byte_To_Short PROC
+
+	mov		iByte, 16
+	pxor	xmm0, xmm0
+
+	cmp		nByte, 16
+	jl		START_EXTRA
+
+LOOP_SIMD:
+	
+	movdqu	xmm1, [ByteAddr]
+	movdqa	xmm2, xmm1
+
+	punpcklbw	xmm1, xmm0
+	punpckhbw	xmm2, xmm0
+
+	movntdq	[ShortAddr], xmm1
+	movntdq	[ShortAddr+16], xmm2
+
+	add		ByteAddr, 16
+	add		ShortAddr, 32
+
+	add		iByte, 16
+	cmp		iByte, nByte
+	jle		LOOP_SIMD
+	sub		iByte, 16
+
+START_EXTRA:
+	xor		rax, rax
+
+LOOP_EXTRA:
+
+	mov		al, [ByteAddr]
+	mov		[ShortAddr], ax
+
+
+	inc		ByteAddr
+	add		ShortAddr, 2
+	inc		iByte
+	
+	cmp		iByte, nByte
+	jl		LOOP_EXTRA
+
+
+RET
+Byte_To_Short ENDP
+
+
+
+
+;==========================================================
+
+iPitch		equ		rcx
+SPR			equ		rdx
+fSPR		equ		r8
+sSPR		equ		r9
+
+InspLeft	equ		qword ptr[rbp+ 30h]
+InspRight	equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom	equ		qword ptr[rbp+ 48h]
+
+pData		equ		qword ptr[rbp+ 50h]
+BuffWidth	equ		qword ptr[rbp+ 58h]
+
+ix			equ		rsi
+iy			equ		rdi
+
+
+xxSrc		equ		xmm4
+xxSrc2		equ		xmm5
+xxCmp		equ		xmm6
+xxCmp2		equ		xmm7
+xxSpr		equ		xmm8
+xxOne		equ		xmm9
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+xxMinus		equ		xmm12
+xxMinus2	equ		xmm13
+xxRslt		equ		xmm14
+
+rrImgAddr	equ		r15
+rrPitch		equ		r10
+rrPitch2	equ		r11
+
+
+
+
+CheckPitchAsm	PROC
+	local	ImgAddrLine		: qword
+	local	ImgLineEnd		: qword
+	local	ImgLineLength	: qword
+	local	Result64[2]		: qword
+
+	mov		rrPitch, iPitch
+	mov		rrPitch2, rrPitch
+	add		rrPitch2, 1h
+	
+
+	mov		rax, 1
+	movd		xxOne, rax		; 1肺 盲款促.(word)
+	movdqa		xmm0, xxOne
+	punpcklwd	xmm0, xxOne
+	pshufd		xxOne, xmm0, 0
+	
+	mov		rax, SPR
+	movd		xxSpr, rax
+	movdqa		xmm0, xxSpr
+	punpcklwd	xmm0, xxSpr
+	pshufd		xxSpr, xmm0, 0
+
+	mov		rax, fSpr
+	movd		xxfSpr, rax
+	movdqa		xmm0, xxfSpr
+	punpcklwd	xmm0, xxfSpr
+	pshufd		xxfSpr, xmm0, 0
+	
+	movdqa	xxsSpr, xxSpr
+	psubw	xxsSpr, xxfSpr
+
+
+
+; 捞固瘤 林家 父甸扁
+	mov		rrImgAddr, pData
+	mov		rax, BuffWidth	; ImgAddr= ImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rrImgAddr, rax
+	mov		ImgAddrLine, rrImgAddr
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	mov		ImgLineLength, rax
+	
+	add		rax, rrImgAddr
+	mov		ImgLineEnd, rax
+
+	mov		iy, InspTop
+	pxor	xxRslt, xxRslt
+	pxor	xmm0, xmm0
+
+Cmp_16:
+										; 1. Src Buffer
+	movdqu	xxSrc, [rrImgAddr]			; Load
+	movdqa	xxSrc2, xxSrc	
+	punpcklbw	xxSrc, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0	
+
+	movdqu	xxMinus, [rrImgAddr+ 1]			; Load
+	movdqa	xxMinus2, xxMinus	
+	punpcklbw	xxMinus, xmm0				; Unpack
+	punpckhbw	xxMinus2, xmm0	
+	
+	paddw	xxSrc, xxMinus
+	paddw	xxSrc2, xxMinus2
+	pmullw	xxSrc, xxSpr				; SPR
+	pmullw	xxSrc2, xxSpr
+
+
+										;	2. Compare Buffer
+	movdqu	xxCmp, [rrImgAddr+ rrPitch]	; Load
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxfSpr				; fSpr
+	pmullw	xxCmp2, xxfSpr
+	
+	psubw	xxSrc, xxCmp				; SPR - fSpr
+	psubw	xxSrc2, xxCmp2
+
+	movdqu	xxCmp, [rrImgAddr+ rrPitch2]
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxSpr
+	pmullw	xxCmp2, xxSpr
+	
+	psubw	xxSrc, xxCmp
+	psubw	xxSrc2, xxCmp2
+
+	movdqu	xxCmp, [rrImgAddr+ rrPitch2+ 1]		; Load
+	movdqa	xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw	xxCmp, xxsSpr				; sSpr
+	pmullw	xxCmp2, xxsSpr
+
+	psubw	xxSrc, xxCmp				; (SPR- fSpr) - sSpr
+	psubw	xxSrc2, xxCmp2
+
+
+	pabsw	xxSrc, xxSrc				; 例措蔼
+	psubusw	xxSrc, xxOne
+	pmaddwd	xxSrc, xxOne				; multiply and add ( 16 -> 32)
+	pabsw	xxSrc2, xxSrc2				; 例措蔼
+	psubusw	xxSrc2, xxOne
+	pmaddwd	xxSrc2, xxOne				; multiply and add ( 16 -> 32)
+	
+	movdqa	xxCmp, xxSrc
+	punpckldq	xxCmp, xmm0				; unpack 32 -> 64
+	punpckhdq	xxSrc, xmm0
+	
+	paddq	xxRslt, xxSrc				; add to Result(64)
+	paddq	xxRslt, xxCmp				; add to Result(64)
+
+	movdqa	xxCmp, xxSrc2
+	punpckldq	xxCmp, xmm0				; unpack 32 -> 64
+	punpckhdq	xxSrc2, xmm0
+
+	paddq	xxRslt, xxSrc2				; add to Result(64)
+	paddq	xxRslt, xxCmp				; add to Result(64)
+
+	
+	
+	add	rrImgAddr, 10h
+	cmp	rrImgAddr, ImgLineEnd
+	jl	Cmp_16
+	
+	inc	iy
+	cmp	iy, InspBottom
+	jge	End_Buff
+
+
+	mov	rax, ImgAddrLine
+	add	rax, BuffWidth
+	mov	ImgAddrLine, rax
+	mov	rrImgAddr, rax
+	
+	add	rax, ImgLineLength
+	mov	ImgLineEnd, rax
+	
+	jmp	Cmp_16
+
+
+End_Buff:
+
+	lea	esi, Result64
+	movdqu	[esi], xxRslt
+	mov	rax, [esi]
+	mov	rcx, [esi+8h]
+	add	rax, rcx
+
+RET
+CheckPitchAsm	ENDP
+end
diff --git a/Common_Class/SISAssem/BinalizeInspection.cpp b/Common_Class/SISAssem/BinalizeInspection.cpp
new file mode 100644
index 0000000..7d9ad24
--- /dev/null
+++ b/Common_Class/SISAssem/BinalizeInspection.cpp
@@ -0,0 +1,129 @@
+//20161221 单葛侩栏肺 鞭窍霸 父惦
+//捞柳拳 八荤(咖瘤农发八荤 殿俊 静磊)
+#include "stdafx.h"
+
+#include "BlobStorage.h"
+#include <wmmintrin.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#include "SISAssem.h"
+#include "AssemParam.h"
+
+int CSISAssem::BinalizeInspection(BYTE *pSrc, int nThresS, int nThresE, CRect rtROI
+									,int nWidth, CDefectPair *pDefectdPair, int nStartPair, int nMaxPair
+									,int &nEndLine)
+{	
+	int nPair = nStartPair;	
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	if(nThresE < nThresS)
+	{
+		int nTemp = nThresS;
+		nThresS = nThresE;
+		nThresE = nTemp;
+	}
+
+	__m128i ZeroData = _mm_setzero_si128();
+	__m128i ThresHigh = _mm_set1_epi8(UCHAR(nThresE)^0x80);
+	__m128i ThresLow = _mm_set1_epi8(UCHAR(nThresS)^0x80);
+	__m128i OneAll = _mm_set1_epi8(-1);
+	__m128i Image;
+	__m128i Result;
+	__m128i Temp;	
+	__m128i _x80 = _mm_set1_epi8('\x80');
+
+	BYTE *pS, *pS_;
+
+	int nx, ny;
+	int nStartX, nEndX, nStartY, nEndY;
+	nStartY = rtROI.top;
+	nEndY = nStartY + rtROI.Height();
+	nStartX = rtROI.left;
+	nEndX = rtROI.right-16;
+
+	pS = pSrc + nWidth * nStartY + nStartX;
+	
+	for(ny = nStartY; ny < nEndY; ny++)
+	{		
+		pS_ = pS;
+		for(nx = nStartX; nx < nEndX; nx+=16)	//16俺究 贸府
+		{
+			//捞固瘤单捞磐 肺爹(src)
+			Image = _mm_loadu_si128((__m128i*) (pS_));
+
+			//奴芭			
+			Temp = _mm_cmpgt_epi8(_mm_xor_si128(Image, _x80), ThresLow);
+			Result = _mm_cmplt_epi8(_mm_xor_si128(Image, _x80), ThresHigh);
+			Result = _mm_and_si128(Result, Temp);
+
+			if(_mm_movemask_epi8(Result) != 0)
+			{
+				for(int i = 0; i < 16; i++)
+				{
+					if(Result.m128i_i8[i] != 0)
+					{
+						PairAddr->s_DefectPos = DEFPOS_CENTER;
+						PairAddr->s_DefectPair = DEFPAIR_PPAIR;
+						PairAddr->s_nDefectX = nx + i;
+						PairAddr->s_nDefectY = ny;
+						PairAddr->s_DefectType = DEFTYPE_BLACK;
+						PairAddr->s_nGraySrc = Image.m128i_u8[i];
+						PairAddr->s_nGrayRef = nThresE;
+						PairAddr->s_nZone = 0;
+						PairAddr->s_nThresold = nThresE;
+						PairAddr++;
+						nPair++;
+
+						if(nPair >= nMaxPair)
+						{
+							nEndLine = ny;
+							return nPair;
+						}
+					}
+				}			
+			}
+			pS_ += 16;
+		}
+		pS += nWidth;
+	}
+
+	/*
+	nEndX+=16;
+	for(ny = nStartY; ny < nEndY; ny++)
+	{		
+		pS_ = pS;
+		for(; nx < nEndX; nx++)	//16俺究 贸府
+		{
+			if(*(pS_) > nThresS &&  *(pS_) < nThresE)
+			{
+				PairAddr->s_DefectPos = DEFPOS_CENTER;
+				PairAddr->s_DefectPair = DEFPAIR_PPAIR;
+				PairAddr->s_nDefectX = nx;
+				PairAddr->s_nDefectY = ny;
+				PairAddr->s_DefectType = DEFTYPE_BLACK;
+				PairAddr->s_nGraySrc = *(pS_);
+				PairAddr->s_nGrayRef = nThresE;
+				PairAddr->s_nZone = 0;
+				PairAddr->s_nThresold = nThresE;
+				PairAddr++;
+				nPair++;
+
+				if(nPair >= nMaxPair)
+				{
+					nEndLine = ny;
+					return nPair;
+				}
+			}
+
+			pS_ ++;
+		}
+		pS += nWidth;
+	}
+	*/
+
+	nEndLine = (int)rtROI.bottom;
+	return nPair;
+}
diff --git a/Common_Class/SISAssem/BlobStorage.cpp b/Common_Class/SISAssem/BlobStorage.cpp
new file mode 100644
index 0000000..c1549d9
--- /dev/null
+++ b/Common_Class/SISAssem/BlobStorage.cpp
@@ -0,0 +1,1445 @@
+#include "StdAfx.h"
+#include "BlobStorage.h"
+#include "math.h"
+
+#include "StopWatch3.h"
+
+
+
+
+CBlobStorage::CBlobStorage(void)
+{
+	m_nBlobSpace= m_maxBlob= m_nBlob= 0;
+	m_pBlobDefect= NULL;
+}
+CBlobStorage::~CBlobStorage(void)
+{
+	if(m_pBlobDefect)
+		delete[] m_pBlobDefect;
+}
+
+void CBlobStorage::ResetBlobStorage()
+{
+	m_nSkipUnpaired = 0;
+	m_nSkipClassify = 0;
+	m_nMoveClassify = 0;
+	m_nSkipMerged = 0;
+
+	int i;
+	int nBlob;
+
+	if(m_nBlobSpace < m_nBlob)
+		nBlob= m_nBlobSpace;
+	else
+		nBlob= m_nBlob;
+
+	for(i= 0; i< nBlob; i++)
+	{
+		m_pBlobDefect[i].Reset();
+	}
+	m_nBlob= 0;
+}
+void CBlobStorage::TotalResetBlobStorage()
+{
+
+	m_nSkipUnpaired = 0;
+	m_nSkipClassify = 0;
+	m_nMoveClassify = 0;
+	m_nSkipMerged = 0;
+
+	int i;
+	for(i= 0; i< m_maxBlob; i++)
+	{
+		m_pBlobDefect[i].Reset();
+	}
+	m_nBlob= 0;
+}
+
+
+int	CBlobStorage::InitBlobStorage(int maxBlob)
+{
+	if(maxBlob <= m_nBlobSpace)
+	{
+		m_maxBlob= maxBlob;
+		return m_maxBlob;
+	}
+
+	if(m_pBlobDefect != NULL)
+	{
+		delete[] m_pBlobDefect;
+	}
+
+	// 16俺狼 咯盒阑 敌促..恐? 郴干..
+	int	BlobSapce= maxBlob+ 16;
+	m_pBlobDefect= new CDefectBlob[BlobSapce];
+
+
+	if(m_pBlobDefect == NULL)
+	{
+		m_maxBlob= m_nBlobSpace= 0;
+		return m_maxBlob;
+	}
+
+
+	m_maxBlob= m_nBlobSpace= maxBlob;
+
+	TotalResetBlobStorage();// 檬扁拳 矫埃 窜绵阑 困秦 TotalReset 拌凯 窃荐 眠啊.
+
+	return m_maxBlob;
+}
+
+DIT_RESULT CBlobStorage::BlobDefectVert()
+{
+	DIT_RESULT Ret = DIT_CONV_SUCCESS;
+
+	CStopWatch stopWatch;
+	stopWatch.Start();
+	int x, y;
+
+
+	// Index 概扁扁.
+	ZeroMemory(m_bMerged, m_nPair * sizeof(BOOL));
+	ZeroMemory(m_bTemp, m_nPair * sizeof(BOOL));
+	for (x = 0; x < m_nPair; x++)
+		m_lFirstIndex[x] = x;
+
+
+	CDefectPair *pPair;
+	CDefectPair *pPairNext;
+	m_nSkipClassify= 0;
+	// 牢立 叼棋 赣瘤窍扁.
+
+	// 0. 搬窃 侨伎 灌扁 恐邦 焊沥.
+	CPairStorage::CorrectDefGray();
+	// 1. Filtering Pairing to Delete.
+	CPairStorage::Filtering_Vert();
+
+	// 2. 瘤快绊 巢篮 Pairing Blob Index 父甸扁.
+	int idx, idy;
+	for(x = 0; x < m_nPair; x++)
+	{
+		pPair= m_pPairDefect+ x;
+		if(pPair->s_DefectType == DEFTYPE_DELETE)
+			continue;
+
+		for (y = x + 1; y < m_nPair; y++)
+		{
+			pPairNext= m_pPairDefect+ y;
+			if(pPairNext->s_DefectType == DEFTYPE_DELETE)
+				continue;
+
+			if (m_bMerged[y] || (pPair->s_DefectType != pPairNext->s_DefectType))
+				continue;
+
+			idx= pPairNext->s_nDefectX- pPair->s_nDefectX;
+			idy= pPairNext->s_nDefectY- pPair->s_nDefectY;
+
+			if(idx > 16)
+				break;
+
+			if((idy > 3 || idy < -3))				// 
+				continue;
+			if((idx > 3 || idx < -3))				// 
+				continue;
+
+
+			m_lFirstIndex[y] = m_lFirstIndex[x];
+			m_bMerged[y] = TRUE;
+		}
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	int nStart = m_nBlob;
+
+	// 叼棋甸狼 荐父怒 贸府. - Blobing
+	int nBlobNum = 0;
+	int nLevelDiff = 0;
+
+	CDefectBlob *pBlob= m_pBlobDefect+ m_nBlob;
+	CDefectBlob *pBlobNext;
+	for (x = 0; x < m_nPair; x++)
+	{
+		pPair= m_pPairDefect+ x;
+		if (pPair->s_DefectType == DEFTYPE_DELETE)
+		{
+			m_nSkipClassify++;
+			continue;
+		}
+
+		if (!m_bTemp[m_lFirstIndex[x]])	// 贸澜 唱鸥抄 搬窃 贸府.
+		{
+			if (m_nBlob >= m_maxBlob)
+				continue;
+
+         // 20150811 芭措 CS
+			//////////////////////////////////////////////////////////////////////////
+			//Junho 芭措CS
+         if(pPair->s_nZone != 0) // ZONE捞 绝栏搁 芭措 CS绰 窍瘤 臼绰促.
+         {
+			   if(m_Param.m_nCSThres[pPair->s_nZone] != 0)  
+			   {
+				   if(pPair->s_DefectType == DEFTYPE_BLACK)
+				   {
+					   if(pPair->s_nGraySrc >= m_Param.m_nCSThres[pPair->s_nZone])
+					   {
+						   pPair->s_DefectType = DEFTYPE_DELETE;
+						   m_nSkipClassify++;
+						   continue;
+					   }
+				   }
+			   }
+			   if(m_Param.m_nOriThres[pPair->s_nZone] != 0)  
+			   {
+				   if(pPair->s_DefectType == DEFTYPE_WHITE)
+				   {
+					   nLevelDiff = static_cast<int>(pPair->s_nGraySrc - pPair->s_nGrayRef);
+					   if(nLevelDiff < m_Param.m_nOriThres[pPair->s_nZone])
+					   {
+						   pPair->s_DefectType = DEFTYPE_DELETE;
+						   m_nSkipClassify++;
+						   continue;
+					   }
+				   }
+			   }
+         }
+			//////////////////////////////////////////////////////////////////////////
+
+			m_bTemp[m_lFirstIndex[x]] = TRUE;
+
+			pBlob->CreateBlob(pPair, m_lFirstIndex[x]);
+
+
+			m_nBlob++;
+			nBlobNum++;
+			pBlob= m_pBlobDefect+ m_nBlob;
+		}
+		else		// 唱吝俊 唱鸥抄 搬窃 贸府.
+		{
+			for(y = m_nBlob - 1; y >= 0; y--)
+			{
+				pBlobNext= m_pBlobDefect+ y;
+				if (pBlobNext->s_nIndex == m_lFirstIndex[x])
+				{
+					// 20150811 芭措 CS
+					//////////////////////////////////////////////////////////////////////////
+					//Junho 芭措CS
+					if(pPair->s_nZone != 0) // ZONE捞 绝栏搁 芭措 CS绰 窍瘤 臼绰促.
+					{
+					   if(m_Param.m_nCSThres[pPair->s_nZone] != 0)  
+					   {
+						   if(pPair->s_DefectType == DEFTYPE_BLACK)
+						   {
+							   if(pPair->s_nGraySrc >= m_Param.m_nCSThres[pPair->s_nZone])
+							   {
+								   pPair->s_DefectType = DEFTYPE_DELETE;
+								   m_nSkipClassify++;
+								   continue;
+							   }
+						   }
+					   }
+					   if(m_Param.m_nOriThres[pPair->s_nZone] != 0)  
+					   {
+						   if(pPair->s_DefectType == DEFTYPE_WHITE)
+						   {
+							   nLevelDiff = static_cast<int>(pPair->s_nGraySrc - pPair->s_nGrayRef);
+							   if(nLevelDiff < m_Param.m_nOriThres[pPair->s_nZone])
+							   {
+								   pPair->s_DefectType = DEFTYPE_DELETE;
+								   m_nSkipClassify++;
+								   continue;
+							   }
+						   }
+						}
+					}
+					//////////////////////////////////////////////////////////////////////////
+
+					pBlobNext->IncludePair(pPair);
+					break;
+				}
+			}
+		}
+	}
+
+	// 谅钎 焊沥.
+	for (x = nStart; x < m_nBlob; x++)
+	{
+		pBlob= m_pBlobDefect+ x;
+		if (pBlob->s_nDefectArea > 0)
+		{
+			pBlob->s_nDefectX = pBlob->s_nDefectX / pBlob->s_nDefectArea;
+			pBlob->s_nDefectY = pBlob->s_nDefectY / pBlob->s_nDefectArea;
+			pBlob->s_sLevelSrcAvg = pBlob->s_nLevelSrcSum / pBlob->s_nDefectArea;
+			pBlob->s_sLevelRefAvg = pBlob->s_nLevelRefSum / pBlob->s_nDefectArea;
+			pBlob->s_sLevelDiffAvg = pBlob->s_nLevelDiffSum / pBlob->s_nDefectArea;
+			pBlob->s_sThresholdAvg =  pBlob->s_nThresholdSum / pBlob->s_nDefectArea;
+
+			pBlob->s_nRegionType = m_Param.s_nRegionType;
+			pBlob->s_nDefectRScale = CalcRScale(pBlob->s_ptVertex);
+		}
+		else
+			pBlob->s_bRemoved = TRUE;
+	}
+
+	stopWatch.End();
+	m_BlobTime= stopWatch.GetDurationMilliSecond(); 
+	return Ret;
+}
+
+DIT_RESULT CBlobStorage::BlobDefectVert(CPairStorage *pPairStrg)
+{
+	DIT_RESULT Ret = DIT_CONV_SUCCESS;
+
+	// 搬窃 侨伎 灌扁 恐邦 焊沥.
+	pPairStrg->CorrectDefGray();
+	// PairDefect 鞘磐傅窍扁.
+	pPairStrg->Filtering_Vert();
+
+	int x, y;
+
+	int nPair= m_nPair;
+	CDefectPair *pPairDefect= m_pPairDefect;
+	if(pPairStrg != NULL)
+	{
+		nPair= pPairStrg->m_nPair;
+		pPairDefect= pPairStrg->m_pPairDefect;
+	}
+
+
+	// Index 概扁扁.
+	ZeroMemory(m_bMerged, nPair * sizeof(BOOL));
+	ZeroMemory(m_bTemp, nPair * sizeof(BOOL));
+	for (x = 0; x < nPair; x++)
+		m_lFirstIndex[x] = x;
+
+
+	CDefectPair *pPair;
+	CDefectPair *pPairNext;
+	m_nSkipClassify= 0;
+	// 牢立 叼棋 赣瘤窍扁.
+
+
+	int idx, idy;
+	for(x = 0; x < nPair; x++)
+	{
+		pPair= pPairDefect+ x;
+		if(pPair->s_DefectType == DEFTYPE_DELETE)
+			continue;
+
+		for (y = x + 1; y < nPair; y++)
+		{
+			pPairNext= pPairDefect+ y;
+			if(pPairNext->s_DefectType == DEFTYPE_DELETE)
+				continue;
+
+			if (m_bMerged[y] || pPair->s_DefectType != pPairNext->s_DefectType)
+				continue;
+
+			idx= pPairNext->s_nDefectX- pPair->s_nDefectX;
+			idy= pPairNext->s_nDefectY- pPair->s_nDefectY;
+
+			if(idx > 16)
+				break;
+
+			if((idy > 3 || idy < -3))				// 
+				continue;
+			if((idx > 3 || idx < -3))				// 
+				continue;
+
+
+			m_lFirstIndex[y] = m_lFirstIndex[x];
+			m_bMerged[y] = TRUE;
+		}
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	int nStart = m_nBlob;
+
+	// 叼棋甸狼 荐父怒 贸府. - Blobing
+	int nBlobNum = 0;
+	int nLevelDiff = 0;
+
+	CDefectBlob *pBlob= m_pBlobDefect+ m_nBlob;
+	CDefectBlob *pBlobNext;
+	for (x = 0; x < nPair; x++)
+	{
+		pPair= pPairDefect+ x;
+		if (pPair->s_DefectType == DEFTYPE_DELETE)
+		{
+			m_nSkipClassify++;
+			continue;
+		}
+
+		if (!m_bTemp[m_lFirstIndex[x]])	// 贸澜 唱鸥抄 搬窃 贸府.
+		{
+			if (m_nBlob >= m_maxBlob)
+				continue;
+
+			// 20150811 芭措 CS
+			//////////////////////////////////////////////////////////////////////////
+			//Junho 芭措CS
+			if(pPair->s_nZone != 0) // ZONE捞 绝栏搁 芭措 CS绰 窍瘤 臼绰促.
+			{
+			   if(m_Param.m_nCSThres[pPair->s_nZone] != 0)  
+			   {
+				   if(pPair->s_DefectType == DEFTYPE_BLACK)
+				   {
+					   if(pPair->s_nGraySrc >= m_Param.m_nCSThres[pPair->s_nZone])
+					   {
+						   pPair->s_DefectType = DEFTYPE_DELETE;
+						   m_nSkipClassify++;
+						   continue;
+					   }
+				   }
+			   }
+			   if(m_Param.m_nOriThres[pPair->s_nZone] != 0) 
+			   {
+				   if(pPair->s_DefectType == DEFTYPE_WHITE)
+				   {
+					   nLevelDiff = static_cast<int>(pPair->s_nGraySrc - pPair->s_nGrayRef);
+					   if(nLevelDiff < m_Param.m_nOriThres[pPair->s_nZone])
+					   {
+						   pPair->s_DefectType = DEFTYPE_DELETE;
+						   m_nSkipClassify++;
+						   continue;
+					   }
+				   }
+			   }
+			}
+			//////////////////////////////////////////////////////////////////////////
+
+			m_bTemp[m_lFirstIndex[x]] = TRUE;
+
+			pBlob->CreateBlob(pPair, m_lFirstIndex[x]);
+
+
+			m_nBlob++;
+			nBlobNum++;
+			pBlob= m_pBlobDefect+ m_nBlob;
+		}
+		else		// 唱吝俊 唱鸥抄 搬窃 贸府.
+		{
+			for(y = m_nBlob - 1; y >= 0; y--)
+			{
+				pBlobNext= m_pBlobDefect+ y;
+				if (pBlobNext->s_nIndex == m_lFirstIndex[x])
+				{
+
+					// 20150811 芭措 CS
+					//////////////////////////////////////////////////////////////////////////
+					//Junho 芭措CS
+					if(pPair->s_nZone != 0) // ZONE捞 绝栏搁 芭措 CS绰 窍瘤 臼绰促.
+					{
+						if(m_Param.m_nCSThres[pPair->s_nZone] != 0)  
+						{
+							if(pPair->s_DefectType == DEFTYPE_BLACK)
+							{
+							  if(pPair->s_nGraySrc >= m_Param.m_nCSThres[pPair->s_nZone])
+							  {
+								  pPair->s_DefectType = DEFTYPE_DELETE;
+								  m_nSkipClassify++;
+								  continue;
+							  }
+							}
+						}
+						if(m_Param.m_nOriThres[pPair->s_nZone] != 0) 
+						{
+							if(pPair->s_DefectType == DEFTYPE_WHITE)
+							{
+							  nLevelDiff = static_cast<int>(pPair->s_nGraySrc - pPair->s_nGrayRef);
+							  if(nLevelDiff < m_Param.m_nOriThres[pPair->s_nZone])
+							  {
+								  pPair->s_DefectType = DEFTYPE_DELETE;
+								  m_nSkipClassify++;
+								  continue;
+							  }
+							}
+						}
+					}
+				   //////////////////////////////////////////////////////////////////////////
+
+					pBlobNext->IncludePair(pPair);
+					break;
+				}
+			}
+		}
+	}
+
+	// 谅钎 焊沥.
+	for (x = nStart; x < m_nBlob; x++)
+	{
+		pBlob= m_pBlobDefect+ x;
+		if (pBlob->s_nDefectArea > 0)
+		{
+			pBlob->s_nDefectX = pBlob->s_nDefectX / pBlob->s_nDefectArea;
+			pBlob->s_nDefectY = pBlob->s_nDefectY / pBlob->s_nDefectArea;
+			pBlob->s_sLevelSrcAvg = pBlob->s_nLevelSrcSum / pBlob->s_nDefectArea;
+			pBlob->s_sLevelRefAvg = pBlob->s_nLevelRefSum / pBlob->s_nDefectArea;
+			pBlob->s_sLevelDiffAvg = pBlob->s_nLevelDiffSum / pBlob->s_nDefectArea;
+			pBlob->s_sThresholdAvg =  pBlob->s_nThresholdSum / pBlob->s_nDefectArea;
+
+			pBlob->s_nRegionType = m_Param.s_nRegionType;
+			pBlob->s_nDefectRScale = CalcRScale(pBlob->s_ptVertex);
+		} 
+		else
+			pBlob->s_bRemoved = TRUE;
+	}
+
+
+	return Ret;
+}
+
+DIT_RESULT CBlobStorage::BlobDefect()
+{
+	DIT_RESULT Ret = DIT_CONV_SUCCESS;
+
+	int x, y;
+
+	// Index 概扁扁.
+	ZeroMemory(m_bMerged, m_nPairSpace * sizeof(BOOL));
+	ZeroMemory(m_bTemp, m_nPairSpace * sizeof(BOOL));
+	for (x = 0; x < m_nPair; x++)
+		m_lFirstIndex[x] = x;
+
+
+	CDefectPair *pPair;
+	CDefectPair *pPairNext;
+	m_nSkipClassify= 0;
+
+	// 搬窃 侨伎 灌扁 恐邦 焊沥.
+	CPairStorage::CorrectDefGray();
+	// PairDefect 鞘磐傅窍扁.
+	CPairStorage::Filtering_Hori();
+
+
+	for(x = 0; x < m_nPair; x++)
+	{
+		pPair= m_pPairDefect+ x;
+		if(pPair->s_DefectType == DEFTYPE_DELETE)
+			continue;
+
+		for (y = x + 1; y < m_nPair; y++)
+		{
+			pPairNext= m_pPairDefect+ y;
+			if(pPairNext->s_DefectType == DEFTYPE_DELETE)
+				continue;
+
+			if (m_bMerged[y] || pPair->s_DefectType != pPairNext->s_DefectType)
+				continue;
+
+			if (pPairNext->s_nDefectY - pPair->s_nDefectY > 1)				// y绰 x焊促 农促.
+				break;
+
+			if (pPairNext->s_nDefectX - pPair->s_nDefectX > 1
+				||  pPairNext->s_nDefectX - pPair->s_nDefectX < -1)
+				continue;
+
+			m_lFirstIndex[y] = m_lFirstIndex[x];
+			m_bMerged[y] = TRUE;
+		}
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	int nStart = m_nBlob;
+
+	// 叼棋甸狼 荐父怒 贸府. - Blobing
+	int nBlobNum = 0;
+	int nLevelDiff = 0;
+
+	CDefectBlob *pBlob= m_pBlobDefect+ m_nBlob;
+	CDefectBlob *pBlobNext;
+	for (x = 0; x < m_nPair; x++)
+	{
+		pPair= m_pPairDefect+ x;
+		if (pPair->s_DefectType == DEFTYPE_DELETE)
+		{
+			m_nSkipClassify++;
+			continue;
+		}
+
+		if (!m_bTemp[m_lFirstIndex[x]])	// 贸澜 唱鸥抄 搬窃 贸府.
+		{
+			if (m_nBlob >= m_maxBlob)
+				continue;
+
+			// 20150811 芭措 CS
+			//////////////////////////////////////////////////////////////////////////
+			//Junho 芭措CS
+			if(pPair->s_nZone != 0) // ZONE捞 绝栏搁 芭措 CS绰 窍瘤 臼绰促.
+			{
+				if(m_Param.m_nCSThres[pPair->s_nZone] != 0)  
+				{
+					if(pPair->s_DefectType == DEFTYPE_BLACK)
+					{
+						if(pPair->s_nGraySrc >= m_Param.m_nCSThres[pPair->s_nZone])
+						{
+							pPair->s_DefectType = DEFTYPE_DELETE;
+							m_nSkipClassify++;
+							continue;
+						}
+					}
+				}
+				if(m_Param.m_nOriThres[pPair->s_nZone] != 0) 
+				{
+					if(pPair->s_DefectType == DEFTYPE_WHITE)
+					{
+						nLevelDiff = static_cast<int>(pPair->s_nGraySrc - pPair->s_nGrayRef);
+						if(nLevelDiff < m_Param.m_nOriThres[pPair->s_nZone])
+						{
+							pPair->s_DefectType = DEFTYPE_DELETE;
+							m_nSkipClassify++;
+							continue;
+						}
+					}
+				}
+			}
+			//////////////////////////////////////////////////////////////////////////
+			m_bTemp[m_lFirstIndex[x]] = TRUE;
+
+			pBlob->CreateBlob(pPair, m_lFirstIndex[x]);
+
+
+			m_nBlob++;
+			nBlobNum++;
+			pBlob= m_pBlobDefect+ m_nBlob;
+		}
+		else		// 唱吝俊 唱鸥抄 搬窃 贸府.
+		{
+			for(y = m_nBlob - 1; y >= 0; y--)
+			{
+				pBlobNext= m_pBlobDefect+ y;
+				if (pBlobNext->s_nIndex != m_lFirstIndex[x])
+					continue;
+
+				// 20150811 芭措 CS
+				//////////////////////////////////////////////////////////////////////////
+				//Junho 芭措CS
+				if(pPair->s_nZone != 0) // ZONE捞 绝栏搁 芭措 CS绰 窍瘤 臼绰促.
+				{
+					if(m_Param.m_nCSThres[pPair->s_nZone] != 0)  
+					{
+						if(pPair->s_DefectType == DEFTYPE_BLACK)
+						{
+							if(pPair->s_nGraySrc >= m_Param.m_nCSThres[pPair->s_nZone])
+							{
+								pPair->s_DefectType = DEFTYPE_DELETE;
+								m_nSkipClassify++;
+								continue;
+							}
+						}
+					}
+					if(m_Param.m_nOriThres[pPair->s_nZone] != 0)
+					{
+						if(pPair->s_DefectType == DEFTYPE_WHITE)
+						{
+							nLevelDiff = static_cast<int>(pPair->s_nGraySrc - pPair->s_nGrayRef);
+							if(nLevelDiff < m_Param.m_nOriThres[pPair->s_nZone])
+							{
+								pPair->s_DefectType = DEFTYPE_DELETE;
+								m_nSkipClassify++;
+								continue;
+							}
+						}
+					}
+				}
+				//////////////////////////////////////////////////////////////////////////
+
+				pBlobNext->IncludePair(pPair);
+
+				break;
+			}
+		}
+	}
+
+	// 谅钎 焊沥.
+	for (x = nStart; x < m_nBlob; x++)
+	{
+		pBlob= m_pBlobDefect+ x;
+		if (pBlob->s_nDefectArea > 0)
+		{
+			pBlob->s_nDefectX = pBlob->s_nDefectX / pBlob->s_nDefectArea;
+			pBlob->s_nDefectY = pBlob->s_nDefectY / pBlob->s_nDefectArea;
+			pBlob->s_sLevelSrcAvg = pBlob->s_nLevelSrcSum / pBlob->s_nDefectArea;
+			pBlob->s_sLevelRefAvg = pBlob->s_nLevelRefSum / pBlob->s_nDefectArea;
+			pBlob->s_sLevelDiffAvg = pBlob->s_nLevelDiffSum / pBlob->s_nDefectArea;
+			pBlob->s_sThresholdAvg =  pBlob->s_nThresholdSum / pBlob->s_nDefectArea;
+
+			pBlob->s_nRegionType = m_Param.s_nRegionType;
+			pBlob->s_nDefectRScale = CalcRScale(pBlob->s_ptVertex);
+		} 
+		else
+			pBlob->s_bRemoved = TRUE;
+	}
+
+
+	return Ret;
+}
+
+void	CBlobStorage::ShadowFilterVert(int nStart, double yPitch)
+{
+	CDefectBlob *pBlob;
+	CDefectBlob *pBlobNext;
+	int x, y;
+
+	// Shadow Filtering : unpair狼 版快... pitch 扒呈俊 搬窃捞 乐促搁.. unpair甫 力芭 窍摆促.
+	CRect	rect;
+	CPoint	pt;
+	for (x= nStart; x < m_nBlob; x++)
+	{
+		pBlob= m_pBlobDefect+ x;
+		pt.x= pBlob->s_nDefectX;
+
+		if (pBlob->s_DefectPos == DEFPOS_LEFT)
+		{
+			pt.y= (LONG)(pBlob->s_nDefectY+ yPitch);
+		}else if(pBlob->s_DefectPos == DEFPOS_RIGHT)
+		{
+			pt.y= (LONG)(pBlob->s_nDefectY- yPitch);
+		}else
+		{
+			continue;
+		}
+
+		for (y = nStart; y < m_nBlob; y++)
+		{
+			if(x == y)	continue;
+			pBlobNext= m_pBlobDefect+ y;
+			rect= pBlobNext->s_DefectRect;
+			rect.left	-= 3;
+			rect.top	-= 3;
+			rect.right	+= 3;
+			rect.bottom	+= 3;
+			if(rect.PtInRect(pt))
+			{
+				pBlob->s_bRemoved = TRUE;
+				break;
+			}
+		}
+	}
+	// 捞吧 捞繁 侥栏肺 秦具 窍唱?? 快急篮... 墨乔窍绊 唱吝俊 荐沥
+	int i;
+	int nRemovedIdx = 0;
+	for (i = nStart; i < m_nBlob; i++)
+	{
+		if (!m_pBlobDefect[i].s_bRemoved)
+		{
+			m_pBlobDefect[nStart+ nRemovedIdx] = m_pBlobDefect[i];
+			nRemovedIdx++;
+		}
+	}
+	m_nBlob = nStart+ nRemovedIdx;
+}
+
+void	CBlobStorage::ShadowFilter(int nStart, double xPitch)
+{
+	CDefectBlob *pBlob;
+	CDefectBlob *pBlobNext;
+	int x, y;
+
+
+	// Shadow Filtering : unpair狼 版快... pitch 扒呈俊 搬窃捞 乐促搁.. unpair甫 力芭 窍摆促.
+	CRect	rect;
+	CPoint	pt;
+	for (x= nStart; x < m_nBlob; x++)
+	{
+		pBlob= m_pBlobDefect+ x;
+		pt.y= pBlob->s_nDefectY;
+
+		if (pBlob->s_DefectPos == DEFPOS_LEFT)
+		{
+			pt.x= (LONG)(pBlob->s_nDefectX+ xPitch);
+		}else if(pBlob->s_DefectPos == DEFPOS_RIGHT)
+		{
+			pt.x= (LONG)(pBlob->s_nDefectX- xPitch);
+		}else
+		{
+			continue;
+		}
+
+		for (y = nStart; y < m_nBlob; y++)
+		{
+			if(x == y)	continue;
+			pBlobNext= m_pBlobDefect+ y;
+			rect= pBlobNext->s_DefectRect;
+			rect.left	-= 3;
+			rect.top	-= 3;
+			rect.right	+= 3;
+			rect.bottom	+= 3;
+			if(rect.PtInRect(pt))
+			{
+				pBlob->s_bRemoved = TRUE;
+				break;
+			}
+		}
+	}
+	// 捞吧 捞繁 侥栏肺 秦具 窍唱?? 快急篮... 墨乔窍绊 唱吝俊 荐沥
+	int i;
+	int nRemovedIdx = 0;
+	for (i = nStart; i < m_nBlob; i++)
+	{
+		if (!m_pBlobDefect[i].s_bRemoved)
+		{
+			m_pBlobDefect[nStart+ nRemovedIdx] = m_pBlobDefect[i];
+			nRemovedIdx++;
+		}
+	}
+	m_nBlob = nStart+ nRemovedIdx;
+}
+
+
+DIT_RESULT CBlobStorage::MergeDivision(int nStart, int nMergePixel)
+{
+	int i, j;
+	//	return DIT_CONV_SUCCESS;
+
+	// 俺眉狼 搬窃沥焊甫 Merge
+	CDefectBlob *pBlob;
+	CDefectBlob *pBlobNext;
+	for (i = nStart; i < m_nBlob; i++)
+	{
+		pBlob= m_pBlobDefect+ i;
+		for (j = i + 1; j < m_nBlob; j++)
+		{
+			pBlobNext= m_pBlobDefect+ j;
+			//choigudal 促弗 搬窃捞 悼老茄 困摹俊辑 棱鳃 版快 窍唱父 Defect栏肺 焊绊. 20090725
+			if (pBlob->s_DefectType != pBlobNext->s_DefectType)
+				continue;
+
+			if (pBlob->s_DefectRect.bottom + nMergePixel < pBlobNext->s_DefectRect.top
+				|| pBlob->s_DefectRect.top - nMergePixel > pBlobNext->s_DefectRect.bottom)
+				continue;
+
+			if (pBlob->s_DefectRect.right + nMergePixel < pBlobNext->s_DefectRect.left
+				|| pBlob->s_DefectRect.left - nMergePixel > pBlobNext->s_DefectRect.right)
+				continue;
+
+			// 牢立秦 乐栏骨肺 钦模促.
+			if (!pBlob->s_bRemoved && !pBlobNext->s_bRemoved)
+			{
+				//choigudal 促弗 搬窃捞 悼老茄 困摹俊辑 棱鳃 版快 窍唱父 Defect栏肺 焊绊. 20090725
+				//if(pBlob->s_DefectType == DEFTYPE_WHITE || pBlobNext->s_DefectType == DEFTYPE_WHITE)
+				//	pBlob->s_DefectType = DEFTYPE_WHITE;
+
+				//m_pBlobDefect[i] = m_pBlobDefect[i] + m_pBlobDefect[j];
+				pBlob->MergeBlob(*pBlobNext);
+				pBlobNext->s_bRemoved = TRUE;
+				m_nSkipMerged++;
+			}
+		}
+	}
+
+	// 搬窃阑 瘤款促.
+	int nRemovedIdx = 0;
+	for (i = nStart; i < m_nBlob; i++)
+	{
+		if (!m_pBlobDefect[i].s_bRemoved)
+		{
+			m_pBlobDefect[nStart+ nRemovedIdx] = m_pBlobDefect[i];
+			nRemovedIdx++;
+		}
+	}
+	m_nBlob = nStart+ nRemovedIdx;
+
+	for (i = nStart; i < m_nBlob; i++)
+		m_pBlobDefect[i].s_nDefectRScale = CalcRScale(m_pBlobDefect[i].s_ptVertex);
+
+	return DIT_CONV_SUCCESS;
+}
+
+DIT_RESULT CBlobStorage::MergeMix(int nStart, int nMergePixel)
+{
+	int i, j;
+
+	// 俺眉狼 搬窃沥焊甫 Merge
+	for (i = nStart; i < m_nBlob; i++)
+	{
+		for (j = m_nBlob - 1; j > i; j--)
+		{
+			if (m_pBlobDefect[j].s_DefectRect.bottom + 1 + nMergePixel < m_pBlobDefect[j].s_DefectRect.top
+				|| m_pBlobDefect[j].s_DefectRect.top - 1 - nMergePixel > m_pBlobDefect[j].s_DefectRect.bottom)
+				continue;
+
+			if (m_pBlobDefect[j].s_DefectRect.right + nMergePixel < m_pBlobDefect[j].s_DefectRect.left
+				|| m_pBlobDefect[j].s_DefectRect.left - nMergePixel > m_pBlobDefect[j].s_DefectRect.right)
+				continue;
+
+			// 牢立秦 乐栏骨肺 钦模促. -> Type捞 促福搁 Type阑 MIXED肺 官槽促.
+			if (m_pBlobDefect[j].s_DefectType != m_pBlobDefect[j].s_DefectType)
+				m_pBlobDefect[j].s_DefectType = DEFTYPE_MIXED;
+
+			if (!m_pBlobDefect[j].s_bRemoved && !m_pBlobDefect[j].s_bRemoved)
+			{
+				m_pBlobDefect[i].MergeBlob(m_pBlobDefect[j]);
+				m_pBlobDefect[j].s_bRemoved = TRUE;
+				m_nSkipMerged++;
+			}
+		}
+	}
+
+	// 搬窃阑 瘤款促.
+	int nRemovedIdx = 0;
+	for (i = nStart; i < m_nBlob; i++)
+	{
+		if (!m_pBlobDefect[i].s_bRemoved)
+		{
+			m_pBlobDefect[nStart+ nRemovedIdx] = m_pBlobDefect[i];
+			nRemovedIdx++;
+		}
+	}
+	m_nBlob = nStart+ nRemovedIdx;
+
+	for (i = nStart; i < m_nBlob; i++)
+		m_pBlobDefect[i].s_nDefectRScale = CalcRScale(m_pBlobDefect[i].s_ptVertex);
+
+	return DIT_CONV_SUCCESS;
+}
+
+
+void CBlobStorage::CheckDefectRect(CDefectBlob& Defect, int nX, int nY)	// CPoint* pVertex, CRect* pRect, int nX, int nY)
+{
+	CPoint *points=  Defect.s_ptVertex;
+	if (nY <= Defect.s_DefectRect.top)
+	{
+		Defect.s_DefectRect.top = nY;
+		if (Defect.s_ptVertex[2].y == nY)	// Top Left
+		{
+			if (nX < Defect.s_ptVertex[2].x)
+			{
+				Defect.s_ptVertex[2].x = nX;
+				Defect.s_ptVertex[2].y = nY;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[2].x = nX;
+			Defect.s_ptVertex[2].y = nY;
+		}
+		if (Defect.s_ptVertex[3].y == nY)	// Top Right
+		{
+			if (nX + 1 > Defect.s_ptVertex[3].x)
+			{
+				Defect.s_ptVertex[3].x = nX + 1;
+				Defect.s_ptVertex[3].y = nY;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[3].x = nX + 1;
+			Defect.s_ptVertex[3].y = nY;
+		}
+	}
+	if (nY + 1 >= Defect.s_DefectRect.bottom)
+	{
+		Defect.s_DefectRect.bottom = nY + 1;
+		if (Defect.s_ptVertex[6].y == nY + 1)	// Bottom Left
+		{
+			if (nX < Defect.s_ptVertex[6].x)
+			{
+				Defect.s_ptVertex[6].x = nX;
+				Defect.s_ptVertex[6].y = nY + 1;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[6].x = nX;
+			Defect.s_ptVertex[6].y = nY + 1;
+		}
+		if (Defect.s_ptVertex[7].y == nY + 1)	// Bottom Right
+		{
+			if (nX + 1 > Defect.s_ptVertex[7].x)
+			{
+				Defect.s_ptVertex[7].x = nX + 1;
+				Defect.s_ptVertex[7].y = nY + 1;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[7].x = nX + 1;
+			Defect.s_ptVertex[7].y = nY + 1;
+		}
+	}
+	if (nX <= Defect.s_DefectRect.left)
+	{
+		Defect.s_DefectRect.left = nX;
+		if (Defect.s_ptVertex[1].x == nX)	// Left Bottom
+		{
+			if (nY + 1 > Defect.s_ptVertex[1].y)
+			{
+				Defect.s_ptVertex[1].x = nX;
+				Defect.s_ptVertex[1].y = nY + 1;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[1].x = nX;
+			Defect.s_ptVertex[1].y = nY + 1;
+		}
+		if (Defect.s_ptVertex[0].x == nX)	// Left Top
+		{
+			if (nY < Defect.s_ptVertex[0].y)
+			{
+				Defect.s_ptVertex[0].x = nX;
+				Defect.s_ptVertex[0].y = nY;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[0].x = nX;
+			Defect.s_ptVertex[0].y = nY;
+		}
+	}
+	if (nX + 1 >= Defect.s_DefectRect.right)
+	{
+		Defect.s_DefectRect.right = nX + 1;
+		if (Defect.s_ptVertex[5].x == nX + 1)	// Right Bottom
+		{
+			if (nY + 1 > Defect.s_ptVertex[5].y)
+			{
+				Defect.s_ptVertex[5].x = nX + 1;
+				Defect.s_ptVertex[5].y = nY + 1;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[5].x = nX + 1;
+			Defect.s_ptVertex[5].y = nY + 1;
+		}
+		if (Defect.s_ptVertex[4].x == nX + 1)	// Right Top
+		{
+			if (nY < Defect.s_ptVertex[4].y)
+			{
+				Defect.s_ptVertex[4].x = nX + 1;
+				Defect.s_ptVertex[4].y = nY;
+			}
+		}
+		else
+		{
+			Defect.s_ptVertex[4].x = nX + 1;
+			Defect.s_ptVertex[4].y = nY;
+		}
+	}
+}
+
+int CBlobStorage::CalcRScale(CPoint* pVertex)
+{
+	double dDeltaX, dDeltaY;
+	double dTemp, dRScale = 0.0;
+	for (int i = 0; i < 8; i++)
+	{
+		for (int j = i; j < 8; j++)
+		{
+#ifdef MOSIS_DELETE_CalcRScale
+			if (pVertex[i].x == 0 || pVertex[i].x == 32760 || pVertex[i].y == 0 ||pVertex[i].y == 32760
+				|| pVertex[j].x == 0 || pVertex[j].x == 32760 || pVertex[j].y == 0 ||pVertex[j].y == 32760)
+				continue;
+#endif
+			dDeltaX = (pVertex[i].x - pVertex[j].x) * m_Param.s_dConvResolution;
+			dDeltaY = (pVertex[i].y - pVertex[j].y) * m_Param.s_dScanResolution;
+			dTemp = sqrt(dDeltaX * dDeltaX + dDeltaY * dDeltaY);
+			if (dRScale < dTemp)
+				dRScale = dTemp;
+		}
+	}
+	if (dRScale < 0.0)
+		dRScale = 0.0;
+
+	return static_cast<int>(dRScale + 0.5);
+}
+
+int CBlobStorage::GetConvolutionValue(int nX, int nY, double dDist, int nSuppress)
+{
+	LPBYTE lpBuffer = NULL;
+	int nPitch;
+	double dRestRight;
+	double dRestLeft;
+	int nConvWidth, nConvHeight;
+
+	lpBuffer = m_Param.s_lpBuffer;
+	nConvWidth = m_Param.s_nConvWidth;
+	nConvHeight = m_Param.s_nConvHeight;
+
+	// 	if (dDist < 0)							// -10.4
+	// 	{
+	// 		dDist -= 1;							// -11.4
+	// 		nPitch = static_cast<int>(dDist);	// -11
+	// 		dRestRight = nPitch - dDist;		// 0.4
+	// 		dRestLeft = 1.0 - dRestRight;		// 0.6
+	// 	}
+	// 	else									// 10.4
+	// 	{
+	// 		nPitch = static_cast<int>(dDist);	// 10
+	// 		dRestLeft = dDist - nPitch;			// 0.4
+	// 		dRestRight = 1.0 - dRestLeft;		// 0.6
+	// 	}
+
+	if (dDist < 0)							// -10.4
+	{
+		dDist -= 1;							// -11.4
+		nPitch = static_cast<int>(dDist);	// -11
+		dRestLeft = nPitch - dDist;			// 0.4
+		dRestRight = 1.0 - dRestLeft;		// 0.6
+	}
+	else									// 10.4
+	{
+		nPitch = static_cast<int>(dDist);	// 10
+		dRestRight = dDist - nPitch;		// 0.4
+		dRestLeft = 1.0 - dRestRight;		// 0.6
+	}
+
+	int nConvolution = 0;
+	int nSourColor = 0, nDestColor = 0, nValue;
+	for (int i = 0; i < nConvWidth; i++)
+	{
+		for (int j = 0; j < nConvHeight; j++)
+		{
+			nValue = lpBuffer[(nY + j) * m_Param.s_nFrameWidth + (nX + i)];
+			if (nValue > nSuppress)
+				nValue = nSuppress;
+			nSourColor += nValue;
+
+			nValue = static_cast<int>((lpBuffer[(nY + j) * m_Param.s_nFrameWidth + (nX + i) + nPitch] * dRestLeft) + (lpBuffer[(nY + j) * m_Param.s_nFrameWidth + (nX + i) + nPitch + 1] * dRestRight));
+			if (nValue > nSuppress)
+				nValue = nSuppress;
+			nDestColor += nValue;
+		}
+	}
+
+	nConvolution = nSourColor - nDestColor;
+
+	return nConvolution;
+}
+
+int CBlobStorage::GetAreaValue(int nXStart, int nYStart, int nWidth, int nHeight, double dDist, int nSuppress)
+{
+	LPBYTE lpBuffer = NULL;
+	int nPitch;
+	double dRestRight;
+	double dRestLeft;
+	int nConvWidth, nConvHeight;
+
+	lpBuffer = m_Param.s_lpBuffer;
+	nConvWidth = m_Param.s_nConvWidth;
+	nConvHeight = m_Param.s_nConvHeight;
+
+	nPitch = static_cast<int>(dDist);
+	dRestRight = dDist - nPitch;
+	dRestLeft = 1.0 - dRestRight;
+
+	int nConvolution = 0, nValue;
+	double dSourColor = 0.0, dDestColor = 0.0;
+	for (int i = 0; i < nHeight; i++)
+	{
+		for (int j = 0; j < nWidth; j++)
+		{
+			nValue = lpBuffer[(nYStart + i) * m_Param.s_nFrameWidth + (nXStart + j)];
+			if (nValue > nSuppress)
+				nValue = nSuppress;
+			dSourColor += nValue;
+
+			nValue = static_cast<int>((lpBuffer[(nYStart + j) * m_Param.s_nFrameWidth + (nXStart + i) + nPitch] * dRestLeft) + (lpBuffer[(nYStart + j) * m_Param.s_nFrameWidth + (nXStart + i) + nPitch + 1] * dRestRight));
+			if (nValue > nSuppress)
+				nValue = nSuppress;
+			dDestColor += nValue;
+		}
+	}
+	nConvolution = static_cast<int>((dSourColor - dDestColor) / (nWidth * nHeight));
+
+	return nConvolution;
+}
+
+int CBlobStorage::GetConvolutionValueVert(int nX, int nY, double dDist, int nSuppress)
+{
+	LPBYTE lpBuffer = NULL;
+	int nPitch;
+	double dRestRight;
+	double dRestLeft;
+	int nConvWidth, nConvHeight;
+
+	lpBuffer = m_Param.s_lpBuffer;
+	nConvWidth = m_Param.s_nConvWidth;
+	nConvHeight = m_Param.s_nConvHeight;
+
+	if (dDist < 0)							// -10.4
+	{
+		dDist -= 1;							// -11.4
+		nPitch = static_cast<int>(dDist);	// -11
+		dRestLeft = nPitch - dDist;			// 0.4
+		dRestRight = 1.0 - dRestLeft;		// 0.6
+	}
+	else									// 10.4
+	{
+		nPitch = static_cast<int>(dDist);	// 10
+		dRestRight = dDist - nPitch;		// 0.4
+		dRestLeft = 1.0 - dRestRight;		// 0.6
+	}
+
+	if(nY+nPitch+1 >= m_Param.s_nFrameHeight || nY+nPitch+1 <= 0)
+		return 0;
+
+	int nConvolution = 0;
+	int nSourColor = 0, nDestColor = 0, nValue;
+	for (int i = 0; i < nConvWidth; i++)
+	{
+		for (int j = 0; j < nConvHeight; j++)
+		{
+			nValue = lpBuffer[(nY + j) * m_Param.s_nFrameWidth + (nX + i)];
+			if (nValue > nSuppress)
+				nValue = nSuppress;
+			nSourColor += nValue;
+
+			nValue = static_cast<int>((lpBuffer[(nY + j + nPitch) * m_Param.s_nFrameWidth + (nX + i)] * dRestLeft) + (lpBuffer[(nY + j + nPitch + 1) * m_Param.s_nFrameWidth + (nX + i)] * dRestRight));
+			if (nValue > nSuppress)
+				nValue = nSuppress;
+			nDestColor += nValue;
+		}
+	}
+
+	nConvolution = nSourColor - nDestColor;
+
+	return nConvolution;
+}
+
+int CBlobStorage::GetAreaValueVert(int nXStart, int nYStart, int nWidth, int nHeight, double dDist, int nSuppress)
+{
+	LPBYTE lpBuffer = NULL;
+	int nPitch;
+	double dRestRight;
+	double dRestLeft;
+	int nConvWidth, nConvHeight;	
+
+	lpBuffer = m_Param.s_lpBuffer;
+	nConvWidth = m_Param.s_nConvWidth;
+	nConvHeight = m_Param.s_nConvHeight;
+
+	nPitch = static_cast<int>(dDist);
+	dRestRight = dDist - nPitch;
+	dRestLeft = 1.0 - dRestRight;
+
+	if(nYStart+nPitch+1 >= m_Param.s_nFrameHeight)
+		return 0;
+
+	int nConvolution = 0, nValue;
+	double dSourColor = 0.0, dDestColor = 0.0;
+	for (int i = 0; i < nHeight; i++)
+	{
+		for (int j = 0; j < nWidth; j++)
+		{
+			nValue = lpBuffer[(nYStart + i) * m_Param.s_nFrameWidth + (nXStart + j)];
+			if (nValue > nSuppress)
+				nValue = nSuppress;
+			dSourColor += nValue;
+
+			nValue = static_cast<int>((lpBuffer[(nYStart + j + nPitch) * m_Param.s_nFrameWidth + (nXStart + i)] * dRestLeft) + (lpBuffer[(nYStart + j + nPitch + 1) * m_Param.s_nFrameWidth + (nXStart + i)] * dRestRight));
+			if (nValue > nSuppress)
+				nValue = nSuppress;
+			dDestColor += nValue;
+		}
+	}
+	nConvolution = static_cast<int>((dSourColor - dDestColor) / (nWidth * nHeight));
+
+	return nConvolution;
+}
+
+// 惑/窍 乔摹康开俊辑 搬窃 犁备盒茄促.
+DIT_RESULT CBlobStorage::ClassificationDefectVert(int nStart)
+{
+
+	// 谅/快 八荤康开 犁八荤.
+	int nPitch = static_cast<int>(m_Param.s_dPitchScanReal * m_Param.s_nPitchCycleScan);
+	double dPitch = m_Param.s_dPitchScanReal * m_Param.s_nPitchCycleScan;
+	int nCR, nCL, nCRValue, nCLValue;
+	int nX, nY;
+	int nStartIdx = m_nBlob - 1;
+
+	int i;
+	CDefectBlob *pBlob;
+	for (i = nStartIdx; i >= nStart; i--)
+	{
+		pBlob= m_pBlobDefect+ i;
+		if (pBlob->s_DefectPos == DEFPOS_LEFT && pBlob->s_DefectPair == DEFPAIR_UNPAIR)
+		{
+			//if (pBlob->s_sDefectPeak * (m_Param.s_nConvWidth * m_Param.s_nConvHeight) > m_Param.s_nSideThreshold)
+			//if (pBlob->s_sDefectPeak > m_Param.s_nThreshold)
+			{
+				nX = pBlob->s_nDefectX;
+				nY = pBlob->s_nDefectY % m_Param.s_nFrameHeight;
+				nCL = GetConvolutionValueVert(nX, nY, dPitch, m_Param.s_nThresholdSupress);
+				nCR = GetConvolutionValueVert(nX, static_cast<int>(nY+dPitch), dPitch, m_Param.s_nThresholdSupress);
+				nCLValue = abs(nCL);
+				nCRValue = abs(nCR);
+
+				if (nCLValue >= m_Param.s_nThreshold && nCRValue < m_Param.s_nThreshold)	// 困率 搬窃.
+				{
+					// 哭率栏肺 Shift
+					//	pBlob->s_nDefectY += nPitch;
+					//	pBlob->s_DefectRect.top += nPitch;
+					//	pBlob->s_DefectRect.bottom += nPitch;
+					if (nCL < 0)
+						pBlob->s_DefectType = DEFTYPE_WHITE;
+					else
+						pBlob->s_DefectType = DEFTYPE_BLACK;
+					pBlob->s_DefectPair = DEFPAIR_SIDE;
+
+					m_nMoveClassify++;
+				}
+				else if (nCLValue >= m_Param.s_nThreshold && nCRValue >= m_Param.s_nThreshold)	// 困/酒贰 灌扁瞒啊 鞍栏搁 泅犁困摹狼 搬窃捞促.
+					pBlob->s_DefectPair = DEFPAIR_SIDE;
+			}
+		}		
+		else if (pBlob->s_DefectPos == DEFPOS_CENTER && pBlob->s_DefectPair == DEFPAIR_UNPAIR)
+		{
+			if (pBlob->s_DefectRect.Width() <= 1 || pBlob->s_DefectRect.Height() <= 1)
+				continue;
+
+			int nXStart = pBlob->s_DefectRect.left;
+			int nYStart = pBlob->s_DefectRect.top % m_Param.s_nFrameHeight;
+			int nWidth = pBlob->s_DefectRect.Width();
+			if (nWidth > nPitch)
+				nWidth = nPitch;
+			int nHeight = pBlob->s_DefectRect.Height();
+			int nThreshold = m_Param.s_nThreshold;// / (m_Param.s_nConvWidth * m_Param.s_nConvHeight);
+
+			nCR = GetAreaValueVert(nXStart, nYStart, nWidth, nHeight, dPitch, m_Param.s_nThresholdSupress);
+			nCL = GetAreaValueVert(nXStart, static_cast<int>(nYStart-dPitch), nWidth, nHeight, dPitch, m_Param.s_nThresholdSupress);
+			nCLValue = abs(nCL);
+			nCRValue = abs(nCR);
+			if (nCRValue <= nThreshold && nCLValue > nThreshold)			// 困率捞 搬窃捞促.
+			{
+				// 困肺 Shift
+				pBlob->s_nDefectY -= nPitch;
+				pBlob->s_DefectRect.top -= nPitch;
+				pBlob->s_DefectRect.bottom -= nPitch;
+				if (nCL < 0)
+					pBlob->s_DefectType = DEFTYPE_BLACK;
+				else
+					pBlob->s_DefectType = DEFTYPE_WHITE;
+				pBlob->s_DefectPair = DEFPAIR_LARGE;
+
+				m_nMoveClassify++;
+			}
+			else if (nCRValue > nThreshold && nCLValue <= nThreshold)		// 酒贰率捞 搬窃捞促.
+			{
+				// 酒贰率栏肺 Shift
+				pBlob->s_nDefectY += nPitch;
+				pBlob->s_DefectRect.top += nPitch;
+				pBlob->s_DefectRect.bottom += nPitch;
+				if (nCR > 0)
+					pBlob->s_DefectType = DEFTYPE_BLACK;
+				else
+					pBlob->s_DefectType = DEFTYPE_WHITE;
+				pBlob->s_DefectPair = DEFPAIR_LARGE;
+
+				m_nMoveClassify++;
+				m_nMoveClassify++;
+			}
+			else if (nCRValue > nThreshold && nCLValue > nThreshold)				// i锅 搬窃阑 瘤款促.
+				pBlob->s_DefectPair = DEFPAIR_LARGE;
+		}
+	}
+
+	for (i = m_nBlob - 1; i >= nStart; i--)
+	{
+		pBlob= m_pBlobDefect+ i;
+		if (pBlob->s_DefectPair == DEFPAIR_UNPAIR)
+			pBlob->s_bRemoved = TRUE;
+	}
+
+	// 搬窃阑 瘤款促.
+	int nRemovedIdx = 0;
+	for (i = nStart; i < m_nBlob; i++)
+	{
+		pBlob= m_pBlobDefect+ i;
+		if (!pBlob->s_bRemoved)
+		{
+			m_pBlobDefect[nStart+ nRemovedIdx] = m_pBlobDefect[i];
+			nRemovedIdx++;
+		}
+	}
+	m_nBlob = nStart+ nRemovedIdx;
+
+	return DIT_CONV_SUCCESS;
+}
+
+
+
+
+
+BOOL CBlobStorage::ClassifyVertical(int nPairedIdx, int nThreshold)
+{
+	//////////////////////////////////////////////////////////////////////
+	// Vertical 厚背
+	int nVertGab = static_cast<int>(m_Param.s_dPitchScanReal * m_Param.s_nPitchCycleScan);
+	double dVRight = (m_Param.s_dPitchScanReal * m_Param.s_nPitchCycleScan) - nVertGab;
+	double dVLeft = 1 - dVRight;
+	int nVApplyPitch = nVertGab;
+	double dLevelSrc, dLevelTemp, dLevelRef;
+	int nLevelDiff;
+
+
+	if (m_Param.s_RectConv.Height() > nVApplyPitch * 2)
+	{
+		if (m_pPairDefect[nPairedIdx].s_nDefectY + nVApplyPitch + 1 >= m_Param.s_RectConv.bottom)
+		{
+			nVApplyPitch = -nVertGab - 1;
+			double dTemp = dVRight;
+			dVLeft = dVRight;
+			dVRight = dTemp;
+		}
+
+		dLevelSrc = *(m_Param.s_lpBuffer + m_pPairDefect[nPairedIdx].s_nDefectY * m_Param.s_nFrameWidth + m_pPairDefect[nPairedIdx].s_nDefectX);
+		dLevelTemp = *(m_Param.s_lpBuffer + (m_pPairDefect[nPairedIdx].s_nDefectY + nVApplyPitch) * m_Param.s_nFrameWidth + m_pPairDefect[nPairedIdx].s_nDefectX);
+		dLevelRef = dLevelTemp * dVLeft;
+		dLevelTemp = *(m_Param.s_lpBuffer + (m_pPairDefect[nPairedIdx].s_nDefectY + nVApplyPitch + 1) * m_Param.s_nFrameWidth + m_pPairDefect[nPairedIdx].s_nDefectX);
+		dLevelRef += dLevelTemp * dVRight;
+
+		// Pixel 窜困肺 巩盼蔼阑 逞瘤 臼阑 版快 昏力.
+		if (m_pPairDefect[nPairedIdx].s_DefectType == DEFTYPE_BLACK)
+		{
+			nLevelDiff = static_cast<int>(dLevelRef - dLevelSrc);
+			if (nLevelDiff < nThreshold)
+			{
+				m_pPairDefect[nPairedIdx].s_DefectType = DEFTYPE_DELETE;
+				return FALSE;
+			}
+		}
+		else if (m_pPairDefect[nPairedIdx].s_DefectType == DEFTYPE_WHITE)
+		{
+			nLevelDiff = static_cast<int>(dLevelSrc - dLevelRef);
+			if (nLevelDiff < nThreshold)
+			{
+				m_pPairDefect[nPairedIdx].s_DefectType = DEFTYPE_DELETE;
+				return FALSE;
+			}
+		}
+		return TRUE;
+	}
+
+	// 八刘且 荐 绝栏搁 搬窃栏肺 持瘤 富扼绰 磺狐捞 酒历揪狼 富靖.
+	return FALSE;
+}
+
+
+BOOL CBlobStorage::ReadBlob(CBlobStorage *pBlobStrg)
+{
+	if(pBlobStrg == NULL) return FALSE;
+
+	CDefectBlob *pBlob;
+	int nBlob= pBlobStrg->GetBlobCount();
+	for(int iBlob= 0; iBlob < nBlob; iBlob++)
+	{
+		pBlob= pBlobStrg->GetBlobDefect(iBlob);
+
+		if(AddBlob(pBlob) == FALSE)
+			return FALSE;
+	}
+	return TRUE;
+}
+BOOL CBlobStorage::AddBlob(CDefectBlob *pBlob)
+{
+	if(m_nBlob < m_maxBlob)
+	{
+		*GetBlobDefect(m_nBlob)= *pBlob;
+		m_nBlob++;
+		return m_nBlob < m_maxBlob;
+	}
+	return FALSE;
+}
diff --git a/Common_Class/SISAssem/ConvFloat.asm b/Common_Class/SISAssem/ConvFloat.asm
new file mode 100644
index 0000000..fadff94
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloat.asm
@@ -0,0 +1,760 @@
+
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+ConvNSprShift		equ		6	; shift 2 & shift 4
+SprShift			equ		4
+ConvShift			equ		2
+SprMulti			equ		16
+ConvMulti			equ		4
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+GraySrc			equ		qword ptr[rbp+ 0b0h]
+GrayCmp			equ		qword ptr[rbp+ 0b8h]
+ZoneId			equ		qword ptr[rbp+ 0c0h]
+ZoneTh			equ		qword ptr[rbp+ 0c8h]
+
+bReverseFilter	equ		qword ptr[rbp+ 0d0h]
+DThSlide		equ		qword ptr[rbp+ 0d8h]
+endLine			equ		qword ptr[rbp+ 0e0h]
+
+
+ix			equ		rsi
+ix32		equ		esi
+iy			equ		rdi
+iy32		equ		edi
+
+
+rrBW		equ		r8
+rdBW		equ		r8d
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+
+rrImgAddr	equ		r14
+rrConAddr	equ		r15
+rdConAddr	equ		r15d
+rwConAddr	equ		r15w
+
+
+xxTemp		equ		xmm1
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus		equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12
+xxPeak2		equ		xmm13
+
+xxDSlide	equ		xmm14
+xxDStart	equ		xmm15
+
+
+ConvFloat PROC C
+	local	ImgAddr				: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ConAddr				: qword
+	local	ConAddrLine			: qword
+	local	InspLength			: qword
+	
+	local	ImgConLine			: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	ConConLine			: qword
+	local	ConLength			: qword
+	local	ConConLineEnd		: qword
+	
+	local	BlackNWhite			: qword
+	local	maxDefect			: qword
+	local	iPitch2				: qword	
+	local	pairLeft			: qword
+
+	local	pairRight			: qword
+	local	iPitchHUp			: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 078h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	mov		maxDefect	, r8
+	mov		rrNoD		, r9
+	mov		rrBW		, BuffWidth
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax		; supress
+	movdqa		xmm0, xxSupp
+	;punpcklbw	xxSupp, xmm0
+	;movdqa		xmm0, xxSupp
+	;punpcklbw	xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+	mov			rax, Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+	movdqa		xxDStart, xxThres
+	psrlw		xxDStart, ConvNSprShift
+	
+
+	movd		xxDSlide, DThSlide
+	movdqa		xmm0, xxDSlide
+	punpcklwd	xmm0, xxDSlide
+	pshufd		xxDSlide, xmm0, 0
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch16, rax
+	mov		iPitchHUp, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		iPitchHUp
+	PITCH_H_UP_PASS:
+
+
+	mov		rax, iPitch16
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+
+	mov		rax, ConAddr
+	mov		ConConLine, rax
+	mov		ConAddrLine, rax
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sal		rax, 1
+	add		rax, ConAddr
+	mov		ConConLineEnd, rax
+	
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch16
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(8 byte align)
+
+
+
+; 捞固瘤 矫累 林家 父甸扁.
+
+	mov		rax, rrBw	; rrImgAddr= rrImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgConLine, rax
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+	pxor	xmm0, xmm0
+	
+	mov		rax, ix
+	add		rax, iPitch16
+	mov		pairLeft, rax
+	
+	mov		rax, InspRight
+	sub		rax, iPitch16
+	mov		pairRight, rax
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	jmp		MAKE_CON_BUFF
+
+NEXT_LINE:	; 概 扼牢付促 林家 犁瘤沥
+	
+	jmp		PAIRING_HORI
+	PAIRING_HORI_RETURN:
+
+	inc		iy						; Loop Y
+
+	add		ImgConLine		, rrBW
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+
+MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	movdqu		xmm2, [rrImgAddr]
+	movdqa		xmm3, xmm2
+	punpcklbw	xmm2, xmm0
+	punpckhbw	xmm3, xmm0
+	
+	movdqu		xmm4, [rrImgAddr+ rrBW]
+	movdqa		xmm5, xmm4
+	punpcklbw	xmm4, xmm0
+	punpckhbw	xmm5, xmm0
+	paddw		xmm2, xmm4
+	paddw		xmm3, xmm5
+	movdqu		[rrConAddr], xmm2
+	movdqu		[rrConAddr+ 10h], xmm3
+	
+	add		rrImgAddr, 10h
+	add		rrConAddr, 20h
+	cmp		rrConAddr, ConConLineEnd
+	jle		MAKE_CON_BUFF
+
+	mov		rrConAddr, ConAddrLine
+	mov		ix, InspLeft
+;	inc		iy
+
+
+Conv_8:			; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+
+	mov		rax, iPitch2
+	add		rax, rrConAddr
+	movdqu	xxCmp, [rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 4]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+	movdqa	xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxCmp, xmm1
+
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xmm1, [rrConAddr+ 2]
+	paddw	xxSrc, xmm1
+	
+	psllw	xxSrc, SprShift		; SPR
+
+	movdqa	xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxSrc, xmm1
+	
+;	jmp		DTH_PASS
+	movdqa	xxThres, xxSrc
+	pmaxuw	xxThres, xxCmp
+	psrlw	xxThres, ConvNSprShift
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	psllw	xxThres, ConvNSprShift
+;	DTH_PASS:
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+	
+Inspect_Black:
+	mov			BlackNWhite, 0
+	mov			bx, 0
+	movdqa		xxPeak, xxMinus
+	movdqa		xxPeak2, xxMinus
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	jne		DEFECT_00
+
+Inspect_White:
+	mov			BlackNWhite, 1
+	mov			bx, 1
+	movdqa		xxPeak, xxPlus
+	movdqa		xxPeak2, xxPlus
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	jne		DEFECT_00
+
+End_8_Pixel:
+	cmp		rrNoD, maxDefect
+	jge		PAIRING_HORI
+
+	add		ix, 8					; Loop X
+	add		rrConAddr, 16			; 14= 16- 2
+	cmp		ix, InspRight
+	jl		Conv_8
+
+	cmp		iy, InspBottom
+	jl		NEXT_LINE
+
+	jmp		END_FUNC
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	sar		rax, ConvNSprShift
+	call	PixelAddF
+
+	pextrw	rax, xxSrc, 0h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	sar		rax, ConvNSprShift
+	call	PixelAddF
+
+	pextrw	rax, xxSrc, 1h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	sar		rax, ConvNSprShift
+	call	PixelAddF
+
+	pextrw	rax, xxSrc, 2h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	sar		rax, ConvNSprShift
+	call	PixelAddF
+
+	pextrw	rax, xxSrc, 3h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	sar		rax, ConvNSprShift
+	call	PixelAddF
+
+	pextrw	rax, xxSrc, 4h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	sar		rax, ConvNSprShift
+	call	PixelAddF
+
+	pextrw	rax, xxSrc, 5h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	sar		rax, ConvNSprShift
+	call	PixelAddF
+
+	pextrw	rax, xxSrc, 6h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxPeak2, 7h
+	sar		rax, ConvNSprShift
+	call	PixelAddF
+
+	pextrw	rax, xxSrc, 7h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+
+PAIRING_HORI:
+	mov		ix, -1
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, ix
+	movsxd	rcx, dword ptr [rrXoD+ 4*ix]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+	
+
+	cmp		rcx, pairRight
+	jg		PAIR_RIGHT
+
+	cmp		rcx, pairLeft
+	jge		PAIR_CENTER
+
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_LEFT_UNPAIR:
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_Position
+	cmp		rdx, rax
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_RIGHT:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_HORI_RETURN
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloat ENDP
+
+
+PixelAddF	PROC
+	mov		[rrXoD], ix32
+	mov		[rrYoD], iy32
+	mov		[rrToD], bx
+	mov		[rrPoD], ax
+
+	add		rrXoD, 4
+	add		rrYoD, 4
+	add		rrToD, 2
+	add		rrPoD, 2
+RET
+PixelAddF	ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloat2.asm b/Common_Class/SISAssem/ConvFloat2.asm
new file mode 100644
index 0000000..5ab85eb
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloat2.asm
@@ -0,0 +1,755 @@
+
+PBYTE	TYPEDEF		PTR BYTE
+PWORD	TYPEDEF		PTR	WORD
+PDWORD	TYPEDEF		PTR DWORD
+
+; ConvFloat 拌凯 窃荐(DPC, CPC, Echo, LinePair) 甸阑 窍唱狼 沏农记俊 持栏妨绊 窍绰 窃荐.
+; 2011.02.08 = Index Filtering 荐沥吝
+
+.data
+ShiftCnt	QWORD	4
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+.code
+
+
+ix			equ  rsi
+iy			equ  rdi
+ix32		equ  esi
+iy32		equ  edi
+
+rrBW		equ  r8		; Buffer Width
+rrNoD		equ  r9		; Number of Defect
+
+rrXoD		equ  r10		; Defect X
+rrYoD		equ  r11		; Defect Y
+rrToD		equ  r12		; Defect Type
+rrPoD		equ  r13		; Defect Peak
+
+rrImgAdr		equ  r14		; Image Address
+rrConAdr		equ  r15
+
+
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus	equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres	equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12
+xxPeak2	equ		xmm13
+
+
+ConvSize		equ		4
+ConvSizeBit	equ		2
+TotalSpr		equ		16
+TotalSprBit	equ		4
+ConvNSpr		equ		64
+DEFTYPE_NODEFECT	equ	3
+DEFTYPE_DELETE	equ	4
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+StartPair		equ		qword ptr[rbp+ 78h]
+MaxPair		equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+Pitch16		equ		qword ptr[rbp+ 90h]
+BuffWidth		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+pIndexBuff		equ		qword ptr[rbp+ 0b0h]
+IndexWidth		equ		qword ptr[rbp+ 0b8h]
+IndexHeight	equ		qword ptr[rbp+ 0c0h]
+iIndex			equ		qword ptr[rbp+ 0c8h]
+IndexLeft		equ		qword ptr[rbp+ 0d0h]
+IndexTop		equ		qword ptr[rbp+ 0d8h]
+
+piPitch		equ		qword ptr[rbp+ 0e0h]
+pfSpr			equ		qword ptr[rbp+ 0e8h]
+psSpr			equ		qword ptr[rbp+ 0f0h]
+
+ConvFloat2 PROC C
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ConAddr			: qword
+	local	ImgConStart		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	ImgConEnd			: qword
+	local	BlackNWhite		: qword	
+	local	maxDefect			: qword
+	local	iPitch				: qword
+	local	iPitch2			: qword
+	local	sSpr				: qword
+
+	local	iPitchHUp			: qword
+	local	InspPixel16A		: qword
+	local	InspEnd			: qword
+	
+	local	PairLeft			: qword
+	local	PairRight			: qword
+	local	xPlusPitch				: dword
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 080h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr		, rcx
+	mov		ConAddr		, rdx
+	mov		maxDefect	, r8
+	sub		maxDefect, 16
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+; Pitch 父甸扁.
+	mov		rax, Pitch16
+	mov		rcx, rax
+	sar		rax, 4
+	mov		iPitch, rax
+	and		rcx, 0fh
+	mov		sSpr, rcx
+	
+	mov		rax, iPitch
+	mov		iPitchHUp, rax
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+	cmp		sSpr, 8
+	jl		PITCH_HALF_UP_NO
+	inc		iPitchHUp
+PITCH_HALF_UP_NO:	
+
+	
+
+
+; xmm 父甸扁
+	mov			rax, Threshold
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	mov			rax, 16
+	sub			rax, sSpr
+	movd		xxfSpr, rax		; fSpr
+	movdqa		xmm0, xxfSpr
+	punpcklwd	xmm0, xxfSpr
+	pshufd		xxfSpr, xmm0, 0
+
+	movd		xxsSpr, sSpr		; sSpr
+	movdqa		xmm0, xxsSpr
+	punpcklwd	xmm0, xxsSpr
+	pshufd		xxsSpr, xmm0, 0
+
+
+	mov		rax, ConvNSpr
+	mul		Suppress
+	movd		xxSupp, rax		; supress
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	mov		InspPixel16A, rax
+
+
+	sub		rax, iPitch
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, InspLeft
+	mov		InspEnd, rax
+
+	mov		rax, InspLeft
+	add		rax, iPitch
+	mov		PairLeft, rax
+	
+	mov		rax, InspEnd
+	sub		rax, iPitch
+	mov		PairRight, rax
+
+	
+; 捞固瘤 矫累 林家 父甸扁.
+
+	mov		rax, rrBW	; rrImgAdr= rrImgAdr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgConStart, rax
+
+	add		rax, InspPixel16A
+	mov		ImgConEnd, rax
+
+; 檬扁拳	
+	mov		rrConAdr, ConAddr	
+	mov		rrImgAdr, ImgConStart
+	pxor	xmm0, xmm0
+	
+	mov		iy, InspTop
+	
+	jmp		LOOP_MAKE_CON_BUFF
+
+NEXT_LINE:	; 概 扼牢付促 林家 犁瘤沥
+	
+	mov		rax		, ImgConStart
+	add		rax		, rrBW
+	mov		ImgConStart	, rax
+	mov		rrImgAdr, rax
+	
+	add		rax, InspPixel16A
+	mov		ImgConEnd, rax
+
+	mov		rrConAdr, ConAddr
+
+LOOP_MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	movdqu		xmm2, [rrImgAdr]
+	movdqa		xmm3, xmm2
+	punpcklbw	xmm2, xmm0
+	punpckhbw	xmm3, xmm0
+	
+	movdqu		xmm4, [rrImgAdr+ rrBW]
+	movdqa		xmm5, xmm4
+	punpcklbw	xmm4, xmm0
+	punpckhbw	xmm5, xmm0
+	paddw		xmm2, xmm4
+	paddw		xmm3, xmm5
+	movdqu		[rrConAdr], xmm2
+	movdqu		[rrConAdr+ 10h], xmm3
+	
+	add		rrImgAdr, 10h
+	add		rrConAdr, 20h
+	cmp		rrImgAdr, ImgConEnd
+	jl		LOOP_MAKE_CON_BUFF
+
+	mov		rrConAdr, ConAddr
+	mov		ix, InspLeft
+	inc		iy
+
+
+
+Conv_8:			; 八荤 风凭 (16俺 窜困啊 酒聪扼 8俺 窜困肺 楷魂 啊瓷)
+
+	cmp		piPitch, 0
+	je		FLAG_DPC_NO
+	
+	mov		rax, ix			; Pitch Buffer Index 备窍扁.
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, rax
+	mov		rcx, rax
+	
+	mov		rax, pfSPR			; Load SPR
+	add		rax, rcx
+	movdqu	xxfSPR, [rax]
+	
+	mov		rax, psSPR
+	add		rax, rcx
+	movdqu	xxsSPR, [rax]
+
+	mov		rax, piPitch
+	add		rax, rcx
+	movsx	rax, word ptr[rax]				; Compare Buffer (piPitch*pfSPR + piPitchNext*psSPR) - Suppress - Unpack - *SPR
+
+	add		rax, rax
+	jmp		FLAG_DPC_END
+	
+FLAG_DPC_NO:
+	mov		rax, iPitch2
+FLAG_DPC_END:
+	
+
+	add		rax, rrConAdr
+	movdqu	xxCmp, [rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rax+ 2]
+	psllw	xmm1, ShiftCnt
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 4]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+	movdqa		xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxCmp, xmm1
+
+
+	movdqu	xxSrc, [rrConAdr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xmm1, [rrConAdr+ 2]
+	paddw	xxSrc, xmm1
+	
+	psllw	xxSrc, ShiftCnt		; SPR
+
+	movdqa		xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxSrc, xmm1
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+
+Inspect_Black:
+	mov		BlackNWhite, 0
+	mov		bx, 0
+	movdqa	xxPeak, xxMinus
+	movdqa	xxPeak2, xxMinus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+Inspect_White:
+	mov		BlackNWhite, 1
+	mov		bx, 1
+	movdqa	xxPeak, xxPlus
+	movdqa	xxPeak2, xxPlus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+End_8_Pixel:
+	cmp		rrNoD, maxDefect
+	jge		END_FUNC
+
+	add		ix, 8					; Loop X
+	add		rrConAdr, 16			; 14= 16- 2
+	cmp		ix, InspEnd
+	jl		Conv_8
+
+	jmp		PAIRING
+PAIRING_END:
+
+	cmp		iy, InspBottom
+	jge		END_FUNC
+
+	jmp		NEXT_LINE
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxPeak2, 7h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+	cmp		pIndexBuff, 0
+	je		INDEX_FILTERING_NO
+
+INDEX_FILTERING:
+	mov		ix, -1
+	mov		rax, pIndexBuff
+	mov		rbx, iIndex
+
+LOOP_INDEX_FILTERING:
+	cmp		ix, rrNoD
+	jge		LOOP_INDEX_FILTERING_END
+
+	movsxd	rcx, dword ptr [rrXoD+ 4*ix]
+	cmp		bl, byte ptr [rax+ rcx]
+	jne		FILTERING_NO
+	mov		word ptr [rrToD+ 2*ix], 4
+	
+FILTERING_NO:
+
+	inc		ix
+	jmp		LOOP_INDEX_FILTERING
+LOOP_INDEX_FILTERING_END:
+	mov		rax, IndexWidth
+	add		pIndexBuff, rax
+
+INDEX_FILTERING_NO:
+
+
+PAIRING:
+	mov		ix, -1
+LOOP_PAIR_NUN:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, StartPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], DEFTYPE_DELETE			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUN
+	
+	mov		rbx, ix
+	movsxd	rax, dword ptr [rrXoD+ 4*ix]
+	mov		rcx, rax
+	add		rax, iPitchHUp
+	mov		xPlusPitch, eax
+	
+	cmp		rcx, PairLeft
+	jl		PAIR_LEFT
+	
+	cmp		rcx, PairRight
+	jl		PAIR_CENTER
+
+
+PAIR_RIGHT:
+
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_RIGHT_UNPAIR
+	
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	
+	cmp		edx, 3
+	jge		PAIR_RIGHT
+
+	mov		ecx, [rrXoD+ 4*rbx]
+	
+	movsx	eax, word ptr[rrToD+ 2*ix]
+	cmp		eax, edx
+	je		PAIR_RIGHT
+
+	mov		eax, xPlusPitch
+	sub		eax, ecx
+	cmp		eax, 1
+	jg		PAIR_RIGHT
+	cmp		eax, -1
+	jl		PAIR_RIGHT_UNPAIR
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		StartPair
+	jmp		LOOP_PAIR_NUN
+	
+PAIR_RIGHT_UNPAIR:
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		edx, xPlusPitch
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	
+	cmp		edx, 0
+	je		CHANGE_TYPE_0
+	mov		edx, 0
+	jmp		CHANGE_TYPE_end
+CHANGE_TYPE_0:
+	mov		edx, 1
+CHANGE_TYPE_end:
+
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak,  edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		StartPair
+	jmp		LOOP_PAIR_NUN
+
+
+PAIR_LEFT:
+
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+	
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	
+	cmp		edx, 3
+	jge		PAIR_LEFT
+
+	mov		ecx, [rrXoD+ 4*rbx]
+	
+	movsx	eax, word ptr[rrToD+ 2*ix]
+	cmp		eax, edx
+	je		PAIR_LEFT
+
+	mov		eax, xPlusPitch
+	sub		eax, ecx
+	cmp		eax, 1
+	jg		PAIR_LEFT
+	cmp		eax, -1
+	jl		PAIR_LEFT_UNPAIR
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		StartPair
+	jmp		LOOP_PAIR_NUN
+	
+PAIR_LEFT_UNPAIR:
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	movsxd		rdx, xPlusPitch
+	sub		rdx, iPitchHUp
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	movsx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak,  edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		StartPair
+	jmp		LOOP_PAIR_NUN
+
+PAIR_CENTER:
+
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUN
+	
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	
+	cmp		edx, 3
+	jge		PAIR_CENTER
+
+	mov		ecx, [rrXoD+ 4*rbx]
+	
+	movsx	eax, word ptr[rrToD+ 2*ix]
+	cmp		eax, edx
+	je		PAIR_CENTER
+
+	mov		eax, xPlusPitch
+	sub		eax, ecx
+	cmp		eax, 1
+	jg		PAIR_CENTER
+	cmp		eax, -1
+	jl		LOOP_PAIR_NUN
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		StartPair
+	jmp		LOOP_PAIR_NUN
+	
+LOOP_PAIR_X_END:
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_END
+
+
+
+END_FUNC:
+
+;	mov		rax, rrNoD
+	mov		rax, StartPair
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+ConvFloat2 ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloat6.asm b/Common_Class/SISAssem/ConvFloat6.asm
new file mode 100644
index 0000000..c479cd7
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloat6.asm
@@ -0,0 +1,808 @@
+
+; 夯贰 2*2 楷魂俊辑
+; 2*3 楷魂夸没栏肺 力累
+; 2011.11.00
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprMulti			equ		16
+SprShift			equ		4
+ConvMulti			equ		6
+ConvNSprMulti		equ		96
+
+DReverseShift equ 7		; 1/6捞 酒聪扼 1/8 甫 利侩茄促.  1/16 * 1/8 => 4 + 3 = >>7
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+GraySrc			equ		qword ptr[rbp+ 0b0h]
+GrayCmp			equ		qword ptr[rbp+ 0b8h]
+ZoneId			equ		qword ptr[rbp+ 0c0h]
+ZoneTh			equ		qword ptr[rbp+ 0c8h]
+
+bReverseFilter	equ		qword ptr[rbp+ 0d0h]
+DThSlide		equ		qword ptr[rbp+ 0d8h]
+endLine			equ		qword ptr[rbp+ 0e0h]
+
+
+ix			equ		rsi
+ix32		equ		esi
+iy			equ		rdi
+iy32		equ		edi
+
+
+rrBW		equ		r8
+rdBW		equ		r8d
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+
+rrImgAddr	equ		r14
+rrConAddr	equ		r15
+rdConAddr	equ		r15d
+rwConAddr	equ		r15w
+rrPair			equ		rrImgAddr
+
+
+xxTemp		equ		xmm1
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus		equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12
+xxPeak2		equ		xmm13
+
+xxDSlide	equ		xmm14
+xxDStart	equ		xmm15
+
+xxDConvMulti	equ		xmm3
+
+
+
+ConvFloat6 PROC C
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ConAddr			: qword
+	local	ConAddrLine		: qword
+	local	InspLength			: qword
+	
+	local	ImgConLine			: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	ConConLine			: qword
+	local	ConLength			: qword
+	local	ConConLineEnd		: qword
+	
+	local	BlackNWhite		: qword
+	local	maxDefect			: qword
+	local	iPitch2				: qword	
+	local	pairLeft			: qword
+
+	local	pairRight			: qword
+	local	iPitchHUp			: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 078h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	mov		maxDefect	, r8
+	mov		rrNoD		, r9
+	mov		rrBW		, BuffWidth
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress		; supress
+	mov			rcx, ConvNSprMulti
+	mul			rcx
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+	mov			rax, Threshold			; Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	mov			rax, Threshold
+	mov			rcx, ConvMulti
+	cdq
+	div			ecx
+	movd		xxDStart, rax
+	movdqa		xxTemp, xxDStart
+	punpcklwd	xxTemp, xxDStart
+	pshufd		xxDStart, xxTemp, 0
+	
+	mov			rax, 6
+	movd		xxDConvMulti, rax
+	movdqa		xxTemp, xxDConvMulti
+	punpcklwd	xxTemp, xxDConvMulti
+	pshufd		xxDConvMulti, xxTemp, 0
+
+	movd		xxDSlide, DThSlide
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch16, rax
+	mov		iPitchHUp, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		iPitchHUp
+	PITCH_H_UP_PASS:
+
+
+	mov		rax, iPitch16
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+
+	mov		rax, ConAddr
+	mov		ConConLine, rax
+	mov		ConAddrLine, rax
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sal		rax, 1
+	add		rax, ConAddr
+	mov		ConConLineEnd, rax
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch16
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(8 byte align)
+
+
+; 捞固瘤 矫累 林家 父甸扁.
+
+	mov		rax, rrBw	; rrImgAddr= rrImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgConLine, rax
+
+	mov		rrConAddr, ConConLine	
+	mov		rrImgAddr, ImgConLine
+	pxor	xmm0, xmm0
+
+	mov		rax, ix
+	add		rax, iPitch16
+	mov		pairLeft, rax
+	
+	mov		rax, InspRight
+	sub		rax, iPitch16
+	mov		pairRight, rax
+
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	jmp		MAKE_CON_BUFF
+
+NEXT_LINE:	; 概 扼牢付促 林家 犁瘤沥
+	
+	jmp		PAIRING_HORI
+	PAIRING_HORI_RETURN:
+	
+	inc		iy						; Loop Y
+
+	add		ImgConLine		, rrBW
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+
+MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxCmp, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxCmp, xmm0
+	
+	movdqu		xxPlus, [rrImgAddr+ rrBW]
+	movdqa		xxMinus, xxPlus
+	punpcklbw	xxPlus, xmm0
+	punpckhbw	xxMinus, xmm0
+	paddw		xxSrc, xxPlus
+	paddw		xxCmp, xxMinus
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxCmp
+	
+
+	
+	add		rrImgAddr, 10h
+	add		rrConAddr, 20h
+	cmp		rrConAddr, ConConLineEnd
+	jle		MAKE_CON_BUFF
+
+	mov		rrConAddr, ConAddrLine
+	mov		ix, InspLeft
+;	inc		iy
+
+
+Conv_8:			; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+
+	mov		rax, iPitch2
+	add		rax, rrConAddr
+	movdqu	xxCmp, [rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 4]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 6]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+	movdqa	xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxCmp, xmm1
+
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xxTemp, [rrConAddr+ 2]
+	paddw	xxSrc, xxTemp
+	movdqu	xxTemp, [rrConAddr+ 4]
+	paddw	xxSrc, xxTemp
+	
+	psllw	xxSrc, SprShift		; SPR
+
+	movdqa	xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxSrc, xmm1
+
+;jmp	PASS_DTH
+	movdqa	xxThres, xxSrc
+	psrlw	xxThres, DReverseShift	; 1/6捞 酒聪扼 1/8 甫 利侩茄促.  1/16 * 1/8 => 4 + 3 = >>7
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	pmullw	xxThres, xxDConvMulti
+	psllw	xxThres, SprShift
+	
+	PASS_DTH:
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+
+Inspect_Black:
+	mov		BlackNWhite, 0
+	mov		bx, 0
+	movdqa	xxPeak, xxMinus
+	movdqa	xxPeak2, xxMinus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+Inspect_White:
+	mov		BlackNWhite, 1
+	mov		bx, 1
+	movdqa	xxPeak, xxPlus
+	movdqa	xxPeak2, xxPlus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+End_8_Pixel:
+	cmp		rrNoD, maxDefect
+	jge		PAIRING_HORI
+
+	add		ix, 8					; Loop X
+	add		rrConAddr, 16			; 14= 16- 2
+	cmp		ix, InspRight
+	jl		Conv_8
+
+	cmp		iy, InspBottom
+	jl		NEXT_LINE
+
+	jmp		END_FUNC
+
+DEFECT_00:
+	mov		rcx, ConvNSprMulti
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	cdq
+	div		rcx
+	call	PixelAddF6
+
+	pextrw	rax, xxSrc, 0h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	cdq
+	div		rcx
+	call	PixelAddF6
+
+	pextrw	rax, xxSrc, 1h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	cdq
+	div		rcx
+	call	PixelAddF6
+
+	pextrw	rax, xxSrc, 2h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	cdq
+	div		rcx
+	call	PixelAddF6
+
+	pextrw	rax, xxSrc, 3h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	cdq
+	div		rcx
+	call	PixelAddF6
+
+	pextrw	rax, xxSrc, 4h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	cdq
+	div		rcx
+	call	PixelAddF6
+
+	pextrw	rax, xxSrc, 5h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	cdq
+	div		rcx
+	call	PixelAddF6
+
+	pextrw	rax, xxSrc, 6h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxPeak2, 7h
+	cdq
+	div		rcx
+	call	PixelAddF6
+
+	pextrw	rax, xxSrc, 7h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+
+PAIRING_HORI:
+	mov		ix, -1
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, ix
+	movsxd	rax, dword ptr [rrXoD+ 4*ix]
+	mov		rcx, rax
+	add		rcx, iPitchHUp
+	
+
+	cmp		rax, pairRight
+	jg		PAIR_RIGHT
+
+	cmp		rax, pairLeft
+	jge		PAIR_CENTER
+
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rcx			; cmp	rdx, yPlusPitch
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rcx, PairAddr
+	
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 1
+	mov		(astPair ptr [rcx]).x, edx
+	mov		(astPair ptr [rcx]).y, iy32
+	mov		(astPair ptr [rcx]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_LEFT_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_Position
+	cmp		rdx, rcx
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rcx, PairAddr
+	
+	mov		(astPair ptr [rcx]).pos, 2
+	mov		(astPair ptr [rcx]).pair, 1
+	mov		(astPair ptr [rcx]).x, edx
+	mov		(astPair ptr [rcx]).y, iy32
+	mov		(astPair ptr [rcx]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_RIGHT:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	add		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+	
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+	
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_HORI_RETURN
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloat6 ENDP
+
+
+PixelAddF6	PROC
+	mov		[rrXoD], ix32
+	mov		[rrYoD], iy32
+	mov		[rrToD], bx
+	mov		[rrPoD], ax
+
+	add		rrXoD, 4
+	add		rrYoD, 4
+	add		rrToD, 2
+	add		rrPoD, 2
+RET
+PixelAddF6	ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloat9.asm b/Common_Class/SISAssem/ConvFloat9.asm
new file mode 100644
index 0000000..0eec688
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloat9.asm
@@ -0,0 +1,819 @@
+
+; 夯贰 2*2 楷魂俊辑
+; 3*3 楷魂夸没栏肺 力累
+; 2012.06.12 ~ 
+; GrayDown : 八荤俊 荤侩登绰 灌扁绰 conv size俊 惑包绝捞 8bit 蔼栏肺 down 矫难 拌魂茄促.
+; 措脚 Dynamic Threshold肺 茄促.
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift			equ		4
+SprMulti			equ		16
+SprHalf				equ		8
+ConvMulti			equ		9
+ConvNSprMulti		equ		144
+
+DReverseShift equ 7		; DTH 拌魂且 锭 1/9措脚 1/8阑 利侩茄促. 1/16+ 1/8 => 4 + 3 =>  >>7
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+GraySrc			equ		qword ptr[rbp+ 0b0h]
+GrayCmp			equ		qword ptr[rbp+ 0b8h]
+ZoneId			equ		qword ptr[rbp+ 0c0h]
+ZoneTh			equ		qword ptr[rbp+ 0c8h]
+
+bReverseFilter	equ		qword ptr[rbp+ 0d0h]
+DThSlide		equ		qword ptr[rbp+ 0d8h]
+endLine			equ		qword ptr[rbp+ 0e0h]
+
+
+ix			equ		rsi
+ix32		equ		esi
+iy			equ		rdi
+iy32		equ		edi
+
+
+rrBW		equ		r8
+rdBW		equ		r8d
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+
+rrImgAddr	equ		r14
+rrConAddr	equ		r15
+rdConAddr	equ		r15d
+rwConAddr	equ		r15w
+rrPair		equ		rrImgAddr
+
+
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus		equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12	; greater flag俊 荤侩且 蔼
+xxPeak2		equ		xmm13	; 角力 peak 蔼
+
+xxDSlide	equ		xmm14
+xxDStart	equ		xmm15
+
+xxDConvMulti	equ		xmm3
+
+
+
+ConvFloat9 PROC C
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ConAddr			: qword
+	local	ConAddrLine		: qword
+	local	InspLength			: qword
+	
+	local	ImgConLine			: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	ConConLine			: qword
+	local	ConLength			: qword
+	local	ConConLineEnd		: qword
+	
+	local	BlackNWhite		: qword
+	local	maxDefect			: qword
+	local	iPitch2				: qword	
+	local	pairLeft			: qword
+
+	local	pairRight			: qword
+	local	iPitchHUp			: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 078h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	mov		maxDefect	, r8
+	mov		rrNoD		, r9
+	mov		rrBW		, BuffWidth
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress		; supress
+	mov			rcx, ConvNSprMulti
+	mul			rcx
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+	mov			rax, Threshold			; Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	mov			rax, Threshold
+	mov			rcx, ConvMulti
+	cdq
+	div			ecx
+	movd		xxDStart, rax
+	movdqa		xxTemp, xxDStart
+	punpcklwd	xxTemp, xxDStart
+	pshufd		xxDStart, xxTemp, 0
+	
+	mov			rax, ConvMulti
+	movd		xxDConvMulti, rax
+	movdqa		xxTemp, xxDConvMulti
+	punpcklwd	xxTemp, xxDConvMulti
+	pshufd		xxDConvMulti, xxTemp, 0
+
+	movd		xxDSlide, DThSlide
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch16, rax
+	mov		iPitchHUp, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		iPitchHUp
+	PITCH_H_UP_PASS:
+
+
+	mov		rax, iPitch16
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+
+	mov		rax, ConAddr
+	mov		ConConLine, rax
+	mov		ConAddrLine, rax
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sal		rax, 1
+	add		rax, ConAddr
+	mov		ConConLineEnd, rax
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch16
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(8 byte align)
+
+
+; 捞固瘤 矫累 林家 父甸扁.
+
+	mov		rax, rrBw	; rrImgAddr= rrImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgConLine, rax
+
+	mov		rrConAddr, ConConLine	
+	mov		rrImgAddr, ImgConLine
+	pxor	xmm0, xmm0
+
+	mov		rax, ix
+	add		rax, iPitch16
+	mov		pairLeft, rax
+	
+	mov		rax, InspRight
+	sub		rax, iPitch16
+	mov		pairRight, rax
+
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	jmp		MAKE_CON_BUFF
+
+NEXT_LINE:	; 概 扼牢付促 林家 犁瘤沥
+	
+	jmp		PAIRING_HORI
+	PAIRING_HORI_RETURN:
+	
+	inc		iy						; Loop Y
+
+	add		ImgConLine		, rrBW
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+
+MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxCmp, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxCmp, xmm0
+	
+	movdqu		xxPlus, [rrImgAddr+ rrBW]
+	movdqa		xxMinus, xxPlus
+	punpcklbw	xxPlus, xmm0
+	punpckhbw	xxMinus, xmm0
+	paddw		xxSrc, xxPlus
+	paddw		xxCmp, xxMinus
+	
+	movdqu		xxPlus, [rrImgAddr+ rrBW*2 ]
+	movdqa		xxMinus, xxPlus
+	punpcklbw	xxPlus, xmm0
+	punpckhbw	xxMinus, xmm0
+	paddw		xxSrc, xxPlus
+	paddw		xxCmp, xxMinus
+	
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxCmp
+	
+
+	
+	add		rrImgAddr, 10h
+	add		rrConAddr, 20h
+	cmp		rrConAddr, ConConLineEnd
+	jle		MAKE_CON_BUFF
+
+	mov		rrConAddr, ConAddrLine
+	mov		ix, InspLeft
+;	inc		iy
+
+
+Conv_8:			; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+	mov		rax, iPitch2
+	add		rax, rrConAddr
+	movdqu	xxCmp, [rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 4]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 6]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+	movdqa	xmm1, xxCmp				; suppress (Conv*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxCmp, xmm1
+
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xxTemp, [rrConAddr+ 2]
+	paddw	xxSrc, xxTemp
+	movdqu	xxTemp, [rrConAddr+ 4]
+	paddw	xxSrc, xxTemp
+	
+	psllw	xxSrc, SprShift		; SPR
+
+	movdqa	xmm1, xxSrc				; suppress (Conv*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxSrc, xmm1
+
+;jmp	PASS_DTH
+	movdqa	xxThres, xxSrc
+	psrlw	xxThres, DReverseShift	; 扁匡扁 利侩矫 1/6捞 酒聪扼 6/36捞瘤父 6/32 甫 利侩茄促. >>7
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	pmullw	xxThres, xxDConvMulti
+	psllw	xxThres, SprShift
+	
+	PASS_DTH:
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+
+Inspect_Black:
+	mov		BlackNWhite, 0
+	mov		bx, 0
+	movdqa	xxPeak, xxMinus
+	movdqa	xxPeak2, xxMinus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+Inspect_White:
+	mov		BlackNWhite, 1
+	mov		bx, 1
+	movdqa	xxPeak, xxPlus
+	movdqa	xxPeak2, xxPlus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+End_8_Pixel:
+	cmp		rrNoD, maxDefect
+	jge		PAIRING_HORI
+
+	add		ix, 8					; Loop X
+	add		rrConAddr, 16			; 14= 16- 2
+	cmp		ix, InspRight
+	jl		Conv_8
+
+	cmp		iy, InspBottom
+	jl		NEXT_LINE
+
+	jmp		END_FUNC
+
+DEFECT_00:
+	mov		rcx, ConvNSprMulti
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	cdq
+	div		rcx
+	call	PixelAddF33
+
+	pextrw	rax, xxSrc, 0h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	cdq
+	div		rcx
+	call	PixelAddF33
+
+	pextrw	rax, xxSrc, 1h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	cdq
+	div		rcx
+	call	PixelAddF33
+
+	pextrw	rax, xxSrc, 2h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	cdq
+	div		rcx
+	call	PixelAddF33
+
+	pextrw	rax, xxSrc, 3h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	cdq
+	div		rcx
+	call	PixelAddF33
+
+	pextrw	rax, xxSrc, 4h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	cdq
+	div		rcx
+	call	PixelAddF33
+
+	pextrw	rax, xxSrc, 5h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	cdq
+	div		rcx
+	call	PixelAddF33
+
+	pextrw	rax, xxSrc, 6h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxPeak2, 7h
+	cdq
+	div		rcx
+	call	PixelAddF33
+
+	pextrw	rax, xxSrc, 7h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+
+PAIRING_HORI:
+	mov		ix, -1
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, ix
+	movsxd	rax, dword ptr [rrXoD+ 4*ix]
+	mov		rcx, rax
+	add		rcx, iPitchHUp
+	
+
+	cmp		rax, pairRight
+	jg		PAIR_RIGHT
+
+	cmp		rax, pairLeft
+	jge		PAIR_CENTER
+
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rcx			; cmp	rdx, yPlusPitch
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rcx, PairAddr
+	
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 1
+	mov		(astPair ptr [rcx]).x, edx
+	mov		(astPair ptr [rcx]).y, iy32
+	mov		(astPair ptr [rcx]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_LEFT_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_Position
+	cmp		rdx, rcx
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rcx, PairAddr
+	
+	mov		(astPair ptr [rcx]).pos, 2
+	mov		(astPair ptr [rcx]).pair, 1
+	mov		(astPair ptr [rcx]).x, edx
+	mov		(astPair ptr [rcx]).y, iy32
+	mov		(astPair ptr [rcx]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_RIGHT:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	add		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+	
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+	
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_HORI_RETURN
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloat9 ENDP
+
+
+PixelAddF33	PROC
+	mov		[rrXoD], ix32
+	mov		[rrYoD], iy32
+	mov		[rrToD], bx
+	mov		[rrPoD], ax
+
+	add		rrXoD, 4
+	add		rrYoD, 4
+	add		rrToD, 2
+	add		rrPoD, 2
+RET
+PixelAddF33	ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatDPC.asm b/Common_Class/SISAssem/ConvFloatDPC.asm
new file mode 100644
index 0000000..331287d
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatDPC.asm
@@ -0,0 +1,789 @@
+
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+ConvNSprShift		equ		6	; shift 2 & shift 4
+SprShift			equ		4
+ConvShift			equ		2
+SprMulti			equ		16
+ConvMulti			equ		4
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair		equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+bRFilter		equ		qword ptr[rbp+ 0b0h]
+pPitch			equ		qword ptr[rbp+ 0b8h]
+pfSpr			equ		qword ptr[rbp+ 0c0h]
+psSpr			equ		qword ptr[rbp+ 0c8h]
+
+GraySrc			equ		qword ptr[rbp+ 0d0h]
+GrayCmp			equ		qword ptr[rbp+ 0d8h]
+ZoneId			equ		qword ptr[rbp+ 0e0h]
+ZoneTh			equ		qword ptr[rbp+ 0e8h]
+
+DThSlide		equ		qword ptr[rbp+ 0f0h]
+endLine			equ		qword ptr[rbp+ 0f8h]
+
+
+ix			equ		rsi
+ix32		equ		esi
+iy			equ		rdi
+iy32		equ		edi
+
+
+rrBW		equ		r8
+rdBW		equ		r8d
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+
+rrImgAddr	equ		r14
+rrConAddr	equ		r15
+rdConAddr	equ		r15d
+rwConAddr	equ		r15w
+
+
+xxTemp		equ		xmm1
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus		equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12
+xxPeak2		equ		xmm13
+
+xxDSlide	equ		xmm14
+xxDStart	equ		xmm15
+
+
+ConvFloatDPC PROC C
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ConAddr			: qword
+	local	ConAddrLine		: qword
+	local	InspLength			: qword
+	
+	local	ImgConLine			: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	ConConLine			: qword
+	local	ConLength			: qword
+	local	ConConLineEnd		: qword
+	
+	local	BlackNWhite		: qword
+	local	maxDefect			: qword
+	local	iPitch2				: qword	
+	local	pairLeft			: qword
+
+	local	pairRight			: qword
+	local	iPitchHUp			: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 078h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	mov		maxDefect	, r8
+	mov		rrNoD		, r9
+	mov		rrBW		, BuffWidth
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax		; supress
+	movdqa		xmm0, xxSupp
+	;punpcklbw	xxSupp, xmm0
+	;movdqa		xmm0, xxSupp
+	;punpcklbw	xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+	mov			rax, Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+	movdqa		xxDStart, xxThres
+	psrlw		xxDStart, ConvNSprShift
+	
+
+	movd		xxDSlide, DThSlide
+	movdqa		xmm0, xxDSlide
+	punpcklwd	xmm0, xxDSlide
+	pshufd		xxDSlide, xmm0, 0
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch16, rax
+	mov		iPitchHUp, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		iPitchHUp
+	PITCH_H_UP_PASS:
+
+
+	mov		rax, iPitch16
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+
+	mov		rax, ConAddr
+	mov		ConConLine, rax
+	mov		ConAddrLine, rax
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sal		rax, 1
+	add		rax, ConAddr
+	mov		ConConLineEnd, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch16
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(8 byte align)
+
+
+	
+; 捞固瘤 矫累 林家 父甸扁.
+
+	mov		rax, rrBw	; rrImgAddr= rrImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgConLine, rax
+
+	mov		rrConAddr, ConConLine	
+	mov		rrImgAddr, ImgConLine
+	pxor	xmm0, xmm0
+	
+	mov		rax, ix
+	add		rax, iPitch16
+	mov		pairLeft, rax
+	
+	mov		rax, InspRight
+	sub		rax, iPitch16
+	mov		pairRight, rax
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	jmp		MAKE_CON_BUFF
+
+NEXT_LINE:	; 概 扼牢付促 林家 犁瘤沥
+	
+	jmp		PAIRING_HORI
+	PAIRING_HORI_RETURN:
+
+	inc		iy						; Loop Y
+
+	add		ImgConLine		, rrBW
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+
+MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	movdqu		xmm2, [rrImgAddr]
+	movdqa		xmm3, xmm2
+	punpcklbw	xmm2, xmm0
+	punpckhbw	xmm3, xmm0
+	
+	movdqu		xmm4, [rrImgAddr+ rrBW]
+	movdqa		xmm5, xmm4
+	punpcklbw	xmm4, xmm0
+	punpckhbw	xmm5, xmm0
+	paddw		xmm2, xmm4
+	paddw		xmm3, xmm5
+	movdqu		[rrConAddr], xmm2
+	movdqu		[rrConAddr+ 10h], xmm3
+	
+	add		rrImgAddr, 10h
+	add		rrConAddr, 20h
+	cmp		rrConAddr, ConConLineEnd
+	jle		MAKE_CON_BUFF
+
+	mov		rrConAddr, ConAddrLine
+	mov		ix, InspLeft
+;	inc		iy
+
+
+Conv_8:			; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+MAKE_DPC:
+	mov		rax, ix
+	sar		rax, 4
+	sal		rax, 5
+	;mov		ix2, rax
+	
+	mov		rcx, pPitch
+	add		rcx, rax
+	movsx	rdx, word ptr[rcx]
+	sal		rdx, 1
+	mov		iPitch2, rdx
+	
+	mov		rcx, pfSpr
+	add		rcx, rax
+	movdqu	xxfSpr, [rcx]
+	
+	mov		rcx, psSpr
+	add		rcx, rax
+	movdqu	xxsSpr, [rcx]
+
+	mov		rax, iPitch2
+	add		rax, rrConAddr
+	movdqu	xxCmp, [rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 4]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+	movdqa	xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxCmp, xmm1
+
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xmm1, [rrConAddr+ 2]
+	paddw	xxSrc, xmm1
+	
+	psllw	xxSrc, SprShift		; SPR
+
+	movdqa	xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxSrc, xmm1
+	
+;	jmp		DTH_PASS
+	movdqa	xxThres, xxSrc
+	pmaxuw	xxThres, xxCmp
+	psrlw	xxThres, ConvNSprShift
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	psllw	xxThres, ConvNSprShift
+;	DTH_PASS:
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+
+Inspect_Black:
+	mov		BlackNWhite, 0
+	mov		bx, 0
+	movdqa	xxPeak, xxMinus
+	movdqa	xxPeak2, xxMinus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+Inspect_White:
+	mov		BlackNWhite, 1
+	mov		bx, 1
+	movdqa	xxPeak, xxPlus
+	movdqa	xxPeak2, xxPlus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+End_8_Pixel:
+	cmp		rrNoD, maxDefect
+	jge		PAIRING_HORI
+
+	add		ix, 8					; Loop X
+	add		rrConAddr, 16			; 14= 16- 2
+	cmp		ix, InspRight
+	jl		Conv_8
+
+	cmp		iy, InspBottom
+	jl		NEXT_LINE
+
+	jmp		END_FUNC
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxPeak2, 7h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+
+PAIRING_HORI:
+	mov		ix, -1
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, ix
+	movsxd	rcx, dword ptr [rrXoD+ 4*ix]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+	
+
+	cmp		rcx, pairRight
+	jg		PAIR_RIGHT
+
+	cmp		rcx, pairLeft
+	jge		PAIR_CENTER
+
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_LEFT_UNPAIR:
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_Position
+	cmp		rdx, rax
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_RIGHT:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+	
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_HORI_RETURN
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloatDPC ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatDPC6.asm b/Common_Class/SISAssem/ConvFloatDPC6.asm
new file mode 100644
index 0000000..c93050a
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatDPC6.asm
@@ -0,0 +1,842 @@
+
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprMulti			equ		16
+SprShift			equ		4
+ConvMulti			equ		6
+ConvNSprMulti		equ		96
+
+DReverseShift equ 7		; 1/9捞 措脚 1/8 甫 利侩茄促.  1/16 * 1/8 => 4 + 3 = >>7
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+bRFilter		equ		qword ptr[rbp+ 0b0h]
+pPitch			equ		qword ptr[rbp+ 0b8h]
+pfSpr			equ		qword ptr[rbp+ 0c0h]
+psSpr			equ		qword ptr[rbp+ 0c8h]
+
+GraySrc			equ		qword ptr[rbp+ 0d0h]
+GrayCmp			equ		qword ptr[rbp+ 0d8h]
+ZoneId			equ		qword ptr[rbp+ 0e0h]
+ZoneTh			equ		qword ptr[rbp+ 0e8h]
+
+DThSlide		equ		qword ptr[rbp+ 0f0h]
+endLine			equ		qword ptr[rbp+ 0f8h]
+
+ix			equ		rsi
+ix32		equ		esi
+iy			equ		rdi
+iy32		equ		edi
+
+
+rrBW		equ		r8
+rdBW		equ		r8d
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+
+rrImgAddr	equ		r14
+rrConAddr	equ		r15
+rdConAddr	equ		r15d
+rwConAddr	equ		r15w
+
+
+xxTemp		equ		xmm1
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus		equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12
+xxPeak2		equ		xmm13
+
+xxDSlide	equ		xmm14
+xxDStart	equ		xmm15
+
+xxDConvMulti	equ		xmm3
+
+ConvFloatDPC6 PROC C
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ConAddr			: qword
+	local	ConAddrLine		: qword
+	local	InspLength			: qword
+	
+	local	ImgConLine			: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	ConConLine			: qword
+	local	ConLength			: qword
+	local	ConConLineEnd		: qword
+	
+	local	BlackNWhite			: qword
+	local	maxDefect			: qword
+	local	iPitch2				: qword	
+	local	pairLeft			: qword
+
+	local	pairRight			: qword
+	local	iPitchHUp			: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 078h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	mov		maxDefect	, r8
+	mov		rrNoD		, r9
+	mov		rrBW		, BuffWidth
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress
+	mov			rcx, ConvNSprMulti
+	mul			rcx
+	movd		xxSupp, rax		; supress
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+	mov			rax, Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	mov			rax, Threshold
+	mov			rcx, ConvMulti
+	cdq
+	div			ecx
+	movd		xxDStart, rax
+	movdqa		xxTemp, xxDStart
+	punpcklwd	xxTemp, xxDStart
+	pshufd		xxDStart, xxTemp, 0
+	
+	mov			rax, 6
+	movd		xxDConvMulti, rax
+	movdqa		xxTemp, xxDConvMulti
+	punpcklwd	xxTemp, xxDConvMulti
+	pshufd		xxDConvMulti, xxTemp, 0
+
+	movd		xxDSlide, DThSlide
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch16, rax
+	mov		iPitchHUp, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		iPitchHUp
+	PITCH_H_UP_PASS:
+
+
+	mov		rax, iPitch16
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+
+	mov		rax, ConAddr
+	mov		ConConLine, rax
+	mov		ConAddrLine, rax
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sal		rax, 1
+	add		rax, ConAddr
+	mov		ConConLineEnd, rax
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch16
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(8 byte align)
+
+
+; 捞固瘤 矫累 林家 父甸扁.
+
+	mov		rax, rrBw	; rrImgAddr= rrImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgConLine, rax
+
+	mov		rrConAddr, ConConLine	
+	mov		rrImgAddr, ImgConLine
+	pxor	xmm0, xmm0
+	
+	mov		rax, ix
+	add		rax, iPitch16
+	mov		pairLeft, rax
+	
+	mov		rax, InspRight
+	sub		rax, iPitch16
+	mov		pairRight, rax
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	jmp		MAKE_CON_BUFF
+
+NEXT_LINE:	; 概 扼牢付促 林家 犁瘤沥
+	
+	jmp		PAIRING_HORI
+	PAIRING_HORI_RETURN:
+	
+	inc		iy						; Loop Y
+	
+	add		ImgConLine		, rrBW
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+
+MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxCmp, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxCmp, xmm0
+	
+	movdqu		xxPlus, [rrImgAddr+ rrBW]
+	movdqa		xxMinus, xxPlus
+	punpcklbw	xxPlus, xmm0
+	punpckhbw	xxMinus, xmm0
+	paddw		xxSrc, xxPlus
+	paddw		xxCmp, xxMinus
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxCmp
+	
+
+	
+	add		rrImgAddr, 10h
+	add		rrConAddr, 20h
+	cmp		rrConAddr, ConConLineEnd
+	jle		MAKE_CON_BUFF
+
+	mov		rrConAddr, ConAddrLine
+	mov		ix, InspLeft
+;	inc		iy
+
+
+Conv_8:			; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+;JMP JUMP_DPC
+MAKE_DPC:
+	mov		rax, ix
+	sar		rax, 4
+	sal		rax, 5
+	;mov		ix2, rax
+	
+	mov		rcx, pPitch
+	add		rcx, rax
+	movsx	rdx, word ptr[rcx]
+	sal		rdx, 1
+	mov		iPitch2, rdx
+	
+	mov		rcx, pfSpr
+	add		rcx, rax
+	movdqu	xxfSpr, [rcx]
+	
+	mov		rcx, psSpr
+	add		rcx, rax
+	movdqu	xxsSpr, [rcx]
+JUMP_DPC:
+	mov		rax, iPitch2
+	add		rax, rrConAddr
+	movdqu	xxCmp, [rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 4]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 6]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+	movdqa	xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxCmp, xmm1
+
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xxTemp, [rrConAddr+ 2]
+	paddw	xxSrc, xxTemp
+	movdqu	xxTemp, [rrConAddr+ 4]
+	paddw	xxSrc, xxTemp
+	
+	psllw	xxSrc, SprShift		; SPR
+
+	movdqa	xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxSrc, xmm1
+
+;jmp	PASS_DTH
+	movdqa	xxThres, xxSrc
+	psrlw	xxThres, DReverseShift	; 1/9捞 酒聪扼 1/8 甫 利侩茄促.  1/16 * 1/8 => 4 + 3 = >>7
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	pmullw	xxThres, xxDConvMulti
+	psllw	xxThres, SprShift
+	
+	PASS_DTH:
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+
+Inspect_Black:
+	mov		BlackNWhite, 0
+	mov		bx, 0
+	movdqa	xxPeak, xxMinus
+	movdqa	xxPeak2, xxMinus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+Inspect_White:
+	mov		BlackNWhite, 1
+	mov		bx, 1
+	movdqa	xxPeak, xxPlus
+	movdqa	xxPeak2, xxPlus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+End_8_Pixel:
+	cmp		rrNoD, maxDefect
+	jge		PAIRING_HORI
+
+	add		ix, 8					; Loop X
+	add		rrConAddr, 16			; 14= 16- 2
+	cmp		ix, InspRight
+	jl		Conv_8
+
+	cmp		iy, InspBottom
+	jl		NEXT_LINE
+
+	jmp		END_FUNC
+
+DEFECT_00:
+	mov		rcx, ConvNSprMulti
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	cdq
+	div		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	cdq
+	div		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	cdq
+	div		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	cdq
+	div		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	cdq
+	div		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	cdq
+	div		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	cdq
+	div		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxPeak2, 7h
+	cdq
+	div		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+
+PAIRING_HORI:
+	mov		ix, -1
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, ix
+	movsxd	rax, dword ptr [rrXoD+ 4*ix]
+	mov		rcx, rax
+	add		rcx, iPitchHUp
+	
+
+	cmp		rax, pairRight
+	jg		PAIR_RIGHT
+
+	cmp		rax, pairLeft
+	jge		PAIR_CENTER
+
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rcx			; cmp	rdx, yPlusPitch
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rcx, PairAddr
+	
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 1
+	mov		(astPair ptr [rcx]).x, edx
+	mov		(astPair ptr [rcx]).y, iy32
+	mov		(astPair ptr [rcx]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_LEFT_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_Position
+	cmp		rdx, rcx
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rcx, PairAddr
+	
+	mov		(astPair ptr [rcx]).pos, 2
+	mov		(astPair ptr [rcx]).pair, 1
+	mov		(astPair ptr [rcx]).x, edx
+	mov		(astPair ptr [rcx]).y, iy32
+	mov		(astPair ptr [rcx]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_RIGHT:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	add		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+	
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).ref, eax
+	
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rcx]).src, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_HORI_RETURN
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloatDPC6 ENDP
+
+
+ConvZoneE PROC
+ret
+ConvZoneE endp
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatDPC_BOE.asm b/Common_Class/SISAssem/ConvFloatDPC_BOE.asm
new file mode 100644
index 0000000..3796d42
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatDPC_BOE.asm
@@ -0,0 +1,861 @@
+
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+ConvNSprShift		equ		6	; shift 2 & shift 4
+SprShift			equ		4
+ConvShift			equ		2
+SprMulti			equ		16
+ConvMulti			equ		4
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair		equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+bRFilter		equ		qword ptr[rbp+ 0b0h]
+pPitch			equ		qword ptr[rbp+ 0b8h]
+pfSpr			equ		qword ptr[rbp+ 0c0h]
+psSpr			equ		qword ptr[rbp+ 0c8h]
+
+GraySrc			equ		qword ptr[rbp+ 0d0h]
+GrayCmp			equ		qword ptr[rbp+ 0d8h]
+ZoneId			equ		qword ptr[rbp+ 0e0h]
+ZoneTh			equ		qword ptr[rbp+ 0e8h]
+
+DThSlide		equ		qword ptr[rbp+ 0f0h]
+endLine			equ		qword ptr[rbp+ 0f8h]
+
+
+ix			equ		rsi
+ix32		equ		esi
+iy			equ		rdi
+iy32		equ		edi
+
+
+rrBW		equ		r8
+rdBW		equ		r8d
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+
+rrImgAddr	equ		r14
+rrConAddr	equ		r15
+rdConAddr	equ		r15d
+rwConAddr	equ		r15w
+
+
+xxTemp		equ		xmm1
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus		equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12
+xxPeak2		equ		xmm13
+
+xxDSlide	equ		xmm14
+xxDStart	equ		xmm15
+
+
+ConvFloatDPC_BOE PROC C
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ConAddr			: qword
+	local	ConAddrLine		: qword
+	local	InspLength			: qword
+	
+	local	ImgConLine			: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	ConConLine			: qword
+	local	ConLength			: qword
+	local	ConConLineEnd		: qword
+	
+	local	BlackNWhite		: qword
+	local	maxDefect			: qword
+	local	iPitch2				: qword	
+	local	pairLeft			: qword
+
+	local	pairRight			: qword
+	local	iPitchHUp			: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 078h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	mov		maxDefect	, r8
+	mov		rrNoD		, r9
+	mov		rrBW		, BuffWidth
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax		; supress
+	movdqa		xmm0, xxSupp
+	;punpcklbw	xxSupp, xmm0
+	;movdqa		xmm0, xxSupp
+	;punpcklbw	xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+	mov			rax, Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+	movdqa		xxDStart, xxThres
+	psrlw		xxDStart, ConvNSprShift
+	
+
+	movd		xxDSlide, DThSlide
+	movdqa		xmm0, xxDSlide
+	punpcklwd	xmm0, xxDSlide
+	pshufd		xxDSlide, xmm0, 0
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch16, rax
+	mov		iPitchHUp, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		iPitchHUp
+	PITCH_H_UP_PASS:
+
+
+	mov		rax, iPitch16
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+
+	mov		rax, ConAddr
+	mov		ConConLine, rax
+	mov		ConAddrLine, rax
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sal		rax, 1
+	add		rax, ConAddr
+	mov		ConConLineEnd, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch16
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(8 byte align)
+
+	; 辑脓矾滚欺 背眉矫 磷绢辑 ROI 函版(BOE)
+	mov		rax, InspBottom		
+	sub		rax, 2
+	mov		InspBottom, rax
+
+	
+; 捞固瘤 矫累 林家 父甸扁.
+
+	mov		rax, rrBw	; rrImgAddr= rrImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgConLine, rax
+
+	mov		rrConAddr, ConConLine	
+	mov		rrImgAddr, ImgConLine
+	pxor	xmm0, xmm0
+	
+	mov		rax, ix
+	add		rax, iPitch16
+	mov		pairLeft, rax
+	
+	mov		rax, InspRight
+	sub		rax, iPitch16
+	mov		pairRight, rax
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	jmp		MAKE_CON_BUFF
+
+NEXT_LINE:	; 概 扼牢付促 林家 犁瘤沥
+	
+	jmp		PAIRING_HORI
+	PAIRING_HORI_RETURN:
+
+	inc		iy						; Loop Y
+
+	add		ImgConLine		, rrBW
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+
+MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	movdqu		xmm2, [rrImgAddr]
+	movdqa		xmm3, xmm2
+	punpcklbw	xmm2, xmm0
+	punpckhbw	xmm3, xmm0
+	
+	movdqu		xmm4, [rrImgAddr+ rrBW]
+	movdqa		xmm5, xmm4
+	punpcklbw	xmm4, xmm0
+	punpckhbw	xmm5, xmm0
+	paddw		xmm2, xmm4
+	paddw		xmm3, xmm5
+	movdqu		[rrConAddr], xmm2
+	movdqu		[rrConAddr+ 10h], xmm3
+	
+	add		rrImgAddr, 10h
+	add		rrConAddr, 20h
+	cmp		rrConAddr, ConConLineEnd
+	jle		MAKE_CON_BUFF
+
+	mov		rrConAddr, ConAddrLine
+	mov		ix, InspLeft
+;	inc		iy
+
+
+Conv_8:			; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+MAKE_DPC:
+	mov		rax, ix
+	sar		rax, 4
+	sal		rax, 5
+	;mov		ix2, rax
+	
+	mov		rcx, pPitch
+	add		rcx, rax
+	movsx	rdx, word ptr[rcx]
+	sal		rdx, 1
+	mov		iPitch2, rdx
+	
+	mov		rcx, pfSpr
+	add		rcx, rax
+	movdqu	xxfSpr, [rcx]
+	
+	mov		rcx, psSpr
+	add		rcx, rax
+	movdqu	xxsSpr, [rcx]
+
+	mov		rax, iPitch2
+	add		rax, rrConAddr
+	movdqu	xxCmp, [rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 4]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+	movdqa	xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxCmp, xmm1
+
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xmm1, [rrConAddr+ 2]
+	paddw	xxSrc, xmm1
+	
+	psllw	xxSrc, SprShift		; SPR
+
+	movdqa	xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxSrc, xmm1
+	
+;	jmp		DTH_PASS
+	movdqa	xxThres, xxSrc
+	pmaxuw	xxThres, xxCmp
+	psrlw	xxThres, ConvNSprShift
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	psllw	xxThres, ConvNSprShift
+;	DTH_PASS:
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+
+Inspect_Black:
+	mov		BlackNWhite, 0
+	mov		bx, 0
+	movdqa	xxPeak, xxMinus
+	movdqa	xxPeak2, xxMinus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+Inspect_White:
+	mov		BlackNWhite, 1
+	mov		bx, 1
+	movdqa	xxPeak, xxPlus
+	movdqa	xxPeak2, xxPlus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+End_8_Pixel:
+	cmp		rrNoD, maxDefect
+	jge		PAIRING_HORI
+
+	add		ix, 8					; Loop X
+	add		rrConAddr, 16			; 14= 16- 2
+	cmp		ix, InspRight
+	jl		Conv_8
+
+	cmp		iy, InspBottom
+	jl		NEXT_LINE
+
+	jmp		END_FUNC
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 0h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 1h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 2h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 3h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 4h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 5h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 6h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxPeak2, 7h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 7h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+
+PAIRING_HORI:
+	mov		ix, -1
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, ix
+	movsxd	rcx, dword ptr [rrXoD+ 4*ix]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+	
+
+	cmp		rcx, pairRight
+	jg		PAIR_RIGHT
+
+	cmp		rcx, pairLeft
+	jge		PAIR_CENTER
+
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_LEFT_UNPAIR:
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_Position
+	cmp		rdx, rax
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_RIGHT:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+	
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).thre, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_HORI_RETURN
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloatDPC_BOE ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatVTD.asm b/Common_Class/SISAssem/ConvFloatVTD.asm
new file mode 100644
index 0000000..76b3ecc
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatVTD.asm
@@ -0,0 +1,989 @@
+
+; ConvFloatVTD 俺惯 - 2011.09.02
+; ConvFloatVTD 俺惯 [Tilt] - 2011.09.05
+; ConvFloatVTD 肯丰 [T+D]- 2011.09.06
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+ConvNSprShift		equ		6	; shift 2 & shift 4
+SprShift			equ		4
+ConvShift			equ		2
+SprMulti			equ		16
+ConvMulti			equ		4
+
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+ConAddr2		equ		qword ptr[rbp+ 0b0h]
+tilt16			equ		qword ptr[rbp+ 0b8h]
+PitchBuff		equ		qword ptr[rbp+ 0c0h]
+DThSlide		equ		qword ptr[rbp+ 0c8h]
+
+GraySrc			equ		qword ptr[rbp+ 0d0h]
+GrayCmp			equ		qword ptr[rbp+ 0d8h]
+ZoneId			equ		qword ptr[rbp+ 0e0h]
+ZoneTh			equ		qword ptr[rbp+ 0e8h]
+
+endLine			equ		qword ptr[rbp+ 0f0h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+
+
+
+
+rrNoD			equ		r9
+
+rrXoD			equ		r10
+rrYoD			equ		r11
+rrToD			equ		r12
+rrPoD			equ		r13
+rrImgAddr		equ		r14
+rrConAddr		equ		r15
+rdConAddr		equ		r15d
+rwConAddr		equ		r15w
+
+rrConAddr2		equ		r8
+rdConAddr2		equ		r8d
+
+xxZero		equ		xmm0
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+
+xxPeak		equ		xmm4
+xxPeakAbs	equ		xmm5
+
+xxfSPR		equ		xmm6
+xxsSPR		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+
+xxSrc1		equ		xmm10
+xxSrc2		equ		xxTemp
+xxSrc3		equ		xxTemp
+xxCmp1		equ		xmm13
+xxCmp2		equ		xxTemp
+xxCmp3		equ		xxTemp
+
+xxDStart	equ		xmm11
+xxDSlide	equ		xmm12
+
+xxfSprT		equ		xmm14
+xxsSprT		equ		xmm15
+
+
+
+ConvFloatVTD PROC
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ImgAddrLeft		: qword
+	local	ImgConLine		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	F_Y2Insp		: qword
+	
+	local	maxPixelD		: qword
+	local	ConPitch		: qword	; 8*iPitch
+	local	ConPitch2		: qword
+	local	ConAddr			: qword
+	
+	local	ConOrigin		: qword
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword
+	
+	local	iPitch			: qword
+	local	iPitchLast		: qword
+	local	yPlusPitch		: qword
+	local	ConBottom		: qword
+	
+	
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	add		rbp, 08h
+	add		rbp, 080h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	add		ConAddr, 20h
+	add		ConAddr2, 20h
+	mov		maxPixelD	, r8
+	mov		iPitchLast, 0
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Threshold			; Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+	movdqa		xxDStart, xxThres
+	psrlw		xxDStart, ConvNSprShift
+	
+	movd		xxDSlide, DThSlide
+	movdqa		xmm0, xxDSlide
+	punpcklwd	xmm0, xxDSlide
+	pshufd		xxDSlide, xmm0, 0
+
+	mov			rax, Suppress			; supress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+	
+	mov			rcx, tilt16				; tilt setting
+	and			rcx, 0fh
+	
+	movd		xxsSprT, rcx
+	movdqa		xmm0, xxsSprT
+	punpcklwd	xmm0, xxsSprT
+	pshufd		xxsSprT, xmm0, 0
+	
+	mov			rax, SprMulti
+	sub			rax, rcx
+	movd		xxfSprT, rax
+	movdqa		xmm0, xxfSprT
+	punpcklwd	xmm0, xxfSprT
+	pshufd		xxfSprT, xmm0, 0
+	
+	mov			rax, tilt16
+	sar			rax, SprShift
+	mov			tilt16, rax
+
+	mov			rax, iPitch16			; iPitch Setting
+	sar			rax, SprShift
+	mov			iPitch, rax
+	
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	
+	cmp			rcx, 8
+	jl			PITCH_H_UP_PASS
+	inc			rax
+PITCH_H_UP_PASS:
+	mov			iPitchHUp, rax
+	
+	movd		xxsSPR, rcx			; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+
+	mov		rax, InspBottom
+	mov		ConBottom, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(16 byte align)
+
+	mov		rax, BuffWidth
+	mul		InspTop
+	add		rax, ImgAddr
+	add		rax, ix
+	mov		ImgAddrLeft, rax
+	
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+	
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, InspBottom
+	sub		rax, iPitch
+	sub		rax, 2
+	mov		InspBottom, rax
+
+	sub		rax, iPitch
+	mov		pairBottom, rax
+	
+
+	pxor	xmm0, xmm0	
+	
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	jmp		PAIRING_VERT
+PAIRING_VERT_RETURN:
+
+	add		ImgAddrLeft, 10h
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	
+	mov		iy, InspTop
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		END_FUNC
+
+LOOP_X_BODY:
+;	dec		iy						; Reverse Filter甫 困秦 ConBuff甫 茄临 歹 父电促.
+;	sub		rrImgAddr, BuffWidth
+;	sub		rrConAddr, 20h
+;	sub		rrConAddr2, 20h
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+	jmp		MAKE_CONBUFF_BODY_TAIL_CHECK
+MAKE_CONBUFF_RETURN:
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+	jmp		MAKE_CONBUFF2_HEAD
+MAKE_CONBUFF2_RETURN:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	mov		F_Y2Insp, 0
+	
+	jmp		LOOP_Y_CHECK
+
+DPC_READ:
+	cmp		PitchBuff, 0
+	je		DPC_READ_RETURN
+	mov		rcx, iy
+	sar		rcx, 4
+	sal		rcx, 2					; Pitch 16Pixel俊 茄锅究(>>4), Pitch绰 DWORD(4BYTE)<<2
+	add		rcx, PitchBuff
+	movsxd	rax, dword ptr[rcx]
+	
+	cmp		rax, iPitchLast
+	je		DPC_READ_RETURN
+	
+	mov		iPitchLast, rax
+
+	mov		rbx, rax
+	and		rbx, 0fh
+	
+	sar		rax, SprShift			; SprShift(>>4), Line(16*2 = << 5)
+	sal		rax, 5
+	mov		ConPitch, rax
+
+	movd		xxsSpr, rbx		; sSpr
+	movdqa		xmm1, xxsSpr
+	punpcklwd	xmm1, xxsSpr
+	pshufd		xxsSpr, xmm1, 0
+
+	mov			rdx, SprMulti
+	sub			rdx, rbx
+	movd		xxfSpr, rdx		; fSpr
+	movdqa		xmm1, xxfSpr
+	punpcklwd	xmm1, xxfSpr
+	pshufd		xxfSpr, xmm1, 0
+
+jmp	DPC_READ_RETURN
+
+	
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	add		rrConAddr, 20h
+	add		rrConAddr2, 20h
+
+LOOP_Y_CHECK:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING_VERT
+	
+	cmp		iy, InspBottom
+	jl		LOOP_Y_BODY
+
+; Y Double Check, Y绵 Conv甫 16 Pixel 窜困肺 父靛绰单. 八荤绰 8 Pixel 究 窍骨肺 2锅 y风橇 倒府扁.
+	add		ix, 8
+	cmp		F_Y2Insp, 1
+	jge		LOOP_X_TAIL	; y_end & goto x_tail
+
+	mov		F_Y2Insp, 1
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	add		rrConAddr, 10h
+	add		rrConAddr2, 10h
+
+	jmp		LOOP_Y_BODY
+
+
+
+; Con 滚欺 父甸扁
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc1
+
+	add		rrImgAddr, BuffWidth
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, ConBottom
+	jle		MAKE_CONBUFF_BODY_TAIL_CHECK	
+	jmp		MAKE_CONBUFF_RETURN
+
+
+MAKE_CONBUFF2_HEAD:
+	mov			rax, rrImgAddr
+	add			rax, tilt16
+	mov			rrConAddr2, ConAddr2
+MAKE_CONBUFF2_BODY:
+	movdqu		xxSrc, [rax]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+	pmullw		xxSrc, xxfSprT
+	pmullw		xxSrc1, xxfSprT
+	
+	
+	movdqu		xxCmp, [rax+ 2]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+	pmullw		xxCmp, xxsSprT
+	pmullw		xxCmp1, xxsSprT
+	
+	
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxcmp1
+	
+	psrlw		xxSrc, SprShift
+	psrlw		xxSrc1, SprShift
+
+	movdqu		xxCmp, [rax+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+
+	movdqu		[rrConAddr2], xxSrc
+	movdqu		[rrConAddr2+ 10h], xxSrc1
+	
+	add		rax, BuffWidth
+	add		rrConAddr2, 20h
+	
+	inc		iy
+	cmp		iy, ConBottom
+	jle		MAKE_CONBUFF2_BODY
+	jmp	MAKE_CONBUFF2_RETURN
+
+
+LOOP_Y_BODY:
+	jmp	DPC_READ
+	DPC_READ_RETURN:
+
+	movdqu	xxSrc1, [rrConAddr]			; 家胶 滚欺
+	movdqu	xxSrc2, [rrConAddr+ 20h]
+	movdqa	xxSrc, xxSrc1
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+
+	movdqa	xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxSrc, xxTemp
+
+
+	mov		rax, rrConAddr2				; 厚背 滚欺 钦 父甸扁
+	add		rax, ConPitch
+
+	movdqu	xxCmp1, [rax]
+	movdqa	xxCmp, xxCmp1
+	pmullw	xxCmp, xxfSPR
+
+	movdqu	xxCmp1, [rax+ 20h]
+	movdqa	xxTemp, xxCmp1
+	psllw	xxTemp, SprShift
+	paddw	xxCmp, xxTemp
+
+	movdqu	xxTemp, [rax+ 40h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+	movdqa	xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxCmp, xxTemp
+
+
+;	jmp		DTH_PASS
+	movdqa	xxThres, xxSrc
+	pmaxuw	xxThres, xxCmp
+	psrlw	xxThres, ConvNSprShift
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	psllw	xxThres, ConvNSprShift
+;	DTH_PASS:
+
+
+
+;	JMP		REINSPECT_PRE
+REINSPECT_RETURN:
+;	JMP		ReReINSPECT_PRE
+ReReINSPECT_RETURN:
+
+INSPECT_BLACK:
+	movdqa		xxPeakAbs, xxCmp
+	psubusw		xxPeakAbs, xxSrc
+
+	movdqa		xxPeak, xxPeakAbs
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0			; 孺搬窃 flag
+	jmp			DEFECT_00
+
+INSPECT_WHITE:
+	movdqa		xxPeakAbs	, xxSrc
+	psubusw		xxPeakAbs	, xxCmp
+
+	movdqa		xxPeak, xxPeakAbs
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1			; 归搬窃 flag
+	jmp			DEFECT_00
+
+
+REINSPECT_PRE:
+;JMP		REINSPECT_RETURN
+	paddw	xxCmp1, xxCmp2			; 厚背 滚欺 1+2
+	psllw	xxCmp1, SprShift
+	
+	movdqu	xxSrc3, [rrConAddr- 20h]	; 惑措 滚欺 1+ 2+ 3
+	pmullw	xxSrc3, xxSSPR
+	
+	psllw	xxSrc1, SprShift
+	paddw	xxSrc3, xxSrc1
+	
+	pmullw	xxSrc2, xxFSpr
+	paddw	xxSrc3, xxSrc2
+
+	JMP		REINSPECT_RETURN
+
+REINSPECT_BLACK:
+	movdqa		xxTemp, xxCmp1
+	psubusw		xxTemp, xxSrc3
+	
+	pcmpgtw		xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00	;ReReINSPECT_BLACK
+
+REINSPECT_WHITE:
+	movdqa		xxTemp, xxSrc3
+	psubusw		xxTemp, xxCmp1
+
+	pcmpgtw		xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00	;ReReINSPECT_WHITE
+
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeakAbs, 0
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxPeakAbs, 1
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeakAbs, 2
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeakAbs, 3
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeakAbs, 4
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeakAbs, 5
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeakAbs, 6
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7
+	cmp		rax, 0h
+	je		DEFECT_END
+	
+	pextrw	rax, xxPeakAbs, 7
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_END:
+	sub		ix, 7
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+
+
+
+
+PAIRING_VERT:
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*iy], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrConAddr2, dword ptr[rrXoD+ 4*iy]
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrConAddr2, rcx
+	jne		PAIR_TOP
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdConAddr2
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrConAddr2, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdConAddr2
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_VERT_RETURN
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloatVTD ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatVTD_BOE.asm b/Common_Class/SISAssem/ConvFloatVTD_BOE.asm
new file mode 100644
index 0000000..566f52a
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatVTD_BOE.asm
@@ -0,0 +1,1057 @@
+
+; ConvFloatVTD 俺惯 - 2011.09.02
+; ConvFloatVTD 俺惯 [Tilt] - 2011.09.05
+; ConvFloatVTD 肯丰 [T+D]- 2011.09.06
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+ConvNSprShift		equ		6	; shift 2 & shift 4
+SprShift			equ		4
+ConvShift			equ		2
+SprMulti			equ		16
+ConvMulti			equ		4
+
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+ConAddr2		equ		qword ptr[rbp+ 0b0h]
+tilt16			equ		qword ptr[rbp+ 0b8h]
+PitchBuff		equ		qword ptr[rbp+ 0c0h]
+DThSlide		equ		qword ptr[rbp+ 0c8h]
+
+GraySrc			equ		qword ptr[rbp+ 0d0h]
+GrayCmp			equ		qword ptr[rbp+ 0d8h]
+ZoneId			equ		qword ptr[rbp+ 0e0h]
+ZoneTh			equ		qword ptr[rbp+ 0e8h]
+
+endLine			equ		qword ptr[rbp+ 0f0h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+
+
+
+
+rrNoD			equ		r9
+
+rrXoD			equ		r10
+rrYoD			equ		r11
+rrToD			equ		r12
+rrPoD			equ		r13
+rrImgAddr		equ		r14
+rrConAddr		equ		r15
+rdConAddr		equ		r15d
+rwConAddr		equ		r15w
+
+rrConAddr2		equ		r8
+rdConAddr2		equ		r8d
+
+xxZero		equ		xmm0
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+
+xxPeak		equ		xmm4
+xxPeakAbs	equ		xmm5
+
+xxfSPR		equ		xmm6
+xxsSPR		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+
+xxSrc1		equ		xmm10
+xxSrc2		equ		xxTemp
+xxSrc3		equ		xxTemp
+xxCmp1		equ		xmm13
+xxCmp2		equ		xxTemp
+xxCmp3		equ		xxTemp
+
+xxDStart	equ		xmm11
+xxDSlide	equ		xmm12
+
+xxfSprT		equ		xmm14
+xxsSprT		equ		xmm15
+
+
+
+ConvFloatVTD_BOE PROC
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ImgAddrLeft		: qword
+	local	ImgConLine		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	F_Y2Insp		: qword
+	
+	local	maxPixelD		: qword
+	local	ConPitch		: qword	; 8*iPitch
+	local	ConPitch2		: qword
+	local	ConAddr			: qword
+	
+	local	ConOrigin		: qword
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword
+	
+	local	iPitch			: qword
+	local	iPitchLast		: qword
+	local	yPlusPitch		: qword
+	local	ConBottom		: qword
+	
+	
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	add		rbp, 08h
+	add		rbp, 080h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	add		ConAddr, 20h
+	add		ConAddr2, 20h
+	mov		maxPixelD	, r8
+	mov		iPitchLast, 0
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Threshold			; Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+	movdqa		xxDStart, xxThres
+	psrlw		xxDStart, ConvNSprShift
+	
+	movd		xxDSlide, DThSlide
+	movdqa		xmm0, xxDSlide
+	punpcklwd	xmm0, xxDSlide
+	pshufd		xxDSlide, xmm0, 0
+
+	mov			rax, Suppress			; supress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+	
+	mov			rcx, tilt16				; tilt setting
+	and			rcx, 0fh
+	
+	movd		xxsSprT, rcx
+	movdqa		xmm0, xxsSprT
+	punpcklwd	xmm0, xxsSprT
+	pshufd		xxsSprT, xmm0, 0
+	
+	mov			rax, SprMulti
+	sub			rax, rcx
+	movd		xxfSprT, rax
+	movdqa		xmm0, xxfSprT
+	punpcklwd	xmm0, xxfSprT
+	pshufd		xxfSprT, xmm0, 0
+	
+	mov			rax, tilt16
+	sar			rax, SprShift
+	mov			tilt16, rax
+
+	mov			rax, iPitch16			; iPitch Setting
+	sar			rax, SprShift
+	mov			iPitch, rax
+	
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	
+	cmp			rcx, 8
+	jl			PITCH_H_UP_PASS
+	inc			rax
+PITCH_H_UP_PASS:
+	mov			iPitchHUp, rax
+	
+	movd		xxsSPR, rcx			; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	;辑脓矾俊辑 磷绢辑 Bottom 俊辑 1 哗霖促.(BOE)
+	mov		rax, InspBottom
+	sub		rax, 1
+	mov		InspBottom, rax
+
+	mov		rax, InspBottom
+	mov		ConBottom, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(16 byte align)
+
+	mov		rax, BuffWidth
+	mul		InspTop
+	add		rax, ImgAddr
+	add		rax, ix
+	mov		ImgAddrLeft, rax
+	
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+	
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, InspBottom
+	sub		rax, iPitch
+	;菊俊辑 1 哗玲扁 锭巩俊 1父 哗淋(BOE) //sub		rax, 2
+	sub		rax, 1
+	mov		InspBottom, rax
+
+	sub		rax, iPitch
+	mov		pairBottom, rax
+	
+
+	pxor	xmm0, xmm0	
+	
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	jmp		PAIRING_VERT
+PAIRING_VERT_RETURN:
+
+	add		ImgAddrLeft, 10h
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	
+	mov		iy, InspTop
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		END_FUNC
+
+LOOP_X_BODY:
+;	dec		iy						; Reverse Filter甫 困秦 ConBuff甫 茄临 歹 父电促.
+;	sub		rrImgAddr, BuffWidth
+;	sub		rrConAddr, 20h
+;	sub		rrConAddr2, 20h
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+	jmp		MAKE_CONBUFF_BODY_TAIL_CHECK
+MAKE_CONBUFF_RETURN:
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+	jmp		MAKE_CONBUFF2_HEAD
+MAKE_CONBUFF2_RETURN:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	mov		F_Y2Insp, 0
+	
+	jmp		LOOP_Y_CHECK
+
+DPC_READ:
+	cmp		PitchBuff, 0
+	je		DPC_READ_RETURN
+	mov		rcx, iy
+	sar		rcx, 4
+	sal		rcx, 2					; Pitch 16Pixel俊 茄锅究(>>4), Pitch绰 DWORD(4BYTE)<<2
+	add		rcx, PitchBuff
+	movsxd	rax, dword ptr[rcx]
+	
+	cmp		rax, iPitchLast
+	je		DPC_READ_RETURN
+	
+	mov		iPitchLast, rax
+
+	mov		rbx, rax
+	and		rbx, 0fh
+	
+	sar		rax, SprShift			; SprShift(>>4), Line(16*2 = << 5)
+	sal		rax, 5
+	mov		ConPitch, rax
+
+	movd		xxsSpr, rbx		; sSpr
+	movdqa		xmm1, xxsSpr
+	punpcklwd	xmm1, xxsSpr
+	pshufd		xxsSpr, xmm1, 0
+
+	mov			rdx, SprMulti
+	sub			rdx, rbx
+	movd		xxfSpr, rdx		; fSpr
+	movdqa		xmm1, xxfSpr
+	punpcklwd	xmm1, xxfSpr
+	pshufd		xxfSpr, xmm1, 0
+
+jmp	DPC_READ_RETURN
+
+	
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	add		rrConAddr, 20h
+	add		rrConAddr2, 20h
+
+LOOP_Y_CHECK:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING_VERT
+	
+	cmp		iy, InspBottom
+	jl		LOOP_Y_BODY
+
+; Y Double Check, Y绵 Conv甫 16 Pixel 窜困肺 父靛绰单. 八荤绰 8 Pixel 究 窍骨肺 2锅 y风橇 倒府扁.
+	add		ix, 8
+	cmp		F_Y2Insp, 1
+	jge		LOOP_X_TAIL	; y_end & goto x_tail
+
+	mov		F_Y2Insp, 1
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	add		rrConAddr, 10h
+	add		rrConAddr2, 10h
+
+	jmp		LOOP_Y_BODY
+
+
+
+; Con 滚欺 父甸扁
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc1
+
+	add		rrImgAddr, BuffWidth
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, ConBottom
+	jle		MAKE_CONBUFF_BODY_TAIL_CHECK	
+	jmp		MAKE_CONBUFF_RETURN
+
+
+MAKE_CONBUFF2_HEAD:
+	mov			rax, rrImgAddr
+	add			rax, tilt16
+	mov			rrConAddr2, ConAddr2
+MAKE_CONBUFF2_BODY:
+	movdqu		xxSrc, [rax]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+	pmullw		xxSrc, xxfSprT
+	pmullw		xxSrc1, xxfSprT
+	
+	
+	movdqu		xxCmp, [rax+ 2]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+	pmullw		xxCmp, xxsSprT
+	pmullw		xxCmp1, xxsSprT
+	
+	
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxcmp1
+	
+	psrlw		xxSrc, SprShift
+	psrlw		xxSrc1, SprShift
+
+	movdqu		xxCmp, [rax+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+
+	movdqu		[rrConAddr2], xxSrc
+	movdqu		[rrConAddr2+ 10h], xxSrc1
+	
+	add		rax, BuffWidth
+	add		rrConAddr2, 20h
+	
+	inc		iy
+	cmp		iy, ConBottom
+	jle		MAKE_CONBUFF2_BODY
+	jmp	MAKE_CONBUFF2_RETURN
+
+
+LOOP_Y_BODY:
+	jmp	DPC_READ
+	DPC_READ_RETURN:
+
+	movdqu	xxSrc1, [rrConAddr]			; 家胶 滚欺
+	movdqu	xxSrc2, [rrConAddr+ 20h]
+	movdqa	xxSrc, xxSrc1
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+
+	movdqa	xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxSrc, xxTemp
+
+
+	mov		rax, rrConAddr2				; 厚背 滚欺 钦 父甸扁
+	add		rax, ConPitch
+
+	movdqu	xxCmp1, [rax]
+	movdqa	xxCmp, xxCmp1
+	pmullw	xxCmp, xxfSPR
+
+	movdqu	xxCmp1, [rax+ 20h]
+	movdqa	xxTemp, xxCmp1
+	psllw	xxTemp, SprShift
+	paddw	xxCmp, xxTemp
+
+	movdqu	xxTemp, [rax+ 40h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+	movdqa	xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxCmp, xxTemp
+
+
+;	jmp		DTH_PASS
+	movdqa	xxThres, xxSrc
+	pmaxuw	xxThres, xxCmp
+	psrlw	xxThres, ConvNSprShift
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	psllw	xxThres, ConvNSprShift
+;	DTH_PASS:
+
+
+
+;	JMP		REINSPECT_PRE
+REINSPECT_RETURN:
+;	JMP		ReReINSPECT_PRE
+ReReINSPECT_RETURN:
+
+INSPECT_BLACK:
+	movdqa		xxPeakAbs, xxCmp
+	psubusw		xxPeakAbs, xxSrc
+
+	movdqa		xxPeak, xxPeakAbs
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0			; 孺搬窃 flag
+	jmp			DEFECT_00
+
+INSPECT_WHITE:
+	movdqa		xxPeakAbs	, xxSrc
+	psubusw		xxPeakAbs	, xxCmp
+
+	movdqa		xxPeak, xxPeakAbs
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1			; 归搬窃 flag
+	jmp			DEFECT_00
+
+
+REINSPECT_PRE:
+;JMP		REINSPECT_RETURN
+	paddw	xxCmp1, xxCmp2			; 厚背 滚欺 1+2
+	psllw	xxCmp1, SprShift
+	
+	movdqu	xxSrc3, [rrConAddr- 20h]	; 惑措 滚欺 1+ 2+ 3
+	pmullw	xxSrc3, xxSSPR
+	
+	psllw	xxSrc1, SprShift
+	paddw	xxSrc3, xxSrc1
+	
+	pmullw	xxSrc2, xxFSpr
+	paddw	xxSrc3, xxSrc2
+
+	JMP		REINSPECT_RETURN
+
+REINSPECT_BLACK:
+	movdqa		xxTemp, xxCmp1
+	psubusw		xxTemp, xxSrc3
+	
+	pcmpgtw		xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00	;ReReINSPECT_BLACK
+
+REINSPECT_WHITE:
+	movdqa		xxTemp, xxSrc3
+	psubusw		xxTemp, xxCmp1
+
+	pcmpgtw		xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00	;ReReINSPECT_WHITE
+
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeakAbs, 0
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 0h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxPeakAbs, 1
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 1h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeakAbs, 2
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 2h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeakAbs, 3
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 3h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeakAbs, 4
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 4h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeakAbs, 5
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 5h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeakAbs, 6
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 6h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7
+	cmp		rax, 0h
+	je		DEFECT_END
+	
+	pextrw	rax, xxPeakAbs, 7
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 7h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_END:
+	sub		ix, 7
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+
+
+
+
+PAIRING_VERT:
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*iy], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrConAddr2, dword ptr[rrXoD+ 4*iy]
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrConAddr2, rcx
+	jne		PAIR_TOP
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdConAddr2
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).thre, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrConAddr2, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdConAddr2
+	mov		(astPair ptr [rcx]).y, eax
+
+	;搬窃鸥涝 滚弊 荐沥(BOE)
+	movsx	edx, word ptr[rrToD+ 2*iy]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).thre, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_VERT_RETURN
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloatVTD_BOE ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatVTD_DPCAIAu.asm b/Common_Class/SISAssem/ConvFloatVTD_DPCAIAu.asm
new file mode 100644
index 0000000..6f559a9
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatVTD_DPCAIAu.asm
@@ -0,0 +1,830 @@
+
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+ConAddr2		equ		qword ptr[rbp+ 0b0h]
+tilt16			equ		qword ptr[rbp+ 0b8h]
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+
+
+
+
+rrNoD			equ		r9
+
+rrXoD			equ		r10
+rrYoD			equ		r11
+rrToD			equ		r12
+rrPoD			equ		r13
+rrImgAddr		equ		r14
+rrConAddr		equ		r15
+rdConAddr		equ		r15d
+rwConAddr		equ		r15w
+
+rrConAddr2		equ		r8
+rdConAddr2		equ		r8d
+
+xxZero		equ		xmm0
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+
+xxPeak		equ		xmm4
+xxPeakEx	equ		xmm5
+
+xxfSPR		equ		xmm6
+xxsSPR		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxMinus		equ		xmm10
+xxPlus		equ		xmm11
+
+xxSrc1		equ		xmm10
+xxSrc2		equ		xmm11
+xxSrc3		equ		xmm12
+xxCmp1		equ		xmm13
+xxCmp2		equ		xmm14
+xxCmp3		equ		xmm15
+
+
+xxfSprc		equ		xmm14
+xxsSprc		equ		xmm15
+
+
+ConvSprShift		equ		6	; shift 2 & shift 4
+ConvShift			equ		2
+ConvMulti			equ		4
+SprShift			equ		4
+SprMulti			equ		16
+
+
+ConvFloatVTD PROC
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ImgAddrLeft		: qword
+	local	ImgConLine		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	F_Y2Insp		: qword
+	
+	local	maxPixelD		: qword
+	local	ConPitch		: qword	; 8*iPitch
+	local	ConPitch2		: qword
+	local	ConAddr			: qword
+	
+	local	ConOrigin		: qword
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword
+	
+	local	iPitch			: qword
+	local	i2Pitch			: qword
+	local	yPlusPitch		: qword
+	local	ConBottom		: qword
+	
+	
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 088h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	add		ConAddr, 20h
+	add		ConAddr2, 20h
+	mov		maxPixelD	, r8
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Threshold			; Threshold
+	movd		xxThres, rax
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	mov			rax, Suppress			; supress
+	sal			rax, ConvSprShift
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+	
+	mov			rcx, tilt16				; tilt setting
+	and			rcx, 0fh
+	
+	movd		xxsSprC, rcx
+	movdqa		xmm0, xxsSprC
+	punpcklwd	xmm0, xxsSprC
+	pshufd		xxsSprC, xmm0, 0
+	
+	mov			rax, SprMulti
+	sub			rax, rcx
+	movd		xxfSPRC, rax
+	movdqa		xmm0, xxfSPRC
+	punpcklwd	xmm0, xxfSPRC
+	pshufd		xxfSPRC, xmm0, 0
+	
+	mov			rax, tilt16
+	sar			rax, SprShift
+	mov			tilt16, rax
+
+	mov			rax, iPitch16			; iPitch Setting
+	sar			rax, SprShift
+	mov			iPitch, rax
+	
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	
+	cmp			rcx, 8
+	jl			PITCH_H_UP_PASS
+	inc			rax
+PITCH_H_UP_PASS:
+	mov			iPitchHUp, rax
+	
+	movd		xxsSPR, rcx			; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+
+	mov		rax, InspBottom
+	mov		ConBottom, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(16 byte align)
+
+	mov		rax, BuffWidth
+	mul		InspTop
+	add		rax, ImgAddr
+	add		rax, ix
+	mov		ImgAddrLeft, rax
+	
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+	
+	mov		rax, 20h
+	mul		i2Pitch
+	mov		ConPitch2, rax
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, InspBottom
+	sub		rax, iPitch
+	sub		rax, 2
+	mov		InspBottom, rax
+
+	sub		rax, iPitch
+	mov		pairBottom, rax
+	
+
+	pxor	xmm0, xmm0	
+	
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	jmp		PAIRING_VERT
+PAIRING_VERT_RETURN:
+
+	add		ImgAddrLeft, 10h
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	
+	mov		iy, InspTop
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		END_FUNC
+
+LOOP_X_BODY:
+;	dec		iy						; Reverse Filter甫 困秦 ConBuff甫 茄临 歹 父电促.
+;	sub		rrImgAddr, BuffWidth
+;	sub		rrConAddr, 20h
+;	sub		rrConAddr2, 20h
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+	jmp		LOOP_CONBUFF_BODY_TAIL_CHECK
+LOOP_CONBUFF_RETURN:
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+
+	jmp		LOOP_CONBUFF2_HEAD
+LOOP_CONBUFF2_RETURN:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	mov		F_Y2Insp, 0
+	
+	jmp		LOOP_Y_CHECK
+
+
+
+	
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	add		rrConAddr, 20h
+	add		rrConAddr2, 20h
+
+LOOP_Y_CHECK:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING_VERT
+	
+	cmp		iy, InspBottom
+	jl		LOOP_Y_BODY
+
+; Y Double Check, Y绵 Conv甫 16 官捞飘 窜困肺 父靛绰单. 八荤绰 8官捞飘究 窍骨肺 2锅 y风橇 倒府扁.
+	add		ix, 8
+	cmp		F_Y2Insp, 1
+	jge		LOOP_X_TAIL	; y_end & goto x_tail
+
+	mov		F_Y2Insp, 1
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		rrConAddr2, ConAddr2
+	add		rrConAddr, 10h
+	add		rrConAddr2, 10h
+
+	jmp		LOOP_Y_BODY
+
+
+
+; Con 滚欺 父甸扁
+LOOP_CONBUFF_BODY_TAIL_CHECK:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc1
+
+	add		rrImgAddr, BuffWidth
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, ConBottom
+	jle		LOOP_CONBUFF_BODY_TAIL_CHECK	
+	jmp		LOOP_CONBUFF_RETURN
+
+
+LOOP_CONBUFF2_HEAD:
+	mov			rax, rrImgAddr
+	add			rax, tilt16
+	mov			rrConAddr2, ConAddr2
+LOOP_CONBUFF2_BODY:
+	movdqu		xxSrc, [rax]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+	pmullw		xxSrc, xxfSprc
+	pmullw		xxSrc1, xxfSprc
+	
+	
+	movdqu		xxCmp, [rax+ 2]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+	pmullw		xxCmp, xxsSprc
+	pmullw		xxCmp1, xxsSprc
+	
+	
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxcmp1
+	
+	psraw		xxSrc, SprShift
+	psraw		xxSrc1, SprShift
+
+	movdqu		xxCmp, [rax+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+
+	movdqu		[rrConAddr2], xxSrc
+	movdqu		[rrConAddr2+ 10h], xxSrc1
+	
+	add		rax, BuffWidth
+	add		rrConAddr2, 20h
+	
+	inc		iy
+	cmp		iy, ConBottom
+	jle		LOOP_CONBUFF2_BODY
+	jmp	LOOP_CONBUFF2_RETURN
+
+
+LOOP_Y_BODY:
+
+	movdqu	xxSrc1, [rrConAddr]			; 家胶 滚欺
+	movdqu	xxSrc2, [rrConAddr+ 20h]
+	movdqa	xxSrc, xxSrc1
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+
+	movdqa	xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxSrc, xxTemp
+
+
+	mov		rax, rrConAddr2				; 厚背 滚欺 钦 父甸扁
+	add		rax, ConPitch
+
+	movdqu	xxCmp1, [rax]
+	movdqa	xxCmp, xxCmp1
+	pmullw	xxCmp, xxfSPR
+
+	movdqu	xxCmp1, [rax+ 20h]
+	movdqa	xxTemp, xxCmp1
+	psllw	xxTemp, SprShift
+	paddw	xxCmp, xxTemp
+	
+	movdqu	xxTemp, [rax+ 40h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+	movdqa	xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxCmp, xxTemp
+
+
+
+;	JMP		REINSPECT_PRE
+REINSPECT_RETURN:
+;	JMP		ReReINSPECT_PRE
+ReReINSPECT_RETURN:
+
+INSPECT_BLACK:
+	movdqa		xxPeakEx, xxCmp
+	psubusw		xxPeakEx, xxSrc
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0			; 孺搬窃 flag
+	jmp			DEFECT_00
+
+INSPECT_WHITE:
+	movdqa		xxPeakEx	, xxSrc
+	psubusw		xxPeakEx	, xxCmp
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1			; 归搬窃 flag
+	jmp			DEFECT_00
+
+
+REINSPECT_PRE:
+;JMP		REINSPECT_RETURN
+	paddw	xxCmp1, xxCmp2			; 厚背 滚欺 1+2
+	psllw	xxCmp1, SprShift
+	
+	movdqu	xxSrc3, [rrConAddr- 20h]	; 惑措 滚欺 1+ 2+ 3
+	pmullw	xxSrc3, xxSSPR
+	
+	psllw	xxSrc1, SprShift
+	paddw	xxSrc3, xxSrc1
+	
+	pmullw	xxSrc2, xxFSpr
+	paddw	xxSrc3, xxSrc2
+
+	JMP		REINSPECT_RETURN
+
+REINSPECT_BLACK:
+	movdqa		xxTemp, xxCmp1
+	psubusw		xxTemp, xxSrc3	;psubusw	xxPlus	, xxCmp
+	
+	pcmpgtw		xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00	;ReReINSPECT_BLACK
+
+REINSPECT_WHITE:
+	movdqa		xxTemp, xxSrc3
+	psubusw		xxTemp, xxCmp1	;psubusw	xxMinus	, xxSrc
+
+	pcmpgtw		xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00	;ReReINSPECT_WHITE
+
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeakEx, 0
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxPeakEx, 1
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeakEx, 2
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeakEx, 3
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeakEx, 4
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeakEx, 5
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeakEx, 6
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7
+	cmp		rax, 0h
+	je		DEFECT_END
+	
+	pextrw	rax, xxPeakEx, 7
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_END:
+	sub		ix, 7
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+
+
+
+
+PAIRING_VERT:
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*iy], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrConAddr2, dword ptr[rrXoD+ 4*iy]
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrConAddr2, rcx
+	jne		PAIR_TOP
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdConAddr2
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrConAddr2, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdConAddr2
+	mov		(astPair ptr [rcx]).y, eax
+	cmp		edx, 0
+	je		TYPE_1
+	mov		(astPair ptr [rcx]).dtype, 0
+	jmp		TYPE_END
+TYPE_1:
+	mov		(astPair ptr [rcx]).dtype, 1
+TYPE_END:
+
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_VERT_RETURN
+
+
+
+END_FUNC:
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+ConvFloatVTD ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatVert.asm b/Common_Class/SISAssem/ConvFloatVert.asm
new file mode 100644
index 0000000..7e752c7
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatVert.asm
@@ -0,0 +1,885 @@
+
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+ConvNSprShift		equ		6	; shift 2 & shift 4
+SprShift			equ		4
+ConvShift			equ		2
+SprMulti			equ		16
+ConvMulti			equ		4
+
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+GraySrc			equ		qword ptr[rbp+ 0b0h]
+GrayCmp			equ		qword ptr[rbp+ 0b8h]
+ZoneId			equ		qword ptr[rbp+ 0c0h]
+ZoneTh			equ		qword ptr[rbp+ 0c8h]
+
+i2Pitch16		equ		qword ptr[rbp+ 0d0h]
+bReverseFilter	equ		qword ptr[rbp+ 0d8h]
+DThSlide		equ		qword ptr[rbp+ 0e0h]
+endLine			equ		qword ptr[rbp+ 0e8h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+
+
+
+
+rrBW			equ		r8
+rdBW			equ		r8d
+rrNoD			equ		r9
+
+rrXoD			equ		r10
+rrYoD			equ		r11
+rrToD			equ		r12
+rrPoD			equ		r13
+rrImgAddr		equ		r14
+rrConAddr		equ		r15
+rdConAddr		equ		r15d
+rwConAddr		equ		r15w
+
+
+xxZero		equ		xmm0
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+
+xxPeak		equ		xmm4
+xxPeakEx	equ		xmm5
+
+xxfSPR		equ		xmm6
+xxsSPR		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxDStart	equ		xmm12
+xxDSlide	equ		xmm15
+
+xxSrc1		equ		xmm10
+xxSrc2		equ		xmm11
+xxSrc3		equ		xmm12
+xxCmp1		equ		xmm13
+xxCmp2		equ		xmm14
+xxCmp3		equ		xmm15
+
+
+
+
+
+
+ConvFloatVert PROC
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ImgAddrLeft		: qword
+	local	ImgConLine		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	F_Y2Insp		: qword
+	
+	local	maxPixelD		: qword
+	local	ConPitch		: qword	; 8*iPitch
+	local	ConPitch2		: qword	
+	local	ConAddr			: qword
+	
+	local	ConOrigin		: qword
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword
+	
+	local	iPitch			: qword
+	local	i2Pitch			: qword
+	local	yPlusPitch		: qword	
+	local	ConBottom		: qword
+	
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 088h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	add		ConAddr, 20h
+	mov		maxPixelD	, r8
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Threshold			; Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+	movdqa		xxDStart, xxThres
+	psrlw		xxDStart, ConvNSprShift
+	
+	movd		xxDSlide, DThSlide
+	movdqa		xmm0, xxDSlide
+	punpcklwd	xmm0, xxDSlide
+	pshufd		xxDSlide, xmm0, 0
+
+	mov			rax, Suppress			; supress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+	
+	
+	mov			rax, iPitch16			; iPitch
+	sar			rax, SprShift
+	mov			iPitch, rax
+	
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	
+	cmp			rcx, 8
+	jl			PITCH_H_UP_PASS
+	inc			rax
+PITCH_H_UP_PASS:
+	mov			iPitchHUp, rax
+	
+	movd		xxsSPR, rcx			; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+
+	mov			rax, i2Pitch16		; i2Pitch
+	sar			rax, SprShift
+	mov			i2Pitch, rax
+
+	mov			rax, i2Pitch16
+	and			rax, 0fh
+
+
+
+
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+
+	mov		rax, InspBottom
+	mov		ConBottom, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(16 byte align)
+
+	mov		rax, rrBW
+	mul		InspTop
+	add		rax, ImgAddr
+	add		rax, ix
+	mov		ImgAddrLeft, rax
+
+;	mov		rax, 20h
+;	mul		InspTop
+;	add		rax, ConOrigin
+;	mov		ConAddr, rax
+
+
+
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+
+	mov		rax, 20h
+	mul		i2Pitch
+	mov		ConPitch2, rax
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+
+	mov		rax, InspBottom
+	sub		rax, iPitch
+	sub		rax, 2
+	mov		InspBottom, rax
+
+	sub		rax, iPitch
+	mov		pairBottom, rax
+
+
+	pxor	xmm0, xmm0	
+	;mov		ix, InspLeft
+	;mov		iy, InspTop
+	
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+
+
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	jmp		PAIRING_VERT
+PAIRING_VERT_RETURN:
+
+	add		ImgAddrLeft, 10h
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	
+	mov		iy, InspTop
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		END_FUNC
+
+LOOP_X_BODY:
+	dec		iy						; top栏肺 1 pixel 歹 父电促. 开规氢 八刘困秦
+	sub		rrImgAddr, rrBW
+	sub		rrConAddr, 20h
+	jmp		MAKE_CONBUFF_BODY_TAIL_CHECK
+MAKE_CONBUFF_RETURN:
+
+
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		F_Y2Insp, 0
+	
+	jmp		LOOP_Y_CHECK
+
+
+
+	
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+LOOP_Y_CHECK:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING_VERT
+	
+	cmp		iy, InspBottom
+	jl		LOOP_Y_BODY
+
+; Y Double Check, Y绵 Conv甫 16 官捞飘 窜困肺 父靛绰单. 八荤绰 8官捞飘究 窍骨肺 2锅 y风橇 倒府扁.
+	add		ix, 8
+	cmp		F_Y2Insp, 1
+	jge		LOOP_X_TAIL	; y_end & goto x_tail
+
+	mov		F_Y2Insp, 1
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	add		rrConAddr, 10h
+
+	jmp		LOOP_Y_BODY
+
+
+
+; Con 滚欺 父甸扁
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc1
+
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, ConBottom
+	jle		MAKE_CONBUFF_BODY_TAIL_CHECK
+	
+	jmp		MAKE_CONBUFF_RETURN
+
+
+
+
+LOOP_Y_BODY:
+
+	movdqu	xxSrc1, [rrConAddr]			; 家胶 滚欺
+	movdqu	xxSrc2, [rrConAddr+ 20h]
+	movdqa	xxSrc, xxSrc1
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+
+	movdqa	xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxSrc, xxTemp
+
+
+	mov		rax, rrConAddr				; 厚背 滚欺 钦 父甸扁
+	add		rax, ConPitch
+
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp, xxCmp1
+	pmullw		xxCmp, xxfSPR
+
+	movdqu		xxCmp2, [rax+ 20h]
+	movdqa		xxTemp, xxCmp2
+	psllw		xxTemp, SprShift
+	paddw		xxCmp, xxTemp
+	
+	movdqu		xxTemp, [rax+ 40h]
+	pmullw		xxTemp, xxsSPR
+	paddw		xxCmp, xxTemp
+
+	movdqa		xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw		xxTemp, xxSupp
+	psubusw		xxCmp, xxTemp
+
+	movdqa		xxThres, xxSrc
+	pmaxuw		xxThres, xxCmp
+	psrlw		xxThres, ConvNSprShift
+	pmullw		xxThres, xxDSlide
+	psrlw		xxThres, 8
+	paddw		xxThres, xxDStart
+	psllw		xxThres, ConvNSprShift
+
+
+;	JMP		REINSPECT_PRE
+REINSPECT_RETURN:
+;	JMP		ReReINSPECT_PRE
+ReReINSPECT_RETURN:
+
+
+INSPECT_BLACK:
+	movdqa		xxPeakEx, xxCmp
+	psubusw		xxPeakEx, xxSrc
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00
+
+INSPECT_WHITE:
+	movdqa		xxPeakEx	, xxSrc
+	psubusw		xxPeakEx	, xxCmp
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00
+
+
+REINSPECT_PRE:
+;JMP		REINSPECT_RETURN
+	paddw	xxCmp1, xxCmp2			; 厚背 滚欺 1+2
+	psllw	xxCmp1, SprShift
+	
+	movdqu	xxSrc3, [rrConAddr- 20h]	; 惑措 滚欺 1+ 2+ 3
+	pmullw	xxSrc3, xxSSPR
+	
+	psllw	xxSrc1, SprShift
+	paddw	xxSrc3, xxSrc1
+	
+	pmullw	xxSrc2, xxFSpr
+	paddw	xxSrc3, xxSrc2
+
+	JMP		REINSPECT_RETURN
+
+REINSPECT_BLACK:
+	movdqa		xxTemp, xxCmp1
+	psubusw	xxTemp, xxSrc3	;psubusw	xxPlus	, xxCmp
+	
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00	;ReReINSPECT_BLACK
+
+REINSPECT_WHITE:
+	movdqa		xxTemp, xxSrc3
+	psubusw	xxTemp, xxCmp1	;psubusw	xxMinus	, xxSrc
+
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00	;ReReINSPECT_WHITE
+
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeakEx, 0h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxPeakEx, 1h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeakEx, 2h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeakEx, 3h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeakEx, 4h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeakEx, 5h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeakEx, 6h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		DEFECT_END
+	
+	pextrw	rax, xxPeakEx, 7h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_END:
+	sub		ix, 7
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+
+
+
+
+PAIRING_VERT:
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*iy], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrBW, dword ptr[rrXoD+ 4*iy]
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrBW, rcx
+	jne		PAIR_TOP
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdBW
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrBW, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdBW
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	mov		rrBW, BuffWidth
+	jmp		PAIRING_VERT_RETURN
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+ConvFloatVert ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatVert6.asm b/Common_Class/SISAssem/ConvFloatVert6.asm
new file mode 100644
index 0000000..3794a22
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatVert6.asm
@@ -0,0 +1,936 @@
+
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprMulti			equ		16
+SprShift			equ		4
+ConvMulti			equ		6
+ConvNSprMulti		equ		96
+
+DReverseShift equ 7		; 1/6捞 酒聪扼 1/8 甫 利侩茄促.  1/16 * 1/8 => 4 + 3 = >>7
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+GraySrc			equ		qword ptr[rbp+ 0b0h]
+GrayCmp			equ		qword ptr[rbp+ 0b8h]
+ZoneId			equ		qword ptr[rbp+ 0c0h]
+ZoneTh			equ		qword ptr[rbp+ 0c8h]
+
+
+i2Pitch16		equ		qword ptr[rbp+ 0d0h]
+bReverseFilter	equ		qword ptr[rbp+ 0d8h]
+DThSlide		equ		qword ptr[rbp+ 0e0h]
+endLine			equ		qword ptr[rbp+ 0e8h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+
+
+rrBW			equ		r8
+rdBW			equ		r8d
+rrNoD			equ		r9
+
+
+rrXoD			equ		r10
+rrYoD			equ		r11
+rrToD			equ		r12
+rrPoD			equ		r13
+
+rrImgAddr		equ		r14
+rrConAddr		equ		r15
+rdConAddr		equ		r15d
+rwConAddr		equ		r15w
+rrPair			equ		rrImgAddr
+
+
+xxZero		equ		xmm0
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+
+xxPeak		equ		xmm4
+xxPeakEx	equ		xmm5
+
+xxfSPR		equ		xmm6
+xxsSPR		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxMinus		equ		xmm10
+xxPlus		equ		xmm11
+
+xxSrc1		equ		xmm10
+xxSrc2		equ		xmm11
+xxCmp1		equ		xmm13
+
+xxDConvMulti	equ	xmm12
+xxDStart	equ		xmm14
+xxDSlide	equ		xmm15
+
+xxSrc3		equ		xxDConvMulti
+xxCmp2		equ		xxDStart
+
+
+
+
+
+
+ConvFloatVert6 PROC
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ImgAddrLeft		: qword
+	local	ImgConLine		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	F_Y2Insp		: qword
+	
+	local	maxPixelD		: qword
+	local	ConPitch		: qword	; 8*iPitch
+	local	ConPitch2		: qword	
+	local	ConAddr			: qword
+	
+	local	ConOrigin		: qword
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword
+	
+	local	iPitch			: qword
+	local	i2Pitch			: qword
+	local	yPlusPitch		: qword	
+	local	ConBottom		: qword
+	
+
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	ADD		rbp, 088h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	add		ConAddr, 20h
+	mov		maxPixelD	, r8
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress			; supress
+	mov			rcx, ConvNSprMulti
+	mul			rcx
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+	mov			rax, Threshold			; Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	mov			rax, Threshold
+	mov			rcx, ConvMulti
+	cdq
+	div			ecx
+	movd		xxDStart, rax
+	movdqa		xxTemp, xxDStart
+	punpcklwd	xxTemp, xxDStart
+	pshufd		xxDStart, xxTemp, 0
+	
+	mov			rax, 6
+	movd		xxDConvMulti, rax
+	movdqa		xxTemp, xxDConvMulti
+	punpcklwd	xxTemp, xxDConvMulti
+	pshufd		xxDConvMulti, xxTemp, 0
+
+	movd		xxDSlide, DThSlide
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+	
+	mov			rax, iPitch16			; iPitch
+	sar			rax, SprShift
+	mov			iPitch, rax
+	
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	
+	cmp			rcx, 8
+	jl			PITCH_H_UP_PASS
+	inc			rax
+PITCH_H_UP_PASS:
+	mov			iPitchHUp, rax
+	
+	movd		xxsSPR, rcx			; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+
+	mov			rax, i2Pitch16		; i2Pitch
+	sar			rax, SprShift
+	mov			i2Pitch, rax
+
+	mov			rax, i2Pitch16
+	and			rax, 0fh
+
+
+
+
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+
+	mov		rax, InspBottom
+	mov		ConBottom, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(16 byte align)
+
+	mov		rax, rrBW
+	mul		InspTop
+	add		rax, ImgAddr
+	add		rax, ix
+	mov		ImgAddrLeft, rax
+	
+;	mov		rax, 20h
+;	mul		InspTop
+;	add		rax, ConOrigin
+;	mov		ConAddr, rax
+
+
+
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+	
+	mov		rax, 20h
+	mul		i2Pitch
+	mov		ConPitch2, rax
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, InspBottom
+	sub		rax, iPitch
+	sub		rax, 2
+	mov		InspBottom, rax
+
+	sub		rax, iPitch
+	mov		pairBottom, rax
+	
+
+	pxor	xmm0, xmm0	
+	;mov		ix, InspLeft
+	;mov		iy, InspTop
+	
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+
+
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	jmp		PAIRING_VERT
+PAIRING_VERT_RETURN:
+
+	add		ImgAddrLeft, 10h
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	
+	mov		iy, InspTop
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		END_FUNC
+
+LOOP_X_BODY:
+	dec		iy
+	sub		rrImgAddr, rrBW
+	sub		rrConAddr, 20h
+	jmp		MAKE_CONBUFF_BODY_TAIL_CHECK
+MAKE_CONBUFF_RETURN:
+
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		F_Y2Insp, 0
+	
+	jmp		LOOP_Y_CHECK
+
+
+
+	
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+LOOP_Y_CHECK:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING_VERT
+	
+	cmp		iy, InspBottom
+	jl		LOOP_Y_BODY
+
+; Y Double Check, Y绵 Conv甫 16 官捞飘 窜困肺 父靛绰单. 八荤绰 8官捞飘究 窍骨肺 2锅 y风橇 倒府扁.
+	add		ix, 8
+	cmp		F_Y2Insp, 1
+	jge		LOOP_X_TAIL	; y_end & goto x_tail
+
+	mov		F_Y2Insp, 1
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	add		rrConAddr, 10h
+
+	jmp		LOOP_Y_BODY
+
+
+
+; Con 滚欺 父甸扁
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxTemp, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxTemp, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxTemp
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc1
+
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, ConBottom
+	jle		MAKE_CONBUFF_BODY_TAIL_CHECK
+	
+	jmp		MAKE_CONBUFF_RETURN
+
+
+
+
+LOOP_Y_BODY:
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶 滚欺
+	movdqu	xxSrc1, [rrConAddr+ 20h]
+	movdqu	xxSrc2, [rrConAddr+ 40h]
+	paddw	xxSrc, xxSrc1
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+
+	movdqa	xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxSrc, xxTemp
+
+
+	mov		rax, rrConAddr				; 厚背 滚欺 钦 父甸扁
+	add		rax, ConPitch
+
+	movdqu	xxCmp, [rax]
+	pmullw	xxCmp, xxfSPR
+
+	movdqu	xxTemp, [rax+ 20h]
+	psllw	xxTemp, SprShift
+	paddw	xxCmp, xxTemp
+	
+	movdqu	xxTemp, [rax+ 40h]
+	psllw	xxTemp, SprShift
+	paddw	xxCmp, xxTemp
+
+	movdqu	xxTemp, [rax+ 60h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+	movdqa		xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxCmp, xxTemp
+
+;jmp	PASS_DTH
+	movdqa	xxThres, xxSrc
+	psrlw	xxThres, DReverseShift	; 1/6捞 措脚 1/8 甫 利侩茄促.  1/16 * 1/8 => 4 + 3 = >>7
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	pmullw	xxThres, xxDConvMulti
+	psllw	xxThres, SprShift
+	
+	PASS_DTH:
+
+
+;	JMP		REINSPECT_PRE
+REINSPECT_RETURN:
+;	JMP		ReReINSPECT_PRE
+ReReINSPECT_RETURN:
+
+INSPECT_BLACK:
+	movdqa		xxPeakEx, xxCmp
+	psubusw		xxPeakEx, xxSrc
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00
+
+INSPECT_WHITE:
+	movdqa		xxPeakEx	, xxSrc
+	psubusw		xxPeakEx	, xxCmp
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00
+
+
+REINSPECT_PRE:
+;JMP		REINSPECT_RETURN
+	paddw	xxCmp1, xxCmp2			; 厚背 滚欺 1+2
+	psllw	xxCmp1, SprShift
+	
+	movdqu	xxSrc3, [rrConAddr- 20h]	; 惑措 滚欺 1+ 2+ 3
+	pmullw	xxSrc3, xxSSPR
+	
+	psllw	xxSrc1, SprShift
+	paddw	xxSrc3, xxSrc1
+	
+	pmullw	xxSrc2, xxFSpr
+	paddw	xxSrc3, xxSrc2
+
+	JMP		REINSPECT_RETURN
+
+REINSPECT_BLACK:
+	movdqa		xxTemp, xxCmp1
+	psubusw	xxTemp, xxSrc3	;psubusw	xxPlus	, xxCmp
+	
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00	;ReReINSPECT_BLACK
+
+REINSPECT_WHITE:
+	movdqa		xxTemp, xxSrc3
+	psubusw	xxTemp, xxCmp1	;psubusw	xxMinus	, xxSrc
+
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00	;ReReINSPECT_WHITE
+
+
+DEFECT_00:
+	mov		rcx, ConvNSprMulti
+	pextrw	rax, xxPeak, 0
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeakEx, 0
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxPeakEx, 1
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeakEx, 2
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeakEx, 3
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeakEx, 4
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeakEx, 5
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeakEx, 6
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7
+	cmp		rax, 0h
+	je		DEFECT_END
+	
+	pextrw	rax, xxPeakEx, 7
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_END:
+	sub		ix, 7
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+
+
+
+
+PAIRING_VERT:
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*iy], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrBW, dword ptr[rrXoD+ 4*iy]
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrBW, rcx
+	jne		PAIR_TOP
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rrPair, PairAddr
+	
+	mov		(astPair ptr [rrPair]).pos, 1
+	mov		(astPair ptr [rrPair]).pair, 1
+	mov		(astPair ptr [rrPair]).x, ecx
+	mov		(astPair ptr [rrPair]).y, edx
+	mov		(astPair ptr [rrPair]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rrPair]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).ref, eax
+
+
+	add		rrPair, PairSize
+	mov		PairAddr, rrPair
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rrPair, PairAddr
+
+	mov		(astPair ptr [rrPair]).pos, 1
+	mov		(astPair ptr [rrPair]).pair, 5
+	mov		(astPair ptr [rrPair]).x, rdBW
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rrPair]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rrPair]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rrPair]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).ref, eax
+
+	add		rrPair, PairSize
+	mov		PairAddr, rrPair
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrBW, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rrPair, PairAddr
+	
+	mov		(astPair ptr [rrPair]).pos, 2
+	mov		(astPair ptr [rrPair]).pair, 1
+	mov		(astPair ptr [rrPair]).x, ecx
+	mov		(astPair ptr [rrPair]).y, edx
+	mov		(astPair ptr [rrPair]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rrPair]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).ref, eax
+
+	add		rrPair, PairSize
+	mov		PairAddr, rrPair
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rrPair, PairAddr
+	mov		(astPair ptr [rrPair]).pos, 3
+	mov		(astPair ptr [rrPair]).pair, 5
+	mov		(astPair ptr [rrPair]).x, rdBW
+	mov		(astPair ptr [rrPair]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rrPair]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rrPair]).peak, edx
+
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).src, eax
+
+	add		rrPair, PairSize
+	mov		PairAddr, rrPair
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	mov		rrBW, BuffWidth
+	jmp		PAIRING_VERT_RETURN
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+;	pop		rbp
+
+RET
+ConvFloatVert6 ENDP
+
+
+ConvFloatDPCE PROC
+RET
+ConvFloatDPCE ENDP
+end
diff --git a/Common_Class/SISAssem/ConvFloatVert9.asm b/Common_Class/SISAssem/ConvFloatVert9.asm
new file mode 100644
index 0000000..826e100
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatVert9.asm
@@ -0,0 +1,941 @@
+
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift			equ		4
+SprMulti			equ		16
+SprHalf				equ		8
+ConvMulti			equ		9
+ConvNSprMulti		equ		144
+
+
+DReverseShift equ 7		; DTH 拌魂且 锭 1/9措脚 1/8阑 利侩茄促. 1/16+ 1/8 => 4 + 3 =>  >>7
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+GraySrc			equ		qword ptr[rbp+ 0b0h]
+GrayCmp			equ		qword ptr[rbp+ 0b8h]
+ZoneId			equ		qword ptr[rbp+ 0c0h]
+ZoneTh			equ		qword ptr[rbp+ 0c8h]
+
+
+i2Pitch16		equ		qword ptr[rbp+ 0d0h]
+bReverseFilter	equ		qword ptr[rbp+ 0d8h]
+DThSlide		equ		qword ptr[rbp+ 0e0h]
+endLine			equ		qword ptr[rbp+ 0e8h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+
+
+rrBW			equ		r8
+rdBW			equ		r8d
+rrNoD			equ		r9
+
+
+rrXoD			equ		r10
+rrYoD			equ		r11
+rrToD			equ		r12
+rrPoD			equ		r13
+
+rrImgAddr		equ		r14
+rrConAddr		equ		r15
+rdConAddr		equ		r15d
+rwConAddr		equ		r15w
+rrPair			equ		rrImgAddr
+
+
+xxZero		equ		xmm0
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+
+xxPeak		equ		xmm4
+xxPeakEx	equ		xmm5
+
+xxfSPR		equ		xmm6
+xxsSPR		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxMinus		equ		xmm10
+xxPlus		equ		xmm11
+
+xxSrc1		equ		xmm10
+xxSrc2		equ		xmm11
+xxCmp1		equ		xmm13
+
+xxDConvMulti	equ	xmm12
+xxDStart	equ		xmm14
+xxDSlide	equ		xmm15
+
+xxSrc3		equ		xxDConvMulti
+xxCmp2		equ		xxDStart
+
+
+
+
+
+
+ConvFloatVert9 PROC
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ImgAddrLeft		: qword
+	local	ImgConLine		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	F_Y2Insp		: qword
+	
+	local	maxPixelD		: qword
+	local	ConPitch		: qword	; 8*iPitch
+	local	ConPitch2		: qword	
+	local	ConAddr			: qword
+	
+	local	ConOrigin		: qword
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword
+	
+	local	iPitch			: qword
+	local	i2Pitch			: qword
+	local	yPlusPitch		: qword	
+	local	ConBottom		: qword
+	
+
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	ADD		rbp, 088h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	add		ConAddr, 20h
+	mov		maxPixelD	, r8
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress			; supress
+	mov			rcx, ConvNSprMulti
+	mul			rcx
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+	mov			rax, Threshold			; Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	mov			rax, Threshold
+	mov			rcx, ConvMulti
+	cdq
+	div			ecx
+	movd		xxDStart, rax
+	movdqa		xxTemp, xxDStart
+	punpcklwd	xxTemp, xxDStart
+	pshufd		xxDStart, xxTemp, 0
+	
+	mov			rax, ConvMulti
+	movd		xxDConvMulti, rax
+	movdqa		xxTemp, xxDConvMulti
+	punpcklwd	xxTemp, xxDConvMulti
+	pshufd		xxDConvMulti, xxTemp, 0
+
+	movd		xxDSlide, DThSlide
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+	
+	mov			rax, iPitch16			; iPitch
+	sar			rax, SprShift
+	mov			iPitch, rax
+	
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	
+	cmp			rcx, SprHalf
+	jl			PITCH_H_UP_PASS
+	inc			rax
+PITCH_H_UP_PASS:
+	mov			iPitchHUp, rax
+	
+	movd		xxsSPR, rcx			; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+
+	mov			rax, i2Pitch16		; i2Pitch
+	sar			rax, SprShift
+	mov			i2Pitch, rax
+
+	mov			rax, i2Pitch16
+	and			rax, 0fh
+
+
+
+
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+
+	mov		rax, InspBottom
+	mov		ConBottom, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(16 byte align)
+
+	mov		rax, rrBW
+	mul		InspTop
+	add		rax, ImgAddr
+	add		rax, ix
+	mov		ImgAddrLeft, rax
+	
+;	mov		rax, 20h
+;	mul		InspTop
+;	add		rax, ConOrigin
+;	mov		ConAddr, rax
+
+
+
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+	
+	mov		rax, 20h
+	mul		i2Pitch
+	mov		ConPitch2, rax
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, InspBottom
+	sub		rax, iPitch
+	sub		rax, 2
+	mov		InspBottom, rax
+
+	sub		rax, iPitch
+	mov		pairBottom, rax
+	
+
+	pxor	xmm0, xmm0	
+	;mov		ix, InspLeft
+	;mov		iy, InspTop
+	
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+
+
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	jmp		PAIRING_VERT
+PAIRING_VERT_RETURN:
+
+	add		ImgAddrLeft, 10h
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	
+	mov		iy, InspTop
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		END_FUNC
+
+LOOP_X_BODY:
+	dec		iy
+	sub		rrImgAddr, rrBW
+	sub		rrConAddr, 20h
+	jmp		MAKE_CONBUFF_BODY_TAIL_CHECK
+MAKE_CONBUFF_RETURN:
+
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		F_Y2Insp, 0
+	
+	jmp		LOOP_Y_CHECK
+
+
+
+	
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+LOOP_Y_CHECK:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING_VERT
+	
+	cmp		iy, InspBottom
+	jl		LOOP_Y_BODY
+
+; Y Double Check, Y绵 Conv甫 16 官捞飘 窜困肺 父靛绰单. 八荤绰 8官捞飘究 窍骨肺 2锅 y风橇 倒府扁.
+	add		ix, 8
+	cmp		F_Y2Insp, 1
+	jge		LOOP_X_TAIL	; y_end & goto x_tail
+
+	mov		F_Y2Insp, 1
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	add		rrConAddr, 10h
+
+	jmp		LOOP_Y_BODY
+
+
+
+; Con 滚欺 父甸扁
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxTemp, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxTemp, xmm0
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxTemp
+
+	movdqu		xxCmp, [rrImgAddr+ 2]
+	movdqa		xxTemp, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxTemp, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxTemp
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc1
+
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, ConBottom
+	jle		MAKE_CONBUFF_BODY_TAIL_CHECK
+	
+	jmp		MAKE_CONBUFF_RETURN
+
+
+
+
+LOOP_Y_BODY:
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶 滚欺
+	movdqu	xxSrc1, [rrConAddr+ 20h]
+	movdqu	xxSrc2, [rrConAddr+ 40h]
+	paddw	xxSrc, xxSrc1
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+
+	movdqa	xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxSrc, xxTemp
+
+
+	mov		rax, rrConAddr				; 厚背 滚欺 钦 父甸扁
+	add		rax, ConPitch
+
+	movdqu	xxCmp, [rax]
+	pmullw	xxCmp, xxfSPR
+
+	movdqu	xxTemp, [rax+ 20h]
+	psllw	xxTemp, SprShift
+	paddw	xxCmp, xxTemp
+	
+	movdqu	xxTemp, [rax+ 40h]
+	psllw	xxTemp, SprShift
+	paddw	xxCmp, xxTemp
+
+	movdqu	xxTemp, [rax+ 60h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+	movdqa		xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxCmp, xxTemp
+
+;jmp	PASS_DTH
+	movdqa	xxThres, xxSrc
+	psrlw	xxThres, DReverseShift	; 1/6捞 酒聪扼 6/36捞瘤父 6/32 甫 利侩茄促. >>7
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	pmullw	xxThres, xxDConvMulti
+	psllw	xxThres, SprShift
+	
+	PASS_DTH:
+
+
+;	JMP		REINSPECT_PRE
+REINSPECT_RETURN:
+;	JMP		ReReINSPECT_PRE
+ReReINSPECT_RETURN:
+
+INSPECT_BLACK:
+	movdqa		xxPeakEx, xxCmp
+	psubusw		xxPeakEx, xxSrc
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00
+
+INSPECT_WHITE:
+	movdqa		xxPeakEx	, xxSrc
+	psubusw		xxPeakEx	, xxCmp
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00
+
+
+REINSPECT_PRE:
+;JMP		REINSPECT_RETURN
+	paddw	xxCmp1, xxCmp2			; 厚背 滚欺 1+2
+	psllw	xxCmp1, SprShift
+	
+	movdqu	xxSrc3, [rrConAddr- 20h]	; 惑措 滚欺 1+ 2+ 3
+	pmullw	xxSrc3, xxSSPR
+	
+	psllw	xxSrc1, SprShift
+	paddw	xxSrc3, xxSrc1
+	
+	pmullw	xxSrc2, xxFSpr
+	paddw	xxSrc3, xxSrc2
+
+	JMP		REINSPECT_RETURN
+
+REINSPECT_BLACK:
+	movdqa		xxTemp, xxCmp1
+	psubusw	xxTemp, xxSrc3	;psubusw	xxPlus	, xxCmp
+	
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00	;ReReINSPECT_BLACK
+
+REINSPECT_WHITE:
+	movdqa		xxTemp, xxSrc3
+	psubusw	xxTemp, xxCmp1	;psubusw	xxMinus	, xxSrc
+
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00	;ReReINSPECT_WHITE
+
+
+DEFECT_00:
+	mov		rcx, ConvNSprMulti
+	pextrw	rax, xxPeak, 0
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeakEx, 0
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxPeakEx, 1
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeakEx, 2
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeakEx, 3
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeakEx, 4
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeakEx, 5
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeakEx, 6
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7
+	cmp		rax, 0h
+	je		DEFECT_END
+	
+	pextrw	rax, xxPeakEx, 7
+	cdq
+	idiv		rcx
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rdx, GraySrc
+	mov		[rdx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rdx, GrayCmp
+	mov		[rdx+ 4*rrNoD], eax
+	inc		rrNoD
+
+DEFECT_END:
+	sub		ix, 7
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+
+
+
+
+PAIRING_VERT:
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*iy], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrBW, dword ptr[rrXoD+ 4*iy]
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrBW, rcx
+	jne		PAIR_TOP
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rrPair, PairAddr
+	
+	mov		(astPair ptr [rrPair]).pos, 1
+	mov		(astPair ptr [rrPair]).pair, 1
+	mov		(astPair ptr [rrPair]).x, ecx
+	mov		(astPair ptr [rrPair]).y, edx
+	mov		(astPair ptr [rrPair]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rrPair]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).ref, eax
+
+
+	add		rrPair, PairSize
+	mov		PairAddr, rrPair
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rrPair, PairAddr
+
+	mov		(astPair ptr [rrPair]).pos, 1
+	mov		(astPair ptr [rrPair]).pair, 5
+	mov		(astPair ptr [rrPair]).x, rdBW
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rrPair]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rrPair]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rrPair]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).ref, eax
+
+	add		rrPair, PairSize
+	mov		PairAddr, rrPair
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrBW, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rrPair, PairAddr
+	
+	mov		(astPair ptr [rrPair]).pos, 2
+	mov		(astPair ptr [rrPair]).pair, 1
+	mov		(astPair ptr [rrPair]).x, ecx
+	mov		(astPair ptr [rrPair]).y, edx
+	mov		(astPair ptr [rrPair]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rrPair]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*rbx]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*rbx]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).ref, eax
+
+	add		rrPair, PairSize
+	mov		PairAddr, rrPair
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rrPair, PairAddr
+	mov		(astPair ptr [rrPair]).pos, 3
+	mov		(astPair ptr [rrPair]).pair, 5
+	mov		(astPair ptr [rrPair]).x, rdBW
+	mov		(astPair ptr [rrPair]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rrPair]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rrPair]).peak, edx
+
+	
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+;	mov		rrConAddr, ConvNSprMulti
+	cdq
+	div		rrConAddr
+	mov		(astPair ptr [rrPair]).src, eax
+
+	add		rrPair, PairSize
+	mov		PairAddr, rrPair
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	mov		rrBW, BuffWidth
+	jmp		PAIRING_VERT_RETURN
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+;	pop		rbp
+
+RET
+ConvFloatVert9 ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloatVert_BOE.asm b/Common_Class/SISAssem/ConvFloatVert_BOE.asm
new file mode 100644
index 0000000..f376f57
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloatVert_BOE.asm
@@ -0,0 +1,953 @@
+
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+ConvNSprShift		equ		6	; shift 2 & shift 4
+SprShift			equ		4
+ConvShift			equ		2
+SprMulti			equ		16
+ConvMulti			equ		4
+
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+GraySrc			equ		qword ptr[rbp+ 0b0h]
+GrayCmp			equ		qword ptr[rbp+ 0b8h]
+ZoneId			equ		qword ptr[rbp+ 0c0h]
+ZoneTh			equ		qword ptr[rbp+ 0c8h]
+
+i2Pitch16		equ		qword ptr[rbp+ 0d0h]
+bReverseFilter	equ		qword ptr[rbp+ 0d8h]
+DThSlide		equ		qword ptr[rbp+ 0e0h]
+endLine			equ		qword ptr[rbp+ 0e8h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+
+
+
+
+rrBW			equ		r8
+rdBW			equ		r8d
+rrNoD			equ		r9
+
+rrXoD			equ		r10
+rrYoD			equ		r11
+rrToD			equ		r12
+rrPoD			equ		r13
+rrImgAddr		equ		r14
+rrConAddr		equ		r15
+rdConAddr		equ		r15d
+rwConAddr		equ		r15w
+
+
+xxZero		equ		xmm0
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+
+xxPeak		equ		xmm4
+xxPeakEx	equ		xmm5
+
+xxfSPR		equ		xmm6
+xxsSPR		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxDStart	equ		xmm12
+xxDSlide	equ		xmm15
+
+xxSrc1		equ		xmm10
+xxSrc2		equ		xmm11
+xxSrc3		equ		xmm12
+xxCmp1		equ		xmm13
+xxCmp2		equ		xmm14
+xxCmp3		equ		xmm15
+
+
+
+
+
+
+ConvFloatVert_BOE PROC
+	local	ImgAddr			: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ImgAddrLeft		: qword
+	local	ImgConLine		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	F_Y2Insp		: qword
+	
+	local	maxPixelD		: qword
+	local	ConPitch		: qword	; 8*iPitch
+	local	ConPitch2		: qword	
+	local	ConAddr			: qword
+	
+	local	ConOrigin		: qword
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword
+	
+	local	iPitch			: qword
+	local	i2Pitch			: qword
+	local	yPlusPitch		: qword	
+	local	ConBottom		: qword
+	
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 088h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	add		ConAddr, 20h
+	mov		maxPixelD	, r8
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Threshold			; Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+	movdqa		xxDStart, xxThres
+	psrlw		xxDStart, ConvNSprShift
+	
+	movd		xxDSlide, DThSlide
+	movdqa		xmm0, xxDSlide
+	punpcklwd	xmm0, xxDSlide
+	pshufd		xxDSlide, xmm0, 0
+
+	mov			rax, Suppress			; supress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+	
+	
+	mov			rax, iPitch16			; iPitch
+	sar			rax, SprShift
+	mov			iPitch, rax
+	
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	
+	cmp			rcx, 8
+	jl			PITCH_H_UP_PASS
+	inc			rax
+PITCH_H_UP_PASS:
+	mov			iPitchHUp, rax
+	
+	movd		xxsSPR, rcx			; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+	
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+
+	mov			rax, i2Pitch16		; i2Pitch
+	sar			rax, SprShift
+	mov			i2Pitch, rax
+
+	mov			rax, i2Pitch16
+	and			rax, 0fh
+
+
+
+
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	;辑脓矾俊辑 磷绢辑 Bottom 俊辑 1 哗霖促.(BOE)
+	mov		rax, InspBottom
+	sub		rax, 1
+	mov		InspBottom, rax
+	
+	mov		rax, InspBottom
+	mov		ConBottom, rax
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(16 byte align)
+
+	mov		rax, rrBW
+	mul		InspTop
+	add		rax, ImgAddr
+	add		rax, ix
+	mov		ImgAddrLeft, rax
+
+;	mov		rax, 20h
+;	mul		InspTop
+;	add		rax, ConOrigin
+;	mov		ConAddr, rax
+
+
+
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+
+	mov		rax, 20h
+	mul		i2Pitch
+	mov		ConPitch2, rax
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+
+	mov		rax, InspBottom
+	sub		rax, iPitch
+	;菊俊辑 1 哗玲扁 锭巩俊 1父 哗淋(BOE) //sub		rax, 2
+	sub		rax, 1
+	mov		InspBottom, rax
+
+	sub		rax, iPitch
+	mov		pairBottom, rax
+
+
+	pxor	xmm0, xmm0	
+	;mov		ix, InspLeft
+	;mov		iy, InspTop
+	
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+
+
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	jmp		PAIRING_VERT
+PAIRING_VERT_RETURN:
+
+	add		ImgAddrLeft, 10h
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	
+	mov		iy, InspTop
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		END_FUNC
+
+LOOP_X_BODY:
+	;dec		iy						; top栏肺 1 pixel 歹 父电促. 开规氢 八刘困秦(辑脓矾滚欺俊辑 磷绢辑 林籍贸府)
+	;sub		rrImgAddr, rrBW
+	;sub		rrConAddr, 20h
+	jmp		MAKE_CONBUFF_BODY_TAIL_CHECK
+MAKE_CONBUFF_RETURN:
+
+
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	mov		F_Y2Insp, 0
+	
+	jmp		LOOP_Y_CHECK
+
+
+
+	
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+LOOP_Y_CHECK:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING_VERT
+	
+	cmp		iy, InspBottom
+	jl		LOOP_Y_BODY
+
+; Y Double Check, Y绵 Conv甫 16 官捞飘 窜困肺 父靛绰单. 八荤绰 8官捞飘究 窍骨肺 2锅 y风橇 倒府扁.
+	add		ix, 8
+	cmp		F_Y2Insp, 1
+	jge		LOOP_X_TAIL	; y_end & goto x_tail
+
+	mov		F_Y2Insp, 1
+	mov		iy, InspTop
+	mov		rrConAddr, ConAddr
+	add		rrConAddr, 10h
+
+	jmp		LOOP_Y_BODY
+
+
+
+; Con 滚欺 父甸扁
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc1
+
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, ConBottom
+	jle		MAKE_CONBUFF_BODY_TAIL_CHECK
+	
+	jmp		MAKE_CONBUFF_RETURN
+
+
+
+
+LOOP_Y_BODY:
+
+	movdqu	xxSrc1, [rrConAddr]			; 家胶 滚欺
+	movdqu	xxSrc2, [rrConAddr+ 20h]
+	movdqa	xxSrc, xxSrc1
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+
+	movdqa	xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxSrc, xxTemp
+
+
+	mov		rax, rrConAddr				; 厚背 滚欺 钦 父甸扁
+	add		rax, ConPitch
+
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp, xxCmp1
+	pmullw		xxCmp, xxfSPR
+
+	movdqu		xxCmp2, [rax+ 20h]
+	movdqa		xxTemp, xxCmp2
+	psllw		xxTemp, SprShift
+	paddw		xxCmp, xxTemp
+	
+	movdqu		xxTemp, [rax+ 40h]
+	pmullw		xxTemp, xxsSPR
+	paddw		xxCmp, xxTemp
+
+	movdqa		xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw		xxTemp, xxSupp
+	psubusw		xxCmp, xxTemp
+
+	movdqa		xxThres, xxSrc
+	pmaxuw		xxThres, xxCmp
+	psrlw		xxThres, ConvNSprShift
+	pmullw		xxThres, xxDSlide
+	psrlw		xxThres, 8
+	paddw		xxThres, xxDStart
+	psllw		xxThres, ConvNSprShift
+
+
+;	JMP		REINSPECT_PRE
+REINSPECT_RETURN:
+;	JMP		ReReINSPECT_PRE
+ReReINSPECT_RETURN:
+
+
+INSPECT_BLACK:
+	movdqa		xxPeakEx, xxCmp
+	psubusw		xxPeakEx, xxSrc
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00
+
+INSPECT_WHITE:
+	movdqa		xxPeakEx	, xxSrc
+	psubusw		xxPeakEx	, xxCmp
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00
+
+
+REINSPECT_PRE:
+;JMP		REINSPECT_RETURN
+	paddw	xxCmp1, xxCmp2			; 厚背 滚欺 1+2
+	psllw	xxCmp1, SprShift
+	
+	movdqu	xxSrc3, [rrConAddr- 20h]	; 惑措 滚欺 1+ 2+ 3
+	pmullw	xxSrc3, xxSSPR
+	
+	psllw	xxSrc1, SprShift
+	paddw	xxSrc3, xxSrc1
+	
+	pmullw	xxSrc2, xxFSpr
+	paddw	xxSrc3, xxSrc2
+
+	JMP		REINSPECT_RETURN
+
+REINSPECT_BLACK:
+	movdqa		xxTemp, xxCmp1
+	psubusw	xxTemp, xxSrc3	;psubusw	xxPlus	, xxCmp
+	
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00	;ReReINSPECT_BLACK
+
+REINSPECT_WHITE:
+	movdqa		xxTemp, xxSrc3
+	psubusw	xxTemp, xxCmp1	;psubusw	xxMinus	, xxSrc
+
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00	;ReReINSPECT_WHITE
+
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeakEx, 0h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 0h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 0h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxPeakEx, 1h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 1h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 1h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeakEx, 2h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 2h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 2h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeakEx, 3h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 3h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 3h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeakEx, 4h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 4h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 4h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeakEx, 5h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 5h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 5h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeakEx, 6h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 6h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 6h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		DEFECT_END
+	
+	pextrw	rax, xxPeakEx, 7h
+	sar		rax, ConvNSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+
+	pextrw	rax, xxSrc, 7h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 7h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_END:
+	sub		ix, 7
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+
+
+
+
+PAIRING_VERT:
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*iy], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrBW, dword ptr[rrXoD+ 4*iy]
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrBW, rcx
+	jne		PAIR_TOP
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+	
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdBW
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).thre, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrBW, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+	
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdBW
+	mov		(astPair ptr [rcx]).y, eax
+	
+	;搬窃鸥涝 滚弊 荐沥(BOE)
+	movsx	edx, word ptr[rrToD+ 2*iy]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+	
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		eax, [rdx+ 4*iy]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).thre, eax
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	mov		rrBW, BuffWidth
+	jmp		PAIRING_VERT_RETURN
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+ConvFloatVert_BOE ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvFloat_BOE.asm b/Common_Class/SISAssem/ConvFloat_BOE.asm
new file mode 100644
index 0000000..af13ff3
--- /dev/null
+++ b/Common_Class/SISAssem/ConvFloat_BOE.asm
@@ -0,0 +1,827 @@
+
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+ConvNSprShift		equ		6	; shift 2 & shift 4
+SprShift			equ		4
+ConvShift			equ		2
+SprMulti			equ		16
+ConvMulti			equ		4
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+GraySrc			equ		qword ptr[rbp+ 0b0h]
+GrayCmp			equ		qword ptr[rbp+ 0b8h]
+ZoneId			equ		qword ptr[rbp+ 0c0h]
+ZoneTh			equ		qword ptr[rbp+ 0c8h]
+
+bReverseFilter	equ		qword ptr[rbp+ 0d0h]
+DThSlide		equ		qword ptr[rbp+ 0d8h]
+endLine			equ		qword ptr[rbp+ 0e0h]
+
+
+ix			equ		rsi
+ix32		equ		esi
+iy			equ		rdi
+iy32		equ		edi
+
+
+rrBW		equ		r8
+rdBW		equ		r8d
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+
+rrImgAddr	equ		r14
+rrConAddr	equ		r15
+rdConAddr	equ		r15d
+rwConAddr	equ		r15w
+
+
+xxTemp		equ		xmm1
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus		equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12
+xxPeak2		equ		xmm13
+
+xxDSlide	equ		xmm14
+xxDStart	equ		xmm15
+
+
+ConvFloat_BOE PROC C
+	local	ImgAddr				: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ConAddr				: qword
+	local	ConAddrLine			: qword
+	local	InspLength			: qword
+	
+	local	ImgConLine			: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	ConConLine			: qword
+	local	ConLength			: qword
+	local	ConConLineEnd		: qword
+	
+	local	BlackNWhite			: qword
+	local	maxDefect			: qword
+	local	iPitch2				: qword	
+	local	pairLeft			: qword
+
+	local	pairRight			: qword
+	local	iPitchHUp			: qword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 078h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	mov		maxDefect	, r8
+	mov		rrNoD		, r9
+	mov		rrBW		, BuffWidth
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax		; supress
+	movdqa		xmm0, xxSupp
+	;punpcklbw	xxSupp, xmm0
+	;movdqa		xmm0, xxSupp
+	;punpcklbw	xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+	mov			rax, Threshold
+	sal			rax, SprShift
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+	movdqa		xxDStart, xxThres
+	psrlw		xxDStart, ConvNSprShift
+	
+
+	movd		xxDSlide, DThSlide
+	movdqa		xmm0, xxDSlide
+	punpcklwd	xmm0, xxDSlide
+	pshufd		xxDSlide, xmm0, 0
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch16, rax
+	mov		iPitchHUp, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		iPitchHUp
+	PITCH_H_UP_PASS:
+
+
+	mov		rax, iPitch16
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+
+	mov		rax, ConAddr
+	mov		ConConLine, rax
+	mov		ConAddrLine, rax
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sal		rax, 1
+	add		rax, ConAddr
+	mov		ConConLineEnd, rax
+	
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch16
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(8 byte align)
+	
+	; 辑脓矾滚欺 背眉矫 磷绢辑 ROI 函版(BOE)
+	mov		rax, InspBottom		
+	sub		rax, 2
+	mov		InspBottom, rax
+
+
+; 捞固瘤 矫累 林家 父甸扁.
+
+	mov		rax, rrBw	; rrImgAddr= rrImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		rax, ImgAddr
+	mov		ImgConLine, rax
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+	pxor	xmm0, xmm0
+	
+	mov		rax, ix
+	add		rax, iPitch16
+	mov		pairLeft, rax
+	
+	mov		rax, InspRight
+	sub		rax, iPitch16
+	mov		pairRight, rax
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	jmp		MAKE_CON_BUFF
+
+NEXT_LINE:	; 概 扼牢付促 林家 犁瘤沥
+	
+	jmp		PAIRING_HORI
+	PAIRING_HORI_RETURN:
+
+	inc		iy						; Loop Y
+
+	add		ImgConLine		, rrBW
+
+	mov		rrConAddr, ConConLine
+	mov		rrImgAddr, ImgConLine
+
+MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	movdqu		xmm2, [rrImgAddr]
+	movdqa		xmm3, xmm2
+	punpcklbw	xmm2, xmm0
+	punpckhbw	xmm3, xmm0
+	
+	movdqu		xmm4, [rrImgAddr+ rrBW]
+	movdqa		xmm5, xmm4
+	punpcklbw	xmm4, xmm0
+	punpckhbw	xmm5, xmm0
+	paddw		xmm2, xmm4
+	paddw		xmm3, xmm5
+	movdqu		[rrConAddr], xmm2
+	movdqu		[rrConAddr+ 10h], xmm3
+	
+	add		rrImgAddr, 10h
+	add		rrConAddr, 20h
+	cmp		rrConAddr, ConConLineEnd
+	jle		MAKE_CON_BUFF
+
+	mov		rrConAddr, ConAddrLine
+	mov		ix, InspLeft
+;	inc		iy
+
+
+Conv_8:			; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+	mov		rax, iPitch2
+	add		rax, rrConAddr
+	movdqu	xxCmp, [rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rax+ 4]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+	movdqa	xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxCmp, xmm1
+
+
+	movdqu	xxSrc, [rrConAddr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xmm1, [rrConAddr+ 2]
+	paddw	xxSrc, xmm1
+	
+	psllw	xxSrc, SprShift		; SPR
+
+	movdqa	xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xmm1, xxSupp
+	psubusw	xxSrc, xmm1
+	
+;	jmp		DTH_PASS
+	movdqa	xxThres, xxSrc
+	pmaxuw	xxThres, xxCmp
+	psrlw	xxThres, ConvNSprShift
+	pmullw	xxThres, xxDSlide
+	psrlw	xxThres, 8
+	paddw	xxThres, xxDStart
+	psllw	xxThres, ConvNSprShift
+;	DTH_PASS:
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+	
+Inspect_Black:
+	mov			BlackNWhite, 0
+	mov			bx, 0
+	movdqa		xxPeak, xxMinus
+	movdqa		xxPeak2, xxMinus
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	jne		DEFECT_00
+
+Inspect_White:
+	mov			BlackNWhite, 1
+	mov			bx, 1
+	movdqa		xxPeak, xxPlus
+	movdqa		xxPeak2, xxPlus
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	jne		DEFECT_00
+
+End_8_Pixel:
+	cmp		rrNoD, maxDefect
+	jge		PAIRING_HORI
+
+	add		ix, 8					; Loop X
+	add		rrConAddr, 16			; 14= 16- 2
+	cmp		ix, InspRight
+	jl		Conv_8
+
+	cmp		iy, InspBottom
+	jl		NEXT_LINE
+
+	jmp		END_FUNC
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	sar		rax, ConvNSprShift
+	call	PixelAddF_BOE
+
+	pextrw	rax, xxSrc, 0h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 0h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax	
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 0h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	sar		rax, ConvNSprShift
+	call	PixelAddF_BOE
+
+	pextrw	rax, xxSrc, 1h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 1h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 1h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	sar		rax, ConvNSprShift
+	call	PixelAddF_BOE
+
+	pextrw	rax, xxSrc, 2h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 2h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 2h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	sar		rax, ConvNSprShift
+	call	PixelAddF_BOE
+
+	pextrw	rax, xxSrc, 3h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 3h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 3h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	sar		rax, ConvNSprShift
+	call	PixelAddF_BOE
+
+	pextrw	rax, xxSrc, 4h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 4h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 4h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	sar		rax, ConvNSprShift
+	call	PixelAddF_BOE
+
+	pextrw	rax, xxSrc, 5h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 5h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 5h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	sar		rax, ConvNSprShift
+	call	PixelAddF_BOE
+
+	pextrw	rax, xxSrc, 6h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 6h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 6h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxPeak2, 7h
+	sar		rax, ConvNSprShift
+	call	PixelAddF_BOE
+
+	pextrw	rax, xxSrc, 7h
+	mov		rcx, GraySrc
+	mov		[rcx+ 4*rrNoD], eax
+	pextrw	rax, xxCmp, 7h
+	mov		rcx, GrayCmp
+	mov		[rcx+ 4*rrNoD], eax
+	
+	;Threshold 眠免(BOE)
+	pextrw	rax, xxThres, 7h
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rrNoD], eax	
+	inc		rrNoD
+
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+
+PAIRING_HORI:
+	mov		ix, -1
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, ix
+	movsxd	rcx, dword ptr [rrXoD+ 4*ix]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+	
+
+	cmp		rcx, pairRight
+	jg		PAIR_RIGHT
+
+	cmp		rcx, pairLeft
+	jge		PAIR_CENTER
+
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_LEFT ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_LEFT_UNPAIR:
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+	
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*ix]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrXoD+ 4*rbx]			; Filter_1_Pair_Position
+	cmp		rdx, rax
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*ix]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	mov		rdx, GraySrc
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).src, ecx
+	mov		rdx, GrayCmp
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).ref, ecx
+	
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		ecx, [rdx+ 4*rbx]
+	sar		ecx, ConvNSprShift
+	mov		(astPair ptr [rax]).thre, ecx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_RIGHT:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, eax
+	mov		(astPair ptr [rcx]).y, iy32
+
+	movsx	edx, word ptr[rrToD+ 2*rbx]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rcx]).peak, edx
+
+
+	mov		rdx, GraySrc
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).ref, eax
+	mov		rdx, GrayCmp
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).src, eax
+	
+	;Threshold 眠免(BOE)
+	mov		rdx, ZoneTh
+	mov		eax, [rdx+ 4*ix]
+	sar		eax, ConvNSprShift
+	mov		(astPair ptr [rcx]).thre, eax
+
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_HORI_RETURN
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvFloat_BOE ENDP
+
+
+PixelAddF_BOE	PROC
+	mov		[rrXoD], ix32
+	mov		[rrYoD], iy32
+	mov		[rrToD], bx
+	mov		[rrPoD], ax
+
+	add		rrXoD, 4
+	add		rrYoD, 4
+	add		rrToD, 2
+	add		rrPoD, 2
+RET
+PixelAddF_BOE	ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvPixel.asm b/Common_Class/SISAssem/ConvPixel.asm
new file mode 100644
index 0000000..7138522
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixel.asm
@@ -0,0 +1,1102 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+	
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8		; x, y 阿 4 byte
+
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSrc3		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+xxSupp		equ		xxSrc3
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+; 肺拿 函荐
+
+
+ConvPixel PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	exPtrn			: qword
+	local	exPtrn1			: qword
+	local	eyPtrn			: qword	
+	local	pairLeft		: qword
+	
+	local	pairRight		: qword
+	local	iPitchHUp		: qword
+
+	local	c8Pixel		: dword
+
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 090h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+	
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+	
+	sub		rax, iPitch
+	mov		pairRight, rax
+
+	mov		rax, InspLeft
+	add		rax, iPitch
+	mov		pairLeft, rax
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+;	mov		rrZIdD, ZoneID
+;	mov		rrZThD, ZoneTh
+
+
+	jmp		NOT_ZONE_PASS
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		exPtrn1, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+
+NOT_ZONE_PASS:
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING
+	_return_PAIRING:
+
+	inc		iy
+
+LOOP_1_CHECK:
+	cmp		iy, InspBottom
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		ix, InspLeft
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+;	cmp		iy, eyPtrn
+;	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+
+LOOP_2_TAIL:
+	add		rrImgAddr, 010h
+LOOP_2_CHECK:
+	cmp		ix, InspRight
+	jge		LOOP_1_TAIL
+	
+;	cmp		ix, exPtrn
+;	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, szyMatch
+	add		pMatch1, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jle		EXCESS_1_BOUND
+	mov		rdx, rax
+EXCESS_1_BOUND:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, pMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch2, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dxPtrn
+	cmp		rax, InspRight
+	jl		EXCESS_2_BOUND
+	mov		rdx, rax
+EXCESS_2_BOUND:
+	mov		exPtrn, rdx						; eyPtrn	mov		rdx, ix
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch2, ebx
+	mov		rax, iy
+	sub		rax, rbx
+	mov		rbx, rdx
+	mul		ZoneTableW							; y*width
+
+
+	add		rax, rbx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+;	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+;	mov		ZoneIdAddr1, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, iPitch				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	movdqu		xxCmp1, [rax]
+;	movdqa		xxCmp4, xxCmp1
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+
+	movdqu	xxCmp3, [rax+ 1]
+
+	movdqu	xxTemp, xxCmp3	
+	punpcklbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr
+	paddw	xxCmp1, xxTemp
+
+	movdqu	xxTemp, xxCmp3	
+	punpckhbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr	
+	paddw	xxCmp2, xxTemp
+	
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING
+
+	inc		ix
+;	add		ZoneThAddr, 010h
+;	add		ZoneIdAddr, 010h
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		_return_XMM_COMPARE				; BE_RD CHECK
+	
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 7
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+_XMM_COMPARE_VERIFY:
+	cmp		bRFilter, 1
+	jne		DEFECT_00
+; 荐沥秦具 等促.. xxSrc3阑 肺爹秦具茄促.
+	movdqu		xxSrc3, [rrImgAddr- 1]
+	movdqa		xxSrc4, xxSrc3
+	punpcklbw	xxSrc3, xmm0
+	punpckhbw	xxSrc4, xmm0
+
+	cmp		c8Pixel, 1
+	jge		COMPARE_VERIFY_LOAD_SECOND
+	movdqa		xxCmp3, xxCmp4
+	punpcklbw	xxCmp3, xmm0
+	jmp		COMPARE_VERIFY_LOAD_END
+	
+	COMPARE_VERIFY_LOAD_SECOND:
+	movdqa		xxSrc3, xxSrc4
+	movdqa		xxCmp3, xxCmp4
+	punpckhbw	xxCmp3, xmm0
+	
+	COMPARE_VERIFY_LOAD_END:	
+	pmullw		xxSrc3, xxsSpr
+	movdqa		xxZId, xxfSpr
+	pmullw		xxZId, xxSrc1
+	paddw		xxSrc3, xxZId
+	psrlw		xxSrc3, SprShift
+	
+	psubsw		xxSrc3, xxCmp3
+	pabsw		xxSrc3, xxSrc3
+	pcmpgtw	xxSrc3, xxZTh
+	pand		xxTemp, xxSrc3
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0
+	jne			DEFECT_00
+	add			ix, 7
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			_return_XMM_COMPARE_8PIXEL
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		_return_XMM_COMPARE_8PIXEL
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+PAIRING:
+;_return		_return_PAIRING
+	mov		ix, -1
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+	mov		rbx, ix
+	movsxd	rdx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		rcx, rdx
+	add		rcx, iPitchHUp
+	
+	cmp		rdx, pairLeft
+	jl		PAIR_LEFT
+	
+	cmp		rdx, pairRight
+	jle		PAIR_CENTER
+
+PAIR_RIGHT:
+	mov		rax, bUseUnpair
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYod+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+
+	movsx	ecx, word ptr [rrToD+ 2*ix]
+	inc		ecx
+	and		ecx, 1
+	mov		(astPair ptr [rax]).dtype, ecx
+	
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+	
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_LEFT
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_LEFT
+	
+	mov		word ptr[rrToD+ 2*rbx], 4
+	
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		ecx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	movsx	edx, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_CENTER
+	jg		PAIR_CENTER_UNPAIR
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_CENTER
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_CENTER
+
+	mov		word ptr[rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, dword ptr[rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, dword ptr[rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER_UNPAIR:
+
+	jmp		LOOP_PAIR_NUM
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	_return		_return_PAIRING
+
+
+
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+	
+RET
+ConvPixel ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvPixel222.asm b/Common_Class/SISAssem/ConvPixel222.asm
new file mode 100644
index 0000000..6afdf1f
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixel222.asm
@@ -0,0 +1,1079 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+
+.code
+
+SprShift		equ		4
+SprMulti		equ		16
+_return		equ		jmp
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc		equ		qword ptr[rbp+ 70h]
+GrayCmp		equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair		equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS	equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSrc3		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+xxSupp		equ		xmm12
+
+xxDStart	equ		xmm13	; 檬扁摹
+xxDSlope	equ		xmm14	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+szxMatch	equ		0
+szyMatch	equ		8
+
+
+; 肺拿 函荐
+
+
+ConvZoneVert PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1	: qword
+	local	ZoneTableW2	: qword
+	
+	local	pMatch1		: qword
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	local	ConvPitch		: qword
+	
+	local	pairTop		: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword
+	
+	local	c8Pixel		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 080h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	mul		BuffWidth
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+	sar		rax, 4
+	sal		rax, 4
+	mov		InspRight, rax
+	mov		rax, inspLeft
+	add		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szyMatch					; ZoneThreshold Offset 拌魂(zOffset)
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		eyPtrn, 0
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, InspBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szyMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, pMatch
+	add		pMatch, szyMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+;	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+;	mov		ZoneIdAddr1, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp4, xxCmp1
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	add		rax, BuffWidth
+	movdqu	xxCmp3, [rax]
+
+	movdqu	xxTemp, xxCmp3	
+	punpcklbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr
+	paddw	xxCmp1, xxTemp
+
+	movdqu	xxTemp, xxCmp3	
+	punpckhbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr	
+	paddw	xxCmp2, xxTemp
+	
+	psraw	xxCmp1, SprShift
+	psraw	xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+
+	_return	_return_XMM_COMPARE
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			END_FUNC
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxZTh, [rax]
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00		;_XMM_COMPARE_VERIFY
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+_XMM_COMPARE_VERIFY:
+	cmp		c8Pixel, 1
+	jge		COMPARE_VERIFY_LOAD_SECOND					; BD_AD Check
+	mov		rax, rrImgAddr
+	sub		rax, BuffWidth
+	movdqu		xxSrc3, [rax]
+	movdqa		xxSrc4, xxSrc3
+	punpcklbw	xxSrc3, xmm0
+	punpckhbw	xxSrc4, xmm0
+	movdqa		xxCmp4, xxCmp3
+	punpcklbw	xxCmp4, xmm0
+	jmp		COMPARE_VERIFY_LOAD_END
+
+	COMPARE_VERIFY_LOAD_SECOND:
+	movdqa		xxSrc3, xxSrc4
+	movdqa		xxCmp4, xxCmp3
+	punpckhbw	xxCmp4, xmm0
+
+	COMPARE_VERIFY_LOAD_END:	
+	pmullw		xxSrc3, xxsSpr
+	movdqa		xxZId, xxfSpr
+	pmullw		xxZId, xxSrc1
+	paddw		xxSrc3, xxZId
+	psraw		xxSrc3, SprShift
+	
+	psubsw		xxSrc3, xxCmp4
+	pabsw		xxSrc3, xxSrc3
+	pcmpgtw	xxSrc3, xxZTh
+	pand		xxTemp, xxSrc3
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0
+	jne			DEFECT_00
+	add			ix, 8
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+	cmp		edx, 0
+	je		TYPE_1
+	mov		(astPair ptr [rcx]).dtype, 0
+	jmp		TYPE_END
+TYPE_1:
+	mov		(astPair ptr [rcx]).dtype, 1
+TYPE_END:
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+
+END_FUNC:
+
+	;mov		rax, rrNoD					; return rrNoD
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvZoneVert ENDP
+
+
+ConvPixel	PROC
+ret
+ConvPixel	ENDP
+end
diff --git a/Common_Class/SISAssem/ConvPixelD.asm b/Common_Class/SISAssem/ConvPixelD.asm
new file mode 100644
index 0000000..cff6991
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelD.asm
@@ -0,0 +1,1130 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+	
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+piPitch			equ		qword ptr[rbp+ 98h]
+pfSPR			equ		qword ptr[rbp+ 0a0h]
+psSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+iPitch			equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSrc3		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+xxSupp		equ		xxSrc3
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+
+; 肺拿 函荐
+
+
+ConvPixelDPC PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	exPtrn			: qword
+	local	exPtrn1			: qword
+	local	eyPtrn			: qword	
+	local	pairLeft		: qword
+	
+	local	pairRight		: qword
+	local	iPitchHUp		: qword
+	local	iPitchDPC		: qword
+
+	local	xMatch			: dword
+	local	yMatch			: dword
+	
+	local	xMatch2			: dword
+	local	yMatch2			: dword
+	local	c8Pixel			: dword
+	
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	add		rbp, 08h
+	ADD		rbp, 090h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+	
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	mov		iPitchDPC, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+	
+	sub		rax, iPitch
+	mov		pairRight, rax
+
+	mov		rax, InspLeft
+	add		rax, iPitch
+	mov		pairLeft, rax
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+;	mov		rrZIdD, ZoneID
+;	mov		rrZThD, ZoneTh
+
+
+	jmp		NOT_ZONE_PASS
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		exPtrn1, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+
+NOT_ZONE_PASS:
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING
+	_return_PAIRING:
+
+	inc		iy
+
+LOOP_1_CHECK:
+	cmp		iy, InspBottom
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		ix, InspLeft
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+;	cmp		iy, eyPtrn
+;	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+
+LOOP_2_TAIL:
+	add		rrImgAddr, 010h
+LOOP_2_CHECK:
+	cmp		ix, InspRight
+	jge		LOOP_1_TAIL
+	
+;	cmp		ix, exPtrn
+;	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, szyMatch
+	add		pMatch1, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jle		EXCESS_1_BOUND
+	mov		rdx, rax
+EXCESS_1_BOUND:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, pMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch2, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dxPtrn
+	cmp		rax, InspRight
+	jl		EXCESS_2_BOUND
+	mov		rdx, rax
+EXCESS_2_BOUND:
+	mov		exPtrn, rdx						; eyPtrn	mov		rdx, ix
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch2, ebx
+	mov		rax, iy
+	sub		rax, rbx
+	mov		rbx, rdx
+	mul		ZoneTableW							; y*width
+
+
+	add		rax, rbx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+;	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+;	mov		ZoneIdAddr1, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+DPC_MAKE:
+	mov		rax, ix
+	sar		rax, 4
+	sal		rax, 5
+;	mov		ix2, rax
+	mov		rcx, piPitch
+	add		rcx, rax
+	movsx	rdx, word ptr[rcx]
+	mov		iPitchDPC, rdx
+	
+	mov		rcx, pfSPR
+	add		rcx, rax
+	movdqu	xxfSpr, [rcx]
+	
+	mov		rcx, psSPR
+	add		rcx, rax
+	movdqu	xxsSpr, [rcx]
+
+
+_return _return_DPC_MAKE
+
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, iPitchDPC				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	movdqu		xxCmp1, [rax]
+;	movdqa		xxCmp4, xxCmp1
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+
+	movdqu	xxCmp3, [rax+ 1]
+
+	movdqu	xxTemp, xxCmp3	
+	punpcklbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr
+	paddw	xxCmp1, xxTemp
+
+	movdqu	xxTemp, xxCmp3	
+	punpckhbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr	
+	paddw	xxCmp2, xxTemp
+	
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING
+
+	inc		ix
+;	add		ZoneThAddr, 010h
+;	add		ZoneIdAddr, 010h
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		_return_XMM_COMPARE				; BE_RD CHECK
+	
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 7
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+_XMM_COMPARE_VERIFY:
+	cmp		bRFilter, 1
+	jne		DEFECT_00
+; 荐沥秦具 等促.. xxSrc3阑 肺爹秦具茄促.
+	movdqu		xxSrc3, [rrImgAddr- 1]
+	movdqa		xxSrc4, xxSrc3
+	punpcklbw	xxSrc3, xmm0
+	punpckhbw	xxSrc4, xmm0
+
+	cmp		c8Pixel, 1
+	jge		COMPARE_VERIFY_LOAD_SECOND
+	movdqa		xxCmp3, xxCmp4
+	punpcklbw	xxCmp3, xmm0
+	jmp		COMPARE_VERIFY_LOAD_END
+	
+	COMPARE_VERIFY_LOAD_SECOND:
+	movdqa		xxSrc3, xxSrc4
+	movdqa		xxCmp3, xxCmp4
+	punpckhbw	xxCmp3, xmm0
+	
+	COMPARE_VERIFY_LOAD_END:	
+	pmullw		xxSrc3, xxsSpr
+	movdqa		xxZId, xxfSpr
+	pmullw		xxZId, xxSrc1
+	paddw		xxSrc3, xxZId
+	psrlw		xxSrc3, SprShift
+	
+	psubsw		xxSrc3, xxCmp3
+	pabsw		xxSrc3, xxSrc3
+	pcmpgtw	xxSrc3, xxZTh
+	pand		xxTemp, xxSrc3
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0
+	jne			DEFECT_00
+	add			ix, 7
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			_return_XMM_COMPARE_8PIXEL
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		_return_XMM_COMPARE_8PIXEL
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+PAIRING:
+;_return		_return_PAIRING
+	mov		ix, -1
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+	mov		rbx, ix
+	movsxd	rdx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		rcx, rdx
+	add		rcx, iPitchHUp
+	
+	cmp		rdx, pairLeft
+	jl		PAIR_LEFT
+	
+	cmp		rdx, pairRight
+	jle		PAIR_CENTER
+
+PAIR_RIGHT:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYod+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+
+	movsx	ecx, word ptr [rrToD+ 2*ix]
+	inc		ecx
+	and		ecx, 1
+	mov		(astPair ptr[rax]).dtype, ecx
+
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+	
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_LEFT
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_LEFT
+	
+	mov		word ptr[rrToD+ 2*rbx], 4
+	
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		ecx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	movsx	edx, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_CENTER
+	jg		PAIR_CENTER_UNPAIR
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_CENTER
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_CENTER
+
+	mov		word ptr[rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, dword ptr[rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, dword ptr[rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER_UNPAIR:
+
+	jmp		LOOP_PAIR_NUM
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	_return		_return_PAIRING
+
+
+
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+	
+RET
+ConvPixelDPC ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelEE.asm b/Common_Class/SISAssem/ConvPixelEE.asm
new file mode 100644
index 0000000..7c48594
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelEE.asm
@@ -0,0 +1,667 @@
+; Copyright (c) Microsoft Corporation.  All rights reserved.
+
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; but without Source Browser information
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+
+; Custom Build Step, including a listing file placed in intermediate directory
+; and Source Browser information also placed in intermediate directory
+; debug:
+; ml -c -Zi "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; release:
+; ml -c "-Fl$(IntDir)\$(InputName).lst" "-FR$(IntDir)\$(InputName).sbr" "-Fo$(IntDir)\$(InputName).obj" "$(InputPath)"
+; outputs:
+; $(IntDir)\$(InputName).obj
+; $(IntDir)\$(InputName).sbr
+
+;.386
+
+;.MODEL FLAT, C
+
+PBYTE	TYPEDEF		PTR BYTE
+PWORD	TYPEDEF		PTR	WORD
+PDWORD	TYPEDEF		PTR DWORD
+
+.data
+	
+
+.code
+
+ImgAddr		equ		rsi
+nDefect		equ		rdi
+; maxDefect	equ		r8	; parameterr 3
+; nDefect	equ		r9	; parameter 4
+
+InspLeft	equ		qword ptr[rbp+ 30h]
+InspRight	equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom	equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType	equ		qword ptr[rbp+ 60h]
+DefectVal	equ		qword ptr[rbp+ 68h]
+
+
+GraySrc		equ		qword ptr[rbp+ 70h]
+GrayCmp		equ		qword ptr[rbp+ 78h]
+ZoneId		equ		qword ptr[rbp+ 80h]
+ZoneTh		equ		qword ptr[rbp+ 88h]
+
+BuffWidth	equ		qword ptr[rbp+ 90h]
+iPitch		equ		qword ptr[rbp+ 98h]
+fSPR		equ		qword ptr[rbp+ 0a0h]
+sSPR		equ		qword ptr[rbp+ 0a8h]
+
+Suppress	equ		qword ptr[rbp+ 0b0h]
+DTH_StartTh			equ		qword ptr[rbp+ 0b8h]; StartTh		x 例祈				xmm13 (扁粮 捞抚 ADD)
+DTH_Gradient		equ		qword ptr[rbp+ 0c0h]; Gradient		扁匡扁				xmm14 (扁粮, 绊沥摹)
+DTH_SectionStart	equ		qword ptr[rbp+ 0c8h]; SectionStart	利侩 备埃 弥家摹	xmm15 (扁粮 捞抚 VAL)
+
+ShiftCount	equ		qword ptr[rbp+ 0d0h]
+
+
+ix			equ		rcx
+iy			equ		rdx
+
+
+ConvPixel PROC
+	local	ImgAddrAdd:	qword
+	local	maxDefect:	qword
+	local	Threshold: dword
+	local	ZoneID_Def: dword
+	local	Count2: dword
+	local	Suppress2[2]		: qword
+
+	mov		maxDefect, r8
+	mov		nDefect, r9
+	mov		Threshold, edx
+	mov		ZoneID_Def, 0
+	mov		ImgAddr, rcx
+
+
+	mov			rax, Suppress		; supress
+	movd		xmm12, eax
+	movdqa		xmm0, xmm12
+	punpcklbw	xmm12, xmm0
+	movdqa		xmm0, xmm12
+	punpcklbw	xmm0, xmm12
+	pshufd		xmm12, xmm0, 0
+	
+	
+	mov			rax, Suppress		; Suppress2
+	sal			rax, 4
+	movd		xmm10, eax
+	movdqa		xmm0, xmm10
+	punpcklwd	xmm0, xmm10
+	pshufd		xmm10, xmm0, 0
+	lea			rax, Suppress2
+	movdqu		[rax], xmm10
+	
+	
+	mov			rax, fSPR		; fSPR
+	movd		xmm10, eax
+	movdqa		xmm0, xmm10
+	punpcklwd	xmm0, xmm10
+	pshufd		xmm10, xmm0, 0
+	
+	mov			rax, sSPR		; sSPR
+	movd		xmm11, eax
+	movdqa		xmm0, xmm11
+	punpcklwd	xmm0, xmm11
+	pshufd		xmm11, xmm0, 0
+
+	
+	movd		xmm2, Threshold		; Threshold
+	movdqa		xmm0, xmm2
+	punpcklwd	xmm0, xmm2
+	pshufd		xmm2, xmm0, 0
+
+
+
+	mov			rax, DTH_StartTh			; 例祈
+	movd		xmm13, eax
+	movdqa		xmm0, xmm13
+	punpcklwd	xmm0, xmm13
+	pshufd		xmm13, xmm0, 0
+
+
+	mov			rax, DTH_Gradient			; 扁匡扁
+	movd		xmm14, eax
+	movdqa		xmm0, xmm14
+	punpcklwd	xmm0, xmm14
+	pshufd		xmm14, xmm0, 0
+
+
+	mov			rax, DTH_SectionStart		; 利侩 备埃 弥家摹 ( :110 捞惑俊辑 DTH 利侩)
+	movd		xmm15, eax
+	movdqa		xmm0, xmm15
+	punpcklwd	xmm0, xmm15
+	pshufd		xmm15, xmm0, 0
+
+
+;	mov			rax, 
+
+
+	
+	mov		rax, BuffWidth	; ImgAddr= ImgAddr+ BuffWidth*InspTop + InspLeft;
+	mul		InspTop
+	add		rax, InspLeft
+	add		ImgAddr, rax
+
+
+
+
+	;jmp		END_BUFFER
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+	sar		rax, 4
+	sal		rax, 4
+	mov		InspRight, rax
+	mov		rax, inspLeft
+	add		InspRight, rax
+
+	mov		rax, BuffWidth			; 捞固瘤 器牢磐 捞悼蔼 拌魂(茄青 八荤 场抄 饶 器牢磐 捞悼.)
+	add		rax, InspLeft
+	sub		rax, InspRight
+	mov		ImgAddrAdd, rax
+	
+	
+	mov		r8, DefectX
+	mov		r9, DefectY
+	mov		r10, DefectType
+	mov		r11, DefectVal
+
+	mov		r12, GraySrc
+	mov		r13, GrayCmp
+	mov		r14, ZoneID
+	mov		r15, ZoneTh
+
+
+
+
+
+LOOP_XY:									; START_16PIXEL:
+	
+	pxor	xmm0, xmm0
+	
+	movdqu	xmm4, [ImgAddr]				; Src Buffer (Value*SPR) - Suppress - Unpack - *SPR
+	movdqa	xmm5, xmm4					; Copy
+	psubusb	xmm4, xmm12					; Suppress
+	psubusb xmm5, xmm4
+	movdqa	xmm4, xmm5					; Src Buff	
+	punpcklbw	xmm4, xmm0				; Unpack
+	punpckhbw	xmm5, xmm0
+	
+	psllw	xmm4, ShiftCount	; Multiply
+	psllw	xmm5, ShiftCount
+
+	
+	mov		rax, iPitch				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	
+	movdqu	xmm6, [ImgAddr+ rax]
+	movdqa	xmm7, xmm6
+;	psubusb	xmm6, xmm12					; Suppress
+;	psubusb	xmm7, xmm6
+;	movdqa	xmm6, xmm7
+	
+	inc		rax
+	movdqu	xmm8, [ImgAddr+ rax]
+	movdqu	xmm9, xmm8
+;	psubusb	xmm8, xmm12					; Suppress
+;	psubusb	xmm9, xmm8
+;	movdqa	xmm8, xmm9
+	
+	punpcklbw	xmm6, xmm0				; Unpack
+	punpckhbw	xmm7, xmm0
+	punpcklbw	xmm8, xmm0
+	punpckhbw	xmm9, xmm0
+	
+	pmullw	xmm6, xmm10					; Compare SPR (fSPR, sSPR)
+	pmullw	xmm7, xmm10
+	pmullw	xmm8, xmm11
+	pmullw	xmm9, xmm11
+	paddw	xmm6, xmm8
+	paddw	xmm7, xmm9
+
+	lea		rax, Suppress2
+	movdqu	xmm9, [rax]
+	
+	movdqa	xmm1, xmm6
+	psubusw	xmm1, xmm9
+	psubusw	xmm6, xmm1
+	
+	movdqa	xmm1, xmm7
+	psubusw	xmm1, xmm9
+	psubusw	xmm7, xmm1
+	
+	mov		Count2, 2
+INSPECT_FIRST8:
+
+	pxor	xmm1, xmm1
+										; Dynamic Threshold 眠免
+	pmaxsw	xmm1, xmm4					; 厚背 侨伎吝 灌篮 侨伎 蔼 茫扁.
+	pmaxsw	xmm1, xmm6
+	psraw	xmm1, ShiftCount				; *SPR
+	movdqa	xmm3, xmm1
+	pcmpgtw	xmm3, xmm15						; DTH_Start 焊促 灌篮 侨伎 茫扁
+	pand	xmm1, xmm3
+	pmullw	xmm1, xmm14						; 扁匡扁利侩 = *slide/256
+	psraw	xmm1, 8
+	pand	xmm3, xmm13						; DTH_Val
+	paddw	xmm1, xmm3					;DTH 眠免
+	
+	movdqa	xmm8, xmm4					; Peak xmm
+	psubw	xmm8, xmm6	
+	psraw	xmm8, ShiftCount
+	
+	movdqa	xmm3, xmm2					; Zone Threshold 利侩
+	pmaxsw	xmm3, xmm1
+	pxor	xmm9, xmm9
+	psubw	xmm9, xmm8
+	pmaxsw	xmm9, xmm8
+	movdqa	xmm0, xmm9
+	pcmpgtw	xmm0, xmm3
+	pmovmskb	rax, xmm0
+	cmp		rax, 0
+	jne		DEFECT_0
+	
+	add		ix, 7
+INSPECT_SECOND8:
+	dec		Count2
+	jz		END_16_PIXEL
+	
+	inc		ix
+
+	pxor	xmm1, xmm1
+										; Dynamic Threshold 眠免
+	pmaxsw	xmm1, xmm5					; 厚背 侨伎吝 灌篮 侨伎 蔼 茫扁.
+	pmaxsw	xmm1, xmm7
+	psraw	xmm1, ShiftCount				; *SPR
+	movdqa	xmm3, xmm1
+	pcmpgtw	xmm3, xmm15						; DTH_Start 焊促 灌篮 侨伎 茫扁
+	pand	xmm1, xmm3
+	pmullw	xmm1, xmm14						; 扁匡扁利侩 = *slide/256
+	psraw	xmm1, 8
+	pand	xmm3, xmm13						; DTH_Val
+	paddw	xmm1, xmm3					;DTH 眠免
+	
+	
+	movdqa	xmm4, xmm5					; Defect 沥焊 眠免阑 犁荤侩 窍扁困秦(low, high)
+	movdqa	xmm6, xmm7
+	
+	movdqa	xmm8, xmm5					; Peak xmm
+	psubw	xmm8, xmm7	
+	psraw	xmm8, ShiftCount
+	
+	movdqa	xmm3, xmm2					; Zone Threshold 利侩
+	pmaxsw	xmm3, xmm1
+	pxor	xmm9, xmm9
+	psubw	xmm9, xmm8
+	pmaxsw	xmm9, xmm8
+	movdqa	xmm0, xmm9
+	pcmpgtw	xmm0, xmm3
+	pmovmskb	rax, xmm0
+	cmp		rax, 0
+	jne		DEFECT_0
+	
+	add		ix, 7
+
+END_16_PIXEL:
+	inc		ix
+	add		ImgAddr, 16
+	cmp		ix, InspRight
+	jl		LOOP_XY
+
+	inc		iy
+	cmp		iy, InspBottom
+	jge		END_BUFFER
+	
+	mov		ix, InspLeft
+	add		ImgAddr, ImgAddrAdd
+	jmp		LOOP_XY
+
+DEFECT_0:
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	psraw	xmm4, ShiftCount
+	psraw	xmm6, ShiftCount
+	
+	
+	pextrw	rax, xmm0, 0h
+	cmp		rax, 0
+	je		DEFECT_1
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 0h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 0h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	rax, xmm8, 0h
+	pextrw	rbx, xmm9, 0h
+	cmp		ax, bx
+	je		POSITIVE_0
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_1
+	
+POSITIVE_0:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+DEFECT_1:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	pextrw	rax, xmm0, 1h
+	cmp		rax, 0
+	je		DEFECT_2
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 1h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 1h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 1h
+	pextrw	ebx, xmm9, 1h
+	cmp		eax, ebx
+	je		POSITIVE_1
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_2
+	
+POSITIVE_1:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_2:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	
+	pextrw	rax, xmm0, 2h
+	cmp		rax, 0
+	je		DEFECT_3
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 2h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 2h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 2h
+	pextrw	ebx, xmm9, 2h
+	cmp		eax, ebx
+	je		POSITIVE_2
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_3
+	
+POSITIVE_2:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_3:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	
+	pextrw	rax, xmm0, 3h
+	cmp		rax, 0
+	je		DEFECT_4
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 3h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 3h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 3h
+	pextrw	ebx, xmm9, 3h
+	cmp		eax, ebx
+	je		POSITIVE_3
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_4
+	
+POSITIVE_3:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_4:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	pextrw	rax, xmm0, 4h
+	cmp		rax, 0
+	je		DEFECT_5
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 4h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 4h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 4h
+	pextrw	ebx, xmm9, 4h
+	cmp		eax, ebx
+	je		POSITIVE_4
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_5
+	
+POSITIVE_4:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+	
+DEFECT_5:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	pextrw	rax, xmm0, 5h
+	cmp		rax, 0
+	je		DEFECT_6
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 5h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 5h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 5h
+	pextrw	ebx, xmm9, 5h
+	cmp		eax, ebx
+	je		POSITIVE_5
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_6
+	
+POSITIVE_5:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+
+DEFECT_6:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+	pextrw	rax, xmm0, 6h
+	cmp		rax, 0
+	je		DEFECT_7
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 6h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 6h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 6h
+	pextrw	ebx, xmm9, 6h
+	cmp		eax, ebx
+	je		POSITIVE_6
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+	jmp		DEFECT_7
+	
+POSITIVE_6:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+
+DEFECT_7:
+	inc		ix
+	cmp		nDefect, maxDefect
+	jge		END_BUFFER
+	
+
+	pextrw	rax, xmm0, 7h
+	cmp		rax, 0
+	je		INSPECT_SECOND8
+	
+	mov		[r8+ 4*nDefect], ecx
+	mov		[r9+ 4*nDefect], edx
+	
+	pextrw	eax, xmm4, 7h
+	mov		[r12+ 4*nDefect], eax
+	pextrw	eax, xmm6, 7h
+	mov		[r13+ 4*nDefect], eax
+
+	mov		dword ptr [r14+ 4*nDefect], 0
+	mov		eax, Threshold
+	mov		dword ptr[r15+ 4*nDefect], eax
+	
+	pextrw	eax, xmm8, 7h
+	pextrw	ebx, xmm9, 7h
+	cmp		eax, ebx
+	je		POSITIVE_7
+	mov		word ptr[r10+ 2*nDefect], 0
+	
+	sub		ebx, Threshold
+	mov		[r11+ 2*nDefect], bx
+	
+	inc		nDefect
+
+	jmp		INSPECT_SECOND8
+	
+POSITIVE_7:
+	mov		word ptr[r10+ 2*nDefect], 1
+	sub		eax, Threshold
+	mov		[r11+ 2*nDefect], ax
+	inc		nDefect
+
+	jmp		INSPECT_SECOND8
+	
+
+
+
+END_BUFFER:
+
+	mov		rax, nDefect					; return nDefect
+RET
+ConvPixel ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelVTDS.asm b/Common_Class/SISAssem/ConvPixelVTDS.asm
new file mode 100644
index 0000000..e14f722
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelVTDS.asm
@@ -0,0 +1,1060 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+;szyMatch	equ		1600
+
+
+.code
+
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+piPitch16Ori	equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+ConAddr			equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+ExTh			equ		qword ptr[rbp+ 138h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+; 肺拿 函荐
+
+
+ConvPixelVTDS PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	ConBottom		: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConPitch		: qword
+
+	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	temp			: qword
+	
+	local	c8Pixel		: dword	
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+	local	cDPC		: dword
+	local	iPitch		: qword
+	
+	local	piPitch16	: qword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	;辑脓矾俊辑 磷绢辑 Bottom 俊辑 1 哗霖促.(BOE)
+	mov		rcx, InspBottom
+	sub		rcx, 1
+	mov		InspBottom, rcx	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+	mov		piPitch16, 0			; DPC Address Set
+	cmp		piPitch16Ori, 0
+	je		DPC_PASS
+	mov		rax, iy
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, piPitch16Ori
+	mov		piPitch16, rax	
+	DPC_PASS:
+
+	jmp		MAKE_CONBUFF_HEAD
+_return_MAKE_CONBUFF:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+
+
+LOOP_2:
+	mov		cDpc, 010h
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+
+LOOP_2_BODY:
+	cmp		piPitch16, 0
+	je		XMM_MAKE
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	inc		cDpc
+
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+
+MAKE_CONBUFF:
+
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+10h], xxSrc2
+	
+	add		rrImgAddr, rcx
+	add		rax, 20h
+
+	inc		iy
+	cmp		iy, InspBottom
+	jle		MAKE_CONBUFF
+	jmp		_return_MAKE_CONBUFF
+
+DPC_MAKE:	; verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	cmp		cDpc, 010h
+	jne		_return_DPC_MAKE
+	mov		cDpc, 0
+	mov		rax, piPitch16
+	movsxd	rax, dword ptr[rax]
+	add		piPitch16, 4
+	
+	cmp		iPitch16, rax
+	je		_return_DPC_MAKE
+	
+	mov		iPitch16, rax	
+	mov		rcx, rax
+	and		rcx, 0fh
+	
+	shr		rax, SprShift
+	mov		iPitch, rax
+	
+	sal		rax, 5
+	mov		ConPitch, rax
+	
+	mov		rdx, 010h
+	sub		rdx, rcx
+	
+	movd		xxsSpr, rcx
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	
+	movd		xxfSpr, rdx
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	jmp		_return_DPC_MAKE
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]			; rrImgAddr 篮 ConBuff Addr 捞促.
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	movdqu		xxCmp3, [rax+ 20h]
+	movdqu		xxTemp, [rax+ 30h]	
+
+	pmullw		xxCmp3, xxsSpr	
+	paddw		xxCmp1, xxCmp3
+	
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp2, xxTemp
+
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+;	sub		ZoneThAddr, 010h
+;	sub		ZoneIdAddr, 010h
+_return	_return_XMM_COMPARE
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	movsx	rdx, word ptr[rrPoD+ 2*iy]
+	cmp		rdx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvPixelVTDS ENDP
+
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelVTDSBW.asm b/Common_Class/SISAssem/ConvPixelVTDSBW.asm
new file mode 100644
index 0000000..f37666e
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelVTDSBW.asm
@@ -0,0 +1,1170 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+;szyMatch	equ		1600
+
+
+.code
+
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+piPitch16Ori	equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+ConAddr			equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+BWB_BASE		equ		qword ptr[rbp+ 138h]
+BWB_SLIDE		equ		qword ptr[rbp+ 140h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+; 肺拿 函荐
+
+
+ConvPixelVTDSBW PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	ConBottom		: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConPitch		: qword
+
+	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	temp			: qword
+	
+	local	c8Pixel		: dword	
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+	local	cDPC		: dword
+	local	iPitch		: qword
+	
+	local	piPitch16	: qword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+	mov		piPitch16, 0			; DPC Address Set
+	cmp		piPitch16Ori, 0
+	je		DPC_PASS
+	mov		rax, iy
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, piPitch16Ori
+	mov		piPitch16, rax	
+	DPC_PASS:
+
+	jmp		MAKE_CONBUFF_HEAD
+_return_MAKE_CONBUFF:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+
+
+LOOP_2:
+	mov		cDpc, 010h
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+
+LOOP_2_BODY:
+	cmp		piPitch16, 0
+	je		XMM_MAKE
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	inc		cDpc
+
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+
+MAKE_CONBUFF:
+
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+10h], xxSrc2
+	
+	add		rrImgAddr, rcx
+	add		rax, 20h
+
+	inc		iy
+	cmp		iy, InspBottom
+	jle		MAKE_CONBUFF
+	jmp		_return_MAKE_CONBUFF
+
+DPC_MAKE:	; verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	cmp		cDpc, 010h
+	jne		_return_DPC_MAKE
+	mov		cDpc, 0
+	mov		rax, piPitch16
+	movsxd	rax, dword ptr[rax]
+	add		piPitch16, 4
+	
+	cmp		iPitch16, rax
+	je		_return_DPC_MAKE
+	
+	mov		iPitch16, rax	
+	mov		rcx, rax
+	and		rcx, 0fh
+	
+	shr		rax, SprShift
+	mov		iPitch, rax
+	
+	sal		rax, 5
+	mov		ConPitch, rax
+	
+	
+	mov		rdx, 010h
+	sub		rdx, rcx
+	
+	movd		xxsSpr, rcx
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	
+	movd		xxfSpr, rdx
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	jmp		_return_DPC_MAKE
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]			; rrImgAddr 篮 ConBuff Addr 捞促.
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	movdqu		xxCmp3, [rax+ 20h]
+	movdqu		xxTemp, [rax+ 30h]	
+
+	pmullw		xxCmp3, xxsSpr	
+	paddw		xxCmp1, xxCmp3
+	
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp2, xxTemp
+
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+;	sub		ZoneThAddr, 010h
+;	sub		ZoneIdAddr, 010h
+_return	_return_XMM_COMPARE
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+	mov		word ptr [rrToD+ 2*rbx], 4	; 其绢傅瞪 Pixel 搬窃篮 瘤款促.
+
+;	JMP		ADD_TO_PAIR;
+	cmp		rrImgAddr, 0
+	jne		ADD_TO_TOP_PAIR
+	movsxd	rax, dword ptr[rrSrcD+ 4*rbx]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*rbx]
+	cmp		rax, rdx
+	jge		GREATER_SRC
+	mov		rax, rdx
+	GREATER_SRC:
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*rbx]
+	add		dx, word ptr[rrPoD+ 2*rbx]
+	cmp		ax, dx
+	jge		LOOP_PAIR_NUM
+
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rbx], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*rbx], dx
+	
+	ADD_TO_TOP_PAIR:
+	
+
+	mov		rax, PairAddr
+	
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	mov		(astPair ptr [rax]).x, ecx
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	movzx	rax, word ptr[rrToD+ 2*iy]
+	cmp		ax, 0
+	jne		ADD_TO_TOP_UNPAIR
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*iy]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*iy]
+	cmp		rax, rdx
+	jge		GREATER_TOP_UNPAIR_SRC
+	mov		rax, rdx
+	GREATER_TOP_UNPAIR_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE	
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*iy]
+	add		dx, word ptr[rrPoD+ 2*iy]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*iy], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*iy], dx
+
+ADD_TO_TOP_UNPAIR:
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	movsxd	rax, dword ptr [rrYoD+ 4*iy]
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+
+
+	cmp		rrImgAddr, 0
+	jne		ADD_TO_CENTER
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*rbx]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*rbx]
+	cmp		rax, rdx
+	jge		GREATER_CENTER_SRC
+	mov		rax, rdx
+	GREATER_CENTER_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*rbx]
+	add		dx, word ptr[rrPoD+ 2*rbx]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rbx], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*rbx], dx
+
+	
+ADD_TO_CENTER:
+
+
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	mov		(astPair ptr [rax]).x, ecx
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+
+	movzx	rax, word ptr[rrToD+ 2*iy]
+	cmp		rax, 1
+	jne		ADD_TO_BOTTOM
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*iy]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*iy]
+	cmp		rax, rdx
+	jge		GREATER_BOTTOM_SRC
+	mov		rax, rdx
+	GREATER_BOTTOM_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*iy]
+	add		dx, word ptr[rrPoD+ 2*iy]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*iy], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*iy], dx
+
+ADD_TO_BOTTOM:
+
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	movsxd	rax, dword ptr [rrYoD+ 4*iy]
+	add		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvPixelVTDSBW ENDP
+
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelVTDSBW_BOE.asm b/Common_Class/SISAssem/ConvPixelVTDSBW_BOE.asm
new file mode 100644
index 0000000..7313cd5
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelVTDSBW_BOE.asm
@@ -0,0 +1,1174 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+;szyMatch	equ		1600
+
+
+.code
+
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+piPitch16Ori	equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+ConAddr			equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+BWB_BASE		equ		qword ptr[rbp+ 138h]
+BWB_SLIDE		equ		qword ptr[rbp+ 140h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+; 肺拿 函荐
+
+
+ConvPixelVTDSBW_BOE PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	ConBottom		: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConPitch		: qword
+
+	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	temp			: qword
+	
+	local	c8Pixel		: dword	
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+	local	cDPC		: dword
+	local	iPitch		: qword
+	
+	local	piPitch16	: qword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch16			; iPitch16
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	;辑脓矾俊辑 磷绢辑 Bottom 俊辑 1 哗霖促.(BOE)
+	mov		rcx, InspBottom
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+	mov		piPitch16, 0			; DPC Address Set
+	cmp		piPitch16Ori, 0
+	je		DPC_PASS
+	mov		rax, iy
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, piPitch16Ori
+	mov		piPitch16, rax	
+	DPC_PASS:
+
+	jmp		MAKE_CONBUFF_HEAD
+_return_MAKE_CONBUFF:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+
+
+LOOP_2:
+	mov		cDpc, 010h
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+
+LOOP_2_BODY:
+	cmp		piPitch16, 0
+	je		XMM_MAKE
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	inc		cDpc
+
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+
+MAKE_CONBUFF:
+
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+10h], xxSrc2
+	
+	add		rrImgAddr, rcx
+	add		rax, 20h
+
+	inc		iy
+	cmp		iy, InspBottom
+	jle		MAKE_CONBUFF
+	jmp		_return_MAKE_CONBUFF
+
+DPC_MAKE:	; verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	cmp		cDpc, 010h
+	jne		_return_DPC_MAKE
+	mov		cDpc, 0
+	mov		rax, piPitch16
+	movsxd	rax, dword ptr[rax]
+	add		piPitch16, 4
+	
+	cmp		iPitch16, rax
+	je		_return_DPC_MAKE
+	
+	mov		iPitch16, rax	
+	mov		rcx, rax
+	and		rcx, 0fh
+	
+	shr		rax, SprShift
+	mov		iPitch, rax
+	
+	sal		rax, 5
+	mov		ConPitch, rax
+	
+	
+	mov		rdx, 010h
+	sub		rdx, rcx
+	
+	movd		xxsSpr, rcx
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	
+	movd		xxfSpr, rdx
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	jmp		_return_DPC_MAKE
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]			; rrImgAddr 篮 ConBuff Addr 捞促.
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	movdqu		xxCmp3, [rax+ 20h]
+	movdqu		xxTemp, [rax+ 30h]	
+
+	pmullw		xxCmp3, xxsSpr	
+	paddw		xxCmp1, xxCmp3
+	
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp2, xxTemp
+
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+;	sub		ZoneThAddr, 010h
+;	sub		ZoneIdAddr, 010h
+_return	_return_XMM_COMPARE
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+	mov		word ptr [rrToD+ 2*rbx], 4	; 其绢傅瞪 Pixel 搬窃篮 瘤款促.
+
+;	JMP		ADD_TO_PAIR;
+	cmp		rrImgAddr, 0
+	jne		ADD_TO_TOP_PAIR
+	movsxd	rax, dword ptr[rrSrcD+ 4*rbx]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*rbx]
+	cmp		rax, rdx
+	jge		GREATER_SRC
+	mov		rax, rdx
+	GREATER_SRC:
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*rbx]
+	add		dx, word ptr[rrPoD+ 2*rbx]
+	cmp		ax, dx
+	jge		LOOP_PAIR_NUM
+
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rbx], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*rbx], dx
+	
+	ADD_TO_TOP_PAIR:
+	
+
+	mov		rax, PairAddr
+	
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	mov		(astPair ptr [rax]).x, ecx
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	movzx	rax, word ptr[rrToD+ 2*iy]
+	cmp		ax, 0
+	jne		ADD_TO_TOP_UNPAIR
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*iy]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*iy]
+	cmp		rax, rdx
+	jge		GREATER_TOP_UNPAIR_SRC
+	mov		rax, rdx
+	GREATER_TOP_UNPAIR_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE	
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*iy]
+	add		dx, word ptr[rrPoD+ 2*iy]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*iy], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*iy], dx
+
+ADD_TO_TOP_UNPAIR:
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	movsxd	rax, dword ptr [rrYoD+ 4*iy]
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+
+
+	cmp		rrImgAddr, 0
+	jne		ADD_TO_CENTER
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*rbx]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*rbx]
+	cmp		rax, rdx
+	jge		GREATER_CENTER_SRC
+	mov		rax, rdx
+	GREATER_CENTER_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*rbx]
+	add		dx, word ptr[rrPoD+ 2*rbx]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rbx], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*rbx], dx
+
+	
+ADD_TO_CENTER:
+
+
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	mov		(astPair ptr [rax]).x, ecx
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+
+	movzx	rax, word ptr[rrToD+ 2*iy]
+	cmp		rax, 1
+	jne		ADD_TO_BOTTOM
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*iy]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*iy]
+	cmp		rax, rdx
+	jge		GREATER_BOTTOM_SRC
+	mov		rax, rdx
+	GREATER_BOTTOM_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*iy]
+	add		dx, word ptr[rrPoD+ 2*iy]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*iy], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*iy], dx
+
+ADD_TO_BOTTOM:
+
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	movsxd	rax, dword ptr [rrYoD+ 4*iy]
+	add		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvPixelVTDSBW_BOE ENDP
+
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelVert.asm b/Common_Class/SISAssem/ConvPixelVert.asm
new file mode 100644
index 0000000..74d01e0
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelVert.asm
@@ -0,0 +1,1321 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSrc3		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+xxSupp		equ		xxSrc3
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+
+; 肺拿 函荐
+
+
+ConvPixelVert PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1	: qword
+	local	ZoneIdAddr1	: qword
+	local	ZoneTableW2	: qword	
+	local	pMatch1		: qword
+	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword
+
+	
+	local	pairTop		: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	c8Pixel		: dword
+	
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	mul		BuffWidth
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+	jmp		NOT_ZONE_PASS
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+
+
+
+NOT_ZONE_PASS:
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+;	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+;	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+;	mov		rax, ZoneTableW2
+;	add		ZoneThAddr, rax
+;	add		ZoneIdAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, InspBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+;	cmp		iy, eyPtrn					; BD_AD Check
+;	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+;	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+;	mov		ZoneIdAddr1, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+;	movdqa		xxCmp4, xxCmp1
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	add		rax, BuffWidth
+	movdqu	xxCmp3, [rax]
+
+	movdqu		xxTemp, xxCmp3	
+
+	punpckhbw	xxCmp3, xmm0
+	pmullw		xxCmp3, xxsSpr	
+	paddw		xxCmp2, xxCmp3
+	
+	punpcklbw	xxTemp, xmm0
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+;	add		ZoneThAddr, 010h
+;	add		ZoneIdAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+;	sub		ZoneThAddr, 010h
+;	sub		ZoneIdAddr, 010h
+_return	_return_XMM_COMPARE
+
+
+_XMM_COMPARE_VERIFY:
+jmp		DEFECT_00
+	cmp		bRFilter, 1
+	jne		DEFECT_00
+	
+; 荐沥秦具 等促.. xxSrc3阑 肺爹秦具茄促.
+	mov		rax, rrImgAddr
+	sub		rax, BuffWidth
+	movdqu		xxSrc3, [rax]
+	movdqa		xxSrc4, xxSrc3
+	punpcklbw	xxSrc3, xmm0
+	punpckhbw	xxSrc4, xmm0
+
+	cmp		c8Pixel, 1
+	jge		COMPARE_VERIFY_LOAD_SECOND					; BD_AD Check
+	movdqa		xxCmp3, xxCmp4
+	punpcklbw	xxCmp3, xmm0
+	jmp		COMPARE_VERIFY_LOAD_END
+
+	COMPARE_VERIFY_LOAD_SECOND:
+	movdqa		xxSrc3, xxSrc4
+	movdqa		xxCmp3, xxCmp4
+	punpckhbw	xxCmp3, xmm0
+
+	COMPARE_VERIFY_LOAD_END:	
+	pmullw		xxSrc3, xxsSpr
+	movdqa		xxZId, xxfSpr
+	pmullw		xxZId, xxSrc1
+	paddw		xxSrc3, xxZId
+	psrlw		xxSrc3, SprShift
+	
+	psubsw		xxSrc3, xxCmp3
+	pabsw		xxSrc3, xxSrc3
+	pcmpgtw	xxSrc3, xxZTh
+	pand		xxTemp, xxSrc3
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0
+	jne			DEFECT_00
+	add			ix, 8
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+
+END_FUNC:
+
+	;mov		rax, rrNoD					; return rrNoD
+	mov		rax, nPair					; return nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvPixelVert ENDP
+
+ConvPixelVertTest PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword
+
+	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	c8Pixel			: dword
+	
+	local	xMatch			: dword
+	local	yMatch			: dword
+	local	xMatch2			: dword
+	local	yMatch2			: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	mul		BuffWidth
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+
+	add		ix, 010h
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+LOOP_2_CHECK:
+	cmp		iy, InspBottom			; BED Check
+	jge		LOOP_1_TAIL
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+jmp		LOOP_2_TAIL
+	
+XMM_MAKE:
+XMM_COMPARE:
+
+END_FUNC:
+ret
+ConvPixelVertTest ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelVertMS.asm b/Common_Class/SISAssem/ConvPixelVertMS.asm
new file mode 100644
index 0000000..6ba4e36
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelVertMS.asm
@@ -0,0 +1,1037 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+CacheWidth		equ		40h
+CacheWidth2		equ		80h
+szxMatch	equ		8
+
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+ConAddr			equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSrc3		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+xxSupp		equ		xxSrc3
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+; 肺拿 函荐
+
+
+ConvPixelVertMS PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	ConBottom		: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword
+
+	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	CacheRight		: qword
+	
+	local	CacheCount		: qword	
+	local	xMatch			: dword
+	local	yMatch			: dword
+	local	xMatch2			: dword
+	local	yMatch2			: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	add		rbp, 08h
+	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	sal		rax, 2
+	mov		ConvPitch, rax
+	
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, CacheWidth
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+	jmp		MAKE_CONBUFF_HEAD
+_return_MAKE_CONBUFF:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	mov		rax, ix
+	add		rax, CacheWidth
+	cmp		rax, InspRight
+	jle		PASS_Cache_RIGHT
+	mov		rax, InspRight
+PASS_Cache_RIGHT:
+	mov		CacheRight, rax
+
+
+LOOP_2:
+	mov		CacheCount, ix
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	mov		ix, CacheCount
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+
+LOOP_2_BODY:
+
+	jmp		_XMM_COMPARE_CHECK
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+MAKE_CONBUFF_TEST:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+10h], xxSrc2
+	
+	movdqu		xxSrc1, [rrImgAddr+ 10h]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	movdqu		[rax+ 20h], xxSrc1
+	movdqu		[rax+ 30h], xxSrc2
+	
+	movdqu		xxSrc1, [rrImgAddr+ 20h]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	movdqu		[rax+ 40h], xxSrc1
+	movdqu		[rax+ 50h], xxSrc2
+
+	movdqu		xxSrc1, [rrImgAddr+ 30h]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	movdqu		[rax+ 60h], xxSrc1
+	movdqu		[rax+ 70h], xxSrc2
+
+	add			rrImgAddr, rcx
+	add			rax, 80h
+
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+	
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+	;jmp		MAKE_CONBUFF_TEST
+
+MAKE_CONBUFF:
+
+	
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+10h], xxSrc2
+	
+	movdqu		xxZTh, [rrImgAddr+ 10h]
+	movdqa		xxZId, xxZTh
+	punpcklbw	xxZTh, xmm0
+	punpckhbw	xxZId, xmm0
+	movdqu		[rax+ 20h], xxZTh
+	movdqu		[rax+ 30h], xxZId
+	
+	movdqu		xxCmp1, [rrImgAddr+ 20h]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	movdqu		[rax+ 40h], xxCmp1
+	movdqu		[rax+ 50h], xxCmp2
+
+	movdqu		xxPeakS, [rrImgAddr+ 30h]
+	movdqa		xxPeakAbs, xxPeakS
+	punpcklbw	xxPeakS, xmm0
+	punpckhbw	xxPeakAbs, xmm0
+	movdqu		[rax+ 60h], xxPeakS
+	movdqu		[rax+ 70h], xxPeakAbs
+	
+	add			rrImgAddr, rcx
+	add			rax, 80h
+
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+
+_XMM_COMPARE_TAIL:
+	add		rrImgAddr, 10h
+_XMM_COMPARE_CHECK:
+	cmp		ix, CacheRight
+	jge		_return_XMM_COMPARE
+	
+	cmp		rrNoD, maxDefect				; BED Check
+	jge		_MAX_PIXEL_DEFECT
+
+
+
+_XMM_COMPARE_8PIXEL:
+	movdqu		xxSrc1, [rrImgAddr]
+	mov			rax, rrImgAddr
+	add			rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	pmullw		xxCmp1, xxfSpr
+	
+	movdqu		xxTemp, [rax+ CacheWidth2]
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+	
+	psrlw		xxCmp1, SprShift
+
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_XMM_COMPARE_TAIL
+
+
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _XMM_COMPARE_TAIL
+
+
+_MAX_PIXEL_DEFECT:
+	mov		ix, InspRight
+	jmp		PAIRING_VERT
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+	cmp		edx, 0
+	je		TYPE_1
+	mov		(astPair ptr [rcx]).dtype, 0
+	jmp		TYPE_END
+TYPE_1:
+	mov		(astPair ptr [rcx]).dtype, 1
+TYPE_END:
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvPixelVertMS ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelVertS.asm b/Common_Class/SISAssem/ConvPixelVertS.asm
new file mode 100644
index 0000000..55c1bd4
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelVertS.asm
@@ -0,0 +1,1006 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+;szyMatch	equ		1600
+
+
+.code
+
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+ConAddr			equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+ExTh			equ		qword ptr[rbp+ 138h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+; 肺拿 函荐
+
+
+ConvPixelVertS PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	ConBottom		: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword
+
+	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	temp			: qword
+	
+	local	c8Pixel		: dword	
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	mov		rcx, InspBottom
+	sub		rcx, 1
+	mov		InspBottom, rcx	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+	
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+	jmp		MAKE_CONBUFF_HEAD
+_return_MAKE_CONBUFF:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+
+MAKE_CONBUFF:
+
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+10h], xxSrc2
+	
+	add		rrImgAddr, rcx
+	add		rax, 20h
+
+	inc		iy
+	cmp		iy, InspBottom
+	jle		MAKE_CONBUFF
+	jmp		_return_MAKE_CONBUFF
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]			; rrImgAddr 篮 ConBuff Addr 捞促.
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	movdqu		xxCmp3, [rax+ 20h]
+	movdqu		xxTemp, [rax+ 30h]	
+
+	pmullw		xxCmp3, xxsSpr	
+	paddw		xxCmp1, xxCmp3
+	
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp2, xxTemp
+
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+;	sub		ZoneThAddr, 010h
+;	sub		ZoneIdAddr, 010h
+_return	_return_XMM_COMPARE
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvPixelVertS ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelVertSBW.asm b/Common_Class/SISAssem/ConvPixelVertSBW.asm
new file mode 100644
index 0000000..e4fb487
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelVertSBW.asm
@@ -0,0 +1,1114 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+;szyMatch	equ		1600
+
+
+.code
+
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+ConAddr			equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+BWB_BASE		equ		qword ptr[rbp+ 138h]
+BWB_SLIDE		equ		qword ptr[rbp+ 140h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+; 肺拿 函荐
+
+
+ConvPixelVertSBW PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	ConBottom		: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword
+
+	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	temp			: qword
+	
+	local	c8Pixel		: dword	
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	add		rbp, 08h
+	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+	
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+	jmp		MAKE_CONBUFF_HEAD
+_return_MAKE_CONBUFF:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+
+MAKE_CONBUFF:
+
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+10h], xxSrc2
+	
+	add		rrImgAddr, rcx
+	add		rax, 20h
+
+	inc		iy
+	cmp		iy, InspBottom
+	jle		MAKE_CONBUFF
+	jmp		_return_MAKE_CONBUFF
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]			; rrImgAddr 篮 ConBuff Addr 捞促.
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	movdqu		xxCmp3, [rax+ 20h]
+	movdqu		xxTemp, [rax+ 30h]	
+
+	pmullw		xxCmp3, xxsSpr	
+	paddw		xxCmp1, xxCmp3
+	
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp2, xxTemp
+
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+;	sub		ZoneThAddr, 010h
+;	sub		ZoneIdAddr, 010h
+_return	_return_XMM_COMPARE
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+	mov		word ptr [rrToD+ 2*rbx], 4	; 其绢傅瞪 Pixel 搬窃篮 瘤款促.
+
+;	JMP		ADD_TO_PAIR;
+	cmp		rrImgAddr, 0
+	jne		ADD_TO_TOP_PAIR
+	movsxd	rax, dword ptr[rrSrcD+ 4*rbx]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*rbx]
+	cmp		rax, rdx
+	jge		GREATER_SRC
+	mov		rax, rdx
+	GREATER_SRC:
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*rbx]
+	add		dx, word ptr[rrPoD+ 2*rbx]
+	cmp		ax, dx
+	jge		LOOP_PAIR_NUM
+
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rbx], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*rbx], dx
+	
+	ADD_TO_TOP_PAIR:
+	
+
+	mov		rax, PairAddr
+	
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	mov		(astPair ptr [rax]).x, ecx
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	movzx	rax, word ptr[rrToD+ 2*iy]
+	cmp		ax, 0
+	jne		ADD_TO_TOP_UNPAIR
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*iy]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*iy]
+	cmp		rax, rdx
+	jge		GREATER_TOP_UNPAIR_SRC
+	mov		rax, rdx
+	GREATER_TOP_UNPAIR_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE	
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*iy]
+	add		dx, word ptr[rrPoD+ 2*iy]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*iy], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*iy], dx
+
+ADD_TO_TOP_UNPAIR:
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	movsxd	rax, dword ptr [rrYoD+ 4*iy]
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+
+
+	cmp		rrImgAddr, 0
+	jne		ADD_TO_CENTER
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*rbx]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*rbx]
+	cmp		rax, rdx
+	jge		GREATER_CENTER_SRC
+	mov		rax, rdx
+	GREATER_CENTER_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*rbx]
+	add		dx, word ptr[rrPoD+ 2*rbx]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rbx], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*rbx], dx
+
+	
+ADD_TO_CENTER:
+
+
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	mov		(astPair ptr [rax]).x, ecx
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+
+	movzx	rax, word ptr[rrToD+ 2*iy]
+	cmp		rax, 1
+	jne		ADD_TO_BOTTOM
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*iy]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*iy]
+	cmp		rax, rdx
+	jge		GREATER_BOTTOM_SRC
+	mov		rax, rdx
+	GREATER_BOTTOM_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*iy]
+	add		dx, word ptr[rrPoD+ 2*iy]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*iy], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*iy], dx
+
+ADD_TO_BOTTOM:
+
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	movsxd	rax, dword ptr [rrYoD+ 4*iy]
+	add		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvPixelVertSBW ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvPixelVertSBW_BOE.asm b/Common_Class/SISAssem/ConvPixelVertSBW_BOE.asm
new file mode 100644
index 0000000..299c3b4
--- /dev/null
+++ b/Common_Class/SISAssem/ConvPixelVertSBW_BOE.asm
@@ -0,0 +1,1118 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+;szyMatch	equ		1600
+
+
+.code
+
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+DThSlide		equ		qword ptr[rbp+ 110h]
+ThSuppress		equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+ConAddr			equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+BWB_BASE		equ		qword ptr[rbp+ 138h]
+BWB_SLIDE		equ		qword ptr[rbp+ 140h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+xxDStart	equ		xxSrc4	; 檬扁摹
+xxDSlide	equ		xxCmp4	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+; 肺拿 函荐
+
+
+ConvPixelVertSBW_BOE PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	ConBottom		: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword
+
+	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	temp			: qword
+	
+	local	c8Pixel		: dword	
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	add		rbp, 08h
+	ADD		rbp, 98h
+
+	mov			ImgAddrOri, rcx
+	mov			maxDefect, r8
+
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	movd		xxZTh, edx				; Threshold
+	movdqa		xxTemp, xxZTh
+	punpcklwd	xxTemp, xxZTh
+	pshufd		xxZTh, xxTemp, 0
+	movdqa		xxDStart, xxZTh
+	
+	mov			rax, DThSlide
+	movd		xxDSlide, eax
+	movdqa		xxTemp, xxDSlide
+	punpcklwd	xxTemp, xxDSlide
+	pshufd		xxDSlide, xxTemp, 0
+
+
+	mov			rax, 0
+	movd		xxZId, eax
+	movdqa		xxTemp, xxZId
+	punpcklwd	xxTemp, xxZId
+	pshufd		xxZId, xxTemp, 0
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	;辑脓矾俊辑 磷绢辑 Bottom 俊辑 1 哗霖促.(BOE)
+	mov		rcx, InspBottom
+	sub		rcx, 1
+	mov		InspBottom, rcx	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+	
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+	jmp		MAKE_CONBUFF_HEAD
+_return_MAKE_CONBUFF:
+
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+
+MAKE_CONBUFF:
+
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+10h], xxSrc2
+	
+	add		rrImgAddr, rcx
+	add		rax, 20h
+
+	inc		iy
+	cmp		iy, InspBottom
+	jle		MAKE_CONBUFF
+	jmp		_return_MAKE_CONBUFF
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]			; rrImgAddr 篮 ConBuff Addr 捞促.
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	movdqu		xxCmp3, [rax+ 20h]
+	movdqu		xxTemp, [rax+ 30h]	
+
+	pmullw		xxCmp3, xxsSpr	
+	paddw		xxCmp1, xxCmp3
+	
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp2, xxTemp
+
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+	
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+;	mov			rax, ZoneThAddr
+;	movdqu		xxZTh, [rax]
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1				; Dynamic Threshold
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxDStart
+	
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+;	sub		ZoneThAddr, 010h
+;	sub		ZoneIdAddr, 010h
+_return	_return_XMM_COMPARE
+
+
+DEFECT_00:
+	
+;	mov			rax, ZoneIdAddr
+;	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+	mov		word ptr [rrToD+ 2*rbx], 4	; 其绢傅瞪 Pixel 搬窃篮 瘤款促.
+
+;	JMP		ADD_TO_PAIR;
+	cmp		rrImgAddr, 0
+	jne		ADD_TO_TOP_PAIR
+	movsxd	rax, dword ptr[rrSrcD+ 4*rbx]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*rbx]
+	cmp		rax, rdx
+	jge		GREATER_SRC
+	mov		rax, rdx
+	GREATER_SRC:
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*rbx]
+	add		dx, word ptr[rrPoD+ 2*rbx]
+	cmp		ax, dx
+	jge		LOOP_PAIR_NUM
+
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rbx], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*rbx], dx
+	
+	ADD_TO_TOP_PAIR:
+	
+
+	mov		rax, PairAddr
+	
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	mov		(astPair ptr [rax]).x, ecx
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+	movzx	rax, word ptr[rrToD+ 2*iy]
+	cmp		ax, 0
+	jne		ADD_TO_TOP_UNPAIR
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*iy]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*iy]
+	cmp		rax, rdx
+	jge		GREATER_TOP_UNPAIR_SRC
+	mov		rax, rdx
+	GREATER_TOP_UNPAIR_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE	
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*iy]
+	add		dx, word ptr[rrPoD+ 2*iy]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*iy], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*iy], dx
+
+ADD_TO_TOP_UNPAIR:
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	movsxd	rax, dword ptr [rrYoD+ 4*iy]
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+
+
+	cmp		rrImgAddr, 0
+	jne		ADD_TO_CENTER
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*rbx]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*rbx]
+	cmp		rax, rdx
+	jge		GREATER_CENTER_SRC
+	mov		rax, rdx
+	GREATER_CENTER_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*rbx]
+	add		dx, word ptr[rrPoD+ 2*rbx]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*rbx], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*rbx], dx
+
+	
+ADD_TO_CENTER:
+
+
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	mov		(astPair ptr [rax]).x, ecx
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 0
+	je		LOOP_PAIR_NUM
+
+
+	movzx	rax, word ptr[rrToD+ 2*iy]
+	cmp		rax, 1
+	jne		ADD_TO_BOTTOM
+	
+	movsxd	rax, dword ptr[rrSrcD+ 4*iy]
+	movsxd	rdx, dword ptr[rrCmpD+ 4*iy]
+	cmp		rax, rdx
+	jge		GREATER_BOTTOM_SRC
+	mov		rax, rdx
+	GREATER_BOTTOM_SRC:
+	
+	mul		BWB_SLIDE
+	shr		rax, 8
+	add		rax, BWB_BASE
+	mov		rdx, ZoneTh
+	movsxd	rdx, dword ptr[rdx+ 4*iy]
+	add		dx, word ptr[rrPoD+ 2*iy]
+	cmp		ax, dx;
+	jge		LOOP_PAIR_NUM
+	
+	mov		rcx, ZoneTh
+	mov		[rcx+ 4*iy], eax
+	sub		dx, ax
+	mov		word ptr[rrPoD+ 2*iy], dx
+
+ADD_TO_BOTTOM:
+
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	movsxd	rax, dword ptr [rrYoD+ 4*iy]
+	add		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return nPair
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvPixelVertSBW_BOE ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvTrap.asm b/Common_Class/SISAssem/ConvTrap.asm
new file mode 100644
index 0000000..4cafff2
--- /dev/null
+++ b/Common_Class/SISAssem/ConvTrap.asm
@@ -0,0 +1,767 @@
+
+; 荤促府裁 康开阑 罐酒 Horizontal 规氢栏肺 八荤甫 柳青茄促.
+; Fluidic Pitch Pointer啊 乐阑 矫 CPC 八荤. - PitchBuff	equ		qword ptr[rbp+ 0d8h]
+; CPC侩 Pitch 绰 16锅俊 茄锅究 肺爹秦辑 函版
+; Fluidic Pitch Pointer啊 绝阑 矫 扁霖 Pitch 八荤. - iPitch		equ  qword ptr[rbp+ 98h]
+; 扼牢 窜困 其绢傅阑 角矫茄促. - PairAddr	equ		qword ptr[rbp+ 0b0h]
+; 其绢傅 炼扒 函版 -> +-1 俊辑 just pixel to pixel肺 函版
+
+.data
+	
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+.code
+
+ConvShift		equ		2
+ConvSize		equ		4
+SprShift		equ		4
+SprMulti		equ		16
+ConvNSprShift	equ		6
+
+
+; register 捞抚窿扁
+ix			equ  rsi
+iy			equ  rdi
+ix32		equ  esi
+iy32		equ  edi
+
+rrBW		equ  r8		; Buffer Width
+rrNoD		equ  r9		; Number of Defect
+
+rrXoD		equ  r10		; Defect X
+rrYoD		equ  r11		; Defect Y
+rrToD		equ  r12		; Defect Type
+rrPoD		equ  r13		; Defect Peak
+
+rrImgAddr		equ  r14		; Image Address
+rrConAdr		equ  r15
+
+
+; xmm 捞抚 窿扁
+xxTemp		equ		xmm1
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus		equ		xmm6
+xxPlus		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+
+xxPeak		equ		xmm12
+xxPeak2		equ		xmm13
+
+
+y1			equ  qword ptr[rbp+ 30h]
+y2			equ  qword ptr[rbp+ 38h]
+xlt			equ  qword ptr[rbp+ 40h]				; left position top
+xlb			equ  qword ptr[rbp+ 48h]				; left position bottom
+
+xrt			equ  qword ptr[rbp+ 50h]				; right position 	top
+xrb			equ  qword ptr[rbp+ 58h]				; rigfht position bottom
+Threshold	equ  qword ptr[rbp+ 60h]
+Suppress	equ  qword ptr[rbp+ 68h]
+
+
+DefectX		equ  qword ptr[rbp+ 70h]
+DefectY		equ  qword ptr[rbp+ 78h]
+DefectType	equ  qword ptr[rbp+ 80h]
+DefectVal	equ  qword ptr[rbp+ 88h]
+
+SprShiftF	equ  qword ptr[rbp+ 90h]
+iPitch		equ  qword ptr[rbp+ 98h]
+fSPR		equ  qword ptr[rbp+ 0a0h]
+sSPR		equ  qword ptr[rbp+ 0a8h]
+
+
+PairAddr	equ		qword ptr[rbp+ 0b0h]
+nPair		equ		qword ptr[rbp+ 0b8h]
+MaxPair		equ		qword ptr[rbp+ 0c0h]
+PairSize	equ		qword ptr[rbp+ 0c8h]
+
+BuffWidth	equ		qword ptr[rbp+ 0d0h]
+PitchBuff	equ		qword ptr[rbp+ 0d8h]
+bUseUnpair	equ		qword ptr[rbp+ 0e0h]
+
+
+ConvTrapezium PROC C
+	local	BlackNWhite	: qword	
+	local	dxTrapLeft		: qword
+	local	dxTrapRight	: qword
+	local	dyTrap			: qword
+	local	xStart			: qword
+	local	xEnd			: qword
+	local	xWidth			: qword
+	local	ImgAdrEnd		: qword
+	local	iPitch2		: qword
+	local	ImgAdr			: qword
+	local	ConAdr			: qword
+	local	maxPixelD		: qword
+	
+	local	minInsp		: qword
+	
+	local	pairLeft		: qword
+	local	pairRight		: qword
+	local	iPitchHUp		: qword
+	local	cPitch			: qword ; 啊函 林扁 墨款飘.
+	local	xPlusPitch		: dword
+
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 068h+ 30h
+
+	mov		ImgAdr, rcx
+	mov		ConAdr, rdx
+	mov		maxPixelD, r8
+	sub		maxPixelD, 16
+	
+	
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+	mov		rax, nPair
+	mov		rcx, PairSize
+	imul	rax, rcx
+	add		rax, PairAddr
+	mov		PairAddr, rax
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+
+
+	mov		rax, iPitch				;;; 瘤开 函荐 且寸.
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+	add		rax, iPitch
+	mov		minInsp, rax		; 3 pitch 捞惑 登绢具 八荤.
+	cmp		rax, 10h
+	jge		MIN_INSP_SIZE
+	mov		minInsp, 48
+	MIN_INSP_SIZE:
+					
+	mov		rax, y2			; 荤促府裁 芭府 傍瞒 备窍扁
+	sub		rax, y1
+	mov		dyTrap,  rax
+	
+	mov		rax, xlb
+	sub		rax, xlt
+	mov		dxTrapLeft, rax
+	
+	mov		rax, xrb
+	sub		rax, xrt
+	mov		dxTrapRight, rax
+
+
+	mov			rax, Suppress			; supress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+	mov			rax, Threshold
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+
+	mov			rax, iPitch
+	mov			iPitchHUp, rax
+	cmp			sSpr, 8
+	jl			PITCH_HALF_UP_PASS
+	inc			iPitchHUp
+PITCH_HALF_UP_PASS:	
+
+	mov		iy, y1							;;; 八荤 檬扁拳.
+	pxor	xmm0, xmm0
+	mov		cPitch, 0
+
+
+NEXT_LINE:
+
+	inc		cPitch				; 16扼牢俊 茄锅究 乔摹甫 佬扁困茄 墨款磐
+	and		cPitch, 0fh
+	cmp		cPitch, 1			; 16锅俊 茄锅究 扒呈顿扁. 盖 贸澜篮 公炼扒 秦具瘤. 弊贰辑 1苞 厚背
+	jne		FLAG_FLUIDIC_PITCH_PASS
+	cmp		PitchBuff, 0		; 乔摹 沥焊 绝栏搁 扒呈顿扁.
+	je		FLAG_FLUIDIC_PITCH_PASS
+
+	mov		rax, iy
+	sar		rax, 4			; 乔摹 沥焊绰 16 line阑 茄 窜困肺 历厘等促.
+	shl		rax, 2
+	add		rax, PitchBuff
+	movsxd		rax, dword ptr [rax]	
+
+	mov		rcx, rax
+	and		rcx, 0fh
+
+	shr		rax, SprShift
+	mov		iPitch, rax
+	add		rax, rax
+	mov		iPitch2, rax			; iPitch2
+	mov		rdx, 16
+	sub		rdx, rcx
+	
+	mov			rax, iPitch
+	mov			iPitchHUp, rax
+	cmp			rcx, 8
+	jl			PITCH_HALF_DOWN2
+	inc			iPitchHUp	
+PITCH_HALF_DOWN2:
+
+	mov		rax, iPitch				;;; 瘤开 函荐 且寸.
+	add		rax, iPitch2
+	mov		minInsp, rax		; 3 pitch 捞惑 登绢具 八荤.
+	cmp		rax, 10h
+	jge		MIN_INSP_SIZE2
+	mov		minInsp, 48
+	MIN_INSP_SIZE2:
+
+	movd		xxsSpr, rcx		; sSpr
+	movdqa		xmm1, xxsSpr
+	punpcklwd	xmm1, xxsSpr
+	pshufd		xxsSpr, xmm1, 0
+
+	movd		xxfSpr, rdx		; fSpr
+	movdqa		xmm1, xxfSpr
+	punpcklwd	xmm1, xxfSpr
+	pshufd		xxfSpr, xmm1, 0
+
+FLAG_FLUIDIC_PITCH_PASS:
+
+									; 八荤 xStart, xEnd 备窍扁. x= x1 + (x2- x1)*(iy - y1)/(y2- y1), (x1, y1)俊辑 (x2, y2)肺 捞悼且锭 烙狼狼 iy俊辑狼 ix狼 蔼 魂免
+; xStart, xEnd 
+	mov		rax, iy
+	sub		rax, y1
+	imul	rax, dxTrapLeft
+	mov		rcx, dyTrap
+	cdq
+	idiv	ecx
+	movsxd	rax, eax
+	add		rax, xlt
+	mov		xStart, rax
+	mov		ix, rax
+
+	mov		rax, iy
+	sub		rax, y1
+	imul	rax, dxTrapRight
+	mov		rcx, dyTrap
+	cdq
+	idiv	ecx
+	movsxd	rax, eax
+	add		rax, xrt
+	mov		xEnd, rax
+
+	sub		rax, xStart			; 16 byte align
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, xStart
+	mov		xEnd, rax
+
+	sub		rax, xStart
+	mov		xWidth, rax
+
+	mov		rax, xEnd
+	sub		rax, xStart
+	sub		rax, iPitch
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, xStart
+	mov		xEnd, rax
+
+	mov		rax, rrBW				; Image Address Setting
+	imul	rax, iy
+	add		rax, ImgAdr
+	add		rax, ix
+	mov		rrImgAddr, rax
+
+	add		rax, xWidth
+	mov		ImgAdrEnd, rax
+
+	mov		rrConAdr, ConAdr		; Con Address Setting
+
+	mov		rax, xStart
+	add		rax, iPitch
+	mov		pairLeft, rax
+
+	mov		rax, xEnd
+	sub		rax, iPitch
+	mov		pairRight, rax
+
+	mov		rax, xEnd			; 3pitch 康开 犬焊. 3pitch 救瞪版快 line Inspection pass
+	sub		rax, xStart
+	cmp		rax, minInsp
+	jge		LOOP_MAKE_CON_BUFF
+	inc		iy;
+	cmp		iy, y2
+	jge		END_FUNC
+
+	jmp		NEXT_LINE
+
+LOOP_MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	movdqu		xmm2, [rrImgAddr]
+	movdqa		xmm3, xmm2
+	punpcklbw	xmm2, xmm0
+	punpckhbw	xmm3, xmm0
+
+	movdqu		xmm4, [rrImgAddr+ rrBW]
+	movdqa		xmm5, xmm4
+	punpcklbw	xmm4, xmm0
+	punpckhbw	xmm5, xmm0
+	paddw		xmm2, xmm4
+	paddw		xmm3, xmm5
+	movdqu		[rrConAdr], xmm2
+	movdqu		[rrConAdr+ 10h], xmm3
+
+	add		rrImgAddr, 10h
+	add		rrConAdr, 20h
+	cmp		rrImgAddr, ImgAdrEnd
+	jl		LOOP_MAKE_CON_BUFF
+	
+	;////////////////
+	
+	mov		rrConAdr, ConAdr
+;	inc		iy						; Loop Y
+
+Conv_8:							; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+
+	mov		rax, iPitch2
+	movdqu	xxCmp, [rrConAdr+ rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rrConAdr+ rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rrConAdr+ rax+ 4]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+;	movdqa		xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+;	psubusw	xmm1, xxSupp
+;	psubusw	xxCmp, xmm1
+	pminuw	xxCmp, xxSupp
+
+
+
+	movdqu	xxSrc, [rrConAdr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xmm1, [rrConAdr+ 2]
+	paddw	xxSrc, xmm1
+	
+	psllw	xxSrc, SprShift		; SPR
+
+;	movdqa		xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+;	psubusw	xmm1, xxSupp
+;	psubusw	xxSrc, xmm1
+	pminuw	xxSrc, xxSupp
+
+	movdqa	xxMinus	, xxCmp
+	psubw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubw	xxPlus	, xxCmp
+
+Inspect_Black:
+	mov			BlackNWhite, 0
+	mov			bx, 0
+	movdqa		xxPeak, xxMinus
+	movdqa		xxPeak2, xxMinus
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	jne		DEFECT_CALL
+
+Inspect_White:
+	mov			BlackNWhite, 1
+	mov			bx, 1
+	movdqa		xxPeak, xxPlus
+	movdqa		xxPeak2, xxPlus
+	pcmpgtw		xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	jne		DEFECT_CALL
+
+End_8_Pixel:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING
+
+	add		ix, 8					; Loop X
+	add		rrConAdr, 16			; 14= 16- 2
+	cmp		ix, xEnd
+	jl		Conv_8
+	
+	jmp		PAIRING
+PAIRING_RETURN:
+
+	
+	inc		iy						; Loop Y
+	cmp		iy, y2
+	jge		END_FUNC
+	
+	jmp		NEXT_LINE
+
+DEFECT_CALL:
+	call DefectProc
+	
+	jmp		DEFECT_END
+
+
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+PAIRING:
+	mov		ix, -1
+	
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+	mov		rbx, ix
+	movsxd	rax, dword ptr [rrXoD+ 4*ix]
+	mov		rcx, rax
+	add		rax, iPitchHUp
+	mov		xPlusPitch, eax
+
+	cmp		rcx, pairLeft
+	jl		PAIR_LEFT
+
+	cmp		rcx, pairRight
+	jl		PAIR_CENTER
+
+PAIR_RIGHT:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		edx, xPlusPitch
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]	
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rax]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak,  edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+
+PAIR_LEFT:
+
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	mov		ecx, [rrXoD+ 4*rbx]					; Filter_1_Pair_Position
+	mov		eax, xPlusPitch
+	sub		eax, ecx
+	cmp		eax, 1
+	jge		PAIR_LEFT
+	cmp		eax, -1
+	jle		PAIR_LEFT_UNPAIR
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_LEFT
+
+	
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_LEFT
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_LEFT_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	movsxd		rdx, xPlusPitch
+	sub		rdx, iPitchHUp
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak,  edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_CENTER:
+
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+	
+
+	mov		ecx, [rrXoD+ 4*rbx]					; Filter_1_Pair_Position
+	cmp		ecx, xPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_DELETE
+	cmp		dx, 3
+	jge		PAIR_CENTER
+
+	
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_PAIR
+	cmp		ax, dx
+	je		PAIR_CENTER
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+LOOP_PAIR_X_END:
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_RETURN
+
+
+
+END_FUNC:
+
+	mov		rax, nPair
+;	mov		rax, rrNoD
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+ConvTrapezium ENDP
+
+
+;==============================================DefectProc=============
+DefectProc	Proc
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		DefectProc_End
+	
+	pextrw	rax, xxPeak2, 7h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DefectProc_End:
+
+RET
+DefectProc Endp
+
+
+
+
+end
diff --git a/Common_Class/SISAssem/ConvTrapFD.asm b/Common_Class/SISAssem/ConvTrapFD.asm
new file mode 100644
index 0000000..e691b7b
--- /dev/null
+++ b/Common_Class/SISAssem/ConvTrapFD.asm
@@ -0,0 +1,858 @@
+
+; 荤促府裁 康开阑 罐酒 Horizontal 规氢栏肺 八荤甫 柳青茄促.
+; Fluidic Pitch Pointer啊 乐阑 矫 CPC 八荤. - PitchBuff	equ		qword ptr[rbp+ 0d8h]
+; CPC侩 Pitch 绰 16锅俊 茄锅究 肺爹秦辑 函版
+; Fluidic Pitch Pointer啊 绝阑 矫 扁霖 Pitch 八荤. - iPitch		equ  qword ptr[rbp+ 98h]
+; 扼牢 窜困 其绢傅阑 角矫茄促. - PairAddr	equ		qword ptr[rbp+ 0b0h]
+; 其绢傅 炼扒 函版 -> +-1 俊辑 just pixel to pixel肺 函版
+
+.data
+	
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+.code
+
+ConvShift		equ		2
+ConvSize		equ		4
+SprShift		equ		4
+SprMulti		equ		16
+ConvNSprShift	equ		6
+
+
+; register 捞抚窿扁
+ix			equ  rsi
+iy			equ  rdi
+ix32		equ  esi
+iy32		equ  edi
+
+rrBW		equ  r8		; Buffer Width
+rrNoD		equ  r9		; Number of Defect
+
+rrXoD		equ  r10		; Defect X
+rrYoD		equ  r11		; Defect Y
+rrToD		equ  r12		; Defect Type
+rrPoD		equ  r13		; Defect Peak
+
+rrImgAddr		equ  r14		; Image Address
+rrConAdr		equ  r15
+
+
+; xmm 捞抚 窿扁
+xxTemp		equ		xmm1
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+xxSrc2		equ		xmm4
+xxCmp2		equ		xmm5
+xxThres		equ		xmm6
+xxSupp		equ		xmm7
+
+xxfSPR		equ		xmm8
+xxsSPR		equ		xmm9
+
+xxZeroBack	equ		xmm10
+xxOne		equ		xmm11
+xxPeak		equ		xmm12
+xxPeak2		equ		xmm13
+xxNoise		equ		xmm15
+
+
+
+y1		equ  qword ptr[rbp+ 30h]
+y2		equ  qword ptr[rbp+ 38h]
+xlt		equ  qword ptr[rbp+ 40h]				; left position top
+xlb		equ  qword ptr[rbp+ 48h]				; left position bottom
+
+xrt			equ  qword ptr[rbp+ 50h]				; right position 	top
+xrb			equ  qword ptr[rbp+ 58h]				; rigfht position bottom
+Threshold	equ  qword ptr[rbp+ 60h]
+Suppress	equ  qword ptr[rbp+ 68h]
+
+
+DefectX		equ  qword ptr[rbp+ 70h]
+DefectY		equ  qword ptr[rbp+ 78h]
+DefectType		equ  qword ptr[rbp+ 80h]
+DefectVal		equ  qword ptr[rbp+ 88h]
+
+SprShiftF	equ  qword ptr[rbp+ 90h]
+iPitch		equ  qword ptr[rbp+ 98h]
+fSPR		equ  qword ptr[rbp+ 0a0h]
+sSPR		equ  qword ptr[rbp+ 0a8h]
+
+
+PairAddr	equ		qword ptr[rbp+ 0b0h]
+nPair		equ		qword ptr[rbp+ 0b8h]
+MaxPair		equ		qword ptr[rbp+ 0c0h]
+PairSize	equ		qword ptr[rbp+ 0c8h]
+
+BuffWidth	equ		qword ptr[rbp+ 0d0h]
+PitchBuff	equ		qword ptr[rbp+ 0d8h]
+
+
+ConvTrapFD		PROC C
+	local	BlackNWhite	: qword	
+	local	dxTrapLeft				: qword
+	local	dxTrapRight				: qword
+	local	dyTrap				: qword
+	local	xStart			: qword
+	local	xEnd			: qword
+	local	xWidth			: qword
+	local	ImgAdrEnd		: qword
+	local	iPitch2		: qword
+	local	ImgAdr			: qword
+	local	ConAdr			: qword
+	local	maxPixelD		: qword
+	
+	local	minInsp		: qword
+	
+	local	pairLeft		: qword
+	local	pairRight		: qword
+	local	iPitchHUp		: qword
+	local	cPitch			: qword ; 啊函 林扁 墨款飘.
+	local	xPlusPitch		: dword
+
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 068h+ 30h
+
+	mov		ImgAdr, rcx
+	mov		ConAdr, rdx
+	mov		maxPixelD, r8
+	sub		maxPixelD, 16
+	
+	
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+	mov		rax, nPair
+	mov		rcx, PairSize
+	imul	rax, rcx
+	add		rax, PairAddr
+	mov		PairAddr, rax
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+
+
+	mov		rax, iPitch				;;; 瘤开 函荐 且寸.
+	add		rax, rax
+	mov		iPitch2, rax		; conv buff绰 2byte 窜困捞骨肺..
+	add		rax, iPitch
+	mov		minInsp, rax		; 3 pitch 捞惑 登绢具 八荤.
+	cmp		rax, 10h
+	jge		MIN_INSP_SIZE
+	mov		minInsp, 48
+	MIN_INSP_SIZE:
+					
+	mov		rax, y2			; 荤促府裁 芭府 傍瞒 备窍扁
+	sub		rax, y1
+	mov		dyTrap,  rax
+	
+	mov		rax, xlb
+	sub		rax, xlt
+	mov		dxTrapLeft, rax
+	
+	mov		rax, xrb
+	sub		rax, xrt
+	mov		dxTrapRight, rax
+
+
+	mov			rax, Suppress			; supress
+	sal			rax, ConvNSprShift
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+	mov			rax, Threshold
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+
+	mov			rax, iPitch
+	mov			iPitchHUp, rax
+	cmp			sSpr, 8
+	jl			PITCH_HALF_UP_PASS
+	inc			iPitchHUp
+PITCH_HALF_UP_PASS:	
+
+	mov		iy, y1							;;; 八荤 檬扁拳.
+	pxor	xmm0, xmm0
+	mov		cPitch, 0
+
+
+NEXT_LINE:
+
+	inc		cPitch				; 16扼牢俊 茄锅究 乔摹甫 佬扁困茄 墨款磐
+	and		cPitch, 0fh
+	cmp		cPitch, 1			; 16锅俊 茄锅究 扒呈顿扁. 盖 贸澜篮 公炼扒 秦具瘤. 弊贰辑 1苞 厚背
+	jne		FLAG_FLUIDIC_PITCH_PASS
+	cmp		PitchBuff, 0		; 乔摹 沥焊 绝栏搁 扒呈顿扁.
+	je		FLAG_FLUIDIC_PITCH_PASS
+
+	mov		rax, iy
+	sar		rax, 4			; 乔摹 沥焊绰 16 line阑 茄 窜困肺 历厘等促.
+	shl		rax, 2
+	add		rax, PitchBuff
+	movsxd	rax, dword ptr [rax]	
+
+	mov		rcx, rax
+	and		rcx, 0fh
+
+	shr		rax, SprShift
+	mov		iPitch, rax
+	add		rax, rax
+	mov		iPitch2, rax			; iPitch2
+	mov		rdx, 16
+	sub		rdx, rcx
+	
+	mov			rax, iPitch
+	mov			iPitchHUp, rax
+	cmp			rcx, 8
+	jl			PITCH_HALF_DOWN2
+	inc			iPitchHUp	
+PITCH_HALF_DOWN2:	
+
+	mov		rax, iPitch				;;; 瘤开 函荐 且寸.
+	add		rax, iPitch2
+	mov		minInsp, rax		; 3 pitch 捞惑 登绢具 八荤.
+	cmp		rax, 10h
+	jge		MIN_INSP_SIZE2
+	mov		minInsp, 48
+	MIN_INSP_SIZE2:
+
+	movd		xxsSpr, rcx		; sSpr
+	movdqa		xmm1, xxsSpr
+	punpcklwd	xmm1, xxsSpr
+	pshufd		xxsSpr, xmm1, 0
+
+	movd		xxfSpr, rdx		; fSpr
+	movdqa		xmm1, xxfSpr
+	punpcklwd	xmm1, xxfSpr
+	pshufd		xxfSpr, xmm1, 0
+
+FLAG_FLUIDIC_PITCH_PASS:
+
+									; 八荤 xStart, xEnd 备窍扁. x= x1 + (x2- x1)*(iy - y1)/(y2- y1), (x1, y1)俊辑 (x2, y2)肺 捞悼且锭 烙狼狼 iy俊辑狼 ix狼 蔼 魂免
+; xStart, xEnd 
+	mov		rax, iy
+	sub		rax, y1
+	imul	rax, dxTrapLeft
+	mov		rcx, dyTrap
+	cdq
+	idiv	ecx
+	movsxd	rax, eax
+	add		rax, xlt
+	mov		xStart, rax
+	mov		ix, rax
+
+	mov		rax, iy
+	sub		rax, y1
+	imul	rax, dxTrapRight
+	mov		rcx, dyTrap
+	cdq
+	idiv	ecx
+	movsxd	rax, eax
+	add		rax, xrt
+	mov		xEnd, rax
+
+	sub		rax, xStart			; 16 byte align
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, xStart
+	mov		xEnd, rax
+
+	sub		rax, xStart
+	mov		xWidth, rax
+
+	mov		rax, xEnd
+	sub		rax, xStart
+	sub		rax, iPitch
+	sub		rax, 1
+	sar		rax, 3
+	sal		rax, 3
+	add		rax, xStart
+	mov		xEnd, rax
+
+	mov		rax, rrBW				; Image Address Setting
+	imul	rax, iy
+	add		rax, ImgAdr
+	add		rax, ix
+	mov		rrImgAddr, rax
+
+	add		rax, xWidth
+	mov		ImgAdrEnd, rax
+
+	mov		rrConAdr, ConAdr		; Con Address Setting
+	
+	mov		rax, xStart
+	add		rax, iPitch
+	mov		pairLeft, rax
+	
+	mov		rax, xEnd
+	sub		rax, iPitch
+	mov		pairRight, rax
+
+	mov		rax, xEnd			; 3pitch 康开 犬焊. 3pitch 救瞪版快 line Inspection pass
+	sub		rax, xStart
+	cmp		rax, minInsp
+	jge		LOOP_MAKE_CON_BUFF
+	inc		iy;
+	cmp		iy, y2
+	jge		END_FUNC
+
+	jmp		NEXT_LINE
+
+LOOP_MAKE_CON_BUFF:					; 茄 扼牢 傈眉 技肺 钦滚欺 父甸扁
+	movdqu		xmm2, [rrImgAddr]
+	movdqa		xmm3, xmm2
+	punpcklbw	xmm2, xmm0
+	punpckhbw	xmm3, xmm0
+
+	movdqu		xmm4, [rrImgAddr+ rrBW]
+	movdqa		xmm5, xmm4
+	punpcklbw	xmm4, xmm0
+	punpckhbw	xmm5, xmm0
+	paddw		xmm2, xmm4
+	paddw		xmm3, xmm5
+	movdqu		[rrConAdr], xmm2
+	movdqu		[rrConAdr+ 10h], xmm3
+
+	add		rrImgAddr, 10h
+	add		rrConAdr, 20h
+	cmp		rrImgAddr, ImgAdrEnd
+	jl		LOOP_MAKE_CON_BUFF
+	
+	;////////////////
+	
+	mov		rrConAdr, ConAdr
+;	inc		iy						; Loop Y
+
+Conv_8:							; 八荤 风凭 (16俺 窜困啊 酒聪扼 8霸 窜困肺 楷魂 啊瓷)
+
+
+	mov		rax, iPitch2
+	movdqu	xxCmp, [rrConAdr+ rax]		; 厚背 滚欺 啊肺钦 父甸扁
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xmm1, [rrConAdr+ rax+ 2]
+	psllw	xmm1, SprShift
+	paddw	xxCmp, xmm1
+	
+	movdqu	xmm1, [rrConAdr+ rax+ 4]
+	pmullw	xmm1, xxsSPR
+	paddw	xxCmp, xmm1
+
+;	movdqa		xmm1, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+;	psubusw	xmm1, xxSupp
+;	psubusw	xxCmp, xmm1
+	pminuw	xxCmp, xxSupp
+
+
+	movdqu	xxSrc, [rrConAdr]			; 家胶滚欺 啊肺钦 父甸扁
+	movdqu	xmm1, [rrConAdr+ 2]
+	paddw	xxSrc, xmm1
+	
+	psllw	xxSrc, SprShift		; SPR
+
+;	movdqa		xmm1, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+;	psubusw	xmm1, xxSupp
+;	psubusw	xxSrc, xmm1
+	pminuw	xxSrc, xxSupp
+
+
+Inspect_Black:
+	mov			BlackNWhite, 0
+	mov			bx, 0
+	movdqa		xxPeak, xxCmp
+	psubw		xxPeak, xxSrc
+	movdqa		xxPeak2, xxPeak
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	jne		DEFECT_CALL
+
+Inspect_White:
+	mov			BlackNWhite, 1
+	mov			bx, 1
+	movdqa		xxPeak, xxSrc
+	psubw		xxPeak, xxCmp
+	movdqa		xxPeak2, xxPeak
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	jne		DEFECT_CALL
+
+End_8_Pixel:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING
+
+	add		ix, 8					; Loop X
+	add		rrConAdr, 16			; 14= 16- 2
+	cmp		ix, xEnd
+	jl		Conv_8
+	
+	jmp		PAIRING
+PAIRING_RETURN:
+
+	
+	inc		iy						; Loop Y
+	cmp		iy, y2
+	jge		END_FUNC
+	
+	jmp		NEXT_LINE
+
+DEFECT_CALL:
+	call DefectProcFD
+	
+	jmp		DEFECT_END
+
+
+Defect_End:
+	sub		ix, 7
+	cmp		BlackNWhite, 0
+	je		Inspect_White
+	
+	jmp		End_8_Pixel
+
+
+PAIRING:
+	mov		ix, -1
+	
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+	mov		rbx, ix
+	movsxd	rax, dword ptr [rrXoD+ 4*ix]
+	mov		rcx, rax
+	add		rax, iPitchHUp
+	mov		xPlusPitch, eax
+
+	cmp		rcx, pairLeft
+	jl		PAIR_LEFT
+
+	cmp		rcx, pairRight
+	jl		PAIR_CENTER
+
+PAIR_RIGHT:
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		edx, xPlusPitch
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	
+	movzx	edx, word ptr[rrToD+ 2*ix]	
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rax]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak,  edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+
+PAIR_LEFT:
+
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	mov		ecx, [rrXoD+ 4*rbx]					; Filter_1_Pair_Position
+	mov		eax, xPlusPitch
+	sub		eax, ecx
+	cmp		eax, 1
+	jge		PAIR_LEFT
+	cmp		eax, -1
+	jle		PAIR_LEFT_UNPAIR
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_LEFT
+
+	
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_LEFT
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_LEFT_UNPAIR:
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	movsxd		rdx, xPlusPitch
+	sub		rdx, iPitchHUp
+	mov		(astPair ptr [rax]).x, edx
+	mov		(astPair ptr [rax]).y, iy32
+	movzx	edx, word ptr[rrToD+ 2*ix]
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak,  edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_CENTER:
+
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+	
+
+	mov		ecx, [rrXoD+ 4*rbx]					; Filter_1_Pair_Position
+	cmp		ecx, xPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_DELETE
+	cmp		dx, 3
+	jge		PAIR_CENTER
+
+	
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_PAIR
+	cmp		ax, dx
+	je		PAIR_CENTER
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+LOOP_PAIR_X_END:
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_RETURN
+
+
+
+END_FUNC:
+
+	mov		rax, nPair
+;	mov		rax, rrNoD
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+ConvTrapFD		ENDP
+
+
+
+;==============================================GetNoiseHori=============
+DefectProcFD	Proc
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0h
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeak2, 0h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1h
+	cmp		rax, 0h
+	je		Defect_02
+	
+	pextrw	rax, xxPeak2, 1h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2h
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeak2, 2h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3h
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeak2, 3h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4h
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeak2, 4h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5h
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeak2, 5h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6h
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeak2, 6h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7h
+	cmp		rax, 0h
+	je		DefectProc_End
+	
+	pextrw	rax, xxPeak2, 7h
+	sar		rax, 6
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DefectProc_End:
+
+	RET
+DefectProcFD Endp
+
+
+
+
+;==============================================GetNoiseHori=============
+GetNoiseHori	PROC	; rcx= iPitch16
+	local	PitchSum[2]	: qword
+
+	mov			rax, rcx
+	and			rax, 0fh	
+	movd		xxsSpr, eax
+	punpcklwd	xxsSpr, xxsSpr
+	pshufd		xxsSpr, xxsSpr, 0
+	mov			rbx, SprMulti
+	sub			rbx, rax
+	movd		xxfSpr, rbx
+	punpcklwd	xxfSpr, xxfSpr
+	pshufd		xxfSpr, xxfSpr, 0
+
+	sar			rcx, SprShift
+
+	push	rrImgAddr
+
+	pxor	xxNoise, xxNoise		; Noise
+	mov		rax, 0					; count to 16
+
+LOOP_PITCH:
+	movdqu		xxSrc, [rrImgAddr]			; Src
+	movdqu		xxCmp, [rrImgAddr+ 1]
+
+	movdqa		xxSrc2, xxSrc
+	movdqa		xxCmp2, xxCmp	
+	punpcklbw	xxSrc, xmm0
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxSrc2, xmm0	
+	punpckhbw	xxCmp2, xmm0	
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc2, xxCmp2	
+	psllw		xxSrc, SprShift
+	psllw		xxSrc2, Sprshift
+
+	mov			rbx, rrImgAddr				; Ref
+	add			rbx, rcx
+
+	movdqu		xxCmp, [rbx]
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp, xxfSpr
+	pmullw		xxCmp2, xxfSpr	
+	psubw		xxSrc, xxCmp
+	psubw		xxSrc2, xxCmp2
+
+	movdqu		xxCmp, [rbx+ 1]
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp, xxfSpr
+	pmullw		xxCmp2, xxfSpr	
+	psubw		xxSrc, xxCmp
+	psubw		xxSrc2, xxCmp2
+
+	movdqu		xxCmp, [rbx+ 2]
+	movdqa		xxCmp2, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp, xxfSpr
+	pmullw		xxCmp2, xxfSpr	
+	psubw		xxSrc, xxCmp
+	psubw		xxSrc2, xxCmp2
+
+
+	pabsw		xxSrc, xxSrc					; Rslt
+	pabsw		xxSrc2, xxSrc2
+	psubusw	xxSrc, xxZeroBack
+	psubusw	xxSrc2, xxZeroBack
+	pmaddwd	xxSrc, xxOne						; Word -> DWord (16->32)
+	pmaddwd	xxSrc2, xxOne
+
+	movdqa		xxCmp, xxSrc
+	punpckldq	xxSrc, xmm0						; DWord -> QWord (32 -> 64)
+	punpckldq	xxCmp, xmm0
+
+	paddq		xxNoise, xxSrc
+	paddq		xxNoise, xxcmp
+
+	add		rrImgAddr, rrBW
+	inc		rax
+	cmp		rax, 16
+	jl		LOOP_PITCH
+
+	lea		rcx, PitchSum
+	movdqu	[rcx], xxNoise
+	mov		rax, [rcx]
+	add		rax, [rcx+ 8]
+
+	pop		rrImgAddr
+
+RET
+GetNoiseHori	ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvTrapVert.asm b/Common_Class/SISAssem/ConvTrapVert.asm
new file mode 100644
index 0000000..058c992
--- /dev/null
+++ b/Common_Class/SISAssem/ConvTrapVert.asm
@@ -0,0 +1,1118 @@
+
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+
+.code
+
+TrapLeft		equ		qword ptr[rbp+ 30h]
+TrapRight		equ		qword ptr[rbp+ 38h]
+LeftTop			equ		qword ptr[rbp+ 40h]
+LeftBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+PairAddr		equ		qword ptr[rbp+ 70h]
+nPair			equ		qword ptr[rbp+ 78h]
+maxPair			equ		qword ptr[rbp+ 80h]
+PairSize		equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch16		equ		qword ptr[rbp+ 98h]
+Threshold		equ		qword ptr[rbp+ 0a0h]
+Suppress		equ		qword ptr[rbp+ 0a8h]
+
+i2Pitch16		equ		qword ptr[rbp+ 0b0h]
+RightTop		equ		qword ptr[rbp+ 0b8h]
+RightBottom		equ		qword ptr[rbp+ 0c0h]
+PitchBuff		equ		qword ptr[rbp+ 0c8h]
+
+hPitch16		equ		qword ptr[rbp+ 0d0h]
+bUseUnpair		equ		qword ptr[rbp+ 0d8h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+
+
+
+rrBW			equ		r8
+rrNoD			equ		r9
+
+rrXoD			equ		r10
+rrYoD			equ		r11
+rrToD			equ		r12
+rrPoD			equ		r13
+rrImgAddr		equ		r14
+rrConAddr		equ		r15
+rdImgAddr		equ		r14d
+rwImgAddr		equ		r14w
+rdConAddr		equ		r15d
+rwConAddr		equ		r15w
+
+
+xxTemp		equ		xmm1
+
+xxSrc		equ		xmm2
+xxCmp		equ		xmm3
+
+xxPeak		equ		xmm4
+xxPeakEx	equ		xmm5
+
+xxfSPR		equ		xmm6
+xxsSPR		equ		xmm7
+
+xxThres		equ		xmm8
+xxSupp		equ		xmm9
+
+
+xxSrc1		equ		xmm10		; EXTRA
+xxSrc2		equ		xmm11		; EXTRA
+xxSrc3		equ		xmm12		; EXTRA
+
+xxCmp1		equ		xmm13		; EXTRA
+xxCmp2		equ		xmm14		; EXTRA
+xxCmp3		equ		xmm15		; EXTRA
+
+
+
+
+ConvSprShift		equ		6	; shift 2 & shift 4
+ConvShift			equ		2
+ConvMulti			equ		4
+SprShift			equ		4
+SprMulti			equ		16
+
+
+
+ConvTrapezium_Vert PROC
+	local	ImgAddr		: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	InspRight		: qword
+	local	F_Y2Insp		: qword	
+	local	maxPixelD		: qword
+	
+	local	ConAddr		: qword
+	local	ConPitch		: qword	; 8*iPitch		
+	local	iPitch			: qword
+	local	iPitch2		: qword
+	
+	local	iPitchHUp		: qword
+	local	yPlusPitch		: qword	
+	local	dxTrap			: qword
+	local	dyTop			: qword
+	
+	local	dyBottom		: qword	
+	local	yStart			: qword
+	local	yEnd			: qword
+	local	yEndPitch		: qword
+	
+	local	pairTop		: qword
+	local	pairBottom		: qword
+	
+	local	hPitch			: qword
+	local	minInsp		: qword
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 0a8h
+
+
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr	, rcx
+	mov		ConAddr	, rdx
+	add		ConAddr, 20h
+	mov		maxPixelD	, r8
+
+
+
+; register 且寸.
+	mov		ix, TrapLeft
+	mov		iy, LeftTop
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+	mov		rrBW, BuffWidth
+
+;拌魂 蔼 父甸扁
+	mov		rax, iPitch16			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	mov		rax, hPitch16
+	sar		rax, SprShift
+	mov		hPitch, rax
+
+	sal		rax, 1						; iPitch2
+	mov		iPitch2, rax
+
+	add		rax, iPitch				;;; 瘤开 函荐 且寸.
+	mov		minInsp, rax		; 3 pitch 捞惑 登绢具 八荤.
+	cmp		rax, 10h
+	jge		MIN_INSP_SIZE2
+	mov		minInsp, 48
+	MIN_INSP_SIZE2:
+
+
+	mov		rax, TrapRight			; Right Padding
+	sub		rax, TrapLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, TrapLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(16 byte align)
+
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+
+	mov		rax, TrapRight
+	sub		rax, TrapLeft
+	mov		dxTrap, rax
+	
+	mov		rax, RightTop
+	sub		rax, LeftTop
+	mov		dyTop, rax
+	
+	mov		rax, RightBottom
+	sub		rax, LeftBottom
+	mov		dyBottom, rax
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Threshold			; Threshold
+	movd		xxThres, rax
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	mov			rax, Suppress			; supress
+	sal			rax, ConvSprShift
+	movd		xxSupp, rax
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+
+
+
+	mov			rax, iPitch
+	mov			rcx, iPitch16
+	and			rcx, 0fh
+
+	cmp			rcx, 8
+	jl			PITCH_H_UP_PASS
+	inc			rax
+PITCH_H_UP_PASS:
+	mov			iPitchHUp, rax
+
+	movd		xxsSPR, rcx			; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSPR, rax
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPr
+	pshufd		xxfSPr, xmm0, 0
+
+
+
+
+
+
+
+START_FUNC:
+	pxor	xmm0, xmm0	
+	
+	jmp		LOOP_X_CHECK
+
+LOOP_X_TAIL:
+	jmp		PAIRING_VERT
+PAIRING_VERT_RETURN:
+
+
+
+LOOP_X_CHECK:
+	cmp		ix, InspRight
+	jge		END_FUNC
+
+LOOP_X_BODY:
+	cmp		PitchBuff, 0
+	jne		FPC_READ
+FPC_READ_RETURN:
+
+	jmp		FIND_CONBOX
+FIND_CONBOX_RETURN:
+
+	mov		iy, yStart
+	mov		rax, rrBW
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddr
+	mov		rrImgAddr, rax
+	mov		rrConAddr, ConAddr
+
+	dec		iy
+	sub		rrImgAddr, rrBW
+	sub		rrConAddr, 20h
+	jmp		MAKE_CONBUFF_BODY_TAIL_CHECK
+MAKE_CONBUFF_RETURN:
+
+	mov		iy, yStart
+	mov		rrConAddr, ConAddr
+	mov		F_Y2Insp, 0
+	
+	jmp		LOOP_Y_CHECK
+
+
+
+	
+LOOP_Y_TAIL:
+	inc		iy
+	add		rrConAddr, 20h
+
+LOOP_Y_CHECK:
+	cmp		rrNoD, maxPixelD
+	jge		PAIRING_VERT
+	
+	cmp		iy, yEndPitch
+	jl		LOOP_Y_BODY
+
+; Y Double Check, Y绵 Conv甫 16 官捞飘 窜困肺 父靛绰单. 八荤绰 8官捞飘究 窍骨肺 2锅 y风橇 倒府扁.
+	add		ix, 8
+	cmp		F_Y2Insp, 1
+	jge		LOOP_X_TAIL	; y_end & goto x_tail
+
+	mov		F_Y2Insp, 1
+	mov		iy, yStart
+	mov		rrConAddr, ConAddr
+	add		rrConAddr, 10h
+
+	jmp		LOOP_Y_BODY
+
+
+FPC_READ:
+	mov		rax, ix
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, PitchBuff
+	movsxd	rax, dword ptr[rax]
+
+	mov		rcx, rax
+	and		rcx, 0fh
+
+	shr		rax, SprShift
+	mov		iPitch, rax
+	shl		rax, 1
+	mov		iPitch2, rax
+	mov		rdx, 010h
+	sub		rdx, rcx
+
+	mov		rax, iPitch
+	cmp		rcx, 8
+	jl		PITCH_HUP_PASS2
+	inc		rax	
+	PITCH_HUP_PASS2:
+	mov		iPitchHUp, rax
+
+	movd		xxsSpr, rcx		; sSpr
+	movdqa		xmm1, xxsSpr
+	punpcklwd	xmm1, xxsSpr
+	pshufd		xxsSpr, xmm1, 0
+
+	movd		xxfSpr, rdx		; fSpr
+	movdqa		xmm1, xxfSpr
+	punpcklwd	xmm1, xxfSpr
+	pshufd		xxfSpr, xmm1, 0
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+
+	jmp		FPC_READ_RETURN
+
+
+FIND_CONBOX:
+
+FIND_TOP:
+	mov		rax, ix
+	cmp		dyTop, 0
+	jg		TOP_DIR_PLUS
+	jmp		FIND_TOP_PROC
+TOP_DIR_PLUS:
+	add		rax, 010h
+FIND_TOP_PROC:
+	sub		rax, TrapLeft
+	mul		dyTop
+	mov		rcx, dxTrap
+	cdq
+	idiv	ecx
+	movsxd	rax, eax
+	add		rax, LeftTop
+	mov		yStart, rax
+
+FIND_BOTTOM:
+	mov		rax, ix
+	cmp		dyBottom, 0
+	jl		BOT_DIR_MINUS
+	jmp		FIND_BOT_PROC
+BOT_DIR_MINUS:
+	add		rax, 010h
+FIND_BOT_PROC:
+	sub		rax, TrapLeft
+	mul		dyBottom
+	mov		rcx, dxTrap
+	cdq
+	idiv	ecx
+	movsxd	rax, eax
+	add		rax, LeftBottom
+	mov		yEnd, rax
+	
+	sub		rax, iPitch
+	dec		rax
+	mov		yEndPitch, rax
+	
+	sub		rax, yStart				; 3Pitch Size Filtering
+	cmp		rax, minInsp
+	jge		FIND_CONBOX_RETURN
+
+	mov		rax, dyBottom
+	cmp		dyTop, rax
+	jge		END_FUNC
+
+	inc		ix
+	cmp		ix, InspRight
+	jge		END_FUNC
+	
+
+	jmp		FIND_CONBOX
+
+
+
+; Con 滚欺 父甸扁
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxSrc1, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxSrc1, xmm0
+
+	movdqu		xxCmp, [rrImgAddr+ 1]
+	movdqa		xxCmp1, xxCmp
+	punpcklbw	xxCmp, xmm0
+	punpckhbw	xxCmp1, xmm0
+
+	paddw		xxSrc, xxCmp
+	paddw		xxSrc1, xxCmp1
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxSrc1
+	
+	add		rrImgAddr, rrBW
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, yEnd
+	jle		MAKE_CONBUFF_BODY_TAIL_CHECK
+	
+	jmp		MAKE_CONBUFF_RETURN
+
+
+
+
+LOOP_Y_BODY:
+
+	movdqu	xxSrc1, [rrConAddr]			; 家胶 滚欺
+	movdqu	xxSrc2, [rrConAddr+ 20h]
+	movdqa	xxSrc, xxSrc1
+	paddw	xxSrc, xxSrc2
+	psllw	xxSrc, SprShift
+
+;	movdqa		xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+;	psubusw	xxTemp, xxSupp
+;	psubusw	xxSrc, xxTemp
+	pminuw	xxSrc, xxSupp
+
+
+
+	mov		rax, rrConAddr				; 厚背 滚欺 钦 父甸扁
+	add		rax, ConPitch
+
+	movdqu	xxCmp1, [rax]
+	movdqa	xxCmp, xxCmp1
+	pmullw	xxCmp, xxfSPR
+
+	movdqu	xxCmp2, [rax+ 20h]
+	movdqa	xxTemp, xxCmp2
+	psllw	xxTemp, SprShift
+	paddw	xxCmp, xxTemp
+	
+	movdqu	xxTemp, [rax+ 40h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+;	movdqa		xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+;	psubusw	xxTemp, xxSupp
+;	psubusw	xxCmp, xxTemp
+	pminuw	xxCmp, xxSupp
+
+
+
+	JMP		REINSPECT_PRE
+REINSPECT_RETURN:
+;	JMP		ReReINSPECT_PRE
+ReReINSPECT_RETURN:
+
+INSPECT_BLACK:
+	movdqa		xxPeakEx, xxCmp
+	psubusw	xxPeakEx, xxSrc
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			REINSPECT_BLACK
+
+INSPECT_WHITE:
+	movdqa		xxPeakEx	, xxSrc
+	psubusw	xxPeakEx	, xxCmp
+
+	movdqa		xxPeak, xxPeakEx
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+	cmp			rax, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			REINSPECT_WHITE
+
+
+REINSPECT_PRE:
+;JMP		REINSPECT_RETURN
+	paddw	xxCmp1, xxCmp2			; 厚背 滚欺 1+2
+	psllw	xxCmp1, SprShift
+	
+	movdqu	xxSrc3, [rrConAddr- 20h]	; 惑措 滚欺 1+ 2+ 3
+	pmullw	xxSrc3, xxSSPR
+	
+	psllw	xxSrc1, SprShift
+	paddw	xxSrc3, xxSrc1
+	
+	pmullw	xxSrc2, xxFSpr
+	paddw	xxSrc3, xxSrc2
+
+	JMP		REINSPECT_RETURN
+
+REINSPECT_BLACK:
+	movdqa		xxTemp, xxCmp1
+	psubusw	xxTemp, xxSrc3	;psubusw	xxPlus	, xxCmp
+
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_00	;ReReINSPECT_BLACK
+
+REINSPECT_WHITE:
+	movdqa		xxTemp, xxSrc3
+	psubusw	xxTemp, xxCmp1	;psubusw	xxMinus	, xxSrc
+
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_00	;ReReINSPECT_WHITE
+
+
+ReReINSPECT_PRE:
+jmp		ReReINSPECT_RETURN
+	mov		rax, rrBW
+	mul		iy
+	add		rax, ix
+	add		rax, hPitch
+	add		rax, ImgAddr
+	movdqu	xxSrc1, [rax]
+	movdqu	xxSrc2, [rax+ rrBW]
+	
+	movdqa		xxCmp3, xxSrc1
+	punpcklbw	xxCmp3, xmm0
+	movdqa		xxTemp, xxSrc2
+	punpcklbw	xxTemp, xmm0
+	paddw		xxCmp3, xxTemp
+	
+	pmullw	xxCmp3, xxFSpr
+	
+	
+	psrldq	xxSrc1, 1
+	psrldq	xxSrc2, 1
+	
+	movdqa		xxTemp, xxSrc1
+	punpcklbw	xxTemp, xmm0
+	movdqa		xxCmp2, xxSrc2
+	punpcklbw	xxCmp2, xmm0
+	paddw	xxTemp, xxCmp2
+	psllw	xxTemp, SprShift
+	paddw	xxCmp3, xxTemp
+
+	psrldq	xxSrc1, 1
+	psrldq	xxSrc2, 1
+	
+	movdqa		xxTemp, xxSrc1
+	punpcklbw	xxTemp, xmm0
+	movdqa		xxCmp2, xxSrc2
+	punpcklbw	xxCmp2, xmm0
+	paddw	xxTemp, xxCmp2
+	pmullw	xxTemp, xxSSpr
+	paddw	xxCmp3, xxTemp
+	
+;	jmp		ReReINSPECT_RETURN
+
+ReReINSPECT_BLACK:
+jmp		DEFECT_00
+	movdqa		xxTemp, xxCmp3
+	psubusw	xxTemp, xxSrc
+
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			INSPECT_WHITE
+	mov			rbx, 0
+	jmp			DEFECT_P_0
+
+ReReINSPECT_WHITE:
+jmp		DEFECT_00
+	movdqa		xxTemp, xxSrc
+	psubusw	xxTemp, xxCmp3
+
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	pmovmskb	rcx, xxPeak
+	cmp			rcx, 0
+	je			LOOP_Y_TAIL
+	mov			rbx, 1
+	jmp			DEFECT_P_0
+
+
+DEFECT_P_0:
+	inc		ix
+	inc		iy
+	pextrw	rax, xxPeak, 0
+	cmp		rcx, 0h
+	je		DEFECT_P_1
+	pextrw	rax, xxPeakEx, 0
+	sar		rax, ConvSprShift
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ix32
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, ebx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, ecx
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	
+DEFECT_P_1:
+	inc		ix
+	pextrw	rax, xxPeak, 1
+	cmp		rcx, 0h
+	je		DEFECT_P_2
+	pextrw	rax, xxPeakEx, 1
+	sar		rax, ConvSprShift
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ix32
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, ebx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, ecx
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	
+DEFECT_P_2:
+	inc		ix
+	pextrw	rax, xxPeak, 2
+	cmp		rcx, 0h
+	je		DEFECT_P_3
+	pextrw	rax, xxPeakEx, 2
+	sar		rax, ConvSprShift
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ix32
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, ebx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, ecx
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+
+DEFECT_P_3:
+	inc		ix
+	pextrw	rax, xxPeak, 3
+	cmp		rcx, 0h
+	je		DEFECT_P_4
+	pextrw	rax, xxPeakEx, 3
+	sar		rax, ConvSprShift
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ix32
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, ebx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, ecx
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+
+DEFECT_P_4:
+	inc		ix
+	pextrw	rax, xxPeak, 4
+	cmp		rcx, 0h
+	je		DEFECT_P_5
+	pextrw	rax, xxPeakEx, 4
+	sar		rax, ConvSprShift
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ix32
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, ebx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, ecx
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+
+DEFECT_P_5:
+	inc		ix
+	pextrw	rax, xxPeak, 5
+	cmp		rcx, 0h
+	je		DEFECT_P_6
+	pextrw	rax, xxPeakEx, 5
+	sar		rax, ConvSprShift
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ix32
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, ebx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, ecx
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+
+DEFECT_P_6:
+	inc		ix
+	pextrw	rax, xxPeak, 6
+	cmp		rcx, 0h
+	je		DEFECT_P_7
+	pextrw	rax, xxPeakEx, 6
+	sar		rax, ConvSprShift
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ix32
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, ebx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, ecx
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+
+DEFECT_P_7:
+	inc		ix
+	pextrw	rax, xxPeak, 7
+	cmp		rcx, 0h
+	je		DEFECT_P_END
+	pextrw	rax, xxPeakEx, 7
+	sar		rax, ConvSprShift
+
+	mov		rax, PairAddr
+
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ix32
+	mov		(astPair ptr [rax]).y, iy32
+	mov		(astPair ptr [rax]).dtype, ebx
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, ecx
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+
+DEFECT_P_END:
+	sub		ix, 8
+	dec		iy
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxPeakEx, 0
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxPeakEx, 1
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxPeakEx, 2
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxPeakEx, 3
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxPeakEx, 4
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxPeakEx, 5
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxPeakEx, 6
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7
+	cmp		rax, 0h
+	je		DEFECT_END
+	
+	pextrw	rax, xxPeakEx, 7
+	sar		rax, ConvSprShift
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	mov		[rrToD+ 2*rrNoD], bx
+	mov		[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_END:
+	sub		ix, 7
+	cmp		bx, 0
+	je		INSPECT_WHITE
+	
+	jmp		LOOP_Y_TAIL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	PAIRING_VERT_RETURN
+	mov		rax, yStart
+	add		rax, iPitch
+	mov		pairTop, rax
+
+	mov		rax, yEndPitch
+	sub		rax, iPitch
+	mov		pairBottom, rax
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*iy], 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]				; Filter_2_Pair_XPosition
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrConAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrConAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwConAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdConAddr
+	movzx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movzx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		PAIRING_VERT_RETURN
+
+
+
+END_FUNC:
+
+	mov		rax, nPair					; return rrNoD
+	;mov		rax, rrNoD
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+ConvTrapezium_Vert ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvVert2-DoubleCmp.asm b/Common_Class/SISAssem/ConvVert2-DoubleCmp.asm
new file mode 100644
index 0000000..c32c2dd
--- /dev/null
+++ b/Common_Class/SISAssem/ConvVert2-DoubleCmp.asm
@@ -0,0 +1,611 @@
+
+
+
+
+.data
+
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+
+.code
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType	equ		qword ptr[rbp+ 60h]
+DefectVal	equ		qword ptr[rbp+ 68h]
+
+
+BuffWidth	equ		qword ptr[rbp+ 70h]
+iPitch		equ		qword ptr[rbp+ 78h]
+fSPR		equ		qword ptr[rbp+ 80h]
+sSPR		equ		qword ptr[rbp+ 88h]
+
+Threshold	equ		qword ptr[rbp+ 90h]
+Suppress	equ		qword ptr[rbp+ 98h]
+SPR			equ		qword ptr[rbp+ 0a0h]
+ShiftCnt	equ		qword ptr[rbp+ 0a8h]
+
+iPitch2	equ		qword ptr[rbp+ 0b0h]
+fSPR2		equ		qword ptr[rbp+ 0b8h]
+sSPR2		equ		qword ptr[rbp+ 0c0h]
+
+ix			equ		rcx
+iy			equ		rdx
+
+rrImgAddr	equ		rsi
+rrNDefect	equ		rdi
+
+
+rrPeakFlag		equ		r8
+rrBuffWidth	equ		r9
+rrdx		equ		r10
+rrdy		equ		r11
+rrdt		equ		r12
+rrdp		equ		r13
+
+
+rrConAddr	equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxPlus2	equ		xmm8
+xxMinus2	equ		xmm9
+
+xxSrc		equ		xmm4
+xxCmp		equ		xmm5
+xxMinus	equ		xmm6
+xxPlus		equ		xmm7
+
+xxPeak		equ		xmm2
+xxPeak2	equ		xmm3
+
+xxfSPR		equ		xmm10
+xxsSPR		equ		xmm11
+xxfSpr2	equ		xmm14
+xxsSpr2	equ		xmm15
+xxThres	equ		xmm12
+xxSupp		equ		xmm13
+
+
+
+lShiftCnt	equ		4
+
+ConvVert2 PROC
+	local	ImgAddr		: qword		; 颇扼固磐肺 逞绢柯 蔼
+	local	ImgAddrLeft	: qword
+	local	ImgConLine		: qword		; Conv Buffer 父甸锭 矫累 林家
+	local	F_Y2Insp		: qword
+	local	ShftSize		: qword
+	local	maxDefect		: qword
+	local	ConPitch		: qword	; 8*iPitch
+	local	ConPitch2		: qword
+	local	ConvSize		: qword
+	local	ConAddr		: qword
+	local	ConOrigin		: qword
+	local	InspTop1		: qword
+	local	InspTop2		: qword
+	
+
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 070h
+
+
+	mov		ConvSize, 4
+	mov		rax, ShiftCnt
+	mov		ShftSize, 4
+
+; 颇扼固磐肺 逞绢柯 register蔼 颗扁扁
+	mov		ImgAddr		, rcx
+	mov		ConOrigin		, rdx
+	mov		maxDefect	, r8
+	mov		rrNDefect	, r9
+;	sub		maxDefect, 16
+
+
+; mmx 蔼 父甸扁
+	mov			rax, Suppress
+	mul			SPR
+	mul			ConvSize
+	movd		xxSupp, rax		; supress
+	movdqa		xmm0, xxSupp
+	punpcklwd	xmm0, xxSupp
+	pshufd		xxSupp, xmm0, 0
+	
+	
+	mov			rax, Threshold
+	movd		xxThres, rax		; Threshold
+	movdqa		xmm0, xxThres
+	punpcklwd	xmm0, xxThres
+	pshufd		xxThres, xmm0, 0
+
+	movd		xxfSPR, fSpr		; fSpr
+	movdqa		xmm0, xxfSPR
+	punpcklwd	xmm0, xxfSPR
+	pshufd		xxfSPR, xmm0, 0
+
+	movd		xxsSPR, sSpr		; sSpr
+	movdqa		xmm0, xxsSPR
+	punpcklwd	xmm0, xxsSPR
+	pshufd		xxsSPR, xmm0, 0
+
+
+	movd		xxfSPR2, fSpr2		; fSpr
+	movdqa		xmm0, xxfSPR2
+	punpcklwd	xmm0, xxfSPR2
+	pshufd		xxfSPR2, xmm0, 0
+
+	movd		xxsSPR2, sSpr2		; sSpr
+	movdqa		xmm0, xxsSPR2
+	punpcklwd	xmm0, xxsSPR2
+	pshufd		xxsSPR2, xmm0, 0
+
+
+; register 且寸.
+	mov		ix, InspLeft
+	mov		iy, InspTop
+
+	mov		rrdx, DefectX
+	mov		rrdy, DefectY
+	mov		rrdt, DefectType
+	mov		rrdp, DefectVal
+	mov		rrBuffWidth, BuffWidth
+
+
+
+
+; 八荤 康开 汲沥(width甫 pitch父怒 肋扼具 厚背茄促)
+; 林家蔼 汲沥
+
+	mov		rax, rrBuffWidth
+	mul		InspTop
+	add		rax, ImgAddr
+	add		rax, ix
+	mov		ImgAddrLeft, rax
+	
+	mov		rax, 20h
+	mul		InspTop
+	add		rax, ConOrigin
+	mov		ConAddr, rax
+
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax		; 角力 八荤 康开 场瘤痢 函版(8 byte align)
+
+	mov		rax, 20h
+	mul		iPitch
+	mov		ConPitch, rax
+	
+	mov		rax, 20h
+	mul		iPitch2
+	mov		ConPitch2, rax
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	add		rax, 2
+	mov		InspTop1, rax
+	
+	mov		rax, InspBottom
+	sub		rax, iPitch
+	sub		rax, 2
+	mov		InspTop2, rax
+
+
+	pxor	xmm0, xmm0	
+	mov		iy, InspTop
+	sub		ImgAddrLeft, 10h
+
+
+LOOP_X:
+	cmp		ix, InspRight
+	jge		LOOP_X_END
+	
+	add		ImgAddrLeft, 10h
+	mov		rrImgAddr, ImgAddrLeft
+	mov		rrConAddr, ConAddr
+	
+	mov		iy, InspTop
+
+; 烙矫 Conbuff
+;	mov		rrImgAddr, ImgAddr
+;	add		rrImgAddr, ix
+;	mov		rrConAddr, ConOrigin
+;	mov		iy, 0
+; 烙矫 Conbuff
+
+; Con 滚欺 父甸扁
+LOOP_Y_CON_BUFF:
+	movdqu		xxSrc, [rrImgAddr]
+	movdqa		xxCmp, xxSrc
+	punpcklbw	xxSrc, xmm0
+	punpckhbw	xxCmp, xmm0
+
+	movdqu		xxPlus, [rrImgAddr+ 1]
+	movdqa		xxMinus, xxPlus
+	punpcklbw	xxPlus, xmm0
+	punpckhbw	xxMinus, xmm0
+
+	paddw		xxSrc, xxPlus
+	paddw		xxCmp, xxMinus
+	movdqu		[rrConAddr], xxSrc
+	movdqu		[rrConAddr+ 10h], xxCmp
+	
+	add		rrImgAddr, rrBuffWidth
+	add		rrConAddr, 20h
+
+	inc		iy
+	cmp		iy, InspBottom
+	jle		LOOP_Y_CON_BUFF
+
+
+	mov		rrConAddr, ConAddr
+	mov		iy, InspTop
+	mov		F_Y2Insp, 0
+
+LOOP_Y:
+	cmp		iy, InspBottom
+	jge		LOOP_Y_END
+
+	cmp		rrNDefect, maxDefect
+	jge		End_Buffer
+
+
+; 家胶 滚欺
+	movdqu	xxSrc, [rrConAddr]
+	movdqu	xxTemp, [rrConAddr+ 20h]
+	paddw	xxSrc, xxTemp
+	psllw	xxSrc, lShiftCnt
+
+	movdqa		xxTemp, xxSrc				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxSrc, xxTemp
+
+
+	cmp		iy, InspTop2
+	jg		CaseCmpTop3
+
+; 厚背 滚欺 钦 父甸扁
+	mov		rax, rrConAddr
+	add		rax, ConPitch
+
+	movdqu	xxCmp, [rax]
+	pmullw	xxCmp, xxfSPR
+
+	movdqu	xxTemp, [rax+ 20h]
+	psllw	xxTemp, lShiftCnt
+	paddw	xxCmp, xxTemp
+	
+	movdqu	xxTemp, [rax+ 40h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+	jmp		CaseCmpEnd
+
+CaseCmpTop3:
+	mov		rax, rrConAddr
+	sub		rax, ConPitch
+	
+	movdqu	xxCmp, [rax+ 20h]
+	pmullw	xxCmp, xxfSPR
+	
+	movdqu	xxTemp, [rax]
+	psllw	xxTemp, lShiftCnt
+	paddw	xxCmp, xxTemp
+	
+	movdqu	xxTemp, [rax- 20h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+
+CaseCmpEnd:
+	movdqa		xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxCmp, xxTemp
+
+
+	movdqa	xxMinus	, xxCmp
+	psubusw	xxMinus	, xxSrc
+	movdqa	xxPlus	, xxSrc
+	psubusw	xxPlus	, xxCmp
+
+Inspect_Black:
+	movdqa		xxPeak, xxMinus
+	pcmpgtw	xxPeak, xxThres
+	pmovmskb	rax, xxPeak
+
+Inspect_White:
+	movdqa		xxPeak2, xxPlus
+	pcmpgtw	xxPeak2, xxThres
+	pmovmskb	rbx, xxPeak2
+	add		rax, rbx
+	cmp		rax, 0
+	je		Defect_None
+
+	cmp		iy, InspTop2
+	jg		CaseCmp2Top3
+
+	cmp		iy, InspTop1
+	jg		CaseCmp2Top2
+	
+; 搬窃 八刘
+
+CaseCmp2Top1:
+	mov		rax, rrConAddr
+	add		rax, ConPitch2
+
+	movdqu	xxCmp, [rax]
+	pmullw	xxCmp, xxfSPR2
+
+	movdqu	xxTemp, [rax+ 20h]
+	psllw	xxTemp, lShiftCnt
+	paddw	xxCmp, xxTemp
+
+	movdqu	xxTemp, [rax+ 40h]
+	pmullw	xxTemp, xxsSPR2
+	paddw	xxCmp, xxTemp
+
+	jmp		Inspect_Black2
+
+CaseCmp2Top2:
+	mov		rax, rrConAddr
+	sub		rax, ConPitch
+
+	movdqu	xxCmp, [rax+ 20h]
+	pmullw	xxCmp, xxfSPR
+
+	movdqu	xxTemp, [rax]
+	psllw	xxTemp, lShiftCnt
+	paddw	xxCmp, xxTemp
+
+	movdqu	xxTemp, [rax- 20h]
+	pmullw	xxTemp, xxsSPR
+	paddw	xxCmp, xxTemp
+
+	
+	jmp		Inspect_Black2
+
+CaseCmp2Top3:
+	mov		rax, rrConAddr
+	sub		rax, ConPitch2
+
+	movdqu	xxCmp, [rax+ 20]
+	pmullw	xxCmp, xxfSPR2
+
+	movdqu	xxTemp, [rax]
+	psllw	xxTemp, lShiftCnt
+	paddw	xxCmp, xxTemp
+
+	movdqu	xxTemp, [rax- 20h]
+	pmullw	xxTemp, xxsSPR2
+	paddw	xxCmp, xxTemp
+
+
+
+Inspect_Black2:
+	movdqa		xxTemp, xxCmp				; suppress (2*2*SPR 秦霖 suppress)
+	psubusw	xxTemp, xxSupp
+	psubusw	xxCmp, xxTemp
+
+	movdqa		xxMinus2	, xxCmp
+	psubusw	xxMinus2	, xxSrc
+	movdqa		xxPlus2	, xxSrc
+	psubusw	xxPlus2	, xxCmp
+
+	mov			bx, 0
+	movdqa		xxTemp, xxMinus2
+	pcmpgtw	xxTemp, xxThres
+	pand		xxPeak, xxTemp
+	movdqa		xxTemp, xxMinus
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	jne		DEFECT_00
+
+Inspect_White2:
+	mov			bx, 1
+	movdqa		xxPeak, xxPlus2
+	pcmpgtw	xxPeak, xxThres
+	pand		xxPeak, xxPeak2
+	movdqa		xxTemp, xxPlus
+	pmovmskb	rax, xxPeak
+	cmp		rax, 0
+	je		Defect_None
+
+ 
+
+DEFECT_00:
+	pextrw	rax, xxPeak, 0
+	cmp		rax, 0h
+	je		Defect_01
+	
+	pextrw	rax, xxTemp, 0
+	sar		rax, 6
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	mov		[rrdp+ 2*rrNDefect], ax
+	inc		rrNDefect
+
+DEFECT_01:
+	inc		ix
+	pextrw	rax, xxPeak, 1
+	cmp		rax, 0h
+	je		Defect_02
+
+	pextrw	rax, xxTemp, 1
+	sar		rax, 6
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	mov		[rrdp+ 2*rrNDefect], ax
+	inc		rrNDefect
+
+DEFECT_02:
+	inc		ix
+	pextrw	rax, xxPeak, 2
+	cmp		rax, 0h
+	je		Defect_03
+	
+	pextrw	rax, xxTemp, 2
+	sar		rax, 6
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	mov		[rrdp+ 2*rrNDefect], ax
+	inc		rrNDefect
+
+DEFECT_03:
+	inc		ix
+	pextrw	rax, xxPeak, 3
+	cmp		rax, 0h
+	je		Defect_04
+	
+	pextrw	rax, xxTemp, 3
+	sar		rax, 6
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	mov		[rrdp+ 2*rrNDefect], ax
+	inc		rrNDefect
+
+DEFECT_04:
+	inc		ix
+	pextrw	rax, xxPeak, 4
+	cmp		rax, 0h
+	je		Defect_05
+	
+	pextrw	rax, xxTemp, 4
+	sar		rax, 6
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	mov		[rrdp+ 2*rrNDefect], ax
+	inc		rrNDefect
+
+DEFECT_05:
+	inc		ix
+	pextrw	rax, xxPeak, 5
+	cmp		rax, 0h
+	je		Defect_06
+	
+	pextrw	rax, xxTemp, 5
+	sar		rax, 6
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	mov		[rrdp+ 2*rrNDefect], ax
+	inc		rrNDefect
+
+DEFECT_06:
+	inc		ix
+	pextrw	rax, xxPeak, 6
+	cmp		rax, 0h
+	je		Defect_07
+	
+	pextrw	rax, xxTemp, 6
+	sar		rax, 6
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	mov		[rrdp+ 2*rrNDefect], ax
+	inc		rrNDefect
+
+DEFECT_07:
+	inc		ix
+	pextrw	rax, xxPeak, 7
+	cmp		rax, 0h
+	je		Defect_End
+	
+	pextrw	rax, xxTemp, 7
+	sar		rax, 6
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	mov		[rrdp+ 2*rrNDefect], ax
+	inc		rrNDefect
+
+Defect_End:
+	sub		ix, 7
+	cmp		bx, 0
+	je		Inspect_White2
+
+Defect_None:
+	mov		[rrdx+ 4*rrNDefect], ecx
+	mov		[rrdy+ 4*rrNDefect], edx
+	mov		[rrdt+ 2*rrNDefect], bx
+	
+	inc		iy	
+	add		rrConAddr, 20h
+	jmp		LOOP_Y
+
+LOOP_Y_END:
+	cmp		F_Y2Insp, 1
+	je		LOOP_Y_END2
+
+	add		ix, 8
+	mov		rrConAddr, ConAddr
+	add		rrConAddr, 10h
+	mov		iy, InspTop
+	mov		F_Y2Insp, 1
+
+	jmp		LOOP_Y
+
+LOOP_Y_END2:
+
+	add		ix, 8h
+	jmp		LOOP_X
+LOOP_X_END:
+
+
+
+
+END_BUFFER:
+
+	mov		rax, rrNDefect					; return rrNDefect
+	
+	pop	rbx
+	pop	rsi
+	pop	rdi
+	pop	r15
+	pop	r14
+	pop	r13
+	pop	r12
+	pop	r11
+	pop	r10
+	pop		rbp
+
+RET
+ConvVert2 ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvZgSpVtSkB1.asm b/Common_Class/SISAssem/ConvZgSpVtSkB1.asm
new file mode 100644
index 0000000..e06e356
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZgSpVtSkB1.asm
@@ -0,0 +1,1220 @@
+; 2016.07.19
+; ConvZg; Zg=ZoneGamma
+; ConvZgSp ; Sp = SpeedUp
+; ConvZgSpVt : Vt = Vertical
+; ConvZgSpVtSk : Sk = Skip Block = 厚八荤 Block 粮犁 器窃
+; ConvZgSpVtSkB2 : B2 = 2 by 2.
+; Vertical Convolution Buffer 狼 档涝栏肺 葛碘 胶乔靛 35% 啊加
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		12		; x, y, bSkip 阿 4byte
+
+
+.code
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+xxDSlide	equ		xmm14	; 扁匡扁
+xxEcho		equ		xmm13	; Echo Filtering
+xxEcho2		equ		xmm15	; Echo Filtering
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+ConAddr			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+UnpairAddTh		equ		qword ptr[rbp+ 130h]
+ThSuppress		equ		qword ptr[rbp+ 138h]
+EchoThreshold	equ		qword ptr[rbp+ 140h]
+
+; 肺拿 函荐
+
+
+; Function Start ----------------------------------ConvZgSpVtSkB1--------
+ConvZgSpVtSkB1 PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	dxPtrnS			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	ConBottom		: qword
+	local	EchoTh[2]		: qword
+	
+	local	EchoFlg[2]		: qword
+	local	EchoAddr		: qword
+	local	c8Pixel			: dword	
+	local	xMatch			: dword
+	
+	local	yMatch			: dword	
+	local	xMatch2			: dword
+	
+	local	yMatch2			: dword
+	local	bSkipBlock		: dword
+	local	bSkipBlock1		; dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	ADD		rbp, 0a8h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+	
+;	mov			EchoThreshold, 8
+;	mov			rax, EchoThreshold
+	mov			rax, 8
+	movd		xxsSpr, eax
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxTemp, xxsSpr, 0
+	lea			rax, EchoTh
+	movdqu		[rax], xxTemp
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+	mov		rcx, dxPtrn
+	sub		rcx, 16
+	mov		dxPtrnS, rcx
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd	rbx, dword ptr[rcx]
+	movsxd	rbx, dword ptr[rcx+8]
+	mov		bSkipBlock, ebx
+	mov		bSkipBlock1, ebx
+	
+	
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	mov		ebx, dword ptr[rcx+20]		; 20 = 8 + 12, 促澜 概莫捞 八荤 胶诺捞搁 exPtrn阑 临烙
+	cmp		ebx, 1
+	jne		PASS_NEXT_BLOCK_SKIP_1
+	movsxd	rbx, xMatch
+	add		rbx, dxPtrnS
+	mov		exPtrn, rbx
+PASS_NEXT_BLOCK_SKIP_1:
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	mov		eax, bSkipBlock1
+	mov		bSkipBlock, eax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+	
+MAKE_CONBUFF:
+	mov			EchoAddr, rrImgAddr
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	
+	add			rrImgAddr, rcx
+	add			rax, 20h
+	
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		ebx, dword ptr[rcx]			; 皋葛府 Hitting 困茄 窜鉴 龋免
+	mov		ebx, dword ptr[rcx+8]
+	mov		bSkipBlock, ebx
+	mov		bSkipBlock1, ebx
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+
+	mov		ebx, dword ptr[rcx+20]		; 20 = 8 + 12, 促澜 概莫捞 八荤 胶诺捞搁 exPtrn阑 临烙
+	cmp		ebx, 1
+	jne		PASS_NEXT_BLOCK_SKIP_2
+	movsxd	rbx, xMatch
+	add		rbx, dxPtrnS
+	mov		exPtrn, rbx
+PASS_NEXT_BLOCK_SKIP_2:
+
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:						; iy > eyMatch 老 版快
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	mov		ebx, dword ptr[rcx+8]
+	mov		bSkipBlock, ebx
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+	movdqu	xxTemp, [rax+ 20h]
+	movdqu	xxDSlide, [rax+ 30h]
+
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	pmullw		xxDSlide, xxsSpr	
+	paddw		xxCmp2, xxDSlide
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	cmp		bSkipBlock, 0			; 胶诺 且瘤 厚背
+	jne		_XMM_COMPARE_SKIP_BLOCK		; 胶诺 救窍瘤 臼栏搁 (=胶诺 茄促搁 - 八荤 风凭父 厚哺啊扁)
+
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+_XMM_COMPARE_SKIP_BLOCK:
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, UnpairAddTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		PAIR_CENTER_UNPAIR
+	;jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_CENTER_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, UnpairAddTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 2
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, UnpairAddTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+
+RET
+ConvZgSpVtSkB1 ENDP
+; Function End	----------------------------------ConvZoneVert2--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZgSpVtSkB2.asm b/Common_Class/SISAssem/ConvZgSpVtSkB2.asm
new file mode 100644
index 0000000..312d319
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZgSpVtSkB2.asm
@@ -0,0 +1,1230 @@
+; 2016.07.19
+; ConvZg; Zg=ZoneGamma
+; ConvZgSp ; Sp = SpeedUp
+; ConvZgSpVt : Vt = Vertical
+; ConvZgSpVtSk : Sk = Skip Block = 厚八荤 Block 粮犁 器窃
+; ConvZgSpVtSkB2 : B2 = 2 by 2.
+; Vertical Convolution Buffer 狼 档涝栏肺 葛碘 胶乔靛 35% 啊加
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		12		; x, y, bSkip 阿 4byte
+
+
+.code
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+xxDSlide	equ		xmm14	; 扁匡扁
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+ConAddr			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ExTh			equ		qword ptr[rbp+ 130h]
+ThSuppress		equ		qword ptr[rbp+ 138h]
+
+; 肺拿 函荐
+
+
+; Function Start ----------------------------------ConvZgSpVtSkB2--------
+ConvZgSpVtSkB2 PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	dxPtrnS			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	ConBottom		: qword
+	local	c8Pixel			: dword	
+	local	xMatch			: dword
+	local	yMatch			: dword	
+	local	xMatch2			: dword
+	
+	local	yMatch2			: dword
+	local	bSkipBlock		: dword
+	local	bSkipBlock1		; dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0a8h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	mov		bSkipBlock, 1
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+	mov		rcx, dxPtrn
+	sub		rcx, 16
+	mov		dxPtrnS, rcx
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd	rbx, dword ptr[rcx]
+	movsxd	rbx, dword ptr[rcx+8]
+	mov		bSkipBlock, ebx
+	mov		bSkipBlock1, ebx
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	mov		ebx, dword ptr[rcx+20]		; 20 = 8 + 12, 促澜 概莫捞 八荤 胶诺捞搁 exPtrn阑 临烙
+	cmp		ebx, 1
+	jne		PASS_NEXT_BLOCK_SKIP_1
+	movsxd	rbx, xMatch
+	add		rbx, dxPtrnS
+	mov		exPtrn, rbx
+PASS_NEXT_BLOCK_SKIP_1:
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	mov		eax, bSkipBlock1
+	mov		bSkipBlock, eax
+
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+	
+	
+MAKE_CONBUFF:	; Make Conv Buff for 2by2
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+	movdqu		xxCmp1, [rrImgAddr+ 1]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0	
+	paddw		xxSrc1, xxCmp1
+	paddw		xxSrc2, xxCmp2
+
+	movdqu		xxCmp1, [rrImgAddr+ rcx]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0	
+	paddw		xxSrc1, xxCmp1
+	paddw		xxSrc2, xxCmp2
+
+	movdqu		xxCmp1, [rrImgAddr+ rcx+ 1]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	paddw		xxSrc1, xxCmp1
+	paddw		xxSrc2, xxCmp2
+
+	psraw		xxSrc1, 2
+	psraw		xxSrc2, 2
+
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	
+	add			rrImgAddr, rcx
+	add			rax, 20h
+	
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+CHECK_1_BOUND:						; ix > exMatch 老 版快
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		ebx, dword ptr[rcx]			; 皋葛府 Hitting 困茄 窜鉴 龋免
+	mov		ebx, dword ptr[rcx+8]
+	mov		bSkipBlock, ebx
+	mov		bSkipBlock1, ebx
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+	mov		ebx, dword ptr[rcx+20]		; 20 = 8 + 12, 促澜 概莫捞 八荤 胶诺捞搁 exPtrn阑 临烙
+	cmp		ebx, 1
+	jne		PASS_NEXT_BLOCK_SKIP_2
+	movsxd	rbx, xMatch
+	add		rbx, dxPtrnS
+	mov		exPtrn, rbx
+PASS_NEXT_BLOCK_SKIP_2:
+
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:						; iy > eyMatch 老 版快
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	mov		ebx, dword ptr[rcx+8]
+	mov		bSkipBlock, ebx
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+	movdqu	xxTemp, [rax+ 20h]
+	movdqu	xxDSlide, [rax+ 30h]
+
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	pmullw		xxDSlide, xxsSpr	
+	paddw		xxCmp2, xxDSlide
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+_return_XMM_COMPARE_8PIXEL:
+
+	cmp		rrNoD, maxDefect				; BED Check
+	jge		PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	cmp		bSkipBlock, 0				; 胶诺 且瘤 厚背
+	jne		_XMM_COMPARE_SKIP_BLOCK		; 胶诺 救窍瘤 臼栏搁 (=胶诺 茄促搁 - 八荤 风凭父 厚哺啊扁)
+
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+_XMM_COMPARE_SKIP_BLOCK:
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+
+;	psraw xxPeakAbs, 2
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+	
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		PAIR_CENTER_UNPAIR
+	;jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_CENTER_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 2
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+
+RET
+ConvZgSpVtSkB2 ENDP
+; Function End	----------------------------------ConvZoneVert2--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZone.asm b/Common_Class/SISAssem/ConvZone.asm
new file mode 100644
index 0000000..8c33dcd
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZone.asm
@@ -0,0 +1,1067 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+	
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSrc3		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+xxSupp		equ		xmm12
+
+xxDStart	equ		xmm13	; 檬扁摹
+xxDSlope	equ		xmm14	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+; 肺拿 函荐
+
+
+ConvZone PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword 
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword
+	
+	local	exPtrn			: qword
+	local	exPtrn1			: qword
+	local	eyPtrn			: qword	
+	local	pairLeft		: qword
+	
+	local	pairRight		: qword
+	local	iPitchHUp		: qword
+
+	local	c8Pixel		: dword
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	
+	local	yMatch2		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 090h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+
+	
+	
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+	
+	sub		rax, iPitch
+	mov		pairRight, rax
+
+	mov		rax, InspLeft
+	add		rax, iPitch
+	mov		pairLeft, rax
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+;	mov		rrZIdD, ZoneID
+;	mov		rrZThD, ZoneTh
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		exPtrn1, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING
+	_return_PAIRING:
+
+	inc		iy
+	mov		rax, exPtrn1
+	mov		exPtrn, rax
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	mov		rax, ZoneThAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneThAddr1, rax
+	mov		ZoneThAddr, rax
+	mov		rax, ZoneIdAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneIdAddr1, rax
+	mov		ZoneIdAddr, rax
+
+LOOP_1_CHECK:
+	cmp		iy, InspBottom
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		ix, InspLeft
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+	cmp		iy, eyPtrn
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+
+LOOP_2_TAIL:
+	add		rrImgAddr, 010h
+LOOP_2_CHECK:
+	cmp		ix, InspRight
+	jge		LOOP_1_TAIL
+	
+	cmp		ix, exPtrn
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, szyMatch
+	add		pMatch1, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jle		EXCESS_1_BOUND
+	mov		rdx, rax
+EXCESS_1_BOUND:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, pMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch2, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dxPtrn
+	cmp		rax, InspRight
+	jl		EXCESS_2_BOUND
+	mov		rdx, rax
+EXCESS_2_BOUND:
+	mov		exPtrn, rdx						; eyPtrn	mov		rdx, ix
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch2, ebx
+	mov		rax, iy
+	sub		rax, rbx
+	mov		rbx, rdx
+	mul		ZoneTableW							; y*width
+
+
+	add		rax, rbx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+;	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+;	mov		ZoneIdAddr1, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, iPitch				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp4, xxCmp1
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+
+	movdqu	xxCmp3, [rax+ 1]
+
+	movdqu	xxTemp, xxCmp3	
+	punpcklbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr
+	paddw	xxCmp1, xxTemp
+
+	movdqu	xxTemp, xxCmp3	
+	punpckhbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr	
+	paddw	xxCmp2, xxTemp
+	
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			END_FUNC
+
+	inc		ix
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		_return_XMM_COMPARE				; BE_RD CHECK
+	
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxZTh, [rax]
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			_XMM_COMPARE_VERIFY
+
+	add			ix, 7
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+_XMM_COMPARE_VERIFY:
+	cmp		bRFilter, 1
+	jne		DEFECT_00
+; 荐沥秦具 等促.. xxSrc3阑 肺爹秦具茄促.
+	movdqu		xxSrc3, [rrImgAddr- 1]
+	movdqa		xxSrc4, xxSrc3
+	punpcklbw	xxSrc3, xmm0
+	punpckhbw	xxSrc4, xmm0
+
+	cmp		c8Pixel, 1
+	jge		COMPARE_VERIFY_LOAD_SECOND
+	movdqa		xxCmp3, xxCmp4
+	punpcklbw	xxCmp3, xmm0
+	jmp		COMPARE_VERIFY_LOAD_END
+	
+	COMPARE_VERIFY_LOAD_SECOND:
+	movdqa		xxSrc3, xxSrc4
+	movdqa		xxCmp3, xxCmp4
+	punpckhbw	xxCmp3, xmm0
+	
+	COMPARE_VERIFY_LOAD_END:	
+	pmullw		xxSrc3, xxsSpr
+	movdqa		xxZId, xxfSpr
+	pmullw		xxZId, xxSrc1
+	paddw		xxSrc3, xxZId
+	psrlw		xxSrc3, SprShift
+	
+	psubsw		xxSrc3, xxCmp3
+	pabsw		xxSrc3, xxSrc3
+	pcmpgtw	xxSrc3, xxZTh
+	pand		xxTemp, xxSrc3
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0
+	jne			DEFECT_00
+	add			ix, 7
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			_return_XMM_COMPARE_8PIXEL
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		_return_XMM_COMPARE_8PIXEL
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+PAIRING:
+;_return		_return_PAIRING
+	mov		ix, -1
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+	mov		rbx, ix
+	movsxd	rdx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		rcx, rdx
+	add		rcx, iPitchHUp
+	
+	cmp		rdx, pairLeft
+	jl		PAIR_LEFT
+	
+	cmp		rdx, pairRight
+	jle		PAIR_CENTER
+
+PAIR_RIGHT:
+	mov		word ptr[rrToD+ 2*ix], 4
+	mov		rax, PairAddr
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYod+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		cx, word ptr [rrToD+ 2*ix]
+	cmp		cx, 0
+	je		TYPE_1
+	mov		(astPair ptr [rax]).dtype, 0
+	jmp		TYPE_END
+TYPE_1:
+	mov		(astPair ptr [rax]).dtype, 1
+TYPE_END:
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+	
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_LEFT
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_LEFT
+	
+	mov		word ptr[rrToD+ 2*rbx], 4
+	
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT_UNPAIR:
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		ecx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	movsx	edx, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_CENTER
+	jg		PAIR_CENTER_UNPAIR
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_CENTER
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_CENTER
+
+	mov		word ptr[rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, dword ptr[rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, dword ptr[rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER_UNPAIR:
+
+	jmp		LOOP_PAIR_NUM
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	_return		_return_PAIRING
+
+
+
+
+
+END_FUNC:
+
+	;mov		rax, rrNoD					; return rrNoD
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+	
+RET
+ConvZone ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvZone2.asm b/Common_Class/SISAssem/ConvZone2.asm
new file mode 100644
index 0000000..c133f92
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZone2.asm
@@ -0,0 +1,1081 @@
+
+; ConvZone2
+; 2011.05.20
+; ConvZone俊 Zone喊 Dynamic Threshold 眠啊 累诀吝. ZoneDTH
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch	equ		8
+;szyMatch	equ		1600
+
+
+.code
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+bUseUnpair		equ		qword ptr[rbp+ 118h]
+endLine			equ		qword ptr[rbp+ 120h]
+ThSuppress		equ		qword ptr[rbp+ 128h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+xxDStart	equ		xmm13	; 檬扁摹
+xxDSlide	equ		xmm14	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+; 肺拿 函荐
+
+
+ConvZone2 PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	exPtrn1			: qword
+	
+	local	eyPtrn			: qword	
+	local	pairLeft		: qword	
+	local	pairRight		: qword
+	local	iPitchHUp		: qword
+
+	local	c8Pixel			: dword
+	local	xMatch			: dword
+	local	yMatch			: dword
+	local	xMatch2			: dword
+	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	ADD		rbp, 0a0h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+	
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+	
+	sub		rax, iPitch
+	mov		pairRight, rax
+
+	mov		rax, InspLeft
+	add		rax, iPitch
+	mov		pairLeft, rax
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+;	mov		rrZIdD, ZoneID
+;	mov		rrZThD, ZoneTh
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		exPtrn1, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING
+	_return_PAIRING:
+
+	inc		iy
+	mov		rax, exPtrn1
+	mov		exPtrn, rax
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	mov		rax, ZoneThAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneThAddr1, rax
+	mov		ZoneThAddr, rax
+	mov		rax, ZoneIdAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneIdAddr1, rax
+	mov		ZoneIdAddr, rax
+	mov		rax, ZoneAddAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneAddAddr1, rax
+	mov		ZoneAddAddr, rax
+
+LOOP_1_CHECK:
+	cmp		iy, InspBottom
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		ix, InspLeft
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+	cmp		iy, eyPtrn
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+
+LOOP_2_TAIL:
+	add		rrImgAddr, 010h
+LOOP_2_CHECK:
+	cmp		ix, InspRight
+	jge		LOOP_1_TAIL
+
+	cmp		ix, exPtrn
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, szyMatch
+	add		pMatch1, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jle		EXCESS_1_BOUND
+	mov		rdx, rax
+EXCESS_1_BOUND:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, pMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch2, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dxPtrn
+	cmp		rax, InspRight
+	jl		EXCESS_2_BOUND
+	mov		rdx, rax
+EXCESS_2_BOUND:
+	mov		exPtrn, rdx						; eyPtrn	mov		rdx, ix
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch2, ebx
+	mov		rax, iy
+	sub		rax, rbx
+	mov		rbx, rdx
+	mul		ZoneTableW							; y*width
+
+
+	add		rax, rbx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+;	PMOVZXBW	xxSrc1,[rax]
+;	PMOVZXBW	xxSrc2,[rax+ 8]
+
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, iPitch				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+
+	movdqu		xxDMin, [rax+ 1]
+	movdqa		xxTemp, xxDMin	
+	punpcklbw	xxTemp, xmm0
+
+;	PMOVZXBW	xxTemp,[rax+ 1] 
+	
+	
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	movdqa		xxTemp, xxDMin	
+	punpckhbw	xxTemp, xmm0
+;	PMOVZXBW	xxTemp,[rax+ 9]
+
+	pmullw		xxTemp, xxsSpr	
+	paddw		xxCmp2, xxTemp
+	
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING
+
+	inc		ix
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		_return_XMM_COMPARE				; BE_RD CHECK
+	
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	mov			rbx, ZoneAddAddr
+	movdqu		xxTemp, [rax]
+	movdqu		xxDSlide, [rbx]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+	
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+	
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 7
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			_return_XMM_COMPARE_8PIXEL
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		_return_XMM_COMPARE_8PIXEL
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+PAIRING:
+;_return		_return_PAIRING
+	mov		ix, -1
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+	mov		rbx, ix
+	movsxd	rdx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		rcx, rdx
+	add		rcx, iPitchHUp
+	
+	cmp		rdx, pairLeft
+	jl		PAIR_LEFT
+	
+	cmp		rdx, pairRight
+	jle		PAIR_CENTER
+
+PAIR_RIGHT:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYod+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	movsx	ecx, word ptr [rrToD+ 2*ix]
+	
+	inc		ecx
+	and		ecx, 1
+	mov		(astPair ptr [rax]).dtype, ecx
+
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+	
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_LEFT
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_LEFT
+	
+	mov		word ptr[rrToD+ 2*rbx], 4
+	
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		ecx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	movsx	edx, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_CENTER
+	jg		PAIR_CENTER_UNPAIR
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_CENTER
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_CENTER
+
+	mov		word ptr[rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, dword ptr[rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, dword ptr[rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER_UNPAIR:
+
+	jmp		LOOP_PAIR_NUM
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	_return		_return_PAIRING
+
+
+
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+	
+RET
+ConvZone2 ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneDPC.asm b/Common_Class/SISAssem/ConvZoneDPC.asm
new file mode 100644
index 0000000..af07eba
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneDPC.asm
@@ -0,0 +1,1093 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		8
+
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+piPitch			equ		qword ptr[rbp+ 98h]
+pfSPR			equ		qword ptr[rbp+ 0a0h]
+psSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+bRFilter		equ		qword ptr[rbp+ 100h]
+iPitch			equ		qword ptr[rbp+ 108h]
+
+szyMatch		equ		qword ptr[rbp+ 110h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSrc3		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+xxSupp		equ		xmm12
+
+xxDStart	equ		xmm13	; 檬扁摹
+xxDSlope	equ		xmm14	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+
+; 肺拿 函荐
+
+
+ConvZoneDPC PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	local	ZoneThAddr1		: qword	; First Loop 矫累矫 搬沥, 促澜 风橇饶 盔汗浚 Plus
+	local	ZoneIdAddr1		: qword	; First Loop 矫累矫 搬沥, 促澜 风橇饶 盔汗浚 Plus
+	local	ZoneTableW2		: qword	; 2Byte甫 绊妨茄 Width of Byte
+	local	pMatch1			: qword
+	
+	local	exPtrn			: qword
+	local	exPtrn1			: qword
+	local	eyPtrn			: qword	
+	local	pairLeft		: qword
+	
+	local	pairRight		: qword
+	local	iPitchHUp		: qword
+	local	iPitchDpc		: qword
+
+	local	c8Pixel		: dword
+
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 098h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+	
+	sub		rax, iPitch
+	mov		pairRight, rax
+
+	mov		rax, InspLeft
+	add		rax, iPitch
+	mov		pairLeft, rax
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+;	mov		rrZIdD, ZoneID
+;	mov		rrZThD, ZoneTh
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		exPtrn1, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING
+	_return_PAIRING:
+
+	inc		iy
+	mov		rax, exPtrn1
+	mov		exPtrn, rax
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	mov		rax, ZoneThAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneThAddr1, rax
+	mov		ZoneThAddr, rax
+	mov		rax, ZoneIdAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneIdAddr1, rax
+	mov		ZoneIdAddr, rax
+
+LOOP_1_CHECK:
+	cmp		iy, InspBottom
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		ix, InspLeft
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+	cmp		iy, eyPtrn
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+
+LOOP_2_TAIL:
+	add		rrImgAddr, 010h
+LOOP_2_CHECK:
+	cmp		ix, InspRight
+	jge		LOOP_1_TAIL
+	
+	cmp		ix, exPtrn
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, szyMatch
+	add		pMatch1, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jle		EXCESS_1_BOUND
+	mov		rdx, rax
+EXCESS_1_BOUND:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, pMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch2, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dxPtrn
+	cmp		rax, InspRight
+	jl		EXCESS_2_BOUND
+	mov		rdx, rax
+EXCESS_2_BOUND:
+	mov		exPtrn, rdx						; eyPtrn	mov		rdx, ix
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch2, ebx
+	mov		rax, iy
+	sub		rax, rbx
+	mov		rbx, rdx
+	mul		ZoneTableW							; y*width
+
+
+	add		rax, rbx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+;	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+;	mov		ZoneIdAddr1, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+
+DPC_MAKE:
+	mov		rax, ix
+	sar		rax, 4
+	sal		rax, 5
+;	mov		ix2, rax
+	mov		rcx, piPitch
+	add		rcx, rax
+	movsx	rdx, word ptr[rcx]
+	mov		iPitchDpc, rdx			;iPitchDpc, rdx
+
+	mov		rcx, pfSPR
+	add		rcx, rax
+	movdqu	xxfSpr, [rcx]
+	
+	mov		rcx, psSPR
+	add		rcx, rax
+	movdqu	xxsSpr, [rcx]
+
+
+_return _return_DPC_MAKE
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, iPitchDpc				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp4, xxCmp1
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+
+	movdqu	xxCmp3, [rax+ 1]
+
+	movdqu	xxTemp, xxCmp3	
+	punpcklbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr
+	paddw	xxCmp1, xxTemp
+
+	movdqu	xxTemp, xxCmp3	
+	punpckhbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr	
+	paddw	xxCmp2, xxTemp
+	
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			END_FUNC
+
+	inc		ix
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		_return_XMM_COMPARE				; BE_RD CHECK
+	
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxZTh, [rax]
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 7
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+_XMM_COMPARE_VERIFY:
+	cmp		bRFilter, 1
+	jne		DEFECT_00
+; 荐沥秦具 等促.. xxSrc3阑 肺爹秦具茄促.
+	movdqu		xxSrc3, [rrImgAddr- 1]
+	movdqa		xxSrc4, xxSrc3
+	punpcklbw	xxSrc3, xmm0
+	punpckhbw	xxSrc4, xmm0
+
+	cmp		c8Pixel, 1
+	jge		COMPARE_VERIFY_LOAD_SECOND
+	movdqa		xxCmp3, xxCmp4
+	punpcklbw	xxCmp3, xmm0
+	jmp		COMPARE_VERIFY_LOAD_END
+	
+	COMPARE_VERIFY_LOAD_SECOND:
+	movdqa		xxSrc3, xxSrc4
+	movdqa		xxCmp3, xxCmp4
+	punpckhbw	xxCmp3, xmm0
+	
+	COMPARE_VERIFY_LOAD_END:	
+	pmullw		xxSrc3, xxsSpr
+	movdqa		xxZId, xxfSpr
+	pmullw		xxZId, xxSrc1
+	paddw		xxSrc3, xxZId
+	psrlw		xxSrc3, SprShift
+	
+	psubsw		xxSrc3, xxCmp3
+	pabsw		xxSrc3, xxSrc3
+	pcmpgtw	xxSrc3, xxZTh
+	pand		xxTemp, xxSrc3
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0
+	jne			DEFECT_00
+	add			ix, 7
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			_return_XMM_COMPARE_8PIXEL
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		_return_XMM_COMPARE_8PIXEL
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+PAIRING:
+;_return		_return_PAIRING
+	mov		ix, -1
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+	mov		rbx, ix
+	movsxd	rdx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		rcx, rdx
+	add		rcx, iPitchHUp
+	
+	cmp		rdx, pairLeft
+	jl		PAIR_LEFT
+	
+	cmp		rdx, pairRight
+	jle		PAIR_CENTER
+
+PAIR_RIGHT:
+	mov		word ptr[rrToD+ 2*ix], 4
+	mov		rax, PairAddr
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYod+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		cx, word ptr [rrToD+ 2*ix]
+	cmp		cx, 0
+	je		TYPE_1
+	mov		(astPair ptr [rax]).dtype, 0
+	jmp		TYPE_END
+TYPE_1:
+	mov		(astPair ptr [rax]).dtype, 1
+TYPE_END:
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+	
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_LEFT
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_LEFT
+	
+	mov		word ptr[rrToD+ 2*rbx], 4
+	
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT_UNPAIR:
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		ecx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	movsx	edx, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_CENTER
+	jg		PAIR_CENTER_UNPAIR
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_CENTER
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_CENTER
+
+	mov		word ptr[rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, dword ptr[rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, dword ptr[rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER_UNPAIR:
+
+	jmp		LOOP_PAIR_NUM
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	_return		_return_PAIRING
+
+
+
+
+
+END_FUNC:
+
+	;mov		rax, rrNoD					; return rrNoD
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+	
+RET
+ConvZoneDPC ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneDPC2.asm b/Common_Class/SISAssem/ConvZoneDPC2.asm
new file mode 100644
index 0000000..2b15055
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneDPC2.asm
@@ -0,0 +1,1098 @@
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+	
+SprShift		equ		4
+SprMulti		equ		16
+_return		equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+piPitch			equ		qword ptr[rbp+ 98h]
+pfSPR			equ		qword ptr[rbp+ 0a0h]
+psSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+bRFilter		equ		qword ptr[rbp+ 100h]
+iPitch			equ		qword ptr[rbp+ 108h]
+
+szyMatch		equ		qword ptr[rbp+ 110h]
+ZoneAddAddrPr	equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ThSuppress		equ		qword ptr[rbp+ 130h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+xxDStart	equ		xmm13	; 檬扁摹
+xxDSlide	equ		xmm14	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+; 肺拿 函荐
+
+
+ConvZoneDPC2 PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword	; First Loop 矫累矫 搬沥, 促澜 风橇饶 盔汗浚 Plus
+	local	ZoneIdAddr1		: qword	; First Loop 矫累矫 搬沥, 促澜 风橇饶 盔汗浚 Plus
+	local	ZoneAddAddr1	: qword
+	local	ZoneTableW2		: qword	; 2Byte甫 绊妨茄 Width of Byte
+	local	pMatch1			: qword
+	
+	local	exPtrn			: qword
+	local	exPtrn1			: qword
+	local	eyPtrn			: qword	
+	local	pairLeft		: qword
+	
+	local	pairRight		: qword
+	local	iPitchHUp		: qword
+	local	iPitchDPC		: qword
+
+	local	c8Pixel		: dword
+
+	local	xMatch		: dword
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 0a8h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+	
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	mov		iPitchDPC, rax
+
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+
+
+	mov		rax, InspRight
+	sub		rax, InspLeft
+	sub		rax, iPitch
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, InspLeft
+	mov		InspRight, rax
+	
+	sub		rax, iPitch
+	mov		pairRight, rax
+
+	mov		rax, InspLeft
+	add		rax, iPitch
+	mov		pairLeft, rax
+	
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+;	mov		rrZIdD, ZoneID
+;	mov		rrZThD, ZoneTh
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		exPtrn1, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING
+	_return_PAIRING:
+
+	inc		iy
+	mov		rax, exPtrn1
+	mov		exPtrn, rax
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	mov		rax, ZoneThAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneThAddr1, rax
+	mov		ZoneThAddr, rax
+	mov		rax, ZoneIdAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneIdAddr1, rax
+	mov		ZoneIdAddr, rax
+	mov		rax, ZoneAddAddr1
+	add		rax, ZoneTablew2
+	mov		ZoneAddAddr1, rax
+	mov		ZoneAddAddr, rax
+
+LOOP_1_CHECK:
+	cmp		iy, InspBottom
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		ix, InspLeft
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+
+	cmp		iy, eyPtrn
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+
+LOOP_2_TAIL:
+	add		rrImgAddr, 010h
+LOOP_2_CHECK:
+	cmp		ix, InspRight
+	jge		LOOP_1_TAIL
+	
+	cmp		ix, exPtrn
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, szyMatch
+	add		pMatch1, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jle		EXCESS_1_BOUND
+	mov		rdx, rax
+EXCESS_1_BOUND:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		rcx, pMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	add		pMatch, szxMatch
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch2, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dxPtrn
+	cmp		rax, InspRight
+	jl		EXCESS_2_BOUND
+	mov		rdx, rax
+EXCESS_2_BOUND:
+	mov		exPtrn, rdx						; eyPtrn	mov		rdx, ix
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch2, ebx
+	mov		rax, iy
+	sub		rax, rbx
+	mov		rbx, rdx
+	mul		ZoneTableW							; y*width
+
+
+	add		rax, rbx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+
+DPC_MAKE:
+	mov		rax, ix
+	sar		rax, 4
+	sal		rax, 5
+;	mov		ix2, rax
+	mov		rcx, piPitch
+	add		rcx, rax
+	movsx	rdx, word ptr[rcx]
+	mov		iPitchDpc, rdx
+	
+	mov		rcx, pfSPR
+	add		rcx, rax
+	movdqu	xxfSpr, [rcx]
+	
+	mov		rcx, psSPR
+	add		rcx, rax
+	movdqu	xxsSpr, [rcx]
+
+
+_return _return_DPC_MAKE
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov			rax, rrImgAddr
+	add			rax, iPitchDPC				; Compare Buffer (iPitch*fSPR + iPitchNext*sSPR) - Suppress - Unpack - *SPR
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+
+	movdqu	xxDMin, [rax+ 1]
+
+	movdqu	xxTemp, xxDMin	
+	punpcklbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr
+	paddw	xxCmp1, xxTemp
+
+	movdqu	xxTemp, xxDMin	
+	punpckhbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr	
+	paddw	xxCmp2, xxTemp
+	
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING
+
+	inc		ix
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		_return_XMM_COMPARE				; BE_RD CHECK
+	
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+	
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 7
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			_return_XMM_COMPARE_8PIXEL
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		_return_XMM_COMPARE_8PIXEL
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+PAIRING:
+;_return		_return_PAIRING
+	mov		ix, -1
+LOOP_PAIR_NUM:
+	inc		ix
+	cmp		ix, rrNoD
+	jge		LOOP_PAIR_NUM_END
+
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	cmp		word ptr [rrToD+ 2*ix], 3			; chek type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+	mov		rbx, ix
+	movsxd	rdx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		rcx, rdx
+	add		rcx, iPitchHUp
+	
+	cmp		rdx, pairLeft
+	jl		PAIR_LEFT
+	
+	cmp		rdx, pairRight
+	jle		PAIR_CENTER
+
+PAIR_RIGHT:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+;	mov		word ptr[rrToD+ 2*ix], 4
+	mov		rax, PairAddr
+	mov		(astPair ptr [rax]).pos, 3
+	mov		(astPair ptr [rax]).pair, 5
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYod+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	
+	movsx	ecx, word ptr [rrToD+ 2*ix]
+	inc		ecx
+	and		ecx, 1
+	mov		(astPair ptr [rax]).dtype, ecx
+
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_LEFT_UNPAIR
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_LEFT
+	jg		PAIR_LEFT_UNPAIR
+	
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_LEFT
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_LEFT
+	
+	mov		word ptr[rrToD+ 2*rbx], 4
+	
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_LEFT_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 5
+	mov		ecx, dword ptr[rrXoD+ 4*ix]				; Filter_2_Pair_XPosition
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*ix]
+	mov		(astPair ptr [rax]).y, ecx
+	movsx	edx, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*ix]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*ix]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*ix]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*ix]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	mov		eax, dword ptr[rrXoD+ 4*rbx]
+	cmp		eax, ecx
+	jl		PAIR_CENTER
+	jg		PAIR_CENTER_UNPAIR
+
+	movzx	edx, word ptr[rrToD+ 2*rbx]			; Filter_2_TYPE_DELETE
+	cmp		dx, 3
+	jge		PAIR_CENTER
+
+	mov		ax, word ptr[rrToD+ 2*ix]			; Filter_3_TYPE_PAIR
+	cmp		ax, dx
+	je		PAIR_CENTER
+
+	mov		word ptr[rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		ecx, dword ptr[rrYoD+ 4*rbx]
+	mov		(astPair ptr [rax]).y, ecx
+	mov		(astPair ptr [rax]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, dword ptr[rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, dword ptr[rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, dword ptr[rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+PAIR_CENTER_UNPAIR:
+	mov		word ptr[rrToD+ 2*rbx], 4
+
+	jmp		LOOP_PAIR_NUM
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	_return		_return_PAIRING
+
+
+
+
+
+END_FUNC:
+
+	add		iy32, 1
+	mov		rax, endLine
+	mov		[rax], iy32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+	
+RET
+ConvZoneDPC2 ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneMVert2S.asm b/Common_Class/SISAssem/ConvZoneMVert2S.asm
new file mode 100644
index 0000000..e2f9b08
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneMVert2S.asm
@@ -0,0 +1,1245 @@
+
+; ConvZoneVert2s 狼 Multi Dynamic Threshold 滚傈 : Threshold甫 滴俺狼 流急栏肺 盒府
+; ConvZoneVert2S ; S means SpeedUp
+; ConvZoneVert2狼 SpeedUp Version.
+; Vertical Convolution Buffer 狼 档涝栏肺 葛碘 胶乔靛 35% 啊加
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		8		; x, y 阿 4byte
+
+
+.code
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxZTh2		equ		xmm12
+xxFlag		equ		xmm13
+
+xxDSlide	equ		xmm14	; 扁匡扁
+
+xxSupp		equ		xmm15	; 2锅掳 Threshold 狼 扁霖
+
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+ConAddr			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ZoneMThMinPr	equ		qword ptr[rbp+ 130h]
+ZoneMThAddrPr	equ		qword ptr[rbp+ 138h]
+ZoneMAddAddrPr	equ		qword ptr[rbp+ 140h]
+ThSuppress		equ		qword ptr[rbp+ 148h]
+
+
+; 肺拿 函荐
+
+
+; Function Start ----------------------------------ConvZoneVert2--------
+ConvZoneMVert2S PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddrLine		: qword
+	local	ZoneIdAddrLine		: qword
+	local	ZoneAddAddrLine	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	ConBottom		: qword
+	local	ZoneMThAddr		: qword
+	local	ZoneMAddAddr	: qword
+	
+	local	ZoneMThMinAddr		: qword
+	local	ZoneMThMinLine		: qword
+	local	ZoneMThAddrLine		: qword
+	local	ZoneMAddAddrLine	: qword
+	
+	local	c8Pixel			: dword	
+	local	xMatch			: dword
+	local	yMatch			: dword	
+	local	xMatch2			: dword
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0a8h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddrLine, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddrLine, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddrLine, rdx
+	mov		rdx, ZoneMThAddrPr
+	add		rdx, rax
+	mov		ZoneMThAddr, rdx
+	mov		ZoneMThAddrLine, rdx
+	mov		rdx, ZoneMAddAddrPr
+	add		rdx, rax
+	mov		ZoneMAddAddr, rdx
+	mov		ZoneMAddAddrLine, rdx
+	mov		rdx, ZoneMThMinPr
+	add		rdx, rax
+	mov		ZoneMThMinAddr, rdx
+	mov		ZoneMThMinLine, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	
+	add		ZoneThAddrLine, 020h
+	mov		rax, ZoneThAddrLine
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddrLine, 020h
+	mov		rax, ZoneIdAddrLine
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddrLine, 020h
+	mov		rax, ZoneAddAddrLine
+	mov		ZoneAddAddr, rax
+	add		ZoneMThAddrLine, 020h
+	mov		rax, ZoneMThAddrLine
+	mov		ZoneMThAddr, rax
+	add		ZoneMAddAddrLine, 020h
+	mov		rax, ZoneMAddAddrLine
+	mov		ZoneMAddAddr, rax
+	add		ZoneMThMinLine, 020h
+	mov		rax, ZoneMThMinLine
+	mov		ZoneMThMinAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+	add		ZoneMThAddr, rax
+	add		ZoneMAddAddr, rax
+	add		ZoneMThMinAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+
+MAKE_CONBUFF:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+
+	add			rrImgAddr, rcx
+	add			rax, 20h
+
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddrLine, rdx
+	
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddrLine, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddrLine, rdx
+	
+	mov		rdx, ZoneMThAddrPr
+	add		rdx, rax
+	mov		ZoneMThAddr, rdx
+	mov		ZoneMThAddrLine, rdx
+	
+	mov		rdx, ZoneMAddAddrPr
+	add		rdx, rax
+	mov		ZoneMAddAddr, rdx
+	mov		ZoneMAddAddrLine, rdx
+	
+	mov		rdx, ZoneMThMinPr
+	add		rdx, rax
+	mov		ZoneMThMinAddr, rdx
+	mov		ZoneMThMinLine, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		rdx, ZoneMThAddrPr
+	add		rdx, rax
+	mov		ZoneMThAddr, rdx
+	
+	mov		rdx, ZoneMAddAddrPr
+	add		rdx, rax
+	mov		ZoneMAddAddr, rdx
+	
+	mov		rdx, ZoneMThMinPr
+	add		rdx, rax
+	mov		ZoneMThMinAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+	movdqu	xxTemp, [rax+ 20h]
+	movdqu	xxDSlide, [rax+ 30h]
+
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	pmullw		xxDSlide, xxsSpr	
+	paddw		xxCmp2, xxDSlide
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	sub		ZoneMThAddr, 010h
+	sub		ZoneMAddAddr, 010h
+	sub		ZoneMThMinAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+;	jmp		_XMM_COMPARE_8PIXEL
+	jmp		_XMM_COMPARE_MTH
+_return_XMM_COMPARE_8PIXEL:
+_return_XMM_COMPARE_MTH:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+	add		ZoneMThAddr, 010h
+	add		ZoneMAddAddr, 010h
+	add		ZoneMThMinAddr, 010h
+
+	jmp		_XMM_COMPARE_MTH				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+_XMM_COMPARE_MTH:
+
+	mov			rax, ZoneMThMinAddr
+	movdqu		xxTemp, [rax]
+
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	movdqa		xxZTh2, xxZTh
+	movdqa		xxFlag, xxZTh
+	pcmpgtw		xxFlag, xxTemp
+
+	
+	mov			rax, ZoneMAddAddr		; Second Threshold 利侩
+	movdqu		xxDSlide, [rax]
+	pmullw		xxZTh2, xxDSlide
+	psrlw		xxZTh2, 8
+	mov			rax, ZoneMThAddr
+	movdqu		xxDSlide, [rax]
+	paddw		xxZTh2, xxDSlide
+	pand		xxZTh2, xxFlag
+
+	pcmpeqw		xxTemp, xxTemp
+	pandn		xxFlag, xxTemp
+
+	mov			rax, ZoneAddAddr		; First Threshold 利侩
+	movdqu		xxDSlide, [rax]
+	pmullw		xxZTh, xxDSlide			; Overflow 啊瓷己
+	psrlw		xxZTh, 8
+	mov			rax, ZoneThAddr
+	movdqu		xxDSlide, [rax]
+	paddw		xxZTh, xxDSlide
+	pand		xxZTh, xxFlag
+
+	por			xxZTh, xxZTh2
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0
+
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return _return_XMM_COMPARE_MTH
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+
+RET
+ConvZoneMVert2S ENDP
+; Function End	----------------------------------ConvZoneVert2--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVTD.asm b/Common_Class/SISAssem/ConvZoneVTD.asm
new file mode 100644
index 0000000..945cb94
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVTD.asm
@@ -0,0 +1,1224 @@
+
+
+; ConvZoneVTD [ Vertical Tilt Dynamic Pitch]
+; Vertical 八荤俊 Tilt 楷魂 棺 DynamicPitch扁瓷 眠啊, 
+; 2011.09.20 : Vertical Pitch 眠啊
+; 2011.09.21 : Tilt 眠啊霖厚.
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift	equ		4
+SprMulti	equ		16
+_return		equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxfSprT		equ		xmm12
+xxsSprT		equ		xmm13
+
+
+xxSupp		equ		xmm14
+
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+piPitch16Ori	equ		qword ptr[rbp+ 98h]
+iPitch			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+Tilt16			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ExTh			equ		qword ptr[rbp+ 130h]
+ThSuppress		equ		qword ptr[rbp+ 138h]
+
+
+; 肺拿 函荐
+
+; Function Start ----------------------------------ConvZoneVTD--------
+ConvZoneVTD PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	iPitch16		: qword
+	local	cDpc			: qword
+	local	piPitch16		: qword
+	
+	local	c8Pixel			: dword	
+	local	xMatch			: dword	
+	local	yMatch			: dword
+	local	xMatch2			: dword	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0b8h
+
+
+	mov		ImgAddrOri, rcx				; Parameter -> Register
+	mov		maxDefect, r8
+
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+
+	mov			rax, Tilt16				; Tilt Setting
+	and			rax, 0fh
+	movd		xxsSprT, rax
+	movdqa		xxTemp, xxsSprT
+	punpcklwd	xxTemp, xxsSprT
+	pshufd		xxsSprT, xxTemp, 0
+	mov			rcx, SprMulti
+	sub			rcx, rax
+	movd		xxfSprT, rcx
+	movdqa		xxTemp, xxfSprT
+	punpcklwd	xxTemp, xxfSprT
+	pshufd		xxFSprT, xxTemp, 0
+	
+	mov			rax, Tilt16
+	sar			rax, SprShift
+	mov			Tilt16, rax
+
+	mov			rcx, iPitch				; Pitch Setting
+	and			rcx, 0fh
+	movd		xxsSpr, ecx					; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti				; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch					; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	mul		BuffWidth
+	mov		ConPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+	
+	mov		rax, BuffWidth			; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	mov		piPitch16, 0			; DPC Address Set
+	cmp		piPitch16Ori, 0
+	je		DPC_PASS
+	mov		rax, iy
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, piPitch16Ori
+	mov		piPitch16, rax	
+	DPC_PASS:
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	mov		cDpc, 010h
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, InspBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	cmp		piPitch16, 0
+	je		XMM_MAKE
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	inc		cDpc
+	
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+DPC_MAKE:	; verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	cmp		cDpc, 010h
+	jne		_return_DPC_MAKE
+	mov		cDpc, 0
+	mov		rax, piPitch16
+	movsxd	rax, dword ptr[rax]
+	add		piPitch16, 4
+	
+	cmp		iPitch16, rax
+	je		_return_DPC_MAKE
+	
+	mov		iPitch16, rax	
+	mov		rcx, rax
+	and		rcx, 0fh
+	
+	shr		rax, SprShift
+	mov		iPitch, rax
+	
+	mul		BuffWidth
+	mov		ConPitch, rax
+	
+	
+	mov		rdx, 010h
+	sub		rdx, rcx
+	
+	movd		xxsSpr, rcx
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	
+	movd		xxfSpr, rdx
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	jmp		_return_DPC_MAKE
+
+
+XMM_MAKE:
+
+	mov			rax, rrImgAddr			; Compare Pixel
+	add			rax, ConPitch
+	movdqu		xxCmp1, [rax]				; 1 Compare
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSprT					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSprT
+
+	movdqu		xxSrc2, [rax+ 1]			; 2 Compare
+	movdqa		xxSrc1, xxSrc2	
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	pmullw		xxSrc1, xxsSprT
+	pmullw		xxSrc2, xxsSprT
+	
+	paddw		xxCmp1, xxSrc1				; 1+ 2 , >>4, *fSpr
+	paddw		xxCmp2, xxSrc2
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+	pmullw		xxCmp1, xxfSpr
+	pmullw		xxCmp2, xxfSpr
+
+
+	add			rax, BuffWidth				; 3 Compare
+	movdqu		xxSrc2, [rax]
+	movdqa		xxSrc1, xxSrc2	
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	pmullw		xxSrc1, xxfSprT
+	pmullw		xxSrc2, xxfSprT
+
+	movdqu		xxTemp, [rax+ 1]			; 4 Compare
+	movdqa		xxZId, xxTemp
+	punpcklbw	xxTemp, xmm0
+	punpckhbw	xxZId, xmm0
+	pmullw		xxTemp, xxsSprT
+	pmullw		xxZId, xxsSprT
+
+	paddw		xxSrc1, xxTemp				; 3+ 4, >>4, *sSpr
+	paddw		xxSrc2, xxZId
+	psrlw		xxSrc1, SprShift
+	psrlw		xxSrc2, SprShift
+	pmullw		xxSrc1, xxsSpr
+	pmullw		xxSrc2, xxsSpr
+
+	paddw		xxCmp1, xxSrc1
+	paddw		xxCmp2, xxSrc2
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+	
+	movdqu		xxSrc1, [rrImgAddr]		; Source Pixel
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxZId, [rax]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+	
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxZId
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvZoneVTD	ENDP
+; Function End	----------------------------------ConvZoneVTD--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVTDMS.asm b/Common_Class/SISAssem/ConvZoneVTDMS.asm
new file mode 100644
index 0000000..d3e9153
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVTDMS.asm
@@ -0,0 +1,1242 @@
+
+; ConvZoneVTMS : Maximize Speedup 累诀吝
+
+;ConvZoneVTDS : 胶乔靛 诀 累诀吝
+
+; ConvZoneVTD [ Vertical Tilt Dynamic Pitch]
+; Vertical 八荤俊 Tilt 楷魂 棺 DynamicPitch扁瓷 眠啊, 
+; 2011.09.20 : Vertical DynamicPitch 眠啊
+; 2011.09.21 : Tilt 眠啊霖厚. tilt 规氢己(+-)眠啊秦具窃.
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ? 
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift	equ		4
+SprMulti	equ		16
+_return		equ		jmp
+szxMatch	equ		8
+CacheWidth		equ		40h
+CacheWidth2		equ		80h
+
+
+.code
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxfSprT		equ		xmm12
+xxsSprT		equ		xmm13
+
+
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+piPitch16Ori	equ		qword ptr[rbp+ 98h]
+iPitch			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+Tilt16			equ		qword ptr[rbp+ 118h]
+ConAddr			equ		qword ptr[rbp+ 120h]
+bUseUnpair		equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+
+; 肺拿 函荐
+
+; Function Start ----------------------------------ConvZoneVTD--------
+ConvZoneVTDMS PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	iPitch16		: qword
+	local	cDpc			: qword
+	local	piPitch16		: qword
+	
+	local	ConBottom		: qword	
+	local	CacheRight		: qword
+	local	CacheCount		: qword	
+	local	xMatch			: dword	
+	local	yMatch			: dword
+	
+	local	xMatch2			: dword	
+	local	yMatch2			: dword
+	local	c8Pixel			: qword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0b0h
+
+
+	mov		ImgAddrOri, rcx				; Parameter -> Register
+	mov		maxDefect, r8
+
+	mov			rax, Tilt16				; Tilt Setting
+	and			rax, 0fh
+	movd		xxsSprT, rax
+	movdqa		xxTemp, xxsSprT
+	punpcklwd	xxTemp, xxsSprT
+	pshufd		xxsSprT, xxTemp, 0
+	mov			rcx, SprMulti
+	sub			rcx, rax
+	movd		xxfSprT, rcx
+	movdqa		xxTemp, xxfSprT
+	punpcklwd	xxTemp, xxfSprT
+	pshufd		xxFSprT, xxTemp, 0
+	
+	mov			rax, Tilt16
+	sar			rax, SprShift
+	mov			Tilt16, rax
+
+	mov			rcx, iPitch				; Pitch Setting
+	and			rcx, 0fh
+	movd		xxsSpr, ecx					; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti				; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch					; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	sal		rax, 2
+	mov		ConPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, CacheWidth
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+	
+	mov		rax, BuffWidth			; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	mov		piPitch16, 0			; DPC Address Set
+	cmp		piPitch16Ori, 0
+	je		DPC_PASS
+	mov		rax, iy
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, piPitch16Ori
+	mov		piPitch16, rax	
+	DPC_PASS:
+
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	mov		cDpc, 010h
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	mov		rcx, CacheCount
+	sal		rcx, 3
+	sub		ix, rcx
+	sal		rcx, 1
+	mov		rax, ZoneTableW2
+	sub		rax, rcx
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	cmp		piPitch16, 0
+	je		XMM_MAKE
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	inc		cDpc
+	
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+	
+MAKE_CONBUFF:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	
+	add			rrImgAddr, rcx
+	add			rax, 20h
+	
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+DPC_MAKE:	; verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	cmp		cDpc, 010h
+	jne		_return_DPC_MAKE
+	mov		cDpc, 0
+	mov		rax, piPitch16
+	movsxd	rax, dword ptr[rax]
+	add		piPitch16, 4
+	
+	cmp		iPitch16, rax
+	je		_return_DPC_MAKE
+	
+	mov		iPitch16, rax	
+	mov		rcx, rax
+	and		rcx, 0fh
+	
+	shr		rax, SprShift
+	mov		iPitch, rax
+	
+	mul		BuffWidth
+	mov		ConPitch, rax
+	
+	
+	mov		rdx, 010h
+	sub		rdx, rcx
+	
+	movd		xxsSpr, rcx
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	
+	movd		xxfSpr, rdx
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	jmp		_return_DPC_MAKE
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]		; Source Pixel
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+	mov			rax, rrImgAddr			; Compare Pixel
+	add			rax, ConPitch
+	movdqu		xxCmp1, [rax]				; 1 Compare
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSprT					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSprT
+
+	movdqu		xxCmp4, [rax+ 1]			; 2 Compare
+	movdqa		xxCmp3, xxCmp4	
+	punpcklbw	xxCmp3, xmm0
+	punpckhbw	xxCmp4, xmm0
+	pmullw		xxCmp3, xxsSprT
+	pmullw		xxCmp4, xxsSprT
+	
+	paddw		xxCmp1, xxCmp3				; 1+ 2 , >>4, *fSpr
+	paddw		xxCmp2, xxCmp4
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+	pmullw		xxCmp1, xxfSpr
+	pmullw		xxCmp2, xxfSpr
+
+
+	add			rax, BuffWidth				; 3 Compare
+	movdqu		xxCmp4, [rax]
+	movdqa		xxCmp3, xxCmp4	
+	punpcklbw	xxCmp3, xmm0
+	punpckhbw	xxCmp4, xmm0
+	pmullw		xxCmp3, xxfSprT
+	pmullw		xxCmp4, xxfSprT
+
+	movdqu		xxTemp, [rax+ 1]			; 4 Compare
+	movdqa		xxZId, xxTemp
+	punpcklbw	xxTemp, xmm0
+	punpckhbw	xxZId, xmm0
+	pmullw		xxTemp, xxsSprT
+	pmullw		xxZId, xxsSprT
+
+	paddw		xxCmp3, xxTemp				; 3+ 4, >>4, *sSpr
+	paddw		xxCmp4, xxZId
+	psrlw		xxCmp3, SprShift
+	psrlw		xxCmp4, SprShift
+	pmullw		xxCmp3, xxsSpr
+	pmullw		xxCmp4, xxsSpr
+
+	paddw		xxCmp1, xxCmp3
+	paddw		xxCmp2, xxCmp4
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxZId, [rax]
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxZId
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvZoneVTDMS	ENDP
+; Function End	----------------------------------ConvZoneVTD--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVTDS.asm b/Common_Class/SISAssem/ConvZoneVTDS.asm
new file mode 100644
index 0000000..c218972
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVTDS.asm
@@ -0,0 +1,1231 @@
+
+;ConvZoneVTDS : 胶乔靛 诀, 累诀吝.
+
+; ConvZoneVTD [ Vertical Tilt Dynamic Pitch]
+; Vertical 八荤俊 Tilt 楷魂 棺 DynamicPitch扁瓷 眠啊, 
+; 2011.09.20 : Vertical DynamicPitch 眠啊
+; 2011.09.21 : Tilt 眠啊霖厚. tilt 规氢己(+-)眠啊秦具窃.
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift	equ		4
+SprMulti	equ		16
+_return		equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxfSprT		equ		xmm12
+xxsSprT		equ		xmm13
+
+
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+piPitch16Ori	equ		qword ptr[rbp+ 98h]
+iPitch			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+Tilt16			equ		qword ptr[rbp+ 118h]
+ConAddr			equ		qword ptr[rbp+ 120h]
+bUseUnpair		equ		qword ptr[rbp+ 128h]
+
+endLine			equ		qword ptr[rbp+ 130h]
+
+
+; 肺拿 函荐
+
+; Function Start ----------------------------------ConvZoneVTD--------
+ConvZoneVTDS PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	iPitch16		: qword
+	local	cDpc			: qword
+	local	piPitch16		: qword
+	
+	local	ConBottom		: qword	
+	local	c8Pixel			: dword	
+	local	xMatch			: dword	
+	local	yMatch			: dword
+	local	xMatch2			: dword	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0b0h
+
+
+	mov		ImgAddrOri, rcx				; Parameter -> Register
+	mov		maxDefect, r8
+
+	mov			rax, Tilt16				; Tilt Setting
+	and			rax, 0fh
+	movd		xxsSprT, rax
+	movdqa		xxTemp, xxsSprT
+	punpcklwd	xxTemp, xxsSprT
+	pshufd		xxsSprT, xxTemp, 0
+	mov			rcx, SprMulti
+	sub			rcx, rax
+	movd		xxfSprT, rcx
+	movdqa		xxTemp, xxfSprT
+	punpcklwd	xxTemp, xxfSprT
+	pshufd		xxFSprT, xxTemp, 0
+	
+	mov			rax, Tilt16
+	sar			rax, SprShift
+	mov			Tilt16, rax
+
+	mov			rcx, iPitch				; Pitch Setting
+	and			rcx, 0fh
+	movd		xxsSpr, ecx					; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti				; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch					; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+	
+	mov		rax, BuffWidth			; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	mov		piPitch16, 0			; DPC Address Set
+	cmp		piPitch16Ori, 0
+	je		DPC_PASS
+	mov		rax, iy
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, piPitch16Ori
+	mov		piPitch16, rax	
+	DPC_PASS:
+
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	mov		cDpc, 010h
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	cmp		piPitch16, 0
+	je		XMM_MAKE
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	inc		cDpc
+	
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+	
+MAKE_CONBUFF:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	
+	add			rrImgAddr, rcx
+	add			rax, 20h
+	
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+DPC_MAKE:	; verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	cmp		cDpc, 010h
+	jne		_return_DPC_MAKE
+	mov		cDpc, 0
+	mov		rax, piPitch16
+	movsxd	rax, dword ptr[rax]
+	add		piPitch16, 4
+	
+	cmp		iPitch16, rax
+	je		_return_DPC_MAKE
+	
+	mov		iPitch16, rax	
+	mov		rcx, rax
+	and		rcx, 0fh
+	
+	shr		rax, SprShift
+	mov		iPitch, rax
+	
+	sal		rax, 5
+	mov		ConPitch, rax
+	
+	
+	mov		rdx, 010h
+	sub		rdx, rcx
+	
+	movd		xxsSpr, rcx
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	
+	movd		xxfSpr, rdx
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	jmp		_return_DPC_MAKE
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]		; Source Pixel
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+	mov			rax, rrImgAddr			; Compare Pixel
+	add			rax, ConPitch
+	movdqu		xxCmp1, [rax]				; 1 Compare
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSprT					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSprT
+
+	movdqu		xxCmp4, [rax+ 1]			; 2 Compare
+	movdqa		xxCmp3, xxCmp4	
+	punpcklbw	xxCmp3, xmm0
+	punpckhbw	xxCmp4, xmm0
+	pmullw		xxCmp3, xxsSprT
+	pmullw		xxCmp4, xxsSprT
+	
+	paddw		xxCmp1, xxCmp3				; 1+ 2 , >>4, *fSpr
+	paddw		xxCmp2, xxCmp4
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+	pmullw		xxCmp1, xxfSpr
+	pmullw		xxCmp2, xxfSpr
+
+
+	add			rax, BuffWidth				; 3 Compare
+	movdqu		xxCmp4, [rax]
+	movdqa		xxCmp3, xxCmp4	
+	punpcklbw	xxCmp3, xmm0
+	punpckhbw	xxCmp4, xmm0
+	pmullw		xxCmp3, xxfSprT
+	pmullw		xxCmp4, xxfSprT
+
+	movdqu		xxTemp, [rax+ 1]			; 4 Compare
+	movdqa		xxZId, xxTemp
+	punpcklbw	xxTemp, xmm0
+	punpckhbw	xxZId, xmm0
+	pmullw		xxTemp, xxsSprT
+	pmullw		xxZId, xxsSprT
+
+	paddw		xxCmp3, xxTemp				; 3+ 4, >>4, *sSpr
+	paddw		xxCmp4, xxZId
+	psrlw		xxCmp3, SprShift
+	psrlw		xxCmp4, SprShift
+	pmullw		xxCmp3, xxsSpr
+	pmullw		xxCmp4, xxsSpr
+
+	paddw		xxCmp1, xxCmp3
+	paddw		xxCmp2, xxCmp4
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxZId, [rax]
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxZId
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvZoneVTDS	ENDP
+; Function End	----------------------------------ConvZoneVTD--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVTD_BOE.asm b/Common_Class/SISAssem/ConvZoneVTD_BOE.asm
new file mode 100644
index 0000000..25aab95
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVTD_BOE.asm
@@ -0,0 +1,1230 @@
+
+
+; ConvZoneVTD [ Vertical Tilt Dynamic Pitch]
+; Vertical 八荤俊 Tilt 楷魂 棺 DynamicPitch扁瓷 眠啊, 
+; 2011.09.20 : Vertical Pitch 眠啊
+; 2011.09.21 : Tilt 眠啊霖厚.
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift	equ		4
+SprMulti	equ		16
+_return		equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxfSprT		equ		xmm12
+xxsSprT		equ		xmm13
+
+
+xxSupp		equ		xmm14
+
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+piPitch16Ori	equ		qword ptr[rbp+ 98h]
+iPitch			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+Tilt16			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ExTh			equ		qword ptr[rbp+ 130h]
+ThSuppress		equ		qword ptr[rbp+ 138h]
+
+
+; 肺拿 函荐
+
+; Function Start ----------------------------------ConvZoneVTD--------
+ConvZoneVTD_BOE PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	iPitch16		: qword
+	local	cDpc			: qword
+	local	piPitch16		: qword
+	
+	local	c8Pixel			: dword	
+	local	xMatch			: dword	
+	local	yMatch			: dword
+	local	xMatch2			: dword	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0b8h
+
+
+	mov		ImgAddrOri, rcx				; Parameter -> Register
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+
+	mov			rax, Tilt16				; Tilt Setting
+	and			rax, 0fh
+	movd		xxsSprT, rax
+	movdqa		xxTemp, xxsSprT
+	punpcklwd	xxTemp, xxsSprT
+	pshufd		xxsSprT, xxTemp, 0
+	mov			rcx, SprMulti
+	sub			rcx, rax
+	movd		xxfSprT, rcx
+	movdqa		xxTemp, xxfSprT
+	punpcklwd	xxTemp, xxfSprT
+	pshufd		xxFSprT, xxTemp, 0
+	
+	mov			rax, Tilt16
+	sar			rax, SprShift
+	mov			Tilt16, rax
+
+	mov			rcx, iPitch				; Pitch Setting
+	and			rcx, 0fh
+	movd		xxsSpr, ecx					; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti				; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch					; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	;辑脓矾俊辑 磷绢辑 Bottom 俊辑 1 哗霖促.(BOE)
+	mov		rcx, InspBottom
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	mul		BuffWidth
+	mov		ConPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+	
+	mov		rax, BuffWidth			; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	mov		piPitch16, 0			; DPC Address Set
+	cmp		piPitch16Ori, 0
+	je		DPC_PASS
+	mov		rax, iy
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, piPitch16Ori
+	mov		piPitch16, rax	
+	DPC_PASS:
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	mov		cDpc, 010h
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, InspBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	cmp		piPitch16, 0
+	je		XMM_MAKE
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	inc		cDpc
+	
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+DPC_MAKE:	; verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	cmp		cDpc, 010h
+	jne		_return_DPC_MAKE
+	mov		cDpc, 0
+	mov		rax, piPitch16
+	movsxd	rax, dword ptr[rax]
+	add		piPitch16, 4
+	
+	cmp		iPitch16, rax
+	je		_return_DPC_MAKE
+	
+	mov		iPitch16, rax	
+	mov		rcx, rax
+	and		rcx, 0fh
+	
+	shr		rax, SprShift
+	mov		iPitch, rax
+	
+	mul		BuffWidth
+	mov		ConPitch, rax
+	
+	
+	mov		rdx, 010h
+	sub		rdx, rcx
+	
+	movd		xxsSpr, rcx
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	
+	movd		xxfSpr, rdx
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	jmp		_return_DPC_MAKE
+
+
+XMM_MAKE:
+
+	mov			rax, rrImgAddr			; Compare Pixel
+	add			rax, ConPitch
+	movdqu		xxCmp1, [rax]				; 1 Compare
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSprT					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSprT
+
+	movdqu		xxSrc2, [rax+ 1]			; 2 Compare
+	movdqa		xxSrc1, xxSrc2	
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	pmullw		xxSrc1, xxsSprT
+	pmullw		xxSrc2, xxsSprT
+	
+	paddw		xxCmp1, xxSrc1				; 1+ 2 , >>4, *fSpr
+	paddw		xxCmp2, xxSrc2
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+	pmullw		xxCmp1, xxfSpr
+	pmullw		xxCmp2, xxfSpr
+
+
+	add			rax, BuffWidth				; 3 Compare
+	movdqu		xxSrc2, [rax]
+	movdqa		xxSrc1, xxSrc2	
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	pmullw		xxSrc1, xxfSprT
+	pmullw		xxSrc2, xxfSprT
+
+	movdqu		xxTemp, [rax+ 1]			; 4 Compare
+	movdqa		xxZId, xxTemp
+	punpcklbw	xxTemp, xmm0
+	punpckhbw	xxZId, xmm0
+	pmullw		xxTemp, xxsSprT
+	pmullw		xxZId, xxsSprT
+
+	paddw		xxSrc1, xxTemp				; 3+ 4, >>4, *sSpr
+	paddw		xxSrc2, xxZId
+	psrlw		xxSrc1, SprShift
+	psrlw		xxSrc2, SprShift
+	pmullw		xxSrc1, xxsSpr
+	pmullw		xxSrc2, xxsSpr
+
+	paddw		xxCmp1, xxSrc1
+	paddw		xxCmp2, xxSrc2
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+	
+	movdqu		xxSrc1, [rrImgAddr]		; Source Pixel
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxZId, [rax]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+	
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxZId
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+	
+	;搬窃鸥涝 滚弊 荐沥(BOE)
+	movsx	edx, word ptr[rrToD+ 2*iy]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvZoneVTD_BOE	ENDP
+; Function End	----------------------------------ConvZoneVTD--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVTD_ExThAIAu.asm b/Common_Class/SISAssem/ConvZoneVTD_ExThAIAu.asm
new file mode 100644
index 0000000..0aeb649
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVTD_ExThAIAu.asm
@@ -0,0 +1,1202 @@
+
+
+; ConvZoneVTD [ Vertical Tilt Dynamic Pitch]
+; Vertical 八荤俊 Tilt 楷魂 棺 DynamicPitch扁瓷 眠啊, 
+; 2011.09.20 : Vertical Pitch 眠啊
+; 2011.09.21 : Tilt 眠啊霖厚.
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift	equ		4
+SprMulti	equ		16
+_return		equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxfSprT		equ		xmm12
+xxsSprT		equ		xmm13
+
+
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+piPitch16Ori	equ		qword ptr[rbp+ 98h]
+iPitch			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+Tilt16			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+
+
+; 肺拿 函荐
+
+; Function Start ----------------------------------ConvZoneVTD--------
+ConvZoneVTD PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	iPitch16		: qword
+	local	cDpc			: qword
+	local	piPitch16		: qword
+	
+	local	c8Pixel			: dword	
+	local	xMatch			: dword	
+	local	yMatch			: dword
+	local	xMatch2			: dword	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0b8h
+
+
+	mov		ImgAddrOri, rcx				; Parameter -> Register
+	mov		maxDefect, r8
+
+	mov			rax, Tilt16				; Tilt Setting
+	and			rax, 0fh
+	movd		xxsSprT, rax
+	movdqa		xxTemp, xxsSprT
+	punpcklwd	xxTemp, xxsSprT
+	pshufd		xxsSprT, xxTemp, 0
+	mov			rcx, SprMulti
+	sub			rcx, rax
+	movd		xxfSprT, rcx
+	movdqa		xxTemp, xxfSprT
+	punpcklwd	xxTemp, xxfSprT
+	pshufd		xxFSprT, xxTemp, 0
+	
+	mov			rax, Tilt16
+	sar			rax, SprShift
+	mov			Tilt16, rax
+
+	mov			rcx, iPitch				; Pitch Setting
+	and			rcx, 0fh
+	movd		xxsSpr, ecx					; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti				; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch					; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	mul		BuffWidth
+	mov		ConPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+	
+	mov		rax, BuffWidth			; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	mov		piPitch16, 0			; DPC Address Set
+	cmp		piPitch16Ori, 0
+	je		DPC_PASS
+	mov		rax, iy
+	sar		rax, 4
+	sal		rax, 2
+	add		rax, piPitch16Ori
+	mov		piPitch16, rax	
+	DPC_PASS:
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	mov		cDpc, 010h
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, InspBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	cmp		piPitch16, 0
+	je		XMM_MAKE
+	jmp		DPC_MAKE
+	_return_DPC_MAKE:
+	inc		cDpc
+	
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+DPC_MAKE:	; verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	cmp		cDpc, 010h
+	jne		_return_DPC_MAKE
+	mov		cDpc, 0
+	mov		rax, piPitch16
+	movsxd	rax, dword ptr[rax]
+	add		piPitch16, 4
+	
+	cmp		iPitch16, rax
+	je		_return_DPC_MAKE
+	
+	mov		iPitch16, rax	
+	mov		rcx, rax
+	and		rcx, 0fh
+	
+	shr		rax, SprShift
+	mov		iPitch, rax
+	
+	mul		BuffWidth
+	mov		ConPitch, rax
+	
+	
+	mov		rdx, 010h
+	sub		rdx, rcx
+	
+	movd		xxsSpr, rcx
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	
+	movd		xxfSpr, rdx
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	jmp		_return_DPC_MAKE
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]		; Source Pixel
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+	mov			rax, rrImgAddr			; Compare Pixel
+	add			rax, ConPitch
+	movdqu		xxCmp1, [rax]				; 1 Compare
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSprT					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSprT
+
+	movdqu		xxCmp4, [rax+ 1]			; 2 Compare
+	movdqa		xxCmp3, xxCmp4	
+	punpcklbw	xxCmp3, xmm0
+	punpckhbw	xxCmp4, xmm0
+	pmullw		xxCmp3, xxsSprT
+	pmullw		xxCmp4, xxsSprT
+	
+	paddw		xxCmp1, xxCmp3				; 1+ 2 , >>4, *fSpr
+	paddw		xxCmp2, xxCmp4
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+	pmullw		xxCmp1, xxfSpr
+	pmullw		xxCmp2, xxfSpr
+
+
+	add			rax, BuffWidth				; 3 Compare
+	movdqu		xxCmp4, [rax]
+	movdqa		xxCmp3, xxCmp4	
+	punpcklbw	xxCmp3, xmm0
+	punpckhbw	xxCmp4, xmm0
+	pmullw		xxCmp3, xxfSprT
+	pmullw		xxCmp4, xxfSprT
+
+	movdqu		xxTemp, [rax+ 1]			; 4 Compare
+	movdqa		xxZId, xxTemp
+	punpcklbw	xxTemp, xmm0
+	punpckhbw	xxZId, xmm0
+	pmullw		xxTemp, xxsSprT
+	pmullw		xxZId, xxsSprT
+
+	paddw		xxCmp3, xxTemp				; 3+ 4, >>4, *sSpr
+	paddw		xxCmp4, xxZId
+	psrlw		xxCmp3, SprShift
+	psrlw		xxCmp4, SprShift
+	pmullw		xxCmp3, xxsSpr
+	pmullw		xxCmp4, xxsSpr
+
+	paddw		xxCmp1, xxCmp3
+	paddw		xxCmp2, xxCmp4
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxZId, [rax]
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxZId
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvZoneVTD	ENDP
+; Function End	----------------------------------ConvZoneVTD--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVert.asm b/Common_Class/SISAssem/ConvZoneVert.asm
new file mode 100644
index 0000000..37673e1
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVert.asm
@@ -0,0 +1,1102 @@
+
+; ConvZone Vertical 八荤 葛碘.
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		8
+
+
+.code
+
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSrc3		equ		xmm12
+xxSrc4		equ		xmm13
+xxCmp3		equ		xmm14
+xxCmp4		equ		xmm15
+
+xxSupp		equ		xmm12
+
+xxDStart	equ		xmm13	; 檬扁摹
+xxDSlope	equ		xmm14	; 扁匡扁
+xxDMin		equ		xmm15	; 利侩 备埃 弥家摹
+
+; 颇扼固磐
+
+
+
+
+; 肺拿 函荐
+
+
+ConvZoneVert PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneThAddr1	: qword
+	local	ZoneIdAddr1	: qword
+	local	ZoneTableW2	: qword	
+	local	pMatch1		: qword
+	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword
+	
+	local	pairTop		: qword
+	local	pairBottom		: qword
+	local	iPitchHUp		: qword	
+	local	c8Pixel		: dword	
+	local	xMatch		: dword
+	
+	local	yMatch		: dword
+	local	xMatch2		: dword
+	local	yMatch2		: dword
+
+	push	rbp
+	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+	ADD		rbp, 098h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	mul		BuffWidth
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, InspBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+;	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+;	mov		ZoneIdAddr1, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp4, xxCmp1
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+	
+	add		rax, BuffWidth
+	movdqu	xxCmp3, [rax]
+
+	movdqu	xxTemp, xxCmp3	
+	punpcklbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr
+	paddw	xxCmp1, xxTemp
+
+	movdqu	xxTemp, xxCmp3	
+	punpckhbw	xxTemp, xmm0
+	pmullw	xxTemp, xxsSpr	
+	paddw	xxCmp2, xxTemp
+	
+	psrlw	xxCmp1, SprShift
+	psrlw	xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+
+	_return	_return_XMM_COMPARE
+XMM_COMPARE:
+	mov		c8Pixel, 0	
+	jmp		_XMM_COMPARE_8PIXEL
+	_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			END_FUNC
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxZTh, [rax]
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw	xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			_XMM_COMPARE_VERIFY
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+_XMM_COMPARE_VERIFY:
+	cmp		bRFilter, 1
+	jne		DEFECT_00
+	
+; 荐沥秦具 等促.. xxSrc3阑 肺爹秦具茄促.
+	mov		rax, rrImgAddr
+	sub		rax, BuffWidth
+	movdqu		xxSrc3, [rax]
+	movdqa		xxSrc4, xxSrc3
+	punpcklbw	xxSrc3, xmm0
+	punpckhbw	xxSrc4, xmm0
+
+	cmp		c8Pixel, 1
+	jge		COMPARE_VERIFY_LOAD_SECOND					; BD_AD Check
+	movdqa		xxCmp3, xxCmp4
+	punpcklbw	xxCmp3, xmm0
+	jmp		COMPARE_VERIFY_LOAD_END
+
+	COMPARE_VERIFY_LOAD_SECOND:
+	movdqa		xxSrc3, xxSrc4
+	movdqa		xxCmp3, xxCmp4
+	punpckhbw	xxCmp3, xmm0
+
+	COMPARE_VERIFY_LOAD_END:	
+	pmullw		xxSrc3, xxsSpr
+	movdqa		xxZId, xxfSpr
+	pmullw		xxZId, xxSrc1
+	paddw		xxSrc3, xxZId
+	psrlw		xxSrc3, SprShift
+	
+	psubsw		xxSrc3, xxCmp3
+	pabsw		xxSrc3, xxSrc3
+	pcmpgtw	xxSrc3, xxZTh
+	pand		xxTemp, xxSrc3
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0
+	jne			DEFECT_00
+	add			ix, 8
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+	cmp		edx, 0
+	je		TYPE_1
+	mov		(astPair ptr [rcx]).dtype, 0
+	jmp		TYPE_END
+TYPE_1:
+	mov		(astPair ptr [rcx]).dtype, 1
+TYPE_END:
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+
+END_FUNC:
+
+	;mov		rax, rrNoD					; return rrNoD
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+	pop		rbp
+
+RET
+ConvZoneVert ENDP
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVert2.asm b/Common_Class/SISAssem/ConvZoneVert2.asm
new file mode 100644
index 0000000..d95d188
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVert2.asm
@@ -0,0 +1,1102 @@
+
+; ConvZoneVert狼 促捞唱雇 Threshold 滚傈.
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return		equ		jmp
+szxMatch	equ		8
+
+
+.code
+
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+
+xxDSlide	equ		xmm14	; 扁匡扁
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop		equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX		equ		qword ptr[rbp+ 50h]
+DefectY		equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc		equ		qword ptr[rbp+ 70h]
+GrayCmp		equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair		equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+ConAddr			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ThSuppress		equ		qword ptr[rbp+ 130h]
+
+
+; 肺拿 函荐
+
+
+; Function Start ----------------------------------ConvZoneVert2--------
+ConvZoneVert2 PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	c8Pixel			: dword	
+	local	xMatch			: dword
+	local	yMatch			: dword	
+	local	xMatch2			: dword
+	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	ADD		rbp, 0a8h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	mul		BuffWidth
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, BuffWidth
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, InspBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0				; Unpack
+	punpckhbw	xxSrc2, xmm0
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0				; Unpack
+	punpckhbw	xxCmp2, xmm0
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+	add		rax, BuffWidth
+	movdqu	xxDSlide, [rax]
+
+	movdqu		xxTemp, xxDSlide	
+	punpcklbw	xxTemp, xmm0
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	punpckhbw	xxDSlide, xmm0
+	pmullw		xxDSlide, xxsSpr	
+	paddw		xxCmp2, xxDSlide
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+	
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvZoneVert2 ENDP
+; Function End	----------------------------------ConvZoneVert2--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVert2S.asm b/Common_Class/SISAssem/ConvZoneVert2S.asm
new file mode 100644
index 0000000..af4e055
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVert2S.asm
@@ -0,0 +1,1130 @@
+
+; ConvZoneVert2S ; S means SpeedUp
+; ConvZoneVert2狼 SpeedUp Version.
+; Vertical Convolution Buffer 狼 档涝栏肺 葛碘 胶乔靛 35% 啊加
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		8		; x, y 阿 4byte
+
+
+.code
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+xxDSlide	equ		xmm14	; 扁匡扁
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+ConAddr			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ExTh			equ		qword ptr[rbp+ 130h]
+ThSuppress		equ		qword ptr[rbp+ 138h]
+
+; 肺拿 函荐
+
+
+; Function Start ----------------------------------ConvZoneVert2--------
+ConvZoneVert2S PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	ConBottom		: qword
+	local	c8Pixel			: dword	
+	local	xMatch			: dword
+	local	yMatch			: dword	
+	local	xMatch2			: dword
+	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0a8h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+	
+MAKE_CONBUFF:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	
+	add			rrImgAddr, rcx
+	add			rax, 20h
+	
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+	movdqu	xxTemp, [rax+ 20h]
+	movdqu	xxDSlide, [rax+ 30h]
+
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	pmullw		xxDSlide, xxsSpr	
+	paddw		xxCmp2, xxDSlide
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+	
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+
+RET
+ConvZoneVert2S ENDP
+; Function End	----------------------------------ConvZoneVert2--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVert2S2b2.asm b/Common_Class/SISAssem/ConvZoneVert2S2b2.asm
new file mode 100644
index 0000000..19bdba1
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVert2S2b2.asm
@@ -0,0 +1,1158 @@
+
+; ConvZoneVert2S2b2 ; 2b2 = 2*2 Masking
+; ConvZoneVert2S ; S means SpeedUp
+; ConvZoneVert2狼 SpeedUp Version.
+; Vertical Convolution Buffer 狼 档涝栏肺 葛碘 胶乔靛 35% 啊加
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		8		; x, y 阿 4byte
+
+
+.code
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+xxDSlide	equ		xmm14	; 扁匡扁
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+ConAddr			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ExTh			equ		qword ptr[rbp+ 130h]
+ThSuppress		equ		qword ptr[rbp+ 138h]
+
+; 肺拿 函荐
+
+
+; Function Start ----------------------------------ConvZoneVert2--------
+ConvZoneVert2S2b2 PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	ConBottom		: qword
+	local	c8Pixel			: dword	
+	local	xMatch			: dword
+	local	yMatch			: dword	
+	local	xMatch2			: dword
+	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0a8h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+	
+	
+MAKE_CONBUFF:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+
+	movdqu		xxCmp1, [rrImgAddr+ 1]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0	
+	paddw		xxSrc1, xxCmp1
+	paddw		xxSrc2, xxCmp2
+
+	movdqu		xxCmp1, [rrImgAddr+ rcx]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0	
+	paddw		xxSrc1, xxCmp1
+	paddw		xxSrc2, xxCmp2
+
+	movdqu		xxCmp1, [rrImgAddr+ rcx+ 1]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	paddw		xxSrc1, xxCmp1
+	paddw		xxSrc2, xxCmp2
+
+	psraw		xxSrc1, 2
+	psraw		xxSrc2, 2
+
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	
+	add			rrImgAddr, rcx
+	add			rax, 20h
+	
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+	movdqu	xxTemp, [rax+ 20h]
+	movdqu	xxDSlide, [rax+ 30h]
+
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	pmullw		xxDSlide, xxsSpr	
+	paddw		xxCmp2, xxDSlide
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+
+;	psraw xxPeakAbs, 2
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+	
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+
+RET
+ConvZoneVert2S2b2 ENDP
+; Function End	----------------------------------ConvZoneVert2--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVert2S_BOE.asm b/Common_Class/SISAssem/ConvZoneVert2S_BOE.asm
new file mode 100644
index 0000000..12394c0
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVert2S_BOE.asm
@@ -0,0 +1,1136 @@
+
+; ConvZoneVert2S ; S means SpeedUp
+; ConvZoneVert2狼 SpeedUp Version.
+; Vertical Convolution Buffer 狼 档涝栏肺 葛碘 胶乔靛 35% 啊加
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		8		; x, y 阿 4byte
+
+
+.code
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+xxDSlide	equ		xmm14	; 扁匡扁
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+ConAddr			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ExTh			equ		qword ptr[rbp+ 130h]
+ThSuppress		equ		qword ptr[rbp+ 138h]
+
+; 肺拿 函荐
+
+
+; Function Start ----------------------------------ConvZoneVert2--------
+ConvZoneVert2S_BOE PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	ConBottom		: qword
+	local	c8Pixel			: dword	
+	local	xMatch			: dword
+	local	yMatch			: dword	
+	local	xMatch2			: dword
+	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0a8h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	;辑脓矾俊辑 磷绢辑 Bottom 俊辑 1 哗霖促.(BOE)
+	mov		rcx, InspBottom
+	sub		rcx, 1
+	mov		InspBottom, rcx
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, 010h
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	add		rrImgAddr, 20h
+	mov		rax, ZoneTableW2
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	jmp		XMM_MAKE
+	_return_XMM_MAKE:
+	jmp		XMM_COMPARE
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+	
+MAKE_CONBUFF:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	
+	add			rrImgAddr, rcx
+	add			rax, 20h
+	
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+	jmp			_return_MAKE_CONBUFF
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+XMM_MAKE:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqu		xxSrc2, [rrImgAddr+ 10h]
+
+	mov		rax, rrImgAddr
+	add		rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	movdqu		xxCmp2, [rax+ 10h]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+	pmullw		xxCmp2, xxfSpr
+
+	movdqu	xxTemp, [rax+ 20h]
+	movdqu	xxDSlide, [rax+ 30h]
+
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+
+	pmullw		xxDSlide, xxsSpr	
+	paddw		xxCmp2, xxDSlide
+
+	psrlw		xxCmp1, SprShift
+	psrlw		xxCmp2, SprShift
+_return	_return_XMM_MAKE
+
+
+
+XMM_COMPARE_END:
+	sub		ix, 10h
+	sub		ZoneThAddr, 010h
+	sub		ZoneIdAddr, 010h
+	sub		ZoneAddAddr, 010h
+	_return	_return_XMM_COMPARE
+
+XMM_COMPARE:
+	mov		c8Pixel, 0
+	jmp		_XMM_COMPARE_8PIXEL
+_return_XMM_COMPARE_8PIXEL:
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			PAIRING_VERT
+
+
+	inc		c8Pixel
+	cmp		c8Pixel, 2
+	je		XMM_COMPARE_END				; BE_RD CHECK
+
+	movdqa		xxSrc1, xxSrc2
+	movdqa		xxCmp1, xxCmp2
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+
+	;jmp		_XMM_COMPARE_8PIXEL				; RD
+
+_XMM_COMPARE_8PIXEL:
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+	
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_return_XMM_COMPARE_8PIXEL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _return_XMM_COMPARE_8PIXEL
+
+
+
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+	
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	movsx	rcx, word ptr[rrPoD+ 2*iy]
+	cmp		rcx, ExTh
+	jle		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+	
+	;搬窃鸥涝 滚弊 荐沥(BOE)
+	movsx	edx, word ptr[rrToD+ 2*iy]
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+
+RET
+ConvZoneVert2S_BOE ENDP
+; Function End	----------------------------------ConvZoneVert2--------
+
+end
diff --git a/Common_Class/SISAssem/ConvZoneVertMS.asm b/Common_Class/SISAssem/ConvZoneVertMS.asm
new file mode 100644
index 0000000..a50b59d
--- /dev/null
+++ b/Common_Class/SISAssem/ConvZoneVertMS.asm
@@ -0,0 +1,1181 @@
+
+; ConvZoneVertMS ; MS means Maximum SpeedUp
+; ConvZoneVert2狼 滴锅掳 Speed Up Version
+; Cache Memory Hitt Ratio 甫 必措拳 窍扁.
+; Cache Right 档涝
+; Side Effect : Line Inspection Unit 捞 目瘤搁辑 Zone Shift俊 措茄 利侩捞 惑措利栏肺 蠢妨咙.
+; Line Inspection Unit 窜困绰 Zone Index Table阑 包烹茄促.
+; Line Inspection Unit 篮 64pixel 捞哥 Inspection Right甫 逞绢辑绰 裹困狼 Pixel捞 蜡瓤秦具 茄促. when Stackint up the buffer.
+; ******** blob 风凭 荐沥秦具 窃, 俺荐 瞒捞巢..
+
+
+; ConvZoneVert2S ; S means SpeedUp
+; ConvZoneVert2狼 SpeedUp Version.
+; Vertical Convolution Buffer 狼 档涝栏肺 葛碘 胶乔靛 35% 啊加
+
+
+.data
+astPair	STRUCT
+	pos		dword ?
+	pair	dword ?
+	dtype	dword ?
+	peak	dword ?
+	x		dword ?
+	y		dword ?
+	src		dword ?
+	ref		dword ?
+	zone	dword ?
+	Thre	dword ?	
+astPair	ENDS
+
+SprShift		equ		4
+SprMulti		equ		16
+_return			equ		jmp
+szxMatch		equ		8
+CacheWidth		equ		40h
+CacheWidth2		equ		80h
+
+
+.code
+
+
+ix			equ		rsi
+iy			equ		rdi
+ix32		equ		esi
+iy32		equ		edi
+rrImgAddr	equ		r8
+rdImgAddr	equ		r8d
+rwImgAddr	equ		r8w
+rrNoD		equ		r9
+
+
+rrXoD		equ		r10
+rrYoD		equ		r11
+rrToD		equ		r12
+rrPoD		equ		r13
+rrSrcD		equ		r14
+rrCmpD		equ		r15
+
+
+xxTemp		equ		xmm1
+
+xxZTh		equ		xmm2
+xxZId		equ		xmm3
+
+xxSrc1		equ		xmm4
+xxSrc2		equ		xmm5
+
+xxCmp1		equ		xmm6
+xxCmp2		equ		xmm7
+xxPeakS		equ		xmm8
+xxPeakAbs	equ		xmm9
+
+xxfSpr		equ		xmm10
+xxsSpr		equ		xmm11
+
+xxSupp		equ		xmm12
+
+xxDSlide	equ		xmm14	; 扁匡扁
+
+; 颇扼固磐
+
+InspLeft		equ		qword ptr[rbp+ 30h]
+InspRight		equ		qword ptr[rbp+ 38h]
+InspTop			equ		qword ptr[rbp+ 40h]
+InspBottom		equ		qword ptr[rbp+ 48h]
+
+DefectX			equ		qword ptr[rbp+ 50h]
+DefectY			equ		qword ptr[rbp+ 58h]
+DefectType		equ		qword ptr[rbp+ 60h]
+DefectVal		equ		qword ptr[rbp+ 68h]
+
+
+GraySrc			equ		qword ptr[rbp+ 70h]
+GrayCmp			equ		qword ptr[rbp+ 78h]
+ZoneId			equ		qword ptr[rbp+ 80h]
+ZoneTh			equ		qword ptr[rbp+ 88h]
+
+BuffWidth		equ		qword ptr[rbp+ 90h]
+iPitch			equ		qword ptr[rbp+ 98h]
+fSPR			equ		qword ptr[rbp+ 0a0h]
+sSPR			equ		qword ptr[rbp+ 0a8h]
+
+ZoneThAddrPr	equ		qword ptr[rbp+ 0b0h]
+ZoneIdAddrPr	equ		qword ptr[rbp+ 0b8h]
+ZoneTableW		equ		qword ptr[rbp+ 0c0h]
+pMatch			equ		qword ptr[rbp+ 0c8h]
+
+PairAddr		equ		qword ptr[rbp+ 0d0h]	; 扁夯八荤 WIDTH
+nPair			equ		qword ptr[rbp+ 0d8h]	; 扁夯 八荤 HEIGHT
+MaxPair			equ		qword ptr[rbp+ 0e0h]
+PairSize		equ		qword ptr[rbp+ 0e8h]
+
+dxPtrn			equ		qword ptr[rbp+ 0f0h]
+dyPtrn			equ		qword ptr[rbp+ 0f8h]
+szyMatch		equ		qword ptr[rbp+ 100h]
+bRFilter		equ		qword ptr[rbp+ 108h]
+
+ZoneAddAddrPr	equ		qword ptr[rbp+ 110h]
+ConAddr			equ		qword ptr[rbp+ 118h]
+bUseUnpair		equ		qword ptr[rbp+ 120h]
+endLine			equ		qword ptr[rbp+ 128h]
+
+ThSuppress		equ		qword ptr[rbp+ 130h]
+
+; 肺拿 函荐
+
+
+; Function Start ----------------------------------ConvZoneVert2--------
+ConvZoneVertMS PROC
+	local	maxDefect		: qword
+	local	ImgAddrOri		: qword
+	local	ZoneThAddr		: qword
+	local	ZoneIdAddr		: qword
+	
+	local	ZoneAddAddr		: qword
+	local	ZoneThAddr1		: qword
+	local	ZoneIdAddr1		: qword
+	local	ZoneAddAddr1	: qword
+	
+	local	ZoneTableW2		: qword	
+	local	pMatch1			: qword	
+	local	exPtrn			: qword
+	local	eyPtrn			: qword
+	
+	local	eyPtrn1			: qword
+	local	ConvPitch		: qword	
+	local	pairTop			: qword
+	local	pairBottom		: qword
+	
+	local	iPitchHUp		: qword	
+	local	ConBottom		: qword
+	local	CacheRight		: qword
+	local	CacheCount		: qword	
+	
+	local	xMatch			: dword
+	local	yMatch			: dword	
+	local	xMatch2			: dword	
+	local	yMatch2			: dword
+
+;	push	rbp
+;	mov		rbp, rsp
+	push	r10
+	push	r11
+	push	r12
+	push	r13
+	push	r14
+	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	add		rbp, 08h
+;	ADD		rbp, 0b0h
+
+	mov		ImgAddrOri, rcx
+	mov		maxDefect, r8
+	
+	mov			rax, ThSuppress		; Suppress
+	movd		xxSupp, eax
+	movdqa		xxTemp, xxSupp
+	punpcklwd	xxTemp, xxSupp
+	pshufd		xxSupp, xxTemp, 0
+
+	mov			rcx, iPitch
+	and			rcx, 0fh
+	movd		xxsSpr, ecx			; sSPR
+	movdqa		xxTemp, xxsSpr
+	punpcklwd	xxTemp, xxsSpr
+	pshufd		xxsSpr, xxTemp, 0
+	mov			rax, SprMulti			; fSpr
+	sub			rax, rcx
+	movd		xxfSpr, eax
+	movdqa		xxTemp, xxfSpr
+	punpcklwd	xxTemp, xxfSpr
+	pshufd		xxfSpr, xxTemp, 0
+	
+	mov		xMatch2, 0
+
+	mov		rax, iPitch			; iPitch
+	sar		rax, SprShift
+	mov		iPitch, rax
+	
+	cmp		rcx, 8
+	jl		PITCH_H_UP_PASS
+	inc		rax
+	PITCH_H_UP_PASS:
+	mov		iPitchHUp, rax
+	
+	
+	mov		rcx, InspBottom
+	sub		rcx, iPitch
+	sub		rcx, 1
+	mov		ConBottom, rcx
+	
+	sub		rcx, iPitch
+	mov		pairBottom, rcx
+
+	mov		rax, InspTop
+	add		rax, iPitch
+	mov		pairTop, rax
+	
+	mov		rax, iPitch
+	sal		rax, 5
+	sal		rax, 2
+	mov		ConvPitch, rax
+
+	mov		rax, ZoneTableW
+	add		rax, rax
+	mov		ZoneTableW2, rax
+
+	
+	mov		ix, InspLeft
+	mov		iy, InspTop
+	
+	mov		rax, InspRight
+	sub		rax, InspLeft
+;	add		rax, 15
+	sar		rax, 4
+	sal		rax, 4
+	add		rax, inspLeft
+	mov		InspRight, rax
+
+
+	mov		rrXoD, DefectX
+	mov		rrYoD, DefectY
+	mov		rrToD, DefectType
+	mov		rrPoD, DefectVal
+
+	mov		rrSrcD, GraySrc
+	mov		rrCmpD, GrayCmp
+
+
+	mov		rcx, pMatch				; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	mov		pMatch1, rcx				; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn
+	add		rdx, rbx
+	mov		exPtrn, rdx						; exPtrn
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+
+
+	pxor	xmm0, xmm0
+
+LOOP_1:
+	jmp		LOOP_1_CHECK
+LOOP_1_TAIL:
+	jmp		PAIRING_VERT
+	_return_PAIRING_VERT:
+
+	add		ix, CacheWidth
+	mov		rax, eyPtrn1
+	mov		eyPtrn, rax	
+	mov		rax, pMatch1
+	mov		pMatch, rax
+	add		ZoneThAddr1, 020h
+	mov		rax, ZoneThAddr1
+	mov		ZoneThAddr, rax
+	add		ZoneIdAddr1, 020h
+	mov		rax, ZoneIdAddr1
+	mov		ZoneIdAddr, rax
+	add		ZoneAddAddr1, 020h
+	mov		rax, ZoneAddAddr1
+	mov		ZoneAddAddr, rax
+	
+LOOP_1_CHECK:
+	cmp		ix, InspRight			; x绵 BED Check
+	jge		END_FUNC
+LOOP_1_BODY:
+	mov		iy, InspTop
+
+	mov		rax, BuffWidth		; 捞固瘤 绢靛饭胶 Set
+	mul		iy
+	add		rax, ix
+	add		rax, ImgAddrOri
+	mov		rrImgAddr, rax
+	
+	jmp		MAKE_CONBUFF_HEAD
+	_return_MAKE_CONBUFF:
+	
+	mov		iy, InspTop
+	mov		rrImgAddr, ConAddr
+
+	cmp		ix, exPtrn				; 菩畔 八荤 BD_RD Check
+	jge		CHECK_1_BOUND
+	_return_CHECK_1_BOUND:
+
+	mov		rax, ix
+	add		rax, CacheWidth
+	cmp		rax, InspRight
+	jle		PASS_Cache_RIGHT
+	mov		rax, InspRight
+PASS_Cache_RIGHT:
+	mov		CacheRight, rax
+
+LOOP_2:
+	jmp		LOOP_2_CHECK
+LOOP_2_TAIL:
+	inc		iy
+	mov		rcx, CacheCount
+	sal		rcx, 3
+	sub		ix, rcx
+	sal		rcx, 1
+	mov		rax, ZoneTableW2
+	sub		rax, rcx
+	add		ZoneThAddr, rax
+	add		ZoneIdAddr, rax
+	add		ZoneAddAddr, rax
+LOOP_2_CHECK:
+	cmp		iy, ConBottom			; BED Check
+	jge		LOOP_1_TAIL
+	
+	cmp		iy, eyPtrn					; BD_AD Check
+	jge		CHECK_2_BOUND
+	_return_CHECK_2_BOUND:
+
+LOOP_2_BODY:
+	mov		CacheCount, 0
+	jmp		_XMM_COMPARE_CHECK
+	_return_XMM_COMPARE:
+
+	jmp		LOOP_2_TAIL
+
+;;;;;;;=================================================
+
+
+
+CHECK_1_BOUND:
+									; 促澜 Zone offset备窍扁, pMatch, exPtrn, eyPtrn
+	add		pMatch1, szxMatch					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch1
+	add		rcx, szyMatch
+	mov		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		eyPtrn1, rdx
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, dxPtrn						; exPtrn
+	add		rdx, rbx
+	mov		rcx, rdx
+	add		rcx, dxPtrn
+	cmp		rcx, InspRight
+	jl		EXCESS_1_BOUND_PASS
+	mov		rdx, rcx
+EXCESS_1_BOUND_PASS:
+	mov		exPtrn, rdx
+	mov		rdx, ix
+	sub		rdx, rbx
+	
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		ZoneThAddr1, rdx
+	
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		ZoneIdAddr1, rdx
+	
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+	mov		ZoneAddAddr1, rdx
+	inc		xMatch2
+	
+_return	_return_CHECK_1_BOUND
+
+CHECK_2_BOUND:
+									; 促澜 Zone offset备窍扁, eyPtrn, (exPtrn篮 LOOP_1 俊辑父 备窃)
+	mov		rcx, szyMatch
+	add		pMatch, rcx					; ZoneThreshold Offset 拌魂(zOffset)
+	mov		rcx, pMatch
+	movsxd rbx, dword ptr[rcx+ 4]
+	mov		yMatch, ebx
+	mov		rdx, dyPtrn
+	add		rdx, rbx
+	mov		rax, rdx
+	add		rax, dyPtrn
+	cmp		rax, InspBottom
+	jl		EXCESS_2_BOUND_PASS
+	mov		rdx, rax
+EXCESS_2_BOUND_PASS:
+	mov		eyPtrn, rdx						; eyPtrn
+	mov		rax, iy
+	sub		rax, rbx
+	mul		ZoneTableW							; y*width
+
+	movsxd	rbx, dword ptr[rcx]
+	mov		xMatch, ebx
+	mov		rdx, ix
+	sub		rdx, rbx
+
+	add		rax, rdx							; offset= y*width+ x
+	add		rax, rax
+	mov		rdx, ZoneThAddrPr
+	add		rdx, rax
+	mov		ZoneThAddr, rdx
+	mov		rdx, ZoneIdAddrPr
+	add		rdx, rax
+	mov		ZoneIdAddr, rdx
+	mov		rdx, ZoneAddAddrPr
+	add		rdx, rax
+	mov		ZoneAddAddr, rdx
+
+_return	_return_CHECK_2_BOUND
+
+
+MAKE_CONBUFF2_HEAD:		; 内靛啊 犬厘己捞 乐瘤父 Register 炼累捞 歹 腹酒辑 弊繁瘤.. MAKE_CONBUFF_HEAD 焊促 加档啊 炼陛歹 蠢府促.
+	mov		rax, ConAddr
+
+MAKE_CONBUFF2:
+	mov		rcx, rrImgAddr
+	mov		rdx, 40h
+	add		rdx, rrImgAddr
+	
+MAKE_CONBUFF2_SUB:
+	movdqu		xxSrc1, [rcx]
+	movdqu		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	add			rcx, 10h
+	add			rax, 20h
+	cmp			rcx, rdx
+	jle			MAKE_CONBUFF2_SUB
+	sub			rax, 20h
+	
+	add			rrImgAddr, BuffWidth
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF2
+jmp		_return_MAKE_CONBUFF
+
+
+
+MAKE_CONBUFF_HEAD:
+	mov		rcx, BuffWidth
+	mov		rax, ConAddr
+
+
+MAKE_CONBUFF:
+	movdqu		xxSrc1, [rrImgAddr]
+	movdqa		xxSrc2, xxSrc1
+	punpcklbw	xxSrc1, xmm0
+	punpckhbw	xxSrc2, xmm0
+	
+	movdqu		[rax], xxSrc1
+	movdqu		[rax+ 10h], xxSrc2
+	
+	movdqu		xxCmp1, [rrImgAddr+ 10h]
+	movdqa		xxCmp2, xxCmp1
+	punpcklbw	xxCmp1, xmm0
+	punpckhbw	xxCmp2, xmm0
+	
+	movdqu		[rax+ 20h], xxCmp1
+	movdqu		[rax+ 30h], xxcmp2
+	
+	movdqu		xxZTh, [rrImgAddr+ 20h]
+	movdqa		xxZId, xxZTh
+	punpcklbw	xxZTh, xmm0
+	punpckhbw	xxZId, xmm0
+	
+	movdqu		[rax+ 40h], xxZTh
+	movdqu		[rax+ 50h], xxZId
+	
+	movdqu		xxPeakS, [rrImgAddr+ 30h]
+	movdqa		xxPeakAbs, xxPeakS
+	punpcklbw	xxPeakS, xmm0
+	punpckhbw	xxPeakAbs, xmm0
+	
+	movdqu		[rax+ 60h], xxPeakS
+	movdqu		[rax+ 70h], xxPeakAbs
+	
+
+	add			rrImgAddr, rcx
+	add			rax, 80h
+	
+	inc			iy
+	cmp			iy, InspBottom
+	jle			MAKE_CONBUFF
+jmp			_return_MAKE_CONBUFF
+
+
+_XMM_COMPARE_TAIL:
+	add		rrImgAddr, 010h
+	add		ZoneThAddr, 010h
+	add		ZoneIdAddr, 010h
+	add		ZoneAddAddr, 010h
+_XMM_COMPARE_CHECK:
+	cmp		ix, CacheRight
+	jge		_return_XMM_COMPARE
+
+	cmp			rrNoD, maxDefect				; BED Check
+	jge			_MAX_PIXEL_DEFECT
+
+	inc		CacheCount
+	
+_XMM_COMPARE_8PIXEL:
+;Make XMM
+	movdqu		xxSrc1, [rrImgAddr]
+
+	mov			rax, rrImgAddr
+	add			rax, ConvPitch
+	movdqu		xxCmp1, [rax]
+	pmullw		xxCmp1, xxfSpr					; Compare SPR (fSPR, sSPR)
+
+	movdqu		xxTemp, [rax+ CacheWidth2]
+	pmullw		xxTemp, xxsSpr
+	paddw		xxCmp1, xxTemp
+	
+
+	psrlw		xxCmp1, SprShift
+; Make Dynamic Threshold
+
+	pminuw		xxSrc1, xxSupp
+	pminuw		xxCmp1, xxSupp
+
+	mov			rax, ZoneThAddr
+	movdqu		xxTemp, [rax]
+	mov			rax, ZoneAddAddr
+	movdqu		xxDSlide, [rax]
+	movdqa		xxZTh, xxSrc1
+	pmaxuw		xxZTh, xxCmp1
+	pmullw		xxZTh, xxDSlide
+	psrlw		xxZTh, 8
+	paddw		xxZTh, xxTemp
+
+; Compare Src, Ref
+	movdqa		xxPeakS, xxSrc1
+	psubsw		xxPeakS, xxCmp1
+	pabsw		xxPeakAbs, xxPeakS
+	movdqa		xxTemp, xxPeakAbs
+	pcmpgtw		xxTemp, xxZTh
+	pmovmskb	rax, xxTemp
+	cmp			rax, 0								; BD_E Check
+	jne			DEFECT_00
+
+	add			ix, 8
+
+_return	_XMM_COMPARE_TAIL
+
+
+
+DEFECT_00:
+	
+	mov			rax, ZoneIdAddr
+	movdqu		xxZId, [rax]	
+
+	pextrw		rax, xxTemp, 0h
+	cmp			rax, 0
+	je			DEFECT_01
+
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 0h
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 0h
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 0h
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	ebx, xxZTh, 0h
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 0h
+	cmp		ax, 0
+	jg		WHITE_00
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 0h
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_01
+	WHITE_00:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_01:
+	inc		ix
+
+	pextrw		rax, xxTemp, 1
+	cmp			rax, 0
+	je			DEFECT_02
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 1
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 1
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 1
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 1
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 1
+	cmp		ax, 0
+	jg		WHITE_01
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_02
+	WHITE_01:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_02:
+	inc		ix
+
+	pextrw		rax, xxTemp, 2
+	cmp			rax, 0
+	je			DEFECT_03
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 2
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 2
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 2
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 2
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 2
+	cmp		ax, 0
+	jg		WHITE_02
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 2
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_03
+	WHITE_02:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_03:
+	inc		ix
+
+	pextrw		rax, xxTemp, 3
+	cmp			rax, 0
+	je			DEFECT_04
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 3
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 3
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 3
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 3
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 3
+	cmp		ax, 0
+	jg		WHITE_03
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 3
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_04
+	WHITE_03:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_04:
+	inc		ix
+
+	pextrw		rax, xxTemp, 4
+	cmp			rax, 0
+	je			DEFECT_05
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 4
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 4
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 4
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 4
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 4
+	cmp		ax, 0
+	jg		WHITE_04
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 4
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_05
+	WHITE_04:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+	
+DEFECT_05:
+	inc		ix
+
+	pextrw		rax, xxTemp, 5
+	cmp			rax, 0
+	je			DEFECT_06
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 5
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 5
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 5
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 5
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 5
+	cmp		ax, 0
+	jg		WHITE_05
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 5
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_06
+	WHITE_05:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_06:
+	inc		ix
+
+	pextrw		rax, xxTemp, 6
+	cmp			rax, 0
+	je			DEFECT_07
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 6
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 6
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 6
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 6
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 6
+	cmp		ax, 0
+	jg		WHITE_06
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 6
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_07
+	WHITE_06:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_07:
+	inc		ix
+
+	pextrw		rax, xxTemp, 7
+	cmp			rax, 0
+	je			DEFECT_08
+
+	
+	mov		[rrXoD+ 4*rrNoD], ix32
+	mov		[rrYoD+ 4*rrNoD], iy32
+	
+	pextrw	eax, xxSrc1, 7
+	mov		[rrSrcD+ 4*rrNoD], eax
+	pextrw	eax, xxCmp1, 7
+	mov		[rrCmpD+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneId
+	pextrw	eax, xxZId, 7
+	mov		dword ptr [rcx+ 4*rrNoD], eax
+	
+	mov		rcx, ZoneTh
+	pextrw	rbx, xxZTh, 7
+	mov		dword ptr[rcx+ 4*rrNoD], ebx
+
+	pextrw	rax, xxPeakS, 7
+	cmp		ax, 0
+	jg		WHITE_07
+	
+	mov		word ptr[rrToD+ 2*rrNoD], 0
+	pextrw	rax, xxPeakAbs, 7
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+
+	inc		rrNoD
+	
+	jmp		DEFECT_08
+	WHITE_07:
+	mov		word ptr[rrToD+ 2*rrNoD], 1
+	sub		rax, rbx
+	mov		word ptr[rrPoD+ 2*rrNoD], ax
+	inc		rrNoD
+
+DEFECT_08:
+	inc		ix
+
+_return _XMM_COMPARE_TAIL
+
+
+_MAX_PIXEL_DEFECT:
+	mov		ix, InspRight
+	jmp		PAIRING_VERT
+
+
+PAIRING_VERT:
+;	JMP	_return_PAIRING_VERT
+	mov		iy, -1
+LOOP_PAIR_NUM:
+	inc		iy
+	cmp		iy, rrNoD
+	jge		LOOP_PAIR_NUM_END
+	
+	mov		rax, nPair
+	cmp		rax, MaxPair
+	jge		END_FUNC
+
+	movsx	rdx, word ptr [rrToD+ 2*iy]
+	cmp		rdx, 3			; check type DEFTYPE_NODEFECT= 3, DEFTYPE_DELETE= 4
+	jge		LOOP_PAIR_NUM
+
+
+	mov		rbx, iy
+	movsxd	rcx, dword ptr [rrYoD+ 4*iy]
+	mov		rax, rcx
+	add		rax, iPitchHUp
+;	mov		yPlusPitch, rax
+	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	
+
+	cmp		rcx, pairBottom
+	jg		PAIR_BOTTOM
+
+	cmp		rcx, pairTop
+	jge		PAIR_CENTER
+
+PAIR_TOP:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		PAIR_TOP_UNPAIR
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_TOP
+	jg		PAIR_TOP_UNPAIR
+
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_TOP
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_TOP ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 1
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+PAIR_TOP_UNPAIR:
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+
+	mov		(astPair ptr [rcx]).pos, 1
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	sub		rax, iPitchHUp
+	mov		(astPair ptr [rcx]).y, eax
+	movzx	edx, word ptr[rrToD+ 2*iy]
+	mov		(astPair ptr [rcx]).dtype, edx
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+	
+	
+PAIR_CENTER:
+	inc		rbx
+	cmp		rbx, rrNoD
+	jge		LOOP_PAIR_NUM
+
+	movsxd	rdx, dword ptr[rrYoD+ 4*rbx]			; Filter_1_Pair_YPosition
+	cmp		rdx, rax			; cmp	rdx, yPlusPitch
+	jl		PAIR_CENTER
+	jg		LOOP_PAIR_NUM
+
+;	movsxd	rrImgAddr, dword ptr[rrXoD+ 4*iy]				; Filter_2_Pair_XPosition
+	movsxd	rcx, dword ptr[rrXoD+ 4*rbx]
+	cmp		rrImgAddr, rcx
+	jne		PAIR_CENTER
+
+	movzx	rrImgAddr, word ptr[rrToD+ 2*rbx]		; Filter_3_TYPE_DELETE
+	cmp		rrImgAddr, 3
+	jge		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 (+-1)肺 官拆 版快 官哺具 茄促.
+
+	mov		ax, word ptr[rrToD+ 2*iy]				; Filter_4_TYPE_PAIR
+	cmp		ax, rwImgAddr
+	je		LOOP_PAIR_NUM				; jge	PAIR_CENTER ;Filte_1_狼 炼扒捞 官拆 版快 官哺具 茄促.
+
+
+	mov		word ptr [rrToD+ 2*rbx], 4
+
+	mov		rax, PairAddr
+	
+	mov		(astPair ptr [rax]).pos, 2
+	mov		(astPair ptr [rax]).pair, 1
+	mov		(astPair ptr [rax]).x, ecx
+	mov		(astPair ptr [rax]).y, edx
+	mov		(astPair ptr [rax]).dtype, rdImgAddr
+	movsx	edx, word ptr[rrPoD+ 2*rbx]
+	mov		(astPair ptr [rax]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*rbx]
+	mov		(astPair ptr [rax]).src, edx
+	mov		edx, [rrCmpD+ 4*rbx]
+	mov		(astPair ptr [rax]).ref, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*rbx]
+	mov		(astPair ptr [rax]).thre, edx
+
+	add		rax, PairSize
+	mov		PairAddr, rax
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+PAIR_BOTTOM:	; 菊俊辑 pairing捞 登瘤 臼栏搁 歹捞惑 pairing 且 荐 绝促. 公炼扒 unpair捞促.
+	cmp		bUseUnpair, 1
+	jne		LOOP_PAIR_NUM
+
+	mov		rcx, PairAddr
+	mov		(astPair ptr [rcx]).pos, 3
+	mov		(astPair ptr [rcx]).pair, 5
+	mov		(astPair ptr [rcx]).x, rdImgAddr
+	mov		(astPair ptr [rcx]).y, eax
+
+	inc		edx
+	and		edx, 1
+	mov		(astPair ptr [rcx]).dtype, edx
+
+	movsx	edx, word ptr[rrPoD+ 2*iy]
+	mov		(astPair ptr [rcx]).peak, edx
+	
+	mov		edx, [rrSrcD+ 4*iy]
+	mov		(astPair ptr [rcx]).ref, edx
+	mov		edx, [rrCmpD+ 4*iy]
+	mov		(astPair ptr [rcx]).src, edx
+	mov		rdx, ZoneId
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).zone, edx
+	mov		rdx, ZoneTh
+	mov		edx, [rdx+ 4*iy]
+	mov		(astPair ptr [rcx]).thre, edx
+
+	add		rcx, PairSize
+	mov		PairAddr, rcx
+	inc		nPair
+	jmp		LOOP_PAIR_NUM
+
+LOOP_PAIR_NUM_END:
+	mov		rrNoD, 0
+	jmp		_return_PAIRING_VERT
+
+
+END_FUNC:
+
+	add		ix32, 10h
+	mov		rax, endLine
+	mov		[rax], ix32
+
+	mov		rax, nPair					; return rrNoD
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+	pop		r15
+	pop		r14
+	pop		r13
+	pop		r12
+	pop		r11
+	pop		r10
+;	pop		rbp
+
+RET
+ConvZoneVertMS ENDP
+; Function End	----------------------------------ConvZoneVert2--------
+
+end
diff --git a/Common_Class/SISAssem/Header/ASGInspection.h b/Common_Class/SISAssem/Header/ASGInspection.h
new file mode 100644
index 0000000..c5764a2
--- /dev/null
+++ b/Common_Class/SISAssem/Header/ASGInspection.h
@@ -0,0 +1,43 @@
+#if !defined(__ASGINSPECTION_INCLUDED__)
+#define __ASGINSPECTION_INCLUDED__
+
+#include "AssemParam.h"
+#include "AssemDefect.h"
+
+class AFX_EXT_CLASS CASGInspection
+{
+	// Construction
+public:
+	CASGInspection();
+	virtual ~CASGInspection();
+
+public:
+	void			SetPixelBuf(int *pPixelX,int *pPixelY,short *pPixelType,short *pPixelValue,int *nPixelCnt)
+	{
+		m_pPixelX = pPixelX,m_pPixelY = pPixelY,m_pPixelType = pPixelType,m_pPixelValue = pPixelValue,m_nPixelCnt = nPixelCnt;
+	}
+	void			SetParingBuf(CDefectPair *pDefectPair,int nParingCnt)
+	{
+		m_pDefectParing = pDefectPair,m_nDefectParingCnt=nParingCnt;
+	}
+	int				GetParingCnt(){return m_nDefectParingCnt;}
+
+	void			VConvolutionConvC(CConvParam *pParam);
+
+protected:
+	BOOL			GetBufferCheck();
+	void			SetPixelData(int x, int y, int sub, int threshold);
+	BOOL			InsertPairing(int x, int y, int sub, int threshold, int graySrc, int grayRef);
+	CRITICAL_SECTION	m_csDefect;
+protected:
+	int				*m_pPixelX;
+	int				*m_pPixelY;
+	short			*m_pPixelType;
+	short			*m_pPixelValue;
+	int				*m_nPixelCnt;
+	CDefectPair		*m_pDefectParing;
+	int				m_nDefectParingCnt;
+
+};
+
+#endif
\ No newline at end of file
diff --git a/Common_Class/SISAssem/Header/AssemDefect.h b/Common_Class/SISAssem/Header/AssemDefect.h
new file mode 100644
index 0000000..5d59c87
--- /dev/null
+++ b/Common_Class/SISAssem/Header/AssemDefect.h
@@ -0,0 +1,467 @@
+#pragma once
+
+enum DefectKind {DK_BM, DK_PATTERN};
+enum DefectType {DEFTYPE_BLACK = 0, DEFTYPE_WHITE, DEFTYPE_MIXED, DEFTYPE_NODEFECT, DEFTYPE_DELETE};
+enum DefectPos	{DEFPOS_NONE = 0, DEFPOS_LEFT, DEFPOS_CENTER, DEFPOS_RIGHT, CRACKPOS_EDGELINE,CRACKPOS_SPOTLINE};
+enum DefectPair	{DEFPAIR_NOTDEFINE = 0, DEFPAIR_PPAIR, DEFPAIR_MPAIR, DEFPAIR_SIDE, DEFPAIR_LARGE, DEFPAIR_UNPAIR };
+
+
+typedef		int		DIT_RESULT;
+#define		DIT_CONV_SUCCESS			0x01		// 沥惑 荐青.
+#define		DIT_CONV_CALLINGVIOLATION	0x02		// 窃荐 龋免 例瞒啊 肋给登菌促.
+#define		DIT_CONV_PARAMMODEFAIL		0x04
+#define		DIT_CONV_INVALIDPARAM		0x08		// 棵官福瘤 臼篮 窃荐 Parameter.
+#define		DIT_CONV_FRAMEOVERFLOW		0x10		// 茄 Frame俊 搬窃捞 10000 Pixel 捞惑捞促.
+#define		DIT_CONV_GLASSOVERFLOW		0x20		// 茄 Thread啊 Blob茄 搬窃捞 10000 俺 捞惑捞促.
+#define		DIT_CONV_RSLT_RECT_SMALL	0x40		// 八荤康开(Rect)啊 乔摹 3硅焊促 累促.剧规氢葛滴
+#define		DIT_CONV_USER				0x80		// Not_Defined...
+#define		DIT_CONV_RESULT_COUNT		8			// 搬苞 辆幅狼 俺荐, 亲惑 弥措 荐啊 登绢具 茄促.
+
+//////////////////////////////////////////////////////////////////////////
+// Processing Option (急琶等 亲格俊 蝶扼 Processing 咯何甫 眉农茄促.)
+#define		DIT_CONV_CONVOLUTION		1
+#define		DIT_CONV_PPAIRING			2
+#define		DIT_CONV_MPAIRING			4
+#define		DIT_CONV_BLOBING			8
+#define		DIT_CONV_CLASSIFY			16
+#define		DIT_CONV_MERGE_DIVISION		32
+#define		DIT_CONV_MERGE_MIX			64
+#define		DIT_CONV_UNPAIRBLOB			128
+
+#define		DIT_CONV_ALL_SKIPMERGE		31
+#define		DIT_CONV_ALL_MERGEDIVISION	63
+#define		DIT_CONV_ALL_MERGEMIX		95
+
+//////////////////////////////////////////////////////////////////////////
+// 弥措 倾侩 搬窃 荐.
+#define		MAX_DEFECTPIX_NUM			10000
+#define		MAX_DEFECTBLOB_NUM			10000
+#define		MAX_ZONE_NUM				16
+
+#define		VERT_CELLCENTER			0
+#define		VERT_CELLSTART			1
+#define		VERT_CELLEND			2
+
+
+
+
+class AFX_EXT_CLASS CConvResult
+{
+public:
+	int			m_nThreadDefectPixelNum;
+	int			m_nThreadDefectNum;
+	int			m_nSkipUnpaired;
+	int			m_nSkipClassify;
+	int			m_nMoveClassify;
+	int			m_nSkipMerged;
+
+	CConvResult()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_nThreadDefectPixelNum	= 0;
+		m_nThreadDefectNum		= 0;
+		m_nSkipUnpaired			= 0;
+		m_nSkipClassify			= 0;
+		m_nMoveClassify			= 0;
+		m_nSkipMerged			= 0;
+	}
+};
+
+class AFX_EXT_CLASS CDefectPair
+{
+public:
+	DefectPos	s_DefectPos;
+	DefectPair	s_DefectPair;
+	DefectType	s_DefectType;
+	int			s_fDefectPeak;
+	int			s_nDefectX;
+	int			s_nDefectY;
+	int			s_nGraySrc;
+	int			s_nGrayRef;
+	int			s_nZone;
+	int			s_nThresold;
+
+	CDefectPair()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		s_DefectPos = DEFPOS_NONE;
+		s_DefectPair = DEFPAIR_NOTDEFINE;
+		s_DefectType = DEFTYPE_NODEFECT;
+		s_fDefectPeak = 0;
+		s_nDefectX = 0;
+		s_nDefectY = 0;
+		s_nGraySrc = 0;
+		s_nGrayRef = 0;
+		s_nZone= 0;
+		s_nThresold= 0;
+	}
+	void SetPeak(int nPeak, int nKernelThres, int nCalcPixel)
+	{
+		s_fDefectPeak= (abs(nPeak));
+		s_fDefectPeak -= (nKernelThres);
+		s_fDefectPeak /= (nCalcPixel);
+	}
+
+	// 汗荤 积己磊.
+	CDefectPair(const CDefectPair& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_DefectPos			= rhs.s_DefectPos;
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_fDefectPeak		= rhs.s_fDefectPeak;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nGraySrc			= rhs.s_nGraySrc;
+			s_nGrayRef			= rhs.s_nGrayRef;
+			s_nZone				= rhs.s_nZone;
+			s_nThresold			= rhs.s_nThresold;
+		}
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+	CDefectPair& operator=(const CDefectPair& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_DefectPos			= rhs.s_DefectPos;
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_fDefectPeak		= rhs.s_fDefectPeak;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nGraySrc			= rhs.s_nGraySrc;
+			s_nGrayRef			= rhs.s_nGrayRef;
+			s_nZone				= rhs.s_nZone;
+			s_nThresold			= rhs.s_nThresold;
+		}
+		return *this;
+	}
+
+};
+
+class AFX_EXT_CLASS CDefectBlob
+{
+public:
+	DefectPos	s_DefectPos;
+	DefectPair	s_DefectPair;
+	DefectType	s_DefectType;
+	int			s_nIndex;
+	int			s_nDefectArea;
+	int			s_nPadRegionIdx;
+	int			s_nDefectX;
+	int			s_nDefectY;
+	int			s_xMaxPeak;
+	int			s_yMaxPeak;
+	int			s_xLevelSrcMax;
+	int			s_yLevelSrcMax;
+	int			s_nDefectRScale;
+	CRect		s_DefectRect;
+	short		s_sDefectPeak;
+
+	short		s_sLevelSrcMin;
+	short		s_sLevelSrcMax;
+	short		s_sLevelSrcAvg;
+	short		s_sLevelRefMin;
+	short		s_sLevelRefMax;
+	short		s_sLevelRefAvg;
+	short		s_sLevelDiffMin;
+	short		s_sLevelDiffMax;
+	short		s_sLevelDiffAvg;
+	int			s_nLevelSrcSum;
+	int			s_nLevelRefSum;
+	int			s_nLevelDiffSum;
+	//公霸吝缴狼 Gray 沥焊 -辣沥刮-
+	short		s_sCMSrcMin;
+	short		s_sCMSrcMax;
+	short		s_sCMSrcAvg;
+	short		s_sCMRefMin;
+	short		s_sCMRefMax;
+	short		s_sCMRefAvg;
+
+	short		s_sThreshold;
+	short		s_sThresholdAvg;
+	int			s_nThresholdSum;
+
+	short		s_sZonePixelCount[MAX_ZONE_NUM];
+	short		s_sZoneValueMin[MAX_ZONE_NUM];
+	BYTE		s_sZoneValueMax[MAX_ZONE_NUM];
+	int			s_sZoneValueSum[MAX_ZONE_NUM];
+
+	int			s_nRegionType;
+	BOOL		s_bRemoved;
+
+
+	CPoint		s_ptVertex[8];
+
+	CDefectBlob()
+	{
+		Reset();
+	}
+	void ResetReuse()
+	{
+		s_DefectRect.SetRect(INT_MAX, INT_MAX, 0, 0);
+		for (int i = 0; i < MAX_ZONE_NUM; i++)
+		{
+			s_sZonePixelCount[i] = 0;
+			s_sZoneValueMin[i] = 256;
+			s_sZoneValueMax[i] = 0;
+			s_sZoneValueSum[i] = 0;
+		}
+		s_ptVertex[0]		= MAKELONG(32760, 32760);
+		s_ptVertex[1]		= MAKELONG(32760, 0);
+		s_ptVertex[2]		= MAKELONG(32760, 32760);
+		s_ptVertex[3]		= MAKELONG(0, 32760);
+		s_ptVertex[4]		= MAKELONG(0, 32760);
+		s_ptVertex[5]		= MAKELONG(0, 0);
+		s_ptVertex[6]		= MAKELONG(32760, 0);
+		s_ptVertex[7]		= MAKELONG(0, 0);
+
+		s_bRemoved			= FALSE;
+	}
+	void Reset()
+	{
+		s_DefectPos			= DEFPOS_NONE;
+		s_DefectPair		= DEFPAIR_NOTDEFINE;
+		s_DefectType		= DEFTYPE_NODEFECT;
+		s_nIndex			= 0;
+		s_nDefectArea		= 0;
+		s_nPadRegionIdx		= -1;
+		s_nDefectX			= 0;
+		s_nDefectY			= 0;
+		s_nDefectRScale		= 0;
+		// 20080525 捞霖锐
+		s_DefectRect.SetRect(INT_MAX, INT_MAX, 0, 0);
+		s_sDefectPeak		= 0;
+
+		s_sLevelSrcMin		= 2048;
+		s_xMaxPeak			= -1;
+		s_yMaxPeak			= -1;
+		s_sLevelSrcMax		= 0;
+		s_xLevelSrcMax		= 0;
+		s_yLevelSrcMax		= 0;
+		s_sLevelSrcAvg		= 0;
+		s_sLevelRefMin		= 2048;
+		s_sLevelRefMax		= 0;
+		s_sLevelRefAvg		= 0;
+		s_sLevelDiffMin		= 2048;
+		s_sLevelDiffMax		= 0;
+		s_sLevelDiffAvg		= 0;
+		s_nLevelSrcSum		= 0;
+		s_nLevelRefSum		= 0;
+		s_nLevelDiffSum		= 0;
+
+		s_sThreshold		= 0;
+		s_sThresholdAvg		= 0;
+		s_nThresholdSum		= 0;
+
+		for (int i = 0; i < MAX_ZONE_NUM; i++)
+		{
+			s_sZonePixelCount[i] = 0;
+			s_sZoneValueMin[i] = 256;
+			s_sZoneValueMax[i] = 0;
+			s_sZoneValueSum[i] = 0;
+		}
+
+		s_nRegionType		= -1;
+
+		// 20080525 捞霖锐
+		s_ptVertex[0]		= MAKELONG(32760, 32760);
+		s_ptVertex[1]		= MAKELONG(32760, 0);
+		s_ptVertex[2]		= MAKELONG(32760, 32760);
+		s_ptVertex[3]		= MAKELONG(0, 32760);
+		s_ptVertex[4]		= MAKELONG(0, 32760);
+		s_ptVertex[5]		= MAKELONG(0, 0);
+		s_ptVertex[6]		= MAKELONG(32760, 0);
+		s_ptVertex[7]		= MAKELONG(0, 0);
+
+		s_bRemoved			= FALSE;
+	}
+	void SetDefectPos(DefectPos	DP)
+	{
+		// 2012.1.26 : Center 搬窃 快急. 
+		if (s_DefectPos == DEFPOS_NONE)
+			s_DefectPos = DP;
+		else if (s_DefectPos == DEFPOS_CENTER)//DP == DEFPOS_LEFT || DP == DEFPOS_RIGHT)
+			return;
+		s_DefectPos = DP;
+	}
+
+	void SetDefectPair(DefectPair DP)
+	{
+		// 2012.1.26 : Pair 搬窃 快急栏肺 荐沥. mosis
+		if (s_DefectPair > DP)
+			s_DefectPair = DP;
+	}
+
+
+	// 措涝楷魂磊 坷滚肺爹.
+	CDefectBlob& operator=(const CDefectBlob& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_DefectPos			= rhs.s_DefectPos;
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_nIndex			= rhs.s_nIndex;
+			s_nDefectArea		= rhs.s_nDefectArea;
+			s_nPadRegionIdx		= rhs.s_nPadRegionIdx;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nDefectRScale		= rhs.s_nDefectRScale;
+			s_DefectRect		= rhs.s_DefectRect;
+			s_sDefectPeak		= rhs.s_sDefectPeak;
+
+			s_sLevelSrcMin		= rhs.s_sLevelSrcMin;
+			s_sLevelSrcMax		= rhs.s_sLevelSrcMax;
+			s_xMaxPeak			= rhs.s_xMaxPeak;
+			s_yMaxPeak			= rhs.s_yMaxPeak;
+			s_xLevelSrcMax		= rhs.s_xLevelSrcMax;
+			s_yLevelSrcMax		= rhs.s_yLevelSrcMax;
+			s_sLevelSrcAvg		= rhs.s_sLevelSrcAvg;
+			s_sLevelRefMin		= rhs.s_sLevelRefMin;
+			s_sLevelRefMax		= rhs.s_sLevelRefMax;
+			s_sLevelRefAvg		= rhs.s_sLevelRefAvg;
+			s_sLevelDiffMin		= rhs.s_sLevelDiffMin;
+			s_sLevelDiffMax		= rhs.s_sLevelDiffMax;
+			s_sLevelDiffAvg		= rhs.s_sLevelDiffAvg;
+			s_nLevelSrcSum		= rhs.s_nLevelSrcSum;
+			s_nLevelRefSum		= rhs.s_nLevelRefSum;
+			s_nLevelDiffSum		= rhs.s_nLevelDiffSum;
+
+			s_sThreshold		= rhs.s_sThreshold;
+			s_sThresholdAvg		= rhs.s_sThresholdAvg;
+
+			int i;
+#define MOSIS_EDIT_VERTEX
+			for(i= 0; i< 8; i++)
+			{
+				s_ptVertex[i]= rhs.s_ptVertex[i];
+			}
+
+			for (i = 0; i < MAX_ZONE_NUM; i++)
+			{
+				s_sZonePixelCount[i] = rhs.s_sZonePixelCount[i];
+				s_sZoneValueMin[i] = rhs.s_sZoneValueMin[i];
+				s_sZoneValueMax[i] = rhs.s_sZoneValueMax[i];
+				s_sZoneValueSum[i] = rhs.s_sZoneValueSum[i];
+			}
+			s_nRegionType		= rhs.s_nRegionType;
+			s_bRemoved			= rhs.s_bRemoved;
+		}
+		return *this;
+	}
+
+	void MergeBlob(const CDefectBlob& rhs)
+	{
+		if (s_DefectPos == DEFPOS_NONE)
+			s_DefectPos = rhs.s_DefectPos;
+		else if (rhs.s_DefectPos == DEFPOS_LEFT || rhs.s_DefectPos == DEFPOS_RIGHT)
+			s_DefectPos = rhs.s_DefectPos;
+
+		if (s_DefectPair < rhs.s_DefectPair)
+			s_DefectPair = rhs.s_DefectPair;
+
+		//公霸吝缴栏肺 搬窃谅钎 魂免 20140207 lmk
+		s_nDefectX = (s_nDefectX * s_nDefectArea + rhs.s_nDefectX * rhs.s_nDefectArea);
+		s_nDefectY = (s_nDefectY * s_nDefectArea + rhs.s_nDefectY * rhs.s_nDefectArea);
+		s_nDefectArea += rhs.s_nDefectArea;
+		s_nDefectX /= s_nDefectArea;
+		s_nDefectY /= s_nDefectArea;
+
+		//扁粮搬窃谅钎
+		//滚弊, 角钠 公霸吝缴 备秦初绊 付瘤阜俊 泛飘肺 搬窃谅钎甫 备茄促.
+		//窍瘤父 弊付历档 钦摹扁 傈狼 泛飘狼 吝缴谅钎肺 备窍扁 锭巩俊 钧蹲茄 镑捞 搬窃谅钎啊 等促.
+		//s_nDefectArea += rhs.s_nDefectArea;
+		//s_nDefectX = (s_DefectRect.right + s_DefectRect.left) / 2;
+		//s_nDefectY = (s_DefectRect.bottom + s_DefectRect.top) / 2;
+
+		if (s_ptVertex[0].x >= rhs.s_ptVertex[0].x)	// LT
+			s_ptVertex[0] = rhs.s_ptVertex[0];
+		if (s_ptVertex[1].x >= rhs.s_ptVertex[1].x)	// LB
+			s_ptVertex[1] = rhs.s_ptVertex[1];
+		if (s_ptVertex[2].y >= rhs.s_ptVertex[2].y)	// TL
+			s_ptVertex[2] = rhs.s_ptVertex[2];
+		if (s_ptVertex[3].y >= rhs.s_ptVertex[3].y)	// TR
+			s_ptVertex[3] = rhs.s_ptVertex[3];
+		if (s_ptVertex[4].x <= rhs.s_ptVertex[4].x)	// RT
+			s_ptVertex[4] = rhs.s_ptVertex[4];
+		if (s_ptVertex[5].x <= rhs.s_ptVertex[5].x)	// RB
+			s_ptVertex[5] = rhs.s_ptVertex[5];
+		if (s_ptVertex[6].y <= rhs.s_ptVertex[6].y)	// BL
+			s_ptVertex[6] = rhs.s_ptVertex[6];
+		if (s_ptVertex[7].y <= rhs.s_ptVertex[7].y)	// BR
+			s_ptVertex[7] = rhs.s_ptVertex[7];
+
+		s_nDefectRScale = (s_nDefectRScale + rhs.s_nDefectRScale);
+		if (s_DefectRect.left > rhs.s_DefectRect.left)
+			s_DefectRect.left = rhs.s_DefectRect.left;
+		if (s_DefectRect.top > rhs.s_DefectRect.top)
+			s_DefectRect.top = rhs.s_DefectRect.top;
+		if (s_DefectRect.right < rhs.s_DefectRect.right)
+			s_DefectRect.right = rhs.s_DefectRect.right;
+		if (s_DefectRect.bottom < rhs.s_DefectRect.bottom)
+			s_DefectRect.bottom = rhs.s_DefectRect.bottom;
+
+		//公霸吝缴捞 酒囱 搬窃泛飘狼 吝缴栏肺 搬窃谅钎甫 魂免且妨搁 咯扁林籍阑钱磊
+		//s_nDefectX = (s_DefectRect.right + s_DefectRect.left) / 2;
+		//s_nDefectY = (s_DefectRect.bottom + s_DefectRect.top) / 2;
+
+		if (s_sDefectPeak < rhs.s_sDefectPeak)
+		{
+			s_sDefectPeak		= rhs.s_sDefectPeak;
+			s_xMaxPeak			= rhs.s_xMaxPeak;
+			s_yMaxPeak			= rhs.s_yMaxPeak;
+		}
+
+		if (s_sLevelSrcMin > rhs.s_sLevelSrcMin)
+			s_sLevelSrcMin		= rhs.s_sLevelSrcMin;
+		if (s_sLevelSrcMax < rhs.s_sLevelSrcMax)
+		{
+			s_sLevelSrcMax		= rhs.s_sLevelSrcMax;
+			s_xLevelSrcMax		= rhs.s_xLevelSrcMax;
+			s_yLevelSrcMax		= rhs.s_yLevelSrcMax;
+		}
+		if (s_sLevelRefMin > rhs.s_sLevelRefMin)
+			s_sLevelRefMin		= rhs.s_sLevelRefMin;
+		if (s_sLevelRefMax < rhs.s_sLevelRefMax)
+			s_sLevelRefMax		= rhs.s_sLevelRefMax;
+		if (s_sLevelDiffMin > rhs.s_sLevelDiffMin)
+			s_sLevelDiffMin		= rhs.s_sLevelDiffMin;
+		if (s_sLevelDiffMax < rhs.s_sLevelDiffMax)
+			s_sLevelDiffMax		= rhs.s_sLevelDiffMax;
+
+		s_nLevelSrcSum		+= rhs.s_nLevelSrcSum;
+		s_nLevelRefSum		+= rhs.s_nLevelRefSum;
+		s_nLevelDiffSum		+= rhs.s_nLevelDiffSum;
+		s_nThresholdSum		+= rhs.s_nThresholdSum;
+
+		s_sLevelSrcAvg			= s_nLevelSrcSum / s_nDefectArea;
+		s_sLevelRefAvg			= s_nLevelRefSum / s_nDefectArea;
+		s_sLevelDiffAvg			= s_nLevelDiffSum / s_nDefectArea;
+		s_sThresholdAvg			= s_nThresholdSum / s_nDefectArea;
+
+		if (s_sThreshold < rhs.s_sThreshold)
+			s_sThreshold		= rhs.s_sThreshold;
+
+		for (int i = 0; i < MAX_ZONE_NUM; i++)
+		{
+			s_sZonePixelCount[i] = s_sZonePixelCount[i] + rhs.s_sZonePixelCount[i];
+			s_sZoneValueMin[i] = min(s_sZoneValueMin[i],rhs.s_sZoneValueMin[i]);
+			s_sZoneValueMax[i] = max(s_sZoneValueMax[i],rhs.s_sZoneValueMax[i]);
+			s_sZoneValueSum[i] = (s_sZoneValueSum[i]+rhs.s_sZoneValueSum[i]);
+		}
+
+	}
+	void CreateBlob(CDefectPair *pPair, int id);
+	void IncludePair(CDefectPair *pPair);
+	void CheckDefectRect(int nX, int nY);
+};
+
diff --git a/Common_Class/SISAssem/Header/AssemParam.h b/Common_Class/SISAssem/Header/AssemParam.h
new file mode 100644
index 0000000..4676b8a
--- /dev/null
+++ b/Common_Class/SISAssem/Header/AssemParam.h
@@ -0,0 +1,319 @@
+#pragma once
+
+#include "Pad.h"
+#include "AssemDefect.h"
+
+
+enum ConvMode		{ ConvMode_Float = 0, ConvMode_Pixel, ConvMode_Binalize };
+enum ConvDir		{ ConvDir_Hori= 0, ConvDir_Vert= 1, ConvDir_Double= 2};
+
+#define		MAX_DEAD_ZONE_COUNT		10
+
+class AFX_EXT_CLASS CConvParam
+{
+public:
+	virtual ~CConvParam() {}
+
+public:
+	// 1.1. 八荤 规过 包访
+	ConvMode	m_ConvMode;		// 0 = ConvFloat(2*2), 1 = ConvPixel(1*1)
+	int			m_ConvDir;		// 0 = Horizontal, 1= Vertical, 2, Hori and Vert
+	int			m_ReinspectCount;		// Frame Overflow矫 犁八荤 雀荐
+	BOOL		m_bZone2B2;				// Zone 2 By 2 八荤
+	BOOL		m_bIntrinsic;
+	BOOL		m_bSkipBlock;			// 捞屈伎.
+
+	// 1.2. 八荤 捞固瘤 沥焊
+	LPBYTE		s_lpBuffer;				// * 八荤且 滚欺
+	int			s_nFrameWidth;			// * 八荤 捞固瘤 承捞
+	int			s_nFrameHeight;			// * 八荤 捞固瘤 臭捞.
+
+	// 1.3. 八荤 康开 沥焊.
+	CTrapezium	m_Trapezium;			// 荤促府裁 八荤 康开
+	CRect		s_RectConv;				// * 滚欺俊辑 楷魂且 荤阿屈
+	CRect		s_RectFilter;			// * 滚欺俊辑 鞘磐傅俊 静老 荐 乐绰 荤阿屈(盔贰 伎农扁 殿 啊瓷)
+	CRect		s_RectDeadZone[MAX_DEAD_ZONE_COUNT];
+
+	// 1.5. Convolution 沥焊.
+	int			s_nConvWidth;			// * 八荤 窜困 承捞
+	int			s_nConvHeight;			// * 八荤 窜困 臭捞
+
+	double		s_dPitchConvReal;		// * 八荤 乔摹
+	int			s_nPitchCycleConv;		// 茄 伎狼 乔摹
+	double		s_dPitchScanReal;		// * 八荤 乔摹
+	int			s_nPitchCycleScan;		// 茄 伎狼 乔摹
+
+	float		m_fTilt;				// tilt 蔼. 
+
+	// 1.6. 巩盼蔼 沥焊.
+	int			s_nThreshold;			// * 皋牢 巩盼蔼
+	int			s_nDThSlide;		// Dynamic Threshold 扁匡扁
+	int			s_nThresholdSupress;	// Suppress 巩盼蔼.
+	int			s_nSideThreshold;		// 谅/快/Unpair 八荤 巩盼蔼
+	int			s_nBWB_Main;		// Black 搬窃 绢祭俊辑狼 鞘磐傅 DTh(ConvPixel VertSBW, VTDSBW父 备泅), 0捞搁 救靖.
+	int			s_nBWB_Slide;		// Black 搬窃 绢祭俊辑狼 鞘磐傅 DTh(ConvPixel VertSBW, VTDSBW父 备泅)
+
+	// 1.7. 八荤 Process 沥焊.
+	BOOL		m_bEchoConvolution;	// 楷魂 加档 何练栏肺 绢祭 郴何俊辑 Thread 盒且 八荤 咯何.
+	BOOL		m_bVertSpeedup;		// Pixel苞 Zone 加档 何练栏肺 八荤 风凭狼 皋葛府 犁秦籍 咯何
+	BOOL		m_bSelectiveDir;	// 楷魂 规氢俊辑 3乔摹 何练矫 楷魂规氢阑 cross 规氢栏肺 函版饶 八荤 且瘤 咯何.
+	BOOL		m_bUseUnpair;			// Left客 Right狼 Unpair 搬窃阑 Assem狼 Pairing 窜拌俊辑 惶酒 晨(TRUE) or 滚覆(FALSE). 扁夯 TRUE;
+	BOOL		s_bReverseFilter;		// ReverseFilter 荤侩 咯何
+	int			m_EdgeFilterTh;			// 伎 Edge 康开俊辑 窜林扁 鞘磐 利侩且 荐 绝绰 备埃阑 困茄 眠啊 Th
+
+	// 1.8. Dynamic Pitch 沥焊
+	int			*m_pPitch16;	// pitch甫 16硅 秦辑 subpixel鳖瘤 钎泅, Trapezium捞寇狼 Rect俊辑绰 Vertical 规氢捞促.
+	short		*m_pPitch;		// Dynamic Pitch. Horizontal 规氢捞绊
+	short		*m_pfSPR;		// Dynamic Pitch. Horizontal 规氢捞绊, Sub Pixel
+	short		*m_psSPR;		// Dynamic Pitch. Horizontal 规氢捞绊, Sub Pixel
+	BOOL		m_bUseDPC;
+
+	// 1.7. Zone Threshold 八荤 沥焊
+	BOOL		m_bZoneMulti;			// Zone Multi Threshold 八荤 利侩 急琶.
+	short*		s_psZoneTable;				// Zone喊 Thresholding阑 困茄 Index Table
+	short*		s_psZoneThTable;			// Zone喊 Thresholding阑 困茄 Threshold Table
+	short*		s_psZoneAddTable;			// Zone喊 Thresholding阑 困茄 DynamicThreshold Table
+	short*		s_psZoneMThTable;		// 2吝 ZoneThreshold狼 滴锅掳 Base Threshold
+	short*		s_psZoneMAddTable;		// 2吝 ZoneThreshold狼 滴锅掳 Threshold Slope
+	short*		s_psZoneMMinTable;			// 2吝 ZoneThreshold狼 2锅掳 流急阑 困茄 烙拌摹(侨伎 灌扁), 2吝 ZoneThreshold利侩 咯何狼 备盒磊 开且档 扳窃.
+	int			s_nThresTableWidth;		// Threshold Table 承捞
+	int			s_nThresTableHeight;	// Threshold Table 臭捞
+	int			s_nThresTableStartX;	// X绵 矫累 Offset
+	int			s_nThresTableStartY;	// Y绵 矫累 Offset
+	void*		m_pGammaTable;			// Zone Threshold 滴锅掳 滚傈栏肺 概莫 抛捞喉 沥焊 焊包.
+	int			m_nGammaXCount;			// Gamma Table狼 X, Y 硅凯狼 X绵 概莫器捞飘 墨款飘(俺荐)
+	int			s_nZoneCycleConv;		// Zone Reference 捞固瘤狼 扁夯林扁 硅荐
+	int			s_nZoneCycleScan;		// Zone Reference 捞固瘤狼 扁夯林扁 硅荐
+	int*		m_pFilterThBlack;
+	int*		m_pFilterThBlack2;
+	int*		m_pFilterThWhite;
+	int*		m_pFilterThWhite2;
+	int*		m_pSpeedZoneTh;
+	int*		m_pSpeedZoneThSlide;
+
+
+	int			GetFilterThreshold(int iZone, int pixel, DefectType Type)
+	{
+		if(Type == DEFTYPE_WHITE)
+			return ((m_pFilterThWhite2[iZone]*pixel)>>8)+ m_pFilterThWhite[iZone];
+
+		return ((m_pFilterThBlack2[iZone]*pixel)>>8)+ m_pFilterThBlack[iZone];
+	}
+
+
+	//==================================
+	// Assem 捞 场抄 饶贸府客 包访等 沥焊.
+
+	// 2.1.  搬窃 包府 沥焊.
+	int			s_nFrameDefPixLimit;	// 茄 Frame俊辑狼 弥措 搬窃 侨伎 荐
+	int			s_nFrameDefBlobLimit;	// 茄 Frame俊辑狼 弥措 搬窃 荐
+
+	// 2.2. 侨伎 窜拌 鞘磐傅 沥焊.
+	BOOL		m_bUsePixelFilter;		// Pixel窜拌俊辑 鞘磐傅阑 且 巴牢啊 富 巴牢啊?
+	BOOL		m_bUseMarginFilter;		//
+	BOOL		m_bOnlyJumpFilter;		// 八荤 绵狼 Cross 规氢栏肺 鞘磐傅 绝捞 JumpFiltering父 且 巴牢啊 .or. CrossFilter甫 且 巴牢啊.
+	BOOL		m_bPairFilter;			// Pair 搬窃俊档 Cross&Jump 鞘磐 利侩.
+	
+	// 2.2 Zone Measure Filter // 漂沥 粮俊 措秦 固技 康开 犁 概莫饶 促矫 八荤 鞘磐 利侩.
+	BOOL		m_bTiltFilter;
+ 
+	// 2.3. 饶贸府 沥焊.
+	int			m_nDefectMergePixel;	// 叼棋 赣瘤 荤捞令
+
+	// 2.4. Zone Sorting, Thresholding
+	BYTE*		s_pZoneData;			// Zone Sort Table
+	BYTE*		s_pZoneThreshold;		// Zone Threshold Table
+	int			s_nZoneDataWidth;		// Zone Sort Table 承捞
+	int			s_nZoneBufferWidth;		// Zone Data 滚欺狼 捞固瘤 滚欺 农扁.
+	int			s_nZoneDataHeight;		// Zone Sort Table 臭捞
+
+	// 2.5. 搬窃 沥焊 啊傍 沥焊.
+	double		s_dScanResolution;		// Scan Resolution
+	double		s_dConvResolution;		// Conv Resolution
+
+
+
+	//======================================
+	// 99. 救 静瘤父 俺充惑 瘤快瘤 臼阑 巴甸.
+	short		s_sSkipSave;			// 八荤 饶 捞固瘤 历厘 咯何
+	UINT		s_uiProcessing;			// * 八荤 规过
+	int			s_nRegionType;			// 康开 - 汲沥等 蔼阑 搬窃俊 静扁 困窃
+
+	// 技牧八荤 Param
+	BOOL		s_bUse2ndInspection;
+	int			s_n2ndThres;
+	int			s_n2ndThresSlide;
+	double		s_d2ndPitch;
+
+
+	// Add by PJH
+	int			s_nASGDynamicHi;
+	int			s_nASGDynamicLow;
+
+	// 99. 扁鸥 棱促备府
+	// 200090612 size choigudal
+	BOOL		s_bUseTrimmer;
+	int			s_nTrimmerWidth;
+	int			s_nTrimmerHeight;
+
+
+   // 20150811 芭措 CS
+	int			m_nCSThres[MAX_ZONE_NUM];
+	int			m_nOriThres[MAX_ZONE_NUM];
+
+	CConvParam()
+	{
+		Reset();
+	}
+
+	double	GetRealConvPitch(){return s_dPitchConvReal*s_nPitchCycleConv;}
+	double	GetRealScanPitch(){return s_dPitchScanReal*s_nPitchCycleScan;}
+	double	GetZoneConvPitch(){return s_dPitchConvReal*s_nZoneCycleConv;}
+	double	GetZoneScanPitch(){return s_dPitchScanReal*s_nZoneCycleScan;}
+
+	void Reset()
+	{
+		// 1.1. 八荤 规过 包访
+		m_ConvMode					= ConvMode_Float;
+		m_ConvDir					= 0;
+		m_ReinspectCount			= 3;
+		m_bZone2B2					= FALSE;
+		m_bIntrinsic				= FALSE;
+		m_bSkipBlock				= FALSE;
+
+		// 1.2. 八荤 捞固瘤 沥焊
+		s_lpBuffer					= NULL;
+		s_nFrameWidth				= 0;
+		s_nFrameHeight				= 0;
+
+		// 1.3. 八荤 康开 沥焊.
+		s_RectConv.SetRect(0, 0, 0, 0);
+		s_RectFilter= s_RectConv;
+		for(int i = 0 ; i < MAX_DEAD_ZONE_COUNT; i++)
+			s_RectDeadZone[i].SetRectEmpty();
+
+		// 1.5. Convolution 沥焊.
+		s_nConvWidth				= 0;
+		s_nConvHeight				= 0;
+
+		s_dPitchConvReal			= 0.0;
+		s_nPitchCycleConv			= 0;
+		s_dPitchScanReal			= 0.0;
+		s_nPitchCycleScan			= 0;
+
+		m_fTilt						= 0.0;
+
+		// 1.6. 巩盼蔼 沥焊.
+		s_nThreshold				= 10;
+		s_nDThSlide					= 20;
+		s_nThresholdSupress			= 255;
+		s_nSideThreshold			= 0;
+		s_nBWB_Main					= 0;
+		s_nBWB_Slide				= 0;
+
+		// 1.7. 八荤 Process 沥焊.
+		m_bEchoConvolution			= TRUE;
+		m_bVertSpeedup				= TRUE;
+		m_bSelectiveDir				= FALSE;
+		m_bUseUnpair				= TRUE;
+		s_bReverseFilter			= FALSE;
+		m_EdgeFilterTh				= 0;
+
+		// 1.8. Dynamic Pitch 沥焊
+		m_pPitch16					= NULL;
+		m_pPitch					= NULL;
+		m_pfSPR						= NULL;
+		m_psSPR						= NULL;
+		m_bUseDPC					= TRUE;
+
+
+		// 1.9. Zone Threshold 八荤 沥焊
+		m_bZoneMulti				= FALSE;
+		s_psZoneTable				= NULL;	//0617 眠啊
+		s_psZoneThTable				= NULL;
+		s_psZoneAddTable			= NULL;
+		s_psZoneMThTable			= NULL;
+		s_psZoneMAddTable			= NULL;
+		s_psZoneMMinTable			= NULL;
+		s_nThresTableWidth			= 12000;
+		s_nThresTableHeight			= 1024;
+		s_nThresTableStartX			= 0;
+		s_nThresTableStartY			= 0;
+		m_pGammaTable				= NULL;
+		m_nGammaXCount				= 300;
+		s_nZoneCycleConv			= 1;
+		s_nZoneCycleScan			= 1;
+		m_pFilterThBlack			= NULL;
+		m_pFilterThBlack2			= NULL;
+		m_pFilterThWhite			= NULL;
+		m_pFilterThWhite2			= NULL;
+		m_pSpeedZoneTh				= NULL;
+		m_pSpeedZoneThSlide			= NULL;
+
+		//==================================
+		// Assem 捞 场抄 饶贸府客 包访等 沥焊.
+
+		// 2.1.  搬窃 包府 沥焊.
+		s_nFrameDefPixLimit			= 10000;//MAX_DEFECTPIX_NUM;
+		s_nFrameDefBlobLimit		= 10000;//MAX_DEFECTBLOB_NUM;
+
+		// 2.2. 鞘磐傅 沥焊.
+		m_bUsePixelFilter			= TRUE;
+		m_bOnlyJumpFilter			= FALSE;
+		m_bPairFilter				= FALSE;
+		m_bUseMarginFilter			= TRUE;
+
+		// 2.2. Zone Measure Filter // 漂沥 粮俊 措秦 固技 康开 犁 概莫饶 促矫 八荤 鞘磐 利侩.
+		m_bTiltFilter				= FALSE;
+
+		// 2.3. 饶贸府 沥焊.
+		m_nDefectMergePixel			= 4;// 赣瘤 4 侨伎
+
+		// 2.4. Zone Sorting, Thresholding, Zone Thresholding老 锭狼 Zone 沥焊, RSCale 眠免阑 困茄 蔼甸
+		s_pZoneData					= NULL;
+		s_pZoneThreshold			= NULL;
+		s_nZoneDataWidth			= 0;
+		s_nZoneBufferWidth			= 0;
+		s_nZoneDataHeight			= 0;
+
+		// 2.5. 搬窃 沥焊 啊傍 沥焊.
+		s_dScanResolution			= 0.0;
+		s_dConvResolution			= 0.0;
+
+		//======================================
+		// 99. 静绰瘤 救 静绰 瘤 葛福绰 巴.
+		s_sSkipSave					= 0;
+		s_uiProcessing				= 0;
+		s_nRegionType				= -1;
+
+		//技牧靛 八荤
+		s_bUse2ndInspection			= FALSE;
+		s_n2ndThres					= 255;;
+		s_n2ndThresSlide			= 0;
+		s_d2ndPitch					= 0;
+
+		// Add by PJH
+		s_nASGDynamicHi				= 0;
+		s_nASGDynamicLow			= 0;
+
+		// 200090612 size choigudal
+		s_bUseTrimmer				= FALSE;
+		s_nTrimmerWidth				= 0;
+		s_nTrimmerHeight			= 0;
+//.
+      // 20150811 芭措 CS
+		for(int i = 0; i < MAX_ZONE_NUM; i++)
+		{
+			m_nCSThres[i] = 0;
+			m_nOriThres[i] = 0;
+		}
+
+	}
+
+	BOOL IsAllInspected(int endLine)
+	{
+		if(m_ConvDir == ConvDir_Hori)
+			return s_RectConv.bottom - endLine < 16;
+		return s_RectConv.right - endLine < 16;
+	}
+};
diff --git a/Common_Class/SISAssem/Header/AssemUtil.h b/Common_Class/SISAssem/Header/AssemUtil.h
new file mode 100644
index 0000000..fbe46fb
--- /dev/null
+++ b/Common_Class/SISAssem/Header/AssemUtil.h
@@ -0,0 +1,35 @@
+#pragma once
+
+class AFX_EXT_CLASS CAssemUtil
+{
+public:
+	// Assem阑 静绰 辫俊 咯扁促 父电促.
+	static void ByteToShort( unsigned char* pSrc, short* pDest, int nSize);
+	// 乔摹 备窍扁, 函荐甫 谅快 沤祸 俺充栏肺 犁祈
+	static void CheckPitchSmall16(__int64 pitch16, int searchCount, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &findPitch16, int &iPitch, int &spr);
+	static void CheckPitchSmallVert16(__int64 pitch16, int searchCount, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &findPitch16, int &iPitch, int &spr);
+
+	// 厘林扁 贾风记 : Vertical 捞搁辑 Tilt等 捞固瘤俊辑 Dynamic 乔摹 备窍扁
+	// 1. Vertical Pitch & Tilt 备窍扁
+	static void CheckPitchSmallVPT16(int pitchStart16, int pitchEnd16, int tiltStart16, int tiltEnd16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16, int &findTilt16);
+	// 2. Vertical Pitch俊辑 Tilt 备窍扁
+	static void CheckPitchSmallVP_T16(int pitch16, int tiltStart16, int tiltEnd16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findTilt16);
+	// 3. Tilt 俊辑 Vertical Pitch 备窍扁
+	static void CheckPitchSmallVT_P16(int pitchStart16, int pitchEnd16, int Tilt16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16);
+	// 4. Tilt 俊辑 Vertical Pitch 备窍扁 + Error Check(ImageBuffer)
+	static int CheckPitchSmallVT_P16_BOE(int pitchStart16, int pitchEnd16, int Tilt16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int buffHeight, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16);
+
+
+
+
+	// start 客 end啊 integer肺 登绢 乐促. 3.0阑 八荤窍妨搁 48锅(3*16)狼 八荤甫 荐青茄促.
+	// sub pixel狼 扁夯窜困绰 1/16 捞促.
+	static void CheckPitch(int StartPitch, int EndPitch, int Spr, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &rPitch, int &rfSpr);
+	// 弥檬 pitch绰 start~end鳖瘤 八荤窍唱, 乔摹 函拳啊 鞭拜窍瘤 臼扁锭巩俊 促澜 困摹狼 乔摹绰 1/16 窜困肺 乔摹 八荤 荐青
+	static void CheckPitchSmall(int StartPitch, int EndPitch, int Spr, int fSpr, int sSpr, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &rPitch, int &rfSpr);
+	// 弥檬 pitch何磐 count甫 临咯 唱埃促. 涝仿等乔摹绰 16硅茄 int蔼捞促.
+	static void CheckPitchPixel(int startPitch, int endPitch, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &iPitch);
+	static void CheckPitchEcho(int StartPitch, int EndPitch, int Spr, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &rPitch, int &rfSpr);
+
+
+};
diff --git a/Common_Class/SISAssem/Header/BlobStorage.h b/Common_Class/SISAssem/Header/BlobStorage.h
new file mode 100644
index 0000000..3157ff7
--- /dev/null
+++ b/Common_Class/SISAssem/Header/BlobStorage.h
@@ -0,0 +1,67 @@
+#pragma once
+
+#include "AssemDefect.h"
+#include "PairStorage.h"
+
+
+class AFX_EXT_CLASS CBlobStorage : public CPairStorage
+{
+public:
+	CBlobStorage(void);
+	~CBlobStorage(void);
+	int				m_nBlob;
+	CDefectBlob		*m_pBlobDefect;
+
+	int				m_maxBlob;
+	int				m_nBlobSpace;
+	double			m_BlobTime;;
+
+
+public:
+	int		InitBlobStorage(int maxBlob= 10000);
+	void	ResetBlobStorage()	;
+	void	TotalResetBlobStorage()	;// 檬扁拳 矫埃 窜绵阑 困秦 TotalReset 拌凯 窃荐 眠啊.
+	int		GetBlobCount() {return m_nBlob;}
+	CDefectBlob* GetBlobDefect(int i){return m_pBlobDefect+ i;}
+
+
+
+public:	// Blobing 扁夯 牢磐其捞胶
+	DIT_RESULT	BlobDefect();
+	DIT_RESULT	BlobDefectVert();
+	DIT_RESULT	BlobDefectVert(CPairStorage *pPairStrg);
+
+	// Filtering 包访.
+
+	void		ShadowFilter(int nStart, double xPitch);
+	void		ShadowFilterVert(int nStart, double yPitch);
+
+	int		GetConvolutionValue(int nX, int nY, double dDist, int nSuppress = 255);
+	int		GetConvolutionValueVert(int nX, int nY, double dDist, int nSuppress = 255);
+	int		GetAreaValue(int nXStart, int nYStart, int nWidth, int nHeight, double dDist, int nSuppress = 255);
+	int		GetAreaValueVert(int nXStart, int nYStart, int nWidth, int nHeight, double dDist, int nSuppress = 255);
+
+	// PostProcess 包访.
+	void		CheckDefectRect(CDefectBlob& Defect, int nX, int nY);
+	int			CalcRScale(CPoint* pVertex);
+
+	BOOL		ReadBlob(CBlobStorage *pBlobStrg);
+	BOOL		AddBlob(CDefectBlob *pBlob);
+
+	// 促 瘤况扼.
+	DIT_RESULT	BlobDefect2();
+	DIT_RESULT	BlobDefect_old();
+	DIT_RESULT	BlobUnpairDefect();
+
+	DIT_RESULT	MergeDivision(int nStart, int nMergePixel);
+	DIT_RESULT	MergeMix(int nStart, int nMergePixel);
+	DIT_RESULT	ClassificationDefect(int nStart);
+	BOOL		ClassifyVertical(int nPairedIdx, int nThreshold);
+	DIT_RESULT	ClassificationDefectVert(int nStart);
+
+	long				m_nSkipUnpaired;
+	long				m_nSkipClassify;
+	long				m_nMoveClassify;
+	long				m_nSkipMerged;
+
+};
diff --git a/Common_Class/SISAssem/Header/Pad.h b/Common_Class/SISAssem/Header/Pad.h
new file mode 100644
index 0000000..d8b435c
--- /dev/null
+++ b/Common_Class/SISAssem/Header/Pad.h
@@ -0,0 +1,145 @@
+#pragma once
+
+
+class AFX_EXT_CLASS CPadPoint
+{
+public:
+	int x, y;
+
+	void SetPoint(int px, int py)	{ x= px; y= py;	}
+	void VectorTo(CPadPoint &point)	{	x= point.x- x;	y= point.y- y;	}
+
+	BOOL FindCrossX(CPadPoint &point, int cy, int &tx);// 烙狼狼 cy俊 秦寸窍绰 x 蔼 备窍扁
+	BOOL FindCrossY(CPadPoint &point, int cx, int &ty);// 烙狼狼 cx俊 秦寸窍绰 y 蔼 备窍扁
+
+	BOOL ChangeCrossHori(CPadPoint &point, int cy);// 烙狼狼 cy俊 秦寸窍绰 x, y 肺 point 蔼 官操扁
+	BOOL ChangeCrossVert(CPadPoint &point, int cx);// 烙狼狼 cx俊 秦寸窍绰 x, y 肺 point 蔼 官操扁
+};
+
+class AFX_EXT_CLASS CTrapezium
+{
+public:
+	CPadPoint	m_TrapPoint[4];
+
+public:
+	CTrapezium*	GetSelfTrapezium()	{return this;}
+	int		GetTop()	{return m_TrapPoint->y;}
+	int		GetBottom()	{return m_TrapPoint[3].y;}
+	void	OffsetPlus(int x, int y)
+	{
+		for(int i= 0; i< 4; i++)
+		{
+			m_TrapPoint[i].x+= x;
+			m_TrapPoint[i].y+= y;
+		}
+	}
+	void	ChangeAxis()
+	{
+		int temp;
+		for(int i= 0; i< 4; i++)
+		{
+			temp= m_TrapPoint[i].x;
+			m_TrapPoint[i].x= m_TrapPoint[i].y;
+			m_TrapPoint[i].y= temp;
+		}
+	}
+};
+class AFX_EXT_CLASS CTrapeziumStorage
+{
+protected:
+	int m_nTrapSpace;
+	int m_nTrap;
+	CTrapezium	m_Trapeziums[10];
+	
+public:
+	CTrapeziumStorage(){m_nTrapSpace= 10; ResetTrapeziumCount();}
+
+public:
+	void ResetTrapeziumCount(){m_nTrap= 0;}
+	CTrapezium*	GetTrapezium(int i){	return m_Trapeziums+ i;}
+	int	GetTrapeziumCount(){return m_nTrap;}
+
+	BOOL OpenTrap(CPadPoint &TopLeft, CPadPoint &TopRight)
+	{
+		if(m_nTrap >= m_nTrapSpace)
+			return FALSE;
+		m_Trapeziums[m_nTrap].m_TrapPoint[0]= TopLeft;
+		m_Trapeziums[m_nTrap].m_TrapPoint[1]= TopRight;
+		return TRUE;
+	}
+	BOOL CloseTrap(CPadPoint &BotLeft, CPadPoint &BotRight)
+	{
+		if(m_nTrap >= m_nTrapSpace)
+			return FALSE;
+		m_Trapeziums[m_nTrap].m_TrapPoint[2]= BotLeft;
+		m_Trapeziums[m_nTrap].m_TrapPoint[3]= BotRight;
+		m_nTrap++;
+		return TRUE;
+	}
+};
+
+class AFX_EXT_CLASS CPadPoligon
+{
+	int			m_nPadPoint;	// 蜡瓤 器牢飘 荐
+	BOOL		m_bHorizontal;	// 八荤 规氢
+public:
+	int			m_iTopLeft, m_iTopRight;	// m_iTopLeft = 0 捞绢具 茄促.
+	int			m_iBottomRight, m_iBottomLeft;		// 
+
+//	int			m_iLeftBottom, m_iLeftTop;	// vertical 捞搁 Top捞 Left肺 官差绰 巴捞瘤氛..
+//	int			m_iRightTop, m_iRightBottom;
+
+	CPadPoint	m_PadPoints[10];
+	CRect		m_OutRect;
+	float		m_PitchMin;
+	float		m_PitchMax;
+
+public:
+	int		GetPointCount(){return m_nPadPoint;}
+	CPadPoint* GetPadPoint(int i){ return m_PadPoints+ i;}
+	CPadPoint* GetPadPoint_Round(int i){ return m_PadPoints+ GetRoundIndex(i);}
+
+	int		GetRoundIndex(int id){return id%m_nPadPoint;}
+	int		GetNextIndex(int id){ return (id+ 1)%m_nPadPoint;}
+	int		GetPreIndex(int id){ return (id+ m_nPadPoint- 1)%m_nPadPoint;}
+	void	CalOutRect();
+
+public:
+	CPadPoligon()	{		ResetPoligon();	}
+	CPadPoligon* GetSelfPoligon(){return this;}
+	/////------- test debug
+	void Test();
+	void OffsetPlusIndex(int start);
+	void OffsetPlus(int dx, int dy);
+	void ReverseIndex(int start);
+	/////======= test debug
+	BOOL IsClockwise();
+
+	void ResetPoligon(){m_nPadPoint= 0;}
+	void AddPoint(int x, int y)
+	{
+		m_PadPoints[m_nPadPoint].x= x;
+		m_PadPoints[m_nPadPoint].y= y;
+		m_nPadPoint++;
+	}
+	void AddPoint(CPadPoint& point)
+	{
+		m_PadPoints[m_nPadPoint]= point;
+		m_nPadPoint++;
+	}
+
+	void Cut_Margin(int left, int right, CPadPoligon &PadPoligon);
+	void Cut_3Pitch(float fPitch);
+	void Find_Corner();
+
+	BOOL Cut_TrapeziumHori(CTrapeziumStorage	*pTrapeziums);
+	BOOL Cut_TrapeziumVert(CTrapeziumStorage	*pTrapeziums);
+};
+
+class AFX_EXT_CLASS CPoligonStorage
+{
+	int			m_nPadPoligon;
+	CPadPoligon	m_PadPoligons[10];
+public:
+	CPadPoligon* GetPadPoligon(int i){ return m_PadPoligons+ i;}
+};
diff --git a/Common_Class/SISAssem/Header/PairStorage.h b/Common_Class/SISAssem/Header/PairStorage.h
new file mode 100644
index 0000000..f71eb7d
--- /dev/null
+++ b/Common_Class/SISAssem/Header/PairStorage.h
@@ -0,0 +1,59 @@
+#pragma once
+
+
+#include "AssemParam.h"
+#include "AssemDefect.h"
+#include "PixelStorage.h"
+
+class AFX_EXT_CLASS CPairStorage : public CPixelStorage
+{
+public:
+	CPairStorage(void);
+	~CPairStorage(void);
+	int				m_nPair;
+	CDefectPair		*m_pPairDefect;
+
+	int				m_maxPair;
+	int				m_nPairSpace;
+
+	long				*m_lFirstIndex;//[MAX_DEFECTPIX_NUM];
+	BOOL				*m_bMerged;//[MAX_DEFECTPIX_NUM];
+	BOOL				*m_bTemp;//[MAX_DEFECTPIX_NUM];
+
+	int		InitPairStorage(int maxPair= 10000);
+	void	ResetPairStorage();
+	void	TotalResetPairStorage();// 檬扁拳 矫埃 窜绵阑 困秦 TotalReset 拌凯 窃荐 眠啊.
+	int		GetPairCount() {return m_nPair;}
+	CDefectPair*	GetPairDefect(int i){return m_pPairDefect+ i;}
+
+	int		FalseFilter_Vert();
+	int		FalseFilter_Hori();
+
+
+	void	ShadowFly();	// UnpairDefect吝 ShadowDefect阑 葛滴 朝赴促.
+	void	CorrectDefGray();			// 叼棋 pixel狼 灌扁 蔼 恐邦 焊沥(恐邦捞蜡:辑宏侨伎, m*n 楷魂)
+
+	// Filtering  dfdf Interface.
+	void	Filtering_Vert();
+	void	Filtering_Vert_Temp();
+	void	Filtering_Hori();
+
+
+	BOOL		CrossFilter_Hori(CDefectPair *pPair);
+	BOOL		CrossFilter_Vert(CDefectPair *pPair);
+
+	BOOL		JumpFilter_Hori(CDefectPair *pPair);
+	BOOL		JumpFilter_Vert(CDefectPair *pPair);
+
+	BOOL		MarginFilter_Hori(CDefectPair *pPair);
+	BOOL		OneFilter_Vert(CDefectPair *pPair);
+
+	DIT_RESULT	PairingPlus_Pixel(double dPitchSize);
+	DIT_RESULT	PairingMinus_Pixel(double dPitchsize);
+
+	DIT_RESULT	PairingPlus_Float(double dPitchSize);
+	DIT_RESULT	PairingMinus_Float(double dPitchsize);
+
+	DIT_RESULT	PairingPlus_Vert(double dPitchSize);
+	DIT_RESULT	PairingMinus_Vert(double dPitchsize);
+};
diff --git a/Common_Class/SISAssem/Header/PixelStorage.h b/Common_Class/SISAssem/Header/PixelStorage.h
new file mode 100644
index 0000000..2bc693c
--- /dev/null
+++ b/Common_Class/SISAssem/Header/PixelStorage.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#include "AssemParam.h"
+
+class AFX_EXT_CLASS CPixelStorage
+{
+protected:
+	CConvParam	m_Param;
+public:
+	int		m_nPixel;
+
+	int		*m_pPixelX;
+	int		*m_pPixelY;
+	short	*m_pPixelType;
+	short	*m_pPixelValue;
+
+	int		*m_pGraySrc;
+	int		*m_pGrayCmp;
+	int		*m_pZoneID;
+	int		*m_pZoneTh;
+
+public:
+	int		m_nPixelSpace;
+	int		m_maxPixel;
+
+public:
+	CPixelStorage();
+	virtual ~CPixelStorage();
+
+public:
+	int		InitPixelStorage(int maxPixel= 10000);
+	void	SetConvParam(CConvParam *pParam);
+	void	ResetPixelStorage();
+	int		GetPixelCount(){return m_nPixel;}
+
+	int		GetThreadDefectPixelNum()		{ return m_nPixel; }
+	int		GetOverflowedPixelY()			{ return m_pPixelY[m_nPixel - 1]; }
+
+
+	int	GetPixelX(int i){return m_pPixelX[i];}
+	int	GetPixelY(int i){return m_pPixelY[i];}
+	int	GetPixelType(int i){return m_pPixelType[i];}
+	int	GetPixelValue(int i){return m_pPixelValue[i];}
+	int	GetPeak(int i){return m_pPixelValue[i];}
+	int	GetThreshold(int i){return m_pZoneTh[i];}
+	int	GetSrcGray(int i){return m_pGraySrc[i];}
+	int	GetCmpGray(int i){return m_pGrayCmp[i];}
+};
+
diff --git a/Common_Class/SISAssem/Header/SISAssem.h b/Common_Class/SISAssem/Header/SISAssem.h
new file mode 100644
index 0000000..b61e755
--- /dev/null
+++ b/Common_Class/SISAssem/Header/SISAssem.h
@@ -0,0 +1,233 @@
+#pragma once
+
+#include "AssemParam.h"
+#include "BlobStorage.h"
+#include "AssemUtil.h"
+#include "SISStrg.h"
+#define ASSEM_CONVBUFFER_SIZE	1024*1024
+
+class CBlobStorage;
+class CSISAssem;
+
+
+
+class AFX_EXT_CLASS CAssemControl
+{
+	int				m_nThread;
+	int				m_nSpace;
+	CSISAssem		*m_pSISAssem;
+
+public:
+	CAssemControl();
+	~CAssemControl();
+
+public:
+	int				InitAssemControl(int nThread, int maxDefect= 10000);
+	void			ResetReinspectCount();
+
+public:
+	DIT_RESULT		Inspect_Rect(int iThread, CConvParam *pParam, BOOL bAsg= FALSE);//, class CDefectStorage *pDefectStorage, int iFrame, int iScan, int iModel, BOOL bCosmicFiler);
+	DIT_RESULT		Inspect_Trapezium(int iThread, CConvParam *pParam);//, class CDefectStorage *pDefectStorage, int iFrame, int iScan, int iModel, BOOL bCosmicFiler);
+	DIT_RESULT		Inspect_ASG(int iThread, CConvParam *pParam);
+	DIT_RESULT		ASGVertConvolution(int iThread, CConvParam *pParam);
+
+public:
+	CSISAssem*	GetSISAssem(int iThread);
+};
+
+// CSISAssem 郴俊辑 林绢柳 八荤 康开阑 盒且秦 Thread 盒且 八荤甫 角矫茄促.
+class CAssemThreadControl
+{
+	int				m_nThread;
+	int				m_nSpace;
+	CSISAssem		*m_pSISAssem;
+
+public:
+	CAssemThreadControl();
+	~CAssemThreadControl();
+	int				GetThreadCount(){return m_nThread;}
+	BOOL			InitAssemThreadControl(int nThread, int maxDefect);
+	DIT_RESULT		Inspect_RectThread(int iThread, CConvParam *pParam);//, class CDefectStorage *pDefectStorage, int iFrame, int iScan, int iModel, BOOL bCosmicFiler);
+
+	CSISAssem*	GetSISAssemThread(int iThread);
+};
+
+class AFX_EXT_CLASS CSISAssem	 : public CBlobStorage
+{
+public:
+	CAssemThreadControl	*m_pAssemControl;
+	int		m_iThread;
+	//	BOOL	m_bNowInspect;
+
+	double	m_ConvTime;
+	int		m_cReinspect;
+
+
+protected:
+	CSISBlock<short>	m_ConvBlock;
+	CSISBlock<short>	m_ConvBlock2;
+
+public:
+	CSISAssem(void);
+	~CSISAssem(void);
+
+public:
+
+	BOOL		InitAssem(int iThread, int maxDefect);
+	void		ResetReinspectCount()	{m_cReinspect= 0;}
+	void		ResetSISAssem();	// Inspect_Pre(); 甫 ResetSISAssem()栏肺 疙狼函版茄促.
+	void		InspectPAD_Clear();
+
+	BOOL		EnableInternalThread(int nThrea, int maxDefect);
+
+public:		// 寇何俊辑 八荤矫 龋免窍绰 角力 牢磐其捞胶[老访狼 八荤 苞沥(Reset, Check Validity, Inspect, PostProcess..]阑 郴何俊辑 器窃茄促]
+	DIT_RESULT	Inspect_Rect(CConvParam *pParam);
+	DIT_RESULT	Inspect_RectThread(CConvParam *pParam);
+	DIT_RESULT	Inspect_Trapezium(CConvParam *pParam);
+	DIT_RESULT	Inspect_ASG(CConvParam *pParam);	// Asg俊 Zone 八荤啊 眠啊登搁辑 Inspect 拌凯俊 Inspect_ASG() 眠啊
+
+public:
+	void		CountReinspect()	{m_cReinspect++;}
+
+public:
+	DIT_RESULT	CheckParameter(BOOL &bNoInspect);
+	DIT_RESULT	CheckParameter_Vert(BOOL &bNoInspect);
+
+public:// Assem 龋免阑 烹秦 角力 八荤 Control窍绰 窃荐甸. Assem殿 角力 八荤 风凭阑 眠啊 窍妨芭电 捞率 拌凯肺 荤侩茄促.
+	int			Compare_Float();
+	int			Compare_Pixel();
+	void		Compare_Zone();			// Compare_Zone2(); 肺 措眉
+	int			Compare_Zone2();		//  Zone 喊 促捞唱雇 Threshold 眠啊等 滚傈.
+	void		Compare_Trapezium();
+	int			Compare_ASGZone();
+	int			BinalizeInspection();
+
+
+protected:// 八荤俊 荤侩瞪 捞固瘤甫 困茄 吝埃 滚欺 Control
+	void		ResetConBuff(int &InspSize);			// 技肺规氢 厚背甫 困秦 16硅狼 傍埃 荤侩
+	short*		GetConBuffComp(){return m_ConvBlock.GetDataAddr();};
+	short*		GetConBuffComp2(){return m_ConvBlock2.GetDataAddr();};
+
+public:
+	DIT_RESULT		ASGVertConvolution(CConvParam *pParam);
+
+public:
+	int				BinalizeInspection(BYTE *pSrc, int nThresS, int nThresE, CRect rtROI
+									,int nWidth, CDefectPair *pDefectdPair, int nStartPair, int nMaxPair
+									,int &nEndLine);
+
+	int				ConvFloatVert_BOE_Intrin(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+									, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 i2Pitch16, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+									);
+	int				ConvFloatVTD_BOE_Intrin(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+									, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+									, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+									, short*  i2Pitch16, __int64 tilt16, int* PitchBuff, __int64 ThresholdSlide
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, int* endLine
+									);
+	int				ConvZoneVert2S_BOE_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+									, __int64 ExTh, __int64 Suppress
+									);
+	int				ConvZoneVert2S_TSP_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+									, __int64 ExTh, __int64 Suppress
+									);
+	int				ConvZoneVert2S_BlackFilter(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+									, __int64 ExTh, __int64 Suppress
+									);
+	int				ConvZoneVTD_BOE_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, int* piPitch16, __int64 iPitch16, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, short* ZoneAddTable, __int64 Tilt16, __int64 bUseUnpair, int* endLine
+									, __int64 ExTh, __int64 Suppress
+									);
+	int				ConvPixelVertS_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+									, int* endLine, __int64 ExTh);
+	int				ConvPixelVTDS_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, int* piPitch16, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+									, int* endLine, __int64 ExTh
+									);
+	int				ConvPixel_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, int* endLine
+									);
+	int				ConvPixel_Intrin_Twice(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, int* endLine
+									, __int64 iPitch2, __int64 Threshold2, __int64 ThresholdSlide2);
+	int				ConvPixelVertS_Intrin_Twice(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+									, int* endLine, __int64 ExTh, __int64 iPitch2, __int64 Threshold2
+									, __int64 ThresholdSlide2);
+};
+
diff --git a/Common_Class/SISAssem/Header/SISStrg.h b/Common_Class/SISAssem/Header/SISStrg.h
new file mode 100644
index 0000000..b2f54ee
--- /dev/null
+++ b/Common_Class/SISAssem/Header/SISStrg.h
@@ -0,0 +1,163 @@
+#pragma once
+
+
+
+template<typename T>
+class CSISStrg
+{
+	int m_nSpace;
+	int	m_Width, m_Height;
+	T*	m_pData;
+public:
+	CSISStrg()
+	{
+		m_pData= NULL;
+		m_Width= m_Height= m_nSpace= 0;
+	}
+	~CSISStrg()
+	{
+		if(m_pData)
+			delete[] m_pData;
+	}
+	BOOL	SetStrgSize(int w, int h)
+	{
+		if(w < 1) w= 1;
+		if(h < 1) h= 1;
+
+		int size= w*h;
+		if(size <= m_nSpace)
+		{
+			m_Width= w;
+			m_Height= h;
+			return TRUE;
+		}
+		if(m_pData)
+			delete[] m_pData;
+
+		m_pData= new T[size];
+		m_nSpace= m_Width= m_Height= 0;
+		if(! m_pData)	return FALSE;
+
+		m_nSpace= size;
+		m_Width= w;
+		m_Height= h;
+		return TRUE;
+	}
+};
+
+template<typename T>
+class CSISBlock
+{
+public:
+	CSISBlock()
+	{
+		m_pData= NULL;
+		m_nData= m_nSpace= 0;
+		ResetBlock();
+	}
+	~CSISBlock()
+	{
+		if(m_pData)
+			delete[] m_pData;
+	}
+
+public:
+	int	m_iData;
+	int m_nSpace;
+	int m_nData;
+	T	*m_pData;
+public:
+	BOOL	SetBlockSize(int size)
+	{
+		if(size <= 1)
+			size= 1;
+
+		if(size <= m_nSpace)
+		{
+			m_nData= size;
+			return TRUE;
+		}
+		if(m_pData)
+			delete[] m_pData;
+
+		m_pData= new T[size];
+		m_nSpace= m_nData= 0;
+		if(! m_pData)	return FALSE;
+
+		m_nSpace= size;
+		m_nData= size;
+		return TRUE;
+	}
+	void	ResetBlock()	{ m_iData= 0;	}
+	T*	GetData(int i)	{return (m_pData+ i);}
+	T*	GetDataAddr()	{return m_pData;}
+	int GetDataCount()	{return m_iData;}
+	int GetValidDataSpace()	{return m_nData;}
+	int GetDataSpace()	{return m_nSpace;}
+	int GetDataIndex()	{return m_iData;}
+
+	T*	GeCurData()		{return m_pData+ m_iData;}
+	int	AddDataCount()	{if(m_iData< m_nData-1) ++m_iData; return m_iData;}
+	void	AddBlock(T &data)
+	{
+		if(m_iData < m_nData)
+		{
+			m_pData[m_iData++]= data;
+		}
+	}
+};
+
+template<typename T>
+class CSISStack
+{
+public:
+	CSISStack()
+	{
+		m_pData= NULL;
+		m_nData= m_nSpace= 0;
+	}
+	~CSISStack()
+	{
+		if(m_pData)
+			delete[] m_pData;
+	}
+
+protected:
+	int m_nSpace;
+	int m_nData;
+	T	*m_pData;
+
+public:
+	BOOL	SetStackSize(int size)
+	{
+		if(size <= 1)
+			size= 1;
+
+		if(size <= m_nSpace)
+		{
+			m_nData= size;
+			return TRUE;
+		}
+		if(m_pData)
+			delete[] m_pData;
+
+		m_pData= new T[size];
+		m_nSpace= m_nData= 0;
+		if(! m_pData)	return FALSE;
+
+		m_nSpace= size;
+		m_nData= size;
+		return TRUE;
+	}
+	T*	GetStackData(int i)	{return (m_pData+ i);}
+	T*	GetStackDataAddr()	{return m_pData;}
+	int	GetStackDataCount()	{return m_nData;}
+
+};
+
+
+template<typename T>
+class CPointerBox
+{
+
+};
\ No newline at end of file
diff --git a/Common_Class/SISAssem/MathImpl.asm b/Common_Class/SISAssem/MathImpl.asm
new file mode 100644
index 0000000..883a4cb
--- /dev/null
+++ b/Common_Class/SISAssem/MathImpl.asm
@@ -0,0 +1,214 @@
+
+.data
+
+
+.code
+
+_return		equ		jmp
+
+
+xxZero		equ		xmm7
+xxSrc		equ		xmm0
+xxTemp		equ		xmm1
+xxSrc2		equ		xmm2
+xxTemp2	equ		xmm3
+xxRslt		equ		xmm5
+
+
+
+; 颇扼固磐
+rrSrc		equ		rsi
+rrSrc2		equ		rdi
+rrLen		equ		r8
+rrFlag		equ		r9
+
+
+
+; 肺拿 函荐
+
+
+_asm_GetCC_8u PROC
+	local	Rslt[2]	: qword
+
+;	push	rbp
+;	mov		rbp, rsp
+;	push	r10
+;	push	r11
+;	push	r12
+;	push	r13
+;	push	r14
+;	push	r15
+	push	rdi
+	push	rsi
+	push	rbx
+;	ADD		rbp, 018h
+
+
+	pxor	xxZero, xxZero
+	pxor	xxRslt, xxRslt
+	
+	mov		rrSrc, rcx
+	mov		rrSrc2, rdx
+	add		rrLen, rrSrc
+	sub		rrLen, 10h
+
+	cmp		rrSrc2, 0
+	je		ONE_BUFF
+	
+	cmp		rrFlag, 1
+	je		LOOP_AU2
+	jg		LOOP_UU2
+	jmp		LOOP_AA2
+	
+ONE_BUFF:
+	cmp		rrFlag, 1
+	jg		LOOP_UU
+	jmp		LOOP_AA
+
+
+LOOP_AA:
+	cmp		rrSrc, rrLen
+	jg		SUM_RSLT
+	movdqa		xxSrc, xmmword ptr[rrSrc]
+	movdqa		xxTemp, xxSrc
+	
+	punpckhbw	xxTemp, xxZero	
+	pmaddwd		xxTemp, xxTemp
+	punpcklbw	xxSrc, xxZero
+	pmaddwd		xxSrc, xxSrc
+	paddd		xxTemp, xxSrc
+	paddd		xxRslt, xxTemp
+	add			rrSrc, 10h
+	jmp			LOOP_AA
+
+LOOP_AA2:
+	cmp		rrSrc, rrLen
+	jg		SUM_RSLT
+	movdqa		xxSrc, xmmword ptr[rrSrc]	
+	movdqa		xxSrc2, xmmword ptr[rrSrc2]
+	movdqa		xxTemp2, xxSrc2
+	punpckhbw	xxTemp2, xxZero
+	movdqa		xxTemp, xxSrc
+	punpckhbw	xxTemp, xxZero	
+	pmaddwd		xxTemp, xxTemp2
+	
+	paddd		xxRslt, xxTemp
+	
+	punpcklbw	xxSrc, xxZero
+	punpcklbw	xxSrc2, xxZero
+	pmaddwd		xxSrc, xxSrc2
+	paddd		xxRslt, xxSrc
+	add		rrSrc, 10h
+	add		rrSrc2, 10h
+	jmp		LOOP_AA2
+
+LOOP_AU2:
+	cmp		rrSrc, rrLen
+	jg		SUM_RSLT
+	movdqu		xxSrc2, xmmword ptr[rrSrc2]
+	movdqa		xxSrc, xmmword ptr[rrSrc]
+	movdqa		xxTemp, xxSrc
+	movdqa		xxTemp2, xxSrc2
+	punpckhbw	xxTemp, xxZero	
+	punpckhbw	xxTemp2, xxZero	
+	pmaddwd		xxTemp, xxTemp2
+	paddd		xxRslt, xxTemp
+	punpcklbw	xxSrc, xxZero
+	punpcklbw	xxSrc2, xxZero
+	pmaddwd		xxSrc, xxSrc2
+	paddd		xxRslt, xxSrc
+	add		rrSrc, 10h
+	add		rrSrc2, 10h
+	jmp		LOOP_AU2
+
+LOOP_UU2:
+	cmp		rrSrc, rrLen
+	jg		SUM_RSLT
+	movdqu		xxSrc, xmmword ptr[rrSrc]
+	movdqu		xxSrc2, xmmword ptr[rrSrc2]
+	
+	movdqa		xxTemp2, xxSrc2
+	movdqa		xxTemp, xxSrc
+	punpckhbw	xxTemp, xxZero
+	punpckhbw	xxTemp2, xxZero	
+	pmaddwd		xxTemp, xxTemp2
+	paddd		xxRslt, xxTemp
+	
+	punpcklbw	xxSrc, xxZero
+	punpcklbw	xxSrc2, xxZero
+	pmaddwd		xxSrc, xxSrc2
+	paddd		xxRslt, xxSrc
+	add		rrSrc, 10h
+	add		rrSrc2, 10h
+	jmp		LOOP_UU2
+
+LOOP_UU:
+	cmp		rrSrc, rrLen
+	jg		SUM_RSLT
+	movdqu		xxSrc, xmmword ptr[rrSrc]
+	movdqa		xxTemp, xxSrc
+	
+	punpckhbw	xxTemp, xxZero	
+	pmaddwd		xxTemp, xxTemp
+	paddd		xxRslt, xxTemp
+	punpcklbw	xxSrc, xxZero
+	pmaddwd		xxSrc, xxSrc
+	paddd		xxRslt, xxSrc
+	add		rrSrc, 10h
+	jmp		LOOP_UU
+
+SUM_RSLT:
+	xor		rax, rax
+	lea		rcx, Rslt
+	movdqu	xmmword ptr[rcx], xxRslt
+	mov		eax, [rcx]
+	add		eax, [rcx+ 4]
+	add		eax, [rcx+ 8]
+	add		eax, [rcx+ 12]
+	add		rrLen, 10h
+
+	cmp		rrSrc2, 0
+	je		LOOP_CC
+
+LOOP_CC2:
+	cmp		rrSrc, rrLen
+	jge		END_FUNC
+	movzx	ebx, byte ptr[rrSrc]
+	movzx	ecx, byte ptr[rrSrc2]
+	imul	ebx, ecx
+	add		rax, rcx
+	inc		rrSrc
+	inc		rrSrc2
+	jmp		LOOP_CC2
+
+
+LOOP_CC:
+	cmp		rrSrc, rrLen
+	jge		END_FUNC
+	movzx	ecx, byte ptr[rrSrc]
+	imul	ecx, ecx
+	add		rax, rcx
+	inc		rrSrc
+	jmp		LOOP_CC
+	
+
+
+
+END_FUNC:
+
+	
+	pop		rbx
+	pop		rsi
+	pop		rdi
+;	pop		r15
+;	pop		r14
+;	pop		r13
+;	pop		r12
+;	pop		r11
+;	pop		r10
+;	pop		rbp
+
+RET
+_asm_GetCC_8u ENDP
+
+end
\ No newline at end of file
diff --git a/Common_Class/SISAssem/Pad.cpp b/Common_Class/SISAssem/Pad.cpp
new file mode 100644
index 0000000..84d620c
--- /dev/null
+++ b/Common_Class/SISAssem/Pad.cpp
@@ -0,0 +1,371 @@
+#include "StdAfx.h"
+#include "Pad.h"
+
+
+BOOL	CPadPoint::FindCrossX(CPadPoint &point, int cy, int &tx)// 烙狼狼 cy俊 秦寸窍绰 x, 蔼 茫扁
+{
+	if(point.y == y)
+	{
+		tx= point.x;
+		return y == cy;
+	}
+	tx= x+ (cy- y)*(point.x- x)/(point.y- y);
+	return TRUE;
+}
+
+BOOL CPadPoint::FindCrossY(CPadPoint &point, int cx, int &ty)// 烙狼狼 cX俊 秦寸窍绰 y 蔼 茫扁
+{
+	if(point.x == x)
+	{
+		ty= point.y;
+		return x == cx;
+	}
+	ty= y+ (cx- x)*(point.y- y)/(point.x- x);
+	return TRUE;
+}
+
+BOOL	CPadPoint::ChangeCrossHori(CPadPoint &point, int cy)// 烙狼狼 cy俊 秦寸窍绰 x, y 肺 蔼 官操扁
+{
+	if(point.y == y)
+	{
+		x= point.x;
+		y= point.y;
+		return	y == cy;
+	}
+	x= x+ (cy- y)*(point.x- x)/(point.y- y);
+	y= cy;
+	return TRUE;
+}
+BOOL	CPadPoint::ChangeCrossVert(CPadPoint &point, int cx)// 烙狼狼 cx俊 秦寸窍绰 x, y 肺 蔼 官操扁
+{
+	if(point.x == x)
+	{
+		x= point.x;
+		y= point.y;
+		return x == cx;
+	}
+	y= y+ (cx- x)*(point.y- y)/(point.x- x);
+	x= cx;
+	return TRUE;
+}
+
+void CPadPoligon::CalOutRect()
+{
+	CPadPoint *point;
+
+	m_OutRect.SetRect(10000000, 10000000, -10000000, -10000000);
+
+	for(int i= 0; i< m_nPadPoint; i++)
+	{
+		point= m_PadPoints+ i;
+		if(point->x < m_OutRect.left)
+			m_OutRect.left= point->x;
+		if(point->y < m_OutRect.top)
+			m_OutRect.top= point->y;
+		if(m_OutRect.right < point->x)
+			m_OutRect.right= point->x;
+		if(m_OutRect.bottom < point->y)
+			m_OutRect.bottom= point->y;
+	}
+}
+
+void CPadPoligon::Find_Corner()
+{
+	int ip;
+	int yMax= 1000000000;
+	int iMax, xMax;
+	int yMin= -1000000000;
+	int iMin, xMin;
+
+	if(m_nPadPoint < 3)
+		return;
+
+	if(! IsClockwise())
+	{
+		ReverseIndex(0);
+	}
+
+	for(ip= 0; ip < m_nPadPoint; ip++)
+	{
+		if(yMax > m_PadPoints[ip].y)// 
+		{
+			iMax= ip;
+			yMax= m_PadPoints[ip].y;
+			xMax= m_PadPoints[ip].x;
+		}else if(yMax == m_PadPoints[ip].y)
+		{
+			if(m_PadPoints[ip].x < xMax)
+			{
+				iMax= ip;
+				yMax= m_PadPoints[ip].y;
+				xMax= m_PadPoints[ip].x;
+			}
+		}
+		if(m_PadPoints[ip].y > yMin)
+		{
+			iMin= ip;
+			yMin= m_PadPoints[ip].y;
+			xMin= m_PadPoints[ip].x;
+		}else if(yMin == m_PadPoints[ip].y)
+		{
+			if(m_PadPoints[ip].x > xMin)
+			{
+				iMin= ip;
+				yMin= m_PadPoints[ip].y;
+				xMin= m_PadPoints[ip].x;
+			}
+		}
+	}
+
+	m_iTopLeft= iMax;
+	m_iBottomRight= iMin;
+
+	CPadPoint *point;
+
+	m_iTopRight= m_iTopLeft;
+	for(ip= 0; ip < m_nPadPoint; ip++)
+	{
+		point= GetPadPoint_Round(m_iTopLeft+ ip);
+		if(m_PadPoints[m_iTopLeft].y == point->y)
+		{
+			m_iTopRight= GetRoundIndex(m_iTopLeft+ ip);
+		}else
+		{
+			break;
+		}
+	}
+
+	m_iBottomLeft= m_iBottomRight;
+	for(ip= 0; ip < m_nPadPoint; ip++)
+	{
+		point= GetPadPoint_Round(m_iBottomRight+ ip);
+		if(m_PadPoints[m_iBottomRight].y == point->y)
+		{
+			m_iBottomLeft= GetRoundIndex(m_iBottomRight+ ip);
+		}else
+		{
+			break;
+		}
+	}
+
+	CalOutRect();
+}
+
+BOOL CPadPoligon::IsClockwise()
+{
+	if(m_nPadPoint < 3)	return FALSE;// 八荤 康开 绝澜, 伙阿屈 给秦...肋扼辑 客.
+
+	CPadPoint pt1, pt2;
+	int nCheck= m_nPadPoint- 2;
+	int vr;
+	for(int i= 0; i< nCheck; i++)
+	{
+		pt1= *GetPadPoint(i);
+		pt2= *GetPadPoint(i+1);
+		pt1.VectorTo(pt2);
+		pt2.VectorTo(*GetPadPoint(i+2));
+		vr= pt1.x*pt2.y- pt2.x*pt1.y;
+		if(vr < 0)
+			return FALSE;
+	}
+
+	return TRUE;
+
+
+	pt1= *GetPadPoint(0);
+	pt2= *GetPadPoint(1);
+	pt1.VectorTo(pt2);
+	pt2.VectorTo(*GetPadPoint(2));
+
+
+	vr= pt1.x*pt2.y- pt2.x*pt1.y;
+
+	if( vr >= 0)
+	{
+		return TRUE;
+	}
+	return FALSE;
+}
+BOOL CPadPoligon::Cut_TrapeziumVert(CTrapeziumStorage	*pTrapeziums)
+{
+	pTrapeziums->ResetTrapeziumCount();
+	if(m_nPadPoint < 3)	return FALSE;// 八荤 康开 绝澜, 伙阿屈 给秦...肋扼辑 客.
+	return TRUE;
+}
+
+BOOL CPadPoligon::Cut_TrapeziumHori(CTrapeziumStorage	*pTrapeziums)
+{
+	pTrapeziums->ResetTrapeziumCount();
+	if(m_nPadPoint < 3)	return FALSE;// 八荤 康开 绝澜, 伙阿屈 给秦...肋扼辑 客.
+
+	if(m_nPadPoint == 3)
+	{
+		int			i,j,nCount;
+		CPadPoint	point;
+		for(i=0;i<m_nPadPoint;i++)
+		{
+			nCount = 0;
+			point = m_PadPoints[i];
+			for(j=0;j<m_nPadPoint;j++)
+			{
+				if(point.x == m_PadPoints[j].x && point.y == m_PadPoints[j].y)
+					nCount++;
+			}
+
+			if(nCount >= 2)
+				return FALSE;
+		}
+	}
+
+	// if(nPoint == 4)	// 荤促府裁 趣篮 rect 匙~~
+
+	int		iLeft, iRight;
+	CPadPoint TopLeft, TopRight;
+
+	TopLeft= m_PadPoints[m_iTopLeft];
+	TopRight= m_PadPoints[m_iTopRight];
+
+
+	iLeft= GetPreIndex(m_iTopLeft);//(m_iTopLeft+ m_nPadPoint- 1)%m_nPadPoint;
+	iRight= GetNextIndex(m_iTopRight);//(m_iTopRight+ 1)%m_nPadPoint;
+
+	int endLeft, endRight;
+	endLeft= GetPreIndex(m_iBottomLeft);
+	endRight= GetNextIndex(m_iBottomRight);
+
+	while(!(iLeft == endLeft && iRight == endRight))
+	{
+		pTrapeziums->OpenTrap(TopLeft, TopRight);
+		if(m_PadPoints[iLeft].y < m_PadPoints[iRight].y)
+		{
+			TopLeft= m_PadPoints[iLeft];
+			TopRight.ChangeCrossHori(m_PadPoints[iRight], TopLeft.y);
+			pTrapeziums->CloseTrap(TopRight, TopLeft);
+			//iLeft--;
+			iLeft= GetPreIndex(iLeft);
+		}else if(m_PadPoints[iLeft].y > m_PadPoints[iRight].y)
+		{
+			TopRight= m_PadPoints[iRight];
+			TopLeft.ChangeCrossHori(m_PadPoints[iLeft], TopRight.y);
+			pTrapeziums->CloseTrap(TopRight, TopLeft);
+			//iRight++;
+			iRight= GetNextIndex(iRight);
+		}else // if( == )
+		{
+			TopLeft= m_PadPoints[iLeft];
+			TopRight= m_PadPoints[iRight];
+			pTrapeziums->CloseTrap(TopRight, TopLeft);
+			//iLeft--;
+			//iRight++;
+			iLeft= GetPreIndex(iLeft);
+			iRight= GetNextIndex(iRight);
+		}
+	}
+	return TRUE;
+}
+
+void CPadPoligon::Cut_Margin(int left, int right, CPadPoligon &PadPoligon)
+{
+	int i;
+	CPadPoint *pt1, *pt2;
+	CPadPoint	point;
+	int iPoint= 0;
+	PadPoligon.ResetPoligon();
+
+//	if(left > m_OutRect.left && left < m_OutRect.right)
+	{
+		for(i= 0; i< m_nPadPoint; i++)
+		{
+			pt1= GetPadPoint_Round(i);//m_PadPoints+ i;
+			pt2= GetPadPoint_Round(i+ 1);//m_PadPoints+ (i+1)%m_nPadPoint;
+
+			if(pt1->x < left)
+			{
+				if(left < pt2->x)
+				{
+					point= *pt1;
+					point.ChangeCrossVert(*pt2, left);
+					PadPoligon.AddPoint(point);
+				}
+				if(right < pt2->x)
+				{
+					point= *pt1;
+					point.ChangeCrossVert(*pt2, right);
+					PadPoligon.AddPoint(point);
+				}
+			}else if(right < pt1->x)
+			{
+				if(pt2->x < right)
+				{
+					point= *pt1;
+					point.ChangeCrossVert(*pt2, right);
+					PadPoligon.AddPoint(point);
+				}
+				if(pt2->x < left)
+				{
+					point= *pt1;
+					point.ChangeCrossVert(*pt2, left);
+					PadPoligon.AddPoint(point);
+				}
+			}else// if(left <= pt1->x && pt1->x < right)
+			{
+				PadPoligon.AddPoint(*pt1);
+				if(pt2->x < left)
+				{
+					point= *pt1;
+					point.ChangeCrossVert(*pt2, left);
+					PadPoligon.AddPoint(point);
+				}else if(right < pt2->x)
+				{
+					point= *pt1;
+					point.ChangeCrossVert(*pt2, right);
+					PadPoligon.AddPoint(point);
+				}
+			}
+		}
+	}
+}
+
+void CPadPoligon::Test()
+{
+	AddPoint(100, 150);
+	AddPoint(400, 30);
+	AddPoint(600, 100);
+//	AddPoint(780, 200);
+	AddPoint(800, 200);
+	AddPoint(500, 400);	// bottom right
+	AddPoint(400, 400);	// bottom left
+	AddPoint(300, 400);	// bottom left
+	AddPoint(200, 350);
+	AddPoint(100, 200);
+
+}
+
+void CPadPoligon::OffsetPlus(int dx, int dy)
+{
+	int i;
+	for(i=0; i< m_nPadPoint; i++)
+	{
+		m_PadPoints[i].x= m_PadPoints[i].x+ dx;
+		m_PadPoints[i].y= m_PadPoints[i].y+ dy;
+	}
+}
+
+void CPadPoligon::OffsetPlusIndex(int start)
+{
+	int i;
+	CPadPoligon poligon= *this;
+	for(i=0; i< m_nPadPoint; i++)
+	{
+		m_PadPoints[i]= *poligon.GetPadPoint_Round(start+ i);//poligon.m_PadPoints[GetPreIndex(m_nPadPoint+ test-i)];
+	}
+}
+void CPadPoligon::ReverseIndex(int start)
+{
+	int i;
+	CPadPoligon poligon= *this;
+	for(i=0; i< m_nPadPoint; i++)
+	{
+		m_PadPoints[i]= *poligon.GetPadPoint_Round(m_nPadPoint+ start- i);//poligon.m_PadPoints[GetPreIndex(m_nPadPoint+ test-i)];
+	}
+}
diff --git a/Common_Class/SISAssem/PairStorage.cpp b/Common_Class/SISAssem/PairStorage.cpp
new file mode 100644
index 0000000..4abe7ae
--- /dev/null
+++ b/Common_Class/SISAssem/PairStorage.cpp
@@ -0,0 +1,1478 @@
+#include "StdAfx.h"
+#include "PairStorage.h"
+
+
+
+CPairStorage::CPairStorage(void)
+{
+	m_nPairSpace= m_maxPair= m_nPair= -1;
+	m_pPairDefect= NULL;
+
+	m_lFirstIndex= NULL;
+	m_bMerged= NULL;
+	m_bTemp= NULL;
+}
+
+CPairStorage::~CPairStorage(void)
+{
+	if(m_pPairDefect)
+		delete[] m_pPairDefect;
+	if(m_lFirstIndex)
+		delete[] m_lFirstIndex;
+	if(m_bMerged)
+		delete[] m_bMerged;
+	if(m_bTemp)
+		delete[] m_bTemp;
+}
+
+
+// 滚欺狼 荤捞令俊 惑包绝捞 minus 牢郸胶肺档 立辟 啊瓷茄 扁瓷 滚欺.
+class CSISBufferSudo
+{
+protected:
+	BYTE * m_pData;
+	int m_Width, m_DataWidth;
+	int m_Height;
+public:
+	CSISBufferSudo(){m_pData= NULL; SetSize(0, 0);};
+	CSISBufferSudo(BYTE* pData_, int w, int h)
+		: m_pData(pData_)
+	{		SetSize(w, h);	}
+	void SetBuffer(BYTE* pData, int w, int h)
+	{
+		m_pData= pData;
+		SetSize(w, h);
+	}
+	virtual BOOL SetSize(int w, int h)
+	{
+		m_Width= w;
+		m_Height= h;
+		m_DataWidth= ChangeDataWidth(w);//(m_Width+ 3)/4*4;
+		return TRUE;
+	}
+	BYTE* GetDataAddress(int x, int y){return m_pData+ GetDataWidth()*y+ x;};
+	double GetDiff32(int x, int y, double xPitch);
+	double	GetDiff23(int x, int y, double yPitch);	
+
+	double GetXDiff22(int x, int y, double xPitch);
+	double GetYDiff22(int x, int y, double yPitch);
+
+	double GetXDiff(int x, int y, double xPitch);
+	double GetYDiff(int x, int y, double yPitch);
+
+	int GetDataWidth(){ return m_DataWidth;}
+	static int ChangeDataWidth(int width){return (width+ 3)/4*4;}
+};
+
+double CSISBufferSudo::GetXDiff(int x, int y, double xPitch)
+{
+	double ret;
+	double xRef= x+ xPitch;
+	int iRef= (int)xRef;
+	double r2= xRef- iRef;
+	double r1= 1- r2;
+
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(iRef, y);
+
+	ret= *pData;
+
+	ret-= ((double)(*pData2)*r1+ *(pData2+1)*r2);
+
+	return ret;
+}
+
+double CSISBufferSudo::GetYDiff(int x, int y, double yPitch)
+{
+	double ret;
+	double yRef= y+ yPitch;
+	int iRef= (int)yRef;
+	double r2= yRef- iRef;
+	double r1= 1- r2;
+
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(x, iRef);
+
+	ret= *pData;
+
+	ret-= ((double)(*pData2)*r1);
+	pData2+= GetDataWidth();
+	ret-= ((double)(*pData2)*r2);
+
+	return ret;
+}
+
+double CSISBufferSudo::GetXDiff22(int x, int y, double xPitch)
+{
+	double ret;
+	double xRef= x+ xPitch;
+	int iRef= (int)xRef;
+	double r2= xRef- iRef;
+	double r1= 1- r2;
+
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(iRef, y);
+
+	ret= *pData+ *(pData+ 1);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+ 1);
+
+	ret-= ((double)(*pData2)*r1+ *(pData2+ 1)+ *(pData2+2)*r2);
+	pData2+= GetDataWidth();
+	ret-= ((double)(*pData2)*r1+ *(pData2+ 1)+ *(pData2+2)*r2);
+
+	return ret;
+}
+
+double CSISBufferSudo::GetYDiff22(int x, int y, double yPitch)
+{
+	double ret;
+	double yRef= y+ yPitch;
+	int iRef= (int)yRef;
+	double r2= yRef- iRef;
+	double r1= 1- r2;
+
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(x, iRef);
+
+	ret= *pData+ *(pData+ 1);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+ 1);
+
+	ret-= ((double)((*pData2)+ *(pData2+ 1))*r1);
+	pData2+= GetDataWidth();
+	ret-= ((double)((*pData2)+ *(pData2+ 1)));
+	pData2+= GetDataWidth();
+	ret-= ((double)((*pData2)+ *(pData2+ 1))*r2);
+
+	return ret;
+}
+
+double CSISBufferSudo::GetDiff32(int x, int y, double xPitch)
+{
+	double		ret;
+	double	xRef= x+ xPitch;
+	int		iRef= (int) xRef;
+	double	pb= xRef- iRef;
+	double	pa= 1- pb;
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(iRef, y);
+
+	ret= *pData+ *(pData+ 1)+ *(pData+2);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+ 1)+ *(pData+2);
+
+	ret-= ((double)(*pData2)*pa+ *(pData2+ 1)+ *(pData2+2)+ (*(pData2+3))*pb);
+	pData2+= GetDataWidth();
+	ret-= ((double)(*pData2)*pa+ *(pData2+ 1)+ *(pData2+2)+ (*(pData2+3))*pb);
+
+	return ret;
+}
+
+double CSISBufferSudo::GetDiff23(int x, int y, double yPitch)
+{
+	double		ret;
+	double	yRef= y+ yPitch;
+	int		iRef= (int) yRef;
+	double	pb= yRef- iRef;
+	double	pa= 1- pb;
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(x, iRef);
+
+	ret= *pData+ *(pData+1);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+1);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+1);
+
+	ret-= ((double)(*pData2)*pa+ (*(pData2+1))*pa);
+	pData2+= GetDataWidth();
+	ret-= *pData2+ *(pData2+1);
+	pData2+= GetDataWidth();
+	ret-= *pData2+ *(pData2+1);
+	pData2+= GetDataWidth();
+	ret-= ((double)(*pData2)*pb+ (*(pData2+1))*pb);
+
+	return ret;
+}
+
+void CPairStorage::ShadowFly()
+{
+	// ShadowDefect(UnpairDefect)阑 葛滴 朝赴促. 唱吝俊 绢祭俊辑 颇扼固磐肺 罐酒辑 贸府窍厘.
+	CDefectPair *pPair;
+	int x;
+
+	for(x = 0; x < m_nPair; x++)
+	{
+		pPair= m_pPairDefect+ x;
+		if(pPair->s_DefectPair == DEFPAIR_UNPAIR)
+		{
+			pPair->s_DefectType= DEFTYPE_DELETE;
+		}
+	}
+}
+
+void CPairStorage::TotalResetPairStorage()
+{
+	m_nPair= 0;
+	int i;
+	for(i= 0; i< m_maxPair; i++)
+	{
+		m_pPairDefect[i].Reset();
+	}
+}
+
+void CPairStorage::ResetPairStorage()
+{
+	int i;
+	int nPair;
+
+	if(m_nPairSpace < m_nPair)
+		nPair= m_nPairSpace;
+	else
+		nPair= m_nPair;
+
+	for(i= 0; i< nPair; i++)
+	{
+		m_pPairDefect[i].Reset();
+	}
+	m_nPair= 0;
+}
+
+int	CPairStorage::InitPairStorage(int maxPair)
+{
+	if(maxPair <= m_nPairSpace)
+	{
+		m_maxPair= maxPair;
+		return m_maxPair;
+	}
+
+	if(m_pPairDefect != NULL)
+	{
+		delete[] m_pPairDefect;
+	}
+	int	PairSapce= maxPair+ 16;
+
+	if(m_lFirstIndex)
+		delete[] m_lFirstIndex;
+	if(m_bMerged)
+		delete[] m_bMerged;
+	if(m_bTemp)
+		delete[] m_bTemp;
+
+	m_lFirstIndex= new long[PairSapce];
+	m_bMerged= new BOOL[PairSapce];
+	m_bTemp= new BOOL[PairSapce];
+
+	// 16俺狼 咯盒阑 敌促..恐? 郴干..
+	m_pPairDefect= new CDefectPair[PairSapce];
+
+	if(m_pPairDefect == NULL)
+	{
+		m_maxPair= m_nPairSpace= 0;
+		return m_maxPair;
+	}
+
+
+	m_maxPair= m_nPairSpace= maxPair;
+
+	TotalResetPairStorage();// 檬扁拳 矫埃 窜绵阑 困秦 TotalReset 拌凯 窃荐 眠啊.
+
+	return m_maxPair;
+}
+
+
+
+int CPairStorage::FalseFilter_Vert()
+{
+	if(m_Param.m_bUsePixelFilter == FALSE)	return 0;
+
+	int iPair, ip;
+	CDefectPair *pPair, *pp;
+	int	x, y;
+
+	for(iPair= 0; iPair < m_nPair; iPair++)
+	{
+		pPair= m_pPairDefect+ iPair;
+		x= pPair->s_nDefectX;
+		y= pPair->s_nDefectY;
+		for(ip= iPair+ 1; ip < m_nPair; ip)
+		{
+			pp= m_pPairDefect+ ip;
+			if(y == pp->s_nDefectY)
+			{
+
+			}
+		}
+	}
+	return 0;
+}
+
+int CPairStorage::FalseFilter_Hori()
+{
+	if(m_Param.m_bUsePixelFilter == FALSE)	return 0;
+
+	int iPair, ip;
+	CDefectPair *pPair, *pp;
+	int	x, y;
+//	int	ids[1000];
+	int count;
+
+	for(iPair= 0; iPair < m_nPair; iPair++)
+	{
+		pPair= m_pPairDefect+ iPair;
+		x= pPair->s_nDefectX;
+		y= pPair->s_nDefectY+ 1;
+		count= 0;
+		for(ip= iPair+ 1; ip < m_nPair; ip)
+		{
+			pp= m_pPairDefect+ ip;
+			if(y < pp->s_nDefectY)
+			{
+				break;
+			}
+			count++;
+		}
+	}
+	return 0;
+}
+
+void CPairStorage::Filtering_Hori()
+{
+	if(m_Param.m_bUsePixelFilter == FALSE)	return;
+
+	int iPair;
+	CDefectPair *pPair;
+	if(m_Param.m_bPairFilter == TRUE)
+	{
+		if(m_Param.m_bOnlyJumpFilter == TRUE)
+		{
+			for(iPair= 0; iPair < m_nPair; iPair++)
+			{
+				pPair= m_pPairDefect+ iPair;
+				if(! MarginFilter_Hori(pPair))
+					pPair->s_DefectType= DEFTYPE_DELETE;
+				else if(! JumpFilter_Hori(pPair))
+				{
+					pPair->s_DefectType= DEFTYPE_DELETE;
+				}
+			}
+		}else
+		{
+			for(iPair= 0; iPair < m_nPair; iPair++)
+			{
+				pPair= m_pPairDefect+ iPair;
+				if(! MarginFilter_Hori(pPair))
+					pPair->s_DefectType= DEFTYPE_DELETE;
+				else if(! CrossFilter_Vert(pPair))
+				{
+					pPair->s_DefectType= DEFTYPE_DELETE;
+				}
+			}
+		}
+	}else
+	{
+		if(m_Param.m_bOnlyJumpFilter == TRUE)
+		{
+			for(iPair= 0; iPair < m_nPair; iPair++)
+			{
+				pPair= m_pPairDefect+ iPair;
+				if(pPair->s_DefectPair == DEFPAIR_UNPAIR)
+				{
+					if(! MarginFilter_Hori(pPair))
+						pPair->s_DefectType= DEFTYPE_DELETE;
+					else if(! JumpFilter_Hori(pPair))
+					{
+						pPair->s_DefectType= DEFTYPE_DELETE;
+					}
+				}
+			}
+		}else
+		{
+			for(iPair= 0; iPair < m_nPair; iPair++)
+			{
+				pPair= m_pPairDefect+ iPair;
+				if(pPair->s_DefectPair == DEFPAIR_UNPAIR)
+				{
+					if(! MarginFilter_Hori(pPair))
+						pPair->s_DefectType= DEFTYPE_DELETE;
+					else if(! CrossFilter_Vert(pPair))
+					{
+						pPair->s_DefectType= DEFTYPE_DELETE;
+					}
+				}
+			}
+		}
+	}
+};
+
+void CPairStorage::Filtering_Vert_Temp()
+{
+	if(m_Param.m_bUsePixelFilter == FALSE)	return;
+
+}
+
+void CPairStorage::CorrectDefGray()			// 叼棋 pixel狼 灌扁 蔼 恐邦 焊沥(恐邦捞蜡:辑宏侨伎, m*n 楷魂)
+{
+	int iPair;
+	CDefectPair *pPair;
+
+	if(NULL == m_Param.s_lpBuffer)
+		return;
+
+	for(iPair= 0; iPair < m_nPair; iPair++)
+	{
+		pPair= m_pPairDefect+ iPair;
+
+		pPair->s_fDefectPeak = abs(pPair->s_nGraySrc - pPair->s_nGrayRef) - abs(pPair->s_nThresold);
+		pPair->s_nGraySrc= *(m_Param.s_lpBuffer+ m_Param.s_nFrameWidth*pPair->s_nDefectY+ pPair->s_nDefectX);
+	}
+}
+
+void CPairStorage::Filtering_Vert()
+{
+	int iPair;
+	CDefectPair *pPair;
+
+	if(m_Param.m_bUsePixelFilter == FALSE)
+	{
+		for(iPair= 0; iPair < m_nPair; iPair++)
+		{
+			pPair= m_pPairDefect+ iPair;
+			if(! OneFilter_Vert(pPair))
+			{
+				pPair->s_DefectType= DEFTYPE_DELETE;
+			}
+		}
+
+		return;
+	}
+
+	if(m_Param.m_bPairFilter == TRUE)
+	{
+		if(m_Param.m_bOnlyJumpFilter == TRUE)
+		{
+			for(iPair= 0; iPair < m_nPair; iPair++)
+			{
+				pPair= m_pPairDefect+ iPair;
+				if(! JumpFilter_Vert(pPair))
+				{
+					
+					pPair->s_DefectType= DEFTYPE_DELETE;
+				}
+			}
+		}else
+		{
+			for(iPair= 0; iPair < m_nPair; iPair++)
+			{
+				pPair= m_pPairDefect+ iPair;
+				if(! CrossFilter_Hori(pPair))
+				{
+					pPair->s_DefectType= DEFTYPE_DELETE;
+				}
+			}
+		}
+	}else
+	{
+		if(m_Param.m_bOnlyJumpFilter == TRUE)
+		{
+			for(iPair= 0; iPair < m_nPair; iPair++)
+			{
+				pPair= m_pPairDefect+ iPair;
+				if(pPair->s_DefectPair == DEFPAIR_UNPAIR)
+				{
+					if(! JumpFilter_Vert(pPair))
+					{
+						pPair->s_DefectType= DEFTYPE_DELETE;
+					}
+				}
+			}
+		}else
+		{
+			for(iPair= 0; iPair < m_nPair; iPair++)
+			{
+				pPair= m_pPairDefect+ iPair;
+				if(pPair->s_DefectPair == DEFPAIR_UNPAIR)
+				{
+					if(! CrossFilter_Hori(pPair))
+					{
+						pPair->s_DefectType= DEFTYPE_DELETE;
+					}
+				}
+			}
+		}
+	}
+}
+
+
+BOOL ContainY(CRect &rect, int y)
+{
+	if(rect.top > y)	return FALSE;
+	if(rect.bottom < y)	return FALSE;
+	return TRUE;
+}
+BOOL ContainX(CRect &rect, int x)
+{
+	if(rect.left > x)	return FALSE;
+	if(rect.right < x)	return FALSE;
+	return TRUE;
+}
+//JumpCheck
+BOOL CPairStorage::JumpFilter_Hori(CDefectPair *pPair)
+{
+	double pitch= m_Param.GetRealConvPitch() * 2;
+	int iPitch= (int)pitch;
+
+	CSISBufferSudo buffer(m_Param.s_lpBuffer, m_Param.s_nFrameWidth, m_Param.s_nFrameHeight);
+	int diff;
+
+	if(pPair->s_nDefectX+ iPitch + 1 >= m_Param.s_RectConv.right)
+	{
+		pitch= -pitch;
+	}
+
+	// pitch 蔼捞 八荤 裹困甫 哈绢唱搁 鞘磐傅且 荐 绝促.
+	if(ContainX(m_Param.s_RectConv, pPair->s_nDefectX+ pitch) == FALSE)	return FALSE;
+
+	int nThreshold;
+	if(m_Param.m_ConvMode == ConvMode_Pixel)
+	{
+		if(m_Param.m_pFilterThBlack == NULL)
+			nThreshold= pPair->s_nThresold;
+		else
+			nThreshold= m_Param.GetFilterThreshold(pPair->s_nZone, max(pPair->s_nGraySrc, pPair->s_nGrayRef), pPair->s_DefectType);
+		diff= abs((int)buffer.GetXDiff(pPair->s_nDefectX, pPair->s_nDefectY, pitch));
+	}else
+	{
+		nThreshold= pPair->s_nThresold * m_Param.s_nConvWidth * m_Param.s_nConvHeight;
+		diff= abs((int)buffer.GetXDiff22(pPair->s_nDefectX, pPair->s_nDefectY, pitch));
+	}
+
+	if(diff > nThreshold)
+	{
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+#include <vector>
+#include <algorithm>
+class CSIS
+{
+	int count;
+public:
+	CSIS(){count= 0;}
+	int operator ()(int a)
+	{
+		return ++count;
+	}
+};
+
+
+class CPairFilter
+{
+	CSISBufferSudo m_Buffer;
+public:
+	CPairFilter(BYTE* pData, int w, int h)
+	{
+		m_Buffer.SetBuffer(pData, w, h);
+
+		CSIS mosis;
+
+		int *pInt= new int[100];
+
+		std::for_each(pInt, pInt+ 100, mosis);
+	}
+
+	BOOL JumpFilter();
+};
+
+BOOL CPairStorage::JumpFilter_Vert(CDefectPair *pPair)
+{
+	if(! OneFilter_Vert(pPair)) return FALSE;// 鞘磐傅捞 登菌栏搁 歹捞惑 柳青 鞘夸 绝澜..
+
+
+	double pitch= m_Param.GetRealScanPitch() * 2;
+	int iPitch= (int)pitch;
+
+
+	CSISBufferSudo buffer(m_Param.s_lpBuffer, m_Param.s_nFrameWidth, m_Param.s_nFrameHeight);
+	int diff;
+
+
+	if(pPair->s_nDefectY+ iPitch+ 1 >= m_Param.s_RectConv.bottom)
+	{
+		pitch= -pitch;
+	}
+
+	// pitch 蔼捞 八荤 裹困甫 哈绢唱搁 鞘磐傅且 荐 绝促. 搬窃捞 等促.
+	if(ContainY(m_Param.s_RectConv, pPair->s_nDefectY+ pitch) == FALSE)	return TRUE;
+
+	int nThreshold;
+	if(m_Param.m_ConvMode == ConvMode_Pixel)
+	{
+		if(m_Param.m_pFilterThBlack == NULL)
+			nThreshold= pPair->s_nThresold;
+		else
+			nThreshold= m_Param.GetFilterThreshold(pPair->s_nZone, max(pPair->s_nGraySrc, pPair->s_nGrayRef), pPair->s_DefectType);
+		diff= abs((int)buffer.GetYDiff(pPair->s_nDefectX, pPair->s_nDefectY, pitch));
+	}else
+	{
+		nThreshold= pPair->s_nThresold * m_Param.s_nConvWidth * m_Param.s_nConvHeight;
+		diff= abs((int)buffer.GetYDiff22(pPair->s_nDefectX, pPair->s_nDefectY, pitch));
+	}
+
+	if(diff > nThreshold)
+	{
+		return TRUE;// 混酒 巢酒 叼棋捞 等促..
+	}
+
+	return FALSE;
+}
+
+BOOL CPairStorage::MarginFilter_Hori(CDefectPair *pPair)
+{
+	if(m_Param.m_bUseMarginFilter == FALSE)	return TRUE;	// TRUE means pPair is true defect. (this filter doesn't have any effect.)
+	double pitch;
+	int		edgeTh= 0;
+
+	int		x= pPair->s_nDefectX;
+	int		bReverse= TRUE;
+	int		nSign=	1;
+	CRect	rectFilter;
+
+	if(m_Param.s_RectFilter.Height() < 1)
+	{
+		rectFilter			= m_Param.s_RectConv;
+		rectFilter.left		= 0;
+		rectFilter.right	= m_Param.s_nFrameWidth;
+	}else
+		rectFilter= m_Param.s_RectFilter;
+
+	pitch= m_Param.GetRealConvPitch();
+
+	if(pPair->s_DefectPos == DEFPOS_LEFT)
+	{
+		if(x- pitch- 3 <rectFilter.left)
+		{
+			x= x+ pitch+ 0.5;
+			pitch= -pitch;
+			edgeTh= m_Param.m_EdgeFilterTh;
+		}else
+		{
+			x= x- int(pitch+0.5);
+		}
+		nSign= -1;
+	}else if(pPair->s_DefectPos == DEFPOS_RIGHT)
+	{
+		if(x+ pitch+ 3 > rectFilter.right)
+		{
+			pitch= -pitch;
+			edgeTh= m_Param.m_EdgeFilterTh;
+		}else
+		{
+		}
+	}else
+	{
+		return TRUE;// 混酒 巢酒 叼棋捞 等促..
+	}
+
+	int iPitch= (int)pitch;
+
+	CSISBufferSudo buffer(m_Param.s_lpBuffer, m_Param.s_nFrameWidth, m_Param.s_nFrameHeight);
+	int diff;
+	int nThreshold;
+	if(m_Param.m_ConvMode == ConvMode_Pixel)
+	{
+		if(m_Param.m_pFilterThBlack == NULL)
+			nThreshold= pPair->s_nThresold;
+		else
+			nThreshold= m_Param.GetFilterThreshold(pPair->s_nZone, max(pPair->s_nGraySrc, pPair->s_nGrayRef), pPair->s_DefectType);
+		nThreshold+= edgeTh;
+		diff= buffer.GetXDiff(x, pPair->s_nDefectY, pitch);		// s, y => src, pitch= ref;
+	}else
+	{
+		nThreshold= pPair->s_nThresold;
+		nThreshold+= edgeTh;
+		nThreshold= nThreshold * m_Param.s_nConvWidth * m_Param.s_nConvHeight;
+		diff= buffer.GetXDiff22(x, pPair->s_nDefectY, pitch);	// s, y => src, pitch= ref;
+	}
+
+	diff= nSign*diff;	// src & ref distinguish.
+	if(pPair->s_DefectType == DEFTYPE_BLACK)
+	{
+		return -diff > nThreshold;
+	}
+	return diff > nThreshold;	// if reutrn(true), the defect is  a real defect. if not, that defect is not a defect.
+
+
+// 	if(abs(diff) > nThreshold)
+// 	{
+// 		return TRUE;// 混酒 巢酒 叼棋捞 等促..
+// 	}
+// 
+// 	return FALSE;
+}
+
+BOOL CPairStorage::OneFilter_Vert(CDefectPair *pPair)
+{
+	double pitch;
+	int		edgeTh= 0;
+
+	int		y= pPair->s_nDefectY;
+	int		bReverse= TRUE;
+	CRect	rectFilter;
+
+	if(m_Param.s_RectFilter.Height() < 1)
+		rectFilter= m_Param.s_RectConv;
+	else
+		rectFilter= m_Param.s_RectFilter;
+
+ 	if(m_Param.m_pPitch16 != NULL)
+ 		pitch= (double)m_Param.m_pPitch16[y/16]/16;
+	else
+		pitch= m_Param.GetRealScanPitch();
+
+	if(pPair->s_DefectPos == DEFPOS_LEFT)
+	{
+		if(y- pitch- 3 <rectFilter.top)
+		{
+			y= y+ pitch+ 0.5;
+			pitch= -pitch;
+			edgeTh= m_Param.m_EdgeFilterTh;
+		}else
+		{
+			y= y- int(pitch+0.5);			
+		}
+	}else if(pPair->s_DefectPos == DEFPOS_RIGHT)
+	{
+		if(y+ pitch+ 3 > rectFilter.bottom)
+		{
+			pitch= -pitch;
+			edgeTh= m_Param.m_EdgeFilterTh;
+		}else
+		{
+			;
+		}
+	}else
+	{
+		return TRUE;// 混酒 巢酒 叼棋捞 等促..
+	}
+
+
+	int iPitch= (int)pitch;
+
+	CSISBufferSudo buffer(m_Param.s_lpBuffer, m_Param.s_nFrameWidth, m_Param.s_nFrameHeight);
+	int diff;
+
+	// pitch 蔼捞 八荤 裹困甫 哈绢唱搁 鞘磐傅且 荐 绝促.
+// 	if(ContainY(m_Param.s_RectFilter, y+ pitch) == FALSE)
+// 	{
+//		AfxMessageBox("over");
+// 		return FALSE;// 叼棋阑 瘤款促. 啊搬窃 锭巩俊.. 捞 炼扒篮 父练窍搁 救登绰... 3林扁啊 登绢具 窍聪鳖.
+// 	}
+
+	int nThreshold;
+	if(m_Param.m_ConvMode == ConvMode_Pixel)
+	{
+		if(m_Param.m_pFilterThBlack == NULL)
+			nThreshold= pPair->s_nThresold;
+		else
+			nThreshold= m_Param.GetFilterThreshold(pPair->s_nZone, max(pPair->s_nGraySrc, pPair->s_nGrayRef), pPair->s_DefectType);
+		nThreshold+= edgeTh;
+		diff= abs((int)buffer.GetYDiff(pPair->s_nDefectX, y, pitch));
+	}else
+	{
+		nThreshold= pPair->s_nThresold;
+		nThreshold+= edgeTh;
+		nThreshold= nThreshold * m_Param.s_nConvWidth * m_Param.s_nConvHeight;
+		diff= abs((int)buffer.GetYDiff22(pPair->s_nDefectX, y, pitch));
+	}
+
+//	if(pPair->s_DefectType == DEFTYPE_BLACK)
+	{
+		if(diff > nThreshold)
+		{
+			return TRUE;// 混酒 巢酒 叼棋捞 等促..
+		}
+	}
+
+	return FALSE;// 叼棋阑 瘤款促.
+}
+
+
+BOOL CPairStorage::CrossFilter_Hori(CDefectPair *pPair)
+{
+	if(! OneFilter_Vert(pPair)) return FALSE;// 鞘磐傅捞 登菌栏搁 歹捞惑 柳青 鞘夸 绝澜..
+
+	double pitch= m_Param.GetRealConvPitch();
+	int iPitch= (int)pitch;
+
+
+
+	if(m_Param.s_RectConv.Width() < pitch*2)
+	{
+		return JumpFilter_Vert(pPair);
+	}
+
+	CSISBufferSudo buffer(m_Param.s_lpBuffer, m_Param.s_nFrameWidth, m_Param.s_nFrameHeight);
+	int diff;
+
+
+	if(pPair->s_nDefectX+ iPitch+ 1 >= m_Param.s_RectConv.right)
+	{
+		pitch= -pitch;
+	}
+
+	int nThreshold;
+	if(m_Param.m_ConvMode == ConvMode_Pixel)
+	{
+		if(m_Param.m_pFilterThBlack == NULL)
+			nThreshold= pPair->s_nThresold;
+		else
+			nThreshold= m_Param.GetFilterThreshold(pPair->s_nZone, max(pPair->s_nGraySrc, pPair->s_nGrayRef), pPair->s_DefectType);
+		diff= abs((int)buffer.GetXDiff(pPair->s_nDefectX, pPair->s_nDefectY, pitch));
+	}else
+	{
+		nThreshold= pPair->s_nThresold * m_Param.s_nConvWidth * m_Param.s_nConvHeight;
+		diff= abs((int)buffer.GetXDiff22(pPair->s_nDefectX, pPair->s_nDefectY, pitch));
+	}
+
+
+	if(diff > nThreshold)
+	{
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+BOOL CPairStorage::CrossFilter_Vert(CDefectPair *pPair)
+{
+	double pitch= m_Param.GetRealScanPitch();
+	int iPitch= (int)pitch;
+
+
+	if(m_Param.s_RectConv.Height() < pitch*2)
+	{
+		return JumpFilter_Hori(pPair);
+	}
+
+	CSISBufferSudo buffer(m_Param.s_lpBuffer, m_Param.s_nFrameWidth, m_Param.s_nFrameHeight);
+	int diff;
+
+	//BOE 结脓矾滚欺俊辑 磷绢辑 荐沥
+	if(pPair->s_nDefectY+ iPitch+ 2 >= m_Param.s_RectConv.bottom) //if(pPair->s_nDefectY+ iPitch+ 1 >= m_Param.s_RectConv.bottom)
+	{
+		pitch= -pitch;
+	}
+
+	int nThreshold;
+	if(m_Param.m_ConvMode == ConvMode_Pixel)
+	{
+		if(m_Param.m_pFilterThBlack == NULL)
+			nThreshold= pPair->s_nThresold;
+		else
+		nThreshold= m_Param.GetFilterThreshold(pPair->s_nZone, max(pPair->s_nGraySrc, pPair->s_nGrayRef), pPair->s_DefectType);
+
+		diff= abs((int)buffer.GetYDiff(pPair->s_nDefectX, pPair->s_nDefectY, pitch));
+	}else
+	{
+		nThreshold= pPair->s_nThresold * m_Param.s_nConvWidth * m_Param.s_nConvHeight;
+		diff= abs((int)buffer.GetYDiff22(pPair->s_nDefectX, pPair->s_nDefectY, pitch));
+	}
+
+	if(diff > nThreshold)
+	{
+		return TRUE;
+	}
+
+// 	if(pPair->s_DefectType == DEFTYPE_BLACK)
+// 	{
+// 		if(diff < -nThreshold)
+// 		{
+// 			return TRUE;
+// 		}
+// 		return FALSE;
+// 	}else if(pPair->s_DefectType == DEFTYPE_WHITE)
+// 	{
+// 		if(diff > nThreshold)
+// 		{
+// 			return TRUE;
+// 		}
+// 		return FALSE;
+// 	}
+
+	return FALSE;
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////
+DIT_RESULT CPairStorage::PairingPlus_Pixel(double dPitchsize)
+{
+	//////////////////////////////////////////////////////////////////////////
+	//MMX俊辑 thresholding鳖瘤窍绊 唱坷绰 搬窃狼 point沥焊绰 pair肺 唱坷骨肺 
+	//角力 茄俺狼 point沥焊甫 芭福绰 苞沥捞 鞘夸窍促.
+	dPitchsize+=0.5;
+	int i, j, nLenX;
+	BOOL ignore = FALSE;
+	int left, right;
+	left= m_Param.s_RectConv.left+ static_cast<LONG>(dPitchsize);
+	right= m_Param.s_RectConv.right- static_cast<LONG>(dPitchsize * 2);
+
+	CDefectPair *pPairDefect= m_pPairDefect+m_nPair;
+
+	for(i = 0; i < m_nPixel; i++)
+	{
+		if (m_pPixelType[i] == DEFTYPE_DELETE || m_pPixelType[i] == DEFTYPE_NODEFECT)
+			continue;
+
+		// 哭率 八荤 康开 抗寇贸府.
+		ignore = FALSE;
+		if (m_pPixelX[i] < left)
+		{
+			// 版拌俊辑狼 Paring 八荤.
+			for(j = i + 1; j < m_nPixel; j++)
+			{
+				if (m_pPixelType[j] == DEFTYPE_DELETE || m_pPixelType[j] == DEFTYPE_NODEFECT)
+					continue;
+				if (m_pPixelY[j] != m_pPixelY[i])	// 歹捞惑 厚背且 鞘夸 绝促.
+					break;
+				if (m_pPixelType[i] == m_pPixelType[j])
+					continue;
+				nLenX = m_pPixelX[j] - (m_pPixelX[i] + static_cast<int>(dPitchsize));
+				if(nLenX != 0)//if (nLenX > 1 || nLenX < -1)
+					continue;
+
+				// 茄 乔摹 坷弗率俊 搬窃捞 乐绰 版快 DEFPOS_LEFT_PAIR肺 魄沥
+				pPairDefect->s_DefectPos		= DEFPOS_LEFT;
+				pPairDefect->s_DefectPair		= DEFPAIR_PPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[j];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[j];
+				pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[j]);	//角力归搬窃篮1,孺搬窃篮0
+				pPairDefect->s_nGraySrc		= m_pGraySrc[j];
+				pPairDefect->s_nGrayRef		= m_pGrayCmp[j];
+				pPairDefect->s_fDefectPeak	= m_pPixelValue[j];
+				pPairDefect->s_nZone			= m_pZoneID[j];
+				pPairDefect->s_nThresold		= m_pZoneTh[j];
+
+
+				m_pPixelType[j] = DEFTYPE_DELETE;	// 乔摹 坷弗率 搬窃篮 歹捞惑 积阿且 鞘夸档 绝促.
+				m_nPair++;
+				pPairDefect++;
+
+				ignore = TRUE;
+				break;
+			}
+			if (ignore == FALSE)		// Pair 啊 酒囱 版快 DEFPOS_LEFT_UNPAIR肺 魄沥. 捞饶 Classify俊辑 犁炼沥.
+			{
+				pPairDefect->s_DefectPos		= DEFPOS_LEFT;
+				pPairDefect->s_DefectPair		= DEFPAIR_UNPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[i];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[i];
+				pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[i]);	//角力归搬窃篮1,孺搬窃篮0
+				pPairDefect->s_nGraySrc		= m_pGraySrc[i];
+				pPairDefect->s_nGrayRef		= m_pGrayCmp[i];
+				pPairDefect->s_fDefectPeak	= m_pPixelValue[i];
+				pPairDefect->s_nZone			= m_pZoneID[i];
+				pPairDefect->s_nThresold		= m_pZoneTh[i];
+				pPairDefect->s_nDefectX					= m_pPixelX[i];
+				m_nPair++;
+				pPairDefect++;
+			}
+		}
+		// 啊款单 八荤康开老 锭 贸府.
+		else if (m_pPixelX[i] <= right)
+		{
+			for(j = i + 1; j < m_nPixel; j++)
+			{
+				if (m_pPixelType[j] == DEFTYPE_DELETE || m_pPixelType[j] == DEFTYPE_NODEFECT)
+					continue;
+				if (m_pPixelY[j] != m_pPixelY[i])	// 歹捞惑 厚背且 鞘夸 绝促.
+					break;
+				if (m_pPixelType[i] == m_pPixelType[j])
+					continue;
+				nLenX = m_pPixelX[j] - (m_pPixelX[i] + static_cast<int>(dPitchsize));
+				if(nLenX != 0)//if (nLenX > 1 || nLenX < -1)	// 茄 乔摹 坷弗率俊 搬窃捞 乐绰 版快 DEFPOS_LEFT_PAIR肺 魄沥
+					continue;
+
+				// 茄 乔摹 捞饶俊 叼棋捞 乐栏搁 Pairing.
+				pPairDefect->s_DefectPos		= DEFPOS_CENTER;
+				pPairDefect->s_DefectPair		= DEFPAIR_PPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[j];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[j];
+				pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[j]);	//角力归搬窃篮1,孺搬窃篮0
+				pPairDefect->s_nGraySrc		= m_pGraySrc[j];
+				pPairDefect->s_nGrayRef		= m_pGrayCmp[j];
+				pPairDefect->s_fDefectPeak	= m_pPixelValue[j];
+				pPairDefect->s_nZone			= m_pZoneID[j];
+				pPairDefect->s_nThresold		= m_pZoneTh[j];
+
+				m_pPixelType[j] = DEFTYPE_DELETE;	// 乔摹 坷弗率 搬窃篮 歹捞惑 积阿且 鞘夸档 绝促.
+				m_nPair++;
+				pPairDefect++;
+
+				ignore = TRUE;
+				break;
+			}
+// 			if (ignore == FALSE)		// Pair 啊 酒囱 版快.
+// 			{
+// 				pPairDefect->s_DefectPos		= DEFPOS_CENTER;
+// 				pPairDefect->s_DefectPair		= DEFPAIR_UNPAIR;
+// 				pPairDefect->s_nDefectX		= m_pPixelX[i];	// Add Margin
+// 				pPairDefect->s_nDefectY		= m_pPixelY[i];
+// 				pPairDefect->s_DefectType		= (DefectType)m_pPixelType[i];	//角力归搬窃篮1,孺搬窃篮0
+// 				pPairDefect->s_nGraySrc		= m_pGraySrc[i];
+// 				pPairDefect->s_nGrayRef		= m_pGrayCmp[i];
+// 				pPairDefect->s_fDefectPeak	= m_pPixelValue[i];
+// 				pPairDefect->s_nZone			= m_pZoneID[i];
+// 				pPairDefect->s_nThresold		= m_pZoneTh[i];
+// 				m_nPair++;
+// 				pPairDefect++;
+// 			}
+		}
+		// 坷弗率 康开俊辑 哭率俊 Defect捞 乐栏搁 Pairing捞 等 搬窃捞促.
+		else
+		{
+			pPairDefect->s_DefectPos		= DEFPOS_RIGHT;
+			pPairDefect->s_DefectPair		= DEFPAIR_UNPAIR;
+			pPairDefect->s_nDefectX		= m_pPixelX[i]+ static_cast<int>(dPitchsize);	// Add Margin
+			pPairDefect->s_nDefectY		= m_pPixelY[i];
+			if(m_pPixelType[i] == 0)
+				m_pPixelType[i]= 1;
+			else
+				m_pPixelType[i]= 0;
+			pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[i]);	//角力归搬窃篮1,孺搬窃篮0
+			pPairDefect->s_nGraySrc		= m_pGraySrc[i];
+			pPairDefect->s_nGrayRef		= m_pGrayCmp[i];
+			pPairDefect->s_fDefectPeak	= m_pPixelValue[i];
+			pPairDefect->s_nZone			= m_pZoneID[i];
+			pPairDefect->s_nThresold		= m_pZoneTh[i];
+			m_nPair++;
+			pPairDefect++;
+		}
+	}
+
+	return DIT_CONV_SUCCESS;
+}
+
+DIT_RESULT CPairStorage::PairingMinus_Pixel(double dPitchsize)
+{
+	// -2Pitch Pairing
+	// 累悼 坷幅肺 扁瓷 沥瘤. 2011.01.12 2011.01.12
+	return DIT_CONV_SUCCESS;
+
+	// 搬窃捞 Pair肺 乐阑 版快甫 贸府. 1Pitch焊促 农绊 2Pitch焊促 累篮 搬窃 八免.dPitchsize
+	dPitchsize+= 0.5;
+	int i, j, nLenX, nLenY;
+
+	for(i = 0; i < m_nPair; i++)
+	{
+		//////////////////////////////////////////////////////////////////////////
+		// CENTER
+		if (m_pPairDefect[i].s_DefectPos != DEFPOS_CENTER && m_pPairDefect[i].s_DefectPos != DEFPOS_RIGHT)
+			continue;
+
+		if (m_pPairDefect[i].s_DefectPair != DEFPAIR_UNPAIR)
+			continue;
+
+		// +Pitch 悼老茄 搬窃捞 乐绰 版快, 搬窃捞 乔摹焊促 目辑 -2Pitch俊 UNPAIR啊 乐绰 版快, 盔贰 UNPAIR肺 八免等 版快.
+		// -nPitch 何磐 拌加 搬窃牢 版快.
+		// -2Pitch 尔 厚背.
+		for(j = i - 1; j >= 0; j--)
+		{
+			nLenX = m_pPairDefect[j].s_nDefectX - (m_pPairDefect[i].s_nDefectX - static_cast<int>(dPitchsize * 2));
+			nLenY = m_pPairDefect[j].s_nDefectY - m_pPairDefect[i].s_nDefectY;
+
+			if (nLenY < 0)
+				break;
+
+			if (abs(nLenX) > 2 || nLenY > 0)
+				continue;
+
+			// -2Pitch啊 Origin Pair牢 版快绰 -1Pitch客 -2Pitch 啊 搬窃 Type捞 促福促.
+			if (m_pPairDefect[j].s_DefectPair == DEFPAIR_PPAIR)
+			{
+				if (m_pPairDefect[i].s_DefectType == m_pPairDefect[j].s_DefectType)
+				{
+					m_pPairDefect[i].s_DefectType = static_cast<DefectType>((m_pPairDefect[j].s_DefectType + 1) % 2);
+					m_pPairDefect[i].s_nDefectX -= static_cast<int>(dPitchsize);
+					m_pPairDefect[i].s_DefectPair = DEFPAIR_MPAIR;
+				}
+			}
+			else if (m_pPairDefect[j].s_DefectPair == DEFPAIR_MPAIR)
+			{
+				if (m_pPairDefect[i].s_DefectType != m_pPairDefect[j].s_DefectType)
+				{
+					m_pPairDefect[i].s_DefectType = m_pPairDefect[j].s_DefectType;
+					m_pPairDefect[i].s_nDefectX -= static_cast<int>(dPitchsize);
+					m_pPairDefect[i].s_DefectPair = DEFPAIR_MPAIR;
+				}
+			}
+		}
+	}
+
+	return DIT_CONV_SUCCESS;
+}
+
+DIT_RESULT	CPairStorage::PairingMinus_Vert(double dPitchsize)
+{
+	// 搬窃捞 Pair肺 乐阑 版快甫 贸府. 1Pitch焊促 农绊 2Pitch焊促 累篮 搬窃 八免.dPitchsize
+	// 累悼 坷幅肺 扁瓷 沥瘤. 2011.01.12
+	return DIT_CONV_SUCCESS;
+	dPitchsize+= 0.5;
+	int i, j, nLenX, nLenY;
+
+	for(i = 0; i < m_nPair; i++)
+	{
+		//////////////////////////////////////////////////////////////////////////
+		// CENTER
+		if (m_pPairDefect[i].s_DefectPos != DEFPOS_CENTER && m_pPairDefect[i].s_DefectPos != DEFPOS_RIGHT)
+			continue;
+
+		if (m_pPairDefect[i].s_DefectPair != DEFPAIR_UNPAIR)
+			continue;
+
+		// +Pitch 悼老茄 搬窃捞 乐绰 版快, 搬窃捞 乔摹焊促 目辑 -2Pitch俊 UNPAIR啊 乐绰 版快, 盔贰 UNPAIR肺 八免等 版快.
+		// -nPitch 何磐 拌加 搬窃牢 版快.
+		// -2Pitch 尔 厚背.
+		for(j = i - 1; j >= 0; j--)
+		{
+			nLenX = m_pPairDefect[j].s_nDefectX - m_pPairDefect[i].s_nDefectX ;
+			nLenY = m_pPairDefect[j].s_nDefectY - (m_pPairDefect[i].s_nDefectY- static_cast<int>(dPitchsize * 2));
+
+			//	if (nLenX < 0)
+			//		break;
+
+			if (abs(nLenY) > 2 || nLenX > 0)
+				continue;
+
+			// -2Pitch啊 Origin Pair牢 版快绰 -1Pitch客 -2Pitch 啊 搬窃 Type捞 促福促.
+			if (m_pPairDefect[j].s_DefectPair == DEFPAIR_PPAIR)
+			{
+				if (m_pPairDefect[i].s_DefectType == m_pPairDefect[j].s_DefectType)
+				{
+					m_pPairDefect[i].s_DefectType = static_cast<DefectType>((m_pPairDefect[j].s_DefectType + 1) % 2);
+					m_pPairDefect[i].s_nDefectY -= static_cast<int>(dPitchsize);
+					m_pPairDefect[i].s_DefectPair = DEFPAIR_MPAIR;
+				}
+			}
+			else if (m_pPairDefect[j].s_DefectPair == DEFPAIR_MPAIR)
+			{
+				if (m_pPairDefect[i].s_DefectType != m_pPairDefect[j].s_DefectType)
+				{
+					m_pPairDefect[i].s_DefectType = m_pPairDefect[j].s_DefectType;
+					m_pPairDefect[i].s_nDefectY -= static_cast<int>(dPitchsize);
+					m_pPairDefect[i].s_DefectPair = DEFPAIR_MPAIR;
+				}
+			}
+		}
+	}
+
+	return DIT_CONV_SUCCESS;
+}
+
+DIT_RESULT	CPairStorage::PairingPlus_Vert(double dPitchsize)
+{	
+	//////////////////////////////////////////////////////////////////////////
+	//MMX俊辑 thresholding鳖瘤窍绊 唱坷绰 搬窃狼 point沥焊绰 pair肺 唱坷骨肺 
+	//角力 茄俺狼 point沥焊甫 芭福绰 苞沥捞 鞘夸窍促.
+	dPitchsize+=0.5;
+	int i, j, nLenY;
+	BOOL ignore = FALSE;
+	int top,bottom;
+	top= m_Param.s_RectConv.top+ static_cast<LONG>(dPitchsize);
+	bottom= m_Param.s_RectConv.bottom- static_cast<LONG>(dPitchsize);
+	CDefectPair *pPairDefect= m_pPairDefect+m_nPair;	
+
+	for(i = 0; i < m_nPixel; i++)
+	{
+		if (m_pPixelType[i] == DEFTYPE_DELETE || m_pPixelType[i] == DEFTYPE_NODEFECT)
+			continue;
+
+		// 哭率 八荤 康开 抗寇贸府.
+		ignore = FALSE;
+		if (m_pPixelY[i] < top)
+		{
+			// 版拌俊辑狼 Paring 八荤.
+			for(j = i + 1; j < m_nPixel; j++)
+			{
+				if (m_pPixelType[j] == DEFTYPE_DELETE || m_pPixelType[j] == DEFTYPE_NODEFECT)
+					continue;						
+				if (m_pPixelType[i] == m_pPixelType[j])
+					continue;
+				if(m_pPixelX[j] != m_pPixelX[i])
+					continue;
+				nLenY = m_pPixelY[j] - (m_pPixelY[i] + static_cast<int>(dPitchsize));				
+				if(nLenY != 0)//if (nLenY > 1 || nLenY < -1)
+					continue;
+
+				// 茄 乔摹 酒贰率俊 搬窃捞 乐绰 版快 DEFPOS_LEFT_PAIR肺 魄沥
+				pPairDefect->s_DefectPos		= DEFPOS_LEFT;
+				pPairDefect->s_DefectPair		= DEFPAIR_PPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[j];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[j];
+				pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[j]);	//角力归搬窃篮1,孺搬窃篮0						
+
+
+				m_pPixelType[j] = DEFTYPE_DELETE;	// 乔摹 坷弗率 搬窃篮 歹捞惑 积阿且 鞘夸档 绝促.
+				m_nPair++;
+				pPairDefect++;
+
+				ignore = TRUE;
+				break;
+			}
+			if (ignore == FALSE)		// Pair 啊 酒囱 版快 DEFPOS_LEFT_UNPAIR肺 魄沥. 捞饶 Classify俊辑 犁炼沥.
+			{
+				pPairDefect->s_DefectPos		= DEFPOS_LEFT;
+				pPairDefect->s_DefectPair		= DEFPAIR_UNPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[i];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[i];
+				pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[i]);	//角力归搬窃篮1,孺搬窃篮0
+
+				m_nPair++;
+				pPairDefect++;
+			}
+		}
+		// 啊款单 八荤康开老 锭 贸府.
+		else// if (m_pPixelY[i] <= bottom)
+		{
+			for(j = i + 1; j < m_nPixel; j++)
+			{
+				if (m_pPixelType[j] == DEFTYPE_DELETE || m_pPixelType[j] == DEFTYPE_NODEFECT)
+					continue;			
+				if (m_pPixelType[i] == m_pPixelType[j])
+					continue;
+				if(m_pPixelX[j] != m_pPixelX[i])
+					continue;				
+				nLenY = m_pPixelY[j] - (m_pPixelY[i] + static_cast<int>(dPitchsize));				
+				if(nLenY != 0)//if (nLenY > 1 || nLenY < -1)
+					continue;
+
+				// 茄 乔摹 捞饶俊 叼棋捞 乐栏搁 Pairing.
+				pPairDefect->s_DefectPos		= DEFPOS_CENTER;
+				pPairDefect->s_DefectPair		= DEFPAIR_PPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[j];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[j];
+				pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[j]);	//角力归搬窃篮1,孺搬窃篮0
+
+				m_pPixelType[j] = DEFTYPE_DELETE;	// 乔摹 坷弗率 搬窃篮 歹捞惑 积阿且 鞘夸档 绝促.
+				m_nPair++;
+				pPairDefect++;
+
+				ignore = TRUE;
+				break;
+			}
+			if (ignore == FALSE)		// Pair 啊 酒囱 版快.
+			{
+				pPairDefect->s_DefectPos		= DEFPOS_CENTER;
+				pPairDefect->s_DefectPair		= DEFPAIR_UNPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[i];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[i];
+				pPairDefect->s_DefectType		= (DefectType)m_pPixelType[i];	//角力归搬窃篮1,孺搬窃篮0
+
+				m_nPair++;
+				pPairDefect++;
+			}
+		}
+	}
+
+	return DIT_CONV_SUCCESS;
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+DIT_RESULT CPairStorage::PairingPlus_Float(double dPitchsize)
+{
+	//////////////////////////////////////////////////////////////////////////
+	//MMX俊辑 thresholding鳖瘤窍绊 唱坷绰 搬窃狼 point沥焊绰 pair肺 唱坷骨肺 
+	//角力 茄俺狼 point沥焊甫 芭福绰 苞沥捞 鞘夸窍促.
+	int pitch= (int)(dPitchsize+ 0.5);
+	dPitchsize+=0.5;
+	int i, j, nLenX;
+	BOOL ignore = FALSE;
+	int left, right;
+	left= m_Param.s_RectConv.left+ static_cast<LONG>(dPitchsize);
+	right= m_Param.s_RectConv.right- static_cast<LONG>(dPitchsize * 2);
+	CDefectPair *pPairDefect= m_pPairDefect+m_nPair;
+
+	for(i = 0; i < m_nPixel; i++)
+	{
+		if (m_pPixelType[i] == DEFTYPE_DELETE || m_pPixelType[i] == DEFTYPE_NODEFECT)
+			continue;
+
+		// 哭率 八荤 康开 抗寇贸府.
+		ignore = FALSE;
+		if (m_pPixelX[i] < left)
+		{
+			// 版拌俊辑狼 Paring 八荤.
+			for(j = i + 1; j < m_nPixel; j++)
+			{
+				if (m_pPixelType[j] == DEFTYPE_DELETE || m_pPixelType[j] == DEFTYPE_NODEFECT)
+					continue;
+				if (m_pPixelY[j] != m_pPixelY[i])	// 歹捞惑 厚背且 鞘夸 绝促.
+					break;
+				if (m_pPixelType[i] == m_pPixelType[j])
+					continue;
+				nLenX = m_pPixelX[j] - (m_pPixelX[i] + static_cast<int>(dPitchsize));
+				if(nLenX != 0)
+					continue;
+				//if (nLenX > 1 || nLenX < -1)
+				//	continue;
+
+				// 茄 乔摹 坷弗率俊 搬窃捞 乐绰 版快 DEFPOS_LEFT_PAIR肺 魄沥
+				pPairDefect->s_DefectPos	= DEFPOS_LEFT;
+				pPairDefect->s_DefectPair	= DEFPAIR_PPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[j];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[j];
+				pPairDefect->s_DefectType	= static_cast<DefectType>(m_pPixelType[j]);	//角力归搬窃篮1,孺搬窃篮0	
+				pPairDefect->s_fDefectPeak	= m_pPixelValue[j];
+
+
+				m_pPixelType[j] = DEFTYPE_DELETE;	// 乔摹 坷弗率 搬窃篮 歹捞惑 积阿且 鞘夸档 绝促.
+				m_nPair++;
+				pPairDefect++;
+
+				ignore = TRUE;
+				break;
+			}
+			if (ignore == FALSE)		// Pair 啊 酒囱 版快 DEFPOS_LEFT_UNPAIR肺 魄沥. 捞饶 Classify俊辑 犁炼沥.
+			{
+				pPairDefect->s_DefectPos		= DEFPOS_LEFT;
+				pPairDefect->s_DefectPair		= DEFPAIR_UNPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[i];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[i];
+				pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[i]);	//角力归搬窃篮1,孺搬窃篮0
+				pPairDefect->s_fDefectPeak	= m_pPixelValue[i];
+				
+				m_nPair++;
+				pPairDefect++;
+			}
+		}
+		// 啊款单 八荤康开老 锭 贸府.
+		else if (m_pPixelX[i] <= right)
+		{
+			for(j = i + 1; j < m_nPixel; j++)
+			{
+				if (m_pPixelType[j] == DEFTYPE_DELETE || m_pPixelType[j] == DEFTYPE_NODEFECT)
+					continue;
+				if (m_pPixelY[j] != m_pPixelY[i])	// 歹捞惑 厚背且 鞘夸 绝促.
+					break;
+				if (m_pPixelType[i] == m_pPixelType[j])
+					continue;
+				nLenX = m_pPixelX[j] - (m_pPixelX[i] + static_cast<int>(dPitchsize));
+				if(nLenX != 0)
+					continue;
+				if (nLenX > 1 || nLenX < -1)	// 茄 乔摹 坷弗率俊 搬窃捞 乐绰 版快 DEFPOS_LEFT_PAIR肺 魄沥
+					continue;
+
+				// 茄 乔摹 捞饶俊 叼棋捞 乐栏搁 Pairing.
+				pPairDefect->s_DefectPos		= DEFPOS_CENTER;
+				pPairDefect->s_DefectPair		= DEFPAIR_PPAIR;
+				pPairDefect->s_nDefectX		= m_pPixelX[j];	// Add Margin
+				pPairDefect->s_nDefectY		= m_pPixelY[j];
+				pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[j]);	//角力归搬窃篮1,孺搬窃篮0
+				pPairDefect->s_fDefectPeak	= m_pPixelValue[j];
+
+				m_pPixelType[j] = DEFTYPE_DELETE;	// 乔摹 坷弗率 搬窃篮 歹捞惑 积阿且 鞘夸档 绝促.
+				m_nPair++;
+				pPairDefect++;
+
+				ignore = TRUE;
+				break;
+			}
+// 			if (ignore == FALSE)		// Pair 啊 酒囱 版快.
+// 			{
+// 				pPairDefect->s_DefectPos		= DEFPOS_CENTER;
+// 				pPairDefect->s_DefectPair		= DEFPAIR_UNPAIR;
+// 				pPairDefect->s_nDefectX		= m_pPixelX[i];	// Add Margin
+// 				pPairDefect->s_nDefectY		= m_pPixelY[i];
+// 				pPairDefect->s_DefectType		= (DefectType)m_pPixelType[i];	//角力归搬窃篮1,孺搬窃篮0
+// 				pPairDefect->s_fDefectPeak	= m_pPixelValue[i];
+// 
+// 				m_nPair++;
+// 				pPairDefect++;
+// 			}
+		}		// 坷弗率 康开俊辑 哭率俊 Defect捞 乐栏搁 Pairing捞 等 搬窃捞促.
+		else
+		{
+			pPairDefect->s_DefectPos		= DEFPOS_RIGHT;
+			pPairDefect->s_DefectPair		= DEFPAIR_UNPAIR;
+			pPairDefect->s_nDefectY		= m_pPixelY[i];
+			pPairDefect->s_nDefectX		= m_pPixelX[i]+ pitch;	// Add Margin
+			if(m_pPixelType[i] == 0)
+				m_pPixelType[i]= 1;
+			else
+				m_pPixelType[i]= 0;
+			pPairDefect->s_DefectType		= static_cast<DefectType>(m_pPixelType[i]);	//角力归搬窃篮1,孺搬窃篮0
+			pPairDefect->s_fDefectPeak	= m_pPixelValue[i];
+
+			m_nPair++;
+			pPairDefect++;
+		}
+
+	}
+
+	return DIT_CONV_SUCCESS;
+}
+
+DIT_RESULT CPairStorage::PairingMinus_Float(double dPitchsize)
+{
+	// -2Pitch Pairing
+	// 累悼 坷幅肺 扁瓷 沥瘤. 2011.01.12
+	return DIT_CONV_SUCCESS;
+
+	// 搬窃捞 Pair肺 乐阑 版快甫 贸府. 1Pitch焊促 农绊 2Pitch焊促 累篮 搬窃 八免.dPitchsize
+	dPitchsize+= 0.5;
+	int i, j, nLenX, nLenY;
+
+	for(i = 0; i < m_nPair; i++)
+	{
+		//////////////////////////////////////////////////////////////////////////
+		// CENTER
+		if (m_pPairDefect[i].s_DefectPos != DEFPOS_CENTER && m_pPairDefect[i].s_DefectPos != DEFPOS_RIGHT)
+			continue;
+
+		if (m_pPairDefect[i].s_DefectPair != DEFPAIR_UNPAIR)
+			continue;
+
+		// +Pitch 悼老茄 搬窃捞 乐绰 版快, 搬窃捞 乔摹焊促 目辑 -2Pitch俊 UNPAIR啊 乐绰 版快, 盔贰 UNPAIR肺 八免等 版快.
+		// -nPitch 何磐 拌加 搬窃牢 版快.
+		// -2Pitch 尔 厚背.
+		for(j = i - 1; j >= 0; j--)
+		{
+			nLenX = m_pPairDefect[j].s_nDefectX - (m_pPairDefect[i].s_nDefectX - static_cast<int>(dPitchsize * 2));
+			nLenY = m_pPairDefect[j].s_nDefectY - m_pPairDefect[i].s_nDefectY;
+
+			if (nLenY < 0)
+				break;
+
+			if (abs(nLenX) > 2 || nLenY > 0)
+				continue;
+
+			// -2Pitch啊 Origin Pair牢 版快绰 -1Pitch客 -2Pitch 啊 搬窃 Type捞 促福促.
+			if (m_pPairDefect[j].s_DefectPair == DEFPAIR_PPAIR)
+			{
+				if (m_pPairDefect[i].s_DefectType == m_pPairDefect[j].s_DefectType)
+				{
+					m_pPairDefect[i].s_DefectType = static_cast<DefectType>((m_pPairDefect[j].s_DefectType + 1) % 2);
+					m_pPairDefect[i].s_nDefectX -= static_cast<int>(dPitchsize);
+					m_pPairDefect[i].s_DefectPair = DEFPAIR_MPAIR;
+				}
+			}
+			else if (m_pPairDefect[j].s_DefectPair == DEFPAIR_MPAIR)
+			{
+				if (m_pPairDefect[i].s_DefectType != m_pPairDefect[j].s_DefectType)
+				{
+					m_pPairDefect[i].s_DefectType = m_pPairDefect[j].s_DefectType;
+					m_pPairDefect[i].s_nDefectX -= static_cast<int>(dPitchsize);
+					m_pPairDefect[i].s_DefectPair = DEFPAIR_MPAIR;
+				}
+			}
+		}
+	}
+
+	return DIT_CONV_SUCCESS;
+}
diff --git a/Common_Class/SISAssem/PixelStorage.cpp b/Common_Class/SISAssem/PixelStorage.cpp
new file mode 100644
index 0000000..22d9c59
--- /dev/null
+++ b/Common_Class/SISAssem/PixelStorage.cpp
@@ -0,0 +1,92 @@
+#include "StdAfx.h"
+#include "PixelStorage.h"
+
+
+
+CPixelStorage::CPixelStorage()
+{
+	m_nPixelSpace= m_maxPixel= m_nPixel= 0;
+	m_pPixelX= NULL;
+}
+CPixelStorage::~CPixelStorage()
+{
+	if(m_pPixelX)
+		delete[] m_pPixelX;
+}
+
+void CPixelStorage::ResetPixelStorage()
+{
+	m_nPixel= 0;
+}
+void CPixelStorage::SetConvParam(CConvParam *pParam)
+{
+	m_Param= *pParam;
+}
+
+
+int	CPixelStorage::InitPixelStorage(int maxPixel)
+{
+	if(maxPixel <= m_nPixelSpace)
+	{
+		m_maxPixel= maxPixel;
+		return m_maxPixel;
+	}
+
+	if(m_pPixelX != NULL)
+	{
+		delete[] m_pPixelX;
+	}
+
+	// 16俺狼 咯盒阑 敌促..恐? 郴干..
+	int	PixelSapce= maxPixel+ 16;
+	m_pPixelX= new int[PixelSapce*8];
+
+	if(m_pPixelX == NULL)
+	{
+		m_maxPixel= m_nPixelSpace= 0;
+		return m_maxPixel;
+	}
+
+	m_pPixelY= m_pPixelX+ PixelSapce;
+	m_pPixelType= (short*)(m_pPixelX+ PixelSapce*2);
+	m_pPixelValue= (short*)(m_pPixelX+ PixelSapce*3);
+
+	m_pGraySrc= m_pPixelX+ PixelSapce*4;
+	m_pGrayCmp= m_pPixelX+ PixelSapce*5;
+	m_pZoneID= m_pPixelX+ PixelSapce*6;
+	m_pZoneTh= m_pPixelX+ PixelSapce*7;
+
+	m_maxPixel= m_nPixelSpace= maxPixel;
+
+	for(int i= 0; i < m_maxPixel; i++)
+	{
+		m_pZoneID[i]= 0;
+		m_pZoneTh[i]= 0;
+	}
+
+	return m_maxPixel;
+}
+
+
+/*
+int	CPixelStorage::GetPixelX(int i)
+{
+	if(i< 0 || i >= m_nPixel)	return -1;
+	return m_pPixelX[i];
+}
+int CPixelStorage::GetPixelY(int i)
+{
+	if(i< 0 || i >= m_nPixel) return -1;
+	return m_pPixelY[i];
+}
+int CPixelStorage::GetPixelValue(int i)
+{
+	if(i< 0 || i >= m_nPixel) return -1;
+	return m_pPixelValue[i];
+}
+int CPixelStorage::GetPixelType(int i)
+{
+	if(i< 0 || i >= m_nPixel) return -1;
+	return m_pPixelType[i];
+}
+*/
\ No newline at end of file
diff --git a/Common_Class/SISAssem/ReadMe.txt b/Common_Class/SISAssem/ReadMe.txt
new file mode 100644
index 0000000..f79c426
--- /dev/null
+++ b/Common_Class/SISAssem/ReadMe.txt
@@ -0,0 +1,56 @@
+锘�========================================================================
+    MFC 霛检澊敫岆煬毽� : SISAssem 頂勲鞝濏姼 臧滌殧
+========================================================================
+
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 鞚� SISAssem DLL鞚� 毵岆摛鞐堨姷雼堧嫟.  鞚� DLL鞚�
+MFC鞚� 旮半掣 靷毄氩曥潉 氤挫棳 欷� 肟愲 鞎勲媹霛� DLL鞚� 鞛戩劚頃橁赴 鞙勴暅 旮半掣 甑“毳� 鞝滉车頃╇媹雼�.
+
+鞚� 韺岇澕鞐愲姅 SISAssem DLL鞚� 甑劚頃橂姅 臧� 韺岇澕鞐� 雽�頃�
+鞖旍暯 靹る獏鞚� 韽暔霅橃柎 鞛堨姷雼堧嫟.
+
+SISAssem.vcproj
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靸濎劚頃� VC++ 頂勲鞝濏姼鞚� 旮半掣 頂勲鞝濏姼 韺岇澕鞛呺媹雼�.
+    韺岇澕鞚� 靸濎劚頃� Visual C++ 氩勳爠鞐� 雽�頃� 鞝曤炒鞕�
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靹犿儩頃� 頂岆灚韽�, 甑劚 氚� 頂勲鞝濏姼 旮半姤鞐� 雽�頃�
+    鞝曤炒臧� 霌れ柎 鞛堨姷雼堧嫟.
+
+SISAssem.cpp
+    DllMain()鞚� 鞝曥潣霅橃柎 鞛堧姅 旮半掣 DLL 靻岇姢
+    韺岇澕鞛呺媹雼�.
+
+SISAssem.rc
+    頂勲攴鸽灗鞐愳劀 靷毄頃橂姅 氇摖 Microsoft Windows 毽唽鞀れ潣
+    氇╇鞛呺媹雼�.  鞐赴鞐愲姅 RES 頃橃渼 霐旊爥韯半Μ鞐� 鞝�鞛ル悳 鞎勳澊旖�, 牍勴姼毵� 氚� 旎れ劀臧�
+    韽暔霅╇媹雼�.  鞚� 韺岇澕鞚� Microsoft Visual C++鞐愳劀 歆侅爲 韼胳頃� 靾�
+    鞛堨姷雼堧嫟.
+
+res\SISAssem.rc2
+    鞚� 韺岇澕鞐愲姅 Microsoft Visual C++ 鞚挫櫢鞚� 雼るジ 霃勱惮鞐愳劀 韼胳頃� 毽唽鞀り皜
+    韽暔霅橃柎 鞛堨姷雼堧嫟.  毽唽鞀� 韼胳旮半 韼胳頃� 靾� 鞐嗠姅 毽唽鞀る姅
+    氇憪 鞚� 韺岇澕 鞎堨棎 氚办箻頃挫暭 頃╇媹雼�.
+
+SISAssem.def
+    鞚� 韺岇澕鞐愲姅 Microsoft Windows鞐愳劀 鞁ろ枆霅橁赴 鞙勴暣 鞝滉车頃挫暭 頃橂姅
+    DLL鞐� 雽�頃� 鞝曤炒臧� 韽暔霅橃柎 鞛堨溂氅�,  DLL鞚� 鞚措 氚� 靹る獏瓿� 臧欖潃
+    毵り皽 氤�靾橁皜 鞝曥潣霅橃柎 鞛堨姷雼堧嫟.  霕愴暅 DLL鞐愳劀
+    頃垬霃� 雮措炒雰呺媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
+旮绊儉 響滌 韺岇澕:
+
+StdAfx.h, StdAfx.cpp
+    鞚� 韺岇澕鞚� 氙鸽Μ 旎错寣鞚茧悳 項る崝(PCH) 韺岇澕鞚� SISAssem.pch鞕�
+    氙鸽Μ 旎错寣鞚茧悳 順曥嫕(PCT) 韺岇澕鞚� StdAfx.obj毳� 牍岆摐頃橂姅 雿� 靷毄霅╇媹雼�.
+
+Resource.h
+    靸� 毽唽鞀� ID毳� 鞝曥潣頃橂姅 響滌 項る崝 韺岇澕鞛呺媹雼�.
+    Microsoft Visual C++鞐愳劀 鞚� 韺岇澕鞚� 鞚疥碃 鞐呺嵃鞚错姼頃╇媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
+旮绊儉 彀戈碃:
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 靷毄頃橂姅 "TODO:" 欤检劃鞚� 靷毄鞛愱皜 於旉皜頃橁卑雮� 靷毄鞛� 歆�鞝曧暣鞎� 頃橂姅
+靻岇姢 旖旊摐 攵�攵勳潉 雮橅儉雰呺媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/SISAssem/Resource.h b/Common_Class/SISAssem/Resource.h
new file mode 100644
index 0000000..ea227f6
--- /dev/null
+++ b/Common_Class/SISAssem/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by SISAssem.rc
+//
+
+// 促澜篮 货 俺眉俊 荤侩且 扁夯蔼涝聪促.
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	8000
+#define _APS_NEXT_CONTROL_VALUE		8000
+#define _APS_NEXT_SYMED_VALUE		8000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/SISAssem/SISAssem.cpp b/Common_Class/SISAssem/SISAssem.cpp
new file mode 100644
index 0000000..e956bdd
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssem.cpp
@@ -0,0 +1,1988 @@
+
+#include "stdafx.h"
+
+#include "BlobStorage.h"
+#include "ASGInspection.h"
+
+#include "StopWatch3.h"
+
+#include "Pad.h"
+#include <omp.h>
+
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#define CONV_SPR_MULTI	16
+#define CONV_SPR_SHIFT	4
+
+
+#include "SISAssem.h"
+//#include "Memory.h"
+#include "AssemParam.h"
+
+
+class CGammaPt
+{
+public:
+	int x, y;
+
+public:
+	static CGammaPt* FindLeft(int left, CGammaPt *pGamma, int start, int end, int GammaWidth)
+	{
+		if(left >= pGamma->x)
+		{
+			for(;start < end ; start++)
+			{
+				pGamma= pGamma+ 1;
+				if(left <= pGamma->x)
+					return pGamma- 1;
+			}
+			return NULL;
+		}
+
+		for(; start > 0; start--)
+		{
+			pGamma= pGamma+ 1;
+			if(left >= pGamma->x)
+				return pGamma;
+		}
+		return NULL;
+	}
+
+	static CGammaPt* FindTop(int top, CGammaPt *pGamma, int start, int end, int GammaWidth)
+	{
+		if(top >= pGamma->y)
+		{
+			for(;start < end ; start++)
+			{
+				pGamma= pGamma+ GammaWidth;
+				if(top <= pGamma->y)
+					return pGamma- GammaWidth;
+			}
+			return NULL;
+		}
+
+		for(; start > 0; start--)
+		{
+			pGamma= pGamma+ GammaWidth;
+			if(top >= pGamma->y)
+				return pGamma;
+		}
+		return NULL;
+	}
+};
+
+
+extern "C"{
+	int ConvFloat_BOE(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloat(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloat6(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloat9(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloatVert_BOE(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 i2Pitch16, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloatVert(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 i2Pitch16, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloatVert6(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 i2Pitch16, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloatVert9(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 i2Pitch16, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloatDPC_BOE(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, __int64 bReverseFilter, short* piPitch, short* pfSPR, short* psSPR
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloatDPC(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, __int64 bReverseFilter, short* piPitch, short* pfSPR, short* psSPR
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloatDPC6(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, __int64 bReverseFilter, short* piPitch, short* pfSPR, short* psSPR
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 ThresholdSlide, int* endLine
+		);
+	int ConvFloatDPCOld(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, __int64 frameWidth, short* piPitch, short* pfSPR, short* psSPR
+		, __int64 Threshold, __int64 Suppress, __int64 SPR, __int64 ShiftCount
+		, __int64 iPitch, __int64 bReverseFilter
+		);
+	// 	int ConvVert(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+	// 		, __int64 left, __int64 right, __int64 top, __int64 bottom
+	// 		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+	// 		, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+	// 		, __int64 Threshold, __int64 Suppress, __int64 SPR, __int64 ShiftCount
+	// 		, short* pScanBuf
+	// 		);
+	int ConvFloatVTD_BOE(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, short*  i2Pitch16, __int64 tilt16, int* PitchBuff, __int64 ThresholdSlide
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, int* endLine
+		);
+	int ConvFloatVTD(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, short*  i2Pitch16, __int64 tilt16, int* PitchBuff, __int64 ThresholdSlide
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, int* endLine
+		);
+}
+
+extern "C"{
+	int ConvZone2(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+		, short* ZoneAddTable, __int64 bUseUnpair, int* endLine, __int64 Suppress
+		);
+	int ConvZoneDPC2(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, short* iPitch, short* fSPR, short* sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 bReverseFilter, __int64 iPitch16
+		, __int64 yZoneByte, short* ZoneAddTable, __int64 bUseUnpair, int* endLine
+		, __int64 Suppress
+		);
+	int ConvZoneVert2(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+		, __int64 Suppress
+		);
+	int ConvZoneVert2S(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+		, __int64 ExTh, __int64 Suppress
+		);
+	int ConvZoneVert2S_BOE(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+		, __int64 ExTh, __int64 Suppress
+		);
+	int ConvZoneVert2S2b2(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+		, __int64 ExTh, __int64 Suppress
+		);
+	int ConvZoneMVert2S(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+		, short* ZoneSecond, short* ZoneThTable2, short* ZoneAddTable2, __int64 Suppress
+		);
+
+	int ConvZoneVertMS(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+		, __int64 Suppress
+		);
+	int ConvZoneVTD(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, int* piPitch16, __int64 iPitch16, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, __int64 Tilt16, __int64 bUseUnpair, int* endLine
+		, __int64 ExTh, __int64 Suppress
+		);
+	int ConvZoneVTD_BOE(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, int* piPitch16, __int64 iPitch16, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, __int64 Tilt16, __int64 bUseUnpair, int* endLine
+		, __int64 ExTh, __int64 Suppress
+		);
+	// Zg= Gamma Zone, Sp= Speedup, Vt= Vertical, Sk= Skip Block, B1= 1by1
+	int ConvZgSpVtSkB1(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+		, __int64 ExTh, __int64 Suppress
+		);
+	// Zg= Gamma Zone, Sp= Speedup, Vt= Vertical, Sk= Skip Block, B2= 2by2
+	int ConvZgSpVtSkB2(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+		, __int64 ExTh, __int64 Suppress
+		);
+	// 	int ConvZoneVTDS(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+	// 		, __int64 left, __int64 right, __int64 top, __int64 bottom
+	// 		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+	// 		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+	// 		, __int64 frameWidth, int* piPitch16, __int64 iPitch16, __int64 sSPR
+	// 		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+	// 		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+	// 		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+	// 		, short* ZoneAddTable, __int64 Tilt16, short* pConBuff, __int64 bUseUnpair
+	// 		, int* endLine, __int64 Suppress
+	// 		);
+}
+
+extern "C"{
+	int ConvPixel(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, int* endLine
+		);
+	int ConvPixelDPC(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, short* iPitch, short* fSPR, short* sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, __int64 iPitch16
+		, int* endLine
+		);
+
+	int ConvPixelVert(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+		, int* endLine
+		);
+	int ConvPixelVertS(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+		, int* endLine, __int64 ExTh
+		);
+	int ConvPixelVertSBW(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+		, int* endLine, __int64 s_nBWB_Main, __int64 s_nBWB_Slide
+		);
+	int ConvPixelVertSBW_BOE(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+		, int* endLine, __int64 s_nBWB_Main, __int64 s_nBWB_Slide
+		);
+	int ConvPixelVertMS(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+		, int* endLine
+		);
+	int ConvPixelVTDS(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, int* piPitch16, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+		, int* endLine, __int64 ExTh
+		);
+	int ConvPixelVTDSBW(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, int* piPitch16, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+		, int* endLine, __int64 s_nBWB_Main, __int64 s_nBWB_Slide
+		);
+	int ConvPixelVTDSBW_BOE(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, int* piPitch16, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+		, int* endLine, __int64 s_nBWB_Main, __int64 s_nBWB_Slide
+		);
+}
+
+extern "C"{
+	int ConvTrapezium(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 top, __int64 bottom, __int64 left1, __int64 left2
+		, __int64 right1, __int64 right2, __int64 Threshold, __int64 Suppress
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, __int64 ShiftCount, __int64 iPitch, __int64 fSPR, __int64 sSPR
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth , int* PitchBuff, __int64 bUseUnpair
+		);
+	int ConvTrapezium_Vert(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 leftTop, __int64 leftBottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+		, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+		, __int64 i2Pitch16, __int64 rightTop, __int64 rightBottom, int* PitchBuff
+		, __int64 hPitch16, __int64 bUseUnpair
+		);
+};
+
+CSISAssem::CSISAssem(void)
+{
+	m_pAssemControl= NULL;
+	ResetReinspectCount();
+}
+
+CSISAssem::~CSISAssem(void)
+{
+	if(m_pAssemControl)
+		delete m_pAssemControl;
+}
+
+BOOL CSISAssem::EnableInternalThread(int nThrea, int maxDefect)
+{
+	if(m_pAssemControl == NULL)
+	{
+		m_pAssemControl= new CAssemThreadControl;
+		m_pAssemControl->InitAssemThreadControl(nThrea, maxDefect);
+	}
+	return TRUE;
+}
+
+BOOL CSISAssem::InitAssem(int iThread, int maxDefect)
+{
+	// iThread
+	m_iThread= iThread;
+
+	int max2= maxDefect;
+	if(max2 < 80000)
+		max2= 80000;
+
+	// Max Defect
+	if(CPixelStorage::InitPixelStorage(max2<<1) < 1)
+		return FALSE;
+	if(CPairStorage::InitPairStorage(max2<<1) < 1)
+		return FALSE;
+	if(CBlobStorage::InitBlobStorage(maxDefect) < 1)
+		return FALSE;
+
+	return TRUE;
+}
+
+void CSISAssem::ResetConBuff(int &InspSize)
+{
+	if(InspSize < 1) InspSize= 1;
+	int		nSize = (InspSize+ 32)*16;
+	m_ConvBlock.SetBlockSize(nSize);		// vert狼 版快 16硅狼 Conv Buff啊 鞘夸窍促.
+	m_ConvBlock2.SetBlockSize(nSize);
+	memset(m_ConvBlock.GetDataAddr(), 0, m_ConvBlock.GetValidDataSpace()*sizeof(short));	
+	memset(m_ConvBlock2.GetDataAddr(), 0, m_ConvBlock2.GetValidDataSpace()*sizeof(short));
+}
+
+DIT_RESULT	CSISAssem::Inspect_Rect(CConvParam *pParam)
+{
+	DIT_RESULT rslt= DIT_CONV_SUCCESS;
+	BOOL	bPassInspect;
+	CStopWatch stopWatch;
+	stopWatch.Start();
+	SetConvParam(pParam);
+
+
+	//ResetSISAssem();
+	CPixelStorage::ResetPixelStorage();
+	CPairStorage::ResetPairStorage();
+
+
+	if(m_Param.m_ConvDir == ConvDir_Vert)
+	{
+		rslt= CheckParameter_Vert(bPassInspect);
+		if(rslt != DIT_CONV_SUCCESS  || bPassInspect)
+			return rslt;
+	}else
+	{
+		rslt= CheckParameter(bPassInspect);
+		if(rslt != DIT_CONV_SUCCESS  || bPassInspect)
+			return rslt;
+	}
+
+	int endLine;
+	if(m_Param.s_psZoneThTable)
+	{
+		endLine= Compare_Zone2();// Zone 喊 促捞唱雇 Threshold 眠啊等 滚傈.
+		if(!m_Param.IsAllInspected(endLine) && m_cReinspect < m_Param.m_ReinspectCount)
+		{
+			rslt= DIT_CONV_FRAMEOVERFLOW;
+			CountReinspect();
+			CGammaPt *pGamma= (CGammaPt*)m_Param.m_pGammaTable;
+			if(m_Param.m_ConvDir == ConvDir_Hori)
+			{
+				m_Param.s_RectConv.top= endLine;
+				pGamma= CGammaPt::FindTop(endLine, pGamma, 4, 2000, m_Param.m_nGammaXCount);
+			}else
+			{
+				m_Param.s_RectConv.left= endLine;
+				pGamma= CGammaPt::FindLeft(endLine, pGamma, 4, m_Param.m_nGammaXCount, m_Param.m_nGammaXCount);
+			}
+
+			if(pGamma == NULL)
+				return rslt;
+
+			m_Param.m_pGammaTable= (void*) pGamma;
+			Inspect_Rect(&m_Param);
+		}
+	}
+	else
+	{
+		if(m_Param.m_ConvMode == ConvMode_Pixel)
+		{
+			endLine= Compare_Pixel();
+			if(!m_Param.IsAllInspected(endLine) && m_cReinspect < m_Param.m_ReinspectCount)
+			{
+				rslt= DIT_CONV_FRAMEOVERFLOW;
+				CountReinspect();
+				if(m_Param.m_ConvDir == ConvDir_Hori)
+				{
+					m_Param.s_RectConv.top= endLine;
+				}else
+				{
+					m_Param.s_RectConv.left= endLine;
+				}
+				Inspect_Rect(&m_Param);
+			}
+		}
+		else if(m_Param.m_ConvMode == ConvMode_Float)
+		{
+			endLine= Compare_Float();
+			if(!m_Param.IsAllInspected(endLine) && m_cReinspect < m_Param.m_ReinspectCount)
+			{
+				rslt= DIT_CONV_FRAMEOVERFLOW;
+				CountReinspect();
+				if(m_Param.m_ConvDir == ConvDir_Hori)
+				{
+					m_Param.s_RectConv.top= endLine;
+				}else
+				{
+					m_Param.s_RectConv.left= endLine;
+				}
+				Inspect_Rect(&m_Param);
+			}
+		}
+		else if(m_Param.m_ConvMode == ConvMode_Binalize)
+		{
+			endLine= BinalizeInspection();
+			if(!m_Param.IsAllInspected(endLine) && m_cReinspect < m_Param.m_ReinspectCount)
+			{
+				rslt= DIT_CONV_FRAMEOVERFLOW;
+				CountReinspect();
+				if(m_Param.m_ConvDir == ConvDir_Hori)
+				{
+					m_Param.s_RectConv.top= endLine;
+				}else
+				{
+					m_Param.s_RectConv.left= endLine;
+				}
+				Inspect_Rect(&m_Param);
+			}
+		}
+	}
+
+	stopWatch.End();
+	m_ConvTime= stopWatch.GetDurationMilliSecond();
+
+	if(m_nPair > m_maxPair)
+		rslt= DIT_CONV_FRAMEOVERFLOW;
+
+	return rslt;
+}
+
+DIT_RESULT	CSISAssem::Inspect_RectThread(CConvParam *pParam)
+{
+
+	DIT_RESULT rslt= DIT_CONV_SUCCESS;
+
+	if(m_pAssemControl == NULL)
+		return DIT_CONV_INVALIDPARAM;
+
+#define	AT_GOOD_SIZE	2000	// 乔摹俊 措茄 绊妨啊 鞘夸 绝绰 捞蜡绰 Vertical 规氢俊辑父 Thread盒扁 八荤啊 捞风绢柳促.
+#define AT_MIN_SIZE		64	// 弥家 八荤 呈厚
+
+	int totalSize;//= pParam->s_RectConv.Width();
+	int ThreadCount;
+	int ThreadSize;
+
+	int left;//= pParam->s_RectConv.left;
+	int right;//= pParam->s_RectConv.right;
+
+	// ConvDir_Hori 绰 Thread 盒且 救 茄促. 加档啊 面盒窍聪鳖...
+	// ConvDir_Hori 阑 Thread 盒且 窍妨搁 width 扁馆捞 酒囱 Height 扁馆栏肺 康开 技盒拳 秦具茄促.
+	if(pParam->m_ConvDir == ConvDir_Vert)
+	{
+		totalSize= pParam->s_RectConv.Width();
+		left= pParam->s_RectConv.left;
+		right= pParam->s_RectConv.right;
+	}else
+	{
+		totalSize= pParam->s_RectConv.Height();
+		left= pParam->s_RectConv.top;
+		right= pParam->s_RectConv.bottom;
+	}
+
+	ThreadCount= totalSize/AT_GOOD_SIZE;
+
+	if(ThreadCount > m_pAssemControl->GetThreadCount())
+	{
+		ThreadCount= m_pAssemControl->GetThreadCount();
+	}else if(ThreadCount < 1)
+	{
+		// Thread 盒且捞 鞘夸 绝阑 锭绰 OpenMP甫 荤侩窍瘤 臼绊 官肺 八荤.
+		ThreadCount= 1;
+		return Inspect_Rect(pParam);
+	}
+
+	ThreadSize= (int)((float)totalSize/ThreadCount);
+	ThreadSize= ThreadSize/AT_MIN_SIZE*AT_MIN_SIZE;
+
+	CConvParam convParam;
+	CSISAssem *pSISAssem;
+	omp_set_num_threads(ThreadCount);
+	int count= 0;
+#pragma omp parallel for private(convParam)
+	for(int iThread= 0; iThread < ThreadCount; iThread++)
+	{
+		convParam= *pParam;
+		convParam.s_RectConv.left= left+ ThreadSize*iThread;
+		if(iThread == ThreadCount- 1)
+		{
+			convParam.s_RectConv.right= right;
+		}else
+		{
+			convParam.s_RectConv.right= convParam.s_RectConv.left+ ThreadSize;
+		}
+
+		m_pAssemControl->Inspect_RectThread(iThread, &convParam);
+		count++;
+	}
+
+
+	ResetSISAssem();
+	// 阿 Thread 扳荤 搬苞 眠免秦坷扁.
+	for(int iThread= 0; iThread < ThreadCount; iThread++)
+	{
+		pSISAssem= m_pAssemControl->GetSISAssemThread(iThread);
+		if(pSISAssem->m_BlobTime > m_BlobTime)
+			m_BlobTime= pSISAssem->m_BlobTime;
+		if(pSISAssem->m_ConvTime > m_ConvTime)
+			m_ConvTime= pSISAssem->m_ConvTime;
+		m_nPair+= pSISAssem->m_nPair;
+		ReadBlob(pSISAssem);
+	}
+
+	if(m_nPair > m_maxPair)
+		rslt= DIT_CONV_FRAMEOVERFLOW;
+
+	return rslt;
+}
+
+DIT_RESULT	CSISAssem::Inspect_Trapezium(CConvParam *pParam)
+{
+	DIT_RESULT rslt= DIT_CONV_SUCCESS;
+	BOOL	bPassInspect;
+	SetConvParam(pParam);
+
+	ResetSISAssem();
+
+	if(m_Param.m_ConvDir == ConvDir_Vert)
+	{
+		rslt= CheckParameter_Vert(bPassInspect);
+		if(rslt != DIT_CONV_SUCCESS  || bPassInspect)
+			return rslt;
+	}else
+	{
+		rslt= CheckParameter(bPassInspect);
+		if(rslt != DIT_CONV_SUCCESS  || bPassInspect)
+			return rslt;
+	}
+
+	m_Param.m_bUseUnpair= FALSE;// Trapezium 俊辑绰 Unpair 搬窃阑 荤侩窍瘤 臼绰促.
+	m_Param.m_bOnlyJumpFilter	= TRUE;		// mandatory for ASG Inspection.
+	Compare_Trapezium();
+
+	if(m_nPair > m_maxPair)
+		return DIT_CONV_FRAMEOVERFLOW;
+
+	return rslt;
+}
+
+DIT_RESULT CSISAssem::Inspect_ASG(CConvParam *pParam)
+{
+	DIT_RESULT	rslt= DIT_CONV_SUCCESS;
+	BOOL		bPassInspect;
+	CStopWatch stopWatch;
+
+	stopWatch.Start();
+	SetConvParam(pParam);
+
+	ResetSISAssem();
+
+	if(m_Param.m_ConvDir == ConvDir_Vert)
+	{
+		rslt= CheckParameter_Vert(bPassInspect);
+		if(rslt != DIT_CONV_SUCCESS  || bPassInspect)
+			return rslt;
+	}else
+	{
+		rslt= CheckParameter(bPassInspect);
+		if(rslt != DIT_CONV_SUCCESS  || bPassInspect)
+			return rslt;
+	}
+
+	m_Param.m_bUseUnpair		= FALSE;	// mandatory for ASG Inspection. but, We could lose 'unpair defect' only in horizontal Inspection Mode.
+	m_Param.m_bOnlyJumpFilter	= TRUE;		// mandatory for ASG Inspection.
+
+	if(m_Param.s_psZoneThTable != NULL)
+		Compare_ASGZone();
+	else
+		Compare_Pixel();
+
+	if(m_nPair > m_maxPair)
+		return DIT_CONV_FRAMEOVERFLOW;
+
+	return rslt;
+}
+
+int CSISAssem::Compare_ASGZone()
+{
+	double xpitch	= m_Param.GetRealConvPitch();
+	double ypitch	= m_Param.GetRealScanPitch();
+	int	oldBlob		= m_nBlob;
+	int	endLine;
+
+	if(m_Param.m_ConvDir == ConvDir_Hori)
+	{
+		endLine= m_Param.s_RectConv.right;
+		if(m_Param.m_pPitch)
+		{
+			m_nPair= ConvZoneDPC2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4 
+				, m_Param.s_nFrameWidth, m_Param.m_pPitch, m_Param.m_pfSPR, m_Param.m_psSPR				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) xpitch, (__int64) INT_MAX, (__int64) m_Param.s_bReverseFilter, (__int64)(xpitch*16)
+				, m_Param.m_nGammaXCount*8, m_Param.s_psZoneAddTable, (__int64) m_Param.m_bUseUnpair, &endLine
+				, m_Param.s_nThresholdSupress
+				);
+		}else
+		{
+			m_nPair= ConvZone2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, (__int64)(xpitch*16), 0, 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) xpitch, (__int64) INT_MAX, (__int64) m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_psZoneAddTable, (__int64)m_Param.m_bUseUnpair, &endLine, m_Param.s_nThresholdSupress
+				);
+		}
+		CBlobStorage::BlobDefect();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+
+		return endLine;
+	}
+
+	endLine= m_Param.s_RectConv.bottom;
+	int nSize= m_Param.s_RectConv.Height()*4;
+	ResetConBuff(nSize);
+	if(m_Param.m_bVertSpeedup == 0)
+	{
+		m_nPair= ConvZoneVert2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+			, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+			, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, INT_MAX, (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+			, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+			, m_Param.s_nThresholdSupress
+			);
+	}else//if(m_Param.m_bVertSpeedup == 0)
+	{
+		if(m_Param.m_bZoneMulti && m_Param.s_psZoneMMinTable)
+		{
+			m_nPair= ConvZoneMVert2S(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, INT_MAX, (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+				, m_Param.s_psZoneMMinTable, m_Param.s_psZoneMThTable, m_Param.s_psZoneMAddTable, m_Param.s_nThresholdSupress
+				);
+		}else
+		{
+			if(m_Param.m_bZone2B2)
+			{
+				m_nPair= ConvZoneVert2S2b2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+					, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+					, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+					, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+					, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+					, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+					, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+					, INT_MAX, (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+					, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+					, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+					);
+			}else
+			{
+				m_nPair= ConvZoneVert2S_BOE(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+					, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+					, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+					, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+					, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+					, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+					, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+					, INT_MAX, (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+					, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+					, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+					);
+			}
+		}
+	}
+	CBlobStorage::BlobDefectVert();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilterVert(oldBlob, m_Param.GetRealScanPitch());
+
+	return endLine;
+}
+
+int	CSISAssem::Compare_Zone2()
+{
+	double xpitch= m_Param.GetRealConvPitch();
+	double ypitch= m_Param.GetRealScanPitch();
+	int		oldBlob= m_nBlob;
+	int		endLine;
+
+	if(m_Param.m_ConvDir == ConvDir_Hori)
+	{
+		endLine= m_Param.s_RectConv.bottom;
+		if(m_Param.m_pPitch)
+		{
+			m_nPair= ConvZoneDPC2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4 
+				, m_Param.s_nFrameWidth, m_Param.m_pPitch, m_Param.m_pfSPR, m_Param.m_psSPR				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), (__int64) m_Param.s_bReverseFilter, (__int64)(xpitch*16)
+				, m_Param.m_nGammaXCount*8, m_Param.s_psZoneAddTable, (__int64) m_Param.m_bUseUnpair, &endLine
+				, m_Param.s_nThresholdSupress
+				);
+		}else
+		{
+			m_nPair= ConvZone2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, (__int64)(xpitch*16), 0, 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), (__int64) m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_psZoneAddTable, (__int64)m_Param.m_bUseUnpair, &endLine, m_Param.s_nThresholdSupress
+				);
+		}
+		CBlobStorage::BlobDefect();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+
+		return endLine;
+	}//if(m_Param.m_ConvDir == ConvDir_Hori)
+
+	//if(m_Param.m_ConvDir == ConvDir_Vert)
+	endLine= m_Param.s_RectConv.right;
+
+	int nSize= m_Param.s_RectConv.Height()*4;
+	ResetConBuff(nSize);
+	if(m_Param.m_pPitch16)
+	{
+		if(m_Param.m_bIntrinsic)
+		{
+			m_nPair= ConvZoneVTD_BOE_Intrin(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, m_Param.m_pPitch16, (__int64)(ypitch*16), 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_psZoneAddTable, (__int64)(m_Param.m_fTilt*16), (__int64)m_Param.m_bUseUnpair, &endLine
+				, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+				);
+		}
+		else
+		{
+			m_nPair= ConvZoneVTD_BOE(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, m_Param.m_pPitch16, (__int64)(ypitch*16), 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_psZoneAddTable, (__int64)(m_Param.m_fTilt*16), (__int64)m_Param.m_bUseUnpair, &endLine
+				, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+				);
+		}
+
+		CBlobStorage::BlobDefectVert();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		CBlobStorage::ShadowFilterVert(oldBlob, m_Param.GetRealScanPitch());
+
+		return endLine;
+	}//if(m_Param.m_pPitch16)
+
+	if(m_Param.m_fTilt == 0)
+	{
+		if(m_Param.m_bVertSpeedup == 0)
+		{
+			m_nPair= ConvZoneVert2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_psZoneAddTable, GetConBuffComp(), (__int64) m_Param.m_bUseUnpair, &endLine
+				, m_Param.s_nThresholdSupress
+				);
+		}else//if(m_Param.m_bVertSpeedup == 0)
+		{
+			if(m_Param.m_bZoneMulti && m_Param.s_psZoneMMinTable)
+			{
+				m_nPair= ConvZoneMVert2S(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+					, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+					, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+					, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+					, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+					, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+					, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+					, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+					, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+					, m_Param.s_psZoneMMinTable, m_Param.s_psZoneMThTable, m_Param.s_psZoneMAddTable, m_Param.s_nThresholdSupress
+					);
+			}else if(m_Param.m_bSkipBlock)
+			{
+				if(m_Param.m_bZone2B2)
+				{
+					m_nPair= ConvZgSpVtSkB2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*12, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+						, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+						);
+				}else
+				{
+					m_nPair= ConvZgSpVtSkB1(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*12, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+						, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+						);
+				}
+			}else
+			{
+				if(m_Param.m_bZone2B2)
+				{
+					m_nPair= ConvZoneVert2S2b2(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+						, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+						);
+				}else
+				{
+					if(m_Param.m_bIntrinsic)
+					{
+						if(m_Param.m_pSpeedZoneTh != NULL)
+						{
+							m_nPair= ConvZoneVert2S_TSP_Intrin(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+								, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+								, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+								, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+								, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+								, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+								, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+								, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+								, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+								, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+								);
+						}
+						else if(m_Param.s_nBWB_Main > 0)
+						{
+							m_nPair= ConvZoneVert2S_BlackFilter(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+								, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+								, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+								, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+								, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+								, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+								, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+								, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+								, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+								, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+								);
+						}
+						else
+						{
+							m_nPair= ConvZoneVert2S_BOE_Intrin(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+								, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+								, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+								, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+								, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+								, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+								, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+								, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+								, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+								, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+								);
+						}
+					}
+					else
+					{
+						m_nPair= ConvZoneVert2S_BOE(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+							, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+							, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+							, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+							, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+							, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+							, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+							, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+							, m_Param.s_psZoneAddTable, GetConBuffComp(), m_Param.m_bUseUnpair, &endLine
+							, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+							);
+					}
+				}
+			}
+		}
+	}else//if(m_Param.m_fTilt == 0)
+	{
+
+		if(m_Param.m_bIntrinsic)
+		{
+			m_nPair= ConvZoneVTD_BOE_Intrin(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, m_Param.m_pPitch16, (__int64)(ypitch*16), 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_psZoneAddTable, (__int64)(m_Param.m_fTilt*16), (__int64)m_Param.m_bUseUnpair, &endLine
+				, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+				);
+		}
+		else
+		{
+			m_nPair= ConvZoneVTD_BOE(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, m_Param.m_pPitch16, (__int64)(ypitch*16), 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_psZoneAddTable, (__int64)(m_Param.m_fTilt*16), (__int64)m_Param.m_bUseUnpair, &endLine
+				, m_Param.m_EdgeFilterTh, m_Param.s_nThresholdSupress
+				);
+		}
+
+
+	}//if(m_Param.m_fTilt == 0) else
+	CBlobStorage::BlobDefectVert();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilterVert(oldBlob, m_Param.GetRealScanPitch());
+
+	return endLine;
+}
+
+int	CSISAssem::Compare_Pixel()
+{
+	double xpitch= m_Param.GetRealConvPitch();
+	double ypitch= m_Param.GetRealScanPitch();
+
+	int		oldBlob= m_nBlob;
+	int endLine;
+
+
+	// ASG 八荤俊辑绰 Unpair甫 荤侩窍瘤 臼绊, Active俊辑绰 Unpair甫 荤侩茄促(Cross Filter肺 Filtering 且 巴捞扁 锭巩俊)
+
+	if(m_Param.m_ConvDir == ConvDir_Vert)
+	{
+		endLine= m_Param.s_RectConv.right;
+		int nSize= m_Param.s_RectConv.Height()*4;
+		ResetConBuff(nSize);
+
+		if(m_Param.m_pPitch16)
+		{
+
+			if(m_Param.m_bIntrinsic)
+			{
+				m_nPair= ConvPixelVTDS_Intrin(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+					, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+					, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+					, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+					, m_Param.s_nFrameWidth, (__int64)(ypitch*16), m_Param.m_pPitch16, 0				// 4
+					, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+					, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+					, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+					, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, GetConBuffComp()
+					, &endLine, m_Param.m_EdgeFilterTh
+					);
+			}
+			else
+			{
+				if(m_Param.s_nBWB_Main > 0)
+				{
+					m_nPair= ConvPixelVTDSBW_BOE(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), m_Param.m_pPitch16, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, GetConBuffComp()
+						, &endLine, m_Param.s_nBWB_Main, m_Param.s_nBWB_Slide
+						);
+				}
+				else
+				{
+					m_nPair= ConvPixelVTDS(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), m_Param.m_pPitch16, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, GetConBuffComp()
+						, &endLine, m_Param.m_EdgeFilterTh
+						);
+				}
+			}
+		}else if(m_Param.m_bVertSpeedup == 0)
+		{
+			m_nPair= ConvPixelVert(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, GetConBuffComp()
+				, &endLine
+				);
+		}
+		else
+		{
+
+			if(m_Param.m_bIntrinsic)
+			{
+				if(m_Param.s_bUse2ndInspection)
+				{
+					m_nPair= ConvPixelVertS_Intrin_Twice(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, GetConBuffComp()
+						, &endLine, m_Param.m_EdgeFilterTh, (__int64)(m_Param.s_d2ndPitch*16), m_Param.s_n2ndThres
+						, m_Param.s_n2ndThresSlide
+						);
+
+					return endLine;
+				}
+				else
+				{
+					m_nPair= ConvPixelVertS_Intrin(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, GetConBuffComp()
+						, &endLine, m_Param.m_EdgeFilterTh
+						);
+				}
+			}
+			else
+			{
+				if(m_Param.s_nBWB_Main > 0)
+				{
+					m_nPair= ConvPixelVertSBW_BOE(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, GetConBuffComp()
+						, &endLine, m_Param.s_nBWB_Main, m_Param.s_nBWB_Slide
+						);
+				}
+				else
+				{
+					m_nPair= ConvPixelVertS(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+						, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+						, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+						, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, GetConBuffComp()
+						, &endLine, m_Param.m_EdgeFilterTh
+						);
+				}
+			}
+		}
+
+		CBlobStorage::BlobDefectVert();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		CBlobStorage::ShadowFilterVert(oldBlob, m_Param.GetRealScanPitch());
+		return endLine;
+	}
+
+	endLine= m_Param.s_RectConv.bottom;
+	if(m_Param.m_pPitch)
+	{
+		m_nPair= ConvPixelDPC(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+			, m_Param.s_nFrameWidth, m_Param.m_pPitch, m_Param.m_pfSPR, m_Param.m_psSPR				// 4
+			, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+			, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, (__int64)(m_Param.GetRealConvPitch()*16)
+			, &endLine
+			);
+
+		CBlobStorage::BlobDefect();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+
+		return endLine;
+	}
+
+	if(m_Param.m_bIntrinsic)
+	{
+		if(m_Param.s_bUse2ndInspection)
+		{
+			m_nPair= ConvPixel_Intrin_Twice(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, (__int64)(xpitch*16), 0, 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, &endLine
+				, (__int64)(m_Param.s_d2ndPitch*16), m_Param.s_n2ndThres, m_Param.s_n2ndThresSlide);
+
+			return endLine;
+		}
+		else
+		{
+			m_nPair= ConvPixel_Intrin(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+				, m_Param.s_nFrameWidth, (__int64)(xpitch*16), 0, 0				// 4
+				, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+				, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, &endLine);
+		}
+	}
+	else
+	{
+		m_nPair= ConvPixel(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+			, m_Param.s_nFrameWidth, (__int64)(xpitch*16), 0, 0				// 4
+			, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+			, m_Param.s_nDThSlide, m_Param.s_nThresholdSupress, m_Param.m_bUseUnpair, &endLine
+			);
+	}
+
+	CBlobStorage::BlobDefect();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+
+	return endLine;
+}
+
+int	CSISAssem::Compare_Float()
+{
+	double xPitch= m_Param.GetRealConvPitch();
+	double yPitch= m_Param.GetRealScanPitch();
+	int		oldBlob;
+	oldBlob= m_nBlob;
+
+	int endLine;
+
+	int ConvSize= m_Param.s_nConvWidth*m_Param.s_nConvHeight;
+
+	if(m_Param.m_ConvDir == ConvDir_Vert)
+	{
+		endLine= m_Param.s_RectConv.right;
+		int nSize= m_Param.s_RectConv.Height();
+		ResetConBuff(nSize);
+		if(m_Param.m_fTilt == 0.0 && m_Param.m_pPitch16 == NULL)
+		{
+			if(ConvSize == 4)
+			{
+				if(m_Param.m_bIntrinsic)
+				{
+					m_nPair= ConvFloatVert_BOE_Intrin(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, m_Param.s_nFrameWidth, (__int64)(yPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+						, (__int64)(yPitch*2*16+ 0.5), (__int64) m_Param.s_bReverseFilter, m_Param.s_nDThSlide, &endLine
+						);
+				}
+				else
+				{
+					m_nPair= ConvFloatVert_BOE(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, m_Param.s_nFrameWidth, (__int64)(yPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+						, (__int64)(yPitch*2*16+ 0.5), (__int64) m_Param.s_bReverseFilter, m_Param.s_nDThSlide, &endLine
+						);
+				}
+			}else if(ConvSize == 6)
+			{
+				m_nPair= ConvFloatVert6(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+					, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+					, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+					, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+					, m_Param.s_nFrameWidth, (__int64)(yPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+					, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+					, (__int64)(yPitch*2*16+ 0.5), (__int64) m_Param.s_bReverseFilter, m_Param.s_nDThSlide, &endLine
+					);
+			}else
+			{
+				m_nPair= ConvFloatVert9(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+					, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+					, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+					, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+					, m_Param.s_nFrameWidth, (__int64)(yPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+					, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+					, (__int64)(yPitch*2*16+ 0.5), (__int64) m_Param.s_bReverseFilter, m_Param.s_nDThSlide, &endLine
+					);
+			}
+		}else
+		{
+			if(ConvSize == 4)
+			{
+				__int64 tilt16= (__int64)(m_Param.m_fTilt*16);
+				if(m_Param.m_bIntrinsic)
+				{
+					m_nPair= ConvFloatVTD_BOE_Intrin(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, m_Param.s_nFrameWidth, (__int64)(yPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+						, GetConBuffComp2(), tilt16, m_Param.m_pPitch16, m_Param.s_nDThSlide
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+						, &endLine
+						);
+				}
+				else
+				{
+					m_nPair= ConvFloatVTD_BOE(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+						, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+						, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+						, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+						, m_Param.s_nFrameWidth, (__int64)(yPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+						, GetConBuffComp2(), tilt16, m_Param.m_pPitch16, m_Param.s_nDThSlide
+						, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+						, &endLine
+						);
+				}
+			}
+		}
+		CBlobStorage::BlobDefectVert();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		CBlobStorage::ShadowFilterVert(oldBlob, yPitch);
+		return endLine;
+	}
+
+	endLine= m_Param.s_RectConv.bottom;
+
+	int			nSize = m_Param.s_RectConv.Width();
+	ResetConBuff(nSize);
+
+	if(m_Param.m_ConvMode == ConvMode_Binalize)
+	{
+		m_nPair= BinalizeInspection(m_Param.s_lpBuffer, 0, m_Param.s_nThreshold, m_Param.s_RectConv
+			, m_Param.s_nFrameWidth, m_pPairDefect, m_nPair, m_maxPair
+			, endLine);
+
+		CBlobStorage::BlobDefect();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		return endLine;
+	}
+
+
+	if(m_Param.m_pPitch != NULL)
+	{
+		if(ConvSize == 4)
+		{
+			m_nPair= ConvFloatDPC_BOE(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, m_Param.s_nFrameWidth, (__int64)(xPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+				, (__int64) m_Param.s_bReverseFilter, m_Param.m_pPitch, m_Param.m_pfSPR, m_Param.m_psSPR
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+				, m_Param.s_nDThSlide, &endLine
+				);
+		}else
+		{
+			m_nPair= ConvFloatDPC6(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+				, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+				, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+				, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+				, m_Param.s_nFrameWidth, (__int64)(xPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+				, (__int64) m_Param.s_bReverseFilter, m_Param.m_pPitch, m_Param.m_pfSPR, m_Param.m_psSPR
+				, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+				, m_Param.s_nDThSlide, &endLine
+				);
+		}
+
+		CBlobStorage::BlobDefect();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+		return endLine;
+	}
+
+	if(ConvSize == 4)
+	{
+		m_nPair= ConvFloat_BOE(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, m_Param.s_nFrameWidth, (__int64)(xPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+			, (__int64) m_Param.s_bReverseFilter, m_Param.s_nDThSlide, &endLine
+			);
+	}else if(ConvSize == 6)
+	{
+		m_nPair= ConvFloat6(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, m_Param.s_nFrameWidth, (__int64)(xPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+			, (__int64) m_Param.s_bReverseFilter, m_Param.s_nDThSlide, &endLine
+			);
+	}else
+	{
+		m_nPair= ConvFloat9(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, m_Param.s_nFrameWidth, (__int64)(xPitch*16+ 0.5), m_Param.s_nThreshold, m_Param.s_nThresholdSupress
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh
+			, (__int64) m_Param.s_bReverseFilter, m_Param.s_nDThSlide, &endLine
+			);
+	}
+
+	CBlobStorage::BlobDefect();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+
+	return endLine;
+}
+
+int	CSISAssem::BinalizeInspection()
+{
+	int		oldBlob = m_nBlob;
+
+	int endLine = m_Param.s_RectConv.bottom;
+
+	m_nPair= BinalizeInspection(m_Param.s_lpBuffer, 0, m_Param.s_nThreshold, m_Param.s_RectConv
+		, m_Param.s_nFrameWidth, m_pPairDefect, m_nPair, m_maxPair
+		, endLine);
+
+	CBlobStorage::BlobDefect();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	return endLine;
+}
+
+void CSISAssem::InspectPAD_Clear()
+{
+	CPixelStorage::ResetPixelStorage();
+	CPairStorage::ResetPairStorage();
+}
+
+void CSISAssem::ResetSISAssem()
+{
+	// Reset 3 Storage (Blob, Pair, Pixel)
+	// 檬扁拳 矫埃 窜绵阑 困秦 TotalReset 拌凯 窃荐 眠啊. TotalReset篮 历厘家 傈眉甫 檬扁拳
+	// 咯扁辑绰 父甸绢柳 搬窃狼 俺荐 父怒父 Reset 茄促备府..
+	CPixelStorage::ResetPixelStorage();
+	CPairStorage::ResetPairStorage();
+	CBlobStorage::ResetBlobStorage();
+	m_ConvTime= 0;
+	m_BlobTime= 0;
+}
+
+
+void CSISAssem::Compare_Trapezium()
+{
+	double xPitch= m_Param.GetRealConvPitch();
+	double yPitch= m_Param.GetRealScanPitch();
+	int		oldBlob;
+	oldBlob= m_nBlob;
+	CPadPoint *TrapPoint= m_Param.m_Trapezium.m_TrapPoint;
+	if(m_Param.m_ConvDir == ConvDir_Vert)
+	{
+		int			nSize = m_Param.s_RectConv.Height();
+		ResetConBuff(nSize);		
+		// x绵 矫拌规氢俊辑 ChangeXY窃荐肺 y 绵. 单捞鸥甫 父电促. LeftTop扁霖 -馆矫拌规氢
+		m_nPair= ConvTrapezium_Vert(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel// 4
+			, TrapPoint[0].x, TrapPoint[3].x, TrapPoint[0].y, TrapPoint[1].y
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, m_Param.s_nFrameWidth, (__int64)(yPitch*16+ 0.5), m_Param.s_nThreshold<<CONV_SPR_SHIFT, m_Param.s_nThresholdSupress
+			, (__int64)(yPitch*2*16+ 0.5), TrapPoint[3].y, TrapPoint[2].y, m_Param.m_pPitch16
+			, (__int64)(xPitch*16+ 0.5), (__int64) m_Param.m_bUseUnpair
+			);
+		CBlobStorage::BlobDefectVert();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		//CBlobStorage::ShadowFilterVert(oldBlob, m_Param.GetRealScanPitch());
+		return;
+	}
+
+	int			nSize = m_Param.s_RectConv.Width();
+	ResetConBuff(nSize);	
+	m_nPair= ConvTrapezium(m_Param.s_lpBuffer, GetConBuffComp(), m_maxPixel, m_nPixel
+		, TrapPoint[0].y, TrapPoint[3].y, TrapPoint[0].x, TrapPoint[3].x
+		, TrapPoint[1].x, TrapPoint[2].x, m_Param.s_nThreshold<<CONV_SPR_SHIFT, m_Param.s_nThresholdSupress
+		, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+		, CONV_SPR_SHIFT, (__int64)(xPitch*16+ 0.5), 0, 0			// 4
+		, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+		, m_Param.s_nFrameWidth, m_Param.m_pPitch16, (__int64) m_Param.m_bUseUnpair
+		);
+	CBlobStorage::BlobDefect();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	//CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+}
+
+
+DIT_RESULT CSISAssem::CheckParameter_Vert(BOOL &bNoInspect)
+{
+	bNoInspect= FALSE;
+	if (!m_Param.s_lpBuffer)
+		return DIT_CONV_INVALIDPARAM;
+
+	if (m_Param.s_nFrameWidth < m_Param.s_dPitchConvReal * m_Param.s_nPitchCycleConv * 3 || m_Param.s_nFrameHeight < m_Param.s_nConvHeight * 2)
+		return DIT_CONV_INVALIDPARAM;
+	if (m_Param.s_RectConv.Width() < m_Param.s_nConvWidth * 3
+		|| m_Param.s_RectConv.Height() < m_Param.s_nConvHeight * 2)
+		return DIT_CONV_INVALIDPARAM;
+
+	if (m_Param.s_nConvWidth < 1 || m_Param.s_nConvWidth >= 1024
+		|| m_Param.s_nConvHeight < 1 || m_Param.s_nConvHeight >= 1024)
+		return DIT_CONV_INVALIDPARAM;
+
+	// 八荤 规氢 3林扁 八刘
+	if (m_Param.s_dPitchScanReal * m_Param.s_nPitchCycleScan * 3 > m_Param.s_RectConv.Height())
+		return DIT_CONV_INVALIDPARAM;
+
+	if (m_Param.s_nFrameDefPixLimit < 10 || m_Param.s_nFrameDefBlobLimit < 2)
+		return DIT_CONV_INVALIDPARAM;
+
+	// 呈厚甫 16狼 硅荐肺 父电促.
+	// 16 硅荐肺 救 父电促.. 救俊辑 舅酒辑 且败. 八荤 康开 逞歹扼档 临捞瘤 富扁.
+	//	m_Param.s_RectConv.right = m_Param.s_RectConv.right - (m_Param.s_RectConv.right - m_Param.s_RectConv.left) % 16;
+
+	if (m_Param.s_nThreshold <= 0)
+		return DIT_CONV_INVALIDPARAM;
+	if (m_Param.s_nThresholdSupress < 1)
+		m_Param.s_nThresholdSupress = 1;
+	if (m_Param.s_nThresholdSupress > 255)
+		m_Param.s_nThresholdSupress = 255;
+
+	return DIT_CONV_SUCCESS;
+}
+
+DIT_RESULT	CSISAssem::CheckParameter(BOOL &bNoInspect)
+{
+	bNoInspect= FALSE;	
+
+	if (!m_Param.s_lpBuffer)
+		return DIT_CONV_INVALIDPARAM;
+
+	if (m_Param.s_nFrameWidth < m_Param.s_dPitchConvReal * m_Param.s_nPitchCycleConv * 3 || m_Param.s_nFrameHeight < m_Param.s_nConvHeight * 2)
+		return DIT_CONV_INVALIDPARAM;
+	if (m_Param.s_RectConv.Width() < m_Param.s_nConvWidth * 3
+		|| m_Param.s_RectConv.Height() < m_Param.s_nConvHeight * 2)
+		return DIT_CONV_INVALIDPARAM;
+
+	//	镜葛 绝绰 扁霖栏肺 魄窜凳. < Conv Size(Width, Height)包访 八荤 阂啊 炼扒.
+	if (m_Param.s_nConvWidth < 1 || m_Param.s_nConvWidth >= 1024
+		|| m_Param.s_nConvHeight < 1 || m_Param.s_nConvHeight >= 1024)
+		return DIT_CONV_INVALIDPARAM;
+
+
+	// 八荤 规氢 3林扁 八刘
+	if (m_Param.s_dPitchConvReal * m_Param.s_nPitchCycleConv *3 > m_Param.s_RectConv.Width())
+		return DIT_CONV_INVALIDPARAM;
+
+
+
+	if (m_Param.s_nFrameDefPixLimit < 10 || m_Param.s_nFrameDefBlobLimit < 2)
+		return DIT_CONV_INVALIDPARAM;
+
+
+	if(m_Param.m_ConvMode == ConvMode_Pixel)
+	{
+		if(m_Param.s_psZoneThTable == NULL)
+		{// main threahold肺 八荤茄促.
+
+		}
+		else
+		{
+			if (m_Param.s_nThresTableStartX < 0 || m_Param.s_nThresTableStartY < 0)
+				return DIT_CONV_INVALIDPARAM;//return DIT_CONV_PARAMMODEFAIL;
+			// 			if (m_Param.s_nThresTableWidth < m_Param.s_nFrameWidth || m_Param.s_nThresTableHeight < m_Param.s_nFrameHeight)
+			// 				return DIT_CONV_INVALIDPARAM;//return DIT_CONV_PARAMMODEFAIL;
+		}
+	}
+
+	// 呈厚甫 16狼 硅荐肺 父电促.
+	// 鞘夸 绝绢 脸促.. 鞘夸且 版快 assem俊辑 贸府 且 巴捞促.
+	//m_Param.s_RectConv.right = m_Param.s_RectConv.right - (m_Param.s_RectConv.right - m_Param.s_RectConv.left) % 16;
+
+
+	if (m_Param.s_nThreshold <= 0)
+		return DIT_CONV_INVALIDPARAM;
+	if (m_Param.s_nThresholdSupress < 1)
+		m_Param.s_nThresholdSupress = 1;
+	if (m_Param.s_nThresholdSupress > 255)
+		m_Param.s_nThresholdSupress = 255;
+
+	return DIT_CONV_SUCCESS;
+}
+CSISAssem* CAssemControl::GetSISAssem(int iThread)
+{
+	if(iThread < 0 || iThread > m_nThread)
+		return NULL;
+	return m_pSISAssem+ iThread;
+}
+
+CAssemControl::CAssemControl()
+{
+	m_pSISAssem= NULL;
+	m_nSpace= 0;
+	m_nThread= 0;
+}
+
+CAssemControl::~CAssemControl()
+{
+	if(m_pSISAssem)
+		delete[] m_pSISAssem;
+}
+
+DIT_RESULT		CAssemControl::Inspect_Rect(int iThread, CConvParam *pParam, BOOL bAsg)
+{
+	// 1. Check Valid Instance
+	if(iThread >= m_nThread || iThread < 0)
+		return DIT_CONV_INVALIDPARAM;
+
+	CSISAssem	*pSISAssem= GetSISAssem(iThread);
+
+	if(pSISAssem == NULL)	return DIT_CONV_INVALIDPARAM;
+
+	// 2. Reset Intermediate Findings of Inspection.(like Pixels, Pairings, Blobs)
+	// 八荤矫 吝埃 搬苞(Pixel, Pair, Blob)狼 俺荐甫 刚历 檬扁拳 矫挪促.
+	pSISAssem->ResetSISAssem();
+
+
+	// 3. Check Validity of Inspection Direction
+	// SID(Selective Inspect Direction)
+	// 3林扁 扁霖 八荤 康开 农扁 鸥寸己 八刘 棺 八荤 规氢 傈券饶 八荤
+	if(pParam->m_ConvDir == ConvDir_Hori)
+	{
+		if(pParam->GetRealConvPitch()*3 > pParam->s_RectConv.Width())
+		{
+			if(! pParam->m_bSelectiveDir)
+				return DIT_CONV_INVALIDPARAM;
+
+			if(pParam->GetRealScanPitch()*3 > pParam->s_RectConv.Height())
+				return DIT_CONV_RSLT_RECT_SMALL;
+
+			pParam->m_ConvDir= ConvDir_Vert;
+		}
+	}else if(pParam->m_ConvDir == ConvDir_Vert)
+	{
+		if(pParam->GetRealScanPitch()*3 > pParam->s_RectConv.Height())
+		{
+			if(! pParam->m_bSelectiveDir)
+				return DIT_CONV_INVALIDPARAM;
+
+			if(pParam->GetRealConvPitch()*3 > pParam->s_RectConv.Width())
+				return DIT_CONV_RSLT_RECT_SMALL;
+
+			pParam->m_ConvDir= ConvDir_Hori;
+		}
+	}
+
+	// Asg 八荤绰 Internal Thread肺 八荤窍瘤 臼绰促.
+	if(bAsg)	return pSISAssem->Inspect_ASG(pParam);
+
+	// ConvDir_Hori篮 Thread 盒且 窍瘤 臼绰促.. 加档啊 面盒窍促.
+	// ConvDir_Hori档 Thread 盒且 八荤甫 窍妨搁 康开 盒且矫 Width 扁馆捞 酒聪扼 Height 扁馆捞 登绢具 茄促.
+	if(pParam->m_ConvDir == ConvDir_Hori)
+	{
+		pSISAssem->ResetSISAssem();
+		return pSISAssem->Inspect_Rect(pParam);
+	}
+
+	if(pParam->m_bEchoConvolution)
+	{
+		pSISAssem->ResetSISAssem();
+		return pSISAssem->Inspect_RectThread(pParam);
+	}
+
+	pSISAssem->ResetSISAssem();
+	return pSISAssem->Inspect_Rect(pParam);
+}
+
+DIT_RESULT		CAssemControl::Inspect_Trapezium(int iThread, CConvParam *pParam)
+{
+	if(iThread >= m_nThread || iThread < 0)
+		return DIT_CONV_INVALIDPARAM;
+	return GetSISAssem(iThread)->Inspect_Trapezium(pParam);
+}
+
+DIT_RESULT		CAssemControl::Inspect_ASG(int iThread, CConvParam *pParam)
+{
+	if(iThread >= m_nThread || iThread < 0)
+		return DIT_CONV_INVALIDPARAM;
+	return GetSISAssem(iThread)->Inspect_ASG(pParam);
+}
+
+void	CAssemControl::ResetReinspectCount()
+{
+	for(int i= 0; i < m_nSpace; i++)
+	{
+		m_pSISAssem[i].ResetReinspectCount();
+	}
+}
+
+int CAssemControl::InitAssemControl(int nThread, int maxDefect/* = 10000 */)
+{
+	if(nThread <= m_nSpace)
+	{
+		m_nThread= nThread;
+
+		for(int i= 0; i< m_nThread; i++)
+		{
+			m_pSISAssem[i].InitAssem(i, maxDefect);
+			m_pSISAssem[i].EnableInternalThread(4, maxDefect);
+		}
+
+		return m_nThread;
+	}
+
+	if(m_pSISAssem != NULL)
+	{
+		delete[] m_pSISAssem;
+		m_pSISAssem= NULL;
+	}
+
+	m_pSISAssem= new CSISAssem[nThread];
+
+	if(m_pSISAssem == NULL)
+	{
+		m_nSpace= m_nThread= 0;
+		return m_nThread;
+	}
+
+	m_nSpace= m_nThread= nThread;
+
+	for(int i= 0; i< m_nSpace; i++)
+	{
+		m_pSISAssem[i].InitAssem(i, maxDefect);
+		m_pSISAssem[i].EnableInternalThread(4, maxDefect);
+	}
+
+	return m_nThread;
+}
+
+CAssemThreadControl::CAssemThreadControl()
+{
+	//	InitAssemControl(4, 10000);
+	m_nSpace= m_nThread= 0;
+	m_pSISAssem= NULL;
+}
+CAssemThreadControl::~CAssemThreadControl()
+{
+	if(m_pSISAssem)
+		delete[] m_pSISAssem;
+}
+
+BOOL CAssemThreadControl::InitAssemThreadControl(int nThread, int maxDefect)
+{
+	if(m_nSpace >= nThread)
+	{
+		m_nThread= nThread;
+		return TRUE;
+	}
+	if(m_pSISAssem != NULL)
+		delete[] m_pSISAssem;
+
+	m_pSISAssem= new CSISAssem[nThread];
+
+	m_nSpace= nThread;
+	m_nThread= nThread;
+
+	for(int i= 0; i< m_nSpace; i++)
+	{
+		m_pSISAssem[i].InitAssem(i, maxDefect);
+	}
+
+	return m_pSISAssem != NULL;
+}
+
+DIT_RESULT	CAssemThreadControl::Inspect_RectThread(int iThread, CConvParam *pParam)//, class CDefectStorage *pDefectStorage, int iFrame, int iScan, int iModel, BOOL bCosmicFiler);
+{
+	CGammaPt* pGamma= (CGammaPt*) pParam->m_pGammaTable;
+	int left= pParam->s_RectConv.left;
+
+	int iGamma= 0;
+
+	if(iThread >= m_nThread || iThread < 0)
+		return DIT_CONV_INVALIDPARAM;
+
+	if(pGamma == NULL)
+	{
+		m_pSISAssem[iThread].ResetSISAssem();
+		return m_pSISAssem[iThread].Inspect_Rect(pParam);
+	}
+
+
+	for(iGamma= 0; iGamma < pParam->m_nGammaXCount; iGamma++)
+	{
+		if(left < pGamma[iGamma].x)
+		{
+			pParam->m_pGammaTable= pGamma+ iGamma;
+			break;
+		}
+	}
+
+	if(iGamma >= pParam->m_nGammaXCount)
+		return DIT_CONV_INVALIDPARAM;
+
+	m_pSISAssem[iThread].ResetSISAssem();
+	return m_pSISAssem[iThread].Inspect_Rect(pParam);
+}
+CSISAssem*	CAssemThreadControl::GetSISAssemThread(int iThread)
+{
+	return m_pSISAssem+ iThread;
+}
\ No newline at end of file
diff --git a/Common_Class/SISAssem/SISAssem.def b/Common_Class/SISAssem/SISAssem.def
new file mode 100644
index 0000000..cba8633
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssem.def
@@ -0,0 +1,7 @@
+; SISAssem.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY      "SISAssem"
+DESCRIPTION  'SISAssem Windows Dynamic Link Library'
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
\ No newline at end of file
diff --git a/Common_Class/SISAssem/SISAssem.rc b/Common_Class/SISAssem/SISAssem.rc
new file mode 100644
index 0000000..b301b89
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssem.rc
@@ -0,0 +1,125 @@
+// Microsoft Visual C++俊辑 积己茄 府家胶 胶农赋飘涝聪促.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE 2 府家胶俊辑 积己登菌嚼聪促.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+	"#ifndef APSTUDIO_INVOKED\r\n"
+    "#include ""targetver.h""\r\n"
+    "#endif\r\n"
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+	"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
+	"LANGUAGE 18, 1\r\n"
+	"#pragma code_page(949)\r\n"
+    "#include ""res\\SISAssem.rc2""  // Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶涝聪促.\r\n"
+#ifndef _AFXDLL
+    "#include ""l.KOR\\afxres.rc""  	// 钎霖 备己 夸家涝聪促.\r\n"
+#endif
+    "#endif\r\n"
+    "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE 18, 1
+#pragma code_page(949)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 滚傈
+//
+
+VS_VERSION_INFO     VERSIONINFO
+  FILEVERSION       1,0,0,1
+  PRODUCTVERSION    1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+	BLOCK "StringFileInfo"
+	BEGIN
+        BLOCK "041203b5"
+		BEGIN
+            VALUE "CompanyName", "TODO: <雀荤 捞抚>"
+            VALUE "FileDescription", "TODO: <颇老 汲疙>"
+			VALUE "FileVersion",     "1.0.0.1"
+			VALUE "InternalName",    "SISAssem.dll"
+            VALUE "LegalCopyright", "TODO: (c) <雀荤 捞抚>.  All rights reserved."
+			VALUE "OriginalFilename","SISAssem.dll"
+            VALUE "ProductName", "TODO: <力前 捞抚>"
+			VALUE "ProductVersion",  "1.0.0.1"
+		END
+	END
+	BLOCK "VarFileInfo"
+	BEGIN
+		VALUE "Translation", 0x0412, 949
+    END
+END
+
+#endif
+#ifndef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE 3 府家胶俊辑 积己登菌嚼聪促.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE 18, 1
+#pragma code_page(949)
+#include "res\\SISAssem.rc2"  // Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶涝聪促.
+#ifndef _AFXDLL
+#include "l.KOR\\afxres.rc"  	// 钎霖 备己 夸家涝聪促.
+#endif
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED啊 酒凑聪促.
+
diff --git a/Common_Class/SISAssem/SISAssem.sln b/Common_Class/SISAssem/SISAssem.sln
new file mode 100644
index 0000000..b4190d8
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssem.sln
@@ -0,0 +1,26 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SISAssem", "SISAssem.vcxproj", "{147FB2E2-F781-431F-92A5-15F9E72E2FF2}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Debug|Win32.ActiveCfg = Debug|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Debug|Win32.Build.0 = Debug|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Debug|x64.ActiveCfg = Debug|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Debug|x64.Build.0 = Debug|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Release|Win32.ActiveCfg = Release|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Release|Win32.Build.0 = Release|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Release|x64.ActiveCfg = Release|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/Common_Class/SISAssem/SISAssem.vcproj b/Common_Class/SISAssem/SISAssem.vcproj
new file mode 100644
index 0000000..01607e4
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssem.vcproj
@@ -0,0 +1,1844 @@
+<?xml version="1.0" encoding="ks_c_5601-1987"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="SISAssem"
+	ProjectGUID="{147FB2E2-F781-431F-92A5-15F9E72E2FF2}"
+	RootNamespace="SISAssem"
+	Keyword="MFCDLLProj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="false"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_AFXEXT"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				ModuleDefinitionFile=".\SISAssem.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="..\..\角青颇老\Debug\"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="false"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\Header"
+				PreprocessorDefinitions="_WINDOWS;_DEBUG;_AFXEXT"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				OpenMP="true"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="..\Library\Debug\$(TargetName).pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)$(ProjectName).dll"
+				LinkIncremental="2"
+				ModuleDefinitionFile=".\SISAssem.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
+				SubSystem="2"
+				ImportLibrary="$(OutDir)$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="false"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_AFXEXT"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				ModuleDefinitionFile=".\SISAssem.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="..\..\角青颇老\Debug\"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="false"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories=".\Header"
+				PreprocessorDefinitions="_WINDOWS;NDEBUG;_AFXEXT"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				OpenMP="true"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile="..\Library\Debug\$(TargetName).pch"
+				ProgramDataBaseFileName="..\Library\Debug\$(TargetName).pdb"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RegisterOutput="false"
+				OutputFile="$(OutDir)$(ProjectName).dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile=".\SISAssem.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="..\Library\Debug\$(TargetName).pdb"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="..\Library\Debug\$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="家胶 颇老"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\dllmain.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\SISAssem.def"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="庆歹 颇老"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\Resource.h"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="府家胶 颇老"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+			<File
+				RelativePath=".\SISAssem.rc"
+				>
+			</File>
+			<File
+				RelativePath=".\res\SISAssem.rc2"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Data"
+			>
+			<File
+				RelativePath=".\AssemDefect.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\AssemDefect.h"
+				>
+			</File>
+			<File
+				RelativePath=".\AssemParam.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\AssemParam.h"
+				>
+			</File>
+			<File
+				RelativePath=".\BlobStorage.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\BlobStorage.h"
+				>
+			</File>
+			<File
+				RelativePath=".\PairStorage.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\PairStorage.h"
+				>
+			</File>
+			<File
+				RelativePath=".\PixelStorage.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\PixelStorage.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Mosis"
+			>
+			<File
+				RelativePath=".\ASGInspection.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\ASGInspection.h"
+				>
+			</File>
+			<File
+				RelativePath=".\ConvFloat.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvFloat6.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvFloat9.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvFloatDPC.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvFloatDPC6.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvFloatVert.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvFloatVert6.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvFloatVert9.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvFloatVTD.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvPixel.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvPixelD.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvPixelVert.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvPixelVertMS.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Cheer Mosis..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Cheer Mosis..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvPixelVertS.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvPixelVertSBW.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技bw"
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技bw"
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvPixelVTDS.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技"
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技.."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvPixelVTDSBW.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvTrap.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvTrapFD.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvTrapVert.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZone2.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneDPC2.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneMVert2S.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Multi DTH..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Multi DTH..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneVert2.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneVert2S.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneVertMS.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技"
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneVTD.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneVTDMS.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						AdditionalDependencies=""
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneVTDS.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="脚炉父技..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\StopWatch3.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\StopWatch3.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Util"
+			>
+			<File
+				RelativePath=".\AssemUtil.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\Header\AssemUtil.h"
+				>
+			</File>
+			<File
+				RelativePath=".\AssemUtil2E.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\Pad.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\Pad.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Unuse"
+			>
+			<File
+				RelativePath=".\ConvZone.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneDPC.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\ConvZoneVert.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="aNow"
+			>
+			<File
+				RelativePath=".\AssemPitch.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\AssemUtil2.asm"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Intrinsic"
+			>
+			<File
+				RelativePath=".\SISAssemIntrin.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Entry"
+			>
+			<File
+				RelativePath=".\SISAssem.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\Header\SISAssem.h"
+				>
+			</File>
+			<File
+				RelativePath=".\SISAssem_Unuse.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="My Inspector Results"
+			>
+			<File
+				RelativePath=".\My Inspector Results\r012mi4\r012mi4.insp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="My Amplifier Results"
+			>
+			<File
+				RelativePath=".\My Amplifier Results\r000hs\r000hs.ampl"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/Common_Class/SISAssem/SISAssem.vcxproj b/Common_Class/SISAssem/SISAssem.vcxproj
new file mode 100644
index 0000000..37a3b23
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssem.vcxproj
@@ -0,0 +1,912 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{147FB2E2-F781-431F-92A5-15F9E72E2FF2}</ProjectGuid>
+    <RootNamespace>SISAssem</RootNamespace>
+    <Keyword>MFCDLLProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\SISAssem.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN64;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <OpenMPSupport>true</OpenMPSupport>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)$(TargetName)D$(TargetExt)</OutputFile>
+      <ModuleDefinitionFile>.\SISAssemD.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <ImportLibrary>$(OutDir)\$(TargetName)D.lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\SISAssem.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <OpenMPSupport>true</OpenMPSupport>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <RegisterOutput>false</RegisterOutput>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <ModuleDefinitionFile>.\SISAssem.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <ImportLibrary>
+      </ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\SISAssem\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\SISAssem\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\SISAssem\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\ASGInspection.h" "$(SolutionDir)Lib\SISAssem\include\ASGInspection.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\AssemDefect.h" "$(SolutionDir)Lib\SISAssem\include\AssemDefect.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\AssemParam.h" "$(SolutionDir)Lib\SISAssem\include\AssemParam.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\AssemUtil.h" "$(SolutionDir)Lib\SISAssem\include\AssemUtil.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\BlobStorage.h" "$(SolutionDir)Lib\SISAssem\include\BlobStorage.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\Pad.h" "$(SolutionDir)Lib\SISAssem\include\Pad.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\PairStorage.h" "$(SolutionDir)Lib\SISAssem\include\PairStorage.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\PixelStorage.h" "$(SolutionDir)Lib\SISAssem\include\PixelStorage.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\SISAssem.h" "$(SolutionDir)Lib\SISAssem\include\SISAssem.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\SISStrg.h" "$(SolutionDir)Lib\SISAssem\include\SISStrg.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="BinalizeInspection.cpp" />
+    <ClCompile Include="dllmain.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
+    </ClCompile>
+    <ClCompile Include="SISFloatIntrin.cpp" />
+    <ClCompile Include="SISPixelIntrin.cpp" />
+    <ClCompile Include="SISZoneIntrin.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="AssemDefect.cpp" />
+    <ClCompile Include="AssemParam.cpp" />
+    <ClCompile Include="BlobStorage.cpp" />
+    <ClCompile Include="PairStorage.cpp" />
+    <ClCompile Include="PixelStorage.cpp" />
+    <ClCompile Include="ASGInspection.cpp" />
+    <ClCompile Include="StopWatch3.cpp" />
+    <ClCompile Include="AssemUtil.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="Pad.cpp" />
+    <ClCompile Include="SISAssem.cpp" />
+    <ClCompile Include="SISAssem_Unuse.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuild Include="AssemPitch_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatDPC_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVert_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVTD_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloat_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVertSBW_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVTDSBW_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert2S2b2.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">靷毄鞛� 歆�鞝� 牍岆摐 雼硠 靾橅枆 欷�</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">靷毄鞛� 歆�鞝� 牍岆摐 雼硠 靾橅枆 欷�</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert2S_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVTD_BOE.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">飑‰ BOE(欷戧淡鞐愳劀 臧滉碃靸�)</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZgSpVtSkB1.asm">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assem Debug 鞚错槙靺� 1x1</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assem Release 鞚错槙靺� 1x1</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZgSpVtSkB2.asm">
+      <FileType>Document</FileType>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assem Debug 鞚错槙靺� 2x2</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assem Release 鞚错槙靺� 2x2</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+    </CustomBuild>
+    <None Include="SISAssem.def" />
+    <None Include="res\SISAssem.rc2" />
+    <CustomBuild Include="ConvFloat.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloat6.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloat9.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatDPC.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatDPC6.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVert.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVert6.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVert9.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVTD.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixel.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelD.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVert.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVertMS.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Cheer Mosis...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Cheer Mosis...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVertS.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">鞁犾П毵岇劯...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">鞁犾П毵岇劯...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVertSBW.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">鞁犾П毵岇劯bw</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">鞁犾П毵岇劯bw</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVTDS.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">鞁犾П毵岇劯</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">鞁犾П毵岇劯..</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVTDSBW.asm">
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvTrap.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvTrapFD.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvTrapVert.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZone2.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneDPC2.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneMVert2S.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Multi DTH...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Multi DTH...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert2.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">鞁犾П毵岇劯...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert2S.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">鞁犾П毵岇劯...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">鞁犾П毵岇劯...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVertMS.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">鞁犾П毵岇劯...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">鞁犾П毵岇劯</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVTD.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVTDMS.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalInputs)</AdditionalInputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVTDS.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">鞁犾П毵岇劯...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">鞁犾П毵岇劯...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="AssemUtil2E.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZone.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneDPC.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="AssemPitch.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <CustomBuild Include="AssemUtil2.asm">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64 -c -Zi "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Assembling...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64 -c "-Fl$(IntDir)%(Filename).lst" "-Fo$(IntDir)%(Filename).obj" "%(FullPath)"
+</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
+    </CustomBuild>
+    <None Include="My Inspector Results\r012mi4\r012mi4.insp" />
+    <None Include="My Amplifier Results\r000hs\r000hs.ampl" />
+    <None Include="ReadMe.txt" />
+    <None Include="SISAssemD.def" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+    <ClInclude Include="Header\AssemDefect.h" />
+    <ClInclude Include="Header\AssemParam.h" />
+    <ClInclude Include="Header\BlobStorage.h" />
+    <ClInclude Include="Header\PairStorage.h" />
+    <ClInclude Include="Header\PixelStorage.h" />
+    <ClInclude Include="Header\ASGInspection.h" />
+    <ClInclude Include="StopWatch3.h" />
+    <ClInclude Include="Header\AssemUtil.h" />
+    <ClInclude Include="Header\Pad.h" />
+    <ClInclude Include="Header\SISAssem.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="SISAssem.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/SISAssem/SISAssem.vcxproj.filters b/Common_Class/SISAssem/SISAssem.vcxproj.filters
new file mode 100644
index 0000000..a9e656e
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssem.vcxproj.filters
@@ -0,0 +1,304 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Data">
+      <UniqueIdentifier>{02e444d2-0b8d-4851-b97d-68a87c425dbe}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Mosis">
+      <UniqueIdentifier>{1452e029-f935-40b9-88e0-102a648d5726}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Util">
+      <UniqueIdentifier>{7eee9d68-7bca-4872-8214-f17a8c89dac9}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Unuse">
+      <UniqueIdentifier>{b7be8263-aef9-487f-a606-f1253a871eb3}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="aNow">
+      <UniqueIdentifier>{697b4ca3-314b-44ab-950c-c5cc1fd02402}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Intrinsic">
+      <UniqueIdentifier>{a110ec6f-6201-4a6b-a76f-f45ef8056c74}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Entry">
+      <UniqueIdentifier>{3d5de4ec-963c-4859-8693-ba0cb7f34638}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="My Inspector Results">
+      <UniqueIdentifier>{2555ee26-efdd-4a56-96cf-f32a4c993fbf}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="My Amplifier Results">
+      <UniqueIdentifier>{da0c91c6-ea74-41df-9af0-ee6ce6cdd09b}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="dllmain.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="AssemDefect.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="AssemParam.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="BlobStorage.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="PairStorage.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="PixelStorage.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="ASGInspection.cpp">
+      <Filter>Mosis</Filter>
+    </ClCompile>
+    <ClCompile Include="StopWatch3.cpp">
+      <Filter>Mosis</Filter>
+    </ClCompile>
+    <ClCompile Include="AssemUtil.cpp">
+      <Filter>Util</Filter>
+    </ClCompile>
+    <ClCompile Include="Pad.cpp">
+      <Filter>Util</Filter>
+    </ClCompile>
+    <ClCompile Include="SISAssem.cpp">
+      <Filter>Entry</Filter>
+    </ClCompile>
+    <ClCompile Include="SISAssem_Unuse.cpp">
+      <Filter>Entry</Filter>
+    </ClCompile>
+    <ClCompile Include="BinalizeInspection.cpp">
+      <Filter>Intrinsic</Filter>
+    </ClCompile>
+    <ClCompile Include="SISFloatIntrin.cpp">
+      <Filter>Intrinsic</Filter>
+    </ClCompile>
+    <ClCompile Include="SISPixelIntrin.cpp">
+      <Filter>Intrinsic</Filter>
+    </ClCompile>
+    <ClCompile Include="SISZoneIntrin.cpp">
+      <Filter>Intrinsic</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="SISAssem.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\SISAssem.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="My Inspector Results\r012mi4\r012mi4.insp">
+      <Filter>My Inspector Results</Filter>
+    </None>
+    <None Include="My Amplifier Results\r000hs\r000hs.ampl">
+      <Filter>My Amplifier Results</Filter>
+    </None>
+    <None Include="ReadMe.txt" />
+    <None Include="SISAssemD.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\AssemDefect.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\AssemParam.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\BlobStorage.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\PairStorage.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\PixelStorage.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ASGInspection.h">
+      <Filter>Mosis</Filter>
+    </ClInclude>
+    <ClInclude Include="StopWatch3.h">
+      <Filter>Mosis</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\AssemUtil.h">
+      <Filter>Util</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\Pad.h">
+      <Filter>Util</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISAssem.h">
+      <Filter>Entry</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="SISAssem.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuild Include="ConvFloat.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloat6.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloat9.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatDPC.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatDPC6.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVert.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVert6.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVert9.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVTD.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixel.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelD.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVert.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVertMS.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVertS.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVertSBW.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVTDS.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVTDSBW.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvTrap.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvTrapFD.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvTrapVert.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZone2.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneDPC2.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneMVert2S.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert2.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert2S.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVertMS.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVTD.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVTDMS.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVTDS.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="AssemUtil2E.asm">
+      <Filter>Util</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZone.asm">
+      <Filter>Unuse</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneDPC.asm">
+      <Filter>Unuse</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert.asm">
+      <Filter>Unuse</Filter>
+    </CustomBuild>
+    <CustomBuild Include="AssemPitch.asm">
+      <Filter>aNow</Filter>
+    </CustomBuild>
+    <CustomBuild Include="AssemUtil2.asm">
+      <Filter>aNow</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloat_BOE.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVTD_BOE.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert2S_BOE.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZoneVert2S2b2.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVTDSBW_BOE.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvPixelVertSBW_BOE.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVTD_BOE.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatVert_BOE.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvFloatDPC_BOE.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="AssemPitch_BOE.asm">
+      <Filter>aNow</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZgSpVtSkB1.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+    <CustomBuild Include="ConvZgSpVtSkB2.asm">
+      <Filter>Mosis</Filter>
+    </CustomBuild>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/SISAssem/SISAssemD.def b/Common_Class/SISAssem/SISAssemD.def
new file mode 100644
index 0000000..5374610
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssemD.def
@@ -0,0 +1,7 @@
+; SISAssemD.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY      "SISAssemD"
+DESCRIPTION  'SISAssemD Windows Dynamic Link Library(Debug)'
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
\ No newline at end of file
diff --git a/Common_Class/SISAssem/SISAssem_Unuse.cpp b/Common_Class/SISAssem/SISAssem_Unuse.cpp
new file mode 100644
index 0000000..065ed15
--- /dev/null
+++ b/Common_Class/SISAssem/SISAssem_Unuse.cpp
@@ -0,0 +1,338 @@
+
+#include "stdafx.h"
+
+#include "BlobStorage.h"
+#include "ASGInspection.h"
+
+#include "StopWatch3.h"
+
+#include "Pad.h"
+
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#define CONV_SPR_MULTI	16
+#define CONV_SPR_SHIFT	4
+
+
+#include "SISAssem.h"
+//#include "Memory.h"
+#include "AssemParam.h"
+
+
+
+
+extern "C"{
+
+	int ConvFloatE(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, __int64 frameWidth, __int64 piPitch, __int64 pfSPR, __int64 psSPR
+		, __int64 Threshold, __int64 Suppress, __int64 SPR, __int64 ShiftCount
+		);
+	int ConvFloatDPCE(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, __int64 frameWidth, short* piPitch, short* pfSPR, short* psSPR
+		, __int64 Threshold, __int64 Suppress, __int64 SPR, __int64 ShiftCount
+		, __int64 iPitch
+		);
+
+	int ConvPixelE(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+		, __int64 Suppress, __int64 DTH_StartThreshold, __int64 DTH_Gradient, __int64 DTH_SectionStart
+		, __int64 ShiftCount
+		);
+	int ConvPixelE2(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+		, __int64 Suppress, __int64 DTH_StartThreshold, __int64 DTH_Gradient, __int64 DTH_SectionStart
+		, __int64 ShiftCount
+		);
+	int ConvPixelDPCE(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, short* piPitch, short* pfSPR, short* psSPR
+		, __int64 Suppress, __int64 DTH_StartThreshold, __int64 DTH_Gradient, __int64 DTH_SectionStart
+		, __int64 ShiftCount, __int64 iPitch
+		);
+
+	int ConvZone(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+		);
+	int ConvZoneDPC(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, short* iPitch, short* fSPR, short* sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 bReverseFilter, __int64 iPitch16
+		, __int64 yZoneByte
+		);
+	int ConvZoneVert(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+		, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+		);
+
+
+	int ConvZoneE(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+		, __int64 Suppress, __int64 DTH_StartThreshold, __int64 DTH_Gradient, __int64 DTH_SectionStart
+		, __int64 ShiftCount, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth
+		, __int64 ZoneTableX, __int64 ZoneTableY
+		);
+	int ConvZoneDPCE(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+		, __int64 frameWidth, short* piPitch, short* pfSPR, short* psSPR
+		, __int64 Suppress, __int64 DTH_StartThreshold, __int64 DTH_Gradient, __int64 DTH_SectionStart
+		, __int64 ShiftCount, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth
+		, __int64 ZoneTableX, __int64 ZoneTableY, __int64 iPitch
+		);
+
+	int ConvFloat2(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+		, __int64 left, __int64 right, __int64 top, __int64 bottom
+		, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+		, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+		, __int64 iPitch16, __int64 BuffWidth, __int64 Threshold, __int64 Suppress
+		, BYTE* pIndexBuff, __int64 IndexWidth, __int64 IndexHeight, __int64 iIndex
+		, __int64 IndexLeft, __int64 IndexTop
+		, short* piPitch, short* pfSpr, short* psSpr
+		);
+};
+
+
+
+void	CSISAssem::Compare_Zone()
+{
+	double xpitch= m_Param.GetRealConvPitch();
+	double ypitch= m_Param.GetRealScanPitch();
+	int		oldBlob;
+		oldBlob= m_nBlob;
+
+	if(m_Param.m_ConvDir == ConvDir_Vert)
+	{
+		m_nPair= ConvZoneVert(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+			, m_Param.s_nFrameWidth, (__int64)(ypitch*16), 0, 0				// 4
+			, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, (__int64) m_Param.GetZoneConvPitch(), (__int64) m_Param.GetZoneScanPitch(), m_Param.m_nGammaXCount*8, (__int64) m_Param.s_bReverseFilter
+			);
+		CBlobStorage::BlobDefectVert();
+		CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+		CBlobStorage::ShadowFilterVert(oldBlob, m_Param.GetRealScanPitch());
+		return;
+	}
+
+	if(m_Param.m_pPitch)
+	{
+		m_nPair= ConvZoneDPC(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4 
+			, m_Param.s_nFrameWidth, m_Param.m_pPitch, m_Param.m_pfSPR, m_Param.m_psSPR				// 4
+			, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, (__int64)xpitch, (__int64)ypitch, m_Param.s_bReverseFilter, (__int64)(xpitch*16)
+			, m_Param.m_nGammaXCount*8
+			);
+/*
+		m_nPixel= ConvZoneDPC(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+			, m_Param.s_nFrameWidth, m_Param.m_pPitch, m_Param.m_pfSPR, m_Param.m_psSPR				// 4
+			, m_Param.s_nThresholdSupress, m_Param.s_nAddThreshold, m_Param.s_nAddGradient, m_Param.s_nAddThresLevel
+			, CONV_SPR_SHIFT, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth
+			, m_Param.s_nThresTableStartX, m_Param.s_nThresTableStartY, (__int64)(xpitch+ 0.5), (__int64) m_Param.s_bReverseFilter
+			);
+		CPairStorage::PairingPlus_Pixel(xpitch);
+*/
+	}else
+	{
+		m_nPair= ConvZone(m_Param.s_lpBuffer, m_Param.s_nThreshold, m_maxPixel, m_nPixel// 4
+			, m_Param.s_RectConv.left, m_Param.s_RectConv.right, m_Param.s_RectConv.top, m_Param.s_RectConv.bottom
+			, m_pPixelX, m_pPixelY, m_pPixelType, m_pPixelValue			// 4
+			, m_pGraySrc, m_pGrayCmp, m_pZoneID, m_pZoneTh// 4
+			, m_Param.s_nFrameWidth, (__int64)(xpitch*16), 0, 0				// 4
+			, m_Param.s_psZoneThTable, m_Param.s_psZoneTable, m_Param.s_nThresTableWidth, m_Param.m_pGammaTable
+			, m_pPairDefect, m_nPair, m_maxPair, sizeof(CDefectPair)
+			, (__int64)xpitch, (__int64)ypitch, m_Param.m_nGammaXCount*8, m_Param.s_bReverseFilter
+			);
+	}
+	CBlobStorage::BlobDefect();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+	return;
+}
+
+
+DIT_RESULT	CAssemControl::ASGVertConvolution(int iThread, CConvParam *pParam)
+{
+	if(iThread >= m_nThread || iThread < 0)
+		return DIT_CONV_INVALIDPARAM;
+	return GetSISAssem(iThread)->ASGVertConvolution(pParam);
+}
+
+
+DIT_RESULT	CSISAssem::ASGVertConvolution(CConvParam *pParam)
+{
+	// 捞 窃荐 救 竟聪促..
+	// 龋免 窍瘤 付技夸..
+	// 唱吝俊 沥府 且 疤聪促.
+	DIT_RESULT rslt= DIT_CONV_SUCCESS;
+
+	// copy prameter to member variable
+	SetConvParam(pParam);
+
+	BOOL bPassInspect;
+	rslt= CheckParameter_Vert(bPassInspect);
+	if(rslt != DIT_CONV_SUCCESS)
+		return rslt;
+
+	// Reset 3 Storage (Blob, Pair, Pixel)
+	ResetSISAssem();
+
+
+
+	// SupPixel 沥剐档甫 1/8(3铰硅) 苞 1/16(4铰硅) 笛吝俊 窍唱肺 急琶秦具 茄促..
+
+	//Compare_Vert();	//冠苞厘 内靛
+
+
+	if (m_Param.s_uiProcessing & DIT_CONV_PPAIRING)
+	{
+		DIT_RESULT PairResu;
+		PairResu = CPairStorage::PairingPlus_Vert(m_Param.s_dPitchScanReal * m_Param.s_nPitchCycleScan);	
+
+		if (PairResu != DIT_CONV_SUCCESS)
+		{
+			if (rslt == DIT_CONV_FRAMEOVERFLOW)
+				return rslt;
+			else
+				return PairResu;
+		}
+
+		if (m_Param.s_uiProcessing & DIT_CONV_MPAIRING)// && FALSE)
+		{			
+			PairResu = CPairStorage::PairingMinus_Vert(m_Param.s_dPitchScanReal * m_Param.s_nPitchCycleScan);		
+
+			if (PairResu != DIT_CONV_SUCCESS)
+			{
+				if (rslt == DIT_CONV_FRAMEOVERFLOW)
+					return rslt;
+				else
+					return PairResu;
+			}
+		}
+
+		//////////////////////////////////////////////////////////////////////////
+		// Blobing
+		if (m_Param.s_uiProcessing & DIT_CONV_BLOBING)
+		{
+			int nBlobStart = m_nBlob;
+			DIT_RESULT PairResu= DIT_CONV_SUCCESS;
+	//		PairResu = CBlobStorage::BlobDefect2();
+			////Debug_test();
+			if (PairResu != DIT_CONV_SUCCESS)
+			{
+				if (rslt == DIT_CONV_FRAMEOVERFLOW)
+					return rslt;
+				else
+					return PairResu;
+			}
+
+			//////////////////////////////////////////////////////////////////////////
+			// Unpair Blobing
+			if (m_Param.s_uiProcessing & DIT_CONV_UNPAIRBLOB)// && FALSE)
+			{
+//				PairResu = CBlobStorage::BlobUnpairDefect();
+				//Debug_test();
+				if (PairResu != DIT_CONV_SUCCESS)
+				{
+					if (rslt == DIT_CONV_FRAMEOVERFLOW)
+						return rslt;
+					else
+						return PairResu;
+				}
+			}
+			//				TRACE("Blobing %d\n", GetTickCount() - dwTick);
+			//				dwTick = GetTickCount();
+
+			//////////////////////////////////////////////////////////////////////////
+			// Defect Classification
+			if (m_Param.s_uiProcessing & DIT_CONV_CLASSIFY)
+			{
+				PairResu = CBlobStorage::ClassificationDefectVert(nBlobStart);
+				//Debug_test();
+				if (PairResu != DIT_CONV_SUCCESS)
+				{
+					if (rslt == DIT_CONV_FRAMEOVERFLOW)
+						return rslt;
+					else
+						return PairResu;
+				}
+			}
+
+			//				TRACE("ClassificationDefect %d\n", GetTickCount() - dwTick);
+			//				dwTick = GetTickCount();
+			//////////////////////////////////////////////////////////////////////////
+			// Merge Defect
+			int nDefectMergePixel= m_Param.m_nDefectMergePixel;
+			if (m_Param.s_uiProcessing & DIT_CONV_MERGE_DIVISION && nDefectMergePixel > 0)
+			{
+				PairResu = CBlobStorage::MergeDivision(nBlobStart, nDefectMergePixel);
+				//Debug_test();
+				if (PairResu != DIT_CONV_SUCCESS)
+				{
+					if (rslt == DIT_CONV_FRAMEOVERFLOW)
+						return rslt;
+					else
+						return PairResu;
+				}
+			}
+			else if (m_Param.s_uiProcessing & DIT_CONV_MERGE_MIX && nDefectMergePixel > 0)
+			{
+				PairResu = CBlobStorage::MergeMix(nBlobStart, nDefectMergePixel);
+				//Debug_test();
+				if (PairResu != DIT_CONV_SUCCESS)
+				{
+					if (rslt == DIT_CONV_FRAMEOVERFLOW)
+						return rslt;
+					else
+						return PairResu;
+				}
+			}
+			//				TRACE("Merging %d\n", GetTickCount() - dwTick);
+			//				dwTick = GetTickCount();
+		}
+	}
+	return rslt;
+}
diff --git a/Common_Class/SISAssem/SISFloatIntrin.cpp b/Common_Class/SISAssem/SISFloatIntrin.cpp
new file mode 100644
index 0000000..4997aad
--- /dev/null
+++ b/Common_Class/SISAssem/SISFloatIntrin.cpp
@@ -0,0 +1,1463 @@
+
+#include "stdafx.h"
+
+#include "BlobStorage.h"
+#include <wmmintrin.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#include "SISAssem.h"
+#include "AssemParam.h"
+
+//Assem->Intrinsic Convert(2by2 Vertical DTh)
+int CSISAssem::ConvFloatVert_BOE_Intrin(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+										  , __int64 left, __int64 right, __int64 top, __int64 bottom
+										  , int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+										  , CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+										  , __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+										  , int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+										  , __int64 i2Pitch16, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+										  )
+{
+	const __int64 ConvNSprShift = 6;
+	const __int64 SprShift = 4;
+	const __int64 ConvShift = 2;
+	const __int64 SprMulti = 16;
+	const __int64 ConvMulti = 4;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	__int64	rrBW = frameWidth;
+	__int64 rrNoD = nDefect;
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	__int64 F_Y2Insp;
+
+	__int64 ImgAddr	= (__int64)pImgBuff;
+	__int64	ConAddr	= __int64(pConBuff + 0x10);
+	__int64	maxPixelD = maxDefect;
+
+	__m128i	xxSrc;
+	__m128i	xxCmp;
+
+	__m128i	xxPeak;
+	__m128i	xxPeakEx;
+	__m128i xxSrc1;
+	__m128i xxSrc2;
+
+	__m128i xxCmp1;
+	__int64 rax, rbx, rcx, rdx;
+
+	__m128i xxZero = _mm_setzero_si128();
+	__m128i xxThres = _mm_set1_epi16((short)Threshold * SprMulti);
+	__m128i	xxDStart = _mm_set1_epi16((short)Threshold / ConvMulti);
+	__m128i	xxDSlide = _mm_set1_epi16((short)ThresholdSlide);
+	__m128i xxSupp = _mm_set1_epi16((short)Suppress * SprMulti * ConvMulti);
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	short sSrc, sRef, sThres, sDiff;
+	__m128i	xxZThB, xxZThW, xx0xff = _mm_set1_epi16(-1);
+	__m128i xxDStartB(xxDStart);
+	__m128i xxDSlideB(xxDSlide);
+
+	if(m_Param.s_nBWB_Main > 0)
+	{
+		xxDStartB = _mm_set1_epi16((short)m_Param.s_nBWB_Main);
+		xxDSlideB = _mm_set1_epi16((short)m_Param.s_nBWB_Slide);
+	}
+	else
+	{
+		m_Param.s_nBWB_Main = (int)Threshold;
+		m_Param.s_nBWB_Slide = (int)ThresholdSlide;
+	}
+	// ----------------------------------- //
+
+	__int64 iPitch = iPitch16 / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	__int64 iSpr = iPitch16 & 0xF;
+	if(iSpr >= SprMulti / 2)
+		iPitchHUp++;
+
+	__m128i	xxsSPR = _mm_set1_epi16((short)iSpr);
+	__m128i	xxfSPR = _mm_set1_epi16((short)SprMulti - (short)iSpr);
+
+	__int64 i2Pitch = i2Pitch16 / SprMulti;
+	__int64 i2Spr = i2Pitch16 & 0xF;
+
+	bottom--;
+	__int64 ConBottom = bottom;
+
+	right = (right - left) / 16 * 16 + left;
+
+	__int64 ImgAddrLeft = ImgAddr + top * rrBW + left;
+	__int64 ConPitch = iPitch * 0x20;
+	__int64 ConPitch2 = i2Pitch * 0x20;
+	__int64 pairTop = top + iPitch;
+	bottom = bottom - iPitch - 1;
+	__int64 pairBottom = bottom - iPitch;
+
+	// -------------- 嗷 Filtering -------------- //
+	CRect rtDeadZone[MAX_DEAD_ZONE_COUNT];
+	CPoint ptDefect;
+	memcpy(rtDeadZone, m_Param.s_RectDeadZone, sizeof(CRect) * MAX_DEAD_ZONE_COUNT);
+	int nDeadZoneCount = 0;
+	for(int i = 0; i < MAX_DEAD_ZONE_COUNT; i++)
+	{
+		if(rtDeadZone[i].IsRectEmpty() == TRUE)
+		{
+			nDeadZoneCount = i;
+			break;
+		}
+	}
+	// ------------------------------------------ //
+
+	__int64 rrImgAddr = ImgAddrLeft;
+	__int64 rrConAddr = ConAddr;
+
+	goto LOOP_X_CHECK;
+
+LOOP_X_TAIL:
+	goto PAIRING_VERT;
+
+PAIRING_VERT_RETURN:
+	ImgAddrLeft += 0x10;
+	rrImgAddr = ImgAddrLeft;
+	rrConAddr = ConAddr;
+	iy = top;
+
+LOOP_X_CHECK:
+	if(ix >= right)
+		goto END_FUNC;
+
+	//LOOP_X_BODY:
+	goto MAKE_CONBUFF_BODY_TAIL_CHECK;
+
+MAKE_CONBUFF_RETURN:
+	iy = top;
+	rrConAddr = ConAddr;
+	F_Y2Insp = 0;
+	goto LOOP_Y_CHECK;
+
+LOOP_Y_TAIL:
+	iy++;
+	rrImgAddr += rrBW;
+	rrConAddr += 0x20;
+
+LOOP_Y_CHECK:
+	if(rrNoD >= maxPixelD)
+		goto PAIRING_VERT;
+	if(iy < bottom)
+		goto LOOP_Y_BODY;
+	ix += 8;
+	if(F_Y2Insp >= 1)
+		goto LOOP_X_TAIL;
+
+	F_Y2Insp = 1;
+	iy = top;
+	rrConAddr = ConAddr + 0x10;
+	goto LOOP_Y_BODY;
+
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxCmp1 = _mm_loadu_si128((__m128i*)(rrImgAddr + 1));
+
+	_mm_storeu_si128((__m128i*)(rrConAddr), _mm_add_epi16(_mm_unpacklo_epi8(xxSrc1, xxZero), _mm_unpacklo_epi8(xxCmp1, xxZero)));
+	_mm_storeu_si128((__m128i*)(rrConAddr + 0x10), _mm_add_epi16(_mm_unpackhi_epi8(xxSrc1, xxZero), _mm_unpackhi_epi8(xxCmp1, xxZero)));
+
+	rrImgAddr += rrBW;
+	rrConAddr += 0x20;
+	iy++;
+	if(iy <= ConBottom)
+		goto MAKE_CONBUFF_BODY_TAIL_CHECK;
+	goto MAKE_CONBUFF_RETURN;
+
+LOOP_Y_BODY:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrConAddr);
+	xxSrc2 = _mm_loadu_si128((__m128i*) (rrConAddr + 0x20));
+	xxSrc = _mm_slli_epi16(_mm_add_epi16(xxSrc1, xxSrc2), SprShift);
+	xxSrc = _mm_subs_epu16(xxSrc, _mm_subs_epu16(xxSrc, xxSupp));
+
+	rax = rrConAddr + ConPitch;
+	xxCmp = _mm_add_epi16(_mm_add_epi16(_mm_mullo_epi16(_mm_loadu_si128((__m128i*)(rax)), xxfSPR), _mm_slli_epi16(_mm_loadu_si128((__m128i*)(rax + 0x20)), SprShift))
+		, _mm_mullo_epi16(_mm_loadu_si128((__m128i*)(rax + 0x40)), xxsSPR));
+
+	xxCmp = _mm_subs_epu16(xxCmp, _mm_subs_epu16(xxCmp, xxSupp));
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	//盔贰内靛: xxThres = _mm_slli_epi16(_mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_srli_epi16(
+	//						_mm_max_epi16(xxSrc, xxCmp), ConvNSprShift), xxDSlide), 8), xxDStart), ConvNSprShift);
+	xxZThW = _mm_slli_epi16(_mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_srli_epi16(
+		_mm_max_epi16(xxSrc, xxCmp), ConvNSprShift), xxDSlide), 8), xxDStart), ConvNSprShift);
+	xxZThB = _mm_slli_epi16(_mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_srli_epi16(
+		_mm_max_epi16(xxSrc, xxCmp), ConvNSprShift), xxDSlideB), 8), xxDStartB), ConvNSprShift);
+
+		xxThres = _mm_min_epu16(xxZThW, xxZThB);
+	// ----------------------------------- //
+
+	//INSPECT_BLACK:
+	xxPeakEx = _mm_subs_epu16(xxCmp, xxSrc);
+	xxPeak = _mm_cmpgt_epi16(xxPeakEx, xxThres);
+	if(_mm_movemask_epi8(xxPeak) == 0)
+		goto INSPECT_WHITE;
+	rbx = 0;
+	goto DEFECT_00;
+
+INSPECT_WHITE:
+	xxPeakEx = _mm_subs_epu16(xxSrc, xxCmp);
+	xxPeak = xxPeakEx;
+	xxPeak = _mm_cmpgt_epi16(xxPeak, xxThres);
+	if(_mm_movemask_epi8(xxPeak) == 0)
+		goto LOOP_Y_TAIL;
+	rbx = 1;
+	goto DEFECT_00;
+
+DEFECT_00:
+	if(_mm_extract_epi16(xxPeak, 0x00) == 0)
+		goto DEFECT_01;
+
+	rax = _mm_extract_epi16(xxPeakEx, 0x00);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x00);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x00);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x00);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	if(_mm_extract_epi16(xxPeak, 0x01) == 0)
+		goto DEFECT_02;
+
+	rax = _mm_extract_epi16(xxPeakEx, 0x01);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x01);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x01);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x01);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	if(_mm_extract_epi16(xxPeak, 0x02) == 0)
+		goto DEFECT_03;
+
+	rax = _mm_extract_epi16(xxPeakEx, 0x02);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x02);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x02);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x02);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	if(_mm_extract_epi16(xxPeak, 0x03) == 0)
+		goto DEFECT_04;
+
+	rax = _mm_extract_epi16(xxPeakEx, 0x03);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x03);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x03);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x03);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	if(_mm_extract_epi16(xxPeak, 0x04) == 0)
+		goto DEFECT_05;
+
+	rax = _mm_extract_epi16(xxPeakEx, 0x04);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x04);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x04);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x04);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	if(_mm_extract_epi16(xxPeak, 0x05) == 0)
+		goto DEFECT_06;
+
+	rax = _mm_extract_epi16(xxPeakEx, 0x05);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x05);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x05);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x05);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	if(_mm_extract_epi16(xxPeak, 0x06) == 0)
+		goto DEFECT_07;
+
+	rax = _mm_extract_epi16(xxPeakEx, 0x06);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x06);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x06);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x06);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	if(_mm_extract_epi16(xxPeak, 0x07) == 0)
+		goto DEFECT_END;
+
+	rax = _mm_extract_epi16(xxPeakEx, 0x07);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x07);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x07);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x07);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_END:
+	ix -= 7;
+	if(rbx == 0)
+		goto INSPECT_WHITE;
+	goto LOOP_Y_TAIL;
+
+PAIRING_VERT:
+	iy = -1;
+
+LOOP_PAIR_NUM:
+	iy++;
+	if(iy >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(nPair >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + iy) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = iy;
+	rcx = *(DefectY + iy);
+	rax = rcx + iPitchHUp;
+	rrBW = *(DefectX + iy);
+
+	if(rcx > pairBottom)
+		goto PAIR_BOTTOM;
+
+	if(rcx >= pairTop)
+		goto PAIR_CENTER;
+
+PAIR_TOP:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_TOP_UNPAIR;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_TOP;
+	else if(rdx > rax)
+		goto PAIR_TOP_UNPAIR;
+
+	rcx = *(DefectX + rbx);
+	if(rrBW != rcx)
+		goto PAIR_TOP;
+
+	rrConAddr = *(DefectT + rbx);
+	if(rrConAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrConAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGraySrc + rbx));
+	sRef = (int)(*(pGrayCmp + rbx));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold / 4) * 64;
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main) * 64;
+
+	*(pZoneTh + rbx) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrConAddr;
+	PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc / 64);
+	PairAddr->s_nGrayRef = (int)(sRef / 64);
+	PairAddr->s_nThresold = (int)(sThres / 64);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_TOP_UNPAIR:
+	if(m_Param.m_bUseUnpair == FALSE)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)(rrBW);
+	ptDefect.y = (LONG)(rax - iPitchHUp);
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGraySrc + iy));
+	sRef = (int)(*(pGrayCmp + iy));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold / 4) * 64;
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main) * 64;
+
+	*(pZoneTh + iy) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)ptDefect.x;
+	PairAddr->s_nDefectY = (int)ptDefect.y;
+	PairAddr->s_DefectType = (DefectType)*(DefectT + iy);
+	PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(sSrc / 64);
+	PairAddr->s_nGrayRef = (int)(sRef / 64);
+	PairAddr->s_nThresold = (int)(sThres / 64);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx == rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_CENTER;
+	else if(rdx > rax)
+		goto LOOP_PAIR_NUM;
+
+	rcx = *(DefectX + rbx);
+	if(rrBW != rcx)
+		goto PAIR_CENTER;
+
+	rrConAddr = *(DefectT + rbx);
+	if(rrConAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrConAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+		sSrc = (int)(*(pGraySrc + rbx));
+		sRef = (int)(*(pGrayCmp + rbx));
+
+		if(sSrc > sRef)
+			sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold / 4) * 64;
+		else
+			sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main) * 64;
+
+		*(pZoneTh + rbx) = sThres;
+
+		sDiff = abs(sSrc - sRef);
+		if(sDiff <= sThres)
+			goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrConAddr;
+	PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc / 64);
+	PairAddr->s_nGrayRef = (int)(sRef / 64);
+	PairAddr->s_nThresold = (int)(sThres / 64);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_BOTTOM:
+	if(m_Param.m_bUseUnpair == FALSE)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rrBW;
+	ptDefect.y = (LONG)rax;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGrayCmp + iy));
+	sRef = (int)(*(pGraySrc + iy));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold / 4) * 64;
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main) * 64;
+
+	*(pZoneTh + iy) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrBW;
+	PairAddr->s_nDefectY = (int)rax;
+	rdx = (*(DefectT + iy) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rdx;
+	PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(sSrc / 64);
+	PairAddr->s_nGrayRef = (int)(sRef / 64);
+	PairAddr->s_nThresold = (int)(sThres / 64);
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	rrBW = frameWidth;
+	goto PAIRING_VERT_RETURN;
+
+END_FUNC:
+	ix += 0x10;
+	*endLine = (int)ix;
+
+	return (int)nPair;
+}
+
+
+//Assem->Intrinsic Convert(2by2 Vertical DTh DPC)
+int CSISAssem::ConvFloatVTD_BOE_Intrin(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+										 , __int64 left, __int64 right, __int64 top, __int64 bottom
+										 , int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+										 , CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+										 , __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+										 , short*  i2Pitch16, __int64 tilt16, int* PitchBuff, __int64 ThresholdSlide
+										 , int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+										 , int* endLine
+										 )
+{
+	const __int64 ConvNSprShift = 6;
+	const __int64 SprShift = 4;
+	const __int64 ConvShift = 2;
+	const __int64 SprMulti = 16;
+	const __int64 ConvMulti = 4;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	__int64 rrNoD = nDefect;
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	__int64 F_Y2Insp;
+
+	__int64 ImgAddr	= (__int64)pImgBuff;
+	__int64	ConAddr	= __int64(pConBuff + 0x10);
+	__int64	ConAddr2	= __int64(i2Pitch16 + 0x10);
+	__int64	maxPixelD = maxDefect;
+	__int64	iPitchLast = 0;
+
+	__m128i	xxTemp;
+	__m128i	xxSrc;
+	__m128i	xxCmp;
+
+	__m128i	xxPeak;
+	__m128i	xxPeakAbs;
+	__m128i xxSrc1;
+	__m128i xxCmp1;
+
+	__m128i xxfSprT;
+	__m128i xxsSprT;
+
+	__int64 rax, rbx, rcx, rdx;
+
+	__m128i xxZero = _mm_setzero_si128();
+	__m128i xxThres = _mm_set1_epi16((short)Threshold * SprMulti);
+	__m128i	xxDStart = _mm_set1_epi16((short)Threshold / ConvMulti);
+	__m128i	xxDSlide = _mm_set1_epi16((short)ThresholdSlide);
+	__m128i xxSupp = _mm_set1_epi16((short)Suppress * SprMulti * ConvMulti);
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	short sSrc, sRef, sThres, sDiff;
+	__m128i	xxZThB, xxZThW, xx0xff = _mm_set1_epi16(-1);
+	__m128i xxDStartB(xxDStart);
+	__m128i xxDSlideB(xxDSlide);
+
+	if(m_Param.s_nBWB_Main > 0)
+	{
+		xxDStartB = _mm_set1_epi16((short)m_Param.s_nBWB_Main);
+		xxDSlideB = _mm_set1_epi16((short)m_Param.s_nBWB_Slide);
+	}
+	else
+	{
+		m_Param.s_nBWB_Main = (int)Threshold;
+		m_Param.s_nBWB_Slide = (int)ThresholdSlide;
+	}
+	// ----------------------------------- //
+
+	rcx = tilt16;
+	rcx &= 0x0f;
+
+	xxsSprT = _mm_set1_epi16((short)rcx);
+
+	rax = SprMulti;
+	rax -= rcx;
+	xxfSprT = _mm_set1_epi16((short)rax);
+
+	tilt16 /= 16;
+
+	__int64 iPitch = iPitch16 / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	__int64 iSpr = iPitch16 & 0xF;
+	if(iSpr >= SprMulti / 2)
+		iPitchHUp++;
+
+	__m128i	xxsSPR = _mm_set1_epi16((short)iSpr);
+	__m128i	xxfSPR = _mm_set1_epi16((short)SprMulti - (short)iSpr);
+
+	bottom--;
+	__int64 ConBottom = bottom;
+
+	right = (right - left) / 16 * 16 + left;
+
+	__int64 ImgAddrLeft = ImgAddr + top * frameWidth + left;
+	__int64 ConPitch = iPitch * 0x20;
+
+	// -------------- 嗷 Filtering -------------- //
+	CRect rtDeadZone[MAX_DEAD_ZONE_COUNT];
+	CPoint ptDefect;
+	memcpy(rtDeadZone, m_Param.s_RectDeadZone, sizeof(CRect) * MAX_DEAD_ZONE_COUNT);
+	int nDeadZoneCount = 0;
+	for(int i = 0; i < MAX_DEAD_ZONE_COUNT; i++)
+	{
+		if(rtDeadZone[i].IsRectEmpty() == TRUE)
+		{
+			nDeadZoneCount = i;
+			break;
+		}
+	}
+	// ------------------------------------------ //
+
+	__int64 pairTop = top + iPitch;
+	bottom = bottom - iPitch - 1;
+	__int64 pairBottom = bottom - iPitch;
+
+	__int64 rrImgAddr = ImgAddrLeft;
+	__int64 rrConAddr = ConAddr;
+	__int64 rrConAddr2 = ConAddr2;
+
+	goto LOOP_X_CHECK;
+
+LOOP_X_TAIL:
+	goto PAIRING_VERT;
+
+PAIRING_VERT_RETURN:
+	ImgAddrLeft += 0x10;
+	rrImgAddr = ImgAddrLeft;
+	rrConAddr = ConAddr;
+	rrConAddr2 = ConAddr2;
+	iy = top;
+
+LOOP_X_CHECK:
+	if(ix >= right)
+		goto END_FUNC;
+
+//LOOP_X_BODY:
+	iy = top;
+	rrImgAddr = ImgAddrLeft;
+	rrConAddr = ConAddr;
+	rrConAddr2 = ConAddr2;
+	goto MAKE_CONBUFF_BODY_TAIL_CHECK;
+
+MAKE_CONBUFF_RETURN:
+	iy = top;
+	rrImgAddr = ImgAddrLeft;
+	rrConAddr = ConAddr;
+	rrConAddr2 = ConAddr2;
+	goto MAKE_CONBUFF2_HEAD;
+
+MAKE_CONBUFF2_RETURN:
+	iy = top;
+	rrImgAddr = ImgAddrLeft;
+	rrConAddr = ConAddr;
+	rrConAddr2 = ConAddr2;
+	F_Y2Insp = 0;
+	goto LOOP_Y_CHECK;
+
+DPC_READ:
+	if(PitchBuff == NULL)
+		goto DPC_READ_RETURN;
+
+	rax = *(PitchBuff + iy / 16);
+	if(rax == iPitchLast)
+		goto DPC_READ_RETURN;
+
+	iPitchLast = rax;
+	rbx = rax;
+	rbx &= 0x0f;
+	rax /= 16;
+	rax *= 32;
+	ConPitch = rax;
+	xxsSPR = _mm_set1_epi16((short)rbx);
+
+	rdx = SprMulti;
+	rdx -= rbx;
+	xxfSPR = _mm_set1_epi16((short)rdx);
+	goto DPC_READ_RETURN;
+
+LOOP_Y_TAIL:
+	iy++;
+	rrImgAddr += frameWidth;
+	rrConAddr += 0x20;
+	rrConAddr2 += 0x20;
+
+LOOP_Y_CHECK:
+	if(rrNoD >= maxPixelD)
+		goto PAIRING_VERT;
+	if(iy < bottom)
+		goto LOOP_Y_BODY;
+	ix += 8;
+	if(F_Y2Insp >= 1)
+		goto LOOP_X_TAIL;
+
+	F_Y2Insp = 1;
+	iy = top;
+	rrConAddr = ConAddr;
+	rrConAddr += 0x10;
+	rrConAddr2 = ConAddr2;
+	rrConAddr2 += 0x10;
+	goto LOOP_Y_BODY;
+
+MAKE_CONBUFF_BODY_TAIL_CHECK:
+	xxSrc = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxSrc1 = xxSrc;
+	xxSrc = _mm_unpacklo_epi8(xxSrc, xxZero);
+	xxSrc1 = _mm_unpackhi_epi8(xxSrc1, xxZero);
+
+	xxCmp = _mm_loadu_si128((__m128i*)(rrImgAddr + 1));
+	xxCmp1 = xxCmp;
+	xxCmp = _mm_unpacklo_epi8(xxCmp, xxZero);
+	xxCmp1 = _mm_unpackhi_epi8(xxCmp1, xxZero);
+
+	xxSrc = _mm_add_epi16(xxSrc, xxCmp);
+	xxSrc1 = _mm_add_epi16(xxSrc1, xxCmp1);
+
+	_mm_storeu_si128((__m128i*)(rrConAddr), xxSrc);
+	_mm_storeu_si128((__m128i*)(rrConAddr + 0x10), xxSrc1);
+
+	rrImgAddr += frameWidth;
+	rrConAddr += 0x20;
+	iy++;
+	if(iy <= ConBottom)
+		goto MAKE_CONBUFF_BODY_TAIL_CHECK;
+	goto MAKE_CONBUFF_RETURN;
+
+MAKE_CONBUFF2_HEAD:
+	rax = rrImgAddr;
+	rax += tilt16;
+	rrConAddr2 = ConAddr2;
+
+MAKE_CONBUFF2_BODY:
+	xxSrc = _mm_loadu_si128((__m128i*) rax);
+	xxSrc1 = xxSrc;
+	xxSrc = _mm_unpacklo_epi8(xxSrc, xxZero);
+	xxSrc1 = _mm_unpackhi_epi8(xxSrc1, xxZero);
+	xxSrc = _mm_mullo_epi16(xxSrc, xxfSprT);
+	xxSrc1 = _mm_mullo_epi16(xxSrc1, xxfSprT);
+
+	xxCmp = _mm_loadu_si128((__m128i*)(rax + 2));
+	xxCmp1 = xxCmp;
+	xxCmp = _mm_unpacklo_epi8(xxCmp, xxZero);
+	xxCmp1 = _mm_unpackhi_epi8(xxCmp1, xxZero);
+	xxCmp = _mm_mullo_epi16(xxCmp, xxsSprT);
+	xxCmp1 = _mm_mullo_epi16(xxCmp1, xxsSprT);
+
+	xxSrc = _mm_add_epi16(xxSrc, xxCmp);
+	xxSrc1 = _mm_add_epi16(xxSrc1, xxCmp1);
+
+	xxSrc = _mm_srli_epi16(xxSrc, SprShift);
+	xxSrc1 = _mm_srli_epi16(xxSrc1, SprShift);
+
+	xxCmp = _mm_loadu_si128((__m128i*)(rax + 1));
+	xxCmp1 = xxCmp;
+	xxCmp = _mm_unpacklo_epi8(xxCmp, xxZero);
+	xxCmp1 = _mm_unpackhi_epi8(xxCmp1, xxZero);
+
+	xxSrc = _mm_add_epi16(xxSrc, xxCmp);
+	xxSrc1 = _mm_add_epi16(xxSrc1, xxCmp1);
+
+	_mm_storeu_si128((__m128i*)(rrConAddr2), xxSrc);
+	_mm_storeu_si128((__m128i*)(rrConAddr2 + 0x10), xxSrc1);
+
+	rax += frameWidth;
+	rrConAddr2 += 0x20;
+
+	iy++;
+	if(iy <= ConBottom)
+		goto MAKE_CONBUFF2_BODY;
+	goto MAKE_CONBUFF2_RETURN;
+
+LOOP_Y_BODY:
+	goto DPC_READ;
+
+DPC_READ_RETURN:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrConAddr);
+	xxTemp = _mm_loadu_si128((__m128i*) (rrConAddr + 0x20));
+	xxSrc = xxSrc1;
+	xxSrc = _mm_add_epi16(xxSrc, xxTemp);
+	xxSrc = _mm_slli_epi16(xxSrc, SprShift);
+	xxTemp = xxSrc;
+	xxTemp = _mm_subs_epu16(xxTemp, xxSupp);
+	xxSrc = _mm_subs_epu16(xxSrc, xxTemp);
+
+	rax = rrConAddr2 + ConPitch;
+	xxCmp1 = _mm_loadu_si128((__m128i*)(rax));
+	xxCmp = xxCmp1;
+	xxCmp = _mm_mullo_epi16(xxCmp, xxfSPR);
+
+	xxCmp1 = _mm_loadu_si128((__m128i*)(rax + 0x20));
+	xxTemp = xxCmp1;
+	xxTemp = _mm_slli_epi16(xxTemp, SprShift);
+	xxCmp = _mm_add_epi16(xxCmp, xxTemp);
+
+	xxTemp = _mm_loadu_si128((__m128i*)(rax + 0x40));
+	xxTemp = _mm_mullo_epi16(xxTemp, xxsSPR);
+	xxCmp = _mm_add_epi16(xxCmp, xxTemp);
+
+	xxTemp = xxCmp;
+	xxTemp = _mm_subs_epu16(xxTemp, xxSupp);
+	xxCmp = _mm_subs_epu16(xxCmp, xxTemp);
+
+	xxThres = xxSrc;
+	xxThres = _mm_max_epi16(xxThres, xxCmp);
+	xxThres = _mm_srli_epi16(xxThres, ConvNSprShift);
+	xxThres = _mm_mullo_epi16(xxThres, xxDSlide);
+	xxThres = _mm_srli_epi16(xxThres, 8);
+	xxThres = _mm_add_epi16(xxThres, xxDStart);
+	xxThres = _mm_slli_epi16(xxThres, ConvNSprShift);
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+/*盔贰内靛:
+	xxThres = xxSrc;
+	xxThres = _mm_max_epi16(xxThres, xxCmp);
+	xxThres = _mm_srli_epi16(xxThres, ConvNSprShift);
+	xxThres = _mm_mullo_epi16(xxThres, xxDSlide);
+	xxThres = _mm_srli_epi16(xxThres, 8);
+	xxThres = _mm_add_epi16(xxThres, xxDStart);
+	xxThres = _mm_slli_epi16(xxThres, ConvNSprShift);
+	*/
+	xxZThW = _mm_slli_epi16(_mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_srli_epi16(
+		_mm_max_epi16(xxSrc, xxCmp), ConvNSprShift), xxDSlide), 8), xxDStart), ConvNSprShift);
+	xxZThB = _mm_slli_epi16(_mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_srli_epi16(
+		_mm_max_epi16(xxSrc, xxCmp), ConvNSprShift), xxDSlideB), 8), xxDStartB), ConvNSprShift);
+
+		xxThres = _mm_min_epu16(xxZThW, xxZThB);
+	// ----------------------------------- //
+
+	//INSPECT_BLACK:
+	xxPeakAbs = xxCmp;
+	xxPeakAbs = _mm_subs_epu16(xxPeakAbs, xxSrc);
+	xxPeak = xxPeakAbs;
+	xxPeak = _mm_cmpgt_epi16(xxPeak, xxThres);
+	rax = _mm_movemask_epi8(xxPeak);
+	if(rax == 0)
+		goto INSPECT_WHITE;
+	rbx = 0;
+	goto DEFECT_00;
+
+INSPECT_WHITE:
+	xxPeakAbs = xxSrc;
+	xxPeakAbs = _mm_subs_epu16(xxPeakAbs, xxCmp);
+	xxPeak = xxPeakAbs;
+	xxPeak = _mm_cmpgt_epi16(xxPeak, xxThres);
+	rax = _mm_movemask_epi8(xxPeak);
+	if(rax == 0)
+		goto LOOP_Y_TAIL;
+	rbx = 1;
+	goto DEFECT_00;
+
+DEFECT_00:
+	rax = _mm_extract_epi16(xxPeak, 0x00);
+	if(rax == 0)
+		goto DEFECT_01;
+
+	rax = _mm_extract_epi16(xxPeakAbs, 0x00);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x00);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x00);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x00);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	rax = _mm_extract_epi16(xxPeak, 0x01);
+	if(rax == 0)
+		goto DEFECT_02;
+
+	rax = _mm_extract_epi16(xxPeakAbs, 0x01);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x01);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x01);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x01);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	rax = _mm_extract_epi16(xxPeak, 0x02);
+	if(rax == 0)
+		goto DEFECT_03;
+
+	rax = _mm_extract_epi16(xxPeakAbs, 0x02);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x02);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x02);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x02);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	rax = _mm_extract_epi16(xxPeak, 0x03);
+	if(rax == 0)
+		goto DEFECT_04;
+
+	rax = _mm_extract_epi16(xxPeakAbs, 0x03);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x03);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x03);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x03);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	rax = _mm_extract_epi16(xxPeak, 0x04);
+	if(rax == 0)
+		goto DEFECT_05;
+
+	rax = _mm_extract_epi16(xxPeakAbs, 0x04);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x04);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x04);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x04);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	rax = _mm_extract_epi16(xxPeak, 0x05);
+	if(rax == 0)
+		goto DEFECT_06;
+
+	rax = _mm_extract_epi16(xxPeakAbs, 0x05);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x05);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x05);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x05);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	rax = _mm_extract_epi16(xxPeak, 0x06);
+	if(rax == 0)
+		goto DEFECT_07;
+
+	rax = _mm_extract_epi16(xxPeakAbs, 0x06);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x06);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x06);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x06);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	rax = _mm_extract_epi16(xxPeak, 0x07);
+	if(rax == 0)
+		goto DEFECT_END;
+
+	rax = _mm_extract_epi16(xxPeakAbs, 0x07);
+	rax =  rax >> ConvNSprShift;
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+	*(DefectT + rrNoD) = (int)rbx;
+	*(DefectValue + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxSrc, 0x07);
+	*(pGraySrc + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxCmp, 0x07);
+	*(pGrayCmp + rrNoD) = (int)rax;
+
+	rax = _mm_extract_epi16(xxThres, 0x07);
+	*(pZoneTh + rrNoD) = (int)rax;
+
+	rrNoD++;
+
+DEFECT_END:
+	ix -= 7;
+	if(rbx == 0)
+		goto INSPECT_WHITE;
+	goto LOOP_Y_TAIL;
+
+PAIRING_VERT:
+	iy = -1;
+
+LOOP_PAIR_NUM:
+	iy++;
+	if(iy >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(rax >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + iy) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = iy;
+	rcx = *(DefectY + iy);
+	rax = rcx + iPitchHUp;
+	rrConAddr2 = *(DefectX + iy);
+
+	if(rcx > pairBottom)
+		goto PAIR_BOTTOM;
+
+	if(rcx >= pairTop)
+		goto PAIR_CENTER;
+
+PAIR_TOP:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_TOP_UNPAIR;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_TOP;
+	else if(rdx > rax)
+		goto PAIR_TOP_UNPAIR;
+
+	rcx = *(DefectX + rbx);
+	if(rrConAddr2 != rcx)
+		goto PAIR_TOP;
+
+	rrConAddr = *(DefectT + rbx);
+	if(rrConAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrConAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGraySrc + rbx));
+	sRef = (int)(*(pGrayCmp + rbx));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold / 4) * 64;
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main) * 64;
+
+	*(pZoneTh + rbx) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrConAddr;
+	PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc / 64);
+	PairAddr->s_nGrayRef = (int)(sRef / 64);
+	PairAddr->s_nThresold = (int)(sThres / 64);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_TOP_UNPAIR:
+	if(m_Param.m_bUseUnpair == FALSE)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)(rrConAddr2);
+	ptDefect.y = (LONG)(rax - iPitchHUp);
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGraySrc + iy));
+	sRef = (int)(*(pGrayCmp + iy));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold / 4) * 64;
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main) * 64;
+
+	*(pZoneTh + iy) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)ptDefect.x;
+	PairAddr->s_nDefectY = (int)ptDefect.y;
+	PairAddr->s_DefectType = (DefectType)*(DefectT + iy);
+	PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(sSrc / 64);
+	PairAddr->s_nGrayRef = (int)(sRef / 64);
+	PairAddr->s_nThresold = (int)(sThres / 64);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx == rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_CENTER;
+	else if(rdx > rax)
+		goto LOOP_PAIR_NUM;
+
+	rcx = *(DefectX + rbx);
+	if(rrConAddr2 != rcx)
+		goto PAIR_CENTER;
+
+	rrConAddr = *(DefectT + rbx);
+	if(rrConAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrConAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+		sSrc = (int)(*(pGraySrc + rbx));
+		sRef = (int)(*(pGrayCmp + rbx));
+
+		if(sSrc > sRef)
+			sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold / 4) * 64;
+		else
+			sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main) * 64;
+
+		*(pZoneTh + rbx) = sThres;
+
+		sDiff = abs(sSrc - sRef);
+		if(sDiff <= sThres)
+			goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrConAddr;
+	PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc / 64);
+	PairAddr->s_nGrayRef = (int)(sRef / 64);
+	PairAddr->s_nThresold = (int)(sThres / 64);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_BOTTOM:
+	if(m_Param.m_bUseUnpair == FALSE)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rrConAddr2;
+	ptDefect.y = (LONG)rax;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGrayCmp + iy));
+	sRef = (int)(*(pGraySrc + iy));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold / 4) * 64;
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main) * 64;
+
+	*(pZoneTh + iy) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrConAddr2;
+	PairAddr->s_nDefectY = (int)rax;
+	rdx = (*(DefectT + iy) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rdx;
+	PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(sSrc / 64);
+	PairAddr->s_nGrayRef = (int)(sRef / 64);
+	PairAddr->s_nThresold = (int)(sThres / 64);
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	goto PAIRING_VERT_RETURN;
+
+END_FUNC:
+	ix += 0x10;
+	*endLine = (int)ix;
+
+	return (int)nPair;
+}
\ No newline at end of file
diff --git a/Common_Class/SISAssem/SISPixelIntrin.cpp b/Common_Class/SISAssem/SISPixelIntrin.cpp
new file mode 100644
index 0000000..0cc97fa
--- /dev/null
+++ b/Common_Class/SISAssem/SISPixelIntrin.cpp
@@ -0,0 +1,2000 @@
+
+#include "stdafx.h"
+
+#include "BlobStorage.h"
+#include <wmmintrin.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#include "SISAssem.h"
+#include "AssemParam.h"
+
+int CSISAssem::ConvPixelVertS_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+							   , __int64 left, __int64 right, __int64 top, __int64 bottom
+							   , int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+							   , int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+							   , __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+							   , short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+							   , CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+							   , __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+							   , __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+							   , int* endLine, __int64 ExTh
+							   )
+{
+	const __int64 SprShift = 4;
+	const __int64 SprMulti = 16;
+
+	__m128i	xxTemp;
+
+	__m128i	xxZTh;
+
+	__m128i	xxSrc1;
+	__m128i xxSrc2;
+
+	__m128i	xxCmp1;
+	__m128i xxCmp2;
+	__m128i xxCmp3;
+
+	__m128i	xxPeakS;
+	__m128i	xxPeakAbs;
+
+	__m128i	xxfSpr;
+	__m128i	xxsSpr;
+
+	__m128i xxDStart;
+	__m128i xxDSlide;
+
+	__int64 rax, rbx, rcx, rdx;
+
+	__int64 ImgAddrOri	= (__int64)pImgBuff;
+	__int64 ConAddr = (__int64)pConBuff;
+	__int64 c8Pixel, rrNoD = 0, rrImgAddr, nPair = StartPair;
+
+	__m128i xxSupp = _mm_set1_epi16((short)ThresholdSuppress);	
+
+	xxDStart = _mm_set1_epi16((short)Threshold);
+	xxDSlide = _mm_set1_epi16((short)ThresholdSlide);
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	short sSrc, sRef, sThres, sDiff;
+	__m128i	xxZThB, xxZThW, xx0xff = _mm_set1_epi16(-1);
+	__m128i xxDStartB(xxDStart);
+	__m128i xxDSlideB(xxDSlide);
+
+	if(m_Param.s_nBWB_Main > 0)
+	{
+		xxDStartB = _mm_set1_epi16((short)m_Param.s_nBWB_Main);
+		xxDSlideB = _mm_set1_epi16((short)m_Param.s_nBWB_Slide);
+	}
+	else
+	{
+		m_Param.s_nBWB_Main = (int)Threshold;
+		m_Param.s_nBWB_Slide = (int)ThresholdSlide;
+	}
+	// ----------------------------------- //
+
+	rcx = iPitch16;
+	rcx &= 0x0f;
+	xxsSpr = _mm_set1_epi16((short)rcx);
+
+	rax = SprMulti;
+	rax -= rcx;
+	xxfSpr = _mm_set1_epi16((short)rax);
+
+	__int64 iPitch = iPitch16 / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	if(rcx >= SprMulti / 2)
+		iPitchHUp++;
+
+	bottom--;
+	__int64 ConBottom = bottom - iPitch - 1;
+	__int64 pairBottom = ConBottom - iPitch;
+
+	// -------------- 嗷 Filtering -------------- //
+	CRect rtDeadZone[MAX_DEAD_ZONE_COUNT];
+	CPoint ptDefect;
+	memcpy(rtDeadZone, m_Param.s_RectDeadZone, sizeof(CRect) * MAX_DEAD_ZONE_COUNT);
+	int nDeadZoneCount = 0;
+	for(int i = 0; i < MAX_DEAD_ZONE_COUNT; i++)
+	{
+		if(rtDeadZone[i].IsRectEmpty() == TRUE)
+		{
+			nDeadZoneCount = i;
+			break;
+		}
+	}
+	// ------------------------------------------ //
+
+	__int64 pairTop = top + iPitch;
+	__int64 ConvPitch = iPitch * 0x20;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	right = (right - left) / 16 * 16 + left;
+
+	__m128i xxZero = _mm_setzero_si128();
+
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+//LOOP_1:
+	goto LOOP_1_CHECK;
+
+LOOP_1_TAIL:
+	goto PAIRING_VERT;
+
+_return_PAIRING_VERT:
+	ix += 0x10;
+
+LOOP_1_CHECK:
+	if(ix >= right)
+		goto END_FUNC;
+
+//LOOP_1_BODY:
+	iy = top;
+	rrImgAddr = ImgAddrOri + frameWidth * iy + ix;
+	goto MAKE_CONBUFF_HEAD;
+
+_return_MAKE_CONBUFF:
+	iy = top;
+	rrImgAddr = ConAddr;
+//LOOP_2:
+	goto LOOP_2_CHECK;
+
+LOOP_2_TAIL:
+	iy++;
+	rrImgAddr += 0x20;
+
+LOOP_2_CHECK:
+	if(iy >= ConBottom)
+		goto LOOP_1_TAIL;
+
+//LOOP_2_BODY:
+	goto XMM_MAKE;
+_return_XMM_MAKE:
+	goto XMM_COMPARE;
+_return_XMM_COMPARE:
+	goto LOOP_2_TAIL;
+
+MAKE_CONBUFF_HEAD:
+	rax = ConAddr;
+
+MAKE_CONBUFF:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	_mm_storeu_si128((__m128i*)rax, _mm_unpacklo_epi8(xxSrc1, xxZero));
+	_mm_storeu_si128((__m128i*)(rax + 0x10), _mm_unpackhi_epi8(xxSrc1, xxZero));
+	rrImgAddr += frameWidth;
+	rax += 0x20;
+	iy++;
+	if(iy <= bottom)
+		goto MAKE_CONBUFF;
+	goto _return_MAKE_CONBUFF;
+
+XMM_MAKE:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxSrc2 = _mm_loadu_si128((__m128i*) (rrImgAddr + 0x10));
+
+	rax = rrImgAddr + ConvPitch;
+
+	xxCmp1 = _mm_loadu_si128((__m128i*) rax);
+	xxCmp2 = _mm_loadu_si128((__m128i*) (rax + 0x10));
+	xxCmp3 = _mm_loadu_si128((__m128i*) (rax + 0x20));
+	xxTemp = _mm_loadu_si128((__m128i*) (rax + 0x30));
+
+	xxCmp1 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp1, xxfSpr), _mm_mullo_epi16(xxCmp3, xxsSpr)), SprShift);
+	xxCmp2 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp2, xxfSpr), _mm_mullo_epi16(xxTemp, xxsSpr)), SprShift);
+	goto _return_XMM_MAKE;
+
+XMM_COMPARE:
+	c8Pixel = 0;
+	xxSrc1 = _mm_min_epu16(xxSrc1, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp1, xxSupp);
+	goto _XMM_COMPARE_8PIXEL;
+
+_return_XMM_COMPARE_8PIXEL:
+	if(rrNoD >= maxDefect)
+		goto PAIRING_VERT;
+
+	c8Pixel++;
+	if(c8Pixel == 2)
+		goto XMM_COMPARE_END;
+
+	xxSrc1 = _mm_min_epu16(xxSrc2, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp2, xxSupp);
+
+_XMM_COMPARE_8PIXEL:
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	//盔贰内靛: xxZTh = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxDStart);
+	xxZThW = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxDStart);
+	xxZThB = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlideB), 8), xxDStartB);
+
+		xxZTh = _mm_min_epu16(xxZThW, xxZThB);
+	// ----------------------------------- //
+
+	//瞒捞蔼阑 备窍绊
+	xxPeakS = _mm_sub_epi16(xxSrc1, xxCmp1);
+	xxPeakAbs = _mm_abs_epi16(xxPeakS);
+	xxTemp = _mm_cmpgt_epi16(xxPeakAbs, xxZTh);
+	if(_mm_movemask_epi8(xxTemp) != 0)
+		goto DEFECT_00;
+
+	ix += 8;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+XMM_COMPARE_END:
+	ix -= 0x10;
+	goto _return_XMM_COMPARE;
+
+
+DEFECT_00:
+	if(_mm_extract_epi16(xxTemp, 0x00) == 0)
+		goto DEFECT_01;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x00);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x00);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x00);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x00);
+	if((short)_mm_extract_epi16(xxPeakS, 0x00)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x01) == 0)
+		goto DEFECT_02;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x01);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x01);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x01);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x01);
+	if((short)_mm_extract_epi16(xxPeakS, 0x01)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x02) == 0)
+		goto DEFECT_03;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x02);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x02);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x02);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x02);
+	if((short)_mm_extract_epi16(xxPeakS, 0x02)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x03) == 0)
+		goto DEFECT_04;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x03);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x03);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x03);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x03);
+	if((short)_mm_extract_epi16(xxPeakS, 0x03)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x04) == 0)
+		goto DEFECT_05;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x04);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x04);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x04);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x04);
+	if((short)_mm_extract_epi16(xxPeakS, 0x04)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x05) == 0)
+		goto DEFECT_06;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x05);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x05);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x05);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x05);
+	if((short)_mm_extract_epi16(xxPeakS, 0x05)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x06) == 0)
+		goto DEFECT_07;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x06);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x06);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x06);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x06);
+	if((short)_mm_extract_epi16(xxPeakS, 0x06)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x07) == 0)
+		goto DEFECT_08;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x07);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x07);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x07);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x07);
+	if((short)_mm_extract_epi16(xxPeakS, 0x07)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_08:
+	ix++;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+PAIRING_VERT:
+	iy = -1;
+
+LOOP_PAIR_NUM:
+	iy++;
+	if(iy >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(rax >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + iy) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = iy;
+	rcx = *(DefectY + iy);
+	rax = rcx + iPitchHUp;
+	rrImgAddr = *(DefectX + iy);
+
+	if(rcx > pairBottom)
+		goto PAIR_BOTTOM;
+
+	if(rcx >= pairTop)
+		goto PAIR_CENTER;
+
+PAIR_TOP:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_TOP_UNPAIR;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_TOP;
+	else if(rdx > rax)
+		goto PAIR_TOP_UNPAIR;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_TOP;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGraySrc + rbx));
+	sRef = (int)(*(pGrayCmp + rbx));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold);
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+
+	*(pZoneTh + rbx) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(sThres);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_TOP_UNPAIR:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)(rrImgAddr);
+	ptDefect.y = (LONG)(rax - iPitchHUp);
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGraySrc + iy));
+	sRef = (int)(*(pGrayCmp + iy));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold);
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+
+	*(pZoneTh + iy) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)ptDefect.x;
+	PairAddr->s_nDefectY = (int)ptDefect.y;
+	PairAddr->s_DefectType = (DefectType)*(DefectT + iy);
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)(sThres);
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_CENTER;
+	else if(rdx > rax)
+		goto LOOP_PAIR_NUM;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_CENTER;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+		sSrc = (int)(*(pGraySrc + rbx));
+		sRef = (int)(*(pGrayCmp + rbx));
+
+		if(sSrc > sRef)
+			sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold);
+		else
+			sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+
+		*(pZoneTh + rbx) = sThres;
+
+		sDiff = abs(sSrc - sRef);
+		if(sDiff <= sThres)
+			goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(sThres);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_BOTTOM:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rrImgAddr;
+	ptDefect.y = (LONG)rax;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGrayCmp + iy));
+	sRef = (int)(*(pGraySrc + iy));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold);
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+
+	*(pZoneTh + iy) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrImgAddr;
+	PairAddr->s_nDefectY = (int)rax;
+	rdx = (*(DefectT + iy) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rdx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)sSrc;
+	PairAddr->s_nGrayRef = (int)sRef;
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)sThres;
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	goto _return_PAIRING_VERT;
+
+END_FUNC:
+	ix += 0x10;
+	*endLine = (int)ix;
+
+	return (int)nPair;
+}
+
+int CSISAssem::ConvPixelVTDS_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+							, __int64 left, __int64 right, __int64 top, __int64 bottom
+							, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+							, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+							, __int64 frameWidth, __int64 iPitch16, int* piPitch16, __int64 sSPR
+							, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+							, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+							, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+							, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+							, int* endLine, __int64 ExTh
+							)
+{
+	const __int64 SprShift = 4;
+	const __int64 SprMulti = 16;
+
+	__m128i	xxTemp;
+
+	__m128i	xxZTh;
+
+	__m128i	xxSrc1;
+	__m128i xxSrc2;
+
+	__m128i	xxCmp1;
+	__m128i xxCmp2;
+	__m128i xxCmp3;
+
+	__m128i	xxPeakS;
+	__m128i	xxPeakAbs;
+
+	__m128i	xxfSpr;
+	__m128i	xxsSpr;
+
+	__m128i xxDStart;
+	__m128i xxDSlide;
+
+	__int64 rax, rbx, rcx, rdx;
+
+
+	__int64 ImgAddrOri	= (__int64)pImgBuff;
+	__int64 ConAddr = (__int64)pConBuff;
+	__int64 c8Pixel, rrNoD = 0, rrImgAddr, nPair = StartPair, _piPitch16, cDpc;
+
+	__m128i xxSupp = _mm_set1_epi16((short)ThresholdSuppress);
+		
+	xxDStart = _mm_set1_epi16((short)Threshold);
+	xxDSlide = _mm_set1_epi16((short)ThresholdSlide);
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	short sSrc, sRef, sThres, sDiff;
+	__m128i	xxZThB, xxZThW, xx0xff = _mm_set1_epi16(-1);
+	__m128i xxDStartB(xxDStart);
+	__m128i xxDSlideB(xxDSlide);
+
+	if(m_Param.s_nBWB_Main > 0)
+	{
+		xxDStartB = _mm_set1_epi16((short)m_Param.s_nBWB_Main);
+		xxDSlideB = _mm_set1_epi16((short)m_Param.s_nBWB_Slide);
+	}
+	else
+	{
+		m_Param.s_nBWB_Main = (int)Threshold;
+		m_Param.s_nBWB_Slide = (int)ThresholdSlide;
+	}
+	// ----------------------------------- //
+
+	rcx = iPitch16;
+	rcx &= 0x0f;
+	xxsSpr = _mm_set1_epi16((short)rcx);
+
+	rax = SprMulti;
+	rax -= rcx;
+	xxfSpr = _mm_set1_epi16((short)rax);
+
+	__int64 iPitch = iPitch16 / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	if(rcx >= SprMulti / 2)
+		iPitchHUp++;
+
+	bottom--;
+	__int64 ConBottom = bottom - iPitch - 1;
+	__int64 pairBottom = ConBottom - iPitch;
+
+	// -------------- 嗷 Filtering -------------- //
+	CRect rtDeadZone[MAX_DEAD_ZONE_COUNT];
+	CPoint ptDefect;
+	memcpy(rtDeadZone, m_Param.s_RectDeadZone, sizeof(CRect) * MAX_DEAD_ZONE_COUNT);
+	int nDeadZoneCount = 0;
+	for(int i = 0; i < MAX_DEAD_ZONE_COUNT; i++)
+	{
+		if(rtDeadZone[i].IsRectEmpty() == TRUE)
+		{
+			nDeadZoneCount = i;
+			break;
+		}
+	}
+	// ------------------------------------------ //
+
+	__int64 pairTop = top + iPitch;
+	__int64 ConvPitch = iPitch * 0x20;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	right = (right - left) / 16 * 16 + left;
+
+	__m128i xxZero = _mm_setzero_si128();
+
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	//LOOP_1:
+	goto LOOP_1_CHECK;
+
+LOOP_1_TAIL:
+	goto PAIRING_VERT;
+
+_return_PAIRING_VERT:
+	ix += 0x10;
+
+LOOP_1_CHECK:
+	if(ix >= right)
+		goto END_FUNC;
+
+	//LOOP_1_BODY:
+	iy = top;
+	rrImgAddr = ImgAddrOri + frameWidth * iy + ix;
+	
+	_piPitch16 = 0;
+	if(piPitch16 == NULL)
+		goto DPC_PASS;
+
+	rax = iy;
+	rax /= 16;
+	rax *= 4;
+	rax += __int64(piPitch16);
+	_piPitch16 = rax;
+
+DPC_PASS:	
+	goto MAKE_CONBUFF_HEAD;
+
+_return_MAKE_CONBUFF:
+	iy = top;
+	rrImgAddr = ConAddr;
+	//LOOP_2:
+	cDpc = 0x10;
+	goto LOOP_2_CHECK;
+
+LOOP_2_TAIL:
+	iy++;
+	rrImgAddr += 0x20;
+
+LOOP_2_CHECK:
+	if(iy >= ConBottom)
+		goto LOOP_1_TAIL;
+
+	//LOOP_2_BODY:
+	if(_piPitch16 == 0)
+		goto XMM_MAKE;
+	goto DPC_MAKE;
+_return_DPC_MAKE:
+	cDpc++;
+	goto XMM_MAKE;
+_return_XMM_MAKE:
+	goto XMM_COMPARE;
+	_return_XMM_COMPARE:
+	goto LOOP_2_TAIL;
+
+MAKE_CONBUFF_HEAD:
+	rax = ConAddr;
+
+MAKE_CONBUFF:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	_mm_storeu_si128((__m128i*)rax, _mm_unpacklo_epi8(xxSrc1, xxZero));
+	_mm_storeu_si128((__m128i*)(rax + 0x10), _mm_unpackhi_epi8(xxSrc1, xxZero));
+	rrImgAddr += frameWidth;
+	rax += 0x20;
+	iy++;
+	if(iy <= bottom)
+		goto MAKE_CONBUFF;
+	goto _return_MAKE_CONBUFF;
+
+DPC_MAKE:	// verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	if(cDpc != 0x10)				//cmp		cDpc, 010h
+		goto _return_DPC_MAKE;		//jne		_return_DPC_MAKE
+	cDpc = 0;						//mov		cDpc, 0
+	rax = _piPitch16;				//mov		rax, piPitch16
+	rax = *(int*)(rax);				//movsxd	rax, dword ptr[rax]
+	_piPitch16 +=4;					//add		piPitch16, 4
+
+	if(iPitch16 == rax)				//cmp		iPitch16, rax
+		goto _return_DPC_MAKE;		//je		_return_DPC_MAKE
+
+	iPitch16 = rax;					//mov		iPitch16, rax	
+	rcx = rax;						//mov		rcx, rax
+	rcx &= 0x0f;					//and		rcx, 0fh
+
+	rax /= 16;						//shr		rax, SprShift
+	iPitch = rax;					//mov		iPitch, rax
+
+	rax *= 32;						//sal		rax, 5
+	ConvPitch = rax;				//mov		ConPitch, rax
+
+
+	rdx = 0x10;						//mov		rdx, 010h
+	rdx -= rcx;						//sub		rdx, rcx
+
+	xxsSpr = _mm_set1_epi16((short)rcx);
+	xxfSpr = _mm_set1_epi16((short)rdx);
+
+	goto _return_DPC_MAKE;
+
+XMM_MAKE:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxSrc2 = _mm_loadu_si128((__m128i*) (rrImgAddr + 0x10));
+
+	rax = rrImgAddr + ConvPitch;
+
+	xxCmp1 = _mm_loadu_si128((__m128i*) rax);
+	xxCmp2 = _mm_loadu_si128((__m128i*) (rax + 0x10));
+	xxCmp3 = _mm_loadu_si128((__m128i*) (rax + 0x20));
+	xxTemp = _mm_loadu_si128((__m128i*) (rax + 0x30));
+
+	xxCmp1 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp1, xxfSpr), _mm_mullo_epi16(xxCmp3, xxsSpr)), SprShift);
+	xxCmp2 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp2, xxfSpr), _mm_mullo_epi16(xxTemp, xxsSpr)), SprShift);
+	goto _return_XMM_MAKE;
+
+XMM_COMPARE:
+	c8Pixel = 0;
+	xxSrc1 = _mm_min_epu16(xxSrc1, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp1, xxSupp);
+	goto _XMM_COMPARE_8PIXEL;
+
+_return_XMM_COMPARE_8PIXEL:
+	if(rrNoD >= maxDefect)
+		goto PAIRING_VERT;
+
+	c8Pixel++;
+	if(c8Pixel == 2)
+		goto XMM_COMPARE_END;
+
+	xxSrc1 = _mm_min_epu16(xxSrc2, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp2, xxSupp);
+
+_XMM_COMPARE_8PIXEL:
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	//盔贰内靛: xxZTh = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxDStart);
+	xxZThW = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxDStart);
+	xxZThB = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlideB), 8), xxDStartB);
+
+		xxZTh = _mm_min_epu16(xxZThW, xxZThB);
+	// ----------------------------------- //
+
+	//瞒捞蔼阑 备窍绊
+	xxPeakS = _mm_sub_epi16(xxSrc1, xxCmp1);
+	xxPeakAbs = _mm_abs_epi16(xxPeakS);
+	xxTemp = _mm_cmpgt_epi16(xxPeakAbs, xxZTh);
+	if(_mm_movemask_epi8(xxTemp) != 0)
+		goto DEFECT_00;
+
+	ix += 8;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+XMM_COMPARE_END:
+	ix -= 0x10;
+	goto _return_XMM_COMPARE;
+
+
+DEFECT_00:
+	if(_mm_extract_epi16(xxTemp, 0x00) == 0)
+		goto DEFECT_01;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x00);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x00);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x00);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x00);
+	if((short)_mm_extract_epi16(xxPeakS, 0x00)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x01) == 0)
+		goto DEFECT_02;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x01);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x01);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x01);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x01);
+	if((short)_mm_extract_epi16(xxPeakS, 0x01)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x02) == 0)
+		goto DEFECT_03;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x02);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x02);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x02);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x02);
+	if((short)_mm_extract_epi16(xxPeakS, 0x02)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x03) == 0)
+		goto DEFECT_04;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x03);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x03);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x03);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x03);
+	if((short)_mm_extract_epi16(xxPeakS, 0x03)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x04) == 0)
+		goto DEFECT_05;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x04);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x04);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x04);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x04);
+	if((short)_mm_extract_epi16(xxPeakS, 0x04)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x05) == 0)
+		goto DEFECT_06;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x05);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x05);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x05);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x05);
+	if((short)_mm_extract_epi16(xxPeakS, 0x05)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x06) == 0)
+		goto DEFECT_07;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x06);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x06);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x06);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x06);
+	if((short)_mm_extract_epi16(xxPeakS, 0x06)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x07) == 0)
+		goto DEFECT_08;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x07);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x07);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZero, 0x07);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x07);
+	if((short)_mm_extract_epi16(xxPeakS, 0x07)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_08:
+	ix++;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+PAIRING_VERT:
+	iy = -1;
+
+LOOP_PAIR_NUM:
+	iy++;
+	if(iy >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(rax >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + iy) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = iy;
+	rcx = *(DefectY + iy);
+	rax = rcx + iPitchHUp;
+	rrImgAddr = *(DefectX + iy);
+
+	if(rcx > pairBottom)
+		goto PAIR_BOTTOM;
+
+	if(rcx >= pairTop)
+		goto PAIR_CENTER;
+
+PAIR_TOP:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_TOP_UNPAIR;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_TOP;
+	else if(rdx > rax)
+		goto PAIR_TOP_UNPAIR;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_TOP;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //	
+	sSrc = (int)(*(pGraySrc + rbx));
+	sRef = (int)(*(pGrayCmp + rbx));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold);
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+
+	*(pZoneTh + rbx) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(sThres);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_TOP_UNPAIR:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)(rrImgAddr);
+	ptDefect.y = (LONG)(rax - iPitchHUp);
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGraySrc + iy));
+	sRef = (int)(*(pGrayCmp + iy));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold);
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+
+	*(pZoneTh + iy) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)ptDefect.x;
+	PairAddr->s_nDefectY = (int)ptDefect.y;
+	PairAddr->s_DefectType = (DefectType)*(DefectT + iy);
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)(sThres);
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_CENTER;
+	else if(rdx > rax)
+		goto LOOP_PAIR_NUM;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_CENTER;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+		sSrc = (int)(*(pGraySrc + rbx));
+		sRef = (int)(*(pGrayCmp + rbx));
+
+		if(sSrc > sRef)
+			sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold);
+		else
+			sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+
+		*(pZoneTh + rbx) = sThres;
+
+		sDiff = abs(sSrc - sRef);
+		if(sDiff <= sThres)
+			goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(sThres);
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_BOTTOM:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rrImgAddr;
+	ptDefect.y = (LONG)rax;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ---- 孺归搬窃 瞒殿 巩盼蔼 利侩 ---- //
+	sSrc = (int)(*(pGrayCmp + iy));
+	sRef = (int)(*(pGraySrc + iy));
+
+	if(sSrc > sRef)
+		sThres = (short)(sSrc * ThresholdSlide / 256 + Threshold);
+	else
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+
+	*(pZoneTh + iy) = sThres;
+
+	sDiff = abs(sSrc - sRef);
+	if(sDiff <= sThres)
+		goto LOOP_PAIR_NUM;
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrImgAddr;
+	PairAddr->s_nDefectY = (int)rax;
+	rdx = (*(DefectT + iy) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rdx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)sSrc;
+	PairAddr->s_nGrayRef = (int)sRef;
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)sThres;
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	goto _return_PAIRING_VERT;
+
+END_FUNC:
+	ix += 0x10;
+	*endLine = (int)ix;
+
+	return (int)nPair;
+}
+
+int CSISAssem::ConvPixel_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+								  , __int64 left, __int64 right, __int64 top, __int64 bottom
+								  , int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+								  , int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+								  , __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+								  , short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+								  , CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+								  , __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+								  , __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, int* endLine
+								  )
+{
+	const __int64 SprShift = 4;
+	const __int64 SprMulti = 16;
+
+	__m128i	xxTemp;
+
+	__m128i	xxZTh;
+	__m128i	xxZId;
+
+	__m128i	xxSrc1;
+	__m128i xxSrc2;
+
+	__m128i	xxCmp1;
+	__m128i xxCmp2;
+	__m128i xxCmp3;
+
+	__m128i	xxPeakS;
+	__m128i	xxPeakAbs;
+
+	__m128i	xxfSpr;
+	__m128i	xxsSpr;
+
+	__m128i xxDStart;
+	__m128i xxDSlide;
+
+	__int64 rax, rbx, rcx, rdx;
+
+	__int64 ImgAddrOri	= (__int64)pImgBuff;
+	__int64 c8Pixel, rrNoD = 0, rrImgAddr, nPair = StartPair;
+		
+	__m128i xxSupp = _mm_set1_epi16((short)ThresholdSuppress);
+
+	xxDStart = _mm_set1_epi16((short)Threshold);
+	xxDSlide = _mm_set1_epi16((short)ThresholdSlide);
+
+	xxZId = _mm_setzero_si128();
+
+	rcx = iPitch;
+	rcx &= 0x0f;
+	xxsSpr = _mm_set1_epi16((short)rcx);
+
+	rax = SprMulti;
+	rax -= rcx;
+	xxfSpr = _mm_set1_epi16((short)rax);
+
+	iPitch = iPitch / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	if(rcx >= SprMulti / 2)
+		iPitchHUp++;
+
+	right = (right - left - iPitch) / 16 * 16 + left;	
+
+	__int64 pairRight = right - iPitch;
+	__int64 pairLeft = left + iPitch;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	__m128i xxZero = _mm_setzero_si128();
+
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	//LOOP_1:
+	goto LOOP_1_CHECK;
+
+LOOP_1_TAIL:
+	goto PAIRING;
+
+_return_PAIRING:
+	iy++;
+
+LOOP_1_CHECK:
+	if(iy >= bottom)
+		goto END_FUNC;
+
+	//LOOP_1_BODY:
+	ix = left;
+	rrImgAddr = ImgAddrOri + frameWidth * iy + ix;
+
+	//LOOP_2:
+	goto LOOP_2_CHECK;
+
+LOOP_2_TAIL:
+	rrImgAddr += 0x10;
+
+LOOP_2_CHECK:
+	if(ix >= right)
+		goto LOOP_1_TAIL;
+
+	//LOOP_2_BODY:
+	goto XMM_MAKE;
+_return_XMM_MAKE:
+	goto XMM_COMPARE;
+_return_XMM_COMPARE:
+	goto LOOP_2_TAIL;
+
+
+XMM_MAKE:
+	xxSrc2 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxSrc1 = _mm_unpacklo_epi8(xxSrc2, xxZero);
+	xxSrc2 = _mm_unpackhi_epi8(xxSrc2, xxZero);
+
+	rax = rrImgAddr + iPitch;
+
+	xxCmp2 = _mm_loadu_si128((__m128i*) rax);
+	xxCmp1 = _mm_unpacklo_epi8(xxCmp2, xxZero);
+	xxCmp2 = _mm_unpackhi_epi8(xxCmp2, xxZero);
+
+	xxCmp1 = _mm_mullo_epi16(xxCmp1, xxfSpr);
+	xxCmp2 = _mm_mullo_epi16(xxCmp2, xxfSpr);
+
+	xxCmp3 = _mm_loadu_si128((__m128i*) (rax + 1));
+
+	xxTemp = xxCmp3;
+	xxTemp = _mm_unpacklo_epi8(xxTemp, xxZero);
+	xxTemp = _mm_mullo_epi16(xxTemp, xxsSpr);
+	xxCmp1 = _mm_add_epi16(xxCmp1, xxTemp);
+
+	xxTemp = xxCmp3;
+	xxTemp = _mm_unpackhi_epi8(xxTemp, xxZero);
+	xxTemp = _mm_mullo_epi16(xxTemp, xxsSpr);
+	xxCmp2 = _mm_add_epi16(xxCmp2, xxTemp);
+
+
+	xxCmp1 = _mm_srli_epi16(xxCmp1, SprShift);
+	xxCmp2 = _mm_srli_epi16(xxCmp2, SprShift);
+	goto _return_XMM_MAKE;
+
+XMM_COMPARE:
+	c8Pixel = 0;
+	goto _XMM_COMPARE_8PIXEL;
+
+_return_XMM_COMPARE_8PIXEL:
+	if(rrNoD >= maxDefect)
+		goto PAIRING;
+
+	ix++;
+
+	c8Pixel++;
+	if(c8Pixel == 2)
+		goto _return_XMM_COMPARE;
+
+	xxSrc1 = xxSrc2;
+	xxCmp1 = xxCmp2;
+
+_XMM_COMPARE_8PIXEL:
+	xxSrc1 = _mm_min_epu16(xxSrc1, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp1, xxSupp);
+
+	xxZTh = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxDStart);
+	xxPeakS = _mm_sub_epi16(xxSrc1, xxCmp1);
+	xxPeakAbs = _mm_abs_epi16(xxPeakS);
+	xxTemp = _mm_cmpgt_epi16(xxPeakAbs, xxZTh);
+	if(_mm_movemask_epi8(xxTemp) != 0)
+		goto DEFECT_00;
+
+	ix += 7;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+DEFECT_00:
+	if(_mm_extract_epi16(xxTemp, 0x00) == 0)
+		goto DEFECT_01;
+	
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x00);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x00);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x00);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x00);
+	if((short)_mm_extract_epi16(xxPeakS, 0x00)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x01) == 0)
+		goto DEFECT_02;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x01);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x01);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x01);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x01);
+	if((short)_mm_extract_epi16(xxPeakS, 0x01)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x02) == 0)
+		goto DEFECT_03;
+		
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x02);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x02);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x02);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x02);
+	if((short)_mm_extract_epi16(xxPeakS, 0x02)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x03) == 0)
+		goto DEFECT_04;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x03);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x03);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x03);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x03);
+	if((short)_mm_extract_epi16(xxPeakS, 0x03)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x04) == 0)
+		goto DEFECT_05;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x04);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x04);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x04);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x04);
+	if((short)_mm_extract_epi16(xxPeakS, 0x04)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x05) == 0)
+		goto DEFECT_06;
+		
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x05);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x05);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x05);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x05);
+	if((short)_mm_extract_epi16(xxPeakS, 0x05)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x06) == 0)
+		goto DEFECT_07;
+		
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x06);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x06);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x06);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x06);
+	if((short)_mm_extract_epi16(xxPeakS, 0x06)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x07) == 0)
+		goto _return_XMM_COMPARE_8PIXEL;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x07);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x07);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x07);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x07);
+	if((short)_mm_extract_epi16(xxPeakS, 0x07)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+	goto _return_XMM_COMPARE_8PIXEL;
+
+PAIRING:
+	ix = -1;
+
+LOOP_PAIR_NUM:
+	ix++;
+	if(ix >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(rax >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + ix) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = ix;
+	rdx = *(DefectX + ix);
+	rcx = rdx;
+	rcx = rcx + iPitchHUp;
+
+	if(rdx < pairLeft)
+		goto PAIR_LEFT;
+
+	if(rdx <= pairRight)
+		goto PAIR_CENTER;
+
+	//PAIR_RIGHT:
+	if(bUseUnpair == 0)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)(*(DefectY + ix));
+	rcx = (*(DefectT + ix) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rcx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(*(pGrayCmp + ix));
+	PairAddr->s_nGrayRef = (int)(*(pGraySrc + ix));
+	PairAddr->s_nZone = (int)(*(pZoneID + ix));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + ix));
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_LEFT:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_LEFT_UNPAIR;
+
+	rax = *(DefectX + rbx);
+	if(rax < rcx)
+		goto PAIR_LEFT;
+	else if(rax > rcx)
+		goto PAIR_LEFT_UNPAIR;
+
+	rdx = *(DefectT + rbx);
+	if(rdx >= 3)
+		goto PAIR_LEFT;
+
+	rax = (__int64)*(DefectT + ix);
+	if(rax == rdx)
+		goto PAIR_LEFT;
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)(*(DefectY + rbx));
+	PairAddr->s_DefectType = (DefectType)rdx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + rbx));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + rbx));
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + rbx));
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_LEFT_UNPAIR:
+	if(bUseUnpair == 0)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)(*(DefectX + ix));
+	PairAddr->s_nDefectY = (int)(*(DefectY + ix));
+	PairAddr->s_DefectType = (DefectType)*(DefectT + ix);
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + ix));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + ix));
+	PairAddr->s_nZone = (int)(*(pZoneID + ix));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + ix));
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rax = *(DefectX + rbx);
+	if(rax < rcx)
+		goto PAIR_CENTER;
+	else if(rax > rcx)
+		goto PAIR_CENTER_UNPAIR;
+
+	rdx = *(DefectT + rbx);
+	if(rdx >= 3)
+		goto PAIR_CENTER;
+
+	rax = (__int64)*(DefectT + ix);
+	if(rax == rdx)
+		goto PAIR_CENTER;
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)(*(DefectY + rbx));
+	PairAddr->s_DefectType = (DefectType)rdx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + rbx));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + rbx));
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + rbx));
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+PAIR_CENTER_UNPAIR:
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	goto _return_PAIRING;
+
+END_FUNC:
+	iy ++;
+	*endLine = (int)iy;
+
+	return (int)nPair;
+}
+
+int CSISAssem::ConvPixel_Intrin_Twice(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+								  , __int64 left, __int64 right, __int64 top, __int64 bottom
+								  , int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+								  , int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+								  , __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+								  , short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+								  , CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+								  , __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+								  , __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, int* endLine
+								  , __int64 iPitch2, __int64 Threshold2, __int64 ThresholdSlide2)
+{
+	//芭措 搬窃阑 八免窍扁 困秦 厘林扁肺 茄锅歹 厚背茄促.
+	__int64 nPair1 = ConvPixel_Intrin(pImgBuff, Threshold, maxDefect, nDefect
+		, left, right, top, bottom
+		, DefectX, DefectY, DefectT, DefectValue
+		, pGraySrc, pGrayCmp, pZoneID, pZoneTh
+		, frameWidth, iPitch, fSPR, sSPR
+		, ZoneThTable, ZoneIdTable, ZoneTableWidth, pMatchTable
+		, pDefectdPair, StartPair, MaxPair, PairSize
+		, dxPattern, dyPattern, yZoneByte,  bReverseFilter
+		, ThresholdSlide, ThresholdSuppress, bUseUnpair, endLine
+		);
+
+	__int64 nPair2 = ConvPixel_Intrin(pImgBuff, Threshold2, maxDefect, nDefect
+		, left, right, top, bottom
+		, DefectX, DefectY, DefectT, DefectValue
+		, pGraySrc, pGrayCmp, pZoneID, pZoneTh
+		, frameWidth, iPitch2, fSPR, sSPR
+		, ZoneThTable, ZoneIdTable, ZoneTableWidth, pMatchTable
+		, pDefectdPair, nPair1, MaxPair, PairSize
+		, dxPattern, dyPattern, yZoneByte,  bReverseFilter
+		, ThresholdSlide2, ThresholdSuppress, bUseUnpair, endLine
+		);
+
+	//其绢傅等 搬窃吝 鞍篮 谅钎狼 Pair 绰 瘤款促.
+	__int64 iPair1, iPair2;
+	CDefectPair *pPair1, *pPair2;
+
+	for(iPair1= StartPair; iPair1 < nPair1; iPair1++)
+	{
+		pPair1= pDefectdPair+ iPair1;
+		if(pPair1->s_DefectType == DEFTYPE_DELETE)
+			continue;
+
+		for(iPair2= nPair1; iPair2 < nPair2; iPair2++)
+		{
+			pPair2= pDefectdPair+ iPair2;
+			if(pPair2->s_DefectType == DEFTYPE_DELETE)
+				continue;
+
+			if(pPair1->s_nDefectY < pPair2->s_nDefectY - 1)
+				break;
+
+			if(pPair1->s_nDefectX < pPair2->s_nDefectX - 1)
+				continue;
+
+			if(abs(pPair1->s_nDefectX - pPair2->s_nDefectX) < 2
+				&& abs(pPair1->s_nDefectY - pPair2->s_nDefectY) < 2)
+				pPair2->s_DefectType = DEFTYPE_DELETE;
+		}
+	}
+
+	int	oldBlob = m_nBlob;
+	m_nPair = (int)nPair1;
+	CBlobStorage::BlobDefect();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+
+	int nThres = m_Param.s_nThreshold;
+	int nDThSlide = m_Param.s_nDThSlide;
+	double dPitchConvReal = m_Param.s_dPitchConvReal;
+	double dPitchScanReal = m_Param.s_dPitchScanReal;
+
+	m_Param.s_nThreshold = m_Param.s_n2ndThres;
+	m_Param.s_nDThSlide = m_Param.s_n2ndThresSlide;
+	m_Param.s_dPitchConvReal = m_Param.s_d2ndPitch;
+	m_Param.s_dPitchScanReal = m_Param.s_d2ndPitch;
+
+	oldBlob = m_nBlob;
+	m_nPair = (int)nPair2;
+	CBlobStorage::BlobDefect();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilter(oldBlob, m_Param.GetRealConvPitch());
+
+	m_Param.s_nThreshold = nThres;
+	m_Param.s_nDThSlide = nDThSlide;
+	m_Param.s_dPitchConvReal = dPitchConvReal;
+	m_Param.s_dPitchScanReal = dPitchScanReal;
+
+	return (int)nPair2;
+}
+
+int CSISAssem::ConvPixelVertS_Intrin_Twice(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+											, __int64 left, __int64 right, __int64 top, __int64 bottom
+											, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+											, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+											, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+											, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+											, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+											, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+											, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+											, int* endLine, __int64 ExTh, __int64 iPitch2, __int64 Threshold2
+											, __int64 ThresholdSlide2
+											)
+{	
+	//芭措 搬窃阑 八免窍扁 困秦 厘林扁肺 茄锅歹 厚背茄促.
+	__int64 nPair1 = ConvPixelVertS_Intrin(pImgBuff, Threshold, maxDefect, nDefect
+		, left, right, top, bottom
+		, DefectX, DefectY, DefectT, DefectValue
+		, pGraySrc, pGrayCmp, pZoneID, pZoneTh
+		, frameWidth, iPitch16, fSPR, sSPR
+		, ZoneThTable, ZoneIdTable, ZoneTableWidth, pMatchTable
+		, pDefectdPair, StartPair, MaxPair, PairSize
+		, dxPattern, dyPattern, yZoneByte, bReverseFilter
+		, ThresholdSlide, ThresholdSuppress, bUseUnpair, pConBuff
+		, endLine, ExTh);	
+
+	__int64 nPair2 = ConvPixelVertS_Intrin(pImgBuff, Threshold2, maxDefect, nDefect
+		, left, right, top, bottom
+		, DefectX, DefectY, DefectT, DefectValue
+		, pGraySrc, pGrayCmp, pZoneID, pZoneTh
+		, frameWidth, iPitch2, fSPR, sSPR
+		, ZoneThTable, ZoneIdTable, ZoneTableWidth, pMatchTable
+		, pDefectdPair, nPair1, MaxPair, PairSize
+		, dxPattern, dyPattern, yZoneByte, bReverseFilter
+		, ThresholdSlide2, ThresholdSuppress, bUseUnpair, pConBuff
+		, endLine, ExTh);
+
+	//其绢傅等 搬窃吝 鞍篮 谅钎狼 Pair 绰 瘤款促.
+	__int64 iPair1, iPair2;
+	CDefectPair *pPair1, *pPair2;
+
+	for(iPair1= StartPair; iPair1 < nPair1; iPair1++)
+	{
+		pPair1= pDefectdPair+ iPair1;
+		if(pPair1->s_DefectType == DEFTYPE_DELETE)
+			continue;
+
+		for(iPair2= nPair1; iPair2 < nPair2; iPair2++)
+		{
+			pPair2= pDefectdPair+ iPair2;
+			if(pPair2->s_DefectType == DEFTYPE_DELETE)
+				continue;
+
+			if(pPair1->s_nDefectX < pPair2->s_nDefectX - 1)
+				break;
+
+			if(pPair1->s_nDefectY < pPair2->s_nDefectY - 1)
+				continue;
+
+			if(abs(pPair1->s_nDefectX - pPair2->s_nDefectX) < 2
+				&& abs(pPair1->s_nDefectY - pPair2->s_nDefectY) < 2)
+				pPair2->s_DefectType = DEFTYPE_DELETE;
+		}
+	}
+
+	int	oldBlob = m_nBlob;
+	m_nPair = (int)nPair1;
+	CBlobStorage::BlobDefectVert();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilterVert(oldBlob, m_Param.GetRealScanPitch());
+
+	int nThres = m_Param.s_nThreshold;
+	int nDThSlide = m_Param.s_nDThSlide;
+	double dPitchConvReal = m_Param.s_dPitchConvReal;
+	double dPitchScanReal = m_Param.s_dPitchScanReal;
+
+	m_Param.s_nThreshold = m_Param.s_n2ndThres;
+	m_Param.s_nDThSlide = m_Param.s_n2ndThresSlide;
+	m_Param.s_dPitchConvReal = m_Param.s_d2ndPitch;
+	m_Param.s_dPitchScanReal = m_Param.s_d2ndPitch;
+
+	oldBlob = m_nBlob;
+	m_nPair = (int)nPair2;
+	CBlobStorage::BlobDefectVert();
+	CBlobStorage::MergeDivision(oldBlob, m_Param.m_nDefectMergePixel);
+	CBlobStorage::ShadowFilterVert(oldBlob, m_Param.GetRealScanPitch());
+
+	m_Param.s_nThreshold = nThres;
+	m_Param.s_nDThSlide = nDThSlide;
+	m_Param.s_dPitchConvReal = dPitchConvReal;
+	m_Param.s_dPitchScanReal = dPitchScanReal;
+
+	return (int)nPair2;
+}
\ No newline at end of file
diff --git a/Common_Class/SISAssem/SISZoneIntrin.cpp b/Common_Class/SISAssem/SISZoneIntrin.cpp
new file mode 100644
index 0000000..c0664db
--- /dev/null
+++ b/Common_Class/SISAssem/SISZoneIntrin.cpp
@@ -0,0 +1,2734 @@
+
+#include "stdafx.h"
+
+#include "BlobStorage.h"
+#include <wmmintrin.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#include "SISAssem.h"
+#include "AssemParam.h"
+
+//20160816 yjm Assem->Intrinsic Convert(1by1 Vertical ZoneTh)
+int CSISAssem::ConvZoneVert2S_BOE_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+										   , __int64 left, __int64 right, __int64 top, __int64 bottom
+										   , int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+										   , int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+										   , __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+										   , short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+										   , CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+										   , __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+										   , short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+										   , __int64 ExTh, __int64 Suppress
+										   )
+{
+	const __int64 SprShift = 4;
+	const __int64 SprMulti = 16;
+	const __int64 szxMatch = 8;
+
+	__m128i	xxTemp;
+	__m128i	xxDSlide;
+
+	__m128i	xxZTh;
+	__m128i	xxZId;
+
+	__m128i	xxSrc1;
+	__m128i xxSrc2;
+
+	__m128i	xxCmp1;
+	__m128i xxCmp2;
+
+	__m128i	xxPeakS;
+	__m128i	xxPeakAbs;
+
+	__m128i	xxfSpr;
+	__m128i	xxsSpr;
+
+	__int64 rax, rbx, rcx, rdx;
+
+	__int64 ImgAddrOri	= (__int64)pImgBuff;
+	__int64 ConAddr = (__int64)pConBuff;
+	__int64 c8Pixel, rrNoD = 0, rrImgAddr, nPair = StartPair;
+
+	__m128i xxSupp = _mm_set1_epi16((short)Suppress);
+
+	rcx = iPitch16;
+	rcx &= 0x0f;
+	xxsSpr = _mm_set1_epi16((short)rcx);
+
+	rax = SprMulti;
+	rax -= rcx;
+	xxfSpr = _mm_set1_epi16((short)rax);
+
+	__int64 xMatch2 = 0;
+	__int64 iPitch = iPitch16 / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	if(rcx >= SprMulti / 2)
+		iPitchHUp++;
+
+	bottom--;
+	__int64 ConBottom = bottom - iPitch - 1;
+	__int64 pairBottom = ConBottom - iPitch;
+
+	// -------------- 嗷 Filtering -------------- //
+	CRect rtDeadZone[MAX_DEAD_ZONE_COUNT];
+	CPoint ptDefect;
+	memcpy(rtDeadZone, m_Param.s_RectDeadZone, sizeof(CRect) * MAX_DEAD_ZONE_COUNT);
+	int nDeadZoneCount = 0;
+	for(int i = 0; i < MAX_DEAD_ZONE_COUNT; i++)
+	{
+		if(rtDeadZone[i].IsRectEmpty() == TRUE)
+		{
+			nDeadZoneCount = i;
+			break;
+		}
+	}
+	// ------------------------------------------ //
+
+	__int64 pairTop = top + iPitch;
+	__int64 ConvPitch = iPitch * 0x20;
+	__int64 ZoneTableW2 = ZoneTableWidth + ZoneTableWidth;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	right = (right - left) / 16 * 16 + left;
+
+	__int64 pMatch1 = (__int64)pMatchTable;
+	pMatchTable = (void*)(pMatch1 + yZoneByte);
+	rcx = (__int64)pMatchTable;
+
+	rbx = (__int64)(*((int*)(rcx + 4)));
+	int yMatch = (int)rbx;
+	rdx = dyPattern + rbx;
+	__int64 eyPtrn = rdx;
+	__int64 eyPtrn1 = rdx;
+	rax = (iy - rbx) * ZoneTableWidth;
+
+	rbx = (__int64)(*((int*)rcx));
+	int xMatch = (int)rbx;
+	__int64 exPtrn = dxPattern + rbx;
+	rax += ix - rbx;
+	rax += rax;
+	rdx = (__int64)ZoneThTable + rax;
+	__int64	ZoneThAddr = rdx;
+	__int64	ZoneThAddr1 = rdx;
+	rdx = (__int64)ZoneIdTable + rax;
+	__int64	ZoneIdAddr = rdx;
+	__int64	ZoneIdAddr1 = rdx;
+	rdx = (__int64)ZoneAddTable + rax;
+	__int64	ZoneAddAddr = rdx;
+	__int64	ZoneAddAddr1 = rdx;
+
+	__m128i xxZero = _mm_setzero_si128();
+
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	//LOOP_1:
+	goto LOOP_1_CHECK;
+
+LOOP_1_TAIL:
+	goto PAIRING_VERT;
+
+_return_PAIRING_VERT:
+	ix += 0x10;
+	eyPtrn = eyPtrn1;
+	pMatchTable = (void*)pMatch1;
+	ZoneThAddr1 += 0x20;
+	ZoneThAddr = ZoneThAddr1;
+	ZoneIdAddr1 += 0x20;
+	ZoneIdAddr = ZoneIdAddr1;
+	ZoneAddAddr1 += 0x20;
+	ZoneAddAddr = ZoneAddAddr1;
+
+LOOP_1_CHECK:
+	if(ix >= right)
+		goto END_FUNC;
+
+//LOOP_1_BODY:
+	iy = top;
+	rrImgAddr = ImgAddrOri + frameWidth * iy + ix;
+	goto MAKE_CONBUFF_HEAD;
+
+_return_MAKE_CONBUFF:
+	iy = top;
+	rrImgAddr = ConAddr;
+	if(ix >= exPtrn)
+		goto CHECK_1_BOUND;
+
+_return_CHECK_1_BOUND:
+//LOOP_2:
+	goto LOOP_2_CHECK;
+
+LOOP_2_TAIL:
+	iy++;
+	rrImgAddr += 0x20;
+	ZoneThAddr += ZoneTableW2;
+	ZoneIdAddr += ZoneTableW2;
+	ZoneAddAddr += ZoneTableW2;
+
+LOOP_2_CHECK:
+	if(iy >= ConBottom)
+		goto LOOP_1_TAIL;
+
+	if(iy >= eyPtrn)
+		goto CHECK_2_BOUND;
+
+_return_CHECK_2_BOUND:
+	//LOOP_2_BODY:
+	goto XMM_MAKE;
+
+MAKE_CONBUFF_HEAD:
+	rax = ConAddr;
+
+MAKE_CONBUFF:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	_mm_storeu_si128((__m128i*)rax, _mm_unpacklo_epi8(xxSrc1, xxZero));
+	_mm_storeu_si128((__m128i*)(rax + 0x10), _mm_unpackhi_epi8(xxSrc1, xxZero));
+	rrImgAddr += frameWidth;
+	rax += 0x20;
+	iy++;
+	if(iy <= bottom)
+		goto MAKE_CONBUFF;
+	goto _return_MAKE_CONBUFF;
+
+CHECK_1_BOUND:
+	pMatch1 += szxMatch;
+	rcx = pMatch1 + yZoneByte;
+	pMatchTable = (void*)rcx;
+	yMatch = *((int*)(rcx + 4));
+	rdx = dyPattern + yMatch;
+	eyPtrn = eyPtrn1 = rdx;
+	rax = (iy - yMatch) * ZoneTableWidth;
+	xMatch = *(int*)(rcx);
+	rdx = dxPattern + xMatch;
+	rcx = xMatch + dxPattern;
+	if(rcx < right)
+		goto EXCESS_1_BOUND_PASS;
+	rdx = rcx;
+
+EXCESS_1_BOUND_PASS:
+	exPtrn = rdx;
+	rax += (ix - xMatch);
+	rax += rax;
+	ZoneThAddr1 = ZoneThAddr = (__int64)ZoneThTable + rax;
+	ZoneIdAddr1 = ZoneIdAddr = (__int64)ZoneIdTable + rax;
+	ZoneAddAddr1 = ZoneAddAddr = (__int64)ZoneAddTable + rax;
+	xMatch2++;
+	goto _return_CHECK_1_BOUND;
+
+CHECK_2_BOUND:
+	pMatchTable = (void*)((__int64)pMatchTable + yZoneByte);
+	rbx = (__int64)(*((int*)((__int64)pMatchTable + 4)));
+	yMatch = (int)rbx;
+	eyPtrn = dyPattern + rbx;
+	rax = eyPtrn + dyPattern;
+	if(rax < bottom)
+		goto EXCESS_2_BOUND_PASS;
+	eyPtrn = rax;
+
+EXCESS_2_BOUND_PASS:
+	rax = (iy - rbx) * ZoneTableWidth;
+	xMatch =*((int*)pMatchTable);
+	rax += ix - xMatch;
+	rax += rax;
+	ZoneThAddr = (__int64)ZoneThTable + rax;
+	ZoneIdAddr = (__int64)ZoneIdTable + rax;
+	ZoneAddAddr = (__int64)ZoneAddTable + rax;
+	goto _return_CHECK_2_BOUND;
+
+XMM_MAKE:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxSrc2 = _mm_loadu_si128((__m128i*) (rrImgAddr + 0x10));
+
+	rax = rrImgAddr + ConvPitch;
+
+	xxCmp1 = _mm_loadu_si128((__m128i*) rax);
+	xxCmp2 = _mm_loadu_si128((__m128i*) (rax + 0x10));
+	xxTemp = _mm_loadu_si128((__m128i*) (rax + 0x20));
+	xxDSlide = _mm_loadu_si128((__m128i*) (rax + 0x30));
+
+	xxCmp1 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp1, xxfSpr), _mm_mullo_epi16(xxTemp, xxsSpr)), SprShift);
+	xxCmp2 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp2, xxfSpr), _mm_mullo_epi16(xxDSlide, xxsSpr)), SprShift);
+	goto XMM_COMPARE;
+
+XMM_COMPARE_END:
+	ix -= 0x10;
+	ZoneThAddr -= 0x10;
+	ZoneIdAddr -= 0x10;
+	ZoneAddAddr -= 0x10;
+	goto LOOP_2_TAIL;
+
+XMM_COMPARE:
+	c8Pixel = 0;
+	xxSrc1 = _mm_min_epu16(xxSrc1, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp1, xxSupp);
+	goto _XMM_COMPARE_8PIXEL;
+
+_return_XMM_COMPARE_8PIXEL:
+	if(rrNoD >= maxDefect)
+		goto PAIRING_VERT;
+
+	c8Pixel++;
+	if(c8Pixel == 2)
+		goto XMM_COMPARE_END;
+
+	xxSrc1 = _mm_min_epu16(xxSrc2, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp2, xxSupp);
+	ZoneThAddr += 0x10;
+	ZoneIdAddr += 0x10;
+	ZoneAddAddr += 0x10;
+
+_XMM_COMPARE_8PIXEL:
+	xxTemp = _mm_loadu_si128((__m128i*) ZoneThAddr);
+	xxDSlide = _mm_loadu_si128((__m128i*) ZoneAddAddr);
+
+	xxZTh = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxTemp);
+	xxPeakS = _mm_sub_epi16(xxSrc1, xxCmp1);
+	xxPeakAbs = _mm_abs_epi16(xxPeakS);
+	xxTemp = _mm_cmpgt_epi16(xxPeakAbs, xxZTh);
+	if(_mm_movemask_epi8(xxTemp) != 0)
+		goto DEFECT_00;
+
+	ix += 8;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+DEFECT_00:
+	xxZId = _mm_loadu_si128((__m128i*) ZoneIdAddr);
+	if(_mm_extract_epi16(xxTemp, 0x00) == 0)
+		goto DEFECT_01;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x00);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x00);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x00);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x00);
+	if((short)_mm_extract_epi16(xxPeakS, 0x00)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x01) == 0)
+		goto DEFECT_02;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x01);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x01);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x01);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x01);
+	if((short)_mm_extract_epi16(xxPeakS, 0x01)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x02) == 0)
+		goto DEFECT_03;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x02);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x02);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x02);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x02);
+	if((short)_mm_extract_epi16(xxPeakS, 0x02)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x03) == 0)
+		goto DEFECT_04;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x03);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x03);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x03);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x03);
+	if((short)_mm_extract_epi16(xxPeakS, 0x03)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x04) == 0)
+		goto DEFECT_05;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x04);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x04);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x04);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x04);
+	if((short)_mm_extract_epi16(xxPeakS, 0x04)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x05) == 0)
+		goto DEFECT_06;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x05);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x05);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x05);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x05);
+	if((short)_mm_extract_epi16(xxPeakS, 0x05)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x06) == 0)
+		goto DEFECT_07;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x06);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x06);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x06);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x06);
+	if((short)_mm_extract_epi16(xxPeakS, 0x06)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x07) == 0)
+		goto DEFECT_08;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x07);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x07);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x07);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x07);
+	if((short)_mm_extract_epi16(xxPeakS, 0x07)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_08:
+	ix++;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+PAIRING_VERT:
+	iy = -1;
+
+LOOP_PAIR_NUM:
+	iy++;
+	if(iy >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(rax >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + iy) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = iy;
+	rcx = *(DefectY + iy);
+	rax = rcx + iPitchHUp;
+	rrImgAddr = *(DefectX + iy);
+
+	if(rcx > pairBottom)
+		goto PAIR_BOTTOM;
+
+	if(rcx >= pairTop)
+		goto PAIR_CENTER;
+
+PAIR_TOP:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_TOP_UNPAIR;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_TOP;
+	else if(rdx > rax)
+		goto PAIR_TOP_UNPAIR;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_TOP;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + rbx));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + rbx));
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + rbx));
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_TOP_UNPAIR:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)(rrImgAddr);
+	ptDefect.y = (LONG)(rax - iPitchHUp);
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)ptDefect.x;
+	PairAddr->s_nDefectY = (int)ptDefect.y;
+	PairAddr->s_DefectType = (DefectType)*(DefectT + iy);
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + iy));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + iy));
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + iy));
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_CENTER;
+	else if(rdx > rax)
+		goto LOOP_PAIR_NUM;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_CENTER;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + rbx));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + rbx));
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + rbx));
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_BOTTOM:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rrImgAddr;
+	ptDefect.y = (LONG)rax;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrImgAddr;
+	PairAddr->s_nDefectY = (int)rax;
+	rdx = (*(DefectT + iy) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rdx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(*(pGrayCmp + iy));
+	PairAddr->s_nGrayRef = (int)(*(pGraySrc + iy));
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + iy));
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	goto _return_PAIRING_VERT;
+
+END_FUNC:
+	ix += 0x10;
+	*endLine = (int)ix;
+
+	return (int)nPair;
+}
+
+//粮喊Th 吝 啊厘 撤篮 巩盼蔼栏肺 刚历 八荤茄 第俊, 八免等 搬窃阑 粮喊Th肺 犁八荤茄促.
+//厘痢: Th Table 阑 曼炼 救秦辑 Speed up!(厘林扁 Th Table 篮 某矫 利吝捞 救登绢 蠢府促.)
+//窜痢: 犁八荤矫 茄率 规氢 厚背父窍咯 啊搬窃 惯积咯何, 啊厘 撤篮 巩盼蔼栏肺 八荤且 锭 搬窃捞 促惯窍搁 绢痘霸 瞪瘤 葛福摆匙?
+int CSISAssem::ConvZoneVert2S_TSP_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+										   , __int64 left, __int64 right, __int64 top, __int64 bottom
+										   , int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+										   , int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+										   , __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+										   , short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+										   , CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+										   , __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+										   , short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+										   , __int64 ExTh, __int64 Suppress
+										   )
+{
+	const __int64 SprShift = 4;
+	const __int64 SprMulti = 16;
+	const __int64 szxMatch = 8;
+
+	__m128i	xxTemp;
+	__m128i	xxDSlide;
+
+	__m128i	xxZTh;
+	__m128i	xxZId;
+
+	__m128i	xxSrc1;
+	__m128i xxSrc2;
+
+	__m128i	xxCmp1;
+	__m128i xxCmp2;
+
+	__m128i	xxPeakS;
+	__m128i	xxPeakAbs;
+
+	__m128i	xxfSpr;
+	__m128i	xxsSpr;
+
+	__int64 rax, rbx, rcx, rdx;
+
+	__int64 ImgAddrOri	= (__int64)pImgBuff;
+	__int64 ConAddr = (__int64)pConBuff;
+	__int64 c8Pixel, rrNoD = 0, rrImgAddr, nPair = StartPair;
+
+	__m128i xxSupp = _mm_set1_epi16((short)Suppress);
+
+	rcx = iPitch16;
+	rcx &= 0x0f;
+	xxsSpr = _mm_set1_epi16((short)rcx);
+
+	rax = SprMulti;
+	rax -= rcx;
+	xxfSpr = _mm_set1_epi16((short)rax);
+
+	Threshold = 256;
+	for(int i = 0; i < 16; i++)
+	{
+		if(m_Param.m_pSpeedZoneTh[i] != 0 && m_Param.m_pSpeedZoneTh[i] < Threshold)
+			Threshold = m_Param.m_pSpeedZoneTh[i];
+	}
+
+	xxZTh = _mm_set1_epi16((short)Threshold);
+	short	sSrc, sDest, sDiff, sZone, sZoneTh;
+
+	__int64 xMatch2 = 0;
+	__int64 iPitch = iPitch16 / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	if(rcx >= SprMulti / 2)
+		iPitchHUp++;
+
+	bottom--;
+	__int64 ConBottom = bottom - iPitch - 1;
+	__int64 pairBottom = ConBottom - iPitch;
+	__int64 pairTop = top + iPitch;
+	__int64 ConvPitch = iPitch * 0x20;
+	__int64 ZoneTableW2 = ZoneTableWidth + ZoneTableWidth;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	right = (right - left) / 16 * 16 + left;
+
+	__int64 pMatch1 = (__int64)pMatchTable;
+	pMatchTable = (void*)(pMatch1 + yZoneByte);
+	rcx = (__int64)pMatchTable;
+
+	rbx = (__int64)(*((int*)(rcx + 4)));
+	int yMatch = (int)rbx;
+	rdx = dyPattern + rbx;
+	__int64 eyPtrn = rdx;
+	__int64 eyPtrn1 = rdx;
+	rax = (iy - rbx) * ZoneTableWidth;
+
+	rbx = (__int64)(*((int*)rcx));
+	int xMatch = (int)rbx;
+	__int64 exPtrn = dxPattern + rbx;
+	rax += ix - rbx;
+	rax += rax;
+	rdx = (__int64)ZoneThTable + rax;
+	__int64	ZoneThAddr = rdx;
+	__int64	ZoneThAddr1 = rdx;
+	rdx = (__int64)ZoneIdTable + rax;
+	__int64	ZoneIdAddr = rdx;
+	__int64	ZoneIdAddr1 = rdx;
+	rdx = (__int64)ZoneAddTable + rax;
+	__int64	ZoneAddAddr = rdx;
+	__int64	ZoneAddAddr1 = rdx;
+
+	__m128i xxZero = _mm_setzero_si128();
+
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	//LOOP_1:
+	goto LOOP_1_CHECK;
+
+LOOP_1_TAIL:
+	goto PAIRING_VERT;
+
+_return_PAIRING_VERT:
+	ix += 0x10;
+	eyPtrn = eyPtrn1;
+	pMatchTable = (void*)pMatch1;
+	ZoneThAddr1 += 0x20;
+	ZoneThAddr = ZoneThAddr1;
+	ZoneIdAddr1 += 0x20;
+	ZoneIdAddr = ZoneIdAddr1;
+	ZoneAddAddr1 += 0x20;
+	ZoneAddAddr = ZoneAddAddr1;
+
+LOOP_1_CHECK:
+	if(ix >= right)
+		goto END_FUNC;
+
+	//LOOP_1_BODY:
+	iy = top;
+	rrImgAddr = ImgAddrOri + frameWidth * iy + ix;
+	goto MAKE_CONBUFF_HEAD;
+
+_return_MAKE_CONBUFF:
+	iy = top;
+	rrImgAddr = ConAddr;
+	if(ix >= exPtrn)
+		goto CHECK_1_BOUND;
+
+_return_CHECK_1_BOUND:
+	//LOOP_2:
+	goto LOOP_2_CHECK;
+
+LOOP_2_TAIL:
+	iy++;
+	rrImgAddr += 0x20;
+	ZoneThAddr += ZoneTableW2;
+	ZoneIdAddr += ZoneTableW2;
+	ZoneAddAddr += ZoneTableW2;
+
+LOOP_2_CHECK:
+	if(iy >= ConBottom)
+		goto LOOP_1_TAIL;
+
+	if(iy >= eyPtrn)
+		goto CHECK_2_BOUND;
+
+_return_CHECK_2_BOUND:
+	//LOOP_2_BODY:
+	goto XMM_MAKE;
+
+MAKE_CONBUFF_HEAD:
+	rax = ConAddr;
+
+MAKE_CONBUFF:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	_mm_storeu_si128((__m128i*)rax, _mm_unpacklo_epi8(xxSrc1, xxZero));
+	_mm_storeu_si128((__m128i*)(rax + 0x10), _mm_unpackhi_epi8(xxSrc1, xxZero));
+	rrImgAddr += frameWidth;
+	rax += 0x20;
+	iy++;
+	if(iy <= bottom)
+		goto MAKE_CONBUFF;
+	goto _return_MAKE_CONBUFF;
+
+CHECK_1_BOUND:
+	pMatch1 += szxMatch;
+	rcx = pMatch1 + yZoneByte;
+	pMatchTable = (void*)rcx;
+	yMatch = *((int*)(rcx + 4));
+	rdx = dyPattern + yMatch;
+	eyPtrn = eyPtrn1 = rdx;
+	rax = (iy - yMatch) * ZoneTableWidth;
+	xMatch = *(int*)(rcx);
+	rdx = dxPattern + xMatch;
+	rcx = xMatch + dxPattern;
+	if(rcx < right)
+		goto EXCESS_1_BOUND_PASS;
+	rdx = rcx;
+
+EXCESS_1_BOUND_PASS:
+	exPtrn = rdx;
+	rax += (ix - xMatch);
+	rax += rax;
+	ZoneThAddr1 = ZoneThAddr = (__int64)ZoneThTable + rax;
+	ZoneIdAddr1 = ZoneIdAddr = (__int64)ZoneIdTable + rax;
+	ZoneAddAddr1 = ZoneAddAddr = (__int64)ZoneAddTable + rax;
+	xMatch2++;
+	goto _return_CHECK_1_BOUND;
+
+CHECK_2_BOUND:
+	pMatchTable = (void*)((__int64)pMatchTable + yZoneByte);
+	rbx = (__int64)(*((int*)((__int64)pMatchTable + 4)));
+	yMatch = (int)rbx;
+	eyPtrn = dyPattern + rbx;
+	rax = eyPtrn + dyPattern;
+	if(rax < bottom)
+		goto EXCESS_2_BOUND_PASS;
+	eyPtrn = rax;
+
+EXCESS_2_BOUND_PASS:
+	rax = (iy - rbx) * ZoneTableWidth;
+	xMatch =*((int*)pMatchTable);
+	rax += ix - xMatch;
+	rax += rax;
+	ZoneThAddr = (__int64)ZoneThTable + rax;
+	ZoneIdAddr = (__int64)ZoneIdTable + rax;
+	ZoneAddAddr = (__int64)ZoneAddTable + rax;
+	goto _return_CHECK_2_BOUND;
+
+XMM_MAKE:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxSrc2 = _mm_loadu_si128((__m128i*) (rrImgAddr + 0x10));
+
+	rax = rrImgAddr + ConvPitch;
+
+	xxCmp1 = _mm_loadu_si128((__m128i*) rax);
+	xxCmp2 = _mm_loadu_si128((__m128i*) (rax + 0x10));
+	xxTemp = _mm_loadu_si128((__m128i*) (rax + 0x20));
+	xxDSlide = _mm_loadu_si128((__m128i*) (rax + 0x30));
+
+	xxCmp1 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp1, xxfSpr), _mm_mullo_epi16(xxTemp, xxsSpr)), SprShift);
+	xxCmp2 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp2, xxfSpr), _mm_mullo_epi16(xxDSlide, xxsSpr)), SprShift);
+	goto XMM_COMPARE;
+
+XMM_COMPARE_END:
+	ix -= 0x10;
+	ZoneThAddr -= 0x10;
+	ZoneIdAddr -= 0x10;
+	ZoneAddAddr -= 0x10;
+	goto LOOP_2_TAIL;
+
+XMM_COMPARE:
+	c8Pixel = 0;
+	xxSrc1 = _mm_min_epu16(xxSrc1, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp1, xxSupp);
+	goto _XMM_COMPARE_8PIXEL;
+
+_return_XMM_COMPARE_8PIXEL:
+	if(rrNoD >= maxDefect)
+		goto PAIRING_VERT;
+
+	c8Pixel++;
+	if(c8Pixel == 2)
+		goto XMM_COMPARE_END;
+
+	xxSrc1 = _mm_min_epu16(xxSrc2, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp2, xxSupp);
+	ZoneThAddr += 0x10;
+	ZoneIdAddr += 0x10;
+	ZoneAddAddr += 0x10;
+
+_XMM_COMPARE_8PIXEL:
+	//xxTemp = _mm_loadu_si128((__m128i*) ZoneThAddr);
+	//xxDSlide = _mm_loadu_si128((__m128i*) ZoneAddAddr);
+
+	//xxZTh = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxTemp);
+
+	xxPeakS = _mm_sub_epi16(xxSrc1, xxCmp1);
+	xxPeakAbs = _mm_abs_epi16(xxPeakS);
+	xxTemp = _mm_cmpgt_epi16(xxPeakAbs, xxZTh);
+	if(_mm_movemask_epi8(xxTemp) != 0)
+		goto DEFECT_00;
+
+	ix += 8;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+DEFECT_00:
+	xxZId = _mm_loadu_si128((__m128i*) ZoneIdAddr);
+	if(_mm_extract_epi16(xxTemp, 0x00) == 0)
+		goto DEFECT_01;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x00);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x00);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x00);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x00);
+	if((short)_mm_extract_epi16(xxPeakS, 0x00)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x01) == 0)
+		goto DEFECT_02;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x01);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x01);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x01);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x01);
+	if((short)_mm_extract_epi16(xxPeakS, 0x01)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x02) == 0)
+		goto DEFECT_03;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x02);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x02);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x02);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x02);
+	if((short)_mm_extract_epi16(xxPeakS, 0x02)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x03) == 0)
+		goto DEFECT_04;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x03);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x03);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x03);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x03);
+	if((short)_mm_extract_epi16(xxPeakS, 0x03)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x04) == 0)
+		goto DEFECT_05;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x04);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x04);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x04);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x04);
+	if((short)_mm_extract_epi16(xxPeakS, 0x04)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x05) == 0)
+		goto DEFECT_06;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x05);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x05);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x05);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x05);
+	if((short)_mm_extract_epi16(xxPeakS, 0x05)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x06) == 0)
+		goto DEFECT_07;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x06);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x06);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x06);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x06);
+	if((short)_mm_extract_epi16(xxPeakS, 0x06)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x07) == 0)
+		goto DEFECT_08;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x07);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x07);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x07);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x07);
+	if((short)_mm_extract_epi16(xxPeakS, 0x07)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_08:
+	ix++;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+PAIRING_VERT:
+	iy = -1;
+
+LOOP_PAIR_NUM:
+	iy++;
+	if(iy >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(rax >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + iy) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = iy;
+	rcx = *(DefectY + iy);
+	rax = rcx + iPitchHUp;
+	rrImgAddr = *(DefectX + iy);
+
+	if(rcx > pairBottom)
+		goto PAIR_BOTTOM;
+
+	if(rcx >= pairTop)
+		goto PAIR_CENTER;
+
+PAIR_TOP:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_TOP_UNPAIR;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_TOP;
+	else if(rdx > rax)
+		goto PAIR_TOP_UNPAIR;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_TOP;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	sSrc = (*(pGraySrc + rbx));
+	sDest = (*(pGrayCmp + rbx));
+	sZone = (*(pZoneID + rbx));
+	sDiff = abs(sSrc - sDest);
+	sZoneTh = max(sSrc, sDest) * m_Param.m_pSpeedZoneThSlide[sZone] / 256 + m_Param.m_pSpeedZoneTh[sZone];
+
+	if(sDiff < sZoneTh)
+		goto LOOP_PAIR_NUM;
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)sSrc;
+	PairAddr->s_nGrayRef = (int)sDest;
+	PairAddr->s_nZone = (int)sZone;
+	PairAddr->s_nThresold = (int)sZoneTh;
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_TOP_UNPAIR:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+	sSrc = (*(pGraySrc + iy));
+	sDest = (*(pGrayCmp + iy));
+	sZone = (*(pZoneID + iy));
+	sDiff = abs(sSrc - sDest);
+	sZoneTh = max(sSrc, sDest) * m_Param.m_pSpeedZoneThSlide[sZone] / 256 + m_Param.m_pSpeedZoneTh[sZone];
+
+	if(sDiff < sZoneTh)
+		goto LOOP_PAIR_NUM;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrImgAddr;
+	rax -= iPitchHUp;
+	PairAddr->s_nDefectY = (int)rax;
+	PairAddr->s_DefectType = (DefectType)*(DefectT + iy);
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)sSrc;
+	PairAddr->s_nGrayRef = (int)sDest;
+	PairAddr->s_nZone = (int)sZone;
+	PairAddr->s_nThresold = (int)sZoneTh;
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_CENTER;
+	else if(rdx > rax)
+		goto LOOP_PAIR_NUM;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_CENTER;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	sSrc = (*(pGraySrc + rbx));
+	sDest = (*(pGrayCmp + rbx));
+	sZone = (*(pZoneID + rbx));
+	sDiff = abs(sSrc - sDest);
+	sZoneTh = max(sSrc, sDest) * m_Param.m_pSpeedZoneThSlide[sZone] / 256 + m_Param.m_pSpeedZoneTh[sZone];
+
+	if(sDiff < sZoneTh)
+		goto LOOP_PAIR_NUM;
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)sSrc;
+	PairAddr->s_nGrayRef = (int)sDest;
+	PairAddr->s_nZone = (int)sZone;
+	PairAddr->s_nThresold = (int)sZoneTh;
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_BOTTOM:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	sSrc = (*(pGrayCmp + iy));
+	sDest = (*(pGraySrc + iy));
+	sZone = (*(pZoneID + iy));
+	sDiff = abs(sSrc - sDest);
+	sZoneTh = max(sSrc, sDest) * m_Param.m_pSpeedZoneThSlide[sZone] / 256 + m_Param.m_pSpeedZoneTh[sZone];
+
+	if(sDiff < sZoneTh)
+		goto LOOP_PAIR_NUM;
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrImgAddr;
+	PairAddr->s_nDefectY = (int)rax;
+	rdx = (*(DefectT + iy) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rdx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)sSrc;
+	PairAddr->s_nGrayRef = (int)sDest;
+	PairAddr->s_nZone = (int)sZone;
+	PairAddr->s_nThresold = (int)sZoneTh;
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	goto _return_PAIRING_VERT;
+
+END_FUNC:
+	ix += 0x10;
+	*endLine = (int)ix;
+
+	return (int)nPair;
+}
+
+int CSISAssem::ConvZoneVTD_BOE_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+	, __int64 left, __int64 right, __int64 top, __int64 bottom
+	, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+	, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+	, __int64 frameWidth, int* piPitch16, __int64 iPitch16, __int64 sSPR
+	, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+	, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+	, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+	, short* ZoneAddTable, __int64 Tilt16, __int64 bUseUnpair, int* endLine
+	, __int64 ExTh, __int64 Suppress
+	)
+{
+	const __int64 SprShift = 4;
+	const __int64 SprMulti = 16;
+	const __int64 szxMatch = 8;
+
+	__m128i	xxTemp;
+	__m128i	xxDSlide;
+
+	__m128i	xxZTh;
+	__m128i	xxZId;
+
+	__m128i	xxSrc1;
+	__m128i xxSrc2;
+
+	__m128i	xxCmp1;
+	__m128i xxCmp2;
+
+	__m128i	xxPeakS;
+	__m128i	xxPeakAbs;
+
+	__m128i	xxfSpr;
+	__m128i	xxsSpr;
+
+	__m128i	xxfSprT;
+	__m128i	xxsSprT;
+
+	__int64 rax, rbx, rcx, rdx;
+
+	__int64 ImgAddrOri	= (__int64)pImgBuff;
+	__int64 c8Pixel, rrNoD = 0, rrImgAddr, nPair = StartPair, _piPitch16, cDpc;
+
+	__m128i xxSupp = _mm_set1_epi16((short)Suppress);
+
+	rax = Tilt16;
+	rax &= 0x0f;
+	xxsSprT = _mm_set1_epi16((short)rax);
+
+	rcx = SprMulti;
+	rcx -= rax;
+	xxfSprT = _mm_set1_epi16((short)rcx);
+
+	Tilt16 /= SprMulti;
+
+	rcx = iPitch16;
+	rcx &= 0x0f;
+	xxsSpr = _mm_set1_epi16((short)rcx);
+
+	rax = SprMulti;
+	rax -= rcx;
+	xxfSpr = _mm_set1_epi16((short)rax);
+
+	__int64 xMatch2 = 0;
+	__int64 iPitch = iPitch16 / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	if(rcx >= SprMulti / 2)
+		iPitchHUp++;
+	iPitch16 = -1;
+	bottom--;
+	bottom = bottom - iPitch - 1;
+	__int64 pairBottom = bottom - iPitch;
+
+	// -------------- 嗷 Filtering -------------- //
+	CRect rtDeadZone[MAX_DEAD_ZONE_COUNT];
+	CPoint ptDefect;
+	memcpy(rtDeadZone, m_Param.s_RectDeadZone, sizeof(CRect) * MAX_DEAD_ZONE_COUNT);
+	int nDeadZoneCount = 0;
+	for(int i = 0; i < MAX_DEAD_ZONE_COUNT; i++)
+	{
+		if(rtDeadZone[i].IsRectEmpty() == TRUE)
+		{
+			nDeadZoneCount = i;
+			break;
+		}
+	}
+	// ------------------------------------------ //
+
+	__int64 pairTop = top + iPitch;
+	__int64 ConvPitch = iPitch * frameWidth;
+	__int64 ZoneTableW2 = ZoneTableWidth + ZoneTableWidth;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	right = (right - left) / 16 * 16 + left;
+
+	__int64 pMatch1 = (__int64)pMatchTable;
+	pMatchTable = (void*)(pMatch1 + yZoneByte);
+	rcx = (__int64)pMatchTable;
+
+	rbx = (__int64)(*((int*)(rcx + 4)));
+	int yMatch = (int)rbx;
+	rdx = dyPattern + rbx;
+	__int64 eyPtrn = rdx;
+	__int64 eyPtrn1 = rdx;
+	rax = (iy - rbx) * ZoneTableWidth;
+
+	rbx = (__int64)(*((int*)rcx));
+	int xMatch = (int)rbx;
+	__int64 exPtrn = dxPattern + rbx;
+	rax += ix - rbx;
+	rax += rax;
+	rdx = (__int64)ZoneThTable + rax;
+	__int64	ZoneThAddr = rdx;
+	__int64	ZoneThAddr1 = rdx;
+	rdx = (__int64)ZoneIdTable + rax;
+	__int64	ZoneIdAddr = rdx;
+	__int64	ZoneIdAddr1 = rdx;
+	rdx = (__int64)ZoneAddTable + rax;
+	__int64	ZoneAddAddr = rdx;
+	__int64	ZoneAddAddr1 = rdx;
+
+	__m128i xxZero = _mm_setzero_si128();
+
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	//LOOP_1:
+	goto LOOP_1_CHECK;
+
+LOOP_1_TAIL:
+	goto PAIRING_VERT;
+
+_return_PAIRING_VERT:
+	ix += 0x10;
+	eyPtrn = eyPtrn1;
+	pMatchTable = (void*)pMatch1;
+	ZoneThAddr1 += 0x20;
+	ZoneThAddr = ZoneThAddr1;
+	ZoneIdAddr1 += 0x20;
+	ZoneIdAddr = ZoneIdAddr1;
+	ZoneAddAddr1 += 0x20;
+	ZoneAddAddr = ZoneAddAddr1;
+
+LOOP_1_CHECK:
+	if(ix >= right)
+		goto END_FUNC;
+
+	//LOOP_1_BODY:
+	iy = top;
+	rrImgAddr = ImgAddrOri + frameWidth * iy + ix;
+
+	_piPitch16 = 0;
+	if(piPitch16 == NULL)
+		goto DPC_PASS;
+
+	rax = iy;
+	rax /= 16;
+	rax *= 4;
+	rax += __int64(piPitch16);
+	_piPitch16 = rax;
+
+DPC_PASS:
+	if(ix >= exPtrn)
+		goto CHECK_1_BOUND;
+
+_return_CHECK_1_BOUND:
+		
+//LOOP_2:
+	cDpc = 0x10;
+	goto LOOP_2_CHECK;
+
+LOOP_2_TAIL:
+	iy++;
+	rrImgAddr += frameWidth;
+	ZoneThAddr += ZoneTableW2;
+	ZoneIdAddr += ZoneTableW2;
+	ZoneAddAddr += ZoneTableW2;
+
+LOOP_2_CHECK:
+	if(iy >= bottom)
+		goto LOOP_1_TAIL;
+
+	if(iy >= eyPtrn)
+		goto CHECK_2_BOUND;
+
+_return_CHECK_2_BOUND:
+	
+//LOOP_2_BODY:
+	if(_piPitch16 == 0)
+		goto XMM_MAKE;
+	goto DPC_MAKE;
+_return_DPC_MAKE:
+	cDpc++;
+	goto XMM_MAKE;
+_return_XMM_MAKE:
+	goto XMM_COMPARE;
+//_return_XMM_COMPARE:
+	goto LOOP_2_TAIL;
+
+CHECK_1_BOUND:
+	pMatch1 += szxMatch;
+	rcx = pMatch1 + yZoneByte;
+	pMatchTable = (void*)rcx;
+	yMatch = *((int*)(rcx + 4));
+	rdx = dyPattern + yMatch;
+	eyPtrn = eyPtrn1 = rdx;
+	rax = (iy - yMatch) * ZoneTableWidth;
+	xMatch = *(int*)(rcx);
+	rdx = dxPattern + xMatch;
+	rcx = xMatch + dxPattern;
+	if(rcx < right)
+		goto EXCESS_1_BOUND_PASS;
+	rdx = rcx;
+
+EXCESS_1_BOUND_PASS:
+	exPtrn = rdx;
+	rax += (ix - xMatch);
+	rax += rax;
+	ZoneThAddr1 = ZoneThAddr = (__int64)ZoneThTable + rax;
+	ZoneIdAddr1 = ZoneIdAddr = (__int64)ZoneIdTable + rax;
+	ZoneAddAddr1 = ZoneAddAddr = (__int64)ZoneAddTable + rax;
+	xMatch2++;
+	goto _return_CHECK_1_BOUND;
+
+CHECK_2_BOUND:
+	pMatchTable = (void*)((__int64)pMatchTable + yZoneByte);
+	rbx = (__int64)(*((int*)((__int64)pMatchTable + 4)));
+	yMatch = (int)rbx;
+	eyPtrn = dyPattern + rbx;
+	rax = eyPtrn + dyPattern;
+	if(rax < bottom)
+		goto EXCESS_2_BOUND_PASS;
+	eyPtrn = rax;
+
+EXCESS_2_BOUND_PASS:
+	rax = (iy - rbx) * ZoneTableWidth;
+	xMatch =*((int*)pMatchTable);
+	rax += ix - xMatch;
+	rax += rax;
+	ZoneThAddr = (__int64)ZoneThTable + rax;
+	ZoneIdAddr = (__int64)ZoneIdTable + rax;
+	ZoneAddAddr = (__int64)ZoneAddTable + rax;
+	goto _return_CHECK_2_BOUND;
+
+DPC_MAKE:	// verticla 篮 16锅俊 茄锅究父 肺爹茄促. cDpc 墨款飘, 悼老 Pitch 魄窜饶 Pass 扁瓷
+	if(cDpc != 0x10)				//cmp		cDpc, 010h
+		goto _return_DPC_MAKE;		//jne		_return_DPC_MAKE
+	cDpc = 0;						//mov		cDpc, 0
+	rax = _piPitch16;				//mov		rax, piPitch16
+	rax = *(int*)(rax);				//movsxd	rax, dword ptr[rax]
+	_piPitch16 +=4;					//add		piPitch16, 4
+
+	if(iPitch16 == rax)				//cmp		iPitch16, rax
+		goto _return_DPC_MAKE;		//je		_return_DPC_MAKE
+
+	iPitch16 = rax;					//mov		iPitch16, rax	
+	rcx = rax;						//mov		rcx, rax
+	rcx &= 0x0f;					//and		rcx, 0fh
+
+	rax /= 16;						//shr		rax, SprShift
+	iPitch = rax;					//mov		iPitch, rax
+
+	rax *= frameWidth;				//mul		BuffWidth
+	ConvPitch = rax;				//mov		ConPitch, rax
+
+
+	rdx = 0x10;						//mov		rdx, 010h
+	rdx -= rcx;						//sub		rdx, rcx
+
+	xxsSpr = _mm_set1_epi16((short)rcx);
+	xxfSpr = _mm_set1_epi16((short)rdx);
+
+	goto _return_DPC_MAKE;
+
+XMM_MAKE:
+	rax = rrImgAddr;
+	rax += ConvPitch;
+
+	xxCmp1 = _mm_loadu_si128((__m128i*) rax);
+	xxCmp2 = xxCmp1;
+
+	xxCmp1 = _mm_unpacklo_epi8(xxCmp1, xxZero);
+	xxCmp2 = _mm_unpackhi_epi8(xxCmp2, xxZero);
+
+	xxCmp1 = _mm_mullo_epi16(xxCmp1, xxfSprT);
+	xxCmp2 = _mm_mullo_epi16(xxCmp2, xxfSprT);
+
+	xxSrc2 = _mm_loadu_si128((__m128i*) (rax + 1));
+	xxSrc1 = xxSrc2;
+
+	xxSrc1 = _mm_unpacklo_epi8(xxSrc1, xxZero);
+	xxSrc2 = _mm_unpackhi_epi8(xxSrc2, xxZero);
+
+	xxSrc1 = _mm_mullo_epi16(xxSrc1, xxsSprT);
+	xxSrc2 = _mm_mullo_epi16(xxSrc2, xxsSprT);
+
+	xxCmp1 = _mm_add_epi16(xxCmp1, xxSrc1);
+	xxCmp2 = _mm_add_epi16(xxCmp2, xxSrc2);
+
+	xxCmp1 = _mm_srli_epi16(xxCmp1, SprShift);
+	xxCmp2 = _mm_srli_epi16(xxCmp2, SprShift);
+
+	xxCmp1 = _mm_mullo_epi16(xxCmp1, xxfSpr);
+	xxCmp2 = _mm_mullo_epi16(xxCmp2, xxfSpr);
+
+	rax += frameWidth;
+	xxSrc2 = _mm_loadu_si128((__m128i*) (rax));
+	xxSrc1 = xxSrc2;
+
+	xxSrc1 = _mm_unpacklo_epi8(xxSrc1, xxZero);
+	xxSrc2 = _mm_unpackhi_epi8(xxSrc2, xxZero);
+
+	xxSrc1 = _mm_mullo_epi16(xxSrc1, xxfSprT);
+	xxSrc2 = _mm_mullo_epi16(xxSrc2, xxfSprT);
+
+	xxTemp = _mm_loadu_si128((__m128i*) (rax + 1));
+	xxZId = xxTemp;
+
+	xxTemp = _mm_unpacklo_epi8(xxTemp, xxZero);
+	xxZId = _mm_unpackhi_epi8(xxZId, xxZero);
+
+	xxTemp = _mm_mullo_epi16(xxTemp, xxsSprT);
+	xxZId = _mm_mullo_epi16(xxZId, xxsSprT);
+
+	xxSrc1 = _mm_add_epi16(xxSrc1, xxTemp);
+	xxSrc2 = _mm_add_epi16(xxSrc2, xxZId);
+
+	xxSrc1 = _mm_srli_epi16(xxSrc1, SprShift);
+	xxSrc2 = _mm_srli_epi16(xxSrc2, SprShift);
+
+	xxSrc1 = _mm_mullo_epi16(xxSrc1, xxsSpr);
+	xxSrc2 = _mm_mullo_epi16(xxSrc2, xxsSpr);
+
+	xxCmp1 = _mm_add_epi16(xxCmp1, xxSrc1);
+	xxCmp2 = _mm_add_epi16(xxCmp2, xxSrc2);
+				
+	xxCmp1 = _mm_srli_epi16(xxCmp1, SprShift);
+	xxCmp2 = _mm_srli_epi16(xxCmp2, SprShift);
+		
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxSrc2 = xxSrc1;
+	xxSrc1 = _mm_unpacklo_epi8(xxSrc1, xxZero);
+	xxSrc2 = _mm_unpackhi_epi8(xxSrc2, xxZero);
+	goto _return_XMM_MAKE;
+
+XMM_COMPARE_END:
+	ix -= 0x10;
+	ZoneThAddr -= 0x10;
+	ZoneIdAddr -= 0x10;
+	ZoneAddAddr -= 0x10;
+	goto LOOP_2_TAIL;
+
+XMM_COMPARE:
+	c8Pixel = 0;
+	xxSrc1 = _mm_min_epu16(xxSrc1, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp1, xxSupp);
+	goto _XMM_COMPARE_8PIXEL;
+
+_return_XMM_COMPARE_8PIXEL:
+	if(rrNoD >= maxDefect)
+		goto PAIRING_VERT;
+
+	c8Pixel++;
+	if(c8Pixel == 2)
+		goto XMM_COMPARE_END;
+
+	xxSrc1 = _mm_min_epu16(xxSrc2, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp2, xxSupp);
+	ZoneThAddr += 0x10;
+	ZoneIdAddr += 0x10;
+	ZoneAddAddr += 0x10;
+
+_XMM_COMPARE_8PIXEL:
+	xxTemp = _mm_loadu_si128((__m128i*) ZoneThAddr);
+	xxDSlide = _mm_loadu_si128((__m128i*) ZoneAddAddr);
+
+	xxZTh = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxTemp);
+	xxPeakS = _mm_sub_epi16(xxSrc1, xxCmp1);
+	xxPeakAbs = _mm_abs_epi16(xxPeakS);
+	xxTemp = _mm_cmpgt_epi16(xxPeakAbs, xxZTh);
+	if(_mm_movemask_epi8(xxTemp) != 0)
+		goto DEFECT_00;
+
+	ix += 8;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+DEFECT_00:
+	xxZId = _mm_loadu_si128((__m128i*) ZoneIdAddr);
+	if(_mm_extract_epi16(xxTemp, 0x00) == 0)
+		goto DEFECT_01;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x00);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x00);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x00);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x00);
+	if((short)_mm_extract_epi16(xxPeakS, 0x00)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x01) == 0)
+		goto DEFECT_02;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x01);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x01);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x01);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x01);
+	if((short)_mm_extract_epi16(xxPeakS, 0x01)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x02) == 0)
+		goto DEFECT_03;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x02);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x02);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x02);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x02);
+	if((short)_mm_extract_epi16(xxPeakS, 0x02)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x03) == 0)
+		goto DEFECT_04;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x03);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x03);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x03);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x03);
+	if((short)_mm_extract_epi16(xxPeakS, 0x03)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x04) == 0)
+		goto DEFECT_05;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x04);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x04);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x04);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x04);
+	if((short)_mm_extract_epi16(xxPeakS, 0x04)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x05) == 0)
+		goto DEFECT_06;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x05);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x05);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x05);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x05);
+	if((short)_mm_extract_epi16(xxPeakS, 0x05)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x06) == 0)
+		goto DEFECT_07;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x06);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x06);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x06);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x06);
+	if((short)_mm_extract_epi16(xxPeakS, 0x06)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x07) == 0)
+		goto DEFECT_08;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x07);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x07);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x07);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x07);
+	if((short)_mm_extract_epi16(xxPeakS, 0x07)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_08:
+	ix++;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+PAIRING_VERT:
+	iy = -1;
+
+LOOP_PAIR_NUM:
+	iy++;
+	if(iy >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(rax >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + iy) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = iy;
+	rcx = *(DefectY + iy);
+	rax = rcx + iPitchHUp;
+	rrImgAddr = *(DefectX + iy);
+
+	if(rcx > pairBottom)
+		goto PAIR_BOTTOM;
+
+	if(rcx >= pairTop)
+		goto PAIR_CENTER;
+
+PAIR_TOP:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_TOP_UNPAIR;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_TOP;
+	else if(rdx > rax)
+		goto PAIR_TOP_UNPAIR;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_TOP;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + rbx));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + rbx));
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + rbx));
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_TOP_UNPAIR:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)(rrImgAddr);
+	ptDefect.y = (LONG)(rax - iPitchHUp);
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)ptDefect.x;
+	PairAddr->s_nDefectY = (int)ptDefect.y;
+	PairAddr->s_DefectType = (DefectType)*(DefectT + iy);
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + iy));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + iy));
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + iy));
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_CENTER;
+	else if(rdx > rax)
+		goto LOOP_PAIR_NUM;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_CENTER;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(*(pGraySrc + rbx));
+	PairAddr->s_nGrayRef = (int)(*(pGrayCmp + rbx));
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + rbx));
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_BOTTOM:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rrImgAddr;
+	ptDefect.y = (LONG)rax;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrImgAddr;
+	PairAddr->s_nDefectY = (int)rax;
+	rdx = (*(DefectT + iy) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rdx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(*(pGrayCmp + iy));
+	PairAddr->s_nGrayRef = (int)(*(pGraySrc + iy));
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + iy));
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	goto _return_PAIRING_VERT;
+
+END_FUNC:
+	ix += 0x10;
+	*endLine = (int)ix;
+
+	return (int)nPair;
+}
+
+int CSISAssem::ConvZoneVert2S_BlackFilter(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+										   , __int64 left, __int64 right, __int64 top, __int64 bottom
+										   , int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+										   , int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+										   , __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+										   , short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+										   , CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+										   , __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+										   , short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+										   , __int64 ExTh, __int64 Suppress
+										   )
+{
+	const __int64 SprShift = 4;
+	const __int64 SprMulti = 16;
+	const __int64 szxMatch = 8;
+
+	__m128i	xxTemp;
+	__m128i	xxDSlide;
+
+	__m128i	xxZTh;
+	__m128i	xxZId;
+
+	__m128i	xxSrc1;
+	__m128i xxSrc2;
+
+	__m128i	xxCmp1;
+	__m128i xxCmp2;
+
+	__m128i	xxPeakS;
+	__m128i	xxPeakAbs;
+
+	__m128i	xxfSpr;
+	__m128i	xxsSpr;
+
+	__int64 rax, rbx, rcx, rdx;
+
+	__int64 ImgAddrOri	= (__int64)pImgBuff;
+	__int64 ConAddr = (__int64)pConBuff;
+	__int64 c8Pixel, rrNoD = 0, rrImgAddr, nPair = StartPair;
+
+	__m128i xxSupp = _mm_set1_epi16((short)Suppress);
+	// ----------- 孺搬窃 鞘磐 ----------- //
+	short sSrc, sRef, sThres;
+	// ----------------------------------- //
+
+	rcx = iPitch16;
+	rcx &= 0x0f;
+	xxsSpr = _mm_set1_epi16((short)rcx);
+
+	rax = SprMulti;
+	rax -= rcx;
+	xxfSpr = _mm_set1_epi16((short)rax);
+
+	__int64 xMatch2 = 0;
+	__int64 iPitch = iPitch16 / SprMulti;
+	__int64 iPitchHUp = iPitch;
+	if(rcx >= SprMulti / 2)
+		iPitchHUp++;
+
+	bottom--;
+	__int64 ConBottom = bottom - iPitch - 1;
+	__int64 pairBottom = ConBottom - iPitch;
+
+	// -------------- 嗷 Filtering -------------- //
+	CRect rtDeadZone[MAX_DEAD_ZONE_COUNT];
+	CPoint ptDefect;
+	memcpy(rtDeadZone, m_Param.s_RectDeadZone, sizeof(CRect) * MAX_DEAD_ZONE_COUNT);
+	int nDeadZoneCount = 0;
+	for(int i = 0; i < MAX_DEAD_ZONE_COUNT; i++)
+	{
+		if(rtDeadZone[i].IsRectEmpty() == TRUE)
+		{
+			nDeadZoneCount = i;
+			break;
+		}
+	}
+	// ------------------------------------------ //
+
+	__int64 pairTop = top + iPitch;
+	__int64 ConvPitch = iPitch * 0x20;
+	__int64 ZoneTableW2 = ZoneTableWidth + ZoneTableWidth;
+
+	__int64 ix = left;
+	__int64	iy = top;
+
+	right = (right - left) / 16 * 16 + left;
+
+	__int64 pMatch1 = (__int64)pMatchTable;
+	pMatchTable = (void*)(pMatch1 + yZoneByte);
+	rcx = (__int64)pMatchTable;
+
+	rbx = (__int64)(*((int*)(rcx + 4)));
+	int yMatch = (int)rbx;
+	rdx = dyPattern + rbx;
+	__int64 eyPtrn = rdx;
+	__int64 eyPtrn1 = rdx;
+	rax = (iy - rbx) * ZoneTableWidth;
+
+	rbx = (__int64)(*((int*)rcx));
+	int xMatch = (int)rbx;
+	__int64 exPtrn = dxPattern + rbx;
+	rax += ix - rbx;
+	rax += rax;
+	rdx = (__int64)ZoneThTable + rax;
+	__int64	ZoneThAddr = rdx;
+	__int64	ZoneThAddr1 = rdx;
+	rdx = (__int64)ZoneIdTable + rax;
+	__int64	ZoneIdAddr = rdx;
+	__int64	ZoneIdAddr1 = rdx;
+	rdx = (__int64)ZoneAddTable + rax;
+	__int64	ZoneAddAddr = rdx;
+	__int64	ZoneAddAddr1 = rdx;
+
+	__m128i xxZero = _mm_setzero_si128();
+
+	CDefectPair* PairAddr = pDefectdPair + nPair;
+
+	//LOOP_1:
+	goto LOOP_1_CHECK;
+
+LOOP_1_TAIL:
+	goto PAIRING_VERT;
+
+_return_PAIRING_VERT:
+	ix += 0x10;
+	eyPtrn = eyPtrn1;
+	pMatchTable = (void*)pMatch1;
+	ZoneThAddr1 += 0x20;
+	ZoneThAddr = ZoneThAddr1;
+	ZoneIdAddr1 += 0x20;
+	ZoneIdAddr = ZoneIdAddr1;
+	ZoneAddAddr1 += 0x20;
+	ZoneAddAddr = ZoneAddAddr1;
+
+LOOP_1_CHECK:
+	if(ix >= right)
+		goto END_FUNC;
+
+	//LOOP_1_BODY:
+	iy = top;
+	rrImgAddr = ImgAddrOri + frameWidth * iy + ix;
+	goto MAKE_CONBUFF_HEAD;
+
+_return_MAKE_CONBUFF:
+	iy = top;
+	rrImgAddr = ConAddr;
+	if(ix >= exPtrn)
+		goto CHECK_1_BOUND;
+
+_return_CHECK_1_BOUND:
+	//LOOP_2:
+	goto LOOP_2_CHECK;
+
+LOOP_2_TAIL:
+	iy++;
+	rrImgAddr += 0x20;
+	ZoneThAddr += ZoneTableW2;
+	ZoneIdAddr += ZoneTableW2;
+	ZoneAddAddr += ZoneTableW2;
+
+LOOP_2_CHECK:
+	if(iy >= ConBottom)
+		goto LOOP_1_TAIL;
+
+	if(iy >= eyPtrn)
+		goto CHECK_2_BOUND;
+
+_return_CHECK_2_BOUND:
+	//LOOP_2_BODY:
+	goto XMM_MAKE;
+
+MAKE_CONBUFF_HEAD:
+	rax = ConAddr;
+
+MAKE_CONBUFF:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	_mm_storeu_si128((__m128i*)rax, _mm_unpacklo_epi8(xxSrc1, xxZero));
+	_mm_storeu_si128((__m128i*)(rax + 0x10), _mm_unpackhi_epi8(xxSrc1, xxZero));
+	rrImgAddr += frameWidth;
+	rax += 0x20;
+	iy++;
+	if(iy <= bottom)
+		goto MAKE_CONBUFF;
+	goto _return_MAKE_CONBUFF;
+
+CHECK_1_BOUND:
+	pMatch1 += szxMatch;
+	rcx = pMatch1 + yZoneByte;
+	pMatchTable = (void*)rcx;
+	yMatch = *((int*)(rcx + 4));
+	rdx = dyPattern + yMatch;
+	eyPtrn = eyPtrn1 = rdx;
+	rax = (iy - yMatch) * ZoneTableWidth;
+	xMatch = *(int*)(rcx);
+	rdx = dxPattern + xMatch;
+	rcx = xMatch + dxPattern;
+	if(rcx < right)
+		goto EXCESS_1_BOUND_PASS;
+	rdx = rcx;
+
+EXCESS_1_BOUND_PASS:
+	exPtrn = rdx;
+	rax += (ix - xMatch);
+	rax += rax;
+	ZoneThAddr1 = ZoneThAddr = (__int64)ZoneThTable + rax;
+	ZoneIdAddr1 = ZoneIdAddr = (__int64)ZoneIdTable + rax;
+	ZoneAddAddr1 = ZoneAddAddr = (__int64)ZoneAddTable + rax;
+	xMatch2++;
+	goto _return_CHECK_1_BOUND;
+
+CHECK_2_BOUND:
+	pMatchTable = (void*)((__int64)pMatchTable + yZoneByte);
+	rbx = (__int64)(*((int*)((__int64)pMatchTable + 4)));
+	yMatch = (int)rbx;
+	eyPtrn = dyPattern + rbx;
+	rax = eyPtrn + dyPattern;
+	if(rax < bottom)
+		goto EXCESS_2_BOUND_PASS;
+	eyPtrn = rax;
+
+EXCESS_2_BOUND_PASS:
+	rax = (iy - rbx) * ZoneTableWidth;
+	xMatch =*((int*)pMatchTable);
+	rax += ix - xMatch;
+	rax += rax;
+	ZoneThAddr = (__int64)ZoneThTable + rax;
+	ZoneIdAddr = (__int64)ZoneIdTable + rax;
+	ZoneAddAddr = (__int64)ZoneAddTable + rax;
+	goto _return_CHECK_2_BOUND;
+
+XMM_MAKE:
+	xxSrc1 = _mm_loadu_si128((__m128i*) rrImgAddr);
+	xxSrc2 = _mm_loadu_si128((__m128i*) (rrImgAddr + 0x10));
+
+	rax = rrImgAddr + ConvPitch;
+
+	xxCmp1 = _mm_loadu_si128((__m128i*) rax);
+	xxCmp2 = _mm_loadu_si128((__m128i*) (rax + 0x10));
+	xxTemp = _mm_loadu_si128((__m128i*) (rax + 0x20));
+	xxDSlide = _mm_loadu_si128((__m128i*) (rax + 0x30));
+
+	xxCmp1 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp1, xxfSpr), _mm_mullo_epi16(xxTemp, xxsSpr)), SprShift);
+	xxCmp2 = _mm_srli_epi16(_mm_add_epi16(_mm_mullo_epi16(xxCmp2, xxfSpr), _mm_mullo_epi16(xxDSlide, xxsSpr)), SprShift);
+	goto XMM_COMPARE;
+
+XMM_COMPARE_END:
+	ix -= 0x10;
+	ZoneThAddr -= 0x10;
+	ZoneIdAddr -= 0x10;
+	ZoneAddAddr -= 0x10;
+	goto LOOP_2_TAIL;
+
+XMM_COMPARE:
+	c8Pixel = 0;
+	xxSrc1 = _mm_min_epu16(xxSrc1, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp1, xxSupp);
+	goto _XMM_COMPARE_8PIXEL;
+
+_return_XMM_COMPARE_8PIXEL:
+	if(rrNoD >= maxDefect)
+		goto PAIRING_VERT;
+
+	c8Pixel++;
+	if(c8Pixel == 2)
+		goto XMM_COMPARE_END;
+
+	xxSrc1 = _mm_min_epu16(xxSrc2, xxSupp);
+	xxCmp1 = _mm_min_epu16(xxCmp2, xxSupp);
+	ZoneThAddr += 0x10;
+	ZoneIdAddr += 0x10;
+	ZoneAddAddr += 0x10;
+
+_XMM_COMPARE_8PIXEL:
+	xxTemp = _mm_loadu_si128((__m128i*) ZoneThAddr);
+	xxDSlide = _mm_loadu_si128((__m128i*) ZoneAddAddr);
+
+	xxZTh = _mm_add_epi16(_mm_srli_epi16(_mm_mullo_epi16(_mm_max_epu16(xxSrc1, xxCmp1), xxDSlide), 8), xxTemp);
+	xxPeakS = _mm_sub_epi16(xxSrc1, xxCmp1);
+	xxPeakAbs = _mm_abs_epi16(xxPeakS);
+	xxTemp = _mm_cmpgt_epi16(xxPeakAbs, xxZTh);
+	if(_mm_movemask_epi8(xxTemp) != 0)
+		goto DEFECT_00;
+
+	ix += 8;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+DEFECT_00:
+	xxZId = _mm_loadu_si128((__m128i*) ZoneIdAddr);
+	if(_mm_extract_epi16(xxTemp, 0x00) == 0)
+		goto DEFECT_01;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x00);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x00);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x00);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x00);
+	if((short)_mm_extract_epi16(xxPeakS, 0x00)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_01:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x01) == 0)
+		goto DEFECT_02;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x01);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x01);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x01);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x01);
+	if((short)_mm_extract_epi16(xxPeakS, 0x01)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_02:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x02) == 0)
+		goto DEFECT_03;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x02);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x02);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x02);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x02);
+	if((short)_mm_extract_epi16(xxPeakS, 0x02)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_03:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x03) == 0)
+		goto DEFECT_04;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x03);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x03);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x03);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x03);
+	if((short)_mm_extract_epi16(xxPeakS, 0x03)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_04:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x04) == 0)
+		goto DEFECT_05;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x04);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x04);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x04);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x04);
+	if((short)_mm_extract_epi16(xxPeakS, 0x04)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_05:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x05) == 0)
+		goto DEFECT_06;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x05);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x05);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x05);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x05);
+	if((short)_mm_extract_epi16(xxPeakS, 0x05)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_06:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x06) == 0)
+		goto DEFECT_07;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x06);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x06);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x06);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x06);
+	if((short)_mm_extract_epi16(xxPeakS, 0x06)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_07:
+	ix++;
+	if(_mm_extract_epi16(xxTemp, 0x07) == 0)
+		goto DEFECT_08;
+
+	*(DefectX + rrNoD) = (int)ix;
+	*(DefectY + rrNoD) = (int)iy;
+
+	*(pGraySrc + rrNoD) = _mm_extract_epi16(xxSrc1, 0x07);
+	*(pGrayCmp + rrNoD) = _mm_extract_epi16(xxCmp1, 0x07);
+	*(pZoneID + rrNoD) = _mm_extract_epi16(xxZId, 0x07);
+	*(pZoneTh + rrNoD) = _mm_extract_epi16(xxZTh, 0x07);
+	if((short)_mm_extract_epi16(xxPeakS, 0x07)  > 0)
+		*(DefectT + rrNoD) = 1;
+	else
+		*(DefectT + rrNoD) = 0;
+
+	rrNoD++;
+
+DEFECT_08:
+	ix++;
+	goto _return_XMM_COMPARE_8PIXEL;
+
+PAIRING_VERT:
+	iy = -1;
+
+LOOP_PAIR_NUM:
+	iy++;
+	if(iy >= rrNoD)
+		goto LOOP_PAIR_NUM_END;
+
+	rax = nPair;
+	if(rax >= MaxPair)
+		goto END_FUNC;
+
+	if(*(DefectT + iy) >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rbx = iy;
+	rcx = *(DefectY + iy);
+	rax = rcx + iPitchHUp;
+	rrImgAddr = *(DefectX + iy);
+
+	if(rcx > pairBottom)
+		goto PAIR_BOTTOM;
+
+	if(rcx >= pairTop)
+		goto PAIR_CENTER;
+
+PAIR_TOP:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto PAIR_TOP_UNPAIR;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_TOP;
+	else if(rdx > rax)
+		goto PAIR_TOP_UNPAIR;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_TOP;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ----------- 孺搬窃 鞘磐 ----------- //
+	sSrc = (int)(*(pGraySrc + rbx));
+	sRef = (int)(*(pGrayCmp + rbx));
+
+	if(sSrc < sRef)
+	{
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+		if(abs(sSrc - sRef) <= sThres)
+			goto LOOP_PAIR_NUM;
+
+		*(pZoneTh + rbx) = sThres;
+	}
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + rbx));
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_TOP_UNPAIR:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)(rrImgAddr);
+	ptDefect.y = (LONG)(rax - iPitchHUp);
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ----------- 孺搬窃 鞘磐 ----------- //
+	sSrc = (int)(*(pGraySrc + iy));
+	sRef = (int)(*(pGrayCmp + iy));
+
+	if(sSrc < sRef)
+	{
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+		if(abs(sSrc - sRef) <= sThres)
+			goto LOOP_PAIR_NUM;
+
+		*(pZoneTh + iy) = sThres;
+
+	}
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)1;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)ptDefect.x;
+	PairAddr->s_nDefectY = (int)ptDefect.y;
+	PairAddr->s_DefectType = (DefectType)*(DefectT + iy);
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + iy));
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_CENTER:
+	rbx++;
+	if(rbx >= rrNoD)
+		goto LOOP_PAIR_NUM;
+
+	rdx = *(DefectY + rbx);
+	if(rdx < rax)
+		goto PAIR_CENTER;
+	else if(rdx > rax)
+		goto LOOP_PAIR_NUM;
+
+	rcx = *(DefectX + rbx);
+	if(rrImgAddr != rcx)
+		goto PAIR_CENTER;
+
+	rrImgAddr = *(DefectT + rbx);
+	if(rrImgAddr >= 3)
+		goto LOOP_PAIR_NUM;
+
+	rax = (__int64)*(DefectT + iy);
+	if(rax == rrImgAddr)
+		goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rcx;
+	ptDefect.y = (LONG)rdx;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ----------- 孺搬窃 鞘磐 ----------- //
+	sSrc = (int)(*(pGraySrc + rbx));
+	sRef = (int)(*(pGrayCmp + rbx));
+
+	if(sSrc < sRef)
+	{
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+		if(abs(sSrc - sRef) <= sThres)
+			goto LOOP_PAIR_NUM;
+
+		*(pZoneTh + rbx) = sThres;
+	}
+	// ----------------------------------- //
+
+	*(DefectT + rbx) = 4;
+
+	PairAddr->s_DefectPos = (DefectPos)2;
+	PairAddr->s_DefectPair = (DefectPair)1;
+	PairAddr->s_nDefectX = (int)rcx;
+	PairAddr->s_nDefectY = (int)rdx;
+	PairAddr->s_DefectType = (DefectType)rrImgAddr;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + rbx);
+	PairAddr->s_nGraySrc = (int)(sSrc);
+	PairAddr->s_nGrayRef = (int)(sRef);
+	PairAddr->s_nZone = (int)(*(pZoneID + rbx));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + rbx));
+
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+PAIR_BOTTOM:
+	if(bUseUnpair != 1)
+		goto LOOP_PAIR_NUM;
+
+	//rcx = (__int64)*(DefectValue + iy);
+	//if(rcx <= ExTh)
+	//	goto LOOP_PAIR_NUM;
+
+	// -------------- 嗷 Filtering -------------- //
+	ptDefect.x = (LONG)rrImgAddr;
+	ptDefect.y = (LONG)rax;
+	for(int i = 0; i < nDeadZoneCount; i++)
+	{
+		if(rtDeadZone[i].PtInRect(ptDefect) )
+			goto LOOP_PAIR_NUM;
+	}
+	// ------------------------------------------ //
+
+	// ----------- 孺搬窃 鞘磐 ----------- //
+	sSrc = (int)(*(pGrayCmp + iy));
+	sRef = (int)(*(pGraySrc + iy));
+
+	if(sSrc < sRef)
+	{
+		sThres = (short)(sRef * m_Param.s_nBWB_Slide / 256 + m_Param.s_nBWB_Main);
+		if(abs(sSrc - sRef) <= sThres)
+			goto LOOP_PAIR_NUM;
+
+		*(pZoneTh + iy) = sThres;
+	}
+	// ----------------------------------- //
+
+	PairAddr->s_DefectPos = (DefectPos)3;
+	PairAddr->s_DefectPair = (DefectPair)5;
+	PairAddr->s_nDefectX = (int)rrImgAddr;
+	PairAddr->s_nDefectY = (int)rax;
+	rdx = (*(DefectT + iy) + 1) & 1;
+	PairAddr->s_DefectType = (DefectType)rdx;
+	//PairAddr->s_fDefectPeak = (int)*(DefectValue + iy);
+	PairAddr->s_nGraySrc = (int)sSrc;
+	PairAddr->s_nGrayRef = (int)sRef;
+	PairAddr->s_nZone = (int)(*(pZoneID + iy));
+	PairAddr->s_nThresold = (int)(*(pZoneTh + iy));
+	PairAddr++;
+	nPair++;
+	goto LOOP_PAIR_NUM;
+
+LOOP_PAIR_NUM_END:
+	rrNoD = 0;
+	goto _return_PAIRING_VERT;
+
+END_FUNC:
+	ix += 0x10;
+	*endLine = (int)ix;
+
+	return (int)nPair;
+}
\ No newline at end of file
diff --git a/Common_Class/SISAssem/StopWatch3.cpp b/Common_Class/SISAssem/StopWatch3.cpp
new file mode 100644
index 0000000..6166a52
--- /dev/null
+++ b/Common_Class/SISAssem/StopWatch3.cpp
@@ -0,0 +1,43 @@
+// StopWatch3.cpp: implementation of the CStopWatch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "StopWatch3.h"
+
+
+
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CStopWatch::CStopWatch()
+{
+	m_swFreq.LowPart = m_swFreq.HighPart = 0;
+	m_swStart = m_swFreq;
+	m_swEnd = m_swFreq;
+	m_fTimeforDuration = 0;
+
+	QueryPerformanceFrequency(&m_swFreq);
+//	m_swFreq.QuadPart = (LONGLONG)(2.41f*1024*1024*1024);
+}
+
+CStopWatch::~CStopWatch()
+{
+}
+
+void CStopWatch::Start(void)
+{
+	QueryPerformanceCounter(&m_swStart);
+}
+
+void CStopWatch::End(void)
+{
+	QueryPerformanceCounter(&m_swEnd);
+	m_fTimeforDuration = (m_swEnd.QuadPart - m_swStart.QuadPart)/(float)m_swFreq.QuadPart; 
+}
+
+
+
+
diff --git a/Common_Class/SISAssem/StopWatch3.h b/Common_Class/SISAssem/StopWatch3.h
new file mode 100644
index 0000000..bac5131
--- /dev/null
+++ b/Common_Class/SISAssem/StopWatch3.h
@@ -0,0 +1,28 @@
+
+#pragma once
+
+#include <afxwin.h>
+
+class CStopWatch  
+{
+public:
+	CStopWatch();
+	virtual ~CStopWatch();
+
+public:
+	void Start(void);
+	void End(void);
+	const float GetDurationSecond(void) const { return m_fTimeforDuration; }
+	const float GetDurationMilliSecond(void) const { return m_fTimeforDuration*1000.f; }
+
+public:
+	LARGE_INTEGER GetStartInteger(void) const { return m_swStart; }
+	LARGE_INTEGER GetEndInteger(void) const { return m_swEnd; }
+	LARGE_INTEGER GetFrequency(void) const { return m_swFreq; }
+
+protected:
+	LARGE_INTEGER		m_swFreq, m_swStart, m_swEnd;
+	float				m_fTimeforDuration;
+};
+
+//#endif // !defined(AFX_STOPWATCH_H__C2068F0F_528F_43C3_9A72_ECA8A4DCAFA2__INCLUDED_)
diff --git a/Common_Class/SISAssem/dllmain.cpp b/Common_Class/SISAssem/dllmain.cpp
new file mode 100644
index 0000000..086661e
--- /dev/null
+++ b/Common_Class/SISAssem/dllmain.cpp
@@ -0,0 +1,51 @@
+// dllmain.cpp : DLL狼 檬扁拳 风凭阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+#include <afxwin.h>
+#include <afxdllx.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+static AFX_EXTENSION_MODULE SISAssemDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+	// lpReserved甫 荤侩窍绰 版快 促澜阑 力芭窍绞矫坷.
+	UNREFERENCED_PARAMETER(lpReserved);
+
+	if (dwReason == DLL_PROCESS_ATTACH)
+	{
+		TRACE0("SISAssem.DLL Initializing\n");
+		
+		// 犬厘 DLL阑 茄 锅父 檬扁拳钦聪促.
+		if (!AfxInitExtensionModule(SISAssemDLL, hInstance))
+			return 0;
+
+		// 捞 DLL阑 府家胶 眉牢俊 火涝钦聪促.
+		// 曼绊: 捞 犬厘 DLL捞 MFC 览侩 橇肺弊伐捞
+		//  酒囱 ActiveX 牧飘费苞 鞍篮 MFC 扁夯 DLL俊
+		//  狼秦 疙矫利栏肺 傅农登绢 乐绰 版快俊绰
+		//  DllMain俊辑 捞 临阑 力芭窍绊, 力芭茄 临篮 捞 犬厘 DLL俊辑
+		//  郴焊辰 喊档狼 窃荐俊 眠啊钦聪促.
+		//  弊繁 促澜 捞 犬厘 DLL阑 荤侩窍绰 扁夯 DLL篮
+		//  秦寸 窃荐甫 疙矫利栏肺 龋免窍咯 捞 犬厘 DLL阑 眠啊秦具 钦聪促.
+		//  弊犯瘤 臼栏搁 CDynLinkLibrary 俺眉啊
+		//  扁夯 DLL狼 府家胶 眉牢俊 眠啊登瘤 臼栏骨肺
+		//  缴阿茄 巩力啊 惯积钦聪促.
+
+		new CDynLinkLibrary(SISAssemDLL);
+
+	}
+	else if (dwReason == DLL_PROCESS_DETACH)
+	{
+		TRACE0("SISAssem.DLL Terminating.\n");
+
+		// 家戈磊啊 龋免登扁 傈俊 扼捞宏矾府甫 辆丰钦聪促.
+		AfxTermExtensionModule(SISAssemDLL);
+	}
+	return 1;   // 犬牢
+}
diff --git a/Common_Class/SISAssem/res/SISAssem.rc2 b/Common_Class/SISAssem/res/SISAssem.rc2
new file mode 100644
index 0000000..6509022
--- /dev/null
+++ b/Common_Class/SISAssem/res/SISAssem.rc2
@@ -0,0 +1,13 @@
+//
+// SISAssem.RC2 - Microsoft Visual C++俊辑 流立 祈笼窍瘤 臼绰 府家胶
+//
+
+#ifdef APSTUDIO_INVOKED
+#error 捞 颇老篮 Microsoft Visual C++俊辑 祈笼且 荐 绝嚼聪促.
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// 咯扁俊 荐悼栏肺 祈笼茄 府家胶甫 眠啊钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/SISAssem/stdafx.cpp b/Common_Class/SISAssem/stdafx.cpp
new file mode 100644
index 0000000..7eda465
--- /dev/null
+++ b/Common_Class/SISAssem/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : 钎霖 器窃 颇老父 甸绢 乐绰 家胶 颇老涝聪促.
+// SISAssem.pch绰 固府 哪颇老等 庆歹啊 邓聪促.
+// stdafx.obj俊绰 固府 哪颇老等 屈侥 沥焊啊 器窃邓聪促.
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/SISAssem/stdafx.h b/Common_Class/SISAssem/stdafx.h
new file mode 100644
index 0000000..5cacd4c
--- /dev/null
+++ b/Common_Class/SISAssem/stdafx.h
@@ -0,0 +1,39 @@
+// stdafx.h : 磊林 荤侩窍瘤父 磊林 函版登瘤绰 臼绰
+// 钎霖 矫胶袍 器窃 颇老 棺 橇肺璃飘 包访 器窃 颇老捞
+// 甸绢 乐绰 器窃 颇老涝聪促.
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 芭狼 荤侩登瘤 臼绰 郴侩篮 Windows 庆歹俊辑 力寇钦聪促.
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 老何 CString 积己磊绰 疙矫利栏肺 急攫邓聪促.
+
+#include <afxwin.h>         // MFC 琴缴 棺 钎霖 备己 夸家涝聪促.
+#include <afxext.h>         // MFC 犬厘涝聪促.
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE 努贰胶涝聪促.
+#include <afxodlgs.h>       // MFC OLE 措拳 惑磊 努贰胶涝聪促.
+#include <afxdisp.h>        // MFC 磊悼拳 努贰胶涝聪促.
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 单捞磐海捞胶 努贰胶涝聪促.
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 单捞磐海捞胶 努贰胶涝聪促.
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // Internet Explorer 4 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // Windows 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
diff --git a/Common_Class/SISAssem/targetver.h b/Common_Class/SISAssem/targetver.h
new file mode 100644
index 0000000..75a9f56
--- /dev/null
+++ b/Common_Class/SISAssem/targetver.h
@@ -0,0 +1,26 @@
+
+#pragma once
+
+// 促澜 概农肺绰 鞘夸茄 弥家 敲阀汽阑 沥狼钦聪促. 鞘夸茄 弥家 敲阀汽篮
+// 览侩 橇肺弊伐阑 角青窍绰 单 鞘夸茄 扁瓷捞 器窃等 啊厘 狐弗 滚傈狼 Windows, Internet Explorer
+// 殿涝聪促. 捞 概农肺绰 瘤沥等 滚傈 捞惑狼 敲阀汽 滚傈俊辑 荤侩 啊瓷茄 葛电 扁瓷阑 劝己拳秦具
+// 累悼钦聪促.
+
+// 酒贰 瘤沥等 敲阀汽俊 快急窍绰 敲阀汽阑 措惑栏肺 窍绰 版快 促澜 沥狼甫 荐沥窍绞矫坷.
+// 促弗 敲阀汽俊 荤侩登绰 秦寸 蔼狼 弥脚 沥焊绰 MSDN阑 曼炼窍绞矫坷.
+#ifndef WINVER                          // 鞘夸茄 弥家 敲阀汽阑 Windows Vista肺 瘤沥钦聪促.
+#define WINVER 0x0600           // 促弗 滚傈狼 Windows俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_WINNT            // 鞘夸茄 弥家 敲阀汽阑 Windows Vista肺 瘤沥钦聪促.
+#define _WIN32_WINNT 0x0600     // 促弗 滚傈狼 Windows俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_WINDOWS          // 鞘夸茄 弥家 敲阀汽阑 Windows 98肺 瘤沥钦聪促.
+#define _WIN32_WINDOWS 0x0410 // Windows Me 捞惑俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_IE                       // 鞘夸茄 弥家 敲阀汽阑 Internet Explorer 7.0栏肺 瘤沥钦聪促.
+#define _WIN32_IE 0x0700        // 促弗 滚傈狼 IE俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
diff --git a/Common_Class/SISBuffer/ConvInt1.cpp b/Common_Class/SISBuffer/ConvInt1.cpp
new file mode 100644
index 0000000..08aa07f
--- /dev/null
+++ b/Common_Class/SISBuffer/ConvInt1.cpp
@@ -0,0 +1,4303 @@
+// ConvInt1.cpp: implementation of the CConvInt1 class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ConvInt1.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+int		CConvInt1::m_nDefectNum = 0;
+int		CConvInt1::m_nDefectPointX[MAX_DEFECTPIX_NUM] = {0, };
+int		CConvInt1::m_nDefectPointY[MAX_DEFECTPIX_NUM] = {0, };
+short	CConvInt1::m_sDefectType[MAX_DEFECTPIX_NUM] = {0, };
+int		CConvInt1::m_nDefectValue[MAX_DEFECTPIX_NUM] = {0, };
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CConvInt1::CConvInt1()
+{
+	m_nLastDefectNum =0;
+}
+
+CConvInt1::~CConvInt1()
+{
+
+}
+
+void CConvInt1::ReadyToConvolution(ConvParam* pParam)
+{
+	m_pParam			= pParam;
+	m_nDefectNum		= 0;	//橇饭烙付促狼 搬窃POINT荐
+	m_nDefectPairedNum	= 0;	// Pairing 茄 搬窃 历厘且 备炼眉 檬扁拳.
+
+	for (int i = 0; i < MAX_DEFECTPIX_NUM; i++)
+	{
+		m_nDefectPointX[i] = 0;
+		m_nDefectPointY[i] = 0;
+		m_sDefectType[i] = 0;
+		m_nDefectValue[i] = 0;
+
+		m_DefectPaired[i].Reset();
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////
+DIT_RESULT CConvInt1::PairingPlus(double dPitchsize)
+{
+	PairingPlus_1(dPitchsize);
+	return DIT_CONV_SUCCESS;
+	//////////////////////////////////////////////////////////////////////////
+	//MMX俊辑 thresholding鳖瘤窍绊 唱坷绰 搬窃狼 point沥焊绰 pair肺 唱坷骨肺 
+	//角力 茄俺狼 point沥焊甫 芭福绰 苞沥捞 鞘夸窍促.
+
+	int i, j;
+	BOOL ignore = FALSE;
+	for(i = 0; i < m_nDefectNum; i++)
+	{
+		m_nDefectPointX[i]++;
+		m_nDefectPointY[i]++;
+	}
+	for(i = 0; i < m_nDefectNum; i++)
+	{
+		if (m_nDefectPairedNum >= m_pParam->s_nFrameDefPixLimit)
+			break;
+
+		if(m_sDefectType[i] == DEFTYPE_DELETE)
+			continue;
+
+		if (m_sDefectType[i] == DEFTYPE_NODEFECT)
+			continue;
+
+		// 哭率 八荤 康开 抗寇贸府.
+		ignore = FALSE;
+		if(m_nDefectPointX[i] < dPitchsize * 2)
+		{
+			// 版拌俊辑狼 Paring 八荤.
+			for(j = i + 1; j < m_nDefectNum; j++)
+			{
+				if (m_sDefectType[i] == m_sDefectType[j])
+					continue;
+
+				// 茄 乔摹 坷弗率俊 搬窃捞 乐绰 版快 DEFPOS_LEFT_PAIR肺 魄沥
+				if (abs(m_nDefectPointX[j] - (m_nDefectPointX[i] + dPitchsize)) < 2 &&
+					m_nDefectPointY[j] == m_nDefectPointY[i])
+				{
+					m_DefectPaired[m_nDefectPairedNum].s_DefectPos		= DEFPOS_LEFT;
+					m_DefectPaired[m_nDefectPairedNum].s_DefectPair		= DEFPAIR_PPAIR;
+					m_DefectPaired[m_nDefectPairedNum].s_nDefectX		= m_nDefectPointX[i] + m_pParam->s_RectConv.left - 1;	// Add Margin
+					m_DefectPaired[m_nDefectPairedNum].s_nDefectY		= m_nDefectPointY[i] + m_pParam->s_RectConv.top;
+					m_DefectPaired[m_nDefectPairedNum].s_DefectType		= static_cast<DefectType>(m_sDefectType[i]);	//角力归搬窃篮1,孺搬窃篮0
+					m_DefectPaired[m_nDefectPairedNum].SetPeak(m_nDefectValue[i], m_pParam->s_nThreshold, m_pParam->s_nConvWidth * m_pParam->s_nConvHeight);
+
+					m_sDefectType[j] = DEFTYPE_DELETE;	// 乔摹 坷弗率 搬窃篮 歹捞惑 积阿且 鞘夸档 绝促.
+					m_nDefectPairedNum++;
+
+					ignore = TRUE;
+					break;
+				}
+				if (m_nDefectPointY[j] > m_nDefectPointY[i])	// 歹捞惑 厚背且 鞘夸 绝促.
+					break;
+			}
+			if(ignore == FALSE)		// Pair 啊 酒囱 版快 DEFPOS_LEFT_UNPAIR肺 魄沥. 捞饶 Classify俊辑 犁炼沥.
+			{
+				m_DefectPaired[m_nDefectPairedNum].s_DefectPos		= DEFPOS_LEFT;
+				m_DefectPaired[m_nDefectPairedNum].s_DefectPair		= DEFPAIR_UNPAIR;
+				m_DefectPaired[m_nDefectPairedNum].s_nDefectX		= m_nDefectPointX[i] + m_pParam->s_RectConv.left - 1;	// Add Margin
+				m_DefectPaired[m_nDefectPairedNum].s_nDefectY		= m_nDefectPointY[i] + m_pParam->s_RectConv.top;
+				m_DefectPaired[m_nDefectPairedNum].s_DefectType		= static_cast<DefectType>(m_sDefectType[i]);	//角力归搬窃篮1,孺搬窃篮0
+				m_DefectPaired[m_nDefectPairedNum].SetPeak(m_nDefectValue[i], m_pParam->s_nThreshold, m_pParam->s_nConvWidth * m_pParam->s_nConvHeight);
+				m_nDefectPairedNum++;
+			}
+		}
+		// 啊款单 八荤康开老 锭 贸府.
+		else if((m_nDefectPointX[i] < m_pParam->s_RectConv.right-m_pParam->s_RectConv.left-dPitchsize) && (m_nDefectPointX[i] >= dPitchsize * 2))
+		{
+			for(j = i + 1; j < m_nDefectNum; j++)
+			{
+				if (m_sDefectType[i] == m_sDefectType[j])
+					continue;
+
+				// 茄 乔摹 捞饶俊 叼棋捞 乐栏搁 Pairing.
+				if (abs(m_nDefectPointX[j] - (m_nDefectPointX[i] + dPitchsize)) < 2 &&
+					m_nDefectPointY[j] == m_nDefectPointY[i])
+				{
+					m_DefectPaired[m_nDefectPairedNum].s_DefectPos		= DEFPOS_CENTER;
+					m_DefectPaired[m_nDefectPairedNum].s_DefectPair		= DEFPAIR_PPAIR;
+					m_DefectPaired[m_nDefectPairedNum].s_nDefectX		= m_nDefectPointX[i] + m_pParam->s_RectConv.left - 1;	// Add Margin
+					m_DefectPaired[m_nDefectPairedNum].s_nDefectY		= m_nDefectPointY[i] + m_pParam->s_RectConv.top;
+					m_DefectPaired[m_nDefectPairedNum].s_DefectType		= static_cast<DefectType>(m_sDefectType[i]);	//角力归搬窃篮1,孺搬窃篮0
+					m_DefectPaired[m_nDefectPairedNum].SetPeak(m_nDefectValue[i], m_pParam->s_nThreshold, m_pParam->s_nConvWidth * m_pParam->s_nConvHeight);
+
+					m_sDefectType[j] = DEFTYPE_DELETE;	// 乔摹 坷弗率 搬窃篮 歹捞惑 积阿且 鞘夸档 绝促.
+					m_nDefectPairedNum++;
+
+					ignore = TRUE;
+					break;
+				}
+				if (m_nDefectPointY[j] > m_nDefectPointY[i])	// 歹捞惑 厚背且 鞘夸 绝促.
+					break;
+			}
+			if(ignore == FALSE)		// Pair 啊 酒囱 版快.
+			{
+				m_DefectPaired[m_nDefectPairedNum].s_DefectPos		= DEFPOS_CENTER;
+				m_DefectPaired[m_nDefectPairedNum].s_DefectPair		= DEFPAIR_UNPAIR;
+				m_DefectPaired[m_nDefectPairedNum].s_nDefectX		= m_nDefectPointX[i] + m_pParam->s_RectConv.left - 1;	// Add Margin
+				m_DefectPaired[m_nDefectPairedNum].s_nDefectY		= m_nDefectPointY[i] + m_pParam->s_RectConv.top;
+				m_DefectPaired[m_nDefectPairedNum].s_DefectType		= (DefectType)m_sDefectType[i];	//角力归搬窃篮1,孺搬窃篮0
+				m_DefectPaired[m_nDefectPairedNum].SetPeak(m_nDefectValue[i], m_pParam->s_nThreshold, m_pParam->s_nConvWidth * m_pParam->s_nConvHeight);
+				m_nDefectPairedNum++;
+			}
+		}
+		// 坷弗率 康开俊辑 哭率俊 Defect捞 乐栏搁 Pairing捞 等 搬窃捞促.
+		else if(m_nDefectPointX[i] >= m_pParam->s_RectConv.right-m_pParam->s_RectConv.left-dPitchsize)
+		{
+			m_DefectPaired[m_nDefectPairedNum].s_DefectPos		= DEFPOS_RIGHT;
+			m_DefectPaired[m_nDefectPairedNum].s_DefectPair		= DEFPAIR_UNPAIR;
+			m_DefectPaired[m_nDefectPairedNum].s_nDefectX		= m_nDefectPointX[i] + m_pParam->s_RectConv.left - 1;	// Add Margin
+			m_DefectPaired[m_nDefectPairedNum].s_nDefectY		= m_nDefectPointY[i] + m_pParam->s_RectConv.top;
+			m_DefectPaired[m_nDefectPairedNum].s_DefectType		= static_cast<DefectType>(m_sDefectType[i]);	//角力归搬窃篮1,孺搬窃篮0
+			m_DefectPaired[m_nDefectPairedNum].SetPeak(m_nDefectValue[i], m_pParam->s_nThreshold, m_pParam->s_nConvWidth * m_pParam->s_nConvHeight);
+			m_nDefectPairedNum++;
+		}
+	}
+
+	return DIT_CONV_SUCCESS;
+}
+
+DIT_RESULT CConvInt1::PairingMinus(double dPitchsize)
+{
+	// -2Pitch Pairing
+	// 搬窃捞 Pair肺 乐阑 版快甫 贸府. 1Pitch焊促 农绊 2Pitch焊促 累篮 搬窃 八免.
+	int i, j, nLenX, nLenY;
+	for(i = 0; i < m_nDefectPairedNum; i++)
+	{
+		//////////////////////////////////////////////////////////////////////////
+		// CENTER
+		if (m_DefectPaired[i].s_DefectPos != DEFPOS_CENTER && m_DefectPaired[i].s_DefectPos != DEFPOS_RIGHT)
+			continue;
+		
+		if (m_DefectPaired[i].s_DefectPair != DEFPAIR_UNPAIR)
+			continue;
+		
+		// +Pitch 悼老茄 搬窃捞 乐绰 版快, 搬窃捞 乔摹焊促 目辑 -2Pitch俊 UNPAIR啊 乐绰 版快, 盔贰 UNPAIR肺 八免等 版快.
+		// -nPitch 何磐 拌加 搬窃牢 版快.
+		// -2Pitch 尔 厚背.
+		for(j = i - 1; j >= 0; j--)
+		{
+			nLenX = m_DefectPaired[j].s_nDefectX - (m_DefectPaired[i].s_nDefectX - static_cast<int>(dPitchsize * 2));
+			nLenY = m_DefectPaired[j].s_nDefectY - m_DefectPaired[i].s_nDefectY;
+			
+			if (nLenY < 0)
+				break;
+			
+			if (abs(nLenX) > 2 || nLenY > 0)
+				continue;
+			
+			// -2Pitch啊 Origin Pair牢 版快绰 -1Pitch客 -2Pitch 啊 搬窃 Type捞 促福促.
+			if (m_DefectPaired[j].s_DefectPair == DEFPAIR_PPAIR)
+			{
+				if (m_DefectPaired[i].s_DefectType == m_DefectPaired[j].s_DefectType)
+				{
+					m_DefectPaired[i].s_DefectType = static_cast<DefectType>((m_DefectPaired[j].s_DefectType + 1) % 2);
+					m_DefectPaired[i].s_nDefectX -= static_cast<int>(dPitchsize);
+					m_DefectPaired[i].s_DefectPair = DEFPAIR_MPAIR;
+				}
+			}
+			else if (m_DefectPaired[j].s_DefectPair == DEFPAIR_MPAIR)
+			{
+				if (m_DefectPaired[i].s_DefectType != m_DefectPaired[j].s_DefectType)
+				{
+					m_DefectPaired[i].s_DefectType = m_DefectPaired[j].s_DefectType;
+					m_DefectPaired[i].s_nDefectX -= static_cast<int>(dPitchsize);
+					m_DefectPaired[i].s_DefectPair = DEFPAIR_MPAIR;
+				}
+			}
+		}
+	}
+
+	return DIT_CONV_SUCCESS;
+}
+
+int CConvInt1::HConvolution_SSE3()
+{
+//VConvolution_SEE3_6();
+m_nLastDefectNum = HConvolution_SSE3_6();
+
+//m_nLastDefectNum = HVConvolution_SEE3_6();
+return m_nLastDefectNum;
+
+#define RPA_SIZE 128.0
+#define SHIFT_COUNT 6
+	char* img = (char*)(m_pParam->s_lpBuffer + m_pParam->s_RectConv.top * m_pParam->s_nFrameWidth + m_pParam->s_RectConv.left);
+
+	int		Honrizontal_Len =2;
+	int		Vertical_Len = 2;
+	int		MAX_WORD_PROCESS = 16;
+	int		SEARCH_WORD_PROCESS = 8 ;
+	if(m_pParam->s_RectConv.Width() <=0)
+		return; 
+	if(Honrizontal_Len > SEARCH_WORD_PROCESS)
+		return;
+	//lks 
+	short		mulFactorOrg[8] = {8,8,8,8,8,8,8,8};	// integer 楷魂栏肺 floating楷魂窍绰 瓤苞甫 焊扁困窍咯 
+	int			Cmp_Pitch = (int)(m_pParam->s_dPitchConvReal * m_pParam->s_nPitchCycleConv);	// 角荐pitch俊辑 沥荐己盒
+	double		rPitch = (m_pParam->s_dPitchConvReal * m_pParam->s_nPitchCycleConv) - Cmp_Pitch;	// 角荐pitch俊辑 沥荐己盒阑 猾 唱赣瘤 (0何磐 1荤捞狼 荐)
+	int			rpRatio = (int)(rPitch*8.0 + 0.5);		// 唱赣瘤 己盒狼 8盒困 殿鞭
+	int			rpRatioC = 8 - rpRatio;					// 8盒困殿鞭狼 8's complement
+	short		mulFactorR[8], mulFactorC[8];
+//	int i;
+
+
+	int     vertical_count=Vertical_Len;
+	int		horiz_count = m_pParam->s_nFrameWidth;
+	int		limit_vert_count = m_pParam->s_RectConv.Height()-Vertical_Len ;
+	int     limit_horiz_count = (m_pParam->s_RectConv.Width()-1)/MAX_WORD_PROCESS;
+	int     backup_limit_horiz_count=limit_horiz_count;
+	int		Vwidth =m_pParam->s_nFrameWidth * vertical_count;
+	int		Hwidth =Cmp_Pitch;
+	int		Short_Cmp_Pitch =Cmp_Pitch *2 ;
+	int     Num_Defect_Search =6; //2*2 
+	int     Backup_Num_Defect_Search=Num_Defect_Search;
+	int		Jmp_Char_Count = 6; // 6 pixel processing
+	int		Jmp_Short_Count =Jmp_Char_Count*2;
+	int		short_limit_horiz_count =
+		    (m_pParam->s_RectConv.Width()-Cmp_Pitch-MAX_WORD_PROCESS)/Jmp_Char_Count ;
+
+	int		backup_short_limit_horiz_count = short_limit_horiz_count;
+	UCHAR	*src_add = (UCHAR*)img ;
+	UCHAR   *cmp_add = src_add +Cmp_Pitch;
+	short	*Temp_Result_Add;
+	short   *Temp_Dynamic_thres_Result_Add;
+	Temp_Result_Add = new short[m_pParam->s_RectConv.Width()];
+	memset(Temp_Result_Add,0,sizeof(short) * m_pParam->s_RectConv.Width());
+	short Dynamic_thres[8];
+	UCHAR thres_suppress[16];
+	short check_tmp1[8];
+	short check_tmp2[8];
+	short check_tmp3[8];
+	short check_tmp4[8];
+	short check_tmp5[8];
+
+
+	short *check_tmp;
+	check_tmp=check_tmp1;
+	for(int suppress_i=0;suppress_i<16;suppress_i++)
+		thres_suppress[suppress_i] = m_pParam->s_nThresholdSupress;
+
+	int Start_X = 0;
+	int Start_Y = 0;
+	int start_x = Start_X+Cmp_Pitch;
+	int start_x1=Start_X+Cmp_Pitch;
+	for(int thre_i=0;thre_i<8;thre_i++)
+	{
+		Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		mulFactorR[thre_i] = rpRatio;
+		mulFactorC[thre_i] = rpRatioC;
+	}
+	Dynamic_thres[6]=1000; //2 word pass next ins
+	Dynamic_thres[7]=1000;
+
+	int nMaxPixelNum = m_pParam->s_nFrameDefPixLimit;
+
+	__asm {
+		pushad
+
+		mov			esi, src_add
+		 movdqu		xmm6, Dynamic_thres
+
+UNPACK_LOOP:
+		mov			edi, Temp_Result_Add
+		mov			ebx, limit_horiz_count
+	    pxor		xmm0, xmm0
+		mov			ecx , esi
+
+HORIZONTAL_IMG_SUM :
+	
+		mov			eax , ecx
+		pxor		xmm3, xmm3
+		pxor		xmm4, xmm4
+		pxor		xmm7, xmm7
+
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+		add			eax , horiz_count
+		
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+
+		movdqu		[edi],xmm3
+		movdqu		[edi+16],xmm4
+	
+		add			ecx ,16
+		add			edi ,32
+		dec			ebx
+		jnz			HORIZONTAL_IMG_SUM
+
+    
+INIT_BLANK_SPACE:
+		pxor		xmm0, xmm0  
+		mov			ebx,  start_x
+		mov			start_x1,ebx
+		mov			ebx,backup_short_limit_horiz_count
+		mov			short_limit_horiz_count,ebx
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+		mov			ecx, esi
+		mov			edi, Temp_Result_Add
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+
+HORIZONTAL_INS :
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch 
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		movdqu		xmm1, [edi]
+	
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+//		movdqu      check_tmp2,xmm3
+		
+		movdqu		xmm5, [edi+eax]
+	
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+//		movdqu      check_tmp1,xmm5
+
+
+	
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+//		movdqu      check_tmp3,xmm0
+	 	pcmpgtw     xmm0, xmm6
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH1 	
+		jmp			THRES_PASS1 	
+
+
+THRES_PASS1 :
+
+		mov			eax ,Jmp_Short_Count
+		add			edi, eax
+	//	add			ecx, eax
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_count
+		jnz			HORIZONTAL_INS
+
+		add			esi,horiz_count
+		inc			Start_Y
+		dec			limit_vert_count
+		jnz			UNPACK_LOOP
+		jmp			PROCESSING_END
+
+	
+DEFECT_SEARCH1 :
+		// 1锅掳 况靛
+	
+		mov			eax, start_x1
+		pextrw		edx, xmm0, 0x00
+		cmp			edx, 0
+		je			NODEFECT1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x00
+		pextrw		edx, xmm1, 0x00
+		cmp			ebx, edx
+		je			POSITIVE_POINT
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 1
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT1
+	
+POSITIVE_POINT : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 0
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+		
+NODEFECT1:	
+	// 2锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x01
+		cmp			edx, 0
+		je			NODEFECT2
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x01
+		pextrw		edx, xmm1, 0x01
+		cmp			ebx, edx
+		je			POSITIVE_POINT1
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 1
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT2
+	
+POSITIVE_POINT1 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 0
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+NODEFECT2:	
+	// 3锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x02
+		cmp			edx, 0
+		je			NODEFECT3
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x02
+		pextrw		edx, xmm1, 0x02
+		cmp			ebx, edx
+		je			POSITIVE_POINT2
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 1
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT3
+	
+POSITIVE_POINT2 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 0
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT3:	
+	// 4锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x03
+		cmp			edx, 0
+		je			NODEFECT4
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x03
+		pextrw		edx, xmm1, 0x03
+		cmp			ebx, edx
+		je			POSITIVE_POINT3
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 1
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT4
+	
+POSITIVE_POINT3 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 0
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT4:	
+	// 5锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x04
+		cmp			edx, 0
+		je			NODEFECT5
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x04
+		pextrw		edx, xmm1, 0x04
+		cmp			ebx, edx
+		je			POSITIVE_POINT4
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 1
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT5
+	
+POSITIVE_POINT4 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 0
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT5:	
+	// 6锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x05
+		cmp			edx, 0
+		je			THRES_PASS1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x05
+		pextrw		edx, xmm1, 0x05
+		cmp			ebx, edx
+		je			POSITIVE_POINT5
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 1
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			THRES_PASS1
+	
+POSITIVE_POINT5 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 0
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+		jmp			THRES_PASS1
+
+PROCESSING_END :
+		popad
+		emms
+	}
+	delete[] Temp_Result_Add;
+
+}
+
+void CConvInt1::HConvolution_SSE3_1()
+{
+	if(m_pParam->s_RectConv.Width() <=(int)(m_pParam->s_dPitchConvReal)*3)
+		return;
+#define PROCESSING_COUNT 6
+	char* img = (char*)(m_pParam->s_lpBuffer + m_pParam->s_RectConv.top * m_pParam->s_nFrameWidth + m_pParam->s_RectConv.left);
+	int		Honrizontal_Len =2;
+	int		Vertical_Len = 2;
+	int		MAX_WORD_PROCESS = 16;
+	int		SEARCH_WORD_PROCESS = 8 ;
+	if(m_pParam->s_RectConv.Width() <=0)
+		return; 
+	if(Honrizontal_Len > SEARCH_WORD_PROCESS)
+		return;
+	//lks 
+	short		mulFactorOrg[8] = {8,8,8,8,8,8,8,8};	// integer 楷魂栏肺 floating楷魂窍绰 瓤苞甫 焊扁困窍咯 
+	int			Cmp_Pitch = (int)(m_pParam->s_dPitchConvReal);	// 角荐pitch俊辑 沥荐己盒
+	double		rPitch = (m_pParam->s_dPitchConvReal) - Cmp_Pitch;	// 角荐pitch俊辑 沥荐己盒阑 猾 唱赣瘤 (0何磐 1荤捞狼 荐)
+	int			rpRatio = (int)(rPitch*8.0 + 0.5);		// 唱赣瘤 己盒狼 8盒困 殿鞭
+	int			rpRatioC = 8 - rpRatio;					// 8盒困殿鞭狼 8's complement
+	short		mulFactorR[8], mulFactorC[8];
+    // 2PITCH 
+	int			Cmp_Pitch2 = (int)(m_pParam->s_dPitchConvReal * 2);	// 角荐pitch俊辑 沥荐己盒
+	double		rPitch2 = (m_pParam->s_dPitchConvReal * 2) - Cmp_Pitch2;	// 角荐pitch俊辑 沥荐己盒阑 猾 唱赣瘤 (0何磐 1荤捞狼 荐)
+	int			rpRatio2 = (int)(rPitch2*8.0 + 0.5);		// 唱赣瘤 己盒狼 8盒困 殿鞭
+	int			rpRatioC2 = 8 - rpRatio2;					// 8盒困殿鞭狼 8's complement
+	short		mulFactorR2[8], mulFactorC2[8];
+
+	int     vertical_count=Vertical_Len;
+	int		horiz_count = m_pParam->s_nFrameWidth;
+	int		limit_vert_count = m_pParam->s_RectConv.Height()-1 ;
+	int     limit_horiz_count = m_pParam->s_RectConv.Width()/MAX_WORD_PROCESS+1;
+	int     backup_limit_horiz_count=limit_horiz_count;
+	int		Vwidth =m_pParam->s_nFrameWidth * vertical_count;
+	int		Hwidth =Cmp_Pitch;
+	int		Short_Cmp_Pitch =Cmp_Pitch *2 ;
+	int		Short_Cmp_Pitch2 =Cmp_Pitch2 *2 ;
+	int		Jmp_Char_Count = PROCESSING_COUNT; // 6 pixel processing
+	int		Jmp_Short_Count =Jmp_Char_Count*2;
+	int		Jmp_Char_Count2 = Jmp_Char_Count*2; // 6 pixel processing
+	int		Jmp_Short_Count2 =Jmp_Short_Count*2;
+	int		short_limit_horiz_count =
+		    (m_pParam->s_RectConv.Width()-Cmp_Pitch2-Jmp_Char_Count)/Jmp_Char_Count ;
+	int temp=0;
+	int short_limit_horiz_right_count=0;
+	if(m_pParam->s_RectConv.Width() <=(int)(m_pParam->s_dPitchConvReal)*3)
+	{
+			 temp=Jmp_Char_Count-Cmp_Pitch%Jmp_Char_Count;
+		     short_limit_horiz_right_count =(temp+(Cmp_Pitch))/Jmp_Char_Count;
+
+	}
+	else
+	{
+		     temp=Jmp_Char_Count-Cmp_Pitch2%Jmp_Char_Count;
+			 short_limit_horiz_right_count =(temp+(Cmp_Pitch2))/Jmp_Char_Count;
+	}
+	
+	int		backup_short_limit_horiz_count = short_limit_horiz_count;
+	int		backup_short_limit_horiz_right_count = short_limit_horiz_right_count;
+
+	UCHAR	*src_add = (UCHAR*)img ;
+	short	*Temp_Result_Add;
+	Temp_Result_Add = new short[m_pParam->s_RectConv.Width()+Short_Cmp_Pitch];
+	memset(Temp_Result_Add,0,sizeof(short) * (m_pParam->s_RectConv.Width()+Short_Cmp_Pitch));
+	short Dynamic_thres[8];
+	UCHAR thres_suppress[16];
+	int Start_X = 0;
+	int Start_Y = 0;
+	int start_x = Start_X;
+	int start_x1=Start_X;
+	int p=m_pParam->s_RectConv.Width();
+	int start_right_x = m_pParam->s_RectConv.Width()-short_limit_horiz_right_count*Jmp_Char_Count;
+	int start_right_x1=Start_X;
+	int is_right_ins_mode =0;
+
+	int nMaxPixelNum = m_pParam->s_nFrameDefPixLimit;
+
+
+	short check_tmp1[8];
+	short check_tmp2[8];
+	short check_tmp3[8];
+	short check_tmp4[8];
+	short check_tmp5[8];    // yong debug 
+ 
+	for(int suppress_i=0;suppress_i<16;suppress_i++)
+		thres_suppress[suppress_i] = m_pParam->s_nThresholdSupress;
+
+	for(int thre_i=0;thre_i<8;thre_i++)
+	{
+		Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		mulFactorR[thre_i] = rpRatio;
+		mulFactorC[thre_i] = rpRatioC;
+		mulFactorR2[thre_i] = rpRatio2;
+		mulFactorC2[thre_i] = rpRatioC2;
+	}
+	Dynamic_thres[6]=1000; //2 word pass next ins max :: 255*4(2cheng2)
+	Dynamic_thres[7]=1000;
+
+	__asm {
+		pushad
+
+		mov			esi, src_add
+		 movdqu		xmm6, Dynamic_thres
+
+UNPACK_LOOP:
+		mov			edi, Temp_Result_Add
+		mov			ebx, limit_horiz_count
+	    pxor		xmm0, xmm0
+		mov			ecx , esi
+
+HORIZONTAL_IMG_SUM :
+	
+		mov			eax , ecx
+		pxor		xmm3, xmm3
+		pxor		xmm4, xmm4
+		pxor		xmm7, xmm7
+
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+		add			eax , horiz_count
+		
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+
+		movdqu		[edi],xmm3
+		movdqu		[edi+16],xmm4
+
+		add			ecx ,16
+		add			edi ,32
+		dec			ebx
+		jnz			HORIZONTAL_IMG_SUM
+
+    
+INIT_BLANK_SPACE:
+		pxor		xmm0, xmm0  
+		mov			ebx,  start_x
+		mov			start_x1,ebx
+		mov			ebx,backup_short_limit_horiz_count
+		mov			short_limit_horiz_count,ebx
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+		mov			ecx, esi
+		mov			edi, Temp_Result_Add
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+		mov         is_right_ins_mode,0
+
+HORIZONTAL_INS_LEFT :
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch 
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		movdqu		xmm1, [edi]
+	
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+		
+		movdqu		xmm5, [edi+eax]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+//		movdqu      check_tmp1, xmm3
+//		movdqu      check_tmp2, xmm5	
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		movdqu		xmm7, xmm0
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH1 	
+		jmp			THRES_PASS1 	
+
+DEFECT_SEARCH1 :
+
+		mov			eax , Short_Cmp_Pitch2
+		movdqu		xmm5, [edi+eax]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC2
+		pmullw      xmm5, xmm0
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR2
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+//		movdqu      check_tmp1, xmm3
+//		movdqu      check_tmp2, xmm5
+
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+//		movdqu      check_tmp3, xmm0
+//		movdqu      check_tmp4, xmm7
+		pand	    xmm0, xmm7
+	
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH2 	
+		jmp			THRES_PASS1 	
+
+THRES_PASS1 :
+
+		mov			eax ,Jmp_Short_Count
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_count
+		jnz			HORIZONTAL_INS_LEFT
+		jmp			HORIZONTAL_INS_RIGHT_START 
+
+THRES_PASS2 :
+
+		mov			eax ,Jmp_Short_Count2
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count2
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_count
+		jz			HORIZONTAL_INS_RIGHT_START
+		dec			short_limit_horiz_count
+		jnz			HORIZONTAL_INS_LEFT
+
+HORIZONTAL_INS_RIGHT_START :
+
+		mov			edi, Temp_Result_Add
+		mov			ebx,  start_right_x
+		mov			start_x1,ebx
+		mov			eax ,start_x1
+		add         edi , eax
+		add			edi, eax
+		mov         eax,backup_short_limit_horiz_right_count
+		mov         short_limit_horiz_right_count,eax
+		mov         is_right_ins_mode,1
+
+
+//Right 
+HORIZONTAL_INS_RIGHT :
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch 
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		sub         edi, eax
+		movdqu		xmm1, [edi]   //[edi -eax]bu neng  directly sub 
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+		add         edi, eax	
+		movdqu		xmm5, [edi]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		movdqu		xmm7, xmm0
+
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH1_RIGHT 	
+		jmp			THRES_PASS1_RIGHT 	
+
+DEFECT_SEARCH1_RIGHT :
+
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch2 
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		sub         edi, eax
+		movdqu		xmm1, [edi]
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+
+		add         edi, eax
+		movdqu		xmm5, [edi]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC2
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR2
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+
+		movdqu		xmm1, xmm5
+		psubw		xmm1, xmm3
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		pand	    xmm0, xmm7
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH2 	
+		
+THRES_PASS1_RIGHT :
+
+		mov			eax ,Jmp_Short_Count
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_right_count
+		jnz			HORIZONTAL_INS_RIGHT
+
+
+NEXT_VERTICAL :
+
+		add			esi,horiz_count
+		inc			Start_Y
+		dec			limit_vert_count
+		jnz			UNPACK_LOOP
+		jmp			PROCESSING_END
+
+	
+DEFECT_SEARCH2 :
+		// 1锅掳 况靛
+	
+		mov			eax, start_x1
+		pextrw		edx, xmm0, 0x00
+		cmp			edx, 0
+		je			NODEFECT1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x00
+		pextrw		edx, xmm1, 0x00
+		cmp			ebx, edx
+		je			POSITIVE_POINT
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT1
+	
+POSITIVE_POINT : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+		
+NODEFECT1:	
+	// 2锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x01
+		cmp			edx, 0
+		je			NODEFECT2
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x01
+		pextrw		edx, xmm1, 0x01
+		cmp			ebx, edx
+		je			POSITIVE_POINT1
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT2
+	
+POSITIVE_POINT1 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+NODEFECT2:	
+	// 3锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x02
+		cmp			edx, 0
+		je			NODEFECT3
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x02
+		pextrw		edx, xmm1, 0x02
+		cmp			ebx, edx
+		je			POSITIVE_POINT2
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT3
+	
+POSITIVE_POINT2 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT3:	
+	// 4锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x03
+		cmp			edx, 0
+		je			NODEFECT4
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x03
+		pextrw		edx, xmm1, 0x03
+		cmp			ebx, edx
+		je			POSITIVE_POINT3
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT4
+	
+POSITIVE_POINT3 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT4:	
+	// 5锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x04
+		cmp			edx, 0
+		je			NODEFECT5
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x04
+		pextrw		edx, xmm1, 0x04
+		cmp			ebx, edx
+		je			POSITIVE_POINT4
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT5
+	
+POSITIVE_POINT4 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT5:	
+	// 6锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x05
+		cmp			edx, 0
+		je			THRES_PASS
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x05
+		pextrw		edx, xmm1, 0x05
+		cmp			ebx, edx
+		je			POSITIVE_POINT5
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+THRES_PASS :
+		mov         edx,is_right_ins_mode
+		cmp         edx,1
+		je          THRES_PASS1_RIGHT
+		jmp			THRES_PASS1
+	
+POSITIVE_POINT5 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+		mov         edx,is_right_ins_mode
+		cmp         edx,1
+		je          THRES_PASS1_RIGHT
+		jmp			THRES_PASS1
+
+PROCESSING_END :
+		popad
+		emms
+	}
+	delete[] Temp_Result_Add;
+
+}
+
+void CConvInt1::PairingPlus_1(double dPitchsize)
+{
+//////////////////////////////////////////////////////////////////////////
+	//MMX俊辑 thresholding鳖瘤窍绊 唱坷绰 搬窃狼 point沥焊绰 pair肺 唱坷骨肺 
+	//角力 茄俺狼 point沥焊甫 芭福绰 苞沥捞 鞘夸窍促.
+
+	int i, j;
+	BOOL ignore = FALSE;
+	for(i = 0; i < m_nDefectNum; i++)
+	{
+		if (m_nDefectPairedNum >= m_pParam->s_nFrameDefPixLimit)
+			break;
+
+		if(m_sDefectType[i] == DEFTYPE_DELETE)
+			continue;
+
+		if (m_sDefectType[i] == DEFTYPE_NODEFECT)
+			continue;
+			m_DefectPaired[m_nDefectPairedNum].s_DefectPos		= DEFPOS_CENTER;
+			m_DefectPaired[m_nDefectPairedNum].s_DefectPair		= DEFPAIR_PPAIR;
+			m_DefectPaired[m_nDefectPairedNum].s_nDefectX		= m_nDefectPointX[i] + m_pParam->s_RectConv.left - 1;	// Add Margin
+			m_DefectPaired[m_nDefectPairedNum].s_nDefectY		= m_nDefectPointY[i] + m_pParam->s_RectConv.top;
+			m_DefectPaired[m_nDefectPairedNum].s_DefectType		= static_cast<DefectType>(m_sDefectType[i]);	//角力归搬窃篮1,孺搬窃篮0
+			m_DefectPaired[m_nDefectPairedNum].SetPeak(m_nDefectValue[i], m_pParam->s_nThreshold, m_pParam->s_nConvWidth * m_pParam->s_nConvHeight);
+			m_nDefectPairedNum++;
+	}
+	
+
+
+//	return DIT_CONV_SUCCESS;
+}
+
+void CConvInt1::HConvolution_SSE3_PITCH3()
+{
+
+#define PROCESSING_COUNT 6
+	char* img = (char*)(m_pParam->s_lpBuffer + m_pParam->s_RectConv.top * m_pParam->s_nFrameWidth + m_pParam->s_RectConv.left);
+	int		Honrizontal_Len =2;
+	int		Vertical_Len = 2;
+	int		MAX_WORD_PROCESS = 16;
+	int		SEARCH_WORD_PROCESS = 8 ;
+	if(m_pParam->s_RectConv.Width() <=0)
+		return; 
+	if(Honrizontal_Len > SEARCH_WORD_PROCESS)
+		return;
+	//lks 
+	short		mulFactorOrg[8] = {8,8,8,8,8,8,8,8};	// integer 楷魂栏肺 floating楷魂窍绰 瓤苞甫 焊扁困窍咯 
+	int			Cmp_Pitch = (int)(m_pParam->s_dPitchConvReal);	// 角荐pitch俊辑 沥荐己盒
+	double		rPitch = (m_pParam->s_dPitchConvReal) - Cmp_Pitch;	// 角荐pitch俊辑 沥荐己盒阑 猾 唱赣瘤 (0何磐 1荤捞狼 荐)
+	int			rpRatio = (int)(rPitch*8.0 + 0.5);		// 唱赣瘤 己盒狼 8盒困 殿鞭
+	int			rpRatioC = 8 - rpRatio;					// 8盒困殿鞭狼 8's complement
+	short		mulFactorR[8], mulFactorC[8];
+    // 2PITCH 
+	int			Cmp_Pitch2 = (int)(m_pParam->s_dPitchConvReal * 2);	// 角荐pitch俊辑 沥荐己盒
+	double		rPitch2 = (m_pParam->s_dPitchConvReal * 2) - Cmp_Pitch2;	// 角荐pitch俊辑 沥荐己盒阑 猾 唱赣瘤 (0何磐 1荤捞狼 荐)
+	int			rpRatio2 = (int)(rPitch2*8.0 + 0.5);		// 唱赣瘤 己盒狼 8盒困 殿鞭
+	int			rpRatioC2 = 8 - rpRatio2;					// 8盒困殿鞭狼 8's complement
+	short		mulFactorR2[8], mulFactorC2[8];
+
+	int     vertical_count=Vertical_Len;
+	int		horiz_count = m_pParam->s_nFrameWidth;
+	int		limit_vert_count = m_pParam->s_RectConv.Height()-1 ;
+	int     limit_horiz_count = m_pParam->s_RectConv.Width()/MAX_WORD_PROCESS+1;
+	int     backup_limit_horiz_count=limit_horiz_count;
+	int		Vwidth =m_pParam->s_nFrameWidth * vertical_count;
+	int		Hwidth =Cmp_Pitch;
+	int		Short_Cmp_Pitch =Cmp_Pitch *2 ;
+	int		Short_Cmp_Pitch2 =Cmp_Pitch2 *2 ;
+	int		Jmp_Char_Count = PROCESSING_COUNT; // 6 pixel processing
+	int		Jmp_Short_Count =Jmp_Char_Count*2;
+	int		Jmp_Char_Count2 = Jmp_Char_Count*2; // 6 pixel processing
+	int		Jmp_Short_Count2 =Jmp_Short_Count*2;
+	int		short_limit_horiz_count =
+		    (m_pParam->s_RectConv.Width()-Cmp_Pitch2-Jmp_Char_Count)/Jmp_Char_Count ;
+	int     temp=Jmp_Char_Count-Cmp_Pitch2%Jmp_Char_Count;
+	int     short_limit_horiz_right_count =(temp+(Cmp_Pitch*2))/Jmp_Char_Count;
+
+	int		backup_short_limit_horiz_count = short_limit_horiz_count;
+	int		backup_short_limit_horiz_right_count = short_limit_horiz_right_count;
+
+	UCHAR	*src_add = (UCHAR*)img ;
+	short	*Temp_Result_Add;
+	Temp_Result_Add = new short[m_pParam->s_RectConv.Width()+Short_Cmp_Pitch];
+	memset(Temp_Result_Add,0,sizeof(short) * (m_pParam->s_RectConv.Width()+Short_Cmp_Pitch));
+	short Dynamic_thres[8];
+	UCHAR thres_suppress[16];
+	int Start_X = 0;
+	int Start_Y = 0;
+	int start_x = Start_X;
+	int start_x1=Start_X;
+	int start_right_x = m_pParam->s_RectConv.Width()-short_limit_horiz_right_count*Jmp_Char_Count;
+	int start_right_x1=Start_X;
+	int is_right_ins_mode =0;
+	Dynamic_thres[6]=1000; //2 word pass next ins max :: 255*4(2cheng2)
+	Dynamic_thres[7]=1000;
+	int nMaxPixelNum = m_pParam->s_nFrameDefPixLimit;
+
+/*
+	short check_tmp1[8];
+	short check_tmp2[8];
+	short check_tmp3[8];
+	short check_tmp4[8];
+	short check_tmp5[8];  */  // yong debug 
+ 
+	for(int suppress_i=0;suppress_i<16;suppress_i++)
+		thres_suppress[suppress_i] = m_pParam->s_nThresholdSupress;
+
+	for(int thre_i=0;thre_i<8;thre_i++)
+	{
+		Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		mulFactorR[thre_i] = rpRatio;
+		mulFactorC[thre_i] = rpRatioC;
+		mulFactorR2[thre_i] = rpRatio2;
+		mulFactorC2[thre_i] = rpRatioC2;
+	}
+
+
+	__asm {
+		pushad
+
+		mov			esi, src_add
+		 movdqu		xmm6, Dynamic_thres
+
+UNPACK_LOOP:
+		mov			edi, Temp_Result_Add
+		mov			ebx, limit_horiz_count
+	    pxor		xmm0, xmm0
+		mov			ecx , esi
+
+HORIZONTAL_IMG_SUM :
+	
+		mov			eax , ecx
+		pxor		xmm3, xmm3
+		pxor		xmm4, xmm4
+		pxor		xmm7, xmm7
+
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+		add			eax , horiz_count
+		
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+
+		movdqu		[edi],xmm3
+		movdqu		[edi+16],xmm4
+
+		add			ecx ,16
+		add			edi ,32
+		dec			ebx
+		jnz			HORIZONTAL_IMG_SUM
+
+    
+INIT_BLANK_SPACE:
+		pxor		xmm0, xmm0  
+		mov			ebx,  start_x
+		mov			start_x1,ebx
+		mov			ebx,backup_short_limit_horiz_count
+		mov			short_limit_horiz_count,ebx
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+		mov			ecx, esi
+		mov			edi, Temp_Result_Add
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+		mov         is_right_ins_mode,0
+
+HORIZONTAL_INS_LEFT :
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch 
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		movdqu		xmm1, [edi]
+	
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+		
+		movdqu		xmm5, [edi+eax]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+	
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		movdqu		xmm7, xmm0
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH1 	
+		jmp			THRES_PASS1 	
+
+DEFECT_SEARCH1 :
+
+		mov			eax , Short_Cmp_Pitch2
+		movdqu		xmm5, [edi+eax]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC2
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR2
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+	
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		pand	    xmm0, xmm7
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH2 	
+		jmp			THRES_PASS1 	
+
+THRES_PASS1 :
+
+		mov			eax ,Jmp_Short_Count
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_count
+		jnz			HORIZONTAL_INS_LEFT
+		jmp			HORIZONTAL_INS_RIGHT_START 
+
+THRES_PASS2 :
+
+		mov			eax ,Jmp_Short_Count2
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count2
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_count
+		jz			HORIZONTAL_INS_RIGHT_START
+		dec			short_limit_horiz_count
+		jnz			HORIZONTAL_INS_LEFT
+
+HORIZONTAL_INS_RIGHT_START :
+
+		mov			edi, Temp_Result_Add
+		mov			ebx,  start_right_x
+		mov			start_x1,ebx
+		mov			eax ,start_x1
+		add         edi , eax
+		add			edi, eax
+		mov         eax,backup_short_limit_horiz_right_count
+		mov         short_limit_horiz_right_count,eax
+		mov         is_right_ins_mode,1
+
+
+//Right 
+HORIZONTAL_INS_RIGHT :
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch 
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		sub         edi, eax
+		movdqu		xmm1, [edi]   //[edi -eax]bu neng  directly sub 
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+		add         edi, eax	
+		movdqu		xmm5, [edi]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+	
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		movdqu		xmm7, xmm0
+
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH1_RIGHT 	
+		jmp			THRES_PASS1_RIGHT 	
+
+DEFECT_SEARCH1_RIGHT :
+
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch2 
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		sub         edi, eax
+		movdqu		xmm1, [edi]
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+
+		add         edi, eax
+		movdqu		xmm5, [edi]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, mulFactorC2
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, mulFactorR2
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+        movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+
+		movdqu		xmm1, xmm5
+		psubw		xmm1, xmm3
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		pand	    xmm0, xmm7
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH2 	
+		
+THRES_PASS1_RIGHT :
+
+		mov			eax ,Jmp_Short_Count
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_right_count
+		jnz			HORIZONTAL_INS_RIGHT
+
+
+NEXT_VERTICAL :
+
+		add			esi,horiz_count
+		inc			Start_Y
+		dec			limit_vert_count
+		jnz			UNPACK_LOOP
+		jmp			PROCESSING_END
+
+	
+DEFECT_SEARCH2 :
+		// 1锅掳 况靛
+	
+		mov			eax, start_x1
+		pextrw		edx, xmm0, 0x00
+		cmp			edx, 0
+		je			NODEFECT1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x00
+		pextrw		edx, xmm1, 0x00
+		cmp			ebx, edx
+		je			POSITIVE_POINT
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT1
+	
+POSITIVE_POINT : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+		
+NODEFECT1:	
+	// 2锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x01
+		cmp			edx, 0
+		je			NODEFECT2
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x01
+		pextrw		edx, xmm1, 0x01
+		cmp			ebx, edx
+		je			POSITIVE_POINT1
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT2
+	
+POSITIVE_POINT1 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+NODEFECT2:	
+	// 3锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x02
+		cmp			edx, 0
+		je			NODEFECT3
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x02
+		pextrw		edx, xmm1, 0x02
+		cmp			ebx, edx
+		je			POSITIVE_POINT2
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT3
+	
+POSITIVE_POINT2 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT3:	
+	// 4锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x03
+		cmp			edx, 0
+		je			NODEFECT4
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x03
+		pextrw		edx, xmm1, 0x03
+		cmp			ebx, edx
+		je			POSITIVE_POINT3
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT4
+	
+POSITIVE_POINT3 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT4:	
+	// 5锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x04
+		cmp			edx, 0
+		je			NODEFECT5
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x04
+		pextrw		edx, xmm1, 0x04
+		cmp			ebx, edx
+		je			POSITIVE_POINT4
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT5
+	
+POSITIVE_POINT4 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT5:	
+	// 6锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x05
+		cmp			edx, 0
+		je			THRES_PASS
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x05
+		pextrw		edx, xmm1, 0x05
+		cmp			ebx, edx
+		je			POSITIVE_POINT5
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+THRES_PASS :
+		mov         edx,is_right_ins_mode
+		cmp         edx,1
+		je          THRES_PASS1_RIGHT
+		jmp			THRES_PASS1
+	
+POSITIVE_POINT5 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+		mov         edx,is_right_ins_mode
+		cmp         edx,1
+		je          THRES_PASS1_RIGHT
+		jmp			THRES_PASS1
+
+PROCESSING_END :
+		popad
+		emms
+	}
+	delete[] Temp_Result_Add;
+}
+
+void CConvInt1::VConvolution_SEE3()
+{
+/*
+   reverse de hua huan add jizhu.
+*/
+	
+ if(m_pParam->s_RectConv.Height() <=(int)(m_pParam->s_dPitchConvReal)*4)
+		return;
+
+	char* img = (char*)(m_pParam->s_lpBuffer + m_pParam->s_RectConv.top * m_pParam->s_nFrameWidth + m_pParam->s_RectConv.left);
+	if(m_pParam->s_RectConv.Width() <=0)
+		return; 
+	//lks 
+#define 		PROCESSING_COUNT 7
+#define 		MAX_THRESHOLD 1000 
+	short		mulFactorOrg[8] = {8,8,8,8,8,8,8,8};	
+	int			Cmp_Pitch = (int)(m_pParam->s_dPitchConvReal);
+	double		rPitch = (m_pParam->s_dPitchConvReal) - Cmp_Pitch;	
+	int			rpRatio = (int)(rPitch*8.0 + 0.5);	
+	int			rpRatioC = 8 - rpRatio;				
+	short		mulFactorR[8], mulFactorC[8];
+    // 2PITCH 
+	int			Cmp_Pitch2 = (int)(m_pParam->s_dPitchConvReal * 2);	
+	double		rPitch2 = (m_pParam->s_dPitchConvReal * 2) - Cmp_Pitch2;
+	int			rpRatio2 = (int)(rPitch2*8.0 + 0.5);	
+	int			rpRatioC2 = 8 - rpRatio2;				
+	short		mulFactorR2[8], mulFactorC2[8];
+
+	int		horiz_count = m_pParam->s_nFrameWidth;
+	int		limit_vert_count = m_pParam->s_RectConv.Height()-1 ;
+	int		limit_vert_count_forward =limit_vert_count-Cmp_Pitch2  ;
+	int		limit_vert_count_backward = Cmp_Pitch2 ; //2*2 end 
+	int		Jmp_Char_Count = PROCESSING_COUNT; // 7 pixel processing
+	int		char_limit_horiz_count =
+		    m_pParam->s_RectConv.Width()/Jmp_Char_Count ;
+	int		Remainder_count =
+		    m_pParam->s_RectConv.Width()%Jmp_Char_Count ;
+	int		temp=0;
+	int     Inspection_End=1;
+	int		backup_char_limit_horiz_count = char_limit_horiz_count;
+	int     backup_Remainder_count= Remainder_count;
+
+	UCHAR	*src_add = (UCHAR*)img ;
+	UCHAR   *src_add_backward= (UCHAR*)img +limit_vert_count_forward*horiz_count- Cmp_Pitch*horiz_count;
+	UCHAR   *dest_add =(UCHAR*)img + Cmp_Pitch*horiz_count;
+	UCHAR   *dest_add2 =(UCHAR*)img + Cmp_Pitch2*horiz_count;
+	UCHAR   *dest_add_minus =(UCHAR*)src_add_backward + Cmp_Pitch*horiz_count;  //yuanlai src 
+	UCHAR   *dest_add2_minus =(UCHAR*)dest_add_minus - Cmp_Pitch2*horiz_count;
+	UCHAR   *dest_add_backup =dest_add;
+	UCHAR   *dest_add2_backup =dest_add2;
+	UCHAR   *src_add_backup=src_add;
+	short Dynamic_thres[8];
+	short Remainder_Dynamic_thres[8];
+	UCHAR thres_suppress[16];
+	int Start_X = 0;
+	int Start_Y = 0;
+	int start_x = Start_X;
+	int start_x1=Start_X;
+	int nMaxPixelNum = m_pParam->s_nFrameDefPixLimit;
+	int is_reverse=0; 
+
+	UCHAR check_tmp11[16];
+	short check_tmp1[8];
+	short check_tmp2[8];
+	short check_tmp3[8];
+	short check_tmp4[8];
+	short check_tmp5[8];    // yong debug 
+ 
+	for(int suppress_i=0;suppress_i<16;suppress_i++)
+		thres_suppress[suppress_i] = m_pParam->s_nThresholdSupress;
+
+	for(int thre_i=0;thre_i<8;thre_i++)
+	{
+		Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		Remainder_Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		mulFactorR[thre_i] = rpRatio;
+		mulFactorC[thre_i] = rpRatioC;
+		mulFactorR2[thre_i] = rpRatio2;
+		mulFactorC2[thre_i] = rpRatioC2;
+	}
+	Dynamic_thres[7]=MAX_THRESHOLD; //1 word pass next ins max :: 255*4(2cheng2)
+	for(thre_i=0;thre_i<8-Remainder_count;thre_i++)
+	{
+		Remainder_Dynamic_thres[PROCESSING_COUNT-thre_i]=MAX_THRESHOLD;
+
+	}
+
+	__asm {
+		pushad
+
+UNPACK_LOOP:
+    
+		mov			ebx,  start_x
+		mov			start_x1,ebx
+		mov			ebx,backup_char_limit_horiz_count
+		mov			char_limit_horiz_count,ebx
+		movdqu      xmm6,Dynamic_thres
+		mov         edx, backup_Remainder_count
+		mov         Remainder_count,edx
+		
+HORIZONTAL_INS_LEFT :
+		mov			edi, src_add
+		pxor		xmm0, xmm0
+		pxor		xmm3, xmm3
+		Pxor        xmm4, xmm4
+		movdqu		xmm1, [edi]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+
+		paddw		xmm3, xmm2
+		mov			eax , horiz_count
+		add			edi , eax
+		movdqu		xmm1, [edi]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		paddw		xmm3, xmm2
+		movdqu		xmm4, xmm3
+		psrldq		xmm4, 2
+		paddw		xmm3, xmm4
+
+		mov			edi , dest_add 
+		pxor		xmm4, xmm4
+		movdqu		xmm1, [edi]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm0, mulFactorC
+		pmullw      xmm2, xmm0
+		paddw		xmm4, xmm2
+		mov			eax , horiz_count
+		add			edi , eax
+		movdqu		xmm1, [edi]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm7, xmm2 
+		movdqu		xmm0, mulFactorR
+	    pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		movdqu		xmm0, mulFactorC 
+		pmullw		xmm7, xmm0
+		paddw       xmm4, xmm7
+		add         edi,  eax
+		movdqu		xmm1, [edi]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm7, xmm2 
+		movdqu		xmm0, mulFactorR
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		psraw		xmm4, 3
+        movdqu		xmm5, xmm4
+		psrldq		xmm4, 2		//1 num rpa
+		paddw		xmm5, xmm4 
+//		movdqu		check_tmp2,xmm5
+//		movdqu		check_tmp1,xmm3
+
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		movdqu		xmm7, xmm0
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH1 	
+		jmp			THRES_PASS1 	
+
+THRES_PASS1 :
+		
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		mov         edi, src_add
+		add         edi, eax
+		mov         src_add,edi 
+		mov         edi, dest_add
+		add         edi, eax
+		mov         dest_add,edi 
+		mov         edi, dest_add2
+		add         edi, eax
+		mov         dest_add2,edi 
+		dec			char_limit_horiz_count
+		jnz			HORIZONTAL_INS_LEFT
+		mov         eax, Remainder_count
+		cmp			eax,  0
+		je			NEXT_VERTICAL
+		mov			Remainder_count,0
+		mov         char_limit_horiz_count,1
+		movdqu      xmm6,Remainder_Dynamic_thres
+		jmp			HORIZONTAL_INS_LEFT 	
+			
+			
+NEXT_VERTICAL :
+		mov         eax,horiz_count
+		add         src_add_backup,eax
+		mov			edi,src_add_backup
+		mov			src_add,edi
+		add         dest_add_backup,eax
+		mov         edi,dest_add_backup
+		mov         dest_add,edi
+		add         dest_add2_backup,eax
+		mov			edi,dest_add2_backup
+		mov         dest_add2,edi
+		inc			Start_Y
+		dec			limit_vert_count_forward
+		jnz			UNPACK_LOOP
+		cmp			Inspection_End,0
+		je			PROCESSING_END
+		mov         eax,limit_vert_count_backward
+		mov         limit_vert_count_forward,eax
+		mov         edi,src_add_backward
+		mov         src_add,edi
+		mov			src_add_backup,edi
+		mov         edi,dest_add_minus
+		mov         dest_add,edi
+		mov         dest_add_backup,edi
+		mov         edi,dest_add2_minus
+		mov         dest_add2,edi
+		mov			dest_add2_backup,edi
+		mov			Inspection_End,0
+		mov         is_reverse,1 
+		jmp         UNPACK_LOOP
+
+DEFECT_SEARCH1 :
+		mov			edx, is_reverse 
+		cmp         edx, 1
+		je			DEFECT_SEARCH1_REVERSE
+		mov			edi , dest_add2 
+		pxor		xmm4, xmm4
+		movdqu		xmm1, [edi]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm0, mulFactorC2
+		pmullw      xmm2, xmm0
+		paddw		xmm4, xmm2
+		mov			eax , horiz_count
+		add			edi , eax
+		movdqu		xmm1, [edi]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm1, xmm2
+		movdqu		xmm0, mulFactorR2
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+        movdqu		xmm0, mulFactorC2
+		pmullw      xmm1, xmm0
+		paddw       xmm4, xmm1
+		add         edi,  eax
+		movdqu		xmm1, [edi]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm0, mulFactorR2
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+
+		psraw		xmm4, 3
+		movdqu		xmm5,xmm4
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5, xmm4
+//		movdqu		check_tmp3,xmm5
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		pand	    xmm0, xmm7
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH2 	
+		jmp			THRES_PASS1 	
+
+
+DEFECT_SEARCH1_REVERSE :
+
+		pxor		xmm0, xmm0
+		pxor		xmm3, xmm3
+		Pxor        xmm4, xmm4
+		mov			edi,  dest_add2
+		movdqu		xmm1, [edi]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		paddw		xmm3, xmm2
+		mov			eax , horiz_count
+		add			edi , eax
+		movdqu		xmm1, [edi]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		paddw		xmm3, xmm2
+		movdqu		xmm4, xmm3
+		psrldq		xmm4, 2
+		paddw		xmm3, xmm4	
+
+		mov			edi , dest_add  //reverse ~ dest_add -> src 
+		pxor		xmm4, xmm4
+		movdqu		xmm1, [edi]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm0, mulFactorC2
+		pmullw      xmm2, xmm0
+		paddw		xmm4, xmm2
+		mov			eax , horiz_count
+		add			edi , eax
+		movdqu		xmm1, [edi]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm1, xmm2
+		movdqu		xmm0, mulFactorR2
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		movdqu		xmm0, mulFactorC2
+		pmullw      xmm1, xmm0
+		paddw       xmm4, xmm1
+		add         edi,  eax
+		movdqu		xmm1, [edi]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+	//	movdqu	    xmm1, xmm2
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm0, mulFactorR2
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		
+		psraw		xmm4, 3
+		movdqu		xmm5, xmm4
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5, xmm4
+		movdqu		xmm2, xmm5
+		movdqu		xmm5, xmm3
+		movdqu		xmm3, xmm2 
+		movdqu		xmm1, xmm3
+//		movdqu		check_tmp2,xmm5
+//		movdqu		check_tmp1,xmm3
+
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+		pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+		pcmpgtw     xmm0, xmm6
+		pand	    xmm0, xmm7
+		pmovmskb    edx,  xmm0
+		cmp			edx,  0
+		jne			DEFECT_SEARCH2 	
+		jmp			THRES_PASS1 
+
+
+	
+DEFECT_SEARCH2 :
+		// 1锅掳 况靛
+	
+		mov			eax, start_x1
+		pextrw		edx, xmm0, 0x00
+		cmp			edx, 0
+		je			NODEFECT1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x00
+		pextrw		edx, xmm1, 0x00
+		cmp			ebx, edx
+		je			POSITIVE_POINT
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT1
+	
+POSITIVE_POINT : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+		
+NODEFECT1:	
+	// 2锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x01
+		cmp			edx, 0
+		je			NODEFECT2
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x01
+		pextrw		edx, xmm1, 0x01
+		cmp			ebx, edx
+		je			POSITIVE_POINT1
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT2
+	
+POSITIVE_POINT1 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+NODEFECT2:	
+	// 3锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x02
+		cmp			edx, 0
+		je			NODEFECT3
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x02
+		pextrw		edx, xmm1, 0x02
+		cmp			ebx, edx
+		je			POSITIVE_POINT2
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT3
+	
+POSITIVE_POINT2 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT3:	
+	// 4锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x03
+		cmp			edx, 0
+		je			NODEFECT4
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x03
+		pextrw		edx, xmm1, 0x03
+		cmp			ebx, edx
+		je			POSITIVE_POINT3
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT4
+	
+POSITIVE_POINT3 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT4:	
+	// 5锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x04
+		cmp			edx, 0
+		je			NODEFECT5
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x04
+		pextrw		edx, xmm1, 0x04
+		cmp			ebx, edx
+		je			POSITIVE_POINT4
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT5
+	
+POSITIVE_POINT4 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT5:	
+			// 6锅掳 况靛
+			inc			eax
+			pextrw		edx, xmm0, 0x05
+			cmp			edx, 0
+			je			NODEFECT6
+			
+			mov			edx, nMaxPixelNum
+			cmp			m_nDefectNum, edx
+			je			PROCESSING_END
+			
+			mov			edx, m_nDefectNum
+			mov			ebx,Start_Y
+			mov			m_nDefectPointX[4*edx], eax
+			mov			m_nDefectPointY[4*edx], ebx
+			pextrw		ebx, xmm2, 0x05
+			pextrw		edx, xmm1, 0x05
+			cmp			ebx, edx
+			je			POSITIVE_POINT5
+			mov			ebx, m_nDefectNum
+			mov			m_sDefectType[2*ebx], 0
+			mov			m_nDefectValue[4*ebx], edx
+			inc			m_nDefectNum
+			jmp			NODEFECT6
+			
+POSITIVE_POINT5 : 
+			mov			edx, m_nDefectNum
+			mov			m_sDefectType[2*edx], 1
+			mov			m_nDefectValue[4*edx], ebx
+			inc			m_nDefectNum
+
+
+NODEFECT6:	
+	// 7锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x06
+		cmp			edx, 0
+		je			THRES_PASS1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x06
+		pextrw		edx, xmm1, 0x06
+		cmp			ebx, edx
+		je			POSITIVE_POINT6
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			THRES_PASS1
+	
+POSITIVE_POINT6 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+		jmp			THRES_PASS1
+
+PROCESSING_END :
+		popad
+		emms
+	}
+
+}
+
+int CConvInt1::HConvolution_SSE3_6()
+{
+#define PROCESSING_COUNT 6
+	if(m_pParam->s_RectConv.Width() <=(int)(m_pParam->s_dPitchConvReal)*3)
+		return;
+
+	char* img = (char*)(m_pParam->s_lpBuffer + m_pParam->s_RectConv.top * m_pParam->s_nFrameWidth + m_pParam->s_RectConv.left);
+	int		Honrizontal_Len =2;
+	int		Vertical_Len = 2;
+	int		MAX_WORD_PROCESS = 16;
+	int		SEARCH_WORD_PROCESS = 8 ;
+	if(m_pParam->s_RectConv.Width() <=0)
+		return; 
+	if(Honrizontal_Len > SEARCH_WORD_PROCESS)
+		return;
+	//lks 
+	short	Real_Cmp_Pitch[24],	Real_Cmp_Pitch2[24];
+	short	mulFactorR[24], mulFactorC[24];
+	short	mulFactorR2[24], mulFactorC2[24];
+	short Result_bit[8];
+	double	rPitch=0,rPitch2=0;
+	int		rpRatio=0,rpRatioC=0;
+	int		Cmp_Pitch=(int)(m_pParam->s_dPitchConvReal);
+	int     Cmp_Pitch2=Cmp_Pitch*2;
+	int		rpRatio2=0,rpRatioC2=0;
+	int		thre_i=0,i=0;
+	int     vertical_count=Vertical_Len;
+	int		horiz_count = m_pParam->s_nFrameWidth;
+	int		limit_vert_count = m_pParam->s_RectConv.Height()-1 ;
+	int     limit_horiz_count = m_pParam->s_RectConv.Width()/MAX_WORD_PROCESS+1;
+	int     backup_limit_horiz_count=limit_horiz_count;
+	int		Vwidth =m_pParam->s_nFrameWidth * vertical_count;
+	int		Short_Cmp_Pitch =Cmp_Pitch *2 ;
+	int		Short_Cmp_Pitch2 =Cmp_Pitch2 *2 ;
+	int		Jmp_Char_Count = PROCESSING_COUNT; // 6 pixel processing
+	int		Jmp_Short_Count =Jmp_Char_Count*2;
+	int		Jmp_Char_Count2 = Jmp_Char_Count*2; // 6 pixel processing
+	int		Jmp_Short_Count2 =Jmp_Short_Count*2;
+	int		short_limit_horiz_count =
+		    (m_pParam->s_RectConv.Width()-Cmp_Pitch2-Jmp_Char_Count)/Jmp_Char_Count ;
+	int temp=0;
+	int short_limit_horiz_right_count=0;
+	if(m_pParam->s_RectConv.Width() <=(int)(m_pParam->s_dPitchConvReal)*4)
+	{
+			 temp=Jmp_Char_Count-Cmp_Pitch%Jmp_Char_Count;
+		     short_limit_horiz_right_count =(temp+(Cmp_Pitch))/Jmp_Char_Count;
+	}
+	else
+	{
+		     temp=Jmp_Char_Count-Cmp_Pitch2%Jmp_Char_Count;
+			 short_limit_horiz_right_count =(temp+(Cmp_Pitch2))/Jmp_Char_Count;
+	}
+	
+	int		backup_short_limit_horiz_count = short_limit_horiz_count;
+	int		backup_short_limit_horiz_right_count = short_limit_horiz_right_count;
+
+	UCHAR	*src_add = (UCHAR*)img ;
+	short	*Temp_Result_Add;
+	Temp_Result_Add = new short[m_pParam->s_RectConv.Width()+Short_Cmp_Pitch2];
+	memset(Temp_Result_Add,0,sizeof(short) * (m_pParam->s_RectConv.Width()+Short_Cmp_Pitch2));
+	short Dynamic_thres[8];
+	UCHAR thres_suppress[16];
+	int Start_X = 0;
+	int Start_Y = 0;
+	int start_x = Start_X;
+	int start_x1=Start_X;
+	int p=m_pParam->s_RectConv.Width();
+	int start_right_x = m_pParam->s_RectConv.Width()-short_limit_horiz_right_count*Jmp_Char_Count;
+	int start_right_x1=Start_X;
+	int is_right_ins_mode =0;
+	int nMaxPixelNum = m_pParam->s_nFrameDefPixLimit;
+
+	short check_tmp1[8];
+	short check_tmp2[8];
+	short check_tmp3[8];
+	short check_tmp4[8];
+	short check_tmp5[8];    // yong debug 
+ 
+	for(int suppress_i=0;suppress_i<16;suppress_i++)
+		thres_suppress[suppress_i] = m_pParam->s_nThresholdSupress;
+
+	for( thre_i=0;thre_i<8;thre_i++)
+	{
+		Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		Result_bit[thre_i]=-1;
+	}
+	for(i=0;i<3;i++)
+	{
+		
+		Cmp_Pitch = (int)(m_pParam->s_dPitchConvReal+(i*0.2-0.2));	
+		rPitch = (m_pParam->s_dPitchConvReal+(i*0.2-0.2)) - Cmp_Pitch;
+		rpRatio = (int)(rPitch*8.0 + 0.5);		
+		rpRatioC = 8 - rpRatio;	
+		Cmp_Pitch2 = (int)(m_pParam->s_dPitchConvReal*2+(i*0.2-0.2));	
+		rPitch2 = (m_pParam->s_dPitchConvReal*2+(i*0.2-0.2)) - Cmp_Pitch2;	
+		rpRatio2 = (int)(rPitch2*8.0 + 0.5);		
+		rpRatioC2 = 8 - rpRatio2;	
+		for(thre_i=0;thre_i<8;thre_i++)
+		{
+			mulFactorR[thre_i+i*8] = rpRatio;
+			mulFactorC[thre_i+i*8] = rpRatioC;
+			mulFactorR2[thre_i+i*8] = rpRatio2;
+			mulFactorC2[thre_i+i*8] = rpRatioC2;
+			Real_Cmp_Pitch[thre_i+i*8]=Cmp_Pitch*2;
+			Real_Cmp_Pitch2[thre_i+i*8]=Cmp_Pitch2*2;
+		}
+	}
+	Dynamic_thres[6]=1000; //2 word pass next ins max :: 255*4(2cheng2)
+	Dynamic_thres[7]=1000;
+
+	__asm {
+		pushad
+
+		mov			esi, src_add
+		 movdqu		xmm6, Dynamic_thres
+
+UNPACK_LOOP:
+		mov			edi, Temp_Result_Add
+		mov			ebx, limit_horiz_count
+	    pxor		xmm0, xmm0
+		mov			ecx , esi
+
+HORIZONTAL_IMG_SUM :
+	
+		mov			eax , ecx
+		pxor		xmm3, xmm3
+		pxor		xmm4, xmm4
+		pxor		xmm7, xmm7
+
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+		add			eax , horiz_count
+		
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+
+		movdqu		[edi],xmm3
+		movdqu		[edi+16],xmm4
+
+		add			ecx ,16
+		add			edi ,32
+		dec			ebx
+		jnz			HORIZONTAL_IMG_SUM
+
+    
+INIT_BLANK_SPACE:
+		pxor		xmm0, xmm0  
+		mov			ebx,  start_x
+		mov			start_x1,ebx
+		mov			ebx,backup_short_limit_horiz_count
+		mov			short_limit_horiz_count,ebx
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+		mov			ecx, esi
+		mov			edi, Temp_Result_Add
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+		mov         is_right_ins_mode,0
+
+HORIZONTAL_INS_LEFT :
+		pxor		xmm0, xmm0
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		movdqu		xmm1, [edi]
+	
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+		movdqu      xmm7, Result_bit
+		mov         ebx,0
+
+      
+LEFT_RIGHT_SHAKE : 
+        cmp         ebx,48
+		je          DEFECT_SEARCH1
+		movdqu      xmm0, [Real_Cmp_Pitch+ebx]
+		pextrw		eax, xmm0, 0x00
+		movdqu		xmm5, [edi+eax]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, [mulFactorC +ebx] 
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, [mulFactorR +ebx]
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+	    movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+	
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+	//	movdqu      check_tmp1, xmm0	
+	//	pmullw      xmm0, xmm0
+	//	movdqu      check_tmp2, xmm0
+		pand 		xmm0, xmm7 
+	//	movdqu      check_tmp3, xmm0
+		movdqu		xmm7, xmm0
+		pmovmskb    edx,  xmm0
+		add         ebx,  16
+		cmp			edx,  0
+		jne			LEFT_RIGHT_SHAKE 	
+		jmp			THRES_PASS1 
+
+DEFECT_SEARCH1 :
+//		jmp         DEFECT_SEARCH2  // test 
+		mov         ebx,0
+LEFT_RIGHT_SHAKE2 : 
+        cmp         ebx,48
+		je          DEFECT_SEARCH2
+		movdqu      xmm0, [Real_Cmp_Pitch2+ebx]
+		pextrw		eax, xmm0, 0x00
+		movdqu		xmm5, [edi+eax]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, [mulFactorC2+ebx]
+		pmullw      xmm5, xmm0
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, [mulFactorR2+ebx]
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+	    movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+//		movdqu      check_tmp1, xmm3
+//		movdqu      check_tmp2, xmm5
+
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		pand 		xmm0, xmm7 
+		movdqu		xmm7, xmm0
+		pmovmskb    edx,  xmm0
+		add         ebx, 16
+		cmp			edx,  0
+		jne			LEFT_RIGHT_SHAKE2 	
+		jmp			THRES_PASS1 	
+
+THRES_PASS1 :
+
+		mov			eax ,Jmp_Short_Count
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_count
+		jnz			HORIZONTAL_INS_LEFT
+		jmp			HORIZONTAL_INS_RIGHT_START 
+
+HORIZONTAL_INS_RIGHT_START :
+
+		mov			edi, Temp_Result_Add
+		mov			ebx,  start_right_x
+		mov			start_x1,ebx
+		mov			eax ,start_x1
+		add         edi , eax
+		add			edi, eax
+		mov         eax,backup_short_limit_horiz_right_count
+		mov         short_limit_horiz_right_count,eax
+		mov         is_right_ins_mode,1
+
+//Right 
+HORIZONTAL_INS_RIGHT :
+//		jmp 		THRES_PASS1_RIGHT  // test
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch 
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		sub         edi, eax
+		movdqu		xmm1, [edi]   //[edi -eax]bu neng  directly sub 
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+		mov         ebx,0
+		movdqu      xmm7, Result_bit
+
+RIGHT_INS_LEFT_RIGHT_SHAKE : 
+
+        cmp         ebx,48
+		je          DEFECT_SEARCH1_RIGHT
+		movdqu      xmm0, [Real_Cmp_Pitch+ebx]
+		pextrw		eax, xmm0, 0x00
+		movdqu		xmm5, [edi+eax]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, [mulFactorC+ebx]
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, [mulFactorR+ebx]
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+	    movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		pand 		xmm0, xmm7 
+		movdqu		xmm7, xmm0
+		pmovmskb    edx,  xmm0
+		add         ebx, 16
+		cmp			edx,  0
+		jne         RIGHT_INS_LEFT_RIGHT_SHAKE 
+		mov			eax , Short_Cmp_Pitch 
+		sub         edi, eax
+		jmp 		THRES_PASS1_RIGHT 
+	 	
+
+DEFECT_SEARCH1_RIGHT :
+		pxor		xmm0, xmm0
+		mov			eax , Short_Cmp_Pitch 
+		sub         edi, eax
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		movdqu		xmm1, [edi]   //[edi -eax]bu neng  directly sub 
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+		mov         ebx,0
+
+RIGHT_INS_LEFT_RIGHT_SHAKE2 : 
+
+        cmp         ebx,48
+		je          DEFECT_SEARCH2
+		movdqu      xmm0, [Real_Cmp_Pitch2+ebx]
+		pextrw		eax, xmm0, 0x00
+		movdqu		xmm5, [edi+eax]
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, [mulFactorC2+ebx]
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, [mulFactorR2+ebx]
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+	    movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+
+		movdqu		xmm1, xmm5
+		psubw		xmm1, xmm3
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+;		pmullw      xmm0, xmm0
+		pand 		xmm0, xmm7 
+		movdqu		xmm7, xmm0
+		pmovmskb    edx,  xmm0
+		add         ebx, 16
+		cmp			edx,  0
+		jne			RIGHT_INS_LEFT_RIGHT_SHAKE2 	
+		
+THRES_PASS1_RIGHT :
+		mov			eax , Short_Cmp_Pitch2 
+		add         edi, eax
+		mov			eax ,Jmp_Short_Count
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_right_count
+		jnz			HORIZONTAL_INS_RIGHT
+
+
+NEXT_VERTICAL :
+
+		add			esi,horiz_count
+		inc			Start_Y
+		dec			limit_vert_count
+		jnz			UNPACK_LOOP
+		jmp			PROCESSING_END
+
+	
+DEFECT_SEARCH2 :
+		// 1锅掳 况靛
+	
+		mov			eax, start_x1
+		pextrw		edx, xmm0, 0x00
+		cmp			edx, 0
+		je			NODEFECT1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x00
+		pextrw		edx, xmm1, 0x00
+		cmp			ebx, edx
+		je			POSITIVE_POINT
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT1
+	
+POSITIVE_POINT : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+		
+NODEFECT1:	
+	// 2锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x01
+		cmp			edx, 0
+		je			NODEFECT2
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x01
+		pextrw		edx, xmm1, 0x01
+		cmp			ebx, edx
+		je			POSITIVE_POINT1
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT2
+	
+POSITIVE_POINT1 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+NODEFECT2:	
+	// 3锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x02
+		cmp			edx, 0
+		je			NODEFECT3
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x02
+		pextrw		edx, xmm1, 0x02
+		cmp			ebx, edx
+		je			POSITIVE_POINT2
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT3
+	
+POSITIVE_POINT2 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT3:	
+	// 4锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x03
+		cmp			edx, 0
+		je			NODEFECT4
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x03
+		pextrw		edx, xmm1, 0x03
+		cmp			ebx, edx
+		je			POSITIVE_POINT3
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT4
+	
+POSITIVE_POINT3 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT4:	
+	// 5锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x04
+		cmp			edx, 0
+		je			NODEFECT5
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x04
+		pextrw		edx, xmm1, 0x04
+		cmp			ebx, edx
+		je			POSITIVE_POINT4
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT5
+	
+POSITIVE_POINT4 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT5:	
+	// 6锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x05
+		cmp			edx, 0
+		je			THRES_PASS
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x05
+		pextrw		edx, xmm1, 0x05
+		cmp			ebx, edx
+		je			POSITIVE_POINT5
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+THRES_PASS :
+		mov         edx,is_right_ins_mode
+		cmp         edx,1
+		je          THRES_PASS1_RIGHT
+		jmp			THRES_PASS1
+	
+POSITIVE_POINT5 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+		mov         edx,is_right_ins_mode
+		cmp         edx,1
+		je          THRES_PASS1_RIGHT
+		jmp			THRES_PASS1
+
+PROCESSING_END :
+		popad
+		emms
+	}
+	delete[] Temp_Result_Add;
+	return m_nDefectNum;
+
+}
+
+void CConvInt1::VConvolution_SEE3_6()
+{
+/*
+   reverse de hua huan add jizhu.
+*/
+	
+ if(m_pParam->s_RectConv.Height() <=(int)(m_pParam->s_dPitchConvReal)*4)
+		return;
+
+	char* img = (char*)(m_pParam->s_lpBuffer + m_pParam->s_RectConv.top * m_pParam->s_nFrameWidth + m_pParam->s_RectConv.left);
+	if(m_pParam->s_RectConv.Width() <=0)
+		return; 
+	//lks 
+#define 		PROCESSING_COUNT 7
+#define 		MAX_THRESHOLD 1000 
+	short	Real_Cmp_Pitch[24],	Real_Cmp_Pitch2[24];
+	short	mulFactorR[24], mulFactorC[24];
+	short	mulFactorR2[24], mulFactorC2[24];
+	double	rPitch=0,rPitch2=0;
+	int		rpRatio=0,rpRatioC=0;
+	int		Cmp_Pitch=(int)(m_pParam->s_dPitchConvReal-0.2);	
+	int     Cmp_Pitch2=(int)(m_pParam->s_dPitchConvReal*2-0.2);
+	int		rpRatio2=0,rpRatioC2=0;
+	int		thre_i=0,i=0;
+
+	int		horiz_count = m_pParam->s_nFrameWidth;
+	int		limit_vert_count = m_pParam->s_RectConv.Height()-1 ;
+	int		limit_vert_count_forward =limit_vert_count-Cmp_Pitch2  ;
+	int		limit_vert_count_backward = Cmp_Pitch2 ; //2*2 end 
+	int		Jmp_Char_Count = PROCESSING_COUNT; // 7 pixel processing
+	int		char_limit_horiz_count =
+		    m_pParam->s_RectConv.Width()/Jmp_Char_Count ;
+	int		Remainder_count =
+		    m_pParam->s_RectConv.Width()%Jmp_Char_Count ;
+	int		temp=0;
+	int     Inspection_End=1;
+	int		backup_char_limit_horiz_count = char_limit_horiz_count;
+	int     backup_Remainder_count= Remainder_count;
+
+	UCHAR	*src_add = (UCHAR*)img ;
+	UCHAR   *dest_add =(UCHAR*)img + Cmp_Pitch*horiz_count;
+	UCHAR   *dest_add2 =(UCHAR*)img + Cmp_Pitch2*horiz_count;
+	UCHAR   *src_add_backward= (UCHAR*)img +limit_vert_count_forward*horiz_count- Cmp_Pitch*horiz_count;
+	UCHAR   *dest_add_minus =(UCHAR*)src_add_backward + Cmp_Pitch*horiz_count;  //yuanlai src 
+	UCHAR   *dest_add2_minus =(UCHAR*)dest_add_minus - Cmp_Pitch2*horiz_count; 
+
+	UCHAR   *dest_add_backup =dest_add;
+	UCHAR   *dest_add2_backup =dest_add2;
+	UCHAR   *src_add_backup=src_add;
+	short Dynamic_thres[8];
+	short Remainder_Dynamic_thres[8];
+	short Result_bit[8],backup_Result_bit[8];
+	UCHAR thres_suppress[16];
+	int Start_X = 0;
+	int Start_Y = 0;
+	int start_x = Start_X;
+	int start_x1=Start_X;
+	int nMaxPixelNum = m_pParam->s_nFrameDefPixLimit;
+	int is_reverse=0; 
+	int temp_pitch=0,temp_pitch2=0;
+
+	UCHAR check_tmp11[16];
+	short check_tmp1[8];
+	short check_tmp2[8];
+	short check_tmp3[8];
+	short check_tmp4[8];
+	short check_tmp5[8];    // yong debug 
+ 
+	for(int suppress_i=0;suppress_i<16;suppress_i++)
+		thres_suppress[suppress_i] = m_pParam->s_nThresholdSupress;
+
+	for(i=0;i<3;i++)
+	{
+		
+		temp_pitch = (int)(m_pParam->s_dPitchConvReal+(i*0.2-0.2));	
+		rPitch = (m_pParam->s_dPitchConvReal+(i*0.2-0.2)) - temp_pitch;
+		rpRatio = (int)(rPitch*8.0 + 0.5);		
+		rpRatioC = 8 - rpRatio;	
+		temp_pitch2 = (int)(m_pParam->s_dPitchConvReal*2+(i*0.2-0.2));	
+		rPitch2 = (m_pParam->s_dPitchConvReal*2+(i*0.2-0.2)) - temp_pitch2;	
+		rpRatio2 = (int)(rPitch2*8.0 + 0.5);		
+		rpRatioC2 = 8 - rpRatio2;	
+		for(thre_i=0;thre_i<8;thre_i++)
+		{
+			mulFactorR[thre_i+i*8] = rpRatio;
+			mulFactorC[thre_i+i*8] = rpRatioC;
+			mulFactorR2[thre_i+i*8] = rpRatio2;
+			mulFactorC2[thre_i+i*8] = rpRatioC2;
+			Real_Cmp_Pitch[thre_i+i*8]=(temp_pitch-Cmp_Pitch);
+			Real_Cmp_Pitch2[thre_i+i*8]=(temp_pitch2-Cmp_Pitch2);
+			
+		}
+	}
+	for(thre_i=0;thre_i<8;thre_i++)
+	{
+		Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		Remainder_Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		Result_bit[thre_i]=-1;
+		backup_Result_bit[thre_i]=-1;
+	}
+	Dynamic_thres[7]=MAX_THRESHOLD; //1 word pass next ins max :: 255*4(2cheng2)
+	for(thre_i=0;thre_i<8-Remainder_count;thre_i++)
+	{
+		Remainder_Dynamic_thres[PROCESSING_COUNT-thre_i]=MAX_THRESHOLD;
+
+	}
+
+	__asm {
+		pushad
+
+UNPACK_LOOP:
+    
+		mov			ebx,  start_x
+		mov			start_x1,ebx
+		mov			ebx,backup_char_limit_horiz_count
+		mov			char_limit_horiz_count,ebx
+		movdqu      xmm6,Dynamic_thres
+		mov         edx, backup_Remainder_count
+		mov         Remainder_count,edx
+		
+HORIZONTAL_INS_LEFT :
+		mov			edi, src_add
+		pxor		xmm0, xmm0
+		pxor		xmm3, xmm3
+		Pxor        xmm4, xmm4
+		movdqu		xmm1, [edi]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor        xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		paddw		xmm3, xmm2
+		mov			eax , horiz_count
+//		add			edi , eax
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor        xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		paddw		xmm3, xmm2
+		movdqu		xmm4, xmm3
+		psrldq		xmm4, 2
+		paddw		xmm3, xmm4
+		mov         ebx,0
+		mov			edi , dest_add 
+		
+LEFT_RIGHT_SHAKE : 
+        cmp         ebx,48
+		je          DEFECT_SEARCH1
+		movdqu      xmm0, [Real_Cmp_Pitch+ebx]
+		pextrw		eax, xmm0, 0x00
+		pxor		xmm4, xmm4
+		imul		eax, horiz_count
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor        xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+	//	movdqu		check_tmp1,xmm2
+		movdqu		xmm0, [mulFactorC+ebx]
+		pmullw      xmm2, xmm0
+		paddw		xmm4, xmm2
+		mov			edx , horiz_count
+		add         eax , edx 
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm7, xmm2 
+	//	movdqu		check_tmp1,xmm2
+		movdqu		xmm0, [mulFactorR+ebx]
+	    pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		movdqu		xmm0, [mulFactorC +ebx]
+
+		pmullw		xmm7, xmm0
+		paddw       xmm4, xmm7
+		add         eax,  edx 
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+	//	movdqu		check_tmp1,xmm2
+		movdqu		xmm7, xmm2 
+		movdqu		xmm0, [mulFactorR+ebx]
+	//	movdqu		check_tmp3,xmm0
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+	    movdqu		xmm5, xmm4
+		psrldq		xmm4, 2		//1 num rpa
+		paddw		xmm5, xmm4 
+		psraw       xmm5, 3 
+//		movdqu		check_tmp3,xmm5
+//		movdqu		check_tmp4,xmm3
+
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+		pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	
+		pcmpgtw     xmm0, xmm6
+		movdqu      xmm7, Result_bit
+	//	movdqu      check_tmp1,xmm0
+		pand 		xmm0, xmm7 
+		movdqu      Result_bit,xmm0 
+		pmovmskb    edx,  xmm0
+		add         ebx, 16
+		cmp			edx,  0
+		jne			LEFT_RIGHT_SHAKE 	
+		jmp			THRES_PASS1 	
+
+THRES_PASS1 :
+		
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		movdqu      xmm0, backup_Result_bit
+		movdqu      Result_bit,xmm0
+		mov         edi, src_add
+		add         edi, eax
+		mov         src_add,edi 
+		mov         edi, dest_add
+		add         edi, eax
+		mov         dest_add,edi 
+		mov         edi, dest_add2
+		add         edi, eax
+		mov         dest_add2,edi 
+		dec			char_limit_horiz_count
+		jnz			HORIZONTAL_INS_LEFT
+		mov         eax, Remainder_count
+		cmp			eax,  0
+		je			NEXT_VERTICAL
+		mov			Remainder_count,0
+		mov         char_limit_horiz_count,1
+		movdqu      xmm6,Remainder_Dynamic_thres
+		jmp			HORIZONTAL_INS_LEFT 	
+			
+			
+NEXT_VERTICAL :
+		movdqu      xmm0, backup_Result_bit
+		movdqu      Result_bit,xmm0
+		mov         eax,horiz_count
+		add         src_add_backup,eax
+		mov			edi,src_add_backup
+		mov			src_add,edi
+		add         dest_add_backup,eax
+		mov         edi,dest_add_backup
+		mov         dest_add,edi
+		add         dest_add2_backup,eax
+		mov			edi,dest_add2_backup
+		mov         dest_add2,edi
+		inc			Start_Y
+		dec			limit_vert_count_forward
+		jnz			UNPACK_LOOP
+		cmp			Inspection_End,0
+		je			PROCESSING_END
+		mov         eax,limit_vert_count_backward
+		mov         limit_vert_count_forward,eax
+		mov         edi,src_add_backward
+		mov         src_add,edi
+		mov			src_add_backup,edi
+		mov         edi,dest_add_minus
+		mov         dest_add,edi
+		mov         dest_add_backup,edi
+		mov         edi,dest_add2_minus
+		mov         dest_add2,edi
+		mov			dest_add2_backup,edi
+		mov			Inspection_End,0
+		mov         is_reverse,1 
+		jmp         UNPACK_LOOP
+
+DEFECT_SEARCH1 :
+//		jmp          DEFECT_SEARCH2  //test
+		mov			edx, is_reverse 
+		cmp         edx, 1
+		je			DEFECT_SEARCH1_REVERSE
+		mov         ebx,0
+		
+LEFT_RIGHT_SHAKE2 : 
+        cmp         ebx,48
+		je          DEFECT_SEARCH2
+		movdqu      xmm0, [Real_Cmp_Pitch2+ebx]
+		pextrw		eax, xmm0, 0x00
+
+		mov			edi , dest_add2 
+		pxor		xmm4, xmm4
+		imul		eax , horiz_count
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm0, [mulFactorC2+ebx]
+		pmullw      xmm2, xmm0
+		paddw		xmm4, xmm2
+		mov			edx , horiz_count
+		add         eax , edx 
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm1, xmm2
+		movdqu		xmm0, [mulFactorR2+ebx]
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+        movdqu		xmm0, [mulFactorC2+ebx]
+		pmullw      xmm1, xmm0
+		paddw       xmm4, xmm1
+		add         eax,  edx 
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm0, [mulFactorR2+ebx]
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		movdqu		xmm5,xmm4
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5, xmm4
+		psraw       xmm5, 3 
+//		movdqu		check_tmp5,xmm5
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		movdqu      xmm7, Result_bit
+		pand 		xmm0, xmm7 
+		movdqu      Result_bit,xmm0 
+		pmovmskb    edx,  xmm0
+		add         ebx, 16
+		cmp			edx,  0
+		jne			LEFT_RIGHT_SHAKE2 	
+		jmp			THRES_PASS1 	
+
+
+DEFECT_SEARCH1_REVERSE :
+		
+		pxor		xmm0, xmm0
+		pxor		xmm3, xmm3
+		Pxor        xmm4, xmm4
+		mov         ebx,0
+		
+LEFT_RIGHT_SHAKE_REVERSE : 
+		cmp         ebx,48
+		je          DEFECT_SEARCH2
+		mov			edi,  dest_add2
+		pxor        xmm3, xmm3 
+		movdqu		xmm1, [edi]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor        xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+//		movdqu      check_tmp1,xmm2
+		paddw		xmm3, xmm2
+		mov			eax , horiz_count
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor        xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+//		movdqu      check_tmp1,xmm2
+		paddw		xmm3, xmm2
+		movdqu		xmm4, xmm3
+		psrldq		xmm4, 2
+		paddw		xmm3, xmm4
+//		movdqu      check_tmp3,xmm3
+      
+		movdqu      xmm0, [Real_Cmp_Pitch2+ebx]
+		pextrw		eax, xmm0, 0x00
+		mov			edi , dest_add  //reverse ~ dest_add -> src 
+		pxor		xmm4, xmm4
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+//		movdqu      check_tmp1,xmm2
+		movdqu		xmm0, [mulFactorC2+ebx]
+		pmullw      xmm2, xmm0
+		paddw		xmm4, xmm2
+		mov			edx , horiz_count
+		add         eax , edx 
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+//		movdqu		check_tmp1,xmm2
+		movdqu		xmm1, xmm2
+		movdqu		xmm0, [mulFactorR2+ebx]
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		movdqu		xmm0, [mulFactorC2+ebx]
+		pmullw      xmm1, xmm0
+		paddw       xmm4, xmm1
+		add         eax,  edx 
+		movdqu		xmm1, [edi+eax]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+//		movdqu      check_tmp1,xmm2
+		movdqu		xmm0, [mulFactorR2+ebx]
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		movdqu		xmm5, xmm4
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5, xmm4
+		psraw       xmm5, 3 
+//		movdqu		check_tmp2, xmm5
+		movdqu		xmm2, xmm5
+		movdqu		xmm5, xmm3
+		movdqu		xmm3, xmm2 
+		movdqu		xmm1, xmm3
+
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+		pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+		pcmpgtw     xmm0, xmm6
+		movdqu      xmm7, Result_bit
+		pand 		xmm0, xmm7 
+		movdqu      Result_bit,xmm0 
+		pmovmskb    edx,  xmm0
+		add			ebx, 16
+		cmp			edx,  0
+		jne			LEFT_RIGHT_SHAKE_REVERSE 	
+		jmp			THRES_PASS1 
+	
+DEFECT_SEARCH2 :
+		// 1锅掳 况靛
+	
+		mov			eax, start_x1
+		pextrw		edx, xmm0, 0x00
+		cmp			edx, 0
+		je			NODEFECT1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x00
+		pextrw		edx, xmm1, 0x00
+		cmp			ebx, edx
+		je			POSITIVE_POINT
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT1
+	
+POSITIVE_POINT : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+		
+NODEFECT1:	
+	// 2锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x01
+		cmp			edx, 0
+		je			NODEFECT2
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x01
+		pextrw		edx, xmm1, 0x01
+		cmp			ebx, edx
+		je			POSITIVE_POINT1
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT2
+	
+POSITIVE_POINT1 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+NODEFECT2:	
+	// 3锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x02
+		cmp			edx, 0
+		je			NODEFECT3
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x02
+		pextrw		edx, xmm1, 0x02
+		cmp			ebx, edx
+		je			POSITIVE_POINT2
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT3
+	
+POSITIVE_POINT2 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT3:	
+	// 4锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x03
+		cmp			edx, 0
+		je			NODEFECT4
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x03
+		pextrw		edx, xmm1, 0x03
+		cmp			ebx, edx
+		je			POSITIVE_POINT3
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT4
+	
+POSITIVE_POINT3 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT4:	
+	// 5锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x04
+		cmp			edx, 0
+		je			NODEFECT5
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x04
+		pextrw		edx, xmm1, 0x04
+		cmp			ebx, edx
+		je			POSITIVE_POINT4
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT5
+	
+POSITIVE_POINT4 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT5:	
+			// 6锅掳 况靛
+			inc			eax
+			pextrw		edx, xmm0, 0x05
+			cmp			edx, 0
+			je			NODEFECT6
+			
+			mov			edx, nMaxPixelNum
+			cmp			m_nDefectNum, edx
+			je			PROCESSING_END
+			
+			mov			edx, m_nDefectNum
+			mov			ebx,Start_Y
+			mov			m_nDefectPointX[4*edx], eax
+			mov			m_nDefectPointY[4*edx], ebx
+			pextrw		ebx, xmm2, 0x05
+			pextrw		edx, xmm1, 0x05
+			cmp			ebx, edx
+			je			POSITIVE_POINT5
+			mov			ebx, m_nDefectNum
+			mov			m_sDefectType[2*ebx], 0
+			mov			m_nDefectValue[4*ebx], edx
+			inc			m_nDefectNum
+			jmp			NODEFECT6
+			
+POSITIVE_POINT5 : 
+			mov			edx, m_nDefectNum
+			mov			m_sDefectType[2*edx], 1
+			mov			m_nDefectValue[4*edx], ebx
+			inc			m_nDefectNum
+
+
+NODEFECT6:	
+	// 7锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x06
+		cmp			edx, 0
+		je			THRES_PASS1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x06
+		pextrw		edx, xmm1, 0x06
+		cmp			ebx, edx
+		je			POSITIVE_POINT6
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			THRES_PASS1
+	
+POSITIVE_POINT6 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+		jmp			THRES_PASS1
+
+PROCESSING_END :
+		popad
+		emms
+	}
+}
+
+int CConvInt1::HVConvolution_SEE3_6()
+{
+
+	#define PROCESSING_COUNT 6
+	int		MAX_WORD_PROCESS = 16;
+	if(m_pParam->s_RectConv.Width() <=(int)(m_pParam->s_dPitchConvReal)+MAX_WORD_PROCESS)
+		return;
+	if(m_pParam->s_RectConv.Height() <=(int)(m_pParam->s_dPitchScanReal)+1)
+		return;
+
+	char* img = (char*)(m_pParam->s_lpBuffer + m_pParam->s_RectConv.top * m_pParam->s_nFrameWidth + m_pParam->s_RectConv.left);
+	int		Honrizontal_Len =2;
+	int		Vertical_Len = 2;
+	int		SEARCH_WORD_PROCESS = 8 ;
+	//lks 
+	short	Real_Cmp_Pitch[24],	VReal_Cmp_Pitch[24];
+	short	mulFactorR[24], mulFactorC[24];
+	short	VmulFactorR[24], VmulFactorC[24];
+	short	Result_bit[8],Backup_Result_bit[8];
+	double	rPitch=0,VrPitch=0;
+	int		rpRatio=0,rpRatioC=0;
+	int		VrpRatio=0,VrpRatioC=0;
+	int		Cmp_Pitch=(int)(m_pParam->s_dPitchConvReal);
+	int     V_Cmp_Pitch=(int)(m_pParam->s_dPitchScanReal);
+	int		thre_i=0,i=0;
+	int     vertical_count=Vertical_Len;
+	int		horiz_count = m_pParam->s_nFrameWidth;
+	int		limit_vert_count = m_pParam->s_RectConv.Height()-V_Cmp_Pitch ;
+	int     limit_horiz_count = m_pParam->s_RectConv.Width()/MAX_WORD_PROCESS+1;
+	int     backup_limit_horiz_count=limit_horiz_count;
+	int		Vwidth =m_pParam->s_nFrameWidth * vertical_count;
+	int		Short_Cmp_Pitch =Cmp_Pitch *2 ;
+	int		Jmp_Char_Count = PROCESSING_COUNT; // 6 pixel processing
+	int		Jmp_Short_Count =Jmp_Char_Count*2;
+	int		short_limit_horiz_count =
+		    (m_pParam->s_RectConv.Width()-Cmp_Pitch-Jmp_Char_Count)/Jmp_Char_Count ;
+	int		 limit_bottom_vertical_count =V_Cmp_Pitch;
+	if(m_pParam->s_RectConv.Height() <=(int)(m_pParam->s_dPitchScanReal)*2+1)
+		limit_bottom_vertical_count=0;
+	int temp=0;
+	int short_limit_horiz_right_count=0;
+	int Is_Vertical_Backward=0;
+	int Is_Horizontal_Backward=0;
+	temp=Jmp_Char_Count-Cmp_Pitch%Jmp_Char_Count;
+	if(m_pParam->s_RectConv.Width() <=(int)(m_pParam->s_dPitchConvReal)*2+MAX_WORD_PROCESS)
+		short_limit_horiz_right_count=0;
+	else
+		short_limit_horiz_right_count =(temp+(Cmp_Pitch))/Jmp_Char_Count;
+
+	int		backup_short_limit_horiz_count = short_limit_horiz_count;
+	int		backup_short_limit_horiz_right_count = short_limit_horiz_right_count;
+
+	UCHAR	*src_add = (UCHAR*)img ;
+	short	*Temp_Result_Add;
+	Temp_Result_Add = new short[m_pParam->s_RectConv.Width()+Short_Cmp_Pitch];
+	memset(Temp_Result_Add,0,sizeof(short) * (m_pParam->s_RectConv.Width()+Short_Cmp_Pitch));
+	short Dynamic_thres[8];
+	UCHAR thres_suppress[16];
+	int Start_X = 0;
+	int Start_Y = 0;
+	int start_x = Start_X;
+	int start_x1=Start_X;
+	int p=m_pParam->s_RectConv.Width();
+	int nMaxPixelNum = m_pParam->s_nFrameDefPixLimit;
+
+/*	short check_tmp1[8];
+	short check_tmp2[8];
+	short check_tmp3[8];
+	short check_tmp4[8];
+	short check_tmp5[8]; */   // yong debug 
+ 
+	for(int suppress_i=0;suppress_i<16;suppress_i++)
+		thres_suppress[suppress_i] = m_pParam->s_nThresholdSupress;
+
+	for( thre_i=0;thre_i<8;thre_i++)
+	{
+		Dynamic_thres[thre_i] = m_pParam->s_nThreshold;
+		Result_bit[thre_i]=-1;
+		Backup_Result_bit[thre_i]=-1;
+	}
+	for(i=0;i<3;i++)
+	{
+		
+		Cmp_Pitch = (int)(m_pParam->s_dPitchConvReal+(i*0.2-0.2));	
+		rPitch = (m_pParam->s_dPitchConvReal+(i*0.2-0.2)) - Cmp_Pitch;
+		rpRatio = (int)(rPitch*8.0 + 0.5);		
+		rpRatioC = 8 - rpRatio;	
+		V_Cmp_Pitch = (int)(m_pParam->s_dPitchScanReal+(i*0.2-0.2));	
+		VrPitch = (m_pParam->s_dPitchScanReal+(i*0.2-0.2)) - V_Cmp_Pitch;	
+		VrpRatio = (int)(VrPitch*8.0 + 0.5);		
+		VrpRatioC = 8 - VrpRatio;	
+		for(thre_i=0;thre_i<8;thre_i++)
+		{
+			mulFactorR[thre_i+i*8] = rpRatio;
+			mulFactorC[thre_i+i*8] = rpRatioC;
+			VmulFactorR[thre_i+i*8] = VrpRatio;
+			VmulFactorC[thre_i+i*8] = VrpRatioC;
+			Real_Cmp_Pitch[thre_i+i*8]=Cmp_Pitch*2;	//short type
+			VReal_Cmp_Pitch[thre_i+i*8]=V_Cmp_Pitch; 
+		}
+	}
+	Dynamic_thres[6]=1000; //2 word pass next ins max :: 255*4(2cheng2)
+	Dynamic_thres[7]=1000;
+
+	__asm {
+		pushad
+
+		mov			esi, src_add
+		movdqu		xmm6, Dynamic_thres
+
+UNPACK_LOOP:
+		mov			edi, Temp_Result_Add
+		mov			ebx, limit_horiz_count
+	    pxor		xmm0, xmm0
+		mov			ecx , esi
+
+HORIZONTAL_IMG_SUM :
+	
+		mov			eax , ecx
+		pxor		xmm3, xmm3
+		pxor		xmm4, xmm4
+		pxor		xmm7, xmm7
+
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+		add			eax , horiz_count
+		
+		movdqu		xmm1, [eax]	
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		movdqu	    xmm1, xmm2
+		punpcklbw	xmm1, xmm0				// unpack lower-order bytes to words
+		punpckhbw	xmm2, xmm0				// unpack higher-order bytes to words
+	
+		paddw		xmm3, xmm1
+		paddw		xmm4, xmm2  
+
+		movdqu		[edi],xmm3
+		movdqu		[edi+16],xmm4
+
+		add			ecx ,16
+		add			edi ,32
+		dec			ebx
+		jnz			HORIZONTAL_IMG_SUM
+
+    
+INIT_BLANK_SPACE:
+		pxor		xmm0, xmm0  
+		mov			ebx,  start_x
+		mov			start_x1,ebx
+		mov			ebx,backup_short_limit_horiz_count
+		mov			short_limit_horiz_count,ebx
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+		mov			ecx, esi
+		mov			edi, Temp_Result_Add
+		mov			edx,backup_limit_horiz_count
+		mov		    limit_horiz_count,edx
+
+HORIZONTAL_INS_LEFT :
+		pxor		xmm0, xmm0
+		pxor		xmm3,xmm3
+		Pxor        xmm4,xmm4
+		movdqu		xmm1, [edi]
+	
+		paddw		xmm3, xmm1
+		psrldq		xmm1, 2
+		paddw		xmm3, xmm1
+		movdqu      xmm7, Result_bit
+		mov         ebx,0
+
+      
+LEFT_RIGHT_SHAKE : 
+        cmp         ebx,48
+		je          DEFECT_SEARCH1
+		movdqu      xmm0, [Real_Cmp_Pitch+ebx]
+		pextrw		eax, xmm0, 0x00
+		cmp         Is_Horizontal_Backward,1 
+		jne         HORIZONTAL_FORWARD
+
+HORIZONTAL_BACKWARD :
+		sub			edi,eax 
+		movdqu		xmm5,[edi]
+		add         edi,eax 
+        jmp			HORIZONTAL_CALC
+
+HORIZONTAL_FORWARD :
+		movdqu		xmm5, [edi+eax]
+
+HORIZONTAL_CALC :
+
+		movdqu		xmm4, xmm5
+		movdqu		xmm0, [mulFactorC +ebx] 
+		pmullw      xmm5, xmm0
+	
+		psrldq		xmm4, 2		//1 num rpa
+	
+		movdqu		xmm0, [mulFactorR +ebx]
+	    pmullw      xmm4, xmm0
+		paddw       xmm5,xmm4
+	    movdqu		xmm4,xmm5
+		psrldq		xmm4, 2		//1 num rpa
+		paddw       xmm5,xmm4
+		psraw		xmm5, 3
+	
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+	    pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+	 	pcmpgtw     xmm0, xmm6
+		pand 		xmm0, xmm7 
+	
+		movdqu		xmm7, xmm0
+		pmovmskb    edx,  xmm0
+		add         ebx,  16
+		cmp			edx,  0
+		jne			LEFT_RIGHT_SHAKE 	
+		jmp			THRES_PASS1 
+
+DEFECT_SEARCH1 :
+		movdqu	    Result_bit,xmm7	
+		mov         ebx,0
+	
+
+LEFT_RIGHT_SHAKE2 : 
+        cmp         ebx,48
+		je          DEFECT_SEARCH2
+		mov			ecx , esi 
+		add			ecx , start_x1
+		movdqu      xmm0, [VReal_Cmp_Pitch+ebx]
+		pextrw		eax, xmm0, 0x00
+		pxor		xmm4, xmm4
+		cmp         Is_Vertical_Backward,1 
+		jne         VERTICAL_FORWARD
+
+VERTICAL_BACKWARD :
+		imul		eax,horiz_count 
+		sub			ecx,eax 
+		movdqu		xmm1,[ecx]
+        jmp			VERTICAL_CALC
+
+VERTICAL_FORWARD :
+		imul		eax ,horiz_count
+		add			ecx ,eax
+		movdqu		xmm1, [ecx]
+
+VERTICAL_CALC :
+
+		movdqu		xmm5, [thres_suppress]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor        xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm0, [VmulFactorC+ebx]
+		pmullw      xmm2, xmm0
+		paddw		xmm4, xmm2
+		add			ecx , horiz_count
+		movdqu		xmm1, [ecx]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm7, xmm2 
+		movdqu		xmm0, [VmulFactorR+ebx]
+	    pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+		movdqu		xmm0, [VmulFactorC +ebx]
+
+		pmullw		xmm7, xmm0
+		paddw       xmm4, xmm7
+		add         ecx,  horiz_count 
+		movdqu		xmm1, [ecx]
+		movdqu		xmm2, xmm1
+		psubusb     xmm1, xmm5
+		psubusb     xmm2, xmm1
+		pxor		xmm0, xmm0
+		punpcklbw	xmm2, xmm0				// unpack lower-order bytes to words
+		movdqu		xmm7, xmm2 
+		movdqu		xmm0, [VmulFactorR+ebx]
+		pmullw      xmm2, xmm0
+		paddw       xmm4, xmm2
+	    movdqu		xmm5, xmm4
+		psrldq		xmm4, 2		//1 num rpa
+		paddw		xmm5, xmm4 
+		psraw       xmm5, 3 
+
+		movdqu		xmm1, xmm3
+		psubw		xmm1, xmm5
+		pxor		xmm2, xmm2
+		psubw		xmm2, xmm1
+		pmaxsw		xmm2, xmm1
+		movdqu		xmm0, xmm2
+		pcmpgtw     xmm0, xmm6
+	    movdqu		xmm7, Result_bit
+		pand 		xmm0, xmm7 
+		movdqu		xmm7, xmm0
+		movdqu		Result_bit,xmm7
+		pmovmskb    edx,  xmm0
+		add         ebx, 16
+		cmp			edx,  0
+		jne			LEFT_RIGHT_SHAKE2 	
+		jmp			THRES_PASS1 	
+
+THRES_PASS1 :
+		movdqu		xmm0,Backup_Result_bit
+		movdqu		Result_bit,xmm0
+		mov			eax ,Jmp_Short_Count
+		add			edi, eax
+		mov			eax ,Jmp_Char_Count
+		mov			edx, start_x1
+		add			edx, eax
+		mov			start_x1 ,edx
+		dec			short_limit_horiz_count
+		jnz			HORIZONTAL_INS_LEFT
+		cmp			short_limit_horiz_right_count,0
+		je			NEXT_VERTICAL
+		cmp         Is_Horizontal_Backward,1
+		je			NEXT_VERTICAL
+		mov         eax,short_limit_horiz_right_count 
+		mov         short_limit_horiz_count,eax 
+		mov			Is_Horizontal_Backward,1
+		jmp			HORIZONTAL_INS_LEFT 
+
+NEXT_VERTICAL :
+
+		mov			Is_Horizontal_Backward,0
+		add			esi,horiz_count
+		inc			Start_Y
+		dec			limit_vert_count
+		jnz			UNPACK_LOOP
+		cmp			limit_bottom_vertical_count,0
+		je			PROCESSING_END       
+		cmp         Is_Vertical_Backward,1
+		je			PROCESSING_END
+		mov         eax,limit_bottom_vertical_count 
+		mov         limit_vert_count,eax 
+		mov			Is_Vertical_Backward,1
+		jmp			UNPACK_LOOP 
+
+	
+DEFECT_SEARCH2 :
+		// 1锅掳 况靛
+	
+		mov			eax, start_x1
+		pextrw		edx, xmm0, 0x00
+		cmp			edx, 0
+		je			NODEFECT1
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x00
+		pextrw		edx, xmm1, 0x00
+		cmp			ebx, edx
+		je			POSITIVE_POINT
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT1
+	
+POSITIVE_POINT : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+		
+NODEFECT1:	
+	// 2锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x01
+		cmp			edx, 0
+		je			NODEFECT2
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x01
+		pextrw		edx, xmm1, 0x01
+		cmp			ebx, edx
+		je			POSITIVE_POINT1
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT2
+	
+POSITIVE_POINT1 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+	
+NODEFECT2:	
+	// 3锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x02
+		cmp			edx, 0
+		je			NODEFECT3
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x02
+		pextrw		edx, xmm1, 0x02
+		cmp			ebx, edx
+		je			POSITIVE_POINT2
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT3
+	
+POSITIVE_POINT2 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT3:	
+	// 4锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x03
+		cmp			edx, 0
+		je			NODEFECT4
+	
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x03
+		pextrw		edx, xmm1, 0x03
+		cmp			ebx, edx
+		je			POSITIVE_POINT3
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT4
+	
+POSITIVE_POINT3 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+
+NODEFECT4:	
+	// 5锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x04
+		cmp			edx, 0
+		je			NODEFECT5
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x04
+		pextrw		edx, xmm1, 0x04
+		cmp			ebx, edx
+		je			POSITIVE_POINT4
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+		jmp			NODEFECT5
+	
+POSITIVE_POINT4 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+
+NODEFECT5:	
+	// 6锅掳 况靛
+		inc			eax
+		pextrw		edx, xmm0, 0x05
+		cmp			edx, 0
+		je			THRES_PASS
+		
+		mov			edx, nMaxPixelNum
+		cmp			m_nDefectNum, edx
+		je			PROCESSING_END
+	
+		mov			edx, m_nDefectNum
+		mov			ebx,Start_Y
+		mov			m_nDefectPointX[4*edx], eax
+		mov			m_nDefectPointY[4*edx], ebx
+		pextrw		ebx, xmm2, 0x05
+		pextrw		edx, xmm1, 0x05
+		cmp			ebx, edx
+		je			POSITIVE_POINT5
+		mov			ebx, m_nDefectNum
+		mov			m_sDefectType[2*ebx], 0
+		mov			m_nDefectValue[4*ebx], edx
+		inc			m_nDefectNum
+
+THRES_PASS :
+	
+		jmp			THRES_PASS1
+	
+POSITIVE_POINT5 : 
+		mov			edx, m_nDefectNum
+		mov			m_sDefectType[2*edx], 1
+		mov			m_nDefectValue[4*edx], ebx
+		inc			m_nDefectNum
+		jmp			THRES_PASS1
+
+PROCESSING_END :
+		popad
+		emms
+	}
+	delete[] Temp_Result_Add;
+	return m_nDefectNum;
+}
diff --git a/Common_Class/SISBuffer/CopyBuffer.cpp b/Common_Class/SISBuffer/CopyBuffer.cpp
new file mode 100644
index 0000000..d5cbbcb
--- /dev/null
+++ b/Common_Class/SISBuffer/CopyBuffer.cpp
@@ -0,0 +1,59 @@
+
+// CopyBuffer.cpp: implementation of the CCopyBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "InspectionBuffer.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+
+BOOL CCopyBuffer::FillBuffer(CSISBuffer &buffer, double xx, double yy)
+{
+	int x= static_cast<int> (xx);
+	int y= static_cast<int> (yy);
+	
+	if(yy < 0)
+	{
+		y--;
+	}
+	double x2= xx- x;
+	double x1= 1.0- x2;
+	double y2= yy- y;
+	double y1= 1.0- y2;
+	
+	double xy= x1*y1;
+	double xxy= x2*y1;
+	double xyy= x1*y2;
+	double xxyy= x2*y2;
+	
+	BYTE val;
+	int tx, ty;
+	
+	//	FILE pFile;
+	//	pFile= fopen("buffer.txt", "w");
+	for(int iy= 0; iy < m_Height; iy++)
+	{
+		ty= y+ iy;
+		for(int ix= 0; ix < m_Width; ix++)
+		{
+			tx= x+ ix;
+			val= (BYTE) (xy*buffer.GetPixel(tx, ty) + xxy*buffer.GetPixel(tx+ 1, ty)+ xyy*buffer.GetPixel(tx, ty+ 1)+ xxyy*buffer.GetPixel(tx+1, ty+1));
+			SetPixel(ix, iy, val);
+			//			fprintf(pFile, "%d, %d, %d, %d, %d", val, buffer.GetPixel(tx, ty), buffer.GetPixel(tx+ 1, ty), buffer.GetPixel(tx+ 1, ty), buffer.GetPixel(tx+ 1, ty+ 1));
+			//			SetPixel(ix, iy, 0);
+		}
+	}
+	return TRUE;
+}
+
diff --git a/Common_Class/SISBuffer/CrossCorr.cpp b/Common_Class/SISBuffer/CrossCorr.cpp
new file mode 100644
index 0000000..505431b
--- /dev/null
+++ b/Common_Class/SISBuffer/CrossCorr.cpp
@@ -0,0 +1,509 @@
+
+#include "stdafx.h"
+
+#include "MatchImpl.h"
+
+#include <emmintrin.h>
+//#include <tmmintrin.h>
+#include <ia32intrin.h>
+
+
+#define MOSIS_SIMD
+
+int64	CrossCorr_8u_C1(const uchar * vec1, const uchar * vec2, int len )
+{
+    int i, s = 0;
+    int64 sum = 0;
+
+#ifdef MOSIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	__m128i mmZeroData= _mm_setzero_si128();
+	mmResult= _mm_setzero_si128();
+
+	int results[4];
+
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+		mmA= _mm_loadu_si128((__m128i*) (vec1+ i));
+		mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+/*
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+		mmResult2= _mm_mullo_epi16(mmAA, mmBB);
+
+		// 1.2 8俺狼 16bit 单捞磐甫 4俺狼 32厚飘 单捞磐屈 滴俺肺 函券饶.. 歹茄促.
+		mmAA= _mm_unpackhi_epi16(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi16(mmResult2, mmZeroData);
+		mmResult2= _mm_add_epi32(mmAA, mmBB);
+		// 1.3 ... 醚钦俊 歹茄促.
+		mmResult= _mm_add_epi32(mmResult, mmResult2);
+
+
+
+		// 2. 窍困 单捞磐 拌魂.
+		// 2.1 窍困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+		mmResult2= _mm_mullo_epi16(mmAA, mmBB);
+		
+		// 2.2 8俺狼 16bit 单捞磐甫 4俺狼 32bit 单捞磐屈 滴俺肺 函券饶.. 歹茄促.
+		mmAA= _mm_unpackhi_epi16(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi16(mmResult2, mmZeroData);
+		mmResult2= _mm_add_epi32(mmAA, mmBB);
+		// 2.3 ... 醚钦俊 歹茄促.
+		mmResult= _mm_add_epi32(mmResult, mmResult2);
+		*/
+	}
+
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum+= results[0]+ results[1]+ results[2]+ results[3];
+
+
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        int e = vec1[i] * vec2[i];
+        int v = vec1[i + 1] * vec2[i + 1];
+
+        e += v;
+        v = vec1[i + 2] * vec2[i + 2];
+        e += v;
+        v = vec1[i + 3] * vec2[i + 3];
+        e += v;
+        sum += e;
+    }
+#endif
+
+    for( ; i < len; i++ )
+    {
+        s += vec1[i] * vec2[i];
+    }
+
+    return sum + s;
+}
+
+int64	CrossCorr_8u_C1( CMosisBuffer buffer1, int x1, int y1, int width, int height, CMosisBuffer buffer2, int x2, int y2)
+{
+    int64 sum = 0;
+	int h, w;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	__m128i	mmResult, mmResult2;
+	__m128i mmZeroData= _mm_setzero_si128();
+	mmResult= _mm_setzero_si128();
+	for(h= 0; h< height; h++)
+	{
+		for(w= 0; w < width- 16; w+= 16)
+		{
+			mmA= _mm_loadu_si128((__m128i*) buffer1.GetDataAddress(x1+ w, y1+ h));
+			mmB= _mm_loadu_si128((__m128i*) buffer2.GetDataAddress(x2+ w, y2+ h));
+
+			mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+			mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+			
+			mmResult2= _mm_madd_epi16(mmAA, mmBB);
+			mmResult= _mm_add_epi32(mmResult2, mmResult);
+			
+			
+			mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+			mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+			
+			mmResult2= _mm_madd_epi16(mmAA, mmBB);
+			mmResult= _mm_add_epi32(mmResult2, mmResult);
+		}
+	}
+	int results[4];
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= results[0]+ results[1]+ results[2]+ results[3];
+    return sum;
+}
+
+int64	CrossCorr_16u_C1( const ushort * vec1, const ushort * vec2, int len )
+{
+    int i, s = 0;
+    int64 sum = 0;
+
+#ifdef MOSIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	mmResult= _mm_setzero_si128();
+
+	int results[4];
+
+	for(i= 0; i <= len- 8; i+= 8)
+	{
+		mmA= _mm_loadu_si128((__m128i*) (vec1+ i));
+		mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+
+
+		mmResult2= _mm_madd_epi16(mmA, mmB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= results[0]+ results[1]+ results[2]+ results[3];
+
+
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        int e = vec1[i] * vec2[i];
+        int v = vec1[i + 1] * vec2[i + 1];
+
+        e += v;
+        v = vec1[i + 2] * vec2[i + 2];
+        e += v;
+        v = vec1[i + 3] * vec2[i + 3];
+        e += v;
+        sum += e;
+    }
+#endif
+
+    for( ; i < len; i++ )
+    {
+        s += vec1[i] * vec2[i];
+    }
+
+    return sum + s;
+}
+
+// 澜狼 邦急. 弥家蔼捞 粮犁茄促.
+float SearchMaximum(int64 *pData, int nData)
+{
+	int64	best= 0;
+	int64	bestBefore, bestAfter;
+	int		iBest;
+	float	ret= 0;
+	for(int i= 0; i< nData; i++)
+	{
+		if(best < *(pData+ i))
+		{
+			iBest= i;
+			best= *(pData+ i);
+		}
+	}
+	if(iBest < 1 || iBest > nData- 2)
+		return -1;
+
+	bestBefore= *(pData+ iBest- 1);
+	bestAfter= *(pData+ iBest+ 1);
+	if(best == bestAfter)
+	{
+		ret= iBest+ 0.5;
+	}
+	else if(bestBefore < bestAfter)
+	{
+		ret= iBest+ 0.5- 0.5*(best- bestAfter)/(best- bestBefore);
+	}
+	else
+	{
+		ret= iBest- 0.5+ 0.5/(best- bestAfter)*(best- bestBefore);
+	}
+
+	if(ret > iBest+ 1 || ret < iBest- 1)
+		return -1;
+
+	return ret;
+}
+// 澜狼 邦急. 弥家蔼捞 粮犁茄促.
+float SearchMinimum(int64 *pData, int nData)
+{
+	int64	best= *pData;
+	int64	bestBefore, bestAfter;
+	int		iBest;
+	float	ret= 0;
+	for(int i= 0; i< nData; i++)
+	{
+		if(best >= *(pData+ i))
+		{
+			iBest= i;
+			best= *(pData+ i);
+		}
+	}
+	if(iBest < 1 || iBest > nData- 2)
+		return -1;
+
+	bestBefore= *(pData+ iBest- 1);
+	bestAfter= *(pData+ iBest+ 1);
+	if(best == bestAfter)
+	{
+		ret= iBest+ 0.5;
+	}
+	else if(best == bestBefore)
+	{
+		ret= iBest- 0.5;
+	}
+	else if(bestBefore < bestAfter)
+	{
+		ret= iBest- 0.5+ 0.5/(best- bestAfter)*(best- bestBefore);
+	}
+	else// if(*(pBest-1) > bestAfter)
+	{
+		ret= iBest+ 0.5- 0.5*(best- bestAfter)/(best- bestBefore);
+	}
+
+	if(ret > iBest+ 1 || ret < iBest- 1)
+		return -1;
+
+	return ret;
+}
+
+AFX_EXT_API INT64 GetAbsoluteDifference(CMosisBuffer buffer, int x1, int y1, int width, int height, int x2, int y2)
+{
+	//	width= width>>4<<4;// 16栏肺 唱传促.
+	
+	__m128i mmA, mmB;
+	__m128i mmRes= _mm_setzero_si128();
+    int64 sum;
+	int64 results[2];
+	
+	for(int y= 0; y< height; y++)
+	{
+		for(int x= 0; x<= width- 16; x+= 16)
+		{
+			mmA= _mm_loadu_si128((__m128i*) buffer.GetDataAddress(x1+ x, y1+ y));
+			mmB= _mm_loadu_si128((__m128i*) buffer.GetDataAddress(x2+ x, y2+ y));
+			mmA= _mm_sad_epu8(mmA, mmB);
+			mmRes= _mm_add_epi64(mmA, mmRes);
+		}
+	}
+	_mm_storeu_si128((__m128i*)results, mmRes);
+	sum= results[0]+ results[1];
+	return sum;
+}
+AFX_EXT_API INT64 GetAbsoluteDifference(CMosisBuffer buffer, int x1, int y1, int width, int height, CMosisBuffer buffer2, int x2, int y2)
+{
+	//	width= width>>4<<4;// 16栏肺 唱传促.
+	
+	__m128i mmA, mmB;
+	__m128i mmRes= _mm_setzero_si128();
+    int64 sum;
+	int64 results[2];
+	
+	for(int y= 0; y< height; y++)
+	{
+		for(int x= 0; x<= width- 16; x+= 16)
+		{
+			mmA= _mm_loadu_si128((__m128i*) buffer.GetDataAddress(x1+ x, y1+ y));
+			mmB= _mm_loadu_si128((__m128i*) buffer2.GetDataAddress(x2+ x, y2+ y));
+			mmA= _mm_sad_epu8(mmA, mmB);
+			mmRes= _mm_add_epi64(mmA, mmRes);
+		}
+	}
+	_mm_storeu_si128((__m128i*)results, mmRes);
+	sum= results[0]+ results[1];
+	return sum;
+}
+
+AFX_EXT_API INT64 GetAbsoluteDifference(CMosisBuffer buffer, int x1, int y1, int width, int height, int x2, int y2, float subpixel)
+{
+	width= width>>4;// 16栏肺 唱传促.
+	
+	__m128i	mmZero= _mm_setzero_si128();
+	__m128i mmA, mmB;
+	__m128i mmAA, mmBB;
+	__m128i mmRes= _mm_setzero_si128();
+    int64 sum= 0;
+	int64 results[2];
+	
+	for(int y= y1; y< y1+ height; y++)
+	{
+		for(int x= 0; x<= width- 16; x+= 16)
+		{
+			mmA= _mm_loadu_si128((__m128i*) buffer.GetDataAddress(x1+ x, y));
+			mmB= _mm_loadu_si128((__m128i*) buffer.GetDataAddress(x2+ x, y));
+			mmBB= _mm_loadu_si128((__m128i*) buffer.GetDataAddress(x2+ x+ 1, y));
+			mmB= _mm_sub_epi8(mmA, mmB);
+			mmBB= _mm_sub_epi8(mmA, mmBB);
+		}
+	}
+	return sum;
+}
+
+
+
+void VertConvSIMD(unsigned char *pSrc, unsigned char *pDest, unsigned int nImageWidth, unsigned int nImageHeight, float pitch, int Threshold)
+{
+	int nPitch = pitch;
+	int SubPixel = (pitch-nPitch)*16;
+
+	
+	short SrcValue = 0;
+	short DestValue = 0;
+	short DestValue1 = 0;
+	short DestValue2 = 0;
+	short SubValue = 0;
+
+	__m128i ZeroData = _mm_setzero_si128();
+	__m128i DataN = _mm_set1_epi16(-1);
+
+	__m128i SubPixel128 = _mm_set1_epi16(16-SubPixel);
+	__m128i SubPixel2128 = _mm_set1_epi16(SubPixel);
+
+	__m128i Thres128 = _mm_set1_epi16(Threshold);
+	__m128i NThres128 = _mm_set1_epi16(Threshold*-1);
+
+	__m128i SrcHigh = _mm_setzero_si128();
+	__m128i Srclow = _mm_setzero_si128();
+	__m128i Dest1High = _mm_setzero_si128();
+	__m128i Dest1Low = _mm_setzero_si128();
+	__m128i Dest2High = _mm_setzero_si128();
+	__m128i Dest2Low = _mm_setzero_si128();
+
+	__m128i Resulthigh = _mm_setzero_si128();
+	__m128i ResultLow = _mm_setzero_si128();
+
+	int mask[4] = {0};
+	int mask2 = 0;
+
+	//0~pitch 芭府鳖瘤
+	for( int i = 0; i < nImageWidth; i+=16)
+	{
+		for( int j = nPitch+1; j < nImageHeight-nPitch-1; j++)
+		{
+			Srclow = _mm_loadu_si128((__m128i*)(pSrc+i+j*nImageWidth));
+
+			SrcHigh = _mm_unpackhi_epi8(Srclow,ZeroData);
+			//惑困 困摹 short屈 函券
+			Srclow = _mm_unpacklo_epi8(Srclow,ZeroData);
+			//窍困 困摹 short屈 函券
+
+			Dest1Low = _mm_loadu_si128((__m128i*)(pSrc+i+(j+nPitch)*nImageWidth));
+			
+			Dest1High = _mm_unpackhi_epi8(Dest1Low,ZeroData);
+			//惑困 困摹 short屈 函券
+			Dest1Low = _mm_unpacklo_epi8(Dest1Low,ZeroData);
+			//窍困 困摹 short屈 函券
+
+			Dest1High = _mm_mullo_epi16(Dest1High,SubPixel128);
+			Dest1Low = _mm_mullo_epi16(Dest1Low,SubPixel128);
+
+			Dest2Low = _mm_loadu_si128((__m128i*)(pSrc+i+(j+nPitch+1)*nImageWidth));
+			
+			Dest2High = _mm_unpackhi_epi8(Dest2Low,ZeroData);
+			//惑困 困摹 short屈 函券
+			Dest2Low = _mm_unpacklo_epi8(Dest2Low,ZeroData);
+			//窍困 困摹 short屈 函券
+
+			Dest2High = _mm_mullo_epi16(Dest2High,SubPixel2128);
+			Dest2Low = _mm_mullo_epi16(Dest2Low,SubPixel2128);
+
+			Dest1High = _mm_adds_epi16(Dest1High,Dest2High);
+			Dest1Low = _mm_adds_epi16(Dest1Low,Dest2Low);
+
+			Dest1High = _mm_srli_epi16(Dest1High,4);
+			Dest1Low = _mm_srli_epi16(Dest1Low,4);
+
+			Dest1High = _mm_subs_epi16(Dest1High,SrcHigh);
+			Dest1Low = _mm_subs_epi16(Dest1Low,Srclow);
+
+			Dest2High = Dest1High;
+			Dest2Low = Dest1Low;
+
+			Resulthigh = Dest1High;
+			ResultLow = Dest1Low;
+
+			Dest1High = _mm_cmpgt_epi16(Dest1High,Thres128);
+			Dest1Low = _mm_cmpgt_epi16(Dest1Low,Thres128);
+
+			mask[0] = _mm_movemask_epi8(Dest1High);
+			mask[1] = _mm_movemask_epi8(Dest1Low);
+
+			Dest1High = _mm_cmplt_epi16(Dest2High,NThres128);
+			Dest1Low = _mm_cmplt_epi16(Dest2Low,NThres128);
+
+			mask[2] = _mm_movemask_epi8(Dest1High);
+			mask[3] = _mm_movemask_epi8(Dest1Low);
+
+			if(mask[0] ||mask[1] ||mask[2] ||mask[3] )
+			{
+				Dest1Low = _mm_loadu_si128((__m128i*)(pSrc+i+(j-nPitch)*nImageWidth));
+				
+				Dest1High = _mm_unpackhi_epi8(Dest1Low,ZeroData);
+				//惑困 困摹 short屈 函券
+				Dest1Low = _mm_unpacklo_epi8(Dest1Low,ZeroData);
+				//窍困 困摹 short屈 函券
+				
+				Dest1High = _mm_mullo_epi16(Dest1High,SubPixel128);
+				Dest1Low = _mm_mullo_epi16(Dest1Low,SubPixel128);
+				
+				
+				Dest2Low = _mm_loadu_si128((__m128i*)(pSrc+i+(j-nPitch-1)*nImageWidth));
+				
+				Dest2High = _mm_unpackhi_epi8(Dest2Low,ZeroData);
+				//惑困 困摹 short屈 函券
+				Dest2Low = _mm_unpacklo_epi8(Dest2Low,ZeroData);
+				//窍困 困摹 short屈 函券
+				
+				Dest2High = _mm_mullo_epi16(Dest2High,SubPixel2128);
+				Dest2Low = _mm_mullo_epi16(Dest2Low,SubPixel2128);
+				
+				Dest1High = _mm_adds_epi16(Dest1High,Dest2High);
+				Dest1Low = _mm_adds_epi16(Dest1Low,Dest2Low);
+				
+				Dest1High = _mm_srli_epi16(Dest1High,4);
+				Dest1Low = _mm_srli_epi16(Dest1Low,4);
+				
+				Dest1High = _mm_subs_epi16(Dest1High,SrcHigh);
+				Dest1Low = _mm_subs_epi16(Dest1Low,Srclow);
+
+				Dest2High = Dest1High;
+				Dest2Low = Dest1Low;
+			}
+
+			if(mask[0] ||mask[1])
+			{
+				Dest1High = _mm_cmpgt_epi16(Dest1High,Thres128);
+				Dest1Low = _mm_cmpgt_epi16(Dest1Low,Thres128);
+				
+				mask[0] = _mm_movemask_epi8(Dest1High);
+				mask[1] = _mm_movemask_epi8(Dest1Low);
+				
+				if(mask[0] ||mask[1])
+				{
+					ResultLow = _mm_packus_epi16(ResultLow,Resulthigh);
+					_mm_storeu_si128( (__m128i*)(pDest+i+j*nImageWidth),ResultLow);
+					continue;
+				}
+			}
+
+			if(mask[2] ||mask[3])
+			{
+				Dest1High = _mm_cmplt_epi16(Dest2High,NThres128);
+				Dest1Low = _mm_cmplt_epi16(Dest2Low,NThres128);
+				
+				mask[2] = _mm_movemask_epi8(Dest1High);
+				mask[3] = _mm_movemask_epi8(Dest1Low);
+				
+				if(mask[2] ||mask[3])
+				{
+					ResultLow = _mm_packus_epi16(ResultLow,Resulthigh);
+					_mm_storeu_si128( (__m128i*)(pDest+i+j*nImageWidth),ResultLow);
+					continue;
+				}
+			}
+
+			_mm_storeu_si128( (__m128i*)(pDest+i+j*nImageWidth),ZeroData);
+		}
+	}
+}
diff --git a/Common_Class/SISBuffer/FileBuffer.cpp b/Common_Class/SISBuffer/FileBuffer.cpp
new file mode 100644
index 0000000..31e286c
--- /dev/null
+++ b/Common_Class/SISBuffer/FileBuffer.cpp
@@ -0,0 +1,114 @@
+// FileBuffer.cpp: implementation of the CFileBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "InspectionBuffer.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+void CFileBuffer::FillBuffer(CFile &file, int x, int y, int oWidth, int oHeight)
+{
+	int iData= sizeof(BITMAPFILEHEADER)+ sizeof(BITMAPINFOHEADER)+ 1024;
+	for(int i= 0; i< m_Height; i++)
+	{
+//		fseek(pFile, iData+ x+ (y+ i)*oWidth, SEEK_SET);
+//		fread(m_pData+ i*GetDataWidth(), width, 1, pFile);
+		file.Seek(iData+ x+ (y+ i)*oWidth, SEEK_SET);
+		file.Read(m_pData+ i*GetDataWidth(), m_Width);
+	}
+}
+
+void CFileBuffer::FillBufferReverse(CFile &file, int x, int y, int oWidth, int oHeight)
+{
+	int iData= sizeof(BITMAPFILEHEADER)+ sizeof(BITMAPINFOHEADER)+ 1024;
+
+	int nNewY = oHeight - y - m_Height;
+	for(int i= m_Height-1; i>=0 ; i--)
+	{
+		file.Seek(iData+ x+ (nNewY+ i)*oWidth, SEEK_SET);
+		file.Read(m_pData+ (m_Height-1-i)*GetDataWidth(), m_Width);
+	}
+}
+
+void CFileBuffer::FillBufferFromTwoFile(CFile &file1, CFile &file2, int x, int y, int FirstHeight, int SecondHeight, int oWidth, int oHeight)
+{
+	int iData= sizeof(BITMAPFILEHEADER)+ sizeof(BITMAPINFOHEADER)+ 1024;
+	for(int i= 0; i< FirstHeight; i++)
+	{
+		file1.Seek(iData+ x+ (y+ i)*oWidth, SEEK_SET);
+		file1.Read(m_pData+ i*GetDataWidth(), m_Width);
+	}
+
+	if(SecondHeight>0)
+	{
+		for(int i= 0; i< SecondHeight; i++)
+		{
+			file2.Seek(iData+ x+ i*oWidth, SEEK_SET);
+			file2.Read(m_pData+ (FirstHeight+i)*GetDataWidth(), m_Width);
+		}
+	}
+}
+
+
+void CFileBuffer::SaveBufferToTwoFile(CFile &file1, CFile &file2, int x, int y, int FirstHeight, int SecondHeight, int oWidth, int oHeight)
+{
+	int iData= sizeof(BITMAPFILEHEADER)+ sizeof(BITMAPINFOHEADER)+ 1024;
+	for(int i= 0; i< FirstHeight; i++)
+	{
+		file1.Seek(iData+ x+ (y+ i)*oWidth, SEEK_SET);
+		file1.Write(m_pData+ i*GetDataWidth(), m_Width);
+	}
+
+	if(SecondHeight>0)
+	{
+		for(int i= 0; i< SecondHeight; i++)
+		{
+			file2.Seek(iData+ x+ i*oWidth, SEEK_SET);
+			file2.Write(m_pData+ (FirstHeight+i)*GetDataWidth(), m_Width);
+		}
+	}
+}
+
+// miniont, 2008-09-04, begin
+BITMAPINFOHEADER  CFileBuffer::GetBitmapInfoHeader(CFile &file)
+{
+	BITMAPINFOHEADER infoHeader;
+
+	file.Seek(sizeof(BITMAPFILEHEADER), SEEK_SET);
+	file.Read(&infoHeader, sizeof(BITMAPINFOHEADER));
+
+	return infoHeader;
+}
+
+const int CFileBuffer::GetContentWidth(CFile &file)
+{
+	BITMAPINFOHEADER infoHeader;
+	
+	file.Seek(sizeof(BITMAPFILEHEADER), SEEK_SET);
+	file.Read(&infoHeader, sizeof(BITMAPINFOHEADER));
+	
+	return infoHeader.biWidth;
+}
+
+
+const int CFileBuffer::GetContentHeight(CFile &file)
+{
+	BITMAPINFOHEADER infoHeader;
+
+	file.Seek(sizeof(BITMAPFILEHEADER), SEEK_SET);
+	file.Read(&infoHeader, sizeof(BITMAPINFOHEADER));
+
+	return infoHeader.biHeight;
+}
+// miniont, 2008-09-04, end
+
+
diff --git a/Common_Class/SISBuffer/FrameSave.cpp b/Common_Class/SISBuffer/FrameSave.cpp
new file mode 100644
index 0000000..0d05dc4
--- /dev/null
+++ b/Common_Class/SISBuffer/FrameSave.cpp
@@ -0,0 +1,63 @@
+// FrameSave.cpp: implementation of the CFrameSave class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "InspectionBuffer.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+
+
+
+CFrameSave::CFrameSave(CString &strDir_, int startFrame, int width, int height) : strDir(strDir_), iStartFrame(startFrame)
+{
+	pImageFileHeader= new stImageFileHeader;
+	pImageFileHeader->ChangeSize(width, height);
+}
+
+CFrameSave::~CFrameSave()
+{
+	if(pImageFileHeader)
+		delete pImageFileHeader;
+}
+
+void CFrameSave::SaveFrame(BYTE *m_pData, int iScan, int iFrame, int cell, int bottom)
+{
+	CFile file;
+	CString fileName;
+	fileName.Format(_T("%s\\%02d_%04d_%02d_%03d.bmp"), strDir.GetBuffer(100), iScan, iFrame- iStartFrame, cell, bottom);
+	
+	file.Open(fileName, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
+	file.Write(&pImageFileHeader->fileHeader, pImageFileHeader->fileHeader.bfOffBits);
+	// 	file.Write(&pImageFileHeader->fileHeader, sizeof(BITMAPFILEHEADER));
+	// 	file.Write(&pImageFileHeader->infoHeader, sizeof(BITMAPINFOHEADER));
+	// 	file.Write(pImageFileHeader->quad, sizeof(RGBQUAD)*256);
+	
+	file.Write(m_pData, pImageFileHeader->infoHeader.biSizeImage);
+	file.Close();
+}
+void CFrameSave::SaveFrame(BYTE *m_pData, int iFrame)
+{
+	CFile file;
+	CString fileName;
+	fileName.Format(_T("%s\\%04d.bmp"), strDir.GetBuffer(100), iFrame- iStartFrame);
+	
+	file.Open(fileName, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
+	file.Write(&pImageFileHeader->fileHeader, pImageFileHeader->fileHeader.bfOffBits);
+	// 	file.Write(&pImageFileHeader->fileHeader, sizeof(BITMAPFILEHEADER));
+	// 	file.Write(&pImageFileHeader->infoHeader, sizeof(BITMAPINFOHEADER));
+	// 	file.Write(pImageFileHeader->quad, sizeof(RGBQUAD)*256);
+	
+	file.Write(m_pData, pImageFileHeader->infoHeader.biSizeImage);
+	file.Close();
+}
diff --git a/Common_Class/SISBuffer/Header/Broadcast.h b/Common_Class/SISBuffer/Header/Broadcast.h
new file mode 100644
index 0000000..fa15c59
--- /dev/null
+++ b/Common_Class/SISBuffer/Header/Broadcast.h
@@ -0,0 +1,41 @@
+#if !defined(AFX_BROADCAST_H__180A3328_BAE3_4BA3_92F8_4F7C54938BC1__INCLUDED_)
+#define AFX_BROADCAST_H__180A3328_BAE3_4BA3_92F8_4F7C54938BC1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// Broadcast.h : header file
+//
+
+#include <vector>
+
+class CAudience
+{
+public:
+	virtual void OnAir(int channel, int program, void* pContent)= 0;
+};
+
+class CBroadcast
+{
+	std::vector<CAudience*> audiences;
+public:
+	void Register(CAudience* pAucience)
+	{
+		audiences.push_back(pAucience);
+	}
+
+	int Broadcast(int channel, int program, void* pContent)
+	{
+		std::vector<CAudience*>::iterator iter;
+		iter= audiences.begin();
+		while(iter != audiences.end())
+		{
+			(*iter)->OnAir(channel, program, pContent);
+			iter++;
+		}
+		return audiences.size();
+	}
+};
+
+
+#endif // !defined(AFX_BROADCAST_H__180A3328_BAE3_4BA3_92F8_4F7C54938BC1__INCLUDED_)
diff --git a/Common_Class/SISBuffer/Header/InspectionBuffer.h b/Common_Class/SISBuffer/Header/InspectionBuffer.h
new file mode 100644
index 0000000..6a474ec
--- /dev/null
+++ b/Common_Class/SISBuffer/Header/InspectionBuffer.h
@@ -0,0 +1,498 @@
+// InspectionBuffer.h: interface for the CSISBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_INSPECTIONBUFFER_H__16133B59_E7ED_46D2_9FCE_FF4D0A62B052__INCLUDED_)
+#define AFX_INSPECTIONBUFFER_H__16133B59_E7ED_46D2_9FCE_FF4D0A62B052__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+struct stBufferSize;
+class CSISBuffer;
+class CShiftBuffer;
+class CCropBuffer;
+class CCopyBuffer;
+class CFileBuffer;
+class COwnerBuffer;
+struct stImageFileHeader;
+class CBufferAttach;
+class CFrameSave;
+class CFrameSave_OneFile;
+class CSISImageBuffer;
+
+
+// 滚欺狼 荤捞令 包访 沥焊 备炼眉.
+struct AFX_EXT_CLASS stBufferSize
+{
+	int		m_Width, m_Height;
+	int		m_DataWidth;
+public:
+	stBufferSize(int width= 0, int height= 0)
+	{
+		SetSize(width, height);
+	}
+	stBufferSize(stBufferSize& size)
+	{
+		SetSize(size.GetWidth(), size.GetHeight());
+	}
+	stBufferSize(stBufferSize* pSize)
+	{
+		SetSize(pSize->GetWidth(), pSize->GetHeight());
+	}
+
+public:
+	int GetWidth(){return m_Width;}
+	int GetHeight(){return m_Height;}
+	int GetDataWidth(){return m_DataWidth;}
+	UINT GetDataSize(){return (UINT)GetDataWidth()*GetHeight();}
+
+public:
+	static int ChangeDataWidth(int width){return (width+ 3)/4*4;}
+	void SetSize(int width, int height)
+	{
+		m_Width= width;
+		m_Height= height;
+		m_DataWidth= ChangeDataWidth(width);//(width+ 3)/4*4 ;
+	}
+};
+
+
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 八荤 滚欺 漂己惑 boundary甫 逞绰 单捞磐 立辟档 啊瓷窍档废 汲拌凳. 付捞呈胶 x, y, 棺 width, height甫 逞绢辑绰 x, y 侨伎肺狼 立辟捞 啊瓷窍促.
+// 拱沸 皋葛府俊 粮犁窍瘤 臼栏搁 桓绢滚府摆瘤.. 滚欺俊辑 肋 炼例秦辑 荤侩秦具 茄促.
+
+class  AFX_EXT_CLASS  CSISBuffer
+{
+protected:
+	BYTE * m_pData;
+	int m_Width, m_DataWidth;
+	int m_Height;
+
+public:
+	CSISBuffer()
+		:m_pData(NULL)
+	{SetSize(0, 0);}
+	CSISBuffer(BYTE* pData_, int w, int h)
+		: m_pData(pData_)
+	{		SetSize(w, h);	}
+	virtual ~CSISBuffer()
+	{	};
+
+
+	virtual BOOL SetSize(int w, int h)
+	{
+		m_Width= w;
+		m_Height= h;
+		m_DataWidth= CSISBuffer::ChangeDataWidth(w);//(m_Width+ 3)/4*4;
+		return TRUE;
+	}
+	void ChangeData(BYTE* pd)	{ m_pData= pd;	}
+	void SetBuffer(BYTE* pData_, int w, int h)
+	{
+		ChangeData(pData_);
+		SetSize(w, h);
+	}
+	void MemSet(BYTE val);
+	void RotateImage();
+public:
+	BYTE * GetDataAddress(){return m_pData;}
+	BYTE* GetDataAddress(int x, int y){return m_pData+ GetDataWidth()*y+ x;};
+
+	virtual CRect GetAvailableInspectRect(CRect requestRect)
+	{
+		CRect rect;
+		rect.SetRect(1, 1, GetWidth()- 1, GetHeight()- 1);
+		rect.IntersectRect(rect, requestRect);
+		return rect;
+	}
+	CRect IntersectRect(CRect &rect);// RECT甫 滚欺 农扁俊 嘎霸 犁 汲沥. Return Value绰 rect啊 滚欺甫 哈绢车栏搁 false, 酒聪搁 true
+	int GetSize(){return GetWidth()*GetHeight();}
+	int GetDataSize(){return GetDataWidth()*GetHeight();}
+	int GetWidth(){ return m_Width;}
+	int GetDataWidth(){ return m_DataWidth;}
+	int GetHeight(){return m_Height;}
+	BYTE GetPixel(int idx){return GetPixel(idx%GetDataWidth(), idx/GetDataWidth());};
+	BYTE GetPixel(int x, int y){ return *(m_pData+ x+ y*GetDataWidth());}
+	BYTE GetPixel(double fx, int y);
+	BYTE GetPixel(int x, double fy);
+	void SetPixel(int x, int y, BYTE value){*(GetDataAddress(x, y))= value;}
+	BOOL SetValidPixel(int x, int y, BYTE value){if(! IsValidPixel(x, y)) return FALSE; SetPixel(x, y, value); return TRUE;}
+
+	int GetDiff32(int x, int y, double xPitch);
+	int	GetDiff23(int x, int y, double yPitch);
+
+	int GetXDiff22(int x, int y, double xPitch);
+	int GetYDiff22(int x, int y, double yPitch);
+
+	int GetVar(int x, int y, int min);
+
+	float GetMeanBright();
+	void AdjustBright(CSISBuffer &buffer);
+	void FlipUpDown();
+	BOOL IsValidBuffer();
+	virtual BOOL IsValidPixel(int x, int y)
+	{
+		return x >= 0 && y >= 0 && x < m_Width && y < m_Height;
+	}
+
+	static BOOL CopyBtoA(CSISBuffer &aBuffer, int x, int y, CSISBuffer &bBuffer, CRect &rectFrom);
+	static int ChangeDataWidth(int width){return (width+ 3)/4*4;}
+
+	BOOL Contains(CRect &rect)
+	{
+		if(rect.left < 0)	return FALSE;
+		if(rect.top < 0)	return FALSE;
+		if(rect.right > GetWidth())		return FALSE;
+		if(rect.bottom > GetHeight())	return FALSE;
+
+		return TRUE;
+	}
+};
+
+
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 盔贰 林家 甫 滚府绊 x, y父怒 滚欺甫 shift秦辑 荤侩且 荐 乐霸 秦霖促.
+// 盔贰 林家 眉拌啊 秦寸 滚欺 客 shift x, y 焊促绰 农促绰 啊沥窍俊 荤侩啊瓷.
+class  AFX_EXT_CLASS  CShiftBuffer : public CSISBuffer
+{
+	int x, y;// x客 y绰 pitch 父怒 捞悼茄 芭瘤..
+public:
+	CShiftBuffer(CSISBuffer& iBuffer, int x_, int y_)
+		: CSISBuffer(iBuffer.GetDataAddress(), iBuffer.GetWidth(), iBuffer.GetHeight()), x(x_), y(y_)
+	{
+		m_pData = GetDataAddress(x, y);
+
+		CRect	rect(0, 0, GetWidth(), GetHeight());
+		CRect	rectShift = rect;
+		rectShift.OffsetRect(x, y);
+		
+		rect.IntersectRect(rectShift, rect);
+	}
+	virtual CRect GetAvailableInspectRect(CRect requestRect)
+	{
+		CRect rect;
+		rect.SetRect(1, 1, GetWidth()- x- 1, GetHeight()- y- 1);
+		rect.IntersectRect(rect, requestRect);
+		return rect;
+	}
+	virtual BOOL IsValidPixel(int xx, int yy)
+	{
+		xx= xx- x;
+		yy= yy- y;
+		return CSISBuffer::IsValidPixel(xx, yy);
+	}
+
+};
+
+// 2008-08-28, miniont, begin
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 盔贰 林家, width, height 甫 滚府绊 rectROI 农扁狼 滚欺牢巴 贸烦 悼累窍霸 茄促.
+// 奴 滚欺甫 付摹 累篮 滚欺牢剧 悼累窍霸 窍绰 滚欺.
+class  AFX_EXT_CLASS  CCropBuffer : public CSISBuffer
+{
+	int x, y;// x客 y绰 pitch 父怒 捞悼茄 芭瘤..
+public:
+	CCropBuffer() : CSISBuffer(NULL, 0, 0){};
+	CCropBuffer(CSISBuffer& iBuffer, CRect &rectROI)
+		: CSISBuffer(iBuffer.GetDataAddress(rectROI.left, rectROI.top), rectROI.Width(), rectROI.Height()), x(rectROI.left), y(rectROI.top)
+	{
+		CRect	rectImage(0, 0, iBuffer.GetWidth(), iBuffer.GetHeight());
+
+		CRect	rectBoundaryChecked;
+		rectBoundaryChecked.IntersectRect(rectROI, rectImage);
+
+		m_Width = rectBoundaryChecked.Width();		
+		m_Height = rectBoundaryChecked.Height();	
+		m_DataWidth = iBuffer.GetDataWidth();
+		x = rectROI.left;
+		y = rectROI.top;
+	}
+	void DoCrop(CSISBuffer& iBuffer, CRect &rectROI)
+	{
+		SetBuffer(iBuffer.GetDataAddress(rectROI.left, rectROI.top), rectROI.Width(), rectROI.Height());
+		x= rectROI.left;
+		y= rectROI.top;
+		CRect	rectImage(0, 0, iBuffer.GetWidth(), iBuffer.GetHeight());
+		CRect	rectBoundaryChecked;
+		rectBoundaryChecked.IntersectRect(rectROI, rectImage);
+		m_Width = rectBoundaryChecked.Width();		
+		m_Height = rectBoundaryChecked.Height();	
+		m_DataWidth = iBuffer.GetDataWidth();
+	}
+	int GetX(){return x;}
+	int GetY(){return y;}
+	virtual BOOL IsValidPixel(int xx, int yy)
+	{
+		xx= xx- x;
+		yy= yy- y;
+		return CSISBuffer::IsValidPixel(xx, yy);
+	}
+};
+
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 促弗 滚欺俊辑 单捞磐甫 啊廉客辑 夯 滚欺俊 墨乔茄促.
+class  AFX_EXT_CLASS CCopyBuffer : public CSISBuffer
+{
+public:
+	CCopyBuffer(CSISBuffer& buffer)
+		: CSISBuffer(buffer.GetDataAddress(), buffer.GetWidth(), buffer.GetHeight())
+	{
+		m_DataWidth= buffer.GetDataWidth();
+	}
+	CCopyBuffer(unsigned char *pData_, int width, int height)
+		: CSISBuffer(pData_, width, height)
+	{
+	}
+	CCopyBuffer(int width, int height)
+		: CSISBuffer(NULL, width, height)
+	{
+	}
+	CCopyBuffer()
+		: CSISBuffer(NULL, 0, 0)
+	{
+	}
+
+public:
+	BOOL FillBufferCenter(CSISBuffer &buffer, double xx, double yy)
+	{
+		return FillBuffer(buffer, xx- GetWidth()/2, yy- GetHeight()/2);
+	}
+	BOOL FillBuffer(CSISBuffer &buffer, double xx, double yy);
+	BOOL FillBufferCenter(CSISBuffer& buffer, int x, int y)
+	{
+		return FillBuffer(buffer, x- GetWidth()/2, y- GetHeight()/2);
+	}
+	BOOL FillBuffer(CSISBuffer& buffer, int x, int y);
+};
+
+
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 颇老俊辑 单捞磐甫 啊廉客辑 夯 滚欺俊 墨乔茄促.
+class  AFX_EXT_CLASS  CFileBuffer : public CSISBuffer
+{
+public:
+	CFileBuffer(CSISBuffer &buffer)
+		:CSISBuffer(buffer.GetDataAddress(), buffer.GetWidth(), buffer.GetHeight())
+	{
+		m_DataWidth= buffer.GetDataWidth();
+	}
+	CFileBuffer(int width, int height)
+		: CSISBuffer(NULL, width, height)
+	{
+	}
+
+	CFileBuffer(unsigned char *pData_, int width, int height)
+		: CSISBuffer(pData_, width, height)
+	{
+	}
+
+	// miniont, 2008-8-28, end
+public:
+	void FillBuffer(CFile &file, int x, int y, int oWidth, int oHeight);
+	void FillBufferReverse(CFile &file, int x, int y, int oWidth, int oHeight);		// miniont, 2008-09-10
+	void FillBufferFromTwoFile(CFile &file1, CFile &file2, int x, int y, int FirstHeight, int SecondHeight, int oWidth, int oHeight);		// miniont, 2008-09-29
+	void SaveBufferToTwoFile(CFile &file1, CFile &file2, int x, int y, int FirstHeight, int SecondHeight, int oWidth, int oHeight);		// miniont, 2008-11-24
+
+	const int GetContentWidth(CFile &file);															// miniont, 2008-09-04
+	const int GetContentHeight(CFile &file);
+	
+	static BITMAPINFOHEADER GetBitmapInfoHeader(CFile &file);
+	// miniont, 2008-09-04
+
+public:
+// 	CFile m_File;
+// 	BITMAPINFOHEADER m_InfoHeader;
+// 	BOOL ReadBuffer(CSISBuffer &buffer, int x, int y, int width, int height);
+// 	BOOL WriteBuffer(CSISBuffer &buffer, int x, int y, int width, int height);
+};
+
+
+// 蜡老窍霸 磊脚狼 单捞磐甫 皋葛府俊 父甸绢 郴绰 扁瓷阑 茄促.
+// 促弗 滚欺 贸府 扁瓷阑 窍扁 困秦辑 夯滚欺甫 copy滚欺唱 shift滚欺, file滚欺殿俊 积己磊肺 逞败林搁 等促.
+class AFX_EXT_CLASS COwnerBuffer : public CSISBuffer
+{
+	int m_DataSpace;
+public:
+	COwnerBuffer(int ww= 0, int hh= 0);
+	virtual ~COwnerBuffer();
+	virtual BOOL SetSize(int ww, int hh);
+	void ReleaseSpace();
+};
+
+
+#include <pshpack2.h>
+
+struct AFX_EXT_CLASS stImageFileHeader
+{
+#define DIB_HEADER_MARKER   ((WORD) ('M' << 8) | 'B')
+	BITMAPFILEHEADER	fileHeader;
+	BITMAPINFOHEADER	infoHeader;
+	RGBQUAD				quad[256];
+
+	stImageFileHeader()
+	{
+		fileHeader.bfType = DIB_HEADER_MARKER;  // "BM"
+		fileHeader.bfReserved1 = 0;
+		fileHeader.bfReserved2 = 0;
+		
+		infoHeader.biSize = 40;// sizeof(BITMAPINFOHEADER)
+		infoHeader.biWidth = 0;
+		infoHeader.biHeight = 0;
+		infoHeader.biPlanes = 1;
+		infoHeader.biBitCount = 8;
+		infoHeader.biCompression = 0;
+		infoHeader.biSizeImage = 0;
+		infoHeader.biXPelsPerMeter = 2923;
+		infoHeader.biYPelsPerMeter = 2923;
+		infoHeader.biClrUsed = 0;
+		infoHeader.biClrImportant = 0;
+
+
+		fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256;
+		fileHeader.bfSize = fileHeader.bfOffBits + infoHeader.biSizeImage;
+
+		int i;
+		for(i= 0; i< 256; i++)
+		{
+			quad[i].rgbRed= i;
+			quad[i].rgbGreen= i;
+			quad[i].rgbBlue= i;
+			quad[i].rgbReserved= 0;
+		}
+	}
+
+public:
+	BOOL IsValidHeader()	{	return infoHeader.biWidth > 0;	}// IsValid()
+	int GetWidth()	{	return infoHeader.biWidth;	}
+	int GetHeight()	{	return infoHeader.biHeight;	}
+	UINT GetDataOffset(){	return fileHeader.bfOffBits;}
+	UINT GetDataSize(){	return infoHeader.biSizeImage;}
+
+	void ChangeSize(int width, int height)// void ChangeHeader(int width, int height)
+	{
+		infoHeader.biWidth = width;
+		infoHeader.biHeight = height;
+		stBufferSize bufferSize(width, height);
+		infoHeader.biSizeImage = bufferSize.GetDataSize();//width*height*1;
+
+//		fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256;
+		fileHeader.bfSize = fileHeader.bfOffBits + infoHeader.biSizeImage;
+	}
+
+	void ReadFromFile(CString &fileName)
+	{
+		CFile file;
+		file.Open(fileName, CFile::modeCreate | CFile::typeBinary);
+		ReadFromFile(file);
+		file.Close();
+	}
+	void ReadFromFile(CFile &file)
+	{
+		file.Seek(0, SEEK_SET);
+		file.Read(&fileHeader, sizeof(BITMAPFILEHEADER));
+		file.Read(&infoHeader, sizeof(BITMAPINFOHEADER));
+		file.Read(quad, sizeof(RGBQUAD)*256);
+		ChangeSize(infoHeader.biWidth, infoHeader.biHeight);
+	}
+	BITMAPINFO* GetBitmapInfo(){return (BITMAPINFO*) &infoHeader;}
+};
+#include <poppack.h>
+
+
+// 林绢柳 捞抚狼 颇老阑 瘤快绊 货肺 积己茄促.
+// 积己磊 龋免且锭 林狼 秦扼...せせせ.
+// AttachToFile 窃荐啊 龋免瞪锭付促 捞固瘤甫 眠啊茄促.
+class  AFX_EXT_CLASS CBufferAttach
+{
+	CString m_FileName;
+	stImageFileHeader *m_pImageFileHeader;
+	int		m_bFileMade;
+public:
+	CBufferAttach(CString &name);
+	~CBufferAttach();
+public:
+	void	AttachToFile(CSISBuffer &buffer);
+protected:
+	BOOL	MakeFile();
+};
+
+
+
+// 橇饭烙 窜困肺 捞固瘤甫 历厘窍扁 困茄 努贰胶.
+class AFX_EXT_CLASS CFrameSave
+{
+	int iStartFrame;
+	stImageFileHeader *pImageFileHeader;
+	CString strDir;
+	
+public:
+	CFrameSave(CString &strDir_, int startFrame, int width= 8192, int height= 1024);
+	~CFrameSave();
+	
+public:
+	void SaveFrame(BYTE *m_pData, int iFrame);
+	void SaveFrame(BYTE *m_pData, int iScan, int iFrame, int cell, int bottom);
+};
+
+
+// 滚欺甫 鉴瞒利栏肺 颇老俊 历厘窍扁 困茄 努贰胶.
+class AFX_EXT_CLASS  CFrameSave_OneFile
+{
+	CBufferAttach *pBufferAttach;
+	int width, height;
+	
+	// 历厘阑 矫累窍妨绊 窍绰 滚欺 牢郸胶.
+	int	idStartFrame;
+	
+	// 历厘且 橇饭烙 荐 棺 历厘茄 橇饭烙 荐.
+	int nSaveFrame;
+	int iSaveFrame;
+	
+	
+public:
+	CFrameSave_OneFile(CString &fileName_, int startFrame, int saveFrame, int width_= 8192, int height_= 1024);
+	~CFrameSave_OneFile();
+public:
+	void SaveFrame(int iFrame, CSISBuffer &frameBuffer);
+};
+
+
+
+class AFX_EXT_CLASS  CDynamicBuffer : public COwnerBuffer
+{
+	
+public:
+	void FillBuffer(CSISBuffer &buffer, CRect &rect);
+};
+
+
+// width, height 父怒狼 滚欺甫 悼利栏肺 积己 茄促.
+class  AFX_EXT_CLASS  CSISImageBuffer : public CSISBuffer
+{
+// 	BYTE * m_pData;
+// 	int	m_Width, m_Height;
+	int m_DataSpace;
+	stImageFileHeader *m_pFileHeader;
+
+public:
+	CSISImageBuffer();
+	~CSISImageBuffer();
+public:
+	stImageFileHeader* GetFileHeader()	{		return m_pFileHeader;	}
+	
+public:
+//	stBufferSize GetSize(){return stBufferSize(m_Width, m_Height);}
+//	int GetWidth(){return m_Width;}
+//	int GetHeight(){return m_Height;}
+
+	virtual BOOL SetSize(int ww, int hh);
+
+	void ReleaseImage();
+	BOOL ReadFromFile(CString &fileName);
+};
+
+
+
+#endif // !defined(AFX_INSPECTIONBUFFER_H__16133B59_E7ED_46D2_9FCE_FF4D0A62B052__INCLUDED_)
diff --git a/Common_Class/SISBuffer/Header/NoiseLevel.h b/Common_Class/SISBuffer/Header/NoiseLevel.h
new file mode 100644
index 0000000..1fc3b4f
--- /dev/null
+++ b/Common_Class/SISBuffer/Header/NoiseLevel.h
@@ -0,0 +1,148 @@
+// NoiseLevel.h: interface for the CNoiseLevel class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_NOISELEVEL_H__5D3B57CE_14F1_4CD6_8D25_25471A55B874__INCLUDED_)
+#define AFX_NOISELEVEL_H__5D3B57CE_14F1_4CD6_8D25_25471A55B874__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+class CSISBuffer;
+typedef unsigned char BYTE;
+
+// 1. FindXNoiseLevel 拌凯肺 Noise甫 单捞磐 犬焊.
+// 2. RecommendThreshold(1, 2, 3) 3啊瘤 规过栏肺 Threshold 档免.
+
+
+class AFX_EXT_CLASS CNoiseLevel  
+{
+public:
+	int m_TotalCount;
+	int	m_OverCount;
+	double	m_Ratio;
+	int	m_LimitCount;
+	int m_pnNoisePixel[256];
+	int m_FoundThreshold;
+	int	m_Width, m_Height;
+
+	void ResetCount()
+	{
+		for(int i= 0; i< 256; i++)
+		{
+			m_pnNoisePixel[i]= 0;
+		}
+		m_TotalCount= 0;
+		m_FoundThreshold= -1;
+	}
+	int GetNoiseCount(int level)
+	{
+		if(level < 0)
+			level= -level;
+		ASSERT(level < 256);
+		return m_pnNoisePixel[level];
+	}
+	int CountNoise(int level)
+	{
+		if(level < 0)
+			level= -level;
+		ASSERT(level < 256);
+		m_pnNoisePixel[level]++;
+		m_TotalCount++;
+		return m_pnNoisePixel[level];
+	}
+
+
+public:
+	// 1. 畴捞令啊 奴 巴何磐 沤祸秦 limitCount 焊促 臭篮 痢捞 惯积窍搁 Threshold肺 眠玫.. 柄昌茄 捞固瘤俊 利钦.
+	int RecommendThreshold1(double fNoiseLimit= 0.001)
+	{
+		m_LimitCount= (int)(m_TotalCount*fNoiseLimit);
+		if(m_LimitCount < 1)
+			m_LimitCount= 1;
+		return RecommendThreshold(m_LimitCount);
+	}
+	int RecommendThreshold(int nLimitCount)
+	{
+		m_OverCount= 0;
+		for(int i= 255; i>= 0; i--)
+		{
+			m_OverCount+= m_pnNoisePixel[i];
+			if(m_pnNoisePixel[i] >= nLimitCount)
+			{
+				m_OverCount-= m_pnNoisePixel[i];
+				m_FoundThreshold= i;
+				return m_FoundThreshold;
+			}
+		}
+		m_FoundThreshold= 0;
+		return 0;
+	}
+
+	// 2. 畴捞令啊 累篮 巴何磐 矫累秦 limitcount捞窍肺 冻绢瘤扁 矫累窍绰 痢阑 茫绰促... 畴捞令 腹篮 捞固瘤俊 利钦.
+	int RecommendThreshold2(double fNoiseLimit= 0.001)
+	{
+		m_OverCount= m_TotalCount;
+		m_LimitCount= (int)(m_TotalCount*fNoiseLimit);
+		if(m_LimitCount < 1)
+			m_LimitCount= 1;
+		for(int i= 0; i< 256; i++)
+		{
+			m_OverCount-= m_pnNoisePixel[i];
+			if(m_pnNoisePixel[i] <= m_LimitCount)
+			{
+				m_FoundThreshold= i;
+				return i;
+			}
+		}
+		m_FoundThreshold= 0;
+		return 0;
+	}
+
+	// 3. 畴捞令啊 臭篮 率俊辑 何磐 穿利利栏风促啊 拌魂秦辑 limitcount甫 逞绰 仇阑 Threshold肺 眠玫. 救傈户俊 利钦.
+	int RecommendThreshold3(double fNoiseLimit= 0.001)
+	{
+		m_LimitCount= (int)(m_TotalCount*fNoiseLimit);
+		if(m_LimitCount < 1)
+			m_LimitCount= 1;
+		return RecommendThresholdAccumulative(m_LimitCount);
+	}
+	// Threshold甫 撤苗啊搁 nNoiseLimet 俺荐 捞惑狼 搬窃 侨伎捞 惯积窍搁 弊 急阑 Threshold肺 茄促.
+	int RecommendThresholdAccumulative(int nLimitCount)
+	{
+		int nCount= 0;
+		for(int i= 255; i>= 0; i--)
+		{
+			nCount+= m_pnNoisePixel[i];
+			if(nCount >= nLimitCount)
+			{
+				m_OverCount= nCount-  m_pnNoisePixel[i];
+				m_FoundThreshold= i;
+				return i;
+			}
+		}
+		m_FoundThreshold= 0;
+		return 0;
+	}
+
+public:
+	CNoiseLevel()			{ResetCount();}
+
+	BOOL FindXNoiseLevel(CSISBuffer &buffer, double xPitch, BOOL b32= TRUE);
+	BOOL FindYNoiseLevel(CSISBuffer &buffer, double yPitch, BOOL b23= TRUE);
+
+	BOOL DrawNoisePixel2Left(CSISBuffer &buffer, CSISBuffer &buffer2, double pitch, int threshold, BYTE color, BOOL b32= TRUE);
+	BOOL DrawNoisePixel2Right(CSISBuffer &buffer, CSISBuffer &buffer2, double pitch, int threshold, BYTE color, BOOL b32= TRUE);
+	BOOL DrawNoisePixel2Top(CSISBuffer &buffer, CSISBuffer &buffer2, double pitch, int threshold, BYTE color, BOOL b23= TRUE);
+	BOOL DrawNoisePixel2Bottom(CSISBuffer &buffer, CSISBuffer &buffer2, double pitch, int threshold, BYTE color, BOOL b23= TRUE);
+	void DrawNoiseLevel(CDC *pDC);
+
+	//////////////////////////////////////////////////////////////////////////
+	// Focus Value
+	int	CalFocusValue(CSISBuffer &buffer);
+
+};
+
+#endif // !defined(AFX_NOISELEVEL_H__5D3B57CE_14F1_4CD6_8D25_25471A55B874__INCLUDED_)
diff --git a/Common_Class/SISBuffer/Header/SISBuffer.h b/Common_Class/SISBuffer/Header/SISBuffer.h
new file mode 100644
index 0000000..c8c6652
--- /dev/null
+++ b/Common_Class/SISBuffer/Header/SISBuffer.h
@@ -0,0 +1,14 @@
+// SISBuffer.h: interface for the CSISBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MOSISBUFFER_H__725D6951_3046_4A17_8DA4_77C83FE85118__INCLUDED_)
+#define AFX_MOSISBUFFER_H__725D6951_3046_4A17_8DA4_77C83FE85118__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "InspectionBuffer.h"
+
+#endif // !defined(AFX_MOSISBUFFER_H__725D6951_3046_4A17_8DA4_77C83FE85118__INCLUDED_)
diff --git a/Common_Class/SISBuffer/Header/SISMatch.h b/Common_Class/SISBuffer/Header/SISMatch.h
new file mode 100644
index 0000000..883616e
--- /dev/null
+++ b/Common_Class/SISBuffer/Header/SISMatch.h
@@ -0,0 +1,99 @@
+// SISMatch.h: interface for the CSISMatch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MOSISMATCH_H__CB8CE1CD_6F94_4C2E_858D_8182CEF9A453__INCLUDED_)
+#define AFX_MOSISMATCH_H__CB8CE1CD_6F94_4C2E_858D_8182CEF9A453__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "InspectionBuffer.h"
+
+
+
+typedef struct stSISMatchResult
+{
+	double m_X, m_Y, m_Score;
+	stSISMatchResult()	{	Invalidate();	}
+	void Invalidate()		{ m_X= 0, m_Y= 0; m_Score= 0;}
+	BOOL IsValid()			{	return m_Score != 0;	}
+	BOOL MatchBetterThan(stSISMatchResult &result)	{	return m_Score > result.m_Score;}
+
+	void OffsetBig(CRect &rect)		{	m_X += rect.left;	m_Y	+= rect.top;}	// BigBuffer 谅钎肺 函券.
+	void OffsetSmall(CRect &rect)	{	m_X -= rect.left;	m_Y -= rect.top;}	// SmallBuffer狼 盔痢捞 概莫等 痢阑 茫绊磊 茄促.
+	void Offset(double x, double y)	{	m_X+= x;	m_Y+= y;}
+
+	void CenterOrigin(CRect &rect)
+	{// width, height 啊 圈荐 老 版快.. 0.5啊 吝缴痢烙阑 疙缴 肚 疙缴.
+		double dx= (double)rect.Width()/2;
+		double dy= (double)rect.Height()/2;
+		Offset(-dx, -dy);
+	}
+}CMatchPt;
+
+
+typedef struct stSISMatchParam
+{
+
+	// 袍敲复 皋家靛.
+	enum{CV_TM_SQDIFF= 0, CV_TM_SQDIFF_NORMED= 1, CV_TM_CCORR= 2, CV_TM_CCORR_NORMED= 3, CV_TM_CCOEFF= 4, CV_TM_CCOEFF_NORMED= 5};
+
+	int			m_Method;// 0, 1, 2, 3, 4, 5
+	int			m_Pyramid;
+	double		m_Acceptance;// 0~ 1
+	BOOL		m_bInterpol;
+
+	stSISMatchParam(int pyramid= 2, double acceptance= 0.3, BOOL bUseInterpolate= TRUE, int method= CV_TM_CCOEFF_NORMED)
+		: m_Pyramid(pyramid), m_Acceptance(acceptance), m_bInterpol(bUseInterpolate),  m_Method(method)
+	{	}
+	int			GetMulti(){return 1<<m_Pyramid;}
+	void		ValidateParam()
+	{
+		if(m_Pyramid < 0)
+			m_Pyramid= 0;
+		if(m_Pyramid > 4)
+			m_Pyramid= 4;
+
+		if(m_Acceptance > 0.99)
+			m_Acceptance= 0.99;
+	}
+}CMatchParam;
+
+
+class AFX_EXT_CLASS CSISMatch  
+{
+	CSISBuffer	m_BigBuffer, m_SmallBuffer;// 盔夯 滚欺(措府滚欺)
+
+	CRect m_BigRect, m_SmallRect;// 概莫 roi.
+	stSISMatchParam m_MatchParam;// 概莫 颇扼固磐.
+	class CMatchImpl *m_pMatchImpl;
+
+/*
+	struct _IplImage *m_pBigImage, *m_pSmallImage, *m_pResultImage;// 乔扼固靛 概莫侩 捞固瘤.
+ 	struct _IplImage *m_pBigImage2, *m_pSmallImage2, *m_pResultImage2;// 惑技 概莫侩 捞固瘤.
+*/
+public:
+	CSISMatch();
+	virtual ~CSISMatch();
+
+public:
+	BOOL DoTemplateMatch(stSISMatchResult &result, stSISMatchParam &matchParam);
+private:
+	BOOL DoTemplateMatch2(stSISMatchResult &result);
+	
+public:
+	BOOL SetBigImage(CSISBuffer buffer, CRect &roi);// 菩畔阑 茫阑 菩畔 捞固瘤.
+	BOOL SetSmallImage(CSISBuffer buffer, CRect &roi);// 概莫侩 袍敲复 捞固瘤.
+	BOOL SetBigImage2(CSISBuffer buffer, CRect &roi);// 菩畔阑 茫阑 菩畔 捞固瘤.
+	BOOL SetSmallImage2(CSISBuffer buffer, CRect &roi);// 概莫侩 袍敲复 捞固瘤.
+public:
+	void NormalizeMatchRect(CRect &rect);// 概莫俊 嘎霸 荐流,荐乞 剧规氢 4byte 倔扼牢 荤捞令甫 嘎冕促.
+	BOOL SetImage32f(struct _IplImage **pImage, CSISBuffer *buffer, CRect &roi);// 捞固瘤甫 32bit float屈怕狼 summation滚欺肺 积己茄促.
+	BOOL MakeImage(struct _IplImage **pImage, int width, int height);
+	BOOL SetImage(struct _IplImage **pImage, CSISBuffer *buffer, CRect &roi);// 捞固瘤甫 8bit(1byte) 捞固瘤 弊措肺 概莫俊 嘎霸 父电促.
+	
+};
+
+#endif // !defined(AFX_MOSISMATCH_H__CB8CE1CD_6F94_4C2E_858D_8182CEF9A453__INCLUDED_)
diff --git a/Common_Class/SISBuffer/Header/SISMath.h b/Common_Class/SISBuffer/Header/SISMath.h
new file mode 100644
index 0000000..992abbd
--- /dev/null
+++ b/Common_Class/SISBuffer/Header/SISMath.h
@@ -0,0 +1,169 @@
+// SISMath.h: interface for the CSISMath class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MOSISMATH_H__00204741_878C_42AB_8757_3EE86C292EFD__INCLUDED_)
+#define AFX_MOSISMATH_H__00204741_878C_42AB_8757_3EE86C292EFD__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "InspectionBuffer.h"
+
+typedef __int64 int64;
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+
+
+/*
+
+// defect count 扁馆栏肺 cutoff point 甫 茫酒 霖促.
+// AddCountData甫 烹茄 规过苞 FindCutoff_Continue甫 烹茄 规过 滴啊瘤啊 乐促.
+class AFX_EXT_CLASS CCutoffFind
+{
+	int m_nContinuousCutoff;
+	int *m_pCountData;
+public:
+	int m_nCountData;
+	CCutoffFind()
+	{
+		m_nCountData= 0;
+		m_pCountData= NULL;
+	}
+	~CCutoffFind()
+	{
+		if(m_pCountData)
+			delete m_pCountData;
+	}
+	BOOL SetSize(int nData)
+	{
+		m_nCountData= nData;
+		if(m_pCountData)
+			delete m_pCountData;
+		m_pCountData= new int[nData];
+		return TRUE;
+	}
+	
+	// 鉴瞒利栏肺 龋免登搁 cutoff牢瘤甫 魄喊秦 楷加 cutoff count甫 府畔秦 霖促.
+	int AddCountData(int data, int nCutoff)
+	{
+		if(data < nCutoff)
+		{
+			m_nContinuousCutoff++;
+			return m_nContinuousCutoff;
+		}
+		m_nContinuousCutoff= 0;
+		return 0;
+	}
+	
+	
+	void SetCountData(int iData, int data)
+	{
+		m_pCountData[iData]= data;
+	}
+	// 沥,开规氢栏肺 line by line 八荤窍哥 Cutoff_Continuous甫 茫酒 辰促.  Cutoff_Continuous啊 绝栏搁 false, Cutoff 困摹绰 沥规氢 扁霖狼 index捞促.
+	// nContinue俺荐 捞惑 瘤加利栏肺 cutoff啊 积败具 Cutoff_Continuous肺 埃林茄促.
+	BOOL FindCutoff_Continuous(BOOL bForwardScan, int nCutoff, int nContinue, int &iForwardResult)
+	{
+		int i;
+		int nOccur= 0;
+		
+		if(bForwardScan)
+		{
+			for(i= 0; i< m_nCountData; i++)
+			{
+				if(m_pCountData[i] > nCutoff)
+				{
+					nOccur++;
+					if(nOccur >= nContinue)
+					{
+						iForwardResult= i- nContinue+ 1;
+						return TRUE;
+					}
+				}else
+				{
+					nOccur= 0;
+				}
+			}
+			return FALSE;
+		}
+		
+		for(i= m_nCountData-1; i >= 0; i--)
+		{
+			if(m_pCountData[i] > nCutoff)
+			{
+				nOccur++;
+				if(nOccur >= nContinue)
+				{
+					iForwardResult= i+ nContinue- 1;
+					return TRUE;
+				}else
+				{
+					nOccur= 0;
+				}
+			}
+		}
+		return FALSE;
+	}
+};
+*/
+
+// 1. Sum of Absolute Differences
+// 2. Cross-Correlation Values.
+// 3. Minimum or Maximum on a certain curve.
+class AFX_EXT_CLASS CSISMath
+{
+public:
+
+	// 1. Get Sum of Absolute Differences on the specific area(Rect).
+	static INT64	GetAbsDiff(CSISBuffer buffer, CRect rect, CSISBuffer buffer2, int x2, int y2)
+	{
+		return GetAbsDiff(buffer, rect.left, rect.top, rect.Width(), rect.Height(), buffer2, x2, y2);
+	}
+	static INT64	GetAbsDiff(CSISBuffer buffer, int x1, int y1, int width, int height, CSISBuffer buffer2, int x2, int y2);
+	static INT64	GetAbsDiff(BYTE* pData, BYTE* pData2, int len);
+
+	// 2. Get Cross Correlation Value on the specific area(Rect).
+	static int64	Get_CCU8( CSISBuffer buffer1, int x1, int y1, int width, int height, CSISBuffer buffer2, int x2, int y2);
+	static int64	Get_CCU8_A( const uchar * vec1, int len );
+	static int64	Get_CCU8_AUA( const uchar * vec1, const uchar * vec2, int len );
+	static int64	Get_CCU8_UA( const uchar * vec1, const uchar * vec2, int len );
+	static int64	Get_CCU8_UA( const uchar * vec1, int len );
+	static int64	Get_CCU16_A( const ushort * vec1, int len );
+	static int64	Get_CCU16_AUA( const ushort * vec1, const ushort * vec2, int len );
+	static int64	Get_CCU16_UA( const ushort * vec1, const ushort * vec2, int len );
+	static int64	Get_CCU16_UA( const ushort * vec1, int len );
+
+	static int64	SumPixels_8u( const uchar * vec, int len );
+	static int64	SumPixels_16u( const ushort * vec, int len );
+
+
+	// 3. y= -a(x+ b)^2+ c => 弥家蔼阑 啊瘤绰 器拱急俊辑 弥家蔼阑 茫绰促.
+	static double	SearchMinimum(int64 *pData, int nData);
+	// 3. y= a(x+ b)^2+ c => 弥措蔼阑 啊瘤绰 器拱急俊辑 弥措蔼阑 茫绰促.
+	static double	SearchMaximum(int64 *pData, int nData);
+
+	// 4. 
+	static double	GetAverage(CSISBuffer buffer);
+	static INT64	GetSum(CSISBuffer buffer);
+
+	// 5.
+//	static void		CountLineDefect(CSISBuffer bufer, double xPitch, double yPitch, CCutoffFind &find);
+
+public: // useless
+	static int64	Get_CCU16_A( const ushort * vec1, const ushort * vec2, int len );
+	static int64	Get_CCU8_A( const uchar * vec1, const uchar * vec2, int len );
+
+public: // for omp
+	static int64	OMP_CCU8_A(const uchar * vec1, int len);
+	static int64	OMP_CCU8_UA(const uchar *vec1, int len);
+	static int64	OMP_CCU8_AUA( const uchar * vec1, const uchar * vec2, int len );
+
+	
+	static int64	OMP_CCU16_A( const ushort * vec1, int len );
+	static int64	OMP_CCU16_UA( const ushort * vec1, int len );
+	static int64	OMP_CCU16_AUA( const ushort * vec1, const ushort * vec2, int len );
+};
+
+#endif // !defined(AFX_MOSISMATH_H__00204741_878C_42AB_8757_3EE86C292EFD__INCLUDED_)
diff --git a/Common_Class/SISBuffer/Header/SISPitch.h b/Common_Class/SISBuffer/Header/SISPitch.h
new file mode 100644
index 0000000..c5c77ae
--- /dev/null
+++ b/Common_Class/SISBuffer/Header/SISPitch.h
@@ -0,0 +1,167 @@
+// SISPitch.h: interface for the CSISPitch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MOSISPITCH_H__CA80B4A7_F0BD_4AEA_A81B_CF86C09EC7C1__INCLUDED_)
+#define AFX_MOSISPITCH_H__CA80B4A7_F0BD_4AEA_A81B_CF86C09EC7C1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+#include "InspectionBuffer.h"
+
+
+// type T俊 措茄 历厘家 俺充(hive=国烹) 盔夯 : SISRecipe 俊 粮犁.
+// 硅凯 屈侥栏肺 instance T甫 历厘窍哥 SetSize甫 烹秦 Size甫 疵副 荐 乐促.
+// 梨篮 皋葛府 累诀阑 弥家拳 棺 Mem free 救沥己阑 犬焊 窍扁 困秦 荤侩茄促.
+typedef __int64 int64;
+
+template<typename T>
+class CSISHive1B
+{
+protected:
+	int		m_Size;
+	int		m_Space;
+	T*		m_Pointers;
+public:
+	CSISHive1B()
+	{
+		m_Pointers= NULL;
+		m_Space= m_Size= 0;
+	}
+	~CSISHive1B()
+	{
+		if(m_Pointers)
+			delete[] m_Pointers;
+	}
+
+	CSISHive1B& operator =(CSISHive1B& Hive)
+	{
+		if( SetSize(Hive.m_Size, FALSE))
+			memcpy(m_Pointers, Hive.m_Pointers, sizeof(T)*Hive.GetSize());
+		return *this;
+	}
+
+	int		GetSize(){return m_Size;}
+	BOOL	SetSize(int size, BOOL bAppend)
+	{
+		ASSERT(size > 0);
+		
+		if(m_Pointers == NULL)
+		{
+			m_Pointers= new T[size];
+			if(m_Pointers == NULL)
+				return FALSE;
+			m_Space= m_Size= size;
+			return TRUE;
+		}
+		if(m_Space < size)
+		{
+			T *pOld= m_Pointers;
+			m_Pointers= new T[size];
+			if(m_Pointers == NULL)
+			{
+				m_Pointers= pOld;
+				m_Size= 0;
+				return FALSE;
+			}
+			
+			if(bAppend)
+				memcpy(m_Pointers, pOld, sizeof(T)*m_Size);
+			
+			delete[] pOld;
+			
+			m_Space= m_Size= size;
+			return TRUE;
+		}
+		m_Size= size;
+		return TRUE;
+	}
+
+	void	Delete(int i)
+	{
+		T* pData= GetData(i);
+		if(pData == NULL)
+			return;
+		int size= GetSize()- 1- i;
+		if(size > 0)
+			memcpy(GetData(i), GetData(i+1), sizeof(T)*size);
+		SetSize(GetSize()- 1, FALSE);
+	}
+
+	T*		Add()
+	{
+		int iAdd= m_Size;
+		SetSize(m_Size+ 1, TRUE);
+		return GetData(iAdd);
+	}
+
+	BOOL	Swap(int a, int b)
+	{
+		T* pa= GetData(a);
+		T* pb= GetData(b);
+		if(pa == NULL || pb == NULL)
+			return FALSE;
+
+		T temp= *pa;
+		*pa= *pb;
+		*pb= temp;
+		return TRUE;
+	}
+
+	T*		GetData(int i)
+	{
+		if(i < 0 || i > GetSize()- 1)
+			return NULL;
+		return m_Pointers+ i;
+	}
+};
+
+
+
+
+class AFX_EXT_CLASS CSISPitch
+{
+public:
+	double	m_xPitch;			// 拌魂等 乔摹.
+	double	m_yPitch;
+
+	CRect	m_Rect;				// 八荤 康开.
+	
+	double	m_xPitchOrigin;		// 扁霖 乔摹 - 林绢柳 乔摹. 
+	double	m_yPitchOrigin;
+	long	m_CheckWidth;		// 乔摹 乞啊且 康开 width
+	long	m_CheckHeight;
+	long	m_xSearchRange;		// 扁霖 乔摹 +- Range 康开 父怒 八荤.
+	long	m_ySearchRange;
+	
+//	CSISHive1B<int64>	m_DifferenceHive;
+	
+	CSISPitch(double xPitch, double yPitch, long CheckWidth, long CheckHeight, long xSearchRange= 4, long ySearchRange= 4)
+	{
+		m_xPitchOrigin= xPitch;
+		m_yPitchOrigin= yPitch;
+		m_CheckWidth= CheckWidth;
+		m_CheckHeight= CheckHeight;
+		m_xSearchRange= xSearchRange;
+		m_ySearchRange= ySearchRange;
+		m_xPitch= 0;
+		m_yPitch= 0;
+	}
+	CSISPitch()
+	{
+		m_xPitchOrigin= 100.0;// 100.0 += m_SearchRange 父怒 八刘.
+		m_yPitchOrigin= 100.0;// 100.0 += m_SearchRange 父怒 八刘.
+		m_CheckWidth= 100;// widht 100 呈厚肺 厚背 八刘.
+		m_CheckHeight= 100;// Height 100 呈厚肺 厚背 八刘.
+		m_xSearchRange= 4;// PITCH +- 4 俊辑 八刘.
+		m_ySearchRange= 4;// PITCH +- 4 俊辑 八刘.
+		m_xPitch= 0;
+		m_yPitch= 0;
+	}
+	
+	BOOL CheckPitch(CSISBuffer buffer, CRect rect);
+};
+#endif // !defined(AFX_MOSISPITCH_H__CA80B4A7_F0BD_4AEA_A81B_CF86C09EC7C1__INCLUDED_)
diff --git a/Common_Class/SISBuffer/InspectionBuffer.cpp b/Common_Class/SISBuffer/InspectionBuffer.cpp
new file mode 100644
index 0000000..8edf2fe
--- /dev/null
+++ b/Common_Class/SISBuffer/InspectionBuffer.cpp
@@ -0,0 +1,514 @@
+// InspectionBuffer.cpp: implementation of the CSISBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "InspectionBuffer.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+void CSISBuffer::MemSet(BYTE val)
+{
+	memset(GetDataAddress(), val, GetDataSize());
+	return;
+	for(int i= 0; i< GetHeight(); i++)
+	{
+		memset(GetDataAddress(0, i), val, GetWidth());
+	}
+}
+
+void CSISBuffer::FlipUpDown()
+{
+	int hh= GetHeight()/2;
+	int eh= GetHeight()- 1;
+	LPBYTE lpBuffer = new BYTE[hh*GetDataWidth()];
+	
+	memcpy(lpBuffer, GetDataAddress(), hh*GetDataWidth());
+	
+	CSISBuffer temp(lpBuffer, GetWidth(), hh);
+	for (int i = 0; i <hh; i++)
+	{
+		memcpy(GetDataAddress(0, i), GetDataAddress(0, eh- i), GetDataWidth());
+		memcpy(GetDataAddress(0, eh-i), temp.GetDataAddress(0, i), GetDataWidth());
+	}
+	
+	delete [] lpBuffer;
+}
+
+BOOL CSISBuffer::IsValidBuffer()
+{
+	if(!m_pData)
+		return FALSE;
+	if(GetWidth() < 1 || GetHeight() < 1)
+		return FALSE;
+	return TRUE;
+}
+
+BYTE CSISBuffer::GetPixel(double fx, int y)
+{
+	int x= (int)fx;
+	double second= fx- x;
+	double first= 1- second;
+	BYTE* pData= m_pData+ x+ y*GetDataWidth();
+	first= first*(*(pData));
+	second= second*(*(pData+ 1));
+	return (BYTE)(first+ second);
+}
+
+BYTE CSISBuffer::GetPixel(int x, double fy)
+{
+	int y= (int)fy;
+	double second= fy- y;
+	double first= 1- second;
+	BYTE* pData= m_pData+ x+ y*GetDataWidth();
+	first= first*(*(pData));
+	second= second*(*(pData+ GetDataWidth()));
+	return (BYTE)(first+ second);
+}
+
+CRect CSISBuffer::IntersectRect(CRect &rectFrom)
+{
+	CRect rect= rectFrom;
+	if(rect.left < 0)
+		rect.left= 0;
+	if(rect.top < 0)
+		rect.top= 0;
+	if(rect.right > GetWidth())
+		rect.right= GetWidth();
+	if(rect.bottom > GetHeight())
+		rect.bottom= GetHeight();
+	return rect;
+}
+
+int CSISBuffer::GetXDiff22(int x, int y, double xPitch)
+{
+	int ret;
+	double xRef= x+ xPitch;
+	int iRef= (int)xRef;
+	double r2= xRef- iRef;
+	double r1= 1- r2;
+
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(iRef, y);
+
+	ret= *pData+ *(pData+ 1);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+ 1);
+
+	ret-= (int)((*pData2)*r1+ *(pData2+ 1)+ *(pData2+2)*r2);
+	pData2+= GetDataWidth();
+	ret-= (int)((*pData2)*r1+ *(pData2+ 1)+ *(pData2+2)*r2);
+
+	return ret;
+}
+
+int CSISBuffer::GetYDiff22(int x, int y, double yPitch)
+{
+	int ret;
+	double yRef= y+ yPitch;
+	int iRef= (int)yRef;
+	double r2= yRef- iRef;
+	double r1= 1- r2;
+
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(x, iRef);
+
+	ret= *pData+ *(pData+ 1);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+ 1);
+
+	ret-= (int)(((*pData2)+ *(pData2+ 1))*r1);
+	pData2+= GetDataWidth();
+	ret-= (int)(((*pData2)+ *(pData2+ 1)));
+	pData2+= GetDataWidth();
+	ret-= (int)(((*pData2)+ *(pData2+ 1))*r2);
+
+	return ret;
+}
+
+int CSISBuffer::GetDiff32(int x, int y, double xPitch)
+{
+	int		ret;
+	double	xRef= x+ xPitch;
+	int		iRef= (int) xRef;
+	double	pb= xRef- iRef;
+	double	pa= 1- pb;
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(iRef, y);
+
+	ret= *pData+ *(pData+ 1)+ *(pData+2);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+ 1)+ *(pData+2);
+	
+	ret-= (int)((*pData2)*pa+ *(pData2+ 1)+ *(pData2+2)+ (*(pData2+3))*pb);
+	pData2+= GetDataWidth();
+	ret-= (int)((*pData2)*pa+ *(pData2+ 1)+ *(pData2+2)+ (*(pData2+3))*pb);
+
+	return ret;
+}
+
+int CSISBuffer::GetDiff23(int x, int y, double yPitch)
+{
+	int		ret;
+	double	yRef= y+ yPitch;
+	int		iRef= (int) yRef;
+	double	pb= yRef- iRef;
+	double	pa= 1- pb;
+	BYTE	*pData= GetDataAddress(x, y);
+	BYTE	*pData2= GetDataAddress(x, iRef);
+
+	ret= *pData+ *(pData+1);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+1);
+	pData+= GetDataWidth();
+	ret+= *pData+ *(pData+1);
+
+	ret-= (int)((*pData2)*pa+ (*(pData2+1))*pa);
+	pData2+= GetDataWidth();
+	ret-= *pData2+ *(pData2+1);
+	pData2+= GetDataWidth();
+	ret-= *pData2+ *(pData2+1);
+	pData2+= GetDataWidth();
+	ret-= (int)((*pData2)*pb+ (*(pData2+1))*pb);
+
+	return ret;
+}
+
+BOOL CSISBuffer::CopyBtoA(CSISBuffer &aBuffer, int x, int y, CSISBuffer &bBuffer, CRect &rectFrom)
+{
+	if(!aBuffer.IsValidBuffer())
+		return FALSE;
+	if(!bBuffer.IsValidBuffer())
+		return FALSE;
+
+	int xx= 0, yy= 0;
+	int width, ey;
+
+
+	CRect rect= rectFrom;
+	rect.NormalizeRect();
+	rect= bBuffer.IntersectRect(rect);
+	if(rectFrom.top < 0)
+		y-= rectFrom.top;
+
+	if(rectFrom.left < 0)
+		x-= rectFrom.left;
+
+	width= rect.Width();
+	ey= rect.Height();
+
+	if(x+ rect.Width() > aBuffer.GetWidth())
+	{
+		width= aBuffer.GetWidth()- x;
+	}
+	if(x < 0)
+	{
+		xx= -x;
+		width-= xx;
+	}
+	if(y < 0)
+	{
+		yy= -y;
+	}
+	if(y+ rect.Height() > aBuffer.GetHeight())
+	{
+		ey= aBuffer.GetHeight()- y;
+	}
+
+
+	if(width < 0)
+		return FALSE;
+
+	for(;yy < ey; yy++)
+	{
+		memcpy(aBuffer.GetDataAddress(x+ xx, y+ yy), bBuffer.GetDataAddress(rect.left+ xx, rect.top+ yy), width);
+	}
+
+	return TRUE;
+}
+
+void CSISBuffer::RotateImage()
+{
+	if(IsValidBuffer() == FALSE)
+		return;
+
+	BYTE cTemp;
+	
+	for(int h = 0; h < m_Height; h++)
+	{
+		for(int w = 0; w < m_Width / 2; w++)
+		{
+			cTemp = m_pData[w + h * m_DataWidth];
+			m_pData[w + h * m_DataWidth] = m_pData[(m_Width - 1 - w) + (m_Height - 1 - h) * m_DataWidth];
+			m_pData[(m_Width - 1 - w) + (m_Height - 1 - h) * m_DataWidth] = cTemp;
+		}
+	}	
+}
+
+
+CBufferAttach::CBufferAttach(CString &name) : m_FileName(name)
+{
+	m_bFileMade= FALSE;
+	m_FileName= name;
+}
+
+CBufferAttach::~CBufferAttach()
+{
+	if(m_pImageFileHeader)
+		delete m_pImageFileHeader;
+}
+
+BOOL CBufferAttach::MakeFile()
+{
+	m_pImageFileHeader= new stImageFileHeader;
+	CFile file;
+	if(! file.Open(m_FileName, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary))
+	{
+		//file.Close();
+		return FALSE;
+	}
+	//file.Seek(0, CFile::begin);
+	file.Write(&m_pImageFileHeader->fileHeader, m_pImageFileHeader->fileHeader.bfOffBits);
+	file.Close();
+	m_bFileMade= TRUE;
+	return TRUE;
+}
+
+void CBufferAttach::AttachToFile(CSISBuffer &buffer)
+{
+	CFile file;
+
+	if(! m_bFileMade)
+	{
+		MakeFile();
+	}
+	
+	int width= buffer.GetWidth();
+	int height= m_pImageFileHeader->GetHeight()+ buffer.GetHeight();
+	
+	m_pImageFileHeader->ChangeSize(width, height);
+
+	if(! file.Open(m_FileName, CFile::modeWrite | CFile::typeBinary))
+	{
+		//file.Close();
+		return;
+	}
+	
+	file.Seek(0, CFile::begin);
+	file.Write(&m_pImageFileHeader->fileHeader, m_pImageFileHeader->fileHeader.bfOffBits);
+ 	file.Seek(0, CFile::end);
+
+	int wData= CSISBuffer::ChangeDataWidth(buffer.GetWidth());
+	for(int i= buffer.GetHeight()- 1; i >= 0; i--)
+	{
+		file.Write(buffer.GetDataAddress(0, i), wData);
+	}
+	file.Close();
+}
+
+BOOL CCopyBuffer::FillBuffer(CSISBuffer& buffer, int x, int y)
+{
+	int end= y+ GetHeight();
+	int yy;
+	for(yy= 0; y< end; y++, yy++)
+	{
+		memcpy(GetDataAddress(0, yy), buffer.GetDataAddress(x, y), GetWidth());
+	}
+	return TRUE;
+}
+
+COwnerBuffer::COwnerBuffer(int width, int height)
+	: CSISBuffer(NULL, width, height)
+{
+	m_DataSpace= 0;
+	SetSize(width, height);
+}
+
+void COwnerBuffer::ReleaseSpace()
+{
+	if(m_pData)
+		delete[] m_pData;
+	CSISBuffer::SetSize(0, 0);
+	m_DataSpace= 0;
+	m_pData= NULL;
+}
+
+BOOL COwnerBuffer::SetSize(int width, int height)
+{
+	int tempwidth= CSISBuffer::ChangeDataWidth(width);//(width+ 3)/4*4;
+	int space= tempwidth*height;
+	if(space < 1)
+	{
+		CSISBuffer::SetSize(0, 0);
+		return FALSE;
+	}
+
+	if(m_DataSpace < space)
+	{
+		ReleaseSpace();
+	}else
+	{
+		CSISBuffer::SetSize(width, height);
+		return IsValidBuffer();
+	}
+
+	if(m_pData == NULL)
+	{
+		m_pData= new BYTE[space+ 16];
+		m_DataSpace= space;
+	}
+	CSISBuffer::SetSize(width, height);
+
+	return IsValidBuffer();
+}
+
+COwnerBuffer::~COwnerBuffer()
+{
+	if(m_pData)
+	{
+		delete[] m_pData;
+		m_pData= NULL;
+	}
+}
+/*
+void stImageFileHeader::ChangeSize(int width, int height)// void ChangeHeader(int width, int height)
+{
+	infoHeader.biWidth = width;
+	infoHeader.biHeight = height;
+	stBufferSize bufferSize(width, height);
+	infoHeader.biSizeImage = bufferSize.GetDataSize();//width*height*1;
+
+//		fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256;
+	fileHeader.bfSize = fileHeader.bfOffBits + infoHeader.biSizeImage;
+}
+
+void stImageFileHeader::ReadFromFile(CString &fileName)
+{
+	CFile file;
+	file.Open(fileName, CFile::modeCreate | CFile::typeBinary);
+	ReadFromFile(file);
+	file.Close();
+}
+void stImageFileHeader::ReadFromFile(CFile &file)
+{
+	file.Seek(0, SEEK_SET);
+	file.Read(&fileHeader, sizeof(BITMAPFILEHEADER));
+	file.Read(&infoHeader, sizeof(BITMAPINFOHEADER));
+	file.Read(quad, sizeof(RGBQUAD)*256);
+	ChangeSize(infoHeader.biWidth, infoHeader.biHeight);
+}
+*/
+void CDynamicBuffer::FillBuffer(CSISBuffer &buffer, CRect &rect)
+{
+	SetSize(rect.Width(), rect.Height());
+	CCopyBuffer copyer(*this);
+	copyer.FillBuffer(buffer, rect.left, rect.top);
+}
+CSISImageBuffer::CSISImageBuffer()
+	:CSISBuffer(NULL, 0, 0)
+{
+	m_pFileHeader= new stImageFileHeader;
+	m_DataSpace= 0;
+}
+CSISImageBuffer::~CSISImageBuffer()
+{
+ 	if(m_pData)
+ 		delete[] m_pData;
+	if(m_pFileHeader)
+		delete m_pFileHeader;
+}
+
+BOOL CSISImageBuffer::SetSize(int width, int height)
+{
+	int tempwidth= CSISBuffer::ChangeDataWidth(width);//(width+ 3)/4*4;
+	int space= tempwidth*height;
+	if(space < 1)
+		return FALSE;
+	
+	if(m_DataSpace < space)
+	{
+		ReleaseImage();
+	}
+	
+	if(m_pData == NULL)
+	{
+		m_pData= new BYTE[space];
+		m_DataSpace= space;
+	}
+	CSISBuffer::SetSize(width, height);
+	m_pFileHeader->ChangeSize(GetWidth(), GetHeight());
+	
+	return IsValidBuffer();
+}
+
+void CSISImageBuffer::ReleaseImage()
+{
+	SetSize(0, 0);
+	if(m_pData)
+		delete[] m_pData;
+	m_pData= NULL;
+}
+
+BOOL CSISImageBuffer::ReadFromFile(CString &fileName)
+{
+	CFile file;
+	if(file.Open(fileName, CFile::modeRead | CFile::typeBinary))
+	{
+		m_pFileHeader->ReadFromFile(file);
+		if(SetSize(m_pFileHeader->GetWidth(), m_pFileHeader->GetHeight()))
+		{
+			file.Seek(m_pFileHeader->GetDataOffset(), SEEK_SET);
+			for(int i= GetHeight()-1; i>= 0; i--)
+			{
+				file.Read(GetDataAddress(0, i), GetDataWidth());
+			}
+			//file.Read(m_pData, m_pFileHeader->GetDataSize());
+		}
+	}
+	else
+		return FALSE;
+
+	file.Close();
+	return TRUE;
+}
+
+
+CFrameSave_OneFile::CFrameSave_OneFile(CString &fileName_, int startFrame, int saveFrame, int width_, int height_)
+: idStartFrame(startFrame), nSaveFrame(saveFrame), width(width_), height(height_)
+, iSaveFrame(0)
+{
+	pBufferAttach= new CBufferAttach(fileName_);
+}
+
+CFrameSave_OneFile::~CFrameSave_OneFile()
+{
+	if(pBufferAttach)
+		delete pBufferAttach;
+}
+
+void CFrameSave_OneFile::SaveFrame(int iFrame, CSISBuffer &frameBuffer)
+{
+	if(iFrame < idStartFrame)
+		return;
+	
+	if(iSaveFrame >= nSaveFrame)
+		return;
+	
+	int id;
+	id= iFrame- idStartFrame;
+	if(id != iSaveFrame)
+	{
+		// 滚欺 历厘 鉴辑啊 促福匙??
+	}
+	
+	pBufferAttach->AttachToFile(frameBuffer);
+	iSaveFrame++;
+}
\ No newline at end of file
diff --git a/Common_Class/SISBuffer/LeastSquare.cpp b/Common_Class/SISBuffer/LeastSquare.cpp
new file mode 100644
index 0000000..f9f299e
--- /dev/null
+++ b/Common_Class/SISBuffer/LeastSquare.cpp
@@ -0,0 +1,736 @@
+#include<math.h>
+#include<string.h>
+#include<stdlib.h>
+#include<stdio.h>
+#include"LeastSquare.h"
+
+
+
+// fitting 窍扁 困秦 鞘夸茄 窃荐甸..................
+
+//********************************************************************************************************************************************************************************
+//					开青纺阑 备窍扁 困茄 窃荐甸...
+//********************************************************************************************************************************************************************************
+
+// transepose matrix甫 备窍绊 弊 青纺阑 TrMatrix 俊 持绰 窃荐.....
+//row : 青 column: 凯...
+void InverseFns::TranseposeMatrix(float** Matrix , float** TrMatrix , int row , int column) 
+{
+	int i ;
+	int j ;
+	
+	for( i = 0 ; i < row ; i++ )
+		for( j = 0 ; j < column ; j++ )
+		TrMatrix[j][i] = Matrix[i][j] ;	
+}
+
+
+// 烙狼狼 滴 青纺阑   蚌窍绊 技锅掳 青纺俊 持绰 窃荐.......
+// 菊 青 凯 第 凯....
+void InverseFns::MultiplyMatrixAB(float** MatrixA , float** MatrixB , float** MatrixAB , int row , int column , int bcolumn) 
+{
+	int i ; 
+	int j ;
+	int m ;
+	float sum ;
+
+
+	for( i = 0 ; i < row ; i++ )
+	{
+		for( j = 0 ; j < bcolumn ; j++ )
+		{
+			sum = 0.0 ;
+		
+			for( m = 0 ; m < column  ; m++ )
+			{
+				sum += MatrixA[i][m]*MatrixB[m][j] ;
+			}
+
+			MatrixAB[i][j] = sum;
+		}		
+	}	
+}
+
+
+
+
+// inverse matrix甫 备窍绰 窃荐.... nSize : 瞒荐甫 富茄促....
+int InverseFns::CalculatingInverseMatrix(float** Matrix , int nSize , float** InverseMatrix)
+{
+	int i , j , k , a;
+	float c , temp;		
+
+	// 窜困 青纺肺 父电促....
+	for( i = 0 ; i < nSize ; i++ )
+		memset(InverseMatrix[i] , 0x00 , sizeof(float)*nSize);
+
+
+	for( i = 0 ; i < nSize ; i++ )
+		InverseMatrix[i][i] = 1;
+
+
+	// 捞力 角力 开青纺阑 备茄促.....
+	for( j = 0 ; j < nSize ; j++ )
+	{
+		for( i = j ; i < nSize ; i++)
+			if( Matrix[i][j] != 0.0 ) // 贸澜栏肺 0.0 捞 救登绰 镑阑 茫绰促...
+				break ;
+		
+		if( i == nSize )	//0.0 捞 救登绰 镑捞 绝栏搁 开青纺捞 绝促绊 茄促..
+			return 0 ;		// 开青纺捞 粮犁窍瘤 臼绰促..... 
+		
+
+		c = Matrix[i][j] ;
+
+		// 贸澜栏肺 0.0 捞 酒囱镑阑 1肺 父甸扁 困秦 唱穿绢霖促... 蚌秦辑 鞍篮 荐肺 父甸绢 哗扁 奖霸 窍妨绊...
+		if( c != 1.0 )
+		{
+			for( a = 0 ; a < nSize ; a++ )
+			{
+				Matrix[i][a] = Matrix[i][a]/c;
+				InverseMatrix[i][a] = InverseMatrix[i][a]/c;
+			}
+		}
+
+		// 0 捞 酒聪扼绊 茫篮 镑阑 j 锅掳 青苞 困摹甫 官操磊...
+		for( a = 0 ; a < nSize ; a++ )
+		{ 
+			temp = Matrix[j][a];
+			Matrix[j][a] = Matrix[i][a];
+			Matrix[i][a] = temp;
+
+			temp = InverseMatrix[j][a];
+			InverseMatrix[j][a] = InverseMatrix[i][a];
+			InverseMatrix[i][a] = temp;
+		}
+
+		for( k = 0 ; k < nSize ; k++)
+		{
+			if(Matrix[k][j] == 0.0 || k == j)
+				continue ;
+
+			c = Matrix[k][j] ;
+
+			for( a = 0 ; a < nSize ; a++ )
+			{
+				Matrix[k][a] = Matrix[k][a] - c*Matrix[j][a];
+				InverseMatrix[k][a] = InverseMatrix[k][a] - c*InverseMatrix[j][a];
+			}		
+		}
+	}// end of outer for loop ... j  凯 锅龋.... 
+
+	//开青纺阑 己傍利栏肺 备窍搁...
+	return 1 ;
+}
+
+
+//coeff = (Tr(zMatrix)*zMatrix)狼 开青纺*Tr(zMatrix)*Y(角力 单捞磐狼 y 蔼.. 咯扁急 z 蔼捞 等促... )
+//角力肺 coeffcient 甫 备窍绰 窃荐....
+void LeastSquareFns::MultiplyMatrixAzThreeD(float** MatrixA , float* zThreeD , float aCoeff[] , int mDegree , int dataSize) 
+{
+	int i ; 
+	int m ;
+	float sum ;
+
+	
+	for( i = 0 ; i < mDegree ; i++ )
+	{
+		sum = 0.0 ;
+
+		for( m = 0 ; m < dataSize ; m++ )
+		{
+			sum += MatrixA[i][m]*zThreeD[m] ;
+		}
+
+		aCoeff[i] = sum;
+	}
+}
+
+
+//***********************************************************************************************************************
+// - end -
+//************************************************************************************************************************
+
+
+//********************************************************************************************************************************************************************************
+// Least square regression 栏肺 fitting 窍绰 单 鞘夸茄 窃荐甸....
+//********************************************************************************************************************************************************************************
+
+// 持绢霖 蔼阑 nTimes 父怒 蚌窍绰 窃荐.....
+float LeastSquareFns::GetNTimesValue(float value , int nTimes)
+{
+	
+	if( nTimes == 0 )
+		return 1.0;
+	else
+		return value*GetNTimesValue(value , nTimes - 1);
+}
+
+//Least square肺  polynomial fitting 窍绰 窃荐...  fitting 捞 救登搁 1阑 登搁 0阑 府畔茄促...
+//0 何磐 矫累秦辑 瞒荐 +1 父怒 皋葛府甫 棱疽促....
+// a0 + a1*x + a2*x*x + .....
+int LeastSquareFns::GetRegressionCoeffInPoly(float* xPoint , float* yPoint , float aCoeff[] , int mDegree , int nSize)
+{
+	int i , j , result ;
+	float** zMatrix ;
+	float** trzMatrix;
+	float** trzzMatrix ;
+	float** inversetrzzMatrix ;
+	float** resultMatrix ;
+
+
+	zMatrix = (float** ) malloc(nSize*sizeof(float*)) ;
+	trzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	trzzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	inversetrzzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	resultMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+
+	  
+
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;
+	}
+
+	for( i = 0 ; i < (mDegree+1) ; i++ )
+	{
+		trzMatrix[i] = (float* ) malloc(nSize*sizeof(float)) ;
+		trzzMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;  
+		inversetrzzMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;
+		resultMatrix[i] = (float* ) malloc(nSize*sizeof(float)) ;
+	}
+	
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		for( j = 0 ; j < mDegree + 1 ; j++ )
+		{
+			zMatrix[i][j] = GetNTimesValue( xPoint[i] , j ) ;		
+		}// end of inner for loop 
+	}
+
+	// 傈摹 青纺阑 备茄促.
+	invFnsClass.TranseposeMatrix( zMatrix , trzMatrix , nSize , mDegree +1 ) ;
+	// 傈摹青纺阑 蚌茄促.
+	invFnsClass.MultiplyMatrixAB( trzMatrix , zMatrix , trzzMatrix , mDegree+1 , nSize , mDegree + 1) ;
+	// 开青纺阑 备茄促.
+	result = invFnsClass.CalculatingInverseMatrix( trzzMatrix , mDegree+1 , inversetrzzMatrix ) ;
+
+	if( result == 1 )
+	{
+		invFnsClass.MultiplyMatrixAB(inversetrzzMatrix , trzMatrix , resultMatrix , mDegree+1 , mDegree+1 ,  nSize) ;
+		MultiplyMatrixAzThreeD(resultMatrix , yPoint , aCoeff  , mDegree+1 , nSize) ; 
+
+		for( i = 0 ; i < nSize ; i++ )
+			free(zMatrix[i] ) ;
+
+		for( i=0 ; i < (mDegree+1) ; i++ )
+		{
+			free( trzMatrix[i] ) ;
+			free( trzzMatrix[i]) ;
+			free( inversetrzzMatrix[i] ) ;
+			free( resultMatrix[i] ) ;
+		}
+
+		free( zMatrix ) ;
+		free( trzMatrix ) ;
+		free( trzzMatrix) ;
+		free( inversetrzzMatrix ) ;
+		free( resultMatrix ) ;
+		return 1 ;
+
+	}
+
+	for( i = 0 ; i < nSize ; i++ )
+			free(zMatrix[i] ) ;
+
+	for( i=0 ; i < (mDegree+1) ; i++ )
+	{
+		free( trzMatrix[i] ) ;
+		free( trzzMatrix[i]) ;
+		free( inversetrzzMatrix[i] ) ;
+		free( resultMatrix[i] ) ;
+	}
+
+	free( zMatrix ) ;
+	free( trzMatrix ) ;
+	free( trzzMatrix) ;
+	free( inversetrzzMatrix ) ;
+	free( resultMatrix ) ;
+	
+	return 0;
+}
+
+
+// polynomial fitting 饶 弊 窃荐狼 y蔼阑 舅酒郴绰 窃荐...
+float LeastSquareFns::GetRegressionFnValue(float aCoeff[] ,float xValue , int mDegree) 
+{
+	float nTimesxValue = 1.0 ;
+	int i ;
+	if( mDegree == 0 )
+		return aCoeff[0] ;
+	else
+	{
+		for( i = 1 ; i <= mDegree ; i++ )
+			nTimesxValue *= xValue ;
+		return ( aCoeff[mDegree]* nTimesxValue + GetRegressionFnValue( aCoeff , xValue , mDegree - 1 ) );
+	}
+}
+
+
+
+// Least square 肺  乞搁栏肺 fitting 窍绰 窃荐...  fitting 捞 救登搁 1阑 登搁 0阑 府畔茄促...
+// 0 何磐 矫累窍骨肺 瞒荐 +1 父怒 皋葛府甫 棱疽促....
+// z = ax + by + c  屈怕狼 乞搁捞促...
+int LeastSquareFns::GetRegressionCoeffInPlane(float* xPoint , float* yPoint , float* zPoint, float aCoeff[] , int nSize)
+{
+	int i, result ;
+	float** zMatrix ;
+	float** trzMatrix;
+	float** trzzMatrix ;
+	float** inversetrzzMatrix ;
+	float** resultMatrix ;
+	int mDegree = 2;			// 惑荐甫 猾 唱赣瘤 瞒荐...
+
+	zMatrix = (float** ) malloc(nSize*sizeof(float*)) ;
+	trzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	trzzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	inversetrzzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	resultMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;
+	}
+
+	for( i = 0 ; i < (mDegree+1) ; i++ )
+	{
+		trzMatrix[i] = (float* ) malloc(nSize*sizeof(float)) ;
+		trzzMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;  
+		inversetrzzMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;
+		resultMatrix[i] = (float* ) malloc(nSize*sizeof(float)) ;
+	}
+	
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i][0] = xPoint[i];
+		zMatrix[i][1] = yPoint[i];
+		zMatrix[i][2] = 1;
+	}
+
+	invFnsClass.TranseposeMatrix( zMatrix , trzMatrix , nSize , mDegree +1 ) ;
+	invFnsClass.MultiplyMatrixAB( trzMatrix , zMatrix , trzzMatrix , mDegree+1 , nSize , mDegree + 1) ;
+	result = invFnsClass.CalculatingInverseMatrix( trzzMatrix , mDegree+1 , inversetrzzMatrix ) ;
+
+	if( result == 1 )
+	{
+		invFnsClass.MultiplyMatrixAB( inversetrzzMatrix , trzMatrix , resultMatrix , mDegree+1 , mDegree+1 ,  nSize) ;
+		MultiplyMatrixAzThreeD( resultMatrix , zPoint , aCoeff, mDegree+1 , nSize ) ; 
+
+		for( i = 0 ; i < nSize ; i++ )
+			free(zMatrix[i] ) ;
+
+		for( i=0 ; i < (mDegree+1) ; i++ )
+		{
+			free( trzMatrix[i] ) ;
+			free( trzzMatrix[i]) ;
+			free( inversetrzzMatrix[i] ) ;
+			free( resultMatrix[i] ) ;
+		}
+
+		free( zMatrix ) ;
+		free( trzMatrix ) ;
+		free( trzzMatrix) ;
+		free( inversetrzzMatrix ) ;
+		free( resultMatrix ) ;
+		return 1;
+
+	}
+
+	for( i = 0 ; i < nSize ; i++ )
+			free(zMatrix[i] ) ;
+
+	for( i=0 ; i < (mDegree+1) ; i++ )
+	{
+		free( trzMatrix[i] ) ;
+		free( trzzMatrix[i]) ;
+		free( inversetrzzMatrix[i] ) ;
+		free( resultMatrix[i] ) ;
+	}
+
+	free( zMatrix ) ;
+	free( trzMatrix ) ;
+	free( trzzMatrix) ;
+	free( inversetrzzMatrix ) ;
+	free( resultMatrix ) ;
+	
+	return 0;
+}
+
+//Least square肺  乞搁栏肺 fitting 窍绰 窃荐...  fitting 捞 救登搁 1阑 登搁 0阑 府畔茄促...
+//0 何磐 矫累窍骨肺 瞒荐 +1 父怒 皋葛府甫 棱疽促....
+// z = ax + by + c  屈怕狼 乞搁捞促...
+// z = a0 + a1*2*x*y + a2(x*x + y*y) + a2(y*y - x*x)
+int LeastSquareFns::GetRegressionCoeffInZernikePoly( float* xPoint , float* yPoint , float* zPoint, float aCoeff[] , int nSize )
+{
+	int i, result ;
+	float** zMatrix ;
+	float** trzMatrix;
+	float** trzzMatrix ;
+	float** inversetrzzMatrix ;
+	float** resultMatrix ;
+	int mDegree = 3;			// 惑荐甫 猾 唱赣瘤 瞒荐...
+
+	zMatrix = (float** ) malloc(nSize*sizeof(float*)) ;
+	trzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	trzzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	inversetrzzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	resultMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;
+	}
+
+	for( i = 0 ; i < (mDegree+1) ; i++ )
+	{
+		trzMatrix[i] = (float* ) malloc(nSize*sizeof(float)) ;
+		trzzMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;  
+		inversetrzzMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;
+		resultMatrix[i] = (float* ) malloc(nSize*sizeof(float)) ;
+	}
+	
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i][0] = 1;
+		zMatrix[i][1] = 2*xPoint[i]*yPoint[i];
+		zMatrix[i][2] = 2*(xPoint[i]*xPoint[i] + yPoint[i]*yPoint[i]);
+		zMatrix[i][3] = yPoint[i]*yPoint[i] - xPoint[i]*xPoint[i];
+//		zMatrix[i][4] = xPoint[i];
+//		zMatrix[i][5] = yPoint[i];	
+	}
+
+	invFnsClass.TranseposeMatrix( zMatrix , trzMatrix , nSize , mDegree +1 ) ;
+	invFnsClass.MultiplyMatrixAB( trzMatrix , zMatrix , trzzMatrix , mDegree+1 , nSize , mDegree + 1) ;
+	result = invFnsClass.CalculatingInverseMatrix( trzzMatrix , mDegree+1 , inversetrzzMatrix ) ;
+
+	if( result == 1 )
+	{
+		invFnsClass.MultiplyMatrixAB( inversetrzzMatrix , trzMatrix , resultMatrix , mDegree+1 , mDegree+1 ,  nSize) ;
+		MultiplyMatrixAzThreeD( resultMatrix , zPoint , aCoeff  , mDegree+1 , nSize ) ; 
+
+		for( i = 0 ; i < nSize ; i++ )
+			free(zMatrix[i] ) ;
+
+		for( i=0 ; i < (mDegree+1) ; i++ )
+		{
+			free( trzMatrix[i] ) ;
+			free( trzzMatrix[i]) ;
+			free( inversetrzzMatrix[i] ) ;
+			free( resultMatrix[i] ) ;
+		}
+
+		free( zMatrix ) ;
+		free( trzMatrix ) ;
+		free( trzzMatrix) ;
+		free( inversetrzzMatrix ) ;
+		free( resultMatrix ) ;
+		return 0 ;
+
+	}
+
+	for( i = 0 ; i < nSize ; i++ )
+			free(zMatrix[i] ) ;
+
+	for( i=0 ; i < (mDegree+1) ; i++ )
+	{
+		free( trzMatrix[i] ) ;
+		free( trzzMatrix[i]) ;
+		free( inversetrzzMatrix[i] ) ;
+		free( resultMatrix[i] ) ;
+	}
+
+	free( zMatrix ) ;
+	free( trzMatrix ) ;
+	free( trzzMatrix) ;
+	free( inversetrzzMatrix ) ;
+	free( resultMatrix ) ;
+	
+	return 1 ;
+}
+
+
+//Least square肺  乞搁栏肺 fitting 窍绰 窃荐...  fitting 捞 救登搁 1阑 登搁 0阑 府畔茄促...
+//0 何磐 矫累窍骨肺 瞒荐 +1 父怒 皋葛府甫 棱疽促....
+// z = ax + by + c  屈怕狼 乞搁捞促...
+int LeastSquareFns::GetRegressionCoeffInZernikePoly( float* xPoint , float* yPoint , int nSize)
+{
+	int i, j, result ;
+	float** zMatrix ;
+	float** trzMatrix;
+	float** trzzMatrix ;
+	float** inversetrzzMatrix ;
+	float** resultMatrix ;
+	int mDegree = 1;	// 惑荐甫 猾 唱赣瘤 瞒荐...  硅凯狼 付瘤阜 牢郸胶甫 持栏搁 等促...
+
+
+	FILE* fp;
+
+	fp = fopen("LeastSquareMatrix.txt", "w");
+
+
+
+	zMatrix = (float** ) malloc(nSize*sizeof(float*)) ;
+	trzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	trzzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	inversetrzzMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+	resultMatrix = (float** ) malloc((mDegree+1)*sizeof(float*)) ;
+
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;
+	}
+
+	for( i = 0 ; i < (mDegree+1) ; i++ )
+	{
+		trzMatrix[i] = (float* ) malloc(nSize*sizeof(float)) ;
+		trzzMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;  
+		inversetrzzMatrix[i] = (float* ) malloc((mDegree+1)*sizeof(float)) ;
+		resultMatrix[i] = (float* ) malloc(nSize*sizeof(float)) ;
+	}
+	
+
+/*
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i][0] = 1;
+		zMatrix[i][1] = xPoint[i];
+		zMatrix[i][2] = yPoint[i];
+		zMatrix[i][3] = 2*xPoint[i]*yPoint[i];
+		zMatrix[i][4] = (2*xPoint[i]*xPoint[i] + 2*yPoint[i]*yPoint[i] - 1);
+		zMatrix[i][5] = yPoint[i]*yPoint[i] - xPoint[i]*xPoint[i];	
+	}
+*/
+	
+	
+/*	
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i][0] = 1;
+		zMatrix[i][1] = 2*xPoint[i]*yPoint[i];
+		zMatrix[i][2] = 2*(xPoint[i]*xPoint[i] + yPoint[i]*yPoint[i]);
+		zMatrix[i][3] = yPoint[i]*yPoint[i] - xPoint[i]*xPoint[i];	
+	}
+*/
+
+/*
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i][0] = 2*xPoint[i]*yPoint[i];
+		zMatrix[i][1] = (2*xPoint[i]*xPoint[i] + 2*yPoint[i]*yPoint[i]);
+		zMatrix[i][2] = yPoint[i]*yPoint[i] - xPoint[i]*xPoint[i];	
+	}
+*/
+
+	
+/*
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i][0] = 1;
+		zMatrix[i][1] = xPoint[i];
+		zMatrix[i][2] = yPoint[i];
+	}
+*/
+
+
+	for( i = 0 ; i < nSize ; i++ )
+	{
+		zMatrix[i][0] = 1;
+//		zMatrix[i][1] = xPoint[i];
+//		zMatrix[i][2] = yPoint[i];
+		zMatrix[i][1] = xPoint[i]*xPoint[i] + yPoint[i]*yPoint[i];
+	}
+
+	invFnsClass.TranseposeMatrix( zMatrix , trzMatrix , nSize , mDegree +1 ) ;
+	invFnsClass.MultiplyMatrixAB( trzMatrix , zMatrix , trzzMatrix , mDegree+1 , nSize , mDegree + 1) ;
+	result = invFnsClass.CalculatingInverseMatrix( trzzMatrix , mDegree+1 , inversetrzzMatrix ) ;
+
+	if( result == 1 )
+	{
+		invFnsClass.MultiplyMatrixAB( inversetrzzMatrix , trzMatrix , resultMatrix , mDegree+1 , mDegree+1 ,  nSize) ;
+
+		
+		for(i = 0; i < mDegree + 1; i++)
+		{
+			for(j = 0; j < nSize; j++)
+			{
+				fprintf(fp, "%f, ", resultMatrix[i][j]);
+			}
+
+			fprintf(fp, "\n");
+		}
+
+
+
+
+		fprintf(fp, "integer version\n\n\n\n");
+		for(i = 0; i < mDegree + 1; i++)
+		{
+			for(j = 0; j < nSize; j++)
+			{
+				fprintf(fp, "%5d, ", (int)(resultMatrix[i][j]*100000.0));
+			}
+
+			fprintf(fp, "\n");
+		}
+		fclose(fp);
+
+
+
+
+		
+//		MultiplyMatrixAzThreeD( resultMatrix , zPoint , aCoeff  , mDegree+1 , nSize ) ; 
+
+		for( i = 0 ; i < nSize ; i++ )
+			free(zMatrix[i] ) ;
+
+		for( i=0 ; i < (mDegree+1) ; i++ )
+		{
+			free( trzMatrix[i] ) ;
+			free( trzzMatrix[i]) ;
+			free( inversetrzzMatrix[i] ) ;
+			free( resultMatrix[i] ) ;
+		}
+
+		free( zMatrix ) ;
+		free( trzMatrix ) ;
+		free( trzzMatrix) ;
+		free( inversetrzzMatrix ) ;
+		free( resultMatrix ) ;
+		return 0 ;
+
+	}
+
+	for( i = 0 ; i < nSize ; i++ )
+			free(zMatrix[i] ) ;
+
+	for( i=0 ; i < (mDegree+1) ; i++ )
+	{
+		free( trzMatrix[i] ) ;
+		free( trzzMatrix[i]) ;
+		free( inversetrzzMatrix[i] ) ;
+		free( resultMatrix[i] ) ;
+	}
+
+	free( zMatrix ) ;
+	free( trzMatrix ) ;
+	free( trzzMatrix) ;
+	free( inversetrzzMatrix ) ;
+	free( resultMatrix ) ;
+	
+	return 1 ;
+}
+
+int GetRegressionCoff_CircleFit(float* xps, float *yps, int nData)
+{
+	// xx, yy, ax, by, c
+	return 0;
+}
+
+//Least square肺  polynomial fitting 窍绰 窃荐...  fitting 捞 救登搁 1阑 登搁 0阑 府畔茄促...
+//0 何磐 矫累秦辑 瞒荐 +1 父怒 皋葛府甫 棱疽促....
+// a0 + a1*x + a2*x*x + .....
+int LeastSquareFns::GetRegressionCoeffInCircleFitting(float* xPoint, float* yPoint, int dataNum, float *cx, float *cy, float *radius)
+{
+	// (x*x + y*y + ax + by + c)俊辑 捞蔼狼 力蚌甸狼 钦阑 力老 累霸窍绰 a, b, c 甫 备窍磊.
+	float xxx, yyy, xxy, yyx, xx, yx, xy, yy, x, y;
+	int dataCnt, anyCnt;
+	float **AMat;
+	float **A_Mat;
+	float *BMat;
+	int result;
+	float a, b, c;
+
+	AMat = new float*[3];
+	A_Mat = new float*[3];
+	BMat = new float[3];
+
+	for(anyCnt = 0; anyCnt < 3; anyCnt++)
+	{
+		AMat[anyCnt] = new float[3];
+		A_Mat[anyCnt] = new float[3];
+	}
+
+	xxx = yyy = xxy = yyx = xx = yx = xy = yy = x = y = 0.0;
+	
+	// data 俺荐 父怒 困 侥阑 固盒茄 蔼甸阑 歹窍磊..
+	for(dataCnt = 0; dataCnt < dataNum; dataCnt++)
+	{
+		xxx += (xPoint[dataCnt]*xPoint[dataCnt]*xPoint[dataCnt]);
+		yyy += (yPoint[dataCnt]*yPoint[dataCnt]*yPoint[dataCnt]);
+		xxy += (xPoint[dataCnt]*xPoint[dataCnt]*yPoint[dataCnt]);
+		yyx += (yPoint[dataCnt]*yPoint[dataCnt]*xPoint[dataCnt]);
+		xx += (xPoint[dataCnt]*xPoint[dataCnt]);
+		yx += (yPoint[dataCnt]*xPoint[dataCnt]);
+		xy += (xPoint[dataCnt]*yPoint[dataCnt]);
+		yy += (yPoint[dataCnt]*yPoint[dataCnt]);
+		x += xPoint[dataCnt];
+		y += yPoint[dataCnt];
+	}
+
+	AMat[0][0] = xx;
+	AMat[0][1] = yx;
+	AMat[0][2] = x;
+	AMat[1][0] = xy;
+	AMat[1][1] = yy;
+	AMat[1][2] = y;
+	AMat[2][0] = x;
+	AMat[2][1] = y;
+	AMat[2][2] = dataNum;
+
+	BMat[0] = -xxx - yyx;
+	BMat[1] = -xxy - yyy;
+	BMat[2] = -xx - yy;
+
+	result = invFnsClass.CalculatingInverseMatrix(AMat , 3, A_Mat);
+
+	//捞 版快 fitting捞 救等促..
+	if(result == 0)
+	{
+		for(anyCnt = 0; anyCnt < 3; anyCnt++)
+		{
+			delete [] AMat[anyCnt];
+			delete [] A_Mat[anyCnt];
+		}
+
+		delete [] AMat;
+		delete [] A_Mat;
+		delete [] BMat;
+		
+		return 0;
+	}
+
+	a = b = c = 0.0;
+
+	for(anyCnt = 0; anyCnt < 3; anyCnt++)
+	{
+		a += A_Mat[0][anyCnt]*BMat[anyCnt];
+		b += A_Mat[1][anyCnt]*BMat[anyCnt];
+		c += A_Mat[2][anyCnt]*BMat[anyCnt];
+	}
+
+	*cx = -a/2.0;
+	*cy = -b/2.0;
+	*radius = sqrt((*cx)*(*cx) + (*cy)*(*cy) - c);
+
+	for(anyCnt = 0; anyCnt < 3; anyCnt++)
+	{
+		delete [] AMat[anyCnt];
+		delete [] A_Mat[anyCnt];
+	}
+
+	delete [] AMat;
+	delete [] A_Mat;
+	delete [] BMat;
+
+	return 1;
+}
diff --git a/Common_Class/SISBuffer/LeastSquare.h b/Common_Class/SISBuffer/LeastSquare.h
new file mode 100644
index 0000000..645e6f2
--- /dev/null
+++ b/Common_Class/SISBuffer/LeastSquare.h
@@ -0,0 +1,69 @@
+/*
+float leastSquareMatrix[10][500] =
+{
+	-0.023522, -0.013986, -0.006569, -0.001271, 0.001907, 0.002967, 0.001907, -0.001271, -0.006569, -0.013986, -0.023522, -0.013986, -0.004450, 0.002967, 0.008264, 0.011443, 0.012503, 0.011443, 0.008264, 0.002967, -0.004450, -0.013986, -0.006569, 0.002967, 0.010384, 0.015681, 0.018860, 0.019919, 0.018860, 0.015681, 0.010384, 0.002967, -0.006569, -0.001271, 0.008264, 0.015681, 0.020979, 0.024158, 0.025217, 0.024158, 0.020979, 0.015681, 0.008264, -0.001271, 0.001907, 0.011443, 0.018860, 0.024158, 0.027336, 0.028396, 0.027336, 0.024158, 0.018860, 0.011443, 0.001907, 0.002967, 0.012503, 0.019919, 0.025217, 0.028396, 0.029455, 0.028396, 0.025217, 0.019919, 0.012503, 0.002967, 0.001907, 0.011443, 0.018860, 0.024158, 0.027336, 0.028396, 0.027336, 0.024158, 0.018860, 0.011443, 0.001907, -0.001271, 0.008264, 0.015681, 0.020979, 0.024158, 0.025217, 0.024158, 0.020979, 0.015681, 0.008264, -0.001271, -0.006569, 0.002967, 0.010384, 0.015681, 0.018860, 0.019919, 0.018860, 0.015681, 0.010384, 0.002967, -0.006569, -0.013986, -0.004450, 0.002967, 0.008264, 0.011443, 0.012503, 0.011443, 0.008264, 0.002967, -0.004450, -0.013986, -0.023522, -0.013986, -0.006569, -0.001271, 0.001907, 0.002967, 0.001907, -0.001271, -0.006569, -0.013986, -0.023522, 
+	-0.001033, -0.000826, -0.000620, -0.000413, -0.000207, 0.000000, 0.000207, 0.000413, 0.000620, 0.000826, 0.001033, -0.000826, -0.000661, -0.000496, -0.000331, -0.000165, 0.000000, 0.000165, 0.000331, 0.000496, 0.000661, 0.000826, -0.000620, -0.000496, -0.000372, -0.000248, -0.000124, 0.000000, 0.000124, 0.000248, 0.000372, 0.000496, 0.000620, -0.000413, -0.000331, -0.000248, -0.000165, -0.000083, 0.000000, 0.000083, 0.000165, 0.000248, 0.000331, 0.000413, -0.000207, -0.000165, -0.000124, -0.000083, -0.000041, 0.000000, 0.000041, 0.000083, 0.000124, 0.000165, 0.000207, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000207, 0.000165, 0.000124, 0.000083, 0.000041, 0.000000, -0.000041, -0.000083, -0.000124, -0.000165, -0.000207, 0.000413, 0.000331, 0.000248, 0.000165, 0.000083, 0.000000, -0.000083, -0.000165, -0.000248, -0.000331, -0.000413, 0.000620, 0.000496, 0.000372, 0.000248, 0.000124, 0.000000, -0.000124, -0.000248, -0.000372, -0.000496, -0.000620, 0.000826, 0.000661, 0.000496, 0.000331, 0.000165, 0.000000, -0.000165, -0.000331, -0.000496, -0.000661, -0.000826, 0.001033, 0.000826, 0.000620, 0.000413, 0.000207, 0.000000, -0.000207, -0.000413, -0.000620, -0.000826, -0.001033, 
+	0.000795, 0.000556, 0.000371, 0.000238, 0.000159, 0.000132, 0.000159, 0.000238, 0.000371, 0.000556, 0.000795, 0.000556, 0.000318, 0.000132, 0.000000, -0.000079, -0.000106, -0.000079, 0.000000, 0.000132, 0.000318, 0.000556, 0.000371, 0.000132, -0.000053, -0.000185, -0.000265, -0.000291, -0.000265, -0.000185, -0.000053, 0.000132, 0.000371, 0.000238, 0.000000, -0.000185, -0.000318, -0.000397, -0.000424, -0.000397, -0.000318, -0.000185, 0.000000, 0.000238, 0.000159, -0.000079, -0.000265, -0.000397, -0.000477, -0.000503, -0.000477, -0.000397, -0.000265, -0.000079, 0.000159, 0.000132, -0.000106, -0.000291, -0.000424, -0.000503, -0.000530, -0.000503, -0.000424, -0.000291, -0.000106, 0.000132, 0.000159, -0.000079, -0.000265, -0.000397, -0.000477, -0.000503, -0.000477, -0.000397, -0.000265, -0.000079, 0.000159, 0.000238, 0.000000, -0.000185, -0.000318, -0.000397, -0.000424, -0.000397, -0.000318, -0.000185, 0.000000, 0.000238, 0.000371, 0.000132, -0.000053, -0.000185, -0.000265, -0.000291, -0.000265, -0.000185, -0.000053, 0.000132, 0.000371, 0.000556, 0.000318, 0.000132, 0.000000, -0.000079, -0.000106, -0.000079, 0.000000, 0.000132, 0.000318, 0.000556, 0.000795, 0.000556, 0.000371, 0.000238, 0.000159, 0.000132, 0.000159, 0.000238, 0.000371, 0.000556, 0.000795, 
+	0.000000, 0.000477, 0.000848, 0.001113, 0.001271, 0.001324, 0.001271, 0.001113, 0.000848, 0.000477, 0.000000, -0.000477, 0.000000, 0.000371, 0.000636, 0.000795, 0.000848, 0.000795, 0.000636, 0.000371, 0.000000, -0.000477, -0.000848, -0.000371, 0.000000, 0.000265, 0.000424, 0.000477, 0.000424, 0.000265, 0.000000, -0.000371, -0.000848, -0.001113, -0.000636, -0.000265, 0.000000, 0.000159, 0.000212, 0.000159, 0.000000, -0.000265, -0.000636, -0.001113, -0.001271, -0.000795, -0.000424, -0.000159, 0.000000, 0.000053, 0.000000, -0.000159, -0.000424, -0.000795, -0.001271, -0.001324, -0.000848, -0.000477, -0.000212, -0.000053, 0.000000, -0.000053, -0.000212, -0.000477, -0.000848, -0.001324, -0.001271, -0.000795, -0.000424, -0.000159, 0.000000, 0.000053, 0.000000, -0.000159, -0.000424, -0.000795, -0.001271, -0.001113, -0.000636, -0.000265, 0.000000, 0.000159, 0.000212, 0.000159, 0.000000, -0.000265, -0.000636, -0.001113, -0.000848, -0.000371, 0.000000, 0.000265, 0.000424, 0.000477, 0.000424, 0.000265, 0.000000, -0.000371, -0.000848, -0.000477, 0.000000, 0.000371, 0.000636, 0.000795, 0.000848, 0.000795, 0.000636, 0.000371, 0.000000, -0.000477, 0.000000, 0.000477, 0.000848, 0.001113, 0.001271, 0.001324, 0.001271, 0.001113, 0.000848, 0.000477, 0.000000
+
+};
+
+
+*/
+
+
+
+class InverseFns
+{
+public:
+	// transepose matrix甫 备窍绊 弊 青纺阑 TrMatrix 俊 持绰 窃荐.....
+	//row : 青 column: 凯...
+	void TranseposeMatrix(float** Matrix , float** TrMatrix , int row , int column); 
+	// 烙狼狼 滴 青纺阑   蚌窍绊 技锅掳 青纺俊 持绰 窃荐.......
+	// 菊 青 凯 第 凯....
+	void MultiplyMatrixAB(float** MatrixA , float** MatrixB , float** MatrixAB , int row , int column , int bcolumn); 
+
+	// inverse matrix甫 备窍绰 窃荐.... nSize : 瞒荐甫 富茄促....
+	int CalculatingInverseMatrix(float** Matrix , int nSize , float** InverseMatrix);
+
+};
+
+
+
+class LeastSquareFns
+{
+
+public:
+	InverseFns invFnsClass;
+	//********************************************************************************************************************************************************************************
+	// Least square regression 栏肺 fitting 窍绰 单 鞘夸茄 窃荐甸....
+	//********************************************************************************************************************************************************************************
+	//coeff = (Tr(zMatrix)*zMatrix)狼 开青纺*Tr(zMatrix)*Y(角力 单捞磐狼 y 蔼.. 咯扁急 z 蔼捞 等促... )
+	//角力肺 coeffcient 甫 备窍绰 窃荐....
+	void MultiplyMatrixAzThreeD(float** MatrixA , float* zThreeD , float aCoeff[] , int mDegree , int dataSize); 
+
+	// 持绢霖 蔼阑 nTimes 父怒 蚌窍绰 窃荐.....
+	float GetNTimesValue(float value , int nTimes);
+
+	//Least square肺  polynomial fitting 窍绰 窃荐...  fitting 捞 救登搁 1阑 登搁 0阑 府畔茄促...
+	//0 何磐 矫累秦辑 瞒荐 +1 父怒 皋葛府甫 棱疽促....
+	// a0 + a1*x + a2*x*x + .....
+	int GetRegressionCoeffInPoly(float* xPoint , float* yPoint , float aCoeff[] , int mDegree , int nSize);
+
+	// polynomial fitting 饶 弊 窃荐狼 y蔼阑 舅酒郴绰 窃荐...
+	float GetRegressionFnValue(float aCoeff[] ,float xValue , int mDegree); 
+
+	//Least square肺  乞搁栏肺 fitting 窍绰 窃荐...  fitting 捞 救登搁 1阑 登搁 0阑 府畔茄促...
+	//0 何磐 矫累窍骨肺 瞒荐 +1 父怒 皋葛府甫 棱疽促....
+	// z = ax + by + c  屈怕狼 乞搁捞促...
+	int GetRegressionCoeffInPlane(float* xPoint , float* yPoint , float* zPoint, float aCoeff[] , int nSize);
+	int GetRegressionCoeffInZernikePoly( float* xPoint , float* yPoint , float* zPoint, float aCoeff[] , int nSize );
+	int GetRegressionCoeffInZernikePoly( float* xPoint , float* yPoint , int nSize);
+	//(x*x + y*y + ax + by + c)^2狼 钦阑 弥家肺窍绰 a, b, c 蔼阑 备窍绊 吝缴苞 馆瘤抚阑 备窃... 
+	int GetRegressionCoeffInCircleFitting(float* xPoint, float* yPoint, int dataNum, float *cx, float *cy, float *radius);
+	
+};
+
+
+
+
diff --git a/Common_Class/SISBuffer/MatchBuffer.cpp b/Common_Class/SISBuffer/MatchBuffer.cpp
new file mode 100644
index 0000000..fe2b24f
--- /dev/null
+++ b/Common_Class/SISBuffer/MatchBuffer.cpp
@@ -0,0 +1,359 @@
+// MatchBuffer.cpp: implementation of the CMatchBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "MatchBuffer.h"
+#include "SISBuffer.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+#define MOSIS_MEMORY_ALIGN 16
+
+#if defined(MOSIS_MEMORY_ALIGN)
+#include "malloc.h"
+#endif
+
+CUShortBuff::CUShortBuff()
+: m_pData(NULL), m_Width(0), m_Height(0), m_DataSpace(0)
+{}
+CUShortBuff::~CUShortBuff()
+{
+	ReleaseSpace();
+}
+void CUShortBuff::ReleaseSpace()
+{
+	if(m_pData)
+	{
+#if defined(MOSIS_MEMORY_ALIGN)
+		_mm_free(m_pData);
+#else
+		delete[] m_pData;
+#endif
+		m_pData= NULL;
+	}
+	m_Width= 0;
+	m_Height= 0;
+	m_DataSpace= 0;
+}
+BOOL CUShortBuff::SetSize(int width, int height)
+{
+	int space= width*height;
+	if(space < 1)
+		return FALSE;
+	
+	if(m_DataSpace < space)
+	{
+		ReleaseSpace();
+	}
+	
+	if(m_pData == NULL)
+	{
+#if defined(MOSIS_MEMORY_ALIGN)
+		m_pData= (ushort*)_mm_malloc(space*sizeof(ushort), MOSIS_MEMORY_ALIGN);
+#else
+		m_pData= new ushort[space];
+#endif
+		m_DataSpace= space;
+	}
+	m_Width= width;
+	m_Height= height;
+
+	return IsValidBuffer();
+}
+
+
+BOOL CUShortBuff::SetBuffPyramid(CSISBuffer fromBuff, CRect roi, int multi)
+{
+	int width, height;
+	width= (int)(roi.Width()/multi);///8*8;
+	height= roi.Height()/multi;
+
+	ushort data;
+
+	if(! SetSize(width, height))
+		return FALSE;
+
+	int x, y;
+	int divide= multi*multi;
+//	divide= 1;
+
+	for(y= 0; y< height; y++)
+	{
+		for(x= 0; x< width; x++)
+		{
+			data= 0;
+			for(int yy= y*multi; yy< y*multi+ multi; yy++)
+			{
+				for(int xx= x*multi; xx< x*multi+ multi; xx++)
+				{
+					data+= fromBuff.GetPixel(roi.left+ xx, roi.top+ yy);
+				}
+			}
+			SetPixel(x, y, (ushort)((float)data/divide+ 0.5));
+// 			for(int xx= x*multi; xx< x*multi+ multi; xx++)
+// 			{
+// 				data+= fromBuff.GetPixel(roi.left+ xx, roi.top+ xx);
+// 			}
+// 			SetPixel(x, y, data/multi);
+		}
+	}
+/*
+	__m128i	mmResult, mmResult1, mmResult2;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	__m128i mmZeroData= _mm_setzero_si128();
+	BYTE *pData;
+	multi= 2;
+	int		distance= 2<<multi;
+	for(y= 0; y< height; y++)
+	{
+		for(x= 0; x< width- distance; x+=distance)
+		{
+			mmResult= _mm_setzero_si128();
+			for(int i= 0; i< distance; i++)// y绵栏肺 钦.
+			{
+				pData= fromBuff.GetDataAddress(x*distance, y*distance+ i);
+				mmA= _mm_loadu_si128((__m128i*) (pData));
+				mmB= _mm_loadu_si128((__m128i*) (pData+ distance*8));
+				
+				mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+				mmBB= _mm_unpacklo_epi8(mmA, mmZeroData);
+				
+				mmResult1= _mm_hadd_epi16(mmAA, mmBB);
+				
+				mmAA= _mm_unpackhi_epi8(mmB, mmZeroData);
+				mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+				
+				mmResult2= _mm_hadd_epi16(mmAA, mmBB);
+				
+				mmResult2= _mm_hadd_epi16(mmResult1, mmResult2);
+
+				mmResult= _mm_add_epi16(mmResult, mmResult2);
+			}
+			_mm_storeu_si128((__m128i*)GetDataAddress(x, y), mmResult);
+		}
+	}
+*/
+	return TRUE;
+}
+
+BOOL	CUShortBuff::CopyFrom(CUShortBuff &fromBuffer, CRect rect)
+{
+	if(rect.left < 0 || rect.right > fromBuffer.GetWidth() ||
+		rect.top < 0 || rect.bottom > fromBuffer.GetHeight())
+		return FALSE;
+	if(! IsValidBuffer())
+		return FALSE;
+
+	if(GetHeight() < rect.Height())
+		return FALSE;
+
+	for(int i= 0; i< rect.Height(); i++)
+	{
+		memcpy(GetDataAddress(0, i), fromBuffer.GetDataAddress(rect.left, i+ rect.top), GetWidth()*sizeof(ushort));
+	}
+	return TRUE;
+}
+
+
+void CByteBuff::ReleaseSpace()
+{
+	if(m_pData)
+	{
+#if defined(MOSIS_MEMORY_ALIGN)
+		_mm_free(m_pData);
+#else
+		delete[] m_pData;
+#endif
+	}
+	m_pData= NULL;
+	m_Width= 0;
+	m_Height= 0;
+	m_DataSpace= 0;
+}
+BOOL CByteBuff::SetSize(int width, int height)
+{
+	int space= width*height;
+	if(space < 1)
+		return FALSE;
+	
+	if(m_DataSpace < space)
+	{
+		ReleaseSpace();
+	}
+	
+	if(m_pData == NULL)
+	{
+#if defined(MOSIS_MEMORY_ALIGN)
+		m_pData= (BYTE*)_mm_malloc(space*sizeof(BYTE), MOSIS_MEMORY_ALIGN);
+#else
+		m_pData= new BYTE[space];
+#endif
+		m_DataSpace= space;
+	}
+	
+	m_Width= width;
+	m_Height= height;
+	return IsValidBuffer();
+}
+BOOL CByteBuff::CopyFrom(CSISBuffer &fromBuffer, CRect rect)
+{
+	// 滚欺 眉农甫 窍瘤 臼摆促... 扼牢俊辑绰 滚欺啊 嘿绢 乐栏聪鳖..
+	// 臂扼胶 TILT俊 狼秦 痢柳利 概莫俊辑 滚欺 版拌甫 檬苞且 荐 乐促.
+// 	if(rect.left < 0 || rect.right > fromBuffer.GetWidth() ||
+// 		rect.top < 0 || rect.bottom > fromBuffer.GetHeight())
+// 		return FALSE;
+	if(! IsValidBuffer())
+		return FALSE;
+	
+	if(GetHeight() < rect.Height())
+		return FALSE;
+
+	int width= rect.Width();
+	if(GetWidth() < width)
+		width= GetWidth();
+	if(rect.left < 0)
+		return FALSE;
+	if(rect.top < 0)
+		return FALSE;
+	if(rect.right > fromBuffer.GetWidth())
+		return FALSE;
+	if(rect.bottom > fromBuffer.GetHeight())
+		return FALSE;
+	
+	for(int i= 0; i< rect.Height(); i++)
+	{
+		memcpy(GetDataAddress(0, i), fromBuffer.GetDataAddress(rect.left, i+ rect.top), width);
+	}
+	return TRUE;
+/*	int width, height;
+	width= rect.Width();
+	height= rect.Height();
+	if(SetSize(rect.Width(), rect.Height()))
+	{
+		for(int yy= 0; yy< rect.Height(); yy++)
+		{
+			memcpy(GetDataAddress(0, yy), fromBuffer.GetDataAddress(rect.left, rect.top+ yy), rect.Width());
+		}
+	}*/
+}
+BOOL CByteBuff::CopyFrom(CByteBuff &fromBuffer, CRect rect)
+{
+	if(rect.left < 0 || rect.right > fromBuffer.GetWidth() ||
+		rect.top < 0 || rect.bottom > fromBuffer.GetHeight())
+		return FALSE;
+	if(! IsValidBuffer())
+		return FALSE;
+	
+	if(GetHeight() < rect.Height())
+		return FALSE;
+	
+	int width= rect.Width();
+	if(GetWidth() < width)
+		width= GetWidth();
+	if(rect.left < 0)
+		return FALSE;
+	if(rect.top < 0)
+		return FALSE;
+	if(rect.right > fromBuffer.GetWidth())
+		return FALSE;
+	if(rect.bottom > fromBuffer.GetHeight())
+		return FALSE;
+
+	for(int i= 0; i< rect.Height(); i++)
+	{
+		memcpy(GetDataAddress(0, i), fromBuffer.GetDataAddress(rect.left, i+ rect.top), width);
+	}
+	return TRUE;
+/*	if(SetSize(rect.Width(), rect.Height()))
+	{
+		for(int yy= 0; yy< rect.Height(); yy++)
+		{
+			memcpy(GetDataAddress(0, yy), fromBuffer.GetDataAddress(rect.left, rect.top+ yy), rect.Width());
+		}
+	}*/
+}
+
+BOOL CByteBuff::SetBuffPyramid(CSISBuffer fromBuff, CRect roi, int multi)
+{
+	int width, height;
+	width= (int)(roi.Width()/multi);///8*8;
+	height= roi.Height()/multi;
+
+	ushort data;
+
+	if(! SetSize(width, height))
+		return FALSE;
+
+	int x, y;
+	int divide= multi*multi;
+
+	for(y= 0; y< height; y++)
+	{
+		for(x= 0; x< width; x++)
+		{
+			data= 0;
+			for(int yy= y*multi; yy< y*multi+ multi; yy++)
+			{
+				for(int xx= x*multi; xx< x*multi+ multi; xx++)
+				{
+					data+= fromBuff.GetPixel(roi.left+ xx, roi.top+ yy);
+				}
+			}
+			SetPixel(x, y, (BYTE)((float)data/divide+ 0.5));
+// 			for(int xx= x*multi; xx< x*multi+ multi; xx++)
+// 			{
+// 				data+= fromBuff.GetPixel(roi.left+ xx, roi.top+ xx);
+// 			}
+// 			SetPixel(x, y, data/multi);
+		}
+	}
+/*
+	__m128i	mmResult, mmResult1, mmResult2;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	__m128i mmZeroData= _mm_setzero_si128();
+	BYTE *pData;
+	multi= 2;
+	int		distance= 2<<multi;
+	for(y= 0; y< height; y++)
+	{
+		for(x= 0; x< width- distance; x+=distance)
+		{
+			mmResult= _mm_setzero_si128();
+			for(int i= 0; i< distance; i++)// y绵栏肺 钦.
+			{
+				pData= fromBuff.GetDataAddress(x*distance, y*distance+ i);
+				mmA= _mm_loadu_si128((__m128i*) (pData));
+				mmB= _mm_loadu_si128((__m128i*) (pData+ distance*8));
+				
+				mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+				mmBB= _mm_unpacklo_epi8(mmA, mmZeroData);
+				
+				mmResult1= _mm_hadd_epi16(mmAA, mmBB);
+				
+				mmAA= _mm_unpackhi_epi8(mmB, mmZeroData);
+				mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+				
+				mmResult2= _mm_hadd_epi16(mmAA, mmBB);
+				
+				mmResult2= _mm_hadd_epi16(mmResult1, mmResult2);
+
+				mmResult= _mm_add_epi16(mmResult, mmResult2);
+			}
+			_mm_storeu_si128((__m128i*)GetDataAddress(x, y), mmResult);
+		}
+	}
+*/
+	return TRUE;
+}
+
diff --git a/Common_Class/SISBuffer/MatchBuffer.h b/Common_Class/SISBuffer/MatchBuffer.h
new file mode 100644
index 0000000..9ecac45
--- /dev/null
+++ b/Common_Class/SISBuffer/MatchBuffer.h
@@ -0,0 +1,162 @@
+// MatchBuffer.h: interface for the CMatchBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MATCHBUFFER_H__86EF7EFC_838A_4414_8DA0_655D6EC5210B__INCLUDED_)
+#define AFX_MATCHBUFFER_H__86EF7EFC_838A_4414_8DA0_655D6EC5210B__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+#include "SISBuffer.h"
+
+typedef unsigned short ushort;
+typedef __int64 int64;
+
+#define MOSIS_MEMORY_ALIGN 16
+
+template<typename T>
+class CMemBuff// 4byte 倔扼牢阑 荤侩窍瘤 臼阑 巴捞促.
+{
+protected:
+	T *m_pData;
+	int m_Width;
+	int m_Height;
+	int m_DataSpace;
+public:
+	CMemBuff()
+	{
+		m_Width= 0;
+		m_Height= 0;
+		m_DataSpace= 0;
+		m_pData= NULL;
+	}
+	virtual ~CMemBuff()
+	{
+		ReleaseSpace();
+	}
+	BYTE	*GetDataAddress(){return m_pData;}
+	BYTE	*GetDataAddress(int x, int y){return m_pData+ x+ y*GetWidth();}
+	int		GetWidth(){return m_Width;}
+	int		GetHeight(){return m_Height;}
+	int		GetDataSize(){return GetWidth()*GetHeight();}
+	BOOL	IsValidBuffer(){return (m_pData != NULL) && (m_Width>0) && (m_Height>0);}
+	
+	void ReleaseSpace()
+	{
+		if(m_pData)
+		{
+#if defined(MOSIS_MEMORY_ALIGN)
+			_mm_free(m_pData);
+#else
+			delete[] m_pData;
+#endif
+		}
+		m_pData= NULL;
+		m_Width= 0;
+		m_Height= 0;
+		m_DataSpace= 0;
+	}
+	BOOL SetSize(int width, int height)
+	{
+		int space= width*height;
+		if(space < 1)
+			return FALSE;
+		
+		if(m_DataSpace < space)
+		{
+			ReleaseSpace();
+		}
+		
+		if(m_pData == NULL)
+		{
+#if defined(MOSIS_MEMORY_ALIGN)
+			m_pData= (BYTE*)_mm_malloc(space*sizeof(BYTE), MOSIS_MEMORY_ALIGN);
+#else
+			m_pData= new BYTE[space];
+#endif
+			m_DataSpace= space;
+		}
+		
+		m_Width= width;
+		m_Height= height;
+		return IsValidBuffer();
+	}
+	void SetPixel(int x, int y, T val)
+	{
+		*(m_pData+ x+ y*GetWidth())= val;
+	}
+};
+
+
+class CUShortBuff// 4byte 倔扼牢阑 荤侩窍瘤 臼阑 巴捞促.
+{
+public:
+	CUShortBuff();
+	virtual ~CUShortBuff();
+	
+protected:
+	ushort *m_pData;
+	int		m_Width;
+	int		m_Height;
+	int		m_DataSpace;
+	
+public:
+	ushort	*GetDataAddress(){return m_pData;}
+	ushort	*GetDataAddress(int x, int y){return m_pData+ x+ y*GetWidth();}
+	int		GetWidth(){return m_Width;}
+	int		GetHeight(){return m_Height;}
+	int		GetDataSize(){return GetWidth()*GetHeight();}
+	BOOL	IsValidBuffer(){return (m_pData != NULL) && (m_Width>0) && (m_Height>0);}
+	
+public:
+	void	ReleaseSpace();
+	BOOL	SetSize(int width, int height);
+	BOOL	SetBuffPyramid(CSISBuffer from, CRect roi, int multi);
+	void	SetPixel(int x, int y, ushort val)
+	{
+		*(m_pData+ x+ y*GetWidth())= val;
+	}
+	BOOL	CopyFrom(CUShortBuff &fromBuffer, CRect rect);
+};
+
+class CByteBuff// 4byte 倔扼牢阑 荤侩窍瘤 臼阑 巴捞促.
+{
+protected:
+	BYTE *m_pData;
+	int m_Width;
+	int m_Height;
+	int m_DataSpace;
+public:
+	CByteBuff()
+	{
+		m_Width= 0;
+		m_Height= 0;
+		m_DataSpace= 0;
+		m_pData= NULL;
+	}
+	virtual ~CByteBuff()
+	{
+		ReleaseSpace();
+	}
+	BYTE	*GetDataAddress(){return m_pData;}
+	BYTE	*GetDataAddress(int x, int y){return m_pData+ x+ y*GetWidth();}
+	int		GetWidth(){return m_Width;}
+	int		GetHeight(){return m_Height;}
+	int		GetDataSize(){return GetWidth()*GetHeight();}
+	BOOL	IsValidBuffer(){return (m_pData != NULL) && (m_Width>0) && (m_Height>0);}
+	
+	void ReleaseSpace();
+	BOOL SetSize(int width, int height);
+	BOOL SetBuffPyramid(CSISBuffer from, CRect roi, int multi);
+	void SetPixel(int x, int y, BYTE val)
+	{
+		*(m_pData+ x+ y*GetWidth())= val;
+	}
+	BOOL CopyFrom(CSISBuffer &buffer, CRect rect);
+	BOOL CopyFrom(CByteBuff &buffer, CRect rect);
+};
+
+#endif // !defined(AFX_MATCHBUFFER_H__86EF7EFC_838A_4414_8DA0_655D6EC5210B__INCLUDED_)
diff --git a/Common_Class/SISBuffer/MatchImpl.cpp b/Common_Class/SISBuffer/MatchImpl.cpp
new file mode 100644
index 0000000..1b0860c
--- /dev/null
+++ b/Common_Class/SISBuffer/MatchImpl.cpp
@@ -0,0 +1,1145 @@
+// MatchImpl.cpp: implementation of the CMatchImpl class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "MatchImpl.h"
+#include "SISMath.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+#include <emmintrin.h>
+//#include <tmmintrin.h>
+//#include <ia32intrin.h>
+#include <math.h>
+
+//#define MOSIS_ASM
+
+extern "C"{
+	int64 _asm_Get_CCU8(const uchar * vec1, const uchar * vec2, int len, int flag);// 0= aa, 1=au, 2=uu
+};
+
+
+float GetRegressionCoeffInPoly(float* points , float *scores, int nSize);
+
+CMatchImpl::CMatchImpl()
+{
+	m_bBigBufferChanged= TRUE;
+	m_bSmallBufferChanged= TRUE;
+}
+
+CMatchImpl::~CMatchImpl()
+{
+
+	m_BigBuff16.ReleaseSpace();
+	m_SmallBuff16.ReleaseSpace();
+
+	m_BigBuff8.ReleaseSpace();
+	m_SmallBuff8.ReleaseSpace();
+}
+BOOL CMatchImpl::SetBigImage(CSISBuffer bigBuffer, CRect roi)
+{
+	m_BigOriginal= bigBuffer;
+	m_BigRect= roi;
+
+	m_bBigBufferChanged= TRUE;
+
+	return TRUE;
+}
+BOOL CMatchImpl::SetSmallImage(CSISBuffer smallBuffer, CRect roi)
+{
+	m_SmallOriginal= smallBuffer;
+	m_SmallRect= roi;
+
+// 	m_SmallRect.bottom= (m_SmallRect.top+ m_SmallRect.bottom)/2;
+// 	m_SmallRect.right= (m_SmallRect.left+ m_SmallRect.right)/2;
+
+	m_bSmallBufferChanged= TRUE;
+	m_SmallBuff8.SetSize(m_SmallRect.Width(), m_SmallRect.Height());
+	m_SmallBuff8.CopyFrom(m_SmallOriginal, m_SmallRect);
+
+	return TRUE;
+}
+
+BOOL CMatchImpl::Check_Buffer(CUShortBuff &smallBuffer, CUShortBuff &bigBuffer)
+{
+	if(!smallBuffer.IsValidBuffer())
+		return FALSE;
+	if(!bigBuffer.IsValidBuffer())
+		return FALSE;
+	if(smallBuffer.GetWidth() >= bigBuffer.GetWidth())
+		return FALSE;
+	if(smallBuffer.GetHeight() >= bigBuffer.GetHeight())
+		return FALSE;
+	return TRUE;
+}
+BOOL CMatchImpl::Check_Buffer(CByteBuff &smallBuffer, CByteBuff &bigBuffer)
+{
+	if(!smallBuffer.IsValidBuffer())
+		return FALSE;
+	if(!bigBuffer.IsValidBuffer())
+		return FALSE;
+	if(smallBuffer.GetWidth() >= bigBuffer.GetWidth())
+		return FALSE;
+	if(smallBuffer.GetHeight() >= bigBuffer.GetHeight())
+		return FALSE;
+	return TRUE;
+}
+
+BOOL CMatchImpl::DoTemplateMatch(stSISMatchResult &matchResult, stSISMatchParam param)
+{
+	stSISMatchResult result;
+	result.Invalidate();
+	matchResult.Invalidate();
+	m_MatchParam= param;
+	m_MatchParam.ValidateParam();
+
+
+	if(m_SmallRect.Width()+ 10 >= m_BigRect.Width())
+	{
+		m_MatchParam.m_Pyramid= 0;
+	}
+	else
+	{
+//		m_MatchParam.m_Pyramid= 2;
+	}
+
+//	m_MatchParam.m_Acceptance= 0.3;
+//	m_MatchParam.m_bInterpol= TRUE;
+//	m_MatchParam.m_Method= stSISMatchParam::CV_TM_CCOEFF_NORMED;
+//	m_MatchParam.m_Method= stSISMatchParam::CV_TM_CCORR_NORMED;
+
+	if(m_SmallRect.Width() >= m_BigRect.Width())
+		return FALSE;
+	if(m_SmallRect.Height() >= m_BigRect.Height())
+		return FALSE;
+
+
+	stSISMatchResult result2;
+	BOOL bRet= TRUE;
+	int sWidth, sHeight;
+	int hWidth, hHeight;
+	CRect roi;
+	CPoint mpt;
+
+	if(m_MatchParam.m_Method == stSISMatchParam::CV_TM_CCORR_NORMED)
+	{
+		if(m_MatchParam.m_Pyramid > 0)
+		{
+			if(! m_SmallBuff16.IsValidBuffer() || m_bSmallBufferChanged)
+			{
+				if(m_SmallBuff16.SetBuffPyramid(m_SmallOriginal, m_SmallRect, m_MatchParam.GetMulti()))
+					m_bSmallBufferChanged= FALSE;
+			}
+			if(! m_BigBuff16.IsValidBuffer() || m_bBigBufferChanged)
+			{
+				if(m_BigBuff16.SetBuffPyramid(m_BigOriginal, m_BigRect, m_MatchParam.GetMulti()))
+					m_bBigBufferChanged= FALSE;
+			}
+
+
+			result.Invalidate();
+			bRet= MatchImpl(m_SmallBuff16, m_BigBuff16, result, 0, m_MatchParam.m_bInterpol);
+
+//			result.m_X= m_BigRect.left+ result.m_X*m_MatchParam.GetMulti();
+//			result.m_Y= m_BigRect.top+ result.m_Y*m_MatchParam.GetMulti();
+			mpt.x= m_BigRect.left+ (int)(result.m_X*m_MatchParam.GetMulti()+ 0.5);
+			mpt.y= m_BigRect.top+ (int)(result.m_Y*m_MatchParam.GetMulti()+ 0.5);
+
+			matchResult= result;
+			if(bRet == FALSE)
+			{
+				return FALSE;
+			}
+			
+			
+			sWidth= m_SmallRect.Width();
+			sHeight= m_SmallRect.Height();
+			
+			hWidth= m_MatchParam.GetMulti()+1;
+			hHeight= m_MatchParam.GetMulti()+1;
+			roi.SetRect(mpt.x- hWidth, mpt.y- hHeight, mpt.x+ sWidth+ hWidth, mpt.y+ sHeight+ hHeight);
+			m_BigBuff8.SetSize(roi.Width(), roi.Height());
+			m_BigBuff8.CopyFrom(m_BigOriginal, roi);
+			
+			result.Invalidate();
+			bRet= MatchImpl(m_SmallBuff8, m_BigBuff8, result, 0, m_MatchParam.m_bInterpol);
+
+			matchResult.m_X= roi.left+ result.m_X- m_BigRect.left;
+			matchResult.m_Y= roi.top+ result.m_Y- m_BigRect.top;
+			matchResult.m_Score= result.m_Score;
+
+			result.m_X= matchResult.m_X+ m_BigRect.left;
+			result.m_Y= matchResult.m_Y+ m_BigRect.top;
+			
+			return matchResult.m_Score >= m_MatchParam.m_Acceptance;
+		}
+		
+		m_BigBuff8.SetSize(m_BigRect.Width(), m_BigRect.Height());
+		if(!m_BigBuff8.CopyFrom(m_BigOriginal, m_BigRect))
+			return FALSE;
+		
+		result.Invalidate();
+		bRet= MatchImpl(m_SmallBuff8, m_BigBuff8, result, 0, m_MatchParam.m_bInterpol);
+		matchResult= result;
+		return matchResult.m_Score >= m_MatchParam.m_Acceptance;
+	}
+
+	if(m_MatchParam.m_Pyramid > 0)
+	{
+		if(! m_SmallBuff16.IsValidBuffer() || m_bSmallBufferChanged)
+		{
+			if(m_SmallBuff16.SetBuffPyramid(m_SmallOriginal, m_SmallRect, m_MatchParam.GetMulti()))
+				m_bSmallBufferChanged= FALSE;
+		}
+		if(! m_BigBuff16.IsValidBuffer() || m_bBigBufferChanged)
+		{
+			if(m_BigBuff16.SetBuffPyramid(m_BigOriginal, m_BigRect, m_MatchParam.GetMulti()))
+				m_bBigBufferChanged= FALSE;
+		}
+		
+
+		result.Invalidate();
+		bRet= MatchImpl_Coef(m_SmallBuff16, m_BigBuff16, result, 0, m_MatchParam.m_bInterpol);
+//		result.m_X= m_BigRect.left+ result.m_X*m_MatchParam.GetMulti();
+//		result.m_Y= m_BigRect.top+ result.m_Y*m_MatchParam.GetMulti();
+		mpt.x= m_BigRect.left+ (int)(result.m_X*m_MatchParam.GetMulti()+ 0.5);
+		mpt.y= m_BigRect.top+ (int)(result.m_Y*m_MatchParam.GetMulti()+ 0.5);
+
+		matchResult= result;
+		if(bRet == FALSE)
+		{
+			return FALSE;
+		}
+
+		sWidth= m_SmallRect.Width();
+		sHeight= m_SmallRect.Height();
+
+		hWidth= m_MatchParam.GetMulti()+1;
+		hHeight= m_MatchParam.GetMulti()+1;
+
+		stSISMatchResult resultBest;
+
+//#define MOSIS_DEBUG_INSPECTION_MATCHING
+#if defined(MOSIS_DEBUG_INSPECTION_MATCHING)// 概莫 捞固瘤啊 2林扁 捞哥 拘绵(乔扼固靛)概莫矫 1林扁究 撇绢咙阑 皑救秦 4锅狼 技何 概莫阑 窍咯 概莫 坷瞒甫 绝矩促.
+
+		int hsWidth= sWidth/2-1;
+		int hsHeight= sHeight/2-1;
+
+		int xMatch= 0, yMatch;
+		int x, y;
+		for(xMatch = 0; xMatch < 2; xMatch++)
+		{
+			for(yMatch= 0; yMatch < 2; yMatch++)
+			{
+				x= result.m_X+ xMatch*sWidth/2;
+				y= result.m_Y+ yMatch*sHeight/2;
+				roi.SetRect(x- hWidth, y- hHeight, x+ sWidth+ hWidth, y+ sHeight+ hHeight);
+				m_BigBuff8.SetSize(roi.Width(), roi.Height());
+				m_BigBuff8.CopyFrom(m_BigOriginal, roi);
+
+				matchResult.Invalidate();
+				bRet= MatchImpl_Coef(m_SmallBuff8, m_BigBuff8, matchResult, 0, m_MatchParam.m_bInterpol);
+
+				matchResult.m_X= roi.left+ matchResult.m_X- m_BigRect.left;
+				matchResult.m_Y= roi.top+ matchResult.m_Y- m_BigRect.top;
+				//matchResult.m_Score= result.m_Score;
+				if(matchResult.m_Score > resultBest.m_Score)
+				{
+					resultBest= matchResult;
+				}
+			}
+		}
+#else
+		//roi.SetRect(result.m_X- hWidth, result.m_Y- hHeight, result.m_X+ sWidth+ hWidth, result.m_Y+ sHeight+ hHeight);
+		roi.SetRect(mpt.x- hWidth, mpt.y- hHeight, mpt.x+ sWidth+ hWidth, mpt.y+ sHeight+ hHeight);
+		m_BigBuff8.SetSize(roi.Width(), roi.Height());
+		m_BigBuff8.CopyFrom(m_BigOriginal, roi);
+
+		resultBest.Invalidate();
+		bRet= MatchImpl_Coef(m_SmallBuff8, m_BigBuff8, resultBest, 0, m_MatchParam.m_bInterpol);
+
+		resultBest.m_X= roi.left+ resultBest.m_X- m_BigRect.left;
+		resultBest.m_Y= roi.top+ resultBest.m_Y- m_BigRect.top;
+
+#endif
+
+		matchResult= resultBest;
+		result.m_X= resultBest.m_X+ m_BigRect.left;
+		result.m_Y= resultBest.m_Y+ m_BigRect.top;
+		
+		return matchResult.m_Score >= m_MatchParam.m_Acceptance;
+	}
+
+	m_BigBuff8.SetSize(m_BigRect.Width(), m_BigRect.Height());
+	if(!m_BigBuff8.CopyFrom(m_BigOriginal, m_BigRect))
+		return FALSE;
+
+	result.Invalidate();
+	bRet= MatchImpl_Coef(m_SmallBuff8, m_BigBuff8, result, 0, m_MatchParam.m_bInterpol);
+	matchResult= result;
+	return matchResult.m_Score >= m_MatchParam.m_Acceptance;
+}
+/* calculates 1/sqrt(val) */
+#define FLT_EPSILON     1.192092896e-07F        /* smallest such that 1.0+FLT_EPSILON != 1.0 */
+#define _CV_SQRT_MAGIC     0xbe6f0000
+double
+h_InvSqrt64d( double arg )
+{
+    double x, y;
+    float t = (float) arg;
+	
+    *((unsigned *) &t) = (_CV_SQRT_MAGIC - *((unsigned *) &t)) >> 1;
+    y = arg * 0.5;
+    x = t;
+    x *= 1.5 - y * x * x;
+    x *= 1.5 - y * x * x;
+    x *= 1.5 - y * x * x;
+    x *= 1.5 - y * x * x;
+
+	
+	return x;
+}
+#define MOSIS_SQRT(A) sqrt(fabs(A))
+#define MOSIS_INVERSE_SQRT(A) h_InvSqrt64d(fabs((long double)A)+ FLT_EPSILON)
+//#define MOSIS_INVERSE_SQRT(A) h_InvSqrt64d(fabs(A))
+//#define MOSIS_INVERSE_SQRT(A) (1/sqrt(fabs((double)A)))
+
+BOOL CMatchImpl::MatchImpl(CUShortBuff &smallBuffer, CUShortBuff &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate)
+{
+	int64 smallSqsum;
+
+	if(! Check_Buffer(smallBuffer, bigBuffer))
+		return FALSE;
+
+
+	int x, y;
+
+	int64 sqsval;
+	m_sqSumBuffer.SetSize(1, bigBuffer.GetHeight());
+	m_resultBuffer.SetSize(bigBuffer.GetWidth()- smallBuffer.GetWidth()+ 1, bigBuffer.GetHeight()- smallBuffer.GetHeight()+ 1);
+	m_resNumBuffer.SetSize(1, m_resultBuffer.GetHeight());
+	m_resDenomBuffer.SetSize(1, m_resultBuffer.GetHeight()*2);
+
+
+	m_tempBuffer16.SetSize(smallBuffer.GetWidth(), bigBuffer.GetHeight()+ bigBuffer.GetWidth()/smallBuffer.GetWidth()+ 10);
+	if(!m_tempBuffer16.CopyFrom(bigBuffer, CRect(0, 0, smallBuffer.GetWidth(), bigBuffer.GetHeight())))
+		return FALSE;
+
+	int64 *sqsumBuf= m_sqSumBuffer.GetDataAddress(0, 0);
+	smallSqsum = CSISMath::Get_CCU16_A(smallBuffer.GetDataAddress(), smallBuffer.GetDataSize());
+	double smallCoeff = (double)smallSqsum;
+	smallCoeff = h_InvSqrt64d( fabs( smallCoeff ) + FLT_EPSILON );
+
+	for(y= 0; y< bigBuffer.GetHeight(); y++)
+	{
+		sqsval = CSISMath::Get_CCU16_UA(bigBuffer.GetDataAddress(0, y), smallBuffer.GetWidth() );
+		m_sqSumBuffer.SetData(0, y, sqsval);
+	}
+
+	int64 *resNum= m_resNumBuffer.GetDataAddress(0, 0);
+	int64 *resDenom= m_resDenomBuffer.GetDataAddress(0, 0);
+	for(x= 0; x< m_resultBuffer.GetWidth(); x++)
+	{
+		sqsval= 0;
+        ushort *imgPtr = m_tempBuffer16.GetDataAddress(x, 0);
+
+		if(x > 0)
+		{
+            const ushort *src = bigBuffer.GetDataAddress(x + smallBuffer.GetWidth() - 1, 0);
+            ushort *dst = imgPtr - 1;
+            int out_val = dst[0];
+			
+            dst += smallBuffer.GetWidth();
+			
+            for( y = 0; y < bigBuffer.GetHeight(); y++, src += bigBuffer.GetWidth(), dst += smallBuffer.GetWidth() )
+            {
+                int in_val = src[0];
+
+                sqsumBuf[y] += (in_val - out_val) * (in_val + out_val);
+                out_val = dst[0];
+                dst[0] = (ushort) in_val;
+            }
+		}
+        for( y = 0; y < smallBuffer.GetHeight(); y++ )
+        {
+            sqsval += sqsumBuf[y];
+        }
+
+		for( y = 0; y < m_resultBuffer.GetHeight(); y++, imgPtr += smallBuffer.GetWidth() )
+        {
+            int64 res = CSISMath::Get_CCU16_AUA(smallBuffer.GetDataAddress(),  imgPtr, smallBuffer.GetDataSize() );
+			
+            if( y > 0 )
+            {
+                sqsval -= sqsumBuf[y - 1];
+                sqsval += sqsumBuf[y + smallBuffer.GetHeight() - 1];
+            }
+            resNum[y] = res;
+            resDenom[y] = sqsval;
+        }
+
+		for( y = 0; y < m_resultBuffer.GetHeight(); y++ )
+        {
+            double res = ((double) resNum[y]) * smallCoeff *
+                h_InvSqrt64d( fabs( (double) resDenom[y] ) + FLT_EPSILON );
+			
+            //pResult[x + y * resultStep] = (float) res;
+			m_resultBuffer.SetData(x, y, (float)res);
+        }
+	}
+
+	return m_resultBuffer.GetBestMatchResult(matchResult, acceptance, bUseInterpolate);
+}
+
+BOOL CMatchImpl::MatchImpl(CSISBuffer &smallBuffer, CSISBuffer &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate)
+{
+
+	int64 smallSqsum;
+	m_sqSumBuffer.SetSize(1, bigBuffer.GetHeight());
+	m_resultBuffer.SetSize(bigBuffer.GetWidth()- smallBuffer.GetWidth()+ 1, bigBuffer.GetHeight()- smallBuffer.GetHeight()+ 1);
+	m_resNumBuffer.SetSize(1, m_resultBuffer.GetHeight());
+	m_resDenomBuffer.SetSize(1, m_resultBuffer.GetHeight());
+
+	int width, height;
+	int x, y;
+	int dx, dy;
+	int64 sqsum, sqssum2;
+	width= smallBuffer.GetWidth();
+	height= smallBuffer.GetHeight();
+	dx= bigBuffer.GetWidth()- width;
+	dy= bigBuffer.GetHeight()- height;
+
+// 	CByteBuff aBuffer, bBuffer;
+// 	aBuffer.SetBuffer(buffer1, x1, y1, width, height);
+// 	bBuffer.SetBuffer(buffer2, x2, y2, width, height);
+// 	return Get_CCU8(aBuffer.GetDataAddress(0, 0), bBuffer.GetDataAddress(0, 0), width*height);
+
+
+	smallSqsum= CSISMath::Get_CCU8(smallBuffer, 0, 0, width, height, smallBuffer, 0, 0);
+// 	smallSqsum= CrossCorr_8u_C1(smallBuffer, 0, 0, width, height, smallBuffer, 0, 0);
+	double smallCoeff;
+	smallCoeff= MOSIS_INVERSE_SQRT(smallSqsum);
+	double res;
+
+
+
+	for(y= 0; y< dy; y++)
+	{
+		for(x= 0; x< dx; x++)
+		{
+// 			sqsum= CrossCorr_8u_C1(smallBuffer, 0, 0, width, height, bigBuffer, x, y);
+// 			sqssum2= CrossCorr_8u_C1(bigBuffer, x, y, width, height, bigBuffer, x, y);
+			sqsum= CSISMath::Get_CCU8(smallBuffer, 0, 0, width, height, bigBuffer, x, y);
+			sqssum2= CSISMath::Get_CCU8(bigBuffer, x, y, width, height, bigBuffer, x, y);
+			res= sqsum*smallCoeff*MOSIS_INVERSE_SQRT(sqssum2);
+			m_resultBuffer.SetData(x, y, (float)res);
+		}
+	}
+
+	
+	return m_resultBuffer.GetBestMatchResult(matchResult, acceptance, bUseInterpolate);
+}
+
+
+#define DBL_EPSILON     2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
+
+
+BOOL CMatchImpl::MatchImpl(CByteBuff &smallBuffer, CByteBuff &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate)
+{
+	int64 smallSqsum;
+
+	int x, y;
+	if(! Check_Buffer(smallBuffer, bigBuffer))
+		return FALSE;
+	
+	int64 sqsval;
+	m_resultBuffer.SetSize(bigBuffer.GetWidth()- smallBuffer.GetWidth()+ 1, bigBuffer.GetHeight()- smallBuffer.GetHeight()+ 1);
+	m_sqSumBuffer.SetSize(1, bigBuffer.GetHeight());
+	m_resNumBuffer.SetSize(1, m_resultBuffer.GetHeight());
+	m_resDenomBuffer.SetSize(1, m_resultBuffer.GetHeight()*2);
+	
+	m_tempBuffer8.SetSize(smallBuffer.GetWidth(), bigBuffer.GetHeight()+ bigBuffer.GetWidth()/smallBuffer.GetWidth()+ 10);
+	if(!m_tempBuffer8.CopyFrom(bigBuffer, CRect(0, 0, smallBuffer.GetWidth(), bigBuffer.GetHeight())))
+		return FALSE;
+	
+	int64 *sqsumBuf= m_sqSumBuffer.GetDataAddress(0, 0);
+#if defined(MOSIS_ASM)
+	smallSqsum = _asm_Get_CCU8(smallBuffer.GetDataAddress(), NULL, smallBuffer.GetDataSize(), 0);
+#else
+	smallSqsum = CSISMath::Get_CCU8_A(smallBuffer.GetDataAddress(), smallBuffer.GetDataSize());
+#endif
+	double smallCoeff = (double)smallSqsum;
+	smallCoeff = MOSIS_INVERSE_SQRT(smallCoeff);//h_InvSqrt64d( fabs( smallCoeff ) + FLT_EPSILON );
+	
+	for(y= 0; y< bigBuffer.GetHeight(); y++)
+	{
+#if defined(MOSIS_ASM)
+		sqsval = _asm_Get_CCU8(bigBuffer.GetDataAddress(0, y), NULL, smallBuffer.GetWidth(), 2);
+#else
+		sqsval = CSISMath::Get_CCU8_UA(bigBuffer.GetDataAddress(0, y), smallBuffer.GetWidth() );
+#endif
+		m_sqSumBuffer.SetData(0, y, sqsval);
+	}
+	
+	int64 *resNum= m_resNumBuffer.GetDataAddress(0, 0);
+	int64 *resDenom= m_resDenomBuffer.GetDataAddress(0, 0);
+
+
+	for(x= 0; x< m_resultBuffer.GetWidth(); x++)
+	{
+		sqsval= 0;
+        uchar *imgPtr = m_tempBuffer8.GetDataAddress(x, 0);
+		
+		if(x > 0)
+		{
+            const uchar *src = bigBuffer.GetDataAddress(x + smallBuffer.GetWidth() - 1, 0);
+            uchar *dst = imgPtr - 1;
+            int out_val = dst[0];
+			
+            dst += smallBuffer.GetWidth();
+			
+            for( y = 0; y < bigBuffer.GetHeight(); y++, src += bigBuffer.GetWidth(), dst += smallBuffer.GetWidth() )
+            {
+                int in_val = src[0];
+				
+                sqsumBuf[y] += (in_val - out_val) * (in_val + out_val);
+                out_val = dst[0];
+                dst[0] = (uchar) in_val;
+            }
+		}
+        for( y = 0; y < smallBuffer.GetHeight(); y++ )
+        {
+            sqsval += sqsumBuf[y];
+        }
+		
+		for( y = 0; y < m_resultBuffer.GetHeight(); y++, imgPtr += smallBuffer.GetWidth() )
+        {
+			int64 res= 0;
+#if defined(MOSIS_ASM)
+			res = _asm_Get_CCU8(smallBuffer.GetDataAddress(), imgPtr, smallBuffer.GetDataSize(), 1);
+#else
+			res = CSISMath::Get_CCU8_AUA(smallBuffer.GetDataAddress(),  imgPtr, smallBuffer.GetDataSize() );
+#endif
+			
+            if( y > 0 )
+            {
+                sqsval -= sqsumBuf[y - 1];
+                sqsval += sqsumBuf[y + smallBuffer.GetHeight() - 1];
+            }
+            resNum[y] = res;
+            resDenom[y] = sqsval;
+        }
+		
+		for( y = 0; y < m_resultBuffer.GetHeight(); y++ )
+        {
+            double res = ((double) resNum[y]) * smallCoeff * MOSIS_INVERSE_SQRT(resDenom[y]);
+			//h_InvSqrt64d( fabs( (double) resDenom[y] ) + FLT_EPSILON );
+			
+            //pResult[x + y * resultStep] = (float) res;
+			m_resultBuffer.SetData(x, y, (float)res);
+        }
+	}
+	
+	
+	return m_resultBuffer.GetBestMatchResult(matchResult, acceptance, bUseInterpolate);
+}
+
+
+
+
+BOOL CMatchImpl::MatchImpl_Coef(CByteBuff &smallBuffer, CByteBuff &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate)
+{
+	int64 smallSqsum;
+	int x, y;
+	if(! Check_Buffer(smallBuffer, bigBuffer))
+		return FALSE;
+
+
+//	int64 sqsval;
+	int64 sum= 0, sqsum= 0;
+	int64 templSum;
+    double winCoeff = 1. / (smallBuffer.GetDataSize() + DBL_EPSILON);
+	m_sumBuffer.SetSize(1, bigBuffer.GetHeight());
+	m_sqSumBuffer.SetSize(1, bigBuffer.GetHeight());
+	m_resultBuffer.SetSize(bigBuffer.GetWidth()- smallBuffer.GetWidth()+ 1, bigBuffer.GetHeight()- smallBuffer.GetHeight()+ 1);
+	m_resNumBuffer.SetSize(1, m_resultBuffer.GetHeight());
+	m_resDenomBuffer.SetSize(1, (m_resultBuffer.GetHeight())*2);
+	
+	m_tempBuffer8.SetSize(smallBuffer.GetWidth(), bigBuffer.GetHeight()+ bigBuffer.GetWidth()/smallBuffer.GetWidth()+ 10);
+	if(!m_tempBuffer8.CopyFrom(bigBuffer, CRect(0, 0, smallBuffer.GetWidth(), bigBuffer.GetHeight())))
+		return FALSE;
+	
+	int64 *sumBuf= m_sumBuffer.GetDataAddress(0, 0);
+	int64 *sqsumBuf= m_sqSumBuffer.GetDataAddress(0, 0);
+#if defined(MOSIS_ASM)
+	smallSqsum = _asm_Get_CCU8(smallBuffer.GetDataAddress(), NULL, smallBuffer.GetDataSize(), 0);
+#else
+	smallSqsum = CSISMath::Get_CCU8_A(smallBuffer.GetDataAddress(), smallBuffer.GetDataSize());
+#endif
+	templSum = CSISMath::SumPixels_8u(smallBuffer.GetDataAddress(), smallBuffer.GetDataSize());
+	double smallCoeff = (double)smallSqsum;
+	smallCoeff = (double) smallSqsum - ((double) templSum) * templSum * winCoeff;
+	smallCoeff = MOSIS_INVERSE_SQRT(smallCoeff);//h_InvSqrt64d( fabs( smallCoeff ) + FLT_EPSILON );
+	
+	for(y= 0; y< bigBuffer.GetHeight(); y++)
+	{
+		sumBuf[y] = CSISMath::SumPixels_8u( bigBuffer.GetDataAddress(0, y), smallBuffer.GetWidth() );
+#if defined(MOSIS_ASM)
+		sqsumBuf[y] = _asm_Get_CCU8(bigBuffer.GetDataAddress(), NULL, smallBuffer.GetWidth(), 2);
+#else
+		sqsumBuf[y] = CSISMath::Get_CCU8_UA(bigBuffer.GetDataAddress(0, y), smallBuffer.GetWidth() );
+#endif
+	}
+	
+	int64 *resNum= m_resNumBuffer.GetDataAddress(0, 0);
+	int64 *resDenom= m_resDenomBuffer.GetDataAddress(0, 0);
+	for(x= 0; x< m_resultBuffer.GetWidth(); x++)
+	{
+		sum= 0;
+		sqsum= 0;
+        uchar *imgPtr = m_tempBuffer8.GetDataAddress(x, 0);
+		
+		if(x > 0)
+		{
+            const uchar *src = bigBuffer.GetDataAddress(x + smallBuffer.GetWidth() - 1, 0);
+            uchar *dst = imgPtr - 1;
+            int out_val = dst[0];
+			
+            dst += smallBuffer.GetWidth();
+			
+            for( y = 0; y < bigBuffer.GetHeight(); y++, src += bigBuffer.GetWidth(), dst += smallBuffer.GetWidth() )
+            {
+                int in_val = src[0];
+				
+                sumBuf[y] += in_val - out_val;
+                sqsumBuf[y] += (in_val - out_val) * (in_val + out_val);
+                out_val = dst[0];
+                dst[0] = (uchar) in_val;
+            }
+		}
+        for( y = 0; y < smallBuffer.GetHeight(); y++ )
+        {
+            sum += sumBuf[y];
+            sqsum += sqsumBuf[y];
+        }
+
+		for( y = 0; y < m_resultBuffer.GetHeight(); y++, imgPtr += smallBuffer.GetWidth() )
+        {
+			int64 res;
+#if defined(MOSIS_ASM)
+			res = _asm_Get_CCU8(smallBuffer.GetDataAddress(), imgPtr, smallBuffer.GetDataSize(), 1);
+#else
+			res = CSISMath::Get_CCU8_AUA(smallBuffer.GetDataAddress(),  imgPtr, smallBuffer.GetDataSize() );
+#endif
+
+            if( y > 0 )
+            {
+                sum -= sumBuf[y - 1];
+                sum += sumBuf[y + smallBuffer.GetHeight() - 1];
+                sqsum -= sqsumBuf[y - 1];
+                sqsum += sqsumBuf[y + smallBuffer.GetHeight() - 1];
+            }
+            resNum[y] = res;
+            resDenom[y] = sum;
+            resDenom[y + m_resultBuffer.GetHeight()] = sqsum;
+        }
+		
+		for( y = 0; y < m_resultBuffer.GetHeight(); y++ )
+        {
+			double Dsum = ((double) resDenom[y]);
+            double wsum = winCoeff * Dsum;
+            double res = ((double) resNum[y]) - wsum * templSum;
+            double nrm_s = ((double) resDenom[y + m_resultBuffer.GetHeight()]) - wsum * Dsum;
+            res *= smallCoeff * MOSIS_INVERSE_SQRT(nrm_s);//icvInvSqrt64d( fabs( nrm_s ) + FLT_EPSILON );
+			m_resultBuffer.SetData(x, y, (float)res);
+        }
+	}
+	
+	BOOL bRet= m_resultBuffer.GetBestMatchResult(matchResult, acceptance, bUseInterpolate);
+	return bRet;
+}
+
+
+BOOL CMatchImpl::MatchImpl_Coef(CUShortBuff &smallBuffer, CUShortBuff &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate)
+{
+	int64 smallSqsum;
+	int x, y;
+	if(! Check_Buffer(smallBuffer, bigBuffer))
+		return FALSE;
+	
+//	int64 sqsval;
+    double winCoeff = 1. / (smallBuffer.GetDataSize() + DBL_EPSILON);
+	int64 sum= 0, sqsum= 0;
+	int64 templSum;
+	m_sumBuffer.SetSize(1, bigBuffer.GetHeight());
+	m_sqSumBuffer.SetSize(1, bigBuffer.GetHeight());
+	m_resultBuffer.SetSize(bigBuffer.GetWidth()- smallBuffer.GetWidth()+ 1, bigBuffer.GetHeight()- smallBuffer.GetHeight()+ 1);
+	m_resNumBuffer.SetSize(1, m_resultBuffer.GetHeight());
+	m_resDenomBuffer.SetSize(1, (m_resultBuffer.GetHeight())*2);
+	
+	m_tempBuffer16.SetSize(smallBuffer.GetWidth(), bigBuffer.GetHeight()+ bigBuffer.GetWidth()/smallBuffer.GetWidth()+ 10);
+	if(!m_tempBuffer16.CopyFrom(bigBuffer, CRect(0, 0, smallBuffer.GetWidth(), bigBuffer.GetHeight())))
+		return FALSE;
+	
+	int64 *sumBuf= m_sumBuffer.GetDataAddress(0, 0);
+	int64 *sqsumBuf= m_sqSumBuffer.GetDataAddress(0, 0);
+	smallSqsum = CSISMath::Get_CCU16_A(smallBuffer.GetDataAddress(), smallBuffer.GetDataSize());
+	templSum = CSISMath::SumPixels_16u(smallBuffer.GetDataAddress(), smallBuffer.GetDataSize());
+	double smallCoeff = (double)smallSqsum;
+	smallCoeff = (double) smallSqsum - ((double) templSum) * templSum * winCoeff;
+	smallCoeff = MOSIS_INVERSE_SQRT(smallCoeff);//h_InvSqrt64d( fabs( smallCoeff ) + FLT_EPSILON );
+
+	for(y= 0; y< bigBuffer.GetHeight(); y++)
+	{
+		sumBuf[y] = CSISMath::SumPixels_16u( bigBuffer.GetDataAddress(0, y), smallBuffer.GetWidth() );
+		sqsumBuf[y] = CSISMath::Get_CCU16_UA(bigBuffer.GetDataAddress(0, y), smallBuffer.GetWidth() );
+	}
+	
+	int64 *resNum= m_resNumBuffer.GetDataAddress(0, 0);
+	int64 *resDenom= m_resDenomBuffer.GetDataAddress(0, 0);
+	for(x= 0; x< m_resultBuffer.GetWidth(); x++)
+	{
+		sum= 0;
+		sqsum= 0;
+        ushort *imgPtr = m_tempBuffer16.GetDataAddress(x, 0);
+		
+		if(x > 0)
+		{
+            const ushort *src = bigBuffer.GetDataAddress(x + smallBuffer.GetWidth() - 1, 0);
+            ushort *dst = imgPtr - 1;
+            int out_val = dst[0];
+			
+            dst += smallBuffer.GetWidth();
+			
+            for( y = 0; y < bigBuffer.GetHeight(); y++, src += bigBuffer.GetWidth(), dst += smallBuffer.GetWidth() )
+            {
+                int in_val = src[0];
+				
+                sumBuf[y] += in_val - out_val;
+                sqsumBuf[y] += (in_val - out_val) * (in_val + out_val);
+                out_val = dst[0];
+                dst[0] = (ushort) in_val;
+            }
+		}
+       for( y = 0; y < smallBuffer.GetHeight(); y++ )
+        {
+            sum += sumBuf[y];
+            sqsum += sqsumBuf[y];
+        }
+		
+		for( y = 0; y < m_resultBuffer.GetHeight(); y++, imgPtr += smallBuffer.GetWidth() )
+        {
+            int64 res = CSISMath::Get_CCU16_AUA(smallBuffer.GetDataAddress(),  imgPtr, smallBuffer.GetDataSize() );
+			
+            if( y > 0 )
+            {
+                sum -= sumBuf[y - 1];
+                sum += sumBuf[y + smallBuffer.GetHeight() - 1];
+                sqsum -= sqsumBuf[y - 1];
+                sqsum += sqsumBuf[y + smallBuffer.GetHeight() - 1];
+            }
+            resNum[y] = res;
+            resDenom[y] = sum;
+            resDenom[y + m_resultBuffer.GetHeight()] = sqsum;
+        }
+ 	
+		
+		for( y = 0; y < m_resultBuffer.GetHeight(); y++ )
+        {
+			double dsum = ((double) resDenom[y]);
+            double wsum = winCoeff * dsum;
+            double res = ((double) resNum[y]) - wsum * templSum;
+            double nrm_s = ((double) resDenom[y + m_resultBuffer.GetHeight()]) - wsum * dsum;
+            res *= smallCoeff * MOSIS_INVERSE_SQRT(nrm_s);//icvInvSqrt64d( fabs( nrm_s ) + FLT_EPSILON );
+			m_resultBuffer.SetData(x, y, (float)res);
+        }
+	
+	}
+	
+	return m_resultBuffer.GetBestMatchResult(matchResult, acceptance, bUseInterpolate);
+}
+
+
+void CResultBufferFloat::ReleaseSpace()
+{
+	if(m_pData)
+		delete[] m_pData;
+	m_pData= NULL;
+	m_Width= 0;
+	m_Height= 0;
+	m_DataSpace= 0;
+}
+void CResultBufferInt64::ReleaseSpace()
+{
+	if(m_pData)
+		delete[] m_pData;
+	m_pData= NULL;
+	m_Width= 0;
+	m_Height= 0;
+	m_DataSpace= 0;
+}
+BOOL CResultBufferFloat::SetSize(int width, int height)
+{
+	int space= width*height;
+	if(space < 1)
+		return FALSE;
+
+	if(m_DataSpace < space)
+	{
+		ReleaseSpace();
+	}
+
+	if(m_pData == NULL)
+	{
+		m_pData= new float[space];
+		m_DataSpace= space;
+	}
+
+	m_Width= width;
+	m_Height= height;
+
+	return IsValidBuffer();
+}
+BOOL CResultBufferInt64::SetSize(int width, int height)
+{
+	int space= width*height;
+	if(space < 1)
+		return FALSE;
+	if(m_DataSpace < space)
+	{
+		ReleaseSpace();
+	}
+	
+	if(m_pData == NULL)
+	{
+		m_pData= new int64[space];
+		m_DataSpace= space;
+	}
+	
+	m_Width= width;
+	m_Height= height;
+
+	return IsValidBuffer();
+}
+CResultBufferFloat::~CResultBufferFloat()
+{
+	if(m_pData)
+		delete[] m_pData;
+}
+CResultBufferInt64::~CResultBufferInt64()
+{
+	if(m_pData)
+		delete[] m_pData;
+}
+
+BOOL CResultBufferFloat::GetBestMatchResult(stSISMatchResult &result, double acceptance, BOOL bUseInterpolate)
+{
+	int width, height;
+	float best= GetData(0, 0);
+	int i, j;
+	int xx= 0, yy= 0;
+	double xxx, yyy;
+	
+	width= GetWidth();
+	height= GetHeight();
+	
+	for(i= 0; i< width; i++)
+	{
+		for(j= 0; j< height; j++)
+		{
+			if(best < GetData(i, j))//*pBest)
+			{
+				best= GetData(i, j);
+				xx= i;
+				yy= j;
+			}
+		}
+	}
+	result.m_X= xx;
+	result.m_Y= yy;
+	result.m_Score= best;
+	if(!bUseInterpolate)
+		return result.m_Score >= acceptance;
+
+
+	float best1, best3;
+// 	float points[4];
+// 	float data[4];
+	if(xx == 0)
+	{
+		xxx= xx;
+// 		points[0]= 0;
+// 		points[1]= 1;
+// 		points[2]= 2;
+// 		data[0]= GetData(points[0], yy);
+// 		data[1]= GetData(points[1], yy);
+// 		data[2]= GetData(points[2], yy);
+// 		xxx= GetRegressionCoeffInPoly(points, data, 3);
+	}
+	else if(xx == width-1)
+	{
+		xxx= xx;
+// 		points[0]= width- 4;
+// 		points[1]= width- 3;
+// 		points[2]= width- 2;
+// 		points[3]= width- 1;
+// 		data[0]= GetData(points[0], yy);
+// 		data[1]= GetData(points[1], yy);
+// 		data[2]= GetData(points[2], yy);
+// 		data[3]= GetData(points[3], yy);
+// 		xxx= GetRegressionCoeffInPoly(points, data, 4);
+	}
+	else
+	{
+		best1= GetData(xx- 1, yy);//*(pBest- 1);
+		best3= GetData(xx+ 1, yy);//*(pBest+ 1);
+		if(best == best3)
+		{
+			xxx= xx+ 0.5;
+		}
+		else if(best == best1)
+		{
+			xxx= xx- 0.5;
+		}
+		else if(best1 < best3)
+		{
+			xxx= xx+ 0.5- 0.5*(best- best3)/(best- best1);
+		}
+		else// if(*(pBest-1) > best3)
+		{
+			xxx= xx- 0.5+ 0.5/(best- best3)*(best- best1);
+		}
+		
+// 		points[0]= xx-1;
+// 		points[1]= xx;
+// 		points[2]= xx+1;
+// 		data[0]= GetData(points[0], yy);
+// 		data[1]= GetData(points[1], yy);
+// 		data[2]= GetData(points[2], yy);
+// 		xxx= GetRegressionCoeffInPoly(points, data, 3);
+	}
+
+	if(yy == 0)
+	{
+// 		points[0]= 0;
+// 		points[1]= 1;
+// 		points[2]= 2;
+// 		data[0]= GetData(xx, points[0]);
+// 		data[1]= GetData(xx, points[1]);		
+// 		data[2]= GetData(xx, points[2]);
+// 		yyy= GetRegressionCoeffInPoly(points, data, 3);
+		yyy= yy;
+	}
+	else if(yy == height-1)
+	{
+// 		points[0]= height- 3;
+// 		points[1]= height- 2;
+// 		points[2]= height- 1;
+// 		data[0]= GetData(xx, points[0]);
+// 		data[1]= GetData(xx, points[1]);
+// 		data[2]= GetData(xx, points[2]);
+// 		yyy= GetRegressionCoeffInPoly(points, data, 3);
+		yyy= yy;
+	}
+	else
+	{
+
+		best1= GetData(xx, yy- 1);//*(pBest- width);
+		best3= GetData(xx, yy+ 1);//*(pBest+ height);
+		if(best == best3)
+		{
+			yyy= yy+ 0.5;
+		}
+		else if(best == best1)
+		{
+			yyy= yy- 0.5;
+		}
+		else if(best1 < best3)
+		{
+			yyy= yy+ 0.5- 0.5*(best- best3)/(best- best1);
+		}
+		else// if(best1 > best3)
+		{
+			yyy= yy- 0.5+ 0.5/(best- best3)*(best- best1);
+		}
+
+// 		points[0]= yy-1;
+// 		points[1]= yy;
+// 		points[2]= yy+1;
+// 		data[0]= GetData(xx, points[0]);
+// 		data[1]= GetData(xx, points[1]);
+// 		data[2]= GetData(xx, points[2]);
+// 		yyy= GetRegressionCoeffInPoly(points, data, 3);
+	}
+	result.m_X= xxx;
+	result.m_Y= yyy;
+	result.m_Score= best;
+	return result.m_Score >= acceptance;
+}
+
+BOOL CResultBufferInt64::GetBestMatchResult(stSISMatchResult &result, double acceptance, BOOL bUseInterpolate)
+{
+	return FALSE;
+/*	int width, height;
+	int64 best= 0;
+	int i, j;
+	int xx, yy;
+	double xxx, yyy;
+	
+	width= GetWidth();
+	height= GetHeight();
+	
+	for(i= 0; i< width; i++)
+	{
+		for(j= 0; j< height; j++)
+		{
+			if(best < GetData(i, j))//*pBest)
+			{
+				best= GetData(i, j);
+				xx= i;
+				yy= j;
+			}
+		}
+	}
+	result.m_X= xx;
+	result.m_Y= yy;
+	result.m_Score= best;
+	if(!bUseInterpolate)
+		return result.m_Score >= acceptance;
+
+
+	int64 best1, best3;
+//	float points[3];
+//	float data[3];
+	if(xx == 0)
+	{
+// 		points[0]= 0;
+// 		points[1]= 1;
+// 		points[2]= 2;
+// 		data[0]= GetData(points[0], yy);
+// 		data[1]= GetData(points[1], yy);
+// 		data[2]= GetData(points[2], yy);
+// 		xxx= GetRegressionCoeffInPoly(points, data, 3);
+		xxx= xx;
+	}
+	else if(xx == width-1)
+	{
+// 		points[0]= width- 3;
+// 		points[1]= width- 2;
+// 		points[2]= width- 1;
+// 		data[0]= GetData(points[0], yy);
+// 		data[1]= GetData(points[1], yy);
+// 		data[2]= GetData(points[2], yy);
+// 		xxx= GetRegressionCoeffInPoly(points, data, 3);
+		xxx= xx;
+	}
+	else
+	{
+		best1= GetData(xx- 1, yy);//*(pBest- 1);
+		best3= GetData(xx+ 1, yy);//*(pBest+ 1);
+		if(best == best3)
+		{
+			xxx= xx+ 0.5;
+		}
+		else if(best == best1)
+		{
+			xxx= xx- 0.5;
+		}
+		else if(best1 < best3)
+		{
+			xxx= xx+ 0.5- 0.5*(best- best3)/(best- best1);
+		}
+		else// if(*(pBest-1) > best3)
+		{
+			xxx= xx- 0.5+ 0.5/(best- best3)*(best- best1);
+		}
+		
+// 		points[0]= xx-1;
+// 		points[1]= xx;
+// 		points[2]= xx+1;
+// 		data[0]= GetData(points[0], yy);
+// 		data[1]= GetData(points[1], yy);
+// 		data[2]= GetData(points[2], yy);
+// 		xxx= GetRegressionCoeffInPoly(points, data, 3);
+	}
+
+	if(yy == 0)
+	{
+// 		points[0]= 0;
+// 		points[1]= 1;
+// 		points[2]= 2;
+// 		data[0]= GetData(xx, points[0]);
+// 		data[1]= GetData(xx, points[1]);
+// 		data[2]= GetData(xx, points[2]);
+// 		yyy= GetRegressionCoeffInPoly(points, data, 3);
+		yyy= yy;
+	}
+	else if(yy == height-1)
+	{
+// 		points[0]= height- 3;
+// 		points[1]= height- 2;
+// 		points[2]= height- 1;
+// 		data[0]= GetData(xx, points[0]);
+// 		data[1]= GetData(xx, points[1]);
+// 		data[2]= GetData(xx, points[2]);
+// 		yyy= GetRegressionCoeffInPoly(points, data, 3);
+		yyy= yy;
+	}
+	else
+	{
+
+		best1= GetData(xx, yy- 1);//*(pBest- width);
+		best3= GetData(xx, yy+ 1);//*(pBest+ height);
+		if(best == best3)
+		{
+			yyy= yy+ 0.5;
+		}
+		else if(best == best1)
+		{
+			yyy= yy- 0.5;
+		}
+		else if(best1 < best3)
+		{
+			yyy= yy+ 0.5- 0.5*(best- best3)/(best- best1);
+		}
+		else// if(best1 > best3)
+		{
+			yyy= yy- 0.5+ 0.5/(best- best3)*(best- best1);
+		}
+
+// 		points[0]= yy-1;
+// 		points[1]= yy;
+// 		points[2]= yy+1;
+// 		data[0]= GetData(xx, points[0]);
+// 		data[1]= GetData(xx, points[1]);
+// 		data[2]= GetData(xx, points[2]);
+// 		yyy= GetRegressionCoeffInPoly(points, data, 3);
+	}
+	result.m_X= xxx;
+	result.m_Y= yyy;
+	result.m_Score= best;
+	return result.m_Score >= acceptance;
+	*/
+}
+
+#include "LeastSquare.h"
+float GetRegressionCoeffInPoly(float* points , float *scores, int nSize)
+{
+	float aCoeff[3];
+	LeastSquareFns fns;
+
+	fns.GetRegressionCoeffInPoly(points, scores, aCoeff, 2, nSize);
+
+	float xx= -aCoeff[1]/(2*aCoeff[2]);
+	return xx;
+
+}
+
diff --git a/Common_Class/SISBuffer/MatchImpl.h b/Common_Class/SISBuffer/MatchImpl.h
new file mode 100644
index 0000000..ef8f773
--- /dev/null
+++ b/Common_Class/SISBuffer/MatchImpl.h
@@ -0,0 +1,151 @@
+// MatchImpl.h: interface for the CMatchImpl class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MATCHIMPL_H__55548055_7034_4B12_A642_2771D6DFBAA4__INCLUDED_)
+#define AFX_MATCHIMPL_H__55548055_7034_4B12_A642_2771D6DFBAA4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "InspectionBuffer.h"
+#include "SISMatch.h"
+#include "SISMath.h"
+
+#include "MatchBuffer.h"
+
+typedef __int64 int64;
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+
+
+class CResultBufferInt64
+{
+	int		m_Width, m_Height;
+	int	m_DataSpace;
+	int64	*m_pData;
+public:
+	CResultBufferInt64()
+	{
+		m_pData= NULL;
+		m_Width= 0;
+		m_Height= 0;
+		m_DataSpace= 0;
+	}
+	~CResultBufferInt64();
+	
+	BOOL IsValidBuffer(){return m_pData != NULL;}
+	int		GetWidth(){return m_Width;}
+	int		GetHeight(){return m_Height;}
+	
+	void ReleaseSpace();
+	BOOL SetSize(int width, int height);
+	void SetData(int x, int y, int64 val)
+	{
+		*(m_pData+ x+ y*m_Width)= val;
+	}
+	int64 GetData(int x, int y)
+	{
+		return *(m_pData+ x+ y*m_Width);
+	}
+	int64	*GetDataAddress(int x= 0, int y= 0)
+	{
+		return m_pData+ x+ y*m_Width;
+	}
+	BOOL GetBestMatchResult(stSISMatchResult &result, double acceptance, BOOL bUseInterpolate);
+};
+
+class CResultBufferFloat
+{
+	int		m_Width, m_Height;
+	int		m_DataSpace;
+	float	*m_pData;
+public:
+	CResultBufferFloat()
+	{
+		m_pData= NULL;
+		m_Width= 0;
+		m_Height= 0;
+		m_DataSpace= 0;
+	}
+	~CResultBufferFloat();
+	
+	BOOL IsValidBuffer(){return m_pData != NULL;}
+	int		GetWidth(){return m_Width;}
+	int		GetHeight(){return m_Height;}
+	
+	void ReleaseSpace();
+	BOOL SetSize(int width, int height);
+	void SetData(int x, int y, float val)
+	{
+		*(m_pData+ x+ y*m_Width)= val;
+	}
+	float GetData(int x, int y)
+	{
+		return *(m_pData+ x+ y*m_Width);
+	}
+	float	*GetDataAddress(int x= 0, int y= 0)
+	{
+		return m_pData+ x+ y*m_Width;
+	}
+	BOOL GetBestMatchResult(stSISMatchResult &result, double acceptance, BOOL bUseInterpolate);
+};
+
+
+
+class CMatchImpl
+{
+	stSISMatchParam	m_MatchParam;
+
+	CSISBuffer		m_BigOriginal;
+	CSISBuffer		m_SmallOriginal;
+
+	BOOL				m_bSmallBufferChanged;
+	BOOL				m_bBigBufferChanged;
+
+
+	CRect				m_BigRect;
+	CRect				m_SmallRect;
+
+	CUShortBuff		m_SmallBuff16;
+	CUShortBuff		m_BigBuff16;
+
+	CByteBuff		m_BigBuff8;
+	CByteBuff		m_SmallBuff8;
+
+
+	CByteBuff				m_tempBuffer8;
+	CUShortBuff				m_tempBuffer16;
+	CResultBufferInt64		m_sumBuffer;
+	CResultBufferInt64		m_sqSumBuffer;
+	CResultBufferFloat		m_resultBuffer;
+	CResultBufferInt64		m_resNumBuffer;
+	CResultBufferInt64		m_resDenomBuffer;
+
+public:
+	CMatchImpl();
+	virtual ~CMatchImpl();
+	
+	BOOL SetBigImage(CSISBuffer bigBuff, CRect roi);
+	BOOL SetSmallImage(CSISBuffer smallBuff, CRect roi);
+	BOOL DoTemplateMatch(stSISMatchResult &matchResult, stSISMatchParam param);
+
+	BOOL MatchImpl(CUShortBuff &smallBuffer, CUShortBuff &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate);
+	BOOL MatchImpl(CByteBuff &smallBuffer, CByteBuff &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate);
+
+	BOOL MatchImpl(CSISBuffer &smallBuffer, CSISBuffer &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate);
+
+	BOOL MatchImpl_Coef(CUShortBuff &smallBuffer, CUShortBuff &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate);
+	BOOL MatchImpl_Coef(CByteBuff &smallBuffer, CByteBuff &bigBuffer, stSISMatchResult &matchResult, double acceptance, BOOL bUseInterpolate);
+
+	BOOL Check_Buffer(CUShortBuff &smallBuffer, CUShortBuff &bigBuffer);
+	BOOL Check_Buffer(CByteBuff &smallBuffer, CByteBuff &bigBuffer);
+
+};
+/*
+int64	CrossCorr_8u_C1(const uchar * vec1, const uchar * vec2, int len );
+
+BOOL MatchSimd(CByteBuff &smallBuffer, CByteBuff &bigBuffer, stSISMatchResult &matchResult, stSISMatchParam matchParam);
+*/
+#endif // !defined(AFX_MATCHIMPL_H__55548055_7034_4B12_A642_2771D6DFBAA4__INCLUDED_)
diff --git a/Common_Class/SISBuffer/MatchImpl_unuse.cpp b/Common_Class/SISBuffer/MatchImpl_unuse.cpp
new file mode 100644
index 0000000..4fcd4ac
--- /dev/null
+++ b/Common_Class/SISBuffer/MatchImpl_unuse.cpp
@@ -0,0 +1,129 @@
+// MatchImpl.cpp: implementation of the CMatchImpl class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "MatchImpl.h"
+#include "SISMath.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+#include <emmintrin.h>
+//#include <tmmintrin.h>
+//#include <ia32intrin.h>
+#include <math.h>
+
+//#define MOSIS_ASM
+
+extern "C"{
+	int64 _asm_GetCC_8u(const uchar * vec1, const uchar * vec2, int len, int flag);// 0= aa, 1=au, 2=uu
+};
+
+
+
+int64	CSISMath::Get_CCU8_A(const uchar * vec1, const uchar * vec2, int len )
+{
+#if defined(MOSIS_ASM)
+	return _asm_GetCC_8u(vec1, vec2, len, 0);
+#else
+#if defined(MOSIS_DEBUG_ALIGNED_UNALIGNED)
+	return Get_CCU8_UA(vec1, vec2, len);
+#endif
+	int i= 0, s = 0;
+	int64 sum = 0;
+
+
+#ifdef MOSIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	__m128i mmZeroData= _mm_setzero_si128();
+	mmResult= _mm_setzero_si128();
+
+#ifdef MOSIS_SIMD_INT64_NO
+	int64 res64[2];
+	int64 sum64= 0;
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+		mmB= _mm_load_si128((__m128i*) (vec2+ i));
+
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+		mmResult= _mm_add_epi64(mmAA, mmResult);
+		mmResult= _mm_add_epi64(mmBB, mmResult);
+
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+
+	_mm_storeu_si128((__m128i*)res64, mmResult);
+	sum64+= res64[0]+ res64[1];
+#endif
+	UINT32 results[4];
+
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+		mmB= _mm_load_si128((__m128i*) (vec2+ i));
+
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum+= results[0]+ results[1]+ results[2]+ results[3];
+
+#else
+	for( i = 0; i <= len - 4; i += 4 )
+	{
+		int e = vec1[i] * vec2[i];
+		int v = vec1[i + 1] * vec2[i + 1];
+
+		e += v;
+		v = vec1[i + 2] * vec2[i + 2];
+		e += v;
+		v = vec1[i + 3] * vec2[i + 3];
+		e += v;
+		sum += e;
+	}
+#endif
+
+	for( ; i < len; i++ )
+	{
+		s += vec1[i] * vec2[i];
+	}
+
+	return sum + s;
+#endif
+}
diff --git a/Common_Class/SISBuffer/NoiseLevel.cpp b/Common_Class/SISBuffer/NoiseLevel.cpp
new file mode 100644
index 0000000..2b0300f
--- /dev/null
+++ b/Common_Class/SISBuffer/NoiseLevel.cpp
@@ -0,0 +1,333 @@
+// NoiseLevel.cpp: implementation of the CNoiseLevel class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "NoiseLevel.h"
+
+#include "SISBuffer.h"
+#include <math.h>
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+// 哭率 侨伎俊 付农. -> 坷弗率栏肺 牢郸胶 柳青.
+BOOL CNoiseLevel::DrawNoisePixel2Right(CSISBuffer &buffer, CSISBuffer &buffer2, double xPitch, int threshold, BYTE color, BOOL b32)
+{
+	int x, y;
+	int width= buffer.GetWidth()- (int)xPitch- 5;
+	int level;
+
+	if(b32)
+	{
+		for(x= 0; x< width; x++)
+		{
+			for(y= 0; y < buffer.GetHeight(); y++)
+			{
+				//	level= buffer.GetPixel(x, y);
+				//	level= level- buffer.GetPixel(xPitch+ x, y);
+				level= buffer.GetDiff32(x, y, xPitch)/6;
+				if(level > threshold)
+					buffer2.SetPixel(x, y, 255);
+				else if(level < -threshold)
+					buffer2.SetPixel(x, y, 0);
+			}
+		}
+	}else
+	{
+		for(x= 0; x< width; x++)
+		{
+			for(y= 0; y < buffer.GetHeight(); y++)
+			{
+				level= buffer.GetPixel(x, y);
+				level= level- buffer.GetPixel(xPitch+ x, y);
+				if(level > threshold)
+					buffer2.SetPixel(x, y, 255);
+				else if(level < -threshold)
+					buffer2.SetPixel(x, y, 0);
+			}
+		}
+	}
+	
+	//	int k= cov(noiseLevel, buffer, xPitch);
+	return TRUE;
+}
+
+// 坷弗率 侨伎俊 付农. -> 哭率栏肺 牢郸胶 柳青
+BOOL CNoiseLevel::DrawNoisePixel2Left(CSISBuffer &buffer, CSISBuffer &buffer2, double xPitch, int threshold, BYTE color, BOOL b32)
+{
+	int x, y;
+	int width= buffer.GetWidth()- 1;
+	int xs, xe;
+	int level;
+
+	if(b32)
+	{
+		xe= width- 3;
+		xs= (int)(xPitch+ 3);
+		for(x= xe; x >= xs; x--)
+		{
+			for(y= 0; y < buffer.GetHeight(); y++)
+			{
+				//level= buffer.GetPixel(x, y);
+				//level= level- buffer.GetPixel(xPitch+ x, y);
+				level= buffer.GetDiff32(x, y, -xPitch)/6;
+				if(level > threshold)
+					buffer2.SetPixel( x+ (int)(xPitch+ 0.5), y, 255);
+				else if(level < -threshold)
+					buffer2.SetPixel( x+ (int)(xPitch+ 0.5), y, 0);
+			}
+		}
+
+	}else
+	{	
+		for(x= width; x >= 0; x--)
+		{
+			for(y= 0; y < buffer.GetHeight(); y++)
+			{
+				level= buffer.GetPixel(x, y);
+				level= level- buffer.GetPixel(xPitch+ x, y);
+				if(level > threshold)
+					buffer2.SetPixel( x+ (int)(xPitch+ 0.5), y, 255);
+				else if(level < -threshold)
+					buffer2.SetPixel( x+ (int)(xPitch+ 0.5), y, 0);
+			}
+		}
+	}
+
+	
+	//	int k= cov(noiseLevel, buffer, xPitch);
+	return TRUE;
+}
+// 窍何 侨伎俊 付农. -> 困率栏肺 牢郸胶 柳青.
+BOOL CNoiseLevel::DrawNoisePixel2Top(CSISBuffer &buffer, CSISBuffer &buffer2, double yPitch, int threshold, BYTE color, BOOL b23)
+{
+	int x, y;
+	int height= buffer.GetHeight()- (int)yPitch- 5;
+	int level;
+	int cCount= 0;
+
+	if(b23)
+	{
+		for(y= height; y >= 0; y--)
+		{
+			for(x= 0; x < buffer.GetWidth(); x++)
+			{
+				//	level= buffer.GetPixel(x, y);
+				//	level= level- buffer.GetPixel(x, yPitch+ y);
+				level= buffer.GetDiff23(x, y, yPitch)/6;
+				if(level > threshold)
+					buffer2.SetPixel( x, y+ (int)(yPitch+ 0.5), 255);
+				else if(level < -threshold)
+					buffer2.SetPixel( x, y+ (int)(yPitch+ 0.5), 0);
+			}
+		}
+	}else
+	{
+		for(y= height; y >= 0; y--)
+		{
+			for(x= 0; x < buffer.GetWidth(); x++)
+			{
+				level= buffer.GetPixel(x, y);
+				level= level- buffer.GetPixel(x, yPitch+ y);
+				//level= buffer.GetDiff23(x, y, yPitch)/6;
+				if(level > threshold)
+					buffer2.SetPixel( x, y+ (int)(yPitch+ 0.5), 255);
+				else if(level < -threshold)
+					buffer2.SetPixel( x, y+ (int)(yPitch+ 0.5), 0);
+			}
+		}
+	}
+	
+	//	int k= cov(noiseLevel, buffer, xPitch);
+	return TRUE;
+}
+// 惑何 侨伎俊 付农. -> 酒贰率栏肺 牢郸胶 柳青.
+BOOL CNoiseLevel::DrawNoisePixel2Bottom(CSISBuffer &buffer, CSISBuffer &buffer2, double yPitch, int threshold, BYTE color, BOOL b23)
+{
+	int x, y;
+	int height= buffer.GetHeight()- (int)yPitch- 5;
+	int level;
+
+	if(b23)
+	{
+		for(y= 0; y< height; y++)
+		{
+			for(x= 0; x < buffer.GetWidth(); x++)
+			{
+				//level= buffer.GetPixel(x, y);
+				//level= level- buffer.GetPixel(x, yPitch+ y);
+				level= buffer.GetDiff23(x, y, yPitch)/6;
+				if(level > threshold)
+					buffer2.SetPixel( x, y, 255);
+				else if(level < -threshold)
+					buffer2.SetPixel( x, y, 0);
+			}
+		}
+	}else
+	{
+		for(y= 0; y< height; y++)
+		{
+			for(x= 0; x < buffer.GetWidth(); x++)
+			{
+				level= buffer.GetPixel(x, y);
+				level= level- buffer.GetPixel(x, yPitch+ y);
+				//level= buffer.GetDiff23(x, y, yPitch)/6;
+				if(level > threshold)
+					buffer2.SetPixel( x, y, 255);
+				else if(level < -threshold)
+					buffer2.SetPixel( x, y, 0);
+			}
+		}
+	}
+	
+	//	int k= cov(noiseLevel, buffer, xPitch);
+	return TRUE;
+}
+
+BOOL CNoiseLevel::FindXNoiseLevel(CSISBuffer &buffer, double xPitch, BOOL b32)
+{
+	int x, y;
+	int width= buffer.GetWidth()- (int)xPitch- 5;
+	int level;
+	m_Width= width;
+	m_Height= buffer.GetHeight();
+
+	if(b32)
+	{
+		for(x= 0; x< width; x++)
+		{
+			for(y= 0; y < buffer.GetHeight(); y++)
+			{
+				// 			level= buffer.GetPixel(x, y);
+				// 			level= level- buffer.GetPixel(xPitch+ x, y);
+				level= buffer.GetDiff32(x, y, xPitch)/6;
+				CountNoise(level);
+			}
+		}
+	}else
+	{
+		for(x= 0; x< width; x++)
+		{
+			for(y= 0; y < buffer.GetHeight(); y++)
+			{
+				level= buffer.GetPixel(x, y);
+				level= level- buffer.GetPixel(xPitch+ x, y);
+				//level= buffer.GetDiff32(x, y, xPitch)/6;
+				CountNoise(level);
+			}
+		}
+	}
+	
+	//	int k= cov(noiseLevel, buffer, xPitch);
+	return TRUE;
+}  
+BOOL CNoiseLevel::FindYNoiseLevel(CSISBuffer &buffer, double yPitch, BOOL b23)
+{
+	int x, y;
+	int height= buffer.GetHeight()- (int)yPitch- 5;
+	int level;
+	m_Width= buffer.GetWidth();
+	m_Height= height;
+
+
+	if(b23)
+	{
+		for(y= 0; y< height; y++)
+		{
+			for(x= 0; x < buffer.GetWidth(); x++)
+			{
+				//level= buffer.GetPixel(x, y);
+				//level= level- buffer.GetPixel(x, yPitch+ y);
+				level= buffer.GetDiff23(x, y, yPitch)/6;
+				CountNoise(level);
+			}
+		}
+	}else
+	{
+		for(y= 0; y< height; y++)
+		{
+			for(x= 0; x < buffer.GetWidth(); x++)
+			{
+				level= buffer.GetPixel(x, y);
+				level= level- buffer.GetPixel(x, yPitch+ y);
+				//level= buffer.GetDiff23(x, y, yPitch)/6;
+				CountNoise(level);
+			}
+		}
+	}
+	
+	//	int k= cov(noiseLevel, buffer, xPitch);
+	return TRUE;
+}
+void CNoiseLevel::DrawNoiseLevel(CDC *pDC)
+{
+	if(m_FoundThreshold <= 0) return;
+	if(pDC == NULL) return;
+
+	int noiseCount;
+	int i;
+	for(i= 0; i< 255; i++)
+	{
+		noiseCount= GetNoiseCount(i);
+		if(noiseCount > 0)
+		{
+			pDC->MoveTo(i, 500);
+			pDC->LineTo(i, 500- noiseCount);
+		}
+	}
+
+	i= m_FoundThreshold- 3;
+	if(i < 0)
+		i= 0;
+
+	TCHAR str[400];
+	_tprintf(str, _T("Thre:%d[%d-%d][%d/%d/%d]"), m_FoundThreshold, m_Width, m_Height, m_LimitCount, m_OverCount, m_TotalCount);
+	for(; i< 255; i++)
+	{
+		noiseCount= GetNoiseCount(i);
+		if(noiseCount > 0)
+		{
+			_tprintf(str, _T("%s, %d[%d]"), str, i, noiseCount);
+			if(lstrlen(str) > 390)
+				break;
+		}
+	}
+	pDC->TextOut(50, 100, str);
+}
+
+int CNoiseLevel::CalFocusValue(CSISBuffer &buffer)
+{
+	double Focusvalue = 0;
+	double SumValue = 0;
+	double TempValue = 0;
+	int		nWidth = buffer.GetWidth();
+	int		nHeight = buffer.GetHeight();
+	LPBYTE	pBuffer = buffer.GetDataAddress(0,0);
+
+	if(pBuffer == NULL || nWidth <= 0 || nHeight <= 0)
+		return 0;
+
+	for(int y=0; y < nHeight-1; y++)
+	{
+		for(int x=0; x < nWidth-1; x++)	
+		{
+			TempValue = (double)(pBuffer[y*nWidth+x]-pBuffer[y*nWidth+x+1]);
+			SumValue = TempValue*TempValue;		
+			TempValue = (double)(pBuffer[y*nWidth+x]-pBuffer[(y+1)*nWidth+x]);
+			SumValue += TempValue*TempValue;
+
+			sqrt(SumValue);
+			Focusvalue += SumValue;
+		}
+	}
+
+
+	return int(Focusvalue/(double)nWidth);
+}
diff --git a/Common_Class/SISBuffer/ReadMe.txt b/Common_Class/SISBuffer/ReadMe.txt
new file mode 100644
index 0000000..90c0457
--- /dev/null
+++ b/Common_Class/SISBuffer/ReadMe.txt
@@ -0,0 +1,63 @@
+========================================================================
+       MICROSOFT FOUNDATION CLASS LIBRARY : SISBuffer
+========================================================================
+
+
+AppWizard has created this SISBuffer DLL for you.  This DLL not only
+demonstrates the basics of using the Microsoft Foundation classes but
+is also a starting point for writing your DLL.
+
+This file contains a summary of what you will find in each of the files that
+make up your SISBuffer DLL.
+
+SISBuffer.dsp
+    This file (the project file) contains information at the project level and
+    is used to build a single project or subproject. Other users can share the
+    project (.dsp) file, but they should export the makefiles locally.
+
+SISBuffer.cpp
+    This is the main DLL source file that contains the definition of
+	DllMain().
+
+
+SISBuffer.rc
+    This is a listing of all of the Microsoft Windows resources that the
+    program uses.  It includes the icons, bitmaps, and cursors that are stored
+    in the RES subdirectory.  This file can be directly edited in Microsoft
+	Visual C++.
+
+SISBuffer.clw
+    This file contains information used by ClassWizard to edit existing
+    classes or add new classes.  ClassWizard also uses this file to store
+    information needed to create and edit message maps and dialog data
+    maps and to create prototype member functions.
+
+res\SISBuffer.rc2
+    This file contains resources that are not edited by Microsoft 
+	Visual C++.  You should place all resources not editable by
+	the resource editor in this file.
+
+SISBuffer.def
+    This file contains information about the DLL that must be
+    provided to run with Microsoft Windows.  It defines parameters
+    such as the name and description of the DLL.  It also exports
+	functions from the DLL.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named SISBuffer.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+    This is the standard header file, which defines new resource IDs.
+    Microsoft Visual C++ reads and updates this file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/SISBuffer/Resource.h b/Common_Class/SISBuffer/Resource.h
new file mode 100644
index 0000000..b892b66
--- /dev/null
+++ b/Common_Class/SISBuffer/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by MOSISBUFFER.RC
+//
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	3000
+#define _APS_NEXT_CONTROL_VALUE		3000
+#define _APS_NEXT_SYMED_VALUE		3000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/SISBuffer/SISBuffer.cpp b/Common_Class/SISBuffer/SISBuffer.cpp
new file mode 100644
index 0000000..da3d81d
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBuffer.cpp
@@ -0,0 +1,86 @@
+// SISBuffer.cpp: implementation of the CSISBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "SISBuffer.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+
+int CSISBuffer::GetVar(int x, int y, int min)
+{
+	int a= GetPixel(x, y);
+	int mmt;
+	
+	for(int yy= y- 1; yy < y+ 1; yy++)
+	{
+		for(int xx= x- 1; xx < x+ 1; xx++)
+		{
+			mmt= abs((int)GetPixel(xx, yy)- a);
+			if(mmt > min)
+				min= mmt;
+		}
+	}
+	return min;
+}
+
+float CSISBuffer::GetMeanBright()
+{
+	int bright= 0;
+	
+	int yi, xi;
+	int cnt= 0;
+	
+	for(yi= 0; yi< GetHeight(); yi++)
+	{
+		for(xi= 0; xi < GetWidth(); xi++)
+		{
+			//	if(GetPixel(xi, yi) > 40 && GetPixel(xi, yi) < 200)
+			{
+				bright+= GetPixel(xi, yi);
+				cnt++;
+			}
+		}
+	}
+	if(cnt < 1)
+		cnt= 1;
+	return (float)bright/cnt;
+}
+
+void CSISBuffer::AdjustBright(CSISBuffer &buffer)
+{
+	double ratio= buffer.GetMeanBright()/GetMeanBright();
+	int yi, xi;
+	int val;
+	for(yi= 0; yi< GetHeight(); yi++)
+	{
+		for(xi= 0; xi < GetWidth(); xi++)
+		{
+			if(GetPixel(xi, yi) > 200)
+			{
+				continue;
+			}
+			if(GetPixel(xi, yi) < 40)
+			{
+				continue;
+			}
+			val= (int)(ratio*GetPixel(xi, yi));
+			if(val > 255)
+			{
+				val= 255;
+			}
+			SetPixel(xi, yi, (BYTE)val);
+		}
+	}
+}
+
diff --git a/Common_Class/SISBuffer/SISBuffer.def b/Common_Class/SISBuffer/SISBuffer.def
new file mode 100644
index 0000000..946e74e
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBuffer.def
@@ -0,0 +1,7 @@
+; SISBuffer.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY      "SISBuffer"
+DESCRIPTION  'SISBuffer Windows Dynamic Link Library'
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
\ No newline at end of file
diff --git a/Common_Class/SISBuffer/SISBuffer.rc b/Common_Class/SISBuffer/SISBuffer.rc
new file mode 100644
index 0000000..374c28a
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBuffer.rc
@@ -0,0 +1,124 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+	"\r\n"
+	"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
+	"#ifdef _WIN32\r\n"
+	"LANGUAGE 18, 1\r\n"
+	"#pragma code_page(949)\r\n"
+	"#endif //_WIN32\r\n"
+	"#include ""res\\SISBuffer.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
+	"#include ""l.kor\\afxres.rc""  	// Standard components\r\n"
+	"#endif\r\n"
+    "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED
+
+
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+#ifdef _WIN32
+LANGUAGE 18, 1
+#pragma code_page(949)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO     VERSIONINFO
+  FILEVERSION       1,0,0,1
+  PRODUCTVERSION    1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+	BLOCK "StringFileInfo"
+	BEGIN
+        BLOCK "041204B0"
+		BEGIN 
+			VALUE "CompanyName",     "\0"
+			VALUE "FileDescription", "SISBuffer DLL\0"
+			VALUE "FileVersion",     "1, 0, 0, 1\0"
+			VALUE "InternalName",    "SISBuffer\0"
+			VALUE "LegalCopyright",  "Copyright (C) 2008\0"
+			VALUE "LegalTrademarks", "\0"
+			VALUE "OriginalFilename","SISBuffer.DLL\0"
+			VALUE "ProductName",     "SISBuffer 悼利 楷搬 扼捞宏矾府\0"
+			VALUE "ProductVersion",  "1, 0, 0, 1\0"
+		END
+	END
+	BLOCK "VarFileInfo" 
+	BEGIN 
+		VALUE "Translation", 0x412, 1200
+    END
+END
+
+#endif
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+#ifdef _WIN32
+LANGUAGE 18, 1
+#pragma code_page(949)
+#endif //_WIN32
+#include "res\\SISBuffer.rc2"  // non-Microsoft Visual C++ edited resources
+#include "l.kor\\afxres.rc"  	// Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/Common_Class/SISBuffer/SISBuffer.sln b/Common_Class/SISBuffer/SISBuffer.sln
new file mode 100644
index 0000000..fc64542
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBuffer.sln
@@ -0,0 +1,26 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SISBuffer", "SISBuffer.vcxproj", "{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Debug|Win32.Build.0 = Debug|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Debug|x64.ActiveCfg = Debug|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Debug|x64.Build.0 = Debug|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Release|Win32.ActiveCfg = Release|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Release|Win32.Build.0 = Release|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Release|x64.ActiveCfg = Release|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/Common_Class/SISBuffer/SISBuffer.vcproj b/Common_Class/SISBuffer/SISBuffer.vcproj
new file mode 100644
index 0000000..008f992
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBuffer.vcproj
@@ -0,0 +1,1121 @@
+<?xml version="1.0" encoding="ks_c_5601-1987"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="SISBuffer"
+	ProjectGUID="{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}"
+	RootNamespace="SISBuffer"
+	Keyword="MFCProj"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory=".\../Debug"
+			IntermediateDirectory=".\Debug"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="2"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\../Debug/SISBuffer.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\Header"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_AFXEXT"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				StructMemberAlignment="3"
+				PrecompiledHeaderFile=".\Debug/SISBuffer.pch"
+				AssemblerListingLocation=".\Debug/"
+				ObjectFile=".\Debug/"
+				ProgramDataBaseFileName=".\Debug/"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1042"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile=".\../Debug/SISBuffer.dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\../Debug/SISBuffer.pdb"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary=".\../Debug/SISBuffer.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\../Debug/SISBuffer.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="..\..\角青颇老\Debug\"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="2"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\../Debug/SISBuffer.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\Header"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_AFXEXT"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				StructMemberAlignment="3"
+				OpenMP="true"
+				PrecompiledHeaderFile="..\Library\Debug\$(TargetName).pch"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="..\Library\Debug\$(TargetName).pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1042"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)$(ProjectName).dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="..\Library\Debug\$(TargetName).pdb"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="..\Library\Debug\$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\../Debug/SISBuffer.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory=".\../Release"
+			IntermediateDirectory=".\Release"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="2"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\../Release/SISBuffer.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories=".\Header"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_AFXEXT"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile=".\Release/SISBuffer.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1042"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile=".\../Release/SISBuffer.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ProgramDatabaseFile=".\../Release/SISBuffer.pdb"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary=".\../Release/SISBuffer.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\../Release/SISBuffer.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="..\..\角青颇老\Debug\"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="2"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\../Release/SISBuffer.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				AdditionalIncludeDirectories=".\Header"
+				PreprocessorDefinitions="NDEBUG;_WINDOWS;_AFXEXT"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				OpenMP="true"
+				PrecompiledHeaderFile="..\Library\Release\$(TargetName).pch"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="..\Library\Debug\$(TargetName).pdb"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1042"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)$(ProjectName).dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ProgramDatabaseFile="..\Library\Release\$(TargetName).pdb"
+				SubSystem="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary="..\Library\Debug\$(TargetName).lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\../Release/SISBuffer.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+			>
+			<File
+				RelativePath="CopyBuffer.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="FileBuffer.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="FrameSave.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="MatchBuffer.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="SISBuffer.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="SISBuffer.rc"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="SISBufferDll.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="SISPitch.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="NoiseLevel.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="StdAfx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl"
+			>
+			<File
+				RelativePath="Header\Broadcast.h"
+				>
+			</File>
+			<File
+				RelativePath="Header\InspectionBuffer.h"
+				>
+			</File>
+			<File
+				RelativePath="LeastSquare.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="LeastSquare.h"
+				>
+			</File>
+			<File
+				RelativePath="MatchBuffer.h"
+				>
+			</File>
+			<File
+				RelativePath="MatchImpl.h"
+				>
+			</File>
+			<File
+				RelativePath="Header\SISBuffer.h"
+				>
+			</File>
+			<File
+				RelativePath="Header\SISMatch.h"
+				>
+			</File>
+			<File
+				RelativePath="Header\SISMath.h"
+				>
+			</File>
+			<File
+				RelativePath="Header\SISPitch.h"
+				>
+			</File>
+			<File
+				RelativePath="Header\NoiseLevel.h"
+				>
+			</File>
+			<File
+				RelativePath="Resource.h"
+				>
+			</File>
+			<File
+				RelativePath="StdAfx.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+			>
+			<File
+				RelativePath="res\SISBuffer.rc2"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Match"
+			>
+			<File
+				RelativePath="MatchImpl.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\MatchImpl_unuse.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\SISAssem\MathImpl.asm"
+				>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c -Zi &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Assembling..."
+						CommandLine="ml64 -c &quot;-Fl$(IntDir)\$(InputName).lst&quot; &quot;-Fo$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+						Outputs="$(IntDir)\$(InputName).obj"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="SISMatch.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="SISMath.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\SISMath_omp.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\SISMath_unuse.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Buffer"
+			>
+			<File
+				RelativePath="InspectionBuffer.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalIncludeDirectories=""
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<File
+			RelativePath="ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/Common_Class/SISBuffer/SISBuffer.vcxproj b/Common_Class/SISBuffer/SISBuffer.vcxproj
new file mode 100644
index 0000000..75a6c05
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBuffer.vcxproj
@@ -0,0 +1,416 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}</ProjectGuid>
+    <RootNamespace>MosisBuffer</RootNamespace>
+    <Keyword>MFCProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\../Debug\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\../Release\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\../Debug/MosisBuffer.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <StructMemberAlignment>4Bytes</StructMemberAlignment>
+      <PrecompiledHeaderOutputFile>.\Debug/MosisBuffer.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
+      <ObjectFileName>.\Debug/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>.\../Debug/MosisBuffer.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\../Debug/MosisBuffer.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>.\../Debug/MosisBuffer.lib</ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\../Debug/MosisBuffer.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\../Debug/MosisBuffer.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <StructMemberAlignment>4Bytes</StructMemberAlignment>
+      <OpenMPSupport>true</OpenMPSupport>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>
+      </AssemblerListingLocation>
+      <ObjectFileName>$(IntDir)</ObjectFileName>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)$(TargetName)D$(TargetExt)</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>$(OutDir)\$(TargetName)D.lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+      <ModuleDefinitionFile>.\SISBufferD.def</ModuleDefinitionFile>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\../Debug/MosisBuffer.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\../Release/MosisBuffer.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeaderOutputFile>.\Release/MosisBuffer.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
+      <ObjectFileName>.\Release/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>.\../Release/MosisBuffer.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <ProgramDatabaseFile>.\../Release/MosisBuffer.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>.\../Release/MosisBuffer.lib</ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\../Release/MosisBuffer.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\../Release/MosisBuffer.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <OpenMPSupport>true</OpenMPSupport>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+      <ObjectFileName>$(IntDir)</ObjectFileName>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>
+      </ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ModuleDefinitionFile>.\SISBuffer.def</ModuleDefinitionFile>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\../Release/MosisBuffer.bsc</OutputFile>
+    </Bscmake>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\SISBuffer\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\SISBuffer\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\SISBuffer\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\Broadcast.h" "$(SolutionDir)Lib\SISBuffer\include\Broadcast.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\InspectionBuffer.h" "$(SolutionDir)Lib\SISBuffer\include\InspectionBuffer.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\NoiseLevel.h" "$(SolutionDir)Lib\SISBuffer\include\NoiseLevel.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\SISMatch.h" "$(SolutionDir)Lib\SISBuffer\include\SISMatch.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\SISMath.h" "$(SolutionDir)Lib\SISBuffer\include\SISMath.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\SISPitch.h" "$(SolutionDir)Lib\SISBuffer\include\SISPitch.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="CopyBuffer.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="FileBuffer.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="FrameSave.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="MatchBuffer.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="NoiseLevel.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="SISBuffer.cpp" />
+    <ClCompile Include="SISBufferDll.cpp" />
+    <ClCompile Include="SISMatch.cpp" />
+    <ClCompile Include="SISMath.cpp" />
+    <ClCompile Include="SISMath_omp.cpp" />
+    <ClCompile Include="SISMath_unuse.cpp" />
+    <ClCompile Include="SISPitch.cpp" />
+    <ClCompile Include="StdAfx.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="LeastSquare.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="MatchImpl.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="MatchImpl_unuse.cpp" />
+    <ClCompile Include="InspectionBuffer.cpp">
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\Broadcast.h" />
+    <ClInclude Include="Header\InspectionBuffer.h" />
+    <ClInclude Include="Header\SISBuffer.h" />
+    <ClInclude Include="Header\SISMatch.h" />
+    <ClInclude Include="Header\SISMath.h" />
+    <ClInclude Include="Header\SISPitch.h" />
+    <ClInclude Include="LeastSquare.h" />
+    <ClInclude Include="MatchBuffer.h" />
+    <ClInclude Include="MatchImpl.h" />
+    <ClInclude Include="Header\NoiseLevel.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="StdAfx.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="res\SISBuffer.rc2" />
+    <None Include="SISBuffer.def" />
+    <None Include="SISBufferD.def" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/SISBuffer/SISBuffer.vcxproj.filters b/Common_Class/SISBuffer/SISBuffer.vcxproj.filters
new file mode 100644
index 0000000..075b6b9
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBuffer.vcxproj.filters
@@ -0,0 +1,126 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Match">
+      <UniqueIdentifier>{21b42a2e-083b-4e70-8fc8-46fd931d0656}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Buffer">
+      <UniqueIdentifier>{87151540-285e-4a02-9e4d-1fb7bbe30fa0}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{bfe491f0-dc02-4fe4-acaa-71f72d815d44}</UniqueIdentifier>
+      <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{86410033-dfd1-4dbd-9466-5f150733120a}</UniqueIdentifier>
+      <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{131a1d8e-24bd-4019-a8cb-cd866b9f9b6b}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="CopyBuffer.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="FileBuffer.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="FrameSave.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="MatchBuffer.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="NoiseLevel.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="StdAfx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="LeastSquare.cpp">
+      <Filter>澶存枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="MatchImpl.cpp">
+      <Filter>Match</Filter>
+    </ClCompile>
+    <ClCompile Include="MatchImpl_unuse.cpp">
+      <Filter>Match</Filter>
+    </ClCompile>
+    <ClCompile Include="InspectionBuffer.cpp">
+      <Filter>Buffer</Filter>
+    </ClCompile>
+    <ClCompile Include="SISBufferDll.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISMatch.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISMath.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISMath_omp.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISMath_unuse.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISPitch.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISBuffer.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\Broadcast.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\InspectionBuffer.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="LeastSquare.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="MatchBuffer.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="MatchImpl.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\NoiseLevel.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="StdAfx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISBuffer.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISMatch.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISMath.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISPitch.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="SISBuffer.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="SISBufferD.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\SISBuffer.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/SISBuffer/SISBufferD.def b/Common_Class/SISBuffer/SISBufferD.def
new file mode 100644
index 0000000..3100f05
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBufferD.def
@@ -0,0 +1,7 @@
+; SISBufferD.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY      "SISBufferD"
+DESCRIPTION  'SISBufferD Windows Dynamic Link Library(Debug)'
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
\ No newline at end of file
diff --git a/Common_Class/SISBuffer/SISBufferDll.cpp b/Common_Class/SISBuffer/SISBufferDll.cpp
new file mode 100644
index 0000000..655020c
--- /dev/null
+++ b/Common_Class/SISBuffer/SISBufferDll.cpp
@@ -0,0 +1,51 @@
+// SISBuffer.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include <afxdllx.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+static AFX_EXTENSION_MODULE SISBufferDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+	// Remove this if you use lpReserved
+	UNREFERENCED_PARAMETER(lpReserved);
+
+	if (dwReason == DLL_PROCESS_ATTACH)
+	{
+		TRACE0("SISBUFFER.DLL Initializing!\n");
+		
+		// Extension DLL one-time initialization
+		if (!AfxInitExtensionModule(SISBufferDLL, hInstance))
+			return 0;
+
+		// Insert this DLL into the resource chain
+		// NOTE: If this Extension DLL is being implicitly linked to by
+		//  an MFC Regular DLL (such as an ActiveX Control)
+		//  instead of an MFC application, then you will want to
+		//  remove this line from DllMain and put it in a separate
+		//  function exported from this Extension DLL.  The Regular DLL
+		//  that uses this Extension DLL should then explicitly call that
+		//  function to initialize this Extension DLL.  Otherwise,
+		//  the CDynLinkLibrary object will not be attached to the
+		//  Regular DLL's resource chain, and serious problems will
+		//  result.
+
+		new CDynLinkLibrary(SISBufferDLL);
+	}
+	else if (dwReason == DLL_PROCESS_DETACH)
+	{
+		TRACE0("SISBUFFER.DLL Terminating!\n");
+		// Terminate the library before destructors are called
+		AfxTermExtensionModule(SISBufferDLL);
+	}
+	return 1;   // ok
+}
diff --git a/Common_Class/SISBuffer/SISMatch.cpp b/Common_Class/SISBuffer/SISMatch.cpp
new file mode 100644
index 0000000..8fc7f7b
--- /dev/null
+++ b/Common_Class/SISBuffer/SISMatch.cpp
@@ -0,0 +1,446 @@
+// SISMatch.cpp: implementation of the CSISMatch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "SISMatch.h"
+#include "MatchImpl.h"
+
+#include "MatchBuffer.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+//#include "cv_src/cv.h"
+
+#define SIS_MATCH_IMPL_SIMD
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CSISMatch::CSISMatch()
+/*: m_pBigImage(NULL), m_pSmallImage(NULL), m_pResultImage(NULL)
+	,m_pBigImage2(NULL), m_pSmallImage2(NULL), m_pResultImage2(NULL)*/
+{
+	m_pMatchImpl= new CMatchImpl;
+}
+
+CSISMatch::~CSISMatch()
+{
+	delete m_pMatchImpl;
+/*
+	if(m_pBigImage)
+		cvReleaseImage(&m_pBigImage);
+	if(m_pSmallImage)
+		cvReleaseImage(&m_pSmallImage);
+	if(m_pResultImage)
+		cvReleaseImage(&m_pResultImage);
+	if(m_pBigImage2)
+		cvReleaseImage(&m_pBigImage2);
+	if(m_pSmallImage2)
+		cvReleaseImage(&m_pSmallImage2);
+	if(m_pResultImage2)
+		cvReleaseImage(&m_pResultImage2);
+*/
+}
+
+void CSISMatch::NormalizeMatchRect(CRect &rect)
+{
+	rect.NormalizeRect();
+	rect.right= rect.left+ rect.Width()/4*4;
+	rect.bottom= rect.top+ rect.Height()/4*4;
+}
+
+/*
+BOOL CSISMatch::SetImage(_IplImage **pImage, CSISBuffer *pBuffer, CRect &rect)
+{
+	int width= rect.Width();
+	int height= rect.Height();
+
+	if(pBuffer == NULL) return FALSE;
+
+	if(*pImage != NULL)
+	{
+		if(width != (*pImage)->width || height != (*pImage)->height)
+		{
+			cvReleaseImage(pImage);
+			*pImage= cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
+		}
+	}
+	else
+	{
+		*pImage= cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
+	}
+	
+	
+	_IplImage *pImageData= *pImage;
+
+	if(pImageData == NULL)
+		return FALSE;
+	
+	int yy;
+	int left= rect.left;
+	int top= rect.top;
+	for(yy= 0; yy< height; yy++)
+	{
+		memcpy(pImageData->imageData+ yy*width, pBuffer->GetDataAddress(left, top+ yy), sizeof(BYTE)*width);
+	}
+	
+	return TRUE;
+}
+BOOL CSISMatch::MakeImage(struct _IplImage **ppImage, int width, int height)
+{
+	if(*ppImage == NULL)
+	{
+		*ppImage= cvCreateImage(cvSize(width, height), IPL_DEPTH_32F, 1);
+	}
+	else
+	{
+		if(width != (*ppImage)->width || height != (*ppImage)->height)
+		{
+			cvReleaseImage(ppImage);
+			*ppImage= cvCreateImage(cvSize(width, height), IPL_DEPTH_32F, 1);
+		}
+	}
+	return *ppImage != NULL;
+}
+
+BOOL CSISMatch::SetImage32f(_IplImage **ppImage, CSISBuffer *pBuffer, CRect &rect)
+{
+	int width= rect.Width();
+	int height= rect.Height();
+
+	if(pBuffer == NULL) return FALSE;
+
+	// result image Data 酒匆锭绰 4盒狼 1肺 绵家秦辑 单捞磐甫 盲况 持绰促..
+	width= width/4;
+	height= height/4;
+
+/*	if(width*4 > rect.Width() || (height)*4 > rect.Height())
+		AfxMessageBox("width*4 > rect.Width");
+	if(rect.left < 0 || rect.top < 0 || rect.bottom > 1024 || rect.right >= 8192)
+	{
+		char str[200];
+		_tprintf(str, "L:%d, R:%d, T:%d, B:%d", rect.left, rect.right, rect.top, rect.bottom);
+		AfxMessageBox(str);
+	}
+*/
+/*
+	if(*ppImage == NULL)
+	{
+		*ppImage= cvCreateImage(cvSize(width, height), IPL_DEPTH_32F, 1);
+	}
+	else
+	{
+		if(width != (*ppImage)->width || height != (*ppImage)->height)
+		{
+			cvReleaseImage(ppImage);
+			*ppImage= cvCreateImage(cvSize(width, height), IPL_DEPTH_32F, 1);
+		}
+	}
+
+	if(*ppImage == NULL)
+		return FALSE;
+	
+
+
+	_IplImage *pImageData= *ppImage;
+
+	float *pData;
+	int x, y, xx, yy;
+	int left= rect.left;
+	int top= rect.top;
+	for(yy= 0; yy< height; yy++)
+	{
+//		pData2= (float*)pImageData->imageData+ yy*width;
+		y= top+ yy*4;
+		for(xx= 0; xx< width; xx++)
+		{
+			pData= (((float*)(pImageData->imageData))+ yy*width+ xx);//pData2+ xx;
+			x= left+ xx*4;
+			
+			*pData= (float)(pBuffer->GetPixel(x, y)
+				+ pBuffer->GetPixel(x+ 1, y+ 1) 
+				+ pBuffer->GetPixel(x+ 2, y+ 2)
+				+ pBuffer->GetPixel(x+ 3, y+ 3)
+
+				+ pBuffer->GetPixel(x, y+ 1) 
+				+ pBuffer->GetPixel(x+ 1, y+ 2)
+				+ pBuffer->GetPixel(x+ 2, y+ 3)
+				+ pBuffer->GetPixel(x+ 3, y)
+
+				+ pBuffer->GetPixel(x, y+ 2) 
+				+ pBuffer->GetPixel(x+ 1, y+ 3)
+				+ pBuffer->GetPixel(x+ 2, y)
+				+ pBuffer->GetPixel(x+ 3, y+ 1)
+
+				+ pBuffer->GetPixel(x, y+ 3) 
+				+ pBuffer->GetPixel(x+ 1, y)
+				+ pBuffer->GetPixel(x+ 2, y+ 1)
+				+ pBuffer->GetPixel(x+ 3, y+ 2)
+				
+				)/16;
+				
+		}
+	}
+
+	return TRUE;
+}
+
+
+*/
+BOOL CSISMatch::SetBigImage(CSISBuffer buffer, CRect &roi)
+{
+	m_BigRect= roi;
+	m_BigBuffer= buffer;
+	NormalizeMatchRect(m_BigRect);	
+
+#if defined (SIS_MATCH_IMPL_SIMD)
+	if(m_pMatchImpl)
+		return m_pMatchImpl->SetBigImage(m_BigBuffer, m_BigRect);
+	return FALSE;
+#endif
+	
+	return TRUE;
+}
+BOOL CSISMatch::SetSmallImage(CSISBuffer buffer, CRect &roi)
+{
+	m_SmallRect= roi;
+	m_SmallBuffer= buffer;
+	NormalizeMatchRect(m_SmallRect);
+#if defined (SIS_MATCH_IMPL_SIMD)
+	if(m_pMatchImpl)
+		return m_pMatchImpl->SetSmallImage(m_SmallBuffer, m_SmallRect);
+	return FALSE;
+#endif
+
+	return TRUE;
+}
+BOOL CSISMatch::SetBigImage2(CSISBuffer buffer, CRect &roi)
+{
+	m_BigRect= roi;
+	m_BigBuffer= buffer;
+	NormalizeMatchRect(m_BigRect);
+
+
+	return TRUE;
+}
+BOOL CSISMatch::SetSmallImage2(CSISBuffer buffer, CRect &roi)
+{
+	m_SmallRect= roi;
+	m_SmallBuffer= buffer;
+	NormalizeMatchRect(m_SmallRect);
+
+	
+	return TRUE;
+}
+/*
+BOOL ExtractMatchResult(IplImage *pResultImage, stSISMatchResult &result, BOOL bUseInterplate)
+{
+	int width, height;
+	float best= 0.0;
+	float *pBest;
+	int i, j;
+	int xx, yy;
+	double xxx, yyy;
+
+	width= pResultImage->width;
+	height= pResultImage->height;
+
+	for(j= 0; j< height- 1; j++)
+	{
+		for(i= 0; i< width- 1; i++)
+		{
+			pBest= (float*)(pResultImage->imageData+ 4*(i+ j*width));
+			if(best < *pBest)
+			{
+				best= *pBest;
+				xx= i;
+				yy= j;
+			}
+		}
+	}
+
+	result.m_Score= best;
+	result.m_X= xx;
+	result.m_Y= yy;
+	if(!bUseInterplate)
+	{
+		return TRUE;
+	}
+
+// 	if(xx > width- 2)
+// 		return FALSE;
+// 	if(xx < 1)
+// 		return FALSE;
+// 	if(yy > height- 2)
+// 		return FALSE;
+// 	if(xx < 1)
+// 		return FALSE;
+
+	pBest= (((float*)pResultImage->imageData)+ (xx+ yy*width));
+	best= *pBest;
+	float best1, best3;
+	best1= *(pBest- 1);
+	best3= *(pBest+ 1);
+	if(best == best3)
+	{
+		xxx= xx+ 0.5;
+	}
+	else if(best == best1)
+	{
+		xxx= xx- 0.5;
+	}
+	else if(best1 < best3)
+	{
+		xxx= xx+ 0.5- 0.5*(best- best3)/(best- best1);
+	}
+	else// if(*(pBest-1) > best3)
+	{
+		xxx= xx- 0.5+ 0.5/(best- best3)*(best- best1);
+	}
+//	float besty;
+	float best11, best33;
+	best11= *(pBest- width);
+	best33= *(pBest+ width);
+	if(best == best33)
+	{
+		yyy= yy+ 0.5;
+	}
+	else if(best == best11)
+	{
+		yyy= yy- 0.5;
+	}
+	else if(best11 < best33)
+	{
+		yyy= yy+ 0.5- 0.5*(best- best33)/(best- best11);
+	}
+	else// if(*(pBest-1) > best3)
+	{
+		yyy= yy- 0.5+ 0.5*(best- best11)/(best- best33);
+	}
+/*
+	if(xxx < xx- 0.5)
+		return FALSE;
+	if(xxx > xx+ 0.5)
+		return FALSE;
+	if(yyy < yy- 0.5)
+		return FALSE;
+	if(yyy > yy+ 0.5)
+		return FALSE;
+*/
+/*
+	result.m_X= xxx;
+	result.m_Y= yyy;
+	result.m_Score= best;
+	return TRUE;
+}
+*/
+BOOL CSISMatch::DoTemplateMatch(stSISMatchResult &result, stSISMatchParam &matchParam)
+{
+	m_MatchParam= matchParam;
+#if defined (SIS_MATCH_IMPL_SIMD)
+
+	return m_pMatchImpl->DoTemplateMatch(result, m_MatchParam);
+#else
+//	return TRUE;
+
+	//	m_MatchParam.m_Method= CV_TM_SQDIFF_NORMED;
+	//	m_MatchParam.m_Method= CV_TM_CCORR_NORMED;
+	//	m_MatchParam.m_Method= CV_TM_CCOEFF_NORMED;
+
+	if(m_BigRect.Height() <= m_SmallRect.Height()+ 10)
+		return DoTemplateMatch2(result);
+
+	int width, height;
+	width= m_BigRect.Width()/4- m_SmallRect.Width()/4+ 1;
+	height= m_BigRect.Height()/4- m_SmallRect.Height()/4+ 1;
+
+	if(!SetImage32f(&m_pSmallImage, &m_SmallBuffer, m_SmallRect))
+		return FALSE;
+	if(!SetImage32f(&m_pBigImage, &m_BigBuffer, m_BigRect))
+		return FALSE;
+	if(!MakeImage(&m_pResultImage, width, height))
+		return FALSE;
+
+	cvMatchTemplate(m_pBigImage, m_pSmallImage, m_pResultImage, m_MatchParam.m_Method);
+
+	stSISMatchResult tempResult;
+	if(!ExtractMatchResult(m_pResultImage, tempResult, m_MatchParam.m_bUseInterpolate))
+		return FALSE;
+
+	/*
+	// 沥剐 概莫 绝捞 府畔 且 版快.
+	result.m_X= tempResult.m_X*4;//+ m_BigRect.left;
+	result.m_Y= tempResult.m_Y*4;//+ m_BigRect.top;
+	result.m_Score= tempResult.m_Score;
+	return TRUE;
+*/
+	// 乔扼固靛 概莫 饶 累篮 康开俊辑 沥剐 概莫.
+
+	int x, y;
+	x= (int)(m_BigRect.left+ tempResult.m_X*4+ 0.5);
+	y= (int)(m_BigRect.top+ tempResult.m_Y*4+ 0.5);
+
+
+	CRect rect;
+	x= x- 4;
+	y= y-4;
+
+	if(x < 0)
+		x= 0;
+	if(y < 0)
+		y= 0;
+
+	rect.SetRect(x, y, x+ m_SmallRect.Width()+ 8, y+ m_SmallRect.Height()+ 8);
+
+
+	if(!SetImage(&m_pSmallImage2, &m_SmallBuffer, m_SmallRect))
+		return FALSE;
+	if(!SetImage(&m_pBigImage2, &m_BigBuffer, rect))
+		return FALSE;
+	if(!MakeImage(&m_pResultImage2, 8+ 1, 8+ 1))
+		return FALSE;
+
+
+	cvMatchTemplate(m_pBigImage2, m_pSmallImage2, m_pResultImage2, m_MatchParam.m_Method);
+	if(! ExtractMatchResult(m_pResultImage2, tempResult, m_MatchParam.m_bUseInterpolate))
+		return FALSE;
+
+
+	result.m_X= rect.left+ tempResult.m_X- m_BigRect.left;
+	result.m_Y= rect.top+ tempResult.m_Y- m_BigRect.top;
+	result.m_Score= tempResult.m_Score;
+	return result.m_Score >= m_MatchParam.m_Acceptance;
+#endif
+}
+/*
+BOOL CSISMatch::DoTemplateMatch2(stSISMatchResult &result)
+{
+	int width= m_BigRect.Width()- m_SmallRect.Width()+ 1;
+	int height= m_BigRect.Height()- m_SmallRect.Height()+ 1;
+	stSISMatchResult tempResult;
+	if(! SetImage(&m_pSmallImage2, &m_SmallBuffer, m_SmallRect))
+		return FALSE;
+	if(! SetImage(&m_pBigImage2, &m_BigBuffer, m_BigRect))
+		return FALSE;
+	if(! MakeImage(&m_pResultImage2, width, height))
+		return FALSE;
+	
+	cvMatchTemplate(m_pBigImage2, m_pSmallImage2, m_pResultImage2, m_MatchParam.m_Method);
+	BOOL bRet= ExtractMatchResult(m_pResultImage2, tempResult, m_MatchParam.m_bUseInterpolate);
+	
+	
+	result.m_X= tempResult.m_X;
+	result.m_Y= tempResult.m_Y;
+	result.m_Score= tempResult.m_Score;
+	if(bRet)
+		return (result.m_Score >= m_MatchParam.m_Acceptance);
+	return FALSE;
+}
+*/
+
+
diff --git a/Common_Class/SISBuffer/SISMath.cpp b/Common_Class/SISBuffer/SISMath.cpp
new file mode 100644
index 0000000..230ca48
--- /dev/null
+++ b/Common_Class/SISBuffer/SISMath.cpp
@@ -0,0 +1,1003 @@
+// SISMath.cpp: implementation of the CSISMath class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "SISMath.h"
+
+
+#include <emmintrin.h>
+#include <tmmintrin.h>
+#include <omp.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+#define SIS_SIMD			// C++ 滚傈俊辑 Intrinsic 滚傈栏肺 利侩 窃.. C++ 滚傈 昏力 啊瓷 窍摆澜..
+
+//#define SIS_ASM			// Intrinsic 滚傈俊辑 Assembly 滚傈栏肺 利侩窃.. 备泅 抛胶飘 饶 矫埃瞒 绝绢辑 Intrinsic栏肺 利侩窃.
+
+//#define SIS_DEBUG_OMP	// Intrinsic 滚傈俊辑 Open MP 利侩
+							// OpenMP 利侩 阂啊.. 备泅饶 抛胶飘俊辑 加档 蠢妨咙.
+							// SIMD 窜俊 利侩 沁栏唱 措何盒狼 纳捞胶俊辑 矫埃捞 2硅 家夸.. 
+							// Thread OverHead , Context switching盔牢栏肺 魄窜凳.
+							// Debug 俊辑 悼累篮 窍唱 Release俊辑 沥惑悼累 救窃.
+
+
+
+#if defined(SIS_ASM)
+extern "C"{
+	int64 _asm_Get_CCU8(const uchar * vec1, const uchar * vec2, int len, int flag);// 0= aa, 1=au, 2=uu
+};
+#endif
+
+//#define SIS_DEBUG_ALIGNED_UNALIGNED
+
+INT64	CSISMath::GetSum(CSISBuffer buffer)
+{
+	__m128i mmA, mmB= _mm_setzero_si128();
+	__m128i mmRes= _mm_setzero_si128();
+    int64 sum= 0;
+	int64 results[2];
+	
+	int x, y, width= buffer.GetWidth(), height= buffer.GetHeight();
+	for(y= 0; y< height; y++)
+	{
+		for(x= 0; x< width; x+= 16)
+		{
+			mmA= _mm_loadu_si128((__m128i*) buffer.GetDataAddress(x, y));
+			mmA= _mm_sad_epu8(mmA, mmB);
+			mmRes= _mm_add_epi64(mmA, mmRes);
+		}
+		//16栏肺 唱传 唱赣瘤 康开 贸府.
+		for( ; x < width; x++ )
+		{
+			sum += buffer.GetPixel(x, y);
+		}
+	}
+	_mm_storeu_si128((__m128i*)results, mmRes);
+	sum= results[0]+ results[1]+ sum;
+	return sum;
+}
+
+double	CSISMath::GetAverage(CSISBuffer buffer)
+{
+	return (double)(GetSum(buffer))/(double)(buffer.GetWidth()*buffer.GetHeight());
+}
+INT64 CSISMath::GetAbsDiff(BYTE* pData, BYTE* pData2, int len)
+{
+	__m128i mmA, mmB;
+	__m128i mmRes= _mm_setzero_si128();
+    int64 sum= 0;
+	int64 results[2];
+
+	int x= 0;
+	for( x= 0; x<= len- 16; x+= 16)
+	{
+		mmA= _mm_loadu_si128((__m128i*) pData+ x);
+		mmB= _mm_loadu_si128((__m128i*) pData2+ x);
+		mmA= _mm_sad_epu8(mmA, mmB);
+		mmRes= _mm_add_epi64(mmA, mmRes);
+	}
+	_mm_storeu_si128((__m128i*)results, mmRes);
+	for( x= 0; x< len; x++)
+		sum+= *(pData+len);
+	sum= results[0]+ results[1]+ sum;
+	return sum;
+
+}
+INT64 CSISMath::GetAbsDiff(CSISBuffer buffer, int x1, int y1, int width, int height, CSISBuffer buffer2, int x2, int y2)
+{
+	//	width= width>>4<<4;// 16栏肺 唱传促.
+	
+	__m128i mmA, mmB;
+	__m128i mmRes= _mm_setzero_si128();
+    int64 sum= 0;
+	int64 results[2];
+// 	mmA= _mm_abs_epi16(mmA);		// pabsw       xmm0,xmm0
+// 	mmA= _mm_hadd_epi16(mmA, mmB);	// phaddw      xmm0,xmmword ptr [rsp+30h]
+// 	mmA= _mm_madd_epi16(mmA, mmB);	// pmaddwd     xmm0,xmmword ptr [rsp+30h]
+	
+	int x;
+	for(int y= 0; y< height; y++)
+	{
+		for( x= 0; x<= width- 16; x+= 16)
+		{
+			mmA= _mm_loadu_si128((__m128i*) buffer.GetDataAddress(x1+ x, y1+ y));
+			mmB= _mm_loadu_si128((__m128i*) buffer2.GetDataAddress(x2+ x, y2+ y));
+			mmA= _mm_sad_epu8(mmA, mmB);
+			mmRes= _mm_add_epi64(mmA, mmRes);
+		}
+		// 16栏肺 唱传 唱赣瘤 康开 贸府.
+// 		for( ; x < width; x++ )
+// 		{
+// 			sum += abs(buffer.GetPixel(x1+ x, y1+ y) - buffer2.GetPixel(x2+ x, y2+ y));
+// 		}
+	}
+	_mm_storeu_si128((__m128i*)results, mmRes);
+	sum= results[0]+ results[1]+ sum;
+	return sum;
+}
+
+
+// 剧狼 邦急. 弥措蔼捞 粮犁茄促.
+double CSISMath::SearchMaximum(int64 *pData, int nData)
+{
+	if(pData == NULL)
+		return -1;
+	if(nData < 2)
+		return -1;
+	int64	best= *pData;
+	int64	bestBefore, bestAfter;
+	int		iBest= 0;
+	double	ret= 0;
+	for(int i= 1; i< nData; i++)
+	{
+		if(best < *(pData+ i))
+		{
+			iBest= i;
+			best= *(pData+ i);
+		}
+	}
+	if(iBest < 1 || iBest > nData- 2)
+		return -1;
+	
+	bestBefore= *(pData+ iBest- 1);
+	bestAfter= *(pData+ iBest+ 1);
+	if((best- bestAfter) == 0)
+	{
+		ret= iBest+ 0.5;
+	}
+	else if((best- bestBefore) == 0)
+	{
+		ret= iBest- 0.5;
+	}
+	else if(bestBefore < bestAfter)
+	{
+		ret= iBest+ 0.5- 0.5*(best- bestAfter)/(best- bestBefore);
+	}
+	else
+	{
+		ret= iBest- 0.5+ 0.5/(best- bestAfter)*(best- bestBefore);
+	}
+	
+	if(ret > iBest+ 1 || ret < iBest- 1)
+		return -1;
+	
+	return ret;
+}
+// 澜狼 邦急. 弥家蔼捞 粮犁茄促.
+double CSISMath::SearchMinimum(int64 *pData, int nData)
+{
+	if(pData == NULL)
+		return -1;
+	if(nData < 2)
+		return -1;
+	int64	best= *pData;
+	int64	bestBefore, bestAfter;
+	int		iBest= 0;
+	double	ret= 0;
+	for(int i= 1; i< nData; i++)
+	{
+		if(best > *(pData+ i))
+		{
+			iBest= i;
+			best= *(pData+ i);
+		}
+	}
+	if(iBest < 1 || iBest > nData- 2)
+		return -1;
+	
+	bestBefore= *(pData+ iBest- 1);
+	bestAfter= *(pData+ iBest+ 1);
+	if((best- bestAfter) == 0)
+	{
+		ret= iBest+ 0.5;
+	}
+	else if((best- bestBefore) == 0)
+	{
+		ret= iBest- 0.5;
+	}
+	else if(bestBefore < bestAfter)
+	{
+		ret= iBest- 0.5+ 0.5/(best- bestAfter)*(best- bestBefore);
+	}
+	else// if(*(pBest-1) > bestAfter)
+	{
+		ret= iBest+ 0.5- 0.5*(best- bestAfter)/(best- bestBefore);
+	}
+	
+	if(ret > iBest+ 1 || ret < iBest- 1)
+		return -1;
+	
+	return ret;
+}
+#define SIS_SIMD_INT64
+
+int64 CSISMath::SumPixels_8u( const uchar * vec, int len )
+{
+    int i= 0, s = 0;
+    int64 sum = 0;
+#if defined(SIS_SIMD)
+	int results[4];
+
+	__m128i	mmResult;
+	__m128i	mmA, mmB;
+	__m128i mmZeroData= _mm_setzero_si128();
+	mmResult= _mm_setzero_si128();
+	__m128i mmOne= _mm_set1_epi16(1);
+
+
+
+	for(i= 0; i<= len- 16; i+= 16)
+	{
+		mmA= _mm_loadu_si128((__m128i*) (vec+ i));
+		mmB= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmA= _mm_add_epi16(mmA, mmB);
+		mmA= _mm_madd_epi16(mmA, mmOne);
+		mmResult= _mm_add_epi32(mmA, mmResult);
+	}
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= (int64)results[0]+ results[1]+ results[2]+ results[3];
+
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        sum += vec[i] + vec[i + 1] + vec[i + 2] + vec[i + 3];
+    }
+#endif
+
+    for( ; i < len; i++ )
+    {
+        s += vec[i];
+    }
+	
+    return sum + s;
+
+}
+int64 CSISMath::SumPixels_16u( const ushort * vec, int len )
+{
+	int64 sum = 0;
+	int i, s = 0;
+	int64 sum2= 0;
+#if defined(SIS_SIMD)
+	UINT32 results[4];
+	
+	__m128i	mmResult;
+	__m128i	mmA;
+	__m128i mmZeroData= _mm_setzero_si128();
+	mmResult= _mm_setzero_si128();
+	__m128i mmOne= _mm_set1_epi16(1);
+	for(i= 0; i<= len- 8; i+= 8)
+	{
+		mmA= _mm_loadu_si128((__m128i*) (vec+ i));
+//		mmA= _mm_add_epi16(mmA, mmB);
+		mmA= _mm_madd_epi16(mmA, mmOne);
+		mmResult= _mm_add_epi32(mmA, mmResult);
+	}
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= (int64)results[0]+ results[1]+ results[2]+ results[3];
+	
+#else
+    for( i = 0; i <= len - 8; i += 8 )
+    {
+        sum += vec[i] + vec[i + 1] + vec[i + 2] + vec[i + 3]
+			+ vec[i+ 4] + vec[i + 5] + vec[i + 6] + vec[i + 7];
+    }
+#endif
+    for( ; i < len; i++ )
+    {
+        s += vec[i];
+    }
+
+	return sum + s;
+}
+
+int64	CSISMath::Get_CCU8_A(const uchar * vec1, int len )
+{
+#if defined(SIS_DEBUG_OMP)
+	int64 rslt=  OMP_CCU8_A(vec1, len);
+	return rslt;
+#endif
+
+#if defined(SIS_ASM)
+	return _asm_Get_CCU8(vec1, NULL, len, 0);
+#else
+#if defined(SIS_DEBUG_ALIGNED_UNALIGNED)
+	return Get_CCU8_UA(vec1, vec1, len);
+#endif
+	int i, s = 0;
+	int64 sum = 0;
+
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA;
+	__m128i	mmAA, mmBB;
+	__m128i mmZeroData= _mm_setzero_si128();
+
+#ifdef SIS_SIMD_INT64
+	int64 res64[2];
+	mmResult= _mm_setzero_si128();
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmResult2= _mm_madd_epi16(mmAA, mmAA);
+		mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+		mmResult= _mm_add_epi64(mmAA, mmResult);
+		mmResult= _mm_add_epi64(mmBB, mmResult);
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmResult2= _mm_madd_epi16(mmAA, mmAA);
+		mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+		mmResult= _mm_add_epi64(mmAA, mmResult);
+		mmResult= _mm_add_epi64(mmBB, mmResult);
+	}
+	_mm_storeu_si128((__m128i*)res64, mmResult);
+	sum= res64[0]+ res64[1];
+
+#else
+
+	UINT32 results[4];
+
+	mmResult= _mm_setzero_si128();
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+		//		mmB= _mm_load_si128((__m128i*) (vec2+ i));
+
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		//		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmAA);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		//		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmAA);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= results[0]+ results[1]+ results[2]+ results[3];
+#endif
+
+#else
+	for( i = 0; i <= len - 4; i += 4 )
+	{
+		int e = vec1[i] * vec1[i];
+		int v = vec1[i + 1] * vec1[i + 1];
+
+		e += v;
+		v = vec1[i + 2] * vec1[i + 2];
+		e += v;
+		v = vec1[i + 3] * vec1[i + 3];
+		e += v;
+		sum += e;
+	}
+#endif
+
+	for( ; i < len; i++ )
+	{
+		s += vec1[i] * vec1[i];
+	}
+
+	return sum + s;
+#endif
+}
+
+
+int64	CSISMath::Get_CCU8_AUA(const uchar * vec1, const uchar * vec2, int len )
+{
+#if defined(SIS_DEBUG_OMP)
+	int64 rslt=  OMP_CCU8_AUA(vec1, vec2, len);
+	return rslt;
+#endif
+#if defined(SIS_ASM)
+	return _asm_Get_CCU8(vec1, vec2, len, 1);
+#else
+#if defined(SIS_DEBUG_ALIGNED_UNALIGNED)
+	return Get_CCU8_UA(vec1, vec2, len);
+#endif
+    int i, s = 0;
+    int64 sum = 0;
+	
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	__m128i mmZeroData= _mm_setzero_si128();
+	mmResult= _mm_setzero_si128();
+#ifdef SIS_SIMD_INT64
+	int64 res64[2];
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+		mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+		mmResult= _mm_add_epi64(mmAA, mmResult);
+		mmResult= _mm_add_epi64(mmBB, mmResult);
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+		mmResult= _mm_add_epi64(mmAA, mmResult);
+		mmResult= _mm_add_epi64(mmBB, mmResult);
+	}
+	_mm_storeu_si128((__m128i*)res64, mmResult);
+	sum= res64[0]+ res64[1];
+#else
+	
+	UINT32 results[4];
+	
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+		
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+		mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+		
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+		
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+		
+		
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+		
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+	
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum+= results[0]+ results[1]+ results[2]+ results[3];
+#endif
+	
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        int e = vec1[i] * vec2[i];
+        int v = vec1[i + 1] * vec2[i + 1];
+		
+        e += v;
+        v = vec1[i + 2] * vec2[i + 2];
+        e += v;
+        v = vec1[i + 3] * vec2[i + 3];
+        e += v;
+        sum += e;
+    }
+#endif
+	
+    for( ; i < len; i++ )
+    {
+        s += vec1[i] * vec2[i];
+    }
+	
+    return sum + s;
+#endif
+}
+
+int64	CSISMath::Get_CCU8_UA(const uchar * vec1, const uchar * vec2, int len )
+{
+#if defined(SIS_ASM)
+	return _asm_Get_CCU8(vec1, vec2, len, 2);
+#else
+   int i, s = 0;
+    int64 sum = 0;
+
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	__m128i mmZeroData= _mm_setzero_si128();
+	mmResult= _mm_setzero_si128();
+
+#ifdef SIS_SIMD_INT64
+
+#endif
+
+	UINT32 results[4];
+
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+
+		mmA= _mm_loadu_si128((__m128i*) (vec1+ i));
+		mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmBB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+/*
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+		mmResult2= _mm_mullo_epi16(mmAA, mmBB);
+
+		// 1.2 8俺狼 16bit 单捞磐甫 4俺狼 32厚飘 单捞磐屈 滴俺肺 函券饶.. 歹茄促.
+		mmAA= _mm_unpackhi_epi16(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi16(mmResult2, mmZeroData);
+		mmResult2= _mm_add_epi32(mmAA, mmBB);
+		// 1.3 ... 醚钦俊 歹茄促.
+		mmResult= _mm_add_epi32(mmResult, mmResult2);
+
+
+
+		// 2. 窍困 单捞磐 拌魂.
+		// 2.1 窍困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+		mmResult2= _mm_mullo_epi16(mmAA, mmBB);
+		
+		// 2.2 8俺狼 16bit 单捞磐甫 4俺狼 32bit 单捞磐屈 滴俺肺 函券饶.. 歹茄促.
+		mmAA= _mm_unpackhi_epi16(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi16(mmResult2, mmZeroData);
+		mmResult2= _mm_add_epi32(mmAA, mmBB);
+		// 2.3 ... 醚钦俊 歹茄促.
+		mmResult= _mm_add_epi32(mmResult, mmResult2);
+		*/
+	}
+
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum+= (int64)results[0]+ results[1]+ results[2]+ results[3];
+
+
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        int e = vec1[i] * vec2[i];
+        int v = vec1[i + 1] * vec2[i + 1];
+
+        e += v;
+        v = vec1[i + 2] * vec2[i + 2];
+        e += v;
+        v = vec1[i + 3] * vec2[i + 3];
+        e += v;
+        sum += e;
+    }
+#endif
+
+    for( ; i < len; i++ )
+    {
+        s += vec1[i] * vec2[i];
+    }
+
+    return sum + s;
+#endif
+}
+
+int64	CSISMath::Get_CCU8_UA(const uchar * vec1, int len )
+{
+#if defined(SIS_DEBUG_OMP)
+	int64 rslt=  OMP_CCU8_UA(vec1, len);
+	return rslt;
+#endif
+
+#if defined(SIS_ASM)
+	return _asm_Get_CCU8(vec1, NULL, len, 2);
+#else
+	int i, s = 0;
+    int64 sum = 0;
+
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA;
+	__m128i	mmAA, mmBB;
+	__m128i mmZeroData= _mm_setzero_si128();
+
+#ifdef SIS_SIMD_INT64
+	int64 res64[2];
+	mmResult= _mm_setzero_si128();
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+
+		mmA= _mm_loadu_si128((__m128i*) (vec1+ i));
+
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+		mmResult2= _mm_madd_epi16(mmAA, mmAA);
+		mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+		mmResult= _mm_add_epi64(mmAA, mmResult);
+		mmResult= _mm_add_epi64(mmBB, mmResult);
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+		mmResult2= _mm_madd_epi16(mmAA, mmAA);
+		mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+		mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+		mmResult= _mm_add_epi64(mmAA, mmResult);
+		mmResult= _mm_add_epi64(mmBB, mmResult);
+	}
+	_mm_storeu_si128((__m128i*)res64, mmResult);
+	sum= res64[0]+ res64[1];
+
+#else
+
+	UINT32 results[4];
+
+	mmResult= _mm_setzero_si128();
+	for(i= 0; i <= len- 16; i+= 16)
+	{
+
+		mmA= _mm_loadu_si128((__m128i*) (vec1+ i));
+//		mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+
+		// 1. 惑困 单捞磐 拌魂.
+		// 1.1 惑困 8俺狼 8bit 单捞磐甫 8俺狼 16bit 单捞磐肺 函券饶.. 蚌茄促.
+		mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+//		mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmAA);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+
+
+		mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+//		mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+
+		mmResult2= _mm_madd_epi16(mmAA, mmAA);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+
+	}
+
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum+= results[0]+ results[1]+ results[2]+ results[3];
+#endif
+
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        int e = vec1[i] * vec1[i];
+        int v = vec1[i + 1] * vec1[i + 1];
+
+        e += v;
+        v = vec1[i + 2] * vec1[i + 2];
+        e += v;
+        v = vec1[i + 3] * vec1[i + 3];
+        e += v;
+        sum += e;
+    }
+#endif
+
+    for( ; i < len; i++ )
+    {
+        s += vec1[i] * vec1[i];
+    }
+
+    return sum + s;
+#endif
+}
+
+
+int64	CSISMath::Get_CCU8( CSISBuffer buffer1, int x1, int y1, int width, int height, CSISBuffer buffer2, int x2, int y2)
+{
+    int64 sum = 0;
+	int64 sum2= 0;
+	int h, w;
+	__m128i	mmA, mmB;
+	__m128i	mmAA, mmBB;
+	__m128i	mmResult, mmResult2;
+	__m128i mmZeroData= _mm_setzero_si128();
+	mmResult= _mm_setzero_si128();
+
+
+	for(h= 0; h< height; h++)
+	{
+		for(w= 0; w < width- 16; w+= 16)
+		{
+			mmA= _mm_loadu_si128((__m128i*) buffer1.GetDataAddress(x1+ w, y1+ h));
+			mmB= _mm_loadu_si128((__m128i*) buffer2.GetDataAddress(x2+ w, y2+ h));
+
+			mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+			mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+			
+			mmResult2= _mm_madd_epi16(mmAA, mmBB);
+			mmResult= _mm_add_epi32(mmResult2, mmResult);
+			
+			
+			mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+			mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+			
+			mmResult2= _mm_madd_epi16(mmAA, mmBB);
+			mmResult= _mm_add_epi32(mmResult2, mmResult);
+		}
+// 		for(; w< width; w++)
+// 		{
+// 			sum2+= buffer1.GetPixel(x1+ w, y1+ h)*buffer2.GetPixel(x2+ w, y2+ h);
+// 		}
+	}
+	UINT32 results[4];
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= (int64)results[0]+ results[1]+ results[2]+ results[3]+ sum2;
+    return sum;
+}
+
+int64	CSISMath::Get_CCU16_A( const ushort * vec1, const ushort * vec2, int len )
+{
+#if defined(SIS_DEBUG_ALIGNED_UNALIGNED)
+	return Get_CCU16_UA(vec1, vec2, len);
+#endif
+	int i, s = 0;
+	int64 sum = 0;
+
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA, mmB;
+	mmResult= _mm_setzero_si128();
+
+	UINT32 results[4];
+
+	for(i= 0; i <= len- 8; i+= 8)
+	{
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+		mmB= _mm_load_si128((__m128i*) (vec2+ i));
+
+
+		mmResult2= _mm_madd_epi16(mmA, mmB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= (int64)results[0]+ results[1]+ results[2]+ results[3];
+
+
+#else
+	for( i = 0; i <= len - 4; i += 4 )
+	{
+		int e = vec1[i] * vec2[i];
+		int v = vec1[i + 1] * vec2[i + 1];
+
+		e += v;
+		v = vec1[i + 2] * vec2[i + 2];
+		e += v;
+		v = vec1[i + 3] * vec2[i + 3];
+		e += v;
+		sum += e;
+	}
+#endif
+
+	for( ; i < len; i++ )
+	{
+		s += vec1[i] * vec2[i];
+	}
+
+	return sum + s;
+}
+
+int64	CSISMath::Get_CCU16_A( const ushort * vec1, int len )
+{
+#if defined(SIS_DEBUG_ALIGNED_UNALIGNED)
+	return Get_CCU16_UA(vec1, vec1, len);
+#endif
+	int i, s = 0;
+	int64 sum = 0;
+
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA;
+	mmResult= _mm_setzero_si128();
+
+	UINT32 results[4];
+
+	for(i= 0; i <= len- 8; i+= 8)
+	{
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+		//		mmB= _mm_load_si128((__m128i*) (vec2+ i));
+
+
+		mmResult2= _mm_madd_epi16(mmA, mmA);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= (int64)results[0]+ results[1]+ results[2]+ results[3];
+
+
+#else
+	for( i = 0; i <= len - 4; i += 4 )
+	{
+		int e = vec1[i] * vec1[i];
+		int v = vec1[i + 1] * vec1[i + 1];
+
+		e += v;
+		v = vec1[i + 2] * vec1[i + 2];
+		e += v;
+		v = vec1[i + 3] * vec1[i + 3];
+		e += v;
+		sum += e;
+	}
+#endif
+
+	for( ; i < len; i++ )
+	{
+		s += vec1[i] * vec1[i];
+	}
+
+	return sum + s;
+}
+
+int64	CSISMath::Get_CCU16_UA( const ushort * vec1, const ushort * vec2, int len )
+{
+    int i, s = 0;
+    int64 sum = 0;
+	
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA, mmB;
+	mmResult= _mm_setzero_si128();
+	
+	UINT32 results[4];
+	
+	for(i= 0; i <= len- 8; i+= 8)
+	{
+		mmA= _mm_loadu_si128((__m128i*) (vec1+ i));
+		mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+		
+		
+		mmResult2= _mm_madd_epi16(mmA, mmB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+	
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= (int64)results[0]+ results[1]+ results[2]+ results[3];
+	
+	
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        int e = vec1[i] * vec2[i];
+        int v = vec1[i + 1] * vec2[i + 1];
+		
+        e += v;
+        v = vec1[i + 2] * vec2[i + 2];
+        e += v;
+        v = vec1[i + 3] * vec2[i + 3];
+        e += v;
+        sum += e;
+    }
+#endif
+	
+    for( ; i < len; i++ )
+    {
+        s += vec1[i] * vec2[i];
+    }
+	
+    return sum + s;
+}
+
+int64	CSISMath::Get_CCU16_UA( const ushort * vec1, int len )
+{
+    int i, s = 0;
+    int64 sum = 0;
+	
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA;
+	mmResult= _mm_setzero_si128();
+	
+	UINT32 results[4];
+	
+	for(i= 0; i <= len- 8; i+= 8)
+	{
+		mmA= _mm_loadu_si128((__m128i*) (vec1+ i));
+		
+		
+		mmResult2= _mm_madd_epi16(mmA, mmA);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+	
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= (int64)results[0]+ results[1]+ results[2]+ results[3];
+	
+	
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        int e = vec1[i] * vec1[i];
+        int v = vec1[i + 1] * vec1[i + 1];
+		
+        e += v;
+        v = vec1[i + 2] * vec1[i + 2];
+        e += v;
+        v = vec1[i + 3] * vec1[i + 3];
+        e += v;
+        sum += e;
+    }
+#endif
+	
+    for( ; i < len; i++ )
+    {
+        s += vec1[i] * vec1[i];
+    }
+	
+    return sum + s;
+}
+
+
+int64	CSISMath::Get_CCU16_AUA( const ushort * vec1, const ushort * vec2, int len )
+{
+#if defined(SIS_DEBUG_ALIGNED_UNALIGNED)
+	return Get_CCU16_UA(vec1, vec2, len);
+#endif
+    int i, s = 0;
+    int64 sum = 0;
+	
+#ifdef SIS_SIMD
+	__m128i	mmResult, mmResult2;
+	__m128i	mmA, mmB;
+	mmResult= _mm_setzero_si128();
+	
+	UINT32 results[4];
+	
+	for(i= 0; i <= len- 8; i+= 8)
+	{
+		mmA= _mm_load_si128((__m128i*) (vec1+ i));
+		mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+		
+		
+		mmResult2= _mm_madd_epi16(mmA, mmB);
+		mmResult= _mm_add_epi32(mmResult2, mmResult);
+	}
+	
+	_mm_storeu_si128((__m128i*)results, mmResult);
+	sum= (int64)results[0]+ results[1]+ results[2]+ results[3];
+	
+	
+#else
+    for( i = 0; i <= len - 4; i += 4 )
+    {
+        int e = vec1[i] * vec2[i];
+        int v = vec1[i + 1] * vec2[i + 1];
+		
+        e += v;
+        v = vec1[i + 2] * vec2[i + 2];
+        e += v;
+        v = vec1[i + 3] * vec2[i + 3];
+        e += v;
+        sum += e;
+    }
+#endif
+	
+    for( ; i < len; i++ )
+    {
+        s += vec1[i] * vec2[i];
+    }
+	
+    return sum + s;
+}
diff --git a/Common_Class/SISBuffer/SISMath_omp.cpp b/Common_Class/SISBuffer/SISMath_omp.cpp
new file mode 100644
index 0000000..76711ec
--- /dev/null
+++ b/Common_Class/SISBuffer/SISMath_omp.cpp
@@ -0,0 +1,196 @@
+// SISMath.cpp: implementation of the CSISMath class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "SISMath.h"
+
+
+#include <emmintrin.h>
+#include <tmmintrin.h>
+#include <omp.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+#define SIS_SIMD
+
+#define MOMP_MAX_THREAD_SIZE 4
+
+//#define SIS_ASM
+
+
+int64 CSISMath::OMP_CCU8_A(const uchar * vec1, int len)
+{
+	int s = 0;
+	int64 sum = 0;
+
+	int64 sumT[MOMP_MAX_THREAD_SIZE] = {0};
+#pragma omp parallel num_threads(MOMP_MAX_THREAD_SIZE)
+	{
+		int i= 0;
+		int templen= len- 16;
+		__m128i	mmResult, mmResult2;
+		__m128i	mmA;
+		__m128i	mmAA, mmBB;	
+		__m128i mmZeroData= _mm_setzero_si128();
+
+		int64 res64[2];
+		mmResult= _mm_setzero_si128();
+#pragma omp for private(i)
+		for(i= 0; i <= templen; i+= 16)
+		{
+			mmA= _mm_load_si128((__m128i*) (vec1+ i));
+
+			mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+			mmResult2= _mm_madd_epi16(mmAA, mmAA);
+			mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+			mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+			mmResult= _mm_add_epi64(mmAA, mmResult);
+			mmResult= _mm_add_epi64(mmBB, mmResult);
+
+			mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+			mmResult2= _mm_madd_epi16(mmAA, mmAA);
+			mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+			mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+			mmResult= _mm_add_epi64(mmAA, mmResult);
+			mmResult= _mm_add_epi64(mmBB, mmResult);
+		}
+		_mm_storeu_si128((__m128i*)res64, mmResult);
+		sumT[omp_get_thread_num()]= res64[0]+ res64[1];
+	}
+
+	int i = 0;
+	for (i = 0; i < MOMP_MAX_THREAD_SIZE; i++)
+	{
+		sum += sumT[i];
+	}
+
+	i= len- (len&15);
+	for(; i < len; i++ )
+	{
+		s += vec1[i] * vec1[i];
+	}
+
+	return sum + s;
+}
+
+int64	CSISMath::OMP_CCU8_UA(const uchar *vec1, int len)
+{
+	int s = 0;
+	int64 sum = 0;
+	
+	int64 sumT[MOMP_MAX_THREAD_SIZE];
+#pragma omp parallel num_threads(MOMP_MAX_THREAD_SIZE)
+	{
+		int i = 0;
+		int templen= len- 16;
+		int64	res64[2];
+		__m128i	mmResult, mmResult2;
+		__m128i mmA, mmAA, mmBB;
+		__m128i mmZeroData= _mm_setzero_si128();
+		mmResult= mmZeroData;
+#pragma omp for private(i)
+		for(i= 0; i <= templen; i+= 16)
+		{
+			mmA= _mm_loadu_si128((__m128i*) (vec1+ i));
+
+			mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+			mmResult2= _mm_madd_epi16(mmAA, mmAA);
+			mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+			mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+			mmResult= _mm_add_epi64(mmAA, mmResult);
+			mmResult= _mm_add_epi64(mmBB, mmResult);
+
+			mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+			mmResult2= _mm_madd_epi16(mmAA, mmAA);
+			mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+			mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+			mmResult= _mm_add_epi64(mmAA, mmResult);
+			mmResult= _mm_add_epi64(mmBB, mmResult);
+		}
+		_mm_storeu_si128((__m128i*)res64, mmResult);
+		sumT[omp_get_thread_num()]= res64[0]+ res64[1];
+	}
+
+	int i = 0;
+	for(i= 0; i< MOMP_MAX_THREAD_SIZE; i++)
+	{
+		sum+= sumT[i];
+	}
+
+
+	i= len- (len&15);
+	for(; i < len; i++ )
+	{
+		s += vec1[i] * vec1[i];
+	}
+
+	return sum+ s;
+}
+
+int64	CSISMath::OMP_CCU8_AUA( const uchar * vec1, const uchar * vec2, int len )
+{
+	int s = 0;
+	int64 sum = 0;
+	int64 temp[MOMP_MAX_THREAD_SIZE];
+	
+
+
+#pragma omp parallel num_threads(MOMP_MAX_THREAD_SIZE)
+	{
+		int i = 0;
+		int	templen= len- 16;
+		__m128i	mmResult, mmResult2;
+		__m128i	mmA, mmB;
+		__m128i	mmAA, mmBB;
+		__m128i mmZeroData= _mm_setzero_si128();
+		mmResult= _mm_setzero_si128();
+		int64 res64[2];
+
+#pragma omp for private(i)
+		for(i= 0; i <= templen; i+= 16)
+		{
+			mmA= _mm_load_si128((__m128i*) (vec1+ i));
+			mmB= _mm_loadu_si128((__m128i*) (vec2+ i));
+
+			mmAA= _mm_unpackhi_epi8(mmA, mmZeroData);
+			mmBB= _mm_unpackhi_epi8(mmB, mmZeroData);
+			mmResult2= _mm_madd_epi16(mmAA, mmBB);
+			mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+			mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+			mmResult= _mm_add_epi64(mmAA, mmResult);
+			mmResult= _mm_add_epi64(mmBB, mmResult);
+
+			mmAA= _mm_unpacklo_epi8(mmA, mmZeroData);
+			mmBB= _mm_unpacklo_epi8(mmB, mmZeroData);
+			mmResult2= _mm_madd_epi16(mmAA, mmBB);
+			mmAA= _mm_unpackhi_epi32(mmResult2, mmZeroData);
+			mmBB= _mm_unpacklo_epi32(mmResult2, mmZeroData);
+			mmResult= _mm_add_epi64(mmAA, mmResult);
+			mmResult= _mm_add_epi64(mmBB, mmResult);
+		}
+		_mm_storeu_si128((__m128i*)res64, mmResult);
+		temp[omp_get_thread_num()]= res64[0]+ res64[1];
+	}
+	int i = 0;
+
+	for(i= 0; i< MOMP_MAX_THREAD_SIZE; i++)
+	{
+		sum+= temp[i];
+	}
+
+	i= len- (len&15);
+	for(; i < len; i++ )
+	{
+		s += vec1[i] * vec1[i];
+	}
+	return sum+ s;
+}
diff --git a/Common_Class/SISBuffer/SISMath_unuse.cpp b/Common_Class/SISBuffer/SISMath_unuse.cpp
new file mode 100644
index 0000000..b1186d2
--- /dev/null
+++ b/Common_Class/SISBuffer/SISMath_unuse.cpp
@@ -0,0 +1,23 @@
+// SISMath.cpp: implementation of the CSISMath class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "SISMath.h"
+
+
+#include <emmintrin.h>
+#include <tmmintrin.h>
+#include <omp.h>
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+#define SIS_SIMD
+#define SIS_DEBUG_OMP
+
+#define MOMP_MAX_THREAD_SIZE 4
+
+//#define SIS_ASM
+
diff --git a/Common_Class/SISBuffer/SISPitch.cpp b/Common_Class/SISBuffer/SISPitch.cpp
new file mode 100644
index 0000000..85b7340
--- /dev/null
+++ b/Common_Class/SISBuffer/SISPitch.cpp
@@ -0,0 +1,84 @@
+// SISPitch.cpp: implementation of the CSISPitch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "SISPitch.h"
+
+#include "SISBuffer.h"
+#include "SISMath.h"
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+BOOL CSISPitch::CheckPitch(CSISBuffer buffer, CRect rect)
+{
+	m_xPitch= 0;
+	m_yPitch= 0;
+	m_Rect= rect;
+	
+	int xIntPitch= (int)m_xPitchOrigin;
+	int yIntPitch= (int)m_yPitchOrigin;
+	
+	if(xIntPitch < 10 || yIntPitch < 10)
+		return FALSE;
+	if(rect.top < 0)
+		return FALSE;
+	CSISHive1B<int64> m_DifferenceHive;
+	if(m_DifferenceHive.SetSize(m_xSearchRange*2+ 2, FALSE) < 1)
+		return FALSE;
+	if(m_DifferenceHive.SetSize(m_ySearchRange*2+ 2, FALSE) < 1)
+		return FALSE;
+	
+	int64 *differences= m_DifferenceHive.GetData(0);
+	int i;
+	
+	double xResult= -1;
+	double yResult= -1;
+	int x, y, x2, y2;
+
+
+	x= rect.left;
+	y= rect.top;
+	x2= x+ xIntPitch- m_xSearchRange;
+	y2= y;
+
+	if(rect.left+ xIntPitch+ m_xSearchRange*2+ m_CheckWidth < rect.right)
+	{
+		for(i= 0; i< m_xSearchRange*2; i++)
+		{
+			differences[i]= CSISMath::GetAbsDiff(buffer, x, y, m_CheckWidth, m_CheckHeight, buffer, x2+ i, y2);
+		}
+		xResult= CSISMath::SearchMinimum(differences, m_xSearchRange*2);
+	}
+	if(xResult >= 0)
+	{
+		m_xPitch= x2- x+ xResult;
+	}else
+		m_xPitch= 0;
+
+
+	x2= x;
+	y2= y+ yIntPitch- m_ySearchRange;
+	if(rect.top+ yIntPitch+ m_ySearchRange*2+ m_CheckHeight < rect.bottom)
+	{
+		for(i= 0; i< m_ySearchRange*2; i++)
+		{
+			differences[i]= CSISMath::GetAbsDiff(buffer, x, y, m_CheckWidth, m_CheckHeight, buffer, x2, y2+ i);
+		}
+		yResult= CSISMath::SearchMinimum(differences, m_ySearchRange*2);
+	}
+	if(yResult >= 0)
+	{
+		m_yPitch= y2- y+ yResult;
+	}else
+		m_yPitch= 0;
+	
+	return xResult >= 0 && yResult >= 0;
+}
diff --git a/Common_Class/SISBuffer/StdAfx.cpp b/Common_Class/SISBuffer/StdAfx.cpp
new file mode 100644
index 0000000..48943ab
--- /dev/null
+++ b/Common_Class/SISBuffer/StdAfx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+//	SISBuffer.pch will be the pre-compiled header
+//	stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
+
diff --git a/Common_Class/SISBuffer/StdAfx.h b/Common_Class/SISBuffer/StdAfx.h
new file mode 100644
index 0000000..69d3189
--- /dev/null
+++ b/Common_Class/SISBuffer/StdAfx.h
@@ -0,0 +1,42 @@
+// stdafx.h : include file for standard system include files,
+//  or project specific include files that are used frequently, but
+//      are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__142FC3B7_2F5C_404B_9779_7C01223CD0E8__INCLUDED_)
+#define AFX_STDAFX_H__142FC3B7_2F5C_404B_9779_7C01223CD0E8__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers
+
+#include <afxwin.h>         // MFC core and standard components
+#include <afxext.h>         // MFC extensions
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE classes
+#include <afxodlgs.h>       // MFC OLE dialog classes
+#include <afxdisp.h>        // MFC Automation classes
+#endif // _AFX_NO_OLE_SUPPORT
+
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>			// MFC ODBC database classes
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>			// MFC DAO database classes
+#endif // _AFX_NO_DAO_SUPPORT
+
+#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>			// MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__142FC3B7_2F5C_404B_9779_7C01223CD0E8__INCLUDED_)
diff --git a/Common_Class/SISBuffer/res/SISBuffer.rc2 b/Common_Class/SISBuffer/res/SISBuffer.rc2
new file mode 100644
index 0000000..863425d
--- /dev/null
+++ b/Common_Class/SISBuffer/res/SISBuffer.rc2
@@ -0,0 +1,13 @@
+//
+// MOSISBUFFER.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+	#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/SISControls/CellCtrl.cpp b/Common_Class/SISControls/CellCtrl.cpp
new file mode 100644
index 0000000..37da64e
--- /dev/null
+++ b/Common_Class/SISControls/CellCtrl.cpp
@@ -0,0 +1,1548 @@
+// CellCtrl.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include "CellCtrl.h"
+#include "LogCtrl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CCellCtrl
+#define CHECKRGB(c) (c > 255 ? 255 : c)
+#define DIVCLR(c) RGB(CHECKRGB(GetRValue(c)*1.5),\
+					  CHECKRGB(GetGValue(c)*1.5),\
+					  CHECKRGB(GetBValue(c)*1.5))
+
+class CListSort
+{
+public:
+	// The sort depend on the EnumDataType. We can extent the type ...
+	enum SortDataType { dtNULL = 0, dtINT, dtDEC, dtSTRING, dtSTRINGNOCASE, dtDATETIME };
+
+	CListSort(CCellCtrl *pList, const int nCol)
+	{
+		m_pList = pList;
+		ASSERT(m_pList);
+		int totItems = m_pList->GetItemCount();
+
+		// Replace All Item Data with pointer to CSortItem class
+		for (int i = 0; i < totItems; i++)
+		{
+			DWORD dw = static_cast<DWORD>(m_pList->GetItemData(i));
+			CString txt = m_pList->GetItemText(i, nCol);
+			m_pList->SetItemData(i, (DWORD) new CSortItem(dw, txt));
+		}
+	}
+	virtual ~CListSort()
+	{
+		ASSERT(m_pList);
+		int totItems = m_pList->GetItemCount();
+		for (int i = 0; i < totItems; i++)
+		{
+			CSortItem *pItem = (CSortItem*)(m_pList->GetItemData(i));
+			ASSERT(pItem);
+			m_pList->SetItemData(i, pItem->m_dw);
+			if (pItem)
+			{
+				delete pItem;
+				pItem = NULL;
+			}
+		}
+	}
+	void Sort(BOOL bAsc, SortDataType dtType)
+	{
+		long lParamSort = bAsc ? dtType : -dtType;
+		m_pList->SortItems(Compare, lParamSort);
+	}
+
+protected:
+	CCellCtrl *m_pList;
+	static int CALLBACK Compare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+	{
+		CSortItem *pItem1 = (CSortItem*)lParam1;
+		CSortItem *pItem2 = (CSortItem*)lParam2;
+		ASSERT(pItem1 && pItem2);
+
+		int nOrder = (lParamSort < 0) ? -1 : 1;
+		SortDataType dtType = (SortDataType) (lParamSort * nOrder); // get rid of sign
+
+		switch (dtType)
+		{
+		case /*SortDataType::*/dtINT:
+			return (_ttoi(pItem1->m_txt) - _ttoi(pItem2->m_txt)) * nOrder;
+		case /*SortDataType::*/dtDEC:
+			return (int) ((_tcstod(pItem1->m_txt,NULL) - _tcstod(pItem2->m_txt,NULL)) * nOrder);
+		case /*SortDataType::*/dtSTRING:
+			return pItem1->m_txt.Compare(pItem2->m_txt) * nOrder;
+		case /*SortDataType::*/dtSTRINGNOCASE:
+			return pItem1->m_txt.CompareNoCase(pItem2->m_txt) * nOrder;
+		case /*SortDataType::*/dtDATETIME:
+			{
+				COleDateTime time1, time2;
+				if (time1.ParseDateTime(pItem1->m_txt) && time2.ParseDateTime(pItem2->m_txt))
+					return ((time1 == time2) ? 0 : (time1 < time2 ? -1 : 1)) * nOrder;
+			}
+		default:
+			ASSERT("Error: attempt to sort a column without type.");
+			return 0;
+		}
+	}
+
+	class CSortItem
+	{
+	public:
+		CSortItem(const DWORD dw, const CString &txt) : m_txt(txt),m_dw(dw){;}
+		virtual ~CSortItem() {;}
+		DWORD m_dw;
+		CString m_txt;
+	};
+};
+
+CCellCtrl::CCellCtrl()
+{
+	m_bSort=TRUE;//Sort Flag
+	m_bTime=FALSE;//SetTimer Flag
+	m_bTurnDraw=FALSE;//Item Color Convert 
+	m_pFont=NULL;//府胶飘 迄飘
+	m_pUmenu=NULL;//荤侩磊 皋春
+	m_edLct.nItem=0;//俊叼飘冠胶 困摹
+	m_edLct.nSubItem=0;
+	m_mcLct.nItem=0;//付快胶 努腐 困摹
+	m_mcLct.nSubItem=0;
+	m_bCanEdit = FALSE;
+	m_pInfo=new CELLINFO;//府胶飘 皋矫瘤 沥焊
+	m_nClipOptin=CCellCtrl::clipNO;//努赋焊靛 state
+}
+
+CCellCtrl::~CCellCtrl()
+{
+	m_menu.DestroyMenu();
+	m_edit.DestroyWindow();
+	if(m_pFont)	
+	{
+		m_pFont->DeleteObject();
+		delete m_pFont;
+		m_pFont = NULL;
+	}
+	if(m_pInfo)
+		delete m_pInfo;
+	m_pInfo = NULL;
+}
+
+BEGIN_MESSAGE_MAP(CCellCtrl, CListCtrl)
+	//{{AFX_MSG_MAP(CCellCtrl)
+//	ON_WM_CONTEXTMENU()
+	ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
+	ON_WM_HSCROLL()
+	ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
+	ON_WM_VSCROLL()
+	ON_WM_MOUSEWHEEL()
+	ON_NOTIFY_REFLECT(LVN_INSERTITEM, OnInsertitem)
+	ON_NOTIFY_REFLECT(LVN_DELETEITEM, OnDeleteitem)
+	ON_NOTIFY_REFLECT(LVN_DELETEALLITEMS, OnDeleteallitems)
+	ON_WM_TIMER()
+	ON_WM_DESTROY()
+	ON_WM_MEASUREITEM()
+	ON_WM_CTLCOLOR()
+	ON_WM_LBUTTONDOWN()
+	//}}AFX_MSG_MAP
+	ON_NOTIFY_REFLECT ( NM_CUSTOMDRAW, OnCustomdrawList )
+	ON_COMMAND(CCMSG_OPEN_EXCEL, OnOpenExcel)
+	ON_COMMAND(CCMSG_OPEN_LIST, OnOpenList)
+	ON_COMMAND(CCMSG_SAVE_FILE, OnSaveFile)
+	ON_COMMAND(CCMSG_USE_EDIT, OnUseEdit)
+	ON_COMMAND(CCMSG_MOVE_EDIT, OnMoveEdit)
+	ON_COMMAND(CCMSG_RECT_CHANGE, OnRectchange)
+	ON_COMMAND(CCMSG_LIST_PRINT, OnListPrint)
+	ON_COMMAND(CCMSG_FONT_CHANGE, OnFontChange)
+	ON_COMMAND(CCMSG_COPY_CLIPBOARD, OnCopyClipboard)
+	ON_COMMAND(CCMSG_PASTE_CLIPBOARD, OnPasteClipboard)
+	ON_COMMAND(CCMSG_CUT_CLIPBOARD, OnCutClipboard)
+	ON_COMMAND(CCMSG_SELITEM_DELETE, OnSelItemDelete)
+	ON_COMMAND(CCMSG_BACK_COLOR, OnBackColor)
+	ON_COMMAND(CCMSG_TEXT_COLOR, OnTextColor)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CCellCtrl message handlers
+
+/*
+void CCellCtrl::OnContextMenu(CWnd* pWnd, CPoint point) 
+{
+	if(point.x==-1 && point.y==-1)
+	{
+//		ScreenToClient(&point);
+		point=CPoint(0,0);
+		ClientToScreen(&point);
+	}
+	if(m_pUmenu)
+	{
+		CWnd* pParWnd = GetParent();
+ 		m_pUmenu->TrackPopupMenu(
+ 			TPM_CENTERALIGN | TPM_RIGHTBUTTON,
+ 			point.x, point.y, pWnd, 0);
+	}
+	else if(m_menu.GetSafeHmenu())
+	{
+ 		m_menu.TrackPopupMenu(
+ 			TPM_CENTERALIGN | TPM_RIGHTBUTTON,
+ 			point.x, point.y, pWnd, 0);
+	}
+}
+*/
+void CCellCtrl::UseMenu(UINT nOption)
+{
+	
+	m_pUmenu=NULL;
+	//皋春甫 荤侩窍瘤 臼阑 版快
+	if(nOption==CCellCtrl::menuNO)
+	{
+		if(m_menu.GetSafeHmenu())
+			m_menu.DestroyMenu();
+		return;
+	}
+
+	if(m_menu.GetSafeHmenu())
+		m_menu.DestroyMenu();
+
+	m_menu.CreatePopupMenu( ); 
+
+	//clipboard Option
+//	if(nOption & CCellCtrl::menuCOPY)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_COPY_CLIPBOARD, "汗荤	Ctrl+C"); 
+//	if(nOption & CCellCtrl::menuPASTE)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_PASTE_CLIPBOARD,"嘿咯持扁	Ctrl+V"); 
+//	if(nOption & CCellCtrl::menuCUT)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_CUT_CLIPBOARD,	 "肋扼郴扁	Ctrl+X"); 
+//	if(nOption & CCellCtrl::menuDELETE)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_SELITEM_DELETE, "昏力	Ctrl+Del"); 
+//	if(nOption & CCellCtrl::menuBACKCOLOR)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_BACK_COLOR, "硅版祸 汲沥"); 
+//	if(nOption & CCellCtrl::menuTEXTCOLOR)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_TEXT_COLOR, "臂祸 汲沥"); 
+
+//	if(nOption & 0xFFFF0000)
+//		m_menu.AppendMenu(MF_SEPARATOR); 
+
+	//menu Option
+//	if(nOption & CCellCtrl::menuINPUT)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_USE_EDIT,"涝仿"); 
+	if(nOption & CCellCtrl::menuSAVE)
+		m_menu.AppendMenu(MF_STRING, CCMSG_SAVE_FILE,_T("傈券(Excel)")); 
+	if(nOption & CCellCtrl::menuEXCEL)
+		m_menu.AppendMenu(MF_STRING, CCMSG_OPEN_EXCEL,_T("颇老凯扁(Excel)")); 
+//	if(nOption & CCellCtrl::menuLIST)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_OPEN_LIST,"颇老凯扁(List)"); 
+//	if(nOption & CCellCtrl::menuPRINT)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_LIST_PRINT,"橇赴飘"); 
+//	if(nOption & CCellCtrl::menuFONT)
+//		m_menu.AppendMenu(MF_STRING, CCMSG_FONT_CHANGE,"迄飘 汲沥"); 
+
+}
+void CCellCtrl::SerializeAllInfo(CArchive& ar)
+{
+	if (ar.IsStoring())
+	{	// storing code
+	}
+	else
+	{
+	}
+}
+
+void CCellCtrl::Serialize(CArchive& ar) 
+{
+	
+	if (ar.IsStoring())
+	{	// storing code
+		CString strText="";
+		TCHAR szText[256];
+		int  i=0, j=0, nCol=0, nRow=0;
+		LVCOLUMN lvcol;
+		memset(&lvcol, NULL, sizeof(lvcol));
+		lvcol.mask = LVCF_TEXT;
+		lvcol.pszText=szText;
+		lvcol.cchTextMax=256;
+
+		while(GetColumn(nCol, &lvcol))
+		{
+			strText += lvcol.pszText;
+			strText += ",";
+			lvcol.iSubItem=nCol++;
+		}
+		strText.TrimRight(_T(","));
+		strText+=_T("\n");
+
+		ar.WriteString(strText);
+
+		//府胶飘 酒捞袍狼 巩磊凯阑 啊廉柯促.
+		nRow=GetItemCount();
+		for( i=0; i<nRow; i++)
+		{
+			strText="";
+			for( j=0; j<nCol; j++)
+				strText+=(GetItemText(i,j)+",");
+
+			strText.TrimRight(_T(","));
+			strText+=_T("\n");
+			ar.WriteString(strText);
+		}	
+	}
+	else
+	{	
+		int nStart=0, nEnd=0;
+		int nRow=0, nCol=0;
+		int nSubItem=0;
+		CString strText="";
+		CString str="";
+		// HEADER
+		ar.ReadString(strText);
+//		if(!strText.IsEmpty())
+//		{
+//			while((nEnd=strText.Find(_T(","), nStart))>=0)
+//			{
+//				str=strText.Mid(nStart, nEnd-nStart);
+//				InsertColumn(++nCol, str, LVCFMT_LEFT, 100);
+//				nStart=nEnd+1;
+//			}
+//			str=strText.Mid(nStart, nStart+256);
+//			InsertColumn(nCol, str, LVCFMT_LEFT, 100);
+//		}
+			
+		// LIST
+		while(ar.ReadString(strText))
+		{
+			if(strText.IsEmpty())
+				break;
+
+			nStart=0;
+			nCol=0;
+			InsertItem(nRow,_T(""));
+			while((nEnd=strText.Find(_T(","), nStart))>=0)
+			{
+				str=strText.Mid(nStart, nEnd-nStart);
+				SetItemText(nRow, nCol++, str);
+				nStart=nEnd+1;
+			}
+			str=strText.Mid(nStart, nStart+256);
+			SetItemText(nRow, nCol, str);
+			nRow++;
+		}
+
+	}
+
+}
+
+int CCellCtrl::GetSubItemCount()
+{
+	LV_COLUMN lvcol;
+	lvcol.mask = LVCF_FMT;
+	int iColCnt=0;
+	while(GetColumn( ++iColCnt, &lvcol) ){};
+	return iColCnt;
+}
+
+void CCellCtrl::OnRectchange()
+{
+	CRect rectLC;
+	CRect rectED;
+	rectLC.SetRectEmpty();
+	rectED.SetRectEmpty();
+
+	m_edit.GetWindowRect(rectED);
+	if(m_edLct.nSubItem)
+		GetSubItemRect( m_edLct.nItem, m_edLct.nSubItem,LVIR_BOUNDS,rectLC);
+	else
+		GetSubItemRect( m_edLct.nItem, m_edLct.nSubItem,LVIR_LABEL,rectLC);
+
+	ClientToScreen(rectLC);
+
+	if(rectED.IsRectEmpty() || rectLC.IsRectEmpty())
+		return;
+
+	if(	rectED.left==rectLC.left && rectED.Width()==rectLC.Width())
+		return;
+
+	PostMessage(WM_COMMAND,CCMSG_MOVE_EDIT);
+}
+
+void CCellCtrl::OnUseEdit()
+{
+	UseEdit( m_mcLct.nItem, m_mcLct.nSubItem);
+}
+
+void CCellCtrl::OnMoveEdit()
+{
+	CRect rect;
+	CString strLCtxt=_T("");
+
+	if(m_edLct.nSubItem)
+		GetSubItemRect( m_edLct.nItem, m_edLct.nSubItem,LVIR_BOUNDS,rect);
+	else
+		GetSubItemRect( m_edLct.nItem, m_edLct.nSubItem,LVIR_LABEL,rect);
+	
+	if(GetStyle()&LVS_REPORT && rect.top<GetHeadHeight())
+	{
+		m_edit.ShowWindow(FALSE);
+		return;
+	}
+
+	strLCtxt=GetItemText( m_edLct.nItem, m_edLct.nSubItem);
+	m_edit.MoveWindow(rect);
+	m_edit.SetWindowText(strLCtxt);
+	m_edit.Invalidate();
+	m_edit.ShowWindow(TRUE);
+	m_edit.SetSel(0,-1);
+
+	memset(m_pInfo, NULL, sizeof(CELLINFO));
+	m_pInfo->nId	 =GetDlgCtrlID();
+	m_pInfo->nItem   =m_edLct.nItem;
+	m_pInfo->nSubItem=m_edLct.nSubItem;
+	m_pInfo->lpstrNew=(LPWSTR)(LPCTSTR)strLCtxt;
+	m_pInfo->lpstrOld=(LPWSTR)(LPCTSTR)strLCtxt;
+	CWnd* pWnd=GetParent();
+	::SendMessage(pWnd->m_hWnd, CCMSG_LIST, (WPARAM)CCMSG_MOVE_EDIT, (LPARAM)m_pInfo);
+}
+
+BOOL CCellCtrl::UseEdit( int nItem, int nSubItem)
+{
+	if(nItem<0 || nSubItem<0)
+		return 0;
+
+	m_edLct.nItem=nItem;
+	m_edLct.nSubItem=nSubItem;
+	CRect rect;
+	if(!m_edit.GetSafeHwnd())
+	{
+		CFont* pFont=GetFont();
+		m_edit.Create(ES_LEFT | ES_AUTOHSCROLL | WS_BORDER | WS_CHILD ,rect,this,0);
+		m_edit.SetFont(pFont);
+	}
+	PostMessage(WM_COMMAND,CCMSG_MOVE_EDIT);
+	return 1;
+}
+
+void CCellCtrl::UpdateEdit(int nItem, int nSubItem)
+{
+	if(m_mcLct.nItem==nItem && m_mcLct.nSubItem==nSubItem)
+	{
+		if(m_edit.GetSafeHwnd() && m_edit.IsWindowVisible())
+			PostMessage(WM_COMMAND,CCMSG_RECT_CHANGE);
+	}
+}
+
+BOOL CCellCtrl::IsModifyEdit(int nItem, int nSubItem)
+{
+	CString strEDtxt="";
+	CString strLCtxt="";
+
+	m_edit.GetWindowText(strEDtxt);
+	strLCtxt = GetItemText(nItem, nSubItem);
+	SetItemText(nItem,nSubItem,strEDtxt);
+
+
+	if(strEDtxt==strLCtxt)
+		return 0;
+
+	memset(m_pInfo, NULL, sizeof(CELLINFO));
+	m_pInfo->nId	 = GetDlgCtrlID();
+	m_pInfo->nItem	 = nItem;
+	m_pInfo->nSubItem= nSubItem;
+	m_pInfo->lpstrNew= (LPWSTR)(LPCTSTR)strEDtxt;
+	m_pInfo->lpstrOld= (LPWSTR)(LPCTSTR)strLCtxt;
+	CWnd* pWnd=GetParent();
+	::SendMessage(pWnd->m_hWnd, CCMSG_LIST, (WPARAM)CCMSG_MODIFY_EDIT, (LPARAM)m_pInfo);
+	int nn=CCMSG_LIST;
+	return 1;
+}
+
+void CCellCtrl::EditCtrl(MSG msg)
+{
+	TCHAR szKey[128]=_T("");
+	int nSChar=0,nEChar=0;
+	CString string="";
+	int nICnt=GetItemCount()-1;
+	int nSCnt=GetSubItemCount()-1;
+	int nItem=m_edLct.nItem;
+	int nSubItem=m_edLct.nSubItem;
+
+	if((CWnd*)&m_edit != GetFocus())
+	{
+		m_edit.SetFocus();
+		GetKeyNameText( static_cast<LONG>(msg.lParam), szKey, sizeof(szKey));
+		
+		if(wcslen(szKey)==1)
+			m_edit.SetWindowText(szKey);
+		m_edit.SetSel(1,1);
+	}
+	switch(msg.wParam)
+	{
+	case VK_UP:
+		if(m_edLct.nItem<1)	return;
+		m_edLct.nItem--;
+		SetItemState(m_edLct.nItem,LVIS_FOCUSED ,LVIS_FOCUSED );
+		EnsureVisible(m_edLct.nItem, TRUE);
+		break;
+	case VK_DOWN:	
+		if(nICnt<=m_edLct.nItem)return;
+		m_edLct.nItem++;
+		SetItemState(m_edLct.nItem,LVIS_FOCUSED ,LVIS_FOCUSED );
+		EnsureVisible(m_edLct.nItem, TRUE);
+		break;
+	case VK_LEFT:	
+		if(m_edLct.nSubItem<1)return;
+//		m_edit.GetSel(nSChar, nEChar);
+//		if(nSChar!=nEChar)
+//		{
+//			m_edit.SetSel(nSChar, nSChar);
+//			return;
+//		}
+		m_edLct.nSubItem--;
+		break;
+	case VK_RIGHT:	
+		if(nSCnt<=m_edLct.nSubItem)return;
+//		m_edit.GetSel(nSChar, nEChar);
+//		if(nSChar!=nEChar)
+//		{
+//			m_edit.SetSel(nEChar, nEChar);
+//			return;
+//		}
+		m_edLct.nSubItem++;
+		break;
+	case VK_HOME:	
+		m_edLct.nSubItem=0;
+		break;
+	case VK_END:	
+		m_edLct.nSubItem=nSCnt;
+		break;
+	case VK_PRIOR:	return;
+	case VK_NEXT:	return;
+	case VK_RETURN:
+		msg.wParam=VK_DOWN;
+		EditCtrl(msg);
+		return;
+	case VK_ESCAPE: 
+		m_edit.ShowWindow(FALSE);
+		return;
+	default:		
+		return;
+	}
+
+	//俊叼飘 冠胶狼 巩磊凯苞 府胶飘俊 乐绰 巩磊凯苞 厚背窍咯 
+	//促甫 版快 俊叼飘 冠胶狼 巩磊凯阑 府胶飘俊 涝仿茄促.
+	IsModifyEdit(nItem, nSubItem);
+	UpdateCell(m_edLct.nItem, m_edLct.nSubItem);
+	PostMessage(WM_COMMAND,CCMSG_MOVE_EDIT);//俊叼飘冠胶 捞悼
+}
+
+void CCellCtrl::UpdateCell(int nItem, int nSubItem)
+{
+	CRect rect;
+	if(nSubItem==0)
+		GetSubItemRect(nItem,nSubItem,LVIR_LABEL,rect);
+	else
+		GetSubItemRect(nItem,nSubItem,LVIR_BOUNDS,rect);
+	InvalidateRect(&rect);
+}
+
+void CCellCtrl::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+	m_mcLct.nItem=pNMListView->iItem;
+	m_mcLct.nSubItem=pNMListView->iSubItem;
+	*pResult = 0;
+}
+
+void CCellCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
+{
+	if(m_edit.GetSafeHwnd() && m_edit.IsWindowVisible())
+		PostMessage(WM_COMMAND,CCMSG_MOVE_EDIT);
+		
+	CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CCellCtrl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if(m_edit.GetSafeHwnd() && m_edit.IsWindowVisible())
+		PostMessage(WM_COMMAND,CCMSG_MOVE_EDIT);
+	
+	CListCtrl::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CCellCtrl::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+
+	if(!m_bSort)
+		return;
+
+	static BOOL bAsc=TRUE;
+	CString strText=GetItemText(0,pNMListView->iSubItem);
+
+	COleDateTime oleTime;
+	CListSort listSort(this,pNMListView->iSubItem);
+	if(bAsc)bAsc=FALSE;
+	else	bAsc=TRUE;
+
+	if(strText.IsEmpty())
+		listSort.Sort(bAsc,CListSort/*::SortDataType*/::dtSTRING);
+	else if(oleTime.ParseDateTime(strText))
+		listSort.Sort(bAsc,CListSort/*::SortDataType*/::dtDATETIME);
+	else if(_ttoi(strText) || strText.GetAt(0)=='0')
+		listSort.Sort(bAsc,CListSort/*::SortDataType*/::dtINT);
+	else
+		listSort.Sort(bAsc,CListSort/*::SortDataType*/::dtSTRING);
+
+	*pResult = 0;
+}
+
+BOOL CCellCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if(m_edit.GetSafeHwnd() && m_edit.IsWindowVisible())
+		PostMessage(WM_COMMAND,CCMSG_MOVE_EDIT);
+	
+	return CListCtrl::OnMouseWheel(nFlags, zDelta, pt);
+}
+
+HBRUSH CCellCtrl::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
+{
+	HBRUSH hbr = CListCtrl::OnCtlColor(pDC, pWnd, nCtlColor);
+	// TODO: Change any attributes of the DC here
+	CELLCOLOR cellcolor;
+	if(GetItemColor(m_edLct.nItem, m_edLct.nSubItem, &cellcolor))
+	{
+		if(m_edit.IsWindowVisible())
+		{
+			m_brush.DeleteObject();
+			pDC->SetBkMode(TRANSPARENT);
+			pDC->SetTextColor(cellcolor.txtclr);
+			m_brush.CreateSolidBrush(cellcolor.bkgclr);
+			return (HBRUSH)m_brush;
+		}
+	}
+	return hbr;
+}
+
+BOOL CCellCtrl::PreTranslateMessage(MSG* pMsg) 
+{
+	switch(pMsg->message)
+	{
+	case WM_LBUTTONDBLCLK:
+		break;
+	case WM_LBUTTONDOWN:
+		break;
+	case WM_RBUTTONDOWN:
+		break;
+	case WM_LBUTTONUP:
+		HitTest(CPoint(static_cast<int>(pMsg->wParam), static_cast<int>(pMsg->lParam)));
+		break;
+	case WM_MOUSEMOVE:
+		break;
+	case WM_KEYDOWN:
+		if(m_edit.GetSafeHwnd() && m_edit.IsWindowVisible())
+		{
+			if(!IsMultiKey())
+				EditCtrl(*pMsg);
+		}
+
+		if(GetKeyState(VK_CONTROL) & 128)
+		{
+			if((CWnd*)&m_edit == GetFocus())
+				break;
+
+			switch(pMsg->wParam)
+			{
+			case 'C':	CopyClipboard();	break;
+			case 'V':	PasteClipboard();	break;
+			case 'X':	CutClipboard();		break;
+			case VK_DELETE:	SelectItemDelete();	break;
+			}
+		}
+	}
+	
+	return CListCtrl::PreTranslateMessage(pMsg);
+}
+
+void CCellCtrl::OnSaveFile() 
+{
+
+	
+	CFileDialog fileDlg( FALSE, NULL, NULL,
+						OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT,
+						_T("Excel Data Files (*.csv)|*.csv||"), this );
+
+	if(fileDlg.DoModal()!=IDOK)
+		return;
+
+	//颇老 捞抚阑 啊廉柯促.
+	CString filename = fileDlg.GetFileName();
+	CString extname = fileDlg.GetFileExt();
+	extname.MakeLower();
+
+	//颇老狼 犬厘疙捞 乐绰瘤 眉农
+	if(extname.IsEmpty() || extname!="csv")
+		filename+=".csv";
+
+	CFile wfile(filename, 
+				CFile::modeCreate | 
+//				CFile::modeNoTruncate | 
+				CFile::modeWrite | 
+				CFile::typeBinary);
+
+	CArchive ar(&wfile, CArchive::store);
+	Serialize(ar);
+	
+}
+
+void CCellCtrl::OnOpenExcel() 
+{
+	CFileDialog fileDlg( TRUE, NULL, NULL,
+						OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT,
+						_T("Data Files (*.xlc;*.xls;*.csv)|*.xlc; *.xls ; *.csv|All Files (*.*)|*.*||"));
+ 
+	if(fileDlg.DoModal()!=IDOK)
+		return;
+
+	//颇老 捞抚阑 啊廉柯促.
+	CString filename = fileDlg.GetPathName();
+	ShellExecute(m_hWnd, _T("open"), filename,NULL, NULL, SW_SHOW);
+}
+
+void CCellCtrl::OnOpenList() 
+{
+	CFileDialog fileDlg( TRUE, NULL, NULL,
+						OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT,
+						_T("Excel Data Files (*.csv)|*.csv||"), this );
+
+	if(fileDlg.DoModal()!=IDOK)
+		return;
+
+	//颇老 捞抚阑 啊廉柯促.
+	CString filename = fileDlg.GetFileName();
+	CString extname = fileDlg.GetFileExt();
+	extname.MakeLower();
+
+	//颇老狼 犬厘疙捞 乐绰瘤 眉农
+	if(extname.IsEmpty() || extname!="csv")
+		filename+=".csv";
+
+	CFile rfile(filename, 
+				CFile::modeCreate | 
+				CFile::modeNoTruncate | 
+				CFile::modeRead | 
+				CFile::typeBinary);
+
+	DeleteAllItems();
+	CArchive ar(&rfile, CArchive::load);
+	Serialize(ar);
+}
+
+void CCellCtrl::OnListPrint() 
+{
+	ListPrinting(TRUE);
+}
+
+void CCellCtrl::OnFontChange()
+{
+	LOGFONT logfont;
+	CFont *pFont=GetFont();
+	pFont->GetLogFont(&logfont);
+	CFontDialog fontDlg( &logfont, CF_EFFECTS | CF_BOTH, NULL, this );
+	if(fontDlg.DoModal()!=IDOK)
+		return;
+	fontDlg.GetCurrentFont( &logfont);
+	SetListFont(&logfont);
+}
+
+void CCellCtrl::OnBackColor()
+{
+	CELLCOLOR cellClr;
+	COLORREF  newBkgclr;
+	CColorDialog clrDlg;
+	CWnd* pWnd=GetParent();
+	int nID = GetDlgCtrlID();
+	int nSubItemCnt=GetSubItemCount();
+	if(clrDlg.DoModal()!=IDOK)
+		return;
+	newBkgclr = clrDlg.GetColor();
+	POSITION pos=GetFirstSelectedItemPosition();
+	while(1)
+	{
+		if(!pos) break;
+		int nItem=GetNextSelectedItem(pos);
+		for( int nSubItem=0; nSubItem<nSubItemCnt; nSubItem++)
+		{
+			GetItemColor(nItem,nSubItem, &cellClr);
+			memset(m_pInfo, 0, sizeof(CELLINFO));
+			m_pInfo->nId = nID;
+			m_pInfo->nItem = nItem;
+			m_pInfo->nSubItem=nSubItem;
+			m_pInfo->oldClr.bkgclr = cellClr.bkgclr;
+			m_pInfo->newClr.bkgclr = newBkgclr;
+
+			SetItemBkColor(nItem, nSubItem, newBkgclr, IsTurning(nItem, nSubItem));
+			UpdateCell(nItem,nSubItem);
+
+			::SendMessage(pWnd->m_hWnd, CCMSG_LIST, 
+				(WPARAM)CCMSG_BACK_COLOR, 
+				(LPARAM)m_pInfo);
+		}
+	}
+}
+
+void CCellCtrl::OnTextColor()
+{
+	CELLCOLOR cellClr;
+	COLORREF  newTxtclr;
+	CColorDialog clrDlg;
+	CWnd* pWnd=GetParent();
+	int nID = GetDlgCtrlID();
+	int nSubItemCnt=GetSubItemCount();
+	if(clrDlg.DoModal()!=IDOK)
+		return;
+	newTxtclr = clrDlg.GetColor();
+
+	POSITION pos=GetFirstSelectedItemPosition();
+	while(1)
+	{
+		if(!pos) break;
+		int nItem=GetNextSelectedItem(pos);
+		for( int nSubItem=0; nSubItem<nSubItemCnt; nSubItem++)
+		{
+			GetItemColor(nItem,nSubItem, &cellClr);
+			memset(m_pInfo, 0, sizeof(CELLINFO));
+
+			m_pInfo->nId = nID;
+			m_pInfo->nItem=nItem;
+			m_pInfo->nItem=nSubItem;
+			m_pInfo->oldClr.txtclr=cellClr.txtclr;
+			m_pInfo->newClr.txtclr=newTxtclr;
+
+			SetItemTextColor( nItem, nSubItem, newTxtclr);
+			::SendMessage(pWnd->m_hWnd, CCMSG_LIST, 
+				(WPARAM)CCMSG_TEXT_COLOR, 
+				(LPARAM)m_pInfo);
+		}
+		Update(nItem);
+	}
+}
+
+BOOL CCellCtrl::ListPrinting(BOOL bDialog, int Orientation)
+{
+	CPrintDC printDC;
+	CDC* pDC;
+	pDC= printDC.GetPrintDC(Orientation, bDialog);
+	if(!pDC)return 0;
+	Printing(pDC);
+	return 1;
+}
+
+void CCellCtrl::SetListFont(LOGFONT* plogfont)
+{
+	if(m_pFont)
+	{
+		delete m_pFont; 
+		m_pFont=NULL;
+	}
+
+	EnsureVisible( 0, TRUE);
+	m_pFont=new CFont;
+	m_pFont->CreateFontIndirect(plogfont);
+	SetFont(m_pFont);
+
+	if(m_edit.GetSafeHwnd())
+	{
+		m_edit.SetFont(m_pFont);
+		PostMessage(WM_COMMAND,CCMSG_MOVE_EDIT);
+	}
+
+	if(GetSafeHead())
+	{
+		m_head.FontChange(*plogfont);
+		Update(0);
+	}
+}
+
+BOOL CCellCtrl::GetSafeHead()
+{
+	if((GetStyle() & LVS_TYPEMASK)==LVS_REPORT)
+	{
+		if(!m_head.GetSafeHwnd())	
+			m_head.SubclassWindow(GetHeaderCtrl()->m_hWnd);
+		return 1;
+	}
+	return 0;
+}
+
+BOOL CCellCtrl::IsMultiKey()
+{
+	int vKey=0;
+	UCHAR kBuf[256];
+	GetKeyboardState(kBuf);
+	if(kBuf[VK_CONTROL] & 128)	return 1;
+	if (kBuf[VK_SHIFT] & 128)	return 1;
+
+	return 0;
+}
+
+void CCellCtrl::Printing(CDC* pDC)
+{
+	DOCINFO di;
+	CLogCtrl logctrl;
+
+	int nHeadCnt   =m_head.GetCount();
+	int nItemCnt   =GetItemCount();
+	int nSubItemCnt=GetSubItemCount();
+	int nMode = pDC->SetMapMode(MM_ISOTROPIC);
+	int nVertres=pDC->GetDeviceCaps(VERTRES);
+	int nVertSize=pDC->GetDeviceCaps(VERTSIZE);
+	int nHorzres=pDC->GetDeviceCaps(HORZRES);
+	int nHorzSize=pDC->GetDeviceCaps(HORZSIZE);
+	SetCrtToPrintRate(pDC);
+
+	int nHeight = GetLogRect(pDC, 0, 0).Height();
+	if (nHeight==0)	return ;
+	int nPageItemCnt = (nVertres-(nVertSize*3))/nHeight;
+
+	memset(&di,NULL,sizeof(di));
+	di.cbSize = sizeof(DOCINFO);
+	di.lpszDocName = _T("府胶飘 免仿");
+
+	int i=0,j=0;
+	int nTopIndex=0;
+	while(1)
+	{
+		CRect rect;
+		CString strText;
+		CLogPage logpage;
+		logpage.RemoveRow(10);
+		logpage.SetColCount(nSubItemCnt);
+		logpage.SetRowCount(nPageItemCnt);
+
+		for( i=0; i<nSubItemCnt; i++)
+			logpage.SetColWidth(i,GetLogRect(pDC, 0, i).Width());
+
+		for( i=0; i<nPageItemCnt; i++)
+			logpage.SetRowHeight(i,nHeight);
+
+		//庆歹何盒 祈笼
+		for( i=0; i<nHeadCnt; i++)
+		{
+			for( j=0; j<m_head.GetItemCount(); j++)
+			{
+				int down=0, right=0;
+				int nMode = m_head.GetItemState(i,j,down,right);
+				if(nMode==LCS_UNUSE) continue;
+
+				if(nMode==LCS_MERGE)
+					logpage.CellMerge( i, j, i+down, j+right);
+
+				strText=m_head.GetItemText(i,j);
+				logpage.SetItemText(i,j,strText);
+				logpage.SetCellBkgColor(i,j, RGB(200,200,200));
+				logpage.SetCellTxtColor(i,j, RGB(0,0,0));
+				logpage.SetCellFormat(i,j, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
+			}
+		}
+
+		//府胶飘 祈笼
+		for( i=0; i<nPageItemCnt; i++)
+		{
+			if(i+nTopIndex>=GetItemCount())	break;
+
+			for( j=0; j<nSubItemCnt; j++)
+			{
+				CELLCOLOR color;
+				strText = GetItemText(i+nTopIndex,j);
+				if(GetItemColor(i+nTopIndex,j, &color))
+				{
+					logpage.SetCellBkgColor(i+nHeadCnt,j, color.bkgclr);
+					logpage.SetCellTxtColor(i+nHeadCnt,j, color.txtclr);
+				}
+
+				logpage.SetItemText( i+nHeadCnt, j, strText);
+				logpage.SetCellFormat(i+nHeadCnt, j, DT_LEFT|DT_SINGLELINE|DT_VCENTER);
+			}
+		}
+
+		logctrl.AddLogPage(logpage);
+		logpage.RemoveAll();
+
+		if(i+nTopIndex>=GetItemCount())	break;
+		nTopIndex+=(nPageItemCnt-nHeadCnt);
+	}
+
+	pDC->SetMapMode(MM_TEXT);
+	logctrl.Draw(pDC,&di);
+	pDC->SetMapMode(nMode);
+
+	return;
+}
+
+CRect CCellCtrl::GetLogRect(CDC* pDC, int nItem, int nSubItem)
+{
+	CRect rect;
+	if(nSubItem)
+	{
+		GetSubItemRect(nItem,nSubItem,LVIR_BOUNDS,rect);
+	}
+	else
+	{
+		GetSubItemRect(nItem,nSubItem,LVIR_LABEL,rect);
+		rect.left=0;
+	}
+
+	pDC->LPtoDP(&rect);
+
+	return rect;
+}
+
+int  CCellCtrl::GetColumnFmt(int nSubItem)
+{
+	LV_COLUMN lvcol;
+	lvcol.mask = LVCF_FMT;
+	GetColumn( nSubItem, &lvcol);
+	lvcol.fmt &=0x0f;
+	switch(lvcol.fmt)
+	{
+	case LVCFMT_LEFT:	lvcol.fmt=DT_LEFT;	break;
+	case LVCFMT_RIGHT:	lvcol.fmt=DT_RIGHT;	break;
+	case LVCFMT_CENTER:	lvcol.fmt=DT_CENTER;break;
+	default:			lvcol.fmt=DT_CENTER;break;
+	}
+	return lvcol.fmt;
+}
+
+void CCellCtrl::SetCrtToPrintRate(CDC* pPntDC)
+{
+	int iWidth=GetCrtWidth();
+	float fPntWidth=(float)pPntDC->GetDeviceCaps(HORZRES);
+	float fPntHeight=(float)pPntDC->GetDeviceCaps(VERTRES);
+	int iHeight= (int)((float)iWidth * (fPntHeight/fPntWidth));
+
+	pPntDC->SetWindowExt(iWidth, iHeight);
+	pPntDC->SetViewportOrg( pPntDC->GetDeviceCaps(HORZSIZE),
+							pPntDC->GetDeviceCaps(VERTSIZE)*3);
+	pPntDC->SetViewportExt( (int)fPntWidth-(pPntDC->GetDeviceCaps(HORZSIZE)),
+							(int)fPntHeight-(pPntDC->GetDeviceCaps(VERTSIZE)*2));
+}
+
+//府胶飘狼 SubItem苞 扩档快狼 农扁吝 奴蔼阑 府畔茄促.
+int CCellCtrl::GetCrtWidth()
+{
+	CRect rect;
+	CRect rectClient;
+	GetSubItemRect(0,0,LVIR_BOUNDS,rect);
+	GetClientRect(rectClient);
+	rect|=rectClient;
+	return rect.Width();
+}
+
+void CCellCtrl::OnInsertitem(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+	*pResult = 0;
+}
+
+void CCellCtrl::OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+
+	DeleteItemData(pNMListView->iItem);
+	*pResult = 0;
+}
+
+void CCellCtrl::OnDeleteallitems(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+	DeleteAllItemData();
+	*pResult = 0;
+}
+
+void CCellCtrl::DeleteItemData(int nItem)
+{
+	CCSArray* pcsAry= (CCSArray*)GetItemData(nItem);
+	if(!pcsAry)	return;
+	pcsAry->RemoveAll();
+	if (pcsAry)
+	{
+		delete pcsAry;
+		pcsAry = NULL;
+	}
+	
+	SetItemData(nItem, 0);
+}
+
+void CCellCtrl::DeleteAllItemData()
+{
+	int count = GetItemCount();
+	for( int i=0; i<count; i++)
+		DeleteItemData(i);
+}
+
+BOOL CCellCtrl::GetItemColor(int nItem, int nSubItem, CELLCOLOR* pCellClr)
+{
+	CCSArray* pcsAry = (CCSArray*)GetItemData(nItem);
+	if(!pcsAry)	return 0;
+	if(pcsAry->GetSize()<=nSubItem)	return 0;
+	pCellClr->txtclr=(*pcsAry)[nSubItem].txtclr;
+	pCellClr->bkgclr=(*pcsAry)[nSubItem].bkgclr;
+	return 1;
+}
+
+BOOL CCellCtrl::SetItemBkColor(int nItem, int nSubItem, COLORREF color, bool bTurn)
+{
+	if(!m_bTime)
+	{
+		m_bTime=true;
+		SetTimer(GetDlgCtrlID(),500, NULL);
+	}
+
+	int nSubItemCount = GetSubItemCount();
+	int nItemCount = GetItemCount();
+	if(nItemCount<=nItem || nSubItemCount<=nSubItem)
+		return 0;
+
+	//酒捞袍俊 单捞磐啊 粮犁窍瘤 臼阑 版快 积己茄促.
+	CCSArray* pcsAry = (CCSArray*)GetItemData(nItem);
+	if(!pcsAry)
+	{
+		pcsAry = new CCSArray;
+		pcsAry->SetSize(nSubItemCount);
+		SetItemData(nItem, (DWORD)pcsAry);
+	}
+	if(pcsAry->GetSize()<=nSubItem)
+	{
+		pcsAry->SetAtGrow(nSubItem, CCellData(clrTEXT, color, bTurn));
+	}
+	else
+	{
+		(*pcsAry)[nSubItem].bkgclr=color;
+		(*pcsAry)[nSubItem].bTurn=bTurn;
+	}
+	return 1;
+}
+
+bool CCellCtrl::IsTurning(int nItem, int nSubItem)
+{
+	CCSArray* pcsAry = (CCSArray*)GetItemData(nItem);
+	if(!pcsAry) return 0;
+	return (*pcsAry)[nSubItem].bTurn;
+}
+
+BOOL CCellCtrl::SetCellData(int nItem, int nSubItem, DWORD dwUserData)
+{
+	int nSubItemCount = GetSubItemCount();
+	int nItemCount = GetItemCount();
+	if(nItemCount<=nItem || nSubItemCount<=nSubItem)
+		return 0;
+
+	//酒捞袍俊 单捞磐啊 粮犁窍瘤 臼阑 版快 积己茄促.
+	CCSArray* pcsAry = (CCSArray*)GetItemData(nItem);
+	if(!pcsAry)
+	{
+		pcsAry = new CCSArray;
+		pcsAry->SetSize(nSubItemCount);
+		SetItemData(nItem, (DWORD)pcsAry);
+	}
+	if(pcsAry->GetSize()<=nSubItem)
+		pcsAry->SetAtGrow(nSubItem, CCellData(clrTEXT, clrBACK, false, dwUserData));
+	else
+		(*pcsAry)[nSubItem].dwData=dwUserData;
+	return 1;
+}
+
+DWORD CCellCtrl::GetCellData(int nItem, int nSubItem)
+{
+	CCSArray* pcsAry = (CCSArray*)GetItemData(nItem);
+	if(!pcsAry)	return 0;
+	if(pcsAry->GetSize()<=nSubItem)	return 0;
+	return (*pcsAry)[nSubItem].dwData;
+}
+
+BOOL CCellCtrl::SetItemTextColor(int nItem, int nSubItem, COLORREF color)
+{
+	int nSubItemCount = GetSubItemCount();
+	int nItemCount = GetItemCount();
+	if(nItemCount<=nItem || nSubItemCount<=nSubItem)
+		return 0;
+
+	//酒捞袍俊 单捞磐啊 粮犁窍瘤 臼阑 版快 积己茄促.
+	CCSArray* pcsAry = (CCSArray*)GetItemData(nItem);
+	if(!pcsAry)
+	{
+		pcsAry = new CCSArray;
+		pcsAry->SetSize(nSubItemCount);
+		SetItemData(nItem, (DWORD)pcsAry);
+	}
+	if(pcsAry->GetSize()<=nSubItem)
+		pcsAry->SetAtGrow(nSubItem, CCellData(color, clrBACK, false));
+	else
+		(*pcsAry)[nSubItem].txtclr=color;
+	return 1;
+}
+
+BOOL CCellCtrl::SetItemBkColor(int nItem, COLORREF color, bool bTurn)
+{
+	int nSubItemCount=GetSubItemCount();
+	for(int i=0; i<nSubItemCount; i++)
+		SetItemBkColor(nItem, i, color,bTurn);
+	return 1;
+}
+
+BOOL CCellCtrl::SetItemTextColor(int nItem, COLORREF color)
+{
+	int nSubItemCount=GetSubItemCount();
+	for(int i=0; i<nSubItemCount; i++)
+		SetItemTextColor(nItem, i, color);
+	return 1;
+}
+
+void CCellCtrl::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
+{
+	NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
+
+    // Take the default processing unless we set this to something else below.
+    *pResult = CDRF_DODEFAULT;
+
+    // First thing - check the draw stage. If it's the control's prepaint
+    // stage, then tell Windows we want messages for every item.
+	if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
+	{
+		*pResult = CDRF_NOTIFYITEMDRAW;
+	}
+    else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
+	{
+        // This is the notification message for an item.  We'll request
+        // notifications before each subitem's prepaint stage.
+		
+		*pResult = CDRF_NOTIFYSUBITEMDRAW;
+	}
+    else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
+	{
+		CELLCOLOR cellclr;
+		int  nItem= static_cast<int>( pLVCD->nmcd.dwItemSpec );
+		BOOL bRtn = GetItemColor(nItem, pLVCD->iSubItem, &cellclr);
+
+		pLVCD->clrTextBk= clrBACK;
+		if(bRtn)
+		{
+			pLVCD->clrText	= cellclr.txtclr;
+			pLVCD->clrTextBk= cellclr.bkgclr;
+		}
+		else
+		{
+			pLVCD->clrText	= GetTextColor();
+			pLVCD->clrTextBk= GetTextBkColor();
+		}
+		if(	m_bTurnDraw && IsTurning(nItem, pLVCD->iSubItem))
+		{
+			pLVCD->clrText	= DIVCLR(cellclr.txtclr);
+			pLVCD->clrTextBk= DIVCLR(cellclr.bkgclr);
+		}
+		UpdateEdit(nItem, pLVCD->iSubItem);
+	}
+}
+
+void CCellCtrl::CopyClipboard()
+{
+	if(!(m_nClipOptin & clipCOPY))
+		return;
+
+	if(!OpenClipboard())
+		return;
+
+	EmptyClipboard();
+
+	int nSubItemCount=GetSubItemCount();
+	TCHAR* pBuff;
+	TCHAR* szDivide=_T("	");//TAB KEY
+	CString strCopyData="";
+	HGLOBAL hGlobal;
+	
+	POSITION pos=GetFirstSelectedItemPosition();
+	while(1)
+	{
+		if(!pos) break;
+		int nItem=GetNextSelectedItem(pos);
+
+		CString strText="";
+		for( int i=0; i<nSubItemCount; i++)
+			strText+=(GetItemText(nItem,i)+szDivide);
+
+		strText.TrimRight(szDivide);
+		strText+=_T("\r\n");
+		strCopyData+=strText;
+	}	
+
+	hGlobal = GlobalAlloc(GMEM_DDESHARE, strCopyData.GetLength()+1);
+	pBuff = (TCHAR*)GlobalLock(hGlobal);
+
+	wcscpy_s(pBuff, sizeof(*pBuff), (strCopyData));
+
+	GlobalUnlock(hGlobal);
+
+	SetClipboardData(CF_TEXT, hGlobal);
+	CloseClipboard();
+}
+
+void CCellCtrl::PasteClipboard()
+{
+	if(!(m_nClipOptin & clipPASTE))
+		return;
+
+	if ( !OpenClipboard() ) 
+		return;
+
+	int i=0,j=0;
+	int nRow=GetItemCount();
+	int nCol=GetSubItemCount();
+	TCHAR* szTab=_T("	");	//TAB KEY
+
+	CString strText="";
+	CString strPasteData="";
+
+	HANDLE hData = GetClipboardData( CF_TEXT );
+	strPasteData = (LPCSTR)GlobalLock( hData );
+
+	POSITION pos=GetFirstSelectedItemPosition();
+	if(!pos)	return;
+	int nItem=GetNextSelectedItem(pos);
+
+	while(1)
+	{
+		int nStart=0, nEnd=0;
+		int nFind = strPasteData.Find(_T("\r\n"));
+		if(nFind<0)	break;
+
+		strText = strPasteData.Left(nFind);
+		strPasteData.Delete(0, nFind+2);
+
+		nCol=0;
+		InsertItem(nItem,_T(""));
+
+		while((nEnd=strText.Find(szTab, nStart))>=0)
+		{
+			SetItemText(nItem, nCol++, strText.Mid(nStart, nEnd-nStart));
+			nStart=nEnd+1;
+		}
+
+		SetItemText(nItem, nCol, strText.Mid(nStart, nStart+256));
+		nItem++;
+	}
+
+	GlobalUnlock(hData);
+	CloseClipboard();
+}
+
+void CCellCtrl::CutClipboard()
+{
+	CopyClipboard();
+	SelectItemDelete();
+}
+
+void CCellCtrl::SelectItemDelete()
+{
+	if(!(m_nClipOptin & clipDELETE))
+		return;
+
+	ShowWindow(FALSE);
+	int nItem=GetItemCount()-1;
+	while(1)
+	{
+		if(nItem==-1) break;
+		nItem = GetNextItem(nItem, LVNI_ABOVE|LVNI_SELECTED);
+		DeleteItem(nItem);
+	}
+	ShowWindow(TRUE);
+}
+
+int CCellCtrl::GetHeadHeight()
+{
+	if(GetSafeHead())
+		return m_head.GetHeadHeight();
+	return 0;
+}
+
+int CCellCtrl::GetHeadItemCount()
+{
+	if(GetSafeHead())
+		return m_head.GetCount();
+	return 0;
+}
+
+void CCellCtrl::SetHeadItemCount(int nCount)
+{
+	if(GetSafeHead())
+	{
+		m_head.SetCount(nCount,GetFont());
+		Update(0);
+		Invalidate();
+	}
+}
+
+BOOL CCellCtrl::DeleteColumn( int nCol )
+{
+	if(GetSafeHead()) m_head.DeleteColumn(nCol);
+	return CListCtrl::DeleteColumn( nCol );
+}
+
+
+int CCellCtrl::InsertColumn(int nCol, LPCTSTR lpstTxt ,int nFormat, int nWidth, int nSubItem)
+{
+	int nRtn=CListCtrl::InsertColumn(nCol,lpstTxt,nFormat,nWidth,nSubItem);
+	if(GetSafeHead())
+	{
+		m_head.InsertColumn(nCol);
+		m_head.SetItemText(0, nCol, CT2A(lpstTxt));
+	}
+	return nRtn;
+}
+
+void CCellCtrl::SetHeadItemText(int nItem, int nSubItem, LPCTSTR lpstTxt)
+{
+	if(!GetSafeHead()) return;
+	m_head.SetItemText(nItem, nSubItem, CT2A(lpstTxt));
+}
+
+CString CCellCtrl::GetHeadItemText(int nItem, int nSubItem)
+{
+	if(!GetSafeHead()) return "";
+	return m_head.GetItemText(nItem, nSubItem);
+}
+
+void CCellCtrl::SetHeadItemMerge(int nsItem, int nsSubItem, int neItem, int neSubItem)
+{
+	if(!GetSafeHead()) return;
+	m_head.SetItemMerge(nsItem, nsSubItem, neItem, neSubItem);
+}
+
+int CCellCtrl::GetLeftSubItem()
+{
+	CRect rect;
+	int nSubItemCount = GetSubItemCount();
+	for( int i=0; i<nSubItemCount; i++)
+	{
+		if(i) GetSubItemRect(0,i,LVIR_BOUNDS,rect);
+		else  GetSubItemRect(0,i,LVIR_LABEL,rect);
+		if(rect.right>0)
+			return i;
+	}
+	return -1;
+}
+
+int CCellCtrl::GetRightSubItem()
+{
+	CRect rect,vRect;
+	GetClientRect(vRect);
+	int nSubItemCount = GetSubItemCount();
+	for( int i=GetLeftSubItem(); i<nSubItemCount; i++)
+	{
+		if(i) GetSubItemRect(0,i,LVIR_BOUNDS,rect);
+		else  GetSubItemRect(0,i,LVIR_LABEL,rect);
+
+		if(rect.left>vRect.right)
+			return i;
+	}
+	return nSubItemCount;
+}
+
+void CCellCtrl::OnTimer(UINT_PTR nIDEvent) 
+{
+	if(GetDlgCtrlID()!=(int)nIDEvent)
+		return;
+
+	if(m_bTurnDraw)	m_bTurnDraw=FALSE;
+	else			m_bTurnDraw=TRUE;
+
+	int nItemCnt = GetItemCount();
+
+	int nsItem=GetTopIndex();
+	int neItem=GetCountPerPage()+nsItem+1;
+
+	int nsSubI=GetLeftSubItem();
+	int neSubI=GetRightSubItem();
+
+	neItem= neItem < nItemCnt ? neItem:nItemCnt;
+
+	for( int i=nsItem; i<neItem; i++)
+	{
+		for( int j=nsSubI; j<neSubI; j++)
+		{
+			if(IsTurning(i,j))
+				UpdateCell(i, j);
+		}
+	}
+//	CListCtrl::OnTimer(nIDEvent);
+}
+void CCellCtrl::OnDestroy() 
+{
+	CListCtrl::OnDestroy();
+	KillTimer(GetDlgCtrlID());
+}
+
+//OnTimer
+//SetTimer甫 荤侩窍瘤 臼酒档 nIDEvent==45牢 Timer啊 扁夯栏肺 倒绊 乐促.(1檬林扁)
+//nIDEvent甫 Check窍瘤 臼栏搁 ...?
+
+void CCellCtrl::SaveFile()
+{
+	CFileDialog fileDlg( FALSE, NULL, NULL,
+						OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT,
+						_T("Excel Data Files (*.csv)|*.csv||"), this );
+
+	if(fileDlg.DoModal()!=IDOK)
+		return;
+
+	//颇老 捞抚阑 啊廉柯促.
+	CString filename = fileDlg.GetFileName();
+	CString extname = fileDlg.GetFileExt();
+	extname.MakeLower();
+
+	//颇老狼 犬厘疙捞 乐绰瘤 眉农
+	if(extname.IsEmpty() || extname!="csv")
+		filename+=".csv";
+
+	CFile wfile(filename, 
+				CFile::modeCreate | 
+//				CFile::modeNoTruncate | 
+				CFile::modeWrite | 
+				CFile::typeBinary);
+
+	CArchive ar(&wfile, CArchive::store);
+	Serialize(ar);
+}
+
+void CCellCtrl::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if (m_bCanEdit)
+	{
+		if (m_edLct.nItem > 0 || m_edLct.nSubItem > 0)
+		{
+			IsModifyEdit(m_edLct.nItem, m_edLct.nSubItem);
+			UpdateCell(m_edLct.nItem, m_edLct.nSubItem);
+		}
+
+		LVHITTESTINFO pItem;
+		pItem.pt = point;
+		int test = SubItemHitTest(&pItem);
+
+		int nCol,nRow;
+		nRow = pItem.iItem;
+		nCol = pItem.iSubItem;
+
+		if(nRow != -1 && nCol != -1)
+			UseEdit(nRow, nCol);
+		else
+			m_edit.ShowWindow(FALSE);
+	}
+
+	CListCtrl::OnLButtonDown(nFlags, point);
+}
diff --git a/Common_Class/SISControls/ColorButton.cpp b/Common_Class/SISControls/ColorButton.cpp
new file mode 100644
index 0000000..2c019fd
--- /dev/null
+++ b/Common_Class/SISControls/ColorButton.cpp
@@ -0,0 +1,383 @@
+// ColorButton.cpp : implementation file
+//
+// Written by Marius Bancila (mbancila@yahoo.com)
+// Copyright (c) 2004.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name is included. If 
+// the source code in  this file is used in any commercial application 
+// then acknowledgement must be made to the author of this file 
+// (in whatever form you wish).
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
+// IN THE SOFTWARE.
+// 
+// Please use and enjoy. Please let me know of any bugs/mods/improvements 
+// that you have found/implemented and I will fix/incorporate them into this
+// file. 
+
+#include "stdafx.h"
+#include "ColorButton.h"
+
+#include <afxtempl.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+namespace clr
+{
+	const COLORREF CLR_BTN_WHITE  = RGB(255, 255, 255);
+	const COLORREF CLR_BTN_BLACK  = RGB(0, 0, 0);
+	const COLORREF CLR_BTN_DGREY  = RGB(128, 128, 128);
+	const COLORREF CLR_BTN_GREY   = RGB(192, 192, 192);
+	const COLORREF CLR_BTN_LLGREY = RGB(223, 223, 223);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CColorButton
+CColorButton::CColorButton()
+{
+	SetColorToWindowsDefault();
+}
+
+CColorButton::CColorButton(COLORREF text, COLORREF bkgnd)
+{
+	m_TextColor				= text;
+	m_BkgndColor			= bkgnd; 
+	m_DisabledBkgndColor	= GetSysColor(COLOR_BTNFACE);
+	m_Light					= GetSysColor(COLOR_3DLIGHT);
+	m_Highlight				= GetSysColor(COLOR_BTNHIGHLIGHT);
+	m_Shadow				= GetSysColor(COLOR_BTNSHADOW);
+	m_DarkShadow			= GetSysColor(COLOR_3DDKSHADOW);	
+}
+
+CColorButton::CColorButton(COLORREF text, COLORREF bkgnd, COLORREF disabled)
+{
+	m_TextColor				= text;
+	m_BkgndColor			= bkgnd; 
+	m_DisabledBkgndColor	= disabled;
+	m_Light					= GetSysColor(COLOR_3DLIGHT);
+	m_Highlight				= GetSysColor(COLOR_BTNHIGHLIGHT);
+	m_Shadow				= GetSysColor(COLOR_BTNSHADOW);
+	m_DarkShadow			= GetSysColor(COLOR_3DDKSHADOW);	
+}
+
+CColorButton::CColorButton(COLORREF text, COLORREF bkgnd, COLORREF disabled, COLORREF light, COLORREF highlight, COLORREF shadow, COLORREF darkShadow)
+{
+	m_TextColor				= text;
+	m_BkgndColor			= bkgnd; 
+	m_DisabledBkgndColor	= disabled;
+	m_Light					= light;
+	m_Highlight				= highlight;
+	m_Shadow				= shadow;
+	m_DarkShadow			= darkShadow;
+}
+
+CColorButton::~CColorButton()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CColorButton, CButton)
+	//{{AFX_MSG_MAP(CColorButton)
+	ON_WM_CREATE()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CColorButton message handlers
+
+void CColorButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
+{
+	CDC		*pDC;
+	CRect	rcFocus, rcButton, rcText, rcOffsetText;
+	UINT	state;
+	
+	pDC    = CDC::FromHandle(lpDrawItemStruct->hDC);
+	state = lpDrawItemStruct->itemState;
+	
+	rcFocus.CopyRect(&lpDrawItemStruct->rcItem); 
+	rcButton.CopyRect(&lpDrawItemStruct->rcItem); 
+	
+	rcText = rcButton;
+	rcText.OffsetRect(-1, -1);
+
+	rcOffsetText = rcText;
+	rcOffsetText.OffsetRect(1, 1);
+	
+	// Set the focus rectangle to just past the border decoration
+	rcFocus.left   += 4;
+    rcFocus.right  -= 4;
+    rcFocus.top    += 4;
+    rcFocus.bottom -= 4;
+	
+	// Retrieve the button's caption
+	CString strCaption;
+	GetWindowText(strCaption);
+	
+	if (state & ODS_DISABLED)
+    {
+		DrawFilledRect(pDC, rcButton, m_DisabledBkgndColor);
+	}
+	else
+	{
+		DrawFilledRect(pDC, rcButton, m_BkgndColor);
+	}
+	
+	if (state & ODS_SELECTED)
+	{ 
+		DrawFrame(pDC, rcButton, BUTTON_IN);
+	}
+	else
+	{
+		if ((state & ODS_DEFAULT) || (state & ODS_FOCUS))
+		{
+			DrawFrame(pDC, rcButton, BUTTON_OUT | BUTTON_BLACK_BORDER);			
+		}
+		else
+		{
+			DrawFrame(pDC, rcButton, BUTTON_OUT);
+		}
+	}
+	
+	if (state & ODS_DISABLED)
+	{
+		DrawButtonText(pDC, rcOffsetText, strCaption, clr::CLR_BTN_WHITE);
+		DrawButtonText(pDC, rcText,	strCaption, clr::CLR_BTN_DGREY);
+    }
+	else
+	{
+		if (state & ODS_SELECTED)
+		{
+			DrawButtonText(pDC, rcOffsetText, strCaption, m_TextColor);
+		}
+		else
+		{
+			DrawButtonText(pDC, rcText, strCaption, m_TextColor);
+		}
+	}
+	
+	if (state & ODS_FOCUS)
+	{
+		DrawFocusRect(lpDrawItemStruct->hDC, (LPRECT)&rcFocus);
+	}	
+}
+
+void CColorButton::DrawFrame(CDC *pDC, CRect rc, int state)
+{
+	COLORREF color;
+	
+	if (state & BUTTON_BLACK_BORDER)
+	{
+		color = clr::CLR_BTN_BLACK;
+		
+		DrawLine(pDC, rc.left, rc.top, rc.right, rc.top,    color); // Across top
+		DrawLine(pDC, rc.left, rc.top, rc.left,  rc.bottom, color); // Down left
+		
+		DrawLine(pDC, rc.left,      rc.bottom - 1, rc.right,     rc.bottom - 1, color); // Across bottom
+		DrawLine(pDC, rc.right - 1, rc.top,        rc.right - 1, rc.bottom,     color); // Down right
+		
+		rc.InflateRect(-1, -1);
+	}
+	
+	if (state & BUTTON_OUT)
+	{
+		color = m_Highlight;
+		
+		DrawLine(pDC, rc.left, rc.top, rc.right, rc.top,    color); // Across top
+		DrawLine(pDC, rc.left, rc.top, rc.left,  rc.bottom, color); // Down left
+		
+		color = m_DarkShadow;
+		
+		DrawLine(pDC, rc.left,      rc.bottom - 1, rc.right,     rc.bottom - 1, color); // Across bottom
+		DrawLine(pDC, rc.right - 1, rc.top,        rc.right - 1, rc.bottom,     color); // Down right
+		
+		rc.InflateRect(-1, -1);
+		
+		color = m_Light;
+		
+		DrawLine(pDC, rc.left, rc.top, rc.right, rc.top,    color); // Across top
+		DrawLine(pDC, rc.left, rc.top, rc.left,  rc.bottom, color); // Down left
+		
+		color = m_Shadow;
+		
+		DrawLine(pDC, rc.left,      rc.bottom - 1, rc.right,     rc.bottom - 1, color); // Across bottom
+		DrawLine(pDC, rc.right - 1, rc.top,        rc.right - 1, rc.bottom,     color); // Down right
+	}
+	
+	if (state & BUTTON_IN)
+	{
+		color = m_DarkShadow;
+		
+		DrawLine(pDC, rc.left, rc.top, rc.right, rc.top,    color); // Across top
+		DrawLine(pDC, rc.left, rc.top, rc.left,  rc.bottom, color); // Down left
+		DrawLine(pDC, rc.left,      rc.bottom - 1, rc.right,     rc.bottom - 1, color); // Across bottom
+		DrawLine(pDC, rc.right - 1, rc.top,        rc.right - 1, rc.bottom,     color); // Down right
+		
+		rc.InflateRect(-1, -1);
+		
+		color = m_Shadow;
+		
+		DrawLine(pDC, rc.left, rc.top, rc.right, rc.top,    color); // Across top
+		DrawLine(pDC, rc.left, rc.top, rc.left,  rc.bottom, color); // Down left
+		DrawLine(pDC, rc.left,      rc.bottom - 1, rc.right,     rc.bottom - 1, color); // Across bottom
+		DrawLine(pDC, rc.right - 1, rc.top,        rc.right - 1, rc.bottom,     color); // Down right
+	}
+}
+
+void CColorButton::DrawFilledRect(CDC *pDC, CRect rc, COLORREF color)
+{
+	CBrush brSolid;
+	
+	brSolid.CreateSolidBrush(color);
+	pDC->FillRect(rc, &brSolid);
+}
+
+void CColorButton::DrawLine(CDC *pDC, long sx, long sy, long ex, long ey, COLORREF color)
+{
+	CPen newPen;
+	CPen *oldPen;
+	
+	newPen.CreatePen(PS_SOLID, 1, color);
+	oldPen = pDC->SelectObject(&newPen);
+
+	pDC->MoveTo(sx, sy);
+	pDC->LineTo(ex, ey);
+	pDC->SelectObject(oldPen);
+
+    newPen.DeleteObject();	
+}
+
+void CColorButton::DrawButtonText(CDC *pDC, CRect rc, CString strCaption, COLORREF textcolor)
+{
+	DWORD uStyle = GetWindowLong(this->m_hWnd,GWL_STYLE);
+
+	CArray<CString, CString> arLines;
+
+	if((uStyle & BS_MULTILINE) == BS_MULTILINE)
+	{
+		int nIndex = 0;
+		while(nIndex != -1)
+		{
+			nIndex = strCaption.Find('\n');
+			if(nIndex>-1)
+			{
+				CString line = strCaption.Left(nIndex);
+				arLines.Add(line);
+				strCaption.Delete(0,nIndex+1);
+			}
+			else
+				arLines.Add(strCaption);
+		}
+	}
+	else
+	{
+		arLines.Add(strCaption);
+	}
+
+	CSize sizeText = pDC->GetOutputTextExtent( strCaption );
+	
+    COLORREF oldColour;
+	
+	oldColour = pDC->SetTextColor(textcolor);
+	pDC->SetBkMode(TRANSPARENT);
+	
+	int nStartPos = (rc.Height() - static_cast<int>(arLines.GetSize())*sizeText.cy)/2-1;
+	if((uStyle & BS_TOP) == BS_TOP)
+		nStartPos = rc.top+2;
+	if((uStyle & BS_BOTTOM) == BS_BOTTOM)
+		nStartPos = rc.bottom- static_cast<int>(arLines.GetSize())*sizeText.cy-2;
+	if((uStyle & BS_VCENTER) == BS_VCENTER)
+		nStartPos = (rc.Height() - static_cast<int>(arLines.GetSize())*sizeText.cy)/2-1;
+	
+	UINT uDrawStyles = 0;
+	if((uStyle & BS_CENTER) == BS_CENTER)
+		uDrawStyles |= DT_CENTER;
+	else
+	{
+		if((uStyle & BS_LEFT) == BS_LEFT)
+			uDrawStyles |= DT_LEFT;
+		else
+		if((uStyle & BS_RIGHT) == BS_RIGHT)
+			uDrawStyles |= DT_RIGHT;
+		else
+		if(uDrawStyles == 0)
+			uDrawStyles = DT_CENTER|DT_VCENTER | DT_SINGLELINE;
+	}
+	
+	for(int i=0; i<arLines.GetSize(); i++)
+	{
+		CRect textrc = rc;
+		textrc.DeflateRect(3,0,3,0);
+		textrc.top = nStartPos + sizeText.cy*i;
+		textrc.bottom = nStartPos + sizeText.cy*(i+1);
+		CString line = arLines.GetAt(i);
+		pDC->DrawText(line, line.GetLength(), textrc, uDrawStyles);
+	}
+
+	pDC->SetTextColor(oldColour);
+}
+
+void CColorButton::SetColor(COLORREF text, COLORREF bkgnd)
+{
+	m_TextColor				= text;
+	m_BkgndColor			= bkgnd; 
+
+	if(m_hWnd != NULL)
+		Invalidate();
+}
+
+void CColorButton::SetColor(COLORREF text, COLORREF bkgnd, COLORREF disabled)
+{
+	m_TextColor				= text;
+	m_BkgndColor			= bkgnd; 
+	m_DisabledBkgndColor	= disabled;
+
+	if(m_hWnd != NULL)
+		Invalidate();
+}
+
+void CColorButton::SetColor(COLORREF text, COLORREF bkgnd, COLORREF disabled, COLORREF light, COLORREF highlight, COLORREF shadow, COLORREF darkShadow)
+{
+	m_TextColor				= text;
+	m_BkgndColor			= bkgnd; 
+	m_DisabledBkgndColor	= disabled;
+	m_Light					= light;
+	m_Highlight				= highlight;
+	m_Shadow				= shadow;
+	m_DarkShadow			= darkShadow;
+
+	if(m_hWnd != NULL)
+		Invalidate();
+}
+
+void CColorButton::SetColorToWindowsDefault()
+{
+	m_TextColor				= GetSysColor(COLOR_BTNTEXT);
+	m_BkgndColor			= GetSysColor(COLOR_BTNFACE); 
+	m_DisabledBkgndColor	= GetSysColor(COLOR_BTNFACE);
+	m_Light					= GetSysColor(COLOR_3DLIGHT);
+	m_Highlight				= GetSysColor(COLOR_BTNHIGHLIGHT);
+	m_Shadow				= GetSysColor(COLOR_BTNSHADOW);
+	m_DarkShadow			= GetSysColor(COLOR_3DDKSHADOW);	
+}
+
+int CColorButton::OnCreate(LPCREATESTRUCT lpCreateStruct) 
+{
+	lpCreateStruct->dwExStyle |= BS_OWNERDRAW;
+
+	if (CButton::OnCreate(lpCreateStruct) == -1)
+		return -1;
+	
+	return 0;
+}
diff --git a/Common_Class/SISControls/DefectMap.cpp b/Common_Class/SISControls/DefectMap.cpp
new file mode 100644
index 0000000..7c5eb39
--- /dev/null
+++ b/Common_Class/SISControls/DefectMap.cpp
@@ -0,0 +1,354 @@
+// DefectMap.cpp: implementation of the CDefectMap class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "DefectMap.h"
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#define ID_TIMER_BLINK		9001
+
+CDefectMap::CDefectMap()
+{
+	m_pParentWnd			= NULL;
+	m_nMapWidth				= 0;
+	m_nMapHeight			= 0;
+	
+	m_OriginDir				= OD_LeftBottom;
+	m_nUnitSize				= 0;
+	
+	m_bShowShot				= FALSE;
+	
+	m_hDrawingSurface		= NULL;
+	m_RectDrawingSurface	= CRect(0, 0, 0, 0);
+	memset(&m_BMIH, 0, sizeof(BITMAPINFOHEADER));
+	m_pDrawingSurfaceBits	= NULL;
+	
+	m_dRatio				= 1.0;
+	m_RectWnd.SetRect(0, 0, 0, 0);
+	m_RectMap.SetRect(0, 0, 0, 0);
+	m_PointWindowStart.x	= 0;
+	m_PointWindowStart.y	= 0;
+	m_bDragMove				= FALSE;
+	m_bIsMiniMap			= FALSE;
+	m_PointGlassStart.x		= 0;
+	m_PointGlassStart.y		= 0;
+	m_PointGlassEnd.x		= 0;
+	m_PointGlassEnd.y		= 0;
+	m_nCoordGabX			= 2;
+	m_nCoordGabY			= 2;
+	
+	m_nCCutSize				= 20;
+
+	m_dWidthRatio			= 0.;
+	m_dHeightRatio			= 0.;
+}
+
+CDefectMap::~CDefectMap()
+{
+	DeinitGlass();
+}
+
+BEGIN_MESSAGE_MAP(CDefectMap, CStatic)
+//{{AFX_MSG_MAP(CDefectMap)
+ON_WM_PAINT()
+ON_WM_TIMER()
+ON_WM_LBUTTONDBLCLK()
+ON_WM_LBUTTONDOWN()
+ON_WM_RBUTTONDOWN()
+ON_WM_LBUTTONUP()
+ON_WM_MOUSEMOVE()
+//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+void CDefectMap::InitGlass(CWnd* pParent, int nMapWidth, int nMapHeight, int nMapMargin)
+{
+	if (!pParent || nMapWidth <= 0 || nMapHeight <= 0)
+		return;
+	
+	m_pParentWnd = pParent;
+	m_nMapWidth = nMapWidth;
+	m_nMapHeight = nMapHeight;
+	
+	GetClientRect(m_RectWnd);
+	
+	m_nUnitSize = m_nMapWidth / m_RectWnd.Width();	
+	
+	m_dWidthRatio = static_cast<double>(m_RectWnd.Width())/static_cast<double>(m_nMapWidth);
+	m_dHeightRatio = static_cast<double>(m_RectWnd.Height())/static_cast<double>(m_nMapHeight);	
+	
+	m_RectMap.SetRect(0, 0, m_nMapWidth, m_nMapHeight);		
+	
+	// Review Map 历厘阑 困茄 霖厚
+	GetWindowRect(&m_RectDrawingSurface);
+	ScreenToClient(&m_RectDrawingSurface);
+	CDC* pDC = GetDC();
+	if(pDC != NULL)
+	{
+		// 20101019 Bugfix 措冠..-_-  咯扁啊 啊惑皋葛府 穿荐狼 林裹. ( 饭矫乔 眉牢瘤矫 皋葛府 穿遏 何盒 ) 
+		if( m_hDrawingSurface != NULL )
+		{
+			::DeleteObject(m_hDrawingSurface);
+			m_hDrawingSurface = NULL;
+		}
+
+		m_BMIH.biSize = sizeof(BITMAPINFOHEADER);
+		m_BMIH.biBitCount = 24;
+		m_BMIH.biPlanes = 1;
+		m_BMIH.biCompression = BI_RGB;
+		m_BMIH.biWidth = m_RectDrawingSurface.Width();
+		m_BMIH.biHeight = m_RectDrawingSurface.Height();
+		m_BMIH.biSizeImage = ((((m_BMIH.biWidth * m_BMIH.biBitCount) + 31) & ~31) >> 3) * m_BMIH.biHeight;
+		m_hDrawingSurface = CreateDIBSection(pDC->GetSafeHdc(), (CONST BITMAPINFO*)&m_BMIH, DIB_RGB_COLORS
+			, (void**)&m_pDrawingSurfaceBits, NULL, 0);
+		ReleaseDC(pDC);
+	}	
+}
+
+void CDefectMap::DeinitGlass()
+{
+	if (m_hDrawingSurface != NULL)
+	{
+		DeleteObject(m_hDrawingSurface);
+		m_hDrawingSurface = NULL;
+	}
+}
+
+void CDefectMap::IncreaseRatio()
+{
+	if (!m_bIsMiniMap)
+	{
+		m_dRatio = m_dRatio + 0.5;
+		if (m_dRatio > 4.0)
+			m_dRatio = 4.0;
+		
+		// 啊款单甫 扁霖栏肺 颗变促.
+		m_PointWindowStart.x = static_cast<int>((m_RectWnd.right * m_dRatio - m_RectWnd.Width()) / 2) * -1;
+		m_PointWindowStart.y = static_cast<int>((m_RectWnd.bottom * m_dRatio - m_RectWnd.Height()) / 2) * -1;
+		
+		// 康开捞 哈绢唱瘤 臼档废 抗寇贸府.
+		if (m_PointWindowStart.x > 0)
+			m_PointWindowStart.x = 0;
+		else if (m_PointWindowStart.x < m_RectWnd.right * m_dRatio * -1 + m_RectWnd.Width())
+			m_PointWindowStart.x = static_cast<int>(m_RectWnd.right * m_dRatio) * -1 + m_RectWnd.Width();
+		if (m_PointWindowStart.y > 0)
+			m_PointWindowStart.y = 0;
+		else if (m_PointWindowStart.y < m_RectWnd.bottom * m_dRatio * -1 + m_RectWnd.Height())
+			m_PointWindowStart.y = static_cast<int>(m_RectWnd.bottom * m_dRatio) * -1 + m_RectWnd.Height();
+		
+	//	m_PointGlassStart = SetWindowToGlass(CPoint(0, 0));
+	//	m_PointGlassEnd = SetWindowToGlass(CPoint(m_RectWnd.right, m_RectWnd.bottom));
+		
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_CHANGED, 0, 0);
+		
+		Invalidate();
+	}
+}
+
+void CDefectMap::DecreaseRatio()
+{
+	if (!m_bIsMiniMap)
+	{
+		m_dRatio = m_dRatio - 0.5;
+		if (m_dRatio < 1)
+			m_dRatio = 1.0;
+		
+		// 啊款单甫 扁霖栏肺 颗变促.
+		m_PointWindowStart.x = static_cast<int>((m_RectWnd.right * m_dRatio - m_RectWnd.Width()) / 2) * -1;
+		m_PointWindowStart.y = static_cast<int>((m_RectWnd.bottom * m_dRatio - m_RectWnd.Height()) / 2) * -1;
+		
+		// 康开捞 哈绢唱瘤 臼档废 抗寇贸府.
+		if (m_PointWindowStart.x > 0)
+			m_PointWindowStart.x = 0;
+		else if (m_PointWindowStart.x < m_RectWnd.right * m_dRatio * -1 + m_RectWnd.Width())
+			m_PointWindowStart.x = static_cast<int>(m_RectWnd.right * m_dRatio) * -1 + m_RectWnd.Width();
+		if (m_PointWindowStart.y > 0)
+			m_PointWindowStart.y = 0;
+		else if (m_PointWindowStart.y < m_RectWnd.bottom * m_dRatio * -1 + m_RectWnd.Height())
+			m_PointWindowStart.y = static_cast<int>(m_RectWnd.bottom * m_dRatio) * -1 + m_RectWnd.Height();
+		
+	//	m_PointGlassStart = SetWindowToGlass(CPoint(0, 0));
+	//	m_PointGlassEnd = SetWindowToGlass(CPoint(m_RectWnd.right, m_RectWnd.bottom));
+		
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_CHANGED, 0, 0);
+		
+		Invalidate();
+	}
+}
+
+void CDefectMap::ResetRatio()
+{
+	if (!m_bIsMiniMap)
+	{
+		m_dRatio = 1.0;
+		
+		m_PointWindowStart.x = 0;
+		m_PointWindowStart.y = 0;
+		
+//		m_PointGlassStart = SetWindowToGlass(CPoint(0, 0));
+	//	m_PointGlassEnd = SetWindowToGlass(CPoint(m_RectWnd.right, m_RectWnd.bottom));
+		
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_CHANGED, 0, 0);
+		
+		Invalidate();
+	}
+}
+
+void CDefectMap::SetDisplayRect(CPoint& PointStart, CPoint& PointEnd)
+{
+	m_PointGlassStart = PointStart;
+	m_PointGlassEnd = PointEnd;
+}
+
+void CDefectMap::OnPaint() 
+{
+	CPaintDC dc(this); // device context for painting
+
+
+	DrawGlass(&dc);
+
+	// 焊咯林扁 康开 荤阿屈 弊府扁.
+	if (m_bIsMiniMap)
+	{
+		CBrush BrushDisplay;
+		CPen PenShow(PS_SOLID, 1, RGB(255,0,0));
+		CPen* pOldPen = (CPen*)dc.SelectObject(&PenShow);
+		BrushDisplay.CreateStockObject(NULL_BRUSH);
+		CBrush* pOldBrush = (CBrush*)dc.SelectObject(&BrushDisplay);
+		dc.Rectangle(CRect(m_PointGlassStart.x + m_RectMap.left, m_PointGlassStart.y + m_RectMap.top
+			, m_PointGlassEnd.x + m_RectMap.left, m_PointGlassEnd.y + m_RectMap.top));
+		dc.SelectObject(pOldPen);
+		dc.SelectObject(pOldBrush);
+	}
+}
+
+void CDefectMap::OnLButtonDblClk(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	MouseLBtnDblClk(point);
+
+	CStatic::OnLButtonDblClk(nFlags, point);
+}
+
+void CDefectMap::OnRButtonDown(UINT nFlags, CPoint point)
+{
+	MouseRBtnDwn(point);
+
+	CStatic::OnRButtonDown(nFlags, point);
+}
+
+void CDefectMap::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	m_bDragMove = TRUE;
+	m_PointDragStart = point;
+	MouseLBtnDwn(point);
+
+	CStatic::OnLButtonDown(nFlags, point);
+}
+
+void CDefectMap::OnLButtonUp(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	m_bDragMove = FALSE;
+	MouseLBtnUp(point);
+
+	CStatic::OnLButtonUp(nFlags, point);
+}
+
+void CDefectMap::OnMouseMove(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	
+	MouseLBtnMove(point);
+
+	CStatic::OnMouseMove(nFlags, point);
+}
+
+void CDefectMap::OnTimer(UINT_PTR nIDEvent) 
+{
+	// TODO: Add your message handler code here and/or call default
+	Timer(nIDEvent);
+
+	CStatic::OnTimer(nIDEvent);
+}
+
+void CDefectMap::SaveMapToFile(CString strFileName) 
+{
+	FILE *pFile;
+	_wfopen_s(&pFile, strFileName, _T("wb"));
+	if(pFile == NULL)
+		return;	
+
+	BITMAPFILEHEADER bmfh;	
+	int nBitsOffset = sizeof(BITMAPFILEHEADER) + m_BMIH.biSize; 
+	LONG lImageSize = m_BMIH.biSizeImage;
+	LONG lFileSize = nBitsOffset + lImageSize;
+	bmfh.bfType = 'B'+('M'<<8);			
+	bmfh.bfOffBits = nBitsOffset;		
+	bmfh.bfSize = lFileSize;				
+	bmfh.bfReserved1 = bmfh.bfReserved2 = 0;
+	//Write the bitmap file header
+	UINT nWrittenFileHeaderSize = static_cast<UINT>(fwrite(&bmfh, 1, sizeof(BITMAPFILEHEADER), pFile));
+	//And then the bitmap info header
+	UINT nWrittenInfoHeaderSize = static_cast<UINT>(fwrite(&m_BMIH, 1, sizeof(BITMAPINFOHEADER), pFile));
+	//Finally, write the image data itself -- the data represents our drawing
+	UINT nWrittenDIBDataSize = static_cast<UINT>(fwrite(m_pDrawingSurfaceBits, 1, lImageSize, pFile));
+	
+	fclose(pFile);
+}
+
+void CDefectMap::ConvertGlassToView(CRect &rect)
+{
+	if(m_dWidthRatio <= 0 || m_dHeightRatio <= 0)
+		return;
+	
+	rect.left = static_cast<int>(static_cast<double>(rect.left)*m_dWidthRatio);
+	rect.right = static_cast<int>(static_cast<double>(rect.right)*m_dWidthRatio);
+	rect.top = static_cast<int>(static_cast<double>(rect.top)*m_dHeightRatio);
+	rect.bottom = static_cast<int>(static_cast<double>(rect.bottom)*m_dHeightRatio);
+}
+
+void CDefectMap::ConvertGlassToView(CPoint &pt)
+{
+	if(m_dWidthRatio <= 0 || m_dHeightRatio <= 0)
+		return;
+	
+	pt.x = static_cast<int>(static_cast<double>(pt.x)*m_dWidthRatio);	
+	pt.y = static_cast<int>(static_cast<double>(pt.y)*m_dHeightRatio);	
+}
+
+CPoint CDefectMap::ConvertViewToGlass(CPoint &pt)
+{
+	if(m_dWidthRatio <= 0 || m_dHeightRatio <= 0)
+		return pt;
+	
+	pt.x = static_cast<int>(static_cast<double>(pt.x)/m_dWidthRatio);	
+	pt.y = static_cast<int>(static_cast<double>(pt.y)/m_dHeightRatio);
+	
+	return pt;
+}
+
+CRect CDefectMap::ConvertViewToGlass(CRect &rect)
+{
+	if(m_dWidthRatio <= 0 || m_dHeightRatio <= 0)
+		return rect;
+	
+	rect.left = static_cast<int>(static_cast<double>(rect.left)/m_dWidthRatio);
+	rect.right = static_cast<int>(static_cast<double>(rect.right)/m_dWidthRatio);
+	rect.top = static_cast<int>(static_cast<double>(rect.top)/m_dHeightRatio);
+	rect.bottom = static_cast<int>(static_cast<double>(rect.bottom)/m_dHeightRatio);
+	
+	return rect;
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/FontStatic.cpp b/Common_Class/SISControls/FontStatic.cpp
new file mode 100644
index 0000000..ffb4bca
--- /dev/null
+++ b/Common_Class/SISControls/FontStatic.cpp
@@ -0,0 +1,197 @@
+// FontStatic.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "FontStatic.h"
+
+
+// CFontStatic
+IMPLEMENT_DYNAMIC(CFontStatic, CStatic)
+
+CFontStatic::CFontStatic()
+{
+	// Set the font style
+	m_bBold = false;
+	m_bItalic = false;
+	m_bUnderlined = false;
+	m_bStrikethrough = false;
+	m_bAntialias = false;
+
+	// Set the horizontal alignment
+	m_bCenter = true;
+	m_bLeft = false;
+	m_bRight = false;
+
+	// Set default font
+	m_bBgColor = false;
+	m_nSize = 10;
+	m_dwColor = RGB(0,0,0);
+	m_szFont=_T("MS Sans Serif");
+	m_szText = _T("");
+}
+
+CFontStatic::~CFontStatic()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+BEGIN_MESSAGE_MAP(CFontStatic, CStatic)
+	//{{AFX_MSG_MAP(CFontStatic)
+	//}}AFX_MSG_MAP
+	ON_WM_PAINT()
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+
+void CFontStatic::PreSubclassWindow() 
+{
+	ModifyStyle(0, SS_NOTIFY, TRUE);
+	CStatic::PreSubclassWindow();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void CFontStatic::OnPaint() 
+{
+	CFont fFont;
+	CFont *fOldFont;
+	int nWeight;
+	CPaintDC dc(this);
+	DWORD dwQuality;
+	CRect rect;
+	UINT unFormat=0;
+
+	// Get the client rect
+	this->GetClientRect(rect);
+
+	// Set the background
+	if(m_bBgColor)
+		dc.FillSolidRect(rect,m_dwBgColor);
+	else
+		dc.FillSolidRect(rect,GetSysColor(COLOR_3DFACE));
+
+	// Set the text-color and background
+	dc.SetTextColor(m_dwColor);
+	dc.SetBkMode(TRANSPARENT);
+
+	// Determine the weight of the font
+	if(m_bBold)
+		nWeight = FW_BLACK;
+	else
+		nWeight = FW_NORMAL;
+
+	// Set the quality of the font
+	if(m_bAntialias)
+		dwQuality = ANTIALIASED_QUALITY;
+	else
+		dwQuality = DEFAULT_QUALITY;
+
+	// Set no prefix and wordwrapping
+	unFormat|=DT_SINGLELINE;//DT_NOPREFIX
+	unFormat|=DT_WORDBREAK;
+	unFormat|=DT_VCENTER;
+
+	// Set the horizontal alignment
+	if(m_bCenter)
+		unFormat|=DT_CENTER;
+	else if(m_bRight)
+		unFormat|=DT_RIGHT;
+	else if(m_bLeft)
+		unFormat|=DT_LEFT;
+
+	// Create the font
+	fFont.Detach();
+	if(fFont.CreateFont(m_nSize,0,0,0, nWeight ,m_bItalic, m_bUnderlined, m_bStrikethrough, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, BYTE(dwQuality), DEFAULT_PITCH | FF_DONTCARE, m_szFont)!=NULL)
+	{
+		fOldFont = dc.SelectObject(&fFont);
+		dc.DrawText(m_szText,rect,unFormat);
+	}
+	else
+		AfxMessageBox(_T("Font could not be created!"));
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void CFontStatic::SetFontStyle(DWORD dwStyle)
+{
+	// Set the style of the static
+	if(dwStyle&FS_BOLD)
+		m_bBold = true;
+	if(dwStyle&FS_ITALIC)
+		m_bItalic = true;
+	if(dwStyle&FS_UNDERLINED)
+		m_bUnderlined = true;
+	if(dwStyle&FS_STRIKETHROUGH)
+		m_bStrikethrough = true;
+	if(dwStyle&FS_ANTIALIAS)
+		m_bAntialias = true;
+	if(dwStyle&FS_NORMAL)
+	{
+		// This will (even if it's combined with other defines) 
+		// set all styles to false.
+
+		m_bBold = false;
+		m_bItalic = false;
+		m_bUnderlined = false;
+		m_bStrikethrough = false;
+		m_bAntialias = false;
+		m_bCenter = false;
+		m_bLeft = true;
+		m_bRight = false;
+	}
+
+	// Set all alignments to false
+	m_bCenter = true;
+	m_bLeft = false;
+	m_bRight = false;
+
+	// Set the horizontal alignment
+	if(dwStyle&FS_CENTER)
+		m_bCenter = true;
+	else if(dwStyle&FS_RIGHT)
+		m_bRight = true;
+	else if(dwStyle&FS_LEFT)
+		m_bLeft = true;
+	else
+		m_bLeft = true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void CFontStatic::SetBackground(DWORD dwBgColor)
+{
+	// Set the background color
+	m_dwBgColor = dwBgColor;
+	m_bBgColor = true;
+	Invalidate(TRUE);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void CFontStatic::SetFontStatic(CString szFont, int nSize, DWORD dwColor, DWORD dwStyle)
+{
+	// Set the font, size and color.
+	m_szFont = szFont;
+	m_nSize = nSize;
+	m_dwColor = dwColor;
+
+	// Set the style
+	SetFontStyle(dwStyle);
+}
+
+void CFontStatic::SetWindowText(LPCTSTR a_lpstr)
+{
+	m_szText = a_lpstr;
+	
+	Invalidate(TRUE);
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+// CFontStatic 皋矫瘤 贸府扁涝聪促.
+
+
diff --git a/Common_Class/SISControls/GradientStatic.cpp b/Common_Class/SISControls/GradientStatic.cpp
new file mode 100644
index 0000000..b4e8abd
--- /dev/null
+++ b/Common_Class/SISControls/GradientStatic.cpp
@@ -0,0 +1,341 @@
+// GradientStatic.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "GradientStatic.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+// CGradientStatic
+#define ID_TIMER_ANIMATION_CONTROL 1
+IMPLEMENT_DYNAMIC(CGradientStatic, CStatic)
+
+CGradientStatic::CGradientStatic()
+{
+	m_bVertical = FALSE;
+	m_iLeftSpacing = 10;
+	clLeft = GetSysColor(COLOR_ACTIVECAPTION);
+	clRight = GetSysColor(COLOR_BTNFACE);
+	clText = GetSysColor(COLOR_CAPTIONTEXT);
+	clOut1 = RGB(160, 160, 160);
+	clOut2 = RGB(0, 255, 0);
+	
+	m_iAlign = 0;
+
+	hinst_msimg32 = LoadLibrary( _T("msimg32.dll") );
+
+	m_bCanDoGradientFill = FALSE;
+		
+	if(hinst_msimg32)
+	{
+		m_bCanDoGradientFill = TRUE;		
+		dllfunc_GradientFill = ((LPFNDLLFUNC1) GetProcAddress( hinst_msimg32, "GradientFill" ));
+	}
+	
+	m_sTEXT = _T("");
+	m_bDrawOutLine = FALSE;
+	m_nAniColorCount = 1;
+	m_enAnimation = EN_ANI_NONE;
+	SetDrawColor(clLeft, clRight);
+}
+
+CGradientStatic::~CGradientStatic()
+{
+	FreeLibrary( hinst_msimg32 );
+	if(m_font.GetSafeHandle() != NULL)
+		m_font.DeleteObject();
+}
+
+BEGIN_MESSAGE_MAP(CGradientStatic, CStatic)
+	ON_WM_PAINT()
+	ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+// CGradientStatic 皋矫瘤 贸府扁涝聪促
+//this function will be used only if msimg32.dll library is not available
+void CGradientStatic::DrawGradRect(CDC *pDC, CRect r, COLORREF cLeft, COLORREF cRight, BOOL a_bVertical)
+{
+	CRect stepR;					// rectangle for color's band
+	COLORREF color;				// color for the bands
+	float fStep;
+
+	if(a_bVertical)
+		fStep = ((float)r.Height())/255.0f;	
+	else
+		fStep = ((float)r.Width())/255.0f;	// width of color's band
+
+	for (int iOnBand = 0; iOnBand < 255; iOnBand++) 
+	{
+		// set current band
+		if(a_bVertical)
+		{
+			SetRect(&stepR,
+				r.left, 
+				r.top+(int)(iOnBand * fStep),
+				r.right, 
+				r.top+(int)((iOnBand+1)* fStep));	
+		}
+		else
+		{
+			SetRect(&stepR,
+				r.left+(int)(iOnBand * fStep), 
+				r.top,
+				r.left+(int)((iOnBand+1)* fStep), 
+				r.bottom);	
+		}
+
+		// set current color
+		color = RGB((GetRValue(cRight)-GetRValue(cLeft))*((float)iOnBand)/255.0f+GetRValue(cLeft),
+			(GetGValue(cRight)-GetGValue(cLeft))*((float)iOnBand)/255.0f+GetGValue(cLeft),
+			(GetBValue(cRight)-GetBValue(cLeft))*((float)iOnBand)/255.0f+GetBValue(cLeft));
+		// fill current band
+		pDC->FillSolidRect(stepR,color);
+	}
+}
+
+void CGradientStatic::DrawGradRect(CDC *pDC, CRect r, BOOL a_bVertical, COLORREF *cl)
+{
+	CRect stepR;					// rectangle for color's band
+	COLORREF color;				// color for the bands
+	float fStep;
+
+	if(a_bVertical)
+		fStep = ((float)r.Height())/255.0f;	
+	else
+		fStep = ((float)r.Width())/255.0f;	// width of color's band
+
+	if(m_enAnimation == EN_ANI_LAMP)
+	{
+		// set current color
+		color = cl[0];
+
+		// fill current band
+		pDC->FillSolidRect(r,color);
+	}
+	else
+	{
+		for (int iOnBand = 0; iOnBand < 256; iOnBand++) 
+		{
+			// set current band
+			if(a_bVertical)
+			{
+				SetRect(&stepR,
+					r.left, 
+					r.top+(int)(iOnBand * fStep),
+					r.right, 
+					r.top+(int)((iOnBand+1)* fStep));	
+			}
+			else
+			{
+				SetRect(&stepR,
+					r.left+(int)(iOnBand * fStep), 
+					r.top,
+					r.left+(int)((iOnBand+1)* fStep), 
+					r.bottom);	
+			}
+
+			// set current color
+			color = cl[iOnBand];
+
+			// fill current band
+			pDC->FillSolidRect(stepR,color);
+		}
+	}
+	
+}
+
+void CGradientStatic::OnPaint() 
+{
+	CPaintDC dc(this); // device context for painting
+	
+	CRect rect;
+	GetClientRect(&rect);
+	CDoubleBuff memdc(&dc, &rect);
+	
+	CRect rtOutline(rect);
+	
+	if(m_bDrawOutLine)
+	{
+		CPen OutLinePen, *pOldPen;
+		OutLinePen.CreatePen(PS_SOLID, 1, clOut1);
+		pOldPen = (CPen*)memdc.SelectObject(&OutLinePen);
+		memdc.Rectangle(rtOutline);
+		memdc.SelectObject(pOldPen);
+		OutLinePen.DeleteObject();
+
+		rtOutline.DeflateRect(1, 1);
+		OutLinePen.CreatePen(PS_SOLID, 1, clOut2);
+		pOldPen = (CPen*)memdc.SelectObject(&OutLinePen);
+		memdc.Rectangle(rtOutline);
+		memdc.SelectObject(pOldPen);
+		OutLinePen.DeleteObject();	
+		rtOutline.DeflateRect(1, 1);
+	}	
+
+	if(m_enAnimation == EN_ANI_NONE && m_bCanDoGradientFill) //msimg32.dll library is loaded
+	{	
+		TRIVERTEX rcVertex[2];
+		rcVertex[0].x=rtOutline.left;
+		rcVertex[0].y=rtOutline.top;
+		rcVertex[0].Red=GetRValue(clLeft)<<8;	// color values from 0x0000 to 0xff00 !!!!
+		rcVertex[0].Green=GetGValue(clLeft)<<8;
+		rcVertex[0].Blue=GetBValue(clLeft)<<8;
+		rcVertex[0].Alpha=0x0000;
+		rcVertex[1].x=rtOutline.right; 
+		rcVertex[1].y=rtOutline.bottom;
+		rcVertex[1].Red=GetRValue(clRight)<<8;
+		rcVertex[1].Green=GetGValue(clRight)<<8;
+		rcVertex[1].Blue=GetBValue(clRight)<<8;
+		rcVertex[1].Alpha=0;
+		
+		GRADIENT_RECT rect;
+		rect.UpperLeft=0;
+		rect.LowerRight=1;
+		
+		// fill the area 
+		dllfunc_GradientFill( memdc,rcVertex,2,&rect,1, m_bVertical ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H);
+		
+	}
+	else
+	{
+		//msimg32.dll is not available. Let's use our own code to display gradient background.
+		//This code is very simple and produces worse gradient that function from the library - but works!
+		DrawGradRect(&memdc,rtOutline,m_bVertical, clDrawColor);
+	}
+	
+	//let's set color defined by user
+	::SetTextColor(memdc,clText);
+
+	HFONT hfontOld;
+
+	/*
+	VERIFY(font.CreateFont(
+		20,                        // nHeight
+		0,                         // nWidth
+		0,                         // nEscapement
+		0,                         // nOrientation
+		FW_BLACK,					// nWeight
+		FALSE,                     // bItalic
+		FALSE,                     // bUnderline
+		0,                         // cStrikeOut
+		ANSI_CHARSET,              // nCharSet
+		OUT_DEFAULT_PRECIS,        // nOutPrecision
+		CLIP_DEFAULT_PRECIS,       // nClipPrecision
+		DEFAULT_QUALITY,           // nQuality
+		DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
+		_T("MS Sans Serif")));                 // lpszFacename
+
+		*/
+
+	hfontOld = (HFONT)SelectObject(memdc.m_hDC, m_font.m_hObject);
+
+	::SetBkMode(memdc, TRANSPARENT);
+	GetClientRect(&rect);
+
+	if(m_iAlign == 1) // center
+		::DrawText(memdc, m_sTEXT, -1, &rect, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
+	else if(m_iAlign == 0) // left
+	{
+		rect.left+=m_iLeftSpacing;
+		::DrawText(memdc, m_sTEXT, -1, &rect, DT_SINGLELINE|DT_VCENTER|DT_LEFT);
+	}
+	else //right
+	{
+		rect.right-=m_iLeftSpacing;
+		::DrawText(memdc, m_sTEXT, -1, &rect, DT_SINGLELINE|DT_VCENTER|DT_RIGHT);
+	}
+
+	::SelectObject(memdc.m_hDC, hfontOld);
+}
+
+void CGradientStatic::SetReverseGradient()
+{
+	COLORREF cTemp = clLeft;
+	clLeft = clRight;
+	clRight = cTemp;
+}
+
+void CGradientStatic::SetWindowText(LPCTSTR a_lpstr)
+{
+//	CStatic::SetWindowText(a_lpstr);
+
+	m_sTEXT = a_lpstr;
+
+	Invalidate(FALSE);
+}
+
+void CGradientStatic::SetDrawColor(long cLeft, long cRight)
+{
+	for (int iOnBand = 0; iOnBand < 256; iOnBand++)
+	{
+		// set current color
+		clDrawColor[iOnBand] = RGB((GetRValue(cRight)-GetRValue(cLeft))*((float)iOnBand)/255.0f+GetRValue(cLeft),
+			(GetGValue(cRight)-GetGValue(cLeft))*((float)iOnBand)/255.0f+GetGValue(cLeft),
+			(GetBValue(cRight)-GetBValue(cLeft))*((float)iOnBand)/255.0f+GetBValue(cLeft));		
+	}
+	for (int iOnBand = 256; iOnBand < 510; iOnBand++)
+	{
+		clDrawColor[iOnBand] = clDrawColor[510 - iOnBand];
+	}
+}
+
+void CGradientStatic::MoveDrawColor()
+{
+	COLORREF temp[510];
+	memcpy(&temp[m_nAniColorCount], clDrawColor, sizeof(COLORREF) * (510 - m_nAniColorCount));
+	memcpy(temp, &clDrawColor[510 - m_nAniColorCount], sizeof(COLORREF) * m_nAniColorCount);
+	memcpy(clDrawColor, temp, sizeof(COLORREF) * 510);	
+}
+
+void CGradientStatic::OnTimer(UINT_PTR nIDEvent)
+{
+	switch(nIDEvent)
+	{
+	case ID_TIMER_ANIMATION_CONTROL:
+		{
+			if(m_enAnimation == EN_ANI_NONE)
+			{
+				KillTimer(ID_TIMER_ANIMATION_CONTROL);
+				SetDrawColor(clLeft, clRight);
+				return;
+			}
+
+			MoveDrawColor();
+			Invalidate(FALSE);
+		}
+		break;
+	}
+
+	__super::OnTimer(nIDEvent);
+}
+
+void CGradientStatic::SetAnimationMode(int nMode, int nTime, int nIndex)
+{
+	m_enAnimation = (EN_ANI_MODE)nMode;
+	m_nAniColorCount = nIndex;
+	SetDrawColor(clLeft, clRight);
+	if(m_enAnimation == EN_ANI_NONE)
+	{
+		KillTimer(ID_TIMER_ANIMATION_CONTROL);
+	}
+	else
+	{
+		SetTimer(ID_TIMER_ANIMATION_CONTROL, nTime, NULL);
+	}
+}
+
+BOOL CGradientStatic::SetControlFont(int nHeight, int nWidth, int nEscapement,
+									 int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline,
+									 BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision,
+									 BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily,
+									 LPCTSTR lpszFacename)
+{
+	if(m_font.GetSafeHandle() != NULL)
+		m_font.DeleteObject();
+
+	return m_font.CreateFont(nHeight, nWidth, nEscapement,nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, nCharSet, nOutPrecision, nClipPrecision, nQuality, nPitchAndFamily, lpszFacename);
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/CellRange.h b/Common_Class/SISControls/GridControl/CellRange.h
new file mode 100644
index 0000000..ca429b5
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/CellRange.h
@@ -0,0 +1,156 @@
+///////////////////////////////////////////////////////////////////////
+// CellRange.h: header file
+//
+// MFC Grid Control - interface for the CCellRange class.
+//
+// Written by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2002. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+// The code contained in this file is based on the original
+// WorldCom Grid control written by Joe Willcoxson,
+//      mailto:chinajoe@aol.com
+//      http://users.aol.com/chinajoe
+
+#ifndef max
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+#endif
+
+class AFX_EXT_CLASS CCellID
+{    
+// Attributes
+public:
+    int row, col;
+
+// Operations
+public:
+    explicit CCellID(int nRow = -1, int nCol = -1) : row(nRow), col(nCol) {}
+
+    int IsValid() const { return (row >= 0 && col >= 0); }
+    int operator==(const CCellID& rhs) const { return (row == rhs.row && col == rhs.col); }
+    int operator!=(const CCellID& rhs) const { return !operator==(rhs); }
+};
+
+class CCellRange
+{ 
+public:
+    
+    CCellRange(int nMinRow = -1, int nMinCol = -1, int nMaxRow = -1, int nMaxCol = -1)
+    {
+        Set(nMinRow, nMinCol, nMaxRow, nMaxCol);
+    }
+
+    void Set(int nMinRow = -1, int nMinCol = -1, int nMaxRow = -1, int nMaxCol = -1);
+    
+    int  IsValid() const;
+    int  InRange(int row, int col) const;
+    int  InRange(const CCellID& cellID) const;
+    int  Count() { return (m_nMaxRow - m_nMinRow + 1) * (m_nMaxCol - m_nMinCol + 1); }
+    
+    CCellID  GetTopLeft() const;
+    CCellRange  Intersect(const CCellRange& rhs) const;
+    
+    int GetMinRow() const {return m_nMinRow;}
+    void SetMinRow(int minRow) {m_nMinRow = minRow;}
+    
+    int GetMinCol() const {return m_nMinCol;}
+    void SetMinCol(int minCol) {m_nMinCol = minCol;}
+    
+    int GetMaxRow() const {return m_nMaxRow;}
+    void SetMaxRow(int maxRow) {m_nMaxRow = maxRow;}
+    
+    int GetMaxCol() const {return m_nMaxCol;}
+    void SetMaxCol(int maxCol) {m_nMaxCol = maxCol;}
+
+    int GetRowSpan() const {return m_nMaxRow - m_nMinRow + 1;}
+    int GetColSpan() const {return m_nMaxCol - m_nMinCol + 1;}
+    
+    void operator=(const CCellRange& rhs);
+    int  operator==(const CCellRange& rhs);
+    int  operator!=(const CCellRange& rhs);
+    
+protected:
+    int m_nMinRow;
+    int m_nMinCol;
+    int m_nMaxRow;
+    int m_nMaxCol;
+};
+
+inline void CCellRange::Set(int minRow, int minCol, int maxRow, int maxCol)
+{
+     m_nMinRow = minRow;
+     m_nMinCol = minCol;
+     m_nMaxRow = maxRow;
+     m_nMaxCol = maxCol;
+}
+
+inline void CCellRange::operator=(const CCellRange& rhs)
+{
+    if (this != &rhs) Set(rhs.m_nMinRow, rhs.m_nMinCol, rhs.m_nMaxRow, rhs.m_nMaxCol);
+}
+
+inline int CCellRange::operator==(const CCellRange& rhs)
+{
+     return ((m_nMinRow == rhs.m_nMinRow) && (m_nMinCol == rhs.m_nMinCol) &&
+             (m_nMaxRow == rhs.m_nMaxRow) && (m_nMaxCol == rhs.m_nMaxCol));
+}
+
+inline int CCellRange::operator!=(const CCellRange& rhs)
+{
+     return !operator==(rhs);
+}
+
+inline int CCellRange::IsValid() const
+{
+     return (m_nMinRow >= 0 && m_nMinCol >= 0 && m_nMaxRow >= 0 && m_nMaxCol >= 0 &&
+             m_nMinRow <= m_nMaxRow && m_nMinCol <= m_nMaxCol);
+}
+
+inline int CCellRange::InRange(int row, int col) const
+{
+     return (row >= m_nMinRow && row <= m_nMaxRow && col >= m_nMinCol && col <= m_nMaxCol);
+}
+
+inline int CCellRange::InRange(const CCellID& cellID) const
+{
+     return InRange(cellID.row, cellID.col);
+}
+
+inline CCellID CCellRange::GetTopLeft() const
+{
+     return CCellID(m_nMinRow, m_nMinCol);
+}
+
+inline CCellRange CCellRange::Intersect(const CCellRange& rhs) const
+{
+     return CCellRange(max(m_nMinRow,rhs.m_nMinRow), max(m_nMinCol,rhs.m_nMinCol),
+                       min(m_nMaxRow,rhs.m_nMaxRow), min(m_nMaxCol,rhs.m_nMaxCol));
+}
+
+#endif // !defined(AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.cpp b/Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.cpp
new file mode 100644
index 0000000..29181f4
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.cpp
@@ -0,0 +1,147 @@
+// GridCell.cpp : implementation file
+//
+// MFC Grid Control - Main grid cell class
+//
+// Provides the implementation for the "default" cell type of the
+// grid control. Adds in cell editing.
+//
+// Written by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2000. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10
+//
+// History:
+// Eric Woodruff - 20 Feb 2000 - Added PrintCell() plus other minor changes
+// Ken Bertelson - 12 Apr 2000 - Split CGridCell into CGridCell and CGridCellBase
+// <kenbertelson@hotmail.com>
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "GridCell.h"
+#include "InPlaceEdit.h"
+#include "GridCtrl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#ifdef GRIDCTRL_MINSIZE
+/////////////////////////////////////////////////////////////////////////////
+// CGridCellAttr default static attributes
+
+DWORD    CGridCellAttr::m_nDefFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX
+#ifndef _WIN32_WCE
+                                       | DT_END_ELLIPSIS
+#endif
+                                       ;
+COLORREF CGridCellAttr::m_crDefBkClr = CLR_DEFAULT;     // Background colour (or CLR_DEFAULT)
+COLORREF CGridCellAttr::m_crDefFgClr = CLR_DEFAULT;     // Forground colour (or CLR_DEFAULT)
+LOGFONT  CGridCellAttr::m_lfDefFont;                    // Cell font
+UINT     CGridCellAttr::m_nDefMargin = 3;               // Internal cell margin
+
+#endif
+
+IMPLEMENT_DYNCREATE(CGridCell, CGridCellBase)
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCell
+
+CGridCell::CGridCell()
+{
+    Reset();
+}
+
+CGridCell::~CGridCell()
+{
+#ifdef GRIDCTRL_MINSIZE
+    delete m_pAttr;
+#endif
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCell Attributes
+
+void CGridCell::Reset()
+{
+    CGridCellBase::Reset();
+
+    m_strText.Empty();
+    m_nImage   = -1;
+    m_pGrid    = NULL;
+    m_bEditing = FALSE;
+    m_pEditWnd = NULL;
+
+#ifdef GRIDCTRL_MINSIZE
+    delete m_pAttr;
+    m_pAttr    = NULL;
+#else
+#ifdef _WIN32_WCE
+    m_nFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX;
+#else
+    m_nFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX | DT_END_ELLIPSIS;
+#endif
+    m_crBkClr = CLR_DEFAULT;     // Background colour (or CLR_DEFAULT)
+    m_crFgClr = CLR_DEFAULT;     // Forground colour (or CLR_DEFAULT)
+    m_lfFont;                    // Cell font
+    m_nMargin = 3;               // Internal cell margin
+#endif
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCell Operations
+
+BOOL CGridCell::Edit(int nRow, int nCol, CRect rect, CPoint /* point */, UINT nID, UINT nChar)
+{
+    DWORD dwStyle = ES_LEFT;
+    if (GetFormat() & DT_RIGHT) 
+        dwStyle = ES_RIGHT;
+    else if (GetFormat() & DT_CENTER) 
+        dwStyle = ES_CENTER;
+
+    m_bEditing = TRUE;
+    
+    // InPlaceEdit auto-deletes itself
+    CGridCtrl* pGrid = GetGrid();
+    m_pEditWnd = new CInPlaceEdit(pGrid, rect, dwStyle, nID, nRow, nCol, GetText(), nChar);
+    
+    return TRUE;
+}
+
+void CGridCell::EndEdit()
+{
+    if (m_pEditWnd)
+        ((CInPlaceEdit*)m_pEditWnd)->EndEdit();
+}
+
+void CGridCell::OnEndEdit()
+{
+    m_bEditing = FALSE;
+    m_pEditWnd = NULL;
+}
+
+inline DWORD    CGridCell::GetFormat()                 { return m_nFormat; }
+inline COLORREF CGridCell::GetTextClr()                { return m_crFgClr; }
+inline COLORREF CGridCell::GetBackClr()                { return m_crBkClr; }
+inline const LOGFONT* CGridCell::GetFont()             { return &m_lfFont; }
+inline UINT     CGridCell::GetMargin()                 { return m_nMargin; }
+
+inline void     CGridCell::SetFormat(DWORD nFormat)    { m_nFormat = nFormat; }                      
+inline void     CGridCell::SetTextClr(COLORREF clr)    { m_crFgClr = clr; }                          
+inline void     CGridCell::SetBackClr(COLORREF clr)    { m_crBkClr = clr; }                          
+inline void     CGridCell::SetFont(const LOGFONT* plf) { memcpy(&(m_lfFont), plf, sizeof(LOGFONT)); }
+inline void     CGridCell::SetMargin( UINT nMargin)    { m_nMargin = nMargin; }
diff --git a/Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.h b/Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.h
new file mode 100644
index 0000000..1583844
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/Experimental Upgrades/GridCellLite.h
@@ -0,0 +1,148 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCell.h : header file
+//
+// MFC Grid Control - Grid cell class header file
+//
+// Written by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2000. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridCtrl;
+#include "GridCellBase.h"
+
+//#define GRIDCTRL_MINSIZE
+
+#ifdef GRIDCTRL_MINSIZE
+class CGridCellAttr
+{
+public:
+    virtual DWORD    GetFormat()                { return m_nFormat; }
+    virtual COLORREF GetTextClr()               { return m_crFgClr; }
+    virtual COLORREF GetBackClr()               { return m_crBkClr; }
+    virtual const LOGFONT* GetFont()            { return &m_lfFont; }
+    virtual UINT     GetMargin()                { return m_nMargin; }
+
+    static DWORD    GetDefFormat()              { return m_nDefFormat; }
+    static COLORREF GetDefTextClr()             { return m_crDefFgClr; }
+    static COLORREF GetDefBackClr()             { return m_crDefBkClr; }
+    static const LOGFONT* GetDefFont()          { return &m_lfFont; }
+    static UINT     GetDefMargin()              { return m_nMargin; }
+
+protected:
+    DWORD    m_nFormat;     // Cell format
+    COLORREF m_crBkClr;     // Background colour (or CLR_DEFAULT)
+    COLORREF m_crFgClr;     // Forground colour (or CLR_DEFAULT)
+    LOGFONT  m_lfFont;      // Cell font
+    UINT     m_nMargin;     // Internal cell margin
+
+protected:
+    static DWORD    m_nDefFormat;     // Cell format
+    static COLORREF m_crDefBkClr;     // Background colour (or CLR_DEFAULT)
+    static COLORREF m_crDefFgClr;     // Forground colour (or CLR_DEFAULT)
+    static LOGFONT  m_lfDefFont;      // Cell font
+    static UINT     m_nDefMargin;     // Internal cell margin
+};
+#endif
+
+// Each cell contains one of these. Fields "row" and "column" are not stored since we
+// will usually have acces to them in other ways, and they are an extra 8 bytes per
+// cell that is probably unnecessary.
+
+class CGridCell : public CGridCellBase
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCell)
+
+// Construction/Destruction
+public:
+    CGridCell();
+    virtual ~CGridCell();
+
+// Attributes
+public:
+    virtual void SetText(LPCTSTR szText)        { m_strText = szText; }                       
+    virtual void SetImage(int nImage)           { m_nImage = nImage; }                        
+    virtual void SetData(LPARAM lParam)         { m_lParam = lParam; }      
+    virtual void SetGrid(CGridCtrl* pGrid)      { m_pGrid = pGrid; }                          
+    
+ // virtual void SetState(DWORD nState);  -  use base class version   
+
+    virtual void SetFormat(DWORD nFormat);
+    virtual void SetTextClr(COLORREF clr);
+    virtual void SetBackClr(COLORREF clr);
+    virtual void SetFont(const LOGFONT* plf);
+    virtual void SetMargin( UINT nMargin);
+
+    virtual void SetCoords( int /* nRow */, int /* nCol */) {}  // don't need to know the row and
+                                                                // column for base implementation
+
+    virtual LPCTSTR  GetText()                  { return (m_strText.IsEmpty())? _T("") : m_strText; }
+    virtual int      GetImage()                 { return m_nImage;  }
+    virtual LPARAM   GetData()                  { return m_lParam;  }
+    virtual CGridCtrl* GetGrid()                { return m_pGrid;   }
+
+    // virtual DWORD    GetState()  - use base class
+
+    virtual DWORD    GetFormat();
+    virtual COLORREF GetTextClr();
+    virtual COLORREF GetBackClr();
+    virtual const LOGFONT* GetFont();
+    virtual UINT     GetMargin();
+
+    virtual BOOL     IsEditing()                { return m_bEditing; }
+    virtual void     Reset();
+
+// editing cells
+public:
+    virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual void EndEdit();
+protected:
+    virtual void OnEndEdit();
+
+protected:
+    CString         m_strText;      // Cell text (or binary data if you wish...)
+    LPARAM          m_lParam;       // 32-bit value to associate with item
+    int             m_nImage;       // Index of the list view item抯 icon
+
+#ifdef GRIDCTRL_MINSIZE
+    CGridCellAttr*  m_pAttr;        // Less commonly used attributes. NULL if defaults are used
+#else
+    DWORD    m_nFormat;
+    COLORREF m_crFgClr;
+    COLORREF m_crBkClr;
+    LOGFONT  m_lfFont;
+    UINT     m_nMargin;
+#endif
+
+    BOOL            m_bEditing;     // Cell being edited?
+
+    CGridCtrl*      m_pGrid;        // Parent grid control
+    CWnd*           m_pEditWnd;
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.cpp b/Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.cpp
new file mode 100644
index 0000000..b8a3238
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.cpp
@@ -0,0 +1,305 @@
+// InPlaceList.cpp : implementation file
+//
+// Written by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2000. All Rights Reserved.
+//
+// The code contained in this file is based on the original
+// CInPlaceList from http://www.codeguru.com/listview
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name is included. If 
+// the source code in  this file is used in any commercial application 
+// then acknowledgement must be made to the author of this file 
+// (in whatever form you wish).
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// Expect bugs!
+// 
+// Please use and enjoy. Please let me know of any bugs/mods/improvements 
+// that you have found/implemented and I will fix/incorporate them into this
+// file. 
+//
+// 6 Aug 1998 - Added CComboEdit to subclass the edit control - code provided by 
+//              Roelf Werkman <rdw@inn.nl>. Added nID to the constructor param list.
+// 29 Nov 1998 - bug fix in onkeydown (Markus Irtenkauf)
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "InPlaceList.h"
+
+#include "GridCtrl.h"
+
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CComboEdit
+
+CComboEdit::CComboEdit()
+{
+}
+
+CComboEdit::~CComboEdit()
+{
+}
+
+// Stoopid win95 accelerator key problem workaround - Matt Weagle.
+BOOL CComboEdit::PreTranslateMessage(MSG* pMsg) 
+{
+	// Make sure that the keystrokes continue to the appropriate handlers
+	if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP)
+	{
+		::TranslateMessage(pMsg);
+		::DispatchMessage(pMsg);
+		return TRUE;
+	}	
+
+	// Catch the Alt key so we don't choke if focus is going to an owner drawn button
+	if (pMsg->message == WM_SYSCHAR)
+		return TRUE;
+
+	return CEdit::PreTranslateMessage(pMsg);
+}
+
+BEGIN_MESSAGE_MAP(CComboEdit, CEdit)
+	//{{AFX_MSG_MAP(CComboEdit)
+	ON_WM_KILLFOCUS()
+	ON_WM_KEYDOWN()
+	ON_WM_KEYUP()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CComboEdit message handlers
+
+void CComboEdit::OnKillFocus(CWnd* pNewWnd) 
+{
+	CEdit::OnKillFocus(pNewWnd);
+	
+    CInPlaceList* pOwner = (CInPlaceList*) GetOwner();  // This MUST be a CInPlaceList
+    if (pOwner)
+        pOwner->EndEdit();	
+}
+
+void CComboEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if ((nChar == VK_PRIOR || nChar == VK_NEXT ||
+		 nChar == VK_DOWN  || nChar == VK_UP   ||
+		 nChar == VK_RIGHT || nChar == VK_LEFT) &&
+		(GetKeyState(VK_CONTROL) < 0 && GetDlgCtrlID() == IDC_COMBOEDIT))
+    {
+        CWnd* pOwner = GetOwner();
+        if (pOwner)
+            pOwner->SendMessage(WM_KEYDOWN, nChar, nRepCnt+ (((DWORD)nFlags)<<16));
+        return;
+    }
+
+	CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+void CComboEdit::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if (nChar == VK_ESCAPE) 
+	{
+        CWnd* pOwner = GetOwner();
+        if (pOwner)
+            pOwner->SendMessage(WM_KEYUP, nChar, nRepCnt + (((DWORD)nFlags)<<16));
+        return;
+    }
+
+	if (nChar == VK_TAB || nChar == VK_RETURN || nChar == VK_ESCAPE)
+    {
+        CWnd* pOwner = GetOwner();
+        if (pOwner)
+            pOwner->SendMessage(WM_KEYUP, nChar, nRepCnt + (((DWORD)nFlags)<<16));
+        return;
+    }
+
+	CEdit::OnKeyUp(nChar, nRepCnt, nFlags);
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceList
+
+CInPlaceList::CInPlaceList(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
+                           int nRow, int nColumn, 
+						   CStringArray& Items, CString sInitText, 
+						   UINT nFirstChar)
+{
+	m_nNumLines = 4;
+	m_sInitText = sInitText;
+ 	m_nRow		= nRow;
+ 	m_nCol      = nColumn;
+ 	m_nLastChar = 0; 
+	m_bExitOnArrows = FALSE; //(nFirstChar != VK_LBUTTON);	// If mouse click brought us here,
+
+	// Create the combobox
+ 	DWORD dwComboStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL|
+ 					     CBS_AUTOHSCROLL | dwStyle;
+	int nHeight = rect.Height();
+	rect.bottom = rect.bottom + m_nNumLines*nHeight + ::GetSystemMetrics(SM_CYHSCROLL);
+	if (!Create(dwComboStyle, rect, pParent, nID)) return;
+
+	// Add the strings
+	for (int i = 0; i < Items.GetSize(); i++) 
+		AddString(Items[i]);
+
+	// Get the maximum width of the text strings
+	int nMaxLength = 0;
+	CClientDC dc(GetParent());
+	CFont* pOldFont = dc.SelectObject(pParent->GetFont());
+
+	for (i = 0; i < Items.GetSize(); i++) 
+		nMaxLength = max(nMaxLength, dc.GetTextExtent(Items[i]).cx);
+
+	nMaxLength += (::GetSystemMetrics(SM_CXVSCROLL) + dc.GetTextExtent(_T(" ")).cx*2);
+	dc.SelectObject(pOldFont);
+
+    if (nMaxLength > rect.Width())
+	    rect.right = rect.left + nMaxLength;
+
+	// Resize the edit window and the drop down window
+	MoveWindow(rect);
+
+	SetFont(pParent->GetFont());
+	SetItemHeight(-1, nHeight);
+
+	SetDroppedWidth(nMaxLength);
+	SetHorizontalExtent(0); // no horz scrolling
+
+	// Set the initial text to m_sInitText
+	if (SelectString(-1, m_sInitText) == CB_ERR) 
+		SetWindowText(m_sInitText);		// No text selected, so restore what was there before
+
+    // Subclass the combobox edit control if style includes CBS_DROPDOWN
+    if ((dwStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWNLIST)
+    {
+        m_edit.SubclassDlgItem(IDC_COMBOEDIT, this);
+ 	    SetFocus();
+        switch (nFirstChar)
+        {
+            case VK_LBUTTON: 
+            case VK_RETURN:   m_edit.SetSel((int)_tcslen(m_sInitText), -1); return;
+            case VK_BACK:     m_edit.SetSel((int)_tcslen(m_sInitText), -1); break;
+            case VK_DOWN: 
+            case VK_UP:   
+            case VK_RIGHT:
+            case VK_LEFT:  
+            case VK_NEXT:  
+            case VK_PRIOR: 
+            case VK_HOME:  
+            case VK_END:      m_edit.SetSel(0,-1); return;
+            default:          m_edit.SetSel(0,-1);
+        }
+        SendMessage(WM_CHAR, nFirstChar);
+    }
+    else
+ 	    SetFocus();
+}
+
+CInPlaceList::~CInPlaceList()
+{
+}
+
+void CInPlaceList::EndEdit()
+{
+    CString str;
+    GetWindowText(str);
+ 
+    // Send Notification to parent
+    GV_DISPINFO dispinfo;
+
+    dispinfo.hdr.hwndFrom = GetSafeHwnd();
+    dispinfo.hdr.idFrom   = GetDlgCtrlID();
+    dispinfo.hdr.code     = GVN_ENDLABELEDIT;
+ 
+    dispinfo.item.mask    = LVIF_TEXT|LVIF_PARAM;
+    dispinfo.item.row     = m_nRow;
+    dispinfo.item.col     = m_nCol;
+    dispinfo.item.strText = str;
+    dispinfo.item.lParam  = (LPARAM) m_nLastChar; 
+ 
+    CWnd* pOwner = GetOwner();
+    if (IsWindow(pOwner->GetSafeHwnd()))
+        pOwner->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo );
+ 
+    // Close this window (PostNcDestroy will delete this)
+    PostMessage(WM_CLOSE, 0, 0);
+}
+
+void CInPlaceList::PostNcDestroy() 
+{
+	CComboBox::PostNcDestroy();
+
+	delete this;
+}
+
+BEGIN_MESSAGE_MAP(CInPlaceList, CComboBox)
+	//{{AFX_MSG_MAP(CInPlaceList)
+	ON_WM_KILLFOCUS()
+	ON_WM_KEYDOWN()
+	ON_WM_KEYUP()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceList message handlers
+
+void CInPlaceList::OnKillFocus(CWnd* pNewWnd) 
+{
+	CComboBox::OnKillFocus(pNewWnd);
+
+	if (GetSafeHwnd() == pNewWnd->GetSafeHwnd())
+        return;
+
+    // Only end editing on change of focus if we're using the CBS_DROPDOWNLIST style
+    if ((GetStyle() & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST)
+        EndEdit();
+}
+
+// If an arrow key (or associated) is pressed, then exit if
+//  a) The Ctrl key was down, or
+//  b) m_bExitOnArrows == TRUE
+void CInPlaceList::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if ((nChar == VK_PRIOR || nChar == VK_NEXT ||
+		 nChar == VK_DOWN  || nChar == VK_UP   ||
+		 nChar == VK_RIGHT || nChar == VK_LEFT) &&
+		(m_bExitOnArrows || GetKeyState(VK_CONTROL) < 0))
+	{
+		m_nLastChar = nChar;
+		GetParent()->SetFocus();
+		return;
+	}
+
+	CComboBox::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+// Need to keep a lookout for Tabs, Esc and Returns.
+void CInPlaceList::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if (nChar == VK_ESCAPE) 
+		SetWindowText(m_sInitText);	// restore previous text
+
+	if (nChar == VK_TAB || nChar == VK_RETURN || nChar == VK_ESCAPE)
+	{
+		m_nLastChar = nChar;
+		GetParent()->SetFocus();	// This will destroy this window
+		return;
+	}
+
+	CComboBox::OnKeyUp(nChar, nRepCnt, nFlags);
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.h b/Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.h
new file mode 100644
index 0000000..0ab3bd6
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/Experimental Upgrades/InPlaceList.h
@@ -0,0 +1,137 @@
+#if !defined(AFX_INPLACELIST_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_INPLACELIST_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+/////////////////////////////////////////////////////////////////////////////
+// InPlaceList.h : header file
+//
+// Written by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2000. All Rights Reserved.
+//
+// The code contained in this file is based on the original
+// CInPlaceList from http://www.codeguru.com/listview
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name is included. If 
+// the source code in  this file is used in any commercial application 
+// then acknowledgement must be made to the author of this file 
+// (in whatever form you wish).
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// Expect bugs!
+// 
+// Please use and enjoy. Please let me know of any bugs/mods/improvements 
+// that you have found/implemented and I will fix/incorporate them into this
+// file. 
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#define IDC_COMBOEDIT 1001
+
+/////////////////////////////////////////////////////////////////////////////
+// CComboEdit window
+
+class CComboEdit : public CEdit
+{
+// Construction
+public:
+	CComboEdit();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CComboEdit)
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CComboEdit();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CComboEdit)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceList window
+
+class CInPlaceList : public CComboBox
+{
+    friend class CComboEdit;
+
+// Construction
+public:
+	CInPlaceList(CWnd* pParent,         // parent
+                 CRect& rect,           // dimensions & location
+                 DWORD dwStyle,         // window/combobox style
+                 UINT nID,              // control ID
+                 int nRow, int nColumn, // row and column
+				 CStringArray& Items,   // Items in list
+                 CString sInitText,     // initial selection
+				 UINT nFirstChar);      // first character to pass to control
+
+// Attributes
+public:
+   CComboEdit m_edit;  // subclassed edit control
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceList)
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceList();
+protected:
+    void EndEdit();
+
+// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceList)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	int		m_nNumLines;
+	CString m_sInitText;
+	int		m_nRow;
+	int		m_nCol;
+ 	UINT    m_nLastChar; 
+	BOOL	m_bExitOnArrows; 
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACELIST_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.cpp b/Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.cpp
new file mode 100644
index 0000000..29a47ec
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.cpp
@@ -0,0 +1,442 @@
+////////////////////////////////////////////////////////////////////////////
+// TitleTip.cpp : implementation file
+//
+// Adapted from code written by Zafir Anjum
+//
+// Modifed 10 Apr 1999  Now accepts a LOGFONT pointer and 
+//					    a tracking rect in Show(...)  (Chris Maunder)
+//         18 Apr 1999  Resource leak in Show fixed by Daniel Gehriger
+//          7 Jan 2000  Added multiline capabilities, and the ability to
+//                      specify the maximum length of the tip (Mark Findlay)
+   
+
+#include "stdafx.h"
+#include "TitleTip.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CTitleTip
+	
+CTitleTip::CTitleTip()
+{
+	// Register the window class if it has not already been registered.
+	WNDCLASS wndcls;
+	HINSTANCE hInst = AfxGetInstanceHandle();
+	if(!(::GetClassInfo(hInst, TITLETIP_CLASSNAME, &wndcls)))
+	{
+		// otherwise we need to register a new class
+		wndcls.style			= CS_SAVEBITS;
+		wndcls.lpfnWndProc		= ::DefWindowProc;
+		wndcls.cbClsExtra		= wndcls.cbWndExtra = 0;
+		wndcls.hInstance		= hInst;
+		wndcls.hIcon			= NULL;
+		wndcls.hCursor			= LoadCursor( hInst, IDC_ARROW );
+		wndcls.hbrBackground	= (HBRUSH)(COLOR_INFOBK + 1); 
+		wndcls.lpszMenuName		= NULL;
+		wndcls.lpszClassName	= TITLETIP_CLASSNAME;
+
+		if (!AfxRegisterClass(&wndcls))
+			AfxThrowResourceException();
+	}
+}
+
+CTitleTip::~CTitleTip()
+{
+    if (::IsWindow(m_hWnd))
+        DestroyWindow();
+}
+
+
+BEGIN_MESSAGE_MAP(CTitleTip, CWnd)
+	//{{AFX_MSG_MAP(CTitleTip)
+	ON_WM_MOUSEMOVE()
+	ON_WM_PAINT()
+	ON_WM_SYSKEYDOWN()
+	ON_WM_KEYDOWN()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CTitleTip message handlers
+
+BOOL CTitleTip::Create(CWnd * pParentWnd)
+{
+//	ASSERT_VALID(pParentWnd);
+
+	DWORD dwStyle = WS_BORDER | WS_POPUP; 
+	DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
+	m_pParentWnd = pParentWnd;
+
+	return CreateEx(dwExStyle, TITLETIP_CLASSNAME, NULL, dwStyle, 
+					CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
+					NULL, NULL, NULL );
+}
+
+
+// Show 		 - Show the titletip if needed
+// rectTitle	 - The rectangle within which the original 
+//					title is constrained - in client coordinates
+// lpszTitleText - The text to be displayed
+// xoffset		 - Number of pixel that the text is offset from
+//				   left border of the cell
+void CTitleTip::Show(CRect rectTitle, LPCTSTR lpszTitleText, 
+                     int xoffset /*=0*/, int nMaxChars /*=-1*/, 
+					 LPRECT lpHoverRect /*=NULL*/,
+					 LPLOGFONT lpLogFont /*=NULL*/,
+                     DWORD dwFormat /*=...*/)
+{
+//	ASSERT( ::IsWindow( GetSafeHwnd() ) );
+
+	if (rectTitle.IsRectEmpty())
+		return;
+
+	// If titletip is already displayed, don't do anything.
+	if( IsWindowVisible() ) 
+		return;
+
+	m_rectHover = (lpHoverRect != NULL)? lpHoverRect : rectTitle;
+	m_rectHover.right++; m_rectHover.bottom++;
+
+	m_pParentWnd->ClientToScreen( m_rectHover );
+	ScreenToClient( m_rectHover );
+
+
+	// Do not display the titletip is app does not have focus
+	if( GetFocus() == NULL )
+		return;
+
+	// Define the rectangle outside which the titletip will be hidden.
+	// We add a buffer of one pixel around the rectangle
+	m_rectTitle.top	= -1;
+	m_rectTitle.left   = -xoffset-1;
+	m_rectTitle.right  = rectTitle.Width()-xoffset;
+	m_rectTitle.bottom = rectTitle.Height()+1;
+
+	// Determine the width of the text
+	m_pParentWnd->ClientToScreen( rectTitle );
+
+	CClientDC dc(this);
+	m_strTitle = _T("");
+	//m_strTitle += _T(" ");
+	m_strTitle += lpszTitleText; 
+	//m_strTitle += _T(" ");
+
+	CFont font, *pOldFont = NULL;
+	if (lpLogFont)
+	{
+		font.CreateFontIndirect(lpLogFont);
+		pOldFont = dc.SelectObject( &font );
+	}
+	else
+	{
+		// use same font as ctrl
+		pOldFont = dc.SelectObject( m_pParentWnd->GetFont() );
+	}
+
+	CSize size = dc.GetTextExtent( m_strTitle );
+
+	TEXTMETRIC tm;
+	dc.GetTextMetrics(&tm);
+	size.cx += tm.tmOverhang;
+
+	dc.SelectObject( pOldFont );
+
+	m_rectDisplay = rectTitle;
+	m_rectDisplay.left += xoffset-1;
+    m_rectDisplay.top  += 0;
+	m_rectDisplay.right = m_rectDisplay.left + size.cx + xoffset;
+    m_rectDisplay.bottom = m_rectDisplay.top + size.cy;
+	
+	// Do not display if the text fits within available space
+	if ( m_rectDisplay.right <= rectTitle.right-xoffset )
+        return;
+
+	// We will use avg char width to set max tooltip width
+    int nMaxTooltipWidth = -1;
+    if (nMaxChars > 0)
+    {
+	    int nMaxTooltipWidth = (tm.tmAveCharWidth * nMaxChars);
+		if (nMaxTooltipWidth < 0)
+			nMaxTooltipWidth *= -1;
+
+	    // Rect display to be set to max chars
+	    if (m_rectDisplay.Width() > nMaxTooltipWidth)
+            m_rectDisplay.right = m_rectDisplay.left + nMaxTooltipWidth;
+	}
+
+    //***************************************************************************************
+    //Adjust the dimensions of the rect to fit within the client
+
+    // Get the coordinates of the parents client area. (In this case the ListView's client
+    // area) and convert coordinates to those of the tooltip.
+    CRect rectClient;
+    m_pParentWnd->GetClientRect( rectClient );
+    m_pParentWnd->ClientToScreen( rectClient );
+
+
+	// ------------------------------------------------------------------------------
+	// Use the screen's right edge as the right hand border, not the right edge of the client.
+	// You can comment this out to use the right client as the border.
+	CWindowDC wdc(NULL);
+	rectClient.right = GetDeviceCaps(wdc, HORZRES) - 8;
+	rectClient.bottom = GetDeviceCaps(wdc, VERTRES) - 8;
+	//---------------------------------------------------------------------------------------
+
+
+    //If the right edge exceeds the right edge of the client:
+    //          see how much room there is to move the display to the left and adjust the
+    //          rectangle that far to the left. If the rect still exceeds the right edge, clip
+    //          the right edge to match the client right edge.
+    //
+    // Does the right display edge exceed the right client edge?
+    if (m_rectDisplay.right > rectClient.right)
+    {
+        // establish what is available left shift wise and what is needed
+        int nAvail = 0;
+        int nNeeded = m_rectDisplay.right - rectClient.right;
+
+        if (m_rectDisplay.left > rectClient.left)
+            nAvail = m_rectDisplay.left - rectClient.left;
+
+        // is there room to move left?
+        if (nAvail >= nNeeded)
+        {
+            m_rectDisplay.OffsetRect(-nNeeded,0);  // yes, move all that is needed
+            // increase the size of the window that will be inspected to see if the 
+            // cursor has gone outside of the tooltip area by the number of units we
+            // offset our display rect.
+            m_rectTitle.right += nNeeded;
+        }
+        else
+        {
+            m_rectDisplay.OffsetRect(-nAvail,0);   // no, at least move to left edge of client
+            // increase the size of the window that will be inspected to see if the 
+            // cursor has gone outside of the tooltip area by the number of units we
+            // offset our display rect.
+            m_rectTitle.right += nAvail;
+        }
+
+        // Did we move enough? If not, clip right edge to match client right edge
+        if (m_rectDisplay.right > rectClient.right)
+            m_rectDisplay.right = rectClient.right;
+    }
+
+
+    //If the left edge exceeds the left edge of the client:
+    //          see how much room there is to move the display to the right and adjust the
+    //          rectangle that far to the right. If the rect still exceeds the left edge, clip
+    //          the left edge to match the client left edge.
+    //
+    // Does the left display edge exceed the left client edge?
+    if (m_rectDisplay.left < rectClient.left)
+    {
+        // establish what is available right shift wise and what is needed
+        int nAvail = 0;
+        int nNeeded = rectClient.left - m_rectDisplay.left;
+
+        if (m_rectDisplay.right < rectClient.right)
+            nAvail = rectClient.right - m_rectDisplay.right;
+
+        // is there room to move left?
+        if (nAvail >= nNeeded)
+        {
+            m_rectDisplay.OffsetRect(+nNeeded,0);  // yes, move all that is needed
+            // increase the size of the window that will be inspected to see if the 
+            // cursor has gone outside of the tooltip area by the number of units we
+            // offset our display rect.
+            m_rectTitle.left -= nNeeded;
+        }
+        else
+        {
+            m_rectDisplay.OffsetRect(+nAvail,0);   // no, at least move to left edge of client
+            // increase the size of the window that will be inspected to see if the 
+            // cursor has gone outside of the tooltip area by the number of units we
+            // offset our display rect.
+            m_rectTitle.left -= nAvail;
+        }
+
+        // Did we move enough? If not, clip left edge to match client left edge
+        if (m_rectDisplay.left < rectClient.left)
+            m_rectDisplay.left = rectClient.left;        
+    }
+
+
+	// if the calculated width > maxwidth set above then truncate 
+    if (nMaxTooltipWidth > 0 && m_rectDisplay.Width() > nMaxTooltipWidth)
+        m_rectDisplay.right = m_rectDisplay.left + nMaxTooltipWidth;
+
+    //***************************************************************************************
+   
+    // Use a "work" rect to calculate the bottom. This work rect will be inset 
+    // slightly from the rect we have just created so the tooltip does not touch
+    // the sides.
+    CRect rectCalc = m_rectDisplay;
+
+    // rectCalc.top += 1;
+
+    int nHeight = dc.DrawText(m_strTitle, rectCalc, dwFormat | DT_CALCRECT);
+    m_dwFormat = dwFormat;
+    
+	// If this is a single line, shorten the display to get rid of any excess blank space
+	if (nHeight == tm.tmHeight)
+    {
+		rectCalc.right = rectCalc.left + size.cx + 3;
+    }
+
+
+    m_rectDisplay.bottom = m_rectDisplay.top + nHeight;
+
+	// ensure the tooltip does not exceed the bottom of the screen
+	if (m_rectDisplay.bottom > rectClient.bottom)
+    {
+		m_rectDisplay.bottom = rectClient.bottom;
+        rectCalc.bottom = rectClient.bottom; 
+    }
+
+	SetWindowPos( &wndTop, 
+        m_rectDisplay.left, 
+        m_rectDisplay.top, 
+		m_rectDisplay.Width(), 
+        m_rectDisplay.Height(),
+		SWP_SHOWWINDOW|SWP_NOACTIVATE );
+    SetCapture();
+}
+
+void CTitleTip::Hide()
+{
+  	if (!::IsWindow(GetSafeHwnd()))
+		return;
+
+	if (GetCapture()->GetSafeHwnd() == GetSafeHwnd())
+		ReleaseCapture();
+
+	ShowWindow( SW_HIDE );
+}
+
+void CTitleTip::OnMouseMove(UINT nFlags, CPoint point) 
+{
+	if (!m_rectHover.PtInRect(point)) 
+	{
+		Hide();
+		
+		// Forward the message
+		ClientToScreen( &point );
+		CWnd *pWnd = WindowFromPoint( point );
+		if ( pWnd == this ) 
+			pWnd = m_pParentWnd;
+		
+		int hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y));
+		
+		if (hittest == HTCLIENT)
+        {
+			pWnd->ScreenToClient( &point );
+			pWnd->PostMessage( WM_MOUSEMOVE, nFlags, MAKELONG(point.x,point.y) );
+		} 
+        else 
+			pWnd->PostMessage( WM_NCMOUSEMOVE, hittest, MAKELONG(point.x,point.y) );
+	}
+}
+
+BOOL CTitleTip::PreTranslateMessage(MSG* pMsg) 
+{
+	CWnd *pWnd;
+	int hittest;
+	switch (pMsg->message)
+	{
+	case WM_LBUTTONDOWN:
+	case WM_RBUTTONDOWN:
+	case WM_MBUTTONDOWN:
+		POINTS pts = MAKEPOINTS( pMsg->lParam );
+		POINT  point;
+		point.x = pts.x;
+		point.y = pts.y;
+		ClientToScreen( &point );
+		pWnd = WindowFromPoint( point );
+		if( pWnd == this ) 
+			pWnd = m_pParentWnd;
+
+		hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y));
+
+		if (hittest == HTCLIENT)
+		{
+			pWnd->ScreenToClient( &point );
+			pMsg->lParam = MAKELONG(point.x,point.y);
+		} 
+		else 
+		{
+			switch (pMsg->message) 
+			{
+				case WM_LBUTTONDOWN: 
+					pMsg->message = WM_NCLBUTTONDOWN;
+					break;
+				case WM_RBUTTONDOWN: 
+					pMsg->message = WM_NCRBUTTONDOWN;
+					break;
+				case WM_MBUTTONDOWN: 
+					pMsg->message = WM_NCMBUTTONDOWN;
+					break;
+			}
+			pMsg->wParam = hittest;
+			pMsg->lParam = MAKELONG(point.x,point.y);
+		}
+
+		Hide();
+		pWnd->PostMessage(pMsg->message,pMsg->wParam,pMsg->lParam);
+		return TRUE;	
+		
+	case WM_KEYDOWN:
+	case WM_SYSKEYDOWN:
+		Hide();
+		m_pParentWnd->PostMessage( pMsg->message, pMsg->wParam, pMsg->lParam );
+		return TRUE;
+	}
+
+	if( GetFocus() == NULL )
+	{
+		Hide();
+		return TRUE;
+	}
+
+	return CWnd::PreTranslateMessage(pMsg);
+}
+
+void CTitleTip::OnPaint() 
+{
+	CPaintDC dc(this); // device context for painting
+
+    TEXTMETRIC tm;
+	dc.GetTextMetrics(&tm);
+
+	CFont *pFont = m_pParentWnd->GetFont(); 	// use same font as ctrl
+	CFont *pFontDC = dc.SelectObject( pFont );
+	int nHeight=0;
+
+	CRect rect = m_rectDisplay;
+	ScreenToClient(rect);
+
+	dc.SetBkMode( TRANSPARENT ); 
+
+	nHeight = dc.DrawText(m_strTitle, rect, m_dwFormat);
+
+	dc.SelectObject( pFontDC );
+
+	// Do not call CWnd::OnPaint() for painting messages
+}
+
+void CTitleTip::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+    Hide();	
+	CWnd::OnSysKeyDown(nChar, nRepCnt, nFlags);
+}
+
+void CTitleTip::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+    Hide();	
+	CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
+}
diff --git a/Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.h b/Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.h
new file mode 100644
index 0000000..87c9e87
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/Experimental Upgrades/TitleTip.h
@@ -0,0 +1,68 @@
+#if !defined(AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// TitleTip.h : header file
+//
+
+#define TITLETIP_CLASSNAME _T("ZTitleTip")
+
+/////////////////////////////////////////////////////////////////////////////
+// CTitleTip window
+
+class CTitleTip : public CWnd
+{
+// Construction
+public:
+	CTitleTip();
+	virtual ~CTitleTip();
+	virtual BOOL Create( CWnd *pParentWnd);
+
+// Attributes
+public:
+
+// Operations
+public:
+	void Show(CRect rectTitle, LPCTSTR lpszTitleText, 
+              int xoffset = 0, int nMaxChars = -1, 
+              LPRECT lpHoverRect = NULL, LPLOGFONT lpLogFont = NULL,
+              DWORD dwFormat = DT_LEFT|DT_NOCLIP|DT_EDITCONTROL|DT_NOPREFIX|DT_WORDBREAK);
+    void Hide();
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CTitleTip)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+
+protected:
+	CWnd *m_pParentWnd;
+	CRect m_rectTitle;
+    CRect m_rectHover;
+    CRect m_rectDisplay;
+    CString m_strTitle;		// for use in OnPaint()
+    DWORD m_dwFormat;
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CTitleTip)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnPaint();
+	afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/GridCell.cpp b/Common_Class/SISControls/GridControl/GridCell.cpp
new file mode 100644
index 0000000..b7acf6d
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridCell.cpp
@@ -0,0 +1,294 @@
+// GridCell.cpp : implementation file
+//
+// MFC Grid Control - Main grid cell class
+//
+// Provides the implementation for the "default" cell type of the
+// grid control. Adds in cell editing.
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+// History:
+// Eric Woodruff - 20 Feb 2000 - Added PrintCell() plus other minor changes
+// Ken Bertelson - 12 Apr 2000 - Split CGridCell into CGridCell and CGridCellBase
+// <kenbertelson@hotmail.com>
+// C Maunder     - 17 Jun 2000 - Font handling optimsed, Added CGridDefaultCell
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "..\\stdafx.h"
+#include "GridCell.h"
+#include "GridInPlaceEdit.h"
+#include "GridCtrl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+IMPLEMENT_DYNCREATE(CGridCell, CGridCellBase)
+IMPLEMENT_DYNCREATE(CGridDefaultCell, CGridCell)
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCell
+
+CGridCell::CGridCell()
+{
+    m_plfFont = NULL;
+	CGridCell::Reset();
+}
+
+CGridCell::~CGridCell()
+{
+	if (m_plfFont)
+	{
+		delete m_plfFont;
+		m_plfFont = NULL;
+	}
+	
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCell Attributes
+
+void CGridCell::operator=(const CGridCell& cell)
+{
+    if (this != &cell) CGridCellBase::operator=(cell);
+}
+
+void CGridCell::Reset()
+{
+    CGridCellBase::Reset();
+
+    m_strText.Empty();
+    m_nImage   = -1;
+    m_lParam   = NULL;           // BUG FIX J. Bloggs 20/10/03
+    m_pGrid    = NULL;
+    m_bEditing = FALSE;
+    m_pEditWnd = NULL;
+
+    m_nFormat = (DWORD)-1;       // Use default from CGridDefaultCell
+    m_crBkClr = CLR_DEFAULT;     // Background colour (or CLR_DEFAULT)
+    m_crFgClr = CLR_DEFAULT;     // Forground colour (or CLR_DEFAULT)
+    m_nMargin = (UINT)-1;        // Use default from CGridDefaultCell
+
+	if (m_plfFont)
+	{
+		delete m_plfFont;
+		m_plfFont = NULL;
+	}
+    m_plfFont = NULL;            // Cell font
+}
+
+void CGridCell::SetFont(const LOGFONT* plf)
+{
+    if (plf == NULL)
+    {
+		if (m_plfFont)
+		{
+			delete m_plfFont;
+			m_plfFont = NULL;
+		}
+    }
+    else
+    {
+        if (!m_plfFont)
+            m_plfFont = new LOGFONT;
+        if (m_plfFont)
+            memcpy(m_plfFont, plf, sizeof(LOGFONT)); 
+    }
+}
+
+LOGFONT* CGridCell::GetFont() const
+{
+    if (m_plfFont == NULL)
+    {
+        CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell();
+        if (!pDefaultCell)
+            return NULL;
+
+        return pDefaultCell->GetFont();
+    }
+
+    return m_plfFont; 
+}
+
+CFont* CGridCell::GetFontObject() const
+{
+    // If the default font is specified, use the default cell implementation
+    if (m_plfFont == NULL)
+    {
+        CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell();
+        if (!pDefaultCell)
+            return NULL;
+
+        return pDefaultCell->GetFontObject();
+    }
+    else
+    {
+        static CFont Font;
+        Font.DeleteObject();
+        Font.CreateFontIndirect(m_plfFont);
+        return &Font;
+    }
+}
+
+DWORD CGridCell::GetFormat() const
+{
+    if (m_nFormat == (DWORD)-1)
+    {
+        CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell();
+        if (!pDefaultCell)
+            return 0;
+
+        return pDefaultCell->GetFormat();
+    }
+
+    return m_nFormat; 
+}
+
+UINT CGridCell::GetMargin() const           
+{
+    if (m_nMargin == (UINT)-1)
+    {
+        CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell();
+        if (!pDefaultCell)
+            return 0;
+
+        return pDefaultCell->GetMargin();
+    }
+
+    return m_nMargin; 
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCell Operations
+
+BOOL CGridCell::Edit(int nRow, int nCol, CRect rect, CPoint /* point */, UINT nID, UINT nChar)
+{
+    if ( m_bEditing )
+	{      
+        if (m_pEditWnd)
+		    m_pEditWnd->SendMessage ( WM_CHAR, nChar );    
+    }  
+	else  
+	{   
+		DWORD dwStyle = ES_LEFT;
+		if (GetFormat() & DT_RIGHT) 
+			dwStyle = ES_RIGHT;
+		else if (GetFormat() & DT_CENTER) 
+			dwStyle = ES_CENTER;
+		
+		m_bEditing = TRUE;
+		
+		// InPlaceEdit auto-deletes itself
+		CGridCtrl* pGrid = GetGrid();
+		m_pEditWnd = new CGridInPlaceEdit(pGrid, rect, dwStyle, nID, nRow, nCol, GetText(), nChar);
+    }
+    return TRUE;
+}
+
+void CGridCell::EndEdit()
+{
+    if (m_pEditWnd)
+        ((CGridInPlaceEdit*)m_pEditWnd)->EndEdit();
+}
+
+void CGridCell::OnEndEdit()
+{
+    m_bEditing = FALSE;
+    m_pEditWnd = NULL;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridDefaultCell
+
+CGridDefaultCell::CGridDefaultCell() 
+{
+#ifdef _WIN32_WCE
+    m_nFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX;
+#else
+    m_nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX | DT_END_ELLIPSIS;
+#endif
+    m_crFgClr = CLR_DEFAULT;
+    m_crBkClr = CLR_DEFAULT;
+    m_Size    = CSize(30,10);
+    m_dwStyle = 0;
+
+#ifdef _WIN32_WCE
+    LOGFONT lf;
+    GetObject(GetStockObject(SYSTEM_FONT), sizeof(LOGFONT), &lf);
+    SetFont(&lf);
+#else // not CE
+    NONCLIENTMETRICS ncm;
+	memset(&ncm,0,sizeof(NONCLIENTMETRICS));
+    ncm.cbSize = sizeof(NONCLIENTMETRICS);
+    //VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
+	SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0);
+    SetFont(&(ncm.lfMessageFont));
+#endif
+}
+
+CGridDefaultCell::~CGridDefaultCell()
+{
+    m_Font.DeleteObject(); 
+}
+
+void CGridDefaultCell::SetFont(const LOGFONT* plf)
+{
+//    ASSERT(plf);
+
+    if (!plf) return;
+
+    m_Font.DeleteObject();
+    m_Font.CreateFontIndirect(plf);
+
+    CGridCell::SetFont(plf);
+
+    // Get the font size and hence the default cell size
+    CDC* pDC = CDC::FromHandle(::GetDC(NULL));
+    if (pDC)
+    {
+        CFont* pOldFont = pDC->SelectObject(&m_Font);
+
+        SetMargin(pDC->GetTextExtent(_T(" "), 1).cx);
+        m_Size = pDC->GetTextExtent(_T(" XXXXXXXXXXXX "), 14);
+        m_Size.cy = (m_Size.cy * 3) / 2;
+
+        pDC->SelectObject(pOldFont);
+        ReleaseDC(NULL, pDC->GetSafeHdc());
+    }
+    else
+    {
+        SetMargin(3);
+        m_Size = CSize(40,16);
+    }
+}
+
+LOGFONT* CGridDefaultCell::GetFont() const
+{
+//    ASSERT(m_plfFont);  // This is the default - it CAN'T be NULL!
+    return m_plfFont;
+}
+
+CFont* CGridDefaultCell::GetFontObject() const
+{
+//    ASSERT(m_Font.GetSafeHandle());
+    return (CFont*) &m_Font; 
+}
diff --git a/Common_Class/SISControls/GridControl/GridCell.h b/Common_Class/SISControls/GridControl/GridCell.h
new file mode 100644
index 0000000..05a368f
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridCell.h
@@ -0,0 +1,143 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCell.h : header file
+//
+// MFC Grid Control - Grid cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridCtrl;
+#include "GridCellBase.h"
+
+// Each cell contains one of these. Fields "row" and "column" are not stored since we
+// will usually have acces to them in other ways, and they are an extra 8 bytes per
+// cell that is probably unnecessary.
+
+class AFX_EXT_CLASS CGridCell : public CGridCellBase
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCell)
+
+// Construction/Destruction
+public:
+    CGridCell();
+    virtual ~CGridCell();
+
+// Attributes
+public:
+    void operator=(const CGridCell& cell);
+
+    virtual void  SetText(LPCTSTR szText)        { m_strText = szText;  }                       
+    virtual void  SetImage(int nImage)           { m_nImage = nImage;   }                        
+    virtual void  SetData(LPARAM lParam)         { m_lParam = lParam;   }      
+    virtual void  SetGrid(CGridCtrl* pGrid)      { m_pGrid = pGrid;     }                          
+    // virtual void SetState(const DWORD nState);  -  use base class version   
+    virtual void  SetFormat(DWORD nFormat)       { m_nFormat = nFormat; }                      
+    virtual void  SetTextClr(COLORREF clr)       { m_crFgClr = clr;     }                          
+    virtual void  SetBackClr(COLORREF clr)       { m_crBkClr = clr;     }                          
+    virtual void  SetFont(const LOGFONT* plf);
+    virtual void  SetMargin(UINT nMargin)        { m_nMargin = nMargin; }
+    virtual CWnd* GetEditWnd() const             { return m_pEditWnd;   }
+    virtual void  SetCoords(int /*nRow*/, int /*nCol*/) {}  // don't need to know the row and
+                                                            // column for base implementation
+
+    virtual LPCTSTR     GetText() const             { return (m_strText.IsEmpty())? _T("") : LPCTSTR(m_strText); }
+    virtual int         GetImage() const            { return m_nImage;  }
+    virtual LPARAM      GetData() const             { return m_lParam;  }
+    virtual CGridCtrl*  GetGrid() const             { return m_pGrid;   }
+    // virtual DWORD    GetState() const - use base class
+    virtual DWORD       GetFormat() const;
+    virtual COLORREF    GetTextClr() const          { return m_crFgClr; } // TODO: change to use default cell
+    virtual COLORREF    GetBackClr() const          { return m_crBkClr; }
+    virtual LOGFONT*    GetFont() const;
+    virtual CFont*      GetFontObject() const;
+    virtual UINT        GetMargin() const;
+
+    virtual BOOL        IsEditing() const           { return m_bEditing; }
+    virtual BOOL        IsDefaultFont() const       { return (m_plfFont == NULL); }
+    virtual void        Reset();
+
+// editing cells
+public:
+    virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual void EndEdit();
+protected:
+    virtual void OnEndEdit();
+
+protected:
+    CString    m_strText;      // Cell text (or binary data if you wish...)
+    LPARAM     m_lParam;       // 32-bit value to associate with item
+    int        m_nImage;       // Index of the list view item抯 icon
+    DWORD      m_nFormat;
+    COLORREF   m_crFgClr;
+    COLORREF   m_crBkClr;
+    LOGFONT*   m_plfFont;
+    UINT       m_nMargin;
+
+    BOOL       m_bEditing;     // Cell being edited?
+
+    CGridCtrl* m_pGrid;        // Parent grid control
+    CWnd*      m_pEditWnd;
+};
+
+// This class is for storing grid default values. It's a little heavy weight, so
+// don't use it in bulk 
+class CGridDefaultCell : public CGridCell
+{
+    DECLARE_DYNCREATE(CGridDefaultCell)
+
+// Construction/Destruction
+public:
+    CGridDefaultCell();
+    virtual ~CGridDefaultCell();
+
+public:
+    virtual DWORD GetStyle() const                      { return m_dwStyle;      }
+    virtual void  SetStyle(DWORD dwStyle)               { m_dwStyle = dwStyle;   }
+    virtual int   GetWidth() const                      { return m_Size.cx;      }
+    virtual int   GetHeight() const                     { return m_Size.cy;      }
+    virtual void  SetWidth(int nWidth)                  { m_Size.cx = nWidth;    }
+    virtual void  SetHeight(int nHeight)                { m_Size.cy = nHeight;   }
+
+    // Disable these properties
+    virtual void     SetData(LPARAM /*lParam*/)             { ASSERT(FALSE);         }      
+    virtual void     SetState(DWORD /*nState*/)             { ASSERT(FALSE);         }
+    virtual DWORD    GetState() const                       { return CGridCell::GetState()|GVIS_READONLY; }
+    virtual void     SetCoords( int /*row*/, int /*col*/)   { /*ASSERT(FALSE);*/         }
+    virtual void     SetFont(const LOGFONT* /*plf*/);
+    virtual LOGFONT* GetFont() const;   
+    virtual CFont*   GetFontObject() const;
+
+protected:
+    CSize m_Size;       // Default Size
+    CFont m_Font;       // Cached font
+    DWORD m_dwStyle;    // Cell Style - unused
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/GridCellBase.cpp b/Common_Class/SISControls/GridControl/GridCellBase.cpp
new file mode 100644
index 0000000..f0d3e50
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridCellBase.cpp
@@ -0,0 +1,773 @@
+// GridCellBase.cpp : implementation file
+//
+// MFC Grid Control - Main grid cell base class
+//
+// Provides the implementation for the base cell type of the
+// grid control. No data is stored (except for state) but default
+// implementations of drawing, printingetc provided. MUST be derived
+// from to be used.
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+// History:
+// Ken Bertelson - 12 Apr 2000 - Split CGridCell into CGridCell and CGridCellBase
+// C Maunder     - 19 May 2000 - Fixed sort arrow drawing (Ivan Ilinov)
+// C Maunder     - 29 Aug 2000 - operator= checks for NULL font before setting (Martin Richter)
+// C Maunder     - 15 Oct 2000 - GetTextExtent fixed (Martin Richter)
+// C Maunder     -  1 Jan 2001 - Added ValidateEdit
+// Yogurt        - 13 Mar 2004 - GetCellExtent fixed
+//
+// NOTES: Each grid cell should take care of it's own drawing, though the Draw()
+//        method takes an "erase background" paramter that is called if the grid
+//        decides to draw the entire grid background in on hit. Certain ambient
+//        properties such as the default font to use, and hints on how to draw
+//        fixed cells should be fetched from the parent grid. The grid trusts the
+//        cells will behave in a certain way, and the cells trust the grid will
+//        supply accurate information.
+//        
+/////////////////////////////////////////////////////////////////////////////
+
+#include "..\\stdafx.h"
+#include "GridCtrl.h"
+#include "GridCellBase.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+IMPLEMENT_DYNAMIC(CGridCellBase, CObject)
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCellBase
+
+CGridCellBase::CGridCellBase()
+{
+    Reset();
+}
+
+CGridCellBase::~CGridCellBase()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCellBase Operations
+
+void CGridCellBase::Reset()
+{
+    m_nState  = 0;
+}
+
+void CGridCellBase::operator=(const CGridCellBase& cell)
+{
+	if (this == &cell) return;
+
+    SetGrid(cell.GetGrid());    // do first in case of dependencies
+
+    SetText(cell.GetText());
+    SetImage(cell.GetImage());
+    SetData(cell.GetData());
+    SetState(cell.GetState());
+    SetFormat(cell.GetFormat());
+    SetTextClr(cell.GetTextClr());
+    SetBackClr(cell.GetBackClr());
+    SetFont(cell.IsDefaultFont()? NULL : cell.GetFont());
+    SetMargin(cell.GetMargin());
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCellBase Attributes
+
+// Returns a pointer to a cell that holds default values for this particular type of cell
+CGridCellBase* CGridCellBase::GetDefaultCell() const
+{
+    if (GetGrid())
+        return GetGrid()->GetDefaultCell(IsFixedRow(), IsFixedCol());
+    return NULL;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCellBase Operations
+
+// EFW - Various changes to make it draw cells better when using alternate
+// color schemes.  Also removed printing references as that's now done
+// by PrintCell() and fixed the sort marker so that it doesn't draw out
+// of bounds.
+BOOL CGridCellBase::Draw(CDC* pDC, int nRow, int nCol, CRect rect,  BOOL bEraseBkgnd /*=TRUE*/)
+{
+    // Note - all through this function we totally brutalise 'rect'. Do not
+    // depend on it's value being that which was passed in.
+
+    CGridCtrl* pGrid = GetGrid();
+//    ASSERT(pGrid);
+
+    if (!pGrid || !pDC)
+        return FALSE;
+
+    if( rect.Width() <= 0 || rect.Height() <= 0)  // prevents imagelist item from drawing even
+        return FALSE;                             //  though cell is hidden
+
+    //TRACE3("Drawing %scell %d, %d\n", IsFixed()? _T("Fixed ") : _T(""), nRow, nCol);
+
+    int nSavedDC = pDC->SaveDC();
+    pDC->SetBkMode(TRANSPARENT);
+
+    // Get the default cell implementation for this kind of cell. We use it if this cell
+    // has anything marked as "default"
+    CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell();
+    if (!pDefaultCell)
+        return FALSE;
+
+    // Set up text and background colours
+    COLORREF TextClr, TextBkClr;
+
+    TextClr = (GetTextClr() == CLR_DEFAULT)? pDefaultCell->GetTextClr() : GetTextClr();
+    if (GetBackClr() == CLR_DEFAULT)
+        TextBkClr = pDefaultCell->GetBackClr();
+    else
+    {
+        bEraseBkgnd = TRUE;
+        TextBkClr = GetBackClr();
+    }
+
+    // Draw cell background and highlighting (if necessary)
+    if ( IsFocused() || IsDropHighlighted() )
+    {
+        // Always draw even in list mode so that we can tell where the
+        // cursor is at.  Use the highlight colors though.
+        if(GetState() & GVIS_SELECTED)
+        {
+            TextBkClr = ::GetSysColor(COLOR_HIGHLIGHT);
+            TextClr = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
+            bEraseBkgnd = TRUE;
+        }
+
+        rect.right++; rect.bottom++;    // FillRect doesn't draw RHS or bottom
+        if (bEraseBkgnd)
+        {
+            TRY 
+            {
+                CBrush brush(TextBkClr);
+                pDC->FillRect(rect, &brush);
+            } 
+            CATCH(CResourceException, e)
+            {
+                //e->ReportError();
+            }
+            END_CATCH
+        }
+
+        // Don't adjust frame rect if no grid lines so that the
+        // whole cell is enclosed.
+        if(pGrid->GetGridLines() != GVL_NONE)
+        {
+            rect.right--;
+            rect.bottom--;
+        }
+
+        if (pGrid->GetFrameFocusCell())
+        {
+                // Use same color as text to outline the cell so that it shows
+                // up if the background is black.
+            TRY 
+            {
+                CBrush brush(TextClr);
+                pDC->FrameRect(rect, &brush);
+            }
+            CATCH(CResourceException, e)
+            {
+                //e->ReportError();
+            }
+            END_CATCH
+        }
+        pDC->SetTextColor(TextClr);
+
+        // Adjust rect after frame draw if no grid lines
+        if(pGrid->GetGridLines() == GVL_NONE)
+        {
+            rect.right--;
+            rect.bottom--;
+        }
+
+		//rect.DeflateRect(0,1,1,1);  - Removed by Yogurt
+    }
+    else if ((GetState() & GVIS_SELECTED))
+    {
+        rect.right++; rect.bottom++;    // FillRect doesn't draw RHS or bottom
+        pDC->FillSolidRect(rect, ::GetSysColor(COLOR_HIGHLIGHT));
+        rect.right--; rect.bottom--;
+        pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
+    }
+    else
+    {
+        if (bEraseBkgnd)
+        {
+            rect.right++; rect.bottom++;    // FillRect doesn't draw RHS or bottom
+            CBrush brush(TextBkClr);
+            pDC->FillRect(rect, &brush);
+            rect.right--; rect.bottom--;
+        }
+        pDC->SetTextColor(TextClr);
+    }
+
+    // Draw lines only when wanted
+    if (IsFixed() && pGrid->GetGridLines() != GVL_NONE)
+    {
+        CCellID FocusCell = pGrid->GetFocusCell();
+
+        // As above, always show current location even in list mode so
+        // that we know where the cursor is at.
+        BOOL bHiliteFixed = pGrid->GetTrackFocusCell() && pGrid->IsValid(FocusCell) &&
+                            (FocusCell.row == nRow || FocusCell.col == nCol);
+
+        // If this fixed cell is on the same row/col as the focus cell,
+        // highlight it.
+        if (bHiliteFixed)
+        {
+            rect.right++; rect.bottom++;
+            pDC->DrawEdge(rect, BDR_SUNKENINNER /*EDGE_RAISED*/, BF_RECT);
+            rect.DeflateRect(1,1);
+        }
+        else
+        {
+            CPen lightpen(PS_SOLID, 1,  ::GetSysColor(COLOR_3DHIGHLIGHT)),
+                darkpen(PS_SOLID,  1, ::GetSysColor(COLOR_3DDKSHADOW)),
+                *pOldPen = pDC->GetCurrentPen();
+
+            pDC->SelectObject(&lightpen);
+            pDC->MoveTo(rect.right, rect.top);
+            pDC->LineTo(rect.left, rect.top);
+            pDC->LineTo(rect.left, rect.bottom);
+
+            pDC->SelectObject(&darkpen);
+            pDC->MoveTo(rect.right, rect.top);
+            pDC->LineTo(rect.right, rect.bottom);
+            pDC->LineTo(rect.left, rect.bottom);
+
+            pDC->SelectObject(pOldPen);
+            rect.DeflateRect(1,1);
+        }
+    }
+
+    // Draw Text and image
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+    if (!pDC->m_bPrinting)
+#endif
+    {
+        CFont *pFont = GetFontObject();
+//		ASSERT(pFont);
+        if (pFont)
+            pDC->SelectObject(pFont);
+    }
+
+    //rect.DeflateRect(GetMargin(), 0); - changed by Yogurt
+    rect.DeflateRect(GetMargin(), GetMargin());    
+    rect.right++;    
+    rect.bottom++;
+
+    if (pGrid->GetImageList() && GetImage() >= 0)
+    {
+        IMAGEINFO Info;
+        if (pGrid->GetImageList()->GetImageInfo(GetImage(), &Info))
+        {
+            //  would like to use a clipping region but seems to have issue
+            //  working with CMemDC directly.  Instead, don't display image
+            //  if any part of it cut-off
+            //
+            // CRgn rgn;
+            // rgn.CreateRectRgnIndirect(rect);
+            // pDC->SelectClipRgn(&rgn);
+            // rgn.DeleteObject();
+
+            /*
+            // removed by Yogurt
+            int nImageWidth = Info.rcImage.right-Info.rcImage.left+1;
+            int nImageHeight = Info.rcImage.bottom-Info.rcImage.top+1;
+            if( nImageWidth + rect.left <= rect.right + (int)(2*GetMargin())
+                && nImageHeight + rect.top <= rect.bottom + (int)(2*GetMargin())  )
+            {
+                pGrid->GetImageList()->Draw(pDC, GetImage(), rect.TopLeft(), ILD_NORMAL);
+            }
+            */
+            // Added by Yogurt
+            int nImageWidth = Info.rcImage.right-Info.rcImage.left;            
+            int nImageHeight = Info.rcImage.bottom-Info.rcImage.top;            
+            if ((nImageWidth + rect.left <= rect.right) && (nImageHeight + rect.top <= rect.bottom))                
+                pGrid->GetImageList()->Draw(pDC, GetImage(), rect.TopLeft(), ILD_NORMAL);
+
+            //rect.left += nImageWidth+GetMargin();
+        }
+    }
+
+    // Draw sort arrow
+    if (pGrid->GetSortColumn() == nCol && nRow == 0)
+    {
+        CSize size = pDC->GetTextExtent(_T("M"));
+        int nOffset = 2;
+
+        // Base the size of the triangle on the smaller of the column
+        // height or text height with a slight offset top and bottom.
+        // Otherwise, it can get drawn outside the bounds of the cell.
+        size.cy -= (nOffset * 2);
+
+        if (size.cy >= rect.Height())
+            size.cy = rect.Height() - (nOffset * 2);
+
+        size.cx = size.cy;      // Make the dimensions square
+
+        // Kludge for vertical text
+        BOOL bVertical = (GetFont()->lfEscapement == 900);
+
+        // Only draw if it'll fit!
+        //if (size.cx + rect.left < rect.right + (int)(2*GetMargin())) - changed / Yogurt
+        if (size.cx + rect.left < rect.right)
+        {
+            int nTriangleBase = rect.bottom - nOffset - size.cy;    // Triangle bottom right
+            //int nTriangleBase = (rect.top + rect.bottom - size.cy)/2; // Triangle middle right
+            //int nTriangleBase = rect.top + nOffset;                 // Triangle top right
+
+            //int nTriangleLeft = rect.right - size.cx;                 // Triangle RHS
+            //int nTriangleLeft = (rect.right + rect.left - size.cx)/2; // Triangle middle
+            //int nTriangleLeft = rect.left;                            // Triangle LHS
+
+            int nTriangleLeft;
+            if (bVertical)
+                nTriangleLeft = (rect.right + rect.left - size.cx)/2; // Triangle middle
+            else
+                nTriangleLeft = rect.right - size.cx;               // Triangle RHS
+
+            CPen penShadow(PS_SOLID, 0, ::GetSysColor(COLOR_3DSHADOW));
+            CPen penLight(PS_SOLID, 0, ::GetSysColor(COLOR_3DHILIGHT));
+            if (pGrid->GetSortAscending())
+            {
+                // Draw triangle pointing upwards
+                CPen *pOldPen = (CPen*) pDC->SelectObject(&penLight);
+                pDC->MoveTo( nTriangleLeft + 1, nTriangleBase + size.cy + 1);
+                pDC->LineTo( nTriangleLeft + (size.cx / 2) + 1, nTriangleBase + 1 );
+                pDC->LineTo( nTriangleLeft + size.cx + 1, nTriangleBase + size.cy + 1);
+                pDC->LineTo( nTriangleLeft + 1, nTriangleBase + size.cy + 1);
+
+                pDC->SelectObject(&penShadow);
+                pDC->MoveTo( nTriangleLeft, nTriangleBase + size.cy );
+                pDC->LineTo( nTriangleLeft + (size.cx / 2), nTriangleBase );
+                pDC->LineTo( nTriangleLeft + size.cx, nTriangleBase + size.cy );
+                pDC->LineTo( nTriangleLeft, nTriangleBase + size.cy );
+                pDC->SelectObject(pOldPen);
+            }
+            else
+            {
+                // Draw triangle pointing downwards
+                CPen *pOldPen = (CPen*) pDC->SelectObject(&penLight);
+                pDC->MoveTo( nTriangleLeft + 1, nTriangleBase + 1 );
+                pDC->LineTo( nTriangleLeft + (size.cx / 2) + 1, nTriangleBase + size.cy + 1 );
+                pDC->LineTo( nTriangleLeft + size.cx + 1, nTriangleBase + 1 );
+                pDC->LineTo( nTriangleLeft + 1, nTriangleBase + 1 );
+    
+                pDC->SelectObject(&penShadow);
+                pDC->MoveTo( nTriangleLeft, nTriangleBase );
+                pDC->LineTo( nTriangleLeft + (size.cx / 2), nTriangleBase + size.cy );
+                pDC->LineTo( nTriangleLeft + size.cx, nTriangleBase );
+                pDC->LineTo( nTriangleLeft, nTriangleBase );
+                pDC->SelectObject(pOldPen);
+            }
+            
+            if (!bVertical)
+                rect.right -= size.cy;
+        }
+    }
+
+    // We want to see '&' characters so use DT_NOPREFIX
+    GetTextRect(rect);
+    rect.right++;    
+    rect.bottom++;
+
+    DrawText(pDC->m_hDC, GetText(), -1, rect, GetFormat() | DT_NOPREFIX);
+
+    pDC->RestoreDC(nSavedDC);
+
+    return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCellBase Mouse and Cursor events
+
+// Not yet implemented
+void CGridCellBase::OnMouseEnter()
+{
+//    TRACE0("Mouse entered cell\n");
+}
+
+void CGridCellBase::OnMouseOver()
+{
+    //TRACE0("Mouse over cell\n");
+}
+
+// Not Yet Implemented
+void CGridCellBase::OnMouseLeave()
+{
+//    TRACE0("Mouse left cell\n");
+}
+
+void CGridCellBase::OnClick( CPoint PointCellRelative)
+{
+    UNUSED_ALWAYS(PointCellRelative);
+//    TRACE2("Mouse Left btn up in cell at x=%i y=%i\n", PointCellRelative.x, PointCellRelative.y);
+}
+
+void CGridCellBase::OnClickDown( CPoint PointCellRelative)
+{
+    UNUSED_ALWAYS(PointCellRelative);
+ //   TRACE2("Mouse Left btn down in cell at x=%i y=%i\n", PointCellRelative.x, PointCellRelative.y);
+}
+
+void CGridCellBase::OnRClick( CPoint PointCellRelative)
+{
+    UNUSED_ALWAYS(PointCellRelative);
+ //   TRACE2("Mouse right-clicked in cell at x=%i y=%i\n", PointCellRelative.x, PointCellRelative.y);
+}
+
+void CGridCellBase::OnDblClick( CPoint PointCellRelative)
+{
+    UNUSED_ALWAYS(PointCellRelative);
+//    TRACE2("Mouse double-clicked in cell at x=%i y=%i\n", PointCellRelative.x, PointCellRelative.y);
+}
+
+// Return TRUE if you set the cursor
+BOOL CGridCellBase::OnSetCursor()
+{
+#ifndef _WIN32_WCE_NO_CURSOR
+    SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
+#endif
+    return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCellBase editing
+
+void CGridCellBase::OnEndEdit() 
+{
+//	ASSERT( FALSE); 
+}
+
+BOOL CGridCellBase::ValidateEdit(LPCTSTR str)
+{
+    UNUSED_ALWAYS(str);
+	return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCellBase Sizing
+
+BOOL CGridCellBase::GetTextRect( LPRECT pRect)  // i/o:  i=dims of cell rect; o=dims of text rect
+{
+    if (GetImage() >= 0)
+    {
+        IMAGEINFO Info;
+
+        CGridCtrl* pGrid = GetGrid();
+        CImageList* pImageList = pGrid->GetImageList();
+        
+        if (pImageList && pImageList->GetImageInfo( GetImage(), &Info))
+        {
+            int nImageWidth = Info.rcImage.right-Info.rcImage.left+1;
+            pRect->left += nImageWidth + GetMargin();
+        }
+    }
+
+    return TRUE;
+}
+
+// By default this uses the selected font (which is a bigger font)
+CSize CGridCellBase::GetTextExtent(LPCTSTR szText, CDC* pDC /*= NULL*/)
+{
+    CGridCtrl* pGrid = GetGrid();
+//    ASSERT(pGrid);
+
+    BOOL bReleaseDC = FALSE;
+    if (pDC == NULL || szText == NULL)
+    {
+        if (szText)
+			pDC = pGrid->GetDC();
+        if (pDC == NULL || szText == NULL) 
+        {
+            CGridDefaultCell* pDefCell = (CGridDefaultCell*) GetDefaultCell();
+//            ASSERT(pDefCell);
+            return CSize(pDefCell->GetWidth(), pDefCell->GetHeight());
+        }
+        bReleaseDC = TRUE;
+    }
+
+    CFont *pOldFont = NULL,
+          *pFont = GetFontObject();
+    if (pFont)
+        pOldFont = pDC->SelectObject(pFont);
+
+    CSize size;
+    int nFormat = GetFormat();
+
+    // If the cell is a multiline cell, then use the width of the cell
+    // to get the height
+    if ((nFormat & DT_WORDBREAK) && !(nFormat & DT_SINGLELINE))
+    {
+        CString str = szText;
+        int nMaxWidth = 0;
+        while (TRUE)
+        {
+            int nPos = str.Find(_T('\n'));
+            CString TempStr = (nPos < 0)? str : str.Left(nPos);
+            int nTempWidth = pDC->GetTextExtent(TempStr).cx;
+            if (nTempWidth > nMaxWidth)
+                nMaxWidth = nTempWidth;
+
+            if (nPos < 0)
+                break;
+            str = str.Mid(nPos + 1);    // Bug fix by Thomas Steinborn
+        }
+        
+        CRect rect;
+        rect.SetRect(0,0, nMaxWidth+1, 0);
+        pDC->DrawText(szText, -1, rect, nFormat | DT_CALCRECT);
+        size = rect.Size();
+    }
+    else
+        size = pDC->GetTextExtent(szText, (int)_tcslen(szText));
+
+    // Removed by Yogurt
+    //TEXTMETRIC tm;
+    //pDC->GetTextMetrics(&tm);
+    //size.cx += (tm.tmOverhang);
+
+    if (pOldFont)
+        pDC->SelectObject(pOldFont);
+    
+    size += CSize(2*GetMargin(), 2*GetMargin());
+
+    // Kludge for vertical text
+    LOGFONT *pLF = GetFont();
+    if (pLF->lfEscapement == 900 || pLF->lfEscapement == -900)
+    {
+        int nTemp = size.cx;
+        size.cx = size.cy;
+        size.cy = nTemp;
+        size += CSize(0, 4*GetMargin());
+    }
+    
+    if (bReleaseDC)
+        pGrid->ReleaseDC(pDC);
+
+    return size;
+}
+
+
+CSize CGridCellBase::GetCellExtent(CDC* pDC)
+{    
+    CSize size = GetTextExtent(GetText(), pDC);    
+    CSize ImageSize(0,0);    
+    
+    int nImage = GetImage();    
+    if (nImage >= 0)    
+    {        
+        CGridCtrl* pGrid = GetGrid();        
+//        ASSERT(pGrid);        
+        IMAGEINFO Info;        
+        if (pGrid->GetImageList() && pGrid->GetImageList()->GetImageInfo(nImage, &Info))         
+        {            
+            ImageSize = CSize(Info.rcImage.right-Info.rcImage.left,                                 
+                Info.rcImage.bottom-Info.rcImage.top);            
+            if (size.cx > 2*(int)GetMargin ())                
+                ImageSize.cx += GetMargin();            
+            ImageSize.cy += 2*(int)GetMargin ();        
+        }    
+    }    
+    size.cx += ImageSize.cx + 1;    
+    size.cy = max(size.cy, ImageSize.cy) + 1;    
+    if (IsFixed())    
+    {        
+        size.cx++;        
+        size.cy++;    
+    }    
+    return size;
+}
+
+// EFW - Added to print cells so that grids that use different colors are
+// printed correctly.
+BOOL CGridCellBase::PrintCell(CDC* pDC, int /*nRow*/, int /*nCol*/, CRect rect)
+{
+#if defined(_WIN32_WCE_NO_PRINTING) || defined(GRIDCONTROL_NO_PRINTING)
+    return FALSE;
+#else
+    COLORREF crFG, crBG;
+    GV_ITEM Item;
+
+    CGridCtrl* pGrid = GetGrid();
+    if (!pGrid || !pDC)
+        return FALSE;
+
+    if( rect.Width() <= 0
+        || rect.Height() <= 0)  // prevents imagelist item from drawing even
+        return FALSE;           //  though cell is hidden
+
+    int nSavedDC = pDC->SaveDC();
+
+    pDC->SetBkMode(TRANSPARENT);
+
+    if (pGrid->GetShadedPrintOut())
+    {
+        // Get the default cell implementation for this kind of cell. We use it if this cell
+        // has anything marked as "default"
+        CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell();
+        if (!pDefaultCell)
+            return FALSE;
+
+        // Use custom color if it doesn't match the default color and the
+        // default grid background color.  If not, leave it alone.
+        if(IsFixed())
+            crBG = (GetBackClr() != CLR_DEFAULT) ? GetBackClr() : pDefaultCell->GetBackClr();
+        else
+            crBG = (GetBackClr() != CLR_DEFAULT && GetBackClr() != pDefaultCell->GetBackClr()) ?
+                GetBackClr() : CLR_DEFAULT;
+
+        // Use custom color if the background is different or if it doesn't
+        // match the default color and the default grid text color.  
+        if(IsFixed())
+            crFG = (GetBackClr() != CLR_DEFAULT) ? GetTextClr() : pDefaultCell->GetTextClr();
+        else
+            crFG = (GetBackClr() != CLR_DEFAULT) ? GetTextClr() : pDefaultCell->GetTextClr();
+
+        // If not printing on a color printer, adjust the foreground color
+        // to a gray scale if the background color isn't used so that all
+        // colors will be visible.  If not, some colors turn to solid black
+        // or white when printed and may not show up.  This may be caused by
+        // coarse dithering by the printer driver too (see image note below).
+        if(pDC->GetDeviceCaps(NUMCOLORS) == 2 && crBG == CLR_DEFAULT)
+            crFG = RGB(GetRValue(crFG) * 0.30, GetGValue(crFG) * 0.59,
+                GetBValue(crFG) * 0.11);
+
+        // Only erase the background if the color is not the default
+        // grid background color.
+        if(crBG != CLR_DEFAULT)
+        {
+            CBrush brush(crBG);
+            rect.right++; rect.bottom++;
+            pDC->FillRect(rect, &brush);
+            rect.right--; rect.bottom--;
+        }
+    }
+    else
+    {
+        crBG = CLR_DEFAULT;
+        crFG = RGB(0, 0, 0);
+    }
+
+    pDC->SetTextColor(crFG);
+
+    CFont *pFont = GetFontObject();
+    if (pFont)
+        pDC->SelectObject(pFont);
+
+    /*
+    // ***************************************************
+    // Disabled - if you need this functionality then you'll need to rewrite.
+    // Create the appropriate font and select into DC.
+    CFont Font;
+    // Bold the fixed cells if not shading the print out.  Use italic
+    // font it it is enabled.
+    const LOGFONT* plfFont = GetFont();
+    if(IsFixed() && !pGrid->GetShadedPrintOut())
+    {
+        Font.CreateFont(plfFont->lfHeight, 0, 0, 0, FW_BOLD, plfFont->lfItalic, 0, 0,
+            ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+#ifndef _WIN32_WCE
+            PROOF_QUALITY,
+#else
+            DEFAULT_QUALITY,
+#endif
+            VARIABLE_PITCH | FF_SWISS, plfFont->lfFaceName);
+    }
+    else
+        Font.CreateFontIndirect(plfFont);
+
+    pDC->SelectObject(&Font);
+    // ***************************************************
+    */
+
+    // Draw lines only when wanted on fixed cells.  Normal cell grid lines
+    // are handled in OnPrint.
+    if(pGrid->GetGridLines() != GVL_NONE && IsFixed())
+    {
+        CPen lightpen(PS_SOLID, 1,  ::GetSysColor(COLOR_3DHIGHLIGHT)),
+             darkpen(PS_SOLID,  1, ::GetSysColor(COLOR_3DDKSHADOW)),
+            *pOldPen = pDC->GetCurrentPen();
+
+        pDC->SelectObject(&lightpen);
+        pDC->MoveTo(rect.right, rect.top);
+        pDC->LineTo(rect.left, rect.top);
+        pDC->LineTo(rect.left, rect.bottom);
+
+        pDC->SelectObject(&darkpen);
+        pDC->MoveTo(rect.right, rect.top);
+        pDC->LineTo(rect.right, rect.bottom);
+        pDC->LineTo(rect.left, rect.bottom);
+
+        rect.DeflateRect(1,1);
+        pDC->SelectObject(pOldPen);
+    }
+
+    rect.DeflateRect(GetMargin(), 0);
+
+    if(pGrid->GetImageList() && GetImage() >= 0)
+    {
+        // NOTE: If your printed images look like fuzzy garbage, check the
+        //       settings on your printer driver.  If it's using coarse
+        //       dithering and/or vector graphics, they may print wrong.
+        //       Changing to fine dithering and raster graphics makes them
+        //       print properly.  My HP 4L had that problem.
+
+        IMAGEINFO Info;
+        if(pGrid->GetImageList()->GetImageInfo(GetImage(), &Info))
+        {
+            int nImageWidth = Info.rcImage.right-Info.rcImage.left;
+            pGrid->GetImageList()->Draw(pDC, GetImage(), rect.TopLeft(), ILD_NORMAL);
+            rect.left += nImageWidth+GetMargin();
+        }
+    }
+
+    // Draw without clipping so as not to lose text when printed for real
+	// DT_NOCLIP removed 01.01.01. Slower, but who cares - we are printing!
+    DrawText(pDC->m_hDC, GetText(), -1, rect,
+        GetFormat() | /*DT_NOCLIP | */ DT_NOPREFIX);
+
+    pDC->RestoreDC(nSavedDC);
+
+    return TRUE;
+#endif
+}
+
+/*****************************************************************************
+Callable by derived classes, only
+*****************************************************************************/
+LRESULT CGridCellBase::SendMessageToParent(int nRow, int nCol, int nMessage)
+{
+    CGridCtrl* pGrid = GetGrid();
+    if( pGrid)
+        return pGrid->SendMessageToParent(nRow, nCol, nMessage);
+    else
+        return 0;
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/GridCellBase.h b/Common_Class/SISControls/GridControl/GridCellBase.h
new file mode 100644
index 0000000..f7804c2
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridCellBase.h
@@ -0,0 +1,172 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCellBase.h : header file
+//
+// MFC Grid Control - Grid cell base class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridCtrl;
+
+// Cell states
+#define GVIS_FOCUSED            0x0001
+#define GVIS_SELECTED           0x0002
+#define GVIS_DROPHILITED        0x0004
+#define GVIS_READONLY           0x0008
+#define GVIS_FIXED              0x0010
+#define GVIS_FIXEDROW           0x0020
+#define GVIS_FIXEDCOL           0x0040
+#define GVIS_MODIFIED           0x0080
+
+// Cell data mask
+#define GVIF_TEXT               LVIF_TEXT
+#define GVIF_IMAGE              LVIF_IMAGE
+#define GVIF_PARAM              LVIF_PARAM
+#define GVIF_STATE              LVIF_STATE
+#define GVIF_BKCLR              (GVIF_STATE<<1)
+#define GVIF_FGCLR              (GVIF_STATE<<2)
+#define GVIF_FORMAT             (GVIF_STATE<<3)
+#define GVIF_FONT               (GVIF_STATE<<4)
+#define GVIF_MARGIN             (GVIF_STATE<<5)
+#define GVIF_ALL                (GVIF_TEXT|GVIF_IMAGE|GVIF_PARAM|GVIF_STATE|GVIF_BKCLR|GVIF_FGCLR| \
+                                 GVIF_FORMAT|GVIF_FONT|GVIF_MARGIN)
+
+// Used for Get/SetItem calls.
+typedef struct _GV_ITEM {
+    int      row,col;     // Row and Column of item
+    UINT     mask;        // Mask for use in getting/setting cell data
+    UINT     nState;      // cell state (focus/hilighted etc)
+    DWORD    nFormat;     // Format of cell
+    int      iImage;      // index of the list view item抯 icon
+    COLORREF crBkClr;     // Background colour (or CLR_DEFAULT)
+    COLORREF crFgClr;     // Forground colour (or CLR_DEFAULT)
+    LPARAM   lParam;      // 32-bit value to associate with item
+    LOGFONT  lfFont;      // Cell font
+    UINT     nMargin;     // Internal cell margin
+    CString  strText;     // Text in cell
+} GV_ITEM;
+
+
+// Each cell contains one of these. Fields "row" and "column" are not stored since we
+// will usually have acces to them in other ways, and they are an extra 8 bytes per
+// cell that is probably unnecessary.
+
+class AFX_EXT_CLASS CGridCellBase : public CObject
+{
+    friend class CGridCtrl;
+    DECLARE_DYNAMIC(CGridCellBase)
+
+// Construction/Destruction
+public:
+    CGridCellBase();
+    virtual ~CGridCellBase();
+
+// Attributes
+public:
+    virtual void SetText(LPCTSTR /* szText */)              = 0 ;
+    virtual void SetImage(int /* nImage */)                 = 0 ;
+    virtual void SetData(LPARAM /* lParam */)               = 0 ;
+    virtual void SetState(DWORD nState)                     { m_nState = nState; }
+    virtual void SetFormat(DWORD /* nFormat */)             = 0 ;
+    virtual void SetTextClr(COLORREF /* clr */)             = 0 ;
+    virtual void SetBackClr(COLORREF /* clr */)             = 0 ;
+    virtual void SetFont(const LOGFONT* /* plf */)          = 0 ;
+    virtual void SetMargin( UINT /* nMargin */)             = 0 ;
+    virtual void SetGrid(CGridCtrl* /* pGrid */)            = 0 ;
+    virtual void SetCoords( int /* nRow */, int /* nCol */) = 0 ;
+
+    virtual LPCTSTR    GetText()       const                = 0 ;
+    virtual LPCTSTR    GetTipText()    const                { return GetText(); } // may override TitleTip return
+    virtual int        GetImage()      const                = 0 ;
+    virtual LPARAM     GetData()       const                = 0 ;
+    virtual DWORD      GetState()      const                { return m_nState;  }
+    virtual DWORD      GetFormat()     const                = 0 ;
+    virtual COLORREF   GetTextClr()    const                = 0 ;
+    virtual COLORREF   GetBackClr()    const                = 0 ;
+    virtual LOGFONT  * GetFont()       const                = 0 ;
+    virtual CFont    * GetFontObject() const                = 0 ;
+    virtual CGridCtrl* GetGrid()       const                = 0 ;
+    virtual CWnd     * GetEditWnd()    const                = 0 ;
+    virtual UINT       GetMargin()     const                = 0 ;
+
+    virtual CGridCellBase* GetDefaultCell() const;
+
+    virtual BOOL IsDefaultFont()       const                = 0 ;
+    virtual BOOL IsEditing()           const                = 0 ;
+    virtual BOOL IsFocused()           const                { return (m_nState & GVIS_FOCUSED);  }
+    virtual BOOL IsFixed()             const                { return (m_nState & GVIS_FIXED);    }
+    virtual BOOL IsFixedCol()          const                { return (m_nState & GVIS_FIXEDCOL); }
+    virtual BOOL IsFixedRow()          const                { return (m_nState & GVIS_FIXEDROW); }
+    virtual BOOL IsSelected()          const                { return (m_nState & GVIS_SELECTED); }
+    virtual BOOL IsReadOnly()          const                { return (m_nState & GVIS_READONLY); }
+    virtual BOOL IsModified()          const                { return (m_nState & GVIS_MODIFIED); }
+    virtual BOOL IsDropHighlighted()   const                { return (m_nState & GVIS_DROPHILITED); }
+
+// Operators
+public:
+    virtual void operator=(const CGridCellBase& cell);
+
+// Operations
+public:
+    virtual void Reset();
+
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+    virtual BOOL GetTextRect( LPRECT pRect);    // i/o:  i=dims of cell rect; o=dims of text rect
+    virtual BOOL GetTipTextRect( LPRECT pRect) { return GetTextRect( pRect); }  // may override for btns, etc.
+    virtual CSize GetTextExtent(LPCTSTR str, CDC* pDC = NULL);
+    virtual CSize GetCellExtent(CDC* pDC);
+
+    // Editing
+    virtual BOOL Edit( int /* nRow */, int /* nCol */, CRect /* rect */, CPoint /* point */, 
+                       UINT /* nID */, UINT /* nChar */) { return FALSE;}
+	virtual BOOL ValidateEdit(LPCTSTR str);
+    virtual void EndEdit() {}
+
+    // EFW - Added to print cells properly
+    virtual BOOL PrintCell(CDC* pDC, int nRow, int nCol, CRect rect);
+
+    // add additional protected grid members required of cells
+    LRESULT SendMessageToParent(int nRow, int nCol, int nMessage);
+
+protected:
+    virtual void OnEndEdit();
+    virtual void OnMouseEnter();
+    virtual void OnMouseOver();
+    virtual void OnMouseLeave();
+    virtual void OnClick( CPoint PointCellRelative);
+    virtual void OnClickDown( CPoint PointCellRelative);
+    virtual void OnRClick( CPoint PointCellRelative);
+    virtual void OnDblClick( CPoint PointCellRelative);
+    virtual BOOL OnSetCursor();
+
+protected:
+    DWORD    m_nState;      // Cell state (selected/focus etc)
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/GridCellButton.cpp b/Common_Class/SISControls/GridControl/GridCellButton.cpp
new file mode 100644
index 0000000..bd98011
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridCellButton.cpp
@@ -0,0 +1,47 @@
+#include "..\\stdafx.h"
+#include "GridCell.h"
+#include "GridCtrl.h"
+#include "GridCellButton.h"  
+
+
+#ifdef _DEBUG  
+#define new DEBUG_NEW  
+#undef THIS_FILE  
+static char THIS_FILE[] = __FILE__;
+#endif  
+
+IMPLEMENT_DYNCREATE(CGridCellButton, CGridCell)
+	CGridCellButton::CGridCellButton(void)
+{
+	m_bPushing = FALSE;
+}
+
+CGridCellButton::~CGridCellButton(void)
+{
+}
+
+BOOL CGridCellButton::Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd /* = TRUE */)
+{
+	m_rect = rect;
+	pDC->SetBkMode(TRANSPARENT);
+	rect.DeflateRect(GetMargin(), 0);
+	CFont* pOldFont = pDC->SelectObject(GetFontObject());
+	pDC->DrawFrameControl(rect, DFC_BUTTON, m_bPushing ? DFCS_BUTTONPUSH | DFCS_PUSHED : DFCS_BUTTONPUSH);
+	COLORREF ColorCurrent = pDC->GetTextColor();
+	pDC->SetTextColor(::GetSysColor(COLOR_BTNTEXT));
+	pDC->DrawText(GetText(), -1, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS);
+	pDC->SetTextColor(ColorCurrent);
+	return TRUE;
+}
+
+void CGridCellButton::OnClick(CPoint PointCellRelative)
+{
+	m_bPushing = !m_bPushing;
+	GetGrid()->InvalidateRect(m_rect);
+}
+
+void CGridCellButton::OnMouseLeave()
+{
+	m_bPushing = FALSE;
+	GetGrid()->InvalidateRect(m_rect);
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/GridCellButton.h b/Common_Class/SISControls/GridControl/GridCellButton.h
new file mode 100644
index 0000000..6b04419
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridCellButton.h
@@ -0,0 +1,28 @@
+#ifndef __GRID_CELL_BUTTON__
+#define __GRID_CELL_BUTTON__
+
+#include "GridCell.h"
+
+class AFX_EXT_CLASS CGridCellButton : public CGridCell
+{
+	friend class CGridCtrl;
+	DECLARE_DYNCREATE(CGridCellButton)
+
+public:
+	CGridCellButton(void);
+	virtual ~CGridCellButton(void);
+
+	void SetPushing(BOOL bPush) {m_bPushing = bPush;}
+
+public:
+	virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+protected:
+	virtual void OnClick(CPoint PointCellRelative);
+	virtual void OnMouseLeave();
+
+protected:
+	CRect m_rect;
+	BOOL m_bPushing;
+};
+#endif
diff --git a/Common_Class/SISControls/GridControl/GridCtrl.cpp b/Common_Class/SISControls/GridControl/GridCtrl.cpp
new file mode 100644
index 0000000..80c9b5c
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridCtrl.cpp
@@ -0,0 +1,8426 @@
+// GridCtrl.cpp : implementation file
+//
+// MFC Grid Control v2.26
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// The code contained in this file was based on the original
+// WorldCom Grid control written by Joe Willcoxson,
+//        mailto:chinajoe@aol.com
+//        http://users.aol.com/chinajoe
+// (These addresses may be out of date) The code has gone through 
+// so many modifications that I'm not sure if there is even a single 
+// original line of code. In any case Joe's code was a great 
+// framework on which to build.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// Expect bugs!
+// 
+// Please use and enjoy, and let me know of any bugs/mods/improvements 
+// that you have found/implemented and I will fix/incorporate them into 
+// this file. 
+//
+//  History:
+//  --------
+//  This control is constantly evolving, sometimes due to new features that I
+//  feel are necessary, and sometimes due to existing bugs. Where possible I
+//  have credited the changes to those who contributed code corrections or
+//  enhancements (names in brackets) or code suggestions (suggested by...)
+//
+//          1.0 - 1.13   20 Feb 1998 - 6 May 1999
+//                          First release version. Progressed from being a basic
+//                          grid based on the original WorldCom Grid control
+//                          written by Joe Willcoxson (mailto:chinajoe@aol.com,
+//                          http://users.aol.com/chinajoe) to something a little
+//                          more feature rich. Rewritten so many times I doubt
+//                          there is a single line of Joe's code left. Many, many,
+//                          MANY people sent in bug reports and fixes. Thank you
+//                          all.
+//
+//          2.0         1 Feb 2000
+//                          Rewritten to make the grid more object oriented, in
+//                          that the CGridCell class now takes care of cell-specific
+//                          tasks. This makes the code more robust, but more
+//                          importantly it allows the simple insertion of other
+//                          types of cells.
+//                          
+//          2.10       11 Mar 2000 - Ken Bertelson and Chris Maunder
+//                          - Additions for virtual CGridCell support of embedded tree 
+//                            & cell buttons implementation
+//                          - Optional WYSIWYG printing
+//                          - Awareness of hidden (0 width/height) rows and columns for 
+//                            key movements,  cut, copy, paste, and autosizing
+//                          - CGridCell can make title tips display any text rather than 
+//                            cell text only
+//                          - Minor vis bug fixes
+//                          - CGridCtrl now works with CGridCellBase instead of CGridCell
+//                            This is a taste of things to come.
+//
+//          2.20       30 Jul 2000 - Chris Maunder
+//                          - Font storage optimised (suggested by Martin Richter)
+//                          - AutoSizeColumn works on either column header, data or both
+//                          - EnsureVisible. The saga continues... (Ken)
+//                          - Rewrote exception handling
+//                          - Added TrackFocusCell and FrameFocusCell properties, as well as
+//                            ExpandLastColumn (suggested by Bruce E. Stemplewski).
+//                          - InsertColumn now allows you to insert columns at the end of the
+//                            column range (David Weibel)
+//                          - Shift-cell-selection more intuitive
+//                          - API change: Set/GetGridColor now Set/GetGridLineColor
+//                          - API change: Set/GetBkColor now Set/GetGridBkColor
+//                          - API change: Set/GetTextColor, Set/GetTextBkColor depricated 
+//                          - API change: Set/GetFixedTextColor, Set/GetFixedBkColor depricated 
+//                          - Stupid DDX_GridControl workaround removed.
+//                          - Added "virtual mode" via Set/GetVirtualMode
+//                          - Added SetCallbackFunc to allow callback functions in virtual mode
+//                          - Added Set/GetAutoSizeStyle
+//                          - AutoSize() bug fixed
+//                          - added GVIS_FIXEDROW, GVIS_FIXEDCOL states
+//                          - added Get/SetFixed[Row|Column]Selection
+//                          - cell "Get" methods now const'd. Sorry folks...
+//                          - GetMouseScrollLines now uses win98/W2K friendly code
+//                          - WS_EX_CLIENTEDGE style now implicit
+//
+//                          [ Only the latest version and major version changes will be shown ]
+////
+//          2.25       13 Mar 2004 - Chris Maunder
+//                                 - Minor changes so it will compile in VS.NET (inc. Whidbey)
+//                                 - Fixed minor bug in EnsureVisible - Junlin Xu
+//                                 - Changed AfxGetInstanceHandle for AfxGetResourceHandle in RegisterWindowClass
+//					               - Various changes thanks to Yogurt
+//
+//          2.26       13 Dec 2005 - Pierre Couderc
+//                                 - Added sort in Virtual mode
+//                                 - Change row/column order programatically or via drag and drop
+//                                 - Added save/restore layer (for undoing row/column order changes)
+//
+// TODO:   1) Implement sparse grids (super easy now)
+//         2) Fix it so that as you drag select, the speed of selection increases
+//            with time.
+//         3) Scrolling is still a little dodgy (too much grey area). I know there
+//            is a simple fix but it's been a low priority
+//
+// ISSUES: 1) WindowFromPoint seems to do weird things in W2K. Causing problems for
+//            the rigt-click-on-titletip code.
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "..\\stdafx.h"
+#include "GridMemDC.h"
+#include "GridCtrl.h"
+#include <algorithm>
+
+// OLE stuff for clipboard operations
+#include <afxadv.h>            // For CSharedFile
+#include <afxconv.h>           // For LPTSTR -> LPSTR macros
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+// Spit out some messages as a sanity check for programmers
+#ifdef GRIDCONTROL_NO_TITLETIPS
+#pragma message(" -- CGridCtrl: No titletips for cells with large data")
+#endif
+#ifdef GRIDCONTROL_NO_DRAGDROP
+#pragma message(" -- CGridCtrl: No OLE drag and drop")
+#endif
+#ifdef GRIDCONTROL_NO_CLIPBOARD
+#pragma message(" -- CGridCtrl: No clipboard support")
+#endif
+#ifdef GRIDCONTROL_NO_PRINTING
+#pragma message(" -- CGridCtrl: No printing support")
+#endif
+
+
+IMPLEMENT_DYNCREATE(CGridCtrl, CWnd)
+
+
+// Get the number of lines to scroll with each mouse wheel notch
+// Why doesn't windows give us this function???
+UINT GetMouseScrollLines()
+{
+    int nScrollLines = 3;            // reasonable default
+
+#ifndef _WIN32_WCE
+    // Do things the hard way in win95
+    OSVERSIONINFO VersionInfo;
+    VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+    if (!GetVersionEx(&VersionInfo) || 
+        (VersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS && VersionInfo.dwMinorVersion == 0))
+    {
+        HKEY hKey;
+        if (RegOpenKeyEx(HKEY_CURRENT_USER,  _T("Control Panel\\Desktop"),
+            0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
+        {
+            TCHAR szData[128];
+            DWORD dwKeyDataType;
+            DWORD dwDataBufSize = sizeof(szData);
+            
+            if (RegQueryValueEx(hKey, _T("WheelScrollLines"), NULL, &dwKeyDataType,
+                (LPBYTE) &szData, &dwDataBufSize) == ERROR_SUCCESS)
+            {
+                nScrollLines = _tcstoul(szData, NULL, 10);
+            }
+            RegCloseKey(hKey);
+        }
+    }
+    // win98 or greater
+    else
+           SystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &nScrollLines, 0);
+#endif
+
+    return nScrollLines;
+}
+
+CRect  CGridCtrl::rectNull(0, 0, 0, 0);
+CCellID CGridCtrl::cellNull(0, 0);
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl
+
+CGridCtrl::CGridCtrl(int nRows, int nCols, int nFixedRows, int nFixedCols)
+{
+    RegisterWindowClass();
+
+#if !defined(GRIDCONTROL_NO_DRAGDROP) || !defined(GRIDCONTROL_NO_CLIPBOARD)
+    _AFX_THREAD_STATE* pState = AfxGetThreadState();
+    if (!pState->m_bNeedTerm && !AfxOleInit())
+        AfxMessageBox(_T("OLE initialization failed. Make sure that the OLE libraries are the correct version"));
+#endif
+
+    // Store the system colours in case they change. The gridctrl uses
+    // these colours, and in OnSysColorChange we can check to see if
+    // the gridctrl colours have been changed from the system colours.
+    // If they have, then leave them, otherwise change them to reflect
+    // the new system colours.
+    m_crWindowText        = ::GetSysColor(COLOR_WINDOWTEXT);
+    m_crWindowColour      = ::GetSysColor(COLOR_WINDOW);
+    m_cr3DFace            = ::GetSysColor(COLOR_3DFACE);
+    m_crShadow            = ::GetSysColor(COLOR_3DSHADOW);
+    m_crGridLineColour    = RGB(192,192,192);
+
+    m_nRows               = 0;
+    m_nCols               = 0;
+    m_nFixedRows          = 0;
+    m_nFixedCols          = 0;
+	m_InDestructor        = false;
+
+    m_bVirtualMode        = FALSE;
+    m_pfnCallback         = NULL;
+
+    m_nVScrollMax         = 0;          // Scroll position
+    m_nHScrollMax         = 0;
+    m_nRowsPerWheelNotch  = GetMouseScrollLines(); // Get the number of lines
+                                                   // per mouse wheel notch to scroll
+    m_nBarState           = GVL_NONE;
+    m_MouseMode           = MOUSE_NOTHING;
+    m_nGridLines          = GVL_BOTH;
+    m_bEditable           = TRUE;
+    m_bListMode           = FALSE;
+    m_bSingleRowSelection = FALSE;
+    m_bSingleColSelection = FALSE;
+    m_bLMouseButtonDown   = FALSE;
+    m_bRMouseButtonDown   = FALSE;
+    m_bAllowDraw          = TRUE;       // allow draw updates
+    m_bEnableSelection    = TRUE;
+    m_bFixedColumnSelection = TRUE;
+    m_bFixedRowSelection  = TRUE;
+    m_bAllowRowResize     = TRUE;
+    m_bAllowColumnResize  = TRUE;
+    m_bSortOnClick        = FALSE;      // Sort on header row click
+    m_bHandleTabKey       = TRUE;
+#ifdef _WIN32_WCE
+    m_bDoubleBuffer       = FALSE;      // Use double buffering to avoid flicker?
+#else
+    m_bDoubleBuffer       = TRUE;       // Use double buffering to avoid flicker?
+#endif
+    m_bTitleTips          = TRUE;       // show cell title tips
+
+    m_bWysiwygPrinting    = FALSE;      // use size-to-width printing
+
+    m_bHiddenColUnhide    = TRUE;       // 0-width columns can be expanded via mouse
+    m_bHiddenRowUnhide    = TRUE;       // 0-Height rows can be expanded via mouse
+
+    m_bAllowColHide       = TRUE;       // Columns can be contracted to 0-width via mouse
+    m_bAllowRowHide       = TRUE;       // Rows can be contracted to 0-height via mouse
+
+    m_bAscending          = TRUE;       // sorting stuff
+    m_nSortColumn         = -1;
+	m_pfnCompare		  = NULL;
+	m_pfnVirtualCompare   = NULL;
+    m_nAutoSizeColumnStyle = GVS_BOTH;  // Autosize grid using header and data info
+
+    m_nTimerID            = 0;          // For drag-selection
+    // LUC
+	m_nTimerInterval      = 150;         // (in milliseconds)
+    m_nResizeCaptureRange = 3;          // When resizing columns/row, the cursor has to be
+                                        // within +/-3 pixels of the dividing line for
+                                        // resizing to be possible
+    m_pImageList          = NULL;       // Images in the grid
+    m_bAllowDragAndDrop   = FALSE;      // for drag and drop - EFW - off by default
+    m_bTrackFocusCell     = FALSE;       // Track Focus cell?
+    m_bFrameFocus         = TRUE;       // Frame the selected cell?
+	m_AllowReorderColumn	= false;
+	m_QuitFocusOnTab = false;
+	m_AllowSelectRowInFixedCol = false;
+	m_bDragRowMode = TRUE; // allow to drop a line over another one to change row order
+    m_pRtcDefault = RUNTIME_CLASS(CGridCell);
+
+    SetupDefaultCells();
+    SetGridBkColor(m_crShadow);
+
+    // Set up the initial grid size
+    SetRowCount(nRows);
+    SetColumnCount(nCols);
+    SetFixedRowCount(nFixedRows);
+    SetFixedColumnCount(nFixedCols);
+	// LUC
+	m_nFreezedRows = 0;
+	m_nFreezedCols = 0;
+
+	// LUC
+	m_bExcludeFreezedRowsFromSelection = FALSE;
+	m_bExcludeFreezedColsFromSelection = FALSE;
+
+    SetTitleTipTextClr(CLR_DEFAULT);  //FNA
+    SetTitleTipBackClr(CLR_DEFAULT); 
+
+    // set initial selection range (ie. none)
+    m_SelectedCellMap.RemoveAll();
+    m_PrevSelectedCellMap.RemoveAll();
+
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+    // EFW - Added to support shaded/unshaded printout and
+    // user-definable margins.
+    m_bShadedPrintOut = TRUE;
+    SetPrintMarginInfo(2, 2, 4, 4, 1, 1, 1);
+#endif	
+
+	// LUC
+	m_bDrawingMergedCell = FALSE;
+	m_nCurrentMergeID = -1;
+	// LUC
+	m_bShowHorzNonGridArea = FALSE;
+}
+
+CGridCtrl::~CGridCtrl()
+{
+	m_InDestructor = true;
+    DeleteAllItems();
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+    if (m_bTitleTips && ::IsWindow(m_TitleTip.GetSafeHwnd())) 
+        m_TitleTip.DestroyWindow();
+#endif
+
+    DestroyWindow();
+
+#if !defined(GRIDCONTROL_NO_DRAGDROP) || !defined(GRIDCONTROL_NO_CLIPBOARD)
+    // BUG FIX - EFW
+    COleDataSource *pSource = COleDataSource::GetClipboardOwner();
+    if(pSource)
+        COleDataSource::FlushClipboard();
+#endif
+}
+
+// Register the window class if it has not already been registered.
+BOOL CGridCtrl::RegisterWindowClass()
+{
+    WNDCLASS wndcls;
+    //HINSTANCE hInst = AfxGetInstanceHandle();
+    HINSTANCE hInst = AfxGetResourceHandle();
+
+    if (!(::GetClassInfo(hInst, GRIDCTRL_CLASSNAME, &wndcls)))
+    {
+        // otherwise we need to register a new class
+        wndcls.style            = CS_DBLCLKS;
+        wndcls.lpfnWndProc      = ::DefWindowProc;
+        wndcls.cbClsExtra       = wndcls.cbWndExtra = 0;
+        wndcls.hInstance        = hInst;
+        wndcls.hIcon            = NULL;
+#ifndef _WIN32_WCE_NO_CURSOR
+        wndcls.hCursor          = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
+#else
+        wndcls.hCursor          = 0;
+#endif
+        wndcls.hbrBackground    = (HBRUSH) (COLOR_3DFACE + 1);
+        wndcls.lpszMenuName     = NULL;
+        wndcls.lpszClassName    = GRIDCTRL_CLASSNAME;
+
+        if (!AfxRegisterClass(&wndcls))
+        {
+            AfxThrowResourceException();
+            return FALSE;
+        }
+    }
+
+    return TRUE;
+}
+
+BOOL CGridCtrl::Initialise()
+{
+    // Stop re-entry problems
+    static BOOL bInProcedure = FALSE;
+    if (bInProcedure)
+        return FALSE;
+    bInProcedure = TRUE;
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+    m_TitleTip.SetParentWnd(this);
+#endif
+
+	// This would be a good place to register the droptarget but
+	// unfortunately this causes problems if you are using the 
+	// grid in a view. 
+	// Moved from OnSize.
+//#ifndef GRIDCONTROL_NO_DRAGDROP
+//    m_DropTarget.Register(this);
+//#endif
+
+    if (::IsWindow(m_hWnd))
+        ModifyStyleEx(0, WS_EX_CLIENTEDGE);
+
+	// Kludge: Make sure the client edge shows
+	// This is so horrible it makes my eyes water.
+	CRect rect;
+	GetWindowRect(rect);
+	CWnd* pParent = GetParent();
+	if (pParent != NULL)
+		pParent->ScreenToClient(rect);
+	rect.InflateRect(1,1);	MoveWindow(rect);
+	rect.DeflateRect(1,1);  MoveWindow(rect);
+ 
+    bInProcedure = FALSE;
+    return TRUE;
+}
+
+// creates the control - use like any other window create control
+BOOL CGridCtrl::Create(const RECT& rect, CWnd* pParentWnd, UINT nID, DWORD dwStyle)
+{
+//    ASSERT(pParentWnd->GetSafeHwnd());
+
+    if (!CWnd::Create(GRIDCTRL_CLASSNAME, NULL, dwStyle, rect, pParentWnd, nID))
+        return FALSE;
+
+    //Initialise(); - called in PreSubclassWnd
+
+    // The number of rows and columns will only be non-zero if the constructor
+    // was called with non-zero initialising parameters. If this window was created
+    // using a dialog template then the number of rows and columns will be 0 (which
+    // means that the code below will not be needed - which is lucky 'cause it ain't
+    // gonna get called in a dialog-template-type-situation.
+
+    TRY
+    {
+        m_arRowHeights.SetSize(m_nRows);    // initialize row heights
+        m_arColWidths.SetSize(m_nCols);     // initialize column widths
+    }
+    CATCH (CMemoryException, e)
+    {
+        e->ReportError();
+        return FALSE;
+    }
+    END_CATCH
+
+    int i;
+    for (i = 0; i < m_nRows; i++)
+        m_arRowHeights[i] = m_cellDefault.GetHeight();
+    for (i = 0; i < m_nCols; i++)
+        m_arColWidths[i] = m_cellDefault.GetWidth();
+
+    return TRUE;
+}
+
+
+
+
+void CGridCtrl::SetupDefaultCells()
+{
+    m_cellDefault.SetGrid(this);            // Normal editable cell
+    m_cellFixedColDef.SetGrid(this);        // Cell for fixed columns
+    m_cellFixedRowDef.SetGrid(this);        // Cell for fixed rows
+    m_cellFixedRowColDef.SetGrid(this);     // Cell for area overlapped by fixed columns/rows
+
+    m_cellDefault.SetTextClr(m_crWindowText);   
+    m_cellDefault.SetBackClr(m_crWindowColour); 
+    m_cellFixedColDef.SetTextClr(m_crWindowText);
+    m_cellFixedColDef.SetBackClr(m_cr3DFace);
+    m_cellFixedRowDef.SetTextClr(m_crWindowText);
+    m_cellFixedRowDef.SetBackClr(m_cr3DFace);
+    m_cellFixedRowColDef.SetTextClr(m_crWindowText);
+    m_cellFixedRowColDef.SetBackClr(m_cr3DFace);
+}
+
+void CGridCtrl::PreSubclassWindow()
+{
+    CWnd::PreSubclassWindow();
+
+    //HFONT hFont = ::CreateFontIndirect(m_cellDefault.GetFont());
+    //OnSetFont((LPARAM)hFont, 0);
+    //DeleteObject(hFont);
+
+    Initialise();
+}
+
+// Sends a message to the parent in the form of a WM_NOTIFY message with
+// a NM_GRIDVIEW structure attached
+LRESULT CGridCtrl::SendMessageToParent(int nRow, int nCol, int nMessage) const
+{
+    if (!IsWindow(m_hWnd))
+        return 0;
+
+    NM_GRIDVIEW nmgv;
+    nmgv.iRow         = nRow;
+    nmgv.iColumn      = nCol;
+    nmgv.hdr.hwndFrom = m_hWnd;
+    nmgv.hdr.idFrom   = GetDlgCtrlID();
+    nmgv.hdr.code     = nMessage;
+
+    CWnd *pOwner = GetOwner();
+    if (pOwner && IsWindow(pOwner->m_hWnd))
+        return pOwner->SendMessage(WM_NOTIFY, nmgv.hdr.idFrom, (LPARAM)&nmgv);
+    else
+        return 0;
+}
+
+// Send a request to the parent to return information on a given cell
+LRESULT CGridCtrl::SendDisplayRequestToParent(GV_DISPINFO* pDisplayInfo) const
+{
+    if (!IsWindow(m_hWnd))
+        return 0;
+
+    // Fix up the message headers
+    pDisplayInfo->hdr.hwndFrom = m_hWnd;
+    pDisplayInfo->hdr.idFrom   = GetDlgCtrlID();
+    pDisplayInfo->hdr.code     = GVN_GETDISPINFO;
+
+    // Send the message
+    CWnd *pOwner = GetOwner();
+    if (pOwner && IsWindow(pOwner->m_hWnd))
+        return pOwner->SendMessage(WM_NOTIFY, pDisplayInfo->hdr.idFrom, (LPARAM)pDisplayInfo);
+    else
+        return 0;
+}
+
+// Send a hint to the parent about caching information
+LRESULT CGridCtrl::SendCacheHintToParent(const CCellRange& range) const
+{
+    if (!IsWindow(m_hWnd))
+        return 0;
+
+    GV_CACHEHINT CacheHint;
+
+    // Fix up the message headers
+    CacheHint.hdr.hwndFrom = m_hWnd;
+    CacheHint.hdr.idFrom   = GetDlgCtrlID();
+    CacheHint.hdr.code     = GVN_ODCACHEHINT;
+
+    CacheHint.range = range;
+
+    // Send the message
+    CWnd *pOwner = GetOwner();
+    if (pOwner && IsWindow(pOwner->m_hWnd))
+        return pOwner->SendMessage(WM_NOTIFY, CacheHint.hdr.idFrom, (LPARAM)&CacheHint);
+    else
+        return 0;
+}
+
+#define LAYER_SIGNATURE (0x5FD4E64)
+int CGridCtrl::GetLayer(int** pLayer) // used to save and restore order of columns
+{ //  gives back the size of the area (do not forget to delete pLayer)
+	int Length = 2+GetColumnCount()*2;
+	int *Layer = new int[Length];	// the caller is supposed to delete it
+	Layer[0]= LAYER_SIGNATURE;
+	Layer[1]= GetColumnCount();
+	memcpy(&Layer[2], &m_arColOrder[0], GetColumnCount()*sizeof(int));
+	memcpy(&Layer[2+GetColumnCount()], &m_arColWidths[0], GetColumnCount()*sizeof(int));
+	*pLayer = Layer;
+	return Length;
+}
+void CGridCtrl::SetLayer(int* pLayer)
+{ // coming from a previous GetLayer (ignored if not same number of column, or the same revision number)
+	if(pLayer[0] != LAYER_SIGNATURE) return;
+	if(pLayer[1] != GetColumnCount()) return;
+/*	TRACE("  %d == %d \n",m_arColOrder[0],pLayer[2]);
+	TRACE("  %d == %d \n",m_arColOrder[1],pLayer[3]);
+	TRACE("  %d == %d \n",m_arColOrder[2],pLayer[4]);
+	TRACE("  %d == %d \n",m_arColWidths[0],pLayer[2+3]);
+	TRACE("  %d == %d \n",m_arColWidths[1],pLayer[3+3]);
+	TRACE("  %d == %d \n",m_arColWidths[2],pLayer[4+3]);
+	TRACE("  %d == %d \n",GetColumnCount(),3);
+
+	
+	ASSERT(m_arColOrder[0]==pLayer[2]);
+	ASSERT(m_arColOrder[1]==pLayer[3]);
+	ASSERT(m_arColOrder[2]==pLayer[4]);
+	ASSERT(m_arColWidths[0]==pLayer[2+3]);
+	ASSERT(m_arColWidths[1]==pLayer[3+3]);
+	ASSERT(m_arColWidths[2]==pLayer[4+3]);
+	ASSERT(GetColumnCount()==3);
+*/	memcpy(&m_arColOrder[0],&pLayer[2], GetColumnCount()*sizeof(int));
+	memcpy(&m_arColWidths[0],&pLayer[2+GetColumnCount()], GetColumnCount()*sizeof(int));
+}
+
+BEGIN_MESSAGE_MAP(CGridCtrl, CWnd)
+//EFW - Added ON_WM_RBUTTONUP
+//{{AFX_MSG_MAP(CGridCtrl)
+    ON_WM_PAINT()
+    ON_WM_HSCROLL()
+    ON_WM_VSCROLL()
+    ON_WM_SIZE()
+    ON_WM_LBUTTONUP()
+    ON_WM_LBUTTONDOWN()
+    ON_WM_MOUSEMOVE()
+    ON_WM_TIMER()
+    ON_WM_GETDLGCODE()
+    ON_WM_KEYDOWN()
+    ON_WM_CHAR()
+    ON_WM_LBUTTONDBLCLK()
+    ON_WM_ERASEBKGND()
+    ON_UPDATE_COMMAND_UI(ID_EDIT_SELECT_ALL, OnUpdateEditSelectAll)
+    ON_COMMAND(ID_EDIT_SELECT_ALL, OnEditSelectAll)
+    ON_WM_SYSKEYDOWN()
+//}}AFX_MSG_MAP
+#ifndef _WIN32_WCE_NO_CURSOR
+    ON_WM_SETCURSOR()
+#endif
+#ifndef _WIN32_WCE
+    ON_WM_RBUTTONUP()
+    ON_WM_SYSCOLORCHANGE()
+    ON_WM_CAPTURECHANGED()
+#endif
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
+    ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateEditCopy)
+    ON_COMMAND(ID_EDIT_CUT, OnEditCut)
+    ON_UPDATE_COMMAND_UI(ID_EDIT_CUT, OnUpdateEditCut)
+    ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
+    ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, OnUpdateEditPaste)
+#endif
+#if (_WIN32_WCE >= 210)
+    ON_WM_SETTINGCHANGE()
+#endif
+#if !defined(_WIN32_WCE) && (_MFC_VER >= 0x0421)
+    ON_WM_MOUSEWHEEL()
+#endif
+    ON_MESSAGE(WM_SETFONT, OnSetFont)
+    ON_MESSAGE(WM_GETFONT, OnGetFont)
+    ON_MESSAGE(WM_IME_CHAR, OnImeChar)
+    ON_NOTIFY(GVN_ENDLABELEDIT, IDC_INPLACE_CONTROL, OnEndInPlaceEdit)
+	ON_NOTIFY(GVN_COMBOSELCHANGE, IDC_INPLACE_CONTROL, OnComboSelChange)
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl message handlers
+
+void CGridCtrl::OnPaint()
+{
+    CPaintDC dc(this);      // device context for painting
+
+    if (m_bDoubleBuffer)    // Use a memory DC to remove flicker
+    {
+        CGridMemDC MemDC(&dc);
+        OnDraw(&MemDC);
+    }
+    else                    // Draw raw - this helps in debugging vis problems.
+        OnDraw(&dc);
+}
+
+BOOL CGridCtrl::OnEraseBkgnd(CDC* /*pDC*/)
+{
+    return TRUE;    // Don't erase the background.
+}
+
+// Custom background erasure. This gets called from within the OnDraw function,
+// since we will (most likely) be using a memory DC to stop flicker. If we just
+// erase the background normally through OnEraseBkgnd, and didn't fill the memDC's
+// selected bitmap with colour, then all sorts of vis problems would occur
+void CGridCtrl::EraseBkgnd(CDC* pDC)
+{	
+    CRect  VisRect, ClipRect, rect;
+    CBrush FixedRowColBack(GetDefaultCell(TRUE, TRUE)->GetBackClr()),
+           FixedRowBack(GetDefaultCell(TRUE, FALSE)->GetBackClr()),
+           FixedColBack(GetDefaultCell(FALSE, TRUE)->GetBackClr()),
+           TextBack(GetDefaultCell(FALSE, FALSE)->GetBackClr());
+    CBrush Back(GetGridBkColor()); 
+    
+    if (pDC->GetClipBox(ClipRect) == ERROR)
+        return;
+    GetVisibleNonFixedCellRange(VisRect);
+
+    int nFixedColumnWidth = GetFixedColumnWidth();
+    int nFixedRowHeight = GetFixedRowHeight();
+
+    // Draw Fixed row/column background
+    if (ClipRect.left < nFixedColumnWidth && ClipRect.top < nFixedRowHeight)
+        pDC->FillRect(CRect(ClipRect.left, ClipRect.top, 
+                      nFixedColumnWidth, nFixedRowHeight),
+                      &FixedRowColBack);
+
+    // Draw Fixed columns background
+    if (ClipRect.left < nFixedColumnWidth && ClipRect.top < VisRect.bottom)
+        pDC->FillRect(CRect(ClipRect.left, ClipRect.top, 
+                      nFixedColumnWidth, VisRect.bottom),
+                      &FixedColBack);
+        
+    // Draw Fixed rows background
+    if (ClipRect.top < nFixedRowHeight && 
+        ClipRect.right > nFixedColumnWidth && ClipRect.left < VisRect.right)
+        pDC->FillRect(CRect(nFixedColumnWidth-1, ClipRect.top,
+                      VisRect.right, nFixedRowHeight),
+                      &FixedRowBack);
+
+    // Draw non-fixed cell background
+    if (rect.IntersectRect(VisRect, ClipRect)) 
+    {
+        CRect CellRect(__max(nFixedColumnWidth, rect.left), 
+                       __max(nFixedRowHeight, rect.top),
+                       rect.right, rect.bottom);
+        pDC->FillRect(CellRect, &TextBack);
+    }
+
+    // Draw right hand side of window outside grid
+    if (VisRect.right < ClipRect.right) 
+        pDC->FillRect(CRect(VisRect.right, ClipRect.top, 
+                      ClipRect.right, ClipRect.bottom),
+                      &Back);
+
+    // Draw bottom of window below grid
+    if (VisRect.bottom < ClipRect.bottom && ClipRect.left < VisRect.right) 
+        pDC->FillRect(CRect(ClipRect.left, VisRect.bottom,
+                      VisRect.right, ClipRect.bottom),
+                      &Back);
+}
+
+void CGridCtrl::OnSize(UINT nType, int cx, int cy)
+{  
+    static BOOL bAlreadyInsideThisProcedure = FALSE;
+    if (bAlreadyInsideThisProcedure)
+        return;
+
+    if (!::IsWindow(m_hWnd))
+        return;
+
+	// This is not the ideal place to register the droptarget
+#ifndef GRIDCONTROL_NO_DRAGDROP
+	m_DropTarget.Register(this);
+#endif
+
+    // Start re-entry blocking
+    bAlreadyInsideThisProcedure = TRUE;
+
+    EndEditing();        // destroy any InPlaceEdit's
+    CWnd::OnSize(nType, cx, cy);
+    ResetScrollBars();
+
+    // End re-entry blocking
+    bAlreadyInsideThisProcedure = FALSE;
+}
+
+UINT CGridCtrl::OnGetDlgCode()
+{
+    UINT nCode = DLGC_WANTARROWS | DLGC_WANTCHARS; // DLGC_WANTALLKEYS; //
+
+    if (m_bHandleTabKey && !IsCTRLpressed())
+        nCode |= DLGC_WANTTAB;
+
+    return nCode;
+}
+
+#ifndef _WIN32_WCE
+// If system colours change, then redo colours
+void CGridCtrl::OnSysColorChange()
+{
+    CWnd::OnSysColorChange();
+
+    if (GetDefaultCell(FALSE, FALSE)->GetTextClr() == m_crWindowText)                   // Still using system colours
+        GetDefaultCell(FALSE, FALSE)->SetTextClr(::GetSysColor(COLOR_WINDOWTEXT));      // set to new system colour
+    if (GetDefaultCell(FALSE, FALSE)->GetBackClr() == m_crWindowColour)
+        GetDefaultCell(FALSE, FALSE)->SetBackClr(::GetSysColor(COLOR_WINDOW));
+
+    if (GetDefaultCell(TRUE, FALSE)->GetTextClr() == m_crWindowText)                   // Still using system colours
+        GetDefaultCell(TRUE, FALSE)->SetTextClr(::GetSysColor(COLOR_WINDOWTEXT));      // set to new system colour
+    if (GetDefaultCell(TRUE, FALSE)->GetBackClr() == m_crWindowColour)
+        GetDefaultCell(TRUE, FALSE)->SetBackClr(::GetSysColor(COLOR_WINDOW));
+
+    if (GetDefaultCell(FALSE, TRUE)->GetTextClr() == m_crWindowText)                   // Still using system colours
+        GetDefaultCell(FALSE, TRUE)->SetTextClr(::GetSysColor(COLOR_WINDOWTEXT));      // set to new system colour
+    if (GetDefaultCell(FALSE, TRUE)->GetBackClr() == m_crWindowColour)
+        GetDefaultCell(FALSE, TRUE)->SetBackClr(::GetSysColor(COLOR_WINDOW));
+
+    if (GetDefaultCell(TRUE, TRUE)->GetTextClr() == m_crWindowText)                   // Still using system colours
+        GetDefaultCell(TRUE, TRUE)->SetTextClr(::GetSysColor(COLOR_WINDOWTEXT));      // set to new system colour
+    if (GetDefaultCell(TRUE, TRUE)->GetBackClr() == m_crWindowColour)
+        GetDefaultCell(TRUE, TRUE)->SetBackClr(::GetSysColor(COLOR_WINDOW));
+
+    if (GetGridBkColor() == m_crShadow)
+        SetGridBkColor(::GetSysColor(COLOR_3DSHADOW));
+
+    m_crWindowText   = ::GetSysColor(COLOR_WINDOWTEXT);
+    m_crWindowColour = ::GetSysColor(COLOR_WINDOW);
+    m_cr3DFace       = ::GetSysColor(COLOR_3DFACE);
+    m_crShadow       = ::GetSysColor(COLOR_3DSHADOW);
+}
+#endif
+
+#ifndef _WIN32_WCE_NO_CURSOR
+// If we are drag-selecting cells, or drag and dropping, stop now
+void CGridCtrl::OnCaptureChanged(CWnd *pWnd)
+{
+    if (pWnd->GetSafeHwnd() == GetSafeHwnd())
+        return;
+
+    // kill timer if active
+    if (m_nTimerID != 0)
+    {
+        KillTimer(m_nTimerID);
+        m_nTimerID = 0;
+    }
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    // Kill drag and drop if active
+    if (m_MouseMode == MOUSE_DRAGGING)
+        m_MouseMode = MOUSE_NOTHING;
+#endif
+}
+#endif
+
+#if (_MFC_VER >= 0x0421) || (_WIN32_WCE >= 210)
+// If system settings change, then redo colours
+void CGridCtrl::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
+{
+    CWnd::OnSettingChange(uFlags, lpszSection);
+
+    if (GetDefaultCell(FALSE, FALSE)->GetTextClr() == m_crWindowText)                   // Still using system colours
+        GetDefaultCell(FALSE, FALSE)->SetTextClr(::GetSysColor(COLOR_WINDOWTEXT));      // set to new system colour
+    if (GetDefaultCell(FALSE, FALSE)->GetBackClr() == m_crWindowColour)
+        GetDefaultCell(FALSE, FALSE)->SetBackClr(::GetSysColor(COLOR_WINDOW));
+
+    if (GetDefaultCell(TRUE, FALSE)->GetTextClr() == m_crWindowText)                   // Still using system colours
+        GetDefaultCell(TRUE, FALSE)->SetTextClr(::GetSysColor(COLOR_WINDOWTEXT));      // set to new system colour
+    if (GetDefaultCell(TRUE, FALSE)->GetBackClr() == m_crWindowColour)
+        GetDefaultCell(TRUE, FALSE)->SetBackClr(::GetSysColor(COLOR_WINDOW));
+
+    if (GetDefaultCell(FALSE, TRUE)->GetTextClr() == m_crWindowText)                   // Still using system colours
+        GetDefaultCell(FALSE, TRUE)->SetTextClr(::GetSysColor(COLOR_WINDOWTEXT));      // set to new system colour
+    if (GetDefaultCell(FALSE, TRUE)->GetBackClr() == m_crWindowColour)
+        GetDefaultCell(FALSE, TRUE)->SetBackClr(::GetSysColor(COLOR_WINDOW));
+
+    if (GetDefaultCell(TRUE, TRUE)->GetTextClr() == m_crWindowText)                   // Still using system colours
+        GetDefaultCell(TRUE, TRUE)->SetTextClr(::GetSysColor(COLOR_WINDOWTEXT));      // set to new system colour
+    if (GetDefaultCell(TRUE, TRUE)->GetBackClr() == m_crWindowColour)
+        GetDefaultCell(TRUE, TRUE)->SetBackClr(::GetSysColor(COLOR_WINDOW));
+
+    if (GetGridBkColor() == m_crShadow)
+        SetGridBkColor(::GetSysColor(COLOR_3DSHADOW));
+
+    m_crWindowText   = ::GetSysColor(COLOR_WINDOWTEXT);
+    m_crWindowColour = ::GetSysColor(COLOR_WINDOW);
+    m_cr3DFace       = ::GetSysColor(COLOR_3DFACE);
+    m_crShadow       = ::GetSysColor(COLOR_3DSHADOW);
+
+    m_nRowsPerWheelNotch = GetMouseScrollLines(); // Get the number of lines
+}
+#endif
+
+// For drag-selection. Scrolls hidden cells into view
+// TODO: decrease timer interval over time to speed up selection over time
+void CGridCtrl::OnTimer(UINT_PTR nIDEvent)
+{
+//    ASSERT(nIDEvent == WM_LBUTTONDOWN);
+    if (nIDEvent != WM_LBUTTONDOWN)
+        return;
+
+    CPoint pt, origPt;
+
+#ifdef _WIN32_WCE
+    if (m_MouseMode == MOUSE_NOTHING)
+        return;
+    origPt = GetMessagePos();
+#else
+    if (!GetCursorPos(&origPt))
+        return;
+#endif
+
+    ScreenToClient(&origPt);
+
+    CRect rect;
+    GetClientRect(rect);
+
+	// LUC		
+	CCellID cell = GetCellFromPt(origPt);
+
+	CCellID idTopLeft = GetTopleftNonFixedCell();
+	if(idTopLeft.row == GetFixedRowCount(TRUE))
+	{
+		m_bExcludeFreezedRowsFromSelection = FALSE;
+	}
+	else if((cell.row > idTopLeft.row) || (m_LeftClickDownCell.row >= idTopLeft.row))
+	{
+		m_bExcludeFreezedRowsFromSelection = TRUE;
+
+	}	
+	if(idTopLeft.col == GetFixedColumnCount(TRUE))
+	{
+		m_bExcludeFreezedColsFromSelection = FALSE;
+	}
+	else if((cell.col > idTopLeft.col)	|| (m_LeftClickDownCell.col >= idTopLeft.col))
+	{
+		m_bExcludeFreezedColsFromSelection = TRUE;
+	}
+	
+	int nFixedRowHeight = GetFixedRowHeight(m_bExcludeFreezedRowsFromSelection);
+    int nFixedColWidth = GetFixedColumnWidth(m_bExcludeFreezedColsFromSelection);
+	
+    pt = origPt;
+    if (pt.y > rect.bottom)
+    {
+        //SendMessage(WM_VSCROLL, SB_LINEDOWN, 0);
+        SendMessage(WM_KEYDOWN, VK_DOWN, 0);
+
+        if (pt.x < rect.left)
+            pt.x = rect.left;
+        if (pt.x > rect.right)
+            pt.x = rect.right;
+        pt.y = rect.bottom;
+        OnSelecting(GetCellFromPt(pt));
+    }
+    else if (pt.y < nFixedRowHeight)
+    {
+        //SendMessage(WM_VSCROLL, SB_LINEUP, 0);
+        SendMessage(WM_KEYDOWN, VK_UP, 0);
+
+        if (pt.x < rect.left)
+            pt.x = rect.left;
+        if (pt.x > rect.right)
+            pt.x = rect.right;
+        pt.y = nFixedRowHeight + 1;
+        OnSelecting(GetCellFromPt(pt));
+    }
+
+    pt = origPt;
+    if (pt.x > rect.right)
+    {
+        // SendMessage(WM_HSCROLL, SB_LINERIGHT, 0);
+        SendMessage(WM_KEYDOWN, VK_RIGHT, 0);
+
+        if (pt.y < rect.top)
+            pt.y = rect.top;
+        if (pt.y > rect.bottom)
+            pt.y = rect.bottom;
+        pt.x = rect.right;
+        OnSelecting(GetCellFromPt(pt));
+    }
+    else if (pt.x < nFixedColWidth)
+    {		    
+        //SendMessage(WM_HSCROLL, SB_LINELEFT, 0);
+        SendMessage(WM_KEYDOWN, VK_LEFT, 0);
+
+        if (pt.y < rect.top)
+            pt.y = rect.top;
+        if (pt.y > rect.bottom)
+            pt.y = rect.bottom;
+        pt.x = nFixedColWidth + 1;
+        OnSelecting(GetCellFromPt(pt));
+    }
+	
+}
+
+// move about with keyboard
+void CGridCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+    if (!IsValid(m_idCurrentCell))
+    {
+        CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
+        return;
+    }
+    CCellID next = m_idCurrentCell;
+    BOOL bChangeLine = FALSE;
+	BOOL bHorzScrollAction = FALSE;
+	BOOL bVertScrollAction = FALSE;
+
+    if (IsCTRLpressed())
+    {
+        switch (nChar)
+        {
+        case 'A':
+            OnEditSelectAll();
+            break;
+        case 'k':		// This is ctrl+ on french keyboard, may need to be better processed for other locales
+            AutoSizeColumns();
+			Invalidate();
+            break;
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+        case 'X':
+            OnEditCut();
+            break;
+        case VK_INSERT:
+        case 'C':
+            OnEditCopy();
+            break;
+        case 'V':
+            OnEditPaste();
+            break;
+#endif
+        }
+    }
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    if (IsSHIFTpressed() &&(nChar == VK_INSERT))
+        OnEditPaste();
+#endif
+
+    BOOL bFoundVisible;
+    int iOrig;
+
+    if (nChar == VK_DELETE)
+    {
+		CutSelectedText();
+    }
+    else if (nChar == VK_DOWN)
+    {
+        // don't let user go to a hidden row
+        bFoundVisible = FALSE;
+        iOrig = next.row;
+        next.row++;
+        while( next.row < GetRowCount())
+        {
+            if( GetRowHeight( next.row) > 0)
+            {
+                bFoundVisible = TRUE;
+                break;
+            }
+            next.row++;
+        }
+        if( !bFoundVisible)
+            next.row = iOrig;
+    }
+    else if (nChar == VK_UP)
+    {
+        // don't let user go to a hidden row
+        bFoundVisible = FALSE;
+        iOrig = next.row;
+        next.row--;
+		// LUC
+		//while( next.row >= m_nFixedRows)
+		while( next.row >= GetFixedRowCount(m_bExcludeFreezedRowsFromSelection))
+        {
+            if( GetRowHeight( next.row) > 0)
+            {
+                bFoundVisible = TRUE;
+                break;
+            }
+            next.row--;
+        }
+        if( !bFoundVisible)
+            next.row = iOrig;
+    }
+    else if (nChar == VK_RIGHT || (nChar == VK_TAB && !IsSHIFTpressed()) )
+    {
+		if( (nChar == VK_TAB) &&  m_QuitFocusOnTab )
+		{
+			CDialog* p= (CDialog*) GetParent();
+			if(p) p->NextDlgCtrl();
+			return;
+
+		}
+        // don't let user go to a hidden column
+        bFoundVisible = FALSE;
+        iOrig = next.col;
+        next.col++;
+
+        if (nChar == VK_TAB)
+        {
+			// If we're at the end of a row, go down a row till we find a non-hidden row
+            if (next.col == (GetColumnCount()) && next.row < (GetRowCount() - 1))
+            {
+				next.row++;
+				while( next.row < GetRowCount())
+				{
+					if( GetRowHeight(next.row) > 0)
+					{
+						bFoundVisible = TRUE;
+						break;
+					}
+					next.row++; 
+				}
+
+				// LUC
+                //next.col = m_nFixedCols;	// Place focus on first non-fixed column
+				next.col = GetFixedColumnCount(m_bExcludeFreezedColsFromSelection);	// Place focus on first non-fixed column
+                bChangeLine = TRUE;
+            }
+            else
+                CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
+        }
+
+		// We're on a non-hidden row, so look across for the next non-hidden column
+        while( next.col < GetColumnCount())
+        {
+            if( GetColumnWidth( next.col) > 0)
+            {
+                bFoundVisible = TRUE;
+                break;
+            }
+            next.col++;
+        }
+
+		// If nothing worked then don't bother
+        if( !bFoundVisible)
+            next.col = iOrig;
+    }
+    else if (nChar == VK_LEFT || (nChar == VK_TAB && IsSHIFTpressed()) )
+    {
+        // don't let user go to a hidden column
+        bFoundVisible = FALSE;
+        iOrig = next.col;
+        next.col--;
+
+        if (nChar == VK_TAB)
+        {
+			// LUC
+            if (next.col == (GetFixedColumnCount(m_bExcludeFreezedColsFromSelection)-1) 
+				&& next.row > GetFixedRowCount(m_bExcludeFreezedRowsFromSelection))
+            {
+                next.row--;
+				while( next.row > GetFixedRowCount(m_bExcludeFreezedRowsFromSelection))
+				{
+					if( GetRowHeight(next.row) > 0)
+					{
+						bFoundVisible = TRUE;
+						break;
+					}
+					next.row--; 
+				}
+
+                next.col = GetColumnCount() - 1; 
+                bChangeLine = TRUE;
+            }
+            else
+                CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
+        }
+
+		// LUC
+        //while( next.col >= m_nFixedCols)
+		while(next.col >= GetFixedColumnCount(m_bExcludeFreezedColsFromSelection))
+        {
+            if( GetColumnWidth( next.col) > 0)
+            {
+                bFoundVisible = TRUE;
+                break;
+            }
+            next.col--;
+        }
+        if( !bFoundVisible)
+            next.col = iOrig;
+    }
+    else if (nChar == VK_NEXT)
+    {
+        CCellID idOldTopLeft = GetTopleftNonFixedCell();
+        SendMessage(WM_VSCROLL, SB_PAGEDOWN, 0);
+		bVertScrollAction = TRUE;
+        CCellID idNewTopLeft = GetTopleftNonFixedCell();
+
+        int increment = idNewTopLeft.row - idOldTopLeft.row;
+        if (increment)
+        {
+            next.row += increment;
+            if (next.row >(GetRowCount() - 1))
+                next.row = GetRowCount() - 1;
+        }
+        else
+            next.row = GetRowCount() - 1;
+    }
+    else if (nChar == VK_PRIOR)
+    {
+        CCellID idOldTopLeft = GetTopleftNonFixedCell();
+        SendMessage(WM_VSCROLL, SB_PAGEUP, 0);
+		bVertScrollAction = TRUE;
+        CCellID idNewTopLeft = GetTopleftNonFixedCell();
+            
+        int increment = idNewTopLeft.row - idOldTopLeft.row;
+        if (increment) 
+        {
+            next.row += increment;
+			// LUC
+            if (next.row < GetFixedRowCount(m_bExcludeFreezedRowsFromSelection)) 
+                next.row = GetFixedRowCount(m_bExcludeFreezedColsFromSelection);
+        }
+        else
+			// LUC
+            next.row = GetFixedRowCount(m_bExcludeFreezedRowsFromSelection);
+    }
+    else if (nChar == VK_HOME)
+    {
+        // Home and Ctrl-Home work more like Excel
+        //  and don't let user go to a hidden cell
+        if (IsCTRLpressed())
+        {
+            SendMessage(WM_VSCROLL, SB_TOP, 0);
+            SendMessage(WM_HSCROLL, SB_LEFT, 0);
+			bVertScrollAction = TRUE;
+			bHorzScrollAction = TRUE;
+            //next.row = m_nFixedRows;
+            //next.col = m_nFixedCols;
+			// LUC
+			next.row = GetFixedRowCount(m_bExcludeFreezedRowsFromSelection);
+			next.col = GetFixedColumnCount(m_bExcludeFreezedColsFromSelection);
+        }
+        else
+        {
+            SendMessage(WM_HSCROLL, SB_LEFT, 0);
+ 			bHorzScrollAction = TRUE;
+            // LUC
+			//next.col = m_nFixedCols;
+			next.col = GetFixedColumnCount(m_bExcludeFreezedColsFromSelection);
+        }
+        // adjust column to avoid hidden columns and rows
+        while( next.col < GetColumnCount() - 1)
+        {
+            if( GetColumnWidth( next.col) > 0)
+                break;
+            next.col++;
+        }
+        while( next.row < GetRowCount() - 1)
+        {
+            if( GetRowHeight( next.row) > 0)
+                break;
+            next.row++;
+        }
+    }
+    else if (nChar == VK_END)
+    {
+        // End and Ctrl-End work more like Excel
+        //  and don't let user go to a hidden cell
+        if (IsCTRLpressed())
+        {
+            SendMessage(WM_VSCROLL, SB_BOTTOM, 0);
+            SendMessage(WM_HSCROLL, SB_RIGHT, 0);
+			bHorzScrollAction = TRUE;
+			bVertScrollAction = TRUE;
+            next.row = GetRowCount() - 1;
+            next.col = GetColumnCount() - 1;
+        }
+        else
+        {
+            SendMessage(WM_HSCROLL, SB_RIGHT, 0);
+			bHorzScrollAction = TRUE;
+            next.col = GetColumnCount() - 1;
+        }
+        // adjust column to avoid hidden columns and rows
+        //while( next.col > m_nFixedCols + 1)
+		while(next.col > GetFixedColumnCount(m_bExcludeFreezedColsFromSelection) + 1)
+        {
+            if( GetColumnWidth( next.col) > 0)
+                break;
+            next.col--;
+        }
+        //while( next.row > m_nFixedRows + 1)
+		while( next.row > GetFixedRowCount(m_bExcludeFreezedRowsFromSelection) + 1)
+        {
+            if( GetRowHeight( next.row) > 0)
+                break;
+            next.row--;
+        }
+    }
+    else if (nChar == VK_F2)
+    {
+        OnEditCell(m_idCurrentCell.row, m_idCurrentCell.col, CPoint( -1, -1), VK_LBUTTON);
+    }
+    else
+    {
+        CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
+        return;
+    }
+
+    if (next != m_idCurrentCell)
+    {
+		// LUC
+
+		int nNextRow = next.row;
+		int nNextCol = next.col;
+
+		int nCurRow = m_idCurrentCell.row;
+		int nCurCol = m_idCurrentCell.col;
+
+		BOOL bMerged = GetTopLeftMergedCell(nCurRow, nCurCol, rectNull);
+
+		switch(nChar)
+		{
+			case VK_LEFT:
+			{
+				if(GetTopLeftMergedCell(nNextRow, nNextCol, rectNull))
+				{					
+					next.col = nNextCol;					
+					if(bMerged)
+					{
+						// if already in a merged cell make sure the next column is not the leftmost column of the merged cell
+						next.col--;	
+					}
+				}
+				break;
+			}
+
+			case VK_RIGHT:
+			{
+				if(GetBottomRightMergedCell(nNextRow, nNextCol, rectNull))
+				{
+					next.col = nNextCol;
+					if(bMerged)
+					{
+						// if already in a merged cell make sure the next column is not the rightmost column of the merged cell						
+						next.col++;	
+					}
+				}
+				break;
+			}
+
+			case VK_UP:
+			{
+				if(GetTopLeftMergedCell(nNextRow, nNextCol, rectNull))
+				{
+					next.row = nNextRow;
+					if(bMerged)
+					{
+						// if already in a merged cell make sure the next row is not the topmost row of the merged cell						
+						next.row--;	
+					}
+				}
+				break;
+			}
+
+			case VK_DOWN:
+			{
+				if(GetBottomRightMergedCell(nNextRow, nNextCol, rectNull))
+				{
+					next.row = nNextRow;
+					if(bMerged)
+					{
+						// if already in a merged cell make sure the next row is not the bottommost row of the merged cell						
+						next.row++;	
+					}
+				}
+				break;
+			}
+		}
+		
+        // While moving with the Cursorkeys the current ROW/CELL will get selected
+        // OR Selection will get expanded when SHIFT is pressed
+        // Cut n paste from OnLButtonDown - Franco Bez
+        // Added check for NULL mouse mode - Chris Maunder.
+        if (m_MouseMode == MOUSE_NOTHING)
+        {
+            m_PrevSelectedCellMap.RemoveAll();
+            m_MouseMode = m_bListMode? MOUSE_SELECT_ROW : MOUSE_SELECT_CELLS;
+            if (!IsSHIFTpressed() || nChar == VK_TAB)
+                m_SelectionStartCell = next;
+
+			// Notify parent that selection is changing - Arthur Westerman/Scot Brennecke 
+            SendMessageToParent(next.row, next.col, GVN_SELCHANGING);
+			OnSelecting(next);
+			SendMessageToParent(next.row, next.col, GVN_SELCHANGED);
+
+            m_MouseMode = MOUSE_NOTHING;
+        }
+
+        SetFocusCell(next);
+
+        if (!IsCellVisible(next))
+        {
+
+            switch (nChar)
+            {
+            case VK_RIGHT:  
+                SendMessage(WM_HSCROLL, SB_LINERIGHT, 0); 
+				bHorzScrollAction = TRUE;
+                break;
+                
+            case VK_LEFT:   
+                SendMessage(WM_HSCROLL, SB_LINELEFT, 0);  
+				bHorzScrollAction = TRUE;
+                break;
+                
+            case VK_DOWN:   
+                SendMessage(WM_VSCROLL, SB_LINEDOWN, 0);  
+				bVertScrollAction = TRUE;
+                break;
+                
+            case VK_UP:     
+                SendMessage(WM_VSCROLL, SB_LINEUP, 0);    
+				bVertScrollAction = TRUE;
+                break;                
+                
+            case VK_TAB:    
+                if (IsSHIFTpressed())
+                {
+                    if (bChangeLine) 
+                    {
+                        SendMessage(WM_VSCROLL, SB_LINEUP, 0);
+						bVertScrollAction = TRUE;
+                        SetScrollPos32(SB_HORZ, m_nHScrollMax);
+                        break;
+                    }
+                    else 
+					{
+                        SendMessage(WM_HSCROLL, SB_LINELEFT, 0);
+						bHorzScrollAction = TRUE;
+					}
+                }
+                else
+                {
+                    if (bChangeLine) 
+                    {
+                        SendMessage(WM_VSCROLL, SB_LINEDOWN, 0);
+						bVertScrollAction = TRUE;
+                        SetScrollPos32(SB_HORZ, 0);
+                        break;
+                    }
+                    else 
+					{
+						SendMessage(WM_HSCROLL, SB_LINERIGHT, 0);
+						bHorzScrollAction = TRUE;
+					}
+                }
+                break;
+            }
+            EnsureVisible(next); // Make sure cell is visible
+            Invalidate();
+        }
+        EnsureVisible(next); // Make sure cell is visible
+
+		if (bHorzScrollAction)
+			SendMessage(WM_HSCROLL, SB_ENDSCROLL, 0);
+		if (bVertScrollAction)
+			SendMessage(WM_VSCROLL, SB_ENDSCROLL, 0);
+    }
+}
+
+void CGridCtrl::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+    CWnd::OnKeyUp(nChar, nRepCnt, nFlags);
+}
+
+void CGridCtrl::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+#ifdef GRIDCONTROL_USE_TITLETIPS
+    m_TitleTip.Hide();  // hide any titletips
+#endif
+
+    CWnd::OnSysKeyDown(nChar, nRepCnt, nFlags);
+}
+
+// Instant editing of cells when keys are pressed
+void CGridCtrl::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+    // EFW - BUG FIX
+    if (!IsCTRLpressed() && m_MouseMode == MOUSE_NOTHING && nChar != VK_ESCAPE)
+    {
+        if (!m_bHandleTabKey || (m_bHandleTabKey && nChar != VK_TAB))
+            OnEditCell(m_idCurrentCell.row, m_idCurrentCell.col, CPoint( -1, -1), nChar);
+    }
+
+    CWnd::OnChar(nChar, nRepCnt, nFlags);
+}
+
+// Added by KiteFly
+LRESULT CGridCtrl::OnImeChar(WPARAM wCharCode, LPARAM)
+{
+    // EFW - BUG FIX
+    if (!IsCTRLpressed() && m_MouseMode == MOUSE_NOTHING && wCharCode != VK_ESCAPE) 
+        OnEditCell(m_idCurrentCell.row, m_idCurrentCell.col, CPoint( -1, -1), (UINT)wCharCode);
+    return 0;
+}
+
+// Callback from any CInPlaceEdits that ended. This just calls OnEndEditCell,
+// refreshes the edited cell and moves onto next cell if the return character
+// from the edit says we should.
+void CGridCtrl::OnEndInPlaceEdit(NMHDR* pNMHDR, LRESULT* pResult)
+{
+    GV_DISPINFO *pgvDispInfo = (GV_DISPINFO *)pNMHDR;
+    GV_ITEM     *pgvItem = &pgvDispInfo->item;
+
+    // In case OnEndInPlaceEdit called as window is being destroyed
+    if (!IsWindow(GetSafeHwnd()))
+        return;
+
+    OnEndEditCell(pgvItem->row, pgvItem->col, pgvItem->strText);
+    //InvalidateCellRect(CCellID(pgvItem->row, pgvItem->col));
+
+    switch (pgvItem->lParam)
+    {
+    case VK_TAB:
+    case VK_DOWN:
+    case VK_UP:
+    case VK_RIGHT:
+    case VK_LEFT:
+    case VK_NEXT:
+    case VK_PRIOR:
+    case VK_HOME:
+    case VK_END:
+        OnKeyDown((UINT)pgvItem->lParam, 0, 0);
+        OnEditCell(m_idCurrentCell.row, m_idCurrentCell.col, CPoint( -1, -1), (UINT)pgvItem->lParam);
+    }
+
+    *pResult = 0;
+}
+
+
+void CGridCtrl::OnComboSelChange(NMHDR* pNMHDR, LRESULT* pResult)
+{
+	GV_DISPINFO *pgvDispInfo = (GV_DISPINFO *)pNMHDR;
+	GV_ITEM     *pgvItem = &pgvDispInfo->item;
+
+	// In case OnEndInPlaceEdit called as window is being destroyed
+	if (!IsWindow(GetSafeHwnd()))
+		return;
+
+	OnEndEditCell(pgvItem->row, pgvItem->col, pgvItem->strText);
+
+	SendMessageToParent(pgvItem->row, pgvItem->col, GVN_COMBOSELCHANGE);
+
+	*pResult = 0;
+}
+
+// Handle horz scrollbar notifications
+void CGridCtrl::OnHScroll(UINT nSBCode, UINT /*nPos*/, CScrollBar* /*pScrollBar*/)
+{
+    EndEditing();
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+    m_TitleTip.Hide();  // hide any titletips
+#endif
+
+    int scrollPos = GetScrollPos32(SB_HORZ);
+
+    CCellID idTopLeft = GetTopleftNonFixedCell();
+
+    CRect rect;
+    GetClientRect(rect);
+
+	// LUC
+	BOOL bIncludeFreezedCells = FALSE;
+
+    switch (nSBCode)
+    {
+    case SB_LINERIGHT:
+        if (scrollPos < m_nHScrollMax)
+        {
+            // may have contiguous hidden columns.  Blow by them
+            while (idTopLeft.col < (GetColumnCount()-1)
+                    && GetColumnWidth( idTopLeft.col) < 1 )
+            {
+                idTopLeft.col++;
+            }
+            int xScroll = GetColumnWidth(idTopLeft.col);
+            SetScrollPos32(SB_HORZ, scrollPos + xScroll);
+            if (GetScrollPos32(SB_HORZ) == scrollPos)
+                break;          // didn't work
+
+			// LUC
+            rect.left = GetFixedColumnWidth(bIncludeFreezedCells);
+            //rect.left = GetFixedColumnWidth() + xScroll;
+            //ScrollWindow(-xScroll, 0, rect);
+            //rect.left = rect.right - xScroll;
+            InvalidateRect(rect);
+        }
+        break;
+
+    case SB_LINELEFT:
+        if (scrollPos > 0 && idTopLeft.col > GetFixedColumnCount(TRUE))
+        {
+            int iColToUse = idTopLeft.col-1;
+            // may have contiguous hidden columns.  Blow by them
+            while(  iColToUse > GetFixedColumnCount(TRUE)
+                    && GetColumnWidth( iColToUse) < 1 )
+            {
+                iColToUse--;
+            }
+
+            int xScroll = GetColumnWidth(iColToUse);
+            SetScrollPos32(SB_HORZ, __max(0, scrollPos - xScroll));
+			// LUC
+            rect.left = GetFixedColumnWidth(bIncludeFreezedCells);
+            //ScrollWindow(xScroll, 0, rect);
+            //rect.right = rect.left + xScroll;
+            InvalidateRect(rect);
+        }
+        break;
+
+    case SB_PAGERIGHT:
+        if (scrollPos < m_nHScrollMax)
+        {
+			// LUC
+            rect.left = GetFixedColumnWidth(TRUE);
+            int offset = rect.Width();
+            int pos = min(m_nHScrollMax, scrollPos + offset);
+            SetScrollPos32(SB_HORZ, pos);
+			// LUC
+            rect.left = GetFixedColumnWidth(bIncludeFreezedCells);
+            InvalidateRect(rect);
+        }
+        break;
+        
+    case SB_PAGELEFT:
+        if (scrollPos > 0)
+        {
+			// LUC
+            rect.left = GetFixedColumnWidth(TRUE);
+            int offset = -rect.Width();
+            int pos = __max(0, scrollPos + offset);
+            SetScrollPos32(SB_HORZ, pos);
+			// LUC
+            rect.left = GetFixedColumnWidth(bIncludeFreezedCells);
+            InvalidateRect(rect);
+        }
+        break;
+        
+    case SB_THUMBPOSITION:
+    case SB_THUMBTRACK:
+        {
+            SetScrollPos32(SB_HORZ, GetScrollPos32(SB_HORZ, TRUE));
+            m_idTopLeftCell.row = -1;
+            CCellID idNewTopLeft = GetTopleftNonFixedCell();
+            if (idNewTopLeft != idTopLeft)
+            {
+				// LUC
+                rect.left = GetFixedColumnWidth(bIncludeFreezedCells);
+                InvalidateRect(rect);
+            }
+        }
+        break;
+        
+    case SB_LEFT:
+        if (scrollPos > 0)
+        {
+            SetScrollPos32(SB_HORZ, 0);
+            Invalidate();
+        }
+        break;
+        
+    case SB_RIGHT:
+        if (scrollPos < m_nHScrollMax)
+        {
+            SetScrollPos32(SB_HORZ, m_nHScrollMax);
+            Invalidate();
+        }
+        break;
+        
+        
+    default: 
+        break;
+    }
+}
+
+// Handle vert scrollbar notifications
+void CGridCtrl::OnVScroll(UINT nSBCode, UINT /*nPos*/, CScrollBar* /*pScrollBar*/)
+{
+    EndEditing();
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+    m_TitleTip.Hide();  // hide any titletips
+#endif
+
+    // Get the scroll position ourselves to ensure we get a 32 bit value
+    int scrollPos = GetScrollPos32(SB_VERT);
+
+    CCellID idTopLeft = GetTopleftNonFixedCell();
+
+    CRect rect;
+    GetClientRect(rect);
+
+	// LUC
+	BOOL bIncludeFreezedCells = FALSE;
+
+    switch (nSBCode)
+    {
+    case SB_LINEDOWN:
+        if (scrollPos < m_nVScrollMax)
+        {
+            // may have contiguous hidden rows.  Blow by them
+            while(  idTopLeft.row < (GetRowCount()-1)
+                    && GetRowHeight( idTopLeft.row) < 1 )
+            {
+                idTopLeft.row++;
+            }
+
+            int yScroll = GetRowHeight(idTopLeft.row);
+            SetScrollPos32(SB_VERT, scrollPos + yScroll);
+            if (GetScrollPos32(SB_VERT) == scrollPos)
+                break;          // didn't work
+
+			// LUC
+            rect.top = GetFixedRowHeight(bIncludeFreezedCells);
+            //rect.top = GetFixedRowHeight() + yScroll;
+            //ScrollWindow(0, -yScroll, rect);
+            //rect.top = rect.bottom - yScroll;
+            InvalidateRect(rect);
+        }
+        break;
+        
+    case SB_LINEUP:
+        if (scrollPos > 0 && idTopLeft.row > GetFixedRowCount(TRUE))
+        {
+            int iRowToUse = idTopLeft.row-1;
+            // may have contiguous hidden rows.  Blow by them
+            while(  iRowToUse > GetFixedRowCount(TRUE)
+                    && GetRowHeight( iRowToUse) < 1 )
+            {
+                iRowToUse--;
+            }
+
+            int yScroll = GetRowHeight( iRowToUse);
+            SetScrollPos32(SB_VERT, __max(0, scrollPos - yScroll));
+            // LUC
+			rect.top = GetFixedRowHeight(bIncludeFreezedCells);
+            //ScrollWindow(0, yScroll, rect);
+            //rect.bottom = rect.top + yScroll;
+            InvalidateRect(rect);
+        }
+        break;
+        
+    case SB_PAGEDOWN:
+        if (scrollPos < m_nVScrollMax)
+        {
+			// LUC
+            rect.top = GetFixedRowHeight(TRUE);
+            scrollPos = min(m_nVScrollMax, scrollPos + rect.Height());
+            SetScrollPos32(SB_VERT, scrollPos);
+			// LUC
+            rect.top = GetFixedRowHeight(bIncludeFreezedCells);
+            InvalidateRect(rect);
+        }
+        break;
+        
+    case SB_PAGEUP:
+        if (scrollPos > 0)
+        {
+			// LUC
+            rect.top = GetFixedRowHeight(TRUE);
+            int offset = -rect.Height();
+            int pos = __max(0, scrollPos + offset);
+            SetScrollPos32(SB_VERT, pos);
+			// LUC
+            rect.top = GetFixedRowHeight(bIncludeFreezedCells);
+            InvalidateRect(rect);
+        }
+        break;
+        
+    case SB_THUMBPOSITION:
+    case SB_THUMBTRACK:
+        {
+            SetScrollPos32(SB_VERT, GetScrollPos32(SB_VERT, TRUE));
+            m_idTopLeftCell.row = -1;
+            CCellID idNewTopLeft = GetTopleftNonFixedCell();
+            if (idNewTopLeft != idTopLeft)
+            {
+				// LUC
+                rect.top = GetFixedRowHeight(bIncludeFreezedCells);
+                InvalidateRect(rect);
+            }
+        }
+        break;
+        
+    case SB_TOP:
+        if (scrollPos > 0)
+        {
+            SetScrollPos32(SB_VERT, 0);
+            Invalidate();
+        }
+        break;
+        
+    case SB_BOTTOM:
+        if (scrollPos < m_nVScrollMax)
+        {
+            SetScrollPos32(SB_VERT, m_nVScrollMax);
+            Invalidate();
+        }
+        
+    default: 
+        break;
+    }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl implementation functions
+
+void CGridCtrl::OnDraw(CDC* pDC)
+{
+    if (!m_bAllowDraw)
+        return;
+
+    CRect clipRect;
+    if (pDC->GetClipBox(&clipRect) == ERROR)
+        return;
+
+    EraseBkgnd(pDC);            // OnEraseBkgnd does nothing, so erase bkgnd here.
+    // This necessary since we may be using a Memory DC.
+
+#ifdef _DEBUG
+	LARGE_INTEGER iStartCount;
+	QueryPerformanceCounter(&iStartCount);
+#endif
+	
+	CRect rc;
+	GetClientRect(rc);
+
+    CRect rect;
+    int row, col;
+    CGridCellBase* pCell;
+
+	// LUC
+    int nFixedRowHeight = GetFixedRowHeight(TRUE);
+    int nFixedColWidth  = GetFixedColumnWidth(TRUE);
+
+    CCellID idTopLeft = GetTopleftNonFixedCell();
+    int minVisibleRow = idTopLeft.row,
+        minVisibleCol = idTopLeft.col;
+
+    CRect VisRect;
+    CCellRange VisCellRange = GetVisibleNonFixedCellRange(VisRect);
+    int maxVisibleRow = VisCellRange.GetMaxRow(),
+        maxVisibleCol = VisCellRange.GetMaxCol();
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(VisCellRange);
+
+    // draw top-left cells 0..m_nFixedRows-1, 0..m_nFixedCols-1
+    rect.bottom = -1;
+	int nFixedRows = m_nFixedRows + m_nFreezedRows;
+	int nFixedCols = m_nFixedCols + m_nFreezedCols;
+    for (row = 0; row < nFixedRows; row++)
+    {
+        if (GetRowHeight(row) <= 0) continue;
+
+        rect.top = rect.bottom+1;
+        rect.bottom = rect.top + GetRowHeight(row)-1;
+        rect.right = -1;
+
+        for (col = 0; col < nFixedCols; col++)
+        {
+            if (GetColumnWidth(col) <= 0) continue;
+
+            rect.left = rect.right+1;
+            rect.right = rect.left + GetColumnWidth(col)-1;
+
+            pCell = GetCell(row, col);
+            if (pCell)
+			{
+				pCell->SetCoords(row,col);
+                pCell->Draw(pDC, row, col, rect, FALSE);
+			}
+        }
+    }
+
+
+    // draw fixed column cells:  m_nFixedRows..n, 0..m_nFixedCols-1
+    rect.bottom = nFixedRowHeight-1;
+    for (row = minVisibleRow; row <= maxVisibleRow; row++)
+    {
+        if (GetRowHeight(row) <= 0) continue;
+
+        rect.top = rect.bottom+1;
+        rect.bottom = rect.top + GetRowHeight(row)-1;
+
+        // rect.bottom = bottom pixel of previous row
+        if (rect.top > clipRect.bottom)
+            break;                // Gone past cliprect
+        if (rect.bottom < clipRect.top)
+            continue;             // Reached cliprect yet?
+
+        rect.right = -1;
+        for (col = 0; col < nFixedCols; col++)
+        {
+            if (GetColumnWidth(col) <= 0) continue;
+
+            rect.left = rect.right+1;
+            rect.right = rect.left + GetColumnWidth(col)-1;
+
+            if (rect.left > clipRect.right)
+                break;            // gone past cliprect
+            if (rect.right < clipRect.left)
+                continue;         // Reached cliprect yet?
+
+            pCell = GetCell(row, col);
+            if (pCell)
+			{
+				pCell->SetCoords(row,col);
+                pCell->Draw(pDC, row, col, rect, FALSE);
+			}
+        }
+    }
+
+
+    // draw fixed row cells  0..m_nFixedRows, m_nFixedCols..n
+    rect.bottom = -1;
+    for (row = 0; row < nFixedRows; row++)
+    {
+        if (GetRowHeight(row) <= 0) continue;
+
+        rect.top = rect.bottom+1;
+        rect.bottom = rect.top + GetRowHeight(row)-1;
+
+        // rect.bottom = bottom pixel of previous row
+        if (rect.top > clipRect.bottom)
+            break;                // Gone past cliprect
+        if (rect.bottom < clipRect.top)
+            continue;             // Reached cliprect yet?
+
+        rect.right = nFixedColWidth-1;
+        for (col = minVisibleCol; col <= maxVisibleCol; col++)
+        {
+            if (GetColumnWidth(col) <= 0) continue;
+
+            rect.left = rect.right+1;
+            rect.right = rect.left + GetColumnWidth(col)-1;
+
+            if (rect.left > clipRect.right)
+                break;        // gone past cliprect
+            if (rect.right < clipRect.left)
+                continue;     // Reached cliprect yet?
+
+            pCell = GetCell(row, col);
+            if (pCell)
+			{
+				pCell->SetCoords(row,col);
+				// LUC
+				if(!m_bShowHorzNonGridArea && (col == m_nCols - 1))
+				{
+					pCell->Draw(pDC, row, col, rect, FALSE);
+
+					if(rect.right < rc.right)
+					{
+						CRect rcFill(rect.right + 1, rect.top, rc.right - 2, rect.bottom);
+						
+						CGridCell cell;
+						cell.SetGrid(this);
+
+						DWORD dwState = pCell->GetState() & ~(GVIS_SELECTED | GVIS_FOCUSED);
+						cell.SetState(dwState);
+
+						int nSortColumn = GetSortColumn();
+						m_nSortColumn = -1;
+
+						cell.Draw(pDC, row, col, rcFill, TRUE);
+						
+						if(!(pCell->GetState() & GVIS_FIXED))
+						{
+							rcFill.right++;
+							rcFill.bottom++;
+							pDC->Draw3dRect(rcFill, GetTextBkColor(), m_crGridLineColour);
+						}
+
+						m_nSortColumn = nSortColumn;
+					}
+				}
+				else
+				{
+					pCell->Draw(pDC, row, col, rect, FALSE);
+				}
+			}			
+        }
+    }
+
+    // draw rest of non-fixed cells
+    rect.bottom = nFixedRowHeight-1;
+    for (row = minVisibleRow; row <= maxVisibleRow; row++)
+    {
+        if (GetRowHeight(row) <= 0) continue;
+
+        rect.top = rect.bottom+1;
+        rect.bottom = rect.top + GetRowHeight(row)-1;
+
+        // rect.bottom = bottom pixel of previous row
+        if (rect.top > clipRect.bottom)
+            break;                // Gone past cliprect
+        if (rect.bottom < clipRect.top)
+            continue;             // Reached cliprect yet?
+
+        rect.right = nFixedColWidth-1;
+        for (col = minVisibleCol; col <= maxVisibleCol; col++)
+        {
+            if (GetColumnWidth(col) <= 0) continue;
+
+            rect.left = rect.right+1;
+            rect.right = rect.left + GetColumnWidth(col)-1;
+
+            if (rect.left > clipRect.right)
+                break;        // gone past cliprect
+            if (rect.right < clipRect.left)
+                continue;     // Reached cliprect yet?
+
+            pCell = GetCell(row, col);
+            // TRACE(_T("Cell %d,%d type: %s\n"), row, col, pCell->GetRuntimeClass()->m_lpszClassName);
+            if (pCell)
+			{
+				pCell->SetCoords(row,col);
+				// LUC
+				if(!m_bShowHorzNonGridArea && (col == m_nCols - 1))
+				{			
+					if(rect.right < rc.right)
+					{
+						pCell->Draw(pDC, row, col, rect, FALSE);
+
+						CRect rcFill(rect.right + 1, rect.top, rc.right - 1, rect.bottom);
+						pDC->FillSolidRect(rcFill, GetTextBkColor());
+
+						rcFill.right++;
+						rcFill.bottom++;
+						pDC->Draw3dRect(rcFill, GetTextBkColor(), m_crGridLineColour);
+					}
+
+				}
+				else
+				{
+					pCell->Draw(pDC, row, col, rect, FALSE);
+				}
+			}			
+        }
+    }	
+
+	CPen pen;
+    pen.CreatePen(PS_SOLID, 0, m_crGridLineColour);
+    pDC->SelectObject(&pen);
+
+    // draw vertical lines (drawn at ends of cells)
+    if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT)
+    {
+		// LUC
+        //int x = nFixedColWidth;
+		int x = GetFixedColumnWidth(); 
+		
+		// LUC
+        //for (col = minVisibleCol; col < maxVisibleCol; col++)
+		int nFixedRowHeightExcludingFreezedRows = GetFixedRowHeight();
+		for (col = m_nFixedCols; col <= maxVisibleCol; col++)
+        {
+            if (GetColumnWidth(col) <= 0) continue;
+
+			if(col == (m_nFixedCols + m_nFreezedCols))
+			{
+				col = minVisibleCol;
+			}
+
+            x += GetColumnWidth(col);
+            //pDC->MoveTo(x-1, nFixedRowHeight);
+			pDC->MoveTo(x-1, nFixedRowHeightExcludingFreezedRows);
+            pDC->LineTo(x-1, VisRect.bottom);
+        }
+    }
+
+    // draw horizontal lines (drawn at bottom of each cell)
+    if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ)
+    {
+		// LUC
+        //int y = nFixedRowHeight;
+		int y = GetFixedRowHeight();
+        //for (row = minVisibleRow; row <= maxVisibleRow; row++)
+		int nFixedColumnWidthExcludingFreezedColumns = GetFixedColumnWidth();
+		for (row = m_nFixedRows; row <= maxVisibleRow; row++)
+        {
+            if (GetRowHeight(row) <= 0) continue;
+			
+			if(row == (m_nFixedRows + m_nFreezedRows))
+			{
+				row = minVisibleRow;
+			}
+
+            y += GetRowHeight(row);
+            //pDC->MoveTo(nFixedColWidth, y-1);
+			pDC->MoveTo(nFixedColumnWidthExcludingFreezedColumns, y-1);
+			// LUC
+            pDC->LineTo(VisRect.right,  y-1);			
+        }
+    }
+
+	// LUC : Merge Cell
+	m_bDrawingMergedCell = TRUE;
+	INT_PTR size = m_arMergedCells.GetSize();
+	if(size > 0)
+	{	
+		CRect rcMergeRect;
+		for(INT_PTR i = 0; i < size; i++)
+		{
+			m_nCurrentMergeID = i;
+			if(GetMergedCellRect(m_arMergedCells[i], rcMergeRect))
+			{
+				rcMergeRect.right--;
+				rcMergeRect.bottom--;
+				
+				pCell = GetCell(m_arMergedCells[i].GetMinRow(), m_arMergedCells[i].GetMinCol());
+				if (pCell)
+				{				
+					pCell->Draw(pDC, m_arMergedCells[i].GetMinRow(), m_arMergedCells[i].GetMinCol(), rcMergeRect, TRUE);
+				}
+			}
+		}
+	}
+	m_bDrawingMergedCell = FALSE;	
+	m_nCurrentMergeID = -1;
+
+	// LUC: 
+	// Finally we can draw a line for the Freezed Frame
+	////
+	pen.DeleteObject();
+	pen.CreatePen(PS_SOLID, 0, RGB(0, 0, 255));
+    pDC->SelectObject(&pen);
+	if(m_nFreezedRows > 0)
+	{
+		pDC->MoveTo(0, nFixedRowHeight);
+		pDC->LineTo(rc.right, nFixedRowHeight);
+	}
+	if(m_nFreezedCols > 0)
+	{
+		pDC->MoveTo(nFixedColWidth, 0);
+		pDC->LineTo(nFixedColWidth, rc.bottom);
+	}
+
+    pDC->SelectStockObject(NULL_PEN);
+
+    // Let parent know it can discard it's data if it needs to.
+    if (GetVirtualMode())
+       SendCacheHintToParent(CCellRange(-1,-1,-1,-1));
+
+#ifdef _DEBUG
+	LARGE_INTEGER iEndCount;
+	QueryPerformanceCounter(&iEndCount);
+	//TRACE1("Draw counter ticks: %d\n", iEndCount.LowPart-iStartCount.LowPart);
+#endif
+
+}
+
+////////////////////////////////////////////////////////////////////////////////////////
+// CGridCtrl Cell selection stuff
+
+// Is a given cell designation valid (ie within the bounds of our number
+// of columns/rows)?
+BOOL CGridCtrl::IsValid(int nRow, int nCol) const
+{
+    return (nRow >= 0 && nRow < m_nRows && nCol >= 0 && nCol < m_nCols);
+}
+
+BOOL CGridCtrl::IsValid(const CCellID& cell) const
+{
+    return IsValid(cell.row, cell.col);
+}
+
+// Is a given cell range valid (ie within the bounds of our number
+// of columns/rows)?
+BOOL CGridCtrl::IsValid(const CCellRange& range) const
+{
+    return (range.GetMinRow() >= 0 && range.GetMinCol() >= 0 &&
+        range.GetMaxRow() >= 0 && range.GetMaxCol() >= 0 &&
+        range.GetMaxRow() < m_nRows && range.GetMaxCol() < m_nCols &&
+        range.GetMinRow() <= range.GetMaxRow() && range.GetMinCol() <= range.GetMaxCol());
+}
+
+// Enables/Disables redraw for certain operations like columns auto-sizing etc,
+// but not for user caused things such as selection changes.
+void CGridCtrl::SetRedraw(BOOL bAllowDraw, BOOL bResetScrollBars /* = FALSE */)
+{
+//    TRACE(_T("%s: Setting redraw to %s\n"),
+//             GetRuntimeClass()->m_lpszClassName, bAllowDraw? _T("TRUE") : _T("FALSE"));
+
+    if (bAllowDraw && !m_bAllowDraw)
+    {
+        m_bAllowDraw = TRUE;
+        Refresh();
+    }
+
+    m_bAllowDraw = bAllowDraw;
+    if (bResetScrollBars)
+        ResetScrollBars();
+}
+
+// Forces a redraw of a cell immediately (using a direct DC construction,
+// or the supplied dc)
+BOOL CGridCtrl::RedrawCell(const CCellID& cell, CDC* pDC /* = NULL */)
+{
+    return RedrawCell(cell.row, cell.col, pDC);
+}
+
+BOOL CGridCtrl::RedrawCell(int nRow, int nCol, CDC* pDC /* = NULL */)
+{	
+    BOOL bResult = TRUE;
+    BOOL bMustReleaseDC = FALSE;
+
+    if (!m_bAllowDraw || !IsCellVisible(nRow, nCol))
+        return FALSE;
+
+    CRect rect;	
+	if (!GetCellRect(nRow, nCol, rect))
+        return FALSE;
+    
+	// LUC	
+	BOOL bIsMergeCell = GetTopLeftMergedCell(nRow, nCol, rect);
+
+    if (!pDC)
+    {
+        pDC = GetDC();
+        if (pDC)
+            bMustReleaseDC = TRUE;
+    }
+
+    if (pDC)
+    {
+        // Redraw cells directly
+        if (nRow < m_nFixedRows || nCol < m_nFixedCols)
+        {
+            CGridCellBase* pCell = GetCell(nRow, nCol);
+            if (pCell)
+                bResult = pCell->Draw(pDC, nRow, nCol, rect, TRUE);
+        }
+        else
+        {
+            CGridCellBase* pCell = GetCell(nRow, nCol);
+            if (pCell)
+                bResult = pCell->Draw(pDC, nRow, nCol, rect, TRUE);
+
+            // Since we have erased the background, we will need to redraw the gridlines
+            CPen pen;
+            pen.CreatePen(PS_SOLID, 0, m_crGridLineColour);
+
+            CPen* pOldPen = (CPen*) pDC->SelectObject(&pen);
+            if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ)
+            {
+                pDC->MoveTo(rect.left,    rect.bottom);
+                pDC->LineTo(rect.right + 1, rect.bottom);
+            }
+            if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT)
+            {
+                pDC->MoveTo(rect.right, rect.top);
+                pDC->LineTo(rect.right, rect.bottom + 1);
+            }
+            pDC->SelectObject(pOldPen);
+        }
+    } else
+        InvalidateRect(rect, TRUE);     // Could not get a DC - invalidate it anyway
+    // and hope that OnPaint manages to get one
+
+    if (bMustReleaseDC)
+        ReleaseDC(pDC);
+
+	// LUC : if this is a merge cell then we have to make sure there are no drawing problem becoz of direct redraw of cell
+	// specially becoz of the freeze pane lines
+	if(bIsMergeCell)
+	{
+		InvalidateRect(rect, TRUE);
+	}
+    
+	return bResult;
+}
+
+// redraw a complete row
+BOOL CGridCtrl::RedrawRow(int row)
+{
+    BOOL bResult = TRUE;
+
+    CDC* pDC = GetDC();
+    for (int col = 0; col < GetColumnCount(); col++)
+        bResult = RedrawCell(row, col, pDC) && bResult;
+    if (pDC)
+        ReleaseDC(pDC);
+
+    return bResult;
+}
+
+// redraw a complete column
+BOOL CGridCtrl::RedrawColumn(int col)
+{
+    BOOL bResult = TRUE;
+
+    CDC* pDC = GetDC();
+    for (int row = 0; row < GetRowCount(); row++)
+        bResult = RedrawCell(row, col, pDC) && bResult;
+    if (pDC)
+        ReleaseDC(pDC);
+
+    return bResult;
+}
+
+
+// Sets the currently selected cell, returning the previous current cell
+CCellID CGridCtrl::SetFocusCell(int nRow, int nCol)
+{
+    return SetFocusCell(CCellID(nRow, nCol));
+}
+
+CCellID CGridCtrl::SetFocusCell(CCellID cell)
+{
+    if (cell == m_idCurrentCell)
+        return m_idCurrentCell;
+
+    CCellID idPrev = m_idCurrentCell;
+
+    // EFW - Bug Fix - Force focus to be in a non-fixed cell
+    if (cell.row != -1 && cell.row < GetFixedRowCount(m_bExcludeFreezedRowsFromSelection))
+        cell.row = GetFixedRowCount(m_bExcludeFreezedRowsFromSelection);
+    if (cell.col != -1 && cell.col < GetFixedColumnCount(m_bExcludeFreezedColsFromSelection))
+        cell.col = GetFixedColumnCount(m_bExcludeFreezedColsFromSelection);
+
+    m_idCurrentCell = cell;
+
+    if (IsValid(idPrev))
+    {
+        SetItemState(idPrev.row, idPrev.col,
+            GetItemState(idPrev.row, idPrev.col) & ~GVIS_FOCUSED);
+        RedrawCell(idPrev); // comment to reduce flicker
+
+        if (GetTrackFocusCell() && idPrev.col != m_idCurrentCell.col)
+            for (int row = 0; row < m_nFixedRows; row++)
+                RedrawCell(row, idPrev.col);
+        if (GetTrackFocusCell() && idPrev.row != m_idCurrentCell.row)
+            for (int col = 0; col < m_nFixedCols; col++)
+                RedrawCell(idPrev.row, col);
+    }
+
+    if (IsValid(m_idCurrentCell))
+    {
+        SetItemState(m_idCurrentCell.row, m_idCurrentCell.col,
+            GetItemState(m_idCurrentCell.row, m_idCurrentCell.col) | GVIS_FOCUSED);
+
+        RedrawCell(m_idCurrentCell); // comment to reduce flicker
+
+        if (GetTrackFocusCell() && idPrev.col != m_idCurrentCell.col)
+            for (int row = 0; row < m_nFixedRows; row++)
+                RedrawCell(row, m_idCurrentCell.col);
+        if (GetTrackFocusCell() && idPrev.row != m_idCurrentCell.row)
+            for (int col = 0; col < m_nFixedCols; col++)
+                RedrawCell(m_idCurrentCell.row, col);
+
+        // EFW - New addition.  If in list mode, make sure the selected
+        // row highlight follows the cursor.
+        // Removed by C Maunder 27 May
+        //if (m_bListMode)
+        //{
+        //    m_PrevSelectedCellMap.RemoveAll();
+        //    m_MouseMode = MOUSE_SELECT_ROW;
+        //    OnSelecting(m_idCurrentCell);
+
+            // Leave this off so that you can still drag the highlight around
+            // without selecting rows.
+            // m_MouseMode = MOUSE_NOTHING;
+        //}
+
+	}
+
+    return idPrev;
+}
+
+// Sets the range of currently selected cells
+void CGridCtrl::SetSelectedRange(const CCellRange& Range,
+                                 BOOL bForceRepaint /* = FALSE */, BOOL bSelectCells/*=TRUE*/)
+{
+    SetSelectedRange(Range.GetMinRow(), Range.GetMinCol(),
+                     Range.GetMaxRow(), Range.GetMaxCol(),
+                     bForceRepaint, bSelectCells);
+}
+
+void CGridCtrl::SetSelectedRange(int nMinRow, int nMinCol, int nMaxRow, int nMaxCol,
+                                 BOOL bForceRepaint /* = FALSE */, BOOL bSelectCells/*=TRUE*/)
+{
+    if (!m_bEnableSelection)
+        return;
+
+	CWaitCursor wait; // Thomas Haase 
+	
+
+    CDC* pDC = NULL;
+    if (bForceRepaint)
+        pDC = GetDC();
+
+	// Only redraw visible cells
+    CCellRange VisCellRange, FixedVisCellRange;
+	if (IsWindow(GetSafeHwnd()))
+
+	{
+		VisCellRange = GetVisibleNonFixedCellRange(NULL, 0);
+		FixedVisCellRange = GetVisibleFixedCellRange();
+	}
+   
+    // EFW - Bug fix - Don't allow selection of fixed rows
+	// LUC    
+	int Left= (m_AllowSelectRowInFixedCol ? 0 : GetFixedColumnCount(m_bExcludeFreezedColsFromSelection));
+
+	if(nMinRow >= 0 && nMinRow < GetFixedRowCount(m_bExcludeFreezedRowsFromSelection))
+        nMinRow = GetFixedRowCount(m_bExcludeFreezedRowsFromSelection);
+    if(nMaxRow >= 0 && nMaxRow < GetFixedRowCount(m_bExcludeFreezedRowsFromSelection))
+        nMaxRow = GetFixedRowCount(m_bExcludeFreezedRowsFromSelection);
+    if(nMinCol >= 0 && nMinCol < Left)
+        nMinCol = GetFixedColumnCount(m_bExcludeFreezedColsFromSelection);
+    if(nMaxCol >= 0 && nMaxCol < Left)
+        nMaxCol = GetFixedColumnCount(m_bExcludeFreezedColsFromSelection);
+
+	// LUC
+	for(int row = nMinRow; row <= nMaxRow; row++)
+	{
+		for(int col = nMinCol; col <= nMaxCol; col++)
+		{				
+			int nMergedMinRow = row, nMergedMinCol = col;
+			if(GetTopLeftMergedCell(nMergedMinRow, nMergedMinCol, rectNull))
+			{	
+				if(nMinRow > nMergedMinRow)
+				{
+					nMinRow = nMergedMinRow;
+				}
+				if(nMinCol > nMergedMinCol)
+				{
+					nMinCol = nMergedMinCol;
+				}								
+			}
+			int nMergedMaxRow = row, nMergedMaxCol = col;			
+			
+			if(GetBottomRightMergedCell(nMergedMaxRow, nMergedMaxCol, rectNull))
+			{
+				if(nMaxRow < nMergedMaxRow)
+				{
+					nMaxRow = nMergedMaxRow;
+				}
+				if(nMaxCol < nMergedMaxCol)
+				{
+					nMaxCol = nMergedMaxCol;
+				}
+			
+				// let's try to make it a bit efficient
+				row = nMergedMaxRow;
+				col = nMergedMaxCol;
+			}
+									
+		}
+	}		
+	////
+    // If we are selecting cells, then first clear out the list of currently selected cells, then
+    if (bSelectCells)
+    {
+        POSITION pos;
+
+        // Unselect all previously selected cells
+        for (pos = m_SelectedCellMap.GetStartPosition(); pos != NULL; )
+        {
+            DWORD key;
+            CCellID cell;
+            m_SelectedCellMap.GetNextAssoc(pos, key, (CCellID&)cell);
+
+            // Reset the selection flag on the cell
+            if (IsValid(cell))
+            {
+                // This will remove the cell from the m_SelectedCellMap map
+                SetItemState(cell.row, cell.col,
+                    GetItemState(cell.row, cell.col) & ~GVIS_SELECTED);
+
+                // If this is to be reselected, continue on past the redraw
+                if (nMinRow <= cell.row && cell.row <= nMaxRow &&
+                    nMinCol <= cell.col && cell.col <= nMaxCol)
+                    continue;
+
+				if ( (VisCellRange.IsValid() && VisCellRange.InRange( cell )) || FixedVisCellRange.InRange( cell ) )
+				{
+					if (bForceRepaint && pDC)                    // Redraw NOW
+						RedrawCell(cell.row, cell.col, pDC);
+					else
+						InvalidateCellRect(cell);                // Redraw at leisure
+				}
+            }
+            else
+            {
+                m_SelectedCellMap.RemoveKey( key);  // if it's not valid, get rid of it!
+            }
+        }
+
+        // if we are selecting cells, and there are previous selected cells to be retained 
+        // (eg Ctrl is being held down) then copy them to the newly created list, and mark 
+        // all these cells as selected
+        // Note that if we are list mode, single row selection, then we won't be adding 
+        // the previous cells. Only the current row of cells will be added (see below)
+        if (!GetSingleRowSelection() &&
+            nMinRow >= 0 && nMinCol >= 0 && nMaxRow >= 0 && nMaxCol >= 0)
+        {
+            for (pos = m_PrevSelectedCellMap.GetStartPosition(); pos != NULL; /* nothing */)
+            {
+                DWORD key;
+                CCellID cell;
+                m_PrevSelectedCellMap.GetNextAssoc(pos, key, (CCellID&)cell);
+
+                if (!IsValid(cell))
+                    continue;
+
+                int nState = GetItemState(cell.row, cell.col);
+
+                // Set state as Selected. This will add the cell to m_SelectedCellMap
+                SetItemState(cell.row, cell.col, nState | GVIS_SELECTED);
+
+				if (( VisCellRange.IsValid() && VisCellRange.InRange( cell ))  || FixedVisCellRange.InRange( cell )  )
+				{
+					// Redraw (immediately or at leisure)
+					if (bForceRepaint && pDC)
+					    RedrawCell(cell.row, cell.col, pDC);
+					else
+					    InvalidateCellRect(cell);
+				}
+            }
+        }
+    }
+
+    // Now select/deselect all cells in the cell range specified. If selecting, and the cell 
+    // has already been marked as selected (above) then ignore it. If we are deselecting and
+    // the cell isn't selected, then ignore
+    if (nMinRow >= 0 && nMinCol >= 0 && nMaxRow >= 0 && nMaxCol >= 0 &&
+        nMaxRow < m_nRows && nMaxCol < m_nCols &&
+        nMinRow <= nMaxRow && nMinCol <= nMaxCol)
+    {
+        for (int row = nMinRow; row <= nMaxRow; row++)
+            for (int col = nMinCol; col <= nMaxCol; col++)
+            {
+                BOOL bCellSelected = IsCellSelected(row, col);
+                if (bSelectCells == bCellSelected)
+                    continue;    // Already selected or deselected - ignore
+
+                // Set the selected state. This will add/remove the cell to m_SelectedCellMap
+                if (bSelectCells)
+                    SetItemState(row, col, GetItemState(row, col) | GVIS_SELECTED);
+                else
+                    SetItemState(row, col, GetItemState(row, col) & ~GVIS_SELECTED);
+
+				if ( (VisCellRange.IsValid() && VisCellRange.InRange(row, col))  || FixedVisCellRange.InRange(row, col) )
+				{
+	                // Redraw (immediately or at leisure)
+	                if (bForceRepaint && pDC)
+	                    RedrawCell(row, col, pDC);
+	                else
+	                    InvalidateCellRect(row, col);
+				}
+            }
+    }
+    //    TRACE(_T("%d cells selected.\n"), m_SelectedCellMap.GetCount());
+
+    if (pDC != NULL)
+        ReleaseDC(pDC);
+}
+
+// selects all cells
+void CGridCtrl::SelectAllCells()
+{
+    if (!m_bEnableSelection)
+        return;
+
+    SetSelectedRange(m_nFixedRows, m_nFixedCols, GetRowCount()-1, GetColumnCount()-1);
+}
+
+// selects columns
+void CGridCtrl::SelectColumns(CCellID currentCell, 
+                              BOOL bForceRedraw /*=FALSE*/, BOOL bSelectCells /*=TRUE*/)
+{
+    if (!m_bEnableSelection)
+        return;
+
+    //if (currentCell.col == m_idCurrentCell.col) return;
+    if (currentCell.col < m_nFixedCols)
+        return;
+    if (!IsValid(currentCell))
+        return;
+
+    if (GetSingleColSelection())
+        SetSelectedRange(GetFixedRowCount(), currentCell.col,
+                         GetRowCount()-1,    currentCell.col,
+                         bForceRedraw, bSelectCells);
+    else
+        SetSelectedRange(GetFixedRowCount(),
+                         min(m_SelectionStartCell.col, currentCell.col),
+                         GetRowCount()-1,
+                         max(m_SelectionStartCell.col, currentCell.col),
+                         bForceRedraw, bSelectCells);
+}
+
+// selects rows
+void CGridCtrl::SelectRows(CCellID currentCell, 
+                           BOOL bForceRedraw /*=FALSE*/, BOOL bSelectCells /*=TRUE*/)
+{
+    if (!m_bEnableSelection)
+        return;
+
+    //if (currentCell.row; == m_idCurrentCell.row) return;
+    if (currentCell.row < m_nFixedRows)
+        return;
+    if (!IsValid(currentCell))
+        return;
+	int Left = ( m_AllowSelectRowInFixedCol ? 0 : GetFixedColumnCount());
+    if (GetSingleRowSelection())
+        SetSelectedRange(currentCell.row, Left ,
+                         currentCell.row, GetColumnCount()-1, 
+                         bForceRedraw, bSelectCells);
+    else
+        SetSelectedRange(min(m_SelectionStartCell.row, currentCell.row),
+                         Left,
+                         __max(m_SelectionStartCell.row, currentCell.row),
+                         GetColumnCount()-1,
+                         bForceRedraw, bSelectCells);
+}
+
+// selects cells
+void CGridCtrl::SelectCells(CCellID currentCell, 
+                            BOOL bForceRedraw /*=FALSE*/, BOOL bSelectCells /*=TRUE*/)
+{
+    if (!m_bEnableSelection)
+        return;
+
+    int row = currentCell.row;
+    int col = currentCell.col;
+	// LUC
+    if (row < GetFixedRowCount(m_bExcludeFreezedRowsFromSelection) || col < GetFixedColumnCount(m_bExcludeFreezedColsFromSelection))
+		if (row < GetFixedRowCount() || col < GetFixedColumnCount())
+	{
+		return;
+	}
+    if (!IsValid(currentCell))
+        return;
+
+    // Prevent unnecessary redraws
+    //if (currentCell == m_LeftClickDownCell)  return;
+    //else if (currentCell == m_idCurrentCell) return;
+
+    SetSelectedRange(min(m_SelectionStartCell.row, row),
+                     min(m_SelectionStartCell.col, col),
+                     __max(m_SelectionStartCell.row, row),
+                     __max(m_SelectionStartCell.col, col),
+                     bForceRedraw, bSelectCells);
+}
+
+// Called when mouse/keyboard selection is a-happening.
+void CGridCtrl::OnSelecting(const CCellID& currentCell)
+{
+    if (!m_bEnableSelection)
+        return;
+
+    switch (m_MouseMode)
+    {
+    case MOUSE_SELECT_ALL:
+        SelectAllCells();
+        break;
+    case MOUSE_SELECT_COL:
+        SelectColumns(currentCell, FALSE);
+        break;
+    case MOUSE_SELECT_ROW:
+        SelectRows(currentCell, FALSE);
+        break;
+    case MOUSE_SELECT_CELLS:
+        SelectCells(currentCell, FALSE);
+        break;
+    }
+
+    // EFW - Bug fix [REMOVED CJM: this will cause infinite loop in list mode]
+    // SetFocusCell(max(currentCell.row, m_nFixedRows), max(currentCell.col, m_nFixedCols));
+}
+
+void CGridCtrl::ValidateAndModifyCellContents(int nRow, int nCol, LPCTSTR strText)
+{
+    if (!IsCellEditable(nRow, nCol))
+        return;
+
+    if (SendMessageToParent(nRow, nCol, GVN_BEGINLABELEDIT) >= 0)
+    {
+        CString strCurrentText = GetItemText(nRow, nCol);
+        if (strCurrentText != strText)
+        {
+            SetItemText(nRow, nCol, strText);
+            if (ValidateEdit(nRow, nCol, strText) && 
+                SendMessageToParent(nRow, nCol, GVN_ENDLABELEDIT) >= 0)
+            {
+                SetModified(TRUE, nRow, nCol);
+                RedrawCell(nRow, nCol);
+            }
+            else
+            {
+                SetItemText(nRow, nCol, strCurrentText);
+            }
+        }
+    }
+}
+
+void CGridCtrl::ClearCells(CCellRange Selection)
+{
+    for (int row = Selection.GetMinRow(); row <= Selection.GetMaxRow(); row++)
+    {
+        for (int col = Selection.GetMinCol(); col <= Selection.GetMaxCol(); col++)
+        {
+            // don't clear hidden cells
+            if ( m_arRowHeights[row] > 0 && m_arColWidths[col] > 0 )
+            {
+                ValidateAndModifyCellContents(row, col, _T(""));
+            }
+		}
+	}
+    Refresh();
+}
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+
+////////////////////////////////////////////////////////////////////////////////////////
+// Clipboard functions
+
+// Deletes the contents from the selected cells
+void CGridCtrl::CutSelectedText()
+{
+    if (!IsEditable())
+        return;
+
+    for (POSITION pos = m_SelectedCellMap.GetStartPosition(); pos != NULL; )
+    {
+		DWORD key;
+        CCellID cell;
+        m_SelectedCellMap.GetNextAssoc(pos, key, (CCellID&)cell);
+        ValidateAndModifyCellContents(cell.row, cell.col, _T(""));
+    }
+}
+
+// Copies text from the selected cells to the clipboard
+COleDataSource* CGridCtrl::CopyTextFromGrid()
+{
+    USES_CONVERSION;
+
+    CCellRange Selection = GetSelectedCellRange();
+    if (!IsValid(Selection))
+        return NULL;
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(Selection);
+
+    // Write to shared file (REMEBER: CF_TEXT is ANSI, not UNICODE, so we need to convert)
+    CSharedFile sf(GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
+
+    // Get a tab delimited string to copy to cache
+    CString str;
+    CGridCellBase *pCell;
+    for (int row = Selection.GetMinRow(); row <= Selection.GetMaxRow(); row++)
+    {
+        // don't copy hidden cells
+        if( m_arRowHeights[row] <= 0 )
+            continue;
+
+        str.Empty();
+        for (int col = Selection.GetMinCol(); col <= Selection.GetMaxCol(); col++)
+        {
+            // don't copy hidden cells
+            if( m_arColWidths[col] <= 0 )
+                continue;
+
+            pCell = GetCell(row, col);
+            if (pCell &&(pCell->GetState() & GVIS_SELECTED))
+            {
+                // if (!pCell->GetText())
+                //    str += _T(" ");
+                // else 
+                str += pCell->GetText();
+            }
+            if (col != Selection.GetMaxCol()) 
+                str += _T("\t");
+        }
+
+        if (row != Selection.GetMaxRow()) 
+            str += _T("\r\n");
+        
+        sf.Write(T2A(str.GetBuffer(1)), str.GetLength());
+        str.ReleaseBuffer();
+    }
+    
+    char c = '\0';
+    sf.Write(&c, 1);
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(CCellRange(-1,-1,-1,-1));
+
+    DWORD dwLen = (DWORD) sf.GetLength();
+    HGLOBAL hMem = sf.Detach();
+    if (!hMem)
+        return NULL;
+
+    hMem = ::GlobalReAlloc(hMem, dwLen, GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
+    if (!hMem)
+        return NULL;
+
+    // Cache data
+    COleDataSource* pSource = new COleDataSource();
+    pSource->CacheGlobalData(CF_TEXT, hMem);
+
+    return pSource;
+}
+
+// Pastes text from the clipboard to the selected cells
+BOOL CGridCtrl::PasteTextToGrid(CCellID cell, COleDataObject* pDataObject, 
+								BOOL bSelectPastedCells /*=TRUE*/)
+{
+    if (!IsValid(cell) || !IsCellEditable(cell) || !pDataObject->IsDataAvailable(CF_TEXT))
+        return FALSE;
+
+    // Get the text from the COleDataObject
+    HGLOBAL hmem = pDataObject->GetGlobalData(CF_TEXT);
+    CMemFile sf((BYTE*) ::GlobalLock(hmem), (UINT)::GlobalSize(hmem));
+
+    // CF_TEXT is ANSI text, so we need to allocate a char* buffer
+    // to hold this.
+	//LPTSTR szBuffer = new TCHAR[::GlobalSize(hmem)];
+    char* szBuffer = new char[::GlobalSize(hmem)];
+    if (!szBuffer)
+        return FALSE;
+
+    sf.Read(szBuffer, (UINT)::GlobalSize(hmem));
+    ::GlobalUnlock(hmem);
+
+    // Now store in generic TCHAR form so we no longer have to deal with
+    // ANSI/UNICODE problems
+    CString strText = szBuffer;
+    delete szBuffer;
+
+    // Parse text data and set in cells...
+    strText.LockBuffer();
+    CString strLine = strText;
+    int nLine = 0;
+
+    // Find the end of the first line
+	CCellRange PasteRange(cell.row, cell.col,-1,-1);
+    int nIndex;
+    do
+    {
+        int nColumn = 0;
+        nIndex = strLine.Find(_T("\n"));
+
+        // Store the remaining chars after the newline
+        CString strNext = (nIndex < 0)? _T("")  : strLine.Mid(nIndex + 1);
+
+        // Remove all chars after the newline
+        if (nIndex >= 0)
+            strLine = strLine.Left(nIndex);
+
+        int nLineIndex = strLine.FindOneOf(_T("\t,"));
+        CString strCellText = (nLineIndex >= 0)? strLine.Left(nLineIndex) : strLine;
+
+        // skip hidden rows
+        int iRowVis = cell.row + nLine;
+        while( iRowVis < GetRowCount())
+        {
+            if( GetRowHeight( iRowVis) > 0)
+                break;
+            nLine++;
+            iRowVis++;
+        }
+
+        while (!strLine.IsEmpty())
+        {
+            // skip hidden columns
+            int iColVis = cell.col + nColumn;
+            while( iColVis < GetColumnCount())
+            {
+                if( GetColumnWidth( iColVis) > 0)
+                    break;
+                nColumn++;
+                iColVis++;
+            }
+
+            CCellID TargetCell(iRowVis, iColVis);
+            if (IsValid(TargetCell))
+            {
+                strCellText.TrimLeft();
+                strCellText.TrimRight();
+
+                ValidateAndModifyCellContents(TargetCell.row, TargetCell.col, strCellText);
+
+                // Make sure cell is not selected to avoid data loss
+                SetItemState(TargetCell.row, TargetCell.col,
+                    GetItemState(TargetCell.row, TargetCell.col) & ~GVIS_SELECTED);
+
+				if (iRowVis > PasteRange.GetMaxRow()) PasteRange.SetMaxRow(iRowVis);
+				if (iColVis > PasteRange.GetMaxCol()) PasteRange.SetMaxCol(iColVis);
+            }
+
+            strLine = (nLineIndex >= 0)? strLine.Mid(nLineIndex + 1) : _T("");
+            nLineIndex = strLine.FindOneOf(_T("\t,"));
+            strCellText = (nLineIndex >= 0)? strLine.Left(nLineIndex) : strLine;
+
+            nColumn++;
+        }
+
+        strLine = strNext;
+        nLine++;
+    } while (nIndex >= 0);
+
+    strText.UnlockBuffer();
+
+	if (bSelectPastedCells)
+		SetSelectedRange(PasteRange, TRUE);
+	else
+	{
+		ResetSelectedRange();
+		Refresh();
+	}
+
+    return TRUE;
+}
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+
+// Start drag n drop
+void CGridCtrl::OnBeginDrag()
+{
+    COleDataSource* pSource = NULL;
+    if (!m_bAllowDragAndDrop && m_CurCol==-1)
+        return;
+
+    if (m_CurCol>=0)	pSource = new COleDataSource();
+    if (!pSource && m_bAllowDragAndDrop) pSource = CopyTextFromGrid();
+    if (pSource)
+    {
+        SendMessageToParent(GetSelectedCellRange().GetTopLeft().row,
+            GetSelectedCellRange().GetTopLeft().col,
+            GVN_BEGINDRAG);
+
+        m_MouseMode = MOUSE_DRAGGING;
+        m_bLMouseButtonDown = FALSE;
+
+        DROPEFFECT dropEffect = pSource->DoDragDrop(DROPEFFECT_COPY | DROPEFFECT_MOVE);
+
+        if (dropEffect & DROPEFFECT_MOVE)
+            CutSelectedText();
+
+        if (pSource)
+            delete pSource;    // Did not pass source to clipboard, so must delete
+
+    }
+}
+
+// Handle drag over grid
+DROPEFFECT CGridCtrl::OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState,
+                                 CPoint point)
+{
+    // Find which cell we are over and drop-highlight it
+    CCellID cell = GetCellFromPt(point, FALSE);
+	bool Valid;
+    // Any text data available for us?
+	if(m_CurCol==-1)
+	{
+		if(m_bDragRowMode)
+		{
+			Valid = cell.col>=GetFixedColumnCount() && cell.row>=GetFixedRowCount();
+		}
+		else
+		{
+    if (!m_bAllowDragAndDrop || !IsEditable() || !pDataObject->IsDataAvailable(CF_TEXT))
+        return DROPEFFECT_NONE;
+			Valid = IsValid(cell)!=0;
+		}
+	}
+	else
+	{
+		Valid = cell.col>=GetFixedColumnCount() &&   cell.row<GetFixedRowCount() ;
+	}
+
+
+    // If not valid, set the previously drop-highlighted cell as no longer drop-highlighted
+    if (!Valid)
+    {
+        OnDragLeave();
+        m_LastDragOverCell = CCellID(-1,-1);
+        return DROPEFFECT_NONE;
+    }
+	if(m_CurCol==-1)
+	{
+		if (!m_bDragRowMode && !IsCellEditable(cell))
+        return DROPEFFECT_NONE;
+	}
+
+    // Have we moved over a different cell than last time?
+    if (cell != m_LastDragOverCell)
+    {
+        // Set the previously drop-highlighted cell as no longer drop-highlighted
+        if (IsValid(m_LastDragOverCell))
+        {
+            UINT nState = GetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col);
+            SetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col,
+                nState & ~GVIS_DROPHILITED);
+            RedrawCell(m_LastDragOverCell);
+        }
+
+        m_LastDragOverCell = cell;
+
+        // Set the new cell as drop-highlighted
+        if (IsValid(m_LastDragOverCell))
+        {
+            UINT nState = GetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col);
+            SetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col,
+                nState | GVIS_DROPHILITED);
+            RedrawCell(m_LastDragOverCell);
+        }
+    }
+
+    // Return an appropraite value of DROPEFFECT so mouse cursor is set properly
+    if (dwKeyState & MK_CONTROL)
+        return DROPEFFECT_COPY;
+    else
+        return DROPEFFECT_MOVE;
+}
+
+// Something has just been dragged onto the grid
+DROPEFFECT CGridCtrl::OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState,
+                                  CPoint point)
+{
+    // Any text data available for us?
+    m_LastDragOverCell = GetCellFromPt(point, m_CurCol>=0);
+	bool Valid;
+	if(m_CurCol==-1)
+	{
+    if (!m_bAllowDragAndDrop || !pDataObject->IsDataAvailable(CF_TEXT))
+        return DROPEFFECT_NONE;
+
+    // Find which cell we are over and drop-highlight it
+    if (!IsValid(m_LastDragOverCell))
+        return DROPEFFECT_NONE;
+
+    if (!IsCellEditable(m_LastDragOverCell))
+        return DROPEFFECT_NONE;
+		Valid = IsValid(m_LastDragOverCell)!=0;
+
+	}
+	else
+	{
+		Valid = m_LastDragOverCell.row>=0 && m_LastDragOverCell.row<GetFixedRowCount() && m_LastDragOverCell.col>=GetFixedColumnCount();
+	}
+
+    if (Valid)
+    {
+        UINT nState = GetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col);
+        SetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col,
+            nState | GVIS_DROPHILITED);
+        RedrawCell(m_LastDragOverCell);
+    }
+
+    // Return an appropraite value of DROPEFFECT so mouse cursor is set properly
+    if (dwKeyState & MK_CONTROL)
+        return DROPEFFECT_COPY;
+    else
+        return DROPEFFECT_MOVE;
+}
+
+// Something has just been dragged away from the grid
+void CGridCtrl::OnDragLeave()
+{
+    // Set the previously drop-highlighted cell as no longer drop-highlighted
+    if (IsValid(m_LastDragOverCell))
+    {
+        UINT nState = GetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col);
+        SetItemState(m_LastDragOverCell.row, m_LastDragOverCell.col,
+            nState & ~GVIS_DROPHILITED);
+        RedrawCell(m_LastDragOverCell);
+    }
+}
+
+// Something has just been dropped onto the grid
+BOOL CGridCtrl::OnDrop(COleDataObject* pDataObject, DROPEFFECT /*dropEffect*/,
+                       CPoint /* point */)
+{
+    m_MouseMode = MOUSE_NOTHING;
+    if(m_CurCol ==-1)
+	{
+		if (!m_bAllowDragAndDrop || (!IsCellEditable(m_LastDragOverCell) && !m_bDragRowMode))
+        return FALSE;
+	}
+
+    OnDragLeave();
+    if (m_CurCol>=0)
+	{
+		if(m_LastDragOverCell.col == m_CurCol || m_LastDragOverCell.row >= GetFixedRowCount()) 
+			return FALSE;
+		else
+		{
+			int New = m_arColOrder[m_CurCol];
+			m_arColOrder.erase(m_arColOrder.begin()+m_CurCol);
+			m_arColOrder.insert(m_arColOrder.begin()+m_LastDragOverCell.col, New);
+			m_CurCol=-1;
+			Invalidate();
+			return TRUE;
+		}
+	}
+	else
+	{
+		if(m_bDragRowMode)
+		{
+			Reorder(m_CurRow,m_LastDragOverCell.row);
+			Invalidate();
+			return TRUE;
+		}
+		else
+    return PasteTextToGrid(m_LastDragOverCell, pDataObject, FALSE);
+}
+}
+#endif
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+void CGridCtrl::OnEditCut()
+{
+    if (!IsEditable())
+        return;
+
+    COleDataSource* pSource = CopyTextFromGrid();
+    if (!pSource)
+        return;
+
+    pSource->SetClipboard();
+    CutSelectedText();
+}
+
+void CGridCtrl::OnEditCopy()
+{
+    COleDataSource* pSource = CopyTextFromGrid();
+    if (!pSource)
+        return;
+
+    pSource->SetClipboard();
+}
+
+void CGridCtrl::OnEditPaste()
+{
+    if (!IsEditable())
+        return;
+
+	CCellRange cellRange = GetSelectedCellRange();
+
+	// Get the top-left selected cell, or the Focus cell, or the topleft (non-fixed) cell
+	CCellID cell;
+	if (cellRange.IsValid())
+	{
+		cell.row = cellRange.GetMinRow();
+		cell.col = cellRange.GetMinCol();
+	}
+	else
+	{
+		cell = GetFocusCell();
+		if (!IsValid(cell))
+			cell = GetTopleftNonFixedCell();
+		if (!IsValid(cell))
+			return;
+	}
+
+	// If a cell is being edited, then call it's edit window paste function.
+    if ( IsItemEditing(cell.row, cell.col) )
+    {
+        CGridCellBase* pCell = GetCell(cell.row, cell.col);
+//        ASSERT(pCell);
+        if (!pCell) return;
+
+		CWnd* pEditWnd = pCell->GetEditWnd();
+		if ( pEditWnd && pEditWnd->IsKindOf(RUNTIME_CLASS(CEdit)) )
+		{
+			((CEdit*)pEditWnd)->Paste();
+			return;
+		}
+    }
+
+    // Attach a COleDataObject to the clipboard and paste the data to the grid
+    COleDataObject obj;
+    if (obj.AttachClipboard())
+        PasteTextToGrid(cell, &obj);
+}
+#endif
+
+void CGridCtrl::OnEditSelectAll()
+{
+    SendMessageToParent(m_LeftClickDownCell.row, m_LeftClickDownCell.col, GVN_SELCHANGING);
+    SelectAllCells();
+    SendMessageToParent(m_idCurrentCell.row, m_idCurrentCell.col, GVN_SELCHANGED);
+}
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+void CGridCtrl::OnUpdateEditCopy(CCmdUI* pCmdUI)
+{
+	pCmdUI->Enable(GetSelectedCount() > 0); // - Thomas Haase 
+    //CCellRange Selection = GetSelectedCellRange();
+    //pCmdUI->Enable(Selection.Count() && IsValid(Selection));
+}
+
+void CGridCtrl::OnUpdateEditCut(CCmdUI* pCmdUI)
+{
+	pCmdUI->Enable(IsEditable() && GetSelectedCount() > 0); // - Thomas Haase 
+    //CCellRange Selection = GetSelectedCellRange();
+    //pCmdUI->Enable(IsEditable() && Selection.Count() && IsValid(Selection));
+}
+
+void CGridCtrl::OnUpdateEditPaste(CCmdUI* pCmdUI)
+{
+    CCellID cell = GetFocusCell();
+
+    BOOL bCanPaste = IsValid(cell) && IsCellEditable(cell) &&
+        ::IsClipboardFormatAvailable(CF_TEXT);
+
+    pCmdUI->Enable(bCanPaste);
+}
+#endif
+
+void CGridCtrl::OnUpdateEditSelectAll(CCmdUI* pCmdUI)
+{
+    pCmdUI->Enable(m_bEnableSelection);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////
+// hittest-like functions
+
+// TRUE if the mouse is over a row resize area
+BOOL CGridCtrl::MouseOverRowResizeArea(CPoint& point)
+{
+    if (point.x >= GetFixedColumnWidth())
+        return FALSE;
+
+    CCellID idCurrentCell = GetCellFromPt(point);
+    CPoint start;
+    if (!GetCellOrigin(idCurrentCell, &start))
+        return FALSE;
+
+    int endy = start.y + GetRowHeight(idCurrentCell.row);
+
+    if ((point.y - start.y < m_nResizeCaptureRange && idCurrentCell.row != 0) ||
+        endy - point.y < m_nResizeCaptureRange)
+    {
+        return TRUE;
+    }
+    else
+        return FALSE;
+}
+
+// TRUE if the mouse is over a column resize area. point is in Client coords
+BOOL CGridCtrl::MouseOverColumnResizeArea(CPoint& point)
+{
+    if (point.y >= GetFixedRowHeight())
+        return FALSE;
+
+    CCellID idCurrentCell = GetCellFromPt(point);
+    CPoint start;
+    if (!GetCellOrigin(idCurrentCell, &start))
+        return FALSE;
+
+    int endx = start.x + GetColumnWidth(idCurrentCell.col);
+
+    if ((point.x - start.x < m_nResizeCaptureRange && idCurrentCell.col != 0) ||
+        endx - point.x < m_nResizeCaptureRange)
+    {
+        return TRUE;
+    }
+    else
+        return FALSE;
+}
+
+// Get cell from point.
+// point - client coordinates
+// bAllowFixedCellCheck - if TRUE then fixed cells are checked
+CCellID CGridCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck/* =TRUE*/, CCellID& cellOriginal/*= cellNull*/)
+{
+    CCellID cellID; // return value
+
+    CCellID idTopLeft = GetTopleftNonFixedCell();
+	if (!bAllowFixedCellCheck && !IsValid(idTopLeft))
+		return cellID;
+
+    // calculate column index
+	// LUC
+    int fixedColWidth = GetFixedColumnWidth(TRUE);
+	int nFixedCols = m_nFixedCols + m_nFreezedCols;
+
+    if (point.x < 0 || (!bAllowFixedCellCheck && point.x < fixedColWidth)) // not in window
+        cellID.col = -1;
+    else if (point.x < fixedColWidth) // in fixed col
+    {
+        int xpos = 0;
+        int col = 0;
+        while (col < nFixedCols)
+        {
+            xpos += GetColumnWidth(col);
+            if (xpos > point.x)
+                break;
+			col++;
+        }
+
+        cellID.col = col;
+    }
+    else    // in non-fixed col
+    {
+        int xpos = fixedColWidth;
+		int col = idTopLeft.col; //m_nFixedCols;
+        while ( col < GetColumnCount())
+        {
+            xpos += GetColumnWidth(col);
+            if (xpos > point.x)
+                break;
+			col++;
+        }
+
+        if (col >= GetColumnCount())
+            cellID.col = -1;
+        else
+            cellID.col = col;
+    }
+
+    // calculate row index
+	// LUC
+    int fixedRowHeight = GetFixedRowHeight(TRUE);
+    if (point.y < 0 || (!bAllowFixedCellCheck && point.y < fixedRowHeight)) // not in window
+        cellID.row = -1;
+    else if (point.y < fixedRowHeight) // in fixed col
+    {
+        int ypos = 0;
+        int row = 0;
+		int nFixedRows = m_nFixedRows + m_nFreezedRows;
+        while (row < nFixedRows) 
+        {
+            ypos += GetRowHeight(row);
+            if (ypos > point.y)
+                break;
+			row++;
+        }
+        cellID.row = row;
+    }
+    else
+    {
+        int ypos = fixedRowHeight;
+		int row = idTopLeft.row; //m_nFixedRows;
+        while ( row < GetRowCount() )
+        {
+            ypos += GetRowHeight(row);
+            if (ypos > point.y)
+                break;
+			row++;
+        }
+
+        if (row >= GetRowCount())
+            cellID.row = -1;
+        else
+            cellID.row = row;
+    }
+
+	// LUC
+	if(cellOriginal != cellNull)
+	{
+		cellOriginal = cellID;
+	}
+	GetTopLeftMergedCell(cellID.row, cellID.col, rectNull);
+	
+    return cellID;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// CGridCtrl cellrange functions
+
+// Gets the first non-fixed cell ID
+CCellID CGridCtrl::GetTopleftNonFixedCell(BOOL bForceRecalculation /*=FALSE*/)
+{
+    // Used cached value if possible
+    if (m_idTopLeftCell.IsValid() && !bForceRecalculation)
+        return m_idTopLeftCell;
+
+    int nVertScroll = GetScrollPos(SB_VERT), 
+        nHorzScroll = GetScrollPos(SB_HORZ);
+
+	// LUC
+    m_idTopLeftCell.col = m_nFixedCols + m_nFreezedCols;
+    int nRight = 0;
+    while (nRight < nHorzScroll && m_idTopLeftCell.col < (GetColumnCount()-1))
+        nRight += GetColumnWidth(m_idTopLeftCell.col++);
+
+	// LUC
+    m_idTopLeftCell.row = m_nFixedRows + m_nFreezedRows;
+    int nTop = 0;
+    while (nTop < nVertScroll && m_idTopLeftCell.row < (GetRowCount()-1))
+        nTop += GetRowHeight(m_idTopLeftCell.row++);
+
+
+    //TRACE2("TopLeft cell is row %d, col %d\n",m_idTopLeftCell.row, m_idTopLeftCell.col);
+    return m_idTopLeftCell;
+}
+
+
+
+
+
+// This gets even partially visible cells
+CCellRange CGridCtrl::GetVisibleNonFixedCellRange(LPRECT pRect /*=NULL*/, 
+                                                  BOOL bForceRecalculation /*=FALSE*/)
+{
+    int i;
+    CRect rect;
+    GetClientRect(rect);
+
+    CCellID idTopLeft = GetTopleftNonFixedCell(bForceRecalculation);
+
+    // calc bottom
+	// LUC
+    int bottom = GetFixedRowHeight();
+    //for (i = idTopLeft.row; i < GetRowCount(); i++)
+	for (i = m_nFixedRows; i < GetRowCount(); i++)
+    {
+		if(i == (m_nFixedRows+ m_nFreezedRows))
+		{
+			i = idTopLeft.row;
+		}
+        bottom += GetRowHeight(i);
+        if (bottom >= rect.bottom)
+        {
+            bottom = rect.bottom;
+            break;
+        }
+    }
+    int maxVisibleRow = min(i, GetRowCount() - 1);
+
+    // calc right
+	// LUC
+    int right = GetFixedColumnWidth();
+    //for (i = idTopLeft.col; i < GetColumnCount(); i++)
+	for (i = m_nFixedCols; i < GetColumnCount(); i++)
+    {
+		if(i == (m_nFixedCols + m_nFreezedCols))
+		{
+			i = idTopLeft.col;
+		}
+        right += GetColumnWidth(i);
+        if (right >= rect.right)
+        {
+            right = rect.right;
+            break;
+        }
+    }
+    int maxVisibleCol = min(i, GetColumnCount() - 1);
+    if (pRect)
+    {
+        pRect->left = pRect->top = 0;
+        pRect->right = right;
+        pRect->bottom = bottom;
+    }
+
+	// LUC
+	/*if(bIncludeFreezedCells)
+	{
+		if(m_nFreezedRows > 0)
+		{
+			idTopLeft.row = m_nFixedRows;
+		}
+		if(m_nFreezedCols > 0)
+		{
+			idTopLeft.col = m_nFixedCols;
+		}
+	}*/
+
+	if(!m_bExcludeFreezedRowsFromSelection)
+	{
+		if(m_nFreezedRows > 0)
+		{
+			idTopLeft.row = m_nFixedRows;
+		}
+		
+	}
+	if(!m_bExcludeFreezedColsFromSelection)
+	{
+		if(m_nFreezedCols > 0)
+		{
+			idTopLeft.col = m_nFixedCols;
+		}
+	}
+
+    return CCellRange(idTopLeft.row, idTopLeft.col, maxVisibleRow, maxVisibleCol);
+}
+
+
+CCellRange CGridCtrl::GetVisibleFixedCellRange(LPRECT pRect /*=NULL*/, 
+                                                  BOOL bForceRecalculation /*=FALSE*/)
+{
+    int i;
+    CRect rect;
+    GetClientRect(rect);
+
+    CCellID idTopLeft = GetTopleftNonFixedCell(bForceRecalculation);
+
+    // calc bottom
+	// LUC
+    int bottom = GetFixedRowHeight(m_bExcludeFreezedRowsFromSelection);
+    for (i = idTopLeft.row; i < GetRowCount(); i++)
+    {
+        bottom += GetRowHeight(i);
+        if (bottom >= rect.bottom)
+        {
+            bottom = rect.bottom;
+            break;
+        }
+    }
+    int maxVisibleRow = min(i, GetRowCount() - 1);
+
+    // calc right
+    int right = 0;
+    for (i = 0; i < GetFixedColumnCount(m_bExcludeFreezedColsFromSelection); i++)
+    {
+        right += GetColumnWidth(i);
+        if (right >= rect.right)
+        {
+            right = rect.right;
+            break;
+        }
+    }
+    int maxVisibleCol = min(i, GetColumnCount() - 1);
+    if (pRect)
+    {
+        pRect->left = pRect->top = 0;
+        pRect->right = right;
+        pRect->bottom = bottom;
+    }
+
+    return CCellRange(idTopLeft.row, 0, maxVisibleRow, maxVisibleCol);
+}
+
+
+
+
+// used by ResetScrollBars() - This gets only fully visible cells
+CCellRange CGridCtrl::GetUnobstructedNonFixedCellRange(BOOL bForceRecalculation /*=FALSE*/)
+{
+    CRect rect;
+    GetClientRect(rect);
+
+    CCellID idTopLeft = GetTopleftNonFixedCell(bForceRecalculation);
+
+    // calc bottom
+    int i;
+    int bottom = GetFixedRowHeight();
+    for (i = idTopLeft.row; i < GetRowCount(); i++)
+    {
+        bottom += GetRowHeight(i);
+        if (bottom >= rect.bottom)
+            break;
+    }
+    int maxVisibleRow = min(i, GetRowCount() - 1);
+    if (maxVisibleRow > 0 && bottom > rect.bottom)
+        maxVisibleRow--;
+
+    // calc right
+    int right = GetFixedColumnWidth();
+    for (i = idTopLeft.col; i < GetColumnCount(); i++)
+    {
+        right += GetColumnWidth(i);
+        if (right >= rect.right)
+            break;
+    }
+    int maxVisibleCol = min(i, GetColumnCount() - 1);
+    if (maxVisibleCol > 0 && right > rect.right)
+        maxVisibleCol--;
+
+
+    return CCellRange(idTopLeft.row, idTopLeft.col, maxVisibleRow, maxVisibleCol);
+}
+
+// Returns the minimum bounding range of the current selection
+// If no selection, then the returned CCellRange will be invalid
+CCellRange CGridCtrl::GetSelectedCellRange() const
+{
+    CCellRange Selection(GetRowCount(), GetColumnCount(), -1,-1);
+
+    for (POSITION pos = m_SelectedCellMap.GetStartPosition(); pos != NULL; )
+    {
+        DWORD key;
+        CCellID cell;
+        m_SelectedCellMap.GetNextAssoc(pos, key, (CCellID&)cell);
+
+        Selection.SetMinRow( min(Selection.GetMinRow(), cell.row) );
+        Selection.SetMinCol( min(Selection.GetMinCol(), cell.col) );
+        Selection.SetMaxRow( __max(Selection.GetMaxRow(), cell.row) );
+        Selection.SetMaxCol( __max(Selection.GetMaxCol(), cell.col) );
+    }
+
+    return Selection;
+}
+
+// Returns ALL the cells in the grid
+CCellRange CGridCtrl::GetCellRange() const
+{
+    return CCellRange(0, 0, GetRowCount() - 1, GetColumnCount() - 1);
+}
+
+// Resets the selected cell range to the empty set.
+void CGridCtrl::ResetSelectedRange()
+{
+    m_PrevSelectedCellMap.RemoveAll();
+    SetSelectedRange(-1,-1,-1,-1);
+    SetFocusCell(-1,-1);
+}
+
+// Get/Set scroll position using 32 bit functions
+int CGridCtrl::GetScrollPos32(int nBar, BOOL bGetTrackPos /* = FALSE */)
+{
+    SCROLLINFO si;
+    si.cbSize = sizeof(SCROLLINFO);
+
+    if (bGetTrackPos)
+    {
+        if (GetScrollInfo(nBar, &si, SIF_TRACKPOS))
+            return si.nTrackPos;
+    }
+    else
+    {
+        if (GetScrollInfo(nBar, &si, SIF_POS))
+            return si.nPos;
+    }
+
+    return 0;
+}
+
+BOOL CGridCtrl::SetScrollPos32(int nBar, int nPos, BOOL bRedraw /* = TRUE */)
+{
+    m_idTopLeftCell.row = -1;
+
+    SCROLLINFO si;
+    si.cbSize = sizeof(SCROLLINFO);
+    si.fMask  = SIF_POS;
+    si.nPos   = nPos;
+    return SetScrollInfo(nBar, &si, bRedraw);
+}
+
+void CGridCtrl::EnableScrollBars(int nBar, BOOL bEnable /*=TRUE*/)
+{
+    if (bEnable)
+    {
+        if (!IsVisibleHScroll() && (nBar == SB_HORZ || nBar == SB_BOTH))
+        {
+            m_nBarState |= GVL_HORZ;
+            CWnd::EnableScrollBarCtrl(SB_HORZ, bEnable);
+        }
+        
+        if (!IsVisibleVScroll() && (nBar == SB_VERT || nBar == SB_BOTH))
+        {
+            m_nBarState |= GVL_VERT;
+            CWnd::EnableScrollBarCtrl(SB_VERT, bEnable);
+        }
+    }
+    else
+    {
+        if ( IsVisibleHScroll() && (nBar == SB_HORZ || nBar == SB_BOTH))
+        {
+            m_nBarState &= ~GVL_HORZ; 
+            CWnd::EnableScrollBarCtrl(SB_HORZ, bEnable);
+        }
+        
+        if ( IsVisibleVScroll() && (nBar == SB_VERT || nBar == SB_BOTH))
+        {
+            m_nBarState &= ~GVL_VERT;
+            CWnd::EnableScrollBarCtrl(SB_VERT, bEnable);
+        }
+    }
+}
+
+// If resizing or cell counts/sizes change, call this - it'll fix up the scroll bars
+void CGridCtrl::ResetScrollBars()
+{
+    // Force a refresh. 
+    m_idTopLeftCell.row = -1;
+
+    if (!m_bAllowDraw || !::IsWindow(GetSafeHwnd())) 
+        return;
+    
+    CRect rect;
+    
+    // This would have caused OnSize event - Brian 
+    //EnableScrollBars(SB_BOTH, FALSE); 
+    
+    GetClientRect(rect);
+    
+    if (rect.left == rect.right || rect.top == rect.bottom)
+        return;
+    
+    if (IsVisibleVScroll())
+        rect.right += GetSystemMetrics(SM_CXVSCROLL) + GetSystemMetrics(SM_CXBORDER);
+    
+    if (IsVisibleHScroll())
+        rect.bottom += GetSystemMetrics(SM_CYHSCROLL) + GetSystemMetrics(SM_CYBORDER);
+    
+    rect.left += GetFixedColumnWidth(TRUE);
+    rect.top += GetFixedRowHeight(TRUE);
+    
+    
+    if (rect.left >= rect.right || rect.top >= rect.bottom)
+    {
+        EnableScrollBarCtrl(SB_BOTH, FALSE);
+        return;
+    }
+    
+    CRect VisibleRect(GetFixedColumnWidth(TRUE), GetFixedRowHeight(TRUE), 
+		              rect.right, rect.bottom);
+    CRect VirtualRect(GetFixedColumnWidth(TRUE), GetFixedRowHeight(TRUE),
+		              GetVirtualWidth(), GetVirtualHeight());
+    
+    // Removed to fix single row scrollbar problem (Pontus Goffe)
+    // CCellRange visibleCells = GetUnobstructedNonFixedCellRange();
+    // if (!IsValid(visibleCells)) return;
+        
+    //TRACE(_T("Visible: %d x %d, Virtual %d x %d.  H %d, V %d\n"), 
+    //      VisibleRect.Width(), VisibleRect.Height(),
+    //      VirtualRect.Width(), VirtualRect.Height(),
+    //      IsVisibleHScroll(), IsVisibleVScroll());
+
+    // If vertical scroll bar, horizontal space is reduced
+    if (VisibleRect.Height() < VirtualRect.Height())
+        VisibleRect.right -= ::GetSystemMetrics(SM_CXVSCROLL);
+    // If horz scroll bar, vert space is reduced
+    if (VisibleRect.Width() < VirtualRect.Width())
+        VisibleRect.bottom -= ::GetSystemMetrics(SM_CYHSCROLL);
+    
+    // Recheck vertical scroll bar
+    //if (VisibleRect.Height() < VirtualRect.Height())
+    // VisibleRect.right -= ::GetSystemMetrics(SM_CXVSCROLL);
+    
+    if (VisibleRect.Height() < VirtualRect.Height())
+    {
+        EnableScrollBars(SB_VERT, TRUE); 
+        m_nVScrollMax = VirtualRect.Height() - 1;
+    }
+    else
+    {
+        EnableScrollBars(SB_VERT, FALSE); 
+        m_nVScrollMax = 0;
+    }
+
+    if (VisibleRect.Width() < VirtualRect.Width())
+    {
+        EnableScrollBars(SB_HORZ, TRUE); 
+        m_nHScrollMax = VirtualRect.Width() - 1;
+    }
+    else
+    {
+        EnableScrollBars(SB_HORZ, FALSE); 
+        m_nHScrollMax = 0;
+    }
+
+//    ASSERT(m_nVScrollMax < INT_MAX && m_nHScrollMax < INT_MAX); // This should be fine
+
+    /* Old code - CJM
+    SCROLLINFO si;
+    si.cbSize = sizeof(SCROLLINFO);
+    si.fMask = SIF_PAGE;
+    si.nPage = (m_nHScrollMax>0)? VisibleRect.Width() : 0;
+    SetScrollInfo(SB_HORZ, &si, FALSE); 
+    si.nPage = (m_nVScrollMax>0)? VisibleRect.Height() : 0;
+    SetScrollInfo(SB_VERT, &si, FALSE);
+
+    SetScrollRange(SB_VERT, 0, m_nVScrollMax, TRUE);
+    SetScrollRange(SB_HORZ, 0, m_nHScrollMax, TRUE);
+    */
+
+    // New code - Paul Runstedler 
+    SCROLLINFO si;
+    si.cbSize = sizeof(SCROLLINFO);
+    si.fMask = SIF_PAGE | SIF_RANGE;
+    si.nPage = (m_nHScrollMax>0)? VisibleRect.Width() : 0;
+    si.nMin = 0;
+    si.nMax = m_nHScrollMax;
+    SetScrollInfo(SB_HORZ, &si, TRUE);
+
+    si.fMask |= SIF_DISABLENOSCROLL;
+    si.nPage = (m_nVScrollMax>0)? VisibleRect.Height() : 0;
+    si.nMin = 0;
+    si.nMax = m_nVScrollMax;
+    SetScrollInfo(SB_VERT, &si, TRUE);
+}
+
+////////////////////////////////////////////////////////////////////////////////////
+// Row/Column position functions
+
+// returns the top left point of the cell. Returns FALSE if cell not visible.
+BOOL CGridCtrl::GetCellOrigin(int nRow, int nCol, LPPOINT p)
+{
+    int i;
+
+    if (!IsValid(nRow, nCol))
+        return FALSE;
+
+    CCellID idTopLeft;
+	int nFixedCols = m_nFixedCols + m_nFreezedCols;
+	int nFixedRows = m_nFixedRows + m_nFreezedRows;
+
+	// LUC
+    if (nCol >= nFixedCols || nRow >= nFixedRows)
+        idTopLeft = GetTopleftNonFixedCell();
+
+    if ((nRow >= nFixedRows && nRow < idTopLeft.row) ||
+        (nCol>= nFixedCols && nCol < idTopLeft.col))
+        return FALSE;
+
+    p->x = 0;
+    if (nCol < nFixedCols)                      // is a fixed column
+        for (i = 0; i < nCol; i++)
+            p->x += GetColumnWidth(i);
+        else 
+        {                                        // is a scrollable data column
+            for (i = 0; i < nFixedCols; i++)
+                p->x += GetColumnWidth(i);
+            for (i = idTopLeft.col; i < nCol; i++)
+                p->x += GetColumnWidth(i);
+        }
+        
+        p->y = 0;
+        if (nRow < nFixedRows)                      // is a fixed row
+            for (i = 0; i < nRow; i++)
+                p->y += GetRowHeight(i);
+            else 
+            {                                        // is a scrollable data row
+                for (i = 0; i < nFixedRows; i++)
+                    p->y += GetRowHeight(i);
+                for (i = idTopLeft.row; i < nRow; i++)
+                    p->y += GetRowHeight(i);
+            }
+            
+            return TRUE;
+}
+
+BOOL CGridCtrl::GetCellOrigin(const CCellID& cell, LPPOINT p)
+{
+    return GetCellOrigin(cell.row, cell.col, p);
+}
+
+// Returns the bounding box of the cell
+BOOL CGridCtrl::GetCellRect(const CCellID& cell, LPRECT pRect)
+{
+    return GetCellRect(cell.row, cell.col, pRect);
+}
+
+BOOL CGridCtrl::GetCellRect(int nRow, int nCol, LPRECT pRect)
+{
+    CPoint CellOrigin;
+    if (!GetCellOrigin(nRow, nCol, &CellOrigin))
+        return FALSE;
+
+    pRect->left   = CellOrigin.x;
+    pRect->top    = CellOrigin.y;
+    pRect->right  = CellOrigin.x + GetColumnWidth(nCol)-1;
+    pRect->bottom = CellOrigin.y + GetRowHeight(nRow)-1;
+	
+    //TRACE("Row %d, col %d: L %d, T %d, W %d, H %d:  %d,%d - %d,%d\n",
+    //      nRow,nCol, CellOrigin.x, CellOrigin.y, GetColumnWidth(nCol), GetRowHeight(nRow),
+    //      pRect->left, pRect->top, pRect->right, pRect->bottom);
+
+    return TRUE;
+}
+
+BOOL CGridCtrl::GetTextRect(const CCellID& cell, LPRECT pRect)
+{
+    return GetTextRect(cell.row, cell.col, pRect);
+}
+
+BOOL CGridCtrl::GetTextRect(int nRow, int nCol, LPRECT pRect)
+{
+    CGridCellBase* pCell = GetCell( nRow, nCol);
+    if( pCell == NULL)
+        return FALSE;
+    
+    if( !GetCellRect( nRow, nCol, pRect) )
+        return FALSE;
+
+    return pCell->GetTextRect( pRect);
+}
+
+BOOL CGridCtrl::SetCellMaskEditable( int nRow, int nCol, BOOL bEditable )
+{
+	if (nRow < 0 || nRow >= m_pCellEnable.size())
+	{
+		return FALSE;
+	}
+
+	if (nCol < 0 || nCol >= m_pCellEnable[nRow].size())
+	{
+		return FALSE;
+	}
+
+	m_pCellEnable[nRow][nCol].SetEnable(bEditable);
+
+	return TRUE;
+}
+
+BOOL CGridCtrl::isCellMaskEditable( int nRow, int nCol )
+{
+	if (nRow < 0 || nRow >= m_pCellEnable.size())
+	{
+		return FALSE;
+	}
+
+	if (nCol < 0 || nCol >= m_pCellEnable[nRow].size())
+	{
+		return FALSE;
+	}
+	
+	return m_pCellEnable[nRow][nCol].isEnable();
+}
+
+BOOL CGridCtrl::isCellMaskActivated( int nRow, int nCol )
+{
+	if (nRow < 0 || nRow >= m_pCellEnable.size())
+	{
+		return FALSE;
+	}
+
+	if (nCol < 0 || nCol >= m_pCellEnable[nRow].size())
+	{
+		return FALSE;
+	}
+
+	return m_pCellEnable[nRow][nCol].isActivated();
+}
+
+// Returns the bounding box of a range of cells
+BOOL CGridCtrl::GetCellRangeRect(const CCellRange& cellRange, LPRECT lpRect)
+{
+    CPoint MinOrigin,MaxOrigin;
+
+    if (!GetCellOrigin(cellRange.GetMinRow(), cellRange.GetMinCol(), &MinOrigin))
+        return FALSE;
+    if (!GetCellOrigin(cellRange.GetMaxRow(), cellRange.GetMaxCol(), &MaxOrigin))
+        return FALSE;
+
+    lpRect->left   = MinOrigin.x;
+    lpRect->top    = MinOrigin.y;
+    lpRect->right  = MaxOrigin.x + GetColumnWidth(cellRange.GetMaxCol()) - 1;
+    lpRect->bottom = MaxOrigin.y + GetRowHeight(cellRange.GetMaxRow()) - 1;
+
+    return TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////////
+// Grid attribute functions
+
+LRESULT CGridCtrl::OnSetFont(WPARAM hFont, LPARAM /*lParam */)
+{
+    LRESULT result = Default();
+
+    // Get the logical font
+    LOGFONT lf;
+    if (!GetObject((HFONT) hFont, sizeof(LOGFONT), &lf))
+        return result;
+
+    m_cellDefault.SetFont(&lf);
+    m_cellFixedColDef.SetFont(&lf);
+    m_cellFixedRowDef.SetFont(&lf);
+    m_cellFixedRowColDef.SetFont(&lf);
+
+    Refresh();
+
+    return result;
+}
+
+LRESULT CGridCtrl::OnGetFont(WPARAM /*wParam*/, LPARAM /*lParam*/)
+{
+    //LOGFONT    lf;
+    //m_cellDefault.GetFontObject()->GetLogFont(&lf);
+
+    return (LRESULT) m_cellDefault.GetFontObject()->GetSafeHandle();
+}
+
+#ifndef _WIN32_WCE_NO_CURSOR
+BOOL CGridCtrl::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
+{
+    if (nHitTest == HTCLIENT)
+    {
+        switch (m_MouseMode)
+        {
+        case MOUSE_OVER_COL_DIVIDE:
+            SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEWE));
+            break;
+        case MOUSE_OVER_ROW_DIVIDE:
+            SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZENS));
+            break;
+#ifndef GRIDCONTROL_NO_DRAGDROP
+        case MOUSE_DRAGGING:
+            break;
+#endif
+        default:
+            if (!GetVirtualMode())
+            {
+                CPoint pt(GetMessagePos());
+                ScreenToClient(&pt);
+                CCellID cell = GetCellFromPt(pt);
+                if (IsValid(cell))
+                {
+                    CGridCellBase* pCell = GetCell(cell.row, cell.col);
+                    if (pCell)
+                        return pCell->OnSetCursor();
+                }
+            }
+
+            SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
+        }
+        return TRUE;
+    }
+
+    return CWnd::OnSetCursor(pWnd, nHitTest, message);
+}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////
+// Row/Column count functions
+
+BOOL CGridCtrl::SetFixedRowCount(int nFixedRows)
+{
+    if (m_nFixedRows == nFixedRows)
+        return TRUE;
+
+//    ASSERT(nFixedRows >= 0);
+
+    ResetSelectedRange();
+
+    // Force recalculation
+    m_idTopLeftCell.col = -1;
+
+    if (nFixedRows > GetRowCount())
+        if (!SetRowCount(nFixedRows))
+            return FALSE;
+        
+        if (m_idCurrentCell.row < nFixedRows)
+            SetFocusCell(-1, - 1);
+        
+        if (!GetVirtualMode())
+        {
+            if (nFixedRows > m_nFixedRows)
+            {
+                for (int i = m_nFixedRows; i < nFixedRows; i++)
+                    for (int j = 0; j < GetColumnCount(); j++)
+                    {
+                        SetItemState(i, j, GetItemState(i, j) | GVIS_FIXED | GVIS_FIXEDROW);
+                        SetItemBkColour(i, j, CLR_DEFAULT );
+                        SetItemFgColour(i, j, CLR_DEFAULT );
+                    }
+            }
+            else
+            {
+                for (int i = nFixedRows; i < m_nFixedRows; i++)
+                {
+                    int j;
+                    for (j = 0; j < GetFixedColumnCount(); j++)
+                        SetItemState(i, j, GetItemState(i, j) & ~GVIS_FIXEDROW );
+
+                    for (j = GetFixedColumnCount(); j < GetColumnCount(); j++)
+                    {
+                        SetItemState(i, j, GetItemState(i, j) & ~(GVIS_FIXED | GVIS_FIXEDROW) );
+                        SetItemBkColour(i, j, CLR_DEFAULT );
+                        SetItemFgColour(i, j, CLR_DEFAULT );
+                    }
+                }
+            }
+        }
+
+        m_nFixedRows = nFixedRows;
+        
+        Refresh();
+        
+        return TRUE;
+}
+
+BOOL CGridCtrl::SetFixedColumnCount(int nFixedCols)
+{
+    if (m_nFixedCols == nFixedCols)
+        return TRUE;
+
+//    ASSERT(nFixedCols >= 0);
+
+    if (nFixedCols > GetColumnCount())
+        if (!SetColumnCount(nFixedCols))
+            return FALSE;
+
+    if (m_idCurrentCell.col < nFixedCols)
+        SetFocusCell(-1, - 1);
+
+    ResetSelectedRange();
+
+    // Force recalculation
+    m_idTopLeftCell.col = -1;
+
+    if (!GetVirtualMode())
+    {
+        if (nFixedCols > m_nFixedCols)
+        {
+            for (int i = 0; i < GetRowCount(); i++)
+                for (int j = m_nFixedCols; j < nFixedCols; j++)
+                {
+                    SetItemState(i, j, GetItemState(i, j) | GVIS_FIXED | GVIS_FIXEDCOL);
+                    SetItemBkColour(i, j, CLR_DEFAULT );
+                    SetItemFgColour(i, j, CLR_DEFAULT );
+                }
+        }
+        else
+        {
+			{ // Scope limit i,j
+	            for (int i = 0; i < GetFixedRowCount(); i++)
+		            for (int j = nFixedCols; j < m_nFixedCols; j++)
+			            SetItemState(i, j, GetItemState(i, j) & ~GVIS_FIXEDCOL );
+			}
+			{// Scope limit i,j
+	            for (int i = GetFixedRowCount(); i < GetRowCount(); i++)
+		            for (int j = nFixedCols; j < m_nFixedCols; j++)
+			        {
+				        SetItemState(i, j, GetItemState(i, j) & ~(GVIS_FIXED | GVIS_FIXEDCOL) );
+					    SetItemBkColour(i, j, CLR_DEFAULT );
+						SetItemFgColour(i, j, CLR_DEFAULT );
+	                }
+			}
+        }
+    }
+        
+    m_nFixedCols = nFixedCols;
+        
+    Refresh();
+        
+    return TRUE;
+}
+
+BOOL CGridCtrl::SetRowCount(int nRows)
+{
+    BOOL bResult = TRUE;
+
+//    ASSERT(nRows >= 0);
+    if (nRows == GetRowCount())
+        return bResult;
+
+	// Force recalculation
+    m_idTopLeftCell.col = -1;
+
+    if (nRows < m_nFixedRows)
+        m_nFixedRows = nRows;
+
+    if (m_idCurrentCell.row >= nRows)
+        SetFocusCell(-1, - 1);
+
+    int addedRows = nRows - GetRowCount();
+
+    // If we are about to lose rows, then we need to delete the GridCell objects
+    // in each column within each row
+    if (addedRows < 0)
+    {
+        if (!GetVirtualMode())
+        {
+            for (int row = nRows; row < m_nRows; row++)
+            {
+                // Delete cells
+                for (int col = 0; col < m_nCols; col++)
+                    DestroyCell(row, col);
+            
+                // Delete rows
+                GRID_ROW* pRow = m_RowData[row];
+                if (pRow)
+                    delete pRow;
+            }
+        }
+        m_nRows = nRows;
+    }
+    
+    TRY
+    {
+        m_arRowHeights.SetSize(nRows);
+
+        if (GetVirtualMode())
+        {
+            m_nRows = nRows;
+            if (addedRows > 0)
+            {
+                int startRow = nRows - addedRows;
+                for (int row = startRow; row < nRows; row++)
+                    m_arRowHeights[row] = m_cellDefault.GetHeight();
+            }
+			ResetVirtualOrder();
+        }
+        else
+        {
+            // Change the number of rows.
+            m_RowData.SetSize(nRows);
+
+            // If we have just added rows, we need to construct new elements for each cell
+            // and set the default row height
+            if (addedRows > 0)
+            {
+                // initialize row heights and data
+                int startRow = nRows - addedRows;
+                for (int row = startRow; row < nRows; row++)
+                {
+                    m_arRowHeights[row] = m_cellDefault.GetHeight();
+
+                    m_RowData[row] = new GRID_ROW;
+                    m_RowData[row]->SetSize(m_nCols);
+                    for (int col = 0; col < m_nCols; col++)
+                    {
+                        GRID_ROW* pRow = m_RowData[row];
+                        if (pRow && !GetVirtualMode())
+                            pRow->SetAt(col, CreateCell(row, col));
+                    }
+                    m_nRows++;
+                }
+            }
+        }
+    }
+    CATCH (CMemoryException, e)
+    {
+        e->ReportError();
+        bResult = FALSE;
+    }
+    END_CATCH
+
+    SetModified();
+    ResetScrollBars();
+    Refresh();
+
+    return bResult;
+}
+
+BOOL CGridCtrl::SetColumnCount(int nCols)
+{
+    BOOL bResult = TRUE;
+
+//    ASSERT(nCols >= 0);
+
+    if (nCols == GetColumnCount())
+        return bResult;
+
+    // Force recalculation
+    m_idTopLeftCell.col = -1;
+
+    if (nCols < m_nFixedCols)
+        m_nFixedCols = nCols;
+
+    if (m_idCurrentCell.col >= nCols)
+        SetFocusCell(-1, - 1);
+
+    int addedCols = nCols - GetColumnCount();
+
+    // If we are about to lose columns, then we need to delete the GridCell objects
+    // within each column
+    if (addedCols < 0 && !GetVirtualMode())
+    {
+        for (int row = 0; row < m_nRows; row++)
+            for (int col = nCols; col < GetColumnCount(); col++)
+                DestroyCell(row, col);
+    }
+
+    TRY 
+    {
+        // Change the number of columns.
+        m_arColWidths.SetSize(nCols);
+    
+        // Change the number of columns in each row.
+        if (!GetVirtualMode())
+            for (int i = 0; i < m_nRows; i++)
+                if (m_RowData[i])
+                    m_RowData[i]->SetSize(nCols);
+        
+        // If we have just added columns, we need to construct new elements for each cell
+        // and set the default column width
+        if (addedCols > 0)
+        {
+            int row, col;
+
+            // initialized column widths
+            int startCol = nCols - addedCols;
+            for (col = startCol; col < nCols; col++)
+                m_arColWidths[col] = m_cellFixedColDef.GetWidth();
+        
+            // initialise column data
+            if (!GetVirtualMode())
+            {
+                for (row = 0; row < m_nRows; row++)
+                    for (col = startCol; col < nCols; col++)
+                    {
+                        GRID_ROW* pRow = m_RowData[row];
+                        if (pRow)
+                            pRow->SetAt(col, CreateCell(row, col));
+                    }
+            }
+        }
+        // else    // check for selected cell ranges
+        //    ResetSelectedRange();
+    }
+    CATCH (CMemoryException, e)
+    {
+        e->ReportError();
+        bResult = FALSE;
+    }
+    END_CATCH
+
+	m_arColOrder.resize(nCols);  // Reset Column Order
+    for (int i = 0; i < nCols; i++)
+	{
+		m_arColOrder[i] = i;	
+	}
+
+    m_nCols = nCols;
+
+    SetModified();
+    ResetScrollBars();
+    Refresh();
+
+    return bResult;
+}
+
+BOOL CGridCtrl::UpdateCellEditableMask()
+{
+	if (m_nRows != m_pCellEnable.size())
+	{
+		m_pCellEnable.resize(m_nRows);
+	}
+
+	for (int i = 0; i<m_nRows; i++)
+	{
+		if (m_nCols != m_pCellEnable[i].size())
+		{
+			m_pCellEnable[i].resize(m_nCols);
+		}
+	}
+
+	return TRUE;
+}
+
+// Insert a column at a given position, or add to end of columns (if nColumn = -1)
+int CGridCtrl::InsertColumn(LPCTSTR strHeading,
+                            UINT nFormat /* = DT_CENTER|DT_VCENTER|DT_SINGLELINE */,
+                            int nColumn  /* = -1 */)
+{
+//	ASSERT(!m_AllowReorderColumn); // function not implemented in case of m_AllowReorderColumn option
+    if (nColumn >= 0 && nColumn < m_nFixedCols)
+    {
+
+        // TODO: Fix it so column insertion works for in the fixed column area
+//        ASSERT(FALSE);
+        return -1;
+    }
+
+    // If the insertion is for a specific column, check it's within range.
+    if (nColumn >= 0 && nColumn > GetColumnCount())
+        return -1;
+
+    // Force recalculation
+    m_idTopLeftCell.col = -1;
+
+    ResetSelectedRange();
+
+    // Gotta be able to at least _see_ some of the column.
+    if (m_nRows < 1)
+        SetRowCount(1);
+
+    // Allow the user to insert after the last of the columns, but process it as a
+    // "-1" column, meaning it gets flaged as being the last column, and not a regular
+    // "insert" routine.
+    if (nColumn == GetColumnCount())
+        nColumn = -1;
+
+    TRY
+    {
+        if (nColumn < 0)
+        {
+            nColumn = m_nCols;
+            m_arColWidths.Add(0);
+            if (!GetVirtualMode())
+            {
+                for (int row = 0; row < m_nRows; row++)
+                {
+                    GRID_ROW* pRow = m_RowData[row];
+                    if (!pRow)
+                        return -1;
+                    pRow->Add(CreateCell(row, nColumn));
+                }
+            }
+        } 
+        else
+        {
+            m_arColWidths.InsertAt(nColumn, (UINT)0);
+            if (!GetVirtualMode())
+            {
+                for (int row = 0; row < m_nRows; row++) 
+                {
+                    GRID_ROW* pRow = m_RowData[row];
+                    if (!pRow)
+                        return -1;
+                    pRow->InsertAt(nColumn, CreateCell(row, nColumn));
+                }
+            }
+        }
+    }
+    CATCH (CMemoryException, e)
+    {
+        e->ReportError();
+        return -1;
+    }
+    END_CATCH
+
+    m_nCols++;
+    
+    // Initialise column data
+    SetItemText(0, nColumn, strHeading);
+    for (int row = 0; row < m_nRows; row++) 
+        SetItemFormat(row, nColumn, nFormat);
+    
+    // initialized column width
+    m_arColWidths[nColumn] = GetTextExtent(0, nColumn, strHeading).cx;
+    
+    if (m_idCurrentCell.col != -1 && nColumn < m_idCurrentCell.col)
+        m_idCurrentCell.col++;
+    
+    ResetScrollBars();
+
+    SetModified();
+    
+    return nColumn;
+}
+
+// Insert a row at a given position, or add to end of rows (if nRow = -1)
+int CGridCtrl::InsertRow(LPCTSTR strHeading, int nRow /* = -1 */)
+{
+    if (nRow >= 0 && nRow < m_nFixedRows)
+    {
+        // TODO: Fix it so column insertion works for in the fixed row area
+//        ASSERT(FALSE);
+        return -1;
+    }
+
+    // If the insertion is for a specific row, check it's within range.
+    if (nRow >= 0 && nRow >= GetRowCount())
+        return -1;
+
+    // Force recalculation
+    m_idTopLeftCell.col = -1;
+
+    ResetSelectedRange();
+
+    // Gotta be able to at least _see_ some of the row.
+    if (m_nCols < 1)
+        SetColumnCount(1);
+
+    TRY
+    {
+        // Adding a row to the bottom
+        if (nRow < 0)
+        {
+            nRow = m_nRows;
+            m_arRowHeights.Add(0);
+            if (!GetVirtualMode())
+                m_RowData.Add(new GRID_ROW);
+			else
+				m_arRowOrder.push_back(m_nRows);
+
+        }
+        else
+        {
+            m_arRowHeights.InsertAt(nRow, (UINT)0);
+            if (!GetVirtualMode())
+                m_RowData.InsertAt(nRow, new GRID_ROW);
+			else
+			{
+				ResetVirtualOrder();
+			}
+        }
+
+        if (!GetVirtualMode())
+            m_RowData[nRow]->SetSize(m_nCols);
+    }
+    CATCH (CMemoryException, e)
+    {
+        e->ReportError();
+        return -1;
+    }
+    END_CATCH
+
+    m_nRows++;
+
+    // Initialise cell data
+    if (!GetVirtualMode())
+    {
+        for (int col = 0; col < m_nCols; col++)
+        {
+            GRID_ROW* pRow = m_RowData[nRow];
+            if (!pRow)
+                return -1;
+            pRow->SetAt(col, CreateCell(nRow, col));
+        }
+    }
+
+    // Set row title
+    SetItemText(nRow, 0, strHeading);
+
+    // initialized row height
+    if (strHeading && strHeading[0])
+        m_arRowHeights[nRow] = GetTextExtent(nRow, 0, strHeading).cy;
+    else
+        m_arRowHeights[nRow] = m_cellFixedRowDef.GetHeight();
+
+    if (m_idCurrentCell.row != -1 && nRow < m_idCurrentCell.row)
+        m_idCurrentCell.row++;
+
+    ResetScrollBars();
+
+    SetModified();
+
+    return nRow;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Cell creation stuff
+
+BOOL CGridCtrl::SetCellType(int nRow, int nCol, CRuntimeClass* pRuntimeClass)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+//    ASSERT(IsValid(nRow, nCol));
+    if (!IsValid(nRow, nCol))
+        return FALSE;
+
+    if (!pRuntimeClass->IsDerivedFrom(RUNTIME_CLASS(CGridCellBase)))
+    {
+//        ASSERT( FALSE);
+        return FALSE;
+    }
+
+    CGridCellBase* pNewCell = (CGridCellBase*) pRuntimeClass->CreateObject();
+
+    CGridCellBase* pCurrCell = GetCell(nRow, nCol);
+    if (pCurrCell)
+        *pNewCell = *pCurrCell;
+
+    SetCell(nRow, nCol, pNewCell);
+    delete pCurrCell;
+
+    return TRUE;
+}
+
+BOOL CGridCtrl::SetDefaultCellType( CRuntimeClass* pRuntimeClass)
+{
+//    ASSERT( pRuntimeClass != NULL );
+    if (!pRuntimeClass->IsDerivedFrom(RUNTIME_CLASS(CGridCellBase)))
+    {
+//        ASSERT( FALSE);
+        return FALSE;
+    }
+    m_pRtcDefault = pRuntimeClass;
+    return TRUE;
+}
+
+// Creates a new grid cell and performs any necessary initialisation
+/*virtual*/ CGridCellBase* CGridCtrl::CreateCell(int nRow, int nCol)
+{
+//    ASSERT(!GetVirtualMode());
+
+    if (!m_pRtcDefault || !m_pRtcDefault->IsDerivedFrom(RUNTIME_CLASS(CGridCellBase)))
+    {
+//        ASSERT( FALSE);
+        return NULL;
+    }
+    CGridCellBase* pCell = (CGridCellBase*) m_pRtcDefault->CreateObject();
+    if (!pCell)
+        return NULL;
+
+    pCell->SetGrid(this);
+    pCell->SetCoords(nRow, nCol); 
+
+    if (nCol < m_nFixedCols)
+        pCell->SetState(pCell->GetState() | GVIS_FIXED | GVIS_FIXEDCOL);
+    if (nRow < m_nFixedRows)
+        pCell->SetState(pCell->GetState() | GVIS_FIXED | GVIS_FIXEDROW);
+    
+    pCell->SetFormat(pCell->GetDefaultCell()->GetFormat());
+
+    return pCell;
+}
+
+// Performs any cell cleanup necessary to maintain grid integrity
+/*virtual*/ void CGridCtrl::DestroyCell(int nRow, int nCol)
+{
+    // Should NEVER get here in virtual mode.
+//    ASSERT(!GetVirtualMode());
+
+    // Set the cells state to 0. If the cell is selected, this
+    // will remove the cell from the selected list.
+    SetItemState(nRow, nCol, 0);
+
+    delete GetCell(nRow, nCol);
+}
+
+BOOL CGridCtrl::DeleteColumn(int nColumn)
+{
+    if (nColumn < 0 || nColumn >= GetColumnCount())
+        return FALSE;
+
+    ResetSelectedRange();
+
+    if (!GetVirtualMode())
+    {
+        for (int row = 0; row < GetRowCount(); row++)
+        {
+            GRID_ROW* pRow = m_RowData[row];
+            if (!pRow)
+                return FALSE;
+
+            DestroyCell(row, nColumn);
+        
+            pRow->RemoveAt(nColumn);
+        }
+    }
+    m_arColWidths.RemoveAt(nColumn);
+    m_nCols--;
+    if (nColumn < m_nFixedCols)
+        m_nFixedCols--;
+    
+    if (nColumn == m_idCurrentCell.col)
+        m_idCurrentCell.row = m_idCurrentCell.col = -1;
+    else if (nColumn < m_idCurrentCell.col)
+        m_idCurrentCell.col--;
+    
+    ResetScrollBars();
+
+    SetModified();
+
+    return TRUE;
+}
+
+
+void CGridCtrl::AddSubVirtualRow(int Num, int Nb)
+{
+//	ASSERT(Nb == -1 || Nb ==1); // only these vlaues are implemented now
+	if(!GetVirtualMode()) return;
+	for(int ind = 0; ind<m_nRows ; ind++)
+		if(m_arRowOrder[ind]>Num) m_arRowOrder[ind]+=Nb;
+	if(Nb>0)
+		m_arRowOrder.insert(m_arRowOrder.begin()+Num,Num);
+	else
+		m_arRowOrder.erase(m_arRowOrder.begin()+Num);
+}
+
+
+BOOL CGridCtrl::DeleteRow(int nRow)
+{
+    if (nRow < 0 || nRow >= GetRowCount())
+        return FALSE;
+
+    ResetSelectedRange();
+
+    if (!GetVirtualMode())
+    {
+        GRID_ROW* pRow = m_RowData[nRow];
+        if (!pRow)
+            return FALSE;
+
+        for (int col = 0; col < GetColumnCount(); col++)
+            DestroyCell(nRow, col);
+
+        delete pRow;
+        m_RowData.RemoveAt(nRow);
+    }
+    else
+    	AddSubVirtualRow(nRow,-1);
+
+    m_arRowHeights.RemoveAt(nRow);
+
+    m_nRows--;
+    if (nRow < m_nFixedRows)
+        m_nFixedRows--;
+    
+    if (nRow == m_idCurrentCell.row)
+        m_idCurrentCell.row = m_idCurrentCell.col = -1;
+    else if (nRow < m_idCurrentCell.row)
+        m_idCurrentCell.row--;
+    
+    ResetScrollBars();
+
+    SetModified();
+    
+    return TRUE;
+}
+
+// Handy function that removes all non-fixed rows
+BOOL CGridCtrl::DeleteNonFixedRows()
+{
+    ResetSelectedRange();
+    int nFixed = GetFixedRowCount();
+    int nCount = GetRowCount();
+    if (GetVirtualMode())
+	{
+		if(nCount != nFixed)
+		{
+			SetRowCount(nFixed);
+			m_arRowOrder.resize(nFixed);
+			m_arRowHeights.SetSize(nFixed);
+			m_idCurrentCell.row = m_idCurrentCell.col = -1;
+			ResetScrollBars();
+			SetModified();
+		}
+	}
+	else
+	{
+    // Delete all data rows
+    for (int nRow = nCount; nRow >= nFixed; nRow--)
+        DeleteRow(nRow);
+	}
+    return TRUE;
+}
+
+// Removes all rows, columns and data from the grid.
+BOOL CGridCtrl::DeleteAllItems()
+{
+    ResetSelectedRange();
+
+    m_arColWidths.RemoveAll();
+    m_arRowHeights.RemoveAll();
+
+    // Delete all cells in the grid
+    if (!GetVirtualMode())
+    {
+        for (int row = 0; row < m_nRows; row++)
+        {
+            for (int col = 0; col < m_nCols; col++)
+                DestroyCell(row, col);
+
+            GRID_ROW* pRow = m_RowData[row];
+            delete pRow;
+        }
+
+        // Remove all rows
+        m_RowData.RemoveAll();
+    }
+	else
+		m_arRowOrder.clear();
+
+
+    m_idCurrentCell.row = m_idCurrentCell.col = -1;
+    m_nRows = m_nFixedRows = m_nCols = m_nFixedCols = 0;
+
+    ResetScrollBars();
+
+    SetModified();
+
+    return TRUE;
+}
+
+void CGridCtrl::AutoFill()
+{
+    if (!::IsWindow(m_hWnd))
+        return;
+
+    CRect rect;
+    GetClientRect(rect);
+
+    SetColumnCount(rect.Width() / m_cellDefault.GetWidth() + 1);
+    SetRowCount(rect.Height() / m_cellDefault.GetHeight() + 1);
+    SetFixedRowCount(1);
+    SetFixedColumnCount(1);
+    ExpandToFit();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl data functions
+
+// Set CListCtrl::GetNextItem for details
+CCellID CGridCtrl::GetNextItem(CCellID& cell, int nFlags) const
+{
+    if ((nFlags & GVNI_ALL) == GVNI_ALL)
+    {    // GVNI_ALL Search whole Grid beginning from cell
+        //          First row (cell.row) -- ONLY Columns to the right of cell
+        //          following rows       -- ALL  Columns
+        int row = cell.row , col = cell.col + 1;
+        if (row <= 0)
+            row = GetFixedRowCount();
+        for (; row < GetRowCount(); row++)
+        {
+            if (col <= 0)
+                col = GetFixedColumnCount();
+            for (; col < GetColumnCount(); col++)
+            {
+                int nState = GetItemState(row, col);
+                if ((nFlags & GVNI_DROPHILITED && nState & GVIS_DROPHILITED) || 
+                    (nFlags & GVNI_FOCUSED     && nState & GVIS_FOCUSED)     ||
+                    (nFlags & GVNI_SELECTED    && nState & GVIS_SELECTED)    ||
+                    (nFlags & GVNI_READONLY    && nState & GVIS_READONLY)    ||
+                    (nFlags & GVNI_FIXED       && nState & GVIS_FIXED)       ||
+                    (nFlags & GVNI_MODIFIED    && nState & GVIS_MODIFIED))
+                    return CCellID(row, col);
+            }
+            // go to First Column
+            col = GetFixedColumnCount();
+        }
+    }
+    else if ((nFlags & GVNI_BELOW) == GVNI_BELOW && 
+             (nFlags & GVNI_TORIGHT) == GVNI_TORIGHT)
+    {   // GVNI_AREA Search Grid beginning from cell to Lower-Right of Grid
+        //           Only rows starting with  cell.row and below
+        //           All rows   -- ONLY Columns to the right of cell
+        int row = cell.row;
+        if (row <= 0)
+            row = GetFixedRowCount();
+        for (; row < GetRowCount(); row++)
+        {
+            int col = cell.col + 1;
+            if (col <= 0)
+                col = GetFixedColumnCount();
+            for (; col < GetColumnCount(); col++) 
+            {
+                int nState = GetItemState(row, col);
+                if ((nFlags & GVNI_DROPHILITED && nState & GVIS_DROPHILITED) || 
+                    (nFlags & GVNI_FOCUSED     && nState & GVIS_FOCUSED)     ||
+                    (nFlags & GVNI_SELECTED    && nState & GVIS_SELECTED)    ||
+                    (nFlags & GVNI_READONLY    && nState & GVIS_READONLY)    ||
+                    (nFlags & GVNI_FIXED       && nState & GVIS_FIXED)       ||
+                    (nFlags & GVNI_MODIFIED    && nState & GVIS_MODIFIED))
+                    return CCellID(row, col);
+            }
+        }
+    }
+    else if ((nFlags & GVNI_ABOVE) == GVNI_ABOVE) 
+    {
+        for (int row = cell.row - 1; row >= GetFixedRowCount(); row--) 
+        {
+            int nState = GetItemState(row, cell.col);
+            if ((nFlags & GVNI_DROPHILITED && nState & GVIS_DROPHILITED) || 
+                (nFlags & GVNI_FOCUSED     && nState & GVIS_FOCUSED)     ||
+                (nFlags & GVNI_SELECTED    && nState & GVIS_SELECTED)    ||
+                (nFlags & GVNI_READONLY    && nState & GVIS_READONLY)    ||
+                (nFlags & GVNI_FIXED       && nState & GVIS_FIXED)       ||
+                (nFlags & GVNI_MODIFIED    && nState & GVIS_MODIFIED))
+                return CCellID(row, cell.col);
+        }
+    }
+    else if ((nFlags & GVNI_BELOW) == GVNI_BELOW)
+    {
+        for (int row = cell.row + 1; row < GetRowCount(); row++) 
+        {
+            int nState = GetItemState(row, cell.col);
+            if ((nFlags & GVNI_DROPHILITED && nState & GVIS_DROPHILITED) || 
+                (nFlags & GVNI_FOCUSED     && nState & GVIS_FOCUSED)     ||
+                (nFlags & GVNI_SELECTED    && nState & GVIS_SELECTED)    ||
+                (nFlags & GVNI_READONLY    && nState & GVIS_READONLY)    ||
+                (nFlags & GVNI_FIXED       && nState & GVIS_FIXED)       ||
+                (nFlags & GVNI_MODIFIED    && nState & GVIS_MODIFIED))
+                return CCellID(row, cell.col);
+        }
+    } 
+    else if ((nFlags & GVNI_TOLEFT) == GVNI_TOLEFT)
+    {
+        for (int col = cell.col - 1; col >= GetFixedColumnCount(); col--) 
+        {
+            int nState = GetItemState(cell.row, col);
+            if ((nFlags & GVNI_DROPHILITED && nState & GVIS_DROPHILITED) || 
+                (nFlags & GVNI_FOCUSED     && nState & GVIS_FOCUSED)     ||
+                (nFlags & GVNI_SELECTED    && nState & GVIS_SELECTED)    ||
+                (nFlags & GVNI_READONLY    && nState & GVIS_READONLY)    ||
+                (nFlags & GVNI_FIXED       && nState & GVIS_FIXED)       ||
+                (nFlags & GVNI_MODIFIED    && nState & GVIS_MODIFIED))
+                return CCellID(cell.row, col);
+        }
+    }
+    else if ((nFlags & GVNI_TORIGHT) == GVNI_TORIGHT)
+    {
+        for (int col = cell.col + 1; col < GetColumnCount(); col++) 
+        {
+            int nState = GetItemState(cell.row, col);
+            if ((nFlags & GVNI_DROPHILITED && nState & GVIS_DROPHILITED) || 
+                (nFlags & GVNI_FOCUSED     && nState & GVIS_FOCUSED)     ||
+                (nFlags & GVNI_SELECTED    && nState & GVIS_SELECTED)    ||
+                (nFlags & GVNI_READONLY    && nState & GVIS_READONLY)    ||
+                (nFlags & GVNI_FIXED       && nState & GVIS_FIXED)       ||
+                (nFlags & GVNI_MODIFIED    && nState & GVIS_MODIFIED))
+                return CCellID(cell.row, col);
+        }
+    }
+    
+    return CCellID(-1, -1);
+}
+
+// Sorts on a given column using the cell text
+BOOL CGridCtrl::SortTextItems(int nCol, BOOL bAscending, LPARAM data /* = 0 */)
+{
+    return CGridCtrl::SortItems(pfnCellTextCompare, nCol, bAscending, data);
+}
+
+void CGridCtrl::SetCompareFunction(PFNLVCOMPARE pfnCompare)
+{
+	m_pfnCompare = pfnCompare;
+}
+
+// Sorts on a given column using the cell text and using the specified comparison
+// function
+BOOL CGridCtrl::SortItems(int nCol, BOOL bAscending, LPARAM data /* = 0 */)
+{
+    SetSortColumn(nCol);
+    SetSortAscending(bAscending);
+    ResetSelectedRange();
+    SetFocusCell(-1, - 1);
+
+	if (m_pfnCompare == NULL)
+		return CGridCtrl::SortItems(pfnCellTextCompare, nCol, bAscending, data);
+	else
+	    return CGridCtrl::SortItems(m_pfnCompare, nCol, bAscending, data);
+}
+
+// Sorts on a given column using the supplied compare function (see CListCtrl::SortItems)
+BOOL CGridCtrl::SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending,
+                          LPARAM data /* = 0 */)
+{
+    SetSortColumn(nCol);
+    SetSortAscending(bAscending);
+    ResetSelectedRange();
+    SetFocusCell(-1, -1);
+    return SortItems(pfnCompare, nCol, bAscending, data, GetFixedRowCount(), -1);
+}
+
+int CALLBACK CGridCtrl::pfnCellTextCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+{
+	UNUSED_ALWAYS(lParamSort);
+
+	CGridCellBase* pCell1 = (CGridCellBase*) lParam1;
+	CGridCellBase* pCell2 = (CGridCellBase*) lParam2;
+	if (!pCell1 || !pCell2) return 0;
+
+	return _tcscmp(pCell1->GetText(), pCell2->GetText());
+}
+
+int CALLBACK CGridCtrl::pfnCellNumericCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+{
+	UNUSED_ALWAYS(lParamSort);
+
+	CGridCellBase* pCell1 = (CGridCellBase*) lParam1;
+	CGridCellBase* pCell2 = (CGridCellBase*) lParam2;
+	if (!pCell1 || !pCell2) return 0;
+
+	int nValue1 = _ttol(pCell1->GetText());
+	int nValue2 = _ttol(pCell2->GetText());
+
+	if (nValue1 < nValue2)
+		return -1;
+	else if (nValue1 == nValue2)
+		return 0;
+	else
+		return 1;
+}
+
+
+CGridCtrl *  CGridCtrl::m_This;
+// private recursive sort implementation
+bool CGridCtrl::NotVirtualCompare(int c1, int c2)
+{
+	return ! CGridCtrl::m_This->m_pfnVirtualCompare(c1, c2);
+}
+BOOL CGridCtrl::SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data,
+                          int low, int high)
+{
+    if (nCol >= GetColumnCount())
+        return FALSE;
+
+    if (high == -1)
+        high = GetRowCount() - 1;
+
+    int lo = low;
+    int hi = high;
+    
+    if (hi <= lo)
+        return FALSE;
+
+    if (GetVirtualMode())
+	{
+//		ASSERT(m_pfnVirtualCompare);
+		m_CurCol = m_arColOrder[nCol];
+		m_This = this;
+		std::stable_sort(m_arRowOrder.begin() + m_nFixedRows, m_arRowOrder.end(), 
+                         bAscending ? m_pfnVirtualCompare : NotVirtualCompare);
+		return TRUE;
+	}
+   
+    
+    //LPARAM midItem = GetItemData((lo + hi)/2, nCol);
+	LPARAM pMidCell = (LPARAM) GetCell((lo + hi)/2, nCol);
+    
+    // loop through the list until indices cross
+    while (lo <= hi)
+    {
+        // Find the first element that is greater than or equal to the partition 
+        // element starting from the left Index.
+        if (bAscending)
+            while (lo < high  && pfnCompare( (LPARAM)GetCell(lo, nCol), (LPARAM) pMidCell, data) < 0)
+                ++lo;
+        else
+            while (lo < high && pfnCompare((LPARAM)GetCell(lo, nCol), pMidCell, data) > 0)
+				++lo;
+                
+		// Find an element that is smaller than or equal to  the partition 
+		// element starting from the right Index.
+		if (bAscending)
+			while (hi > low && pfnCompare((LPARAM)GetCell(hi, nCol), pMidCell, data) > 0)
+				--hi;
+		else
+			while (hi > low && pfnCompare((LPARAM)GetCell(hi, nCol), pMidCell, data) < 0)
+				--hi;
+                        
+        // If the indexes have not crossed, swap if the items are not equal
+        if (lo <= hi)
+        {
+			// swap only if the items are not equal
+            if (pfnCompare((LPARAM)GetCell(lo, nCol), (LPARAM)GetCell(hi, nCol), data) != 0)
+            {
+				for (int col = 0; col < GetColumnCount(); col++)
+                {
+					CGridCellBase *pCell = GetCell(lo, col);
+                    SetCell(lo, col, GetCell(hi, col));
+                    SetCell(hi, col, pCell);
+                }
+                UINT nRowHeight = m_arRowHeights[lo];
+                m_arRowHeights[lo] = m_arRowHeights[hi];
+                m_arRowHeights[hi] = nRowHeight;
+            }
+                            
+            ++lo;
+            --hi;
+         }
+    }
+    
+    // If the right index has not reached the left side of array
+    // must now sort the left partition.
+    if (low < hi)
+        SortItems(pfnCompare, nCol, bAscending, data, low, hi);
+    
+    // If the left index has not reached the right side of array
+    // must now sort the right partition.
+    if (lo < high)
+        SortItems(pfnCompare, nCol, bAscending, data, lo, high);
+    
+    return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl data functions
+
+BOOL CGridCtrl::SetItem(const GV_ITEM* pItem)
+{
+    if (!pItem || GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(pItem->row, pItem->col);
+    if (!pCell)
+        return FALSE;
+
+    SetModified(TRUE, pItem->row, pItem->col);
+
+    if (pItem->mask & GVIF_TEXT)
+        pCell->SetText(pItem->strText);
+    if (pItem->mask & GVIF_PARAM)
+        pCell->SetData(pItem->lParam);
+    if (pItem->mask & GVIF_IMAGE)
+        pCell->SetImage(pItem->iImage);
+    if (pItem->mask & GVIF_STATE)
+        SetItemState(pItem->row, pItem->col, pItem->nState);
+    if (pItem->mask & GVIF_FORMAT)
+        pCell->SetFormat(pItem->nFormat);
+    if (pItem->mask & GVIF_BKCLR)
+        pCell->SetBackClr(pItem->crBkClr);
+    if (pItem->mask & GVIF_FGCLR)
+        pCell->SetTextClr(pItem->crFgClr);
+    if (pItem->mask & GVIF_FONT)
+        pCell->SetFont(&(pItem->lfFont));
+    if( pItem->mask & GVIF_MARGIN)
+        pCell->SetMargin( pItem->nMargin);
+    
+    return TRUE;
+}
+
+BOOL CGridCtrl::GetItem(GV_ITEM* pItem)
+{
+    if (!pItem)
+        return FALSE;
+    CGridCellBase* pCell = GetCell(pItem->row, pItem->col);
+    if (!pCell)
+        return FALSE;
+
+    if (pItem->mask & GVIF_TEXT)
+        pItem->strText = GetItemText(pItem->row, pItem->col);
+    if (pItem->mask & GVIF_PARAM)
+        pItem->lParam  = pCell->GetData();;
+    if (pItem->mask & GVIF_IMAGE)
+        pItem->iImage  = pCell->GetImage();
+    if (pItem->mask & GVIF_STATE)
+        pItem->nState  = pCell->GetState();
+    if (pItem->mask & GVIF_FORMAT)
+        pItem->nFormat = pCell->GetFormat();
+    if (pItem->mask & GVIF_BKCLR)
+        pItem->crBkClr = pCell->GetBackClr();
+    if (pItem->mask & GVIF_FGCLR)
+        pItem->crFgClr = pCell->GetTextClr();
+    if (pItem->mask & GVIF_FONT)
+        memcpy(&(pItem->lfFont), pCell->GetFont(), sizeof(LOGFONT));
+    if( pItem->mask & GVIF_MARGIN)
+        pItem->nMargin = pCell->GetMargin();
+
+    return TRUE;
+}
+
+BOOL CGridCtrl::SetItemText(int nRow, int nCol, LPCTSTR str)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+    if (!pCell)
+        return FALSE;
+
+    pCell->SetText(str);
+
+    SetModified(TRUE, nRow, nCol);
+    return TRUE;
+}
+
+#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 210)
+// EFW - 06/13/99 - Added to support printf-style formatting codes
+BOOL CGridCtrl::SetItemTextFmt(int nRow, int nCol, LPCTSTR szFmt, ...)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CString strText;
+
+    va_list argptr;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+    if (!pCell)
+        return FALSE;
+
+    // Format the message text
+    va_start(argptr, szFmt);
+    strText.FormatV(szFmt, argptr);
+    va_end(argptr);
+
+    pCell->SetText(strText);
+
+    SetModified(TRUE, nRow, nCol);
+    return TRUE;
+}
+
+// EFW - 06/13/99 - Added to support string resource ID.  Supports
+// a variable argument list too.
+BOOL CGridCtrl::SetItemTextFmtID(int nRow, int nCol, UINT nID, ...)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CString strFmt, strText;
+    va_list argptr;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+    if (!pCell)
+        return FALSE;
+
+    // Format the message text
+    va_start(argptr, nID);
+    VERIFY(strFmt.LoadString(nID));
+    strText.FormatV(strFmt, argptr);
+    va_end(argptr);
+
+    pCell->SetText(strText);
+
+    SetModified(TRUE, nRow, nCol);
+    return TRUE;
+}
+#endif
+
+BOOL CGridCtrl::SetItemData(int nRow, int nCol, LPARAM lParam)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+    if (!pCell)
+        return FALSE;
+
+    pCell->SetData(lParam);
+    SetModified(TRUE, nRow, nCol);
+    return TRUE;
+}
+
+LPARAM CGridCtrl::GetItemData(int nRow, int nCol) const
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+    if (!pCell)
+        return (LPARAM) 0;
+
+    return pCell->GetData();
+}
+
+BOOL CGridCtrl::SetItemImage(int nRow, int nCol, int iImage)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+    if (!pCell)
+        return FALSE;
+
+    pCell->SetImage(iImage);
+    SetModified(TRUE, nRow, nCol);
+    return TRUE;
+}
+
+int CGridCtrl::GetItemImage(int nRow, int nCol) const
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return -1;
+
+    return pCell->GetImage();
+}
+
+BOOL CGridCtrl::SetItemState(int nRow, int nCol, UINT state)
+{
+    BOOL bSelected = IsCellSelected(nRow, nCol);
+
+    // If the cell is being unselected, remove it from the selected list
+    if (bSelected && !(state & GVIS_SELECTED))
+    {
+        CCellID cell;
+        DWORD key = MAKELONG(nRow, nCol);
+
+        if (m_SelectedCellMap.Lookup(key, (CCellID&)cell))
+            m_SelectedCellMap.RemoveKey(key);
+    }
+
+    // If cell is being selected, add it to the list of selected cells
+    else if (!bSelected && (state & GVIS_SELECTED))
+    {
+        CCellID cell(nRow, nCol);
+        m_SelectedCellMap.SetAt(MAKELONG(nRow, nCol), cell);
+    }
+
+    if (GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return FALSE;
+
+    // Set the cell's state
+    pCell->SetState(state);
+
+    return TRUE;
+}
+
+UINT CGridCtrl::GetItemState(int nRow, int nCol) const
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return 0;
+
+    return pCell->GetState();
+}
+
+BOOL CGridCtrl::SetItemFormat(int nRow, int nCol, UINT nFormat)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return FALSE;
+
+    pCell->SetFormat(nFormat);
+    return TRUE;
+}
+
+UINT CGridCtrl::GetItemFormat(int nRow, int nCol) const
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return 0;
+
+    return pCell->GetFormat();
+}
+
+BOOL CGridCtrl::SetItemBkColour(int nRow, int nCol, COLORREF cr /* = CLR_DEFAULT */)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return FALSE;
+
+    pCell->SetBackClr(cr);
+    return TRUE;
+}
+
+COLORREF CGridCtrl::GetItemBkColour(int nRow, int nCol) const
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return 0;
+
+    return pCell->GetBackClr();
+}
+
+BOOL CGridCtrl::SetItemFgColour(int nRow, int nCol, COLORREF cr /* = CLR_DEFAULT */)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return FALSE;
+    
+    pCell->SetTextClr(cr);
+    return TRUE;
+}
+
+COLORREF CGridCtrl::GetItemFgColour(int nRow, int nCol) const
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return 0;
+    
+    return pCell->GetTextClr();
+}
+
+BOOL CGridCtrl::SetItemFont(int nRow, int nCol, const LOGFONT* plf)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return FALSE;
+    
+    pCell->SetFont(plf);
+    
+    return TRUE;
+}
+
+const LOGFONT* CGridCtrl::GetItemFont(int nRow, int nCol)
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell) 
+        return GetDefaultCell(nRow < GetFixedRowCount(), nCol < GetFixedColumnCount())->GetFont();
+    
+    return pCell->GetFont();
+}
+
+BOOL CGridCtrl::IsItemEditing(int nRow, int nCol)
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return FALSE;
+
+    return pCell->IsEditing();
+}
+
+////////////////////////////////////////////////////////////////////////////////////
+// Row/Column size functions
+
+long CGridCtrl::GetVirtualWidth() const
+{
+    long lVirtualWidth = 0;
+    int iColCount = GetColumnCount();
+    for (int i = 0; i < iColCount; i++)
+        lVirtualWidth += m_arColWidths[i];
+
+    return lVirtualWidth;
+}
+
+long CGridCtrl::GetVirtualHeight() const
+{
+    long lVirtualHeight = 0;
+    int iRowCount = GetRowCount();
+    for (int i = 0; i < iRowCount; i++)
+        lVirtualHeight += m_arRowHeights[i];
+
+    return lVirtualHeight;
+}
+
+int CGridCtrl::GetRowHeight(int nRow) const
+{
+//    ASSERT(nRow >= 0 && nRow < m_nRows);
+    if (nRow < 0 || nRow >= m_nRows)
+        return -1;
+
+    return m_arRowHeights[nRow];
+}
+
+int CGridCtrl::GetColumnWidth(int nCol) const
+{
+//    ASSERT(nCol >= 0 && nCol < m_nCols);
+    if (nCol < 0 || nCol >= m_nCols)
+        return -1;
+
+    return m_arColWidths[m_arColOrder[nCol]];
+}
+
+BOOL CGridCtrl::SetRowHeight(int nRow, int height)
+{
+//    ASSERT(nRow >= 0 && nRow < m_nRows && height >= 0);
+    if (nRow < 0 || nRow >= m_nRows || height < 0)
+        return FALSE;
+
+    m_arRowHeights[nRow] = height;
+    ResetScrollBars();
+
+    return TRUE;
+}
+
+BOOL CGridCtrl::SetColumnWidth(int nCol, int width)
+{
+//    ASSERT(nCol >= 0 && nCol < m_nCols && width >= 0);
+    if (nCol < 0 || nCol >= m_nCols || width < 0)
+        return FALSE;
+
+    m_arColWidths[m_arColOrder[nCol]] = width;
+    ResetScrollBars();
+
+    return TRUE;
+}
+
+// LUC
+int CGridCtrl::GetFixedRowHeight(BOOL bIncludeFreezedRows /*=FALSE*/) const
+{
+    int nHeight = 0;
+	int i;
+    for (i = 0; i < m_nFixedRows; i++)
+        nHeight += GetRowHeight(i);
+
+	if(bIncludeFreezedRows)
+	{
+		for ( ; i < (m_nFixedRows + m_nFreezedRows); i++)
+        nHeight += GetRowHeight(i);
+	}
+
+    return nHeight;
+}
+
+// LUC
+int CGridCtrl::GetFixedColumnWidth(BOOL bIncludeFreezedCols /*=FALSE*/) const
+{
+    int nWidth = 0;
+	int i;
+    for (i = 0; i < m_nFixedCols; i++)
+		nWidth += GetColumnWidth(i);
+
+	if(bIncludeFreezedCols)
+	{
+		for ( ; i < (m_nFixedCols + m_nFreezedCols); i++)
+        nWidth += GetColumnWidth(i);
+	}
+
+    return nWidth;
+}
+
+BOOL CGridCtrl::AutoSizeColumn(int nCol, UINT nAutoSizeStyle /*=GVS_DEFAULT*/, 
+                               BOOL bResetScroll /*=TRUE*/)
+{
+//    ASSERT(nCol >= 0 && nCol < m_nCols);
+    if (nCol < 0 || nCol >= m_nCols)
+        return FALSE;
+
+    //  Skip hidden columns when autosizing
+    if( GetColumnWidth( nCol) <=0 )
+        return FALSE;
+
+    CSize size;
+    CDC* pDC = GetDC();
+    if (!pDC)
+        return FALSE;
+
+    int nWidth = 0;
+
+//    ASSERT(GVS_DEFAULT <= nAutoSizeStyle && nAutoSizeStyle <= GVS_BOTH);
+    if (nAutoSizeStyle == GVS_DEFAULT)
+        nAutoSizeStyle = GetAutoSizeStyle();
+
+    int nStartRow = (nAutoSizeStyle & GVS_HEADER)? 0 : GetFixedRowCount();
+    int nEndRow   = (nAutoSizeStyle & GVS_DATA)? GetRowCount()-1 : GetFixedRowCount()-1;
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(CCellRange(nStartRow, nCol, nEndRow, nCol));
+
+    for (int nRow = nStartRow; nRow <= nEndRow; nRow++)
+    {
+        CGridCellBase* pCell = GetCell(nRow, nCol);
+        if (pCell)
+            size = pCell->GetCellExtent(pDC);
+        if (size.cx > nWidth)
+            nWidth = size.cx;
+    }
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(CCellRange(-1,-1,-1,-1));
+
+    m_arColWidths[nCol] = nWidth;
+
+    ReleaseDC(pDC);
+    if (bResetScroll)
+        ResetScrollBars();
+
+    return TRUE;
+}
+
+BOOL CGridCtrl::AutoSizeRow(int nRow, BOOL bResetScroll /*=TRUE*/)
+{
+//    ASSERT(nRow >= 0 && nRow < m_nRows);
+    if (nRow < 0 || nRow >= m_nRows)
+        return FALSE;
+
+    //  Skip hidden rows when autosizing
+    if( GetRowHeight( nRow) <=0 )
+        return FALSE;
+
+    CSize size;
+    CDC* pDC = GetDC();
+    if (!pDC)
+        return FALSE;
+
+    int nHeight = 0;
+    int nNumColumns = GetColumnCount();
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(CCellRange(nRow, 0, nRow, nNumColumns));
+
+    for (int nCol = 0; nCol < nNumColumns; nCol++)
+    {
+        CGridCellBase* pCell = GetCell(nRow, nCol);
+        if (pCell)
+            size = pCell->GetCellExtent(pDC);
+        if (size.cy > nHeight)
+            nHeight = size.cy;
+    }
+    m_arRowHeights[nRow] = nHeight;
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(CCellRange(-1,-1,-1,-1));
+
+    ReleaseDC(pDC);
+    if (bResetScroll)
+        ResetScrollBars();
+
+    return TRUE;
+}
+
+void CGridCtrl::AutoSizeColumns(UINT nAutoSizeStyle /*=GVS_DEFAULT*/)
+{
+    int nNumColumns = GetColumnCount();
+    for (int nCol = 0; nCol < nNumColumns; nCol++)
+    {
+        //  Skip hidden columns when autosizing
+        if( GetColumnWidth( nCol) > 0 )
+            AutoSizeColumn(nCol, nAutoSizeStyle, FALSE);
+    }
+    ResetScrollBars();
+}
+
+void CGridCtrl::AutoSizeRows()
+{
+    int nNumRows = GetRowCount();
+    for (int nRow = 0; nRow < nNumRows; nRow++)
+    {
+        //  Skip hidden rows when autosizing
+        if( GetRowHeight( nRow) > 0 )
+            AutoSizeRow(nRow, FALSE);
+    }
+    ResetScrollBars();
+}
+
+// sizes all rows and columns
+// faster than calling both AutoSizeColumns() and AutoSizeRows()
+void CGridCtrl::AutoSize(UINT nAutoSizeStyle /*=GVS_DEFAULT*/)
+{
+    CDC* pDC = GetDC();
+    if (!pDC)
+        return;
+
+    int nNumColumns = GetColumnCount();
+
+    int nCol, nRow;
+
+//    ASSERT(GVS_DEFAULT <= nAutoSizeStyle && nAutoSizeStyle <= GVS_BOTH);
+    if (nAutoSizeStyle == GVS_DEFAULT)
+        nAutoSizeStyle = GetAutoSizeStyle();
+
+    int nStartRow = (nAutoSizeStyle & GVS_HEADER)? 0 : GetFixedRowCount();
+    int nEndRow   = (nAutoSizeStyle & GVS_DATA)? GetRowCount()-1 : GetFixedRowCount()-1;
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(CCellRange(nStartRow, 0, nEndRow, nNumColumns));
+
+    // Row initialisation - only work on rows whose height is > 0
+    for (nRow = nStartRow; nRow <= nEndRow; nRow++)
+    {
+        if( GetRowHeight( nRow) > 0 )
+            m_arRowHeights[nRow] = 1;
+    }
+
+    CSize size;
+    for (nCol = 0; nCol < nNumColumns; nCol++)
+    {
+        //  Don't size hidden columns or rows
+        if( GetColumnWidth( nCol) > 0 )
+        {
+            // Skip columns that are hidden, but now initialize
+            m_arColWidths[nCol] = 0;
+            for (nRow = nStartRow; nRow <= nEndRow; nRow++)
+            {
+                if( GetRowHeight( nRow) > 0 )
+                {
+                    CGridCellBase* pCell = GetCell(nRow, nCol);
+                    if (pCell)
+                        size = pCell->GetCellExtent(pDC);
+                    if (size.cx >(int) m_arColWidths[nCol])
+                        m_arColWidths[nCol] = size.cx;
+                    if (size.cy >(int) m_arRowHeights[nRow])
+                        m_arRowHeights[nRow] = size.cy;
+                }
+            }
+        }
+    }
+
+    if (GetVirtualMode())
+        SendCacheHintToParent(CCellRange(-1,-1,-1,-1));
+
+    ReleaseDC(pDC);
+
+    ResetScrollBars();
+    Refresh();
+}
+
+// Expands the columns to fit the screen space. If bExpandFixed is FALSE then fixed 
+// columns will not be affected
+void CGridCtrl::ExpandColumnsToFit(BOOL bExpandFixed /*=TRUE*/)
+{
+    if (bExpandFixed)
+	{
+		if (GetColumnCount() <= 0) return;
+	} 
+	else
+	{
+		if (GetColumnCount() <= GetFixedColumnCount()) return;
+	}
+
+    EnableScrollBars(SB_HORZ, FALSE);
+
+    int col;
+    CRect rect;
+    GetClientRect(rect);
+
+    int nFirstColumn = (bExpandFixed)? 0 : GetFixedColumnCount();
+
+    int nNumColumnsAffected = 0;
+    for (col = nFirstColumn; col < GetColumnCount(); col++)
+    {
+        if (m_arColWidths[col] > 0)
+            nNumColumnsAffected++;
+    }
+
+    if (nNumColumnsAffected <= 0)
+        return;
+
+    long virtualWidth = GetVirtualWidth();
+    int nDifference = rect.Width() -(int) virtualWidth;
+    int nColumnAdjustment = nDifference / nNumColumnsAffected;
+
+    for (col = nFirstColumn; col < GetColumnCount(); col++)
+    {
+        if (m_arColWidths[col] > 0)
+            m_arColWidths[col] += nColumnAdjustment;    
+    }
+
+    if (nDifference > 0)
+    {
+        int leftOver = nDifference % nNumColumnsAffected;
+        for (int nCount = 0, col = nFirstColumn; 
+             (col < GetColumnCount()) && (nCount < leftOver); col++, nCount++)
+        {
+            if (m_arColWidths[col] > 0)
+                m_arColWidths[col] += 1;
+        }
+    }
+    else 
+    {
+        int leftOver = (-nDifference) % nNumColumnsAffected;
+        for (int nCount = 0, col = nFirstColumn; 
+             (col < GetColumnCount()) && (nCount < leftOver); col++, nCount++)
+        {
+            if (m_arColWidths[col] > 0)
+                m_arColWidths[col] -= 1;
+        }
+    }
+
+    Refresh();
+
+    ResetScrollBars();
+}
+
+void CGridCtrl::ExpandLastColumn()
+{
+    if (GetColumnCount() <= 0)
+        return;
+
+    // Search for last non-hidden column
+    int nLastColumn = GetColumnCount()-1;
+    while (m_arColWidths[nLastColumn] <= 0)
+        nLastColumn--;
+
+    if (nLastColumn <= 0)
+        return;
+
+    EnableScrollBars(SB_HORZ, FALSE);
+
+    CRect rect;
+    GetClientRect(rect);
+
+    long virtualWidth = GetVirtualWidth();
+    int nDifference = rect.Width() -(int) virtualWidth;
+
+    if (nDifference > 0)
+    {
+        //if (GetVirtualHeight() > rect.Height())
+        //    nDifference -= GetSystemMetrics(SM_CXVSCROLL);
+
+        m_arColWidths[ nLastColumn ] += nDifference;
+        Refresh();
+    }
+
+    ResetScrollBars();
+}
+
+// Expands the rows to fit the screen space. If bExpandFixed is FALSE then fixed 
+// rows will not be affected
+void CGridCtrl::ExpandRowsToFit(BOOL bExpandFixed /*=TRUE*/)
+{
+    if (bExpandFixed)
+	{
+		if (GetRowCount() <= 0) return;
+	} 
+	else
+	{
+		if (GetRowCount() <= GetFixedRowCount()) return;
+	}
+
+    EnableScrollBars(SB_VERT, FALSE); 
+
+    int row;
+    CRect rect;
+    GetClientRect(rect);
+    
+    int nFirstRow = (bExpandFixed)? 0 : GetFixedRowCount();
+
+    int nNumRowsAffected = 0;
+    for (row = nFirstRow; row < GetRowCount(); row++)
+    {
+        if (m_arRowHeights[row] > 0)
+            nNumRowsAffected++;
+    }
+
+    if (nNumRowsAffected <= 0)
+        return;
+
+    long virtualHeight = GetVirtualHeight();
+    int nDifference = rect.Height() -(int) virtualHeight;
+    int nRowAdjustment = nDifference / nNumRowsAffected;
+    
+    for (row = nFirstRow; row < GetRowCount(); row++)
+    {
+        if (m_arRowHeights[row] > 0)
+            m_arRowHeights[row] += nRowAdjustment;    
+    }
+    
+    if (nDifference > 0)
+    {
+        int leftOver = nDifference % nNumRowsAffected;
+        for (int nCount = 0, row = nFirstRow; 
+             (row < GetRowCount()) && (nCount < leftOver); row++, nCount++)
+        {
+            if (m_arRowHeights[row] > 0)
+                m_arRowHeights[row] += 1;
+        }
+    } 
+    else 
+    {
+        int leftOver = (-nDifference) % nNumRowsAffected;
+        for (int nCount = 0, row = nFirstRow; 
+             (row < GetRowCount()) && (nCount < leftOver); row++, nCount++)
+        {
+            if (m_arRowHeights[row] > 0)
+                m_arRowHeights[row] -= 1;
+        }
+    }
+
+    Refresh();
+
+    ResetScrollBars();
+}
+
+// Expands the cells to fit the screen space. If bExpandFixed is FALSE then fixed 
+// cells  will not be affected
+void CGridCtrl::ExpandToFit(BOOL bExpandFixed /*=TRUE*/)
+{
+    ExpandColumnsToFit(bExpandFixed);   // This will remove any existing horz scrollbar
+    ExpandRowsToFit(bExpandFixed);      // This will remove any existing vert scrollbar
+    ExpandColumnsToFit(bExpandFixed);   // Just in case the first adjustment was with a vert
+                                        // scrollbar in place
+    Refresh();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+// Attributes
+
+void CGridCtrl::SetVirtualMode(BOOL bVirtual)
+{
+    DeleteAllItems();
+    m_bVirtualMode = bVirtual;
+
+    // Force some defaults here.
+    if (m_bVirtualMode)
+    {
+        SetEditable(FALSE);
+        SetAutoSizeStyle(GVS_HEADER);
+        SetFixedColumnSelection(FALSE);
+        SetFixedRowSelection(FALSE);
+		ResetVirtualOrder();
+    }
+}
+
+void CGridCtrl::SetGridLines(int nWhichLines /*=GVL_BOTH*/) 
+{
+    m_nGridLines = nWhichLines;
+    Refresh();
+}
+
+void CGridCtrl::SetListMode(BOOL bEnableListMode /*=TRUE*/)
+{
+    ResetSelectedRange();
+    SetSortColumn(-1);
+    m_bListMode = bEnableListMode;
+    SetFixedRowSelection(FALSE);
+    Refresh();
+}
+
+void CGridCtrl::SetSortColumn(int nCol)
+{
+    if (m_nSortColumn >= 0)
+        InvalidateCellRect(0, m_nSortColumn);
+    m_nSortColumn = nCol;
+    if (nCol >= 0)
+        InvalidateCellRect(0, nCol);
+}
+
+BOOL CGridCtrl::IsCellFixed(int nRow, int nCol)
+{
+    return (nRow < GetFixedRowCount() || nCol < GetFixedColumnCount());
+}
+
+void CGridCtrl::SetModified(BOOL bModified /*=TRUE*/, int nRow /*=-1*/, int nCol /*=-1*/)
+{
+    // Cannot guarantee sorting anymore...
+    if (nCol < 0 || nCol == GetSortColumn())
+        SetSortColumn(-1);
+
+    if (nRow >= 0 && nCol >= 0)
+    {
+        if (bModified)
+        {
+            SetItemState(nRow, nCol, GetItemState(nRow, nCol) | GVIS_MODIFIED);
+            m_bModified = TRUE;
+        }
+        else
+            SetItemState(nRow, nCol, GetItemState(nRow, nCol) & ~GVIS_MODIFIED);
+    }
+    else
+        m_bModified = bModified;
+
+    if (!m_bModified)
+    {
+        for (int row = 0; row < GetRowCount(); row++)
+            for (int col = 0; col < GetColumnCount(); col++)
+                SetItemState(row, col, GetItemState(row, col) & ~GVIS_MODIFIED);
+    }
+}
+
+BOOL CGridCtrl::GetModified(int nRow /*=-1*/, int nCol /*=-1*/)
+{
+    if (nRow >= 0 && nCol >= 0)
+        return ( (GetItemState(nRow, nCol) & GVIS_MODIFIED) == GVIS_MODIFIED );
+    else
+        return m_bModified;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+// GridCtrl cell visibility tests and invalidation/redraw functions
+
+void CGridCtrl::Refresh()
+{
+    if (GetSafeHwnd() && m_bAllowDraw)
+        Invalidate();
+}
+
+// EnsureVisible supplied by Roelf Werkman
+void CGridCtrl::EnsureVisible(int nRow, int nCol)
+{
+    if (!m_bAllowDraw)
+        return;
+
+    CRect rectWindow;
+    /*
+    // set the scroll to the approximate position of row (Nigel Page-Jones)
+    int nPos = (int)((float)nRow / GetRowCount() * 1000);
+    float fPos = (float)nPos / 1000;
+    SCROLLINFO scrollInfo;
+    GetScrollInfo(SB_VERT, &scrollInfo);
+    scrollInfo.nPos = (int)(scrollInfo.nMax * fPos);
+    SetScrollInfo(SB_VERT, &scrollInfo, FALSE);
+    
+    GetClientRect(rectWindow);
+
+    // redraw cells    if necessary (Nigel Page-Jones)
+    CCellID idTopLeft = GetTopleftNonFixedCell(FALSE);
+    CCellID idNewTopLeft = GetTopleftNonFixedCell(TRUE);
+    if (idNewTopLeft != idTopLeft)
+    {
+        rectWindow.top = GetFixedRowHeight();
+        InvalidateRect(rectWindow);
+    }
+    */
+
+    // We are going to send some scroll messages, which will steal the focus 
+    // from it's rightful owner. Squirrel it away ourselves so we can give
+    // it back. (Damir)
+    CWnd* pFocusWnd = GetFocus();
+
+    CCellRange VisibleCells = GetVisibleNonFixedCellRange();
+
+    int right = nCol - VisibleCells.GetMaxCol();
+    int left  = VisibleCells.GetMinCol() - nCol;
+    int down  = nRow - VisibleCells.GetMaxRow();
+    int up    = VisibleCells.GetMinRow() - nRow;
+
+    int iColumnStart;
+    int iRowStart;
+
+    iColumnStart = VisibleCells.GetMaxCol() + 1;
+    while( right > 0 )
+    {
+        if( GetColumnWidth( iColumnStart ) > 0 )
+            SendMessage( WM_HSCROLL, SB_LINERIGHT, 0 );
+
+        right--;
+        iColumnStart++;
+    }
+
+    iColumnStart = VisibleCells.GetMinCol() - 1;
+    while( left > 0 )
+    {
+        if( GetColumnWidth( iColumnStart ) > 0 )
+            SendMessage( WM_HSCROLL, SB_LINELEFT, 0 );
+        left--;
+        iColumnStart--;
+    }
+
+    iRowStart = VisibleCells.GetMaxRow() + 1;
+    while( down > 0 )
+    {
+        if( GetRowHeight( iRowStart ) > 0 )
+            SendMessage( WM_VSCROLL, SB_LINEDOWN, 0 );
+        down--;
+        iRowStart++;
+    }
+
+    iRowStart = VisibleCells.GetMinRow() - 1;
+    while( up > 0 )
+    {
+        if( GetRowHeight( iRowStart ) > 0 )
+            SendMessage( WM_VSCROLL, SB_LINEUP, 0 );
+        up--;
+        iRowStart--;
+    }
+
+    // Move one more if we only see a snall bit of the cell
+    CRect rectCell;
+    if (!GetCellRect(nRow, nCol, rectCell))
+    {
+		if (pFocusWnd && ::IsWindow(pFocusWnd->GetSafeHwnd()))
+			pFocusWnd->SetFocus(); 
+        return;
+    }
+
+    GetClientRect(rectWindow);
+
+	// LUC
+    // The previous fix was fixed properly by Martin Richter 
+    while (rectCell.right > rectWindow.right
+        && rectCell.left > GetFixedColumnWidth(m_bExcludeFreezedColsFromSelection)
+        && IsVisibleHScroll() // Junlin Xu: added to prevent infinite loop
+        )
+    {
+        SendMessage(WM_HSCROLL, SB_LINERIGHT, 0);
+        if (!GetCellRect(nRow, nCol, rectCell))
+        {
+            pFocusWnd->SetFocus(); 
+            return;
+        }
+    }
+
+	// LUC
+    while (rectCell.bottom > rectWindow.bottom
+        && rectCell.top > GetFixedRowHeight(m_bExcludeFreezedRowsFromSelection)
+        && IsVisibleVScroll() // Junlin Xu: added to prevent infinite loop
+        )
+    {
+        SendMessage(WM_VSCROLL, SB_LINEDOWN, 0);
+        if (!GetCellRect(nRow, nCol, rectCell))
+        {
+            pFocusWnd->SetFocus(); 
+            return;
+        }
+    }
+
+    // restore focus to whoever owned it
+    pFocusWnd->SetFocus(); 
+}
+
+BOOL CGridCtrl::IsCellEditable(CCellID &cell) const
+{
+    return IsCellEditable(cell.row, cell.col);
+}
+
+BOOL CGridCtrl::IsCellEditable(int nRow, int nCol) const
+{
+    return IsEditable() && ((GetItemState(nRow, nCol) & GVIS_READONLY) != GVIS_READONLY);
+}
+
+BOOL CGridCtrl::IsCellSelected(CCellID &cell) const
+{
+    return IsCellSelected(cell.row, cell.col);
+}
+
+BOOL CGridCtrl::IsCellSelected(int nRow, int nCol) const
+{
+    if (GetVirtualMode())
+    {   
+        if (!IsSelectable())
+            return FALSE;
+
+        CCellID cell;
+        DWORD key = MAKELONG(nRow, nCol);
+
+        return (m_SelectedCellMap.Lookup(key, (CCellID&)cell));       
+    }
+    else
+        return IsSelectable() && ((GetItemState(nRow, nCol) & GVIS_SELECTED) == GVIS_SELECTED);
+}
+
+BOOL CGridCtrl::IsCellVisible(CCellID cell) 
+{
+    return IsCellVisible(cell.row, cell.col);
+}
+
+BOOL CGridCtrl::IsCellVisible(int nRow, int nCol)
+{
+    if (!IsWindow(m_hWnd))
+        return FALSE;
+
+    int x, y;
+
+	// LUC
+    CCellID TopLeft;
+    if (nCol >= GetFixedColumnCount(TRUE) || nRow >= GetFixedRowCount(TRUE))
+    {
+        TopLeft = GetTopleftNonFixedCell();
+        if (nCol >= GetFixedColumnCount(TRUE) && nCol < TopLeft.col)
+            return FALSE;
+        if (nRow >= GetFixedRowCount(TRUE) && nRow < TopLeft.row)
+            return FALSE;
+    }
+    
+    CRect rect;
+    GetClientRect(rect);
+    if (nCol < GetFixedColumnCount(TRUE))
+    {
+        x = 0;
+        for (int i = 0; i <= nCol; i++) 
+        {
+            if (x >= rect.right)
+                return FALSE;
+            x += GetColumnWidth(i);    
+        }
+    } 
+    else 
+    {
+        x = GetFixedColumnWidth(TRUE);
+        for (int i = TopLeft.col; i <= nCol; i++) 
+        {
+			if (x >= rect.right)
+				return FALSE;
+            x += GetColumnWidth(i);    
+        }
+    }
+    
+    if (nRow < GetFixedRowCount(TRUE))
+    {
+        y = 0;
+        for (int i = 0; i <= nRow; i++) 
+        {
+            if (y >= rect.bottom)
+                return FALSE;
+            y += GetRowHeight(i);    
+        }
+    } 
+    else 
+    {
+        if (nRow < TopLeft.row)
+            return FALSE;
+        y = GetFixedRowHeight(TRUE);
+        for (int i = TopLeft.row; i <= nRow; i++) 
+        {
+            if (y >= rect.bottom)
+                return FALSE;
+            y += GetRowHeight(i);    
+        }
+    }
+    
+    return TRUE;
+}
+
+BOOL CGridCtrl::InvalidateCellRect(const CCellID& cell)
+{
+    return InvalidateCellRect(cell.row, cell.col);
+}
+
+BOOL CGridCtrl::InvalidateCellRect(const int row, const int col)
+{
+    if (!::IsWindow(GetSafeHwnd()) || !m_bAllowDraw)
+        return FALSE;
+
+    if (!IsValid(row, col))
+        return FALSE;
+
+    if (!IsCellVisible(row, col))
+        return FALSE;
+
+    CRect rect;
+    if (!GetCellRect(row, col, rect))
+        return FALSE;
+
+	// LUC
+	int nRow = row;
+	int nCol = col;
+	GetTopLeftMergedCell(nRow, nCol, rect);
+
+    rect.right++;
+    rect.bottom++;
+    InvalidateRect(rect, TRUE);
+
+    return TRUE;
+}
+
+BOOL CGridCtrl::InvalidateCellRect(const CCellRange& cellRange)
+{
+//    ASSERT(IsValid(cellRange));
+    if (!::IsWindow(GetSafeHwnd()) || !m_bAllowDraw)
+        return FALSE;
+
+    CCellRange visibleCellRange = GetVisibleNonFixedCellRange().Intersect(cellRange);
+
+    CRect rect;
+    if (!GetCellRangeRect(visibleCellRange, rect))
+        return FALSE;
+
+    rect.right++;
+    rect.bottom++;
+    InvalidateRect(rect, TRUE);
+
+    return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl Mouse stuff
+
+// Handles mouse wheel notifications
+// Note - if this doesn't work for win95 then use OnRegisteredMouseWheel instead
+#if !defined(_WIN32_WCE) && (_MFC_VER >= 0x0421)
+BOOL CGridCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+{
+    // A m_nRowsPerWheelNotch value less than 0 indicates that the mouse
+    // wheel scrolls whole pages, not just lines.
+    if (m_nRowsPerWheelNotch == -1)
+    {
+        int nPagesScrolled = zDelta / 120;
+
+        if (nPagesScrolled > 0)
+		{
+            for (int i = 0; i < nPagesScrolled; i++)
+			{
+                PostMessage(WM_VSCROLL, SB_PAGEUP, 0);
+			}
+		}
+        else
+		{
+            for (int i = 0; i > nPagesScrolled; i--)
+			{
+                PostMessage(WM_VSCROLL, SB_PAGEDOWN, 0);
+			}
+		}
+    }
+    else
+    {
+        int nRowsScrolled = m_nRowsPerWheelNotch * zDelta / 120;
+
+        if (nRowsScrolled > 0)
+		{
+            for (int i = 0; i < nRowsScrolled; i++)
+			{
+                PostMessage(WM_VSCROLL, SB_LINEUP, 0);
+			}
+		}
+        else
+		{
+            for (int i = 0; i > nRowsScrolled; i--)
+			{
+                PostMessage(WM_VSCROLL, SB_LINEDOWN, 0);
+			}
+		}
+    }
+
+    return CWnd::OnMouseWheel(nFlags, zDelta, pt);
+}
+#endif // !defined(_WIN32_WCE) && (_MFC_VER >= 0x0421)
+
+void CGridCtrl::OnMouseMove(UINT /*nFlags*/, CPoint point)
+{
+    CRect rect;
+    GetClientRect(rect);
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    // If outside client area, return (unless we are drag n dropping)
+    if (m_MouseMode != MOUSE_DRAGGING && !rect.PtInRect(point))
+        return;
+#endif
+
+    // Sometimes a MOUSEMOVE message can come after the left buttons
+    // has been let go, but before the BUTTONUP message hs been processed.
+    // We'll keep track of mouse buttons manually to avoid this.
+    // All bMouseButtonDown's have been replaced with the member m_bLMouseButtonDown
+    // BOOL bMouseButtonDown = ((nFlags & MK_LBUTTON) == MK_LBUTTON);
+
+    // If the left mouse button is up, then test to see if row/column sizing is imminent
+    if (!m_bLMouseButtonDown ||
+        (m_bLMouseButtonDown && m_MouseMode == MOUSE_NOTHING))
+    {
+        if (m_bAllowColumnResize && MouseOverColumnResizeArea(point))
+        {
+            if (m_MouseMode != MOUSE_OVER_COL_DIVIDE)
+            {
+#ifndef _WIN32_WCE_NO_CURSOR
+                SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEWE));
+#endif
+                m_MouseMode = MOUSE_OVER_COL_DIVIDE;
+            }
+        }
+        else if (m_bAllowRowResize && MouseOverRowResizeArea(point))
+        {
+            if (m_MouseMode != MOUSE_OVER_ROW_DIVIDE)
+            {
+#ifndef _WIN32_WCE_NO_CURSOR
+                SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZENS));
+#endif
+                m_MouseMode = MOUSE_OVER_ROW_DIVIDE;
+            }
+        }
+        else if (m_MouseMode != MOUSE_NOTHING)
+        {
+#ifndef _WIN32_WCE_NO_CURSOR
+            SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
+#endif
+            m_MouseMode = MOUSE_NOTHING;
+        }
+
+        if (m_MouseMode == MOUSE_NOTHING)
+        {
+            CGridCellBase* pCell = NULL;
+            CCellID idCurrentCell;
+            if (!GetVirtualMode() || m_bTitleTips)
+            {
+                // Let the cell know that a big fat cursor is currently hovering
+                // over it.
+                idCurrentCell = GetCellFromPt(point);
+                pCell = GetCell(idCurrentCell.row, idCurrentCell.col);
+                if (pCell)
+                    pCell->OnMouseOver();
+            }
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+            // Titletips anyone? anyone?
+            if (m_bTitleTips)
+            {
+                CRect TextRect, CellRect;
+                if (pCell)
+                {
+                    LPCTSTR szTipText = pCell->GetTipText();
+                    if (!m_bRMouseButtonDown
+						&& szTipText && szTipText[0]
+                        && !pCell->IsEditing()
+                        && GetCellRect( idCurrentCell.row, idCurrentCell.col, &TextRect)
+                        && pCell->GetTipTextRect( &TextRect)
+                        && GetCellRect(idCurrentCell.row, idCurrentCell.col, CellRect) )
+                    {
+						// LUC
+						int row = idCurrentCell.row;
+						int col = idCurrentCell.col;
+						GetTopLeftMergedCell(row, col, CellRect);
+//						TRACE0("Showing TitleTip\n");
+						m_TitleTip.Show(TextRect, pCell->GetTipText(),  0, CellRect,
+                                        pCell->GetFont(),  GetTitleTipTextClr(), GetTitleTipBackClr());
+                    }
+                }
+            }
+#endif
+        }
+
+        m_LastMousePoint = point;
+        return;
+    }
+
+    if (!IsValid(m_LeftClickDownCell))
+    {
+        m_LastMousePoint = point;
+        return;
+    }
+
+    // If the left mouse button is down, then process appropriately
+    if (m_bLMouseButtonDown)
+    {
+        switch (m_MouseMode)
+        {
+        case MOUSE_SELECT_ALL:
+            break;
+
+        case MOUSE_SELECT_COL:
+        case MOUSE_SELECT_ROW:
+        case MOUSE_SELECT_CELLS:
+            {
+                CCellID idCurrentCell = GetCellFromPt(point);
+                if (!IsValid(idCurrentCell))
+                    return;
+
+                if (idCurrentCell != GetFocusCell())
+                {
+                    OnSelecting(idCurrentCell);
+
+                    // EFW - BUG FIX - Keep the appropriate cell row and/or
+                    // column focused.  A fix in SetFocusCell() will place
+                    // the cursor in a non-fixed cell as needed.
+					// LUC
+                    if((idCurrentCell.row >= GetFixedRowCount(m_bExcludeFreezedRowsFromSelection) &&
+                      idCurrentCell.col >= GetFixedColumnCount(m_bExcludeFreezedColsFromSelection)) ||
+                      m_MouseMode==MOUSE_SELECT_COL ||
+                      m_MouseMode==MOUSE_SELECT_ROW)
+                    {
+                        SetFocusCell(idCurrentCell);
+                    }
+                }
+                break;
+            }
+
+        case MOUSE_SIZING_COL:
+            {
+                CDC* pDC = GetDC();
+                if (!pDC)
+                    break;
+
+                CRect oldInvertedRect(m_LastMousePoint.x, rect.top,
+                    m_LastMousePoint.x + 2, rect.bottom);
+                pDC->InvertRect(&oldInvertedRect);
+                CRect newInvertedRect(point.x, rect.top, 
+                    point.x + 2, rect.bottom);
+                pDC->InvertRect(&newInvertedRect);
+                ReleaseDC(pDC);
+            }
+            break;
+            
+        case MOUSE_SIZING_ROW:        
+            {
+                CDC* pDC = GetDC();
+                if (!pDC)
+                    break;
+                
+                CRect oldInvertedRect(rect.left, m_LastMousePoint.y,
+                    rect.right, m_LastMousePoint.y + 2);
+                pDC->InvertRect(&oldInvertedRect);
+                CRect newInvertedRect(rect.left, point.y, 
+                    rect.right, point.y + 2);
+                pDC->InvertRect(&newInvertedRect);
+                ReleaseDC(pDC);
+            }
+            break;
+            
+#ifndef GRIDCONTROL_NO_DRAGDROP
+        case MOUSE_PREPARE_EDIT:
+        case MOUSE_PREPARE_DRAG:
+            m_MouseMode = MOUSE_PREPARE_DRAG;
+            OnBeginDrag();    
+            break;
+#endif
+        }    
+    }
+
+    m_LastMousePoint = point;
+}
+
+// Returns the point inside the cell that was clicked (coords relative to cell top left)
+CPoint CGridCtrl::GetPointClicked(int nRow, int nCol, const CPoint& point)
+{
+    CPoint PointCellOrigin;
+    if( !GetCellOrigin( nRow, nCol, &PointCellOrigin)  )
+        return CPoint( 0, 0);
+
+    CPoint PointClickedCellRelative( point);
+    PointClickedCellRelative -= PointCellOrigin;
+    return PointClickedCellRelative;
+}
+
+void CGridCtrl::OnLButtonDblClk(UINT nFlags, CPoint point)
+{
+    TRACE0("CGridCtrl::OnLButtonDblClk\n");
+
+	// LUC
+	CCellID cellOriginal;
+    CCellID cell = GetCellFromPt(point, TRUE, cellOriginal);
+    if( !IsValid( cell) )
+    {
+        //ASSERT(FALSE);
+        return;
+    }
+
+#ifdef _WIN32_WCE
+    if (MouseOverColumnResizeArea(point))
+#else
+    if (m_MouseMode == MOUSE_OVER_COL_DIVIDE)
+#endif
+    {
+        CPoint start;
+        if (!GetCellOrigin(0, cell.col, &start))
+            return;
+
+        if (point.x - start.x < m_nResizeCaptureRange)     // Clicked right of border
+            cell.col--;
+
+        //  ignore columns that are hidden and look left towards first visible column
+        BOOL bFoundVisible = FALSE;
+        while( cell.col >= 0)
+        {
+            if( GetColumnWidth( cell.col) > 0)
+            {
+                bFoundVisible = TRUE;
+                break;
+            }
+            cell.col--;
+        }
+        if( !bFoundVisible)
+            return;
+
+        AutoSizeColumn(cell.col, GetAutoSizeStyle());
+        Invalidate();
+    }
+#ifdef _WIN32_WCE
+    else if (MouseOverRowResizeArea(point))
+#else
+    else if (m_MouseMode == MOUSE_OVER_ROW_DIVIDE)
+#endif
+    {
+        CPoint start;
+        if (!GetCellOrigin(0, cell.col, &start))
+            return;
+
+        if (point.y - start.y < m_nResizeCaptureRange)     // Clicked below border
+            cell.row--;
+
+        //  ignore rows that are hidden and look up towards first visible row
+        BOOL bFoundVisible = FALSE;
+        while( cell.row >= 0)
+        {
+            if( GetRowHeight( cell.row) > 0)
+            {
+                bFoundVisible = TRUE;
+                break;
+            }
+            cell.row--;
+        }
+        if( !bFoundVisible)
+            return;
+
+        AutoSizeRow(cell.row);
+        Invalidate();
+    }
+    else if (m_MouseMode == MOUSE_NOTHING)
+    {
+        CPoint pointClickedRel;
+        pointClickedRel = GetPointClicked( cell.row, cell.col, point);
+
+        CGridCellBase* pCell = NULL;
+        if (IsValid(cell))
+            pCell = GetCell(cell.row, cell.col);
+
+        // Clicked in the text area? Only then will cell selection work
+        BOOL bInTextArea = FALSE;
+        if (pCell)
+        {
+			// LUC
+            CRect rectCell;
+            if (GetCellRect(cellOriginal.row, cellOriginal.col, rectCell) && pCell->GetTextRect(rectCell))
+                bInTextArea = rectCell.PtInRect(point);
+        }
+
+        if (cell.row >= m_nFixedRows && IsValid(m_LeftClickDownCell) && 
+            cell.col >= m_nFixedCols && bInTextArea)
+        {
+            OnEditCell(cell.row, cell.col, pointClickedRel, VK_LBUTTON);
+        }
+        else if (m_bListMode)
+        {
+            if (!IsValid(cell))
+                return;
+            if (cell.row >= m_nFixedRows && cell.col >= m_nFixedCols && bInTextArea)
+                OnEditCell(cell.row, cell.col, pointClickedRel, VK_LBUTTON);
+        }
+
+        if (IsValid(cell))
+        {
+            CGridCellBase* pCell = GetCell(cell.row, cell.col);
+            if (pCell)
+                pCell->OnDblClick(pointClickedRel);
+            SendMessageToParent(cell.row, cell.col, NM_DBLCLK);
+        }
+    }
+
+    CWnd::OnLButtonDblClk(nFlags, point);
+}
+
+void CGridCtrl::OnLButtonDown(UINT nFlags, CPoint point)
+{
+#ifdef GRIDCONTROL_USE_TITLETIPS
+    // EFW - Bug Fix
+    m_TitleTip.Hide();  // hide any titletips
+#endif
+
+    // TRACE0("CGridCtrl::OnLButtonDown\n");
+    // CWnd::OnLButtonDown(nFlags, point);
+
+    SetFocus();
+	m_CurCol = -1;
+    m_bLMouseButtonDown   = TRUE;
+    m_LeftClickDownPoint = point;
+	// LUC
+	CCellID cellOriginal;
+    m_LeftClickDownCell  = GetCellFromPt(point, TRUE, cellOriginal);
+    if (!IsValid(m_LeftClickDownCell))
+        return;
+	m_CurRow = m_LeftClickDownCell.row;
+
+    // If the SHIFT key is not down, then the start of the selection area should be the 
+    // cell just clicked. Otherwise, keep the previous selection-start-cell so the user
+    // can add to their previous cell selections in an intuitive way. If no selection-
+    // start-cell has been specified, then set it's value here and now.
+    if ((nFlags & MK_SHIFT) != MK_SHIFT)
+        m_SelectionStartCell = m_LeftClickDownCell;
+    else
+    {
+        if (!IsValid(m_SelectionStartCell))
+            m_SelectionStartCell = m_idCurrentCell;
+    }
+
+    EndEditing();
+
+    // tell the cell about it 
+    CGridCellBase* pCell = GetCell(m_LeftClickDownCell.row, m_LeftClickDownCell.col);
+    if (pCell)
+        pCell->OnClickDown(GetPointClicked( m_LeftClickDownCell.row, m_LeftClickDownCell.col, point));
+
+    // Clicked in the text area? Only then will cell selection work
+    BOOL bInTextArea = FALSE;
+    if (pCell)
+    {
+        CRect rectCell;
+		// LUC
+        //if (GetCellRect(m_LeftClickDownCell.row, m_LeftClickDownCell.col, rectCell) &&
+        //    pCell->GetTextRect(rectCell))
+		if (GetCellRect(cellOriginal.row, cellOriginal.col, rectCell) &&
+            pCell->GetTextRect(rectCell))        
+        {
+            bInTextArea = rectCell.PtInRect(point);
+        }
+    }
+
+    // If the user clicks on the current cell, then prepare to edit it.
+    // (If the user moves the mouse, then dragging occurs)
+    if (m_LeftClickDownCell == m_idCurrentCell && 
+        !(nFlags & MK_CONTROL) && bInTextArea &&
+        IsCellEditable(m_LeftClickDownCell))
+    {
+        m_MouseMode = MOUSE_PREPARE_EDIT;
+        return;
+    }
+    // If the user clicks on a selected cell, then prepare to drag it.
+    // (If the user moves the mouse, then dragging occurs)
+    else if (IsCellSelected(m_LeftClickDownCell))
+    {
+        SetFocusCell(m_LeftClickDownCell.row, m_LeftClickDownCell.col);
+
+        // If control is pressed then unselect the cell or row (depending on the list mode)
+        if (nFlags & MK_CONTROL)
+        {
+            SetFocusCell(m_LeftClickDownCell);
+            if (GetListMode())
+                SelectRows(m_LeftClickDownCell, TRUE, FALSE);
+            else
+                SelectCells(m_LeftClickDownCell, TRUE, FALSE);
+            return;
+        }
+#ifndef GRIDCONTROL_NO_DRAGDROP
+        else if (m_bAllowDragAndDrop)
+            m_MouseMode = MOUSE_PREPARE_DRAG;
+#endif
+    }
+    else if (m_MouseMode != MOUSE_OVER_COL_DIVIDE &&
+             m_MouseMode != MOUSE_OVER_ROW_DIVIDE)        
+    {
+		if (m_LeftClickDownCell.row >= GetFixedRowCount() && 
+			m_LeftClickDownCell.col >= GetFixedColumnCount())
+		{
+            SetFocusCell(m_LeftClickDownCell.row, m_LeftClickDownCell.col);
+		}
+		else
+			SetFocusCell(-1, -1);
+
+		//Don't set focus on any cell if the user clicked on a fixed cell - David Pritchard
+        //if (GetRowCount() > GetFixedRowCount() && 
+        //    GetColumnCount() > GetFixedColumnCount())
+        //    SetFocusCell(max(m_LeftClickDownCell.row, m_nFixedRows),
+        //                 max(m_LeftClickDownCell.col, m_nFixedCols));
+    }
+    
+    SetCapture();
+    
+    if (m_MouseMode == MOUSE_NOTHING)
+    {
+        if (m_bAllowColumnResize && MouseOverColumnResizeArea(point))
+        {
+            if (m_MouseMode != MOUSE_OVER_COL_DIVIDE)
+            {
+#ifndef _WIN32_WCE_NO_CURSOR
+                SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEWE));
+#endif
+                m_MouseMode = MOUSE_OVER_COL_DIVIDE;
+            }
+        }
+        else if (m_bAllowRowResize && MouseOverRowResizeArea(point))
+        {
+            if (m_MouseMode != MOUSE_OVER_ROW_DIVIDE)
+            {
+#ifndef _WIN32_WCE_NO_CURSOR
+                SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZENS));
+#endif
+                m_MouseMode = MOUSE_OVER_ROW_DIVIDE;
+            }
+        }
+        // else if (m_MouseMode != MOUSE_NOTHING)
+        //{
+        //    SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
+        //    m_MouseMode = MOUSE_NOTHING;
+        //}
+    }
+    
+    if (m_MouseMode == MOUSE_OVER_COL_DIVIDE) // sizing column
+    {
+        m_MouseMode = MOUSE_SIZING_COL;
+
+        // Kludge for if we are over the last column...
+        if (GetColumnWidth(GetColumnCount()-1) < m_nResizeCaptureRange)
+        {
+            CRect VisRect;
+            GetVisibleNonFixedCellRange(VisRect);
+            if (abs(point.x - VisRect.right) < m_nResizeCaptureRange)
+                m_LeftClickDownCell.col = GetColumnCount()-1;
+        }
+
+        CPoint start;
+        if (!GetCellOrigin(0, m_LeftClickDownCell.col, &start))
+            return;
+
+        if( !m_bHiddenColUnhide)
+        {
+            //  ignore columns that are hidden and look left towards first visible column
+            BOOL bLookForVisible = TRUE;
+            BOOL bIsCellRightBorder = point.x - start.x >= m_nResizeCaptureRange;
+
+            if( bIsCellRightBorder
+                && m_LeftClickDownCell.col + 1 >= GetColumnCount() )
+            {
+                // clicked on last column's right border
+
+                // if last column is visible, don't do anything
+                if( m_LeftClickDownCell.col >= 0)
+                    bLookForVisible = FALSE;
+            }
+
+            if( bLookForVisible)
+            {
+                // clicked on column divider other than last right border
+                BOOL bFoundVisible = FALSE;
+                int iOffset = 1;
+
+                if( bIsCellRightBorder)
+                    iOffset = 0;
+
+                while( m_LeftClickDownCell.col - iOffset >= 0)
+                {
+                    if( GetColumnWidth( m_LeftClickDownCell.col - iOffset) > 0)
+                    {
+                        bFoundVisible = TRUE;
+                        break;
+                    }
+                    m_LeftClickDownCell.col--;
+                }
+                if( !bFoundVisible)
+                    return;
+            }
+        }
+
+
+        CRect rect;
+        GetClientRect(rect);
+        CRect invertedRect(point.x, rect.top, point.x + 2, rect.bottom);
+
+        CDC* pDC = GetDC();
+        if (pDC)
+        {
+            pDC->InvertRect(&invertedRect);
+            ReleaseDC(pDC);
+        }
+
+        // If we clicked to the right of the colimn divide, then reset the click-down cell
+        // as the cell to the left of the column divide - UNLESS we clicked on the last column
+        // and the last column is teensy (kludge fix)
+        if (point.x - start.x < m_nResizeCaptureRange)
+        {
+            if (m_LeftClickDownCell.col < GetColumnCount()-1 || 
+                GetColumnWidth(GetColumnCount()-1) >= m_nResizeCaptureRange)
+            {
+                if (!GetCellOrigin(0, --m_LeftClickDownCell.col, &start))
+                    return;
+            }
+        }
+
+		// Allow a cell resize width no greater than that which can be viewed within
+		// the grid itself
+		int nMaxCellWidth = rect.Width()-GetFixedColumnWidth();
+        rect.left  = start.x + 1;
+		rect.right = rect.left + nMaxCellWidth;
+
+        ClientToScreen(rect);
+#ifndef _WIN32_WCE_NO_CURSOR
+        ClipCursor(rect);
+#endif
+    }
+    else if (m_MouseMode == MOUSE_OVER_ROW_DIVIDE) // sizing row
+    {
+        m_MouseMode = MOUSE_SIZING_ROW;
+
+        // Kludge for if we are over the last column...
+        if (GetRowHeight(GetRowCount()-1) < m_nResizeCaptureRange)
+        {
+            CRect VisRect;
+            GetVisibleNonFixedCellRange(VisRect);
+            if (abs(point.y - VisRect.bottom) < m_nResizeCaptureRange)
+                m_LeftClickDownCell.row = GetRowCount()-1;
+        }
+
+        CPoint start;
+        if (!GetCellOrigin(m_LeftClickDownCell, &start))
+            return;
+
+        if( !m_bHiddenRowUnhide)
+        {
+            //  ignore rows that are hidden and look up towards first visible row
+            BOOL bLookForVisible = TRUE;
+            BOOL bIsCellBottomBorder = point.y - start.y >= m_nResizeCaptureRange;
+
+            if( bIsCellBottomBorder
+                && m_LeftClickDownCell.row + 1 >= GetRowCount() )
+            {
+                // clicked on last row's bottom border
+
+                // if last row is visible, don't do anything
+                if( m_LeftClickDownCell.row >= 0)
+                    bLookForVisible = FALSE;
+            }
+
+            if( bLookForVisible)
+            {
+                // clicked on row divider other than last bottom border
+                BOOL bFoundVisible = FALSE;
+                int iOffset = 1;
+
+                if( bIsCellBottomBorder)
+                    iOffset = 0;
+
+                while( m_LeftClickDownCell.row - iOffset >= 0)
+                {
+                    if( GetRowHeight( m_LeftClickDownCell.row - iOffset) > 0)
+                    {
+                        bFoundVisible = TRUE;
+                        break;
+                    }
+                    m_LeftClickDownCell.row--;
+                }
+                if( !bFoundVisible)
+                    return;
+            }
+        }
+
+        CRect rect;
+        GetClientRect(rect);
+        CRect invertedRect(rect.left, point.y, rect.right, point.y + 2);
+
+        CDC* pDC = GetDC();
+        if (pDC)
+        {
+            pDC->InvertRect(&invertedRect);
+            ReleaseDC(pDC);
+        }
+
+        // If we clicked below the row divide, then reset the click-down cell
+        // as the cell above the row divide - UNLESS we clicked on the last row
+        // and the last row is teensy (kludge fix)
+        if (point.y - start.y < m_nResizeCaptureRange)            // clicked below border
+        {
+            if (m_LeftClickDownCell.row < GetRowCount()-1 || 
+                GetRowHeight(GetRowCount()-1) >= m_nResizeCaptureRange)
+            {
+                if (!GetCellOrigin(--m_LeftClickDownCell.row, 0, &start))
+                    return;
+            }
+        }
+
+		int nMaxCellHeight = rect.Height()-GetFixedRowHeight();
+        rect.top = start.y + 1;
+		rect.bottom = rect.top + nMaxCellHeight;
+
+        ClientToScreen(rect);
+
+#ifndef _WIN32_WCE_NO_CURSOR
+        ClipCursor(rect);
+#endif
+    }
+    else
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    if (m_MouseMode != MOUSE_PREPARE_DRAG) // not sizing or editing -- selecting
+#endif
+    {
+	    SendMessageToParent(m_LeftClickDownCell.row, m_LeftClickDownCell.col, GVN_SELCHANGING);
+
+        // If Ctrl pressed, save the current cell selection. This will get added
+        // to the new cell selection at the end of the cell selection process
+        m_PrevSelectedCellMap.RemoveAll();
+        if (nFlags & MK_CONTROL)
+        {
+            for (POSITION pos = m_SelectedCellMap.GetStartPosition(); pos != NULL; )
+            {
+                DWORD key;
+                CCellID cell;
+                m_SelectedCellMap.GetNextAssoc(pos, key, (CCellID&)cell);
+                m_PrevSelectedCellMap.SetAt(key, cell);
+            }
+        }
+        
+        if (m_LeftClickDownCell.row < GetFixedRowCount())
+		{
+            OnFixedRowClick(m_LeftClickDownCell);
+            if(m_AllowReorderColumn && m_LeftClickDownCell.col >=  GetFixedColumnCount())
+			{
+				ResetSelectedRange(); // TODO : This is not the better solution, as we do not see why clicking in column header should reset selection
+											//but the state of selection is instable after drag (at least until someone debugs it), so better clear it allways.
+				m_MouseMode = MOUSE_PREPARE_DRAG;
+				m_CurCol = m_LeftClickDownCell.col;
+			}
+		}
+        else if (m_LeftClickDownCell.col < GetFixedColumnCount())
+            OnFixedColumnClick(m_LeftClickDownCell);
+        else
+        {
+            m_MouseMode = m_bListMode? MOUSE_SELECT_ROW : MOUSE_SELECT_CELLS;
+            OnSelecting(m_LeftClickDownCell);
+
+            m_nTimerID = SetTimer(WM_LBUTTONDOWN, m_nTimerInterval, 0);
+        }
+    }   
+    m_LastMousePoint = point;
+}
+
+void CGridCtrl::OnLButtonUp(UINT nFlags, CPoint point)
+{
+    // TRACE0("CGridCtrl::OnLButtonUp\n");
+
+    CWnd::OnLButtonUp(nFlags, point);
+
+    m_bLMouseButtonDown = FALSE;
+
+#ifndef _WIN32_WCE_NO_CURSOR
+    ClipCursor(NULL);
+#endif
+
+    if (GetCapture()->GetSafeHwnd() == GetSafeHwnd())
+    {
+        ReleaseCapture();
+        KillTimer(m_nTimerID);
+        m_nTimerID = 0;
+
+		// LUC
+		m_bExcludeFreezedRowsFromSelection = FALSE;
+		m_bExcludeFreezedColsFromSelection = FALSE;
+    }
+
+    CPoint pointClickedRel;
+    pointClickedRel = GetPointClicked( m_idCurrentCell.row, m_idCurrentCell.col, point);
+
+    // m_MouseMode == MOUSE_PREPARE_EDIT only if user clicked down on current cell
+    // and then didn't move mouse before clicking up (releasing button)
+    if (m_MouseMode == MOUSE_PREPARE_EDIT)
+    {
+        OnEditCell(m_idCurrentCell.row, m_idCurrentCell.col, pointClickedRel, VK_LBUTTON);
+    }
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    // m_MouseMode == MOUSE_PREPARE_DRAG only if user clicked down on a selected cell
+    // and then didn't move mouse before clicking up (releasing button)
+    else if (m_MouseMode == MOUSE_PREPARE_DRAG) 
+    {
+        CGridCellBase* pCell = GetCell(m_idCurrentCell.row, m_idCurrentCell.col);
+        if (pCell)
+            pCell->OnClick( GetPointClicked( m_idCurrentCell.row, m_idCurrentCell.col, point) );
+        SendMessageToParent(m_LeftClickDownCell.row, m_LeftClickDownCell.col, NM_CLICK);
+	    SendMessageToParent(m_LeftClickDownCell.row, m_LeftClickDownCell.col, GVN_SELCHANGING);
+        ResetSelectedRange();
+	    SendMessageToParent(m_idCurrentCell.row, m_idCurrentCell.col, GVN_SELCHANGED);
+    }
+#endif
+    else if (m_MouseMode == MOUSE_SIZING_COL)
+    {
+        CRect rect;
+        GetClientRect(rect);
+        CRect invertedRect(m_LastMousePoint.x, rect.top, m_LastMousePoint.x + 2, rect.bottom);
+        
+        CDC* pDC = GetDC();
+        if (pDC)
+        {
+            pDC->InvertRect(&invertedRect);
+            ReleaseDC(pDC);
+        }
+        
+        if (m_LeftClickDownPoint != point && (point.x != 0 || point.y != 0)) // 0 pt fix by email1@bierling.net
+        {   
+            CPoint start;
+            if (!GetCellOrigin(m_LeftClickDownCell, &start))
+                return;
+
+            int nColumnWidth = __max(point.x - start.x, m_bAllowColHide? 0 : 1);
+
+            SetColumnWidth(m_LeftClickDownCell.col, nColumnWidth);
+            ResetScrollBars();
+            Invalidate();
+        }
+    }
+    else if (m_MouseMode == MOUSE_SIZING_ROW)
+    {
+        CRect rect;
+        GetClientRect(rect);
+        CRect invertedRect(rect.left, m_LastMousePoint.y, rect.right, m_LastMousePoint.y + 2);
+
+        CDC* pDC = GetDC();
+        if (pDC)
+        {
+            pDC->InvertRect(&invertedRect);
+            ReleaseDC(pDC);
+        }
+        
+        if (m_LeftClickDownPoint != point  && (point.x != 0 || point.y != 0)) // 0 pt fix by email1@bierling.net
+        {
+            CPoint start;
+            if (!GetCellOrigin(m_LeftClickDownCell, &start))
+                return;
+            
+            int nRowHeight = __max(point.y - start.y, m_bAllowRowHide? 0 : 1);
+
+            SetRowHeight(m_LeftClickDownCell.row, nRowHeight);
+            ResetScrollBars();
+            Invalidate();
+        }
+    }
+    else
+    {
+	    SendMessageToParent(m_idCurrentCell.row, m_idCurrentCell.col, GVN_SELCHANGED);
+
+        CGridCellBase* pCell = GetCell(m_idCurrentCell.row, m_idCurrentCell.col);
+        if (pCell)
+            pCell->OnClick( GetPointClicked( m_idCurrentCell.row, m_idCurrentCell.col, point) );
+        SendMessageToParent(m_LeftClickDownCell.row, m_LeftClickDownCell.col, NM_CLICK);
+    }
+    
+    m_MouseMode = MOUSE_NOTHING;
+    
+#ifndef _WIN32_WCE_NO_CURSOR
+    SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
+#endif
+    
+    if (!IsValid(m_LeftClickDownCell))
+        return;
+    
+    CWnd *pOwner = GetOwner();
+    if (pOwner && IsWindow(pOwner->m_hWnd))
+        pOwner->PostMessage(WM_COMMAND, MAKELONG(GetDlgCtrlID(), BN_CLICKED),
+        (LPARAM) GetSafeHwnd());
+}
+
+#ifndef _WIN32_WCE
+void CGridCtrl::OnRButtonDown(UINT nFlags, CPoint point)
+{
+    CWnd::OnRButtonDown(nFlags, point);
+	m_bRMouseButtonDown = TRUE;
+
+#ifdef GRIDCONTROL_USE_TITLETIPS
+	TRACE0("Hiding TitleTip\n");
+    m_TitleTip.Hide();  // hide any titletips
+#endif
+}
+
+// EFW - Added to forward right click to parent so that a context
+// menu can be shown without deriving a new grid class.
+void CGridCtrl::OnRButtonUp(UINT nFlags, CPoint point)
+{
+    CWnd::OnRButtonUp(nFlags, point);
+
+	m_bRMouseButtonDown = FALSE;
+
+    CCellID FocusCell;
+    FocusCell = GetCellFromPt(point);
+
+    EndEditing();        // Auto-destroy any InPlaceEdit's
+
+    // If not a valid cell, pass -1 for row and column
+    if(!IsValid(FocusCell))
+        SendMessageToParent(-1, -1, NM_RCLICK);
+    else
+    {
+        SetFocusCell(-1,-1);
+        SetFocusCell(__max(FocusCell.row, m_nFixedRows),
+            __max(FocusCell.col, m_nFixedCols));
+
+        // tell the cell about it
+        CGridCellBase* pCell = GetCell(FocusCell.row, FocusCell.col);
+        if (pCell)
+            pCell->OnRClick( GetPointClicked( FocusCell.row, FocusCell.col, point) );
+
+        SendMessageToParent(FocusCell.row, FocusCell.col, NM_RCLICK);		
+    }
+}
+#endif
+
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl printing
+
+// EFW - New print margin support functions
+void CGridCtrl::SetPrintMarginInfo(int nHeaderHeight, int nFooterHeight,
+    int nLeftMargin, int nRightMargin, int nTopMargin,
+    int nBottomMargin, int nGap)
+{
+    // If any parameter is -1, keep the existing setting
+    if(nHeaderHeight > -1)
+        m_nHeaderHeight = nHeaderHeight;
+    if(nFooterHeight > -1)
+        m_nFooterHeight = nFooterHeight;
+    if(nLeftMargin > -1)
+        m_nLeftMargin = nLeftMargin;
+    if(nRightMargin > -1)
+        m_nRightMargin = nRightMargin;
+    if(nTopMargin > -1)
+        m_nTopMargin = nTopMargin;
+    if(nBottomMargin > -1)
+        m_nBottomMargin = nBottomMargin;
+    if(nGap > -1)
+        m_nGap = nGap;
+}
+
+void CGridCtrl::GetPrintMarginInfo(int &nHeaderHeight, int &nFooterHeight,
+    int &nLeftMargin, int &nRightMargin, int &nTopMargin,
+    int &nBottomMargin, int &nGap)
+{
+    nHeaderHeight = m_nHeaderHeight;
+    nFooterHeight = m_nFooterHeight;
+    nLeftMargin = m_nLeftMargin;
+    nRightMargin = m_nRightMargin;
+    nTopMargin = m_nTopMargin;
+    nBottomMargin = m_nBottomMargin;
+    nGap = m_nGap;
+}
+
+void CGridCtrl::Print(CPrintDialog* pPrntDialog /*=NULL*/)
+{
+    CDC dc;
+
+    if (pPrntDialog == NULL)
+    {
+        CPrintDialog printDlg(FALSE);
+        if (printDlg.DoModal() != IDOK)             // Get printer settings from user
+            return;
+
+        dc.Attach(printDlg.GetPrinterDC());         // attach a printer DC
+    }
+    else
+        dc.Attach(pPrntDialog->GetPrinterDC());     // attach a printer DC
+        
+    dc.m_bPrinting = TRUE;
+
+    CString strTitle;
+    strTitle.LoadString(AFX_IDS_APP_TITLE);
+
+    if( strTitle.IsEmpty() )
+    {
+        CWnd *pParentWnd = GetParent();
+        while (pParentWnd)
+        {
+            pParentWnd->GetWindowText(strTitle);
+            if (strTitle.GetLength())  // can happen if it is a CView, CChildFrm has the title
+                break;
+            pParentWnd = pParentWnd->GetParent();
+        }
+    }
+
+    DOCINFO di;                                 // Initialise print doc details
+    memset(&di, 0, sizeof (DOCINFO));
+    di.cbSize = sizeof (DOCINFO);
+    di.lpszDocName = strTitle;
+
+    BOOL bPrintingOK = dc.StartDoc(&di);        // Begin a new print job
+
+    CPrintInfo Info;
+    Info.m_rectDraw.SetRect(0,0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
+
+    OnBeginPrinting(&dc, &Info);                // Initialise printing
+    for (UINT page = Info.GetMinPage(); page <= Info.GetMaxPage() && bPrintingOK; page++)
+    {
+        dc.StartPage();                         // begin new page
+        Info.m_nCurPage = page;
+        OnPrint(&dc, &Info);                    // Print page
+        bPrintingOK = (dc.EndPage() > 0);       // end page
+    }
+    OnEndPrinting(&dc, &Info);                  // Clean up after printing
+
+    if (bPrintingOK)
+        dc.EndDoc();                            // end a print job
+    else
+        dc.AbortDoc();                          // abort job.
+
+    dc.Detach();                                // detach the printer DC
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl printing overridables - for Doc/View print/print preview framework
+
+// EFW - Various changes in the next few functions to support the
+// new print margins and a few other adjustments.
+void CGridCtrl::OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo)
+{
+    // OnBeginPrinting() is called after the user has committed to
+    // printing by OK'ing the Print dialog, and after the framework
+    // has created a CDC object for the printer or the preview view.
+
+    // This is the right opportunity to set up the page range.
+    // Given the CDC object, we can determine how many rows will
+    // fit on a page, so we can in turn determine how many printed
+    // pages represent the entire document.
+
+//    ASSERT(pDC && pInfo);
+    if (!pDC || !pInfo) return;
+
+    // Get a DC for the current window (will be a screen DC for print previewing)
+    CDC *pCurrentDC = GetDC();        // will have dimensions of the client area
+    if (!pCurrentDC) return;
+
+    CSize PaperPixelsPerInch(pDC->GetDeviceCaps(LOGPIXELSX), pDC->GetDeviceCaps(LOGPIXELSY));
+    CSize ScreenPixelsPerInch(pCurrentDC->GetDeviceCaps(LOGPIXELSX), pCurrentDC->GetDeviceCaps(LOGPIXELSY));
+
+    // Create the printer font
+    int nFontSize = -10;
+    CString strFontName = _T("Arial");
+    m_PrinterFont.CreateFont(nFontSize, 0,0,0, FW_NORMAL, 0,0,0, DEFAULT_CHARSET,
+                             OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY,
+                             DEFAULT_PITCH | FF_DONTCARE, strFontName);
+
+    CFont *pOldFont = pDC->SelectObject(&m_PrinterFont);
+
+    // Get the average character width (in GridCtrl units) and hence the margins
+    m_CharSize = pDC->GetTextExtent(_T("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSATUVWXYZ"),52);
+    m_CharSize.cx /= 52;
+    int nMargins = (m_nLeftMargin+m_nRightMargin)*m_CharSize.cx;
+
+    // Get the page sizes (physical and logical)
+    m_PaperSize = CSize(pDC->GetDeviceCaps(HORZRES), pDC->GetDeviceCaps(VERTRES));
+
+    if( m_bWysiwygPrinting)
+    {
+        m_LogicalPageSize.cx = ScreenPixelsPerInch.cx * m_PaperSize.cx / PaperPixelsPerInch.cx * 3 / 4;
+        m_LogicalPageSize.cy = ScreenPixelsPerInch.cy * m_PaperSize.cy / PaperPixelsPerInch.cy * 3 / 4;
+    }
+    else
+    {
+        m_PaperSize = CSize(pDC->GetDeviceCaps(HORZRES), pDC->GetDeviceCaps(VERTRES));
+
+        m_LogicalPageSize.cx = GetVirtualWidth()+nMargins;
+#ifdef _WIN32_WCE
+        m_LogicalPageSize.cy = (m_LogicalPageSize.cx * m_PaperSize.cy) / m_PaperSize.cx;
+#else
+        m_LogicalPageSize.cy = MulDiv(m_LogicalPageSize.cx, m_PaperSize.cy, m_PaperSize.cx);
+#endif
+    }
+
+    m_nPageHeight = m_LogicalPageSize.cy - GetFixedRowHeight()
+                       - (m_nHeaderHeight+m_nFooterHeight + 2*m_nGap)*m_CharSize.cy;
+
+    // Get the number of pages. Assumes no row is bigger than the page size.
+    int nTotalRowHeight = 0;
+    m_nNumPages = 1;
+    for (int row = GetFixedRowCount(); row < GetRowCount(); row++)
+    {
+        nTotalRowHeight += GetRowHeight(row);
+        if (nTotalRowHeight > m_nPageHeight) {
+            m_nNumPages++;
+            nTotalRowHeight = GetRowHeight(row);
+        }
+    }
+
+    // now, figure out how many additional pages must print out if rows ARE bigger
+    //  than page size
+    int iColumnOffset = 0;
+    int i1;
+    for( i1=0; i1 < GetFixedColumnCount(); i1++)
+    {
+        iColumnOffset += GetColumnWidth( i1);
+    }
+    m_nPageWidth = m_LogicalPageSize.cx - iColumnOffset
+                    - nMargins;
+    m_nPageMultiplier = 1;
+
+    if( m_bWysiwygPrinting)
+    {
+        int iTotalRowWidth = 0;
+        for( i1 = GetFixedColumnCount(); i1 < GetColumnCount(); i1++)
+        {
+            iTotalRowWidth += GetColumnWidth( i1);
+            if( iTotalRowWidth > m_nPageWidth)
+            {
+                m_nPageMultiplier++;
+                iTotalRowWidth = GetColumnWidth( i1);
+            }
+        }
+        m_nNumPages *= m_nPageMultiplier;
+    }
+
+    // Set up the print info
+    pInfo->SetMaxPage(m_nNumPages);
+    pInfo->m_nCurPage = 1;                        // start printing at page# 1
+
+    ReleaseDC(pCurrentDC);
+    pDC->SelectObject(pOldFont);
+}
+
+void CGridCtrl::OnPrint(CDC *pDC, CPrintInfo *pInfo)
+{
+    if (!pDC || !pInfo)
+        return;
+
+    //CRect rcPage(pInfo->m_rectDraw);
+    CFont *pOldFont = pDC->SelectObject(&m_PrinterFont);
+
+    // Set the page map mode to use GridCtrl units, and setup margin
+    pDC->SetMapMode(MM_ANISOTROPIC);
+    pDC->SetWindowExt(m_LogicalPageSize);
+    pDC->SetViewportExt(m_PaperSize);
+    pDC->SetWindowOrg(-m_nLeftMargin * m_CharSize.cx, 0);
+
+    // Header
+    pInfo->m_rectDraw.top    = 0;
+    pInfo->m_rectDraw.left   = 0;
+    pInfo->m_rectDraw.right  = m_LogicalPageSize.cx - (m_nLeftMargin + m_nRightMargin) * m_CharSize.cx;
+    pInfo->m_rectDraw.bottom = m_nHeaderHeight * m_CharSize.cy;
+    PrintHeader(pDC, pInfo);
+    pDC->OffsetWindowOrg(0, -m_nHeaderHeight * m_CharSize.cy);
+
+    // Gap between header and column headings
+    pDC->OffsetWindowOrg(0, -m_nGap * m_CharSize.cy);
+
+    pDC->OffsetWindowOrg(0, -GetFixedRowHeight());
+
+    // We need to find out which row to start printing for this page.
+    int nTotalRowHeight = 0;
+    UINT nNumPages = 1;
+    m_nCurrPrintRow = GetFixedRowCount();
+
+
+    // Not only the row, but we need to figure out column, too
+
+    // Can print 4 pages, where page 1 and 2 represent the same rows but
+    // with different WIDE columns.
+    //
+    // .......
+    // .1 .2 .  If representing page 3  -->    iPageIfIgnoredWideCols = 2
+    // .......                                 iWideColPageOffset = 0
+    // .3 .4 .  If representing page 2  -->    iPageIfIgnoredWideCols = 1
+    // .......                                 iWideColPageOffset = 1
+
+    int iPageIfIgnoredWideCols = pInfo->m_nCurPage / m_nPageMultiplier;
+    int iWideColPageOffset = pInfo->m_nCurPage - ( iPageIfIgnoredWideCols * m_nPageMultiplier);
+    if( iWideColPageOffset > 0)
+        iPageIfIgnoredWideCols++;
+
+    if( iWideColPageOffset == 0)
+        iWideColPageOffset = m_nPageMultiplier;
+    iWideColPageOffset--;
+
+    // calculate current print row based on iPageIfIgnoredWideCols
+    while(  m_nCurrPrintRow < GetRowCount()
+            && (int)nNumPages < iPageIfIgnoredWideCols)
+    {
+        nTotalRowHeight += GetRowHeight(m_nCurrPrintRow);
+        if (nTotalRowHeight > m_nPageHeight) {
+            nNumPages++;
+            if ((int)nNumPages == iPageIfIgnoredWideCols) break;
+            nTotalRowHeight = GetRowHeight(m_nCurrPrintRow);
+        }
+        m_nCurrPrintRow++;
+    }
+
+    m_nPrintColumn = GetFixedColumnCount();
+    int iTotalRowWidth = 0;
+    int i1, i2;
+
+    // now, calculate which print column to start displaying
+    for( i1 = 0; i1 < iWideColPageOffset; i1++)
+    {
+        for( i2 = m_nPrintColumn; i2 < GetColumnCount(); i2++)
+        {
+            iTotalRowWidth += GetColumnWidth( i2);
+            if( iTotalRowWidth > m_nPageWidth)
+            {
+                m_nPrintColumn = i2;
+                iTotalRowWidth = 0;
+                break;
+            }
+        }
+    }
+
+
+    PrintRowButtons( pDC, pInfo);   // print row buttons on each page
+    int iColumnOffset = 0;
+    for( i1=0; i1 < GetFixedColumnCount(); i1++)
+    {
+        iColumnOffset += GetColumnWidth( i1);
+    }
+
+    // Print the column headings
+    pInfo->m_rectDraw.bottom = GetFixedRowHeight();
+
+    if( m_nPrintColumn == GetFixedColumnCount())
+    {
+        // have the column headings fcn draw the upper left fixed cells
+        //  for the very first columns, only
+        pDC->OffsetWindowOrg( 0, +GetFixedRowHeight());
+
+        m_nPageWidth += iColumnOffset;
+        m_nPrintColumn = 0;
+        PrintColumnHeadings(pDC, pInfo);
+        m_nPageWidth -= iColumnOffset;
+        m_nPrintColumn = GetFixedColumnCount();
+
+        pDC->OffsetWindowOrg( -iColumnOffset, -GetFixedRowHeight());
+    }
+    else
+    {
+        // changed all of this here to match above almost exactly same
+        pDC->OffsetWindowOrg( 0, +GetFixedRowHeight());
+
+        m_nPageWidth += iColumnOffset;
+
+        // print from column 0 ... last column that fits on the current page
+        PrintColumnHeadings(pDC, pInfo);
+        
+        m_nPageWidth -= iColumnOffset;
+ 
+        pDC->OffsetWindowOrg( -iColumnOffset, -GetFixedRowHeight());
+    }
+
+
+    if (m_nCurrPrintRow >= GetRowCount()) return;
+
+    // Draw as many rows as will fit on the printed page.
+    // Clip the printed page so that there is no partially shown
+    // row at the bottom of the page (the same row which will be fully
+    // shown at the top of the next page).
+
+    BOOL bFirstPrintedRow = TRUE;
+    CRect rect;
+    rect.bottom = -1;
+    while (m_nCurrPrintRow < GetRowCount())
+    {
+        rect.top = rect.bottom+1;
+        rect.bottom = rect.top + GetRowHeight(m_nCurrPrintRow) - 1;
+
+        if (rect.bottom > m_nPageHeight) break;            // Gone past end of page
+
+        rect.right = -1;
+
+        // modified to allow printing of wide grids on multiple pages
+        for (int col = m_nPrintColumn; col < GetColumnCount(); col++)
+        {
+            rect.left = rect.right+1;
+            rect.right =    rect.left
+                            + GetColumnWidth( col)
+                            - 1;
+
+            if( rect.right > m_nPageWidth)
+                break;
+
+            CGridCellBase* pCell = GetCell(m_nCurrPrintRow, col);
+            if (pCell)
+                pCell->PrintCell(pDC, m_nCurrPrintRow, col, rect);
+
+            if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ)
+            {
+                int Overlap = (col == 0)? 0:1;
+                pDC->MoveTo(rect.left-Overlap, rect.bottom);
+                pDC->LineTo(rect.right, rect.bottom);
+                if (m_nCurrPrintRow == 0) {
+                    pDC->MoveTo(rect.left-Overlap, rect.top);
+                    pDC->LineTo(rect.right, rect.top);
+                }
+            }
+            if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT)
+            {
+                int Overlap = (bFirstPrintedRow)? 0:1;
+                pDC->MoveTo(rect.right, rect.top-Overlap);
+                pDC->LineTo(rect.right, rect.bottom);
+                if (col == 0) {
+                    pDC->MoveTo(rect.left, rect.top-Overlap);
+                    pDC->LineTo(rect.left, rect.bottom);
+                }
+            }
+
+        }
+        m_nCurrPrintRow++;
+        bFirstPrintedRow = FALSE;
+    }
+
+
+    // Footer
+    pInfo->m_rectDraw.bottom = m_nFooterHeight * m_CharSize.cy;
+    pDC->SetWindowOrg( -m_nLeftMargin * m_CharSize.cx,
+        -m_LogicalPageSize.cy + m_nFooterHeight * m_CharSize.cy);
+    PrintFooter(pDC, pInfo);
+
+    // SetWindowOrg back for next page
+    pDC->SetWindowOrg(0,0);
+
+    pDC->SelectObject(pOldFont);
+}
+
+
+// added by M.Fletcher 12/17/00
+void CGridCtrl::PrintFixedRowCells(int nStartColumn, int nStopColumn, int& row, CRect& rect,
+                                   CDC *pDC, BOOL& bFirst)
+{
+   // print all cells from nStartColumn to nStopColumn on row
+   for (int col =nStartColumn; col < nStopColumn; col++)
+   {
+      rect.left = rect.right+1;
+      rect.right =    rect.left + GetColumnWidth( col) - 1;
+
+      if( rect.right > m_nPageWidth)
+         break;
+      
+      CGridCellBase* pCell = GetCell(row, col);
+      if (pCell)
+         pCell->PrintCell(pDC, row, col, rect);
+      
+      if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ)
+      {
+         int Overlap = (col == 0)? 0:1;
+         
+         pDC->MoveTo(rect.left-Overlap, rect.bottom);
+         pDC->LineTo(rect.right, rect.bottom);
+         
+         if (row == 0)
+         {
+            pDC->MoveTo(rect.left-Overlap, rect.top);
+            pDC->LineTo(rect.right, rect.top);
+          }
+      }
+
+      if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT)
+      {
+         int Overlap = (row == 0)? 0:1;
+
+         pDC->MoveTo(rect.right, rect.top-Overlap);
+         pDC->LineTo(rect.right, rect.bottom);
+         
+         if( bFirst)
+         {
+            pDC->MoveTo(rect.left-1, rect.top-Overlap);
+            pDC->LineTo(rect.left-1, rect.bottom);
+            bFirst = FALSE;
+          }
+
+       }
+
+   } // end of column cells loop
+
+
+} // end of CGridCtrl::PrintFixedRowCells
+
+void CGridCtrl::PrintColumnHeadings(CDC *pDC, CPrintInfo* /*pInfo*/)
+{
+    CFont *pOldFont = pDC->SelectObject(&m_PrinterFont);
+
+    CRect rect;
+    rect.bottom = -1;
+
+    BOOL bFirst = TRUE;
+    BOOL bOriginal;
+    
+
+    // modified to allow column hdr printing of multi-page wide grids
+    for (int row = 0; row < GetFixedRowCount(); row++)
+    {
+        rect.top = rect.bottom+1;
+        rect.bottom = rect.top + GetRowHeight(row) - 1;
+
+        rect.right = -1;
+ 
+        // if printColumn > fixedcolumncount we are on page 2 or more
+        // lets printout those fixed cell headings again the 1 or more that would be missed
+        // added by M.Fletcher 12/17/00
+        if(m_nPrintColumn>= GetFixedColumnCount())
+        {
+           bOriginal=bFirst;
+           // lets print the missing fixed cells on left first out to last fixed column
+           PrintFixedRowCells(0,GetFixedColumnCount(), row, rect, pDC, bFirst);
+           bFirst=bOriginal;
+        }
+
+        // now back to normal business print cells in heading after all fixed columns
+        PrintFixedRowCells(m_nPrintColumn, GetColumnCount(), row, rect, pDC, bFirst);
+        
+    } // end of Row Loop
+
+    pDC->SelectObject(pOldFont);
+} // end of CGridCtrl::PrintColumnHeadings
+
+
+
+/*****************************************************************************
+Prints line of row buttons on each page of the printout.  Assumes that
+the window origin is setup before calling
+
+*****************************************************************************/
+void CGridCtrl::PrintRowButtons(CDC *pDC, CPrintInfo* /*pInfo*/)
+{
+    CFont *pOldFont = pDC->SelectObject(&m_PrinterFont);
+
+    CRect rect;
+    rect.right = -1;
+
+    BOOL bFirst = TRUE;
+    for( int iCol = 0; iCol < GetFixedColumnCount(); iCol++)
+    {
+        rect.left = rect.right+1;
+        rect.right =    rect.left
+                        + GetColumnWidth( iCol)
+                        - 1;
+
+        rect.bottom = -1;
+        for( int iRow = m_nCurrPrintRow; iRow < GetRowCount(); iRow++)
+        {
+            rect.top = rect.bottom+1;
+            rect.bottom = rect.top + GetRowHeight( iRow) - 1;
+
+            if( rect.bottom > m_nPageHeight)
+                break;
+
+            CGridCellBase* pCell = GetCell(iRow, iCol);
+            if (pCell)
+                pCell->PrintCell(pDC, iRow, iCol, rect);
+
+            if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_HORZ)
+            {
+                int Overlap = (iCol == 0)? 0:1;
+                pDC->MoveTo(rect.left-Overlap, rect.bottom);
+                pDC->LineTo(rect.right, rect.bottom);
+                if( bFirst) {
+                    pDC->MoveTo(rect.left-Overlap, rect.top-1);
+                    pDC->LineTo(rect.right, rect.top-1);
+                    bFirst = FALSE;
+                }
+            }
+            if (m_nGridLines == GVL_BOTH || m_nGridLines == GVL_VERT)
+            {
+                int Overlap = (iRow == 0)? 0:1;
+                pDC->MoveTo(rect.right, rect.top-Overlap);
+                pDC->LineTo(rect.right, rect.bottom);
+                if (iCol == 0) {
+                    pDC->MoveTo(rect.left, rect.top-Overlap);
+                    pDC->LineTo(rect.left, rect.bottom);
+                }
+            }
+
+        }
+    }
+    pDC->SelectObject(pOldFont);
+}
+
+void CGridCtrl::PrintHeader(CDC *pDC, CPrintInfo *pInfo)
+{
+    // print App title on top right margin
+    CString strRight;
+    strRight.LoadString(AFX_IDS_APP_TITLE);
+
+    // print parent window title in the centre (Gert Rijs)
+    CString strCenter;
+    CWnd *pParentWnd = GetParent();
+    while (pParentWnd)
+    {
+        pParentWnd->GetWindowText(strCenter);
+        if (strCenter.GetLength())  // can happen if it is a CView, CChildFrm has the title
+            break;
+        pParentWnd = pParentWnd->GetParent();
+    }
+
+    CFont   BoldFont;
+    LOGFONT lf;
+
+    //create bold font for header and footer
+    VERIFY(m_PrinterFont.GetLogFont(&lf));
+    lf.lfWeight = FW_BOLD;
+    VERIFY(BoldFont.CreateFontIndirect(&lf));
+
+    CFont *pNormalFont = pDC->SelectObject(&BoldFont);
+    int nPrevBkMode = pDC->SetBkMode(TRANSPARENT);
+
+    CRect   rc(pInfo->m_rectDraw);
+    if( !strCenter.IsEmpty() )
+        pDC->DrawText( strCenter, &rc, DT_CENTER | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
+    if( !strRight.IsEmpty() )
+        pDC->DrawText( strRight, &rc, DT_RIGHT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
+
+    pDC->SetBkMode(nPrevBkMode);
+    pDC->SelectObject(pNormalFont);
+    BoldFont.DeleteObject();
+
+    // draw ruled-line across top
+    pDC->SelectStockObject(BLACK_PEN);
+    pDC->MoveTo(rc.left, rc.bottom);
+    pDC->LineTo(rc.right, rc.bottom);
+}
+
+//print footer with a line and date, and page number
+void CGridCtrl::PrintFooter(CDC *pDC, CPrintInfo *pInfo)
+{
+    // page numbering on left
+    CString strLeft;
+    strLeft.Format(_T("Page %d of %d"), pInfo->m_nCurPage, pInfo->GetMaxPage() );
+
+    // date and time on the right
+    CString strRight;
+    COleDateTime t = COleDateTime::GetCurrentTime();
+    strRight = t.Format(_T("%c"));
+    
+    CRect rc(pInfo->m_rectDraw);
+
+    // draw ruled line on bottom
+    pDC->SelectStockObject(BLACK_PEN);
+    pDC->MoveTo(rc.left, rc.top);
+    pDC->LineTo(rc.right, rc.top);
+
+    CFont BoldFont;
+    LOGFONT lf;
+
+    //create bold font for header and footer
+    m_PrinterFont.GetLogFont(&lf);
+    lf.lfWeight = FW_BOLD;
+    BoldFont.CreateFontIndirect(&lf);
+
+    CFont *pNormalFont = pDC->SelectObject(&BoldFont);
+    int nPrevBkMode = pDC->SetBkMode(TRANSPARENT);
+
+    // EFW - Bug fix - Force text color to black.  It doesn't always
+    // get set to a printable color when it gets here.
+    pDC->SetTextColor(RGB(0, 0, 0));
+
+    if( !strLeft.IsEmpty() )
+        pDC->DrawText( strLeft, &rc, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
+    if( !strRight.IsEmpty() )
+        pDC->DrawText( strRight, &rc, DT_RIGHT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
+
+    pDC->SetBkMode(nPrevBkMode);
+    pDC->SelectObject(pNormalFont);
+    BoldFont.DeleteObject();
+}
+
+void CGridCtrl::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
+{
+    m_PrinterFont.DeleteObject();
+}
+
+#endif  // !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+
+
+#ifndef _WIN32_WCE
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl persistance
+
+BOOL CGridCtrl::Save(LPCTSTR filename, TCHAR chSeparator/*=_T(',')*/)
+{
+    CStdioFile File;
+    CFileException ex;
+	CString strSeparator(chSeparator);
+
+    if (!File.Open(filename, CFile::modeWrite | CFile::modeCreate| CFile::typeText, &ex))
+    {
+        ex.ReportError();
+        return FALSE;
+    }
+
+    TRY
+    {
+        int nNumColumns = GetColumnCount();
+        for (int i = 0; i < GetRowCount(); i++)
+        {
+            for (int j = 0; j < nNumColumns; j++)
+            {
+                File.WriteString(GetItemText(i,j));
+                File.WriteString((j==(nNumColumns-1))? _T("\n"): strSeparator);
+            }
+        }
+
+        File.Close();
+    }
+
+    CATCH (CFileException, e)
+    {
+        AfxMessageBox(_T("Unable to save grid list"));
+        return FALSE;
+    }
+    END_CATCH
+
+    return TRUE;
+}
+
+BOOL CGridCtrl::Load(LPCTSTR filename, TCHAR chSeparator/*=_T(',')*/)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    TCHAR *token, *end;
+    TCHAR buffer[1024];
+    CStdioFile File;
+    CFileException ex;
+
+    if (!File.Open(filename, CFile::modeRead | CFile::typeText))
+    {
+        ex.ReportError();
+        return FALSE;
+    }
+
+    DeleteAllItems();
+
+    TRY
+    {
+        // Read Header off file
+        File.ReadString(buffer, 1024);
+
+        // Get first token
+        for (token=buffer, end=buffer;
+             *end && (*end != chSeparator) && (*end != _T('\n')); 
+             end++)
+            ;
+
+        if ((*end == _T('\0')) && (token == end))
+            token = NULL;
+
+        *end = _T('\0');
+
+        while (token)
+        {
+            InsertColumn(token);
+
+            // Get next token
+            for (token=++end; *end && (*end != chSeparator) && (*end != _T('\n'));
+               end++)
+                ;
+
+            if ((*end == _T('\0')) && (token == end))
+                token = NULL;
+
+            *end = _T('\0');
+        }
+
+        // Read in rest of data
+        int nItem = 1;
+        while (File.ReadString(buffer, 1024))
+        {
+            // Get first token
+            for (token=buffer, end=buffer;
+              *end && (*end != chSeparator) && (*end != _T('\n')); end++)
+                ;
+
+            if ((*end == _T('\0')) && (token == end))
+                token = NULL;
+
+            *end = _T('\0');
+
+            int nSubItem = 0;
+            while (token)
+            {
+                if (!nSubItem)
+                    InsertRow(token);
+                else
+                    SetItemText(nItem, nSubItem, token);
+
+                // Get next token
+                for (token=++end; *end && (*end != chSeparator) && (*end != _T('\n'));
+                  end++)
+                    ;
+
+                if ((*end == _T('\0')) && (token == end))
+                    token = NULL;
+
+                *end = _T('\0');
+
+                nSubItem++;
+            }
+            nItem++;
+        }
+
+        AutoSizeColumns(GetAutoSizeStyle());
+        File.Close();
+    }
+
+    CATCH (CFileException, e)
+    {
+        AfxMessageBox(_T("Unable to load grid data"));
+        return FALSE;
+    }
+    END_CATCH
+
+    return TRUE;
+}
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl overrideables
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+// This is no longer needed since I've changed to OLE drag and drop - but it's
+// still cool code. :)
+CImageList* CGridCtrl::CreateDragImage(CPoint *pHotSpot)
+{
+    CDC* pDC = GetDC();
+    if (!pDC)
+        return NULL;
+
+    CRect rect;
+    CCellID cell = GetFocusCell();
+    if (!GetCellRect(cell.row, cell.col, rect))
+        return NULL;
+    
+    // Translate coordinate system
+    rect.BottomRight() = CPoint(rect.Width(), rect.Height());
+    rect.TopLeft()     = CPoint(0, 0);
+    *pHotSpot = rect.BottomRight(); 
+    
+    // Create a new imagelist (the caller of this function has responsibility
+    // for deleting this list)
+    CImageList* pList = new CImageList;
+    if (!pList || !pList->Create(rect.Width(), rect.Height(), ILC_MASK, 1, 1))
+    {    
+        if (pList)
+            delete pList;
+        return NULL;
+    }
+    
+    // Create mem DC and bitmap
+    CDC MemDC;
+    CBitmap bm;
+    MemDC.CreateCompatibleDC(pDC);
+    bm.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height());
+    CBitmap* pOldBitmap = MemDC.SelectObject(&bm);
+    MemDC.SetWindowOrg(0, 0);
+    
+    // Draw cell onto bitmap in memDC
+    CGridCellBase* pCell = GetCell(cell.row, cell.col);
+    if (pCell)
+        pCell->Draw(&MemDC, cell.row, cell.col, rect, FALSE);
+    
+    // Clean up
+    MemDC.SelectObject(pOldBitmap);
+    ReleaseDC(pDC);
+    
+    // Add the bitmap we just drew to the image list.
+    pList->Add(&bm, GetDefaultCell(FALSE, FALSE)->GetBackClr());
+    bm.DeleteObject();
+
+    return pList;
+}
+#endif
+
+void CGridCtrl::OnFixedRowClick(CCellID& cell)
+{
+    if (!IsValid(cell))
+        return;
+
+    if (GetHeaderSort())
+    {
+        CWaitCursor waiter;
+        if (cell.col == GetSortColumn())
+            SortItems(cell.col, !GetSortAscending());
+        else
+            SortItems(cell.col, TRUE);
+        Invalidate();
+    }
+
+	// Did the user click on a fixed column cell (so the cell was within the overlap of
+	// fixed row and column cells) - (fix by David Pritchard)
+    if (GetFixedColumnSelection())
+    {
+        if (cell.col < GetFixedColumnCount())
+        {
+            m_MouseMode = MOUSE_SELECT_ALL;
+            OnSelecting(cell);
+        }
+        else 
+        {
+            m_MouseMode = MOUSE_SELECT_COL;
+            OnSelecting(cell);
+        }
+    }
+}
+
+void CGridCtrl::OnFixedColumnClick(CCellID& cell)
+{
+    if (!IsValid(cell))
+        return;
+
+//    if (m_bListMode && (GetItemState(cell.row, m_nFixedCols) & GVNI_SELECTED))
+//    {
+//        OnEditCell(cell.row, cell.col, VK_LBUTTON);
+//        return;
+//    }
+
+	// Did the user click on a fixed row cell (so the cell was within the overlap of
+	// fixed row and column cells) - (fix by David Pritchard)
+    if (GetFixedRowSelection())
+    {
+        if (cell.row < GetFixedRowCount())
+        {
+            m_MouseMode = MOUSE_SELECT_ALL;
+            OnSelecting(cell);
+        }
+        else
+        {
+            m_MouseMode = MOUSE_SELECT_ROW;
+            OnSelecting(cell);
+        }
+    }
+}
+
+// Gets the extent of the text pointed to by str (no CDC needed)
+// By default this uses the selected font (which is a bigger font)
+CSize CGridCtrl::GetTextExtent(int nRow, int nCol, LPCTSTR str)
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+    if (!pCell)
+        return CSize(0, 0);
+    else
+        return pCell->GetTextExtent(str);
+}
+
+// virtual
+void CGridCtrl::OnEditCell(int nRow, int nCol, CPoint point, UINT nChar)
+{
+#ifndef GRIDCONTROL_NO_TITLETIPS
+    m_TitleTip.Hide();  // hide any titletips
+#endif
+
+    // Can we do it?
+    CCellID cell(nRow, nCol);
+    if (!IsValid(cell) || !IsCellEditable(nRow, nCol))
+        return;
+
+    // Can we see what we are doing?
+    EnsureVisible(nRow, nCol);
+    if (!IsCellVisible(nRow, nCol))
+        return;
+
+    // Where, exactly, are we gonna do it??
+    CRect rect;
+    if (!GetCellRect(cell, rect))
+        return;
+
+    // Check we can edit...
+    if (SendMessageToParent(nRow, nCol, GVN_BEGINLABELEDIT) >= 0)
+    {
+		// LUC
+		GetTopLeftMergedCell(nRow, nCol, rect);
+
+        // Let's do it...
+        CGridCellBase* pCell = GetCell(nRow, nCol);
+        if (pCell)
+		{
+			pCell->Edit(nRow, nCol, rect, point, IDC_INPLACE_CONTROL, nChar);
+		}
+            
+    }
+}
+
+// virtual
+void CGridCtrl::EndEditing()
+{
+    CCellID cell = GetFocusCell();
+    if (!IsValid(cell)) return;
+    CGridCellBase *pCell = GetCell(cell.row, cell.col);
+    if (pCell)
+        pCell->EndEdit();
+}
+
+// virtual
+void CGridCtrl::OnEndEditCell(int nRow, int nCol, CString str)
+{
+    CString strCurrentText = GetItemText(nRow, nCol);
+    if (strCurrentText != str)
+    {
+        SetItemText(nRow, nCol, str);
+        if (ValidateEdit(nRow, nCol, str) && 
+            SendMessageToParent(nRow, nCol, GVN_ENDLABELEDIT) >= 0)
+        {
+            SetModified(TRUE, nRow, nCol);
+            RedrawCell(nRow, nCol);
+        }
+        else
+        {
+            SetItemText(nRow, nCol, strCurrentText);
+        }
+    }
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+    if (pCell)
+        pCell->OnEndEdit();
+}
+
+// If this returns FALSE then the editing isn't allowed
+// virtual
+BOOL CGridCtrl::ValidateEdit(int nRow, int nCol, LPCTSTR str)
+{
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return TRUE;
+
+    return pCell->ValidateEdit(str);
+}
+
+// virtual
+CString CGridCtrl::GetItemText(int nRow, int nCol) const
+{
+    if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols)
+        return _T("");
+
+    CGridCellBase* pCell = GetCell(nRow, nCol);
+//    ASSERT(pCell);
+    if (!pCell)
+        return _T("");
+
+    return pCell->GetText();
+}
+
+void CGridCtrl::ResetVirtualOrder()
+{
+	m_arRowOrder.resize(m_nRows);  
+    for (int i = 0; i < m_nRows; i++)
+	{
+		m_arRowOrder[i] = i;	
+	}
+}
+
+
+void CGridCtrl::Reorder(int From, int To)
+{
+		// Set line From just after Line To
+//	ASSERT(From>= GetFixedRowCount() && To>=GetFixedRowCount()-1 && From<m_nRows && To<m_nRows);
+	int Value = m_arRowOrder[From];
+	m_arRowOrder.erase(m_arRowOrder.begin()+From);
+	int Offset = (From>=To ? 1:0);
+	m_arRowOrder.insert(m_arRowOrder.begin()+To+Offset, Value);
+
+}
+
+
+// LUC
+INT_PTR CGridCtrl::MergeCells(CCellRange& mergedCellRange)
+{
+	INT_PTR nMergeID = -1;
+	if(IsValid(mergedCellRange))
+	{
+		m_arMergedCells.Add(mergedCellRange);
+		nMergeID =  m_arMergedCells.GetSize() - 1;
+	}
+
+	return nMergeID;
+
+}
+
+void CGridCtrl::SplitCells(INT_PTR nMergeID)
+{
+	if(nMergeID > -1)
+	{
+		m_arMergedCells.RemoveAt(nMergeID);
+	}
+}
+
+BOOL CGridCtrl::IsMergedCell(int row, int col, CCellRange& mergedCellRange)
+{
+	if((mergedCellRange.GetMinRow() <= row) && (mergedCellRange.GetMinCol() <= col)
+		&& (mergedCellRange.GetMaxRow() >= row) && (mergedCellRange.GetMaxCol() >= col))
+	{
+		return TRUE;
+	}
+
+	return FALSE;	
+}
+
+
+BOOL CGridCtrl::GetMergedCellRect(CCellRange& mergedCell, CRect& rect)
+{ 	
+	CCellID idTopLeftMin = GetTopleftNonFixedCell();
+
+	if(m_nFreezedRows > 0)
+	{
+		idTopLeftMin.row = m_nFixedRows;
+	}
+	if(m_nFreezedCols > 0)
+	{
+		idTopLeftMin.col = m_nFixedCols;
+	}
+				
+	int nMinRow = mergedCell.GetMinRow();
+	if(nMinRow < idTopLeftMin.row)
+		nMinRow = idTopLeftMin.row;
+	
+	int nMinCol = mergedCell.GetMinCol();
+	if(nMinCol < idTopLeftMin.col)
+		nMinCol = idTopLeftMin.col;
+	
+	int nMaxRow = mergedCell.GetMaxRow();
+	int nMaxCol = mergedCell.GetMaxCol();		
+	
+	while(!IsCellVisible(nMinRow, nMaxCol))
+	{
+		nMaxCol--;
+		if(nMaxCol <= nMinCol)
+		{
+			break;
+		}
+	}
+
+	while(!IsCellVisible(nMaxRow, nMinCol))
+	{
+		nMaxRow--;
+		if(nMaxRow <= nMinRow)
+		{
+			break;
+		}
+	}
+	
+	CRect rcTopLeft;
+	GetCellRect(nMinRow, nMinCol, rcTopLeft);
+
+	CRect rcBottomRight;
+	GetCellRect(nMaxRow, nMaxCol, rcBottomRight);
+
+	rect.left = rcTopLeft.left;
+	rect.top = rcTopLeft.top;
+	rect.right = rcBottomRight.right;
+	rect.bottom = rcBottomRight.bottom;				
+
+	return TRUE;
+}
+
+BOOL CGridCtrl::GetTopLeftMergedCell(int& row, int& col, CRect& mergeRect)
+{
+	BOOL bRet = FALSE;
+
+	INT_PTR size = m_arMergedCells.GetSize();
+	if(size > 0)
+	{	
+		for(INT_PTR i = 0; i < size; i++)
+		{
+			CCellRange& mergedCell = m_arMergedCells[i];
+			if(IsMergedCell(row, col, mergedCell))
+			{
+				CCellID idTopLeftMin = GetTopleftNonFixedCell();
+
+				if(m_nFreezedRows > 0)
+				{
+					idTopLeftMin.row = m_nFixedRows;
+				}
+				if(m_nFreezedCols > 0)
+				{
+					idTopLeftMin.col = m_nFixedCols;
+				}
+				
+				int nMinRow = mergedCell.GetMinRow();
+				int nMinCol = mergedCell.GetMinCol();
+
+				row = nMinRow;
+				col = nMinCol;
+
+				if(nMinRow < idTopLeftMin.row)
+					nMinRow = idTopLeftMin.row;
+				
+				if(nMinCol < idTopLeftMin.col)
+					nMinCol = idTopLeftMin.col;
+				
+				int nMaxRow = mergedCell.GetMaxRow();
+				int nMaxCol = mergedCell.GetMaxCol();
+
+				while(!IsCellVisible(nMinRow, nMaxCol))
+				{
+					nMaxCol--;
+					if(nMaxCol <= nMinCol)
+					{
+						break;
+					}
+				}
+
+				while(!IsCellVisible(nMaxRow, nMinCol))
+				{
+					nMaxRow--;
+					if(nMaxRow <= nMinRow)
+					{
+						break;
+					}
+				}
+				
+				if(mergeRect != rectNull)
+				{
+					CRect rcTopLeft;
+					GetCellRect(nMinRow, nMinCol, rcTopLeft);
+
+					CRect rcBottomRight;
+					GetCellRect(nMaxRow, nMaxCol, rcBottomRight);
+
+					mergeRect.left = rcTopLeft.left;
+					mergeRect.top = rcTopLeft.top;
+					mergeRect.right = rcBottomRight.right;
+					mergeRect.bottom = rcBottomRight.bottom;				
+				}								
+
+				bRet =  TRUE;
+			}
+		}
+	}
+
+	return bRet;
+}
+
+BOOL CGridCtrl::GetBottomRightMergedCell(int& row, int& col, CRect& mergeRect)
+{
+	BOOL bRet = FALSE;
+
+	INT_PTR size = m_arMergedCells.GetSize();
+	if(size > 0)
+	{	
+		for(INT_PTR i = 0; i < size; i++)
+		{
+			CCellRange& mergedCell = m_arMergedCells[i];
+			if(IsMergedCell(row, col, mergedCell))
+			{
+				CCellID idTopLeftMin = GetTopleftNonFixedCell();
+
+				if(m_nFreezedRows > 0)
+				{
+					idTopLeftMin.row = m_nFixedRows;
+				}
+				if(m_nFreezedCols > 0)
+				{
+					idTopLeftMin.col = m_nFixedCols;
+				}
+				
+				int nMinRow = mergedCell.GetMinRow();
+				int nMinCol = mergedCell.GetMinCol();				
+
+				if(nMinRow < idTopLeftMin.row)
+					nMinRow = idTopLeftMin.row;
+				
+				if(nMinCol < idTopLeftMin.col)
+					nMinCol = idTopLeftMin.col;
+				
+				int nMaxRow = mergedCell.GetMaxRow();
+				int nMaxCol = mergedCell.GetMaxCol();
+
+				row = nMaxRow;
+				col = nMaxCol;
+
+				while(!IsCellVisible(nMinRow, nMaxCol))
+				{
+					nMaxCol--;
+					if(nMaxCol <= nMinCol)
+					{
+						break;
+					}
+				}
+
+				while(!IsCellVisible(nMaxRow, nMinCol))
+				{
+					nMaxRow--;
+					if(nMaxRow <= nMinRow)
+					{
+						break;
+					}
+				}
+
+				if(mergeRect != rectNull)
+				{
+					CRect rcTopLeft;
+					GetCellRect(nMinRow, nMinCol, rcTopLeft);
+
+					CRect rcBottomRight;
+					GetCellRect(nMaxRow, nMaxCol, rcBottomRight);
+
+					mergeRect.left = rcTopLeft.left;
+					mergeRect.top = rcTopLeft.top;
+					mergeRect.right = rcBottomRight.right;
+					mergeRect.bottom = rcBottomRight.bottom;				
+				}								
+
+				bRet =  TRUE;
+			}
+		}
+	}
+
+	return bRet;
+}
+
+
+BOOL CGridCtrl::GetMergedCellRect(int row, int col, CRect& rect)
+{ 
+	INT_PTR size = m_arMergedCells.GetSize();
+	if(size > 0)
+	{	
+		for(INT_PTR i = 0; i < size; i++)
+		{
+			if(IsMergedCell(row, col, m_arMergedCells[i]))
+			{
+				CCellID idTopLeftMin = GetTopleftNonFixedCell();
+				
+				int nMinRow = m_arMergedCells[i].GetMinRow();
+				if(nMinRow < idTopLeftMin.row)
+					nMinRow = idTopLeftMin.row;
+				int nMinCol = m_arMergedCells[i].GetMinCol();
+				if(nMinCol < idTopLeftMin.col)
+					nMinCol = idTopLeftMin.col;
+				int nMaxRow = m_arMergedCells[i].GetMaxRow();
+				int nMaxCol = m_arMergedCells[i].GetMaxCol();
+
+				CRect rcTopLeft;
+				GetCellRect(nMinRow, nMinCol, rcTopLeft);
+
+				CRect rcBottomRight;
+				GetCellRect(nMaxRow, nMaxCol, rcBottomRight);
+
+				rect.left = rcTopLeft.left;
+				rect.top = rcTopLeft.top;
+				rect.right = rcBottomRight.right;
+				rect.bottom = rcBottomRight.bottom;				
+
+				return TRUE;
+			}
+		}
+	}
+
+	return FALSE;
+}
+
+// LUC
+BOOL CGridCtrl::IsFocused(CGridCellBase& cell, int nRow, int nCol)
+{
+	BOOL bRet = cell.IsFocused();
+	if(!bRet && m_bDrawingMergedCell)
+	{
+		CCellRange& mergedCell = m_arMergedCells[m_nCurrentMergeID];
+		for(int row = mergedCell.GetMinRow(); row <= mergedCell.GetMaxRow(); row++)
+		{
+			for(int col = mergedCell.GetMinCol(); col <= mergedCell.GetMaxCol(); col++)
+			{
+				CGridCellBase* pCell = GetCell(row, col);
+				if(pCell != NULL)
+				{
+					if(pCell->IsFocused())
+					{
+						bRet = TRUE;
+					}
+				}
+			}
+		}				
+	}
+	
+	return bRet;
+}
+
+BOOL CGridCtrl::IsSelected(CGridCellBase& cell, int nRow, int nCol)
+{
+	BOOL bRet = cell.IsSelected();
+	if(!bRet && m_bDrawingMergedCell)
+	{
+		CCellRange& mergedCell = m_arMergedCells[m_nCurrentMergeID];
+		for(int row = mergedCell.GetMinRow(); row <= mergedCell.GetMaxRow(); row++)
+		{
+			for(int col = mergedCell.GetMinCol(); col <= mergedCell.GetMaxCol(); col++)
+			{
+				CGridCellBase* pCell = GetCell(row, col);
+				if(pCell != NULL)
+				{
+					if(pCell->IsSelected())
+					{
+						bRet = TRUE;
+					}
+				}
+			}
+		}				
+	}
+	
+	return bRet;
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/GridCtrl.h b/Common_Class/SISControls/GridControl/GridCtrl.h
new file mode 100644
index 0000000..286c9db
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridCtrl.h
@@ -0,0 +1,1088 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCtrl.h : header file
+//
+// MFC Grid Control - main header
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+// FEATURES BY Mukit, Ataul (2007-11-17):
+// 1. Merge Cell 
+// 2. Ability to do XL Style Freeze Pane
+// 3. The Horizontal Gray Area Removed 
+  
+// FINDINGS:
+// 1. A cell cannot be edited if a tooltip is shown..
+// 2. The InplaceEditCtrl is not multiline even if a cell can contain Multiline Text..
+// 3. If a cell is too small, the InplaceEditCtrl is almost invisible..
+
+#if !defined(AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include "CellRange.h"
+#include "GridCell.h"
+#include <afxtempl.h>
+#include <vector>
+using namespace std;
+
+
+struct CELL_ENABLE
+{
+	CELL_ENABLE()
+	{
+		nEnable = -1;
+	}
+	void SetEnable(BOOL bValue)
+	{
+		nEnable = bValue;
+	}
+	BOOL isEnable()
+	{
+		if (nEnable == 0)
+		{
+			return FALSE;
+		}
+		else if (nEnable > 0)
+		{
+			return TRUE;
+		}
+	}
+	BOOL isActivated()
+	{
+		if (nEnable < 0)
+		{
+			return FALSE;
+		}
+		else
+			return TRUE;
+	}
+	int nEnable;
+};
+
+///////////////////////////////////////////////////////////////////////////////////
+// Defines - these determine the features (and the final size) of the final code
+///////////////////////////////////////////////////////////////////////////////////
+
+//#define GRIDCONTROL_NO_TITLETIPS   // Do not use titletips for cells with large data
+//#define GRIDCONTROL_NO_DRAGDROP    // Do not use OLE drag and drop
+//#define GRIDCONTROL_NO_CLIPBOARD   // Do not use clipboard routines
+
+#ifdef _WIN32_WCE
+#   define GRIDCONTROL_NO_TITLETIPS   // Do not use titletips for cells with large data
+#   define GRIDCONTROL_NO_DRAGDROP    // Do not use OLE drag and drop
+#   define GRIDCONTROL_NO_CLIPBOARD   // Do not use clipboard routines
+#   define GRIDCONTROL_NO_PRINTING    // Do not use printing routines
+#   ifdef WCE_NO_PRINTING			  // Older versions of CE had different #def's
+#       define _WIN32_WCE_NO_PRINTING
+#   endif
+#   ifdef WCE_NO_CURSOR
+#       define _WIN32_WCE_NO_CURSOR
+#   endif
+#endif  // _WIN32_WCE
+
+// Use this as the classname when inserting this control as a custom control
+// in the MSVC++ dialog editor
+#define GRIDCTRL_CLASSNAME    _T("MFCGridCtrl")  // Window class name
+#define IDC_INPLACE_CONTROL   8                  // ID of inplace edit controls
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Conditional includes
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+#   include "TitleTip.h"
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+#   include "GridDropTarget.h"
+#   undef GRIDCONTROL_NO_CLIPBOARD     // Force clipboard functions on
+#endif
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+#   include <afxole.h>
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Helper functions
+///////////////////////////////////////////////////////////////////////////////////
+
+// Handy functions
+#define IsSHIFTpressed() ( (GetKeyState(VK_SHIFT) & (1 << (sizeof(SHORT)*8-1))) != 0   )
+#define IsCTRLpressed()  ( (GetKeyState(VK_CONTROL) & (1 << (sizeof(SHORT)*8-1))) != 0 )
+
+// Backwards compatibility for pre 2.20 grid versions
+#define DDX_GridControl(pDX, nIDC, rControl)  DDX_Control(pDX, nIDC, rControl)     
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Structures
+///////////////////////////////////////////////////////////////////////////////////
+
+// This structure sent to Grid's parent in a WM_NOTIFY message
+typedef struct tagNM_GRIDVIEW {
+    NMHDR hdr;
+    int   iRow;
+    int   iColumn;
+} NM_GRIDVIEW;
+
+// This is sent to the Grid from child in-place edit controls
+typedef struct tagGV_DISPINFO {
+    NMHDR   hdr;
+    GV_ITEM item;
+} GV_DISPINFO;
+
+// This is sent to the Grid from child in-place edit controls
+typedef struct tagGV_CACHEHINT {
+    NMHDR      hdr;
+    CCellRange range;
+} GV_CACHEHINT;
+
+// storage typedef for each row in the grid
+typedef CTypedPtrArray<CObArray, CGridCellBase*> GRID_ROW;
+
+// For virtual mode callback
+typedef BOOL (CALLBACK* GRIDCALLBACK)(GV_DISPINFO *, LPARAM);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Defines
+///////////////////////////////////////////////////////////////////////////////////
+
+// Grid line/scrollbar selection
+#define GVL_NONE                0L      // Neither
+#define GVL_HORZ                1L      // Horizontal line or scrollbar
+#define GVL_VERT                2L      // Vertical line or scrollbar
+#define GVL_BOTH                3L      // Both
+
+// Autosizing option
+#define GVS_DEFAULT             0
+#define GVS_HEADER              1       // Size using column fixed cells data only
+#define GVS_DATA                2       // Size using column non-fixed cells data only
+#define GVS_BOTH                3       // Size using column fixed and non-fixed
+
+// Cell Searching options
+#define GVNI_FOCUSED            0x0001
+#define GVNI_SELECTED           0x0002
+#define GVNI_DROPHILITED        0x0004
+#define GVNI_READONLY           0x0008
+#define GVNI_FIXED              0x0010
+#define GVNI_MODIFIED           0x0020
+// LUC
+#define GVNI_FREEZED			0x0040
+
+#define GVNI_ABOVE              LVNI_ABOVE
+#define GVNI_BELOW              LVNI_BELOW
+#define GVNI_TOLEFT             LVNI_TOLEFT
+#define GVNI_TORIGHT            LVNI_TORIGHT
+#define GVNI_ALL                (LVNI_BELOW|LVNI_TORIGHT|LVNI_TOLEFT)
+#define GVNI_AREA               (LVNI_BELOW|LVNI_TORIGHT)
+
+// Hit test values (not yet implemented)
+#define GVHT_DATA               0x0000
+#define GVHT_TOPLEFT            0x0001
+#define GVHT_COLHDR             0x0002
+#define GVHT_ROWHDR             0x0004
+#define GVHT_COLSIZER           0x0008
+#define GVHT_ROWSIZER           0x0010
+#define GVHT_LEFT               0x0020
+#define GVHT_RIGHT              0x0040
+#define GVHT_ABOVE              0x0080
+#define GVHT_BELOW              0x0100
+
+// Messages sent to the grid's parent (More will be added in future)
+#define GVN_BEGINDRAG           LVN_BEGINDRAG        // LVN_FIRST-9
+#define GVN_BEGINLABELEDIT      LVN_BEGINLABELEDIT   // LVN_FIRST-5
+#define GVN_BEGINRDRAG          LVN_BEGINRDRAG
+#define GVN_COLUMNCLICK         LVN_COLUMNCLICK
+#define GVN_DELETEITEM          LVN_DELETEITEM
+#define GVN_ENDLABELEDIT        LVN_ENDLABELEDIT     // LVN_FIRST-6
+#define GVN_SELCHANGING         LVN_ITEMCHANGING
+#define GVN_SELCHANGED          LVN_ITEMCHANGED
+#define GVN_GETDISPINFO         LVN_GETDISPINFO 
+#define GVN_ODCACHEHINT         LVN_ODCACHEHINT 
+#define GVN_COMBOSELCHANGE		LVN_FIRST-10
+
+class CGridCtrl;
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl window
+
+typedef bool (*PVIRTUALCOMPARE)(int, int);
+
+class AFX_EXT_CLASS CGridCtrl : public CWnd
+{
+    DECLARE_DYNCREATE(CGridCtrl)
+    friend class CGridCell;
+    friend class CGridCellBase;
+
+// Construction
+public:
+    CGridCtrl(int nRows = 0, int nCols = 0, int nFixedRows = 0, int nFixedCols = 0);
+
+    BOOL Create(const RECT& rect, CWnd* parent, UINT nID,
+                DWORD dwStyle = WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VISIBLE);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Attributes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+
+///// LUC ///////////////////////////////////////////////////////////////////////
+
+	//// LUC : MergeCell////////
+	
+	INT_PTR MergeCells(CCellRange& mergedCellRange);
+	void SplitCells(INT_PTR nMergeID);
+
+	BOOL IsMergedCell(int row, int col, CCellRange& mergedCellRange);
+	BOOL GetMergedCellRect(int row, int col, CRect& rect);
+	BOOL GetMergedCellRect(CCellRange& mergedCell, CRect& rect);
+	BOOL GetTopLeftMergedCell(int& row, int& col, CRect& mergeRect);
+	BOOL GetBottomRightMergedCell(int& row, int& col, CRect& mergeRect);
+	virtual BOOL IsFocused(CGridCellBase& cell, int nRow, int nCol);
+	virtual BOOL IsSelected(CGridCellBase& cell, int nRow, int nCol);
+
+	BOOL	m_bDrawingMergedCell;
+	INT_PTR	m_nCurrentMergeID;
+
+	static CRect rectNull;		
+	static CCellID cellNull;
+
+	// LUC : Freeze Rows	
+
+	BOOL SetFreezedRowCount(int nFreezedRows)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedRows >= 0) && ((nFreezedRows + m_nFixedRows) <= m_nRows) )
+		{
+			m_nFreezedRows = nFreezedRows;
+			ResetScrollBars();
+			Refresh();
+			bRet = TRUE;
+		}
+	
+		return bRet;
+		
+	}
+	
+	BOOL SetFreezedColumnCount(int nFreezedCols)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedCols >= 0) && ((nFreezedCols + m_nFixedCols) <= m_nCols) )
+		{
+			m_nFreezedCols = nFreezedCols;
+			ResetScrollBars();
+			Refresh();
+			bRet = TRUE;
+		}
+	
+		return bRet;
+	}
+
+	// To avoid calling ResetScrollBars twice you can use SetFreezedFrame
+	BOOL SetFreezedFrame(int nFreezedRows, int nFreezedCols)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedRows >= 0) && ((nFreezedRows + m_nFixedRows) <= m_nRows) )
+		{
+			m_nFreezedRows = nFreezedRows;			
+			bRet = TRUE;
+		}
+		if( (nFreezedCols >= 0) && ((nFreezedCols + m_nFixedCols) <= m_nCols) )
+		{
+			m_nFreezedCols = nFreezedCols;
+			bRet = TRUE;
+		}
+		else
+		{
+			bRet = FALSE;
+		}
+
+		ResetScrollBars();
+			
+		return bRet;			
+	}	
+	
+	int  GetFreezedRowCount() const                    { return m_nFreezedRows; }
+    int  GetFreezedColumnCount() const                 { return m_nFreezedCols; }	
+
+	void ShowHorzNonGridArea(BOOL bShow)
+	{
+		m_bShowHorzNonGridArea = bShow;
+	}
+
+	BOOL IsShowingHorzNonGridArea()
+	{
+		return m_bShowHorzNonGridArea;
+	}
+
+///////////////////////////////////////////////////////////////////////////////////////    
+	
+    int  GetRowCount() const                    { return m_nRows; }
+    int  GetColumnCount() const                 { return m_nCols; }
+    int  GetFixedRowCount(BOOL bIncludeFreezedRows = FALSE) const
+	{ 
+		return (bIncludeFreezedRows) ? (m_nFixedRows + m_nFreezedRows) : m_nFixedRows;
+	}
+    int  GetFixedColumnCount(BOOL bIncludeFreezedCols = FALSE) const            
+	{
+		return (bIncludeFreezedCols) ? (m_nFixedCols + m_nFreezedCols) : m_nFixedCols; 
+	}	
+	
+	BOOL SetRowCount(int nRows = 10);
+    BOOL SetColumnCount(int nCols = 10);
+
+	BOOL UpdateCellEditableMask();
+    
+	BOOL SetFixedRowCount(int nFixedRows = 1);
+    BOOL SetFixedColumnCount(int nFixedCols = 1);	
+
+public:
+    int  GetRowHeight(int nRow) const;
+    BOOL SetRowHeight(int row, int height);
+    int  GetColumnWidth(int nCol) const;
+    BOOL SetColumnWidth(int col, int width);
+
+    BOOL GetCellOrigin(int nRow, int nCol, LPPOINT p);
+    BOOL GetCellOrigin(const CCellID& cell, LPPOINT p);
+    BOOL GetCellRect(int nRow, int nCol, LPRECT pRect);
+    BOOL GetCellRect(const CCellID& cell, LPRECT pRect);
+
+    BOOL GetTextRect(const CCellID& cell, LPRECT pRect);
+    BOOL GetTextRect(int nRow, int nCol, LPRECT pRect);
+
+	BOOL SetCellMaskEditable(int nRow, int nCol, BOOL bEditable);
+	BOOL isCellMaskEditable(int nRow, int nCol);
+	BOOL isCellMaskActivated(int nRow, int nCol);
+
+    // LUC
+	// Change for MergeCell
+	CCellID GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck = TRUE, CCellID& cellOriginal = cellNull);
+
+	// LUC
+    //int  GetFixedRowHeight() const;
+    //int  GetFixedColumnWidth() const;	    
+	int	GetFixedRowHeight(BOOL bIncludeFreezedRows = FALSE) const;
+	int GetFixedColumnWidth(BOOL bIncludeFreezedCols = FALSE) const;
+
+    long GetVirtualWidth() const;
+    long GetVirtualHeight() const;
+
+    CSize GetTextExtent(int nRow, int nCol, LPCTSTR str);
+    // EFW - Get extent of current text in cell
+    inline CSize GetCellTextExtent(int nRow, int nCol)  { return GetTextExtent(nRow, nCol, GetItemText(nRow,nCol)); }
+
+    void     SetGridBkColor(COLORREF clr)         { m_crGridBkColour = clr;           }
+    COLORREF GetGridBkColor() const               { return m_crGridBkColour;          }
+    void     SetGridLineColor(COLORREF clr)       { m_crGridLineColour = clr;         }
+    COLORREF GetGridLineColor() const             { return m_crGridLineColour;        }
+
+	void	 SetTitleTipBackClr(COLORREF clr = CLR_DEFAULT) { m_crTTipBackClr = clr;  }
+	COLORREF GetTitleTipBackClr()				            { return m_crTTipBackClr; }
+	void	 SetTitleTipTextClr(COLORREF clr = CLR_DEFAULT) { m_crTTipTextClr = clr;  }
+	COLORREF GetTitleTipTextClr()				            { return m_crTTipTextClr; }
+
+    // ***************************************************************************** //
+    // These have been deprecated. Use GetDefaultCell and then set the colors
+    void     SetTextColor(COLORREF clr)      { m_cellDefault.SetTextClr(clr);        }
+    COLORREF GetTextColor()                  { return m_cellDefault.GetTextClr();    }
+    void     SetTextBkColor(COLORREF clr)    { m_cellDefault.SetBackClr(clr);        }
+    COLORREF GetTextBkColor()                { return m_cellDefault.GetBackClr();    }
+    void     SetFixedTextColor(COLORREF clr) { m_cellFixedRowDef.SetTextClr(clr); 
+                                               m_cellFixedColDef.SetTextClr(clr); 
+                                               m_cellFixedRowColDef.SetTextClr(clr); }
+    COLORREF GetFixedTextColor() const       { return m_cellFixedRowDef.GetTextClr(); }
+    void     SetFixedBkColor(COLORREF clr)   { m_cellFixedRowDef.SetBackClr(clr); 
+                                               m_cellFixedColDef.SetBackClr(clr); 
+                                               m_cellFixedRowColDef.SetBackClr(clr); }
+    COLORREF GetFixedBkColor() const         { return m_cellFixedRowDef.GetBackClr(); }
+    void     SetGridColor(COLORREF clr)      { SetGridLineColor(clr);                }
+    COLORREF GetGridColor()                  { return GetGridLineColor();            }
+    void     SetBkColor(COLORREF clr)        { SetGridBkColor(clr);                  }
+    COLORREF GetBkColor()                    { return GetGridBkColor();              }
+
+    void     SetDefCellMargin( int nMargin)  { m_cellDefault.SetMargin(nMargin); 
+                                               m_cellFixedRowDef.SetMargin(nMargin); 
+                                               m_cellFixedColDef.SetMargin(nMargin); 
+                                               m_cellFixedRowColDef.SetMargin(nMargin); }
+    int      GetDefCellMargin() const        { return m_cellDefault.GetMargin();     }
+
+    int      GetDefCellHeight() const        { return m_cellDefault.GetHeight();     }
+    void     SetDefCellHeight(int nHeight)   { m_cellDefault.SetHeight(nHeight); 
+                                               m_cellFixedRowDef.SetHeight(nHeight); 
+                                               m_cellFixedColDef.SetHeight(nHeight); 
+                                               m_cellFixedRowColDef.SetHeight(nHeight); }
+    int      GetDefCellWidth() const         { return m_cellDefault.GetWidth();     }
+    void     SetDefCellWidth(int nWidth)     { m_cellDefault.SetWidth(nWidth); 
+                                               m_cellFixedRowDef.SetWidth(nWidth); 
+                                               m_cellFixedColDef.SetWidth(nWidth); 
+                                               m_cellFixedRowColDef.SetWidth(nWidth); }
+
+    // ***************************************************************************** //
+
+    int GetSelectedCount() const                  { return (int)m_SelectedCellMap.GetCount(); }
+
+    CCellID SetFocusCell(CCellID cell);
+    CCellID SetFocusCell(int nRow, int nCol);
+    CCellID GetFocusCell() const                  { return m_idCurrentCell;           }
+
+
+    void SetVirtualMode(BOOL bVirtual);
+    BOOL GetVirtualMode() const                   { return m_bVirtualMode;            }
+    void SetCallbackFunc(GRIDCALLBACK pCallback, 
+                         LPARAM lParam)           { m_pfnCallback = pCallback; m_lParam = lParam; }
+    GRIDCALLBACK GetCallbackFunc()                { return m_pfnCallback;             }
+
+
+    void SetImageList(CImageList* pList)          { m_pImageList = pList;             }
+    CImageList* GetImageList() const              { return m_pImageList;              }
+
+    void SetGridLines(int nWhichLines = GVL_BOTH);
+    int  GetGridLines() const                     { return m_nGridLines;              }
+    void SetEditable(BOOL bEditable = TRUE)       { m_bEditable = bEditable;          }
+    BOOL IsEditable() const                       { return m_bEditable;               }
+    void SetListMode(BOOL bEnableListMode = TRUE);
+    BOOL GetListMode() const                      { return m_bListMode;               }
+    void SetSingleRowSelection(BOOL bSing = TRUE) { m_bSingleRowSelection = bSing;    }
+    BOOL GetSingleRowSelection()                  { return m_bSingleRowSelection & m_bListMode; }
+    void SetSingleColSelection(BOOL bSing = TRUE) { m_bSingleColSelection = bSing;    }
+    BOOL GetSingleColSelection()                  { return m_bSingleColSelection;     }
+    void EnableSelection(BOOL bEnable = TRUE)     { ResetSelectedRange(); m_bEnableSelection = bEnable; ResetSelectedRange(); }
+    BOOL IsSelectable() const                     { return m_bEnableSelection;        }
+    void SetFixedColumnSelection(BOOL bSelect)    { m_bFixedColumnSelection = bSelect;}
+    BOOL GetFixedColumnSelection()                { return m_bFixedColumnSelection;   }
+    void SetFixedRowSelection(BOOL bSelect)       { m_bFixedRowSelection = bSelect;   }
+    BOOL GetFixedRowSelection()                   { return m_bFixedRowSelection;      }
+    void EnableDragAndDrop(BOOL bAllow = TRUE)    { m_bAllowDragAndDrop = bAllow;     }
+    BOOL GetDragAndDrop() const                   { return m_bAllowDragAndDrop;       }
+    void SetRowResize(BOOL bResize = TRUE)        { m_bAllowRowResize = bResize;      }
+    BOOL GetRowResize() const                     { return m_bAllowRowResize;         }
+    void SetColumnResize(BOOL bResize = TRUE)     { m_bAllowColumnResize = bResize;   }
+    BOOL GetColumnResize() const                  { return m_bAllowColumnResize;      }
+    void SetHeaderSort(BOOL bSortOnClick = TRUE)  { m_bSortOnClick = bSortOnClick;    }
+    BOOL GetHeaderSort() const                    { return m_bSortOnClick;            }
+    void SetHandleTabKey(BOOL bHandleTab = TRUE)  { m_bHandleTabKey = bHandleTab;     }
+    BOOL GetHandleTabKey() const                  { return m_bHandleTabKey;           }
+    void SetDoubleBuffering(BOOL bBuffer = TRUE)  { m_bDoubleBuffer = bBuffer;        }
+    BOOL GetDoubleBuffering() const               { return m_bDoubleBuffer;           }
+    void EnableTitleTips(BOOL bEnable = TRUE)     { m_bTitleTips = bEnable;           }
+    BOOL GetTitleTips()                           { return m_bTitleTips;              }
+    void SetSortColumn(int nCol);
+    int  GetSortColumn() const                    { return m_nSortColumn;             }
+    void SetSortAscending(BOOL bAscending)        { m_bAscending = bAscending;        }
+    BOOL GetSortAscending() const                 { return m_bAscending;              }
+    void SetTrackFocusCell(BOOL bTrack)           { m_bTrackFocusCell = bTrack;       }
+    BOOL GetTrackFocusCell()                      { return m_bTrackFocusCell;         }
+    void SetFrameFocusCell(BOOL bFrame)           { m_bFrameFocus = bFrame;           }
+    BOOL GetFrameFocusCell()                      { return m_bFrameFocus;             }
+    void SetAutoSizeStyle(int nStyle = GVS_BOTH)  { m_nAutoSizeColumnStyle = nStyle;  }
+    int  GetAutoSizeStyle()                       { return m_nAutoSizeColumnStyle; }
+
+    void EnableHiddenColUnhide(BOOL bEnable = TRUE){ m_bHiddenColUnhide = bEnable;    }
+    BOOL GetHiddenColUnhide()                     { return m_bHiddenColUnhide;        }
+    void EnableHiddenRowUnhide(BOOL bEnable = TRUE){ m_bHiddenRowUnhide = bEnable;    }
+    BOOL GetHiddenRowUnhide()                     { return m_bHiddenRowUnhide;        }
+
+    void EnableColumnHide(BOOL bEnable = TRUE)    { m_bAllowColHide = bEnable;        }
+    BOOL GetColumnHide()                          { return m_bAllowColHide;           }
+    void EnableRowHide(BOOL bEnable = TRUE)       { m_bAllowRowHide = bEnable;        }
+    BOOL GetRowHide()                             { return m_bAllowRowHide;           }
+
+///////////////////////////////////////////////////////////////////////////////////
+// default Grid cells. Use these for setting default values such as colors and fonts
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CGridCellBase* GetDefaultCell(BOOL bFixedRow, BOOL bFixedCol) const;
+
+///////////////////////////////////////////////////////////////////////////////////
+// Grid cell Attributes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CGridCellBase* GetCell(int nRow, int nCol) const;   // Get the actual cell!
+
+    void SetModified(BOOL bModified = TRUE, int nRow = -1, int nCol = -1);
+    BOOL GetModified(int nRow = -1, int nCol = -1);
+    BOOL IsCellFixed(int nRow, int nCol);
+
+    BOOL   SetItem(const GV_ITEM* pItem);
+    BOOL   GetItem(GV_ITEM* pItem);
+    BOOL   SetItemText(int nRow, int nCol, LPCTSTR str);
+    // The following was virtual. If you want to override, use 
+    //  CGridCellBase-derived class's GetText() to accomplish same thing
+    CString GetItemText(int nRow, int nCol) const;
+
+    // EFW - 06/13/99 - Added to support printf-style formatting codes.
+    // Also supports use with a string resource ID
+#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 210)
+    BOOL   SetItemTextFmt(int nRow, int nCol, LPCTSTR szFmt, ...);
+    BOOL   SetItemTextFmtID(int nRow, int nCol, UINT nID, ...);
+#endif
+
+    BOOL   SetItemData(int nRow, int nCol, LPARAM lParam);
+    LPARAM GetItemData(int nRow, int nCol) const;
+    BOOL   SetItemImage(int nRow, int nCol, int iImage);
+    int    GetItemImage(int nRow, int nCol) const;
+    BOOL   SetItemState(int nRow, int nCol, UINT state);
+    UINT   GetItemState(int nRow, int nCol) const;
+    BOOL   SetItemFormat(int nRow, int nCol, UINT nFormat);
+    UINT   GetItemFormat(int nRow, int nCol) const;
+    BOOL   SetItemBkColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
+    COLORREF GetItemBkColour(int nRow, int nCol) const;
+    BOOL   SetItemFgColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
+    COLORREF GetItemFgColour(int nRow, int nCol) const;
+    BOOL SetItemFont(int nRow, int nCol, const LOGFONT* lf);
+    const LOGFONT* GetItemFont(int nRow, int nCol);
+
+    BOOL IsItemEditing(int nRow, int nCol);
+
+    BOOL SetCellType(int nRow, int nCol, CRuntimeClass* pRuntimeClass);
+    BOOL SetDefaultCellType( CRuntimeClass* pRuntimeClass);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Operations
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    int  InsertColumn(LPCTSTR strHeading, UINT nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE,
+                      int nColumn = -1);
+    int  InsertRow(LPCTSTR strHeading, int nRow = -1);
+    BOOL DeleteColumn(int nColumn);
+    BOOL DeleteRow(int nRow);
+    BOOL DeleteNonFixedRows();
+    BOOL DeleteAllItems();
+
+	void ClearCells(CCellRange Selection);
+
+    BOOL AutoSizeRow(int nRow, BOOL bResetScroll = TRUE);
+    BOOL AutoSizeColumn(int nCol, UINT nAutoSizeStyle = GVS_DEFAULT, BOOL bResetScroll = TRUE);
+    void AutoSizeRows();
+    void AutoSizeColumns(UINT nAutoSizeStyle = GVS_DEFAULT);
+    void AutoSize(UINT nAutoSizeStyle = GVS_DEFAULT);
+    void ExpandColumnsToFit(BOOL bExpandFixed = TRUE);
+    void ExpandLastColumn();
+    void ExpandRowsToFit(BOOL bExpandFixed = TRUE);
+    void ExpandToFit(BOOL bExpandFixed = TRUE);
+
+    void Refresh();
+    void AutoFill();   // Fill grid with blank cells
+
+    void EnsureVisible(CCellID &cell)       { EnsureVisible(cell.row, cell.col); }
+    void EnsureVisible(int nRow, int nCol);
+    BOOL IsCellVisible(int nRow, int nCol);
+    BOOL IsCellVisible(CCellID cell);
+    BOOL IsCellEditable(int nRow, int nCol) const;
+    BOOL IsCellEditable(CCellID &cell) const;
+    BOOL IsCellSelected(int nRow, int nCol) const;
+    BOOL IsCellSelected(CCellID &cell) const;
+	
+
+    // SetRedraw stops/starts redraws on things like changing the # rows/columns
+    // and autosizing, but not for user-intervention such as resizes
+    void SetRedraw(BOOL bAllowDraw, BOOL bResetScrollBars = FALSE);
+    BOOL RedrawCell(int nRow, int nCol, CDC* pDC = NULL);
+    BOOL RedrawCell(const CCellID& cell, CDC* pDC = NULL);
+    BOOL RedrawRow(int row);
+    BOOL RedrawColumn(int col);
+
+#ifndef _WIN32_WCE
+    BOOL Save(LPCTSTR filename, TCHAR chSeparator = _T(','));
+    BOOL Load(LPCTSTR filename, TCHAR chSeparator = _T(','));
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////
+// Cell Ranges
+///////////////////////////////////////////////////////////////////////////////////
+ public:
+    CCellRange GetCellRange() const;
+    CCellRange GetSelectedCellRange() const;
+    void SetSelectedRange(const CCellRange& Range, BOOL bForceRepaint = FALSE, BOOL bSelectCells = TRUE);
+    void SetSelectedRange(int nMinRow, int nMinCol, int nMaxRow, int nMaxCol,
+                          BOOL bForceRepaint = FALSE, BOOL bSelectCells = TRUE);
+    BOOL IsValid(int nRow, int nCol) const;
+    BOOL IsValid(const CCellID& cell) const;
+    BOOL IsValid(const CCellRange& range) const;
+
+///////////////////////////////////////////////////////////////////////////////////
+// Clipboard, drag and drop, and cut n' paste operations
+///////////////////////////////////////////////////////////////////////////////////
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    virtual void CutSelectedText();
+    virtual COleDataSource* CopyTextFromGrid();
+    virtual BOOL PasteTextToGrid(CCellID cell, COleDataObject* pDataObject, BOOL bSelectPastedCells=TRUE);
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+ public:
+    virtual void OnBeginDrag();
+    virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    virtual void OnDragLeave();
+    virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+#endif
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    virtual void OnEditCut();
+    virtual void OnEditCopy();
+    virtual void OnEditPaste();
+#endif
+    virtual void OnEditSelectAll();
+
+///////////////////////////////////////////////////////////////////////////////////
+// Misc.
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CCellID GetNextItem(CCellID& cell, int nFlags) const;
+
+	BOOL SortItems(int nCol, BOOL bAscending, LPARAM data = 0);
+    BOOL SortTextItems(int nCol, BOOL bAscending, LPARAM data = 0);
+    BOOL SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data = 0);
+
+	void SetCompareFunction(PFNLVCOMPARE pfnCompare);
+
+	// in-built sort functions
+	static int CALLBACK pfnCellTextCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK pfnCellNumericCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Printing
+///////////////////////////////////////////////////////////////////////////////////
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+public:
+    void Print(CPrintDialog* pPrntDialog = NULL);
+
+    // EFW - New printing support functions
+    void EnableWysiwygPrinting(BOOL bEnable = TRUE) { m_bWysiwygPrinting = bEnable;     }
+    BOOL GetWysiwygPrinting()                       { return m_bWysiwygPrinting;        }
+
+    void SetShadedPrintOut(BOOL bEnable = TRUE)     {   m_bShadedPrintOut = bEnable;    }
+    BOOL GetShadedPrintOut(void)                    {   return m_bShadedPrintOut;       }
+
+    // Use -1 to have it keep the existing value
+    void SetPrintMarginInfo(int nHeaderHeight, int nFooterHeight,
+        int nLeftMargin, int nRightMargin, int nTopMargin,
+        int nBottomMargin, int nGap);
+
+    void GetPrintMarginInfo(int &nHeaderHeight, int &nFooterHeight,
+        int &nLeftMargin, int &nRightMargin, int &nTopMargin,
+        int &nBottomMargin, int &nGap);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Printing overrides for derived classes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    virtual void OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo);
+    virtual void OnPrint(CDC *pDC, CPrintInfo *pInfo);
+    virtual void OnEndPrinting(CDC *pDC, CPrintInfo *pInfo);
+
+#endif // #if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+
+// Implementation
+public:
+    virtual ~CGridCtrl();
+
+protected:
+    BOOL RegisterWindowClass();
+    BOOL Initialise();
+    void SetupDefaultCells();
+
+    LRESULT SendMessageToParent(int nRow, int nCol, int nMessage) const;
+    LRESULT SendDisplayRequestToParent(GV_DISPINFO* pDisplayInfo) const;
+    LRESULT SendCacheHintToParent(const CCellRange& range) const;
+
+    BOOL InvalidateCellRect(const int row, const int col);
+    BOOL InvalidateCellRect(const CCellID& cell);
+    BOOL InvalidateCellRect(const CCellRange& cellRange);
+    void EraseBkgnd(CDC* pDC);
+
+    BOOL GetCellRangeRect(const CCellRange& cellRange, LPRECT lpRect);
+
+    BOOL SetCell(int nRow, int nCol, CGridCellBase* pCell);
+
+    int  SetMouseMode(int nMode) { int nOldMode = m_MouseMode; m_MouseMode = nMode; return nOldMode; }
+    int  GetMouseMode() const    { return m_MouseMode; }
+
+    BOOL MouseOverRowResizeArea(CPoint& point);
+    BOOL MouseOverColumnResizeArea(CPoint& point);
+
+    CCellID GetTopleftNonFixedCell(BOOL bForceRecalculation = FALSE);
+    CCellRange GetUnobstructedNonFixedCellRange(BOOL bForceRecalculation = FALSE);
+	// LUC
+    CCellRange GetVisibleNonFixedCellRange(LPRECT pRect = NULL, BOOL bForceRecalculation = FALSE);
+    CCellRange GetVisibleFixedCellRange(LPRECT pRect = NULL, BOOL bForceRecalculation = FALSE);
+
+    BOOL IsVisibleVScroll() { return ( (m_nBarState & GVL_VERT) > 0); } 
+    BOOL IsVisibleHScroll() { return ( (m_nBarState & GVL_HORZ) > 0); }
+    void ResetSelectedRange();
+    void ResetScrollBars();
+    void EnableScrollBars(int nBar, BOOL bEnable = TRUE);
+    int  GetScrollPos32(int nBar, BOOL bGetTrackPos = FALSE);
+    BOOL SetScrollPos32(int nBar, int nPos, BOOL bRedraw = TRUE);
+
+    BOOL SortTextItems(int nCol, BOOL bAscending, int low, int high);
+    BOOL SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data,
+                   int low, int high);
+
+    CPoint GetPointClicked(int nRow, int nCol, const CPoint& point);
+
+	void ValidateAndModifyCellContents(int nRow, int nCol, LPCTSTR strText);
+
+// Overrrides
+    // ClassWizard generated virtual function overrides
+    //{{AFX_VIRTUAL(CGridCtrl)
+    protected:
+    virtual void PreSubclassWindow();
+    //}}AFX_VIRTUAL
+
+protected:
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+    // Printing
+	virtual void PrintFixedRowCells(int nStartColumn, int nStopColumn, int& row, CRect& rect,
+                                    CDC *pDC, BOOL& bFirst);
+    virtual void PrintColumnHeadings(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintHeader(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintFooter(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintRowButtons(CDC *pDC, CPrintInfo* /*pInfo*/);
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    // Drag n' drop
+    virtual CImageList* CreateDragImage(CPoint *pHotSpot);    // no longer necessary
+#endif
+
+    // Mouse Clicks
+    virtual void  OnFixedColumnClick(CCellID& cell);
+    virtual void  OnFixedRowClick(CCellID& cell);
+
+    // Editing
+    virtual void  OnEditCell(int nRow, int nCol, CPoint point, UINT nChar);
+    virtual void  OnEndEditCell(int nRow, int nCol, CString str);
+	virtual BOOL  ValidateEdit(int nRow, int nCol, LPCTSTR str);
+    virtual void  EndEditing();
+
+    // Drawing
+    virtual void  OnDraw(CDC* pDC);
+
+    // CGridCellBase Creation and Cleanup
+    virtual CGridCellBase* CreateCell(int nRow, int nCol);
+    virtual void DestroyCell(int nRow, int nCol);
+
+// Attributes
+protected:
+    // General attributes
+    COLORREF    m_crFixedTextColour, m_crFixedBkColour;
+    COLORREF    m_crGridBkColour, m_crGridLineColour;
+    COLORREF    m_crWindowText, m_crWindowColour, m_cr3DFace,     // System colours
+                m_crShadow;
+    COLORREF    m_crTTipBackClr, m_crTTipTextClr;                 // Titletip colours - FNA
+    
+    BOOL        m_bVirtualMode;
+    LPARAM      m_lParam;                                           // lParam for callback
+    GRIDCALLBACK m_pfnCallback;                                     // The callback function
+
+    int         m_nGridLines;
+    BOOL        m_bEditable;
+    BOOL        m_bModified;
+    BOOL        m_bAllowDragAndDrop;
+    BOOL        m_bListMode;
+    BOOL        m_bSingleRowSelection;
+    BOOL        m_bSingleColSelection;
+    BOOL        m_bAllowDraw;
+    BOOL        m_bEnableSelection;
+    BOOL        m_bFixedRowSelection, m_bFixedColumnSelection;
+    BOOL        m_bSortOnClick;
+    BOOL        m_bHandleTabKey;
+    BOOL        m_bDoubleBuffer;
+    BOOL        m_bTitleTips;
+    int         m_nBarState;
+    BOOL        m_bWysiwygPrinting;
+    BOOL        m_bHiddenColUnhide, m_bHiddenRowUnhide;
+    BOOL        m_bAllowColHide, m_bAllowRowHide;
+    BOOL        m_bAutoSizeSkipColHdr;
+    BOOL        m_bTrackFocusCell;
+    BOOL        m_bFrameFocus;
+    UINT        m_nAutoSizeColumnStyle;
+
+	// Cell enable
+	vector<vector<CELL_ENABLE>>	m_pCellEnable;
+
+    // Cell size details
+    int         m_nRows, m_nFixedRows, m_nCols, m_nFixedCols;
+	// LUC
+	int			m_nFreezedRows, m_nFreezedCols;
+	BOOL m_bExcludeFreezedRowsFromSelection;
+	BOOL m_bExcludeFreezedColsFromSelection;
+	
+	// LUC
+	CArray<CCellRange, CCellRange&> m_arMergedCells;
+	// LUC
+	BOOL m_bShowHorzNonGridArea;
+	
+    CUIntArray  m_arRowHeights, m_arColWidths;
+    int         m_nVScrollMax, m_nHScrollMax;
+
+    // Fonts and images
+    CRuntimeClass*   m_pRtcDefault; // determines kind of Grid Cell created by default
+    CGridDefaultCell m_cellDefault;  // "default" cell. Contains default colours, font etc.
+    CGridDefaultCell m_cellFixedColDef, m_cellFixedRowDef, m_cellFixedRowColDef;
+    CFont       m_PrinterFont;  // for the printer
+    CImageList* m_pImageList;
+
+    // Cell data
+    CTypedPtrArray<CObArray, GRID_ROW*> m_RowData;
+
+    // Mouse operations such as cell selection
+    int         m_MouseMode;
+    BOOL        m_bLMouseButtonDown, m_bRMouseButtonDown;
+    CPoint      m_LeftClickDownPoint, m_LastMousePoint;
+    CCellID     m_LeftClickDownCell, m_SelectionStartCell;
+    CCellID     m_idCurrentCell, m_idTopLeftCell;
+    INT_PTR     m_nTimerID;
+    int         m_nTimerInterval;
+    int         m_nResizeCaptureRange;
+    BOOL        m_bAllowRowResize, m_bAllowColumnResize;
+    int         m_nRowsPerWheelNotch;
+    CMap<DWORD,DWORD, CCellID, CCellID&> m_SelectedCellMap, m_PrevSelectedCellMap;
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+    CTitleTip   m_TitleTip;             // Title tips for cells
+#endif
+
+    // Drag and drop
+    CCellID     m_LastDragOverCell;
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    CGridDropTarget m_DropTarget;       // OLE Drop target for the grid
+#endif
+
+    // Printing information
+    CSize       m_CharSize;
+    int         m_nPageHeight;
+    CSize       m_LogicalPageSize,      // Page size in gridctrl units.
+                m_PaperSize;            // Page size in device units.
+    // additional properties to support Wysiwyg printing
+    int         m_nPageWidth;
+    int         m_nPrintColumn;
+    int         m_nCurrPrintRow;
+    int         m_nNumPages;
+    int         m_nPageMultiplier;
+
+    // sorting
+    int          m_bAscending;
+    int          m_nSortColumn;
+	PFNLVCOMPARE m_pfnCompare;
+
+    // EFW - Added to support shaded/unshaded printout.  If true, colored
+    // cells will print as-is.  If false, all text prints as black on white.
+    BOOL        m_bShadedPrintOut;
+
+    // EFW - Added support for user-definable margins.  Top and bottom are in 
+    // lines.  Left, right, and gap are in characters (avg width is used).
+    int         m_nHeaderHeight, m_nFooterHeight, m_nLeftMargin,
+                m_nRightMargin, m_nTopMargin, m_nBottomMargin, m_nGap;
+
+protected:
+    void SelectAllCells();
+    void SelectColumns(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void SelectRows(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void SelectCells(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void OnSelecting(const CCellID& currentCell);
+
+    // Generated message map functions
+    //{{AFX_MSG(CGridCtrl)
+    afx_msg void OnPaint();
+    afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+    afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+    afx_msg void OnSize(UINT nType, int cx, int cy);
+    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+    afx_msg void OnTimer(UINT_PTR nIDEvent);
+    afx_msg UINT OnGetDlgCode();
+    afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+    afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnUpdateEditSelectAll(CCmdUI* pCmdUI);
+    //}}AFX_MSG
+#ifndef _WIN32_WCE_NO_CURSOR
+    afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+#endif
+#ifndef _WIN32_WCE
+    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+    afx_msg void OnRButtonUp(UINT nFlags, CPoint point);    // EFW - Added
+    afx_msg void OnSysColorChange();
+#endif
+#ifndef _WIN32_WCE_NO_CURSOR
+    afx_msg void OnCaptureChanged(CWnd *pWnd);
+#endif
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
+    afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
+    afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
+#endif
+#if (_MFC_VER >= 0x0421) || (_WIN32_WCE >= 210)
+    afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
+#endif
+#if !defined(_WIN32_WCE) && (_MFC_VER >= 0x0421)
+    afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+#endif
+    afx_msg LRESULT OnSetFont(WPARAM hFont, LPARAM lParam);
+    afx_msg LRESULT OnGetFont(WPARAM hFont, LPARAM lParam);
+    afx_msg LRESULT OnImeChar(WPARAM wCharCode, LPARAM lParam);
+    afx_msg void OnEndInPlaceEdit(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnComboSelChange(NMHDR* pNMHDR, LRESULT* pResult);
+    DECLARE_MESSAGE_MAP()
+
+    enum eMouseModes { MOUSE_NOTHING, MOUSE_SELECT_ALL, MOUSE_SELECT_COL, MOUSE_SELECT_ROW,
+                       MOUSE_SELECT_CELLS, MOUSE_SCROLLING_CELLS,
+                       MOUSE_OVER_ROW_DIVIDE, MOUSE_SIZING_ROW,
+                       MOUSE_OVER_COL_DIVIDE, MOUSE_SIZING_COL,
+                       MOUSE_PREPARE_EDIT,
+#ifndef GRIDCONTROL_NO_DRAGDROP
+                       MOUSE_PREPARE_DRAG, MOUSE_DRAGGING
+#endif
+    };
+//      for sort in virtual mode, and column order, save and load layer
+public:
+	typedef std::vector<int> intlist;
+	void Reorder(int From, int To);
+	void SetVirtualCompare(PVIRTUALCOMPARE VirtualCompare) { m_pfnVirtualCompare = VirtualCompare;}
+	int m_CurCol;
+	void AllowReorderColumn(bool b=true) { m_AllowReorderColumn = b;}
+	void EnableDragRowMode(bool b=true) { m_bDragRowMode = b; if(b) EnableDragAndDrop(); } // to change row order
+	int GetLayer(int** pLayer); //  gives back the number of ints of the area (do not forget to delete *pLayer)
+	void SetLayer(int* pLayer); // coming from a previous GetLayer (ignored if not same number of column, or the same revision number)
+	void ForceQuitFocusOnTab(bool b=true) { m_QuitFocusOnTab = b;} // use only if GetParent() is a CDialog
+	void AllowSelectRowInFixedCol(bool b=true) { m_AllowSelectRowInFixedCol = b;} // 
+//    allow acces?
+	intlist m_arRowOrder, m_arColOrder;
+	static CGridCtrl* m_This;
+protected:
+	virtual void AddSubVirtualRow(int Num, int Nb);
+	bool m_bDragRowMode;
+	int m_CurRow;
+private:
+	void ResetVirtualOrder();
+	PVIRTUALCOMPARE m_pfnVirtualCompare;
+	static bool NotVirtualCompare(int c1, int c2);
+	bool m_InDestructor;
+	bool m_AllowReorderColumn;
+	bool m_QuitFocusOnTab;
+	bool m_AllowSelectRowInFixedCol;
+
+};
+
+// Returns the default cell implementation for the given grid region
+inline CGridCellBase* CGridCtrl::GetDefaultCell(BOOL bFixedRow, BOOL bFixedCol) const
+{ 
+    if (bFixedRow && bFixedCol) return (CGridCellBase*) &m_cellFixedRowColDef;
+    if (bFixedRow)              return (CGridCellBase*) &m_cellFixedRowDef;
+    if (bFixedCol)              return (CGridCellBase*) &m_cellFixedColDef;
+    return (CGridCellBase*) &m_cellDefault;
+}
+
+inline CGridCellBase* CGridCtrl::GetCell(int nRow, int nCol) const
+{
+	if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols) 
+        return NULL;
+	
+    if (GetVirtualMode())
+    {
+        CGridCellBase* pCell = GetDefaultCell(nRow < m_nFixedRows, nCol < m_nFixedCols);
+        static GV_DISPINFO gvdi;
+        gvdi.item.row     = nRow;
+        gvdi.item.col     = nCol;
+        gvdi.item.mask    = 0xFFFFFFFF;
+        gvdi.item.nState  = 0;
+        gvdi.item.nFormat = pCell->GetFormat();
+        gvdi.item.iImage  = pCell->GetImage();
+        gvdi.item.crBkClr = pCell->GetBackClr();
+        gvdi.item.crFgClr = pCell->GetTextClr();
+        gvdi.item.lParam  = pCell->GetData();
+        memcpy(&gvdi.item.lfFont, pCell->GetFont(), sizeof(LOGFONT));
+        gvdi.item.nMargin = pCell->GetMargin();
+        gvdi.item.strText.Empty();
+
+        // Fix the state bits
+        if (IsCellSelected(nRow, nCol))   gvdi.item.nState |= GVIS_SELECTED;
+        if (nRow < GetFixedRowCount())    gvdi.item.nState |= (GVIS_FIXED | GVIS_FIXEDROW);
+        if (nCol < GetFixedColumnCount()) gvdi.item.nState |= (GVIS_FIXED | GVIS_FIXEDCOL);
+        if (GetFocusCell() == CCellID(nRow, nCol)) gvdi.item.nState |= GVIS_FOCUSED;
+		if(!m_InDestructor)
+		{
+			gvdi.item.row = m_arRowOrder[nRow];
+			gvdi.item.col = m_arColOrder[nCol];
+
+			if (m_pfnCallback)
+				m_pfnCallback(&gvdi, m_lParam);
+			else
+				SendDisplayRequestToParent(&gvdi);
+			gvdi.item.row = nRow;        
+			gvdi.item.col = nCol;
+		}
+        static CGridCell cell;
+        cell.SetState(gvdi.item.nState);
+        cell.SetFormat(gvdi.item.nFormat);
+        cell.SetImage(gvdi.item.iImage);
+        cell.SetBackClr(gvdi.item.crBkClr);
+        cell.SetTextClr(gvdi.item.crFgClr);
+        cell.SetData(gvdi.item.lParam);
+        cell.SetFont(&(gvdi.item.lfFont));
+        cell.SetMargin(gvdi.item.nMargin);
+        cell.SetText(gvdi.item.strText);
+        cell.SetGrid((CGridCtrl*)this);
+
+        return (CGridCellBase*) &cell;
+    }
+
+    GRID_ROW* pRow = m_RowData[nRow];
+    if (!pRow) return NULL;
+	if(pRow->GetData() == NULL)
+		return NULL;
+    return pRow->GetAt(m_arColOrder[nCol]);
+}
+
+inline BOOL CGridCtrl::SetCell(int nRow, int nCol, CGridCellBase* pCell)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols) 
+        return FALSE;
+
+    GRID_ROW* pRow = m_RowData[nRow];
+    if (!pRow) return FALSE;
+
+    pCell->SetCoords( nRow, nCol); 
+    pRow->SetAt(nCol, pCell);
+
+    return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/GridDropTarget.cpp b/Common_Class/SISControls/GridControl/GridDropTarget.cpp
new file mode 100644
index 0000000..d135bf2
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridDropTarget.cpp
@@ -0,0 +1,156 @@
+// GridDropTarget.cpp : implementation file
+//
+// MFC Grid Control - Drag/Drop target implementation
+//
+// CGridDropTarget is an OLE drop target for CGridCtrl. All it does
+// is handle the drag and drop windows messages and pass them
+// directly onto the grid control.
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "..\\stdafx.h"
+#include "GridCtrl.h"
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+#include "GridDropTarget.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridDropTarget
+
+CGridDropTarget::CGridDropTarget()
+{
+    m_pGridCtrl = NULL;
+    m_bRegistered = FALSE;
+}
+
+CGridDropTarget::~CGridDropTarget()
+{
+}
+
+// Overloaded Register() function performs the normal COleDropTarget::Register
+// but also serves to connect this COleDropTarget with the parent grid control,
+// where all drop messages will ultimately be forwarded.
+BOOL CGridDropTarget::Register(CGridCtrl *pGridCtrl)
+{
+    if (m_bRegistered)
+        return FALSE;
+
+    // Stop re-entry problems
+    static BOOL bInProcedure = FALSE;
+    if (bInProcedure)
+        return FALSE;
+    bInProcedure = TRUE;
+
+//    ASSERT(pGridCtrl->IsKindOf(RUNTIME_CLASS(CGridCtrl)));
+//    ASSERT(pGridCtrl);
+
+    if (!pGridCtrl || !pGridCtrl->IsKindOf(RUNTIME_CLASS(CGridCtrl)))
+    {
+        bInProcedure = FALSE;
+        return FALSE;
+    }
+
+    m_pGridCtrl = pGridCtrl;
+
+    m_bRegistered = COleDropTarget::Register(pGridCtrl);
+
+    bInProcedure = FALSE;
+    return m_bRegistered;
+}
+
+void CGridDropTarget::Revoke()
+{
+    m_bRegistered = FALSE;
+    COleDropTarget::Revoke();
+}
+
+BEGIN_MESSAGE_MAP(CGridDropTarget, COleDropTarget)
+    //{{AFX_MSG_MAP(CGridDropTarget)
+    //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridDropTarget message handlers
+
+DROPEFFECT CGridDropTarget::OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint /*point*/)
+{
+//    TRACE("In CGridDropTarget::OnDragScroll\n");
+    if (pWnd->GetSafeHwnd() == m_pGridCtrl->GetSafeHwnd())
+    {
+        if (dwKeyState & MK_CONTROL)
+            return DROPEFFECT_COPY;
+        else
+            return DROPEFFECT_MOVE;
+    } else
+        return DROPEFFECT_NONE;
+}
+
+DROPEFFECT CGridDropTarget::OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, 
+                                        DWORD dwKeyState, CPoint point)
+{
+//    TRACE(_T("In CGridDropTarget::OnDragEnter\n"));
+//    ASSERT(m_pGridCtrl);
+
+    if (pWnd->GetSafeHwnd() == m_pGridCtrl->GetSafeHwnd())
+        return m_pGridCtrl->OnDragEnter(pDataObject, dwKeyState, point);
+    else
+        return DROPEFFECT_NONE;
+}
+
+void CGridDropTarget::OnDragLeave(CWnd* pWnd)
+{
+//    TRACE(_T("In CGridDropTarget::OnDragLeave\n"));
+//    ASSERT(m_pGridCtrl);
+
+    if (pWnd->GetSafeHwnd() == m_pGridCtrl->GetSafeHwnd())
+        m_pGridCtrl->OnDragLeave();
+}
+
+DROPEFFECT CGridDropTarget::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, 
+                                       DWORD dwKeyState, CPoint point)
+{
+///    TRACE("In CGridDropTarget::OnDragOver\n");
+//    ASSERT(m_pGridCtrl);
+
+    if (pWnd->GetSafeHwnd() == m_pGridCtrl->GetSafeHwnd())
+        return m_pGridCtrl->OnDragOver(pDataObject, dwKeyState, point);
+    else
+        return DROPEFFECT_NONE;
+}
+
+BOOL CGridDropTarget::OnDrop(CWnd* pWnd, COleDataObject* pDataObject,
+                             DROPEFFECT dropEffect, CPoint point)
+{
+//    TRACE(_T("In CGridDropTarget::OnDrop\n"));
+//    ASSERT(m_pGridCtrl);
+
+    if (pWnd->GetSafeHwnd() == m_pGridCtrl->GetSafeHwnd())
+        return m_pGridCtrl->OnDrop(pDataObject, dropEffect, point);
+    else
+        return FALSE;
+}
+
+#endif // GRIDCONTROL_NO_DRAGDROP
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/GridDropTarget.h b/Common_Class/SISControls/GridControl/GridDropTarget.h
new file mode 100644
index 0000000..1fe5887
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridDropTarget.h
@@ -0,0 +1,82 @@
+//////////////////////////////////////////////////////////////////////
+// GridDropTarget.h : header file
+//
+// MFC Grid Control - Drag/Drop target implementation
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_)
+#define AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+
+#include <afxole.h>
+
+class CGridCtrl;
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridDropTarget command target
+
+class AFX_EXT_CLASS CGridDropTarget : public COleDropTarget
+{
+public:
+    CGridDropTarget();
+    virtual ~CGridDropTarget();
+
+// Attributes
+public:
+    CGridCtrl* m_pGridCtrl;
+    BOOL       m_bRegistered;
+
+// Operations
+public:
+    BOOL Register(CGridCtrl *pGridCtrl);
+    virtual void Revoke();
+
+    BOOL        OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+    DROPEFFECT  OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    void        OnDragLeave(CWnd* pWnd);
+    DROPEFFECT  OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    DROPEFFECT  OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point);
+
+// Overrides
+    // ClassWizard generated virtual function overrides
+    //{{AFX_VIRTUAL(CGridDropTarget)
+    //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+    // Generated message map functions
+    //{{AFX_MSG(CGridDropTarget)
+    //}}AFX_MSG
+
+    DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/GridInPlaceEdit.cpp b/Common_Class/SISControls/GridControl/GridInPlaceEdit.cpp
new file mode 100644
index 0000000..a01a1a9
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridInPlaceEdit.cpp
@@ -0,0 +1,263 @@
+// InPlaceEdit.cpp : implementation file
+//
+// Adapted by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2002. All Rights Reserved.
+//
+// The code contained in this file is based on the original
+// CGridInPlaceEdit from http://www.codeguru.com/listview/edit_subitems.shtml
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+// History:
+//         10 May 1998  Uses GVN_ notifications instead of LVN_,
+//                      Sends notification messages to the parent, 
+//                      instead of the parent's parent.
+//         15 May 1998  There was a problem when editing with the in-place editor, 
+//                      there arises a general protection fault in user.exe, with a 
+//                      few qualifications:
+//                         (1) This only happens with owner-drawn buttons;
+//                         (2) This only happens in Win95
+//                         (3) This only happens if the handler for the button does not 
+//                             create a new window (even an AfxMessageBox will avoid the 
+//                             crash)
+//                         (4) This will not happen if Spy++ is running.
+//                      PreTranslateMessage was added to route messages correctly.
+//                      (Matt Weagle found and fixed this problem)
+//         26 Jul 1998  Removed the ES_MULTILINE style - that fixed a few probs!
+//          6 Aug 1998  Added nID to the constructor param list
+//          6 Sep 1998  Space no longer clears selection when starting edit (Franco Bez)
+//         10 Apr 1999  Enter, Tab and Esc key prob fixed (Koay Kah Hoe)
+//                      Workaround for bizzare "shrinking window" problem in CE
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "..\\stdafx.h"
+#include "TCHAR.h"
+#include "GridInPlaceEdit.h"
+
+#include "GridCtrl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridInPlaceEdit
+
+CGridInPlaceEdit::CGridInPlaceEdit(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
+                           int nRow, int nColumn, CString sInitText, 
+                           UINT nFirstChar)
+{
+    m_sInitText     = sInitText;
+    m_nRow          = nRow;
+    m_nColumn       = nColumn;
+    m_nLastChar     = 0; 
+    m_bExitOnArrows = (nFirstChar != VK_LBUTTON);    // If mouse click brought us here,
+                                                     // then no exit on arrows
+
+    m_Rect = rect;  // For bizarre CE bug.
+    
+    DWORD dwEditStyle = WS_BORDER|WS_CHILD|WS_VISIBLE| ES_AUTOHSCROLL //|ES_MULTILINE
+        | dwStyle;
+    if (!Create(dwEditStyle, rect, pParent, nID)) return;
+    
+    SetFont(pParent->GetFont());
+    
+    SetWindowText(sInitText);
+    SetFocus();
+    
+    switch (nFirstChar){
+        case VK_LBUTTON: 
+        case VK_RETURN:   SetSel((int)_tcslen(m_sInitText), -1); return;
+        case VK_BACK:     SetSel((int)_tcslen(m_sInitText), -1); break;
+        case VK_TAB:
+        case VK_DOWN: 
+        case VK_UP:   
+        case VK_RIGHT:
+        case VK_LEFT:  
+        case VK_NEXT:  
+        case VK_PRIOR: 
+        case VK_HOME:
+        case VK_SPACE:
+        case VK_END:      SetSel(0,-1); return;
+        default:          SetSel(0,-1);
+    }
+
+    // Added by KiteFly. When entering DBCS chars into cells the first char was being lost
+    // SenMessage changed to PostMessage (John Lagerquist)
+    if( nFirstChar < 0x80)
+        PostMessage(WM_CHAR, nFirstChar);   
+    else
+        PostMessage(WM_IME_CHAR, nFirstChar);
+}
+
+CGridInPlaceEdit::~CGridInPlaceEdit()
+{
+}
+
+BEGIN_MESSAGE_MAP(CGridInPlaceEdit, CEdit)
+    //{{AFX_MSG_MAP(CGridInPlaceEdit)
+    ON_WM_KILLFOCUS()
+    ON_WM_CHAR()
+    ON_WM_KEYDOWN()
+    ON_WM_GETDLGCODE()
+    ON_WM_CREATE()
+    //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+////////////////////////////////////////////////////////////////////////////
+// CGridInPlaceEdit message handlers
+
+// If an arrow key (or associated) is pressed, then exit if
+//  a) The Ctrl key was down, or
+//  b) m_bExitOnArrows == TRUE
+void CGridInPlaceEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+    if ((nChar == VK_PRIOR || nChar == VK_NEXT ||
+        nChar == VK_DOWN  || nChar == VK_UP   ||
+        nChar == VK_RIGHT || nChar == VK_LEFT) &&
+        (m_bExitOnArrows || GetKeyState(VK_CONTROL) < 0))
+    {
+        m_nLastChar = nChar;
+        GetParent()->SetFocus();
+        return;
+    }
+    
+    CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+// As soon as this edit loses focus, kill it.
+void CGridInPlaceEdit::OnKillFocus(CWnd* pNewWnd)
+{
+    CEdit::OnKillFocus(pNewWnd);
+    EndEdit();
+}
+
+void CGridInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+    if (nChar == VK_TAB || nChar == VK_RETURN)
+    {
+        m_nLastChar = nChar;
+        GetParent()->SetFocus();    // This will destroy this window
+        return;
+    }
+    if (nChar == VK_ESCAPE) 
+    {
+        SetWindowText(m_sInitText);    // restore previous text
+        m_nLastChar = nChar;
+        GetParent()->SetFocus();
+        return;
+    }
+    
+    CEdit::OnChar(nChar, nRepCnt, nFlags);
+    
+    // Resize edit control if needed
+    
+    // Get text extent
+    CString str;
+    GetWindowText( str );
+
+    // add some extra buffer
+    str += _T("  ");
+    
+    CWindowDC dc(this);
+    CFont *pFontDC = dc.SelectObject(GetFont());
+    CSize size = dc.GetTextExtent( str );
+    dc.SelectObject( pFontDC );
+       
+    // Get client rect
+    CRect ParentRect;
+    GetParent()->GetClientRect( &ParentRect );
+    
+    // Check whether control needs to be resized
+    // and whether there is space to grow
+    if (size.cx > m_Rect.Width())
+    {
+        if( size.cx + m_Rect.left < ParentRect.right )
+            m_Rect.right = m_Rect.left + size.cx;
+        else
+            m_Rect.right = ParentRect.right;
+        MoveWindow( &m_Rect );
+    }
+}
+
+UINT CGridInPlaceEdit::OnGetDlgCode() 
+{
+    return DLGC_WANTALLKEYS;
+}
+
+////////////////////////////////////////////////////////////////////////////
+// CGridInPlaceEdit overrides
+
+// Stoopid win95 accelerator key problem workaround - Matt Weagle.
+BOOL CGridInPlaceEdit::PreTranslateMessage(MSG* pMsg) 
+{
+    // Catch the Alt key so we don't choke if focus is going to an owner drawn button
+    if (pMsg->message == WM_SYSCHAR)
+        return TRUE;
+    
+    return CWnd::PreTranslateMessage(pMsg);
+}
+
+// Auto delete
+void CGridInPlaceEdit::PostNcDestroy() 
+{
+    CEdit::PostNcDestroy();
+    
+    delete this;	
+}
+
+////////////////////////////////////////////////////////////////////////////
+// CGridInPlaceEdit implementation
+
+void CGridInPlaceEdit::EndEdit()
+{
+    CString str;
+
+    // EFW - BUG FIX - Clicking on a grid scroll bar in a derived class
+    // that validates input can cause this to get called multiple times
+    // causing assertions because the edit control goes away the first time.
+    static BOOL bAlreadyEnding = FALSE;
+
+    if(bAlreadyEnding)
+        return;
+
+    bAlreadyEnding = TRUE;
+    GetWindowText(str);
+
+    // Send Notification to parent
+    GV_DISPINFO dispinfo;
+
+    dispinfo.hdr.hwndFrom = GetSafeHwnd();
+    dispinfo.hdr.idFrom   = GetDlgCtrlID();
+    dispinfo.hdr.code     = GVN_ENDLABELEDIT;
+
+    dispinfo.item.mask    = LVIF_TEXT|LVIF_PARAM;
+    dispinfo.item.row     = m_nRow;
+    dispinfo.item.col     = m_nColumn;
+    dispinfo.item.strText  = str;
+    dispinfo.item.lParam  = (LPARAM) m_nLastChar;
+
+    CWnd* pOwner = GetOwner();
+    if (pOwner)
+        pOwner->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo );
+
+    // Close this window (PostNcDestroy will delete this)
+    if (IsWindow(GetSafeHwnd()))
+        SendMessage(WM_CLOSE, 0, 0);
+    bAlreadyEnding = FALSE;
+}
diff --git a/Common_Class/SISControls/GridControl/GridInPlaceEdit.h b/Common_Class/SISControls/GridControl/GridInPlaceEdit.h
new file mode 100644
index 0000000..b26b207
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridInPlaceEdit.h
@@ -0,0 +1,83 @@
+//////////////////////////////////////////////////////////////////////
+// InPlaceEdit.h : header file
+//
+// MFC Grid Control - inplace editing class
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridInPlaceEdit : public CEdit
+{
+// Construction
+public:
+    CGridInPlaceEdit(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
+                 int nRow, int nColumn, CString sInitText, UINT nFirstChar);
+
+// Attributes
+public:
+ 
+// Operations
+public:
+     void EndEdit();
+ 
+// Overrides
+     // ClassWizard generated virtual function overrides
+     //{{AFX_VIRTUAL(CGridInPlaceEdit)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+ 
+// Implementation
+public:
+     virtual ~CGridInPlaceEdit();
+ 
+// Generated message map functions
+protected:
+    //{{AFX_MSG(CGridInPlaceEdit)
+    afx_msg void OnKillFocus(CWnd* pNewWnd);
+    afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg UINT OnGetDlgCode();
+	//}}AFX_MSG
+    DECLARE_MESSAGE_MAP()
+
+private:
+    int     m_nRow;
+    int     m_nColumn;
+    CString m_sInitText;
+    UINT    m_nLastChar;
+    BOOL    m_bExitOnArrows;
+    CRect   m_Rect;
+};
+ 
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/GridMemDC.h b/Common_Class/SISControls/GridControl/GridMemDC.h
new file mode 100644
index 0000000..f0f4894
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/GridMemDC.h
@@ -0,0 +1,106 @@
+#if !defined(AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// MemDC.h : header file
+//
+
+//////////////////////////////////////////////////
+// CGridMemDC - memory DC
+//
+// Author: Keith Rule
+// Email:  keithr@europa.com
+// Copyright 1996-1997, Keith Rule
+//
+// You may freely use or modify this code provided this
+// Copyright is included in all derived versions.
+//
+// History - 10/3/97 Fixed scrolling bug.
+//                   Added print support.
+//           25 feb 98 - fixed minor assertion bug
+//
+// This class implements a memory Device Context
+
+class CGridMemDC : public CDC
+{
+public:
+
+    // constructor sets up the memory DC
+    CGridMemDC(CDC* pDC) : CDC()
+    {
+//        ASSERT(pDC != NULL);
+
+        m_pDC = pDC;
+        m_pOldBitmap = NULL;
+#ifndef _WIN32_WCE_NO_PRINTING
+        m_bMemDC = !pDC->IsPrinting();
+#else
+        m_bMemDC = FALSE;
+#endif
+
+        if (m_bMemDC)    // Create a Memory DC
+        {
+            pDC->GetClipBox(&m_rect);
+            CreateCompatibleDC(pDC);
+            m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+            m_pOldBitmap = SelectObject(&m_bitmap);
+#ifndef _WIN32_WCE
+            SetWindowOrg(m_rect.left, m_rect.top);
+#endif
+            // EFW - Bug fix - Fill background in case the user has overridden
+            // WM_ERASEBKGND.  We end up with garbage otherwise.
+            // CJM - moved to fix a bug in the fix.
+            FillSolidRect(m_rect, pDC->GetBkColor());
+        }
+        else        // Make a copy of the relevent parts of the current DC for printing
+        {
+#if !defined(_WIN32_WCE) || ((_WIN32_WCE > 201) && !defined(_WIN32_WCE_NO_PRINTING))
+            m_bPrinting = pDC->m_bPrinting;
+#endif
+            m_hDC       = pDC->m_hDC;
+            m_hAttribDC = pDC->m_hAttribDC;
+        }
+
+    }
+
+    // Destructor copies the contents of the mem DC to the original DC
+    ~CGridMemDC()
+    {
+        if (m_bMemDC)
+        {
+            // Copy the offscreen bitmap onto the screen.
+            m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+                          this, m_rect.left, m_rect.top, SRCCOPY);
+
+            //Swap back the original bitmap.
+            SelectObject(m_pOldBitmap);
+        } else {
+            // All we need to do is replace the DC with an illegal value,
+            // this keeps us from accidently deleting the handles associated with
+            // the CDC that was passed to the constructor.
+            m_hDC = m_hAttribDC = NULL;
+        }
+    }
+
+    // Allow usage as a pointer
+    CGridMemDC* operator->() {return this;}
+        
+    // Allow usage as a pointer
+    operator CGridMemDC*() {return this;}
+
+private:
+    CBitmap  m_bitmap;      // Offscreen bitmap
+    CBitmap* m_pOldBitmap;  // bitmap originally found in CGridMemDC
+    CDC*     m_pDC;         // Saves CDC passed in constructor
+    CRect    m_rect;        // Rectangle of drawing area.
+    BOOL     m_bMemDC;      // TRUE if CDC really is a Memory DC.
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.cpp b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.cpp
new file mode 100644
index 0000000..8fc43de
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.cpp
@@ -0,0 +1,186 @@
+// GridCellCheck.cpp : implementation file
+//
+// MFC Grid Control - Main grid cell class
+//
+// Provides the implementation for a combobox cell type of the
+// grid control.
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// Parts of the code contained in this file are based on the original
+// CInPlaceList from http://www.codeguru.com/listview
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+// History:
+// 23 Jul 2001 - Complete rewrite
+// 13 Mar 2004 - GetCellExtent and GetCheckPlacement fixed by Yogurt
+//             - Read-only now honoured - Yogurt
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "..\\..\\stdafx.h"
+#include "..\\GridCell.h"
+#include "..\\GridCtrl.h"
+
+#include "GridCellCheck.h"
+
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+IMPLEMENT_DYNCREATE(CGridCellCheck, CGridCell)
+
+CGridCellCheck::CGridCellCheck() : CGridCell()
+{
+    m_bChecked = FALSE;
+    //m_Rect.IsRectNull();
+}
+
+CSize CGridCellCheck::GetCellExtent(CDC* pDC)
+{
+    // Using SM_CXHSCROLL as a guide to the size of the checkbox
+    int nWidth = GetSystemMetrics(SM_CXHSCROLL) + 2*GetMargin();	
+    CSize	cellSize = CGridCell::GetCellExtent(pDC);	
+    cellSize.cx += nWidth;	
+    cellSize.cy = max (cellSize.cy, nWidth);	
+    return  cellSize;
+}
+
+// i/o:  i=dims of cell rect; o=dims of text rect
+BOOL CGridCellCheck::GetTextRect( LPRECT pRect)
+{
+    BOOL bResult = CGridCell::GetTextRect(pRect);
+    if (bResult)
+    {
+        int nWidth = GetSystemMetrics(SM_CXHSCROLL) + 2*GetMargin();
+        pRect->left += nWidth;
+        if (pRect->left > pRect->right)
+            pRect->left = pRect->right;
+    }
+    return bResult;
+}
+
+// Override draw so that when the cell is selected, a drop arrow is shown in the RHS.
+BOOL CGridCellCheck::Draw(CDC* pDC, int nRow, int nCol, CRect rect,  BOOL bEraseBkgnd /*=TRUE*/)
+{
+    BOOL bResult = CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);
+
+#ifndef _WIN32_WCE
+    // Store the cell's dimensions for later
+    m_Rect = rect;
+
+    CRect CheckRect = GetCheckPlacement();
+    rect.left = CheckRect.right;
+
+    // enough room to draw?
+    // if (CheckRect.Width() < rect.Width() && CheckRect.Height() < rect.Height()) {
+
+    // Do the draw 
+    pDC->DrawFrameControl(GetCheckPlacement(), DFC_BUTTON, 
+	    (m_bChecked)? DFCS_BUTTONCHECK | DFCS_CHECKED : DFCS_BUTTONCHECK);
+
+    // }
+#endif
+    return bResult;
+}
+
+void CGridCellCheck::OnClick(CPoint PointCellRelative)
+{
+	// PointCellRelative is relative to the topleft of the cell. Convert to client coords
+	PointCellRelative += m_Rect.TopLeft();
+
+    // Bail if cell is read-only
+    CCellID cell = GetGrid()->GetCellFromPt(PointCellRelative);	
+	if (GetGrid()->isCellMaskActivated(cell.row, cell.col))
+	{
+		if (!GetGrid()->isCellMaskEditable(cell.row, cell.col))
+		{
+			return;
+		}
+	}
+	else
+	{
+		if (!GetGrid()->IsCellEditable(cell))		
+			return;
+	}
+    
+	// GetCheckPlacement returns the checkbox dimensions in client coords. Only check/
+	// uncheck if the user clicked in the box
+	if (GetCheckPlacement().PtInRect(PointCellRelative))
+	{
+		m_bChecked = !m_bChecked;
+		GetGrid()->InvalidateRect(m_Rect);
+	}
+}
+
+//////////////////////////////////////////////////////////////////////
+// Operations
+//////////////////////////////////////////////////////////////////////
+
+BOOL CGridCellCheck::SetCheck(BOOL bChecked /*=TRUE*/)
+{
+	BOOL bTemp = m_bChecked;
+	m_bChecked = bChecked;
+	if (!m_Rect.IsRectEmpty())
+		GetGrid()->InvalidateRect(m_Rect);
+
+	return bTemp;
+}
+
+BOOL CGridCellCheck::GetCheck()
+{
+	return m_bChecked;
+}
+
+//////////////////////////////////////////////////////////////////////
+// Protected implementation
+//////////////////////////////////////////////////////////////////////
+
+// Returns the dimensions and placement of the checkbox in client coords.
+CRect CGridCellCheck::GetCheckPlacement()
+{
+	int nWidth = GetSystemMetrics(SM_CXHSCROLL);
+	CRect place = m_Rect + CSize(GetMargin(), GetMargin());
+    place.right = place.left + nWidth;
+    place.bottom = place.top + nWidth;
+
+	/* for centering
+	int nDiff = (place.Width() - nWidth)/2;
+	if (nDiff > 0)
+	{
+		place.left += nDiff;
+		place.right = place.left + nWidth;
+	}
+	nDiff = (place.Height() - nWidth)/2;
+	if (nDiff > 0)
+	{
+		place.top += nDiff;
+		place.bottom = place.top + nWidth;
+	}
+    */
+
+    if (m_Rect.Height() < nWidth + 2 * static_cast<int> (GetMargin())) 
+    {		
+        place.top = m_Rect.top + (m_Rect.Height() - nWidth) / 2;	    
+        place.bottom = place.top + nWidth;	
+    }
+
+	return place;
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.h b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.h
new file mode 100644
index 0000000..049cb44
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCheck.h
@@ -0,0 +1,68 @@
+#if !defined(AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCellCheck.h : header file
+//
+// MFC Grid Control - Grid combo cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+
+#include "..\\GridCell.h"
+
+
+class AFX_EXT_CLASS CGridCellCheck : public CGridCell
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCellCheck)
+
+public:
+    CGridCellCheck();
+
+public:
+	BOOL SetCheck(BOOL bChecked = TRUE);
+	BOOL GetCheck();
+
+// Operations
+	virtual CSize GetCellExtent(CDC* pDC);
+    virtual void OnClick( CPoint PointCellRelative);
+    virtual BOOL GetTextRect( LPRECT pRect);
+
+protected:
+	CRect GetCheckPlacement();
+
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+protected:
+    BOOL  m_bChecked;
+    CRect m_Rect;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.cpp b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.cpp
new file mode 100644
index 0000000..73f4cb8
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.cpp
@@ -0,0 +1,511 @@
+// GridCellCombo.cpp : implementation file
+//
+// MFC Grid Control - Main grid cell class
+//
+// Provides the implementation for a combobox cell type of the
+// grid control.
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// Parts of the code contained in this file are based on the original
+// CInPlaceList from http://www.codeguru.com/listview
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+// History:
+// 6 Aug 1998 - Added CComboEdit to subclass the edit control - code 
+//              provided by Roelf Werkman <rdw@inn.nl>. Added nID to 
+//              the constructor param list.
+// 29 Nov 1998 - bug fix in onkeydown (Markus Irtenkauf)
+// 13 Mar 2004 - GetCellExtent fixed by Yogurt
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "..\\..\\stdafx.h"
+#include "../GridCell.h"
+#include "../GridCtrl.h"
+
+#include "GridCellCombo.h"
+
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CComboEdit
+
+CComboEdit::CComboEdit()
+{
+}
+
+CComboEdit::~CComboEdit()
+{
+}
+
+// Stoopid win95 accelerator key problem workaround - Matt Weagle.
+BOOL CComboEdit::PreTranslateMessage(MSG* pMsg) 
+{
+	// Make sure that the keystrokes continue to the appropriate handlers
+	if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP)
+	{
+		::TranslateMessage(pMsg);
+		::DispatchMessage(pMsg);
+		return TRUE;
+	}	
+
+	// Catch the Alt key so we don't choke if focus is going to an owner drawn button
+	if (pMsg->message == WM_SYSCHAR)
+		return TRUE;
+
+	return CEdit::PreTranslateMessage(pMsg);
+}
+
+BEGIN_MESSAGE_MAP(CComboEdit, CEdit)
+	//{{AFX_MSG_MAP(CComboEdit)
+	ON_WM_KILLFOCUS()
+	ON_WM_KEYDOWN()
+	ON_WM_KEYUP()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CComboEdit message handlers
+
+void CComboEdit::OnKillFocus(CWnd* pNewWnd) 
+{
+	CEdit::OnKillFocus(pNewWnd);
+	
+    CInPlaceList* pOwner = (CInPlaceList*) GetOwner();  // This MUST be a CInPlaceList
+    if (pOwner)
+        pOwner->EndEdit();	
+}
+
+void CComboEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if ((nChar == VK_PRIOR || nChar == VK_NEXT ||
+		 nChar == VK_DOWN  || nChar == VK_UP   ||
+		 nChar == VK_RIGHT || nChar == VK_LEFT) &&
+		(GetKeyState(VK_CONTROL) < 0 && GetDlgCtrlID() == IDC_COMBOEDIT))
+    {
+        CWnd* pOwner = GetOwner();
+        if (pOwner)
+            pOwner->SendMessage(WM_KEYDOWN, nChar, nRepCnt+ (((DWORD)nFlags)<<16));
+        return;
+    }
+
+	CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+void CComboEdit::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if (nChar == VK_ESCAPE) 
+	{
+        CWnd* pOwner = GetOwner();
+        if (pOwner)
+            pOwner->SendMessage(WM_KEYUP, nChar, nRepCnt + (((DWORD)nFlags)<<16));
+        return;
+    }
+
+	if (nChar == VK_TAB || nChar == VK_RETURN || nChar == VK_ESCAPE)
+    {
+        CWnd* pOwner = GetOwner();
+        if (pOwner)
+            pOwner->SendMessage(WM_KEYUP, nChar, nRepCnt + (((DWORD)nFlags)<<16));
+        return;
+    }
+
+	CEdit::OnKeyUp(nChar, nRepCnt, nFlags);
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceList
+
+CInPlaceList::CInPlaceList(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
+                           int nRow, int nColumn, 
+                           COLORREF crFore, COLORREF crBack,
+						   CStringArray& Items, CString sInitText, 
+						   UINT nFirstChar)
+{
+    m_crForeClr = crFore;
+    m_crBackClr = crBack;
+
+	m_nNumLines = 4;
+	m_sInitText = sInitText;
+ 	m_nRow		= nRow;
+ 	m_nCol      = nColumn;
+ 	m_nLastChar = 0; 
+	m_bExitOnArrows = FALSE; //(nFirstChar != VK_LBUTTON);	// If mouse click brought us here,
+
+	// Create the combobox
+ 	DWORD dwComboStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL|
+ 					     CBS_AUTOHSCROLL | dwStyle;
+	int nHeight = rect.Height();
+	rect.bottom = rect.bottom + m_nNumLines*nHeight + ::GetSystemMetrics(SM_CYHSCROLL);
+	if (!Create(dwComboStyle, rect, pParent, nID)) return;
+
+	// Add the strings
+	for (int i = 0; i < Items.GetSize(); i++) 
+		AddString(Items[i]);
+
+	SetFont(pParent->GetFont());
+	SetItemHeight(-1, nHeight);
+
+    int nMaxLength = GetCorrectDropWidth();
+    /*
+    if (nMaxLength > rect.Width())
+	    rect.right = rect.left + nMaxLength;
+	// Resize the edit window and the drop down window
+	MoveWindow(rect);
+    */
+
+	SetDroppedWidth(nMaxLength);
+
+	SetHorizontalExtent(0); // no horz scrolling
+
+	// Set the initial text to m_sInitText
+    if (::IsWindow(m_hWnd) && SelectString(-1, m_sInitText) == CB_ERR) 
+		SetWindowText(m_sInitText);		// No text selected, so restore what was there before
+
+    ShowDropDown();
+
+    // Subclass the combobox edit control if style includes CBS_DROPDOWN
+    if ((dwStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWNLIST)
+    {
+        m_edit.SubclassDlgItem(IDC_COMBOEDIT, this);
+ 	    SetFocus();
+        switch (nFirstChar)
+        {
+            case VK_LBUTTON: 
+            case VK_RETURN:   m_edit.SetSel((int)_tcslen(m_sInitText), -1); return;
+            case VK_BACK:     m_edit.SetSel((int)_tcslen(m_sInitText), -1); break;
+            case VK_DOWN: 
+            case VK_UP:   
+            case VK_RIGHT:
+            case VK_LEFT:  
+            case VK_NEXT:  
+            case VK_PRIOR: 
+            case VK_HOME:  
+            case VK_END:      m_edit.SetSel(0,-1); return;
+            default:          m_edit.SetSel(0,-1);
+        }
+        SendMessage(WM_CHAR, nFirstChar);
+    }
+    else
+ 	    SetFocus();
+}
+
+CInPlaceList::~CInPlaceList()
+{
+}
+
+void CInPlaceList::EndEdit()
+{
+    CString str;
+    if (::IsWindow(m_hWnd))
+        GetWindowText(str);
+ 
+    // Send Notification to parent
+    GV_DISPINFO dispinfo;
+
+    dispinfo.hdr.hwndFrom = GetSafeHwnd();
+    dispinfo.hdr.idFrom   = GetDlgCtrlID();
+    dispinfo.hdr.code     = GVN_ENDLABELEDIT;
+ 
+    dispinfo.item.mask    = LVIF_TEXT|LVIF_PARAM;
+    dispinfo.item.row     = m_nRow;
+    dispinfo.item.col     = m_nCol;
+    dispinfo.item.strText = str;
+    dispinfo.item.lParam  = (LPARAM) m_nLastChar; 
+ 
+    CWnd* pOwner = GetOwner();
+    if (IsWindow(pOwner->GetSafeHwnd()))
+        pOwner->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo );
+ 
+    // Close this window (PostNcDestroy will delete this)
+    if (::IsWindow(m_hWnd))
+        PostMessage(WM_CLOSE, 0, 0);
+}
+
+int CInPlaceList::GetCorrectDropWidth()
+{
+    const int nMaxWidth = 200;  // don't let the box be bigger than this
+
+    // Reset the dropped width
+    int nNumEntries = GetCount();
+    int nWidth = 0;
+    CString str;
+
+    CClientDC dc(this);
+    int nSave = dc.SaveDC();
+    dc.SelectObject(GetFont());
+
+    int nScrollWidth = ::GetSystemMetrics(SM_CXVSCROLL);
+    for (int i = 0; i < nNumEntries; i++)
+    {
+        GetLBText(i, str);
+        int nLength = dc.GetTextExtent(str).cx + nScrollWidth;
+        nWidth = max(nWidth, nLength);
+    }
+    
+    // Add margin space to the calculations
+    nWidth += dc.GetTextExtent(_T("0")).cx;
+
+    dc.RestoreDC(nSave);
+
+    nWidth = min(nWidth, nMaxWidth);
+
+    return nWidth;
+    //SetDroppedWidth(nWidth);
+}
+
+/*
+// Fix by Ray (raybie@Exabyte.COM)
+void CInPlaceList::OnSelendOK() 
+{
+    int iIndex = GetCurSel(); 
+    if( iIndex != CB_ERR) 
+    { 
+        CString strLbText; 
+        GetLBText( iIndex, strLbText); 
+ 
+        if (!((GetStyle() & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST)) 
+           m_edit.SetWindowText( strLbText); 
+    } 
+ 
+    GetParent()->SetFocus(); 	
+}
+*/
+
+void CInPlaceList::PostNcDestroy() 
+{
+	CComboBox::PostNcDestroy();
+
+	delete this;
+}
+
+BEGIN_MESSAGE_MAP(CInPlaceList, CComboBox)
+	//{{AFX_MSG_MAP(CInPlaceList)
+	ON_WM_KILLFOCUS()
+	ON_WM_KEYDOWN()
+	ON_WM_KEYUP()
+	ON_CONTROL_REFLECT(CBN_DROPDOWN, OnDropdown)
+	ON_CONTROL_REFLECT(CBN_SELCHANGE, OnSelChange)
+	ON_WM_GETDLGCODE()
+	ON_WM_CTLCOLOR_REFLECT()
+	//}}AFX_MSG_MAP
+	//ON_CONTROL_REFLECT(CBN_SELENDOK, OnSelendOK)
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceList message handlers
+
+UINT CInPlaceList::OnGetDlgCode() 
+{
+    return DLGC_WANTALLKEYS;
+}
+
+void CInPlaceList::OnDropdown() 
+{
+    SetDroppedWidth(GetCorrectDropWidth());
+}
+
+void CInPlaceList::OnSelChange()
+{
+	CString str;
+	GetLBText(GetCurSel(), str);
+
+	// Send Notification to parent
+	GV_DISPINFO dispinfo;
+
+	dispinfo.hdr.hwndFrom = GetSafeHwnd();
+	dispinfo.hdr.idFrom   = GetDlgCtrlID();
+	dispinfo.hdr.code     = GVN_COMBOSELCHANGE;
+
+	dispinfo.item.mask    = LVIF_TEXT|LVIF_PARAM;
+	dispinfo.item.row     = m_nRow;
+	dispinfo.item.col     = m_nCol;
+	dispinfo.item.strText = str;
+	dispinfo.item.lParam  = (LPARAM) m_nLastChar; 
+
+	CWnd* pOwner = GetOwner();
+	if (IsWindow(pOwner->GetSafeHwnd()))
+		pOwner->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo);
+}
+
+void CInPlaceList::OnKillFocus(CWnd* pNewWnd) 
+{
+	CComboBox::OnKillFocus(pNewWnd);
+
+	if (GetSafeHwnd() == pNewWnd->GetSafeHwnd())
+        return;
+
+    // Only end editing on change of focus if we're using the CBS_DROPDOWNLIST style
+    if ((GetStyle() & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST)
+        EndEdit();
+}
+
+// If an arrow key (or associated) is pressed, then exit if
+//  a) The Ctrl key was down, or
+//  b) m_bExitOnArrows == TRUE
+void CInPlaceList::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if ((nChar == VK_PRIOR || nChar == VK_NEXT ||
+		 nChar == VK_DOWN  || nChar == VK_UP   ||
+		 nChar == VK_RIGHT || nChar == VK_LEFT) &&
+		(m_bExitOnArrows || GetKeyState(VK_CONTROL) < 0))
+	{
+		m_nLastChar = nChar;
+		GetParent()->SetFocus();
+		return;
+	}
+
+	CComboBox::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+// Need to keep a lookout for Tabs, Esc and Returns.
+void CInPlaceList::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if (nChar == VK_ESCAPE) 
+		SetWindowText(m_sInitText);	// restore previous text
+
+	if (nChar == VK_TAB || nChar == VK_RETURN || nChar == VK_ESCAPE)
+	{
+		m_nLastChar = nChar;
+		GetParent()->SetFocus();	// This will destroy this window
+		return;
+	}
+
+	CComboBox::OnKeyUp(nChar, nRepCnt, nFlags);
+}
+
+HBRUSH CInPlaceList::CtlColor(CDC* /*pDC*/, UINT /*nCtlColor*/) 
+{
+    /*
+    static CBrush brush(m_crBackClr);
+    pDC->SetTextColor(m_crForeClr);
+    pDC->SetBkMode(TRANSPARENT);
+    return (HBRUSH) brush.GetSafeHandle();
+    */
+	
+	// TODO: Return a non-NULL brush if the parent's handler should not be called
+	return NULL;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCellCombo 
+/////////////////////////////////////////////////////////////////////////////
+
+
+IMPLEMENT_DYNCREATE(CGridCellCombo, CGridCell)
+
+CGridCellCombo::CGridCellCombo() : CGridCell()
+{
+    SetStyle(CBS_DROPDOWN);  // CBS_DROPDOWN, CBS_DROPDOWNLIST, CBS_SIMPLE, CBS_SORT
+}
+
+// Create a control to do the editing
+BOOL CGridCellCombo::Edit(int nRow, int nCol, CRect rect, CPoint /* point */, UINT nID, UINT nChar)
+{
+    m_bEditing = TRUE;
+    
+    // CInPlaceList auto-deletes itself
+    m_pEditWnd = new CInPlaceList(GetGrid(), rect, GetStyle(), nID, nRow, nCol, 
+                                  GetTextClr(), GetBackClr(), m_Strings, GetText(), nChar);
+
+    return TRUE;
+}
+
+CWnd* CGridCellCombo::GetEditWnd() const
+{
+	if (m_pEditWnd && (m_pEditWnd->GetStyle() & CBS_DROPDOWNLIST) != CBS_DROPDOWNLIST )
+		return &(((CInPlaceList*)m_pEditWnd)->m_edit);
+
+	return NULL;
+}
+
+
+CSize CGridCellCombo::GetCellExtent(CDC* pDC)
+{    
+    CSize sizeScroll (GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics(SM_CYHSCROLL));    
+    CSize sizeCell (CGridCell::GetCellExtent(pDC));    
+    sizeCell.cx += sizeScroll.cx;    
+    sizeCell.cy = max(sizeCell.cy,sizeScroll.cy);    
+    return sizeCell;
+}
+
+// Cancel the editing.
+void CGridCellCombo::EndEdit()
+{
+    if (m_pEditWnd)
+        ((CInPlaceList*)m_pEditWnd)->EndEdit();
+}
+
+// Override draw so that when the cell is selected, a drop arrow is shown in the RHS.
+BOOL CGridCellCombo::Draw(CDC* pDC, int nRow, int nCol, CRect rect,  BOOL bEraseBkgnd /*=TRUE*/)
+{
+#ifdef _WIN32_WCE
+    return CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);
+#else
+    // Cell selected?
+    //if ( !IsFixed() && IsFocused())
+    if (GetGrid()->IsCellEditable(nRow, nCol) && !IsEditing())
+    {
+        // Get the size of the scroll box
+        CSize sizeScroll(GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics(SM_CYHSCROLL));
+
+        // enough room to draw?
+        if (sizeScroll.cy < rect.Width() && sizeScroll.cy < rect.Height())
+        {
+            // Draw control at RHS of cell
+            CRect ScrollRect = rect;
+            ScrollRect.left   = rect.right - sizeScroll.cx;
+            ScrollRect.bottom = rect.top + sizeScroll.cy;
+
+            // Do the draw 
+            pDC->DrawFrameControl(ScrollRect, DFC_SCROLL, DFCS_SCROLLDOWN);
+
+            // Adjust the remaining space in the cell
+            rect.right = ScrollRect.left;
+        }
+    }
+
+    CString strTempText = GetText();
+    if (IsEditing())
+        SetText(_T(""));
+
+    // drop through and complete the cell drawing using the base class' method
+    BOOL bResult = CGridCell::Draw(pDC, nRow, nCol, rect,  bEraseBkgnd);
+
+    if (IsEditing())
+        SetText(strTempText);
+
+	return bResult;
+#endif
+}
+
+// For setting the strings that will be displayed in the drop list
+void CGridCellCombo::SetOptions(const CStringArray& ar)
+{ 
+    m_Strings.RemoveAll();
+    for (int i = 0; i < ar.GetSize(); i++)
+        m_Strings.Add(ar[i]);
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.h b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.h
new file mode 100644
index 0000000..bf436c3
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellCombo.h
@@ -0,0 +1,178 @@
+#if !defined(AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCellCombo.h : header file
+//
+// MFC Grid Control - Grid combo cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10
+//
+//////////////////////////////////////////////////////////////////////
+
+
+#include "../GridCell.h"
+
+
+class AFX_EXT_CLASS CGridCellCombo : public CGridCell
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCellCombo)
+
+public:
+    CGridCellCombo();
+
+// editing cells
+public:
+    virtual BOOL  Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual CWnd* GetEditWnd() const;
+    virtual void  EndEdit();
+
+// Operations
+public:
+	virtual CSize GetCellExtent(CDC* pDC);
+
+// CGridCellCombo specific calls
+public:
+    void  SetOptions(const CStringArray& ar);
+    void  SetStyle(DWORD dwStyle)           { m_dwStyle = dwStyle; }
+    DWORD GetStyle()                        { return m_dwStyle;    }
+
+protected:
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+    CStringArray m_Strings;
+    DWORD        m_dwStyle;
+};
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CComboEdit window
+
+#define IDC_COMBOEDIT 1001
+
+class CComboEdit : public CEdit
+{
+// Construction
+public:
+	CComboEdit();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CComboEdit)
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CComboEdit();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CComboEdit)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceList window
+
+class CInPlaceList : public CComboBox
+{
+    friend class CComboEdit;
+
+// Construction
+public:
+	CInPlaceList(CWnd* pParent,         // parent
+                 CRect& rect,           // dimensions & location
+                 DWORD dwStyle,         // window/combobox style
+                 UINT nID,              // control ID
+                 int nRow, int nColumn, // row and column
+                 COLORREF crFore, COLORREF crBack,  // Foreground, background colour
+				 CStringArray& Items,   // Items in list
+                 CString sInitText,     // initial selection
+				 UINT nFirstChar);      // first character to pass to control
+
+// Attributes
+public:
+   CComboEdit m_edit;  // subclassed edit control
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceList)
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceList();
+    void EndEdit();
+
+protected:
+    int GetCorrectDropWidth();
+
+// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceList)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnDropdown();
+	afx_msg void OnSelChange();
+	afx_msg UINT OnGetDlgCode();
+	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
+	//}}AFX_MSG
+	//afx_msg void OnSelendOK();
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	int		 m_nNumLines;
+	CString  m_sInitText;
+	int		 m_nRow;
+	int		 m_nCol;
+ 	UINT     m_nLastChar; 
+	BOOL	 m_bExitOnArrows; 
+    COLORREF m_crForeClr, m_crBackClr;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.cpp b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.cpp
new file mode 100644
index 0000000..dfd982b
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.cpp
@@ -0,0 +1,269 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// GridCellDateTime.cpp: implementation of the CGridCellDateTime class.
+//
+// Provides the implementation for a datetime picker cell type of the
+// grid control.
+//
+// Written by Podsypalnikov Eugen 15 Mar 2001
+// Modified:
+//    31 May 2001  Fixed m_cTime bug (Chris Maunder)
+//
+// For use with CGridCtrl v2.22+
+//
+///////////////////////////////////////////////////////////////////////////
+
+#include "..\\..\\stdafx.h"
+#include "..\\GridCtrl.h"
+#include "..\\GridCell.h"
+#include "GridCellDateTime.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// CGridCellDateTime
+
+IMPLEMENT_DYNCREATE(CGridCellDateTime, CGridCell)
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CGridCellDateTime::CGridCellDateTime() : CGridCell()
+{
+	m_dwStyle = 0;
+	m_cTime   = CTime::GetCurrentTime();
+}
+
+CGridCellDateTime::CGridCellDateTime(DWORD dwStyle) : CGridCell()
+{
+	Init(dwStyle);
+}
+
+CGridCellDateTime::~CGridCellDateTime()
+{
+}
+
+CSize CGridCellDateTime::GetCellExtent(CDC* pDC)
+{    
+    CSize sizeScroll (GetSystemMetrics(SM_CXVSCROLL), GetSystemMetrics(SM_CYHSCROLL));	
+    CSize sizeCell (CGridCell::GetCellExtent(pDC));	
+    sizeCell.cx += sizeScroll.cx;	
+    sizeCell.cy = max(sizeCell.cy,sizeScroll.cy);	
+    return sizeCell;
+}
+
+BOOL CGridCellDateTime::Edit(int nRow, int nCol, CRect rect, CPoint /* point */, 
+							 UINT nID, UINT nChar)
+{
+	m_bEditing = TRUE;
+
+	// CInPlaceDateTime auto-deletes itself
+	m_pEditWnd = new CInPlaceDateTime(GetGrid(), rect,
+		m_dwStyle|DTS_UPDOWN, nID, nRow, nCol, 
+		GetTextClr(), GetBackClr(), GetTime(), nChar);
+	return TRUE;
+}
+
+CWnd* CGridCellDateTime::GetEditWnd() const
+{
+	return m_pEditWnd;
+}
+
+void CGridCellDateTime::EndEdit()
+{
+	if (m_pEditWnd) ((CInPlaceDateTime*)m_pEditWnd)->EndEdit();
+}
+
+void CGridCellDateTime::Init(DWORD dwStyle)
+{
+	m_dwStyle = dwStyle;
+
+	SetTime(CTime::GetCurrentTime());
+
+	SetFormat(DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX
+#ifndef _WIN32_WCE
+		|DT_END_ELLIPSIS
+#endif
+		);
+}
+
+// Should be changed to use locale settings
+void CGridCellDateTime::SetTime(CTime time)
+{
+	m_cTime = time;
+
+	if (DTS_TIMEFORMAT == m_dwStyle) 
+	{
+#ifdef _WIN32_WCE
+		CString strTemp;
+		strTemp.Format(_T("%02d:%02d:%02d"), 
+			           m_cTime.GetHour(), m_cTime.GetMinute(), m_cTime.GetSecond());
+		SetText(strTemp);
+#else
+
+//		SetText(m_cTime.Format(_T("%H:%M:%S")));
+    	SetText(m_cTime.Format(_T("%X")));
+#endif
+	}
+	else if (DTS_SHORTDATEFORMAT == m_dwStyle) 
+	{
+#ifdef _WIN32_WCE
+		CString strTemp;
+		strTemp.Format(_T("%02d/%02d/%02d"), 
+			           m_cTime.GetMonth(), m_cTime.GetDay(), m_cTime.GetYear());
+		SetText(strTemp);
+#else
+//		SetText(m_cTime.Format(("%d/%m/%Y")));
+		SetText(m_cTime.Format(("%x")));
+#endif
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceDateTime
+
+CInPlaceDateTime::CInPlaceDateTime(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
+								   int nRow, int nColumn, 
+								   COLORREF crFore, COLORREF crBack,
+								   CTime* pcTime,
+								   UINT nFirstChar)
+{
+	m_crForeClr     = crFore;
+	m_crBackClr     = crBack;
+	m_nRow          = nRow;
+	m_nCol          = nColumn;
+	m_nLastChar     = 0; 
+	m_bExitOnArrows = FALSE;
+	m_pcTime        = pcTime;
+
+	DWORD dwStl = WS_BORDER|WS_VISIBLE|WS_CHILD|dwStyle;
+
+	if (!Create(dwStl, rect, pParent, nID)) {
+		return;
+	}
+
+	SetTime(m_pcTime);
+
+	SetFont(pParent->GetFont());
+	SetFocus();
+
+	switch (nFirstChar) 
+	{
+		case VK_LBUTTON: 
+		case VK_RETURN: return;
+		case VK_BACK:   break;
+		case VK_DOWN: 
+		case VK_UP:   
+		case VK_RIGHT:
+		case VK_LEFT:  
+		case VK_NEXT:  
+		case VK_PRIOR: 
+		case VK_HOME:  
+		case VK_END:    return;
+		default:        break;
+	}
+	SendMessage(WM_CHAR, nFirstChar);
+}
+
+CInPlaceDateTime::~CInPlaceDateTime()
+{
+}
+
+void CInPlaceDateTime::EndEdit()
+{
+	CString str;
+	if (::IsWindow(m_hWnd)) 
+	{
+		GetWindowText(str);
+		GetTime(*m_pcTime);
+	}
+
+	// Send Notification to parent
+	GV_DISPINFO dispinfo;
+
+	dispinfo.hdr.hwndFrom = GetSafeHwnd();
+	dispinfo.hdr.idFrom   = GetDlgCtrlID();
+	dispinfo.hdr.code     = GVN_ENDLABELEDIT;
+
+	dispinfo.item.mask    = LVIF_TEXT|LVIF_PARAM;
+	dispinfo.item.row     = m_nRow;
+	dispinfo.item.col     = m_nCol;
+	dispinfo.item.strText = str;
+	dispinfo.item.lParam  = (LPARAM) m_nLastChar; 
+
+	CWnd* pOwner = GetOwner();
+	if (IsWindow(pOwner->GetSafeHwnd())) {
+		pOwner->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo);
+	}
+
+	// Close this window (PostNcDestroy will delete this)
+	if (::IsWindow(m_hWnd)) {
+		PostMessage(WM_CLOSE, 0, 0);
+	}
+}
+
+void CInPlaceDateTime::PostNcDestroy() 
+{
+	CDateTimeCtrl::PostNcDestroy();
+	delete this;
+}
+
+BEGIN_MESSAGE_MAP(CInPlaceDateTime, CDateTimeCtrl)
+	//{{AFX_MSG_MAP(CInPlaceDateTime)
+	ON_WM_KILLFOCUS()
+	ON_WM_KEYDOWN()
+	ON_WM_KEYUP()
+	ON_WM_GETDLGCODE()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceDateTime message handlers
+
+void CInPlaceDateTime::OnKillFocus(CWnd* pNewWnd) 
+{
+	CDateTimeCtrl::OnKillFocus(pNewWnd);
+
+	if (GetSafeHwnd() == pNewWnd->GetSafeHwnd()) {
+		return;
+	}
+	EndEdit();
+}
+
+UINT CInPlaceDateTime::OnGetDlgCode() 
+{
+	return DLGC_WANTALLKEYS;
+}
+
+void CInPlaceDateTime::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if (( nChar == VK_PRIOR || nChar == VK_NEXT ||
+		nChar == VK_DOWN  || nChar == VK_UP   ||
+		nChar == VK_RIGHT || nChar == VK_LEFT) &&
+		(m_bExitOnArrows  || GetKeyState(VK_CONTROL) < 0))
+	{
+		m_nLastChar = nChar;
+		GetParent()->SetFocus();
+		return;
+	}
+
+	CDateTimeCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+void CInPlaceDateTime::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	if (nChar == VK_TAB || nChar == VK_RETURN || nChar == VK_ESCAPE)
+	{
+		m_nLastChar = nChar;
+		GetParent()->SetFocus();    // This will destroy this window
+		return;
+	}
+
+	CDateTimeCtrl::OnKeyUp(nChar, nRepCnt, nFlags);
+}
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.h b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
new file mode 100644
index 0000000..a3d5a76
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
@@ -0,0 +1,92 @@
+// GridCellDateTime.h: interface for the CGridCellDateTime class.
+//
+// Provides the implementation for a datetime picker cell type of the
+// grid control.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_)
+#define AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+#include "afxdtctl.h"	// for CDateTimeCtrl
+
+class CGridCellDateTime : public CGridCell  
+{
+  friend class CGridCtrl;
+  DECLARE_DYNCREATE(CGridCellDateTime)
+
+  CTime m_cTime;
+  DWORD m_dwStyle;
+
+public:
+	CGridCellDateTime();
+	CGridCellDateTime(DWORD dwStyle);
+	virtual ~CGridCellDateTime();
+    virtual CSize GetCellExtent(CDC* pDC);
+
+  // editing cells
+public:
+	void Init(DWORD dwStyle);
+	virtual BOOL  Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+	virtual CWnd* GetEditWnd() const;
+	virtual void  EndEdit();
+
+
+	CTime* GetTime() {return &m_cTime;};
+	void   SetTime(CTime time);
+};
+
+class CInPlaceDateTime : public CDateTimeCtrl
+{
+// Construction
+public:
+	CInPlaceDateTime(CWnd* pParent,         // parent
+                   CRect& rect,           // dimensions & location
+                   DWORD dwStyle,         // window/combobox style
+                   UINT nID,              // control ID
+                   int nRow, int nColumn, // row and column
+                   COLORREF crFore, COLORREF crBack,  // Foreground, background colour
+                   CTime* pcTime,
+          		   UINT nFirstChar);      // first character to pass to control
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceList)
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceDateTime();
+    void EndEdit();
+
+// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceList)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg UINT OnGetDlgCode();
+	//}}AFX_MSG
+	//afx_msg void OnSelendOK();
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+    CTime*   m_pcTime;
+	int		 m_nRow;
+	int		 m_nCol;
+ 	UINT     m_nLastChar; 
+	BOOL	 m_bExitOnArrows; 
+    COLORREF m_crForeClr, m_crBackClr;
+};
+
+#endif // !defined(AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.cpp b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.cpp
new file mode 100644
index 0000000..f63a7a9
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.cpp
@@ -0,0 +1,42 @@
+// GridCellNumeric.cpp: implementation of the CGridCellNumeric class.
+//
+// Written by Andrew Truckle [ajtruckle@wsatkins.co.uk]
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "..\\..\\stdafx.h"
+#include "GridCellNumeric.h"
+#include "..\\Gridinplaceedit.h"
+#include "..\\GridCtrl.h"
+
+IMPLEMENT_DYNCREATE(CGridCellNumeric, CGridCell)
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+// Create a control to do the editing
+BOOL CGridCellNumeric::Edit(int nRow, int nCol, CRect rect, CPoint /* point */, UINT nID, UINT nChar)
+{
+    m_bEditing = TRUE;
+    
+    // CGridInPlaceEdit auto-deletes itself
+    m_pEditWnd = new CGridInPlaceEdit(GetGrid(), rect, /*GetStyle() |*/ ES_NUMBER, nID, nRow, nCol,
+		GetText(), nChar);
+
+    return TRUE;
+}
+
+// Cancel the editing.
+void CGridCellNumeric::EndEdit()
+{
+    if (m_pEditWnd)
+        ((CGridInPlaceEdit*)m_pEditWnd)->EndEdit();
+}
+
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.h b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
new file mode 100644
index 0000000..4efb7d7
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
@@ -0,0 +1,26 @@
+// GridCellNumeric.h: interface for the CGridCellNumeric class.
+//
+// Written by Andrew Truckle [ajtruckle@wsatkins.co.uk]
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_)
+#define AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+
+class AFX_EXT_CLASS CGridCellNumeric : public CGridCell  
+{
+    DECLARE_DYNCREATE(CGridCellNumeric)
+
+public:
+    virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual void EndEdit();
+
+};
+
+#endif // !defined(AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.cpp b/Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.cpp
new file mode 100644
index 0000000..68ff569
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.cpp
@@ -0,0 +1,212 @@
+// GridURLCell.cpp: implementation of the CGridURLCell class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "..\\..\\stdafx.h"
+#include "GridURLCell.h"
+#include "..\\GridCtrl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+IMPLEMENT_DYNCREATE(CGridURLCell, CGridCell)
+
+#ifndef _WIN32_WCE
+HCURSOR CGridURLCell::g_hLinkCursor = NULL;
+#endif
+
+// Possible prefixes that indicate a hyperlink
+URLStruct CGridURLCell::g_szURIprefixes[] = { 
+    { _T("www."),    _tcslen(_T("www."))    },
+    { _T("http:"),   _tcslen(_T("http:"))   },
+    { _T("mailto:"), _tcslen(_T("mailto:")) },
+    { _T("ftp:"),    _tcslen(_T("ftp:"))    },
+    { _T("https:"),  _tcslen(_T("https:"))  },
+    { _T("news:"),   _tcslen(_T("news:"))   },
+    { _T("gopher:"), _tcslen(_T("gopher:")) },
+    { _T("telnet:"), _tcslen(_T("telnet:")) },
+    { _T("url:"),    _tcslen(_T("url:"))    },
+    { _T("file:"),   _tcslen(_T("file:"))   },
+    { _T("ftp."),    _tcslen(_T("ftp."))    }
+};
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CGridURLCell::CGridURLCell()
+{
+#ifndef _WIN32_WCE
+    g_hLinkCursor = GetHandCursor();
+#endif
+	m_bLaunchUrl = TRUE;
+	m_clrUrl = GetSysColor(COLOR_HIGHLIGHT);
+}
+
+CGridURLCell::~CGridURLCell()
+{
+}
+
+BOOL CGridURLCell::Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd)
+{
+	// If url is present then change text color
+	if (HasUrl(GetText()))
+		SetTextClr(m_clrUrl);
+
+    // Good a place as any to store the bounds of the rect
+    m_Rect = rect;
+
+    return CGridCell::Draw(pDC, nRow, nCol, rect, bEraseBkgnd);
+}
+
+#pragma warning(disable:4100)
+BOOL CGridURLCell::Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar)
+{
+    return FALSE;
+}
+#pragma warning(default:4100)
+
+void CGridURLCell::OnClick(CPoint PointCellRelative)
+{
+#ifndef _WIN32_WCE
+    CString strURL;
+    if (GetAutoLaunchUrl() && OverURL(PointCellRelative, strURL))
+		ShellExecute(NULL, _T("open"), strURL, NULL,NULL, SW_SHOW);
+#endif
+}
+
+// Return TRUE if you set the cursor
+BOOL CGridURLCell::OnSetCursor()
+{
+#ifndef _WIN32_WCE
+    CString strURL;
+    CPoint pt(GetMessagePos());
+    GetGrid()->ScreenToClient(&pt);
+    pt = pt - m_Rect.TopLeft();
+
+    if (OverURL(pt, strURL))
+    {
+        SetCursor(g_hLinkCursor);
+		return TRUE;
+	}
+	else
+#endif
+		return CGridCell::OnSetCursor();
+}
+
+#ifndef _WIN32_WCE
+HCURSOR CGridURLCell::GetHandCursor()
+{
+	if (g_hLinkCursor == NULL)		// No cursor handle - load our own
+	{
+        // Get the windows directory
+		CString strWndDir;
+		GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
+		strWndDir.ReleaseBuffer();
+
+		strWndDir += _T("\\winhlp32.exe");
+		// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
+		HMODULE hModule = LoadLibrary(strWndDir);
+		if( hModule )
+		{
+			HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
+			if( hHandCursor )
+			{
+				g_hLinkCursor = CopyCursor(hHandCursor);
+			}
+		}
+		FreeLibrary(hModule);
+	}
+
+	return g_hLinkCursor;
+}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Helper functions
+
+BOOL CGridURLCell::HasUrl(CString str)
+{
+    int nNumPrefixes = sizeof(g_szURIprefixes) / sizeof(g_szURIprefixes[0]);
+    for (int i = 0; i < nNumPrefixes; i++)
+        //if (str.Left(g_szURIprefixes[i].nLength) == g_szURIprefixes[i].szURLPrefix)
+        if (str.Find(g_szURIprefixes[i].szURLPrefix) >= 0)
+            return TRUE;
+
+    return FALSE;
+}
+
+// here we figure out if we are over a URL or not
+BOOL CGridURLCell::OverURL(CPoint& pt, CString& strURL)
+{
+    //TRACE2("Checking point %d,%d\n",pt.x,pt.y);
+
+	BOOL bOverURL = FALSE;
+	CSize size = GetTextExtent(GetText());
+
+	// Add left of cell so we know if we clicked on text or not
+	pt.x += m_Rect.left;
+	CPoint center = m_Rect.CenterPoint();
+
+	if ((m_nFormat & DT_RIGHT) && pt.x >= (m_Rect.right - size.cx))
+	{
+		bOverURL = TRUE;
+	}	
+	else if ((m_nFormat & DT_CENTER) && 
+             ((center.x - (size.cx/2)) <= pt.x) && (pt.x <= (center.x + (size.cx/2))) )
+	{
+		bOverURL = TRUE;
+	}
+	else if (pt.x <= (size.cx + m_Rect.left))
+	{
+		bOverURL = TRUE;
+	}
+
+    if (!bOverURL)
+        return FALSE;
+
+    // We are over text - but are we over a URL?
+	bOverURL = FALSE;
+	strURL = GetText();
+
+	// Use float, otherwise we get an incorrect letter from the point
+	float width = (float)size.cx/(float)strURL.GetLength();
+
+	// remove left of cell so we have original point again 
+	pt.x -= m_Rect.left;
+	if (m_nFormat & DT_RIGHT)
+	{
+		int wide = m_Rect.Width() - size.cx;
+		pt.x -= wide;
+		if (pt.x <= 0)
+			return FALSE;
+	}
+
+	if (m_nFormat & DT_CENTER)
+	{
+		int wide = m_Rect.Width() - size.cx;
+		pt.x -= (wide/2);
+		if (pt.x <= 0 || pt.x > (size.cx + (wide/2)))
+			return FALSE;
+	}
+
+	// Turn point into a letter
+	int ltrs = (int)((float)pt.x/width);
+#if  !defined(_WIN32_WCE) || (_WIN32_WCE > 210)
+	// Find spaces before and after letter, process text between
+	int endSpace = strURL.Find(_T(' '), ltrs);
+	if (endSpace != -1)
+		strURL.Delete(endSpace, strURL.GetLength()-endSpace);
+
+	int beginSpace = strURL.ReverseFind(_T(' '));
+	if (beginSpace != -1)
+		strURL.Delete(0, ++beginSpace);
+#endif
+
+	// Does text have url
+	return HasUrl(strURL);
+}
+
diff --git a/Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.h b/Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.h
new file mode 100644
index 0000000..c3dffa0
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/NewCellTypes/GridURLCell.h
@@ -0,0 +1,55 @@
+// GridURLCell.h: interface for the CGridURLCell class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_)
+#define AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+
+typedef struct {
+    LPCTSTR szURLPrefix;
+    size_t  nLength;
+} URLStruct;
+
+
+
+class CGridURLCell : public CGridCell  
+{
+    DECLARE_DYNCREATE(CGridURLCell)
+
+public:
+	CGridURLCell();
+	virtual ~CGridURLCell();
+
+    virtual BOOL     Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+    virtual BOOL     Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual LPCTSTR  GetTipText() { return NULL; }
+	void SetAutoLaunchUrl(BOOL bLaunch = TRUE) { m_bLaunchUrl = bLaunch;	}
+	BOOL GetAutoLaunchUrl() { return m_bLaunchUrl;	}
+
+protected:
+    virtual BOOL OnSetCursor();
+    virtual void OnClick(CPoint PointCellRelative);
+
+	BOOL HasUrl(CString str);
+    BOOL OverURL(CPoint& pt, CString& strURL);
+
+protected:
+#ifndef _WIN32_WCE
+    static HCURSOR g_hLinkCursor;		// Hyperlink mouse cursor
+	HCURSOR GetHandCursor();
+#endif
+    static URLStruct g_szURIprefixes[];
+
+protected:
+	COLORREF m_clrUrl;
+	BOOL     m_bLaunchUrl;
+    CRect    m_Rect;
+};
+
+#endif // !defined(AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_)
diff --git a/Common_Class/SISControls/GridControl/TitleTip.cpp b/Common_Class/SISControls/GridControl/TitleTip.cpp
new file mode 100644
index 0000000..2bb9eda
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/TitleTip.cpp
@@ -0,0 +1,341 @@
+////////////////////////////////////////////////////////////////////////////
+// TitleTip.cpp : implementation file
+//
+// Based on code by Zafir Anjum
+//
+// Adapted by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2002. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+// History
+//         10 Apr 1999  Now accepts a LOGFONT pointer and 
+//                      a tracking rect in Show(...)  (Chris Maunder)
+//         18 Apr 1999  Resource leak in Show fixed by Daniel Gehriger
+//          8 Mar 2000  Added double-click fix found on codeguru
+//                      web site but forgot / can't find who contributed it
+//         28 Mar 2000  Aqiruse (marked with //FNA)
+//                      Titletips now use cell color
+//         18 Jun 2000  Delayed window creation added
+//
+/////////////////////////////////////////////////////////////////////////////
+ 
+#include "..\\stdafx.h"
+#include "gridctrl.h"
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+
+#include "TitleTip.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CTitleTip
+
+CTitleTip::CTitleTip()
+{
+	// Register the window class if it has not already been registered.
+	WNDCLASS wndcls;
+	HINSTANCE hInst = AfxGetInstanceHandle();
+	if(!(::GetClassInfo(hInst, TITLETIP_CLASSNAME, &wndcls)))
+	{
+		// otherwise we need to register a new class
+		wndcls.style			= CS_SAVEBITS;
+		wndcls.lpfnWndProc		= ::DefWindowProc;
+		wndcls.cbClsExtra		= wndcls.cbWndExtra = 0;
+		wndcls.hInstance		= hInst;
+		wndcls.hIcon			= NULL;
+		wndcls.hCursor			= LoadCursor( hInst, IDC_ARROW );
+		wndcls.hbrBackground	= (HBRUSH)(COLOR_INFOBK +1);
+		wndcls.lpszMenuName		= NULL;
+		wndcls.lpszClassName	= TITLETIP_CLASSNAME;
+
+		if (!AfxRegisterClass(&wndcls))
+			AfxThrowResourceException();
+	}
+
+    m_dwLastLButtonDown = ULONG_MAX;
+    m_dwDblClickMsecs   = GetDoubleClickTime();
+    m_bCreated          = FALSE;
+    m_pParentWnd        = NULL;
+}
+
+CTitleTip::~CTitleTip()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CTitleTip, CWnd)
+	//{{AFX_MSG_MAP(CTitleTip)
+	ON_WM_MOUSEMOVE()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CTitleTip message handlers
+
+BOOL CTitleTip::Create(CWnd * pParentWnd)
+{
+//	ASSERT_VALID(pParentWnd);
+
+    // Already created?
+    if (m_bCreated)
+        return TRUE;
+
+	DWORD dwStyle = WS_BORDER | WS_POPUP; 
+	DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
+	m_pParentWnd = pParentWnd;
+
+	m_bCreated = CreateEx(dwExStyle, TITLETIP_CLASSNAME, NULL, dwStyle, 
+                          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
+		                  NULL, NULL, NULL );
+
+    return m_bCreated;
+}
+
+BOOL CTitleTip::DestroyWindow() 
+{
+    m_bCreated = FALSE;
+	
+	return CWnd::DestroyWindow();
+}
+
+// Show 		 - Show the titletip if needed
+// rectTitle	 - The rectangle within which the original 
+//				    title is constrained - in client coordinates
+// lpszTitleText - The text to be displayed
+// xoffset		 - Number of pixel that the text is offset from
+//				   left border of the cell
+void CTitleTip::Show(CRect rectTitle, LPCTSTR lpszTitleText, int xoffset /*=0*/,
+                     LPRECT lpHoverRect /*=NULL*/,
+                     const LOGFONT* lpLogFont /*=NULL*/,
+                     COLORREF crTextClr /* CLR_DEFAULT */,
+                     COLORREF crBackClr /* CLR_DEFAULT */)
+{
+    if (!IsWindow(m_hWnd))
+        Create(m_pParentWnd);
+
+//	ASSERT( ::IsWindow( GetSafeHwnd() ) );
+
+    if (rectTitle.IsRectEmpty())
+        return;
+
+	// If titletip is already displayed, don't do anything.
+	if( IsWindowVisible() ) 
+		return;
+
+    m_rectHover = (lpHoverRect != NULL)? lpHoverRect : rectTitle;
+    m_rectHover.right++; m_rectHover.bottom++;
+
+	m_pParentWnd->ClientToScreen( m_rectHover );
+    ScreenToClient( m_rectHover );
+
+	// Do not display the titletip is app does not have focus
+	if( GetFocus() == NULL )
+		return;
+
+	// Define the rectangle outside which the titletip will be hidden.
+	// We add a buffer of one pixel around the rectangle
+	m_rectTitle.top    = -1;
+	m_rectTitle.left   = -xoffset-1;
+	m_rectTitle.right  = rectTitle.Width()-xoffset;
+	m_rectTitle.bottom = rectTitle.Height()+1;
+
+	// Determine the width of the text
+	m_pParentWnd->ClientToScreen( rectTitle );
+
+	CClientDC dc(this);
+	CString strTitle = _T("");
+    strTitle += _T(" ");
+    strTitle += lpszTitleText; 
+    strTitle += _T(" ");
+
+	CFont font, *pOldFont = NULL;
+    if (lpLogFont)
+    {
+        font.CreateFontIndirect(lpLogFont);
+	    pOldFont = dc.SelectObject( &font );
+    }
+    else
+    {
+        // use same font as ctrl
+	    pOldFont = dc.SelectObject( m_pParentWnd->GetFont() );
+    }
+
+	CSize size = dc.GetTextExtent( strTitle );
+
+    TEXTMETRIC tm;
+    dc.GetTextMetrics(&tm);
+    size.cx += tm.tmOverhang;
+
+	CRect rectDisplay = rectTitle;
+	rectDisplay.left += xoffset;
+	rectDisplay.right = rectDisplay.left + size.cx + xoffset;
+    
+    // Do not display if the text fits within available space
+    if ( rectDisplay.right > rectTitle.right-xoffset )
+    {
+		// Show the titletip
+        SetWindowPos( &wndTop, rectDisplay.left, rectDisplay.top, 
+            rectDisplay.Width(), rectDisplay.Height(), 
+            SWP_SHOWWINDOW|SWP_NOACTIVATE );
+        
+        // FNA - handle colors correctly
+        if (crBackClr != CLR_DEFAULT)
+        {
+		    CBrush backBrush(crBackClr);
+		    CBrush* pOldBrush = dc.SelectObject(&backBrush);
+		    CRect rect;
+		    dc.GetClipBox(&rect);     // Erase the area needed 
+
+		    dc.PatBlt(rect.left, rect.top, rect.Width(), rect.Height(),  PATCOPY);
+		    dc.SelectObject(pOldBrush);
+	    }
+        // Set color
+        if (crTextClr != CLR_DEFAULT)//FNA
+            dc.SetTextColor(crTextClr);//FA
+
+        dc.SetBkMode( TRANSPARENT );
+        dc.TextOut( 0, 0, strTitle );
+        SetCapture();
+    }
+    
+    dc.SelectObject( pOldFont );
+}
+
+void CTitleTip::Hide()
+{
+  	if (!::IsWindow(GetSafeHwnd()))
+        return;
+
+    if (GetCapture()->GetSafeHwnd() == GetSafeHwnd())
+        ReleaseCapture();
+
+	ShowWindow( SW_HIDE );
+}
+
+void CTitleTip::OnMouseMove(UINT nFlags, CPoint point) 
+{
+    if (!m_rectHover.PtInRect(point)) 
+    {
+        Hide();
+        
+        // Forward the message
+        ClientToScreen( &point );
+        CWnd *pWnd = WindowFromPoint( point );
+        if ( pWnd == this ) 
+            pWnd = m_pParentWnd;
+        
+        int hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y));
+        
+        if (hittest == HTCLIENT) {
+            pWnd->ScreenToClient( &point );
+            pWnd->PostMessage( WM_MOUSEMOVE, nFlags, MAKELONG(point.x,point.y) );
+        } else {
+            pWnd->PostMessage( WM_NCMOUSEMOVE, hittest, MAKELONG(point.x,point.y) );
+        }
+    }
+}
+
+BOOL CTitleTip::PreTranslateMessage(MSG* pMsg) 
+{
+    // Used to qualify WM_LBUTTONDOWN messages as double-clicks
+    DWORD dwTick=0;
+    BOOL bDoubleClick=FALSE;
+
+    CWnd *pWnd;
+	int hittest;
+	switch (pMsg->message)
+	{
+	case WM_LBUTTONDOWN:
+       // Get tick count since last LButtonDown
+        dwTick = GetTickCount();
+        bDoubleClick = ((dwTick - m_dwLastLButtonDown) <= m_dwDblClickMsecs);
+        m_dwLastLButtonDown = dwTick;
+        // NOTE: DO NOT ADD break; STATEMENT HERE! Let code fall through
+
+	case WM_RBUTTONDOWN:
+	case WM_MBUTTONDOWN:
+		{
+		POINTS pts = MAKEPOINTS( pMsg->lParam );
+		POINT  point;
+		point.x = pts.x;
+		point.y = pts.y;
+
+		ClientToScreen( &point );
+        Hide();
+
+		pWnd = WindowFromPoint( point );
+		if (!pWnd)
+			return CWnd::PreTranslateMessage(pMsg);
+
+		if( pWnd->GetSafeHwnd() == GetSafeHwnd()) 
+			pWnd = m_pParentWnd;
+
+		hittest = (int)pWnd->SendMessage(WM_NCHITTEST,0,MAKELONG(point.x,point.y));
+
+		if (hittest == HTCLIENT) 
+		{
+			pWnd->ScreenToClient( &point );
+			pMsg->lParam = MAKELONG(point.x,point.y);
+		}
+		else 
+		{
+			switch (pMsg->message) {
+			case WM_LBUTTONDOWN: 
+				pMsg->message = WM_NCLBUTTONDOWN;
+				break;
+			case WM_RBUTTONDOWN: 
+				pMsg->message = WM_NCRBUTTONDOWN;
+				break;
+			case WM_MBUTTONDOWN: 
+				pMsg->message = WM_NCMBUTTONDOWN;
+				break;
+			}
+			pMsg->wParam = hittest;
+			pMsg->lParam = MAKELONG(point.x,point.y);
+		}
+
+
+        // If this is the 2nd WM_LBUTTONDOWN in x milliseconds,
+        // post a WM_LBUTTONDBLCLK message instead of a single click.
+        pWnd->PostMessage(  bDoubleClick ? WM_LBUTTONDBLCLK : pMsg->message,
+                            pMsg->wParam,
+                            pMsg->lParam);
+		return TRUE;
+		}
+		
+	case WM_KEYDOWN:
+	case WM_SYSKEYDOWN:
+        Hide();
+		m_pParentWnd->PostMessage( pMsg->message, pMsg->wParam, pMsg->lParam );
+		return TRUE;
+	}
+
+	if( GetFocus() == NULL )
+	{
+        Hide();
+		return TRUE;
+	}
+
+	return CWnd::PreTranslateMessage(pMsg);
+}
+
+#endif // GRIDCONTROL_NO_TITLETIPS
\ No newline at end of file
diff --git a/Common_Class/SISControls/GridControl/TitleTip.h b/Common_Class/SISControls/GridControl/TitleTip.h
new file mode 100644
index 0000000..3894a4f
--- /dev/null
+++ b/Common_Class/SISControls/GridControl/TitleTip.h
@@ -0,0 +1,87 @@
+/////////////////////////////////////////////////////////////////////////////
+// Titletip.h : header file
+//
+// MFC Grid Control - cell titletips
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#define TITLETIP_CLASSNAME _T("ZTitleTip")
+
+/////////////////////////////////////////////////////////////////////////////
+// CTitleTip window
+
+class AFX_EXT_CLASS CTitleTip : public CWnd
+{
+// Construction
+public:
+	CTitleTip();
+	virtual ~CTitleTip();
+	virtual BOOL Create( CWnd *pParentWnd);
+
+// Attributes
+public:
+    void SetParentWnd(CWnd* pParentWnd)  { m_pParentWnd = pParentWnd; }
+    CWnd* GetParentWnd()                 { return m_pParentWnd;       }
+
+// Operations
+public:
+	void Show(CRect rectTitle, LPCTSTR lpszTitleText, 
+              int xoffset = 0, LPRECT lpHoverRect = NULL, 
+              const LOGFONT* lpLogFont = NULL,
+              COLORREF crTextClr = CLR_DEFAULT, COLORREF crBackClr = CLR_DEFAULT);
+    void Hide();
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CTitleTip)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL DestroyWindow();
+	//}}AFX_VIRTUAL
+
+// Implementation
+protected:
+	CWnd  *m_pParentWnd;
+	CRect  m_rectTitle;
+    CRect  m_rectHover;
+    DWORD  m_dwLastLButtonDown;
+    DWORD  m_dwDblClickMsecs;
+    BOOL   m_bCreated;
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CTitleTip)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/SISControls/HeadCtrl.cpp b/Common_Class/SISControls/HeadCtrl.cpp
new file mode 100644
index 0000000..68a2ed4
--- /dev/null
+++ b/Common_Class/SISControls/HeadCtrl.cpp
@@ -0,0 +1,293 @@
+// HeadCtrl.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "HeadCtrl.h"
+#include "CellCtrl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#define NORML		0x00000000
+#define MERGE		0x00000001
+#define UNUSE		0x00000002
+
+#define SetFlag(n)  DWORD(BYTE(n)<<16)
+#define GetFlag(d)  int((d & 0x00FF0000)>>16)
+#define SetDown(n)  DWORD(BYTE(n)<<8)
+#define GetDown(d)  int((d & 0x0000FF00)>>8)
+#define SetRight(n) DWORD(BYTE(n))
+#define GetRight(d) int((d & 0x000000FF))
+/////////////////////////////////////////////////////////////////////////////
+// CHeadCtrl
+
+CHeadCtrl::CHeadCtrl()
+{
+	m_bclick=FALSE;
+	m_count=1;
+	m_Info.SetSize(1);
+}
+
+CHeadCtrl::~CHeadCtrl()
+{
+	m_Info.RemoveAll();
+}
+
+
+BEGIN_MESSAGE_MAP(CHeadCtrl, CHeaderCtrl)
+	//{{AFX_MSG_MAP(CHeadCtrl)
+	ON_WM_LBUTTONDBLCLK()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_PAINT()
+	ON_WM_LBUTTONUP()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CHeadCtrl message handlers
+
+int  CHeadCtrl::GetHeadHeight()
+{
+	CRect rect;
+	GetItemRect(0, &rect);
+	return rect.Height();
+}
+
+void CHeadCtrl::SetCount(int nCount, CFont* pFont)
+{
+	LOGFONT logfont;
+	pFont->GetLogFont(&logfont);
+	m_count=nCount;
+	FontChange(logfont);
+	m_Info.SetSize(nCount);
+}
+
+void CHeadCtrl::DeleteColumn(int nCol)
+{
+	int nSize = static_cast<int>(m_Info.GetSize());
+	for( int i=0; i<nSize; i++)
+	{
+		if(m_Info[i].GetSize()>nCol)
+			m_Info[i].RemoveAt(nCol);
+	}
+}
+
+void CHeadCtrl::FontChange(LOGFONT logfont)
+{
+	if(m_font.GetSafeHandle())
+		m_font.DeleteObject();
+
+	CFont  font;
+
+	m_font.CreateFontIndirect(&logfont);
+	
+	logfont.lfHeight-=m_count;
+	logfont.lfHeight*=m_count;
+
+	font.CreateFontIndirect(&logfont);
+	SetFont(&font);
+	
+	font.DeleteObject();
+}
+
+void CHeadCtrl::InsertColumn(int nCol)
+{
+	for( int i=0; i<m_count; i++)
+	{
+		CHeadCell hCell;
+		m_Info[i].SetAtGrow(nCol, hCell);
+	}
+}
+
+BOOL CHeadCtrl::SetItemText(int nItem, int nSubItem, LPCSTR lpcstr)
+{
+	if(m_Info.GetSize()<=nItem)
+		return 0;
+	if(m_Info[nItem].GetSize()<=nSubItem)
+		return 0;
+
+	m_Info[nItem][nSubItem].string=lpcstr;
+	return 1;
+}
+
+CString CHeadCtrl::GetItemText(int nItem, int nSubItem)
+{
+	if(m_Info.GetSize()<=nItem)
+		return "";
+	if(m_Info[nItem].GetSize()<=nSubItem)
+		return "";
+
+	return m_Info[nItem][nSubItem].string;
+}
+
+BOOL CHeadCtrl::GetRect(int nItem, int nSubItem, CRect& rect)
+{
+	CRect rectTemp;
+	int down=0;
+	int right=0;
+	int nHeight=0;
+	int nWidth=0;
+	UINT nFlag=GetItemState(nItem, nSubItem, down, right);
+
+	if(nFlag==UNUSE)
+		return 0;
+
+	GetItemRect(nSubItem, &rect);
+	nHeight = rect.Height()/m_count;
+	rect.top   = nHeight * nItem ;
+	rect.bottom= rect.top + ( nHeight * (down+1));
+
+	for( int i=nSubItem+1; i<= nSubItem + right; i++)
+	{
+		GetItemRect(i, &rectTemp);
+		nWidth += rectTemp.Width();
+	}
+	rect.right = rect.right + nWidth;
+
+	return 1;
+}
+
+BOOL CHeadCtrl::SetItemMerge(int nsItem, int nsSubItem, int neItem, int neSubItem)
+{
+	if(m_Info.GetSize()<=neItem)	return 0;
+	if(m_Info[neItem].GetSize()<=neSubItem)return 0;
+
+	for( int i=nsItem; i<=neItem; i++)
+	{
+		for( int j=nsSubItem; j<=neSubItem; j++)
+		{
+			if(i==nsItem && j==nsSubItem)
+				m_Info[i][j].state= SetFlag(MERGE) | 
+									SetDown(neItem-nsItem) | 
+									SetRight(neSubItem-nsSubItem);
+			else
+				m_Info[i][j].state=SetFlag(UNUSE);
+		}
+	}
+	return 1;
+}
+
+UINT CHeadCtrl::GetItemState(int nItem, int nSubItem, int& down, int& right) 
+{
+	if(m_Info.GetSize()<=nItem)
+		return 0;
+	if(m_Info[nItem].GetSize()<=nSubItem)
+		return 0;
+	DWORD dw = m_Info[nItem][nSubItem].state;
+	down =GetDown(dw);
+	right=GetRight(dw);
+
+	return GetFlag(dw);
+}
+
+void CHeadCtrl::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	CFont* pOldFont = NULL;
+	dc.SetBkMode(TRANSPARENT   );
+
+	if(!m_font.GetSafeHandle())
+	{
+		pOldFont = dc.SelectObject(&m_font);
+	}
+	dc.SetBkColor(RGB(255,0,0));
+	for( int i=0; i<m_count; i++)
+	{
+		for( int j=0; j<GetItemCount(); j++)
+		{
+			CRect rect;
+			if(!GetRect(i, j, rect ))
+				continue;
+			if(!IsDraw(rect))
+				continue;
+			CString strText = GetItemText(i, j);
+
+			if( rect.left<m_pnt.x && rect.right>m_pnt.x &&
+				rect.top<m_pnt.y && rect.bottom>m_pnt.y && m_bclick)
+			{
+				dc.DrawEdge( &rect, EDGE_SUNKEN, BF_RECT | BF_SOFT);
+			}
+			else
+			{
+				dc.DrawEdge( &rect, EDGE_RAISED, BF_RECT | BF_SOFT);
+			}
+
+			BOOL bMulti = GetTextRect(&dc, strText, rect);
+			if(bMulti)
+			{
+				dc.DrawText( strText, -1, rect, 
+					DT_CENTER | DT_VCENTER );
+			}
+			else
+			{
+				dc.DrawText( strText, -1, rect, 
+					DT_CENTER | DT_SINGLELINE | DT_VCENTER );
+			}
+		}
+	}
+	if(pOldFont)
+		dc.SelectObject(pOldFont);
+}
+
+BOOL CHeadCtrl::GetTextRect(CDC* pDC, CString strText, CRect& rect)
+{
+	int nCount=1, nStart=0;
+	TEXTMETRIC metrics;
+	while(1)
+	{
+		nStart = strText.Find('\n', nStart)+1;
+		if(nStart < 1)	break;
+		nCount++;
+	}
+
+	if(nCount==1)	
+		return 0;
+
+	pDC->GetOutputTextMetrics(&metrics) ;
+	rect.top += ((rect.Height() - metrics.tmHeight * nCount)/2);
+	return 1;
+}
+
+BOOL CHeadCtrl::IsDraw(CRect rect)
+{
+	CRect rectCC;
+	CCellCtrl* pCC=(CCellCtrl*)GetParent();
+	pCC->GetClientRect(&rectCC);
+
+	int nPos = pCC->GetScrollPos(SB_HORZ);
+
+	if(nPos>rect.right)
+		return 0;
+	if((nPos+rectCC.Width())<rect.left)
+		return 0;
+	return 1;
+}
+
+void CHeadCtrl::OnLButtonDblClk(UINT nFlags, CPoint point) 
+{
+	Invalidate();
+	CHeaderCtrl::OnLButtonDblClk(nFlags, point);
+}
+
+void CHeadCtrl::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	if(!m_bclick)
+	{
+		m_bclick=TRUE;
+		m_pnt=point;
+	}
+	CHeaderCtrl::OnLButtonDown(nFlags, point);
+}
+
+void CHeadCtrl::OnLButtonUp(UINT nFlags, CPoint point) 
+{
+	if(m_bclick)
+	{
+		m_bclick=FALSE;
+		Invalidate();
+	}
+	CHeaderCtrl::OnLButtonUp(nFlags, point);
+}
diff --git a/Common_Class/SISControls/Header/CellCtrl.h b/Common_Class/SISControls/Header/CellCtrl.h
new file mode 100644
index 0000000..b8bc378
--- /dev/null
+++ b/Common_Class/SISControls/Header/CellCtrl.h
@@ -0,0 +1,304 @@
+#ifndef _CELLCTRL_H_
+#define _CELLCTRL_H_
+#define _CELLCTRL_LIB_H_
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// CellCtrl.h : header file
+//
+#include "HeadCtrl.h"
+
+#ifndef  __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CCellCtrl window
+#define CCMSG_USE_EDIT			WM_USER+1
+#define CCMSG_MOVE_EDIT			WM_USER+2
+#define CCMSG_RECT_CHANGE		WM_USER+3
+//#define CCMSG_SEL_PRINT		WM_USER+4
+#define CCMSG_LIST_PRINT		WM_USER+5
+#define CCMSG_FONT_CHANGE		WM_USER+6
+#define CCMSG_SAVE_FILE			WM_USER+7
+#define CCMSG_OPEN_EXCEL		WM_USER+8
+#define CCMSG_OPEN_LIST			WM_USER+9
+#define CCMSG_MODIFY_EDIT		WM_USER+10
+#define CCMSG_COPY_CLIPBOARD	WM_USER+11
+#define CCMSG_PASTE_CLIPBOARD	WM_USER+12
+#define CCMSG_CUT_CLIPBOARD		WM_USER+13
+#define CCMSG_SELITEM_DELETE	WM_USER+14
+#define CCMSG_BACK_COLOR		WM_USER+15
+#define CCMSG_TEXT_COLOR		WM_USER+16
+#define CCMSG_LIST				WM_USER-1
+
+const COLORREF clrTEXT=0x00000000;
+const COLORREF clrBACK=0x00FFFFFF;
+
+class AFX_EXT_CLASS CCellCtrl : public CListCtrl
+{
+public:
+	struct LOCATION
+	{
+		int nItem;
+		int nSubItem;
+	};
+
+	struct CELLCOLOR
+	{
+		COLORREF txtclr;
+		COLORREF bkgclr;
+	};
+
+	struct CELLINFO
+	{
+		int nId;			//CONTROL ID
+		int nItem;			//LIST ITEM
+		int nSubItem;		//LIST SUBITEM
+		CELLCOLOR oldClr;	//汲沥傈狼 祸
+		CELLCOLOR newClr;	//汲沥饶狼 祸
+		LPWSTR lpstrOld;	//涝仿傈 巩磊凯
+		LPWSTR lpstrNew;	//涝仿茄 巩磊凯
+	};
+
+	struct CELLDATA
+	{
+		COLORREF txtclr;//臂磊祸
+		COLORREF bkgclr;//硅版祸
+		bool	 bUseCtl;//牧飘费 荤侩
+		bool	 bTurn; //馆娄馆娄
+		DWORD    dwData;
+	};
+
+	class CCellData : public CELLDATA
+	{
+	public:
+		CCellData()
+		{
+			bTurn =false;
+			bUseCtl=false;//牧飘费 荤侩
+			txtclr=clrTEXT;
+			bkgclr=clrBACK;
+			dwData=0;
+		}
+
+		CCellData(COLORREF TextColor, COLORREF BackColor,
+				  bool bTurning, DWORD dwUserData=0)
+		{
+			bTurn =bTurning;
+			bUseCtl=false;//牧飘费 荤侩
+			txtclr=TextColor;
+			bkgclr=BackColor;
+			dwData=dwUserData;
+		}
+		virtual ~CCellData(){;}
+		void operator=(const CELLDATA& cc)
+		{
+			(CELLDATA)*this=cc;	
+		}
+	};
+	typedef CArray<CCellData, CCellData&> CCSArray;
+	virtual void SerializeAllInfo(CArchive& ar);
+
+protected:
+	CBrush m_brush;		//俊叼飘冠胶狼 硅版
+	CEdit  m_edit;		//俊叼飘 冠胶
+	BOOL	m_bCanEdit;
+	CFont* m_pFont;		//府胶飘 迄飘
+
+protected:
+	void Printing(CDC* pDC);//府胶飘甫 橇赴飘肺 免仿茄促.
+	CRect GetLogRect(CDC* pDC, int nItem, int nSubItem);//府胶飘 伎Rect阑 厚啦俊 蝶扼 函券茄促.
+	void SetCrtToPrintRate(CDC* pDC);//拳搁苞 厘钎狼 厚啦阑 备茄促.
+	int  GetCrtWidth();//拳搁(府胶飘)狼 气蔼阑 府畔茄促.
+
+protected:
+	BOOL m_bSort;//Sort Flag
+	BOOL m_bTime;//SetTimer(,,)甫 汲沥沁绰瘤 咯何
+	BOOL m_bTurnDraw;//府胶飘 盎脚矫 伎狼 祸彬捞 函秦具窍绰瘤 咯何
+	UINT  m_nClipOptin;//努赋焊靛 可记
+	CHeadCtrl m_head;//HeaderCtrl
+	LOCATION m_mcLct;//right mouse click
+	LOCATION m_edLct;//edit location
+	UINT m_nStartColEdit;
+	UINT m_nEndColEdit;
+	CMenu m_menu;//府胶飘 皋春 
+	CMenu* m_pUmenu;//荤侩磊 沥狼 皋春
+	CELLINFO* m_pInfo;
+
+	//汲沥等 Item Data甫 昏力茄促.
+	void DeleteItemData(int nItem);
+	void DeleteAllItemData();
+
+	//俊叼飘冠胶狼 Data甫 荐沥沁绰瘤 咯何甫 眉农窍绊 
+	//何葛扩档快肺 皋矫瘤甫 焊辰促.
+	BOOL IsModifyEdit(int nItem, int nSubItem);
+
+	//酒捞袍狼 康开捞 函沁阑 版快俊 俊叼飘冠胶狼 农扁档 函秦具 窍骨肺
+	//促澜窃荐甫 捞侩窍咯 俊叼飘冠胶甫 盎脚茄促.
+	void UpdateEdit(int nItem, int nSubItem);
+
+	//伎狼 康开阑 盎脚茄促.
+	void UpdateCell(int nItem, int nSubItem);
+
+	//伎狼 拿矾啊 函窍档废 汲沥登绢 乐绰瘤 咯何
+	bool IsTurning(int nItem, int nSubItem);
+
+	//府胶飘狼 沥纺 left,right,center 屈侥阑 备茄促.
+	int  GetColumnFmt(int nSubItem);	
+
+public:
+	enum ListOption
+	{
+		//MENU OPTION
+		menuNO		=	0x00000000,
+		menuEXCEL	=	0x00000001,
+		menuLIST	=	0x00000002,
+		menuPRINT	=	0x00000004,
+		menuINPUT	=	0x00000010,
+		menuSAVE	=	0x00000020,
+		menuFONT	=	0x00000040,
+		menuBACKCOLOR=	0x00000100,
+		menuTEXTCOLOR=	0x00000200,
+		menuCOPY	=	0x00010000,
+		menuPASTE	=	0x00020000,
+		menuCUT		=	0x00040000,
+		menuDELETE	=	0x00080000,
+		menuCOMMON	=	0x000000FF,
+		menuCLIP	=	0x000F0000,
+		menuALL		=	0x000FFFFF,
+		menuAceept  =   0x00010000,
+
+		//CLIPBOARD OPTION
+		clipNO		=	0x00000000,
+		clipCOPY	=	0x00000001,
+		clipPASTE	=	0x00000002,
+		clipCUT		=	0x00000004,
+		clipDELETE	=	0x00000008,
+		clipALL		=	0x0000FFFF,
+	};
+	CCellCtrl();
+
+	//Sort function
+	void EnableSort(BOOL bSort=TRUE){m_bSort=bSort;}
+	void EnableEdit(BOOL bCanEdit)	{ m_bCanEdit = bCanEdit; }
+
+	//menu function
+	BOOL CCellCtrl::SetMenu(CMenu* pMenu=NULL){m_pUmenu=pMenu; return TRUE;}
+	void UseMenu( UINT nOption=menuCOMMON/*default=menuCOMMON*/);
+
+	//editbox function
+	BOOL SetEditMovable( int nStartCol, int nEndCol);
+	BOOL UseEdit( int nItem, int nSubItem);
+	void EditCtrl( MSG pMsg );
+
+	//Rect捞 函沁绰瘤 魄窜茄促.
+	BOOL IsSubRectChange();	
+
+	//府胶飘甫 橇赴飘肺 免仿茄促.
+	BOOL ListPrinting(BOOL bDialog, int Orientation=1/*啊肺=1, 技肺=2*/);
+
+	//keystate function 
+	BOOL IsMultiKey();//shift虐, ctrl虐殿捞 喘矾脸绰瘤 check茄促
+
+	//font function
+	void SetLogFont(LOGFONT logfont);//厘钎 迄飘
+	void SetListFont(LOGFONT* logfont);//府胶飘 迄飘
+
+	//
+	int GetSubItemCount();		//拿烦荐甫 备茄促.
+	int GetLeftSubItem();		//谅螟栏肺何磐 劝己拳等 拿烦阑 茫绰促.
+	int GetRightSubItem();		//快螟栏肺何磐 劝己拳等 拿烦阑 茫绰促.
+	
+	//荤侩磊啊 鞘夸茄 蔼阑 历厘窍绊 阂矾棵荐 乐绰 窃荐捞促.
+	BOOL SetCellData(int nItem, int nSubItem, DWORD dwData);
+	DWORD GetCellData(int nItem, int nSubItem);
+
+	//color function
+	BOOL SetItemTextColor(int nItem, COLORREF color);
+	BOOL SetItemTextColor(int nItem, int nSubItem, COLORREF color);
+	BOOL SetItemBkColor(int nItem, COLORREF color, bool bTurn=false);
+	BOOL SetItemBkColor(int nItem, int nSubItem, COLORREF color, bool bTurn=false);
+	BOOL GetItemColor(int nItem, int nSubItem, CELLCOLOR* pCellClr);
+
+	//Clipboard function
+	void UseClipboard( UINT nOption=clipALL/*default=clipALL*/){m_nClipOptin=nOption;}
+	void CopyClipboard();// Ctrl C (select item copy)
+	void PasteClipboard();//Ctrl V (paste)
+	void CutClipboard();//Ctrl V (paste)
+	void SelectItemDelete();
+
+	BOOL DeleteColumn( int nCol );
+	int  InsertColumn(int nCol, LPCTSTR lpstTxt,int nFormat=LVCFMT_LEFT, 
+						int nWidth = -1, int nSubItem = -1);
+
+	//HeaderCtrl function
+	BOOL GetSafeHead();
+	int  GetHeadHeight();
+	int  GetHeadItemCount();
+	void SetHeadItemCount(int nCount);
+	void SetHeadItemText(int nItem, int nSubItem, LPCTSTR lpstTxt);
+	CString GetHeadItemText(int nItem, int nSubItem);
+	void SetHeadItemMerge(int nsItem, int nsSubItem, 
+						  int neItem, int neSubItem);
+
+protected:
+
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CCellCtrl)
+	public:
+	virtual void Serialize(CArchive& ar);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	protected:
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	void SaveFile();
+	virtual ~CCellCtrl();
+
+	// Generated message map functions
+protected:
+
+	//{{AFX_MSG(CCellCtrl)
+//	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
+	afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	afx_msg void OnInsertitem(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnDeleteallitems(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnDestroy();
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+	afx_msg void OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult );
+	afx_msg void OnSaveFile();
+	afx_msg void OnOpenExcel();
+	afx_msg void OnOpenList();
+	afx_msg void OnUseEdit();
+	afx_msg void OnMoveEdit();
+	afx_msg void OnRectchange();
+	afx_msg void OnListPrint();
+	afx_msg void OnFontChange();
+	afx_msg void OnBackColor();
+	afx_msg void OnTextColor();
+
+	afx_msg void OnCopyClipboard()	{	CopyClipboard();	}
+	afx_msg void OnPasteClipboard()	{	PasteClipboard();	}
+	afx_msg void OnCutClipboard()	{	CutClipboard();		}
+	afx_msg void OnSelItemDelete()	{	SelectItemDelete();	}
+
+	DECLARE_MESSAGE_MAP()
+};
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(_CELLCTRL_H_)
diff --git a/Common_Class/SISControls/Header/ColorButton.h b/Common_Class/SISControls/Header/ColorButton.h
new file mode 100644
index 0000000..65c1c8b
--- /dev/null
+++ b/Common_Class/SISControls/Header/ColorButton.h
@@ -0,0 +1,101 @@
+// Written by Marius Bancila (mbancila@yahoo.com)
+// Copyright (c) 2004.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name is included. If 
+// the source code in  this file is used in any commercial application 
+// then acknowledgement must be made to the author of this file 
+// (in whatever form you wish).
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
+// IN THE SOFTWARE.
+// 
+// Please use and enjoy. Please let me know of any bugs/mods/improvements 
+// that you have found/implemented and I will fix/incorporate them into this
+// file. 
+
+
+#if !defined(AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_)
+#define AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ColorButton.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CColorButton window
+
+class AFX_EXT_CLASS CColorButton : public CButton
+{
+private:
+	enum {	BUTTON_IN			= 0x01,
+			BUTTON_OUT			= 0x02,
+			BUTTON_BLACK_BORDER	= 0x04,};
+	
+// Construction
+public:
+	CColorButton();
+	CColorButton(COLORREF text, COLORREF bkgnd);
+	CColorButton(COLORREF text, COLORREF bkgnd, COLORREF disabled);
+	CColorButton(COLORREF text, COLORREF bkgnd, COLORREF disabled, COLORREF light, COLORREF highlight, COLORREF shadow, COLORREF darkShadow);
+	
+// Attributes
+public:
+
+private:
+	COLORREF m_TextColor;
+	COLORREF m_BkgndColor;
+	COLORREF m_DisabledBkgndColor;
+	COLORREF m_Light;
+	COLORREF m_Highlight;
+	COLORREF m_Shadow;
+	COLORREF m_DarkShadow;
+	
+// Operations
+public:
+	void SetColor(COLORREF text, COLORREF bkgnd);
+	void SetColor(COLORREF text, COLORREF bkgnd, COLORREF disabled);
+	void SetColor(COLORREF text, COLORREF bkgnd, COLORREF disabled, COLORREF light, COLORREF highlight, COLORREF shadow, COLORREF darkShadow);
+	void SetColorToWindowsDefault();
+	
+private:
+	void DrawFrame(CDC *pDC, CRect rc, int state);
+	void DrawFilledRect(CDC *pDC, CRect rc, COLORREF color);
+	void DrawLine(CDC *pDC, long sx, long sy, long ex, long ey, COLORREF color);
+	void DrawButtonText(CDC *pDC, CRect rc, CString strCaption, COLORREF textcolor);
+	
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CColorButton)
+	public:
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CColorButton();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CColorButton)
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/DefectMap.h b/Common_Class/SISControls/Header/DefectMap.h
new file mode 100644
index 0000000..b76f219
--- /dev/null
+++ b/Common_Class/SISControls/Header/DefectMap.h
@@ -0,0 +1,125 @@
+// DefectMap.h: interface for the CDefectMap class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_)
+#define AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define ORIGIN_LEFTTOP		1
+#define ORIGIN_LEFTBOTTOM	0
+#define ORIGIN_RIGHTTOP		2
+#define ORIGIN_RIGHTBOTTOM	3
+
+#define UM_MAP_CHANGED			5573
+
+#include "StaticMap.h"
+//enum OriginDirection		{ OD_LeftTop = 0, OD_RightTop = 1, OD_LeftBottom = 10, OD_RightBottom = 11 };
+
+class AFX_EXT_CLASS CDefectMap  : public CStatic
+{
+public:
+	CDefectMap();
+	virtual ~CDefectMap();
+
+public:
+	void				InitGlass(CWnd* pParent, int nMapWidth, int nMapHeight, int nMapMargin);	// Pixel 窜困 付柳.
+	void				DeinitGlass();
+	int					GetMapTotalWidth()		{ return m_nMapTotalWidth; }
+	int					GetMapTotalHeight()		{ return m_nMapTotalHeight; }
+	int					GetMapWidth()			{ return m_nMapWidth; }
+	int					GetMapHeight()			{ return m_nMapHeight; }
+	
+	void				SetMiniMap(BOOL bIsMiniMap, int nUnitSize)	{ m_bIsMiniMap = bIsMiniMap; m_nUnitSize = nUnitSize; }
+	int					GetUnitSize()			{ return m_nUnitSize; }
+	
+	virtual void		DrawGlass(CDC* pDC)						{ }
+	virtual void		MouseRBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnUp(CPoint& point)				{ }
+	virtual void		MouseLBtnMove(CPoint& point)			{ }
+	virtual void		MouseLBtnDblClk(CPoint& point)			{ }
+	virtual void		Timer(UINT_PTR nIDEvent)					{ }
+	
+	// 犬措/绵家
+	void				IncreaseRatio();
+	void				DecreaseRatio();
+	void				ResetRatio();
+	
+	CPoint&				GetDisplayStart()		{ return m_PointGlassStart; }
+	CPoint&				GetDisplayEnd()			{ return m_PointGlassEnd; }
+	
+	void				SetDisplayRect(CPoint& PointStart, CPoint& PointEnd);
+	void				SetShowShot(BOOL bShow)	{ m_bShowShot = bShow; }
+	
+	void				ConvertGlassToView(CRect &rect);
+	void				ConvertGlassToView(CPoint &pt);
+	CRect				ConvertViewToGlass(CRect &rect);
+	CPoint				ConvertViewToGlass(CPoint &pt);
+
+	// 历厘
+	void				SaveMapToFile(CString strFileName);
+	
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CStaticMap)
+	//}}AFX_VIRTUAL
+
+protected:
+	CWnd*				m_pParentWnd;
+	int					m_nMapTotalWidth;
+	int					m_nMapTotalHeight;
+	int					m_nMapWidth;
+	int					m_nMapHeight;
+	CRect				m_RectWnd;
+	CRect				m_RectMap;
+	
+	//////////////////////////////////////////////////////////////////////////
+	// 弊府扁 沥焊
+	HBITMAP				m_hDrawingSurface;
+	BITMAPINFOHEADER	m_BMIH;
+	CRect				m_RectDrawingSurface;
+	BYTE*				m_pDrawingSurfaceBits;
+	
+	OriginDirection		m_OriginDir;
+	int					m_nUnitSize;
+	
+	// Cell 弊府扁
+	BOOL				m_bShowShot;
+	
+	// 犬措/绵家
+	CRect				m_RectShowWnd;
+	
+	double				m_dWidthRatio;
+	double				m_dHeightRatio;
+	double				m_dRatio;
+	CPoint				m_PointWindowStart;
+	BOOL				m_bDragMove;
+	CPoint				m_PointDragStart;
+	BOOL				m_bIsMiniMap;			// Minimap篮 犬措/绵家甫 救茄促.
+	CPoint				m_PointGlassStart;		// Glass 吝 泅犁 焊咯瘤绰 康开.
+	CPoint				m_PointGlassEnd;
+	
+	CPoint				m_PointCCut[3];			//内呈钠 弊府扁 谅钎
+	int					m_nCCutSize;
+	int					m_nCoordGabX;			// 谅钎甫 谎副 芭府.
+	int					m_nCoordGabY;			// 谅钎甫 谎副 芭府.
+	
+	//{{AFX_MSG(CStaticGlass)
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg long OnUpdateMap(WPARAM wParam, LPARAM lParam);
+	//}}AFX_MSG
+	
+	DECLARE_MESSAGE_MAP()
+};
+
+#endif // !defined(AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/FontStatic.h b/Common_Class/SISControls/Header/FontStatic.h
new file mode 100644
index 0000000..35b2a33
--- /dev/null
+++ b/Common_Class/SISControls/Header/FontStatic.h
@@ -0,0 +1,69 @@
+#pragma once
+
+// Defines for the font style
+#define FS_NORMAL			0x00
+#define FS_BOLD				0x01
+#define FS_ITALIC			0x02
+#define FS_UNDERLINED		0x04
+#define FS_STRIKETHROUGH	0x08
+#define FS_ANTIALIAS		0x10
+
+// Defines for horizontal alignment
+#define FS_CENTER			0x20
+#define FS_LEFT				0x40
+#define FS_RIGHT			0x80
+
+// CFontStatic
+
+class AFX_EXT_CLASS CFontStatic : 
+	public CStatic
+{
+	DECLARE_DYNAMIC(CFontStatic)
+
+public:
+	CFontStatic();
+
+	// Attributes
+public:
+	bool m_bBold;
+	bool m_bItalic;
+	bool m_bUnderlined;
+	bool m_bStrikethrough;
+	bool m_bAntialias;
+	bool m_bBgColor;
+
+	bool m_bCenter;
+	bool m_bLeft;
+	bool m_bRight;
+
+	CString m_szText;
+	CString m_szFont;
+	DWORD m_dwColor;
+	DWORD m_dwBgColor;
+	int m_nSize;
+
+	// Operations
+public:
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CFontStatic)
+protected:
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+
+	// Implementation
+public:
+	void SetWindowText(LPCTSTR a_lpstr);
+	void SetFontStyle(DWORD dwStyle);
+	void SetBackground(DWORD dwBgColor);
+	void SetFontStatic(CString szFont, int nSize, DWORD dwColor, DWORD dwStyle);
+	virtual ~CFontStatic();
+
+protected:
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnPaint();
+};
+
+
diff --git a/Common_Class/SISControls/Header/GradientStatic.h b/Common_Class/SISControls/Header/GradientStatic.h
new file mode 100644
index 0000000..d7c72a7
--- /dev/null
+++ b/Common_Class/SISControls/Header/GradientStatic.h
@@ -0,0 +1,149 @@
+#pragma once
+
+
+// CGradientStatic
+typedef UINT (CALLBACK* LPFNDLLFUNC1)(HDC,CONST PTRIVERTEX,DWORD,CONST PVOID,DWORD,DWORD);
+
+class CDoubleBuff : public CDC {
+private:	
+	CBitmap		m_bitmap;		// Offscreen bitmap
+	CBitmap*	m_oldBitmap;	// bitmap originally found in CDoubleBuff
+	CDC*		m_pDC;			// Saves CDC passed in constructor
+	CRect		m_rect;			// Rectangle of drawing area.
+	BOOL		m_bMemDC;		// TRUE if CDC really is a Memory DC.
+public:
+
+	CDoubleBuff(CDC* pDC, const CRect* pRect = NULL) : CDC()
+	{
+		ASSERT(pDC != NULL); 
+
+		// Some initialization
+		m_pDC = pDC;
+		m_oldBitmap = NULL;
+		m_bMemDC = !pDC->IsPrinting();
+
+		// Get the rectangle to draw
+		if (pRect == NULL) {
+			pDC->GetClipBox(&m_rect);
+		} else {
+			m_rect = *pRect;
+		}
+
+		if (m_bMemDC) {
+			// Create a Memory DC
+			CreateCompatibleDC(pDC);
+			pDC->LPtoDP(&m_rect);
+
+			m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+			m_oldBitmap = SelectObject(&m_bitmap);
+
+			SetMapMode(pDC->GetMapMode());
+
+			SetWindowExt(pDC->GetWindowExt());
+			SetViewportExt(pDC->GetViewportExt());
+
+			pDC->DPtoLP(&m_rect);
+			SetWindowOrg(m_rect.left, m_rect.top);
+		} else {
+			// Make a copy of the relevent parts of the current DC for printing
+			m_bPrinting = pDC->m_bPrinting;
+			m_hDC       = pDC->m_hDC;
+			m_hAttribDC = pDC->m_hAttribDC;
+		}
+
+		// Fill background 
+		FillSolidRect(m_rect, pDC->GetBkColor());
+	}
+
+	virtual ~CDoubleBuff()	
+	{		
+		if (m_bMemDC) {
+			// Copy the offscreen bitmap onto the screen.
+			m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+				this, m_rect.left, m_rect.top, SRCCOPY);			
+
+			//Swap back the original bitmap.
+			SelectObject(m_oldBitmap);
+		} else {
+			// All we need to do is replace the DC with an illegal value,
+			// this keeps us from accidently deleting the handles associated with
+			// the CDC that was passed to the constructor.			
+			m_hDC = m_hAttribDC = NULL;
+		}	
+	}
+
+	// Allow usage as a pointer	
+	CDoubleBuff* operator->() 
+	{
+		return this;
+	}	
+
+	// Allow usage as a pointer	
+	operator CDoubleBuff*() 
+	{
+		return this;
+	}
+
+	CDC *GetOriginalDC()
+	{
+		return m_pDC;
+	}
+};
+
+class AFX_EXT_CLASS CGradientStatic : public CStatic
+{
+	DECLARE_DYNAMIC(CGradientStatic)
+
+public:
+	enum	EN_ANI_MODE{EN_ANI_NONE=0,EN_ANI_LEFTRIGHT,EN_ANI_LAMP};
+
+	CGradientStatic();
+	virtual ~CGradientStatic();
+	void SetWindowText(LPCTSTR a_lpstr);
+	void SetColor(long cl) {clLeft=cl;};
+	BOOL SetControlFont(int nHeight, int nWidth, int nEscapement,
+		int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline,
+		BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision,
+		BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily,
+		LPCTSTR lpszFacename);
+	void SetGradientColor(long cl) {clRight=cl; SetDrawColor(clLeft, clRight); };
+	void SetTextColor(long cl) {clText=cl;};
+	void SetReverseGradient();
+	void SetLeftSpacing(int iNoOfPixels) { m_iLeftSpacing = iNoOfPixels; };
+	void SetTextAlign(int iAlign ) { m_iAlign = iAlign; }; //0 - left, 1 - center, 2 -right
+	void SetVerticalGradient(BOOL a_bVertical = TRUE) { m_bVertical = a_bVertical; };
+	void SetOulineColor(long cl1, long cl2) { clOut1 = cl1; clOut2 = cl2; m_bDrawOutLine = TRUE; }
+	void SetDrawColor(long cl1, long cl2);
+	void MoveDrawColor();
+	void SetAnimationMode(int nMode, int nTime, int nIndex);
+	static void DrawGradRect(CDC *pDC, CRect r, COLORREF cLeft, COLORREF cRight, BOOL a_bVertical);
+	void DrawGradRect(CDC *pDC, CRect r, BOOL a_bVertical, COLORREF *cl);
+
+protected:
+	CString m_sTEXT;
+	int m_iLeftSpacing;
+	long clLeft;
+	long clRight;
+	long clText;
+	long clOut1;
+	long clOut2;
+	COLORREF clDrawColor[510];
+	int m_iAlign;
+	BOOL m_bDrawOutLine;
+	EN_ANI_MODE m_enAnimation;
+	int m_nAniColorCount;
+	HINSTANCE hinst_msimg32;
+	BOOL m_bCanDoGradientFill;
+	BOOL m_bVertical;
+	LPFNDLLFUNC1 dllfunc_GradientFill;
+
+	CFont m_font;
+
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+
+	DECLARE_MESSAGE_MAP()
+public:
+};
+
+
diff --git a/Common_Class/SISControls/Header/HeadCtrl.h b/Common_Class/SISControls/Header/HeadCtrl.h
new file mode 100644
index 0000000..a273989
--- /dev/null
+++ b/Common_Class/SISControls/Header/HeadCtrl.h
@@ -0,0 +1,104 @@
+#if !defined(AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_)
+#define AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// HeadCtrl.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CHeadCtrl window
+#ifndef __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+class AFX_EXT_CLASS CHeadCtrl : public CHeaderCtrl
+{
+// Construction
+public:
+	struct HEADCELL
+	{
+		DWORD   state;
+		CString string;
+	};
+	class CHeadCell : public HEADCELL
+	{
+	public:
+		CHeadCell()
+		{
+			state=0;
+			string="";
+		}
+		CHeadCell(HEADCELL& hcell)
+		{
+			*this=hcell;
+		}
+		CHeadCell operator=(HEADCELL& hcell)
+		{
+			state=hcell.state;
+			string=hcell.string;
+			return *this;
+		}
+	};
+
+	typedef CArray<CHeadCell,CHeadCell&> CHeadItem;
+	typedef CArray<CHeadItem,CHeadItem&> CHeadInfo;
+
+public:
+	CHeadCtrl();
+	void SetCount(int nCount, CFont* pFont);
+	int  GetCount(){return m_count;}
+	int  GetHeadHeight();
+
+
+	void InsertColumn(int nCol);
+	void DeleteColumn(int nCol);
+	void FontChange(LOGFONT logfont);
+	BOOL SetItemText(int nItem, int nSubItem, LPCSTR lpcstr);
+	CString GetItemText(int nItem, int nSubItem);
+	BOOL SetItemMerge(int nsItem, int nsSubItem, int neItem, int neSubItem); 
+	UINT GetItemState(int nItem, int nSubItem, int& down, int& right);
+	BOOL GetRect(int nItem, int nSubItem, CRect& rect);
+protected:
+	BOOL m_bclick;
+	CPoint m_pnt;
+
+	CFont m_font;
+	int m_count;
+	CHeadInfo m_Info;
+	BOOL IsDraw(CRect rect);
+	BOOL GetTextRect(CDC* pDC, CString strText, CRect& rect);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CHeadCtrl)
+	virtual void OnPaint();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CHeadCtrl();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CHeadCtrl)
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/InPlaceComboBox.h b/Common_Class/SISControls/Header/InPlaceComboBox.h
new file mode 100644
index 0000000..a8a1248
--- /dev/null
+++ b/Common_Class/SISControls/Header/InPlaceComboBox.h
@@ -0,0 +1,51 @@
+#if !defined(AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_)
+#define AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// InPlaceComboBox.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceComboBox window
+
+class AFX_EXT_CLASS CInPlaceComboBox : public CComboBox
+{
+// Construction
+public:
+	CInPlaceComboBox(int iItem,int iSubItem);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceComboBox)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceComboBox();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceComboBox)
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnSelchange();
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	//}}AFX_MSG
+	int m_iSubItem;
+	int m_iItem;
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/InPlaceEdit.h b/Common_Class/SISControls/Header/InPlaceEdit.h
new file mode 100644
index 0000000..e40b670
--- /dev/null
+++ b/Common_Class/SISControls/Header/InPlaceEdit.h
@@ -0,0 +1,59 @@
+#if !defined(AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_)
+#define AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// InPlaceEdit.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceEdit window
+
+class AFX_EXT_CLASS CInPlaceEdit : public CEdit
+{
+// Construction
+public:
+	CInPlaceEdit(int iItem, int iSubItem, CString sInitText);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceEdit)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	CString m_strNewValue;
+	virtual ~CInPlaceEdit();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceEdit)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnNcDestroy();
+	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+private:
+	BOOL m_bESC;
+	CString m_sInitText;
+	int m_iSubItem;
+	int m_iItem;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/LogCtrl.h b/Common_Class/SISControls/Header/LogCtrl.h
new file mode 100644
index 0000000..bcf41e5
--- /dev/null
+++ b/Common_Class/SISControls/Header/LogCtrl.h
@@ -0,0 +1,213 @@
+//LogCtrl.h
+//LogCtrl.h
+#ifndef __LOGCTRL_H
+#define __LOGCTRL_H
+#define __LOGCTRL_LIB_H
+
+#ifndef __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+//LOG CELL STATE
+//MERGE
+#define LCS_NORML		0x0000
+#define LCS_MERGE		0x0001
+#define LCS_UNUSE		0x0002
+
+//LINE
+#define LCS_TLINE		0x0001	//TOP LINE DRAW
+#define LCS_BLINE		0x0002	//BOTTOM LINE DRAW
+#define LCS_LLINE		0x0004	//LEFT LINE DRAW
+#define LCS_RLINE		0x0008	//RIGHT LINE DRAW
+#define LCS_RECT		LCS_TLINE|LCS_BLINE|LCS_LLINE|LCS_RLINE
+
+//merge state
+#define SetFlag(n)  DWORD(BYTE(n)<<16)
+#define GetFlag(d)  int((d & 0x00FF0000)>>16)
+
+#define SetDown(n)  DWORD(BYTE(n)<<8)
+#define GetDown(d)  int((d & 0x0000FF00)>>8)
+
+#define SetRight(n) DWORD(BYTE(n))
+#define GetRight(d) int((d & 0x000000FF))
+
+#define LOGCHECK(b) if(b){return;}
+#define LOGCHECK0(b) if(b){return 0;}
+#define LOGCHECK1(b) if(b){return -1;}
+
+class CPrintDC;
+class CLogCell;
+class CLogPage;
+class CLogCtrl;
+
+typedef CArray<CLogCell,CLogCell&> CLogItem;
+typedef CArray<CLogItem,CLogItem&> CLogItemArray;
+typedef CArray<CLogPage,CLogPage&> CLogPageArray;
+
+typedef struct tagLOGCELL
+{
+	BYTE		m_nLine; //惑窍谅快 扼牢 
+	UINT		m_nState;//促弗伎苞 捍钦灯绰瘤 ..
+	UINT		m_nFormat;//沥纺葛靛
+	RECT		m_rect;  //伎狼 康开
+	COLORREF	m_txtclr;//臂磊祸
+	COLORREF	m_bkgclr;//硅版祸
+	CString		m_strTxt;//臂磊
+	CFont*		m_pfont; //迄飘
+	CBitmap*	m_pBitmap;//厚飘甘
+}LOGCELL;
+
+//Orientation=啊肺(1), 技肺(2)  bDialog=DoModal()
+class AFX_EXT_CLASS CPrintDC
+{
+public:
+	CPrintDC();
+	virtual ~CPrintDC();
+	CDC* GetPrintDC(int Orientation, BOOL bDialog=FALSE);
+protected:
+	CDC *m_pDC;
+};
+
+class CLogCell : public tagLOGCELL
+{
+public:
+	CLogCell();
+	CLogCell(LPCSTR lpstr,
+			CRect	rect,
+			int nFormat=DT_CENTER,
+			COLORREF textColor=0x00000000,
+			COLORREF backColor=0x00ffffff,
+			CFont* pf=NULL);
+
+	void operator=(const CLogCell& log);
+	void InitCell();
+	void Draw(CDC* pDC);
+};
+
+class AFX_EXT_CLASS CLogPage
+{
+public:
+	CLogPage();
+	CLogPage(CPoint startPnt);
+	virtual ~CLogPage();
+	void RemoveAll();
+	void operator=(CLogPage& page);
+
+	//青,凯 肮荐甫 汲沥茄促.
+	void SetColCount(int nCount);
+	void SetRowCount(int nCount);
+	BOOL RemoveRow(int nRow);
+
+	//厘钎 免仿困摹
+	void SetStartPoint(CPoint startPnt);
+	CPoint GetStartPoint() const;
+
+	//青,凯 肮荐甫 府畔茄促.
+	int GetColCount() const;
+	int GetRowCount() const;
+
+	//气,臭捞甫 汲沥茄促.
+	BOOL SetColWidth(int nCol, int nWidth);
+	BOOL SetRowHeight(int nRow, int nHeight);
+
+	//迄飘甫 汲沥茄促.
+	BOOL SetCellFont(int nRow, int nCol, CFont* pf);
+	BOOL SetCellFont(int nsRow, int nsCol, int neRow, int neCol, CFont* pf);
+	CFont* GetCellFont(int nRow, int nCol);
+
+	//硅版祸阑 汲沥茄促.
+	BOOL SetCellBkgColor(int nRow, int nCol, COLORREF color);
+	COLORREF GetCellBkgColor(int nRow, int nCol);
+
+	//臂磊祸阑 汲沥茄促.
+	BOOL SetCellTxtColor(int nRow, int nCol, COLORREF color);
+	COLORREF GetCellTxtColor(int nRow, int nCol);
+
+	//臂磊困摹 汲沥
+	BOOL SetCellFormat(int nRow, int nCol, int nFormat);
+	int GetCellFormat(int nRow, int nCol);
+
+	//Rect阑 汲沥茄促.
+	BOOL SetCellRect(int nRow, int nCol, CRect rect);
+	BOOL GetCellRect(int nRow, int nCol, CRect& rect);
+
+	//BITMAP阑 汲沥茄促.
+	BOOL SetCellBmp(int nRow, int nCol, CBitmap* pBmp);
+	CBitmap* GetCellBmp(int nRow, int nCol);
+
+	//荤阿屈 弊副锭 绢蠢 困摹甫 弊副 巴牢啊 汲沥茄促. 
+	BOOL SetCellLine(int nRow, int nCol, int nState=LCS_RECT/*LCS_RECT*/);
+	int GetCellLine(int nRow, int nCol);
+
+	//伎俊 臂磊阑 涝仿茄促.
+	BOOL SetItemText(int nRow, int nCol, LPCTSTR lpstr, int nFormat=DT_CENTER|DT_VCENTER|DT_SINGLELINE);
+	CString GetItemText(int nRow, int nCol);
+
+	BOOL SetCell(int nRow, int nCol, CLogCell lc);
+	CLogCell* GetCell(int nRow, int nCol);
+
+	//伎阑 捍钦茄促.
+	BOOL CellMerge(int nsCol, int nsRow, int neCol ,int neRow );
+
+	//免仿茄促.(nPageNO绰 其捞瘤 锅龋捞哥 0老 版快 免仿登瘤 臼绰促.)
+	void Draw(CDC* pDC, int nPageNO=0);
+
+	//SetPageRect(,)窃荐甫 荤侩矫 
+	//Draw(CDC* pDC, int nPageNO=0);窃荐甫 龋免窍扁 官肺傈俊 荤侩秦具窃
+	//侩档: 
+	//   <<page>>                                 <<device>>
+	//  0                               100      0                               1000  
+	//  ΓΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΔ        ΓΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΔ
+	//  Β  (10,10)              (90,10)Β        Β (100,100)           (900,100)Β
+	//  Β  ΓΑΑΑΑΑΑΑΑΑΑΑΔ  Β        Β  ΓΑΑΑΑΑΑΑΑΑΑΑΔ  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  Β                      Β ΜΜΜΜΜΜΜ>Β                      Β  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  ΖΑΑΑΑΑΑΑΑΑΑΑΕ  Β        Β  ΖΑΑΑΑΑΑΑΑΑΑΑΕ  Β
+	//  Β  (10,40)              (90,40)Β        Β (100,400)           (900,400)Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  ΖΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΕ        ΖΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΕ
+	//  200                            100,200    2000                            1000,2000 
+	//  
+	//   CRect page(0,0,100,200);
+	//   CRect device(0,0,1000,2000);
+	//   咯归阑 炼陛 林妨搁: CRect device(100,100,900,1900);
+	//   SetPageRect(pDC, page, device);
+	BOOL SetPageRect(CDC* pDC, CRect page, CRect device);
+protected:
+	bool m_IsViewPort;
+	int m_RowCnt;
+	int m_ColCnt;
+	CPoint		  m_startPnt;
+	CLogItemArray m_liAry;
+};
+
+//厘钎 傈眉甫 包府茄促.
+//厘钎甫 免仿窍扁 困秦 怖 鞘夸窍柳 臼促.
+//CLogPage甫 荤侩秦档 公规窍促.
+class AFX_EXT_CLASS CLogCtrl
+{
+public:
+	CLogCtrl();
+	virtual ~CLogCtrl();
+	int  GetLogPageCount();
+	void AddLogPage(CLogPage& lp);
+	CLogPage* GetLogPage(int nPage);
+	void DelLogPage(int nPage);
+	void Draw(CDC* pDC, DOCINFO* pDocInfo);
+protected:
+	CLogPageArray m_log;
+};
+
+#endif
diff --git a/Common_Class/SISControls/Header/SISButton.h b/Common_Class/SISControls/Header/SISButton.h
new file mode 100644
index 0000000..86f912e
--- /dev/null
+++ b/Common_Class/SISControls/Header/SISButton.h
@@ -0,0 +1,82 @@
+#if !defined(AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_)
+#define AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISButton.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISButton by Niek Albers
+// Thanks to some people for the tooltip.
+// A cool CBitmapButton derived class with 3 states,
+// Up/Down/SIS.
+class AFX_EXT_CLASS CSISButton : public CBitmapButton
+{
+	DECLARE_DYNAMIC(CSISButton);
+
+	// Construction
+public:
+	CSISButton();
+	void SetToolTipText(CString* spText, BOOL bActivate = TRUE);
+	void SetToolTipText(int nId, BOOL bActivate = TRUE);
+	void SetWindowText(CString strText);
+	void SetFontSize(int nSize);
+	void SetTextColor(COLORREF rgbNormal, COLORREF rgbDisable);
+	void SetSISButtonStyle(UINT uID, int nImgCount);
+	void SetSISButtonStyle(UINT uID, int nImgCount, CString spTipText);
+	void SetSISButtonStyle(UINT uID, int nImgCount, CString spTipText, CString spBtnText, int nFontSize);
+
+	CString m_strText;
+	CDC      m_gMemDC;
+
+// Attributes
+protected:
+	void fPaint(CDC* pDC);
+	void ActivateTooltip(BOOL bActivate = TRUE);
+	BOOL m_bSIS;						// indicates if mouse is over the button
+	CSize m_ButtonSize;					// width and height of the button
+	CBitmap m_Bitmap;
+	BOOL m_bTracking;
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISButton)
+	protected:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	BOOL LoadBitmap(UINT bitmapid, UINT uiImageCount);
+	virtual ~CSISButton();
+
+	// Generated message map functions
+protected:
+	CToolTipCtrl m_ToolTip;
+	void InitToolTip();
+	//{{AFX_MSG(CSISButton)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg LRESULT OnMouseLeave(WPARAM wparam, LPARAM lparam);
+	afx_msg LRESULT OnMouseHOver(WPARAM wparam, LPARAM lparam) ;
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	UINT m_uiImageCount;
+	CFont	m_Font;
+	LOGFONT		m_lf;
+	COLORREF m_RGBTextNormal;
+	COLORREF m_RGBTextDisable;
+	BOOL m_bIsDisable;	// Disable老 锭绰 臂磊祸阑 官操扁 困秦.
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/SISFolderScheduling.h b/Common_Class/SISControls/Header/SISFolderScheduling.h
new file mode 100644
index 0000000..68d9a52
--- /dev/null
+++ b/Common_Class/SISControls/Header/SISFolderScheduling.h
@@ -0,0 +1,92 @@
+// SISFolderScheduling.h: interface for the CSISFolderScheduling class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_)
+#define AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define TARGETTYPE_FOLDER		1
+#define TARGETTYPE_FILE			2
+
+struct SSubPathInfo
+{
+	CString		s_strItemPath;
+	CString		s_strItemName;
+	long		s_nCreateDate;
+	int			s_nItemType;
+
+	SSubPathInfo()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		s_strItemPath = _T("");
+		s_strItemName = _T("");
+		s_nCreateDate = 0;
+		s_nItemType = 0;
+	}
+	
+	// 汗荤 积己磊.
+	SSubPathInfo(const SSubPathInfo& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_strItemPath = rhs.s_strItemPath;
+			s_strItemName = rhs.s_strItemName;
+			s_nCreateDate = rhs.s_nCreateDate;
+			s_nItemType = rhs.s_nItemType;
+		}
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+    SSubPathInfo& operator=(const SSubPathInfo& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_strItemPath = rhs.s_strItemPath;
+			s_strItemName = rhs.s_strItemName;
+			s_nCreateDate = rhs.s_nCreateDate;
+			s_nItemType = rhs.s_nItemType;
+		}
+		return *this;
+	}
+};
+
+class AFX_EXT_CLASS CSISFolderScheduling  
+{
+public:
+	CSISFolderScheduling();
+	CSISFolderScheduling(CString strPath);
+	CSISFolderScheduling(CString strPath, int nTargetType);
+	virtual ~CSISFolderScheduling();
+
+	BOOL SetRemainDelete(CString strPath, int nTargetType, int nRemainItemCount);
+	BOOL CommitSchedule();
+	void ResetSchedule();
+
+protected:
+	
+	BOOL SearchSubItem(const CString &strMainPath, BOOL bIsAscending);
+	BOOL SortSubItem(BOOL bIsAscending);	// 坷抚瞒鉴 TRUE, 郴覆瞒鉴 FALSE
+	BOOL DeleteFolder(const CString &strFolder);
+
+	// 包府甫 且 弥惑困 版肺.
+	CString				m_strMainPath;
+	BOOL				m_bTargetFolder;
+	BOOL				m_bTargetFile;
+	BOOL				m_bIsAscending;
+
+	// 老何父 巢扁绊 昏力.
+	int					m_nRemainItemCount;
+
+	// 包府 措惑 沥焊
+	SSubPathInfo*		m_pPathInfo;
+	int					m_nSubItemCount;
+};
+
+#endif // !defined(AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/SISJogBtn2Parent.h b/Common_Class/SISControls/Header/SISJogBtn2Parent.h
new file mode 100644
index 0000000..16595c0
--- /dev/null
+++ b/Common_Class/SISControls/Header/SISJogBtn2Parent.h
@@ -0,0 +1,12 @@
+// by ChaeSIS
+
+#ifndef SIS_JOG_BTN_2_PARENT_H
+#define SIS_JOG_BTN_2_PARENT_H
+
+typedef struct _SISJOGBTN2PARENT
+{
+	virtual BOOL SendMessageToParent(LPCTSTR message) = 0;
+	virtual BOOL SendMessageToParent(int nMsg) = 0;
+} SISJogBtn2Parent, *pSISJogBtn2Parent;
+
+#endif
\ No newline at end of file
diff --git a/Common_Class/SISControls/Header/SISJogButton.h b/Common_Class/SISControls/Header/SISJogButton.h
new file mode 100644
index 0000000..1f971a1
--- /dev/null
+++ b/Common_Class/SISControls/Header/SISJogButton.h
@@ -0,0 +1,63 @@
+#if !defined(AFX_SISJOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_)
+#define AFX_SISJOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISJogButton.h : header file
+//
+
+#include "SISJogBtn2Parent.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISJogButton window
+
+class AFX_EXT_CLASS CSISJogButton : public CButton
+{
+// Construction
+public:
+	CSISJogButton();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void SetJ2M(pSISJogBtn2Parent pJ2M)			{ m_pJ2M = pJ2M; }
+	void SetStringDown(CString strMsg)			{ m_strMessageDown = strMsg; }
+	void SetStringUp(CString strMsg)			{ m_strMessageUp = strMsg; }
+	void SetIntDown(int nMsg)					{ m_nMessageDown = nMsg; }
+	void SetIntUp(int nMsg)						{ m_nMessageUp = nMsg; }
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISJogButton)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CSISJogButton();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISJogButton)
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	pSISJogBtn2Parent	m_pJ2M;
+	CString				m_strMessageDown;
+	CString				m_strMessageUp;
+	int					m_nMessageDown;
+	int					m_nMessageUp;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_JOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/SISLabel.h b/Common_Class/SISControls/Header/SISLabel.h
new file mode 100644
index 0000000..e6dd533
--- /dev/null
+++ b/Common_Class/SISControls/Header/SISLabel.h
@@ -0,0 +1,77 @@
+#if !defined(AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
+#define AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// Label.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISLabel window
+enum FlashType {None, Text, Background };
+
+class AFX_EXT_CLASS CSISLabel : public CStatic
+{
+// Construction
+public:
+	CSISLabel();
+	CSISLabel& SetBkColor(COLORREF crBkgnd);
+	CSISLabel& SetTextColor(COLORREF crText);
+	CSISLabel& SetText(const CString& strText);
+	CSISLabel& SetFontBold(BOOL bBold);
+	CSISLabel& SetFontName(const CString& strFont);
+	CSISLabel& SetFontUnderline(BOOL bSet);
+	CSISLabel& SetFontItalic(BOOL bSet);
+	CSISLabel& SetFontSize(int nSize);
+	CSISLabel& SetSunken(BOOL bSet);
+	CSISLabel& SetBorder(BOOL bSet);
+	CSISLabel& FlashText(BOOL bActivate);
+	CSISLabel& FlashBackground(BOOL bActivate);
+	CSISLabel& SetLink(BOOL bLink);
+	CSISLabel& SetLinkCursor(HCURSOR hCursor);
+
+// Attributes
+public:
+protected:
+	void ReconstructFont();
+	COLORREF	m_crText;
+	HBRUSH		m_hBrush;
+	HBRUSH		m_hwndBrush;
+	LOGFONT		m_lf;
+	CFont		m_font;
+	CString		m_strText;
+	BOOL		m_bState;
+	BOOL		m_bTimer;
+	BOOL		m_bLink;
+	FlashType	m_Type;
+	HCURSOR		m_hCursor;
+			// Operations
+public:
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISLabel)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CSISLabel();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISLabel)
+	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/SISListBoxLog.h b/Common_Class/SISControls/Header/SISListBoxLog.h
new file mode 100644
index 0000000..6ad7ea8
--- /dev/null
+++ b/Common_Class/SISControls/Header/SISListBoxLog.h
@@ -0,0 +1,96 @@
+#if !defined(AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_)
+#define AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// cSISListBoxLog.h : header file
+//
+
+#include "SISFolderScheduling.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListBoxLog window
+
+#define LOG_NORMAL		1
+#define LOG_HISTORY		2
+#define LOG_WARNING		3
+#define LOG_ERROR		4
+#define LOG_DEBUG		5
+
+#define STRINGBUFFER_COUNT		200
+class AFX_EXT_CLASS CSISListBoxLog : public CListBox
+{
+// Construction
+public:
+	CSISListBoxLog();
+	virtual ~CSISListBoxLog();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISListBoxLog)
+	//}}AFX_VIRTUAL
+
+	//////////////////////////////////////////////////////////////////////////
+	// Logging
+	void	SetPath(CString& strPath, CString& strName, BOOL bDelete, int nRemainCount);
+	void	DisplayMessages(BOOL bAddMsgBox, int nLevel, TCHAR *str, ...);
+	void	DisplayMessages(BOOL bAddMsgBox, TCHAR *str, ...);
+	void	DisplayMessage(BOOL bAddMsgBox, int nLevel, TCHAR *str);
+	void	DisplayMessage(BOOL bAddMsgBox, TCHAR *str);
+	void	SetTextColor(long clbg1 = RGB(255,255,255), long clbg2 = RGB(255,255,255), long clText = RGB(0,0,0));
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISListBoxLog)
+	afx_msg LRESULT OnDisplayMessage(WPARAM wParam, LPARAM lParam);
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+	//////////////////////////////////////////////////////////////////////////
+	// Folder Management
+	CSISFolderScheduling	m_FolderSchedule;
+		
+	//////////////////////////////////////////////////////////////////////////
+	// Logging
+	CString				m_strLogDir;
+	CString				m_strFileName;
+
+	CString				m_strLogPath;
+	CString				m_strLogFile;
+	CTime				m_TimeLogFile;
+	CFile*				m_pFileLog;
+
+	TCHAR				m_strBuffer[512];
+
+	BOOL				MakeLogFile();
+	BOOL				WriteToFile(CTime& time, CString& strContents);
+	BOOL				WriteToFile(CTime& time, TCHAR* strContents);
+
+	DWORD				m_dwThreadID;
+
+	CString				m_strArray[STRINGBUFFER_COUNT];
+	BOOL				m_bMustDisplay[STRINGBUFFER_COUNT];
+	int					m_nAddIndex;
+	int					m_nReadIndex;
+	CRITICAL_SECTION	m_csLog;
+
+	long				m_clBG1;
+	long				m_clBG2;
+	long				m_clText;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/SISListCtrlExt.h b/Common_Class/SISControls/Header/SISListCtrlExt.h
new file mode 100644
index 0000000..c0e712a
--- /dev/null
+++ b/Common_Class/SISControls/Header/SISListCtrlExt.h
@@ -0,0 +1,137 @@
+#if !defined(AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_)
+#define AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISListCtrlExt.h : header file
+//
+
+#include <afxtempl.h>
+
+#include "InPlaceEdit.h"
+#include "InPlaceComboBox.h"
+
+#define EDITDISABLE_NONE	0
+#define EDITDISABLE_ROWS	1
+#define EDITDISABLE_COLS	2
+#define EDITDISABLE_ROWCOL	3
+
+#define INPLACECTRL_EDIT	4
+#define INPLACECTRL_COMBO	5
+#define INPLACECTRL_EDIT_COMBO	6
+
+#define EDITDISABLE_ROWS_ARRAY	7
+#define EDITDISABLE_COLS_ARRAY	8
+
+#define COMBODATASTATE_SINGLE 9
+#define COMBODATASTATE_MULTI  10
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListCtrlExt window
+
+typedef struct _LISTROWCOLOR
+{
+	int			s_nRow;
+	COLORREF	s_Color;
+} ListRowColor, *pListRowColor;
+
+class AFX_EXT_CLASS CSISListCtrlExt : public CListCtrl
+{
+// Construction
+public:
+	CSISListCtrlExt();
+	virtual ~CSISListCtrlExt();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void SetComboCtrlCols(CString strCols,int nLength);
+	void SetEditCtrlCols(CString strCols,int nLength);
+	void SetComboData(TCHAR *pData[],int nState,int nLength);
+	void SetComboData(CStringList *pList, int nState);
+	void EditDisableRows(CString strRows,int nLength);
+	void EditDisableCols(CString strCols,int nLength);
+	BOOL GetEnableSortList();
+	void SetEnableSortList(BOOL nEnable);
+	void SortListCtrl(int nCol);
+	void InitListHeader(TCHAR *colList[],int *widthList,int nLength, int nHeight);
+	void SetInPlaceCtrl(int nCtrl);
+	void SetDefaultEditText(CString strInitText);
+	void SetEditDisableState(int nState);
+	int GetEditDisableCols();
+	int GetEditDisableRows();
+	int GetEditDisableState();
+	void EditDisableRowCol(int nRow,int nCol);
+	void EditDisableCols(int nCols);
+	void EditDisableRows(int nRows);
+	void SetColNum(int nColNum);
+	void AddBlankItem();
+	CImageList* SetImageList(CImageList* pImageList, int nImageListType);
+		
+	void InsertListItemEx(int nRow, int nCol, const CString& strString);
+	void InsertListItemEx(int nRow, int nCol, int nValue);
+	void InsertListItemEx(int nRow, int nCol, double dValue, int nRight = 3);
+
+	void SetTextColor(int nRow, COLORREF clrText);
+	void SetBKColor(int nRow, COLORREF clrBK);
+	void ReleaseTextColor(int nRow);
+	void ReleaseBKColor(int nRow);
+	void ResetTextColor();
+	void ResetBKColor();
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISListCtrlExt)
+	//}}AFX_VIRTUAL
+
+protected:
+	CInPlaceEdit *m_pEdit;
+	CInPlaceComboBox *m_pComboBox;
+	int m_nInPlaceCtrl;
+	int m_nColNum;
+	int m_nEditDisableState;
+	int m_nDisableCol;
+	int m_nDisableRow;
+	BOOL m_bSortOrder;
+	CString m_strInitEditText;
+	BOOL m_bEnableSortList;
+	int *m_pEditDisableCols;
+	int *m_pEditDisableRows;
+	// Generated message map functions
+protected:
+	int m_nComboCtrlLength;
+	int m_nEditCtrlLength;
+	int *m_pComboCtrlCols;
+	int *m_pEditCtrlCols;
+	CStringList *m_pComboData;
+	int m_nLength;
+	int m_nComboDataState;
+	BOOL m_bSetImageList;
+
+// Implementation
+public:
+	CList<pListRowColor, pListRowColor>	m_ListColorText;
+	CList<pListRowColor, pListRowColor>	m_ListColorBk;
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISListCtrlExt)
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/SortClass.h b/Common_Class/SISControls/Header/SortClass.h
new file mode 100644
index 0000000..b6b2d83
--- /dev/null
+++ b/Common_Class/SISControls/Header/SortClass.h
@@ -0,0 +1,40 @@
+
+
+class CSortClass
+{
+public:
+	CSortClass(CListCtrl * _pWnd, const int _iCol, const bool _bIsNumeric);
+	//CSortClass(CListCtrl * _pWnd, const int _iCol, const bool _bIsNumeric, int iStartingItem, int iEndingItem );
+	virtual ~CSortClass();		
+	
+	int iCol;	
+	int m_iStartingItem;
+	int m_iEndingItem;
+
+	CListCtrl * pWnd;	
+	bool bIsNumeric;
+	
+	void Sort(const bool bAsc);	
+	
+	static int CALLBACK CompareAsc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareDes(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareAscI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareDesI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
+public:	
+	class CSortItem	
+	{	
+		public:		
+			virtual  ~CSortItem();
+			CSortItem(const DWORD _dw, const CString &_txt);		
+			CString txt;		
+			DWORD dw;	
+	};
+	class CSortItemInt	
+	{	
+		public:
+			CSortItemInt(const DWORD _dw, const CString &_txt);		
+			int iInt ;		
+			DWORD dw;	
+	};
+};
\ No newline at end of file
diff --git a/Common_Class/SISControls/Header/StaticMap.h b/Common_Class/SISControls/Header/StaticMap.h
new file mode 100644
index 0000000..591e458
--- /dev/null
+++ b/Common_Class/SISControls/Header/StaticMap.h
@@ -0,0 +1,149 @@
+#if !defined(AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_)
+#define AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// StaticMap.h : header file
+//
+
+#define ORIGIN_LEFTTOP		1
+#define ORIGIN_LEFTBOTTOM	0
+#define ORIGIN_RIGHTTOP		2
+#define ORIGIN_RIGHTBOTTOM	3
+
+#define UM_MAP_CHANGED			5573
+#define _MENU_DEFECT_LIST_ID_			8000
+/////////////////////////////////////////////////////////////////////////////
+// CStaticMap window
+enum OriginDirection		{ OD_LeftTop = 0, OD_RightTop = 1, OD_LeftBottom = 10, OD_RightBottom = 11 };
+
+class AFX_EXT_CLASS CStaticMap : public CStatic
+{
+	// Construction
+public:
+	CStaticMap();
+
+	// Attributes
+public:
+
+	// Operations
+public:
+	void				InitGlass(CWnd* pParent, int nMapWidth, int nMapHeight, int nMapMargin);	// Pixel 窜困 付柳.
+	void				DeinitGlass();
+	int					GetMapTotalWidth()		{ return m_nMapTotalWidth; }
+	int					GetMapTotalHeight()		{ return m_nMapTotalHeight; }
+	int					GetMapWidth()			{ return m_nMapWidth; }
+	int					GetMapHeight()			{ return m_nMapHeight; }
+
+	void				SetMiniMap(BOOL bIsMiniMap, int nUnitSize)	{ m_bIsMiniMap = bIsMiniMap; m_nUnitSize = nUnitSize; }
+	int					GetUnitSize()			{ return m_nUnitSize; }
+
+	virtual void		DrawGlass(CDC* pDC)						{ }
+	virtual void		MouseLBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnUp(CPoint& point)				{ }
+	virtual void		MouseLBtnMove(CPoint& point)			{ }
+	virtual void		MouseLBtnDblClk(CPoint& point)			{ }
+	virtual void		MouseRBtnDwn(CPoint& point)				{ }
+	virtual void		MouseRBtnUp(CPoint& point)				{ }
+	virtual void		MouseRBtnDblClk(CPoint& point)			{ }
+	virtual void		RegistNoDefect()						{ }
+	virtual void		Timer(UINT nIDEvent)					{ }
+
+	// 犬措/绵家
+	void				IncreaseRatio();
+	void				DecreaseRatio();
+	void				ResetRatio();
+
+	CPoint&				GetDisplayStart()		{ return m_PointGlassStart; }
+	CPoint&				GetDisplayEnd()			{ return m_PointGlassEnd; }
+
+	void				SetDisplayRect(CPoint& PointStart, CPoint& PointEnd);
+	void				SetShowShot(BOOL bShow)	{ m_bShowShot = bShow; }
+
+	// 历厘
+	void				SaveMapToFile(CString strFileName);
+	void				SetBGColor(COLORREF color) { m_clBGColor = color; }
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CStaticMap)
+	//}}AFX_VIRTUAL
+
+	// Implementation
+public:
+	virtual ~CStaticMap();
+
+	// Generated message map functions
+protected:
+	void				SetMappingMode(CDC *pDC);
+	CPoint				SetWindowToGlass(CPoint pt);
+	CPoint				SetGlassToWindow(CPoint pt);
+	void				ControlZoom(BOOL bZoomIn, CPoint ptMouse);
+
+	void				PopupMenu(int nBaseID, CPoint point);
+
+	CWnd*				m_pParentWnd;
+	int					m_nMapTotalWidth;
+	int					m_nMapTotalHeight;
+	int					m_nMapWidth;
+	int					m_nMapHeight;
+	int					m_nMapMarginWidth;
+	int					m_nMapMarginHeight;
+	CRect				m_RectWnd;
+	CRect				m_RectMap;
+	long				m_clBGColor;
+	long				m_clPatColor;
+	//////////////////////////////////////////////////////////////////////////
+	// 弊府扁 沥焊
+	HBITMAP				m_hDrawingSurface;
+	BITMAPINFOHEADER	m_BMIH;
+	CRect				m_RectDrawingSurface;
+	BYTE*				m_pDrawingSurfaceBits;
+
+	OriginDirection		m_OriginDir;
+	int					m_nUnitSize;
+
+	// Cell 弊府扁
+	BOOL				m_bShowShot;
+
+	// 犬措/绵家
+	CRect				m_RectShowWnd;
+
+	double				m_dRatio;
+	CPoint				m_PointWindowStart;
+	BOOL				m_bDragMove;
+	CPoint				m_PointDragStart;
+	BOOL				m_bIsMiniMap;			// Minimap篮 犬措/绵家甫 救茄促.
+	CPoint				m_PointGlassStart;		// Glass 吝 泅犁 焊咯瘤绰 康开.
+	CPoint				m_PointGlassEnd;
+
+	POINT				m_PointCCut[3];			//内呈钠 弊府扁 谅钎
+	int					m_nCCutSize;
+	int					m_nCoordGabX;			// 谅钎甫 谎副 芭府.
+	int					m_nCoordGabY;			// 谅钎甫 谎副 芭府.
+
+	//{{AFX_MSG(CStaticGlass)
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg long OnUpdateMap(WPARAM wParam, LPARAM lParam);
+	afx_msg void OnMenuChangeViewMode(UINT nID);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/WKButton.h b/Common_Class/SISControls/Header/WKButton.h
new file mode 100644
index 0000000..6dec8c3
--- /dev/null
+++ b/Common_Class/SISControls/Header/WKButton.h
@@ -0,0 +1,119 @@
+#if !defined(AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_)
+#define AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// WKButton.h : header file
+/******************************< 橇肺弊伐 沥焊 >****************************/
+/*   努 贰 胶 疙 : WKButton                                                */ 
+/*   滚       傈 :                                                         */
+/*   弥辆 荐沥老 : 2006. 05. 28                                            */
+/***************************************************************************/
+
+/////////////////////////////////< 沥  狼 >//////////////////////////////////
+
+// 滚瓢 屈怕
+#define		WK_BUTTON_SHPAE_RECTANGLE				0x0001
+#define		WK_BUTTON_SHAPE_CIRCLE					0x0002
+#define		WK_BUTTON_SHAPE_ROUNDRECT				0x0004
+
+// 滚瓢 祸惑
+#define		WK_BUTTON_COLOR_ONE						0x0001
+#define		WK_BUTTON_COLOR_TWO						0x0002
+#define		WK_BUTTON_COLOR_GRADATION_UP			0x0011
+#define		WK_BUTTON_COLOR_GRADATION_RIGHT			0x0012
+#define		WK_BUTTON_COLOR_GRADATION_DOWN			0x0014
+#define		WK_BUTTON_COLOR_GRADATION_LEFT			0x0018
+
+// 滚瓢 惑怕
+#define		WK_BUTTON_STATUS_MOUSEOVER				0x0001
+#define		WK_BUTTON_STATUS_MOUSELEAVE				0x0002
+#define		WK_BUTTON_STATUS_MOUSECLICK				0x0004
+
+
+///////////////////////////////< 努贰胶 备炼 >///////////////////////////////
+class AFX_EXT_CLASS CWKButton : public CButton
+{
+public://<<<<<<<<<<<<<<<<<<<<<< 寇何 立辟 窃荐 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+	CWKButton();
+	virtual ~CWKButton();
+
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CWKButton)
+	public:
+	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
+	virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL DestroyWindow();
+	protected:
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+public:	
+/*****************************< 滚瓢 汲沥 窃荐 >****************************/
+	/* 咆胶飘 葛剧 棺 郴侩 瘤沥 */
+	BOOL SetButtonText(CString strCaption);
+	BOOL SetButtonText(CString strCaption, COLORREF rgbText);
+	BOOL SetButtonText(CString strCaption, CFont *font, COLORREF rgbText);
+	
+	/* 滚瓢 屈怕 棺 祸惑 瘤沥 */
+	BOOL SetButtonStyle(DWORD dShape, COLORREF rgbColor1);
+	BOOL SetButtonStyle(DWORD dShape, DWORD dStyle,	COLORREF rgbColor1,	COLORREF rgbColor2);
+	/***************************************************************************/
+
+protected://<<<<<<<<<<<<<<<< 郴何 贸府 窃荐 棺 函荐 >>>>>>>>>>>>>>>>>>>>>>>>>
+	/* 惑怕喊 滚瓢 捞固瘤 */
+	CBitmap m_bmpImage1;	//乞惑矫
+	CBitmap m_bmpImage2;	//付快胶 坷滚
+	CBitmap m_bmpImage3;	//努腐
+	
+	/* 惑怕喊 滚瓢 捞固瘤 积己 */
+	BOOL CreateButtonImage();
+
+	/* 滚瓢 屈怕 积己 */
+	BOOL DrawFormRectangle();	// 荤阿
+	BOOL DrawFormCircle();		// 盔
+	BOOL DrawFormRoundRect();	// 嫡辟荤阿
+
+	/* 捞固瘤 贸府 */
+	COLORREF LightValueControl(COLORREF rgb, int nValue);						// 祸惑 灌扁 炼例
+	void DrawGradation(CBitmap* bmpImage, COLORREF color1, COLORREF color2);	// 弊扼单捞记 捞固瘤 积己
+	BOOL DrawBorder(CBitmap* pbmpImage, COLORREF color1, COLORREF color2, int nWidth = 2);		// 滚瓢 抛滴府 弊府扁
+	BOOL DrawText(CBitmap* pBitmap, int nStatus);								// 滚瓢俊 臂揪 持扁
+
+	/* 滚瓢 捞固瘤 沥焊 */
+	DWORD m_dShape;			// 滚瓢 屈怕
+	DWORD m_dStyle;			// 拿矾 胶鸥老
+	COLORREF m_rgbColor1;	// 霉锅掳 拿矾
+	COLORREF m_rgbColor2;	// 滴锅掳 拿矾
+	CRect m_rtButton;		// 滚瓢农扁
+	int m_nWidth;			// 滚瓢 呈厚
+	int m_nHeight;			// 滚瓢 臭捞
+
+	/* 咆胶飘 沥焊 */
+	CString m_strCaption;	// 母记 郴侩
+	CFont m_Font;			// 母记 臂裁
+	COLORREF m_rgbText;		// 母记 祸惑
+	BOOL m_bValueChange;	// 母记 函版
+	
+	/* 滚瓢 惑怕 沥焊 */
+	DWORD m_dButtonStatus;
+	
+	//{{AFX_MSG(CWKButton)
+	afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
+	afx_msg void OnPaint();
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_)
diff --git a/Common_Class/SISControls/Header/XTabCtrl.h b/Common_Class/SISControls/Header/XTabCtrl.h
new file mode 100644
index 0000000..2d25ef4
--- /dev/null
+++ b/Common_Class/SISControls/Header/XTabCtrl.h
@@ -0,0 +1,90 @@
+#if !defined(AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_)
+#define AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// XTabCtrl.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CXTabCtrl window
+#include <afxtempl.h>
+
+class AFX_EXT_CLASS CXTabCtrl : public CTabCtrl
+{
+// Construction
+public:
+	CXTabCtrl();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void AddTab(CWnd* pWnd, LPTSTR lpszCaption, int iImage =0);
+	void AddTab(CWnd* pWnd, LPTSTR lpszCaption, int Width, int Height, int iImage =0);
+	void EnableTab(int iIndex, BOOL bEnable = TRUE);
+	BOOL SelectTab(int iIndex);
+	void DeleteAllTabs();
+	void DeleteTab(int iIndex);
+	void SetTopLeftCorner(CPoint pt);
+	BOOL IsTabEnabled(int iIndex);
+
+	void SetDisabledColor(COLORREF cr);
+	void SetSelectedColor(COLORREF cr);
+	void SetNormalColor(COLORREF cr);
+	void SetMouseOverColor(COLORREF cr);
+
+	void SetParentWnd(CWnd* pWnd)	{ m_pParentWnd = pWnd; }
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CXTabCtrl)
+	protected:
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CXTabCtrl();
+
+	// Generated message map functions
+protected:
+	CArray<BOOL, BOOL> m_arrayStatusTab; //** enabled Y\N
+	int m_iSelectedTab;
+	POINT m_ptTabs;
+	COLORREF m_crSelected;
+	COLORREF m_crDisabled;
+	COLORREF m_crNormal;
+	COLORREF m_crMouseOver;
+	COLORREF m_crBKColor;
+
+	int m_iIndexMouseOver;
+	
+	bool m_bMouseOver;
+	bool m_bColorMouseOver;
+	bool m_bColorNormal;
+	bool m_bColorDisabled;
+	bool m_bColorSelected;
+	
+	//{{AFX_MSG(CXTabCtrl)
+	afx_msg void OnSelchange(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+	CWnd*		m_pParentWnd;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_)
diff --git a/Common_Class/SISControls/InPlaceComboBox.cpp b/Common_Class/SISControls/InPlaceComboBox.cpp
new file mode 100644
index 0000000..8c43aa2
--- /dev/null
+++ b/Common_Class/SISControls/InPlaceComboBox.cpp
@@ -0,0 +1,70 @@
+// InPlaceComboBox.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "InPlaceComboBox.h"
+#include "SISListCtrlExt.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceComboBox
+
+CInPlaceComboBox::CInPlaceComboBox(int iItem,int iSubItem)
+{
+	m_iItem = iItem;
+	m_iSubItem = iSubItem;
+}
+
+CInPlaceComboBox::~CInPlaceComboBox()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CInPlaceComboBox, CComboBox)
+	//{{AFX_MSG_MAP(CInPlaceComboBox)
+	ON_WM_CREATE()
+	ON_CONTROL_REFLECT(CBN_SELCHANGE, OnSelchange)
+	ON_WM_KILLFOCUS()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceComboBox message handlers
+
+int CInPlaceComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct) 
+{
+	if (CComboBox::OnCreate(lpCreateStruct) == -1)
+		return -1;
+	
+	CFont* font = GetParent()->GetFont() ;
+	SetFont(font) ;
+
+	SetFocus() ;
+	SetCurSel(0) ;
+	// TODO: Add your specialized creation code here
+	
+	return 0;
+}
+
+
+void CInPlaceComboBox::OnSelchange() 
+{
+	// TODO: Add your control notification handler code here
+	CString str;
+	GetLBText(GetCurSel(),str);
+	((CSISListCtrlExt*)GetParent())->InsertListItemEx(m_iItem,m_iSubItem,str);
+	ShowWindow(SW_HIDE);
+}
+
+void CInPlaceComboBox::OnKillFocus(CWnd* pNewWnd) 
+{
+	CComboBox::OnKillFocus(pNewWnd);
+	
+	// TODO: Add your message handler code here
+//	DestroyWindow();
+}
diff --git a/Common_Class/SISControls/InPlaceEdit.cpp b/Common_Class/SISControls/InPlaceEdit.cpp
new file mode 100644
index 0000000..3e783f5
--- /dev/null
+++ b/Common_Class/SISControls/InPlaceEdit.cpp
@@ -0,0 +1,147 @@
+// InPlaceEdit.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "InPlaceEdit.h"
+#include "SISListCtrlExt.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceEdit
+
+CInPlaceEdit::CInPlaceEdit(int iItem, int iSubItem, CString sInitText) : m_sInitText(sInitText)
+{
+	m_iItem = iItem ;
+	m_iSubItem = iSubItem ;
+	m_bESC = FALSE ;
+
+}
+
+CInPlaceEdit::~CInPlaceEdit()
+{			
+
+}
+
+
+BEGIN_MESSAGE_MAP(CInPlaceEdit, CEdit)
+	//{{AFX_MSG_MAP(CInPlaceEdit)
+	ON_WM_KILLFOCUS()
+	ON_WM_NCDESTROY()
+	ON_WM_CHAR()
+	ON_WM_CREATE()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceEdit message handlers
+
+
+void CInPlaceEdit::OnKillFocus(CWnd* pNewWnd) 
+{
+	CEdit::OnKillFocus(pNewWnd);
+	
+	// TODO: Add your message handler code here
+
+	DestroyWindow() ;
+	
+}
+
+void CInPlaceEdit::OnNcDestroy() 
+{
+	CEdit::OnNcDestroy();
+	
+	// TODO: Add your message handler code here
+
+}
+
+void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if (nChar == VK_ESCAPE || nChar == VK_RETURN)
+	{
+		if(nChar == VK_ESCAPE)
+			m_bESC = TRUE ;
+		GetParent()->SetFocus() ;
+		return ;
+	}
+	
+	CEdit::OnChar(nChar, nRepCnt, nFlags);
+
+	CString str ;
+
+	GetWindowText(str) ;
+	CWindowDC dc(this) ;
+	CFont *pFont = GetParent()->GetFont() ;
+	CFont *pFontDC = dc.SelectObject(pFont) ;
+	CSize size = dc.GetTextExtent(str) ;
+	dc.SelectObject(pFontDC) ;
+	size.cx += 5 ;
+
+	CRect rect, parentrect = CRect(0,0,0,0) ;
+	GetClientRect(&rect) ;
+	GetParent()->ScreenToClient(&rect) ;
+
+	if(size.cx > rect.Width())
+	{
+		if (size.cx + rect.left < parentrect.right)
+			rect.right = rect.left + size.cx ;
+		else 
+			rect.right = parentrect.right ;
+		MoveWindow(&rect) ;
+	}
+}
+
+int CInPlaceEdit::OnCreate(LPCREATESTRUCT lpCreateStruct) 
+{
+	if (CEdit::OnCreate(lpCreateStruct) == -1)
+		return -1;
+	
+	// TODO: Add your specialized creation code here
+//	long style;
+//	style = GetWindowLong(this->m_hWnd,GWL_STYLE);
+//	style |= ES_AUTOVSCROLL;
+//	SetWindowLong(this->m_hWnd,GWL_STYLE,style);
+
+	CFont* font = GetParent()->GetFont() ;
+	SetFont(font) ;
+
+	SetWindowText(m_sInitText) ;
+	SetFocus() ;
+	SetSel(0, -1) ;
+
+	return 0;
+}
+
+BOOL CInPlaceEdit::PreTranslateMessage(MSG* pMsg) 
+{
+	// TODO: Add your specialized code here and/or call the base class
+	if (pMsg->message == WM_KEYDOWN)
+	{
+		if(pMsg->wParam == VK_RETURN || pMsg->wParam == VK_DELETE
+				|| pMsg->wParam == VK_ESCAPE
+				|| GetKeyState(VK_CONTROL))
+		{
+			::TranslateMessage(pMsg) ;
+			::DispatchMessage(pMsg) ;
+
+			if(pMsg->wParam == VK_RETURN)
+			{
+				CString str ;
+				GetWindowText(str) ;
+
+				((CSISListCtrlExt*)GetParent())->InsertListItemEx(m_iItem,m_iSubItem,str);
+			}
+			return TRUE ;
+		}
+	}
+
+	return CEdit::PreTranslateMessage(pMsg);
+}
+
+
+
diff --git a/Common_Class/SISControls/LogCtrl.cpp b/Common_Class/SISControls/LogCtrl.cpp
new file mode 100644
index 0000000..4569ddf
--- /dev/null
+++ b/Common_Class/SISControls/LogCtrl.cpp
@@ -0,0 +1,544 @@
+// LogCtrl.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include "LogCtrl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+CPrintDC::CPrintDC()
+{
+	m_pDC = new CDC;
+}
+
+CPrintDC::~CPrintDC()
+{
+	//hDC甫 昏力窍瘤 臼酒档 CDC努贰胶狼 家戈磊俊辑 磊悼 家戈等促.
+	//HDC hDC = m_pDC->Detach();
+	//::DeleteDC(hDC);
+	if (m_pDC)
+	{
+		delete m_pDC;
+		m_pDC = NULL;
+	}
+	
+}
+
+CDC* CPrintDC::GetPrintDC(int Orientation, BOOL bDialog)
+{
+	HDC hDC=m_pDC->Detach();
+	DEVMODE* pDM;
+	if(hDC) ::DeleteDC(hDC);
+
+	CPrintDialog pntDlg(FALSE);
+
+	if(bDialog)
+	{
+		if(pntDlg.DoModal()!=IDOK)
+			return 0;
+		hDC=pntDlg.GetPrinterDC();
+	}
+	else
+	{
+		pntDlg.GetDefaults();
+		hDC=pntDlg.GetPrinterDC();
+	}
+
+	if(Orientation!=0)
+	{
+		//pDM = return (LPDEVMODE)::GlobalLock(m_pd.hDevMode);
+		pDM = pntDlg.GetDevMode();
+		pDM->dmOrientation = Orientation;
+		::ResetDC(hDC, pDM);
+		::GlobalUnlock(pntDlg.m_pd.hDevMode);
+	}
+	m_pDC->Attach(hDC);
+	return m_pDC;
+}
+
+CLogCell::CLogCell()
+{
+	InitCell();	
+}
+
+CLogCell::CLogCell(LPCSTR lpstr, CRect r, int nCellFormat,
+					COLORREF textColor,COLORREF backColor, CFont* pf)
+{
+	m_nLine=LCS_RECT;
+	m_nState=0;
+	m_txtclr=textColor;
+	m_bkgclr=backColor;
+	m_nFormat=nCellFormat;
+
+	m_strTxt = lpstr;
+	m_rect=r;
+	m_pfont=pf;
+	m_pBitmap=0;
+}
+
+void CLogCell::operator=(const CLogCell& log)
+{
+	m_nLine=log.m_nLine;
+	m_nState=log.m_nState;
+	m_txtclr=log.m_txtclr;
+	m_bkgclr=log.m_bkgclr;
+	m_nFormat=log.m_nFormat;
+
+	m_strTxt=log.m_strTxt;
+	m_rect=log.m_rect;
+	m_pfont=log.m_pfont;
+	m_pBitmap=log.m_pBitmap;
+}
+
+void CLogCell::InitCell()
+{
+	m_nLine=LCS_RECT;
+	m_nState=0;
+	m_txtclr=0X00000000;
+	m_bkgclr=0X00FFFFFF;
+	m_nFormat=0;
+	m_strTxt="";
+	m_pfont=0;
+	m_pBitmap=0;
+	memset(&m_rect, NULL, sizeof(m_rect));
+}
+
+void CLogCell::Draw(CDC* pDC)
+{
+//	ASSERT(pDC);
+	if(GetFlag(m_nState)==LCS_UNUSE)
+		return;
+	CRect rect=m_rect;
+
+	CFont* pOldFont=0;
+	int nMode=pDC->SetBkMode(TRANSPARENT);
+	COLORREF color=pDC->SetTextColor(m_txtclr);
+	if(m_pfont) 
+		pOldFont=pDC->SelectObject(m_pfont);
+
+	pDC->FillRect(rect, &CBrush(m_bkgclr));
+	if(	m_nLine & LCS_TLINE)
+	{
+		pDC->MoveTo(rect.left, rect.top);
+		pDC->LineTo(rect.right,rect.top);
+	}
+	if(	m_nLine & LCS_BLINE)
+	{
+		pDC->MoveTo(rect.left, rect.bottom);
+		pDC->LineTo(rect.right,rect.bottom);
+	}
+	if(	m_nLine & LCS_LLINE)
+	{
+		pDC->MoveTo(rect.left, rect.top);
+		pDC->LineTo(rect.left, rect.bottom);
+	}
+	if(	m_nLine & LCS_RLINE)
+	{
+		pDC->MoveTo(rect.right, rect.top);
+		pDC->LineTo(rect.right, rect.bottom);
+	}
+	//1mm捞悼
+	rect.left+=(pDC->GetDeviceCaps(HORZSIZE)/10);
+	rect.right-=(pDC->GetDeviceCaps(HORZSIZE)/10);
+
+	if(m_pBitmap)
+		pDC->DrawState( rect.TopLeft(), rect.Size(), m_pBitmap, DSS_NORMAL, &CBrush(m_bkgclr));
+
+	pDC->DrawText(m_strTxt, -1, rect, m_nFormat);
+
+	if(pOldFont)
+		pDC->SelectObject(pOldFont);
+	pDC->SetTextColor(color);
+	pDC->SetBkMode(nMode);
+}
+
+CLogPage::CLogPage()
+{
+	m_startPnt=CPoint(0,0);
+	RemoveAll();
+}
+
+CLogPage::CLogPage(CPoint startPnt)
+{
+	m_startPnt=startPnt;
+	RemoveAll();
+}
+
+CLogPage::~CLogPage()
+{
+	RemoveAll();
+}
+
+void CLogPage::RemoveAll()
+{
+	m_ColCnt=0;
+	m_RowCnt=0;
+	m_liAry.RemoveAll();
+	m_startPnt=CPoint(0,0);
+}
+
+BOOL CLogPage::SetPageRect(CDC* pDC, CRect page, CRect device)
+{
+	ASSERT(pDC);
+
+	pDC->SetMapMode(MM_ISOTROPIC);
+
+	//其捞瘤 农扁 汲沥
+	pDC->SetWindowOrg(page.TopLeft());
+	pDC->SetWindowExt(page.right,page.bottom);
+
+	//矫累困摹,付瘤阜 困摹
+	pDC->SetViewportOrg( device.TopLeft() );
+	pDC->SetViewportExt( device.right, device.bottom);
+	for( int i=0; i<m_RowCnt; i++)
+	{
+		for( int j=0; j<m_ColCnt; j++)
+			pDC->LPtoDP(&m_liAry[i][j].m_rect);
+	}
+	m_IsViewPort=true;
+	pDC->SetMapMode(MM_TEXT);
+	return 1;
+}
+
+BOOL CLogPage::SetColWidth(int nCol, int nWidth)
+{
+	LOGCHECK0(nCol>=m_ColCnt);
+	for( int i=0; i<m_RowCnt; i++)
+	{
+		if(nCol==0)
+		{
+			m_liAry[i][0].m_rect.left =m_startPnt.x;
+			m_liAry[i][0].m_rect.right=m_startPnt.x + nWidth;
+		}
+		else
+		{
+			m_liAry[i][nCol].m_rect.left =
+				m_liAry[i][nCol-1].m_rect.right;
+			m_liAry[i][nCol].m_rect.right=
+				m_liAry[i][nCol-1].m_rect.right + nWidth;
+		}
+	}
+	return 1;
+}
+
+BOOL CLogPage::SetRowHeight(int nRow, int nHeight)
+{
+	LOGCHECK0(nRow>=m_RowCnt);
+	for( int i=0; i<m_ColCnt; i++)
+	{
+		if(nRow==0)
+		{
+			m_liAry[0][i].m_rect.top =m_startPnt.y;
+			m_liAry[0][i].m_rect.bottom=m_startPnt.y + nHeight;
+		}
+		else
+		{
+			m_liAry[nRow][i].m_rect.top =
+				m_liAry[nRow-1][i].m_rect.bottom;
+
+			m_liAry[nRow][i].m_rect.bottom =
+				m_liAry[nRow-1][i].m_rect.bottom+nHeight;
+		}
+	}
+	return 1;
+}
+
+void CLogPage::SetColCount(int nCount)
+{
+	m_ColCnt=nCount;
+	int nSize=static_cast<int>(m_liAry.GetSize());
+	for( int i=0; i<nSize; i++)
+		m_liAry[i].SetSize(nCount);
+}
+
+void CLogPage::SetRowCount(int nCount)
+{
+	m_RowCnt=nCount;
+	m_liAry.SetSize(nCount);
+	for( int i=0; i<nCount; i++)
+		m_liAry[i].SetSize(m_ColCnt);
+}
+
+BOOL CLogPage::RemoveRow(int nRow)
+{
+	LOGCHECK0(nRow>=m_RowCnt);
+	m_liAry.RemoveAt(nRow);
+	return 1;
+}
+
+//厘钎 免仿困摹
+void CLogPage::SetStartPoint(CPoint startPnt)
+{
+	m_startPnt=startPnt;
+}
+
+CPoint CLogPage::GetStartPoint() const 
+{ 
+	return m_startPnt;
+}
+
+//青,凯 肮荐甫 府畔茄促.
+int CLogPage::GetColCount() const
+{
+	return m_ColCnt;
+}
+int CLogPage::GetRowCount() const 
+{
+	return m_RowCnt;
+}
+
+//迄飘甫 汲沥茄促.
+BOOL CLogPage::SetCellFont(int nRow, int nCol, CFont* pf)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol].m_pfont = pf;
+	return 1;
+}
+
+BOOL CLogPage::SetCellFont(int nsRow, int nsCol, int neRow, int neCol, CFont* pf)
+{
+	LOGCHECK0(neRow>=m_RowCnt || neCol>=m_ColCnt);
+	for( int i=nsRow; i<=neRow; i++)
+	{
+		for( int j=nsCol; j<=neCol; j++)
+			m_liAry[i][j].m_pfont = pf;
+	}
+	return 1;
+}
+
+CFont* CLogPage::GetCellFont(int nRow, int nCol)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	return m_liAry[nRow][nCol].m_pfont;
+}
+
+//硅版祸阑 汲沥茄促.
+BOOL CLogPage::SetCellBkgColor(int nRow, int nCol, COLORREF color)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol].m_bkgclr = color;
+	return 1;
+}
+COLORREF CLogPage::GetCellBkgColor(int nRow, int nCol)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	return m_liAry[nRow][nCol].m_bkgclr;
+}
+
+//臂磊祸阑 汲沥茄促.
+BOOL CLogPage::SetCellTxtColor(int nRow, int nCol, COLORREF color)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol].m_txtclr=color;
+	return 1;
+}
+COLORREF CLogPage::GetCellTxtColor(int nRow, int nCol)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	return m_liAry[nRow][nCol].m_txtclr;
+}
+
+//臂磊困摹 汲沥
+BOOL CLogPage::SetCellFormat(int nRow, int nCol, int nFormat)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol].m_nFormat = nFormat;
+	return 1;
+}
+
+int CLogPage::GetCellFormat(int nRow, int nCol)
+{
+	LOGCHECK1(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	return m_liAry[nRow][nCol].m_nFormat;
+}
+
+//Rect阑 函版茄促.
+BOOL CLogPage::SetCellRect(int nRow, int nCol, CRect rect)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol].m_rect=rect;
+	return 1;
+}
+
+BOOL CLogPage::GetCellRect(int nRow, int nCol, CRect& rect)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	rect = m_liAry[nRow][nCol].m_rect;
+	return 1;
+}
+
+//BITMAP阑 汲沥茄促.
+BOOL CLogPage::SetCellBmp(int nRow, int nCol, CBitmap* pBmp)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol].m_pBitmap=pBmp;
+	return 1;
+}
+
+CBitmap* CLogPage::GetCellBmp(int nRow, int nCol)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	return m_liAry[nRow][nCol].m_pBitmap;
+}
+
+//荤阿屈 弊副锭 绢蠢 困摹甫 弊副 巴牢啊 汲沥茄促. 
+BOOL CLogPage::SetCellLine(int nRow, int nCol, int nState)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol].m_nLine=nState;
+	return 1;
+}
+
+int CLogPage::GetCellLine(int nRow, int nCol)
+{
+	LOGCHECK1(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	return m_liAry[nRow][nCol].m_nLine;
+}
+
+void CLogPage::operator=(CLogPage& page)
+{
+	m_RowCnt=page.m_RowCnt;
+	m_ColCnt=page.m_ColCnt;
+	m_startPnt=page.m_startPnt;
+	m_liAry.SetSize(m_RowCnt);
+	for( int i=0; i<m_RowCnt; i++)
+	{
+		m_liAry[i].SetSize(m_ColCnt);
+		for( int j=0; j<m_ColCnt; j++)
+			m_liAry[i][j]=page.m_liAry[i][j];
+	}
+}
+
+BOOL CLogPage::SetItemText(int nRow, int nCol, LPCTSTR lpstr, int nFormat)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol].m_strTxt=lpstr;
+	m_liAry[nRow][nCol].m_nFormat = nFormat;
+	return 1;
+}
+
+CString CLogPage::GetItemText(int nRow, int nCol)
+{
+	return m_liAry[nRow][nCol].m_strTxt;
+}
+
+BOOL CLogPage::SetCell(int nRow, int nCol, CLogCell lc)
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	m_liAry[nRow][nCol]=lc;
+	return 1;
+}
+
+CLogCell* CLogPage::GetCell(int nRow, int nCol) 
+{
+	LOGCHECK0(nRow>=m_RowCnt || nCol>=m_ColCnt);
+	return &m_liAry[nRow][nCol];
+}
+
+void CLogPage::Draw(CDC* pDC, int nPageNO)
+{
+	LOGCHECK(m_RowCnt==0 || m_ColCnt==0);
+	for( int i=0; i<m_RowCnt; i++)
+	{
+		for( int j=0; j<m_ColCnt; j++)
+			m_liAry[i][j].Draw(pDC);
+	}
+
+	int nVertres = pDC->GetDeviceCaps(VERTRES);
+	int nHorzres = pDC->GetDeviceCaps(HORZRES);
+	int nHorzSize= pDC->GetDeviceCaps(HORZSIZE);
+	int nVertSize= pDC->GetDeviceCaps(VERTSIZE);
+
+	if(nPageNO)
+	{
+		CString str="";
+		CPoint pntOrg;
+		str.Format(_T("%d"), nPageNO);
+		CRect rect( 0, 0, nHorzSize, nVertSize);
+
+		pntOrg=pDC->SetViewportOrg(nHorzres/2, nVertres-nVertSize);
+		pDC->DrawText(str, -1, rect, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
+		pDC->SetViewportOrg(pntOrg.x, pntOrg.y);
+	}
+}
+
+BOOL CLogPage::CellMerge(int nsRow, int nsCol, int neRow, int neCol)
+{
+	LOGCHECK0(neRow>=m_RowCnt || neCol>=m_ColCnt);
+	for( int i=nsRow; i<=neRow; i++)
+	{
+		for( int j=nsCol; j<=neCol; j++)
+		{
+			if(i==nsRow && j==nsCol)
+			{
+				m_liAry[i][j].m_nState=	SetFlag(LCS_MERGE) | 
+										SetDown(neRow-nsRow) | 
+										SetRight(neCol-nsCol);
+
+				CRect rect = m_liAry[i][j].m_rect;
+				rect =m_liAry[neRow][neCol].m_rect;
+
+				m_liAry[i][j].m_rect.bottom=m_liAry[neRow][neCol].m_rect.bottom;
+				m_liAry[i][j].m_rect.right=m_liAry[neRow][neCol].m_rect.right;
+			}
+			else
+			{
+				m_liAry[i][j].m_nState=SetFlag(LCS_UNUSE);
+			}
+		}
+	}
+	return 1;
+}
+
+CLogCtrl::CLogCtrl()
+{
+	m_log.RemoveAll(); 
+}
+
+CLogCtrl::~CLogCtrl()		
+{ 
+	m_log.RemoveAll(); 
+}
+
+int CLogCtrl::GetLogPageCount()
+{ 
+	return static_cast<int>(m_log.GetSize()); 
+}
+
+void CLogCtrl::AddLogPage(CLogPage& lp)
+{ 
+	m_log.Add(lp); 
+}
+
+CLogPage* CLogCtrl::GetLogPage(int nPage)
+{ 
+	LOGCHECK0(m_log.GetSize()<=nPage);
+	return &m_log[nPage]; 
+}
+
+void CLogCtrl::DelLogPage(int nPage)
+{
+	LOGCHECK(m_log.GetSize()<=nPage);
+	m_log.RemoveAt(nPage);
+}
+
+void CLogCtrl::Draw(CDC* pDC, DOCINFO* pDocInfo)
+{
+	ASSERT(pDC);
+
+	int nSize = static_cast<int>(m_log.GetSize());
+	LOGCHECK(nSize<1);
+	
+	pDC->StartDoc(pDocInfo);
+	for( int i=0; i<nSize; i++)
+	{
+		pDC->StartPage();
+		m_log[i].Draw(pDC,i+1);
+		pDC->EndPage();
+	}
+	pDC->EndDoc();
+}
diff --git a/Common_Class/SISControls/PropertyGridControl/CustomItem.h b/Common_Class/SISControls/PropertyGridControl/CustomItem.h
new file mode 100644
index 0000000..efca4f2
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/CustomItem.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#include "PropertyGrid.h"
+
+class ICustomItem
+{
+public:
+  // basic required stuff
+  virtual CPropertyGrid::EEditMode GetEditMode() = 0;
+  virtual void DrawItem(CDC& dc, CRect rc, bool focused) = 0;
+
+  // validation
+  virtual void ValidateChanges() {}
+
+  // mouse stuff
+  virtual bool OnLButtonDown(CRect rc, CPoint pt) { return false; }
+  virtual void OnMouseMove(CRect rc, CPoint pt) {}
+  virtual void OnLButtonUp(CRect rc, CPoint pt) {}
+
+  // in-place edit
+  virtual CString GetStringForInPlaceEdit() { return _T(""); }
+  virtual bool OnItemEdited(CString strNewValue) { return false; }
+
+  // dropdown edit
+  virtual void ShowDropDown(CRect rc) {}
+
+  // modal edit
+  virtual bool OnEditItem() { return false; }
+
+protected:
+  friend class CPropertyGrid;
+  CPropertyGrid* m_pGrid;
+};
+
diff --git a/Common_Class/SISControls/PropertyGridControl/DynDialogEx.cpp b/Common_Class/SISControls/PropertyGridControl/DynDialogEx.cpp
new file mode 100644
index 0000000..1275180
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/DynDialogEx.cpp
@@ -0,0 +1,621 @@
+// DynDialogEx.cpp : 备泅 颇老涝聪促.
+//
+
+#include "../stdafx.h"
+#include "DynDialogEx.h"
+#include "afxdialogex.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+// CDynDialogEx 措拳 惑磊涝聪促.
+
+CDynDialogEx::CDynDialogEx(CWnd* pParent /*=NULL*/)
+: CDialog()
+{
+  //{{AFX_DATA_INIT(CDynDialogEx)
+  // NOTE: the ClassWizard will add member initialization here
+  //}}AFX_DATA_INIT
+
+  m_DialogTemplate.style				= WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_SETFONT;
+  m_DialogTemplate.dwExtendedStyle = WS_EX_DLGMODALFRAME;
+  m_DialogTemplate.x					= 0;
+  m_DialogTemplate.y					= 0;
+  m_DialogTemplate.cx					= 0; // 4 horizontal units are the width of one character
+  m_DialogTemplate.cy					= 0; // 8 vertical units are the height of one character
+  m_DialogTemplate.cdit				= 0;  // nr of dialog items in the dialog
+
+  m_pParentWnd	= pParent;
+  m_strCaption	= _T("");
+  m_pFont			= NULL;
+  m_wFontSize		= 0;
+  m_nCurRow		= FIRSTROW1;
+  m_bAddSystemButtons = TRUE;
+
+  m_bIsFontCreated = FALSE;
+  m_bModelessDlg = FALSE;
+}
+
+CDynDialogEx::~CDynDialogEx()
+{
+  CDynDialogItemEx *pDynDialogItemEx = NULL;
+  for (INT_PTR i = m_arrDlgItemPtr.GetSize() - 1; i >= 0; i--) {
+    pDynDialogItemEx = m_arrDlgItemPtr[i];
+    if (pDynDialogItemEx != NULL) {
+      delete pDynDialogItemEx;
+      pDynDialogItemEx = NULL;
+    }
+  }
+
+  if (m_bIsFontCreated) {
+    delete m_pFont;
+  }
+}
+
+CWnd *CDynDialogEx::GetParent()
+{
+  return m_pParentWnd;
+}
+
+void CDynDialogEx::AddStyles(DWORD dwStyles)
+{
+  m_DialogTemplate.style |= dwStyles;
+}
+
+void CDynDialogEx::RemoveStyles(DWORD dwStyles)
+{
+  m_DialogTemplate.style &= (~dwStyles);
+}
+
+void CDynDialogEx::DoDataExchange(CDataExchange* pDX)
+{
+  CDialog::DoDataExchange(pDX);
+  //{{AFX_DATA_MAP(CDynDialogEx)
+  // NOTE: the ClassWizard will add DDX and DDV calls here
+  //}}AFX_DATA_MAP
+
+  CDynDialogItemEx *pDynDialogItemEx = NULL;
+  for (INT_PTR i = m_arrDlgItemPtr.GetSize() - 1; i >= 0; i--) {
+    pDynDialogItemEx = m_arrDlgItemPtr[i];
+    if (pDynDialogItemEx != NULL) {
+      pDynDialogItemEx->DoDataExchange(pDX);
+    }
+  }
+}
+
+BEGIN_MESSAGE_MAP(CDynDialogEx, CDialog)
+  //{{AFX_MSG_MAP(CDynDialogEx)
+  ON_WM_CREATE()
+  //}}AFX_MSG_MAP
+  ON_MESSAGE(WM_HELP, OnHelpMsg)
+  ON_WM_MEASUREITEM()		// TMB! 06-12-2001 Adjusted.. was wrongly an ON_MESSAGE()!!
+  ON_WM_DRAWITEM()			// TMB! 06-12-2001 Adjusted.. was wrongly an ON_MESSAGE()!!
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDynDialogEx message handlers
+
+int CDynDialogEx::OnCreate(LPCREATESTRUCT lpCreateStruct) 
+{
+  if (CDialog::OnCreate(lpCreateStruct) == -1)
+    return -1;
+
+  //if we have no font, create one here
+  if (m_pFont == NULL) {
+    LOGFONT LogFont;
+
+    // Can do better???
+    memset(&LogFont, 0x00, sizeof(LogFont));
+    _tcsncpy_s(LogFont.lfFaceName, _T("MS Sans Serif"), LF_FACESIZE);
+    LogFont.lfHeight = 8;
+
+    m_pFont = new CFont;
+    m_pFont->CreateFontIndirect(&LogFont);
+    SetFont(m_pFont);
+    m_bIsFontCreated = TRUE;
+  }
+
+  //Create all the controls on the dialog
+  CDynDialogItemEx *pDynDialogItemEx = NULL;
+  for (int i = 0; i < m_arrDlgItemPtr.GetSize(); i++) {
+    pDynDialogItemEx = m_arrDlgItemPtr[i];
+    if (pDynDialogItemEx != NULL) {
+      if (!pDynDialogItemEx->IsDlgItemSubclassed()) {
+        if (!pDynDialogItemEx->CreateEx(this)) {
+          AfxMessageBox(_T("Failed to create DlgItem."));
+        }
+        else if (pDynDialogItemEx->GetSafeHwnd() != NULL) {
+          pDynDialogItemEx->SetFont(m_pFont, FALSE);
+        }
+      }
+    }
+  }
+
+  return 0;
+}
+
+BOOL CDynDialogEx::OnInitDialog() 
+{
+  //Reposition all the controls on the dialog...
+  CDynDialogItemEx *pDynDialogItemEx = NULL;
+  for (int i = 0; i < m_arrDlgItemPtr.GetSize(); i++) 
+  {
+    pDynDialogItemEx = m_arrDlgItemPtr[i];
+    if (pDynDialogItemEx != NULL)
+	{
+      if (!pDynDialogItemEx->IsDlgItemSubclassed() && !pDynDialogItemEx->SetWindowPos(this)) 
+	  {
+        CString strMessage;
+        strMessage.Format(_T("Failed SetWindowPos for control %s."), pDynDialogItemEx->GetClassName());
+        AfxMessageBox(strMessage);
+      }
+    }
+  }
+
+  CDialog::OnInitDialog();
+
+  CenterWindow();
+
+  return TRUE;  // return TRUE unless you set the focus to a control
+  // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+INT_PTR CDynDialogEx::DoModal() 
+{
+	//Do we need OK and Cancel buttons??
+	if (m_bAddSystemButtons) 
+	{
+		AddSystemButtons();
+	}
+
+	//
+	// Get font info from mainwindow of the application
+	//
+	CFont* pParentFont = m_pFont;
+	if (pParentFont == NULL && m_pParentWnd != NULL) 
+	{
+		pParentFont = m_pParentWnd->GetFont();
+	}
+	if (pParentFont == NULL && AfxGetApp()->m_pActiveWnd != NULL) 
+	{
+		pParentFont = AfxGetApp()->m_pActiveWnd->GetFont();
+	}
+
+	LOGFONT LogFont;
+	memset(&LogFont, 0x00, sizeof(LogFont));
+	if (pParentFont != NULL)
+	{
+		pParentFont->GetLogFont(&LogFont);
+	}
+	else 
+	{
+		// Can do better???
+		_tcsncpy(LogFont.lfFaceName, _T("MS Sans Serif"), LF_FACESIZE);
+		LogFont.lfHeight = 8;
+	}
+
+	//Prework for setting font in dialog...
+	//int cWC = MultiByteToWideChar(CP_ACP, 0, LogFont.lfFaceName, -1, NULL, 0);
+	int cWC = (int)_tcslen(LogFont.lfFaceName)+1;
+	int nFontNameLen = cWC + 1;
+	WCHAR *szFontName = new WCHAR[nFontNameLen];
+
+	// Copy the string
+	//MultiByteToWideChar(CP_ACP, 0, LogFont.lfFaceName, -1, (LPWSTR) szFontName, cWC);
+	_tcsncpy(szFontName, LogFont.lfFaceName, cWC);
+
+	szFontName[cWC] = 0;
+	nFontNameLen = (cWC) * sizeof(WCHAR);
+
+	if (m_wFontSize == 0) 
+	{
+		m_wFontSize = (unsigned short)LogFont.lfHeight;
+	}
+
+	//Prework for setting caption in dialog...
+	//cWC = MultiByteToWideChar(CP_ACP, 0, m_strCaption, -1, NULL, 0);
+	cWC = m_strCaption.GetLength()+1;
+	int szBoxLen = cWC + 1;
+	WCHAR *szBoxCaption = new WCHAR[szBoxLen];
+
+	// Copy the string
+	//MultiByteToWideChar(CP_ACP, 0, m_strCaption, -1, (LPWSTR) szBoxCaption, cWC);
+	_tcsncpy(szBoxCaption, m_strCaption, cWC);
+	szBoxCaption[cWC] = 0;
+	szBoxLen = (cWC) * sizeof(WCHAR);
+
+	INT_PTR iRet = -1;
+	//Here 's the stuff to build the dialog template in memory
+	//without the controls being in the template
+	//(Our first try, was this same template with some additional code
+	//for each control placed on it, that's why this class is cold Ex :)
+	//This gave some problems on WIN9x systems, where EDIT boxes
+	//were not shown with 3D-look, but as flat controls)
+	int nBufferSize =  sizeof(DLGTEMPLATE) + (2 * sizeof(WORD)) /*menu and class*/ + szBoxLen /*size of caption*/
+	+ sizeof(WORD) /*fontsize*/ + nFontNameLen /*size of fontname*/;
+
+	//Are there any subclassed controls...
+	if (m_DialogTemplate.cdit > 0)
+	{
+		nBufferSize = (nBufferSize + 3) & ~3;  // adjust size to make first control DWORD aligned
+
+		CDynDialogItemEx *pDynDialogItemEx = NULL;
+		for (int i = 0; i < m_arrDlgItemPtr.GetSize(); i++)
+		{
+			pDynDialogItemEx = m_arrDlgItemPtr[i];
+			if (pDynDialogItemEx != NULL)
+			{
+				if (pDynDialogItemEx->IsDlgItemSubclassed())
+				{
+					int nItemLength = sizeof(DLGITEMTEMPLATE) + 3 * sizeof(WORD);
+					nItemLength += (pDynDialogItemEx->GetCaptionLength() + 1) * sizeof(WCHAR);
+
+					if (i != m_DialogTemplate.cdit - 1) 
+					{   // the last control does not need extra bytes
+						nItemLength = (nItemLength + 3) & ~3;  // take into account gap so next control is DWORD aligned
+					}
+					nBufferSize += nItemLength;
+				}
+			}
+		}
+	}
+
+	HLOCAL hLocal = LocalAlloc(LHND, nBufferSize);
+	if (hLocal != NULL)
+	{
+		BYTE*	pBuffer = (BYTE*)LocalLock(hLocal);
+		if (pBuffer == NULL) 
+		{
+			LocalFree(hLocal);
+			AfxMessageBox(_T("CDynDialogEx::DoModal() : LocalLock Failed"));
+		}
+
+		BYTE *pdest = pBuffer;
+		// transfer DLGTEMPLATE structure to the buffer
+		memcpy(pdest, &m_DialogTemplate, sizeof(DLGTEMPLATE));	// DLGTemplate
+		pdest += sizeof(DLGTEMPLATE);
+		*(WORD*)pdest = 0;									// no menu						 -- WORD to say it is 0 bytes
+		pdest += sizeof(WORD);								// Increment
+		*(WORD*)(pdest + 1) = 0;							// use default window class -- WORD to say it is 0 bytes
+		pdest += sizeof(WORD);								// Increment
+		memcpy(pdest, szBoxCaption, szBoxLen);			// Caption
+		pdest += szBoxLen;
+
+		*(WORD*)pdest = m_wFontSize;						// font size
+		pdest += sizeof(WORD);
+		memcpy(pdest, szFontName, nFontNameLen);		// font name
+		pdest += nFontNameLen;
+
+		// will now transfer the information for each one of subclassed controls...
+		if (m_DialogTemplate.cdit > 0) 
+		{
+			CDynDialogItemEx *pDynDialogItemEx = NULL;
+			for (int i = 0; i < m_arrDlgItemPtr.GetSize(); i++) 
+			{
+				pDynDialogItemEx = m_arrDlgItemPtr[i];
+				if (pDynDialogItemEx != NULL)
+				{
+					if (pDynDialogItemEx->IsDlgItemSubclassed()) 
+					{
+						pdest = pDynDialogItemEx->FillBufferWithItemTemplate(pdest);
+					}
+				}
+			}
+		}
+		ASSERT(pdest - pBuffer == nBufferSize); // just make sure we did not overrun the heap
+
+		//Next lines to make sure that MFC makes no ASSERTION when PREVIOUS/NEXT is pressed:)
+		if (m_lpDialogTemplate != NULL) 
+		{
+			m_lpDialogTemplate = NULL;
+		}
+
+		//These are the MFC functions, which do the job...
+		if (m_bModelessDlg)
+		{
+			iRet = CreateIndirect((LPDLGTEMPLATE)pBuffer, m_pParentWnd);		
+		}
+		else 
+		{
+			InitModalIndirect((LPDLGTEMPLATE)pBuffer, m_pParentWnd);
+			iRet = CDialog::DoModal();
+		}
+
+		LocalUnlock(hLocal);
+		LocalFree(hLocal);
+
+		delete [] szBoxCaption;
+		delete [] szFontName;
+		return iRet;
+	}
+	else
+	{
+		AfxMessageBox(_T("CDynDialogEx::DoModal() : LocalAllock Failed"));
+		return -1;
+	}
+}
+
+void CDynDialogEx::SetFont(CFont *pFont)
+{
+  m_pFont = pFont;
+}
+
+CFont *CDynDialogEx::GetFont()
+{
+  return m_pFont;
+}
+
+void CDynDialogEx::SetFontSize(WORD wSize)
+{
+  m_wFontSize = wSize;
+}
+
+WORD CDynDialogEx::GetFontSize()
+{
+  return m_wFontSize;
+}
+
+void CDynDialogEx::SetUseSystemButtons(BOOL bUse /*= TRUE*/)
+{
+  m_bAddSystemButtons = bUse;
+}
+
+void CDynDialogEx::GetDlgRect(LPRECT lpRect)
+{
+  ASSERT(lpRect);
+  lpRect->left   = m_DialogTemplate.x;
+  lpRect->top    = m_DialogTemplate.y;
+  lpRect->right  = lpRect->left + m_DialogTemplate.cx;
+  lpRect->bottom = lpRect->top + m_DialogTemplate.cy;
+}
+
+void CDynDialogEx::SetDlgRect(LPRECT lpRect)
+{
+  ASSERT(lpRect);
+  //#pragma warning(disable : 4244)
+  m_DialogTemplate.cx = (short)(lpRect->right  - lpRect->left);
+  m_DialogTemplate.cy = (short)(lpRect->bottom - lpRect->top);
+  m_DialogTemplate.x  = (short)(lpRect->left);
+  m_DialogTemplate.y  = (short)(lpRect->top);
+  //#pragma warning(default : 4244)
+}
+
+void CDynDialogEx::SetDlgRectangle(LPRECT pRect)
+{
+  RECT rect;
+
+  GetDlgRect(&rect);
+  if (rect.left > pRect->left) {
+    rect.left = pRect->left;
+  }
+  if (rect.right < pRect->right) {
+    rect.right = pRect->right + 5;
+  }
+  if (rect.top > pRect->top) {
+    rect.top = pRect->top;
+  }
+  if (rect.bottom < pRect->bottom) {
+    rect.bottom = pRect->bottom + 5;
+  }
+  SetDlgRect(&rect);
+}
+
+UINT CDynDialogEx::AddDlgControl(DLGITEMTEMPLATECONTROLS TypeControl,
+                                 LPCTSTR lpszCaption,
+                                 DWORD dwStyle,
+                                 DWORD dwExtendedStyle,
+                                 LPRECT pRect /*= NULL*/,
+                                 void *pData /*= NULL*/,
+                                 UINT nID /*= 0*/)
+{
+  UINT nRet = 0;
+  //In case no rectangle given create our own...
+  CRect Rect(FIXEDCOL1, m_nCurRow, FIXEDCOL2, m_nCurRow + ROWSTEPSIZE);
+
+  //if no rectangle given use our own...
+  if (pRect == NULL) {
+    pRect = &Rect;
+  }
+  //	else {
+  //		m_nCurRow = max(m_nCurRow, pRect->bottom) - m_nCurRow;
+  //	}
+
+  m_nCurRow += (ROWSTEPSIZE);
+
+  //Update dialogtemplate boundaries
+  SetDlgRectangle(pRect);
+
+  //Create control and add to array of controls
+  CDynDialogItemEx *pDynDialogItemEx = new CDynDialogItemEx;
+  if (pDynDialogItemEx != NULL) {
+    nRet = pDynDialogItemEx->InitDialogItem(TypeControl, dwStyle, dwExtendedStyle, pRect, lpszCaption, nID, FALSE, pData);
+    m_arrDlgItemPtr.Add(pDynDialogItemEx);
+  }
+
+  //Return ID of Control we created.
+  return nRet;
+}
+
+UINT CDynDialogEx::AddDlgControl(LPCSTR lpszClassName,
+                                 LPCTSTR lpszCaption,
+                                 DWORD dwStyle,
+                                 DWORD dwExtendedStyle,
+                                 LPRECT pRect /*= NULL*/,
+                                 void *pData /*= NULL*/,
+                                 UINT nID /*= 0*/)
+{
+  UINT nRet = 0;
+  //In case no rectangle given create our own...
+  CRect Rect(FIXEDCOL1, m_nCurRow, FIXEDCOL2, m_nCurRow + ROWSTEPSIZE);
+
+  //if no rectangle given use our own...
+  if (pRect == NULL) {
+    pRect = &Rect;
+    Rect.right += INPUTCOL;
+  }
+  //	else {
+  //		m_nCurRow = max(m_nCurRow, pRect->bottom) - m_nCurRow;
+  //	}
+
+  m_nCurRow += (ROWSTEPSIZE);
+
+  //Update dialogtemplate boundaries
+  SetDlgRectangle(pRect);
+
+  //Create control and add to array of controls
+  CDynDialogItemEx *pDynDialogItemEx = new CDynDialogItemEx;
+  if (pDynDialogItemEx != NULL) {
+    nRet = pDynDialogItemEx->InitDialogItem(lpszClassName, dwStyle, dwExtendedStyle, pRect, lpszCaption, nID, FALSE, pData);
+    m_arrDlgItemPtr.Add(pDynDialogItemEx);
+  }
+
+  //Return ID of Control we created.
+  return nRet;
+}
+
+UINT CDynDialogEx::AddSubclassedDlgControl(LPCSTR lpszClassName,
+                                           LPCTSTR lpszCaption,
+                                           DWORD dwStyle,
+                                           DWORD dwExtendedStyle,
+                                           LPRECT pRect /*= NULL*/,
+                                           UINT nID /*= 0*/)
+{
+  UINT nRet = 0;
+  //In case no rectangle given create our own...
+  CRect Rect(FIXEDCOL1, m_nCurRow, FIXEDCOL2, m_nCurRow + ROWSTEPSIZE);
+
+  //if no rectangle given use our own...
+  if (pRect == NULL) {
+    pRect = &Rect;
+    Rect.right += INPUTCOL;
+  }
+  //	else {
+  //		m_nCurRow = max(m_nCurRow, pRect->bottom) - m_nCurRow;
+  //	}
+
+  m_nCurRow += (ROWSTEPSIZE);
+
+  //Update dialogtemplate boundaries
+  SetDlgRectangle(pRect);
+
+  //Create control and add to array of controls
+  CDynDialogItemEx *pDynDialogItemEx = new CDynDialogItemEx;
+  if (pDynDialogItemEx != NULL) {
+    nRet = pDynDialogItemEx->InitDialogItem(lpszClassName, dwStyle, dwExtendedStyle, pRect, lpszCaption, nID, TRUE);
+    m_arrDlgItemPtr.Add(pDynDialogItemEx);
+    m_DialogTemplate.cdit++;
+  }
+
+  //Return ID of Control we created.
+  return nRet;
+}
+
+void CDynDialogEx::AddSystemButtons()
+{
+  m_nCurRow += 6;			// Leave some room!
+  CRect rect(FIXEDCOL1, m_nCurRow, FIXEDCOL2 - 60, m_nCurRow + (long)(ROWSTEPSIZE * 1.2));
+
+  AddDlgControl(BUTTON, _T("OK"), STYLE_BUTTON, EXSTYLE_BUTTON, &rect, NULL, IDOK);
+
+  // This has to be revised later.
+  rect.left  += 55;
+  rect.right += 55;
+  AddDlgControl(BUTTON, _T("Annuleren"), STYLE_BUTTON, EXSTYLE_BUTTON, &rect, NULL, IDCANCEL);
+
+}
+
+void CDynDialogEx::SetWindowTitle(LPCSTR lpszCaption)
+{
+  m_strCaption = lpszCaption;
+}
+
+void CDynDialogEx::SetUseModeless(BOOL bModelessDlg /*= TRUE*/)
+{
+  m_bModelessDlg = bModelessDlg;
+}
+
+void CDynDialogEx::OnCancel()
+{
+  if (m_bModelessDlg) {
+    DestroyWindow();
+  }
+  else {
+    CDialog::OnCancel();
+  }
+}
+
+void CDynDialogEx::OnOK()
+{
+  if (m_bModelessDlg) {
+    DestroyWindow();
+  }
+  else {
+    CDialog::OnOK();
+  }
+}
+
+BOOL CDynDialogEx::OnCommand(WPARAM wParam, LPARAM lParam) 
+{
+  //wParam
+  //The low-order word of wParam identifies the command ID of the menu item, control, or accelerator.
+  //The high-order word of wParam specifies the notification message if the message is from a control.
+  //If the message is from an accelerator, the high-order word is 1.
+  //If the message is from a menu, the high-order word is 0.
+
+  //lParam
+  //Identifies the control that sends the message if the message is from a control. Otherwise, lParam is 0.
+
+  WORD wControlID = LOWORD(wParam);
+  WORD wMessageID = HIWORD(wParam);
+
+  if (wControlID != 0) {
+    switch (wControlID) {
+    case IDOK:
+      OnOK();
+      return TRUE;
+      break;
+    case IDCANCEL:
+      OnCancel();
+      return TRUE;
+      break;
+    default:
+      //if we have a parent send the message to the parent, so we can handle the message over there.
+      if (m_pParentWnd != NULL) {
+        ::SendMessage(m_pParentWnd->GetSafeHwnd(), WM_COMMAND, wParam, lParam);
+      }
+      break;
+    }
+  }
+
+  return CDialog::OnCommand(wParam, lParam);
+}
+
+// Hellup!
+afx_msg LRESULT CDynDialogEx::OnHelpMsg(WPARAM wParam, LPARAM lParam)
+{
+  //lParam		<<-- Contains: (LPHELPINFO)lParam
+  // >> typedef  struct  tagHELPINFO { 
+  //     UINT     cbSize; 
+  //     int      iContextType 
+  //     int      iCtrlId; 
+  //     HANDLE   hItemHandle; 
+  //     DWORD    dwContextId; 
+  //     POINT    MousePos; 
+  // } HELPINFO, FAR *LPHELPINFO;
+
+  //
+  // User pressed F1 in dialog, call the OnHelp() function, this can be overridden...
+  //
+  OnHelp();
+  return TRUE;
+}
+
+// Default implementation of the OnHelp()
+// This one is to be overridden by a caller ;)
+void CDynDialogEx::OnHelp()
+{
+  CDialog::OnHelp();
+}
diff --git a/Common_Class/SISControls/PropertyGridControl/DynDialogEx.h b/Common_Class/SISControls/PropertyGridControl/DynDialogEx.h
new file mode 100644
index 0000000..41edfb9
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/DynDialogEx.h
@@ -0,0 +1,151 @@
+#pragma once
+
+
+// CDynDialogEx 措拳 惑磊涝聪促.
+#include "DynDialogItemEx.h"
+#include "DynDialogItemEx.h"
+
+// Control styles
+#define	STYLE_EDIT							(WS_VISIBLE | WS_CHILD | WS_TABSTOP | SS_LEFT)
+#define	STYLE_MULTIEDIT					(WS_VISIBLE | WS_CHILD | WS_TABSTOP | SS_LEFT | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | ES_WANTRETURN)
+#define	STYLE_STATIC						(WS_VISIBLE | WS_CHILD | SS_LEFT)
+#define	STYLE_STATIC_CENTER				(WS_VISIBLE | WS_CHILD | SS_CENTER)
+#define	STYLE_STATIC_RIGHT				(WS_VISIBLE | WS_CHILD | SS_RIGHT)
+#define	STYLE_RADIO							(WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON)
+#define	STYLE_RADIO_GROUP					(STYLE_RADIO| WS_GROUP | WS_TABSTOP)
+#define	STYLE_BUTTON						(WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON)
+#define	STYLE_GROUPBOX						(WS_VISIBLE | WS_CHILD | BS_GROUPBOX)
+#define	STYLE_CHECKBOX						(WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP | BS_AUTOCHECKBOX)
+#define	STYLE_COMBOBOX_DROPDOWN			(WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VSCROLL | CBS_DROPDOWN | CBS_SORT | CBS_AUTOHSCROLL) // | CBS_DISABLENOSCROLL)
+#define	STYLE_COMBOBOX_DROPDOWN_NOSORT (WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL) // | CBS_DISABLENOSCROLL)
+#define	STYLE_COMBOBOX_SIMPLE			(WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VSCROLL | CBS_SIMPLE | CBS_SORT | CBS_AUTOHSCROLL) // | CBS_DISABLENOSCROLL)
+#define	STYLE_COMBOBOX_SIMPLE_NOSORT	(WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VSCROLL | CBS_SIMPLE | CBS_AUTOHSCROLL) // | CBS_DISABLENOSCROLL)
+#define	STYLE_COMBOBOX_DROPDOWNLIST	(WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_AUTOHSCROLL) // | CBS_DISABLENOSCROLL)
+#define	STYLE_COMBOBOX_DROPDOWNLIST_NOSORT	(WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_AUTOHSCROLL) // | CBS_DISABLENOSCROLL)
+#define  STYLE_LISTBOX						(WS_VISIBLE | WS_CHILD | WS_TABSTOP | LBS_STANDARD)
+
+#define STYLE_DATETIMEPICKER				(WS_VISIBLE | WS_CHILD | WS_TABSTOP | DTS_RIGHTALIGN)
+#define STYLE_TIMEPICKER					(WS_VISIBLE | WS_CHILD | WS_TABSTOP | DTS_RIGHTALIGN | DTS_TIMEFORMAT)
+// Default combo-style
+#define	STYLE_COMBOBOX						(STYLE_COMBOBOX_DROPDOWNLIST)
+#define	STYLE_COMBOBOX_NOSORT			(STYLE_COMBOBOX_DROPDOWNLIST_NOSORT)
+
+// Control Extended styles
+#define	EXSTYLE_EDIT						(WS_EX_CLIENTEDGE)
+#define	EXSTYLE_MULTIEDIT					(WS_EX_CLIENTEDGE)
+#define	EXSTYLE_LISTBOX					(WS_EX_CLIENTEDGE)
+#define	EXSTYLE_STATIC						(0)
+#define	EXSTYLE_RADIO						(0)
+#define	EXSTYLE_BUTTON						(0)
+#define	EXSTYLE_GROUPBOX					(0)
+#define	EXSTYLE_CHECKBOX					(0)
+#define	EXSTYLE_COMBOBOX					(0)
+#define  EXSTYLE_DATETIMEPICKER			(0)
+#define  EXSTYLE_TIMEPICKER				(0)
+
+#define ROWSTEPSIZE	 12 
+#define FIRSTROW1		 10
+#define FIRSTROW2		 37
+#define FIXEDCOL1		 10
+#define FIXEDCOL2		120
+#define INPUTCOL		150
+#define GROWLIMIT		  6
+
+#define MAX_COLS_PER_DESCR		25						// Just a number..
+
+/////////////////////////////////////////////////////////////////////////////
+// CDynDialogEx dialog
+
+class CDynDialogEx : public CDialog
+{
+// Construction
+public:
+	CDynDialogEx(CWnd* pParent = NULL);   // standard constructor
+	virtual ~CDynDialogEx();
+
+	virtual CWnd *GetParent();
+
+	// Dialog Data
+	//{{AFX_DATA(CDynDialogEx)
+	// NOTE: the ClassWizard will add data members here
+	//}}AFX_DATA
+
+	virtual UINT AddDlgControl(DLGITEMTEMPLATECONTROLS TypeControl,
+		LPCTSTR lpszCaption,
+		DWORD dwStyle,
+		DWORD dwExtendedStyle,
+		LPRECT pRect = NULL,
+		void *pData = NULL,
+		UINT nID = 0);
+
+	virtual UINT AddDlgControl(LPCSTR lpszClassName,
+		LPCTSTR lpszCaption,
+		DWORD dwStyle,
+		DWORD dwExtendedStyle,
+		LPRECT pRect = NULL,
+		void *pData = NULL,
+		UINT nID = 0);
+
+	virtual UINT AddSubclassedDlgControl(LPCSTR lpszClassName,
+		LPCTSTR lpszCaption,
+		DWORD dwStyle,
+		DWORD dwExtendedStyle,
+		LPRECT pRect = NULL,
+		UINT nID = 0);
+
+	void SetWindowTitle(LPCSTR lpszCaption);
+	void SetFont(CFont *pFont);
+	CFont *GetFont();
+	void SetFontSize(WORD wSize);
+	WORD GetFontSize();
+	void SetUseSystemButtons(BOOL bUse = TRUE);
+	void SetUseModeless(BOOL bModelessDlg = TRUE);
+	long GetNumberOfConrols() {return long(m_arrDlgItemPtr.GetSize());}
+
+	//Additional functions by Tom Daffin
+	void AddStyles(DWORD dwStyles);
+	void RemoveStyles(DWORD dwStyles);
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CDynDialogEx)
+public:
+	virtual INT_PTR DoModal();
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+	virtual void OnCancel();
+	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
+	virtual void OnOK();
+	//}}AFX_VIRTUAL
+	virtual void OnHelp();										// To be overridden..
+
+protected:
+	CWnd *m_pParentWnd;
+	CString m_strCaption;
+	CFont *m_pFont;
+	WORD m_wFontSize;
+	long m_nCurRow;
+	BOOL m_bAddSystemButtons;
+	BOOL m_bIsFontCreated;
+	BOOL m_bModelessDlg;
+
+	DLGTEMPLATE m_DialogTemplate;
+	CArray<CDynDialogItemEx*, CDynDialogItemEx*>	m_arrDlgItemPtr;
+
+// Implementation
+protected:
+	void AddSystemButtons();
+	void GetDlgRect(LPRECT lpRect);
+	void SetDlgRect(LPRECT lpRect);
+	void SetDlgRectangle(LPRECT pRect);
+	
+	// Generated message map functions
+	//{{AFX_MSG(CDynDialogEx)
+	virtual BOOL OnInitDialog();
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	//}}AFX_MSG
+	afx_msg LRESULT OnHelpMsg(WPARAM wParam, LPARAM lParam);
+
+	DECLARE_MESSAGE_MAP()
+};
diff --git a/Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.cpp b/Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.cpp
new file mode 100644
index 0000000..ebdb8c1
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.cpp
@@ -0,0 +1,519 @@
+// DynDialogItemEx.cpp : 备泅 颇老涝聪促.
+//
+
+#include "../stdafx.h"
+#include "DynDialogItemEx.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+struct _RuntimeLicense {
+  LPCTSTR lpszRegisteredControlName;
+  WCHAR *wchLicenseKey;
+  long lLicenseLength;
+}_TAGRUNTIMELICENSE;
+
+/*mgkgtgnnmnmninigthkgogggvmkhinjggnvm*/						//(MS Multimedia MCI Control - mci32.ocx)
+WCHAR pwchMCIMMControl1LicenseKey[] =
+{
+  0x006D,	0x0067,	0x006B,	0x0067,	0x0074,	0x0067,	
+  0x006E,	0x006E,	0x006D,	0x006E,	0x006D,	0x006E,	
+  0x0069,	0x006E,	0x0069,	0x0067,	0x0074,	0x0068,	
+  0x006B,	0x0067,	0x006F,	0x0067,	0x0067,	0x0067,	
+  0x0076,	0x006D,	0x006B,	0x0068,	0x0069,	0x006E,	
+  0x006A,	0x0067,	0x0067,	0x006E,	0x0076,	0x006D
+};
+
+/*Copyright (c) 1994 */												//(MS Communications Control - mscomm32.ocx)
+WCHAR pwchMSCOMMLibMSComm1LicenseKey[] =
+{
+  0x0043,	0x006F,	0x0070,	0x0079,	0x0072,	0x0069,	
+  0x0067,	0x0068,	0x0074,	0x0020,	0x0028,	0x0063,	
+  0x0029,	0x0020,	0x0031,	0x0039,	0x0039,	0x0034,	
+  0x0020
+};
+
+/*72E67120-5959-11cf-91F6-C2863C385E30*/						//(MS Flex Grid Control - msflxgrd.ocx)
+WCHAR pwchMSFlexGridLibMSFlexGrid1LicenseKey[] =
+{
+  0x0037,	0x0032,	0x0045,	0x0036,	0x0037,	0x0031,	
+  0x0032,	0x0030,	0x002D,	0x0035,	0x0039,	0x0035,	
+  0x0039,	0x002D,	0x0031,	0x0031,	0x0063,	0x0066,	
+  0x002D,	0x0039,	0x0031,	0x0046,	0x0036,	0x002D,	
+  0x0043,	0x0032,	0x0038,	0x0036,	0x0033,	0x0043,	
+  0x0033,	0x0038,	0x0035,	0x0045,	0x0033,	0x0030
+};
+
+/*mgkgtgnnmnmninigthkgogggvmkhinjggnvm*/						//(MS Masked Edit - msmask32.ocx)
+WCHAR pwchMSMaskMaskEdBox1LicenseKey[] =
+{
+  0x006D,	0x0067,	0x006B,	0x0067,	0x0074,	0x0067,	
+  0x006E,	0x006E,	0x006D,	0x006E,	0x006D,	0x006E,	
+  0x0069,	0x006E,	0x0069,	0x0067,	0x0074,	0x0068,	
+  0x006B,	0x0067,	0x006F,	0x0067,	0x0067,	0x0067,	
+  0x0076,	0x006D,	0x006B,	0x0068,	0x0069,	0x006E,	
+  0x006A,	0x0067,	0x0067,	0x006E,	0x0076,	0x006D
+};
+
+/*GL........*/															//(MS Grid Control - grid32.ocx)
+WCHAR pwchMSDBGridDBGridLicenseKey[] =
+{
+  0x0047,	0x004C,	0x0005,	0x0008,	0x0001,	0x0005,	
+  0x0002,	0x0008,	0x0001,	0x0004
+};
+
+/*DB4C0D09-400B-101B-A3C9-08002B2F49FB*/						//(MS Picture Clip Control - picclp32.ocx)
+WCHAR pwchPicClipPictureClip1LicenseKey[] =
+{
+  0x0044,	0x0042,	0x0034,	0x0043,	0x0030,	0x0044,	
+  0x0030,	0x0039,	0x002D,	0x0034,	0x0030,	0x0030,	
+  0x0042,	0x002D,	0x0031,	0x0030,	0x0031,	0x0042,	
+  0x002D,	0x0041,	0x0033,	0x0043,	0x0039,	0x002D,	
+  0x0030,	0x0038,	0x0030,	0x0030,	0x0032,	0x0042,	
+  0x0032,	0x0046,	0x0034,	0x0039,	0x0046,	0x0042
+};
+
+/*04746E60CE4F11CDB23C0000C076FE*/								//(MS Tab Control - tabctl32.ocx) 
+static WCHAR pwchTabDlgSSTab1LicenseKey[] =
+{
+  0x0030,	0x0034,	0x0037,	0x0034,	0x0036,	0x0045,	
+  0x0036,	0x0030,	0x0043,	0x0045,	0x0034,	0x0046,	
+  0x0031,	0x0031,	0x0043,	0x0044,	0x0042,	0x0032,	
+  0x0033,	0x0043,	0x0030,	0x0030,	0x0030,	0x0030,	
+  0x0043,	0x0030,	0x0037,	0x0036,	0x0046,	0x0045
+};
+
+static _RuntimeLicense RuntimeLicenses[] = 
+{
+  {_T("MCI.MMControl.1"), pwchMCIMMControl1LicenseKey, sizeof(pwchMCIMMControl1LicenseKey)},
+  {_T("MSCOMMLib.MSComm.1"), pwchMSCOMMLibMSComm1LicenseKey, sizeof(pwchMSCOMMLibMSComm1LicenseKey)},
+  {_T("MSFlexGridLib.MSFlexGrid.1"), pwchMSFlexGridLibMSFlexGrid1LicenseKey, sizeof(pwchMSFlexGridLibMSFlexGrid1LicenseKey)},
+  {_T("MSMask.MaskEdBox.1"), pwchMSMaskMaskEdBox1LicenseKey, sizeof(pwchMSMaskMaskEdBox1LicenseKey)},
+  {_T("MSDBGrid.DBGrid"), pwchMSDBGridDBGridLicenseKey, sizeof(pwchMSDBGridDBGridLicenseKey)},
+  {_T("PicClip.PictureClip.1"), pwchPicClipPictureClip1LicenseKey, sizeof(pwchPicClipPictureClip1LicenseKey)},
+  {_T("TabDlg.SSTab.1"), pwchTabDlgSSTab1LicenseKey, sizeof(pwchTabDlgSSTab1LicenseKey)},
+  {NULL, NULL, 0}
+};
+
+static UINT glb_nNextID = WM_USER;  // We have to start somewhere...
+
+UINT GetNewUniqueID(void)
+{
+  glb_nNextID++;
+  return glb_nNextID - 1;
+}
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CDynDialogItemEx::CDynDialogItemEx()
+: CWnd()
+{
+  m_eTypeControl = NOCONTROL;
+  m_strClassName = _T("");
+  m_dwStyle = 0;
+  m_dwStyleEx = 0;
+  m_strCaption = _T("");
+  m_ControlID = 0;
+  m_pData = NULL;
+  m_bSubclassed = FALSE;
+}
+
+void CDynDialogItemEx::DoDataExchange(CDataExchange *pDX)
+{
+  if (m_pData != NULL) {
+    switch(m_eTypeControl) {
+case BUTTON:
+  if ((m_dwStyle & BS_AUTORADIOBUTTON) == BS_AUTORADIOBUTTON) {
+    DDX_Radio(pDX, m_ControlID, *(int*)m_pData);
+  }
+  else if ((m_dwStyle & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX) {
+    DDX_Check(pDX, m_ControlID, *(int*)m_pData);
+  }
+  else {
+    DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  }
+  break;
+case EDITCONTROL:
+  DDX_Text(pDX, m_ControlID, *(CString*)m_pData);
+  break;
+case STATICTEXT:
+  DDX_Text(pDX, m_ControlID, *(CString*)m_pData);
+  break;
+case LISTBOX:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case HSCROLL:
+  DDX_Scroll(pDX, m_ControlID, *(int*)m_pData);
+  break;
+case COMBOBOX:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case SPIN:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case PROGRES:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case SLIDER:
+  DDX_Slider(pDX, m_ControlID, *(int*)m_pData);
+  break;
+case HOTKEY:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case LISTCTRL:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case TREECTRL:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case TABCTRL:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case ANIMATE:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case RICHEDIT:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case DATETIMEPICKER:
+  if ((m_dwStyle & DTS_TIMEFORMAT) == DTS_TIMEFORMAT) {
+    DDX_DateTimeCtrl(pDX, m_ControlID, *(CTime*)m_pData);
+  }
+  else {
+    DDX_DateTimeCtrl(pDX, m_ControlID, *(COleDateTime*)m_pData);
+  }
+  break;
+case MONTHCALENDER:
+  DDX_MonthCalCtrl(pDX, m_ControlID, *(COleDateTime*)m_pData);
+  break;
+case IPADRESS:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+case COMBOBOXEX:
+  DDX_Control(pDX, m_ControlID, *(CWnd*)m_pData);
+  break;
+default:
+  break;
+    }
+  }
+  CWnd::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CDynDialogItemEx, CWnd)
+  //{{AFX_MSG_MAP(CDynDialogItemEx)
+  //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+CString CDynDialogItemEx::GetClassNameByType(DLGITEMTEMPLATECONTROLS TypeControl)
+{
+	switch(TypeControl) 
+	{
+	case BUTTON:
+		return _T("BUTTON");
+	case EDITCONTROL:
+		return _T("EDIT");
+	case STATICTEXT:
+		return _T("STATIC");
+	case LISTBOX:
+		return _T("LISTBOX");
+	case HSCROLL:
+		return _T("SCROLLBAR");
+	case COMBOBOX:
+		return _T("COMBOBOX");
+	case SPIN:
+		return _T("msctls_updown32");
+	case PROGRES:
+		return _T("msctls_progress32");
+	case SLIDER:
+		return _T("msctls_trackbar32");
+	case HOTKEY:
+		return _T("msctls_hotkey32");
+	case LISTCTRL:
+		return _T("SysListView32");
+	case TREECTRL:
+		return _T("SysTreeView32");
+	case TABCTRL:
+		return _T("SysTabControl32");
+	case ANIMATE:
+		return _T("SysAnimate32");
+	case RICHEDIT:
+		return _T("RICHEDIT");
+	case DATETIMEPICKER:
+		return _T("SysDateTimePick32");
+	case MONTHCALENDER:
+		return _T("SysMonthCal32");
+	case IPADRESS:
+		return _T("SysIPAddress32");
+	case COMBOBOXEX:
+		return _T("ComboBoxEx32");
+	}
+	return _T("");
+}
+
+DLGITEMTEMPLATECONTROLS CDynDialogItemEx::GetClassTypeByName(LPCSTR lpszClassName)
+{
+  if (memcmp(lpszClassName, _T("BUTTON"), 6) == 0) {
+    return BUTTON;
+  }
+  else if (memcmp(lpszClassName, _T("EDIT"), 4) == 0) {
+    return EDITCONTROL;
+  }
+  else if (memcmp(lpszClassName, _T("STATIC"), 6) == 0) {
+    return STATICTEXT;
+  }
+  else if (memcmp(lpszClassName, _T("LISTBOX"), 7) == 0) {
+    return LISTBOX;
+  }
+  else if (memcmp(lpszClassName, _T("SCROLLBAR"), 9) == 0) {
+    return HSCROLL;
+  }
+  else if (memcmp(lpszClassName, _T("COMBOBOX"), 8) == 0) {
+    return COMBOBOX;
+  }
+  else if (memcmp(lpszClassName, _T("msctls_updown32"), 15) == 0) {
+    return SPIN;
+  }
+  else if (memcmp(lpszClassName, _T("msctls_progress32"), 17) == 0) {
+    return PROGRES;
+  }
+  else if (memcmp(lpszClassName, _T("msctls_trackbar32"), 17) == 0) {
+    return SLIDER;
+  }
+  else if (memcmp(lpszClassName, _T("msctls_hotkey32"), 15) == 0) {
+    return HOTKEY;
+  }
+  else if (memcmp(lpszClassName, _T("SysListView32"), 13) == 0) {
+    return LISTCTRL;
+  }
+  else if (memcmp(lpszClassName, _T("SysTreeView32"), 13) == 0) {
+    return TREECTRL;
+  }
+  else if (memcmp(lpszClassName, _T("SysTabControl32"), 15) == 0) {
+    return TABCTRL;
+  }
+  else if (memcmp(lpszClassName, _T("SysAnimate32"), 12) == 0) {
+    return ANIMATE;
+  }
+  else if (memcmp(lpszClassName, _T("RICHEDIT"), 8) == 0) {
+    return RICHEDIT;
+  }
+  else if (memcmp(lpszClassName, _T("SysDateTimePick32"), 17) == 0) {
+    return DATETIMEPICKER;
+  }
+  else if (memcmp(lpszClassName, _T("SysMonthCal32"), 13) == 0) {
+    return MONTHCALENDER;
+  }
+  else if (memcmp(lpszClassName, _T("SysIPAddress32"), 14) == 0) {
+    return IPADRESS;
+  }
+  else if (memcmp(lpszClassName, _T("ComboBoxEx32"), 12) == 0) {
+    return COMBOBOXEX;
+  }
+
+  return NOCONTROL;
+}
+
+UINT CDynDialogItemEx::InitDialogItem(DLGITEMTEMPLATECONTROLS TypeControl,
+                                      DWORD dwStyle,
+                                      DWORD dwExtendedStyle,
+                                      LPRECT pRect,
+                                      LPCTSTR lpszCaption,
+                                      UINT nID /*= 0*/,
+                                      BOOL bSubclassed /*= FALSE*/,
+                                      void	*pData /*= NULL*/)
+{
+  m_eTypeControl = TypeControl;
+  m_strClassName = GetClassNameByType(m_eTypeControl);
+  m_dwStyle = dwStyle;
+  m_dwStyleEx = dwExtendedStyle;
+  m_Rect = pRect;
+  m_strCaption = lpszCaption;
+  m_bSubclassed = bSubclassed;
+  m_pData = pData;
+  if (nID == 0) {
+    m_ControlID = ::GetNewUniqueID();
+  }
+  else {
+    m_ControlID = nID;
+  }
+  return m_ControlID;
+}
+
+UINT CDynDialogItemEx::InitDialogItem(LPCSTR lpszClassName,
+                                      DWORD dwStyle,
+                                      DWORD dwExtendedStyle,
+                                      LPRECT pRect,
+                                      LPCTSTR lpszCaption,
+                                      UINT nID /*= 0*/,
+                                      BOOL bSubclassed /*= FALSE*/,
+                                      void	*pData /*= NULL*/)
+{
+  m_strClassName = lpszClassName;
+  m_eTypeControl = GetClassTypeByName(lpszClassName);
+  m_dwStyle = dwStyle;
+  m_dwStyleEx = dwExtendedStyle;
+  m_Rect = pRect;
+  m_strCaption = lpszCaption;
+  m_bSubclassed = bSubclassed;
+  m_pData = pData;
+  if (nID == 0) {
+    m_ControlID = ::GetNewUniqueID();
+  }
+  else {
+    m_ControlID = nID;
+  }
+  return m_ControlID;
+}
+
+BOOL CDynDialogItemEx::CreateEx(CWnd *pParent)
+{
+	BOOL bRet = FALSE;
+	if (m_eTypeControl == NOCONTROL) { //It will probably be an OCX...
+		//
+		// Create the control later....
+		// if it's created here then the rectangle is not OK and SetWindowPos doesn't work on OCX's????
+		//
+		bRet = TRUE;
+	}
+	else if (m_pData != NULL && IsDataMemberPointerToWnd()) {
+		bRet = ((CWnd*)m_pData)->CreateEx(m_dwStyleEx, m_strClassName, m_strCaption, m_dwStyle, m_Rect, pParent, m_ControlID);
+	}
+	else  {
+		bRet = CWnd::CreateEx(m_dwStyleEx, m_strClassName, m_strCaption, m_dwStyle, m_Rect, pParent, m_ControlID);
+	}
+
+	return bRet;
+}
+
+BOOL CDynDialogItemEx::SetWindowPos(CWnd *pParent)
+{
+	BOOL bRet = FALSE;
+	//Conversion of Dialog units to screenunits
+	CRect rect(m_Rect);
+	((CDialog *)pParent)->MapDialogRect(&rect);
+	ASSERT(rect.IsRectEmpty() == FALSE);
+
+	if (m_eTypeControl == NOCONTROL) {
+		BSTR bstrLicKey = GetRuntimeLicense(m_strClassName);
+		bRet = CreateControl(m_strClassName, m_strCaption, m_dwStyle, rect, pParent, m_ControlID, NULL, FALSE, bstrLicKey);
+		if (bstrLicKey != NULL) {
+			::SysFreeString(bstrLicKey);
+		}
+	}
+	else if (m_pData != NULL && IsDataMemberPointerToWnd()) {
+		bRet = ((CWnd*)m_pData)->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
+	}
+	else {
+		bRet = CWnd::SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
+	}
+
+	return bRet;
+}
+
+void CDynDialogItemEx::SetFont(CFont* pFont, BOOL bRedraw /*= TRUE*/)
+{
+	if (m_pData != NULL && IsDataMemberPointerToWnd()) {
+		((CWnd*)m_pData)->SetFont(pFont, bRedraw);
+	}
+	else {
+		CWnd::SetFont(pFont, bRedraw);
+	}
+}
+
+PBYTE CDynDialogItemEx::FillBufferWithItemTemplate(BYTE *pdest)
+{
+	pdest = (BYTE*)(((DWORD)pdest + 3) & ~3);  // make the pointer DWORD aligned
+
+	DLGITEMTEMPLATE dlgItemTemplate;
+	dlgItemTemplate.x = (short)m_Rect.left;
+	dlgItemTemplate.y = (short)m_Rect.top;
+	dlgItemTemplate.cx = (short)m_Rect.Width();
+	dlgItemTemplate.cy = (short)m_Rect.Height();
+	dlgItemTemplate.style = m_dwStyle;
+	dlgItemTemplate.dwExtendedStyle = m_dwStyleEx;
+	dlgItemTemplate.id = (USHORT)m_ControlID;
+
+	memcpy(pdest, (void *)&dlgItemTemplate, sizeof(DLGITEMTEMPLATE));
+	pdest += sizeof(DLGITEMTEMPLATE);
+	*(WORD*)pdest = 0xFFFF;  // indicating atom value
+	pdest += sizeof(WORD);
+	*(WORD*)pdest = (USHORT)m_eTypeControl;    // atom value for the control
+	pdest += sizeof(WORD);
+
+	// transfer the caption even when it is an empty string
+	WCHAR*  pchCaption;
+	int nChars = m_strCaption.GetLength() + 1;
+	pchCaption = new WCHAR[nChars];
+	
+	//int nActualChars = MultiByteToWideChar(CP_ACP, 0, m_strCaption, -1, pchCaption, nChars);
+	//ASSERT(nActualChars > 0);
+	//memcpy(pdest, pchCaption, nActualChars * sizeof(WCHAR));
+	int nActualChars = m_strCaption.GetLength();
+	memcpy(pdest, m_strCaption, nActualChars * sizeof(WCHAR));
+
+	pdest += nActualChars * sizeof(WCHAR);
+	delete pchCaption;
+
+	*(WORD*)pdest = 0;  // How many bytes in data for control
+	pdest += sizeof(WORD);
+
+	return pdest;
+}
+
+BSTR CDynDialogItemEx::GetRuntimeLicense(CString &strControlName)
+{
+	BSTR bstrLicKey = NULL;
+	int i = 0;
+	while (RuntimeLicenses[i].lpszRegisteredControlName != NULL) 
+	{
+		if (strControlName.Compare(RuntimeLicenses[i].lpszRegisteredControlName) == 0) 
+		{
+			bstrLicKey = ::SysAllocStringLen(RuntimeLicenses[i].wchLicenseKey, RuntimeLicenses[i].lLicenseLength/sizeof(WCHAR));
+			break;
+		}
+		i++;
+	}
+	return bstrLicKey;
+}
+
+BOOL CDynDialogItemEx::IsDataMemberPointerToWnd()
+{
+	BOOL bRet = TRUE;
+	switch(m_eTypeControl)
+	{
+	case BUTTON:
+		if ((m_dwStyle & BS_AUTORADIOBUTTON) == BS_AUTORADIOBUTTON) {
+			bRet = FALSE;
+		}
+		else if ((m_dwStyle & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX) {
+			bRet = FALSE;
+		}
+		break;
+	case EDITCONTROL:
+		bRet = FALSE;
+		break;
+	case STATICTEXT:
+		bRet = FALSE;
+		break;
+	case HSCROLL:
+		bRet = FALSE;
+		break;
+	case SLIDER:
+		bRet = FALSE;
+		break;
+	case DATETIMEPICKER:
+		bRet = FALSE;
+		break;
+	case MONTHCALENDER:
+		bRet = FALSE;
+		break;
+	default:
+		break;
+	}
+	return bRet;
+}
diff --git a/Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.h b/Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.h
new file mode 100644
index 0000000..ac88b93
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/DynDialogItemEx.h
@@ -0,0 +1,103 @@
+#pragma once
+
+
+// CDynDialogItemEx
+
+typedef enum {
+	NOCONTROL		= 0,
+	BUTTON			= 0x0080,
+	EDITCONTROL		= 0x0081,
+	STATICTEXT		= 0x0082,
+	LISTBOX			= 0x0083,
+	HSCROLL			= 0x0084,
+	COMBOBOX		= 0x0085,
+	SPIN,
+	PROGRES,
+	SLIDER,
+	HOTKEY,
+	LISTCTRL,
+	TREECTRL,
+	TABCTRL,
+	ANIMATE,
+	RICHEDIT,
+	DATETIMEPICKER,
+	MONTHCALENDER,
+	IPADRESS,
+	COMBOBOXEX
+} DLGITEMTEMPLATECONTROLS;
+
+class CDynDialogItemEx : public CWnd
+{
+public:
+	// Construction
+	CDynDialogItemEx();
+	// Operations
+
+public:
+	UINT InitDialogItem(DLGITEMTEMPLATECONTROLS TypeControl,
+		DWORD dwStyle,
+		DWORD dwExtendedStyle,
+		LPRECT pRect,
+		LPCTSTR lpszCaption, 
+		UINT nID = 0,
+		BOOL bSubclassed = FALSE,
+		void	*pData = NULL);
+
+	UINT InitDialogItem(LPCSTR lpszClassName,
+		DWORD dwStyle,
+		DWORD dwExtendedStyle,
+		LPRECT pRect,
+		LPCTSTR lpszCaption, 
+		UINT nID = 0,
+		BOOL bSubclassed = FALSE,
+		void	*pData = NULL);
+
+	BOOL CreateEx(CWnd *pParent);
+	void SetFont(CFont* pFont, BOOL bRedraw = TRUE);
+
+	// Operations
+public:
+	virtual void DoDataExchange(CDataExchange* pDX);
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CDynDialogItemEx)
+	//}}AFX_VIRTUAL
+
+	// Implementation
+public:
+	//virtual ~CDynDialogItemEx();
+	BOOL SetWindowPos(CWnd *pParent);
+	PBYTE FillBufferWithItemTemplate(BYTE* pdest);
+
+	UINT GetControlID()								{return m_ControlID;}
+	DLGITEMTEMPLATECONTROLS GetControlType()	{return m_eTypeControl;}
+	long GetCaptionLength()							{return m_strCaption.GetLength();}
+	BOOL IsDlgItemSubclassed()						{return m_bSubclassed;}
+	CString GetClassName()							{return m_strClassName;}		
+
+protected:
+	DLGITEMTEMPLATECONTROLS GetClassTypeByName(LPCSTR lpszClassName);
+
+	CString						m_strClassName;
+	DLGITEMTEMPLATECONTROLS	m_eTypeControl;
+	UINT							m_ControlID;
+	UINT							m_dwStyle;
+	UINT							m_dwStyleEx;
+	CRect							m_Rect;
+	CString						m_strCaption;
+	void							*m_pData;
+	BOOL							m_bSubclassed;
+
+	// Generated message map functions
+
+protected:
+	BOOL IsDataMemberPointerToWnd();
+	BSTR GetRuntimeLicense(CString &strControlName);
+	CString GetClassNameByType(DLGITEMTEMPLATECONTROLS TypeControl);
+
+	//{{AFX_MSG(CDynDialogItemEx)
+	// NOTE - the ClassWizard will add and remove member functions here.
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+};
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGrid.cpp b/Common_Class/SISControls/PropertyGridControl/PropertyGrid.cpp
new file mode 100644
index 0000000..ff1739d
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGrid.cpp
@@ -0,0 +1,2349 @@
+// PropertyGrid.cpp : 备泅 颇老涝聪促.
+//
+
+#include "../stdafx.h"
+#include "PropertyGrid.h"
+#include "CustomItem.h"
+#include "PropertyGridDirectoryPicker.h"
+#include "PropertyGridMonthCalCtrl.h"
+#include "DynDialogEx.h"
+#include <algorithm>
+#include <shlwapi.h>
+
+#define IDC_MONTHCAL 1023
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+static const int margin = 2;
+
+// CPropertyGrid
+
+IMPLEMENT_DYNAMIC(CPropertyGrid, CWnd)
+
+CPropertyGrid::CPropertyGrid()
+{
+	m_section_id = 0;
+	m_item_id = 0;
+	m_resizing_gutter = false;
+	m_button_pushed = false;
+	m_button_depressed = false;
+	m_value_clicked = false;
+	m_custom_tracking = false;
+	m_scroll_enabled = false;
+	m_draw_lines = true;
+	m_shade_titles = true;
+	m_draw_gutter = true;
+	m_focus_disabled = true;
+	m_bold_modified = false;
+	m_bold_editables = false;
+	m_display_mode = DM_CATEGORIZED;
+	m_control = NULL;
+
+	m_rect_button = CRect(0,0,0,0);
+	m_ptLast = CPoint(0,0);
+
+	m_strTrue = "True";
+	m_strFalse = "False";
+	m_strDate = "Date";
+	m_strTime = "Time";
+	m_strUndefined = "";
+	m_strEmpty = "";
+
+	m_clrBack = GetSysColor(COLOR_WINDOW);
+	m_clrShade = GetSysColor(COLOR_3DFACE);
+	m_clrText = GetSysColor(COLOR_WINDOWTEXT);
+	m_clrTitle = GetSysColor(COLOR_WINDOWTEXT);
+	m_clrFocus = GetSysColor(COLOR_HIGHLIGHT);
+	m_clrHilite = GetSysColor(COLOR_HIGHLIGHTTEXT);
+	m_clrEditable = GetSysColor(COLOR_WINDOWTEXT);
+	m_clrDisabled = GetSysColor(COLOR_GRAYTEXT);
+	m_clrItemLine = GetSysColor(COLOR_3DFACE);
+
+	m_focused_section = -1;
+	m_focused_item = -1;
+}
+
+CPropertyGrid::~CPropertyGrid()
+{
+}
+
+//
+// customization
+//
+
+bool CPropertyGrid::GetShadeTitles()
+{
+  return m_shade_titles;
+}
+
+void CPropertyGrid::SetShadeTitles(bool shade_titles)
+{
+  m_shade_titles = shade_titles;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+bool CPropertyGrid::GetDrawLines()
+{
+  return m_draw_lines;
+}
+
+void CPropertyGrid::SetDrawLines(bool draw_lines)
+{
+  m_draw_lines = draw_lines;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+bool CPropertyGrid::GetDrawGutter()
+{
+  return m_draw_gutter;
+}
+
+void CPropertyGrid::SetDrawGutter(bool draw_gutter)
+{
+  m_draw_gutter = draw_gutter;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+bool CPropertyGrid::GetFocusDisabled()
+{
+  return m_focus_disabled;
+}
+
+void CPropertyGrid::SetFocusDisabled(bool focus_disabled)
+{
+  m_focus_disabled = focus_disabled;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+bool CPropertyGrid::GetBoldModified()
+{
+  return m_bold_modified;
+}
+
+void CPropertyGrid::SetBoldModified(bool bold_modified)
+{
+  m_bold_modified = bold_modified;
+}
+
+bool CPropertyGrid::GetBoldEditables()
+{
+  return m_bold_editables;
+}
+
+void CPropertyGrid::SetBoldEditables(bool bold_editables)
+{
+  m_bold_editables = bold_editables;
+}
+
+//
+// gutter width
+//
+
+int CPropertyGrid::GetGutterWidth()
+{
+  return m_gutter_width;
+}
+
+void CPropertyGrid::SetGutterWidth(int gutter_width)
+{
+  m_gutter_width = gutter_width;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+//
+// custom colors
+//
+
+void CPropertyGrid::SetTextColor(COLORREF clrText)
+{
+  if (m_clrText == m_clrEditable)
+    m_clrEditable = clrText;
+  m_clrText = clrText;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+void CPropertyGrid::SetTitleColor(COLORREF clrTitle)
+{
+  m_clrTitle = clrTitle;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+void CPropertyGrid::SetBackColor(COLORREF clrBack)
+{
+  m_clrBack = clrBack;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+void CPropertyGrid::SetShadeColor(COLORREF clrShade)
+{
+  m_clrShade = clrShade;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+void CPropertyGrid::SetFocusColor(COLORREF clrFocus)
+{
+  m_clrFocus = clrFocus;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+void CPropertyGrid::SetHiliteColor(COLORREF clrHilite)
+{
+  m_clrHilite = clrHilite;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+void CPropertyGrid::SetEditableColor(COLORREF clrEditable)
+{
+  m_clrEditable = clrEditable;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+void CPropertyGrid::SetDisabledColor(COLORREF clrDisabled)
+{
+  m_clrDisabled = clrDisabled;
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+//
+// localization
+//
+
+void CPropertyGrid::SetTrueFalseStrings(CString strTrue, CString strFalse)
+{
+  m_strTrue = strTrue;
+  m_strFalse = strFalse;
+}
+
+void CPropertyGrid::SetOkCancelStrings(CString strOk, CString strCancel)
+{
+  m_strOk = strOk;
+  m_strCancel = strCancel;
+}
+
+void CPropertyGrid::SetDateTimeStrings(CString strDate, CString strTime)
+{
+  m_strDate = strDate;
+  m_strTime = strTime;
+}
+
+void CPropertyGrid::SetUndefinedString(CString strUndefined)
+{
+  m_strUndefined = strUndefined;
+}
+
+void CPropertyGrid::SetEmptyString(CString strEmpty)
+{
+  m_strEmpty = strEmpty;
+}
+
+//
+// appearance
+//
+
+void CPropertyGrid::SetDisplayMode(EDisplayMode display_mode)
+{
+  m_display_mode = display_mode;
+  RecalcLayout();
+}
+
+void CPropertyGrid::ExpandAll(bool expand)
+{
+  for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+    it->m_collapsed = !expand;
+  RecalcLayout();
+}
+
+void CPropertyGrid::ExpandSection(HSECTION hs, bool expand)
+{
+  CSection* pSection = FindSection(hs);
+  if (pSection)
+  {
+    pSection->m_collapsed = !expand;
+    RecalcLayout();
+  }
+}
+
+bool CPropertyGrid::IsSectionCollapsed(HSECTION hs)
+{
+  CSection* pSection = FindSection(hs);
+  if (pSection)
+    return pSection->m_collapsed;
+  return false;
+}
+
+//
+// item management
+//
+
+bool CPropertyGrid::CItem::operator==(const HITEM& item) const
+{
+  return m_id == item;
+}
+
+bool CPropertyGrid::CItem::operator==(const CString& name) const
+{
+  return m_name == name;
+}
+
+bool CPropertyGrid::CSection::operator==(const HSECTION& section) const
+{
+  return m_id == section;
+}
+
+void CPropertyGrid::CItem::ValidateChanges()
+{
+  // save the values
+  m_undefined_old = m_undefined;
+  m_nValue_old = m_nValue;              
+  m_dValue_old = m_dValue;
+  m_strValue_old = m_strValue;
+  m_bValue_old = m_bValue;
+  m_dtValue_old = m_dtValue;
+  m_clrValue_old = m_clrValue;
+  memcpy(&m_lfValue_old, &m_lfValue, sizeof(LOGFONT));
+
+  // callback for custom
+  if (m_type == IT_CUSTOM)
+    m_pCustom->ValidateChanges();
+}
+
+HSECTION CPropertyGrid::AddSection(CString title, bool collapsed, HSECTION after)
+{
+  // build it
+  CSection section;
+  section.m_id = m_section_id;
+  section.m_title = title;
+  section.m_collapsed = collapsed;
+
+  // insert it
+  // if after does not exist then it is appended
+  std::vector<CSection>::iterator it = find(m_sections.begin(), m_sections.end(), after);
+  m_sections.insert(it, section);
+
+  // done
+  RecalcLayout();
+  return m_section_id++;
+}
+
+HITEM CPropertyGrid::AddItem(HSECTION hs, EItemType type, CString name, void* pValue, bool editable, bool undefined, HITEM after)
+{
+  // check section exists
+  std::vector<CSection>::iterator it = find(m_sections.begin(), m_sections.end(), hs);
+  if (it == m_sections.end())
+    return -1;
+
+  // check item does not already exists
+  std::vector<CItem>::iterator it2 = find(it->m_items.begin(), it->m_items.end(), name);
+  if (it2 != it->m_items.end())
+    return -1;
+
+  // build the item
+  CItem item;
+  item.m_id = m_item_id++;
+  item.m_type = type;
+  item.m_name = name;
+  item.m_editable = editable;
+  item.m_undefined = undefined;
+
+  // assign the value
+  if (type == IT_CUSTOM) item.m_pCustom = (ICustomItem*)pValue;
+  else if (type == IT_STRING || type == IT_TEXT || type == IT_FILE || type == IT_FOLDER) item.m_strValue = *(CString*)pValue;
+  else if (type == IT_COMBO || type == IT_INTEGER) item.m_nValue = *(int*)pValue;
+  else if (type == IT_DOUBLE) item.m_dValue = *(double*)pValue;
+  else if (type == IT_BOOLEAN) item.m_bValue = *(bool*)pValue;
+  else if (type == IT_DATE || type == IT_DATETIME) item.m_dtValue = *(COleDateTime*)pValue;
+  else if (type == IT_COLOR) item.m_clrValue = *(COLORREF*)pValue;
+  else if (type == IT_FONT) memcpy(&item.m_lfValue, pValue, sizeof(LOGFONT));
+  else ASSERT(false);
+
+  // finish and add
+  item.ValidateChanges();
+  it->m_items.push_back(item);
+  RecalcLayout();
+  return item.m_id;
+}
+
+HITEM CPropertyGrid::AddCustomItem(HSECTION section, CString name, ICustomItem* pItem, bool editable, HITEM after)
+{
+  pItem->m_pGrid = this;
+  return AddItem(section, IT_CUSTOM, name, pItem, editable, false, after);
+}
+
+HITEM CPropertyGrid::AddStringItem(HSECTION section, CString name, CString value, bool editable, HITEM after)
+{
+  return AddItem(section, IT_STRING, name, &value, editable, false, after);
+}
+
+HITEM CPropertyGrid::AddTextItem(HSECTION section, CString name, CString value, bool editable, HITEM after)
+{
+  return AddItem(section, IT_TEXT, name, &value, editable, false, after);
+}
+
+HITEM CPropertyGrid::AddIntegerItem(HSECTION section, CString name, int value, CString format, bool editable, bool undefined, HITEM after)
+{
+  HITEM it = AddItem(section, IT_INTEGER, name, &value, editable, undefined, after);
+  CItem* pItem = FindItem(it);
+  if (pItem) pItem->m_options.push_back(format);
+  return it;
+}
+
+HITEM CPropertyGrid::AddDoubleItem(HSECTION section, CString name, double value, CString format, bool editable, bool undefined, HITEM after)
+{
+  HITEM it = AddItem(section, IT_DOUBLE, name, &value, editable, undefined, after);
+  CItem* pItem = FindItem(it);
+  if (pItem) pItem->m_options.push_back(format);
+  return it;
+}
+
+HITEM CPropertyGrid::AddComboItem(HSECTION section, CString name, const std::vector<CString>& values, int cur, bool editable, bool undefined, HITEM after)
+{
+  HITEM it = AddItem(section, IT_COMBO, name, &cur, editable, undefined, after);
+  CItem* pItem = FindItem(it);
+  if (pItem) pItem->m_options = values;
+  return it;
+}
+
+HITEM CPropertyGrid::AddBoolItem(HSECTION section, CString name, bool value, bool editable, bool undefined, HITEM after)
+{
+  return AddItem(section, IT_BOOLEAN, name, &value, editable, undefined, after);
+}
+
+HITEM CPropertyGrid::AddDateItem(HSECTION section, CString name, COleDateTime value, CString format, bool editable, bool undefined, HITEM after)
+{
+  HITEM it = AddItem(section, IT_DATE, name, &value, editable, undefined, after);
+  CItem* pItem = FindItem(it);
+  if (pItem) pItem->m_options.push_back(format);
+  return it;
+}
+
+HITEM CPropertyGrid::AddDateTimeItem(HSECTION section, CString name, COleDateTime value, CString format, bool editable, bool undefined, HITEM after)
+{
+  HITEM it = AddItem(section, IT_DATETIME, name, &value, editable, undefined, after);
+  CItem* pItem = FindItem(it);
+  if (pItem) pItem->m_options.push_back(format);
+  return it;
+}
+
+HITEM CPropertyGrid::AddFileItem(HSECTION section, CString name, CString value, CString filter, bool editable, HITEM after)
+{
+  HITEM it = AddItem(section, IT_FILE, name, &value, editable, false, after);
+  CItem* pItem = FindItem(it);
+  if (pItem) pItem->m_options.push_back(filter);
+  return it;
+}
+
+HITEM CPropertyGrid::AddFolderItem(HSECTION section, CString name, CString value, CString title, bool editable, HITEM after)
+{
+  HITEM it = AddItem(section, IT_FOLDER, name, &value, editable, false, after);
+  CItem* pItem = FindItem(it);
+  if (pItem) pItem->m_options.push_back(title);
+  return it;
+}
+
+HITEM CPropertyGrid::AddColorItem(HSECTION section, CString name, COLORREF value, bool editable, bool undefined, HITEM after)
+{
+  return AddItem(section, IT_COLOR, name, &value, editable, undefined, after);
+}
+
+HITEM CPropertyGrid::AddFontItem(HSECTION section, CString name, LOGFONT value, bool editable, bool undefined, HITEM after)
+{
+  return AddItem(section, IT_FONT, name, &value, editable, undefined, after);
+}
+
+void CPropertyGrid::ResetContents()
+{
+  m_sections.clear();
+  m_section_id = 0;
+  m_item_id = 0;
+  RecalcLayout();
+}
+
+bool CPropertyGrid::RemoveSection(HSECTION hs)
+{
+  std::vector<CSection>::iterator it = find(m_sections.begin(), m_sections.end(), hs);
+  if (it == m_sections.end()) return false;
+  m_sections.erase(it);
+  return true;
+}
+
+bool CPropertyGrid::RemoveItem(HITEM item)
+{
+  for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+  {
+    std::vector<CItem>::iterator it2 = find(it->m_items.begin(), it->m_items.end(), item);
+    if (it2 != it->m_items.end())
+    {
+      it->m_items.erase(it2);
+      return true;
+    }
+  }
+  return false;
+}
+
+int CPropertyGrid::GetNumSections()
+{
+  return int(m_sections.size());
+}
+
+int CPropertyGrid::GetSectionSize(HSECTION hs)
+{
+  CSection* pSection = FindSection(hs);
+  if (pSection) return int(pSection->m_items.size());
+  return 0;
+}
+
+void CPropertyGrid::ValidateChanges()
+{
+  for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+  {
+    for (std::vector<CItem>::iterator it2 = it->m_items.begin(); it2 != it->m_items.end(); ++it2)
+      it2->ValidateChanges();
+  }
+}
+
+CPropertyGrid::CSection* CPropertyGrid::FindSection(HSECTION hs) const
+{
+  std::vector<CSection>::const_iterator it = find(m_sections.begin(), m_sections.end(), hs);
+  if (it == m_sections.end()) return NULL;
+  return const_cast<CSection*>(&(*it));
+}
+
+CPropertyGrid::CItem* CPropertyGrid::FindItem(HITEM hi) const
+{
+  for (std::vector<CSection>::const_iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+  {
+    std::vector<CItem>::const_iterator it2 = find(it->m_items.begin(), it->m_items.end(), hi);
+    if (it2 != it->m_items.end())
+      return const_cast<CItem*>(&(*it2));
+  }
+  return NULL;
+}
+
+bool CPropertyGrid::GetItemValue(HITEM item, CString& strValue) const
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+  if (pItem->m_undefined) return false;
+
+  // check
+  if (pItem->m_type == IT_STRING || pItem->m_type == IT_TEXT || pItem->m_type == IT_FILE || pItem->m_type == IT_FOLDER)
+  {
+    strValue = pItem->m_strValue;
+    return true;
+  }
+  else if (pItem->m_type == IT_COMBO)
+  {
+    if (pItem->m_nValue < 0 || pItem->m_nValue > int(pItem->m_options.size())-1) return false;
+    strValue = pItem->m_options[pItem->m_nValue];
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::GetItemValue(HITEM item, int& nValue) const
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+  if (pItem->m_undefined) return false;
+
+  // check
+  if (pItem->m_type == IT_COMBO || pItem->m_type == IT_INTEGER)
+  {
+    nValue = pItem->m_nValue;
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::GetItemValue(HITEM item, double& dValue) const
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+  if (pItem->m_undefined) return false;
+
+  // check
+  if (pItem->m_type == IT_DOUBLE)
+  {
+    dValue = pItem->m_dValue;
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::GetItemValue(HITEM item, bool& bValue) const
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+  if (pItem->m_undefined) return false;
+
+  // check
+  if (pItem->m_type == IT_BOOLEAN)
+  {
+    bValue = pItem->m_bValue;
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::GetItemValue(HITEM item, COleDateTime& dtValue) const
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+  if (pItem->m_undefined) return false;
+
+  // check
+  if (pItem->m_type == IT_DATE || pItem->m_type == IT_DATETIME)
+  {
+    dtValue = pItem->m_dtValue;
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::GetItemValue(HITEM item, COLORREF& clrValue) const
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+  if (pItem->m_undefined) return false;
+
+  // check
+  if (pItem->m_type == IT_COLOR)
+  {
+    clrValue = pItem->m_clrValue;
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::GetItemValue(HITEM item, LOGFONT& lfValue) const
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+  if (pItem->m_undefined) return false;
+
+  // check
+  if (pItem->m_type == IT_FONT)
+  {
+    lfValue = pItem->m_lfValue;
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::SetItemValue(HITEM item, const CString strValue)
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+
+  // check
+  if (pItem->m_type == IT_STRING || pItem->m_type == IT_TEXT || pItem->m_type == IT_FILE || pItem->m_type == IT_FOLDER)
+  {
+    pItem->m_strValue = strValue;
+    pItem->m_undefined = false;
+    Invalidate();
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::SetItemValue(HITEM item, const int nValue)
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+
+  // check
+  if (pItem->m_type == IT_COMBO || pItem->m_type == IT_INTEGER)
+  {
+    pItem->m_nValue = nValue;
+    pItem->m_undefined = false;
+    Invalidate();
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::SetItemValue(HITEM item, const double dValue)
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+
+  // check
+  if (pItem->m_type == IT_DOUBLE)
+  {
+    pItem->m_dValue = dValue;
+    pItem->m_undefined = false;
+    Invalidate();
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::SetItemValue(HITEM item, const bool bValue)
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+
+  // check
+  if (pItem->m_type == IT_BOOLEAN)
+  {
+    pItem->m_bValue = bValue;
+    pItem->m_undefined = false;
+    Invalidate();
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::SetItemValue(HITEM item, const COleDateTime dtValue)
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+
+  // check
+  if (pItem->m_type == IT_DATE || pItem->m_type == IT_DATETIME)
+  {
+    pItem->m_dtValue = dtValue;
+    pItem->m_undefined = false;
+    Invalidate();
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::SetItemValue(HITEM item, const COLORREF clrValue)
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+
+  // check
+  if (pItem->m_type == IT_COLOR)
+  {
+    pItem->m_clrValue = clrValue;
+    pItem->m_undefined = false;
+    Invalidate();
+    return true;
+  }
+  return false;
+}
+
+bool CPropertyGrid::SetItemValue(HITEM item, const LOGFONT lfValue)
+{
+  // get the item
+  CItem* pItem = FindItem(item);
+  if (pItem == NULL) return false;
+
+  // check
+  if (pItem->m_type == IT_FONT)
+  {
+    memcpy(&pItem->m_lfValue, &lfValue, sizeof(LOGFONT));
+    pItem->m_undefined = false;
+    Invalidate();
+    return true;
+  }
+  return false;
+}
+
+int CPropertyGrid::GetTextMargin()
+{
+  return 2*margin;
+}
+
+CFont* CPropertyGrid::GetFontNormal()
+{
+  return &m_fntNormal;
+}
+
+CFont* CPropertyGrid::GetFontBold()
+{
+  return &m_fntBold;
+}
+
+
+BEGIN_MESSAGE_MAP(CPropertyGrid, CWnd)
+	ON_WM_PAINT()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_MOUSEMOVE()
+	ON_WM_CREATE()
+	ON_WM_LBUTTONUP()
+	ON_WM_VSCROLL()
+	ON_WM_ERASEBKGND()
+	ON_MESSAGE(WM_PG_COMBOSELCHANGED, OnComboSelChanged)
+	ON_MESSAGE(WM_PG_ENDLABELEDIT, OnEditChanged)
+	ON_MESSAGE(WM_PG_DATESELCHANGED, OnDateChanged)
+	ON_WM_LBUTTONDBLCLK()
+	ON_WM_MOUSEWHEEL()
+	ON_WM_DESTROY()
+	ON_WM_SIZE()
+	ON_WM_GETDLGCODE()
+	ON_WM_CHAR()
+	ON_WM_KEYDOWN()
+END_MESSAGE_MAP()
+
+
+
+// CPropertyGrid 皋矫瘤 贸府扁涝聪促
+
+void CPropertyGrid::InitControl()
+{
+  // first gutter
+  CRect rc;
+  GetClientRect(&rc);
+  m_gutter_width = rc.Width()/2;
+
+  // check if already done
+  if (m_fntNormal.GetSafeHandle() == NULL)
+  {
+    // fonts
+    LOGFONT lf;
+    if (GetParent() && GetParent()->GetFont())
+    {
+      CFont* pFont = GetParent()->GetFont();
+      pFont->GetLogFont(&lf);
+      m_fntNormal.CreateFontIndirect(&lf);
+      lf.lfWeight = FW_BOLD;
+      m_fntBold.CreateFontIndirect(&lf);
+    }
+    else
+    {
+      m_fntNormal.CreatePointFont(85, _T("Tahoma"));
+      m_fntNormal.GetLogFont(&lf);
+      lf.lfWeight = FW_BOLD;
+      m_fntBold.CreateFontIndirect(&lf);
+    }
+  }
+
+  // get line height
+  CDC* pDC = GetDC();
+  CFont* pOldFont = pDC->SelectObject(&m_fntNormal);
+  m_line_height = pDC->GetTextExtent(_T("Gg")).cy + 2*margin;
+  pDC->SelectObject(pOldFont);
+  ReleaseDC(pDC);
+
+  // styles
+  ModifyStyle(0, WS_CLIPCHILDREN);
+
+  // try to get some strings
+  if (m_strOk.IsEmpty())
+  {
+    m_strOk = "OK";
+    if (GetParent() && GetParent()->GetDlgItem(IDOK))
+    {
+      CString strOk;
+      GetParent()->GetDlgItem(IDOK)->GetWindowText(strOk);
+      m_strOk = strOk;
+    }
+  }
+  if (m_strCancel.IsEmpty())
+  {
+    m_strCancel = "Cancel";
+    if (GetParent() && GetParent()->GetDlgItem(IDCANCEL))
+    {
+      CString strCancel;
+      GetParent()->GetDlgItem(IDCANCEL)->GetWindowText(strCancel);
+      m_strCancel = strCancel;
+    }
+  }
+}
+
+int CPropertyGrid::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+  if (CWnd::OnCreate(lpCreateStruct) == -1) return -1;
+  InitControl();
+  return 0;
+}
+
+void CPropertyGrid::PreSubclassWindow()
+{
+  InitControl();
+  CWnd::PreSubclassWindow();
+}
+
+void CPropertyGrid::OnDestroy()
+{
+  DeleteEditControl();
+  CWnd::OnDestroy();
+}
+
+void CPropertyGrid::OnSize(UINT nType, int cx, int cy)
+{
+  CWnd::OnSize(nType, cx, cy);
+
+  if (m_scrollbar.GetSafeHwnd())
+  {
+    CRect rect;
+    GetClientRect(&rect);
+    m_scrollbar.MoveWindow(rect.right - GetSystemMetrics(SM_CXVSCROLL), rect.top, GetSystemMetrics(SM_CXVSCROLL), rect.Height());
+    RecalcLayout();
+  }
+}
+
+//
+// painting
+//
+
+BOOL CPropertyGrid::OnEraseBkgnd(CDC* pDC)
+{
+  return TRUE;
+}
+
+bool item_alpha_sort(std::vector<CPropertyGrid::CItem>::iterator it1, std::vector<CPropertyGrid::CItem>::iterator it2)
+{
+	return (it1->m_name.Compare(it2->m_name) < 0);
+}
+
+void CPropertyGrid::OnPaint()
+{
+  // stuff needed
+  const int sign_size = 8;
+
+  // the scrollbar offset
+  int top = GetScrollOffset();
+
+  // the rect
+  CRect rc_dummy;
+  GetClientRect(&rc_dummy);
+  if (m_scroll_enabled)
+    rc_dummy.right -= GetSystemMetrics(SM_CXVSCROLL);
+
+  // make sure we do not modify this one
+  // because we use it to bitblt
+  const CRect rc(rc_dummy);
+
+  // stuff for flicker free drawing
+  CDC dcMem;
+  CBitmap bmpMem;
+  CPaintDC dc(this);
+
+  // create and configure the memdc
+  dcMem.CreateCompatibleDC(&dc);
+  bmpMem.CreateCompatibleBitmap(&dc, rc.Width(), rc.Height());
+  CBitmap* pOldBmp = dcMem.SelectObject(&bmpMem);
+
+  // brush needed
+  CBrush brushTitle;
+  brushTitle.CreateSolidBrush(m_clrTitle);
+
+  // pen needed
+  //CPen penShade(PS_SOLID, 1, m_clrShade);
+  CPen penShade(PS_SOLID, 1, m_clrItemLine);
+  CPen penTitle(PS_SOLID, 1, m_clrTitle);
+
+  // to make sure we won't leak gdi resources
+  CBrush* pOldBrush = dcMem.SelectObject(&brushTitle);
+  CPen* pOldPen = dcMem.SelectObject(&penShade);
+  CFont* pOldFont = dcMem.SelectObject(&m_fntNormal);
+
+  // needed
+  int w = rc.Width();
+
+  // blank
+  dcMem.FillSolidRect(rc, m_clrBack);
+  dcMem.SetBkMode(TRANSPARENT);
+
+  // empty text
+  if (m_sections.empty())
+  {
+    CRect rect = rc;
+    rect.top += 10;
+    rect.DeflateRect(rect.Width()/4, 0);
+    dcMem.DrawText(m_strEmpty, rect, DT_CENTER|DT_WORDBREAK|DT_NOPREFIX);
+  }
+  else
+  {
+    // needed
+    int sign_left = margin;
+
+    // we start here
+    int y = -top;
+
+    // alphabetical needs special
+    if (m_display_mode == DM_ALPHABETICAL)
+    {
+      // put all the items in a vector
+      std::vector<std::vector<CItem>::iterator> lst;
+      for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+      {
+        for (std::vector<CItem>::iterator it2 = it->m_items.begin(); it2 != it->m_items.end(); ++it2)
+          lst.push_back(it2);
+      }
+
+      // sort the vector
+      sort(lst.begin(), lst.end(), item_alpha_sort);
+
+      // display the items
+      for (std::vector<std::vector<CItem>::iterator>::iterator it2 = lst.begin(); it2 != lst.end(); ++it2)
+      {
+        // first reset
+        (*it2)->m_rcName.SetRectEmpty();
+        (*it2)->m_rcValue.SetRectEmpty();
+
+        // draw if visible
+        (*it2)->m_rcName = CRect(0, y, w, y+m_line_height);
+        CRect rcInter = (*it2)->m_rcName;
+        rcInter.IntersectRect(rc, rcInter);
+        if (!rcInter.IsRectEmpty())
+          DrawItem(dcMem, w, sign_left+sign_size, y, *it2);
+
+        // next line
+        y += m_line_height;
+      }
+    }
+    else
+    {
+      // next iterate on sections
+      for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+      {
+        // reset
+        it->m_rcSign.SetRectEmpty();
+        it->m_rcTitle.SetRectEmpty();
+
+        // is visible?
+        it->m_rcTitle = CRect(0, y, w, y+m_line_height);
+        CRect rcInter = it->m_rcTitle;
+        rcInter.IntersectRect(rcInter, rc);
+        if (m_display_mode == DM_CATEGORIZED && !rcInter.IsRectEmpty())
+        {
+          // first shade rect
+          if (m_shade_titles)
+		  {
+            dcMem.FillSolidRect(0, y, w, m_line_height, m_clrShade);
+		  }
+
+          // now draw a separator lines
+          if (m_draw_lines)
+          {
+            dcMem.SelectObject(&penShade);
+            dcMem.MoveTo(0, y);
+            dcMem.LineTo(w+1, y);
+            dcMem.MoveTo(0, y+m_line_height);
+            dcMem.LineTo(w+1, y+m_line_height);
+          }
+
+          // now draw gutter
+          if (m_draw_gutter)
+          {
+            dcMem.SelectObject(&penShade);
+			//dcMem.SelectStockObject(BLACK_PEN);
+            dcMem.MoveTo(m_gutter_width, y);
+            dcMem.LineTo(m_gutter_width, y+m_line_height+1);
+          }
+
+          // now draw collapse sign
+          int sign_top = y+margin+2;
+          dcMem.SelectObject(&penTitle);
+		  //dcMem.SelectStockObject(BLACK_PEN);
+          it->m_rcSign = CRect(sign_left, sign_top, sign_left+sign_size+1, sign_top+sign_size+1);
+          dcMem.FrameRect(it->m_rcSign, &brushTitle);
+          dcMem.MoveTo(sign_left+2, sign_top+sign_size/2);
+          dcMem.LineTo(sign_left+2+sign_size/2+1, sign_top+sign_size/2);
+          if (it->m_collapsed)
+          {
+            dcMem.MoveTo(sign_left+sign_size/2, sign_top+2);
+            dcMem.LineTo(sign_left+sign_size/2, sign_top+2+sign_size/2+1);
+          }
+
+          // prepare draw text
+          int title_left = sign_left+sign_size+2*margin;
+          int title_top = y;
+          dcMem.SelectObject(&m_fntBold);
+          it->m_rcTitle = CRect(title_left, title_top, w, title_top+m_line_height);
+
+          // draw focus rect
+          if (m_focused_section == it->m_id)
+          {
+            CSize sz = dcMem.GetTextExtent(it->m_title);
+            int rect_left = title_left;
+            int rect_top = title_top+(m_line_height-sz.cy)/2;
+            int rect_width = sz.cx+3*margin;
+            int rect_height = sz.cy;
+            dcMem.DrawFocusRect(CRect(rect_left, rect_top, rect_left+rect_width, rect_top+rect_height));
+          }
+
+          // now draw text
+          dcMem.SetTextColor(m_clrTitle);
+          dcMem.DrawText(it->m_title, CRect(title_left+GetTextMargin(), title_top, w, title_top+m_line_height), DT_END_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX); 
+        }
+
+        // next line
+        if (m_display_mode == DM_CATEGORIZED)
+          y+=m_line_height;
+
+        // iterate on items
+        if (!it->m_collapsed || m_display_mode != DM_CATEGORIZED)
+        {
+          for (std::vector<CItem>::iterator it2 = it->m_items.begin(); it2 != it->m_items.end(); ++it2)
+          {
+            // reset
+            it2->m_rcName.SetRectEmpty();
+            it2->m_rcValue.SetRectEmpty();
+
+            // is visible?
+            it2->m_rcName = CRect(0, y, w, y+m_line_height);
+            CRect rcInter = it2->m_rcName;
+            rcInter.IntersectRect(rc, rcInter);
+            if (!rcInter.IsRectEmpty())
+              DrawItem(dcMem, w, sign_left+sign_size, y, it2);
+
+            // next line
+            y+=m_line_height;
+          }
+        }
+      }
+    }
+  }
+
+  // Blt the changes to the screen DC.
+  dc.BitBlt(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, &dcMem, 0, 0, SRCCOPY);
+
+  // Done with off-screen bitmap and DC.
+  dcMem.SelectObject(pOldBmp);
+  dcMem.SelectObject(pOldFont);
+  dcMem.SelectObject(pOldPen);
+  dcMem.SelectObject(pOldBrush);
+  bmpMem.DeleteObject();
+  dcMem.DeleteDC();
+
+  // Validate All
+  ValidateRgn(NULL);
+  ValidateRect(NULL);
+}
+
+void CPropertyGrid::DrawItem(CDC& dc, int w, int x, int y, std::vector<CItem>::iterator& it)
+{
+  // brush needed
+  CBrush brushText;
+  brushText.CreateSolidBrush(m_clrText);
+
+  // pen needed
+  //CPen penShade(PS_SOLID, 1, m_clrShade);
+  CPen penShade(PS_SOLID, 1, m_clrItemLine);
+
+  // to make sure we won't leak gdi resources
+  CBrush* pOldBrush = dc.SelectObject(&brushText);
+  CPen* pOldPen = dc.SelectObject(&penShade);
+  CFont* pOldFont = dc.SelectObject(&m_fntNormal);
+
+  // first shade rect
+  if (m_shade_titles)
+    dc.FillSolidRect(0, y, x+2*margin, m_line_height, m_clrShade);
+
+  // now draw a separator line
+  if (m_draw_lines)
+  {
+    dc.SelectObject(&penShade);
+	//dc.SelectStockObject(BLACK_PEN);
+    dc.MoveTo(0, y+m_line_height);
+    dc.LineTo(w+1, y+m_line_height);
+  }
+
+  // now draw gutter
+  if (m_draw_gutter)
+  {
+    dc.SelectObject(&penShade);
+	//dc.SelectStockObject(BLACK_PEN);
+    dc.MoveTo(m_gutter_width, y);
+    dc.LineTo(m_gutter_width, y+m_line_height+1);
+  }
+
+  // needed
+  int name_left = x+2*margin+GetTextMargin();
+  int name_right = m_gutter_width-1;
+  int value_left = m_gutter_width;
+  int value_right = w;
+
+  // is being edited?
+  if (m_focused_item == it->m_id && it->m_editable && GetEditMode(*it) != EM_CUSTOM)
+  {
+    value_right -= m_line_height;
+
+    // the rect of the button
+    m_rect_button = CRect(w-m_line_height, y, w, y+m_line_height);
+
+    UINT pushed = m_button_depressed?DFCS_PUSHED:0;
+
+    // now draw the button
+    switch (GetEditMode(*it))
+    {
+    case EM_MODAL:
+      // draw a button
+      dc.DrawFrameControl(m_rect_button, DFC_BUTTON, DFCS_BUTTONPUSH|pushed);
+      dc.SelectObject(&m_fntBold);
+      dc.DrawText(_T("..."), m_rect_button, DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX);
+      break;
+
+    case EM_DROPDOWN:
+      // draw an arrow
+      dc.DrawFrameControl(m_rect_button, DFC_SCROLL, DFCS_SCROLLDOWN|pushed);
+      break;
+
+    case EM_INPLACE:
+      // whole area is edit
+      m_rect_button.left = m_gutter_width;
+      break;
+
+    default:
+      ASSERT(false);
+    }
+  }
+
+  // update the rects
+  it->m_rcName = CRect(0, y, m_gutter_width, y+m_line_height);
+  it->m_rcValue = CRect(value_left, y, value_right, y+m_line_height);
+  CRect rcValue = it->m_rcValue;
+  rcValue.left += GetTextMargin();
+
+  // focused
+  if (m_focused_item == it->m_id)
+  {
+    int rect_left = name_left-2*margin;
+    int rect_right = name_right;
+    dc.FillSolidRect(rect_left, y, rect_right-rect_left+1, m_line_height, m_clrFocus);
+    dc.SetTextColor(m_clrHilite);
+  }
+  else
+  {
+    dc.SetTextColor(m_clrText);
+  }
+
+  // put name and value
+  dc.SelectObject(&m_fntNormal);
+  dc.DrawText(it->m_name, -1, CRect(name_left, y, name_right, y+m_line_height), DT_END_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX);
+
+  // get back to normal text
+  if (it->m_editable) dc.SetTextColor(m_clrEditable);
+  else dc.SetTextColor(m_clrDisabled);
+
+  // custom item
+  if (it->m_type == IT_CUSTOM)
+  {
+    int save = dc.SaveDC();
+    it->m_pCustom->DrawItem(dc, it->m_rcValue, m_focused_item == it->m_id);
+    dc.RestoreDC(save);
+  }
+  else
+  {
+    // modified flag
+    bool modified = (it->m_strValue != it->m_strValue_old);
+
+    // now draw text
+    CString strValue = it->m_strValue;
+    switch (it->m_type)
+    {
+    case IT_TEXT:
+      {
+        size_t j=0; // mch
+       // for (;( j = strValue.Find( "\r\n" )) != -1;)
+	//		strValue.Replace(j, 2, "?"); 
+        break;
+      }
+
+    case IT_INTEGER:
+      {
+        CString strTemp;
+        CString strFormat = _T("%d");
+        if (it->m_options.size() && !it->m_options.front().IsEmpty()) 
+			strFormat = it->m_options.front();
+
+        strTemp.Format(strFormat, it->m_nValue);
+        strValue = LPCTSTR(strTemp);
+        modified = (it->m_nValue != it->m_nValue_old);
+        break;
+      }
+
+    case IT_DOUBLE:
+      {
+        CString strTemp;
+        CString strFormat = _T("%g");
+        if (it->m_options.size() && !it->m_options.front().IsEmpty()) 
+			strFormat = it->m_options.front();
+        strTemp.Format(strFormat, it->m_dValue);
+        strValue = LPCTSTR(strTemp);
+        modified = (it->m_dValue != it->m_dValue_old);
+        break;
+      }
+
+    case IT_DATE:
+      {
+        CString strTemp;
+        if (it->m_options.size() && !it->m_options.front().IsEmpty()) 
+			strTemp = it->m_dtValue.Format(it->m_options.front());
+        else strTemp = it->m_dtValue.Format(VAR_DATEVALUEONLY);
+        strValue = LPCTSTR(strTemp);
+        modified = (it->m_dtValue != it->m_dtValue_old);
+        break;
+      }
+
+    case IT_DATETIME:
+      {
+        CString strTemp;
+        if (it->m_options.size() && !it->m_options.front().IsEmpty()) 
+			strTemp = it->m_dtValue.Format(it->m_options.front());
+        else strTemp = it->m_dtValue.Format();
+        strValue = LPCTSTR(strTemp);
+        modified = (it->m_dtValue != it->m_dtValue_old);
+        break;
+      }
+
+    case IT_BOOLEAN:
+      {
+        strValue = it->m_bValue ? m_strTrue : m_strFalse;
+        modified = (it->m_bValue != it->m_bValue_old);
+        break;
+      }
+
+    case IT_COMBO:
+      {
+        if (it->m_nValue>=0 && it->m_nValue<int(it->m_options.size()))
+          strValue = it->m_options[it->m_nValue];
+        modified = (it->m_nValue != it->m_nValue_old);
+        break;
+      }
+
+    case IT_FILE:
+    case IT_FOLDER:
+      {
+        TCHAR szBuffer[1024];
+        _tcsncpy_s(szBuffer, strValue, 1024);
+        PathCompactPath(dc.GetSafeHdc(), szBuffer, rcValue.Width());
+        strValue = szBuffer;
+        break;
+      }
+
+    case IT_COLOR:
+      {
+        // draw a sample rectangle
+        CRect rc = rcValue;
+        rc.DeflateRect(0,2,0,2);
+        rc.top++;
+        rc.right = rc.left + m_line_height;
+        dc.FrameRect(rc, &brushText);
+        rc.DeflateRect(1,1);
+        dc.FillSolidRect(rc, it->m_clrValue);
+        rcValue.left = rc.right + 3*margin;
+
+        // update the text
+        CString strTemp;
+        strTemp.Format(_T("%d; %d; %d"), GetRValue(it->m_clrValue), GetGValue(it->m_clrValue), GetBValue(it->m_clrValue));
+        strValue = LPCTSTR(strTemp);
+        modified = (it->m_clrValue != it->m_clrValue_old);
+        break;
+      }
+
+    case IT_FONT:
+      {
+        CString strTemp;
+        strTemp.Format(_T("%s; %dpt"), it->m_lfValue.lfFaceName, -MulDiv(it->m_lfValue.lfHeight, 72, dc.GetDeviceCaps(LOGPIXELSY)));
+        strValue = LPCTSTR(strTemp);
+        modified = (memcmp(&it->m_lfValue, &it->m_lfValue_old, sizeof(LOGFONT))!=0);
+        break;
+      }
+    }
+
+    // we must also take undefined state change into account
+    modified |= (it->m_undefined != it->m_undefined_old);
+
+    // set proper font
+    if (modified && m_bold_modified) dc.SelectObject(&m_fntBold);
+    else if (it->m_editable && m_bold_editables) dc.SelectObject(&m_fntBold);
+    else dc.SelectObject(&m_fntNormal);
+
+    // now draw it
+    if (it->m_undefined) strValue = m_strUndefined;
+    dc.DrawText(strValue, -1, rcValue, DT_END_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX);
+  }
+
+  // clean up
+  dc.SelectObject(pOldFont);
+  dc.SelectObject(pOldPen);
+  dc.SelectObject(pOldBrush);
+}
+
+//
+// mouse interaction
+//
+
+void CPropertyGrid::OnLButtonDown(UINT nFlags, CPoint point)
+{
+  // destroy edit
+  SetFocus();
+  DeleteEditControl();
+
+  // click on button?
+  if (m_rect_button.PtInRect(point))
+  {
+    m_button_pushed = true;
+    m_button_depressed = true;
+    SetCapture();
+    Invalidate();
+    return;
+  }
+
+  // click on button?
+  if (m_focused_item != -1)
+  {
+    CItem* pItem = FindItem(m_focused_item);
+    if (   pItem && pItem->m_type == IT_CUSTOM
+      && GetEditMode(*pItem) == EM_CUSTOM
+      && pItem->m_pCustom->OnLButtonDown(pItem->m_rcValue, point))
+    {
+      m_custom_tracking = true;
+      SetCapture();
+      Invalidate();
+      return;
+    }
+  }
+
+  // resizing gutter?
+  if (abs(point.x-m_gutter_width)<3)
+  {
+    ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEWE));
+    m_resizing_gutter = true;
+    m_ptLast = point;
+    SetCapture();
+    Invalidate();
+    return;
+  }
+
+  // disable focus
+  m_focused_item = -1;
+  m_focused_section = -1;
+  m_rect_button.SetRectEmpty();
+
+  // did we click on a section
+  if (m_display_mode == DM_CATEGORIZED)
+  {
+    for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+    {
+      if (it->m_rcSign.PtInRect(point))
+      {
+        it->m_collapsed = !it->m_collapsed;
+        m_focused_section = it->m_id;
+        RecalcLayout();
+        return;
+      }
+      else if (it->m_rcTitle.PtInRect(point))
+      {
+        m_focused_section = it->m_id;
+        Invalidate();
+        return;
+      }
+    }
+  }
+
+  // focus
+  for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+  {
+    if (!it->m_collapsed || m_display_mode != DM_CATEGORIZED)
+    {
+      for (std::vector<CItem>::iterator it2 = it->m_items.begin(); it2 != it->m_items.end(); ++it2)
+      {
+        if (it2->m_rcName.PtInRect(point) || it2->m_rcValue.PtInRect(point))
+        {
+          if (it2->m_editable || m_focus_disabled)
+          {
+            m_focused_item = it2->m_id;
+            if (it2->m_rcValue.PtInRect(point))
+              m_value_clicked = (GetEditMode(*it2) == EM_INPLACE || GetEditMode(*it2) == EM_DROPDOWN);
+            Invalidate();
+            return;
+          }
+        }
+      }
+    }
+  }
+
+  CWnd::OnLButtonDown(nFlags, point);
+  Invalidate();
+}
+
+void CPropertyGrid::OnLButtonDblClk(UINT nFlags, CPoint point)
+{
+  if (m_focused_item != -1)
+  {
+    CItem* pItem = FindItem(m_focused_item);
+    if (pItem)
+    {
+      if (pItem->m_type == IT_BOOLEAN)
+      {
+        if (!pItem->m_undefined)
+        {
+          pItem->m_bValue = !pItem->m_bValue;
+          GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+          Invalidate();
+        }
+      }
+      else if (pItem->m_type == IT_COMBO)
+      {
+        if (!pItem->m_undefined)
+        {
+          pItem->m_nValue = (pItem->m_nValue+1)%int(pItem->m_options.size());
+          GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+          Invalidate();
+        }
+      }
+      else if (GetEditMode(*pItem) == EM_MODAL)
+      {
+        EditFocusedItem();
+      }
+    }
+  }
+  else if (m_focused_section != -1)
+  {
+    CSection* pSection = FindSection(m_focused_section);
+    if (pSection)
+    {
+      pSection->m_collapsed = !pSection->m_collapsed;
+      Invalidate();
+    }
+  }
+
+  CWnd::OnLButtonDblClk(nFlags, point);
+}
+
+void CPropertyGrid::OnMouseMove(UINT nHitTest, CPoint point)
+{
+  if (m_custom_tracking)
+  {
+    CItem* pItem = FindItem(m_focused_item);
+    if (pItem)
+    {
+      pItem->m_pCustom->OnMouseMove(pItem->m_rcValue, point);
+      Invalidate();
+    }
+  }
+  else if (m_button_pushed)
+  {
+    m_button_depressed = m_rect_button.PtInRect(point)?true:false;
+    Invalidate();
+  }
+  else if (m_resizing_gutter)
+  {
+    ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEWE));
+    m_gutter_width += point.x-m_ptLast.x;
+    CRect rc;
+    GetClientRect(&rc);
+    if (m_gutter_width<rc.Width()/5) m_gutter_width = rc.Width()/5;
+    if (m_gutter_width>4*rc.Width()/5) m_gutter_width = 4*rc.Width()/5;
+    m_ptLast = point;
+    Invalidate();
+  }
+  else if (!m_control)
+  {
+    if (abs(point.x-m_gutter_width)<3) ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEWE));
+    else ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
+  }
+
+  CWnd::OnMouseMove(nHitTest, point);
+}
+
+void CPropertyGrid::OnLButtonUp(UINT nFlags, CPoint point)
+{
+  if (m_custom_tracking)
+  {
+    m_custom_tracking = false;
+    ReleaseCapture();
+    Invalidate();
+    CItem* pItem = FindItem(m_focused_item);
+    if (pItem)
+      pItem->m_pCustom->OnLButtonUp(pItem->m_rcValue, point);
+  }
+  else if (m_button_pushed || m_value_clicked)
+  {
+    m_button_pushed = false;
+    m_button_depressed = false;
+    ReleaseCapture();
+    Invalidate();
+
+    if (m_rect_button.PtInRect(point) || (m_value_clicked && m_focused_item != -1 && FindItem(m_focused_item) && FindItem(m_focused_item)->m_rcValue.PtInRect(point)))
+    {
+      m_value_clicked = false;
+      CItem* pItem = FindItem(m_focused_item);
+      if (pItem)
+      {
+        if (GetEditMode(*pItem) == EM_DROPDOWN)
+        {
+          if (pItem->m_type == IT_CUSTOM)
+          {
+            CRect rc = m_rect_button;
+            rc.left = m_gutter_width;
+            pItem->m_pCustom->ShowDropDown(rc);
+          }
+          else if (pItem->m_type == IT_DATE)
+          {
+            // the calendar rect
+            CRect rc = m_rect_button;
+            rc.left = m_gutter_width;
+            rc.top += m_line_height;
+            rc.bottom = rc.top + 100;
+            ClientToScreen(&rc);
+
+            // create it
+            m_control = new CPropertyGridMonthCalCtrl;
+            CPropertyGridMonthCalCtrl* mc = (CPropertyGridMonthCalCtrl*) m_control;
+            mc->CreateEx(0, MONTHCAL_CLASS, NULL, WS_POPUP|WS_BORDER, rc, GetParent(), 0);
+            mc->SetCurSel(pItem->m_dtValue);
+            mc->SetOwner(this);
+            mc->SizeMinReq();
+
+            // now position it
+            CRect rc2;
+            mc->GetWindowRect(&rc2);
+            rc2.OffsetRect(rc.right-rc2.right, 0);
+            mc->SetWindowPos(NULL, rc2.left, rc2.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_SHOWWINDOW);
+          }
+          else
+          {
+            // the combo rect
+            CRect rc = m_rect_button;
+            rc.left = m_gutter_width;
+            rc.top += m_line_height;
+            rc.bottom = rc.top + 100;
+
+            // create it
+            m_control = new CPropertyGridCombo();
+            CPropertyGridCombo* pCombo = (CPropertyGridCombo*)m_control;
+            pCombo->Create(WS_CHILD, rc, this, 0);
+            pCombo->SetColors(m_clrBack, m_clrText, m_clrFocus, m_clrHilite);
+            pCombo->SetFont(&m_fntNormal);
+
+            if (pItem->m_type == IT_BOOLEAN)
+            {
+              pCombo->AddString(m_strTrue);
+              pCombo->AddString(m_strFalse);
+              if (!pItem->m_undefined)
+                pCombo->SetCurSel(pItem->m_bValue?0:1);
+            }
+            else
+            {
+              for (std::vector<CString>::iterator it = pItem->m_options.begin(); it != pItem->m_options.end(); ++it)
+                pCombo->AddString(*it);
+              if (!pItem->m_undefined)
+                pCombo->SetCurSel(pItem->m_nValue);
+            }
+            pCombo->ShowWindow(SW_SHOW);
+          }
+        }
+        else if (GetEditMode(*pItem) == EM_INPLACE)
+        {
+          // the in-place edit rect
+          CRect rc = m_rect_button;
+          rc.left++;
+          rc.top += margin;
+
+          // the value
+          CString strValue;
+          if (pItem->m_type == IT_STRING)
+          {
+            strValue = pItem->m_strValue;
+          }
+          else if (pItem->m_type == IT_INTEGER)
+          {
+            if (!pItem->m_undefined)
+            {
+              CString strTemp;
+              strTemp.Format(_T("%d"), pItem->m_nValue);
+              strValue = LPCTSTR(strTemp);
+            }
+          }
+          else if (pItem->m_type == IT_DOUBLE)
+          {
+            if (!pItem->m_undefined)
+            {
+              CString strTemp;
+              strTemp.Format(_T("%g"), pItem->m_dValue);
+              strValue = LPCTSTR(strTemp);
+            }
+          }
+          else if (pItem->m_type == IT_CUSTOM)
+          {
+            strValue = pItem->m_pCustom->GetStringForInPlaceEdit();
+          }
+          else
+          {
+            ASSERT(false);
+          }
+
+          // create it
+          m_control = new CPropertyGridInPlaceEdit(this, rc, WS_CHILD, 1000, strValue);
+          CPropertyGridInPlaceEdit* pEdit = (CPropertyGridInPlaceEdit*)m_control;
+          pEdit->SetColors(m_clrBack, m_clrText);
+          pEdit->SetFont(&m_fntNormal);
+          pEdit->ShowWindow(SW_SHOW);
+        }
+        else if (GetEditMode(*pItem) == EM_MODAL)
+        {
+          EditFocusedItem();
+        }
+        else if (GetEditMode(*pItem) == EM_CUSTOM)
+        {
+          pItem->m_pCustom->OnLButtonUp(pItem->m_rcValue, point);
+        }
+        else
+        {
+          ASSERT(false);
+        }
+      }
+    }
+  }
+  else if (m_resizing_gutter)
+  {
+    ReleaseCapture();
+    m_resizing_gutter = false;
+    ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
+  }
+
+  CWnd::OnLButtonUp(nFlags, point);
+}
+
+//
+// keyboard interaction
+//
+
+UINT CPropertyGrid::OnGetDlgCode()
+{
+  return CWnd::OnGetDlgCode()|DLGC_WANTCHARS|DLGC_WANTARROWS;
+}
+
+void CPropertyGrid::MoveForward(HSECTION& focused_section, HITEM& focused_item)
+{
+  for (int pass = 0; pass<2; pass++)
+  {
+    bool found = false;
+
+    bool stop_on_next_valid = false;
+    if (focused_section == -1 && focused_item == -1)
+      stop_on_next_valid = true;
+
+    for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+    {
+      if (m_display_mode == DM_CATEGORIZED)
+      {
+        if (it->m_id == focused_section)
+        {
+          stop_on_next_valid = true;
+        }
+        else if (stop_on_next_valid)
+        {
+          focused_section = it->m_id;
+          focused_item = -1;
+          found = true;
+          break;
+        }
+      }
+
+      if (!it->m_collapsed || m_display_mode != DM_CATEGORIZED)
+      {
+        for (std::vector<CItem>::iterator it2 = it->m_items.begin(); it2 != it->m_items.end(); ++it2)
+        {
+          if (it2->m_id == focused_item)
+          {
+            stop_on_next_valid = true;
+          }
+          else if (stop_on_next_valid)
+          {
+            if (it2->m_editable || m_focus_disabled)
+            {
+              focused_section = -1;
+              focused_item = it2->m_id;
+              found = true;
+              break;
+            }
+          }
+        }
+
+        if (found)
+          break;
+      }
+    }
+
+    if (found)
+      break;
+
+    focused_section = -1;
+    focused_item = -1;
+  }
+}
+
+void CPropertyGrid::FocusNextItem()
+{
+  // simple move forward
+  MoveForward(m_focused_section, m_focused_item);
+
+  // ensure visible
+  CRect rc(0,0,0,0);
+  if (m_focused_section != -1 && FindSection(m_focused_section)) rc = FindSection(m_focused_section)->m_rcTitle;
+  else if (m_focused_item != -1 && FindItem(m_focused_item)) rc = FindItem(m_focused_item)->m_rcName;
+  if (!rc.IsRectEmpty())
+  {
+    CRect rect;
+    GetClientRect(&rect);
+    rect.IntersectRect(rc, rect);
+    if (rect.Height() != m_line_height)
+      OnVScroll(SB_THUMBPOSITION, rc.top, &m_scrollbar);
+  }
+
+  // done
+  Invalidate();
+}
+
+void CPropertyGrid::FocusPrevItem()
+{
+  for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+  {
+    if (m_display_mode == DM_CATEGORIZED)
+    {
+      HSECTION focused_section = it->m_id;
+      HITEM focused_item = -1;
+      MoveForward(focused_section, focused_item);
+      if (focused_section == m_focused_section && focused_item == m_focused_item)
+      {
+        m_focused_section = it->m_id;
+        m_focused_item = -1;
+        break;
+      }
+    }
+
+    if (!it->m_collapsed || m_display_mode != DM_CATEGORIZED)
+    {
+      bool found = false;
+      for (std::vector<CItem>::iterator it2 = it->m_items.begin(); it2 != it->m_items.end(); ++it2)
+      {
+        if (!it2->m_editable && !m_focus_disabled)
+          continue;
+
+        HSECTION focused_section = -1;
+        HITEM focused_item = it2->m_id;
+        MoveForward(focused_section, focused_item);
+        if (focused_section == m_focused_section && focused_item == m_focused_item)
+        {
+          m_focused_section = -1;
+          m_focused_item = it2->m_id;
+          found = true;
+          break;
+        }
+      }
+
+      if (found)
+        break;
+    }
+  }
+
+  // ensure visible
+  CRect rc(0,0,0,0);
+  if (m_focused_section != -1 && FindSection(m_focused_section)) rc = FindSection(m_focused_section)->m_rcTitle;
+  else if (m_focused_item != -1 && FindItem(m_focused_item)) rc = FindItem(m_focused_item)->m_rcName;
+  if (!rc.IsRectEmpty())
+  {
+    CRect rect;
+    GetClientRect(&rect);
+    rect.IntersectRect(rc, rect);
+    if (rect.Height() != m_line_height)
+      OnVScroll(SB_THUMBPOSITION, rc.top, &m_scrollbar);
+  }
+
+  // done
+  Invalidate();
+}
+
+void CPropertyGrid::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+  if (nChar == '*')
+  {
+    ExpandAll(true);
+  }
+  else if (nChar == '/')
+  {
+    ExpandAll(false);
+  }
+  else if (nChar == '+' || nChar == '-')
+  {
+    if (m_focused_section != -1)
+    {
+      CSection* pSection = FindSection(m_focused_section);
+      if (pSection) pSection->m_collapsed = (nChar=='-');
+      RecalcLayout();
+    }
+  }
+
+  CWnd::OnChar(nChar, nRepCnt, nFlags);
+}
+
+void CPropertyGrid::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+  if (nChar == VK_DOWN)
+  {
+    FocusNextItem();
+  }
+  else if (nChar == VK_UP)
+  {
+    FocusPrevItem();
+  }
+  else if (nChar == VK_LEFT)
+  {
+    if (m_focused_section != -1 && FindSection(m_focused_section) && FindSection(m_focused_section)->m_collapsed == false)
+    {
+      ExpandSection(m_focused_section, false);
+    }
+    else
+    {
+      FocusPrevItem();
+    }
+  }
+  else if (nChar == VK_RIGHT)
+  {
+    if (m_focused_section != -1 && FindSection(m_focused_section) && FindSection(m_focused_section)->m_collapsed == true)
+    {
+      ExpandSection(m_focused_section, true);
+    }
+    else
+    {
+      FocusNextItem();
+    }
+  }
+
+  CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+//
+// scrolling
+//
+
+void CPropertyGrid::RecalcLayout()
+{
+  // save current scroll offset
+  int offset = GetScrollOffset();
+
+  // total height
+  int height = 0;
+  for (std::vector<CSection>::iterator it = m_sections.begin(); it != m_sections.end(); ++it)
+  {
+    if (m_display_mode == DM_CATEGORIZED)
+      height += m_line_height;
+    if (!it->m_collapsed || m_display_mode != DM_CATEGORIZED)
+      height += int(it->m_items.size())*m_line_height;
+  }
+
+  // client rect
+  CRect rc;
+  GetClientRect(&rc);
+  if (height < rc.Height())
+  {
+    if (m_scrollbar.GetSafeHwnd() != NULL)
+    {
+      m_scrollbar.EnableScrollBar(ESB_DISABLE_BOTH);
+      m_scrollbar.ShowScrollBar(FALSE);
+    }
+    m_scroll_enabled = false;
+  }
+  else
+  {
+    if (m_scrollbar.GetSafeHwnd() == NULL)
+    {
+      CRect rect = rc;
+      rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL);
+      m_scrollbar.Create(WS_CHILD|SBS_VERT, rect, this, 1000);
+    }
+
+    m_scrollbar.EnableScrollBar(ESB_ENABLE_BOTH);
+
+    SCROLLINFO info;
+    info.cbSize = sizeof(SCROLLINFO);
+    info.fMask = SIF_ALL;
+    info.nMin = 0;
+    info.nMax = height;
+    info.nPage = rc.Height();
+    info.nPos = min(offset, height);
+    info.nTrackPos = 2;
+    m_scrollbar.SetScrollInfo(&info);
+
+    m_scrollbar.ShowScrollBar();
+    m_scroll_enabled = true;
+  }
+
+  if (GetSafeHwnd())
+    Invalidate();
+}
+
+int CPropertyGrid::GetScrollOffset()
+{
+  if (m_scrollbar && m_scrollbar.IsWindowEnabled() == TRUE)
+    return m_scrollbar.GetScrollPos();
+  return 0;
+}
+
+void CPropertyGrid::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+  // check
+  if (!m_scroll_enabled) return;
+  if (pScrollBar != &m_scrollbar) return;
+  if (nSBCode == SB_ENDSCROLL) return;
+
+  // set focus to us
+  SetFocus();
+
+  // get the scroll info
+  SCROLLINFO info;
+  info.cbSize = sizeof(SCROLLINFO);
+  info.fMask = SIF_ALL;
+  m_scrollbar.GetScrollInfo(&info);
+  int min = info.nMin;
+  int pos = info.nPos;
+  int max = info.nMax-info.nPage;
+
+  // the entire rect
+  CRect rect;
+  GetClientRect(&rect);
+  int h = rect.Height();
+
+  // the rect without the scrollbar
+  CRect rc(0,0,rect.right-GetSystemMetrics(SM_CXVSCROLL),rect.bottom);
+
+  switch(nSBCode)
+  {
+  case SB_TOP:
+    pScrollBar->SetScrollPos(min);
+    break;
+
+  case SB_BOTTOM:
+    pScrollBar->SetScrollPos(max);
+    break;
+
+  case SB_LINEDOWN:
+    if (pos+m_line_height>=max) pScrollBar->SetScrollPos(max);
+    else pScrollBar->SetScrollPos(pos+m_line_height);
+    break;
+
+  case SB_LINEUP:
+    if (pos-m_line_height<=min) pScrollBar->SetScrollPos(min);
+    else pScrollBar->SetScrollPos(pos-m_line_height);
+    break;
+
+  case SB_PAGEDOWN:
+    if (pos+h>=max) pScrollBar->SetScrollPos(max);
+    else pScrollBar->SetScrollPos(pos+h);
+    break;
+
+  case SB_PAGEUP:
+    if (pos-h<=min) pScrollBar->SetScrollPos(min);
+    else pScrollBar->SetScrollPos(pos-h);
+    break;
+
+  case SB_THUMBPOSITION:
+  case SB_THUMBTRACK:
+    int diff = nPos - pos;
+    if (diff == 0) return;
+    if (pos <= min && diff<0) return;
+    if (pos >= max && diff>0) return;
+    pScrollBar->SetScrollPos(nPos);
+  }
+
+  Invalidate();
+
+  CWnd::OnVScroll(nSBCode, nPos, pScrollBar);
+
+}
+
+BOOL CPropertyGrid::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+{
+  int steps = abs(zDelta)/WHEEL_DELTA;
+  for (int i=0; i<3*steps; i++)
+  {
+    if (zDelta>0) OnVScroll(SB_LINEUP, 0, &m_scrollbar);
+    if (zDelta<0) OnVScroll(SB_LINEDOWN, 0, &m_scrollbar);
+  }
+
+  return CWnd::OnMouseWheel(nFlags, zDelta, pt);
+}
+
+//
+// editing
+//
+
+CPropertyGrid::EEditMode CPropertyGrid::GetEditMode(CItem& item)
+{
+  switch (item.m_type)
+  {
+  case IT_CUSTOM:
+    return item.m_pCustom->GetEditMode();
+
+  case IT_STRING:
+  case IT_INTEGER:
+  case IT_DOUBLE:
+    return EM_INPLACE;
+
+  case IT_COMBO:
+  case IT_BOOLEAN:
+  case IT_DATE:
+    return EM_DROPDOWN;
+
+  case IT_TEXT:
+  case IT_DATETIME:
+  case IT_FILE:
+  case IT_FOLDER:
+  case IT_COLOR:
+  case IT_FONT:
+    return EM_MODAL;
+
+  default:
+    ASSERT(false);
+    return EM_CUSTOM;
+  }
+}
+
+void CPropertyGrid::DeleteEditControl()
+{
+  // destroy edit
+  if (m_control)
+  {
+    if (m_control->GetSafeHwnd())
+      m_control->DestroyWindow();
+    delete m_control;
+    m_control = NULL;
+  }
+}
+
+LRESULT CPropertyGrid::OnComboSelChanged(WPARAM wParam, LPARAM lParam)
+{
+  CItem* pItem = FindItem(m_focused_item);
+  if (pItem)
+  {
+    if (pItem->m_type == IT_BOOLEAN)
+    {
+      pItem->m_bValue = (wParam == 0);
+      pItem->m_undefined = false;
+      GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+      DeleteEditControl();
+      Invalidate();
+    }
+    else if (pItem->m_type == IT_COMBO)
+    {
+      pItem->m_nValue = int(wParam);
+      pItem->m_undefined = false;
+      GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+      DeleteEditControl();
+      Invalidate();
+    }
+    else
+    {
+      ASSERT(false);
+    }
+  }
+  return 0;
+}
+
+LRESULT CPropertyGrid::OnEditChanged(WPARAM wParam, LPARAM lParam)
+{
+  TCHAR* pParamValue = (TCHAR*)wParam;
+  CItem* pItem = FindItem(m_focused_item);
+  if (pItem)
+  {
+    if (pItem->m_type == IT_STRING)
+    {
+      pItem->m_strValue = CString(pParamValue);
+      pItem->m_undefined = false;
+      GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+      DeleteEditControl();
+      Invalidate();
+    }
+    else if (pItem->m_type == IT_INTEGER)
+    {
+      if (wcslen((TCHAR*)wParam))
+      {
+        pItem->m_nValue = _ttoi(pParamValue);
+        pItem->m_undefined = false;
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+      }
+      DeleteEditControl();
+      Invalidate();
+    }
+    else if (pItem->m_type == IT_DOUBLE)
+    {
+      if (wcslen((TCHAR*)wParam))
+      {
+        pItem->m_dValue = _tcstod(pParamValue,NULL);
+        pItem->m_undefined = false;
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+      }
+      DeleteEditControl();
+      Invalidate();
+    }
+    else if (pItem->m_type == IT_CUSTOM)
+    {
+      if (pItem->m_pCustom->OnItemEdited(CString(pParamValue)))
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+      DeleteEditControl();
+      Invalidate();
+    }
+    else
+    {
+      ASSERT(false);
+    }
+  }
+  return 0;
+}
+
+LRESULT CPropertyGrid::OnDateChanged(WPARAM wParam, LPARAM lParam)
+{
+  CItem* pItem = FindItem(m_focused_item);
+  if (pItem)
+  {
+    if (pItem->m_type == IT_DATE)
+    {
+      CPropertyGridMonthCalCtrl* mc = (CPropertyGridMonthCalCtrl*) m_control;
+      mc->GetCurSel(pItem->m_dtValue);
+      pItem->m_undefined = false;
+      GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+      DeleteEditControl();
+      Invalidate();
+
+    }
+    else
+    {
+      ASSERT(false);
+    }
+  }
+  return 0;
+}
+
+void CPropertyGrid::EditFocusedItem()
+{
+	USES_CONVERSION;
+
+  CItem* pItem = FindItem(m_focused_item);
+  if (pItem)
+  {
+    if (!pItem->m_editable)
+      return;
+
+    if (pItem->m_type == IT_TEXT)
+    {
+      CDynDialogEx dlg(GetParent());
+      dlg.SetUseSystemButtons(FALSE);
+      dlg.SetWindowTitle(CT2A(pItem->m_name));
+      dlg.SetFont(&m_fntNormal);
+      CString strValue = pItem->m_strValue;
+      dlg.AddDlgControl("EDIT", pItem->m_strValue, STYLE_EDIT|WS_VSCROLL|WS_HSCROLL|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_LEFT|ES_MULTILINE|ES_WANTRETURN, EXSTYLE_EDIT, CRect(7, 7, 200, 100), (void*) &strValue);
+      dlg.AddDlgControl("BUTTON", m_strOk, STYLE_BUTTON, EXSTYLE_BUTTON, CRect(56, 106, 106, 120), NULL, IDOK); 
+      dlg.AddDlgControl("BUTTON", m_strCancel, STYLE_BUTTON, EXSTYLE_BUTTON, CRect(110, 106, 160, 120), NULL, IDCANCEL); 
+      if (dlg.DoModal() == IDOK)
+      {
+        pItem->m_strValue = LPCTSTR(strValue);
+        pItem->m_undefined = false;
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+        Invalidate();
+      }
+    }
+    else if (pItem->m_type == IT_DATETIME)
+    {
+      CDynDialogEx dlg(GetParent());
+      dlg.SetUseSystemButtons(FALSE);
+      dlg.SetWindowTitle(CT2A(pItem->m_name));
+      dlg.SetFont(&m_fntNormal);
+      COleDateTime dtValueDate = pItem->m_dtValue;
+      CTime dtValueTime(pItem->m_dtValue.GetYear(), pItem->m_dtValue.GetMonth(), pItem->m_dtValue.GetDay(), pItem->m_dtValue.GetHour(), pItem->m_dtValue.GetMinute(), pItem->m_dtValue.GetSecond());
+      dlg.AddDlgControl("STATIC", m_strDate, STYLE_STATIC, EXSTYLE_STATIC, CRect(7, 3, 60, 12));
+      dlg.AddDlgControl("STATIC", m_strTime, STYLE_STATIC, EXSTYLE_STATIC, CRect(67, 3, 120, 12));
+      dlg.AddDlgControl("SysDateTimePick32", _T(""), STYLE_DATETIMEPICKER|DTS_SHORTDATEFORMAT, EXSTYLE_DATETIMEPICKER, CRect(7, 13, 60, 26), (void*) &dtValueDate);
+      dlg.AddDlgControl("SysDateTimePick32", _T(""), STYLE_DATETIMEPICKER|DTS_TIMEFORMAT , EXSTYLE_DATETIMEPICKER, CRect(67, 13, 120, 26), (void*) &dtValueTime);
+      dlg.AddDlgControl("BUTTON", m_strOk, STYLE_BUTTON, EXSTYLE_BUTTON, CRect(7, 37, 60, 51), NULL, IDOK); 
+      dlg.AddDlgControl("BUTTON", m_strCancel, STYLE_BUTTON, EXSTYLE_BUTTON, CRect(67, 37, 120, 51), NULL, IDCANCEL); 
+      if (dlg.DoModal() == IDOK)
+      {
+        pItem->m_dtValue.SetDateTime(dtValueDate.GetYear(), dtValueDate.GetMonth(), dtValueDate.GetDay(),
+          dtValueTime.GetHour(), dtValueTime.GetMinute(), dtValueTime.GetSecond());
+        pItem->m_undefined = false;
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+        Invalidate();
+      }
+    }
+    else if (pItem->m_type == IT_COLOR)
+    {
+      CColorDialog dlg(pItem->m_clrValue, 0, GetParent());
+      if (dlg.DoModal() == IDOK)
+      {
+        pItem->m_clrValue = dlg.GetColor();
+        pItem->m_undefined = false;
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+        Invalidate();
+      }
+    }
+    else if (pItem->m_type == IT_FILE)
+    {
+      CFileDialog dlg(TRUE, NULL, pItem->m_strValue, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, pItem->m_options.front(), GetParent());
+      if (dlg.DoModal() == IDOK)
+      {
+       // pItem->m_strValue = dlg.GetPathName(); mch
+		pItem->m_strValue = dlg.GetFileName();
+        pItem->m_undefined = false;
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+        Invalidate();
+      }
+    }
+    else if (pItem->m_type == IT_FOLDER)
+    {
+      CPropertyGridDirectoryPicker::m_strTitle = pItem->m_options.front();
+      if (CPropertyGridDirectoryPicker::PickDirectory(pItem->m_strValue, GetParent()->GetSafeHwnd()))
+      {
+        pItem->m_undefined = false;
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+        Invalidate();
+      }
+    }
+    else if (pItem->m_type == IT_FONT)
+    {
+      CFontDialog dlg(&pItem->m_lfValue, CF_EFFECTS|CF_SCREENFONTS, NULL, GetParent());
+      if (dlg.DoModal() == IDOK)
+      {
+        memcpy(&pItem->m_lfValue, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
+        pItem->m_undefined = false;
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+        Invalidate();
+      }
+    }
+    else if (pItem->m_type == IT_CUSTOM)
+    {
+      if (pItem->m_pCustom->OnEditItem())
+      {
+        GetOwner()->SendMessage(WM_PG_ITEMCHANGED, pItem->m_id);
+        Invalidate();
+      }
+    }
+    else
+    {
+      ASSERT(false);
+    }
+  }
+}
+
+
+
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGrid.h b/Common_Class/SISControls/PropertyGridControl/PropertyGrid.h
new file mode 100644
index 0000000..9fdc338
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGrid.h
@@ -0,0 +1,314 @@
+#pragma once
+
+#include "PropertyGridCombo.h"
+#include "PropertyGridInPlaceEdit.h"
+
+#include <map>
+#include <vector>
+// CPropertyGrid
+
+#define WM_PG_ITEMCHANGED WM_USER+486
+
+typedef UINT HSECTION;
+typedef UINT HITEM;
+
+class ICustomItem;
+
+class AFX_EXT_CLASS CPropertyGrid : public CWnd
+{
+	DECLARE_DYNAMIC(CPropertyGrid)
+
+public:
+	// display mode
+	enum EDisplayMode
+	{
+		DM_CATEGORIZED = 0,
+		DM_ALPHABETICAL,
+		DM_NOSORT
+	};
+
+	// editing
+	enum EEditMode
+	{
+		EM_CUSTOM = 0,
+		EM_INPLACE,
+		EM_DROPDOWN,
+		EM_MODAL
+	};
+
+	enum EItemType
+	{
+		IT_CUSTOM = 0,
+		IT_STRING,
+		IT_TEXT,
+		IT_INTEGER,
+		IT_DOUBLE,
+		IT_COMBO,
+		IT_BOOLEAN,
+		IT_DATE,
+		IT_DATETIME,
+		IT_FILE,
+		IT_FOLDER,
+		IT_COLOR,
+		IT_FONT
+	};
+
+public:
+	CPropertyGrid();
+	virtual ~CPropertyGrid();
+
+	// customization
+	bool GetShadeTitles();
+	void SetShadeTitles(bool shade_titles);
+	bool GetDrawLines();
+	void SetDrawLines(bool draw_lines);
+	bool GetDrawGutter();
+	void SetDrawGutter(bool draw_gutter);
+	bool GetFocusDisabled();
+	void SetFocusDisabled(bool focus_disabled);
+	bool GetBoldModified();
+	void SetBoldModified(bool bold_modified);
+	bool GetBoldEditables();
+	void SetBoldEditables(bool bold_editables);
+
+	// gutter width
+	int GetGutterWidth();
+	void SetGutterWidth(int gutter_width);
+
+	// custom colors
+	void SetTextColor(COLORREF clrText);
+	void SetTitleColor(COLORREF clrText);
+	void SetBackColor(COLORREF clrBack);
+	void SetShadeColor(COLORREF clrShade);
+	void SetFocusColor(COLORREF clrFocus);
+	void SetHiliteColor(COLORREF clrHilite);
+	void SetEditableColor(COLORREF clrEditable);
+	void SetDisabledColor(COLORREF clrDisabled);
+
+	// localization
+	void SetTrueFalseStrings(CString strTrue, CString strFalse);
+	void SetOkCancelStrings(CString strOk, CString strCancel);
+	void SetDateTimeStrings(CString strDate, CString strTime);
+	void SetUndefinedString(CString strUndefined);
+	void SetEmptyString(CString strEmpty);
+
+	// add a section
+	HSECTION AddSection(CString title, bool collapsed = false, HSECTION after = -1);
+
+	// add items
+	HITEM AddCustomItem(HSECTION, CString name, ICustomItem* pItem, bool editable = true, HITEM after = -1);
+	HITEM AddStringItem(HSECTION section, CString name, CString value, bool editable = true, HITEM after = -1);
+	HITEM AddTextItem(HSECTION section, CString name, CString value, bool editable = true, HITEM after = -1);
+	HITEM AddIntegerItem(HSECTION section, CString name, int value, CString format = _T(""), bool editable = true, bool undefined = false, HITEM after = -1);
+	HITEM AddDoubleItem(HSECTION section, CString name, double value, CString format = _T(""), bool editable = true, bool undefined = false, HITEM after = -1);
+	HITEM AddComboItem(HSECTION section, CString name, const std::vector<CString>& values, int cur, bool editable = true, bool undefined = false, HITEM after = -1);
+	HITEM AddBoolItem(HSECTION section, CString name, bool value, bool editable = true, bool undefined = false, HITEM after = -1);
+	HITEM AddDateItem(HSECTION section, CString name, COleDateTime value, CString format = _T(""), bool editable = true, bool undefined = false, HITEM after = -1);
+	HITEM AddDateTimeItem(HSECTION section, CString name, COleDateTime value, CString format = _T(""), bool editable = true, bool undefined = false, HITEM after = -1);
+	HITEM AddFileItem(HSECTION section, CString name, CString value, CString filter = _T(""), bool editable = true, HITEM after = -1);
+	HITEM AddFolderItem(HSECTION section, CString name, CString value, CString title = _T(""), bool editable = true, HITEM after = -1);
+	HITEM AddColorItem(HSECTION section, CString name, COLORREF value, bool editable = true, bool undefined = false, HITEM after = -1);
+	HITEM AddFontItem(HSECTION section, CString name, LOGFONT value, bool editable = true, bool undefined = false, HITEM after = -1);
+
+	// contents
+	void ResetContents();
+	bool RemoveSection(HSECTION hs);
+	bool RemoveItem(HITEM item);
+	void ValidateChanges();
+
+	// status
+	int GetNumSections();
+	int GetSectionSize(HSECTION hs);
+
+	// get item value
+	bool GetItemValue(HITEM item, CString& strValue) const;
+	bool GetItemValue(HITEM item, int& nValue) const;
+	bool GetItemValue(HITEM item, double& dValue) const;
+	bool GetItemValue(HITEM item, bool& bValue) const;
+	bool GetItemValue(HITEM item, COleDateTime& dtValue) const;
+	bool GetItemValue(HITEM item, COLORREF& clrValue) const;
+	bool GetItemValue(HITEM item, LOGFONT& lfValue) const;
+
+	// set item value
+	bool SetItemValue(HITEM item, const CString strValue);
+	bool SetItemValue(HITEM item, const int nValue);
+	bool SetItemValue(HITEM item, const double nValue);
+	bool SetItemValue(HITEM item, const bool bValue);
+	bool SetItemValue(HITEM item, const COleDateTime dtValue);
+	bool SetItemValue(HITEM item, const COLORREF clrValue);
+	bool SetItemValue(HITEM item, const LOGFONT lfValue);
+
+	// for custom items
+	int GetTextMargin();
+	CFont* GetFontNormal();
+	CFont* GetFontBold();
+
+	// appearance stuff
+	void SetDisplayMode(EDisplayMode display_mode);
+	void ExpandAll(bool expand);
+	void ExpandSection(HSECTION hs, bool expand);
+	bool IsSectionCollapsed(HSECTION hs);
+
+protected:
+	class CItem
+	{
+	public:
+		HITEM m_id;
+		bool m_editable;
+		bool m_undefined;
+		EItemType m_type;
+		CString m_name;
+
+		std::vector<CString> m_options;
+
+		int m_nValue;
+		double m_dValue;
+		CString m_strValue;
+		bool m_bValue;
+		COleDateTime m_dtValue;
+		COLORREF m_clrValue;
+		LOGFONT m_lfValue;
+		ICustomItem* m_pCustom;
+
+		bool m_undefined_old;
+		int m_nValue_old;
+		double m_dValue_old;
+		CString m_strValue_old;
+		bool m_bValue_old;
+		COleDateTime m_dtValue_old;
+		COLORREF m_clrValue_old;
+		LOGFONT m_lfValue_old;
+
+		CRect m_rcName;
+		CRect m_rcValue;
+
+		bool operator==(const HITEM& item) const;
+		bool operator==(const CString& name) const;
+
+		void ValidateChanges();
+	};
+
+	friend bool item_alpha_sort(std::vector<CPropertyGrid::CItem>::iterator it1, std::vector<CPropertyGrid::CItem>::iterator it2);
+
+	class CSection
+	{
+	public:
+		HSECTION m_id;
+		CString m_title;
+		bool m_collapsed;
+		std::vector<CItem> m_items;
+
+		CRect m_rcSign;
+		CRect m_rcTitle;
+
+		bool operator==(const HSECTION& section) const;
+	};
+
+	std::vector<CSection> m_sections;
+
+	HSECTION m_focused_section;
+	HITEM m_focused_item;
+
+	EDisplayMode m_display_mode;
+
+	bool m_shade_titles;
+	bool m_draw_lines;
+	bool m_draw_gutter;
+	bool m_focus_disabled;
+	bool m_bold_modified;
+	bool m_bold_editables;
+
+	int m_gutter_width;
+	bool m_resizing_gutter;
+	CPoint m_ptLast;
+
+	CFont m_fntNormal;
+	CFont m_fntBold;
+
+	int m_line_height;
+
+	CRect m_rect_button;
+	CWnd* m_control;
+	bool m_button_pushed;
+	bool m_button_depressed;
+	bool m_value_clicked;
+	bool m_custom_tracking;
+
+	HSECTION m_section_id;
+	HITEM m_item_id;
+
+	CString m_strTrue;
+	CString m_strFalse;
+	CString m_strOk;
+	CString m_strCancel;
+	CString m_strDate;
+	CString m_strTime;
+	CString m_strUndefined;
+	CString m_strEmpty;
+
+	COLORREF m_clrText;
+	COLORREF m_clrTitle;
+	COLORREF m_clrBack;
+	COLORREF m_clrShade;
+	COLORREF m_clrFocus;
+	COLORREF m_clrHilite;
+	COLORREF m_clrEditable;
+	COLORREF m_clrDisabled;
+	COLORREF m_clrItemLine;
+
+protected:
+	DECLARE_MESSAGE_MAP()
+
+	// init control
+	void InitControl();
+
+	// drawing
+	void DrawItem(CDC& dc, int w, int x, int y, std::vector<CItem>::iterator& it);
+
+	// item management
+	CSection* FindSection(HSECTION hs) const;
+	CItem* FindItem(HITEM hi) const;
+	HITEM AddItem(HSECTION hs, EItemType type, CString name, void* pValue, bool editable, bool undefined, HITEM after);
+
+	// scrolling stuff
+	CScrollBar m_scrollbar;
+	bool m_scroll_enabled;
+	int GetScrollOffset();
+	void RecalcLayout();
+
+	// editing
+	EEditMode GetEditMode(CItem& item);
+	void DeleteEditControl();
+	void EditFocusedItem();
+
+	// movement in list
+	void MoveForward(HSECTION& focused_section, HITEM& focused_item);
+
+	// keyboard
+	void FocusNextItem();
+	void FocusPrevItem();
+
+protected:
+	virtual void PreSubclassWindow();
+
+public:
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnDestroy();
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	afx_msg void OnPaint();
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nHitTest, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	afx_msg LRESULT OnComboSelChanged(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnEditChanged(WPARAM wParam, LPARAM lParam);
+	afx_msg LRESULT OnDateChanged(WPARAM wParam, LPARAM lParam);
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg UINT OnGetDlgCode();
+	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+};
+
+
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.cpp b/Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.cpp
new file mode 100644
index 0000000..98dba91
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.cpp
@@ -0,0 +1,260 @@
+// PropertyGridCombo.cpp : 备泅 颇老涝聪促.
+//
+
+#include "../stdafx.h"
+#include "PropertyGridCombo.h"
+
+
+// CPropertyGridCombo
+static const int margin = 2;
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+
+#endif
+IMPLEMENT_DYNAMIC(CPropertyGridCombo, CWnd)
+
+CPropertyGridCombo::CPropertyGridCombo()
+{
+	m_pFont = NULL;
+	m_nSelected = -1;
+	m_bTracking = false;
+
+	m_clrBack = GetSysColor(COLOR_WINDOW);
+	m_clrText = GetSysColor(COLOR_WINDOWTEXT);
+	m_clrFocus = GetSysColor(COLOR_HIGHLIGHT);
+	m_clrHilite = GetSysColor(COLOR_HIGHLIGHTTEXT);
+}
+
+CPropertyGridCombo::~CPropertyGridCombo()
+{
+}
+
+void CPropertyGridCombo::AddString(const CString& strItem)
+{
+  m_Items.push_back(strItem);
+}
+
+void CPropertyGridCombo::SetCurSel(int nItem)
+{
+  m_nSelected = nItem;
+}
+
+BEGIN_MESSAGE_MAP(CPropertyGridCombo, CWnd)
+	ON_WM_PAINT()
+	ON_WM_SHOWWINDOW()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_MOUSEMOVE()
+	ON_WM_LBUTTONUP()
+	ON_WM_DESTROY()
+	ON_WM_KILLFOCUS()
+	ON_WM_KEYDOWN()
+	ON_WM_GETDLGCODE()
+END_MESSAGE_MAP()
+
+
+
+// CPropertyGridCombo 皋矫瘤 贸府扁涝聪促.
+
+BOOL CPropertyGridCombo::Create(DWORD dwStyle, CRect& rc, CWnd* pParent, int nId)
+{
+  pParent->ClientToScreen(&rc);
+  //BOOL ret = __super::CreateEx(0, AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW), "", dwStyle|WS_POPUP, rc, pParent->GetParent(), nId);
+
+  BOOL ret = __super::CreateEx(0, AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW), _T(""),WS_POPUP|WS_BORDER, rc, pParent->GetParent(), nId);
+
+  if (ret) SetOwner(pParent);
+  return ret;
+}
+
+void CPropertyGridCombo::SetFont(CFont* pFont, BOOL bRedraw)
+{
+  m_pFont = pFont;
+  CWnd::SetFont(pFont, bRedraw);
+}
+
+void CPropertyGridCombo::SetColors(COLORREF clrBack, COLORREF clrText, COLORREF clrFocus, COLORREF clrHilite)
+{
+  m_clrBack = clrBack;
+  m_clrText = clrText;
+  m_clrFocus = clrFocus;
+  m_clrHilite = clrHilite;
+}
+
+void CPropertyGridCombo::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+  if (bShow)
+  {
+    // get line height
+    CDC* pDC = GetDC();
+    int save = pDC->SaveDC();
+    pDC->SelectObject(m_pFont?m_pFont:GetFont());
+    m_line_height = pDC->GetTextExtent(_T("Gg")).cy + 2*margin;
+    pDC->RestoreDC(save);
+    ReleaseDC(pDC);
+
+    // size control
+    CRect rc;
+    GetWindowRect(&rc);
+    SetWindowPos(NULL, 0, 0, rc.Width(), int(m_Items.size())*m_line_height+2, SWP_NOOWNERZORDER|SWP_NOZORDER|SWP_NOMOVE);
+    SetFocus();
+  }
+
+  CWnd::OnShowWindow(bShow, nStatus);
+}
+
+void CPropertyGridCombo::OnDestroy()
+{
+  CWnd::OnDestroy();
+}
+
+void CPropertyGridCombo::OnKillFocus(CWnd* pNewWnd)
+{
+  CWnd::OnKillFocus(pNewWnd);
+  DestroyWindow();
+}
+
+//
+// painting
+//
+
+void CPropertyGridCombo::OnPaint()
+{
+  // check
+  if (m_nSelected<0) m_nSelected = 0;
+  if (m_nSelected>int(m_Items.size())-1) m_nSelected = int(m_Items.size())-1;
+
+  // client rect
+  CRect rc;
+  GetClientRect(&rc);
+
+  // brush
+  CBrush brush;
+  brush.CreateSolidBrush(m_clrBack);
+
+  // pen
+  CPen pen;
+  pen.CreatePen(PS_SOLID, 1, m_clrText);
+
+  // the dc
+  CPaintDC dc(this);
+  CBrush* pOldBrush = dc.SelectObject(&brush);
+  CPen* pOldPen = dc.SelectObject(&pen);
+  CFont* pOldFont = dc.SelectObject(m_pFont);
+
+  // draw
+  dc.SelectObject(&brush);
+  dc.SelectObject(&pen);
+  dc.Rectangle(rc);
+
+  // put items
+  int i = 0;
+  int y = 1;
+  dc.SelectObject(m_pFont);
+  dc.SetBkMode(TRANSPARENT);
+  for (std::vector<CString>::iterator it = m_Items.begin(); it != m_Items.end(); ++it)
+  {
+    CRect rcItem(0, y, rc.Width(), y+m_line_height);
+    rcItem.DeflateRect(1,0,1,0);
+
+    if (i == m_nSelected)
+    {
+      dc.DrawFocusRect(rcItem);
+      dc.SetTextColor(m_clrHilite);
+
+      CRect rc = rcItem;
+      rc.DeflateRect(1,1);
+      dc.FillSolidRect(rc, m_clrFocus);
+    }
+    else
+    {
+      dc.SetTextColor(m_clrText);
+    }
+
+    // do it
+    rcItem.left += 2*margin;
+    dc.DrawText(*it, rcItem, DT_SINGLELINE|DT_VCENTER|DT_LEFT|DT_NOPREFIX);
+    y += m_line_height;
+    i++;
+  }
+
+  // clean up
+  dc.SelectObject(pOldFont);
+  dc.SelectObject(pOldPen);
+  dc.SelectObject(pOldBrush);
+}
+
+//
+// mouse interaction
+//
+
+void CPropertyGridCombo::OnLButtonDown(UINT nFlags, CPoint point)
+{
+  m_nSelected = point.y/m_line_height;
+  m_bTracking = true;
+  SetCapture();
+  Invalidate();
+
+  CWnd::OnLButtonDown(nFlags, point);
+}
+
+void CPropertyGridCombo::OnMouseMove(UINT nFlags, CPoint point)
+{
+  if (m_bTracking)
+  {
+    m_nSelected = point.y/m_line_height;
+    Invalidate();
+  }
+  CWnd::OnMouseMove(nFlags, point);
+}
+
+void CPropertyGridCombo::OnLButtonUp(UINT nFlags, CPoint point)
+{
+  if (m_bTracking)
+  {
+    ReleaseCapture();
+    m_bTracking = false;
+    Invalidate();
+  }
+
+  GetOwner()->SendMessage(WM_PG_COMBOSELCHANGED, m_nSelected, 0);
+}
+
+//
+// keyboard interaction
+//
+
+UINT CPropertyGridCombo::OnGetDlgCode()
+{
+  return DLGC_WANTALLKEYS;
+}
+
+void CPropertyGridCombo::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+  if (nChar == VK_LEFT || nChar == VK_UP)
+  {
+    m_nSelected = max(0, m_nSelected-1);
+    Invalidate();
+  }
+  else if (nChar == VK_RIGHT || nChar == VK_DOWN)
+  {
+    m_nSelected = min(int(m_Items.size())-1, m_nSelected+1);
+    Invalidate();
+  }
+  else if (nChar == VK_ESCAPE)
+  {
+    DestroyWindow();
+    return;
+  }
+  else if (nChar == VK_RETURN || nChar == VK_EXECUTE)
+  {
+    GetOwner()->SendMessage(WM_PG_COMBOSELCHANGED, m_nSelected, 0);
+    return;
+  }
+
+  CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.h b/Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.h
new file mode 100644
index 0000000..52a29c9
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGridCombo.h
@@ -0,0 +1,52 @@
+#pragma once
+
+
+// CPropertyGridCombo
+#include <vector>
+#define WM_PG_COMBOSELCHANGED WM_USER+487
+
+class CPropertyGridCombo : public CWnd
+{
+	DECLARE_DYNAMIC(CPropertyGridCombo)
+
+public:
+	CPropertyGridCombo();
+	virtual ~CPropertyGridCombo();
+
+	BOOL Create(DWORD dwStyle, CRect& rc, CWnd* pParent, int nId);
+	void SetFont(CFont* pFont, BOOL bRedraw = TRUE);
+	void SetColors(COLORREF clrBack, COLORREF clrText, COLORREF clrFocus, COLORREF clrHilite);
+
+	void AddString(const CString& strItem);
+	void SetCurSel(int nItem);
+
+public:
+	afx_msg void OnPaint();
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnDestroy();
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg UINT OnGetDlgCode();
+
+protected:
+	DECLARE_MESSAGE_MAP()
+
+protected:
+	std::vector<CString> m_Items;
+	int m_nSelected;
+
+	CFont* m_pFont;
+	int m_line_height;
+
+	bool m_bTracking;
+
+	COLORREF m_clrBack;
+	COLORREF m_clrText;
+	COLORREF m_clrFocus;
+	COLORREF m_clrHilite;
+};
+
+
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.cpp b/Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.cpp
new file mode 100644
index 0000000..0510710
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.cpp
@@ -0,0 +1,81 @@
+#include "../StdAfx.h"
+#include "PropertyGridDirectoryPicker.h"
+
+// mch
+//#define BIF_NEWDIALOGSTYLE 0x0040
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+CString CPropertyGridDirectoryPicker::m_strTitle = _T("Choose a directory");
+
+CPropertyGridDirectoryPicker::CPropertyGridDirectoryPicker()
+{
+}
+
+CPropertyGridDirectoryPicker::~CPropertyGridDirectoryPicker()
+{
+}
+
+int CALLBACK CPropertyGridDirectoryPicker::BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
+{
+  switch(uMsg)
+  {
+    // If the dialog is being initialised
+  case BFFM_INITIALIZED:
+    {
+      // Send a SetSelection message on the passed directory
+      SendMessage(hwnd,BFFM_SETSELECTION,TRUE,pData);
+      break;
+    }
+  }
+  return 0;
+}
+
+bool CPropertyGridDirectoryPicker::PickDirectory(CString &directory, HWND hwnd)
+{
+  TCHAR pszBuffer[MAX_PATH];
+  pszBuffer[0] = '\0';
+
+  // Gets the Shell's default allocator
+  LPMALLOC pMalloc;
+  if (::SHGetMalloc(&pMalloc) == NOERROR)
+  {
+    BROWSEINFO bi;
+    LPITEMIDLIST pidl;
+
+    // Get help on BROWSEINFO struct
+    bi.hwndOwner = hwnd;
+    bi.pidlRoot = NULL;
+    bi.pszDisplayName = pszBuffer;
+    bi.lpszTitle = m_strTitle;
+    bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE ;
+
+    // The callback function initialises the dialog with the passed value
+    bi.lpfn = BrowseCallbackProc;
+    bi.lParam = LPARAM(&directory);
+
+    // This next call issues the dialog box.
+    if ((pidl = ::SHBrowseForFolder(&bi)) != NULL)
+    {
+      // Get the full path into pszBuffer
+      ::SHGetPathFromIDList(pidl, pszBuffer);
+      // Free the PIDL allocated by SHBrowseForFolder.
+      pMalloc->Free(pidl);
+    }
+    // Release the shell's allocator.
+    pMalloc->Release();
+  }
+
+  // get the result
+  if (_tcslen(pszBuffer) != 0)
+  {
+    directory = pszBuffer;
+    return TRUE;
+  }
+  return FALSE;
+}
+
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.h b/Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.h
new file mode 100644
index 0000000..cccced8
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGridDirectoryPicker.h
@@ -0,0 +1,15 @@
+#pragma once
+
+class CPropertyGridDirectoryPicker
+{
+public:
+  CPropertyGridDirectoryPicker();
+  virtual ~CPropertyGridDirectoryPicker();
+
+  static bool PickDirectory(CString&, HWND hwnd);
+  static CString m_strTitle;
+
+protected:
+  static int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData);
+};
+
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.cpp b/Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.cpp
new file mode 100644
index 0000000..771fdfa
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.cpp
@@ -0,0 +1,194 @@
+// PropertyGridInPlaceEdit.cpp : 备泅 颇老涝聪促.
+//
+
+#include "../stdafx.h"
+#include "PropertyGridInPlaceEdit.h"
+
+
+// CPropertyGridInPlaceEdit
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+IMPLEMENT_DYNAMIC(CPropertyGridInPlaceEdit, CEdit)
+
+CPropertyGridInPlaceEdit::CPropertyGridInPlaceEdit(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID, CString sInitText)
+{
+  m_sInitText     = sInitText;
+  m_bExitOnArrows = FALSE;
+  m_Rect = rect;  // For bizarre CE bug.
+
+  DWORD dwEditStyle = /*WS_BORDER|*/WS_CHILD|/*WS_VISIBLE|*/ES_AUTOHSCROLL|dwStyle;
+  if (!Create(dwEditStyle, rect, pParent, nID))
+    return;
+
+  m_clrBack = GetSysColor(COLOR_WINDOW);
+  m_clrText = GetSysColor(COLOR_WINDOWTEXT);
+  m_Brush.CreateSolidBrush(m_clrBack);
+
+  SetFont(pParent->GetFont());
+
+  SetWindowText(m_sInitText);
+  SetFocus();
+
+  SetSel(0, -1);
+  SetSel(-1, 0);
+}
+
+CPropertyGridInPlaceEdit::~CPropertyGridInPlaceEdit()
+{
+}
+
+void CPropertyGridInPlaceEdit::SetColors(COLORREF clrBack, COLORREF clrText)
+{
+  m_clrBack = clrBack;
+  m_clrText = clrText;
+  m_Brush.DeleteObject();
+  m_Brush.CreateSolidBrush(m_clrBack);
+}
+
+BEGIN_MESSAGE_MAP(CPropertyGridInPlaceEdit, CEdit)
+	//{{AFX_MSG_MAP(CPropertyGridInPlaceEdit)
+	ON_WM_KILLFOCUS()
+	ON_WM_CHAR()
+	ON_WM_KEYDOWN()
+	ON_WM_GETDLGCODE()
+	ON_WM_CREATE()
+	ON_WM_CTLCOLOR_REFLECT( )
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+
+// CPropertyGridInPlaceEdit 皋矫瘤 贸府扁涝聪促.
+
+
+void CPropertyGridInPlaceEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
+{
+  if ((nChar == VK_PRIOR || nChar == VK_NEXT ||
+    nChar == VK_DOWN  || nChar == VK_UP   ||
+    nChar == VK_RIGHT || nChar == VK_LEFT) &&
+    (m_bExitOnArrows || GetKeyState(VK_CONTROL) < 0))
+  {
+    GetParent()->SetFocus();
+    return;
+  }
+
+  CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+// As soon as this edit loses focus, kill it.
+void CPropertyGridInPlaceEdit::OnKillFocus(CWnd* pNewWnd)
+{
+  CEdit::OnKillFocus(pNewWnd);
+  EndEdit();
+}
+
+void CPropertyGridInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+  if (nChar == VK_TAB || nChar == VK_RETURN)
+  {
+    GetParent()->SetFocus();    // This will destroy this window
+    return;
+  }
+  if (nChar == VK_ESCAPE) 
+  {
+    CancelEdit();
+    return;
+  }
+
+  CEdit::OnChar(nChar, nRepCnt, nFlags);
+
+  //// Resize edit control if needed
+  //
+  //// Get text extent
+  //CString str;
+  //GetWindowText( str );
+
+  //// add some extra buffer
+  //str += _T("  ");
+  //
+  //CWindowDC dc(this);
+  //CFont *pFontDC = dc.SelectObject(GetFont());
+  //CSize size = dc.GetTextExtent( str );
+  //dc.SelectObject( pFontDC );
+  //   
+  //// Get client rect
+  //CRect ParentRect;
+  //GetParent()->GetClientRect( &ParentRect );
+  //
+  //// Check whether control needs to be resized
+  //// and whether there is space to grow
+  //if (size.cx > m_Rect.Width())
+  //{
+  //    if( size.cx + m_Rect.left < ParentRect.right )
+  //        m_Rect.right = m_Rect.left + size.cx;
+  //    else
+  //        m_Rect.right = ParentRect.right;
+  //    MoveWindow( &m_Rect );
+  //}
+}
+
+UINT CPropertyGridInPlaceEdit::OnGetDlgCode() 
+{
+  return DLGC_WANTALLKEYS;
+}
+
+////////////////////////////////////////////////////////////////////////////
+// CPropertyGridInPlaceEdit overrides
+
+// Stoopid win95 accelerator key problem workaround - Matt Weagle.
+BOOL CPropertyGridInPlaceEdit::PreTranslateMessage(MSG* pMsg) 
+{
+  // Catch the Alt key so we don't choke if focus is going to an owner drawn button
+  if (pMsg->message == WM_SYSCHAR)
+    return TRUE;
+  return CEdit::PreTranslateMessage(pMsg);
+}
+
+////////////////////////////////////////////////////////////////////////////
+// CPropertyGridInPlaceEdit implementation
+
+void CPropertyGridInPlaceEdit::CancelEdit()
+{
+  // restore previous text
+  if (IsWindow(GetSafeHwnd()))
+  {
+    SetWindowText(m_sInitText);
+    SendMessage(WM_CLOSE, 0, 0);
+  }
+}
+
+void CPropertyGridInPlaceEdit::EndEdit()
+{
+  CString str;
+
+  // EFW - BUG FIX - Clicking on a grid scroll bar in a derived class
+  // that validates input can cause this to get called multiple times
+  // causing assertions because the edit control goes away the first time.
+  static BOOL bAlreadyEnding = FALSE;
+
+  if(bAlreadyEnding)
+    return;
+
+  bAlreadyEnding = TRUE;
+  GetWindowText(str);
+
+  CWnd* pOwner = GetOwner();
+  if (pOwner)
+    pOwner->SendMessage(WM_PG_ENDLABELEDIT, (WPARAM) LPCTSTR(str), NULL );
+
+  // Close this window (PostNcDestroy will delete this)
+  if (IsWindow(GetSafeHwnd()))
+    SendMessage(WM_CLOSE, 0, 0);
+  bAlreadyEnding = FALSE;
+}
+
+HBRUSH CPropertyGridInPlaceEdit::CtlColor ( CDC* pDC, UINT nCtlColor )
+{
+  pDC->SetTextColor(m_clrText);
+  pDC->SetBkColor(m_clrBack);
+  return m_Brush;
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.h b/Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.h
new file mode 100644
index 0000000..7c8fc6f
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGridInPlaceEdit.h
@@ -0,0 +1,43 @@
+#pragma once
+
+
+// CPropertyGridInPlaceEdit
+#define WM_PG_ENDLABELEDIT WM_USER+488
+
+class CPropertyGridInPlaceEdit : public CEdit
+{
+	DECLARE_DYNAMIC(CPropertyGridInPlaceEdit)
+
+public:
+	CPropertyGridInPlaceEdit(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID, CString sInitText);
+	virtual ~CPropertyGridInPlaceEdit();
+	void SetColors(COLORREF clrBack, COLORREF clrText);
+
+public:
+	void CancelEdit();
+	void EndEdit();
+
+public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+protected:
+	//{{AFX_MSG(CPropertyGridInPlaceEdit)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg UINT OnGetDlgCode();
+	afx_msg HBRUSH CtlColor ( CDC* pDC, UINT nCtlColor );
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+
+private:
+	CString m_sInitText;
+	BOOL    m_bExitOnArrows;
+	CRect   m_Rect;
+
+	COLORREF m_clrBack;
+	COLORREF m_clrText;
+	CBrush  m_Brush;
+};
+
+
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.cpp b/Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.cpp
new file mode 100644
index 0000000..c33be5c
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.cpp
@@ -0,0 +1,78 @@
+// PropertyGridMonthCalCtrl.cpp : 备泅 颇老涝聪促.
+//
+
+#include "../stdafx.h"
+#include "PropertyGridMonthCalCtrl.h"
+
+
+// CPropertyGridMonthCalCtrl
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+IMPLEMENT_DYNAMIC(CPropertyGridMonthCalCtrl, CMonthCalCtrl)
+CPropertyGridMonthCalCtrl::CPropertyGridMonthCalCtrl()
+{
+}
+
+CPropertyGridMonthCalCtrl::~CPropertyGridMonthCalCtrl()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CPropertyGridMonthCalCtrl, CMonthCalCtrl)
+  ON_WM_KILLFOCUS()
+  ON_NOTIFY_REFLECT(MCN_SELECT, OnMcnSelect)
+  ON_WM_GETDLGCODE()
+  ON_WM_KEYDOWN()
+END_MESSAGE_MAP()
+
+
+
+// CPropertyGridMonthCalCtrl message handlers
+
+
+void CPropertyGridMonthCalCtrl::OnKillFocus(CWnd* pNewWnd)
+{
+  CMonthCalCtrl::OnKillFocus(pNewWnd);
+  CWnd* pParent = pNewWnd ? pNewWnd->GetParent() : NULL;
+  if (pParent != this)
+    DestroyWindow();
+}
+
+void CPropertyGridMonthCalCtrl::OnMcnSelect(NMHDR *pNMHDR, LRESULT *pResult)
+{
+  LPNMSELCHANGE pSelChange = reinterpret_cast<LPNMSELCHANGE>(pNMHDR);
+  GetOwner()->SendMessage(WM_PG_DATESELCHANGED);
+  *pResult = 0;
+}
+
+UINT CPropertyGridMonthCalCtrl::OnGetDlgCode()
+{
+  return DLGC_WANTALLKEYS;
+}
+
+void CPropertyGridMonthCalCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+  if (nChar == VK_ESCAPE)
+  {
+    DestroyWindow();
+    return;
+  }
+  else if (nChar == VK_RETURN || nChar == VK_EXECUTE)
+  {
+    GetOwner()->SendMessage(WM_PG_DATESELCHANGED);
+    return;
+  }
+
+  CMonthCalCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
+}
+
+
+
+
+// CPropertyGridMonthCalCtrl 皋矫瘤 贸府扁涝聪促.
+
+
diff --git a/Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.h b/Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.h
new file mode 100644
index 0000000..1d61a40
--- /dev/null
+++ b/Common_Class/SISControls/PropertyGridControl/PropertyGridMonthCalCtrl.h
@@ -0,0 +1,25 @@
+#pragma once
+
+
+// CPropertyGridMonthCalCtrl
+#define WM_PG_DATESELCHANGED WM_USER+489
+
+class CPropertyGridMonthCalCtrl : public CMonthCalCtrl
+{
+	DECLARE_DYNAMIC(CPropertyGridMonthCalCtrl)
+
+public:
+	CPropertyGridMonthCalCtrl();
+	virtual ~CPropertyGridMonthCalCtrl();
+
+protected:
+	DECLARE_MESSAGE_MAP()
+
+public:
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnMcnSelect(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg UINT OnGetDlgCode();
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+};
+
+
diff --git a/Common_Class/SISControls/ReadMe.txt b/Common_Class/SISControls/ReadMe.txt
new file mode 100644
index 0000000..3e5f011
--- /dev/null
+++ b/Common_Class/SISControls/ReadMe.txt
@@ -0,0 +1,63 @@
+========================================================================
+       MICROSOFT FOUNDATION CLASS LIBRARY : SISControls
+========================================================================
+
+
+AppWizard has created this SISControls DLL for you.  This DLL not only
+demonstrates the basics of using the Microsoft Foundation classes but
+is also a starting point for writing your DLL.
+
+This file contains a summary of what you will find in each of the files that
+make up your SISControls DLL.
+
+SISControls.dsp
+    This file (the project file) contains information at the project level and
+    is used to build a single project or subproject. Other users can share the
+    project (.dsp) file, but they should export the makefiles locally.
+
+SISControls.cpp
+    This is the main DLL source file that contains the definition of
+	DllMain().
+
+
+SISControls.rc
+    This is a listing of all of the Microsoft Windows resources that the
+    program uses.  It includes the icons, bitmaps, and cursors that are stored
+    in the RES subdirectory.  This file can be directly edited in Microsoft
+	Visual C++.
+
+SISControls.clw
+    This file contains information used by ClassWizard to edit existing
+    classes or add new classes.  ClassWizard also uses this file to store
+    information needed to create and edit message maps and dialog data
+    maps and to create prototype member functions.
+
+res\SISControls.rc2
+    This file contains resources that are not edited by Microsoft 
+	Visual C++.  You should place all resources not editable by
+	the resource editor in this file.
+
+SISControls.def
+    This file contains information about the DLL that must be
+    provided to run with Microsoft Windows.  It defines parameters
+    such as the name and description of the DLL.  It also exports
+	functions from the DLL.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named SISControls.pch and a precompiled types file named StdAfx.obj.
+
+Resource.h
+    This is the standard header file, which defines new resource IDs.
+    Microsoft Visual C++ reads and updates this file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/SISControls/Resource.h b/Common_Class/SISControls/Resource.h
new file mode 100644
index 0000000..0190caf
--- /dev/null
+++ b/Common_Class/SISControls/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by SISControls.RC
+//
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	7000
+#define _APS_NEXT_CONTROL_VALUE		7000
+#define _APS_NEXT_SYMED_VALUE		7000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/SISControls/SISButton.cpp b/Common_Class/SISControls/SISButton.cpp
new file mode 100644
index 0000000..460fcc4
--- /dev/null
+++ b/Common_Class/SISControls/SISButton.cpp
@@ -0,0 +1,268 @@
+// SISButton.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "SISButton.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISButton
+
+CSISButton::CSISButton()
+{
+	m_bSIS = FALSE;
+	m_bTracking = FALSE;
+
+	::GetObject((HFONT)GetStockObject(DEFAULT_GUI_FONT),sizeof(m_lf),&m_lf);
+	m_Font.CreateFontIndirect(&m_lf);
+
+	m_RGBTextNormal = RGB(10, 10, 10);
+	m_RGBTextDisable = RGB(80, 80, 80);
+}
+
+CSISButton::~CSISButton()
+{
+	m_Font.DeleteObject();
+}
+IMPLEMENT_DYNAMIC(CSISButton, CBitmapButton)
+
+BEGIN_MESSAGE_MAP(CSISButton, CBitmapButton)
+	//{{AFX_MSG_MAP(CSISButton)
+	ON_WM_MOUSEMOVE()
+	ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave)
+	ON_MESSAGE(WM_MOUSEHOVER, OnMouseHOver)
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////
+//	CSISButton message handlers
+
+void CSISButton::OnMouseMove(UINT nFlags, CPoint point) 
+{
+	//	TODO: Add your message handler code here and/or call default
+
+	if (!m_bTracking)
+	{
+		TRACKMOUSEEVENT tme;
+		tme.cbSize = sizeof(tme);
+		tme.hwndTrack = m_hWnd;
+		tme.dwFlags = TME_LEAVE|TME_HOVER;
+		tme.dwHoverTime = 1;
+		m_bTracking = _TrackMouseEvent(&tme);
+	}
+	CBitmapButton::OnMouseMove(nFlags, point);
+}
+
+BOOL CSISButton::PreTranslateMessage(MSG* pMsg) 
+{
+	// TODO: Add your specialized code here and/or call the base class
+	InitToolTip();
+	m_ToolTip.RelayEvent(pMsg);		
+	return CButton::PreTranslateMessage(pMsg);
+}
+
+// Set the tooltip with a string resource
+void CSISButton::SetToolTipText(int nId, BOOL bActivate)
+{
+	CString sText;
+
+	// load string resource
+	sText.LoadString(nId);
+	// If string resource is not empty
+	if (sText.IsEmpty() == FALSE) SetToolTipText(&sText, bActivate);
+
+}
+
+// Set the tooltip with a CString
+void CSISButton::SetToolTipText(CString *spText, BOOL bActivate)
+{
+	// We cannot accept NULL pointer
+	if (spText == NULL) return;
+
+	// Initialize ToolTip
+	InitToolTip();
+
+	// If there is no tooltip defined then add it
+	if (m_ToolTip.GetToolCount() == 0)
+	{
+		CRect rectBtn; 
+		GetClientRect(rectBtn);
+		m_ToolTip.AddTool(this, (LPCTSTR)*spText, rectBtn, 1);
+	}
+
+	// Set text for tooltip
+	m_ToolTip.UpdateTipText((LPCTSTR)*spText, this, 1);
+	m_ToolTip.Activate(bActivate);
+}
+
+void CSISButton::InitToolTip()
+{
+	if (m_ToolTip.m_hWnd == NULL)
+	{
+		// Create ToolTip control
+		m_ToolTip.Create(this);
+		// Create inactive
+		m_ToolTip.Activate(FALSE);
+	}
+} // End of InitToolTip
+
+// Activate the tooltip
+void CSISButton::ActivateTooltip(BOOL bActivate)
+{
+	// If there is no tooltip then do nothing
+	if (m_ToolTip.GetToolCount() == 0) return;
+
+	// Activate tooltip
+	m_ToolTip.Activate(bActivate);
+} // End of EnableTooltip
+
+void CSISButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
+{
+	// TODO: Add your code to draw the specified item
+
+	CDC *mydc=CDC::FromHandle(lpDrawItemStruct->hDC);
+
+	CDC * pMemDC = new CDC;
+	pMemDC -> CreateCompatibleDC(mydc);
+
+	CBitmap * pOldBitmap;
+	pOldBitmap = pMemDC -> SelectObject(&m_Bitmap);
+	
+	CPoint point(0,0);	
+		
+	if(lpDrawItemStruct->itemState & ODS_SELECTED)	// Click
+	{
+		m_bIsDisable = FALSE;
+		mydc->BitBlt(0,0,m_ButtonSize.cx,m_ButtonSize.cy,pMemDC,0,m_ButtonSize.cy * 2,SRCCOPY);
+	}
+	else if (lpDrawItemStruct->itemState & ODS_DISABLED && m_uiImageCount > 3)	// 捞固瘤啊 匙 俺 捞惑捞搁 匙 锅掳啊 Disable
+	{
+		m_bIsDisable = TRUE;
+		mydc->BitBlt(0,0,m_ButtonSize.cx,m_ButtonSize.cy,pMemDC,0,m_ButtonSize.cy * 3,SRCCOPY);
+	}
+	else
+	{
+		m_bIsDisable = FALSE;
+		if(m_bSIS)	// OverMouse
+		{
+			mydc->BitBlt(0,0,m_ButtonSize.cx,m_ButtonSize.cy,pMemDC,0,m_ButtonSize.cy,SRCCOPY);
+		}
+		else	// 老馆
+		{
+			mydc->BitBlt(0,0,m_ButtonSize.cx,m_ButtonSize.cy,pMemDC,0,0,SRCCOPY);
+		}	
+	}
+	fPaint(mydc);
+
+	// clean up
+	pMemDC -> SelectObject(pOldBitmap);
+	delete pMemDC;
+	pMemDC = NULL;
+}
+
+// Load a bitmap from the resources in the button, the bitmap has to have 3 buttonsstates next to each other: Up/Down/SIS
+BOOL CSISButton::LoadBitmap(UINT bitmapid, UINT uiImageCount)
+{
+	m_uiImageCount = uiImageCount;
+
+	m_Bitmap.Detach();
+	m_Bitmap.Attach(::LoadImage(AfxGetResourceHandle(),MAKEINTRESOURCE(bitmapid), IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS));
+	BITMAP	bitmapbits;
+	m_Bitmap.GetBitmap(&bitmapbits);
+	m_ButtonSize.cy = bitmapbits.bmHeight / uiImageCount;
+	m_ButtonSize.cx = bitmapbits.bmWidth;
+
+	SetWindowPos(NULL, 0, 0, m_ButtonSize.cx, m_ButtonSize.cy, SWP_NOMOVE | SWP_NOOWNERZORDER);
+
+	return TRUE;
+}
+
+LRESULT CSISButton::OnMouseHOver(WPARAM wparam, LPARAM lparam) 
+{
+	// TODO: Add your message handler code here and/or call default
+	m_bSIS=TRUE;
+	Invalidate();
+	return 0;
+}
+
+LRESULT CSISButton::OnMouseLeave(WPARAM wparam, LPARAM lparam)
+{
+	m_bTracking = FALSE;
+	m_bSIS=FALSE;
+	Invalidate();
+	return 0;
+}
+
+void CSISButton::SetWindowText(CString strText) 
+{
+	m_strText = strText;
+	Invalidate();
+}
+
+void CSISButton::fPaint(CDC* pDC)
+{
+	if(m_strText.GetLength())
+	{
+		if (!m_bIsDisable)
+			pDC->SetTextColor(m_RGBTextNormal);
+		else
+			pDC->SetTextColor(m_RGBTextDisable);
+
+		RECT Rect;
+		GetClientRect(&Rect);
+		pDC->SetBkMode(TRANSPARENT);
+		pDC->SelectObject(m_Font);
+	    pDC->DrawText(m_strText,&Rect,DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+	}
+}
+
+void CSISButton::SetFontSize(int nSize)
+{
+	m_lf.lfHeight = nSize;
+	
+	m_Font.DeleteObject();
+	
+	BOOL bCreated = m_Font.CreateFontIndirect(&m_lf);
+
+	Invalidate();
+}
+
+void CSISButton::SetTextColor(COLORREF rgbNormal, COLORREF rgbDisable)
+{
+	m_RGBTextNormal = rgbNormal;
+	m_RGBTextDisable = rgbDisable;
+}
+
+void CSISButton::SetSISButtonStyle(UINT uID, int nImgCount)
+{
+	LoadBitmap(uID, 4);
+	Invalidate();
+}
+
+void CSISButton::SetSISButtonStyle(UINT uID, int nImgCount, CString spTipText)
+{
+	LoadBitmap(uID, 4);
+
+	if (!spTipText.IsEmpty())
+		SetToolTipText(&spTipText);
+	Invalidate();
+}
+
+void CSISButton::SetSISButtonStyle(UINT uID, int nImgCount, CString spTipText, CString spBtnText, int nFontSize)
+{
+	LoadBitmap(uID, 4);
+
+	if (!spTipText.IsEmpty())
+		SetToolTipText(&spTipText);
+	if (nFontSize > 0 && !spBtnText.IsEmpty())
+	{
+		SetFontSize(nFontSize);
+		SetWindowText(spBtnText);
+	}
+	Invalidate();
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/SISControls.cpp b/Common_Class/SISControls/SISControls.cpp
new file mode 100644
index 0000000..205784d
--- /dev/null
+++ b/Common_Class/SISControls/SISControls.cpp
@@ -0,0 +1,51 @@
+// SISControls.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include <afxdllx.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+static AFX_EXTENSION_MODULE SISControlsDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+	// Remove this if you use lpReserved
+	UNREFERENCED_PARAMETER(lpReserved);
+
+	if (dwReason == DLL_PROCESS_ATTACH)
+	{
+		TRACE0("SISCONTROLS.DLL Initializing!\n");
+		
+		// Extension DLL one-time initialization
+		if (!AfxInitExtensionModule(SISControlsDLL, hInstance))
+			return 0;
+
+		// Insert this DLL into the resource chain
+		// NOTE: If this Extension DLL is being implicitly linked to by
+		//  an MFC Regular DLL (such as an ActiveX Control)
+		//  instead of an MFC application, then you will want to
+		//  remove this line from DllMain and put it in a separate
+		//  function exported from this Extension DLL.  The Regular DLL
+		//  that uses this Extension DLL should then explicitly call that
+		//  function to initialize this Extension DLL.  Otherwise,
+		//  the CDynLinkLibrary object will not be attached to the
+		//  Regular DLL's resource chain, and serious problems will
+		//  result.
+
+		new CDynLinkLibrary(SISControlsDLL);
+	}
+	else if (dwReason == DLL_PROCESS_DETACH)
+	{
+		TRACE0("SISCONTROLS.DLL Terminating!\n");
+		// Terminate the library before destructors are called
+		AfxTermExtensionModule(SISControlsDLL);
+	}
+	return 1;   // ok
+}
diff --git a/Common_Class/SISControls/SISControls.def b/Common_Class/SISControls/SISControls.def
new file mode 100644
index 0000000..8038916
--- /dev/null
+++ b/Common_Class/SISControls/SISControls.def
@@ -0,0 +1,7 @@
+; SISControls.def : Declares the module parameters for the DLL.
+
+LIBRARY      "SISControls"
+DESCRIPTION  'SISControls Windows Dynamic Link Library'
+
+EXPORTS
+    ; Explicit exports can go here
diff --git a/Common_Class/SISControls/SISControls.dsp b/Common_Class/SISControls/SISControls.dsp
new file mode 100644
index 0000000..7fb3854
--- /dev/null
+++ b/Common_Class/SISControls/SISControls.dsp
@@ -0,0 +1,315 @@
+# Microsoft Developer Studio Project File - Name="SISControls" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=SISControls - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "SISControls.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "SISControls.mak" CFG="SISControls - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "SISControls - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "SISControls - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "SISControls - Win32 Release"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "../Release"
+# PROP Intermediate_Dir "../../Release/SISControls"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x412 /d "NDEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x412 /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 /nologo /subsystem:windows /dll /machine:I386
+
+!ELSEIF  "$(CFG)" == "SISControls - Win32 Debug"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "../Debug"
+# PROP Intermediate_Dir "../Debug/SISControls"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x412 /d "_DEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x412 /d "_DEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"../Debug"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "SISControls - Win32 Release"
+# Name "SISControls - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\CellCtrl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ColorButton.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\EditGrid.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\EditWnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\font.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\HeadCtrl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISButton.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISControls.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISControls.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISControls.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISFolderScheduling.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISJogButton.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISLabel.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISListBoxLog.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISListCtrlExt.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\InPlaceComboBox.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\InPlaceEdit.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\LogCtrl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\msflexgrid.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\picture.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\rowcursor.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SortClass.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StaticMap.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\WKButton.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\XTabCtrl.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;SIS;inl"
+# Begin Source File
+
+SOURCE=.\CellCtrl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ColorButton.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\EditGrid.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\EditWnd.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\font.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\HeadCtrl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISButton.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISFolderScheduling.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISJogBtn2Parent.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISJogButton.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISLabel.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISListBoxLog.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SISListCtrlExt.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\InPlaceComboBox.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\InPlaceEdit.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\LogCtrl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\msflexgrid.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\picture.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\rowcursor.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\SortClass.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StaticMap.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\WKButton.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\XTabCtrl.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\res\SISControls.rc2
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/Common_Class/SISControls/SISControls.dsw b/Common_Class/SISControls/SISControls.dsw
new file mode 100644
index 0000000..44733f0
--- /dev/null
+++ b/Common_Class/SISControls/SISControls.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "SISControls"=.\SISControls.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Common_Class/SISControls/SISControls.rc b/Common_Class/SISControls/SISControls.rc
new file mode 100644
index 0000000..faf1379
--- /dev/null
+++ b/Common_Class/SISControls/SISControls.rc
@@ -0,0 +1,133 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Korean resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+#ifdef _WIN32
+LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
+#pragma code_page(949)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
+    "#ifdef _WIN32\r\n"
+    "LANGUAGE 18, 1\r\n"
+    "#pragma code_page(949)\r\n"
+    "#endif //_WIN32\r\n"
+    "#include ""res\\SISControls.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
+    "#include ""l.kor\\afxres.rc""          // Standard components\r\n"
+    "#endif\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,8,2,0
+ PRODUCTVERSION 1,8,2,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "041204b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "\0"
+            VALUE "FileDescription", "SISControls DLL\0"
+            VALUE "FileVersion", "1, 8, 2, 0\0"
+            VALUE "InternalName", "SISControls\0"
+            VALUE "LegalCopyright", "Copyright (C) 2006\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "SISControls.DLL\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "SISControls 悼利 楷搬 扼捞宏矾府\0"
+            VALUE "ProductVersion", "1, 8, 2, 0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x412, 1200
+    END
+END
+
+#endif    // !_MAC
+
+#endif    // Korean resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+#ifdef _WIN32
+LANGUAGE 18, 1
+#pragma code_page(949)
+#endif //_WIN32
+#include "res\SISControls.rc2"  // non-Microsoft Visual C++ edited resources
+#include "l.kor\afxres.rc"          // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/Common_Class/SISControls/SISControls.sln b/Common_Class/SISControls/SISControls.sln
new file mode 100644
index 0000000..6b0d341
--- /dev/null
+++ b/Common_Class/SISControls/SISControls.sln
@@ -0,0 +1,26 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SISControls", "SISControls.vcxproj", "{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Debug|Win32.Build.0 = Debug|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Debug|x64.ActiveCfg = Debug|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Debug|x64.Build.0 = Debug|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Release|Win32.ActiveCfg = Release|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Release|Win32.Build.0 = Release|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Release|x64.ActiveCfg = Release|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/Common_Class/SISControls/SISControls.vcxproj b/Common_Class/SISControls/SISControls.vcxproj
new file mode 100644
index 0000000..e5b5ff4
--- /dev/null
+++ b/Common_Class/SISControls/SISControls.vcxproj
@@ -0,0 +1,672 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Simulation|Win32">
+      <Configuration>Simulation</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Simulation|x64">
+      <Configuration>Simulation</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}</ProjectGuid>
+    <RootNamespace>SISControls</RootNamespace>
+    <Keyword>MFCProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">.\../Debug\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">.\../Debug/SISControls\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\../Release\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\../../Release/SISControls\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)D</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">$(ProjectName)D</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)D</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\../Debug/SISControls.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeaderOutputFile>.\../Debug/SISControls/SISControls.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\../Debug/SISControls/</AssemblerListingLocation>
+      <ObjectFileName>.\../Debug/SISControls/</ObjectFileName>
+      <ProgramDataBaseFileName>.\../Debug/SISControls/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+      <AdditionalIncludeDirectories>.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>.\../Debug/SISControls.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>../Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ModuleDefinitionFile>.\SISControls.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\../Debug/SISControls.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>.\../Debug/SISControls.lib</ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\../Debug/SISControls.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\../Debug/SISControls.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeaderOutputFile>.\../Debug/SISControls/SISControls.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\../Debug/SISControls/</AssemblerListingLocation>
+      <ObjectFileName>.\../Debug/SISControls/</ObjectFileName>
+      <ProgramDataBaseFileName>.\../Debug/SISControls/</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>.\../Debug/SISControls.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>../Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <ModuleDefinitionFile>.\SISControls.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\../Debug/SISControls.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>.\../Debug/SISControls.lib</ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\../Debug/SISControls.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\../Debug/SISControls.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+      <ObjectFileName>$(IntDir)</ObjectFileName>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)\$(ProjectName)D.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>
+      </AdditionalLibraryDirectories>
+      <ModuleDefinitionFile>.\SISControlsD.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName)D.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>
+      </ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>
+      </OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\../Debug/SISControls.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+      <ObjectFileName>$(IntDir)</ObjectFileName>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <BrowseInformation>true</BrowseInformation>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)\$(ProjectName)D.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>
+      </AdditionalLibraryDirectories>
+      <ModuleDefinitionFile>.\SISControlsD.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName)D.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>..\Library\CommonLibs\$(TargetName).lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>
+      </OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>Win32</TargetEnvironment>
+      <TypeLibraryName>.\../Release/SISControls.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeaderOutputFile>.\../../Release/SISControls/SISControls.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\../../Release/SISControls/</AssemblerListingLocation>
+      <ObjectFileName>.\../../Release/SISControls/</ObjectFileName>
+      <ProgramDataBaseFileName>.\../../Release/SISControls/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>.\../Release/SISControls.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <ModuleDefinitionFile>.\SISControls.def</ModuleDefinitionFile>
+      <ProgramDatabaseFile>.\../Release/SISControls.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>.\../Release/SISControls.lib</ImportLibrary>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\../Release/SISControls.bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetEnvironment>X64</TargetEnvironment>
+      <TypeLibraryName>.\../Release/SISControls.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>.\Header;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+      <ObjectFileName>$(IntDir)</ObjectFileName>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)\$(ProjectName).dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <AdditionalLibraryDirectories>
+      </AdditionalLibraryDirectories>
+      <ModuleDefinitionFile>.\SISControls.def</ModuleDefinitionFile>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>
+      </ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\../Release/SISControls.bsc</OutputFile>
+    </Bscmake>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\SISControls\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\SISControls\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\*.*" "$(SolutionDir)Lib\SISControls\include\*.*"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\CellRange.h" "$(SolutionDir)Lib\SISControls\GridControl\CellRange.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\GridCell.h" "$(SolutionDir)Lib\SISControls\GridControl\GridCell.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\GridCellBase.h" "$(SolutionDir)Lib\SISControls\GridControl\GridCellBase.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\GridCellButton.h" "$(SolutionDir)Lib\SISControls\GridControl\GridCellButton.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\GridCtrl.h" "$(SolutionDir)Lib\SISControls\GridControl\GridCtrl.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\GridDropTarget.h" "$(SolutionDir)Lib\SISControls\GridControl\GridDropTarget.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\GridInPlaceEdit.h" "$(SolutionDir)Lib\SISControls\GridControl\GridInPlaceEdit.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\GridMemDC.h" "$(SolutionDir)Lib\SISControls\GridControl\GridMemDC.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\TitleTip.h" "$(SolutionDir)Lib\SISControls\GridControl\TitleTip.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\NewCellTypes\GridCellCheck.h" "$(SolutionDir)Lib\SISControls\GridControl\NewCellTypes\GridCellCheck.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\NewCellTypes\GridCellCombo.h" "$(SolutionDir)Lib\SISControls\GridControl\NewCellTypes\GridCellCombo.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\NewCellTypes\GridCellDateTime.h" "$(SolutionDir)Lib\SISControls\GridControl\NewCellTypes\GridCellDateTime.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\NewCellTypes\GridCellNumeric.h" "$(SolutionDir)Lib\SISControls\GridControl\NewCellTypes\GridCellNumeric.h"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\GridControl\NewCellTypes\GridURLCell.h" "$(SolutionDir)Lib\SISControls\GridControl\NewCellTypes\GridURLCell.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="CellCtrl.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="ColorButton.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="DefectMap.cpp" />
+    <ClCompile Include="GradientStatic.cpp" />
+    <ClCompile Include="GridControl\GridCellButton.cpp" />
+    <ClCompile Include="HeadCtrl.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="SISButton.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="SISControls.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="SISFolderScheduling.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="SISJogButton.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="SISLabel.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="SISListBoxLog.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="SISListCtrlExt.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="InPlaceComboBox.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="InPlaceEdit.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="LogCtrl.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="PropertyGridControl\DynDialogEx.cpp" />
+    <ClCompile Include="PropertyGridControl\DynDialogItemEx.cpp" />
+    <ClCompile Include="PropertyGridControl\PropertyGrid.cpp" />
+    <ClCompile Include="PropertyGridControl\PropertyGridCombo.cpp" />
+    <ClCompile Include="PropertyGridControl\PropertyGridDirectoryPicker.cpp" />
+    <ClCompile Include="PropertyGridControl\PropertyGridInPlaceEdit.cpp" />
+    <ClCompile Include="PropertyGridControl\PropertyGridMonthCalCtrl.cpp" />
+    <ClCompile Include="SortClass.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="StaticMap.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="StdAfx.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="WKButton.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="XTabCtrl.cpp">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <ClCompile Include="GridControl\GridCell.cpp" />
+    <ClCompile Include="GridControl\GridCellBase.cpp" />
+    <ClCompile Include="GridControl\GridCtrl.cpp" />
+    <ClCompile Include="GridControl\GridDropTarget.cpp" />
+    <ClCompile Include="GridControl\GridInPlaceEdit.cpp" />
+    <ClCompile Include="GridControl\TitleTip.cpp" />
+    <ClCompile Include="GridControl\NewCellTypes\GridCellCheck.cpp" />
+    <ClCompile Include="GridControl\NewCellTypes\GridCellCombo.cpp" />
+    <ClCompile Include="GridControl\NewCellTypes\GridCellDateTime.cpp" />
+    <ClCompile Include="GridControl\NewCellTypes\GridCellNumeric.cpp" />
+    <ClCompile Include="GridControl\NewCellTypes\GridURLCell.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\SISControls.rc2" />
+    <None Include="ReadMe.txt" />
+    <None Include="SISControls.def" />
+    <None Include="SISControlsD.def" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="SISControls.rc">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Simulation|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="GridControl\GridCellButton.h" />
+    <ClInclude Include="Header\CellCtrl.h" />
+    <ClInclude Include="Header\ColorButton.h" />
+    <ClInclude Include="Header\DefectMap.h" />
+    <ClInclude Include="Header\GradientStatic.h" />
+    <ClInclude Include="Header\HeadCtrl.h" />
+    <ClInclude Include="Header\SISButton.h" />
+    <ClInclude Include="Header\SISFolderScheduling.h" />
+    <ClInclude Include="Header\SISJogBtn2Parent.h" />
+    <ClInclude Include="Header\SISJogButton.h" />
+    <ClInclude Include="Header\SISLabel.h" />
+    <ClInclude Include="Header\SISListBoxLog.h" />
+    <ClInclude Include="Header\SISListCtrlExt.h" />
+    <ClInclude Include="Header\InPlaceComboBox.h" />
+    <ClInclude Include="Header\InPlaceEdit.h" />
+    <ClInclude Include="Header\LogCtrl.h" />
+    <ClInclude Include="PropertyGridControl\CustomItem.h" />
+    <ClInclude Include="PropertyGridControl\DynDialogEx.h" />
+    <ClInclude Include="PropertyGridControl\DynDialogItemEx.h" />
+    <ClInclude Include="PropertyGridControl\PropertyGrid.h" />
+    <ClInclude Include="PropertyGridControl\PropertyGridCombo.h" />
+    <ClInclude Include="PropertyGridControl\PropertyGridDirectoryPicker.h" />
+    <ClInclude Include="PropertyGridControl\PropertyGridInPlaceEdit.h" />
+    <ClInclude Include="PropertyGridControl\PropertyGridMonthCalCtrl.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="Header\SortClass.h" />
+    <ClInclude Include="Header\StaticMap.h" />
+    <ClInclude Include="StdAfx.h" />
+    <ClInclude Include="Header\WKButton.h" />
+    <ClInclude Include="Header\XTabCtrl.h" />
+    <ClInclude Include="GridControl\CellRange.h" />
+    <ClInclude Include="GridControl\GridCell.h" />
+    <ClInclude Include="GridControl\GridCellBase.h" />
+    <ClInclude Include="GridControl\GridCtrl.h" />
+    <ClInclude Include="GridControl\GridDropTarget.h" />
+    <ClInclude Include="GridControl\GridInPlaceEdit.h" />
+    <ClInclude Include="GridControl\MemDC.h" />
+    <ClInclude Include="GridControl\TitleTip.h" />
+    <ClInclude Include="GridControl\NewCellTypes\GridCellCheck.h" />
+    <ClInclude Include="GridControl\NewCellTypes\GridCellCombo.h" />
+    <ClInclude Include="GridControl\NewCellTypes\GridCellDateTime.h" />
+    <ClInclude Include="GridControl\NewCellTypes\GridCellNumeric.h" />
+    <ClInclude Include="GridControl\NewCellTypes\GridURLCell.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/SISControls/SISControls.vcxproj.filters b/Common_Class/SISControls/SISControls.vcxproj.filters
new file mode 100644
index 0000000..fd2c8de
--- /dev/null
+++ b/Common_Class/SISControls/SISControls.vcxproj.filters
@@ -0,0 +1,293 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="GridControl">
+      <UniqueIdentifier>{10e116e2-603c-46a9-874f-e63454e39f46}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="GridControl\CellType">
+      <UniqueIdentifier>{f3eb59ef-e9a1-4337-bddc-5044582b37d6}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="PropertyGridControl">
+      <UniqueIdentifier>{b0e41ab5-c110-4308-97f5-df20b157196f}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{b362bd37-1034-48c0-96d4-67871e17736d}</UniqueIdentifier>
+      <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{ffb7cc95-4222-4b15-8395-4c5c54a4abdf}</UniqueIdentifier>
+      <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{958c06f3-53ab-47d8-89f8-2c075f141ba9}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;SIS;inl</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="CellCtrl.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ColorButton.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="HeadCtrl.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISButton.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISControls.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISFolderScheduling.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISJogButton.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISLabel.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISListBoxLog.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SISListCtrlExt.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="InPlaceComboBox.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="InPlaceEdit.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="LogCtrl.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SortClass.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="StaticMap.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="StdAfx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="WKButton.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="XTabCtrl.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\GridCell.cpp">
+      <Filter>GridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\GridCellBase.cpp">
+      <Filter>GridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\GridCtrl.cpp">
+      <Filter>GridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\GridDropTarget.cpp">
+      <Filter>GridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\GridInPlaceEdit.cpp">
+      <Filter>GridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\TitleTip.cpp">
+      <Filter>GridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\NewCellTypes\GridCellCheck.cpp">
+      <Filter>GridControl\CellType</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\NewCellTypes\GridCellCombo.cpp">
+      <Filter>GridControl\CellType</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\NewCellTypes\GridCellDateTime.cpp">
+      <Filter>GridControl\CellType</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\NewCellTypes\GridCellNumeric.cpp">
+      <Filter>GridControl\CellType</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\NewCellTypes\GridURLCell.cpp">
+      <Filter>GridControl\CellType</Filter>
+    </ClCompile>
+    <ClCompile Include="DefectMap.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="GradientStatic.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="GridControl\GridCellButton.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="PropertyGridControl\DynDialogEx.cpp">
+      <Filter>PropertyGridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="PropertyGridControl\DynDialogItemEx.cpp">
+      <Filter>PropertyGridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="PropertyGridControl\PropertyGrid.cpp">
+      <Filter>PropertyGridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="PropertyGridControl\PropertyGridCombo.cpp">
+      <Filter>PropertyGridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="PropertyGridControl\PropertyGridDirectoryPicker.cpp">
+      <Filter>PropertyGridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="PropertyGridControl\PropertyGridInPlaceEdit.cpp">
+      <Filter>PropertyGridControl</Filter>
+    </ClCompile>
+    <ClCompile Include="PropertyGridControl\PropertyGridMonthCalCtrl.cpp">
+      <Filter>PropertyGridControl</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\SISControls.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="ReadMe.txt" />
+    <None Include="SISControls.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="SISControlsD.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="SISControls.rc">
+      <Filter>婧愭枃浠�</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\CellCtrl.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\ColorButton.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\HeadCtrl.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISButton.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISFolderScheduling.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISJogBtn2Parent.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISJogButton.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISLabel.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISListBoxLog.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SISListCtrlExt.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\InPlaceComboBox.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\InPlaceEdit.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\LogCtrl.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\SortClass.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\StaticMap.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="StdAfx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\WKButton.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\XTabCtrl.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\CellRange.h">
+      <Filter>GridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\GridCell.h">
+      <Filter>GridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\GridCellBase.h">
+      <Filter>GridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\GridCtrl.h">
+      <Filter>GridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\GridDropTarget.h">
+      <Filter>GridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\GridInPlaceEdit.h">
+      <Filter>GridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\MemDC.h">
+      <Filter>GridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\TitleTip.h">
+      <Filter>GridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\NewCellTypes\GridCellCheck.h">
+      <Filter>GridControl\CellType</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\NewCellTypes\GridCellCombo.h">
+      <Filter>GridControl\CellType</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\NewCellTypes\GridCellDateTime.h">
+      <Filter>GridControl\CellType</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\NewCellTypes\GridCellNumeric.h">
+      <Filter>GridControl\CellType</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\NewCellTypes\GridURLCell.h">
+      <Filter>GridControl\CellType</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\DefectMap.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\GradientStatic.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="GridControl\GridCellButton.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="PropertyGridControl\CustomItem.h">
+      <Filter>PropertyGridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="PropertyGridControl\DynDialogEx.h">
+      <Filter>PropertyGridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="PropertyGridControl\DynDialogItemEx.h">
+      <Filter>PropertyGridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="PropertyGridControl\PropertyGrid.h">
+      <Filter>PropertyGridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="PropertyGridControl\PropertyGridCombo.h">
+      <Filter>PropertyGridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="PropertyGridControl\PropertyGridDirectoryPicker.h">
+      <Filter>PropertyGridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="PropertyGridControl\PropertyGridInPlaceEdit.h">
+      <Filter>PropertyGridControl</Filter>
+    </ClInclude>
+    <ClInclude Include="PropertyGridControl\PropertyGridMonthCalCtrl.h">
+      <Filter>PropertyGridControl</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/SISControls/SISControlsD.def b/Common_Class/SISControls/SISControlsD.def
new file mode 100644
index 0000000..e902683
--- /dev/null
+++ b/Common_Class/SISControls/SISControlsD.def
@@ -0,0 +1,7 @@
+; SISControlsD.def : Declares the module parameters for the DLL.
+
+LIBRARY      "SISControlsD"
+DESCRIPTION  'SISControls Windows Dynamic Link Library (Debug)'
+
+EXPORTS
+    ; Explicit exports can go here
diff --git a/Common_Class/SISControls/SISFolderScheduling.cpp b/Common_Class/SISControls/SISFolderScheduling.cpp
new file mode 100644
index 0000000..ad18529
--- /dev/null
+++ b/Common_Class/SISControls/SISFolderScheduling.cpp
@@ -0,0 +1,284 @@
+// SISFolderScheduling.cpp: implementation of the CSISFolderScheduling class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "SISFolderScheduling.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CSISFolderScheduling::CSISFolderScheduling()
+{
+	m_strMainPath = _T("");
+
+	m_bTargetFolder = FALSE;
+	m_bTargetFile = FALSE;
+
+	m_pPathInfo = NULL;
+
+	m_nRemainItemCount = 0;
+	m_nSubItemCount = 0;
+}
+
+CSISFolderScheduling::CSISFolderScheduling(CString strPath)
+{
+	m_strMainPath = strPath;
+	
+	m_bTargetFolder = FALSE;
+	m_bTargetFile = FALSE;
+
+	m_pPathInfo = NULL;
+
+	m_nRemainItemCount = 0;
+	m_nSubItemCount = 0;
+}
+
+CSISFolderScheduling::CSISFolderScheduling(CString strPath, int nTargetType)
+{
+	m_strMainPath = strPath;
+	
+	if (nTargetType | TARGETTYPE_FOLDER)
+		m_bTargetFolder = TRUE;
+	else
+		m_bTargetFolder = FALSE;
+
+	if (nTargetType | TARGETTYPE_FILE)
+		m_bTargetFile = TRUE;
+	else
+		m_bTargetFile = FALSE;
+	
+	m_pPathInfo = NULL;
+
+	m_nRemainItemCount = 0;
+	m_nSubItemCount = 0;
+}
+
+CSISFolderScheduling::~CSISFolderScheduling()
+{
+	if (m_pPathInfo)
+	{
+		delete [] m_pPathInfo;
+		m_pPathInfo = NULL;
+	}
+}
+
+void CSISFolderScheduling::ResetSchedule()
+{
+	m_strMainPath.Empty();
+	
+	if (m_pPathInfo)
+	{
+		delete [] m_pPathInfo;
+		m_pPathInfo = NULL;
+	}
+	m_nSubItemCount = 0;
+
+	m_bTargetFolder = FALSE;
+	m_bTargetFile = FALSE;
+	m_nRemainItemCount = 0;
+}
+
+BOOL CSISFolderScheduling::SetRemainDelete(CString strPath, int nTargetType, int nRemainItemCount)
+{
+	m_strMainPath = strPath;
+
+	if (nTargetType & TARGETTYPE_FOLDER)
+		m_bTargetFolder = TRUE;
+	else
+		m_bTargetFolder = FALSE;
+
+	if (nTargetType & TARGETTYPE_FILE)
+		m_bTargetFile = TRUE;
+	else
+		m_bTargetFile = FALSE;
+
+	m_nRemainItemCount = nRemainItemCount;
+	
+	return TRUE;
+}
+
+BOOL CSISFolderScheduling::CommitSchedule()
+{
+	// 巢辫 荐父怒 巢扁绊 唱赣瘤甫 瘤款促.
+	try
+	{
+		// 亲格阑 啊廉客辑...
+		SearchSubItem(m_strMainPath, FALSE);
+
+		// 瘤款促.
+		if (m_nRemainItemCount <= m_nSubItemCount)
+		{
+			for (int i = m_nRemainItemCount; i < m_nSubItemCount; i++)
+			{
+				if (m_pPathInfo[i].s_nItemType == TARGETTYPE_FILE)
+					CFile::Remove(m_pPathInfo[i].s_strItemPath);
+				else if (m_pPathInfo[i].s_nItemType == TARGETTYPE_FOLDER)
+					DeleteFolder(m_pPathInfo[i].s_strItemPath);
+				m_pPathInfo[i].Reset();
+			}
+		}
+	}
+	catch (...)
+	{
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Utility Function
+BOOL CSISFolderScheduling::SearchSubItem(const CString &strMainPath, BOOL bIsAscending)
+{
+	// 扁粮 府胶飘 昏力.
+	if (m_pPathInfo)
+	{
+		delete [] m_pPathInfo;
+		m_pPathInfo = NULL;
+	}
+
+	if (strMainPath.IsEmpty())
+		return FALSE;
+
+	CString strPath;
+	strPath = strMainPath;
+	if(strPath.Right(1) != "\\") 
+		strPath += "\\";
+	
+	CString strFindPath = strPath + "*.*";
+	CString strDirName;
+	CFileFind filefind;
+	BOOL bContinue;	
+	if(!(bContinue = filefind.FindFile(strFindPath)))
+		return FALSE;
+
+	///////////////////////////////////////
+	//悼利 且寸窍扁 困秦 醚 窍困 叼泛配府 肮荐甫 刚历 舅酒辰促.
+	////////////////////////////////////////
+	// 檬扁拳
+	m_nSubItemCount = 0;
+
+	while (bContinue)
+	{
+		bContinue = filefind.FindNextFile();
+		if (filefind.IsDots())
+			continue;
+
+		//叼泛配府捞搁
+		if(m_bTargetFolder && filefind.IsDirectory())
+			m_nSubItemCount++;
+		if (m_bTargetFile && !filefind.IsDirectory())
+			m_nSubItemCount++;
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// 滚欺甫 积己窍绊 笼绢持绰促.
+	// 20160512 yjm 抗寇贸府(m_nSubItemCount 啊 0 老 版快 粮犁)
+	if(!(bContinue = filefind.FindFile(strFindPath)) || m_nSubItemCount == 0)
+		return FALSE;
+	
+	m_pPathInfo = new SSubPathInfo[m_nSubItemCount];
+	int nCount = 0;
+	CTime TMFileCreate;
+
+	while (bContinue)
+	{
+		bContinue = filefind.FindNextFile();
+		if (filefind.IsDots())
+			continue;
+
+		//叼泛配府捞搁
+		if(m_bTargetFolder && filefind.IsDirectory())
+		{
+			strDirName = filefind.GetFileName();
+			if (filefind.GetLastWriteTime(TMFileCreate))
+			{
+				m_pPathInfo[nCount].s_strItemPath = strPath + strDirName;
+				m_pPathInfo[nCount].s_strItemName = strDirName;
+				m_pPathInfo[nCount].s_nCreateDate = (long)TMFileCreate.GetTime();
+				m_pPathInfo[nCount].s_nItemType = TARGETTYPE_FOLDER;
+				nCount++;
+			}
+		}
+		if (m_bTargetFile && !filefind.IsDirectory())
+		{
+			strDirName = filefind.GetFileName();
+			if (filefind.GetLastWriteTime(TMFileCreate))
+			{
+				m_pPathInfo[nCount].s_strItemPath = strPath + strDirName;
+				m_pPathInfo[nCount].s_strItemName = strDirName;
+				m_pPathInfo[nCount].s_nCreateDate = (long)TMFileCreate.GetTime();
+				m_pPathInfo[nCount].s_nItemType = TARGETTYPE_FILE;
+				nCount++;
+			}
+		}
+	}
+
+	if(!SortSubItem(bIsAscending))		//Sub弃歹甫 朝楼俊 嘎霸 沥纺
+		return FALSE;
+
+	filefind.Close();
+
+	return TRUE;
+}
+
+BOOL CSISFolderScheduling::SortSubItem(BOOL bIsAscending)
+{
+	int i,j;
+
+	// 菊率捞 歹 弥辟 朝楼肺
+	SSubPathInfo SubPathInfo;
+	for(i = 0; i < m_nSubItemCount; i++)
+	{
+		for(j = 0; j < m_nSubItemCount - i - 1 ; j++)
+		{
+			// 坷抚瞒鉴
+			if (bIsAscending && m_pPathInfo[j].s_nCreateDate > m_pPathInfo[j + 1].s_nCreateDate)
+			{
+				SubPathInfo = m_pPathInfo[j + 1];
+				m_pPathInfo[j + 1] = m_pPathInfo[j];
+				m_pPathInfo[j] = SubPathInfo;
+			}
+			// 郴覆瞒鉴
+			if (!bIsAscending && m_pPathInfo[j].s_nCreateDate < m_pPathInfo[j + 1].s_nCreateDate)
+			{
+				SubPathInfo = m_pPathInfo[j + 1];
+				m_pPathInfo[j + 1] = m_pPathInfo[j];
+				m_pPathInfo[j] = SubPathInfo;
+			}
+		}
+	}
+
+	return TRUE;
+}
+
+BOOL CSISFolderScheduling::DeleteFolder(const CString &strFolder)
+{
+	SHFILEOPSTRUCT FileOp = {0};
+	TCHAR szTemp[MAX_PATH];
+
+	wcscpy_s(szTemp, MAX_PATH, strFolder);
+	szTemp[strFolder.GetLength() + 1] = NULL; // NULL巩磊啊 滴俺 甸绢啊具 茄促.
+
+	FileOp.hwnd = NULL;
+	FileOp.wFunc = FO_DELETE;
+	FileOp.pFrom = NULL;
+	FileOp.pTo = NULL;
+	FileOp.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI; // 犬牢皋矫瘤啊 救哆档废 汲沥
+	FileOp.fAnyOperationsAborted = false;
+	FileOp.hNameMappings = NULL;
+	FileOp.lpszProgressTitle = NULL;
+	FileOp.pFrom = szTemp;
+
+	SHFileOperation(&FileOp);
+
+	return true;
+}
diff --git a/Common_Class/SISControls/SISJogButton.cpp b/Common_Class/SISControls/SISJogButton.cpp
new file mode 100644
index 0000000..257188b
--- /dev/null
+++ b/Common_Class/SISControls/SISJogButton.cpp
@@ -0,0 +1,60 @@
+// SISJogButton.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "SISJogButton.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISJogButton
+
+CSISJogButton::CSISJogButton()
+{
+	m_strMessageDown	= _T("");
+	m_strMessageUp		= _T("");
+
+	m_nMessageDown		= -1;
+	m_nMessageUp		= -1;
+}
+
+CSISJogButton::~CSISJogButton()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CSISJogButton, CButton)
+	//{{AFX_MSG_MAP(CSISJogButton)
+	ON_WM_LBUTTONDOWN()
+	ON_WM_LBUTTONUP()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISJogButton message handlers
+
+void CSISJogButton::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if (m_nMessageDown == -1)
+		m_pJ2M->SendMessageToParent((LPCTSTR)m_strMessageDown);
+	else
+		m_pJ2M->SendMessageToParent(m_nMessageDown);
+
+	CButton::OnLButtonDown(nFlags, point);
+}
+
+void CSISJogButton::OnLButtonUp(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if (m_nMessageUp == -1)
+		m_pJ2M->SendMessageToParent((LPCTSTR)m_strMessageUp);
+	else
+		m_pJ2M->SendMessageToParent(m_nMessageUp);
+	
+	CButton::OnLButtonUp(nFlags, point);
+}
diff --git a/Common_Class/SISControls/SISLabel.cpp b/Common_Class/SISControls/SISLabel.cpp
new file mode 100644
index 0000000..d596aa2
--- /dev/null
+++ b/Common_Class/SISControls/SISLabel.cpp
@@ -0,0 +1,272 @@
+// SISLabel.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Resource.h"
+#include "SISLabel.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISLabel
+
+CSISLabel::CSISLabel()
+{
+	m_crText = GetSysColor(COLOR_WINDOWTEXT);
+	m_hBrush = ::CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+
+	::GetObject((HFONT)GetStockObject(DEFAULT_GUI_FONT),sizeof(m_lf),&m_lf);
+
+	m_font.CreateFontIndirect(&m_lf);
+	m_bTimer = FALSE;
+	m_bState = FALSE;
+	m_bLink = TRUE;
+	m_hCursor = NULL;
+	m_Type = None;
+
+	m_hwndBrush = ::CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+}
+
+
+CSISLabel::~CSISLabel()
+{
+	m_font.DeleteObject();
+	::DeleteObject(m_hBrush);
+}
+
+CSISLabel& CSISLabel::SetText(const CString& strText)
+{
+	SetWindowText(strText);
+	ShowWindow(SW_HIDE);
+	ShowWindow(SW_SHOW);
+	return *this;
+}
+
+CSISLabel& CSISLabel::SetTextColor(COLORREF crText)
+{
+	m_crText = crText;
+	RedrawWindow();
+	return *this;
+}
+
+CSISLabel& CSISLabel::SetFontBold(BOOL bBold)
+{	
+	m_lf.lfWeight = bBold ? FW_BOLD : FW_NORMAL;
+	ReconstructFont();
+	RedrawWindow();
+	return *this;
+}
+
+CSISLabel& CSISLabel::SetFontUnderline(BOOL bSet)
+{	
+	m_lf.lfUnderline = bSet;
+	ReconstructFont();
+	RedrawWindow();
+	return *this;
+}
+
+CSISLabel& CSISLabel::SetFontItalic(BOOL bSet)
+{
+	m_lf.lfItalic = bSet;
+	ReconstructFont();
+	RedrawWindow();
+	return *this;	
+}
+
+CSISLabel& CSISLabel::SetSunken(BOOL bSet)
+{
+	if (!bSet)
+		ModifyStyleEx(WS_EX_STATICEDGE,0,SWP_DRAWFRAME);
+	else
+		ModifyStyleEx(0,WS_EX_STATICEDGE,SWP_DRAWFRAME);
+		
+	return *this;	
+}
+
+CSISLabel& CSISLabel::SetBorder(BOOL bSet)
+{
+	if (!bSet)
+		ModifyStyle(WS_BORDER,0,SWP_DRAWFRAME);
+	else
+		ModifyStyle(0,WS_BORDER,SWP_DRAWFRAME);
+		
+	return *this;	
+}
+
+CSISLabel& CSISLabel::SetFontSize(int nSize)
+{
+	nSize*=-1;
+	m_lf.lfHeight = nSize;
+	ReconstructFont();
+	RedrawWindow();
+	return *this;
+}
+
+
+CSISLabel& CSISLabel::SetBkColor(COLORREF crBkgnd)
+{
+	if (m_hBrush)
+		::DeleteObject(m_hBrush);
+	
+	m_hBrush = ::CreateSolidBrush(crBkgnd);
+	return *this;
+}
+
+CSISLabel& CSISLabel::SetFontName(const CString& strFont)
+{		
+	wcscpy_s(m_lf.lfFaceName, 32, strFont);
+	ReconstructFont();
+	RedrawWindow();
+	return *this;
+}
+
+
+BEGIN_MESSAGE_MAP(CSISLabel, CStatic)
+	//{{AFX_MSG_MAP(CSISLabel)
+	ON_WM_CTLCOLOR_REFLECT()
+	ON_WM_TIMER()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_SETCURSOR()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISLabel message handlers
+
+HBRUSH CSISLabel::CtlColor(CDC* pDC, UINT nCtlColor) 
+{
+	// TODO: Change any attributes of the DC here
+	
+	// TODO: Return a non-NULL brush if the parent's handler should not be called
+
+	if (CTLCOLOR_STATIC == nCtlColor)
+	{
+		pDC->SelectObject(&m_font);
+		pDC->SetTextColor(m_crText);
+		pDC->SetBkMode(TRANSPARENT);
+	}
+
+	if (m_Type == Background)
+	{
+		if (!m_bState)
+			return m_hwndBrush;
+	}
+
+	return m_hBrush;
+}
+
+void CSISLabel::ReconstructFont()
+{
+	m_font.DeleteObject();
+	BOOL bCreated = m_font.CreateFontIndirect(&m_lf);
+
+	ASSERT(bCreated);
+}
+
+
+CSISLabel& CSISLabel::FlashText(BOOL bActivate)
+{
+	if (m_bTimer)
+	{
+		SetWindowText(m_strText);
+		KillTimer(1);
+	}
+
+	if (bActivate)
+	{
+		GetWindowText(m_strText);
+		m_bState = FALSE;
+		
+		m_bTimer = TRUE;
+		SetTimer(1,500,NULL);
+		m_Type = Text;
+	}
+
+	return *this;
+}
+
+CSISLabel& CSISLabel::FlashBackground(BOOL bActivate)
+{
+
+	if (m_bTimer)
+		KillTimer(1);
+
+	if (bActivate)
+	{
+		m_bState = FALSE;
+
+		m_bTimer = TRUE;
+		SetTimer(1,500,NULL);
+
+		m_Type = Background;
+	}
+
+	return *this;
+}
+
+
+void CSISLabel::OnTimer(UINT_PTR nIDEvent) 
+{
+	m_bState = !m_bState;
+
+	switch (m_Type)
+	{
+		case Text:
+			if (m_bState)
+				SetWindowText(_T(""));
+			else
+				SetWindowText(m_strText);
+		break;
+
+		case Background:
+			InvalidateRect(NULL,FALSE);
+			UpdateWindow();
+		break;
+	}
+	
+	CStatic::OnTimer(nIDEvent);
+}
+
+CSISLabel& CSISLabel::SetLink(BOOL bLink)
+{
+	m_bLink = bLink;
+
+	if (bLink)
+		ModifyStyle(0,SS_NOTIFY);
+	else
+		ModifyStyle(SS_NOTIFY,0);
+
+	return *this;
+}
+
+void CSISLabel::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	CString strLink;
+
+	GetWindowText(strLink);
+	ShellExecute(NULL,_T("open"),strLink,NULL,NULL,SW_SHOWNORMAL);
+		
+	CStatic::OnLButtonDown(nFlags, point);
+}
+
+BOOL CSISLabel::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
+{
+	if (m_hCursor)
+	{
+		::SetCursor(m_hCursor);
+		return TRUE;
+	}
+
+	return CStatic::OnSetCursor(pWnd, nHitTest, message);
+}
+
+CSISLabel& CSISLabel::SetLinkCursor(HCURSOR hCursor)
+{
+	m_hCursor = hCursor;
+	return *this;
+}
+
diff --git a/Common_Class/SISControls/SISListBoxLog.cpp b/Common_Class/SISControls/SISListBoxLog.cpp
new file mode 100644
index 0000000..81c7a23
--- /dev/null
+++ b/Common_Class/SISControls/SISListBoxLog.cpp
@@ -0,0 +1,518 @@
+// SISListBoxLog.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "SISListBoxLog.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#define UM_DISPLAYMESSAGE		WM_USER + 8378
+/////////////////////////////////////////////////////////////////////////////
+// CSISListBoxLog
+
+CSISListBoxLog::CSISListBoxLog()
+{
+	m_pFileLog = NULL;
+	m_strLogPath = _T("");
+	m_strLogFile = _T("");
+	m_strLogDir = _T("");
+	m_strFileName = _T("");
+
+	for (int i = 0; i < STRINGBUFFER_COUNT; i++)
+	{
+		m_strArray[i] = _T("");
+		m_bMustDisplay[i] = FALSE;
+	}
+
+	m_nAddIndex = 0;
+	m_nReadIndex = 0;
+	SetTextColor();
+	InitializeCriticalSection(&m_csLog);
+}
+
+CSISListBoxLog::~CSISListBoxLog()
+{
+	for (int i = 0; i < STRINGBUFFER_COUNT; i++)
+	{
+		m_strArray[i] = _T("");
+		m_bMustDisplay[i] = FALSE;
+	}
+	if (m_pFileLog)
+	{
+		delete m_pFileLog;
+		m_pFileLog = NULL;
+	}
+
+	DeleteCriticalSection(&m_csLog);
+}
+
+BEGIN_MESSAGE_MAP(CSISListBoxLog, CListBox)
+	//{{AFX_MSG_MAP(CSISListBoxLog)
+	ON_MESSAGE(UM_DISPLAYMESSAGE, OnDisplayMessage)
+	ON_WM_ERASEBKGND()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListBoxLog message handlers
+
+//////////////////////////////////////////////////////////////////////////
+// Logging
+void CSISListBoxLog::SetPath(CString& strPath, CString& strName, BOOL bDelete, int nRemainCount)
+{
+	strPath.Replace(_T("/"), _T("\\"));
+	CString str = _T("");
+	str = strPath.Right(1);
+	if (str == "\\")
+		m_strLogPath = strPath;
+	else
+		m_strLogPath = strPath + _T("\\");
+
+	m_strLogDir = m_strLogPath;
+	m_strFileName = strName;
+
+ 	if (bDelete && nRemainCount > 0)
+ 		m_FolderSchedule.SetRemainDelete(m_strLogPath, (int)TARGETTYPE_FOLDER, nRemainCount);
+
+	m_strLogPath += strName;
+
+	MakeLogFile();
+
+	m_dwThreadID = GetCurrentThreadId();
+}
+
+void CSISListBoxLog::DisplayMessages(BOOL bAddMsgBox, int nLevel, TCHAR *str, ...)
+{
+	try
+	{
+		EnterCriticalSection(&m_csLog);
+
+		// TRACE俊 静扁.
+		va_list list;
+		ZeroMemory(m_strBuffer, 512);
+		va_start(list, str);
+		vswprintf_s(m_strBuffer, 512, str, list);
+//		OutputDebugString(m_strBuffer);
+		va_end(list);
+
+		// 涝仿且 巩磊凯 父甸扁.
+		CTime	time = CTime::GetCurrentTime();
+		TCHAR strTemp[512] = {0, };
+		
+		swprintf_s(strTemp, 512, _T("[%02d:%02d:%02d] : %d : %s\n"), time.GetHour(), time.GetMinute(), time.GetSecond(), nLevel, str);
+
+		WriteToFile(time, strTemp);
+
+		// 拳搁俊 免仿窍绰 皋矫瘤扼搁...
+		if (bAddMsgBox)
+		{
+			m_strArray[m_nAddIndex] = _T("");
+			m_strArray[m_nAddIndex] = strTemp;
+			m_bMustDisplay[m_nAddIndex] = TRUE;
+			m_nAddIndex = (m_nAddIndex + 1) % STRINGBUFFER_COUNT;
+
+			if (GetSafeHwnd())
+			{
+				if (m_dwThreadID == GetCurrentThreadId())
+					OnDisplayMessage(1, 0);
+				else
+				{
+					PostMessage(UM_DISPLAYMESSAGE, 0, 0);
+					Sleep(0);
+				}
+			}
+		}
+
+		LeaveCriticalSection(&m_csLog);
+	}
+	catch (...)
+	{
+		LeaveCriticalSection(&m_csLog);
+		return;
+	}
+}
+
+void CSISListBoxLog::DisplayMessages(BOOL bAddMsgBox, TCHAR *str, ...)
+{
+	try
+	{
+		EnterCriticalSection(&m_csLog);
+
+		// TRACE俊 静扁.
+		va_list list;
+		ZeroMemory(m_strBuffer, 512);
+		va_start(list, str);
+		vswprintf_s(m_strBuffer, 512, str, list);
+//		OutputDebugString(m_strBuffer);
+		va_end(list);
+
+		// 涝仿且 巩磊凯 父甸扁.
+		CTime	time = CTime::GetCurrentTime();
+		TCHAR strTemp[512] = {0, };
+		swprintf_s(strTemp, 512, _T("[%02d:%02d:%02d] : %s\n"), time.GetHour(), time.GetMinute(), time.GetSecond(), m_strBuffer);
+
+		WriteToFile(time, strTemp);
+
+		// 拳搁俊 免仿窍绰 皋矫瘤扼搁...
+		if (bAddMsgBox)
+		{
+			m_strArray[m_nAddIndex] = _T("");
+			m_strArray[m_nAddIndex] = strTemp;
+			m_bMustDisplay[m_nAddIndex] = TRUE;
+			m_nAddIndex = (m_nAddIndex + 1) % STRINGBUFFER_COUNT;
+
+			if (GetSafeHwnd())
+			{
+				if (m_dwThreadID == GetCurrentThreadId())
+					OnDisplayMessage(1, 0);
+				else
+				{
+					PostMessage(UM_DISPLAYMESSAGE, 0, 0);
+					Sleep(0);
+				}
+			}
+		}
+
+		LeaveCriticalSection(&m_csLog);
+	}
+	catch (...)
+	{
+		LeaveCriticalSection(&m_csLog);
+		return;
+	}
+}
+
+void CSISListBoxLog::DisplayMessage(BOOL bAddMsgBox, int nLevel, TCHAR *str)
+{
+	try
+	{
+		EnterCriticalSection(&m_csLog);
+
+		// 涝仿且 巩磊凯 父甸扁.
+		CTime	time = CTime::GetCurrentTime();
+		TCHAR strTemp[512] = {0, };
+		swprintf_s(strTemp, 512, _T("[%02d:%02d:%02d] : %d : %s\n"), time.GetHour(), time.GetMinute(), time.GetSecond(), nLevel, str);
+
+		WriteToFile(time, strTemp);
+
+		// 拳搁俊 免仿窍绰 皋矫瘤扼搁...
+		if (bAddMsgBox)
+		{
+			m_strArray[m_nAddIndex] = _T("");
+			m_strArray[m_nAddIndex] = strTemp;
+			m_bMustDisplay[m_nAddIndex] = TRUE;
+			m_nAddIndex = (m_nAddIndex + 1) % STRINGBUFFER_COUNT;
+
+			if (GetSafeHwnd())
+			{
+				if (m_dwThreadID == GetCurrentThreadId())
+					OnDisplayMessage(1, 0);
+				else
+				{
+					PostMessage(UM_DISPLAYMESSAGE, 0, 0);
+					Sleep(0);
+				}
+			}
+		}
+
+		LeaveCriticalSection(&m_csLog);
+	}
+	catch (...)
+	{
+		LeaveCriticalSection(&m_csLog);
+		return;
+	}
+}
+
+void CSISListBoxLog::DisplayMessage(BOOL bAddMsgBox, TCHAR *str)
+{
+	try
+	{
+		EnterCriticalSection(&m_csLog);
+
+		// 涝仿且 巩磊凯 父甸扁.
+		CTime	time = CTime::GetCurrentTime();
+		TCHAR strTemp[512] = {0, };
+		swprintf_s(strTemp, 512, _T("[%02d:%02d:%02d] : %s\n"), time.GetHour(), time.GetMinute(), time.GetSecond(), str);
+
+		WriteToFile(time, strTemp);
+
+		// 拳搁俊 免仿窍绰 皋矫瘤扼搁...
+		if (bAddMsgBox)
+		{
+			m_strArray[m_nAddIndex] = _T("");
+			m_strArray[m_nAddIndex] = strTemp;
+			m_bMustDisplay[m_nAddIndex] = TRUE;
+			m_nAddIndex = (m_nAddIndex + 1) % STRINGBUFFER_COUNT;
+
+			if (GetSafeHwnd())
+			{
+				if (m_dwThreadID == GetCurrentThreadId())
+					OnDisplayMessage(1, 0);
+				else
+				{
+					PostMessage(UM_DISPLAYMESSAGE, 0, 0);
+					Sleep(0);
+				}
+			}
+		}
+
+		LeaveCriticalSection(&m_csLog);
+	}
+	catch (...)
+	{
+		LeaveCriticalSection(&m_csLog);
+		return;
+	}
+}
+
+// Log File俊 静扁.
+BOOL CSISListBoxLog::WriteToFile(CTime& time, CString& strContents)
+{
+	// 朝楼啊 官差搁 颇老疙阑 盎脚秦辑 敬促.
+	if ((time.GetMonth() != m_TimeLogFile.GetMonth()) || (time.GetDay() != m_TimeLogFile.GetDay()) || !m_pFileLog)
+		MakeLogFile();
+
+	if (!m_pFileLog->Open(m_strLogFile, CFile::modeWrite))
+	{
+		if (!m_pFileLog->Open(m_strLogFile, CFile::modeCreate | CFile::modeWrite))
+		{
+			delete m_pFileLog;
+			m_pFileLog = NULL;
+		}
+	}
+
+	if (m_pFileLog)
+	{
+		char		cbuffer[2048] = "";
+#ifdef _UNICODE
+		int		nSize = WideCharToMultiByte(CP_ACP, 0, strContents.GetBuffer(), -1, NULL, 0, NULL,NULL); 				
+		WideCharToMultiByte(CP_ACP, 0, strContents.GetBuffer(), -1, cbuffer, nSize, NULL, NULL); 		
+#else				
+		sprintf_s(cbuffer,sizeof(char)*255,"%s",(LPSTR)(LPCTSTR)strContents);		
+#endif	
+
+		m_pFileLog->SeekToEnd();
+		m_pFileLog->Write(cbuffer, strlen(cbuffer));
+		//m_pFileLog->Write(_T("\r\n"), static_cast<UINT>(wcslen(_T("\r\n"))));
+		m_pFileLog->Close();
+	}
+
+	return TRUE;
+}
+
+BOOL CSISListBoxLog::WriteToFile(CTime& time, TCHAR* strContents)
+{
+	// 朝楼啊 官差搁 颇老疙阑 盎脚秦辑 敬促.
+	if ((time.GetMonth() != m_TimeLogFile.GetMonth()) || (time.GetDay() != m_TimeLogFile.GetDay()) || !m_pFileLog)
+		MakeLogFile();
+
+	if (!m_pFileLog->Open(m_strLogFile, CFile::modeWrite))
+	{
+		if (!m_pFileLog->Open(m_strLogFile, CFile::modeCreate | CFile::modeWrite))
+		{
+			delete m_pFileLog;
+			m_pFileLog = NULL;
+		}
+	}
+
+	if (m_pFileLog)
+	{
+		CString strTemp = (LPCTSTR) strContents;
+
+		char		cbuffer[2048] = "";
+#ifdef _UNICODE
+		int		nSize = WideCharToMultiByte(CP_ACP, 0, strTemp.GetBuffer(), -1, NULL, 0, NULL,NULL); 				
+		WideCharToMultiByte(CP_ACP, 0, strTemp.GetBuffer(), -1, cbuffer, nSize, NULL, NULL); 		
+#else				
+		sprintf_s(cbuffer,sizeof(char)*255,"%s",(LPSTR)(LPCTSTR)strTemp);		
+#endif	
+
+		m_pFileLog->SeekToEnd();
+		m_pFileLog->Write(cbuffer, strlen(cbuffer));
+		//m_pFileLog->Write(_T("\r\n"), static_cast<UINT>(wcslen(_T("\r\n"))));
+		m_pFileLog->Close();
+	}
+
+	return TRUE;
+}
+
+LRESULT CSISListBoxLog::OnDisplayMessage(WPARAM wParam, LPARAM lParam)
+{
+	if (wParam == 0)
+		EnterCriticalSection(&m_csLog);
+
+	int count=0, nInsertCount = 0;
+	while (m_bMustDisplay[m_nReadIndex] && nInsertCount < STRINGBUFFER_COUNT)
+	{
+		// 1000俺老锭 府胶飘甫 努府绢.
+		count = GetCount();
+		if(count > 1000)
+		{
+			ResetContent();
+			count = GetCount();
+		}
+
+		InsertString(count, (LPCTSTR)m_strArray[m_nReadIndex]);
+
+		m_strArray[m_nReadIndex] = _T("");
+		m_bMustDisplay[m_nReadIndex] = FALSE;
+
+		m_nReadIndex = (m_nReadIndex + 1) % STRINGBUFFER_COUNT;
+
+		nInsertCount++;
+	}
+	SetCaretIndex(count + 1);
+//	SetFocus();
+	SendMessage(WM_KEYDOWN, VK_END);
+
+	if (wParam == 0)
+		LeaveCriticalSection(&m_csLog);
+
+	return 0;
+}
+
+BOOL CSISListBoxLog::MakeLogFile()
+{
+	// Log 贸府
+	if (m_strLogPath.IsEmpty())
+		return FALSE;
+
+	// 老沥 荐 捞惑 登搁 坷贰等 亲格阑 瘤款促.
+	m_FolderSchedule.CommitSchedule();
+
+	m_TimeLogFile = CTime::GetCurrentTime();
+
+	CString	strLogPathWitSISM_DD;
+	strLogPathWitSISM_DD = _T("");
+	strLogPathWitSISM_DD.Format(_T("%s%02d"),m_strLogDir, m_TimeLogFile.GetMonth());
+	CreateDirectory(strLogPathWitSISM_DD, NULL);
+
+	//strLogPathWitSISM_DD_HH.AppendFormat("\\%02d",m_TimeLogFile.GetDay());
+	//CreateDirectory(strLogPathWitSISM_DD_HH, NULL);
+
+
+	m_strLogFile.Format(_T("%s\\%s_%02d_%02d.log"), strLogPathWitSISM_DD, m_strFileName
+		,m_TimeLogFile.GetMonth(), m_TimeLogFile.GetDay());
+
+//	m_strLogFile.Format("%s_%02d_%02d.log", m_strLogPath, m_TimeLogFile.GetMonth(), m_TimeLogFile.GetDay());
+
+	if (m_pFileLog)
+		delete m_pFileLog;
+	m_pFileLog = NULL;
+
+	m_pFileLog = new CFile();
+
+	return TRUE;
+}
+
+void CSISListBoxLog::SetTextColor(long clbg1, long clbg2,long clText)
+{
+	m_clBG1 = clbg1;
+	m_clBG2 = clbg2;
+	m_clText = clText;
+}
+
+void CSISListBoxLog::DrawItem(LPDRAWITEMSTRUCT lpDIS)
+{
+	COLORREF oldtextcolor, oldbackgroundcolor;
+
+	CDC* pDC = CDC::FromHandle(lpDIS->hDC);
+	
+	int m_nTabStopPositions[100];
+	for (int i = 0; i < 100; i++)
+		m_nTabStopPositions[i] = (i+1) * 8 * 7;
+
+	int m_cxExtent = 0;
+
+	if (lpDIS->itemID == (UINT)-1)
+	{
+		//if (lpDIS->itemAction & ODA_FOCUS)
+		//	pDC->DrawFocusRect(&lpDIS->rcItem);
+		return;
+	}
+	else
+	{
+		int selChange   = lpDIS->itemAction & ODA_SELECT;
+		int focusChange = lpDIS->itemAction & ODA_FOCUS;
+		int drawEntire  = lpDIS->itemAction & ODA_DRAWENTIRE;
+
+		if (selChange || drawEntire)
+		{
+			BOOL sel = lpDIS->itemState & ODS_SELECTED;
+
+			int nLen = CListBox::GetTextLen(lpDIS->itemID);
+
+			if (nLen != LB_ERR)
+			{
+				TCHAR *buf = new TCHAR [nLen + 16];
+				ASSERT(buf);
+				buf[0] = 0;
+				if (buf && (CListBox::GetText(lpDIS->itemID, buf) != LB_ERR))
+				{
+					CRect rectItem(lpDIS->rcItem);
+					CSize size;					
+									
+					COLORREF textcolor = sel ? RGB(255, 255, 255) : m_clText;
+					oldtextcolor = pDC->SetTextColor(textcolor);
+					COLORREF backgroundcolor = sel ? RGB(0, 0, 255):lpDIS->itemID%2==0?m_clBG1:m_clBG2;
+					oldbackgroundcolor = pDC->SetBkColor(backgroundcolor);					
+
+					// fill the rectangle with the background color the fast way
+					pDC->ExtTextOut(0, 0, ETO_OPAQUE, &rectItem, NULL, 0, NULL);
+
+					pDC->TabbedTextOut(rectItem.left+2, rectItem.top, &buf[0],
+						(int)_tcslen(&buf[0]), 100, (LPINT)m_nTabStopPositions, 0);
+
+					size = pDC->GetOutputTextExtent(&buf[0]);
+					int nScrollBarWidth = ::GetSystemMetrics(SM_CXVSCROLL);
+					size.cx += nScrollBarWidth;	// in case of vertical scrollbar
+
+					int cxExtent = (size.cx > m_cxExtent) ? size.cx : m_cxExtent;
+
+					if (cxExtent > m_cxExtent)
+					{
+						m_cxExtent = cxExtent;
+						SetHorizontalExtent(m_cxExtent+(m_cxExtent/32));
+					}
+				}
+				if (buf)
+					delete [] buf;
+			}
+		}
+
+		//if (focusChange || (drawEntire && (lpDIS->itemState & ODS_FOCUS)))
+		//	pDC->DrawFocusRect(&lpDIS->rcItem);
+	}
+}
+
+
+BOOL CSISListBoxLog::OnEraseBkgnd(CDC* pDC)
+{	
+	CRect rect;
+	GetClientRect(&rect);	
+	
+	int nHeight = GetItemHeight(0);
+	int nCount = rect.Height() / nHeight;
+
+	CRect rtItem(rect);
+	for(int i = 0; i < nCount; i++)
+	{
+		rtItem.bottom = rtItem.top + nHeight;
+		if(i % 2 == 0)
+		{
+			pDC->FillSolidRect(rtItem, m_clBG1);
+		}
+		else
+		{
+			pDC->FillSolidRect(rtItem, m_clBG2);
+		}
+		rtItem.top = rtItem.bottom;
+	}
+
+	return TRUE;
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/SISListCtrlExt.cpp b/Common_Class/SISControls/SISListCtrlExt.cpp
new file mode 100644
index 0000000..817d64e
--- /dev/null
+++ b/Common_Class/SISControls/SISListCtrlExt.cpp
@@ -0,0 +1,874 @@
+// SISListCtrlExt.cpp : implementation file
+//
+
+#include "stdafx.h"
+//#include "	\ add additional includes here"
+#include "SISListCtrlExt.h"
+
+#include "SortClass.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListCtrlExt
+
+CSISListCtrlExt::CSISListCtrlExt()
+{
+	m_nColNum = 0;
+	m_nDisableRow = -1;
+	m_nDisableCol = -1;
+	m_nEditDisableState = EDITDISABLE_NONE;
+
+	m_pEdit = NULL;
+	m_pComboBox = NULL;
+	m_pEditDisableCols = NULL;
+	m_pEditDisableRows = NULL;
+	m_strInitEditText = _T("");
+	m_nInPlaceCtrl = -1;
+	m_bSortOrder = TRUE;
+	m_bEnableSortList = TRUE;
+	m_nLength = 0;
+
+	m_pComboData = NULL;
+	m_nComboDataState = COMBODATASTATE_SINGLE;
+
+	m_pEditCtrlCols = NULL;
+	m_pComboCtrlCols = NULL;
+	m_nEditCtrlLength = 0;
+	m_nComboCtrlLength = 0;
+
+	m_bSetImageList = FALSE;
+}
+
+void CSISListCtrlExt::SetTextColor(int nRow, COLORREF clrText)
+{
+	POSITION pos = m_ListColorText.GetHeadPosition();
+	pListRowColor pLRC;
+	BOOL bIs = FALSE;
+	while (pos)
+	{
+		pLRC = m_ListColorText.GetNext(pos);
+		if (pLRC)
+		{
+			if (pLRC->s_nRow == nRow)
+			{
+				pLRC->s_Color = clrText;
+				bIs = TRUE;
+				break;
+			}
+		}
+	}
+	if (!bIs)
+	{
+		pListRowColor pLRC = new ListRowColor;
+		pLRC->s_nRow = nRow;
+		pLRC->s_Color = clrText;
+		m_ListColorText.AddTail(pLRC);
+	}
+}
+
+void CSISListCtrlExt::SetBKColor(int nRow, COLORREF clrBK)
+{
+	POSITION pos = m_ListColorBk.GetHeadPosition();
+	pListRowColor pLRC;
+	BOOL bIs = FALSE;
+	while (pos)
+	{
+		pLRC = m_ListColorBk.GetNext(pos);
+		if (pLRC)
+		{
+			if (pLRC->s_nRow == nRow)
+			{
+				pLRC->s_Color = clrBK;
+				bIs = TRUE;
+				break;
+			}
+		}
+	}
+	if (!bIs)
+	{
+		pListRowColor pLRC = new ListRowColor;
+		pLRC->s_nRow = nRow;
+		pLRC->s_Color = clrBK;
+		m_ListColorBk.AddTail(pLRC);
+	}
+}
+
+void CSISListCtrlExt::ReleaseTextColor(int nRow)
+{
+	POSITION posDel = NULL;
+	POSITION pos = m_ListColorText.GetHeadPosition();
+	pListRowColor pLRC;
+	BOOL bIs = FALSE;
+	while (pos)
+	{
+		posDel = pos;
+		pLRC = m_ListColorText.GetNext(pos);
+		if (pLRC && pLRC->s_nRow == nRow)
+		{
+			bIs = TRUE;
+			break;
+		}
+	}
+	if (bIs && posDel && pLRC)
+	{
+		delete pLRC;
+		pLRC = NULL;
+		m_ListColorText.RemoveAt(posDel);
+	}
+}
+
+void CSISListCtrlExt::ReleaseBKColor(int nRow)
+{
+	POSITION posDel = NULL;
+	POSITION pos = m_ListColorBk.GetHeadPosition();
+	pListRowColor pLRC;
+	BOOL bIs = FALSE;
+	while (pos)
+	{
+		posDel = pos;
+		pLRC = m_ListColorBk.GetNext(pos);
+		if (pLRC && pLRC->s_nRow == nRow)
+		{
+			bIs = TRUE;
+			break;
+		}
+	}
+	if (bIs && posDel && pLRC)
+	{
+		delete pLRC;
+		pLRC = NULL;
+		m_ListColorBk.RemoveAt(posDel);
+	}
+}
+
+void CSISListCtrlExt::ResetTextColor()
+{
+	POSITION pos = m_ListColorText.GetHeadPosition();
+	pListRowColor pLRC;
+	while (pos)
+	{
+		pLRC = m_ListColorText.GetNext(pos);
+		if (pLRC)
+			delete pLRC;
+		pLRC = NULL;
+	}
+	m_ListColorText.RemoveAll();
+}
+
+void CSISListCtrlExt::ResetBKColor()
+{
+	POSITION pos = m_ListColorBk.GetHeadPosition();
+	pListRowColor pLRC;
+	while (pos)
+	{
+		pLRC = m_ListColorBk.GetNext(pos);
+		if (pLRC)
+			delete pLRC;
+		pLRC = NULL;
+	}
+	m_ListColorBk.RemoveAll();
+}
+
+CSISListCtrlExt::~CSISListCtrlExt()
+{
+	if(m_pEdit)
+	{
+		delete m_pEdit;
+		m_pEdit = NULL;
+	}
+
+	if(m_pComboBox)
+	{
+		delete m_pComboBox;
+		m_pComboBox = NULL;
+	}
+
+	if(m_pEditDisableCols)
+	{
+		delete m_pEditDisableCols;
+		m_pEditDisableCols = NULL;
+	}
+	
+	if(m_pEditDisableRows)
+	{
+		delete m_pEditDisableRows;
+		m_pEditDisableRows = NULL;
+	}
+
+	if(m_pComboData)
+	{
+		m_pComboData->RemoveAll();
+		delete m_pComboData;
+		m_pComboData = NULL;
+	}
+
+	if(m_pEditCtrlCols)
+	{
+		delete m_pEditCtrlCols;
+		m_pEditCtrlCols = NULL;
+	}
+
+	if(m_pComboCtrlCols)
+	{
+		delete m_pComboCtrlCols;
+		m_pComboCtrlCols = NULL;
+	}
+	ResetTextColor();
+	ResetBKColor();
+}
+
+
+BEGIN_MESSAGE_MAP(CSISListCtrlExt, CListCtrl)
+	//{{AFX_MSG_MAP(CSISListCtrlExt)
+	ON_WM_LBUTTONDOWN()
+	ON_WM_VSCROLL()
+	ON_WM_HSCROLL()
+	ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnclick)
+	ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListCtrlExt message handlers
+
+void CSISListCtrlExt::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	
+	CListCtrl::OnLButtonDown(nFlags, point);
+
+//	AddBlankItem();
+
+	LVHITTESTINFO pItem;
+	pItem.pt = point;
+	int test = SubItemHitTest(&pItem);
+
+	int nCol,nRow;
+	nRow = pItem.iItem;
+	nCol = pItem.iSubItem;
+
+	if(nRow != -1)
+	{
+		CRect rect;
+		if(nCol == 0)
+		{
+			GetItemRect(nRow,rect,LVIR_BOUNDS);
+			rect.right = GetColumnWidth(nCol);
+		}
+		else
+			GetSubItemRect(nRow,nCol,LVIR_BOUNDS,rect);
+
+		// 力寇等 青,凯 眉农 //////////////////////////////////////////////////////
+		if(m_nEditDisableState == EDITDISABLE_ROWS || m_nEditDisableState == EDITDISABLE_COLS)
+		{
+			if(m_nDisableRow == nRow)
+				return;
+			if(m_nDisableCol == nCol)
+				return;
+		}
+		if(m_nEditDisableState == EDITDISABLE_ROWCOL)
+		{
+			if(m_nDisableRow == nRow && m_nDisableCol == nCol)
+				return;
+		}
+
+		if(m_nEditDisableState == EDITDISABLE_ROWS_ARRAY)
+		{
+			if(m_pEditDisableRows)
+			{
+				for(int i=0;i<m_nLength;i++)
+				{
+					if(m_pEditDisableRows[i] == nRow)
+						return;
+				}
+			}
+		}
+		if(m_nEditDisableState == EDITDISABLE_COLS_ARRAY)
+		{
+			if(m_pEditDisableCols)
+			{
+				for(int i=0;i<m_nLength;i++)
+				{
+					if(m_pEditDisableCols[i] == nCol)
+						return;
+				}
+			}
+		}
+		// End.. //////////////////////////////////////////////////////////////////
+
+		if(m_nInPlaceCtrl == INPLACECTRL_EDIT)
+		{
+			if(m_pEdit)
+			{
+				delete m_pEdit;
+				m_pEdit = NULL;
+			}
+
+			m_pEdit = new CInPlaceEdit(nRow,nCol,m_strInitEditText);
+			m_pEdit->Create(WS_BORDER | WS_CHILD | WS_VISIBLE,rect,this,10000);
+			m_pEdit->ShowWindow(SW_SHOW);
+		}
+
+		
+		if(m_nInPlaceCtrl == INPLACECTRL_COMBO)
+		{
+			if(m_pComboBox)
+			{
+				delete m_pComboBox;
+				m_pComboBox = NULL;
+			}
+
+			m_pComboBox = new CInPlaceComboBox(nRow,nCol);
+			rect.bottom = rect.bottom + 200;
+			m_pComboBox->Create(WS_BORDER | WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL,rect,this,10001);
+//						DWORD dwStyle = m_pComboBox->GetStyle();
+//						dwStyle &= ~CBS_SORT;
+//						SetWindowLong(m_pComboBox->m_hWnd, GWL_STYLE, dwStyle);
+			POSITION pos = m_pComboData->GetHeadPosition();
+			while(pos)
+			{
+				m_pComboBox->AddString(m_pComboData->GetNext(pos));
+			}
+
+			m_pComboBox->ShowDropDown();
+			m_pComboBox->SetCurSel(0);
+			
+			m_pComboBox->ShowWindow(SW_SHOW);
+		}
+
+		if(m_nInPlaceCtrl == INPLACECTRL_EDIT_COMBO)
+		{
+			if(m_pEditCtrlCols)
+			{
+				for(int i=0;i<m_nEditCtrlLength;i++)
+				{
+					if(nCol == m_pEditCtrlCols[i])
+					{
+						if(m_pEdit)
+						{
+							delete m_pEdit;
+							m_pEdit = NULL;
+						}
+
+						m_pEdit = new CInPlaceEdit(nRow,nCol,m_strInitEditText);
+						m_pEdit->Create(WS_BORDER | WS_CHILD | WS_VISIBLE,rect,this,10000);
+						m_pEdit->ShowWindow(SW_SHOW);
+					}
+				}
+			}
+			
+			if(m_pComboCtrlCols)
+			{
+				for(int j=0;j<m_nComboCtrlLength;j++)
+				{			
+					if(nCol == m_pComboCtrlCols[j])
+					{
+						if(m_pComboBox)
+						{
+							delete m_pComboBox;
+							m_pComboBox = NULL;
+						}
+
+						m_pComboBox = new CInPlaceComboBox(nRow,nCol);
+						rect.bottom = rect.bottom + 200;
+						m_pComboBox->Create(WS_BORDER | WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_VSCROLL,rect,this,10001);
+//						DWORD dwStyle = m_pComboBox->GetStyle();
+//						dwStyle &= ~CBS_SORT;
+//						SetWindowLong(m_pComboBox->m_hWnd, GWL_STYLE, dwStyle);
+
+						if(!m_pComboData)
+							return;
+
+						if(m_nComboDataState == COMBODATASTATE_SINGLE)
+						{
+							POSITION pos = m_pComboData->GetHeadPosition();
+							while(pos)
+							{
+								m_pComboBox->AddString(m_pComboData->GetNext(pos));
+							}
+						}
+						
+						if(m_nComboDataState == COMBODATASTATE_MULTI)
+						{
+							POSITION pos = m_pComboData->FindIndex(j);
+
+							if(!pos)
+								return;
+							
+							CString strData = m_pComboData->GetAt(pos);
+							CString strToken;
+
+							for(int k=0;k<strData.GetLength();k++)
+							{
+								TCHAR ch = strData.GetAt(k);
+
+								if(ch == ',')
+								{
+									m_pComboBox->AddString(strToken);
+									strToken.Empty();
+								}
+								else
+									strToken += ch;
+							}
+							m_pComboBox->AddString(strToken);
+						}
+
+						m_pComboBox->ShowDropDown();
+						m_pComboBox->SetCurSel(0);
+
+						m_pComboBox->ShowWindow(SW_SHOW);					
+					}
+				}
+			}
+		}
+	}
+}
+
+
+void CSISListCtrlExt::AddBlankItem()
+{
+	int nRow;
+	nRow = GetCountPerPage();
+
+	if(GetItemCount()<nRow)
+	{
+		for(int i=0;i<nRow;i++)
+		{
+			for(int j=0;j<m_nColNum;j++)
+			{
+				if(GetItemText(i,j) == "")
+					InsertListItemEx(i,j,"");
+			}
+		}
+	}
+}
+
+void CSISListCtrlExt::SetColNum(int nColNum)
+{
+	m_nColNum = nColNum;
+}
+
+CImageList* CSISListCtrlExt::SetImageList(CImageList* pImageList, int nImageListType)
+{
+	if (pImageList)
+	{
+		m_bSetImageList = TRUE;
+		return CListCtrl::SetImageList(pImageList, nImageListType);
+	}
+
+	return NULL;
+}
+
+void CSISListCtrlExt::InsertListItemEx(int nRow, int nCol, const CString& strString)
+{
+	LV_ITEM item;
+	
+	item.mask = LVIF_TEXT;
+	item.iItem = nRow;
+	item.iSubItem = nCol;
+	item.pszText = (LPWSTR)(LPCTSTR)strString;
+	InsertItem(&item);
+	
+	item.iSubItem = nCol;
+	item.pszText = (LPWSTR)(LPCTSTR)strString;
+	SetItem(&item);
+}
+
+void CSISListCtrlExt::InsertListItemEx(int nRow, int nCol, int nValue)
+{
+	CString strValue = _T("");
+	strValue.Format(_T("%d"), nValue);
+	
+	LV_ITEM item;
+	
+	item.mask = LVIF_TEXT | LVIF_IMAGE;
+	item.iItem = nRow;
+	item.iSubItem = nCol;
+	item.pszText = (LPWSTR)(LPCTSTR)strValue;
+	InsertItem(&item);
+	
+	item.iSubItem = nCol;
+	item.pszText = (LPWSTR)(LPCTSTR)strValue;
+	SetItem(&item);
+}
+
+void CSISListCtrlExt::InsertListItemEx(int nRow, int nCol, double dValue, int nRight)
+{
+	CString strValue = _T("");
+	strValue.Format(_T("%f"), dValue);
+	int nPoint = strValue.ReverseFind('.');
+	if (nPoint > 0 && nPoint + 1 < strValue.GetLength() - nRight)
+		strValue = strValue.Left(nPoint + 4);
+	
+	LV_ITEM item;
+	
+	item.mask = LVIF_TEXT | LVIF_IMAGE;
+	item.iItem = nRow;
+	item.iSubItem = nCol;
+	item.pszText = (LPWSTR)(LPCTSTR)strValue;
+	InsertItem(&item);
+	
+	item.iSubItem = nCol;
+	item.pszText = (LPWSTR)(LPCTSTR)strValue;
+	SetItem(&item);
+}
+
+void CSISListCtrlExt::EditDisableRows(int nRows)
+{
+	SetEditDisableState(EDITDISABLE_NONE);
+	m_nDisableRow = nRows;
+	m_nEditDisableState = EDITDISABLE_ROWS;
+}
+
+void CSISListCtrlExt::EditDisableCols(int nCols)
+{
+	SetEditDisableState(EDITDISABLE_NONE);
+	m_nDisableCol = nCols;
+	m_nEditDisableState = EDITDISABLE_COLS;
+}
+
+void CSISListCtrlExt::EditDisableRowCol(int nRow, int nCol)
+{
+	SetEditDisableState(EDITDISABLE_NONE);
+	m_nDisableRow = nRow;
+	m_nDisableCol = nCol;
+	m_nEditDisableState = EDITDISABLE_ROWCOL;
+}
+
+void CSISListCtrlExt::EditDisableCols(CString strCols,int nLength)
+{
+	if(m_pEditDisableCols)
+	{
+		delete m_pEditDisableCols;
+		m_pEditDisableCols = NULL;
+	}
+	
+	m_pEditDisableCols = new int[nLength];
+	m_nLength = nLength;
+	int nCol = 0;
+
+	CString strToken;
+	for(int i=0;i<strCols.GetLength();i++)
+	{
+		TCHAR ch = strCols.GetAt(i);
+
+		if(ch == ',')
+		{
+			m_pEditDisableCols[nCol++] = _ttoi(strToken);
+			strToken.Empty();
+		}
+		else
+			strToken += ch;
+	}
+	m_pEditDisableCols[nLength-1] = _ttoi(strToken);
+	
+	m_nEditDisableState = EDITDISABLE_COLS_ARRAY;
+}
+
+void CSISListCtrlExt::EditDisableRows(CString strRows,int nLength)
+{
+	if(m_pEditDisableRows)
+	{
+		delete m_pEditDisableRows;
+		m_pEditDisableRows = NULL;
+	}
+	
+	m_pEditDisableRows = new int[nLength];
+	m_nLength = nLength;
+	int nRow = 0;
+
+	CString strToken;
+	for(int i=0;i<strRows.GetLength();i++)
+	{
+		TCHAR ch = strRows.GetAt(i);
+
+		if(ch == ',')
+		{
+			m_pEditDisableRows[nRow++] = _ttoi(strToken);
+			strToken.Empty();
+		}
+		else
+			strToken += ch;
+	}
+	m_pEditDisableRows[nLength-1] = _ttoi(strToken);
+	
+	m_nEditDisableState = EDITDISABLE_ROWS_ARRAY;
+}
+
+int CSISListCtrlExt::GetEditDisableState()
+{
+	return m_nEditDisableState;  
+}
+
+int CSISListCtrlExt::GetEditDisableRows()
+{
+	return m_nDisableRow;
+}
+
+int CSISListCtrlExt::GetEditDisableCols()
+{
+	return m_nDisableCol;
+}
+
+void CSISListCtrlExt::SetEditDisableState(int nState)
+{
+	if(EDITDISABLE_NONE)
+	{
+		m_nDisableRow = -1;
+		m_nDisableCol = -1;
+		m_nEditDisableState = EDITDISABLE_NONE;
+	}
+}
+
+void CSISListCtrlExt::SetDefaultEditText(CString strInitText)
+{
+	m_strInitEditText = strInitText;
+}
+
+void CSISListCtrlExt::SetInPlaceCtrl(int nCtrl)
+{
+	if(m_pEditCtrlCols)
+	{
+		delete m_pEditCtrlCols;
+		m_pEditCtrlCols = NULL;
+	}
+
+	if(m_pComboCtrlCols)
+	{
+		delete m_pComboCtrlCols;
+		m_pComboCtrlCols = NULL;
+	}
+
+	m_nInPlaceCtrl = nCtrl;
+}
+
+void CSISListCtrlExt::InitListHeader(TCHAR *colList[], int *widthList, int nLength, int nHeight)
+{
+	LV_COLUMN lvcolumn;
+
+	for(int i=0; i < nLength; i++) 
+	{
+		lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
+		lvcolumn.fmt = LVCFMT_LEFT;
+		lvcolumn.pszText= colList[i];
+		lvcolumn.iSubItem= i;
+		lvcolumn.cx= widthList[i];
+		InsertColumn(i, &lvcolumn);
+	}
+	
+	if (!m_bSetImageList)
+	{
+		// 府胶飘狼 row 臭捞 炼例
+		CImageList m_image;
+		m_image.Create(1, nHeight, ILC_COLORDDB, 1, 0); //2锅掳 颇扼固磐肺 臭捞炼例.....
+		SetImageList(&m_image, LVSIL_SMALL);
+	}
+ 
+	SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
+}
+
+void CSISListCtrlExt::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if (GetFocus() != this) 
+		SetFocus();
+	
+	CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CSISListCtrlExt::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if (GetFocus() != this) 
+		SetFocus();
+	
+	CListCtrl::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CSISListCtrlExt::OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+	// TODO: Add your control notification handler code here
+
+	if(m_bEnableSortList)
+		SortListCtrl(pNMListView->iSubItem);
+	
+	*pResult = 0;
+}
+
+void CSISListCtrlExt::SortListCtrl(int nCol)
+{
+	CSortClass csc(this, nCol , 0);
+
+	if(m_bSortOrder)
+		m_bSortOrder = FALSE;
+	else
+		m_bSortOrder = TRUE;
+
+	    
+	csc.Sort(m_bSortOrder?1:0);
+}
+
+void CSISListCtrlExt::SetEnableSortList(BOOL nEnable)
+{
+	m_bEnableSortList = nEnable;
+}
+
+
+BOOL CSISListCtrlExt::GetEnableSortList()
+{
+	return m_bEnableSortList;
+}
+
+
+void CSISListCtrlExt::SetComboData(TCHAR *pData[], int nState , int nLength)
+{
+	if(m_nInPlaceCtrl == INPLACECTRL_EDIT)
+		return;
+
+	if(m_pComboData)
+	{
+		m_pComboData->RemoveAll();
+		delete m_pComboData;
+		m_pComboData = NULL;
+	}
+
+	m_pComboData = new CStringList;
+
+	for(int i=0;i<nLength;i++)
+	{
+		m_pComboData->AddTail((LPSTR)(LPCSTR)pData[i]);
+	}
+	m_nComboDataState = nState;
+}
+
+void CSISListCtrlExt::SetComboData(CStringList* pList, int nState)
+{
+	if(m_nInPlaceCtrl == INPLACECTRL_EDIT)
+		return;
+
+	if(m_pComboData)
+	{
+		m_pComboData->RemoveAll();
+		delete m_pComboData;
+		m_pComboData = NULL;
+	}
+
+	m_pComboData = new CStringList;
+
+	POSITION pos = pList->GetHeadPosition();
+
+	while(pos)
+	{
+		m_pComboData->AddTail(pList->GetNext(pos));
+	}
+
+	m_nComboDataState = nState;
+}
+
+void CSISListCtrlExt::SetEditCtrlCols(CString strCols, int nLength)
+{
+	if(m_pEditCtrlCols)
+	{
+		delete m_pEditCtrlCols;
+		m_pEditCtrlCols = NULL;
+	}
+	
+	m_pEditCtrlCols = new int[nLength];
+	m_nEditCtrlLength = nLength;
+	int nCol = 0;
+
+	CString strToken;
+	for(int i=0;i<strCols.GetLength();i++)
+	{
+		TCHAR ch = strCols.GetAt(i);
+
+		if(ch == ',')
+		{
+			m_pEditCtrlCols[nCol++] = _ttoi(strToken);
+			strToken.Empty();
+		}
+		else
+			strToken += ch;
+	}
+	m_pEditCtrlCols[nLength-1] = _ttoi(strToken);
+
+	m_nInPlaceCtrl = INPLACECTRL_EDIT_COMBO;
+}
+
+void CSISListCtrlExt::SetComboCtrlCols(CString strCols, int nLength)
+{
+	if(m_pComboCtrlCols)
+	{
+		delete m_pComboCtrlCols;
+		m_pComboCtrlCols = NULL;
+	}
+	
+	m_pComboCtrlCols = new int[nLength];
+	m_nComboCtrlLength = nLength;
+	int nCol = 0;
+
+	CString strToken;
+	for(int i=0;i<strCols.GetLength();i++)
+	{
+		TCHAR ch = strCols.GetAt(i);
+
+		if(ch == ',')
+		{
+			m_pComboCtrlCols[nCol++] = _ttoi(strToken);
+			strToken.Empty();
+		}
+		else
+			strToken += ch;
+	}
+	m_pComboCtrlCols[nLength-1] = _ttoi(strToken);
+
+	m_nInPlaceCtrl = INPLACECTRL_EDIT_COMBO;
+}
+
+void CSISListCtrlExt::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
+{
+	NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
+
+	*pResult = CDRF_DODEFAULT;
+	if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
+		*pResult = CDRF_NOTIFYITEMDRAW;
+	else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
+	{
+		int nItem = static_cast<int>(pLVCD->nmcd.dwItemSpec);	// 阿 扼牢 汲沥
+
+		COLORREF crTextColor = RGB(0,0,0), crBkColor = RGB(255,255,255);
+		pListRowColor pLRC = NULL;
+		POSITION pos = NULL;
+
+		// 臂磊祸 官操扁
+		pos = m_ListColorText.GetHeadPosition();
+		while (pos)
+		{
+			pLRC = m_ListColorText.GetNext(pos);
+			if (pLRC && pLRC->s_nRow == nItem)
+				break;
+		}
+		if (pLRC)
+			pLVCD->clrText = pLRC->s_Color;
+
+		// 硅版祸 官操扁
+		pos = m_ListColorBk.GetHeadPosition();
+		while (pos)
+		{
+			pLRC = m_ListColorBk.GetNext(pos);
+			if (pLRC && pLRC->s_nRow == nItem)
+				break;
+		}
+		if (pLRC)
+			pLVCD->clrTextBk = pLRC->s_Color;
+
+		// Tell Windows to paint the control itself;
+		*pResult = CDRF_DODEFAULT;
+	}
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/SortClass.cpp b/Common_Class/SISControls/SortClass.cpp
new file mode 100644
index 0000000..390b665
--- /dev/null
+++ b/Common_Class/SISControls/SortClass.cpp
@@ -0,0 +1,143 @@
+#include "stdafx.h"
+#include "SortClass.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CSortClass
+CSortClass::CSortClass(CListCtrl * _pWnd, const int _iCol, const bool _bIsNumeric )
+{	
+	iCol = _iCol;	
+	pWnd = _pWnd;	
+	bIsNumeric = _bIsNumeric;		
+	ASSERT(pWnd);
+	int max = pWnd->GetItemCount();	
+	DWORD dw;	
+	CString txt;	
+	if (bIsNumeric)	
+	{
+		for (int t = 0; t < max; t++)		
+		{			
+			dw = static_cast<DWORD>(pWnd->GetItemData(t));
+			txt = pWnd->GetItemText(t, iCol);
+			pWnd->SetItemData(t, (DWORD) new CSortItemInt(dw, txt));		
+		}	
+	}	
+	else
+	{
+		for (int t = 0; t < max; t++)	
+		{			
+			dw = static_cast<DWORD>(pWnd->GetItemData(t));
+			txt = pWnd->GetItemText(t, iCol);
+			pWnd->SetItemData(t, (DWORD) new CSortItem(dw, txt));
+		}
+	}
+}
+CSortClass::~CSortClass()
+{	
+	ASSERT(pWnd);
+	int max = pWnd->GetItemCount();
+	if (bIsNumeric)	
+	{		
+		CSortItemInt * pItem;		
+		for (int t = 0; t < max; t++)	
+		{
+			pItem = (CSortItemInt *) pWnd->GetItemData(t);			ASSERT(pItem);
+			pWnd->SetItemData(t, pItem->dw);	
+			if (pItem)
+			{
+				delete pItem;
+				pItem = NULL;
+			}
+		}
+	}	
+	else
+	{
+		CSortItem * pItem;
+		for (int t = 0; t < max; t++)
+		{
+			pItem = (CSortItem *) pWnd->GetItemData(t);
+			ASSERT(pItem);
+			pWnd->SetItemData(t, pItem->dw);
+			if (pItem)
+			{
+				delete pItem;
+				pItem = NULL;
+			}
+			
+		}
+	}
+}
+
+void CSortClass::Sort(const bool bAsc)
+{	
+	if (bIsNumeric)	
+	{		
+		if (bAsc)
+			pWnd->SortItems(CompareAscI, 0L);
+		else	
+			pWnd->SortItems(CompareDesI, 0L);
+	}
+	else
+	{	
+		if (bAsc)	
+			pWnd->SortItems(CompareAsc, 0L);	
+		else
+			pWnd->SortItems(CompareDes, 0L);
+	}
+}
+
+int CALLBACK CSortClass::CompareAsc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+{	
+	CSortItem * i1 = (CSortItem *) lParam1;
+	CSortItem * i2 = (CSortItem *) lParam2;	
+	ASSERT(i1 && i2);
+	return i1->txt.CompareNoCase(i2->txt);
+}
+
+int CALLBACK CSortClass::CompareDes(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+{	
+	CSortItem * i1 = (CSortItem *) lParam1;
+	CSortItem * i2 = (CSortItem *) lParam2;	
+	ASSERT(i1 && i2);
+	return i2->txt.CompareNoCase(i1->txt);
+}
+
+int CALLBACK CSortClass::CompareAscI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+{	CSortItemInt * i1 = (CSortItemInt *) lParam1;
+	CSortItemInt * i2 = (CSortItemInt *) lParam2;
+	ASSERT(i1 && i2);
+	if (i1->iInt == i2->iInt) 
+		return 0;	
+	return i1->iInt > i2->iInt ? 1 : -1;
+}
+
+int CALLBACK CSortClass::CompareDesI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
+{	
+	CSortItemInt * i1 = (CSortItemInt *) lParam1;
+	CSortItemInt * i2 = (CSortItemInt *) lParam2;
+	ASSERT(i1 && i2);
+	if (i1->iInt == i2->iInt)
+		return 0;	
+	return i1->iInt < i2->iInt ? 1 : -1;
+}
+
+CSortClass::CSortItem::CSortItem(const DWORD _dw, const CString & _txt)
+{
+	dw = _dw;
+	txt = _txt;
+}
+
+CSortClass::CSortItem::~CSortItem()
+{
+}
+
+CSortClass::CSortItemInt::CSortItemInt(const DWORD _dw, const CString & _txt)
+{
+	iInt = _ttoi(_txt);	
+	dw = _dw;
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/StaticMap.cpp b/Common_Class/SISControls/StaticMap.cpp
new file mode 100644
index 0000000..8ec7a11
--- /dev/null
+++ b/Common_Class/SISControls/StaticMap.cpp
@@ -0,0 +1,565 @@
+// StaticMap.cpp : implementation file
+//
+
+#include "stdafx.h"
+// #include "	\ add additional includes here"
+#include "StaticMap.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+#define ID_TIMER_BLINK		9001
+
+/////////////////////////////////////////////////////////////////////////////
+// CStaticMap
+
+CStaticMap::CStaticMap()
+{
+	m_pParentWnd			= NULL;
+	m_nMapWidth				= 0;
+	m_nMapHeight			= 0;
+
+	m_OriginDir				= OD_LeftBottom;
+	m_nUnitSize				= 0;
+
+	m_bShowShot				= FALSE;
+
+	m_hDrawingSurface		= NULL;
+	m_RectDrawingSurface	= CRect(0, 0, 0, 0);
+	memset(&m_BMIH, 0, sizeof(BITMAPINFOHEADER));
+	m_pDrawingSurfaceBits	= NULL;
+	
+	m_dRatio				= 1.0;
+	m_RectWnd.SetRect(0, 0, 0, 0);
+	m_RectMap.SetRect(0, 0, 0, 0);
+	m_PointWindowStart.x	= 0;
+	m_PointWindowStart.y	= 0;
+	m_bDragMove				= FALSE;
+	m_bIsMiniMap			= FALSE;
+	m_PointGlassStart.x		= 0;
+	m_PointGlassStart.y		= 0;
+	m_PointGlassEnd.x		= 0;
+	m_PointGlassEnd.y		= 0;
+	m_nCoordGabX			= 2;
+	m_nCoordGabY			= 2;
+
+	m_nCCutSize				= 20;
+	m_clBGColor				= RGB(0,0,0);
+	m_clPatColor			= RGB(20,220,20);
+}
+
+CStaticMap::~CStaticMap()
+{
+	DeinitGlass();
+}
+
+BEGIN_MESSAGE_MAP(CStaticMap, CStatic)
+	//{{AFX_MSG_MAP(CStaticMap)
+	ON_WM_PAINT()
+	ON_WM_TIMER()
+	ON_WM_LBUTTONDBLCLK()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_LBUTTONUP()
+	ON_WM_RBUTTONDBLCLK()
+	ON_WM_RBUTTONDOWN()
+	ON_WM_RBUTTONUP()
+	ON_WM_MOUSEMOVE()
+	ON_WM_MOUSEWHEEL()
+	ON_CONTROL_RANGE(BN_CLICKED, _MENU_DEFECT_LIST_ID_, _MENU_DEFECT_LIST_ID_+3, OnMenuChangeViewMode)
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CStaticMap message handlers
+void CStaticMap::InitGlass(CWnd* pParent, int nMapWidth, int nMapHeight, int nMapMargin)
+{
+	if (!pParent || nMapWidth <= 0 || nMapHeight <= 0)
+		return;
+
+	m_pParentWnd = pParent;
+	m_nMapWidth = nMapWidth;
+	m_nMapHeight = nMapHeight;
+
+	GetClientRect(m_RectWnd);
+
+	m_nUnitSize = m_nMapWidth / m_RectWnd.Width();
+	
+	float fMapWperH = static_cast<float>(m_nMapWidth) / static_cast<float>(m_nMapHeight);
+	float fWndWperH = static_cast<float>(m_RectWnd.Width()) / static_cast<float>(m_RectWnd.Height());
+	if (fMapWperH > fWndWperH)
+	{
+		m_nMapTotalWidth = m_nMapWidth + nMapMargin * 2;
+		m_nMapTotalHeight = static_cast<int>(static_cast<float>(m_nMapTotalWidth) * fWndWperH);
+
+		m_nMapMarginWidth = nMapMargin;
+		m_nMapMarginHeight = (m_nMapTotalHeight - m_nMapHeight) / 2;
+	}
+	else
+	{
+		m_nMapTotalHeight = m_nMapHeight + nMapMargin * 2;
+		m_nMapTotalWidth = static_cast<int>(static_cast<float>(m_nMapTotalHeight) * fWndWperH);
+		
+		m_nMapMarginHeight = nMapMargin;
+		m_nMapMarginWidth = (m_nMapTotalWidth - m_nMapWidth) / 2;
+	}	
+	m_RectMap.SetRect(m_nMapMarginWidth, m_nMapMarginHeight, m_nMapMarginWidth + m_nMapWidth, m_nMapMarginHeight + m_nMapHeight);
+
+	// Review Map 历厘阑 困茄 霖厚
+	GetWindowRect(&m_RectDrawingSurface);
+	ScreenToClient(&m_RectDrawingSurface);
+	CDC* pDC = GetDC();
+	if(pDC != NULL)
+	{
+		m_BMIH.biSize = sizeof(BITMAPINFOHEADER);
+		m_BMIH.biBitCount = 24;
+		m_BMIH.biPlanes = 1;
+		m_BMIH.biCompression = BI_RGB;
+		m_BMIH.biWidth = m_RectDrawingSurface.Width();
+		m_BMIH.biHeight = m_RectDrawingSurface.Height();
+		m_BMIH.biSizeImage = ((((m_BMIH.biWidth * m_BMIH.biBitCount) + 31) & ~31) >> 3) * m_BMIH.biHeight;
+		DeinitGlass();
+		m_hDrawingSurface = CreateDIBSection(pDC->GetSafeHdc(), (CONST BITMAPINFO*)&m_BMIH, DIB_RGB_COLORS
+										, (void**)&m_pDrawingSurfaceBits, NULL, 0);
+		ReleaseDC(pDC);
+	}
+}
+
+void CStaticMap::DeinitGlass()
+{
+	if (m_hDrawingSurface != NULL)
+	{
+		DeleteObject(m_hDrawingSurface);
+		m_hDrawingSurface = NULL;
+	}
+}
+
+void CStaticMap::SetMappingMode(CDC *pDC)
+{
+	pDC->SetMapMode(MM_ANISOTROPIC);
+	if (m_OriginDir == OD_LeftTop)
+	{
+		pDC->SetWindowExt(m_nMapTotalWidth, m_nMapTotalHeight);
+		pDC->SetViewportOrg(m_PointWindowStart.x, m_PointWindowStart.y);
+	}
+	else if (m_OriginDir == OD_LeftBottom)
+	{
+		pDC->SetWindowExt(m_nMapTotalWidth, -1 * m_nMapTotalHeight);
+		pDC->SetViewportOrg(m_PointWindowStart.x, m_RectWnd.bottom - m_PointWindowStart.y);
+	}
+	else if (m_OriginDir == OD_RightTop)
+	{
+		pDC->SetWindowExt(-1 * m_nMapTotalWidth, m_nMapTotalHeight);
+		pDC->SetViewportOrg(m_RectWnd.right - m_PointWindowStart.x, m_PointWindowStart.y);
+	}
+	else if (m_OriginDir == OD_RightBottom)
+	{
+		pDC->SetWindowExt(-1 * m_nMapTotalWidth, -1 * m_nMapTotalHeight);
+		pDC->SetViewportOrg(m_RectWnd.right - m_PointWindowStart.x, m_RectWnd.bottom - m_PointWindowStart.y);
+	}
+
+	pDC->SetViewportExt(static_cast<int>(m_RectWnd.right * m_dRatio), static_cast<int>(m_RectWnd.bottom * m_dRatio));
+}
+
+void CStaticMap::IncreaseRatio()
+{
+	if (!m_bIsMiniMap)
+	{
+		m_dRatio = m_dRatio + 0.5;
+		if (m_dRatio > 4.0)
+			m_dRatio = 4.0;
+
+		// 啊款单甫 扁霖栏肺 颗变促.
+		m_PointWindowStart.x = static_cast<int>((m_RectWnd.right * m_dRatio - m_RectWnd.Width()) / 2) * -1;
+		m_PointWindowStart.y = static_cast<int>((m_RectWnd.bottom * m_dRatio - m_RectWnd.Height()) / 2) * -1;
+
+		// 康开捞 哈绢唱瘤 臼档废 抗寇贸府.
+		if (m_PointWindowStart.x > 0)
+			m_PointWindowStart.x = 0;
+		else if (m_PointWindowStart.x < m_RectWnd.right * m_dRatio * -1 + m_RectWnd.Width())
+			m_PointWindowStart.x = static_cast<int>(m_RectWnd.right * m_dRatio) * -1 + m_RectWnd.Width();
+		if (m_PointWindowStart.y > 0)
+			m_PointWindowStart.y = 0;
+		else if (m_PointWindowStart.y < m_RectWnd.bottom * m_dRatio * -1 + m_RectWnd.Height())
+			m_PointWindowStart.y = static_cast<int>(m_RectWnd.bottom * m_dRatio) * -1 + m_RectWnd.Height();
+
+		m_PointGlassStart = SetWindowToGlass(CPoint(0, 0));
+		m_PointGlassEnd = SetWindowToGlass(CPoint(m_RectWnd.right, m_RectWnd.bottom));
+
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_CHANGED, 0, 0);
+
+		Invalidate();
+	}
+}
+
+void CStaticMap::DecreaseRatio()
+{
+	if (!m_bIsMiniMap)
+	{
+		m_dRatio = m_dRatio - 0.5;
+		if (m_dRatio < 1)
+			m_dRatio = 1.0;
+
+		// 啊款单甫 扁霖栏肺 颗变促.
+		m_PointWindowStart.x = static_cast<int>((m_RectWnd.right * m_dRatio - m_RectWnd.Width()) / 2) * -1;
+		m_PointWindowStart.y = static_cast<int>((m_RectWnd.bottom * m_dRatio - m_RectWnd.Height()) / 2) * -1;
+
+		// 康开捞 哈绢唱瘤 臼档废 抗寇贸府.
+		if (m_PointWindowStart.x > 0)
+			m_PointWindowStart.x = 0;
+		else if (m_PointWindowStart.x < m_RectWnd.right * m_dRatio * -1 + m_RectWnd.Width())
+			m_PointWindowStart.x = static_cast<int>(m_RectWnd.right * m_dRatio) * -1 + m_RectWnd.Width();
+		if (m_PointWindowStart.y > 0)
+			m_PointWindowStart.y = 0;
+		else if (m_PointWindowStart.y < m_RectWnd.bottom * m_dRatio * -1 + m_RectWnd.Height())
+			m_PointWindowStart.y = static_cast<int>(m_RectWnd.bottom * m_dRatio) * -1 + m_RectWnd.Height();
+
+		m_PointGlassStart = SetWindowToGlass(CPoint(0, 0));
+		m_PointGlassEnd = SetWindowToGlass(CPoint(m_RectWnd.right, m_RectWnd.bottom));
+
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_CHANGED, 0, 0);
+
+		Invalidate();
+	}
+}
+
+void CStaticMap::ResetRatio()
+{
+	if (!m_bIsMiniMap)
+	{
+		m_dRatio = 1.0;
+
+		m_PointWindowStart.x = 0;
+		m_PointWindowStart.y = 0;
+
+		m_PointGlassStart = SetWindowToGlass(CPoint(0, 0));
+		m_PointGlassEnd = SetWindowToGlass(CPoint(m_RectWnd.right, m_RectWnd.bottom));
+
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_CHANGED, 0, 0);
+
+		Invalidate();
+	}
+}
+
+void CStaticMap::SetDisplayRect(CPoint& PointStart, CPoint& PointEnd)
+{
+	m_PointGlassStart = PointStart;
+	m_PointGlassEnd = PointEnd;
+}
+
+void CStaticMap::OnPaint() 
+{
+	CPaintDC dc(this); // device context for painting
+	
+	// TODO: Add your message handler code here
+	/*
+	// Glass 弊府扁.
+	CPen PenGlass, *pOldPen;
+	CBrush BrushGlass, *pOldBrush;
+	PenGlass.CreatePen(PS_SOLID, 0, m_clBGColor);
+	BrushGlass.CreateSolidBrush(m_clBGColor);
+	pOldBrush = (CBrush*)memdc.SelectObject(&BrushGlass);
+	pOldPen = (CPen*)memdc.SelectObject(&PenGlass);
+
+	dc.Rectangle(m_RectWnd);
+	dc.SelectObject(pOldBrush);
+	dc.SelectObject(pOldPen);
+*/
+	DrawGlass(&dc);
+
+	// 焊咯林扁 康开 荤阿屈 弊府扁.
+	if (m_bIsMiniMap)
+	{
+		CBrush BrushDisplay;
+  		CPen PenShow(PS_SOLID, 1, RGB(255,0,0));
+ 		CPen* pOldPen = (CPen*)dc.SelectObject(&PenShow);
+		BrushDisplay.CreateStockObject(NULL_BRUSH);
+		CBrush* pOldBrush = (CBrush*)dc.SelectObject(&BrushDisplay);
+		dc.Rectangle(CRect(m_PointGlassStart.x + m_RectMap.left, m_PointGlassStart.y + m_RectMap.top
+						, m_PointGlassEnd.x + m_RectMap.left, m_PointGlassEnd.y + m_RectMap.top));
+		dc.SelectObject(pOldPen);
+		dc.SelectObject(pOldBrush);
+	}
+
+	// Do not call CStatic::OnPaint() for painting messages
+}
+
+void CStaticMap::OnLButtonDblClk(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	MouseLBtnDblClk(point);
+
+	CStatic::OnLButtonDblClk(nFlags, point);
+}
+
+void CStaticMap::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	m_bDragMove = TRUE;
+	m_PointDragStart = point;
+	SetFocus();
+	MouseLBtnDwn(point);
+
+	CStatic::OnLButtonDown(nFlags, point);
+}
+
+void CStaticMap::OnLButtonUp(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	m_bDragMove = FALSE;
+	MouseLBtnUp(point);
+
+	CStatic::OnLButtonUp(nFlags, point);
+}
+
+void CStaticMap::OnRButtonDblClk(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	MouseRBtnDblClk(point);
+
+	CStatic::OnRButtonDblClk(nFlags, point);
+}
+
+void CStaticMap::OnRButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	MouseRBtnDwn(point);
+
+	CStatic::OnRButtonDown(nFlags, point);
+}
+
+void CStaticMap::OnRButtonUp(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	MouseRBtnUp(point);
+
+	CStatic::OnRButtonUp(nFlags, point);
+}
+
+void CStaticMap::PopupMenu(int nBaseID, CPoint point)
+{
+	// TODO: Add your message handler code here
+	CString strText;
+	CMenu menu;
+	VERIFY(menu.CreatePopupMenu());
+
+	menu.AppendMenu(MF_STRING, nBaseID, (LPCTSTR)"Register Nodefect(&R)");	
+
+	menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, point.x, point.y, this);
+}
+
+void CStaticMap::OnMenuChangeViewMode(UINT nID)
+{
+	nID -= _MENU_DEFECT_LIST_ID_;
+	switch(nID)
+	{
+	case 0:RegistNoDefect(); break;
+	}
+}
+
+void CStaticMap::OnMouseMove(UINT nFlags, CPoint point) 
+{	
+	// TODO: Add your message handler code here and/or call default
+	if (nFlags & MK_LBUTTON && m_bDragMove && m_dRatio > 1.0)
+	{
+		if (m_OriginDir == OD_LeftTop)
+		{
+			m_PointWindowStart.x -= (m_PointDragStart.x - point.x);
+			m_PointWindowStart.y -= (m_PointDragStart.y - point.y);
+		}
+		else if (m_OriginDir == OD_LeftBottom)
+		{
+			m_PointWindowStart.x -= (m_PointDragStart.x - point.x);
+			m_PointWindowStart.y += (m_PointDragStart.y - point.y);
+		}
+		else if (m_OriginDir == OD_RightTop)
+		{
+			m_PointWindowStart.x += (m_PointDragStart.x - point.x);
+			m_PointWindowStart.y -= (m_PointDragStart.y - point.y);
+		}
+		else if (m_OriginDir == OD_RightBottom)
+		{
+			m_PointWindowStart.x += (m_PointDragStart.x - point.x);
+			m_PointWindowStart.y += (m_PointDragStart.y - point.y);
+		}
+		TRACE("%d %d\n", m_PointWindowStart.x, m_PointWindowStart.y);
+		// 康开捞 哈绢唱瘤 臼档废 抗寇贸府.
+		if (m_PointWindowStart.x > 0)
+			m_PointWindowStart.x = 0;
+		else if (m_PointWindowStart.x < m_RectWnd.right * m_dRatio * -1 + m_RectWnd.Width())
+			m_PointWindowStart.x = static_cast<int>(m_RectWnd.right * m_dRatio) * -1 + m_RectWnd.Width();
+		if (m_PointWindowStart.y > 0)
+			m_PointWindowStart.y = 0;
+		else if (m_PointWindowStart.y < m_RectWnd.bottom * m_dRatio * -1 + m_RectWnd.Height())
+			m_PointWindowStart.y = static_cast<int>(m_RectWnd.bottom * m_dRatio) * -1 + m_RectWnd.Height();
+		m_PointDragStart = point;
+
+		// 泅犁 焊咯瘤绰 康开 舅酒郴扁.
+		m_PointGlassStart = SetWindowToGlass(CPoint(0, 0));
+		m_PointGlassEnd = SetWindowToGlass(CPoint(m_RectWnd.right, m_RectWnd.bottom));
+
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_CHANGED, 0, 0);
+
+		Invalidate();
+	}
+	MouseLBtnMove(point);
+
+	CStatic::OnMouseMove(nFlags, point);
+}
+
+void CStaticMap::OnTimer(UINT_PTR nIDEvent) 
+{
+	// TODO: Add your message handler code here and/or call default
+	Timer(static_cast<UINT>(nIDEvent));
+
+	CStatic::OnTimer(nIDEvent);
+}
+
+CPoint CStaticMap::SetWindowToGlass(CPoint pt)
+{
+	if (!GetSafeHwnd())
+		return pt;
+	
+	//逞败罐篮 拱府 谅钎甫 稠府谅钎肺 函券窍咯 泅犁 拳搁俊 唱鸥唱绰 谅钎肺 函券窍咯 馆券茄促.
+	CPaintDC dc(this);
+
+	SetMappingMode(&dc);
+
+	dc.DPtoLP(&pt);
+
+	return pt;
+}
+
+CPoint CStaticMap::SetGlassToWindow(CPoint pt)
+{
+	if (!GetSafeHwnd())
+		return pt;
+	
+	CPaintDC dc(this);
+
+	SetMappingMode(&dc);
+
+	dc.LPtoDP(&pt);
+
+	return pt;
+}
+
+void CStaticMap::SaveMapToFile(CString strFileName) 
+{
+	//Create a new file for writing
+	FILE *pFile;	
+	_wfopen_s(&pFile, strFileName, _T("wb"));
+	if(pFile == NULL)
+		return;
+
+	BITMAPFILEHEADER bmfh;	
+	int nBitsOffset = sizeof(BITMAPFILEHEADER) + m_BMIH.biSize; 
+	LONG lImageSize = m_BMIH.biSizeImage;
+	LONG lFileSize = nBitsOffset + lImageSize;
+	bmfh.bfType = 'B'+('M'<<8);			
+	bmfh.bfOffBits = nBitsOffset;		
+	bmfh.bfSize = lFileSize;				
+	bmfh.bfReserved1 = bmfh.bfReserved2 = 0;
+	//Write the bitmap file header
+	UINT nWrittenFileHeaderSize = static_cast<UINT>(fwrite(&bmfh, 1, sizeof(BITMAPFILEHEADER), pFile));
+	//And then the bitmap info header
+	UINT nWrittenInfoHeaderSize = static_cast<UINT>(fwrite(&m_BMIH, 1, sizeof(BITMAPINFOHEADER), pFile));
+	//Finally, write the image data itself -- the data represents our drawing
+	UINT nWrittenDIBDataSize = static_cast<UINT>(fwrite(m_pDrawingSurfaceBits, 1, lImageSize, pFile));
+	
+	fclose(pFile);
+}
+
+BOOL CStaticMap::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+{
+	if(zDelta < 0)
+	{
+		ControlZoom(FALSE, pt);
+	}
+	else if(zDelta > 0)
+	{
+		ControlZoom(TRUE, pt);
+	}	
+	
+	return __super::OnMouseWheel(nFlags, zDelta, pt);
+}
+
+void CStaticMap::ControlZoom(BOOL bZoomIn, CPoint ptMouse)
+{
+	CPoint ptCurPos(ptMouse);
+	ScreenToClient(&ptCurPos);
+	CPoint ptTemp(ptCurPos);
+
+	if (m_OriginDir == OD_LeftTop)
+	{
+		;
+	}
+	else if (m_OriginDir == OD_LeftBottom)
+	{
+		ptCurPos.y = m_RectWnd.Height() - ptCurPos.y;
+		ptTemp.y = m_RectWnd.Height() - ptTemp.y;
+	}
+	else if (m_OriginDir == OD_RightTop)
+	{
+		ptCurPos.x = m_RectWnd.Width() - ptCurPos.x;
+		ptTemp.x = m_RectWnd.Width() - ptTemp.x;
+	}
+	else if (m_OriginDir == OD_RightBottom)
+	{
+		ptCurPos.x = m_RectWnd.Width() - ptCurPos.x;
+		ptCurPos.y = m_RectWnd.Height() - ptCurPos.y;
+		ptTemp.x = m_RectWnd.Width() - ptTemp.x;
+		ptTemp.y = m_RectWnd.Height() - ptTemp.y;
+	}
+
+	ptCurPos -= m_PointWindowStart;
+
+	ptCurPos.x = (LONG)(ptCurPos.x / m_dRatio);
+	ptCurPos.y = (LONG)(ptCurPos.y / m_dRatio);
+
+	double dOldRatio = m_dRatio;
+
+	if(bZoomIn == FALSE)
+	{
+		m_dRatio = m_dRatio - 0.5;
+		if (m_dRatio < 1)
+			m_dRatio = 1.0;
+	}
+	else
+	{
+		m_dRatio = m_dRatio + 0.5;
+		if (m_dRatio > 4)
+			m_dRatio = 4.0;
+	}
+
+	ptCurPos.x = (LONG)(ptCurPos.x * m_dRatio);
+	ptCurPos.y = (LONG)(ptCurPos.y * m_dRatio);
+
+	//m_PointWindowStart.x = static_cast<int>(((m_RectWnd.right * m_dRatio - m_RectWnd.Width()) / 2 + (ptCurPos.x - m_RectWnd.Width() * m_dRatio / 2))) * -1;
+	//m_PointWindowStart.y = static_cast<int>(((m_RectWnd.bottom * m_dRatio - m_RectWnd.Height()) / 2 + (ptCurPos.y - m_RectWnd.Height() * m_dRatio / 2))) * -1;
+
+	m_PointWindowStart.x = (ptCurPos.x - ptTemp.x) * -1;
+	m_PointWindowStart.y = (ptCurPos.y - ptTemp.y) * -1;
+
+	// 康开捞 哈绢唱瘤 臼档废 抗寇贸府.
+	if (m_PointWindowStart.x > 0)
+		m_PointWindowStart.x = 0;
+	else if (m_PointWindowStart.x < m_RectWnd.right * m_dRatio * -1 + m_RectWnd.Width())
+		m_PointWindowStart.x = static_cast<int>(m_RectWnd.right * m_dRatio) * -1 + m_RectWnd.Width();
+	if (m_PointWindowStart.y > 0)
+		m_PointWindowStart.y = 0;
+	else if (m_PointWindowStart.y < m_RectWnd.bottom * m_dRatio * -1 + m_RectWnd.Height())
+		m_PointWindowStart.y = static_cast<int>(m_RectWnd.bottom * m_dRatio) * -1 + m_RectWnd.Height();
+
+	// 泅犁 焊咯瘤绰 康开 舅酒郴扁.
+	m_PointGlassStart = SetWindowToGlass(CPoint(0, 0));
+	m_PointGlassEnd = SetWindowToGlass(CPoint(m_RectWnd.right, m_RectWnd.bottom));
+
+	Invalidate(FALSE);
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/StdAfx.cpp b/Common_Class/SISControls/StdAfx.cpp
new file mode 100644
index 0000000..f5fa63f
--- /dev/null
+++ b/Common_Class/SISControls/StdAfx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+//	SISControls.pch will be the pre-compiled header
+//	stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
+
diff --git a/Common_Class/SISControls/StdAfx.h b/Common_Class/SISControls/StdAfx.h
new file mode 100644
index 0000000..7e5612f
--- /dev/null
+++ b/Common_Class/SISControls/StdAfx.h
@@ -0,0 +1,43 @@
+// stdafx.h : include file for standard system include files,
+//  or project specific include files that are used frequently, but
+//      are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__F0138B69_421A_4438_AE47_541D47457F34__INCLUDED_)
+#define AFX_STDAFX_H__F0138B69_421A_4438_AE47_541D47457F34__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers
+
+#include <SDKDDKVer.h>
+
+#include <afxwin.h>         // MFC core and standard components
+#include <afxext.h>         // MFC extensions
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE classes
+#include <afxodlgs.h>       // MFC OLE dialog classes
+#include <afxdisp.h>        // MFC Automation classes
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>			// MFC ODBC database classes
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>			// MFC DAO database classes
+#endif // _AFX_NO_DAO_SUPPORT
+
+#include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>			// MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__F0138B69_421A_4438_AE47_541D47457F34__INCLUDED_)
diff --git a/Common_Class/SISControls/WKButton.cpp b/Common_Class/SISControls/WKButton.cpp
new file mode 100644
index 0000000..23305ec
--- /dev/null
+++ b/Common_Class/SISControls/WKButton.cpp
@@ -0,0 +1,484 @@
+// WKButton.cpp : implementation file
+//
+
+#include "stdafx.h"
+//#include "	\ add additional includes here"
+#include "WKButton.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CWKButton
+
+CWKButton::CWKButton()
+{
+	m_rgbColor1 = RGB(255,255,255);
+	m_rgbColor2 = RGB(0,0,0);
+	m_rgbText = RGB(0,0,0);
+	m_dStyle = WK_BUTTON_COLOR_ONE;
+	m_dShape = WK_BUTTON_SHPAE_RECTANGLE;
+	m_dButtonStatus = WK_BUTTON_STATUS_MOUSELEAVE;
+	m_bValueChange = FALSE;
+
+/*	m_logFont.lfHeight = 20;
+	m_logFont.lfWidth = 0; 
+	m_logFont.lfEscapement = GM_ADVANCED; 
+	m_logFont.lfOrientation = 0; 
+	m_logFont.lfWeight = FW_DONTCARE; 
+	m_logFont.lfItalic = 0; 
+	m_logFont.lfUnderline = 0; 
+	m_logFont.lfStrikeOut = 0; 
+	m_logFont.lfCharSet = DEFAULT_CHARSET; 
+	m_logFont.lfOutPrecision = OUT_CHARACTER_PRECIS; 
+	m_logFont.lfClipPrecision = CLIP_CHARACTER_PRECIS; 
+	m_logFont.lfQuality = DEFAULT_QUALITY; 
+	m_logFont.lfPitchAndFamily = FF_DONTCARE;
+	strcpy(m_logFont.lfFaceName,"奔覆"); */
+	
+	m_Font.CreatePointFont(100,_T("奔覆"));
+	m_strCaption = _T("Button");
+}
+
+CWKButton::~CWKButton()
+{
+	
+}
+
+
+BEGIN_MESSAGE_MAP(CWKButton, CButton)
+	//{{AFX_MSG_MAP(CWKButton)
+	ON_WM_DRAWITEM()
+	ON_WM_PAINT()
+	ON_WM_CREATE()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_MOUSEMOVE()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CWKButton message handlers
+BOOL CWKButton::Create(LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
+{
+	m_rtButton = rect;
+	m_nWidth = rect.right - rect.left;
+	m_nHeight = rect.bottom - rect.top;
+	SetButtonText(lpszCaption);
+	return CButton::Create(lpszCaption, dwStyle, rect, pParentWnd, nID);
+}
+
+BOOL CWKButton::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
+{
+	// TODO: Add your specialized code here and/or call the base class
+	
+	m_rtButton = rect;
+	m_nWidth = rect.right - rect.left;
+	m_nHeight = rect.bottom - rect.top;
+	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
+}
+
+void CWKButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
+{
+	// TODO: Add your code to draw the specified item
+	
+}
+
+void CWKButton::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
+{
+	// TODO: Add your message handler code here and/or call default
+	
+	CButton::OnDrawItem(nIDCtl, lpDrawItemStruct);
+}
+
+void CWKButton::PreSubclassWindow() 
+{
+	// TODO: Add your specialized code here and/or call the base class
+	ModifyStyle(0, BS_OWNERDRAW | BS_AUTOCHECKBOX);
+	
+	CButton::PreSubclassWindow();
+}
+
+
+void CWKButton::OnPaint() 
+{
+	CPaintDC dc(this); // device context for painting
+
+	// TODO: Add your message handler code here
+	if(m_bValueChange)
+	{
+		CreateButtonImage();
+		m_bValueChange = FALSE;
+	}
+
+	CDC MemDC;
+	CRect rt;
+	CBitmap* pOldBitmap = NULL;
+	GetClientRect(&rt);
+	MemDC.CreateCompatibleDC(((CWnd*)(dc.GetWindow()))->GetDC());
+
+	switch(m_dButtonStatus)
+	{
+		case WK_BUTTON_STATUS_MOUSEOVER:
+			pOldBitmap = (CBitmap*)MemDC.SelectObject(&m_bmpImage2);
+			break;
+		case WK_BUTTON_STATUS_MOUSELEAVE:
+			pOldBitmap = (CBitmap*)MemDC.SelectObject(&m_bmpImage1);
+			break;
+		case WK_BUTTON_STATUS_MOUSECLICK:
+			pOldBitmap = (CBitmap*)MemDC.SelectObject(&m_bmpImage3);
+			break;
+	}
+	dc.BitBlt(0,0,rt.right,rt.bottom,&MemDC,0,0,SRCCOPY);
+	if (pOldBitmap)
+		dc.SelectObject(pOldBitmap);
+	// Do not call CButton::OnPaint() for painting messages
+}
+
+int CWKButton::OnCreate(LPCREATESTRUCT lpCreateStruct) 
+{
+	if (CButton::OnCreate(lpCreateStruct) == -1)
+		return -1;
+	
+	// TODO: Add your specialized creation code here
+	CPaintDC dc(this);
+
+	// 滚瓢狼 DC客 龋券 登绰 厚飘甘 积己
+	m_bmpImage1.CreateCompatibleBitmap(((CWnd*)(dc.GetWindow()))->GetDC(),m_nWidth,m_nHeight);	// 乞惑矫 捞固瘤
+	m_bmpImage2.CreateCompatibleBitmap(((CWnd*)(dc.GetWindow()))->GetDC(),m_nWidth,m_nHeight);	// 付快胶 坷滚矫 捞固瘤
+	m_bmpImage3.CreateCompatibleBitmap(((CWnd*)(dc.GetWindow()))->GetDC(),m_nWidth,m_nHeight);	// 努腐矫 捞固瘤
+
+	// 积己等 厚飘甘俊 捞固瘤 累诀
+	CreateButtonImage();	
+
+	return 0;
+}
+
+BOOL CWKButton::SetButtonStyle(DWORD dShape, DWORD dStyle, COLORREF rgbColor1, COLORREF rgbColor2)
+{
+	m_dShape = dShape;			// 葛剧 历厘
+	m_dStyle = dStyle;			// 拿矾 胶鸥老 历厘
+	m_rgbColor1 = rgbColor1;	// 霉锅掳 祸 历厘
+	m_rgbColor2 = rgbColor2;	// 滴锅掳 祸 历厘
+
+	m_bValueChange = TRUE;
+
+	return TRUE;
+}
+
+BOOL CWKButton::SetButtonStyle(DWORD dShape, COLORREF rgbColor1)
+{
+	return SetButtonStyle(dShape, WK_BUTTON_COLOR_ONE, rgbColor1, rgbColor1);
+}
+
+BOOL CWKButton::SetButtonText(CString strCaption, CFont* font, COLORREF rgbText)
+{
+	// 滚瓢 母记 历厘
+	m_strCaption = strCaption;
+
+	// 迄飘 历厘
+	LOGFONT logFont;
+	font->GetLogFont(&logFont);
+	m_Font.DeleteObject();
+	m_Font.CreateFontIndirect(&logFont);
+
+	// 臂磊祸 历厘
+	m_rgbText = rgbText;
+
+	m_bValueChange = TRUE;
+
+	if(this->m_hWnd)
+		Invalidate(FALSE);
+	return TRUE;
+}
+
+BOOL CWKButton::SetButtonText(CString strCaption)
+{
+	SetButtonText(strCaption, &m_Font, m_rgbText);
+	return TRUE;
+}
+
+BOOL CWKButton::SetButtonText(CString strCaption, COLORREF rgbText)
+{
+	SetButtonText(strCaption, &m_Font, rgbText);
+	return TRUE;
+}
+
+BOOL CWKButton::CreateButtonImage()
+{
+	switch(m_dShape)	// 滚瓢 葛剧
+	{
+		case WK_BUTTON_SHPAE_RECTANGLE:	// 荤阿屈
+			DrawFormRectangle();
+			break;
+		case WK_BUTTON_SHAPE_CIRCLE:	// 盔
+			DrawFormRectangle();
+			break;
+		case WK_BUTTON_SHAPE_ROUNDRECT:	// 嫡辟 荤阿屈
+			DrawFormRectangle();
+			break;
+	}
+	return TRUE;
+}
+
+BOOL CWKButton::DrawFormRectangle()
+{
+	switch(m_dStyle)
+	{
+		case WK_BUTTON_COLOR_ONE:
+		case WK_BUTTON_COLOR_TWO:
+		default:
+			// 乞惑矫 捞固瘤 积己
+			DrawGradation(&m_bmpImage1, m_rgbColor1, m_rgbColor2);
+			DrawBorder(&m_bmpImage1, m_rgbColor2, m_rgbColor1);
+			DrawText(&m_bmpImage1,WK_BUTTON_STATUS_MOUSELEAVE);
+			// 付快胶 坷滚
+			DrawGradation(&m_bmpImage2, LightValueControl(m_rgbColor1,+50), LightValueControl(m_rgbColor2,+50));
+			DrawBorder(&m_bmpImage2, LightValueControl(m_rgbColor2,+50), LightValueControl(m_rgbColor1,+50));
+			DrawText(&m_bmpImage2,WK_BUTTON_STATUS_MOUSEOVER);
+			// 努腐矫
+			DrawGradation(&m_bmpImage3, LightValueControl(m_rgbColor1,+20), LightValueControl(m_rgbColor2,+20));
+			DrawBorder(&m_bmpImage3, LightValueControl(m_rgbColor1,-50), LightValueControl(m_rgbColor2,-50), 1);
+			DrawText(&m_bmpImage3,WK_BUTTON_STATUS_MOUSECLICK);
+			break;
+	}
+	return TRUE;
+}
+
+BOOL CWKButton::DrawFormCircle()
+{
+	return TRUE;
+}
+
+BOOL CWKButton::DrawFormRoundRect()
+{
+	return TRUE;
+}
+
+
+void CWKButton::DrawGradation(CBitmap* bmpImage, COLORREF color1, COLORREF color2)
+{
+	CPaintDC dc(this);
+	CDC BufferDC;
+	CBitmap* pOldBitmap;
+	BufferDC.CreateCompatibleDC(((CWnd*)(dc.GetWindow()))->GetDC());
+	
+	pOldBitmap = (CBitmap*)BufferDC.SelectObject(bmpImage);
+
+	int C1Red, C1Green, C1Blue, C2Red, C2Green, C2Blue, x, y;
+	
+	// color1狼 祸惑喊 蔼阑 盒幅
+	C1Red	= GetRValue(color1);
+	C1Green	= GetGValue(color1);
+	C1Blue	= GetBValue(color1);
+
+	// color2狼 祸惑喊 蔼阑 盒幅
+	C2Red	= GetRValue(color2);
+	C2Green	= GetGValue(color2);
+	C2Blue	= GetBValue(color2);
+
+	float StepRed, StepGreen, StepBlue;
+	COLORREF StepRGB;
+	
+	switch(m_dStyle)
+	{
+		case WK_BUTTON_COLOR_GRADATION_RIGHT:	// 坷弗率 规氢栏肺
+			StepRed		= ((float)C1Red		- (float)C2Red)		/(float)m_nWidth;	// RED狼 窜拌喊 刘啊蔼 备窍扁
+			StepGreen	= ((float)C1Green	- (float)C2Green)	/(float)m_nWidth;	// GREEN狼 窜拌喊 刘啊蔼 备窍扁
+			StepBlue	= ((float)C1Blue	- (float)C2Blue)	/(float)m_nWidth;	// BLUE狼 窜拌喊 刘啊蔼 备窍扁
+			for(x = 0; x <= m_nWidth; x++)
+			{
+				StepRGB = RGB(C1Red - (int)(StepRed * x),
+							C1Green - (int)(StepGreen * x),
+							C1Blue - (int)(StepBlue * x));		// 窜拌喊 RGB 蔼 父甸扁
+				for(y = 0; y <= m_nHeight; y++)
+					BufferDC.SetPixel(x, y, StepRGB);			// 窜拌喊 扼牢栏肺 免仿
+			}
+			break;
+			
+		case WK_BUTTON_COLOR_GRADATION_LEFT:	// 哭率 规氢栏肺
+			StepRed		= ((float)C1Red		- (float)C2Red)		/(float)m_nWidth;
+			StepGreen	= ((float)C1Green	- (float)C2Green)	/(float)m_nWidth;
+			StepBlue	= ((float)C1Blue	- (float)C2Blue)	/(float)m_nWidth;
+			for(x = m_nWidth; x >= 0; x--)
+			{
+				StepRGB = RGB(C1Red - (int)(StepRed * x),
+							C1Green - (int)(StepGreen * x),
+							C1Blue - (int)(StepBlue * x));
+				for(y = 0; y <= m_nHeight; y++)
+					BufferDC.SetPixel(x, y, StepRGB);
+			}
+			break;
+			
+		case WK_BUTTON_COLOR_GRADATION_UP:		// 困率 规氢栏肺
+			StepRed		= ((float)C1Red		- (float)C2Red)		/(float)m_nHeight;
+			StepGreen	= ((float)C1Green	- (float)C2Green)	/(float)m_nHeight;
+			StepBlue	= ((float)C1Blue	- (float)C2Blue)	/(float)m_nHeight;
+			for(y = 0; y <= m_nHeight; y++)
+			{
+				StepRGB = RGB(C1Red - (int)(StepRed * y),
+							C1Green - (int)(StepGreen * y),
+							C1Blue - (int)(StepBlue * y));
+				for(x = 0; x <= m_nWidth; x++)
+					BufferDC.SetPixel(x, y, StepRGB);
+			}
+			break;
+			
+		case WK_BUTTON_COLOR_GRADATION_DOWN:	// 酒贰率 规氢栏肺
+			StepRed		= ((float)C1Red		- (float)C2Red)		/(float)m_nHeight;
+			StepGreen	= ((float)C1Green	- (float)C2Green)	/(float)m_nHeight;
+			StepBlue	= ((float)C1Blue	- (float)C2Blue)	/(float)m_nHeight;
+			for(y = m_nHeight; y >= 0; y--)
+			{
+				StepRGB = RGB(C1Red - (int)(StepRed * y),
+							C1Green - (int)(StepGreen * y),
+							C1Blue - (int)(StepBlue * y));
+				for(x = 0; x <= m_nWidth; x++)
+					BufferDC.SetPixel(x, y, StepRGB);
+			}
+			break;
+	}
+	BufferDC.SelectObject(pOldBitmap);
+}
+
+BOOL CWKButton::DrawBorder(CBitmap *pbmpImage, COLORREF color1, COLORREF color2, int nWidth)
+{
+	CPaintDC dc(this);
+	CDC BufferDC;
+	CBitmap* pOldBitmap;
+	BufferDC.CreateCompatibleDC(((CWnd*)(dc.GetWindow()))->GetDC());
+	
+	pOldBitmap = (CBitmap*)BufferDC.SelectObject(pbmpImage);
+
+	int i, j;
+	for(i = 0; i < nWidth; i++)
+		for(j = i; j <= (m_nWidth - i); j++)
+		{
+			BufferDC.SetPixel(j, i, color1);
+			BufferDC.SetPixel(j, m_nHeight - i - 1, color2);
+		}
+
+	for(i = 0; i < nWidth; i++)
+	{
+		for(j = i; j <= (m_nHeight - i - 1); j++)
+		{
+			BufferDC.SetPixel(i, j, color1);
+			BufferDC.SetPixel(m_nWidth - i - 1, j, color2);
+		}
+	}
+	BufferDC.SelectObject(pOldBitmap);
+
+	return TRUE;
+}
+
+BOOL CWKButton::DrawText(CBitmap* pBitmap, int nStatus)
+{
+	CPaintDC dc(this);
+	CDC BufferDC;
+	CBitmap* pOldBitmap;
+	CRect rt;
+	GetClientRect(&rt);
+	BufferDC.CreateCompatibleDC(((CWnd*)(dc.GetWindow()))->GetDC());
+	
+	pOldBitmap = (CBitmap*)BufferDC.SelectObject(pBitmap);
+
+	CFont *pOldFont;
+	pOldFont = (CFont*)BufferDC.SelectObject(&m_Font);
+	BufferDC.SetBkMode(TRANSPARENT);
+
+	if(nStatus == WK_BUTTON_STATUS_MOUSECLICK)
+	{	// 努腐矫 乞惑矫焊促 茄侨伎 关俊 臂揪甫 免仿茄促.
+		rt.left++;
+		rt.top++;
+		BufferDC.DrawText(m_strCaption, &rt, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
+	}
+	else
+	{
+		BufferDC.DrawText(m_strCaption, &rt, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
+	}
+	BufferDC.SelectObject(pOldFont);
+	BufferDC.SelectObject(pOldBitmap);
+	
+	return TRUE;
+}
+
+COLORREF CWKButton::LightValueControl(COLORREF rgb, int nValue)
+{
+	int r,g,b;
+	// R,G,B 蔼阑 盒府饶 nValue父怒 刘啊矫挪促.
+	b = GetBValue(rgb)+nValue;
+	g = GetGValue(rgb)+nValue;
+	r = GetRValue(rgb)+nValue;
+
+	if(b<0)
+		b = 0;
+	if(b>255)
+		b = 255;
+	
+	if(g<0)
+		g = 0;
+	if(g>255)
+		g = 255;
+	
+	if(r<0)
+		r = 0;
+	if(r>255)
+		r = 255;
+
+	return RGB(r,g,b);
+}
+
+void CWKButton::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	m_dButtonStatus = WK_BUTTON_STATUS_MOUSECLICK;
+	Invalidate(FALSE);
+	CButton::OnLButtonDown(nFlags, point);
+}
+
+void CWKButton::OnMouseMove(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	if(nFlags != MK_LBUTTON &&							
+	   nFlags != MK_RBUTTON &&
+	   m_dButtonStatus != WK_BUTTON_STATUS_MOUSEOVER)	
+	{// 付快胶 滚瓢 涝仿捞 绝绰 惑怕俊辑 付快胶 目辑啊 滚瓢困甫 瘤唱芭唱 荤扼龙 版快 捞亥飘甫 惯积矫挪促.
+		TRACKMOUSEEVENT track = {sizeof(TRACKMOUSEEVENT),TME_HOVER | TME_LEAVE,m_hWnd,10};
+		_TrackMouseEvent(&track);
+	}
+	
+	CButton::OnMouseMove(nFlags, point);
+}
+
+BOOL CWKButton::PreTranslateMessage(MSG* pMsg) 
+{
+	// TODO: Add your specialized code here and/or call the base class	
+	switch(pMsg->message)
+	{
+	case WM_MOUSELEAVE:	m_dButtonStatus = WK_BUTTON_STATUS_MOUSELEAVE;
+						Invalidate(FALSE);
+						break;
+
+	case WM_MOUSEHOVER:	m_dButtonStatus = WK_BUTTON_STATUS_MOUSEOVER;
+						Invalidate(FALSE);
+						break;
+	}
+
+	return CButton::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CWKButton::DestroyWindow() 
+{
+	// TODO: Add your specialized code here and/or call the base class
+//	CPaintDC dc(this);
+	m_bmpImage1.DeleteTempMap();
+	m_bmpImage2.DeleteTempMap();
+	m_bmpImage3.DeleteTempMap();
+
+	m_Font.DeleteObject();
+
+	return CButton::DestroyWindow();
+}
diff --git a/Common_Class/SISControls/XTabCtrl.cpp b/Common_Class/SISControls/XTabCtrl.cpp
new file mode 100644
index 0000000..eb4d671
--- /dev/null
+++ b/Common_Class/SISControls/XTabCtrl.cpp
@@ -0,0 +1,442 @@
+// XTabCtrl.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "XTabCtrl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CXTabCtrl
+
+CXTabCtrl::CXTabCtrl()
+{
+	m_iSelectedTab = 0;
+	m_ptTabs.x = 0;
+	m_ptTabs.y = 20;
+
+	m_crSelected = 0;
+	m_crDisabled = 0;
+	m_crNormal = 0;
+	m_crMouseOver = 0;
+	m_crBKColor = RGB(255,255,255);
+
+	m_bColorSelected  = false;
+	m_bColorDisabled  = false;
+	m_bColorNormal    = false;
+	m_bColorMouseOver = false;
+
+
+	m_iIndexMouseOver = -1;
+
+	m_bMouseOver = false;
+}
+
+CXTabCtrl::~CXTabCtrl()
+{
+	m_arrayStatusTab.RemoveAll();
+}
+
+BEGIN_MESSAGE_MAP(CXTabCtrl, CTabCtrl)
+	//{{AFX_MSG_MAP(CXTabCtrl)
+	ON_NOTIFY_REFLECT(TCN_SELCHANGE, OnSelchange)
+	ON_NOTIFY_REFLECT(TCN_SELCHANGING, OnSelchanging)
+	ON_WM_MOUSEMOVE()
+	ON_WM_TIMER()
+	//}}AFX_MSG_MAP
+	ON_WM_PAINT()
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CXTabCtrl message handlers
+
+void CXTabCtrl::SetTopLeftCorner(CPoint pt)
+{
+	m_ptTabs.x = pt.x;
+	m_ptTabs.y = pt.y;
+}
+
+void CXTabCtrl::SetMouseOverColor(COLORREF cr) 
+{
+	m_bColorMouseOver = true;
+	m_crMouseOver = cr;
+}
+
+void CXTabCtrl::SetDisabledColor(COLORREF cr) 
+{
+	m_bColorDisabled = true;
+	m_crDisabled = cr;
+}
+
+void CXTabCtrl::SetSelectedColor(COLORREF cr)
+{
+	m_bColorSelected = true;
+	m_crSelected = cr;
+}
+
+void CXTabCtrl::SetNormalColor(COLORREF cr)
+{
+	m_bColorNormal = true;
+	m_crNormal = cr;
+}
+
+void CXTabCtrl::AddTab(CWnd* pWnd, LPTSTR lpszCaption, int iImage)
+{
+	ASSERT_VALID(pWnd);
+
+	TCITEM item;
+	item.mask = TCIF_TEXT|TCIF_PARAM|TCIF_IMAGE;
+	item.lParam = (LPARAM) pWnd;
+	item.pszText = lpszCaption;
+	item.iImage = iImage;
+
+	int iIndex = static_cast<int>(m_arrayStatusTab.GetSize());
+	InsertItem(iIndex, &item);
+
+	pWnd->SetWindowPos(NULL, m_ptTabs.x, m_ptTabs.y, 505, 415,
+						SWP_FRAMECHANGED | SWP_NOZORDER);
+	
+	pWnd->ShowWindow(iIndex ? SW_HIDE : SW_SHOW);
+
+	//** the initial status is enabled
+	m_arrayStatusTab.Add(TRUE); 
+}
+
+void CXTabCtrl::AddTab(CWnd* pWnd, LPTSTR lpszCaption, int Width, int Height, int iImage)
+{
+	ASSERT_VALID(pWnd);
+
+	TCITEM item;
+	item.mask = TCIF_TEXT|TCIF_PARAM|TCIF_IMAGE;
+	item.lParam = (LPARAM) pWnd;
+	item.pszText = lpszCaption;
+	item.iImage = iImage;
+
+	int iIndex = static_cast<int>(m_arrayStatusTab.GetSize());
+	InsertItem(iIndex, &item);
+
+	//if(Width==0 && Height==0)
+	//{
+	//	int nX, nY, nXc, nYc;
+	//	CRect tabRect, itemRect;
+	//	GetClientRect(&tabRect);
+	//	GetItemRect(0, &itemRect);
+
+	//	nX=itemRect.left;
+	//	nY=itemRect.bottom+1;
+	//	nXc=tabRect.right-itemRect.left-1;
+	//	nYc=tabRect.bottom-nY-1;
+
+	//	pWnd->SetWindowPos(NULL, nX, nY, nXc, nYc, SWP_FRAMECHANGED | SWP_NOZORDER);
+	//}
+	//else
+	//{
+	//	pWnd->SetWindowPos(NULL, m_ptTabs.x, m_ptTabs.y, Width, Height,
+	//						SWP_FRAMECHANGED | SWP_NOZORDER);
+	//}
+
+	pWnd->SetWindowPos(NULL, m_ptTabs.x, m_ptTabs.y, Width, Height,
+		SWP_FRAMECHANGED | SWP_NOZORDER);
+	
+	pWnd->ShowWindow(iIndex ? SW_HIDE : SW_SHOW);
+
+	//** the initial status is enabled
+	m_arrayStatusTab.Add(TRUE); 
+}
+
+void CXTabCtrl::EnableTab(int iIndex, BOOL bEnable)
+{
+	ASSERT(iIndex < m_arrayStatusTab.GetSize());
+
+	//** if it should change the status ----
+	if (m_arrayStatusTab[iIndex] != bEnable)
+	{
+		m_arrayStatusTab[iIndex] = bEnable;
+
+		//** redraw the item -------
+		CRect rect;
+
+		GetItemRect(iIndex, &rect);
+		InvalidateRect(rect);
+	}
+}
+
+void CXTabCtrl::DeleteAllTabs()
+{
+	m_arrayStatusTab.RemoveAll();
+
+	DeleteAllItems();
+}
+
+void CXTabCtrl::DeleteTab(int iIndex)
+{
+	ASSERT(iIndex < m_arrayStatusTab.GetSize());
+
+	m_arrayStatusTab.RemoveAt(iIndex);
+
+	DeleteItem(iIndex);
+}
+
+BOOL CXTabCtrl::IsTabEnabled(int iIndex)
+{
+	ASSERT(iIndex < m_arrayStatusTab.GetSize());
+	
+	return m_arrayStatusTab[iIndex];
+}
+
+BOOL CXTabCtrl::SelectTab(int iIndex)
+{
+	ASSERT(iIndex < m_arrayStatusTab.GetSize());
+
+	if (GetCurSel() == iIndex)
+		return TRUE;
+
+	//** check if the tab is enabled --------
+	if (m_arrayStatusTab[iIndex])
+	{
+		TCITEM item;
+		CWnd* pWnd;
+		item.mask = TCIF_PARAM;
+
+		GetItem(GetCurSel(), &item);
+		pWnd = reinterpret_cast<CWnd*> (item.lParam);
+		ASSERT_VALID(pWnd);
+		pWnd->ShowWindow(SW_HIDE);
+
+		SetCurSel(iIndex);
+		GetItem(iIndex, &item);
+		pWnd = reinterpret_cast<CWnd*> (item.lParam);
+		ASSERT_VALID(pWnd);
+		pWnd->ShowWindow(SW_SHOW);
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+void CXTabCtrl::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	// TODO: Add your control notification handler code here
+	int iNewTab = GetCurSel();
+
+	if (!IsTabEnabled(iNewTab))
+	{
+		SetCurSel(m_iSelectedTab);
+	}
+	else
+	{
+		TCITEM item;
+		CWnd* pWnd;
+
+		item.mask = TCIF_PARAM;
+		
+		//** hide the current tab ---------
+		GetItem(m_iSelectedTab, &item);
+		pWnd = reinterpret_cast<CWnd*> (item.lParam);
+		ASSERT_VALID(pWnd);
+		pWnd->ShowWindow(SW_HIDE);
+
+		//** show the selected tab --------
+		GetItem(iNewTab, &item);
+		pWnd = reinterpret_cast<CWnd*> (item.lParam);
+		ASSERT_VALID(pWnd);
+		pWnd->ShowWindow(SW_SHOW);
+	}
+
+	*pResult = 0;
+}
+
+void CXTabCtrl::OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult) 
+{
+	// TODO: Add your control notification handler code here
+	m_iSelectedTab = GetCurSel();
+
+	*pResult = 0;
+}
+
+void CXTabCtrl::PreSubclassWindow() 
+{
+	// TODO: Add your specialized code here and/or call the base class
+	CTabCtrl::PreSubclassWindow();
+	ModifyStyle(0, TCS_OWNERDRAWFIXED);
+}
+
+void CXTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
+{	
+	CRect rect = lpDrawItemStruct->rcItem;
+	rect.top += ::GetSystemMetrics(SM_CYEDGE);
+
+	int nTabIndex = lpDrawItemStruct->itemID;
+	
+	if (nTabIndex < 0) return;
+
+	BOOL bSelected = (nTabIndex == GetCurSel());
+
+	COLORREF crSelected = m_bColorSelected ? m_crSelected : GetSysColor(COLOR_BTNTEXT);
+	COLORREF crNormal  = m_bColorNormal   ? m_crNormal   : GetSysColor(COLOR_BTNTEXT);
+	COLORREF crDisabled = m_bColorDisabled ? m_crDisabled : GetSysColor(COLOR_GRAYTEXT);
+
+
+	TCHAR label[64];
+	TC_ITEM item;
+	item.mask = TCIF_TEXT|TCIF_IMAGE;
+	item.pszText = label;     
+	item.cchTextMax = 63;    	
+	if (!GetItem(nTabIndex, &item))
+		return;
+
+	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
+	if (!pDC)
+		return;
+
+	int nSavedDC = pDC->SaveDC();
+
+	CRect rectItem;
+	POINT pt;
+
+	GetItemRect(nTabIndex, &rectItem);
+	GetCursorPos(&pt);
+	ScreenToClient(&pt);
+
+	if (rectItem.PtInRect(pt))
+		m_iIndexMouseOver = nTabIndex;
+
+	pDC->SetBkMode(TRANSPARENT);
+	pDC->FillSolidRect(rect, m_crBKColor);
+	//pDC->FillSolidRect(rect, ::GetSysColor(COLOR_BTNFACE));
+
+	//**  Draw the image
+	CImageList* pImageList = GetImageList();
+	if (pImageList && item.iImage >= 0) 
+	{
+
+		rect.left += pDC->GetTextExtent(_T(" ")).cx;
+
+		IMAGEINFO info;
+		pImageList->GetImageInfo(item.iImage, &info);
+		CRect ImageRect(info.rcImage);
+		int nYpos = rect.top;
+
+		pImageList->Draw(pDC, item.iImage, CPoint(rect.left, nYpos), ILD_TRANSPARENT);
+		rect.left += ImageRect.Width();
+	}
+
+	if (!IsTabEnabled(nTabIndex))
+	{
+		pDC->SetTextColor(crDisabled);
+		rect.top -= ::GetSystemMetrics(SM_CYEDGE);
+		pDC->DrawText(label, rect, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
+	}
+	else
+	{
+		//** selected item -----
+		if (bSelected)
+			pDC->SetTextColor(crSelected);
+		else //** other item ---
+		{
+			if (m_bColorMouseOver && nTabIndex == m_iIndexMouseOver) 
+			{
+				pDC->SetTextColor(m_crMouseOver);	
+			}
+			else
+			{
+				pDC->SetTextColor(crNormal);
+			}
+		}
+
+		rect.top -= ::GetSystemMetrics(SM_CYEDGE);
+		pDC->DrawText(label, rect, DT_SINGLELINE|DT_VCENTER|DT_CENTER);
+
+	}
+
+	pDC->RestoreDC(nSavedDC);
+}
+
+void CXTabCtrl::OnMouseMove(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	
+	//** if we should change the color of the tab ctrl ---
+	if (m_bColorMouseOver)
+	{
+		SetTimer(1,10,NULL);
+
+		if (m_iIndexMouseOver != -1)
+		{
+			CRect rectItem;
+			GetItemRect(m_iIndexMouseOver, rectItem);
+			if (!rectItem.PtInRect(point))
+			{
+				CRect rectOldItem;
+				GetItemRect(m_iIndexMouseOver, rectOldItem);
+				m_iIndexMouseOver = -1;
+				InvalidateRect(rectOldItem);
+				return;
+			}
+		}
+	
+
+		if (!m_bMouseOver)
+		{
+			TCHITTESTINFO hitTest;
+
+			m_bMouseOver = true;
+			hitTest.pt = point;
+
+			int iItem = HitTest(&hitTest);
+			if (iItem != -1 && m_arrayStatusTab[iItem])
+			{
+				RECT rectItem;
+				GetItemRect(iItem, &rectItem);
+
+				InvalidateRect(&rectItem);
+			}
+		}
+	}
+	
+	CTabCtrl::OnMouseMove(nFlags, point);
+}
+
+void CXTabCtrl::OnTimer(UINT_PTR nIDEvent) 
+{
+	// TODO: Add your message handler code here and/or call default
+	POINT pt;
+	GetCursorPos(&pt);
+	CRect rectItem, rectScreen;
+
+	GetItemRect(m_iIndexMouseOver, rectItem);
+	rectScreen = rectItem;
+	ClientToScreen(rectScreen);
+	
+	// If mouse leaves, show normal
+	if (!rectScreen.PtInRect(pt)) 
+	{
+		KillTimer (1);
+		m_bMouseOver = false;
+		m_iIndexMouseOver = -1;
+		InvalidateRect(rectItem);
+	}
+
+
+	CTabCtrl::OnTimer(nIDEvent);
+}
+
+BOOL CXTabCtrl::OnEraseBkgnd(CDC* pDC) 
+{
+	// TODO: Add your message handler code here and/or call default
+	BOOL bRet=CTabCtrl::OnEraseBkgnd(pDC);
+
+	CRect crtClient;
+	CRect crtItem;
+	GetItemRect(0,crtItem);
+	GetClientRect(crtClient);
+	crtClient.top+=crtItem.Height();
+	pDC->FillSolidRect(crtClient, m_crBKColor);
+
+	return bRet;
+}
\ No newline at end of file
diff --git a/Common_Class/SISControls/desktop.ini b/Common_Class/SISControls/desktop.ini
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/Common_Class/SISControls/desktop.ini
@@ -0,0 +1 @@
+
diff --git a/Common_Class/SISControls/res/SISControls.rc2 b/Common_Class/SISControls/res/SISControls.rc2
new file mode 100644
index 0000000..0ed6f3f
--- /dev/null
+++ b/Common_Class/SISControls/res/SISControls.rc2
@@ -0,0 +1,13 @@
+//
+// SISControls.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+	#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/SharedMapDll/.gitignore b/Common_Class/SharedMapDll/.gitignore
new file mode 100644
index 0000000..10c7275
--- /dev/null
+++ b/Common_Class/SharedMapDll/.gitignore
@@ -0,0 +1,7 @@
+x64/
+ipch/
+*.user
+IOCPNetwork.sdf
+IOCPNetwork.opensdf
+IOCPNetwork.suo
+Debug/
diff --git a/Common_Class/SharedMapDll/Header/LogManager.h b/Common_Class/SharedMapDll/Header/LogManager.h
new file mode 100644
index 0000000..8a02822
--- /dev/null
+++ b/Common_Class/SharedMapDll/Header/LogManager.h
@@ -0,0 +1,68 @@
+#pragma once
+#include <windows.h>
+
+#define LOG_FILE_PATH _T("C:\\LogFile\\")
+
+#define MAX_STRING_SIZE 256		//UNICODE 扁霖
+
+typedef struct _DITLOG {
+	int nLogID;
+    unsigned int nLevel;
+	unsigned int nProcess;
+    SYSTEMTIME nCurTime;
+    TCHAR logMessage[MAX_STRING_SIZE];
+} DITLOG,*PDITLOG;
+
+
+#define ONE_LOG_SIZE sizeof(DITLOG)	//(level+巩磊凯*2) BYTE 扁霖
+#define SHARED_LOG_COUNT 10000
+#define DIT_MAP_SIZE	1024*64
+
+
+//牢郸胶+疙飞敲贰弊+(level+巩磊凯)*钮肮荐+(甘荤捞令*64)
+#define SHAREDMEM_SIZE	4+4+ONE_LOG_SIZE*SHARED_LOG_COUNT+DIT_MAP_SIZE
+
+class AFX_EXT_CLASS CLogManager
+{
+	unsigned int m_nProcessID;
+	int m_nLogID;
+
+	HANDLE m_hFMap;
+	//牢郸胶客 目盖靛甫 力寇茄 傍蜡皋葛府 矫累 器牢飘
+	char* m_pSharedMem;
+
+	HANDLE m_csMemoryMap;
+	CRITICAL_SECTION m_csLocalLogFile;
+
+	//距 1000老(3斥) 荤侩啊瓷茄 牢郸胶
+	unsigned int* m_nIndex;
+
+	unsigned char* m_Command1;	//map历厘 敲贰弊
+
+	TCHAR m_TempLog[512];
+
+public:
+	unsigned int GetProcessID(){return m_nProcessID;};
+	int GetLogID(){return m_nLogID;};
+	void GetFirstCommand(unsigned char* pCommand);
+	void SetFirstCommand(unsigned char Command);
+	int GetIndex(){ return *m_nIndex;};
+
+	void SetMapData(char* pData)
+		{memcpy(m_pSharedMem+ONE_LOG_SIZE*SHARED_LOG_COUNT,pData,DIT_MAP_SIZE);};
+
+	char* GetMapDataAddress(){ return m_pSharedMem+ONE_LOG_SIZE*SHARED_LOG_COUNT;};
+
+	//傍蜡皋葛府俊 肺弊 累己, 肺弊饭骇苞 肺弊 郴侩 累己
+	void WriteLog( unsigned int Level, TCHAR* str,...);
+	//肺拿 窍靛俊 肺弊 累己
+	void WriteLocalLog(TCHAR* str,...);
+
+	//傍蜡皋葛府狼 肺弊甫 佬绢柯促.
+	void ReadLog(TCHAR* str, unsigned int curIndex, int* curLogID,
+				unsigned int* curLevel,unsigned int* curProcess, PSYSTEMTIME curTime);
+
+	CLogManager(int LogID, TCHAR* NameOfMemoryMap, unsigned int ProcessID = 0);//ProcessID 抗距康开
+	~CLogManager(void);
+	void SaveBinary(TCHAR* FilePath);
+};
diff --git a/Common_Class/SharedMapDll/LogManager.cpp b/Common_Class/SharedMapDll/LogManager.cpp
new file mode 100644
index 0000000..81c7658
--- /dev/null
+++ b/Common_Class/SharedMapDll/LogManager.cpp
@@ -0,0 +1,213 @@
+#include "StdAfx.h"
+#include "LogManager.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+CLogManager::CLogManager(int LogID, TCHAR* NameOfMemoryMap, unsigned int ProcessID )
+{
+	CString strNameOfMemoryMap = _T("");
+	strNameOfMemoryMap.Format(_T("%s%02d"),NameOfMemoryMap,ProcessID);
+	m_nProcessID = ProcessID;
+	m_nLogID = LogID;
+
+	//颇老 甘俏 积己
+	m_hFMap = ::CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,
+		SHAREDMEM_SIZE,strNameOfMemoryMap);
+
+	//父老 促弗 绢敲府纳捞记俊辑 捞固 积己沁促搁
+	if(::GetLastError() == ERROR_ALREADY_EXISTS)
+	{
+		//积己等 颇老 甘俏阑 Open
+		m_hFMap = ::OpenFileMapping(FILE_MAP_ALL_ACCESS,FALSE,strNameOfMemoryMap);
+	}
+
+	//甘俏 颇老俊辑 傍蜡皋葛府 器牢磐甫 啊廉柯促.
+	m_pSharedMem = (char*)::MapViewOfFile(m_hFMap,FILE_MAP_ALL_ACCESS,
+		0,0,SHAREDMEM_SIZE);
+	
+	//牢郸胶肺 荤侩且 傍蜡 皋葛府
+	m_nIndex = (unsigned int*)m_pSharedMem;
+	(*m_nIndex) = 0;
+	m_pSharedMem += 4;
+	
+	//目盖靛肺 荤侩且 傍蜡皋葛府
+	m_Command1 =(unsigned char*)m_pSharedMem;
+	*m_Command1 = 0;
+
+	//3byte 抗距 傍埃
+	//亲饶 目盖靛 眠啊肺 荤侩且 荐 乐嚼聪促.
+
+
+	m_pSharedMem += 4;
+	
+	//农府萍拿 冀记 檬扁拳
+	m_csMemoryMap = CreateMutex(NULL, FALSE, _T("DIT_LOGVIEW_MUTEX"));
+	InitializeCriticalSection(&m_csLocalLogFile);
+}
+
+CLogManager::~CLogManager(void)
+{
+	//农府萍拿 冀记 家戈
+	CloseHandle(m_csMemoryMap);
+	DeleteCriticalSection(&m_csLocalLogFile);
+
+	//牢郸胶客 目盖靛 傍埃阑 登倒赴促.
+	m_pSharedMem -= 8;
+
+	//UnMap 茄促.
+	if( m_pSharedMem != NULL) ::UnmapViewOfFile(m_pSharedMem);
+	if( m_hFMap != NULL) ::CloseHandle(m_hFMap);
+
+
+}
+
+void CLogManager::WriteLog( unsigned int Level, TCHAR* str,...)
+{
+	WaitForSingleObject(m_csMemoryMap, INFINITE);
+
+		memset(m_TempLog,0x00, sizeof(TCHAR)*MAX_STRING_SIZE*2);
+
+		va_list arg;
+		va_start(arg, str);
+		
+		PDITLOG ptrLog;
+		//unsigned int* ptrLevel;
+		unsigned int index = 0;
+
+		index = (*m_nIndex)%SHARED_LOG_COUNT;
+
+		ptrLog = (PDITLOG)(m_pSharedMem+(index*ONE_LOG_SIZE));
+		
+//		ptrLog->nLogID = m_nLogID;
+		ptrLog->nLogID = Level;
+
+		//肺弊 饭骇 历厘
+		ptrLog->nLevel = Level;
+		//抗距单捞磐
+//		ptrLog->nProcess = m_nProcessID;
+		ptrLog->nProcess = Level;
+		//肺弊 矫埃 历厘
+		GetLocalTime(&(ptrLog->nCurTime));
+		//扁粮 肺弊 檬扁拳
+		memset(ptrLog->logMessage,0x00,sizeof(TCHAR)*MAX_STRING_SIZE);
+		//脚痹 肺弊 郴侩 历厘
+		_vstprintf_s(m_TempLog, MAX_STRING_SIZE*2, str, arg);
+
+		memcpy(ptrLog->logMessage,m_TempLog,sizeof(TCHAR)*(MAX_STRING_SIZE-1));
+		//牢郸胶 刘啊
+		(*m_nIndex)++;
+
+	ReleaseMutex(m_csMemoryMap);
+}
+
+void CLogManager::ReadLog(TCHAR* str, unsigned int curIndex, int* curLogID,
+						unsigned int* curLevel,unsigned int* curProcess, PSYSTEMTIME curTime)
+{
+	unsigned int index = 0;
+	PDITLOG ptrLog;
+
+	index = (curIndex)%SHARED_LOG_COUNT;
+	//佬绢棵 肺弊狼 器牢磐甫 啊廉柯促.
+	ptrLog = (PDITLOG)(m_pSharedMem+(index*ONE_LOG_SIZE));
+	//肺弊 饭骇 啊廉柯促.
+	*curLevel = ptrLog->nLevel;
+	//肺弊 酒捞叼甫 啊廉柯促.
+	*curLogID = ptrLog->nLogID;
+	//橇肺技胶 id 抗距康开 单捞磐
+	*curProcess = ptrLog->nProcess;
+	//肺弊矫埃 啊廉柯促.
+	memcpy( curTime, &(ptrLog->nCurTime), sizeof(SYSTEMTIME));
+	//肺弊巩磊凯 啊廉柯促.
+	memcpy( str, ptrLog->logMessage, MAX_STRING_SIZE*sizeof(TCHAR));
+}
+
+//捞 窃荐绰 啊鞭利 荤侩窍瘤 臼绰 巴捞 亮嚼聪促.
+void CLogManager::WriteLocalLog(TCHAR* str,...)
+{
+	//荤侩 绢敲府纳捞记俊辑 肺拿肺 官肺 肺弊 颇老阑 累己钦聪促.
+	va_list list;
+	TCHAR szText[MAX_STRING_SIZE] = {0, };
+
+	va_start(list, str);
+	_vstprintf_s(szText, str, list);
+	va_end(list);
+
+	// 颇老俊 静扁
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+
+	static TCHAR strMessage[MAX_STRING_SIZE];
+	memset(strMessage, 0x00, MAX_STRING_SIZE*sizeof(TCHAR));
+	_stprintf_s(strMessage, _T("[%02d:%02d:%02d] %s\r\n"), st.wHour, st.wMinute, st.wSecond, szText);
+
+	//肺弊 颇老疙苞 困摹 积己
+	static TCHAR strFileName[MAX_PATH];
+	memset(strFileName, 0x00, MAX_PATH*sizeof(TCHAR));
+	_stprintf_s(strFileName, _T("%sLocal%d%02d%02d.log"), LOG_FILE_PATH, st.wYear, st.wMonth, st.wDay);
+
+	DWORD dwWritten;
+	HANDLE hFile;
+
+	//版里惑怕 规瘤甫 困茄 农府萍拿 按眉 荤侩
+	EnterCriticalSection(&m_csLocalLogFile);
+	hFile = CreateFile(strFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+	int nFilePointer = SetFilePointer(hFile, 0, NULL, FILE_END);
+
+	#ifdef UNICODE
+	if(!nFilePointer)
+	{
+		// 蜡聪内靛 颇老狼 矫累篮 BOM(0xFEFF) 捞绢具 茄促.
+		TCHAR strCommand = 0xFEFF;
+		WriteFile(hFile, &strCommand, sizeof(TCHAR), &dwWritten, NULL);
+	}
+	#endif
+
+	//肺拿 肺弊颇老 累己
+	WriteFile(hFile, strMessage, _tcslen(strMessage)*sizeof(TCHAR), &dwWritten, NULL);
+	CloseHandle(hFile);
+	LeaveCriticalSection(&m_csLocalLogFile);
+}
+void CLogManager::SaveBinary(TCHAR* FilePath)
+{
+	// 颇老俊 静扁
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+
+	//颇老 版肺 积己
+	static TCHAR strFileName[MAX_PATH];
+	memset(strFileName, 0x00, MAX_PATH*sizeof(TCHAR));
+	_stprintf_s(strFileName, _T("%s%d%02d%02d-%02d%02d%02d.map"), FilePath, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
+
+	DWORD dwWritten;
+	HANDLE hFile;
+
+	//官捞呈府 甘阑 啊廉可聪促.
+	char* ptrMap = GetMapDataAddress();
+
+	EnterCriticalSection(&m_csLocalLogFile);
+	hFile = CreateFile(strFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+	int nFilePointer = SetFilePointer(hFile, 0, NULL, FILE_END);
+
+	//64K 官捞呈府 单捞磐甫 颇老俊 历厘钦聪促.
+	WriteFile(hFile, ptrMap, DIT_MAP_SIZE, &dwWritten, NULL);
+	
+	CloseHandle(hFile);
+	LeaveCriticalSection(&m_csLocalLogFile);
+}
+
+void CLogManager::GetFirstCommand(unsigned char* pCommand)
+{
+	//目盖靛蔼阑 掘绢可聪促.
+	*pCommand = *m_Command1;
+}
+
+void CLogManager::SetFirstCommand(unsigned char Command)
+{
+	//目盖靛 蔼阑 瘤沥钦聪促.
+	*m_Command1 = Command;
+}
\ No newline at end of file
diff --git a/Common_Class/SharedMapDll/ReadMe.txt b/Common_Class/SharedMapDll/ReadMe.txt
new file mode 100644
index 0000000..bde0751
--- /dev/null
+++ b/Common_Class/SharedMapDll/ReadMe.txt
@@ -0,0 +1,56 @@
+锘�========================================================================
+    MFC 霛检澊敫岆煬毽� : SharedMapDll 頂勲鞝濏姼 臧滌殧
+========================================================================
+
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 鞚� SharedMapDll DLL鞚� 毵岆摛鞐堨姷雼堧嫟.  鞚� DLL鞚�
+MFC鞚� 旮半掣 靷毄氩曥潉 氤挫棳 欷� 肟愲 鞎勲媹霛� DLL鞚� 鞛戩劚頃橁赴 鞙勴暅 旮半掣 甑“毳� 鞝滉车頃╇媹雼�.
+
+鞚� 韺岇澕鞐愲姅 SharedMapDll DLL鞚� 甑劚頃橂姅 臧� 韺岇澕鞐� 雽�頃�
+鞖旍暯 靹る獏鞚� 韽暔霅橃柎 鞛堨姷雼堧嫟.
+
+SharedMapDll.vcproj
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靸濎劚頃� VC++ 頂勲鞝濏姼鞚� 旮半掣 頂勲鞝濏姼 韺岇澕鞛呺媹雼�.
+    韺岇澕鞚� 靸濎劚頃� Visual C++ 氩勳爠鞐� 雽�頃� 鞝曤炒鞕�
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靹犿儩頃� 頂岆灚韽�, 甑劚 氚� 頂勲鞝濏姼 旮半姤鞐� 雽�頃�
+    鞝曤炒臧� 霌れ柎 鞛堨姷雼堧嫟.
+
+SharedMapDll.cpp
+    DllMain()鞚� 鞝曥潣霅橃柎 鞛堧姅 旮半掣 DLL 靻岇姢
+    韺岇澕鞛呺媹雼�.
+
+SharedMapDll.rc
+    頂勲攴鸽灗鞐愳劀 靷毄頃橂姅 氇摖 Microsoft Windows 毽唽鞀れ潣
+    氇╇鞛呺媹雼�.  鞐赴鞐愲姅 RES 頃橃渼 霐旊爥韯半Μ鞐� 鞝�鞛ル悳 鞎勳澊旖�, 牍勴姼毵� 氚� 旎れ劀臧�
+    韽暔霅╇媹雼�.  鞚� 韺岇澕鞚� Microsoft Visual C++鞐愳劀 歆侅爲 韼胳頃� 靾�
+    鞛堨姷雼堧嫟.
+
+res\SharedMapDll.rc2
+    鞚� 韺岇澕鞐愲姅 Microsoft Visual C++ 鞚挫櫢鞚� 雼るジ 霃勱惮鞐愳劀 韼胳頃� 毽唽鞀り皜
+    韽暔霅橃柎 鞛堨姷雼堧嫟.  毽唽鞀� 韼胳旮半 韼胳頃� 靾� 鞐嗠姅 毽唽鞀る姅
+    氇憪 鞚� 韺岇澕 鞎堨棎 氚办箻頃挫暭 頃╇媹雼�.
+
+SharedMapDll.def
+    鞚� 韺岇澕鞐愲姅 Microsoft Windows鞐愳劀 鞁ろ枆霅橁赴 鞙勴暣 鞝滉车頃挫暭 頃橂姅
+    DLL鞐� 雽�頃� 鞝曤炒臧� 韽暔霅橃柎 鞛堨溂氅�,  DLL鞚� 鞚措 氚� 靹る獏瓿� 臧欖潃
+    毵り皽 氤�靾橁皜 鞝曥潣霅橃柎 鞛堨姷雼堧嫟.  霕愴暅 DLL鞐愳劀
+    頃垬霃� 雮措炒雰呺媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
+旮绊儉 響滌 韺岇澕:
+
+StdAfx.h, StdAfx.cpp
+    鞚� 韺岇澕鞚� 氙鸽Μ 旎错寣鞚茧悳 項る崝(PCH) 韺岇澕鞚� SharedMapDll.pch鞕�
+    氙鸽Μ 旎错寣鞚茧悳 順曥嫕(PCT) 韺岇澕鞚� StdAfx.obj毳� 牍岆摐頃橂姅 雿� 靷毄霅╇媹雼�.
+
+Resource.h
+    靸� 毽唽鞀� ID毳� 鞝曥潣頃橂姅 響滌 項る崝 韺岇澕鞛呺媹雼�.
+    Microsoft Visual C++鞐愳劀 鞚� 韺岇澕鞚� 鞚疥碃 鞐呺嵃鞚错姼頃╇媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
+旮绊儉 彀戈碃:
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 靷毄頃橂姅 "TODO:" 欤检劃鞚� 靷毄鞛愱皜 於旉皜頃橁卑雮� 靷毄鞛� 歆�鞝曧暣鞎� 頃橂姅
+靻岇姢 旖旊摐 攵�攵勳潉 雮橅儉雰呺媹雼�.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/SharedMapDll/Resource.h b/Common_Class/SharedMapDll/Resource.h
new file mode 100644
index 0000000..05ab3c7
--- /dev/null
+++ b/Common_Class/SharedMapDll/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by SharedMapDll.rc
+//
+
+// 促澜篮 货 俺眉俊 荤侩且 扁夯蔼涝聪促.
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE	2000
+#define _APS_NEXT_CONTROL_VALUE		2000
+#define _APS_NEXT_SYMED_VALUE		2000
+#define _APS_NEXT_COMMAND_VALUE		32771
+#endif
+#endif
diff --git a/Common_Class/SharedMapDll/SharedMapDll.cpp b/Common_Class/SharedMapDll/SharedMapDll.cpp
new file mode 100644
index 0000000..6f51856
--- /dev/null
+++ b/Common_Class/SharedMapDll/SharedMapDll.cpp
@@ -0,0 +1,10 @@
+// SharedMapDll.cpp : 秦寸 DLL狼 檬扁拳 风凭阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
diff --git a/Common_Class/SharedMapDll/SharedMapDll.def b/Common_Class/SharedMapDll/SharedMapDll.def
new file mode 100644
index 0000000..1a33afb
--- /dev/null
+++ b/Common_Class/SharedMapDll/SharedMapDll.def
@@ -0,0 +1,7 @@
+; SharedMapDll.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY      "SharedMapDll"
+DESCRIPTION  'SharedMapDll Windows Dynamic Link Library'
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
diff --git a/Common_Class/SharedMapDll/SharedMapDll.rc b/Common_Class/SharedMapDll/SharedMapDll.rc
new file mode 100644
index 0000000..0888d72
--- /dev/null
+++ b/Common_Class/SharedMapDll/SharedMapDll.rc
@@ -0,0 +1,125 @@
+// Microsoft Visual C++俊辑 积己茄 府家胶 胶农赋飘涝聪促.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE 2 府家胶俊辑 积己登菌嚼聪促.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+	"#ifndef APSTUDIO_INVOKED\r\n"
+    "#include ""targetver.h""\r\n"
+    "#endif\r\n"
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+    "#define _AFX_NO_OLE_RESOURCES\r\n"
+    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+    "\r\n"
+	"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
+	"LANGUAGE 18, 1\r\n"
+	"#pragma code_page(949)\r\n"
+    "#include ""res\\SharedMapDll.rc2""  // Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶涝聪促.\r\n"
+#ifndef _AFXDLL
+    "#include ""l.KOR\\afxres.rc""  	// 钎霖 备己 夸家涝聪促.\r\n"
+#endif
+    "#endif\r\n"
+    "\0"
+END
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED
+
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE 18, 1
+#pragma code_page(949)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 滚傈
+//
+
+VS_VERSION_INFO     VERSIONINFO
+  FILEVERSION       1,0,0,1
+  PRODUCTVERSION    1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+	BLOCK "StringFileInfo"
+	BEGIN
+        BLOCK "041203b5"
+		BEGIN
+            VALUE "CompanyName", "TODO: <雀荤 捞抚>"
+            VALUE "FileDescription", "TODO: <颇老 汲疙>"
+			VALUE "FileVersion",     "1.0.0.1"
+			VALUE "InternalName",    "SharedMapDll.dll"
+            VALUE "LegalCopyright", "TODO: (c) <雀荤 捞抚>.  All rights reserved."
+			VALUE "OriginalFilename","SharedMapDll.dll"
+            VALUE "ProductName", "TODO: <力前 捞抚>"
+			VALUE "ProductVersion",  "1.0.0.1"
+		END
+	END
+	BLOCK "VarFileInfo"
+	BEGIN
+		VALUE "Translation", 0x0412, 949
+    END
+END
+
+#endif
+#ifndef APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE 3 府家胶俊辑 积己登菌嚼聪促.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
+LANGUAGE 18, 1
+#pragma code_page(949)
+#include "res\\SharedMapDll.rc2"  // Microsoft Visual C++ 捞寇狼 促弗 档备俊辑 祈笼茄 府家胶涝聪促.
+#ifndef _AFXDLL
+#include "l.KOR\\afxres.rc"  	// 钎霖 备己 夸家涝聪促.
+#endif
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // APSTUDIO_INVOKED啊 酒凑聪促.
+
diff --git a/Common_Class/SharedMapDll/SharedMapDll.sln b/Common_Class/SharedMapDll/SharedMapDll.sln
new file mode 100644
index 0000000..506590e
--- /dev/null
+++ b/Common_Class/SharedMapDll/SharedMapDll.sln
@@ -0,0 +1,26 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SharedMapDll", "SharedMapDll.vcxproj", "{681CB63A-6D15-48C9-9990-8874B881CB8C}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Debug|Win32.Build.0 = Debug|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Debug|x64.ActiveCfg = Debug|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Debug|x64.Build.0 = Debug|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Release|Win32.ActiveCfg = Release|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Release|Win32.Build.0 = Release|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Release|x64.ActiveCfg = Release|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Release|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/Common_Class/SharedMapDll/SharedMapDll.vcproj b/Common_Class/SharedMapDll/SharedMapDll.vcproj
new file mode 100644
index 0000000..11999ed
--- /dev/null
+++ b/Common_Class/SharedMapDll/SharedMapDll.vcproj
@@ -0,0 +1,502 @@
+<?xml version="1.0" encoding="ks_c_5601-1987"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="SharedMapDll"
+	ProjectGUID="{681CB63A-6D15-48C9-9990-8874B881CB8C}"
+	RootNamespace="SharedMapDll"
+	Keyword="MFCDLLProj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="false"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_AFXEXT"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				ModuleDefinitionFile=".\SharedMapDll.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="..\..\角青颇老\Debug\"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="false"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=".\Header"
+				PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_AFXEXT"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile="..\Library\Debug\$(TargetName).pch"
+				AssemblerListingLocation="$(IntDir)"
+				ProgramDataBaseFileName="..\Library\Debug\$(TargetName).pdb"
+				BrowseInformationFile="$(IntDir)"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				ErrorReporting="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="..\..\角青颇老\Debug\$(ProjectName).dll"
+				LinkIncremental="2"
+				ModuleDefinitionFile=".\SharedMapDll.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="..\Library\Debug\$(TargetName).pdb"
+				SubSystem="2"
+				TargetMachine="17"
+				ErrorReporting="2"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				OutputFile="$(OutDir)$(TargetName).bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="false"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_AFXEXT"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				ModuleDefinitionFile=".\SharedMapDll.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="..\..\角青颇老\Release\"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			UseOfMFC="2"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="false"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories=".\Header"
+				PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_AFXEXT"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderFile="..\Library\Release\$(TargetName).pch"
+				AssemblerListingLocation="$(IntDir)"
+				ProgramDataBaseFileName="..\Library\Release\$(TargetName).pdb"
+				BrowseInformationFile="$(IntDir)"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+				CompileAs="0"
+				ErrorReporting="2"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1042"
+				AdditionalIncludeDirectories="$(IntDir)"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="..\..\角青颇老\Release\$(ProjectName).dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile=".\SharedMapDll.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				OutputFile="$(OutDir)$(TargetName).bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="家胶 颇老"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\dllmain.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="0"
+						CompileAsManaged="0"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\LogManager.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\SharedMapDll.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\SharedMapDll.def"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="庆歹 颇老"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\LogManager.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Resource.h"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="府家胶 颇老"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+			<File
+				RelativePath=".\SharedMapDll.rc"
+				>
+			</File>
+			<File
+				RelativePath=".\res\SharedMapDll.rc2"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/Common_Class/SharedMapDll/SharedMapDll.vcxproj b/Common_Class/SharedMapDll/SharedMapDll.vcxproj
new file mode 100644
index 0000000..22e8c63
--- /dev/null
+++ b/Common_Class/SharedMapDll/SharedMapDll.vcxproj
@@ -0,0 +1,276 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{681CB63A-6D15-48C9-9990-8874B881CB8C}</ProjectGuid>
+    <RootNamespace>SharedMapDll</RootNamespace>
+    <Keyword>MFCDLLProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\SharedMapDll.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN64;_WINDOWS;_DEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <BrowseInformationFile>$(IntDir)</BrowseInformationFile>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <ErrorReporting>Queue</ErrorReporting>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)$(TargetName)D$(TargetExt)</OutputFile>
+      <ModuleDefinitionFile>.\SharedMapDllD.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX64</TargetMachine>
+      <LinkErrorReporting>QueueForNextLogin</LinkErrorReporting>
+      <ImportLibrary>$(OutDir)\$(TargetName)D.lib</ImportLibrary>
+    </Link>
+    <Bscmake>
+      <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+    </Bscmake>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <ModuleDefinitionFile>.\SharedMapDll.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <TargetEnvironment>X64</TargetEnvironment>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>.\Header</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_AFXEXT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
+      <PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+      <ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+      <BrowseInformationFile>$(IntDir)</BrowseInformationFile>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <CompileAs>Default</CompileAs>
+      <ErrorReporting>Queue</ErrorReporting>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0412</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+    <Link>
+      <OutputFile>$(OutDir)\$(ProjectName).dll</OutputFile>
+      <ModuleDefinitionFile>.\SharedMapDll.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX64</TargetMachine>
+      <ImportLibrary>$(OutDir)\$(TargetName).lib</ImportLibrary>
+      <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
+    </Link>
+    <Bscmake>
+      <OutputFile>$(OutDir)$(TargetName).bsc</OutputFile>
+    </Bscmake>
+    <PostBuildEvent>
+      <Command>copy "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)Lib\SharedMapDll\lib\$(Platform)\$(Configuration)\$(ProjectName).lib"
+copy "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Lib\SharedMapDll\lib\$(Platform)\$(Configuration)\$(ProjectName).pdb"
+copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Lib\SharedMapDll\lib\$(Platform)\$(Configuration)\$(ProjectName).dll"
+copy "$(SolutionDir)Common_Class\$(ProjectName)\Header\LogManager.h" "$(SolutionDir)Lib\SharedMapDll\include\LogManager.h"</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="dllmain.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+      <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
+    </ClCompile>
+    <ClCompile Include="LogManager.cpp" />
+    <ClCompile Include="SharedMapDll.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="SharedMapDll.def" />
+    <None Include="res\SharedMapDll.rc2" />
+    <None Include="ReadMe.txt" />
+    <None Include="SharedMapDllD.def" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header\LogManager.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="SharedMapDll.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/SharedMapDll/SharedMapDll.vcxproj.filters b/Common_Class/SharedMapDll/SharedMapDll.vcxproj.filters
new file mode 100644
index 0000000..8eb8302
--- /dev/null
+++ b/Common_Class/SharedMapDll/SharedMapDll.vcxproj.filters
@@ -0,0 +1,62 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="dllmain.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="LogManager.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SharedMapDll.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="SharedMapDll.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\SharedMapDll.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="ReadMe.txt" />
+    <None Include="SharedMapDllD.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Header\LogManager.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="SharedMapDll.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/Common_Class/SharedMapDll/SharedMapDllD.def b/Common_Class/SharedMapDll/SharedMapDllD.def
new file mode 100644
index 0000000..369f02c
--- /dev/null
+++ b/Common_Class/SharedMapDll/SharedMapDllD.def
@@ -0,0 +1,7 @@
+; SharedMapDllD.def : DLL俊 措茄 葛碘 概俺 函荐甫 沥狼钦聪促.
+
+LIBRARY      "SharedMapDllD"
+DESCRIPTION  'SharedMapDllD Windows Dynamic Link Library (Debug)'
+
+EXPORTS
+    ; 疙矫利 郴焊郴扁甫 咯扁俊 荤侩且 荐 乐嚼聪促.
\ No newline at end of file
diff --git a/Common_Class/SharedMapDll/dllmain.cpp b/Common_Class/SharedMapDll/dllmain.cpp
new file mode 100644
index 0000000..26f6ff0
--- /dev/null
+++ b/Common_Class/SharedMapDll/dllmain.cpp
@@ -0,0 +1,51 @@
+// dllmain.cpp : DLL狼 檬扁拳 风凭阑 沥狼钦聪促.
+//
+
+#include "stdafx.h"
+#include <afxwin.h>
+#include <afxdllx.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+static AFX_EXTENSION_MODULE SharedMapDllDLL = { NULL, NULL };
+
+extern "C" int APIENTRY
+DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+	// lpReserved甫 荤侩窍绰 版快 促澜阑 力芭窍绞矫坷.
+	UNREFERENCED_PARAMETER(lpReserved);
+
+	if (dwReason == DLL_PROCESS_ATTACH)
+	{
+		//TRACE0("SharedMapDll.DLL Initializing\n");
+		
+		// 犬厘 DLL阑 茄 锅父 檬扁拳钦聪促.
+		if (!AfxInitExtensionModule(SharedMapDllDLL, hInstance))
+			return 0;
+
+		// 捞 DLL阑 府家胶 眉牢俊 火涝钦聪促.
+		// 曼绊: 捞 犬厘 DLL捞 MFC 览侩 橇肺弊伐捞
+		//  酒囱 ActiveX 牧飘费苞 鞍篮 MFC 扁夯 DLL俊
+		//  狼秦 疙矫利栏肺 傅农登绢 乐绰 版快俊绰
+		//  DllMain俊辑 捞 临阑 力芭窍绊, 力芭茄 临篮 捞 犬厘 DLL俊辑
+		//  郴焊辰 喊档狼 窃荐俊 眠啊钦聪促.
+		//  弊繁 促澜 捞 犬厘 DLL阑 荤侩窍绰 扁夯 DLL篮
+		//  秦寸 窃荐甫 疙矫利栏肺 龋免窍咯 捞 犬厘 DLL阑 眠啊秦具 钦聪促.
+		//  弊犯瘤 臼栏搁 CDynLinkLibrary 俺眉啊
+		//  扁夯 DLL狼 府家胶 眉牢俊 眠啊登瘤 臼栏骨肺
+		//  缴阿茄 巩力啊 惯积钦聪促.
+
+		new CDynLinkLibrary(SharedMapDllDLL);
+
+	}
+	else if (dwReason == DLL_PROCESS_DETACH)
+	{
+		//TRACE0("SharedMapDll.DLL Terminating.\n");
+
+		// 家戈磊啊 龋免登扁 傈俊 扼捞宏矾府甫 辆丰钦聪促.
+		AfxTermExtensionModule(SharedMapDllDLL);
+	}
+	return 1;   // 犬牢
+}
diff --git a/Common_Class/SharedMapDll/res/SharedMapDll.rc2 b/Common_Class/SharedMapDll/res/SharedMapDll.rc2
new file mode 100644
index 0000000..f36f607
--- /dev/null
+++ b/Common_Class/SharedMapDll/res/SharedMapDll.rc2
@@ -0,0 +1,13 @@
+//
+// SharedMapDll.RC2 - Microsoft Visual C++俊辑 流立 祈笼窍瘤 臼绰 府家胶
+//
+
+#ifdef APSTUDIO_INVOKED
+#error 捞 颇老篮 Microsoft Visual C++俊辑 祈笼且 荐 绝嚼聪促.
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// 咯扁俊 荐悼栏肺 祈笼茄 府家胶甫 眠啊钦聪促.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/Common_Class/SharedMapDll/stdafx.cpp b/Common_Class/SharedMapDll/stdafx.cpp
new file mode 100644
index 0000000..11a5965
--- /dev/null
+++ b/Common_Class/SharedMapDll/stdafx.cpp
@@ -0,0 +1,7 @@
+// stdafx.cpp : 钎霖 器窃 颇老父 甸绢 乐绰 家胶 颇老涝聪促.
+// SharedMapDll.pch绰 固府 哪颇老等 庆歹啊 邓聪促.
+// stdafx.obj俊绰 固府 哪颇老等 屈侥 沥焊啊 器窃邓聪促.
+
+#include "stdafx.h"
+
+
diff --git a/Common_Class/SharedMapDll/stdafx.h b/Common_Class/SharedMapDll/stdafx.h
new file mode 100644
index 0000000..5cacd4c
--- /dev/null
+++ b/Common_Class/SharedMapDll/stdafx.h
@@ -0,0 +1,39 @@
+// stdafx.h : 磊林 荤侩窍瘤父 磊林 函版登瘤绰 臼绰
+// 钎霖 矫胶袍 器窃 颇老 棺 橇肺璃飘 包访 器窃 颇老捞
+// 甸绢 乐绰 器窃 颇老涝聪促.
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 芭狼 荤侩登瘤 臼绰 郴侩篮 Windows 庆歹俊辑 力寇钦聪促.
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 老何 CString 积己磊绰 疙矫利栏肺 急攫邓聪促.
+
+#include <afxwin.h>         // MFC 琴缴 棺 钎霖 备己 夸家涝聪促.
+#include <afxext.h>         // MFC 犬厘涝聪促.
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE 努贰胶涝聪促.
+#include <afxodlgs.h>       // MFC OLE 措拳 惑磊 努贰胶涝聪促.
+#include <afxdisp.h>        // MFC 磊悼拳 努贰胶涝聪促.
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 单捞磐海捞胶 努贰胶涝聪促.
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 单捞磐海捞胶 努贰胶涝聪促.
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // Internet Explorer 4 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // Windows 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
diff --git a/Common_Class/SharedMapDll/targetver.h b/Common_Class/SharedMapDll/targetver.h
new file mode 100644
index 0000000..75a9f56
--- /dev/null
+++ b/Common_Class/SharedMapDll/targetver.h
@@ -0,0 +1,26 @@
+
+#pragma once
+
+// 促澜 概农肺绰 鞘夸茄 弥家 敲阀汽阑 沥狼钦聪促. 鞘夸茄 弥家 敲阀汽篮
+// 览侩 橇肺弊伐阑 角青窍绰 单 鞘夸茄 扁瓷捞 器窃等 啊厘 狐弗 滚傈狼 Windows, Internet Explorer
+// 殿涝聪促. 捞 概农肺绰 瘤沥等 滚傈 捞惑狼 敲阀汽 滚傈俊辑 荤侩 啊瓷茄 葛电 扁瓷阑 劝己拳秦具
+// 累悼钦聪促.
+
+// 酒贰 瘤沥等 敲阀汽俊 快急窍绰 敲阀汽阑 措惑栏肺 窍绰 版快 促澜 沥狼甫 荐沥窍绞矫坷.
+// 促弗 敲阀汽俊 荤侩登绰 秦寸 蔼狼 弥脚 沥焊绰 MSDN阑 曼炼窍绞矫坷.
+#ifndef WINVER                          // 鞘夸茄 弥家 敲阀汽阑 Windows Vista肺 瘤沥钦聪促.
+#define WINVER 0x0600           // 促弗 滚傈狼 Windows俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_WINNT            // 鞘夸茄 弥家 敲阀汽阑 Windows Vista肺 瘤沥钦聪促.
+#define _WIN32_WINNT 0x0600     // 促弗 滚傈狼 Windows俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_WINDOWS          // 鞘夸茄 弥家 敲阀汽阑 Windows 98肺 瘤沥钦聪促.
+#define _WIN32_WINDOWS 0x0410 // Windows Me 捞惑俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
+#ifndef _WIN32_IE                       // 鞘夸茄 弥家 敲阀汽阑 Internet Explorer 7.0栏肺 瘤沥钦聪促.
+#define _WIN32_IE 0x0700        // 促弗 滚傈狼 IE俊 嘎档废 利钦茄 蔼栏肺 函版秦 林绞矫坷.
+#endif
+
diff --git a/Common_Class/VisionLib/ApiVisionSDK/include/ClsVision.h b/Common_Class/VisionLib/ApiVisionSDK/include/ClsVision.h
new file mode 100644
index 0000000..2ed85b9
--- /dev/null
+++ b/Common_Class/VisionLib/ApiVisionSDK/include/ClsVision.h
@@ -0,0 +1,419 @@
+#ifndef CLS_VISION_H
+#define CLS_VISION_H
+
+#ifdef EXPORT_DLL_BASE_VISION
+#define EXPORTED_VISION _declspec(dllexport)
+#else
+#define EXPORTED_VISION _declspec(dllimport)
+#endif
+
+class EXPORTED_VISION ClsVision
+{
+public:
+	ClsVision();
+	~ClsVision();
+
+public:
+	//1. 获取当前的软件版本
+	static std::string GetVersion(void);
+
+	//2. 获取更新内容
+	static std::string GetUpdate(void);
+
+	//4. 获取当前的目录
+	static std::string GetAppPathA();
+
+public:
+	//1. 仿射变换
+	static ParaAffine2D VectorAngleToRigid(Point2D ptOrigine, double angleOrigine, Point2D ptTarget, double angleTarget);
+
+	//2. 点到点的距离
+	static double DistancePP(Point2D pt1, Point2D pt2);
+
+	//3. 点到直线的距离
+	static double DistancePL(Point2D pt, Line2D line);
+
+	//4. 直线的交点
+	static Point2D LineIntersection(Line2D line1, Line2D line2);
+
+	//5. 直线的角度
+	static double LineAngle(Line2D line);
+
+	//6. 直线与直线的夹角
+	double AngleLL(Line2D line1, Line2D line2);
+
+	//7. 坐标转换
+	static Point2D CoordinateTransform(Point2D pt, ParaAffine2D affine);
+
+	//8. 点到直线的垂足
+	static Point2D ProjectionPL(Point2D pt, Line2D line);
+
+	//9. 角度转换为弧度
+	static double DegreeToRad(double angle);
+
+	//10. 弧度转换为角度
+	static double RadToDegree(double rad);
+
+	//11. Cos值
+	static double GetCos(double rad);
+
+	//12. Sin值
+	static double GetSin(double rad);
+
+	//13. 最小二乘法直线拟合
+	static void FitLiner(Point2D *ptArray, int sz, double &ka, double &kb);
+
+	//14. 拟合圆
+	static Circle2D FitCircle(Point2D *ptArray, int sz);
+
+	//15. 直线的刚性变换
+	static ParaAffine2D LineVectorToRigid(Line2D lineStandard, Line2D lineReal);
+
+	//16. 三点成员
+	static Circle2D ThreePointsToCircle(Point2D pt1, Point2D pt2, Point2D pt3);
+
+	//17. 执行标定,仿射变化
+	static ParaAffine2D VectorToHomMat2d(std::vector<Point2D> vPtOrigine, std::vector<Point2D> vPtTarget);
+
+	//18. 刚性变换
+	static ParaAffine2D VectorToRigid(std::vector<Point2D> vPtOrigine, std::vector<Point2D> vPtTarget);
+
+	//19. 仿射参数
+	static void HomMat2dToAffinePar(ParaAffine2D affine, double &xMmvsp, double &yMmvsp, double &angle, double &theta);
+
+	//20. 仿射变换
+	static ParaAffine2D VectorToSimilarity(std::vector<Point2D> vPtOrigine, std::vector<Point2D> vPtTarget);
+
+	//21. 创建圆的离散点
+	static void GenCirclePoints(Point2I ptCenter, double radius, double stepLength, std::vector<Point2I> &vPtCircle);
+
+	//22. 执行标定
+	static CalibrateResult CameraCalibrate(double *px, double *py, double *xmm, double *ymm, int sz);
+
+	//23. 坐标转换
+	static Point2D CoordinateTransform(Point2D pt, CalibrateResult calibrate);
+
+	//24. 相机标定
+	static void CalibrateCamera(Point2D *ptArrayCamera, Point2D *ptArrayWorld, int sz, ParaCalibrate &result);
+
+	//25. 旋转中心
+	static Point2D GetRotateCenter(Point2D ptOrigine, Point2D ptRotate, double angle);
+
+	//26. XYTheta标定
+	static void CalibrateXyTheta(std::vector<Point2D> vPtOrgine, std::vector<Point2D> vPtReal, double angle, ParaCalibrate &result);
+
+public:
+	//1. 对象是否存在
+	static bool ObjectExist(HalconCpp::HObject &hObject);
+
+	//2. 拷贝图像
+	static void CopyImage(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget);
+
+	//3. 产生空对象
+	static void GenEmptyObject(HalconCpp::HObject &hObject);
+
+	//4. 均值滤波
+	static void ImageMean(HalconCpp::HObject &hObject, int maskWidth, int maskHeight, HalconCpp::HObject &hTarget);
+
+	//5. 灰度闭运算
+	static void GrayClosing(HalconCpp::HObject &hObject, int maskWidth, int maskHeight, HalconCpp::HObject &hTarget);
+
+	//6. 灰度开运算
+	static void GrayOpening(HalconCpp::HObject &hObject, int maskWidth, int maskHeight, HalconCpp::HObject &hTarget);
+
+	//7. 图像均值
+	static void ImageIntensity(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, double &avgResult, double &stdResult);
+
+	//8. 图像直方图统计
+	static void GetHistogram(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, int sz, int *aryHist);
+
+	//9. 对象组合
+	static void ObjectConcat(HalconCpp::HObject &hObject1, HalconCpp::HObject &hObject2, HalconCpp::HObject &hTarget);
+
+	//10. 截取区域
+	static void ReduceDomain(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//11. 截取图像
+	static void CropDomain(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget);
+
+	//12. 区域转换为图像
+	static void RegionToBin(HalconCpp::HObject &hRegion, int width, int height, HalconCpp::HObject &hTarget);
+
+	//13. 创建NCC匹配句柄
+	static int CreateNccModel(HalconCpp::HObject &hObject, double angleStart, double angleEnd, double angleStep, int limitTime);
+
+	//14. 释放模板ID
+	static void ClearNccModel(int id);
+
+	//15. 查找模板
+	static void FindNccModel(HalconCpp::HObject &hObject, int idModel, double minScore, int numMatches, std::vector<ParaMatch> &vResult);
+
+	//16. 图像中值
+	static void ImageMedian(HalconCpp::HObject &hObject, double radius, HalconCpp::HObject &hTarget);
+
+	//17. 图像差值
+	static void ImageSub(HalconCpp::HObject &hObject1, HalconCpp::HObject &hObject2, double mul, int gray, HalconCpp::HObject &hTarget);
+
+	//18. 图像转换
+	static void AffineTransImage(HalconCpp::HObject &hImage, ParaAffine2D affine, HalconCpp::HObject &hTarget);
+
+	//19. 投影直方图
+	static void ProjectHistogram(HalconCpp::HObject &hImage, int pLeft, int pTop, int pRight, int pBottom, double *aryHor, double *aryVer);
+
+	//20. 图像的乘法
+	static void ImageMul(HalconCpp::HObject &hObject, double mul, HalconCpp::HObject &hTarget);
+
+	//21. 对象数量
+	static int ObjectNumber(HalconCpp::HObject &hObject);
+
+	//22. 获取图像大小
+	static void GetImageSize(HalconCpp::HObject &hObject, int &width, int &height);
+
+	//23. 读取图像
+	static void ReadImage(HalconCpp::HObject &hObject, std::string &fileName);
+
+	//24. 获取像素
+	static bool GetImagePixel(HalconCpp::HObject &hObject, Point2D pt, int &bResult, int &gResult, int &rResult);
+
+	//25. 图像区域分割
+	static void ImageThreshold(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, int minThreshold, int maxThreshold);
+
+	//26. uchar转换为图像
+	static void DataToObject(uchar *data, int width, int height, HalconCpp::HObject &hObject);
+
+	//27. 图像放大
+	static void ZoomImageFactor(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, double xRate, double yRate);
+
+	//28. 图像放大
+	static void ZoomImageSize(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, int width, int hegiht);
+
+	//29. 创建Shape模板
+	static int CreateShapeModel(HalconCpp::HObject &hObject, double angleStart, double angleEnd, double angleStep, int minContrast, int minCostTime);
+
+	//30. 释放Shape
+	static void ClearShapeModel(int id);
+
+	//31. 查找Shape模板
+	static void FindShapeModel(HalconCpp::HObject &hObject, int idModel, double minScore, int numMatches, std::vector<ParaMatch> &vResult);
+
+	//32. 清理所有NCC模板
+	static void ClearAllNccModel();
+
+	//33. 清理所有的Shape模板
+	static void ClearAllShapeModel();
+
+	//34. 获取区域
+	static void GetDomain(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget);
+
+	//35. Shape定位轮廓
+	static void GetShapeContour(HalconCpp::HObject &hContour, int id);
+
+	//36. 轮廓转化
+	static void AffineTransContour(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, ParaAffine2D affine);
+
+	//37. 图像灰度化
+	static void ImageToGray(HalconCpp::HObject &hObject, int iGray, HalconCpp::HObject &hTarget);
+
+	//38. 局部增强
+	static void ImageEmphasize(HalconCpp::HObject &hObject, int maskWidth, int maskHeight, double rate, HalconCpp::HObject &hTarget);
+
+	//39. 创建图像
+	static void GenImageConst(HalconCpp::HObject &hImage, int width, int height, int gray);
+
+	//40. 大律法
+	static int Otsu(int *aryData, int sz);
+
+	//41. 截取ROI区域的图像并纠正
+	static void GetAndAdjustRectImage(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, int modeAngle, HalconCpp::HObject &hTarget);
+
+	//42. 截取ROI区域的图像并纠正
+	static void GetAndAdjustRectImage(HalconCpp::HObject &hObject, double cx, double cy, double angle, int width, int height, HalconCpp::HObject &hTarget);
+
+	//43. 创建图像
+	static void GenImage(const unsigned char* data, HalconCpp::HObject &hImage, int imgType, int width, int height);
+
+	//44. 创建椭圆区域
+	static void GenEllipse(HalconCpp::HObject &hRegion, double x, double y, double angle, double length1, double length2);
+
+	//45. 图像选择
+	static void ImageRotate(HalconCpp::HObject &hObject, int angle, HalconCpp::HObject &hTarget);
+
+	//46. 截图图像 
+	static void ImageDraw(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, int left, int top, int width, int height);
+
+	//47. 截图带角度图像
+	static void GetAngleImage(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, Point2D center, double angle, int width, int height);
+
+public:
+	//1. 区域是否存在
+	static bool RegionExist(HalconCpp::HObject &hRegion);
+
+	//2. 区域合并
+	static void RegionUnion2(HalconCpp::HObject &hRegion1, HalconCpp::HObject &hRegion2, HalconCpp::HObject &hTarget);
+
+	//3. 区域差值
+	static void RegionDiffer(HalconCpp::HObject &hRegion1, HalconCpp::HObject &hRegion2, HalconCpp::HObject &hTarget);
+
+	//4. 区域交集
+	static void RegionIntersection(HalconCpp::HObject &hRegion1, HalconCpp::HObject &hRegion2, HalconCpp::HObject &hTarget);
+
+	//5. 区域连通
+	static void RegionConnect(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//6. 区域闭运算
+	static void RegionClosing(HalconCpp::HObject &hRegion, double radius, HalconCpp::HObject &hTarget);
+
+	//7. 区域开运算
+	static void RegionOpening(HalconCpp::HObject &hRegion, double radius, HalconCpp::HObject &hTarget);
+
+	//8. 区域腐蚀
+	static void RegionErosion(HalconCpp::HObject &hRegion, double radius, HalconCpp::HObject &hTarget);
+
+	//9. 区域膨胀
+	static void RegionDilation(HalconCpp::HObject &hRegion, double radius, HalconCpp::HObject &hTarget);
+
+	//10. 区域合并
+	static void RegionUnion(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//11. 区域转换
+	static void AffineTransRegion(HalconCpp::HObject &hRegion, ParaAffine2D affine, HalconCpp::HObject &hTarget);
+
+	//12. 判断点在区域里面
+	static bool JudgeInRegion(Point2D pt, HalconCpp::HObject &hRegion);
+
+	//13. 区域中心
+	static void AreaCenter(HalconCpp::HObject &hRegion, int &area, double &x, double &y);
+
+	//14. 面积赛选
+	static void SelectShape(HalconCpp::HObject &hRegion, std::string strMode, double minValue, double maxValue, HalconCpp::HObject &hTarget);
+
+	//15. 最大区域
+	static void MaxRegion(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//16. 最小外接圆
+	static void SmallestCircle(HalconCpp::HObject &hRegion, double &x, double &y, double &radius);
+
+	//17. 最小外接矩形
+	static void SmallestRectangle(HalconCpp::HObject &hRegion, double &x1, double &y1, double &x2, double &y2);
+
+	//18. 区域最小外界矩形 
+	static void SmallestRectangle2(HalconCpp::HObject &hRegion, double &x, double &y, double &angle, double &xa, double &xb);
+
+	//19. 创建矩形2
+	static void GenRectangle2(HalconCpp::HObject &hTarget, double x, double y, double angle, double xa, double xb);
+
+	//20. 创建圆
+	static void GenCircle(HalconCpp::HObject &hObject, double x, double y, double radius);
+
+	//21. 创建直线区域
+	static void GenRegionLine(HalconCpp::HObject &hRegion, double x1, double y1, double x2, double y2);
+
+	//22. 产生矩形
+	static void GenRectangle1(HalconCpp::HObject &hTarget, double x1, double y1, double x2, double y2);
+
+	//23.产生多边行区域
+	static void GenRegionPolygonFilled(HalconCpp::HObject &hTarget, Point2D *ptArray, int sz);
+
+	//24. 产生十字
+	static void GenCrossObject(HalconCpp::HObject &hObject, Point2D pt, double sz, double angle);
+
+	//25. 产生区域轮廓
+	static void GenContourRegion(HalconCpp::HObject &hRegion, std::string strMode, HalconCpp::HObject &hTarget);
+
+	//26. 选择对象
+	static void SelectObject(HalconCpp::HObject &hObject, HalconCpp::HObject &hSelected, int idx);
+
+	//27. 区域填充
+	static void FillUp(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//28. 创建矩形1
+	static void GenRectangle1(HalconCpp::HObject &hTarget, std::vector<double> vX1, std::vector<double> vY1, std::vector<double> vX2, std::vector<double> vY2);
+
+	//29. 创建矩形2
+	static void GenRectangle2(HalconCpp::HObject &hTarget, std::vector<double> vX, std::vector<double> vY, std::vector<double> vAngle, std::vector<double> vLength1, std::vector<double> vLength2);
+
+	//30. 创建圆
+	static void GenCircle(HalconCpp::HObject &hTarget, std::vector<double> vX, std::vector<double> vY, std::vector<double> vRadius);
+
+	//31. 获取直方图区域
+	static void GenDispZft(HalconCpp::HObject &hImage, int dispWidth, int dispHeight, HalconCpp::HObject &hZftObject);
+
+	//32. 区域膨胀
+	static void RegionDilationRectangle(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget, int width, int height);
+
+	//33. 产生区域
+	static void GenRegionPoints(HalconCpp::HObject &hRegion, std::vector<Point2I> vPoints);
+
+public:
+	//1. 显示模式
+	static void SetDraw(int id, std::string strMode);
+
+	//2. 显示位置
+	static void SetTposition(int id, int left, int top);
+
+	//3. 显示颜色
+	static void SetColor(int id, std::string strColor);
+
+	//4. 写文字
+	static void WriteString(int id, std::string str);
+
+	//5. 设置字体
+	static void SetFont(int id, int sz);
+
+	//6. 显示字符
+	static void DispMessage(int id, std::string str, int xPos, int yPos, std::string strColor, std::string strBox);
+
+	//7. 颜色转换
+	static std::string ToColor(int iColor);
+
+	//8. 设置颜色
+	static void SetRgb(int id, int red, int green, int blue);
+
+	//29. rgb转换为颜色
+	static std::string Rgb2Color(int r, int g, int b);
+
+public:
+	//1. 检测判断
+	static bool JudgeResult(double value, double fzMin, double fzMax);
+
+	//2. 排序
+	static void SortArray(double *data, int sz, int iType);
+
+	//4. 获取2个点的中点
+	static Point2D GetPointCenter(Point2D pt1, Point2D pt2);
+
+	//7. 格式转换
+	static Point2I PointToInt(Point2D pt);
+
+	//8. 格式转换
+	static Point2D PointToDouble(Point2I pt);
+
+	//9. 数据合并, 公式 = 10000 * int1 + int2, int1, int2, 不运输超过10000 
+	static int IntegerUnion(int int1, int int2);
+
+	//10. 数据分解
+	static void IntegerDivide(int intInput, int &int1, int &int2);
+
+	//11. 点坐标合并,用于查找
+	static int PointToInteger(Point2I pt);
+
+	//12. 整数转换为坐标
+	static Point2I IntegerToPoint(int intIntput);
+
+	//13. 字符串分割
+	static int SplitString(std::string strInput, std::string strSeparator, std::vector<std::string> &vOutString);
+
+	//14. 判断double数据是否无效
+	static bool IsNaN(double value);
+
+	//15 格式化字符串
+	static std::string FormatString(const char *lpcszFormat, ...);
+
+	//16. 字符分割
+	static int StringSplit(const std::string& strScr, const std::string& delim, std::vector<std::string>& strings);
+	static void StringTrim(std::string& s);
+
+};
+
+#endif
+
diff --git a/Common_Class/VisionLib/ApiVisionSDK/include/IClsDisplay.h b/Common_Class/VisionLib/ApiVisionSDK/include/IClsDisplay.h
new file mode 100644
index 0000000..02a3740
--- /dev/null
+++ b/Common_Class/VisionLib/ApiVisionSDK/include/IClsDisplay.h
@@ -0,0 +1,171 @@
+/**************************************************************************************************
+		Copyright 2020-2022 深圳市八零联合装备有限公司
+		All rights reserved.
+
+		Author: zhenbin,jiang
+		Date: 2021-03-23
+		Version: V1.0.0
+
+		Description:
+			本模块主要是显示基类,包括创建ROI,编辑ROI等
+
+***************************************************************************************************/
+#ifndef I_CLS_DISPLAY_H
+#define I_CLS_DISPLAY_H
+
+typedef enum DISP_TYPE
+{
+	DISP_OBJECT = 0,        //外部显示的特征, 如DispObj();
+	DISP_REGION = 1,        //ROI区域, 如DispRegion();
+	DISP_CROSS = 2,         //显示十字,如DispCross()
+	DISP_SELECT = 3         //显示旋转, 如DispSelect()
+}DISP_TYPE;
+
+typedef enum BOOUNION_MOUSE_EVENT
+{
+	NO_EVENT = -1,                //无事件
+	LEFT_MOUSE_BUTTON_DOWN = 0,   //左键按下
+	LEFT_MOUSE_BUTTON_UP = 1,     //左键按上
+	LEFT_MOUSE_BUTTON_DOUBLE = 2, //左键双击
+	RIGHT_MOUSE_BUTTON_DOWN = 3,  //右键按下
+	RIGHT_MOUSE_BUTTON_UP = 4,    //右键按上
+	WHEEL_MOUSE_BUTTON = 5,       //滚动事件
+	MOUSE_BUTTON_MOVE = 6,       //鼠标移动
+	DRAG_SCROLL_MOVE = 7         //拖动事件
+}BOOUNION_MOUSE_EVENT;
+
+typedef struct _InfRegion
+{
+	int tyShape;  //1是矩形1;2是矩形2;4是圆形;8是任意形状
+	std::vector<double> vInfPos;    //位置信息
+}InfRegion;
+
+//显示位置、比例、像素值
+typedef std::function<void(int msgEvent, int x, int y, double rate, int pixel)> ImageOperateCallback;
+class IClsDisplay
+{
+public:
+	virtual ~IClsDisplay() {};
+
+	//0. 创建窗体
+	virtual void OpenWindow(__int64 id, int width, int height) = 0;
+
+	//1. 自动窗体大小
+	virtual void AutoWindowSize(int width, int height) = 0;
+
+	//2. 设置类型
+	virtual void SetShapeType(int shape) = 0;
+
+	//3. 显示对象
+	virtual void DispObj(HalconCpp::HObject &hObject) = 0;
+
+	//4. 清理窗体
+	virtual void ClearWindow(void) = 0;
+
+	//5. 显示范围
+	virtual void SetPart(int x1, int y1, int x2, int y2) = 0;
+
+	//6. 设置字体
+	virtual void SetFont(int font) = 0;
+
+	//7. 显示字符
+	virtual void DispMessage(int x, int y, std::string str, std::string strColor, std::string strBox) = 0;
+
+	//8. 画图
+	virtual void DrawRegion(void) = 0;
+
+	//9. 编辑区域
+	virtual void EditRegion(void) = 0;
+
+	//10. 显示图像
+	virtual void DispImage(void) = 0;
+
+	//11. 显示ROI区域
+	virtual void DispRegion(void) = 0;
+
+	//12. 显示屏蔽区域
+	virtual void DispCross(void) = 0;
+
+	//13. 窗体是否存在
+	virtual bool WindowIsExist(void) = 0;
+
+	//14. 关闭窗体
+	virtual void CloseWindow(void) = 0;
+
+	//15. 加载显示图
+	virtual void GenImage(const unsigned char* data, int imgType, int width, int height) = 0;
+
+	//16. 获取图像
+	virtual HalconCpp::HObject& GetImage(void) = 0;
+
+	//17. 获取区域
+	virtual HalconCpp::HObject& GetRegion(void) = 0;
+
+	//18. 获取选择区域
+	virtual HalconCpp::HObject& GetSelect(void) = 0;
+
+	//19. 设置图像
+	virtual void SetImage(HalconCpp::HObject &hObject) = 0;
+
+	//20. 设置区域
+	virtual void SetRegion(HalconCpp::HObject &hRegion) = 0;
+
+	//21. 设置选择区域
+	virtual void SetSelect(HalconCpp::HObject &hRegion) = 0;
+
+	//22. 设置颜色
+	virtual void SetColor(std::string color, DISP_TYPE disp) = 0;
+
+	//23. 设置模式
+	virtual void SetDraw(std::string draw, DISP_TYPE disp) = 0;
+
+	//24. 显示选择
+	virtual void DispSelect(void) = 0;
+
+	//25. 设置当前的操作状态
+	virtual void SetOperFlag(OPER_FLAG flag) = 0;
+
+	//26 回调函数
+	virtual void SetOperatorCallback(ImageOperateCallback callback) = 0;
+
+	//27. 获取十字
+	virtual HalconCpp::HObject& GetCross(void) = 0;
+
+	//28. 设置十字
+	virtual void SetCross(HalconCpp::HObject &cross) = 0;
+
+	//29. 设置背景颜色
+	virtual void SetBackgroundColor(std::string strColor) = 0;
+
+	//30. 设置显示线的类型. <1为实线, 否则为虚线
+	virtual void SetLineStyle(int lineStyle, DISP_TYPE disp) = 0;
+
+	//31. 图像坐标转换为窗体的坐标
+	virtual Point2I PixelToClient(Point2I pos) = 0;
+
+	//32. 刷新不使能
+	virtual void UnableFlush(void) = 0;
+
+	//33. 刷新使能
+	virtual void AbleFlush(void) = 0;
+
+	//34. 当前的编辑状态
+	virtual OPER_FLAG GetOperMode(void) = 0;
+
+	//35. 窗体ID
+	virtual int GetDisplayID(void) = 0;
+
+	//36. 位置信息
+	virtual InfRegion GetInfRegion(void) = 0;
+
+	//37. 设置位置信息
+	virtual void SetInfRegion(InfRegion inf) = 0;
+
+	//38. 设置左上定点坐标
+	virtual void SetLtPoint(int xPos, int yPos) = 0;
+
+	//39. 获取左上点的坐标
+	virtual Point2I GetLtPoint(void) = 0;
+};
+
+#endif
diff --git a/Common_Class/VisionLib/ApiVisionSDK/include/VisionLib.h b/Common_Class/VisionLib/ApiVisionSDK/include/VisionLib.h
new file mode 100644
index 0000000..1c75633
--- /dev/null
+++ b/Common_Class/VisionLib/ApiVisionSDK/include/VisionLib.h
@@ -0,0 +1,16 @@
+#ifndef VISION_LIB
+#define VISION_LIB
+
+#include "IClsDisplay.h"
+
+#ifdef EXPORT_DLL_BASE_VISION
+#define EXPORTED_VISION _declspec(dllexport)
+#else
+#define EXPORTED_VISION _declspec(dllimport)
+#endif
+
+extern "C" EXPORTED_VISION IClsDisplay* ClsDisplay_Create(void);
+extern "C" EXPORTED_VISION void ClsDisplay_Free(IClsDisplay *pClsDisplay);
+
+#endif
+
diff --git a/Common_Class/VisionLib/BaseDisplaySDK/include/BaseDisplayLib.h b/Common_Class/VisionLib/BaseDisplaySDK/include/BaseDisplayLib.h
new file mode 100644
index 0000000..646313d
--- /dev/null
+++ b/Common_Class/VisionLib/BaseDisplaySDK/include/BaseDisplayLib.h
@@ -0,0 +1,24 @@
+#ifndef BASE_DISPLAY_LIB
+#define BASE_DISPLAY_LIB
+
+#include "IClsShape.h"
+#include "IImageDisplay.h"
+
+#ifdef EXPORT_DLL_BASE_DISPLAY
+#define EXPORTED_BASE_DISPLAY _declspec(dllexport)
+#else
+#define EXPORTED_BASE_DISPLAY _declspec(dllimport)
+#endif
+
+//1. 获取当前的版本
+extern "C" EXPORTED_BASE_DISPLAY int Display_GetVersion(char* pszVersion, const int nBufferSize);
+//2. 创建ClsDisplay模块
+extern "C" EXPORTED_BASE_DISPLAY IImageDisplay* Display_CreateDisplay(void);
+//3. 释放模块
+extern "C" EXPORTED_BASE_DISPLAY void Display_FreeDisplay(IImageDisplay *pClsDisplay);
+//4. 创建ClsShape模块
+extern "C" EXPORTED_BASE_DISPLAY IClsShape* Display_CreateClsShape(void);
+//5. 释放模块
+extern "C" EXPORTED_BASE_DISPLAY void Display_FreeShape(IClsShape *pShape);
+
+#endif
diff --git a/Common_Class/VisionLib/BaseDisplaySDK/include/BaseVision.h b/Common_Class/VisionLib/BaseDisplaySDK/include/BaseVision.h
new file mode 100644
index 0000000..a530f44
--- /dev/null
+++ b/Common_Class/VisionLib/BaseDisplaySDK/include/BaseVision.h
@@ -0,0 +1,90 @@
+#ifndef BASE_VISION_H
+#define BASE_VISION_H
+
+#ifdef EXPORT_DLL_BASE_DISPLAY
+#define EXPORTED_BASE_DISPLAY _declspec(dllexport)
+#else
+#define EXPORTED_BASE_DISPLAY _declspec(dllimport)
+#endif
+
+#include "typesdef.h"
+
+
+class EXPORTED_BASE_DISPLAY BaseVision
+{
+public:
+	BaseVision();
+	~BaseVision();
+
+public:
+	//1. 获取当前的软件版本
+	static std::string GetVersion(void);
+
+	//2. 获取更新内容
+	static std::string GetUpdate(void);
+
+	//3. 获取当前的目录
+	static std::string GetAppPathA();
+
+public:
+	//1. 画矩形
+	static bool drawRect1(CDC* pDC, RECT1 rect, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//2. 画圆形
+	static bool drawCircle(CDC* pDC, Circle2D cirle, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//3. 画直线
+	static bool drawLine(CDC* pDC, Line2D line, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//4. 画十字价
+	static bool drawCross(CDC* pDC, CROSS cross, COLORREF color, int lineWidth);
+
+	//5. 画布矩形2
+	static bool drawRect2(CDC* pDC, RECT2 rect, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//6. 旋转变换公式
+	static Point2D rotatePoint(Point2D pt, Point2D ptCenter, double angle);
+
+	//7. 画任意区域
+	static bool drawRegion(CDC* pDC, Region2D region, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//8. 初始化图像
+	static bool createImage(CImage &image, int width, int height, COLORREF color);
+
+	//9. 拷贝图像
+	static bool copyImage(const CImage *pSrcImage, CImage &destImage);
+
+	//10. 坐标转换
+	static Point2I toPoint2I(Point2D pt);
+
+	//11. 坐标转换
+	static Point2D toPoint2D(Point2I pt);
+
+	//12. 2点距离
+	static double distancePP(double x1, double y1, double x2, double y2);
+
+	//13. 2点的角度
+	static double anglePP(double x1, double y1, double x2, double y2);
+
+	//14. 判断点是否在直线边界上
+	static bool judgeLinePoint(Point2D pt, Line2D line, double fzDist);
+
+	//15. 判断点与点是否相邻
+	static bool judgePointNear(Point2D pt0, Point2D pt1, double fzDist);
+
+	//16. 点到直线的距离
+	static double distancePL(double px, double py, double lineX1, double lineY1, double lineX2, double lineY2);
+
+	//17. 图像二值化
+	static void imageThreshold(CImage *image, int minThreshold, int maxThreshold);
+
+	//18. 宝贝数据
+	static bool bmpToImage(CBitmap *pBitmap, CImage &image);
+
+	//19. 判断文件是否存在
+	static bool fileIsExist(std::string fileName);
+
+};
+
+#endif
+
diff --git a/Common_Class/VisionLib/BaseDisplaySDK/include/IClsShape.h b/Common_Class/VisionLib/BaseDisplaySDK/include/IClsShape.h
new file mode 100644
index 0000000..a63b4ee
--- /dev/null
+++ b/Common_Class/VisionLib/BaseDisplaySDK/include/IClsShape.h
@@ -0,0 +1,40 @@
+#ifndef ICLS_SHAPE_H
+#define ICLS_SHAPE_H
+
+#include "typesdef.h"
+
+class IClsShape
+{
+public:
+	virtual ~IClsShape() {};
+
+public:
+	//1. 设置shape
+	virtual int setShape(int shape) = 0;
+
+	//2. 设置参数
+	virtual bool setValue(const RECT1 value) = 0;
+	virtual bool setValue(const RECT2 value) = 0;
+	virtual bool setValue(const Circle2D value) = 0;
+	virtual bool setValue(const Region2D value) = 0;
+	virtual bool setValue(const Line2D value) = 0;
+	virtual bool setValue(const CROSS value) = 0;
+
+public:
+	//1. 获取形态
+	virtual int getShape(void) = 0;
+
+	//2. 获取数据
+	virtual bool getValue(RECT1 &value) = 0;
+	virtual bool getValue(RECT2 &value) = 0;
+	virtual bool getValue(Circle2D &value) = 0;
+	virtual bool getValue(Region2D &value) = 0;
+	virtual bool getValue(Line2D &value) = 0;
+	virtual bool getValue(CROSS &value) = 0;
+
+public:
+	//1. 拷贝数据
+	virtual bool copy(IClsShape *pShape) = 0;
+
+};
+#endif
diff --git a/Common_Class/VisionLib/BaseDisplaySDK/include/IImageDisplay.h b/Common_Class/VisionLib/BaseDisplaySDK/include/IImageDisplay.h
new file mode 100644
index 0000000..1c1bff6
--- /dev/null
+++ b/Common_Class/VisionLib/BaseDisplaySDK/include/IImageDisplay.h
@@ -0,0 +1,91 @@
+#ifndef IIMAGE_DISPLAY_H
+#define IIMAGE_DISPLAY_H
+
+#include "IClsShape.h"
+
+class IImageDisplay
+{
+public:
+	virtual ~IImageDisplay() {};
+
+public:
+	//1. 设置模式
+	virtual int setOperFlag(OPER_FLAG flag) = 0;
+
+	//2. 设置Shape类型
+	virtual int setShape(int shape) = 0;
+
+	//3. 设置回调事件
+	virtual int setMouseCallback(ImageMouseCallback mouseEvent) = 0;
+
+	//4. 设置区域
+	virtual int setRegion(IClsShape *pShape) = 0;
+
+	//5. 设置图像
+	virtual int setImage(CImage &image) = 0;
+
+	//6. 设置颜色
+	virtual int setDrawColor(COLORREF color) = 0;
+
+	//7. 设置背景颜色
+	virtual int setEditColor(COLORREF color) = 0;
+
+	//8. 设置十字线
+	virtual int ShowCross(bool valid) = 0;
+
+	//9. 设置十字的颜色
+	virtual int setCrossColor(COLORREF color) = 0;
+
+public:
+	//1. 获取shape类型
+	virtual int getShape(void) = 0;
+
+	//2. 获取region
+	virtual IClsShape* getRegion(void) = 0;
+
+	//3. 获取图像
+	virtual CImage& getImage(void) = 0;
+
+
+public:
+	//1. 显示图像
+	virtual void dispImage(void) = 0;
+
+	//2. 显示区域
+	virtual void dispRegion(void) = 0;
+
+	//3. 创建窗体
+	virtual void openWindow(__int64 id) = 0;
+
+	//4. 设置背景颜色
+	virtual void setBgColor(COLORREF color) = 0;
+
+	//5. 自动设置大小
+	virtual void autoSize(int imgWidth, int imgHeight) = 0;
+
+	//6. 显示图像
+	virtual void dispObj(CImage &image) = 0;
+
+	//7. 清理显示对象
+	virtual void clearObj(void) = 0;
+
+	//8. 关闭窗体
+	virtual void closeWindow(void) = 0;
+
+	//9. 获取当前的句柄
+	virtual CWnd* getWnd(void) = 0;
+
+	//10. 窗体坐标转换
+	virtual Point2D toImagePoint(Point2D point) = 0;
+
+	//11. 转换窗体坐标
+	virtual Point2D toWindowPoint(Point2D point) = 0;
+
+	//12. 显示画面
+	virtual void dispFrame(IClsShape *pShape) = 0;
+
+	//13. 显示十字架
+	virtual void dispCross(void) = 0;
+};
+
+#endif
diff --git a/Common_Class/VisionLib/BaseDisplaySDK/include/typesdef.h b/Common_Class/VisionLib/BaseDisplaySDK/include/typesdef.h
new file mode 100644
index 0000000..7006e35
--- /dev/null
+++ b/Common_Class/VisionLib/BaseDisplaySDK/include/typesdef.h
@@ -0,0 +1,150 @@
+#ifndef TYPES_DEF_H
+#define TYPES_DEF_H
+
+#include <Windows.h>
+#include <iostream>
+#include <stdlib.h>
+#include <assert.h>
+#include <string>
+#include <map>
+#include <vector>
+#include <math.h>
+#include <atlimage.h>
+#include <io.h>
+#include <functional>
+
+//SDK版本号
+#define   VERSION_NO     "1.0.0.0"  
+typedef unsigned char uchar;
+typedef BYTE uchar;
+
+typedef std::function<void(int msgEvent, int x, int y, double rate)> ImageMouseCallback;
+
+//角度转换
+#define _RadToDeg(x) (double)(x) * 57.295779513082
+#define _DegToRad(x) (double)(x) / 57.295779513082
+#define  FUNC_OK                  1    //函数运行OK
+#define  FUNC_NG                  0    //函数运行NG
+
+typedef enum OPER_FLAG
+{
+	DEFAULT_OPER_FLAG = 0,          //没有任何操作
+	DRAW_OPER_FLAG,                 //画图
+	EDIT_OPER_FLAG,                 //编辑
+	SELECT_OPER_FLAG,               //选择
+	SCROLL_OPER_FLAG                  //拖动模式
+}OPER_FLAG;
+
+//ROI区域
+#define ROI_ALL_TYPE        0                  /* 所有格式 */
+#define ROI_RECT1           1                  /* 矩形区域1 */
+#define ROI_RECT2           2                  /* 矩形区域2 */
+#define ROI_CIRCLE          4                  /* 圆形区域 */
+#define ROI_REGION          8                  /* 任意区域 */
+#define ROI_LINE            16                 /* 直线区域 */
+#define ROI_CROSS           32                 /* 十字架区域 */
+#define UNKNOW_SHAPE        64                 /* 没有任何区域 */
+
+//点1
+typedef struct _Point2I
+{
+	int x;
+	int y;
+}Point2I;
+
+//点2
+typedef struct _Point2D
+{
+	double x;
+	double y;
+}Point2D;
+
+//矩形1的坐标
+typedef struct _RECT1
+{
+	Point2I pt0;
+	Point2I pt1;
+}RECT1;
+
+//矩形2的坐标
+typedef struct _RECT2
+{
+	Point2D pt;
+	double angle;
+	double width;
+	double height;
+}RECT2;
+
+//圆形坐标
+typedef struct _Circle2D
+{
+	Point2D pt;
+	double radius;
+}Circle2D;
+
+//区域数据
+typedef struct _Region2D
+{
+	std::vector<Point2D> vPtData;
+}Region2D;
+
+//直线
+typedef struct _Line2D
+{
+	Point2D pt0;
+	Point2D pt1;
+}Line2D;
+
+typedef struct _CROSS
+{
+	Point2D pt;
+	double size;
+}CROSS;
+
+//标定数据结构
+typedef struct _ParaAffine2D
+{
+	double kx0;    /* 仿射变换关系 */
+	double kx1;    /* 仿射变换关系 */
+	double kx2;    /* 仿射变换关系 */
+	double ky0;    /* 仿射变换关系 */
+	double ky1;    /* 仿射变换关系 */
+	double ky2;    /* 仿射变换关系 */
+}ParaAffine2D;
+
+//标定参数
+typedef struct _ParaCalibrate
+{
+	ParaAffine2D affine;   /* 2D转换关系 jiang, 2020-08-29 */
+	double xMmvsp;         /* X方向的图像当量 */
+	double yMmvsp;         /* Y方向的图像当量 */
+	double angle;          /* 2个坐标系的夹角 */
+	double theta;          /* 2个坐标系的倾斜角 */
+}ParaCalibrate;
+
+//模板参数
+typedef struct _ParaMatch
+{
+	Point2D pt;          /* 定位的中点 */
+	double angle;        /* 定位的角度 */
+	double score;        /* 定位的分数 */
+	int mirror;          //是否镜像,1表示没有镜像, 0表示旋转180度,2表示水平镜像,3表示垂直镜像
+}ParaMatch;
+
+//相机标定参数
+typedef struct _CalibrateResult
+{
+	double kx0;       /*X方向系数*/
+	double kx1;       /*X方向系数*/
+	double kx2;       /*X方向系数*/
+	double kx3;       /*X方向系数*/
+	double kx4;       /*X方向系数*/
+	double ky0;       /*Y方向系数*/
+	double ky1;       /*Y方向系数*/
+	double ky2;       /*Y方向系数*/
+	double ky3;       /*Y方向系数*/
+	double ky4;       /*Y方向系数*/
+}CalibrateResult;
+
+#endif
+
diff --git a/Common_Class/VisionLib/BlGrabber/include/FrameBufferController.h b/Common_Class/VisionLib/BlGrabber/include/FrameBufferController.h
new file mode 100644
index 0000000..46ee4fe
--- /dev/null
+++ b/Common_Class/VisionLib/BlGrabber/include/FrameBufferController.h
@@ -0,0 +1,125 @@
+#pragma once
+
+#include <deque>
+#include "../../ENRIT/Define/Global_Define.h"
+
+class AFX_EXT_CLASS CMultiBuffer	// 促吝 滚欺 汲沥, m_nBuff 俺狼 滚欺甫 积己 棺 包府(咯矾 俺狼 胶牡 滚欺 历厘)
+{	
+	BYTE*	m_pTotalBuff;	// m_BuffCnt 俺荐 父怒狼 滚欺甫 茄波锅俊 且寸.
+	int		m_BuffCnt;		// 滚欺狼 俺荐
+	SIZE_T	m_BuffSize;		// 俺喊 滚欺狼 农扁 (frameWidth * frameHeight * frameCnt
+
+							// 滚欺绰 n俺狼 Frame 栏肺 积己 : Width * Height * Cnt
+	int		m_FrameWidth, m_FrameHeight;
+	int		m_FrameCnt;
+public:
+	int		GetFrameWidth() { return m_FrameWidth; }
+	int		GetFrameHeight() { return m_FrameHeight; }
+	int		GetFrameCount() { return m_FrameCnt; }
+	int		GetBuffCount() { return m_BuffCnt; }
+	SIZE_T	GetFrameSize() { return GetFrameWidth()*GetFrameHeight(); }
+
+public:
+	CMultiBuffer() { m_BuffCnt = 0; m_pTotalBuff = NULL; m_FrameWidth = m_FrameHeight = m_FrameCnt = 0; }
+	~CMultiBuffer()
+	{
+		if (m_pTotalBuff)
+		{
+			VirtualFree(m_pTotalBuff, 0, MEM_RELEASE);
+			m_pTotalBuff = NULL;
+		}
+	}
+	BYTE*	GetMultiBuffData(int id) { return m_pTotalBuff + m_BuffSize*id; }
+	int		CreateMultiBuff(int buffCnt, int frameWidth, int frameHeight, int frameCnt)
+	{
+		m_BuffCnt = buffCnt;
+		m_FrameWidth = frameWidth;
+		m_FrameHeight = frameHeight;
+		m_FrameCnt = frameCnt;
+		m_BuffSize = (SIZE_T)frameWidth*frameHeight*frameCnt;
+
+		SIZE_T frameSize = frameWidth* frameHeight;
+		SIZE_T TotalBufferSize = frameSize*frameCnt*buffCnt;
+
+		m_pTotalBuff = (BYTE*)VirtualAlloc(NULL, TotalBufferSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+		if (m_pTotalBuff == NULL)
+		{
+			return FALSE;
+		}
+
+		ZeroMemory(m_pTotalBuff, sizeof(BYTE)*TotalBufferSize);
+
+		return TRUE;
+	}
+
+	void	ClearBuffer()
+	{
+		SIZE_T frameSize = m_FrameWidth * m_FrameHeight;
+		SIZE_T TotalBufferSize = frameSize * m_FrameCnt*m_BuffCnt;
+
+		ZeroMemory(m_pTotalBuff, sizeof(BYTE)*TotalBufferSize);
+	}
+};
+
+class AFX_EXT_CLASS CFrameBufferController
+{
+public:
+	CFrameBufferController(void);
+	virtual ~CFrameBufferController(void);
+
+public:
+	void			ClearBuffer();
+	BOOL			CreateBuffer(int iCamera, int nFrameWidth, int nFrameHeight, int nFrameCnt, int nBufferCnt = 1);
+	CMultiBuffer*	GetMultiBuffer() { return &m_MultiBuffer; }
+	BYTE			*GetMultiBuffData(int id) { return m_MultiBuffer.GetMultiBuffData(id); }
+
+	void			SetMutualEx(BOOL bEnter)
+	{
+		if (bEnter == TRUE)
+			EnterCriticalSection(&m_csProcBuffer);
+		else
+			LeaveCriticalSection(&m_csProcBuffer);
+	}
+
+	int				GetCameraIdx() { return m_nCameraIdx; }
+	LPBYTE			GetFrameBuferHeader(int iScan, int iFrame);
+	BOOL			CheckProcFrame(int iFrame);
+	BOOL			SetFrameBuffer(int iScan, int iFrame, LPBYTE lpBuffer);
+	LPBYTE			GetFrameHeaderLine(int iScan, int nLine = 0);
+	LPBYTE			GetFrameHeader_Line_FromStartLine(int iScan, int iFrame, int nStartLine = 0);
+	int				GetFrameWidth() { return GetMultiBuffer()->GetFrameWidth(); }
+	int				GetFrameHeight() { return GetMultiBuffer()->GetFrameHeight(); }
+	int				GetFrameCount() { return GetMultiBuffer()->GetFrameCount(); }
+	int				GetFrameSize() { return (int)GetMultiBuffer()->GetFrameSize(); }
+
+protected:
+	CRITICAL_SECTION	m_csProcBuffer;	// Critical Section
+	CMultiBuffer	m_MultiBuffer;
+	int				m_nCameraIdx;
+};
+
+struct stFrameIndex
+{
+	stFrameIndex()
+	{
+		nScanIdx = -1;
+		nFrameIdx = -1;
+	}
+	stFrameIndex(const stFrameIndex &rhs)
+	{
+		this->nScanIdx = rhs.nScanIdx;
+		this->nFrameIdx = rhs.nFrameIdx;
+	}
+	stFrameIndex(int nScan, int nGrab)
+	{
+		nScanIdx = nScan;
+		nFrameIdx = nGrab;
+	}
+
+	int nScanIdx;
+	int nFrameIdx;
+};
+
+typedef deque<stFrameIndex> dqGrabIdx;
+typedef deque<stFrameIndex>::iterator dqGrabIdxIt;
+
diff --git a/Common_Class/VisionLib/BlGrabber/include/GrabberControl.h b/Common_Class/VisionLib/BlGrabber/include/GrabberControl.h
new file mode 100644
index 0000000..f4d8260
--- /dev/null
+++ b/Common_Class/VisionLib/BlGrabber/include/GrabberControl.h
@@ -0,0 +1,79 @@
+#pragma once
+
+#include "FrameBufferController.h"
+#define INITX64_SUCCESS				0
+#define INITX64_FAIL_GETSERVER		11
+#define INITX64_FAIL_CREATEACQ		12
+#define INITX64_FAIL_TDIDIRECTION	13
+#define INITX64_FAIL_CAMNVIC		14
+#define INITX64_FAIL_CREATEBUFFER	15
+#define INITX64_FAIL_VIRTUALBUFFER	16
+#define INITX64_FAIL_CREATEXFER		17
+#define INITX64_FAIL_INVALID		18
+
+typedef enum { eMIL_GRAB_OFF = 0, eMIL_GRAB_ON, eMIL_SNAP_ON } _eGrabStatus_;
+
+#define MAX_DFC_PATH 1024
+typedef struct _tag_struct_Grabber_Intialize_Parameter_
+{
+	HWND hWnd;
+	BOOL bDemo;
+
+	int	 nScanCount;
+	int  nGrabBufCount;
+	int	 nGrabBufSize; // rcut 增加
+	int  nFrameWidth;
+	int  nFrameHeight;
+	int	 nConnectPort;
+	int	 nImgFlipX;
+	int	 nCameraIdx;
+	int	 nCameraScan;
+	int	 nBoardIdx;
+	int  nBoardCh;
+	char cDCFPath[MAX_DFC_PATH];
+	char cVICPath[MAX_DFC_PATH];
+	int	 nExposure;
+	int	 nExposureDelay;
+
+	_tag_struct_Grabber_Intialize_Parameter_()
+	{
+		ZeroMemory(this, sizeof(this));
+	}
+} _GRABBER_INIT_PARAM_;
+
+class AFX_EXT_CLASS CGrabberControl
+{
+public:
+	CGrabberControl(void);
+	virtual ~CGrabberControl(void);
+
+public:
+	virtual BOOL	Initialize(void *pParam, int *pErrorCode, int iBoard = 0) = 0;	// Grabber 檬扁拳
+	virtual BOOL	InitializeBuffer(void *pParam) = 0;
+	//////////////////////////////////////////////////////////////////////////
+	// Deinit
+	virtual BOOL	Deinitialize() = 0;
+
+	virtual BOOL	GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure = 10, BOOL bAuto = TRUE) = 0;
+	virtual BOOL	GrabLiveStart(int nExposure = 15) = 0;
+	virtual BOOL	GrabScanStop() = 0;
+
+	virtual BOOL	IsGrabbing() = 0;
+	virtual int		IsAcqFrame(int nFrameNo, int nThreadIdx = -1) = 0;
+
+	virtual LPBYTE	GetFrameHeader(int iScan, int nFrameNo, BOOL* bSuccess = NULL) = 0;
+	virtual LPBYTE	GetFrameHeaderLine(int iScan, int nLine, BOOL* bSuccess = NULL) = 0;
+	virtual BOOL	GetSmallImage(int iScan, LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping = TRUE) = 0;
+
+	virtual int		GetStartFrameIdx() { return 0; }
+	virtual int		GetEndFrameIdx() { return 0; }
+
+	virtual void	SetSimulFrame(int nFrame) = 0;
+	virtual int		GetGrabFrameCount() = 0;
+	virtual void	ClearGrabIdx() = 0;
+	virtual stFrameIndex	GetGrabFrame() = 0;
+	virtual stFrameIndex	GetGrabFrameNoRemove() = 0;
+	virtual CFrameBufferController	*GetFrameBuffer() = 0;
+	virtual BOOL	SetTriggerMode(BOOL bExTrigger) = 0;
+};
+
diff --git a/Common_Class/VisionLib/LogSDK/include/IDayLog.h b/Common_Class/VisionLib/LogSDK/include/IDayLog.h
new file mode 100644
index 0000000..e57188e
--- /dev/null
+++ b/Common_Class/VisionLib/LogSDK/include/IDayLog.h
@@ -0,0 +1,47 @@
+/**************************************************************************************************
+		Copyright 2020-2022 XXX XXX XXX
+		All rights reserved.
+
+		Author: zhenbin,jiang
+		Date: 2023-12-12
+		Version: V1.0.0
+
+		Description:
+				本模块输出日常运行日志
+***************************************************************************************************/
+#ifndef I_DAY_LOG_H
+#define I_DAY_LOG_H
+
+#include <afxwin.h>
+
+//打印日志信息
+typedef enum LOG_TYPE {
+	LOG_EOR = -1,
+	LOG_WARN,
+	LOG_SYSTEM,
+	LOG_CHAMBER,
+	LOG_RF,
+	LOG_GASBOX,
+	LOG_ESC,
+	LOG_SESC
+}LOG_TYPE;
+
+class IDayLog
+{
+public:
+	virtual ~IDayLog() {};
+
+	//1. 设置目录
+	virtual void setDir(const char *pszDir) = 0;
+
+	//2. 创建日志
+	virtual int createLogFile(void) = 0;
+
+	//3. 打印数据 
+	virtual void log(LOG_TYPE code, const char* pszText, const char* pszSuffix) = 0;
+
+	//4. 设置打印日志控件
+	virtual void setWnd(CWnd *pWnd) = 0;
+};
+
+#endif
diff --git a/Common_Class/VisionLib/LogSDK/include/ILogger.h b/Common_Class/VisionLib/LogSDK/include/ILogger.h
new file mode 100644
index 0000000..13515f8
--- /dev/null
+++ b/Common_Class/VisionLib/LogSDK/include/ILogger.h
@@ -0,0 +1,45 @@
+/**************************************************************************************************
+		Copyright 2020-2022 XXX XXX XXX
+		All rights reserved.
+
+		Author: zhenbin,jiang
+		Date: 2020-06-20
+		Version: V1.0.0
+
+		Description:
+				本模块主要是日志模块
+***************************************************************************************************/
+#ifndef I_LOGGER_H
+#define I_LOGGER_H
+
+#include <string>
+
+//日志级别枚举
+typedef enum EnumLogLevel
+{
+	LogLevel_Stop = 0,	//什么都不记录
+	LogLevel_Fatal,		//只记录严重错误
+	LogLevel_Error,		//记录严重错误,普通错误
+	LogLevel_Warning,	//记录严重错误,普通错误,警告
+	LogLevel_Info		//记录严重错误,普通错误,警告,提示信息(也就是全部记录)
+}EnumLogLevel;
+
+//日志模块的头文件
+class ILogger
+{
+public:
+	//1. 写严重错误信息
+	virtual void TraceFatal(const char *lpcszFormat, ...) = 0;
+	//2. 写错误信息
+	virtual void TraceError(const char *lpcszFormat, ...) = 0;
+	//3. 写警告信息
+	virtual void TraceWarning(const char *lpcszFormat, ...) = 0;
+	//4. 写提示信息
+	virtual void TraceInfo(const char *lpcszFormat, ...) = 0;
+	//5. 改变写日志级别
+	virtual void ChangeLogLevel(EnumLogLevel nLevel) = 0;
+	//6. 写日常信息
+	virtual std::string Log(const char* pszHeader, const char *pszSuffix, const char* pszText) = 0;
+};
+
+#endif
diff --git a/Common_Class/VisionLib/LogSDK/include/LogLib.h b/Common_Class/VisionLib/LogSDK/include/LogLib.h
new file mode 100644
index 0000000..8de4f61
--- /dev/null
+++ b/Common_Class/VisionLib/LogSDK/include/LogLib.h
@@ -0,0 +1,39 @@
+/**************************************************************************************************
+		Copyright 2020-2022 XXX XXX XXX
+		All rights reserved.
+
+		Author: zhenbin,jiang
+		Date: 2020-06-20
+		Version: V1.0.0
+
+		Description:
+			本模块输出日志模块的接口函数
+***************************************************************************************************/
+#ifndef LOG_LIB_H
+#define LOG_LIB_H
+
+#include "ILogger.h"
+#include "IDayLog.h"
+
+#ifdef EXPORT_DLL_LOG
+#define EXPORTED_LOG _declspec(dllexport)
+#else
+#define EXPORTED_LOG _declspec(dllimport)
+#endif
+
+//0. 获取当前的版本
+extern "C" EXPORTED_LOG int Log_GetVersion(char* pszBuffer, const int nBufferSize);
+//1. 创建日志
+extern "C" EXPORTED_LOG ILogger* Log_Create(EnumLogLevel nLogLevel, const char* szPath, const char* szName);
+//2. 释放日志
+extern "C" EXPORTED_LOG void Log_Free(ILogger *pLogger);
+//3. 获取错误日志
+extern "C" EXPORTED_LOG ILogger* Log_GetError(void);
+//4. 获取调试日志
+extern "C" EXPORTED_LOG ILogger* Log_GetDebug(void);
+//5. 输出日志文件
+extern "C" EXPORTED_LOG int Log_Dmp(int code);
+//6. 获取daylog
+extern "C" EXPORTED_LOG IDayLog* Log_GetDayLog(void);
+
+#endif
diff --git a/Common_Class/VisionLib/SISControls/GridControl/CellRange.h b/Common_Class/VisionLib/SISControls/GridControl/CellRange.h
new file mode 100644
index 0000000..ca429b5
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/CellRange.h
@@ -0,0 +1,156 @@
+///////////////////////////////////////////////////////////////////////
+// CellRange.h: header file
+//
+// MFC Grid Control - interface for the CCellRange class.
+//
+// Written by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2002. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+// The code contained in this file is based on the original
+// WorldCom Grid control written by Joe Willcoxson,
+//      mailto:chinajoe@aol.com
+//      http://users.aol.com/chinajoe
+
+#ifndef max
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+#endif
+
+class AFX_EXT_CLASS CCellID
+{    
+// Attributes
+public:
+    int row, col;
+
+// Operations
+public:
+    explicit CCellID(int nRow = -1, int nCol = -1) : row(nRow), col(nCol) {}
+
+    int IsValid() const { return (row >= 0 && col >= 0); }
+    int operator==(const CCellID& rhs) const { return (row == rhs.row && col == rhs.col); }
+    int operator!=(const CCellID& rhs) const { return !operator==(rhs); }
+};
+
+class CCellRange
+{ 
+public:
+    
+    CCellRange(int nMinRow = -1, int nMinCol = -1, int nMaxRow = -1, int nMaxCol = -1)
+    {
+        Set(nMinRow, nMinCol, nMaxRow, nMaxCol);
+    }
+
+    void Set(int nMinRow = -1, int nMinCol = -1, int nMaxRow = -1, int nMaxCol = -1);
+    
+    int  IsValid() const;
+    int  InRange(int row, int col) const;
+    int  InRange(const CCellID& cellID) const;
+    int  Count() { return (m_nMaxRow - m_nMinRow + 1) * (m_nMaxCol - m_nMinCol + 1); }
+    
+    CCellID  GetTopLeft() const;
+    CCellRange  Intersect(const CCellRange& rhs) const;
+    
+    int GetMinRow() const {return m_nMinRow;}
+    void SetMinRow(int minRow) {m_nMinRow = minRow;}
+    
+    int GetMinCol() const {return m_nMinCol;}
+    void SetMinCol(int minCol) {m_nMinCol = minCol;}
+    
+    int GetMaxRow() const {return m_nMaxRow;}
+    void SetMaxRow(int maxRow) {m_nMaxRow = maxRow;}
+    
+    int GetMaxCol() const {return m_nMaxCol;}
+    void SetMaxCol(int maxCol) {m_nMaxCol = maxCol;}
+
+    int GetRowSpan() const {return m_nMaxRow - m_nMinRow + 1;}
+    int GetColSpan() const {return m_nMaxCol - m_nMinCol + 1;}
+    
+    void operator=(const CCellRange& rhs);
+    int  operator==(const CCellRange& rhs);
+    int  operator!=(const CCellRange& rhs);
+    
+protected:
+    int m_nMinRow;
+    int m_nMinCol;
+    int m_nMaxRow;
+    int m_nMaxCol;
+};
+
+inline void CCellRange::Set(int minRow, int minCol, int maxRow, int maxCol)
+{
+     m_nMinRow = minRow;
+     m_nMinCol = minCol;
+     m_nMaxRow = maxRow;
+     m_nMaxCol = maxCol;
+}
+
+inline void CCellRange::operator=(const CCellRange& rhs)
+{
+    if (this != &rhs) Set(rhs.m_nMinRow, rhs.m_nMinCol, rhs.m_nMaxRow, rhs.m_nMaxCol);
+}
+
+inline int CCellRange::operator==(const CCellRange& rhs)
+{
+     return ((m_nMinRow == rhs.m_nMinRow) && (m_nMinCol == rhs.m_nMinCol) &&
+             (m_nMaxRow == rhs.m_nMaxRow) && (m_nMaxCol == rhs.m_nMaxCol));
+}
+
+inline int CCellRange::operator!=(const CCellRange& rhs)
+{
+     return !operator==(rhs);
+}
+
+inline int CCellRange::IsValid() const
+{
+     return (m_nMinRow >= 0 && m_nMinCol >= 0 && m_nMaxRow >= 0 && m_nMaxCol >= 0 &&
+             m_nMinRow <= m_nMaxRow && m_nMinCol <= m_nMaxCol);
+}
+
+inline int CCellRange::InRange(int row, int col) const
+{
+     return (row >= m_nMinRow && row <= m_nMaxRow && col >= m_nMinCol && col <= m_nMaxCol);
+}
+
+inline int CCellRange::InRange(const CCellID& cellID) const
+{
+     return InRange(cellID.row, cellID.col);
+}
+
+inline CCellID CCellRange::GetTopLeft() const
+{
+     return CCellID(m_nMinRow, m_nMinCol);
+}
+
+inline CCellRange CCellRange::Intersect(const CCellRange& rhs) const
+{
+     return CCellRange(max(m_nMinRow,rhs.m_nMinRow), max(m_nMinCol,rhs.m_nMinCol),
+                       min(m_nMaxRow,rhs.m_nMaxRow), min(m_nMaxCol,rhs.m_nMaxCol));
+}
+
+#endif // !defined(AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/GridCell.h b/Common_Class/VisionLib/SISControls/GridControl/GridCell.h
new file mode 100644
index 0000000..05a368f
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/GridCell.h
@@ -0,0 +1,143 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCell.h : header file
+//
+// MFC Grid Control - Grid cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridCtrl;
+#include "GridCellBase.h"
+
+// Each cell contains one of these. Fields "row" and "column" are not stored since we
+// will usually have acces to them in other ways, and they are an extra 8 bytes per
+// cell that is probably unnecessary.
+
+class AFX_EXT_CLASS CGridCell : public CGridCellBase
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCell)
+
+// Construction/Destruction
+public:
+    CGridCell();
+    virtual ~CGridCell();
+
+// Attributes
+public:
+    void operator=(const CGridCell& cell);
+
+    virtual void  SetText(LPCTSTR szText)        { m_strText = szText;  }                       
+    virtual void  SetImage(int nImage)           { m_nImage = nImage;   }                        
+    virtual void  SetData(LPARAM lParam)         { m_lParam = lParam;   }      
+    virtual void  SetGrid(CGridCtrl* pGrid)      { m_pGrid = pGrid;     }                          
+    // virtual void SetState(const DWORD nState);  -  use base class version   
+    virtual void  SetFormat(DWORD nFormat)       { m_nFormat = nFormat; }                      
+    virtual void  SetTextClr(COLORREF clr)       { m_crFgClr = clr;     }                          
+    virtual void  SetBackClr(COLORREF clr)       { m_crBkClr = clr;     }                          
+    virtual void  SetFont(const LOGFONT* plf);
+    virtual void  SetMargin(UINT nMargin)        { m_nMargin = nMargin; }
+    virtual CWnd* GetEditWnd() const             { return m_pEditWnd;   }
+    virtual void  SetCoords(int /*nRow*/, int /*nCol*/) {}  // don't need to know the row and
+                                                            // column for base implementation
+
+    virtual LPCTSTR     GetText() const             { return (m_strText.IsEmpty())? _T("") : LPCTSTR(m_strText); }
+    virtual int         GetImage() const            { return m_nImage;  }
+    virtual LPARAM      GetData() const             { return m_lParam;  }
+    virtual CGridCtrl*  GetGrid() const             { return m_pGrid;   }
+    // virtual DWORD    GetState() const - use base class
+    virtual DWORD       GetFormat() const;
+    virtual COLORREF    GetTextClr() const          { return m_crFgClr; } // TODO: change to use default cell
+    virtual COLORREF    GetBackClr() const          { return m_crBkClr; }
+    virtual LOGFONT*    GetFont() const;
+    virtual CFont*      GetFontObject() const;
+    virtual UINT        GetMargin() const;
+
+    virtual BOOL        IsEditing() const           { return m_bEditing; }
+    virtual BOOL        IsDefaultFont() const       { return (m_plfFont == NULL); }
+    virtual void        Reset();
+
+// editing cells
+public:
+    virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual void EndEdit();
+protected:
+    virtual void OnEndEdit();
+
+protected:
+    CString    m_strText;      // Cell text (or binary data if you wish...)
+    LPARAM     m_lParam;       // 32-bit value to associate with item
+    int        m_nImage;       // Index of the list view item抯 icon
+    DWORD      m_nFormat;
+    COLORREF   m_crFgClr;
+    COLORREF   m_crBkClr;
+    LOGFONT*   m_plfFont;
+    UINT       m_nMargin;
+
+    BOOL       m_bEditing;     // Cell being edited?
+
+    CGridCtrl* m_pGrid;        // Parent grid control
+    CWnd*      m_pEditWnd;
+};
+
+// This class is for storing grid default values. It's a little heavy weight, so
+// don't use it in bulk 
+class CGridDefaultCell : public CGridCell
+{
+    DECLARE_DYNCREATE(CGridDefaultCell)
+
+// Construction/Destruction
+public:
+    CGridDefaultCell();
+    virtual ~CGridDefaultCell();
+
+public:
+    virtual DWORD GetStyle() const                      { return m_dwStyle;      }
+    virtual void  SetStyle(DWORD dwStyle)               { m_dwStyle = dwStyle;   }
+    virtual int   GetWidth() const                      { return m_Size.cx;      }
+    virtual int   GetHeight() const                     { return m_Size.cy;      }
+    virtual void  SetWidth(int nWidth)                  { m_Size.cx = nWidth;    }
+    virtual void  SetHeight(int nHeight)                { m_Size.cy = nHeight;   }
+
+    // Disable these properties
+    virtual void     SetData(LPARAM /*lParam*/)             { ASSERT(FALSE);         }      
+    virtual void     SetState(DWORD /*nState*/)             { ASSERT(FALSE);         }
+    virtual DWORD    GetState() const                       { return CGridCell::GetState()|GVIS_READONLY; }
+    virtual void     SetCoords( int /*row*/, int /*col*/)   { /*ASSERT(FALSE);*/         }
+    virtual void     SetFont(const LOGFONT* /*plf*/);
+    virtual LOGFONT* GetFont() const;   
+    virtual CFont*   GetFontObject() const;
+
+protected:
+    CSize m_Size;       // Default Size
+    CFont m_Font;       // Cached font
+    DWORD m_dwStyle;    // Cell Style - unused
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/GridCellBase.h b/Common_Class/VisionLib/SISControls/GridControl/GridCellBase.h
new file mode 100644
index 0000000..f7804c2
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/GridCellBase.h
@@ -0,0 +1,172 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCellBase.h : header file
+//
+// MFC Grid Control - Grid cell base class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridCtrl;
+
+// Cell states
+#define GVIS_FOCUSED            0x0001
+#define GVIS_SELECTED           0x0002
+#define GVIS_DROPHILITED        0x0004
+#define GVIS_READONLY           0x0008
+#define GVIS_FIXED              0x0010
+#define GVIS_FIXEDROW           0x0020
+#define GVIS_FIXEDCOL           0x0040
+#define GVIS_MODIFIED           0x0080
+
+// Cell data mask
+#define GVIF_TEXT               LVIF_TEXT
+#define GVIF_IMAGE              LVIF_IMAGE
+#define GVIF_PARAM              LVIF_PARAM
+#define GVIF_STATE              LVIF_STATE
+#define GVIF_BKCLR              (GVIF_STATE<<1)
+#define GVIF_FGCLR              (GVIF_STATE<<2)
+#define GVIF_FORMAT             (GVIF_STATE<<3)
+#define GVIF_FONT               (GVIF_STATE<<4)
+#define GVIF_MARGIN             (GVIF_STATE<<5)
+#define GVIF_ALL                (GVIF_TEXT|GVIF_IMAGE|GVIF_PARAM|GVIF_STATE|GVIF_BKCLR|GVIF_FGCLR| \
+                                 GVIF_FORMAT|GVIF_FONT|GVIF_MARGIN)
+
+// Used for Get/SetItem calls.
+typedef struct _GV_ITEM {
+    int      row,col;     // Row and Column of item
+    UINT     mask;        // Mask for use in getting/setting cell data
+    UINT     nState;      // cell state (focus/hilighted etc)
+    DWORD    nFormat;     // Format of cell
+    int      iImage;      // index of the list view item抯 icon
+    COLORREF crBkClr;     // Background colour (or CLR_DEFAULT)
+    COLORREF crFgClr;     // Forground colour (or CLR_DEFAULT)
+    LPARAM   lParam;      // 32-bit value to associate with item
+    LOGFONT  lfFont;      // Cell font
+    UINT     nMargin;     // Internal cell margin
+    CString  strText;     // Text in cell
+} GV_ITEM;
+
+
+// Each cell contains one of these. Fields "row" and "column" are not stored since we
+// will usually have acces to them in other ways, and they are an extra 8 bytes per
+// cell that is probably unnecessary.
+
+class AFX_EXT_CLASS CGridCellBase : public CObject
+{
+    friend class CGridCtrl;
+    DECLARE_DYNAMIC(CGridCellBase)
+
+// Construction/Destruction
+public:
+    CGridCellBase();
+    virtual ~CGridCellBase();
+
+// Attributes
+public:
+    virtual void SetText(LPCTSTR /* szText */)              = 0 ;
+    virtual void SetImage(int /* nImage */)                 = 0 ;
+    virtual void SetData(LPARAM /* lParam */)               = 0 ;
+    virtual void SetState(DWORD nState)                     { m_nState = nState; }
+    virtual void SetFormat(DWORD /* nFormat */)             = 0 ;
+    virtual void SetTextClr(COLORREF /* clr */)             = 0 ;
+    virtual void SetBackClr(COLORREF /* clr */)             = 0 ;
+    virtual void SetFont(const LOGFONT* /* plf */)          = 0 ;
+    virtual void SetMargin( UINT /* nMargin */)             = 0 ;
+    virtual void SetGrid(CGridCtrl* /* pGrid */)            = 0 ;
+    virtual void SetCoords( int /* nRow */, int /* nCol */) = 0 ;
+
+    virtual LPCTSTR    GetText()       const                = 0 ;
+    virtual LPCTSTR    GetTipText()    const                { return GetText(); } // may override TitleTip return
+    virtual int        GetImage()      const                = 0 ;
+    virtual LPARAM     GetData()       const                = 0 ;
+    virtual DWORD      GetState()      const                { return m_nState;  }
+    virtual DWORD      GetFormat()     const                = 0 ;
+    virtual COLORREF   GetTextClr()    const                = 0 ;
+    virtual COLORREF   GetBackClr()    const                = 0 ;
+    virtual LOGFONT  * GetFont()       const                = 0 ;
+    virtual CFont    * GetFontObject() const                = 0 ;
+    virtual CGridCtrl* GetGrid()       const                = 0 ;
+    virtual CWnd     * GetEditWnd()    const                = 0 ;
+    virtual UINT       GetMargin()     const                = 0 ;
+
+    virtual CGridCellBase* GetDefaultCell() const;
+
+    virtual BOOL IsDefaultFont()       const                = 0 ;
+    virtual BOOL IsEditing()           const                = 0 ;
+    virtual BOOL IsFocused()           const                { return (m_nState & GVIS_FOCUSED);  }
+    virtual BOOL IsFixed()             const                { return (m_nState & GVIS_FIXED);    }
+    virtual BOOL IsFixedCol()          const                { return (m_nState & GVIS_FIXEDCOL); }
+    virtual BOOL IsFixedRow()          const                { return (m_nState & GVIS_FIXEDROW); }
+    virtual BOOL IsSelected()          const                { return (m_nState & GVIS_SELECTED); }
+    virtual BOOL IsReadOnly()          const                { return (m_nState & GVIS_READONLY); }
+    virtual BOOL IsModified()          const                { return (m_nState & GVIS_MODIFIED); }
+    virtual BOOL IsDropHighlighted()   const                { return (m_nState & GVIS_DROPHILITED); }
+
+// Operators
+public:
+    virtual void operator=(const CGridCellBase& cell);
+
+// Operations
+public:
+    virtual void Reset();
+
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+    virtual BOOL GetTextRect( LPRECT pRect);    // i/o:  i=dims of cell rect; o=dims of text rect
+    virtual BOOL GetTipTextRect( LPRECT pRect) { return GetTextRect( pRect); }  // may override for btns, etc.
+    virtual CSize GetTextExtent(LPCTSTR str, CDC* pDC = NULL);
+    virtual CSize GetCellExtent(CDC* pDC);
+
+    // Editing
+    virtual BOOL Edit( int /* nRow */, int /* nCol */, CRect /* rect */, CPoint /* point */, 
+                       UINT /* nID */, UINT /* nChar */) { return FALSE;}
+	virtual BOOL ValidateEdit(LPCTSTR str);
+    virtual void EndEdit() {}
+
+    // EFW - Added to print cells properly
+    virtual BOOL PrintCell(CDC* pDC, int nRow, int nCol, CRect rect);
+
+    // add additional protected grid members required of cells
+    LRESULT SendMessageToParent(int nRow, int nCol, int nMessage);
+
+protected:
+    virtual void OnEndEdit();
+    virtual void OnMouseEnter();
+    virtual void OnMouseOver();
+    virtual void OnMouseLeave();
+    virtual void OnClick( CPoint PointCellRelative);
+    virtual void OnClickDown( CPoint PointCellRelative);
+    virtual void OnRClick( CPoint PointCellRelative);
+    virtual void OnDblClick( CPoint PointCellRelative);
+    virtual BOOL OnSetCursor();
+
+protected:
+    DWORD    m_nState;      // Cell state (selected/focus etc)
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/GridCellButton.h b/Common_Class/VisionLib/SISControls/GridControl/GridCellButton.h
new file mode 100644
index 0000000..6b04419
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/GridCellButton.h
@@ -0,0 +1,28 @@
+#ifndef __GRID_CELL_BUTTON__
+#define __GRID_CELL_BUTTON__
+
+#include "GridCell.h"
+
+class AFX_EXT_CLASS CGridCellButton : public CGridCell
+{
+	friend class CGridCtrl;
+	DECLARE_DYNCREATE(CGridCellButton)
+
+public:
+	CGridCellButton(void);
+	virtual ~CGridCellButton(void);
+
+	void SetPushing(BOOL bPush) {m_bPushing = bPush;}
+
+public:
+	virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+protected:
+	virtual void OnClick(CPoint PointCellRelative);
+	virtual void OnMouseLeave();
+
+protected:
+	CRect m_rect;
+	BOOL m_bPushing;
+};
+#endif
diff --git a/Common_Class/VisionLib/SISControls/GridControl/GridCtrl.h b/Common_Class/VisionLib/SISControls/GridControl/GridCtrl.h
new file mode 100644
index 0000000..286c9db
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/GridCtrl.h
@@ -0,0 +1,1088 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCtrl.h : header file
+//
+// MFC Grid Control - main header
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+// FEATURES BY Mukit, Ataul (2007-11-17):
+// 1. Merge Cell 
+// 2. Ability to do XL Style Freeze Pane
+// 3. The Horizontal Gray Area Removed 
+  
+// FINDINGS:
+// 1. A cell cannot be edited if a tooltip is shown..
+// 2. The InplaceEditCtrl is not multiline even if a cell can contain Multiline Text..
+// 3. If a cell is too small, the InplaceEditCtrl is almost invisible..
+
+#if !defined(AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include "CellRange.h"
+#include "GridCell.h"
+#include <afxtempl.h>
+#include <vector>
+using namespace std;
+
+
+struct CELL_ENABLE
+{
+	CELL_ENABLE()
+	{
+		nEnable = -1;
+	}
+	void SetEnable(BOOL bValue)
+	{
+		nEnable = bValue;
+	}
+	BOOL isEnable()
+	{
+		if (nEnable == 0)
+		{
+			return FALSE;
+		}
+		else if (nEnable > 0)
+		{
+			return TRUE;
+		}
+	}
+	BOOL isActivated()
+	{
+		if (nEnable < 0)
+		{
+			return FALSE;
+		}
+		else
+			return TRUE;
+	}
+	int nEnable;
+};
+
+///////////////////////////////////////////////////////////////////////////////////
+// Defines - these determine the features (and the final size) of the final code
+///////////////////////////////////////////////////////////////////////////////////
+
+//#define GRIDCONTROL_NO_TITLETIPS   // Do not use titletips for cells with large data
+//#define GRIDCONTROL_NO_DRAGDROP    // Do not use OLE drag and drop
+//#define GRIDCONTROL_NO_CLIPBOARD   // Do not use clipboard routines
+
+#ifdef _WIN32_WCE
+#   define GRIDCONTROL_NO_TITLETIPS   // Do not use titletips for cells with large data
+#   define GRIDCONTROL_NO_DRAGDROP    // Do not use OLE drag and drop
+#   define GRIDCONTROL_NO_CLIPBOARD   // Do not use clipboard routines
+#   define GRIDCONTROL_NO_PRINTING    // Do not use printing routines
+#   ifdef WCE_NO_PRINTING			  // Older versions of CE had different #def's
+#       define _WIN32_WCE_NO_PRINTING
+#   endif
+#   ifdef WCE_NO_CURSOR
+#       define _WIN32_WCE_NO_CURSOR
+#   endif
+#endif  // _WIN32_WCE
+
+// Use this as the classname when inserting this control as a custom control
+// in the MSVC++ dialog editor
+#define GRIDCTRL_CLASSNAME    _T("MFCGridCtrl")  // Window class name
+#define IDC_INPLACE_CONTROL   8                  // ID of inplace edit controls
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Conditional includes
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+#   include "TitleTip.h"
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+#   include "GridDropTarget.h"
+#   undef GRIDCONTROL_NO_CLIPBOARD     // Force clipboard functions on
+#endif
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+#   include <afxole.h>
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Helper functions
+///////////////////////////////////////////////////////////////////////////////////
+
+// Handy functions
+#define IsSHIFTpressed() ( (GetKeyState(VK_SHIFT) & (1 << (sizeof(SHORT)*8-1))) != 0   )
+#define IsCTRLpressed()  ( (GetKeyState(VK_CONTROL) & (1 << (sizeof(SHORT)*8-1))) != 0 )
+
+// Backwards compatibility for pre 2.20 grid versions
+#define DDX_GridControl(pDX, nIDC, rControl)  DDX_Control(pDX, nIDC, rControl)     
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Structures
+///////////////////////////////////////////////////////////////////////////////////
+
+// This structure sent to Grid's parent in a WM_NOTIFY message
+typedef struct tagNM_GRIDVIEW {
+    NMHDR hdr;
+    int   iRow;
+    int   iColumn;
+} NM_GRIDVIEW;
+
+// This is sent to the Grid from child in-place edit controls
+typedef struct tagGV_DISPINFO {
+    NMHDR   hdr;
+    GV_ITEM item;
+} GV_DISPINFO;
+
+// This is sent to the Grid from child in-place edit controls
+typedef struct tagGV_CACHEHINT {
+    NMHDR      hdr;
+    CCellRange range;
+} GV_CACHEHINT;
+
+// storage typedef for each row in the grid
+typedef CTypedPtrArray<CObArray, CGridCellBase*> GRID_ROW;
+
+// For virtual mode callback
+typedef BOOL (CALLBACK* GRIDCALLBACK)(GV_DISPINFO *, LPARAM);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Defines
+///////////////////////////////////////////////////////////////////////////////////
+
+// Grid line/scrollbar selection
+#define GVL_NONE                0L      // Neither
+#define GVL_HORZ                1L      // Horizontal line or scrollbar
+#define GVL_VERT                2L      // Vertical line or scrollbar
+#define GVL_BOTH                3L      // Both
+
+// Autosizing option
+#define GVS_DEFAULT             0
+#define GVS_HEADER              1       // Size using column fixed cells data only
+#define GVS_DATA                2       // Size using column non-fixed cells data only
+#define GVS_BOTH                3       // Size using column fixed and non-fixed
+
+// Cell Searching options
+#define GVNI_FOCUSED            0x0001
+#define GVNI_SELECTED           0x0002
+#define GVNI_DROPHILITED        0x0004
+#define GVNI_READONLY           0x0008
+#define GVNI_FIXED              0x0010
+#define GVNI_MODIFIED           0x0020
+// LUC
+#define GVNI_FREEZED			0x0040
+
+#define GVNI_ABOVE              LVNI_ABOVE
+#define GVNI_BELOW              LVNI_BELOW
+#define GVNI_TOLEFT             LVNI_TOLEFT
+#define GVNI_TORIGHT            LVNI_TORIGHT
+#define GVNI_ALL                (LVNI_BELOW|LVNI_TORIGHT|LVNI_TOLEFT)
+#define GVNI_AREA               (LVNI_BELOW|LVNI_TORIGHT)
+
+// Hit test values (not yet implemented)
+#define GVHT_DATA               0x0000
+#define GVHT_TOPLEFT            0x0001
+#define GVHT_COLHDR             0x0002
+#define GVHT_ROWHDR             0x0004
+#define GVHT_COLSIZER           0x0008
+#define GVHT_ROWSIZER           0x0010
+#define GVHT_LEFT               0x0020
+#define GVHT_RIGHT              0x0040
+#define GVHT_ABOVE              0x0080
+#define GVHT_BELOW              0x0100
+
+// Messages sent to the grid's parent (More will be added in future)
+#define GVN_BEGINDRAG           LVN_BEGINDRAG        // LVN_FIRST-9
+#define GVN_BEGINLABELEDIT      LVN_BEGINLABELEDIT   // LVN_FIRST-5
+#define GVN_BEGINRDRAG          LVN_BEGINRDRAG
+#define GVN_COLUMNCLICK         LVN_COLUMNCLICK
+#define GVN_DELETEITEM          LVN_DELETEITEM
+#define GVN_ENDLABELEDIT        LVN_ENDLABELEDIT     // LVN_FIRST-6
+#define GVN_SELCHANGING         LVN_ITEMCHANGING
+#define GVN_SELCHANGED          LVN_ITEMCHANGED
+#define GVN_GETDISPINFO         LVN_GETDISPINFO 
+#define GVN_ODCACHEHINT         LVN_ODCACHEHINT 
+#define GVN_COMBOSELCHANGE		LVN_FIRST-10
+
+class CGridCtrl;
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl window
+
+typedef bool (*PVIRTUALCOMPARE)(int, int);
+
+class AFX_EXT_CLASS CGridCtrl : public CWnd
+{
+    DECLARE_DYNCREATE(CGridCtrl)
+    friend class CGridCell;
+    friend class CGridCellBase;
+
+// Construction
+public:
+    CGridCtrl(int nRows = 0, int nCols = 0, int nFixedRows = 0, int nFixedCols = 0);
+
+    BOOL Create(const RECT& rect, CWnd* parent, UINT nID,
+                DWORD dwStyle = WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VISIBLE);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Attributes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+
+///// LUC ///////////////////////////////////////////////////////////////////////
+
+	//// LUC : MergeCell////////
+	
+	INT_PTR MergeCells(CCellRange& mergedCellRange);
+	void SplitCells(INT_PTR nMergeID);
+
+	BOOL IsMergedCell(int row, int col, CCellRange& mergedCellRange);
+	BOOL GetMergedCellRect(int row, int col, CRect& rect);
+	BOOL GetMergedCellRect(CCellRange& mergedCell, CRect& rect);
+	BOOL GetTopLeftMergedCell(int& row, int& col, CRect& mergeRect);
+	BOOL GetBottomRightMergedCell(int& row, int& col, CRect& mergeRect);
+	virtual BOOL IsFocused(CGridCellBase& cell, int nRow, int nCol);
+	virtual BOOL IsSelected(CGridCellBase& cell, int nRow, int nCol);
+
+	BOOL	m_bDrawingMergedCell;
+	INT_PTR	m_nCurrentMergeID;
+
+	static CRect rectNull;		
+	static CCellID cellNull;
+
+	// LUC : Freeze Rows	
+
+	BOOL SetFreezedRowCount(int nFreezedRows)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedRows >= 0) && ((nFreezedRows + m_nFixedRows) <= m_nRows) )
+		{
+			m_nFreezedRows = nFreezedRows;
+			ResetScrollBars();
+			Refresh();
+			bRet = TRUE;
+		}
+	
+		return bRet;
+		
+	}
+	
+	BOOL SetFreezedColumnCount(int nFreezedCols)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedCols >= 0) && ((nFreezedCols + m_nFixedCols) <= m_nCols) )
+		{
+			m_nFreezedCols = nFreezedCols;
+			ResetScrollBars();
+			Refresh();
+			bRet = TRUE;
+		}
+	
+		return bRet;
+	}
+
+	// To avoid calling ResetScrollBars twice you can use SetFreezedFrame
+	BOOL SetFreezedFrame(int nFreezedRows, int nFreezedCols)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedRows >= 0) && ((nFreezedRows + m_nFixedRows) <= m_nRows) )
+		{
+			m_nFreezedRows = nFreezedRows;			
+			bRet = TRUE;
+		}
+		if( (nFreezedCols >= 0) && ((nFreezedCols + m_nFixedCols) <= m_nCols) )
+		{
+			m_nFreezedCols = nFreezedCols;
+			bRet = TRUE;
+		}
+		else
+		{
+			bRet = FALSE;
+		}
+
+		ResetScrollBars();
+			
+		return bRet;			
+	}	
+	
+	int  GetFreezedRowCount() const                    { return m_nFreezedRows; }
+    int  GetFreezedColumnCount() const                 { return m_nFreezedCols; }	
+
+	void ShowHorzNonGridArea(BOOL bShow)
+	{
+		m_bShowHorzNonGridArea = bShow;
+	}
+
+	BOOL IsShowingHorzNonGridArea()
+	{
+		return m_bShowHorzNonGridArea;
+	}
+
+///////////////////////////////////////////////////////////////////////////////////////    
+	
+    int  GetRowCount() const                    { return m_nRows; }
+    int  GetColumnCount() const                 { return m_nCols; }
+    int  GetFixedRowCount(BOOL bIncludeFreezedRows = FALSE) const
+	{ 
+		return (bIncludeFreezedRows) ? (m_nFixedRows + m_nFreezedRows) : m_nFixedRows;
+	}
+    int  GetFixedColumnCount(BOOL bIncludeFreezedCols = FALSE) const            
+	{
+		return (bIncludeFreezedCols) ? (m_nFixedCols + m_nFreezedCols) : m_nFixedCols; 
+	}	
+	
+	BOOL SetRowCount(int nRows = 10);
+    BOOL SetColumnCount(int nCols = 10);
+
+	BOOL UpdateCellEditableMask();
+    
+	BOOL SetFixedRowCount(int nFixedRows = 1);
+    BOOL SetFixedColumnCount(int nFixedCols = 1);	
+
+public:
+    int  GetRowHeight(int nRow) const;
+    BOOL SetRowHeight(int row, int height);
+    int  GetColumnWidth(int nCol) const;
+    BOOL SetColumnWidth(int col, int width);
+
+    BOOL GetCellOrigin(int nRow, int nCol, LPPOINT p);
+    BOOL GetCellOrigin(const CCellID& cell, LPPOINT p);
+    BOOL GetCellRect(int nRow, int nCol, LPRECT pRect);
+    BOOL GetCellRect(const CCellID& cell, LPRECT pRect);
+
+    BOOL GetTextRect(const CCellID& cell, LPRECT pRect);
+    BOOL GetTextRect(int nRow, int nCol, LPRECT pRect);
+
+	BOOL SetCellMaskEditable(int nRow, int nCol, BOOL bEditable);
+	BOOL isCellMaskEditable(int nRow, int nCol);
+	BOOL isCellMaskActivated(int nRow, int nCol);
+
+    // LUC
+	// Change for MergeCell
+	CCellID GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck = TRUE, CCellID& cellOriginal = cellNull);
+
+	// LUC
+    //int  GetFixedRowHeight() const;
+    //int  GetFixedColumnWidth() const;	    
+	int	GetFixedRowHeight(BOOL bIncludeFreezedRows = FALSE) const;
+	int GetFixedColumnWidth(BOOL bIncludeFreezedCols = FALSE) const;
+
+    long GetVirtualWidth() const;
+    long GetVirtualHeight() const;
+
+    CSize GetTextExtent(int nRow, int nCol, LPCTSTR str);
+    // EFW - Get extent of current text in cell
+    inline CSize GetCellTextExtent(int nRow, int nCol)  { return GetTextExtent(nRow, nCol, GetItemText(nRow,nCol)); }
+
+    void     SetGridBkColor(COLORREF clr)         { m_crGridBkColour = clr;           }
+    COLORREF GetGridBkColor() const               { return m_crGridBkColour;          }
+    void     SetGridLineColor(COLORREF clr)       { m_crGridLineColour = clr;         }
+    COLORREF GetGridLineColor() const             { return m_crGridLineColour;        }
+
+	void	 SetTitleTipBackClr(COLORREF clr = CLR_DEFAULT) { m_crTTipBackClr = clr;  }
+	COLORREF GetTitleTipBackClr()				            { return m_crTTipBackClr; }
+	void	 SetTitleTipTextClr(COLORREF clr = CLR_DEFAULT) { m_crTTipTextClr = clr;  }
+	COLORREF GetTitleTipTextClr()				            { return m_crTTipTextClr; }
+
+    // ***************************************************************************** //
+    // These have been deprecated. Use GetDefaultCell and then set the colors
+    void     SetTextColor(COLORREF clr)      { m_cellDefault.SetTextClr(clr);        }
+    COLORREF GetTextColor()                  { return m_cellDefault.GetTextClr();    }
+    void     SetTextBkColor(COLORREF clr)    { m_cellDefault.SetBackClr(clr);        }
+    COLORREF GetTextBkColor()                { return m_cellDefault.GetBackClr();    }
+    void     SetFixedTextColor(COLORREF clr) { m_cellFixedRowDef.SetTextClr(clr); 
+                                               m_cellFixedColDef.SetTextClr(clr); 
+                                               m_cellFixedRowColDef.SetTextClr(clr); }
+    COLORREF GetFixedTextColor() const       { return m_cellFixedRowDef.GetTextClr(); }
+    void     SetFixedBkColor(COLORREF clr)   { m_cellFixedRowDef.SetBackClr(clr); 
+                                               m_cellFixedColDef.SetBackClr(clr); 
+                                               m_cellFixedRowColDef.SetBackClr(clr); }
+    COLORREF GetFixedBkColor() const         { return m_cellFixedRowDef.GetBackClr(); }
+    void     SetGridColor(COLORREF clr)      { SetGridLineColor(clr);                }
+    COLORREF GetGridColor()                  { return GetGridLineColor();            }
+    void     SetBkColor(COLORREF clr)        { SetGridBkColor(clr);                  }
+    COLORREF GetBkColor()                    { return GetGridBkColor();              }
+
+    void     SetDefCellMargin( int nMargin)  { m_cellDefault.SetMargin(nMargin); 
+                                               m_cellFixedRowDef.SetMargin(nMargin); 
+                                               m_cellFixedColDef.SetMargin(nMargin); 
+                                               m_cellFixedRowColDef.SetMargin(nMargin); }
+    int      GetDefCellMargin() const        { return m_cellDefault.GetMargin();     }
+
+    int      GetDefCellHeight() const        { return m_cellDefault.GetHeight();     }
+    void     SetDefCellHeight(int nHeight)   { m_cellDefault.SetHeight(nHeight); 
+                                               m_cellFixedRowDef.SetHeight(nHeight); 
+                                               m_cellFixedColDef.SetHeight(nHeight); 
+                                               m_cellFixedRowColDef.SetHeight(nHeight); }
+    int      GetDefCellWidth() const         { return m_cellDefault.GetWidth();     }
+    void     SetDefCellWidth(int nWidth)     { m_cellDefault.SetWidth(nWidth); 
+                                               m_cellFixedRowDef.SetWidth(nWidth); 
+                                               m_cellFixedColDef.SetWidth(nWidth); 
+                                               m_cellFixedRowColDef.SetWidth(nWidth); }
+
+    // ***************************************************************************** //
+
+    int GetSelectedCount() const                  { return (int)m_SelectedCellMap.GetCount(); }
+
+    CCellID SetFocusCell(CCellID cell);
+    CCellID SetFocusCell(int nRow, int nCol);
+    CCellID GetFocusCell() const                  { return m_idCurrentCell;           }
+
+
+    void SetVirtualMode(BOOL bVirtual);
+    BOOL GetVirtualMode() const                   { return m_bVirtualMode;            }
+    void SetCallbackFunc(GRIDCALLBACK pCallback, 
+                         LPARAM lParam)           { m_pfnCallback = pCallback; m_lParam = lParam; }
+    GRIDCALLBACK GetCallbackFunc()                { return m_pfnCallback;             }
+
+
+    void SetImageList(CImageList* pList)          { m_pImageList = pList;             }
+    CImageList* GetImageList() const              { return m_pImageList;              }
+
+    void SetGridLines(int nWhichLines = GVL_BOTH);
+    int  GetGridLines() const                     { return m_nGridLines;              }
+    void SetEditable(BOOL bEditable = TRUE)       { m_bEditable = bEditable;          }
+    BOOL IsEditable() const                       { return m_bEditable;               }
+    void SetListMode(BOOL bEnableListMode = TRUE);
+    BOOL GetListMode() const                      { return m_bListMode;               }
+    void SetSingleRowSelection(BOOL bSing = TRUE) { m_bSingleRowSelection = bSing;    }
+    BOOL GetSingleRowSelection()                  { return m_bSingleRowSelection & m_bListMode; }
+    void SetSingleColSelection(BOOL bSing = TRUE) { m_bSingleColSelection = bSing;    }
+    BOOL GetSingleColSelection()                  { return m_bSingleColSelection;     }
+    void EnableSelection(BOOL bEnable = TRUE)     { ResetSelectedRange(); m_bEnableSelection = bEnable; ResetSelectedRange(); }
+    BOOL IsSelectable() const                     { return m_bEnableSelection;        }
+    void SetFixedColumnSelection(BOOL bSelect)    { m_bFixedColumnSelection = bSelect;}
+    BOOL GetFixedColumnSelection()                { return m_bFixedColumnSelection;   }
+    void SetFixedRowSelection(BOOL bSelect)       { m_bFixedRowSelection = bSelect;   }
+    BOOL GetFixedRowSelection()                   { return m_bFixedRowSelection;      }
+    void EnableDragAndDrop(BOOL bAllow = TRUE)    { m_bAllowDragAndDrop = bAllow;     }
+    BOOL GetDragAndDrop() const                   { return m_bAllowDragAndDrop;       }
+    void SetRowResize(BOOL bResize = TRUE)        { m_bAllowRowResize = bResize;      }
+    BOOL GetRowResize() const                     { return m_bAllowRowResize;         }
+    void SetColumnResize(BOOL bResize = TRUE)     { m_bAllowColumnResize = bResize;   }
+    BOOL GetColumnResize() const                  { return m_bAllowColumnResize;      }
+    void SetHeaderSort(BOOL bSortOnClick = TRUE)  { m_bSortOnClick = bSortOnClick;    }
+    BOOL GetHeaderSort() const                    { return m_bSortOnClick;            }
+    void SetHandleTabKey(BOOL bHandleTab = TRUE)  { m_bHandleTabKey = bHandleTab;     }
+    BOOL GetHandleTabKey() const                  { return m_bHandleTabKey;           }
+    void SetDoubleBuffering(BOOL bBuffer = TRUE)  { m_bDoubleBuffer = bBuffer;        }
+    BOOL GetDoubleBuffering() const               { return m_bDoubleBuffer;           }
+    void EnableTitleTips(BOOL bEnable = TRUE)     { m_bTitleTips = bEnable;           }
+    BOOL GetTitleTips()                           { return m_bTitleTips;              }
+    void SetSortColumn(int nCol);
+    int  GetSortColumn() const                    { return m_nSortColumn;             }
+    void SetSortAscending(BOOL bAscending)        { m_bAscending = bAscending;        }
+    BOOL GetSortAscending() const                 { return m_bAscending;              }
+    void SetTrackFocusCell(BOOL bTrack)           { m_bTrackFocusCell = bTrack;       }
+    BOOL GetTrackFocusCell()                      { return m_bTrackFocusCell;         }
+    void SetFrameFocusCell(BOOL bFrame)           { m_bFrameFocus = bFrame;           }
+    BOOL GetFrameFocusCell()                      { return m_bFrameFocus;             }
+    void SetAutoSizeStyle(int nStyle = GVS_BOTH)  { m_nAutoSizeColumnStyle = nStyle;  }
+    int  GetAutoSizeStyle()                       { return m_nAutoSizeColumnStyle; }
+
+    void EnableHiddenColUnhide(BOOL bEnable = TRUE){ m_bHiddenColUnhide = bEnable;    }
+    BOOL GetHiddenColUnhide()                     { return m_bHiddenColUnhide;        }
+    void EnableHiddenRowUnhide(BOOL bEnable = TRUE){ m_bHiddenRowUnhide = bEnable;    }
+    BOOL GetHiddenRowUnhide()                     { return m_bHiddenRowUnhide;        }
+
+    void EnableColumnHide(BOOL bEnable = TRUE)    { m_bAllowColHide = bEnable;        }
+    BOOL GetColumnHide()                          { return m_bAllowColHide;           }
+    void EnableRowHide(BOOL bEnable = TRUE)       { m_bAllowRowHide = bEnable;        }
+    BOOL GetRowHide()                             { return m_bAllowRowHide;           }
+
+///////////////////////////////////////////////////////////////////////////////////
+// default Grid cells. Use these for setting default values such as colors and fonts
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CGridCellBase* GetDefaultCell(BOOL bFixedRow, BOOL bFixedCol) const;
+
+///////////////////////////////////////////////////////////////////////////////////
+// Grid cell Attributes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CGridCellBase* GetCell(int nRow, int nCol) const;   // Get the actual cell!
+
+    void SetModified(BOOL bModified = TRUE, int nRow = -1, int nCol = -1);
+    BOOL GetModified(int nRow = -1, int nCol = -1);
+    BOOL IsCellFixed(int nRow, int nCol);
+
+    BOOL   SetItem(const GV_ITEM* pItem);
+    BOOL   GetItem(GV_ITEM* pItem);
+    BOOL   SetItemText(int nRow, int nCol, LPCTSTR str);
+    // The following was virtual. If you want to override, use 
+    //  CGridCellBase-derived class's GetText() to accomplish same thing
+    CString GetItemText(int nRow, int nCol) const;
+
+    // EFW - 06/13/99 - Added to support printf-style formatting codes.
+    // Also supports use with a string resource ID
+#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 210)
+    BOOL   SetItemTextFmt(int nRow, int nCol, LPCTSTR szFmt, ...);
+    BOOL   SetItemTextFmtID(int nRow, int nCol, UINT nID, ...);
+#endif
+
+    BOOL   SetItemData(int nRow, int nCol, LPARAM lParam);
+    LPARAM GetItemData(int nRow, int nCol) const;
+    BOOL   SetItemImage(int nRow, int nCol, int iImage);
+    int    GetItemImage(int nRow, int nCol) const;
+    BOOL   SetItemState(int nRow, int nCol, UINT state);
+    UINT   GetItemState(int nRow, int nCol) const;
+    BOOL   SetItemFormat(int nRow, int nCol, UINT nFormat);
+    UINT   GetItemFormat(int nRow, int nCol) const;
+    BOOL   SetItemBkColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
+    COLORREF GetItemBkColour(int nRow, int nCol) const;
+    BOOL   SetItemFgColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
+    COLORREF GetItemFgColour(int nRow, int nCol) const;
+    BOOL SetItemFont(int nRow, int nCol, const LOGFONT* lf);
+    const LOGFONT* GetItemFont(int nRow, int nCol);
+
+    BOOL IsItemEditing(int nRow, int nCol);
+
+    BOOL SetCellType(int nRow, int nCol, CRuntimeClass* pRuntimeClass);
+    BOOL SetDefaultCellType( CRuntimeClass* pRuntimeClass);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Operations
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    int  InsertColumn(LPCTSTR strHeading, UINT nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE,
+                      int nColumn = -1);
+    int  InsertRow(LPCTSTR strHeading, int nRow = -1);
+    BOOL DeleteColumn(int nColumn);
+    BOOL DeleteRow(int nRow);
+    BOOL DeleteNonFixedRows();
+    BOOL DeleteAllItems();
+
+	void ClearCells(CCellRange Selection);
+
+    BOOL AutoSizeRow(int nRow, BOOL bResetScroll = TRUE);
+    BOOL AutoSizeColumn(int nCol, UINT nAutoSizeStyle = GVS_DEFAULT, BOOL bResetScroll = TRUE);
+    void AutoSizeRows();
+    void AutoSizeColumns(UINT nAutoSizeStyle = GVS_DEFAULT);
+    void AutoSize(UINT nAutoSizeStyle = GVS_DEFAULT);
+    void ExpandColumnsToFit(BOOL bExpandFixed = TRUE);
+    void ExpandLastColumn();
+    void ExpandRowsToFit(BOOL bExpandFixed = TRUE);
+    void ExpandToFit(BOOL bExpandFixed = TRUE);
+
+    void Refresh();
+    void AutoFill();   // Fill grid with blank cells
+
+    void EnsureVisible(CCellID &cell)       { EnsureVisible(cell.row, cell.col); }
+    void EnsureVisible(int nRow, int nCol);
+    BOOL IsCellVisible(int nRow, int nCol);
+    BOOL IsCellVisible(CCellID cell);
+    BOOL IsCellEditable(int nRow, int nCol) const;
+    BOOL IsCellEditable(CCellID &cell) const;
+    BOOL IsCellSelected(int nRow, int nCol) const;
+    BOOL IsCellSelected(CCellID &cell) const;
+	
+
+    // SetRedraw stops/starts redraws on things like changing the # rows/columns
+    // and autosizing, but not for user-intervention such as resizes
+    void SetRedraw(BOOL bAllowDraw, BOOL bResetScrollBars = FALSE);
+    BOOL RedrawCell(int nRow, int nCol, CDC* pDC = NULL);
+    BOOL RedrawCell(const CCellID& cell, CDC* pDC = NULL);
+    BOOL RedrawRow(int row);
+    BOOL RedrawColumn(int col);
+
+#ifndef _WIN32_WCE
+    BOOL Save(LPCTSTR filename, TCHAR chSeparator = _T(','));
+    BOOL Load(LPCTSTR filename, TCHAR chSeparator = _T(','));
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////
+// Cell Ranges
+///////////////////////////////////////////////////////////////////////////////////
+ public:
+    CCellRange GetCellRange() const;
+    CCellRange GetSelectedCellRange() const;
+    void SetSelectedRange(const CCellRange& Range, BOOL bForceRepaint = FALSE, BOOL bSelectCells = TRUE);
+    void SetSelectedRange(int nMinRow, int nMinCol, int nMaxRow, int nMaxCol,
+                          BOOL bForceRepaint = FALSE, BOOL bSelectCells = TRUE);
+    BOOL IsValid(int nRow, int nCol) const;
+    BOOL IsValid(const CCellID& cell) const;
+    BOOL IsValid(const CCellRange& range) const;
+
+///////////////////////////////////////////////////////////////////////////////////
+// Clipboard, drag and drop, and cut n' paste operations
+///////////////////////////////////////////////////////////////////////////////////
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    virtual void CutSelectedText();
+    virtual COleDataSource* CopyTextFromGrid();
+    virtual BOOL PasteTextToGrid(CCellID cell, COleDataObject* pDataObject, BOOL bSelectPastedCells=TRUE);
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+ public:
+    virtual void OnBeginDrag();
+    virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    virtual void OnDragLeave();
+    virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+#endif
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    virtual void OnEditCut();
+    virtual void OnEditCopy();
+    virtual void OnEditPaste();
+#endif
+    virtual void OnEditSelectAll();
+
+///////////////////////////////////////////////////////////////////////////////////
+// Misc.
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CCellID GetNextItem(CCellID& cell, int nFlags) const;
+
+	BOOL SortItems(int nCol, BOOL bAscending, LPARAM data = 0);
+    BOOL SortTextItems(int nCol, BOOL bAscending, LPARAM data = 0);
+    BOOL SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data = 0);
+
+	void SetCompareFunction(PFNLVCOMPARE pfnCompare);
+
+	// in-built sort functions
+	static int CALLBACK pfnCellTextCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK pfnCellNumericCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Printing
+///////////////////////////////////////////////////////////////////////////////////
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+public:
+    void Print(CPrintDialog* pPrntDialog = NULL);
+
+    // EFW - New printing support functions
+    void EnableWysiwygPrinting(BOOL bEnable = TRUE) { m_bWysiwygPrinting = bEnable;     }
+    BOOL GetWysiwygPrinting()                       { return m_bWysiwygPrinting;        }
+
+    void SetShadedPrintOut(BOOL bEnable = TRUE)     {   m_bShadedPrintOut = bEnable;    }
+    BOOL GetShadedPrintOut(void)                    {   return m_bShadedPrintOut;       }
+
+    // Use -1 to have it keep the existing value
+    void SetPrintMarginInfo(int nHeaderHeight, int nFooterHeight,
+        int nLeftMargin, int nRightMargin, int nTopMargin,
+        int nBottomMargin, int nGap);
+
+    void GetPrintMarginInfo(int &nHeaderHeight, int &nFooterHeight,
+        int &nLeftMargin, int &nRightMargin, int &nTopMargin,
+        int &nBottomMargin, int &nGap);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Printing overrides for derived classes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    virtual void OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo);
+    virtual void OnPrint(CDC *pDC, CPrintInfo *pInfo);
+    virtual void OnEndPrinting(CDC *pDC, CPrintInfo *pInfo);
+
+#endif // #if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+
+// Implementation
+public:
+    virtual ~CGridCtrl();
+
+protected:
+    BOOL RegisterWindowClass();
+    BOOL Initialise();
+    void SetupDefaultCells();
+
+    LRESULT SendMessageToParent(int nRow, int nCol, int nMessage) const;
+    LRESULT SendDisplayRequestToParent(GV_DISPINFO* pDisplayInfo) const;
+    LRESULT SendCacheHintToParent(const CCellRange& range) const;
+
+    BOOL InvalidateCellRect(const int row, const int col);
+    BOOL InvalidateCellRect(const CCellID& cell);
+    BOOL InvalidateCellRect(const CCellRange& cellRange);
+    void EraseBkgnd(CDC* pDC);
+
+    BOOL GetCellRangeRect(const CCellRange& cellRange, LPRECT lpRect);
+
+    BOOL SetCell(int nRow, int nCol, CGridCellBase* pCell);
+
+    int  SetMouseMode(int nMode) { int nOldMode = m_MouseMode; m_MouseMode = nMode; return nOldMode; }
+    int  GetMouseMode() const    { return m_MouseMode; }
+
+    BOOL MouseOverRowResizeArea(CPoint& point);
+    BOOL MouseOverColumnResizeArea(CPoint& point);
+
+    CCellID GetTopleftNonFixedCell(BOOL bForceRecalculation = FALSE);
+    CCellRange GetUnobstructedNonFixedCellRange(BOOL bForceRecalculation = FALSE);
+	// LUC
+    CCellRange GetVisibleNonFixedCellRange(LPRECT pRect = NULL, BOOL bForceRecalculation = FALSE);
+    CCellRange GetVisibleFixedCellRange(LPRECT pRect = NULL, BOOL bForceRecalculation = FALSE);
+
+    BOOL IsVisibleVScroll() { return ( (m_nBarState & GVL_VERT) > 0); } 
+    BOOL IsVisibleHScroll() { return ( (m_nBarState & GVL_HORZ) > 0); }
+    void ResetSelectedRange();
+    void ResetScrollBars();
+    void EnableScrollBars(int nBar, BOOL bEnable = TRUE);
+    int  GetScrollPos32(int nBar, BOOL bGetTrackPos = FALSE);
+    BOOL SetScrollPos32(int nBar, int nPos, BOOL bRedraw = TRUE);
+
+    BOOL SortTextItems(int nCol, BOOL bAscending, int low, int high);
+    BOOL SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data,
+                   int low, int high);
+
+    CPoint GetPointClicked(int nRow, int nCol, const CPoint& point);
+
+	void ValidateAndModifyCellContents(int nRow, int nCol, LPCTSTR strText);
+
+// Overrrides
+    // ClassWizard generated virtual function overrides
+    //{{AFX_VIRTUAL(CGridCtrl)
+    protected:
+    virtual void PreSubclassWindow();
+    //}}AFX_VIRTUAL
+
+protected:
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+    // Printing
+	virtual void PrintFixedRowCells(int nStartColumn, int nStopColumn, int& row, CRect& rect,
+                                    CDC *pDC, BOOL& bFirst);
+    virtual void PrintColumnHeadings(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintHeader(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintFooter(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintRowButtons(CDC *pDC, CPrintInfo* /*pInfo*/);
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    // Drag n' drop
+    virtual CImageList* CreateDragImage(CPoint *pHotSpot);    // no longer necessary
+#endif
+
+    // Mouse Clicks
+    virtual void  OnFixedColumnClick(CCellID& cell);
+    virtual void  OnFixedRowClick(CCellID& cell);
+
+    // Editing
+    virtual void  OnEditCell(int nRow, int nCol, CPoint point, UINT nChar);
+    virtual void  OnEndEditCell(int nRow, int nCol, CString str);
+	virtual BOOL  ValidateEdit(int nRow, int nCol, LPCTSTR str);
+    virtual void  EndEditing();
+
+    // Drawing
+    virtual void  OnDraw(CDC* pDC);
+
+    // CGridCellBase Creation and Cleanup
+    virtual CGridCellBase* CreateCell(int nRow, int nCol);
+    virtual void DestroyCell(int nRow, int nCol);
+
+// Attributes
+protected:
+    // General attributes
+    COLORREF    m_crFixedTextColour, m_crFixedBkColour;
+    COLORREF    m_crGridBkColour, m_crGridLineColour;
+    COLORREF    m_crWindowText, m_crWindowColour, m_cr3DFace,     // System colours
+                m_crShadow;
+    COLORREF    m_crTTipBackClr, m_crTTipTextClr;                 // Titletip colours - FNA
+    
+    BOOL        m_bVirtualMode;
+    LPARAM      m_lParam;                                           // lParam for callback
+    GRIDCALLBACK m_pfnCallback;                                     // The callback function
+
+    int         m_nGridLines;
+    BOOL        m_bEditable;
+    BOOL        m_bModified;
+    BOOL        m_bAllowDragAndDrop;
+    BOOL        m_bListMode;
+    BOOL        m_bSingleRowSelection;
+    BOOL        m_bSingleColSelection;
+    BOOL        m_bAllowDraw;
+    BOOL        m_bEnableSelection;
+    BOOL        m_bFixedRowSelection, m_bFixedColumnSelection;
+    BOOL        m_bSortOnClick;
+    BOOL        m_bHandleTabKey;
+    BOOL        m_bDoubleBuffer;
+    BOOL        m_bTitleTips;
+    int         m_nBarState;
+    BOOL        m_bWysiwygPrinting;
+    BOOL        m_bHiddenColUnhide, m_bHiddenRowUnhide;
+    BOOL        m_bAllowColHide, m_bAllowRowHide;
+    BOOL        m_bAutoSizeSkipColHdr;
+    BOOL        m_bTrackFocusCell;
+    BOOL        m_bFrameFocus;
+    UINT        m_nAutoSizeColumnStyle;
+
+	// Cell enable
+	vector<vector<CELL_ENABLE>>	m_pCellEnable;
+
+    // Cell size details
+    int         m_nRows, m_nFixedRows, m_nCols, m_nFixedCols;
+	// LUC
+	int			m_nFreezedRows, m_nFreezedCols;
+	BOOL m_bExcludeFreezedRowsFromSelection;
+	BOOL m_bExcludeFreezedColsFromSelection;
+	
+	// LUC
+	CArray<CCellRange, CCellRange&> m_arMergedCells;
+	// LUC
+	BOOL m_bShowHorzNonGridArea;
+	
+    CUIntArray  m_arRowHeights, m_arColWidths;
+    int         m_nVScrollMax, m_nHScrollMax;
+
+    // Fonts and images
+    CRuntimeClass*   m_pRtcDefault; // determines kind of Grid Cell created by default
+    CGridDefaultCell m_cellDefault;  // "default" cell. Contains default colours, font etc.
+    CGridDefaultCell m_cellFixedColDef, m_cellFixedRowDef, m_cellFixedRowColDef;
+    CFont       m_PrinterFont;  // for the printer
+    CImageList* m_pImageList;
+
+    // Cell data
+    CTypedPtrArray<CObArray, GRID_ROW*> m_RowData;
+
+    // Mouse operations such as cell selection
+    int         m_MouseMode;
+    BOOL        m_bLMouseButtonDown, m_bRMouseButtonDown;
+    CPoint      m_LeftClickDownPoint, m_LastMousePoint;
+    CCellID     m_LeftClickDownCell, m_SelectionStartCell;
+    CCellID     m_idCurrentCell, m_idTopLeftCell;
+    INT_PTR     m_nTimerID;
+    int         m_nTimerInterval;
+    int         m_nResizeCaptureRange;
+    BOOL        m_bAllowRowResize, m_bAllowColumnResize;
+    int         m_nRowsPerWheelNotch;
+    CMap<DWORD,DWORD, CCellID, CCellID&> m_SelectedCellMap, m_PrevSelectedCellMap;
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+    CTitleTip   m_TitleTip;             // Title tips for cells
+#endif
+
+    // Drag and drop
+    CCellID     m_LastDragOverCell;
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    CGridDropTarget m_DropTarget;       // OLE Drop target for the grid
+#endif
+
+    // Printing information
+    CSize       m_CharSize;
+    int         m_nPageHeight;
+    CSize       m_LogicalPageSize,      // Page size in gridctrl units.
+                m_PaperSize;            // Page size in device units.
+    // additional properties to support Wysiwyg printing
+    int         m_nPageWidth;
+    int         m_nPrintColumn;
+    int         m_nCurrPrintRow;
+    int         m_nNumPages;
+    int         m_nPageMultiplier;
+
+    // sorting
+    int          m_bAscending;
+    int          m_nSortColumn;
+	PFNLVCOMPARE m_pfnCompare;
+
+    // EFW - Added to support shaded/unshaded printout.  If true, colored
+    // cells will print as-is.  If false, all text prints as black on white.
+    BOOL        m_bShadedPrintOut;
+
+    // EFW - Added support for user-definable margins.  Top and bottom are in 
+    // lines.  Left, right, and gap are in characters (avg width is used).
+    int         m_nHeaderHeight, m_nFooterHeight, m_nLeftMargin,
+                m_nRightMargin, m_nTopMargin, m_nBottomMargin, m_nGap;
+
+protected:
+    void SelectAllCells();
+    void SelectColumns(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void SelectRows(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void SelectCells(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void OnSelecting(const CCellID& currentCell);
+
+    // Generated message map functions
+    //{{AFX_MSG(CGridCtrl)
+    afx_msg void OnPaint();
+    afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+    afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+    afx_msg void OnSize(UINT nType, int cx, int cy);
+    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+    afx_msg void OnTimer(UINT_PTR nIDEvent);
+    afx_msg UINT OnGetDlgCode();
+    afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+    afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnUpdateEditSelectAll(CCmdUI* pCmdUI);
+    //}}AFX_MSG
+#ifndef _WIN32_WCE_NO_CURSOR
+    afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+#endif
+#ifndef _WIN32_WCE
+    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+    afx_msg void OnRButtonUp(UINT nFlags, CPoint point);    // EFW - Added
+    afx_msg void OnSysColorChange();
+#endif
+#ifndef _WIN32_WCE_NO_CURSOR
+    afx_msg void OnCaptureChanged(CWnd *pWnd);
+#endif
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
+    afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
+    afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
+#endif
+#if (_MFC_VER >= 0x0421) || (_WIN32_WCE >= 210)
+    afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
+#endif
+#if !defined(_WIN32_WCE) && (_MFC_VER >= 0x0421)
+    afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+#endif
+    afx_msg LRESULT OnSetFont(WPARAM hFont, LPARAM lParam);
+    afx_msg LRESULT OnGetFont(WPARAM hFont, LPARAM lParam);
+    afx_msg LRESULT OnImeChar(WPARAM wCharCode, LPARAM lParam);
+    afx_msg void OnEndInPlaceEdit(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnComboSelChange(NMHDR* pNMHDR, LRESULT* pResult);
+    DECLARE_MESSAGE_MAP()
+
+    enum eMouseModes { MOUSE_NOTHING, MOUSE_SELECT_ALL, MOUSE_SELECT_COL, MOUSE_SELECT_ROW,
+                       MOUSE_SELECT_CELLS, MOUSE_SCROLLING_CELLS,
+                       MOUSE_OVER_ROW_DIVIDE, MOUSE_SIZING_ROW,
+                       MOUSE_OVER_COL_DIVIDE, MOUSE_SIZING_COL,
+                       MOUSE_PREPARE_EDIT,
+#ifndef GRIDCONTROL_NO_DRAGDROP
+                       MOUSE_PREPARE_DRAG, MOUSE_DRAGGING
+#endif
+    };
+//      for sort in virtual mode, and column order, save and load layer
+public:
+	typedef std::vector<int> intlist;
+	void Reorder(int From, int To);
+	void SetVirtualCompare(PVIRTUALCOMPARE VirtualCompare) { m_pfnVirtualCompare = VirtualCompare;}
+	int m_CurCol;
+	void AllowReorderColumn(bool b=true) { m_AllowReorderColumn = b;}
+	void EnableDragRowMode(bool b=true) { m_bDragRowMode = b; if(b) EnableDragAndDrop(); } // to change row order
+	int GetLayer(int** pLayer); //  gives back the number of ints of the area (do not forget to delete *pLayer)
+	void SetLayer(int* pLayer); // coming from a previous GetLayer (ignored if not same number of column, or the same revision number)
+	void ForceQuitFocusOnTab(bool b=true) { m_QuitFocusOnTab = b;} // use only if GetParent() is a CDialog
+	void AllowSelectRowInFixedCol(bool b=true) { m_AllowSelectRowInFixedCol = b;} // 
+//    allow acces?
+	intlist m_arRowOrder, m_arColOrder;
+	static CGridCtrl* m_This;
+protected:
+	virtual void AddSubVirtualRow(int Num, int Nb);
+	bool m_bDragRowMode;
+	int m_CurRow;
+private:
+	void ResetVirtualOrder();
+	PVIRTUALCOMPARE m_pfnVirtualCompare;
+	static bool NotVirtualCompare(int c1, int c2);
+	bool m_InDestructor;
+	bool m_AllowReorderColumn;
+	bool m_QuitFocusOnTab;
+	bool m_AllowSelectRowInFixedCol;
+
+};
+
+// Returns the default cell implementation for the given grid region
+inline CGridCellBase* CGridCtrl::GetDefaultCell(BOOL bFixedRow, BOOL bFixedCol) const
+{ 
+    if (bFixedRow && bFixedCol) return (CGridCellBase*) &m_cellFixedRowColDef;
+    if (bFixedRow)              return (CGridCellBase*) &m_cellFixedRowDef;
+    if (bFixedCol)              return (CGridCellBase*) &m_cellFixedColDef;
+    return (CGridCellBase*) &m_cellDefault;
+}
+
+inline CGridCellBase* CGridCtrl::GetCell(int nRow, int nCol) const
+{
+	if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols) 
+        return NULL;
+	
+    if (GetVirtualMode())
+    {
+        CGridCellBase* pCell = GetDefaultCell(nRow < m_nFixedRows, nCol < m_nFixedCols);
+        static GV_DISPINFO gvdi;
+        gvdi.item.row     = nRow;
+        gvdi.item.col     = nCol;
+        gvdi.item.mask    = 0xFFFFFFFF;
+        gvdi.item.nState  = 0;
+        gvdi.item.nFormat = pCell->GetFormat();
+        gvdi.item.iImage  = pCell->GetImage();
+        gvdi.item.crBkClr = pCell->GetBackClr();
+        gvdi.item.crFgClr = pCell->GetTextClr();
+        gvdi.item.lParam  = pCell->GetData();
+        memcpy(&gvdi.item.lfFont, pCell->GetFont(), sizeof(LOGFONT));
+        gvdi.item.nMargin = pCell->GetMargin();
+        gvdi.item.strText.Empty();
+
+        // Fix the state bits
+        if (IsCellSelected(nRow, nCol))   gvdi.item.nState |= GVIS_SELECTED;
+        if (nRow < GetFixedRowCount())    gvdi.item.nState |= (GVIS_FIXED | GVIS_FIXEDROW);
+        if (nCol < GetFixedColumnCount()) gvdi.item.nState |= (GVIS_FIXED | GVIS_FIXEDCOL);
+        if (GetFocusCell() == CCellID(nRow, nCol)) gvdi.item.nState |= GVIS_FOCUSED;
+		if(!m_InDestructor)
+		{
+			gvdi.item.row = m_arRowOrder[nRow];
+			gvdi.item.col = m_arColOrder[nCol];
+
+			if (m_pfnCallback)
+				m_pfnCallback(&gvdi, m_lParam);
+			else
+				SendDisplayRequestToParent(&gvdi);
+			gvdi.item.row = nRow;        
+			gvdi.item.col = nCol;
+		}
+        static CGridCell cell;
+        cell.SetState(gvdi.item.nState);
+        cell.SetFormat(gvdi.item.nFormat);
+        cell.SetImage(gvdi.item.iImage);
+        cell.SetBackClr(gvdi.item.crBkClr);
+        cell.SetTextClr(gvdi.item.crFgClr);
+        cell.SetData(gvdi.item.lParam);
+        cell.SetFont(&(gvdi.item.lfFont));
+        cell.SetMargin(gvdi.item.nMargin);
+        cell.SetText(gvdi.item.strText);
+        cell.SetGrid((CGridCtrl*)this);
+
+        return (CGridCellBase*) &cell;
+    }
+
+    GRID_ROW* pRow = m_RowData[nRow];
+    if (!pRow) return NULL;
+	if(pRow->GetData() == NULL)
+		return NULL;
+    return pRow->GetAt(m_arColOrder[nCol]);
+}
+
+inline BOOL CGridCtrl::SetCell(int nRow, int nCol, CGridCellBase* pCell)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols) 
+        return FALSE;
+
+    GRID_ROW* pRow = m_RowData[nRow];
+    if (!pRow) return FALSE;
+
+    pCell->SetCoords( nRow, nCol); 
+    pRow->SetAt(nCol, pCell);
+
+    return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/GridDropTarget.h b/Common_Class/VisionLib/SISControls/GridControl/GridDropTarget.h
new file mode 100644
index 0000000..1fe5887
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/GridDropTarget.h
@@ -0,0 +1,82 @@
+//////////////////////////////////////////////////////////////////////
+// GridDropTarget.h : header file
+//
+// MFC Grid Control - Drag/Drop target implementation
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_)
+#define AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+
+#include <afxole.h>
+
+class CGridCtrl;
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridDropTarget command target
+
+class AFX_EXT_CLASS CGridDropTarget : public COleDropTarget
+{
+public:
+    CGridDropTarget();
+    virtual ~CGridDropTarget();
+
+// Attributes
+public:
+    CGridCtrl* m_pGridCtrl;
+    BOOL       m_bRegistered;
+
+// Operations
+public:
+    BOOL Register(CGridCtrl *pGridCtrl);
+    virtual void Revoke();
+
+    BOOL        OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+    DROPEFFECT  OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    void        OnDragLeave(CWnd* pWnd);
+    DROPEFFECT  OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    DROPEFFECT  OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point);
+
+// Overrides
+    // ClassWizard generated virtual function overrides
+    //{{AFX_VIRTUAL(CGridDropTarget)
+    //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+    // Generated message map functions
+    //{{AFX_MSG(CGridDropTarget)
+    //}}AFX_MSG
+
+    DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/GridInPlaceEdit.h b/Common_Class/VisionLib/SISControls/GridControl/GridInPlaceEdit.h
new file mode 100644
index 0000000..b26b207
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/GridInPlaceEdit.h
@@ -0,0 +1,83 @@
+//////////////////////////////////////////////////////////////////////
+// InPlaceEdit.h : header file
+//
+// MFC Grid Control - inplace editing class
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridInPlaceEdit : public CEdit
+{
+// Construction
+public:
+    CGridInPlaceEdit(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
+                 int nRow, int nColumn, CString sInitText, UINT nFirstChar);
+
+// Attributes
+public:
+ 
+// Operations
+public:
+     void EndEdit();
+ 
+// Overrides
+     // ClassWizard generated virtual function overrides
+     //{{AFX_VIRTUAL(CGridInPlaceEdit)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+ 
+// Implementation
+public:
+     virtual ~CGridInPlaceEdit();
+ 
+// Generated message map functions
+protected:
+    //{{AFX_MSG(CGridInPlaceEdit)
+    afx_msg void OnKillFocus(CWnd* pNewWnd);
+    afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg UINT OnGetDlgCode();
+	//}}AFX_MSG
+    DECLARE_MESSAGE_MAP()
+
+private:
+    int     m_nRow;
+    int     m_nColumn;
+    CString m_sInitText;
+    UINT    m_nLastChar;
+    BOOL    m_bExitOnArrows;
+    CRect   m_Rect;
+};
+ 
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/GridMemDC.h b/Common_Class/VisionLib/SISControls/GridControl/GridMemDC.h
new file mode 100644
index 0000000..f0f4894
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/GridMemDC.h
@@ -0,0 +1,106 @@
+#if !defined(AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// MemDC.h : header file
+//
+
+//////////////////////////////////////////////////
+// CGridMemDC - memory DC
+//
+// Author: Keith Rule
+// Email:  keithr@europa.com
+// Copyright 1996-1997, Keith Rule
+//
+// You may freely use or modify this code provided this
+// Copyright is included in all derived versions.
+//
+// History - 10/3/97 Fixed scrolling bug.
+//                   Added print support.
+//           25 feb 98 - fixed minor assertion bug
+//
+// This class implements a memory Device Context
+
+class CGridMemDC : public CDC
+{
+public:
+
+    // constructor sets up the memory DC
+    CGridMemDC(CDC* pDC) : CDC()
+    {
+//        ASSERT(pDC != NULL);
+
+        m_pDC = pDC;
+        m_pOldBitmap = NULL;
+#ifndef _WIN32_WCE_NO_PRINTING
+        m_bMemDC = !pDC->IsPrinting();
+#else
+        m_bMemDC = FALSE;
+#endif
+
+        if (m_bMemDC)    // Create a Memory DC
+        {
+            pDC->GetClipBox(&m_rect);
+            CreateCompatibleDC(pDC);
+            m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+            m_pOldBitmap = SelectObject(&m_bitmap);
+#ifndef _WIN32_WCE
+            SetWindowOrg(m_rect.left, m_rect.top);
+#endif
+            // EFW - Bug fix - Fill background in case the user has overridden
+            // WM_ERASEBKGND.  We end up with garbage otherwise.
+            // CJM - moved to fix a bug in the fix.
+            FillSolidRect(m_rect, pDC->GetBkColor());
+        }
+        else        // Make a copy of the relevent parts of the current DC for printing
+        {
+#if !defined(_WIN32_WCE) || ((_WIN32_WCE > 201) && !defined(_WIN32_WCE_NO_PRINTING))
+            m_bPrinting = pDC->m_bPrinting;
+#endif
+            m_hDC       = pDC->m_hDC;
+            m_hAttribDC = pDC->m_hAttribDC;
+        }
+
+    }
+
+    // Destructor copies the contents of the mem DC to the original DC
+    ~CGridMemDC()
+    {
+        if (m_bMemDC)
+        {
+            // Copy the offscreen bitmap onto the screen.
+            m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+                          this, m_rect.left, m_rect.top, SRCCOPY);
+
+            //Swap back the original bitmap.
+            SelectObject(m_pOldBitmap);
+        } else {
+            // All we need to do is replace the DC with an illegal value,
+            // this keeps us from accidently deleting the handles associated with
+            // the CDC that was passed to the constructor.
+            m_hDC = m_hAttribDC = NULL;
+        }
+    }
+
+    // Allow usage as a pointer
+    CGridMemDC* operator->() {return this;}
+        
+    // Allow usage as a pointer
+    operator CGridMemDC*() {return this;}
+
+private:
+    CBitmap  m_bitmap;      // Offscreen bitmap
+    CBitmap* m_pOldBitmap;  // bitmap originally found in CGridMemDC
+    CDC*     m_pDC;         // Saves CDC passed in constructor
+    CRect    m_rect;        // Rectangle of drawing area.
+    BOOL     m_bMemDC;      // TRUE if CDC really is a Memory DC.
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCheck.h b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCheck.h
new file mode 100644
index 0000000..049cb44
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCheck.h
@@ -0,0 +1,68 @@
+#if !defined(AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCellCheck.h : header file
+//
+// MFC Grid Control - Grid combo cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+
+#include "..\\GridCell.h"
+
+
+class AFX_EXT_CLASS CGridCellCheck : public CGridCell
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCellCheck)
+
+public:
+    CGridCellCheck();
+
+public:
+	BOOL SetCheck(BOOL bChecked = TRUE);
+	BOOL GetCheck();
+
+// Operations
+	virtual CSize GetCellExtent(CDC* pDC);
+    virtual void OnClick( CPoint PointCellRelative);
+    virtual BOOL GetTextRect( LPRECT pRect);
+
+protected:
+	CRect GetCheckPlacement();
+
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+protected:
+    BOOL  m_bChecked;
+    CRect m_Rect;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCombo.h b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCombo.h
new file mode 100644
index 0000000..bf436c3
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellCombo.h
@@ -0,0 +1,178 @@
+#if !defined(AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCellCombo.h : header file
+//
+// MFC Grid Control - Grid combo cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10
+//
+//////////////////////////////////////////////////////////////////////
+
+
+#include "../GridCell.h"
+
+
+class AFX_EXT_CLASS CGridCellCombo : public CGridCell
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCellCombo)
+
+public:
+    CGridCellCombo();
+
+// editing cells
+public:
+    virtual BOOL  Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual CWnd* GetEditWnd() const;
+    virtual void  EndEdit();
+
+// Operations
+public:
+	virtual CSize GetCellExtent(CDC* pDC);
+
+// CGridCellCombo specific calls
+public:
+    void  SetOptions(const CStringArray& ar);
+    void  SetStyle(DWORD dwStyle)           { m_dwStyle = dwStyle; }
+    DWORD GetStyle()                        { return m_dwStyle;    }
+
+protected:
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+    CStringArray m_Strings;
+    DWORD        m_dwStyle;
+};
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CComboEdit window
+
+#define IDC_COMBOEDIT 1001
+
+class CComboEdit : public CEdit
+{
+// Construction
+public:
+	CComboEdit();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CComboEdit)
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CComboEdit();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CComboEdit)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceList window
+
+class CInPlaceList : public CComboBox
+{
+    friend class CComboEdit;
+
+// Construction
+public:
+	CInPlaceList(CWnd* pParent,         // parent
+                 CRect& rect,           // dimensions & location
+                 DWORD dwStyle,         // window/combobox style
+                 UINT nID,              // control ID
+                 int nRow, int nColumn, // row and column
+                 COLORREF crFore, COLORREF crBack,  // Foreground, background colour
+				 CStringArray& Items,   // Items in list
+                 CString sInitText,     // initial selection
+				 UINT nFirstChar);      // first character to pass to control
+
+// Attributes
+public:
+   CComboEdit m_edit;  // subclassed edit control
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceList)
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceList();
+    void EndEdit();
+
+protected:
+    int GetCorrectDropWidth();
+
+// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceList)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnDropdown();
+	afx_msg void OnSelChange();
+	afx_msg UINT OnGetDlgCode();
+	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
+	//}}AFX_MSG
+	//afx_msg void OnSelendOK();
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	int		 m_nNumLines;
+	CString  m_sInitText;
+	int		 m_nRow;
+	int		 m_nCol;
+ 	UINT     m_nLastChar; 
+	BOOL	 m_bExitOnArrows; 
+    COLORREF m_crForeClr, m_crBackClr;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
new file mode 100644
index 0000000..a3d5a76
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
@@ -0,0 +1,92 @@
+// GridCellDateTime.h: interface for the CGridCellDateTime class.
+//
+// Provides the implementation for a datetime picker cell type of the
+// grid control.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_)
+#define AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+#include "afxdtctl.h"	// for CDateTimeCtrl
+
+class CGridCellDateTime : public CGridCell  
+{
+  friend class CGridCtrl;
+  DECLARE_DYNCREATE(CGridCellDateTime)
+
+  CTime m_cTime;
+  DWORD m_dwStyle;
+
+public:
+	CGridCellDateTime();
+	CGridCellDateTime(DWORD dwStyle);
+	virtual ~CGridCellDateTime();
+    virtual CSize GetCellExtent(CDC* pDC);
+
+  // editing cells
+public:
+	void Init(DWORD dwStyle);
+	virtual BOOL  Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+	virtual CWnd* GetEditWnd() const;
+	virtual void  EndEdit();
+
+
+	CTime* GetTime() {return &m_cTime;};
+	void   SetTime(CTime time);
+};
+
+class CInPlaceDateTime : public CDateTimeCtrl
+{
+// Construction
+public:
+	CInPlaceDateTime(CWnd* pParent,         // parent
+                   CRect& rect,           // dimensions & location
+                   DWORD dwStyle,         // window/combobox style
+                   UINT nID,              // control ID
+                   int nRow, int nColumn, // row and column
+                   COLORREF crFore, COLORREF crBack,  // Foreground, background colour
+                   CTime* pcTime,
+          		   UINT nFirstChar);      // first character to pass to control
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceList)
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceDateTime();
+    void EndEdit();
+
+// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceList)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg UINT OnGetDlgCode();
+	//}}AFX_MSG
+	//afx_msg void OnSelendOK();
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+    CTime*   m_pcTime;
+	int		 m_nRow;
+	int		 m_nCol;
+ 	UINT     m_nLastChar; 
+	BOOL	 m_bExitOnArrows; 
+    COLORREF m_crForeClr, m_crBackClr;
+};
+
+#endif // !defined(AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
new file mode 100644
index 0000000..4efb7d7
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
@@ -0,0 +1,26 @@
+// GridCellNumeric.h: interface for the CGridCellNumeric class.
+//
+// Written by Andrew Truckle [ajtruckle@wsatkins.co.uk]
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_)
+#define AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+
+class AFX_EXT_CLASS CGridCellNumeric : public CGridCell  
+{
+    DECLARE_DYNCREATE(CGridCellNumeric)
+
+public:
+    virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual void EndEdit();
+
+};
+
+#endif // !defined(AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridURLCell.h b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridURLCell.h
new file mode 100644
index 0000000..c3dffa0
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/NewCellTypes/GridURLCell.h
@@ -0,0 +1,55 @@
+// GridURLCell.h: interface for the CGridURLCell class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_)
+#define AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+
+typedef struct {
+    LPCTSTR szURLPrefix;
+    size_t  nLength;
+} URLStruct;
+
+
+
+class CGridURLCell : public CGridCell  
+{
+    DECLARE_DYNCREATE(CGridURLCell)
+
+public:
+	CGridURLCell();
+	virtual ~CGridURLCell();
+
+    virtual BOOL     Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+    virtual BOOL     Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual LPCTSTR  GetTipText() { return NULL; }
+	void SetAutoLaunchUrl(BOOL bLaunch = TRUE) { m_bLaunchUrl = bLaunch;	}
+	BOOL GetAutoLaunchUrl() { return m_bLaunchUrl;	}
+
+protected:
+    virtual BOOL OnSetCursor();
+    virtual void OnClick(CPoint PointCellRelative);
+
+	BOOL HasUrl(CString str);
+    BOOL OverURL(CPoint& pt, CString& strURL);
+
+protected:
+#ifndef _WIN32_WCE
+    static HCURSOR g_hLinkCursor;		// Hyperlink mouse cursor
+	HCURSOR GetHandCursor();
+#endif
+    static URLStruct g_szURIprefixes[];
+
+protected:
+	COLORREF m_clrUrl;
+	BOOL     m_bLaunchUrl;
+    CRect    m_Rect;
+};
+
+#endif // !defined(AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/GridControl/TitleTip.h b/Common_Class/VisionLib/SISControls/GridControl/TitleTip.h
new file mode 100644
index 0000000..3894a4f
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/GridControl/TitleTip.h
@@ -0,0 +1,87 @@
+/////////////////////////////////////////////////////////////////////////////
+// Titletip.h : header file
+//
+// MFC Grid Control - cell titletips
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#define TITLETIP_CLASSNAME _T("ZTitleTip")
+
+/////////////////////////////////////////////////////////////////////////////
+// CTitleTip window
+
+class AFX_EXT_CLASS CTitleTip : public CWnd
+{
+// Construction
+public:
+	CTitleTip();
+	virtual ~CTitleTip();
+	virtual BOOL Create( CWnd *pParentWnd);
+
+// Attributes
+public:
+    void SetParentWnd(CWnd* pParentWnd)  { m_pParentWnd = pParentWnd; }
+    CWnd* GetParentWnd()                 { return m_pParentWnd;       }
+
+// Operations
+public:
+	void Show(CRect rectTitle, LPCTSTR lpszTitleText, 
+              int xoffset = 0, LPRECT lpHoverRect = NULL, 
+              const LOGFONT* lpLogFont = NULL,
+              COLORREF crTextClr = CLR_DEFAULT, COLORREF crBackClr = CLR_DEFAULT);
+    void Hide();
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CTitleTip)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL DestroyWindow();
+	//}}AFX_VIRTUAL
+
+// Implementation
+protected:
+	CWnd  *m_pParentWnd;
+	CRect  m_rectTitle;
+    CRect  m_rectHover;
+    DWORD  m_dwLastLButtonDown;
+    DWORD  m_dwDblClickMsecs;
+    BOOL   m_bCreated;
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CTitleTip)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/CellCtrl.h b/Common_Class/VisionLib/SISControls/include/CellCtrl.h
new file mode 100644
index 0000000..b8bc378
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/CellCtrl.h
@@ -0,0 +1,304 @@
+#ifndef _CELLCTRL_H_
+#define _CELLCTRL_H_
+#define _CELLCTRL_LIB_H_
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// CellCtrl.h : header file
+//
+#include "HeadCtrl.h"
+
+#ifndef  __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CCellCtrl window
+#define CCMSG_USE_EDIT			WM_USER+1
+#define CCMSG_MOVE_EDIT			WM_USER+2
+#define CCMSG_RECT_CHANGE		WM_USER+3
+//#define CCMSG_SEL_PRINT		WM_USER+4
+#define CCMSG_LIST_PRINT		WM_USER+5
+#define CCMSG_FONT_CHANGE		WM_USER+6
+#define CCMSG_SAVE_FILE			WM_USER+7
+#define CCMSG_OPEN_EXCEL		WM_USER+8
+#define CCMSG_OPEN_LIST			WM_USER+9
+#define CCMSG_MODIFY_EDIT		WM_USER+10
+#define CCMSG_COPY_CLIPBOARD	WM_USER+11
+#define CCMSG_PASTE_CLIPBOARD	WM_USER+12
+#define CCMSG_CUT_CLIPBOARD		WM_USER+13
+#define CCMSG_SELITEM_DELETE	WM_USER+14
+#define CCMSG_BACK_COLOR		WM_USER+15
+#define CCMSG_TEXT_COLOR		WM_USER+16
+#define CCMSG_LIST				WM_USER-1
+
+const COLORREF clrTEXT=0x00000000;
+const COLORREF clrBACK=0x00FFFFFF;
+
+class AFX_EXT_CLASS CCellCtrl : public CListCtrl
+{
+public:
+	struct LOCATION
+	{
+		int nItem;
+		int nSubItem;
+	};
+
+	struct CELLCOLOR
+	{
+		COLORREF txtclr;
+		COLORREF bkgclr;
+	};
+
+	struct CELLINFO
+	{
+		int nId;			//CONTROL ID
+		int nItem;			//LIST ITEM
+		int nSubItem;		//LIST SUBITEM
+		CELLCOLOR oldClr;	//汲沥傈狼 祸
+		CELLCOLOR newClr;	//汲沥饶狼 祸
+		LPWSTR lpstrOld;	//涝仿傈 巩磊凯
+		LPWSTR lpstrNew;	//涝仿茄 巩磊凯
+	};
+
+	struct CELLDATA
+	{
+		COLORREF txtclr;//臂磊祸
+		COLORREF bkgclr;//硅版祸
+		bool	 bUseCtl;//牧飘费 荤侩
+		bool	 bTurn; //馆娄馆娄
+		DWORD    dwData;
+	};
+
+	class CCellData : public CELLDATA
+	{
+	public:
+		CCellData()
+		{
+			bTurn =false;
+			bUseCtl=false;//牧飘费 荤侩
+			txtclr=clrTEXT;
+			bkgclr=clrBACK;
+			dwData=0;
+		}
+
+		CCellData(COLORREF TextColor, COLORREF BackColor,
+				  bool bTurning, DWORD dwUserData=0)
+		{
+			bTurn =bTurning;
+			bUseCtl=false;//牧飘费 荤侩
+			txtclr=TextColor;
+			bkgclr=BackColor;
+			dwData=dwUserData;
+		}
+		virtual ~CCellData(){;}
+		void operator=(const CELLDATA& cc)
+		{
+			(CELLDATA)*this=cc;	
+		}
+	};
+	typedef CArray<CCellData, CCellData&> CCSArray;
+	virtual void SerializeAllInfo(CArchive& ar);
+
+protected:
+	CBrush m_brush;		//俊叼飘冠胶狼 硅版
+	CEdit  m_edit;		//俊叼飘 冠胶
+	BOOL	m_bCanEdit;
+	CFont* m_pFont;		//府胶飘 迄飘
+
+protected:
+	void Printing(CDC* pDC);//府胶飘甫 橇赴飘肺 免仿茄促.
+	CRect GetLogRect(CDC* pDC, int nItem, int nSubItem);//府胶飘 伎Rect阑 厚啦俊 蝶扼 函券茄促.
+	void SetCrtToPrintRate(CDC* pDC);//拳搁苞 厘钎狼 厚啦阑 备茄促.
+	int  GetCrtWidth();//拳搁(府胶飘)狼 气蔼阑 府畔茄促.
+
+protected:
+	BOOL m_bSort;//Sort Flag
+	BOOL m_bTime;//SetTimer(,,)甫 汲沥沁绰瘤 咯何
+	BOOL m_bTurnDraw;//府胶飘 盎脚矫 伎狼 祸彬捞 函秦具窍绰瘤 咯何
+	UINT  m_nClipOptin;//努赋焊靛 可记
+	CHeadCtrl m_head;//HeaderCtrl
+	LOCATION m_mcLct;//right mouse click
+	LOCATION m_edLct;//edit location
+	UINT m_nStartColEdit;
+	UINT m_nEndColEdit;
+	CMenu m_menu;//府胶飘 皋春 
+	CMenu* m_pUmenu;//荤侩磊 沥狼 皋春
+	CELLINFO* m_pInfo;
+
+	//汲沥等 Item Data甫 昏力茄促.
+	void DeleteItemData(int nItem);
+	void DeleteAllItemData();
+
+	//俊叼飘冠胶狼 Data甫 荐沥沁绰瘤 咯何甫 眉农窍绊 
+	//何葛扩档快肺 皋矫瘤甫 焊辰促.
+	BOOL IsModifyEdit(int nItem, int nSubItem);
+
+	//酒捞袍狼 康开捞 函沁阑 版快俊 俊叼飘冠胶狼 农扁档 函秦具 窍骨肺
+	//促澜窃荐甫 捞侩窍咯 俊叼飘冠胶甫 盎脚茄促.
+	void UpdateEdit(int nItem, int nSubItem);
+
+	//伎狼 康开阑 盎脚茄促.
+	void UpdateCell(int nItem, int nSubItem);
+
+	//伎狼 拿矾啊 函窍档废 汲沥登绢 乐绰瘤 咯何
+	bool IsTurning(int nItem, int nSubItem);
+
+	//府胶飘狼 沥纺 left,right,center 屈侥阑 备茄促.
+	int  GetColumnFmt(int nSubItem);	
+
+public:
+	enum ListOption
+	{
+		//MENU OPTION
+		menuNO		=	0x00000000,
+		menuEXCEL	=	0x00000001,
+		menuLIST	=	0x00000002,
+		menuPRINT	=	0x00000004,
+		menuINPUT	=	0x00000010,
+		menuSAVE	=	0x00000020,
+		menuFONT	=	0x00000040,
+		menuBACKCOLOR=	0x00000100,
+		menuTEXTCOLOR=	0x00000200,
+		menuCOPY	=	0x00010000,
+		menuPASTE	=	0x00020000,
+		menuCUT		=	0x00040000,
+		menuDELETE	=	0x00080000,
+		menuCOMMON	=	0x000000FF,
+		menuCLIP	=	0x000F0000,
+		menuALL		=	0x000FFFFF,
+		menuAceept  =   0x00010000,
+
+		//CLIPBOARD OPTION
+		clipNO		=	0x00000000,
+		clipCOPY	=	0x00000001,
+		clipPASTE	=	0x00000002,
+		clipCUT		=	0x00000004,
+		clipDELETE	=	0x00000008,
+		clipALL		=	0x0000FFFF,
+	};
+	CCellCtrl();
+
+	//Sort function
+	void EnableSort(BOOL bSort=TRUE){m_bSort=bSort;}
+	void EnableEdit(BOOL bCanEdit)	{ m_bCanEdit = bCanEdit; }
+
+	//menu function
+	BOOL CCellCtrl::SetMenu(CMenu* pMenu=NULL){m_pUmenu=pMenu; return TRUE;}
+	void UseMenu( UINT nOption=menuCOMMON/*default=menuCOMMON*/);
+
+	//editbox function
+	BOOL SetEditMovable( int nStartCol, int nEndCol);
+	BOOL UseEdit( int nItem, int nSubItem);
+	void EditCtrl( MSG pMsg );
+
+	//Rect捞 函沁绰瘤 魄窜茄促.
+	BOOL IsSubRectChange();	
+
+	//府胶飘甫 橇赴飘肺 免仿茄促.
+	BOOL ListPrinting(BOOL bDialog, int Orientation=1/*啊肺=1, 技肺=2*/);
+
+	//keystate function 
+	BOOL IsMultiKey();//shift虐, ctrl虐殿捞 喘矾脸绰瘤 check茄促
+
+	//font function
+	void SetLogFont(LOGFONT logfont);//厘钎 迄飘
+	void SetListFont(LOGFONT* logfont);//府胶飘 迄飘
+
+	//
+	int GetSubItemCount();		//拿烦荐甫 备茄促.
+	int GetLeftSubItem();		//谅螟栏肺何磐 劝己拳等 拿烦阑 茫绰促.
+	int GetRightSubItem();		//快螟栏肺何磐 劝己拳等 拿烦阑 茫绰促.
+	
+	//荤侩磊啊 鞘夸茄 蔼阑 历厘窍绊 阂矾棵荐 乐绰 窃荐捞促.
+	BOOL SetCellData(int nItem, int nSubItem, DWORD dwData);
+	DWORD GetCellData(int nItem, int nSubItem);
+
+	//color function
+	BOOL SetItemTextColor(int nItem, COLORREF color);
+	BOOL SetItemTextColor(int nItem, int nSubItem, COLORREF color);
+	BOOL SetItemBkColor(int nItem, COLORREF color, bool bTurn=false);
+	BOOL SetItemBkColor(int nItem, int nSubItem, COLORREF color, bool bTurn=false);
+	BOOL GetItemColor(int nItem, int nSubItem, CELLCOLOR* pCellClr);
+
+	//Clipboard function
+	void UseClipboard( UINT nOption=clipALL/*default=clipALL*/){m_nClipOptin=nOption;}
+	void CopyClipboard();// Ctrl C (select item copy)
+	void PasteClipboard();//Ctrl V (paste)
+	void CutClipboard();//Ctrl V (paste)
+	void SelectItemDelete();
+
+	BOOL DeleteColumn( int nCol );
+	int  InsertColumn(int nCol, LPCTSTR lpstTxt,int nFormat=LVCFMT_LEFT, 
+						int nWidth = -1, int nSubItem = -1);
+
+	//HeaderCtrl function
+	BOOL GetSafeHead();
+	int  GetHeadHeight();
+	int  GetHeadItemCount();
+	void SetHeadItemCount(int nCount);
+	void SetHeadItemText(int nItem, int nSubItem, LPCTSTR lpstTxt);
+	CString GetHeadItemText(int nItem, int nSubItem);
+	void SetHeadItemMerge(int nsItem, int nsSubItem, 
+						  int neItem, int neSubItem);
+
+protected:
+
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CCellCtrl)
+	public:
+	virtual void Serialize(CArchive& ar);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	protected:
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	void SaveFile();
+	virtual ~CCellCtrl();
+
+	// Generated message map functions
+protected:
+
+	//{{AFX_MSG(CCellCtrl)
+//	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
+	afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	afx_msg void OnInsertitem(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnDeleteallitems(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnDestroy();
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+	afx_msg void OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult );
+	afx_msg void OnSaveFile();
+	afx_msg void OnOpenExcel();
+	afx_msg void OnOpenList();
+	afx_msg void OnUseEdit();
+	afx_msg void OnMoveEdit();
+	afx_msg void OnRectchange();
+	afx_msg void OnListPrint();
+	afx_msg void OnFontChange();
+	afx_msg void OnBackColor();
+	afx_msg void OnTextColor();
+
+	afx_msg void OnCopyClipboard()	{	CopyClipboard();	}
+	afx_msg void OnPasteClipboard()	{	PasteClipboard();	}
+	afx_msg void OnCutClipboard()	{	CutClipboard();		}
+	afx_msg void OnSelItemDelete()	{	SelectItemDelete();	}
+
+	DECLARE_MESSAGE_MAP()
+};
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(_CELLCTRL_H_)
diff --git a/Common_Class/VisionLib/SISControls/include/ColorButton.h b/Common_Class/VisionLib/SISControls/include/ColorButton.h
new file mode 100644
index 0000000..65c1c8b
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/ColorButton.h
@@ -0,0 +1,101 @@
+// Written by Marius Bancila (mbancila@yahoo.com)
+// Copyright (c) 2004.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name is included. If 
+// the source code in  this file is used in any commercial application 
+// then acknowledgement must be made to the author of this file 
+// (in whatever form you wish).
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
+// IN THE SOFTWARE.
+// 
+// Please use and enjoy. Please let me know of any bugs/mods/improvements 
+// that you have found/implemented and I will fix/incorporate them into this
+// file. 
+
+
+#if !defined(AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_)
+#define AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ColorButton.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CColorButton window
+
+class AFX_EXT_CLASS CColorButton : public CButton
+{
+private:
+	enum {	BUTTON_IN			= 0x01,
+			BUTTON_OUT			= 0x02,
+			BUTTON_BLACK_BORDER	= 0x04,};
+	
+// Construction
+public:
+	CColorButton();
+	CColorButton(COLORREF text, COLORREF bkgnd);
+	CColorButton(COLORREF text, COLORREF bkgnd, COLORREF disabled);
+	CColorButton(COLORREF text, COLORREF bkgnd, COLORREF disabled, COLORREF light, COLORREF highlight, COLORREF shadow, COLORREF darkShadow);
+	
+// Attributes
+public:
+
+private:
+	COLORREF m_TextColor;
+	COLORREF m_BkgndColor;
+	COLORREF m_DisabledBkgndColor;
+	COLORREF m_Light;
+	COLORREF m_Highlight;
+	COLORREF m_Shadow;
+	COLORREF m_DarkShadow;
+	
+// Operations
+public:
+	void SetColor(COLORREF text, COLORREF bkgnd);
+	void SetColor(COLORREF text, COLORREF bkgnd, COLORREF disabled);
+	void SetColor(COLORREF text, COLORREF bkgnd, COLORREF disabled, COLORREF light, COLORREF highlight, COLORREF shadow, COLORREF darkShadow);
+	void SetColorToWindowsDefault();
+	
+private:
+	void DrawFrame(CDC *pDC, CRect rc, int state);
+	void DrawFilledRect(CDC *pDC, CRect rc, COLORREF color);
+	void DrawLine(CDC *pDC, long sx, long sy, long ex, long ey, COLORREF color);
+	void DrawButtonText(CDC *pDC, CRect rc, CString strCaption, COLORREF textcolor);
+	
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CColorButton)
+	public:
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CColorButton();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CColorButton)
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/DefectMap.h b/Common_Class/VisionLib/SISControls/include/DefectMap.h
new file mode 100644
index 0000000..b76f219
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/DefectMap.h
@@ -0,0 +1,125 @@
+// DefectMap.h: interface for the CDefectMap class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_)
+#define AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define ORIGIN_LEFTTOP		1
+#define ORIGIN_LEFTBOTTOM	0
+#define ORIGIN_RIGHTTOP		2
+#define ORIGIN_RIGHTBOTTOM	3
+
+#define UM_MAP_CHANGED			5573
+
+#include "StaticMap.h"
+//enum OriginDirection		{ OD_LeftTop = 0, OD_RightTop = 1, OD_LeftBottom = 10, OD_RightBottom = 11 };
+
+class AFX_EXT_CLASS CDefectMap  : public CStatic
+{
+public:
+	CDefectMap();
+	virtual ~CDefectMap();
+
+public:
+	void				InitGlass(CWnd* pParent, int nMapWidth, int nMapHeight, int nMapMargin);	// Pixel 窜困 付柳.
+	void				DeinitGlass();
+	int					GetMapTotalWidth()		{ return m_nMapTotalWidth; }
+	int					GetMapTotalHeight()		{ return m_nMapTotalHeight; }
+	int					GetMapWidth()			{ return m_nMapWidth; }
+	int					GetMapHeight()			{ return m_nMapHeight; }
+	
+	void				SetMiniMap(BOOL bIsMiniMap, int nUnitSize)	{ m_bIsMiniMap = bIsMiniMap; m_nUnitSize = nUnitSize; }
+	int					GetUnitSize()			{ return m_nUnitSize; }
+	
+	virtual void		DrawGlass(CDC* pDC)						{ }
+	virtual void		MouseRBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnUp(CPoint& point)				{ }
+	virtual void		MouseLBtnMove(CPoint& point)			{ }
+	virtual void		MouseLBtnDblClk(CPoint& point)			{ }
+	virtual void		Timer(UINT_PTR nIDEvent)					{ }
+	
+	// 犬措/绵家
+	void				IncreaseRatio();
+	void				DecreaseRatio();
+	void				ResetRatio();
+	
+	CPoint&				GetDisplayStart()		{ return m_PointGlassStart; }
+	CPoint&				GetDisplayEnd()			{ return m_PointGlassEnd; }
+	
+	void				SetDisplayRect(CPoint& PointStart, CPoint& PointEnd);
+	void				SetShowShot(BOOL bShow)	{ m_bShowShot = bShow; }
+	
+	void				ConvertGlassToView(CRect &rect);
+	void				ConvertGlassToView(CPoint &pt);
+	CRect				ConvertViewToGlass(CRect &rect);
+	CPoint				ConvertViewToGlass(CPoint &pt);
+
+	// 历厘
+	void				SaveMapToFile(CString strFileName);
+	
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CStaticMap)
+	//}}AFX_VIRTUAL
+
+protected:
+	CWnd*				m_pParentWnd;
+	int					m_nMapTotalWidth;
+	int					m_nMapTotalHeight;
+	int					m_nMapWidth;
+	int					m_nMapHeight;
+	CRect				m_RectWnd;
+	CRect				m_RectMap;
+	
+	//////////////////////////////////////////////////////////////////////////
+	// 弊府扁 沥焊
+	HBITMAP				m_hDrawingSurface;
+	BITMAPINFOHEADER	m_BMIH;
+	CRect				m_RectDrawingSurface;
+	BYTE*				m_pDrawingSurfaceBits;
+	
+	OriginDirection		m_OriginDir;
+	int					m_nUnitSize;
+	
+	// Cell 弊府扁
+	BOOL				m_bShowShot;
+	
+	// 犬措/绵家
+	CRect				m_RectShowWnd;
+	
+	double				m_dWidthRatio;
+	double				m_dHeightRatio;
+	double				m_dRatio;
+	CPoint				m_PointWindowStart;
+	BOOL				m_bDragMove;
+	CPoint				m_PointDragStart;
+	BOOL				m_bIsMiniMap;			// Minimap篮 犬措/绵家甫 救茄促.
+	CPoint				m_PointGlassStart;		// Glass 吝 泅犁 焊咯瘤绰 康开.
+	CPoint				m_PointGlassEnd;
+	
+	CPoint				m_PointCCut[3];			//内呈钠 弊府扁 谅钎
+	int					m_nCCutSize;
+	int					m_nCoordGabX;			// 谅钎甫 谎副 芭府.
+	int					m_nCoordGabY;			// 谅钎甫 谎副 芭府.
+	
+	//{{AFX_MSG(CStaticGlass)
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg long OnUpdateMap(WPARAM wParam, LPARAM lParam);
+	//}}AFX_MSG
+	
+	DECLARE_MESSAGE_MAP()
+};
+
+#endif // !defined(AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/FontStatic.h b/Common_Class/VisionLib/SISControls/include/FontStatic.h
new file mode 100644
index 0000000..35b2a33
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/FontStatic.h
@@ -0,0 +1,69 @@
+#pragma once
+
+// Defines for the font style
+#define FS_NORMAL			0x00
+#define FS_BOLD				0x01
+#define FS_ITALIC			0x02
+#define FS_UNDERLINED		0x04
+#define FS_STRIKETHROUGH	0x08
+#define FS_ANTIALIAS		0x10
+
+// Defines for horizontal alignment
+#define FS_CENTER			0x20
+#define FS_LEFT				0x40
+#define FS_RIGHT			0x80
+
+// CFontStatic
+
+class AFX_EXT_CLASS CFontStatic : 
+	public CStatic
+{
+	DECLARE_DYNAMIC(CFontStatic)
+
+public:
+	CFontStatic();
+
+	// Attributes
+public:
+	bool m_bBold;
+	bool m_bItalic;
+	bool m_bUnderlined;
+	bool m_bStrikethrough;
+	bool m_bAntialias;
+	bool m_bBgColor;
+
+	bool m_bCenter;
+	bool m_bLeft;
+	bool m_bRight;
+
+	CString m_szText;
+	CString m_szFont;
+	DWORD m_dwColor;
+	DWORD m_dwBgColor;
+	int m_nSize;
+
+	// Operations
+public:
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CFontStatic)
+protected:
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+
+	// Implementation
+public:
+	void SetWindowText(LPCTSTR a_lpstr);
+	void SetFontStyle(DWORD dwStyle);
+	void SetBackground(DWORD dwBgColor);
+	void SetFontStatic(CString szFont, int nSize, DWORD dwColor, DWORD dwStyle);
+	virtual ~CFontStatic();
+
+protected:
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnPaint();
+};
+
+
diff --git a/Common_Class/VisionLib/SISControls/include/GradientStatic.h b/Common_Class/VisionLib/SISControls/include/GradientStatic.h
new file mode 100644
index 0000000..d7c72a7
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/GradientStatic.h
@@ -0,0 +1,149 @@
+#pragma once
+
+
+// CGradientStatic
+typedef UINT (CALLBACK* LPFNDLLFUNC1)(HDC,CONST PTRIVERTEX,DWORD,CONST PVOID,DWORD,DWORD);
+
+class CDoubleBuff : public CDC {
+private:	
+	CBitmap		m_bitmap;		// Offscreen bitmap
+	CBitmap*	m_oldBitmap;	// bitmap originally found in CDoubleBuff
+	CDC*		m_pDC;			// Saves CDC passed in constructor
+	CRect		m_rect;			// Rectangle of drawing area.
+	BOOL		m_bMemDC;		// TRUE if CDC really is a Memory DC.
+public:
+
+	CDoubleBuff(CDC* pDC, const CRect* pRect = NULL) : CDC()
+	{
+		ASSERT(pDC != NULL); 
+
+		// Some initialization
+		m_pDC = pDC;
+		m_oldBitmap = NULL;
+		m_bMemDC = !pDC->IsPrinting();
+
+		// Get the rectangle to draw
+		if (pRect == NULL) {
+			pDC->GetClipBox(&m_rect);
+		} else {
+			m_rect = *pRect;
+		}
+
+		if (m_bMemDC) {
+			// Create a Memory DC
+			CreateCompatibleDC(pDC);
+			pDC->LPtoDP(&m_rect);
+
+			m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+			m_oldBitmap = SelectObject(&m_bitmap);
+
+			SetMapMode(pDC->GetMapMode());
+
+			SetWindowExt(pDC->GetWindowExt());
+			SetViewportExt(pDC->GetViewportExt());
+
+			pDC->DPtoLP(&m_rect);
+			SetWindowOrg(m_rect.left, m_rect.top);
+		} else {
+			// Make a copy of the relevent parts of the current DC for printing
+			m_bPrinting = pDC->m_bPrinting;
+			m_hDC       = pDC->m_hDC;
+			m_hAttribDC = pDC->m_hAttribDC;
+		}
+
+		// Fill background 
+		FillSolidRect(m_rect, pDC->GetBkColor());
+	}
+
+	virtual ~CDoubleBuff()	
+	{		
+		if (m_bMemDC) {
+			// Copy the offscreen bitmap onto the screen.
+			m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+				this, m_rect.left, m_rect.top, SRCCOPY);			
+
+			//Swap back the original bitmap.
+			SelectObject(m_oldBitmap);
+		} else {
+			// All we need to do is replace the DC with an illegal value,
+			// this keeps us from accidently deleting the handles associated with
+			// the CDC that was passed to the constructor.			
+			m_hDC = m_hAttribDC = NULL;
+		}	
+	}
+
+	// Allow usage as a pointer	
+	CDoubleBuff* operator->() 
+	{
+		return this;
+	}	
+
+	// Allow usage as a pointer	
+	operator CDoubleBuff*() 
+	{
+		return this;
+	}
+
+	CDC *GetOriginalDC()
+	{
+		return m_pDC;
+	}
+};
+
+class AFX_EXT_CLASS CGradientStatic : public CStatic
+{
+	DECLARE_DYNAMIC(CGradientStatic)
+
+public:
+	enum	EN_ANI_MODE{EN_ANI_NONE=0,EN_ANI_LEFTRIGHT,EN_ANI_LAMP};
+
+	CGradientStatic();
+	virtual ~CGradientStatic();
+	void SetWindowText(LPCTSTR a_lpstr);
+	void SetColor(long cl) {clLeft=cl;};
+	BOOL SetControlFont(int nHeight, int nWidth, int nEscapement,
+		int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline,
+		BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision,
+		BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily,
+		LPCTSTR lpszFacename);
+	void SetGradientColor(long cl) {clRight=cl; SetDrawColor(clLeft, clRight); };
+	void SetTextColor(long cl) {clText=cl;};
+	void SetReverseGradient();
+	void SetLeftSpacing(int iNoOfPixels) { m_iLeftSpacing = iNoOfPixels; };
+	void SetTextAlign(int iAlign ) { m_iAlign = iAlign; }; //0 - left, 1 - center, 2 -right
+	void SetVerticalGradient(BOOL a_bVertical = TRUE) { m_bVertical = a_bVertical; };
+	void SetOulineColor(long cl1, long cl2) { clOut1 = cl1; clOut2 = cl2; m_bDrawOutLine = TRUE; }
+	void SetDrawColor(long cl1, long cl2);
+	void MoveDrawColor();
+	void SetAnimationMode(int nMode, int nTime, int nIndex);
+	static void DrawGradRect(CDC *pDC, CRect r, COLORREF cLeft, COLORREF cRight, BOOL a_bVertical);
+	void DrawGradRect(CDC *pDC, CRect r, BOOL a_bVertical, COLORREF *cl);
+
+protected:
+	CString m_sTEXT;
+	int m_iLeftSpacing;
+	long clLeft;
+	long clRight;
+	long clText;
+	long clOut1;
+	long clOut2;
+	COLORREF clDrawColor[510];
+	int m_iAlign;
+	BOOL m_bDrawOutLine;
+	EN_ANI_MODE m_enAnimation;
+	int m_nAniColorCount;
+	HINSTANCE hinst_msimg32;
+	BOOL m_bCanDoGradientFill;
+	BOOL m_bVertical;
+	LPFNDLLFUNC1 dllfunc_GradientFill;
+
+	CFont m_font;
+
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+
+	DECLARE_MESSAGE_MAP()
+public:
+};
+
+
diff --git a/Common_Class/VisionLib/SISControls/include/HeadCtrl.h b/Common_Class/VisionLib/SISControls/include/HeadCtrl.h
new file mode 100644
index 0000000..a273989
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/HeadCtrl.h
@@ -0,0 +1,104 @@
+#if !defined(AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_)
+#define AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// HeadCtrl.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CHeadCtrl window
+#ifndef __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+class AFX_EXT_CLASS CHeadCtrl : public CHeaderCtrl
+{
+// Construction
+public:
+	struct HEADCELL
+	{
+		DWORD   state;
+		CString string;
+	};
+	class CHeadCell : public HEADCELL
+	{
+	public:
+		CHeadCell()
+		{
+			state=0;
+			string="";
+		}
+		CHeadCell(HEADCELL& hcell)
+		{
+			*this=hcell;
+		}
+		CHeadCell operator=(HEADCELL& hcell)
+		{
+			state=hcell.state;
+			string=hcell.string;
+			return *this;
+		}
+	};
+
+	typedef CArray<CHeadCell,CHeadCell&> CHeadItem;
+	typedef CArray<CHeadItem,CHeadItem&> CHeadInfo;
+
+public:
+	CHeadCtrl();
+	void SetCount(int nCount, CFont* pFont);
+	int  GetCount(){return m_count;}
+	int  GetHeadHeight();
+
+
+	void InsertColumn(int nCol);
+	void DeleteColumn(int nCol);
+	void FontChange(LOGFONT logfont);
+	BOOL SetItemText(int nItem, int nSubItem, LPCSTR lpcstr);
+	CString GetItemText(int nItem, int nSubItem);
+	BOOL SetItemMerge(int nsItem, int nsSubItem, int neItem, int neSubItem); 
+	UINT GetItemState(int nItem, int nSubItem, int& down, int& right);
+	BOOL GetRect(int nItem, int nSubItem, CRect& rect);
+protected:
+	BOOL m_bclick;
+	CPoint m_pnt;
+
+	CFont m_font;
+	int m_count;
+	CHeadInfo m_Info;
+	BOOL IsDraw(CRect rect);
+	BOOL GetTextRect(CDC* pDC, CString strText, CRect& rect);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CHeadCtrl)
+	virtual void OnPaint();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CHeadCtrl();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CHeadCtrl)
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/InPlaceComboBox.h b/Common_Class/VisionLib/SISControls/include/InPlaceComboBox.h
new file mode 100644
index 0000000..a8a1248
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/InPlaceComboBox.h
@@ -0,0 +1,51 @@
+#if !defined(AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_)
+#define AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// InPlaceComboBox.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceComboBox window
+
+class AFX_EXT_CLASS CInPlaceComboBox : public CComboBox
+{
+// Construction
+public:
+	CInPlaceComboBox(int iItem,int iSubItem);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceComboBox)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceComboBox();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceComboBox)
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnSelchange();
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	//}}AFX_MSG
+	int m_iSubItem;
+	int m_iItem;
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/InPlaceEdit.h b/Common_Class/VisionLib/SISControls/include/InPlaceEdit.h
new file mode 100644
index 0000000..e40b670
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/InPlaceEdit.h
@@ -0,0 +1,59 @@
+#if !defined(AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_)
+#define AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// InPlaceEdit.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceEdit window
+
+class AFX_EXT_CLASS CInPlaceEdit : public CEdit
+{
+// Construction
+public:
+	CInPlaceEdit(int iItem, int iSubItem, CString sInitText);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceEdit)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	CString m_strNewValue;
+	virtual ~CInPlaceEdit();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceEdit)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnNcDestroy();
+	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+private:
+	BOOL m_bESC;
+	CString m_sInitText;
+	int m_iSubItem;
+	int m_iItem;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/LogCtrl.h b/Common_Class/VisionLib/SISControls/include/LogCtrl.h
new file mode 100644
index 0000000..bcf41e5
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/LogCtrl.h
@@ -0,0 +1,213 @@
+//LogCtrl.h
+//LogCtrl.h
+#ifndef __LOGCTRL_H
+#define __LOGCTRL_H
+#define __LOGCTRL_LIB_H
+
+#ifndef __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+//LOG CELL STATE
+//MERGE
+#define LCS_NORML		0x0000
+#define LCS_MERGE		0x0001
+#define LCS_UNUSE		0x0002
+
+//LINE
+#define LCS_TLINE		0x0001	//TOP LINE DRAW
+#define LCS_BLINE		0x0002	//BOTTOM LINE DRAW
+#define LCS_LLINE		0x0004	//LEFT LINE DRAW
+#define LCS_RLINE		0x0008	//RIGHT LINE DRAW
+#define LCS_RECT		LCS_TLINE|LCS_BLINE|LCS_LLINE|LCS_RLINE
+
+//merge state
+#define SetFlag(n)  DWORD(BYTE(n)<<16)
+#define GetFlag(d)  int((d & 0x00FF0000)>>16)
+
+#define SetDown(n)  DWORD(BYTE(n)<<8)
+#define GetDown(d)  int((d & 0x0000FF00)>>8)
+
+#define SetRight(n) DWORD(BYTE(n))
+#define GetRight(d) int((d & 0x000000FF))
+
+#define LOGCHECK(b) if(b){return;}
+#define LOGCHECK0(b) if(b){return 0;}
+#define LOGCHECK1(b) if(b){return -1;}
+
+class CPrintDC;
+class CLogCell;
+class CLogPage;
+class CLogCtrl;
+
+typedef CArray<CLogCell,CLogCell&> CLogItem;
+typedef CArray<CLogItem,CLogItem&> CLogItemArray;
+typedef CArray<CLogPage,CLogPage&> CLogPageArray;
+
+typedef struct tagLOGCELL
+{
+	BYTE		m_nLine; //惑窍谅快 扼牢 
+	UINT		m_nState;//促弗伎苞 捍钦灯绰瘤 ..
+	UINT		m_nFormat;//沥纺葛靛
+	RECT		m_rect;  //伎狼 康开
+	COLORREF	m_txtclr;//臂磊祸
+	COLORREF	m_bkgclr;//硅版祸
+	CString		m_strTxt;//臂磊
+	CFont*		m_pfont; //迄飘
+	CBitmap*	m_pBitmap;//厚飘甘
+}LOGCELL;
+
+//Orientation=啊肺(1), 技肺(2)  bDialog=DoModal()
+class AFX_EXT_CLASS CPrintDC
+{
+public:
+	CPrintDC();
+	virtual ~CPrintDC();
+	CDC* GetPrintDC(int Orientation, BOOL bDialog=FALSE);
+protected:
+	CDC *m_pDC;
+};
+
+class CLogCell : public tagLOGCELL
+{
+public:
+	CLogCell();
+	CLogCell(LPCSTR lpstr,
+			CRect	rect,
+			int nFormat=DT_CENTER,
+			COLORREF textColor=0x00000000,
+			COLORREF backColor=0x00ffffff,
+			CFont* pf=NULL);
+
+	void operator=(const CLogCell& log);
+	void InitCell();
+	void Draw(CDC* pDC);
+};
+
+class AFX_EXT_CLASS CLogPage
+{
+public:
+	CLogPage();
+	CLogPage(CPoint startPnt);
+	virtual ~CLogPage();
+	void RemoveAll();
+	void operator=(CLogPage& page);
+
+	//青,凯 肮荐甫 汲沥茄促.
+	void SetColCount(int nCount);
+	void SetRowCount(int nCount);
+	BOOL RemoveRow(int nRow);
+
+	//厘钎 免仿困摹
+	void SetStartPoint(CPoint startPnt);
+	CPoint GetStartPoint() const;
+
+	//青,凯 肮荐甫 府畔茄促.
+	int GetColCount() const;
+	int GetRowCount() const;
+
+	//气,臭捞甫 汲沥茄促.
+	BOOL SetColWidth(int nCol, int nWidth);
+	BOOL SetRowHeight(int nRow, int nHeight);
+
+	//迄飘甫 汲沥茄促.
+	BOOL SetCellFont(int nRow, int nCol, CFont* pf);
+	BOOL SetCellFont(int nsRow, int nsCol, int neRow, int neCol, CFont* pf);
+	CFont* GetCellFont(int nRow, int nCol);
+
+	//硅版祸阑 汲沥茄促.
+	BOOL SetCellBkgColor(int nRow, int nCol, COLORREF color);
+	COLORREF GetCellBkgColor(int nRow, int nCol);
+
+	//臂磊祸阑 汲沥茄促.
+	BOOL SetCellTxtColor(int nRow, int nCol, COLORREF color);
+	COLORREF GetCellTxtColor(int nRow, int nCol);
+
+	//臂磊困摹 汲沥
+	BOOL SetCellFormat(int nRow, int nCol, int nFormat);
+	int GetCellFormat(int nRow, int nCol);
+
+	//Rect阑 汲沥茄促.
+	BOOL SetCellRect(int nRow, int nCol, CRect rect);
+	BOOL GetCellRect(int nRow, int nCol, CRect& rect);
+
+	//BITMAP阑 汲沥茄促.
+	BOOL SetCellBmp(int nRow, int nCol, CBitmap* pBmp);
+	CBitmap* GetCellBmp(int nRow, int nCol);
+
+	//荤阿屈 弊副锭 绢蠢 困摹甫 弊副 巴牢啊 汲沥茄促. 
+	BOOL SetCellLine(int nRow, int nCol, int nState=LCS_RECT/*LCS_RECT*/);
+	int GetCellLine(int nRow, int nCol);
+
+	//伎俊 臂磊阑 涝仿茄促.
+	BOOL SetItemText(int nRow, int nCol, LPCTSTR lpstr, int nFormat=DT_CENTER|DT_VCENTER|DT_SINGLELINE);
+	CString GetItemText(int nRow, int nCol);
+
+	BOOL SetCell(int nRow, int nCol, CLogCell lc);
+	CLogCell* GetCell(int nRow, int nCol);
+
+	//伎阑 捍钦茄促.
+	BOOL CellMerge(int nsCol, int nsRow, int neCol ,int neRow );
+
+	//免仿茄促.(nPageNO绰 其捞瘤 锅龋捞哥 0老 版快 免仿登瘤 臼绰促.)
+	void Draw(CDC* pDC, int nPageNO=0);
+
+	//SetPageRect(,)窃荐甫 荤侩矫 
+	//Draw(CDC* pDC, int nPageNO=0);窃荐甫 龋免窍扁 官肺傈俊 荤侩秦具窃
+	//侩档: 
+	//   <<page>>                                 <<device>>
+	//  0                               100      0                               1000  
+	//  ΓΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΔ        ΓΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΔ
+	//  Β  (10,10)              (90,10)Β        Β (100,100)           (900,100)Β
+	//  Β  ΓΑΑΑΑΑΑΑΑΑΑΑΔ  Β        Β  ΓΑΑΑΑΑΑΑΑΑΑΑΔ  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  Β                      Β ΜΜΜΜΜΜΜ>Β                      Β  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  ΖΑΑΑΑΑΑΑΑΑΑΑΕ  Β        Β  ΖΑΑΑΑΑΑΑΑΑΑΑΕ  Β
+	//  Β  (10,40)              (90,40)Β        Β (100,400)           (900,400)Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  ΖΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΕ        ΖΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΕ
+	//  200                            100,200    2000                            1000,2000 
+	//  
+	//   CRect page(0,0,100,200);
+	//   CRect device(0,0,1000,2000);
+	//   咯归阑 炼陛 林妨搁: CRect device(100,100,900,1900);
+	//   SetPageRect(pDC, page, device);
+	BOOL SetPageRect(CDC* pDC, CRect page, CRect device);
+protected:
+	bool m_IsViewPort;
+	int m_RowCnt;
+	int m_ColCnt;
+	CPoint		  m_startPnt;
+	CLogItemArray m_liAry;
+};
+
+//厘钎 傈眉甫 包府茄促.
+//厘钎甫 免仿窍扁 困秦 怖 鞘夸窍柳 臼促.
+//CLogPage甫 荤侩秦档 公规窍促.
+class AFX_EXT_CLASS CLogCtrl
+{
+public:
+	CLogCtrl();
+	virtual ~CLogCtrl();
+	int  GetLogPageCount();
+	void AddLogPage(CLogPage& lp);
+	CLogPage* GetLogPage(int nPage);
+	void DelLogPage(int nPage);
+	void Draw(CDC* pDC, DOCINFO* pDocInfo);
+protected:
+	CLogPageArray m_log;
+};
+
+#endif
diff --git a/Common_Class/VisionLib/SISControls/include/SISButton.h b/Common_Class/VisionLib/SISControls/include/SISButton.h
new file mode 100644
index 0000000..86f912e
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/SISButton.h
@@ -0,0 +1,82 @@
+#if !defined(AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_)
+#define AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISButton.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISButton by Niek Albers
+// Thanks to some people for the tooltip.
+// A cool CBitmapButton derived class with 3 states,
+// Up/Down/SIS.
+class AFX_EXT_CLASS CSISButton : public CBitmapButton
+{
+	DECLARE_DYNAMIC(CSISButton);
+
+	// Construction
+public:
+	CSISButton();
+	void SetToolTipText(CString* spText, BOOL bActivate = TRUE);
+	void SetToolTipText(int nId, BOOL bActivate = TRUE);
+	void SetWindowText(CString strText);
+	void SetFontSize(int nSize);
+	void SetTextColor(COLORREF rgbNormal, COLORREF rgbDisable);
+	void SetSISButtonStyle(UINT uID, int nImgCount);
+	void SetSISButtonStyle(UINT uID, int nImgCount, CString spTipText);
+	void SetSISButtonStyle(UINT uID, int nImgCount, CString spTipText, CString spBtnText, int nFontSize);
+
+	CString m_strText;
+	CDC      m_gMemDC;
+
+// Attributes
+protected:
+	void fPaint(CDC* pDC);
+	void ActivateTooltip(BOOL bActivate = TRUE);
+	BOOL m_bSIS;						// indicates if mouse is over the button
+	CSize m_ButtonSize;					// width and height of the button
+	CBitmap m_Bitmap;
+	BOOL m_bTracking;
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISButton)
+	protected:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	BOOL LoadBitmap(UINT bitmapid, UINT uiImageCount);
+	virtual ~CSISButton();
+
+	// Generated message map functions
+protected:
+	CToolTipCtrl m_ToolTip;
+	void InitToolTip();
+	//{{AFX_MSG(CSISButton)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg LRESULT OnMouseLeave(WPARAM wparam, LPARAM lparam);
+	afx_msg LRESULT OnMouseHOver(WPARAM wparam, LPARAM lparam) ;
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	UINT m_uiImageCount;
+	CFont	m_Font;
+	LOGFONT		m_lf;
+	COLORREF m_RGBTextNormal;
+	COLORREF m_RGBTextDisable;
+	BOOL m_bIsDisable;	// Disable老 锭绰 臂磊祸阑 官操扁 困秦.
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/SISFolderScheduling.h b/Common_Class/VisionLib/SISControls/include/SISFolderScheduling.h
new file mode 100644
index 0000000..68d9a52
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/SISFolderScheduling.h
@@ -0,0 +1,92 @@
+// SISFolderScheduling.h: interface for the CSISFolderScheduling class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_)
+#define AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define TARGETTYPE_FOLDER		1
+#define TARGETTYPE_FILE			2
+
+struct SSubPathInfo
+{
+	CString		s_strItemPath;
+	CString		s_strItemName;
+	long		s_nCreateDate;
+	int			s_nItemType;
+
+	SSubPathInfo()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		s_strItemPath = _T("");
+		s_strItemName = _T("");
+		s_nCreateDate = 0;
+		s_nItemType = 0;
+	}
+	
+	// 汗荤 积己磊.
+	SSubPathInfo(const SSubPathInfo& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_strItemPath = rhs.s_strItemPath;
+			s_strItemName = rhs.s_strItemName;
+			s_nCreateDate = rhs.s_nCreateDate;
+			s_nItemType = rhs.s_nItemType;
+		}
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+    SSubPathInfo& operator=(const SSubPathInfo& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_strItemPath = rhs.s_strItemPath;
+			s_strItemName = rhs.s_strItemName;
+			s_nCreateDate = rhs.s_nCreateDate;
+			s_nItemType = rhs.s_nItemType;
+		}
+		return *this;
+	}
+};
+
+class AFX_EXT_CLASS CSISFolderScheduling  
+{
+public:
+	CSISFolderScheduling();
+	CSISFolderScheduling(CString strPath);
+	CSISFolderScheduling(CString strPath, int nTargetType);
+	virtual ~CSISFolderScheduling();
+
+	BOOL SetRemainDelete(CString strPath, int nTargetType, int nRemainItemCount);
+	BOOL CommitSchedule();
+	void ResetSchedule();
+
+protected:
+	
+	BOOL SearchSubItem(const CString &strMainPath, BOOL bIsAscending);
+	BOOL SortSubItem(BOOL bIsAscending);	// 坷抚瞒鉴 TRUE, 郴覆瞒鉴 FALSE
+	BOOL DeleteFolder(const CString &strFolder);
+
+	// 包府甫 且 弥惑困 版肺.
+	CString				m_strMainPath;
+	BOOL				m_bTargetFolder;
+	BOOL				m_bTargetFile;
+	BOOL				m_bIsAscending;
+
+	// 老何父 巢扁绊 昏力.
+	int					m_nRemainItemCount;
+
+	// 包府 措惑 沥焊
+	SSubPathInfo*		m_pPathInfo;
+	int					m_nSubItemCount;
+};
+
+#endif // !defined(AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/SISJogBtn2Parent.h b/Common_Class/VisionLib/SISControls/include/SISJogBtn2Parent.h
new file mode 100644
index 0000000..16595c0
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/SISJogBtn2Parent.h
@@ -0,0 +1,12 @@
+// by ChaeSIS
+
+#ifndef SIS_JOG_BTN_2_PARENT_H
+#define SIS_JOG_BTN_2_PARENT_H
+
+typedef struct _SISJOGBTN2PARENT
+{
+	virtual BOOL SendMessageToParent(LPCTSTR message) = 0;
+	virtual BOOL SendMessageToParent(int nMsg) = 0;
+} SISJogBtn2Parent, *pSISJogBtn2Parent;
+
+#endif
\ No newline at end of file
diff --git a/Common_Class/VisionLib/SISControls/include/SISJogButton.h b/Common_Class/VisionLib/SISControls/include/SISJogButton.h
new file mode 100644
index 0000000..1f971a1
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/SISJogButton.h
@@ -0,0 +1,63 @@
+#if !defined(AFX_SISJOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_)
+#define AFX_SISJOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISJogButton.h : header file
+//
+
+#include "SISJogBtn2Parent.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISJogButton window
+
+class AFX_EXT_CLASS CSISJogButton : public CButton
+{
+// Construction
+public:
+	CSISJogButton();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void SetJ2M(pSISJogBtn2Parent pJ2M)			{ m_pJ2M = pJ2M; }
+	void SetStringDown(CString strMsg)			{ m_strMessageDown = strMsg; }
+	void SetStringUp(CString strMsg)			{ m_strMessageUp = strMsg; }
+	void SetIntDown(int nMsg)					{ m_nMessageDown = nMsg; }
+	void SetIntUp(int nMsg)						{ m_nMessageUp = nMsg; }
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISJogButton)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CSISJogButton();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISJogButton)
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	pSISJogBtn2Parent	m_pJ2M;
+	CString				m_strMessageDown;
+	CString				m_strMessageUp;
+	int					m_nMessageDown;
+	int					m_nMessageUp;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_JOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/SISLabel.h b/Common_Class/VisionLib/SISControls/include/SISLabel.h
new file mode 100644
index 0000000..e6dd533
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/SISLabel.h
@@ -0,0 +1,77 @@
+#if !defined(AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
+#define AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// Label.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISLabel window
+enum FlashType {None, Text, Background };
+
+class AFX_EXT_CLASS CSISLabel : public CStatic
+{
+// Construction
+public:
+	CSISLabel();
+	CSISLabel& SetBkColor(COLORREF crBkgnd);
+	CSISLabel& SetTextColor(COLORREF crText);
+	CSISLabel& SetText(const CString& strText);
+	CSISLabel& SetFontBold(BOOL bBold);
+	CSISLabel& SetFontName(const CString& strFont);
+	CSISLabel& SetFontUnderline(BOOL bSet);
+	CSISLabel& SetFontItalic(BOOL bSet);
+	CSISLabel& SetFontSize(int nSize);
+	CSISLabel& SetSunken(BOOL bSet);
+	CSISLabel& SetBorder(BOOL bSet);
+	CSISLabel& FlashText(BOOL bActivate);
+	CSISLabel& FlashBackground(BOOL bActivate);
+	CSISLabel& SetLink(BOOL bLink);
+	CSISLabel& SetLinkCursor(HCURSOR hCursor);
+
+// Attributes
+public:
+protected:
+	void ReconstructFont();
+	COLORREF	m_crText;
+	HBRUSH		m_hBrush;
+	HBRUSH		m_hwndBrush;
+	LOGFONT		m_lf;
+	CFont		m_font;
+	CString		m_strText;
+	BOOL		m_bState;
+	BOOL		m_bTimer;
+	BOOL		m_bLink;
+	FlashType	m_Type;
+	HCURSOR		m_hCursor;
+			// Operations
+public:
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISLabel)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CSISLabel();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISLabel)
+	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/SISListBoxLog.h b/Common_Class/VisionLib/SISControls/include/SISListBoxLog.h
new file mode 100644
index 0000000..6ad7ea8
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/SISListBoxLog.h
@@ -0,0 +1,96 @@
+#if !defined(AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_)
+#define AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// cSISListBoxLog.h : header file
+//
+
+#include "SISFolderScheduling.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListBoxLog window
+
+#define LOG_NORMAL		1
+#define LOG_HISTORY		2
+#define LOG_WARNING		3
+#define LOG_ERROR		4
+#define LOG_DEBUG		5
+
+#define STRINGBUFFER_COUNT		200
+class AFX_EXT_CLASS CSISListBoxLog : public CListBox
+{
+// Construction
+public:
+	CSISListBoxLog();
+	virtual ~CSISListBoxLog();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISListBoxLog)
+	//}}AFX_VIRTUAL
+
+	//////////////////////////////////////////////////////////////////////////
+	// Logging
+	void	SetPath(CString& strPath, CString& strName, BOOL bDelete, int nRemainCount);
+	void	DisplayMessages(BOOL bAddMsgBox, int nLevel, TCHAR *str, ...);
+	void	DisplayMessages(BOOL bAddMsgBox, TCHAR *str, ...);
+	void	DisplayMessage(BOOL bAddMsgBox, int nLevel, TCHAR *str);
+	void	DisplayMessage(BOOL bAddMsgBox, TCHAR *str);
+	void	SetTextColor(long clbg1 = RGB(255,255,255), long clbg2 = RGB(255,255,255), long clText = RGB(0,0,0));
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISListBoxLog)
+	afx_msg LRESULT OnDisplayMessage(WPARAM wParam, LPARAM lParam);
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+	//////////////////////////////////////////////////////////////////////////
+	// Folder Management
+	CSISFolderScheduling	m_FolderSchedule;
+		
+	//////////////////////////////////////////////////////////////////////////
+	// Logging
+	CString				m_strLogDir;
+	CString				m_strFileName;
+
+	CString				m_strLogPath;
+	CString				m_strLogFile;
+	CTime				m_TimeLogFile;
+	CFile*				m_pFileLog;
+
+	TCHAR				m_strBuffer[512];
+
+	BOOL				MakeLogFile();
+	BOOL				WriteToFile(CTime& time, CString& strContents);
+	BOOL				WriteToFile(CTime& time, TCHAR* strContents);
+
+	DWORD				m_dwThreadID;
+
+	CString				m_strArray[STRINGBUFFER_COUNT];
+	BOOL				m_bMustDisplay[STRINGBUFFER_COUNT];
+	int					m_nAddIndex;
+	int					m_nReadIndex;
+	CRITICAL_SECTION	m_csLog;
+
+	long				m_clBG1;
+	long				m_clBG2;
+	long				m_clText;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/SISListCtrlExt.h b/Common_Class/VisionLib/SISControls/include/SISListCtrlExt.h
new file mode 100644
index 0000000..c0e712a
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/SISListCtrlExt.h
@@ -0,0 +1,137 @@
+#if !defined(AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_)
+#define AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISListCtrlExt.h : header file
+//
+
+#include <afxtempl.h>
+
+#include "InPlaceEdit.h"
+#include "InPlaceComboBox.h"
+
+#define EDITDISABLE_NONE	0
+#define EDITDISABLE_ROWS	1
+#define EDITDISABLE_COLS	2
+#define EDITDISABLE_ROWCOL	3
+
+#define INPLACECTRL_EDIT	4
+#define INPLACECTRL_COMBO	5
+#define INPLACECTRL_EDIT_COMBO	6
+
+#define EDITDISABLE_ROWS_ARRAY	7
+#define EDITDISABLE_COLS_ARRAY	8
+
+#define COMBODATASTATE_SINGLE 9
+#define COMBODATASTATE_MULTI  10
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListCtrlExt window
+
+typedef struct _LISTROWCOLOR
+{
+	int			s_nRow;
+	COLORREF	s_Color;
+} ListRowColor, *pListRowColor;
+
+class AFX_EXT_CLASS CSISListCtrlExt : public CListCtrl
+{
+// Construction
+public:
+	CSISListCtrlExt();
+	virtual ~CSISListCtrlExt();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void SetComboCtrlCols(CString strCols,int nLength);
+	void SetEditCtrlCols(CString strCols,int nLength);
+	void SetComboData(TCHAR *pData[],int nState,int nLength);
+	void SetComboData(CStringList *pList, int nState);
+	void EditDisableRows(CString strRows,int nLength);
+	void EditDisableCols(CString strCols,int nLength);
+	BOOL GetEnableSortList();
+	void SetEnableSortList(BOOL nEnable);
+	void SortListCtrl(int nCol);
+	void InitListHeader(TCHAR *colList[],int *widthList,int nLength, int nHeight);
+	void SetInPlaceCtrl(int nCtrl);
+	void SetDefaultEditText(CString strInitText);
+	void SetEditDisableState(int nState);
+	int GetEditDisableCols();
+	int GetEditDisableRows();
+	int GetEditDisableState();
+	void EditDisableRowCol(int nRow,int nCol);
+	void EditDisableCols(int nCols);
+	void EditDisableRows(int nRows);
+	void SetColNum(int nColNum);
+	void AddBlankItem();
+	CImageList* SetImageList(CImageList* pImageList, int nImageListType);
+		
+	void InsertListItemEx(int nRow, int nCol, const CString& strString);
+	void InsertListItemEx(int nRow, int nCol, int nValue);
+	void InsertListItemEx(int nRow, int nCol, double dValue, int nRight = 3);
+
+	void SetTextColor(int nRow, COLORREF clrText);
+	void SetBKColor(int nRow, COLORREF clrBK);
+	void ReleaseTextColor(int nRow);
+	void ReleaseBKColor(int nRow);
+	void ResetTextColor();
+	void ResetBKColor();
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISListCtrlExt)
+	//}}AFX_VIRTUAL
+
+protected:
+	CInPlaceEdit *m_pEdit;
+	CInPlaceComboBox *m_pComboBox;
+	int m_nInPlaceCtrl;
+	int m_nColNum;
+	int m_nEditDisableState;
+	int m_nDisableCol;
+	int m_nDisableRow;
+	BOOL m_bSortOrder;
+	CString m_strInitEditText;
+	BOOL m_bEnableSortList;
+	int *m_pEditDisableCols;
+	int *m_pEditDisableRows;
+	// Generated message map functions
+protected:
+	int m_nComboCtrlLength;
+	int m_nEditCtrlLength;
+	int *m_pComboCtrlCols;
+	int *m_pEditCtrlCols;
+	CStringList *m_pComboData;
+	int m_nLength;
+	int m_nComboDataState;
+	BOOL m_bSetImageList;
+
+// Implementation
+public:
+	CList<pListRowColor, pListRowColor>	m_ListColorText;
+	CList<pListRowColor, pListRowColor>	m_ListColorBk;
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISListCtrlExt)
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/SortClass.h b/Common_Class/VisionLib/SISControls/include/SortClass.h
new file mode 100644
index 0000000..b6b2d83
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/SortClass.h
@@ -0,0 +1,40 @@
+
+
+class CSortClass
+{
+public:
+	CSortClass(CListCtrl * _pWnd, const int _iCol, const bool _bIsNumeric);
+	//CSortClass(CListCtrl * _pWnd, const int _iCol, const bool _bIsNumeric, int iStartingItem, int iEndingItem );
+	virtual ~CSortClass();		
+	
+	int iCol;	
+	int m_iStartingItem;
+	int m_iEndingItem;
+
+	CListCtrl * pWnd;	
+	bool bIsNumeric;
+	
+	void Sort(const bool bAsc);	
+	
+	static int CALLBACK CompareAsc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareDes(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareAscI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareDesI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
+public:	
+	class CSortItem	
+	{	
+		public:		
+			virtual  ~CSortItem();
+			CSortItem(const DWORD _dw, const CString &_txt);		
+			CString txt;		
+			DWORD dw;	
+	};
+	class CSortItemInt	
+	{	
+		public:
+			CSortItemInt(const DWORD _dw, const CString &_txt);		
+			int iInt ;		
+			DWORD dw;	
+	};
+};
\ No newline at end of file
diff --git a/Common_Class/VisionLib/SISControls/include/StaticMap.h b/Common_Class/VisionLib/SISControls/include/StaticMap.h
new file mode 100644
index 0000000..591e458
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/StaticMap.h
@@ -0,0 +1,149 @@
+#if !defined(AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_)
+#define AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// StaticMap.h : header file
+//
+
+#define ORIGIN_LEFTTOP		1
+#define ORIGIN_LEFTBOTTOM	0
+#define ORIGIN_RIGHTTOP		2
+#define ORIGIN_RIGHTBOTTOM	3
+
+#define UM_MAP_CHANGED			5573
+#define _MENU_DEFECT_LIST_ID_			8000
+/////////////////////////////////////////////////////////////////////////////
+// CStaticMap window
+enum OriginDirection		{ OD_LeftTop = 0, OD_RightTop = 1, OD_LeftBottom = 10, OD_RightBottom = 11 };
+
+class AFX_EXT_CLASS CStaticMap : public CStatic
+{
+	// Construction
+public:
+	CStaticMap();
+
+	// Attributes
+public:
+
+	// Operations
+public:
+	void				InitGlass(CWnd* pParent, int nMapWidth, int nMapHeight, int nMapMargin);	// Pixel 窜困 付柳.
+	void				DeinitGlass();
+	int					GetMapTotalWidth()		{ return m_nMapTotalWidth; }
+	int					GetMapTotalHeight()		{ return m_nMapTotalHeight; }
+	int					GetMapWidth()			{ return m_nMapWidth; }
+	int					GetMapHeight()			{ return m_nMapHeight; }
+
+	void				SetMiniMap(BOOL bIsMiniMap, int nUnitSize)	{ m_bIsMiniMap = bIsMiniMap; m_nUnitSize = nUnitSize; }
+	int					GetUnitSize()			{ return m_nUnitSize; }
+
+	virtual void		DrawGlass(CDC* pDC)						{ }
+	virtual void		MouseLBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnUp(CPoint& point)				{ }
+	virtual void		MouseLBtnMove(CPoint& point)			{ }
+	virtual void		MouseLBtnDblClk(CPoint& point)			{ }
+	virtual void		MouseRBtnDwn(CPoint& point)				{ }
+	virtual void		MouseRBtnUp(CPoint& point)				{ }
+	virtual void		MouseRBtnDblClk(CPoint& point)			{ }
+	virtual void		RegistNoDefect()						{ }
+	virtual void		Timer(UINT nIDEvent)					{ }
+
+	// 犬措/绵家
+	void				IncreaseRatio();
+	void				DecreaseRatio();
+	void				ResetRatio();
+
+	CPoint&				GetDisplayStart()		{ return m_PointGlassStart; }
+	CPoint&				GetDisplayEnd()			{ return m_PointGlassEnd; }
+
+	void				SetDisplayRect(CPoint& PointStart, CPoint& PointEnd);
+	void				SetShowShot(BOOL bShow)	{ m_bShowShot = bShow; }
+
+	// 历厘
+	void				SaveMapToFile(CString strFileName);
+	void				SetBGColor(COLORREF color) { m_clBGColor = color; }
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CStaticMap)
+	//}}AFX_VIRTUAL
+
+	// Implementation
+public:
+	virtual ~CStaticMap();
+
+	// Generated message map functions
+protected:
+	void				SetMappingMode(CDC *pDC);
+	CPoint				SetWindowToGlass(CPoint pt);
+	CPoint				SetGlassToWindow(CPoint pt);
+	void				ControlZoom(BOOL bZoomIn, CPoint ptMouse);
+
+	void				PopupMenu(int nBaseID, CPoint point);
+
+	CWnd*				m_pParentWnd;
+	int					m_nMapTotalWidth;
+	int					m_nMapTotalHeight;
+	int					m_nMapWidth;
+	int					m_nMapHeight;
+	int					m_nMapMarginWidth;
+	int					m_nMapMarginHeight;
+	CRect				m_RectWnd;
+	CRect				m_RectMap;
+	long				m_clBGColor;
+	long				m_clPatColor;
+	//////////////////////////////////////////////////////////////////////////
+	// 弊府扁 沥焊
+	HBITMAP				m_hDrawingSurface;
+	BITMAPINFOHEADER	m_BMIH;
+	CRect				m_RectDrawingSurface;
+	BYTE*				m_pDrawingSurfaceBits;
+
+	OriginDirection		m_OriginDir;
+	int					m_nUnitSize;
+
+	// Cell 弊府扁
+	BOOL				m_bShowShot;
+
+	// 犬措/绵家
+	CRect				m_RectShowWnd;
+
+	double				m_dRatio;
+	CPoint				m_PointWindowStart;
+	BOOL				m_bDragMove;
+	CPoint				m_PointDragStart;
+	BOOL				m_bIsMiniMap;			// Minimap篮 犬措/绵家甫 救茄促.
+	CPoint				m_PointGlassStart;		// Glass 吝 泅犁 焊咯瘤绰 康开.
+	CPoint				m_PointGlassEnd;
+
+	POINT				m_PointCCut[3];			//内呈钠 弊府扁 谅钎
+	int					m_nCCutSize;
+	int					m_nCoordGabX;			// 谅钎甫 谎副 芭府.
+	int					m_nCoordGabY;			// 谅钎甫 谎副 芭府.
+
+	//{{AFX_MSG(CStaticGlass)
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg long OnUpdateMap(WPARAM wParam, LPARAM lParam);
+	afx_msg void OnMenuChangeViewMode(UINT nID);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/WKButton.h b/Common_Class/VisionLib/SISControls/include/WKButton.h
new file mode 100644
index 0000000..6dec8c3
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/WKButton.h
@@ -0,0 +1,119 @@
+#if !defined(AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_)
+#define AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// WKButton.h : header file
+/******************************< 橇肺弊伐 沥焊 >****************************/
+/*   努 贰 胶 疙 : WKButton                                                */ 
+/*   滚       傈 :                                                         */
+/*   弥辆 荐沥老 : 2006. 05. 28                                            */
+/***************************************************************************/
+
+/////////////////////////////////< 沥  狼 >//////////////////////////////////
+
+// 滚瓢 屈怕
+#define		WK_BUTTON_SHPAE_RECTANGLE				0x0001
+#define		WK_BUTTON_SHAPE_CIRCLE					0x0002
+#define		WK_BUTTON_SHAPE_ROUNDRECT				0x0004
+
+// 滚瓢 祸惑
+#define		WK_BUTTON_COLOR_ONE						0x0001
+#define		WK_BUTTON_COLOR_TWO						0x0002
+#define		WK_BUTTON_COLOR_GRADATION_UP			0x0011
+#define		WK_BUTTON_COLOR_GRADATION_RIGHT			0x0012
+#define		WK_BUTTON_COLOR_GRADATION_DOWN			0x0014
+#define		WK_BUTTON_COLOR_GRADATION_LEFT			0x0018
+
+// 滚瓢 惑怕
+#define		WK_BUTTON_STATUS_MOUSEOVER				0x0001
+#define		WK_BUTTON_STATUS_MOUSELEAVE				0x0002
+#define		WK_BUTTON_STATUS_MOUSECLICK				0x0004
+
+
+///////////////////////////////< 努贰胶 备炼 >///////////////////////////////
+class AFX_EXT_CLASS CWKButton : public CButton
+{
+public://<<<<<<<<<<<<<<<<<<<<<< 寇何 立辟 窃荐 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+	CWKButton();
+	virtual ~CWKButton();
+
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CWKButton)
+	public:
+	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
+	virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL DestroyWindow();
+	protected:
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+public:	
+/*****************************< 滚瓢 汲沥 窃荐 >****************************/
+	/* 咆胶飘 葛剧 棺 郴侩 瘤沥 */
+	BOOL SetButtonText(CString strCaption);
+	BOOL SetButtonText(CString strCaption, COLORREF rgbText);
+	BOOL SetButtonText(CString strCaption, CFont *font, COLORREF rgbText);
+	
+	/* 滚瓢 屈怕 棺 祸惑 瘤沥 */
+	BOOL SetButtonStyle(DWORD dShape, COLORREF rgbColor1);
+	BOOL SetButtonStyle(DWORD dShape, DWORD dStyle,	COLORREF rgbColor1,	COLORREF rgbColor2);
+	/***************************************************************************/
+
+protected://<<<<<<<<<<<<<<<< 郴何 贸府 窃荐 棺 函荐 >>>>>>>>>>>>>>>>>>>>>>>>>
+	/* 惑怕喊 滚瓢 捞固瘤 */
+	CBitmap m_bmpImage1;	//乞惑矫
+	CBitmap m_bmpImage2;	//付快胶 坷滚
+	CBitmap m_bmpImage3;	//努腐
+	
+	/* 惑怕喊 滚瓢 捞固瘤 积己 */
+	BOOL CreateButtonImage();
+
+	/* 滚瓢 屈怕 积己 */
+	BOOL DrawFormRectangle();	// 荤阿
+	BOOL DrawFormCircle();		// 盔
+	BOOL DrawFormRoundRect();	// 嫡辟荤阿
+
+	/* 捞固瘤 贸府 */
+	COLORREF LightValueControl(COLORREF rgb, int nValue);						// 祸惑 灌扁 炼例
+	void DrawGradation(CBitmap* bmpImage, COLORREF color1, COLORREF color2);	// 弊扼单捞记 捞固瘤 积己
+	BOOL DrawBorder(CBitmap* pbmpImage, COLORREF color1, COLORREF color2, int nWidth = 2);		// 滚瓢 抛滴府 弊府扁
+	BOOL DrawText(CBitmap* pBitmap, int nStatus);								// 滚瓢俊 臂揪 持扁
+
+	/* 滚瓢 捞固瘤 沥焊 */
+	DWORD m_dShape;			// 滚瓢 屈怕
+	DWORD m_dStyle;			// 拿矾 胶鸥老
+	COLORREF m_rgbColor1;	// 霉锅掳 拿矾
+	COLORREF m_rgbColor2;	// 滴锅掳 拿矾
+	CRect m_rtButton;		// 滚瓢农扁
+	int m_nWidth;			// 滚瓢 呈厚
+	int m_nHeight;			// 滚瓢 臭捞
+
+	/* 咆胶飘 沥焊 */
+	CString m_strCaption;	// 母记 郴侩
+	CFont m_Font;			// 母记 臂裁
+	COLORREF m_rgbText;		// 母记 祸惑
+	BOOL m_bValueChange;	// 母记 函版
+	
+	/* 滚瓢 惑怕 沥焊 */
+	DWORD m_dButtonStatus;
+	
+	//{{AFX_MSG(CWKButton)
+	afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
+	afx_msg void OnPaint();
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_)
diff --git a/Common_Class/VisionLib/SISControls/include/XTabCtrl.h b/Common_Class/VisionLib/SISControls/include/XTabCtrl.h
new file mode 100644
index 0000000..2d25ef4
--- /dev/null
+++ b/Common_Class/VisionLib/SISControls/include/XTabCtrl.h
@@ -0,0 +1,90 @@
+#if !defined(AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_)
+#define AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// XTabCtrl.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CXTabCtrl window
+#include <afxtempl.h>
+
+class AFX_EXT_CLASS CXTabCtrl : public CTabCtrl
+{
+// Construction
+public:
+	CXTabCtrl();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void AddTab(CWnd* pWnd, LPTSTR lpszCaption, int iImage =0);
+	void AddTab(CWnd* pWnd, LPTSTR lpszCaption, int Width, int Height, int iImage =0);
+	void EnableTab(int iIndex, BOOL bEnable = TRUE);
+	BOOL SelectTab(int iIndex);
+	void DeleteAllTabs();
+	void DeleteTab(int iIndex);
+	void SetTopLeftCorner(CPoint pt);
+	BOOL IsTabEnabled(int iIndex);
+
+	void SetDisabledColor(COLORREF cr);
+	void SetSelectedColor(COLORREF cr);
+	void SetNormalColor(COLORREF cr);
+	void SetMouseOverColor(COLORREF cr);
+
+	void SetParentWnd(CWnd* pWnd)	{ m_pParentWnd = pWnd; }
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CXTabCtrl)
+	protected:
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CXTabCtrl();
+
+	// Generated message map functions
+protected:
+	CArray<BOOL, BOOL> m_arrayStatusTab; //** enabled Y\N
+	int m_iSelectedTab;
+	POINT m_ptTabs;
+	COLORREF m_crSelected;
+	COLORREF m_crDisabled;
+	COLORREF m_crNormal;
+	COLORREF m_crMouseOver;
+	COLORREF m_crBKColor;
+
+	int m_iIndexMouseOver;
+	
+	bool m_bMouseOver;
+	bool m_bColorMouseOver;
+	bool m_bColorNormal;
+	bool m_bColorDisabled;
+	bool m_bColorSelected;
+	
+	//{{AFX_MSG(CXTabCtrl)
+	afx_msg void OnSelchange(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+	CWnd*		m_pParentWnd;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_)
diff --git a/ENRIT.sln b/ENRIT.sln
new file mode 100644
index 0000000..06b460d
--- /dev/null
+++ b/ENRIT.sln
@@ -0,0 +1,266 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.23107.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENRIT", "ENRIT\ENRIT.vcxproj", "{12044BF5-D688-41F0-9E7C-E558E134F69B}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common_Class", "Common_Class", "{61A743DC-DEE4-474C-9950-68043D045930}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConfigFileManager", "Common_Class\ConfigFileManager\ConfigFileManager.vcxproj", "{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SISControls", "Common_Class\SISControls\SISControls.vcxproj", "{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CHThreadPool", "Common_Class\CHThreadPool\CHThreadPool.vcxproj", "{A397C4E0-6CDE-411E-960B-FA381D6E612A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SharedMapDll", "Common_Class\SharedMapDll\SharedMapDll.vcxproj", "{681CB63A-6D15-48C9-9990-8874B881CB8C}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EdgeInspect", "Common_Class\EdgeInspect\EdgeInspect.vcxproj", "{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SISBuffer", "Common_Class\SISBuffer\SISBuffer.vcxproj", "{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SISAssem", "Common_Class\SISAssem\SISAssem.vcxproj", "{147FB2E2-F781-431F-92A5-15F9E72E2FF2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CHImageBuffer", "Common_Class\CHImageBuffer\CHImageBuffer.vcxproj", "{C7329FF2-46AB-447B-9761-EC4C45E33A7D}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PLCConnector", "Common_Class\PLCConnector\PLCConnector.vcxproj", "{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExpireDay", "Common_Class\ExpireDay\ExpireDay.vcxproj", "{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LogView", "Common_Class\LogView\LogView.vcxproj", "{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Language_Res", "Language_Res", "{586BA0F1-A7B4-4B94-B701-B0F9C0F15A13}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENRUTResources_zh-CN", "ENRUTResources_zh-CN\ENRUTResources_zh-CN.vcxproj", "{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlGrabber", "Common_Class\BlGrabber\BlGrabber.vcxproj", "{E5ADE862-9082-48F0-8210-A4F5CA9908AF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDK_AND_TEST", "SDK_AND_TEST\SDK_AND_TEST.vcxproj", "{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlVisionPro", "BlVisionPro\BlVisionPro.vcxproj", "{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+		Template|Win32 = Template|Win32
+		Template|x64 = Template|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Debug|Win32.Build.0 = Debug|Win32
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Debug|x64.ActiveCfg = Debug|x64
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Debug|x64.Build.0 = Debug|x64
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Release|Win32.ActiveCfg = Release|Win32
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Release|Win32.Build.0 = Release|Win32
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Release|x64.ActiveCfg = Release|x64
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Release|x64.Build.0 = Release|x64
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Template|Win32.ActiveCfg = Release|Win32
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Template|Win32.Build.0 = Release|Win32
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Template|x64.ActiveCfg = Release|x64
+		{12044BF5-D688-41F0-9E7C-E558E134F69B}.Template|x64.Build.0 = Release|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Debug|Win32.Build.0 = Debug|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Debug|x64.ActiveCfg = Debug|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Debug|x64.Build.0 = Debug|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Release|Win32.ActiveCfg = Release|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Release|Win32.Build.0 = Release|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Release|x64.ActiveCfg = Release|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Release|x64.Build.0 = Release|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Template|Win32.ActiveCfg = Simulation|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Template|Win32.Build.0 = Simulation|Win32
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Template|x64.ActiveCfg = Simulation|x64
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D}.Template|x64.Build.0 = Simulation|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Debug|Win32.Build.0 = Debug|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Debug|x64.ActiveCfg = Debug|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Debug|x64.Build.0 = Debug|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Release|Win32.ActiveCfg = Release|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Release|Win32.Build.0 = Release|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Release|x64.ActiveCfg = Release|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Release|x64.Build.0 = Release|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Template|Win32.ActiveCfg = Simulation|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Template|Win32.Build.0 = Simulation|Win32
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Template|x64.ActiveCfg = Simulation|x64
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593}.Template|x64.Build.0 = Simulation|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Debug|Win32.Build.0 = Debug|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Debug|x64.ActiveCfg = Debug|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Debug|x64.Build.0 = Debug|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Release|Win32.ActiveCfg = Release|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Release|Win32.Build.0 = Release|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Release|x64.ActiveCfg = Release|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Release|x64.Build.0 = Release|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Template|Win32.ActiveCfg = Simulation|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Template|Win32.Build.0 = Simulation|Win32
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Template|x64.ActiveCfg = Simulation|x64
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A}.Template|x64.Build.0 = Simulation|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Debug|Win32.Build.0 = Debug|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Debug|x64.ActiveCfg = Debug|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Debug|x64.Build.0 = Debug|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Release|Win32.ActiveCfg = Release|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Release|Win32.Build.0 = Release|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Release|x64.ActiveCfg = Release|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Release|x64.Build.0 = Release|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Template|Win32.ActiveCfg = Release|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Template|Win32.Build.0 = Release|Win32
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Template|x64.ActiveCfg = Release|x64
+		{681CB63A-6D15-48C9-9990-8874B881CB8C}.Template|x64.Build.0 = Release|x64
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Debug|Win32.Build.0 = Debug|Win32
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Debug|x64.ActiveCfg = Debug|x64
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Debug|x64.Build.0 = Debug|x64
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Release|Win32.ActiveCfg = Release|Win32
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Release|Win32.Build.0 = Release|Win32
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Release|x64.ActiveCfg = Release|x64
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Release|x64.Build.0 = Release|x64
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Template|Win32.ActiveCfg = Release|Win32
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Template|Win32.Build.0 = Release|Win32
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Template|x64.ActiveCfg = Release|x64
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4}.Template|x64.Build.0 = Release|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Debug|Win32.Build.0 = Debug|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Debug|x64.ActiveCfg = Debug|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Debug|x64.Build.0 = Debug|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Release|Win32.ActiveCfg = Release|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Release|Win32.Build.0 = Release|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Release|x64.ActiveCfg = Release|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Release|x64.Build.0 = Release|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Template|Win32.ActiveCfg = Release|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Template|Win32.Build.0 = Release|Win32
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Template|x64.ActiveCfg = Release|x64
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1}.Template|x64.Build.0 = Release|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Debug|Win32.ActiveCfg = Debug|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Debug|Win32.Build.0 = Debug|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Debug|x64.ActiveCfg = Debug|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Debug|x64.Build.0 = Debug|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Release|Win32.ActiveCfg = Release|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Release|Win32.Build.0 = Release|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Release|x64.ActiveCfg = Release|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Release|x64.Build.0 = Release|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Template|Win32.ActiveCfg = Release|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Template|Win32.Build.0 = Release|Win32
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Template|x64.ActiveCfg = Release|x64
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2}.Template|x64.Build.0 = Release|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Debug|Win32.Build.0 = Debug|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Debug|x64.ActiveCfg = Debug|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Debug|x64.Build.0 = Debug|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Release|Win32.ActiveCfg = Release|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Release|Win32.Build.0 = Release|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Release|x64.ActiveCfg = Release|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Release|x64.Build.0 = Release|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Template|Win32.ActiveCfg = Simulation|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Template|Win32.Build.0 = Simulation|Win32
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Template|x64.ActiveCfg = Simulation|x64
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D}.Template|x64.Build.0 = Simulation|x64
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Debug|Win32.ActiveCfg = Debug|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Debug|Win32.Build.0 = Debug|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Debug|x64.ActiveCfg = Debug|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Debug|x64.Build.0 = Debug|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Release|Win32.ActiveCfg = Release|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Release|Win32.Build.0 = Release|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Release|x64.ActiveCfg = Release|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Release|x64.Build.0 = Release|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Template|Win32.ActiveCfg = Template|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Template|Win32.Build.0 = Template|Win32
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Template|x64.ActiveCfg = Template|x64
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0}.Template|x64.Build.0 = Template|x64
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Debug|Win32.Build.0 = Debug|Win32
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Debug|x64.ActiveCfg = Debug|x64
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Debug|x64.Build.0 = Debug|x64
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Release|Win32.ActiveCfg = Release|Win32
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Release|Win32.Build.0 = Release|Win32
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Release|x64.ActiveCfg = Release|x64
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Release|x64.Build.0 = Release|x64
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Template|Win32.ActiveCfg = Release|Win32
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Template|Win32.Build.0 = Release|Win32
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Template|x64.ActiveCfg = Release|x64
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF}.Template|x64.Build.0 = Release|x64
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Debug|Win32.Build.0 = Debug|Win32
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Debug|x64.ActiveCfg = Debug|x64
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Debug|x64.Build.0 = Debug|x64
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Release|Win32.ActiveCfg = Release|Win32
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Release|Win32.Build.0 = Release|Win32
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Release|x64.ActiveCfg = Release|x64
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Release|x64.Build.0 = Release|x64
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Template|Win32.ActiveCfg = Template|Win32
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Template|Win32.Build.0 = Template|Win32
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Template|x64.ActiveCfg = Template|x64
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F}.Template|x64.Build.0 = Template|x64
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Debug|Win32.Build.0 = Debug|Win32
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Debug|x64.ActiveCfg = Debug|x64
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Debug|x64.Build.0 = Debug|x64
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Release|Win32.ActiveCfg = Release|Win32
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Release|Win32.Build.0 = Release|Win32
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Release|x64.ActiveCfg = Release|x64
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Release|x64.Build.0 = Release|x64
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Template|Win32.ActiveCfg = Debug|Win32
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Template|Win32.Build.0 = Debug|Win32
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Template|x64.ActiveCfg = Debug|x64
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}.Template|x64.Build.0 = Debug|x64
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Debug|Win32.Build.0 = Debug|Win32
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Debug|x64.ActiveCfg = Debug|x64
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Debug|x64.Build.0 = Debug|x64
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Release|Win32.ActiveCfg = Release|Win32
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Release|Win32.Build.0 = Release|Win32
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Release|x64.ActiveCfg = Release|x64
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Release|x64.Build.0 = Release|x64
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Template|Win32.ActiveCfg = Release|Win32
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Template|Win32.Build.0 = Release|Win32
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Template|x64.ActiveCfg = Release|x64
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF}.Template|x64.Build.0 = Release|x64
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Debug|Win32.ActiveCfg = Debug|Win32
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Debug|Win32.Build.0 = Debug|Win32
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Debug|x64.ActiveCfg = Debug|x64
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Debug|x64.Build.0 = Debug|x64
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Release|Win32.ActiveCfg = Release|Win32
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Release|Win32.Build.0 = Release|Win32
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Release|x64.ActiveCfg = Release|x64
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Release|x64.Build.0 = Release|x64
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Template|Win32.ActiveCfg = Release|Win32
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Template|Win32.Build.0 = Release|Win32
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Template|x64.ActiveCfg = Release|x64
+		{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}.Template|x64.Build.0 = Release|x64
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Debug|Win32.ActiveCfg = Debug|Win32
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Debug|Win32.Build.0 = Debug|Win32
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Debug|x64.ActiveCfg = Debug|x64
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Debug|x64.Build.0 = Debug|x64
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Release|Win32.ActiveCfg = Release|Win32
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Release|Win32.Build.0 = Release|Win32
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Release|x64.ActiveCfg = Release|x64
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Release|x64.Build.0 = Release|x64
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Template|Win32.ActiveCfg = Release|Win32
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Template|Win32.Build.0 = Release|Win32
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Template|x64.ActiveCfg = Release|x64
+		{36F8EDF1-9D70-4496-B465-AFA0FAB6F7EB}.Template|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{7D79CBEE-DDA9-4CEB-A79B-C66F26F37C7D} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{B7AB9D8F-9E94-4DEE-97D0-7E1753881593} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{A397C4E0-6CDE-411E-960B-FA381D6E612A} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{681CB63A-6D15-48C9-9990-8874B881CB8C} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{AEBDC93C-EB5D-42B9-B1DF-3A4C3021A9C4} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{F5D04EE7-6E37-4BDC-8071-9215CA2933E1} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{147FB2E2-F781-431F-92A5-15F9E72E2FF2} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{C7329FF2-46AB-447B-9761-EC4C45E33A7D} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{DCA95AC1-2C8A-4C10-975F-C2EE6682C3B0} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{6779F1ED-1B3E-44A4-803F-29006DF7DFBF} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{16DDBBEB-2A60-4B4D-AE50-3CC642A4201F} = {61A743DC-DEE4-474C-9950-68043D045930}
+		{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A} = {586BA0F1-A7B4-4B94-B701-B0F9C0F15A13}
+		{E5ADE862-9082-48F0-8210-A4F5CA9908AF} = {61A743DC-DEE4-474C-9950-68043D045930}
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {2F3F0CDA-966C-40BF-B8EA-93C98AFDFFF6}
+	EndGlobalSection
+EndGlobal
diff --git a/ENRIT/BICommon.h b/ENRIT/BICommon.h
new file mode 100644
index 0000000..c7fb138
--- /dev/null
+++ b/ENRIT/BICommon.h
@@ -0,0 +1,16 @@
+#ifndef BL_COMMON_H
+#define BL_COMMON_H
+
+#include <windows.h>
+#include <dbghelp.h>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <time.h>
+
+#include "CLanguageControl.h"
+
+#define OFFLINE_KEY           1   //OFFLINE_KEY:1鏄绾挎ā寮�;0鏄湪绾挎ā寮�
+#define PROHIBITED_LICENSE    0   //Prohibited license
+
+#endif
\ No newline at end of file
diff --git a/ENRIT/CLanguageControl.cpp b/ENRIT/CLanguageControl.cpp
new file mode 100644
index 0000000..5f97005
--- /dev/null
+++ b/ENRIT/CLanguageControl.cpp
@@ -0,0 +1,100 @@
+锘�#include "stdafx.h"
+#include "CLanguageControl.h"
+
+CLanguageControl::CLanguageControl()
+{
+    CString strPath;
+    strPath.Format(_T("%s\\LanguageType.ini"), LANGUAGE_DIR_PATH);
+    CT2CA pszConvertedAnsiString(strPath, CP_UTF8);
+
+    m_eSelectLangType = LoadLanguageSetting(std::string(pszConvertedAnsiString));
+    switch (m_eSelectLangType)
+    {
+    case emLanguageType::emLanguageType_EN:
+        m_hLangDLL = NULL;
+        break;
+    case emLanguageType::emLanguageType_KR:
+        // 灏嗚祫婧愬彞鏌勯噸缃洖榛樿鍊�
+        AfxSetResourceHandle(AfxGetInstanceHandle());
+        m_hLangDLL = NULL;
+        break;
+    case emLanguageType::emLanguageType_CH:
+        // 鍔犺浇涓枃璧勬簮搴�
+        m_hLangDLL = LoadLibraryEx(_T("ENRUTResources_zh-CN.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE);
+        if (m_hLangDLL != NULL)
+        {
+            AfxSetResourceHandle(m_hLangDLL);
+        }
+        break;
+    }
+}
+
+CLanguageControl::~CLanguageControl()
+{
+    if (m_hLangDLL != NULL)
+    {
+        FreeLibrary(m_hLangDLL);
+    }
+}
+
+bool CLanguageControl::SaveLanguageSetting(const std::string& filename, emLanguageType language) {
+    std::ofstream iniFile;
+
+    iniFile.open(filename, std::ios::out);
+    if (!iniFile.is_open()) {
+        std::cerr << "Unable to open file for writing.\n";
+        return false;
+    }
+
+    switch (language) {
+    case emLanguageType::emLanguageType_CH:
+        iniFile << "language=Chinese\n";
+        break;
+    case emLanguageType::emLanguageType_KR:
+        iniFile << "language=Korean\n";
+        break;
+    case emLanguageType::emLanguageType_EN:
+        iniFile << "language=English\n";
+        break;
+    default:
+        iniFile << "language=Unknown\n";
+        break;
+    }
+
+    iniFile.close();
+    return true;
+}
+
+emLanguageType CLanguageControl::LoadLanguageSetting(const std::string& filename) {
+    std::ifstream iniFile;
+    std::string line;
+    std::string languagePrefix = "language=";
+    emLanguageType language = emLanguageType::emLanguageType_KR; // 榛樿璇█
+
+    iniFile.open(filename, std::ios::in);
+    if (!iniFile.is_open()) {
+        std::cerr << "Unable to open file for reading. Default language will be used.\n";
+        return language;
+    }
+
+    while (std::getline(iniFile, line)) {
+        // 妫�鏌ヨ涓槸鍚﹀寘鍚瑷�璁剧疆
+        size_t pos = line.find(languagePrefix);
+        if (pos != std::string::npos) {
+            std::string langStr = line.substr(pos + languagePrefix.length());
+            if (langStr == "Chinese") {
+                language = emLanguageType::emLanguageType_CH;
+            }
+            else if (langStr == "Korean") {
+                language = emLanguageType::emLanguageType_KR;
+            }
+            else if (langStr == "English") {
+                language = emLanguageType::emLanguageType_EN;
+            }
+            break;
+        }
+    }
+
+    iniFile.close();
+    return language;
+}
diff --git a/ENRIT/CLanguageControl.h b/ENRIT/CLanguageControl.h
new file mode 100644
index 0000000..94fcf6f
--- /dev/null
+++ b/ENRIT/CLanguageControl.h
@@ -0,0 +1,21 @@
+#pragma once
+#include "Singleton.h"
+
+#define LANGUAGE_DIR_PATH			_T("C:\\RCutProject\\Language")
+enum emLanguageType { emLanguageType_EN = 0, emLanguageType_KR, emLanguageType_CH };
+
+class CLanguageControl : public Singleton<CLanguageControl>
+{
+public:
+	CLanguageControl();
+	virtual ~CLanguageControl();
+
+	bool SaveLanguageSetting(const std::string& filename, emLanguageType language);
+	emLanguageType LoadLanguageSetting(const std::string& filename);
+
+public:
+	emLanguageType				m_eSelectLangType;
+	HINSTANCE					m_hLangDLL;
+};
+#define g_pLang		CLanguageControl::GetSingletonPtr()
+
diff --git a/ENRIT/Data/DefectStorage.cpp b/ENRIT/Data/DefectStorage.cpp
new file mode 100644
index 0000000..4493ba5
--- /dev/null
+++ b/ENRIT/Data/DefectStorage.cpp
@@ -0,0 +1,939 @@
+#include "StdAfx.h"
+#include "DefectStorage.h"
+#include "MulticamControl.h"
+#include "Glass_Data.h"
+#include "HardwareSettings.h"
+
+CDefectStorage::CDefectStorage(void)
+{
+	m_nDefectSpace = 0;
+	m_nDefect= m_maxDefect= 0;
+	m_pDefect= NULL;	
+}
+
+CDefectStorage::~CDefectStorage(void)
+{
+	if(m_pDefect)
+		delete[] m_pDefect;	
+}
+
+void CDefectStorage::ResetDefectStorage()
+{
+
+//	int i;
+// 	if(m_pDefect != NULL)
+// 	{
+// 		for(i= 0; i< m_maxDefect; i++)		
+// 			m_pDefect[i].Reset();
+// 	}
+	
+	m_nDefect= 0;
+}
+
+
+int	CDefectStorage::InitDefectStorage(int maxDefect)
+{	
+	if(maxDefect <= m_nDefectSpace)
+	{
+		m_maxDefect= maxDefect;
+		return m_maxDefect;
+	}
+
+	if(m_pDefect != NULL)
+	{
+		delete[] m_pDefect;
+	}
+
+	// 16俺狼 咯盒阑 敌促..恐? 郴干..
+	int	DefectSapce= maxDefect+ 16;
+	m_pDefect= new CDefect[DefectSapce];
+
+	if(m_pDefect == NULL)
+	{
+		m_maxDefect= m_nDefectSpace= 0;
+		return m_maxDefect;
+	}
+
+
+	m_maxDefect= m_nDefectSpace= maxDefect;
+
+
+	return m_maxDefect;
+}
+
+void CDefectStorage::CheckDefectRect(CPoint* pVertex, CRect* pRect, int nX, int nY)
+{
+	if (!pVertex || !pRect)
+		return;
+
+	// Rect
+	if (nY <= pRect->top)
+	{
+		pRect->top = nY;
+		if (pVertex[2].y == nY)	// Top Left
+		{
+			if (nX < pVertex[2].x)
+			{
+				pVertex[2].x = nX;
+				pVertex[2].y = nY;
+			}
+		}
+		else
+		{
+			pVertex[2].x = nX;
+			pVertex[2].y = nY;
+		}
+		if (pVertex[3].y == nY)	// Top Right
+		{
+			if (nX + 1 > pVertex[3].x)
+			{
+				pVertex[3].x = nX + 1;
+				pVertex[3].y = nY;
+			}
+		}
+		else
+		{
+			pVertex[3].x = nX + 1;
+			pVertex[3].y = nY;
+		}
+	}
+	if (nY + 1 >= pRect->bottom)
+	{
+		pRect->bottom = nY + 1;
+		if (pVertex[6].y == nY + 1)	// Bottom Left
+		{
+			if (nX < pVertex[6].x)
+			{
+				pVertex[6].x = nX;
+				pVertex[6].y = nY + 1;
+			}
+		}
+		else
+		{
+			pVertex[6].x = nX;
+			pVertex[6].y = nY + 1;
+		}
+		if (pVertex[7].y == nY + 1)	// Bottom Right
+		{
+			if (nX + 1 > pVertex[7].x)
+			{
+				pVertex[7].x = nX + 1;
+				pVertex[7].y = nY + 1;
+			}
+		}
+		else
+		{
+			pVertex[7].x = nX + 1;
+			pVertex[7].y = nY + 1;
+		}
+	}
+	if (nX <= pRect->left)
+	{
+		pRect->left = nX;
+		if (pVertex[1].x == nX)	// Left Bottom
+		{
+			if (nY + 1 > pVertex[1].y)
+			{
+				pVertex[1].x = nX;
+				pVertex[1].y = nY + 1;
+			}
+		}
+		else
+		{
+			pVertex[1].x = nX;
+			pVertex[1].y = nY + 1;
+		}
+		if (pVertex[0].x == nX)	// Left Top
+		{
+			if (nY < pVertex[0].y)
+			{
+				pVertex[0].x = nX;
+				pVertex[0].y = nY;
+			}
+		}
+		else
+		{
+			pVertex[0].x = nX;
+			pVertex[0].y = nY;
+		}
+	}
+	if (nX + 1 >= pRect->right)
+	{
+		pRect->right = nX + 1;
+		if (pVertex[5].x == nX + 1)	// Right Bottom
+		{
+			if (nY + 1 > pVertex[5].y)
+			{
+				pVertex[5].x = nX + 1;
+				pVertex[5].y = nY + 1;
+			}
+		}
+		else
+		{
+			pVertex[5].x = nX + 1;
+			pVertex[5].y = nY + 1;
+		}
+		if (pVertex[4].x == nX + 1)	// Right Top
+		{
+			if (nY < pVertex[4].y)
+			{
+				pVertex[4].x = nX + 1;
+				pVertex[4].y = nY;
+			}
+		}
+		else
+		{
+			pVertex[4].x = nX + 1;
+			pVertex[4].y = nY;
+		}
+	}
+}
+
+int CDefectStorage::StopInspection(CAssemControl *pAssemControl)
+{
+	return 0;
+}
+
+void CDefectStorage::SetBlobDefect( int i )
+{
+
+}
+
+CDefectControl::CDefectControl()
+{
+	m_pGrabber = NULL;
+	m_pGlassData = NULL;
+	m_pHWRecipe = NULL;
+	ResetDefectControl();	
+}
+
+CDefectControl::~CDefectControl()
+{
+
+}
+
+void CDefectControl::ResetDefectControl()
+{
+	CDefectStorage::ResetDefectStorage();
+}
+
+int CDefectControl::CheckDefectCount()
+{
+	if(m_nDefect >= m_maxDefect)
+		return DIT_CONV_GLASSOVERFLOW;
+
+	return DIT_CONV_SUCCESS;
+}
+
+int CDefectControl::ExtractDefect_ProfileChamfer(DimensionDir emDim,int iCam,int iScan,DefectLocation nDefectLoc,CvPoint2D32f  ptDefect,int nProfileIndex)
+{
+	if(m_pGrabber == NULL)
+		return m_nDefect;
+
+	CSingleLock MyLock(&m_csDefect);
+	MyLock.Lock();
+
+	if(m_nDefect >= m_maxDefect)
+	{	
+		MyLock.Unlock();
+		return m_nDefect;
+	}	
+
+	CRect		rectDefect;
+	CDefect		*pDefect=NULL;					
+
+	pDefect = GetDefect(m_nDefect);
+	if(pDefect == NULL)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	pDefect->Reset();
+
+	int			nGlassStart = 0;
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pEdgeInfo != NULL)
+		{
+			nGlassStart = pEdgeInfo->nGlassStartLine;
+		}
+	}
+
+	CAMERA_DIR		eCamDir = CAMDIR_NONE;
+	int				nFrameWidth = 0;
+	if(m_pHWRecipe != NULL)
+	{
+		CCameraSettings *pCamera = m_pHWRecipe->GetCameraSettings(iCam,iScan);
+		if(pCamera != NULL)
+		{
+			eCamDir = pCamera->m_enCamDir;
+			nFrameWidth = pCamera->m_FrameSize.cx;
+		}
+	}
+
+	rectDefect = CRect((int)ptDefect.x,(int)ptDefect.y,(int)ptDefect.x,(int)ptDefect.y);
+	rectDefect.InflateRect(5,5);
+
+	pDefect->m_nGlassStartLine = nGlassStart;
+	pDefect->m_nIndex = m_nDefect;		
+	pDefect->m_nCamID = iCam;
+	pDefect->m_nScanIdx = iScan;
+	pDefect->m_DefectLoc = nDefectLoc;		
+	pDefect->m_nSideLoc = (int)emDim;
+	pDefect->m_nCamDir = (int)eCamDir;
+	pDefect->m_nProfileIndex = nProfileIndex;
+
+	pDefect->m_Defect.s_nDefectRScale = rectDefect.Width()*rectDefect.Height();
+
+	pDefect->m_Defect.s_DefectRect = rectDefect;
+	pDefect->m_Defect.s_nDefectX = (int)ptDefect.x;
+	pDefect->m_Defect.s_nDefectY = (int)ptDefect.y;		
+
+	if(pDefect->m_Defect.s_DefectRect.left < 0 || pDefect->m_Defect.s_DefectRect.right >= nFrameWidth 
+		|| pDefect->m_Defect.s_DefectRect.top < 0)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	if(m_pGrabber->GetSmallImage(iScan,pDefect->m_Image
+		, pDefect->m_Defect.s_nDefectX - DEFECTIMAGE_WIDTH / 2
+		, pDefect->m_Defect.s_nDefectY - DEFECTIMAGE_HEIGHT / 2
+		, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT, FALSE) == FALSE)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	if(nDefectLoc == DefectLoc_Chamfer)
+		g_pLog->DisplayMessage(_T("%s Chamfer Defect Pos[%d,%d]"),PANEL_SIDE[emDim],pDefect->m_Defect.s_nDefectX,pDefect->m_Defect.s_nDefectY);
+	else
+		g_pLog->DisplayMessage(_T("%s Profile Defect Pos[%d,%d]"),PANEL_SIDE[emDim],pDefect->m_Defect.s_nDefectX,pDefect->m_Defect.s_nDefectY);
+
+	m_nDefect++;		
+
+	MyLock.Unlock();
+	return m_nDefect;
+}
+
+int CDefectControl::ExtractDefect_Hole(DimensionDir emDim,int iCam,int iScan,std::vector<CRect> &vecList,int nDefectCount,DefectLocation nDefectLoc,CRect rectIns)
+{
+	if(m_pGrabber == NULL)
+		return m_nDefect;
+
+	CSingleLock MyLock(&m_csDefect);
+	MyLock.Lock();
+	if(m_nDefect >= m_maxDefect)
+	{	
+		MyLock.Unlock();
+		return m_nDefect;
+	}	
+
+	int			iDefect;
+	CRect		rectDefect;
+	CDefect		*pDefect=NULL;					
+
+	int			nGlassStart = 0;
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pEdgeInfo != NULL)
+		{
+			nGlassStart = pEdgeInfo->nGlassStartLine;
+		}
+	}
+
+	CAMERA_DIR		eCamDir = CAMDIR_NONE;
+	int				nFrameWidth = 0;
+	if(m_pHWRecipe != NULL)
+	{
+		CCameraSettings *pCamera = m_pHWRecipe->GetCameraSettings(iCam,iScan);
+		if(pCamera != NULL)
+		{
+			eCamDir = pCamera->m_enCamDir;
+			nFrameWidth = pCamera->m_FrameSize.cx;
+		}
+	}
+
+	for(iDefect=0;iDefect<nDefectCount;iDefect++)
+	{		
+		if(m_nDefect >= m_maxDefect)
+			break;
+
+		pDefect = GetDefect(m_nDefect);
+		if(pDefect == NULL)
+			break;	
+
+		pDefect->Reset();
+
+		rectDefect = vecList[iDefect];
+
+		pDefect->m_nGlassStartLine = nGlassStart;
+		pDefect->m_nIndex = m_nDefect;		
+		pDefect->m_nCamID = iCam;
+		pDefect->m_nScanIdx = iScan;
+		pDefect->m_DefectLoc = nDefectLoc;		
+		pDefect->m_nSideLoc = (int)emDim;
+		pDefect->m_nCamDir = (int)eCamDir;
+
+		pDefect->m_Defect.s_nDefectRScale = rectDefect.Width()*rectDefect.Height();
+
+		pDefect->m_Defect.s_DefectRect = rectDefect;
+		pDefect->m_Defect.s_DefectRect.OffsetRect(rectIns.left,rectIns.top);
+
+		pDefect->m_Defect.s_nDefectX = rectDefect.left;
+		pDefect->m_Defect.s_nDefectY = rectDefect.top;		
+		pDefect->m_Defect.s_nDefectY += rectIns.top;		
+		pDefect->m_Defect.s_nDefectX += rectIns.left;
+		pDefect->m_Defect.s_nDefectArea = rectDefect.Width() * rectDefect.Height();
+
+		if(pDefect->m_Defect.s_DefectRect.left < 0 || pDefect->m_Defect.s_DefectRect.right >= nFrameWidth 
+			|| pDefect->m_Defect.s_DefectRect.top < 0)
+			continue;
+
+		if(m_pGrabber->GetSmallImage(iScan,pDefect->m_Image
+			, pDefect->m_Defect.s_nDefectX - DEFECTIMAGE_WIDTH / 2
+			, pDefect->m_Defect.s_nDefectY - DEFECTIMAGE_HEIGHT / 2
+			, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT, FALSE) == FALSE)
+			continue;
+
+		g_pLog->DisplayMessage(_T("%s Hole Defect Pos[%d,%d]"),PANEL_SIDE[eCamDir],pDefect->m_Defect.s_nDefectX,pDefect->m_Defect.s_nDefectY);		
+
+		m_nDefect++;	
+	}
+
+	MyLock.Unlock();
+
+	return m_nDefect;
+}
+
+int	CDefectControl::ExtractDefect_NotchChip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pBlobStorage,int nDefectCount,DefectLocation nDefectLoc,CRect rectIns)
+{		
+	if(m_pGrabber == NULL)
+		return m_nDefect;
+
+	CSingleLock MyLock(&m_csDefect);
+	MyLock.Lock();
+
+	if(m_nDefect >= m_maxDefect)
+	{	
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	int			iDefect;
+	CChipBlob	*pBlob;		
+	CDefect		*pDefect=NULL;					
+
+	int			nGlassStart = 0;
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pEdgeInfo != NULL)
+		{
+			nGlassStart = pEdgeInfo->nGlassStartLine;
+		}
+	}
+
+	CAMERA_DIR		eCamDir = CAMDIR_NONE;
+	int				nFrameWidth = 0;
+	if(m_pHWRecipe != NULL)
+	{
+		CCameraSettings *pCamera = m_pHWRecipe->GetCameraSettings(iCam,iScan);
+		if(pCamera != NULL)
+		{
+			eCamDir = pCamera->m_enCamDir;
+			nFrameWidth = pCamera->m_FrameSize.cx;
+		}
+	}
+
+	for(iDefect=0;iDefect<nDefectCount;iDefect++)
+	{		
+		if(m_nDefect >= m_maxDefect)
+			break;
+
+		pBlob = &pBlobStorage[iDefect];
+		if(pBlob == NULL)
+			continue;
+
+		if(pBlob->s_DefectType == DEFTYPE_NODEFECT || pBlob->s_bRemoved == TRUE)
+			continue;
+
+		pDefect = GetDefect(m_nDefect);
+		if(pDefect == NULL)
+			break;	
+
+		pDefect->Reset();
+
+		pDefect->m_nGlassStartLine = nGlassStart;
+		pDefect->m_nIndex = m_nDefect;		
+		pDefect->m_nCamID = iCam;
+		pDefect->m_nScanIdx = iScan;
+		pDefect->m_DefectLoc = nDefectLoc;		
+		pDefect->m_nSideLoc = (int)emDim;
+		pDefect->m_nCamDir = (int)eCamDir;
+
+		CopyChipToBlob(pBlob,&pDefect->m_Defect);		
+
+		pDefect->m_Defect.s_DefectRect.OffsetRect(rectIns.left,rectIns.top);
+		pDefect->m_Defect.s_nDefectY += rectIns.top;		
+		pDefect->m_Defect.s_nDefectX += rectIns.left;
+
+		if(pDefect->m_Defect.s_DefectRect.left < 0 || pDefect->m_Defect.s_DefectRect.right >= nFrameWidth
+			|| pDefect->m_Defect.s_DefectRect.top < 0)
+			continue;
+
+		if(m_pGrabber->GetSmallImage(iScan,pDefect->m_Image
+			, pDefect->m_Defect.s_nDefectX - DEFECTIMAGE_WIDTH / 2
+			, pDefect->m_Defect.s_nDefectY - DEFECTIMAGE_HEIGHT / 2
+			, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT, FALSE) == FALSE)
+			continue;
+
+		g_pLog->DisplayMessage(_T("%s Notch Defect Loc[%d] Pos[%d,%d]"),PANEL_SIDE[emDim],pDefect->m_nSplineLoc,pDefect->m_Defect.s_nDefectX,pDefect->m_Defect.s_nDefectY);		
+
+		m_nDefect++;		
+	}
+
+	MyLock.Unlock();
+	return m_nDefect;
+}
+
+int	CDefectControl::ExtractDefect_SplineChip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pBlobStorage,int nDefectCnt,DefectLocation nDefectLoc,CPoint basePos,int nSplineType,BOOL bFlip,int nChipW,int nChipH,EM_CHIPPING_COMP eComp)
+{
+	if(m_pGrabber == NULL)
+		return m_nDefect;
+
+	CSingleLock MyLock(&m_csDefect);
+	MyLock.Lock();
+
+	if(m_nDefect >= m_maxDefect)
+	{		
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	std::vector<CChipBlob*>::iterator	it;	
+	CChipBlob	*pBlob;		
+	CDefect		*pDefect=NULL;			
+	const int	nDetYPosition = 2;		
+	int			iDefect;
+	int			nMinWidthSize = 2;
+
+	int			nGlassStart = 0;
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pEdgeInfo != NULL)
+		{
+			nGlassStart = pEdgeInfo->nGlassStartLine;
+		}
+	}
+
+	CAMERA_DIR		eCamDir = CAMDIR_NONE;
+	int				nFrameWidth = 0;
+	if(m_pHWRecipe != NULL)
+	{
+		CCameraSettings *pCamera = m_pHWRecipe->GetCameraSettings(iCam,iScan);
+		if(pCamera != NULL)
+		{
+			eCamDir = pCamera->m_enCamDir;
+			nFrameWidth = pCamera->m_FrameSize.cx;
+		}
+	}
+
+	for(iDefect=0;iDefect<nDefectCnt;iDefect++)
+	{		
+		if(m_nDefect >= m_maxDefect)
+			break;
+
+		pBlob = &pBlobStorage[iDefect];
+		if(pBlob == NULL)
+			continue;
+
+		if(pBlob->s_DefectType == DEFTYPE_NODEFECT || pBlob->s_bRemoved == TRUE || pBlob->s_DefectRect.Width() <= nMinWidthSize)
+			continue;	
+
+		pDefect = GetDefect(m_nDefect);
+		if(pDefect == NULL)
+			break;			
+
+		pDefect->Reset();
+
+		pDefect->m_nGlassStartLine = nGlassStart;
+		pDefect->m_nIndex = m_nDefect;		
+		pDefect->m_nCamID = iCam;
+		pDefect->m_nScanIdx = iScan;
+		pDefect->m_DefectLoc = nDefectLoc;		
+		pDefect->m_nSideLoc = (int)emDim;
+		pDefect->m_nCamDir = (int)eCamDir;
+
+		if(nSplineType == 0)
+		{
+			if(bFlip == FALSE)
+				pDefect->m_nSplineLoc = Spline_BotRight;
+			else
+				pDefect->m_nSplineLoc = Spline_BotLeft;
+		}
+		else
+		{
+			if(bFlip == FALSE)
+				pDefect->m_nSplineLoc = Spline_TopRight;
+			else
+				pDefect->m_nSplineLoc = Spline_TopLeft;
+		}
+
+		CopyChipToBlob(pBlob,&pDefect->m_Defect);		
+
+		pDefect->m_Defect.s_DefectRect.OffsetRect(basePos.x,basePos.y);
+		pDefect->m_Defect.s_nDefectY += basePos.y;		
+		pDefect->m_Defect.s_nDefectX += basePos.x;
+
+		if(pDefect->m_Defect.s_DefectRect.left < 0 || pDefect->m_Defect.s_DefectRect.right >= nFrameWidth
+			|| pDefect->m_Defect.s_DefectRect.top < 0)
+			continue;
+
+		if(m_pGrabber->GetSmallImage(iScan,pDefect->m_Image
+			, pDefect->m_Defect.s_nDefectX - DEFECTIMAGE_WIDTH / 2
+			, pDefect->m_Defect.s_nDefectY - DEFECTIMAGE_HEIGHT / 2
+			, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT, FALSE) == FALSE)
+			continue;
+
+		g_pLog->DisplayMessage(_T("%s Spline Defect Loc[%d] Pos[%d,%d]"),PANEL_SIDE[emDim],pDefect->m_nSplineLoc,pDefect->m_Defect.s_nDefectX,pDefect->m_Defect.s_nDefectY-nGlassStart);
+
+		m_nDefect++;		
+	}
+
+	MyLock.Unlock();
+
+	return m_nDefect;
+}
+
+int CDefectControl::ExtractDefect_SpNew(DimensionDir emDim,int iCam,int iScan,DefectLocation eDefect,CvPoint2D32f  ptDefect,int nSplineType,BOOL bFlip,int nDefectArea)
+{
+	CSingleLock MyLock(&m_csDefect);
+	MyLock.Lock();
+
+	if(m_nDefect >= m_maxDefect)
+	{	
+		MyLock.Unlock();
+		return m_nDefect;
+	}	
+
+	CRect		rectDefect;
+	CDefect		*pDefect=NULL;				
+	
+	int			nGlassStart = 0;
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pEdgeInfo != NULL)
+		{
+			nGlassStart = pEdgeInfo->nGlassStartLine;
+		}
+	}
+
+	CAMERA_DIR		eCamDir = CAMDIR_NONE;
+	int				nFrameWidth = 0;
+	if(m_pHWRecipe != NULL)
+	{
+		CCameraSettings *pCamera = m_pHWRecipe->GetCameraSettings(iCam,iScan);
+		if(pCamera != NULL)
+		{
+			eCamDir = pCamera->m_enCamDir;
+			nFrameWidth = pCamera->m_FrameSize.cx;
+		}
+	}
+
+	pDefect = GetDefect(m_nDefect);
+	if(pDefect == NULL)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	pDefect->Reset();
+
+	rectDefect = CRect((int)ptDefect.x,(int)ptDefect.y,(int)ptDefect.x,(int)ptDefect.y);
+	rectDefect.InflateRect(5,5);
+
+	pDefect->m_nGlassStartLine = nGlassStart;
+	pDefect->m_nIndex = m_nDefect;		
+	pDefect->m_nCamID = iCam;
+	pDefect->m_nScanIdx = iScan;
+	pDefect->m_DefectLoc = eDefect;		
+	pDefect->m_nSideLoc = (int)emDim;
+	pDefect->m_nCamDir = (int)eCamDir;	
+
+	pDefect->m_Defect.s_nDefectRScale = rectDefect.Width()*rectDefect.Height();
+
+	pDefect->m_Defect.s_DefectRect = rectDefect;
+	pDefect->m_Defect.s_nDefectX = (int)ptDefect.x;
+	pDefect->m_Defect.s_nDefectY = (int)ptDefect.y;		
+	pDefect->m_Defect.s_nDefectArea = nDefectArea;
+
+	if(nSplineType == 0)
+	{
+		if(bFlip == FALSE)
+			pDefect->m_nSplineLoc = Spline_BotRight;
+		else
+			pDefect->m_nSplineLoc = Spline_BotLeft;
+	}
+	else
+	{
+		if(bFlip == FALSE)
+			pDefect->m_nSplineLoc = Spline_TopRight;
+		else
+			pDefect->m_nSplineLoc = Spline_TopLeft;
+	}	
+
+	if(m_pGrabber->GetSmallImage(iScan,pDefect->m_Image
+		, pDefect->m_Defect.s_nDefectX - DEFECTIMAGE_WIDTH / 2
+		, pDefect->m_Defect.s_nDefectY - DEFECTIMAGE_HEIGHT / 2
+		, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT, FALSE) == FALSE)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}	
+
+	m_nDefect++;		
+
+	MyLock.Unlock();
+	return m_nDefect;
+}
+
+int	CDefectControl::ExtractDefect_Chip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pCBlob,int nDefect,DefectLocation eDefect,int iFrameV)
+{
+	if(m_pGrabber == NULL)
+		return m_nDefect;
+
+	CSingleLock MyLock(&m_csDefect);
+	MyLock.Lock();
+
+	if(m_nDefect >= m_maxDefect)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}	
+
+	CChipBlob	*pBlob;		
+	CDefect		*pDefect=NULL;			
+	const int   nMinWidthSize = 2;	
+
+	int			nGlassStart = 0;
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pEdgeInfo != NULL)
+		{
+			nGlassStart = pEdgeInfo->nGlassStartLine;
+		}
+	}
+
+	CAMERA_DIR		eCamDir = CAMDIR_NONE;
+	int				nFrameWidth = 0;
+	if(m_pHWRecipe != NULL)
+	{
+		CCameraSettings *pCamera = m_pHWRecipe->GetCameraSettings(iCam,iScan);
+		if(pCamera != NULL)
+		{
+			eCamDir = pCamera->m_enCamDir;
+			nFrameWidth = pCamera->m_FrameSize.cx;
+		}
+	}
+
+	for(int iDefect=0;iDefect<nDefect;iDefect++)
+	{		
+		pBlob = &pCBlob[iDefect];
+		if(pBlob == NULL)
+			continue;
+
+		if(m_nDefect >= m_maxDefect)
+			break;
+
+		if(pBlob->s_DefectType == DEFTYPE_NODEFECT || pBlob->s_bRemoved == TRUE)// || pBlob->s_DefectRect.Width() <= nMinWidthSize)
+			continue;			
+
+		pDefect = GetDefect(m_nDefect);
+		if(pDefect == NULL)
+			break;		
+
+		pDefect->Reset();
+
+		switch(pBlob->s_DefectJudgeType)
+		{
+		case INS_DEFECT_CHIP:
+			pDefect->m_DefectLoc = DefectLoc_Chip;
+			break;
+		case INS_DEFECT_BURR:
+			pDefect->m_DefectLoc = DefectLoc_Burr;
+			break;
+		case INS_DEFECT_CRACK:
+			pDefect->m_DefectLoc = DefectLoc_Crack;
+			break;
+		case INS_DEFECT_BROKEN:
+			pDefect->m_DefectLoc = DefectLoc_Broken;
+			break;	
+		default:
+			pDefect->m_DefectLoc = eDefect;
+			break;
+		}		
+
+		pDefect->m_nGlassStartLine = nGlassStart;
+		pDefect->m_nIndex = m_nDefect;		
+		pDefect->m_nCamID = iCam;
+		pDefect->m_nScanIdx = iScan;		
+		pDefect->m_nSideLoc = (int)emDim;
+		pDefect->m_nCamDir = (int)eCamDir;
+
+		CopyChipToBlob(pBlob,&pDefect->m_Defect);		
+
+		pDefect->m_Defect.s_nDefectY += iFrameV;		
+		pDefect->m_Defect.s_nDefectX += 0;
+		pDefect->m_Defect.s_DefectRect.OffsetRect(0,iFrameV);
+
+		if(m_pGrabber->GetSmallImage(iScan,pDefect->m_Image
+			, pDefect->m_Defect.s_nDefectX - DEFECTIMAGE_WIDTH / 2
+			, pDefect->m_Defect.s_nDefectY - DEFECTIMAGE_HEIGHT / 2
+			, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT, FALSE) == FALSE)
+			continue;
+
+		m_nDefect++;		
+	}
+
+	MyLock.Unlock();
+	return m_nDefect;
+}
+
+int CDefectControl::ExtractDefect_KDist(DimensionDir emDim, int iCam, int iScan, DefectLocation eDefect, CvPoint2D32f  ptDefect, CRect rectDefect, int nProfileIndex)
+{
+	if (m_pGrabber == NULL)
+		return m_nDefect;
+
+	CSingleLock MyLock(&m_csDefect);
+	MyLock.Lock();
+
+	if (m_nDefect >= m_maxDefect)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	//Rect    rectDefect;
+	CDefect* pDefect = NULL;
+
+	pDefect = GetDefect(m_nDefect);
+	if (pDefect == NULL)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	pDefect->Reset();
+
+	int nGlassStart = 0;
+
+	if (m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO* pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+		if (pEdgeInfo != NULL)
+		{
+			nGlassStart = pEdgeInfo->nGlassStartLine;
+		}
+	}
+
+	CAMERA_DIR                eCamDir = CAMDIR_NONE;
+	int                                nFrameWidth = 0;
+	if (m_pHWRecipe != NULL)
+	{
+		CCameraSettings* pCamera = m_pHWRecipe->GetCameraSettings(iCam, iScan);
+		if (pCamera != NULL)
+		{
+			eCamDir = pCamera->m_enCamDir;
+			nFrameWidth = pCamera->m_FrameSize.cx;
+		}
+	}
+
+	//rectDefect = CRect((int)ptDefect.x, (int)ptDefect.y, (int)ptDefect.x, (int)ptDefect.y);
+	//rectDefect.InflateRect(25, 25);
+
+	pDefect->m_nGlassStartLine = nGlassStart;
+	pDefect->m_nIndex = m_nDefect;
+	pDefect->m_nCamID = iCam;
+	pDefect->m_nScanIdx = iScan;
+	pDefect->m_DefectLoc = eDefect;
+	pDefect->m_nSideLoc = (int)emDim;
+	pDefect->m_nCamDir = (int)eCamDir;
+	pDefect->m_nProfileIndex = nProfileIndex;
+
+	pDefect->m_Defect.s_nDefectRScale = rectDefect.Width() * rectDefect.Height();
+
+	pDefect->m_Defect.s_DefectRect = rectDefect;
+	pDefect->m_Defect.s_nDefectX = (int)ptDefect.x;
+	pDefect->m_Defect.s_nDefectY = (int)ptDefect.y;
+
+	if (pDefect->m_Defect.s_DefectRect.left < 0 || pDefect->m_Defect.s_DefectRect.right >= nFrameWidth
+		|| pDefect->m_Defect.s_DefectRect.top < 0)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	if (m_pGrabber->GetSmallImage(iScan, pDefect->m_Image
+		, pDefect->m_Defect.s_nDefectX - DEFECTIMAGE_WIDTH / 2
+		, pDefect->m_Defect.s_nDefectY - DEFECTIMAGE_HEIGHT / 2
+		, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT, FALSE) == FALSE)
+	{
+		MyLock.Unlock();
+		return m_nDefect;
+	}
+
+	m_nDefect++;
+	MyLock.Unlock();
+	return m_nDefect;
+}
+
+void CDefectControl::CopyChipToBlob(CChipBlob *pChip,CDefectBlob *pBlob)
+{
+	pBlob->s_DefectPair		= (DefectPair)pChip->s_DefectPair;
+	pBlob->s_DefectType		= (DefectType)pChip->s_DefectType;
+	pBlob->s_nIndex			= pChip->s_nIndex;
+	pBlob->s_nDefectArea		= pChip->s_nDefectArea;
+	pBlob->s_nDefectX			= pChip->s_nDefectX;
+	pBlob->s_nDefectY			= pChip->s_nDefectY;
+	pBlob->s_nDefectRScale		= pChip->s_nDefectRScale;
+	pBlob->s_DefectRect		= pChip->s_DefectRect;
+	pBlob->s_sDefectPeak		= pChip->s_sDefectPeak;
+
+	pBlob->s_sLevelSrcMin		= pChip->s_sLevelSrcMin;
+	pBlob->s_sLevelSrcMax		= pChip->s_sLevelSrcMax;
+	pBlob->s_xLevelSrcMax		= pChip->s_xLevelSrcMax;
+	pBlob->s_yLevelSrcMax		= pChip->s_yLevelSrcMax;
+	pBlob->s_sLevelSrcAvg		= pChip->s_sLevelSrcAvg;
+	pBlob->s_sLevelRefMin		= pChip->s_sLevelRefMin;
+	pBlob->s_sLevelRefMax		= pChip->s_sLevelRefMax;
+	pBlob->s_sLevelRefAvg		= pChip->s_sLevelRefAvg;
+	pBlob->s_sLevelDiffMin		= pChip->s_sLevelDiffMin;
+	pBlob->s_sLevelDiffMax		= pChip->s_sLevelDiffMax;
+	pBlob->s_sLevelDiffAvg		= pChip->s_sLevelDiffAvg;
+	pBlob->s_nLevelSrcSum		= pChip->s_nLevelSrcSum;
+	pBlob->s_nLevelRefSum		= pChip->s_nLevelRefSum;
+	pBlob->s_nLevelDiffSum		= pChip->s_nLevelDiffSum;
+
+	pBlob->s_sThreshold		= pChip->s_sThreshold;
+
+	int i;
+#define MOSIS_EDIT_VERTEX
+	for(i= 0; i< 8; i++)
+	{
+		pBlob->s_ptVertex[i]= pChip->s_ptVertex[i];
+	}	
+	pBlob->s_bRemoved			= pChip->s_bRemoved;
+}
\ No newline at end of file
diff --git a/ENRIT/Data/DefectStorage.h b/ENRIT/Data/DefectStorage.h
new file mode 100644
index 0000000..5281bf2
--- /dev/null
+++ b/ENRIT/Data/DefectStorage.h
@@ -0,0 +1,124 @@
+#pragma once
+
+#include "Global_Define.h"
+#include "GlassRecipe.h"
+
+#define		DEFECTIMAGE_WIDTH		1024
+#define		DEFECTIMAGE_HEIGHT		500
+
+enum DefectLocation		{ DefectLoc_Crack, DefectLoc_Broken, DefectLoc_Chip, DefectLoc_Chamfer, DefectLoc_Burr, DefectLoc_Thin, DefectLoc_Air, DefectLoc_Notch, DefectLoc_Hole, DefectLoc_Profile, DefectLoc_KDist, DefectLoc_RCUTChip };
+enum SplineLocation		{ Spline_BotRight=0,Spline_BotLeft,Spline_TopRight,Spline_TopLeft,Spline_None };
+
+class CBlobStorage;
+class CSISBuffer;
+class CConvParam;
+class CAssemControl;
+class CGrabberControl;
+class CGlass_Data;
+class CHardwareSettings;
+
+class CDefect  
+{
+public:	
+	int				m_nIndex;
+	int				m_iFrameIdx;
+	int				m_nCamID;
+	int				m_nScanIdx;	
+	int				m_nGlassStartLine;
+	SplineLocation	m_nSplineLoc;
+	CDefectBlob		m_Defect;
+	DefectLocation	m_DefectLoc;		
+	int				m_nSideLoc;
+	int				m_nCamDir;
+	BYTE			m_Image[DEFECTIMAGE_WIDTH * DEFECTIMAGE_HEIGHT + 1];
+	BOOL			m_bRemoved;
+	BOOL			m_bThinCrackDefect;
+	int				m_nReduceSize;
+	int				m_nProfileIndex;
+
+	CDefect()
+	{
+		Reset();
+	}
+	virtual ~CDefect()
+	{
+
+	}
+	void Reset()
+	{		
+		m_nProfileIndex		= -1;
+		m_bThinCrackDefect	= FALSE;
+		m_bRemoved			= FALSE;
+		m_nIndex			= -1;
+		m_nScanIdx			= -1;		
+		m_nGlassStartLine	= -1;
+		m_nCamID			= -1;
+		m_nSplineLoc		= Spline_None;
+		m_Defect.Reset();
+		m_DefectLoc			= DefectLoc_Crack;		
+		m_nReduceSize		= 0;
+		m_nSideLoc			= 0;
+		m_nCamDir			= -1;
+		ZeroMemory(m_Image, DEFECTIMAGE_WIDTH * DEFECTIMAGE_HEIGHT + 1);		
+	}
+};
+
+class CDefectStorage
+{
+protected:
+	CCriticalSection	m_csDefect;
+
+protected:
+	int				m_nDefect;
+	CDefect			*m_pDefect;
+
+	int				m_maxDefect;
+	int				m_nDefectSpace;
+
+public:
+	int		InitDefectStorage(int maxDefect= 1000);
+	int		IncreaseDefectCount(){++m_nDefect; return m_nDefect;}
+	void	ResetDefectStorage()	;
+	int		GetDefectCount() {return m_nDefect;}
+	CDefect* GetDefect(int i= 0){return m_pDefect+ i;}
+
+public:
+	CDefectStorage(void);
+	virtual ~CDefectStorage(void);
+
+	void	CheckDefectRect(CPoint* pVertex, CRect* pRect, int nX, int nY);
+
+	int		StopInspection(CAssemControl *pAssemControl);
+	void	SetBlobDefect(int i);
+};
+
+class CDefectControl : public CDefectStorage
+{
+public:// Defect 傈价何 眠啊.
+	CDefectControl();
+	virtual ~CDefectControl();
+	
+	void		SetGrabber(CGrabberControl *pGrabber){m_pGrabber=pGrabber;}
+	void		SetGlassData(CGlass_Data *pGlassData){m_pGlassData=pGlassData;}
+	void		SetHWRecipe(CHardwareSettings *pHW){m_pHWRecipe=pHW;}
+	int			ExtractDefect_SpNew(DimensionDir emDim,int iCam,int iScan,DefectLocation eDefect,CvPoint2D32f  ptDefect,int nSplineType,BOOL bFlip,int nDefectArea);
+	int			ExtractDefect_Chip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pCBlob,int nDefect,DefectLocation eDefect,int iFrameV);
+	int			ExtractDefect_SplineChip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pBlobStorage,int nDefectCnt,DefectLocation nDefectLoc,CPoint basePos,int nSplineType,BOOL bFlip,int nChipW,int nChipH,EM_CHIPPING_COMP eComp);		
+	int			ExtractDefect_NotchChip(DimensionDir emDim,int iCam,int iScan,CChipBlob *pBlobStorage,int nDefectCount,DefectLocation nDefectLoc,CRect rectIns);
+	int			ExtractDefect_Hole(DimensionDir emDim,int iCam,int iScan,std::vector<CRect> &vecList,int nDefectCount,DefectLocation nDefectLoc,CRect rectIns);
+	int			ExtractDefect_ProfileChamfer(DimensionDir emDim,int iCam,int iScan,DefectLocation nDefectLoc,CvPoint2D32f  ptDefect,int nProfileIndex);
+	int         ExtractDefect_KDist(DimensionDir emDim, int iCam, int iScan, DefectLocation eDefect, CvPoint2D32f  ptDefect, CRect rectDefect, int nProfileIndex); //2024.6.12
+
+	void		ResetDefectControl();		
+	int			CheckDefectCount();	
+	int			IncreaseDefectCount(){++m_nDefect; return m_nDefect;}
+
+protected:
+	void		CopyChipToBlob(CChipBlob *pChip,CDefectBlob *pBlob);	
+
+protected:
+	CGrabberControl	*m_pGrabber;
+	CGlass_Data			*m_pGlassData;
+	CHardwareSettings	*m_pHWRecipe;
+
+};
\ No newline at end of file
diff --git a/ENRIT/Data/Glass_Data.cpp b/ENRIT/Data/Glass_Data.cpp
new file mode 100644
index 0000000..196a7f8
--- /dev/null
+++ b/ENRIT/Data/Glass_Data.cpp
@@ -0,0 +1,358 @@
+// Glass.cpp: implementation of the CGlass class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "Glass_Data.h"
+#include <math.h>
+
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CGlass_Data::CGlass_Data(void)
+{	
+	m_pGlassRecipe = NULL;
+	m_pHardwareSetting = NULL;
+
+	InitializeCriticalSection(&m_csGlassDefect);	
+
+	ResetGlass();
+}
+
+CGlass_Data::~CGlass_Data()
+{
+	DeleteCriticalSection(&m_csGlassDefect);
+
+	ResetDefect();
+}
+
+void CGlass_Data::ResetDefect()
+{
+	CInspectDefect* pData;
+	for (MapDefectIt it = m_MapDefect.begin(); it != m_MapDefect.end(); it++)
+	{
+		pData = static_cast<CInspectDefect*>(it->second);
+		delete pData;
+	}
+	m_MapDefect.clear();
+	m_nCurDefectIdx = 0;
+	m_nJudgeDefectCount = 0;
+	LeaveCriticalSection(&m_csGlassDefect);
+}
+
+void CGlass_Data::ResetGlass()
+{
+	ResetDefect();	
+
+	m_strLoadingTime			= _T("");
+	m_strUnloadingTime			= _T("");
+	m_strScanStartTime			= _T("");
+	m_strScanEndTime			= _T("");		
+	m_bPostProcessing			= FALSE;
+
+	ZeroMemory(m_EdgeResultInfo,sizeof(INS_EDGE_RESULT_INFO)*MAX_DIMENSION_COUNT);
+	m_stProfileResult.Reset();
+	ZeroMemory(m_nGlassResult,sizeof(short)*5);	
+	m_ProfileInspectData.Reset();
+
+	ZeroMemory(m_nStageLongTheta,sizeof(short)*2);
+	ZeroMemory(m_nStageShortTheta,sizeof(short)*2);
+	ZeroMemory(m_bScanEnd,sizeof(m_bScanEnd));
+	m_bScanStart = FALSE;
+	m_nStartCount = 0;
+	ZeroMemory(m_bScanEndCamera,sizeof(m_bScanEndCamera));
+
+	m_bOnly_Profile_NG = TRUE;
+	for(int i=0; i<MAX_DIMENSION_COUNT; i++)
+	{
+		m_nSide_Profile_NG_Count[i] = 0;
+		m_nSide_Profile_NG_Max_Diff[i] = INT_MIN;
+	}
+}
+
+void CGlass_Data::SetScanStart(BOOL bStart)
+{
+	m_bScanStart = bStart;
+}
+
+void CGlass_Data::SetScanEnd(int nScanIdx,BOOL bIsEnd)
+{
+	m_bScanEnd[nScanIdx] = bIsEnd;
+}
+
+BOOL CGlass_Data::GetScanEnd(int nScanIdx)
+{
+	return m_bScanEnd[nScanIdx];
+}
+
+int CGlass_Data::GetScanEndCameraCount()
+{
+	int			nCount = 0;
+
+	CSingleLock		sLock(&m_csInsEnd);
+	sLock.Lock();
+	for(int iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+	{
+		for(int iScan=0;iScan<MAX_SCAN_COUNT;iScan++)
+		{
+			if(m_bScanEndCamera[iCam][iScan] == TRUE)
+				nCount++;
+		}
+	}
+	sLock.Unlock();
+
+	return nCount;
+}
+
+void CGlass_Data::SetScanEndCamera(int iCam,int iScan)
+{
+	CSingleLock		sLock(&m_csInsEnd);
+	sLock.Lock();
+	m_bScanEndCamera[iCam][iScan] = TRUE;
+	sLock.Unlock();
+}
+
+BOOL CGlass_Data::GetInsUseCheck(EM_INS_TYPE emIns)
+{
+	BOOL		bUse = FALSE;
+	CGlassRecipe	*pGlsRcp = GetGlassRecipe();
+	CINSPECT_INFO_PARM	*pInsPrm = &pGlsRcp->m_InspectInfoParm;
+	if(pInsPrm == NULL)
+		return bUse;
+
+	switch(emIns)
+	{
+	case EM_INS_EDGE:
+		bUse = pInsPrm->GetCutAreaUse(DIMENSION_NONE);
+		break;
+	case EM_INS_CORNER:
+		
+		break;
+	case EM_INS_DIMENSION:
+		bUse = pInsPrm->GetDimenUse(DIMENSION_NONE);
+		break;
+	case EM_INS_SPLINE:
+		bUse = pInsPrm->GetSplineUse(DIMENSION_NONE);
+		break;
+	case EM_INS_NOTCH:
+		bUse = pInsPrm->GetNotchSizeUse(DIMENSION_NONE);
+		break;
+	case EM_INS_SPLINE_POINT_JUDGE:
+		bUse = pInsPrm->GetSplineUsePointJudge(-1);
+		break;
+	}
+
+	return bUse;
+}
+
+CInspectDefect* CGlass_Data::GetDefect(int nDefecIdx)
+{
+	CInspectDefect	*pDefect = NULL;
+
+	for(MapDefectIt it=m_MapDefect.begin();it!=m_MapDefect.end();it++)
+	{
+		pDefect = static_cast<CInspectDefect*>(it->second);
+		if(pDefect != NULL && pDefect->m_nGlassDefectIdx == nDefecIdx)
+		{
+			return pDefect;
+		}
+	}
+
+	return NULL;
+}
+
+BOOL CGlass_Data::SetDefect(CInspectDefect* pDefect)
+{
+	EnterCriticalSection(&m_csGlassDefect);
+
+	if (!pDefect)
+	{
+		LeaveCriticalSection(&m_csGlassDefect);
+		return FALSE;
+	}
+	
+	pDefect->m_nGlassDefectIdx = m_nCurDefectIdx;
+	m_MapDefect.insert(std::make_pair(pDefect->m_nUMOriginX, pDefect));
+	m_nCurDefectIdx++;
+
+	if(pDefect->m_bJudgeDefect == TRUE)
+		m_nJudgeDefectCount++;
+
+	// 22.06.30 - PROFILE NG COUNTING..
+	if(pDefect->m_bJudgeDefect == TRUE && pDefect->m_sDefectLoc == DefectLoc_Profile)
+	{
+		int nSideIdx = pDefect->m_nSideLoc;
+		int nProfileIdx = pDefect->m_nProfileIdx;
+
+		if(0<=nSideIdx && nSideIdx < MAX_DIMENSION_COUNT)
+		{
+			m_nSide_Profile_NG_Count[nSideIdx]++;
+
+			int nProfileIdx = pDefect->m_nProfileIdx;
+
+			if(0 <=  nProfileIdx && nProfileIdx < MAX_PROFILE_SETTING_COUNT)
+			{
+				int nAbsDiff = abs(m_ProfileInspectData.ProfileData[nProfileIdx].nProfileDiff);
+
+				if(m_nSide_Profile_NG_Max_Diff[nSideIdx] < nAbsDiff)
+					m_nSide_Profile_NG_Max_Diff[nSideIdx] = nAbsDiff;
+			}
+		}
+	}
+
+	if(pDefect->m_bJudgeDefect == TRUE && pDefect->m_sDefectLoc != DefectLoc_Profile)
+		m_bOnly_Profile_NG = FALSE;
+
+	LeaveCriticalSection(&m_csGlassDefect);
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Scan
+void CGlass_Data::SetLoadingTime()
+{
+	CTime	time = CTime::GetCurrentTime();
+	m_strLoadingTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
+	m_strLoadingDayFileName.Format(_T("%04d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay());
+	m_strLoadingTimeFileName.Format(_T("%02d%02d%02d"),time.GetHour(),time.GetMinute(),time.GetSecond());
+	
+}
+
+void CGlass_Data::SetUnloadingTime()
+{
+	CTime	time = CTime::GetCurrentTime();
+	m_strUnloadingTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
+}
+
+void CGlass_Data::SetScanStartTime()
+{
+	CTime	time = CTime::GetCurrentTime();
+	m_strScanStartTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
+}
+
+void CGlass_Data::SetScanEndTime()
+{
+	CTime	time = CTime::GetCurrentTime();
+	m_strScanEndTime.Format(_T("%04d%02d%02d_%02d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
+	m_strScanEndTimeFileName.Format(_T("%04d_%02d_%02d"),time.GetYear(),time.GetMonth(),time.GetDay());
+	
+}
+
+
+UINT	eProfileIndex[] = {PROFILE_INSPECT_INDEX_A,PROFILE_INSPECT_INDEX_B,PROFILE_INSPECT_INDEX_C,PROFILE_INSPECT_INDEX_D,PROFILE_INSPECT_INDEX_CF};
+TCHAR	*strProfileString[] = {_T("A"),_T("B"),_T("C"),_T("D"),_T("A")};
+UINT	eProfileRCutIndex[] = {PROFILE_RCUT_INSPECT_INDEX_A,PROFILE_RCUT_INSPECT_INDEX_D,PROFILE_RCUT_INSPECT_INDEX_B,PROFILE_RCUT_INSPECT_INDEX_C};
+TCHAR	*strProfileRCutString[] = {_T("RA"),_T("RB"),_T("RC"),_T("RD")};
+UINT	eProfileSize[] = {PROFILE_INSPECT_SIZE_A_C,PROFILE_INSPECT_SIZE_B_D};
+#define MAX_RCUT_PROFILE_COUNT 5
+
+BOOL CGlass_Data::GetProfileInspectIndex(int iSide,int &nIndex,int &nSize,CString &str)
+{
+	nIndex = nSize = -1;
+	
+	if(iSide < 0 || iSide >=MAX_DIMENSION_COUNT)
+		return FALSE;
+
+	nIndex = eProfileIndex[iSide%MAX_PANEL_SIDE];
+	str = strProfileString[iSide%MAX_PANEL_SIDE];
+
+	if(iSide%2 == 0)
+		nSize = eProfileSize[0];
+	else
+		nSize = eProfileSize[1];
+
+	return TRUE;
+}
+
+BOOL CGlass_Data::GetProfileRCutInspectIndex(int iSide,int &nIndex,int &nSize,CString &str)
+{
+	nIndex = nSize = -1;
+
+	if(iSide < 0 || iSide >=MAX_DIMENSION_COUNT)
+		return FALSE;
+
+	nIndex = eProfileRCutIndex[iSide];
+	str = strProfileRCutString[iSide];
+	nSize = MAX_RCUT_PROFILE_COUNT;	
+
+	return TRUE;
+}
+
+void CGlass_Data::GetStageTheta(int iStage,short &nLongTheta,short &nShortTheta)
+{
+	nLongTheta = m_nStageLongTheta[iStage];
+	nShortTheta = m_nStageShortTheta[iStage];
+}
+
+void CGlass_Data::SetStageTheta(int iStage,BOOL bLong,short nTheta)
+{
+	if(iStage < 0 || iStage > 1)
+	{
+		g_pLog->DisplayMessage(_T("Stage Theta Index Not Normal : %d"),iStage);
+		return;
+	}
+
+	if(bLong == TRUE)
+	{
+		m_nStageLongTheta[iStage] = nTheta;
+	}
+	else
+	{
+		m_nStageShortTheta[iStage] = nTheta;
+	}
+}
+
+void CGlass_Data::SetProfileChamferInspectData(int nIndex,int nUp,CHAMFER_RESULT *pChamferResult)
+{
+	if(nIndex < 0 || nIndex >= MAX_PROFILE_SETTING_COUNT)
+		return;
+	if(nUp < 0 || nUp > 1)
+		return;
+
+	CSingleLock		cLock(&m_csProfileData);
+	cLock.Lock();
+
+	PROFILECHAMFER_RESULT_DATA	*pProfile =	GetProfileInspectData();
+
+	CopyMemory(&pProfile->ResultChamfer[nIndex][nUp],pChamferResult,sizeof(CHAMFER_RESULT));
+
+	cLock.Unlock();
+}
+
+void CGlass_Data::SetProfileInspectData(int nIndex,PROFILE_RESULT *pProfileResult)
+{
+	if(nIndex < 0 || nIndex >= MAX_PROFILE_SETTING_COUNT)
+		return;
+
+	CSingleLock		cLock(&m_csProfileData);
+	cLock.Lock();
+
+	PROFILECHAMFER_RESULT_DATA	*pProfile =	GetProfileInspectData();
+
+	CopyMemory(&pProfile->ProfileData[nIndex],pProfileResult,sizeof(PROFILE_RESULT));
+	
+	cLock.Unlock();
+}
+
+void CGlass_Data::SetRCutProfileInspectData(int nIndex,PROFILE_RCUT_PROCESSDATA *pProfileResult)
+{
+	if(nIndex < 0 || nIndex >= MAX_PROFILE_SETTING_COUNT)
+		return;
+
+	CSingleLock		cLock(&m_csProfileData);
+	cLock.Lock();
+
+	PROFILECHAMFER_RESULT_DATA	*pProfile =	GetProfileInspectData();
+
+	CopyMemory(&pProfile->RCutProcessData[nIndex],pProfileResult,sizeof(PROFILE_RCUT_PROCESSDATA));
+
+	cLock.Unlock();
+}
\ No newline at end of file
diff --git a/ENRIT/Data/Glass_Data.h b/ENRIT/Data/Glass_Data.h
new file mode 100644
index 0000000..132da52
--- /dev/null
+++ b/ENRIT/Data/Glass_Data.h
@@ -0,0 +1,392 @@
+// Glass.h: interface for the CGlass class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include <vector>
+#include "DefectStorage.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "InspectDefect.h"
+
+typedef struct _JUDGE_CUTAREA
+{
+	int					nScanIdx;	
+	double				dThick;
+	double				dyCoordi;
+	CAMERA_DIR			enCamDir;
+	DimensionDir		enDir;
+
+	_JUDGE_CUTAREA()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		nScanIdx = 0;		
+		dThick = dyCoordi = 0.;
+		enCamDir = CAMDIR_NONE;
+	}
+} JUDGE_CUTAREA, *pJUDGE_CUTAREA;
+
+typedef struct _JUDGE_SPLINE
+{
+	int			iType;
+	int			nDetRange;
+	BOOL		bUp;
+	double		dAvg;
+	double		dMax;
+	double		dRangeVal[5];
+
+	_JUDGE_SPLINE()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		iType = -1;
+		nDetRange = 0;
+		bUp = TRUE;
+		dAvg = dMax = 0;
+		ZeroMemory(dRangeVal,sizeof(double)*5);
+	}
+} JUDGE_SPLINE, *pJUDGE_SPLINE;
+
+typedef struct _JUDGE_NOTCH
+{
+	CAMERA_DIR		Camdir;
+	DimensionDir	enDir;
+	double		dAvg;
+	double		dMax;
+	int			nDetRange;
+	double		dRangeVal[5];
+	double		dAvgThick;
+	BOOL		bAvgThick;
+	int			nNotchDx;
+	int			nNotchDy;
+
+	_JUDGE_NOTCH()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		Camdir = CAMDIR_NONE;
+		enDir = DIMENSION_NONE;
+		nDetRange = 0;
+		dAvg = dMax = dAvgThick = 0;
+		ZeroMemory(dRangeVal,sizeof(double)*5);
+		bAvgThick = FALSE;
+		nNotchDx = nNotchDy = 0;
+	}
+} JUDGE_NOTCH, *pJUDGE_NOTCH;
+
+typedef struct _JUDGE_DIMENSION
+{	
+	CAMERA_DIR			Camdir;
+	DimensionDir		enDir;
+	double				dSize;
+	double				dXPos,dYPos;
+
+	_JUDGE_DIMENSION()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		Camdir = CAMDIR_NONE;
+		enDir = DIMENSION_NONE;
+		dSize = dXPos = dYPos = 0.;
+	}
+} JUDGE_DIMENSION, *pJUDGE_DIMENSION;
+
+typedef struct _INS_PROFILE_RESULT_INFO
+{		
+	short					nProfileData[MAX_PROFILE_SETTING_COUNT];
+	short					nChamferUp[MAX_PROFILE_SETTING_COUNT];
+	short					nChamferDn[MAX_PROFILE_SETTING_COUNT];
+
+	_INS_PROFILE_RESULT_INFO()
+	{
+		Reset();
+	}
+	void Reset()
+	{		
+		ZeroMemory(nProfileData,sizeof(short)*MAX_PROFILE_SETTING_COUNT);
+		ZeroMemory(nChamferUp,sizeof(short)*MAX_PROFILE_SETTING_COUNT);
+		ZeroMemory(nChamferDn,sizeof(short)*MAX_PROFILE_SETTING_COUNT);
+	}
+} INS_PROFILE_RESULT_INFO, *pINS_PROFILE_RESULT_INFO;
+
+typedef struct _CHAMFER_RESULT
+{		
+	int				iIndex;
+	int				iCam;
+	int				iScan;
+	int				iSide;
+	int				iFrame;
+	int				nUp;
+	BOOL			bChamferJudge;	
+	int				nGlassLeft;
+	int				nGlassRight;
+	int				nChamferThick;		
+	int				nChamferCalThick;
+	BOOL			bUseJudge;
+	int				nJudgeReference;
+	int				nJudgePlusChamfer;
+	int				nJudgeMinusChamfer;	
+	CvPoint2D32f	ptFull;
+	CvPoint2D32f	ptChamferLine;
+	CvPoint2D32f	ptCADLine;
+	CvPoint2D32f	ptGlassLine;
+
+	_CHAMFER_RESULT()
+	{
+		Reset();
+	}
+	void Reset()
+	{		
+		iIndex = iCam = iScan = iSide = iFrame = nUp = 0;
+		bChamferJudge = TRUE;		
+		nGlassLeft = nGlassRight = nChamferThick = nChamferCalThick = 0;	
+		bUseJudge = TRUE;
+		nJudgeReference = nJudgePlusChamfer = nJudgeMinusChamfer = 0;
+		ptChamferLine.x = ptChamferLine.y = ptCADLine.x = ptCADLine.y = 0;	
+		ptFull.x = ptFull.y = 0;
+		ptGlassLine.x = ptGlassLine.y= 0;	
+	}
+} CHAMFER_RESULT, *pCHAMFER_RESULT;
+
+typedef struct _PROFILE_RESULT
+{	
+	int				iIndex;
+	int				iCam;
+	int				iScan;
+	int				iSide;
+	int				iFrame;
+	BOOL			bProfileJudge;
+	int				nProfileDiff;
+	BOOL			bUseJudge;	
+	int				nJudgePlus;
+	int				nJudgeMinus;	
+	CvPoint2D32f			ptFullImg;
+	CvPoint2D32f			ptGlassLine;
+	CvPoint2D32f			ptGlassAlign;
+	CvPoint2D32f			ptGlassStart;		
+
+	_PROFILE_RESULT()
+	{
+		Reset();
+	}
+	void Reset()
+	{		
+		bProfileJudge = TRUE;
+		bUseJudge = TRUE;
+		iIndex = iCam = iScan = iSide = iFrame = 0;
+		nProfileDiff = 0;
+		nJudgePlus = nJudgeMinus = 0;
+		ptFullImg.x = ptFullImg.y = ptGlassLine.x = ptGlassLine.y = 0;	
+		ptGlassAlign.x = ptGlassAlign.y = ptGlassStart.x = ptGlassStart.y = 0;					
+	}
+} PROFILE_RESULT, *pPROFILE_RESULT;
+
+typedef struct _PROFILE_RCUT_PROCESSDATA
+{	
+	int				iIndex;
+	int				iCam;
+	int				iScan;
+	int				iSide;
+	int				iFrame;
+	double			dCenterX;
+	double			dCenterY;
+	double			dCADLineX;
+	double			dCADLineY;
+	double			dRadius;
+	double			dPixelRadius;
+	CvPoint2D32f			ptGlass;
+	CvPoint2D32f			ptChamfer;
+
+
+	_PROFILE_RCUT_PROCESSDATA()
+	{
+		Reset();
+	}
+	void Reset()
+	{			
+		iIndex = iCam = iScan = iSide = iFrame = 0;
+		dCenterX = dCenterY = dCADLineX = dCADLineY = dRadius = dPixelRadius = 0;
+		ptGlass.x = ptGlass.y = ptChamfer.x = ptChamfer.y = 0;		
+		
+	}
+} PROFILE_RCUT_PROCESSDATA, *pPROFILE_RCUT_PROCESSDATA;
+
+typedef struct _PROFILECHAMFER_RESULT_DATA
+{		
+	PROFILE_RESULT				ProfileData[MAX_PROFILE_SETTING_COUNT];
+	CHAMFER_RESULT				ResultChamfer[MAX_PROFILE_SETTING_COUNT][2];
+	PROFILE_RCUT_PROCESSDATA	RCutProcessData[MAX_PROFILE_SETTING_COUNT];
+
+	_PROFILECHAMFER_RESULT_DATA()
+	{
+		Reset();
+	}
+	void Reset()
+	{		
+		ZeroMemory(ProfileData,sizeof(PROFILE_RESULT)*MAX_PROFILE_SETTING_COUNT);	
+		ZeroMemory(RCutProcessData,sizeof(PROFILE_RCUT_PROCESSDATA)*MAX_PROFILE_SETTING_COUNT);
+		ZeroMemory(ResultChamfer,sizeof(CHAMFER_RESULT)*MAX_PROFILE_SETTING_COUNT*2);
+	}
+} PROFILECHAMFER_RESULT_DATA, *pPROFILECHAMFER_RESULT_DATA;
+
+typedef struct _INS_EDGE_RESULT_INFO
+{	
+	int						nGlassEdgeXPos[2];				// Glass X pos
+	int						nGlassStartLine;						// CELL 矫累
+	int						nGlassStartFrame;
+	int						nGlassEndLine;						// CELL 场
+	int						nGlassEndFrame;
+	int						nPreGlassEndLine;						// CELL 场
+	int						nPreGlassEndFrame;
+
+	BOOL					bSpline[2];
+	BOOL					bMark[MAX_MARKER_COUNT];					// 付农 茫扁 己傍咯何
+	CvPoint2D32f			ptMark[MAX_MARKER_COUNT];					// 付农 困摹
+	CRect					rtMark[MAX_MARKER_COUNT];					// 付农 茫绰 困摹
+
+	CRect					rtChamfer;
+
+	short					nCompRefFrame[MAX_IMAGE_FRAME];
+	short					nGrindframe[3][MAX_IMAGE_FRAME];			// 楷付 LINE
+	short					nGrindData[MAX_IMAGE_FRAME];				// 角力 楷付樊	
+	int						nMarkToEdge_X[MAX_MARKER_COUNT];	
+	int						nMarkToEdge_Y[MAX_MARKER_COUNT];	
+	CRect					rcCorner[MAX_MARKER_COUNT];		
+
+	_INS_EDGE_RESULT_INFO()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		ZeroMemory(bSpline,sizeof(BOOL)*2);
+		ZeroMemory(bMark,sizeof(BOOL)*MAX_MARKER_COUNT);
+		ZeroMemory(ptMark,sizeof(CvPoint2D32f)*MAX_MARKER_COUNT);
+		ZeroMemory(rtMark,sizeof(CRect)*MAX_MARKER_COUNT);
+		nGlassStartLine = nGlassEndLine = nPreGlassEndLine = nPreGlassEndFrame = nGlassEndFrame = nGlassStartFrame = -1;
+		ZeroMemory(nCompRefFrame,sizeof(short)*MAX_IMAGE_FRAME);
+		ZeroMemory(nGrindframe,sizeof(short)*MAX_IMAGE_FRAME*3);
+		ZeroMemory(nGrindData,sizeof(short)*MAX_IMAGE_FRAME);
+		ZeroMemory(rcCorner,sizeof(CRect)*MAX_MARKER_COUNT);
+		ZeroMemory(nMarkToEdge_X,sizeof(int)*MAX_MARKER_COUNT);
+		ZeroMemory(nMarkToEdge_Y,sizeof(int)*MAX_MARKER_COUNT);	
+		ZeroMemory(nGlassEdgeXPos,sizeof(nGlassEdgeXPos));	
+		rtChamfer = CRect(0,0,0,0);		
+	}
+} INS_EDGE_RESULT_INFO, *pINS_EDGE_RESULT_INFO;
+
+class CGlass_Data
+{
+public:	
+	CGlass_Data(void);
+	virtual ~CGlass_Data();
+
+	void					ResetGlass();	
+	void					ResetDefect();
+	BOOL					SetDefect(CInspectDefect* pDefect);
+	CInspectDefect*			GetDefect(int nDefecIdx);
+	MapDefect*				GetMapDefect()			{ return &m_MapDefect; }
+	int						GetTotalDefectCount()	{ return m_nCurDefectIdx;}
+	int						GetJudgeDefectCount() { return m_nJudgeDefectCount;}
+	
+	//////////////////////////////////////////////////////////////////////////
+	// Glass Data
+	BOOL					SetHardwareRecipe(CHardwareSettings *pHardware){m_pHardwareSetting = pHardware;}	
+	void					SetGlassRecipe(CGlassRecipe *pRecipe){m_pGlassRecipe=pRecipe;}
+	CGlassRecipe*			GetGlassRecipe()		{ return m_pGlassRecipe; }
+	CHardwareSettings*		GetHardwareRecipe()		{ return m_pHardwareSetting;}
+	CINSPECT_INFO_PARM*		GetInsRecipe()			{ return &GetGlassRecipe()->m_InspectInfoParm;}
+
+	BOOL					GetInsUseCheck(EM_INS_TYPE emIns);	
+
+	void					SetLoadingTime();
+	void					SetUnloadingTime();
+	void					SetScanStartTime();
+	void					SetScanEndTime();	
+	CString					GetLoadingTime()		{ return m_strLoadingTime; }
+	CString					GetUnloadingTime()		{ return m_strUnloadingTime; }
+	CString					GetScanStartTime()		{ return m_strScanStartTime; }
+	CString					GetScanEndTime()		{ return m_strScanEndTime; }		
+	CString					GetScanEndTimeFileName(){ return m_strScanEndTimeFileName; }		
+	CString					GetLoadingTimeFileName(){ return m_strLoadingTimeFileName; }		
+	CString					GetLoadingDayFileName(){ return m_strLoadingDayFileName; }
+	
+	INS_EDGE_RESULT_INFO	*GetEdgeResultInfo(DimensionDir eDim){return &m_EdgeResultInfo[eDim];}
+	INS_PROFILE_RESULT_INFO	*GetProfileResultInfo(){return &m_stProfileResult;}
+	short					*GetGlassResultInfo(){return m_nGlassResult;}
+	PROFILECHAMFER_RESULT_DATA	*GetProfileInspectData(){return &m_ProfileInspectData;}	
+	void					SetProfileChamferInspectData(int nIndex,int nUp,CHAMFER_RESULT *pChamferResult);
+	void					SetProfileInspectData(int nIndex,PROFILE_RESULT *pProfileResult);
+	void					SetRCutProfileInspectData(int nIndex,PROFILE_RCUT_PROCESSDATA *pProfileResult);
+	BOOL					GetProfileInspectIndex(int iSide,int &nIndex,int &nSize,CString &str);
+	BOOL					GetProfileRCutInspectIndex(int iSide,int &nIndex,int &nSize,CString &str);
+
+	void					GetStageTheta(int iStage,short &nLongTheta,short &nShortTheta);
+	void					SetStageTheta(int iStage,BOOL bLong,short nTheta);
+
+	BOOL					IsPostProcStart()		{return m_bPostProcessing;}
+	void					SetPostProc(BOOL bSet)	{m_bPostProcessing = bSet;}
+
+	void					SetScanStart(BOOL bStart);
+	BOOL					GetScanStart(){return m_bScanStart;}
+	void					SetScanEnd(int nScanIdx,BOOL bIsEnd);
+	BOOL					GetScanEnd(int nScanIdx);
+	void					SetScanStartCount(int nCount){m_nStartCount=nCount;}
+	int						GetScanStartCount(){return m_nStartCount;}	
+	int						GetScanEndCameraCount();
+	void					SetScanEndCamera(int iCam,int iScan);
+
+protected:
+	//////////////////////////////////////////////////////////////////////////
+	CGlassRecipe			*m_pGlassRecipe;			// Glass Recipe
+	CHardwareSettings		*m_pHardwareSetting;		// Hardware Setting
+	MapDefect				m_MapDefect;			// 搬窃沥焊
+	int						m_nCurDefectIdx;
+	int						m_nJudgeDefectCount;
+	CRITICAL_SECTION		m_csGlassDefect;			
+	
+	CString					m_strLoadingTime;
+	CString					m_strUnloadingTime;
+	CString					m_strScanStartTime;
+	CString					m_strScanEndTime;		
+	//park
+	CString					m_strScanEndTimeFileName;
+	CString					m_strGlassResult;
+	CString					m_strLoadingTimeFileName;
+	CString					m_strLoadingDayFileName;
+
+	// Stage theta 焊沥
+	short					m_nStageLongTheta[2];
+	short					m_nStageShortTheta[2];	
+		
+	INS_EDGE_RESULT_INFO	m_EdgeResultInfo[MAX_DIMENSION_COUNT];
+	INS_PROFILE_RESULT_INFO	m_stProfileResult;
+	short					m_nGlassResult[5];
+	PROFILECHAMFER_RESULT_DATA	m_ProfileInspectData;
+	
+	BOOL					m_bScanEndCamera[MAX_CAMERA_COUNT][MAX_SCAN_COUNT];
+	BOOL					m_bScanStart;
+	BOOL					m_bScanEnd[MAX_SCAN_COUNT];
+	BOOL					m_bPostProcessing;
+	CCriticalSection		m_csProfileData;
+	int						m_nStartCount;	
+	CCriticalSection		m_csInsEnd;	
+
+public:
+	// Side
+	BOOL					m_bOnly_Profile_NG;
+	int						m_nSide_Profile_NG_Count[MAX_DIMENSION_COUNT];
+	int						m_nSide_Profile_NG_Max_Diff[MAX_DIMENSION_COUNT];
+};
+
+
diff --git a/ENRIT/Data/History.h b/ENRIT/Data/History.h
new file mode 100644
index 0000000..1b116ae
--- /dev/null
+++ b/ENRIT/Data/History.h
@@ -0,0 +1,68 @@
+#pragma once
+
+#include "Global_Define.h"
+
+typedef struct _HISTORY_RESULT_SAVE_HEADER
+{
+	BOOL			bResult;	
+	int				nInsStageNo;	
+	int				nDefectCnt;
+	int				nCrackCount;
+	int				nBrokenCount;
+	int				nChipCount;
+	int				nChamferCount;
+	int				nBurrCount;
+	int				nUnknownCount;	
+	
+	BOOL			bProfileJudge[MAX_PROFILE_SETTING_COUNT];
+	int				nProfileDiff[MAX_PROFILE_SETTING_COUNT];
+	BOOL			bChamferJudgeUp[MAX_PROFILE_SETTING_COUNT];
+	int				nChamferThickUp[MAX_PROFILE_SETTING_COUNT];
+	BOOL			bChamferJudgeDn[MAX_PROFILE_SETTING_COUNT];
+	int				nChamferThickDn[MAX_PROFILE_SETTING_COUNT];
+	int				nAVGProfileDiff[MAX_VIEWINFO_GRD_CNT + 2];
+	int				nAVGChamferThickUp[MAX_VIEWINFO_GRD_CNT + 2];
+	int				nAVGChamferThickDn[MAX_VIEWINFO_GRD_CNT + 2];
+} HISTORY_RESULT_SAVE_HEADER, *pHISTORY_RESULT_SAVE_HEADER;
+
+typedef struct _HISTORY_RESULT_SAVE_
+{
+	char			szEndTime[100];
+	char			szGlassID[100];
+	char			szHostID[100];
+		
+	HISTORY_RESULT_SAVE_HEADER	Header;
+
+	_HISTORY_RESULT_SAVE_()
+	{
+		ZeroMemory(this, sizeof(_HISTORY_RESULT_SAVE_));
+	}
+
+} HISTORY_RESULT_SAVE, *pHISTORY_RESULT_SAVE;
+
+typedef struct _HISTORY_RESULT : public HISTORY_RESULT_SAVE_HEADER
+{	
+	CString			strGlassID;
+	CString			strHostID;
+	CString			strEndTime;
+
+	_HISTORY_RESULT()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		strGlassID.Empty();
+		strHostID.Empty();
+		strEndTime.Empty();
+		nInsStageNo = -1;
+		nDefectCnt = 0;
+		bResult = TRUE;	
+		ZeroMemory(bProfileJudge,sizeof(BOOL)*MAX_PROFILE_SETTING_COUNT);	
+		ZeroMemory(bChamferJudgeUp,sizeof(BOOL)*MAX_PROFILE_SETTING_COUNT);
+		ZeroMemory(bChamferJudgeDn,sizeof(BOOL)*MAX_PROFILE_SETTING_COUNT);
+		ZeroMemory(nProfileDiff,sizeof(int)*MAX_PROFILE_SETTING_COUNT);
+		ZeroMemory(nChamferThickUp,sizeof(int)*MAX_PROFILE_SETTING_COUNT);
+		ZeroMemory(nChamferThickDn,sizeof(int)*MAX_PROFILE_SETTING_COUNT);	
+	}
+} HISTORY_RESULT, *pHISTORY_RESULT;
diff --git a/ENRIT/Data/InspectDefect.cpp b/ENRIT/Data/InspectDefect.cpp
new file mode 100644
index 0000000..6554f73
--- /dev/null
+++ b/ENRIT/Data/InspectDefect.cpp
@@ -0,0 +1,274 @@
+// Defect.cpp: implementation of the CInspectDefect class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "InspectDefect.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+//edit by hik //叼棋飘 沥狼 CLASS
+
+CInspectDefect::CInspectDefect()
+{
+	ResetDefect();
+}
+
+CInspectDefect::~CInspectDefect()
+{
+
+}
+
+// Do not edit the following lines, which are needed by ClassWizard.
+#if 0
+BEGIN_MESSAGE_MAP(CInspectDefect, CObject)
+//{{AFX_MSG_MAP(CInspectDefect)
+//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+#endif	// 0
+
+void CInspectDefect::ResetDefect()
+{
+	m_bJudgeDefect		= FALSE;
+	m_nCameraIP			= -1;
+	m_nCameraID			= -1;
+	m_nScanIdx			= -1;
+	m_nDir				= -1;
+	m_nDefectIdx		= -1;
+	m_nPixelConv		= 0;
+	m_nPixelScan		= 0;
+	m_nPixelSize		= 0;
+	m_sPixelWidth		= 0;
+	m_sPixelHeight		= 0;
+	m_nDefectRScale		= 0;
+	m_nLevelSrcMin		= 0;
+	m_nLevelSrcMax		= 0;
+	m_nLevelSrcAvg		= 0;
+	m_nLevelRefMin		= 0;
+	m_nLevelRefMax		= 0;
+	m_nLevelRefAvg		= 0;
+	m_nLevelDiffMin		= 0;
+	m_nLevelDiffMax		= 0;
+	m_nLevelDiffAvg		= 0;
+	m_nProfileIdx		= 0;
+
+	m_sThreshold		= 0;
+	m_sDefectPeak		= 0;
+	m_sDefectType		= 0;
+
+	m_nPixelGlassStart	= 0;
+	m_sDefectLoc		= 0;
+	m_sSplineLoc		= -1;
+
+	m_dwTickCount		= 0;
+
+	m_nUMOriginX		= -1;
+	m_nUMOriginY		= -1;
+	m_nUMSizeX			= 0;
+	m_nUMSizeY			= 0;
+	m_nUMSize			= 0;
+	m_nSideLoc			= 0;
+	m_nCameraDir		= 0;
+
+	m_strDefectPath.Empty();
+}
+
+
+CInspectDefect::CInspectDefect(const CInspectDefect& rhs)
+{
+	if (this != &rhs)
+	{
+		m_nGlassDefectIdx	= rhs.m_nGlassDefectIdx;
+
+		m_nProfileIdx		= rhs.m_nProfileIdx;
+		m_nCameraID			= rhs.m_nCameraID;
+		m_nScanIdx			= rhs.m_nScanIdx;
+		m_nDir				= rhs.m_nDir;
+		m_nDefectIdx		= rhs.m_nDefectIdx;
+
+		m_nPixelConv		= rhs.m_nPixelConv;
+		m_nPixelScan		= rhs.m_nPixelScan;
+		m_nPixelSize		= rhs.m_nPixelSize;	
+		m_sPixelWidth		= rhs.m_sPixelWidth;
+		m_sPixelHeight		= rhs.m_sPixelHeight;
+		m_nDefectRScale		= rhs.m_nDefectRScale;
+		m_nLevelSrcMin		= rhs.m_nLevelSrcMin;
+		m_nLevelSrcMax		= rhs.m_nLevelSrcMax;
+		m_nLevelSrcAvg		= rhs.m_nLevelSrcAvg;
+		m_nLevelRefMin		= rhs.m_nLevelRefMin;
+		m_nLevelRefMax		= rhs.m_nLevelRefMax;
+		m_nLevelRefAvg		= rhs.m_nLevelRefAvg;
+		m_nLevelDiffMin		= rhs.m_nLevelDiffMin;
+		m_nLevelDiffMax		= rhs.m_nLevelDiffMax;
+		m_nLevelDiffAvg		= rhs.m_nLevelDiffAvg;
+
+
+		m_nPixelGlassStart	= rhs.m_nPixelGlassStart;
+		m_sDefectLoc		= rhs.m_sDefectLoc;
+		m_sSplineLoc		= rhs.m_sSplineLoc;
+		m_sDefectType		= rhs.m_sDefectType;
+
+		m_sDefectPeak		= rhs.m_sDefectPeak;
+		m_sThreshold		= rhs.m_sThreshold;
+
+		m_dwTickCount		= rhs.m_dwTickCount;
+
+		m_nUMOriginX		= rhs.m_nUMOriginX;
+		m_nUMOriginY		= rhs.m_nUMOriginY;
+		m_nUMSizeX			= rhs.m_nUMSizeX;
+		m_nUMSizeY			= rhs.m_nUMSizeY;
+		m_nUMSize			= rhs.m_nUMSize;		
+		m_nSideLoc			= rhs.m_nSideLoc;
+		m_nCameraDir		= rhs.m_nCameraDir;
+
+		m_strDefectPath		= rhs.m_strDefectPath;
+		m_bJudgeDefect		= rhs.m_bJudgeDefect;
+	}
+}
+
+CInspectDefect& CInspectDefect::operator=(const CInspectDefect& rhs)
+{
+	if (this != &rhs)
+	{
+		m_nGlassDefectIdx	= rhs.m_nGlassDefectIdx;
+
+		m_nProfileIdx		= rhs.m_nProfileIdx;
+		m_nCameraID			= rhs.m_nCameraID;
+		m_nScanIdx			= rhs.m_nScanIdx;
+		m_nDir				= rhs.m_nDir;
+		m_nDefectIdx		= rhs.m_nDefectIdx;
+
+		m_nPixelConv		= rhs.m_nPixelConv;
+		m_nPixelScan		= rhs.m_nPixelScan;
+		m_nPixelSize		= rhs.m_nPixelSize;	
+		m_sPixelWidth		= rhs.m_sPixelWidth;
+		m_sPixelHeight		= rhs.m_sPixelHeight;
+		m_nDefectRScale		= rhs.m_nDefectRScale;
+		m_nLevelSrcMin		= rhs.m_nLevelSrcMin;
+		m_nLevelSrcMax		= rhs.m_nLevelSrcMax;
+		m_nLevelSrcAvg		= rhs.m_nLevelSrcAvg;
+		m_nLevelRefMin		= rhs.m_nLevelRefMin;
+		m_nLevelRefMax		= rhs.m_nLevelRefMax;
+		m_nLevelRefAvg		= rhs.m_nLevelRefAvg;
+		m_nLevelDiffMin		= rhs.m_nLevelDiffMin;
+		m_nLevelDiffMax		= rhs.m_nLevelDiffMax;
+		m_nLevelDiffAvg		= rhs.m_nLevelDiffAvg;
+		m_nPixelGlassStart	= rhs.m_nPixelGlassStart;
+		m_sDefectLoc		= rhs.m_sDefectLoc;
+		m_sSplineLoc		= rhs.m_sSplineLoc;
+		m_sDefectType		= rhs.m_sDefectType;
+
+		m_sDefectPeak		= rhs.m_sDefectPeak;
+		m_sThreshold		= rhs.m_sThreshold;
+
+		m_dwTickCount		= rhs.m_dwTickCount;
+
+		m_nUMOriginX		= rhs.m_nUMOriginX;
+		m_nUMOriginY		= rhs.m_nUMOriginY;
+		m_nUMSizeX			= rhs.m_nUMSizeX;
+		m_nUMSizeY			= rhs.m_nUMSizeY;
+		m_nUMSize			= rhs.m_nUMSize;
+		m_nSideLoc			= rhs.m_nSideLoc;
+		m_nCameraDir		= rhs.m_nCameraDir;
+
+		m_strDefectPath		= rhs.m_strDefectPath;
+		m_bJudgeDefect		= rhs.m_bJudgeDefect;
+	}
+
+	return *this;
+}
+void CInspectDefect::Merge(const CInspectDefect& rhs)
+{
+	//公霸吝缴狼 Gray 沥焊 -辣沥刮-	
+	m_nPixelConv		= (m_nPixelConv + rhs.m_nPixelConv) / 2;
+	m_nPixelScan		= (m_nPixelScan + rhs.m_nPixelScan) / 2;
+	m_nPixelSize		= m_nPixelSize + rhs.m_nPixelSize;
+	m_sPixelWidth		= m_sPixelWidth + rhs.m_sPixelWidth;
+	m_sPixelHeight		= m_sPixelHeight + rhs.m_sPixelHeight;
+	m_nDefectRScale		= m_nDefectRScale + rhs.m_nDefectRScale;
+	if (m_nLevelSrcMin > rhs.m_nLevelSrcMin)
+		m_nLevelSrcMin	= rhs.m_nLevelSrcMin;
+	if (m_nLevelSrcMax < rhs.m_nLevelSrcMax)
+		m_nLevelSrcMax	= rhs.m_nLevelSrcMax;
+	m_nLevelSrcAvg		= (m_nLevelSrcAvg + rhs.m_nLevelSrcAvg) / 2;
+	if (m_nLevelRefMin > rhs.m_nLevelRefMin)
+		m_nLevelRefMin	= rhs.m_nLevelRefMin;
+	if (m_nLevelRefMax < rhs.m_nLevelRefMax)
+		m_nLevelRefMax	= rhs.m_nLevelRefMax;
+	m_nLevelRefAvg		= (m_nLevelRefAvg + rhs.m_nLevelRefAvg) / 2;
+	if (m_nLevelDiffMin > rhs.m_nLevelDiffMin)
+		m_nLevelDiffMin	= rhs.m_nLevelDiffMin;
+	if (m_nLevelDiffMax < rhs.m_nLevelDiffMax)
+		m_nLevelDiffMax	= rhs.m_nLevelDiffMax;
+	m_nLevelDiffAvg		= (m_nLevelDiffAvg + rhs.m_nLevelDiffAvg) / 2;
+
+	if (m_sDefectPeak < rhs.m_sDefectPeak)
+		m_sDefectPeak	= rhs.m_sDefectPeak;
+	if (m_sThreshold < rhs.m_sThreshold)
+		m_sThreshold	= rhs.m_sThreshold;
+	
+	if (m_dwTickCount < rhs.m_dwTickCount)
+		m_dwTickCount	= rhs.m_dwTickCount;
+
+	if (m_nPixelSize < rhs.m_nPixelSize)
+	{
+		m_nUMOriginX	= rhs.m_nUMOriginX;
+		m_nUMOriginY	= rhs.m_nUMOriginY;
+	}
+	m_nUMSizeX			= m_nUMSizeX + rhs.m_nUMSizeX;
+	m_nUMSizeY			= m_nUMSizeY + rhs.m_nUMSizeY;
+	m_nUMSize			= m_nUMSize + rhs.m_nUMSize;	
+}
+
+// + 楷魂磊 坷滚肺爹.
+CInspectDefect& CInspectDefect::operator+(const CInspectDefect& rhs)
+{
+	
+	m_nPixelConv		= (m_nPixelConv + rhs.m_nPixelConv) / 2;
+	m_nPixelScan		= (m_nPixelScan + rhs.m_nPixelScan) / 2;
+	m_nPixelSize		= m_nPixelSize + rhs.m_nPixelSize;
+	m_sPixelWidth		= m_sPixelWidth + rhs.m_sPixelWidth;
+	m_sPixelHeight		= m_sPixelHeight + rhs.m_sPixelHeight;
+	m_nDefectRScale		= m_nDefectRScale + rhs.m_nDefectRScale;
+	if (m_nLevelSrcMin > rhs.m_nLevelSrcMin)
+		m_nLevelSrcMin	= rhs.m_nLevelSrcMin;
+	if (m_nLevelSrcMax < rhs.m_nLevelSrcMax)
+		m_nLevelSrcMax	= rhs.m_nLevelSrcMax;
+	m_nLevelSrcAvg		= (m_nLevelSrcAvg + rhs.m_nLevelSrcAvg) / 2;
+	if (m_nLevelRefMin > rhs.m_nLevelRefMin)
+		m_nLevelRefMin	= rhs.m_nLevelRefMin;
+	if (m_nLevelRefMax < rhs.m_nLevelRefMax)
+		m_nLevelRefMax	= rhs.m_nLevelRefMax;
+	m_nLevelRefAvg		= (m_nLevelRefAvg + rhs.m_nLevelRefAvg) / 2;
+	if (m_nLevelDiffMin > rhs.m_nLevelDiffMin)
+		m_nLevelDiffMin	= rhs.m_nLevelDiffMin;
+	if (m_nLevelDiffMax < rhs.m_nLevelDiffMax)
+		m_nLevelDiffMax	= rhs.m_nLevelDiffMax;
+	m_nLevelDiffAvg		= (m_nLevelDiffAvg + rhs.m_nLevelDiffAvg) / 2;
+	
+	if (m_sDefectPeak < rhs.m_sDefectPeak)
+		m_sDefectPeak	= rhs.m_sDefectPeak;
+	if (m_sThreshold < rhs.m_sThreshold)
+		m_sThreshold	= rhs.m_sThreshold;
+	
+	if (m_dwTickCount < rhs.m_dwTickCount)
+		m_dwTickCount	= rhs.m_dwTickCount;
+
+	if (m_nPixelSize < rhs.m_nPixelSize)
+	{
+		m_nUMOriginX	= rhs.m_nUMOriginX;
+		m_nUMOriginY	= rhs.m_nUMOriginY;
+	}
+	m_nUMSizeX			= m_nUMSizeX + rhs.m_nUMSizeX;
+	m_nUMSizeY			= m_nUMSizeY + rhs.m_nUMSizeY;
+	m_nUMSize			= m_nUMSize + rhs.m_nUMSize;
+
+	return *this;
+}
diff --git a/ENRIT/Data/InspectDefect.h b/ENRIT/Data/InspectDefect.h
new file mode 100644
index 0000000..93bd62d
--- /dev/null
+++ b/ENRIT/Data/InspectDefect.h
@@ -0,0 +1,92 @@
+// Defect.h: interface for the CInspectDefect class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_DEFECT_H__DD976308_A5AC_4A1B_AF4D_BE22406E7973__INCLUDED_)
+#define AFX_DEFECT_H__DD976308_A5AC_4A1B_AF4D_BE22406E7973__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define MAX_DEFECT_COUNT	1000
+
+#include <map>
+#include <vector>
+
+class CInspectDefect : public CObject
+{
+public:
+	CInspectDefect();
+	virtual ~CInspectDefect();
+	CInspectDefect(const CInspectDefect& rhs);
+	CInspectDefect& operator=(const CInspectDefect& rhs);
+	CInspectDefect& operator+(const CInspectDefect &rhs);
+
+	void			Merge(const CInspectDefect& rhs);
+
+	void			ResetDefect();
+
+	void			SetPixelConv(int nValue)		{ m_nPixelAccumConv = nValue; }
+	void			SetPixelScan(int nValue)		{ m_nPixelAccumScan = nValue; }
+
+	int				GetPixelScan()					{ return m_nPixelAccumScan; }
+	int				GetPixelConv()					{ return m_nPixelAccumConv; }
+
+	int				m_nGlassDefectIdx;			// Glass 吝俊辑狼 牢郸胶.
+	int				m_nRawDefectIdx;			// 搬苞颇老 牢郸胶.
+	// 荐脚 搬苞
+	short			m_nCameraIP;
+	short			m_nCameraID;
+	short			m_nScanIdx;
+	short			m_nDir;
+	short			m_nDefectIdx;				// 墨皋扼俊辑狼 搬窃 牢郸胶
+	BOOL			m_bJudgeDefect;
+	short			m_nProfileIdx;
+
+public:
+	int				m_nPixelConv;				// pixel 窜困 谅钎
+	int				m_nPixelScan;				// pixel 窜困 谅钎
+	int				m_nPixelAccumConv;			// pixel 公霸林缴 谅钎
+	int				m_nPixelAccumScan;			// pixel 公霸林缴 谅钎
+
+public:
+	short			m_nPixelSize;				// 搬窃农扁		---------------------------------PS	
+	short			m_sPixelWidth;				// 侨伎窜困 搬窃 呈厚
+	short			m_sPixelHeight;				// 侨伎窜困 搬窃 臭捞
+	short			m_nLevelSrcMin;				// 搬窃 灌扁 Min	-----------------------------SN
+	short			m_nLevelSrcMax;				// 搬窃 灌扁 Max	-----------------------------SX
+	short			m_nLevelSrcAvg;				// 搬窃 灌扁 Avg	-----------------------------SA
+	short			m_nLevelRefMin;				// 厚背措惑 灌扁 Min	-------------------------RN
+	short			m_nLevelRefMax;				// 厚背措惑 灌扁 Max	-------------------------RX
+	short			m_nLevelRefAvg;				// 厚背措惑 灌扁 Avg	-------------------------RA
+	short			m_nLevelDiffMin;			// 厚背瞒 Min	---------------------------------DN
+	short			m_nLevelDiffMax;			// 厚背瞒 Max	---------------------------------DX
+	short			m_nLevelDiffAvg;			// 厚背瞒 Avg	---------------------------------DA
+
+	int				m_nDefectRScale;			// 侨伎窜困 搬窃 臭捞	-------------------------RS
+	short			m_sThreshold;				// 搬窃阑 八免且 锭狼 Threshold
+	short			m_sDefectPeak;				// 搬窃狼 Peak.
+	short			m_sDefectType;				// 搬窃 鸥涝
+
+	int				m_nPixelGlassStart;			// Glass 矫累 侨伎
+	short			m_sDefectLoc;
+	short			m_sSplineLoc;
+	DWORD			m_dwTickCount;
+	int				m_nSideLoc;
+	int				m_nCameraDir;
+
+	// 楷魂 搬苞.
+	int				m_nUMOriginX;				// um窜困 x谅钎 (盔痢扁霖)
+	int				m_nUMOriginY;				// um窜困 y炼钎 (盔痢扁霖)
+	int				m_nUMSizeX;					// um窜困 X 农扁	-----------------------------UX
+	int				m_nUMSizeY;					// um窜困 Y 农扁	-----------------------------UY
+	int				m_nUMSize;					// um窜困 农扁.	
+
+	CString			m_strDefectPath;
+};
+
+typedef std::multimap<int, CInspectDefect*>			MapDefect;
+typedef std::multimap<int, CInspectDefect*>::iterator	MapDefectIt;
+
+#endif // !defined(AFX_DEFECT_H__DD976308_A5AC_4A1B_AF4D_BE22406E7973__INCLUDED_)
diff --git a/ENRIT/Data/PostProcess.cpp b/ENRIT/Data/PostProcess.cpp
new file mode 100644
index 0000000..b3cbc6e
--- /dev/null
+++ b/ENRIT/Data/PostProcess.cpp
@@ -0,0 +1,1071 @@
+#include "StdAfx.h"
+#include "PostProcess.h"
+#include "ResultData.h"
+#include "FreeImage.h"
+#include "ResultFile.h"
+#include "Glass_Data.h"
+#include "GlassRecipe.h"
+#include "Transfer_Data.h"
+#include "InspectCamera.h"
+
+#define JPEG_RATE			JPEG_QUALITYNORMAL|JPEG_OPTIMIZE
+
+CPostProcess::CPostProcess(void)
+{
+	InitPostProcessing();
+	m_pResultData = NULL;	
+}
+
+CPostProcess::~CPostProcess(void)
+{	
+}
+
+void CPostProcess::SetInspectCamera(int iCam,CInspectCamera *pIns)
+{
+	m_pInspectCamera[iCam] = pIns;
+}
+
+void CPostProcess::SetPrameter(CGlass_Data *pGlsData,CHardwareSettings *pHW,CGlassRecipe *pRecipe,CInspectOption *pInsOpt,CProfileOption *pProfileOpt,CTransfer_Data *pTransData,CResultData *pResultData)
+{
+	m_pGlassData = pGlsData;
+	m_pHardware = pHW;
+	m_pRecipe = pRecipe;
+	m_pInspectOpt = pInsOpt;
+	m_pProfileOpt = pProfileOpt;
+	m_pTransData = pTransData;
+	m_pResultData = pResultData;
+}
+
+BOOL CPostProcess::InitPostProcessing()
+{
+	m_pGlassData = NULL;
+	m_pHardware = NULL;
+	m_pRecipe = NULL;
+
+	for(int i=0;i<MAX_CAMERA_COUNT;i++)
+	{
+		m_pInspectCamera[i] = NULL;
+	}
+
+	return TRUE;
+}
+
+BOOL CPostProcess::ProcessingScanEnd()
+{
+	
+	return TRUE;
+}
+
+void CPostProcess::SetResultData()
+{	
+	m_pResultData->m_strRecipeName.Format(_T("%s"), m_pRecipe->GetRecipeName());	
+	m_pResultData->m_strScanStartTime.Format(_T("%s"),m_pGlassData->GetLoadingTime());
+	m_pResultData->m_strScanEndTime.Format(_T("%s"),m_pGlassData->GetScanEndTime());	
+}
+
+void CPostProcess::AddHistoryData(HISTORY_RESULT Data)
+{
+	m_HistoryData = Data;
+}
+
+BOOL CPostProcess::RunPostProcessing()
+{
+	g_pLog->DisplayMessage(_T("Start RunPostProcessing"));
+
+	if(m_pGlassData == NULL)
+	{
+		g_pLog->DisplayMessage(_T("Glass Data is NULL"));
+		return FALSE;
+	}
+	
+	CreateDataDirectory();
+	
+	m_pResultData->Reset();
+	m_pResultData->SetInspectOpt(m_pInspectOpt,m_pProfileOpt);	
+
+	SetResultData();
+
+	MergeDefect();
+		
+	int nDefectCount = GetInspectionDefect(m_pGlassData->GetMapDefect());
+	g_pLog->DisplayMessage(_T("Total Defect Count : Tot %d, Defect %d"),m_pGlassData->GetTotalDefectCount(),m_pGlassData->GetJudgeDefectCount());
+		
+	m_pResultData->SetDefectIns(m_pGlassData->GetMapDefect(),nDefectCount);
+
+	return TRUE;
+}
+
+void CPostProcess::RunPostProcessing_SaveDefectInfo()
+{
+	int nDefectCount = m_pGlassData->GetJudgeDefectCount();
+	SaveProfileData();
+	SaveChamferData(TRUE);
+	SaveChamferData(FALSE);
+	SaveDefectData(nDefectCount);
+}
+
+void CPostProcess::SaveDefectData(int nDefect)
+{
+	int			iDefect = 0;
+	CInspectDefect	*pDefect;
+	MapDefectIt		it;
+	MapDefect		*pMapDefect = m_pGlassData->GetMapDefect();
+
+	CString glass_id;
+	glass_id.Format(_T("%s"), g_pBase->m_strHPanelID);
+
+	if (glass_id.IsEmpty() == TRUE)
+	{
+		glass_id.Format(_T("MANUAL_ID"));
+	}
+
+	CString defect_data,strValue;
+	CString	strTime = g_pBase->m_strLoadingTime;
+
+	for(it=pMapDefect->begin();it!=pMapDefect->end();it++,iDefect++)
+	{		
+		pDefect = static_cast<CInspectDefect*>(it->second);		
+		if(pDefect == NULL)
+			continue;
+		if(pDefect->m_bJudgeDefect == FALSE)
+			continue;
+
+		switch(pDefect->m_sDefectLoc)
+		{
+		case 0: strValue.Format(_T("Crack")); break;			
+		case 1: strValue.Format(_T("Broken")); break;				
+		case 2: strValue.Format(_T("Chip")); break;			
+		case 3: strValue.Format(_T("Chamfer")); break;			
+		case 4: strValue.Format(_T("Burr")); break;		
+		case 5: strValue.Format(_T("Thin")); break;
+		case 6: strValue.Format(_T("Area")); break;
+		case 7: strValue.Format(_T("NCut")); break;
+		case 8: strValue.Format(_T("CCD Hole")); break;
+		case 9: strValue.Format(_T("Profile")); break;
+		case 10: strValue.Format(_T("KDist")); break;
+		case 11: strValue.Format(_T("RCUTChip")); break;
+		default: strValue.Format(_T("Unknown")); break;			
+		}
+
+		CString			strEqip,strUnit,strInsGrind,strRoughPadLayer,strRoughPadCount,strRoughNonPadLayer,strRoughNonPadCount;
+		CString			strPrePadLayer,strPrePadCount,strPreNonPadLayer,strPreNonPadCount;
+
+		CTransfer_Data		*pTrans = m_pTransData;
+		if(pTrans != NULL)
+		{
+			strEqip.Format(_T("%d"),pTrans->m_nEqpNo);		
+			strUnit.Format(_T("%d"),pTrans->m_nUnitNo);	
+			strInsGrind.Format(_T("%d"),pTrans->m_nisGrind);	
+			strRoughPadLayer.Format(_T("%d"),pTrans->m_nRoughPadLayer);		
+			strRoughPadCount.Format(_T("%d"),pTrans->m_nRoughPadCount);
+			strRoughNonPadLayer.Format(_T("%d"),pTrans->m_nRoughNonPadLayer);
+			strRoughNonPadCount.Format(_T("%d"),pTrans->m_nRoughNonPadCount);
+			strPrePadLayer.Format(_T("%d"),pTrans->m_nPrePadLayer);
+			strPrePadCount.Format(_T("%d"),pTrans->m_nPrePadCount);
+			strPreNonPadLayer.Format(_T("%d"),pTrans->m_nPreNonPadLayer);
+			strPreNonPadCount.Format(_T("%d"),pTrans->m_nPreNonPadCount);
+		}
+		else
+		{
+			strEqip.Format(_T("%d"),0);		
+			strUnit.Format(_T("%d"),0);	
+			strInsGrind.Format(_T("%d"),0);	
+			strRoughPadLayer.Format(_T("%d"),0);		
+			strRoughPadCount.Format(_T("%d"),0);
+			strRoughNonPadLayer.Format(_T("%d"),0);
+			strRoughNonPadCount.Format(_T("%d"),0);
+			strPrePadLayer.Format(_T("%d"),0);
+			strPrePadCount.Format(_T("%d"),0);
+			strPreNonPadLayer.Format(_T("%d"),0);
+			strPreNonPadCount.Format(_T("%d"),0);
+		}		
+
+		defect_data.AppendFormat(_T("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%d,%d,%d,%d,%s,"),
+			strTime, 
+			glass_id, 
+			strEqip,
+			strUnit,
+			strRoughPadLayer,
+			strRoughPadCount,
+			strRoughNonPadLayer,
+			strRoughNonPadCount,
+			strPrePadLayer,
+			strPrePadCount,
+			strPreNonPadLayer,
+			strPreNonPadCount,
+			PANEL_SIDE[pDefect->m_nSideLoc],
+			strValue,
+			pDefect->m_nUMOriginY, pDefect->m_nUMOriginX,
+			pDefect->m_nUMSizeY, pDefect->m_nUMSizeX,
+			pDefect->m_strDefectPath);
+
+		defect_data.Append(_T("\r\n"));
+	}
+
+	CString Defect_file_path;
+
+	Defect_file_path.Format(_T("%s\\%s_DefectData.csv"), m_strResultFolder, g_pBase->m_strLoadingDay);
+	CheckDirectory(Defect_file_path);
+
+	CFile file_module;
+	CFileException file_exception;
+
+	file_module.Open(Defect_file_path, CFile::modeCreate|CFile::modeWrite|CFile::modeNoTruncate|CFile::shareDenyWrite|CFile::shareDenyRead, &file_exception);
+
+	if(file_exception.m_cause == CFileException::none)
+	{
+		if(file_module.SeekToEnd() == 0L)
+		{
+			CString defect_title;
+			defect_title.Format(_T("TIME,ID,EQP NO,UNIT NO,ROUGH PAD LAYER 1,ROUGH PAD COUNT 1,ROUGH NON PAD LAYER 1,ROUGH NON PAD COUNT 1,ROUGH PAD LAYER 2,ROUGH PAD COUNT 2,ROUGH NON PAD LAYER 2,ROUGH NON PAD COUNT 2,SIDE,CAT,POS_X,POS_Y,WIDTH,HEIGHT,IMAGE_PATH\r\n"));
+			file_module.Write(defect_title, defect_title.GetLength()*sizeof(TCHAR));
+		}
+		file_module.Write(defect_data, defect_data.GetLength()*sizeof(TCHAR));
+		file_module.Close();
+	}	
+}
+
+void CPostProcess::SaveProfileData()
+{
+	CString glass_id;
+	glass_id.Format(_T("%s"), g_pBase->m_strHPanelID);
+
+	if (glass_id.IsEmpty() == TRUE)
+	{
+		glass_id.Format(_T("MANUAL_ID"));
+	}
+	
+	CString profile_data;
+	CString			strEqip,strUnit,strInsGrind,strRoughPadLayer,strRoughPadCount,strRoughNonPadLayer,strRoughNonPadCount;
+	CString			strPrePadLayer,strPrePadCount,strPreNonPadLayer,strPreNonPadCount;
+
+	CTransfer_Data		*pTrans = m_pTransData;
+	if(pTrans != NULL)
+	{
+		strEqip.Format(_T("%d"),pTrans->m_nEqpNo);		
+		strUnit.Format(_T("%d"),pTrans->m_nUnitNo);	
+		strInsGrind.Format(_T("%d"),pTrans->m_nisGrind);	
+		strRoughPadLayer.Format(_T("%d"),pTrans->m_nRoughPadLayer);		
+		strRoughPadCount.Format(_T("%d"),pTrans->m_nRoughPadCount);
+		strRoughNonPadLayer.Format(_T("%d"),pTrans->m_nRoughNonPadLayer);
+		strRoughNonPadCount.Format(_T("%d"),pTrans->m_nRoughNonPadCount);
+		strPrePadLayer.Format(_T("%d"),pTrans->m_nPrePadLayer);
+		strPrePadCount.Format(_T("%d"),pTrans->m_nPrePadCount);
+		strPreNonPadLayer.Format(_T("%d"),pTrans->m_nPreNonPadLayer);
+		strPreNonPadCount.Format(_T("%d"),pTrans->m_nPreNonPadCount);
+	}
+	else
+	{
+		strEqip.Format(_T("%d"),0);		
+		strUnit.Format(_T("%d"),0);	
+		strInsGrind.Format(_T("%d"),0);	
+		strRoughPadLayer.Format(_T("%d"),0);		
+		strRoughPadCount.Format(_T("%d"),0);
+		strRoughNonPadLayer.Format(_T("%d"),0);
+		strRoughNonPadCount.Format(_T("%d"),0);
+		strPrePadLayer.Format(_T("%d"),0);
+		strPrePadCount.Format(_T("%d"),0);
+		strPreNonPadLayer.Format(_T("%d"),0);
+		strPreNonPadCount.Format(_T("%d"),0);
+	}
+
+	CString strRet(_T("OK"));
+	if (m_HistoryData.bResult == FALSE)
+	{
+		strRet.Format(_T("NG"));
+	}
+
+	profile_data.Format(_T("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,"), g_pBase->m_strLoadingTime, glass_id, strRet, strEqip,
+		strUnit,
+		strRoughPadLayer,
+		strRoughPadCount,
+		strRoughNonPadLayer,
+		strRoughNonPadCount,
+		strPrePadLayer,
+		strPrePadCount,
+		strPreNonPadLayer,
+		strPreNonPadCount);
+
+	PROFILECHAMFER_RESULT_DATA *pResult = m_pGlassData->GetProfileInspectData();
+	
+	for (BYTE loop_count=0; loop_count<MAX_PROFILE_SETTING_COUNT; loop_count++)
+	{
+		profile_data.AppendFormat(_T("%d,"), pResult->ProfileData[loop_count].nProfileDiff);
+	}
+	profile_data.Append(_T("\n"));
+
+	CString profile_file_path;
+	profile_file_path.Format(_T("%s\\%s_ProfileData.csv"), m_strResultFolder, g_pBase->m_strLoadingDay);
+	CheckDirectory(profile_file_path);
+
+	CFile file_module;
+	CFileException file_exception;
+
+	file_module.Open(profile_file_path, CFile::modeCreate|CFile::modeWrite|CFile::modeNoTruncate|CFile::shareDenyWrite|CFile::shareDenyRead, &file_exception);
+	
+	if(file_exception.m_cause == CFileException::none)
+	{
+		if(file_module.SeekToEnd() == 0L)
+		{
+			CString profile_title;
+			profile_title.Format(_T("TIME,ID,NG/OK,EQP NO,UNIT NO,ROUGH PAD LAYER 1,ROUGH PAD COUNT 1,ROUGH NON PAD LAYER 1,ROUGH NON PAD COUNT 1,ROUGH PAD LAYER 2,ROUGH PAD COUNT 2,ROUGH NON PAD LAYER 2,ROUGH NON PAD COUNT 2,"));
+
+			for(BYTE header=1; header<(MAX_PROFILE_SETTING_COUNT+1); header++)
+			{
+				profile_title.AppendFormat(_T("%d,"),header);
+			}
+
+			profile_title.Append(_T("\r\n"));
+			file_module.Write(profile_title, profile_title.GetLength()*sizeof(TCHAR));
+		}
+		file_module.Write(profile_data, profile_data.GetLength()*sizeof(TCHAR));
+		file_module.Close();
+	}
+}
+
+void CPostProcess::SaveChamferData(BOOL bUp)
+{
+
+	CString glass_id;
+	glass_id.Format(_T("%s"), g_pBase->m_strHPanelID);
+
+	if (glass_id.IsEmpty() == TRUE)
+	{
+		glass_id.Format(_T("MANUAL_ID"));
+	}
+	
+	CString chamfer_data;
+	CString			strEqip,strUnit,strInsGrind,strRoughPadLayer,strRoughPadCount,strRoughNonPadLayer,strRoughNonPadCount;
+	CString			strPrePadLayer,strPrePadCount,strPreNonPadLayer,strPreNonPadCount;
+
+	CTransfer_Data		*pTrans = m_pTransData;
+	if(pTrans != NULL)
+	{
+		strEqip.Format(_T("%d"),pTrans->m_nEqpNo);		
+		strUnit.Format(_T("%d"),pTrans->m_nUnitNo);	
+		strInsGrind.Format(_T("%d"),pTrans->m_nisGrind);	
+		strRoughPadLayer.Format(_T("%d"),pTrans->m_nRoughPadLayer);		
+		strRoughPadCount.Format(_T("%d"),pTrans->m_nRoughPadCount);
+		strRoughNonPadLayer.Format(_T("%d"),pTrans->m_nRoughNonPadLayer);
+		strRoughNonPadCount.Format(_T("%d"),pTrans->m_nRoughNonPadCount);
+		strPrePadLayer.Format(_T("%d"),pTrans->m_nPrePadLayer);
+		strPrePadCount.Format(_T("%d"),pTrans->m_nPrePadCount);
+		strPreNonPadLayer.Format(_T("%d"),pTrans->m_nPreNonPadLayer);
+		strPreNonPadCount.Format(_T("%d"),pTrans->m_nPreNonPadCount);
+	}
+	else
+	{
+		strEqip.Format(_T("%d"),0);		
+		strUnit.Format(_T("%d"),0);	
+		strInsGrind.Format(_T("%d"),0);	
+		strRoughPadLayer.Format(_T("%d"),0);		
+		strRoughPadCount.Format(_T("%d"),0);
+		strRoughNonPadLayer.Format(_T("%d"),0);
+		strRoughNonPadCount.Format(_T("%d"),0);
+		strPrePadLayer.Format(_T("%d"),0);
+		strPrePadCount.Format(_T("%d"),0);
+		strPreNonPadLayer.Format(_T("%d"),0);
+		strPreNonPadCount.Format(_T("%d"),0);
+	}	
+	
+	chamfer_data.Format(_T("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,"), g_pBase->m_strLoadingTime, glass_id,strEqip,
+		strUnit,
+		strRoughPadLayer,
+		strRoughPadCount,
+		strRoughNonPadLayer,
+		strRoughNonPadCount,
+		strPrePadLayer,
+		strPrePadCount,
+		strPreNonPadLayer,
+		strPreNonPadCount);
+
+	PROFILECHAMFER_RESULT_DATA *pResult = m_pGlassData->GetProfileInspectData();	
+	
+	for (BYTE loop_count=0; loop_count<MAX_PROFILE_SETTING_COUNT; loop_count++)
+	{
+		chamfer_data.AppendFormat(_T("%d,"), pResult->ResultChamfer[loop_count][bUp].nChamferCalThick);
+	}
+	chamfer_data.Append(_T("\n"));
+
+	CString profile_file_path;
+	if(bUp ==TRUE)
+		profile_file_path.Format(_T("%s\\%s_ChamferUpData.csv"),m_strResultFolder, g_pBase->m_strLoadingDay);
+	else
+		profile_file_path.Format(_T("%s\\%s_ChamferDownData.csv"),m_strResultFolder, g_pBase->m_strLoadingDay);
+	CheckDirectory(profile_file_path);
+
+	CFile file_module;
+	CFileException file_exception;
+
+	file_module.Open(profile_file_path, CFile::modeCreate|CFile::modeWrite|CFile::modeNoTruncate|CFile::shareDenyWrite|CFile::shareDenyRead, &file_exception);
+
+	if(file_exception.m_cause == CFileException::none)
+	{
+		if(file_module.SeekToEnd() == 0L)
+		{
+
+			CString chamfer_title;
+			chamfer_title.Format(_T("TIME,ID,EQP NO,UNIT NO,ROUGH PAD LAYER 1,ROUGH PAD COUNT 1,ROUGH NON PAD LAYER 1,ROUGH NON PAD COUNT 1,ROUGH PAD LAYER 2,ROUGH PAD COUNT 2,ROUGH NON PAD LAYER 2,ROUGH NON PAD COUNT 2,"));
+
+			for(BYTE header=1; header<(MAX_PROFILE_SETTING_COUNT+1); header++)
+			{
+				chamfer_title.AppendFormat(_T("%d,"),header);
+			}
+
+			chamfer_title.Append(_T("\r\n"));
+			file_module.Write(chamfer_title, chamfer_title.GetLength()*sizeof(TCHAR));
+		}
+		file_module.Write(chamfer_data, chamfer_data.GetLength()*sizeof(TCHAR));
+		file_module.Close();
+	}
+}
+
+void CPostProcess::JudgementData()
+{
+	if(m_pGlassData == NULL)
+		return;
+
+	PROFILECHAMFER_RESULT_DATA *pResult = m_pGlassData->GetProfileInspectData();
+	PROFILE_RESULT	*pProfileRes;
+	int			index;
+	
+	for(index=0;index<MAX_PROFILE_SETTING_COUNT;index++)
+	{
+		pProfileRes = &pResult->ProfileData[index];
+
+		pProfileRes->bProfileJudge = TRUE;
+		if(pProfileRes->bUseJudge == TRUE)
+		{
+			if(pProfileRes->nProfileDiff < -1*pProfileRes->nJudgeMinus || pProfileRes->nProfileDiff > pProfileRes->nJudgePlus)
+			{
+				pProfileRes->bProfileJudge = FALSE;
+			}
+		}
+
+		for(int i=0;i<2;i++)
+		{
+			CHAMFER_RESULT *pChamferRes = &pResult->ResultChamfer[index][i];
+			pChamferRes->bChamferJudge = TRUE;
+			if(pChamferRes->bUseJudge == TRUE)
+			{
+				if(pChamferRes->nChamferThick < pChamferRes->nJudgeReference - pChamferRes->nJudgeMinusChamfer || pChamferRes->nChamferThick > pChamferRes->nJudgeReference+pChamferRes->nJudgePlusChamfer)
+				{
+					pChamferRes->bChamferJudge = FALSE;
+					//InsertManualDefect(pInspect,m_pHardware->GetCameraSettings(pProfileRes->iCam,pProfileRes->iScan),pProfileRes->iScan,pProfileRes->ptGlassStart.x,pProfileRes->ptGlassStart.y,DefectLoc_Chamfer);
+				}
+			}
+		}
+	}
+}
+
+BOOL CPostProcess::SaveDefectImage(LPBYTE pImage,CSize szImage,CRect rectDefect,CString strFile,DimensionDir emDir)
+{
+	FIBITMAP					*bitmap = NULL;	
+	BYTE						*pBitBuffer;
+
+	bitmap = FreeImage_Allocate(szImage.cx, szImage.cy,8);
+
+	pBitBuffer = FreeImage_GetBits(bitmap);
+	if(pBitBuffer == NULL)
+	{
+		FreeImage_Unload(bitmap);		
+		return FALSE;
+	}			
+
+	CopyMemory(pBitBuffer,pImage,szImage.cx*szImage.cy);
+
+	FIBITMAP *pBit24 = FreeImage_ConvertTo24Bits(bitmap);
+	if(pBit24 == NULL)
+		return FALSE;
+
+	char cFilePath[255];
+
+#ifdef _UNICODE
+	int		nSize = WideCharToMultiByte(CP_ACP, 0, strFile.GetBuffer(), -1, NULL, 0, NULL,NULL); 				
+	WideCharToMultiByte(CP_ACP, 0, strFile.GetBuffer(), -1, cFilePath, nSize, NULL, NULL); 
+#else				
+	sprintf_s(cFilePath,sizeof(char)*255,_T("%s"),(LPSTR)(LPCTSTR)strFile);	
+#endif	
+
+	FreeImage_FlipVertical(pBit24);
+
+	FreeImage_Save(FIF_JPEG, pBit24, cFilePath,JPEG_RATE);	
+
+	FreeImage_Unload(bitmap);
+	FreeImage_Unload(pBit24);
+
+
+	return TRUE;
+}
+
+BOOL CPostProcess::SaveDefectImage2(LPBYTE pImage,CSize szImage,CRect rectDefect,CString strFile,DimensionDir emDir)
+{
+	IplImage *pImageTmp = cvCreateImage(cvSize(szImage.cx, szImage.cy), 8,1);
+	cvZero(pImageTmp);
+	
+	// add point to the image
+	for (int i = 0; i<szImage.cy; i++)
+	{
+		for (int j = 0; j<szImage.cx; j++)
+		{
+			pImageTmp->imageData[i*pImageTmp->widthStep+j] = pImage[i*szImage.cx+j];
+		}
+	}
+
+	IplImage *pColorImg = cvCreateImage(cvSize(szImage.cx, szImage.cy), 8, 3);
+	cvZero(pColorImg);
+
+	cvCvtColor(pImageTmp, pColorImg, CV_GRAY2BGR);
+
+	cvRectangle(pColorImg,CvPoint(rectDefect.left,rectDefect.top), CvPoint(rectDefect.left+rectDefect.Width(),rectDefect.top+rectDefect.Height()), cvScalar(0,0,255), 1);
+	
+USES_CONVERSION;
+	char str_filename[1024];
+	sprintf_s(str_filename, "%s", W2A(strFile));
+	cvSaveImage(str_filename, pColorImg);
+
+	cvReleaseImage(&pColorImg);
+	cvReleaseImage(&pImageTmp);
+
+	return TRUE;
+}
+
+void CPostProcess::GetJudgePrm(CDefect *pDefect,int &nJudgeW,int &nJudgeH,BOOL &bAnd,EM_CHIPPING_COMP &eComp,BOOL &bJudgeUse)
+{
+	CINSPECT_JUDGEMENT_PARM	*pJudge = m_pRecipe->GetJudgePrm();
+
+	nJudgeW = nJudgeH = 0;
+	bAnd = bJudgeUse = TRUE;
+
+	switch(pDefect->m_DefectLoc)
+	{
+	case DefectLoc_Chip:
+		nJudgeW = pJudge->defect[pDefect->m_nSideLoc][0].Chip_Side.szDefect.cx;
+		nJudgeH = pJudge->defect[pDefect->m_nSideLoc][0].Chip_Side.szDefect.cy;
+		bAnd = pJudge->defect[pDefect->m_nSideLoc][0].Chip_Side.bConditionAND;		
+		bJudgeUse = pJudge->defect[pDefect->m_nSideLoc][0].Chip_Side.bError;		
+		break;
+	case DefectLoc_Crack:
+		nJudgeW = pJudge->defect[pDefect->m_nSideLoc][0].Crack.szDefect.cx;
+		nJudgeH = pJudge->defect[pDefect->m_nSideLoc][0].Crack.szDefect.cy;
+		bAnd = pJudge->defect[pDefect->m_nSideLoc][0].Crack.bConditionAND;		
+		bJudgeUse = pJudge->defect[pDefect->m_nSideLoc][0].Crack.bError;
+		break;
+	case DefectLoc_Broken:
+		nJudgeW = pJudge->defect[pDefect->m_nSideLoc][0].Broken.szDefect.cx;
+		nJudgeH = pJudge->defect[pDefect->m_nSideLoc][0].Broken.szDefect.cy;
+		bAnd = pJudge->defect[pDefect->m_nSideLoc][0].Broken.bConditionAND;		
+		bJudgeUse = pJudge->defect[pDefect->m_nSideLoc][0].Broken.bError;
+		break;
+	case DefectLoc_Burr:
+		nJudgeW = pJudge->defect[pDefect->m_nSideLoc][0].Burr_Side.szDefect.cx;
+		nJudgeH = pJudge->defect[pDefect->m_nSideLoc][0].Burr_Side.szDefect.cy;
+		bAnd = pJudge->defect[pDefect->m_nSideLoc][0].Burr_Side.bConditionAND;		
+		bJudgeUse = pJudge->defect[pDefect->m_nSideLoc][0].Burr_Side.bError;
+		break;
+	}	
+
+	if(bAnd == TRUE)
+		eComp = CHIP_AND;
+	else
+		eComp = CHIP_OR;
+}
+
+int CPostProcess::GetInspectionDefect(MapDefect *mapDefectData)
+{
+	if(m_pRecipe == NULL || m_pHardware == NULL)
+		return 0;
+
+	int			nDefectCount = 0;
+	int			iCam,iDefect;	
+	CDefect		*pDefect;			
+	CHardwareSettings	*pHard = m_pHardware;	
+	CInspectDefect	*pInsDefect = NULL;
+	int			nResultCount = 0;	
+	CString		strFile;
+	CCameraSettings		*pCamera = NULL;
+	
+	int		nJudgeW,nJudgeH;
+	BOOL	bAnd,bJudgeUse;
+	EM_CHIPPING_COMP	eComp;
+	double	dScanRes = 0.,dConvRes = 0.;
+	BOOL	bJudgeDefect;
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+	
+	for(iCam=0;iCam<pHard->GetCameraCount();iCam++)	
+	{
+		nDefectCount = m_pInspectCamera[iCam]->GetDefectCount();
+		g_pLog->DisplayMessage(_T("[%d]Camera Defect Count : %d"), iCam,nDefectCount);		
+
+		for(iDefect=0;iDefect<nDefectCount;iDefect++)
+		{
+			pDefect = m_pInspectCamera[iCam]->GetDefect(iDefect);
+			if(pDefect == NULL || pDefect->m_bRemoved == TRUE)
+				continue;			
+
+			if(m_pGlassData->GetTotalDefectCount() >= MAX_DEFECT_COUNT)
+				return nResultCount;			
+			
+			GetJudgePrm(pDefect,nJudgeW,nJudgeH,bAnd,eComp,bJudgeUse);
+			if(bJudgeUse == FALSE)
+				continue;
+
+			pCamera = m_pHardware->GetCameraSettings(pDefect->m_nCamID,pDefect->m_nScanIdx);
+			if(pCamera == NULL)	
+				continue;			
+
+			dScanRes = pCamera->m_dScanResolution[nStageNo];
+			dConvRes = pCamera->m_dConvResolution[nStageNo];			
+			if (dScanRes <= 0.0 || dConvRes <= 0)	
+				continue;
+
+			if(pDefect->m_nSplineLoc == Spline_None)
+			{
+				bJudgeDefect = FALSE;
+				if(eComp == CHIP_AND)
+				{
+					if((double)pDefect->m_Defect.s_DefectRect.Width()*dConvRes >= nJudgeW && (double)pDefect->m_Defect.s_DefectRect.Height()*dScanRes >= nJudgeH)
+						bJudgeDefect = TRUE;					
+				}
+				else if(eComp == CHIP_OR)
+				{
+					if((double)pDefect->m_Defect.s_DefectRect.Width()*dConvRes >= nJudgeW || (double)pDefect->m_Defect.s_DefectRect.Height()*dScanRes >= nJudgeH)
+						bJudgeDefect = TRUE;					
+				}
+				else
+					continue;
+			}
+			else
+			{
+				bJudgeDefect = TRUE;
+			}
+			
+			pInsDefect = new CInspectDefect;
+
+			pCamera = pHard->GetCameraSettings(iCam,pDefect->m_nScanIdx);
+			if(pCamera != NULL)
+				pInsDefect->m_nDir				= (int)pCamera->m_enCamDir;
+
+			INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(pCamera->m_eDimension);
+			
+			pInsDefect->m_nDefectIdx		= pDefect->m_nIndex;
+			pInsDefect->m_nCameraID			= iCam;
+			pInsDefect->m_nScanIdx			= pDefect->m_nScanIdx;			
+			pInsDefect->m_nPixelGlassStart	= pEdgeInfo->nGlassStartLine;
+			pInsDefect->m_sDefectType		= static_cast<short>(pDefect->m_Defect.s_DefectType);
+			pInsDefect->m_nPixelSize		= pDefect->m_Defect.s_nDefectArea;			
+			pInsDefect->SetPixelConv(pDefect->m_Defect.s_nDefectX);
+			pInsDefect->SetPixelScan(pDefect->m_Defect.s_nDefectY);
+			pInsDefect->m_nPixelConv		= pDefect->m_Defect.s_DefectRect.left;
+			pInsDefect->m_nPixelScan		= pDefect->m_Defect.s_DefectRect.top;
+			pInsDefect->m_sPixelWidth		= pDefect->m_Defect.s_DefectRect.Width();
+			pInsDefect->m_sPixelHeight		= pDefect->m_Defect.s_DefectRect.Height();
+			pInsDefect->m_nDefectRScale		= pDefect->m_Defect.s_nDefectRScale;
+
+			pInsDefect->m_nLevelSrcMin		= pDefect->m_Defect.s_sLevelSrcMin;
+			pInsDefect->m_nLevelSrcMax		= pDefect->m_Defect.s_sLevelSrcMax;
+			pInsDefect->m_nLevelSrcAvg		= pDefect->m_Defect.s_sLevelSrcAvg;
+			pInsDefect->m_nLevelRefMin		= pDefect->m_Defect.s_sLevelRefMin;
+			pInsDefect->m_nLevelRefMax		= pDefect->m_Defect.s_sLevelRefMax;
+			pInsDefect->m_nLevelRefAvg		= pDefect->m_Defect.s_sLevelRefAvg;
+			pInsDefect->m_nLevelDiffMin		= pDefect->m_Defect.s_sLevelDiffMin;
+			pInsDefect->m_nLevelDiffMax		= pDefect->m_Defect.s_sLevelDiffMax;
+			pInsDefect->m_nLevelDiffAvg		= pDefect->m_Defect.s_sLevelDiffAvg;
+
+			pInsDefect->m_sDefectLoc		= static_cast<int>(pDefect->m_DefectLoc);
+			pInsDefect->m_sSplineLoc		= static_cast<int>(pDefect->m_nSplineLoc);
+			pInsDefect->m_sThreshold		= pDefect->m_Defect.s_sThreshold;			
+			pInsDefect->m_sDefectPeak		= pDefect->m_Defect.s_sDefectPeak;		
+			pInsDefect->m_nSideLoc			= (DimensionDir)pDefect->m_nSideLoc;
+			pInsDefect->m_dwTickCount		= GetTickCount();			
+			pInsDefect->m_bJudgeDefect		= bJudgeDefect;
+			pInsDefect->m_nProfileIdx		= pDefect->m_nProfileIndex;
+
+			if(DefectProcess(pInsDefect,m_pInspectCamera[iCam]) == FALSE)
+			{				
+				delete pInsDefect, pInsDefect = NULL;
+				continue;
+			}
+
+			if(m_pGlassData->SetDefect(pInsDefect) == FALSE)
+			{						
+				delete pInsDefect, pInsDefect = NULL;
+				continue;
+			}
+			
+			if(pInsDefect->m_bJudgeDefect == TRUE)
+			{
+				CString		str = _T("Unknown");								
+
+				switch(pDefect->m_DefectLoc)
+				{
+				case DefectLoc_Crack: str=_T("Crack"); break;
+				case DefectLoc_Broken: str=_T("Broken"); break;
+				case DefectLoc_Chip: 
+				{
+					if(pInsDefect->m_sSplineLoc == Spline_None)
+						str=_T("Chip"); 
+					else
+						str=_T("R_Chip"); 
+					break;
+				}
+				case DefectLoc_Chamfer: str=_T("Chamfer"); break;
+				case DefectLoc_Burr: str=_T("Burr"); break;
+				case DefectLoc_Thin: str=_T("Thin"); break;
+				case DefectLoc_Air: str=_T("Lifting"); break;
+				case DefectLoc_Notch: str=_T("NCut"); break;
+				case DefectLoc_Hole: str=_T("Hole"); break;
+				case DefectLoc_Profile: str=_T("Profile"); break;
+				case DefectLoc_KDist: str = _T("KDist"); break;
+				case DefectLoc_RCUTChip: str = _T("RCUTChip"); break;
+				}				
+
+				int			nDefectSize = pInsDefect->m_nDefectRScale;
+				strFile.Format(_T("%s\\%03d_%s_%s_%s.jpg"),m_strDefectFolder,pInsDefect->m_nGlassDefectIdx,g_pBase->m_strHPanelID,PANEL_SIDE[(DimensionDir)pDefect->m_nSideLoc],str);
+
+				CRect		rectDefect;
+
+				rectDefect.left = DEFECTIMAGE_WIDTH/2-pInsDefect->m_sPixelWidth/2;
+				rectDefect.right = DEFECTIMAGE_WIDTH/2+pInsDefect->m_sPixelWidth/2;
+				rectDefect.top = DEFECTIMAGE_HEIGHT/2-pInsDefect->m_sPixelHeight/2;
+				rectDefect.bottom = DEFECTIMAGE_HEIGHT/2+pInsDefect->m_sPixelHeight/2;
+
+				CheckDirectory(strFile);
+				SaveDefectImage2(pDefect->m_Image,CSize(DEFECTIMAGE_WIDTH,DEFECTIMAGE_HEIGHT),rectDefect,strFile,(DimensionDir)pDefect->m_nSideLoc);		
+
+				pInsDefect->m_strDefectPath		= strFile;
+			}
+			nResultCount++;		
+		}
+	}
+	
+	return m_pGlassData->GetJudgeDefectCount();
+}
+
+BOOL CPostProcess::DefectProcess(CInspectDefect* pDefect,CInspectCamera *pInspect)
+{
+	CGlassRecipe* pRecipe = m_pRecipe;
+	if(pRecipe == NULL)	
+		return FALSE;	
+
+	CCameraSettings *pCamera = m_pHardware->GetCameraSettings(pDefect->m_nCameraID,pDefect->m_nScanIdx);
+	if(pCamera == NULL)	
+		return FALSE;
+
+	double	dScanRes = 0.,dConvRes = 0.;
+	int		nMarginLeft;
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	dScanRes = pCamera->m_dScanResolution[nStageNo];
+	dConvRes = pCamera->m_dConvResolution[nStageNo];
+	nMarginLeft = pCamera->m_nMarginLeft;	
+
+	if (dScanRes <= 0.0 || dConvRes <= 0)	
+		return FALSE;	
+	
+	pDefect->m_nUMOriginX = (int)((double)(pDefect->GetPixelScan() - pDefect->m_nPixelGlassStart) * dScanRes);
+	pDefect->m_nUMOriginY = (int)(((double)(pDefect->GetPixelConv()) * dConvRes));
+
+	pDefect->m_nUMSizeX = (int)((double)pDefect->m_sPixelHeight * dScanRes);
+	pDefect->m_nUMSizeY = (int)((double)pDefect->m_sPixelWidth * dConvRes);
+	pDefect->m_nUMSize =(int)((double)pDefect->m_nPixelSize * dScanRes * dConvRes);
+
+	if(pDefect->m_nUMOriginX <= -1 || pDefect->m_nUMOriginY <= -1)		
+		return FALSE;		
+
+	return TRUE;
+}
+
+void CPostProcess::CalcGlassSize()
+{
+	int					iCam,iScan;
+	CHardwareSettings	*pHard = m_pHardware;
+	CCameraSettings		*pCamera;	
+	double				dGlasssizeY[2],dGlasssizeX[2];	
+	double				dGlassSizeSumY[2],dGlassSizeCntY[2];		
+	double				dDist;
+	CAMERA_SCANDIR		ScanDirection;
+	double				dScanRes;
+	double				dConvRes;	
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	for(iCam=0;iCam<pHard->GetCameraCount();iCam++)		
+	{
+		for(iScan=0;iScan<pHard->GetScanCount();iScan++)
+		{
+			pCamera = pHard->GetCameraSettings(iCam,iScan);
+			if(pCamera == NULL)
+				continue;	
+
+			ZeroMemory(dGlasssizeY,sizeof(double)*2);
+			ZeroMemory(dGlasssizeX,sizeof(double)*2);
+
+			INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(pCamera->m_eDimension);
+
+			dGlasssizeX[0] = pEdgeInfo->nGlassEdgeXPos[0];
+			dGlasssizeX[1] = pEdgeInfo->nGlassEdgeXPos[1];
+			dGlasssizeY[0] = pEdgeInfo->nGlassStartLine;
+			dGlasssizeY[1] = pEdgeInfo->nGlassEndLine;
+
+			dScanRes = pCamera->m_dScanResolution[nStageNo];
+			dConvRes = pCamera->m_dConvResolution[nStageNo];
+
+			dDist = sqrt(pow((dGlasssizeX[0]*dConvRes-dGlasssizeX[1]*dConvRes),2) + pow((dGlasssizeY[0]*dScanRes-dGlasssizeY[1]*dScanRes),2));
+			if(dDist > 0)
+			{
+				ScanDirection = pCamera->m_eScanDir;
+				dGlassSizeCntY[(int)ScanDirection]++;
+				dGlassSizeSumY[(int)ScanDirection] += dDist;
+			}
+		}
+	}
+
+	// Glass Size
+	for(int i=0;i<2;i++)
+	{
+		if(dGlassSizeCntY[i] > 0)
+			m_pResultData->m_dGlassSize[i] = dGlassSizeSumY[i]/dGlassSizeCntY[i];
+	}
+}
+
+void CPostProcess::MergeDefect()
+{
+	int			iCam,iDefect,iDefectDest;
+	int			nDefectCount;
+	CDefect		*pDefect,*pDefectDest;
+	int			nMergeDistX,nMergeDistY;
+	int			nRemoveCount = 0;
+	CRect		rect,rectOrg,rectTgt;
+	CHardwareSettings	*pHard = m_pHardware;
+	CGlassRecipe		*pGlsRcp = m_pRecipe;		
+
+	if(pGlsRcp == NULL)
+		return;
+	
+	nMergeDistX = nMergeDistY = 5;
+
+	for(iCam=0;iCam<pHard->GetCameraCount();iCam++)
+	{
+		nDefectCount = m_pInspectCamera[iCam]->GetDefectCount();
+
+		for(iDefect=0;iDefect<nDefectCount-1;iDefect++)
+		{
+			pDefect = m_pInspectCamera[iCam]->GetDefect(iDefect);
+			if(pDefect == NULL)
+				continue;
+
+			if(pDefect->m_bRemoved == TRUE)
+				continue;
+
+			if(pDefect->m_DefectLoc == DefectLoc_Chamfer || pDefect->m_DefectLoc == DefectLoc_Profile)
+				continue;
+
+			if (pDefect->m_DefectLoc == DefectLoc_KDist || pDefect->m_DefectLoc == DefectLoc_RCUTChip)
+				continue;
+			
+			rectOrg = pDefect->m_Defect.s_DefectRect;
+			rectOrg.InflateRect(nMergeDistX,nMergeDistY);
+
+			for(iDefectDest=iDefect+1;iDefectDest<nDefectCount;iDefectDest++)
+			{
+				pDefectDest = m_pInspectCamera[iCam]->GetDefect(iDefectDest);
+				if(pDefectDest == NULL)
+					continue;
+
+				if(pDefectDest->m_nScanIdx != pDefect->m_nScanIdx)
+					continue;
+
+				if(pDefectDest->m_bRemoved == TRUE)
+					continue;
+
+				if(pDefectDest->m_nCamDir != pDefect->m_nCamDir)
+					continue;
+
+				if(pDefectDest->m_DefectLoc == DefectLoc_Chamfer || pDefectDest->m_DefectLoc == DefectLoc_Profile)
+					continue;
+
+				rectTgt = pDefectDest->m_Defect.s_DefectRect;
+
+				if(rect.IntersectRect(rectOrg,rectTgt) == TRUE)
+				{
+					pDefect->m_Defect.MergeBlob(pDefectDest->m_Defect);
+
+					if(pDefect->m_DefectLoc == DefectLoc_Chip)
+					{
+						if(pDefectDest->m_DefectLoc == DefectLoc_Crack || pDefectDest->m_DefectLoc == DefectLoc_Broken)
+							pDefect->m_DefectLoc = pDefectDest->m_DefectLoc;
+					}
+					else if(pDefect->m_DefectLoc == DefectLoc_Crack)
+					{
+						if(pDefectDest->m_DefectLoc == DefectLoc_Broken)
+							pDefect->m_DefectLoc = pDefectDest->m_DefectLoc;
+					}
+
+					pDefectDest->m_bRemoved = TRUE;
+					nRemoveCount++;
+				}				
+			}
+		}
+	}
+
+	g_pLog->DisplayMessage(_T("Defect Merge Count : %d"), nRemoveCount);	
+}
+
+void CPostProcess::JudgeThinCrackDefect()
+{
+	int			iCam,iDefect;
+	int			nDefectCount;
+	int			nJudgeCount = 0;
+	CDefect		*pDefect;
+	CHardwareSettings	*pHard = m_pHardware;
+	CGlassRecipe	*pGlsRcp = m_pRecipe;
+	if(pGlsRcp == NULL)
+		return;
+	
+	for(iCam=0;iCam<pHard->GetCameraCount();iCam++)
+	{
+		nDefectCount = m_pInspectCamera[iCam]->GetDefectCount();
+
+		for(iDefect=0;iDefect<nDefectCount;iDefect++)
+		{
+			pDefect = m_pInspectCamera[iCam]->GetDefect(iDefect);
+			if(pDefect == NULL)
+				continue;
+
+			if(pDefect->m_bRemoved == TRUE)
+				continue;
+
+			if(pDefect->m_bThinCrackDefect == FALSE)
+				continue;
+
+			if(Judge_CornerChip_Item_ThinCrack(pDefect,iCam) == FALSE)
+			{
+				pDefect->m_bRemoved = TRUE;								
+			}
+			else
+			{	
+				nJudgeCount++;
+				pDefect->m_DefectLoc = DefectLoc_Thin;
+			}			
+		}
+	}
+
+	g_pLog->DisplayMessage(_T("Thin Crack Count : %d"), nJudgeCount);	
+}
+
+BOOL CPostProcess::Judge_CornerChip_Item_ThinCrack(CDefect* pDefect,int nCamIdx)
+{
+	CHardwareSettings	*pHard = m_pHardware;
+	CCameraSettings *pCamera;
+
+	pCamera = pHard->GetCameraSettings(nCamIdx,pDefect->m_nScanIdx);
+	if(pCamera == NULL)
+		return FALSE;	
+
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double		dScanRes = pCamera->m_dScanResolution[nStageNo];
+	double		dConvRes = pCamera->m_dConvResolution[nStageNo];
+	EM_CHIPPING_COMP emComp = CHIP_OR;
+
+	//Length and Depth
+	CINSPECT_JUDGEMENT_PARM *pJudgePrm = m_pRecipe->GetJudgePrm();		
+	
+	if(pJudgePrm->bUseLengthDepthComp)
+	{		
+		//and
+		if(emComp == CHIP_AND)
+		{
+			if((double)pDefect->m_Defect.s_DefectRect.Width()*dConvRes >= pJudgePrm->nCornerJugeDepth && (double)pDefect->m_Defect.s_DefectRect.Height()*dScanRes >= pJudgePrm->nCornerJugeLength)
+				return TRUE;	
+		}
+		else if(emComp == CHIP_OR)
+		{
+			if((double)pDefect->m_Defect.s_DefectRect.Width()*dConvRes >= pJudgePrm->nCornerJugeDepth || (double)pDefect->m_Defect.s_DefectRect.Height()*dScanRes >= pJudgePrm->nCornerJugeLength)
+				return TRUE;
+		}									
+	}
+
+	return FALSE;
+}
+
+BOOL CPostProcess::CreateDataDirectory()
+{
+	m_strResultFolder.Format(_T("%sDATA_RESULT"),PATH_INSPECTION_DATA);
+	CheckDirectory(m_strResultFolder);
+	m_strDefectFolder.Format(_T("%sIMG_DEFECT\\%s\\%s\\%s"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime);
+	CheckDirectory(m_strDefectFolder);
+	m_strSplineFolder.Format(_T("%sSPLINE\\%s\\%s\\%s"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime);
+	CheckDirectory(m_strSplineFolder);
+	m_strFullImgeFolder.Format(_T("%sIMG_FULL\\%s\\%s\\%s"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime);
+	CheckDirectory(m_strFullImgeFolder);
+	m_strImageMarkFolder.Format(_T("%sIMG_MARK\\%s\\%s\\%s"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime);
+	CheckDirectory(m_strImageMarkFolder);
+	
+	return TRUE;
+}
+
+BOOL CPostProcess::CheckDirectory(const TCHAR szPathName[])
+{
+	CFileFind finder;
+	CString strTemp;
+	CString strDir = szPathName;
+	int nPos;
+	if (finder.FindFile(szPathName) == FALSE)
+	{
+		nPos = strDir.Find(_T("\\"));
+		nPos = strDir.Find(_T("\\"), nPos+1);
+		while(nPos > 0)
+		{
+			strTemp = strDir.Mid(0,nPos);
+			if(0 < strTemp.GetLength())
+			{
+				if(CString("\\") == strTemp.GetAt(strTemp.GetLength()-1))
+				{
+					nPos = strDir.Find(_T("\\"), nPos+1);
+					continue;
+				}
+			}
+			if (finder.FindFile(strTemp) == FALSE)
+			{
+				if(::CreateDirectory(strTemp, NULL) == FALSE)
+				{
+					strTemp.Format(_T("[%s]Folder Create Fail. "), szPathName);
+
+					//LogMessage(strTemp, 2);
+					return FALSE;
+				}
+			}
+			nPos = strDir.Find(_T("\\"), nPos+1);
+		}
+	}	
+	return TRUE;
+}
+
+CString CPostProcess::GetResultPath(EM_RESULT_PATH ePath)
+{
+	CString			str;
+
+	switch(ePath)
+	{
+	case EM_RESULT_FILE: str=m_strResultFolder; break;
+	case EM_RESULT_DEFECT: str=m_strDefectFolder; break;
+	case EM_RESULT_SPLINE: str=m_strSplineFolder; break;
+	case EM_RESULT_FULL: str=m_strFullImgeFolder; break;
+	case EM_RESULT_MARK: str=m_strImageMarkFolder; break;
+	}
+
+	return str;
+}
\ No newline at end of file
diff --git a/ENRIT/Data/PostProcess.h b/ENRIT/Data/PostProcess.h
new file mode 100644
index 0000000..fae876e
--- /dev/null
+++ b/ENRIT/Data/PostProcess.h
@@ -0,0 +1,73 @@
+#pragma once
+
+#include "InspectDefect.h"
+#include "History.h"
+
+enum	EM_RESULT_PATH{EM_RESULT_FILE=0,EM_RESULT_DEFECT,EM_RESULT_SPLINE,EM_RESULT_FULL,EM_RESULT_MARK};
+
+
+class CDefect;
+class CHardwareSettings;
+class CGlassRecipe;
+class CTransfer_Data;
+class CResultData;
+class CInspectOption;
+class CGlass_Data;
+class CProfileOption;
+class CInspectCamera;
+class CPostProcess
+{
+public:
+	CPostProcess(void);
+	virtual ~CPostProcess(void);
+
+public:
+	virtual BOOL	InitPostProcessing();
+	virtual BOOL	RunPostProcessing();	
+	virtual BOOL	ProcessingScanEnd();
+	virtual CString GetResultPath(EM_RESULT_PATH ePath);
+
+	void            AddHistoryData(HISTORY_RESULT Data);
+	void			RunPostProcessing_SaveDefectInfo();
+	void			SetInspectCamera(int iCam,CInspectCamera *pIns);
+	void			SetPrameter(CGlass_Data *pGlsData,CHardwareSettings *pHW,CGlassRecipe *pRecipe,CInspectOption *pInsOpt,CProfileOption *pProfileOpt,CTransfer_Data *pTransData,CResultData *pResultData);
+
+protected:
+	void			JudgementData();
+	void			SaveProfileData();
+	void			SaveChamferData(BOOL bUp);
+	void			SaveDefectData(int nDefect);	
+	void			SetResultData();	
+	void			MergeDefect();
+	void			JudgeThinCrackDefect();
+	BOOL			Judge_CornerChip_Item_ThinCrack(CDefect* pDefect,int nCamIdx);
+	void			CalcGlassSize();
+	int				GetInspectionDefect(MapDefect *mapDefectData);	
+	BOOL			DefectProcess(CInspectDefect* pDefect,CInspectCamera *pInspect);	
+	BOOL			SaveDefectImage(LPBYTE pImage,CSize szImage,CRect rectDefect,CString strFile,DimensionDir emDir);
+	BOOL			SaveDefectImage2(LPBYTE pImage,CSize szImage,CRect rectDefect,CString strFile,DimensionDir emDir);	
+
+protected:
+	BOOL			CheckDirectory(const TCHAR szPathName[]);
+	BOOL			CreateDataDirectory();	
+	void			GetJudgePrm(CDefect *pDefect,int &nJudgeW,int &nJudgeH,BOOL &bAnd,EM_CHIPPING_COMP &eComp,BOOL &bJudgeUse);
+
+protected:
+	CGlass_Data			*m_pGlassData;			
+	CHardwareSettings	*m_pHardware;
+	CGlassRecipe		*m_pRecipe;	
+	CInspectOption		*m_pInspectOpt;
+	CProfileOption		*m_pProfileOpt;
+	CResultData			*m_pResultData;
+	CTransfer_Data		*m_pTransData;
+	CInspectCamera		*m_pInspectCamera[MAX_CAMERA_COUNT];
+
+	CString			m_strResultFolder;
+	CString			m_strDefectFolder;
+	CString			m_strSplineFolder;
+	CString			m_strFullImgeFolder;
+	CString			m_strImageMarkFolder;
+
+	HISTORY_RESULT		m_HistoryData;
+};
+
diff --git a/ENRIT/Data/ResultData.cpp b/ENRIT/Data/ResultData.cpp
new file mode 100644
index 0000000..7684b40
--- /dev/null
+++ b/ENRIT/Data/ResultData.cpp
@@ -0,0 +1,526 @@
+#include "StdAfx.h"
+#include "ResultData.h"
+
+CResultData::CResultData(void)
+{
+	m_pInspectOpt = NULL;
+	m_pProfileOpt = NULL;
+}
+
+CResultData::~CResultData(void)
+{
+}
+
+void CResultData::Reset()
+{
+	m_bGlassResult = TRUE;
+
+	m_strPCID = m_strScanStartTime = m_strScanEndTime = m_strRecipeName = _T("");	
+
+	int		i,j;
+
+	for(i=0;i<2;i++)
+	{
+		m_bNCutSize[i] = TRUE;
+		m_bNCutThick[i] = TRUE;
+
+		for(j=0;j<2;j++)
+		{
+			m_bCornerResWidth[i][j] = TRUE;
+			m_bCornerResHeight[i][j] = TRUE;
+			m_bSplineRes[i][j] = TRUE;
+			m_nCornerImageCamIdx[i][j] = -1;
+		}
+		for(j=0;j<MAX_DIMENSION_COUNT;j++)
+		{
+			m_bCutAreaRes[i][j] = TRUE;
+			m_bDimensionRes[j] = TRUE;
+			m_bCutAreaDiagonalLine[i][j] = TRUE;//20140622
+		}
+	}
+	ZeroMemory(m_dCutAreaPoint,sizeof(double)*2*MAX_DIMENSION_COUNT*RUSULT_POINT_COUNT);
+	ZeroMemory(m_dCutAreaAvg,sizeof(double)*2*MAX_DIMENSION_COUNT);	
+	ZeroMemory(m_dCutAreaDiagonalLine,sizeof(double)*2*MAX_DIMENSION_COUNT);//20140622
+
+	ZeroMemory(m_dDimensionAvg,sizeof(double)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_dDimensionPoint,sizeof(double)*MAX_DIMENSION_COUNT*RUSULT_POINT_COUNT);
+	ZeroMemory(m_dGlassSize,sizeof(double)*2);	
+
+	ZeroMemory(m_dSplineAvg,sizeof(double)*4);
+	ZeroMemory(m_dSplineMaxDefect,sizeof(double)*MAX_DIMENSION_COUNT);	
+	ZeroMemory(m_dSplinePoint,sizeof(double)*4*RUSULT_POINT_COUNT);	
+
+	ZeroMemory(m_bUseNCutChip,sizeof(BOOL)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_bUseNCutSize,sizeof(BOOL)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_dNCutX,sizeof(double)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_dNCutY,sizeof(double)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_dNCutDiff,sizeof(double)*MAX_DIMENSION_COUNT);	
+	ZeroMemory(m_dNCutThick,sizeof(double)*2);		
+	ZeroMemory(m_dNCutAvg,sizeof(double)*2);	
+	ZeroMemory(m_pointCAD,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+	ZeroMemory(m_pointIMG,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+	ZeroMemory(m_dNCutRange,sizeof(double)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528	
+
+	ZeroMemory(m_pointCAD_Dy,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+	ZeroMemory(m_pointIMG_Dy,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+	ZeroMemory(m_dNCutRange_Dy,sizeof(double)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528	
+
+	ZeroMemory(m_pointCAD_Cham,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+	ZeroMemory(m_pointIMG_Cham,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+	ZeroMemory(m_dNCutRange_Cham,sizeof(double)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+
+	for (int k=0; k<2; k++)//20140528
+	{
+		for(int j=0;j<MAX_DIMENSION_COUNT;j++)
+		{
+			for (int i=0; i<NOTCH_RANGE_VAL_MAX_COUNT; i++)
+			{
+				m_bNCutRange[k][j][i] = TRUE;
+				m_bNCutRange_Dy[k][j][i] = TRUE;
+				m_bNCutRange_Cham[k][j][i] = TRUE;
+			}			
+		}
+	}	
+	
+	ZeroMemory(m_nNotchInsCount,sizeof(int)*MAX_DIMENSION_COUNT);//20140528
+
+	ZeroMemory(m_bUseNotchPointIns_Dimen,sizeof(BOOL)*MAX_DIMENSION_COUNT);//20140721
+	ZeroMemory(m_bUseNotchPointIns_Cham,sizeof(BOOL)*MAX_DIMENSION_COUNT);//20140721
+
+	ZeroMemory(m_dCornerWidth,sizeof(double)*4);
+	ZeroMemory(m_dCornerHeight,sizeof(double)*4);	
+
+	ZeroMemory(m_dDefectPosMax,sizeof(double)*MAX_DIMENSION_COUNT);
+
+	m_nDefectCnt = 0;
+	m_pDefectIns = NULL;
+	m_nMaxDefectCam = 0;
+	m_nErrorCountCF = m_nErrorCountTFT = 0;
+	m_nCrackCount = m_nBrokenCount = m_nChipCount = m_nChamferCount = m_nBurrCount = m_nUnknownCount = 0;
+}
+
+CResultData& CResultData::operator=(CResultData& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+
+		m_bGlassResult = rh.m_bGlassResult;
+
+		m_strPCID = rh.m_strPCID;				
+		m_strScanStartTime = rh.m_strScanStartTime;
+		m_strScanEndTime = rh.m_strScanEndTime;
+		m_strRecipeName = rh.m_strRecipeName;
+	
+		CopyMemory(m_bCutAreaRes,rh.m_bCutAreaRes,sizeof(BOOL)*2*MAX_DIMENSION_COUNT);
+		CopyMemory(m_dCutAreaPoint,rh.m_dCutAreaPoint,sizeof(double)*2*MAX_DIMENSION_COUNT*RUSULT_POINT_COUNT);
+		CopyMemory(m_dCutAreaAvg,rh.m_dCutAreaAvg,sizeof(double)*2*MAX_DIMENSION_COUNT);//20140622	
+
+		CopyMemory(m_bCutAreaDiagonalLine,rh.m_bCutAreaDiagonalLine,sizeof(BOOL)*2*MAX_DIMENSION_COUNT);//20140622
+		CopyMemory(m_dCutAreaDiagonalLine,rh.m_dCutAreaDiagonalLine,sizeof(double)*2*MAX_DIMENSION_COUNT);//20140622
+
+		CopyMemory(m_bDimensionRes,rh.m_bDimensionRes,sizeof(BOOL)*MAX_DIMENSION_COUNT);
+		CopyMemory(m_dDimensionAvg,rh.m_dDimensionAvg,sizeof(double)*MAX_DIMENSION_COUNT);
+		CopyMemory(m_dDimensionPoint,rh.m_dDimensionPoint,sizeof(double)*MAX_DIMENSION_COUNT*RUSULT_POINT_COUNT);
+
+		CopyMemory(m_bSplineRes,rh.m_bSplineRes,sizeof(BOOL)*4);
+		CopyMemory(m_dSplineAvg,rh.m_dSplineAvg,sizeof(double)*4);
+		CopyMemory(m_dSplineMaxDefect,rh.m_dSplineMaxDefect,sizeof(double)*MAX_DIMENSION_COUNT);		
+		CopyMemory(m_dSplinePoint,rh.m_dSplinePoint,sizeof(double)*4*RUSULT_POINT_COUNT);		
+
+		CopyMemory(m_bNCutSize,rh.m_bNCutSize,sizeof(BOOL)*2);
+		CopyMemory(m_bNCutThick,rh.m_bNCutThick,sizeof(BOOL)*2);
+		CopyMemory(m_dNCutX,rh.m_dNCutX,sizeof(double)*MAX_DIMENSION_COUNT);
+		CopyMemory(m_dNCutY,rh.m_dNCutY,sizeof(double)*MAX_DIMENSION_COUNT);
+		CopyMemory(m_dNCutDiff,rh.m_dNCutDiff,sizeof(double)*MAX_DIMENSION_COUNT);	
+		CopyMemory(m_dNCutThick,rh.m_dNCutThick,sizeof(double)*2);
+		CopyMemory(m_dNCutAvg,rh.m_dNCutAvg,sizeof(double)*2);		
+		CopyMemory(m_pointCAD,rh.m_pointCAD,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528		
+		CopyMemory(m_pointIMG,rh.m_pointIMG,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528		
+		CopyMemory(m_dNCutRange,rh.m_dNCutRange,sizeof(double)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		CopyMemory(m_bNCutRange,rh.m_bNCutRange,sizeof(BOOL)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+
+		CopyMemory(m_pointCAD_Dy,rh.m_pointCAD_Dy,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528		
+		CopyMemory(m_pointIMG_Dy,rh.m_pointIMG_Dy,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528		
+		CopyMemory(m_dNCutRange_Dy,rh.m_dNCutRange_Dy,sizeof(double)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		CopyMemory(m_bNCutRange_Dy,rh.m_bNCutRange_Dy,sizeof(BOOL)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+
+		CopyMemory(m_pointCAD_Cham,rh.m_pointCAD_Cham,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528		
+		CopyMemory(m_pointIMG_Cham,rh.m_pointIMG_Cham,sizeof(CPoint)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528		
+		CopyMemory(m_dNCutRange_Cham,rh.m_dNCutRange_Cham,sizeof(double)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		CopyMemory(m_bNCutRange_Cham,rh.m_bNCutRange_Cham,sizeof(double)*2*MAX_DIMENSION_COUNT*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+
+		CopyMemory(m_nNotchInsCount,rh.m_nNotchInsCount,sizeof(int)*MAX_DIMENSION_COUNT);//20140528
+
+		CopyMemory(m_bCornerResWidth,rh.m_bCornerResWidth,sizeof(BOOL)*4);
+		CopyMemory(m_bCornerResHeight,rh.m_bCornerResHeight,sizeof(BOOL)*4);
+		CopyMemory(m_dCornerWidth,rh.m_dCornerWidth,sizeof(double)*4);
+		CopyMemory(m_dCornerHeight,rh.m_dCornerHeight,sizeof(double)*4);
+		CopyMemory(m_nCornerImageCamIdx,rh.m_nCornerImageCamIdx,sizeof(int)*4);
+
+		CopyMemory(m_dDefectPosMax,rh.m_dDefectPosMax,sizeof(double)*MAX_DIMENSION_COUNT);				
+		m_nMaxDefectCam = rh.m_nMaxDefectCam;
+		m_nDefectCnt = rh.m_nDefectCnt;
+		m_pDefectIns = rh.m_pDefectIns;
+		m_nErrorCountCF = rh.m_nErrorCountCF;
+		m_nErrorCountTFT = rh.m_nErrorCountTFT;
+		m_nCrackCount = rh.m_nCrackCount;
+		m_nBrokenCount = rh.m_nBrokenCount;
+		m_nChipCount = rh.m_nChipCount;
+		m_nChamferCount = rh.m_nChamferCount;
+		m_nBurrCount = rh.m_nBurrCount;
+		m_nUnknownCount = rh.m_nUnknownCount;
+
+		CopyMemory(m_nLeftLineMargin,rh.m_nLeftLineMargin,sizeof(int)*MAX_DIMENSION_COUNT*2);
+	}
+	return *this;
+}
+
+void CResultData::TrimString()
+{
+	m_strPCID.TrimLeft(_T(" "));m_strPCID.TrimRight(_T(" "));		
+	m_strScanStartTime.TrimLeft(_T(" "));m_strScanStartTime.TrimRight(_T(" "));
+	m_strScanEndTime.TrimLeft(_T(" "));m_strScanEndTime.TrimRight(_T(" "));
+	m_strRecipeName.TrimLeft(_T(" "));m_strRecipeName.TrimRight(_T(" "));	
+}
+
+double CResultData::GetCutAreaAvg(std::vector<STU_THICKPOS*> *pCamThick,CAMERA_DIR camDir)
+{
+	if(pCamThick == NULL || (int)pCamThick->size() <= 0)
+		return 0.;
+
+	double			dSum,dCnt;
+	std::vector<STU_THICKPOS*>::iterator it;
+	STU_THICKPOS	*pThick;	
+
+	dSum = dCnt = 0.;
+
+	for(it=pCamThick->begin();it!=pCamThick->end();it++)
+	{
+		pThick = *it;
+		if(pThick == NULL || pThick->dThick <= 0)
+			continue;
+
+		switch(camDir)
+		{
+		case CAMDIR_TOP:
+			dSum += pThick->dThick;
+			dCnt++;
+			break;
+		case CAMDIR_BOTTOM:
+			dSum += pThick->dThick;
+			dCnt++;
+			break;
+		}
+	}
+
+	return dCnt > 0?dSum/dCnt:0.;
+}
+
+BOOL CResultData::GetRangeCheck(int nBase,int nMinus,int nPlus,int nValue)
+{
+	if(nValue > nBase+nPlus || nValue < nBase-nMinus)
+		return FALSE;
+
+	return TRUE;
+}
+
+double CResultData::GetCutAreaStdDev(std::vector<STU_THICKPOS*> *pCamThick,CAMERA_DIR camDir,double dAvg)
+{
+	if(pCamThick == NULL || (int)pCamThick->size() <= 0)
+		return 0.;
+
+	std::vector<STU_THICKPOS*>::iterator it;
+	STU_THICKPOS	*pThick;
+	double			dStdDev,dSum,dCnt;	
+
+	dSum = dCnt = dStdDev = 0.;
+	for(it=pCamThick->begin();it!=pCamThick->end();it++)
+	{
+		pThick = *it;
+		if(pThick == NULL || pThick->dThick <= 0)
+			continue;
+
+		switch(camDir)
+		{
+		case CAMDIR_TOP:
+			dSum += pow((dAvg-pThick->dThick),2);
+			break;
+		case CAMDIR_BOTTOM:
+			dSum += pow((dAvg-pThick->dThick),2);
+			break;
+		}
+		dCnt++;
+	}
+
+	return dCnt>0?sqrt(dSum/dCnt):0.;
+}
+
+BOOL CResultData::GetJudgePointMaxMin(std::vector<STU_THICKPOS> *pVecThick,int &nMinPos,int &nMaxPos)
+{
+	std::vector<STU_THICKPOS>::iterator it;
+	STU_THICKPOS		stuThick;
+
+	nMinPos = INT_MAX,nMaxPos = 0;
+
+	for(it=pVecThick->begin();it!=pVecThick->end();it++)
+	{
+		stuThick = *it;				
+		if(nMinPos > stuThick.yCoordi) nMinPos = (int)stuThick.yCoordi;
+		if(nMaxPos < stuThick.yCoordi) nMaxPos = (int)stuThick.yCoordi;	
+	}
+
+	return TRUE;
+}
+
+#define CUTAREA_CALCULATE_SIZE		50000
+double CResultData::GetJudgePointRangeValue(std::vector<STU_THICKPOS> *pVecThick,int nGlassSize,int iPos)
+{	
+	std::vector<STU_THICKPOS>::iterator		it;
+	STU_THICKPOS	stuThick;
+	int			nRange[2];			
+
+	if(iPos-CUTAREA_CALCULATE_SIZE < 0)
+	{
+		nRange[0] = 0;
+		nRange[1] = CUTAREA_CALCULATE_SIZE*2;
+	}
+	else if(iPos+CUTAREA_CALCULATE_SIZE > nGlassSize)
+	{
+		nRange[0] = nGlassSize - CUTAREA_CALCULATE_SIZE*2;
+		nRange[1] = nGlassSize;
+	}
+	else
+	{
+		nRange[0] = iPos - CUTAREA_CALCULATE_SIZE;
+		nRange[1] = iPos + CUTAREA_CALCULATE_SIZE;
+	}
+
+	double		dValue = 0.,dSum = 0.,dCnt = 0;
+	for(it=pVecThick->begin();it!=pVecThick->end();it++)
+	{
+		stuThick = *it;		
+
+		if(nRange[0] <= stuThick.yCoordi && nRange[1] >= stuThick.yCoordi)
+		{
+			dSum +=	stuThick.dThick;
+			dCnt++;			
+		}
+	}
+
+	if(dCnt > 0)
+		dValue = dSum/dCnt;
+
+	return dValue;
+}
+
+void CResultData::GetJudgePointValue(std::vector<STU_THICKPOS> *pVecThick,CAMERA_DIR camDir,DimensionDir enDir,int nGlassSize)
+{
+	if(pVecThick == NULL || (int)pVecThick->size() <= 0)
+		return;
+
+	double			dSum = 0.;
+	double			dCount = 0.;
+	int				nMinPos,nMaxPos;
+
+	if(GetJudgePointMaxMin(pVecThick,nMinPos,nMaxPos) == FALSE)
+		return;	
+
+	int				nJumpVal = abs(nMaxPos-nMinPos)/RUSULT_POINT_COUNT;
+	int				i;
+
+	for(i=0;i<RUSULT_POINT_COUNT-1;i++)
+	{
+		m_dCutAreaPoint[camDir][enDir][i] = GetJudgePointRangeValue(pVecThick,nGlassSize,nMinPos+nJumpVal*i);
+	}
+	m_dCutAreaPoint[camDir][enDir][RUSULT_POINT_COUNT-1] = GetJudgePointRangeValue(pVecThick,nGlassSize,nMaxPos);
+}
+
+BOOL CResultData::FlipImage(LPBYTE pImg,CSize szImg)
+{
+	LPBYTE		pTgt = new BYTE[szImg.cx*szImg.cy];
+	int			v,iPos;
+
+	iPos = 0;
+	for(v=szImg.cy-1;v>=0;v--,iPos++)
+	{
+		CopyMemory(&pTgt[iPos*szImg.cx],&pImg[v*szImg.cx],szImg.cx);
+	}
+
+	CopyMemory(pImg,pTgt,szImg.cx*szImg.cy);
+	delete[] pTgt,pTgt=NULL;
+
+	return TRUE;
+}
+
+void CResultData::Save_FullImgProc_ROI(LPBYTE pImg,CSize szImg,CRect ROI,LPBYTE lpIn)
+{
+	if(pImg == NULL || szImg.cx <= 0 || szImg.cy <= 0)
+		return;	
+
+	int nYStart = ROI.top;
+	int nXStart = ROI.left; 
+	
+	//LPBYTE lpStart = pImg + (nYStart % szImg.cy) * szImg.cx + nXStart;
+	LPBYTE lpStart = pImg + nYStart * szImg.cx + nXStart;
+
+	for (int i = 0; i < ROI.Height(); i++)
+	{
+		memcpy(lpIn + i * ROI.Width(), lpStart + i * szImg.cx, ROI.Width());		
+	}
+ 	CSize szTemp;
+ 	szTemp = CSize(ROI.Width(),ROI.Height());
+ 	FlipImage(lpIn,szTemp);
+}
+
+double CResultData::GetDimensionAvg(std::vector<STU_DIMENSIONPOS*> *pResult)
+{
+	if(pResult == NULL || pResult->size() <= 0)
+		return 0.;
+
+	std::vector<STU_DIMENSIONPOS*>::iterator it;
+	double				dSum,dCount;
+	STU_DIMENSIONPOS	*pDimen;
+
+	dSum = dCount = 0.;
+	for(it=pResult->begin();it!=pResult->end();it++)
+	{
+		pDimen = *it;
+		if(pDimen == NULL || pDimen->dSize <= 0)
+			continue;					
+
+		dSum+=pDimen->dSize;
+		dCount++;				
+	}
+
+	return dCount>0?dSum/dCount:0.;
+}
+
+double CResultData::GetDimensionStd(std::vector<STU_DIMENSIONPOS*> *pResult,double dAvg)
+{
+	if(pResult == NULL || pResult->size() <= 0)
+		return 0.;
+
+	std::vector<STU_DIMENSIONPOS*>::iterator it;
+	double				dSum,dCount;
+	STU_DIMENSIONPOS	*pDimen;
+
+	dSum = dCount = 0.;
+	for(it=pResult->begin();it!=pResult->end();it++)
+	{
+		pDimen = *it;
+		if(pDimen == NULL || pDimen->dSize <= 0)
+			continue;					
+
+		dSum += pow((dAvg-pDimen->dSize),2);	
+		dCount++;				
+	}
+
+	return dCount>0?sqrt(dSum/dCount):0.;
+}
+
+void CResultData::GetDimensionPointValue(std::vector<STU_DIMENSIONPOS> *pData,DimensionDir enDir)
+{
+	std::vector<STU_DIMENSIONPOS>::iterator	it;
+	STU_DIMENSIONPOS	pDimen;
+	double				dMinVal,dMaxVal;
+
+	dMinVal = INT_MAX;
+	dMaxVal = 0;
+	for(it=pData->begin();it!=pData->end();it++)
+	{
+		pDimen = *it;		
+
+		if(dMinVal > pDimen.yCoordi) dMinVal = pDimen.yCoordi;
+		if(dMaxVal < pDimen.yCoordi) dMaxVal = pDimen.yCoordi;		
+	}
+
+	double			dJumpVal = fabs(dMaxVal-dMinVal)/RUSULT_POINT_COUNT;
+
+	for(int i=0;i<RUSULT_POINT_COUNT;i++)
+	{
+		m_dDimensionPoint[enDir][i] = GetDimensionPointRangeValue(pData,dMinVal+dJumpVal*i);
+	}
+	m_dDimensionPoint[enDir][RUSULT_POINT_COUNT-1] = GetDimensionPointRangeValue(pData,dMaxVal);
+}
+
+double CResultData::GetDimensionPointRangeValue(std::vector<STU_DIMENSIONPOS> *pData,double dPos)
+{
+	double		dDiffVal = INT_MAX;
+	double		dValue;
+	std::vector<STU_DIMENSIONPOS>::iterator	it;
+	STU_DIMENSIONPOS	pDimen;
+
+	dValue = 0;
+	for(it=pData->begin();it!=pData->end();it++)
+	{
+		pDimen = *it;		
+
+		if(dDiffVal > fabs(pDimen.yCoordi-dPos))
+		{
+			dDiffVal = fabs(pDimen.yCoordi-dPos);
+			dValue = pDimen.dSize;			
+		}
+	}
+
+	return dValue;
+}
+
+void CResultData::CalJudgement()
+{
+	int			i,j;
+
+	// CutArea
+	for(i=0;i<2;i++)//20140603
+	{
+		for(j=0;j<MAX_DIMENSION_COUNT;j++)
+		{
+			m_bGlassResult &= m_bCutAreaRes[i][j];
+			m_bGlassResult &= m_bCutAreaDiagonalLine[i][j];
+		}
+	}
+
+	// Dimension
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)//20140603
+	{
+		m_bGlassResult &= m_bDimensionRes[i];		
+	}
+	
+	// Spline,Corner Cut,Notch
+	m_bGlassResult &= m_bNCutSize[CAMDIR_TOP];
+	for(i=0;i<2;i++)
+	{		
+		m_bGlassResult &= m_bNCutThick[i];
+		for(j=0;j<2;j++)
+		{
+		//	m_bGlassResult &= m_bSplineRes[i][j];
+			m_bGlassResult &= m_bCornerResWidth[i][j];
+			m_bGlassResult &= m_bCornerResHeight[i][j];
+		}
+	}
+
+	// Defect
+	if(m_nDefectCnt > 0)
+		m_bGlassResult = FALSE;
+
+	//Notch Range Value//20140721(Dim/cham盒府)
+	for (int iDim = 0; iDim<MAX_DIMENSION_COUNT; iDim++)
+	{
+		if(m_bUseNotchPointIns_Dimen[iDim] == TRUE)
+		{
+			for (int i=0; i<NOTCH_RANGE_VAL_MAX_COUNT; i++)
+			{
+				m_bGlassResult &= m_bNCutRange[CAMDIR_TOP][iDim][i];
+			}
+		}
+		if(m_bUseNotchPointIns_Cham[iDim] == TRUE)
+		{
+			for(int i=0; i<NOTCH_RANGE_VAL_MAX_COUNT; i++)
+			{
+				m_bGlassResult &= m_bNCutRange_Cham[CAMDIR_TOP][iDim][i];
+				m_bGlassResult &= m_bNCutRange_Cham[CAMDIR_BOTTOM][iDim][i];
+			}
+		}
+	}
+}
+
diff --git a/ENRIT/Data/ResultData.h b/ENRIT/Data/ResultData.h
new file mode 100644
index 0000000..37c856a
--- /dev/null
+++ b/ENRIT/Data/ResultData.h
@@ -0,0 +1,108 @@
+#pragma once
+
+#include "InspectDefect.h"
+#include "Global_Define.h"
+
+#define		RUSULT_POINT_COUNT		5
+
+class CCameraSettings;
+class CResultData
+{
+public:
+	CResultData(void);	
+	virtual ~CResultData(void);
+	CResultData& operator=(CResultData& rh);
+
+public:
+	void				Reset();
+	void				TrimString();
+	void				CalJudgement();		
+	void				SetInspectOpt(CInspectOption *pInsOpt,CProfileOption *pProfileOpt){m_pInspectOpt=pInsOpt,m_pProfileOpt=pProfileOpt;}
+
+public:
+	BOOL				m_bGlassResult;	
+	CString				m_strRecipeName,m_strScanStartTime,m_strScanEndTime,m_strPCID;
+
+// Cut Area
+	BOOL				m_bCutAreaRes[2][MAX_DIMENSION_COUNT];
+	double				m_dCutAreaPoint[2][MAX_DIMENSION_COUNT][RUSULT_POINT_COUNT];
+	double				m_dCutAreaAvg[2][MAX_DIMENSION_COUNT];
+	BOOL				m_bCutAreaDiagonalLine[2][MAX_DIMENSION_COUNT];//20140622
+	double				m_dCutAreaDiagonalLine[2][MAX_DIMENSION_COUNT];//20140622
+	double				GetCutAreaAvg(std::vector<STU_THICKPOS*> *pCamThick,CAMERA_DIR camDir);
+	double				GetCutAreaStdDev(std::vector<STU_THICKPOS*> *pCamThick,CAMERA_DIR camDir,double dAvg);
+	BOOL				GetRangeCheck(int nBase,int nMinus,int nPlus,int nValue);
+	void				GetJudgePointValue(std::vector<STU_THICKPOS> *pVecThick,CAMERA_DIR camDir,DimensionDir enDir,int nGlassSize);
+	BOOL				GetJudgePointMaxMin(std::vector<STU_THICKPOS> *pVecThick,int &nMinPos,int &nMaxPos);
+	double				GetJudgePointRangeValue(std::vector<STU_THICKPOS> *pVecThick,int nGlassSize,int iPos);		
+	void				Save_FullImgProc_ROI(LPBYTE pImg,CSize szImg,CRect ROI,LPBYTE lpIn);
+	BOOL				FlipImage(LPBYTE pImg,CSize szImg);
+
+// Dimension
+	BOOL				m_bDimensionRes[MAX_DIMENSION_COUNT];
+	double				m_dDimensionAvg[MAX_DIMENSION_COUNT];
+	double				m_dDimensionPoint[MAX_DIMENSION_COUNT][RUSULT_POINT_COUNT];
+	double				m_dGlassSize[2];
+	double				GetDimensionAvg(std::vector<STU_DIMENSIONPOS*> *pResult);
+	double				GetDimensionStd(std::vector<STU_DIMENSIONPOS*> *pResult,double dAvg);
+	void				GetDimensionPointValue(std::vector<STU_DIMENSIONPOS> *pData,DimensionDir enDir);
+	double				GetDimensionPointRangeValue(std::vector<STU_DIMENSIONPOS> *pData,double dPos);
+
+// Spline
+	BOOL				m_bSplineRes[2][2];
+	double				m_dSplineAvg[2][2];
+	double				m_dSplinePoint[2][2][RUSULT_POINT_COUNT];
+	double				m_dSplineMaxDefect[MAX_DIMENSION_COUNT];
+
+// Notch
+	BOOL				m_bUseNCutSize[MAX_DIMENSION_COUNT];
+	BOOL				m_bUseNCutChip[MAX_DIMENSION_COUNT];
+	BOOL				m_bNCutSize[2];
+	BOOL				m_bNCutThick[2];
+	double				m_dNCutThick[2];
+	double				m_dNCutAvg[2];
+	double				m_dNCutX[MAX_DIMENSION_COUNT];
+	double				m_dNCutY[MAX_DIMENSION_COUNT];
+	double				m_dNCutDiff[MAX_DIMENSION_COUNT];
+	CPoint				m_pointCAD[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint				m_pointIMG[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	double				m_dNCutRange[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	BOOL				m_bNCutRange[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+
+	CPoint				m_pointCAD_Dy[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint				m_pointIMG_Dy[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	double				m_dNCutRange_Dy[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	BOOL				m_bNCutRange_Dy[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+
+	CPoint				m_pointCAD_Cham[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint				m_pointIMG_Cham[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	double				m_dNCutRange_Cham[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	BOOL				m_bNCutRange_Cham[2][MAX_DIMENSION_COUNT][NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+
+	int					m_nNotchInsCount[MAX_DIMENSION_COUNT];//20140528
+	BOOL				m_bUseNotchPointIns_Dimen[MAX_DIMENSION_COUNT];//20140721
+	BOOL				m_bUseNotchPointIns_Cham[MAX_DIMENSION_COUNT];//20140721
+
+// Corner Cut
+	BOOL				m_bCornerResWidth[2][2];	
+	BOOL				m_bCornerResHeight[2][2];	
+	double				m_dCornerWidth[2][2];
+	double				m_dCornerHeight[2][2];
+	int					m_nCornerImageCamIdx[2][2];
+
+// Defect
+	int					m_nCrackCount,m_nBrokenCount,m_nChipCount,m_nChamferCount,m_nBurrCount,m_nUnknownCount;
+	double				m_dDefectPosMax[MAX_DIMENSION_COUNT];	
+	int					m_nErrorCountCF;
+	int					m_nErrorCountTFT;
+	int					m_nMaxDefectCam;
+	MapDefect			*m_pDefectIns;
+	int					m_nDefectCnt;
+	void				SetDefectIns(MapDefect *pMapDefect,int nDefectCnt){m_pDefectIns=pMapDefect,m_nDefectCnt=nDefectCnt;}
+
+//Left Line
+	int					m_nLeftLineMargin[MAX_DIMENSION_COUNT];
+
+	CInspectOption		*m_pInspectOpt;
+	CProfileOption		*m_pProfileOpt;
+};
diff --git a/ENRIT/Data/ResultFile.cpp b/ENRIT/Data/ResultFile.cpp
new file mode 100644
index 0000000..3cca6be
--- /dev/null
+++ b/ENRIT/Data/ResultFile.cpp
@@ -0,0 +1,1265 @@
+#include "StdAfx.h"
+#include "ResultFile.h"
+
+CResultFile::CResultFile(void)
+{
+	m_pCurResult = NULL;
+	m_bCut = m_bCorner = m_bDim = m_bSpline = m_bNotch = FALSE;
+}
+
+CResultFile::CResultFile(CResultData *pResult)
+{
+	m_bMakeResultFile = TRUE;
+	m_gBase = g_pBase;
+	m_pCurResult = pResult;
+	if(m_pCurResult == NULL)
+	{
+		g_pLog->DisplayMessage(_T("Result Data Fail! : CurGlass is NULL"));		
+		m_bMakeResultFile = FALSE;
+	}
+
+	if(m_gBase->m_strHPanelID.IsEmpty() == TRUE)
+	{
+		g_pLog->DisplayMessage(_T("Result Data Fail! : No PanelID"));		
+		m_bMakeResultFile = FALSE;
+	}
+}
+
+CResultFile::~CResultFile(void)
+{
+}
+
+void CResultFile::SetInsParm(BOOL bCut,BOOL bCorner,BOOL bDim,BOOL bSpline,BOOL bNotch)
+{
+	m_bCut = bCut;
+	m_bCorner = bCorner;
+	m_bDim = bDim;
+	m_bSpline = bSpline;
+	m_bNotch = bNotch;
+}
+
+BOOL CResultFile::MakeResultFile(CString strFolder,CString strFolder_Notch,BOOL bFinalResult)//20140528
+{
+	if(m_bMakeResultFile == FALSE || m_pCurResult == NULL)
+		return FALSE;
+
+	CString			strGlassID,strPath;
+	CString			strContents,strValue;
+	CStdioFile		*pFile = NULL;
+	CFileException	ex;
+	CString			strHostID;
+	CString			strContents_Notch, strPath_Notch;//20140528
+	CStdioFile		*pFile_Notch = NULL;//20140528
+	CFileException	ex_Notch;//20140528
+
+	strGlassID = m_gBase->m_strHPanelID;	
+	strPath.Format(_T("%s\\%s.csv"),strFolder,strGlassID);
+	strPath_Notch.Format(_T("%s\\%s.csv"),strFolder_Notch,strGlassID);//20140528
+	
+	pFile = new CStdioFile();
+	if (!pFile->Open(strPath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex))
+	{
+#ifdef _DEBUG
+		TCHAR   szCause[255] = {0};
+		ex.GetErrorMessage(szCause, 255);
+		g_pLog->DisplayMessage(_T("Result Data Fail! : File Open Fail[%s]"),szCause);
+#endif
+		if (pFile) 
+			delete pFile,pFile = NULL;	
+	}
+
+	pFile_Notch = new CStdioFile();//20140528
+	if (!pFile_Notch->Open(strPath_Notch, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex_Notch))//20140528
+	{
+#ifdef _DEBUG
+		TCHAR   szCause[255] = {0};
+		ex_Notch.GetErrorMessage(szCause, 255);
+		g_pLog->DisplayMessage(_T("Result Notch Data Fail! : File Open Fail[%s]"),szCause);
+#endif
+		if (pFile_Notch) 
+			delete pFile_Notch,pFile_Notch = NULL;		
+	}
+
+	BOOL		bResult;//20140528
+	bResult = MakeResultRaw(strContents,strContents_Notch,m_bCorner);//20140528
+
+	if(strContents.GetLength() > 0 && pFile != NULL)
+		pFile->WriteString(strContents);	
+
+	if (pFile && pFile->m_hFile != CFile::hFileNull) 
+		pFile->Close();	
+	if (pFile) 
+		delete pFile,pFile = NULL;	
+
+	if(strContents_Notch.GetLength() > 0 && pFile_Notch != NULL)//20140528
+		pFile_Notch->WriteString(strContents_Notch);	
+
+	if (pFile_Notch && pFile_Notch->m_hFile != CFile::hFileNull) //20140528
+		pFile_Notch->Close();	
+	if (pFile_Notch) //20140528
+		delete pFile_Notch,pFile_Notch = NULL;		
+
+	return bResult;
+}
+
+void CResultFile::MakeChamferResult(CString &strContents,BOOL bCornerIns)
+{
+	double		*dRangeVal,dCutAvg;
+	BOOL		bResult;
+	CString		strResult,strValue;	
+
+	bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_TOP][DIMENSION_A];
+	dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_A];
+	dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_TOP][DIMENSION_A][0];
+
+//	if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountCF < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
+	if(bResult == FALSE)//20140603
+		strResult = _T("NG");
+	else if(bResult == TRUE) strResult = _T("OK");
+//	else strResult = _T("NG");	//20140603
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Chamfer Upper APos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Chamfer Upper APos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+	else
+		strValue.Format(_T("[Chamfer Upper APos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	g_pLog->DisplayMessage(_T("[1]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountCF);//20140603
+
+	bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_BOTTOM][DIMENSION_A];
+	dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_A];
+	dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_BOTTOM][DIMENSION_A][0];
+//	if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
+	if(bResult == FALSE)//20140603
+		strResult = _T("NG");
+	else if(bResult == TRUE) strResult = _T("OK");
+//	else strResult = _T("NG");//20140603
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Chamfer Lower APos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Chamfer Lower APos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+	else
+		strValue.Format(_T("[Chamfer Lower APos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	g_pLog->DisplayMessage(_T("[2]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountTFT);//20140603
+
+	bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_TOP][DIMENSION_B];
+	dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_B];
+	dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_TOP][DIMENSION_B][0];
+//	if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountCF < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
+	if(bResult == FALSE)//20140603
+		strResult = _T("NG");
+	else if(bResult == TRUE) strResult = _T("OK");
+//	else strResult = _T("NG");//20140603
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Chamfer Upper BPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Chamfer Upper BPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+	else
+		strValue.Format(_T("[Chamfer Upper BPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	g_pLog->DisplayMessage(_T("[3]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountCF);//20140603
+
+	bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_BOTTOM][DIMENSION_B];
+	dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_B];
+	dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_BOTTOM][DIMENSION_B][0];
+//	if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
+	if(bResult == FALSE)//20140603
+		strResult = _T("NG");
+	else if(bResult == TRUE) strResult = _T("OK");
+	//	else strResult = _T("NG");//20140603
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Chamfer Lower BPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Chamfer Lower BPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+	else
+		strValue.Format(_T("[Chamfer Lower BPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	g_pLog->DisplayMessage(_T("[4]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountTFT);//20140603
+
+	bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_TOP][DIMENSION_C];
+	dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_C];
+	dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_TOP][DIMENSION_C][0];
+	//	if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
+	if(bResult == FALSE)//20140603
+		strResult = _T("NG");
+	else if(bResult == TRUE) strResult = _T("OK");
+	//	else strResult = _T("NG");//20140603
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Chamfer Upper CPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Chamfer Upper CPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+	else
+		strValue.Format(_T("[Chamfer Upper CPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	g_pLog->DisplayMessage(_T("[5]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountCF);//20140603
+
+	bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_BOTTOM][DIMENSION_C];
+	dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_C];
+	dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_BOTTOM][DIMENSION_C][0];
+	//	if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
+	if(bResult == FALSE)//20140603
+		strResult = _T("NG");
+	else if(bResult == TRUE) strResult = _T("OK");
+	//	else strResult = _T("NG");//20140603
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Chamfer Lower CPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Chamfer Lower CPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+	else
+		strValue.Format(_T("[Chamfer Lower CPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	g_pLog->DisplayMessage(_T("[6]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountTFT);//20140603
+
+	bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_TOP][DIMENSION_D];
+	dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_D];
+	dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_TOP][DIMENSION_D][0];
+	//	if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
+	if(bResult == FALSE)//20140603
+		strResult = _T("NG");
+	else if(bResult == TRUE) strResult = _T("OK");
+	//	else strResult = _T("NG");//20140603
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Chamfer Upper DPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Chamfer Upper DPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+	else
+		strValue.Format(_T("[Chamfer Upper DPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	g_pLog->DisplayMessage(_T("[7]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountCF);//20140603
+
+	bResult = m_pCurResult->m_bCutAreaRes[CAMDIR_BOTTOM][DIMENSION_D];
+	dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_D];
+	dRangeVal = &m_pCurResult->m_dCutAreaPoint[CAMDIR_BOTTOM][DIMENSION_D][0];
+	//	if(bCornerIns == TRUE && m_pCurResult->m_nErrorCountTFT < MAX_ERROR_COUNT) strResult = _T("OK");//20140603
+	if(bResult == FALSE)//20140603
+		strResult = _T("NG");
+	else if(bResult == TRUE) strResult = _T("OK");
+	//	else strResult = _T("NG");//20140603
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Chamfer Lower DPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Chamfer Lower DPos]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dCutAvg,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+	else
+		strValue.Format(_T("[Chamfer Lower DPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	g_pLog->DisplayMessage(_T("[8]bResult,dCutAvg,dRangeVal %d, %d,%d,%d"),bResult,dCutAvg,dRangeVal,m_pCurResult->m_nErrorCountTFT);//20140603
+
+	if(m_bCut == TRUE)
+	{
+		dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_A];
+		strValue.Format(_T("[Chamfer Upper APos Specific Area]\r\n%.3f\r\n"),dCutAvg);
+		strContents += strValue;
+
+		dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_A];	
+		strValue.Format(_T("[Chamfer Lower APos Specific Area]\r\n%.3f\r\n"),dCutAvg);
+		strContents += strValue;
+
+		dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_B];
+		strValue.Format(_T("[Chamfer Upper BPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
+		strContents += strValue;
+
+		dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_B];	
+		strValue.Format(_T("[Chamfer Lower BPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
+		strContents += strValue;
+
+		dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_C];	
+		strValue.Format(_T("[Chamfer Upper CPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
+		strContents += strValue;
+
+		dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_C];	
+		strValue.Format(_T("[Chamfer Lower CPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
+		strContents += strValue;
+
+		dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_TOP][DIMENSION_D];	
+		strValue.Format(_T("[Chamfer Upper DPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
+		strContents += strValue;
+
+		dCutAvg = m_pCurResult->m_dCutAreaAvg[CAMDIR_BOTTOM][DIMENSION_D];	
+		strValue.Format(_T("[Chamfer Lower DPos Specific Area]\r\n%.3f\r\n"),dCutAvg);
+		strContents += strValue;
+	}
+	else
+	{		
+		strValue.Format(_T("[Chamfer Upper APos Specific Area]\r\n*\r\n"));
+		strContents += strValue;
+	
+		strValue.Format(_T("[Chamfer Lower APos Specific Area]\r\n*\r\n"));
+		strContents += strValue;
+
+		strValue.Format(_T("[Chamfer Upper BPos Specific Area]\r\n*\r\n"));
+		strContents += strValue;
+
+		strValue.Format(_T("[Chamfer Lower BPos Specific Area]\r\n*\r\n"));
+		strContents += strValue;
+
+		strValue.Format(_T("[Chamfer Upper CPos Specific Area]\r\n*\r\n"));
+		strContents += strValue;
+
+		strValue.Format(_T("[Chamfer Lower CPos Specific Area]\r\n*\r\n"));
+		strContents += strValue;
+
+		strValue.Format(_T("[Chamfer Upper DPos Specific Area]\r\n*\r\n"));
+		strContents += strValue;
+
+		strValue.Format(_T("[Chamfer Lower DPos Specific Area]\r\n*\r\n"));
+		strContents += strValue;
+	}
+}
+
+void CResultFile::MakeChamferDiagonalLineResult(CString &strContents)//20140622
+{
+	double		dDiagonalLineValue;
+	BOOL		bResult;
+	CString		strResult,strValue;	
+
+	bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_A];
+	dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_A];
+	if(bResult == TRUE) strResult = _T("OK");
+	else strResult = _T("NG");	
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Diagonal Line Ins Upper APos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Diagonal Line Ins Upper APos]\r\n%.3f\r\n"),dDiagonalLineValue);	
+	else
+		strValue.Format(_T("[Diagonal Line Ins Upper APos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_A];
+	dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_A];
+	if(bResult == TRUE) strResult = _T("OK");
+	else strResult = _T("NG");	
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Diagonal Line Ins Lower APos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Diagonal Line Ins Lower APos]\r\n%.3f\r\n"),dDiagonalLineValue);	
+	else
+		strValue.Format(_T("[Diagonal Line Ins Lower APos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_B];
+	dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_B];
+	if(bResult == TRUE) strResult = _T("OK");
+	else strResult = _T("NG");	
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Diagonal Line Ins Upper BPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Diagonal Line Ins Upper BPos]\r\n%.3f\r\n"),dDiagonalLineValue);	
+	else
+		strValue.Format(_T("[Diagonal Line Ins Upper BPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_B];
+	dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_B];
+	if(bResult == TRUE) strResult = _T("OK");
+	else strResult = _T("NG");	
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Diagonal Line Ins Lower BPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Diagonal Line Ins Lower BPos]\r\n%.3f\r\n"),dDiagonalLineValue);	
+	else
+		strValue.Format(_T("[Diagonal Line Ins Lower BPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_C];
+	dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_C];
+	if(bResult == TRUE) strResult = _T("OK");
+	else strResult = _T("NG");	
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Diagonal Line Ins Upper CPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Diagonal Line Ins Upper CPos]\r\n%.3f\r\n"),dDiagonalLineValue);	
+	else
+		strValue.Format(_T("[Diagonal Line Ins Upper CPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_C];
+	dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_C];
+	if(bResult == TRUE) strResult = _T("OK");
+	else strResult = _T("NG");	
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Diagonal Line Ins Lower CPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Diagonal Line Ins Lower CPos]\r\n%.3f\r\n"),dDiagonalLineValue);	
+	else
+		strValue.Format(_T("[Diagonal Line Ins Lower CPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_D];
+	dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_TOP][DIMENSION_D];
+	if(bResult == TRUE) strResult = _T("OK");
+	else strResult = _T("NG");	
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Diagonal Line Ins Upper DPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Diagonal Line Ins Upper DPos]\r\n%.3f\r\n"),dDiagonalLineValue);	
+	else
+		strValue.Format(_T("[Diagonal Line Ins Upper DPos]\r\n*\r\n"));	
+	strContents += strValue;
+
+	bResult = m_pCurResult->m_bCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_D];
+	dDiagonalLineValue = m_pCurResult->m_dCutAreaDiagonalLine[CAMDIR_BOTTOM][DIMENSION_D];
+	if(bResult == TRUE) strResult = _T("OK");
+	else strResult = _T("NG");	
+	if(m_bCut == FALSE) strResult = _T("*");
+	strValue.Format(_T("[Diagonal Line Ins Lower DPos Result]\r\n%s\r\n"),strResult);	
+	strContents += strValue;
+	if(m_bCut == TRUE)
+		strValue.Format(_T("[Diagonal Line Ins Lower DPos]\r\n%.3f\r\n"),dDiagonalLineValue);	
+	else
+		strValue.Format(_T("[Diagonal Line Ins Lower DPos]\r\n*\r\n"));	
+	strContents += strValue;
+}
+
+void CResultFile::MakeDimensionResult(CString &strContents,BOOL bCornerIns)
+{
+	double		*dRangeVal;
+	BOOL		bResult;
+	CString		strResult,strValue;	
+	double		dAvgDimen;
+
+	if(m_bDim == TRUE)
+	{
+		dRangeVal = &m_pCurResult->m_dDimensionPoint[DIMENSION_A][0];
+		bResult = m_pCurResult->m_bDimensionRes[DIMENSION_A];
+		dAvgDimen = m_pCurResult->m_dDimensionAvg[DIMENSION_A];		
+		if(bResult == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Dimension APos Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Dimension APos Size]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dAvgDimen,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+		strContents += strValue;
+
+		dRangeVal = &m_pCurResult->m_dDimensionPoint[DIMENSION_B][0];
+		bResult = m_pCurResult->m_bDimensionRes[DIMENSION_B];
+		dAvgDimen = m_pCurResult->m_dDimensionAvg[DIMENSION_B];
+		if(bResult == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Dimension BPos Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Dimension BPos Size]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dAvgDimen,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+		strContents += strValue;
+
+		dRangeVal = &m_pCurResult->m_dDimensionPoint[DIMENSION_C][0];
+		bResult = m_pCurResult->m_bDimensionRes[DIMENSION_C];
+		dAvgDimen = m_pCurResult->m_dDimensionAvg[DIMENSION_C];
+		if(bResult == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Dimension CPos Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Dimension CPos Size]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dAvgDimen,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+		strContents += strValue;
+
+		dRangeVal = &m_pCurResult->m_dDimensionPoint[DIMENSION_D][0];
+		bResult = m_pCurResult->m_bDimensionRes[DIMENSION_D];
+		dAvgDimen = m_pCurResult->m_dDimensionAvg[DIMENSION_D];
+		if(bResult == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Dimension DPos Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Dimension DPos Size]\r\n%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dAvgDimen,dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+		strContents += strValue;
+	}
+	else
+	{
+		strValue.Format(_T("[Dimension APos Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Dimension APos Size]\r\n*\r\n"));	
+		strContents += strValue;
+
+		strValue.Format(_T("[Dimension BPos Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Dimension BPos Size]\r\n*\r\n"));	
+		strContents += strValue;
+		
+		strValue.Format(_T("[Dimension CPos Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Dimension CPos Size]\r\n*\r\n"));	
+		strContents += strValue;
+	
+		strValue.Format(_T("[Dimension DPos Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Dimension DPos Size]\r\n*\r\n"));	
+		strContents += strValue;
+	}
+}
+
+void CResultFile::MakeSplineResult(CString &strContents)
+{	
+	double		dSpline,*dSpMaxDefect;
+	double		*dRangeVal;
+	BOOL		bResult;
+	CString		strResult,strValue;	
+
+	if(m_bSpline == TRUE)
+	{
+		dSpMaxDefect = m_pCurResult->m_dSplineMaxDefect;	
+		dSpline = m_pCurResult->m_dSplineAvg[1][1];		// Left 窍何
+		bResult = m_pCurResult->m_bSplineRes[1][1];
+		dRangeVal = &m_pCurResult->m_dSplinePoint[1][1][0];
+		if(bResult == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Spline CCut Left Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Left Size]\r\n%.3f\r\n"),dSpline);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Left MaxDefect]\r\n%.3f\r\n"),dSpMaxDefect[0]);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Left Range]\r\n%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+		strContents += strValue;
+
+		dSpline = m_pCurResult->m_dSplineAvg[1][0];		// Left 惑何
+		bResult = m_pCurResult->m_bSplineRes[1][0];
+		dRangeVal = &m_pCurResult->m_dSplinePoint[1][0][0];
+		if(bResult == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Spline CCut Right Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Right Size]\r\n%.3f\r\n"),dSpline);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Right MaxDefect]\r\n%.3f\r\n"),dSpMaxDefect[1]);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Right Range]\r\n%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+		strContents += strValue;
+
+		dSpline = m_pCurResult->m_dSplineAvg[0][1];		// Right 惑何
+		bResult = m_pCurResult->m_bSplineRes[0][1];	
+		dRangeVal = &m_pCurResult->m_dSplinePoint[0][1][0];
+		if(bResult == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Spline RCut Left Result]\r\n%s\r\n"),strResult);
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Left Size]\r\n%.3f\r\n"),dSpline);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Left MaxDefect]\r\n%.3f\r\n"),dSpMaxDefect[2]);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Left Range]\r\n%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+		strContents += strValue;
+
+		dSpline = m_pCurResult->m_dSplineAvg[0][0];		// Right 窍何
+		bResult = m_pCurResult->m_bSplineRes[0][0];	
+		dRangeVal = &m_pCurResult->m_dSplinePoint[0][0][0];
+		if(bResult == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Spline RCut Right Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Right Size]\r\n%.3f\r\n"),dSpline);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Right MaxDefect]\r\n%.3f\r\n"),dSpMaxDefect[3]);	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Right Range]\r\n%.3f,%.3f,%.3f,%.3f,%.3f\r\n"),dRangeVal[0],dRangeVal[1],dRangeVal[2],dRangeVal[3],dRangeVal[4]);	
+		strContents += strValue;
+	}
+	else
+	{
+		strValue.Format(_T("[Spline CCut Left Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Left Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Left MaxDefect]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Left Range]\r\n*\r\n"));	
+		strContents += strValue;
+		
+		strValue.Format(_T("[Spline CCut Right Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Right Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Right MaxDefect]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline CCut Right Range]\r\n*\r\n"));	
+		strContents += strValue;
+	
+		strValue.Format(_T("[Spline RCut Left Result]\r\n*\r\n"));
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Left Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Left MaxDefect]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Left Range]\r\n*\r\n"));	
+		strContents += strValue;
+	
+		strValue.Format(_T("[Spline RCut Right Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Right Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Right MaxDefect]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Spline RCut Right Range]\r\n*\r\n"));	
+		strContents += strValue;
+	}
+}
+
+void CResultFile::MakeCornerResult(CString &strContents)
+{
+	//////////////////////////////////////////////////////////////////////////
+	// Corner	
+	CString		strResult,strValue;	
+
+	if(m_bCorner == TRUE)
+	{
+		BOOL    bResultWidth = m_pCurResult->m_bCornerResWidth[1][1];	
+		double	dCornerWidth = m_pCurResult->m_dCornerWidth[1][1];
+		BOOL    bResultHeight = m_pCurResult->m_bCornerResHeight[1][1];	
+		double	dCornerHeight = m_pCurResult->m_dCornerHeight[1][1];
+		if(bResultWidth == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Corner Left Upper Width Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Upper Width Size]\r\n%.3f\r\n"),dCornerWidth);	
+		strContents += strValue;
+		if(bResultHeight == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Corner Left Upper Height Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Upper Height Size]\r\n%.3f\r\n"),dCornerHeight);	
+		strContents += strValue;
+
+		bResultWidth = m_pCurResult->m_bCornerResWidth[1][0];	
+		dCornerWidth = m_pCurResult->m_dCornerWidth[1][0];
+		bResultHeight = m_pCurResult->m_bCornerResHeight[1][0];	
+		dCornerHeight = m_pCurResult->m_dCornerHeight[1][0];
+		if(bResultWidth == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Corner Right Upper Width Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Upper Width Size]\r\n%.3f\r\n"),dCornerWidth);	
+		strContents += strValue;
+		if(bResultHeight == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Corner Right Upper Height Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Upper Height Size]\r\n%.3f\r\n"),dCornerHeight);	
+		strContents += strValue;
+
+		bResultWidth = m_pCurResult->m_bCornerResWidth[0][1];	
+		dCornerWidth = m_pCurResult->m_dCornerWidth[0][1];
+		bResultHeight = m_pCurResult->m_bCornerResHeight[0][1];	
+		dCornerHeight = m_pCurResult->m_dCornerHeight[0][1];
+		if(bResultWidth == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Corner Left Lower Width Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Lower Width Size]\r\n%.3f\r\n"),dCornerWidth);	
+		strContents += strValue;
+		if(bResultHeight == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Corner Left Lower Height Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Lower Height Size]\r\n%.3f\r\n"),dCornerHeight);	
+		strContents += strValue;
+
+		bResultWidth = m_pCurResult->m_bCornerResWidth[0][0];	
+		dCornerWidth = m_pCurResult->m_dCornerWidth[0][0];
+		bResultHeight = m_pCurResult->m_bCornerResHeight[0][0];	
+		dCornerHeight = m_pCurResult->m_dCornerHeight[0][0];
+		if(bResultWidth == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Corner Right Lower Width Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Lower Width Size]\r\n%.3f\r\n"),dCornerWidth);	
+		strContents += strValue;
+		if(bResultHeight == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Corner Right Lower Height Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Lower Height Size]\r\n%.3f\r\n"),dCornerHeight);	
+		strContents += strValue;
+	}
+	else
+	{
+		strValue.Format(_T("[Corner Left Upper Width Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Upper Width Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Upper Height Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Upper Height Size]\r\n*\r\n"));	
+		strContents += strValue;
+		
+		strValue.Format(_T("[Corner Right Upper Width Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Upper Width Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Upper Height Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Upper Height Size]\r\n*\r\n"));	
+		strContents += strValue;
+		
+		strValue.Format(_T("[Corner Left Lower Width Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Lower Width Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Lower Height Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Left Lower Height Size]\r\n*\r\n"));	
+		strContents += strValue;
+	
+		strValue.Format(_T("[Corner Right Lower Width Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Lower Width Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Lower Height Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Corner Right Lower Height Size]\r\n*\r\n"));	
+		strContents += strValue;
+	}
+}
+
+void CResultFile::MakeNotchResult(CString &strContents)
+{
+	////////////////////
+	double dNotchAvgThick = 0.;
+	BOOL bNotchAvgThick = FALSE;
+	CString		strResult,strValue;	
+
+	if(m_bNotch == TRUE)
+	{
+		dNotchAvgThick = m_pCurResult->m_dNCutThick[CAMDIR_TOP];
+		bNotchAvgThick = m_pCurResult->m_bNCutThick[CAMDIR_TOP];
+		if(bNotchAvgThick == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Notch Chamfer Top Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Chamfer Top]\r\n%.3f\r\n"),dNotchAvgThick);	
+		strContents += strValue;
+
+		dNotchAvgThick = m_pCurResult->m_dNCutThick[CAMDIR_BOTTOM];
+		bNotchAvgThick = m_pCurResult->m_bNCutThick[CAMDIR_BOTTOM];
+		if(bNotchAvgThick == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Notch Chamfer Bottom Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Chamfer Bottom]\r\n%.3f\r\n"),dNotchAvgThick);	
+		strContents += strValue;	
+
+		double dNotch=0.;
+		BOOL bNotch = FALSE;
+
+		dNotch = m_pCurResult->m_dNCutAvg[CAMDIR_TOP];
+		bNotch = m_pCurResult->m_bNCutSize[CAMDIR_TOP];
+		if(bNotch == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Notch Top Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Top Size]\r\n%.3f\r\n"),dNotch);	
+		strContents += strValue;
+
+		dNotch = m_pCurResult->m_dNCutAvg[CAMDIR_BOTTOM];
+		bNotch = m_pCurResult->m_bNCutSize[CAMDIR_BOTTOM];
+		if(bNotch == TRUE) strResult = _T("OK");
+		else strResult = _T("NG");
+		strValue.Format(_T("[Notch Bottom Result]\r\n%s\r\n"),strResult);	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Bottom Size]\r\n%.3f\r\n"),dNotch);	
+		strContents += strValue;
+
+		strValue.Format(_T("[Notch Dx Size]\r\n%d,%d,%d,%d\r\n"),(int)m_pCurResult->m_dNCutX[DIMENSION_A],(int)m_pCurResult->m_dNCutX[DIMENSION_B]
+		,(int)m_pCurResult->m_dNCutX[DIMENSION_C],(int)m_pCurResult->m_dNCutX[DIMENSION_D]);	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Dy Size]\r\n%d,%d,%d,%d\r\n"),(int)m_pCurResult->m_dNCutY[DIMENSION_A],(int)m_pCurResult->m_dNCutY[DIMENSION_B]
+		,(int)m_pCurResult->m_dNCutY[DIMENSION_C],(int)m_pCurResult->m_dNCutY[DIMENSION_D]);	
+		strContents += strValue;
+
+		CString			strTmp,strPosTmp[3],strPos[3];
+		for(int iDim=0;iDim<MAX_DIMENSION_COUNT;iDim++)
+		{						
+			strPos[0] = strPos[1] = strPos[2] = _T("");
+			int iR;
+			for(iR=0;iR<RANGE_VAL_COUNT;iR++)
+			{
+				if(iR != RANGE_VAL_COUNT-1)
+				{
+					strPosTmp[0].Format(_T("%d,"),m_pCurResult->m_pointIMG[0][iDim][iR].x);//20140528
+					strPosTmp[1].Format(_T("%d,"),m_pCurResult->m_pointIMG[0][iDim][iR].y);//20140528
+					strPosTmp[2].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange[0][iDim][iR]);//20140528
+				}
+				else
+				{
+					strPosTmp[0].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG[0][iDim][iR].x);//20140528								
+					strPosTmp[1].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG[0][iDim][iR].y);//20140528
+					strPosTmp[2].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange[0][iDim][iR]);//20140528
+				}
+				strPos[0] += strPosTmp[0];			
+				strPos[1] += strPosTmp[1];
+				strPos[2] += strPosTmp[2];						
+			}
+
+			switch(iDim)
+			{
+			case 0: strTmp="A"; break;
+			case 1: strTmp="B"; break;
+			case 2: strTmp="C"; break;
+			case 3: strTmp="D"; break;
+			}
+
+			strValue.Format(_T("[%s Notch Range Position X]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[0];
+			strValue.Format(_T("[%s Notch Range Position Y]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[1];
+			strValue.Format(_T("[%s Notch Range Value]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[2];
+		}	
+	}
+	else
+	{
+		strValue.Format(_T("[Notch Chamfer Top Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Chamfer Top]\r\n*\r\n"));	
+		strContents += strValue;
+
+		strValue.Format(_T("[Notch Chamfer Bottom Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Chamfer Bottom]\r\n*\r\n"));	
+		strContents += strValue;	
+
+		strValue.Format(_T("[Notch Top Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Top Size]\r\n*\r\n"));	
+		strContents += strValue;
+
+		strValue.Format(_T("[Notch Bottom Result]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Bottom Size]\r\n*\r\n"));	
+		strContents += strValue;
+
+		strValue.Format(_T("[Notch Dx Size]\r\n*\r\n"));	
+		strContents += strValue;
+		strValue.Format(_T("[Notch Dy Size]\r\n*\r\n"));	
+		strContents += strValue;
+
+		CString			strTmp,strPosTmp[3],strPos[3];
+		for(int iDim=0;iDim<MAX_DIMENSION_COUNT;iDim++)
+		{						
+			strPos[0] = strPos[1] = strPos[2] = _T("");
+			int iR;
+			for(iR=0;iR<RANGE_VAL_COUNT;iR++)
+			{
+				if(iR != RANGE_VAL_COUNT-1)
+				{
+					strPosTmp[0].Format(_T("*,"));
+					strPosTmp[1].Format(_T("*,"));
+					strPosTmp[2].Format(_T("*,"));
+				}
+				else
+				{
+					strPosTmp[0].Format(_T("*\r\n"));								
+					strPosTmp[1].Format(_T("*\r\n"));
+					strPosTmp[2].Format(_T("*\r\n"));
+				}
+				strPos[0] += strPosTmp[0];			
+				strPos[1] += strPosTmp[1];
+				strPos[2] += strPosTmp[2];						
+			}
+
+			switch(iDim)
+			{
+			case 0: strTmp=_T("A"); break;
+			case 1: strTmp=_T("B"); break;
+			case 2: strTmp=_T("C"); break;
+			case 3: strTmp=_T("D"); break;
+			case 4: strTmp=_T("A_DN"); break;
+			case 5: strTmp=_T("B_DN"); break;
+			case 6: strTmp=_T("C_DN"); break;
+			case 7: strTmp=_T("D_DN"); break;
+			}
+
+			strValue.Format(_T("[%s Notch Range Position X]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[0];
+			strValue.Format(_T("[%s Notch Range Position Y]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[1];
+			strValue.Format(_T("[%s Notch Range Value]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[2];
+		}	
+	}
+}
+
+void CResultFile::MakeNotchInsPointResult(CString &strContents)//20140528
+{
+	CString		strResult,strValue;	
+	CString		strTmp,strPosTmp[8],strPos[8];
+	CString		strInsCount;
+	int			nDefaultNotchInsCount = 9;
+	BOOL		bNCutRangeDim, bNCutRangeChamTop, bNCutRangeChamBot;
+		
+	if(m_bNotch == TRUE)
+	{
+		for(int iDim=0;iDim<MAX_DIMENSION_COUNT;iDim++)
+		{						
+			strPos[0] = strPos[1] = strPos[2] = strPos[3] = strPos[4] = _T("");
+			bNCutRangeDim = bNCutRangeChamTop = bNCutRangeChamBot = TRUE;
+
+			int iR;
+			for(iR=0;iR<m_pCurResult->m_nNotchInsCount[iDim];iR++)
+			{
+				if(iR != m_pCurResult->m_nNotchInsCount[iDim]-1)
+				{
+					strPosTmp[0].Format(_T("%d,"),m_pCurResult->m_pointIMG[0][iDim][iR].x);
+					strPosTmp[1].Format(_T("%d,"),m_pCurResult->m_pointIMG[0][iDim][iR].y);
+					strPosTmp[2].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange[0][iDim][iR]);
+					strPosTmp[3].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange_Cham[0][iDim][iR]);
+					strPosTmp[4].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange_Cham[1][iDim][iR]);
+					strPosTmp[5].Format(_T("%d,"),m_pCurResult->m_pointIMG_Dy[0][iDim][iR].x);
+					strPosTmp[6].Format(_T("%d,"),m_pCurResult->m_pointIMG_Dy[0][iDim][iR].y);
+					strPosTmp[7].Format(_T("%.2f,"),m_pCurResult->m_dNCutRange_Dy[0][iDim][iR]);
+				}
+				else
+				{
+					strPosTmp[0].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG[0][iDim][iR].x);								
+					strPosTmp[1].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG[0][iDim][iR].y);
+					strPosTmp[2].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange[0][iDim][iR]);
+					strPosTmp[3].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange_Cham[0][iDim][iR]);
+					strPosTmp[4].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange_Cham[1][iDim][iR]);
+					strPosTmp[5].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG_Dy[0][iDim][iR].x);								
+					strPosTmp[6].Format(_T("%d\r\n"),m_pCurResult->m_pointIMG_Dy[0][iDim][iR].y);
+					strPosTmp[7].Format(_T("%.2f\r\n"),m_pCurResult->m_dNCutRange_Dy[0][iDim][iR]);
+				}
+				strPos[0] += strPosTmp[0];			
+				strPos[1] += strPosTmp[1];
+				strPos[2] += strPosTmp[2];	
+				strPos[3] += strPosTmp[3];	
+				strPos[4] += strPosTmp[4];
+				strPos[5] += strPosTmp[5];			
+				strPos[6] += strPosTmp[6];
+				strPos[7] += strPosTmp[7];
+
+				bNCutRangeDim &= m_pCurResult->m_bNCutRange[0][iDim][iR];
+				bNCutRangeChamTop &= m_pCurResult->m_bNCutRange_Cham[0][iDim][iR];
+				bNCutRangeChamBot &= m_pCurResult->m_bNCutRange_Cham[1][iDim][iR];
+			}
+
+			switch(iDim)
+			{
+			case 0: strTmp="A"; break;
+			case 1: strTmp="B"; break;
+			case 2: strTmp="C"; break;
+			case 3: strTmp="D"; break;
+			}
+
+			strValue.Format(_T("[%s Notch Range Count]\r\n"),strTmp);
+			strContents += strValue;
+			strInsCount.Format(_T("%d\r\n"),m_pCurResult->m_nNotchInsCount[iDim]);
+			strContents += strInsCount;
+			
+			strValue.Format(_T("[%s Notch Range Position X]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[0];
+			strValue.Format(_T("[%s Notch Range Position Y]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[1];
+
+			if(bNCutRangeDim == TRUE)
+				strResult = _T("OK\r\n");
+			else
+				strResult = _T("NG\r\n");
+			strValue.Format(_T("[%s Notch Range Dimension Result]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strResult;
+
+			strValue.Format(_T("[%s Notch Range Dimension Value]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[2];
+
+			if(bNCutRangeChamTop == TRUE)
+				strResult = _T("OK\r\n");
+			else
+				strResult = _T("NG\r\n");
+			strValue.Format(_T("[%s Notch Range Chamfer Top Result]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strResult;
+
+			strValue.Format(_T("[%s Notch Range Chamfer Top Value]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[3];
+
+			if(bNCutRangeChamBot == TRUE)
+				strResult = _T("OK\r\n");
+			else
+				strResult = _T("NG\r\n");
+			strValue.Format(_T("[%s Notch Range Chamfer Bot Result]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strResult;
+
+			strValue.Format(_T("[%s Notch Range Chamfer Bot Value]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[4];
+
+			strValue.Format(_T("[%s Notch Range Position X_Dy]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[5];
+			strValue.Format(_T("[%s Notch Range Position Y_Dy]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[6];
+
+			strValue.Format(_T("[%s Notch Range Dimension Value_Dy]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[7];
+		}	
+	}
+	else
+	{
+		for(int iDim=0;iDim<MAX_DIMENSION_COUNT;iDim++)
+		{						
+			strPos[0] = strPos[1] = strPos[2] = strPos[3] = strPos[4] = strPos[5] = strPos[6] = strPos[7] = _T("");
+			int iR;
+			for(iR=0;iR<nDefaultNotchInsCount;iR++)
+			{
+				if(iR != nDefaultNotchInsCount-1)
+				{
+					strPosTmp[0].Format(_T("*,"));
+					strPosTmp[1].Format(_T("*,"));
+					strPosTmp[2].Format(_T("*,"));
+					strPosTmp[3].Format(_T("*,"));
+					strPosTmp[4].Format(_T("*,"));
+					strPosTmp[5].Format(_T("*,"));
+					strPosTmp[6].Format(_T("*,"));
+					strPosTmp[7].Format(_T("*,"));
+				}
+				else
+				{
+					strPosTmp[0].Format(_T("*\r\n"));								
+					strPosTmp[1].Format(_T("*\r\n"));
+					strPosTmp[2].Format(_T("*\r\n"));
+					strPosTmp[3].Format(_T("*\r\n"));
+					strPosTmp[4].Format(_T("*\r\n"));
+					strPosTmp[5].Format(_T("*\r\n"));
+					strPosTmp[6].Format(_T("*\r\n"));
+					strPosTmp[7].Format(_T("*\r\n"));
+				}
+				strPos[0] += strPosTmp[0];			
+				strPos[1] += strPosTmp[1];
+				strPos[2] += strPosTmp[2];	
+				strPos[3] += strPosTmp[3];
+				strPos[4] += strPosTmp[4];	
+				strPos[5] += strPosTmp[5];
+				strPos[6] += strPosTmp[6];
+				strPos[7] += strPosTmp[7];
+			}
+
+			switch(iDim)
+			{
+			case DIMENSION_A: strTmp = _T("A"); break;
+			case DIMENSION_B: strTmp = _T("B"); break;
+			case DIMENSION_C: strTmp = _T("C"); break;
+			case DIMENSION_D: strTmp = _T("D"); break;
+			case DIMENSION_A_DN: strTmp = _T("A_DN"); break;
+			case DIMENSION_B_DN: strTmp = _T("B_DN"); break;
+			case DIMENSION_C_DN: strTmp = _T("C_DN"); break;
+			case DIMENSION_D_DN: strTmp = _T("D_DN"); break;
+			}
+
+			strValue.Format(_T("[%s Notch Range Count]\r\n"),strTmp);
+			strContents += strValue;
+			strInsCount.Format(_T("%d\r\n"),nDefaultNotchInsCount);
+			strContents += strInsCount;
+
+			strValue.Format(_T("[%s Notch Range Position X]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[0];
+			strValue.Format(_T("[%s Notch Range Position Y]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[1];
+			strValue.Format(_T("[%s Notch Range Dimension Result]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += _T("*\r\n");
+			strValue.Format(_T("[%s Notch Range Dimension Value]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[2];
+			strValue.Format(_T("[%s Notch Range Chamfer Top Result]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += _T("*\r\n");
+			strValue.Format(_T("[%s Notch Range Chamfer Top Value]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[3];
+			strValue.Format(_T("[%s Notch Range Chamfer Bot Result]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += _T("*\r\n");
+			strValue.Format(_T("[%s Notch Range Chamfer Bot Value]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[4];
+			strValue.Format(_T("[%s Notch Range Position X_Dy]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[5];
+			strValue.Format(_T("[%s Notch Range Position Y_Dy]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[6];
+			strValue.Format(_T("[%s Notch Range Dimension Value_Dy]\r\n"),strTmp);
+			strContents += strValue;
+			strContents += strPos[7];
+		}	
+	}
+}
+
+void CResultFile::MakeEtcResult(CString &strContents)
+{
+	CString		strResult,strValue;	
+
+	strValue.Format(_T("[Glass Size X]\r\n%.3f\r\n"),m_pCurResult->m_dGlassSize[0]);	
+	strContents += strValue;
+	strValue.Format(_T("[Glass Size Y]\r\n%.3f\r\n"),m_pCurResult->m_dGlassSize[1]);
+	strContents += strValue;
+	
+	strValue.Format(_T("[A Left Line Margin]\r\n"));
+	strContents += strValue;
+	strValue.Format(_T("%d,%d\r\n"),m_pCurResult->m_nLeftLineMargin[0],m_pCurResult->m_nLeftLineMargin[1]);
+	strContents += strValue;
+
+	strValue.Format(_T("[B Left Line Margin]\r\n"));
+	strContents += strValue;
+	strValue.Format(_T("%d,%d\r\n"),m_pCurResult->m_nLeftLineMargin[2],m_pCurResult->m_nLeftLineMargin[3]);
+	strContents += strValue;
+
+	strValue.Format(_T("[C Left Line Margin]\r\n"));
+	strContents += strValue;
+	strValue.Format(_T("%d,%d\r\n"),m_pCurResult->m_nLeftLineMargin[4],m_pCurResult->m_nLeftLineMargin[5]);
+	strContents += strValue;
+
+	strValue.Format(_T("[D Left Line Margin]\r\n"));
+	strContents += strValue;
+	strValue.Format(_T("%d,%d\r\n"),m_pCurResult->m_nLeftLineMargin[6],m_pCurResult->m_nLeftLineMargin[7]);
+	strContents += strValue;
+}
+
+BOOL CResultFile::MakeResultRaw(CString &strContents, CString &strContents_Notch, BOOL bCornerIns)//20140528
+{
+	CString		strValue;	
+	
+	strValue.Format(_T("[Host ID]\r\n%s\r\n"),m_gBase->m_strHPanelID);	
+	strContents += strValue;	
+
+	strValue.Format(_T("[Start Date]\r\n%s\r\n"),(m_pCurResult->m_strScanStartTime).Left(8));	
+	strContents += strValue;
+
+	strValue.Format(_T("[Start Time]\r\n%s\r\n"),(m_pCurResult->m_strScanStartTime).Mid(9,6));	
+	strContents += strValue;
+
+	strValue.Format(_T("[End Date]\r\n%s\r\n"),(m_pCurResult->m_strScanEndTime).Left(8));	
+	strContents += strValue;
+
+	strValue.Format(_T("[End Time]\r\n%s\r\n"),(m_pCurResult->m_strScanEndTime).Mid(9,6));	
+	strContents += strValue;
+
+	strValue.Format(_T("[Recipe Name]\r\n%s\r\n"),m_pCurResult->m_strRecipeName);	
+	strContents += strValue;
+
+	CString		strMachine = _T("RCut Machine");
+	strValue.Format(_T("[Machine Name]\r\n%s\r\n"),strMachine);	
+	strContents += strValue;		
+	
+	strContents_Notch = strContents;//20140528
+	
+	MakeChamferResult(strContents,bCornerIns);
+	MakeChamferDiagonalLineResult(strContents);//20140622
+	MakeDimensionResult(strContents,bCornerIns);
+	MakeSplineResult(strContents);
+	MakeCornerResult(strContents);
+	MakeNotchResult(strContents);
+	MakeEtcResult(strContents);
+	MakeDefectRaw(strContents);
+
+	MakeNotchInsPointResult(strContents_Notch);//20140528
+	
+	return TRUE;
+}
+
+void CResultFile::MakeDefectRaw(CString &strContents)
+{
+	if(m_pCurResult->m_pDefectIns == NULL || m_pCurResult->m_nDefectCnt <= 0)
+		return;
+		
+	CString			strValue,strTmp;
+
+	strValue.Format(_T("[Information of Detections]\r\n"));	
+	strContents += strValue;
+	
+	int			iDefect = 0;
+	CInspectDefect	*pDefect;
+	DimensionDir	emDir;		
+	MapDefectIt		it;
+	
+	for(it=m_pCurResult->m_pDefectIns->begin();it!=m_pCurResult->m_pDefectIns->end();it++,iDefect++)
+	{		
+		pDefect = static_cast<CInspectDefect*>(it->second);		
+		if(pDefect == NULL)
+			continue;
+		
+		strValue.Format(_T("%d,"),iDefect);
+		strContents += strValue;
+
+		emDir = (DimensionDir)pDefect->m_nSideLoc;		
+		strContents += PANEL_SIDE[emDir];
+
+		if(pDefect->m_nCameraDir == 0)
+			strValue = _T("Top,");
+		else
+			strValue = _T("Bot,");
+		strContents += strValue;
+
+		strValue.Format(_T("%d,"),pDefect->m_nUMOriginX);
+		strContents += strValue;
+
+		strValue.Format(_T("%d,"),pDefect->m_nUMOriginY);
+		strContents += strValue;
+
+		strValue.Format(_T("%d,"),pDefect->m_nUMSize);
+		strContents += strValue;
+
+		strValue.Format(_T("%d,"),pDefect->m_sDefectPeak);
+		strContents += strValue;
+
+		strValue.Format(_T("%d,"),pDefect->m_nUMSizeX);
+		strContents += strValue;
+
+		strValue.Format(_T("%d,"),pDefect->m_nUMSizeY);
+		strContents += strValue;
+
+		strValue.Format(_T("%d,"),pDefect->m_nDefectRScale);
+		strContents += strValue;
+
+		switch(pDefect->m_sDefectLoc)
+		{
+		case 0: strValue.Format(_T("Crack")); break;			
+		case 1: strValue.Format(_T("Broken")); break;				
+		case 2: strValue.Format(_T("Chip")); break;			
+		case 3: strValue.Format(_T("Chamfer")); break;			
+		case 4: strValue.Format(_T("Burr")); break;		
+		case 5: strValue.Format(_T("Thin")); break;
+		case 6: strValue.Format(_T("Area")); break;
+		case 7: strValue.Format(_T("NCut")); break;
+		case 8: strValue.Format(_T("CCD Hole")); break;
+		case 9: strValue.Format(_T("Profile")); break;
+		default: strValue.Format(_T("Unknown")); break;			
+		}
+		strContents += strValue;		
+		strContents += _T(",\r\n");
+	}
+}
diff --git a/ENRIT/Data/ResultFile.h b/ENRIT/Data/ResultFile.h
new file mode 100644
index 0000000..b3f90e2
--- /dev/null
+++ b/ENRIT/Data/ResultFile.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "Global_Define.h"
+#include "ResultData.h"
+
+#define MAX_ERROR_COUNT		20
+class CResultFile
+{
+public:
+	CResultFile(void);	
+	CResultFile(CResultData *pResult);
+	virtual ~CResultFile(void);
+
+public:
+	BOOL				MakeResultFile(CString strFolder,CString strFolder_Notch,BOOL bFinalResult);//20140528
+	void				SetInsParm(BOOL bCut,BOOL bCorner,BOOL bDim,BOOL bSpline,BOOL bNotch);	
+
+protected:
+	BOOL				MakeResultRaw(CString &strContents,CString &strContents_Notch,BOOL bCornerIns);//20140528
+	void				MakeDefectRaw(CString &strContents);
+	void				MakeChamferResult(CString &strContents,BOOL bCornerIns);
+	void				MakeChamferDiagonalLineResult(CString &strContents);//20140622
+	void				MakeDimensionResult(CString &strContents,BOOL bCornerIns);
+	void				MakeSplineResult(CString &strContents);
+	void				MakeCornerResult(CString &strContents);
+	void				MakeNotchResult(CString &strContents);
+	void				MakeEtcResult(CString &strContents);
+	void				MakeNotchInsPointResult(CString &strContents);//20140528
+	
+protected:
+	CResultData			*m_pCurResult;
+	CInspectionBase		*m_gBase;
+	BOOL				m_bMakeResultFile;
+	BOOL				m_bCut,m_bCorner,m_bDim,m_bSpline,m_bNotch;	
+};
diff --git a/ENRIT/Data/StopWatch.cpp b/ENRIT/Data/StopWatch.cpp
new file mode 100644
index 0000000..d8c0c3b
--- /dev/null
+++ b/ENRIT/Data/StopWatch.cpp
@@ -0,0 +1,45 @@
+// StopWatch.cpp: implementation of the CStopWatch class.
+//
+//////////////////////////////////////////////////////////////////////
+#include "stdafx.h"
+#include "StopWatch.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CStopWatch::CStopWatch()
+{
+	m_swFreq.LowPart = m_swFreq.HighPart = 0;
+	m_swStart = m_swFreq;
+	m_swEnd = m_swFreq;
+	m_fTimeforDuration = 0;
+
+	QueryPerformanceFrequency(&m_swFreq);
+//	m_swFreq.QuadPart = (LONGLONG)(2.41f*1024*1024*1024);
+}
+
+CStopWatch::~CStopWatch()
+{
+}
+
+void CStopWatch::Start(void)
+{
+	QueryPerformanceCounter(&m_swStart);
+}
+
+void CStopWatch::End(void)
+{
+	QueryPerformanceCounter(&m_swEnd);
+	m_fTimeforDuration = (m_swEnd.QuadPart - m_swStart.QuadPart)/(float)m_swFreq.QuadPart; 
+}
+
+
+
+
diff --git a/ENRIT/Data/StopWatch.h b/ENRIT/Data/StopWatch.h
new file mode 100644
index 0000000..f67e952
--- /dev/null
+++ b/ENRIT/Data/StopWatch.h
@@ -0,0 +1,36 @@
+// StopWatch.h: interface for the CStopWatch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_STOPWATCH_H__C2068F0F_528F_43C3_9A72_ECA8A4DCAFA2__INCLUDED_)
+#define AFX_STOPWATCH_H__C2068F0F_528F_43C3_9A72_ECA8A4DCAFA2__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <afxwin.h>
+
+class CStopWatch  
+{
+public:
+	CStopWatch();
+	virtual ~CStopWatch();
+
+public:
+	void Start(void);
+	void End(void);
+	const float GetDurationSecond(void) const { return m_fTimeforDuration; }
+	const float GetDurationMilliSecond(void) const { return m_fTimeforDuration*1000.f; }
+
+public:
+	LARGE_INTEGER GetStartInteger(void) const { return m_swStart; }
+	LARGE_INTEGER GetEndInteger(void) const { return m_swEnd; }
+	LARGE_INTEGER GetFrequency(void) const { return m_swFreq; }
+
+protected:
+	LARGE_INTEGER		m_swFreq, m_swStart, m_swEnd;
+	float				m_fTimeforDuration;
+};
+
+#endif // !defined(AFX_STOPWATCH_H__C2068F0F_528F_43C3_9A72_ECA8A4DCAFA2__INCLUDED_)
diff --git a/ENRIT/Data/TransDataManager.cpp b/ENRIT/Data/TransDataManager.cpp
new file mode 100644
index 0000000..3a4814f
--- /dev/null
+++ b/ENRIT/Data/TransDataManager.cpp
@@ -0,0 +1,428 @@
+#include "StdAfx.h"
+#include "TransDataManager.h"
+#include <fstream>
+#include <iostream>
+
+CTransDataManager& CTransDataManager::operator=(const CTransDataManager& rhs)
+{
+	if (this != &rhs)
+	{
+		ResetData();
+		m_DataPackTotalByteSize = rhs.m_DataPackTotalByteSize;
+		m_TransDataPackMap = rhs.m_TransDataPackMap;
+		m_TransDataPackMapiterator = rhs.m_TransDataPackMapiterator;
+	}	
+	return *this;
+}
+
+
+CTransDataManager::CTransDataManager()
+{
+
+}
+
+CTransDataManager::~CTransDataManager()
+{
+	m_vTransDataList.clear();
+
+	for(m_TransDataPackMapiterator = m_TransDataPackMap.begin(); m_TransDataPackMapiterator != m_TransDataPackMap.end(); ++m_TransDataPackMapiterator)
+	{
+		CTransDataPack* pPack = m_TransDataPackMapiterator->second;
+		if(pPack != NULL)
+			delete pPack;
+	}
+	m_TransDataPackMap.clear();
+	m_DataPackTotalByteSize = 0;
+}
+
+BOOL CTransDataManager::LoadTransItemFromFile(CString FilePath)
+{
+	m_TransDataPackMap.clear();
+	m_DataPackTotalByteSize = 0;
+
+	CString ItemName;
+	int		ItemByte;
+	CString	ItemType;
+	EnumPackType ePackType = eAscii;
+	CString tmpItemByte;
+
+	char LineStr[200];		//茄 临窜困 佬绢甸捞绰 滚欺
+	char *tmpStr;			//窜困肺 谗篮 单捞磐甫 啊府虐绰 器牢磐
+	char *strType;
+	char seps[]=" ,\t\n";	//备盒磊
+
+	std::ifstream input;
+	input.open(FilePath, std::ios::in /*| std::ios::nocreate*/);
+	if (!input.is_open())
+	{
+		input.close();		
+		return FALSE;
+	}
+
+	do 
+	{
+		ZeroMemory(LineStr, 200);
+		input.getline(LineStr, 200);
+
+		// Lise
+		tmpStr = strtok_s(LineStr, seps, &strType);
+		if(tmpStr == NULL) continue;
+		ItemName = tmpStr;
+		tmpStr = strtok_s(NULL, seps, &strType);
+		if(tmpStr == NULL) break;
+		tmpItemByte = tmpStr;
+		ItemByte = _tstoi(tmpItemByte);
+
+		tmpStr = strtok_s(NULL, seps, &strType);
+		if(tmpStr == NULL) break;
+		ItemType = tmpStr;
+		if(ItemType == _T("A"))
+		{
+			ePackType = eAscii;
+		}
+		else
+		{
+			ePackType = eUnsignedDec;
+		}
+		InsertTransItemToMap(ItemName, ItemByte,-1,ePackType);
+	} while(!input.eof());
+	input.close();
+	return TRUE;
+}
+
+void CTransDataManager::InsertTransItemToMap(CString ItemName, int ItemByte, int Key, EnumPackType ePackType)
+{
+	int KeyValue = 0;
+	if (Key == -1)
+	{
+		KeyValue = (int)m_TransDataPackMap.size();	//父老 蜡老 虐蔼阑 林瘤 臼栏搁 措涝鉴栏肺 鉴瞒利牢 牢郸胶 蔼捞 虐蔼捞 凳
+	}
+	else KeyValue = Key;
+
+	m_vTransDataList.push_back(ItemName);
+	m_TransDataPackMap.insert(std::pair<CString, CTransDataPack*>(ItemName,new CTransDataPack(KeyValue, ItemByte,NULL,ePackType)));
+	m_DataPackTotalByteSize+=ItemByte;
+}
+
+int CTransDataManager::GetDataPackTotalNumber()
+{
+	return (int)m_TransDataPackMap.size();
+}
+
+BOOL CTransDataManager::GetPackDataAll(CString &Name, int Index, int &Byte, CString &Value)
+{
+	std::map<CString,CTransDataPack*>::iterator CurItor;
+	for(CurItor = m_TransDataPackMap.begin() ; CurItor != m_TransDataPackMap.end(); CurItor++)
+	{
+		if(Index == CurItor->second->GetIndex())
+		{			
+			Name  = CurItor->first;
+			Byte  = CurItor->second->GetByte();
+			Value = CurItor->second->GetValue();
+			return TRUE;			
+		}
+	}
+	return FALSE;
+}
+
+BOOL CTransDataManager::InsertPLCValueToMap(char* pstrRawData,int nLength)
+{
+	int DataLength  = nLength;
+
+	int divIndex=0;
+	char* pstrDivDataStart = NULL;
+	CString KeyName,strTmp,strCon;
+
+	std::map<CString,CTransDataPack*>::iterator CurItor;
+
+	int nMapSize = (int)m_TransDataPackMap.size();
+	for(int i=0; i<nMapSize; i++)
+	{	
+		CurItor = m_TransDataPackMap.find( m_vTransDataList[i] );
+		if( CurItor != m_TransDataPackMap.end())
+		{
+			pstrDivDataStart = NULL;
+			KeyName = CurItor->first;
+			if((divIndex+CurItor->second->GetByte())>DataLength)
+				return FALSE;
+			pstrDivDataStart = pstrRawData+divIndex;
+			divIndex += CurItor->second->GetByte();
+			InsertPLCValueToPack(KeyName, pstrDivDataStart);				
+
+			strTmp = strCon =  _T("");
+			for(int j=0;j<CurItor->second->GetByte();j++)
+			{
+				strTmp.Format(_T("%d,"),pstrDivDataStart[j]);
+				strCon += strTmp;	
+			}			
+			
+			//g_pLog->DisplayMessage(_T("Insert Transfer Map : Key %s,Data %s"),KeyName,strCon);
+		}
+	}
+	
+	return TRUE;
+}
+
+BOOL CTransDataManager::InsertPLCValueToPack(CString keyName, char* pstrData)
+{
+	m_TransDataPackMapiterator = m_TransDataPackMap.find(keyName);
+	if (m_TransDataPackMapiterator == m_TransDataPackMap.end())
+		return FALSE;
+
+	m_TransDataPackMapiterator->second->SetValue(pstrData);
+
+	return TRUE;
+}
+
+BOOL CTransDataManager::SearchValueInMap(CString Name, CString &ReturnValue, int &ByteLength)
+{
+	m_TransDataPackMapiterator = m_TransDataPackMap.find(Name);
+	if( m_TransDataPackMapiterator == m_TransDataPackMap.end()) return FALSE;
+	CStringA strRetA = ("");
+	strRetA.Format("%s",m_TransDataPackMapiterator->second->GetValue());
+	ReturnValue = (CString)strRetA;
+	ByteLength = m_TransDataPackMapiterator->second->GetByte();
+
+
+	if(m_TransDataPackMapiterator->second->GetPackType() == eUnsignedDec)
+	{
+		char* pstrHex = new char[ByteLength * 2 +1];
+		memset( pstrHex,0,sizeof(char)*(ByteLength * 2 +1) );
+		StrToHex(pstrHex,m_TransDataPackMapiterator->second->GetValue(),ByteLength, TRUE);
+		strRetA = pstrHex;
+
+	//	g_pLog->DisplayMessage(_T("Transfer Search Map String Dec : Key %s,Length %d,Data %s"),Name,ByteLength,pstrHex);
+
+		int nUnSignedDec = Hex2UnsignedDec( (CString)strRetA );
+		ReturnValue.Format(_T("%d"),nUnSignedDec);
+
+	//	g_pLog->DisplayMessage(_T("Ret Transfer Search Map String Dec : Key %s,Length %d,Data %s,Ret %s"),Name,ByteLength,pstrHex,ReturnValue);
+
+		delete [] pstrHex;
+	}
+
+	if(ReturnValue.IsEmpty() == TRUE && m_TransDataPackMapiterator->second->GetPackType() == eAscii)
+		ReturnValue = _T("*");
+
+	ReturnValue = ReturnValue.Trim();
+
+// 	if(m_TransDataPackMapiterator->second->GetPackType() == eAscii)
+// 		g_pLog->DisplayMessage(_T("Ret Transfer Search Map String : Key %s,Length %d,Ret %s"),Name,ByteLength,ReturnValue);
+
+	return TRUE;
+}
+
+BOOL CTransDataManager::SearchValueInMap(CString Name, int &nReturnValue, int &ByteLength)
+{
+	m_TransDataPackMapiterator = m_TransDataPackMap.find(Name);
+	if( m_TransDataPackMapiterator == m_TransDataPackMap.end()) return FALSE;
+	CStringA strRetA = ("");
+	strRetA.Format("%s",m_TransDataPackMapiterator->second->GetValue());
+	ByteLength = m_TransDataPackMapiterator->second->GetByte();
+	
+	if(m_TransDataPackMapiterator->second->GetPackType() == eUnsignedDec)
+	{		
+		char* pstrHex = new char[ByteLength * 2 +1];
+		memset( pstrHex,0,sizeof(char)*(ByteLength * 2 +1) );
+
+	//	g_pLog->DisplayMessage(_T("Transfer Search Map : Key %s,Length %d"),Name,ByteLength);
+
+		StrToHex(pstrHex,m_TransDataPackMapiterator->second->GetValue(),ByteLength, TRUE);
+		strRetA = pstrHex;
+		
+		nReturnValue = Hex2UnsignedDec( (CString)strRetA );
+
+	//	g_pLog->DisplayMessage(_T("Ret Transfer Search Map : Key %s,Length %d,Ret %d"),Name,ByteLength,nReturnValue);
+
+		delete [] pstrHex;
+	}
+	else
+	{
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+CString CTransDataManager::GetDataWord2Str(CString &value, int &addr, int length)
+{
+	CStringA tmp(""),Rstr(""),Fstr(""),buff(""),returnValue("");
+	CStringA strValueA = (CStringA)value;
+	int i;
+	char *p;
+	int		nData;	
+	CStringA strData;
+
+	if (strValueA.GetLength() >= addr * 2 + length * 2)
+	{
+		tmp = strValueA.Mid(addr * 2, length * 2);
+
+		for (i = 0; i < tmp.GetLength() ; i = i + 2)
+		{		
+			//	Rstr += __toascii(strtol(tmp.Mid(i, 2), &p, 16));
+
+			nData = __toascii(strtol(tmp.Mid(i, 2), &p, 16));
+			strData.Format("%c",nData);
+			Rstr += strData;
+		}
+
+		for(i = 0; i < Rstr.GetLength()-1; i = i + 2)
+		{
+			Fstr += Rstr.Mid(i+1, 1);
+			Fstr += Rstr.Mid(i, 1);
+		}
+		if (Rstr.GetLength() % 2 == 1)
+			Fstr += Rstr.Mid(Rstr.GetLength(),1);
+
+		int k = Fstr.GetLength();
+
+		//傍归阑 绝矩促
+		for(i=0;i<Fstr.GetLength();i++)
+		{
+			if(Fstr.Mid(i,1) != " ")
+				returnValue += Fstr.Mid(i,1);
+		}
+
+		k = returnValue.GetLength();
+		//酒公繁 data档 绝栏搁 "*" 贸府茄促
+		if(returnValue.GetLength() == 0)
+			returnValue.Format("*");
+		else if(returnValue.Mid(0,1) == "")
+			returnValue.Format("*");
+	}
+	else
+		returnValue.Format("*");
+
+	return (CString)returnValue;
+}
+
+int CTransDataManager::Hex2Dec(CString hex_str)
+{
+	CString hex("0123456789ABCDEF");
+
+	int		cnv = 1;
+	int     dec = 0;
+
+	for(int i=0 ; i<hex_str.GetLength() ; i++)
+	{
+		dec += hex.Find(hex_str.GetAt(hex_str.GetLength()-1-i))*cnv;
+		cnv *= 16;
+	}
+	return dec;	
+}
+
+
+void CTransDataManager::ResetData()
+{
+	for(m_TransDataPackMapiterator = m_TransDataPackMap.begin(); m_TransDataPackMapiterator != m_TransDataPackMap.end(); ++m_TransDataPackMapiterator)
+	{
+		CTransDataPack* pPack = m_TransDataPackMapiterator->second;
+		if(pPack != NULL)
+			delete pPack;
+	}
+	m_TransDataPackMap.clear();
+	m_vTransDataList.clear();
+	m_DataPackTotalByteSize = 0;
+}
+
+CString CTransDataManager::GetItemName( int nIndex )
+{
+	if( static_cast<int>(m_vTransDataList.size()) <= nIndex)
+		return _T("");
+
+	return m_vTransDataList[nIndex];
+}
+
+void CTransDataManager::ResetPackData()
+{
+	for(m_TransDataPackMapiterator = m_TransDataPackMap.begin(); m_TransDataPackMapiterator != m_TransDataPackMap.end(); ++m_TransDataPackMapiterator)
+	{
+		CTransDataPack* pPack = m_TransDataPackMapiterator->second;
+		if(pPack != NULL)
+		{
+			pPack->SetValue(NULL);
+		}
+	}
+}
+
+short CTransDataManager::Hex2SignedDec( CString hex_str )
+{
+	CString hex("0123456789ABCDEF");
+	int		cnv = 1;    
+	int     dec = 0;
+	int     sign = 1;
+
+
+	for(int i=0 ; i<hex_str.GetLength() ; i++)
+	{
+		dec += hex.Find(hex_str.GetAt(hex_str.GetLength()-1-i))*cnv;
+		cnv *= 16;
+	}
+
+	sign = sign << (hex_str.GetLength()*4 - 1);
+	if(dec & sign)
+	{
+		//dec ^= sign;
+		//dec *= -1;
+
+
+	}
+
+	return (short)dec;
+}
+CString CTransDataManager::Asc2Hex(CStringA hex_str)
+{
+
+	CString ret_str = _T(""); 
+
+	if(hex_str.GetLength()%2 == 1)
+		hex_str += _T(" ");
+
+	for(int i=0 ; i<hex_str.GetLength()/2 ; i++)
+	{
+		CString hex;
+
+		hex.Format(_T("%02X%02X"), (UCHAR)hex_str.GetAt(i*2+1), (UCHAR)hex_str.GetAt(i*2));
+		ret_str += hex;
+	}
+
+	return ret_str;
+}
+
+BOOL CTransDataManager::StrToHex(CHAR* pchData, CHAR* pchDataSrc, INT nLength, BOOL bWordReverse)
+{
+	//static UCHAR saucHex[] = "0123456789ABCDEF";
+	for(int i=0; i<nLength/2; i++)
+	{
+		sprintf(&pchData[i*4], "%02X%02X", pchDataSrc[i*2+1] & 0xFF, pchDataSrc[i*2+0] & 0xFF);
+
+	//	g_pLog->DisplayMessage(_T("Transfer Search Map Data : %02X%02X"),pchDataSrc[i*2+1] & 0xFF, pchDataSrc[i*2+0] & 0xFF);
+	}
+
+	if( bWordReverse == TRUE && nLength >= 4 && nLength % 4 == 0)
+	{
+		char szBuffer[4] = {0,};
+		for(int i=0; i< nLength*2; i+=8)
+		{
+			memcpy(szBuffer,&pchData[i],4);
+			memcpy(&pchData[i],&pchData[i+4],4);
+			memcpy(&pchData[i+4],szBuffer,4);
+
+		}
+	}
+	return TRUE;
+}
+
+UINT CTransDataManager::Hex2UnsignedDec(CString hex_str)
+{
+	CString hex("0123456789ABCDEF");
+	int		cnv = 1;    
+	int     dec = 0;
+
+	for(int i=0 ; i<hex_str.GetLength() ; i++)
+	{
+		dec += hex.Find(hex_str.GetAt(hex_str.GetLength()-1-i))*cnv;
+		cnv *= 16;
+	}
+	return dec;
+}
diff --git a/ENRIT/Data/TransDataManager.h b/ENRIT/Data/TransDataManager.h
new file mode 100644
index 0000000..3d3a302
--- /dev/null
+++ b/ENRIT/Data/TransDataManager.h
@@ -0,0 +1,142 @@
+#pragma once
+
+
+#include <map>
+#include <vector>
+
+
+using namespace std;
+
+enum EnumPackType
+{
+	eAscii = 0,
+	eUnsignedDec
+};
+class CTransDataPack			//拱幅 沥焊 class.
+{
+protected:
+	int				m_nIndex;
+	int				m_nByte;
+	EnumPackType	m_ePackType;
+	char*			m_pstrData;
+public:
+	CTransDataPack()
+	{
+		m_pstrData = NULL;
+		ResetTransDataPack();
+	}
+	~CTransDataPack()
+	{
+		ResetTransDataPack();
+	}
+	CTransDataPack(int Index, int Byte, char* pstrData = NULL, EnumPackType ePackType = eAscii)
+	{
+		m_nIndex = Index;
+		m_nByte = Byte;
+		m_ePackType = ePackType;
+		m_pstrData = new char[m_nByte+1];
+		memset(m_pstrData,0,sizeof(char)*(m_nByte+1));
+		if(pstrData != NULL)
+			memcpy(m_pstrData,pstrData,sizeof(char)*m_nByte);
+	}
+	CTransDataPack& operator=(const CTransDataPack& rhs)
+	{
+		if (this != &rhs)
+		{
+			ResetTransDataPack();
+			m_nIndex = rhs.m_nIndex;
+			m_nByte = rhs.m_nByte;
+			m_ePackType = rhs.m_ePackType;
+			m_pstrData = new char[m_nByte+1];
+			memset(m_pstrData,0,sizeof(char)*(m_nByte+1));
+			if(rhs.m_pstrData != NULL)
+				memcpy(m_pstrData,rhs.m_pstrData,sizeof(char)*m_nByte);
+		}	
+		return *this;
+	}
+	void ResetTransDataPack()
+	{
+		m_nIndex = 0;
+		m_nByte = 0;
+		m_ePackType = eAscii;
+		if(m_pstrData != NULL)
+		{
+			delete [] m_pstrData;
+			m_pstrData = NULL;
+		}
+	}
+
+	int				GetIndex()					{return m_nIndex;};		//拱幅 沥焊狼 鉴辑
+	int				GetByte()					{return m_nByte;};		//拱幅 沥焊狼 辨捞.
+	EnumPackType	GetPackType()		{return m_ePackType;}
+	char*			GetValue()					{return m_pstrData;};	//拱幅 沥焊狼 蔼
+
+	void			SetValue(char* pstrData)
+	{
+		if(pstrData == NULL)
+		{
+			memset(m_pstrData,0,sizeof(char)*(m_nByte+1));
+		}
+		else
+		{
+			memcpy(m_pstrData,pstrData,sizeof(char)*m_nByte);
+		}
+	}
+};
+
+class CTransDataManager  
+{
+
+public:	
+	CTransDataManager();
+	virtual ~CTransDataManager();
+	CTransDataManager& operator=(const CTransDataManager& rhs);
+
+	// 檬扁拳
+	void	ResetPackData();
+
+	// 16柳荐 -> 10柳荐(int)
+	int		Hex2Dec(CString hex_str);				
+	// 16柳荐 -> 何龋绝绰 10柳荐(short)
+	short	Hex2SignedDec(CString hex_str);
+	// 酒胶虐 -> 16柳荐 巩磊凯
+	CString Asc2Hex(CStringA hex_str);
+	// 胶飘傅 -> 16柳荐
+	BOOL	StrToHex(CHAR* pchData, CHAR* pchDataSrc, INT nLength, BOOL bWordReverse = FALSE);
+	// 16柳荐 -> 何龋乐绰 10柳荐
+	UINT	Hex2UnsignedDec(CString hex_str);
+	// 况靛 -> 10柳荐
+	UINT	GetDataWord2Dec(CString buff, int ap, BOOL hi_bit);
+	// 况靛 -> 巩磊凯
+	CString GetDataWord2Str(CString& value, int& addr, int length);
+	// 拱幅 沥焊 辑摹
+	BOOL	SearchValueInMap(CString Name, CString& ReturnValue, int& ByteLength);
+	// 拱幅 沥焊 辑摹
+	BOOL	SearchValueInMap(CString Name, int& nReturnValue, int& ByteLength);
+	// PLC 单捞磐 -> 甘
+	BOOL	InsertPLCValueToPack(CString keyName, char* pstrData);
+	// 蔼 辑摹
+	BOOL	GetPackDataAll(CString &Name, int Index, int &Byte, CString &Value);
+	// 拱幅 单捞磐 傈眉 墨款飘 
+	int		GetDataPackTotalNumber();
+	// 拱幅 单捞磐 傈眉 官捞飘
+	int		GetDataPackTotalByteSize(){return m_DataPackTotalByteSize;};
+
+	// PLC 单捞磐 -> 甘
+	BOOL	InsertPLCValueToMap(char* pstrRawData,int nLength);
+
+	// 拱幅单捞磐 器杆 殿废
+	void	InsertTransItemToMap(CString ItemName, int ItemByte, int Key=-1, EnumPackType ePackType = eAscii);
+	// 拱幅单捞磐 器杆 佬扁
+	BOOL	LoadTransItemFromFile(CString FilePath);
+
+	CString	GetItemName(int nIndex);
+
+protected:
+	void	ResetData();
+private:
+	int m_DataPackTotalByteSize;
+	std::map<CString,CTransDataPack*>			m_TransDataPackMap;			//拱幅沥焊 捞抚, 辨捞, 蔼俊 措茄 甘 牧抛捞呈
+	std::map<CString,CTransDataPack*>::iterator	m_TransDataPackMapiterator;	//拱幅 沥焊 啊府虐绰 器牢磐 
+	std::vector<CString>						m_vTransDataList;			//拱幅 沥焊 府胶飘
+};
diff --git a/ENRIT/Data/Transfer_Data.cpp b/ENRIT/Data/Transfer_Data.cpp
new file mode 100644
index 0000000..0446947
--- /dev/null
+++ b/ENRIT/Data/Transfer_Data.cpp
@@ -0,0 +1,84 @@
+#include "stdafx.h"
+#include "Transfer_Data.h"
+
+CTransfer_Data::CTransfer_Data()
+{
+	Reset();
+}
+CTransfer_Data::~CTransfer_Data()
+{
+	
+}
+
+int CTransfer_Data::CheckString(CString str)
+{
+	int i,j,k=0;
+
+	for(i = 0; i < str.GetLength(); i++)
+	{
+		j = str.GetAt(i);
+		if(j == 46 || j == 95)//"."  "_"
+			k++;
+		else if(j >= 48 && j <= 57)
+			k++;
+		else if(j >= 65 && j <= 90)
+			k++;
+		else if(j >= 97 && j <= 122)
+			k++;
+		else
+			return 0;
+	}
+
+	return 1;
+}
+
+void CTransfer_Data::Reset()
+{
+	m_strHPANELID = _T("");
+	m_nRecipeNo = m_nHandNumber = m_nStartOnlineMode = m_nStartUnitNum = 0;
+	m_nEqpNo = m_nUnitNo = m_nRoughPadLayer = m_nRoughNonPadLayer = m_nRoughNonPadCount = 0;
+	m_nPrePadLayer = m_nPrePadCount = m_nPreNonPadLayer = m_nPreNonPadCount = m_nisGrind = 0;
+	m_nRoughPadCount = 0;
+}
+
+BOOL CTransfer_Data::SetManagerToData(CTransDataManager *pManager)
+{
+	if(pManager == NULL)
+		return FALSE;
+
+	int nByteLength = 0;
+
+	pManager->SearchValueInMap(_T("H_PANELID"), m_strHPANELID, nByteLength);
+	if(m_strHPANELID.CompareNoCase(_T("*")) == 0 || m_strHPANELID.IsEmpty() == TRUE || CheckString(m_strHPANELID)==0)
+		m_strHPANELID.Format(_T("HPanelID"));
+
+	CString			strValue;
+	pManager->SearchValueInMap(_T("RECIPE_NO"), m_nRecipeNo, nByteLength);
+	pManager->SearchValueInMap(_T("HAND_NO"), m_nHandNumber, nByteLength);
+	pManager->SearchValueInMap(_T("STARTONLINE_MODE"), m_nStartOnlineMode, nByteLength);
+	pManager->SearchValueInMap(_T("STARTUNIT_NUM"), m_nStartUnitNum, nByteLength);
+	pManager->SearchValueInMap(_T("EQP_No"), m_nEqpNo, nByteLength);
+	pManager->SearchValueInMap(_T("Unit_No"), m_nUnitNo, nByteLength);
+	pManager->SearchValueInMap(_T("Rough_Pad_Layer"), m_nRoughPadLayer, nByteLength);
+	pManager->SearchValueInMap(_T("Rough_Pad_Count"), m_nRoughPadCount, nByteLength);
+	pManager->SearchValueInMap(_T("Rough_NonPad_Layer"), m_nRoughNonPadLayer, nByteLength);
+	pManager->SearchValueInMap(_T("Rough_NonPad_Count"), m_nRoughNonPadCount, nByteLength);
+	pManager->SearchValueInMap(_T("Pre_Pad_Layer"), m_nPrePadLayer, nByteLength);
+	pManager->SearchValueInMap(_T("Pre_Pad_Count"), m_nPrePadCount, nByteLength);
+	pManager->SearchValueInMap(_T("Pre_NonPad_Layer"), m_nPreNonPadLayer, nByteLength);
+	pManager->SearchValueInMap(_T("Pre_NonPad_Count"), m_nPreNonPadCount, nByteLength);
+	pManager->SearchValueInMap(_T("Is_Grind"), m_nisGrind, nByteLength);
+
+	g_pBase->m_nStageNo = m_nHandNumber-1;
+	g_pBase->m_strHPanelID = m_strHPANELID;
+
+	if(g_pBase->m_nStageNo < 0 || g_pBase->m_nStageNo > 1)
+		g_pBase->m_nStageNo = 0;
+
+	g_pLog->DisplayMessage(_T("Read TransferData GlassID %s, RecipeNo %d, HandNo %d"),m_strHPANELID,m_nRecipeNo,m_nHandNumber);
+	g_pLog->DisplayMessage(_T("Read TransferData EqpID %d, UnitNo %d"),m_nEqpNo,m_nUnitNo);
+	g_pLog->DisplayMessage(_T("Read TransferData Rough_Pad_Layer %d, Rough_Pad_Count %d,Rough_NonPad_Layer %d, Rough_NonPad_Count %d"),m_nRoughPadLayer,m_nRoughPadCount,m_nRoughNonPadLayer,m_nRoughNonPadCount);
+	g_pLog->DisplayMessage(_T("Read TransferData Pre_Pad_Layer %d, Pre_Pad_Count %d,Pre_NonPad_Layer %d, Pre_NonPad_Count %d"),m_nPrePadLayer,m_nPrePadCount,m_nPreNonPadLayer,m_nPreNonPadCount);
+
+	return TRUE;
+}
\ No newline at end of file
diff --git a/ENRIT/Data/Transfer_Data.h b/ENRIT/Data/Transfer_Data.h
new file mode 100644
index 0000000..1980b7b
--- /dev/null
+++ b/ENRIT/Data/Transfer_Data.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "TransDataManager.h"
+
+#define	TRANSITEM_FILEPATH_B5			_T("C:\\RCutProject\\Config\\TransDataItemB5.cfg")
+
+class CTransfer_Data
+{
+public:
+	CTransfer_Data();
+	virtual ~CTransfer_Data();
+	
+	virtual	BOOL	SetManagerToData(CTransDataManager *pManager);
+	virtual void	Reset();
+	virtual	void	SetRecipeName(CString strName){m_nRecipeNo=_ttoi(strName);}
+
+	int				CheckString(CString str);
+
+public:
+	CString					m_strHPANELID;	
+	int						m_nRecipeNo;
+	int						m_nHandNumber;
+	int						m_nStartOnlineMode;
+	int						m_nStartUnitNum;
+	int						m_nEqpNo;
+	int						m_nUnitNo;
+	int						m_nRoughPadLayer;
+	int						m_nRoughPadCount;
+	int						m_nRoughNonPadLayer;
+	int						m_nRoughNonPadCount;
+	int						m_nPrePadLayer;
+	int						m_nPrePadCount;
+	int						m_nPreNonPadLayer;
+	int						m_nPreNonPadCount;
+	int						m_nisGrind;
+};
+
+
diff --git a/ENRIT/Define/Global_Define.h b/ENRIT/Define/Global_Define.h
new file mode 100644
index 0000000..c7a483b
--- /dev/null
+++ b/ENRIT/Define/Global_Define.h
@@ -0,0 +1,841 @@
+#pragma once
+
+#include <map>
+#include <list>
+#include <vector>
+#include <functional>
+using namespace std;
+
+#define WM_USER_SYSTEM_CLOSE						WM_USER + 1
+#define UM_LIST_SELECTDEFECT						WM_USER + 2
+#define WM_POCESS_STATUS							WM_USER + 3
+#define WM_LIVE_IMG_UPDATE							WM_USER + 4
+#define UM_UPDATE_RECIPE							WM_USER + 5
+#define	UM_SEND_MESSAGE_MAIN_DLG					WM_USER + 6
+
+#define	MAX_CAMERA_COUNT			4
+#define MAX_SCAN_COUNT				2
+#define MAX_DIMENSION_COUNT			8
+#define MAX_STAGE_HAND_COUNT		2
+#define MAX_FRAM_COUNT				1024
+
+#define SHARD_MEMORY_STRING_FRAMEBUFFER _T("SHARD_MEMORY_FRAMEBUFFER")
+
+#define RECIPE_PATH					_T("C:\\RCutProject\\Recipe")
+#define RECIPE_ALIGN_PATH			_T("C:\\RCutProject\\Align")
+#define	LINK_FILE_NAME				_T("C:\\RCutProject\\Recipe\\PPIDLink.lst")
+#define GLASSTYPE_IMAGE_PATH		_T("C:\\RcutProject\\Recipe\\GlassType")
+#define PATH_LOGIMAGE				_T("D:\\Image\\Log\\")
+#define PATH_DEBUGFULLIMAGE			_T("D:\\Image\\Log\\DebugFullImage\\")
+#define	PATH_INSPECTOR				_T("C:\\RCutProject")
+#define PATH_INSPECTION_DATA		_T("D:\\InspectionData\\")
+#define RECIPE_HOLE_TEMPLATE_PATH	_T("C:\\RCutProject\\HoleIns")
+
+#define CHKMAX(a,b)    (((a) > (b)) ? (a) : (b))
+#define CHKMIN(a,b)    (((a) < (b)) ? (a) : (b))
+
+#define MAX_PANEL_SIDE					4			// 搁 荐 
+#define	UPDN_TYPE						2			// 惑窍 鞍捞 乐绰版快 2 窍唱父 乐绰版快 1
+
+#define MAX_VIEWINFO_GRD_CNT		7
+#define MAX_PROFILE_SETTING_COUNT	79
+#define PROFILE_INSPECT_SIZE_A_C	13
+#define PROFILE_INSPECT_SIZE_B_D	10
+#define PROFILE_RCUT_SIZE			5
+#define PROFILE_INSPECT_INDEX_A		33
+#define PROFILE_INSPECT_INDEX_B		0
+#define PROFILE_INSPECT_INDEX_C		10
+#define PROFILE_INSPECT_INDEX_D		23
+#define PROFILE_INSPECT_INDEX_CF	46
+#define PROFILE_RCUT_INSPECT_INDEX_A	59
+#define PROFILE_RCUT_INSPECT_INDEX_B	64
+#define PROFILE_RCUT_INSPECT_INDEX_C	69
+#define PROFILE_RCUT_INSPECT_INDEX_D	74
+
+#define SHORT_SIDE_INSPECTION_POINT_OFFSET		1420
+#define LONG_SIDE_INSPECTION_POINT_OFFSET		4770
+
+namespace GLOBAL_DEFINE
+{
+	enum	ENTRY_VIEW {EV_VIEW_INFO=0, EV_VIEW_DEFECT, EV_VIEW_IMAGE, EV_VIEW_RECIPE, EV_VIEW_LIVE, EV_VIEW_HW, EV_EXIT, EV_VIEW_End};
+
+	enum	LIGHT_TYPE{LIGHT_TYPE_TRANS=0,LIGHT_TYPE_REF,LIGHT_TYPE_NONE};
+	enum	LIGHT_MAKER{MAKER_LCP=0,MAKER_AKP,MAKER_NONE};
+
+	enum	CAMERA_DIR{CAMDIR_TOP=0,CAMDIR_BOTTOM,CAMDIR_NONE};	
+	enum	CAMERA_INSPECTION_DIR{INSPECTDIR_FORWARD=0,INSPECTDIR_BACKWARD,INSPECTDIR_NONE};
+	enum	CAMERA_SCANDIR	{SCANGLASS_X=0,SCANGLASS_Y,SCANGLASS_NONE};	
+	enum	BOARD_TYPE{GRAB_LINK_BOARD=0,RADIENT_BOARD,SAP_BOARD,BOARDTYPE_NONE};
+
+	enum	EmSplashCmd {emShow=0, emHide, emText};
+
+	enum	ScanDirectionIns	{ SD_Forward = 0, SD_Backward, SD_Unknown };	// Glass 扁霖 Scan 规氢.
+	enum	DimensionDir		{ DIMENSION_A=0, DIMENSION_B, DIMENSION_C, DIMENSION_D,DIMENSION_A_DN, DIMENSION_B_DN, DIMENSION_C_DN, DIMENSION_D_DN, DIMENSION_NONE};
+	enum	EM_CHIPPING_COMP{CHIP_AND=0,CHIP_OR,CHIP_NONE};
+	enum	EM_CORNER_JUDGE{A_ZONE_CRACK=0,B_ZONE_CRACK,B_ZONE_BURR,C_ZONE_CRACK,C_ZONE_BURR, D_ZONE_CRACK, EDGE_THINCRACK, CHIP_WHITE};
+
+	enum	UPDATE_SETTING_RCP{EM_GLASSINFO_RCP=0,EM_CUTAREA_RCP,EM_DIMEN_RCP,EM_SPLINE_RCP,EM_CORNER_RCP,EM_NOTCH_RCP,EM_VCR_RCP};
+
+	enum	GlassDirection		{ GD_LeftTop = 0, GD_RightTop = 1, GD_LeftBottom = 10, GD_RightBottom = 11 };
+	enum	ExpRegionType		{ ER_ALL=0, ER_AREA, ER_NONE};//130115
+
+	enum	Procee_Mode			{PROC_MODE_AUTO=0,PROC_MODE_SIMULATION_ONESIDE,PROC_MODE_SIMULATION_SIDESHORT,PROC_MODE_SIMULATION_SIDELONG,PROC_MODE_SIMULATION_ALL};
+
+	enum	Init_View_Command	{VIEW_RECIPE=0,VIEW_SCANIMAGE};
+};
+using namespace GLOBAL_DEFINE;
+
+class CProfileOption
+{
+public:
+	int				m_nProfileOff_C_X;
+	int				m_nProfileOff_C_Y;
+	int				m_nProfileOff_C_DN_X;
+	int				m_nProfileOff_C_DN_Y;
+	int				m_nProfileOff_A_X;
+	int				m_nProfileOff_A_Y;
+	int				m_nProfileOff_A_DN_X;
+	int				m_nProfileOff_A_DN_Y;
+	double			m_dProfileRadius[MAX_STAGE_HAND_COUNT][MAX_PROFILE_SETTING_COUNT];
+
+	CProfileOption()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_nProfileOff_C_X = m_nProfileOff_C_Y = m_nProfileOff_C_DN_X = m_nProfileOff_C_DN_Y = 0;
+		m_nProfileOff_A_X = m_nProfileOff_A_Y = m_nProfileOff_A_DN_X = m_nProfileOff_A_DN_Y = 0;
+		ZeroMemory(m_dProfileRadius,sizeof(double)*MAX_STAGE_HAND_COUNT*MAX_PROFILE_SETTING_COUNT);
+	}
+};
+
+class CRandomData
+{
+public:
+	double		dMin;
+	double		dMax;
+	double		dLimit;
+
+	CRandomData()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		dMin = dMax = dLimit = 0;
+	}
+};
+
+class CRandomDataSet
+{
+public:
+	CRandomData		Profile;
+	CRandomData		ChamferUp;
+	CRandomData		ChamferDn;
+
+	CRandomDataSet()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		Profile.Reset();
+		ChamferUp.Reset();
+		ChamferDn.Reset();
+	}
+};
+
+class CInspectOption
+{
+public:
+	BOOL			bSaveNotchi;
+	BOOL			bSaveCornerChip;
+	BOOL			bSaveCornerSP;
+	BOOL			bSaveSpline;
+	BOOL			bSaveEdge;
+	BOOL			bSaveDimension;
+	BOOL			bSaveSplineChip;
+	BOOL			bSaveCutArea;//20140611	
+	BOOL			bSaveChipDefectImg;	
+	int				nNotchNoDetSkip;		// Pixel
+	int				nNotchDetSkip;		// Pixel
+	int				nChamferInsHeight;
+	int				nChamferSearchWidth;
+	int				nChippingInsArea;	
+	int				nCrackINsArea;
+	int				nBrokenInsArea;
+
+	// 20.11.14 - Candidate Filtering..
+	int				nChippingInsMinSize;
+	int				nCrackInsMinSize;
+	int				nBrokenInsMinSize;
+	int				nBurrInsMinSize;
+
+	int				nChippingInsSideFilterRange;
+	int				nCrackInsSideFilterRange;
+	int				nBrokenInsSideFilterRnage;
+	int				nBurrInsSideFilterRange;
+
+	BOOL			bUseRandomData;
+	CRandomDataSet	B_GrindLine;
+	CRandomDataSet	C_GrindLine;
+	CRandomDataSet	D_GrindLine;
+	CRandomDataSet	A1_GrindLine;
+	CRandomDataSet	A2_GrindLine;
+	CRandomDataSet	A1_Rcut;
+	CRandomDataSet	A2_Rcut;
+	CRandomDataSet	C1_Rcut;
+	CRandomDataSet	C2_Rcut;
+
+	int				nAlignMarkRange;
+	int				nAlignMarkRangeY;
+
+	CInspectOption()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bSaveNotchi = bSaveCornerChip = bSaveCornerSP = bSaveSpline = bSaveEdge = bSaveDimension = bSaveSplineChip = bSaveCutArea = FALSE;//20140611		
+		bSaveChipDefectImg = FALSE;
+		nNotchNoDetSkip = 10;
+		nNotchDetSkip = 4;
+		nChamferInsHeight = 100;
+		nChamferSearchWidth = 30;
+		nChippingInsArea = 100;
+		nCrackINsArea = 200;
+		nBrokenInsArea = 300;		
+		nChippingInsMinSize = nCrackInsMinSize = nBrokenInsMinSize = nBurrInsMinSize = 5;
+		nChippingInsSideFilterRange = nCrackInsSideFilterRange = nBrokenInsSideFilterRnage = nBurrInsSideFilterRange = 10;
+
+		bUseRandomData = FALSE;
+		B_GrindLine.Reset();
+		C_GrindLine.Reset();
+		D_GrindLine.Reset();
+		A1_GrindLine.Reset();
+		A2_GrindLine.Reset();
+		A1_Rcut.Reset();
+		A2_Rcut.Reset();
+		C1_Rcut.Reset();
+		C2_Rcut.Reset();		
+
+		nAlignMarkRange = 100;
+	}
+};
+
+typedef struct tagPROG_MSG
+{
+	int nJobIndex;
+	int nSide; 
+	int nState;
+	int nDispLine;
+}PROG_MSG;
+
+struct _ST_MAPSETTINGS_INDEX
+{
+	int			m_nIndex[5][4];
+};
+
+struct _ST_MAPSETTINGS
+{
+	_ST_MAPSETTINGS_INDEX			m_nMapIndex[2];
+};
+
+
+class CInspectDefect;
+class CDefect;
+class CGlass_Data;
+interface	IViewInterface2Parent
+{
+	virtual void		CommandExitButtonClick() = 0;
+	virtual void		MapDefect_ReqDefectImage(CInspectDefect* pDefect,int nGlassDefectIdx) = 0;
+	virtual CDefect		*ListDefect_ReqDefectImage(CInspectDefect* pDefect,int nGlassDefectIdx) = 0;
+
+	virtual LPBYTE		IV2M_GetGrabBufferByDimension(DimensionDir eDim,int iVline) = 0;
+	virtual BOOL		IV2M_SetLiveGrabCommand(DimensionDir eDim,BOOL bStop) = 0;
+	virtual void		IV2M_InitView(Init_View_Command eVew) = 0;
+
+	virtual void		IV2M_LoadImageFullFile(int iSide, CGlass_Data *pGlassData = NULL, std::function<void(BYTE)> _Func = nullptr) = 0;
+	virtual BOOL		IV2M_SaveFullImage(CString strPath,int iSide,CPoint ptStart,int nLength) = 0;
+
+	virtual BOOL		IV2M_RecipeChange(CString strRecipe) = 0;
+
+	virtual	BOOL		MLight_SetLightControlValue(int iCon,int iCh, int nValue, BOOL bRef, int nScanIdx = 0, BOOL bAdjLight = TRUE) = 0;
+	virtual void		MLight_OnOff(int iCon,int iCh,BOOL bValue) = 0;
+	virtual int			MLight_GetLightControlValue(int iCon,int iCh, BOOL bRef) = 0;
+
+	virtual BOOL		IV2M_InspectionProcess(DimensionDir eDim) = 0;
+	virtual BOOL		IV2M_InspectionProcessAll(int iProceMode) = 0;
+
+	virtual std::multimap<int, CPoint *> *IF2M_GetCADProfileLine(int iSide,int vStart,int vEnd)= 0;
+
+};
+
+interface	IUserDefectInterface2Parent
+{
+	virtual void		IU2P_DrawRect(BOOL bSet) = 0;
+	virtual CRect		IU2P_GetCompareRect() = 0;
+	virtual void		IU2P_DrawRefresh() = 0;
+
+	virtual void		IE2P_SetExpArea(int iSide) = 0;
+	virtual POINT		IE2P_GetFrameViewBasepoint() = 0;
+	virtual void		IE2P_SetExpAreaTrackerReset() = 0;	
+	virtual void		IE2P_SetExpAreaDlgClose() = 0;
+};
+
+#define IMAGE_WIDTH						8192//2048
+#define IMAGE_HEIGHT					1024	
+#define MAX_IMAGE_FRAME					100
+#define MAX_IMAGE_FRAME_SHORT			100			// 弥措 橇饭烙 荐 
+#define MAX_IMAGE_FRAME_LONG			100			// 弥措 橇饭烙 荐 
+
+#define MAX_IMAGE_LINE_SHORT	MAX_IMAGE_FRAME_SHORT		  * IMAGE_HEIGHT // 弥措 扼牢荐 
+#define MAX_IMAGE_LINE_LONG		MAX_IMAGE_FRAME_LONG		  * IMAGE_HEIGHT // 弥措 扼牢荐 
+#define MAX_IMAGE_LINE			MAX_IMAGE_LINE_LONG
+#define MAX_LIMIT_LINE			(MAX_IMAGE_FRAME - 1) * IMAGE_HEIGHT
+
+#define MAX_IMAGE_LINE_MARGIN		(150 * IMAGE_HEIGHT) // 弥措 扼牢荐 
+
+struct _ST_GDI_ITEM
+{
+
+	COLORREF	colorWhite;
+	COLORREF	colorRed;
+	COLORREF	colorYellow;
+	COLORREF	colorGreen;
+	COLORREF	colorBlue;
+	COLORREF	colorBlack;
+	COLORREF	colorLightGray;
+	COLORREF	colorDarkGray;
+	COLORREF	colorGray;
+	COLORREF	colorTitle;
+	COLORREF	colorLightBlue;
+	COLORREF	colorViolet;
+	COLORREF	colorLightYellow;
+	COLORREF	colorOrange;
+	COLORREF	colorLightRed;
+	COLORREF	colorLightGreen;
+	COLORREF	colorBrown;
+	COLORREF    colorSky;
+
+
+	CBrush		brushBk;
+	CBrush		brushDarkGray;
+	CBrush		brushWhite;
+	CBrush		brushBlue;
+	CBrush		brushLightBlue;
+	CBrush		brushBlack;
+	CBrush		brushRed;
+
+	CBitmap		BkBitmap;
+	CBrush		BrushBkPattern;
+};
+
+enum THICK_INS_METHOD{THICK_METHOD_NORMAL=0,THICK_METHOD_EXTRA};
+enum THICKPOS_DIRECTION{THICKPOS_LEFT=0,THICKPOS_RIGHT,THICKPOS_TOP,THICKPOS_BOTTOM};
+typedef struct STU_THICKPOS_
+{	
+	CRect			rect;
+	int				iScan;
+	int				iFrame;
+	double			dThick;
+	double			xCoordi;
+	double			yCoordi;
+	int				nLeftLine;
+	int				nRightLine;
+	int				nTopLine;
+	int				nIndex;
+	THICKPOS_DIRECTION	nDir;
+	THICK_INS_METHOD	Insmethod;
+	int				nChamferThres;
+	int				nChipThres;
+	int				nJudgeBase;
+	int				nJudgeDiff_Plus;
+	int				nJudgeDiff_Minus;
+	int				nChipWidth;
+	int				nChipHeight;
+
+public:
+	STU_THICKPOS_()
+	{
+		Reset();
+	}	
+	STU_THICKPOS_(STU_THICKPOS_ *pPos)
+	{
+		*this = *pPos;
+	}	
+	void Reset()
+	{
+		nDir = THICKPOS_LEFT;
+		iFrame = 0;
+		dThick = 0;
+		iScan = 0;
+		nLeftLine = nRightLine = nTopLine = 0;
+		rect = CRect(0,0,0,0);
+		xCoordi = yCoordi = 0.;
+		nIndex = 0;
+		Insmethod = THICK_METHOD_NORMAL;
+		nChamferThres = nChipThres = nJudgeBase = nJudgeDiff_Plus = nJudgeDiff_Minus = 0;
+		nChipWidth = nChipHeight = 0;
+	}
+}STU_THICKPOS, *pSTU_THICKPOS;
+
+typedef struct STU_DIMENSIONPOS_
+{	
+	CRect			rect;	
+	int				iFrame;
+	int				nPixelTop;
+	double			dSize;
+	double			xCoordi;
+	double			yCoordi;
+	double			dPixelLeft;
+	double			dPixelRight;
+	double			dImageRight;
+	int				iIndex;
+
+public:
+	STU_DIMENSIONPOS_()
+	{		
+		iFrame = iIndex = 0;				
+		rect = CRect(0,0,0,0);
+		xCoordi = yCoordi = dSize = 0.;		
+		dPixelLeft = dPixelRight = dImageRight = 0.;
+		nPixelTop = 0;
+	}	
+}STU_DIMENSIONPOS, *pSTU_DIMENSIONPOS;
+
+typedef struct _INSPECTDIMENSION_BUFFER
+{	
+	int				iCam;
+	int				iScan;	
+	int				iIndex;
+	int				iFrame;
+	BOOL			bSuccess;
+	DimensionDir	enSide;
+	double			dLeft;
+	double			dRight;
+	double			dSize;
+	LPBYTE			pOrg;
+	CSize			szOrg;
+
+	_INSPECTDIMENSION_BUFFER()
+	{
+		pOrg = NULL;
+		Reset();
+	}
+	void Reset()
+	{
+		iCam = iScan = iIndex = iFrame = -1;
+		enSide = DIMENSION_NONE;
+		dLeft = dRight = dSize = 0;
+		bSuccess = FALSE;
+		if(pOrg != NULL)
+			delete[] pOrg;
+		pOrg=NULL;
+		szOrg = CSize(0,0);
+	}
+	void Clear()
+	{
+		if(pOrg == NULL || szOrg.cx <= 0 || szOrg.cy <= 0)
+			return;
+		ZeroMemory(pOrg,sizeof(BYTE)*szOrg.cx*szOrg.cy);		
+	}	
+	void SetSize(CSize szRe)
+	{
+		if(pOrg != NULL && szRe.cx <= szOrg.cx && szRe.cy <= szOrg.cy)
+			return;
+
+		if(pOrg != NULL) delete[] pOrg,pOrg=NULL;
+		szOrg = szRe;
+		pOrg = new BYTE[szOrg.cx*szOrg.cy];		
+		Clear();
+	}
+	void CopyBuffer(_INSPECTDIMENSION_BUFFER *pBuffer)
+	{
+		Reset();
+		iCam = pBuffer->iCam;
+		iScan = pBuffer->iScan;
+		iFrame = pBuffer->iFrame;
+		iIndex = pBuffer->iIndex;
+		bSuccess = pBuffer->bSuccess;
+		enSide = pBuffer->enSide;
+		dLeft = pBuffer->dLeft;
+		dRight = pBuffer->dRight;
+		dSize = pBuffer->dSize;	
+		szOrg = pBuffer->szOrg;
+
+		if(pBuffer->pOrg != NULL && pBuffer->szOrg.cx > 0 && pBuffer->szOrg.cy > 0)
+		{
+			pOrg = new BYTE[szOrg.cx*szOrg.cy];
+			CopyMemory(pOrg,pBuffer->pOrg,szOrg.cx*szOrg.cy);
+		}		
+	}
+} INSPECTDIMENSION_BUFFER, *pINSPECTDIMENSION_BUFFER;
+
+#define 	RANGE_VAL_COUNT  9
+typedef struct STU_SPLINE_RESULT_
+{	
+	enum	EN_SPLINE_TYPE{SPLINE_RCUT=0,SPLINE_CCUT,SPLINE_NONE};		
+
+	int				iCam;
+	int				iScan;
+	EN_SPLINE_TYPE	enType;		
+	BOOL			bPos;
+	double			dMinData;
+	double			dMaxData;
+	double			dAvg;
+	double			dRangeVal[RANGE_VAL_COUNT];
+
+public:
+	STU_SPLINE_RESULT_()
+	{				
+		enType = SPLINE_NONE;
+		bPos = TRUE;		
+		dMinData = dMaxData = dAvg = 0.;
+		iCam = iScan = 0;
+		ZeroMemory(dRangeVal,sizeof(double)*RANGE_VAL_COUNT);//20140528
+	}	
+}STU_SPLINE_RESULT, *pSTU_SPLINE_RESULT;
+
+typedef struct _INSPECTSPLINE_BUFFER
+{	
+	enum	SPLINE_SAVE_TYPE{SPLINE_TYPE_ORG=0,SPLINE_TYPE_RES};
+	enum	EN_SPLINE_POSITION{SPLINE_TOPLEFT=0,SPLINE_TOPRIGHT,SPLINE_BOTTOMLEFT,SPLINE_BOTTOMRIGHT,SPLINE_POS_NONE};	
+
+	int				iCam;
+	int				iScan;	
+	int				iFrame;
+	int				iType;
+	EN_SPLINE_POSITION	ePosition;
+	BOOL			bPos;	
+	double			dMinVal;
+	double			dMaxVal;
+	double			dAvgVal;
+	double			dAvgThick;
+	BOOL			bSuccess;
+
+	LPBYTE			pOrg;	
+	LPBYTE			pRes;
+	CSize			szOrg;	
+	CSize			szRes;
+
+	_INSPECTSPLINE_BUFFER()
+	{
+		pOrg = pRes = NULL;
+		Reset();
+	}
+	void Reset()
+	{
+		ePosition = SPLINE_POS_NONE;
+		iCam = iScan = iType = iFrame = -1;
+		bSuccess = bPos = FALSE;
+		dMinVal = dMaxVal = dAvgVal = dAvgThick = 0.;
+		if(pOrg != NULL)
+			delete[] pOrg;
+		pOrg=NULL;		
+		if(pRes != NULL)
+			delete[] pRes;
+		pRes=NULL;
+		szOrg = szRes = CSize(0,0);
+	}
+	void Clear(SPLINE_SAVE_TYPE nOpt)
+	{
+		switch(nOpt)
+		{
+		case SPLINE_TYPE_ORG:	
+			if(pOrg != NULL && szOrg.cx > 0 && szOrg.cy > 0)
+				ZeroMemory(pOrg,sizeof(BYTE)*szOrg.cx*szOrg.cy);
+			break;
+		case SPLINE_TYPE_RES:
+			if(pRes != NULL && szRes.cx > 0 && szRes.cy > 0)
+				ZeroMemory(pRes,sizeof(BYTE)*szRes.cx*szRes.cy);					
+			break;
+		}		
+	}
+	void SetBuffer(LPBYTE pBuf,CSize szImg,SPLINE_SAVE_TYPE nOpt)
+	{
+		if(pBuf == NULL || szImg.cx <= 0 || szImg.cy <= 0)
+			return;		
+
+		SetSize(szImg,nOpt);
+
+		switch(nOpt)
+		{
+		case SPLINE_TYPE_ORG:
+			if(pOrg != NULL && szOrg.cx > 0 && szOrg.cy > 0)			
+				CopyMemory(pOrg,pBuf,sizeof(BYTE)*szOrg.cx*szOrg.cy);	
+			break;
+		case SPLINE_TYPE_RES:
+			if(pRes != NULL && szRes.cx > 0 && szRes.cy > 0)			
+				CopyMemory(pRes,pBuf,sizeof(BYTE)*szRes.cx*szRes.cy);		
+			break;
+		}		
+	}
+	void SetSize(CSize szRe,SPLINE_SAVE_TYPE nOpt)
+	{
+		switch(nOpt)
+		{
+		case SPLINE_TYPE_ORG:
+			if(pOrg != NULL && szRe.cx <= szOrg.cx && szRe.cy <= szOrg.cy)
+				return;
+			if(pOrg != NULL) delete[] pOrg,pOrg=NULL;
+			szOrg = szRe;
+			pOrg = new BYTE[szOrg.cx*szOrg.cy];	
+			break;
+		case SPLINE_TYPE_RES:
+			if(pRes != NULL && szRe.cx <= szRes.cx && szRe.cy <= szRes.cy)
+				return;
+			if(pRes != NULL) delete[] pRes,pRes=NULL;
+			szRes = szRe;
+			pRes = new BYTE[szRes.cx*szRes.cy];
+			break;
+		}
+		Clear(nOpt);
+	}
+	void CopyBuffer(_INSPECTSPLINE_BUFFER *pBuffer)
+	{
+		Reset();
+
+		if(pBuffer == NULL)
+			return;
+
+		ePosition = pBuffer->ePosition;
+		iCam = pBuffer->iCam;
+		iScan = pBuffer->iScan;
+		iFrame = pBuffer->iFrame;
+		iType = pBuffer->iType;
+		bSuccess = pBuffer->bSuccess;
+		bPos = pBuffer->bPos;
+		dMinVal = pBuffer->dMinVal;
+		dMaxVal = pBuffer->dMaxVal;
+		dAvgVal = pBuffer->dAvgVal;
+		dAvgThick = pBuffer->dAvgThick;
+		szOrg = pBuffer->szOrg;	
+		szRes = pBuffer->szRes;
+
+		if(pBuffer->pOrg != NULL && pBuffer->szOrg.cx > 0 && pBuffer->szOrg.cy > 0)
+		{
+			pOrg = new BYTE[szOrg.cx*szOrg.cy];
+			CopyMemory(pOrg,pBuffer->pOrg,szOrg.cx*szOrg.cy);
+		}		
+		if(pBuffer->pRes != NULL && pBuffer->szRes.cx > 0 && pBuffer->szRes.cy > 0)
+		{
+			pRes = new BYTE[szRes.cx*szRes.cy];
+			CopyMemory(pRes,pBuffer->pRes,szRes.cx*szRes.cy);
+		}		
+	}
+} INSPECTSPLINE_BUFFER, *pINSPECTSPLINE_BUFFER;
+
+#define 	NOTCH_RANGE_VAL_MAX_COUNT  100//20140528
+typedef struct STU_NOTCH_RESULT_
+{	
+	int				iCam;
+	int				iScan;		
+	double			dMaxData;
+	double			dAvg;
+	double			dRangeVal[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint			pointCAD[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint			pointIMG[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	double			dRangeVal_Dy[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint			pointCAD_Dy[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint			pointIMG_Dy[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	double			dRangeVal_Cham[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint			pointCAD_Cham[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	CPoint			pointIMG_Cham[NOTCH_RANGE_VAL_MAX_COUNT];//20140528
+	double			dAvgThick;
+	double			dDx;
+	double			dDy;
+	double			dAlignX;
+	double			dAlignY;
+	double			dNotchX;
+	double			dNotchY;
+	int				nNotchInsCount;//20140528
+
+public:
+	STU_NOTCH_RESULT_()
+	{			
+		dMaxData = dAvg = dAvgThick = 0.;
+		iCam = iScan = 0;
+		ZeroMemory(dRangeVal,sizeof(double)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		ZeroMemory(pointCAD,sizeof(CPoint)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		ZeroMemory(pointIMG,sizeof(CPoint)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		ZeroMemory(dRangeVal_Dy,sizeof(double)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		ZeroMemory(pointCAD_Dy,sizeof(CPoint)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		ZeroMemory(pointIMG_Dy,sizeof(CPoint)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		ZeroMemory(dRangeVal_Cham,sizeof(double)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		ZeroMemory(pointCAD_Cham,sizeof(CPoint)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		ZeroMemory(pointIMG_Cham,sizeof(CPoint)*NOTCH_RANGE_VAL_MAX_COUNT);//20140528
+		dDx = dDy = 0.;
+		dAlignX = dAlignY = dNotchX = dNotchY = 0.;	
+		nNotchInsCount = NOTCH_RANGE_VAL_MAX_COUNT;//20140528
+	}	
+}STU_NOTCH_RESULT, *pSTU_NOTCH_RESULT;
+
+typedef struct _INSPECTNOTCH_BUFFER
+{	
+	int				iCamIdx;
+	int				iScanIdx;
+	int				iFrame;	
+	BOOL			bSuccess;
+	DimensionDir	enSide;
+	double			dAvg;
+	double			dMax;
+
+	LPBYTE			pOrg;
+	CSize			szOrg;
+	LPBYTE			pOrg_Dy;
+	CSize			szOrg_Dy;
+
+	_INSPECTNOTCH_BUFFER()
+	{
+		pOrg = NULL;
+		pOrg_Dy = NULL;
+		Reset();
+	}
+	void Reset()
+	{
+		iCamIdx = iScanIdx = iFrame = -1;
+		enSide = DIMENSION_NONE;
+		dAvg = dMax = 0;
+		bSuccess = FALSE;
+		if(pOrg != NULL)
+			delete[] pOrg;
+		pOrg=NULL;
+		szOrg = CSize(0,0);
+		if(pOrg_Dy != NULL)
+			delete[] pOrg_Dy;
+		pOrg_Dy=NULL;
+		szOrg_Dy = CSize(0,0);
+	}
+	void Clear()
+	{
+		if(pOrg == NULL || szOrg.cx <= 0 || szOrg.cy <= 0)
+			return;
+		ZeroMemory(pOrg,sizeof(BYTE)*szOrg.cx*szOrg.cy);		
+	}	
+	void Clear_Dy()
+	{
+		if(pOrg_Dy == NULL || szOrg_Dy.cx <= 0 || szOrg_Dy.cy <= 0)
+			return;
+		ZeroMemory(pOrg_Dy,sizeof(BYTE)*szOrg_Dy.cx*szOrg_Dy.cy);		
+	}
+	void SetSize(CSize szRe)
+	{
+		if(szRe.cx <= 0 || szRe.cy <=0)
+			return;
+
+		if(pOrg != NULL) delete[] pOrg,pOrg=NULL;
+		szOrg = szRe;
+		pOrg = new BYTE[szOrg.cx*szOrg.cy];		
+		Clear();
+	}
+	void SetSize_Dy(CSize szRe)
+	{
+		if(szRe.cx <= 0 || szRe.cy <=0)
+			return;
+
+		if(pOrg_Dy != NULL) delete[] pOrg_Dy,pOrg_Dy=NULL;
+		szOrg_Dy = szRe;
+		pOrg_Dy = new BYTE[szOrg_Dy.cx*szOrg_Dy.cy];		
+		Clear_Dy();
+	}
+	void CopyBuffer(_INSPECTNOTCH_BUFFER *pBuffer)
+	{
+		Reset();
+		iCamIdx = pBuffer->iCamIdx;
+		iScanIdx = pBuffer->iScanIdx;
+		iFrame = pBuffer->iFrame;		
+		bSuccess = pBuffer->bSuccess;
+		enSide = pBuffer->enSide;
+		dAvg = pBuffer->dAvg;
+		dMax = pBuffer->dMax;		
+		szOrg = pBuffer->szOrg;
+
+		if(pBuffer->pOrg != NULL && pBuffer->szOrg.cx > 0 && pBuffer->szOrg.cy > 0)
+		{
+			pOrg = new BYTE[szOrg.cx*szOrg.cy];
+			CopyMemory(pOrg,pBuffer->pOrg,szOrg.cx*szOrg.cy);
+		}				
+	}
+	void CopyBuffer_Dy(_INSPECTNOTCH_BUFFER *pBuffer)
+	{
+		Reset();
+		iCamIdx = pBuffer->iCamIdx;
+		iScanIdx = pBuffer->iScanIdx;
+		iFrame = pBuffer->iFrame;		
+		bSuccess = pBuffer->bSuccess;
+		enSide = pBuffer->enSide;
+		dAvg = pBuffer->dAvg;
+		dMax = pBuffer->dMax;		
+		szOrg_Dy = pBuffer->szOrg_Dy;
+
+		if(pBuffer->pOrg_Dy != NULL && pBuffer->szOrg_Dy.cx > 0 && pBuffer->szOrg_Dy.cy > 0)
+		{
+			pOrg_Dy = new BYTE[szOrg_Dy.cx*szOrg_Dy.cy];
+			CopyMemory(pOrg_Dy,pBuffer->pOrg_Dy,szOrg_Dy.cx*szOrg_Dy.cy);
+		}				
+	}
+} INSPECTNOTCH_BUFFER, *pINSPECTNOTCH_BUFFER;
+
+typedef struct STU_CORNER_RESULT_
+{	
+	enum	EN_CORNER_TYPE{CORNER_RCUT=0,CORNER_CCUT,CORNER_NONE};
+
+	int				iCam;
+	int				iScan;
+	EN_CORNER_TYPE	enType;	
+	BOOL			bPos;
+	double			dResultWidth;
+	double			dResultHeight;
+
+public:
+	STU_CORNER_RESULT_()
+	{		
+		enType = CORNER_NONE;
+		bPos = TRUE;		
+		dResultWidth = dResultHeight = 0.;
+		iCam = iScan = 0;
+	}	
+}STU_CORNER_RESULT, *pSTU_CORNER_RESULT;
+
+typedef struct _INSPECTFULLIMAGE_BUFFER
+{	
+	int				iCamIdx;
+	int				iScanIdx;		
+	LPBYTE			pImage;
+	CSize			szImage;
+
+	_INSPECTFULLIMAGE_BUFFER()
+	{
+		pImage = NULL;
+		Reset();
+	}
+	void Reset()
+	{		
+		iCamIdx = iScanIdx = -1;
+		if(pImage != NULL)
+			delete[] pImage;
+		pImage=NULL;
+		szImage = CSize(0,0);		
+	}
+	void Clear()
+	{
+		if(pImage == NULL || szImage.cx <= 0 || szImage.cy <= 0)
+			return;
+		ZeroMemory(pImage,sizeof(BYTE)*szImage.cx*szImage.cy);		
+	}	
+	void SetSize(CSize szRe)
+	{
+		if(pImage != NULL && szRe.cx <= szImage.cx && szRe.cy <= szImage.cy)
+		{
+			Clear();
+			return;
+		}
+
+		if(pImage != NULL) delete[] pImage,pImage=NULL;
+		szImage = szRe;
+		pImage = new BYTE[szImage.cx*szImage.cy];		
+		Clear();
+	}
+} INSPECTFULLIMAGE_BUFFER, *pINSPECTFULLIMAGE_BUFFER;
\ No newline at end of file
diff --git a/ENRIT/Define/InspectionBase.cpp b/ENRIT/Define/InspectionBase.cpp
new file mode 100644
index 0000000..0e8cfe3
--- /dev/null
+++ b/ENRIT/Define/InspectionBase.cpp
@@ -0,0 +1,135 @@
+#include "stdafx.h"
+
+const TCHAR *PANEL_SIDE[]		= {_T("A_TOP"), _T("B_TOP"), _T("C_TOP"), _T("D_TOP"),_T("A_BOT"), _T("B_BOT"), _T("C_BOT"), _T("D_BOT")};
+
+CInspectionBase::CInspectionBase()
+{
+	m_pBufferSize = NULL;
+	m_pBufferCount = NULL;
+	m_pMemFrameNo = NULL;
+	m_pCameraPort = NULL;
+	m_pFrameWidth = NULL;
+	m_pFrameHeight = NULL;
+	m_nThreadCount = 0;	
+	m_eProcessMode = 0;
+
+	Reset();
+}
+CInspectionBase::~CInspectionBase()
+{	
+	Reset();
+}
+
+
+BOOL CInspectionBase::ReadInspectConfigFile(CString strFileName,int nCamCount)
+{
+	CConfig	CF;
+
+	if(CF.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFileName, FileMap_Mode) == FALSE)
+		return FALSE;
+
+	Reset();
+
+	int nValue;
+
+	m_nCameraCount = nCamCount;
+	CF.GetItemValue(_T("acqmode"), nValue, 0);
+	m_AcqMode = (AcqMode)nValue;
+	CF.GetItemValue(_T("framedefectpixel"), m_nFrameDefectPixel, 1000);
+	CF.GetItemValue(_T("scancount"), m_nScanCount, 2);
+	CF.GetItemValue(_T("threadcount"), m_nThreadCount, 2);
+
+	if(m_nCameraCount > 0)
+	{
+		m_pBufferSize = new int[m_nCameraCount];
+		ZeroMemory(m_pBufferSize,sizeof(int)*m_nCameraCount);
+		m_pBufferCount = new int[m_nCameraCount];
+		ZeroMemory(m_pBufferCount,sizeof(int)*m_nCameraCount);	
+		m_pMemFrameNo = new int[m_nCameraCount];
+		ZeroMemory(m_pMemFrameNo,sizeof(int)*m_nCameraCount);
+		m_pCameraPort = new int[m_nCameraCount];
+		ZeroMemory(m_pCameraPort,sizeof(int)*m_nCameraCount);
+		m_pFrameWidth = new int[m_nCameraCount];
+		ZeroMemory(m_pFrameWidth,sizeof(int)*m_nCameraCount);
+		m_pFrameHeight = new int[m_nCameraCount];
+		ZeroMemory(m_pFrameHeight,sizeof(int)*m_nCameraCount);
+		
+		int			iCam;
+		CString		str,strVal;
+		for(iCam=0;iCam<m_nCameraCount;iCam++)
+		{
+			str.Format(_T("CAM[%d]_camcca"),iCam);
+			CF.GetItemValue((TCHAR*)(LPCTSTR)str, strVal);
+			m_strCamCCA.Add(strVal);
+
+			str.Format(_T("CAM[%d]_camcvi"),iCam);
+			CF.GetItemValue((TCHAR*)(LPCTSTR)str, strVal);
+			m_strCamCVI.Add(strVal);
+
+			str.Format(_T("CAM[%d]_buffersize"),iCam);
+			CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pBufferSize[iCam],0);
+
+			str.Format(_T("CAM[%d]_buffercount"),iCam);
+			CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pBufferCount[iCam],0);		
+
+			str.Format(_T("CAM[%d]_camport"),iCam);
+			CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pCameraPort[iCam],2);
+
+			str.Format(_T("CAM[%d]_framewidth"),iCam);
+			CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pFrameWidth[iCam],8192);
+
+			str.Format(_T("CAM[%d]_frameheight"),iCam);
+			CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pFrameHeight[iCam],1024);
+			
+			m_pMemFrameNo[iCam] = m_pBufferSize[iCam] * m_pBufferCount[iCam];
+		}		
+	}
+
+	return TRUE;
+}
+
+//0326
+void CInspectionBase::SetGlassInfo(CString strHPanelID, CString strRecipeName)
+{
+	m_strHPanelID = m_strOnlineID = _T("");
+	m_strRecipeName = _T("");
+
+	m_strHPanelID = m_strOnlineID = strHPanelID;
+	m_strRecipeName = strRecipeName;	
+}
+
+void CInspectionBase::Reset()
+{		
+	m_AcqMode			= Acq_Simul;	
+	m_nCameraCount		= 0;
+	m_nScanCount		= 0;
+	m_nThreadCount		= 0;
+	m_nFrameDefectPixel	= 14000;
+	m_nMaxDefect		= 1000;		
+	m_eProcessMode		= 0;
+	m_nStageNo			= 0;
+
+	if(m_pFrameWidth != NULL)
+		delete[] m_pFrameWidth, m_pFrameWidth=NULL;
+	if(m_pFrameHeight != NULL)
+		delete[] m_pFrameHeight, m_pFrameHeight=NULL;
+	if(m_pBufferSize != NULL)
+		delete[] m_pBufferSize, m_pBufferSize=NULL;
+	if(m_pBufferCount != NULL)
+		delete[] m_pBufferCount, m_pBufferCount=NULL;
+	if(m_pMemFrameNo != NULL)
+		delete[] m_pMemFrameNo, m_pMemFrameNo=NULL;	
+	if(m_pCameraPort != NULL)
+		delete[] m_pCameraPort, m_pCameraPort=NULL;	
+
+	m_strCamCCA.RemoveAll();
+	m_strCamCVI.RemoveAll();
+	
+	m_strHPanelID		= _T("");
+	m_strRecipeName		= _T("");	
+	m_strOnlineID		= _T("");	
+	m_strLoadingTime	= _T("");
+	m_strProcessID		= _T("");
+	m_strStepID			= _T("");
+	m_strLoadingDay		= _T("");
+}
\ No newline at end of file
diff --git a/ENRIT/Define/InspectionBase.h b/ENRIT/Define/InspectionBase.h
new file mode 100644
index 0000000..95ac799
--- /dev/null
+++ b/ENRIT/Define/InspectionBase.h
@@ -0,0 +1,51 @@
+// HMX64Fundamentals.h: interface for the CHMX64Fundamentals class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "Singleton.h"
+
+enum AcqMode			{ Acq_Unknown = 0, Acq_MultiCam, Acq_Simul };
+
+#define		INSPECTBASE_FILENAME _T("C:\\RCutProject\\Config\\InspectBase.cfg")
+
+extern const TCHAR	*PANEL_SIDE[];
+
+class CInspectionBase : public Singleton<CInspectionBase>
+{
+public:			
+	CStringArray		m_strCamCCA;
+	CStringArray		m_strCamCVI;	
+	int					*m_pBufferSize;			// Grab俊辑 Buffer狼 农扁.
+	int					*m_pBufferCount;			// Grab Buffer狼 荐.
+	int					*m_pMemFrameNo;			// 角力 皋葛府 橇饭烙 荐	
+	int					*m_pCameraPort;
+	int					*m_pFrameHeight;
+	int					*m_pFrameWidth;	
+	AcqMode				m_AcqMode;
+	int					m_nFrameDefectPixel;	// 茄 Frame狼 弥措 搬窃 Pixel 荐
+	int					m_nMaxDefect;			// miniont,2011-04-28, 弥措 搬窃 俺荐			
+	int					m_nCameraCount;	
+	int					m_nScanCount;
+	int					m_nThreadCount;
+	int					m_eProcessMode;
+	int					m_nStageNo;
+	
+	//park
+	CString				m_strLoadingDay;
+	CString				m_strLoadingTime;
+	CString				m_strProcessID;
+	CString				m_strStepID;
+	CString				m_strHPanelID;
+	CString				m_strOnlineID;
+	CString				m_strRecipeName;		
+	
+	CInspectionBase();	
+	virtual ~CInspectionBase();
+
+	void	Reset();	
+	BOOL	ReadInspectConfigFile(CString strFileName,int nCamCount);		
+	void	SetGlassInfo(CString strHPanelID, CString strRecipeName);
+};
+#define g_pBase		CInspectionBase::GetSingletonPtr()
diff --git a/ENRIT/Define/StatusMonitor.cpp b/ENRIT/Define/StatusMonitor.cpp
new file mode 100644
index 0000000..a440abc
--- /dev/null
+++ b/ENRIT/Define/StatusMonitor.cpp
@@ -0,0 +1,246 @@
+#include "StdAfx.h"
+#include "StatusMonitor.h"
+
+
+//////////////////////////////////////////////////////////////////////////
+
+CStatusMonitor::CStatusMonitor(void)
+{
+	m_iScanIdx = -1;
+
+	for(int iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+		m_pFrameBuffer[iCam] = NULL;
+
+	InitGlassLoading();
+}
+
+CStatusMonitor::~CStatusMonitor(void)
+{	
+}
+
+void CStatusMonitor::InitGlassLoading()
+{	
+	for(int i=0;i<MAX_SCAN_COUNT;i++)
+	{
+		m_nGrabFrame[i] = 0;
+		m_bGrabEnd[i] = FALSE;
+	}
+
+	LoadInspectOpt();
+}
+
+void CStatusMonitor::LoadProfileOpt(CString strRecipe)
+{
+	CString		strTaget;
+
+	strTaget.Format(_T("C:\\RCutProject\\Recipe\\%s_Profile.cfg"),strRecipe);
+
+	CFileFind findFile;
+	BOOL bFind = findFile.FindFile(strTaget);
+	if(bFind == FALSE)
+		return;
+
+	CConfig Config;
+
+	if (!Config.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strTaget, FileMap_Mode))
+		return;
+
+	Config.GetItemValue(_T("PROFILE_RCUT_C_X"), m_ProfileOpt.m_nProfileOff_C_X,0);
+	Config.GetItemValue(_T("PROFILE_RCUT_C_Y"), m_ProfileOpt.m_nProfileOff_C_Y,0);
+	Config.GetItemValue(_T("PROFILE_RCUT_C_DN_X"), m_ProfileOpt.m_nProfileOff_C_DN_X,0);
+	Config.GetItemValue(_T("PROFILE_RCUT_C_DN_Y"), m_ProfileOpt.m_nProfileOff_C_DN_Y,0);
+	Config.GetItemValue(_T("PROFILE_RCUT_A_X"), m_ProfileOpt.m_nProfileOff_A_X,0);
+	Config.GetItemValue(_T("PROFILE_RCUT_A_Y"), m_ProfileOpt.m_nProfileOff_A_Y,0);
+	Config.GetItemValue(_T("PROFILE_RCUT_A_DN_X"), m_ProfileOpt.m_nProfileOff_A_DN_X,0);
+	Config.GetItemValue(_T("PROFILE_RCUT_A_DN_Y"), m_ProfileOpt.m_nProfileOff_A_DN_Y,0);
+
+	CString		str;
+	for(int iStage=0;iStage<MAX_STAGE_HAND_COUNT;iStage++)
+	{
+		if(iStage == 0)	// 扁粮 汲沥颇老阑 荤侩窍扁 困秦 盒扁窃.
+		{
+			for(int i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+			{
+				str.Format(_T("PROFILE_RCUT_RADIUS_%d"),i+1);
+				Config.GetItemValue(str, m_ProfileOpt.m_dProfileRadius[iStage][i],0);
+			}
+		}
+		else
+		{
+			for(int i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+			{
+				str.Format(_T("%d_PROFILE_RCUT_RADIUS_%d"),iStage,i+1);
+				Config.GetItemValue(str, m_ProfileOpt.m_dProfileRadius[iStage][i],0);
+			}
+		}
+	}
+}
+
+void CStatusMonitor::LoadInspectOpt()
+{
+	CString		strTaget = _T("C:\\RCutProject\\Config\\InspectOption.cfg");
+
+	CFileFind findFile;
+	BOOL bFind = findFile.FindFile(strTaget);
+	if(bFind == FALSE)
+		return;
+
+	CConfig Config;
+
+	if (!Config.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strTaget, FileMap_Mode))
+		return;
+
+	Config.GetItemValue(_T("SAVE_NOTCHI"), m_InspectOpt.bSaveNotchi,FALSE);
+	Config.GetItemValue(_T("SAVE_CORNERCHIP"), m_InspectOpt.bSaveCornerChip,FALSE);	
+	Config.GetItemValue(_T("SAVE_CORNERSPLINE"), m_InspectOpt.bSaveCornerSP,FALSE);
+	Config.GetItemValue(_T("SAVE_SPLINE"), m_InspectOpt.bSaveSpline,FALSE);
+	Config.GetItemValue(_T("SAVE_EDGE"), m_InspectOpt.bSaveEdge,FALSE);		
+	Config.GetItemValue(_T("SAVE_DIMENSION"), m_InspectOpt.bSaveDimension,FALSE);
+	Config.GetItemValue(_T("SAVE_SPLINECHIP"), m_InspectOpt.bSaveSplineChip,FALSE);	
+	Config.GetItemValue(_T("SAVE_CUTAREA"), m_InspectOpt.bSaveCutArea,FALSE);	
+	Config.GetItemValue(_T("SAVE_CHIPDEFECTIMAGE"), m_InspectOpt.bSaveChipDefectImg,FALSE);		
+	Config.GetItemValue(_T("NOTCH_NODETSKIPSIZE"), m_InspectOpt.nNotchNoDetSkip,10);	
+	Config.GetItemValue(_T("NOTCH_DETSKIPSIZE"), m_InspectOpt.nNotchDetSkip,5);		
+	Config.GetItemValue(_T("CHAMFER_INSHEIGHT"), m_InspectOpt.nChamferInsHeight,100);		
+	Config.GetItemValue(_T("CHAMFER_SEARCHWIDTH"), m_InspectOpt.nChamferSearchWidth,30);	
+	Config.GetItemValue(_T("CHAMFER_CHIPPINGAREA"), m_InspectOpt.nChippingInsArea,150);
+	Config.GetItemValue(_T("CHAMFER_CRACKAREA"), m_InspectOpt.nCrackINsArea,300);
+	Config.GetItemValue(_T("CHAMFER_BROKENAREA"), m_InspectOpt.nBrokenInsArea,450);
+
+	Config.GetItemValue(_T("CHIPPING_MIN_SIZE"), m_InspectOpt.nChippingInsMinSize,5);
+	Config.GetItemValue(_T("CRACK_MIN_SIZE"), m_InspectOpt.nCrackInsMinSize,5);
+	Config.GetItemValue(_T("BROKEN_MIN_SIZE"), m_InspectOpt.nBrokenInsMinSize,5);
+	Config.GetItemValue(_T("BURR_MIN_SIZE"), m_InspectOpt.nBurrInsMinSize,5);
+
+	Config.GetItemValue(_T("CHIPPING_SIDE_FILTER_RANGE"), m_InspectOpt.nChippingInsSideFilterRange,10);
+	Config.GetItemValue(_T("CRACK_SIDE_FILTER_RANGE"), m_InspectOpt.nCrackInsSideFilterRange,10);
+	Config.GetItemValue(_T("BROKEN_SIDE_FILTER_RANGE"), m_InspectOpt.nBrokenInsSideFilterRnage,10);
+	Config.GetItemValue(_T("BURR_SIDE_FILTER_RANGE"), m_InspectOpt.nBurrInsSideFilterRange,10);	
+
+	Config.GetItemValue(_T("USE_RANDOM_DATA"), m_InspectOpt.bUseRandomData,FALSE);	
+
+	ReadRandomData(Config,_T("B_GRINDLINE"),m_InspectOpt.B_GrindLine);
+	ReadRandomData(Config,_T("C_GRINDLINE"),m_InspectOpt.C_GrindLine);
+	ReadRandomData(Config,_T("D_GRINDLINE"),m_InspectOpt.D_GrindLine);
+	ReadRandomData(Config,_T("A1_GRINDLINE"),m_InspectOpt.A1_GrindLine);
+	ReadRandomData(Config,_T("A2_GRINDLINE"),m_InspectOpt.A2_GrindLine);
+	ReadRandomData(Config,_T("A1_RCUT"),m_InspectOpt.A1_Rcut);
+	ReadRandomData(Config,_T("A2_RCUT"),m_InspectOpt.A2_Rcut);
+	ReadRandomData(Config,_T("C1_RCUT"),m_InspectOpt.C1_Rcut);
+	ReadRandomData(Config,_T("C2_RCUT"),m_InspectOpt.C2_Rcut);
+
+	Config.GetItemValue(_T("ALIGN_MARK_RANGE"), m_InspectOpt.nAlignMarkRange,100);	
+	Config.GetItemValue(_T("ALIGN_MARK_RANGE_Y"), m_InspectOpt.nAlignMarkRangeY,100);
+
+	// 220427, 价覆 眠啊 夸没
+
+	if(m_InspectOpt.bUseRandomData == FALSE)
+	{
+		strTaget = _T("C:\\RCutProject\\Config\\YAN.cfg");
+		bFind = findFile.FindFile(strTaget);
+		if(bFind == FALSE)
+			return;
+
+		if (!Config.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strTaget, FileMap_Mode))
+			return;
+
+		Config.GetItemValue(_T("USE_RANDOM_DATA"), m_InspectOpt.bUseRandomData,FALSE);
+
+		ReadRandomData(Config,_T("B_GRINDLINE"),m_InspectOpt.B_GrindLine);
+		ReadRandomData(Config,_T("C_GRINDLINE"),m_InspectOpt.C_GrindLine);
+		ReadRandomData(Config,_T("D_GRINDLINE"),m_InspectOpt.D_GrindLine);
+		ReadRandomData(Config,_T("A1_GRINDLINE"),m_InspectOpt.A1_GrindLine);
+		ReadRandomData(Config,_T("A2_GRINDLINE"),m_InspectOpt.A2_GrindLine);
+		ReadRandomData(Config,_T("A1_RCUT"),m_InspectOpt.A1_Rcut);
+		ReadRandomData(Config,_T("A2_RCUT"),m_InspectOpt.A2_Rcut);
+		ReadRandomData(Config,_T("C1_RCUT"),m_InspectOpt.C1_Rcut);
+		ReadRandomData(Config,_T("C2_RCUT"),m_InspectOpt.C2_Rcut);
+	}
+}
+
+void CStatusMonitor::ReadRandomData(CConfig &Config,CString strSection,CRandomDataSet &DataSet)
+{
+	CString		strName;
+
+	strName.Format(_T("%s_PROFILE_MIN"),strSection);
+	Config.GetItemValue(strName, DataSet.Profile.dMin,0);	
+	strName.Format(_T("%s_PROFILE_MAX"),strSection);
+	Config.GetItemValue(strName, DataSet.Profile.dMax,0);	
+	strName.Format(_T("%s_PROFILE_LIMIT"),strSection);
+	Config.GetItemValue(strName, DataSet.Profile.dLimit,0);	
+
+	strName.Format(_T("%s_CHAMFER_UP_MIN"),strSection);
+	Config.GetItemValue(strName, DataSet.ChamferUp.dMin,0);	
+	strName.Format(_T("%s_CHAMFER_UP_MAX"),strSection);
+	Config.GetItemValue(strName, DataSet.ChamferUp.dMax,0);	
+	strName.Format(_T("%s_CHAMFER_UP_LIMIT"),strSection);
+	Config.GetItemValue(strName, DataSet.ChamferUp.dLimit,0);	
+
+	strName.Format(_T("%s_CHAMFER_DN_MIN"),strSection);
+	Config.GetItemValue(strName, DataSet.ChamferDn.dMin,0);	
+	strName.Format(_T("%s_CHAMFER_DN_MAX"),strSection);
+	Config.GetItemValue(strName, DataSet.ChamferDn.dMax,0);	
+	strName.Format(_T("%s_CHAMFER_DN_LIMIT"),strSection);
+	Config.GetItemValue(strName, DataSet.ChamferDn.dLimit,0);	
+}
+
+int	CStatusMonitor::GetGrabFrameCount(int iScan)
+{
+	if(iScan < 0 || iScan >= MAX_SCAN_COUNT)
+		return 0;
+
+	return m_nGrabFrame[iScan];
+}
+
+void CStatusMonitor::SetGrabEnd(int iScan)
+{
+	if(iScan < 0 || iScan >= MAX_SCAN_COUNT)
+		return;
+
+	m_bGrabEnd[iScan] = TRUE;
+}
+
+void CStatusMonitor::SetGrabFrametoScan(int iScan,int nFrame)
+{
+	if(iScan < 0 || iScan >= MAX_SCAN_COUNT)
+		return;
+
+	m_nGrabFrame[iScan] = nFrame;
+}
+
+BOOL CStatusMonitor::CheckDirectory(const TCHAR szPathName[])
+{
+	CFileFind finder;
+	CString strTemp;
+	CString strDir = szPathName;
+	int nPos;
+	if (finder.FindFile(szPathName) == FALSE)
+	{
+		nPos = strDir.Find(_T("\\"));
+		nPos = strDir.Find(_T("\\"), nPos+1);
+		while(nPos > 0)
+		{
+			strTemp = strDir.Mid(0,nPos);
+			if(0 < strTemp.GetLength())
+			{
+				if(CString("\\") == strTemp.GetAt(strTemp.GetLength()-1))
+				{
+					nPos = strDir.Find(_T("\\"), nPos+1);
+					continue;
+				}
+			}
+			if (finder.FindFile(strTemp) == FALSE)
+			{
+				if(::CreateDirectory(strTemp, NULL) == FALSE)
+				{
+					strTemp.Format(_T("[%s]Folder Create Fail. "), szPathName);
+
+					//LogMessage(strTemp, 2);
+					return FALSE;
+				}
+			}
+			nPos = strDir.Find(_T("\\"), nPos+1);
+		}
+	}	
+	return TRUE;
+}
\ No newline at end of file
diff --git a/ENRIT/Define/StatusMonitor.h b/ENRIT/Define/StatusMonitor.h
new file mode 100644
index 0000000..5cadde8
--- /dev/null
+++ b/ENRIT/Define/StatusMonitor.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "Singleton.h"
+#include "Global_Define.h"
+#include "LicenseChecker.h"
+
+class CStatusMonitor : public Singleton<CStatusMonitor>
+{
+public:
+	CStatusMonitor(void);
+	virtual ~CStatusMonitor(void);
+	
+	void		SetFrameBuffer(int iCam,CFrameBufferController *pFrameBuffer){m_pFrameBuffer[iCam] = pFrameBuffer;}
+	CFrameBufferController *GetFrameBuffer(int iCam){return m_pFrameBuffer[iCam];}	
+	
+	void		InitGlassLoading();
+	CInspectOption	*GetInspectOption(){return &m_InspectOpt;}
+	void		LoadInspectOpt();
+	CProfileOption	*GetProfileOption(){return &m_ProfileOpt;}
+	void		LoadProfileOpt(CString strRecipe);	
+
+	void		SetGrabFrametoScan(int iScan,int nFrame);
+	int			GetGrabFrameCount(int iScan);
+	void		SetGrabEnd(int iScan);
+
+	BOOL		CheckDirectory(const TCHAR szPathName[]);
+
+protected:
+	void		ReadRandomData(CConfig &Config,CString strSection,CRandomDataSet &DataSet);
+
+public:
+	int			m_iScanIdx;
+	CFrameBufferController	*m_pFrameBuffer[MAX_CAMERA_COUNT];
+	
+	int			m_nGrabFrame[MAX_SCAN_COUNT];
+	BOOL		m_bGrabEnd[MAX_SCAN_COUNT];
+	CInspectOption		m_InspectOpt;
+	CProfileOption m_ProfileOpt;	
+	CLicenseChecker* m_pLicenseChecker;
+};
+
+#define g_pStatus CStatusMonitor::GetSingletonPtr()
\ No newline at end of file
diff --git a/ENRIT/ENRIT.cpp b/ENRIT/ENRIT.cpp
new file mode 100644
index 0000000..1c1e4b8
--- /dev/null
+++ b/ENRIT/ENRIT.cpp
@@ -0,0 +1,311 @@
+锘�
+// ENRIT.cpp : 瀹氫箟搴旂敤绋嬪簭鐨勭被鍔ㄤ綔銆�
+//
+
+#include "stdafx.h"
+#include "afxwinappex.h"
+#include "afxdialogex.h"
+#include "ENRIT.h"
+#include "MainFrm.h"
+
+#include "ENRITDoc.h"
+#include "ENRITView.h"
+
+#include <gdiplus.h>
+using namespace Gdiplus;
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+#pragma comment(lib, "DbgHelp.lib")
+
+LONG WINAPI MyUnhandledExceptionFilter(EXCEPTION_POINTERS* pExceptionInfo) {
+	//RCutProject_DmpFile.dmp
+	
+	char szFileName[MAX_PATH];
+	struct stat buffer;
+	if (stat("D:\\Temp", &buffer) != 0)
+	{
+		CreateDirectory(_T("D:\\Temp"), NULL);
+	}
+
+	if (stat("D:\\Temp\\Log", &buffer) != 0)
+	{
+		CreateDirectory(_T("D:\\Temp\\Log"), NULL);
+	}
+
+	CString file_path;
+	file_path.Format(_T("D:\\Temp\\Log\\%s.csv"), g_pBase->m_strLoadingDay);
+
+	CFile file_module;
+	CFileException exception;
+
+	file_module.Open(file_path, CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate | CFile::shareDenyWrite | CFile::shareDenyRead, &exception);
+
+	if (exception.m_cause == CFileException::none)
+	{
+		if (file_module.SeekToEnd() == 0L)
+		{
+			CString defect_title;
+			defect_title.Format(_T("Date,GlassID,Path,Versions\r\n"));
+			file_module.Write(defect_title, defect_title.GetLength() * sizeof(TCHAR));
+		}
+
+		SYSTEMTIME st;
+		GetLocalTime(&st);
+
+		CString strTime;
+		strTime.Format(_T("%02d:%02d:%02d"), st.wHour, st.wMinute, st.wSecond);
+		CString strVersions = L"";
+
+		TCHAR szAppFile[MAX_PATH] = { 0 };
+		::GetModuleFileName(NULL, szAppFile, MAX_PATH);
+
+		HANDLE hAppFile = CreateFile(szAppFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+		if (hAppFile != INVALID_HANDLE_VALUE)
+		{
+			FILETIME fileTime_Create;
+			FILETIME fileTime_LastAccess;
+			FILETIME fileTime_LastWrite;
+
+			if (!GetFileTime(hAppFile, &fileTime_Create, &fileTime_LastAccess, &fileTime_LastWrite))
+			{
+				CloseHandle(hAppFile);
+			}
+			else
+			{
+				FILETIME fileTime_Local;
+				FileTimeToLocalFileTime(&fileTime_LastWrite, &fileTime_Local);
+				FileTimeToSystemTime(&fileTime_Local, &st);
+
+				strVersions.Format(L"%04d/%02d/%02d %02d:%02d:%02d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
+
+				CloseHandle(hAppFile);
+			}
+		}
+
+		CString strData;
+		strData.Format(_T("%s,%s,%s,%s\r\n"), strTime, g_pBase->m_strHPanelID, szAppFile, strVersions);
+		file_module.Write(strData, strData.GetLength() * sizeof(TCHAR));
+		file_module.Close();
+	}
+
+	snprintf(szFileName, MAX_PATH, "D:\\Temp\\RCutProject_DmpFile.dmp");
+
+	AfxMessageBox(_T("system failure!!!"));
+
+	// ?瀛欏喖閬�
+	HANDLE hFile = CreateFileA(szFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+	if (hFile != INVALID_HANDLE_VALUE) {
+		MINIDUMP_EXCEPTION_INFORMATION dumpInfo;
+		dumpInfo.ExceptionPointers = pExceptionInfo;
+		dumpInfo.ThreadId = GetCurrentThreadId();
+		dumpInfo.ClientPointers = TRUE;
+
+		// ?蹇慸ump鍐奸亗
+		BOOL success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpWithFullMemory, &dumpInfo, NULL, NULL);
+		CloseHandle(hFile);
+
+		if (!success) {
+			std::cerr << "Failed to write dump file." << std::endl;
+		}
+		else {
+			std::cerr << "Dump file written to " << szFileName << std::endl;
+		}
+	}
+	else {
+		std::cerr << "Failed to create dump file." << std::endl;
+	}
+
+	return EXCEPTION_EXECUTE_HANDLER;
+}
+
+// CENRITApp
+
+BEGIN_MESSAGE_MAP(CENRITApp, CWinApp)
+	ON_COMMAND(ID_APP_ABOUT, &CENRITApp::OnAppAbout)
+	// 鍩轰簬鏍囧噯鏂囦欢鐨勬枃浠跺懡浠ゃ��
+	ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
+	ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
+END_MESSAGE_MAP()
+
+
+// CENRITApp 鐢熸垚
+
+CENRITApp::CENRITApp()
+{
+	// TODO: 灏嗕笅闈㈢殑搴旂敤绋嬪簭ID瀛楃涓叉浛鎹负鍥烘湁ID瀛楃涓�(寤鸿)銆�
+	// 瀛楃涓茬殑鏍煎紡: CompanyName.ProductName.SubProduct.VersionInformation
+	SetAppID(_T("ENRIT.AppID.NoVersion"));
+
+	m_bCreateBase = FALSE;
+	m_bCreateLog = FALSE;
+	m_hMutex = NULL;
+}
+
+// 鍞竴鐨凜ENRITApp涓綋銆�
+
+CENRITApp theApp;
+
+
+// CENRITApp 鍒濆鍖�
+
+BOOL CENRITApp::InitInstance()
+{
+	SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
+	CWinApp::InitInstance();
+
+	m_hMutex = ::CreateMutex(NULL,FALSE, _T("MutexRCutInspector"));
+	if (m_hMutex != NULL)
+	{
+		if(::GetLastError() == ERROR_ALREADY_EXISTS) 
+		{	
+			AfxMessageBox(_T("The Program is already running. Exit this Program."), MB_OK | MB_ICONERROR);
+			return FALSE;
+		}
+	}	
+
+	if (!AfxSocketInit())
+	{
+		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
+		return FALSE;
+	}
+
+	// 鍒濆鍖朞LE搴撱��
+	if (!AfxOleInit())
+	{
+		AfxMessageBox(IDP_OLE_INIT_FAILED);
+		return FALSE;
+	}
+
+	AfxEnableControlContainer();
+
+	EnableTaskbarInteraction(FALSE);
+
+	// 瑕佷娇鐢≧ichEdit鎺у埗锛屽繀椤绘湁AfxInitRichEdit2()銆�
+	// AfxInitRichEdit2();
+
+	// 鏍囧噯鍒濆鍖�
+	// 濡傛灉鎯冲湪涓嶄娇鐢ㄨ繖浜涘姛鑳界殑鎯呭喌涓嬬缉灏忔渶缁堝彲鎵ц鏂囦欢鐨勫ぇ灏�
+	// 涓嬮潰涓嶉渶瑕佺殑鐗瑰畾鍒濆鍖�
+	// 浣犲繀椤诲幓闄や緥琛屽姩浣溿��
+	// 鏇存敼淇濆瓨璇ヨ缃殑娉ㄥ唽琛ㄩ敭銆�
+	// TODO: 灏嗚瀛楃涓蹭笌鍏徃鍚嶇О鎴栫粍缁囧悕绉扮浉鍚�
+	// 搴旇淇敼鎴愰�傚綋鐨勫唴瀹广��
+	SetRegistryKey(_T("鏈湴搴旂敤绋嬪簭鍚戝涓敓鎴愮殑搴旂敤绋嬪簭"));
+	LoadStdProfileSettings(4);  // 鍔犺浇鏍囧噯INI鏂囦欢閫夐」锛屽寘鎷琈RU銆�
+
+	if (NULL != g_pBase)
+	{
+		m_bCreateBase = TRUE;
+	}
+
+	if (NULL != g_pLog)
+	{
+		m_bCreateLog = TRUE;
+		//g_pLog->SetPath(_T("C:\\RCutProject\\log"));
+	}
+
+	if (NULL != g_pLang)
+	{
+		m_bCreateLang = TRUE;
+	}
+
+	// 娉ㄥ唽搴旂敤绋嬪簭鐨勬枃妗fā鏉裤��
+	// 鏂囨。妯℃澘鏄枃妗c�佹鏋剁獥鍙e拰瑙嗗浘涔嬮棿鐨勮繛鎺ャ��
+	CSingleDocTemplate* pDocTemplate;
+	pDocTemplate = new CSingleDocTemplate(
+		IDR_MAINFRAME,
+		RUNTIME_CLASS(CENRITDoc),
+		RUNTIME_CLASS(CMainFrame),       // 涓昏SDI妗嗘灦绐楀彛銆�
+		RUNTIME_CLASS(CENRITView));
+	if (!pDocTemplate)
+		return FALSE;
+	AddDocTemplate(pDocTemplate);
+
+	// 鍒嗘瀽鏍囧噯澶栧3鍛戒护銆丏DE鍜屾墦寮�鏂囦欢鐨勫懡浠よ銆�
+	CCommandLineInfo cmdInfo;
+	ParseCommandLine(cmdInfo);
+
+	// 鍦ㄥ懡浠よ涓垹闄ゆ寚瀹氱殑鍛戒护銆�
+	// 濡傛灉搴旂敤绋嬪簭浠�/RegServer銆�/Register銆�/Unregserver鎴�/Unregister鍚姩锛屽垯杩斿洖FALSE銆�
+	if (!ProcessShellCommand(cmdInfo))
+		return FALSE;
+
+	GdiplusStartupInput gdiplusStartupInput;
+	GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
+
+	// 鍙湁涓�涓獥鍙e垵濮嬪寲锛屾樉绀哄苟鏇存柊銆�
+	m_pMainWnd->ShowWindow(SW_SHOW);
+	m_pMainWnd->UpdateWindow();
+	// 鍙湁鍦ㄦ湁鍚庣紑鏃舵墠璋冪敤DragAcceptFiles銆�
+	// 鍦⊿DI鐨勫簲鐢ㄧ▼搴忎腑锛孭rocessShellCommand涔嬪悗搴旇鍙戠敓杩欐牱鐨勮皟鐢ㄣ��
+
+	CMainFrame* pMain = static_cast<CMainFrame*>(AfxGetMainWnd());
+	//pMain->SetDoc(static_cast<CAlignInspectionDoc*>(pMain->GetActiveDocument()));
+	pMain->SetView(static_cast<CENRITView*>(pMain->GetActiveView()));
+
+	m_bCreateLog = TRUE;
+
+	return TRUE;
+}
+
+int CENRITApp::ExitInstance()
+{
+	m_bCreateBase = FALSE;
+	m_bCreateLog = FALSE; 
+	m_bCreateLang = FALSE;
+
+	CloseHandle(m_hMutex);
+
+	//TODO: 澶勭悊娣诲姞鐨勮祫婧愩��
+	AfxOleTerm(FALSE);
+
+	return CWinApp::ExitInstance();
+}
+
+// CENRITApp娑堟伅澶勭悊鍣�
+
+
+// 鐢ㄤ簬搴旂敤绋嬪簭淇℃伅鐨凜AboutDlg瀵硅瘽妗嗐��
+
+class CAboutDlg : public CDialogEx
+{
+public:
+	CAboutDlg();
+
+	// 瀵硅瘽妗嗘暟鎹��
+	enum { IDD = IDD_ABOUTBOX };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);
+
+	// 瀹炵幇銆�
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
+END_MESSAGE_MAP()
+
+// 鐢ㄤ簬杩愯瀵硅瘽妗嗙殑搴旂敤绋嬪簭鍛戒护銆�
+void CENRITApp::OnAppAbout()
+{
+	CAboutDlg aboutDlg;
+	aboutDlg.DoModal();
+}
+
+// CENRITApp娑堟伅澶勭悊鍣�
+
+
diff --git a/ENRIT/ENRIT.h b/ENRIT/ENRIT.h
new file mode 100644
index 0000000..5fbeb8a
--- /dev/null
+++ b/ENRIT/ENRIT.h
@@ -0,0 +1,39 @@
+
+// ENRIT.h : ENRIT 览侩 橇肺弊伐俊 措茄 林 庆歹 颇老
+//
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "PCH俊 措秦 捞 颇老阑 器窃窍扁 傈俊 'stdafx.h'甫 器窃钦聪促."
+#endif
+
+#include "resource.h"       // 林 扁龋涝聪促.
+
+
+// CENRITApp:
+// 捞 努贰胶狼 备泅俊 措秦辑绰 ENRIT.cpp阑 曼炼窍绞矫坷.
+//
+
+class CENRITApp : public CWinApp
+{
+public:
+	CENRITApp();
+
+	ULONG_PTR		m_gdiplusToken;
+	BOOL			m_bCreateBase;	
+	BOOL			m_bCreateLog;		// 辆丰矫 眉农甫 困秦.
+	BOOL            m_bCreateLang;
+	HANDLE			m_hMutex;			
+
+	HINSTANCE           m_hLangDLL;
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL InitInstance();
+	virtual int ExitInstance();
+
+// 备泅涝聪促.
+	afx_msg void OnAppAbout();
+	DECLARE_MESSAGE_MAP()
+};
+
+extern CENRITApp theApp;
diff --git a/ENRIT/ENRIT.rc b/ENRIT/ENRIT.rc
new file mode 100644
index 0000000..9517db0
--- /dev/null
+++ b/ENRIT/ENRIT.rc
Binary files differ
diff --git a/ENRIT/ENRIT.vcxproj b/ENRIT/ENRIT.vcxproj
new file mode 100644
index 0000000..04e043b
--- /dev/null
+++ b/ENRIT/ENRIT.vcxproj
@@ -0,0 +1,532 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{12044BF5-D688-41F0-9E7C-E558E134F69B}</ProjectGuid>
+    <RootNamespace>ENRIT</RootNamespace>
+    <Keyword>MFCProj</Keyword>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>./View;../Global_Include;../Common_Class/Matrox/Include;../Common_Class/EuresysCam/Include;./Grabber;../Common_Class/SharedMapDll/Header;../Common_Class/CHThreadPool/Header;./Thread;./PLC;./TriggerBoard;./Light;./Process;../Common_Class/CHImageBuffer/Header;../Common_Class/SISBuffer/Header;../Common_Class/EdgeInspect/Header;../Common_Class/SISAssem/Header;./Data;./;../Common_Class/OpenCV/opencv_3.1/include;../Common_Class/OpenCV/opencv_3.1/include/opencv;../Common_Class/OpenCV/opencv_3.1/include/opencv2;./Recipe;D:\SIS\RCUT_Lock\ENRIT;../Common_Class/SISControls/GridControl;./License;../Common_Class/ConfigFileManager/Header;.\FrameBuffer;../Common_Class\SISControls\Header;./Define;./UITool;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>./;../Global_Include;./Define;./Process;./Recipe;./Grabber;./Light;./PLC;./Thread;./View;./UITool;./FrameBuffer;./Data;./TriggerBoard;./License;../Common_Class/ConfigFileManager/Header;../Common_Class/SISControls/Header;../Common_Class/SISControls/GridControl;../Common_Class/SISControls/GridControl/NewCellTypes;../Common_Class/CHThreadPool/Header;../Common_Class/SharedMapDll/Header;../Common_Class/EdgeInspect/Header;../Common_Class/SISBuffer/Header;../Common_Class/SISAssem/Header;../Common_Class/CHImageBuffer/Header;../Common_Class/OpenCV/opencv_3.1/include;../Common_Class/OpenCV/opencv_3.1/include/opencv;../Common_Class/OpenCV/opencv_3.1/include/opencv2;../Common_Class/EuresysCam/Include;../Common_Class/Matrox/Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);../Common_Class/Matrox/lib;../Common_Class/MegaLock/lib</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>Disabled</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>./;../Global_Include;./Define;./Process;./Recipe;./Grabber;./Light;./PLC;./Thread;./View;./UITool;./FrameBuffer;./Data;./TriggerBoard;./License;../Lib/OpenCV/opencv_3.1/include;../Lib/OpenCV/opencv_3.1/include/opencv;../Lib/OpenCV/opencv_3.1/include/opencv2;../Lib/EuresysCam/Include;../Lib/Matrox/Include;C:\Program Files\Teledyne DALSA\Sapera\Include;C:\Program Files\Teledyne DALSA\Sapera\Classes\Basic;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration);../Lib/Matrox/lib;../Lib/MegaLock/lib;C:\Program Files\Teledyne DALSA\Sapera\Lib;C:\Program Files\Teledyne DALSA\Sapera\Lib\Win64</AdditionalLibraryDirectories>
+      <IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
+      <AdditionalDependencies>SapClassBasic.lib;corapi.lib</AdditionalDependencies>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="res\bitmap1.bmp" />
+    <None Include="res\bitmap_r.bmp" />
+    <None Include="res\bmp00001.bmp" />
+    <None Include="res\bmp00002.bmp" />
+    <None Include="res\bmp00003.bmp" />
+    <None Include="res\bmpInfo.bmp" />
+    <None Include="res\BmpWarning.bmp" />
+    <None Include="res\btn_load.bmp" />
+    <None Include="res\buttons.bmp" />
+    <None Include="res\check.bmp" />
+    <None Include="Res\check32.bmp" />
+    <None Include="res\checkno.bmp" />
+    <None Include="Res\checkno32.bmp" />
+    <None Include="res\Defect Image.bmp" />
+    <None Include="res\ENRIT.ico" />
+    <None Include="res\ENRIT.rc2" />
+    <None Include="res\ENRITDoc.ico" />
+    <None Include="res\filelarge.bmp" />
+    <None Include="res\filesmall.bmp" />
+    <None Include="res\ICON\add2.ico" />
+    <None Include="res\ICON\arrow_down_blue.ico" />
+    <None Include="res\ICON\arrow_left_blue.ico" />
+    <None Include="res\ICON\arrow_right_blue.ico" />
+    <None Include="res\ICON\arrow_up_blue.ico" />
+    <None Include="res\ICON\CANCEL.ICO" />
+    <None Include="res\Icon\check.ico" />
+    <None Include="res\ICON\check1.ico" />
+    <None Include="res\ICON\check7.ico" />
+    <None Include="res\ICON\copy.ico" />
+    <None Include="res\ICON\delete2.ico" />
+    <None Include="res\ICON\edit.ico" />
+    <None Include="res\ICON\gear_preferences.ico" />
+    <None Include="res\ICON\gear_run.ico" />
+    <None Include="res\ICON\gear_stop.ico" />
+    <None Include="res\icon\ico00003.ico" />
+    <None Include="res\icon\ico00004.ico" />
+    <None Include="res\ICON\icon3.ico" />
+    <None Include="res\ICON\icon4.ico" />
+    <None Include="res\ICON\icon5.ico" />
+    <None Include="res\ICON\idisk.ico" />
+    <None Include="res\ICON\LedOff.ico" />
+    <None Include="res\ICON\LedOn.ico" />
+    <None Include="res\ICON\load1.ico" />
+    <None Include="res\ICON\MYSL.ICO" />
+    <None Include="res\ICON\navigate_down.ico" />
+    <None Include="res\ICON\navigate_left.ico" />
+    <None Include="res\ICON\navigate_right.ico" />
+    <None Include="res\ICON\navigate_up.ico" />
+    <None Include="res\ICON\OK.ICO" />
+    <None Include="res\ICON\replace248.ico" />
+    <None Include="res\ICON\save1.ico" />
+    <None Include="res\ICON\save_as.ico" />
+    <None Include="res\ICON\SETUP1.ICO" />
+    <None Include="res\ICON\view.ico" />
+    <None Include="res\ICON\view_next.ico" />
+    <None Include="res\ICON\view_previous.ico" />
+    <None Include="res\ICON\warning.ico" />
+    <None Include="res\image.bmp" />
+    <None Include="res\listCell.bmp" />
+    <None Include="res\Load1_Nor.bmp" />
+    <None Include="res\Load1_Push.bmp" />
+    <None Include="res\main.bmp" />
+    <None Include="res\MenuBar.bmp" />
+    <None Include="res\play.bmp" />
+    <None Include="res\play_hot.bmp" />
+    <None Include="Res\propicons.bmp" />
+    <None Include="res\radio_of.bmp" />
+    <None Include="Res\radio_of32.bmp" />
+    <None Include="res\radio_on.bmp" />
+    <None Include="Res\radio_on32.bmp" />
+    <None Include="res\RecipeList_LinkArrow.bmp" />
+    <None Include="res\Right_Arrow.bmp" />
+    <None Include="res\Save1_Nor.bmp" />
+    <None Include="res\Save1_Push.bmp" />
+    <None Include="res\SIS_Splash.bmp" />
+    <None Include="res\stop.bmp" />
+    <None Include="res\stop_hot.bmp" />
+    <None Include="res\writelarge.bmp" />
+    <None Include="res\writesmall.bmp" />
+    <None Include="res\旃措霛�.ico" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="BICommon.h" />
+    <ClInclude Include="CLanguageControl.h" />
+    <ClInclude Include="Data\DefectStorage.h" />
+    <ClInclude Include="Data\Glass_Data.h" />
+    <ClInclude Include="Data\History.h" />
+    <ClInclude Include="Data\InspectDefect.h" />
+    <ClInclude Include="Data\PostProcess.h" />
+    <ClInclude Include="Data\ResultData.h" />
+    <ClInclude Include="Data\ResultFile.h" />
+    <ClInclude Include="Data\StopWatch.h" />
+    <ClInclude Include="Data\TransDataManager.h" />
+    <ClInclude Include="Data\Transfer_Data.h" />
+    <ClInclude Include="Define\Global_Define.h" />
+    <ClInclude Include="Define\InspectionBase.h" />
+    <ClInclude Include="Define\StatusMonitor.h" />
+    <ClInclude Include="ENRIT.h" />
+    <ClInclude Include="ENRITDoc.h" />
+    <ClInclude Include="ENRITView.h" />
+    <ClInclude Include="Grabber\MulticamControl.h" />
+    <ClInclude Include="Grabber\RadientControl.h" />
+    <ClInclude Include="Grabber\SapControl.h" />
+    <ClInclude Include="Grabber\SapLineGrab.h" />
+    <ClInclude Include="IncludeSDK.h" />
+    <ClInclude Include="InterfaceManager.h" />
+    <ClInclude Include="License\LicenseChecker.h" />
+    <ClInclude Include="License\Worker_UpdateLicense.h" />
+    <ClInclude Include="Light\ExternLightControl.h" />
+    <ClInclude Include="Light\ExternLightControlAKPNV.h" />
+    <ClInclude Include="Light\ExternLightControlLCP.h" />
+    <ClInclude Include="Light\LightManager.h" />
+    <ClInclude Include="MainFrm.h" />
+    <ClInclude Include="PLC\Control_Interface.h" />
+    <ClInclude Include="Process\HoleInspector.h" />
+    <ClInclude Include="Process\InspectCamera.h" />
+    <ClInclude Include="Process\ThreadControl.h" />
+    <ClInclude Include="Recipe\GlassRecipe.h" />
+    <ClInclude Include="Recipe\HardwareSettings.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+    <ClInclude Include="Thread\PriorityThread.h" />
+    <ClInclude Include="Thread\Thread_CheckSeq.h" />
+    <ClInclude Include="Thread\Thread_ControlIF.h" />
+    <ClInclude Include="Thread\Thread_Send.h" />
+    <ClInclude Include="Thread\Thread_ViewRefresh.h" />
+    <ClInclude Include="TriggerBoard\TriggerControl_Mvsol.h" />
+    <ClInclude Include="UITool\btnenh.h" />
+    <ClInclude Include="UITool\cellsmanager.h" />
+    <ClInclude Include="UITool\DisplayMessage.h" />
+    <ClInclude Include="UITool\font.h" />
+    <ClInclude Include="UITool\General_Draw.h" />
+    <ClInclude Include="UITool\MImageStatic.h" />
+    <ClInclude Include="UITool\Singleton.h" />
+    <ClInclude Include="UITool\SlimScrollView.h" />
+    <ClInclude Include="UITool\Splash.h" />
+    <ClInclude Include="UITool\StopWatch.h" />
+    <ClInclude Include="UITool\surfacecolor.h" />
+    <ClInclude Include="UITool\textdescriptor.h" />
+    <ClInclude Include="UITool\texture.h" />
+    <ClInclude Include="View\DlgLicenseInfo.h" />
+    <ClInclude Include="View\DlgLogin.h" />
+    <ClInclude Include="View\FrameImg.h" />
+    <ClInclude Include="View\GlassMap.h" />
+    <ClInclude Include="View\ImgDefect.h" />
+    <ClInclude Include="View\ImgListView.h" />
+    <ClInclude Include="View\ViewDefect.h" />
+    <ClInclude Include="View\ViewException.h" />
+    <ClInclude Include="View\ViewHoleRecipeSetting.h" />
+    <ClInclude Include="View\ViewHWSetting.h" />
+    <ClInclude Include="View\ViewInsInformation.h" />
+    <ClInclude Include="View\ViewLampControl.h" />
+    <ClInclude Include="View\ViewLiveCam.h" />
+    <ClInclude Include="View\ViewMapSettings.h" />
+    <ClInclude Include="View\ViewPPIDNew.h" />
+    <ClInclude Include="View\ViewRecipeChamferView.h" />
+    <ClInclude Include="View\ViewRecipeInspectionView.h" />
+    <ClInclude Include="View\ViewRecipeList.h" />
+    <ClInclude Include="View\ViewRecipeNew.h" />
+    <ClInclude Include="View\ViewRecipeProfileView.h" />
+    <ClInclude Include="View\ViewRecipeSetting.h" />
+    <ClInclude Include="View\ViewScanImage.h" />
+    <ClInclude Include="View\ViewSettingNotch.h" />
+    <ClInclude Include="View\ViewSettingSpline.h" />
+    <ClInclude Include="View\ViewUserDefectArea.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="CLanguageControl.cpp" />
+    <ClCompile Include="Data\DefectStorage.cpp" />
+    <ClCompile Include="Data\Glass_Data.cpp" />
+    <ClCompile Include="Data\InspectDefect.cpp" />
+    <ClCompile Include="Data\PostProcess.cpp" />
+    <ClCompile Include="Data\ResultData.cpp" />
+    <ClCompile Include="Data\ResultFile.cpp" />
+    <ClCompile Include="Data\StopWatch.cpp" />
+    <ClCompile Include="Data\TransDataManager.cpp" />
+    <ClCompile Include="Data\Transfer_Data.cpp" />
+    <ClCompile Include="Define\InspectionBase.cpp" />
+    <ClCompile Include="Define\StatusMonitor.cpp" />
+    <ClCompile Include="ENRIT.cpp" />
+    <ClCompile Include="ENRITDoc.cpp" />
+    <ClCompile Include="ENRITView.cpp" />
+    <ClCompile Include="Grabber\MulticamControl.cpp" />
+    <ClCompile Include="Grabber\RadientControl.cpp" />
+    <ClCompile Include="Grabber\SapControl.cpp" />
+    <ClCompile Include="Grabber\SapLineGrab.cpp" />
+    <ClCompile Include="InterfaceManager.cpp" />
+    <ClCompile Include="License\LicenseChecker.cpp" />
+    <ClCompile Include="License\Worker_UpdateLicense.cpp" />
+    <ClCompile Include="Light\ExternLightControl.cpp" />
+    <ClCompile Include="Light\ExternLightControlAKPNV.cpp" />
+    <ClCompile Include="Light\ExternLightControlLCP.cpp" />
+    <ClCompile Include="Light\LightManager.cpp" />
+    <ClCompile Include="MainFrm.cpp" />
+    <ClCompile Include="PLC\Control_Interface.cpp" />
+    <ClCompile Include="Process\HoleInspector.cpp" />
+    <ClCompile Include="Process\InspectCamera.cpp" />
+    <ClCompile Include="Process\ThreadControl.cpp" />
+    <ClCompile Include="Recipe\GlassRecipe.cpp" />
+    <ClCompile Include="Recipe\HardwareSettings.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="Thread\PriorityThread.cpp" />
+    <ClCompile Include="Thread\Thread_CheckSeq.cpp" />
+    <ClCompile Include="Thread\Thread_ControlIF.cpp" />
+    <ClCompile Include="Thread\Thread_Send.cpp" />
+    <ClCompile Include="Thread\Thread_ViewRefresh.cpp" />
+    <ClCompile Include="TriggerBoard\TriggerControl_Mvsol.cpp" />
+    <ClCompile Include="UITool\btnenh.cpp" />
+    <ClCompile Include="UITool\cellsmanager.cpp" />
+    <ClCompile Include="UITool\DisplayMessage.cpp" />
+    <ClCompile Include="UITool\font.cpp" />
+    <ClCompile Include="UITool\General_Draw.cpp" />
+    <ClCompile Include="UITool\MImageStatic.cpp" />
+    <ClCompile Include="UITool\SlimScrollView.cpp" />
+    <ClCompile Include="UITool\Splash.cpp" />
+    <ClCompile Include="UITool\StopWatch.cpp" />
+    <ClCompile Include="UITool\surfacecolor.cpp" />
+    <ClCompile Include="UITool\textdescriptor.cpp" />
+    <ClCompile Include="UITool\texture.cpp" />
+    <ClCompile Include="View\DlgLicenseInfo.cpp" />
+    <ClCompile Include="View\DlgLogin.cpp" />
+    <ClCompile Include="View\FrameImg.cpp" />
+    <ClCompile Include="View\GlassMap.cpp" />
+    <ClCompile Include="View\ImgDefect.cpp" />
+    <ClCompile Include="View\ImgListView.cpp" />
+    <ClCompile Include="View\ViewDefect.cpp" />
+    <ClCompile Include="View\ViewException.cpp" />
+    <ClCompile Include="View\ViewHoleRecipeSetting.cpp" />
+    <ClCompile Include="View\ViewHWSetting.cpp" />
+    <ClCompile Include="View\ViewInsInformation.cpp" />
+    <ClCompile Include="View\ViewLampControl.cpp" />
+    <ClCompile Include="View\ViewLiveCam.cpp" />
+    <ClCompile Include="View\ViewMapSettings.cpp" />
+    <ClCompile Include="View\ViewPPIDNew.cpp" />
+    <ClCompile Include="View\ViewRecipeChamferView.cpp" />
+    <ClCompile Include="View\ViewRecipeInspectionView.cpp" />
+    <ClCompile Include="View\ViewRecipeList.cpp" />
+    <ClCompile Include="View\ViewRecipeNew.cpp" />
+    <ClCompile Include="View\ViewRecipeProfileView.cpp" />
+    <ClCompile Include="View\ViewRecipeSetting.cpp" />
+    <ClCompile Include="View\ViewScanImage.cpp" />
+    <ClCompile Include="View\ViewSettingNotch.cpp" />
+    <ClCompile Include="View\ViewSettingSpline.cpp" />
+    <ClCompile Include="View\ViewUserDefectArea.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="ENRIT.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\bitmap_d.bmp" />
+    <Image Include="res\bitmap_w.bmp" />
+    <Image Include="res\bmp00004.bmp" />
+    <Image Include="res\bmp00005.bmp" />
+    <Image Include="res\bmp00006.bmp" />
+    <Image Include="res\bmp00007.bmp" />
+    <Image Include="res\bmp00008.bmp" />
+    <Image Include="res\bmp00009.bmp" />
+    <Image Include="res\bmp00010.bmp" />
+    <Image Include="res\bmp00011.bmp" />
+    <Image Include="res\bmp00012.bmp" />
+    <Image Include="res\bmp00013.bmp" />
+    <Image Include="res\bmp00014.bmp" />
+    <Image Include="res\bmp00015.bmp" />
+    <Image Include="res\bmp00016.bmp" />
+    <Image Include="res\bmp00017.bmp" />
+    <Image Include="res\bmp00018.bmp" />
+    <Image Include="res\bmp00019.bmp" />
+    <Image Include="res\bmp00020.bmp" />
+    <Image Include="res\bmp00021.bmp" />
+    <Image Include="res\bmp00022.bmp" />
+    <Image Include="res\bmp00023.bmp" />
+    <Image Include="res\bmp00024.bmp" />
+    <Image Include="res\bmp00025.bmp" />
+    <Image Include="res\bmp00026.bmp" />
+    <Image Include="res\bmp_info.bmp" />
+    <Image Include="res\btn_save.bmp" />
+    <Image Include="res\checkno3.bmp" />
+    <Image Include="res\filelarg.bmp" />
+    <Image Include="res\filesmal.bmp" />
+    <Image Include="res\icon\ico00001.ico" />
+    <Image Include="res\icon\ico00002.ico" />
+    <Image Include="res\icon\ico00005.ico" />
+    <Image Include="res\icon\ico00006.ico" />
+    <Image Include="res\icon\ico00007.ico" />
+    <Image Include="res\icon\ico00008.ico" />
+    <Image Include="res\icon\ico00009.ico" />
+    <Image Include="res\icon\ico00010.ico" />
+    <Image Include="res\icon\ico00011.ico" />
+    <Image Include="res\icon\ico00012.ico" />
+    <Image Include="res\icon\ico00013.ico" />
+    <Image Include="res\icon\ico00014.ico" />
+    <Image Include="res\icon\ico00015.ico" />
+    <Image Include="res\icon\icon_add.ico" />
+    <Image Include="res\icon\icon_app.ico" />
+    <Image Include="res\icon\icon_arr.ico" />
+    <Image Include="res\icon\icon_can.ico" />
+    <Image Include="res\icon\icon_cha.ico" />
+    <Image Include="res\icon\icon_chk.ico" />
+    <Image Include="res\icon\icon_ck_.ico" />
+    <Image Include="res\icon\icon_cop.ico" />
+    <Image Include="res\icon\icon_del.ico" />
+    <Image Include="res\icon\icon_dis.ico" />
+    <Image Include="res\icon\icon_dow.ico" />
+    <Image Include="res\icon\icon_edi.ico" />
+    <Image Include="res\icon\icon_gea.ico" />
+    <Image Include="res\icon\icon_lef.ico" />
+    <Image Include="res\icon\icon_loa.ico" />
+    <Image Include="res\icon\icon_pc.ico" />
+    <Image Include="res\icon\icon_rep.ico" />
+    <Image Include="res\icon\icon_rig.ico" />
+    <Image Include="res\icon\icon_sav.ico" />
+    <Image Include="res\icon\icon_up.ico" />
+    <Image Include="res\icon\icon_up_.ico" />
+    <Image Include="res\icon\icon_vie.ico" />
+    <Image Include="res\icon\icon_war.ico" />
+    <Image Include="res\icon\idr_enri.ico" />
+    <Image Include="res\icon\idr_main.ico" />
+    <Image Include="res\icon\led_off.ico" />
+    <Image Include="res\icon\led_on.ico" />
+    <Image Include="res\led_off.bmp" />
+    <Image Include="res\led_on.bmp" />
+    <Image Include="res\list_cel.bmp" />
+    <Image Include="res\menu_bar.bmp" />
+    <Image Include="res\propicon.bmp" />
+    <Image Include="res\splash.bmp" />
+    <Image Include="res\writelar.bmp" />
+    <Image Include="res\writesma.bmp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="ENRIT.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/ENRIT/ENRIT.vcxproj.filters b/ENRIT/ENRIT.vcxproj.filters
new file mode 100644
index 0000000..94e699c
--- /dev/null
+++ b/ENRIT/ENRIT.vcxproj.filters
@@ -0,0 +1,1027 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Process">
+      <UniqueIdentifier>{91de03c0-c911-4d3f-b1b8-52da1b3b79db}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Recipe">
+      <UniqueIdentifier>{7434b3b5-33f5-4d42-bd6c-d2629aebc856}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Light">
+      <UniqueIdentifier>{57b1515f-d3ee-46db-8866-bd498226283c}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="PLC">
+      <UniqueIdentifier>{589bc8fb-f8b0-4603-b608-c06213a578f4}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Thread">
+      <UniqueIdentifier>{e9bb7714-3608-4d7b-952a-f6ea38c2bd02}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="View">
+      <UniqueIdentifier>{d313f75f-22a5-4da3-8b17-6a92a8081a66}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="UITool">
+      <UniqueIdentifier>{2b8003b0-7ff1-4df6-b7ca-2d6c4aacde98}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Define">
+      <UniqueIdentifier>{282a47cc-615e-4fc5-a048-d78d00a0d506}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Data">
+      <UniqueIdentifier>{fe5e49a9-2a1a-447a-abc7-d65847ac6add}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="TriggerBoard">
+      <UniqueIdentifier>{854eeea5-91c7-4a96-a050-636e4cee38e3}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="License">
+      <UniqueIdentifier>{7bcdadfb-7528-488d-94e2-2c189c6f16e2}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Language">
+      <UniqueIdentifier>{234e7e8a-4708-4356-8956-49179ae28d82}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Grabber">
+      <UniqueIdentifier>{06c793e7-e434-4b2d-af4a-42fc5ccfa17f}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ReadMe.txt" />
+    <None Include="res\ENRIT.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ENRITDoc.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ENRIT.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\旃措霛�.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\LedOn.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\LedOff.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\warning.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\view_previous.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\view_next.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\view.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\icon\ico00004.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\navigate_up.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\save_as.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\navigate_right.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\replace248.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\SETUP1.ICO">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\load1.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\MYSL.ICO">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\icon\ico00003.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\navigate_left.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\gear_stop.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\gear_run.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\gear_preferences.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\edit.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\navigate_down.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\save1.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\idisk.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\delete2.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\copy.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\OK.ICO">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\check7.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\icon5.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Icon\check.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\icon4.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\icon3.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\CANCEL.ICO">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\arrow_up_blue.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\arrow_right_blue.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\arrow_left_blue.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\arrow_down_blue.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\check1.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\ICON\add2.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\SIS_Splash.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\MenuBar.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\listCell.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\bitmap1.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\bmp00001.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Save1_Push.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\bmp00002.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Save1_Nor.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\bmp00003.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\btn_load.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Load1_Push.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Load1_Nor.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\bmpInfo.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\BmpWarning.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\bitmap_r.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Right_Arrow.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\RecipeList_LinkArrow.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\Defect Image.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\writesmall.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\writelarge.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\stop_hot.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\stop.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="Res\radio_on32.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\radio_on.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="Res\radio_of32.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\radio_of.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="Res\propicons.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\play_hot.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\play.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\main.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\image.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\filesmall.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\filelarge.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="Res\checkno32.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\checkno.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="Res\check32.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\check.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+    <None Include="res\buttons.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="ENRIT.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="MainFrm.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="ENRITDoc.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="ENRITView.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Process\ThreadControl.h">
+      <Filter>Process</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\btnenh.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="Light\ExternLightControl.h">
+      <Filter>Light</Filter>
+    </ClInclude>
+    <ClInclude Include="Light\ExternLightControlLCP.h">
+      <Filter>Light</Filter>
+    </ClInclude>
+    <ClInclude Include="Light\LightManager.h">
+      <Filter>Light</Filter>
+    </ClInclude>
+    <ClInclude Include="PLC\Control_Interface.h">
+      <Filter>PLC</Filter>
+    </ClInclude>
+    <ClInclude Include="Define\Global_Define.h">
+      <Filter>Define</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\cellsmanager.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\font.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\surfacecolor.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\textdescriptor.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\texture.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\DisplayMessage.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\Singleton.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="Thread\Thread_ControlIF.h">
+      <Filter>Thread</Filter>
+    </ClInclude>
+    <ClInclude Include="Grabber\MulticamControl.h">
+      <Filter>Grabber</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\StopWatch.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="Define\StatusMonitor.h">
+      <Filter>Define</Filter>
+    </ClInclude>
+    <ClInclude Include="Define\InspectionBase.h">
+      <Filter>Define</Filter>
+    </ClInclude>
+    <ClInclude Include="InterfaceManager.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\Splash.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="Thread\PriorityThread.h">
+      <Filter>Thread</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\TransDataManager.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\Transfer_Data.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Process\InspectCamera.h">
+      <Filter>Process</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\Glass_Data.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Recipe\HardwareSettings.h">
+      <Filter>Recipe</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\DefectStorage.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\InspectDefect.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Recipe\GlassRecipe.h">
+      <Filter>Recipe</Filter>
+    </ClInclude>
+    <ClInclude Include="Thread\Thread_CheckSeq.h">
+      <Filter>Thread</Filter>
+    </ClInclude>
+    <ClInclude Include="Thread\Thread_Send.h">
+      <Filter>Thread</Filter>
+    </ClInclude>
+    <ClInclude Include="View\DlgLogin.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\FrameImg.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\GlassMap.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ImgDefect.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ImgListView.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewDefect.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewException.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewHoleRecipeSetting.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewHWSetting.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewInsInformation.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewLampControl.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewLiveCam.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewMapSettings.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewPPIDNew.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewRecipeChamferView.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewRecipeInspectionView.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewRecipeList.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewRecipeNew.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewRecipeProfileView.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewRecipeSetting.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewScanImage.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewSettingNotch.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewSettingSpline.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="View\ViewUserDefectArea.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\General_Draw.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\SlimScrollView.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="UITool\MImageStatic.h">
+      <Filter>UITool</Filter>
+    </ClInclude>
+    <ClInclude Include="Process\HoleInspector.h">
+      <Filter>Process</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\History.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\PostProcess.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\ResultData.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\ResultFile.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Thread\Thread_ViewRefresh.h">
+      <Filter>Thread</Filter>
+    </ClInclude>
+    <ClInclude Include="Light\ExternLightControlAKPNV.h">
+      <Filter>Light</Filter>
+    </ClInclude>
+    <ClInclude Include="Data\StopWatch.h">
+      <Filter>Data</Filter>
+    </ClInclude>
+    <ClInclude Include="Grabber\RadientControl.h">
+      <Filter>Grabber</Filter>
+    </ClInclude>
+    <ClInclude Include="TriggerBoard\TriggerControl_Mvsol.h">
+      <Filter>TriggerBoard</Filter>
+    </ClInclude>
+    <ClInclude Include="View\DlgLicenseInfo.h">
+      <Filter>View</Filter>
+    </ClInclude>
+    <ClInclude Include="License\LicenseChecker.h">
+      <Filter>License</Filter>
+    </ClInclude>
+    <ClInclude Include="License\Worker_UpdateLicense.h">
+      <Filter>License</Filter>
+    </ClInclude>
+    <ClInclude Include="Grabber\SapControl.h">
+      <Filter>Grabber</Filter>
+    </ClInclude>
+    <ClInclude Include="Grabber\SapLineGrab.h">
+      <Filter>Grabber</Filter>
+    </ClInclude>
+    <ClInclude Include="BICommon.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="CLanguageControl.h">
+      <Filter>Language</Filter>
+    </ClInclude>
+    <ClInclude Include="IncludeSDK.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="ENRIT.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="MainFrm.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ENRITDoc.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="ENRITView.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="Process\ThreadControl.cpp">
+      <Filter>Process</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\btnenh.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="Light\ExternLightControl.cpp">
+      <Filter>Light</Filter>
+    </ClCompile>
+    <ClCompile Include="Light\ExternLightControlLCP.cpp">
+      <Filter>Light</Filter>
+    </ClCompile>
+    <ClCompile Include="Light\LightManager.cpp">
+      <Filter>Light</Filter>
+    </ClCompile>
+    <ClCompile Include="PLC\Control_Interface.cpp">
+      <Filter>PLC</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\cellsmanager.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\font.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\surfacecolor.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\textdescriptor.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\texture.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\DisplayMessage.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="Thread\Thread_ControlIF.cpp">
+      <Filter>Thread</Filter>
+    </ClCompile>
+    <ClCompile Include="Grabber\MulticamControl.cpp">
+      <Filter>Grabber</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\StopWatch.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="Define\StatusMonitor.cpp">
+      <Filter>Define</Filter>
+    </ClCompile>
+    <ClCompile Include="Define\InspectionBase.cpp">
+      <Filter>Define</Filter>
+    </ClCompile>
+    <ClCompile Include="InterfaceManager.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\Splash.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="Thread\PriorityThread.cpp">
+      <Filter>Thread</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\TransDataManager.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\Transfer_Data.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Process\InspectCamera.cpp">
+      <Filter>Process</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\Glass_Data.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Recipe\HardwareSettings.cpp">
+      <Filter>Recipe</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\DefectStorage.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\InspectDefect.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Recipe\GlassRecipe.cpp">
+      <Filter>Recipe</Filter>
+    </ClCompile>
+    <ClCompile Include="Thread\Thread_CheckSeq.cpp">
+      <Filter>Thread</Filter>
+    </ClCompile>
+    <ClCompile Include="Thread\Thread_Send.cpp">
+      <Filter>Thread</Filter>
+    </ClCompile>
+    <ClCompile Include="View\DlgLogin.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\FrameImg.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\GlassMap.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ImgDefect.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ImgListView.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewDefect.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewException.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewHoleRecipeSetting.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewHWSetting.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewInsInformation.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewLampControl.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewLiveCam.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewMapSettings.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewPPIDNew.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewRecipeChamferView.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewRecipeInspectionView.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewRecipeList.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewRecipeNew.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewRecipeProfileView.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewRecipeSetting.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewScanImage.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewSettingNotch.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewSettingSpline.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="View\ViewUserDefectArea.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\General_Draw.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\SlimScrollView.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="UITool\MImageStatic.cpp">
+      <Filter>UITool</Filter>
+    </ClCompile>
+    <ClCompile Include="Process\HoleInspector.cpp">
+      <Filter>Process</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\PostProcess.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\ResultData.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\ResultFile.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Thread\Thread_ViewRefresh.cpp">
+      <Filter>Thread</Filter>
+    </ClCompile>
+    <ClCompile Include="Light\ExternLightControlAKPNV.cpp">
+      <Filter>Light</Filter>
+    </ClCompile>
+    <ClCompile Include="Data\StopWatch.cpp">
+      <Filter>Data</Filter>
+    </ClCompile>
+    <ClCompile Include="Grabber\RadientControl.cpp">
+      <Filter>Grabber</Filter>
+    </ClCompile>
+    <ClCompile Include="TriggerBoard\TriggerControl_Mvsol.cpp">
+      <Filter>TriggerBoard</Filter>
+    </ClCompile>
+    <ClCompile Include="View\DlgLicenseInfo.cpp">
+      <Filter>View</Filter>
+    </ClCompile>
+    <ClCompile Include="License\LicenseChecker.cpp">
+      <Filter>License</Filter>
+    </ClCompile>
+    <ClCompile Include="License\Worker_UpdateLicense.cpp">
+      <Filter>License</Filter>
+    </ClCompile>
+    <ClCompile Include="Grabber\SapLineGrab.cpp">
+      <Filter>Grabber</Filter>
+    </ClCompile>
+    <ClCompile Include="Grabber\SapControl.cpp">
+      <Filter>Grabber</Filter>
+    </ClCompile>
+    <ClCompile Include="CLanguageControl.cpp">
+      <Filter>Language</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="ENRIT.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\bmp00004.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bitmap_d.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00005.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00006.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bitmap_w.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp_info.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00007.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00008.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00009.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00010.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\btn_save.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00011.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00012.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00013.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00014.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00015.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00016.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\checkno3.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\filelarg.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\filesmal.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00017.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\led_off.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\led_on.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\list_cel.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00018.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\menu_bar.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00019.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00020.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\propicon.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00021.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00022.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00023.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00024.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\splash.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00025.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00026.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\writelar.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\writesma.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_add.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_app.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_arr.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00001.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00002.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00005.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_can.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_cha.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_chk.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00006.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00007.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00008.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_ck_.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_cop.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_del.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_dis.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00009.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_dow.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_edi.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_gea.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00010.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00011.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_lef.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00012.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_loa.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00013.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_pc.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_rep.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_rig.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_sav.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_up.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_up_.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_vie.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00014.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00015.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_war.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\led_off.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\led_on.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\idr_enri.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\idr_main.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ENRIT/ENRITDoc.cpp b/ENRIT/ENRITDoc.cpp
new file mode 100644
index 0000000..82e7b6b
--- /dev/null
+++ b/ENRIT/ENRITDoc.cpp
@@ -0,0 +1,137 @@
+
+// ENRITDoc.cpp : CENRITDoc 努锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷
+//
+
+#include "stdafx.h"
+// SHARED_HANDLERS锟斤拷 锟教革拷 锟斤拷锟斤拷, 锟斤拷锟斤拷锟� 锟阶革拷 锟斤拷 锟剿伙拷 锟斤拷锟斤拷 贸锟斤拷锟解甫 锟斤拷锟斤拷锟较达拷 ATL 锟斤拷锟斤拷锟斤拷飘锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷 锟斤拷 锟斤拷锟斤拷锟斤拷
+// 锟截达拷 锟斤拷锟斤拷锟斤拷飘锟斤拷 锟斤拷锟斤拷 锟节靛甫 锟斤拷锟斤拷锟较碉拷锟斤拷 锟斤拷 锟捷聪达拷.
+#ifndef SHARED_HANDLERS
+#include "ENRIT.h"
+#endif
+
+#include "ENRITDoc.h"
+
+#include <propkey.h>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+// CENRITDoc
+
+IMPLEMENT_DYNCREATE(CENRITDoc, CDocument)
+
+BEGIN_MESSAGE_MAP(CENRITDoc, CDocument)
+END_MESSAGE_MAP()
+
+
+// CENRITDoc 锟斤拷锟斤拷/锟揭革拷
+
+CENRITDoc::CENRITDoc()
+{
+	// TODO: 锟斤拷锟解俊 锟斤拷雀锟斤拷 锟斤拷锟斤拷 锟节靛甫 锟竭帮拷锟秸聪达拷.
+
+}
+
+CENRITDoc::~CENRITDoc()
+{
+}
+
+BOOL CENRITDoc::OnNewDocument()
+{
+	if (!CDocument::OnNewDocument())
+		return FALSE;
+
+	// TODO: 锟斤拷锟解俊 锟斤拷锟绞憋拷拳 锟节靛甫 锟竭帮拷锟秸聪达拷.
+	// SDI 锟斤拷锟斤拷锟斤拷 锟斤拷 锟斤拷锟斤拷锟斤拷 锟劫斤拷 锟斤拷锟斤拷沾洗锟�.
+
+	return TRUE;
+}
+
+
+
+
+// CENRITDoc serialization
+
+void CENRITDoc::Serialize(CArchive& ar)
+{
+	if (ar.IsStoring())
+	{
+		// TODO: 锟斤拷锟解俊 锟斤拷锟斤拷 锟节靛甫 锟竭帮拷锟秸聪达拷.
+	}
+	else
+	{
+		// TODO: 锟斤拷锟解俊 锟轿碉拷 锟节靛甫 锟竭帮拷锟秸聪达拷.
+	}
+}
+
+#ifdef SHARED_HANDLERS
+
+// 锟斤拷锟斤拷锟� 锟阶革拷锟斤拷 锟斤拷锟斤拷锟秸聪达拷.
+void CENRITDoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
+{
+	// 锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟酵革拷 锟阶革拷锟斤拷锟斤拷 锟斤拷 锟节靛甫 锟斤拷锟斤拷锟较绞矫匡拷.
+	dc.FillSolidRect(lprcBounds, RGB(255, 255, 255));
+
+	CString strText = _T("TODO: implement thumbnail drawing here");
+	LOGFONT lf;
+
+	CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
+	pDefaultGUIFont->GetLogFont(&lf);
+	lf.lfHeight = 36;
+
+	CFont fontDraw;
+	fontDraw.CreateFontIndirect(&lf);
+
+	CFont* pOldFont = dc.SelectObject(&fontDraw);
+	dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK);
+	dc.SelectObject(pOldFont);
+}
+
+// 锟剿伙拷 贸锟斤拷锟解甫 锟斤拷锟斤拷锟秸聪达拷.
+void CENRITDoc::InitializeSearchContent()
+{
+	CString strSearchContent;
+	// 锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟酵匡拷锟斤拷 锟剿伙拷 锟斤拷锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟秸聪达拷.
+	// 锟斤拷锟斤拷锟斤拷 锟轿猴拷锟斤拷 ";"锟斤拷 锟斤拷锟叫登撅拷锟� 锟秸聪达拷.
+
+	// 锟斤拷: strSearchContent = _T("point;rectangle;circle;ole object;");
+	SetSearchContent(strSearchContent);
+}
+
+void CENRITDoc::SetSearchContent(const CString& value)
+{
+	if (value.IsEmpty())
+	{
+		RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid);
+	}
+	else
+	{
+		CMFCFilterChunkValueImpl *pChunk = NULL;
+		ATLTRY(pChunk = new CMFCFilterChunkValueImpl);
+		if (pChunk != NULL)
+		{
+			pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT);
+			SetChunkValue(pChunk);
+		}
+	}
+}
+
+#endif // SHARED_HANDLERS
+
+// CENRITDoc 锟斤拷锟斤拷
+
+#ifdef _DEBUG
+void CENRITDoc::AssertValid() const
+{
+	CDocument::AssertValid();
+}
+
+void CENRITDoc::Dump(CDumpContext& dc) const
+{
+	CDocument::Dump(dc);
+}
+#endif //_DEBUG
+
+
+// CENRITDoc 锟斤拷锟�
diff --git a/ENRIT/ENRITDoc.h b/ENRIT/ENRITDoc.h
new file mode 100644
index 0000000..921c912
--- /dev/null
+++ b/ENRIT/ENRITDoc.h
@@ -0,0 +1,48 @@
+
+// ENRITDoc.h : CENRITDoc 努锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟教斤拷
+//
+
+
+#pragma once
+
+
+class CENRITDoc : public CDocument
+{
+protected: // serialization锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷洗锟�.
+	CENRITDoc();
+	DECLARE_DYNCREATE(CENRITDoc)
+
+// 漂锟斤拷锟皆聪达拷.
+public:
+
+// 锟桔撅拷锟皆聪达拷.
+public:
+
+// 锟斤拷锟斤拷锟斤拷锟皆聪达拷.
+public:
+	virtual BOOL OnNewDocument();
+	virtual void Serialize(CArchive& ar);
+#ifdef SHARED_HANDLERS
+	virtual void InitializeSearchContent();
+	virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds);
+#endif // SHARED_HANDLERS
+
+// 锟斤拷锟斤拷锟皆聪达拷.
+public:
+	virtual ~CENRITDoc();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected:
+
+// 锟斤拷锟斤拷锟斤拷 锟睫斤拷锟斤拷 锟斤拷 锟皆硷拷
+protected:
+	DECLARE_MESSAGE_MAP()
+
+#ifdef SHARED_HANDLERS
+	// 锟剿伙拷 贸锟斤拷锟解俊 锟斤拷锟斤拷 锟剿伙拷 锟斤拷锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟较达拷 锟斤拷锟斤拷锟� 锟皆硷拷
+	void SetSearchContent(const CString& value);
+#endif // SHARED_HANDLERS
+};
diff --git a/ENRIT/ENRITView.cpp b/ENRIT/ENRITView.cpp
new file mode 100644
index 0000000..e2b18db
--- /dev/null
+++ b/ENRIT/ENRITView.cpp
@@ -0,0 +1,530 @@
+
+// ENRITView.cpp : CENRITView 努贰胶狼 备泅
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ENRITDoc.h"
+#include "ENRITView.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CENRITView
+// CENRITView 积己/家戈
+
+IMPLEMENT_DYNCREATE(CENRITView, CFormView)
+
+CENRITView::CENRITView()
+	: CFormView(CENRITView::IDD)
+{
+	m_pViewInspectInfo = NULL;
+	m_pViewDefect = NULL;
+	m_pViewScanImage = NULL;
+	m_pViewRecipeSetting = NULL;
+	m_pViewLiveCam = NULL;
+	m_pViewHWSetting = NULL;
+	m_IV2M = NULL;
+
+	m_eCurEntry = GLOBAL_DEFINE::EV_VIEW_End;
+	m_eCurView = eView_End;
+
+}
+
+CENRITView::~CENRITView()
+{
+	if(NULL != m_pViewInspectInfo)
+		delete	m_pViewInspectInfo;
+	m_pViewInspectInfo = NULL;
+	if(NULL != m_pViewDefect)
+		delete m_pViewDefect;
+	m_pViewDefect = NULL;
+	if(NULL != m_pViewScanImage)
+		delete	m_pViewScanImage;
+	m_pViewScanImage = NULL;
+
+	if(NULL != m_pViewRecipeSetting)
+		delete	m_pViewRecipeSetting;
+	m_pViewRecipeSetting = NULL;
+
+	if(NULL != m_pViewLiveCam)
+		delete	m_pViewLiveCam;
+	m_pViewLiveCam = NULL;
+
+	if(NULL != m_pViewHWSetting)
+		delete	m_pViewHWSetting;
+	m_pViewHWSetting = NULL;
+}
+
+BOOL CENRITView::PreCreateWindow(CREATESTRUCT& cs)
+{
+	// TODO: CREATESTRUCT cs甫 荐沥窍咯 咯扁俊辑
+	//  Window 努贰胶 肚绰 胶鸥老阑 荐沥钦聪促.
+
+	return CFormView::PreCreateWindow(cs);
+}
+
+// CENRITView 弊府扁
+
+void CENRITView::OnDraw(CDC* /*pDC*/)
+{
+	
+}
+
+
+// CENRITView 柳窜
+
+void CENRITView::DoDataExchange(CDataExchange* pDX)
+{
+	CFormView::DoDataExchange(pDX);
+
+	int i;
+
+	UINT nViewID[] = {IDC_BTN_MAIN_INSINFOR, IDC_BTN_MAIN_DEFECTVIEW,IDC_BTN_MAIN_IMAGE_VIEW, IDC_BTN_MAIN_RECIPE_VIEW, IDC_BTN_MAIN_LIVE_CAM_VIEW, IDC_BTN_MAIN_HW_VIEW,IDC_BTN_MAIN_EXIT};
+	for(i=0; i<eView_End; i++){
+		DDX_Control(pDX, nViewID[i], m_ctrlBtn[i]);
+	}	
+}
+
+BEGIN_MESSAGE_MAP(CENRITView, CFormView)		
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CENRITView, CFormView)
+	ON_EVENT(CENRITView, IDC_BTN_MAIN_INSINFOR, DISPID_CLICK, CENRITView::ClickMenuButton, VTS_NONE)
+	ON_EVENT(CENRITView, IDC_BTN_MAIN_DEFECTVIEW, DISPID_CLICK, CENRITView::ClickMenuButton, VTS_NONE)
+	ON_EVENT(CENRITView, IDC_BTN_MAIN_IMAGE_VIEW, DISPID_CLICK, CENRITView::ClickMenuButton, VTS_NONE)
+	ON_EVENT(CENRITView, IDC_BTN_MAIN_RECIPE_VIEW, DISPID_CLICK, CENRITView::ClickMenuButton, VTS_NONE)
+	ON_EVENT(CENRITView, IDC_BTN_MAIN_LIVE_CAM_VIEW, DISPID_CLICK, CENRITView::ClickMenuButton, VTS_NONE)
+	ON_EVENT(CENRITView, IDC_BTN_MAIN_HW_VIEW, DISPID_CLICK, CENRITView::ClickMenuButton, VTS_NONE)
+	ON_EVENT(CENRITView, IDC_BTN_MAIN_EXIT, DISPID_CLICK, CENRITView::ClickMenuButton, VTS_NONE)
+END_EVENTSINK_MAP()
+
+// CENRITView 皋矫瘤 贸府扁
+
+void CENRITView::CreateChildView()
+{
+	CRect			rcBut,rcMain,rcWindow;
+
+	m_ctrlBtn[eView_InsInfo].GetWindowRect(&rcBut);
+	this->ScreenToClient(&rcBut);
+	this->GetWindowRect(&rcMain);	
+
+	rcWindow = CRect(rcMain.left+5,rcMain.top+5,rcMain.right-5,rcBut.top-5);
+
+	m_pViewInspectInfo = new CViewInsInformation();
+	m_pViewInspectInfo->Create(CViewInsInformation::IDD,this);
+	m_pViewInspectInfo->MoveWindow(rcWindow);
+	m_pViewInspectInfo->ShowWindow(SW_HIDE);
+
+	m_pViewDefect = new CViewDefect();
+	m_pViewDefect->Create(CViewDefect::IDD,this);
+	m_pViewDefect->MoveWindow(rcWindow);
+	m_pViewDefect->ShowWindow(SW_HIDE);
+
+	m_pViewScanImage = new CViewScanImage();
+	m_pViewScanImage->Create(CViewScanImage::IDD,this);
+	m_pViewScanImage->MoveWindow(rcWindow);
+	m_pViewScanImage->ShowWindow(SW_HIDE);
+
+	m_pViewRecipeSetting = new CViewRecipeSetting();
+	m_pViewRecipeSetting->Create(CViewRecipeSetting::IDD,this);
+	m_pViewRecipeSetting->MoveWindow(rcWindow);
+	m_pViewRecipeSetting->ShowWindow(SW_HIDE);
+
+	m_pViewLiveCam = new CViewLiveCam();
+	m_pViewLiveCam->Create(CViewLiveCam::IDD,this);
+	m_pViewLiveCam->MoveWindow(rcWindow);
+	m_pViewLiveCam->ShowWindow(SW_HIDE);
+
+	m_pViewHWSetting = new CViewHWSetting();
+	m_pViewHWSetting->Create(CViewHWSetting::IDD,this);
+	m_pViewHWSetting->MoveWindow(rcWindow);
+	m_pViewHWSetting->ShowWindow(SW_HIDE);
+
+	SwitchView(GLOBAL_DEFINE::EV_VIEW_INFO);
+}
+
+void CENRITView::ClickMenuButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+
+	GLOBAL_DEFINE::ENTRY_VIEW eEntry = GLOBAL_DEFINE::EV_VIEW_End;
+
+	switch(nID){
+	case IDC_BTN_MAIN_INSINFOR:			
+		eEntry = GLOBAL_DEFINE::EV_VIEW_INFO;
+		break;
+
+	case IDC_BTN_MAIN_DEFECTVIEW:
+		eEntry = GLOBAL_DEFINE::EV_VIEW_DEFECT;
+		break;
+
+	case IDC_BTN_MAIN_IMAGE_VIEW:
+		eEntry = GLOBAL_DEFINE::EV_VIEW_IMAGE;
+		break;
+
+	case IDC_BTN_MAIN_RECIPE_VIEW:		
+		eEntry = GLOBAL_DEFINE::EV_VIEW_RECIPE;
+		break;
+
+	case IDC_BTN_MAIN_LIVE_CAM_VIEW:	
+		eEntry = GLOBAL_DEFINE::EV_VIEW_LIVE;
+		break;
+
+	case IDC_BTN_MAIN_HW_VIEW:		
+		eEntry = GLOBAL_DEFINE::EV_VIEW_HW;
+		break;
+
+	case IDC_BTN_MAIN_EXIT:		
+		eEntry = GLOBAL_DEFINE::EV_EXIT; 
+		break;
+	}
+
+	SwitchView(eEntry);
+}
+
+void CENRITView::SwitchView(GLOBAL_DEFINE::ENTRY_VIEW eEntry)
+{
+	if(GetCurEntry() == eEntry){
+		return;
+	}
+
+	if(GLOBAL_DEFINE::EV_EXIT != eEntry)
+		SetButtonEnableAll(TRUE);
+
+	UINT nViewID = -1;
+
+	switch(eEntry){
+	case GLOBAL_DEFINE::EV_VIEW_INFO:			
+		nViewID = CViewInsInformation::IDD;
+		SetButtonEnable(eView_InsInfo, FALSE);
+		break;
+	case GLOBAL_DEFINE::EV_VIEW_DEFECT:
+		nViewID = CViewDefect::IDD;
+		SetButtonEnable(eView_DefectView, FALSE);
+		break;
+	case GLOBAL_DEFINE::EV_VIEW_IMAGE:
+		nViewID = CViewScanImage::IDD;
+		SetButtonEnable(eView_ImageView, FALSE);
+		break;
+	case GLOBAL_DEFINE::EV_VIEW_RECIPE:
+		nViewID = CViewRecipeSetting::IDD;
+		SetButtonEnable(eView_Recipe, FALSE);
+		break;
+	case GLOBAL_DEFINE::EV_VIEW_LIVE:
+		nViewID = CViewLiveCam::IDD;
+		SetButtonEnable(eView_LiveCam, FALSE);
+		break;
+	case GLOBAL_DEFINE::EV_VIEW_HW:
+		nViewID = CViewHWSetting::IDD;
+		SetButtonEnable(eView_HWSetting, FALSE);
+		break;
+	case GLOBAL_DEFINE::EV_EXIT:	
+		if(IDNO == AfxMessageBox(_T("Exit RCutInspection Program?"), MB_YESNO | MB_ICONQUESTION))
+		{
+			return;
+		}
+		if(m_IV2M != NULL)
+			m_IV2M->CommandExitButtonClick();
+		GetParent()->PostMessageW(WM_USER_SYSTEM_CLOSE);
+		return;
+	default:
+		return;
+	}
+
+	if(nViewID>=0)
+	{
+		ChangeView(nViewID);
+		SetCurEntry(eEntry);		
+	}
+}
+
+void CENRITView::ChangeView(UINT nViewID)
+{
+	UINT		nShow;		
+
+	UINT		eFrameView[] = {CViewInsInformation::IDD,CViewDefect::IDD,CViewScanImage::IDD,CViewRecipeSetting::IDD,CViewLiveCam::IDD,CViewHWSetting::IDD};
+
+	for(int i=0; i<eView_End; i++)
+	{
+		if(eFrameView[i] == nViewID)
+			nShow = SW_SHOW;
+		else
+			nShow = SW_HIDE;
+
+		switch(i)
+		{
+		case EV_VIEW_INFO: m_pViewInspectInfo->ShowWindow(nShow); break;
+		case EV_VIEW_DEFECT: m_pViewDefect->ShowWindow(nShow); break;
+		case EV_VIEW_IMAGE: m_pViewScanImage->ShowWindow(nShow); break;
+		case EV_VIEW_RECIPE: m_pViewRecipeSetting->ShowWindow(nShow); break;
+		case EV_VIEW_LIVE: m_pViewLiveCam->ShowWindow(nShow); break;
+		case EV_VIEW_HW: m_pViewHWSetting->ShowWindow(nShow); break;
+		}
+	}
+}
+void CENRITView::SetButtonEnableAll(BOOL bEnable)
+{
+	for(int i=0; i<eView_End; i++){
+		if(m_ctrlBtn[i].GetEnabled() != bEnable){
+			m_ctrlBtn[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+GLOBAL_DEFINE::ENTRY_VIEW CENRITView::GetCurEntry()
+{
+	return m_eCurEntry;
+}
+
+void CENRITView::SetCurEntry(GLOBAL_DEFINE::ENTRY_VIEW View)
+{
+	m_eCurEntry = View;
+}
+
+void CENRITView::SetButtonEnable(eView eSelView, BOOL bEnable)
+{
+	if(eSelView >= eView_End) return;
+	if(m_ctrlBtn[eSelView].GetEnabled() != bEnable){
+		m_ctrlBtn[eSelView].SetEnabled(bEnable);
+	}
+
+	if(!bEnable){
+		m_eCurView = eSelView;
+	}
+}
+
+void CENRITView::View_LicenseInfo()
+{
+	if(m_pViewHWSetting == NULL)
+		return;
+
+	m_pViewHWSetting->View_LicenseInfo();
+}
+
+void CENRITView::SetV2M(IViewInterface2Parent* pV2M)
+{
+	m_IV2M = pV2M;
+	if(m_pViewInspectInfo != NULL)
+		m_pViewInspectInfo->SetView2Main(pV2M);
+	if(m_pViewDefect != NULL)
+		m_pViewDefect->SetV2M(pV2M);
+	if(m_pViewLiveCam != NULL)
+		m_pViewLiveCam->SetV2M(pV2M);
+	if(m_pViewRecipeSetting != NULL)
+		m_pViewRecipeSetting->SetV2M(pV2M);
+	if(m_pViewScanImage != NULL)
+		m_pViewScanImage->SetV2M(pV2M);
+}
+
+void CENRITView::SetGlassData(CGlass_Data *pGlass)
+{
+	m_pGlassData = pGlass;
+	if(m_pViewRecipeSetting != NULL)
+		m_pViewRecipeSetting->SetGlassData(pGlass);
+	if(m_pViewDefect != NULL)
+		m_pViewDefect->SetGlassData(pGlass);
+	if(m_pViewLiveCam != NULL)
+		m_pViewLiveCam->SetGlassData(pGlass);
+	if(m_pViewScanImage != NULL)
+		m_pViewScanImage->SetGlassData(pGlass);
+	if(m_pViewInspectInfo != NULL)
+		m_pViewInspectInfo->SetGlassData(pGlass);
+}
+
+void CENRITView::SetTransferData(CTransfer_Data *pTrans)
+{
+	if(m_pViewInspectInfo != NULL)
+		m_pViewInspectInfo->SetTransferData(pTrans);
+}
+
+void CENRITView::SetHardwareSetting(CHardwareSettings *pHW)
+{
+	m_pHardwareSetting = pHW;
+
+	if(m_pViewHWSetting != NULL)
+	{
+		m_pViewHWSetting->SetSettingParm(pHW);
+	}
+	if(m_pViewLiveCam != NULL)
+	{
+		m_pViewLiveCam->SetRecipe(m_pHardwareSetting);
+	}
+	if(m_pViewScanImage != NULL)
+	{
+		m_pViewScanImage->SetRecipe(pHW);
+	}
+}
+
+void CENRITView::SetRecipeSettings(CGlassRecipe *pRecipe)
+{	
+	m_pGlassRecipe = pRecipe;
+	if(m_pViewInspectInfo != NULL)
+	{
+		m_pViewInspectInfo->SetRecipe(m_pHardwareSetting,pRecipe);
+	}	
+	if(m_pViewRecipeSetting != NULL)
+	{
+		m_pViewRecipeSetting->SetRecipe(m_pHardwareSetting,pRecipe);
+	}	
+	if(m_pViewDefect != NULL)
+		m_pViewDefect->SetRecipe(m_pHardwareSetting);
+}
+
+void CENRITView::ResetViewAll()
+{
+	if(m_pViewInspectInfo != NULL)
+	{
+		m_pViewInspectInfo->ResetView();
+	}	
+	if(m_pViewDefect != NULL)
+		m_pViewDefect->ResetView();
+	if(m_pViewScanImage != NULL)
+	{
+		m_pViewScanImage->ResetView();
+	}		
+	if(m_pViewRecipeSetting != NULL)
+	{
+		m_pViewRecipeSetting->SetGlassData(NULL);
+	}	
+}
+
+void CENRITView::UpdateTransferData()
+{
+	if(m_pViewInspectInfo != NULL)
+	{
+		m_pViewInspectInfo->Refresh();
+	}
+}
+
+void CENRITView::AddHistory(HISTORY_RESULT Data)
+{
+	if(m_pViewInspectInfo != NULL)
+	{
+		m_pViewInspectInfo->AddHistoryData(Data);
+	}
+}
+
+void CENRITView::ViewRefresh(PROG_MSG ProcMsg)
+{
+	int			iCam;
+
+	switch(ProcMsg.nState)
+	{
+	case 1:
+		if(m_pViewRecipeSetting != NULL)
+			m_pViewRecipeSetting->ViewRefresh(ProcMsg);
+		if(m_pViewScanImage != NULL)
+			m_pViewScanImage->ViewRefresh(ProcMsg);
+		break;
+	case VIEW_REFRESH_INIT_VIEW:
+		ResetViewAll();
+		break;
+	case VIEW_REFRESH_ONESCAN_END:
+		if(m_pHardwareSetting == NULL)
+			return;
+		if(m_pViewRecipeSetting == NULL)
+			return;
+		if(m_pViewScanImage == NULL)
+			return;
+
+		for(iCam=0;iCam<MAX_PANEL_SIDE;iCam++)
+		{
+			CCameraSettings *pCamera = m_pHardwareSetting->GetCameraSettings(iCam,0);
+			if(pCamera == NULL)
+				continue;
+
+			ProcMsg.nState = 2;
+			ProcMsg.nSide = (int)pCamera->m_eDimension;
+			m_pViewRecipeSetting->ViewRefresh(ProcMsg);		
+			m_pViewScanImage->ViewRefresh(ProcMsg);		
+		}
+		break;
+	case VIEW_REFRESH_INSPECT_END:
+		if(m_pHardwareSetting == NULL)
+			return;
+		if(m_pViewRecipeSetting == NULL)
+			return;
+		if(m_pViewScanImage == NULL)
+			return;
+
+		for(iCam=0;iCam<MAX_PANEL_SIDE;iCam++)
+		{
+			CCameraSettings *pCamera = m_pHardwareSetting->GetCameraSettings(iCam,0);
+			if(pCamera == NULL)
+				continue;
+
+			ProcMsg.nState = 2;
+			ProcMsg.nSide = (int)pCamera->m_eDimension;
+			m_pViewRecipeSetting->ViewRefresh(ProcMsg);			
+			m_pViewScanImage->ViewRefresh(ProcMsg);		
+
+			pCamera = m_pHardwareSetting->GetCameraSettings(iCam,1);
+			if(pCamera == NULL)
+				continue;
+
+			ProcMsg.nState = 2;
+			ProcMsg.nSide = (int)pCamera->m_eDimension;
+			m_pViewRecipeSetting->ViewRefresh(ProcMsg);			
+			m_pViewScanImage->ViewRefresh(ProcMsg);		
+		}
+		break;
+	}	
+}
+
+void CENRITView::RefreshDefect(CString strDefect)
+{
+	if(m_pGlassData == NULL)
+		return;
+
+	MapDefect *pMapDefect = m_pGlassData->GetMapDefect();
+
+	if(m_pViewInspectInfo != NULL)
+	{
+		m_pViewInspectInfo->SetDefect(pMapDefect);
+	}
+	if(m_pViewDefect != NULL)
+	{
+		m_pViewDefect->SetDefectList(pMapDefect);
+		m_pViewDefect->SetDefectPath(strDefect);
+	}
+}
+
+void CENRITView::InitView(Init_View_Command eVew)
+{
+	switch(eVew)
+	{
+	case VIEW_RECIPE:
+		ResetViewAll();
+		break;
+	case VIEW_SCANIMAGE:
+		if(m_pViewInspectInfo != NULL)
+		{
+			m_pViewInspectInfo->ResetView();
+		}	
+		if(m_pViewRecipeSetting != NULL)
+		{
+			m_pViewRecipeSetting->InitView();
+		}	
+		break;
+	}
+}
+
+BOOL CENRITView::SetSplineImg(LPBYTE pImg,CSize szImg,int iPosition)
+{
+	if(m_pViewInspectInfo == NULL)
+		return FALSE;
+
+	return m_pViewInspectInfo->SetSplineImg(pImg,szImg,iPosition);
+}
+
+BOOL CENRITView::SetNotchImg(LPBYTE pImg,CSize szImg,int bPosDir)
+{
+	if(m_pViewInspectInfo == NULL)
+		return FALSE;
+
+	return m_pViewInspectInfo->SetNotchImg(pImg,szImg,bPosDir);
+}
diff --git a/ENRIT/ENRITView.h b/ENRIT/ENRITView.h
new file mode 100644
index 0000000..965ca71
--- /dev/null
+++ b/ENRIT/ENRITView.h
@@ -0,0 +1,96 @@
+
+// ENRITView.h : CENRITView 努贰胶狼 牢磐其捞胶
+//
+
+#pragma once
+
+#include "btnenh.h"
+#include "ViewInsInformation.h"
+#include "ViewHWSetting.h"
+#include "ViewLiveCam.h"
+#include "ViewRecipeSetting.h"
+#include "ViewScanImage.h"
+#include "ViewDefect.h"
+#include "Global_Define.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "Glass_Data.h"
+
+using namespace	GLOBAL_DEFINE;
+
+#define	VIEW_REFRESH_INIT_VIEW		100
+#define	VIEW_REFRESH_ONESCAN_END	200
+#define	VIEW_REFRESH_INSPECT_END	300
+
+class CENRITView : public CFormView
+{
+protected: // serialization俊辑父 父甸绢笼聪促.
+	CENRITView();
+	virtual ~CENRITView();
+	DECLARE_DYNCREATE(CENRITView)
+
+public:
+	enum{ IDD = IDD_DLG_RCUT_MAIN_VIEW };
+
+// 犁沥狼涝聪促.
+public:
+	virtual void OnDraw(CDC* pDC);  // 捞 轰甫 弊府扁 困秦 犁沥狼登菌嚼聪促.
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support			
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()	
+
+	enum			eView {eView_InsInfo=0, eView_DefectView,eView_ImageView, eView_Recipe,eView_LiveCam, eView_HWSetting, eView_Exit, eView_End};		
+	CBtnEnh			m_ctrlBtn[eView_End];	
+
+public:
+	void			CreateChildView();
+	void			SetV2M(IViewInterface2Parent* pV2M);
+	GLOBAL_DEFINE::ENTRY_VIEW GetCurEntry();	
+	void			SetCurEntry(GLOBAL_DEFINE::ENTRY_VIEW View);
+	void			SetHardwareSetting(CHardwareSettings *pHW);
+	void			SetRecipeSettings(CGlassRecipe *pRecipe);
+	void			SetGlassData(CGlass_Data *pGlass);
+	void			SetTransferData(CTransfer_Data *pTrans);
+	void			ResetViewAll();
+	void			UpdateTransferData();
+	void			AddHistory(HISTORY_RESULT Data);
+	void			RefreshDefect(CString strDefect);
+	void			InitView(Init_View_Command eVew);
+
+	BOOL			SetSplineImg(LPBYTE pImg,CSize szImg,int iPosition);
+	BOOL			SetNotchImg(LPBYTE pImg,CSize szImg,int bPosDir);
+
+	void			ViewRefresh(PROG_MSG ProcMsg);
+	HWND			GetViewScanHWnd(){return m_pViewScanImage==NULL?NULL:m_pViewScanImage->GetSafeHwnd();}
+
+	CViewHWSetting*	GetHardwareSettingView()	{return m_pViewHWSetting;}
+
+protected:
+	void			ClickMenuButton();
+	void			SwitchView(GLOBAL_DEFINE::ENTRY_VIEW eEntry);
+	void			ChangeView(UINT nViewID);
+	void			SetButtonEnableAll(BOOL bEnable);
+	void			SetButtonEnable(eView eSelView, BOOL bEnable);
+
+public:
+	void			View_LicenseInfo();
+
+protected:
+	CViewInsInformation		*m_pViewInspectInfo;
+	CViewDefect				*m_pViewDefect;
+	CViewScanImage			*m_pViewScanImage;
+	CViewRecipeSetting		*m_pViewRecipeSetting;
+	CViewLiveCam			*m_pViewLiveCam;
+	CViewHWSetting			*m_pViewHWSetting;	
+
+	CGlass_Data				*m_pGlassData;
+	IViewInterface2Parent	*m_IV2M;
+
+	CHardwareSettings		*m_pHardwareSetting;
+	CGlassRecipe			*m_pGlassRecipe;
+
+	GLOBAL_DEFINE::ENTRY_VIEW m_eCurEntry;
+	eView			m_eCurView;
+};
+
diff --git a/ENRIT/Grabber/MulticamControl.cpp b/ENRIT/Grabber/MulticamControl.cpp
new file mode 100644
index 0000000..02c29de
--- /dev/null
+++ b/ENRIT/Grabber/MulticamControl.cpp
@@ -0,0 +1,656 @@
+#include "StdAfx.h"
+#include "MulticamControl.h"
+#include "Global_Define.h"
+
+#define DEFAULT_GRAB_FRAME_HEIGHT		1024
+
+//==========================================================================================================================================================================
+// Grabber Multicam
+CGrabberMulticam::CGrabberMulticam()
+{
+	m_nEndFrameIdx = m_nStartFrameIdx = 0;
+	m_nSetBufferIdx = 0;
+	m_nScanIndex = 0;
+	m_nBoardID = 0;
+
+#if OFFLINE_KEY == 0
+	m_hGrabChannel = 0;
+#endif
+
+	m_nAllocatedGrabBufSize = 0;	
+	m_isGrabbing = FALSE;
+	m_isLiveGrab = FALSE;
+	m_pFrameBuffer = NULL;	
+}
+
+CGrabberMulticam::~CGrabberMulticam()
+{
+	if(m_pFrameBuffer != NULL)
+		delete m_pFrameBuffer;
+	m_pFrameBuffer = NULL;
+}
+
+BOOL CGrabberMulticam::Initialize(void *pParam, int *pErrorCode,int iBoard)
+{
+	_GRABBER_INIT_PARAM_ *pParameter = (_GRABBER_INIT_PARAM_ *)pParam;
+
+	if(NULL != pParameter)
+	{
+		m_Param = *pParameter;
+		m_nBoardID = iBoard;
+
+		CString			strDCF;
+		strDCF = pParameter->cDCFPath;
+
+		if(OpenMulticam() != 0)
+		{
+			g_pLog->DisplayMessage(_T("Open Multicam Fail! : %d"), m_nBoardID);
+			return FALSE;
+		}
+		if(InitMulticam(strDCF,iBoard,m_Param.nConnectPort) == FALSE)
+		{
+			g_pLog->DisplayMessage(_T("Init Multicam Fail! : %d"), m_nBoardID);
+			return FALSE;
+		}
+	}
+	else
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CGrabberMulticam::InitializeBuffer(void *pParam)
+{
+	_GRABBER_INIT_PARAM_ *pParameter = (_GRABBER_INIT_PARAM_ *)pParam;
+
+	BOOL		bRet = TRUE;
+	if(NULL != pParameter)
+	{
+		m_Param = *pParameter;
+
+		bRet = CreateGrabBuffer(m_Param.nScanCount,m_Param.nGrabBufCount,m_Param.nFrameWidth,m_Param.nFrameHeight);
+	}
+
+	return bRet;
+}
+
+BOOL CGrabberMulticam::Deinitialize(void)
+{
+	DeleteMulticam();	
+
+	return TRUE;
+}
+
+BOOL CGrabberMulticam::GrabLiveStart(int nExposure)
+{
+	if (IsGrabbing())
+	{
+		g_pLog->DisplayMessage(_T("Start Live Acq : IsGrabbing -> Stop Acq %d"), m_nEndFrameIdx);
+		GrabScanStop();
+		Sleep(100);				
+	}
+
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	m_nSetBufferIdx = -1;
+	m_nScanIndex = 0;
+
+#if OFFLINE_KEY == 0
+	MCSTATUS driver_status = 0;
+
+	//driver_status |= McSetParamInt(m_hGrabChannel, MC_Expose_us	, nExposure);
+	//driver_status |= McSetParamInt(m_hGrabChannel, MC_Period_us	, nExposure/2);	
+	//driver_status |= McSetParamInt(m_hGrabChannel, MC_LineRateMode,MC_LineRateMode_PERIOD);	
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_Expose_us, nExposure);
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_Period_us, nExposure);	
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_LineRateMode, MC_LineRateMode_PERIOD);	
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_ChannelState, MC_ChannelState_ACTIVE);
+#endif
+
+	m_isGrabbing = TRUE;
+	m_isLiveGrab = TRUE;
+	g_pLog->DisplayMessage(_T("Start Live Acq"));
+
+	return TRUE;
+}
+
+BOOL CGrabberMulticam::GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure, BOOL bAuto)
+{	
+	if (IsGrabbing())
+	{
+		g_pLog->DisplayMessage(_T("Start Acq : IsGrabbing -> Stop Acq %d"), m_nEndFrameIdx);
+		GrabScanStop();
+		Sleep(100);
+	}
+
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	m_nSetBufferIdx = -1;
+	m_nScanIndex = iScan;
+
+	if(bAuto == TRUE)
+	{
+#if OFFLINE_KEY == 0
+		MCSTATUS driver_status = 0;
+
+		if(bFreeRun == FALSE)
+		{
+			/* Start the processing. The processing function is called for every frame grabbed. */
+			driver_status |= McSetParamInt(m_hGrabChannel, MC_Expose_us, nExposure);
+			driver_status |= McSetParamInt(m_hGrabChannel, MC_Period_us, nExposure+1);	
+			driver_status |= McSetParamInt(m_hGrabChannel, MC_LineRateMode, MC_LineRateMode_PULSE);	
+			driver_status |= McSetParamInt(m_hGrabChannel, MC_ChannelState, MC_ChannelState_ACTIVE);
+		}
+		else
+		{
+			driver_status |= McSetParamInt(m_hGrabChannel, MC_Expose_us, nExposure);
+			driver_status |= McSetParamInt(m_hGrabChannel, MC_Period_us, nPeriod);	
+			driver_status |= McSetParamInt(m_hGrabChannel, MC_LineRateMode, MC_LineRateMode_PERIOD);	
+			driver_status |= McSetParamInt(m_hGrabChannel, MC_ChannelState, MC_ChannelState_ACTIVE);
+		}
+#endif
+		m_isGrabbing = TRUE;
+		m_isLiveGrab = FALSE;
+	}
+	else
+	{
+		SimulationGrab(iScan);
+	}	
+
+	g_pLog->DisplayMessage(_T("Start Acq : %d"), iScan);
+
+	return TRUE;
+}
+
+void CGrabberMulticam::SimulationGrab(int iScan)
+{
+	if(m_pFrameBuffer == NULL)
+		return;
+
+	
+	int			nFrameCnt = m_pFrameBuffer->GetFrameCount();
+
+	m_nEndFrameIdx = nFrameCnt;
+	m_nSetBufferIdx = nFrameCnt -1;
+	
+	for(int i=0;i<nFrameCnt;i++)
+	{
+		SetInsertFrame(iScan,i);
+	}
+}
+
+BOOL CGrabberMulticam::GrabScanStop(void)
+{
+	g_pLog->DisplayMessage(_T("%d StopAcq : Scan %d, Grab %d, End %d"), m_nBoardID,m_nScanIndex,m_nSetBufferIdx, m_nEndFrameIdx);
+
+#if OFFLINE_KEY == 0
+	MCSTATUS driver_status = 0;
+
+	/* Stop the sequence acquisition. */
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_ChannelState, MC_ChannelState_IDLE);
+#endif
+	
+	m_isGrabbing = FALSE;
+	m_isLiveGrab = FALSE;
+
+	return TRUE;
+}
+
+BOOL CGrabberMulticam::IsGrabbing(void)
+{
+	return m_isGrabbing;
+}
+
+int CGrabberMulticam::IsAcqFrame(int nFrameNo, int nThreadIdx)
+{
+	return m_nSetBufferIdx - nFrameNo;		
+}
+
+LPBYTE	CGrabberMulticam::GetFrameHeaderLine(int iScan,int nLine, BOOL* bSuccess)
+{	
+	if(m_pFrameBuffer == NULL)
+		return NULL;
+
+	return m_pFrameBuffer->GetFrameHeaderLine(iScan,nLine);
+}
+
+LPBYTE CGrabberMulticam::GetFrameHeader(int iScan,int nFrameNo, BOOL* bRet)
+{		
+	if(m_pFrameBuffer == NULL)
+		return NULL;
+
+	return m_pFrameBuffer->GetFrameBuferHeader(iScan,nFrameNo);
+}
+
+BOOL CGrabberMulticam::GetSmallImage(int iScan,LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping) 
+{
+	int nBufSizeX = m_Param.nFrameWidth;
+	int nBufSizeY = m_Param.nFrameHeight;
+
+	if (nXStart < 0 || nYStart < 0)
+		return FALSE;
+	if (nXStart + nXSize > nBufSizeX)
+		return FALSE;
+	if (nYStart + nYSize > nBufSizeY* GetEndFrameIdx())
+		return FALSE;
+	
+	// 矫累 橇饭烙 锅龋客 场 橇饭烙 锅龋.
+	int nStartFrameNo = nYStart / nBufSizeY;
+	int nEndFrameNo = (nYStart + nYSize) / nBufSizeY;
+	LPBYTE	lpHeadAddr = GetFrameHeader(iScan,nStartFrameNo);
+	if (!lpHeadAddr)
+	{
+		return FALSE;
+	}
+	LPBYTE lpStart = lpHeadAddr + (nYStart % nBufSizeY) * nBufSizeX + nXStart;
+	
+	int nLine = 0;
+	for (int i = 0; i < nYSize; i++)
+	{
+		memcpy(lpIn + i * nXSize, lpStart + nLine * nBufSizeX, nXSize);
+		if (nStartFrameNo <= nEndFrameNo && (nYStart + i + 1) % nBufSizeY  == 0)
+		{
+			// 捞固瘤甫 蝶郴具窍绰 康开捞 MemFrameNo 版拌俊 吧媚乐绰 版快 贸府.
+			lpHeadAddr = GetFrameHeader(iScan,++nStartFrameNo);
+			lpStart = lpHeadAddr + nXStart;
+			nLine = 0;
+		}
+		else
+			nLine++;
+	}
+	
+	return TRUE;
+}
+
+void CGrabberMulticam::SetSimulFrame(int nFrame)
+{
+// 	if(nFrame == 0)
+// 	{
+// 		for(int i = 0; i < g_pBase->m_nProcessMargin; i++)
+// 			SetSimulBuffer(i, m_nScanIndex % 2 == 1);
+// 	}
+// 
+// 	m_nEndFrameIdx = CHKMIN(GetGrabFrameNo(m_nScanIndex), nFrame + g_pBase->m_nProcessMargin + 1);
+// 	SetSimulBuffer(m_nEndFrameIdx - 1, m_nScanIndex % 2 == 1);
+// 
+// 	if(GetParents() != NULL)
+// 		GetParents()->PostMessage(UM_IMAGE_GRAB, m_nEndFrameIdx - 1,NULL);
+}
+
+#if OFFLINE_KEY == 0
+void MCAPI CGrabberMulticam::ProcessCallbackFunc(PMCSIGNALINFO signal_info)
+{
+	if(GetThreadPriority(GetCurrentThread()) != THREAD_PRIORITY_HIGHEST)
+		SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
+
+	if (signal_info && signal_info->Context)
+	{
+		CGrabberMulticam* pThis = (CGrabberMulticam*)(signal_info->Context);
+		if (pThis==NULL) 
+			return;
+
+		pThis->Processing(signal_info);
+	}	
+}
+
+BOOL CGrabberMulticam::Processing(PMCSIGNALINFO signal_info)
+{
+	if(signal_info->Signal != MC_SIG_SURFACE_PROCESSING)
+		return TRUE;	
+	if(m_pFrameBuffer == NULL)
+		return FALSE;
+
+	PVOID pGrabBuffer = NULL;
+	int read_bytes = 0;
+	MCSTATUS driver_status = 0;
+
+	int		nImgSize =	m_Param.nFrameWidth*m_Param.nFrameHeight;
+	int			nCurFrame = -1;
+
+	driver_status |= McGetParamInt(m_hGrabChannel, MC_SurfaceIndex, &nCurFrame);
+
+	driver_status |= McGetParamPtr(signal_info->SignalInfo, MC_SurfaceAddr, &pGrabBuffer);
+	
+	driver_status |= McGetParamInt(signal_info->SignalInfo, MC_FillCount, &read_bytes);
+
+	if ((driver_status != 0) || (read_bytes < nImgSize))
+		return FALSE;	
+
+	if (pGrabBuffer==NULL) 
+		return FALSE;	
+
+	int nImageSizeX = 0;
+	int nImageSizeY = 0;	
+
+	if(McGetParamInt(signal_info->SignalInfo, MC_SurfaceSizeX, &nImageSizeX) != MC_OK)
+	{	
+		g_pLog->DisplayMessage(_T("GrabLink X Size Error : %d"),nImageSizeX);	
+		return FALSE;
+	}
+
+	if(McGetParamInt(signal_info->SignalInfo, MC_SurfaceSizeY, (PINT32) &nImageSizeY) != MC_OK)
+	{	
+		g_pLog->DisplayMessage(_T("GrabLink Y Size Error : %d"),nImageSizeY);	
+		return FALSE;
+	}
+
+	if(nImageSizeX<=0 || nImageSizeY<=0 )
+	{	
+		g_pLog->DisplayMessage(_T("GrabLink Size Error : %d,%d"),nImageSizeX,nImageSizeY);
+		return FALSE;
+	}		
+
+	if(m_pFrameBuffer->GetFrameWidth() != nImageSizeX || m_pFrameBuffer->GetFrameHeight() != nImageSizeY)
+	{
+		g_pLog->DisplayMessage(_T("GrabLink Size MissMatching Error : %d,%d"),nImageSizeX,nImageSizeY);
+		return FALSE;
+	}
+
+	if(m_isLiveGrab == TRUE)		// Live Grab 矫.
+	{
+		m_nSetBufferIdx = 0;
+
+		if(m_pFrameBuffer->SetFrameBuffer(0,m_nSetBufferIdx,(LPBYTE)pGrabBuffer) == FALSE)
+		{
+			GrabScanStop();		
+			g_pLog->DisplayMessage(_T("Set Live Frame Buffer Stop Grab[%d][%d]"), 0, m_nSetBufferIdx);
+			return TRUE;
+		}
+
+		return TRUE;
+	}
+
+	
+
+	m_nEndFrameIdx++;			//Count
+	m_nSetBufferIdx++;		//index
+	
+	if (m_nEndFrameIdx > g_pStatus->GetGrabFrameCount(m_nScanIndex))
+	{
+		GrabScanStop();		
+		g_pStatus->SetGrabEnd(m_nScanIndex);
+		g_pLog->DisplayMessage(_T("%d Over Grab Count : Stop Grab[%d][%d] - %d"), m_nBoardID, m_nScanIndex, m_nEndFrameIdx,g_pStatus->GetGrabFrameCount(m_nScanIndex));
+		return TRUE;
+	}
+
+	if (m_nSetBufferIdx > m_pFrameBuffer->GetFrameCount())
+	{
+		GrabScanStop();		
+		g_pStatus->SetGrabEnd(m_nScanIndex);
+		g_pLog->DisplayMessage(_T("%d Over Grab Buffer Stop Grab[%d][%d] - %d"), m_nBoardID, m_nScanIndex, m_nEndFrameIdx,m_pFrameBuffer->GetFrameCount());
+		return TRUE;
+	}
+
+	if(m_pFrameBuffer->SetFrameBuffer(m_nScanIndex,m_nSetBufferIdx,(LPBYTE)pGrabBuffer) == FALSE)
+	{
+		GrabScanStop();		
+		g_pLog->DisplayMessage(_T("%d Set Frame Buffer Error Stop Grab[%d][%d]"),m_nBoardID, m_nScanIndex, m_nSetBufferIdx);
+		return TRUE;
+	}	
+	
+// 	if(m_nBoardID == 0)
+// 	{
+// 		g_pLog->DisplayMessage(_T("Grab Index : %d,%d"),m_nScanIndex,m_nSetBufferIdx);
+// 	}
+	SetInsertFrame(m_nScanIndex,m_nSetBufferIdx);
+
+	return TRUE;
+}
+#endif
+
+int CGrabberMulticam::OpenMulticam(void)
+{
+#if OFFLINE_KEY == 0
+	MCSTATUS driver_status = 0;
+
+	driver_status |= McOpenDriver(NULL);
+
+	driver_status |= McSetParamInt(MC_CONFIGURATION, MC_ErrorHandling, MC_ErrorHandling_NONE);
+
+	driver_status |= McSetParamStr(MC_CONFIGURATION, MC_ErrorLog, "error.log");
+
+	return (int)driver_status;
+#else
+	return 1;
+#endif
+}
+
+void CGrabberMulticam::DeleteMulticam()
+{
+#if OFFLINE_KEY == 0
+	McSetParamInt(m_hGrabChannel, MC_ChannelState, MC_ChannelState_IDLE);
+
+	McDelete(m_hGrabChannel);
+
+	McCloseDriver ();
+#endif
+}
+
+BOOL CGrabberMulticam::InitMulticam(CString strCamfile,int nChannel, int nPort)
+{
+#if OFFLINE_KEY == 0
+	MCSTATUS driver_status = 0;
+
+	driver_status |= McCreate(MC_CHANNEL, &m_hGrabChannel);
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_DriverIndex, nChannel);
+
+	driver_status |= McSetParamStr(m_hGrabChannel, MC_Connector, "M");  //  FULL : M  , DUALBASE :   (A, B)
+
+	char port_number[10] = {0,};
+	sprintf(port_number, "COM%d", nPort);
+
+	McSetParamStr((MC_BOARD + (nPort-8)), MC_SerialControlA, port_number);
+
+	char	cCamfile[1024];
+
+	ZeroMemory(cCamfile,sizeof(char)*1024);
+
+	CString			strCam = strCamfile;
+
+#ifdef _UNICODE
+	int		nSize = WideCharToMultiByte(CP_ACP, 0, strCam.GetBuffer(), -1, NULL, 0, NULL,NULL); 				
+	WideCharToMultiByte(CP_ACP, 0, strCam.GetBuffer(), -1, cCamfile, nSize, NULL, NULL); 		
+#else				
+	sprintf_s(cCamfile,sizeof(char)*255,"%s",(LPSTR)(LPCTSTR)strCamfile);		
+#endif	
+
+	driver_status |= McSetParamStr(m_hGrabChannel, MC_CamFile, cCamfile);	// Choose the video standard strCamFile
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_ColorFormat, MC_ColorFormat_Y8);		// Choose the pixel color format
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_AcquisitionMode, MC_AcquisitionMode_WEB); // Set the acquisition mode
+
+	int			nImgHeight = m_Param.nFrameHeight;	
+
+	if(nImgHeight <= 1)
+		nImgHeight = DEFAULT_GRAB_FRAME_HEIGHT;
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_PageLength_Ln, nImgHeight);
+
+	int expose_value;
+	driver_status |= McGetParamInt(m_hGrabChannel, MC_Expose_us, &expose_value);
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_Expose_us, 1);
+
+	driver_status |= McGetParamInt(m_hGrabChannel, MC_Expose_us, &expose_value);
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_TrigMode, MC_TrigMode_IMMEDIATE);		// Choose the way the first acquisition is triggered
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_NextTrigMode, MC_NextTrigMode_REPEAT);		// Choose the triggering mode for subsequent acquisitions
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_SeqLength_Ln, MC_INDETERMINATE);			// Choose the number of images to acquire
+
+	int image_size_x_value, image_size_y_value;
+	driver_status |= McGetParamInt(m_hGrabChannel, MC_ImageSizeX, &image_size_x_value);
+
+	driver_status |= McGetParamInt(m_hGrabChannel, MC_ImageSizeY, &image_size_y_value);	
+
+	if(nImgHeight != image_size_y_value)
+	{
+		driver_status |= McSetParamInt(m_hGrabChannel, MC_ImageSizeY, nImgHeight);	
+		image_size_y_value = 0;		
+		driver_status |= McGetParamInt(m_hGrabChannel, MC_ImageSizeY, &image_size_y_value);	
+	}
+
+	int			nImgWidth = m_Param.nFrameWidth;
+	if(nImgWidth != image_size_x_value)
+	{
+		driver_status |= McSetParamInt(m_hGrabChannel, MC_ImageSizeX, nImgWidth);	
+		image_size_x_value = 0;
+		driver_status |= McGetParamInt(m_hGrabChannel, MC_ImageSizeX, &image_size_x_value);
+	}
+
+	int buffer_pitch_value;
+	driver_status |= McGetParamInt(m_hGrabChannel, MC_BufferPitch, &buffer_pitch_value);
+
+	///// Time out 5 檬....
+	driver_status |= McSetParamInt(m_hGrabChannel,  MC_AcqTimeout_ms, -1);
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_SurfaceCount, 25);
+
+	// Enable MultiCam signals
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_SignalEnable + MC_SIG_SURFACE_PROCESSING, MC_SignalEnable_ON);
+
+	driver_status |= McSetParamInt(m_hGrabChannel, MC_SignalEnable + MC_SIG_ACQUISITION_FAILURE, MC_SignalEnable_ON);
+
+	if(m_Param.nImgFlipX == 1)
+		driver_status |= McSetParamInt(m_hGrabChannel, MC_ImageFlipX, MC_ImageFlipX_ON);
+
+	driver_status |= McRegisterCallback(m_hGrabChannel, ProcessCallbackFunc, this);	
+
+	if(driver_status != 0)
+	{
+		g_pLog->DisplayMessage(_T("Create driver Fail!:Id[%d],Frame[%d,%d]"),m_nBoardID,image_size_x_value,image_size_y_value);		
+		return FALSE;
+	}
+
+	g_pLog->DisplayMessage(_T("Create driver Success!:Id[%d],Frame[%d,%d]"),m_nBoardID,image_size_x_value,image_size_y_value);		
+#endif
+
+	return TRUE;
+}
+
+BOOL CGrabberMulticam::CreateGrabBuffer(int nScanCount,int nBufSize, int nBufSizeX, int nBufSizeY)
+{
+	SIZE_T tempBufferSize= nBufSize;
+	SIZE_T tempFrmCX = nBufSizeX;
+	SIZE_T tempFrmCY = nBufSizeY;
+	SIZE_T TotalBufferSize= tempBufferSize*tempFrmCX*tempFrmCY;	
+	m_nAllocatedGrabBufSize = nBufSize;	
+
+	if(m_pFrameBuffer != NULL)
+		delete m_pFrameBuffer;
+	m_pFrameBuffer = NULL;
+
+	m_pFrameBuffer = new CFrameBufferController;
+
+	if(TRUE == m_pFrameBuffer->CreateBuffer(m_nBoardID,nBufSizeX ,nBufSizeY,nBufSize, nScanCount))
+	{		
+		g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_nBoardID,nBufSizeX,nBufSizeY,nBufSize);		
+	}
+	else
+	{
+		g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_nBoardID,nBufSizeX,nBufSizeY,nBufSize);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+void CGrabberMulticam::ClearBuffer()
+{
+	if(m_pFrameBuffer != NULL)
+		m_pFrameBuffer->ClearBuffer();
+}
+
+void CGrabberMulticam::ClearGrabIdx()
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	m_dqCallbackFrame.clear();
+	MyLock.Unlock();
+}
+
+BOOL CGrabberMulticam::SetInsertFrame(int iScan,int iFrame)
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	stFrameIndex		stFrame(iScan,iFrame);
+	m_dqCallbackFrame.push_back(stFrame);
+	MyLock.Unlock();
+
+	return TRUE;
+}
+
+BOOL CGrabberMulticam::FindGrabIdx(int iScan,int iFrame)
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+
+	BOOL				bRet = FALSE;
+	stFrameIndex		stFrame;
+	for(dqGrabIdxIt it=m_dqCallbackFrame.begin();it!=m_dqCallbackFrame.end();it++)
+	{
+		stFrame = *it;
+
+		if(stFrame.nScanIdx == iScan)
+		{
+			if(stFrame.nFrameIdx < iFrame)
+				bRet = TRUE;
+		}
+	}
+	MyLock.Unlock();
+
+	return bRet;
+}
+
+int CGrabberMulticam::GetGrabFrameCount()
+{
+	return (int)m_dqCallbackFrame.size();
+}
+
+stFrameIndex CGrabberMulticam::GetGrabFrameNoRemove()
+{
+	stFrameIndex stPop(-1, -1);	
+
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	if(IsHasGrabFrame() == FALSE)
+	{
+		MyLock.Unlock();
+		return stPop;
+	}
+
+	stPop = m_dqCallbackFrame.front();	
+
+	TRACE("Pop Frame Lock[%d]\r\n", stPop.nFrameIdx);
+	MyLock.Unlock();
+	return stPop;
+}
+
+stFrameIndex CGrabberMulticam::GetGrabFrame()
+{
+	stFrameIndex stPop(-1, -1);	
+
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	if(IsHasGrabFrame() == FALSE)
+	{
+		MyLock.Unlock();
+		return stPop;
+	}
+
+	stPop = m_dqCallbackFrame.front();
+	m_dqCallbackFrame.pop_front();
+
+	TRACE("Pop Frame Lock[%d]\r\n", stPop.nFrameIdx);
+	MyLock.Unlock();
+	return stPop;
+}
+
+BOOL CGrabberMulticam::IsHasGrabFrame()
+{
+	return !m_dqCallbackFrame.empty();
+}
\ No newline at end of file
diff --git a/ENRIT/Grabber/MulticamControl.h b/ENRIT/Grabber/MulticamControl.h
new file mode 100644
index 0000000..91aaf86
--- /dev/null
+++ b/ENRIT/Grabber/MulticamControl.h
@@ -0,0 +1,92 @@
+
+#pragma once
+
+#if OFFLINE_KEY == 0
+#include "multicam.h"
+#endif
+
+class CFrameBufferController;
+class CGrabberMulticam : public CGrabberControl
+{
+public:
+	CGrabberMulticam();
+	virtual ~CGrabberMulticam();
+
+public:
+	//////////////////////////////////////////////////////////////////////////
+	// Initialization
+	virtual BOOL	Initialize(void *pParam, int *pErrorCode,int iBoard=0);	// Grabber 檬扁拳
+	virtual BOOL	InitializeBuffer(void *pParam);
+	//////////////////////////////////////////////////////////////////////////
+	// Deinit
+	virtual BOOL	Deinitialize();
+
+	virtual BOOL	GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure=10, BOOL bAuto=TRUE);
+	virtual BOOL	GrabLiveStart(int nExposure=15);
+	virtual BOOL	GrabScanStop();
+
+	virtual BOOL	IsGrabbing();
+	virtual int		IsAcqFrame(int nFrameNo, int nThreadIdx = -1);
+
+	virtual LPBYTE	GetFrameHeader(int iScan,int nFrameNo, BOOL* bSuccess = NULL);
+	virtual LPBYTE	GetFrameHeaderLine(int iScan,int nLine, BOOL* bSuccess = NULL);
+	virtual BOOL	GetSmallImage(int iScan,LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping = TRUE);
+
+	virtual int		GetStartFrameIdx()		{ return m_nStartFrameIdx; }
+	virtual int		GetEndFrameIdx()		{ return m_nEndFrameIdx; }
+
+	virtual void	SetSimulFrame(int nFrame);	
+	virtual int		GetGrabFrameCount();
+	virtual void	ClearGrabIdx();
+	virtual stFrameIndex	GetGrabFrame();
+	virtual stFrameIndex	GetGrabFrameNoRemove();
+	virtual CFrameBufferController	*GetFrameBuffer(){return m_pFrameBuffer;}
+	virtual BOOL	SetTriggerMode( BOOL bExTrigger ){return TRUE;}
+
+public:	
+	/* User's processing function prototype. */	
+#if OFFLINE_KEY == 0
+	static  void MCAPI ProcessCallbackFunc(PMCSIGNALINFO signal_info);
+	BOOL			Processing(PMCSIGNALINFO signal_info);
+#endif
+
+	dqGrabIdx		*GetGrabIdx(){return &m_dqCallbackFrame;}	
+	BOOL			FindGrabIdx(int iScan,int iFrame);
+	
+	BOOL			SetInsertFrame(int iScan,int iFrame);
+	
+	
+	BOOL			IsHasGrabFrame();	
+
+protected:
+	int				OpenMulticam(void);
+	BOOL			InitMulticam(CString strCamfile,int nChannel, int nPort);	
+	void			DeleteMulticam();
+
+//////////////////////////////////////////////////////////////////////////
+// Buffer
+public:	
+	BOOL			CreateGrabBuffer(int nScanCount,int nBufSize, int nBufSizeX, int nBufSizeY);	
+	void			ClearBuffer();
+
+	void			SimulationGrab(int iScan);
+
+public:
+	_GRABBER_INIT_PARAM_	m_Param;	
+	int					m_nEndFrameIdx;		// 泅犁 Grab 茄 荐
+	int					m_nStartFrameIdx;	// 啊厘 坷贰傈俊 Grab茄 Frame狼 牢郸胶.
+	int					m_nSetBufferIdx;
+	int					m_nScanIndex;
+	int					m_nBoardID;
+
+#if OFFLINE_KEY == 0
+	MCHANDLE			m_hGrabChannel;
+#endif
+
+	int					m_nAllocatedGrabBufSize;	
+	BOOL				m_isGrabbing;
+	BOOL				m_isLiveGrab;	
+	CFrameBufferController	*m_pFrameBuffer;	
+	dqGrabIdx			m_dqCallbackFrame;
+	CCriticalSection	m_csIdxLock;
+};
diff --git a/ENRIT/Grabber/RadientControl.cpp b/ENRIT/Grabber/RadientControl.cpp
new file mode 100644
index 0000000..0b260e6
--- /dev/null
+++ b/ENRIT/Grabber/RadientControl.cpp
@@ -0,0 +1,634 @@
+#include "StdAfx.h"
+#include "RadientControl.h"
+#include "IncludeSDK.h"
+
+#define DEFAULT_GRAB_FRAME_HEIGHT		1024
+
+MIL_ID		g_MilApplication	= M_NULL;	/* Application identifier.  */
+int			g_nGrabberCount		= 0;		// grabber count
+
+//==========================================================================================================================================================================
+// Grabber Radient
+CGrabberRadient::CGrabberRadient()
+{
+	m_nEndFrameIdx = m_nStartFrameIdx = 0;
+	m_nSetBufferIdx = 0;
+	m_nScanIndex = 0;
+	m_nAllocatedGrabBufSize = 0;	
+	m_isGrabbing = FALSE;
+	m_isLiveGrab = FALSE;
+	m_pFrameBuffer = NULL;	
+		
+	bUART_Connect[0] = FALSE;
+	bUART_Connect[1] = FALSE;
+}
+
+CGrabberRadient::~CGrabberRadient()
+{
+	if(m_pFrameBuffer != NULL)
+		delete m_pFrameBuffer;
+	m_pFrameBuffer = NULL;
+}
+
+BOOL CGrabberRadient::Initialize(void *pParam, int *pErrorCode,int iBoard)
+{
+	_GRABBER_INIT_PARAM_ *pParameter = (_GRABBER_INIT_PARAM_ *)pParam;
+
+	if(NULL != pParameter)
+	{
+		m_Param = *pParameter;		
+		
+		CString	strDCF;
+		strDCF = m_Param.cDCFPath;
+		if(g_nGrabberCount == 0)
+		{
+			MappAlloc(M_NULL,M_DEFAULT, &g_MilApplication);	
+			CheckLastError();
+		}		
+		g_nGrabberCount++;				
+
+		g_pLog->DisplayMessage( _T("Try the distribution system - %d"), m_Param.nBoardIdx);	
+		MsysAlloc(M_SYSTEM_RADIENTEVCL, m_Param.nBoardIdx, M_DEFAULT, &m_MilSystem);
+		if(CheckLastError())
+			return FALSE;		
+		
+		MdigAlloc(m_MilSystem, m_Param.nBoardCh, strDCF, M_DEFAULT, &m_MilDigitizer);
+		if(CheckLastError())
+			return FALSE;
+
+		for(int j = 0; j < BUFFERING_SIZE_MAX ;j++)
+		{
+			MbufAlloc2d(m_MilSystem, m_Param.nFrameWidth, m_Param.nFrameHeight, 8+M_UNSIGNED, M_IMAGE+M_GRAB, &m_Milbufgrab[j]);
+		}		
+		if(CheckLastError())
+			return FALSE;
+
+		/*
+		INT nExposureTimer = m_Param.nExposure*1000;
+		INT nExposureTimerDelay = m_Param.nExposureDelay*1000;
+
+		MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE_TIME+M_TIMER1,  nExposureTimer);    
+		MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE_TIME_DELAY+M_TIMER1,  nExposureTimerDelay);                 //10us
+
+		if(m_Param.nImgFlipX == 1)
+			SetImageFlipX(TRUE);
+		else
+			SetImageFlipX(FALSE);
+		*/
+
+		//MdigControl(m_MilDigitizer,M_GRAB_MODE   , M_ASYNCHRONOUS);
+		MdigControl(m_MilDigitizer,M_GRAB_TIMEOUT, M_INFINITE);
+		if(CheckLastError())
+			return FALSE;
+		
+		m_DigitizerStatus.status = M_STOP;	
+		
+		//if (g_nGrabberCount == MAX_CAMERA_COUNT)
+		//{
+		//	CString strMsg;
+		//	MIL_INT nVersion;
+		//	MIL_INT nRevision;
+		//	MappInquire(M_VERSION, &nVersion);
+		//	MappInquire(M_REVISION, &nRevision);
+		//	strMsg.Format(_T("MIL [Version %d,Revision %d]"), nVersion, nRevision);
+		//	g_pLog->DisplayMessage(strMsg);
+
+		//	MIL_INT nNumSystems;
+		//	MIL_TEXT_CHAR SystemName[256];
+		//	MappInquire(M_SYSTEM, M_SYSTEM_NUM, &nNumSystems);
+		//	for (MIL_INT i = 0; i < nNumSystems; i++)
+		//	{
+		//		MsysInquire(i, M_NAME, SystemName);
+		//		g_pLog->DisplayMessage(_T("System Index: %d, System Name: %s\n"), i, SystemName);
+		//	}
+		//}
+	}
+	else
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CGrabberRadient::SetImageFlipX(BOOL bOn)
+{
+	if(bOn == TRUE)
+		MdigControl(m_MilDigitizer, M_GRAB_DIRECTION_X, M_REVERSE);
+	else
+		MdigControl(m_MilDigitizer, M_GRAB_DIRECTION_X, M_FORWARD);
+
+	return TRUE;
+}
+
+BOOL CGrabberRadient::CheckLastError()
+{
+	BOOL bReturn = FALSE;
+
+	MIL_INT nErrorCode; 
+	CString strMsg;
+
+	if(MappGetError(M_GLOBAL, &nErrorCode))
+	{
+		int	iCam = m_Param.nCameraIdx;	
+		int	iScan = m_Param.nCameraScan;
+		int	iBoard = m_Param.nBoardIdx;
+		int	iBoardCh = m_Param.nBoardCh;
+		
+		strMsg.Format(_T("[Board:%d,ch %d] [Camera:%d,Scan %d] MIL Error Code : %d"), iBoard,iBoardCh,iCam,iScan, nErrorCode);
+		g_pLog->DisplayMessage(strMsg);	
+		
+		bReturn = TRUE;
+	}	
+	else
+		bReturn = FALSE;
+
+	return bReturn;
+}
+
+BOOL CGrabberRadient::InitializeBuffer(void *pParam)
+{
+	_GRABBER_INIT_PARAM_ *pParameter = (_GRABBER_INIT_PARAM_ *)pParam;
+
+	BOOL		bRet = TRUE;
+	if(NULL != pParameter)
+	{
+		m_Param = *pParameter;
+
+		bRet = CreateGrabBuffer(m_Param.nScanCount,m_Param.nGrabBufCount,m_Param.nFrameWidth,m_Param.nFrameHeight);
+	}
+
+	return bRet;
+}
+
+BOOL CGrabberRadient::Deinitialize(void)
+{	
+	if (IsGrabbing())
+		GrabScanStop();
+
+	g_nGrabberCount--;
+
+	for(int i = 0; i < BUFFERING_SIZE_MAX ;i++)
+	{
+		MbufFree(m_Milbufgrab[i]);
+	}		
+
+	MdigFree(m_MilDigitizer);	
+	
+	MsysFree(m_MilSystem);
+
+	if(g_nGrabberCount == 0)
+		MappFree(g_MilApplication);
+
+	return TRUE;
+}
+
+BOOL CGrabberRadient::GrabLiveStart(int nExposure)
+{
+	if (IsGrabbing())
+	{
+		g_pLog->DisplayMessage(_T("Start Live Acq : IsGrabbing -> Stop Acq %d"), m_nEndFrameIdx);
+		GrabScanStop();
+		Sleep(100);				
+	}
+
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	m_nSetBufferIdx = -1;
+	m_nScanIndex = 0;	
+
+	if(m_DigitizerStatus.status == M_STOP)
+	{				
+		m_DigitizerStatus.status			= M_FREE_START;
+		m_DigitizerStatus.nCount			= 0;
+		m_DigitizerStatus.nIndex			= m_Param.nCameraScan;					
+
+		MdigProcess(m_MilDigitizer,&m_Milbufgrab[0],BUFFERING_SIZE_MAX, M_START, M_DEFAULT, (MIL_BUF_HOOK_FUNCTION_PTR)CallbackFreeRunFunction, this);				
+	}
+
+	m_isGrabbing = TRUE;
+	m_isLiveGrab = TRUE;
+	g_pLog->DisplayMessage(_T("Start Live Acq"));
+
+	return TRUE;
+}
+
+BOOL CGrabberRadient::GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure, BOOL bAuto)
+{	
+	if (IsGrabbing())
+	{
+		g_pLog->DisplayMessage(_T("Start Acq : IsGrabbing -> Stop Acq %d"), m_nEndFrameIdx);
+		GrabScanStop();
+		Sleep(100);
+	}
+
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	m_nSetBufferIdx = -1;
+	m_nScanIndex = iScan;
+
+	if(bAuto == TRUE)
+	{
+		int nDigitizer = 0;
+
+		if(bFreeRun == FALSE)
+		{
+			SetTriggerMode(TRUE);
+
+			/* Start the processing. The processing function is called for every frame grabbed. */
+			if(m_DigitizerStatus.status == M_STOP)
+			{				
+				m_DigitizerStatus.status			= M_START;
+				m_DigitizerStatus.nCount			= 0;
+				m_DigitizerStatus.nIndex			= iScan;				
+				
+				MdigProcess(m_MilDigitizer,&m_Milbufgrab[0],BUFFERING_SIZE_MAX, M_START, M_DEFAULT, (MIL_BUF_HOOK_FUNCTION_PTR)CallbackHookFunction, this);				
+			}
+		}
+		else
+		{
+			if(m_DigitizerStatus.status == M_STOP)
+			{				
+				m_DigitizerStatus.status			= M_FREE_START;
+				m_DigitizerStatus.nCount			= 0;
+				m_DigitizerStatus.nIndex			= iScan;				
+
+				MdigProcess(m_MilDigitizer,&m_Milbufgrab[0],BUFFERING_SIZE_MAX, M_START, M_DEFAULT, (MIL_BUF_HOOK_FUNCTION_PTR)CallbackFreeRunFunction, this);				
+			}
+		}
+
+		m_isGrabbing = TRUE;
+		m_isLiveGrab = FALSE;
+	}
+	else
+	{
+		SimulationGrab(iScan);
+	}	
+
+	g_pLog->DisplayMessage(_T("Start Acq : %d"), iScan);
+
+	return TRUE;
+}
+
+void CGrabberRadient::SimulationGrab(int iScan)
+{
+	if(m_pFrameBuffer == NULL)
+		return;
+		
+	int			nFrameCnt = m_pFrameBuffer->GetFrameCount();
+
+	m_nEndFrameIdx = nFrameCnt;
+	m_nSetBufferIdx = nFrameCnt -1;
+	
+	for(int i=0;i<nFrameCnt;i++)
+	{
+		SetInsertFrame(iScan,i);
+	}
+}
+
+BOOL CGrabberRadient::GrabScanStop(void)
+{
+	g_pLog->DisplayMessage(_T("%d StopAcq : Scan %d, Grab %d, End %d"), m_Param.nBoardIdx,m_nScanIndex,m_nSetBufferIdx, m_nEndFrameIdx);
+	
+	CString strMsg;
+	
+	if( m_DigitizerStatus.status == M_START)
+	{
+		MdigProcess(m_MilDigitizer,&m_Milbufgrab[0],BUFFERING_SIZE_MAX, M_STOP, M_DEFAULT, (MIL_BUF_HOOK_FUNCTION_PTR)CallbackHookFunction, this);
+		m_DigitizerStatus.nIndex	= m_nScanIndex;
+		m_DigitizerStatus.status	= M_STOP;				
+	}	
+	else if(m_DigitizerStatus.status == M_FREE_START)
+	{
+		MdigProcess(m_MilDigitizer,&m_Milbufgrab[0],BUFFERING_SIZE_MAX, M_STOP, M_DEFAULT, (MIL_BUF_HOOK_FUNCTION_PTR)CallbackFreeRunFunction, this);
+		m_DigitizerStatus.nIndex	= m_nScanIndex;
+		m_DigitizerStatus.status	= M_STOP;		
+	}
+	
+	m_isGrabbing = FALSE;
+	m_isLiveGrab = FALSE;
+
+	return TRUE;
+}
+
+BOOL CGrabberRadient::IsGrabbing(void)
+{
+	return m_isGrabbing;
+}
+
+int CGrabberRadient::IsAcqFrame(int nFrameNo, int nThreadIdx)
+{
+	return m_nSetBufferIdx - nFrameNo;		
+}
+
+LPBYTE	CGrabberRadient::GetFrameHeaderLine(int iScan,int nLine, BOOL* bSuccess)
+{	
+	if(m_pFrameBuffer == NULL)
+		return NULL;
+
+	return m_pFrameBuffer->GetFrameHeaderLine(iScan,nLine);
+}
+
+LPBYTE CGrabberRadient::GetFrameHeader(int iScan,int nFrameNo, BOOL* bRet)
+{		
+	if(m_pFrameBuffer == NULL)
+		return NULL;
+
+	return m_pFrameBuffer->GetFrameBuferHeader(iScan,nFrameNo);
+}
+
+BOOL CGrabberRadient::GetSmallImage(int iScan,LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping) 
+{
+	int nBufSizeX = m_Param.nFrameWidth;
+	int nBufSizeY = m_Param.nFrameHeight;
+
+	if (nXStart < 0 || nYStart < 0)
+		return FALSE;
+	if (nXStart + nXSize > nBufSizeX)
+		return FALSE;
+	if (nYStart + nYSize > nBufSizeY* GetEndFrameIdx())
+		return FALSE;
+	
+	// 矫累 橇饭烙 锅龋客 场 橇饭烙 锅龋.
+	int nStartFrameNo = nYStart / nBufSizeY;
+	int nEndFrameNo = (nYStart + nYSize) / nBufSizeY;
+	LPBYTE	lpHeadAddr = GetFrameHeader(iScan,nStartFrameNo);
+	if (!lpHeadAddr)
+	{
+		return FALSE;
+	}
+	LPBYTE lpStart = lpHeadAddr + (nYStart % nBufSizeY) * nBufSizeX + nXStart;
+	
+	int nLine = 0;
+	for (int i = 0; i < nYSize; i++)
+	{
+		memcpy(lpIn + i * nXSize, lpStart + nLine * nBufSizeX, nXSize);
+		if (nStartFrameNo <= nEndFrameNo && (nYStart + i + 1) % nBufSizeY  == 0)
+		{
+			// 捞固瘤甫 蝶郴具窍绰 康开捞 MemFrameNo 版拌俊 吧媚乐绰 版快 贸府.
+			lpHeadAddr = GetFrameHeader(iScan,++nStartFrameNo);
+			lpStart = lpHeadAddr + nXStart;
+			nLine = 0;
+		}
+		else
+			nLine++;
+	}
+	
+	return TRUE;
+}
+
+void CGrabberRadient::SetSimulFrame(int nFrame)
+{
+// 	if(nFrame == 0)
+// 	{
+// 		for(int i = 0; i < g_pBase->m_nProcessMargin; i++)
+// 			SetSimulBuffer(i, m_nScanIndex % 2 == 1);
+// 	}
+// 
+// 	m_nEndFrameIdx = CHKMIN(GetGrabFrameNo(m_nScanIndex), nFrame + g_pBase->m_nProcessMargin + 1);
+// 	SetSimulBuffer(m_nEndFrameIdx - 1, m_nScanIndex % 2 == 1);
+// 
+// 	if(GetParents() != NULL)
+// 		GetParents()->PostMessage(UM_IMAGE_GRAB, m_nEndFrameIdx - 1,NULL);
+}
+
+BOOL CGrabberRadient::Processing(long HookType, MIL_ID HookId)
+{
+	if(m_pFrameBuffer == NULL)
+		return FALSE;
+	
+	MIL_ID ModifiedImage = 0;
+
+	m_nEndFrameIdx++;			//Count
+	m_nSetBufferIdx++;		//index
+
+	if (m_nEndFrameIdx > g_pStatus->GetGrabFrameCount(m_nScanIndex))
+	{
+		GrabScanStop();		
+		g_pStatus->SetGrabEnd(m_nScanIndex);
+		g_pLog->DisplayMessage(_T("%d Over Grab Count : Stop Grab[%d][%d] - %d"), m_Param.nBoardIdx, m_nScanIndex, m_nEndFrameIdx,g_pStatus->GetGrabFrameCount(m_nScanIndex));
+		return TRUE;
+	}
+
+	if (m_nSetBufferIdx > m_pFrameBuffer->GetFrameCount())
+	{
+		GrabScanStop();		
+		g_pStatus->SetGrabEnd(m_nScanIndex);
+		g_pLog->DisplayMessage(_T("%d Over Grab Buffer Stop Grab[%d][%d] - %d"), m_Param.nBoardIdx, m_nScanIndex, m_nEndFrameIdx,m_pFrameBuffer->GetFrameCount());
+		return TRUE;
+	}
+
+	LPBYTE		pBuffer = m_pFrameBuffer->GetFrameBuferHeader(m_nScanIndex,m_nSetBufferIdx);
+	if(pBuffer == NULL)
+	{
+		GrabScanStop();		
+		g_pStatus->SetGrabEnd(m_nScanIndex);
+		g_pLog->DisplayMessage(_T("%d Over Grab Buffer Stop Grab[%d][%d] - %d"), m_Param.nBoardIdx, m_nScanIndex, m_nEndFrameIdx,m_pFrameBuffer->GetFrameCount());
+		return TRUE;
+	}
+
+	MdigGetHookInfo(HookId, M_MODIFIED_BUFFER+M_BUFFER_ID, &ModifiedImage);
+	MbufControl(ModifiedImage, M_LOCK, M_DEFAULT);	
+	MbufGet2d(ModifiedImage,0,0,m_Param.nFrameWidth,m_Param.nFrameHeight,pBuffer);
+	MbufControl(ModifiedImage, M_UNLOCK, M_DEFAULT);	
+			
+
+	SetInsertFrame(m_nScanIndex,m_nSetBufferIdx);
+
+	return TRUE;
+}
+
+long MFTYPE CGrabberRadient::CallbackHookFunction(long HookType, MIL_ID HookId, void MPTYPE *HookDataPtr)
+{
+	if(GetThreadPriority(GetCurrentThread()) != THREAD_PRIORITY_HIGHEST)
+		SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
+
+	CGrabberRadient	*pRadient = (CGrabberRadient*)HookDataPtr;
+
+	pRadient->Processing(HookType,HookId);	
+
+	return 0;
+}
+
+long MFTYPE CGrabberRadient::CallbackFreeRunFunction(long HookType, MIL_ID HookId, void MPTYPE *HookDataPtr)
+{
+	if(GetThreadPriority(GetCurrentThread()) != THREAD_PRIORITY_HIGHEST)
+		SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
+
+	CGrabberRadient	*pRadient = (CGrabberRadient*)HookDataPtr;
+
+	if(pRadient->m_isLiveGrab == TRUE)		// Live Grab 矫.
+	{
+		pRadient->m_nSetBufferIdx = 0;
+
+		LPBYTE		pBuffer = pRadient->m_pFrameBuffer->GetFrameBuferHeader(pRadient->m_nScanIndex,pRadient->m_nSetBufferIdx);
+		if(pBuffer == NULL)
+		{
+			pRadient->GrabScanStop();		
+			g_pStatus->SetGrabEnd(pRadient->m_nScanIndex);
+			g_pLog->DisplayMessage(_T("%d Over Grab Buffer Stop Grab[%d][%d] - %d"), pRadient->m_Param.nBoardIdx, pRadient->m_nScanIndex, pRadient->m_nEndFrameIdx,pRadient->m_pFrameBuffer->GetFrameCount());
+			return TRUE;
+		}
+
+		MIL_ID ModifiedImage = 0;
+		MdigGetHookInfo(HookId, M_MODIFIED_BUFFER+M_BUFFER_ID, &ModifiedImage);
+		MbufControl(ModifiedImage, M_LOCK, M_DEFAULT);	
+		MbufGet2d(ModifiedImage,0,0,pRadient->m_Param.nFrameWidth,pRadient->m_Param.nFrameHeight,pBuffer);
+		MbufControl(ModifiedImage, M_UNLOCK, M_DEFAULT);	
+		
+		/*
+		int			iGrab = pRadient->m_nSetBufferIdx%pRadient->m_Param.nGrabBufCount;
+		MbufGet(pRadient->m_MilImageChild[iGrab],pBuffer);
+		*/
+
+		return TRUE;
+	}	
+
+	return 0;
+}
+
+BOOL CGrabberRadient::CreateGrabBuffer(int nScanCount,int nBufSize, int nBufSizeX, int nBufSizeY)
+{
+	SIZE_T tempBufferSize= nBufSize;
+	SIZE_T tempFrmCX = nBufSizeX;
+	SIZE_T tempFrmCY = nBufSizeY;
+	SIZE_T TotalBufferSize= tempBufferSize*tempFrmCX*tempFrmCY;	
+	m_nAllocatedGrabBufSize = nBufSize;	
+
+	if(m_pFrameBuffer != NULL)
+		delete m_pFrameBuffer;
+	m_pFrameBuffer = NULL;
+
+	m_pFrameBuffer = new CFrameBufferController;
+
+	if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount))
+	{		
+		g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);		
+	}
+	else
+	{
+		g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+void CGrabberRadient::ClearBuffer()
+{
+	if(m_pFrameBuffer != NULL)
+		m_pFrameBuffer->ClearBuffer();
+}
+
+void CGrabberRadient::ClearGrabIdx()
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	m_dqCallbackFrame.clear();
+	MyLock.Unlock();
+}
+
+BOOL CGrabberRadient::SetInsertFrame(int iScan,int iFrame)
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	stFrameIndex		stFrame(iScan,iFrame);
+	m_dqCallbackFrame.push_back(stFrame);
+	MyLock.Unlock();
+
+	return TRUE;
+}
+
+BOOL CGrabberRadient::FindGrabIdx(int iScan,int iFrame)
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+
+	BOOL				bRet = FALSE;
+	stFrameIndex		stFrame;
+	for(dqGrabIdxIt it=m_dqCallbackFrame.begin();it!=m_dqCallbackFrame.end();it++)
+	{
+		stFrame = *it;
+
+		if(stFrame.nScanIdx == iScan)
+		{
+			if(stFrame.nFrameIdx < iFrame)
+				bRet = TRUE;
+		}
+	}
+	MyLock.Unlock();
+
+	return bRet;
+}
+
+int CGrabberRadient::GetGrabFrameCount()
+{
+	return (int)m_dqCallbackFrame.size();
+}
+
+stFrameIndex CGrabberRadient::GetGrabFrameNoRemove()
+{
+	stFrameIndex stPop(-1, -1);	
+
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	if(IsHasGrabFrame() == FALSE)
+	{
+		MyLock.Unlock();
+		return stPop;
+	}
+
+	stPop = m_dqCallbackFrame.front();	
+
+	TRACE("Pop Frame Lock[%d]\r\n", stPop.nFrameIdx);
+	MyLock.Unlock();
+	return stPop;
+}
+
+stFrameIndex CGrabberRadient::GetGrabFrame()
+{
+	stFrameIndex stPop(-1, -1);	
+
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	if(IsHasGrabFrame() == FALSE)
+	{
+		MyLock.Unlock();
+		return stPop;
+	}
+
+	stPop = m_dqCallbackFrame.front();
+	m_dqCallbackFrame.pop_front();
+
+	TRACE("Pop Frame Lock[%d]\r\n", stPop.nFrameIdx);
+	MyLock.Unlock();
+	return stPop;
+}
+
+BOOL CGrabberRadient::IsHasGrabFrame()
+{
+	return !m_dqCallbackFrame.empty();
+}
+
+BOOL CGrabberRadient::SetTriggerMode( BOOL bExTrigger )
+{	
+	//INT nExposureTimer = m_Param.nExposure*1000;
+	//INT nExposureTimerDelay = m_Param.nExposureDelay*1000;
+
+	if(bExTrigger == TRUE)	// Trigger
+	{
+		MdigControl(m_MilDigitizer, M_CAMERALINK_CC1_SOURCE, M_GRAB_EXPOSURE+M_TIMER1);
+		//MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE+M_TIMER1, M_ENABLE);
+		//MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE_SOURCE+M_TIMER1, nHWPort);
+		//MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE_TIME+M_TIMER1,  nExposureTimer);                        //10us
+		//MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE_TIME_DELAY+M_TIMER1,  nExposureTimerDelay);                 //10us
+	}
+	else		// Live
+	{
+		MdigControl(m_MilDigitizer, M_CAMERALINK_CC1_SOURCE, M_GRAB_EXPOSURE+M_TIMER1);
+		//MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE+M_TIMER1, M_ENABLE);
+		//MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE_SOURCE+M_TIMER1, M_CONTINUOUS);                      // Periodic 脚龋 牢啊
+		//MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE_TIME+M_TIMER1, nExposureTimer);                        //10000ns
+		//MdigControl(m_MilDigitizer, M_GRAB_EXPOSURE_TIME_DELAY+M_TIMER1,  nExposureTimerDelay);                 //10000ns	
+	}
+
+	return TRUE;
+}
\ No newline at end of file
diff --git a/ENRIT/Grabber/RadientControl.h b/ENRIT/Grabber/RadientControl.h
new file mode 100644
index 0000000..a1eaf06
--- /dev/null
+++ b/ENRIT/Grabber/RadientControl.h
@@ -0,0 +1,107 @@
+
+#pragma once
+
+#include "Global_Define.h"
+#include "mil.h"
+
+#pragma comment(lib, "mil.lib")
+
+#define MAX_BOARD_COUNT				4
+#define BUFFERING_SIZE_MAX			200
+#define M_FREE_START				100	
+#define MAX_DIGITIZE_COUNT			2
+
+typedef struct tagDigStatus
+{
+	int nJobIndex;
+	int nSKipFrame;
+	int status;			// 泅犁 惑怕... // M_STOP , M_START , M_FREE_START
+	int nCount;			// 佬篮 扼牢荐...
+	int nIndex;			// 捞固瘤 滚欺 牢郸胶	
+	int nDisplayFrame;
+	int nResetFrame;
+}DIGSTATUS, *PDIGSTATUS;
+
+class CFrameBufferController;
+class CGrabberRadient : public CGrabberControl
+{
+public:
+	CGrabberRadient();
+	virtual ~CGrabberRadient();
+
+public:
+	//////////////////////////////////////////////////////////////////////////
+	// Initialization
+	virtual BOOL	Initialize(void *pParam, int *pErrorCode,int iBoard=0);	// Grabber 檬扁拳
+	virtual BOOL	InitializeBuffer(void *pParam);
+	//////////////////////////////////////////////////////////////////////////
+	// Deinit
+	virtual BOOL	Deinitialize();
+
+	virtual BOOL	GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure=10, BOOL bAuto=TRUE);
+	virtual BOOL	GrabLiveStart(int nExposure=15);
+	virtual BOOL	GrabScanStop();
+
+	virtual BOOL	IsGrabbing();
+	virtual int		IsAcqFrame(int nFrameNo, int nThreadIdx = -1);
+
+	virtual LPBYTE	GetFrameHeader(int iScan,int nFrameNo, BOOL* bSuccess = NULL);
+	virtual LPBYTE	GetFrameHeaderLine(int iScan,int nLine, BOOL* bSuccess = NULL);
+	virtual BOOL	GetSmallImage(int iScan,LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping = TRUE);
+	
+	/* User's processing function prototype. */	
+	static long MFTYPE CallbackHookFunction(long HookType	, MIL_ID HookId, void MPTYPE *HookDataPtr);
+	static long MFTYPE CallbackFreeRunFunction(long HookType	, MIL_ID HookId, void MPTYPE *HookDataPtr);
+
+	virtual int		GetStartFrameIdx()		{ return m_nStartFrameIdx; }
+	virtual int		GetEndFrameIdx()		{ return m_nEndFrameIdx; }
+
+	virtual void	SetSimulFrame(int nFrame);	
+	virtual int		GetGrabFrameCount();
+	virtual void	ClearGrabIdx();
+	virtual stFrameIndex	GetGrabFrame();
+	virtual stFrameIndex	GetGrabFrameNoRemove();
+	virtual CFrameBufferController	*GetFrameBuffer(){return m_pFrameBuffer;}
+	virtual BOOL	SetTriggerMode( BOOL bExTrigger );
+
+	dqGrabIdx		*GetGrabIdx(){return &m_dqCallbackFrame;}	
+	BOOL			FindGrabIdx(int iScan,int iFrame);	
+	BOOL			SetInsertFrame(int iScan,int iFrame);
+		
+	BOOL			IsHasGrabFrame();	
+
+protected:	
+	BOOL			Processing(long HookType, MIL_ID HookId);
+//////////////////////////////////////////////////////////////////////////
+// Buffer
+public:	
+	BOOL			CreateGrabBuffer(int nScanCount,int nBufSize, int nBufSizeX, int nBufSizeY);	
+	void			ClearBuffer();
+	BOOL			CheckLastError();
+
+	void			SimulationGrab(int iScan);
+	BOOL			SetImageFlipX(BOOL bOn);
+
+public:
+	_GRABBER_INIT_PARAM_	m_Param;		
+	
+	MIL_ID			m_MilSystem;					// 焊靛寸 1函荐 
+	MIL_ID			m_MilDigitizer;		// 墨皋扼 函荐
+	MIL_ID			m_Milbufgrab[BUFFERING_SIZE_MAX];	
+	DIGSTATUS		m_DigitizerStatus;		
+	long			m_lBord;
+	BOOL			bUART_Connect[2];
+
+	CCriticalSection	m_critical;
+
+	int					m_nEndFrameIdx;		// 泅犁 Grab 茄 荐
+	int					m_nStartFrameIdx;	// 啊厘 坷贰傈俊 Grab茄 Frame狼 牢郸胶.
+	int					m_nSetBufferIdx;
+	int					m_nScanIndex;	
+	int					m_nAllocatedGrabBufSize;	
+	BOOL				m_isGrabbing;
+	BOOL				m_isLiveGrab;	
+	CFrameBufferController	*m_pFrameBuffer;	
+	dqGrabIdx			m_dqCallbackFrame;
+	CCriticalSection	m_csIdxLock;
+};
diff --git a/ENRIT/Grabber/SapControl.cpp b/ENRIT/Grabber/SapControl.cpp
new file mode 100644
index 0000000..67454b6
--- /dev/null
+++ b/ENRIT/Grabber/SapControl.cpp
@@ -0,0 +1,798 @@
+#include "StdAfx.h"
+#include "SapControl.h"
+
+#define	FRAME_HEAD_MARKER	0x55AAFF00
+#define	FRAME_TAIL_MARKER	0x00FFAA55
+
+CSapControl::CSapControl(void)
+{
+	m_nEndFrameIdx = m_nStartFrameIdx = 0;
+	m_nSetBufferIdx = 0;
+	m_nScanIndex = 0;
+	m_nAllocatedGrabBufSize = 0;	
+	m_nBoardID = 0;
+	m_isGrabbing = FALSE;
+	m_isLiveGrab = FALSE;
+	m_pFrameBuffer = NULL;	
+
+	int i;
+	for (i = 0; i < MAX_BUFFER_COUNT; i++)
+	{
+		m_pX64Buffer[i]	= NULL;
+		m_hBuffer[i]	= CORHANDLE_NULL;
+	}
+	for(i = 0; i < MAX_FRAME_COUNT; i++)
+		m_hFrame[i] = CORHANDLE_NULL;
+}
+
+
+CSapControl::~CSapControl(void)
+{
+	Deinitialize();
+
+	if(m_pFrameBuffer != NULL)
+		delete m_pFrameBuffer;
+	m_pFrameBuffer = NULL;
+}
+
+BOOL CSapControl::Initialize(void *pParam, int *pErrorCode,int iBoard)
+{
+	_GRABBER_INIT_PARAM_ *pParameter = (_GRABBER_INIT_PARAM_ *)pParam;
+
+	if(NULL != pParameter)
+	{
+		m_Param = *pParameter;		
+		m_nBoardID = iBoard;
+		
+	//	return TRUE;
+
+		CString			strDCF;
+		strDCF = m_Param.cDCFPath;
+
+		if (!GetServer())
+			return INITX64_FAIL_GETSERVER;
+
+		if (!CreateAcq())
+			return INITX64_FAIL_CREATEACQ;
+
+		if (!CreateCamAndVic())
+			return INITX64_FAIL_CAMNVIC;
+
+		if (!CreateBuffer(CORBUFFER_VAL_TYPE_SCATTER_GATHER))
+			return INITX64_FAIL_CREATEBUFFER;
+
+		if (!CreateXfer())
+			return INITX64_FAIL_CREATEXFER;
+
+		//	if (g_pBase->m_nCameraModel == 1 && !SetScanDirection(g_pBase->m_nCameraSensor))
+		//		return INITX64_FAIL_TDIDIRECTION;
+
+		//	int nBufferSize = g_pBase->m_nFrameWidth * g_pBase->m_nFrameHeight * g_pBase->m_nMemFrameNo;
+		//	CORSTATUS status = DisplayStatus("CorBufferMapEx", CorBufferMapExEx(m_hBuffer, 0, nBufferSize, m_pX64Buffer));
+		ClearBuffer();
+		
+	}
+	else
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CSapControl::ClearBuffer()
+{
+	__int32		tagHead = FRAME_HEAD_MARKER;
+	__int32		tagTail = FRAME_TAIL_MARKER;
+	UINT8		dir[4] = {1,1,1,1} ;
+	
+	for (int i = 0; i < m_Param.nGrabBufCount; i++)
+	{
+		for(int j = 0; j < m_Param.nGrabBufSize; j++)
+		{
+			if (DisplayStatus("CorBufferWriteDots"
+				, CorBufferWriteDots(m_hBuffer[i]
+			, 0
+				, j * m_Param.nFrameHeight
+				, dir, 4, &tagHead, 4)))
+				return FALSE;
+			if( DisplayStatus( "CorBufferWriteDots"
+				, CorBufferWriteDots(m_hBuffer[i]
+			, m_Param.nFrameWidth - 4
+				, (j * m_Param.nFrameHeight) + (m_Param.nFrameHeight - 1)
+				, dir, 4, &tagTail, 4)))
+				return FALSE;
+		}
+	}
+
+	return TRUE;
+}
+
+BOOL CSapControl::CreateXfer()
+{
+	// Xfer勤甸 积己
+	if (DisplayStatus("CorXferNew", CorXferNew(m_hBoard, m_hAcq, *m_hBuffer, NULL, &m_hXfer)))
+		return FALSE;
+
+	CORXFER_DESC  xfer_desc ;
+	xfer_desc.frame			= CORXFER_VAL_FRAME_NON_INTERLACED;
+	//	xfer_desc.fieldOrder	= CORXFER_VAL_FIELD_ORDER_ANY_ORDER;
+	xfer_desc.widthByte		= m_Param.nFrameWidth;
+	xfer_desc.height		= m_Param.nFrameHeight;
+	xfer_desc.incByte		= m_Param.nFrameWidth;
+
+#ifdef FRAME_CALLBACK
+	// 妮归 窃荐 殿废
+	if (DisplayStatus("CorXferRegisterCallback"
+		, CorXferRegisterCallback(m_hXfer
+		, CORXFER_VAL_EVENT_TYPE_END_OF_FRAME
+		, XferCallback, (void*)this)))
+#else
+	// 妮归 窃荐 殿废
+	if (DisplayStatus("CorXferRegisterCallback"
+		, CorXferRegisterCallback(m_hXfer
+		, CORXFER_VAL_EVENT_TYPE_END_OF_NLINES + m_Param.nFrameHeight
+		, XferCallback, (void*)this)))
+#endif
+		return FALSE;
+
+	for(int i = 1; i < m_Param.nGrabBufCount; i++)
+	{
+		if (DisplayStatus("CorXferAppend", CorXferAppend(m_hXfer, m_hAcq, m_hBuffer[i], NULL)))
+			return FALSE;
+
+		// 妮归 窃荐 殿废
+		if (DisplayStatus("CorXferRegisterCallback"
+			, CorXferRegisterCallback(m_hXfer
+			, CORXFER_VAL_EVENT_TYPE_END_OF_FRAME
+			, XferCallback, (void*)this)))
+			return FALSE;
+	}
+
+	if (DisplayStatus( "CorXferSetPrm",	CorXferSetPrm(m_hXfer, CORXFER_PRM_START_MODE, CORXFER_VAL_START_MODE_ASYNCHRONOUS)))
+		return FALSE;
+
+	if (DisplayStatus("CorXferConnect", CorXferConnectEx(m_hXfer,20000)))
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CSapControl::CreateBuffer(UINT32 uiType)
+{
+	UINT32 nBufFormat = 0;		// Buffer format
+
+	if (DisplayStatus("CorAcqGetPrm", CorAcqGetPrm(m_hAcq, CORACQ_PRM_OUTPUT_FORMAT, &nBufFormat)))
+		return FALSE;
+
+	//////////////////////////////////////////////////////////////////////////
+	// Buffer 且寸
+	CORSTATUS st;
+	int i;
+	SIZE_T tempBufferSize= m_Param.nGrabBufSize;
+	int nBufferrCount= m_Param.nGrabBufCount;	
+	SIZE_T TotalBufferSize= tempBufferSize*m_Param.nFrameWidth * m_Param.nFrameHeight * m_Param.nGrabBufCount;
+	SIZE_T nBufferSize = m_Param.nFrameWidth * m_Param.nFrameHeight * m_Param.nGrabBufSize;	
+
+	m_pOneLargeBuffer= (BYTE*)VirtualAlloc(NULL, TotalBufferSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+	if(m_pOneLargeBuffer == NULL)
+	{
+		g_pLog->DisplayMessage(L"Err.X64Grab.CreaBuffer.VirtualAlloc[%d]", TotalBufferSize);
+		return FALSE;
+	}	
+
+	for (i = 0; i <nBufferrCount; i++)
+	{
+		// Memory Address 且寸.
+		m_pX64Buffer[i] = (void*)(m_pOneLargeBuffer+ nBufferSize*i);		
+		if (m_pX64Buffer[i])
+		{
+			st = CorBufferNewEx(m_hPC, m_Param.nFrameWidth, m_Param.nFrameHeight * m_Param.nGrabBufSize, nBufFormat, uiType, NULL, (ULONG_PTR) m_pX64Buffer[i], &m_hBuffer[i]);
+			if (DisplayStatus("CorBuffeNew", st))
+				return FALSE;
+		}
+		else
+			return FALSE;
+	}
+
+	for(int j = 0; j < nBufferrCount; j++)
+	{
+		for(i =m_Param.nGrabBufSize * j; i < (m_Param.nGrabBufSize * (j + 1)); i++)
+		{
+			if(DisplayStatus("CorBufferNewChild", (CorBufferNewChild(m_hBuffer[j], 0, 
+				(i - nBufferSize * j) * m_Param.nFrameHeight,
+				m_Param.nFrameWidth, m_Param.nFrameHeight, &m_hFrame[i]))))
+				return FALSE;
+		}
+	}
+
+	return TRUE;
+}
+
+#include <cstringt.h>
+// Create CAM and VIC objects
+BOOL CSapControl::CreateCamAndVic()
+{
+	// Get a CAM handle
+	if (DisplayStatus("CorCamNew", CorCamNew(m_hPC, &m_hCam)))
+		return FALSE;
+
+	// Get a VIC handle
+	if (DisplayStatus("CorVicNew", CorVicNew(m_hPC, &m_hVic)))
+		return FALSE;
+
+	CString			strDCF,strVIC;
+	strDCF = m_Param.cDCFPath;
+	strVIC = m_Param.cDCFPath;
+
+	// If a CAM file is specified, then read it.
+	if (!strDCF.IsEmpty())
+	{
+		if(DisplayStatus("CorCamLoad", CorCamLoad(m_hCam, (PCSTR)strDCF.GetBuffer())))
+			return FALSE;
+	}
+
+	// If a VIC file is specified, then read it
+	if (!strVIC.IsEmpty())
+	{
+		if(DisplayStatus("CorVicLoad", CorVicLoad(m_hVic, (PCSTR)strVIC.GetBuffer())))
+			return FALSE;		
+	}
+
+	// Update the acquisition module with the new CAM and VIC parameters
+	if (DisplayStatus("CorAcqSetPrms", CorAcqSetPrms(m_hAcq, m_hVic, m_hCam, TRUE)))
+		return FALSE;
+
+	// 荐笼且 康惑狼 农扁 眠免
+	//	if (DisplayStatus("CorAcqGetPrm", CorAcqGetPrm(m_hAcq, CORACQ_PRM_SCALE_HORZ, &g_pBase->m_nFrameWidth)))
+	//		return FALSE;
+
+	//	if (DisplayStatus("CorAcqGetPrm", CorAcqGetPrm(m_hAcq, CORACQ_PRM_SCALE_VERT, &g_pBase->m_nFrameHeight)))
+	//		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CSapControl::CreateAcq()
+{
+	// Get acquisition module handle
+	UINT32 count ;
+	if (DisplayStatus("CorAcqGetCount", CorAcqGetCount(m_hBoard, &count)))
+		return FALSE;
+
+	if (DisplayStatus("CorAcqGetHandle", CorAcqGetHandle(m_hBoard, 0, &m_hAcq)))
+		return FALSE;
+
+	return TRUE;
+}
+
+BOOL CSapControl::GetServer()
+{
+	//Get server selected
+	char strName[50] = {0, };
+
+	m_hPC= CorManGetServer();
+
+	// Get handle to a Sapera enabled board
+	UINT32 uiCount = 0;
+	CorManGetServerCount(&uiCount);
+	if (uiCount == 0)
+		return FALSE;
+
+	if (DisplayStatus("CorManGetServerByIndex", CorManGetServerByIndex(1, strName, &m_hBoard)))
+		return FALSE;
+
+	return TRUE;
+}
+
+CORSTATUS CSapControl::DisplayStatus( char *functionName, CORSTATUS status)
+{	
+	char statusMsg[ 256];
+	CORSTATUS msgStatus = CORSTATUS_OK;
+
+	if( status != CORSTATUS_OK)
+	{
+		msgStatus = CorManGetStatusText( status, statusMsg, 256, NULL, 0);
+		if( msgStatus == CORSTATUS_OK)
+		{
+			g_pLog->DisplayMessage(_T("1Error: Function [%s] (module= 0x%lX status= 0x%lX info= 0x%lX) <%s>"),functionName, CORSTATUS_MODULE( status), CORSTATUS_ID( status), CORSTATUS_INFO( status), statusMsg);			
+		}
+		else
+		{
+			g_pLog->DisplayMessage(_T("2Error: Function [%s] (module= 0x%lX status= 0x%lX info= 0x%lX)"),functionName, CORSTATUS_MODULE( status), CORSTATUS_ID( status), CORSTATUS_INFO( status));			
+		}
+		
+		return status;
+	}
+
+	return( status);
+}
+
+BOOL CSapControl::Deinitialize()
+{
+	BOOL result = TRUE;
+
+	result &= DestroyBuffer();
+	result &= DestroyCamAndVic();
+	result &= DestroyXfer();
+
+	return result;
+}
+
+BOOL CSapControl::DestroyBuffer()
+{
+	// Release the buffer handles	
+	if(m_pOneLargeBuffer != NULL)
+		VirtualFree(m_pOneLargeBuffer, 0, MEM_RELEASE);
+	m_pOneLargeBuffer= NULL;
+
+	for (int i = 0; i < m_Param.nGrabBufCount; i++)
+	{
+		if (m_pX64Buffer[i])
+		{
+			m_pX64Buffer[i] = NULL;
+		}
+
+		if (VALIDATE_HANDLE_BUFFER(m_hBuffer[i]) == CORSTATUS_OK)
+		{
+			if (DisplayStatus("CorBufferFree", CorBufferFree(m_hBuffer[i])))
+				return FALSE;
+
+			m_hBuffer[i] = CORHANDLE_NULL;
+		}
+	}
+	
+
+	return TRUE;
+}
+
+// Destroy CAM and VIC objects
+BOOL CSapControl::DestroyCamAndVic()
+{
+	// Release VIC handle
+	if (VALIDATE_HANDLE_VIC(m_hVic) == CORSTATUS_OK)
+	{
+		if (DisplayStatus( "CorVicFree", CorVicFree(m_hVic)))
+			return FALSE;
+
+		m_hVic = CORHANDLE_NULL;
+	}
+	// Release CAM handle
+	if (VALIDATE_HANDLE_CAM(m_hCam) == CORSTATUS_OK)
+	{
+		if (DisplayStatus( "CorCamFree", CorCamFree(m_hCam)))
+			return FALSE;
+
+		m_hCam = CORHANDLE_NULL;
+	}
+
+	return TRUE;
+}
+
+// Destroy Transfer object
+BOOL CSapControl::DestroyXfer()
+{
+	// Deactivate the connection(s)
+	if (VALIDATE_HANDLE_XFER(m_hXfer) == CORSTATUS_OK)
+	{
+		if( DisplayStatus("CorXferDisconnect", CorXferDisconnect(m_hXfer)))
+			return FALSE;
+
+		// Release the Xfer handle
+		if (DisplayStatus("CorXferFree", CorXferFree(m_hXfer)))
+			return FALSE;
+
+		m_hXfer = CORHANDLE_NULL;
+	}
+
+	return TRUE;	
+}
+
+BOOL CSapControl::InitializeBuffer(void *pParam)
+{
+	_GRABBER_INIT_PARAM_ *pParameter = (_GRABBER_INIT_PARAM_ *)pParam;
+
+	BOOL		bRet = TRUE;
+	if(NULL != pParameter)
+	{
+		m_Param = *pParameter;
+
+		bRet = CreateGrabBuffer(m_Param.nScanCount,m_Param.nGrabBufCount,m_Param.nFrameWidth,m_Param.nFrameHeight);
+	}
+
+	return bRet;
+}
+
+BOOL CSapControl::CreateGrabBuffer(int nScanCount,int nBufSize, int nBufSizeX, int nBufSizeY)
+{
+	SIZE_T tempBufferSize= nBufSize;
+	SIZE_T tempFrmCX = nBufSizeX;
+	SIZE_T tempFrmCY = nBufSizeY;
+	SIZE_T TotalBufferSize= tempBufferSize*tempFrmCX*tempFrmCY;	
+	m_nAllocatedGrabBufSize = nBufSize;	
+
+	if(m_pFrameBuffer != NULL)
+		delete m_pFrameBuffer;
+	m_pFrameBuffer = NULL;
+
+	m_pFrameBuffer = new CFrameBufferController;
+
+	if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount))
+	{		
+		g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);		
+	}
+	else
+	{
+		g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+BOOL CSapControl::GrabLiveStart(int nExposure)
+{
+	if (IsGrabbing())
+	{
+		g_pLog->DisplayMessage(_T("Start Live Acq : IsGrabbing -> Stop Acq %d"), m_nEndFrameIdx);
+		GrabScanStop();
+		Sleep(100);				
+	}
+
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	m_nSetBufferIdx = -1;
+	m_nScanIndex = 0;	
+
+	int nFrameCount = m_Param.nGrabBufCount / m_Param.nGrabBufSize;
+	if (m_Param.nGrabBufCount % m_Param.nGrabBufSize > 0)
+		nFrameCount++;
+	nFrameCount += 4;
+
+	if (DisplayStatus( "CorAcqSetPrm", CorAcqSetPrm(m_hAcq, CORACQ_PRM_EXT_TRIGGER_FRAME_COUNT, nFrameCount)))
+		return FALSE;
+
+	m_isGrabbing = TRUE;
+	m_isLiveGrab = TRUE;
+	g_pLog->DisplayMessage(_T("Start Live Acq"));
+
+	return TRUE;
+}
+
+BOOL CSapControl::GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure, BOOL bAuto)
+{	
+	if (IsGrabbing())
+	{
+		g_pLog->DisplayMessage(_T("Start Acq : IsGrabbing -> Stop Acq %d"), m_nEndFrameIdx);
+		GrabScanStop();
+		Sleep(100);
+	}
+
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	m_nSetBufferIdx = -1;
+	m_nScanIndex = iScan;
+
+	if(bAuto == TRUE)
+	{
+		int nFrameCount = m_Param.nGrabBufCount / m_Param.nGrabBufSize;
+		if (m_Param.nGrabBufCount % m_Param.nGrabBufSize > 0)
+			nFrameCount++;
+		nFrameCount += 4;
+
+		if(bFreeRun == FALSE)
+		{
+			// 悼扁 康惑犬焊 版快 
+			if( DisplayStatus( "CorAcqSetPrm", CorAcqSetPrm(m_hAcq, CORACQ_PRM_EXT_FRAME_TRIGGER_ENABLE, TRUE)))
+				return FALSE;
+
+			if (DisplayStatus( "CorAcqSetPrm", CorAcqSetPrm(m_hAcq, CORACQ_PRM_EXT_TRIGGER_FRAME_COUNT, nFrameCount)))
+				return FALSE;
+		}
+		else
+		{
+			if (DisplayStatus( "CorAcqSetPrm", CorAcqSetPrm(m_hAcq, CORACQ_PRM_EXT_TRIGGER_FRAME_COUNT, nFrameCount)))
+				return FALSE;
+		}
+
+		if (DisplayStatus("CorXferStart", CorXferStart(m_hXfer, CORXFER_CONTINUOUS)))
+			return FALSE;
+
+		m_isGrabbing = TRUE;
+		m_isLiveGrab = FALSE;
+	}
+	else
+	{
+		SimulationGrab(iScan);
+	}	
+
+	g_pLog->DisplayMessage(_T("Start Acq : %d"), iScan);
+
+	return TRUE;
+}
+
+BOOL CSapControl::GrabScanStop(void)
+{
+	g_pLog->DisplayMessage(_T("%d StopAcq : Scan %d, Grab %d, End %d"), m_Param.nBoardIdx,m_nScanIndex,m_nSetBufferIdx, m_nEndFrameIdx);
+
+	BOOL bRet = TRUE;
+	if (m_bIsGrabbing)
+	{
+		g_pLog->DisplayMessage(L"StopAcq : Grab %d, End %d", m_nSetBufferIdx, m_nEndFrameIdx);
+
+		//20141022 yjm abort 肺 窍搁 促澜 弊乏矫 磊操焊靛啊 桓绢滚赴促. 犁何泼父 烹窃..揪广 俺绊积ぱぱせ
+		if (DisplayStatus("CorXferStop", CorXferStop(m_hXfer)))//if (DisplayStatus("CorXferStop", CorXferAbort(m_hXfer)))
+		{
+			g_pLog->DisplayMessage(L"CorXferAbort Fail. Grab %d, End %d", m_nSetBufferIdx, m_nEndFrameIdx);
+			bRet = FALSE;
+			//return FALSE;
+		}
+
+		if(DisplayStatus("CorXferWait", CorXferWait(m_hXfer, 200)))
+		{
+			g_pLog->DisplayMessage(L"CorXferWait 1 Fail. Grab %d, End %d", m_nSetBufferIdx, m_nEndFrameIdx);
+			bRet = FALSE;
+			//return FALSE;
+		}
+
+		if (DisplayStatus("CorXferAbort", CorXferAbort(m_hXfer)))
+		{
+			g_pLog->DisplayMessage(L"CorXferAbort Fail. Grab %d, End %d", m_nSetBufferIdx, m_nEndFrameIdx);
+			bRet = FALSE;
+			//return FALSE;
+		}
+
+		if(DisplayStatus("CorXferWait", CorXferWait(m_hXfer, 200)))
+		{
+			g_pLog->DisplayMessage(L"CorXferWait 2 Fail. Grab %d, End %d", m_nSetBufferIdx, m_nEndFrameIdx);
+			bRet = FALSE;
+			//return FALSE;
+		}
+
+		m_isGrabbing = FALSE;
+		m_isLiveGrab = FALSE;
+	}
+
+	return bRet;
+}
+
+int CSapControl::IsAcqFrame(int nFrameNo, int nThreadIdx)
+{
+	return m_nSetBufferIdx - nFrameNo;		
+}
+
+LPBYTE	CSapControl::GetFrameHeaderLine(int iScan,int nLine, BOOL* bSuccess)
+{	
+	if(m_pFrameBuffer == NULL)
+		return NULL;
+
+	return m_pFrameBuffer->GetFrameHeaderLine(iScan,nLine);
+}
+
+LPBYTE CSapControl::GetFrameHeader(int iScan,int nFrameNo, BOOL* bRet)
+{		
+	if(m_pFrameBuffer == NULL)
+		return NULL;
+
+	return m_pFrameBuffer->GetFrameBuferHeader(iScan,nFrameNo);
+}
+
+BOOL CSapControl::GetSmallImage(int iScan,LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping) 
+{
+	int nBufSizeX = m_Param.nFrameWidth;
+	int nBufSizeY = m_Param.nFrameHeight;
+
+	if (nXStart < 0 || nYStart < 0)
+		return FALSE;
+	if (nXStart + nXSize > nBufSizeX)
+		return FALSE;
+	if (nYStart + nYSize > nBufSizeY* GetEndFrameIdx())
+		return FALSE;
+
+	// 矫累 橇饭烙 锅龋客 场 橇饭烙 锅龋.
+	int nStartFrameNo = nYStart / nBufSizeY;
+	int nEndFrameNo = (nYStart + nYSize) / nBufSizeY;
+	LPBYTE	lpHeadAddr = GetFrameHeader(iScan,nStartFrameNo);
+	if (!lpHeadAddr)
+	{
+		return FALSE;
+	}
+	LPBYTE lpStart = lpHeadAddr + (nYStart % nBufSizeY) * nBufSizeX + nXStart;
+
+	int nLine = 0;
+	for (int i = 0; i < nYSize; i++)
+	{
+		memcpy(lpIn + i * nXSize, lpStart + nLine * nBufSizeX, nXSize);
+		if (nStartFrameNo <= nEndFrameNo && (nYStart + i + 1) % nBufSizeY  == 0)
+		{
+			// 捞固瘤甫 蝶郴具窍绰 康开捞 MemFrameNo 版拌俊 吧媚乐绰 版快 贸府.
+			lpHeadAddr = GetFrameHeader(iScan,++nStartFrameNo);
+			lpStart = lpHeadAddr + nXStart;
+			nLine = 0;
+		}
+		else
+			nLine++;
+	}
+
+	return TRUE;
+}
+
+int CSapControl::GetGrabFrameCount()
+{
+	return (int)m_dqCallbackFrame.size();
+}
+
+void CSapControl::ClearGrabIdx()
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	m_dqCallbackFrame.clear();
+	MyLock.Unlock();
+}
+
+BOOL CSapControl::FindGrabIdx(int iScan,int iFrame)
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+
+	BOOL				bRet = FALSE;
+	stFrameIndex		stFrame;
+	for(dqGrabIdxIt it=m_dqCallbackFrame.begin();it!=m_dqCallbackFrame.end();it++)
+	{
+		stFrame = *it;
+
+		if(stFrame.nScanIdx == iScan)
+		{
+			if(stFrame.nFrameIdx < iFrame)
+				bRet = TRUE;
+		}
+	}
+	MyLock.Unlock();
+
+	return bRet;
+}
+
+stFrameIndex CSapControl::GetGrabFrameNoRemove()
+{
+	stFrameIndex stPop(-1, -1);	
+
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	if(IsHasGrabFrame() == FALSE)
+	{
+		MyLock.Unlock();
+		return stPop;
+	}
+
+	stPop = m_dqCallbackFrame.front();	
+
+	TRACE("Pop Frame Lock[%d]\r\n", stPop.nFrameIdx);
+	MyLock.Unlock();
+	return stPop;
+}
+
+stFrameIndex CSapControl::GetGrabFrame()
+{
+	stFrameIndex stPop(-1, -1);	
+
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	if(IsHasGrabFrame() == FALSE)
+	{
+		MyLock.Unlock();
+		return stPop;
+	}
+
+	stPop = m_dqCallbackFrame.front();
+	m_dqCallbackFrame.pop_front();
+
+	TRACE("Pop Frame Lock[%d]\r\n", stPop.nFrameIdx);
+	MyLock.Unlock();
+	return stPop;
+}
+
+BOOL CSapControl::IsHasGrabFrame()
+{
+	return !m_dqCallbackFrame.empty();
+}
+
+void CSapControl::SimulationGrab(int iScan)
+{
+	if(m_pFrameBuffer == NULL)
+		return;
+
+	int			nFrameCnt = m_pFrameBuffer->GetFrameCount();
+
+	m_nEndFrameIdx = nFrameCnt;
+	m_nSetBufferIdx = nFrameCnt -1;
+
+	for(int i=0;i<nFrameCnt;i++)
+	{
+		SetInsertFrame(iScan,i);
+	}
+}
+
+BOOL CSapControl::SetInsertFrame(int iScan,int iFrame)
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+
+	stFrameIndex		stFrame(iScan,iFrame);
+	m_dqCallbackFrame.push_back(stFrame);
+	MyLock.Unlock();
+
+	return TRUE;
+}
+
+LPBYTE CSapControl::GetGrabFrameHeader(int nFrameNo)
+{
+	LPBYTE lpBuffer = NULL;
+
+	// 捞固瘤甫 嘛篮 利捞 绝绰 版快绰 滚欺甫 府畔茄促.
+	if (m_nStartFrameIdx == 0 && m_nEndFrameIdx == 0)
+	{
+		if (nFrameNo >= 0 && nFrameNo <	g_pBase->m_pMemFrameNo[m_Param.nCameraIdx])
+		{
+			LPBYTE uiHeadAddr;
+			CorBufferGetPrm(m_hBuffer[nFrameNo / m_Param.nGrabBufSize], CORBUFFER_PRM_ADDRESS, &uiHeadAddr);
+			lpBuffer = (LPBYTE)(uiHeadAddr + ((nFrameNo % m_Param.nGrabBufSize) * m_Param.nFrameWidth * m_Param.nFrameHeight));
+		}
+		else
+			lpBuffer = NULL;
+	}
+	else	// 捞固瘤甫 嘛篮 版快绰 Frame No甫 犬牢窍咯 滚欺甫 府畔茄促.
+	{
+		if (nFrameNo >= m_nStartFrameIdx && nFrameNo < m_nEndFrameIdx)
+		{
+			int nBufferNo = (nFrameNo / m_Param.nGrabBufSize) % m_Param.nGrabBufCount;			
+			LPBYTE uiHeadAddr;
+			CorBufferGetPrm(m_hBuffer[nBufferNo], CORBUFFER_PRM_ADDRESS, &uiHeadAddr);
+			lpBuffer = reinterpret_cast<LPBYTE>(uiHeadAddr + ((nFrameNo % m_Param.nGrabBufSize) * m_Param.nFrameWidth * m_Param.nFrameHeight));
+		}
+		else
+			lpBuffer = NULL;
+	}
+
+	return lpBuffer;
+}
+
+CORSTATUS CCONV CSapControl::XferCallback(void *context, UINT32 eventType, UINT32 eventCount)
+{
+	CSapControl* pX64 = (CSapControl*)context;
+
+	pX64->m_nEndFrameIdx++;			//Count
+	pX64->m_nSetBufferIdx++;		//index	
+
+	if (pX64->m_nEndFrameIdx > g_pStatus->GetGrabFrameCount(pX64->m_nScanIndex))
+	{
+		pX64->GrabScanStop();		
+		g_pStatus->SetGrabEnd(pX64->m_nScanIndex);
+		g_pLog->DisplayMessage(_T("%d Over Grab Count : Stop Grab[%d][%d] - %d"), pX64->m_Param.nBoardIdx, pX64->m_nScanIndex, pX64->m_nEndFrameIdx,g_pStatus->GetGrabFrameCount(pX64->m_nScanIndex));
+		return TRUE;
+	}
+
+	if (pX64->m_nSetBufferIdx > pX64->m_pFrameBuffer->GetFrameCount())
+	{
+		pX64->GrabScanStop();		
+		g_pStatus->SetGrabEnd(pX64->m_nScanIndex);
+		g_pLog->DisplayMessage(_T("%d Over Grab Buffer Stop Grab[%d][%d] - %d"), pX64->m_Param.nBoardIdx, pX64->m_nScanIndex, pX64->m_nEndFrameIdx,pX64->m_pFrameBuffer->GetFrameCount());
+		return TRUE;
+	}
+
+	LPBYTE		pBuffer = pX64->m_pFrameBuffer->GetFrameBuferHeader(pX64->m_nScanIndex,pX64->m_nSetBufferIdx);
+	if(pBuffer == NULL)
+	{
+		pX64->GrabScanStop();		
+		g_pStatus->SetGrabEnd(pX64->m_nScanIndex);
+		g_pLog->DisplayMessage(_T("%d Over Grab Buffer Stop Grab[%d][%d] - %d"), pX64->m_Param.nBoardIdx, pX64->m_nScanIndex, pX64->m_nEndFrameIdx,pX64->m_pFrameBuffer->GetFrameCount());
+		return TRUE;
+	}
+
+	LPBYTE lpBuffer = pX64->GetGrabFrameHeader(pX64->m_nSetBufferIdx);
+	if(lpBuffer == NULL)
+		return FALSE;
+
+	memcpy(pBuffer, lpBuffer, pX64->m_Param.nFrameWidth * pX64->m_Param.nFrameHeight);
+
+	pX64->SetInsertFrame(pX64->m_nScanIndex,pX64->m_nSetBufferIdx);
+
+	return CORSTATUS_OK;
+}
\ No newline at end of file
diff --git a/ENRIT/Grabber/SapControl.h b/ENRIT/Grabber/SapControl.h
new file mode 100644
index 0000000..cd0a4c4
--- /dev/null
+++ b/ENRIT/Grabber/SapControl.h
@@ -0,0 +1,89 @@
+#pragma once
+
+#include "Global_Define.h"
+#include "corapi.h"
+
+#define		MAX_BUFFER_SIZE		20
+#define		MAX_BUFFER_COUNT	200
+enum	BUFFER_COUNT{MAX_FRAME_COUNT= MAX_BUFFER_SIZE*MAX_BUFFER_COUNT};
+
+class CFrameBufferController;
+class CSapControl : public CGrabberControl
+{
+public:
+	CSapControl(void);
+	virtual ~CSapControl(void);
+
+public:
+	virtual BOOL	Initialize(void *pParam, int *pErrorCode,int iBoard=0);	// Grabber 檬扁拳
+	virtual BOOL	InitializeBuffer(void *pParam);	
+	virtual BOOL	Deinitialize();
+	virtual BOOL	GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure=10, BOOL bAuto=TRUE);
+	virtual BOOL	GrabLiveStart(int nExposure=15);
+	virtual BOOL	GrabScanStop();
+	virtual BOOL	IsGrabbing(){return m_isGrabbing;}
+	virtual int		IsAcqFrame(int nFrameNo, int nThreadIdx = -1);
+	virtual LPBYTE	GetFrameHeader(int iScan,int nFrameNo, BOOL* bSuccess = NULL);
+	virtual LPBYTE	GetFrameHeaderLine(int iScan,int nLine, BOOL* bSuccess = NULL);
+	virtual BOOL	GetSmallImage(int iScan,LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping = TRUE);	
+	virtual int		GetStartFrameIdx()		{ return m_nStartFrameIdx; }
+	virtual int		GetEndFrameIdx()		{ return m_nEndFrameIdx; }
+	virtual void	SetSimulFrame(int nFrame){;}
+	virtual int		GetGrabFrameCount();
+	virtual void	ClearGrabIdx();
+	virtual stFrameIndex	GetGrabFrame();
+	virtual stFrameIndex	GetGrabFrameNoRemove();
+	virtual CFrameBufferController	*GetFrameBuffer(){return m_pFrameBuffer;}
+	virtual BOOL	SetTriggerMode( BOOL bExTrigger ){return TRUE;}
+	BOOL			FindGrabIdx(int iScan,int iFrame);
+
+protected:
+	BOOL			GetServer();
+	CORSTATUS		DisplayStatus( char *functionName, CORSTATUS status);
+	BOOL			CreateAcq();
+	BOOL			CreateCamAndVic();
+	BOOL			CreateBuffer(UINT32 uiType);
+	BOOL			CreateXfer();
+	BOOL			ClearBuffer();
+	BOOL			CreateGrabBuffer(int nScanCount,int nBufSize, int nBufSizeX, int nBufSizeY);
+
+	BOOL			DestroyBuffer();
+	BOOL			DestroyXfer();
+	BOOL			DestroyCamAndVic();
+
+	void			SimulationGrab(int iScan);
+	BOOL			SetInsertFrame(int iScan,int iFrame);
+	BOOL			IsHasGrabFrame();
+	LPBYTE			GetGrabFrameHeader(int nFrameNo);
+
+	static CORSTATUS CCONV XferCallback (void *context, UINT32 eventType, UINT32 eventCount);
+
+protected:
+	_GRABBER_INIT_PARAM_	m_Param;
+	int					m_nEndFrameIdx;		// 泅犁 Grab 茄 荐
+	int					m_nStartFrameIdx;	// 啊厘 坷贰傈俊 Grab茄 Frame狼 牢郸胶.
+	int					m_nSetBufferIdx;
+	int					m_nScanIndex;	
+	int					m_nAllocatedGrabBufSize;	
+	int					m_nBoardID;
+	BOOL				m_isGrabbing;
+	BOOL				m_isLiveGrab;	
+	CFrameBufferController	*m_pFrameBuffer;	
+	dqGrabIdx			m_dqCallbackFrame;
+	CCriticalSection	m_csIdxLock;
+
+	BYTE*				m_pOneLargeBuffer;
+	void*				m_pX64Buffer[MAX_BUFFER_COUNT];	// 角力 且寸瞪 滚欺.
+	CORBUFFER			m_hBuffer[MAX_BUFFER_COUNT];		// Handle to Buffer module where acquisition will take place
+	CORBUFFER			m_hFrame[MAX_FRAME_COUNT];
+	BOOL				m_bIsGrabbing;		// Grabbing 吝牢瘤 酒囱瘤 魄窜.
+
+	CORSERVER			m_hPC;				// Handle to a PC Sapera server
+	CORSERVER			m_hBoard;			// Handle to Sapera server that will be acquiring
+	CORCAM				m_hCam;				// Handle to Camera module
+	CORVIC				m_hVic;				// Handle to VIC module
+	CORXFER				m_hXfer;			// Handle to Transfer module
+	CORACQ				m_hAcq;				// Handle to Acquisition module
+
+};
+
diff --git a/ENRIT/Grabber/SapLineGrab.cpp b/ENRIT/Grabber/SapLineGrab.cpp
new file mode 100644
index 0000000..12c03b4
--- /dev/null
+++ b/ENRIT/Grabber/SapLineGrab.cpp
@@ -0,0 +1,713 @@
+
+#include "StdAfx.h"
+#include "SapLineGrab.h"
+
+#define	TEMP_GRAB_NUM		30
+
+CSapLineGrab::CSapLineGrab(void)
+{
+	m_pSapAcq = NULL;
+	m_pSapBuffers = NULL;
+	m_pXfer = NULL;
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	m_nSetBufferIdx = 0;
+	m_nGrabFrameNo = 650;
+	m_bXferCall = FALSE;
+	m_pFrameBuffer = NULL;
+	m_nBoardID = -1;
+	m_nAllocatedGrabBufSize = 0;
+	m_bGrabLive = FALSE;
+}
+
+CSapLineGrab::~CSapLineGrab(void)
+{
+	Deinitialize();
+}
+
+BOOL CSapLineGrab::Deinitialize()
+{
+	DestroyObjects();
+	DeleteObjects();
+
+	if (m_pFrameBuffer != NULL)
+		delete m_pFrameBuffer;
+	m_pFrameBuffer = NULL;
+
+	return TRUE;
+}
+
+BOOL CSapLineGrab::CreateAcq(char *camFile)
+{
+	if (SapManager::Open() == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("Error: SapManager::Open."));
+		return FALSE;
+	}
+
+	// Get actual server count and ensure m_nBoardID is within range
+	int nCount = SapManager::GetServerCount(SapManager::ResourceAcq);
+	if (m_nBoardID < 0 || m_nBoardID >= nCount) {
+		g_pLog->DisplayMessage(_T("Error: Invalid Board ID. ServerCount=%d, nBoardID=%d"), nCount, m_nBoardID);
+		return FALSE;
+	}
+
+	char serverName[30];
+	SapManager::GetServerName(m_nBoardID, SapManager::ResourceAcq, serverName);
+
+	// Check resource count for the location
+	SapLocation loc(serverName, 0);
+	nCount = SapManager::GetResourceCount(loc, SapManager::ResourceAcq);
+	if (nCount < 0) {
+		g_pLog->DisplayMessage(_T("Error: Invalid Resource Count. ResourceCount=%d, nBoardID=%d"), nCount, m_nBoardID);
+		return FALSE;
+	}
+
+	m_pSapAcq = new SapAcquisition(loc, camFile);
+
+	return TRUE;
+}
+
+static void XferCallbackGrab(SapXferCallbackInfo *pInfo);
+
+BOOL CSapLineGrab::Initialize(void *pParam, int *pErrorCode,int iBoard)
+{
+	_GRABBER_INIT_PARAM_* pParameter = (_GRABBER_INIT_PARAM_*)pParam;
+
+	if (NULL != pParameter) {
+		m_Param = *pParameter;
+		m_nBoardID = iBoard;
+
+		if (CreateAcq(m_Param.cDCFPath) == FALSE) {
+			if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEACQ;
+			g_pLog->DisplayMessage(_T("Error: CreateAcq fail."));
+			return FALSE;
+		}
+
+		if (CreateBuffer(0) == FALSE) {
+			if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEBUFFER;
+			g_pLog->DisplayMessage(_T("Error: CreateBuffer fail."));
+			return FALSE;
+		}
+
+		if (ActivateObjects() == FALSE) {
+			if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEXFER;
+			g_pLog->DisplayMessage(_T("Error: ActivateObjects fail."));
+			return FALSE;
+		}
+
+		if (m_pXfer->Connect() == FALSE) {
+			g_pLog->DisplayMessage(_T("Error: m_pXfer->Connect fail."));
+			return FALSE;
+		}
+
+		m_pXfer->SetAutoConnect(TRUE);
+		ClearBuffer();
+	}
+	else {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+BOOL CSapLineGrab::InitializeBuffer(void *pParam)
+{
+	_GRABBER_INIT_PARAM_ *pParameter = (_GRABBER_INIT_PARAM_ *)pParam;
+
+	BOOL		bRet = TRUE;
+	if(NULL != pParameter)
+	{
+		m_Param = *pParameter;
+
+		bRet = CreateGrabBuffer(m_Param.nScanCount,m_Param.nGrabBufCount,m_Param.nFrameWidth,m_Param.nFrameHeight);
+	}
+
+	return bRet;
+}
+
+BOOL CSapLineGrab::CreateGrabBuffer(int nScanCount,int nBufSize, int nBufSizeX, int nBufSizeY)
+{
+	SIZE_T tempBufferSize= nBufSize;
+	SIZE_T tempFrmCX = nBufSizeX;
+	SIZE_T tempFrmCY = nBufSizeY;
+	SIZE_T TotalBufferSize= tempBufferSize*tempFrmCX*tempFrmCY;	
+	m_nAllocatedGrabBufSize = nBufSize;	
+
+	if(m_pFrameBuffer != NULL)
+		delete m_pFrameBuffer;
+	m_pFrameBuffer = NULL;
+
+	m_pFrameBuffer = new CFrameBufferController;
+
+	if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount))
+	{		
+		g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);		
+	}
+	else
+	{
+		g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+BOOL CSapLineGrab::CreateBuffer(UINT32 uiType)
+{
+	UINT32	nBuffFormat= 0;
+	CORHANDLE hAcq= m_pSapAcq->GetHandle();
+
+//	CorAcqGetPrm(hAcq, CORACQ_PRM_OUTPUT_FORMAT, &nBuffFormat);
+
+
+	////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	// Process侩 滚欺 积己
+
+	// 1. Memory Virtual Alloc
+	m_pSapBuffers = new SapBuffer(TEMP_GRAB_NUM, m_pSapAcq);
+	
+	// 2.  Create Transfer
+	m_pXfer	= new SapAcqToBuf(m_pSapAcq, m_pSapBuffers, XferCallbackGrab, this);
+	m_pXfer->SetAutoConnect(FALSE);// ???
+	m_pXfer->GetPair(0)->SetEventType(SapXferPair::EventEndOfFrame);// ???
+		
+
+	return TRUE;
+}
+
+BOOL CSapLineGrab::ActivateObjects()
+{
+	// Error checks for SapAcq, SapBuffers, and Xfer creation
+	if (m_pSapAcq && !*m_pSapAcq) {
+		if (!m_pSapAcq->Create()) {
+			DestroyObjects();
+			g_pLog->DisplayMessage(_T("Error: m_pSapAcq->Create fail."));
+			return FALSE;
+		}
+	}
+
+	if (m_pSapBuffers && !*m_pSapBuffers) {
+		if (!m_pSapBuffers->Create()) {
+			DestroyObjects();
+			g_pLog->DisplayMessage(_T("Error: m_pSapBuffers->Create fail."));
+			return FALSE;
+		}
+		m_pSapBuffers->Clear();
+	}
+
+	if (m_pXfer && !*m_pXfer) {
+		m_pXfer->SetAutoEmpty(TRUE);
+		if (!m_pXfer->Create()) {
+			DestroyObjects();
+			g_pLog->DisplayMessage(_T("Error: m_pXfer->Create fail."));
+			return FALSE;
+		}
+	}
+
+	return TRUE;
+}
+
+void CSapLineGrab::DeleteObjects()
+{
+	if(m_pXfer)			{delete m_pXfer; m_pXfer= NULL;}
+	if(m_pSapBuffers)	{delete m_pSapBuffers; m_pSapBuffers= NULL;}
+	if(m_pSapAcq)		{delete m_pSapAcq; m_pSapAcq= NULL;}
+}
+
+void CSapLineGrab::DestroyObjects()
+{
+	GrabScanStop();
+
+	// Destroy transfer object
+	if (m_pXfer && *m_pXfer) m_pXfer->Destroy();
+
+	// Destroy buffer object
+	if (m_pSapBuffers && *m_pSapBuffers) m_pSapBuffers->Destroy();
+
+	// Destroy acquisition object
+	if (m_pSapAcq && *m_pSapAcq) m_pSapAcq->Destroy();
+}
+
+BOOL CSapLineGrab::ClearBuffer()
+{
+	return TRUE;
+}
+
+void CSapLineGrab::My_XferCallback(SapXferCallbackInfo *pInfo)
+{
+	SapXferPair::EventType eventType = pInfo->GetEventType();
+	m_bXferCall = TRUE;
+
+	m_cxferCall++;	
+
+	if((eventType & SapXferPair::EventEndOfFrame) == SapXferPair::EventEndOfFrame)
+	{		
+		m_nSetBufferIdx++;		//index	
+
+		if(m_bGrabLive == TRUE)
+			m_nSetBufferIdx = 0;
+		
+		if (m_nEndFrameIdx > g_pStatus->GetGrabFrameCount(m_nScanIndex))
+		{
+			GrabScanStop();		
+			g_pStatus->SetGrabEnd(m_nScanIndex);
+			g_pLog->DisplayMessage(_T("%d Over Grab Count : Stop Grab[%d][%d] - %d"), m_Param.nBoardIdx, m_nScanIndex, m_nEndFrameIdx,g_pStatus->GetGrabFrameCount(m_nScanIndex));
+			return;
+		}
+
+		if (m_nSetBufferIdx > m_pFrameBuffer->GetFrameCount())
+		{
+			GrabScanStop();		
+			g_pStatus->SetGrabEnd(m_nScanIndex);
+			g_pLog->DisplayMessage(_T("%d Over Grab Buffer Stop Grab[%d][%d] - %d"), m_Param.nBoardIdx, m_nScanIndex, m_nEndFrameIdx,m_pFrameBuffer->GetFrameCount());
+			return;
+		}
+
+		LPBYTE		pBuffer = m_pFrameBuffer->GetFrameBuferHeader(m_nScanIndex,m_nSetBufferIdx);
+		if(pBuffer == NULL)
+		{
+			GrabScanStop();		
+			g_pStatus->SetGrabEnd(m_nScanIndex);
+			g_pLog->DisplayMessage(_T("%d Over Grab Buffer Stop Grab[%d][%d] - %d"), m_Param.nBoardIdx, m_nScanIndex, m_nEndFrameIdx,m_pFrameBuffer->GetFrameCount());
+			return;
+		}
+
+		LPBYTE lpBuffer = GetGrabFrameHeader(m_nSetBufferIdx);
+		if(lpBuffer == NULL)
+			return;
+
+		memcpy(pBuffer, lpBuffer, m_Param.nFrameWidth * m_Param.nFrameHeight);
+
+		SetInsertFrame(m_nScanIndex,m_nSetBufferIdx);
+
+		if(m_bGrabLive == FALSE)
+			m_nEndFrameIdx++;			//Count
+	}
+}
+
+BOOL CSapLineGrab::IsGrabbing()
+{
+	if(m_pXfer)
+		return m_pXfer->IsGrabbing();
+
+	return FALSE;
+}
+
+void XferCallbackGrab(SapXferCallbackInfo *pInfo)
+{
+	CSapLineGrab *pGrab= (CSapLineGrab*) pInfo->GetContext();
+	pGrab->My_XferCallback(pInfo);
+}
+
+
+LPBYTE CSapLineGrab::GetGrabFrameHeader(int nFrameNo, BOOL* bRet)
+{
+	// 捞固瘤甫 嘛篮 利捞 绝绰 版快绰 滚欺甫 府畔茄促.
+	LPBYTE pBuff= NULL;
+	if(nFrameNo > m_nSetBufferIdx)	return NULL;
+
+	nFrameNo= nFrameNo%TEMP_GRAB_NUM;
+	m_pSapBuffers->GetAddress(nFrameNo, (void**)&pBuff);
+
+	return pBuff;
+
+	/*
+	LPBYTE lpBuffer = NULL;
+	if (m_nStartFrameIdx == 0 && m_nEndFrameIdx == 0)
+	{
+		if (bRet)
+			*bRet = FALSE;
+		if (nFrameNo >= 0 && nFrameNo < GetFrameCount())
+		{
+			//lpBuffer= m_pData+ GetFrameSize()*nFrameNo;
+			m_pSapBuffers->GetAddress(nFrameNo, (void**)&lpBuffer);
+			//lpBuffer= m_pData;
+		}
+		else
+			lpBuffer = NULL;
+	}
+	else	// 捞固瘤甫 嘛篮 版快绰 Frame No甫 犬牢窍咯 滚欺甫 府畔茄促.
+	{
+		if (bRet)
+			*bRet = TRUE;
+		//if (nFrameNo >= m_nStartFrameIdx && nFrameNo < m_nEndFrameIdx)
+		if (nFrameNo >= 0 && nFrameNo < GetFrameCount())
+		{
+			//nFrameNo= nFrameNo%GetFrameCount();
+			nFrameNo= nFrameNo%TEMP_GRAB_NUM;
+
+			//lpBuffer= m_pData+ GetFrameSize()*nFrameNo;
+			m_pSapBuffers->GetAddress(nFrameNo, (void**)&lpBuffer);
+			//lpBuffer= m_pData+ nFrameNo*GetFrameWidth()*GetFrameHeight();
+		}
+		else
+			lpBuffer = NULL;
+	}
+
+	return lpBuffer;
+	*/
+}
+
+void CSapLineGrab::SimulationGrab(int iScan)
+{
+	if(m_pFrameBuffer == NULL)
+		return;
+
+	int			nFrameCnt = m_pFrameBuffer->GetFrameCount();
+
+	m_nEndFrameIdx = nFrameCnt;
+	m_nSetBufferIdx = nFrameCnt -1;
+
+	for(int i=0;i<nFrameCnt;i++)
+	{
+		SetInsertFrame(iScan,i);
+	}
+}
+
+BOOL CSapLineGrab::SetInsertFrame(int iScan,int iFrame)
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+
+	stFrameIndex		stFrame(iScan,iFrame);
+	m_dqCallbackFrame.push_back(stFrame);
+	MyLock.Unlock();
+
+	return TRUE;
+}
+
+int CSapLineGrab::GetGrabFrameCount()
+{
+	return (int)m_dqCallbackFrame.size();
+}
+
+void CSapLineGrab::ClearGrabIdx()
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	m_dqCallbackFrame.clear();
+	MyLock.Unlock();
+}
+
+BOOL CSapLineGrab::IsHasGrabFrame()
+{
+	return !m_dqCallbackFrame.empty();
+}
+
+BOOL CSapLineGrab::FindGrabIdx(int iScan,int iFrame)
+{
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+
+	BOOL				bRet = FALSE;
+	stFrameIndex		stFrame;
+	for(dqGrabIdxIt it=m_dqCallbackFrame.begin();it!=m_dqCallbackFrame.end();it++)
+	{
+		stFrame = *it;
+
+		if(stFrame.nScanIdx == iScan)
+		{
+			if(stFrame.nFrameIdx < iFrame)
+				bRet = TRUE;
+		}
+	}
+	MyLock.Unlock();
+
+	return bRet;
+}
+
+stFrameIndex CSapLineGrab::GetGrabFrameNoRemove()
+{
+	stFrameIndex stPop(-1, -1);	
+
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	if(IsHasGrabFrame() == FALSE)
+	{
+		MyLock.Unlock();
+		return stPop;
+	}
+
+	stPop = m_dqCallbackFrame.front();	
+
+	TRACE("Pop Frame Lock[%d]\r\n", stPop.nFrameIdx);
+	MyLock.Unlock();
+	return stPop;
+}
+
+stFrameIndex CSapLineGrab::GetGrabFrame()
+{
+	stFrameIndex stPop(-1, -1);	
+
+	CSingleLock MyLock(&m_csIdxLock);
+	MyLock.Lock();
+	if(IsHasGrabFrame() == FALSE)
+	{
+		MyLock.Unlock();
+		return stPop;
+	}
+
+	stPop = m_dqCallbackFrame.front();
+	m_dqCallbackFrame.pop_front();
+
+	TRACE("Pop Frame Lock[%d]\r\n", stPop.nFrameIdx);
+	MyLock.Unlock();
+	return stPop;
+}
+
+////////////// Acquisition..
+
+BOOL CSapLineGrab::GrabScanStop()
+{
+	BOOL bRet = TRUE;
+
+	BOOL bGrabbing = FALSE;
+	if (m_pXfer==NULL) return FALSE;
+
+	bGrabbing = m_pXfer->IsGrabbing();
+
+	if (bGrabbing == FALSE)
+	{
+		// Snap 疙飞捞 吭栏唱 Callback 窃荐啊 龋免登瘤 臼篮  版快 Abort() 龋免 -> Callback 窃荐啊 龋免登瘤 臼栏搁 Freeze()肺绰 Snap 辆丰啊 救等促.
+		g_pLog->DisplayMessage(_T("Stop Acq Case 1-1 Not Grabbing"));
+		if(m_bSnapStart == TRUE && m_bXferCall == FALSE)
+		{
+			//g_pLog->DisplayMessage(TRUE, "Stop Acq Case 1-2");
+			bRet= m_pXfer->Abort();
+		}
+		else 
+		{
+			bRet = FALSE;
+			//g_pLog->DisplayMessage(TRUE, "Stop Acq Case 1-3");
+		}
+	}
+	else
+	{
+		// Callback 窃荐啊 龋免等 版快绰 Freeze() 龋免
+		//g_pLog->DisplayMessage(TRUE, "Stop Acq Case 2-1");
+		if(m_bXferCall)
+		{
+			//g_pLog->DisplayMessage(TRUE, "Stop Acq Case 2-2");
+			bRet = m_pXfer->Freeze();
+			if(! m_pXfer->Wait(10))
+			{
+				g_pLog->DisplayMessage(_T("WAIT FAIL"));
+
+				bRet= m_pXfer->Abort();
+
+				if(bRet)
+				{
+					g_pLog->DisplayMessage(_T("Abort SUC"));
+				}else
+					g_pLog->DisplayMessage(_T("Abort Fail"));
+			}else
+			{
+				g_pLog->DisplayMessage(_T("WAIT SUCC"));
+			}
+			//bRet = m_pXfer->Abort();
+			//Sleep(200);
+		}
+		else
+		{
+			//g_pLog->DisplayMessage(TRUE, "Stop Acq Case 2-3");
+			bRet= m_pXfer->Abort();
+		}
+	}
+
+	m_bSnapStart = FALSE;
+
+	return bRet;
+}
+
+BOOL CSapLineGrab::GrabLiveStart(int nExposure)
+{
+	if (IsGrabbing())
+	{
+		g_pLog->DisplayMessage(_T("Start Live Acq : IsGrabbing -> Stop Acq %d"), m_nEndFrameIdx);
+		GrabScanStop();
+		Sleep(100);				
+	}
+
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	m_nSetBufferIdx = -1;
+	m_nScanIndex = 0;	
+	m_bGrabLive = TRUE;
+
+	int nFrameCount = m_Param.nGrabBufCount / m_Param.nGrabBufSize;
+	if (m_Param.nGrabBufCount % m_Param.nGrabBufSize > 0)
+		nFrameCount++;
+	nFrameCount += 4;
+
+	m_pSapAcq->SetParameter(CORACQ_PRM_EXT_TRIGGER_FRAME_COUNT, nFrameCount);
+	BOOL b= m_pXfer->Grab();
+
+	g_pLog->DisplayMessage(_T("Start Live Acq - %d,%d"),b,nFrameCount);
+
+	return TRUE;
+}
+
+BOOL CSapLineGrab::GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure, BOOL bAuto)
+{
+	if (m_pXfer->IsGrabbing())
+	{
+		g_pLog->DisplayMessage(_T("Start Acq : IsGrabbing -> Stop Acq %d"), m_nEndFrameIdx);
+		GrabScanStop();
+		Sleep(100);
+	}
+	ClearBuffer();
+
+	m_pSapBuffers->ResetIndex();
+
+	m_nStartFrameIdx = 0;
+	m_nEndFrameIdx = 0;
+	g_pLog->DisplayMessage(_T("Start Acq : %d"), iScan);
+
+	m_bGrabLive = FALSE;
+	m_cxferCall= 0;
+	m_nSetBufferIdx = -1;
+	m_bXferCall = FALSE;
+	m_nScanIndex = iScan;
+
+	int nFrameCount = m_pFrameBuffer->GetFrameCount()+ 4;
+
+	if(bAuto == TRUE)
+	{
+		if (bFreeRun == FALSE)
+		{
+			m_pSapAcq->SetParameter(CORACQ_PRM_EXT_FRAME_TRIGGER_ENABLE, FALSE);
+			m_pSapAcq->SetParameter(CORACQ_PRM_EXT_TRIGGER_FRAME_COUNT, nFrameCount);
+		}
+		else
+		{
+			m_pSapAcq->SetParameter(CORACQ_PRM_EXT_FRAME_TRIGGER_ENABLE, FALSE);
+			m_pSapAcq->SetParameter(CORACQ_PRM_EXT_TRIGGER_FRAME_COUNT, nFrameCount);
+		}
+
+		BOOL b= m_pXfer->Grab();
+	}
+	else
+	{
+		SimulationGrab(iScan);
+	}
+	
+	return TRUE;
+}
+
+int CSapLineGrab::IsAcqFrame(int nFrameNo, int nThreadIdx)
+{
+	return m_nSetBufferIdx - nFrameNo;	
+}
+
+LPBYTE CSapLineGrab::GetFrameHeader(int iScan,int nFrameNo, BOOL* bRet)
+{		
+	if(m_pFrameBuffer == NULL)
+		return NULL;
+
+	return m_pFrameBuffer->GetFrameBuferHeader(iScan,nFrameNo);
+}
+
+LPBYTE	CSapLineGrab::GetFrameHeaderLine(int iScan,int nLine, BOOL* bSuccess)
+{	
+	if(m_pFrameBuffer == NULL)
+		return NULL;
+
+	return m_pFrameBuffer->GetFrameHeaderLine(iScan,nLine);
+}
+
+BOOL CSapLineGrab::GetSmallImage(int iScan,LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping) 
+{
+	int nBufSizeX = m_Param.nFrameWidth;
+	int nBufSizeY = m_Param.nFrameHeight;
+
+	if(lpIn == NULL)
+		return FALSE;
+	if (nXStart < 0 || nYStart < 0)
+		return FALSE;
+	if (nXStart + nXSize > nBufSizeX)
+		return FALSE;
+	if (nYStart + nYSize > nBufSizeY* GetEndFrameIdx())
+		return FALSE;
+
+	LPBYTE	lpHeadAddr = GetFrameHeaderLine(iScan,nYStart);
+	if (!lpHeadAddr)
+	{
+		return FALSE;
+	}
+
+	for (int i = 0; i < nYSize; i++)
+	{
+		memcpy(lpIn + i * nXSize, lpHeadAddr + i * nBufSizeX + nXStart, nXSize);
+	}
+
+	/*
+	// 矫累 橇饭烙 锅龋客 场 橇饭烙 锅龋.
+	int nStartFrameNo = nYStart / nBufSizeY;
+	int nEndFrameNo = (nYStart + nYSize) / nBufSizeY;
+	LPBYTE	lpHeadAddr = GetFrameHeader(iScan,nStartFrameNo);
+	if (!lpHeadAddr)
+	{
+		return FALSE;
+	}
+	LPBYTE lpStart = lpHeadAddr + (nYStart % nBufSizeY) * nBufSizeX + nXStart;
+
+	int nLine = 0;
+	for (int i = 0; i < nYSize; i++)
+	{
+		memcpy(lpIn + i * nXSize, lpStart + nLine * nBufSizeX, nXSize);
+		if (nStartFrameNo <= nEndFrameNo && (nYStart + i + 1) % nBufSizeY  == 0)
+		{
+			// 捞固瘤甫 蝶郴具窍绰 康开捞 MemFrameNo 版拌俊 吧媚乐绰 版快 贸府.
+			lpHeadAddr = GetFrameHeader(iScan,++nStartFrameNo);
+			lpStart = lpHeadAddr + nXStart;
+			nLine = 0;
+		}
+		else
+			nLine++;
+	}
+	*/
+
+	return TRUE;
+}
+
+CORSTATUS CSapLineGrab::DisplayStatus( char *functionName, CORSTATUS status)
+{
+	char statusMsg[ 256];
+	CORSTATUS msgStatus = CORSTATUS_OK;
+
+	if( status != CORSTATUS_OK)
+	{
+		msgStatus = CorManGetStatusText( status, statusMsg, 256, NULL, 0);
+		if( msgStatus == CORSTATUS_OK)
+		{
+			g_pLog->DisplayMessage(_T("1Error: Function [%s] (module= 0x%lX status= 0x%lX info= 0x%lX) <%s>"),functionName, CORSTATUS_MODULE( status), CORSTATUS_ID( status), CORSTATUS_INFO( status), statusMsg);			
+		}
+		else
+		{
+			g_pLog->DisplayMessage(_T("2Error: Function [%s] (module= 0x%lX status= 0x%lX info= 0x%lX)"),functionName, CORSTATUS_MODULE( status), CORSTATUS_ID( status), CORSTATUS_INFO( status));			
+		}
+
+		return status;
+	}
+
+	return( status);
+}
+BOOL CSapLineGrab::SetScanDirection(unsigned int nDirection)
+{
+//	unsigned int dir;
+//	CorAcqGetCamIoControl(m_pSapAcq->GetHandle(), "CC3", &dir); 
+//	if(dir != nDirection)
+	{
+		DisplayStatus("CorAcqSetCamIoControl", CorAcqSetCamIoControl(m_pSapAcq->GetHandle(), "CC3", nDirection));
+//		return FALSE;
+	}
+
+	//DisplayStatus("CorBufferFree", CorBufferFree(m_hBuffer[i]))
+	return TRUE;
+}
+
+void CSapLineGrab::WiatXfer(int tMS)
+{
+	m_pXfer->Wait(tMS);
+}
\ No newline at end of file
diff --git a/ENRIT/Grabber/SapLineGrab.h b/ENRIT/Grabber/SapLineGrab.h
new file mode 100644
index 0000000..e7964e6
--- /dev/null
+++ b/ENRIT/Grabber/SapLineGrab.h
@@ -0,0 +1,89 @@
+#pragma once
+
+#include "StdAfx.h"
+#include "sapclassbasic.h"
+#include "Global_Define.h"
+
+#define ACQ_NO_IMAGE -10000
+
+#define		UM_IMAGE_GRAB		(WM_USER + 1000)
+
+class CFrameBufferController;
+class CSapLineGrab : public CGrabberControl
+{
+public:
+	CSapLineGrab(void);
+	virtual ~CSapLineGrab(void);
+
+public:
+	virtual BOOL	Initialize(void *pParam, int *pErrorCode,int iBoard=0);	// Grabber 檬扁拳
+	virtual BOOL	InitializeBuffer(void *pParam);	
+	virtual BOOL	Deinitialize();
+	virtual BOOL	GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure=10, BOOL bAuto=TRUE);
+	virtual BOOL	GrabLiveStart(int nExposure=15);
+	virtual BOOL	GrabScanStop();
+	virtual BOOL	IsGrabbing();
+	virtual int		IsAcqFrame(int nFrameNo, int nThreadIdx = -1);	// Return 0 - 酒流 救嘛澜, Return -1 - 瘤况, Return 1 -  沥惑
+	virtual LPBYTE	GetFrameHeader(int iScan,int nFrameNo, BOOL* bSuccess = NULL);
+	virtual LPBYTE	GetFrameHeaderLine(int iScan,int nLine, BOOL* bSuccess = NULL);
+	virtual BOOL	GetSmallImage(int iScan,LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping = TRUE);	
+	virtual int		GetStartFrameIdx()		{ return m_nStartFrameIdx; }
+	virtual int		GetEndFrameIdx()		{ return m_nEndFrameIdx; }
+	virtual void	SetSimulFrame(int nFrame){;}
+	virtual int		GetGrabFrameCount();
+	virtual void	ClearGrabIdx();
+	virtual stFrameIndex	GetGrabFrame();
+	virtual stFrameIndex	GetGrabFrameNoRemove();
+	virtual CFrameBufferController	*GetFrameBuffer(){return m_pFrameBuffer;}
+	virtual BOOL	SetTriggerMode( BOOL bExTrigger ){return TRUE;}
+
+	BOOL			CreateGrabBuffer(int nScanCount,int nBufSize, int nBufSizeX, int nBufSizeY);
+	void			SimulationGrab(int iScan);
+	BOOL			SetInsertFrame(int iScan,int iFrame);
+	BOOL			IsHasGrabFrame();
+	BOOL			FindGrabIdx(int iScan,int iFrame);
+
+	// Main Function.		
+	BOOL	CreateAcq(char *file);
+	BOOL	CreateObjects();
+	BOOL	ActivateObjects();	// Each sap object calls it'w own create() function.
+	void	DestroyObjects();
+	void	DeleteObjects();
+		
+	// Acquisition Related.		
+	void	WiatXfer(int tMS);	
+	BOOL	SetScanDirection(unsigned int nDirection);
+	void	My_XferCallback(SapXferCallbackInfo *pInfo);
+	
+	// Buffer Handing.
+	BOOL	CreateBuffer(UINT32 uiType);
+	BOOL	ClearBuffer();	
+
+	LPBYTE	GetGrabFrameHeader(int nFrameNo, BOOL* bSuccess = NULL);
+	BOOL	SetFrameImage(int nFrameNo, int nStartX, int nStartY, int nWidth, int nHeight, LPBYTE lpBuffer);	
+
+	CORSTATUS DisplayStatus( char *functionName, CORSTATUS status);
+
+public:
+	CFrameBufferController	*m_pFrameBuffer;
+
+protected:
+	SapAcquisition	*m_pSapAcq;
+	SapBuffer		*m_pSapBuffers;
+	SapTransfer		*m_pXfer;
+	SapView			*View;
+	int				m_nGrabFrameNo;		// 矫累急苞 八荤且 橇饭烙 荐俊辑 拌魂等 角力 嘛绰 橇饭烙 荐.
+	_GRABBER_INIT_PARAM_	m_Param;
+	int				m_nBoardID;
+	int				m_nAllocatedGrabBufSize;
+	int				m_cxferCall;		// Xfercallback捞 龋免等 墨款飘.
+	int				m_nScanIndex;
+	dqGrabIdx			m_dqCallbackFrame;
+	CCriticalSection	m_csIdxLock;
+	BOOL			m_bGrabLive;
+	// Buffer Accessing.
+	int		m_nStartFrameIdx, m_nEndFrameIdx;
+	int		m_nSetBufferIdx;
+	BOOL	m_bXferCall;
+	BOOL	m_bSnapStart;
+};
diff --git a/ENRIT/IncludeSDK.h b/ENRIT/IncludeSDK.h
new file mode 100644
index 0000000..9c706a5
--- /dev/null
+++ b/ENRIT/IncludeSDK.h
@@ -0,0 +1,215 @@
+#ifndef INCLUDE_SDK_H
+#define INCLUDE_SDK_H
+
+#define HALCON_VISION_KEY 1
+
+//0. Opencv
+#if _DEBUG
+#pragma comment(lib, "../Lib/OpenCV/opencv_3.1/lib/opencv_core310d.lib")
+#pragma comment(lib, "../Lib/OpenCV/opencv_3.1/lib/opencv_highgui310d.lib")
+#pragma comment(lib, "../Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310d.lib")
+#pragma comment(lib, "../Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310d.lib")
+#else
+#pragma comment(lib, "../Lib/OpenCV/opencv_3.1/lib/opencv_core310.lib")
+#pragma comment(lib, "../Lib/OpenCV/opencv_3.1/lib/opencv_highgui310.lib")
+#pragma comment(lib, "../Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib")
+#pragma comment(lib, "../Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib")
+#endif
+
+//1. Log
+#include "../Lib/LogSDK/include/ILogger.h"
+#include "../Lib/LogSDK/include/LogLib.h"
+#ifdef _DEBUG
+#pragma comment(lib, "../Lib/LogSDK/lib/x64/Debug/Log.lib")
+#else
+#pragma comment(lib, "../Lib/LogSDK/lib/x64/Release/Log.lib")
+#endif
+
+//2. ImageBuffer
+#include "../Lib/CHImageBuffer/include/ImageBuffer.h"
+#include "../Lib/CHImageBuffer/include/ImageViewer.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/CHImageBuffer/lib/x64/Debug/CHImageBufferD.lib")
+#else
+#pragma comment (lib, "../Lib/CHImageBuffer/lib/x64/Release/CHImageBuffer.lib")
+#endif
+
+//3. 加载CHThreadPool
+#include "../Lib/CHThreadPool/include/ThreadPool.h"
+#include "../Lib/CHThreadPool/include/TimerThreadPool.h"
+#include "../Lib/CHThreadPool/include/ThreadData.h"
+#include "../Lib/CHThreadPool/include/WaitThreadPool.h"
+#include "../Lib/CHThreadPool/include/WorkThreadArray.h"
+#include "../Lib/CHThreadPool/include/WorkThreadPool.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/CHThreadPool/lib/x64/Debug/CHThreadPoolD.lib")
+#else
+#pragma comment (lib, "../Lib/CHThreadPool/lib/x64/Release/CHThreadPool.lib")
+#endif
+
+//4. ConfigFileManager
+#include "../Lib/ConfigFileManager/include/BasedConfig.h"
+#include "../Lib/ConfigFileManager/include/Config.h"
+#include "../Lib/ConfigFileManager/include/FileIOInterface.h"
+#include "../Lib/ConfigFileManager/include/FileVersionManager.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/ConfigFileManager/lib/x64/Debug/ConfigFileManagerD.lib")
+#else
+#pragma comment (lib, "../Lib/ConfigFileManager/lib/x64/Release/ConfigFileManager.lib")
+#endif
+
+//5. SISBuffer
+#include "../Lib/SISBuffer/include/Broadcast.h"
+#include "../Lib/SISBuffer/include/InspectionBuffer.h"
+#include "../Lib/SISBuffer/include/NoiseLevel.h"
+#include "../Lib/SISBuffer/include/SISMatch.h"
+#include "../Lib/SISBuffer/include/SISMath.h"
+#include "../Lib/SISBuffer/include/SISPitch.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/SISBuffer/lib/x64/Debug/SISBufferD.lib")
+#else
+#pragma comment (lib, "../Lib/SISBuffer/lib/x64/Release/SISBuffer.lib")
+#endif
+
+//6. EdgeInspect
+#include "../Lib/EdgeInspect/include/BLOB_Tool.h"
+#include "../Lib/EdgeInspect/include/EDGE_DIPM.h"
+#include "../Lib/EdgeInspect/include/ChamferInspect.h"
+#include "../Lib/EdgeInspect/include/CornerCut.h"
+#include "../Lib/EdgeInspect/include/EdgeFind.h"
+#include "../Lib/EdgeInspect/include/EdgeProc.h"
+#include "../Lib/EdgeInspect/include/NotchCut.h"
+#include "../Lib/EdgeInspect/include/ProfileCADProc.h"
+#include "../Lib/EdgeInspect/include/RANSAC_LineFittingAlgorithm.h"
+#include "../Lib/EdgeInspect/include/SISEdgeFind.h"
+#include "../Lib/EdgeInspect/include/SplineInspect.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/EdgeInspect/lib/x64/Debug/EdgeInspectD.lib")
+#else
+#pragma comment (lib, "../Lib/EdgeInspect/lib/x64/Release/EdgeInspect.lib")
+#endif
+
+//7. ShareMemoryDll
+#include "../Lib/SharedMapDll/include/LogManager.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/SharedMapDll/lib/x64/Debug/SharedMapDllD.lib")
+#else
+#pragma comment (lib, "../Lib/SharedMapDll/lib/x64/Release/SharedMapDll.lib")
+#endif
+
+
+//8. SISAssem
+#include "../Lib/SISAssem/include/ASGInspection.h"
+#include "../Lib/SISAssem/include/AssemDefect.h"
+#include "../Lib/SISAssem/include/AssemParam.h"
+#include "../Lib/SISAssem/include/AssemUtil.h"
+#include "../Lib/SISAssem/include/BlobStorage.h"
+#include "../Lib/SISAssem/include/Pad.h"
+#include "../Lib/SISAssem/include/PairStorage.h"
+#include "../Lib/SISAssem/include/PixelStorage.h"
+#include "../Lib/SISAssem/include/SISAssem.h"
+#include "../Lib/SISAssem/include/SISStrg.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/SISAssem/lib/x64/Debug/SISAssemD.lib")
+#else
+#pragma comment (lib, "../Lib/SISAssem/lib/x64/Release/SISAssem.lib")
+#endif
+
+//9.  SISControl
+#include "../Lib/SISControls/include/CellCtrl.h"
+#include "../Lib/SISControls/include/ColorButton.h"
+#include "../Lib/SISControls/include/DefectMap.h"
+#include "../Lib/SISControls/include/FontStatic.h"
+#include "../Lib/SISControls/include/GradientStatic.h"
+#include "../Lib/SISControls/include/HeadCtrl.h"
+#include "../Lib/SISControls/include/InPlaceComboBox.h"
+#include "../Lib/SISControls/include/InPlaceEdit.h"
+#include "../Lib/SISControls/include/LogCtrl.h"
+#include "../Lib/SISControls/include/SISButton.h"
+#include "../Lib/SISControls/include/SISFolderScheduling.h"
+#include "../Lib/SISControls/include/SISJogBtn2Parent.h"
+#include "../Lib/SISControls/include/SISJogButton.h"
+#include "../Lib/SISControls/include/SISLabel.h"
+#include "../Lib/SISControls/include/SISListBoxLog.h"
+#include "../Lib/SISControls/include/SISListCtrlExt.h"
+#include "../Lib/SISControls/include/SortClass.h"
+#include "../Lib/SISControls/include/StaticMap.h"
+#include "../Lib/SISControls/include/WKButton.h"
+#include "../Lib/SISControls/include/XTabCtrl.h"
+#include "../Lib/SISControls/GridControl/CellRange.h"
+#include "../Lib/SISControls/GridControl/GridCell.h"
+#include "../Lib/SISControls/GridControl/GridCellBase.h"
+#include "../Lib/SISControls/GridControl/GridCellButton.h"
+#include "../Lib/SISControls/GridControl/GridCtrl.h"
+#include "../Lib/SISControls/GridControl/GridDropTarget.h"
+#include "../Lib/SISControls/GridControl/GridInPlaceEdit.h"
+#include "../Lib/SISControls/GridControl/GridMemDC.h"
+#include "../Lib/SISControls/GridControl/TitleTip.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellCheck.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellCombo.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridURLCell.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/SISControls/lib/x64/Debug/SISControlsD.lib")
+#else
+#pragma comment (lib, "../Lib/SISControls/lib/x64/Release/SISControls.lib")
+#endif
+
+//10. MultiCam
+#if _DEBUG
+#pragma comment (lib, "../Lib/EuresysCam/Lib/amd64/MultiCam.lib")
+#else
+#pragma comment (lib, "../Lib/EuresysCam/Lib/amd64/MultiCam.lib")
+#endif
+
+//11. Free Image
+#if _DEBUG
+#pragma comment (lib, "../Lib/FreeImage/lib/FreeImage.lib")
+#else
+#pragma comment (lib, "../Lib/FreeImage/lib/FreeImage.lib")
+#endif
+
+//12. 采集模块
+#include "../Lib/BlGrabber/include/FrameBufferController.h"
+#include "../Lib/BlGrabber/include/GrabberControl.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/BlGrabber/lib/x64/Debug/BlGrabberD.lib")
+#else
+#pragma comment (lib, "../Lib/BlGrabber/lib/x64/Release/BlGrabber.lib")
+#endif
+
+//13. 日志模块
+#include "../Lib/LogSDK/include/ILogger.h"
+#include "../Lib/LogSDK/include/LogLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/LogSDK/lib/x64/Debug/Log.lib")
+#else
+#pragma comment(lib,"../Lib/LogSDK/lib/x64/Release/Log.lib")
+#endif
+
+//14. 显示模块
+#include "../Lib/BaseDisplaySDK/include/typesdef.h"
+#include "../Lib/BaseDisplaySDK/include/BaseVision.h"
+#include "../Lib/BaseDisplaySDK/include/IClsShape.h"
+#include "../Lib/BaseDisplaySDK/include/IImageDisplay.h"
+#include "../Lib/BaseDisplaySDK/include/BaseDisplayLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/BaseDisplaySDK/lib/x64/Debug/BaseDisplay.lib")
+#else
+#pragma comment(lib,"../Lib/BaseDisplaySDK/lib/x64/Release/BaseDisplay.lib")
+#endif
+
+#if HALCON_VISION_KEY
+//15. 视觉处理模块
+#include "../Lib/BlVisionPro/include/IVisionRecipe.h"
+#include "../Lib/BlVisionPro/include/ISoftVisionApp.h"
+#include "../Lib/BlVisionPro/include/BlVisionLib.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/BlVisionPro/lib/x64/Debug/BlVisionProD.lib")
+#else
+#pragma comment (lib, "../Lib/BlVisionPro/lib/x64/Release/BlVisionPro.lib")
+#endif
+#endif
+
+#endif
diff --git a/ENRIT/InterfaceManager.cpp b/ENRIT/InterfaceManager.cpp
new file mode 100644
index 0000000..18bd626
--- /dev/null
+++ b/ENRIT/InterfaceManager.cpp
@@ -0,0 +1,2391 @@
+#include "StdAfx.h"
+#include "InterfaceManager.h"
+#include "MulticamControl.h"
+#include "RadientControl.h"
+#include "SapControl.h"
+#include "SapLineGrab.h"
+#include "FreeImage.h"
+#include <io.h>
+#include "ExpireDayDefine.h"
+
+//#define TEST_SIGNAL_PROCESS
+
+#define OFFSET_SPLINE_DATA	10
+#define JPEG_RATE					JPEG_QUALITYNORMAL|JPEG_OPTIMIZE
+#define JPEG_FULLIMAGE_RATE			JPEG_QUALITYGOOD|JPEG_OPTIMIZE
+
+CInterfaceManager::CInterfaceManager(void)
+{
+	m_pLogManager = new CLogManager(0,_T("LOGVIEW"));
+	m_pView = NULL;
+	m_bPLCGlassLoading = FALSE;
+	m_pControlInterface = NULL;	
+	m_pTransDataManager = NULL;	
+	m_pLightManager = NULL;
+	m_pTriggerBoardControl = NULL;
+
+	for(int i=0;i<MAX_CAMERA_COUNT;i++)
+	{
+		m_pInspect[i] = NULL;
+		m_pGrabber[i] = NULL;
+	}
+
+	m_pThread_SendMSG = NULL;
+	m_pThread_CheckSequence = NULL;
+	m_pThread_ViewRefresh = NULL;
+	m_nScanStartCount = 0;
+	m_bGlassLoadingEnd = FALSE;
+}
+
+CInterfaceManager::~CInterfaceManager(void)
+{	
+	DeleteProfileData();	
+
+	for(int i=0;i<MAX_CAMERA_COUNT;i++)
+	{
+		if(m_pInspect[i] != NULL)
+		{
+			m_pInspect[i]->SetProcessEnd();
+			Sleep(100);
+			m_pInspect[i]->ReleaseThread();
+			delete m_pInspect[i];
+		}
+		m_pInspect[i] = NULL;		
+	}
+
+	DeinitGrabber();
+
+	if(m_pTransDataManager != NULL)
+		delete m_pTransDataManager;
+	m_pTransDataManager = NULL;
+
+	if(m_pControlInterface != NULL)			
+		delete m_pControlInterface;	
+	m_pControlInterface = NULL;	
+
+	if(m_pLightManager != NULL)
+		delete m_pLightManager;
+	m_pLightManager = NULL;
+
+	if(m_pLogManager != NULL)
+		delete m_pLogManager;
+	m_pLogManager=NULL;
+
+	if(m_pTriggerBoardControl != NULL)
+		delete m_pTriggerBoardControl;
+	m_pTriggerBoardControl=NULL;
+
+	if(m_pLicense != NULL)
+		delete m_pLicense;
+	m_pLicense = NULL;
+}
+
+BOOL CInterfaceManager::DestroyThread()
+{
+	if(m_pThread_SendMSG != NULL)
+	{
+		m_pThread_SendMSG->StopThread();
+		delete m_pThread_SendMSG;	
+	}
+	m_pThread_SendMSG = NULL;		
+
+	if(m_pThread_CheckSequence != NULL)
+	{
+		m_pThread_CheckSequence->StopThread();
+		delete m_pThread_CheckSequence;
+	}
+	m_pThread_CheckSequence = NULL;
+
+	if(m_pThread_ViewRefresh != NULL)
+	{
+		m_pThread_ViewRefresh->StopThread();
+		delete m_pThread_ViewRefresh;
+	}
+	m_pThread_ViewRefresh = NULL;	
+
+	/*
+	if(m_pThread_NetMSG != NULL)		
+	{
+		m_pThread_NetMSG->StopThread();
+		delete m_pThread_NetMSG;
+	}
+	m_pThread_NetMSG = NULL;
+
+		
+
+	if(m_pThread_Light != NULL)
+	{
+		m_pThread_Light->StopThread();
+		delete m_pThread_Light;	
+	}
+	m_pThread_Light = NULL;			
+	*/
+
+	return TRUE;
+}
+
+UINT CInterfaceManager::PLCSignalThreadFunc(LPVOID pParam)
+{
+	CInterfaceManager		*pInter = (CInterfaceManager*)pParam;
+
+	pInter->PLCSignalRetry(pInter->m_emPLCSection,pInter->m_emPLCSendSignal,pInter->m_emPLCControlSignal);
+
+	return 0;
+}
+
+// End Signal阑 PLC俊辑 肋 给罐酒辑 Retry 持菌澜
+void CInterfaceManager::PLCSignalRetry(SEND_MESSAGE_SECTION emSection,InspectToControlSignal emSendSignal,enInterface_Send_Control emControlSignal)
+{
+	if(m_HardwareRecipe.m_nPLCSignalRetry <= 0)
+		return;
+
+	switch(emSendSignal)
+	{
+	case IToC_Ack_LoadingSuccess:
+	case IToC_Ack_ShortScanEndSuccess:
+	case IToC_Ack_ShortScanEndFail:				
+	case IToC_Ack_LongScanEndSuccess:	
+	case IToC_Ack_LongScanEndFail:			
+		break;
+	default:
+		return;
+	}		
+
+	int		nRetryCount = m_HardwareRecipe.m_nPLCSignalRetry;
+	int		nSignalOnTime = 300;//((CPLCControl_Interface_B5*) m_pControlInterface)->GetSignalOnTime(emSendSignal);
+
+	DWORD	dwTick = GetTickCount();
+	DWORD	dwWaitTick;
+	DWORD	dwWaitTime = nSignalOnTime+200;	
+	int		nCount = 0;	
+	BOOL	bSendSignal = FALSE;
+
+	while(TRUE)
+	{
+		dwWaitTick = GetTickCount() - dwTick;
+		if(dwWaitTime < dwWaitTick)
+		{						
+			nCount++;
+			bSendSignal = FALSE;
+			dwTick = GetTickCount();			
+		}
+
+		switch(emSendSignal)
+		{
+		case IToC_Ack_LoadingSuccess:
+			break;
+		case IToC_Ack_ShortScanEndSuccess:
+		case IToC_Ack_ShortScanEndFail:		
+			if(m_bPLCGlassLoading == TRUE)
+			{
+				g_pLog->DisplayMessage(_T("Ack Short PLC End : Rcv GlassLoading PLC Signal %d"),m_bPLCGlassLoading);
+				return;
+			}
+			break;
+		case IToC_Ack_LongScanEndSuccess:	
+		case IToC_Ack_LongScanEndFail:	
+			if(m_bShortPLCScanStart == TRUE)
+			{
+				g_pLog->DisplayMessage(_T("Ack Long PLC End : Rcv Short Start PLC Signal %d"),m_bShortPLCScanStart);
+				return;
+			}
+			break;
+		default:
+			return;
+		}		
+
+		if(bSendSignal == FALSE)
+		{
+			int nRet = m_pControlInterface->SendConstrol(emControlSignal,TRUE);		
+			g_pLog->DisplayMessage(_T("PLC Retry_ON[%d] Send Control Signal : Sig %d, Val %d, Ret %d"),nCount,(int)emControlSignal,TRUE,nRet);
+
+			Sleep(nSignalOnTime);
+
+			nRet = m_pControlInterface->SendConstrol(emControlSignal,FALSE);
+			g_pLog->DisplayMessage(_T("PLC Retry_OFF[%d] Send Control Signal : Sig %d, Val %d, Ret %d"),nCount,(int)emControlSignal,TRUE,nRet);
+
+			bSendSignal = TRUE;
+		}	
+
+		if(nCount >= nRetryCount)
+			break;
+
+		g_pLog->DisplayMessage(_T("PLC Retry_Down Check loop"));
+
+		Sleep(1);
+	}	
+}
+
+void CInterfaceManager::SendMsgInspectToControlSignal(CPostSendMessage *pNetMSG)
+{
+	InspectToControlSignal emSendSignal = static_cast<InspectToControlSignal>(pNetMSG->nSignal);	
+	int		nValue = pNetMSG->nValue;
+	CString	str;
+	enInterface_Send_Control	emControlSignal = enInterface_None;
+
+	if(nValue == TRUE)
+		str = _T("On");
+	else
+		str = _T("Off");
+
+	switch(emSendSignal)
+	{
+	case IToC_Ack_LoadingSuccess:
+	case IToC_Ack_LoadingFail:
+		g_pLog->DisplayMessage(_T("Send Control Signal : Ack Signal Glass Loading %s"),(TCHAR*)(LPCTSTR)str);
+
+		emControlSignal = GLASSLOADING_HANDSHAKE;
+		break;	
+	case IToC_Ack_ShortScanStartSuccess:
+	case IToC_Ack_ShortScanStartFail:	
+		emControlSignal = SHORT_SCANSTART_HANDSHAKE;
+		g_pLog->DisplayMessage(_T("Send Control Signal : Ack Signal Short Scan Start %s"),(TCHAR*)(LPCTSTR)str);	
+		break;
+	case IToC_Ack_ShortScanEndSuccess:
+	case IToC_Ack_ShortScanEndFail:		
+#ifdef			TEST_SIGNAL_PROCESS
+		Sleep(2000);
+#endif
+		emControlSignal = SHORT_SCANEND_HANDSHAKE;
+		g_pLog->DisplayMessage(_T("Send Control Signal : Ack Signal Short Scan End %s"),(TCHAR*)(LPCTSTR)str);
+		break;
+	case IToC_Ack_LongScanStartSuccess:
+	case IToC_Ack_LongScanStartFail:	
+		emControlSignal = LONG_SCANSTART_HANDSHAKE;
+		g_pLog->DisplayMessage(_T("Send Control Signal : Ack Signal Long Scan Start %s"),(TCHAR*)(LPCTSTR)str);	
+		break;	
+	case IToC_Ack_LongScanEndSuccess:	
+	case IToC_Ack_LongScanEndFail:	
+#ifdef			TEST_SIGNAL_PROCESS
+		Sleep(2000);
+#endif
+		emControlSignal = LONG_SCANEND_HANDSHAKE;
+		g_pLog->DisplayMessage(_T("Send Control Signal : Ack Signal Long Scan End %s"),(TCHAR*)(LPCTSTR)str);
+		break;			
+	default:
+		return;
+	}	
+
+	WaitEndSignal(emSendSignal);
+
+	if(emControlSignal < enInterface_None)
+	{
+		int nDelayTime = m_pControlInterface->GetSignalDelayTime(pNetMSG->nSignal);
+
+		if(nDelayTime != 0)
+			Sleep(nDelayTime);
+
+		if(m_HardwareRecipe.m_nPLCSignalRetry > 0)
+		{
+			switch(emSendSignal)
+			{
+			case IToC_Ack_LoadingSuccess:
+			case IToC_Ack_ShortScanEndSuccess:
+			case IToC_Ack_ShortScanEndFail:				
+			case IToC_Ack_LongScanEndSuccess:	
+			case IToC_Ack_LongScanEndFail:			
+				{
+					CSingleLock		myLock(&m_csPLCSignal);
+					myLock.Lock();
+					m_emPLCSection = pNetMSG->emSection;
+					m_emPLCSendSignal = emSendSignal;
+					m_emPLCControlSignal = emControlSignal;
+
+					AfxBeginThread(PLCSignalThreadFunc,this);
+					myLock.Unlock();
+					break;
+				}
+			default:
+				{
+					int nRet = m_pControlInterface->SendConstrol(emControlSignal,nValue);		
+					g_pLog->DisplayMessage(_T("Send Control Signal : Sig %d, Val %d, Ret %d"),(int)emControlSignal,nValue,nRet);
+
+					if(nValue == TRUE && m_pThread_SendMSG != NULL)
+					{
+						int nSignalOnTime = m_pControlInterface->GetSignalOnTime(pNetMSG->nSignal);
+
+						m_pThread_SendMSG->AddDisableMSG(pNetMSG->emSection,pNetMSG->nSignal,FALSE,nSignalOnTime);
+						g_pLog->DisplayMessage(_T("Add Disable Msg"));
+					}
+				}
+				break;
+			}
+		}
+		else
+		{
+			int nRet = m_pControlInterface->SendConstrol(emControlSignal,nValue);		
+			g_pLog->DisplayMessage(_T("Send Control Signal : Sig %d, Val %d, Ret %d"),(int)emControlSignal,nValue,nRet);
+
+			if(nValue == TRUE && m_pThread_SendMSG != NULL)
+			{
+				int nSignalOnTime = m_pControlInterface->GetSignalOnTime(pNetMSG->nSignal);
+
+				m_pThread_SendMSG->AddDisableMSG(pNetMSG->emSection,pNetMSG->nSignal,FALSE,nSignalOnTime);
+			}
+		}
+	}
+}
+
+void CInterfaceManager::SendMsgInspectToControlAlarm(CPostSendMessage *pNetMSG)
+{
+	InspectToControlAlarm emSendAlarm = static_cast<InspectToControlAlarm>(pNetMSG->nSignal);	
+	int		nValue = pNetMSG->nValue;	
+
+	enInterface_Send_Control	emControlSignal = enInterface_None;
+
+	switch(emSendAlarm)
+	{
+	case IToC_Alarm_InspectorError:
+
+		break;		
+	case IToC_Alarm_InspectOverflow:			
+
+		break;	
+	case IToC_Alarm_EdgeCrack:			
+		break;	
+	case IToC_Alarm_NoRecipe:	
+
+		break;	
+	case IToC_Alarm_FindEdgeFail:			
+		break;	
+	case IToC_Alarm_LightError:			
+
+		break;
+	case IToC_Alarm_UpperLimit:		
+		break;	
+	case IToC_Alarm_LowestLimit:		
+		break;	
+	case IToC_Alarm_NoImage:			
+		break;
+	case IToC_Alarm_GlassDetectFail:		
+		break;	
+	case IToC_Alarm_TransferData:		
+		break;
+	case IToC_Alarm_InternalValue:		
+		break;	
+	default:
+		return;
+	}	
+
+	if(emControlSignal < enInterface_None)
+	{
+		int nRet = m_pControlInterface->SendConstrol(emControlSignal,nValue);		
+		g_pLog->DisplayMessage(_T("Send Control Alarm : Sig %d, Val %d, Ret %d"),(int)emControlSignal,nValue,nRet);
+	}
+}
+
+void CInterfaceManager::SendMSG_Received(CPostSendMessage *pSendMSG)
+{
+	if(pSendMSG == NULL)
+		return;
+
+	switch(pSendMSG->emSection)
+	{	
+	case SEND_MESSAGE_CONTROLSIGNAL:
+		SendMsgInspectToControlSignal(pSendMSG);
+		break;
+	case SEND_MESSAGE_ALARM:
+		SendMsgInspectToControlAlarm(pSendMSG);				
+		break;	
+	}
+}
+
+void CInterfaceManager::II2S_InspectionEnd(int iCamID,int iScan)
+{
+	if(iCamID < 0 || iCamID >= MAX_CAMERA_COUNT)
+		return;
+	if(iScan < 0 || iScan >= MAX_SCAN_COUNT)
+		return;
+
+	m_GlassData.SetScanEndCamera(iCamID,iScan);
+
+	DimensionDir	eDimension = m_HardwareRecipe.GetCameraSettings(iCamID,iScan)->m_eDimension;
+
+	g_pLog->DisplayMessage( _T("%s Inspection end Count! Scan %d, Cam %d StartCnt %d,End %d"),PANEL_SIDE[eDimension],iScan,iCamID,m_GlassData.GetScanStartCount(),m_GlassData.GetScanEndCameraCount());	
+	
+	if(m_GlassData.GetScanEndCameraCount() == m_GlassData.GetScanStartCount() && m_bPostProcess == FALSE)
+	{
+		m_bPostProcess = TRUE;
+
+		g_pLog->DisplayMessage(_T("%s inspection end complete : Scan %d"),PANEL_SIDE[eDimension], iScan);
+		g_pLog->DisplayMessage( _T("=========================================================="));	
+
+		m_GlassData.SetScanStart(FALSE);
+		for(int i=0;i<MAX_SCAN_COUNT;i++)
+			m_GlassData.SetScanEnd(i,TRUE);
+
+		for(int i=0;i<MAX_CAMERA_COUNT;i++)
+			m_pInspect[i]->SetProcessEnd();
+
+		AfxBeginThread(ScanEndProcess,this);
+	}
+	else if(m_GlassData.GetScanEndCameraCount() == m_GlassData.GetScanStartCount()/2)
+	{
+		g_pLog->DisplayMessage(_T("%s One Scan inspection end complete : Scan %d"),PANEL_SIDE[eDimension], iScan);
+		g_pLog->DisplayMessage( _T("=========================================================="));
+
+		m_GlassData.SetScanEnd(iScan,TRUE);
+	}
+}
+
+UINT CInterfaceManager::ScanEndProcess(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+	
+	g_pLog->DisplayMessage(_T("========= Start Glass Inspection End Processing"));
+	
+	pInter->PostProcess();
+
+	g_pLog->DisplayMessage(_T("========= End Glass Inspection End Processing"));
+	g_pLog->DisplayMessage( _T("=========================================================="));
+
+	return 0;
+}
+
+UINT CInterfaceManager::ScanTimeOut(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	pInter->ScanOverTimeSignal();
+
+	return 0;
+}
+
+void CInterfaceManager::ScanOverTimeSignal()
+{
+	g_pLog->DisplayMessage(_T("Scan Over Time - Post Processing Start"));
+
+	m_GlassData.SetScanStart(FALSE);
+	for(int i=0;i<MAX_SCAN_COUNT;i++)
+		m_GlassData.SetScanEnd(i,TRUE);
+
+	for(int iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+	{		
+		m_pGrabber[iCam]->GrabScanStop();
+		m_pInspect[iCam]->SetProcessEnd();
+	}
+
+	m_pThread_SendMSG->ClearMSG();
+
+	Sleep(500);
+
+	PostProcess();
+}
+
+BOOL CInterfaceManager::PostProcess()
+{
+	g_pLog->DisplayMessage(_T("Start PostProcess()"));
+
+	if(m_pThread_CheckSequence != NULL)
+		m_pThread_CheckSequence->ClearMessage();
+
+	if(m_GlassData.IsPostProcStart() == TRUE)
+	{
+		g_pLog->DisplayMessage(_T("Already Post Processing Start"));
+		return TRUE;
+	}
+
+	m_GlassData.SetPostProc(TRUE);		
+
+	CopyImageBuffer();
+	
+	m_PostProcess.SetPrameter(&m_GlassData,&m_HardwareRecipe,&m_GlassRecipe,g_pStatus->GetInspectOption(),g_pStatus->GetProfileOption(),&m_TransferData,&m_ResultData);
+	m_PostProcess.RunPostProcessing();
+
+	HISTORY_RESULT HisData;
+	HistoryData(m_GlassData.GetJudgeDefectCount(), HisData);
+	m_PostProcess.AddHistoryData(HisData);
+	m_PostProcess.RunPostProcessing_SaveDefectInfo();
+	
+	WritePLCResult(HisData);
+
+	if(m_pThread_SendMSG != NULL)
+		m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_ShortScanEndSuccess,TRUE);			
+	
+	m_bGlassLoadingEnd = FALSE;
+	m_bPLCGlassLoading = FALSE;
+
+	m_GlassData.SetScanEndTime();
+
+	m_TactStopWatch.End();
+	
+	g_pLog->DisplayMessage(_T("Inspection Time(GlassLoading -> End) : %.3f"),m_TactStopWatch.GetDurationMilliSecond());
+
+	AfxBeginThread(CopyImageThreadFunc, this);	
+
+	if(m_pView != NULL)
+	{
+		m_pView->AddHistory(HisData);
+		m_pView->SetGlassData(&m_GlassData);
+		m_pView->RefreshDefect(m_PostProcess.GetResultPath(EM_RESULT_DEFECT));
+		
+		if(m_pThread_ViewRefresh != NULL)
+		{
+			m_pThread_ViewRefresh->AddViewMSG(0,0,VIEW_REFRESH_INSPECT_END,0);
+		}
+	}		
+
+	return TRUE;
+}
+
+void CInterfaceManager::CopyImageBuffer()
+{
+	DWORD dwTick = GetTickCount();
+	CGLASS_INFO_PARM *pGlass = m_GlassRecipe.GetGlassInfo();
+
+	pINSPECTSPLINE_BUFFER		pSplineBuffer;	
+	CCameraSettings				*pCamera;	
+	int							iCam,iScan,iPos;
+	BOOL						bSplineImg[MAX_PANEL_SIDE];		
+	BOOL						bSpline = m_GlassData.GetInsUseCheck(EM_INS_SPLINE);
+	
+
+	ZeroMemory(bSplineImg,sizeof(BOOL)*MAX_PANEL_SIDE);	
+
+	g_pLog->DisplayMessage(_T("Start Copy Full Image Save"));
+
+	DeleteAlignProfileData();
+
+	for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+	{		
+		for(iScan=0;iScan<MAX_SCAN_COUNT;iScan++)
+		{
+			pCamera = m_HardwareRecipe.GetCameraSettings(iCam,iScan);
+			if(pCamera == NULL)
+				continue;			
+						
+			std::multimap<int, CPoint *> *pCamMapAlign = m_pInspect[iCam]->GetProfileAlign(iScan);
+			
+			if((int)pCamMapAlign->size() > 0)
+			{
+				CSingleLock		csLock(&m_csProfile);
+				csLock.Lock();
+				m_mapAlignProfile[pCamera->m_eDimension].insert(pCamMapAlign->begin(),pCamMapAlign->end());
+				csLock.Unlock();
+			}
+
+			for(iPos=0;iPos<MAX_PANEL_SIDE;iPos++)
+			{
+				pSplineBuffer = m_pInspect[iCam]->GetSplineBuffer(iPos);
+				if(pSplineBuffer == NULL)
+					continue;
+				if(pSplineBuffer->iType < 0 || pSplineBuffer->iType > 1)
+					continue;	
+
+				if(pSplineBuffer->ePosition < INSPECTSPLINE_BUFFER::SPLINE_TOPLEFT || pSplineBuffer->ePosition > INSPECTSPLINE_BUFFER::SPLINE_BOTTOMRIGHT)
+					continue;
+
+				if(bSplineImg[pSplineBuffer->ePosition] == FALSE)
+				{
+					if(m_pView != NULL)
+					{
+						if(m_pView->SetSplineImg(pSplineBuffer->pOrg,pSplineBuffer->szOrg,pSplineBuffer->ePosition) == TRUE)
+							bSplineImg[pSplineBuffer->ePosition] = TRUE;
+					}
+				}
+
+				pSplineBuffer->Reset();				
+			}	
+		}
+	}
+
+	g_pLog->DisplayMessage(_T("Copy Image Save Complete : Time[%d]"),GetTickCount()-dwTick);
+
+}
+
+void CInterfaceManager::Send_ViewRefresh(CScheduleViewMessage *pMSG)
+{	
+	if(m_pView != NULL)
+	{
+		m_pView->ViewRefresh(pMSG->ProcMsg);
+	}
+}
+
+UINT CInterfaceManager::CopyImageThreadFunc(LPVOID pParam)
+{	
+	CInterfaceManager *pMain = static_cast<CInterfaceManager*>(pParam);
+	
+	pMain->Save_FullImg();		
+
+	return 0;
+}
+
+void CInterfaceManager::Save_FullImg()
+{
+	DWORD dwTick = GetTickCount();
+	g_pLog->DisplayMessage(_T("Full Image Save Start"));
+
+	int					iCam,iScan;
+	CHardwareSettings	*pHard = &m_HardwareRecipe;
+	CCameraSettings		*pCamera;	
+	CGlassRecipe		*pGlsRcp = &m_GlassRecipe;
+	CGLASS_INFO_PARM	*pGlassInfoPrm = &pGlsRcp->m_GlassParm;	
+	CString				strFolder,strFileJpg,strPanelID;
+	pINSPECTFULLIMAGE_BUFFER pBuffer;	
+
+	strFolder.Format(_T("%s"),m_PostProcess.GetResultPath(EM_RESULT_FULL));			
+	CreateDirectory(strFolder,NULL);
+
+	strPanelID = g_pBase->m_strHPanelID;
+	if(strPanelID.IsEmpty() == TRUE)
+		strPanelID = _T("TestGlass");
+
+	for(iCam=0;iCam<pHard->GetCameraCount();iCam++)
+	{		
+		for(iScan=0;iScan<MAX_SCAN_COUNT;iScan++)
+		{
+			pCamera = pHard->GetCameraSettings(iCam,iScan);
+			if(pCamera == NULL)
+				continue;			
+
+			pBuffer = m_pInspect[iCam]->GetFullImgBuffer(iScan);			
+			if(pBuffer == NULL)
+				continue;			
+
+			if(pBuffer->pImage != NULL && pBuffer->szImage.cx > 100 && pBuffer->szImage.cy > 100)
+			{
+				
+				strFileJpg.Format(_T("%s\\%s_%s_%s.jpg"),strFolder, strPanelID, PANEL_SIDE[pCamera->m_eDimension],g_pBase->m_strLoadingTime);
+
+				SaveFullImage2(strFileJpg,pBuffer->pImage,pBuffer->szImage.cx,pBuffer->szImage.cy,(int)pCamera->m_eDimension,0,30);
+			}		
+		}
+	}
+	g_pLog->DisplayMessage(_T("Full Image Save Completed : Time[%d]"),GetTickCount()-dwTick);
+}
+
+void CInterfaceManager::WritePLCResult(HISTORY_RESULT &pHistory)
+{
+	short *pResult = m_GlassData.GetGlassResultInfo();
+	ZeroMemory(pResult,sizeof(short)*5);
+
+	// 0 : OK, 1 : NG
+	if(pHistory.bResult == TRUE)
+	{
+		pResult[0] = 0;
+		g_pLog->DisplayMessage(_T("Inspection Result Glass %s - OK"),g_pBase->m_strHPanelID);
+	}
+	else
+	{
+		pResult[0] = 1;	
+		g_pLog->DisplayMessage(_T("Inspection Result Glass %s - NG"),g_pBase->m_strHPanelID);
+	}
+
+	m_GlassData.GetStageTheta(0,pResult[1],pResult[2]);
+	m_GlassData.GetStageTheta(1,pResult[3],pResult[4]);
+
+	m_pControlInterface->SendCIMData(pResult,PLC_ADDR_GLASS_JUDEMENT,5);
+	g_pLog->DisplayMessage(_T("write PLC Result Data : Resut %d,1_L_Theat %d,1_S_Theat %d,2_L_Theat %d,2_S_Theat %d"),pResult[0],pResult[1],pResult[2],pResult[3],pResult[4]);
+
+	INS_PROFILE_RESULT_INFO *pProfileResult = m_GlassData.GetProfileResultInfo();
+
+	for(int i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+	{
+		pProfileResult->nProfileData[i] = pHistory.nProfileDiff[i];
+		pProfileResult->nChamferUp[i] = pHistory.nChamferThickUp[i];
+		pProfileResult->nChamferDn[i] = pHistory.nChamferThickDn[i];
+	}
+
+	m_pControlInterface->SendCIMData((short*)pProfileResult,PLC_ADDR_PROFILE_JUDEMENT,MAX_PROFILE_SETTING_COUNT*3);
+
+	g_pLog->DisplayMessage(_T("write PLC Profile Data : %d"),MAX_PROFILE_SETTING_COUNT*3);
+}
+
+void CInterfaceManager::HistoryData(int nDefectCnt,HISTORY_RESULT &pHistory)
+{
+	CResultData			*pResData = &m_ResultData;
+	PROFILECHAMFER_RESULT_DATA *pProfileResult = m_GlassData.GetProfileInspectData();
+
+	pHistory.Reset();
+
+	int	i;
+	pHistory.bResult = TRUE;
+
+	for(i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+	{
+		pHistory.nProfileDiff[i] = pProfileResult->ProfileData[i].nProfileDiff;
+		if(pProfileResult->ProfileData[i].bUseJudge == TRUE)
+			pHistory.bProfileJudge[i] = pProfileResult->ProfileData[i].bProfileJudge;
+		else
+			pHistory.bProfileJudge[i] = TRUE;
+
+		pHistory.nChamferThickUp[i] = abs(pProfileResult->ResultChamfer[i][0].nChamferCalThick);
+		if(pProfileResult->ResultChamfer[i][0].bUseJudge == TRUE)
+			pHistory.bChamferJudgeUp[i] = pProfileResult->ResultChamfer[i][0].bChamferJudge;
+		else
+			pHistory.bChamferJudgeUp[i] = TRUE;
+
+		pHistory.nChamferThickDn[i] = abs(pProfileResult->ResultChamfer[i][1].nChamferCalThick);
+		if(pProfileResult->ResultChamfer[i][1].bUseJudge == TRUE)
+			pHistory.bChamferJudgeDn[i] = pProfileResult->ResultChamfer[i][1].bChamferJudge;
+		else
+			pHistory.bChamferJudgeDn[i] = TRUE;
+	}
+
+#if 1
+	int	   nGridColumnCnt[] = { PROFILE_INSPECT_SIZE_A_C,PROFILE_INSPECT_SIZE_B_D,PROFILE_INSPECT_SIZE_A_C,PROFILE_INSPECT_SIZE_B_D,PROFILE_INSPECT_SIZE_A_C,PROFILE_INSPECT_SIZE_B_D,PROFILE_INSPECT_SIZE_B_D };
+	UINT   eViewProfileIndex[] = { PROFILE_INSPECT_INDEX_A,PROFILE_INSPECT_INDEX_B,PROFILE_INSPECT_INDEX_C,PROFILE_INSPECT_INDEX_D,PROFILE_INSPECT_INDEX_CF,PROFILE_RCUT_INSPECT_INDEX_A,PROFILE_RCUT_INSPECT_INDEX_C };
+
+	//CString str1,str2,str3;
+	int	index, nProfileIndex;
+	int	nRowIdx, iCol;
+	int nProfileSum, nProfileCnt;
+	int nChamferSumUp, nChamferCntUp;
+	int nChamferSumDn, nChamferCntDn;
+	BOOL isBool;
+
+	for (i = 0; i < MAX_VIEWINFO_GRD_CNT; i++)
+	{
+		isBool = FALSE;
+		nProfileSum = nProfileCnt = 0;
+		nChamferSumUp = nChamferCntUp = 0;
+		nChamferSumDn = nChamferCntDn = 0;
+
+		for (index = 0; index < nGridColumnCnt[i]; index++)
+		{
+			iCol = index + 1;
+			nProfileIndex = eViewProfileIndex[i] + index;
+
+			if (i > MAX_VIEWINFO_GRD_CNT - 3 && index > 4 && !isBool)
+			{
+				isBool = TRUE;
+				pHistory.nAVGProfileDiff[i] = nProfileCnt > 0 ? (nProfileSum / nProfileCnt) : 0;
+				pHistory.nAVGChamferThickUp[i] = nChamferCntUp > 0 ? (nChamferSumUp / nChamferCntUp) : 0;
+				pHistory.nAVGChamferThickDn[i] = nChamferCntDn > 0 ? (nChamferSumDn / nChamferCntDn) : 0;
+
+				nProfileSum = nProfileCnt = 0;
+				nChamferSumUp = nChamferCntUp = 0;
+				nChamferSumDn = nChamferCntDn = 0;
+			}
+
+			if (pProfileResult->ProfileData[nProfileIndex].bProfileJudge)
+			{
+				nProfileSum += pProfileResult->ProfileData[nProfileIndex].nProfileDiff;
+				nProfileCnt++;
+			}
+
+			if (pProfileResult->ResultChamfer[nProfileIndex][0].bChamferJudge)
+			{
+				nChamferSumUp += abs(pProfileResult->ResultChamfer[nProfileIndex][0].nChamferCalThick);
+				nChamferCntUp++;
+			}
+
+			if (pProfileResult->ResultChamfer[nProfileIndex][1].bChamferJudge)
+			{
+				nChamferSumDn += abs(pProfileResult->ResultChamfer[nProfileIndex][1].nChamferCalThick);
+				nChamferCntDn++;
+			}
+		}
+
+		//str1.Format(_T("%.3f"), nProfileCnt > 0 ? (double)(nProfileSum / nProfileCnt / 1000.) : 0.000);
+		//str2.Format(_T("%.3f"), nChamferCntUp > 0 ? (double)(nChamferSumUp / nChamferCntUp / 1000.) : 0.000);
+		//str3.Format(_T("%.3f"), nChamferCntDn > 0 ? (double)(nChamferSumDn / nChamferCntDn / 1000.) : 0.000);
+		//g_pLog->DisplayMessage(_T("HistoryData AVG%d: nProfileAVG=%s,nChamferUpAVG=%s,nChamferUpAVG=%s"), i, str1, str2, str3);
+
+		if (i > MAX_VIEWINFO_GRD_CNT - 3 && index > 4)
+		{
+			pHistory.nAVGProfileDiff[i + 2] = nProfileCnt > 0 ? (nProfileSum / nProfileCnt) : 0;
+			pHistory.nAVGChamferThickUp[i + 2] = nChamferCntUp > 0 ? (nChamferSumUp / nChamferCntUp) : 0;
+			pHistory.nAVGChamferThickDn[i + 2] = nChamferCntDn > 0 ? (nChamferSumDn / nChamferCntDn) : 0;
+		}
+		else
+		{
+			pHistory.nAVGProfileDiff[i] = nProfileCnt > 0 ? (nProfileSum / nProfileCnt) : 0;
+			pHistory.nAVGChamferThickUp[i] = nChamferCntUp > 0 ? (nChamferSumUp / nChamferCntUp) : 0;
+			pHistory.nAVGChamferThickDn[i] = nChamferCntDn > 0 ? (nChamferSumDn / nChamferCntDn) : 0;
+		}
+	}
+#endif // 1
+
+	pHistory.strHostID = g_pBase->m_strHPanelID;
+	pHistory.strGlassID = g_pBase->m_strHPanelID;
+	pHistory.strEndTime = pResData->m_strScanEndTime;	
+	pHistory.nDefectCnt = nDefectCnt;		
+
+	if(nDefectCnt > 0)
+		pHistory.bResult = FALSE;
+
+	// Profile NG
+	if(m_GlassData.m_bOnly_Profile_NG == TRUE)	// Profile NG CHECK..
+	{
+		g_pLog->DisplayMessage(_T("Only Profile Defect !!!!!!!!!!!!!!!"));
+		BOOL bProfileCountNG = FALSE;
+		for(int i=0; i<MAX_DIMENSION_COUNT; i++)
+		{
+			if(m_GlassData.m_nSide_Profile_NG_Count[i] == 0)
+				continue;
+
+			int nMinNGCount = m_GlassRecipe.GetJudgePrm()->nMinProfileNgCount[i];
+
+			g_pLog->DisplayMessage(_T("[Side %d] Only Profile Defect Count [recipe:%d][%d] !!!!!!!!!!!!!!!"), i, nMinNGCount, m_GlassData.m_nSide_Profile_NG_Count[i]);
+
+			if(nMinNGCount <= m_GlassData.m_nSide_Profile_NG_Count[i])
+				bProfileCountNG = TRUE;
+
+			int nMinDiff = m_GlassRecipe.GetJudgePrm()->nMinProfileNgCount_MinDiff[i];
+
+			if(nMinDiff <= m_GlassData.m_nSide_Profile_NG_Max_Diff[i])
+			{
+				bProfileCountNG = TRUE;
+				break;
+			}
+		}
+
+		if(bProfileCountNG == FALSE)
+			pHistory.bResult = TRUE;
+	}
+
+	pHistory.nCrackCount = pResData->m_nCrackCount;
+	pHistory.nBrokenCount = pResData->m_nBrokenCount;
+	pHistory.nChipCount = pResData->m_nChipCount;
+	pHistory.nChamferCount = pResData->m_nChamferCount;
+	pHistory.nBurrCount = pResData->m_nBurrCount;
+	pHistory.nUnknownCount = pResData->m_nUnknownCount;
+}
+
+void CInterfaceManager::CheckSeqMSG_Received(CCheckSeqMessage *pCheckSeq)
+{
+	switch(pCheckSeq->emCheckSeq)
+	{
+	case CHECKSEQ_SHORT_SCANSTART_OVERTIME:
+		g_pLog->DisplayMessage(_T("Check ScanStart TimeOut : start inspection! : %d,%d"),pCheckSeq->iScan,pCheckSeq->dwDuration);
+		if(m_pThread_SendMSG != NULL)
+			m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_ShortScanStartSuccess,TRUE);				
+		break;
+	case CHECKSEQ_SHORT_SCANSTART_COMPLETE:
+		if(m_pThread_SendMSG != NULL)
+			m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_ShortScanStartSuccess,TRUE);		
+		g_pLog->DisplayMessage(_T("All PC - start inspection! : %d,%d"),pCheckSeq->iScan,pCheckSeq->dwDuration);
+		break;
+	case CHECKSEQ_LONG_SCANSTART_OVERTIME:
+		g_pLog->DisplayMessage(_T("Check ScanStart TimeOut : start inspection! : %d,%d"),pCheckSeq->iScan,pCheckSeq->dwDuration);
+		if(m_pThread_SendMSG != NULL)
+			m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_LongScanStartSuccess,TRUE);				
+		break;
+	case CHECKSEQ_LONG_SCANSTART_COMPLETE:
+		if(m_pThread_SendMSG != NULL)
+			m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_LongScanStartSuccess,TRUE);		
+		g_pLog->DisplayMessage(_T("All PC - start inspection! : %d,%d"),pCheckSeq->iScan,pCheckSeq->dwDuration);
+		break;
+	case CHECKSEQ_ONESCAN_OVERTIME:		
+		//m_pThread_NetMSG->AddNetMSG(NET_MESSAGE_INSPECTOR,INSPECTOR_MESSAGE_SCANDISPLAY,pCheckSeq->iScan,0);
+		g_pLog->DisplayMessage(_T("Scan End TimeOut! : %d,%d"),pCheckSeq->iScan,pCheckSeq->dwDuration);		
+		break;
+	case CHECKSEQ_ONESCAN_COMPLETE:
+//		m_pThread_NetMSG->AddNetMSG(NET_MESSAGE_INSPECTOR,INSPECTOR_MESSAGE_SCANDISPLAY,pCheckSeq->iScan,0);
+		g_pLog->DisplayMessage(_T("All PC - One scan Complete! : %d,%d"),pCheckSeq->iScan,pCheckSeq->dwDuration);
+		//m_pView->UpdateSequence(SEQUENCE_SCANEND,(float)pCheckSeq->dwDuration);
+		break;
+	case CHECKSEQ_GLASS_INSPECTION_OVERTIME:
+		g_pLog->DisplayMessage(_T("Glass Inspection TimeOut : Start PostProcess! : %d,%d"),pCheckSeq->iScan,pCheckSeq->dwDuration);
+		AfxBeginThread(ScanTimeOut,this);
+		//ScanOverTimeSignal();		
+		break;
+	case CHECKSEQ_GLASS_INSPECTION_COMPLETE:
+		//m_pThread_NetMSG->AddNetMSG(NET_MESSAGE_INSPECTOR,INSPECTOR_MESSAGE_POSTPROCESSING,pCheckSeq->iScan,0);		
+		g_pLog->DisplayMessage(_T("All PC - Inspection Complete! : Start PostProcess! : %d,%d"),pCheckSeq->iScan,pCheckSeq->dwDuration);
+		break;
+	}
+}
+
+void CInterfaceManager::IMI2P_PLC_ReceiveSignalValue(int nSignalIndex, int nValue)
+{
+	if(m_pLicense != NULL)
+	{
+		if(m_pLicense->Check() == FALSE)
+		{
+			m_pView->View_LicenseInfo();
+			return;
+		}
+	}
+
+	switch(nSignalIndex)
+	{
+	case C2I_Loading:
+		g_pLog->DisplayMessage(_T("=================[GlassLoading Start]================="));
+		GlassLoadingProcess();
+		g_pLog->DisplayMessage(_T("=================[ GlassLoading End ]================="));
+		break;
+	case C2I_ShortScanStart:
+		g_pLog->DisplayMessage(_T("=================[ Short Scan Start Start ]================="));
+		ScanStartProcess(C2I_ShortScanStart);
+		g_pLog->DisplayMessage(_T("=================[ Short Scan Start End  ]================="));
+		break;
+	case C2I_ShortScanEnd:
+		g_pLog->DisplayMessage(_T("=================[ Short Scan End Start ]================="));
+		PLCScanEndProcess(C2I_ShortScanEnd);
+		g_pLog->DisplayMessage(_T("=================[ Short Scan End End  ]================="));
+		break;
+	case C2I_LongScanStart:
+		g_pLog->DisplayMessage(_T("=================[ Long Scan Start Start ]================="));
+		ScanStartProcess(C2I_LongScanStart);
+		g_pLog->DisplayMessage(_T("=================[ Long Scan Start End ]================="));
+		break;	
+	case C2I_LongScanEnd:
+		g_pLog->DisplayMessage(_T("=================[ Long Scan End Start ]================="));
+		PLCScanEndProcess(C2I_LongScanEnd);
+		g_pLog->DisplayMessage(_T("=================[ Long Scan End End ]================="));
+		break;
+	case C2I_EMOGrabStop:
+		g_pLog->DisplayMessage(_T("=================[ EMO Grab Stop Start ]================="));
+		EMOGrabStopProcess(C2I_EMOGrabStop);
+		g_pLog->DisplayMessage(_T("=================[ EMO Grab Stop End  ]================="));
+		break;
+	}
+}
+
+void CInterfaceManager::InitLoadingProcess()
+{
+	g_pLog->DisplayMessage(_T("Start Init Loading Process"));
+		
+	AfxBeginThread(DeleteProfileProcess,this);
+
+	g_pStatus->InitGlassLoading();
+
+	m_GlassData.ResetGlass();
+	m_bPostProcess = FALSE;
+
+	if(m_pView != NULL)
+	{
+		m_pView->ResetViewAll();
+		m_pView->SetRecipeSettings(&m_GlassRecipe);
+		m_pView->SetGlassData(&m_GlassData);
+		m_pView->SetTransferData(&m_TransferData);
+	}
+}
+
+UINT CInterfaceManager::DeleteProfileProcess(LPVOID pParam)
+{
+	CInterfaceManager		*pInterface = (CInterfaceManager *)pParam;
+
+	pInterface->DeleteAlignProfileData();
+
+	return 0;
+}
+
+void CInterfaceManager::DeleteProfileData()
+{
+	std::multimap<int, CPoint*>::iterator	it;
+
+	CPoint		*pPoint;
+	for(int i=0;i<MAX_PANEL_SIDE;i++)
+	{
+		for(it=m_mapProfile[i].begin();it!=m_mapProfile[i].end();it++)
+		{
+			pPoint = it->second;
+			if(pPoint == NULL)
+				continue;
+			delete pPoint;
+			pPoint = NULL;
+		}
+		m_mapProfile[i].clear();		
+	}
+
+	DeleteAlignProfileData();
+}
+
+void CInterfaceManager::DeleteAlignProfileData()
+{
+	CSingleLock		csLock(&m_csProfile);
+	csLock.Lock();
+
+//	std::multimap<int, CPoint*>::iterator	it;
+//	CPoint		*pPoint;
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		/*
+		for(it=m_mapAlignProfile[i].begin();it!=m_mapAlignProfile[i].end();it++)
+		{
+			pPoint = it->second;
+			if(pPoint == NULL)
+				continue;
+			delete pPoint;
+			pPoint = NULL;
+		}
+		*/
+		
+		m_mapAlignProfile[i].clear();
+	}
+
+	csLock.Unlock();
+}
+
+BOOL CInterfaceManager::EMOGrabStopProcess(ControlToInspect emSendSignal)
+{
+
+	return TRUE;
+}
+
+BOOL CInterfaceManager::PLCScanEndProcess(ControlToInspect emSendSignal)
+{
+	switch(emSendSignal)
+	{
+	case C2I_ShortScanEnd:
+		{
+			g_pLog->DisplayMessage(_T("Short Scan End Signal"));			
+			m_bShortPLCEnd = TRUE;
+		}
+		break;
+	case C2I_LongScanEnd:
+		{
+			g_pLog->DisplayMessage(_T("Long Scan End Signal"));
+
+			if(m_pThread_SendMSG != NULL)
+				m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_LongScanEndSuccess,TRUE);
+			m_bLongPLCEnd = TRUE;
+		}
+		break;	
+	}	
+
+	return TRUE;
+}
+
+BOOL CInterfaceManager::ScanStartProcess(ControlToInspect emSendSignal)
+{	
+	if(m_bGlassLoadingEnd == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("GlassLoading Not End : Skip Scan Start Signal"));
+		return FALSE;
+	}
+
+	m_GlassData.SetScanStart(TRUE);
+	m_nScanStartCount = 0;
+
+	switch(emSendSignal)
+	{
+	case C2I_ShortScanStart:
+		{
+			g_pLog->DisplayMessage(_T("Short Scan Start Signal"));
+			m_bShortPLCScanStart = TRUE;			
+
+			g_pStatus->m_iScanIdx = 1;			
+
+			AfxBeginThread(ScanStartCam_0,this);
+			AfxBeginThread(ScanStartCam_1,this);
+			AfxBeginThread(ScanStartCam_2,this);
+			AfxBeginThread(ScanStartCam_3,this);		
+
+			AfxBeginThread(CheckScanStart,this);
+		}
+		break;
+	case C2I_LongScanStart:
+		{
+			g_pLog->DisplayMessage(_T("Long Scan Start Signal"));		
+
+			m_GlassData.SetScanStartTime();	
+
+			g_pStatus->m_iScanIdx = 0;
+
+			AfxBeginThread(ScanStartCam_0,this);
+			AfxBeginThread(ScanStartCam_1,this);
+			AfxBeginThread(ScanStartCam_2,this);
+			AfxBeginThread(ScanStartCam_3,this);			
+
+			AfxBeginThread(CheckScanStart,this);
+
+			m_GlassData.SetScanStartCount(MAX_DIMENSION_COUNT);
+		}
+		break;	
+	}
+
+	return TRUE;
+}
+
+UINT CInterfaceManager::CheckScanStart(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	double		CurTime = GetTickCount();
+	
+	do 
+	{
+		if (GetTickCount() - CurTime > 10000)
+		{
+			g_pLog->DisplayMessage(_T("Scan Start Ack TimeOut : Scan %d-%d"),g_pStatus->m_iScanIdx,pInter->m_nScanStartCount);
+			break;
+		}
+
+		if(pInter->m_nScanStartCount == MAX_CAMERA_COUNT)
+		{
+			g_pLog->DisplayMessage(_T("Scan Start Ack Ok : Scan %d-%d"),g_pStatus->m_iScanIdx,pInter->m_nScanStartCount);
+			break;
+		}
+
+		Sleep(0);
+	} while (1);
+	
+	g_pLog->DisplayMessage(_T("Scan Start Ack Signal Send : Scan %d-%d"),g_pStatus->m_iScanIdx,pInter->m_nScanStartCount);
+	if(g_pStatus->m_iScanIdx == 0)
+	{			
+		if(pInter->m_pThread_SendMSG != NULL)
+			pInter->m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_LongScanStartSuccess,TRUE);
+	}
+	else
+	{
+		if(pInter->m_pThread_SendMSG != NULL)
+			pInter->m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_ShortScanStartSuccess,TRUE);
+	}
+
+	pInter->SetGlassTimeOut();
+	
+	return 0;
+}
+
+void CInterfaceManager::SetGlassTimeOut()
+{
+	if(m_pThread_CheckSequence != NULL)		
+	{
+		double dOneScanTime = m_GlassRecipe.m_GlassParm.GetOneScanTime();
+
+		m_pThread_CheckSequence->SetC2M(static_cast<ICheckSequenceInterface2Parent*>(this),&m_GlassData);
+		m_pThread_CheckSequence->AddCheckSeqMSG(CHECKSEQ_GLASS_INSPECTION_OVERTIME,(int)(dOneScanTime* 1000.),m_HardwareRecipe.GetScanCount()-1);	
+	}
+}
+
+void CInterfaceManager::ScanStartCamera(int iCam)
+{
+	BOOL bFreerun = m_HardwareRecipe.m_bUseFreerun;
+	int nPeriod = m_HardwareRecipe.m_nFreerunPeriod;
+	int nExposureTime = m_HardwareRecipe.m_nFreerunExposureTime;
+
+	CCameraSettings *pCamSettings = m_HardwareRecipe.GetCameraSettings(iCam,g_pStatus->m_iScanIdx);
+
+	g_pStatus->SetGrabFrametoScan(g_pStatus->m_iScanIdx,pCamSettings->m_nGrabFrameCount);
+	if(m_pGrabber[iCam] != NULL)
+	{
+		m_pGrabber[iCam]->GrabScanStart(g_pStatus->m_iScanIdx,bFreerun,nPeriod,nExposureTime);
+	}
+
+	if(m_pInspect[iCam] != NULL)
+	{
+		if(m_pInspect[iCam]->ScanStart(g_pStatus->m_iScanIdx) == FALSE)
+		{
+			g_pLog->DisplayMessage(_T("Cam %d Scan %d Start Fail"),iCam,g_pStatus->m_iScanIdx);
+		}
+	}		
+
+	CSingleLock		cLock(&m_csScanStart);
+	cLock.Lock();
+	m_nScanStartCount++;
+	cLock.Unlock();	
+}
+
+UINT CInterfaceManager::ScanStartCam_0(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	pInter->ScanStartCamera(0);
+
+	return 0;
+}
+
+UINT CInterfaceManager::ScanStartCam_1(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	pInter->ScanStartCamera(1);
+
+	return 0;
+}
+
+UINT CInterfaceManager::ScanStartCam_2(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	pInter->ScanStartCamera(2);
+
+	return 0;
+}
+
+UINT CInterfaceManager::ScanStartCam_3(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	pInter->ScanStartCamera(3);
+
+	return 0;
+}
+
+BOOL CInterfaceManager::ScanStartGrabManual(int iCam,int iScan)
+{
+	if(m_pGrabber[iCam] != NULL)
+	{
+		m_pGrabber[iCam]->GrabScanStart(iScan,FALSE,0,0,FALSE);
+	}
+
+	return TRUE;
+}
+
+BOOL CInterfaceManager::ScanStartManual(int iCam,int iScan)
+{	
+	if(m_pInspect[iCam] != NULL)
+	{
+		if(m_pInspect[iCam]->ScanStart(iScan) == FALSE)
+		{
+			g_pLog->DisplayMessage(_T("Manual Cam %d Scan %d Start Fail"),iCam,iScan);
+		}
+	}		
+
+	return TRUE;
+}
+
+BOOL CInterfaceManager::GlassLoadingProcess()
+{
+	g_pLog->DisplayMessage(_T("==============================================="));
+	g_pLog->DisplayMessage(_T("Start Glass Loading Process"));		
+
+	if(CheckExpireDay() == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("*** Confirm Exit"));	
+		//	ExitProcess(0);
+		return TRUE;
+	}
+
+
+	m_bGlassLoadingEnd = FALSE;
+	m_bPLCGlassLoading = TRUE;		
+
+	InitLoadingProcess();
+	
+	m_GlassData.SetLoadingTime();	
+	m_TactStopWatch.Start();
+
+	g_pBase->m_strRecipeName = m_GlassRecipe.GetRecipeName();
+	g_pBase->m_strLoadingDay = m_GlassData.GetLoadingDayFileName();
+	g_pBase->m_strLoadingTime = m_GlassData.GetLoadingTimeFileName();
+	g_pBase->m_strHPanelID.Format(_T("Manual_%s"),m_GlassData.GetLoadingTime());
+
+	BOOL bGlassLoading;	
+
+	bGlassLoading = Glass_Loading();	
+
+	g_pLog->DisplayMessage(_T("Glass Loading Process Glass ID : %s"),g_pBase->m_strHPanelID);	
+	
+	if(bGlassLoading == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("GlassLoading Fail %s : Inspection does not proceed."),g_pBase->m_strHPanelID);
+		//AddAlarmList(IToC_Alarm_InspectorError);		
+
+		//return FALSE;
+	}
+
+	// Trigger Control
+	if(m_HardwareRecipe.GetTriggerBoardUse() == TRUE)
+		SetTriggerControl();
+
+		
+	g_pStatus->LoadProfileOpt(m_GlassRecipe.GetRecipeName());
+		
+	m_pView->SetRecipeSettings(&m_GlassRecipe);	
+	m_pView->SetGlassData(&m_GlassData);
+
+	if(m_pThread_CheckSequence != NULL)
+		m_pThread_CheckSequence->ClearMessage();		
+
+	m_pView->UpdateTransferData();			
+	m_bShortPLCEnd = FALSE;
+	m_bLongPLCEnd = FALSE;
+	m_bShortPLCScanStart = FALSE;	
+
+	g_pLog->DisplayMessage(_T("Start Glass Loading Process 5"));
+
+	if(m_pThread_SendMSG != NULL)
+	{
+		m_pThread_SendMSG->AddSendMSG(SEND_MESSAGE_CONTROLSIGNAL,IToC_Ack_LoadingSuccess,TRUE);	
+	}
+
+	m_GlassData.SetPostProc(FALSE);
+	m_bGlassLoadingEnd = TRUE;
+
+	return TRUE;
+}
+
+int CInterfaceManager::Glass_Loading()
+{	
+	g_pLog->DisplayMessage(_T("==================================================="));
+	g_pLog->DisplayMessage(_T("Glass Loading Start!!!"));	
+		
+	if(ReadTransferData(TRANSITEM_FILEPATH_B5) == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("Read Transfer File Fail"));
+		//return FALSE;
+	}
+	g_pLog->DisplayMessage(_T("ReadTransferData Process"));
+	
+	if(AutoChangeRecipe() == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("Recipe Change Fail"));		
+	//	return FALSE;
+	}
+	
+	g_pLog->DisplayMessage(_T("AutoChangeRecipe Process"));
+
+	if(SendGlassRecipe() == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("Send Recipe Fail"));		
+		//return FALSE;
+	}		
+
+	return TRUE;
+}
+
+BOOL CInterfaceManager::SendGlassRecipe(BOOL bAll,int iCam)
+{
+	int			i;		
+
+	if(bAll == TRUE)
+	{
+		for(i=0;i<MAX_CAMERA_COUNT;i++)
+		{			
+			if(m_pInspect[i] == NULL)
+				continue;
+
+			m_pInspect[i]->SetParameter(&m_GlassRecipe,&m_HardwareRecipe);
+			g_pLog->DisplayMessage(_T("AutoChangeRecipe cam %d SetGlass"),i);
+			m_pInspect[i]->SetGlassData(&m_GlassData);
+			g_pLog->DisplayMessage(_T("AutoChangeRecipe cam %d setspline"),i);
+			m_pInspect[i]->SetSplineModel(m_SplineModel);	
+			g_pLog->DisplayMessage(_T("AutoChangeRecipe cam %d setcad"),i);
+			m_pInspect[i]->SetCADData(m_mapProfile,m_ptOriginMapProfile);
+			g_pLog->DisplayMessage(_T("AutoChangeRecipe cam %d setcad end"),i);
+		}
+	}
+	else
+	{
+		m_pInspect[iCam]->SetParameter(&m_GlassRecipe,&m_HardwareRecipe);
+		m_pInspect[iCam]->SetGlassData(&m_GlassData);
+		m_pInspect[iCam]->SetSplineModel(m_SplineModel);
+		m_pInspect[iCam]->SetCADData(m_mapProfile,m_ptOriginMapProfile);
+	}
+
+	g_pLog->DisplayMessage(_T("AutoChangeRecipe Process End"));
+
+	return TRUE;	
+}
+
+CString	CInterfaceManager::GetRecipeName(int iRcpNo)
+{
+	if(iRcpNo < 0)
+		return _T("*");
+
+	CConfig cfg;
+	if(cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)LINK_FILE_NAME, FileMap_Mode) == FALSE)	
+		return _T("*");
+
+	int nUpperPPIDNumber;
+	cfg.GetItemValue(_T("UPPER_NUMBER"), nUpperPPIDNumber, 0);
+
+	if(nUpperPPIDNumber <= 0 || nUpperPPIDNumber >= 1000)
+		return _T("*");
+
+	int i;
+	CString strValue = _T("");
+	CString	strRecipe;
+
+	strRecipe.Format(_T("%d"),iRcpNo);
+	for(i = 0; i < nUpperPPIDNumber; i++)
+	{
+		cfg.GetItemValue(i, _T("UPPER_NAME"), strValue, _T("NoName"));
+		strValue.MakeUpper();
+		strValue.TrimLeft(_T(" "));
+		strValue.TrimRight(_T(" "));
+
+		if(strRecipe.CompareNoCase(strValue) == 0)
+		{			
+			cfg.GetItemValue(i, _T("INS_NAME"), strValue, _T("NoName"));
+			strValue.MakeUpper();
+			return strValue;
+		}		
+	}
+
+	return _T("*");
+}
+
+BOOL CInterfaceManager::AutoChangeRecipe()
+{
+	CString		strRcp;
+
+	strRcp = GetRecipeName(m_TransferData.m_nRecipeNo);	
+
+	if(!m_strReserveRecipe.IsEmpty())
+	{
+		g_pLog->DisplayMessage(_T("Apply reserve Recipe Loading - [%s]"), m_strReserveRecipe);		
+		if (LoadGlassRecipe(m_strReserveRecipe,TRUE))	// 鞍篮 Recipe扼档 利侩 抗距登绢 乐栏搁 促矫 肺爹茄促.
+		{					
+			g_pLog->DisplayMessage(_T("Apply reserve Recipe Loading - [%s] : Success"), m_strReserveRecipe);
+		}
+		return TRUE;
+	}	
+
+	if(strRcp.CompareNoCase(_T("*")) == 0)
+	{
+		g_pLog->DisplayMessage(_T("Recipe Link Fail...!"));
+		strRcp = "LinkFail";		
+		return FALSE;
+	}	
+
+	if (strRcp.CompareNoCase(m_GlassRecipe.GetRecipeName()) != 0)	// strRecipeName 官差搁 肺爹茄促.
+	{			
+		if (LoadGlassRecipe(strRcp,TRUE) == FALSE)			
+		{
+			g_pLog->DisplayMessage(_T("Recipe[%s] Read Fail!"),strRcp);
+			return FALSE;
+		}		
+	}	
+
+	m_strReserveRecipe.Empty();	
+
+	return TRUE;
+}
+
+BOOL CInterfaceManager::ReadTransferData(CString strTransItemFile)
+{	
+	if(m_pTransDataManager == NULL || m_pControlInterface == NULL)
+		return FALSE;
+	if(strTransItemFile.IsEmpty() == TRUE)
+		return FALSE;
+
+	char		lpTransBuffer[2048];
+	int			nTransSize = 0;
+
+	ZeroMemory(lpTransBuffer,sizeof(char)*2048);
+
+	if(m_pTransDataManager->LoadTransItemFromFile(strTransItemFile) == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("TransferData Read Fail! 1 :%s"),(TCHAR*)(LPCTSTR)strTransItemFile);
+		return FALSE;
+	}
+
+	if(m_pControlInterface->ReadTransferData(m_pTransDataManager,lpTransBuffer,PLC_TRASFERDATA_ADDR) == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("TransferData Read Fail! 2 :%s"),(TCHAR*)(LPCTSTR)strTransItemFile);
+		return FALSE;
+	}
+	
+	if(m_TransferData.SetManagerToData(m_pTransDataManager) == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("TransferData Read Fail! 3 :%s"),(TCHAR*)(LPCTSTR)strTransItemFile);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+void CInterfaceManager::SetSlashText(EmSplashCmd emCommand, CString strLog, UINT nColor)
+{
+	CString strText = _T("        ");
+	strText += strLog;
+
+	switch(emCommand)
+	{
+	case emShow:			m_splash.ShowSplash();
+		break;
+	case emHide:			m_splash.CloseSplash();
+		break;
+	case emText:			m_splash.SetText(strText, nColor);
+		break;
+	default:
+		break;
+	}
+}
+
+BOOL CInterfaceManager::ReadHardwareSetting()
+{
+	m_HardwareRecipe.Reset();
+
+	//return m_HardwareRecipe.ReadHardwareSettingsRegistry();
+	return m_HardwareRecipe.ReadHardwareSettingsFile(HARDWARE_SETTING_PATH);
+}
+
+BOOL CInterfaceManager::InterfaceInit()
+{
+	BOOL		bIsInit = TRUE;	
+	
+	//////////////////////////////////////////////////////////////////////////
+	// Trans Data Manager
+	m_pTransDataManager = new CTransDataManager;
+	
+	//////////////////////////////////////////////////////////////////////////
+	// Thread Init
+	CreateThread();
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Create Thread Complete"), RGB(0,0,0));	
+
+	m_pControlInterface = new CControl_Interface();
+	m_pControlInterface->SetI2M(static_cast<IMainFrameInterface2Parent*>(this));
+	if(m_pControlInterface != NULL)
+	{		
+		m_pControlInterface->ConnectToControl();
+	}
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("PLC Connection Complete"), RGB(0,0,0));	
+
+	m_pLightManager = new CLightManager;
+	m_pLightManager->InitLightControl();
+	m_pLightManager->SetHardware(&m_HardwareRecipe);
+	m_pLightManager->ConnectToLight();
+	
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Light Control Complete"), RGB(0,0,0));	
+
+	InitGrabber();
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Grabber Complete"), RGB(0,0,0));	
+
+	InitInspect();
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Inspect Complete"), RGB(0,0,0));		
+	
+	LightTurnOnOff(TRUE);
+	LightChangeValue();
+
+	m_pTriggerBoardControl = new CTriggerControl_Mvsol;
+	m_pLicense = new CLicenseChecker();
+
+	g_pStatus->m_pLicenseChecker = m_pLicense;
+
+	if(m_HardwareRecipe.GetTriggerBoardUse() == TRUE)
+		m_pTriggerBoardControl->Connect(m_HardwareRecipe.GetTriggerBoardComport());
+
+	if(m_pView->GetHardwareSettingView() != NULL)
+		m_pView->GetHardwareSettingView()->SetTriggerBoard(m_pTriggerBoardControl);
+
+	setLineCameraParamToSDK();
+
+	return bIsInit;
+}
+
+void CInterfaceManager::setLineCameraParamToSDK(void) {
+	/* code */
+#if HALCON_VISION_KEY
+	CString strRecipePath = RECIPE_PATH;
+	CT2A ansiString(strRecipePath);
+	BlVision_GetVisionRecipe()->setWorkDir(ansiString);
+
+	for (int iCam = 0; iCam < MAX_CAMERA_COUNT; iCam++) {
+		BlVision_GetVisionRecipe()->setGrabberControl(m_pGrabber[iCam], iCam);
+	}
+
+	int nCount = (int)(DIMENSION_NONE);
+	int iCam = -1;
+	int iScan = -1;
+	for (int i = 0; i < nCount; i++) {
+		DimensionDir eDir = (DimensionDir)(i);
+		iCam = m_HardwareRecipe.GetCameraIndexToDimension(eDir);
+		iScan = m_HardwareRecipe.GetScanToDimension(eDir);
+		BlVision_GetVisionRecipe()->setCameraSetting(eDir, iCam, iScan);
+	}
+
+	BlVision_GetVisionRecipe()->setRecipeType(RCUT_VISION_RECIPE);
+	BlVision_GetVisionRecipe()->init();
+
+	for (int i = 0; i < nCount; i++) {        //设置分辨率
+		DimensionDir eDir = (DimensionDir)(i);
+		CBlSideData *pSide = BlVision_GetVisionRecipe()->getSideData(eDir);
+
+		int iCam = m_HardwareRecipe.GetCameraIndexToDimension(eDir);
+		int iScan = m_HardwareRecipe.GetScanToDimension(eDir);
+		CCameraSettings* pCamSetting = m_HardwareRecipe.GetCameraSettings(iCam, iScan);
+
+		pSide->m_dPixelSizeX = pCamSetting->m_dConvResolution[0];
+		pSide->m_dPixelSizeY = pCamSetting->m_dScanResolution[1];
+	}
+
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Vision Library Load"), RGB(0, 0, 0));
+#endif
+}
+
+BOOL CInterfaceManager::InitInspect()
+{
+	int			iCam;		
+
+	for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+	{
+		m_pInspect[iCam] = new CInspectCamera(iCam);	
+		m_pInspect[iCam]->InitInspect(MAX_THREAD,MAX_DEFECT_COUNT);
+		m_pInspect[iCam]->SetParameter(&m_GlassRecipe,&m_HardwareRecipe);
+		m_pInspect[iCam]->SetGrabber(m_pGrabber[iCam]);
+		m_pInspect[iCam]->SetGlassData(&m_GlassData);
+		m_pInspect[iCam]->SetI2S(static_cast<IInspect2Sequence*>(this));
+		m_pInspect[iCam]->SetViewScanHWnd(m_pView->GetViewScanHWnd());
+
+		m_PostProcess.SetInspectCamera(iCam,m_pInspect[iCam]);
+	}
+
+	return TRUE;
+}
+
+BOOL CInterfaceManager::InitGrabber()
+{
+	g_pLog->DisplayMessage( _T("CreateCamera Start!"));	
+
+	//////////////////////////////////////////////////////////////////////////
+	// Camera Handle 积己.
+	int			iCam;		
+	BOOL		bRet = TRUE;
+
+	for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+	{
+		if(m_pGrabber[iCam] != NULL)
+		{
+			delete m_pGrabber[iCam];
+		}
+
+		switch(m_HardwareRecipe.m_nBoardType)
+		{
+		case GRAB_LINK_BOARD:
+			m_pGrabber[iCam] = new CGrabberMulticam;	
+			break;
+		case RADIENT_BOARD:
+			m_pGrabber[iCam] = new CGrabberRadient;	
+			break;
+		case SAP_BOARD:
+			m_pGrabber[iCam] = new CSapLineGrab;	
+			break;
+		default:
+			continue;
+		}
+		
+		_GRABBER_INIT_PARAM_ Param;
+		Param.hWnd = NULL;
+		Param.bDemo = FALSE;
+		// Param.nGrabBufSize = g_pBase->m_pBufferSize[iCam]; // miniled 有这行
+		Param.nGrabBufCount = g_pBase->m_pMemFrameNo[iCam];		
+		Param.nFrameWidth = g_pBase->m_pFrameWidth[iCam];
+		Param.nFrameHeight = g_pBase->m_pFrameHeight[iCam];
+		Param.nConnectPort = g_pBase->m_pCameraPort[iCam];
+		Param.nScanCount = g_pBase->m_nScanCount;
+		// Param.nBoardIdx = g_pBase->m_nBoardID[iCam];      // miniled 有这行
+		// Param.nBoardCh = g_pBase->m_nBoardCh[iCam];       // miniled 有这行
+		Param.nImgFlipX = 0;		
+		Param.nBoardCh = 0;
+		Param.nCameraIdx = iCam;
+		Param.nCameraScan = 0;
+
+		CCameraSettings *pCamera = m_HardwareRecipe.GetCameraSettings(iCam,0);
+		if(pCamera != NULL)
+			Param.nImgFlipX = (int)pCamera->m_nImgFlipx;
+		
+		Param.nExposureDelay = m_HardwareRecipe.m_nFreerunPeriod;
+		Param.nExposure = m_HardwareRecipe.m_nFreerunExposureTime;
+
+#ifdef _UNICODE
+		ZeroMemory(Param.cDCFPath, MAX_DFC_PATH);
+		if(MAX_DFC_PATH < g_pBase->m_strCamCCA[iCam].GetLength())
+		{
+			delete m_pGrabber[iCam];
+			m_pGrabber[iCam] = NULL;
+
+			return FALSE;
+		}
+		int		nSize = WideCharToMultiByte(CP_ACP, 0, g_pBase->m_strCamCCA[iCam].GetBuffer(), -1, NULL, 0, NULL,NULL); 				
+		WideCharToMultiByte(CP_ACP, 0, g_pBase->m_strCamCCA[iCam].GetBuffer(), -1, Param.cDCFPath, nSize, NULL, NULL); 		
+#else				
+		ZeroMemory(Param.cDCFPath, MAX_DFC_PATH);
+		if(MAX_DFC_PATH < g_pBase->m_strCamCCA[iCam].GetLength())
+		{
+			delete m_pGrabber[iCam];
+			m_pGrabber[iCam] = NULL;
+
+			return FALSE;
+		}
+		CopyMemory(Param.cDCFPath, g_pBase->m_strCamCCA[iCam].GetBuffer(0), g_pBase->m_strCamCCA[iCam].GetLength());
+		//Param.cDCFPath = (LPCTSTR)(TCHAR*)(g_pBase->m_strCamCCA);
+#endif			
+
+		g_pLog->DisplayMessage( _T("Cam File[%d]-%s"), iCam, (CString) Param.cDCFPath);	
+
+		int nErrorCode;		
+		int nBoardId = iCam;
+
+		// B5 4龋扁 悸泼
+		int		nLineID = _ttoi(m_HardwareRecipe.GetLineID());
+		if(nLineID == 4)
+		{
+			switch(iCam)
+			{
+			case 0: nBoardId = 2; break;
+			case 1: nBoardId = 0; break;
+			case 2: nBoardId = 3; break;
+			case 3: nBoardId = 1; break;
+			}
+		}
+		else if(nLineID == 5)
+		{
+			switch(iCam)
+			{			
+			case 1: nBoardId = 3; break;
+			case 3: nBoardId = 1; break;
+			}
+		}
+
+		Param.nBoardIdx = nBoardId;
+
+		g_pLog->DisplayMessage( _T("Cam File[%d]-Init"), iCam);	
+
+		bRet |= m_pGrabber[iCam]->Initialize(&Param, &nErrorCode,nBoardId);
+
+		g_pLog->DisplayMessage( _T("Cam File[%d]-Init End"), iCam);	
+
+		bRet |= m_pGrabber[iCam]->InitializeBuffer(&Param);
+
+		g_pLog->DisplayMessage( _T("Cam File[%d]-Buffer End"), iCam);	
+
+		g_pStatus->SetFrameBuffer(iCam,m_pGrabber[iCam]->GetFrameBuffer());
+	}		
+
+	g_pLog->DisplayMessage( _T("CreateCamera Success!"));
+
+	return bRet;
+}
+
+BOOL CInterfaceManager::DeinitGrabber()
+{
+	for(int i=0;i<MAX_CAMERA_COUNT;i++)
+	{
+		if (m_pGrabber[i])
+		{
+			m_pGrabber[i]->GrabScanStop();
+			m_pGrabber[i]->Deinitialize();
+			delete m_pGrabber[i];
+			m_pGrabber[i] = NULL;
+		}
+	}
+	return TRUE;
+}
+
+BOOL CInterfaceManager::LoadGlassRecipe(CString strRecipe,BOOL bReadProfile)
+{
+	if(strRecipe.IsEmpty())
+		return FALSE;		
+	
+	m_GlassRecipe.Reset();
+
+	if (!m_GlassRecipe.MakeRecipeFileName(strRecipe))	
+		return FALSE;
+
+	if (!m_GlassRecipe.ReadRecipeFile())
+		return FALSE;	
+
+	m_GlassData.SetGlassRecipe(&m_GlassRecipe);
+
+	AfxBeginThread(ReadCADData_0,this);
+	AfxBeginThread(ReadCADData_1,this);
+	AfxBeginThread(ReadCADData_2,this);
+	AfxBeginThread(ReadCADData_3,this);
+
+	//AfxBeginThread(ReadSplineModel,this);	
+
+	return TRUE;
+}
+
+UINT CInterfaceManager::ReadSplineModel(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	CString			strRecipe = pInter->m_GlassRecipe.GetRecipeName();
+	pInter->ReadSplineModeldata(strRecipe);
+
+	return 0;
+}
+
+void CInterfaceManager::ReadSplineModeldata(CString strRecipe)
+{
+	CString	strSide,strFile;
+
+	for(int i=0;i<MAX_PANEL_SIDE;i++)
+	{
+		m_SplineModel[i].ClearModelData();
+
+		switch(i)
+		{
+		case DIMENSION_A:		
+			strSide = _T("A");
+			break;
+		case DIMENSION_B:		
+			strSide = _T("B");
+			break;
+		case DIMENSION_C:		
+			strSide = _T("C");
+			break;
+		case DIMENSION_D:		
+			strSide = _T("D");
+			break;
+		}	
+
+		strFile.Format(_T("C:\\RCutProject\\Spline\\%s_RCUT_%s.rcut"),strRecipe,strSide);
+		if(m_SplineModel[i].ReadModelData(strFile,strRecipe) == TRUE)
+		{
+			g_pLog->DisplayMessage(_T("%s R-Cut Master Load Success"),strSide);
+		}
+		else
+		{
+			g_pLog->DisplayMessage(_T("%s  R-Cut Master Load Fail"),strSide);
+		}
+	}
+}
+
+UINT CInterfaceManager::ReadCADData_0(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+	
+	CString			strRecipe = pInter->m_GlassRecipe.GetRecipeName();
+	pInter->ReadProfileCADdata(0,strRecipe);
+
+	return 0;
+}
+
+UINT CInterfaceManager::ReadCADData_1(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	CString			strRecipe = pInter->m_GlassRecipe.GetRecipeName();
+	pInter->ReadProfileCADdata(1,strRecipe);
+
+	return 0;
+}
+
+UINT CInterfaceManager::ReadCADData_2(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	CString			strRecipe = pInter->m_GlassRecipe.GetRecipeName();
+	pInter->ReadProfileCADdata(2,strRecipe);
+
+	return 0;
+}
+
+UINT CInterfaceManager::ReadCADData_3(LPVOID pParam)
+{
+	CInterfaceManager	*pInter = static_cast<CInterfaceManager*>(pParam);
+
+	CString			strRecipe = pInter->m_GlassRecipe.GetRecipeName();
+	pInter->ReadProfileCADdata(3,strRecipe);
+
+	return 0;
+}
+
+BOOL CInterfaceManager::ReadProfileCADdata(int iSide,CString strRecipe)
+{
+	g_pLog->DisplayMessage(_T("Read Profile CAD Data Start : %d"),iSide);	
+
+	CProfileCADProc profileproc;
+	CString		strFile,strDim;
+	int			i = iSide;
+	std::multimap<int, CPoint *>::iterator it;
+	CPoint	*pPoint;
+		
+	switch((DimensionDir)i)
+	{
+	case DIMENSION_A:		
+		strDim = _T("A");
+		break;
+	case DIMENSION_B:
+		strDim = _T("B");
+		break;
+	case DIMENSION_C:
+		strDim = _T("C");
+		break;
+	case DIMENSION_D:
+		strDim = _T("D");
+		break;	
+	}
+
+	for(it=m_mapProfile[i].begin();it!=m_mapProfile[i].end();it++)
+	{
+		pPoint = it->second;
+		if(pPoint == NULL)
+			continue;
+		delete pPoint;
+		pPoint = NULL;
+	}
+	m_mapProfile[i].clear();
+
+	profileproc.SetProfileData(&m_mapProfile[i],NULL);		
+
+	strFile.Format(_T("%s\\Profile\\%s_%s.prf"),PATH_INSPECTOR,strRecipe,strDim);
+
+	if(profileproc.ReadProfileData(strFile) == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("%s Profile CAD Load Fail:%s"),PANEL_SIDE[i],strFile);
+	}
+	else
+	{
+		g_pLog->DisplayMessage(_T("%s Profile CAD Load Success:%s"),PANEL_SIDE[i],strFile);
+	}
+	m_ptOriginMapProfile[i]=  profileproc.GetProfileOrigin();
+	
+
+	return TRUE;
+}
+
+void CInterfaceManager::LightTurnOnOff(BOOL bOn)
+{
+	if(m_pLightManager == NULL)
+		return;	
+	
+	for(int iCam=0;iCam<m_HardwareRecipe.GetCameraCount();iCam++)
+	{			
+		CCameraSettings *pCamSetting = m_HardwareRecipe.GetCameraSettings(iCam,0);
+		if(pCamSetting == NULL)
+			continue;
+
+		m_pLightManager->LampTurnOnOff(pCamSetting->m_nLightIdx_R,pCamSetting->m_nLightIdx_R_Ch,TRUE);
+		Sleep(10);				
+		m_pLightManager->LampTurnOnOff(pCamSetting->m_nLightIdx_T,pCamSetting->m_nLightIdx_T_Ch,TRUE);
+		Sleep(10);
+	}
+}
+
+void CInterfaceManager::LightChangeValue(int iCamera,int nValue)
+{
+	if(m_pLightManager == NULL)
+		return;	
+	
+	if(iCamera == -1)
+	{
+		for(int iCam=0;iCam<m_HardwareRecipe.GetCameraCount();iCam++)
+		{			
+			CCameraSettings *pCamSetting = m_HardwareRecipe.GetCameraSettings(iCam,0);
+			if(pCamSetting == NULL)
+				continue;
+
+			int		nLightVal = m_GlassRecipe.GetLightValue(pCamSetting->m_nLightIdx_R,pCamSetting->m_nLightIdx_R_Ch);
+			m_pLightManager->SetLightControlValue(m_GlassRecipe.GetRecipeName(),pCamSetting->m_nLightIdx_R,pCamSetting->m_nLightIdx_R_Ch,LIGHT_TYPE_REF,TRUE,nLightVal);
+
+			Sleep(10);
+			nLightVal = m_GlassRecipe.GetLightValue(pCamSetting->m_nLightIdx_T,pCamSetting->m_nLightIdx_T_Ch);
+			m_pLightManager->SetLightControlValue(m_GlassRecipe.GetRecipeName(),pCamSetting->m_nLightIdx_T,pCamSetting->m_nLightIdx_T_Ch,LIGHT_TYPE_TRANS,TRUE,nLightVal);
+			Sleep(10);
+		}
+	}
+	else
+	{
+		CCameraSettings *pCamSetting = m_HardwareRecipe.GetCameraSettings(iCamera,0);
+		if(pCamSetting == NULL)
+			return;
+		
+		m_pLightManager->SetLightControlValue(m_GlassRecipe.GetRecipeName(),pCamSetting->m_nLightIdx_R,pCamSetting->m_nLightIdx_R_Ch,LIGHT_TYPE_REF,TRUE,nValue);
+	}
+}
+
+BOOL CInterfaceManager::WaitEndSignal(InspectToControlSignal emSendSignal)
+{
+	DWORD dwTick = GetTickCount();
+	DWORD dwWaitTick;
+	DWORD dwWaitTime = 5000;
+
+	while(TRUE)
+	{
+		dwWaitTick = GetTickCount() - dwTick;
+		if(dwWaitTime < dwWaitTick)
+			break;
+
+		switch(emSendSignal)
+		{
+		case IToC_Ack_ShortScanEndSuccess:
+		case IToC_Ack_ShortScanEndFail:		
+			if(m_bShortPLCEnd == TRUE)
+			{
+				g_pLog->DisplayMessage(_T("Ack Short PLC End : %d"),m_bShortPLCEnd);
+				return TRUE;
+			}
+			break;
+		case IToC_Ack_LongScanEndSuccess:	
+		case IToC_Ack_LongScanEndFail:	
+			if(m_bLongPLCEnd == TRUE)
+			{
+				g_pLog->DisplayMessage(_T("Ack Long PLC End : %d"),m_bShortPLCEnd);
+				return TRUE;
+			}
+			break;
+		default:
+			return TRUE;
+		}		
+
+		Sleep(1);
+	}
+
+	return TRUE;
+}
+
+void CInterfaceManager::SetInspectionEnd()
+{
+	for(int i=0;i<MAX_CAMERA_COUNT;i++)
+	{
+		if(m_pInspect[i] != NULL)
+		{
+			m_pInspect[i]->SetProcessEnd();					
+		}
+	}
+
+	Sleep(500);	
+}
+
+BOOL CInterfaceManager::IsScanNow()
+{	
+	BOOL bScanStart = m_GlassData.GetScanStart();
+	BOOL bScanEnd = m_GlassData.GetScanEnd(m_HardwareRecipe.GetScanCount()-1);
+
+	if (bScanStart && !bScanEnd)
+		return TRUE;
+
+	return FALSE;
+}
+
+void CInterfaceManager::CreateThread()
+{
+	m_pThread_SendMSG = new CThread_SendMSG();
+	if(m_pThread_SendMSG != NULL)
+	{
+		m_pThread_SendMSG->SetIN2P(static_cast<IPLCSendInterface2Parent*>(this));
+		m_pThread_SendMSG->CreateThread();
+	}
+
+	m_pThread_CheckSequence = new CThread_CheckSequence();
+	if(m_pThread_CheckSequence != NULL)
+	{
+		m_pThread_CheckSequence->SetC2M(static_cast<ICheckSequenceInterface2Parent*>(this),&m_GlassData);
+		m_pThread_CheckSequence->CreateThread();
+	}
+
+	m_pThread_ViewRefresh = new CThread_ViewRefresh();
+	if(m_pThread_ViewRefresh != NULL)
+	{
+		m_pThread_ViewRefresh->SetIN2P(static_cast<IViewRefreshInterface2Parent*>(this));
+		m_pThread_ViewRefresh->CreateThread();
+	}
+
+	/*
+	m_pThread_NetMSG = new CThread_NetMSG();
+	if(m_pThread_NetMSG != NULL)
+	{
+		m_pThread_NetMSG->SetIN2P(static_cast<IPLCReceiveInterface2Parent*>(this));
+		m_pThread_NetMSG->CreateThread();
+	}
+
+	
+
+	m_pThread_Light = new CThread_Light();
+	if(m_pThread_Light != NULL)
+	{
+		m_pThread_Light->CreateThread();
+	}	
+	*/
+}
+
+LPBYTE CInterfaceManager::GetGrabBuffer(DimensionDir eDir,int iVline)
+{
+	int	iCam = m_HardwareRecipe.GetCameraIndexToDimension(eDir);
+	int iScan = m_HardwareRecipe.GetScanToDimension(eDir);
+
+	if(iCam < 0 || iCam >= MAX_CAMERA_COUNT)
+		return NULL;
+	if(iScan < 0 || iScan >= MAX_SCAN_COUNT)
+		return NULL;	
+	if(m_pGrabber[iCam] == NULL)
+		return NULL;
+
+	return m_pGrabber[iCam]->GetFrameHeaderLine(iScan,iVline);
+}
+
+BOOL CInterfaceManager::SaveFullImage(CString strPath,int iSide,CPoint ptStart,int nLineCnt)
+{
+	g_pStatus->CheckDirectory(strPath);
+
+	FIBITMAP					*bitmap = NULL;	
+	BYTE						*pBitBuffer;
+
+	CString savePath = strPath;
+	savePath += _T(".jpg");
+
+	bitmap = FreeImage_Allocate(IMAGE_WIDTH, nLineCnt,8);
+
+	pBitBuffer = FreeImage_GetBits(bitmap);
+	if(pBitBuffer == NULL)
+	{
+		FreeImage_Unload(bitmap);		
+		return FALSE;
+	}			
+
+	LPBYTE			lpImg = GetGrabBuffer((DimensionDir)iSide,ptStart.y);
+	if(lpImg == NULL)
+		return FALSE;
+
+	CopyMemory(pBitBuffer,lpImg,IMAGE_WIDTH*nLineCnt);		
+
+	USES_CONVERSION;
+	char str_filename[1024];
+	sprintf_s(str_filename, "%s", W2A(savePath));
+
+	FreeImage_FlipVertical(bitmap);
+
+	FreeImage_Save(FIF_JPEG, bitmap, str_filename,JPEG_FULLIMAGE_RATE);
+
+	FreeImage_Unload(bitmap);		
+
+
+	return TRUE;
+}
+
+BOOL CInterfaceManager::SaveFullImage2(CString strPath,LPBYTE lpOrigin,int nImgWidth,int nImgHeight,int iSide,int nStartY,int nQuality /*= 80*/)
+{
+	if(lpOrigin == NULL)
+		return FALSE;
+
+	if(nImgHeight < 100)
+	{
+		g_pLog->DisplayMessage(_T("Save Full Image Fail(%s, %s, %d), Height is 0"), strPath, PANEL_SIDE[iSide], nImgHeight);
+		return FALSE;
+	}
+
+	//g_pLog->DisplayMessage(_T("Save Full Image (%s, %s, %d) 1"), strPath, PANEL_SIDE[iSide], nImgHeight);
+
+	g_pStatus->CheckDirectory(strPath);
+
+	//g_pLog->DisplayMessage(_T("Save Full Image (%s, %s, %d) 2"), strPath, PANEL_SIDE[iSide], nImgHeight);
+
+	int p[3];
+	p[0] = CV_IMWRITE_JPEG_QUALITY;
+	p[1] = nQuality;
+	p[2] = 0;
+
+	double dCompressRatio = (double) m_HardwareRecipe.m_nFullImageCompressRatio;
+
+	if(dCompressRatio < 70.0 || 90.0 < dCompressRatio)
+		dCompressRatio = 70.0;
+
+	double tmp = dCompressRatio/100.0;
+	double dRatio = 1.-tmp;
+	IplImage *Img  = cvCreateImageHeader(cvSize(nImgWidth,nImgHeight),8,1);
+	IplImage *img2 = cvCreateImage(cvSize((int)(nImgWidth*dRatio),(int)(nImgHeight*dRatio)),8,1);
+
+	//g_pLog->DisplayMessage(_T("Save Full Image (%s, %s, %d) 3"), strPath, PANEL_SIDE[iSide], nImgHeight);
+
+	if(Img == NULL || img2 == NULL)
+	{
+		g_pLog->DisplayMessage(_T("Save Full Image Fail(%s, %s, %d), img pointer is null"), strPath, PANEL_SIDE[iSide], nStartY);
+		return FALSE;
+	}
+
+	g_pLog->DisplayMessage(_T("Save Full Image Start(%s, %s, %d, %d, %d)"), strPath, PANEL_SIDE[iSide], nStartY, nImgHeight, nQuality);	
+
+	if(nStartY < 0 || iSide < 0 || iSide >= MAX_DIMENSION_COUNT)
+	{
+		g_pLog->DisplayMessage(_T("Save Full Image Fail(%s, %s, %d)"), strPath, PANEL_SIDE[iSide], nStartY);
+		return FALSE;
+	}
+
+	LPBYTE			lpImg =	lpOrigin+(nStartY*nImgWidth);
+	if(lpImg == NULL)
+	{
+		g_pLog->DisplayMessage(_T("Save Full Image Fail(%s, %s, %d), Buffer is NULL"), strPath, PANEL_SIDE[iSide], nStartY);
+		return FALSE;
+	}
+
+	//g_pLog->DisplayMessage(_T("Save Full Image (%s, %s, %d) 4"), strPath, PANEL_SIDE[iSide], nImgHeight);
+
+	cvSetData(Img,lpImg,nImgWidth);
+
+	cvResize(Img,img2);
+	USES_CONVERSION;
+	char str_filename[200];
+	sprintf_s(str_filename, "%s", W2A(strPath));
+	cvSaveImage(str_filename,img2, p);
+
+	//g_pLog->DisplayMessage(_T("Save Full Image (%s, %s, %d) 5"), strPath, PANEL_SIDE[iSide], nImgHeight);
+
+	cvReleaseImage(&img2);
+	cvReleaseImageHeader(&Img);
+
+	g_pLog->DisplayMessage(_T("Save Full Image Success(%s, %s, %d, %d, %d)"), strPath, PANEL_SIDE[iSide], nStartY, nImgHeight, nQuality);	
+
+	return TRUE;
+}
+
+#define IMAGE_COMPRESSRATIO		50
+int CInterfaceManager::LoadFullImage(CString strPath,int iSide,int nStartY, CGlass_Data *pGlassData,const bool bIsDebugImg)
+{
+	int  nHeight = -1;
+
+	USES_CONVERSION;
+	char str_filename[200];
+	sprintf_s(str_filename, "%s", W2A(strPath));
+
+	IplImage *Iplimg = cvLoadImage(str_filename, CV_LOAD_IMAGE_GRAYSCALE);
+	LPBYTE		lpImg = NULL;
+
+	if(Iplimg)
+	{
+		if(bIsDebugImg == true) //Debug image
+		{
+			UINT uiReadLine = 0;			
+
+			// 			lpImg = GetGrabBuffer((DimensionDir)iSide,nStartY);
+			// 			if(lpImg != NULL)
+			// 			{
+			// 				memcpy(lpImg, &Iplimg->imageData[0] , Iplimg->widthStep*Iplimg->height);
+			// 			}
+			// 
+			for(int i = 0; i < Iplimg->height; i++)
+			{
+				lpImg = GetGrabBuffer((DimensionDir)iSide,nStartY+i);
+				if(lpImg == NULL)
+					break;
+				memcpy(lpImg, &Iplimg->imageData[uiReadLine] , Iplimg->widthStep);
+				uiReadLine += Iplimg->widthStep;				
+			}
+
+			if(pGlassData != NULL)
+			{
+				INS_EDGE_RESULT_INFO *pResInfo =  pGlassData->GetEdgeResultInfo((DimensionDir)iSide);
+				if(pResInfo != NULL)
+				{
+					pResInfo->nGlassStartLine = 0;
+					pResInfo->nGlassEndLine = Iplimg->height + nStartY;
+				}
+			}
+
+			nHeight = Iplimg->height;
+			cvReleaseImage(&Iplimg);
+		}
+		else //Full image
+		{
+			const double dRatio = 1.0 - static_cast<double>(IMAGE_COMPRESSRATIO / 100.0);
+			IplImage *resizeImage = cvCreateImage(cvSize((int)(Iplimg->width/dRatio), (int)(Iplimg->height/dRatio)), IPL_DEPTH_8U, 1);
+
+			cvResize(Iplimg, resizeImage, CV_INTER_CUBIC);
+
+
+			lpImg = GetGrabBuffer((DimensionDir)iSide,nStartY);
+			if(lpImg != NULL)
+			{
+				memcpy(lpImg, &Iplimg->imageData[0] , resizeImage->widthStep*resizeImage->height);
+			}
+
+			// 			UINT uiReadLine = 0;
+			// 			for(int i = 0; i < resizeImage->height; i++)
+			// 			{
+			// 				lpImg = GetGrabBuffer((DimensionDir)iSide,nStartY+i);
+			// 				if(lpImg == NULL)
+			// 					break;
+			// 				memcpy(lpImg, &resizeImage->imageData[uiReadLine] , resizeImage->widthStep);
+			// 				uiReadLine += resizeImage->widthStep;				
+			// 			}
+
+			if(pGlassData != NULL)
+			{
+				INS_EDGE_RESULT_INFO *pResInfo =  pGlassData->GetEdgeResultInfo((DimensionDir)iSide);
+				if(pResInfo != NULL)
+				{
+					pResInfo->nGlassStartLine = 0;
+					pResInfo->nGlassEndLine = Iplimg->height + nStartY;
+				}
+			}
+
+			nHeight = resizeImage->height;
+			cvReleaseImage(&Iplimg);
+			cvReleaseImage(&resizeImage);
+		}
+		strPath.Append(_T("_OK"));
+	}
+	else
+		strPath.Append(_T("_NG"));
+
+	g_pLog->DisplayMessage(_T("%s"),(TCHAR*)(LPCTSTR)strPath);	
+
+	SetSlashText(GLOBAL_DEFINE::emText, strPath, RGB(0,0,0));
+
+	return nHeight;
+}
+
+BOOL CInterfaceManager::SetLiveGrabCommand(DimensionDir eDir,BOOL bStop)
+{
+	int	iCam = m_HardwareRecipe.GetCameraIndexToDimension(eDir);
+
+	g_pLog->DisplayMessage(_T("Live Grab Cam %d Start : Inter"),iCam);
+
+	if(iCam < 0 || iCam >= MAX_CAMERA_COUNT)
+		return FALSE;
+	if(m_pGrabber[iCam] == NULL)
+		return FALSE;
+
+	BOOL	bRet = TRUE;
+
+	if(bStop == TRUE)
+		bRet = m_pGrabber[iCam]->GrabScanStop();
+	else
+	{
+		bRet = m_pGrabber[iCam]->SetTriggerMode(FALSE);
+		bRet = m_pGrabber[iCam]->GrabLiveStart();	
+	}
+
+	g_pLog->DisplayMessage(_T("Live Grab Cam %d End : Inter"),iCam);
+
+	return bRet;
+}
+
+void CInterfaceManager::WriteLogManager(TCHAR *str)
+{
+	if(m_pLogManager != NULL)
+	{
+		m_pLogManager->WriteLog(0,(TCHAR*)(LPCTSTR)str);		
+	}
+}
+
+BOOL CInterfaceManager::CheckExpireDay()
+{
+#if OFFLINE_KEY
+	return TRUE;
+#endif
+
+	CFile	file;
+	CString	strPath;
+	STU_EXPIRE_DAY	stuExpire;
+	
+	strPath.Format(_T("C:\\Windows\\SystemConfirm.bin"));
+
+	if(TRUE == file.Open(strPath,CFile::modeRead))
+	{
+		if(sizeof(STU_EXPIRE_DAY) == file.Read(&stuExpire, sizeof(STU_EXPIRE_DAY)))
+		{
+			if(stuExpire.m_nCode != 32783762)
+			{
+				file.Close();
+				return FALSE;
+			}		
+		}
+
+		file.Close();
+	}
+	else
+		return FALSE;
+
+	return TRUE;
+}
+
+void CInterfaceManager::SetTriggerControl()
+{
+	g_pLog->DisplayMessage(_T("Set Trigger Control : Stage %d"), g_pBase->m_nStageNo);
+
+	if(m_pTriggerBoardControl == NULL)
+		m_pTriggerBoardControl = new CTriggerControl_Mvsol;
+
+	if(m_pTriggerBoardControl->IsConnect() == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("Trigger Board Connect : Com Port = %d"), m_HardwareRecipe.GetTriggerBoardComport());
+		m_pTriggerBoardControl->Connect(m_HardwareRecipe.GetTriggerBoardComport());
+	}
+		
+
+	if(g_pBase->m_nStageNo == 0)
+	{
+		g_pLog->DisplayMessage(_T("Trigger Control Digital Input OFF !"));
+		m_pTriggerBoardControl->SetSelectEncoder(0);
+	}
+	else
+	{
+		g_pLog->DisplayMessage(_T("Trigger Control Digital Input ON !"));
+		m_pTriggerBoardControl->SetSelectEncoder(1);
+	}
+}
diff --git a/ENRIT/InterfaceManager.h b/ENRIT/InterfaceManager.h
new file mode 100644
index 0000000..7c9afc3
--- /dev/null
+++ b/ENRIT/InterfaceManager.h
@@ -0,0 +1,180 @@
+#pragma once
+
+#include "Global_Define.h"
+#include "Control_Interface.h"
+#include "ENRITView.h"
+#include "LightManager.h"
+#include "Splash.h"
+#include "Transfer_Data.h"
+#include "HardwareSettings.h"
+#include "GlassRecipe.h"
+#include "Glass_Data.h"
+#include "Thread_Send.h"
+#include "Thread_CheckSeq.h"
+#include "Thread_ViewRefresh.h"
+#include "InspectCamera.h"
+#include "PostProcess.h"
+#include "ResultData.h"
+#include "StopWatch.h"
+#include "TriggerControl_Mvsol.h"
+
+class CGrabberMulticam;
+class CFrameBufferController;
+class CInterfaceManager : public IMainFrameInterface2Parent
+						,public ICheckSequenceInterface2Parent
+						,public IPLCSendInterface2Parent
+						,public IInspect2Sequence
+						,public IViewRefreshInterface2Parent
+						
+{
+public:
+	CInterfaceManager(void);
+	virtual ~CInterfaceManager(void);
+
+protected:
+	virtual void	IMI2P_PLC_ReceiveSignalValue(int nSignalIndex, int nValue);
+	virtual void	CheckSeqMSG_Received(CCheckSeqMessage *pCheckSeq);
+	virtual void	SendMSG_Received(CPostSendMessage *pSendMSG);
+		
+	virtual void	II2S_InspectionEnd(int iCamID,int iScan);	
+
+	void			SendMsgInspectToControlSignal(CPostSendMessage *pNetMSG);
+	void			SendMsgInspectToControlAlarm(CPostSendMessage *pNetMSG);	
+
+	virtual void	Send_ViewRefresh(CScheduleViewMessage *pMSG);
+
+protected:
+	void			InitLoadingProcess();
+	BOOL			GlassLoadingProcess();	
+	int				Glass_Loading();
+	BOOL			ReadTransferData(CString strTransItemFile);	
+	BOOL			ScanStartProcess(ControlToInspect emSendSignal);
+	BOOL			PLCScanEndProcess(ControlToInspect emSendSignal);
+	BOOL			EMOGrabStopProcess(ControlToInspect emSendSignal);	
+	BOOL			ScanStartGrabManual(int iCam,int iScan);
+	BOOL			ScanStartManual(int iCam,int iScan);
+	BOOL			PostProcess();
+	void			ScanOverTimeSignal();
+	void			HistoryData(int nDefectCnt,HISTORY_RESULT &pHistory);		
+	
+	static	UINT	ScanTimeOut(LPVOID pParam);
+	void			ScanStartCamera(int iCam);
+	static	UINT	ScanStartCam_0(LPVOID pParam);
+	static	UINT	ScanStartCam_1(LPVOID pParam);
+	static	UINT	ScanStartCam_2(LPVOID pParam);
+	static	UINT	ScanStartCam_3(LPVOID pParam);
+	static  UINT	CheckScanStart(LPVOID pParam);
+	static UINT		PLCSignalThreadFunc(LPVOID pParam);
+	static UINT		DeleteProfileProcess(LPVOID pParam);
+	static UINT		ScanEndProcess(LPVOID pParam);
+
+protected:
+	BOOL			InitInspect();
+	BOOL			InitGrabber();
+	BOOL			DeinitGrabber();	
+
+	void			SetSlashText(EmSplashCmd emCommand, CString strLog, UINT nColor);	
+	void			CreateThread();
+	BOOL			DestroyThread();
+	BOOL			InterfaceInit();
+	BOOL			ReadHardwareSetting();	
+	BOOL			ReadProfileCADdata(int iSide,CString strRecipe);	
+	void			DeleteAlignProfileData();
+	void			DeleteProfileData();
+
+// Recipe
+	BOOL			SendGlassRecipe(BOOL bAll=TRUE,int iCam=-1);
+	BOOL			LoadGlassRecipe(CString strRecipe,BOOL bReadProfile);
+	BOOL			AutoChangeRecipe();
+	CString			GetRecipeName(int iRcpNo);;	
+
+// Light	
+	void			LightTurnOnOff(BOOL bOn);
+	void			LightChangeValue(int iCamera=-1,int nValue=0);
+
+	void			PLCSignalRetry(SEND_MESSAGE_SECTION emSection,InspectToControlSignal emSendSignal,enInterface_Send_Control emControlSignal);
+	BOOL			WaitEndSignal(InspectToControlSignal emSendSignal);
+	
+	void			SetInspectionEnd();
+	BOOL			IsScanNow();	
+	int				LoadFullImage(CString strPath,int iSide,int nStartY = 0, CGlass_Data *pGlassData = NULL, const bool bIsDebugImg = true);
+	BOOL			SaveFullImage(CString strPath,int iSide,CPoint ptStart,int nLineCnt);
+	BOOL			SaveFullImage2(CString strPath,LPBYTE lpOrigin,int nImgWidth,int nImgHeight,int iSide,int nStartY,int nQuality = 50);		
+	LPBYTE			GetGrabBuffer(DimensionDir eDir,int iVline);
+	BOOL			SetLiveGrabCommand(DimensionDir eDir,BOOL bStop);	
+	void			WriteLogManager(TCHAR *str);	
+	void			WritePLCResult(HISTORY_RESULT &pHistory);
+	void			Save_FullImg();
+	void			ReadSplineModeldata(CString strRecipe);
+	void			CopyImageBuffer();		
+	void			SetGlassTimeOut();
+
+	static UINT		ReadCADData_0(LPVOID pParam);
+	static UINT		ReadCADData_1(LPVOID pParam);
+	static UINT		ReadCADData_2(LPVOID pParam);
+	static UINT		ReadCADData_3(LPVOID pParam);
+
+	static UINT		ReadSplineModel(LPVOID pParam);
+
+	static UINT		CopyImageThreadFunc(LPVOID pParam);
+
+	BOOL			CheckExpireDay();
+
+	void			SetTriggerControl();
+
+	//16. 配置参数
+	void setLineCameraParamToSDK(void);
+
+private:
+	//CRITICAL_SECTION m_criticalSection; //互斥量
+	//inline void Lock() { ::InitializeCriticalSection(&m_criticalSection); }
+	//inline void Unlock() { ::DeleteCriticalSection(&m_criticalSection); }
+	//std::mutex m_mtx;
+	//inline void Lock() { m_mtx.lock(); }
+	//inline void Unlock() { m_mtx.unlock(); }
+
+// Instance
+protected:
+	CLogManager			*m_pLogManager;
+	CSplash				m_splash;
+	CENRITView			*m_pView;
+	CTransDataManager	*m_pTransDataManager;
+	CTransfer_Data		m_TransferData;
+	CControl_Interface	*m_pControlInterface;	
+	CLightManager		*m_pLightManager;
+	CTriggerControl_Mvsol* m_pTriggerBoardControl;
+	CHardwareSettings	m_HardwareRecipe;
+	CGlassRecipe		m_GlassRecipe;
+	CInspectCamera		*m_pInspect[MAX_CAMERA_COUNT];	
+	CGrabberControl		*m_pGrabber[MAX_CAMERA_COUNT];		
+	CGlass_Data			m_GlassData;
+	CThread_SendMSG			*m_pThread_SendMSG;	
+	CThread_CheckSequence	*m_pThread_CheckSequence;
+	CThread_ViewRefresh		*m_pThread_ViewRefresh;
+	CPostProcess		m_PostProcess;
+	CResultData			m_ResultData;
+	CCriticalSection	m_csScanStart;
+	int					m_nScanStartCount;
+	BOOL				m_bGlassLoadingEnd;
+
+// Values
+protected:
+	CSplineModel				m_SplineModel[MAX_DIMENSION_COUNT];	
+	std::multimap<int, CPoint*> m_mapProfile[MAX_DIMENSION_COUNT];
+	std::multimap<int, CPoint*> m_mapAlignProfile[MAX_DIMENSION_COUNT];
+	CPoint						m_ptOriginMapProfile[MAX_DIMENSION_COUNT];
+	CCriticalSection			m_csProfile;
+	CCriticalSection			m_csPLCSignal;
+	SEND_MESSAGE_SECTION		m_emPLCSection;
+	InspectToControlSignal		m_emPLCSendSignal;
+	enInterface_Send_Control	m_emPLCControlSignal;
+	BOOL						m_bShortPLCEnd;
+	BOOL						m_bLongPLCEnd;
+	BOOL						m_bShortPLCScanStart;
+	BOOL						m_bPLCGlassLoading;
+	CString						m_strReserveRecipe;
+	BOOL						m_bPostProcess;
+	CStopWatch					m_TactStopWatch;
+	CLicenseChecker*			m_pLicense;
+};
+
diff --git a/ENRIT/License/LicenseChecker.cpp b/ENRIT/License/LicenseChecker.cpp
new file mode 100644
index 0000000..def3672
--- /dev/null
+++ b/ENRIT/License/LicenseChecker.cpp
@@ -0,0 +1,69 @@
+#include "StdAfx.h"
+#include "LicenseChecker.h"
+
+
+CLicenseChecker::CLicenseChecker(void)
+{
+	m_LicenseWorker = new CWorker_UpdateLicense(0, this, 10000);
+	m_LicenseWorker->StartThread();
+}
+
+
+CLicenseChecker::~CLicenseChecker(void)
+{
+	if(m_LicenseWorker != NULL)
+	{
+		m_LicenseWorker->StopThread();
+		delete m_LicenseWorker;
+		m_LicenseWorker = NULL;
+	}
+}
+
+BOOL CLicenseChecker::Check()
+{
+	return TRUE;
+
+	BOOL bRet = FALSE;
+
+	CSingleLock localLock(&m_csStatus);
+	localLock.Lock();
+
+	if(m_Status.nKeyStatus == LicenseKey_Activated)
+		bRet = TRUE;
+
+	localLock.Unlock();
+
+	return bRet;
+}
+
+SLicenseStatus CLicenseChecker::GetLicenseInfo()
+{
+	SLicenseStatus retStatus;
+
+	CSingleLock localLock(&m_csStatus);
+	localLock.Lock();
+
+#if /*PROHIBITED_LICENSE == */1
+	m_Status.nUsbID = 1;
+	m_Status.strSerialNo.Format(_T("No license"));
+	m_Status.nKeyStatus = LicenseKey_Activated;
+	CTime tmpTime(2099, 12, 31, 23, 59, 59);
+	m_Status.expTime = tmpTime;
+#endif
+
+	retStatus = m_Status;
+
+	localLock.Unlock();
+
+	return retStatus;
+}
+
+void CLicenseChecker::IWUL2P_LicenceStatus(int nIndex, const SLicenseStatus& sStatus)
+{
+	CSingleLock localLock(&m_csStatus);
+	localLock.Lock();
+
+	m_Status = sStatus;
+
+	localLock.Unlock();
+}
diff --git a/ENRIT/License/LicenseChecker.h b/ENRIT/License/LicenseChecker.h
new file mode 100644
index 0000000..41fb682
--- /dev/null
+++ b/ENRIT/License/LicenseChecker.h
@@ -0,0 +1,23 @@
+#pragma once
+#include "Worker_UpdateLicense.h"
+
+class CLicenseChecker : public IWorkerUpdateLicense2Parent
+{
+public:
+	CLicenseChecker(void);
+	~CLicenseChecker(void);
+
+public:
+	BOOL Check();
+	SLicenseStatus GetLicenseInfo();
+
+protected:
+	virtual void IWUL2P_LicenceStatus(int nIndex, const SLicenseStatus& sStatus);
+
+private:
+	CWorker_UpdateLicense* m_LicenseWorker;
+
+	CCriticalSection m_csStatus;
+	SLicenseStatus m_Status;
+};
+
diff --git a/ENRIT/License/Worker_UpdateLicense.cpp b/ENRIT/License/Worker_UpdateLicense.cpp
new file mode 100644
index 0000000..b054f0e
--- /dev/null
+++ b/ENRIT/License/Worker_UpdateLicense.cpp
@@ -0,0 +1,206 @@
+#include "stdafx.h"
+#include "Worker_UpdateLicense.h"
+
+#ifdef _DEBUG
+#pragma comment(lib,"setupapi.lib")
+#pragma comment(lib,"l_mega64.lib")
+#else
+#pragma comment(lib,"setupapi.lib")
+#pragma comment(lib,"l_mega64.lib")
+#endif
+
+// 皋啊遏 扼捞宏矾府 寇何 窃荐 急攫 矫累
+#ifdef __cplusplus						
+extern "C" {
+#endif
+	extern unsigned int  lock_init_usb(unsigned int op1);		// 皋啊遏 沤祸
+	extern unsigned char lock_write(unsigned char op1, char op2);
+	extern unsigned char lock_read(unsigned char op1);
+	extern unsigned int  lock_boot_cnt(void);		// 何泼 冉荐 掘扁
+	extern unsigned char lock_version(void);
+	extern unsigned char lock_sn(char);				// 皋啊遏 绊蜡锅龋
+	extern unsigned char lock_check(void);			// 皋啊遏 粮犁 咯何甫 狐福绊 埃窜洒 眉农
+	extern int lock_write_ex(int op1, int op2);
+	extern int lock_read_ex(int op1);
+	extern BOOL lock_receive(void);
+
+	// 捞傈 滚傈苞 龋券己 蜡瘤甫 困茄 窃荐, 脚痹诀眉牢 版快 酒贰狼 窃荐绰 荤侩窍瘤 付技夸.
+	extern unsigned char lock_auto(char op1);
+	extern unsigned char lock_func0(unsigned char op1, unsigned char op2);
+	extern unsigned char lock_func1(unsigned char op1, unsigned char op2);
+	extern unsigned char lock_func2(unsigned char op1, unsigned char op2);
+	extern unsigned char lock_func3(unsigned char op1, unsigned char op2);
+
+#ifdef __cplusplus						
+}
+#endif
+//  皋啊遏 扼捞宏矾府 寇何 窃荐 急攫 场
+
+CWorker_UpdateLicense::CWorker_UpdateLicense(int nIndex, IWorkerUpdateLicense2Parent *pIWUL2P, DWORD dwTick) 
+	: m_nIndex(nIndex), m_pIWUL2P(pIWUL2P), m_dwTick(dwTick)
+{
+	m_sStatus.Reset();
+	m_bUpdate = FALSE;
+	m_hThreadDone = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+}
+
+CWorker_UpdateLicense::~CWorker_UpdateLicense()
+{
+	CloseHandle(m_hThreadDone);
+}
+
+BOOL CWorker_UpdateLicense::StartThread()
+{
+	if (m_bUpdate) return FALSE;
+
+	//Read 胶饭靛 积己
+	m_bUpdate = TRUE;
+	AfxBeginThread(CWorker_UpdateLicense::UpdateLicense,(LPVOID)(this));
+
+	return TRUE;
+}
+
+void CWorker_UpdateLicense::StopThread()
+{
+	if (m_bUpdate)
+	{
+		m_bUpdate = FALSE;
+	}
+}
+
+UINT CWorker_UpdateLicense::UpdateLicense(LPVOID pParam)
+{
+	CWorker_UpdateLicense* pThis = (CWorker_UpdateLicense*)pParam;
+	const UINT uiRetval = pThis->Update_License_Func();
+	if (uiRetval != 0)
+	{
+		SetEvent(pThis->m_hThreadDone);
+	}
+
+	return uiRetval;
+}
+
+UINT CWorker_UpdateLicense::Update_License_Func()
+{
+	while (m_bUpdate)
+	{
+		Update_License();
+	
+		::Sleep(m_dwTick);
+	};
+
+	SetEvent(m_hThreadDone);
+	return 0;
+}
+
+void CWorker_UpdateLicense::Update_License()
+{
+	////////////////////// USB侩 皋啊遏 八荤风凭 矫累
+	DWORD64 dwTick = GetTickCount64();
+
+	m_sStatus.Reset();
+
+#if /*PROHIBITED_LICENSE == */1
+	m_sStatus.nUsbID = 1;
+	m_sStatus.strSerialNo.Format(_T("No license"));
+	m_sStatus.nKeyStatus = LicenseKey_Activated;
+	CTime tmpTime(2099, 12, 31, 23, 59, 59);
+	m_sStatus.expTime = tmpTime;
+	return;
+#endif
+
+	m_sStatus.nKeyStatus = LicenseKey_NotConnected; // 楷搬 救凳
+	m_sStatus.nUsbID = lock_init_usb(8); // 楷搬 眉农
+	if (0 == m_sStatus.nUsbID)
+	{
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+
+	m_sStatus.nKeyStatus = LicenseKey_NotCertified; // 牢刘 救凳
+	if (0 != lock_check()) // 牢刘 眉农
+	{
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+
+	CString szTemp = L"";
+	for (int i = 0; i < 4; i++)  
+	{
+		unsigned int rData = lock_sn(i);
+		szTemp.Format(_T("%s%02X"), szTemp, rData);
+	}
+	m_sStatus.strSerialNo = szTemp;
+
+	m_sStatus.nKeyStatus = LicenseKey_NotActivated; // 劝己拳 救凳
+
+	// TIME 眉农
+	int pMemData[16] = { 0 };
+	CString strTemp;
+	for (int i = 0; i < 16; i++)
+	{
+		strTemp.Format(L"%02X", lock_read(i));
+		pMemData[i] = _ttoi(strTemp); // hex2dec(pChData);
+	}
+
+	int nYear = (pMemData[0] * 100) + pMemData[1];
+	if (nYear < 2000)
+	{
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+
+	int nMonth = pMemData[2];
+	if (nMonth < 1 || nMonth > 12)
+	{
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+
+	int nDay = pMemData[3];
+	if (nDay < 1 || nDay > 31)
+	{
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+
+	int nHour = pMemData[4];
+	if (nHour < 0 || nHour > 24)
+	{
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+
+	int nMinute = pMemData[5];
+	if (nMinute < 0 || nMinute > 60)
+	{
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+
+	int nSec = pMemData[6];
+	if (nSec < 0 || nSec > 60)
+	{
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+	
+	// time check
+	CTime expTime(nYear, nMonth, nDay, nHour, nMinute, nSec);
+	CTime curTime = CTime::GetCurrentTime();
+	CTimeSpan spanTime = expTime - curTime;
+
+	m_sStatus.expTime = expTime;
+
+	if (spanTime.GetTotalSeconds() > 0)
+	{
+		m_sStatus.nKeyStatus = LicenseKey_Activated; // 劝己拳凳
+		m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+		return;
+	}
+
+	dwTick = GetTickCount64() - dwTick;
+	m_pIWUL2P->IWUL2P_LicenceStatus(m_nIndex, m_sStatus);
+
+	return;
+}
diff --git a/ENRIT/License/Worker_UpdateLicense.h b/ENRIT/License/Worker_UpdateLicense.h
new file mode 100644
index 0000000..dd20ca0
--- /dev/null
+++ b/ENRIT/License/Worker_UpdateLicense.h
@@ -0,0 +1,64 @@
+#pragma once
+
+enum LicenseKey_Status {
+	LicenseKey_NotConnected = 0,	// 楷搬 救凳
+	LicenseKey_NotCertified,		// 牢刘 救凳
+	LicenseKey_NotActivated,		// 咀萍海捞记 救凳
+	LicenseKey_Activated			// 咀萍海捞记 凳
+};
+
+struct SLicenseStatus
+{
+	SLicenseStatus()
+	{
+		Reset();
+	}
+
+	void Reset()
+	{
+		nKeyStatus = LicenseKey_NotConnected;
+		nUsbID = 0;
+		strSerialNo = L"";
+	}
+
+	bool operator==(const SLicenseStatus &rhs)
+	{
+		return (this->nKeyStatus == rhs.nKeyStatus);
+	}
+
+	int	nKeyStatus;
+	unsigned int nUsbID;
+	CString  strSerialNo;
+	CTime expTime;
+};
+
+interface IWorkerUpdateLicense2Parent
+{
+	virtual void IWUL2P_LicenceStatus(int nIndex, const SLicenseStatus& sStatus) = 0;
+};
+
+class CWorker_UpdateLicense
+{
+public:
+	CWorker_UpdateLicense(int nIndex, IWorkerUpdateLicense2Parent *pIWUS2P, DWORD dwTick=1000);
+	virtual ~CWorker_UpdateLicense();
+
+	virtual BOOL StartThread();
+	virtual void StopThread();
+
+
+	static UINT UpdateLicense(LPVOID pParam);
+	UINT Update_License_Func();
+
+protected:
+	virtual void Update_License();
+
+protected:
+	int								m_nIndex;
+	DWORD							m_dwTick;
+	BOOL							m_bUpdate;
+	HANDLE							m_hThreadDone;
+	IWorkerUpdateLicense2Parent*	m_pIWUL2P;
+	SLicenseStatus					m_sStatus;
+};
+
diff --git a/ENRIT/Light/ExternLightControl.cpp b/ENRIT/Light/ExternLightControl.cpp
new file mode 100644
index 0000000..efd398a
--- /dev/null
+++ b/ENRIT/Light/ExternLightControl.cpp
@@ -0,0 +1,43 @@
+// ExternLightControl.cpp: implementation of the CExternLightControl class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ExternLightControl.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CExternLightControl::CExternLightControl()
+{
+	m_nLightValue = 0;
+}
+
+CExternLightControl::~CExternLightControl()
+{
+//	CloseControl();
+}
+
+int CExternLightControl::Hex2Integer(const CString strHex, const int iCount)
+{
+	CString str = strHex.Left(iCount);
+	
+	CString hex(_T("0123456789abcdef"));
+	
+	int		cnv = 1;    
+	int     dec = 0;
+	
+	for(int i=0 ; i<str.GetLength() ; i++)
+	{
+		dec += hex.Find(str.GetAt(str.GetLength()-1-i))*cnv;
+		cnv *= 16;
+	}
+	return dec;
+}
diff --git a/ENRIT/Light/ExternLightControl.h b/ENRIT/Light/ExternLightControl.h
new file mode 100644
index 0000000..fd5e395
--- /dev/null
+++ b/ENRIT/Light/ExternLightControl.h
@@ -0,0 +1,42 @@
+// ExternLightControl.h: interface for the CExternLightControl class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_EXTERNLIGHTCONTROL_H__28B165BE_71B7_4AF2_A966_BD8694FDD522__INCLUDED_)
+#define AFX_EXTERNLIGHTCONTROL_H__28B165BE_71B7_4AF2_A966_BD8694FDD522__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define MAX_LAMP_CHANNEL 8
+
+//#define STATUS_RETURN_LENGTH 7
+
+class CExternLightControl  
+{
+public:
+	CExternLightControl();
+	virtual ~CExternLightControl();
+
+	virtual BOOL				OpenControl(int nPort) =0;
+	virtual BOOL				CloseControl() =0;
+	virtual BOOL				SetLightControlValue(int nChannel, int nValue) =0;
+	virtual BOOL				IsOpened() =0 ;//						{ return m_hLightControl ? TRUE : FALSE; }
+	
+//	virtual int					EnumLampTurnOn() = 0;
+	int							Hex2Integer(const CString strHex, const int iCount);
+	virtual BOOL				IsTurnOnLamp(int iIdxChannel) = 0;
+	virtual BOOL				TurnOnOffLamp(int nChannel,BOOL bOn) = 0;
+	//{ if (iIdxChannel >=0 && iIdxChannel < MAX_LAMP_CHANNEL) return m_bStateTurnOn[iIdxChannel]; return FALSE; }
+
+	HANDLE						GetConnHandle() { return m_hLightControl; }
+
+	int					m_nIndex;
+	HANDLE				m_hLightControl;
+	int					m_nPort;
+protected:
+	int					m_nLightValue;	
+};
+
+#endif // !defined(AFX_EXTERNLIGHTCONTROL_H__28B165BE_71B7_4AF2_A966_BD8694FDD522__INCLUDED_)
diff --git a/ENRIT/Light/ExternLightControlAKPNV.cpp b/ENRIT/Light/ExternLightControlAKPNV.cpp
new file mode 100644
index 0000000..485e8c2
--- /dev/null
+++ b/ENRIT/Light/ExternLightControlAKPNV.cpp
@@ -0,0 +1,137 @@
+
+#include "stdafx.h"
+#include "ExternLightControlAKPNV.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+#define ASCII_LF        0x0A
+#define ASCII_CR        0x0D
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CExternLightControlAKPNV::CExternLightControlAKPNV()
+{
+	m_hLightControl = NULL;
+}
+
+CExternLightControlAKPNV::~CExternLightControlAKPNV()
+{
+	CloseControl();
+}	
+
+BOOL CExternLightControlAKPNV::OpenControl(int nPort)
+{
+	m_nPort = nPort;
+	
+	DCB dcb;
+
+	CString strPort;
+	strPort.Format(_T("COM%d"), nPort);
+	
+	m_hLightControl = CreateFile( strPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
+
+	if (m_hLightControl == INVALID_HANDLE_VALUE)
+	{
+		CloseHandle(m_hLightControl);
+		m_hLightControl = NULL;
+		return FALSE;
+	}
+	
+	dcb.DCBlength = sizeof(DCB);
+	if (GetCommState(m_hLightControl,(LPDCB) &dcb))
+	{
+		dcb.DCBlength		= sizeof(DCB);
+		dcb.BaudRate		= CBR_9600;
+		dcb.ByteSize		= 8;
+		dcb.fParity			= FALSE;
+		dcb.Parity			= NOPARITY;
+		//		dcb.StopBits		= 1;
+		dcb.fOutxCtsFlow	= 0;
+		dcb.fOutxDsrFlow	= 0;
+		dcb.fOutX			= 0;
+		dcb.fInX			= 0;
+		
+		if (!SetCommState(m_hLightControl,(LPDCB) &dcb))
+		{
+			CloseHandle(m_hLightControl);
+			m_hLightControl = NULL;
+			return FALSE;
+		}
+	}
+	else
+	{
+		CloseHandle(m_hLightControl);
+		m_hLightControl = NULL;
+		return FALSE;
+	}	
+	
+	return TRUE;
+}
+
+BOOL CExternLightControlAKPNV::CloseControl()
+{
+	if (m_hLightControl)
+		CloseHandle(m_hLightControl);
+	m_hLightControl = NULL;
+	
+	return TRUE;
+}
+
+BOOL CExternLightControlAKPNV::SetLightControlValue(int nChannel, int nValue)
+{
+	if (nChannel < 0 || nChannel > MAX_LAMP_CHANNEL)
+		return FALSE;
+	if (!m_hLightControl)
+		return FALSE;
+	
+	int nHigh = nValue / 16;
+	int nLow = nValue % 16;
+
+	CString hex("0123456789ABCDEF");
+
+	char Data[50];
+	memset(&Data[0],0x00,sizeof(Data));	
+
+	sprintf_s(Data, "C%c%c%c%c%c", hex.GetAt(nChannel+1), hex.GetAt(nHigh), hex.GetAt(nLow), ASCII_CR, ASCII_LF);
+
+	DWORD NumberOfBytesWritten;
+
+	BOOL bRet = WriteFile( m_hLightControl,(LPCVOID) Data,6,(LPDWORD) &NumberOfBytesWritten,NULL);
+	
+	m_nLightValue = nValue;
+
+	return bRet;
+}
+
+BOOL CExternLightControlAKPNV::IsTurnOnLamp(int iIdxChannel)
+{
+	
+	return TRUE;
+}
+
+BOOL CExternLightControlAKPNV::TurnOnOffLamp(int nChannel,BOOL bOn)
+{
+	if (nChannel < 0 || nChannel > MAX_LAMP_CHANNEL)
+		return FALSE;
+	if (!m_hLightControl)
+		return FALSE;
+
+	char Data[50];
+	memset(&Data[0],0x00,sizeof(Data));
+
+	if(bOn == TRUE)
+		sprintf_s(Data, "AP11%c%c", ASCII_CR, ASCII_LF);
+	else
+		sprintf_s(Data, "AP00%c%c", ASCII_CR, ASCII_LF);
+
+	DWORD NumberOfBytesWritten;
+
+	BOOL bRet = WriteFile( m_hLightControl,(LPCVOID) Data,6,(LPDWORD) &NumberOfBytesWritten,NULL);
+	
+	return bRet;
+}
\ No newline at end of file
diff --git a/ENRIT/Light/ExternLightControlAKPNV.h b/ENRIT/Light/ExternLightControlAKPNV.h
new file mode 100644
index 0000000..69cd18e
--- /dev/null
+++ b/ENRIT/Light/ExternLightControlAKPNV.h
@@ -0,0 +1,23 @@
+
+#pragma once
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "ExternLightControl.h"
+
+class CExternLightControlAKPNV : public CExternLightControl
+{
+public:
+	CExternLightControlAKPNV();
+	virtual ~CExternLightControlAKPNV();
+
+	virtual BOOL				OpenControl(int nPort);
+	virtual BOOL				CloseControl();
+	virtual BOOL				SetLightControlValue(int nChannel, int nValue);
+	virtual BOOL				IsOpened()						{ return m_hLightControl ? TRUE : FALSE; }
+	virtual BOOL				IsTurnOnLamp(int iIdxChannel);
+	virtual BOOL				TurnOnOffLamp(int nChannel,BOOL bOn);
+};
+
diff --git a/ENRIT/Light/ExternLightControlLCP.cpp b/ENRIT/Light/ExternLightControlLCP.cpp
new file mode 100644
index 0000000..0fc04ca
--- /dev/null
+++ b/ENRIT/Light/ExternLightControlLCP.cpp
@@ -0,0 +1,138 @@
+
+#include "stdafx.h"
+#include "ExternLightControlLCP.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CExternLightControlLCP::CExternLightControlLCP()
+{
+	m_hLightControl = NULL;
+}
+
+CExternLightControlLCP::~CExternLightControlLCP()
+{
+	CloseControl();
+}	
+
+BOOL CExternLightControlLCP::OpenControl(int nPort)
+{
+	m_nPort = nPort;
+	
+	DCB dcb;
+
+	CString strPort;
+	strPort.Format(_T("COM%d"), nPort);
+	
+	m_hLightControl = CreateFile( strPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
+
+	if (m_hLightControl == INVALID_HANDLE_VALUE)
+	{
+		CloseHandle(m_hLightControl);
+		m_hLightControl = NULL;
+		return FALSE;
+	}
+	
+	dcb.DCBlength = sizeof(DCB);
+	if (GetCommState(m_hLightControl,(LPDCB) &dcb))
+	{
+		dcb.DCBlength		= sizeof(DCB);
+		dcb.BaudRate		= CBR_9600;
+		dcb.ByteSize		= 8;
+		dcb.fParity			= FALSE;
+		dcb.Parity			= NOPARITY;
+		//		dcb.StopBits		= 1;
+		dcb.fOutxCtsFlow	= 0;
+		dcb.fOutxDsrFlow	= 0;
+		dcb.fOutX			= 0;
+		dcb.fInX			= 0;
+		
+		if (!SetCommState(m_hLightControl,(LPDCB) &dcb))
+		{
+			CloseHandle(m_hLightControl);
+			m_hLightControl = NULL;
+			return FALSE;
+		}
+	}
+	else
+	{
+		CloseHandle(m_hLightControl);
+		m_hLightControl = NULL;
+		return FALSE;
+	}	
+	
+	return TRUE;
+}
+
+BOOL CExternLightControlLCP::CloseControl()
+{
+	if (m_hLightControl)
+		CloseHandle(m_hLightControl);
+	m_hLightControl = NULL;
+	
+	return TRUE;
+}
+
+BOOL CExternLightControlLCP::SetLightControlValue(int nChannel, int nValue)
+{
+	if (nChannel < 0 || nChannel > MAX_LAMP_CHANNEL)
+		return FALSE;
+	if (!m_hLightControl)
+		return FALSE;
+	
+
+	CString tmp;
+	char Outbuf[10];
+	DWORD NumberOfBytesWritten;
+			
+	//tmp.Format(_T("%c%cw%4.4u%c"), 0x02, nChannel+0x30, nValue, 0x03);
+	tmp.Format(_T("%c%cw%04d%c"), 0x02, nChannel+0x30, nValue, 0x03);
+	
+	int nLength = tmp.GetLength();
+	ZeroMemory(Outbuf,sizeof(char)*10);
+
+	sprintf_s(Outbuf,"%c%c%c%c%c%c%c%c",tmp.GetAt(0),tmp.GetAt(1),tmp.GetAt(2),tmp.GetAt(3),tmp.GetAt(4),tmp.GetAt(5),tmp.GetAt(6),tmp.GetAt(7));	
+	
+	BOOL bRet = WriteFile( m_hLightControl,(LPCVOID) Outbuf,8,(LPDWORD) &NumberOfBytesWritten,NULL);
+
+	m_nLightValue = nValue;
+
+	return bRet;
+}
+
+BOOL CExternLightControlLCP::IsTurnOnLamp(int iIdxChannel)
+{
+	
+	return TRUE;
+}
+
+BOOL CExternLightControlLCP::TurnOnOffLamp(int nChannel,BOOL bOn)
+{
+	if (nChannel < 0 || nChannel > MAX_LAMP_CHANNEL)
+		return FALSE;
+	if (!m_hLightControl)
+		return FALSE;
+
+	char Outbuf[10];
+	ZeroMemory(Outbuf,sizeof(char)*10);
+
+	Outbuf[0] = 0x02;
+	Outbuf[1] = nChannel+0x30;
+	if(bOn == TRUE)
+		Outbuf[2] = 'o';
+	else
+		Outbuf[2] = 'f';
+	Outbuf[3] = 0x03;
+
+	DWORD NumberOfBytesWritten;
+	BOOL bRet = WriteFile( m_hLightControl,(LPCVOID) Outbuf,4,(LPDWORD) &NumberOfBytesWritten,NULL);
+
+	return bRet;
+}
\ No newline at end of file
diff --git a/ENRIT/Light/ExternLightControlLCP.h b/ENRIT/Light/ExternLightControlLCP.h
new file mode 100644
index 0000000..dfd2555
--- /dev/null
+++ b/ENRIT/Light/ExternLightControlLCP.h
@@ -0,0 +1,23 @@
+
+#pragma once
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "ExternLightControl.h"
+
+class CExternLightControlLCP : public CExternLightControl
+{
+public:
+	CExternLightControlLCP();
+	virtual ~CExternLightControlLCP();
+
+	virtual BOOL				OpenControl(int nPort);
+	virtual BOOL				CloseControl();
+	virtual BOOL				SetLightControlValue(int nChannel, int nValue);
+	virtual BOOL				IsOpened()						{ return m_hLightControl ? TRUE : FALSE; }
+	virtual BOOL				IsTurnOnLamp(int iIdxChannel);
+	virtual BOOL				TurnOnOffLamp(int nChannel,BOOL bOn);
+};
+
diff --git a/ENRIT/Light/LightManager.cpp b/ENRIT/Light/LightManager.cpp
new file mode 100644
index 0000000..a02a0a7
--- /dev/null
+++ b/ENRIT/Light/LightManager.cpp
@@ -0,0 +1,199 @@
+
+#include "StdAfx.h"
+#include "ExternLightControlLCP.h"
+#include "ExternLightControlAKPNV.h"
+#include "LightManager.h"
+#include "HardwareSettings.h"
+
+CLightManager::CLightManager()
+{		
+	m_pParents = NULL;	
+	m_bNoUse_LightControl = FALSE;
+	m_pHardwareSetting = NULL;	
+}
+
+CLightManager::~CLightManager()
+{	
+	DisConnectControl();	
+}
+
+CExternLightControl	*CLightManager::GetIdxLight(int idx)
+{	
+	std::vector<CExternLightControl *>::iterator	it;
+	CExternLightControl *pLight = NULL;	
+	BOOL				bFind = FALSE;
+
+	for(it=m_vecLightControl.begin();it!=m_vecLightControl.end();it++)
+	{
+		pLight = *it;
+		if(pLight == NULL)
+			continue;
+
+		if(pLight->m_nIndex == idx)					
+		{
+			bFind = TRUE;
+			break;
+		}
+	}
+
+	if(bFind == FALSE)
+		pLight = NULL;
+
+	return pLight;
+	
+}
+
+void CLightManager::DisConnectControl()
+{
+	std::vector<CExternLightControl *>::iterator	it;
+	CExternLightControl	*pLight;	
+	
+	for(it=m_vecLightControl.begin();it!=m_vecLightControl.end();it++)
+	{
+		pLight = *it;
+		if(pLight == NULL)
+			continue;
+
+		pLight->CloseControl();
+		delete pLight,pLight=NULL;
+	}
+	m_vecLightControl.clear();		
+}
+
+void CLightManager::InitLightControl()
+{
+	SetLightPath();
+}
+
+void CLightManager::SetLightPath()
+{
+	m_ConfigLightValue.SetRegiConfig(NULL, NULL, LIGHT_CONTROL_FILE_PATH, FileMap_Mode);
+}
+
+BOOL CLightManager::ConnectToLight()
+{
+	if(m_pHardwareSetting == NULL)
+		return FALSE;	
+	
+	int						iCon;
+	CHardwareLightSettings *pLight;	
+	CExternLightControl		*pLingControl = NULL;
+	CString					strMsg;
+	int						nOldPort = -1;
+	
+	for(iCon=0;iCon<m_pHardwareSetting->m_nLightCount_Trans+m_pHardwareSetting->m_nLightCount_Reflect;iCon++)
+	{
+		pLight = m_pHardwareSetting->GetLightSettings(iCon);
+		if(pLight == NULL || nOldPort == pLight->m_nPort)
+			continue;
+
+		switch(pLight->m_emMaker)
+		{
+		case MAKER_LCP:
+			pLingControl = new CExternLightControlLCP;
+			strMsg.Format(_T("LCP Idx[%d]"),pLight->m_nIndex);
+			break;		
+		case MAKER_AKP:
+			pLingControl = new CExternLightControlAKPNV;
+			strMsg.Format(_T("AKP Idx[%d]"),pLight->m_nIndex);
+			break;	
+		default:
+			continue;
+		}
+
+		if(pLingControl == NULL)
+			continue;
+
+		pLingControl->m_nIndex = pLight->m_nIndex;
+
+		if(pLingControl->OpenControl(pLight->m_nPort) == TRUE)
+		{
+			g_pLog->DisplayMessage(_T("Light controller %s connection success : Port[%d]"),strMsg,pLight->m_nPort);
+			//TRACE("炼疙 %s 楷搬 己傍 : Port[%d]\n",strMsg,pLight->m_nPort);
+			nOldPort = pLight->m_nPort;
+		}
+		else
+		{
+			g_pLog->DisplayMessage(_T("Light controller %s connection fail : Port[%d]"),strMsg,pLight->m_nPort);
+			//TRACE("炼疙 %s 楷搬 角菩 : Port[%d]\n",strMsg,pLight->m_nPort);
+		}
+
+		m_vecLightControl.push_back(pLingControl);		
+	}
+	
+	return TRUE;
+}
+
+BOOL CLightManager::SetLightControlValue(CString strRecipe,int iCon,int iCh,LIGHT_TYPE enType,BOOL bAuto,int nControlVal)
+{	
+	CString		strName,strType;
+
+	CExternLightControl *pLight = GetIdxLight(iCon);
+	if(pLight == NULL)
+		return FALSE;
+
+	if(pLight->SetLightControlValue(iCh,nControlVal) == FALSE)
+		return FALSE;
+
+	enType = LIGHT_TYPE_REF;
+	switch(enType)
+	{
+	case LIGHT_TYPE_REF:
+		strType = "R";
+		break;
+	case LIGHT_TYPE_TRANS:
+		strType = "T";
+		break;
+	default:
+		return FALSE;
+	}
+
+	if(bAuto == TRUE)
+		strName.Format(_T("%s_CON[%d]_CH[%d]_AUTO_%s"),strRecipe,iCon,iCh,strType);
+	else
+		strName.Format(_T("%s_CON[%d]_CH[%d]_MANUAL_%s"),strRecipe,iCon,iCh,strType);
+
+	m_ConfigLightValue.SetItemValue((TCHAR*)(LPCTSTR)strName, nControlVal);
+
+	return TRUE;
+}
+
+int	CLightManager::GetLightControlValue(CString strRecipe,int iCon,int iCh,LIGHT_TYPE enType,BOOL bAuto)
+{
+	int			nControlVal = -1;
+	CString		strName,strType;
+
+	switch(enType)
+	{
+	case LIGHT_TYPE_REF:
+		strType = "R";
+		break;
+	case LIGHT_TYPE_TRANS:
+		strType = "T";
+		break;
+	default:
+		return nControlVal;
+	}
+
+	if(bAuto == TRUE)
+		strName.Format(_T("%s_CON[%d]_CH[%d]_AUTO_%s"),strRecipe,iCon,iCh,strType);
+	else
+		strName.Format(_T("%s_CON[%d]_CH[%d]_MANUAL_%s"),strRecipe,iCon,iCh,strType);
+	
+	m_ConfigLightValue.GetItemValue((TCHAR*)(LPCTSTR)strName, nControlVal, -1);
+
+	return nControlVal;
+}
+
+BOOL CLightManager::LampTurnOnOff(int iCon,int iCh, BOOL bOn)
+{
+	CExternLightControl *pLight = GetIdxLight(iCon);
+	if(pLight == NULL)
+		return FALSE;
+
+	if(pLight->TurnOnOffLamp(iCh,bOn) == FALSE)
+		return FALSE;
+
+
+	return TRUE;
+}
\ No newline at end of file
diff --git a/ENRIT/Light/LightManager.h b/ENRIT/Light/LightManager.h
new file mode 100644
index 0000000..14f570d
--- /dev/null
+++ b/ENRIT/Light/LightManager.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <vector>
+#include "ExternLightControl.h"
+#include "Global_Define.h"
+
+#define LIGHT_CONTROL_FILE_PATH		_T("C:\\RCutProject\\Config\\LightValue.cfg")
+
+class CHardwareSettings;
+class CLightManager
+{
+public:
+	CLightManager(void);
+	~CLightManager(void);
+
+public:
+	void			InitLightControl();
+	void			SetParents(CWnd *pWnd){m_pParents=pWnd;}
+	void			SetHardware(CHardwareSettings *pLight){m_pHardwareSetting=pLight;}	
+	BOOL			ConnectToLight();
+	void			DisConnectControl();
+	void			SetLightPath();
+	CExternLightControl	*GetIdxLight(int idx);
+	BOOL			GetLightNoUseAutoControl(){return m_bNoUse_LightControl;}
+
+public:	
+	int				GetLightControlValue(CString strRecipe,int iCon,int iCh,LIGHT_TYPE enType,BOOL bAuto);
+	BOOL			SetLightControlValue(CString strRecipe,int iCon,int iCh,LIGHT_TYPE enType,BOOL bAuto,int nControlVal);	
+	BOOL			LampTurnOnOff(int iCon,int iCh, BOOL bOn);
+
+protected:
+	std::vector<CExternLightControl *>	m_vecLightControl;		
+	CConfig					m_ConfigLightValue;		// 炼疙 汲沥蔼阑 扁撅窍绰 Config File
+	CWnd					*m_pParents;		
+	CHardwareSettings		*m_pHardwareSetting;	
+
+protected:
+	BOOL					m_bNoUse_LightControl;	
+};
\ No newline at end of file
diff --git a/ENRIT/MainFrm.cpp b/ENRIT/MainFrm.cpp
new file mode 100644
index 0000000..1db8ef5
--- /dev/null
+++ b/ENRIT/MainFrm.cpp
@@ -0,0 +1,727 @@
+
+// MainFrm.cpp : CMainFrame 努贰胶狼 备泅
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "MainFrm.h"
+#include "HardwareSettings.h"
+#include "io.h"
+#include "MulticamControl.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+// CMainFrame
+#define TOTAL_WINDOW_SIZE_X		1920
+#define TOTAL_WINDOW_SIZE_Y		1040
+
+#define ID_TIMER_INITDONE		1001
+
+IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
+
+BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
+	ON_WM_CREATE()
+	ON_WM_TIMER()
+	ON_WM_GETMINMAXINFO()
+END_MESSAGE_MAP()
+
+// CMainFrame 积己/家戈
+
+CMainFrame::CMainFrame()
+{
+	m_pView = NULL;
+	m_bManualProcessStart = FALSE;	
+
+}
+
+CMainFrame::~CMainFrame()
+{
+	
+}
+
+int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
+		return -1;
+	 	
+	g_pLog->SetDM2P(static_cast<IDisplyMessage2Parent*>(this));
+	ModifyStyle(WS_CAPTION, NULL);
+
+	SetMenu(NULL);	
+
+	return 0;
+}
+
+BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+	if( !CFrameWnd::PreCreateWindow(cs) )
+		return FALSE;
+
+	cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE;
+	cs.style = cs.style & ~FWS_ADDTOTITLE;
+	cs.x = 0;
+	cs.y = 0;
+	cs.cx = TOTAL_WINDOW_SIZE_X;
+	cs.cy = TOTAL_WINDOW_SIZE_Y;
+	cs.lpszName = _T("RCutInspection");
+	this->SetTitle(_T("RCutInspection"));
+
+	return TRUE;
+}
+
+// CMainFrame 皋矫瘤 贸府扁
+void CMainFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+	//CFrameWndEx::OnGetMinMaxInfo(lpMMI);
+
+	lpMMI->ptMinTrackSize.x = TOTAL_WINDOW_SIZE_X;
+	lpMMI->ptMinTrackSize.y = TOTAL_WINDOW_SIZE_Y;
+
+	lpMMI->ptMaxTrackSize.x = TOTAL_WINDOW_SIZE_X;
+	lpMMI->ptMaxTrackSize.y = TOTAL_WINDOW_SIZE_Y;
+}
+
+// CMainFrame 柳窜
+
+#ifdef _DEBUG
+void CMainFrame::AssertValid() const
+{
+	CFrameWnd::AssertValid();
+}
+
+void CMainFrame::Dump(CDumpContext& dc) const
+{
+	CFrameWnd::Dump(dc);
+}
+#endif //_DEBUG
+
+
+// CMainFrame 皋矫瘤 贸府扁
+void CMainFrame::SetView(CENRITView	*pView)
+{
+	m_pView = pView;
+	if(NULL != m_pView)
+	{
+		m_pView->CreateChildView();
+		m_pView->SetV2M(static_cast<IViewInterface2Parent*>(this));		
+	}
+
+	m_splash.SetBitmap(IDB_SPLASH);
+	m_splash.SetTransparentColor(RGB(128,128,128));
+
+	SetTimer(ID_TIMER_INITDONE, 500, NULL);	
+}
+
+void CMainFrame::OnTimer(UINT_PTR nIDEvent) 
+{		
+	switch(nIDEvent)
+	{
+	case ID_TIMER_INITDONE:
+		KillTimer(ID_TIMER_INITDONE);
+		Timer_InitDone();
+		break;			
+	}
+
+	CFrameWnd::OnTimer(nIDEvent);
+}
+
+void CMainFrame::Timer_InitDone()
+{
+	g_pLog->DisplayMessage(_T("** Run Inspector **[%s %s]"), _T(__DATE__), _T(__TIME__));
+
+	if(CheckExpireDay() == FALSE)
+	{
+		//g_pLog->DisplayMessage(_T("*** SIS Confirm Exit"));	
+		ExitProcess(0);
+		//AfxGetMainWnd()->SendMessage(WM_CLOSE);
+		return;
+	}
+
+	// For Debug
+	//SetSlashText(GLOBAL_DEFINE::emShow, _T(""), RGB(0,0,0));
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("System Initializing .."), RGB(0,0,0));
+
+	ReadHardwareSetting();	
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Read Hardware Setting Complete"), RGB(0,0,0));
+
+	g_pBase->ReadInspectConfigFile(INSPECTBASE_FILENAME,m_HardwareRecipe.GetCameraCount());
+	
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Read Inspect Confie Complete"), RGB(0,0,0));
+
+	InterfaceInit();
+
+	CString			strRecipeName;	
+
+	GetRegistryRcpName(strRecipeName);
+	if(LoadGlassRecipe(strRecipeName,TRUE) == TRUE)
+	{
+		SetRegistryRcpName(strRecipeName);		
+	}	
+	
+	ApplyViewRecipeSettingss();
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Read Recipe Complete"), RGB(0,0,0));
+
+	g_pLog->DisplayMessage(_T("Start Process Completed"));
+
+	Sleep(1000);
+
+	HINSTANCE hViewer = ShellExecute(NULL, _T("open"), _T("C:\\RCutProject\\LogView.exe"), NULL, NULL, SW_SHOWNORMAL);
+
+	hViewer = ShellExecute(NULL, _T("open"), _T("C:\\RCutProject\\PLCConnector.exe"), NULL, NULL, SW_SHOWNORMAL);
+
+	SetSlashText(GLOBAL_DEFINE::emHide, _T(""), RGB(0,0,0));
+}
+
+BOOL CMainFrame::GetRegistryRcpName(CString& strRecipe)
+{
+	CConfig RegiSetting;
+
+	RegiSetting.SetRegiConfig(SHCU, KEY_BASIC, NULL, Registery_mode);
+	RegiSetting.GetItemValue(_T("RECIPE_CURRENT"), strRecipe);
+	
+	return TRUE;
+}
+
+void CMainFrame::SetRegistryRcpName(CString strRecipe)
+{
+	CConfig RegiSetting;
+
+	RegiSetting.SetRegiConfig(SHCU, KEY_BASIC, NULL, Registery_mode);
+	RegiSetting.SetItemValue(_T("RECIPE_CURRENT"), (TCHAR*)(LPCTSTR)strRecipe);	
+}
+
+void CMainFrame::CommandExitButtonClick()
+{
+	DestroyThread();	
+
+	AfxGetMainWnd()->PostMessage(WM_COMMAND,ID_APP_EXIT,0);		
+}
+
+
+void CMainFrame::MapDefect_ReqDefectImage(CInspectDefect* pDefect,int nGlassDefectIdx)
+{
+
+}
+
+CDefect *CMainFrame::ListDefect_ReqDefectImage(CInspectDefect* pDefect,int nGlassDefectIdx)
+{
+	if(pDefect == NULL || nGlassDefectIdx < 0)
+	{
+		g_pLog->DisplayMessage(_T("List Request Defect Image Fail : Data is Null"));
+		return NULL;
+	}
+
+	if(pDefect->m_nCameraID < 0 || pDefect->m_nCameraID >= m_HardwareRecipe.GetCameraCount())
+		return NULL;
+
+	//return m_pInspectSequence->GetDefectData(pDefect->m_nCameraID,pDefect->m_nDefectIdx);
+
+	return NULL;
+}
+
+void CMainFrame::IV2M_InitView(Init_View_Command eVew)
+{
+	m_GlassData.ResetGlass();
+
+	m_pView->InitView(eVew);	
+}
+
+void CMainFrame::ApplyViewRecipeSettingss()
+{
+	if(m_pView == NULL)
+		return;
+
+	m_pView->SetHardwareSetting(&m_HardwareRecipe);
+	m_pView->SetRecipeSettings(&m_GlassRecipe);
+	m_pView->SetGlassData(&m_GlassData);
+	m_pView->SetTransferData(&m_TransferData);
+}
+
+BOOL CMainFrame::IV2M_RecipeChange(CString strRecipe)
+{
+	m_strReserveRecipe.Empty();
+
+	if(!IsScanNow())		// 八荤 吝
+	{				
+		if(LoadGlassRecipe(strRecipe,TRUE) == TRUE)
+		{
+			SetRegistryRcpName(strRecipe);
+			g_pLog->DisplayMessage(_T("Apply Recipe by RecipeView Success : [%s]"), strRecipe);
+			//ApplyViewRecipeSettingss();
+		}
+		else
+		{
+			g_pLog->DisplayMessage(_T("Apply Recipe by RecipeView Fail: [%s]"), strRecipe);
+		}
+	}
+	else
+	{
+		g_pLog->DisplayMessage(_T("Reserve Recipe application by RecipeView : [%s]"), strRecipe);
+		m_strReserveRecipe = strRecipe;
+	}
+
+	return TRUE;
+}
+
+BOOL CMainFrame::IV2M_SaveFullImage(CString strPath,int iSide,CPoint ptStart,int nLength)
+{
+	if(IsScanNow())
+	{
+		g_pLog->DisplayMessage(_T("Doing Inspection"));
+		return TRUE;
+	}
+
+	SetSlashText(GLOBAL_DEFINE::emShow, _T(""), RGB(0,0,0));
+
+	//SetSlashText(GLOBAL_DEFINE::emText, _T("Image Save Start"), RGB(0,0,0));
+
+	BOOL bRet = SaveFullImage(strPath,iSide,ptStart,nLength);
+
+	SetSlashText(GLOBAL_DEFINE::emText, strPath, RGB(0,0,0));
+
+	SetSlashText(GLOBAL_DEFINE::emHide, _T(""), RGB(0,0,0));
+
+	return bRet;
+}
+
+BOOL CMainFrame::IV2M_InspectionProcessAll(int iProceMode)
+{
+	if(IsScanNow())
+	{
+		g_pLog->DisplayMessage(_T("Doing Inspection"));
+		return FALSE;
+	}
+
+	switch(iProceMode)
+	{
+	case 0: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_SIDELONG; break;
+	case 1: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_SIDESHORT; break;
+	case 2: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_ALL; break;
+	}
+
+	AfxBeginThread(ManualInspectProcess,this);
+
+	return TRUE;
+}
+
+UINT CMainFrame::ManualInspectProcess(LPVOID pParam)
+{
+	CMainFrame		*pMain = (CMainFrame *)pParam;
+
+	pMain->SetInspectionEnd();
+
+	DWORD dwTick = GetTickCount();
+	DWORD dwWaitTick;
+	DWORD dwWaitTime = 3000;
+
+	while(TRUE)
+	{
+		Sleep(0);
+
+		dwWaitTick = GetTickCount() - dwTick;
+		if(dwWaitTime < dwWaitTick)
+			break;
+
+		if(pMain->IsScanNow())		
+			continue;	
+		else
+			break;
+	}
+
+	if(pMain->IsScanNow())
+	{
+		g_pLog->DisplayMessage(_T("Doing Inspection"));
+		return 0;
+	}
+
+	DWORD		tTime = GetTickCount();
+	int			iScan = 0;
+	int			iScanEnd = 0;
+	int			iCam = 0;
+	double		dOneScanTime = (pMain->m_GlassRecipe.m_GlassParm.GetOneScanTime()*1000);	
+	
+	pMain->InitLoadingProcess();	
+	pMain->m_GlassData.SetScanStart(TRUE);
+	pMain->m_GlassData.SetLoadingTime();
+	pMain->m_GlassData.SetScanStartTime();	
+		  
+	g_pBase->m_strRecipeName = pMain->m_GlassRecipe.GetRecipeName();
+	g_pBase->m_strLoadingDay = pMain->m_GlassData.GetLoadingDayFileName();
+	g_pBase->m_strLoadingTime = pMain->m_GlassData.GetLoadingTimeFileName();
+
+	g_pBase->m_strHPanelID = _T("Manual");
+
+	switch(g_pBase->m_eProcessMode)
+	{
+	case PROC_MODE_SIMULATION_ONESIDE:
+		{				
+			pMain->m_GlassData.SetScanStartCount(1);			
+			int iCam = pMain->m_HardwareRecipe.GetCameraIndexToDimension(pMain->m_eManualInspectSide);
+			int iScan = pMain->m_HardwareRecipe.GetScanToDimension(pMain->m_eManualInspectSide);
+			
+			pMain->SendGlassRecipe(); 			
+ 			pMain->ScanStartGrabManual(iCam,iScan);			
+ 			pMain->ScanStartManual(iCam,iScan);	
+		}
+		break;
+	case PROC_MODE_SIMULATION_SIDESHORT:
+		{			
+			pMain->m_GlassData.SetScanStartCount(MAX_CAMERA_COUNT);
+			pMain->SendGlassRecipe();
+			for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+			{					
+				pMain->ScanStartGrabManual(iCam,0);
+				pMain->ScanStartManual(iCam,0);						
+			}
+		}
+		break;
+	case PROC_MODE_SIMULATION_SIDELONG:
+		{				
+			pMain->m_GlassData.SetScanStartCount(MAX_CAMERA_COUNT);
+			pMain->SendGlassRecipe();
+			for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+			{					
+				pMain->ScanStartGrabManual(iCam,1);
+				pMain->ScanStartManual(iCam,1);				
+			}
+		}
+		break;
+	case PROC_MODE_SIMULATION_ALL:
+		{
+			g_pLog->DisplayMessage(_T("Simulation Full "));						
+			pMain->m_GlassData.SetScanStartCount(MAX_DIMENSION_COUNT);
+			pMain->SendGlassRecipe();
+			for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+			{				
+				pMain->ScanStartGrabManual(iCam,0);
+				pMain->ScanStartGrabManual(iCam,1);
+			}
+
+			if(pMain->m_pThread_CheckSequence != NULL)		
+			{
+				double dOneScanTime = pMain->m_GlassRecipe.m_GlassParm.GetOneScanTime();
+				
+				pMain->m_pThread_CheckSequence->AddCheckSeqMSG(CHECKSEQ_GLASS_INSPECTION_OVERTIME,(int)(dOneScanTime* 1000.),pMain->m_HardwareRecipe.GetScanCount()-1);	
+
+				g_pLog->DisplayMessage(_T("Simulation Time Out Set : %.1f"),dOneScanTime);
+			}
+
+			for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+			{
+				pMain->ScanStartManual(iCam,0);						
+			}			
+
+			DWORD		sTime = GetTickCount();
+			while(TRUE)
+			{
+				if(pMain->m_GlassData.GetScanEnd(0) == TRUE)
+					break;
+
+				if(GetTickCount() - sTime >= 5000)
+					break;
+			
+				Sleep(10);
+			}
+
+			for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+			{
+				pMain->ScanStartManual(iCam,1);						
+			}	
+		}
+		break;
+	}
+	
+	return 0;
+
+}
+
+std::multimap<int, CPoint *> *CMainFrame::IF2M_GetCADProfileLine(int iSide,int vStart,int vEnd)
+{
+	CSingleLock		csLock(&m_csProfile);
+	csLock.Lock();
+
+	if((int)m_mapAlignProfile[iSide].size() <= 0)
+		return NULL;
+
+	int		iCam,iScan;
+	CCameraSettings *pCamera = NULL;	
+
+	for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++)
+	{		
+		for(iScan=0;iScan<MAX_SCAN_COUNT;iScan++)
+		{
+			pCamera = m_HardwareRecipe.GetCameraSettings(iCam,iScan);
+			if(pCamera == NULL)
+				continue;			
+
+			if(pCamera->m_eDimension == iSide)
+			{
+				std::multimap<int, CPoint *> *pCamMapAlign = m_pInspect[iCam]->GetProfileAlign(iScan);
+
+				if((int)pCamMapAlign->size() != (int)m_mapAlignProfile[iSide].size())
+				{
+					CSingleLock		csLock(&m_csProfile);
+					csLock.Lock();
+					m_mapAlignProfile[iSide].clear();
+					m_mapAlignProfile[pCamera->m_eDimension].insert(pCamMapAlign->begin(),pCamMapAlign->end());
+					csLock.Unlock();
+				}
+			}
+		}
+	}
+
+	std::multimap<int, CPoint *>::iterator	it,itEnd;	
+
+	it = m_mapAlignProfile[iSide].lower_bound(vStart);	
+
+	if (it == m_mapAlignProfile[iSide].end())
+		return NULL;
+
+	csLock.Unlock();
+
+	return &m_mapAlignProfile[iSide];
+}
+
+BOOL CMainFrame::IV2M_InspectionProcess(DimensionDir eDim)
+{
+	if(IsScanNow())
+	{
+		g_pLog->DisplayMessage(_T("Doing Inspection"));
+		return FALSE;
+	}
+
+	g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_ONESIDE;
+	m_eManualInspectSide = eDim;
+
+	// 烙矫肺 阜澜
+	//return TRUE;
+
+	AfxBeginThread(ManualInspectProcess,this);
+
+	return TRUE;
+}
+
+void CMainFrame::MLight_OnOff(int iCon,int iCh,BOOL bValue)
+{
+	// 	if(IsScanNow())
+	// 	{
+	// 		g_pLog->DisplayMessage(_T("Doing Inspection"));
+	// 		return;
+	// 	}
+
+	if(m_pLightManager == NULL)
+		return;
+
+	m_pLightManager->LampTurnOnOff(iCon, iCh, bValue);
+}
+
+
+int	CMainFrame::MLight_GetLightControlValue(int iCon,int iCh, BOOL bRef)
+{
+	// 	if(IsScanNow())
+	// 	{
+	// 		g_pLog->DisplayMessage(_T("Doing Inspection"));
+	// 		return 0;
+	// 	}
+
+	if(m_pLightManager == NULL)
+		return 0;
+
+	return m_pLightManager->GetLightControlValue(m_GlassRecipe.GetRecipeName(),iCon, iCh,(LIGHT_TYPE)bRef,TRUE);
+}
+
+BOOL CMainFrame::MLight_SetLightControlValue(int iCon,int iCh, int nValue, BOOL bRef, int nScanIdx, BOOL bAdjLight)
+{
+	// 	if(IsScanNow())
+	// 	{
+	// 		g_pLog->DisplayMessage(_T("Doing Inspection"));
+	// 		return TRUE;
+	// 	}
+
+	if(m_pLightManager == NULL)
+		return FALSE;
+
+	BOOL	bRet = m_pLightManager->SetLightControlValue(m_GlassRecipe.GetRecipeName(),iCon, iCh, (LIGHT_TYPE)bRef,TRUE, nValue);
+
+	return bRet;
+}
+
+BOOL CMainFrame::IV2M_SetLiveGrabCommand(DimensionDir eDim,BOOL bStop)
+{
+	// 	if(IsScanNow())
+	// 	{
+	// 		g_pLog->DisplayMessage(_T("Doing Inspection"));
+	// 		return TRUE;
+	// 	}
+
+	// 4/13 MiniLED
+	//if(eDim < DIMENSION_A || eDim > DIMENSION_D)
+	//	return FALSE;
+
+	g_pLog->DisplayMessage(_T("Live Cam %d Start : Main"),(int)eDim);	
+
+	BOOL		bRet = SetLiveGrabCommand(eDim,bStop);
+
+	g_pLog->DisplayMessage(_T("Live Cam %d End : Main"),(int)eDim);
+
+	return bRet;
+}
+
+LPBYTE CMainFrame::IV2M_GetGrabBufferByDimension(DimensionDir eDim,int iVline)
+{
+	// 	if(IsScanNow())
+	// 	{
+	// 		g_pLog->DisplayMessage(_T("Doing Inspection"));
+	// 		return NULL;
+	// 	}	
+
+	if(eDim < DIMENSION_A || eDim > DIMENSION_D_DN)
+		return NULL;
+	if(iVline < 0)
+		return NULL;
+
+	return GetGrabBuffer(eDim,iVline);
+}
+
+void CMainFrame::IV2M_LoadImageFullFile(int iSide, CGlass_Data *pGlassData, std::function<void(BYTE)> _Func)
+{
+	if(IsScanNow())
+	{
+		g_pLog->DisplayMessage(_T("Doing Inspection"));
+		return;
+	}
+
+	if(m_bManualProcessStart == TRUE)
+	{
+		g_pLog->DisplayMessage(_T("Doing Manual Process"));
+		return;
+	}
+
+	m_bManualProcessStart = TRUE;
+
+	CString strPath,strGlassID;
+	TCHAR szFilter[] = _T("Image Files(*.bmp;,*.jpg) |*.bmp;*.jpg;|All File (*.*)| *.*||");
+	CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter,AfxGetMainWnd());
+
+	int nStartY = 0, nHeight = 0;
+	if(dlg.DoModal() == IDOK)
+	{
+		SetSlashText(GLOBAL_DEFINE::emShow, _T(""), RGB(0,0,0));
+
+		SetSlashText(GLOBAL_DEFINE::emText, _T("Image Loading Start"), RGB(0,0,0));
+
+		if(iSide > -1)
+		{
+
+			CString strGlsID, strTmp , strExt;
+
+			strExt	 = dlg.GetFileExt();
+			strGlsID = dlg.GetFileName();
+			strGlsID = strGlsID.Left(strGlsID.Find(_T("__")));			
+
+			g_pBase->m_strHPanelID = strGlsID;
+			strTmp = dlg.GetPathName();
+			strTmp = strTmp.Left( strTmp.ReverseFind(_T('\\')));
+
+			char str_filename[200];
+
+			for(int i = 0 ; i < 6 ; i++)
+			{
+				strPath.Format(_T("%s\\%s__%s_%d.%s"),strTmp,strGlsID,PANEL_SIDE[iSide],i,strExt);
+				USES_CONVERSION;					
+				sprintf_s(str_filename, "%s", W2A(strPath));
+				if(access(str_filename, 0) == 0)
+				{
+					nHeight = LoadFullImage(strPath,iSide,nStartY);
+					if(nHeight == -1)
+						break;
+					nStartY += nHeight;
+				}
+				else
+					break;
+			}
+
+			if(pGlassData != NULL)
+			{
+				INS_EDGE_RESULT_INFO *pResInfo = pGlassData->GetEdgeResultInfo((DimensionDir)iSide);
+				if(pResInfo != NULL)
+				{
+					pResInfo->nGlassStartLine = 0;
+					pResInfo->nGlassEndLine = nStartY;
+				}
+
+			}
+
+			if(_Func != nullptr)
+			{
+				_Func(iSide);
+			}			
+		}
+		else
+		{
+
+			CString strGlsID, strTmp , strExt;
+
+			strExt	 = dlg.GetFileExt();
+			strGlsID =dlg.GetFileName();
+			strGlsID = strGlsID.Left(strGlsID.Find(_T("__")));
+			g_pBase->m_strHPanelID = strGlsID;
+
+			char str_filename[200];
+			for(int i = 0; i < MAX_PANEL_SIDE * UPDN_TYPE; i++)
+			{
+				strTmp = dlg.GetPathName();
+				strTmp = strTmp.Left( strTmp.ReverseFind(_T('\\')));
+
+				nStartY = 0, nHeight = 0;
+
+				for(int j = 0 ; j < 6 ; j++)
+				{
+					strPath.Format(_T("%s\\%s__%s_%d.%s"),strTmp,strGlsID,PANEL_SIDE[i],j,strExt);
+
+					USES_CONVERSION;					
+					sprintf_s(str_filename, "%s", W2A(strPath));
+					if(access(str_filename, 0) == 0)
+					{
+						nHeight = LoadFullImage(strPath,i,nStartY);
+						if(nHeight == -1)
+							break;
+						nStartY += nHeight;
+					}					
+					else
+						break;
+				}
+
+				if(pGlassData != NULL)
+				{
+					INS_EDGE_RESULT_INFO *pResInfo = pGlassData->GetEdgeResultInfo((DimensionDir)i);
+					if(pResInfo != NULL)
+					{
+						pResInfo->nGlassStartLine = 0;
+						pResInfo->nGlassEndLine = nStartY;
+					}
+
+				}
+				if(_Func != nullptr)
+				{					
+					_Func(i);
+				}
+			}
+		}
+		SetSlashText(GLOBAL_DEFINE::emHide, _T("Loading Full Image Completed"), RGB(0,0,0));
+	}
+
+	m_bManualProcessStart = FALSE;
+	g_pLog->DisplayMessage(_T("Loading Full Image Completed"));	
+}
+
+void CMainFrame::DisplayMessage(TCHAR* str)
+{
+	WriteLogManager(str);
+}
\ No newline at end of file
diff --git a/ENRIT/MainFrm.h b/ENRIT/MainFrm.h
new file mode 100644
index 0000000..0b59b86
--- /dev/null
+++ b/ENRIT/MainFrm.h
@@ -0,0 +1,82 @@
+
+// MainFrm.h : CMainFrame 努贰胶狼 牢磐其捞胶
+//
+
+#pragma once
+
+#include "InterfaceManager.h"
+
+class CMainFrame : public CFrameWnd
+				,public CInterfaceManager
+				, public IViewInterface2Parent
+				, public IDisplyMessage2Parent
+{
+	
+protected: // serialization俊辑父 父甸绢笼聪促.
+	CMainFrame();
+	DECLARE_DYNCREATE(CMainFrame)
+
+// 漂己涝聪促.
+public:
+
+// 累诀涝聪促.
+public:
+
+// 犁沥狼涝聪促.
+public:
+	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+// 备泅涝聪促.
+public:
+	virtual ~CMainFrame();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+public:
+	virtual void		MapDefect_ReqDefectImage(CInspectDefect* pDefect,int nGlassDefectIdx);
+	virtual CDefect		*ListDefect_ReqDefectImage(CInspectDefect* pDefect,int nGlassDefectIdx);
+	virtual void		CommandExitButtonClick();
+
+	virtual LPBYTE		IV2M_GetGrabBufferByDimension(DimensionDir eDim,int iVline);
+	virtual BOOL		IV2M_SetLiveGrabCommand(DimensionDir eDim,BOOL bStop);
+	virtual void		IV2M_LoadImageFullFile(int iSide, CGlass_Data *pGlassData = NULL, std::function<void(BYTE)> _Func = nullptr);
+	virtual BOOL		IV2M_SaveFullImage(CString strPath,int iSide,CPoint ptStart,int nLength);
+	virtual BOOL		IV2M_RecipeChange(CString strRecipe);
+	virtual void		IV2M_InitView(Init_View_Command eVew);
+
+	virtual BOOL		MLight_SetLightControlValue(int iCon,int iCh, int nValue, BOOL bRef, int nScanIdx = 0, BOOL bAdjLight = TRUE);
+	virtual int			MLight_GetLightControlValue(int iCon,int iCh, BOOL bRef);
+	virtual void		MLight_OnOff(int iCon,int iCh,BOOL bValue);
+	virtual BOOL		IV2M_InspectionProcess(DimensionDir eDim);
+	virtual BOOL		IV2M_InspectionProcessAll(int iProceMode);
+
+	virtual std::multimap<int, CPoint *> *IF2M_GetCADProfileLine(int iSide,int vStart,int vEnd);
+
+	virtual void		DisplayMessage(TCHAR* str);
+
+	static UINT			ManualInspectProcess(LPVOID pParam);
+
+public:
+	void				SetView(CENRITView	*pView);
+
+protected:
+	void				Timer_InitDone();
+	BOOL				GetRegistryRcpName(CString& strRecipe);
+	void				SetRegistryRcpName(CString strRecipe);
+	void				ApplyViewRecipeSettingss();
+
+// 积己等 皋矫瘤 甘 窃荐
+protected:
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);	
+	afx_msg void OnTimer(UINT_PTR nIDEvent);	
+	DECLARE_MESSAGE_MAP()
+
+protected:
+	BOOL				m_bManualProcessStart;
+	DimensionDir		m_eManualInspectSide;
+};
+
+
diff --git a/ENRIT/PLC/Control_Interface.cpp b/ENRIT/PLC/Control_Interface.cpp
new file mode 100644
index 0000000..e0a19a9
--- /dev/null
+++ b/ENRIT/PLC/Control_Interface.cpp
@@ -0,0 +1,991 @@
+#include "StdAfx.h"
+#include "Control_Interface.h"
+#include "SharedMemoryDefine.h"
+
+CControl_Interface::CControl_Interface(void)
+	:m_ReadEvent(FALSE,FALSE,_T("PLCConnector_Event_1"))
+{		
+	m_pI2M = NULL;
+	m_bRecvedPLCIO1 = FALSE;
+	m_nRecvedPLCIO1 = 0;
+
+	m_hMap = NULL;
+	m_pSharedMemory = NULL;	
+
+	m_nSignal = m_nLongSignal = 0;
+	m_bConnect = FALSE;
+
+	m_dTickPrevTime = GetTickCount();
+
+	for(int i=0; i<PLC_MAX_SIGNAL_BIT; i++)
+	{
+		m_nSignalOnTime[i] = 3000;
+		m_nSignalOnDelayTime[i] = 1000;
+	}
+
+	LoadSignalOnTime();
+
+	m_pThreadControlIF = new CThread_ControlIF();
+	if(m_pThreadControlIF != NULL)
+	{
+		m_pThreadControlIF->CreateThread();			
+		m_pThreadControlIF->SetControl2Main(static_cast<IControlInterface2Parent*>(this));
+	}
+}
+
+CControl_Interface::~CControl_Interface(void)
+{
+	if(m_pThreadControlIF != NULL)
+		delete m_pThreadControlIF;
+	m_pThreadControlIF = NULL;
+
+	DisconnectToPLC();
+}
+
+BOOL CControl_Interface::DisconnectToPLC()
+{
+	if (m_pSharedMemory!=NULL)
+	{
+		::UnmapViewOfFile(m_pSharedMemory);
+		m_pSharedMemory = NULL;
+	}
+	if (m_hMap != NULL)
+	{
+		::CloseHandle(m_hMap);
+		m_hMap = NULL;
+	}
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::ConnectToControl()
+{
+	m_bConnect = ConnectPLCConnector();
+
+	return m_bConnect;
+}
+
+BOOL CControl_Interface::ConnectPLCConnector()
+{
+	m_bConnect = FALSE;
+
+	//4k 农扁狼 傍蜡 皋葛府 颇老 积己
+	m_hMap = ::CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE
+		, 0, SHARED_MEMORY_SIZE, _T("MX_COMPONENT_SHARED_MEMORY"));
+
+	//父老 捞固 积己等 按眉啊 乐促搁 捞固 Connector啊 累悼 吝..
+	if (::GetLastError() == ERROR_ALREADY_EXISTS)
+	{
+		//捞固 积己等 按眉啊 乐促搁 积己捞 酒聪扼 坷锹栏肺 角青
+		m_hMap = ::OpenFileMapping(FILE_MAP_ALL_ACCESS,FALSE,_T("MX_COMPONENT_SHARED_MEMORY"));
+	}
+	else//父老 积己等 按眉啊 绝促搁 沥惑 悼累窍瘤 臼绰促.
+		g_pLog->DisplayMessage(_T("Error : No defect PLCConnector program."));
+
+	if (m_hMap == NULL)
+	{
+		g_pLog->DisplayMessage(_T("ERROR: Failed to create(open) file mapping object!"));			
+		return FALSE;
+	}
+
+	//傍蜡皋葛府 甘俏
+	m_pSharedMemory = (char*)::MapViewOfFile(m_hMap, FILE_MAP_ALL_ACCESS, 0, 0, SHARED_MEMORY_SIZE);
+
+	if (m_pSharedMemory == NULL)
+	{
+		g_pLog->DisplayMessage(_T("ERROR: Failed to get shared memory!"));			
+		return FALSE;
+	}
+
+	//0栏肺 檬扁拳
+	ZeroMemory(m_pSharedMemory,SHARED_MEMORY_SIZE);	
+
+	m_bConnect = TRUE;
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::ControlProcess()
+{
+	if(IsConnect() == FALSE)
+	{
+		Sleep(10);
+		return FALSE;
+	}
+
+	if(ReadPLCIOBit() == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("Error PLC Read PLC 01"));
+		return FALSE;
+	}
+
+	CheckSignal_01();
+
+	Sleep(10);
+
+	SendPLCIO_01();
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::ReadPLCIOBit()
+{
+	if(IsConnect() == FALSE)
+		return FALSE;
+
+	WORD	RetVal0=0;
+	CString	str1;
+
+	memcpy(&RetVal0,m_pSharedMemory+PLC_READ_SIGNAL0,2);
+
+	str1.Format(_T("%x"),RetVal0);		
+	str1.MakeUpper();			
+
+	CTransDataManager		TransClass;
+
+	int nRcvData1 = TransClass.Hex2Dec(str1);
+	if (m_nRecvedPLCIO1 != nRcvData1)
+	{
+		m_nRecvedPLCIO1 = nRcvData1;
+		m_bRecvedPLCIO1 = TRUE;
+	}
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::CheckSignal_01()
+{
+	if(m_bRecvedPLCIO1 == FALSE)
+		return TRUE;
+	if(m_pI2M == NULL)
+		return TRUE;
+
+	ST_PLC_RECIVE_01			pPLCData(m_nRecvedPLCIO1);
+
+	// Glass Loading 
+	if (!m_Rcv01.bGlassLoading && pPLCData.bGlassLoading)
+	{			
+		m_pI2M->IMI2P_PLC_ReceiveSignalValue(C2I_Loading, 1);		
+	}	
+	// Short Scan Start
+	if (!m_Rcv01.bShortScanStart && pPLCData.bShortScanStart)	
+	{
+		m_pI2M->IMI2P_PLC_ReceiveSignalValue(C2I_ShortScanStart, 1);		
+	}
+	// Short Scan End
+	if (!m_Rcv01.bShortScanEnd && pPLCData.bShortScanEnd)	
+	{
+		m_pI2M->IMI2P_PLC_ReceiveSignalValue(C2I_ShortScanEnd, 1);		
+	}
+	// Long Scan Start
+	if (!m_Rcv01.bLongScanStart && pPLCData.bLongScanStart)	
+	{
+		m_pI2M->IMI2P_PLC_ReceiveSignalValue(C2I_LongScanStart, 1);		
+	}
+	// Long Scan End
+	if (!m_Rcv01.bLongScanEnd && pPLCData.bLongScanEnd)	
+	{
+		m_pI2M->IMI2P_PLC_ReceiveSignalValue(C2I_LongScanEnd, 1);		
+	}
+	// EMO Grab Stop
+	if (!m_Rcv01.bEMOGrabStop && pPLCData.bEMOGrabStop)	
+	{
+		m_pI2M->IMI2P_PLC_ReceiveSignalValue(C2I_EMOGrabStop, 1);		
+	}
+
+	m_Rcv01 = pPLCData;		
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::SendConstrol(enInterface_Send_Control enAlarm,int nValue)
+{
+	if(enAlarm >= enInterface_None)
+		return FALSE;
+
+	switch(enAlarm)
+	{
+		//case SERVER_ALIVE: SendPLCIO_Alive(); break;
+	case GLASSLOADING_HANDSHAKE: m_Send01.bGlassLoadingAck = nValue; break;
+	case SHORT_SCANSTART_HANDSHAKE: m_Send01.bShortScanStartAck = nValue; break;
+	case SHORT_SCANEND_HANDSHAKE: m_Send01.bShortScanEndAck = nValue; break;
+	case LONG_SCANSTART_HANDSHAKE: m_Send01.bLongScanStartAck = nValue; break;
+	case LONG_SCANEND_HANDSHAKE: m_Send01.bLongScanEndAck = nValue; break;
+	default:
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::SendCIMData(short *pBuf,int nAddr,int nCnt)
+{
+	if(pBuf == NULL || nCnt <= 0)
+		return FALSE;
+
+	if (IsConnect() == FALSE)
+		return FALSE;	
+
+	BOOL			bRet = FALSE;
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("D%d"),nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;
+
+	bRet = WriteLongPLC( tAddr, (short*)pBuf, nCnt);
+
+	return bRet;
+}
+
+BOOL CControl_Interface::CheckAliveTime()
+{
+	double		CurTime = GetTickCount();
+
+	double		PassTime = CurTime - m_dTickPrevTime;
+
+	if(PassTime > 5000)
+	{
+		m_dTickPrevTime = CurTime;
+		m_Send01.bServerAlive = !m_Send01.bServerAlive;
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+BOOL CControl_Interface::SendPLCIO_01()
+{
+	int		nSendData = 0;
+
+	CheckAliveTime();
+
+	m_Send01.MakeSend(nSendData);			
+
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("D%d"),PLC_ADDR_SENDSIGNAL1);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;
+
+	WriteLongPLC_Signal(0,tAddr,(short*)&nSendData,1);
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::SendPLCIO_Alive()
+{	
+	if(CheckAliveTime() == FALSE)
+		return FALSE;
+
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("D%d"),PLC_ADDR_SENDSIGNAL1);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;
+
+	if(WriteWORDOneBitTimer(tAddr,0,1000) == TRUE)
+	{
+		m_Send01.ChangeSignal(m_SentBack01);
+	}	
+
+	return TRUE;
+}
+
+int CControl_Interface::GetSignal()
+{
+	m_nSignal++;
+	if(m_nSignal >= PLC_WRITEWORD_TIMER_COUNT) m_nSignal = 0;
+	return m_nSignal;
+}
+
+int CControl_Interface::GetLongSignal()
+{
+	m_nLongSignal++;
+	if(m_nLongSignal >= PLC_WRITEWORD_LONGDATA_COUNT) m_nLongSignal = 1;
+	if(m_nLongSignal <= 0)
+		m_nLongSignal = 1;
+	return m_nLongSignal;
+}
+
+void CControl_Interface::LoadSignalOnTime()
+{
+	CString		strTaget = _T("C:\\RCutProject\\Config\\SignalOnTime.cfg");
+
+	CFileFind findFile;
+	BOOL bFind = findFile.FindFile(strTaget);
+	if(bFind == FALSE)
+	{
+		SaveSignalOnTime();
+		return;
+	}
+
+	CConfig Config;
+
+	if (!Config.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strTaget, FileMap_Mode))
+		return;
+
+	int nIndex = 0;
+
+	Config.GetItemValue(_T("LOADING_OK_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("LOADING_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("SHORT_SCAN_START_OK_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("SHORT_SCAN_START_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("SHORT_SCAN_END_OK_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("SHORT_SCAN_END_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("LONG_SCAN_START_OK_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("LONG_SCAN_START_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("LONG_SCAN_END_OK_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+	Config.GetItemValue(_T("LONG_SCAN_END_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++], 4000);
+
+	nIndex = 0;
+	Config.GetItemValue(_T("LOADING_OK_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("LOADING_FAIL_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("SHORT_SCAN_START_OK_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("SHORT_SCAN_START_FAIL_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("SHORT_SCAN_END_OK_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("SHORT_SCAN_END_FAIL_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("LONG_SCAN_START_OK_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("LONG_SCAN_START_FAIL_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("LONG_SCAN_END_OK_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+	Config.GetItemValue(_T("LONG_SCAN_END_FAIL_ON_DELAY_TIME"), m_nSignalOnDelayTime[nIndex++], 0);
+}
+
+void CControl_Interface::SaveSignalOnTime()
+{
+	CString		strTaget = _T("C:\\RCutProject\\Config\\SignalOnTime.cfg");
+
+	CFileFind findFile;
+	BOOL bFind = findFile.FindFile(strTaget);
+	if(bFind == FALSE)
+		return;
+
+	CConfig Config;
+
+	if (!Config.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strTaget, FileMap_Mode))
+		return;
+
+	int nIndex = 0;
+
+	Config.SetItemValue(_T("LOADING_OK_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("LOADING_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("SHORT_SCAN_START_OK_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("SHORT_SCAN_START_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("SHORT_SCAN_END_OK_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("SHORT_SCAN_END_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("LONG_SCAN_START_OK_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("LONG_SCAN_START_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("LONG_SCAN_END_OK_ON_TIME"), m_nSignalOnTime[nIndex++]);
+	Config.SetItemValue(_T("LONG_SCAN_END_FAIL_ON_TIME"), m_nSignalOnTime[nIndex++]);
+
+	Config.WriteToFile();
+}
+
+int CControl_Interface::GetSignalOnTime(int nSignalIndex)
+{
+	return m_nSignalOnTime[nSignalIndex];
+}
+
+int CControl_Interface::GetSignalDelayTime(int nSignalIndex)
+{
+	return m_nSignalOnDelayTime[nSignalIndex];
+}
+
+bool CControl_Interface::WriteCStringPLC(TCHAR* strAddress, CString strData,int nWSize)
+{
+	if(m_pSharedMemory == NULL )
+		return FALSE;
+
+	int iSignal = GetLongSignal();
+
+	int strlength =  lstrlen(strAddress);
+	if ( strlength > 6) strlength = 6;
+	int				nWORDSize = strData.GetLength()/2+1;
+
+	if(nWSize > 0)
+	{
+		if(strData.GetLength() < nWSize * 2)
+		{
+			int nCount = nWSize * 2 - strData.GetLength();
+			for(int i = 0; i < nCount;i++)
+			{
+				strData+=" ";
+			}		
+		}		
+		nWORDSize = nWSize;
+	}
+
+	if( nWORDSize > 1000) nWORDSize = 1000;
+
+	int			iAddr,iStartAddr;
+
+	iStartAddr = iAddr = PLC_WRITELONG_SIGNAL+iSignal*PLC_LONGDATA_MAXSIZE;
+
+	iAddr+=1;
+	memset(m_pSharedMemory+iAddr, 0x00, 7*sizeof(TCHAR));
+	memcpy(m_pSharedMemory+iAddr, strAddress,strlength*sizeof(TCHAR));
+	iAddr+=14;
+	memcpy(m_pSharedMemory+iAddr, &nWORDSize, sizeof(unsigned int));
+	iAddr+=4;
+	if(strlength != 0)
+		memcpy(m_pSharedMemory+iAddr, strData.GetBuffer(0), nWORDSize*2);
+	else
+		memset(m_pSharedMemory+iAddr, 0x00, nWORDSize);
+
+	//葛电 蔼阑 盲况 持篮 饶 PLCConnector俊霸 PLC 林家俊 蔼阑 利档废 脚龋甫 焊辰促.
+	m_pSharedMemory[iStartAddr] = 1;
+
+	return true;
+}
+
+bool CControl_Interface::WriteLongPLC_Signal(int iLongSigIdx,TCHAR* strAddress, short* WriteData, unsigned int nWORDSize)
+{
+	if(m_pSharedMemory == NULL )
+		return FALSE;
+
+	//int iSignal = GetLongSignal();
+
+	int iSignal = iLongSigIdx;
+
+	int strlength =  lstrlen(strAddress);
+	if ( strlength > 6) strlength = 6;
+
+	if( nWORDSize > 1000) nWORDSize = 1000;
+	int			iAddr,iStartAddr;
+
+	iStartAddr = iAddr = PLC_WRITELONG_SIGNAL+iSignal*PLC_LONGDATA_MAXSIZE;
+
+	iAddr+=1;
+	memset(m_pSharedMemory+iAddr, 0x00, 7*sizeof(TCHAR));
+	memcpy(m_pSharedMemory+iAddr, strAddress,strlength*sizeof(TCHAR));
+	iAddr+=14;
+	memcpy(m_pSharedMemory+iAddr, &nWORDSize, sizeof(unsigned int));
+	iAddr+=4;
+	memcpy(m_pSharedMemory+iAddr, WriteData, nWORDSize*2);
+
+	m_pSharedMemory[iStartAddr] = 1;
+	return true;
+}
+
+bool CControl_Interface::WriteLongPLC(TCHAR* strAddress, short* WriteData, unsigned int nWORDSize)
+{
+	if(m_pSharedMemory == NULL )
+		return FALSE;
+
+	int iSignal = GetLongSignal();
+
+	int strlength =  lstrlen(strAddress);
+	if ( strlength > 6) strlength = 6;
+
+	if( nWORDSize > 1000) nWORDSize = 1000;
+	int			iAddr,iStartAddr;
+
+	iStartAddr = iAddr = PLC_WRITELONG_SIGNAL+iSignal*PLC_LONGDATA_MAXSIZE;
+
+	iAddr+=1;
+	memset(m_pSharedMemory+iAddr, 0x00, 7*sizeof(TCHAR));
+	memcpy(m_pSharedMemory+iAddr, strAddress,strlength*sizeof(TCHAR));
+	iAddr+=14;
+	memcpy(m_pSharedMemory+iAddr, &nWORDSize, sizeof(unsigned int));
+	iAddr+=4;
+	memcpy(m_pSharedMemory+iAddr, WriteData, nWORDSize*2);
+
+	//葛电 蔼阑 盲况 持篮 饶 PLCConnector俊霸 PLC 林家俊 蔼阑 利档废 脚龋甫 焊辰促.
+	m_pSharedMemory[iStartAddr] = 1;
+	return true;
+}
+
+bool CControl_Interface::WriteWordArrayPLC(TCHAR* strAddress, WORD* WriteData, unsigned int nArraySize)
+{
+	return WriteLongPLC(strAddress, (short*) WriteData, nArraySize);
+}
+
+bool CControl_Interface::WriteIntArrayPLC(TCHAR* strAddress, int* WriteData, unsigned int nArraySize)
+{
+	return WriteLongPLC( strAddress, (short*) WriteData, 2*nArraySize);
+}
+
+bool CControl_Interface::WriteWORDPLCTimer(TCHAR* strAddress, short WriteData, DWORD msecTimer)
+{
+	if(m_pSharedMemory == NULL )
+		return FALSE;
+
+	int strlength =  lstrlen(strAddress);
+	if ( strlength > 6) strlength = 6;
+
+	int			iAddr,iStartAddr;
+
+	int iSignal = GetSignal();
+	iStartAddr = iAddr = PLC_WRITEWORD_SIGNAL+iSignal*PLC_WRITEWORD_TIMER_SIZE;
+
+	iAddr+=1;
+	memset(m_pSharedMemory+iAddr, 0x00, 7*sizeof(TCHAR));
+	memcpy(m_pSharedMemory+iAddr, strAddress,strlength*sizeof(TCHAR));
+	iAddr+=14;
+	memcpy(m_pSharedMemory+iAddr, &WriteData, 2);
+	iAddr+=2;
+	memcpy(m_pSharedMemory+iAddr, &msecTimer, 4);
+
+	//葛电 蔼阑 盲况 持篮 饶 PLCConnector俊霸 PLC 林家俊 蔼阑 利档废 脚龋甫 焊辰促.
+	m_pSharedMemory[iStartAddr] = 1;
+	return true;
+}
+
+bool  CControl_Interface::WriteWORDOneBitTimer(TCHAR* strAddress, short BITOrder, DWORD msecTimer)
+{
+	if(m_pSharedMemory == NULL)
+		return FALSE;
+
+	int strlength =  lstrlen(strAddress);
+	if ( strlength > 6) strlength = 6;
+
+	short WriteData = (1 << BITOrder);
+
+	int			iAddr,iStartAddr;
+	int iSignal = GetSignal();
+
+	iStartAddr = iAddr = PLC_WRITEWORD_SIGNAL+iSignal*PLC_WRITEWORD_TIMER_SIZE;
+
+	iAddr+=1;
+	memset(m_pSharedMemory+iAddr, 0x00, 7*sizeof(TCHAR));
+	memcpy(m_pSharedMemory+iAddr, strAddress,strlength*sizeof(TCHAR));
+	iAddr+=14;
+	memcpy(m_pSharedMemory+iAddr, &WriteData, 2);
+	iAddr+=2;
+	memcpy(m_pSharedMemory+iAddr, &msecTimer, 4);
+
+	//葛电 蔼阑 盲况 持篮 饶 PLCConnector俊霸 PLC 林家俊 蔼阑 利档废 脚龋甫 焊辰促.
+	m_pSharedMemory[iStartAddr] = 1;
+	return true;
+}
+
+bool CControl_Interface::WriteWORDManyBitsTimer(TCHAR* strAddress, char* BitFlag, DWORD msecTimer)
+{
+	short WriteData = 0;
+
+	for( int i = 0; i < 16; i++)
+		WriteData |= (BitFlag[i] << i);
+
+	return WriteWORDPLCTimer( strAddress,  WriteData, msecTimer);
+}
+
+BOOL CControl_Interface::SendIntPLCData(char cDevice, int nAddr, int nData)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;	
+
+	BOOL			bRet = FALSE;
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("%c%d"),cDevice,nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;
+
+	bRet = WriteLongPLC( tAddr, (short*)&nData, 2);
+
+	return bRet;
+
+}
+
+BOOL CControl_Interface::SendWordArrayPLCData(char cDevice, int nAddr, WORD* pData, int nLen)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;	
+
+	BOOL			bRet = FALSE;	
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("%c%d"),cDevice,nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;
+
+	bRet = WriteWordArrayPLC(tAddr,pData,nLen);		
+
+	return bRet;
+}
+
+BOOL CControl_Interface::SendIntArrayPLCData(char cDevice, int nAddr, int* pData, int nLen)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;	
+
+	BOOL			bRet = FALSE;	
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("%c%d"),cDevice,nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;
+
+	bRet = WriteIntArrayPLC(tAddr,pData,nLen);		
+
+	return bRet;
+}
+
+BOOL CControl_Interface::RecvPLCData(char cDevice , int nAddr, char* pData, unsigned short nWORDSize)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;
+
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("%c%d"),cDevice,nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;
+
+	BOOL bRet = FALSE;
+
+	bRet = ReadLongData( pData, tAddr, nWORDSize);
+
+	return bRet;
+}
+
+BOOL CControl_Interface::ReadPLCDataDec(char cMemory, int nAddr, int &nData, int nByteSize)
+{
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("%c%d"),cMemory,nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;	
+
+	char RetData[2048] = {0};
+	CString			pString;
+
+	ReadLongData(RetData,tAddr,nByteSize/2);			
+
+	CTransDataManager		TransClass;
+
+	char* pstrHex = new char[nByteSize * 2 +1];
+	CStringA strRetA = ("");
+	memset( pstrHex,0,sizeof(char)*(nByteSize * 2 +1) );
+
+	StrToHex(pstrHex,RetData,nByteSize, TRUE);
+	strRetA = pstrHex;
+	nData = TransClass.Hex2UnsignedDec( (CString)strRetA );
+
+	delete [] pstrHex;
+
+	return TRUE;
+}
+
+// 胶飘傅 -> 16柳荐
+BOOL CControl_Interface::StrToHex(CHAR* pchData, CHAR* pchDataSrc, INT nLength, BOOL bWordReverse)
+{
+	//static UCHAR saucHex[] = "0123456789ABCDEF";
+	for(int i=0; i<nLength/2; i++)
+	{
+		sprintf(&pchData[i*4], "%02X%02X", pchDataSrc[i*2+1] & 0xFF, pchDataSrc[i*2+0] & 0xFF);
+
+		if(pchData[i*4+0]=='2' && pchData[i*4+1]=='0')
+		{
+			pchData[i*4+0]=0;
+			pchData[i*4+1]=0;
+		}
+		if(pchData[i*4+2]=='2' && pchData[i*4+3]=='0')
+		{
+			pchData[i*4+2]=0;
+			pchData[i*4+3]=0;
+		}
+	}
+
+	if( bWordReverse == TRUE && nLength >= 4 && nLength % 4 == 0)
+	{
+		char szBuffer[4] = {0,};
+		for(int i=0; i< nLength*2; i+=8)
+		{
+			memcpy(szBuffer,&pchData[i],4);
+			memcpy(&pchData[i],&pchData[i+4],4);
+			memcpy(&pchData[i+4],szBuffer,4);
+
+		}
+	}
+	return TRUE;
+}
+
+BOOL CControl_Interface::ReadPLCData(int nAddr, int& nData)
+{
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("D%d"),nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;	
+
+	char RetData[2048] = {0};
+	CString			pString;
+
+	ReadLongData(RetData,tAddr,1);		
+
+	CTransDataManager		TransClass;
+	pString.Format(_T("%s"),RetData);
+
+	if (pString.GetLength() <= 0)
+		return FALSE;
+
+	nData = TransClass.Hex2Dec(pString);
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::ReadPLCData(int nAddr, int &nData, int nLen)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;
+
+	TCHAR			*tAddr;
+	CString			strAddr;
+	CString			pString;
+
+	strAddr.Format(_T("D%d"),nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;	
+
+	char RetData[2048] = {0};
+
+	ReadLongData(RetData,tAddr,nLen);	
+	pString.Format(_T("%s"),RetData);
+
+	if (pString.GetLength() <= 0)
+		return FALSE;
+
+	CString		strRead = pString;
+	CString		strConvert;
+
+	if(strRead.GetLength() < 8)
+		return FALSE;
+
+	strConvert = strRead.Right(4);
+	strConvert += strRead.Left(4);
+
+	CTransDataManager		TransClass;
+
+	nData = TransClass.Hex2Dec(strConvert);
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::ReadPLCData(int nAddr, CString& strData, int nLen)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;
+
+	TCHAR			*tAddr;
+	CString			strAddr;
+	CString			pString;
+
+	strAddr.Format(_T("D%d"),nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;	
+
+	char RetData[2048] = {0};
+
+	ReadLongData(RetData,tAddr,nLen);	
+	pString.Format(_T("%s"),RetData);
+
+	if (pString.GetLength() <= 0)
+		return FALSE;
+
+	int nAddress = 0;
+
+	strData = pString;	
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::ReadPLCData(char cMemory, int nAddr, CString& strData, int nLen)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;
+
+	TCHAR			*tAddr;
+	CString			strAddr;
+	CString			pString;
+
+	strAddr.Format(_T("%c%d"),cMemory,nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;	
+
+	char RetData[2048] = {0};
+
+	ReadLongData(RetData,tAddr,nLen);	
+	pString.Format(_T("%s"),RetData);
+
+	if (pString.GetLength() <= 0)
+		return FALSE;
+
+	int nAddress = 0;
+
+	strData = pString;
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::ReadTIMEData(char cMemory, int nAddr, CString& strData, int nLen, SYSTEMTIME &sTime)
+{
+	CString strYear, strMonth, strDay, strHour, strMinute, strSecond;
+
+	if (IsConnect() == FALSE)
+		return FALSE;
+
+	TCHAR			*tAddr;
+	CString			strAddr;
+	CString			pString;
+
+	strAddr.Format(_T("%c%d"),cMemory,nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;	
+
+	char RetData[2048] = {0};
+
+	ReadLongData(RetData,tAddr,nLen);	
+	pString.Format(_T("%s"),RetData);
+
+	if (pString.GetLength() <= 0)
+		return FALSE;
+
+	int nAddress = 0;
+
+	strData = pString;	
+
+	return TRUE;
+}
+
+BOOL CControl_Interface::SendPLCData(int nAddr, int nData)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;
+
+	BOOL			bRet = FALSE;	
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("D%d"),nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;		
+
+	bRet = WriteWORDPLCTimer(tAddr,nData,1000);	
+
+	return bRet;
+}
+
+BOOL CControl_Interface::SendPLCData_NoTimer(int nAddr, int nData, int nLen)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;
+
+	BOOL bRet = FALSE;
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("D%d"),nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;		
+
+	bRet = WriteLongPLC( tAddr, (short*)&nData, nLen);	
+
+	return bRet;
+}
+
+BOOL CControl_Interface::SendPLCBItData(int nAddr, short nBit)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;
+
+	BOOL bRet = FALSE;	
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("D%d"),nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;		
+
+	bRet = WriteWORDOneBitTimer(tAddr,nBit,1000);
+
+	return bRet;
+}
+
+BOOL CControl_Interface::SendPLCData(char cDevice, int nAddr, CString& strData, int nLen)
+{
+	if (IsConnect() == FALSE)
+		return FALSE;	
+
+	BOOL			bRet = FALSE;	
+	TCHAR			*tAddr;
+	CString			strAddr;
+
+	strAddr.Format(_T("%c%d"),cDevice,nAddr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;
+
+	bRet = WriteCStringPLC(tAddr,strData,nLen);			
+
+	return bRet;
+}
+
+BOOL CControl_Interface::ReadTransferData(CTransDataManager *TData,char *lpTransBuffer,int Addr)
+{
+	CString		pString,strAddr;
+	short		nDataSize;
+
+	nDataSize = TData->GetDataPackTotalByteSize()/2;
+	if(TData->GetDataPackTotalByteSize()%2 > 0)
+		nDataSize++;
+
+	TCHAR			*tAddr;
+
+	strAddr.Format(_T("D%d"),Addr);
+	tAddr = (TCHAR *)(LPCTSTR)strAddr;		
+
+	ReadLongData(lpTransBuffer,tAddr,nDataSize);			
+
+	CString		strTmp;
+
+	for(int i=0;i<nDataSize;i++)
+	{
+		strTmp += lpTransBuffer[i];
+	}
+
+	//g_pLog->DisplayMessage(_T("Read TransferData : %s"),strTmp);
+
+
+	return TData->InsertPLCValueToMap(lpTransBuffer,nDataSize*2);
+}
+
+bool CControl_Interface::ReadLongData(char* pData, TCHAR* strAddress, unsigned short nWORDSize)
+{
+	if(m_pSharedMemory == NULL)
+		return FALSE;
+
+	int strlength =  lstrlen(strAddress);
+	if ( strlength > 6) strlength = 6;	
+
+	if( nWORDSize > 1000) nWORDSize = 1000;
+	//傍蜡 皋葛府俊 拱幅单捞磐甫 佬档废 脚龋甫 焊辰促.
+	ZeroMemory(m_pSharedMemory+PLC_READ_LONGDATA_ADDRESS_1,(PLC_READ_LONGDATA_LENGTH_1)-(PLC_READ_LONGDATA_ADDRESS_1));
+	memcpy(m_pSharedMemory+PLC_READ_LONGDATA_ADDRESS_1, strAddress,strlength*sizeof(TCHAR));
+	memcpy(m_pSharedMemory+PLC_READ_LONGDATA_LENGTH_1, &nWORDSize,2);
+	memset(m_pSharedMemory+PLC_READ_LONGDATA_SIGNAL_1, 0x01, 1);
+
+	//单捞磐甫 促 佬绊 傍蜡皋葛府 利阑 锭鳖瘤 扁促赴促.
+	::WaitForSingleObject(m_ReadEvent,2000);
+
+	//肯丰啊 登搁 秦寸 蔼阑 促矫 佬绢柯促.
+	//pData = m_pSharedMemory+PLC_READ_LONGDATA_VALUE;
+
+	memcpy(pData, m_pSharedMemory+PLC_READ_LONGDATA_VALUE_1, nWORDSize*2);
+
+	return true;
+}
+
+BOOL CControl_Interface::SendJudgement(int nJudge)
+{
+	g_pLog->DisplayMessage(_T("Send Glass Judgement : %d"),nJudge);			
+
+	return SendPLCData_NoTimer(PLC_ADDR_GLASS_JUDEMENT, nJudge, 1);
+}
+
+BOOL CControl_Interface::ReadRcpHandNo(int &nRcpNo,int &nHandNo)
+{
+	nRcpNo = 0;
+	nHandNo = 0;	
+
+	ReadPLCData(520,nRcpNo);
+
+	g_pLog->DisplayMessage(_T("Read Rcp No D520 : %d"),nRcpNo);
+
+	ReadPLCData(521,nHandNo);
+
+	g_pLog->DisplayMessage(_T("Read Hand No D521 : %d"),nHandNo);
+
+	return TRUE;
+}
\ No newline at end of file
diff --git a/ENRIT/PLC/Control_Interface.h b/ENRIT/PLC/Control_Interface.h
new file mode 100644
index 0000000..74de7b9
--- /dev/null
+++ b/ENRIT/PLC/Control_Interface.h
@@ -0,0 +1,187 @@
+#pragma once
+
+#include "Thread_ControlIF.h"
+#include "TransDataManager.h"
+
+#define		PLC_ADDR_SENDSIGNAL1		629
+#define		PLC_TRASFERDATA_ADDR		500
+#define		PLC_ADDR_GLASS_JUDEMENT		600
+#define		PLC_ADDR_PROFILE_JUDEMENT	4300
+
+#define		PLC_MAX_SIGNAL_BIT			10
+
+enum	enInterface_Send_Control{SERVER_ALIVE=0,GLASSLOADING_HANDSHAKE, SHORT_SCANSTART_HANDSHAKE,SHORT_SCANEND_HANDSHAKE, LONG_SCANSTART_HANDSHAKE,LONG_SCANEND_HANDSHAKE,enInterface_None};
+
+enum ControlToAllSignal {C2A_ControlAlive = 0, C2A_RunningMode, C2A_ReviewMode, C2A_ReviewManualMode, C2A_BypassMode, C2A_VaripanelMode, C2A_DualMode, C2A_PPIDUseMode ,ControlToAllSignal_Count };
+
+enum ControlToInspect	{C2I_Loading = 0, C2I_ShortScanStart, C2I_ShortScanEnd,C2I_LongScanStart, C2I_LongScanEnd, C2I_EMOGrabStop,C2I_InitInspect,	ControlToInspect_Count};
+
+enum InspectToControlSignal	{ IToC_Ack_LoadingSuccess=0, IToC_Ack_LoadingFail, IToC_Ack_ShortScanStartSuccess, IToC_Ack_ShortScanStartFail, IToC_Ack_ShortScanEndSuccess, IToC_Ack_ShortScanEndFail
+	, IToC_Ack_LongScanStartSuccess, IToC_Ack_LongScanStartFail, IToC_Ack_LongScanEndSuccess, IToC_Ack_LongScanEndFail, IToC_Sig_InspectionCount};
+enum InspectToControlAlarm {IToC_Alarm_InspectorError=0, IToC_Alarm_InspectOverflow,IToC_Alarm_EdgeCrack, IToC_Alarm_NoRecipe ,IToC_Alarm_FindEdgeFail, IToC_Alarm_LightError, IToC_Alarm_UpperLimit, IToC_Alarm_LowestLimit
+	,IToC_Alarm_NoImage,IToC_Alarm_GlassDetectFail,IToC_Alarm_TransferData,IToC_Alarm_InternalValue ,IToC_Alarm_InspectionCount};
+
+#define	ALIVE_BIT(nValue, add, bit) 	nValue= nValue | ((add)<<(bit));
+#define IS_ALIVE_BIT(nValue, bit) 	((nValue & (0x01<<(bit))) >>(bit));
+
+typedef struct _ST_PLC_RECIVE_01
+{
+	BOOL					bPLCHeatbit;
+	BOOL					bGlassLoading;	
+	BOOL					bShortScanStart;		
+	BOOL					bShortScanEnd;					
+	BOOL					bLongScanStart;		
+	BOOL					bLongScanEnd;					
+	BOOL					bEMOGrabStop;
+
+	_ST_PLC_RECIVE_01()
+	{
+		Reset();
+	}
+	_ST_PLC_RECIVE_01(int nPLCData)
+	{	
+		(nPLCData & 0x01)?bPLCHeatbit=TRUE:bPLCHeatbit=FALSE;
+		(nPLCData & 0x02)?bGlassLoading=TRUE:bGlassLoading=FALSE;
+		(nPLCData & 0x04)?bShortScanStart=TRUE:bShortScanStart=FALSE;
+		(nPLCData & 0x08)?bShortScanEnd=TRUE:bShortScanEnd=FALSE;			
+		(nPLCData & 0x10)?bLongScanStart=TRUE:bLongScanStart=FALSE;
+		(nPLCData & 0x20)?bLongScanEnd=TRUE:bLongScanEnd=FALSE;
+		(nPLCData & 0x40)?bEMOGrabStop=TRUE:bEMOGrabStop=FALSE;		
+	}
+	void Reset()
+	{
+		bPLCHeatbit = bGlassLoading = bShortScanStart = bShortScanEnd = bLongScanStart =FALSE;
+		bLongScanEnd = bEMOGrabStop = FALSE;		
+	}		
+}ST_PLC_RECIVE_01,*pST_PLC_RECIVE_01;
+
+typedef struct _ST_PLC_SEND_01
+{
+	BOOL	bServerAlive;
+	BOOL	bGlassLoadingAck;		
+	BOOL	bShortScanStartAck;
+	BOOL	bShortScanEndAck;
+	BOOL	bLongScanStartAck;
+	BOOL	bLongScanEndAck;
+
+	_ST_PLC_SEND_01()
+	{
+		bServerAlive = FALSE;
+		Reset(FALSE);
+	}	
+	void Reset(BOOL bSet)
+	{		
+		bGlassLoadingAck = bShortScanStartAck = bShortScanEndAck = bLongScanStartAck = bLongScanEndAck = bSet;									
+	}		
+	void ChangeSignal(_ST_PLC_SEND_01 &pSent)
+	{
+		if(pSent.bGlassLoadingAck) bGlassLoadingAck = FALSE;
+		if(pSent.bShortScanStartAck) bShortScanStartAck = FALSE;
+		if(pSent.bShortScanEndAck) bShortScanEndAck = FALSE;
+		if(pSent.bLongScanStartAck) bLongScanStartAck = FALSE;
+		if(pSent.bLongScanEndAck) bLongScanEndAck = FALSE;			
+	}
+	void MakeSend(int &nSendData)
+	{		
+		nSendData = 0;	
+		ALIVE_BIT(nSendData, bLongScanEndAck, 5);
+		ALIVE_BIT(nSendData, bLongScanStartAck, 4);
+		ALIVE_BIT(nSendData, bShortScanEndAck, 3);
+		ALIVE_BIT(nSendData, bShortScanStartAck, 2);
+		ALIVE_BIT(nSendData, bGlassLoadingAck, 1);
+		ALIVE_BIT(nSendData, bServerAlive, 0);	
+	}
+}ST_PLC_SEND_01,*pST_PLC_SEND_01;
+
+interface IMainFrameInterface2Parent
+{
+	virtual void IMI2P_PLC_ReceiveSignalValue(int nSignalIndex, int nValue) = 0;	
+};
+
+class CControl_Interface : public IControlInterface2Parent
+{
+public:
+	CControl_Interface(void);
+	virtual ~CControl_Interface(void);
+
+public:	
+	virtual BOOL		ControlProcess();
+	virtual	BOOL		ConnectToControl();
+	virtual BOOL		DisconnectToPLC();
+	virtual BOOL		SendConstrol(enInterface_Send_Control enAlarm,int nValue);	
+	virtual BOOL		SendCIMData(short *pBuf,int nAddr,int nCnt);		
+	virtual BOOL		SendJudgement(int nJudge);				
+	virtual BOOL		ReadRcpHandNo(int &nRcpNo,int &nHandNo);
+
+	BOOL				IsConnect(){return m_bConnect;}
+	void				SetI2M(IMainFrameInterface2Parent *pI2M){m_pI2M=pI2M;}
+
+public:
+	bool				WriteCStringPLC(TCHAR* strAddress, CString strData,int nWSize=0);
+	bool				WriteLongPLC(TCHAR* strAddress, short* WriteData, unsigned int nWORDSize);	
+	bool				WriteLongPLC_Signal(int iLongSigIdx,TCHAR* strAddress, short* WriteData, unsigned int nWORDSize);
+	bool				WriteIntArrayPLC(TCHAR* strAddress, int* WriteData, unsigned int nArraySize);
+	bool				WriteWordArrayPLC(TCHAR* strAddress, WORD* WriteData, unsigned int nArraySize);
+	bool				WriteWORDPLCTimer(TCHAR* strAddress, short WriteData, DWORD msecTimer);	
+	bool				WriteWORDOneBitTimer(TCHAR* strAddress, short BITOrder, DWORD msecTimer);
+	bool				WriteWORDManyBitsTimer(TCHAR* strAddress, char* BitFlag, DWORD msecTimer);
+
+	BOOL				ReadPLCData(int nAddr, int& nData);
+	BOOL				ReadPLCData(int nAddr, int &nData, int nLen);
+	BOOL				ReadPLCData(int nAddr, CString& strData, int nLen);
+	BOOL				ReadPLCData(char cMemory, int nAddr, CString& strData, int nLen);	
+	BOOL				RecvPLCData(char cDevice , int nAddr, char* pData,unsigned short nWORDSize);
+	bool				ReadLongData(char* pData, TCHAR* strAddress, unsigned short nSize);
+	BOOL				ReadTIMEData(char cMemory, int nAddr, CString& strData, int nLen, SYSTEMTIME &sTime);	
+	BOOL				ReadPLCDataDec(char cMemory, int nAddr, int &nData, int nByteSize);
+
+	BOOL				SendPLCIO_Alive();
+	BOOL				SendPLCData(int nAddr, int nData);
+	BOOL				SendPLCData_NoTimer(int nAddr, int nData, int nLen);
+	BOOL				SendPLCBItData(int nAddr, short nData);
+	BOOL				SendPLCData(char cDevice, int nAddr, CString& strData, int nLen);	
+	BOOL				SendIntPLCData(char cDevice, int nAddr, int nData);
+	BOOL				SendIntArrayPLCData(char cDevice, int nAddr, int* pData, int nLen);
+	BOOL				SendWordArrayPLCData(char cDevice, int nAddr, WORD* pData, int nLen);
+
+	BOOL				ReadTransferData(CTransDataManager *TData,char *lpTransBuffer,int Addr);
+	BOOL				StrToHex(CHAR* pchData, CHAR* pchDataSrc, INT nLength, BOOL bWordReverse=TRUE);
+
+public:
+	void				LoadSignalOnTime();
+	void				SaveSignalOnTime();
+	int					GetSignalOnTime(int nSignalIndex);
+	int					GetSignalDelayTime(int nSignalIndex);
+	int					m_nSignalOnTime[PLC_MAX_SIGNAL_BIT];
+	int					m_nSignalOnDelayTime[PLC_MAX_SIGNAL_BIT];
+
+protected:
+	BOOL				ConnectPLCConnector();
+	BOOL				ReadPLCIOBit();
+	BOOL				CheckSignal_01();
+	BOOL				SendPLCIO_01();		
+	BOOL				CheckAliveTime();
+	int					GetSignal();
+	int					GetLongSignal();
+
+protected:
+	HANDLE				m_hMap;
+	char				*m_pSharedMemory;			
+	ST_PLC_RECIVE_01	m_Rcv01;
+	ST_PLC_SEND_01		m_Send01,m_SentBack01;
+	int					m_nSignal;			//Signal 涝仿
+	int					m_nLongSignal;			//Signal 涝仿
+	CEvent				m_ReadEvent;
+	double				m_dTickPrevTime;
+
+
+	
+protected:	
+	IMainFrameInterface2Parent	*m_pI2M;
+	CThread_ControlIF			*m_pThreadControlIF;
+	BOOL						m_bConnect;
+
+	int							m_nRecvedPLCIO1;
+	BOOL						m_bRecvedPLCIO1;
+};
+
diff --git a/ENRIT/Process/HoleInspector.cpp b/ENRIT/Process/HoleInspector.cpp
new file mode 100644
index 0000000..bd403eb
--- /dev/null
+++ b/ENRIT/Process/HoleInspector.cpp
@@ -0,0 +1,291 @@
+#include "StdAfx.h"
+#include "HoleInspector.h"
+
+
+CHoleInspector::CHoleInspector(void)
+{
+}
+
+
+CHoleInspector::~CHoleInspector(void)
+{
+}
+
+RetValue CHoleInspector::HoleInspect_TemplateMatching(int nThreshold, int nOffset, int nMinSize, IplImage* pTargetImage, IplImage* pTemplateImage, IplImage** pResultImage, std::vector<CRect>& vecDefectList, double& dMatRate, IplImage** pResultImageColor)
+{
+	if(pTargetImage == NULL || pTemplateImage == NULL || pResultImage == NULL)
+		return Ret_ParamError;
+
+	if((pTargetImage->width < pTemplateImage->width) || (pTargetImage->height < pTemplateImage->height))
+		return Ret_ParamError;
+
+
+	if(*(pResultImage) != NULL)
+		cvReleaseImage(pResultImage);
+
+	if(pResultImageColor != NULL)
+		if(*(pResultImageColor) != NULL)
+			cvReleaseImage(pResultImageColor);
+
+	// 1. Template Matching
+	IplImage* C = cvCreateImage(cvSize(pTargetImage->width - pTemplateImage->width + 1, pTargetImage->height - pTemplateImage->height + 1), IPL_DEPTH_32F, 1);
+
+	CvPoint ptLeftTop;
+	double dMin;
+	double dMatchingRate;
+
+	cvMatchTemplate(pTargetImage, pTemplateImage, C, CV_TM_CCOEFF_NORMED);
+	cvMinMaxLoc(C, &dMin, &dMatchingRate, NULL, &ptLeftTop);
+
+	dMatRate = dMatchingRate;
+
+	cvReleaseImage(&C);
+
+	*(pResultImage) = cvCreateImage(cvSize(pTemplateImage->width, pTemplateImage->height), pTemplateImage->depth, pTemplateImage->nChannels);
+	cvZero(*(pResultImage));
+
+	if(pResultImageColor != NULL)
+	{
+		*(pResultImageColor) = cvCreateImage(cvSize(pTemplateImage->width, pTemplateImage->height), pTemplateImage->depth, 3);
+		cvZero(*(pResultImageColor));
+	}	
+
+	// 2. Make Remove Ellipse Circle
+	IplImage* pEllipseRemove = cvCloneImage(*(pResultImage));
+
+	int nMaxOffsetX = pEllipseRemove->width/2;
+	int nMaxOffsetY = pEllipseRemove->height/2;
+
+	if(nMaxOffsetX < nMaxOffsetY && nMaxOffsetX < nOffset)				nOffset = nMaxOffsetX;
+	else if(nMaxOffsetX > nMaxOffsetY && nMaxOffsetY < nOffset)			nOffset = nMaxOffsetY;
+
+	cvEllipse(pEllipseRemove, cvPoint(pEllipseRemove->width/2, pEllipseRemove->height/2), cvSize(pEllipseRemove->width/2-nOffset, pEllipseRemove->height/2-nOffset), 0, 0, 360.0, cvScalar(255,255,255), -1, CV_AA);
+
+	// 3. Inspect
+	for(int i=0; i<(*pResultImage)->height; i++)
+	{
+		for(int j=0; j<(*pResultImage)->width; j++)
+		{
+			if(pEllipseRemove->imageData[i*pEllipseRemove->widthStep+j] != 0)
+			{
+				if(abs(pTemplateImage->imageData[i*pTemplateImage->widthStep+j] - pTargetImage->imageData[(i+ptLeftTop.y)*pTargetImage->widthStep+(j+ptLeftTop.x)]) > nThreshold)
+					(*pResultImage)->imageData[i*(*pResultImage)->widthStep+j] = (BYTE) 255;
+
+				if(pResultImageColor != NULL)
+				{
+					(*pResultImageColor)->imageData[i*(*pResultImageColor)->widthStep+(j*(*pResultImageColor)->nChannels)] = pTargetImage->imageData[(i+ptLeftTop.y)*pTargetImage->widthStep+(j+ptLeftTop.x)];
+					(*pResultImageColor)->imageData[i*(*pResultImageColor)->widthStep+(j*(*pResultImageColor)->nChannels)+1] = pTargetImage->imageData[(i+ptLeftTop.y)*pTargetImage->widthStep+(j+ptLeftTop.x)];
+					(*pResultImageColor)->imageData[i*(*pResultImageColor)->widthStep+(j*(*pResultImageColor)->nChannels)+2] = pTargetImage->imageData[(i+ptLeftTop.y)*pTargetImage->widthStep+(j+ptLeftTop.x)];
+				}
+			}
+		}
+	}
+
+	cvReleaseImage(&pEllipseRemove);
+
+	// 4. Blob Process
+	vecDefectList.clear();
+
+	CvSeq* contours			 = NULL;		
+	CvMemStorage* storage	 = NULL;
+
+	IplImage* pBinImage = cvCloneImage((*pResultImage));
+
+	storage	 = cvCreateMemStorage(0);
+	cvFindContours(pBinImage, storage, &contours, sizeof(CvContour),	CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, cvPoint(0,0) );
+	cvReleaseImage(&pBinImage);
+
+	CvRect	rtCv;
+	CRect	rtDefect;
+
+	for(;contours!=0;contours=contours->h_next)
+	{
+		double dArea = cvContourArea(contours);
+
+		if(nMinSize < dArea)
+		{
+			rtCv = cvBoundingRect(contours);
+
+			rtDefect.left = rtCv.x;
+			rtDefect.right = rtDefect.left + rtCv.width;
+
+			rtDefect.top = rtCv.y;
+			rtDefect.bottom = rtDefect.top + rtCv.height;
+
+			vecDefectList.push_back(rtDefect);
+
+		}
+	}
+	cvReleaseMemStorage(&storage);
+
+
+	// Debug Image
+	if(pResultImageColor != NULL)
+	{
+		cvEllipse((*pResultImageColor), cvPoint((*pResultImageColor)->width/2, (*pResultImageColor)->height/2), cvSize((*pResultImageColor)->width/2, (*pResultImageColor)->height/2), 0, 0, 360.0, cvScalar(0,0,255), 1);
+		cvEllipse((*pResultImageColor), cvPoint((*pResultImageColor)->width/2, (*pResultImageColor)->height/2), cvSize((*pResultImageColor)->width/2-nOffset, (*pResultImageColor)->height/2-nOffset), 0, 0, 360.0, cvScalar(255,0,0), 1);
+
+		for(int i=0; i<(int)vecDefectList.size(); i++)
+			cvDrawRect((*pResultImageColor), cvPoint(vecDefectList[i].left, vecDefectList[i].top), cvPoint(vecDefectList[i].right, vecDefectList[i].bottom), cvScalar(0,255,0));
+	}
+
+	return Ret_Success;
+}
+
+RetValue CHoleInspector::HoleInspect_TemplateMatching(HOLE_INS_PARM* pParam, IplImage* pTargetImage, std::vector<CRect>& vecDefectList, CPoint& ptMatchingPos, IplImage** pResultImageColor/*=NULL*/)
+{
+	if(pParam == NULL || pTargetImage == NULL)
+		return Ret_ParamError;
+
+	char str_filename[1024] = {};
+
+#ifdef _UNICODE
+	int		nSize = WideCharToMultiByte(CP_ACP, 0, pParam->m_strTemplatePath.GetBuffer(), -1, NULL, 0, NULL,NULL); 				
+	WideCharToMultiByte(CP_ACP, 0, pParam->m_strTemplatePath.GetBuffer(), -1, str_filename, nSize, NULL, NULL); 		
+#else				
+	sprintf_s(str_filename,sizeof(char)*pParam->m_strTemplatePath.GetLength(),"%s",(LPSTR)(LPCTSTR)pParam->m_strTemplatePath);		
+#endif
+
+	IplImage* pTemplateImage = cvLoadImage(str_filename, CV_LOAD_IMAGE_GRAYSCALE);
+	if(pTemplateImage == NULL)
+		return Ret_ParamError;
+	
+	CRect rtMatchingArea;
+
+	if(IntersectRect(rtMatchingArea, CRect(0, 0, pTemplateImage->width, pTemplateImage->height), pParam->m_rtHoleArea) == FALSE)
+	{
+		cvReleaseImage(&pTemplateImage);
+		return Ret_ParamError;
+	}
+
+	IplImage* pHoleImage = cvCreateImage(cvSize(rtMatchingArea.Width(), rtMatchingArea.Height()), 8, 1);
+
+	for(int i=0; i<pHoleImage->height; i++)
+		memcpy(&pHoleImage->imageData[i*pHoleImage->widthStep], &pTemplateImage->imageData[((rtMatchingArea.top+i)*pTemplateImage->widthStep)+rtMatchingArea.left], pHoleImage->width);
+
+	cvReleaseImage(&pTemplateImage);
+
+	if((pTargetImage->width < pHoleImage->width) || (pTargetImage->height < pHoleImage->height))
+	{
+		cvReleaseImage(&pHoleImage);
+		return Ret_ParamError;
+	}
+
+	// 1. Template Matching
+	IplImage* C = cvCreateImage(cvSize(pTargetImage->width - pHoleImage->width + 1, pTargetImage->height - pHoleImage->height + 1), IPL_DEPTH_32F, 1);
+
+	CvPoint ptLeftTop;
+	double dMin;
+	double dMatchingRate;
+
+	cvMatchTemplate(pTargetImage, pHoleImage, C, CV_TM_CCOEFF_NORMED);
+	cvMinMaxLoc(C, &dMin, &dMatchingRate, NULL, &ptLeftTop);
+	cvReleaseImage(&C);
+
+	ptMatchingPos.x = ptLeftTop.x;
+	ptMatchingPos.y = ptLeftTop.y;
+
+	dMatchingRate = dMatchingRate * 100.0;
+
+	if(dMatchingRate < pParam->m_dMatRate)
+	{
+		vecDefectList.push_back(CRect(ptLeftTop.x, ptLeftTop.y, ptLeftTop.x+pHoleImage->width, ptLeftTop.y+pHoleImage->height));
+		cvReleaseImage(&pHoleImage);
+		return Ret_MatRateLimit;
+	}
+
+
+	IplImage* pBinImage = cvCreateImage(cvSize(pHoleImage->width, pHoleImage->height), pHoleImage->depth, pHoleImage->nChannels);
+	cvZero(pBinImage);
+
+	// Debug Image
+	if(pResultImageColor != NULL)
+	{
+		if(*(pResultImageColor) != NULL)
+			cvReleaseImage(pResultImageColor);
+
+		*(pResultImageColor) = cvCreateImage(cvSize(pHoleImage->width, pHoleImage->height), pHoleImage->depth, 3);
+		cvZero(*(pResultImageColor));
+	}	
+
+	// 2. Make Remove Ellipse Circle
+	IplImage* pEllipseRemove = cvCloneImage(pBinImage);
+
+	int nMaxOffsetX = pEllipseRemove->width/2;
+	int nMaxOffsetY = pEllipseRemove->height/2;
+
+	int nOffset = 0;
+	if(nMaxOffsetX < nMaxOffsetY && nMaxOffsetX < pParam->m_nOffset)				nOffset = nMaxOffsetX;
+	else if(nMaxOffsetX > nMaxOffsetY && nMaxOffsetY < pParam->m_nOffset)			nOffset = nMaxOffsetY;
+
+	cvEllipse(pEllipseRemove, cvPoint(pEllipseRemove->width/2, pEllipseRemove->height/2), cvSize(pEllipseRemove->width/2-pParam->m_nOffset, pEllipseRemove->height/2-pParam->m_nOffset), 0, 0, 360.0, cvScalar(255,255,255), -1, CV_AA);
+
+	// 3. Inspect
+	for(int i=0; i<pBinImage->height; i++)
+	{
+		for(int j=0; j<pBinImage->width; j++)
+		{
+			if(pEllipseRemove->imageData[i*pEllipseRemove->widthStep+j] != 0)
+			{
+				if(abs(pHoleImage->imageData[i*pHoleImage->widthStep+j] - pTargetImage->imageData[(i+ptLeftTop.y)*pTargetImage->widthStep+(j+ptLeftTop.x)]) > pParam->m_nThreshold)
+					pBinImage->imageData[(i*pBinImage->widthStep)+j] = (BYTE) 255;
+
+				if(pResultImageColor != NULL)
+				{
+					(*pResultImageColor)->imageData[i*(*pResultImageColor)->widthStep+(j*(*pResultImageColor)->nChannels)] = pTargetImage->imageData[(i+ptLeftTop.y)*pTargetImage->widthStep+(j+ptLeftTop.x)];
+					(*pResultImageColor)->imageData[i*(*pResultImageColor)->widthStep+(j*(*pResultImageColor)->nChannels)+1] = pTargetImage->imageData[(i+ptLeftTop.y)*pTargetImage->widthStep+(j+ptLeftTop.x)];
+					(*pResultImageColor)->imageData[i*(*pResultImageColor)->widthStep+(j*(*pResultImageColor)->nChannels)+2] = pTargetImage->imageData[(i+ptLeftTop.y)*pTargetImage->widthStep+(j+ptLeftTop.x)];
+				}
+			}
+		}
+	}
+
+	cvReleaseImage(&pEllipseRemove);
+	cvReleaseImage(&pHoleImage);
+
+	// 4. Blob Process
+	vecDefectList.clear();
+
+	CvSeq* contours			 = NULL;		
+	CvMemStorage* storage	 = NULL;
+
+	storage	 = cvCreateMemStorage(0);
+	cvFindContours(pBinImage, storage, &contours, sizeof(CvContour),	CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, cvPoint(0,0) );
+	cvReleaseImage(&pBinImage);
+
+	CvRect	rtCv;
+	CRect	rtDefect;
+
+	for(;contours!=0;contours=contours->h_next)
+	{
+		double dArea = cvContourArea(contours);
+
+		if(pParam->m_nMinSize < dArea)
+		{
+			rtCv = cvBoundingRect(contours);
+
+			rtDefect.left = rtCv.x;
+			rtDefect.right = rtDefect.left + rtCv.width;
+
+			rtDefect.top = rtCv.y;
+			rtDefect.bottom = rtDefect.top + rtCv.height;
+
+			vecDefectList.push_back(rtDefect);
+
+		}
+	}
+	cvReleaseMemStorage(&storage);
+
+
+	// Debug Image
+	if(pResultImageColor != NULL)
+	{
+		cvEllipse((*pResultImageColor), cvPoint((*pResultImageColor)->width/2, (*pResultImageColor)->height/2), cvSize((*pResultImageColor)->width/2, (*pResultImageColor)->height/2), 0, 0, 360.0, cvScalar(0,0,255), 1);
+		cvEllipse((*pResultImageColor), cvPoint((*pResultImageColor)->width/2, (*pResultImageColor)->height/2), cvSize((*pResultImageColor)->width/2-nOffset, (*pResultImageColor)->height/2-nOffset), 0, 0, 360.0, cvScalar(255,0,0), 1);
+
+		for(int i=0; i<(int)vecDefectList.size(); i++)
+			cvDrawRect((*pResultImageColor), cvPoint(vecDefectList[i].left, vecDefectList[i].top), cvPoint(vecDefectList[i].right, vecDefectList[i].bottom), cvScalar(0,255,0));
+	}
+
+	return Ret_Success;
+}
diff --git a/ENRIT/Process/HoleInspector.h b/ENRIT/Process/HoleInspector.h
new file mode 100644
index 0000000..2739762
--- /dev/null
+++ b/ENRIT/Process/HoleInspector.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "GlassRecipe.h"
+
+#include "cv.h"
+#include "highgui.h"
+#include "cxcore.h"
+
+enum RetValue { Ret_ParamError=0, Ret_MatRateLimit, Ret_Success };
+
+class CHoleInspector
+{
+public:
+	CHoleInspector(void);
+	~CHoleInspector(void);
+
+public:
+	RetValue HoleInspect_TemplateMatching(int nThreshold, int nOffset, int nMinSize, IplImage* pTargetImage, IplImage* pTemplateImage, IplImage** pResultImage, std::vector<CRect>& vecDefectList, double& dMatRate, IplImage** pResultImageColor=NULL);
+
+	// Rcut
+	RetValue HoleInspect_TemplateMatching(HOLE_INS_PARM* pParam, IplImage* pTargetImage, std::vector<CRect>& vecDefectList, CPoint& ptMatchingPos, IplImage** pResultImageColor=NULL);
+};
+
diff --git a/ENRIT/Process/InspectCamera.cpp b/ENRIT/Process/InspectCamera.cpp
new file mode 100644
index 0000000..7c2dc79
--- /dev/null
+++ b/ENRIT/Process/InspectCamera.cpp
@@ -0,0 +1,5107 @@
+锘�#include "StdAfx.h"
+#include "InspectCamera.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "MulticamControl.h"
+#include "RadientControl.h"
+#include "Glass_Data.h"
+#include "IncludeSDK.h"
+
+#define BOUNDARY_GLASSSTARTWIDTH	160
+#define BOUNDARYHORIZ_LEVELDIST		8	// 鑽愪篂 鐗堟媽鎬ラ槕 鑼槕 閿嫾 鍘氳儗鑺簻	
+#define TIME_WAIT_GLASS_START		1500
+
+#define align_4byte(in) ((in + 3)/4)*4
+#define RAD_TO_DEGREE			   (double)(180.0f / 3.1415926535f)
+
+//static double _gLastFinishTime = MININT64;
+
+CInspectCamera::CInspectCamera(int iCam)
+{	
+	m_iCamera = iCam;
+	m_pThreadControl = new CThreadControl();
+	m_pRecipe = NULL;
+	m_pHardparm = NULL;
+	m_pGrabber = NULL;
+	m_pGlassData = NULL;
+	m_pII2S = NULL;
+	m_bExitThread = FALSE;
+	m_pSplineModel = NULL;
+	m_hWndViewScan = NULL;
+
+	int		i;
+	for(i=0;i<MAX_THREAD;i++)
+	{		
+		m_pChamferControl[i]	= new CChamferInspect;	
+		m_pSplineControl[i]	= new CSplineInspect;
+		m_pHoleInspect[i] = new CHoleInspector;
+	}	
+
+	for(i=0;i<MAX_SCAN_COUNT;i++)
+	{
+		for(int j=0;j<MAX_THREAD;j++)
+		{	
+			m_pProfileControl[i][j] = new CProfileCADProc();
+		}
+	}
+
+	for (int i = 0; i < 8; i++) {
+		m_fInspectLastTime[i] = MININT;
+	}
+
+	m_pDefectControl = new CDefectControl();	
+}
+
+CInspectCamera::~CInspectCamera(void)
+{
+	ReleaseThread();
+
+	int		i;
+
+	for(i=0;i<MAX_SCAN_COUNT;i++)
+	{
+		std::multimap<int, CPoint *> *pSetProfileAlignMap = &m_mapAlignProfile[i];
+
+		DeleteCADAlign(pSetProfileAlignMap);
+	}
+
+	for(i=0;i<MAX_THREAD;i++)
+	{		
+		delete m_pChamferControl[i];	
+		m_pChamferControl[i] = NULL;
+
+		delete m_pSplineControl[i];
+		m_pSplineControl[i] = NULL;
+
+		delete m_pHoleInspect[i];
+		m_pHoleInspect[i] = NULL;
+	}	
+
+	for(i=0;i<MAX_SCAN_COUNT;i++)
+	{
+		for(int j=0;j<MAX_THREAD;j++)
+		{	
+			delete m_pProfileControl[i][j];
+			m_pProfileControl[i][j] = NULL;
+		}
+	}
+	
+	if(m_pDefectControl != NULL)
+		delete m_pDefectControl;
+	m_pDefectControl = NULL;
+
+	ReleaseSplineBuffer();
+	ReleaseFullBuffer();
+}
+
+void CInspectCamera::ReleaseThread()
+{
+	m_bExitThread = TRUE;	
+	if(m_pThreadControl != NULL)
+	{
+		m_pThreadControl->ReleaseThreadControl();
+		Sleep(100);
+		delete m_pThreadControl;
+		m_pThreadControl = NULL;
+	}
+}
+
+int	CInspectCamera::InitInspect(int nThread,int maxDefect)
+{
+	m_pThreadControl->InitThreadControl(nThread,this);
+
+	m_pDefectControl->InitDefectStorage(maxDefect);
+
+	return 1;
+}
+
+int CInspectCamera::ReInitThread(int nThread)
+{
+	m_pThreadControl->ReleaseThreadControl();
+	Sleep(100);
+	m_pThreadControl->InitThreadControl(nThread, this);
+
+	return 1;
+}
+
+BOOL CInspectCamera::ScanStart(int iScan)
+{
+	m_iScan = iScan;	
+	m_iSideLine[iScan] = 0;
+	m_bExitThread = FALSE;
+
+	ResetFrameFinish(iScan);
+
+	ScanStartThread();	
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::ScanStartThread()
+{
+	if(m_pThreadControl == NULL)
+		return FALSE;	
+
+	int		nThread = m_pThreadControl->StartThreadControl();
+	if(nThread <= 0)
+	{		
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::GetCheckFrame(stFrameIndex stFrame)
+{
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return FALSE;
+
+	DimensionDir		emDim = pCamera->m_eDimension;
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return FALSE;
+		
+	int			nFrameHeight = pCamera->m_FrameSize.cy;
+	int			nStartFrame = pEdgeInfo->nGlassStartLine/nFrameHeight;
+
+	if(nStartFrame > stFrame.nFrameIdx)
+		return TRUE;
+
+	return FALSE;
+}
+
+ERR_FIND_GLASSSTARTLINE CInspectCamera::IsGlassStartLine(int iThread,int &iScan)
+{
+	iScan = m_iScan;
+
+	if(m_pGrabber->GetGrabFrameCount() < 4)
+	{
+		Sleep(0);
+		return ERR_FINDGLASSSTART_FAIL;
+	}
+
+	stFrameIndex stFrame;
+
+	stFrame.nScanIdx = m_iScan;
+
+	if(m_bFindGlassStart[stFrame.nScanIdx] == TRUE)
+		return ERR_FINDGLASSSTART_SUCCESS;
+
+	if(iThread != 0)
+		return ERR_FINDGLASSSTART_FAIL;	
+	
+	DimensionDir		emDim = GetDimension(stFrame.nScanIdx);		
+
+	iScan = stFrame.nScanIdx;
+
+	if(FindGlassStartLine(emDim,stFrame) == TRUE)
+	{
+		ScanRegionSet(stFrame);		
+		m_bFindGlassStart[stFrame.nScanIdx] = TRUE;
+
+		m_MsgJob.nState = 1;
+		m_MsgJob.nDispLine = 0;
+		m_MsgJob.nSide = (int)emDim;
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pEdgeInfo != NULL)
+			m_MsgJob.nDispLine = pEdgeInfo->nGlassStartLine;
+
+		::SendMessage(m_hWndViewScan, WM_POCESS_STATUS,(WPARAM)&m_MsgJob, (int)emDim);
+
+		return ERR_FINDGLASSSTART_SUCCESS;
+	}
+	else
+	{				
+		return ERR_FINDGLASSSTART_FIND_FAIL;
+	}
+
+	return ERR_FINDGLASSSTART_FAIL;
+}
+
+BOOL CInspectCamera::OnThreadRun(int iThread, CInspectThread *pInspectThread)
+{
+	if(m_pRecipe == NULL)
+		return FALSE;	
+	if(m_pHardparm == NULL)
+		return FALSE;
+	if(m_pGlassData == NULL)
+		return FALSE;
+	if(m_pGrabber == NULL)
+		return FALSE;
+
+	while(TRUE)
+	{
+		if(GetCheckExit() == TRUE)
+		{
+			g_pLog->DisplayMessage(_T("cam %d, Thread %d Thread Exit"),m_iCamera,iThread);
+			break;
+		}		
+
+		int			iRetScan;
+		switch(IsGlassStartLine(iThread,iRetScan))
+		{
+		case ERR_FINDGLASSSTART_FAIL:
+			continue;
+			break;
+		case ERR_FINDGLASSSTART_FIND_FAIL:
+			m_pGrabber->GrabScanStop();
+			m_pGrabber->ClearGrabIdx();
+			m_bExitThread = TRUE;
+			g_pLog->DisplayMessage(_T("%s Process Find Glass StartLine Fail"),PANEL_SIDE[GetDimension(iRetScan)]);
+
+			int			nFrameWidth,nFrameHeight;
+			GetFrameSize(m_iCamera,m_iScan,nFrameWidth,nFrameHeight);
+
+			m_MsgJob.nState = 1;
+			m_MsgJob.nDispLine = 0;
+			m_MsgJob.nSide = (int)GetDimension(m_iScan);
+
+			::SendMessage(m_hWndViewScan, WM_POCESS_STATUS,(WPARAM)&m_MsgJob, (int)m_MsgJob.nSide);
+
+			continue;
+			break;
+		}		
+		
+		stFrameIndex stFrame = m_pGrabber->GetGrabFrame();
+		if(stFrame.nScanIdx < 0 || stFrame.nFrameIdx < 0)
+		{
+			Sleep(0);
+			continue;
+		}
+
+		DimensionDir		emDim = GetDimension(stFrame.nScanIdx);			
+
+		if(CheckStartLineFrame(emDim,stFrame.nFrameIdx) == FALSE)
+			continue;				
+		
+		//if(emDim == DIMENSION_A)
+		//	g_pLog->DisplayMessage(_T("%s, %d Process Frame : %d,%d"),PANEL_SIDE[emDim],iThread, stFrame.nScanIdx,stFrame.nFrameIdx);
+
+		int iFindLine = FindLeftLine(iThread,emDim,stFrame);
+				
+		BOOL bFindEndLine = FindEndLine(iThread,emDim,stFrame);
+									
+		FindAlignProcess(iThread,emDim,stFrame.nScanIdx,stFrame.nFrameIdx);
+						
+		FindThickness(iThread,emDim,stFrame,iFindLine);
+
+		//FindSpline(iThread,emDim,stFrame,iFindLine);	
+
+		FindSpline_New(iThread,emDim,stFrame,iFindLine);
+
+		FindHoleInspection(iThread,emDim,stFrame,iFindLine);
+
+		BOOL bProfile = FindProfileProcess(iThread,emDim,stFrame,iFindLine);
+
+		if(m_bProfileFind[stFrame.nScanIdx] == TRUE && m_nProfileFindFrameIdx[stFrame.nScanIdx] == stFrame.nFrameIdx)
+			bProfile = TRUE;
+
+		if(bFindEndLine == TRUE)
+			SetFrameFinishEndFrame(stFrame.nScanIdx, stFrame.nFrameIdx);
+
+		SetFrameFinish(stFrame.nScanIdx, stFrame.nFrameIdx);
+
+		BOOL bEnd = CheckThreadEnd(iThread,stFrame,bProfile);
+		
+		if(stFrame.nFrameIdx % 10 == 0 && bEnd == FALSE)
+		{
+			int			nFrameWidth,nFrameHeight;
+			GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+			m_MsgJob.nState = 1;
+			m_MsgJob.nDispLine = stFrame.nFrameIdx*nFrameHeight;
+			m_MsgJob.nSide = (int)emDim;
+			
+			//g_pLog->DisplayMessage(_T("%s Display - %d"),PANEL_SIDE[emDim],stFrame.nFrameIdx);
+
+			::SendMessage(m_hWndViewScan, WM_POCESS_STATUS,(WPARAM)&m_MsgJob, (int)emDim);
+		}	
+				
+		Sleep(0);
+	}
+
+	g_pLog->DisplayMessage(_T("Camera %d-%d Thread End"),m_iCamera,iThread);
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::FindProfileProcess(int iThread,DimensionDir emDim,stFrameIndex stFrame,int iFindLine)
+{
+	if(CheckProfile(iThread,emDim,stFrame) == FALSE)
+		return FALSE;
+
+	INS_EDGE_RESULT_INFO *pResInfo =  NULL;
+
+	if(m_pGlassData != NULL)
+		pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+
+	if(pResInfo == NULL)
+		return FALSE;
+
+	DIT_RESULT ret= DIT_CONV_SUCCESS;	
+	
+	CvPoint2D32f		ptAlign[3];
+
+	ptAlign[0].x = ptAlign[0].y = 0;
+	ptAlign[1].x = ptAlign[1].y = 0;	
+	ptAlign[2].x = ptAlign[2].y = 0;	
+	if(pResInfo->bMark[0] == FALSE || pResInfo->bMark[1] == FALSE)
+	{
+		DWORD dwTact = GetTickCount();
+
+		do 
+		{
+			if(pResInfo == NULL)
+				break;
+
+			if(pResInfo->bMark[0] == TRUE && pResInfo->bMark[1] == TRUE)
+				break;
+
+			if(GetTickCount()-dwTact >= 3000)
+			{
+				g_pLog->DisplayMessage(_T("%s Profile Align Wait timeout : %d=%d"),PANEL_SIDE[emDim],pResInfo->bMark[0],pResInfo->bMark[1]);
+				break;
+			}
+
+			Sleep(0);
+
+		} while (1);
+
+		if(pResInfo->bMark[0] == FALSE || pResInfo->bMark[1] == FALSE)
+		{
+			g_pLog->DisplayMessage(_T("%s Start Find Profile Process Fail :Frame %d : (Align Mark Find Fail..)"),PANEL_SIDE[emDim],stFrame.nFrameIdx);
+			return FALSE;
+		}
+	}
+
+	ptAlign[0] = pResInfo->ptMark[0];
+	ptAlign[1] = pResInfo->ptMark[1];
+	ptAlign[2] = pResInfo->ptMark[2];			
+
+	if(ptAlign[0].x<=0 || ptAlign[0].y <= 0 || ptAlign[1].x <= 0 || ptAlign[1].y <=0)
+	{
+		return FALSE;	
+	}
+	
+	CalculateStageTheta(emDim,stFrame.nScanIdx, ptAlign);	
+
+	g_pLog->DisplayMessage(_T("%s Start Find Profile Process : Thread %d,Frame %d"),PANEL_SIDE[emDim],iThread, stFrame.nFrameIdx);
+
+	vector< pair<int,STU_PROFILE_POSITION*> > vecProfile;
+
+	CProfileCADProc *pProfileControl = GetProfileControl(stFrame.nScanIdx,iThread);
+
+	MakeProfilePosition(emDim,stFrame,pProfileControl,vecProfile, ptAlign);
+
+	CalculateProfileChamfer(emDim,stFrame,pProfileControl,vecProfile,ptAlign[0]);
+
+	vector< pair<int,STU_PROFILE_POSITION*> >::iterator		it;
+	STU_PROFILE_POSITION *pProfile;
+	for(it=vecProfile.begin();it!=vecProfile.end();it++)
+	{
+		pProfile = it->second;
+		if(pProfile != NULL)
+			delete pProfile;
+		pProfile = NULL;
+	}
+	vecProfile.clear();
+
+	vector< pair<double,STU_SPLINE_PROFILE_POSITION*> >	vecSplineProfile;
+
+	RCutProfileProcess(emDim,stFrame,pProfileControl,vecSplineProfile,ptAlign);
+
+	vector< pair<double,STU_SPLINE_PROFILE_POSITION*> >::iterator		itSpline;
+	STU_SPLINE_PROFILE_POSITION	*pSpline;
+	for(itSpline=vecSplineProfile.begin();itSpline!=vecSplineProfile.end();itSpline++)
+	{
+		pSpline = itSpline->second;
+		if(pSpline != NULL)
+			delete pSpline;
+		pSpline = NULL;
+	}
+	vecSplineProfile.clear();
+
+	double				dConv,dScan;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return FALSE;
+
+	dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	dScan = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+		return FALSE;
+
+	double dDx	= abs(ptAlign[0].x-ptAlign[1].x)*dConv;
+	double dDy	= abs(ptAlign[0].y-ptAlign[1].y)*dScan;
+	double dAlignDist = sqrtf(float(dDx *dDx + dDy*dDy));
+	double dPixelDx	= abs(ptAlign[0].x-ptAlign[1].x);
+	double dPixelDy	= abs(ptAlign[0].y-ptAlign[1].y);
+	double dPixelAlignDist = sqrtf(float(dPixelDx *dPixelDx + dPixelDy*dPixelDy));
+
+	g_pLog->DisplayMessage(_T("%s Glass Align First[%.0f,%.0f],Align Second[%.0f,%.0f] = Distance %.0f,%.3fmm"),PANEL_SIDE[emDim],ptAlign[0].x,ptAlign[0].y,ptAlign[1].x,ptAlign[1].y,dPixelAlignDist,dAlignDist/1000.);
+
+	g_pLog->DisplayMessage(_T("%s Find Profile Process End :Frame %d"),PANEL_SIDE[emDim],stFrame.nFrameIdx);
+
+	return TRUE;
+	
+}
+
+BOOL CInspectCamera::IsRCutProfileProcess(DimensionDir emDim)
+{
+	switch(emDim)
+	{
+	case DIMENSION_A:
+	case DIMENSION_A_DN:
+	case DIMENSION_B:
+	case DIMENSION_B_DN:
+	case DIMENSION_D:
+	case DIMENSION_D_DN:
+		return TRUE;	
+	}
+
+	return FALSE;
+}
+
+BOOL CInspectCamera::CheckAlignMark(DimensionDir emDim,int &nIndex)
+{
+	INS_EDGE_RESULT_INFO *pResInfo = NULL;
+	BOOL				bRet = FALSE;
+
+	nIndex = -1;
+
+	BOOL		bUseAlignKey = FALSE;
+	CProfileInspect_Prm *pPrm = m_pRecipe->GetProfileParm();
+	if(pPrm != NULL)	
+		bUseAlignKey = pPrm->m_bUseOriginAlignKey[emDim];
+
+	if(m_pGlassData != NULL)
+	{
+		pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pResInfo != NULL)
+		{
+			switch(emDim)
+			{
+			case DIMENSION_A:
+			case DIMENSION_A_DN:
+				bRet = pResInfo->bMark[0];
+				nIndex = 0;
+				break;
+			case DIMENSION_B:
+			case DIMENSION_B_DN:
+			case DIMENSION_D:
+			case DIMENSION_D_DN:
+				if(bUseAlignKey == FALSE)
+				{
+					bRet = pResInfo->bMark[2];	// A鐖� Align 0, B,D缁� 杈戝畯浠樼洰
+					nIndex = 2;
+				}
+				else
+				{
+					bRet = TRUE;
+				}
+				break;
+			}			
+		}
+	}
+
+	return bRet;
+}
+
+BOOL CInspectCamera::ReFindAlignMark(DimensionDir emDim,stFrameIndex stFrame,int iPos)
+{
+	int				iFindFrame;
+	int				iEdgeFrame;
+	int				iGlassEdge = 0;
+	INS_EDGE_RESULT_INFO *pResInfo = NULL;
+
+	pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+
+	CRect		rectAlign =	pResInfo->rtMark[iPos];
+
+	if(rectAlign.top <= 0)
+		return FALSE;
+
+	int		nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	iFindFrame = rectAlign.bottom/nFrameHeight;
+	iEdgeFrame = iFindFrame + 5;
+
+	iGlassEdge = pResInfo->nGrindframe[0][iEdgeFrame];
+
+	if(iGlassEdge <= 0 || iGlassEdge >= nFrameWidth)	
+	{
+		for(int i=iEdgeFrame-1;i>=pResInfo->nGlassStartFrame;i--)
+		{
+			if(pResInfo->nGrindframe[0][i] > 0 && pResInfo->nGrindframe[0][i] < nFrameWidth)
+			{
+				iGlassEdge = pResInfo->nGrindframe[0][i];
+				break;
+			}
+		}
+	}	
+
+	CString			strPos = _T("TOP");
+	CString			strRes = _T("Fail");
+
+	switch(iPos)
+	{
+	case 1: strPos = _T("BOT"); break;
+	case 2: strPos = _T("SUB"); break;
+	}	
+
+	rectAlign.OffsetRect(iGlassEdge,0);
+
+	g_pLog->DisplayMessage(_T("%s Re Align Mark Find[%d] %d,%d,%d,%d"),PANEL_SIDE[emDim],iPos,rectAlign.left,rectAlign.top,rectAlign.right,rectAlign.bottom);
+
+	double			dRate = 0.5;
+	TEMP_RESULT		matchResut;
+	CRect rectIns = rectAlign;			
+	CALIGNMARK_PARM *pAlignPrm = m_pRecipe->GetAlignMarkPrm(emDim);
+	CEdgeProc		insProc;
+	
+	CSISBuffer frameBuffer(m_pGrabber->GetFrameHeaderLine(stFrame.nScanIdx,rectAlign.top), nFrameWidth, rectAlign.Height());	
+
+	if(!frameBuffer.IsValidBuffer())
+	{
+		return FALSE;
+	}		
+
+	rectIns.OffsetRect(0,-rectIns.top);
+
+	matchResut.fRat = 0.;
+	matchResut.pt.x = matchResut.pt.y = 0;
+
+	for(int iMarkPos=0;iMarkPos<MAX_POS_MARKER_COUNT;iMarkPos++)
+	{
+		if(pAlignPrm->IpMarkImg[iPos][iMarkPos] == NULL)
+			continue;
+
+		CRect		rtFind = rectIns;
+
+		if(rtFind.Width() <= pAlignPrm->IpMarkImg[iPos][iMarkPos]->width)
+			rtFind.right = rtFind.left + pAlignPrm->IpMarkImg[iPos][iMarkPos]->width + 10;
+		if(rtFind.Height() <= pAlignPrm->IpMarkImg[iPos][iMarkPos]->height)
+			rtFind.bottom = rtFind.top + pAlignPrm->IpMarkImg[iPos][iMarkPos]->height + 10;
+
+		insProc.CvFindMark(frameBuffer,pAlignPrm->IpMarkImg[iPos][iMarkPos],rectIns,matchResut,dRate);
+
+		if(matchResut.fRat*100. > pAlignPrm->m_dMarkMatchingRate[iPos][iMarkPos])
+		{			
+			if(pResInfo != NULL)
+			{
+				pResInfo->bMark[iPos] = TRUE;
+				pResInfo->ptMark[iPos].x	= matchResut.pt.x;
+				pResInfo->ptMark[iPos].y	= matchResut.pt.y + rectAlign.top;
+				pResInfo->nMarkToEdge_X[iPos] = (int)(pResInfo->ptMark[iPos].x - m_iSideLine[stFrame.nScanIdx]);
+				pResInfo->nMarkToEdge_Y[iPos] = (int)(pResInfo->ptMark[iPos].y - pResInfo->nGlassStartLine );	
+			}
+
+			g_pLog->DisplayMessage(_T("%s Re Align Mark Find[%d][%d] Success x %.2f, y %.2f"),PANEL_SIDE[emDim],iPos,iMarkPos,matchResut.pt.x, matchResut.pt.y + rectAlign.top);
+			strRes = _T("Success");
+			break;
+		}			
+	}
+
+	if(pResInfo != NULL && pResInfo->bMark[iPos] == FALSE)
+	{		
+		pResInfo->bMark[iPos] = TRUE;
+		pResInfo->ptMark[iPos].x	= (float)(m_iSideLine[stFrame.nScanIdx] + m_dMark2MarkX[stFrame.nScanIdx][iPos]);
+		pResInfo->ptMark[iPos].y	= (float)(pResInfo->nGlassStartLine + m_dMark2MarkY[stFrame.nScanIdx][iPos]);		
+
+		g_pLog->DisplayMessage(_T("%s Re Align Mark Find[%d] Fail x %.2f, y %.2f"),PANEL_SIDE[emDim],iPos,m_iSideLine[stFrame.nScanIdx] + m_dMark2MarkX[stFrame.nScanIdx][iPos], pResInfo->nGlassStartLine + m_dMark2MarkY[stFrame.nScanIdx][iPos]);	
+	}
+
+
+	CString			strFile;		
+	CvRect			saveRect = cvRect((int)matchResut.pt.x-rectAlign.Width()/2,(int)(matchResut.pt.y + rectAlign.top)-rectAlign.Height()/2,rectAlign.Width(),rectAlign.Height());
+	strFile.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\Align_%s_%s_%s.jpg"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime,strPos,PANEL_SIDE[emDim],strRes);
+
+	SaveCvAlignImage(saveRect,strFile,stFrame.nScanIdx,nFrameWidth,nFrameHeight);		
+
+	return TRUE;
+}
+
+int CInspectCamera::GetRCutProfileIndexTheta(DimensionDir emDim,stFrameIndex stFrame,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f *ptAlign)
+{
+	int			nRcpIndex[2],nRcpSize[2];
+	int			nProfilePosCount;
+
+	nProfilePosCount = GetRCutProfileIndex(emDim,nRcpIndex,nRcpSize);
+	if(nProfilePosCount <= 0)
+		return 0;
+
+	return GetRCutProfileTheta2Vector(nProfilePosCount,emDim,stFrame,vecProfile,nRcpIndex,nRcpSize,ptAlign);
+}
+
+int	CInspectCamera::GetRCutProfileTheta2Vector(int nPosCnt,DimensionDir eDimension,stFrameIndex stFrame,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile,int *nRcpIndex,INT *nRcpSize,CvPoint2D32f *ptAlign)
+{
+	CProfileInspect_Prm *pPrm = m_pRecipe->GetProfileParm();	
+	int			iPos,iIndex,iTheta;
+	double		dDefaultTheta = RCUT_PROFILE_CALCULATE_THETA;	
+	CvPoint2D32f	ptCenter;	
+
+	for(iPos=0;iPos<nPosCnt;iPos++)
+	{				
+		for(iIndex=nRcpIndex[iPos],iTheta=0;iIndex<nRcpIndex[iPos]+nRcpSize[iPos];iIndex++,iTheta++)
+		{
+			pSTU_SPLINE_PROFILE_POSITION pPfPositon = new STU_SPLINE_PROFILE_POSITION;		
+
+			pPfPositon->iCam = m_iCamera;
+			pPfPositon->iSide = eDimension;
+			pPfPositon->iScan = stFrame.nScanIdx;
+			pPfPositon->iIndex = iIndex;
+			pPfPositon->iPos = iPos;
+			pPfPositon->iLoop = iTheta;
+			pPfPositon->pSettings = &pPrm->m_stProfile[iIndex];
+			pPfPositon->dRadius = pPfPositon->pSettings->radius;			
+
+			double dCalTheta = -1*atan(static_cast<double>(ptAlign[1].x - ptAlign[0].x) / static_cast<double>((ptAlign[1].y - ptAlign[0].y)));
+			dCalTheta = dCalTheta*RAD_TO_DEGREE;
+
+			if(m_pRecipe->GetGlassInfo()->m_bPanelReverse == FALSE)
+			{
+				switch(eDimension)
+				{
+				case DIMENSION_A:
+				case DIMENSION_A_DN:
+					if(iPos == 0)
+						pPfPositon->dTheta = 90-(iTheta*dDefaultTheta);
+					else
+						pPfPositon->dTheta = -1*(iTheta*dDefaultTheta-dCalTheta);
+					break;
+				case DIMENSION_B:
+				case DIMENSION_B_DN:
+					pPfPositon->dTheta = -1*(iTheta*dDefaultTheta-dCalTheta);
+					break;
+				case DIMENSION_D:
+				case DIMENSION_D_DN:
+					pPfPositon->dTheta = 270+(iTheta*dDefaultTheta+dCalTheta);
+					break;
+				}
+			}
+			else
+			{
+				switch(eDimension)
+				{
+				case DIMENSION_A:
+				case DIMENSION_A_DN:
+					if(iPos == 0)
+						pPfPositon->dTheta = (iTheta*dDefaultTheta-dCalTheta);
+					else
+						pPfPositon->dTheta = -1*(90-(iTheta*dDefaultTheta));
+					break;
+				case DIMENSION_B:
+				case DIMENSION_B_DN:
+					pPfPositon->dTheta = 270+(iTheta*dDefaultTheta+dCalTheta);
+					break;
+				case DIMENSION_D:
+				case DIMENSION_D_DN:
+					pPfPositon->dTheta = -1*(iTheta*dDefaultTheta-dCalTheta);					
+					break;
+				}
+			}
+
+			if(iTheta == 0)		// Center缁� 璐告緶娉� 绐嶅敱鑲� 鑼勪績.
+			{
+				GetRCutCalculateCenterPosition(eDimension,stFrame,pPfPositon,ptAlign,iPos);	
+				ptCenter.x = (float)pPfPositon->ptCenterX;
+				ptCenter.y = (float)pPfPositon->ptCenterY;
+			}
+			else
+			{
+				pPfPositon->ptCenterX = ptCenter.x;
+				pPfPositon->ptCenterY = ptCenter.y;
+			}
+
+			vecProfile.push_back(make_pair((double)pPfPositon->iIndex, pPfPositon));		
+		}
+	}
+
+	return (int)vecProfile.size();
+}
+
+void CInspectCamera::GetRCutCalculateCenterPosition(DimensionDir eDimension,stFrameIndex stFrame,pSTU_SPLINE_PROFILE_POSITION pPfPositon,CvPoint2D32f *ptAlign,int iPos)
+{
+	double		dConv,dScan;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return;	
+
+	dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	dScan = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+		return;	
+
+	CEdgeProc		EdgeProc;	
+
+	BOOL			bUseAlignKey;	
+
+	bUseAlignKey = FALSE;
+
+	CProfileInspect_Prm *pPrm = m_pRecipe->GetProfileParm();
+	if(pPrm != NULL)
+	{
+		bUseAlignKey = pPrm->m_bUseOriginAlignKey[eDimension];		
+	}
+
+	if(m_pRecipe->GetGlassInfo()->m_bPanelReverse == FALSE)
+	{
+		switch(eDimension)
+		{
+		case DIMENSION_A:
+		case DIMENSION_A_DN:
+			if(iPos == 0)		// 绐嶄綍 align鎹� 鎵侀湒鎹為鑲� 鎯戜綍缁� 鎷岄瓊鎽硅偤 鑼勪績.
+			{			
+				double				dGlassLongSize = (m_pRecipe->GetGlassInfo()->m_nGlassSizeX);
+				double				dCalValue;
+
+				int					nCalAlignPos = (int)(dGlassLongSize-LONG_SIDE_INSPECTION_POINT_OFFSET);
+				int					nSetPos = (int)(LONG_SIDE_INSPECTION_POINT_OFFSET+pPfPositon->pSettings->y);
+				double				dMove = nCalAlignPos-nSetPos;
+
+				dCalValue = dMove/dScan; 			
+
+				pPfPositon->ptCenterX = (pPfPositon->pSettings->x/dConv) + ptAlign[0].x;
+				pPfPositon->ptCenterY = ptAlign[0].y + dCalValue;
+									
+				pPfPositon->ptCenterX += (g_pStatus->GetProfileOption()->m_nProfileOff_A_DN_X/dConv);
+				pPfPositon->ptCenterY += (g_pStatus->GetProfileOption()->m_nProfileOff_A_DN_Y/dScan);				
+				
+			}
+			else		// 绐嶄綍鍟� 鎵侀湒. shift鐖� 鐭朝
+			{
+				pPfPositon->ptCenterX = ptAlign[1].x+pPfPositon->pSettings->x/dConv;
+				pPfPositon->ptCenterY = ptAlign[1].y-pPfPositon->pSettings->y/dScan;
+
+				pPfPositon->ptCenterX += (g_pStatus->GetProfileOption()->m_nProfileOff_A_X/dConv);
+				pPfPositon->ptCenterY += (g_pStatus->GetProfileOption()->m_nProfileOff_A_Y/dScan);					
+			}
+			break;
+		case DIMENSION_B:
+		case DIMENSION_B_DN:			// C,D缁� 璋呴拵鍟� 棣嗘帾, B缁� C鎼佹爮鑲� 鐒婃悂 绐嶄綍 , 75閿�
+			{			
+				if(bUseAlignKey == FALSE)
+				{
+					CvPoint2D32f 		ptMove;
+
+					pPfPositon->ptRealCenter.x = (float)(pPfPositon->pSettings->y * ptAlign[2].x*dConv);
+					pPfPositon->ptRealCenter.y = (float)(pPfPositon->pSettings->x + ptAlign[2].y*dScan);
+
+					ptMove.x = (float)(pPfPositon->pSettings->y/dConv);			
+					ptMove.y = (float)(pPfPositon->pSettings->x/dScan);
+
+					double dCalTheta = -1*atan(static_cast<double>(ptAlign[1].x - ptAlign[0].x) / static_cast<double>((ptAlign[1].y - ptAlign[0].y)));		// C,D缁� 3閿呮幊 鍊旀壖鐗㈣檺鑲� 鍙偢 鐒婃播绐�.
+					//EdgeProc.RotatePoint(ptMove,pPfPositon->ptCenterX,pPfPositon->ptCenterY,ptAlign[2],sin(dCalTheta),cos(dCalTheta));
+					EdgeProc.RotatePoint(ptMove,pPfPositon->ptCenterX,pPfPositon->ptCenterY,sin(dCalTheta),cos(dCalTheta));
+
+					pPfPositon->ptCenterX += ptAlign[2].x;
+					pPfPositon->ptCenterY += ptAlign[2].y;
+
+					g_pLog->DisplayMessage(_T("%s Profile, 1 Align x %.3f,y %.3f, 2 Align x %.3f,y %.3f, 3 Align x %.3f,y %.3f"),PANEL_SIDE[eDimension],ptAlign[0].x,ptAlign[0].y,ptAlign[1].x,ptAlign[1].y,ptAlign[2].x,ptAlign[2].y);
+					g_pLog->DisplayMessage(_T("%s Profile Theta %.5f move x %.3f,y %.3f, Center x %.3f,y %.3f"),PANEL_SIDE[eDimension],dCalTheta,ptMove.x,ptMove.y,pPfPositon->ptCenterX,pPfPositon->ptCenterY);
+
+					pPfPositon->ptCenterX += (g_pStatus->GetProfileOption()->m_nProfileOff_C_DN_X/dConv);		// user offset绡� 鎵佺伯 C绐嶈灍 鍙偢 鍒╀京
+					pPfPositon->ptCenterY += (g_pStatus->GetProfileOption()->m_nProfileOff_C_DN_Y/dScan);						
+				}
+				else
+				{
+					double		AlignX,AlignY;
+					double		dOrgOffsetX,dOrgOffsetY;
+
+					dOrgOffsetX = (double)pPrm->m_nOriginAlignKeyOffsetDwX[eDimension]/dConv;
+					dOrgOffsetY = (double)pPrm->m_nOriginAlignKeyOffsetDwY[eDimension]/dScan;
+
+					AlignX = ptAlign[1].x;
+					AlignY = ptAlign[1].y;				
+
+					pPfPositon->ptCenterX = AlignX + dOrgOffsetX;
+					pPfPositon->ptCenterY = AlignY + dOrgOffsetY;
+
+					g_pLog->DisplayMessage(_T("Use Key %s Profile, 1 Align x %.3f,y %.3f, 2 Align x %.3f,y %.3f"),PANEL_SIDE[eDimension],ptAlign[0].x,ptAlign[0].y,ptAlign[1].x,ptAlign[1].y);
+					g_pLog->DisplayMessage(_T("Use Key %s Profile offset x %.3f,y %.3f, Center x %.3f,y %.3f"),PANEL_SIDE[eDimension],dOrgOffsetX,dOrgOffsetY,pPfPositon->ptCenterX,pPfPositon->ptCenterY);
+				}
+			}		
+			break;
+		case DIMENSION_D:
+		case DIMENSION_D_DN:		// C,D缁� 璋呴拵鍟� 棣嗘帾, D缁� C鎼佹爮鑲� 鐒婃悂 鎯戜綍 , 70閿�
+			{
+				if(bUseAlignKey == FALSE)
+				{
+					CvPoint2D32f 		ptMove;
+					double				dGlassLongSize = (m_pRecipe->GetGlassInfo()->m_nGlassSizeX);		
+
+					int					nCalAlignPos = (int)(dGlassLongSize-LONG_SIDE_INSPECTION_POINT_OFFSET);
+					int					nSetPos = (int)(LONG_SIDE_INSPECTION_POINT_OFFSET+pPfPositon->pSettings->y);
+					double				dMove = nCalAlignPos-nSetPos;
+
+					ptMove.x = (float)(dMove/dConv);
+					ptMove.y = (float)(pPfPositon->pSettings->x/dScan);			
+
+					double dCalTheta = -1*atan(static_cast<double>(ptAlign[1].x - ptAlign[0].x) / static_cast<double>((ptAlign[1].y - ptAlign[0].y)));		// C,D缁� 3閿呮幊 鍊旀壖鐗㈣檺鑲� 鍙偢 鐒婃播绐�.
+					//EdgeProc.RotatePoint(ptMove,pPfPositon->ptCenterX,pPfPositon->ptCenterY,ptAlign[2],sin(dCalTheta),cos(dCalTheta));
+					EdgeProc.RotatePoint(ptMove,pPfPositon->ptCenterX,pPfPositon->ptCenterY,sin(dCalTheta),cos(dCalTheta));
+
+					pPfPositon->ptCenterX += ptAlign[2].x;
+					pPfPositon->ptCenterY += ptAlign[2].y;
+
+					g_pLog->DisplayMessage(_T("%s Profile, 1 Align x %.3f,y %.3f, 2 Align x %.3f,y %.3f, 3 Align x %.3f,y %.3f"),PANEL_SIDE[eDimension],ptAlign[0].x,ptAlign[0].y,ptAlign[1].x,ptAlign[1].y,ptAlign[2].x,ptAlign[2].y);
+					g_pLog->DisplayMessage(_T("%s Profile Theta %.5f move x %.3f,y %.3f, Center x %.3f,y %.3f"),PANEL_SIDE[eDimension],dCalTheta,ptMove.x,ptMove.y,pPfPositon->ptCenterX,pPfPositon->ptCenterY);
+
+					pPfPositon->ptCenterX += (g_pStatus->GetProfileOption()->m_nProfileOff_C_X/dConv);		// user offset绡� 鎵佺伯 C鎯戣灍 鍙偢 鍒╀京
+					pPfPositon->ptCenterY += (g_pStatus->GetProfileOption()->m_nProfileOff_C_Y/dScan);	
+					
+				}
+				else
+				{
+					double		AlignX,AlignY;
+					double		dOrgOffsetX,dOrgOffsetY;
+
+					dOrgOffsetX = (double)pPrm->m_nOriginAlignKeyOffsetDwX[eDimension]/dConv;
+					dOrgOffsetY = (double)pPrm->m_nOriginAlignKeyOffsetDwY[eDimension]/dScan;
+
+					AlignX = ptAlign[1].x;
+					AlignY = ptAlign[1].y;			
+
+					pPfPositon->ptCenterX = AlignX + dOrgOffsetX;
+					pPfPositon->ptCenterY = AlignY + dOrgOffsetY;
+
+					g_pLog->DisplayMessage(_T("Use Key %s Profile, 1 Align x %.3f,y %.3f, 2 Align x %.3f,y %.3f"),PANEL_SIDE[eDimension],ptAlign[0].x,ptAlign[0].y,ptAlign[1].x,ptAlign[1].y);
+					g_pLog->DisplayMessage(_T("Use Key %s Profile offset x %.3f,y %.3f, Center x %.3f,y %.3f"),PANEL_SIDE[eDimension],dOrgOffsetX,dOrgOffsetY,pPfPositon->ptCenterX,pPfPositon->ptCenterY);
+				}
+			}
+			break;	
+		}
+	}
+	else
+	{
+		switch(eDimension)
+		{
+		case DIMENSION_A:
+		case DIMENSION_A_DN:
+			if(iPos == 0)		// 鎯戜綍鍟� 鎵侀湒. shift鐖� 鐭朝
+			{			
+				pPfPositon->ptCenterX = ptAlign[0].x+pPfPositon->pSettings->x/dConv;
+				pPfPositon->ptCenterY = ptAlign[0].y+pPfPositon->pSettings->y/dScan;
+
+				pPfPositon->ptCenterX += (g_pStatus->GetProfileOption()->m_nProfileOff_A_X/dConv);
+				pPfPositon->ptCenterY += (g_pStatus->GetProfileOption()->m_nProfileOff_A_Y/dScan);	
+				
+			}
+			else		// 鎯戜綍 align鎹� 鎵侀湒鎹為鑲� 鎯戜綍缁� 鎷岄瓊鎽硅偤 鑼勪績.
+			{				
+
+				double				dGlassLongSize = (m_pRecipe->GetGlassInfo()->m_nGlassSizeX);
+				double				dCalValue;
+
+				int					nCalAlignPos = (int)(dGlassLongSize-LONG_SIDE_INSPECTION_POINT_OFFSET);
+				int					nSetPos = (int)(LONG_SIDE_INSPECTION_POINT_OFFSET+pPfPositon->pSettings->y);
+				double				dMove = nSetPos-nCalAlignPos;
+
+				dCalValue = dMove/dScan; 			
+
+				pPfPositon->ptCenterX = (pPfPositon->pSettings->x/dConv) + ptAlign[1].x;
+				pPfPositon->ptCenterY = ptAlign[1].y + dCalValue;
+
+				pPfPositon->ptCenterX += (g_pStatus->GetProfileOption()->m_nProfileOff_A_DN_X/dConv);
+				pPfPositon->ptCenterY += (g_pStatus->GetProfileOption()->m_nProfileOff_A_DN_Y/dScan);		
+				
+			}
+			break;
+		case DIMENSION_B:
+		case DIMENSION_B_DN:			// C,D缁� 璋呴拵鍟� 棣嗘帾, B缁� C鎼佹爮鑲� 鐒婃悂 绐嶄綍 , 75閿�
+			{			
+				CvPoint2D32f 		ptMove;
+				double				dGlassLongSize = (m_pRecipe->GetGlassInfo()->m_nGlassSizeX);		
+
+				int					nCalAlignPos = (int)(dGlassLongSize-LONG_SIDE_INSPECTION_POINT_OFFSET);
+				int					nSetPos = (int)(LONG_SIDE_INSPECTION_POINT_OFFSET+pPfPositon->pSettings->y);
+				double				dMove = nCalAlignPos-nSetPos;
+
+				ptMove.x = (float)(dMove/dConv);
+				ptMove.y = (float)(pPfPositon->pSettings->x/dScan);			
+
+				double dCalTheta = -1*atan(static_cast<double>(ptAlign[1].x - ptAlign[0].x) / static_cast<double>((ptAlign[1].y - ptAlign[0].y)));		// C,D缁� 3閿呮幊 鍊旀壖鐗㈣檺鑲� 鍙偢 鐒婃播绐�.
+				//EdgeProc.RotatePoint(ptMove,pPfPositon->ptCenterX,pPfPositon->ptCenterY,ptAlign[2],sin(dCalTheta),cos(dCalTheta));
+				EdgeProc.RotatePoint(ptMove,pPfPositon->ptCenterX,pPfPositon->ptCenterY,sin(dCalTheta),cos(dCalTheta));
+
+				pPfPositon->ptCenterX += ptAlign[2].x;
+				pPfPositon->ptCenterY += ptAlign[2].y;
+
+				g_pLog->DisplayMessage(_T("%s Profile, 1 Align x %.3f,y %.3f, 2 Align x %.3f,y %.3f, 3 Align x %.3f,y %.3f"),PANEL_SIDE[eDimension],ptAlign[0].x,ptAlign[0].y,ptAlign[1].x,ptAlign[1].y,ptAlign[2].x,ptAlign[2].y);
+				g_pLog->DisplayMessage(_T("%s Profile Theta %.5f move x %.3f,y %.3f, Center x %.3f,y %.3f"),PANEL_SIDE[eDimension],dCalTheta,ptMove.x,ptMove.y,pPfPositon->ptCenterX,pPfPositon->ptCenterY);
+
+				pPfPositon->ptCenterX += (g_pStatus->GetProfileOption()->m_nProfileOff_C_X/dConv);		// user offset绡� 鎵佺伯 C鎯戣灍 鍙偢 鍒╀京
+				pPfPositon->ptCenterY += (g_pStatus->GetProfileOption()->m_nProfileOff_C_Y/dScan);	
+				
+			}		
+			break;
+		case DIMENSION_D:
+		case DIMENSION_D_DN:		// C,D缁� 璋呴拵鍟� 棣嗘帾, D缁� C鎼佹爮鑲� 鐒婃悂 鎯戜綍 , 70閿�
+			{
+				CvPoint2D32f 		ptMove;
+
+				pPfPositon->ptRealCenter.x = (float)(pPfPositon->pSettings->y * ptAlign[2].x*dConv);
+				pPfPositon->ptRealCenter.y = (float)(pPfPositon->pSettings->x + ptAlign[2].y*dScan);
+
+				ptMove.x = (float)(pPfPositon->pSettings->y/dConv);			
+				ptMove.y = (float)(pPfPositon->pSettings->x/dScan);
+
+				double dCalTheta = -1*atan(static_cast<double>(ptAlign[1].x - ptAlign[0].x) / static_cast<double>((ptAlign[1].y - ptAlign[0].y)));		// C,D缁� 3閿呮幊 鍊旀壖鐗㈣檺鑲� 鍙偢 鐒婃播绐�.
+				//EdgeProc.RotatePoint(ptMove,pPfPositon->ptCenterX,pPfPositon->ptCenterY,ptAlign[2],sin(dCalTheta),cos(dCalTheta));
+				EdgeProc.RotatePoint(ptMove,pPfPositon->ptCenterX,pPfPositon->ptCenterY,sin(dCalTheta),cos(dCalTheta));
+
+				pPfPositon->ptCenterX += ptAlign[2].x;
+				pPfPositon->ptCenterY += ptAlign[2].y;
+
+				g_pLog->DisplayMessage(_T("%s Profile, 1 Align x %.3f,y %.3f, 2 Align x %.3f,y %.3f, 3 Align x %.3f,y %.3f"),PANEL_SIDE[eDimension],ptAlign[0].x,ptAlign[0].y,ptAlign[1].x,ptAlign[1].y,ptAlign[2].x,ptAlign[2].y);
+				g_pLog->DisplayMessage(_T("%s Profile Theta %.5f move x %.3f,y %.3f, Center x %.3f,y %.3f"),PANEL_SIDE[eDimension],dCalTheta,ptMove.x,ptMove.y,pPfPositon->ptCenterX,pPfPositon->ptCenterY);
+
+				pPfPositon->ptCenterX += (g_pStatus->GetProfileOption()->m_nProfileOff_C_DN_X/dConv);		// user offset绡� 鎵佺伯 C绐嶈灍 鍙偢 鍒╀京
+				pPfPositon->ptCenterY += (g_pStatus->GetProfileOption()->m_nProfileOff_C_DN_Y/dScan);	
+			}
+			break;	
+		}
+	}
+}
+
+int CInspectCamera::GetRCutProfileIndex(DimensionDir eDimension,int *nRcpIndex,int *nRcpSize)
+{
+	CString		strName;
+	int			nProfileCnt = 1;
+
+	// 鎹炲浐鐦� Scan 閴磋緫鎺偤 Index鐢� 缃愰厭鏌績
+	
+	if(m_pRecipe->GetGlassInfo()->m_bPanelReverse == FALSE)
+	{
+		switch(eDimension)
+		{
+		case DIMENSION_A:
+		case DIMENSION_A_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(1,nRcpIndex[0],nRcpSize[0],strName) == FALSE) // A 鎯戣灍 寮�瑙勬阿, Q1(75) ~ Q4(79)
+				return 0;
+			if(m_pGlassData->GetProfileRCutInspectIndex(0,nRcpIndex[1],nRcpSize[1],strName) == FALSE) // A 绐嶈灍 娌ヨ姘�, P1(60) ~ P4(64)
+				return 0;
+			nProfileCnt = 2;
+			break;
+		case DIMENSION_B:
+		case DIMENSION_B_DN:		
+		case DIMENSION_C:
+		case DIMENSION_C_DN:	
+			if(m_pGlassData->GetProfileRCutInspectIndex(2,nRcpIndex[0],nRcpSize[0],strName) == FALSE) // B 绐嶈灍 娌ヨ姘�, N1(65) ~ N4(69)
+				return 0;
+			break;
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(3,nRcpIndex[0],nRcpSize[0],strName) == FALSE) // D 绐嶈灍 寮�瑙勬阿, Q1(70) ~ Q4(74)
+				return 0;
+			break;
+		}
+	}
+	else
+	{
+		switch(eDimension)
+		{
+		case DIMENSION_A:
+		case DIMENSION_A_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(0,nRcpIndex[0],nRcpSize[0],strName) == FALSE) // A 鎯戣灍 娌ヨ姘�, P1(60) ~ P4(64)
+				return 0;
+			if(m_pGlassData->GetProfileRCutInspectIndex(1,nRcpIndex[1],nRcpSize[1],strName) == FALSE) // A 绐嶈灍 寮�瑙勬阿, Q1(75) ~ Q4(79)
+				return 0;
+			nProfileCnt = 2;
+			break;
+		case DIMENSION_B:
+		case DIMENSION_B_DN:		
+			if(m_pGlassData->GetProfileRCutInspectIndex(3,nRcpIndex[0],nRcpSize[0],strName) == FALSE) // B 绐嶈灍 寮�瑙勬阿, Q1(70) ~ Q4(74)
+				return 0;
+			break;
+		case DIMENSION_C:
+		case DIMENSION_C_DN:
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(2,nRcpIndex[0],nRcpSize[0],strName) == FALSE) // D 绐嶈灍 娌ヨ姘�, N1(65) ~ N4(69)
+				return 0;
+			break;
+		}
+	}
+
+	return nProfileCnt;
+}
+
+BOOL CInspectCamera::RCutProfileProcess(DimensionDir emDim,stFrameIndex stFrame,CProfileCADProc *pProcess,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f *ptAlign)
+{
+	if(IsRCutProfileProcess(emDim) == FALSE)
+		return TRUE;
+
+	int		nIndex = -1;
+	BOOL bCheckAlign = CheckAlignMark(emDim,nIndex);
+	if(bCheckAlign == FALSE)
+	{
+		ReFindAlignMark(emDim,stFrame,nIndex);
+
+		if(m_pGlassData != NULL)
+		{
+			INS_EDGE_RESULT_INFO *pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+			if(pResInfo != NULL)
+			{
+				if(pResInfo->bMark[nIndex] == TRUE)
+				{
+					ptAlign[nIndex] = pResInfo->ptMark[nIndex];
+				}				
+			}
+		}
+	}	
+	
+	int nVecCnt = GetRCutProfileIndexTheta(emDim,stFrame,vecProfile,ptAlign);
+	if(nVecCnt <= 0)
+		return FALSE;
+
+	FindRCutProfilePosition(emDim,stFrame,pProcess,vecProfile,ptAlign);
+
+	CalculateProfileSpline(emDim,stFrame,vecProfile);
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::CalculateProfileSpline(DimensionDir eDimension,stFrameIndex stFrame,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile)
+{
+	CProfileInspect_Prm *pPrm =	m_pRecipe->GetProfileParm();
+	vector< pair<double,STU_SPLINE_PROFILE_POSITION*> >::iterator		it;
+	PROFILE_RCUT_PROCESSDATA		RCutResult;
+	PROFILE_RESULT					ProfileResult;
+	CHAMFER_RESULT					ChamferResult;
+	STU_SPLINE_PROFILE_POSITION		*ptProfile;	
+	ST_CHAMFER_SETTING				*pstChamferPrm;	
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double		dConv,dScan;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return FALSE;	
+
+	dConv = pCamera->m_dConvResolution[nStageNo];
+	dScan = pCamera->m_dScanResolution[nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+		return FALSE;	
+
+	srand((unsigned int)time(NULL));
+
+	for(it=vecProfile.begin();it!=vecProfile.end();it++)
+	{
+		ptProfile = it->second;
+		if(ptProfile == NULL)
+			continue;
+		if(ptProfile->iIndex < 0 || ptProfile->iIndex >= MAX_PROFILE_SETTING_COUNT)
+			continue;
+
+		ProfileResult.iCam = RCutResult.iCam = ptProfile->iCam;
+		ProfileResult.iFrame =  RCutResult.iFrame = stFrame.nFrameIdx;
+		ProfileResult.iIndex = RCutResult.iIndex = ptProfile->iIndex;
+		ProfileResult.iScan = RCutResult.iScan = ptProfile->iScan;
+		ProfileResult.iSide = RCutResult.iSide = ptProfile->iSide;
+
+		if(pCamera->m_enCamDir == CAMDIR_BOTTOM)
+		{	
+			ProfileResult.bUseJudge = pPrm->m_stProfile[ptProfile->iIndex].use;			 
+			ProfileResult.nJudgeMinus = (int)ROUND(pPrm->m_stProfile[ptProfile->iIndex].minus);
+			ProfileResult.nJudgePlus = (int)ROUND(pPrm->m_stProfile[ptProfile->iIndex].plus);
+
+			double dReference = pPrm->m_stProfile[ptProfile->iIndex].radius;
+			if(g_pStatus->GetProfileOption()->m_dProfileRadius[nStageNo][ptProfile->iIndex] > 0)
+				dReference = g_pStatus->GetProfileOption()->m_dProfileRadius[nStageNo][ptProfile->iIndex];
+			
+			ProfileResult.nProfileDiff = (int)ROUND(ptProfile->dDist-dReference);
+
+			RCutResult.dCenterX = ptProfile->ptCenterX;
+			RCutResult.dCenterY = ptProfile->ptCenterY;
+			RCutResult.dCADLineX = ptProfile->ptCadLine.x;
+			RCutResult.dCADLineY = ptProfile->ptCadLine.y;
+			RCutResult.dRadius = ptProfile->dRadius;
+			RCutResult.dPixelRadius = RCutResult.dRadius/dScan;
+			RCutResult.ptGlass = ptProfile->ptGlass;
+			RCutResult.ptChamfer = ptProfile->ptChamfer;
+
+			ProfileResult.bProfileJudge = TRUE;
+			RCutRandom(ProfileResult);
+			if(ProfileResult.bUseJudge == TRUE)
+			{				
+				//if(RCutRandom(ProfileResult) == FALSE)
+				{
+					if(ProfileResult.nProfileDiff < -1*ProfileResult.nJudgeMinus || ProfileResult.nProfileDiff > ProfileResult.nJudgePlus)
+					{
+						ProfileResult.bProfileJudge = FALSE;
+						m_pDefectControl->ExtractDefect_ProfileChamfer(eDimension,m_iCamera,stFrame.nScanIdx,DefectLoc_Profile,RCutResult.ptGlass,ptProfile->iIndex);
+					}
+				}				
+			}	
+			m_pGlassData->SetProfileInspectData(ProfileResult.iIndex,&ProfileResult);
+			m_pGlassData->SetRCutProfileInspectData(RCutResult.iIndex,&RCutResult);
+		}		
+
+		if(pCamera->m_enCamDir == CAMDIR_TOP)
+			pstChamferPrm = pPrm->m_stCamferUp;
+		else
+			pstChamferPrm = pPrm->m_stCamferDn;
+
+		ChamferResult.iCam = ptProfile->iCam;
+		ChamferResult.iFrame =  stFrame.nFrameIdx;
+		ChamferResult.iIndex = ptProfile->iIndex;
+		ChamferResult.iScan = ptProfile->iScan;
+		ChamferResult.iSide = ptProfile->iSide;
+		ChamferResult.nUp = (int)pCamera->m_enCamDir;
+		ChamferResult.bUseJudge = pstChamferPrm[ptProfile->iIndex].use;		  
+		ChamferResult.nJudgeReference = (int)ROUND(pstChamferPrm[ptProfile->iIndex].reference);
+		ChamferResult.nJudgePlusChamfer = (int)ROUND(pstChamferPrm[ptProfile->iIndex].plus);
+		ChamferResult.nJudgeMinusChamfer = (int)ROUND(pstChamferPrm[ptProfile->iIndex].minus);
+		ChamferResult.nChamferThick = (int)ROUND(ptProfile->dChamfer-ChamferResult.nJudgeReference);
+		ChamferResult.nChamferCalThick = abs((int)ROUND(ptProfile->dChamfer));
+		ChamferResult.ptCADLine = ptProfile->ptCadLine;
+		ChamferResult.ptChamferLine = ptProfile->ptChamfer;
+		ChamferResult.ptGlassLine = ptProfile->ptGlass;
+
+		ChamferResult.bChamferJudge = TRUE;
+		RCutChamferRandom(ChamferResult);
+		if(ChamferResult.bUseJudge == TRUE)
+		{
+			//if(RCutChamferRandom(ChamferResult) == FALSE)
+			{
+				if(ChamferResult.nChamferCalThick < ChamferResult.nJudgeReference-ChamferResult.nJudgeMinusChamfer || ChamferResult.nChamferCalThick > ChamferResult.nJudgeReference+ChamferResult.nJudgePlusChamfer)
+				{
+					ChamferResult.bChamferJudge = FALSE;
+					m_pDefectControl->ExtractDefect_ProfileChamfer(eDimension,m_iCamera,stFrame.nScanIdx,DefectLoc_Chamfer,ChamferResult.ptGlassLine,ptProfile->iIndex);
+				}
+			}
+		}
+
+		m_pGlassData->SetProfileChamferInspectData(ChamferResult.iIndex,ChamferResult.nUp,&ChamferResult);
+	}	
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::FindRCutProfilePosition(DimensionDir eDimension,stFrameIndex stFrame,CProfileCADProc *pProcess,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f *ptAlign)
+{
+	vector< pair<double,STU_SPLINE_PROFILE_POSITION*> >::iterator		it;
+	STU_SPLINE_PROFILE_POSITION		*pProfilePos;
+
+	double				dConv,dScan;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return 0;	
+
+	dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	dScan = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+		return 0;	
+
+	for(it=vecProfile.begin();it!=vecProfile.end();it++)
+	{
+		pProfilePos = it->second;
+		if(pProfilePos == NULL || pProfilePos->iIndex < 0)
+			continue;
+		
+		FindRCutPosition(pProfilePos,eDimension,stFrame,pProcess);
+
+		/*
+		if(pProfilePos->iLoop == 0 || pProfilePos->iLoop == 4)
+		{
+			double			dTheta = (pProfilePos->dTheta);
+			if(pProfilePos->dTheta == 0 || pProfilePos->dTheta == 360)
+			{				
+				pProfilePos->dDist = abs(pProfilePos->ptGlass.x-pProfilePos->ptCenterX)*dConv;
+				pProfilePos->dChamfer = abs(pProfilePos->ptGlass.x-pProfilePos->ptChamfer.x)*dConv;			
+			}
+			else
+			{
+				pProfilePos->dDist = abs(pProfilePos->ptGlass.y-pProfilePos->ptCenterY)*dScan;
+				pProfilePos->dChamfer = abs(pProfilePos->ptGlass.y-pProfilePos->ptChamfer.y)*dScan;
+			}
+		}
+		else
+		*/
+		{
+			double dDx	= abs(pProfilePos->ptGlass.x-pProfilePos->ptCenterX)*dConv;
+			double dDy	= abs(pProfilePos->ptGlass.y-pProfilePos->ptCenterY)*dScan;
+			pProfilePos->dDist = sqrtf(float(dDx *dDx + dDy*dDy));
+
+			dDx	= abs(pProfilePos->ptGlass.x-pProfilePos->ptChamfer.x)*dConv;
+			dDy	= abs(pProfilePos->ptGlass.y-pProfilePos->ptChamfer.y)*dScan;
+			pProfilePos->dChamfer = sqrtf(float(dDx *dDx + dDy*dDy));
+		}		
+	}
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::FindRCutPosition(STU_SPLINE_PROFILE_POSITION *pProfilePos,DimensionDir eDimension,stFrameIndex stFrame,CProfileCADProc *pProcess)
+{
+	COwnerBuffer		bufTgt;	
+	CEdgeProc			EdgeProc;
+
+	/*
+	if(pProfilePos->iLoop == 0 || pProfilePos->iLoop == 4)
+	{
+		FindRCutNoRotateFind(pProfilePos,pRecipe);
+	}
+	else
+	*/
+	{
+		ROI		ImgROI = GetRCutProcessImage(pProfilePos,eDimension,stFrame,bufTgt);			
+
+		if(pProfilePos->iPos <0 || pProfilePos->iPos > 1)
+			return FALSE;
+
+		int			nGlassThres = m_pRecipe->GetInspectInfo()->m_nRCutThresGlass[eDimension][1];
+		int			nChamferThres = m_pRecipe->GetInspectInfo()->m_nRCutThresChamfer[eDimension][1];
+
+		if(eDimension == DIMENSION_A || eDimension == DIMENSION_A_DN)
+		{
+			nGlassThres = m_pRecipe->GetInspectInfo()->m_nRCutThresGlass[eDimension][pProfilePos->iPos];
+			nChamferThres = m_pRecipe->GetInspectInfo()->m_nRCutThresChamfer[eDimension][pProfilePos->iPos];
+		}
+
+		IMPOS2D				ptGlassEdgePos,ptChamferEdgePos;
+		
+		FindGlassChamfer(pProfilePos->iIndex,eDimension,stFrame,bufTgt,nGlassThres,nChamferThres,ptGlassEdgePos,ptChamferEdgePos);
+		
+		double dSin = sin(M_RADIAN(pProfilePos->dTheta));
+		double dCos = cos(M_RADIAN(pProfilePos->dTheta));
+		IMPOS2D				p1,posCen;
+
+		posCen.u = pProfilePos->ptCenterX;
+		posCen.v = pProfilePos->ptCenterY;
+
+		ptGlassEdgePos.u += ImgROI.u1;
+		ptGlassEdgePos.v += ImgROI.v1;
+		ptChamferEdgePos.u += ImgROI.u1;
+		ptChamferEdgePos.v += ImgROI.v1;
+
+		EdgeProc.IMRotatePoint(ptGlassEdgePos, &p1, posCen, dSin, dCos) ;
+		pProfilePos->ptGlass.x = (float)p1.u;
+		pProfilePos->ptGlass.y = (float)p1.v;
+
+		EdgeProc.IMRotatePoint(ptChamferEdgePos, &p1, posCen, dSin, dCos) ;
+
+		pProfilePos->ptChamfer.x = (float)p1.u;
+		pProfilePos->ptChamfer.y = (float)p1.v;	
+	}	
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::FindGlassChamfer(int index,DimensionDir eDimension,stFrameIndex stFrame,CSISBuffer &bufTgt,int nGlassThres,int nChamferThres,IMPOS2D &ptGlassEdgePos,IMPOS2D &ptChamferEdgePos)
+{
+	CEdgeProc			EdgeProc;
+	CSISEdgeFind		EdgeFind;		
+
+	double		dPitch = 10;
+	
+	int			nGlassEdge = 0;
+	if(EdgeFind.FindEdge_ToRight(&bufTgt,nGlassEdge,dPitch,nGlassThres,0.3,0) == FALSE)
+	{
+		ptGlassEdgePos.u = (float)bufTgt.GetWidth()/2;
+		ptGlassEdgePos.v = (float)bufTgt.GetHeight()/2;
+		g_pLog->DisplayMessage(_T("%s RCut Profile Edge Detect Fail : index %d"),PANEL_SIDE[eDimension],index);
+	}
+	else
+	{
+		ptGlassEdgePos.u = (float)nGlassEdge;
+		ptGlassEdgePos.v = (float)bufTgt.GetHeight()/2;
+	}
+
+	COwnerBuffer		CopyBuffer(bufTgt.GetWidth(),bufTgt.GetHeight());
+	CRect				CopyRect(0,0,bufTgt.GetWidth(),bufTgt.GetHeight());
+
+	CSISBuffer::CopyBtoA(CopyBuffer,0,0,bufTgt,CopyRect);	
+
+	EdgeProc.ThresholdProcessing(bufTgt.GetDataAddress(),CSize(bufTgt.GetWidth(),bufTgt.GetHeight()),nChamferThres,0);
+
+	int				nChamferEndge = nGlassEdge+2;
+	int				nContiCnt = 0;
+
+	int				uStart,uEnd;
+
+	uStart = (int)ptGlassEdgePos.u;
+	uEnd = uStart + 80;
+	if(uEnd > bufTgt.GetWidth()-1)
+		uEnd = bufTgt.GetWidth()-1;
+
+	for(int u=uStart;u<uEnd;u++)
+	{
+		if(bufTgt.GetPixel(u,bufTgt.GetHeight()/2) == 255)
+			nContiCnt++;
+		else
+		{
+			if(nContiCnt >= 3)
+			{
+				nChamferEndge = u-1;
+				break;
+			}
+		}		
+	}
+
+	ptChamferEdgePos.u = (float)nChamferEndge;
+	ptChamferEdgePos.v = (float)bufTgt.GetHeight()/2;	
+
+	{
+		for(int v=0;v<CopyBuffer.GetHeight();v++)
+		{
+			if(ptGlassEdgePos.u < 0 || ptGlassEdgePos.u > CopyBuffer.GetWidth())
+				continue;
+			CopyBuffer.SetPixel((int)ptGlassEdgePos.u,v,128);
+			if(ptChamferEdgePos.u < 0 || ptChamferEdgePos.u > CopyBuffer.GetWidth())
+				continue;
+			CopyBuffer.SetPixel((int)ptChamferEdgePos.u,v,128);
+		}
+
+		CString		str;
+		str.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\ChamferRes_%s_%d.bmp"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime,PANEL_SIDE[eDimension],index);
+		CBufferAttach		attach(str);
+		attach.AttachToFile(CopyBuffer);
+	}	
+
+	return TRUE;
+}
+
+ROI CInspectCamera::GetRCutProcessImage(STU_SPLINE_PROFILE_POSITION *pProfilePos,DimensionDir eDimension,stFrameIndex stFrame,COwnerBuffer &pTgt)
+{
+	int					nDistance;
+	ROI					aoi;
+	double				dSin,dCos;
+	IMPOS2D				posCen;
+	int					n4ByteWidth;
+	LPBYTE				lpBuffer;
+	CEdgeProc			EdgeProc;
+	CSISBuffer			bufOrg;
+	const int			nSearchArea = 500;
+	const int			nSearchHeight = 3;	
+
+	dSin = sin(M_RADIAN(pProfilePos->dTheta));
+	dCos = cos(M_RADIAN(pProfilePos->dTheta));
+	posCen.u = pProfilePos->ptCenterX;
+	posCen.v = pProfilePos->ptCenterY;
+
+	nDistance = (int)GetRadus2Distance(eDimension,stFrame, pProfilePos->dTheta,pProfilePos->dRadius,dSin,dCos);	
+
+	aoi.u1 = aoi.u2 = aoi.v1 = aoi.v2 = 0;
+	lpBuffer = m_pGrabber->GetFrameHeaderLine(pProfilePos->iScan,0);
+	if(lpBuffer == NULL)
+		return aoi;
+
+	int		nFrameWidth,nFrameHeight;
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	bufOrg.SetBuffer(lpBuffer,nFrameWidth,g_pBase->m_pMemFrameNo[m_iCamera]*nFrameHeight);
+
+	aoi.u1 = (int)ROUND(posCen.u) - nDistance - nSearchArea;
+	aoi.u2 = (int)ROUND(posCen.u) - nDistance + nSearchArea;
+	aoi.v1 = (int)ROUND(posCen.v) - nSearchHeight;
+	aoi.v2 = (int)ROUND(posCen.v) + nSearchHeight;
+
+	n4ByteWidth = align_4byte(EdgeProc.IMROIWidth(aoi));
+	aoi.u2 = aoi.u1 + n4ByteWidth;
+	pTgt.SetSize(EdgeProc.IMROIWidth(aoi),EdgeProc.IMROIHeight(aoi));
+
+	EdgeProc.IMGetRotImg(aoi,bufOrg,pTgt,posCen,dSin,dCos);	
+
+	return aoi;
+}
+
+double CInspectCamera::GetRadus2Distance(DimensionDir eDimension,stFrameIndex stFrame,double dtheta,double dRadius,double dSin,double dCons)
+{
+	CvPoint2D32f		iPos;
+	double				dXPos,dYPos;
+	double				dConv,dScan;
+	CEdgeProc			EdgeProc;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return 0;	
+
+	dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	dScan = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+		return 0;	
+
+	iPos.x = (float)dRadius;
+	iPos.y = 0;
+	EdgeProc.RotatePoint(iPos, dXPos,dYPos,dSin, dCons);
+
+	double dDx	= dXPos/dConv;
+	double dDy	= dYPos/dScan;
+
+	return sqrtf(float(dDx *dDx + dDy*dDy));
+}
+
+#define MAX_RCUT_PROFILE_COUNT 5
+BOOL CInspectCamera::RCutRandom(PROFILE_RESULT &ProfileResult)
+{
+	CInspectOption	*pOpt =	g_pStatus->GetInspectOption();
+
+	if(pOpt->bUseRandomData == FALSE)
+		return FALSE;
+
+	CRandomDataSet		*pDataSet = NULL;
+	if(PROFILE_RCUT_INSPECT_INDEX_A <= ProfileResult.iIndex && PROFILE_RCUT_INSPECT_INDEX_A+MAX_RCUT_PROFILE_COUNT > ProfileResult.iIndex)
+		pDataSet = &pOpt->A1_Rcut;
+	else if(PROFILE_RCUT_INSPECT_INDEX_B <= ProfileResult.iIndex && PROFILE_RCUT_INSPECT_INDEX_B+MAX_RCUT_PROFILE_COUNT > ProfileResult.iIndex)
+		pDataSet = &pOpt->A2_Rcut;
+	else if(PROFILE_RCUT_INSPECT_INDEX_C <= ProfileResult.iIndex && PROFILE_RCUT_INSPECT_INDEX_C+MAX_RCUT_PROFILE_COUNT > ProfileResult.iIndex)
+		pDataSet = &pOpt->C1_Rcut;
+	else if(PROFILE_RCUT_INSPECT_INDEX_D <= ProfileResult.iIndex && PROFILE_RCUT_INSPECT_INDEX_D+MAX_RCUT_PROFILE_COUNT > ProfileResult.iIndex)
+		pDataSet = &pOpt->C2_Rcut;	
+
+	if(pDataSet == NULL)
+		return FALSE;
+
+	if(abs(ProfileResult.nProfileDiff) > pDataSet->Profile.dLimit)
+		return FALSE;
+
+	if(ProfileResult.nProfileDiff < pDataSet->Profile.dMin || ProfileResult.nProfileDiff > pDataSet->Profile.dMax)
+	{
+		int		nRandMax = (int)max(fabs(pDataSet->Profile.dMin),fabs(pDataSet->Profile.dMax));
+		
+		int		nValue = rand()%nRandMax;
+		int		nDir = rand()%1;
+
+		if(nDir == 0)
+		{
+			if(nValue > fabs(pDataSet->Profile.dMin))
+				nValue = (int)pDataSet->Profile.dMin;			
+
+			if(nValue > 0)
+				nValue = -1*nValue;
+		}
+		else
+		{
+			if(nValue > fabs(pDataSet->Profile.dMax))
+				nValue = (int)pDataSet->Profile.dMax;
+
+			if(nValue < 0)
+				nValue = -1*nValue;
+		}
+
+		ProfileResult.nProfileDiff = nValue;
+	}
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::ProfileRandom(PROFILE_RESULT &ProfileResult)
+{
+	CInspectOption	*pOpt =	g_pStatus->GetInspectOption();
+
+	if(pOpt->bUseRandomData == FALSE)
+		return FALSE;
+
+	CRandomDataSet		*pDataSet = NULL;
+	if(PROFILE_INSPECT_INDEX_B <= ProfileResult.iIndex && PROFILE_INSPECT_INDEX_B+PROFILE_INSPECT_SIZE_B_D > ProfileResult.iIndex)
+		pDataSet = &pOpt->B_GrindLine;
+	else if(PROFILE_INSPECT_INDEX_D <= ProfileResult.iIndex && PROFILE_INSPECT_INDEX_D+PROFILE_INSPECT_SIZE_B_D > ProfileResult.iIndex)
+		pDataSet = &pOpt->D_GrindLine;
+	else if(PROFILE_INSPECT_INDEX_C <= ProfileResult.iIndex && PROFILE_INSPECT_INDEX_C+PROFILE_INSPECT_SIZE_A_C > ProfileResult.iIndex)
+		pDataSet = &pOpt->C_GrindLine;
+	else if(PROFILE_INSPECT_INDEX_A <= ProfileResult.iIndex && PROFILE_INSPECT_INDEX_A+PROFILE_INSPECT_SIZE_A_C > ProfileResult.iIndex)
+		pDataSet = &pOpt->A1_GrindLine;
+	else if(PROFILE_INSPECT_INDEX_CF <= ProfileResult.iIndex && PROFILE_INSPECT_INDEX_CF+PROFILE_INSPECT_SIZE_A_C > ProfileResult.iIndex)
+		pDataSet = &pOpt->A2_GrindLine;
+
+	if(pDataSet == NULL)
+		return FALSE;
+
+	if(abs(ProfileResult.nProfileDiff) > pDataSet->Profile.dLimit)
+		return FALSE;
+
+	if(ProfileResult.nProfileDiff < pDataSet->Profile.dMin || ProfileResult.nProfileDiff > pDataSet->Profile.dMax)
+	{
+		int		nRandMax = (int)max(fabs(pDataSet->Profile.dMin),fabs(pDataSet->Profile.dMax));
+
+		int		nValue = rand()%nRandMax;
+		int		nDir = rand()%1;
+
+		if(nDir == 0)
+		{
+			if(nValue > fabs(pDataSet->Profile.dMin))
+				nValue = (int)pDataSet->Profile.dMin;			
+
+			if(nValue > 0)
+				nValue = -1*nValue;
+		}
+		else
+		{
+			if(nValue > fabs(pDataSet->Profile.dMax))
+				nValue = (int)pDataSet->Profile.dMax;
+
+			if(nValue < 0)
+				nValue = -1*nValue;
+		}
+
+		ProfileResult.nProfileDiff = nValue;
+	}
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::RCutChamferRandom(CHAMFER_RESULT &ChamferResult)
+{
+	CInspectOption	*pOpt =	g_pStatus->GetInspectOption();
+
+	if(pOpt->bUseRandomData == FALSE)
+		return FALSE;
+
+	CRandomDataSet		*pDataSet = NULL;
+	if(PROFILE_RCUT_INSPECT_INDEX_A <= ChamferResult.iIndex && PROFILE_RCUT_INSPECT_INDEX_A+MAX_RCUT_PROFILE_COUNT > ChamferResult.iIndex)
+		pDataSet = &pOpt->A1_Rcut;
+	else if(PROFILE_RCUT_INSPECT_INDEX_B <= ChamferResult.iIndex && PROFILE_RCUT_INSPECT_INDEX_B+MAX_RCUT_PROFILE_COUNT > ChamferResult.iIndex)
+		pDataSet = &pOpt->A2_Rcut;
+	else if(PROFILE_RCUT_INSPECT_INDEX_C <= ChamferResult.iIndex && PROFILE_RCUT_INSPECT_INDEX_C+MAX_RCUT_PROFILE_COUNT > ChamferResult.iIndex)
+		pDataSet = &pOpt->C1_Rcut;
+	else if(PROFILE_RCUT_INSPECT_INDEX_D <= ChamferResult.iIndex && PROFILE_RCUT_INSPECT_INDEX_D+MAX_RCUT_PROFILE_COUNT > ChamferResult.iIndex)
+		pDataSet = &pOpt->C2_Rcut;	
+
+	if(pDataSet == NULL)
+		return FALSE;
+
+	CRandomData		*pRndData = NULL;
+
+	if(ChamferResult.nUp == CAMDIR_TOP)
+		pRndData = &pDataSet->ChamferUp;
+	else
+		pRndData = &pDataSet->ChamferDn;
+
+	if(abs(ChamferResult.nChamferCalThick) > pRndData->dLimit)
+		return FALSE;
+
+	if(ChamferResult.nChamferCalThick < pRndData->dMin || ChamferResult.nChamferCalThick > pRndData->dMax)
+	{
+		int		nRandMax = (int)max(fabs(pRndData->dMin),fabs(pRndData->dMax));
+		int		nValue = rand()%nRandMax;
+
+		if(abs(nValue) < fabs(pRndData->dMin))
+			nValue = (int)pRndData->dMin;	
+		if(abs(nValue) > fabs(pRndData->dMax))
+			nValue = (int)pRndData->dMax;	
+
+		ChamferResult.nChamferCalThick = abs(nValue);
+	}
+
+	ChamferResult.nChamferThick = (int)ROUND(ChamferResult.nChamferCalThick-ChamferResult.nJudgeReference);
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::ChamferRandom(CHAMFER_RESULT &ChamferResult)
+{
+	CInspectOption	*pOpt =	g_pStatus->GetInspectOption();
+
+	if(pOpt->bUseRandomData == FALSE)
+		return FALSE;
+
+	CRandomDataSet		*pDataSet = NULL;
+	if(PROFILE_INSPECT_INDEX_B <= ChamferResult.iIndex && PROFILE_INSPECT_INDEX_B+PROFILE_INSPECT_SIZE_B_D > ChamferResult.iIndex)
+		pDataSet = &pOpt->B_GrindLine;
+	else if(PROFILE_INSPECT_INDEX_D <= ChamferResult.iIndex && PROFILE_INSPECT_INDEX_D+PROFILE_INSPECT_SIZE_B_D > ChamferResult.iIndex)
+		pDataSet = &pOpt->D_GrindLine;
+	else if(PROFILE_INSPECT_INDEX_C <= ChamferResult.iIndex && PROFILE_INSPECT_INDEX_C+PROFILE_INSPECT_SIZE_A_C > ChamferResult.iIndex)
+		pDataSet = &pOpt->C_GrindLine;
+	else if(PROFILE_INSPECT_INDEX_A <= ChamferResult.iIndex && PROFILE_INSPECT_INDEX_A+PROFILE_INSPECT_SIZE_A_C > ChamferResult.iIndex)
+		pDataSet = &pOpt->A1_GrindLine;
+	else if(PROFILE_INSPECT_INDEX_CF <= ChamferResult.iIndex && PROFILE_INSPECT_INDEX_CF+PROFILE_INSPECT_SIZE_A_C > ChamferResult.iIndex)
+		pDataSet = &pOpt->A2_GrindLine;
+
+	if(pDataSet == NULL)
+		return FALSE;
+
+	CRandomData		*pRndData = NULL;
+
+	if(ChamferResult.nUp == CAMDIR_TOP)
+		pRndData = &pDataSet->ChamferUp;
+	else
+		pRndData = &pDataSet->ChamferDn;
+
+	if(abs(ChamferResult.nChamferCalThick) > pRndData->dLimit)
+		return FALSE;
+
+	if(ChamferResult.nChamferCalThick < pRndData->dMin || ChamferResult.nChamferCalThick > pRndData->dMax)
+	{
+		int		nRandMax = (int)max(fabs(pRndData->dMin),fabs(pRndData->dMax));
+		int		nValue = rand()%nRandMax;
+
+		if(abs(nValue) < fabs(pRndData->dMin))
+			nValue = (int)pRndData->dMin;	
+		if(abs(nValue) > fabs(pRndData->dMax))
+			nValue = (int)pRndData->dMax;	
+
+		ChamferResult.nChamferCalThick = abs(nValue);
+	}
+
+	ChamferResult.nChamferThick = (int)ROUND(ChamferResult.nChamferCalThick-ChamferResult.nJudgeReference);
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::CalculateProfileChamfer(DimensionDir emDim,stFrameIndex stFrame,CProfileCADProc *pProcess,vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f ptAlign)
+{
+	if((int)vecProfile.size() <= 0)
+		return FALSE;
+	if(m_pGlassData == NULL)
+		return FALSE;
+
+	CProfileInspect_Prm *pPrm = m_pRecipe->GetProfileParm();
+	vector< pair<int,STU_PROFILE_POSITION*> >::iterator		it;
+	STU_PROFILE_POSITION		*ptProfile;
+	STU_THICKPOS	stThick;
+	int				nPosY;
+	PROFILE_RESULT	ProfileResult;
+	CHAMFER_RESULT	ChamferResult;
+	ST_PROFILE_SETTING	stPrm;
+	ST_CHAMFER_SETTING	stChamferPrm;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return FALSE;	
+
+	double dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0)
+		return FALSE;	
+
+	double		dProfileAvg;
+	double		dChamferAvg;
+
+	GetAvgProfileNChamfer(emDim,stFrame,vecProfile,dProfileAvg,dChamferAvg);
+
+	INS_EDGE_RESULT_INFO *pResInfo =  NULL;
+	pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+
+	CINSPECT_JUDGEMENT_PARM *pJudgePrm = m_pRecipe->GetJudgePrm();
+
+	srand((unsigned int)time(NULL));
+
+	for(it=vecProfile.begin();it!=vecProfile.end();it++)
+	{
+		ptProfile = it->second;
+		if(ptProfile == NULL)
+			continue;
+		if(ptProfile->iIndex < 0 || ptProfile->iIndex >= MAX_PROFILE_SETTING_COUNT)
+			continue;
+
+		stPrm = pPrm->m_stProfile[ptProfile->iIndex];
+		if(pCamera->m_enCamDir == CAMDIR_TOP)
+			stChamferPrm = pPrm->m_stCamferUp[ptProfile->iIndex];
+		else
+			stChamferPrm = pPrm->m_stCamferDn[ptProfile->iIndex];
+
+		nPosY = ptProfile->point.y;
+		nPosY -= pResInfo->nGlassStartLine;
+		stThick = GetThickPosResultPos(stFrame,nPosY);
+
+		ProfileResult.ptFullImg.x = (float)ptProfile->point.x;
+		ProfileResult.ptFullImg.y = (float)ptProfile->point.y;		
+		ProfileResult.ptGlassLine.x = (float)stThick.nLeftLine;
+		ProfileResult.ptGlassLine.y = (float)ptProfile->point.y;	
+
+		ProfileResult.iCam = m_iCamera;
+		ProfileResult.iIndex = ptProfile->iIndex;
+		ProfileResult.iFrame = stFrame.nFrameIdx;
+		ProfileResult.iScan = stFrame.nScanIdx;
+		ProfileResult.iSide = (int)emDim;		
+
+		if(pCamera->m_enCamDir == CAMDIR_BOTTOM)
+		{			
+			ProfileResult.ptGlassAlign.x = (float)ptProfile->point.x;
+			ProfileResult.ptGlassAlign.y = (float)ptProfile->point.y;
+			ProfileResult.ptGlassAlign.y += (float)(-1*ptAlign.y);
+			ProfileResult.ptGlassStart = ProfileResult.ptFullImg;
+			ProfileResult.ptGlassStart.y += (float)(-pResInfo->nGlassStartLine);					
+			ProfileResult.nProfileDiff = (int)((double)(ptProfile->point.x - stThick.nLeftLine)*dConv);	
+			ProfileResult.bUseJudge = stPrm.use;		
+			ProfileResult.nJudgePlus = (int)(stPrm.plus);
+			ProfileResult.nJudgeMinus = (int)(stPrm.minus);			
+
+			ProfileResult.bProfileJudge = TRUE;
+			ProfileRandom(ProfileResult);
+			if(ProfileResult.bUseJudge == TRUE)
+			{
+				//if(ProfileRandom(ProfileResult) == FALSE)
+				{
+					if(ProfileResult.nProfileDiff < -1*ProfileResult.nJudgeMinus || ProfileResult.nProfileDiff > ProfileResult.nJudgePlus)
+					{
+						if(pJudgePrm->AvgProfile[emDim].bUse == TRUE && dProfileAvg > 0)
+						{
+							if(abs(ProfileResult.nProfileDiff-(int)dProfileAvg) > pJudgePrm->AvgProfile[emDim].nDiff)
+							{
+								ProfileResult.bProfileJudge = FALSE;
+								m_pDefectControl->ExtractDefect_ProfileChamfer(emDim,m_iCamera,stFrame.nScanIdx,DefectLoc_Profile,ProfileResult.ptFullImg,ptProfile->iIndex);
+								g_pLog->DisplayMessage(_T("%s Avg Profile Option NG : Index %d,Diff %d,Avg %.2f,Setting %d"),PANEL_SIDE[emDim],ProfileResult.iIndex,ProfileResult.nProfileDiff,dProfileAvg,pJudgePrm->AvgProfile[emDim].nDiff);
+							}
+						}
+						else
+						{
+							ProfileResult.bProfileJudge = FALSE;
+							m_pDefectControl->ExtractDefect_ProfileChamfer(emDim,m_iCamera,stFrame.nScanIdx,DefectLoc_Profile,ProfileResult.ptFullImg,ptProfile->iIndex);
+						}					
+					}
+				}				
+			}		
+
+			m_pGlassData->SetProfileInspectData(ptProfile->iIndex,&ProfileResult);
+		}		
+
+		ChamferResult.iCam = m_iCamera;
+		ChamferResult.iIndex = ptProfile->iIndex;
+		ChamferResult.iFrame = stFrame.nFrameIdx;
+		ChamferResult.iScan = stFrame.nScanIdx;
+		ChamferResult.iSide = (int)emDim;
+		ChamferResult.nUp = (int)pCamera->m_enCamDir;
+		ChamferResult.nJudgeReference = (int)(stChamferPrm.reference);
+		ChamferResult.nJudgeMinusChamfer = (int)(stChamferPrm.minus);
+		ChamferResult.nJudgePlusChamfer = (int)(stChamferPrm.plus);
+		ChamferResult.bUseJudge = stChamferPrm.use;
+		ChamferResult.nChamferThick = (int)(stThick.dThick-ChamferResult.nJudgeReference);	
+		ChamferResult.nChamferCalThick = abs((int)ROUND(stThick.dThick));
+		ChamferResult.nGlassLeft = stThick.nLeftLine;
+		ChamferResult.nGlassRight = stThick.nRightLine;
+		ChamferResult.ptChamferLine.x = (float)stThick.nRightLine-1;
+		ChamferResult.ptChamferLine.y = (float)(ProfileResult.ptFullImg.y);
+		ChamferResult.ptFull.x = (float)ptProfile->point.x;
+		ChamferResult.ptFull.y = (float)ptProfile->point.y;		
+
+		ChamferResult.bChamferJudge = TRUE;
+		//ChamferRandom(ChamferResult);
+		if(ChamferResult.bUseJudge == TRUE)
+		{
+			if(ChamferRandom(ChamferResult) == FALSE)
+			{
+				if(ChamferResult.nChamferCalThick < ChamferResult.nJudgeReference-ChamferResult.nJudgeMinusChamfer || ChamferResult.nChamferCalThick > ChamferResult.nJudgeReference+ChamferResult.nJudgePlusChamfer)
+				{
+					if(pJudgePrm->AvgChamfer[emDim].bUse == TRUE && dChamferAvg > 0)
+					{
+						if(abs(ChamferResult.nChamferCalThick-(int)dChamferAvg) > pJudgePrm->AvgChamfer[emDim].nDiff)
+						{
+							ChamferResult.bChamferJudge = FALSE; 
+							m_pDefectControl->ExtractDefect_ProfileChamfer(emDim,m_iCamera,stFrame.nScanIdx,DefectLoc_Chamfer,ChamferResult.ptFull,ptProfile->iIndex);
+
+							g_pLog->DisplayMessage(_T("%s Avg Chamfer Option NG : Index %d,Diff %d,Avg %.2f,Setting %d"),PANEL_SIDE[emDim],ChamferResult.iIndex,ChamferResult.nChamferCalThick,dChamferAvg,pJudgePrm->AvgChamfer[emDim].nDiff);
+						}
+					}
+					else
+					{
+						ChamferResult.bChamferJudge = FALSE; 
+						m_pDefectControl->ExtractDefect_ProfileChamfer(emDim,m_iCamera,stFrame.nScanIdx,DefectLoc_Chamfer,ChamferResult.ptFull,ptProfile->iIndex);
+					}					
+				}
+			}			
+		}
+
+		m_pGlassData->SetProfileChamferInspectData(ChamferResult.iIndex,ChamferResult.nUp,&ChamferResult);
+
+	}
+
+	g_pLog->DisplayMessage(_T("%s Calculate Profile Postion :Profile %d"),PANEL_SIDE[emDim],(int)vecProfile.size());
+
+	return TRUE;
+}
+
+STU_THICKPOS CInspectCamera::GetThickPosResultPos( stFrameIndex stFrame,int nYPos)
+{
+	int			nMinPos = INT_MAX;
+
+	std::vector<STU_THICKPOS>::iterator	it;
+	STU_THICKPOS	stTmpThick;
+	STU_THICKPOS	stThick;
+
+	for(it=m_resultThickPos[stFrame.nScanIdx].begin();it!=m_resultThickPos[stFrame.nScanIdx].end();it++)
+	{
+		stTmpThick = *it;
+		
+		if(abs(stTmpThick.nTopLine-nYPos) < nMinPos)
+		{
+			nMinPos = abs(stTmpThick.nTopLine-nYPos);
+			stThick = stTmpThick;
+		}
+	}
+
+	return stThick;
+}
+
+BOOL CInspectCamera::GetAvgProfileNChamfer(DimensionDir emDim,stFrameIndex stFrame,vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile,double &dProfileAvg,double &dChamferAvg)
+{
+	double		dProfileCnt,dChamferCnt;
+	CProfileInspect_Prm *pPrm = m_pRecipe->GetProfileParm();
+	vector< pair<int,STU_PROFILE_POSITION*> >::iterator		it;
+	STU_PROFILE_POSITION		*ptProfile;
+	STU_THICKPOS	stThick;
+	ST_PROFILE_SETTING	stPrm;
+	ST_CHAMFER_SETTING	stChamferPrm;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return FALSE;	
+
+	double dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0)
+		return FALSE;	
+
+	INS_EDGE_RESULT_INFO *pResInfo =  NULL;
+	pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+
+	double	dProfileSum,dChamferSum;
+
+	dProfileAvg = dProfileCnt = dChamferAvg = dChamferCnt = 0.;
+	dProfileSum = dChamferSum = 0.;
+
+	CINSPECT_JUDGEMENT_PARM *pJudgePrm = m_pRecipe->GetJudgePrm();
+	if(pJudgePrm->AvgProfile[emDim].bUse == TRUE || pJudgePrm->AvgChamfer[emDim].bUse == TRUE)
+	{
+		for(it=vecProfile.begin();it!=vecProfile.end();it++)
+		{
+			ptProfile = it->second;
+			if(ptProfile == NULL)
+				continue;
+			if(ptProfile->iIndex < 0 || ptProfile->iIndex >= MAX_PROFILE_SETTING_COUNT)
+				continue;
+
+			stPrm = pPrm->m_stProfile[ptProfile->iIndex];			
+
+			int nPosY = ptProfile->point.y;
+			nPosY -= pResInfo->nGlassStartLine;
+
+			stThick = GetThickPosResultPos(stFrame,nPosY);
+
+			if(pJudgePrm->AvgProfile[emDim].bUse == TRUE)
+			{
+				if(pCamera->m_enCamDir == CAMDIR_BOTTOM)
+				{
+					int nDiffProfile = (int)((double)(ptProfile->point.x - stThick.nLeftLine)*dConv);	
+					if(nDiffProfile < -1*(int)(stPrm.minus) || nDiffProfile > (int)(stPrm.plus))
+					{
+						;
+					}
+					else
+					{
+						dProfileSum += nDiffProfile;
+						dProfileCnt++;
+					}
+				}
+			}
+
+			if(pJudgePrm->AvgChamfer[emDim].bUse == TRUE)
+			{
+				if(pCamera->m_enCamDir == CAMDIR_TOP)
+					stChamferPrm = pPrm->m_stCamferUp[ptProfile->iIndex];
+				else
+					stChamferPrm = pPrm->m_stCamferDn[ptProfile->iIndex];
+
+				int nChamferThick = (int)(stThick.dThick-(int)(stChamferPrm.reference));	
+
+				if(nChamferThick < -1*(int)(stChamferPrm.minus) || nChamferThick > (int)(stChamferPrm.plus))
+				{
+					;
+				}
+				else
+				{
+					dChamferSum += (int)ROUND(stThick.dThick);
+					dChamferCnt++;
+				}
+			}
+		}
+	}
+
+	if(dProfileCnt > 0)
+		dProfileAvg = dProfileSum/dProfileCnt;
+	if(dChamferCnt > 0)
+		dChamferAvg = dChamferSum/dChamferCnt;
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::MakeProfilePosition(DimensionDir emDim,stFrameIndex stFrame,CProfileCADProc *pProcess,vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f *ptAlign)
+{
+	if(m_pGlassData == NULL)
+	{
+		g_pLog->DisplayMessage(_T("%s MakeProfilePosition Glass NULL : Frame %d"),PANEL_SIDE[emDim],stFrame.nFrameIdx);
+		return FALSE;
+	}
+
+	CProfileInspect_Prm *pPrm = m_pRecipe->GetProfileParm();
+
+	CvPoint2D32f		ptOffset;
+	double		dConv,dScan;
+
+	ptOffset.x = (float)pPrm->m_nCADOffsetX[emDim];
+	ptOffset.y = (float)pPrm->m_nCADOffsetY[emDim];
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+	{
+		g_pLog->DisplayMessage(_T("%s MakeProfilePosition Camera NULL : Frame %d"),PANEL_SIDE[emDim],stFrame.nFrameIdx);
+		return FALSE;	
+	}
+	
+	dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	dScan = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+	{
+		g_pLog->DisplayMessage(_T("%s MakeProfilePosition Res Null : Frame %d, %d,%.3f,%.3f"),PANEL_SIDE[emDim],stFrame.nFrameIdx,g_pBase->m_nStageNo,dConv,dScan);
+		return FALSE;
+	}
+
+	ptOffset.x = (float)((double)ptOffset.x / dConv);
+	ptOffset.y = (float)((double)ptOffset.y / dScan);	
+
+	int			nRcpIndex,nRcpIndexEnd;
+	int			iIndex;
+	ST_PROFILE_SETTING	stProfile;
+	const int	nRange = 5;
+	STU_PROFILE_POSITION	*pPfPositon;
+	CString		str;
+
+	if(m_pGlassData->GetProfileInspectIndex(emDim,nRcpIndex,nRcpIndexEnd,str) == FALSE)
+	{
+		g_pLog->DisplayMessage(_T("%s MakeProfilePosition GetProfileInspectIndex NULL : Frame %d, %d,%d"),PANEL_SIDE[emDim],stFrame.nFrameIdx,nRcpIndex,nRcpIndexEnd);
+		return FALSE;
+	}
+
+	pProcess->RotateProfileData(ptAlign[0],ptAlign[1],ptOffset);
+
+	int			nAlignOffset = 0;
+	CINSPECT_JUDGEMENT_PARM *pJudgePrm = m_pRecipe->GetJudgePrm();	
+
+	switch(emDim)
+	{
+	case DIMENSION_C:
+	case DIMENSION_C_DN:
+		nAlignOffset = 4777;//pJudgePrm->ptAlign[0][DIMENSION_C].y - pJudgePrm->ptAlign[0][DIMENSION_A].y;
+		break;
+	case DIMENSION_B:
+	case DIMENSION_B_DN:
+	case DIMENSION_D:
+	case DIMENSION_D_DN:
+		nAlignOffset = -9000;//1440;//pJudgePrm->ptAlign[0][pRecipe->GetDimension()].y - 1440; // Edge <-> Align : 1.44mm 鐖舵�� 鍝楅湒淇�.
+		break;
+	}
+
+	CPoint		ptCADOrgin = pProcess->GetProfileOrigin();
+	for(iIndex=nRcpIndex;iIndex<nRcpIndex+nRcpIndexEnd;iIndex++)
+	{
+		stProfile = pPrm->m_stProfile[iIndex];
+		if(stProfile.use == FALSE)
+			continue;
+
+		pPfPositon = new STU_PROFILE_POSITION;
+
+		pPfPositon->nMin = (int)((stProfile.y)/dScan) -nRange;
+		pPfPositon->nMax = (int)((stProfile.y)/dScan) + nRange;
+		pPfPositon->nMin += (int)ptCADOrgin.y;
+		pPfPositon->nMax += (int)ptCADOrgin.y;
+		// 		pPfPositon->nMin += (int)(ptAlign[0].y-ptCADOrgin.y);
+		// 		pPfPositon->nMax += (int)(ptAlign[0].y-ptCADOrgin.y);
+		pPfPositon->nMin += (int)(nAlignOffset/dScan);
+		pPfPositon->nMax += (int)(nAlignOffset/dScan);
+
+		pPfPositon->iIndex = iIndex;
+		pPfPositon->iScan = stFrame.nScanIdx;
+		pPfPositon->iSide = (int)emDim;
+
+		vecProfile.push_back(make_pair(pPfPositon->nMin, pPfPositon));				
+	}
+
+	std::sort(vecProfile.begin(),vecProfile.end(),less< pair<int,STU_PROFILE_POSITION*> >());
+
+	pProcess->GetProfilePosition(vecProfile);
+
+	g_pLog->DisplayMessage(_T("%s Make Profile Postion :Profile %d"),PANEL_SIDE[emDim],(int)vecProfile.size());
+
+	return TRUE;
+}
+
+void CInspectCamera::CalculateStageTheta(DimensionDir emDim,int iScan, CvPoint2D32f *pAlign)
+{
+	BOOL		bLong;
+	switch(emDim)
+	{
+	case DIMENSION_A:
+		bLong = TRUE;
+		break;
+	case DIMENSION_B:
+		bLong = FALSE;
+		break;
+	default:
+		return;
+	}
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,iScan);
+	if(pCamera == NULL)
+		return;	
+
+	double dx = (pAlign[1].x-pAlign[0].x) * pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	double dy = (pAlign[1].y-pAlign[0].y) * pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	double dTheta = asin(dx/dy) * RAD_TO_DEGREE;
+
+	if(dTheta > 1.0 || dTheta < -1.0)
+	{
+		g_pLog->DisplayMessage(_T("%s Calculate %d Stage Theta Limit over[degree 1] : %.3f -> 0"),PANEL_SIDE[emDim],g_pBase->m_nStageNo,dTheta);
+		dTheta = 0;
+	}
+
+	short nTheta = (short)(-1*dTheta*1000);
+
+	m_pGlassData->SetStageTheta(g_pBase->m_nStageNo,bLong,nTheta);
+
+	g_pLog->DisplayMessage(_T("%s Calculate %d Stage Theta : %.3f, Send %d"),PANEL_SIDE[emDim],g_pBase->m_nStageNo,dTheta,nTheta);
+}
+
+BOOL CInspectCamera::CheckProfile(int iThread,DimensionDir emDim,stFrameIndex stFrame)
+{
+	INS_EDGE_RESULT_INFO *pResInfo =  NULL;
+
+	if(m_pGlassData != NULL)
+		pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+
+	if(pResInfo == NULL)
+		return FALSE;
+
+	if(pResInfo->nPreGlassEndLine <= 0)
+		return FALSE;
+
+	if(pResInfo->nPreGlassEndFrame > stFrame.nFrameIdx)
+		return FALSE;
+
+	CSingleLock		cLock(&m_csThreadProfile);
+	cLock.Lock();
+
+	if(m_bProfileFind[stFrame.nScanIdx] == TRUE)
+	{
+		cLock.Unlock();
+		return FALSE;
+	}
+
+	m_bProfileFind[stFrame.nScanIdx] = TRUE;
+	m_nProfileFindFrameIdx[stFrame.nScanIdx] = stFrame.nFrameIdx;
+	cLock.Unlock();	
+
+	return TRUE;
+}
+
+void CInspectCamera::FinallyVisionProc(DimensionDir eDim, stFrameIndex stFrame) {
+	/* code */
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo(eDim);
+	BOOL isFindSuccess = pResInfo->bMark[0] && pResInfo->bMark[1];
+	if (!isFindSuccess) return;
+
+	PROFILECHAMFER_RESULT_DATA* pProfileResult = m_pGlassData->GetProfileInspectData();
+
+	double lastTime = GetTickCount();
+	int idx = (int)(eDim);
+	double dTime = fabs(lastTime - m_fInspectLastTime[idx]);
+	if (dTime < 3000) return;
+
+	CBlSideData *pBlSideData = BlVision_GetVisionRecipe()->getSideData(eDim);
+	//Set Info
+	pBlSideData->m_bInspection_Complete = TRUE;
+	pBlSideData->m_bTopMark_Find = FALSE;
+	pBlSideData->m_bBotMark_Find = FALSE;
+	pBlSideData->m_bTopPoint_Find = FALSE;
+	pBlSideData->m_bBotPoint_Find = FALSE;
+	pBlSideData->m_mTopMark.x = 0;
+	pBlSideData->m_mTopMark.y = 0;
+	pBlSideData->m_mBotMark.x = 0;
+	pBlSideData->m_mBotMark.y = 0;
+	pBlSideData->m_mTopPoint.x = 0;
+	pBlSideData->m_mTopPoint.y = 0;
+	pBlSideData->m_mBotPoint.x = 0;
+	pBlSideData->m_mBotPoint.y = 0;
+	pBlSideData->m_nStartLine = 0;
+	pBlSideData->m_nEndLine = 0;
+
+	//Set MarkPos
+	if (pResInfo->bMark[0]) {
+		pBlSideData->m_bTopMark_Find = TRUE;
+		pBlSideData->m_mTopMark.x = (int)(pResInfo->ptMark[0].x);
+		pBlSideData->m_mTopMark.y = (int)(pResInfo->ptMark[0].y);
+	}
+
+	//Set MarkPos
+	if (pResInfo->bMark[1]) {
+		pBlSideData->m_bBotMark_Find = TRUE;
+		pBlSideData->m_mBotMark.x = (int)(pResInfo->ptMark[1].x);
+		pBlSideData->m_mBotMark.y = (int)(pResInfo->ptMark[1].y);
+	}
+
+	pBlSideData->m_nStartLine = pResInfo->nGlassStartLine;
+	pBlSideData->m_nEndLine = pResInfo->nGlassEndLine;
+
+	m_fInspectLastTime[idx] = lastTime;
+	pBlSideData->m_vDispVisionResult.clear();
+
+	int nStageNo = (g_pBase->m_nStageNo > 1 || g_pBase->m_nStageNo < 0) ? 0 : g_pBase->m_nStageNo;
+	BlVision_GetSoftVisionApp()->setStage(g_pBase->m_nStageNo);
+
+	NgInfo ngArray[NG_INF_TOTAL];
+	int ngNum = BlVision_GetSoftVisionApp()->Execute((int)(eDim), ngArray);
+	if (ngNum < 1) return;
+
+#if 0
+	typedef struct _NgInfo
+	{
+		int eDir;                //妫�娴嬮潰
+		int id;                  //妫�娴婭D
+		CString strName;        //鍚嶇О
+		int xPosPxl;            //X浣嶇疆
+		int yPosPxl;            //Y浣嶇疆
+		double result;          //缁撴灉
+		double xResult;          //缁撴灉
+		double yResult;         //缁撴灉
+		double minValue;        //涓嬮檺
+		double maxValue;        //闄愬埗
+		int ngType;             //缂洪櫡绫诲瀷
+		bool isRes;             //妫�娴嬬粨鏋�
+		int x1;                 //缂洪櫡鐨勬渶灏忕煩褰�
+		int y1;                 //缂洪櫡鐨勬渶灏忕煩褰�
+		int x2;                 //缂洪櫡鐨勬渶灏忕煩褰�
+		int y2;                 //缂洪櫡鐨勬渶灏忕煩褰�
+		int eVision;            //瑙嗚绠楁硶
+	}NgInfo;
+#endif
+	CString test_data_kdist;
+	CString test_file_path;
+	CFile test_module;
+	CFileException test_exception;
+
+	CString glass_id;
+	glass_id.Format(_T("%s"), g_pBase->m_strHPanelID);
+	CString	strTime = g_pBase->m_strLoadingTime;
+	std::string array_dir_use[9] = { "A TOP","B TOP", "C TOP", "D TOP", "A BOT", "B BOT","C BOT", "D BOT", "NONE" };
+	std::string array_type_use[7] = { "Unknown", "OK", "Chip", "Broken", "Grind", "Dist Cut", "Corner Dist" };
+
+	test_file_path.Format(_T("D:\\TestData\\%s_TestData.csv"), g_pBase->m_strLoadingDay);
+	::CreateDirectory(_T("D:\\TestData"), NULL);
+
+	int	nFrameWidth, nFrameHeight;
+	GetFrameSize(m_iCamera, stFrame.nScanIdx, nFrameWidth, nFrameHeight);
+	INS_EDGE_RESULT_INFO* pEdgeInfo = m_pGlassData->GetEdgeResultInfo(eDim);
+	if (pEdgeInfo == NULL)
+		return;
+
+	int	nSetEnd = pEdgeInfo->nGlassEndLine <= 0 ? pEdgeInfo->nPreGlassEndLine : pEdgeInfo->nGlassEndLine;
+	int	nOffset = 1000;
+	int	nStartLine = pEdgeInfo->nGlassStartLine - nOffset / 2;
+	int	nEndLine = nSetEnd + nOffset / 2;
+	int nDefectIdx = 0;
+	for (int i = 0; i < ngNum; i++) {
+		NgInfo ng = ngArray[i];    //渚鹅焷璀啀雽勮綆頇у眻
+		if (ng.eDir > 8 || ng.eDir < 0) continue;
+		if (ng.ngType > 7 || ng.ngType < 0) continue;
+		if (ng.x1 < 0 || ng.y1 < nStartLine) continue;
+		if (ng.x2 > nFrameWidth || ng.y2 > nEndLine) continue;
+
+		if ((1 == ng.ngType || 2 == ng.ngType)/* && (ng.result < ng.minValue || ng.result > ng.maxValue)*/)
+		{
+			CvPoint2D32f  ptDefec;
+			ptDefec.x = ng.xPosPxl;
+			ptDefec.y = ng.yPosPxl;
+			CRect rectDefect(ng.x1, ng.y1, ng.x2, ng.y2);
+
+			if (m_pDefectControl != NULL/* && nDefectIdx < 1*/)
+				m_pDefectControl->ExtractDefect_KDist(eDim, m_iCamera, stFrame.nScanIdx, DefectLoc_RCUTChip, ptDefec, rectDefect, (int)(ng.result));
+
+			//nDefectIdx++;
+		}
+		//Hole
+		if ((6 == ng.ngType)/* && (ng.result < ng.minValue || ng.result > ng.maxValue)*/)
+		{
+			CvPoint2D32f  ptDefec;
+			ptDefec.x = ng.xPosPxl;
+			ptDefec.y = ng.yPosPxl;
+			CRect rectDefect(ng.x1, ng.y1, ng.x2, ng.y2);
+			std::vector<CRect> vecList;
+			vecList.push_back(rectDefect);
+
+			CPoint ps = rectDefect.CenterPoint();
+			int offx = ng.x2 - ps.x;
+			int offy = ng.y2 - ps.y;
+
+			if (m_pDefectControl != NULL/* && nDefectIdx < 1*/)
+				m_pDefectControl->ExtractDefect_Hole(eDim, m_iCamera, stFrame.nScanIdx, vecList, ngNum, DefectLoc_Hole, CRect(offx, offy, 2 * offx,2 * offy));
+			
+		}
+		if (5 == ng.ngType)
+		{
+			if (ng.eDir==4)
+			{
+				if (ng.id<6)
+				{
+					pProfileResult->ProfileData[59 + i].nProfileDiff = ng.result;
+					if (ng.maxValue<ng.result||ng.minValue>ng.result)
+					{
+						pProfileResult->ProfileData[59+i].bUseJudge = TRUE;
+						pProfileResult->ProfileData[59 + i].bProfileJudge = FALSE;
+					}
+					
+				}
+				else if (5<ng.id&& ng.id < 11)
+				{
+					pProfileResult->ProfileData[69 + i].nProfileDiff = ng.result;
+					if (ng.maxValue<ng.result || ng.minValue>ng.result)
+					{
+						pProfileResult->ProfileData[69 + i].bUseJudge = TRUE;
+						pProfileResult->ProfileData[69+i].bProfileJudge = FALSE;
+					}
+				}
+				else if (10<ng.id && ng.id < 16)
+				{
+				  pProfileResult->ResultChamfer[49 +i][1].nChamferCalThick = ng.result;
+				  if (ng.maxValue<ng.result || ng.minValue>ng.result)
+				  {
+					  pProfileResult->ResultChamfer[49 + i][1].bUseJudge = TRUE;
+					  pProfileResult->ResultChamfer[49+i][1].bChamferJudge= FALSE;
+				  }
+				}
+				else if (15<ng.id && ng.id < 21)
+				{
+					pProfileResult->ResultChamfer[59 +i][1].nChamferCalThick = ng.result;
+					if (ng.maxValue<ng.result || ng.minValue>ng.result)
+					{
+						pProfileResult->ResultChamfer[59 + i][1].bUseJudge = TRUE;
+						pProfileResult->ResultChamfer[59+i][1].bChamferJudge = FALSE;
+					}
+				}
+				
+			}
+
+			if (ng.eDir == 5)
+			{
+				if (ng.id < 6)
+				{
+					pProfileResult->ProfileData[64 + i].nProfileDiff = ng.result;
+					if (ng.maxValue<ng.result || ng.minValue>ng.result)
+					{
+						pProfileResult->ProfileData[64 + i].bUseJudge = TRUE;
+						pProfileResult->ProfileData[64 + i].bProfileJudge = FALSE;
+					}
+
+				}
+				else if (5 < ng.id && ng.id < 11)
+				{
+					pProfileResult->ResultChamfer[59 + i][1].nChamferCalThick = ng.result;
+					if (ng.maxValue<ng.result || ng.minValue>ng.result)
+					{
+						pProfileResult->ResultChamfer[59 + i][1].bUseJudge = TRUE;
+						pProfileResult->ResultChamfer[59 + i][1].bChamferJudge = FALSE;
+					
+					}
+				}
+
+			}
+			if (ng.eDir == 7)
+			{
+				if (ng.id < 6)
+				{
+					pProfileResult->ProfileData[69 + i].nProfileDiff = ng.result;
+					if (ng.maxValue<ng.result || ng.minValue>ng.result)
+					{
+						pProfileResult->ProfileData[69 + i].bUseJudge = TRUE;
+						pProfileResult->ProfileData[69 + i].bProfileJudge = FALSE;
+					}
+
+				}
+				else if (5 < ng.id && ng.id < 11)
+				{
+					pProfileResult->ResultChamfer[64 + i][1].nChamferCalThick = ng.result;
+					if (ng.maxValue<ng.result || ng.minValue>ng.result)
+					{
+						pProfileResult->ResultChamfer[64 + i][1].bUseJudge = TRUE;
+						pProfileResult->ResultChamfer[64+i][1].bChamferJudge = FALSE;
+					}
+				}
+			}
+		}
+			
+		if (5 == ng.ngType && (ng.result < ng.minValue || ng.result > ng.maxValue))
+		{
+			CvPoint2D32f  ptDefec;
+			ptDefec.x = ng.xPosPxl;
+			ptDefec.y = ng.yPosPxl;
+
+			if (test_data_kdist.IsEmpty())
+			{
+				test_data_kdist.AppendFormat(_T("%s,%s,%s,%s,%s,%f"),
+					strTime,
+					glass_id,
+					array_type_use[ng.ngType],
+					array_dir_use[ng.eDir],
+					ng.strName,
+					ng.result);
+			}
+			else
+			{
+				test_data_kdist.AppendFormat(_T("%s,%s,%f"),
+					array_dir_use[ng.eDir],
+					ng.strName,
+					ng.result);
+			}
+
+			CRect rectDefect(ng.x1, ng.y1, ng.x2, ng.y2);
+			if (m_pDefectControl != NULL)
+				m_pDefectControl->ExtractDefect_KDist(eDim, m_iCamera, stFrame.nScanIdx, DefectLoc_KDist, ptDefec, rectDefect, (int)(ng.result));
+		}
+
+		g_pLog->DisplayMessage(_T("%d FinallyVisionProc return[%d]: %s %s (%d,%d) (%d %d %d %d) %.2f")
+			, g_pBase->m_strHPanelID, i, array_dir_use[ng.eDir], array_type_use[ng.ngType], ng.xPosPxl, ng.yPosPxl
+		    , ng.x1, ng.y1, ng.x2, ng.y2, ng.result);
+	}
+	test_data_kdist.Append(_T("\r\n"));
+
+	test_module.Open(test_file_path, CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate | CFile::shareDenyWrite | CFile::shareDenyRead, &test_exception);
+	if (test_exception.m_cause == CFileException::none)
+	{
+		if (test_module.SeekToEnd() == 0L)
+		{
+			CString test_title;
+			test_title.Format(_T("Time,Glass ID,eDir,Defect Type,Name,Result\r\n"));
+			test_module.Write(test_title, test_title.GetLength() * sizeof(TCHAR));
+		}
+		test_module.Write(test_data_kdist, test_data_kdist.GetLength() * sizeof(TCHAR));
+		test_module.Close();
+	}
+}
+
+BOOL CInspectCamera::CheckThreadEnd(int iThread,stFrameIndex stFrame,BOOL bProfile)
+{
+	int			iScan = stFrame.nScanIdx;
+
+	CSingleLock		myLoc(&m_csThreadEnd);	
+	myLoc.Lock();
+
+	if(m_iThreadEnd[iScan][iThread] == 1)
+	{
+		myLoc.Unlock();
+		return FALSE;	
+	}
+
+	BOOL		bEnd = FALSE;
+
+	if(bProfile == TRUE ||	CheckProcessEnd(iThread,stFrame) == TRUE)
+	{		
+		m_iThreadEnd[iScan][iThread] = 1;
+		bEnd = TRUE;
+		myLoc.Unlock();
+	}	
+
+	if(bEnd == TRUE)
+	{
+		DimensionDir		emDim = GetDimension(iScan);			
+		g_pLog->DisplayMessage(_T("%s Thread %d Process End : Scan %d, Frame %d"),PANEL_SIDE[emDim],iThread,iScan,stFrame.nFrameIdx);		
+
+		if(GetThreadEndCount(iScan) == MAX_THREAD || bProfile == TRUE)
+		{
+			SaveFullImageCopy(iScan);
+
+			// Waiting All Frame Finish..
+			/*
+			DWORD dwTickCount = GetTickCount();
+
+			while(GetTickCount() - dwTickCount < 5000)
+			{
+				if(CheckAllFrameFinish(iScan) == TRUE)
+					break;
+			}
+			*/
+
+			myLoc.Lock();
+			{
+				HANDLE hThread = GetCurrentThread();
+				SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST);
+				g_pLog->DisplayMessage(_T("FinallyVisionProc took start - %s"), PANEL_SIDE[emDim]);
+				auto startTime = std::chrono::high_resolution_clock::now();
+				FinallyVisionProc(emDim, stFrame);
+				auto endTime = std::chrono::high_resolution_clock::now();
+				auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
+				g_pLog->DisplayMessage(_T("FinallyVisionProc took %lld milliseconds - %s"), duration.count(), PANEL_SIDE[emDim]);
+				g_pLog->DisplayMessage(_T("FinallyVisionProc took end - %s"), PANEL_SIDE[emDim]);
+				SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL);
+			}
+			myLoc.Unlock();
+
+			if(m_pII2S != NULL)
+				m_pII2S->II2S_InspectionEnd(m_iCamera,iScan);
+
+			g_pLog->DisplayMessage(_T("%s Scan Process All End"),PANEL_SIDE[emDim]);
+
+			m_MsgJob.nState = 2;
+			m_MsgJob.nSide = (int)emDim;
+			::SendMessage(m_hWndViewScan, WM_POCESS_STATUS,(WPARAM)&m_MsgJob, (int)emDim);
+		}		
+	}
+
+	myLoc.Unlock();
+
+	return bEnd;
+}
+
+int	CInspectCamera::GetThreadEndCount(int iScan)
+{
+	int			nCount = 0;
+	for(int i=0;i<MAX_THREAD;i++)
+		if(m_iThreadEnd[iScan][i] == 1)
+			nCount++;
+
+	return nCount;
+}
+
+void CInspectCamera::ResetFrameFinish(int nCurrentScanIdx)
+{
+	CSingleLock cslocalLock(&m_csFrameFinishCheck);
+	cslocalLock.Lock();
+
+	m_nFrameFinishIdx[nCurrentScanIdx] = -1;
+
+	for(int i=0; i<MAX_FRAM_COUNT; i++)
+		m_bFrameFinish[nCurrentScanIdx][i] = FALSE;
+
+	cslocalLock.Unlock();
+}
+
+void CInspectCamera::SetFrameFinishEndFrame(int nCurrentScanIdx, int nFrameIdx)
+{
+	CSingleLock cslocalLock(&m_csFrameFinishCheck);
+	cslocalLock.Lock();
+
+	m_nFrameFinishIdx[nCurrentScanIdx] = nFrameIdx;
+
+	cslocalLock.Unlock();
+}
+
+void CInspectCamera::SetFrameFinish(int nCurrentScanIdx, int nCurrentFrameIdx)
+{
+	CSingleLock cslocalLock(&m_csFrameFinishCheck);
+	cslocalLock.Lock();
+
+	m_bFrameFinish[nCurrentScanIdx][nCurrentFrameIdx] = TRUE;
+
+	cslocalLock.Unlock();
+}
+
+BOOL CInspectCamera::CheckAllFrameFinish(int nCurrentScanIdx)
+{
+	CSingleLock cslocalLock(&m_csFrameFinishCheck);
+	cslocalLock.Lock();
+
+	if(m_nFrameFinishIdx[nCurrentScanIdx] == -1)
+		return FALSE;
+
+	for(int i=0; i<m_nFrameFinishIdx[nCurrentScanIdx]; i++)
+		if(m_bFrameFinish[nCurrentScanIdx][i] == FALSE)
+			return FALSE;
+
+	return TRUE;
+}
+
+DIT_RESULT CInspectCamera::FindHoleInspection(int iThread,DimensionDir	emDim,stFrameIndex stFrame,int iFindLine)
+{
+	DIT_RESULT ret= DIT_CONV_SUCCESS;	
+	CHOLEINSPECT_PARM		*pHolePrm = m_pRecipe->GetHolePrm();
+
+	if(pHolePrm->m_nTotalHoleCount <= 0)
+		return ret;
+
+	INS_EDGE_RESULT_INFO *pResInfo =  NULL;
+
+	if(m_pGlassData != NULL)
+		pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+
+	std::vector<HOLE_INS_PARM>	vecReg;
+
+	GetHoleRegionFrame(iThread,emDim,stFrame,vecReg);
+
+	if((int)vecReg.size() <= 0)
+		return ret;
+
+	std::vector<HOLE_INS_PARM>::iterator		it;
+	HOLE_INS_PARM		HoleReg;
+
+	for(it=vecReg.begin();it!=vecReg.end();it++)
+	{
+		HoleReg = *it;
+
+		CRect rtArea = HoleReg.m_rtArea;
+		rtArea.OffsetRect(CPoint((int)pResInfo->ptMark[0].x, (int)pResInfo->ptMark[0].y));
+		rtArea.InflateRect(100,100);
+
+		IplImage* pTargetImage = cvCreateImage(cvSize(rtArea.Width(), rtArea.Height()), 8, 1);
+		cvZero(pTargetImage);
+
+		int nStartX = rtArea.left;
+		int nStartY = rtArea.top;
+
+		BYTE* pGrabBuffer = NULL;
+
+		for(int i=0; i< rtArea.Height(); i++)
+		{
+			pGrabBuffer = m_pGrabber->GetFrameHeaderLine(stFrame.nScanIdx,nStartY+i);
+
+			if(pGrabBuffer == NULL)
+				continue;
+
+			memcpy(&pTargetImage->imageData[pTargetImage->widthStep*i], pGrabBuffer+nStartX, sizeof(BYTE)*pTargetImage->width);
+		}
+
+		std::vector<CRect> vecDefectList;
+		IplImage* pViewImage = NULL;
+
+		CPoint ptMatchingPos;
+
+		GetHoleControl(iThread)->HoleInspect_TemplateMatching(&HoleReg, pTargetImage, vecDefectList, ptMatchingPos, &pViewImage);
+
+		rtArea.OffsetRect(ptMatchingPos);
+
+		if((int)vecDefectList.size() > 0)
+		{ 
+			m_pDefectControl->ExtractDefect_Hole(emDim,m_iCamera,stFrame.nScanIdx,vecDefectList,(int)vecDefectList.size(),DefectLoc_Hole,rtArea);
+		}
+
+		cvReleaseImage(&pTargetImage);
+
+		cvReleaseImage(&pViewImage);
+	}
+
+	return ret;
+}
+
+CRect CInspectCamera::GetSplineInsRect_New(int iThread,DimensionDir	emDim,CSize szMaster,CPoint nOffset,stFrameIndex stFrame,int iFindLine,BOOL &bFlip)
+{		
+	CRect		rectIns(0,0,0,0);		
+	CvPoint2D32f ptAlign = CvPoint2D32f(0,0);
+	BOOL		bFindAlign = FALSE;
+
+	int			nFrameWidth,nFrameHeight;
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	int			nStartLine,nEndLine;
+
+	nStartLine = nEndLine = 0;
+	INS_EDGE_RESULT_INFO *pResInfo = NULL;
+	if(m_pGlassData != NULL)
+	{
+		pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pResInfo != NULL)
+		{
+			if(pResInfo->bMark[0] == TRUE)
+			{
+				bFindAlign = pResInfo->bMark[0];
+				ptAlign = pResInfo->ptMark[0];
+			}
+
+			nStartLine = pResInfo->nGlassStartLine;
+			nEndLine = pResInfo->nPreGlassEndLine;
+		}
+	}
+
+	bFlip = FALSE;
+	if(bFindAlign == TRUE && stFrame.nFrameIdx > (int)((ptAlign.y)/nFrameHeight) && pResInfo->bSpline[0] == FALSE)
+	{		
+		rectIns.left = 0;
+		rectIns.right = nFrameWidth;
+		rectIns.top = nStartLine-nOffset.y;
+		rectIns.bottom = nStartLine + szMaster.cx;		
+		pResInfo->bSpline[0] = TRUE;
+	}
+	else if(nEndLine > 0 && stFrame.nFrameIdx == nEndLine/nFrameHeight)
+	{
+		DWORD dwTact = GetTickCount();
+
+		do 
+		{
+			if(pResInfo == NULL)
+				break;
+
+			if(pResInfo->bMark[1] == TRUE)
+				break;
+
+			if(GetTickCount()-dwTact >= 3000)
+			{
+				g_pLog->DisplayMessage(_T("%s Spline Ins Rect timeout : %d=%d"),PANEL_SIDE[emDim],nEndLine/nFrameHeight,stFrame.nFrameIdx);
+				break;
+			}
+
+			Sleep(0);
+
+		} while (1);
+
+		rectIns.left = 0;
+		rectIns.right = nFrameWidth;
+		rectIns.bottom = nEndLine + nOffset.y;
+		rectIns.top = nEndLine-szMaster.cy;		
+		bFlip = TRUE;
+		pResInfo->bSpline[1] = TRUE;
+	}
+	else
+		return rectIns;		
+
+	AssertFrameRectWidth(rectIns,stFrame.nScanIdx);
+
+	int			nWidth = align_4byte(rectIns.Width());
+	rectIns.left = rectIns.right - nWidth;
+
+	if(rectIns.Width() <= 0 || rectIns.Height() <= 0 || rectIns.left > rectIns.right || rectIns.top > rectIns.bottom)
+		return rectIns;
+
+	return rectIns;
+}
+
+DIT_RESULT CInspectCamera::FindSpline_New(int iThread,DimensionDir	emDim,stFrameIndex stFrame,int iFindLine)
+{
+	DIT_RESULT ret= DIT_CONV_SUCCESS;	
+
+	switch(emDim)
+	{
+	case DIMENSION_B:
+	case DIMENSION_B_DN:
+	case DIMENSION_D:
+	case DIMENSION_D_DN:
+		return ret;
+	}
+
+	pSTU_SPLINE_INS_PARM pSplinePrm = m_pRecipe->GetInspectInfo()->GetSplineIns(emDim);
+	pSTU_SPLINE_CHIP_PARM	pChipPrm =	m_pRecipe->GetInspectInfo()->GetSplineChipIns(emDim);
+	CETC_PARM		*pEtc =	m_pRecipe->GetEtcPrm(emDim);		
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+
+	if(pSplinePrm == NULL || pEtc == NULL || pChipPrm == NULL || pChipPrm->m_bSplineChip == FALSE)
+		return ret;
+
+	int			nFrameWidth,nFrameHeight;
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	CSize		szMaster = CSize(pSplinePrm->m_nStartCornerSize_Y,pSplinePrm->m_nEndCornerSize_Y);
+	CPoint		nOffset(100,100);
+	BOOL		bFlip;
+	CRect		rectIns;	
+
+	rectIns = GetSplineInsRect_New(iThread,emDim,szMaster,nOffset,stFrame,iFindLine,bFlip);		
+	if(rectIns.IsRectEmpty() == TRUE)
+	{
+		//	g_pLog->DisplayMessage(_T("Cam[%d] Scan[%d] iThread[%d] Frame[%d] %s Spline No Region!"),GetCameraID(),pRecipe->GetScanIndex(),iThread,iFrame,strCutDiv);		
+		return ret;	
+	}	
+
+	if(rectIns.top < 0 || rectIns.left < 0)
+		return ret;	
+
+	CvPoint2D32f ptSplineCen = GetSplineCenter(iThread,emDim,stFrame,bFlip);
+	if(ptSplineCen.x <= 0 || ptSplineCen.y <= 0)
+	{
+		g_pLog->DisplayMessage(_T("%s iThread[%d] Frame[%d] %d Spline Fail! : Center is Null"),PANEL_SIDE[emDim],iThread,stFrame.nFrameIdx,bFlip);	
+		return ret;
+	}
+
+	CProfileInspect_Prm *pPrm = m_pRecipe->GetProfileParm();
+	int			nRcpIndex[2],nRcpSize[2];
+
+	GetRCutProfileIndex(emDim,nRcpIndex,nRcpSize);
+
+	if(nRcpIndex[0] < 0 || nRcpIndex[0] >= MAX_PROFILE_SETTING_COUNT)
+	{
+		g_pLog->DisplayMessage(_T("%s iThread[%d] Frame[%d] %d Spline Fail! : Radius is Null"),PANEL_SIDE[emDim],iThread,stFrame.nFrameIdx,bFlip);	
+		return ret;
+	}
+	
+	double dRadius = (bFlip == FALSE) ? pSplinePrm->m_nStartCornerRadius_um : pSplinePrm->m_nEndCornerRadius_um; // pPrm->m_stProfile[nRcpIndex[0]].radius;
+	int				nSpIndex = 0;
+
+	if(bFlip == TRUE)
+		nSpIndex = 1;	
+
+	SetRCutDisplayImage(iThread,emDim,stFrame,rectIns,bFlip,dRadius,ptSplineCen);	
+
+	double			dStartTheta = pChipPrm->m_dChipStartTheta;
+	double			dEndTheta = pChipPrm->m_dChipEndTheta;
+	double			dDistTheta = pChipPrm->m_dChipDistTheta;	
+	CEdgeProc		EdgeProc;
+	int				nEdgeThres = m_pRecipe->GetInspectInfo()->m_nRCutThresGlass[emDim][nSpIndex];
+	int				nChamferThres = m_pRecipe->GetInspectInfo()->m_nRCutThresChamfer[emDim][nSpIndex];
+	int				nChamferSize = -1;
+
+	pSTU_SPLINE_INS_PARM pSpline = m_pRecipe->GetInspectInfo()->GetSplineIns(emDim);
+	if(pSpline != NULL )
+		nChamferSize = (nSpIndex == 0) ? pSpline->m_nStartChamferSize : pSpline->m_nEndChamferSize;
+
+	std::vector<STU_SPLINE_RCut> stuRes;
+	double				dConv,dScan;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return ret;	
+
+	dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	dScan = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+		return ret;	
+
+	if(dStartTheta >= dEndTheta)
+	{
+		g_pLog->DisplayMessage(_T("%s iThread[%d] Frame[%d] %d Spline Fail! : theta %.2f,%.2f"),PANEL_SIDE[emDim],iThread,stFrame.nFrameIdx,bFlip,dStartTheta,dEndTheta);
+		return ret;
+	}
+	if(dDistTheta <= 0)
+		dDistTheta = 5;
+
+	int			nCount=0,nSum=0;
+	STU_SPLINE_RCut	stuRcut;	
+	double		dCalTheta;
+
+	for(double iTheta=dStartTheta;iTheta<=dEndTheta;iTheta+=dDistTheta)
+	{
+		dCalTheta = iTheta;
+		if(bFlip == TRUE)
+		{
+			dCalTheta = -1*iTheta;
+		}
+
+		COwnerBuffer	imgProcess;
+
+		ROI imgROI = GetRCutChipImage(iThread,emDim,stFrame,imgProcess,dCalTheta,ptSplineCen,dRadius);
+
+		if(imgProcess.IsValidBuffer() == FALSE)
+			continue;
+
+		if(g_pStatus->GetInspectOption()->bSaveSpline == TRUE)
+		{
+			CString				str;
+			str.Format(_T("D:\\Image\\spline\\%s_%d_%.2f_Org.bmp"),PANEL_SIDE[emDim],bFlip,dCalTheta);
+			CBufferAttach		attach(str);
+			attach.AttachToFile(imgProcess);
+		}
+
+		COwnerBuffer	bufBin(imgProcess.GetDataWidth(),imgProcess.GetHeight());
+		CSize			szImg(bufBin.GetDataWidth(),bufBin.GetHeight());
+
+		CopyMemory(bufBin.GetDataAddress(),imgProcess.GetDataAddress(),imgProcess.GetDataSize());
+
+		EdgeProc.ThresholdProcessing(bufBin.GetDataAddress(),szImg,nChamferThres,0);
+
+		if(g_pStatus->GetInspectOption()->bSaveSpline == TRUE)
+		{
+			CString				str;
+			str.Format(_T("D:\\Image\\spline\\%s_%d_%.2f_Bin.bmp"),PANEL_SIDE[emDim],bFlip,dCalTheta);
+			CBufferAttach		attach(str);
+			attach.AttachToFile(bufBin);
+		}
+
+		CSISEdgeFind		EdgeFind;		
+
+		double		dPitch = imgProcess.GetWidth()/5;
+		if(dPitch < 10)
+			dPitch = 10;
+
+		int			nGlassEdge = 0;
+		if(EdgeFind.FindEdge_ToRight(&imgProcess,nGlassEdge,dPitch,nEdgeThres,0.3,0) == FALSE)
+		{
+			continue;
+		}
+
+		int			iStart,iEnd;
+
+		iStart = nGlassEdge-50;		
+		if(iStart < 0)
+			iStart = 0;
+
+		iEnd = iStart + 200;
+		if(iEnd >= bufBin.GetWidth())
+			iEnd = bufBin.GetWidth()-1;
+
+		for(int y=0;y<bufBin.GetHeight();y++)
+		{
+			stuRcut.reset();
+			stuRcut.y = y;
+			stuRcut.imgX = imgROI.u1;
+			stuRcut.imgY = imgROI.v1;
+			stuRcut.dTheta = dCalTheta;
+			for(int x=iStart;x<iEnd;x++)
+			{
+				if(bufBin.GetPixel(x,y) != 0)
+				{
+					stuRcut.x1 = x;
+
+					// Noise Filter..
+					for(int x2=iEnd-1; x+1 < x2 ; x2--)
+					{
+						int nValidPixelCount = 0;
+
+						int nLength = 6;//x2 - x; // 6 pixel check
+
+						// Noise Check..
+						for(int nCheck=0; nCheck < nLength; nCheck++)
+						{
+							int nPosX = x2 - nCheck;
+
+							if(nPosX <= stuRcut.x1)
+								break;
+
+							if(bufBin.GetPixel(nPosX,y) != 0)
+								nValidPixelCount++;
+						}
+
+						if(3 < nValidPixelCount)		// valid 3 pixel check
+						{
+							stuRcut.x2 = x2-1;
+							stuRcut.width = stuRcut.x2-stuRcut.x1+1;
+							break;
+						}
+					}
+
+					/* Right..
+					for(int x2=iEnd-1; x+1 < x2 ; x2--)
+					{
+						if(bufBin.GetPixel(x2,y) != 0)
+						{
+							stuRcut.x2 = x2-1;
+							stuRcut.width = stuRcut.x2-stuRcut.x1+1;
+							break;
+						}
+					}
+					*/
+
+					/* Left..
+					for(int x2=x+1;x2<iEnd;x2++)
+					{
+						if(bufBin.GetPixel(x2,y) == 0)
+						{
+							stuRcut.x2 = x2-1;
+							stuRcut.width = stuRcut.x2-stuRcut.x1+1;
+							break;
+						}
+					}
+					*/
+					break;
+				}
+			}
+			if(stuRcut.width > 0)
+			{
+				nCount++;
+				nSum+=stuRcut.width;
+			}
+			stuRes.push_back(stuRcut);
+		}		
+	}
+
+	int		nAvg = 0;
+
+	if(nCount > 0)
+		nAvg = nSum/nCount;
+
+	if(nChamferSize > 0)
+		nAvg = nChamferSize;
+
+	if(nAvg <= 0)
+		return ret;
+
+	STU_SPLINE_RCut stuDet;
+	int			nDefectCnt = 0,nMaxDefect = 0;
+	for(int i=0;i<stuRes.size();i++)
+	{
+		stuRcut = stuRes[i];
+
+		if(stuRcut.width <= 0)
+			continue;
+
+		if(stuRcut.width > nAvg && abs(stuRcut.width-nAvg)*dConv >= pChipPrm->m_nChipSize_Y)
+		{
+			nDefectCnt++;
+			stuDet = stuRcut;
+		}
+		else
+		{
+			BOOL		bDefect = FALSE;
+			if(nDefectCnt > 0)
+			{
+				if(pChipPrm->m_bChipJudgeAnd == TRUE)
+				{
+					if(nDefectCnt*dConv >= pChipPrm->m_nChipSize_X)
+						bDefect = TRUE;
+				}
+				else			
+				{
+					bDefect = TRUE;				
+				}
+			}
+
+			if(bDefect == TRUE)
+			{
+				double dSin = sin(M_RADIAN(stuDet.dTheta));
+				double dCos = cos(M_RADIAN(stuDet.dTheta));
+				IMPOS2D				pDefect,p1,posCen;
+
+				posCen.u = ptSplineCen.x;
+				posCen.v = ptSplineCen.y;
+
+				pDefect.u = (stuDet.x2+stuDet.x1+1)/2+stuRcut.imgX;
+				pDefect.v = (stuDet.y-nDefectCnt/2)+stuRcut.imgY;		
+
+				EdgeProc.IMRotatePoint(pDefect, &p1, posCen, dSin, dCos) ;
+				CvPoint2D32f	ptDef;
+				ptDef.x = (float)p1.u;
+				ptDef.y = (float)p1.v;
+
+				m_pDefectControl->ExtractDefect_SpNew(emDim,m_iCamera,stFrame.nScanIdx,DefectLoc_Chip,ptDef,0,bFlip,(int)(nDefectCnt*dConv));
+			}
+
+			nDefectCnt=0;
+		}
+	}
+
+	BOOL		bDefect = FALSE;
+	if(nDefectCnt > 0)
+	{
+		if(pChipPrm->m_bChipJudgeAnd == TRUE)
+		{
+			if(nDefectCnt*dConv >= pChipPrm->m_nChipSize_X)
+				bDefect = TRUE;
+		}
+		else			
+		{
+			bDefect = TRUE;				
+		}
+	}
+
+	if(bDefect == TRUE)
+	{
+		double dSin = sin(M_RADIAN(stuDet.dTheta));
+		double dCos = cos(M_RADIAN(stuDet.dTheta));
+		IMPOS2D				pDefect,p1,posCen;
+
+		posCen.u = ptSplineCen.x;
+		posCen.v = ptSplineCen.y;
+
+		pDefect.u = (stuDet.x2+stuDet.x1+1)/2+stuRcut.imgX;
+		pDefect.v = (stuDet.y-nDefectCnt/2)+stuRcut.imgY;		
+
+		EdgeProc.IMRotatePoint(pDefect, &p1, posCen, dSin, dCos) ;
+		CvPoint2D32f	ptDef;
+		ptDef.x = (float)p1.u;
+		ptDef.y = (float)p1.v;
+
+		m_pDefectControl->ExtractDefect_SpNew(emDim,m_iCamera,stFrame.nScanIdx,DefectLoc_Chip,ptDef,0,bFlip,(int)(nDefectCnt*dConv));
+	}	
+
+	return ret;
+}
+
+ROI CInspectCamera::GetRCutChipImage(int iThread,DimensionDir emDim,stFrameIndex stFrame,COwnerBuffer &pTgt,double dTheata,CvPoint2D32f ptCen,double dRadius)
+{
+	int					nDistance;
+	ROI					aoi;
+	double				dSin,dCos;
+	IMPOS2D				posCen;
+	int					n4ByteWidth;
+	LPBYTE				lpBuffer;
+	CEdgeProc			EdgeProc;
+	CSISBuffer			bufOrg;
+	const int			nSearchArea = 200;
+	const int			nSearchHeight = 40;	
+
+	dSin = sin(M_RADIAN(dTheata));
+	dCos = cos(M_RADIAN(dTheata));
+	posCen.u = ptCen.x;
+	posCen.v = ptCen.y;
+
+	nDistance = (int)GetRadus2Distance(emDim,stFrame, dTheata,dRadius,dSin,dCos);	
+
+	aoi.u1 = aoi.u2 = aoi.v1 = aoi.v2 = 0;
+	lpBuffer = m_pGrabber->GetFrameHeaderLine(stFrame.nScanIdx,0);
+	if(lpBuffer == NULL)
+		return aoi;
+
+	int		nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	bufOrg.SetBuffer(lpBuffer,nFrameWidth,g_pBase->m_pMemFrameNo[m_iCamera]*nFrameHeight);
+
+	aoi.u1 = (int)ROUND(posCen.u) - nDistance - nSearchArea;
+	aoi.u2 = (int)ROUND(posCen.u) - nDistance + nSearchArea;
+	aoi.v1 = (int)ROUND(posCen.v) - nSearchHeight;
+	aoi.v2 = (int)ROUND(posCen.v) + nSearchHeight;
+
+	n4ByteWidth = align_4byte(EdgeProc.IMROIWidth(aoi));
+	aoi.u2 = aoi.u1 + n4ByteWidth;
+	pTgt.SetSize(EdgeProc.IMROIWidth(aoi),EdgeProc.IMROIHeight(aoi));
+
+	// 22.6.13
+	memset(pTgt.GetDataAddress(0,0), 255, pTgt.GetDataSize());
+
+	EdgeProc.IMGetRotImg(aoi,bufOrg,pTgt,posCen,dSin,dCos);	
+
+	return aoi;
+
+}
+
+CvPoint2D32f CInspectCamera::GetSplineCenter(int iThread,DimensionDir emDim,stFrameIndex stFrame,BOOL bBot)
+{
+	CvPoint2D32f		ptCen = CvPoint2D32f(0,0);
+	CvPoint2D32f		ptAlign = CvPoint2D32f(0,0);
+	int					nIndex = 0;
+
+	if(bBot == TRUE)
+		nIndex = 1;
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pResInfo =  m_pGlassData->GetEdgeResultInfo(emDim);
+		if(pResInfo != NULL)
+		{
+			if(pResInfo->bMark[nIndex] == TRUE)
+			{
+				ptAlign = pResInfo->ptMark[nIndex];
+			}				
+		}
+	}
+
+	if(ptAlign.x <= 0 || ptAlign.y <= 0)
+		return ptCen;	
+
+	CProfileInspect_Prm *pPrm = m_pRecipe->GetProfileParm();
+	double		AlignX,AlignY;
+	double		dOrgOffsetX,dOrgOffsetY;
+
+	double		dConv,dScan;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return ptCen;	
+
+	dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	dScan = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+		return ptCen;
+
+	if(nIndex == 0)
+	{
+		dOrgOffsetX = (double)pPrm->m_nOriginAlignKeyOffsetX[emDim]/dConv;
+		dOrgOffsetY = (double)pPrm->m_nOriginAlignKeyOffsetY[emDim]/dScan;
+	}
+	else if(nIndex == 1)
+	{
+		dOrgOffsetX = (double)pPrm->m_nOriginAlignKeyOffsetDwX[emDim]/dConv;
+		dOrgOffsetY = (double)pPrm->m_nOriginAlignKeyOffsetDwY[emDim]/dScan;
+	}
+
+	AlignX = ptAlign.x;
+	AlignY = ptAlign.y;			
+
+	ptCen.x = (float)(AlignX + dOrgOffsetX);
+	ptCen.y = (float)(AlignY + dOrgOffsetY);
+
+	return ptCen;
+}
+
+void CInspectCamera::SetRCutDisplayImage(int iThread,DimensionDir emDim,stFrameIndex stFrame,CRect rectIns,BOOL bFlip,double dRadius,CvPoint2D32f ptSplineCen)
+{
+	switch(emDim)
+	{
+	case DIMENSION_A_DN:
+	case DIMENSION_C_DN:
+	case DIMENSION_B:
+	case DIMENSION_B_DN:
+	case DIMENSION_D:
+	case DIMENSION_D_DN:
+		return;
+	}
+
+	double		dConv,dScan;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return;	
+
+	dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+	dScan = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	if(dConv <= 0 || dScan <= 0)
+		return;	
+
+	int				nDistance = (int)(dRadius/dConv);
+
+	pINSPECTSPLINE_BUFFER		pImgBuf = NULL;
+
+	if(bFlip == FALSE)
+		pImgBuf = GetSplineBuffer(0);
+	else
+		pImgBuf = GetSplineBuffer(1);	
+
+	if(m_iCamera == 0)
+	{
+		if(bFlip == FALSE)
+			pImgBuf->ePosition = INSPECTSPLINE_BUFFER::SPLINE_BOTTOMLEFT;
+		else
+			pImgBuf->ePosition = INSPECTSPLINE_BUFFER::SPLINE_BOTTOMRIGHT;
+	}
+	else
+	{
+		if(bFlip == FALSE)
+			pImgBuf->ePosition = INSPECTSPLINE_BUFFER::SPLINE_TOPLEFT;
+		else
+			pImgBuf->ePosition = INSPECTSPLINE_BUFFER::SPLINE_TOPRIGHT;
+	}
+
+	pImgBuf->iCam = m_iCamera;			
+	pImgBuf->iScan = stFrame.nScanIdx;
+	pImgBuf->iType = (int)STU_SPLINE_RESULT::SPLINE_RCUT;
+	pImgBuf->bPos = bFlip;
+
+	int				nOffset = 100;
+	CRect			rect;
+
+	if(bFlip == FALSE)
+	{
+		rect.left = (int)ptSplineCen.x-nDistance-nOffset;
+		rect.right = rect.left + (int)(nDistance*1.5) + nOffset;
+		rect.top = (int)ptSplineCen.y-nDistance-nOffset;
+		rect.bottom = (int)ptSplineCen.y+nOffset;		
+	}
+	else
+	{
+		rect.left = (int)ptSplineCen.x-nDistance-nOffset;
+		rect.right = rect.left + (int)(nDistance*1.5) + nOffset;
+		rect.bottom = (int)ptSplineCen.y +nDistance+nOffset;
+		rect.top = (int)ptSplineCen.y-nOffset;
+	}
+
+	rect.right = rect.left + align_4byte(rect.Width());
+
+	int			nFrameWidth,nFrameHeight;
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	if(rect.top < 0 || rect.right >= nFrameWidth || rect.left < 0)
+		return;
+
+	COwnerBuffer	sisRcut(rect.Width(),rect.Height());
+	LPBYTE	lpBuffer = m_pGrabber->GetFrameHeaderLine(stFrame.nScanIdx,rect.top);
+
+	CRect		rectCopy = rect;
+	rectCopy.OffsetRect(0,-rectCopy.top);
+
+	CopyRectImg(lpBuffer,sisRcut.GetDataAddress(),CSize(nFrameWidth,sisRcut.GetHeight()*2),rectCopy);	
+	pImgBuf->SetBuffer(sisRcut.GetDataAddress(),CSize(sisRcut.GetWidth(),sisRcut.GetHeight()),INSPECTSPLINE_BUFFER::SPLINE_TYPE_ORG);	// Org		
+}
+
+BOOL CInspectCamera::CopyRectImg(LPBYTE pOrg,LPBYTE pTgt,CSize szImg,CRect &rectIns)
+{
+	if(rectIns.Width() > szImg.cx || rectIns.bottom >= szImg.cy ||
+		rectIns.top < 0 || rectIns.top > rectIns.bottom || rectIns.bottom < 0)
+		return FALSE;
+
+	int			v;
+	int			dv = 0;
+
+	for(v=rectIns.top;v<rectIns.bottom;v++,dv++)
+	{
+		CopyMemory(pTgt+dv*rectIns.Width(),pOrg+v*szImg.cx+rectIns.left,rectIns.Width());
+	}
+
+	return TRUE;
+}
+
+DIT_RESULT CInspectCamera::FindSpline(int iThread,DimensionDir	emDim,stFrameIndex stFrame,int iFindLine)
+{
+	DIT_RESULT ret= DIT_CONV_SUCCESS;	
+	CSplineModel	*pSplineModel = NULL;
+	int				iSplineModelIdx = 0;
+
+	switch(emDim)
+	{
+	case DIMENSION_B:
+	case DIMENSION_B_DN:
+	case DIMENSION_D:
+	case DIMENSION_D_DN:	
+		return ret;
+	case DIMENSION_A:
+	case DIMENSION_A_DN:
+		iSplineModelIdx=0;
+		break;
+	case DIMENSION_C:
+	case DIMENSION_C_DN:
+		iSplineModelIdx=2;
+		break;
+	}
+
+	pSplineModel = &m_pSplineModel[iSplineModelIdx];
+	
+	if(pSplineModel->IsLoadMasterImg() == FALSE)
+	{		
+		return ret;
+	}
+
+	pSTU_SPLINE_INS_PARM pSplinePrm = m_pRecipe->GetInspectInfo()->GetSplineIns(emDim);
+	pSTU_SPLINE_CHIP_PARM	pChipPrm =	m_pRecipe->GetInspectInfo()->GetSplineChipIns(emDim);
+	CETC_PARM		*pEtc =	m_pRecipe->GetEtcPrm(emDim);		
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+
+	if(pSplinePrm == NULL || pEtc == NULL || pChipPrm == NULL || pSplinePrm->m_bSpline == FALSE || pEdgeInfo == NULL)
+		return ret;
+
+	CString		strCutDiv;		
+	CSize		szMaster = pSplineModel->GetMasterDataSize();
+	CPoint		nOffset(100,100);
+	BOOL		bFlip;
+	CRect		rectIns;	
+
+	rectIns = GetSplineInsRect(szMaster,nOffset,stFrame,iFindLine,pEdgeInfo,bFlip);		
+	if(rectIns.IsRectEmpty() == TRUE)
+	{	
+		return ret;	
+	}	
+
+	if(rectIns.top < 0 || rectIns.left < 0)
+		return ret;
+	
+	GetSplineControl(iThread)->SetMasterModelData(pSplineModel);
+
+	double		dCovRes,dScanRes;
+	int			nFrameHeight,nFrameWidth;		
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+
+	if(g_pBase->m_nStageNo >= 0 && g_pBase->m_nStageNo <= 1)
+	{
+		dCovRes = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
+		dScanRes = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	}
+	else
+	{
+		dCovRes = pCamera->m_dConvResolution[0];
+		dScanRes = pCamera->m_dScanResolution[0];
+	}
+
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	int				iTopPixel = rectIns.top;
+	int				iLetPixel = rectIns.left;
+	LPBYTE			lpHeader =	m_pGrabber->GetFrameHeaderLine(stFrame.nScanIdx,rectIns.top);
+	CSISBuffer		pSPBuf(lpHeader,nFrameWidth,rectIns.Height());
+
+	if(lpHeader == NULL || pSPBuf.IsValidBuffer() == FALSE)
+	{		
+		g_pLog->DisplayMessage(_T("%s iThread[%d] Frame[%d] %s Spline Image Fail: %d [%d,%d,%d,%d]"),PANEL_SIDE[emDim],iThread,stFrame.nFrameIdx,strCutDiv
+			,rectIns.top/nFrameHeight,rectIns.left,rectIns.top,rectIns.right,rectIns.bottom);
+		return ret;
+	}
+
+	SPLINE_ERR_MSG				errMsg = SPLINE_INS_SUCESS;	
+
+	g_pLog->DisplayMessage(_T("%s iThread[%d] Frame[%d] %s Spline Inspect Start"),PANEL_SIDE[emDim],iThread,stFrame.nFrameIdx,strCutDiv);
+	
+	rectIns.OffsetRect(0,-rectIns.top);
+	if(pSplinePrm->m_bSpline == TRUE)
+		errMsg = GetSplineControl(iThread)->InspectSpline(pSPBuf,rectIns,pSplinePrm->m_DetMinDist,pSplinePrm->m_nLineThres,bFlip,g_pStatus->GetInspectOption()->bSaveSpline,TRUE);
+
+	//g_pLog->DisplayMessage(_T("Cam[%d] Scan[%d] iThread[%d] Frame[%d] %s Spline Inspect. 02"),GetCameraID(),pRecipe->GetScanIndex(),iThread,iFrame,strCutDiv);
+
+	CSISBuffer		*pChipBuf = GetSplineControl(iThread)->GetSplineOrgImg();
+	if(pChipBuf->IsValidBuffer() == FALSE)
+		pChipBuf = &pSPBuf;
+
+	int		iLeftLine = GetSplineFindEdge(pChipBuf,pEtc,iFindLine,100);
+
+	SplineChipProcess(GetSplineControl(iThread),pChipBuf,iThread,emDim,stFrame,iLeftLine,bFlip,iTopPixel,iLetPixel,strCutDiv);		
+
+	SaveSplineImage(pSPBuf,GetSplineControl(iThread),pSplinePrm,iThread,emDim,stFrame,dCovRes,errMsg,bFlip);	
+	
+	g_pLog->DisplayMessage(_T("%s iThread[%d] Frame[%d] %s Spline Inspect End"),PANEL_SIDE[emDim],iThread,stFrame.nFrameIdx,strCutDiv);
+
+	return ret;
+}
+
+void CInspectCamera::SaveSplineImage(CSISBuffer &pSPBuf,CSplineInspect *pSplineIns,pSTU_SPLINE_INS_PARM pSplinePrm, int iThread,DimensionDir emDim,stFrameIndex stFrame,double dConvRes,SPLINE_ERR_MSG	errMsg,BOOL bFlip)
+{
+	if(emDim == DIMENSION_A || emDim == DIMENSION_C)
+	{
+		if(errMsg == SPLINE_INS_SUCESS)
+		{
+			if(g_pStatus->GetInspectOption()->bSaveSpline == TRUE)
+			{	
+				CSISBuffer					*pResBuf = GetSplineControl(iThread)->GetSplineResImg();
+				pINSPECTSPLINE_BUFFER		pImgBuf = NULL;
+
+				if(bFlip == FALSE)
+					pImgBuf = GetSplineBuffer(0);
+				else
+					pImgBuf = GetSplineBuffer(1);	
+
+				if(m_iCamera == 0)
+				{
+					if(bFlip == FALSE)
+						pImgBuf->ePosition = INSPECTSPLINE_BUFFER::SPLINE_BOTTOMLEFT;
+					else
+						pImgBuf->ePosition = INSPECTSPLINE_BUFFER::SPLINE_BOTTOMRIGHT;
+				}
+				else
+				{
+					if(bFlip == FALSE)
+						pImgBuf->ePosition = INSPECTSPLINE_BUFFER::SPLINE_TOPLEFT;
+					else
+						pImgBuf->ePosition = INSPECTSPLINE_BUFFER::SPLINE_TOPRIGHT;
+				}
+
+				pImgBuf->iCam = m_iCamera;			
+				pImgBuf->iScan = stFrame.nScanIdx;
+				if((int)pSplinePrm->m_emSPType == EM_SP_RCUT)
+					pImgBuf->iType = STU_SPLINE_RESULT::SPLINE_RCUT;
+				else
+					pImgBuf->iType = STU_SPLINE_RESULT::SPLINE_CCUT;				
+				pImgBuf->bPos = bFlip;
+				pImgBuf->SetBuffer(pSPBuf.GetDataAddress(),CSize(pSPBuf.GetWidth(),pSPBuf.GetHeight()),INSPECTSPLINE_BUFFER::SPLINE_TYPE_ORG);	// Org							
+			}
+			g_pLog->DisplayMessage(_T( "%s iThread[%d] Frame[%d] Spline success"),PANEL_SIDE[emDim],iThread,stFrame.nFrameIdx);
+		}
+		else
+		{
+			if(g_pStatus->GetInspectOption()->bSaveSpline== TRUE)
+			{
+				pINSPECTSPLINE_BUFFER		pImgBuf = NULL;
+				if(bFlip == FALSE)
+					pImgBuf = GetSplineBuffer(0);
+				else
+					pImgBuf = GetSplineBuffer(1);	
+
+				pImgBuf->iCam = m_iCamera;			
+				pImgBuf->iScan = stFrame.nScanIdx;
+				if((int)pSplinePrm->m_emSPType == EM_SP_RCUT)
+					pImgBuf->iType = STU_SPLINE_RESULT::SPLINE_RCUT;
+				else
+					pImgBuf->iType = STU_SPLINE_RESULT::SPLINE_CCUT;	
+				pImgBuf->bPos = bFlip;
+				pImgBuf->Clear(INSPECTSPLINE_BUFFER::SPLINE_TYPE_ORG);	// Org			
+				pImgBuf->Clear(INSPECTSPLINE_BUFFER::SPLINE_TYPE_RES);	// Res	
+			}		
+
+			CString			str;
+			switch(errMsg)
+			{
+			case ERR_SPLINE_EMPTYMASTER: str = _T("No Master Image"); break;
+			case ERR_SPLINE_EDGEPROCESS: str = _T("Edge error"); break;
+			case ERR_SPLINE_LABELPROCESS: str = _T("Label error"); break;
+			case ERR_SPLINE_LABELCOUNT: str = _T("Label Count error"); break;
+			case ERR_SPLINE_INDEXFIND: str = _T("Max Index Find error"); break;
+			case ERR_SPLINE_LABELPOSITION: str = _T("Label Position error"); break;
+			case ERR_SPLINE_POSITIONNULL: str = _T("Position Null"); break;	
+			case ERR_SPLINE_INS_CNT_SHORT: str = _T("line Count error"); break;	
+			case ERR_SPLINE_IMAGE_NULL: str = _T("Image Null"); break;	
+			default: str = "Error"; break;
+			}
+			g_pLog->DisplayMessage(_T( "%s iThread[%d] Frame[%d] Spline inspect fail! : %s"),PANEL_SIDE[emDim],iThread,stFrame.nFrameIdx,str);
+		}
+	}
+}
+
+BOOL CInspectCamera::SplineChipProcess(CSplineInspect *pInsSpline,CSISBuffer *imgOrg,int iThread,DimensionDir emDim,stFrameIndex stFrame,int iFindLine,BOOL bFlip,int iTopPixel,int iLeftPixel,CString strCutDiv)
+{
+	if(imgOrg->IsValidBuffer() == FALSE || pInsSpline == NULL)
+		return FALSE;
+
+	pSTU_SPLINE_INS_PARM	pSpInsPrm = m_pRecipe->GetInspectInfo()->GetSplineIns(emDim);
+	pSTU_SPLINE_CHIP_PARM	pSPChipPrm =	m_pRecipe->GetInspectInfo()->GetSplineChipIns(emDim);
+
+	if(pSPChipPrm->m_bSplineChip == FALSE)
+		return FALSE;
+
+	int				nChipThres = pSPChipPrm->m_nChipThres;
+
+	//////////////////////////////////////////////////////////////////////////
+	// 娴佹�� 澶囧焹.									
+	CPoint		pointLeft;
+	CRect		rectChip;	
+
+	CEdgeFind		EdgeFind;
+	CETC_PARM		*pEtc = m_pRecipe->GetEtcPrm(emDim);
+
+	pointLeft.x = GetSplineFindEdge(imgOrg,pEtc,iFindLine,10);			
+	pointLeft.y = pSpInsPrm->m_nStartCornerSize_Y; // pSpInsPrm->m_nYPos;
+	
+	DWORD tacttime = GetTickCount();
+
+	SplineChip_Curve(pInsSpline,imgOrg,iThread,emDim,stFrame,pointLeft,nChipThres,bFlip,iTopPixel,iLeftPixel,strCutDiv);	
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::SplineChip_Curve(CSplineInspect *pInsSpline,CSISBuffer *imgOrg,int iThread,DimensionDir emDim,stFrameIndex stFrame,CPoint &pointLeft,int nChipThres,BOOL bFlip,int iTopPixel,int iLeftPixel,CString strCutDiv)
+{
+	std::vector<STU_SPLINE_CHIP_POS> *pSPChipPos = m_pRecipe->GetInspectInfo()->GetSplineChipPos(emDim);
+	if(pSPChipPos == NULL || (int)pSPChipPos->size() <= 0)
+		return TRUE;
+
+	int			iReg = 0;		
+	int			nModelCnt,nModSize;
+	CHIP_INS_REGION insRegion,insRegTmp;
+	std::vector<STU_SPLINE_CHIP_POS>::iterator it;		
+	CChipBlob	*pBlobResult = NULL;
+	int			nDefectCount;
+	pSTU_SPLINE_INS_PARM	pSpInsPrm = m_pRecipe->GetInspectInfo()->GetSplineIns(emDim);
+	pSTU_SPLINE_CHIP_PARM	pSPChipPrm =	m_pRecipe->GetInspectInfo()->GetSplineChipIns(emDim);
+
+	CCameraSettings *pCamera =  m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+
+	double dScanRes = pCamera->m_dScanResolution[g_pBase->m_nStageNo];
+	
+#define		DIVIDE_SP_REGION_SIZE	80
+
+	int			nMinStartPos = INT_MAX;
+
+	CINSPECT_JUDGEMENT_PARM	*pJudge = m_pRecipe->GetJudgePrm();
+
+	int		nJudgeW,nJudgeH;
+	BOOL	bAnd;
+	EM_CHIPPING_COMP	eComp;
+
+	if(pCamera->m_enCamDir == CAMDIR_BOTTOM)
+	{
+		nJudgeW = pJudge->defect[emDim][0].Chip_Side.szDefect.cx;
+		nJudgeH = pJudge->defect[emDim][0].Chip_Side.szDefect.cy;
+		bAnd = pJudge->defect[emDim][0].Chip_Side.bConditionAND;
+	}
+	else
+	{
+		nJudgeW = pJudge->defect[emDim][0].Chip_CF.szDefect.cx;
+		nJudgeH = pJudge->defect[emDim][0].Chip_CF.szDefect.cy;
+		bAnd = pJudge->defect[emDim][0].Chip_CF.bConditionAND;
+	}		
+
+	if(bAnd == TRUE)
+		eComp = CHIP_AND;
+	else
+		eComp = CHIP_OR;
+
+	int			iSaveIdx = 0;
+
+	g_pLog->DisplayMessage(_T( "%s Frame[%d] %s Spline Chip Curve Inspect Start."),PANEL_SIDE[emDim],stFrame.nFrameIdx,strCutDiv);
+	for(it=pSPChipPos->begin();it!=pSPChipPos->end();it++,iReg++)
+	{
+		if(pSpInsPrm->m_emSPType == EM_SP_CCUT)		
+			if(it->emPos != STU_SPLINE_CHIP_POS::MAKE_IMAGE_POS_CCUT)
+				continue;		
+			else		
+				if(it->emPos != STU_SPLINE_CHIP_POS::MAKE_IMAGE_POS_RCUT)
+					continue;		
+
+		insRegion.bUse = it->bUse;		
+		insRegion.nStartX = it->nStartX;
+		insRegion.nEndX = it->nEndX;		
+		insRegion.nThres = it->nThres;
+		insRegion.nFindThres = it->nFindThres;
+		insRegion.nInsRange = it->nInsRange;
+		insRegion.nSkipDist = it->nSkipDist;
+		insRegion.emMethod = (MAKE_IMAGE_METHOD)it->emMethod;
+		insRegion.emDir = (SPLINE_INS_DIR)it->emDir;
+
+		if(insRegion.bUse == FALSE)
+			continue;				
+
+		nModelCnt = abs(insRegion.nStartX-insRegion.nEndX)/DIVIDE_SP_REGION_SIZE;
+		nModSize = abs(insRegion.nStartX-insRegion.nEndX)%DIVIDE_SP_REGION_SIZE;
+
+		if(nMinStartPos > insRegion.nStartX)
+			nMinStartPos = insRegion.nStartX;
+
+		int			iCnt = 0;
+		if(nModelCnt > 0)
+		{
+			int			nChipMargin = 20;
+			insRegTmp = insRegion;
+			for(iCnt=0;iCnt<nModelCnt;iCnt++)
+			{			
+				insRegTmp.nStartX = insRegion.nStartX+iCnt*DIVIDE_SP_REGION_SIZE;
+				insRegTmp.nEndX = insRegTmp.nStartX+DIVIDE_SP_REGION_SIZE+nChipMargin;
+
+				if(iCnt != 0)
+				{
+					insRegTmp.nStartX -= nChipMargin;							
+					if(insRegTmp.nStartX < 0) insRegTmp.nStartX = 0;
+				}
+
+				if(iCnt == nModelCnt-1 && nModSize <= DIVIDE_SP_REGION_SIZE/2)
+				{
+					insRegTmp.nEndX += nModSize;
+					nModSize = 0;
+				}
+				if(imgOrg->GetWidth() <= insRegTmp.nEndX) insRegTmp.nEndX = imgOrg->GetWidth()-1;
+
+				//	g_pLog->DisplayMessage(_T( "%s Frame[%d] %s Spline Chip Curve Inspect 02._%d"),PANEL_SIDE[pRecipe->GetDimension()],iFrame,strCutDiv,iCnt);
+
+				COwnerBuffer		pSpChipRes;
+
+				pInsSpline->InspectSplineChip(*imgOrg,pointLeft.x,insRegTmp,dScanRes,pSPChipPrm->m_nChipSize_Y,pSpChipRes,bFlip,iSaveIdx,g_pStatus->GetInspectOption()->bSaveSplineChip);
+				iSaveIdx++;
+
+				pBlobResult = pInsSpline->GetResultDefect();
+				nDefectCount = pInsSpline->GetResultDefectCount();
+
+				if(pBlobResult != NULL && nDefectCount > 0)
+				{							
+					m_pDefectControl->ExtractDefect_SplineChip(emDim,m_iCamera,stFrame.nScanIdx,pBlobResult,nDefectCount,DefectLoc_Chip,CPoint(iLeftPixel,iTopPixel),(int)pSpInsPrm->m_emSPType,bFlip,nJudgeW,nJudgeH,eComp);
+				}								
+				//	g_pLog->DisplayMessage(_T( "%s Frame[%d] %s Spline Chip Curve Inspect 03.[%d] "),PANEL_SIDE[pRecipe->GetDimension()],iFrame,strCutDiv,iCnt,m_pInspectOpt->bSaveSplineChip);
+			}
+
+			if(nModSize > 0)
+			{
+				insRegTmp.nEndX = insRegion.nEndX;
+				insRegTmp.nStartX = insRegTmp.nEndX-nModSize;
+
+				//	g_pLog->DisplayMessage(_T( "%s Frame[%d] %s Spline Chip Curve Inspect 04. Mod"),PANEL_SIDE[pRecipe->GetDimension()],iFrame,strCutDiv);
+
+				COwnerBuffer		pSpChipRes;
+
+				pInsSpline->InspectSplineChip(*imgOrg,pointLeft.x,insRegTmp,dScanRes,pSPChipPrm->m_nChipSize_Y,pSpChipRes,bFlip,iSaveIdx,g_pStatus->GetInspectOption()->bSaveSplineChip);
+				iSaveIdx++;
+
+				pBlobResult = pInsSpline->GetResultDefect();
+				nDefectCount = pInsSpline->GetResultDefectCount();
+
+				if(pBlobResult != NULL && nDefectCount > 0)
+				{							
+					m_pDefectControl->ExtractDefect_SplineChip(emDim,m_iCamera,stFrame.nScanIdx,pBlobResult,nDefectCount,DefectLoc_Chip,CPoint(iLeftPixel,iTopPixel),(int)pSpInsPrm->m_emSPType,bFlip,nJudgeW,nJudgeH,eComp);
+				}			
+
+				//	g_pLog->DisplayMessage(_T( "%s Frame[%d] %s Spline Chip Curve Inspect 05.Mod"),PANEL_SIDE[pRecipe->GetDimension()],iFrame,strCutDiv);
+			}
+		}
+		else
+		{
+			//	g_pLog->DisplayMessage(_T( "%s Frame[%d] %s Spline Chip Curve Inspect 06. Mod : %d"),PANEL_SIDE[pRecipe->GetDimension()],iFrame,strCutDiv,nModelCnt);
+			COwnerBuffer		pSpChipRes;
+
+			pInsSpline->InspectSplineChip(*imgOrg,pointLeft.x,insRegion,dScanRes,pSPChipPrm->m_nChipSize_Y,pSpChipRes,bFlip,iSaveIdx,g_pStatus->GetInspectOption()->bSaveSplineChip);
+			iSaveIdx++;
+
+			pBlobResult = pInsSpline->GetResultDefect();
+			nDefectCount = pInsSpline->GetResultDefectCount();
+
+			if(pBlobResult != NULL && nDefectCount > 0)
+			{					
+				m_pDefectControl->ExtractDefect_SplineChip(emDim,m_iCamera,stFrame.nScanIdx,pBlobResult,nDefectCount,DefectLoc_Chip,CPoint(iLeftPixel,iTopPixel),(int)pSpInsPrm->m_emSPType,bFlip,nJudgeW,nJudgeH,eComp);
+			}			
+		}
+	}
+	g_pLog->DisplayMessage(_T("%s Frame[%d] %s Spline Chip Curve Inspect complete."),PANEL_SIDE[emDim],stFrame.nFrameIdx,strCutDiv);
+
+	//nMinStartPos = 30;
+	if(nMinStartPos != INT_MAX || pSPChipPrm->m_bCornerUse == FALSE || pSPChipPrm->m_nCornerRange <= 10)
+	{
+		insRegTmp.Reset();
+
+		insRegTmp.nStartX = -20;
+		insRegTmp.nEndX = nMinStartPos+100;		
+		insRegTmp.nCornerYSize = pSPChipPrm->m_nCornerRange;
+		insRegTmp.nFindThres = pSPChipPrm->m_nCornerThres;
+		insRegTmp.emMethod = MAKE_METHOD_REGRESSION;
+		insRegTmp.bUse = pSPChipPrm->m_bCornerUse;		
+
+		COwnerBuffer		pSpChipRes;
+
+		double dAvgThick = pInsSpline->InspectSplineChip(*imgOrg,pointLeft.x,insRegTmp,dScanRes,pSPChipPrm->m_nChipSize_Y,pSpChipRes,bFlip,0,g_pStatus->GetInspectOption()->bSaveSplineChip);	
+
+		pBlobResult = pInsSpline->GetResultDefect();
+		nDefectCount = pInsSpline->GetResultDefectCount();
+
+		if(pBlobResult != NULL && nDefectCount > 0)		
+		{			
+			m_pDefectControl->ExtractDefect_SplineChip(emDim,m_iCamera,stFrame.nScanIdx,pBlobResult,nDefectCount,DefectLoc_Chip,CPoint(iLeftPixel,iTopPixel),(int)pSpInsPrm->m_emSPType,bFlip,nJudgeW,nJudgeH,eComp);
+		}		
+	}
+
+	return TRUE;
+}
+
+int CInspectCamera::GetSplineFindEdge(CSISBuffer *pSPBuf,CETC_PARM *pEtc,int iFindLine,int nOffset)
+{
+	CRect		rectEdge;	
+	int			iEdgeLine;
+
+	rectEdge.left =  0;
+	rectEdge.right = align_4byte(rectEdge.left + pEtc->m_nGlassFindWidth_Left);
+	rectEdge.top = pSPBuf->GetHeight()-nOffset;
+	rectEdge.bottom = pSPBuf->GetHeight();	
+
+#define SPLINE_EDGE_AUTO_RATIO 0.3
+#define SPLINE_EDGE_AUTO_PITCH 15
+#define SPLINE_EDGE_CONTINUE 3
+
+	CEdgeFind EdgeFind;
+	iEdgeLine = EdgeFind.Find_LeftEdge(pSPBuf,SPLINE_EDGE_AUTO_PITCH,pEtc->m_nGlassFindthres_Left,SPLINE_EDGE_AUTO_RATIO,SPLINE_EDGE_CONTINUE);	
+	if(iEdgeLine <= 0)
+		iEdgeLine = iFindLine;		
+
+	return iEdgeLine;
+}
+
+CRect CInspectCamera::GetSplineInsRect(CSize szMaster,CPoint nOffset,stFrameIndex stFrame,int iFindLine,INS_EDGE_RESULT_INFO *pEdgeInfo,BOOL &bFlip)
+{		
+	CRect		rectIns(0,0,0,0);	
+	int			nFrameHeight,nFrameWidth;		
+
+	if(m_bSplineInspect[0] == TRUE && m_bSplineInspect[1] == TRUE)
+		return rectIns;
+
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	int			nStartFrame = (pEdgeInfo->nGlassStartLine+szMaster.cy+nOffset.y)/nFrameHeight+1;
+
+	bFlip = FALSE;
+
+	if(m_bSplineInspect[0] == FALSE && stFrame.nFrameIdx >= nStartFrame)
+	{
+		m_bSplineInspect[0] = TRUE;
+		rectIns.left = 0;
+		rectIns.right = nFrameWidth;
+		rectIns.top = pEdgeInfo->nGlassStartLine-nOffset.y;
+		rectIns.bottom = pEdgeInfo->nGlassStartLine + szMaster.cy;	
+	}
+	else if(m_bSplineInspect[1] == FALSE && pEdgeInfo->nGlassEndFrame > 0)
+	{
+		m_bSplineInspect[1] = TRUE;
+		rectIns.left = 0;
+		rectIns.right = nFrameWidth;
+		rectIns.bottom = pEdgeInfo->nGlassEndLine + nOffset.y;
+		rectIns.top = pEdgeInfo->nGlassEndLine-szMaster.cy;		
+		bFlip = TRUE;
+	}
+	else
+		return rectIns;			
+
+//	AssertFrameRectWidth(rectIns,stFrame.nScanIdx);
+
+// 	int			nWidth = align_4byte(rectIns.Width());
+// 	rectIns.left = rectIns.right - nWidth;
+// 
+// 	if(rectIns.Width() <= 0 || rectIns.Height() <= 0 || rectIns.left > rectIns.right || rectIns.top > rectIns.bottom)
+// 		return rectIns;
+
+	return rectIns;
+}
+
+void CInspectCamera::SaveFullImageCopy(int iScan)
+{
+	if(m_pGlassData == NULL)
+		return;
+	if(m_pGrabber == NULL)
+		return;
+
+	CSingleLock		cLock(&m_csSaveimage);
+	cLock.Lock();
+
+	DimensionDir eDim = GetDimension(iScan);
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(eDim);
+	if(pEdgeInfo == NULL)
+		return;
+
+	int			nSetEnd = pEdgeInfo->nGlassEndLine<=0?pEdgeInfo->nPreGlassEndLine:pEdgeInfo->nGlassEndLine;
+	int			nOffset = 1000;
+	int			nStartLine = pEdgeInfo->nGlassStartLine -nOffset/2;	
+	int			nEndLine = nSetEnd +nOffset/2;
+	int			nFullSize = nSetEnd-pEdgeInfo->nGlassStartLine+nOffset;		
+
+	if(nStartLine < 0)
+	{
+		nStartLine = 0;
+	}	
+	if(nFullSize <= 0)
+		return;
+	if(nFullSize <= nStartLine)
+		return;
+
+	pINSPECTFULLIMAGE_BUFFER		pImgBuf = GetFullImgBuffer(iScan);
+	int			nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,iScan,nFrameWidth,nFrameHeight);
+
+	if(nFrameWidth <= 0 || nFrameHeight <= 0)
+		return;
+
+	if(nFullSize/nFrameHeight > m_pGrabber->GetFrameBuffer()->GetFrameCount())
+		nFullSize = (m_pGrabber->GetFrameBuffer()->GetFrameCount()-1)*nFrameHeight;
+
+	if(nFullSize <= 100)
+		return;
+
+	pImgBuf->iCamIdx = m_iCamera;
+	pImgBuf->iScanIdx = iScan;		
+
+	pImgBuf->SetSize(CSize(nFrameWidth,nFullSize));
+
+	g_pLog->DisplayMessage(_T( "%s Full Image Memory Copy Start : Start[%d]-End[%d]"),PANEL_SIDE[eDim],nStartLine,nEndLine);	
+
+	LPBYTE			lpHeader = m_pGrabber->GetFrameHeaderLine(iScan,nStartLine);
+	if(lpHeader == NULL)
+	{		
+		g_pLog->DisplayMessage(_T( "%s Full Image Memory Copy fail : Start[%d]-End[%d]"),PANEL_SIDE[eDim],nStartLine,nEndLine);		
+		return;
+	}
+
+	CopyMemory(pImgBuf->pImage,lpHeader,sizeof(BYTE)*pImgBuf->szImage.cx*pImgBuf->szImage.cy);
+
+	cLock.Unlock();
+
+	g_pLog->DisplayMessage(_T( "%s Full Image Memory Copy complete : Start[%d]-End[%d]"),PANEL_SIDE[eDim],nStartLine,nEndLine);	
+}
+
+
+BOOL CInspectCamera::CheckProcessEnd(int iThread,stFrameIndex stFrame)
+{
+	if(m_pGlassData == NULL)
+		return FALSE;
+	if(m_pGrabber == NULL)
+		return FALSE;	
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(GetDimension(stFrame.nScanIdx));
+	if(pEdgeInfo == NULL)
+		return FALSE;
+
+	if(g_pStatus->GetGrabFrameCount(stFrame.nScanIdx)-1 <= stFrame.nFrameIdx)
+		return TRUE;
+ 	if(pEdgeInfo->nPreGlassEndFrame+MAX_THREAD <= stFrame.nFrameIdx)
+ 		return TRUE;
+
+
+// 	BOOL bRemain =  m_pGrabber->FindGrabIdx(stFrame.nScanIdx,pEdgeInfo->nPreGlassEndFrame+MAX_THREAD);
+// 	if(bRemain == FALSE)
+// 	{
+// 		return TRUE;
+// 	}
+
+	return FALSE;
+}
+
+void CInspectCamera::ScanRegionSet(stFrameIndex stFrame)
+{
+	SetGrabEnd(stFrame.nScanIdx);
+	MakeAlignRegion(stFrame.nScanIdx);		
+	PresetChamferPrm(stFrame.nScanIdx,GetDimension(stFrame.nScanIdx));
+	MakeChamferRegion(stFrame.nScanIdx);
+	MakeHoleRegion(stFrame.nScanIdx);	
+}
+
+BOOL CInspectCamera::CheckStartLineFrame(DimensionDir eDim,int iFrame)
+{
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(eDim);
+	if(pEdgeInfo == NULL)
+		return FALSE;
+
+	if(pEdgeInfo->nGlassStartFrame > iFrame)
+		return FALSE;
+
+	return TRUE;
+}
+
+void CInspectCamera::GetChamferRect(stFrameIndex stFrame,DimensionDir eDim,std::vector<CRect> &vecIns)
+{
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(eDim);
+	if(pEdgeInfo == NULL)
+		return;
+
+	int			nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	CRect		rtChamfer = pEdgeInfo->rtChamfer;
+	CRect		rtFrame = CRect(0,stFrame.nFrameIdx*nFrameHeight,nFrameWidth,stFrame.nFrameIdx*nFrameHeight+nFrameHeight);
+	CRect		rtIns;
+
+	if(rtIns.IntersectRect(rtChamfer,rtFrame) == TRUE)
+	{
+		CInspectOption		*pInsOpt = g_pStatus->GetInspectOption();
+		CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+		if(pCamera == NULL)
+			return;
+
+		int		nStageNo = g_pBase->m_nStageNo;
+
+		if(nStageNo < 0 || nStageNo > 1)
+			nStageNo = 0;
+
+		rtIns.left = 0;
+		rtIns.right = (int)(pInsOpt->nChippingInsArea/pCamera->m_dConvResolution[nStageNo]);
+		vecIns.push_back(rtIns);
+	}
+}
+
+void CInspectCamera::GetChamferThres(DimensionDir eDim,int &nChamferThres,int &nChipThres,int &nChipThres_White, int &nChipDiffThres, int &nBurrThres,int &nCrackThres,int &nBrokenThres)
+{
+	pSTU_CUTAREA_PARM	pCutArea = m_pRecipe->GetCutAreaPrm(eDim);
+	pSTU_CHIP_PARM pChipPrm = m_pRecipe->GetInspectInfo()->GetChipParm(eDim);
+
+	nChamferThres = pCutArea->m_nThresT;	
+	nChipThres = pChipPrm->m_nChippingThres_T;
+	nChipThres_White = pChipPrm->m_nChippingThres_T_White;
+	nBurrThres = pChipPrm->m_nChippingThres_T_L;
+	nChipDiffThres = pChipPrm->m_nChipDiffThres;
+	nCrackThres = pChipPrm->m_nCrackThres;
+	nBrokenThres = pChipPrm->m_nBrokenThres;
+}
+
+DIT_RESULT CInspectCamera::FindThickness(int iThread,DimensionDir eDim,stFrameIndex stFrame,int iFindLeft)
+{
+	DIT_RESULT ret= DIT_CONV_SUCCESS;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return ret;
+	
+	std::vector<CRect>	vectIns;	
+
+	GetChamferRect(stFrame,eDim,vectIns);
+
+	if((int)vectIns.size() <= 0)
+		return ret;
+	
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double	dScanRes = pCamera->m_dScanResolution[nStageNo];		
+		
+	int					nPrePos[2];
+	ChipErrCode			eChipErr;
+	int					nChamferThres,nChamferChipThres,nChamferChipThreshold_White,nChipDiffThres,nBurrThres,nCrackThres,nBrokenThres;
+
+	GetChamferThres(eDim,nChamferThres,nChamferChipThres,nChamferChipThreshold_White,nChipDiffThres,nBurrThres,nCrackThres,nBrokenThres);	
+	
+	GetChamferControl(iThread)->SetConvResolution(pCamera->m_dConvResolution[nStageNo]);	
+
+	ZeroMemory(nPrePos,sizeof(int)*2);
+
+	CRect		rtIns;
+	for(std::vector<CRect>::iterator it=vectIns.begin();it!=vectIns.end();it++)
+	{
+		rtIns = *it;
+
+		eChipErr = (ChipErrCode)ChamferInspectProcess(iThread,stFrame,eDim,iFindLeft,rtIns,nChamferThres,nChamferChipThres,nChamferChipThreshold_White,nChipDiffThres,nCrackThres,nBrokenThres,nBurrThres,nPrePos);
+
+		if(eChipErr == ERR_CHIP_SUCCESS)
+		{
+			nPrePos[0] = GetChamferControl(iThread)->GetForeEdgeLine(0);
+			nPrePos[1] = GetChamferControl(iThread)->GetForeEdgeLine(1);
+
+			int		nDefect = ChamferExtractResult(iThread,eDim,stFrame,rtIns);
+		}		
+		else
+		{			
+			
+		}
+	}
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pResInfo =  m_pGlassData->GetEdgeResultInfo(eDim);
+		if(pResInfo != NULL)
+		{			
+			pResInfo->nGrindframe[0][stFrame.nFrameIdx] = GetChamferControl(iThread)->GetForeEdgeLine(0);
+			pResInfo->nGrindframe[1][stFrame.nFrameIdx] = GetChamferControl(iThread)->GetForeEdgeLine(1);
+			pResInfo->nGrindframe[2][stFrame.nFrameIdx] = GetChamferControl(iThread)->GetForeEdgeLine(1);
+		}
+	}
+
+	return ret;
+}
+
+int CInspectCamera::ChamferExtractResult(int iThread,DimensionDir eDim,stFrameIndex stFrame,CRect &rect)
+{
+	int			nDefect = 0;
+
+	STU_THICKPOS	stRes;
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(eDim);
+	if(pEdgeInfo == NULL)
+		return FALSE;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return 0;	
+
+	int			nFrameWidth,nFrameHeight;
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	stRes.dThick = GetChamferControl(iThread)->GetAvgThick()*GetChamferControl(iThread)->GetConvRes();						
+	stRes.nLeftLine = GetChamferControl(iThread)->GetForeEdgeLine(0);
+	stRes.nRightLine = GetChamferControl(iThread)->GetForeEdgeLine(1);				
+	stRes.nTopLine = (stFrame.nFrameIdx*nFrameHeight) + nFrameHeight/2 -pEdgeInfo->nGlassStartLine;
+
+	CINSPECT_JUDGEMENT_PARM	*pJudge = m_pRecipe->GetJudgePrm();
+
+	stRes.nJudgeBase = pJudge->chamfer[eDim][pCamera->m_enCamDir].nRefernce;
+	stRes.nJudgeDiff_Plus = pJudge->chamfer[eDim][pCamera->m_enCamDir].nTolPlus;
+	stRes.nJudgeDiff_Minus = pJudge->chamfer[eDim][pCamera->m_enCamDir].nTolMinus;
+
+	CSingleLock		cLock(&m_csResultThick);
+	cLock.Lock();
+	m_resultThickPos[stFrame.nScanIdx].push_back(stRes);
+	cLock.Unlock();
+
+	CChipBlob	*pChipRes = GetChamferControl(iThread)->GetDefectResult();		
+	int			nDefectCount = GetChamferControl(iThread)->GetDefectCount();
+
+	if(pChipRes != NULL && nDefectCount > 0)
+	{			
+		if(m_pDefectControl != NULL)
+			nDefect = m_pDefectControl->ExtractDefect_Chip(eDim,m_iCamera,stFrame.nScanIdx,pChipRes,nDefectCount,DefectLoc_Chip,rect.top);						
+	}	
+
+	return nDefect;
+}
+
+int CInspectCamera::ChamferInspectProcess(int iThread,stFrameIndex stFrame,DimensionDir eDim,int iFindLeft,CRect rtIns, int nThresChamfer,int nThresChip,int nThresChip_White,int nThresChipDiff,int nThresCrack,int nThresBroken,int nBurrThres,int *nPrePos)
+{	
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return 0;	
+
+	int			nBufWidth = align_4byte(rtIns.Width());		
+	CRect		rectChamfer = CRect(iFindLeft,rtIns.top,iFindLeft,rtIns.bottom);		
+
+	rectChamfer.InflateRect(nBufWidth/2,0);	
+	AssertFrameRectWidth(rectChamfer,stFrame.nScanIdx);
+
+	LPBYTE lpHeader = m_pGrabber->GetFrameHeaderLine(stFrame.nScanIdx,rectChamfer.top);		
+	if(lpHeader == NULL)
+		return ERR_CHIP_IMAGE_NULL_01;
+
+	pSTU_CHIP_PARM pChipPrm = m_pRecipe->GetInspectInfo()->GetChipParm(eDim);
+	if(pChipPrm == NULL)
+		return ERR_CHIP_IMAGE_NULL_01;	
+
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	int			nChipInsArea = (int)((double)pChipPrm->m_nChippingInsArea/pCamera->m_dConvResolution[nStageNo]);
+	CRect		rectChip = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
+	int			nCrackInsArea = (int)((double)pChipPrm->m_nCrackINsArea/pCamera->m_dConvResolution[nStageNo]);
+	CRect		rectCrack = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
+	int			nBrokenInsArea = (int)((double)pChipPrm->m_nBrokenInsArea/pCamera->m_dConvResolution[nStageNo]);
+	CRect		rectBroken = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
+
+	rectChip.InflateRect(align_4byte(nChipInsArea)/2,0);	
+	rectCrack.InflateRect(align_4byte(nCrackInsArea)/2,0);	
+	rectBroken.InflateRect(align_4byte(nBrokenInsArea)/2,0);	
+	AssertFrameRectWidth(rectChip,stFrame.nScanIdx);	
+	AssertFrameRectWidth(rectCrack,stFrame.nScanIdx);
+	AssertFrameRectWidth(rectBroken,stFrame.nScanIdx);
+
+	int			nResult;	
+
+	InspectParam insParam;
+	insParam.bUse_ChipIns			= m_pRecipe->GetJudgePrm()->defect[(int)eDim][0].Chip_Side.bError;//nThresChip;
+	insParam.bUse_CrackIns			= m_pRecipe->GetJudgePrm()->defect[(int)eDim][0].Crack.bError;;
+	insParam.bUse_BrokenIns			= m_pRecipe->GetJudgePrm()->defect[(int)eDim][0].Broken.bError;;
+	insParam.bUse_BurrIns			= m_pRecipe->GetJudgePrm()->defect[(int)eDim][0].Burr_Side.bError;;
+	insParam.nChipThres				= nThresChip;
+	insParam.nChipThres_White		= nThresChip_White;
+	insParam.nChipDiffThres			= nThresChipDiff;
+	insParam.nCrackThres			= nThresCrack;
+	insParam.nBrokenThres			= nThresBroken;
+	insParam.nBurrThres				= nBurrThres;
+	insParam.nChipMinSize			= pChipPrm->m_nChippingInsMinSize;
+	insParam.nCrackMinSize			= pChipPrm->m_nCrackInsMinSize;
+	insParam.nBrokenMinSize			= pChipPrm->m_nBrokenInsMinSize;
+	insParam.nBurrMinSize			= pChipPrm->m_nBurrInsMinSize;
+	insParam.nChipSideFilterSize	= pChipPrm->m_nChippingInsSideFilterRange;
+	insParam.nCrackSideFilterSize	= pChipPrm->m_nCrackInsSideFilterRange;
+	insParam.nBrokenSideFilterSize	= pChipPrm->m_nBrokenInsSideFilterRnage;
+	insParam.nBurrSideFilterSize	= pChipPrm->m_nBurrInsSideFilterRange;
+
+	DWORD dwTact = GetTickCount();
+
+	int					nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+	if(nFrameWidth == 0 || nFrameHeight == 0)
+		return ERR_CHIP_IMAGE_NULL_01;
+
+	CInspectOption		*pInsOpt = g_pStatus->GetInspectOption();
+
+	rectChamfer.OffsetRect(0,-rectChamfer.top);
+	ChipErrCode errCode = GetChamferControl(iThread)->Inspection(&nResult,lpHeader,nFrameWidth,rectChamfer,nThresChamfer,TRUE,TRUE,rectChip,rectCrack,rectBroken,insParam,pInsOpt->bSaveCutArea,nPrePos,THRESMODE_FIXED,stFrame.nFrameIdx);
+
+// 	dwTact = GetTickCount() - dwTact;
+// 	
+// 	if(200 < dwTact)
+// 		g_pLog->DisplayMessage(_T("Processing to Slow.. frame %d, SpanTime %d ms"), stFrame.nFrameIdx, dwTact);
+
+	return errCode;
+}
+
+void CInspectCamera::AssertFrameRectWidth(CRect &rect,int iScan)
+{
+	int					nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,iScan,nFrameWidth,nFrameHeight);
+	if(nFrameWidth == 0 || nFrameHeight == 0)
+		return;
+
+	if(rect.left < 0) rect.left = 0;
+	if(rect.right >= nFrameWidth) rect.right = nFrameWidth;
+}
+
+int	CInspectCamera::GetLeftMargin(int iCam,int iScan)
+{
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(iCam,iScan);
+	if(pCamera == NULL)
+		return 0;	
+
+	return pCamera->m_nMarginLeft;
+}
+
+void CInspectCamera::GetFrameSize(int iCam,int iScan,int &nFrameWidth,int &nFrameHeight)
+{
+	nFrameWidth = nFrameHeight = 0;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(iCam,iScan);
+	if(pCamera == NULL)
+		return;	
+
+	nFrameWidth = pCamera->m_FrameSize.cx;
+	nFrameHeight = pCamera->m_FrameSize.cy;
+}
+
+BOOL CInspectCamera::FindEndLine(int iThread,DimensionDir emDim,stFrameIndex stFrame)
+{
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return FALSE;
+
+	if(pEdgeInfo->nPreGlassEndFrame != stFrame.nFrameIdx)
+		return FALSE;
+
+	m_MsgJob.nState = 1;
+	m_MsgJob.nSide = (int)emDim;
+	::SendMessage(m_hWndViewScan, WM_POCESS_STATUS,(WPARAM)&m_MsgJob, (int)emDim);
+
+
+#define BOUNDARY_GLASSSTARTWIDTH_ENDLINE	140
+#define BOUNDARYHORIZ_LEVELDIST_ENDLINE		50	// 鑽愪篂 鐗堟媽鎬ラ槕 鑼槕 閿嫾 鍘氳儗鑺簻
+
+	int			j,k;
+	int			nFrameWidth;
+	int			nFrameHeight;
+	int			nThreshold = m_pRecipe->GetEtcPrm(emDim)->m_nGlassFindthres_Top * BOUNDARY_GLASSSTARTWIDTH_ENDLINE;		
+	int			nCountinueCount = 0;
+	int			nHStart, nGab;
+	BOOL		bContinue = FALSE;	
+	int			nDivHor = 0;
+	int			iScan = stFrame.nScanIdx;
+
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);	
+
+	CGLASS_INFO_PARM *pGlsInfo = m_pRecipe->GetGlassInfo();
+
+	int			nSetHor = pGlsInfo->m_nGlassFindHorPos[emDim];
+	
+	if(nSetHor < BOUNDARY_GLASSSTARTWIDTH_ENDLINE / 2) nSetHor = BOUNDARY_GLASSSTARTWIDTH_ENDLINE / 2;
+	if(nSetHor > nFrameWidth-(BOUNDARY_GLASSSTARTWIDTH_ENDLINE / 2)) nSetHor = nFrameWidth-(BOUNDARY_GLASSSTARTWIDTH_ENDLINE / 2);
+
+	g_pLog->DisplayMessage(_T( "%s End Edge Find position Frame[%d],Hor[%d]"),PANEL_SIDE[emDim],stFrame.nFrameIdx,nSetHor);
+
+	nHStart = nSetHor - BOUNDARY_GLASSSTARTWIDTH_ENDLINE / 2;	
+
+	const	int		nCalculateFrame = 3;
+	int				nStartFrame = stFrame.nFrameIdx - 2;
+	int				nVTop = nStartFrame*nFrameHeight;
+	LPBYTE			lpHeader = m_pGrabber->GetFrameHeaderLine(stFrame.nScanIdx,nVTop);
+
+	CSISBuffer		pVertBuffer(lpHeader,nFrameWidth,nCalculateFrame*nFrameHeight);
+
+	if(lpHeader == NULL || pVertBuffer.IsValidBuffer() == FALSE)
+		return FALSE;	
+
+// 	{
+// 		CString		str;
+// 		str.Format(_T("D:\\Image\\EndLine.bmp"));
+// 		CBufferAttach	attach(str);
+// 		attach.AttachToFile(pVertBuffer);
+// 	}
+
+	int			*pnSum = new int[nFrameHeight*nCalculateFrame + BOUNDARYHORIZ_LEVELDIST_ENDLINE];
+
+	ZeroMemory(pnSum, sizeof(int) * (nFrameHeight*nCalculateFrame + BOUNDARYHORIZ_LEVELDIST_ENDLINE));		
+
+	for (j = pVertBuffer.GetHeight()-1 ; j >= 0; j--)
+	{
+		for (k = nHStart; k < nHStart+BOUNDARY_GLASSSTARTWIDTH_ENDLINE; k++)
+		{
+			pnSum[j] += *pVertBuffer.GetDataAddress(k,j);
+		}			
+
+		if (j <= (pVertBuffer.GetHeight()-1-BOUNDARYHORIZ_LEVELDIST_ENDLINE))
+		{
+			nGab = abs(pnSum[j + BOUNDARYHORIZ_LEVELDIST_ENDLINE] - pnSum[j]);				
+			if (nGab > nThreshold)
+				nCountinueCount++;
+			else
+				nCountinueCount = 0;
+
+			if (nCountinueCount >= 2)
+			{
+				// Glass鐙� 鐭疮鐦ょ棦闃� 鑼厭杈� 澶囩偧鐪変繆 鎸佺话淇�.
+				pEdgeInfo->nGlassEndLine = nStartFrame*nFrameHeight + j + 2;
+				pEdgeInfo->nGlassEndFrame = pEdgeInfo->nGlassEndLine/nFrameHeight;
+				pEdgeInfo->nGlassEdgeXPos[1] = nSetHor;
+
+				g_pLog->DisplayMessage(_T( "%s End Line Frame %d, Line %d"), PANEL_SIDE[emDim],pEdgeInfo->nGlassEndLine / nFrameHeight, pEdgeInfo->nGlassEndLine);
+
+				// Log
+				g_pLog->DisplayMessage(_T( ""));
+				g_pLog->DisplayMessage(_T( "%s Glass EndLine :: %d,%d (nFrameNo=%d)")
+					, PANEL_SIDE[emDim]
+				, pEdgeInfo->nGlassEdgeXPos[1]
+				, pEdgeInfo->nGlassEndLine
+					, pEdgeInfo->nGlassEndLine / nFrameHeight);					
+
+				delete [] pnSum;
+
+				SaveGlassLineImage(stFrame.nScanIdx,pEdgeInfo->nGlassEndLine,pEdgeInfo->nGlassEdgeXPos[1],emDim,_T("EndLine"));
+
+				return TRUE;
+			}
+		}
+	}
+
+	pEdgeInfo->nGlassEndLine = pEdgeInfo->nPreGlassEndLine;
+	pEdgeInfo->nGlassEndFrame = pEdgeInfo->nPreGlassEndFrame;
+	delete [] pnSum;
+
+	g_pLog->DisplayMessage(_T("%s EndLine Frame %d Fail"),PANEL_SIDE[emDim],stFrame.nFrameIdx);
+
+	return FALSE;
+}
+
+void CInspectCamera::SaveGlassLineImage(int iScan,int nLine,int nXPos,DimensionDir emDim,CString strName)
+{
+	int			nImgWidth = 100;
+	int			nImgHeight = 200;		
+	
+	CvRect			saveRect = cvRect(nXPos-nImgWidth,0,nImgWidth*2,nImgHeight*2);
+
+	int			iStartV = nLine-nImgHeight;
+
+	if(iStartV < 0)
+		iStartV = 0;
+
+	LPBYTE	pImg = m_pGrabber->GetFrameHeaderLine(iScan,iStartV);
+	if(pImg == NULL)
+		return;
+
+	IplImage *IpImg = cvCreateImage(cvSize(saveRect.width,saveRect.height),8,1);
+
+	cvZero(IpImg);
+
+	int			nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,iScan,nFrameWidth,nFrameHeight);
+
+	for(int i=0; i< saveRect.height; i++)
+	{		
+		memcpy(&IpImg->imageData[IpImg->widthStep*i], pImg+saveRect.x, sizeof(BYTE)*IpImg->width);
+		pImg += nFrameWidth;
+	}
+
+	CString			strFile;
+	strFile.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\%s_%s.jpg"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime,PANEL_SIDE[emDim],strName);
+
+	g_pStatus->CheckDirectory(strFile);
+
+	cv::Point startPoint(0,saveRect.height/2);
+	cv::Point endPoint(saveRect.width,saveRect.height/2);
+
+	cvLine(IpImg, startPoint, endPoint, cvScalar(255, 0, 0), 1);
+
+	USES_CONVERSION;
+	char str_filename[1024];
+	sprintf_s(str_filename, "%s", W2A(strFile));
+	cvSaveImage(str_filename,IpImg);	
+	
+	cvReleaseImage(&IpImg);
+}
+
+int CInspectCamera::FindLeftLine(int iThread,DimensionDir emDim,stFrameIndex stFrame)
+{	
+	int nFindLine=-1;		
+	
+	CETC_PARM	*pEtc = m_pRecipe->GetEtcPrm(emDim);
+
+	if(pEtc == NULL)
+	{
+		g_pLog->DisplayMessage(_T("Cam[%d],Scan %d,Frame[%d] Find Left Fail : Parameter is Null"),m_iCamera,stFrame.nScanIdx,stFrame.nFrameIdx);
+		return GetLeftMargin(m_iCamera,stFrame.nScanIdx);
+	}
+
+	int					nThres = pEtc->m_nGlassFindthres_Left;		
+
+#define DEFECT_EDGE_AUTO_RATIO 0.3
+#define DEFECT_EDGE_AUTO_PITCH 20
+#define DEFECT_EDGE_CONTINUE 3	
+	
+	
+	CSISEdgeFind		EdgeFind;		
+	CRect				rtROI;
+	const	int			nSearchWidth = 500;
+	const   int			nSearchHeight = 100;
+	int					nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	CSISBuffer			frameBuffer(m_pGrabber->GetFrameHeader(stFrame.nScanIdx,stFrame.nFrameIdx),nFrameWidth,nFrameHeight);
+	if(frameBuffer.IsValidBuffer() == FALSE)
+		return nFindLine;
+
+	rtROI = CRect(GetLeftMargin(m_iCamera,stFrame.nScanIdx),0,frameBuffer.GetWidth()-1,frameBuffer.GetHeight());
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return nFindLine;
+
+	if(pEdgeInfo->nGlassStartLine != 0 && abs(pEdgeInfo->nGlassStartFrame - stFrame.nFrameIdx) <= 3)
+	{
+		rtROI.bottom = frameBuffer.GetHeight()-1;
+		rtROI.top = rtROI.bottom - nSearchHeight;
+	}
+	else if(pEdgeInfo->nGlassEndLine != 0 && pEdgeInfo->nGlassEndLine/frameBuffer.GetHeight() == stFrame.nFrameIdx)
+	{
+		rtROI.top = 0;
+		rtROI.bottom = rtROI.top + nSearchHeight;
+	}
+	else
+	{
+		rtROI.top = frameBuffer.GetHeight()/2 - nSearchHeight/2;
+		rtROI.bottom = rtROI.top + nSearchHeight;
+	}
+
+	if(rtROI.left < 0)
+		rtROI.left = 0;
+	if(rtROI.right >= frameBuffer.GetWidth())
+		rtROI.right = frameBuffer.GetWidth()-1;
+	if(rtROI.top < 0)
+		rtROI.top = 0;
+	if(rtROI.bottom >= frameBuffer.GetHeight())
+		rtROI.bottom = frameBuffer.GetHeight()-1;
+		
+	EdgeFind.FindEdge_ToRightROI(&frameBuffer,nFindLine,DEFECT_EDGE_AUTO_PITCH,nThres,DEFECT_EDGE_AUTO_RATIO,0,rtROI);
+		
+
+	if(nFindLine > 0 && nFindLine < frameBuffer.GetWidth())
+	{
+		m_iSideLine[stFrame.nScanIdx] = nFindLine;	
+		
+		pEdgeInfo->nGrindframe[0][stFrame.nFrameIdx] = nFindLine;
+
+		//Log_GetDebug()->TraceInfo("Trace Left Edge: %d, %d, (%d, %d, %d, %d), %d, %d", 
+		//	(int)emDim, stFrame.nScanIdx,
+		//	rtROI.left, rtROI.top, rtROI.Width(), rtROI.Height(),
+		//	nFindLine, __LINE__);
+	}
+	
+// 	{
+// 		CString		str;
+// 		str.Format(_T("%sIMG_MARK\\FrameEdge_%s_%03d_%d_%04d_roi_%d_%d_%d_%d.bmp"),PATH_INSPECTION_DATA,PANEL_SIDE[emDim],stFrame.nFrameIdx,iThread,nFindLine,rtROI.left,rtROI.top,rtROI.right,rtROI.bottom);
+// 		CBufferAttach		attach(str);
+// 		attach.AttachToFile(frameBuffer);
+// 	}	
+	
+	return nFindLine;
+}
+
+BOOL CInspectCamera::OnThreadEnd(int iThread, CInspectThread *pInspectThread)
+{
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::OnThreadEndAll()
+{
+
+	return TRUE;
+}
+
+void CInspectCamera::ReleaseSplineBuffer()
+{	
+	int			i;
+
+	for(i=0;i<MAX_PANEL_SIDE;i++)
+	{
+		m_SplineImage[i].Reset();		
+	}	
+}
+
+void CInspectCamera::ReleaseFullBuffer()
+{		
+	int		i;
+	for(i=0;i<MAX_SCAN_COUNT;i++)
+	{
+		m_FullImgBuffer[i].Reset();
+	}		
+}
+
+void CInspectCamera::SetParameter(CGlassRecipe *pRecipe,CHardwareSettings *pHW)
+{
+	g_pLog->DisplayMessage(_T("SetParameter Cam[%d] start"),m_iCamera);
+
+	m_bExitThread = TRUE;
+	ZeroMemory(m_iThreadEnd,sizeof(m_iThreadEnd));
+	ZeroMemory(m_bFindGlassStart,sizeof(m_bFindGlassStart));
+	ZeroMemory(m_iSideLine,sizeof(m_iSideLine));
+	ZeroMemory(m_dMark2MarkX,sizeof(m_dMark2MarkX));
+	ZeroMemory(m_dMark2MarkY,sizeof(m_dMark2MarkY));
+	ZeroMemory(m_bSplineInspect,sizeof(m_bSplineInspect));
+	ZeroMemory(m_bProfileFind,sizeof(m_bProfileFind));
+	ZeroMemory(m_nProfileFindFrameIdx,sizeof(m_nProfileFindFrameIdx));
+		
+	for(int i=0;i<MAX_SCAN_COUNT;i++)
+	{		
+		CSingleLock		cLock(&m_csResultThick);
+		cLock.Lock();
+		m_resultThickPos[i].clear();
+		cLock.Unlock();
+		
+		CSingleLock		cHLock(&m_csHoleReion);
+		cHLock.Lock();
+		m_vecHoleReg[i].clear();
+		cHLock.Unlock();
+	}
+	
+	m_pRecipe = pRecipe;
+	m_pHardparm = pHW;
+
+	if(m_pGrabber != NULL)
+	{
+		m_pGrabber->ClearGrabIdx();
+		//m_pGrabber->ClearBuffer();
+	}	
+	
+	if(m_pDefectControl != NULL)
+	{
+		m_pDefectControl->SetHWRecipe(pHW);
+		m_pDefectControl->ResetDefectControl();
+	}
+
+	g_pLog->DisplayMessage(_T("SetParameter Cam[%d] end"),m_iCamera);
+}
+
+void CInspectCamera::DeleteCADAlign(std::multimap<int, CPoint*> *pSetProfileAlignMap)
+{
+	CSingleLock		csLock(&m_csProfile);
+	csLock.Lock();
+
+	std::multimap<int, CPoint*>::iterator	it;
+
+	CPoint		*pPoint;
+	for(it=pSetProfileAlignMap->begin();it!=pSetProfileAlignMap->end();it++)
+	{
+		pPoint = it->second;
+		if(pPoint == NULL)
+			continue;
+		delete pPoint;
+		pPoint = NULL;
+	}
+	pSetProfileAlignMap->clear();
+
+	csLock.Unlock();
+}
+
+void CInspectCamera::SetCADData(std::multimap<int, CPoint *> *pProfileMap,CPoint *ptOrigin)
+{
+	if(m_pRecipe == NULL || pProfileMap == NULL)
+		return;
+
+	CProfileCADProc *pProfile = NULL;
+	int			iScan,iSide;
+	std::multimap<int, CPoint*> *pSetProfileMap;
+	std::multimap<int, CPoint*> *pSetProfileAlignMap;
+	
+	for(iScan=0;iScan<MAX_SCAN_COUNT;iScan++)
+	{
+		iSide =	GetDimension(iScan)%MAX_PANEL_SIDE;		
+		pSetProfileMap = &pProfileMap[iSide];
+		pSetProfileAlignMap = &m_mapAlignProfile[iScan];
+
+		DeleteCADAlign(pSetProfileAlignMap);
+
+		for(int iThread=0;iThread<MAX_THREAD;iThread++)
+		{
+			pProfile = GetProfileControl(iScan,iThread);
+			if(pProfile == NULL)
+				continue;					
+			
+			pProfile->SetProfileData(pSetProfileMap,pSetProfileAlignMap);		
+			pProfile->SetProfileOrigin(ptOrigin[iSide]);
+		}
+	}
+}
+
+void CInspectCamera::SetGlassData(CGlass_Data *pGlassData)
+{
+	m_pGlassData=pGlassData;
+	if(m_pDefectControl != NULL)
+		m_pDefectControl->SetGlassData(pGlassData);
+
+	if(m_pGrabber != NULL)
+	{
+		for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)i);
+			if(pEdgeInfo == NULL)
+				continue;
+
+			pEdgeInfo->nPreGlassEndFrame = m_pGrabber->GetFrameBuffer()->GetFrameCount()-1;
+		}
+	}
+}
+
+void CInspectCamera::SetGrabber(CGrabberControl *pGrabber)
+{
+	m_pGrabber = pGrabber;
+	if(m_pDefectControl != NULL)
+		m_pDefectControl->SetGrabber(pGrabber);
+}
+
+DimensionDir CInspectCamera::GetDimension(int iScan)
+{
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,iScan);
+	if(pCamera == NULL)
+		return DIMENSION_NONE;
+
+	return pCamera->m_eDimension;
+}
+
+void CInspectCamera::SetGrabEnd(int iScan)
+{
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,iScan);
+	if(pCamera == NULL)
+		return;
+
+	DimensionDir		emDim = pCamera->m_eDimension;
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return;
+
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	int		nGlassSize;
+	if(pCamera->m_eScanDir == SCANGLASS_X)
+		nGlassSize = (int)((double)m_pRecipe->GetGlassInfo()->m_nGlassSizeX/pCamera->m_dScanResolution[nStageNo]);
+	else
+		nGlassSize = (int)((double)m_pRecipe->GetGlassInfo()->m_nGlassSizeY/pCamera->m_dScanResolution[nStageNo]);
+
+	pEdgeInfo->nPreGlassEndLine = pEdgeInfo->nGlassStartLine + nGlassSize;
+	pEdgeInfo->nPreGlassEndFrame = pEdgeInfo->nPreGlassEndLine/pCamera->m_FrameSize.cy;
+
+	g_pStatus->SetGrabFrametoScan(iScan,pEdgeInfo->nPreGlassEndFrame+5);
+
+	g_pLog->DisplayMessage(_T("%s Scan %d : Set Grab EndFrame - GlassEnd %d, Frame %d, GrabBuf %d"),PANEL_SIDE[emDim],iScan,pEdgeInfo->nPreGlassEndLine,pEdgeInfo->nPreGlassEndFrame,pEdgeInfo->nPreGlassEndFrame+5);
+}
+
+#define			CHAMFER_MIN_INSPECT_HEIGHT		1000
+#define			CHAMFER_MIN_INSPECT_SEARCHWIDTH 500
+#define			CHIPPING_MIN_INSPECT_AREA		150
+
+void CInspectCamera::PresetChamferPrm(int iScan,DimensionDir eDim)
+{
+	pSTU_CUTAREA_PARM	pCutArea = m_pRecipe->GetInspectInfo()->GetCutAreaParm(eDim);
+	pSTU_CHIP_PARM		pChipPrm =	m_pRecipe->GetInspectInfo()->GetChipParm(eDim);
+	CInspectOption		*pInsOpt = g_pStatus->GetInspectOption();
+
+	if(pCutArea->m_bCutArea == TRUE)
+	{
+		pCutArea->m_nCalArea = pInsOpt->nChamferInsHeight;
+		pCutArea->m_nSearchWidth = pInsOpt->nChamferSearchWidth;
+
+		if(pCutArea->m_nCalArea < CHAMFER_MIN_INSPECT_HEIGHT)
+			pCutArea->m_nCalArea = CHAMFER_MIN_INSPECT_HEIGHT;
+		if(pCutArea->m_nSearchWidth < CHAMFER_MIN_INSPECT_SEARCHWIDTH)
+			pCutArea->m_nSearchWidth = CHAMFER_MIN_INSPECT_SEARCHWIDTH;
+	}
+
+	pChipPrm->m_bChipping = pCutArea->m_bCutArea;
+
+	if(pChipPrm->m_bChipping == TRUE)
+	{
+		pChipPrm->m_nChippingInsArea = pInsOpt->nChippingInsArea;
+
+		if(pChipPrm->m_nChippingInsArea < CHIPPING_MIN_INSPECT_AREA)
+			pChipPrm->m_nChippingInsArea = CHIPPING_MIN_INSPECT_AREA;
+
+		pChipPrm->m_nCrackINsArea = pInsOpt->nCrackINsArea;
+
+		if(pChipPrm->m_nCrackINsArea < CHIPPING_MIN_INSPECT_AREA)
+			pChipPrm->m_nCrackINsArea = CHIPPING_MIN_INSPECT_AREA;
+
+		pChipPrm->m_nBrokenInsArea = pInsOpt->nBrokenInsArea;
+
+		if(pChipPrm->m_nBrokenInsArea < CHIPPING_MIN_INSPECT_AREA)
+			pChipPrm->m_nBrokenInsArea = CHIPPING_MIN_INSPECT_AREA;
+
+		// 20. 11. 14
+		pChipPrm->m_nChippingInsMinSize = pInsOpt->nChippingInsMinSize;
+		pChipPrm->m_nCrackInsMinSize = pInsOpt->nCrackInsMinSize;
+		pChipPrm->m_nBrokenInsMinSize = pInsOpt->nBrokenInsMinSize;
+		pChipPrm->m_nBurrInsMinSize = pInsOpt->nBurrInsMinSize;
+
+		pChipPrm->m_nChippingInsSideFilterRange = pInsOpt->nChippingInsSideFilterRange;
+		pChipPrm->m_nCrackInsSideFilterRange = pInsOpt->nCrackInsSideFilterRange;
+		pChipPrm->m_nBrokenInsSideFilterRnage = pInsOpt->nBrokenInsSideFilterRnage;
+		pChipPrm->m_nBurrInsSideFilterRange = pInsOpt->nBurrInsSideFilterRange;
+	}
+
+	CETC_PARM *pEtcPrm = m_pRecipe->GetEtcPrm(eDim);
+	if(pEtcPrm != NULL)
+	{
+		CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,iScan);
+		if(pCamera == NULL)
+			return;
+
+		pEtcPrm->m_nGlassFindWidth_Left = pCamera->m_FrameSize.cx-1;
+		pEtcPrm->m_nGlassLeftLineMargin[0] = pEtcPrm->m_nGlassLeftLineMargin[1] = 0;
+		pEtcPrm->m_nGlassFindthres_Left = pEtcPrm->m_nGlassFindthres_Top;
+	}
+}
+
+void CInspectCamera::MakeHoleRegion(int iScan)
+{
+	DimensionDir emDim = GetDimension(iScan);	
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return;	
+
+	CSingleLock		cLock(&m_csHoleReion);
+	cLock.Lock();
+
+	m_vecHoleReg[iScan].clear();
+	for(int i=0; i<m_pRecipe->GetHolePrm()->m_nTotalHoleCount; i++)
+	{
+		if(m_pRecipe->GetHolePrm()->m_vecHoleInsParam[i].m_nSideIdx == iScan)
+		{
+			m_vecHoleReg[iScan].push_back(m_pRecipe->GetHolePrm()->m_vecHoleInsParam[i]);
+		}
+	}
+	cLock.Unlock();
+}
+
+void CInspectCamera::GetHoleRegionFrame(int iThread,DimensionDir emDim,stFrameIndex stFrame, std::vector<HOLE_INS_PARM> &vecArray)
+{
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return;
+
+	vector<HOLE_INS_PARM>::iterator		it;
+
+	if(pEdgeInfo->bMark[0] == FALSE)
+		return;
+
+	int			nFrameWidth,nFrameHeight;
+	GetFrameSize(m_iCamera,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+
+	vecArray.clear();
+	for(it=m_vecHoleReg[stFrame.nScanIdx].begin();it!=m_vecHoleReg[stFrame.nScanIdx].end();it++)
+	{
+		if(stFrame.nFrameIdx == (it->m_rtArea.bottom + (int)pEdgeInfo->ptMark[0].y)/nFrameHeight)
+		{
+			vecArray.push_back(*it);
+		}
+	}
+}
+
+void CInspectCamera::MakeChamferRegion(int iScan)
+{
+	DimensionDir emDim = GetDimension(iScan);
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,iScan);
+	if(pCamera == NULL)
+		return;
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return;
+
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double		dConv = pCamera->m_dConvResolution[nStageNo];
+	double		dScan = pCamera->m_dScanResolution[nStageNo];
+
+	if(dConv <= 0 || dScan <= 0)
+		return;
+
+	int		nGlassSize;
+	if(pCamera->m_eScanDir == SCANGLASS_X)
+		nGlassSize = (int)(m_pRecipe->GetGlassInfo()->m_nGlassSizeX/dScan);
+	else
+		nGlassSize = (int)(m_pRecipe->GetGlassInfo()->m_nGlassSizeY/dScan);
+
+	int			nRSize = 0,nRSize2 = 0;
+	pSTU_SPLINE_INS_PARM pSpline = m_pRecipe->GetInspectInfo()->GetSplineIns(emDim);
+	if(pSpline != NULL )
+	{
+		nRSize = pSpline->m_nStartCornerSize_Y;
+		nRSize2 = pSpline->m_nEndCornerSize_Y;
+	}
+	
+	pEdgeInfo->rtChamfer = CRect(0,nRSize,pCamera->m_FrameSize.cx,nGlassSize-nRSize2);
+	pEdgeInfo->rtChamfer.OffsetRect(0,pEdgeInfo->nGlassStartLine);
+	
+	g_pLog->DisplayMessage(_T("%s Scan %d : Chamfer Region %d,%d"),PANEL_SIDE[emDim],iScan,pEdgeInfo->rtChamfer.top,pEdgeInfo->rtChamfer.bottom);
+}
+
+void CInspectCamera::MakeAlignRegion(int iScan)
+{	
+	CINSPECT_JUDGEMENT_PARM *pJudgePrm = m_pRecipe->GetJudgePrm();	
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,iScan);
+	if(pCamera == NULL)
+		return;
+
+	DimensionDir emDim = GetDimension(iScan);
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return;
+
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double		dConv = pCamera->m_dConvResolution[nStageNo];
+	double		dScan = pCamera->m_dScanResolution[nStageNo];
+
+	if(dConv <= 0 || dScan <= 0)
+		return;
+
+	int		nGlassSize;
+	if(pCamera->m_eScanDir == SCANGLASS_X)
+		nGlassSize = m_pRecipe->GetGlassInfo()->m_nGlassSizeX;
+	else
+		nGlassSize = m_pRecipe->GetGlassInfo()->m_nGlassSizeY;
+
+	int		iSide = (int)emDim;
+
+	m_dMark2MarkX[iScan][0] = (pJudgePrm->ptAlign[0][iSide].x/dConv);	
+	m_dMark2MarkX[iScan][1] = (pJudgePrm->ptAlign[1][iSide].x/dConv);				
+	m_dMark2MarkY[iScan][0]   = (pJudgePrm->ptAlign[0][iSide].y/dScan);	
+	m_dMark2MarkY[iScan][1]   =  ((nGlassSize-pJudgePrm->ptAlign[1][iSide].y)/dScan);
+	m_dMark2MarkX[iScan][2] = (pJudgePrm->ptAlign[2][iSide%MAX_PANEL_SIDE].x/dConv);	
+	m_dMark2MarkY[iScan][2] = ((pJudgePrm->ptAlign[2][iSide%MAX_PANEL_SIDE].y)/dScan);
+		
+	CInspectOption	*pOpt =	g_pStatus->GetInspectOption();
+
+	int		nAlignRange = pOpt->nAlignMarkRange;
+	int		nAlignRangeY = pOpt->nAlignMarkRangeY;
+
+	if(nAlignRange < 100)
+		nAlignRange = 100;
+	if(nAlignRangeY < 100)
+		nAlignRangeY = 100;
+
+	pEdgeInfo->rtMark[0] = CRect((int)m_dMark2MarkX[iScan][0],(int)m_dMark2MarkY[iScan][0],(int)m_dMark2MarkX[iScan][0],(int)m_dMark2MarkY[iScan][0]);
+	pEdgeInfo->rtMark[0].InflateRect(nAlignRange,nAlignRangeY);
+	pEdgeInfo->rtMark[1] = CRect((int)m_dMark2MarkX[iScan][1],(int)m_dMark2MarkY[iScan][1],(int)m_dMark2MarkX[iScan][1],(int)m_dMark2MarkY[iScan][1]);
+	pEdgeInfo->rtMark[1].InflateRect(nAlignRange,nAlignRangeY);
+	pEdgeInfo->rtMark[2] = CRect((int)m_dMark2MarkX[iScan][2],(int)m_dMark2MarkY[iScan][2],(int)m_dMark2MarkX[iScan][2],(int)m_dMark2MarkY[iScan][2]);
+	pEdgeInfo->rtMark[2].InflateRect(nAlignRange,nAlignRangeY);
+
+	pEdgeInfo->rtMark[0].OffsetRect(0,pEdgeInfo->nGlassStartLine);
+	pEdgeInfo->rtMark[1].OffsetRect(0,pEdgeInfo->nGlassStartLine);
+	pEdgeInfo->rtMark[2].OffsetRect(0,pEdgeInfo->nGlassStartLine);
+}
+
+BOOL CInspectCamera::FindAlignProcess(int iThread,DimensionDir eDim,int iScan,int iFrame)
+{
+	int			iPos;		
+
+	for(iPos=0;iPos<3;iPos++)
+	{
+		FindAlignMark(iThread,eDim,iScan,iFrame,iPos);
+	}
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::FindAlignMark(int iThread,DimensionDir eDim, int iScan,int iFrame,int iPos)
+{	
+	BOOL		bRet = FALSE;
+
+	INS_EDGE_RESULT_INFO *pResInfo =  m_pGlassData->GetEdgeResultInfo(eDim);
+	CALIGNMARK_PARM *pAlignPrm = m_pRecipe->GetAlignMarkPrm(eDim);		
+
+	if(pResInfo != NULL && pResInfo->bMark[iPos] == TRUE)
+		return TRUE;
+
+	CRect		rectAlign =	pResInfo->rtMark[iPos];
+	if(rectAlign.top <= 0)
+		return FALSE;
+	
+	int			nFrameWidth,nFrameHeight;
+
+	GetFrameSize(m_iCamera,iScan,nFrameWidth,nFrameHeight);
+
+	switch(iPos)
+	{
+	case 0:
+		if(iFrame != rectAlign.bottom/nFrameHeight+2)
+			return FALSE;		
+		break;
+	default:
+		if(iFrame != rectAlign.bottom/nFrameHeight)
+			return FALSE;
+		break;
+	}				
+
+	LPBYTE		lpBuffer = m_pGrabber->GetFrameHeaderLine(iScan,rectAlign.top);
+	if(lpBuffer == NULL)
+		return FALSE;		
+	
+	CSISBuffer frameBuffer(lpBuffer, nFrameWidth, rectAlign.Height());	
+
+	if(!frameBuffer.IsValidBuffer())
+	{
+		return FALSE;
+	}				
+
+	if(iPos == 1)
+	{
+		int aa = 100;
+	}
+
+	stFrameIndex		stFrame(iScan,iFrame);
+	m_iSideLine[iScan] = FindLeftLine(iThread,eDim,stFrame);
+	if(m_iSideLine[iScan] <= 0 || m_iSideLine[iScan] >= nFrameWidth)	
+	{
+		if(iPos == 1)
+		{				
+			if(pResInfo != NULL)
+			{
+				for(int i=iFrame-1;i>=pResInfo->nGlassStartLine/nFrameHeight-1;i--)
+				{
+					if(pResInfo->nGrindframe[0][i] > 0 && pResInfo->nGrindframe[0][i] < nFrameWidth)
+					{
+						m_iSideLine[iScan] = pResInfo->nGrindframe[0][i];
+						break;
+					}
+				}
+			}				
+		}
+
+		if(m_iSideLine[iScan] <= 0)
+		{
+			g_pLog->DisplayMessage(_T("%s Align Mark Find[%d] Edge Find Fail : Frame %d, %d,%d,%d,%d"),PANEL_SIDE[eDim],iPos, iFrame,rectAlign.left,rectAlign.top,rectAlign.right,rectAlign.bottom);
+			m_iSideLine[iScan] = GetLeftMargin(m_iCamera,iScan);
+		}
+	}			
+
+	CString			strPos = _T("TOP");
+	CString			strRes = _T("Fail");
+
+	switch(iPos)
+	{
+	case 1: strPos = _T("BOT"); break;
+	case 2: strPos = _T("SUB"); break;
+	}					
+
+	rectAlign.OffsetRect(m_iSideLine[iScan],0);
+
+	if(pAlignPrm->m_bIsMark[iPos] == FALSE)
+	{
+		pResInfo->bMark[iPos] = TRUE;
+		pResInfo->ptMark[iPos].x	= (float)rectAlign.CenterPoint().x;
+		pResInfo->ptMark[iPos].y	= (float)rectAlign.CenterPoint().y;
+		pResInfo->nMarkToEdge_X[iPos] = (int)(pResInfo->ptMark[iPos].x - m_iSideLine[iScan]);
+		pResInfo->nMarkToEdge_Y[iPos] = (int)(pResInfo->ptMark[iPos].y - pResInfo->nGlassStartLine);
+
+		g_pLog->DisplayMessage(_T("%s Virtual Align Mark Pos[%d] x : %.2f, y : %.2f"),PANEL_SIDE[eDim],iPos,pResInfo->ptMark[iPos].x,pResInfo->ptMark[iPos].y);
+
+		return TRUE;
+	}
+
+	g_pLog->DisplayMessage(_T("%s Align Mark Pos[%d] %d,%d,%d,%d"),PANEL_SIDE[eDim],iPos,rectAlign.left,rectAlign.top,rectAlign.right,rectAlign.bottom);
+
+	double			dRate = 0.5;
+	TEMP_RESULT		matchResut;
+	CRect rectIns = rectAlign;				
+
+	rectIns.OffsetRect(0,-rectIns.top);
+	matchResut.fRat = 0.;
+	matchResut.pt.x = matchResut.pt.y = 0;
+
+	for(int iMarkPos=0;iMarkPos<MAX_POS_MARKER_COUNT;iMarkPos++)
+	{
+		if(pAlignPrm->IpMarkImg[iPos][iMarkPos] == NULL)
+			continue;	
+
+		CRect		rtFind = rectIns;
+
+		if(rtFind.Width() <= pAlignPrm->IpMarkImg[iPos][iMarkPos]->width)
+			rtFind.right = rtFind.left + pAlignPrm->IpMarkImg[iPos][iMarkPos]->width + 10;
+		if(rtFind.Height() <= pAlignPrm->IpMarkImg[iPos][iMarkPos]->height)
+			rtFind.bottom = rtFind.top + pAlignPrm->IpMarkImg[iPos][iMarkPos]->height + 10;
+
+		CEdgeProc		insProc;
+		insProc.CvFindMark(frameBuffer,pAlignPrm->IpMarkImg[iPos][iMarkPos],rtFind,matchResut,dRate);
+
+		if(matchResut.fRat*100. >= pAlignPrm->m_dMarkMatchingRate[iPos][iMarkPos])
+		{				
+			if(pResInfo != NULL)
+			{
+				pResInfo->bMark[iPos] = TRUE;
+				pResInfo->ptMark[iPos].x	= matchResut.pt.x;
+				pResInfo->ptMark[iPos].y	= matchResut.pt.y + rectAlign.top;
+				pResInfo->nMarkToEdge_X[iPos] = (int)(pResInfo->ptMark[iPos].x - m_iSideLine[iScan]);
+				pResInfo->nMarkToEdge_Y[iPos] = (int)(pResInfo->ptMark[iPos].y - pResInfo->nGlassStartLine);			
+
+				//pResInfo->nGrindframe[0][iFrame] = pResInfo->nGrindframe[1][iFrame] = m_iSideLine[iScan];
+			}
+
+			g_pLog->DisplayMessage(_T("%s Align Mark Find[%d][%d] Success x %.2f, y %.2f"),PANEL_SIDE[eDim],iPos,iMarkPos,matchResut.pt.x, matchResut.pt.y + rectAlign.top);
+			strRes = _T("Success");
+			break;
+		}				
+	}
+
+	if(pResInfo != NULL && pResInfo->bMark[iPos] == FALSE)
+	{
+		if(iPos != 2)		// sub mark缁� 鍔涘瘒
+		{
+			pResInfo->bMark[iPos] = TRUE;
+			pResInfo->ptMark[iPos].x	= (float)rectAlign.CenterPoint().x;
+			pResInfo->ptMark[iPos].y	= (float)rectAlign.CenterPoint().y;
+			pResInfo->nMarkToEdge_X[iPos] = (int)(pResInfo->ptMark[iPos].x - m_iSideLine[iScan]);
+			pResInfo->nMarkToEdge_Y[iPos] = (int)(pResInfo->ptMark[iPos].y - pResInfo->nGlassStartLine);
+
+			g_pLog->DisplayMessage(_T("%s Virtual Align Mark Pos[%d] x : %.2f, y : %.2f"),PANEL_SIDE[eDim],iPos,pResInfo->ptMark[iPos].x,pResInfo->ptMark[iPos].y);
+		}
+		//pResInfo->nGrindframe[0][iFrame] = pResInfo->nGrindframe[1][iFrame] = m_iSideLine[iScan];
+		g_pLog->DisplayMessage(_T("%s Align Mark Find[%d] Fail x %.2f, y %.2f"),PANEL_SIDE[eDim],iPos,m_iSideLine[iScan] + m_dMark2MarkX[iScan][iPos], pResInfo->nGlassStartLine + m_dMark2MarkY[iScan][iPos]);		
+	}
+
+	/*
+	CString			strFile;		
+	CvRect			saveRect = cvRect((int)matchResut.pt.x-rectAlign.Width()/2,(int)(matchResut.pt.y + rectAlign.top)-rectAlign.Height()/2,rectAlign.Width(),rectAlign.Height());
+	strFile.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\Align_%s_%s_%s.jpg"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime,strPos,PANEL_SIDE[eDim],strRes);
+
+	SaveCvAlignImage(saveRect,strFile,iScan,nFrameWidth,nFrameHeight);		
+	*/
+
+	if(iPos == 0)			// 闇夐攨鎺� Align 鑼柦闃戞帾鐖� True
+		bRet = TRUE;
+			
+
+	return bRet;
+}
+
+BOOL CInspectCamera::SaveCvAlignImage(CvRect saveRoi,CString strFile,int iScan,int nFrameWidth,int nFrameHeight)
+{	
+	LPBYTE		pImg = m_pGrabber->GetFrameHeaderLine(iScan,saveRoi.y);
+
+	if(pImg == NULL)	
+		return FALSE;	
+
+	IplImage* IpImg = cvCreateImage(cvSize(saveRoi.width, saveRoi.height), 8, 1);
+	cvZero(IpImg);
+
+	for(int i=0; i< saveRoi.height; i++)
+	{		
+		memcpy(&IpImg->imageData[IpImg->widthStep*i], pImg+saveRoi.x, sizeof(BYTE)*IpImg->width);
+		pImg += nFrameWidth;
+	}
+
+	g_pStatus->CheckDirectory(strFile);
+
+	int			nLineSize = 10;
+	CPoint		posC = CPoint(saveRoi.width/2,saveRoi.height/2);
+
+	cv::Point startPoint(posC.x-nLineSize,posC.y);
+	cv::Point endPoint(posC.x+nLineSize,posC.y);
+	cvLine(IpImg, startPoint, endPoint, cvScalar(192, 192, 192), 1);
+
+	cv::Point startPoint2(posC.x,posC.y-nLineSize);
+	cv::Point endPoint2(posC.x,posC.y+nLineSize);
+	cvLine(IpImg, startPoint2, endPoint2, cvScalar(192, 192, 192), 1);
+
+	USES_CONVERSION;
+	char str_filename[1024];
+	sprintf_s(str_filename, "%s", W2A(strFile));
+
+	cvSaveImage(str_filename,IpImg);
+	cvReleaseImage(&IpImg);
+
+	return TRUE;
+}
+
+BOOL CInspectCamera::FindGlassStartLine(DimensionDir emDim,stFrameIndex stFrame)
+{			
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo(emDim);
+	if(pEdgeInfo == NULL)
+		return FALSE;
+
+	CCameraSettings *pCamera = m_pHardparm->GetCameraSettings(m_iCamera,stFrame.nScanIdx);
+	if(pCamera == NULL)
+		return FALSE;
+
+	CGLASS_INFO_PARM *pGlsInfo = m_pRecipe->GetGlassInfo();
+
+	int			nFrame = m_pGrabber->GetFrameBuffer()->GetFrameCount()/2;
+	int			nFrameWidth = pCamera->m_FrameSize.cx;
+	int			nFrameHeight = pCamera->m_FrameSize.cy;
+	int			nSkipFrame = pGlsInfo->m_nFindGlassStartOffset[emDim] / nFrameHeight;
+	int			nSetHor = pGlsInfo->m_nGlassFindHorPos[emDim];
+
+	if(nSetHor < BOUNDARY_GLASSSTARTWIDTH / 2) nSetHor = BOUNDARY_GLASSSTARTWIDTH / 2;
+	if(nSetHor > nFrameWidth-(BOUNDARY_GLASSSTARTWIDTH / 2)) nSetHor = nFrameWidth-(BOUNDARY_GLASSSTARTWIDTH / 2);
+
+	pEdgeInfo->nGlassEdgeXPos[0] = nSetHor;	
+
+	int			j, k, nGab;
+	int			nThreshold = m_pRecipe->GetEtcPrm(emDim)->m_nGlassFindthres_Top * BOUNDARY_GLASSSTARTWIDTH;
+	int			*pnSum = new int[nFrameHeight + BOUNDARYHORIZ_LEVELDIST];
+	LPBYTE		lpHeader;
+	int			nCountinueCount = 0;
+	int			nRet,nHStart;
+
+	DWORD		dwT1 = GetTickCount();
+
+	g_pLog->DisplayMessage(_T("%s Find Glass Start Start : Scan %d "),PANEL_SIDE[emDim],stFrame.nScanIdx);
+
+	for(int iFrame=0;iFrame<nFrame;iFrame++)
+	{
+		while (TRUE)
+		{
+			nRet = m_pGrabber->IsAcqFrame(iFrame);
+			if (nRet < 2)		// 閰掓祦 鏁戝槢韬爮楠ㄨ偤 鎺墎.
+			{
+				if (GetTickCount() - dwT1 > TIME_WAIT_GLASS_START)
+				{
+					g_pLog->DisplayMessage(_T("%s Find Glass Start : no image(Grab Time Out),%d sec"),PANEL_SIDE[emDim],TIME_WAIT_GLASS_START/1000);
+					delete [] pnSum;					
+					return FALSE;
+				}
+				Sleep(1);
+			}	
+			else
+				break;
+
+		}
+		if (nSkipFrame > iFrame)
+			continue;	
+
+		lpHeader = m_pGrabber->GetFrameHeader(stFrame.nScanIdx,iFrame);		
+		if(lpHeader == NULL)
+		{
+			g_pLog->DisplayMessage(_T("%s Find Glass Start : no image(Image is Null)"),PANEL_SIDE[emDim]);
+			delete [] pnSum;
+			return FALSE;
+		}
+
+		ZeroMemory(pnSum, sizeof(int) * (nFrameHeight + BOUNDARYHORIZ_LEVELDIST));
+		int nLine = 0;
+		nHStart = nSetHor - BOUNDARY_GLASSSTARTWIDTH / 2;
+
+		BOOL		bChangeBuffer = FALSE;
+		for (j = 0; j < nFrameHeight + BOUNDARYHORIZ_LEVELDIST; j++)
+			//for (j = 0; j < nFrameHeight; j++)
+		{
+			for (k = nHStart; k < nHStart + BOUNDARY_GLASSSTARTWIDTH; k++)
+			{
+				// Grab鐗� 鐗堝揩 婊氭鐙� 鐗堟媽淇婅緫 1024鎵肩墷闃� 閫炵虎鍝� 鐗堝揩 淇冩緶 婊氭鐢� 鍟婂粔瀹㈠叿 鑼勪績.
+				if (j == nFrameHeight && nLine != 0 && bChangeBuffer == FALSE)
+				{					
+					DWORD dwTick = GetTickCount();
+					while (TRUE)
+					{			
+						if(GetTickCount()-dwTick > TIME_WAIT_GLASS_START/2)	
+						{					
+							g_pLog->DisplayMessage(_T("%s No Image"),PANEL_SIDE[emDim]);
+							delete [] pnSum;
+							return FALSE;
+						}
+
+						if(m_pGrabber->IsAcqFrame(iFrame + 1) > 1)
+						{
+							lpHeader = m_pGrabber->GetFrameHeader(stFrame.nScanIdx,iFrame + 1);
+							if(lpHeader != NULL)
+							{
+								bChangeBuffer = TRUE;
+								//g_pLog->DisplayMessage(_T("%s Change Buffer %d, %d, %d"),PANEL_SIDE[pRecipe->GetDimension()], j, i, g_pBase->m_pMemFrameNo[GetCameraID()]);
+								break;
+							}	
+						}										
+					}					
+					nLine = 0;
+				}
+
+				pnSum[j] += *(lpHeader + nLine * nFrameWidth + k);
+			}
+			nLine++;			
+
+			if (j >= BOUNDARYHORIZ_LEVELDIST)
+			{
+				nGab = abs(pnSum[j - BOUNDARYHORIZ_LEVELDIST] - pnSum[j]);				
+				if (nGab > nThreshold)
+					nCountinueCount++;
+				else
+					nCountinueCount = 0;
+
+				if (nCountinueCount >= 2)
+				{
+					g_pLog->DisplayMessage(_T("%s Start Line Frame %d, Line %d, Gab %d, Thres %d"), PANEL_SIDE[emDim],iFrame, j, nGab, nThreshold);
+					// Glass鐙� 鐭疮鐦ょ棦闃� 鑼厭杈� 澶囩偧鐪変繆 鎸佺话淇�.
+					pEdgeInfo->nGlassStartLine = iFrame * nFrameHeight + j - 2;
+					pEdgeInfo->nGlassStartFrame = pEdgeInfo->nGlassStartLine/nFrameHeight;
+					// Log
+					g_pLog->DisplayMessage(_T(""));
+					g_pLog->DisplayMessage(_T("%s Glass StartLine :: Pixel %ld nFrameNo=%d")
+						, PANEL_SIDE[emDim]
+					, pEdgeInfo->nGlassStartLine
+						, pEdgeInfo->nGlassStartLine / nFrameHeight);
+
+					delete [] pnSum;		
+
+					SaveGlassLineImage(stFrame.nScanIdx,pEdgeInfo->nGlassStartLine,pEdgeInfo->nGlassEdgeXPos[0],emDim,_T("StartLine"));
+
+					return TRUE;
+				}
+			}
+		}
+	}
+
+	delete [] pnSum;
+	return FALSE;
+}
+
+int	CInspectCamera::GetDefectCount()
+{
+	if(m_pDefectControl == NULL)
+		return 0;
+
+	return m_pDefectControl->GetDefectCount();
+}
+
+CDefect *CInspectCamera::GetDefect(int iDefect)
+{
+	if(m_pDefectControl == NULL)
+		return NULL;
+
+	return m_pDefectControl->GetDefect(iDefect);
+}
\ No newline at end of file
diff --git a/ENRIT/Process/InspectCamera.h b/ENRIT/Process/InspectCamera.h
new file mode 100644
index 0000000..c73ac9e
--- /dev/null
+++ b/ENRIT/Process/InspectCamera.h
@@ -0,0 +1,257 @@
+#pragma once
+
+#include "ThreadControl.h"
+#include "DefectStorage.h"
+#include "Glass_Data.h"
+#include "HoleInspector.h"
+
+interface IInspect2Sequence
+{
+public:	
+	virtual void			II2S_InspectionEnd(int iCamID,int iScan) = 0;		
+};
+
+enum	ERR_FIND_GLASSSTARTLINE {ERR_FINDGLASSSTART_FAIL=0, ERR_FINDGLASSSTART_SUCCESS, ERR_FINDGLASSSTART_FIND_FAIL, ERR_FINDGLASSSTART_COUNT};
+
+#define		RCUT_PROFILE_CALCULATE_THETA		22.5
+typedef struct STU_SPLINE_PROFILE_POSITION_
+{	
+	int			iCam;
+	int			iSide;
+	int			iScan;
+	int			iIndex;
+	int			iPos;
+	int			iLoop;
+	double		dX;
+	double		dY;
+	double		dRadius;
+	double		dTheta;
+	double		ptCenterX;
+	double		ptCenterY;
+	CvPoint2D32f	ptRealCenter;
+	CvPoint2D32f		ptGlass;
+	CvPoint2D32f		ptChamfer;
+	CvPoint2D32f		ptCadLine;
+	BOOL		bFindPos;
+	BOOL		bChamferFind;
+	double		dDist;
+	double		dDistCnt;
+	double		dChamfer;
+
+	ST_PROFILE_SETTING	*pSettings;
+
+public:
+	STU_SPLINE_PROFILE_POSITION_()
+	{		
+		iCam = iSide = iScan = iIndex = iPos = iLoop = 0;
+		dX = dY = dRadius = dTheta = 0.;
+		ptGlass.x = ptGlass.y = ptChamfer.x = ptChamfer.y = ptRealCenter.x = ptRealCenter.y = 0;
+		ptCadLine.x = ptCadLine.y = 0;
+		ptCenterX = ptCenterY = -1;
+		bFindPos = bChamferFind = FALSE;
+		dDist = dChamfer = dDistCnt = 0.;		
+		pSettings = NULL;
+	}	
+}STU_SPLINE_PROFILE_POSITION, *pSTU_SPLINE_PROFILE_POSITION;
+
+typedef struct STU_SPLINE_RCut_
+{	
+	int			width;
+	int			x1,x2,y;	
+	int			imgX,imgY;
+	double		dTheta;
+
+public:
+	STU_SPLINE_RCut_()
+	{		
+		reset();
+	}	
+	void reset()
+	{
+		x1 = x2 = y = width = 0;
+		imgX = imgY = 0;
+		dTheta = 0;
+	}
+}STU_SPLINE_RCut, *pSTU_SPLINE_RCut;
+
+class CGlass_Data;
+class CGlassRecipe;
+class CHardwareSettings;
+class CSISBuffer;
+class CInspectCamera : public IThreadWorker
+{
+public:
+	CInspectCamera(int iCam=0);
+	virtual ~CInspectCamera(void);
+
+public:
+	virtual BOOL		OnThreadRun(int iThread, CInspectThread *pInspectThread);
+	virtual BOOL		OnThreadEnd(int iThread, CInspectThread *pInspectThread);
+	virtual BOOL		OnThreadEndAll();
+
+public:
+	void				ReleaseThread();
+	int					InitInspect(int nThread,int maxDefect=1000);
+	int					ReInitThread(int nThread);
+	void				SetParameter(CGlassRecipe *pRecipe,CHardwareSettings *pHW);
+	void				SetGlassData(CGlass_Data *pGlassData);
+	void				SetSplineModel(CSplineModel *pSplineModel){m_pSplineModel=pSplineModel;}
+	void				SetCADData(std::multimap<int, CPoint *> *pProfileMap,CPoint *ptOrigin);
+	void				SetGrabber(CGrabberControl *pGrabber);
+	void				SetI2S(IInspect2Sequence *pI2S){m_pII2S=pI2S;}
+	BOOL				ScanStart(int iScan);	
+	void				SetProcessEnd(){m_bExitThread=TRUE;}
+	int					GetDefectCount();
+	CDefect				*GetDefect(int iDefect);
+	pINSPECTSPLINE_BUFFER	GetSplineBuffer(int iPos){return &m_SplineImage[iPos];}	
+	pINSPECTFULLIMAGE_BUFFER GetFullImgBuffer(int iScan){return &m_FullImgBuffer[iScan];}
+	void				SetViewScanHWnd(HWND hWnd){m_hWndViewScan=hWnd;}
+	std::multimap<int, CPoint*> *GetProfileAlign(int iScan){return &m_mapAlignProfile[iScan];}
+
+protected:	
+	BOOL				ScanStartThread();		
+	DimensionDir		GetDimension(int iScan);
+	BOOL				GetCheckFrame(stFrameIndex stFrame);
+	void				SetGrabEnd(int iScan);	
+
+	BOOL				CheckStartLineFrame(DimensionDir eDim,int iFrame);	
+	BOOL				FindGlassStartLine(DimensionDir emDim,stFrameIndex stFrame);	
+	int					FindLeftLine(int iThread,DimensionDir emDim,stFrameIndex stFrame);
+	BOOL				FindEndLine(int iThread,DimensionDir emDim,stFrameIndex stFrame);
+	
+	void				MakeAlignRegion(int iScan);	
+	BOOL				FindAlignMark(int iThread,DimensionDir eDim,int iScan,int iFrame,int iPos);
+	BOOL				FindAlignProcess(int iThread,DimensionDir eDim,int iScan,int iFrame);
+
+	void				PresetChamferPrm(int iScan,DimensionDir eDim);
+	void				MakeChamferRegion(int iScan);
+	void				GetChamferRect(stFrameIndex stFrame,DimensionDir eDim,std::vector<CRect> &vecIns);
+	DIT_RESULT			FindThickness(int iThread,DimensionDir eDim,stFrameIndex stFrame,int iFindLeft);
+	CChamferInspect		*GetChamferControl(int iThread){return m_pChamferControl[iThread];}
+	void				GetChamferThres(DimensionDir eDim,int &nChamferThres,int &nChipThres,int &nChipThres_White, int &nChipDiffThres, int &nBurrThres,int &nCrackThres,int &nBrokenThres);	
+	int					ChamferInspectProcess(int iThread,stFrameIndex stFrame,DimensionDir eDim,int iFindLeft,CRect rtIns,int nThresChamfer,int nThresChip,int nThresChip_White,int nThresChipDiff,int nThresCrack,int nThresBroken,int nBurrThres,int *nPrePos);
+	int					ChamferExtractResult(int iThread,DimensionDir eDim,stFrameIndex stFrame,CRect &rect);
+		
+	CSplineInspect		*GetSplineControl(int iThread){return m_pSplineControl[iThread];}
+	DIT_RESULT			FindSpline(int iThread,DimensionDir	emDim,stFrameIndex stFrame,int iFindLine);
+	CRect				GetSplineInsRect(CSize szMaster,CPoint nOffset,stFrameIndex stFrame,int iFindLine,INS_EDGE_RESULT_INFO *pEdgeInfo,BOOL &bFlip);
+	int					GetSplineFindEdge(CSISBuffer *pSPBuf,CETC_PARM *pEtc,int iFindLine,int nOffset);
+	BOOL				SplineChipProcess(CSplineInspect *pInsSpline,CSISBuffer *imgOrg,int iThread,DimensionDir emDim,stFrameIndex stFrame,int iFindLine,BOOL bFlip,int iTopPixel,int iLeftPixel,CString strCutDiv);
+	BOOL				SplineChip_Curve(CSplineInspect *pInsSpline,CSISBuffer *imgOrg,int iThread,DimensionDir emDim,stFrameIndex stFrame,CPoint &pointLeft,int nChipThres,BOOL bFlip,int iTopPixel,int iLeftPixel,CString strCutDiv);
+	void				SaveSplineImage(CSISBuffer &pSPBuf,CSplineInspect *pSplineIns,pSTU_SPLINE_INS_PARM pSplinePrm, int iThread,DimensionDir emDim,stFrameIndex stFrame,double dConvRes,SPLINE_ERR_MSG	errMsg,BOOL bFlip);
+
+	DIT_RESULT			FindSpline_New(int iThread,DimensionDir	emDim,stFrameIndex stFrame,int iFindLine);
+	CRect				GetSplineInsRect_New(int iThread,DimensionDir	emDim,CSize szMaster,CPoint nOffset,stFrameIndex stFrame,int iFindLine,BOOL &bFlip);
+	CvPoint2D32f		GetSplineCenter(int iThread,DimensionDir emDim,stFrameIndex stFrame,BOOL bBot);
+
+	ROI					GetRCutChipImage(int iThread,DimensionDir emDim,stFrameIndex stFrame,COwnerBuffer &pTgt,double dTheata,CvPoint2D32f ptCen,double dRadius);
+	void				SetRCutDisplayImage(int iThread,DimensionDir emDim,stFrameIndex stFrame,CRect rectIns,BOOL bFlip,double dRadius,CvPoint2D32f ptSplineCen);
+	BOOL				CopyRectImg(LPBYTE pOrg,LPBYTE pTgt,CSize szImg,CRect &rectIns);
+
+	CHoleInspector		*GetHoleControl(int iThread){return m_pHoleInspect[iThread];}
+	DIT_RESULT			FindHoleInspection(int iThread,DimensionDir	emDim,stFrameIndex stFrame,int iFindLine);
+	void				MakeHoleRegion(int iScan);
+	void				GetHoleRegionFrame(int iThread,DimensionDir emDim,stFrameIndex stFrame, std::vector<HOLE_INS_PARM> &vecArray);
+
+	BOOL				ProfileRandom(PROFILE_RESULT &ProfileResult);
+	BOOL				ChamferRandom(CHAMFER_RESULT &ChamferResult);
+	BOOL				RCutRandom(PROFILE_RESULT &ProfileResult);
+	BOOL				RCutChamferRandom(CHAMFER_RESULT &ChamferResult);
+
+	BOOL				CheckProfile(int iThread,DimensionDir emDim,stFrameIndex stFrame);
+	BOOL				FindProfileProcess(int iThread,DimensionDir emDim,stFrameIndex stFrame,int iFindLine);
+	void				CalculateStageTheta(DimensionDir emDim,int iScan,CvPoint2D32f *pAlign);
+	BOOL				MakeProfilePosition(DimensionDir emDim,stFrameIndex stFrame,CProfileCADProc *pProcess, vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f *ptAlign);
+	BOOL				CalculateProfileChamfer(DimensionDir emDim,stFrameIndex stFrame,CProfileCADProc *pProcess,vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f ptAlign);
+	BOOL				GetAvgProfileNChamfer(DimensionDir emDim,stFrameIndex stFrame,vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile,double &dProfileAvg,double &dChamferAvg);
+	STU_THICKPOS		GetThickPosResultPos(stFrameIndex stFrame,int nYPos);
+	CProfileCADProc		*GetProfileControl(int iScan,int iThread){return m_pProfileControl[iScan][iThread];}
+
+	BOOL				RCutProfileProcess(DimensionDir emDim,stFrameIndex stFrame,CProfileCADProc *pProcess,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f *ptAlign);
+	BOOL				IsRCutProfileProcess(DimensionDir emDim);
+	BOOL				CheckAlignMark(DimensionDir emDim,int &nIndex);
+	BOOL				ReFindAlignMark(DimensionDir emDim,stFrameIndex stFrame,int iPos);
+	int					GetRCutProfileIndexTheta(DimensionDir emDim,stFrameIndex stFrame,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f *ptAlign);
+	int					GetRCutProfileIndex(DimensionDir eDimension,int *nRcpIndex,int *nRcpSize);
+	int					GetRCutProfileTheta2Vector(int nPosCnt,DimensionDir eDimension,stFrameIndex stFrame,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile,int *nRcpIndex,INT *nRcpSize,CvPoint2D32f *ptAlign);
+	void				GetRCutCalculateCenterPosition(DimensionDir eDimension,stFrameIndex stFrame,pSTU_SPLINE_PROFILE_POSITION pPfPositon,CvPoint2D32f *ptAlign,int iPos);
+	BOOL				FindRCutProfilePosition(DimensionDir eDimension,stFrameIndex stFrame,CProfileCADProc *pProcess,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile,CvPoint2D32f *ptAlign);
+	BOOL				FindRCutPosition(STU_SPLINE_PROFILE_POSITION *pProfilePos,DimensionDir eDimension,stFrameIndex stFrame,CProfileCADProc *pProcess);
+	ROI					GetRCutProcessImage(STU_SPLINE_PROFILE_POSITION *pProfilePos,DimensionDir eDimension,stFrameIndex stFrame,COwnerBuffer &pTgt);
+	double				GetRadus2Distance(DimensionDir eDimension,stFrameIndex stFrame,double dtheta,double dRadius,double dSin,double dCons);
+	BOOL				FindGlassChamfer(int index,DimensionDir eDimension,stFrameIndex stFrame,CSISBuffer &bufTgt,int nGlassThres,int nChamferThres,IMPOS2D &ptGlassEdgePos,IMPOS2D &ptChamferEdgePos);
+	BOOL				CalculateProfileSpline(DimensionDir eDimension,stFrameIndex stFrame,vector< pair<double,STU_SPLINE_PROFILE_POSITION*> > &vecProfile);
+
+	void				DeleteCADAlign(std::multimap<int, CPoint*> *pSetProfileAlignMap);
+
+protected:	
+	//13. 视觉功能
+	void FinallyVisionProc(DimensionDir eDim, stFrameIndex stFrame);
+
+	void				SaveFullImageCopy(int iScan);
+	int					GetLeftMargin(int iCam,int iScan);
+	void				GetFrameSize(int iCam,int iScan,int &nFrameWidth,int &nFrameHeight);	
+	void				SaveGlassLineImage(int iScan,int nEndLine,int nXPos,DimensionDir emDim,CString strName);
+	BOOL				GetCheckExit(){return m_bExitThread;}
+	BOOL				SaveCvAlignImage(CvRect saveRoi,CString strFile,int iScan,int nFrameWidth,int nFrameHeight);	
+	void				AssertFrameRectWidth(CRect &rect,int iScan);
+	void				ScanRegionSet(stFrameIndex stFrame);
+	BOOL				CheckProcessEnd(int iThread,stFrameIndex stFrame);		
+	BOOL				CheckThreadEnd(int iThread,stFrameIndex stFrame,BOOL bProfile);
+	ERR_FIND_GLASSSTARTLINE		IsGlassStartLine(int iThread,int &iScan);
+	void				ReleaseSplineBuffer();	
+	void				ReleaseFullBuffer();	
+	int					GetThreadEndCount(int iScan);
+
+	void				ResetFrameFinish(int nCurrentScanIdx);
+	void				SetFrameFinishEndFrame(int nCurrentScanIdx, int nFrameIdx);
+	void				SetFrameFinish(int nCurrentScanIdx, int nCurrentFrameIdx);
+	BOOL				CheckAllFrameFinish(int nCurrentScanIdx);
+
+protected:
+	CThreadControl		*m_pThreadControl;
+	CGlassRecipe		*m_pRecipe;
+	CHardwareSettings	*m_pHardparm;
+	CGrabberControl		*m_pGrabber;
+	CGlass_Data			*m_pGlassData;
+	IInspect2Sequence	*m_pII2S;
+	CChamferInspect		*m_pChamferControl[MAX_THREAD];
+	CDefectControl		*m_pDefectControl;
+	CSplineInspect		*m_pSplineControl[MAX_THREAD];
+	CSplineModel		*m_pSplineModel;
+	CHoleInspector		*m_pHoleInspect[MAX_THREAD];
+	CProfileCADProc		*m_pProfileControl[MAX_SCAN_COUNT][MAX_THREAD];
+
+protected:
+	int					m_iCamera;
+	int					m_iScan;	
+	int					m_iSideLine[MAX_SCAN_COUNT];
+	BOOL				m_bExitThread;
+	double				m_dMark2MarkX[MAX_SCAN_COUNT][MAX_MARKER_COUNT];
+	double				m_dMark2MarkY[MAX_SCAN_COUNT][MAX_MARKER_COUNT];
+	int					m_iThreadEnd[MAX_SCAN_COUNT][MAX_THREAD];	
+	CCriticalSection	m_csThreadEnd;
+	CCriticalSection	m_csThreadGlassStart;	
+	CCriticalSection	m_csThreadProfile;	
+	CCriticalSection	m_csResultThick;
+	CCriticalSection	m_csHoleReion;
+	CCriticalSection	m_csProfile;
+	CCriticalSection	m_csSaveimage;
+	BOOL				m_bFindGlassStart[MAX_SCAN_COUNT];
+	INSPECTSPLINE_BUFFER m_SplineImage[MAX_PANEL_SIDE];
+	INSPECTFULLIMAGE_BUFFER	m_FullImgBuffer[MAX_SCAN_COUNT];
+	BOOL				m_bSplineInspect[2];
+	BOOL				m_bProfileFind[MAX_SCAN_COUNT];
+	int					m_nProfileFindFrameIdx[MAX_SCAN_COUNT];
+	std::vector<STU_THICKPOS> m_resultThickPos[MAX_SCAN_COUNT];
+	vector<HOLE_INS_PARM>	m_vecHoleReg[MAX_SCAN_COUNT];
+	HWND				m_hWndViewScan;
+	PROG_MSG			m_MsgJob;
+	std::multimap<int, CPoint*> m_mapAlignProfile[MAX_SCAN_COUNT];
+
+	CCriticalSection	m_csFrameFinishCheck;
+	int					m_nFrameFinishIdx[MAX_SCAN_COUNT];
+	BOOL				m_bFrameFinish[MAX_SCAN_COUNT][MAX_FRAM_COUNT];
+	double m_fInspectLastTime[8];
+};
+
diff --git a/ENRIT/Process/ThreadControl.cpp b/ENRIT/Process/ThreadControl.cpp
new file mode 100644
index 0000000..5d89499
--- /dev/null
+++ b/ENRIT/Process/ThreadControl.cpp
@@ -0,0 +1,234 @@
+
+#include "StdAfx.h"
+#include "ThreadControl.h"
+
+CThreadControl::CThreadControl(void)
+{
+	m_nWorkingThread= 0;
+	m_nThreadLoop= 0;
+	m_pThread= NULL;
+	m_pThreadWorker= NULL;
+	InitializeCriticalSection(&m_csWorkingEnd);
+}
+
+CThreadControl::~CThreadControl(void)
+{
+	ReleaseThreadControl();
+	DeleteCriticalSection(&m_csWorkingEnd);
+}
+
+int	CThreadControl::StartThreadControl()
+{
+	if (m_pThread)
+	{
+		for (int i = 0; i < m_nThreadLoop; i++)
+		{
+			m_pThread[i].StartThreadWork();
+		}
+	}
+
+	return m_nThreadLoop;
+}
+
+void CThreadControl::StopThreadControl()
+{
+	if (m_pThread)
+	{
+		for (int i = 0; i < m_nThreadLoop; i++)
+		{
+			m_pThread[i].StopThread();
+		}
+	}
+
+}
+BOOL CThreadControl::InitThreadControl(int nThread, IThreadWorker* pThreadWorker)
+{
+	if(nThread == m_nThreadLoop)
+		return TRUE;
+
+	ReleaseThreadControl();
+
+	if(nThread < 1)
+		nThread= 1;
+	if(nThread > MAX_THREAD)
+		nThread= MAX_THREAD;
+
+	m_pThreadWorker = pThreadWorker;
+	m_pThread = new CInspectThread[nThread];
+
+	m_nThreadLoop = 0;
+	for (int i = 0; i < nThread; i++)
+	{
+		m_pThread[i].SetWorker(static_cast<IThreadWorker*>(this));
+		m_pThread[i].StartThreadLoop(i);
+		m_nThreadLoop++;
+	}
+
+	return TRUE;
+}
+
+BOOL CThreadControl::ReleaseThreadControl()
+{
+	if (m_pThread && m_nThreadLoop > 0)
+	{
+		int i;
+		for (i = 0; i < m_nThreadLoop; i++)
+		{
+			m_pThread[i].StopThread();
+			m_pThread[i].WaitThreadEnd();
+		}
+
+		Sleep(500);
+
+		for (i = 0; i < m_nThreadLoop; i++)
+		{
+			if (m_pThread[i].IsRunning())
+			{
+				m_pThread[i].SuspendThread();
+				Sleep(10);
+				TerminateThread(m_pThread[i].m_hThread, 0);
+				g_pLog->DisplayMessage(_T("Deinit :: Terminate Thread : %d"), i);
+			}
+		}
+
+		m_nThreadLoop = 0;
+
+		delete [] m_pThread;
+		m_pThread = NULL;
+	}
+
+	return TRUE;
+}
+
+BOOL CThreadControl::OnThreadRun(int iThread, CInspectThread *pInspectThread)
+{
+	EnterCriticalSection(&m_csWorkingEnd);
+	m_nWorkingThread++;
+	LeaveCriticalSection(&m_csWorkingEnd);
+
+	Sleep(1);// 窍绰 老捞 绝栏搁  OnThreadEndAll 捞 静饭靛 俺荐 父怒 龋免瞪 荐 乐促.
+
+	if(m_pThreadWorker)
+		return m_pThreadWorker->OnThreadRun(iThread, pInspectThread);
+	return TRUE;
+}
+BOOL CThreadControl::OnThreadEnd(int iThread, CInspectThread *pInspectThread)
+{
+	BOOL bRet= FALSE;
+
+	if(m_pThreadWorker)
+		m_pThreadWorker->OnThreadEnd(iThread, pInspectThread);
+	EnterCriticalSection(&m_csWorkingEnd);
+	m_nWorkingThread--;
+	if(m_nWorkingThread == 0)
+	{
+		bRet= OnThreadEndAll();
+	}
+	LeaveCriticalSection(&m_csWorkingEnd);
+	return bRet;//m_nWorkingThread == 0;
+}
+BOOL CThreadControl::OnThreadEndAll()
+{
+	BOOL bRet= TRUE;
+	if(m_pThreadWorker)
+	{
+		bRet= m_pThreadWorker->OnThreadEndAll();
+	}
+	return bRet;
+}
+
+
+IMPLEMENT_DYNCREATE(CInspectThread, CWinThread)
+CInspectThread::~CInspectThread()
+{
+	DeleteCriticalSection(&m_csExit);
+}
+CInspectThread::CInspectThread()
+{
+	m_bRunning		= FALSE;
+	m_bThreadRunning	= FALSE;
+	m_bWorking			= FALSE;
+	m_iThread			= -1;
+	m_iCamera			= -1;
+
+//	m_nFrameDefBlobLimit	= 0;
+
+	m_pWorker= NULL;
+	InitializeCriticalSection(&m_csExit);
+
+}
+
+BEGIN_MESSAGE_MAP(CInspectThread, CWinThread)
+	//{{AFX_MSG_MAP(CInspectionThread)
+	// NOTE - the ClassWizard will add and remove mapping macros here.
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+BOOL CInspectThread::StartThreadLoop(int iThread)
+{
+	if (m_bRunning)
+		return FALSE;
+
+	m_iThread = iThread;
+	EnterCriticalSection(&m_csExit);
+	m_bRunning = TRUE;
+	LeaveCriticalSection(&m_csExit);
+	CreateThread();
+
+	return TRUE;
+}
+
+void CInspectThread::StopThread()
+{
+	EnterCriticalSection(&m_csExit);
+	m_bRunning = FALSE;
+	LeaveCriticalSection(&m_csExit);
+}
+BOOL CInspectThread::WaitThreadEnd(int ms)
+{
+	int count= 0;
+	while (m_bThreadRunning)
+	{
+		Sleep(1);
+		count++;
+		if(ms > 0)	// 措扁矫埃 力茄捞 乐栏搁.
+		{
+			if(count > ms)
+				return FALSE; // 措扁矫埃 悼救 沥惑 辆丰 给窍绊 府畔.
+		}
+	}
+	return TRUE;	// 沥惑 辆丰 犬牢.
+}
+
+BOOL CInspectThread::InitInstance()
+{
+	// TODO:  perform and per-thread initialization here
+	return TRUE;
+}
+
+int CInspectThread::ExitInstance()
+{
+	// TODO:  perform any per-thread cleanup here
+	return CWinThread::ExitInstance();
+}
+
+int CInspectThread::Run()
+{
+	m_bThreadRunning= TRUE;
+
+	while(m_bRunning && m_pWorker)
+	{
+		if(m_bWorking)
+		{
+			m_pWorker->OnThreadRun(m_iThread, this);
+			m_pWorker->OnThreadEnd(m_iThread, this);
+			m_bWorking= FALSE;
+		}else
+		{
+			Sleep(1);
+		}
+	}	
+	ExitInstance();
+	m_bThreadRunning= FALSE;
+	return CWinThread::Run();
+}
diff --git a/ENRIT/Process/ThreadControl.h b/ENRIT/Process/ThreadControl.h
new file mode 100644
index 0000000..ad27e63
--- /dev/null
+++ b/ENRIT/Process/ThreadControl.h
@@ -0,0 +1,95 @@
+#pragma once
+
+#define MAX_THREAD		3
+
+class CInspectThread;
+
+class IThreadWorker
+{
+public:
+	virtual BOOL OnThreadRun(int iThread, CInspectThread *pInspectThread)= 0;
+	virtual BOOL OnThreadEnd(int iThread, CInspectThread *pInspectThread)= 0;
+	virtual BOOL OnThreadEndAll()= 0;// must be calculated by the Function (OnThreadEnd())
+};
+
+class CInspectThread : public CWinThread
+{
+	DECLARE_DYNCREATE(CInspectThread)
+protected:
+	BOOL			m_bThreadRunning;
+	CRITICAL_SECTION		m_csExit;
+	volatile	BOOL		m_bRunning;
+	BOOL			m_bWorking;
+
+	int				m_iThread;
+	int				m_iCamera;
+
+	IThreadWorker	*m_pWorker;
+
+public:
+	CInspectThread();
+	virtual ~CInspectThread();
+	void SetWorker(IThreadWorker *pWorker){m_pWorker= pWorker;}
+
+	BOOL StartThreadLoop(int iThread);	// 檬扁 
+	void StartThreadWork(){m_bWorking= TRUE;}
+
+	void StopThread();
+	BOOL WaitThreadEnd(int ms= 0);
+
+	BOOL IsRunning(){return m_bRunning;}
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInspectionThread)
+public:
+	virtual BOOL InitInstance();
+	virtual int ExitInstance();
+	virtual int Run();
+	//}}AFX_VIRTUAL
+
+protected:
+
+	// Generated message map functions
+	//{{AFX_MSG(CInspectThread)
+	// NOTE - the ClassWizard will add and remove member functions here.
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+class CThreadControl : IThreadWorker
+{
+	int				m_nThreadLoop;		// 积己等 Thread Count
+	int				m_nWorkingThread;	// 悼累[累诀]阑 矫累茄 Thread Count
+	CInspectThread	*m_pThread;
+
+	IThreadWorker	*m_pThreadWorker;
+	CRITICAL_SECTION	m_csWorkingEnd;
+
+public:
+	CThreadControl(void);
+	~CThreadControl(void);
+
+
+
+public:
+
+	// 1. Thread 磊眉狼 积己苞 家戈俊 包咯.
+	int	InitThreadControl(int nThread, IThreadWorker* pThreadWorker);
+	BOOL ReleaseThreadControl();
+
+	// 2. Thread Loop 救俊辑 累诀狼 瘤矫 咯何父 牧飘费
+	int	StartThreadControl();
+	void StopThreadControl();
+
+	// 
+	int	GetThreadLoopCount(){return m_nThreadLoop;}
+	int GetThreadWorkingCount(){return m_nWorkingThread;}
+
+	// Implementation for Interface[IthreadWorker]
+	BOOL OnThreadRun(int iThread, CInspectThread *pInspectThread);
+	BOOL OnThreadEnd(int iThread, CInspectThread *pInspectThread);
+	BOOL OnThreadEndAll();
+
+};
diff --git a/ENRIT/ReadMe.txt b/ENRIT/ReadMe.txt
new file mode 100644
index 0000000..1d4c283
--- /dev/null
+++ b/ENRIT/ReadMe.txt
@@ -0,0 +1,89 @@
+================================================================================
+    MICROSOFT 基础类库 : ENRIT 项目概述
+===============================================================================
+
+应用程序向导已为您创建了此 ENRIT 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。
+
+本文件概要介绍组成 ENRIT 应用程序的每个文件的内容。
+
+ENRIT.vcxproj
+    这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
+
+ENRIT.vcxproj.filters
+    这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
+
+ENRIT.h
+    这是应用程序的主头文件。
+    其中包括其他项目特定的标头(包括 Resource.h),并声明 CENRITApp 应用程序类。
+
+ENRIT.cpp
+    这是包含应用程序类 CENRITApp 的主应用程序源文件。
+
+ENRIT.rc
+    这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。
+
+res\ENRIT.ico
+    这是用作应用程序图标的图标文件。此图标包括在主资源文件 ENRIT.rc 中。
+
+res\ENRIT.rc2
+    此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+主框架窗口的情况:
+    项目包括标准的MFC接口。
+
+MainFrm.h, MainFrm.cpp
+    此文件包含框架类CMainFrame。
+    这个类派生于CFrameWnd,并控制所有SDI的框架功能。
+
+/////////////////////////////////////////////////////////////////////////////
+
+在应用程序向导中创建一个文档格式和一个视图。
+
+ENRITDoc.h, ENRITDoc.cpp - 文件
+    这个文件包含一个CENRITDoc类。编辑这个文件
+    添加特殊文档数据并通过CENRITDoc::Serialize完成文件
+    实现存储和加载。
+
+ENRITView.h, ENRITView.cpp - 文档视图
+    这个文件包含一个CENRITView类。
+    CENRITView个体用于查看CENRITDoc个体。
+
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+其他功能:
+
+ActiveX 控件
+    该应用程序包含对使用 ActiveX 控件的支持。
+
+Windows 头文件
+    应用程序支持使用TCP/IP网络的通信。
+
+/////////////////////////////////////////////////////////////////////////////
+
+其他标准文件:
+
+StdAfx.h, StdAfx.cpp
+    这些文件用于生成名为 ENRIT.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
+
+Resource.h
+    这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
+
+ChipData.manifest
+	Windows XP 使用应用程序清单文件来描述特定版本的并行程序集的应用程序依赖项。加载程序使用这些信息来从程序集缓存中加载相应的程序集,并保护其不被应用程序访问。应用程序清单可能会包含在内,以作为与应用程序可执行文件安装在同一文件夹中的外部 .manifest 文件进行重新分发,它还可能以资源的形式包含在可执行文件中。
+/////////////////////////////////////////////////////////////////////////////
+
+其他注释:
+
+应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。
+
+如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。
+有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/ENRIT/Recipe/GlassRecipe.cpp b/ENRIT/Recipe/GlassRecipe.cpp
new file mode 100644
index 0000000..0faf916
--- /dev/null
+++ b/ENRIT/Recipe/GlassRecipe.cpp
@@ -0,0 +1,4377 @@
+锘�#include "StdAfx.h"
+#include "GlassRecipe.h"
+
+//////////////////////////////////////////////////////////////////////////
+// CRECIPE_INFO_PARM
+CRECIPE_INFO_PARM::CRECIPE_INFO_PARM(void)
+{
+	Reset();
+}
+
+CRECIPE_INFO_PARM::~CRECIPE_INFO_PARM(void)
+{
+
+}
+
+CRECIPE_INFO_PARM& CRECIPE_INFO_PARM::operator=(CRECIPE_INFO_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+		CopyMemory(m_strRecipeName,rh.m_strRecipeName,sizeof(TCHAR)*MAX_STRING_LENGTH);		
+		CopyMemory(m_strRecipeFileName,rh.m_strRecipeFileName,sizeof(TCHAR)*MAX_STRING_LENGTH);		
+		//park
+		CopyMemory(m_strRecipeFileNameBackUp,rh.m_strRecipeFileNameBackUp,sizeof(TCHAR)*MAX_STRING_LENGTH);		
+		m_nSoftRevision = rh.m_nSoftRevision;
+	}
+	return *this;
+}
+
+void CRECIPE_INFO_PARM::Reset()
+{
+	ZeroMemory(m_strRecipeName,sizeof(TCHAR)*MAX_STRING_LENGTH);	
+	ZeroMemory(m_strRecipeFileName,sizeof(TCHAR)*MAX_STRING_LENGTH);	
+	//park
+	ZeroMemory(m_strRecipeFileNameBackUp,sizeof(TCHAR)*MAX_STRING_LENGTH);
+	m_nSoftRevision = 0;
+}
+
+void CRECIPE_INFO_PARM::SetRecipeName(CString strRecipe)
+{
+	if(strRecipe.IsEmpty() == TRUE || strRecipe.GetLength() <= 0 || strRecipe.GetLength() >= MAX_STRING_LENGTH)
+	{
+		ZeroMemory(m_strRecipeName,sizeof(TCHAR)*MAX_STRING_LENGTH);
+		return;
+	}
+	ZeroMemory(m_strRecipeName,sizeof(TCHAR)*MAX_STRING_LENGTH);
+	CopyMemory(m_strRecipeName,strRecipe.GetBuffer(0),sizeof(TCHAR)*strRecipe.GetLength());
+}
+
+void CRECIPE_INFO_PARM::SetRecipeFileName(CString strFile)
+{
+	if(strFile.IsEmpty() == TRUE || strFile.GetLength() <= 0 || strFile.GetLength() >= MAX_STRING_LENGTH)
+	{
+		ZeroMemory(m_strRecipeFileName,sizeof(TCHAR)*MAX_STRING_LENGTH);
+		return;
+	}
+	ZeroMemory(m_strRecipeFileName,sizeof(TCHAR)*MAX_STRING_LENGTH);
+	CopyMemory(m_strRecipeFileName,strFile.GetBuffer(0),sizeof(TCHAR)*strFile.GetLength());
+}
+
+CString CRECIPE_INFO_PARM::GetRecipeName()
+{
+	CString		strRecipe;		
+	strRecipe.Format(_T("%s"),m_strRecipeName);
+	return strRecipe;
+}
+CString CRECIPE_INFO_PARM::GetRecipeFileName()
+{
+	CString		strFile;		
+	strFile.Format(_T("%s"),m_strRecipeFileName);
+	return strFile;
+}
+
+BOOL CRECIPE_INFO_PARM::ReadRecipe(CConfig *pFile)
+{
+	pFile->GetItemValue(_T("SOFTREV"), m_nSoftRevision);	
+
+	return TRUE;
+}
+BOOL CRECIPE_INFO_PARM::WriteRecipe(CConfig *pFile)
+{
+	pFile->SetItemValue(_T("SOFTREV"), m_nSoftRevision);	
+
+	return TRUE;
+}
+
+void CRECIPE_INFO_PARM::SetRecipeFileNameBackUp( CString strFile )
+{
+	if(strFile.IsEmpty() == TRUE || strFile.GetLength() <= 0 || strFile.GetLength() >= MAX_STRING_LENGTH)
+	{
+		ZeroMemory(m_strRecipeFileNameBackUp,sizeof(TCHAR)*MAX_STRING_LENGTH);
+		return;
+	}
+	ZeroMemory(m_strRecipeFileNameBackUp,sizeof(TCHAR)*MAX_STRING_LENGTH);
+	CopyMemory(m_strRecipeFileNameBackUp,strFile.GetBuffer(0),sizeof(TCHAR)*strFile.GetLength());
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////
+// CGLASS_INFO_PARM
+CGLASS_INFO_PARM::CGLASS_INFO_PARM(void)
+{
+	Reset();
+}
+
+CGLASS_INFO_PARM::~CGLASS_INFO_PARM(void)
+{
+
+}
+
+CGLASS_INFO_PARM& CGLASS_INFO_PARM::operator=(CGLASS_INFO_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+		CopyMemory(m_nFindGlassStartOffset,rh.m_nFindGlassStartOffset,sizeof(int)*MAX_DIMENSION_COUNT);
+		CopyMemory(m_nGlassFindHorPos,rh.m_nGlassFindHorPos,sizeof(int)*MAX_DIMENSION_COUNT);		
+		m_nGlassSizeX = rh.m_nGlassSizeX;
+		m_nGlassSizeY = rh.m_nGlassSizeY;
+		m_nGlassImageSize = rh.m_nGlassImageSize;
+		m_nGlassImageLeftMargin = rh.m_nGlassImageLeftMargin;
+		m_OriginDirection = rh.m_OriginDirection;			
+		m_bGlassFullImageSave = rh.m_bGlassFullImageSave;
+		m_bAllImageSave = rh.m_bAllImageSave;
+		m_strDisp = rh.m_strDisp;
+		m_bGlassDefaultImageSave = rh.m_bGlassDefaultImageSave;
+		m_bOneScanMode = rh.m_bOneScanMode;
+		m_bPanelReverse = rh.m_bPanelReverse;
+		m_dOneScanTime = rh.m_dOneScanTime;
+		m_emGlassType = rh.m_emGlassType;
+	}
+	return *this;
+}
+
+void CGLASS_INFO_PARM::Reset()
+{	
+	ZeroMemory(m_nFindGlassStartOffset,sizeof(int)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_nGlassFindHorPos,sizeof(int)*MAX_DIMENSION_COUNT);	
+	m_nGlassSizeX = 0;
+	m_nGlassSizeY = 0;
+	m_nGlassImageSize = 1500;
+	m_nGlassImageLeftMargin = 200;
+	m_OriginDirection = GD_LeftTop;	
+	m_strDisp.Empty();
+	m_bGlassFullImageSave = FALSE;
+	m_bAllImageSave = FALSE;
+
+	m_bGlassDefaultImageSave = FALSE;
+	m_bOneScanMode = FALSE;
+	m_bPanelReverse = FALSE;
+	m_dOneScanTime = 0.;
+	m_emGlassType = GLASSTYPE_RCUT;
+}
+
+CString CGLASS_INFO_PARM::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+
+	if((void *)&m_nGlassSizeX == pValue)
+		str.Format(_T("GLASS_SIZE_X"));
+	else if((void *)&m_nGlassSizeY == pValue)
+		str.Format(_T("GLASS_SIZE_Y"));
+	else if((void *)&m_nGlassImageSize == pValue)
+		str.Format(_T("GLASS_IMAGE_SIZE"));
+	else if((void *)&m_nGlassImageLeftMargin == pValue)
+		str.Format(_T("GLASS_IMAGE_LEFT_MARGIN"));
+	else if((void *)&m_OriginDirection == pValue)
+		str.Format(_T("GLASS_ORIGIN_DIR"));	
+	else if((void *)&m_strDisp == pValue)
+		str.Format(_T("GLASS_Disp"));	
+	else if((void *)&m_bGlassFullImageSave == pValue)
+		str.Format(_T("GLASS_FullImageSave"));	
+	else if((void *)&m_bAllImageSave == pValue)
+		str.Format(_T("GLASS_AllImageSave"));
+	else if((void *)&m_bGlassDefaultImageSave == pValue)
+		str.Format(_T("GLASS_DefaultImageSave"));
+	else if((void *)&m_bOneScanMode == pValue)
+		str.Format(_T("GLASS_OneScanMode"));
+	else if((void *)&m_bPanelReverse == pValue)
+		str.Format(_T("GLASS_Reverse"));
+	else if((void *)&m_dOneScanTime == pValue)
+		str.Format(_T("GLASS_OneScanTime"));
+	else if((void *)&m_emGlassType == pValue)
+		str.Format(_T("GLASS_TYPE"));
+	else
+	{
+		int		i;
+
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			if((void *)&m_nFindGlassStartOffset[i] == pValue)
+				str.Format(_T("GLASS_FindStartLineOffset[%d]"),i);
+			else if((void *)&m_nGlassFindHorPos[i] == pValue)
+				str.Format(_T("ETC_GLASSFINDHORPOS_%d"),i);
+		}
+	}
+
+	return str;
+}
+
+BOOL CGLASS_INFO_PARM::ReadRecipe(CConfig *pFile)
+{
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nGlassSizeX);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassSizeX);
+
+	str = GetFileString((void *)&m_nGlassSizeY);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassSizeY);
+
+	str = GetFileString((void *)&m_nGlassImageSize);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassImageSize);
+
+	str = GetFileString((void *)&m_nGlassImageLeftMargin);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassImageLeftMargin);
+
+	str = GetFileString((void *)&m_OriginDirection);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_OriginDirection = (GlassDirection)nValue;
+
+	str = GetFileString((void *)&m_strDisp);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_strDisp);
+
+	str = GetFileString((void *)&m_bGlassFullImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bGlassFullImageSave);	
+
+	str = GetFileString((void *)&m_bAllImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bAllImageSave);		
+
+	str = GetFileString((void *)&m_bGlassDefaultImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bGlassDefaultImageSave);
+
+	str = GetFileString((void *)&m_bOneScanMode);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bOneScanMode);
+
+	str = GetFileString((void *)&m_bPanelReverse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bPanelReverse);
+
+	str = GetFileString((void *)&m_dOneScanTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dOneScanTime);	
+
+	str = GetFileString((void *)&m_emGlassType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue, 0);		
+	m_emGlassType = (EM_GLASSTYPE_COMP)nValue;
+
+	int		i;
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_nFindGlassStartOffset[i]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nFindGlassStartOffset[i]);	
+
+		str = GetFileString((void *)&m_nGlassFindHorPos[i]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindHorPos[i]);			
+	}
+
+
+	return TRUE;
+}
+BOOL CGLASS_INFO_PARM::WriteRecipe(CConfig *pFile)
+{
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nGlassSizeX);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassSizeX);
+
+	str = GetFileString((void *)&m_nGlassSizeY);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassSizeY);
+
+	str = GetFileString((void *)&m_nGlassImageSize);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassImageSize);
+
+	str = GetFileString((void *)&m_nGlassImageLeftMargin);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassImageLeftMargin);
+
+	str = GetFileString((void *)&m_OriginDirection);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_OriginDirection;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	str = GetFileString((void *)&m_strDisp);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strDisp);
+
+	str = GetFileString((void *)&m_bGlassFullImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bGlassFullImageSave);
+
+	str = GetFileString((void *)&m_bAllImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bAllImageSave);	
+
+	str = GetFileString((void *)&m_bGlassDefaultImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bGlassDefaultImageSave);
+
+	str = GetFileString((void *)&m_bOneScanMode);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bOneScanMode);
+
+	str = GetFileString((void *)&m_bPanelReverse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bPanelReverse);	
+
+	str = GetFileString((void *)&m_dOneScanTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dOneScanTime);	
+
+	str = GetFileString((void *)&m_emGlassType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_emGlassType;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+	int		i;
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_nFindGlassStartOffset[i]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nFindGlassStartOffset[i]);	
+
+		str = GetFileString((void *)&m_nGlassFindHorPos[i]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindHorPos[i]);		
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CCUTAREA_PARM
+CCUTAREA_PARM::CCUTAREA_PARM(void)
+{
+	Reset();
+}
+
+CCUTAREA_PARM::~CCUTAREA_PARM(void)
+{
+
+}
+
+CCUTAREA_PARM& CCUTAREA_PARM::operator=(CCUTAREA_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();		
+
+		int			i;
+
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{			
+			CopyMemory(&m_stuCutAreaParm[i],&rh.m_stuCutAreaParm[i],sizeof(STU_CUTAREA_PARM));			
+			CopyMemory(&m_stuChipParm[i],&rh.m_stuChipParm[i],sizeof(STU_CHIP_PARM));				
+			CopyMemory(&m_stuCutAreaAlignMark[i],&rh.m_stuCutAreaAlignMark[i],sizeof(STU_CUTAREA_ALIGN_MARK));//20140611
+
+			m_vecCutAreaExpPos[i].clear();
+			std::vector<STU_CUTAREA_EXP_POS>::iterator	it;
+			for(it=rh.m_vecCutAreaExpPos[i].begin();it!=rh.m_vecCutAreaExpPos[i].end();it++)
+				m_vecCutAreaExpPos[i].push_back(*it);		
+		}	
+
+	}
+	return *this;
+}
+
+void CCUTAREA_PARM::Reset()
+{	
+	int			i;
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{		
+		m_stuCutAreaParm[i].Reset();
+		m_stuChipParm[i].Reset();		
+		m_stuCutAreaAlignMark[i].Reset();//20140611
+		m_vecCutAreaExpPos[i].clear();
+	}	
+}
+
+BOOL CCUTAREA_PARM::GetChipUse(int iPos)
+{
+	BOOL		bUse = FALSE;
+
+	int				i;
+
+	if(iPos > DIMENSION_D_DN)
+	{
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{			
+			bUse |= m_stuChipParm[i].m_bChipping;
+		}
+	}
+	else
+	{		
+		bUse |= m_stuChipParm[iPos].m_bChipping;
+	}	
+
+	return bUse;
+}
+
+BOOL CCUTAREA_PARM::GetCutAreaUse(int iPos)
+{
+	BOOL		bUse = FALSE;
+
+	int				i;
+
+	if(iPos > DIMENSION_D_DN)
+	{
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{			
+			bUse |= m_stuCutAreaParm[i].m_bCutArea;			
+		}
+	}
+	else
+	{
+		bUse |= m_stuCutAreaParm[iPos].m_bCutArea;
+	}
+
+	return bUse;
+}
+
+CString CCUTAREA_PARM::GetFileString(void *pValue)
+{
+	CString			str;
+	int				iScan;
+
+	for(iScan=0;iScan<MAX_DIMENSION_COUNT;iScan++)
+	{		
+		if((void *)&m_stuCutAreaParm[iScan].m_bCutArea == pValue)
+			str.Format(_T("CUTAREA_USE_[%d]"),iScan);		
+		else if((void *)&m_stuCutAreaParm[iScan].m_nThresT == pValue)
+			str.Format(_T("CUTAREA_CUTTHRES_T_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaParm[iScan].m_nThresB == pValue)
+			str.Format(_T("CUTAREA_CUTTHRES_B_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaParm[iScan].m_nSearchWidth == pValue)
+			str.Format(_T("CUTAREA_SEARCHWIDTH_[%d]"),iScan);	
+		else if((void *)&m_stuCutAreaParm[iScan].m_nCalArea == pValue)
+			str.Format(_T("CUTAREA_CALAREA_[%d]"),iScan);		
+		else if((void *)&m_stuChipParm[iScan].m_nThresMode == pValue)
+			str.Format(_T("CUTAREA_CHIPPING_THRESMODE[%d]"),iScan);
+		else if((void *)&m_stuChipParm[iScan].m_bChipping == pValue)
+			str.Format(_T("CUTAREA_USE_CHIPPING_[%d]"),iScan);
+		else if((void *)&m_stuChipParm[iScan].m_nChippingInsArea == pValue)
+			str.Format(_T("CUTAREA_CHIPPINGAREA_[%d]"),iScan);
+		else if((void *)&m_stuChipParm[iScan].m_nChippingThres_T == pValue)
+			str.Format(_T("CUTAREA_CHIPPINGTHRES_T_[%d]"),iScan);
+		else if((void *)&m_stuChipParm[iScan].m_nChippingThres_T_White == pValue)
+			str.Format(_T("CUTAREA_CHIPPINGTHRES_T_WHITE[%d]"),iScan);	
+		else if((void *)&m_stuChipParm[iScan].m_nChippingThres_B == pValue)
+			str.Format(_T("CUTAREA_CHIPPINGTHRES_B_[%d]"),iScan);
+		else if((void *)&m_stuChipParm[iScan].m_nChippingThres_T_L == pValue)
+			str.Format(_T("CUTAREA_CHIPPINGTHRES_T_L_[%d]"),iScan);
+		else if((void *)&m_stuChipParm[iScan].m_nChippingThres_B_L == pValue)
+			str.Format(_T("CUTAREA_CHIPPINGTHRES_B_L_[%d]"),iScan);		
+		else if((void *)&m_stuChipParm[iScan].m_nCrackThres == pValue)
+			str.Format(_T("CUTAREA_CRACKTHRES_[%d]"),iScan);		
+		else if((void *)&m_stuChipParm[iScan].m_nBrokenThres == pValue)
+			str.Format(_T("CUTAREA_BROKENTHRES_[%d]"),iScan);		
+		else if((void *)&m_stuChipParm[iScan].m_nChipDiffThres == pValue)
+			str.Format(_T("CUTAREA_CHIPDIFFTHRES_[%d]"),iScan);
+
+		//20140611
+		if((void *)&m_stuCutAreaAlignMark[iScan].m_bCutAreaAlignMark == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_USE_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXPos[0] == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_XPOS_TOP_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXSize[0] == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_XSIZE_TOP_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYPos[0] == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_YPOS_TOP_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYSize[0] == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_YSIZE_TOP_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXPos[1] == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_XPOS_BOT_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXSize[1] == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_XSIZE_BOT_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYPos[1] == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_YPOS_BOT_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYSize[1] == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_YSIZE_BOT_[%d]"),iScan);
+		else if((void *)&m_stuCutAreaAlignMark[iScan].m_nAlign2GlassPos == pValue)
+			str.Format(_T("CUTAREA_ALIGN_MARK_ALIGN2GLASSPOS_[%d]"),iScan);
+		//20140611
+	}
+
+	return str;
+}
+
+BOOL CCUTAREA_PARM::ReadRecipe(CConfig *pFile)
+{
+	CString			str;	
+	int				iScan,nValue;
+	int				nCount,i;
+	STU_CUTAREA_EXP_POS enExp;
+
+	for(iScan=0;iScan<MAX_DIMENSION_COUNT;iScan++)
+	{	
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_bCutArea);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_bCutArea, FALSE);		
+
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_nThresT);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_nThresT, 0);
+
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_nThresB);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_nThresB, 0);
+
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_nCalArea);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_nCalArea, 0);
+
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_nSearchWidth);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_nSearchWidth, 0);		
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_bChipping);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_bChipping, FALSE);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nThresMode);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nThresMode, 0);				
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_T_L);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_T_L, 0);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_T);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_T, 0);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_T_White);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_T_White, 255);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_B_L);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_B_L, 0);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_B);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_B, 0);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nCrackThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nCrackThres, 0);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nBrokenThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nBrokenThres, 0);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChipDiffThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChipDiffThres, 255);		
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingInsArea);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingInsArea, 0);
+
+		m_vecCutAreaExpPos[iScan].clear();
+		str.Format(_T("CUTAREA_EXPCOUNT_[%d]"),iScan);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nCount);
+		for(i=0;i<nCount;i++)
+		{
+			enExp.Reset();
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_SIDE_%d"),iScan,i);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			enExp.enSide = (DimensionDir)nValue;
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_YPOS_%d"),iScan,i);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,enExp.nPosY);
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_YSIZE_%d"),iScan,i);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,enExp.nSize);
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_XPOS_%d"),iScan,i);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,enExp.nPosX);
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_XSIZE_%d"),iScan,i);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,enExp.nSizeX);
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_TYPE_%d"),iScan,i);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+			enExp.enERType = (ExpRegionType)nValue;
+
+			m_vecCutAreaExpPos[iScan].push_back(enExp);
+		}
+
+		//20140611
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_bCutAreaAlignMark);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_bCutAreaAlignMark, FALSE);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXPos[0]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkXPos[0], 0);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXSize[0]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkXSize[0], 0);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYPos[0]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkYPos[0], 0);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYSize[0]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkYSize[0], 0);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXPos[1]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkXPos[1], 0);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXSize[1]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkXSize[1], 0);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYPos[1]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkYPos[1], 0);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYSize[1]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkYSize[1], 0);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nAlign2GlassPos);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nAlign2GlassPos, 0);
+		//20140611
+	}		
+
+	return TRUE;
+}
+BOOL CCUTAREA_PARM::WriteRecipe(CConfig *pFile)
+{
+	CString			str;	
+	int				iScan,nValue;
+	int				i;
+	STU_CUTAREA_EXP_POS enExp;
+	std::vector<STU_CUTAREA_EXP_POS>::iterator	it;
+
+	for(iScan=0;iScan<MAX_DIMENSION_COUNT;iScan++)
+	{		
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_bCutArea);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_bCutArea);		
+
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_nThresT);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_nThresT);
+
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_nThresB);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_nThresB);
+
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_nCalArea);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_nCalArea);
+
+		str = GetFileString((void *)&m_stuCutAreaParm[iScan].m_nSearchWidth);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaParm[iScan].m_nSearchWidth);			
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_bChipping);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_bChipping);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nThresMode);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nThresMode);		
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_T_L);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_T_L);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_T);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_T);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_T_White);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_T_White);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_B_L);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_B_L);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingThres_B);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingThres_B);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nCrackThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nCrackThres);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChipDiffThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChipDiffThres);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nBrokenThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nBrokenThres);
+
+		str = GetFileString((void *)&m_stuChipParm[iScan].m_nChippingInsArea);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuChipParm[iScan].m_nChippingInsArea);
+
+		str.Format(_T("CUTAREA_EXPCOUNT_[%d]"),iScan);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,(int)m_vecCutAreaExpPos[iScan].size());
+		i = 0;
+		for(it=m_vecCutAreaExpPos[iScan].begin();it!=m_vecCutAreaExpPos[iScan].end();it++,i++)
+		{
+			nValue = (int)it->enSide;
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_SIDE_%d"),iScan,i);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_YPOS_%d"),iScan,i);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,it->nPosY);
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_YSIZE_%d"),iScan,i);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,it->nSize);
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_XPOS_%d"),iScan,i);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,it->nPosX);
+
+			str.Format(_T("CUTAREA_EXPREG[%d]_XSIZE_%d"),iScan,i);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,it->nSizeX);
+
+			nValue = (int)it->enERType;
+			str.Format(_T("CUTAREA_EXPREG[%d]_TYPE_%d"),iScan,i);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);			
+		}
+
+		//20140611
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_bCutAreaAlignMark);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_bCutAreaAlignMark);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXPos[0]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkXPos[0]);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXSize[0]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkXSize[0]);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYPos[0]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkYPos[0]);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYSize[0]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkYSize[0]);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXPos[1]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkXPos[1]);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkXSize[1]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkXSize[1]);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYPos[1]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkYPos[1]);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nMarkYSize[1]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nMarkYSize[1]);
+
+		str = GetFileString((void *)&m_stuCutAreaAlignMark[iScan].m_nAlign2GlassPos);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_stuCutAreaAlignMark[iScan].m_nAlign2GlassPos);
+		//20140611
+	}		
+
+	return TRUE;
+}
+
+BOOL CCUTAREA_PARM::GetCutAreaAlignMarkUse( int iPos )//20140611
+{
+	BOOL		bUse = FALSE;
+
+	int				i;
+
+	if(iPos > DIMENSION_D_DN)
+	{
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			bUse |= m_stuCutAreaAlignMark[i].m_bCutAreaAlignMark;
+		}
+	}
+	else
+	{
+		bUse |= m_stuCutAreaAlignMark[iPos].m_bCutAreaAlignMark;
+	}
+
+	return bUse;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CCORNER_PARM
+CCORNER_PARM::CCORNER_PARM(void)
+{
+	Reset();
+}
+
+CCORNER_PARM::~CCORNER_PARM(void)
+{
+
+}
+
+CCORNER_PARM& CCORNER_PARM::operator=(CCORNER_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+
+		int			i;
+
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			m_Thres[i] = rh.m_Thres[i];
+		}
+
+		m_bUse = rh.m_bUse;
+		m_bSaveImage = rh.m_bSaveImage;		
+	}
+	return *this;
+}
+
+void CCORNER_PARM::Reset()
+{
+	ZeroMemory(m_Thres,sizeof(int)*MAX_DIMENSION_COUNT);
+	m_bSaveImage = FALSE;	 
+	m_bUse = FALSE;
+}
+
+
+CString CCORNER_PARM::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+
+	if((void *)&m_bSaveImage == pValue)
+		str.Format(_T("CORNER_INSPECTION_USE_SAVEIMAGE"));
+	else if((void *)&m_bUse == pValue)
+		str.Format(_T("CORNER_INSPECTION_USE"));	
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		if((void *)&m_Thres[i] == pValue)
+			str.Format(_T("CORNER_INSPECTION_Thres[%d]"),i);					
+
+	}
+
+	return str;
+}
+
+BOOL CCORNER_PARM::ReadRecipe(CConfig *pFile)
+{
+	CString			str;			
+
+	str = GetFileString((void *)&m_bSaveImage);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bSaveImage, FALSE);
+
+	str = GetFileString((void *)&m_bUse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bUse, FALSE);	
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_Thres[i]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_Thres[i], FALSE);	
+	}
+
+	return TRUE;
+}
+BOOL CCORNER_PARM::WriteRecipe(CConfig *pFile)
+{
+	CString			str;			
+
+	str = GetFileString((void *)&m_bSaveImage);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bSaveImage);
+
+	str = GetFileString((void *)&m_bUse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bUse);
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_Thres[i]);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_Thres[i]);	
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CDIMENSION_PARM
+CDIMENSION_PARM::CDIMENSION_PARM(void)
+{
+	Reset();
+}
+
+CDIMENSION_PARM::~CDIMENSION_PARM(void)
+{
+
+}
+
+CDIMENSION_PARM& CDIMENSION_PARM::operator=(CDIMENSION_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+
+		std::vector<STU_DI_POS>::iterator	it;
+
+		m_bSaveDimImage = rh.m_bSaveDimImage;
+
+		int			i;
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			m_DimInsParm[i] = rh.m_DimInsParm[i];			
+
+			m_vecDiPosition[i].clear();
+			for(it=rh.m_vecDiPosition[i].begin();it!=rh.m_vecDiPosition[i].end();it++)
+			{
+				m_vecDiPosition[i].push_back(*it);
+			}			
+		}
+
+	}
+	return *this;
+}
+
+void CDIMENSION_PARM::Reset()
+{
+	m_bSaveDimImage = FALSE;
+	for(int	i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		m_DimInsParm[i].Reset();
+		m_vecDiPosition[i].clear();				
+	}
+}
+
+BOOL CDIMENSION_PARM::GetDimenUse(int iPos)
+{
+	BOOL		bUse = FALSE;
+	int			i;
+
+	if(iPos > DIMENSION_D_DN)
+	{
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			bUse |= m_DimInsParm[i].m_bUsePos;
+		}
+	}
+	else
+	{
+		bUse = m_DimInsParm[iPos].m_bUsePos;
+	}
+
+	return bUse;
+}
+
+CString CDIMENSION_PARM::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+	int			i;
+
+	if((void *)&m_bSaveDimImage == pValue)
+		str.Format(_T("DIMENSION_USE_SAVE_DEBUG_IMG"));				
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		if((void *)&m_DimInsParm[i].m_bUsePos == pValue)
+			str.Format(_T("DIMENSION_USE_POS[%d]"),i);				
+		else if((void *)&m_DimInsParm[i].m_nJudgeSetSize == pValue)
+			str.Format(_T("DIMENSION_JUDGE_MIN[%d]"),i);	
+		else if((void *)&m_DimInsParm[i].m_nJudgeSizeRange == pValue)
+			str.Format(_T("DIMENSION_JUDGE_MAX[%d]"),i);		
+		else if((void *)&m_DimInsParm[i].m_nOffset == pValue)
+			str.Format(_T("DIMENSION_OFFSET[%d]"),i);
+		else if((void *)&m_DimInsParm[i].m_nDetThres == pValue)
+			str.Format(_T("DIMENSION_DETTHRES[%d]"),i);
+		else if((void *)&m_DimInsParm[i].m_nCamDir == pValue)
+			str.Format(_T("DIMENSION_DETCAMDIR[%d]"),i);	
+		else if((void *)&m_DimInsParm[i].m_enDimenType == pValue)
+			str.Format(_T("DIMENSION_FINDTYPE[%d]"),i);	
+
+	}
+
+	return str;
+}
+
+BOOL CDIMENSION_PARM::ReadRecipe(CConfig *pFile)
+{
+	CString			str;	
+	int				i,nValue;
+
+	str = GetFileString((void *)&m_bSaveDimImage);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bSaveDimImage);	
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_DimInsParm[i].m_enDimenType);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+		m_DimInsParm[i].m_enDimenType = (DIMEN_FIND_TYPE)nValue;
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_bUsePos);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_bUsePos);		
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nJudgeSetSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nJudgeSetSize);		
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nJudgeSizeRange);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nJudgeSizeRange);		
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nOffset);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nOffset);	
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nDetThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nDetThres);	
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nCamDir);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nCamDir);					
+
+		int			nCount,iLoop;
+		STU_DI_POS	stuPos;
+		str.Format(_T("DIMENSION_DETCOUNT[%d]"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nCount);		
+
+		m_vecDiPosition[i].clear();
+		for(iLoop=0;iLoop<nCount;iLoop++)
+		{
+			str.Format(_T("DIMENSION_POS[%d]_BASEX[%d]"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nBasePosX);
+
+			str.Format(_T("DIMENSION_POS[%d]_BASEY[%d]"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nBasePosY);
+
+			str.Format(_T("DIMENSION_POS[%d]_SEARCHX[%d]"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nSearchX);
+
+			str.Format(_T("DIMENSION_POS[%d]_SEARCHY[%d]"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nSearchY);
+
+			m_vecDiPosition[i].push_back(stuPos);
+		}
+	}
+
+	return TRUE;
+}
+BOOL CDIMENSION_PARM::WriteRecipe(CConfig *pFile)
+{
+	CString			str;	
+	int				i;
+	int			nCount,iLoop,nValue;
+	STU_DI_POS	stuPos;
+	std::vector<STU_DI_POS>::iterator	it;
+
+	str = GetFileString((void *)&m_bSaveDimImage);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bSaveDimImage);	
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_DimInsParm[i].m_enDimenType);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		nValue = (int)m_DimInsParm[i].m_enDimenType;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_bUsePos);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_bUsePos);		
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nJudgeSetSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nJudgeSetSize);		
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nJudgeSizeRange);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nJudgeSizeRange);		
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nOffset);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nOffset);	
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nDetThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nDetThres);	
+
+		str = GetFileString((void *)&m_DimInsParm[i].m_nCamDir);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_DimInsParm[i].m_nCamDir);	
+
+
+		str.Format(_T("DIMENSION_DETCOUNT[%d]"),i);
+		nCount = (int)m_vecDiPosition[i].size();
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nCount);		
+
+		iLoop = 0;
+		for(it=m_vecDiPosition[i].begin();it!=m_vecDiPosition[i].end();it++,iLoop++)
+		{
+			stuPos = *it;
+
+			str.Format(_T("DIMENSION_POS[%d]_BASEX[%d]"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nBasePosX);
+
+			str.Format(_T("DIMENSION_POS[%d]_BASEY[%d]"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nBasePosY);
+
+			str.Format(_T("DIMENSION_POS[%d]_SEARCHX[%d]"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nSearchX);
+
+			str.Format(_T("DIMENSION_POS[%d]_SEARCHY[%d]"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nSearchY);
+		}
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CSPLINE_PARM
+CSPLINE_PARM::CSPLINE_PARM(void)
+{
+	Reset();
+}
+
+CSPLINE_PARM::~CSPLINE_PARM(void)
+{
+
+}
+
+CSPLINE_PARM& CSPLINE_PARM::operator=(CSPLINE_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+
+		int			i;
+		std::vector<STU_SPLINE_CHIP_POS>::iterator it;
+
+		m_bSP_SaveImg = rh.m_bSP_SaveImg;
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			m_SP_InsParm[i] = rh.m_SP_InsParm[i];
+			m_SP_ChipParm[i] = rh.m_SP_ChipParm[i];
+
+			for(it=rh.m_vecSplineChip[i].begin();it!=rh.m_vecSplineChip[i].end();it++)
+			{
+				m_vecSplineChip[i].push_back(*it);
+			}
+		}		
+	}
+	return *this;
+}
+
+void CSPLINE_PARM::Reset()
+{
+	int			i;
+
+	m_bSP_SaveImg = FALSE;
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		m_SP_InsParm[i].Reset();
+		m_SP_ChipParm[i].Reset();
+		m_vecSplineChip[i].clear();
+	}	
+}
+
+BOOL CSPLINE_PARM::GetSplineChipUse(int iPos)
+{
+	BOOL		bUse = FALSE;
+	int			i;
+
+	if(iPos > DIMENSION_D_DN)
+	{
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			bUse |= m_SP_ChipParm[i].m_bSplineChip;
+		}
+	}
+	else
+	{
+		bUse = m_SP_ChipParm[iPos].m_bSplineChip;
+	}
+
+	return bUse;
+}
+
+BOOL CSPLINE_PARM::GetSplineUsePointJudge(int iPos)
+{
+	BOOL		bUse = FALSE;
+	int			i;
+
+	if(iPos <= -1)
+	{
+		for(i=0;i<MAX_SCAN_COUNT;i++)
+		{
+			bUse |= m_SP_InsParm[i].m_bSplinePointJudge;
+		}
+	}
+	else
+	{
+		bUse = m_SP_InsParm[iPos].m_bSplinePointJudge;
+	}
+
+	return bUse;
+}
+
+BOOL CSPLINE_PARM::GetSplineUse(int iPos)
+{
+	BOOL		bUse = FALSE;
+	int			i;
+
+	if(iPos > DIMENSION_D_DN)
+	{
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			bUse |= m_SP_InsParm[i].m_bSpline;
+		}
+	}
+	else
+	{
+		bUse = m_SP_InsParm[iPos].m_bSpline;
+	}
+
+	return bUse;
+}
+
+CString CSPLINE_PARM::GetFileString(void *pValue)
+{
+	CString		str = _T("");	
+	int			i;
+
+	if((void *)&m_bSP_SaveImg == pValue)
+		str.Format(_T("SPLINE_SAVEIMAGE"));	
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		if((void *)&m_SP_InsParm[i].m_bSpline == pValue)
+			str.Format(_T("SPLINE_USE_[%d]"),i);	
+		else if((void *)&m_SP_InsParm[i].m_bSplinePointJudge == pValue)
+			str.Format(_T("SPLINE_USE_POINT_JUDGE_[%d]"),i);
+		else if((void *)&m_SP_InsParm[i].m_DetMinPointDist == pValue)
+			str.Format(_T("SPLINE_DET_POINT_MINDIST_[%d]"),i);
+
+		else if((void *)&m_SP_InsParm[i].m_nStartCornerRadius_um == pValue)
+			str.Format(_T("SPLINE_START_CORNER_RADIUS_[%d]"),i);
+		else if((void *)&m_SP_InsParm[i].m_nStartCornerSize_Y == pValue)
+			str.Format(_T("SPLINE_START_CORNER_SIZE_Y_[%d]"),i);
+		else if((void *)&m_SP_InsParm[i].m_nEndCornerRadius_um == pValue)
+			str.Format(_T("SPLINE_END_CORNER_RADIUS_[%d]"),i);
+		else if((void *)&m_SP_InsParm[i].m_nEndCornerSize_Y == pValue)
+			str.Format(_T("SPLINE_END_CORNER_SIZE_Y_[%d]"),i);
+
+		else if((void *)&m_SP_InsParm[i].m_nStartChamferSize == pValue)
+			str.Format(_T("SPLINE_START_CHAMFER_SIZE_[%d]"),i);
+		else if((void *)&m_SP_InsParm[i].m_nEndChamferSize == pValue)
+			str.Format(_T("SPLINE_END_CHAMFER_SIZE_[%d]"),i);
+		else if((void *)&m_SP_InsParm[i].m_emSPType == pValue)
+			str.Format(_T("SPLINE_EM_TYPE_[%d]"),i);
+		else if((void *)&m_SP_InsParm[i].m_DetMinDist == pValue)
+			str.Format(_T("SPLINE_DET_MINDIST_[%d]"),i);		
+		else if((void *)&m_SP_InsParm[i].m_nLineThres == pValue)
+			str.Format(_T("SPLINE_LINE_THRES_[%d]"),i);	
+
+		if((void *)&m_SP_ChipParm[i].m_bSplineChip == pValue)
+			str.Format(_T("SPLINE_CHIP_USE_[%d]"),i);			
+		else if((void *)&m_SP_ChipParm[i].m_nChipSize_Y == pValue)
+			str.Format(_T("SPLINE_CHIP_SIZE_Y_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_nChipSize_X == pValue)
+			str.Format(_T("SPLINE_CHIP_SIZE_X_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_nChipInsArea == pValue)
+			str.Format(_T("SPLINE_CHIP_INSAREA_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_nChipThres == pValue)
+			str.Format(_T("SPLINE_CHIP_THRES_[%d]"),i);			
+		else if((void *)&m_SP_ChipParm[i].m_bCornerUse == pValue)
+			str.Format(_T("SPLINE_CHIP_COR_USE_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_nCornerThres == pValue)
+			str.Format(_T("SPLINE_CHIP_COR_THRES_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_nCornerRange == pValue)
+			str.Format(_T("SPLINE_CHIP_COR_RANGE_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_dChipDistTheta == pValue)
+			str.Format(_T("SPLINE_CHIP_DIST_THETA_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_dChipStartTheta == pValue)
+			str.Format(_T("SPLINE_CHIP_START_THETA_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_dChipEndTheta == pValue)
+			str.Format(_T("SPLINE_CHIP_END_THETA_[%d]"),i);	
+		else if((void *)&m_SP_ChipParm[i].m_bChipJudgeAnd == pValue)
+			str.Format(_T("SPLINE_CHIP_JUDGE_AND_[%d]"),i);	
+
+	}
+
+	return str;
+}
+
+BOOL CSPLINE_PARM::ReadRecipe(CConfig *pFile)
+{
+	CString			str;
+	int				i;
+	int			nCount,iLoop,nValue;
+	STU_SPLINE_CHIP_POS	stuPos;
+
+	str = GetFileString((void *)&m_bSP_SaveImg);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bSP_SaveImg);	
+
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_SP_InsParm[i].m_bSpline);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_bSpline);	
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_bSplinePointJudge);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_bSplinePointJudge);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_DetMinPointDist);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_DetMinPointDist);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nStartCornerSize_Y);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nStartCornerSize_Y);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nStartCornerRadius_um);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nStartCornerRadius_um);		
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nEndCornerSize_Y);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nEndCornerSize_Y);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nEndCornerRadius_um);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nEndCornerRadius_um);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nStartChamferSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nStartChamferSize, -1);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nEndChamferSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nEndChamferSize, -1);
+		
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_DetMinDist);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_DetMinDist);		
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nLineThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nLineThres);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_emSPType);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+		m_SP_InsParm[i].m_emSPType = (EM_SPLINE_TYPE)nValue;
+
+		str.Format(_T("SPLINE_CHIPCOUNT_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nCount);		
+
+		m_vecSplineChip[i].clear();
+		for(iLoop=0;iLoop<nCount;iLoop++)
+		{
+			stuPos.Reset();
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_POS_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			stuPos.emPos = (STU_SPLINE_CHIP_POS::MAKE_IMAGE_POS)nValue;
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_USE_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.bUse);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_START_X_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nStartX);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_END_X_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nEndX);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_THRES_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nThres);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_FINDTHRES_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nFindThres);		
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_METHOD_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			stuPos.emMethod = (STU_SPLINE_CHIP_POS::MAKE_IMAGE_METHOD)nValue;
+			stuPos.emMethod = STU_SPLINE_CHIP_POS::MAKE_METHOD_REGRESSION;
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_INSRANGE_%d"),i,iLoop);		
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nInsRange);		
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_SKIPDIST_%d"),i,iLoop);		
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nSkipDist);		
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_INSDIR_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			stuPos.emDir = (STU_SPLINE_CHIP_POS::SPLINE_INS_DIRECTION)nValue;
+
+			m_vecSplineChip[i].push_back(stuPos);
+		}
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_bSplineChip);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_bSplineChip);			
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nChipSize_X);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nChipSize_X);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nChipSize_Y);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nChipSize_Y);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nChipInsArea);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nChipInsArea);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nChipThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nChipThres);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_bCornerUse);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_bCornerUse);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nCornerThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nCornerThres);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nCornerRange);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nCornerRange);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_dChipStartTheta);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_dChipStartTheta);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_dChipEndTheta);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_dChipEndTheta);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_dChipDistTheta);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_dChipDistTheta);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_bChipJudgeAnd);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_bChipJudgeAnd);
+
+	}
+
+	return TRUE;
+}
+BOOL CSPLINE_PARM::WriteRecipe(CConfig *pFile)
+{
+	CString			str;
+	int				i;
+	int			nCount,iLoop,nValue;
+	STU_SPLINE_CHIP_POS	stuPos;
+
+	str = GetFileString((void *)&m_bSP_SaveImg);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bSP_SaveImg);	
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_SP_InsParm[i].m_bSpline);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_bSpline);	
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_bSplinePointJudge);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_bSplinePointJudge);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_DetMinPointDist);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_DetMinPointDist);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nStartCornerSize_Y);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nStartCornerSize_Y);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nStartCornerRadius_um);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nStartCornerRadius_um);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nEndCornerSize_Y);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nEndCornerSize_Y);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nEndCornerRadius_um);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nEndCornerRadius_um);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nStartChamferSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nStartChamferSize);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nEndChamferSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nEndChamferSize);
+
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_DetMinDist);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_DetMinDist);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_nLineThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_InsParm[i].m_nLineThres);
+
+		str = GetFileString((void *)&m_SP_InsParm[i].m_emSPType);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		nValue = (int)m_SP_InsParm[i].m_emSPType;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+
+
+		str.Format(_T("SPLINE_CHIPCOUNT_%d"),i);
+		nCount = (int)m_vecSplineChip[i].size();
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nCount);		
+
+		for(iLoop=0;iLoop<nCount;iLoop++)
+		{
+			stuPos = m_vecSplineChip[i][iLoop];
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_POS_%d"),i,iLoop);
+			nValue = (int)stuPos.emPos;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_USE_%d"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.bUse);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_START_X_%d"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nStartX);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_END_X_%d"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nEndX);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_THRES_%d"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nThres);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_FINDTHRES_%d"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nFindThres);		
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_METHOD_%d"),i,iLoop);
+			nValue = (int)stuPos.emMethod;
+			nValue = STU_SPLINE_CHIP_POS::MAKE_METHOD_REGRESSION;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_INSDIR_%d"),i,iLoop);
+			nValue = (int)stuPos.emDir;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_INSRANGE_%d"),i,iLoop);		
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nInsRange);	
+
+			str.Format(_T("SPLINE_CHIPPOS[%d]_SKIPDIST_%d"),i,iLoop);		
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nSkipDist);		
+		}
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_bSplineChip);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_bSplineChip);			
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nChipSize_X);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nChipSize_X);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nChipSize_Y);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nChipSize_Y);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nChipInsArea);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nChipInsArea);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nChipThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nChipThres);		
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_bCornerUse);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_bCornerUse);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nCornerThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nCornerThres);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_nCornerRange);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_nCornerRange);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_dChipStartTheta);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_dChipStartTheta);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_dChipEndTheta);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_dChipEndTheta);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_dChipDistTheta);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_dChipDistTheta);
+
+		str = GetFileString((void *)&m_SP_ChipParm[i].m_bChipJudgeAnd);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_SP_ChipParm[i].m_bChipJudgeAnd);
+
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CVCR_PARM
+CVCR_PARM::CVCR_PARM(void)
+{
+	Reset();
+}
+
+CVCR_PARM::~CVCR_PARM(void)
+{
+
+}
+
+CVCR_PARM& CVCR_PARM::operator=(CVCR_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+		m_bVCR = rh.m_bVCR;		
+		m_bAlarm	= rh.m_bAlarm;	
+		m_bSetResult= rh.m_bSetResult;
+		m_nVCPosY= rh.m_nVCPosY;
+		m_nVCPosX= rh.m_nVCPosX;
+		m_nHeight	= rh.m_nHeight;
+		m_nWidth	= rh.m_nWidth;	
+		m_nCamDir	= rh.m_nCamDir;
+	}
+	return *this;
+}
+
+void CVCR_PARM::Reset()
+{
+	m_bVCR = FALSE;
+	m_bAlarm		= FALSE;
+	m_bSetResult	= FALSE;
+	m_nVCPosY		= 0;
+	m_nVCPosX		= 0;
+	m_nHeight		= 0;
+	m_nWidth		= 0;
+	m_nCamDir		= 0;
+
+}
+
+CRect CVCR_PARM::GetRect()
+{
+	CRect rect = CRect(m_nVCPosX,m_nVCPosY,m_nVCPosX,m_nVCPosY);
+	rect.InflateRect(m_nWidth,m_nHeight);
+
+	return rect;
+}
+
+CString CVCR_PARM::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+
+	if((void *)&m_bVCR == pValue)				str.Format(_T("VCR_USE"));
+	else if((void *)&m_bAlarm == pValue)		str.Format(_T("VCR_ALARM"));
+	else if((void *)&m_bSetResult == pValue)	str.Format(_T("VCR_SETRESULT"));
+	else if((void *)&m_nVCPosX == pValue)		str.Format(_T("VCR_POS_X"));
+	else if((void *)&m_nVCPosY == pValue)		str.Format(_T("VCR_POS_Y"));
+	else if((void *)&m_nHeight == pValue)		str.Format(_T("VCR_HEIGHT"));
+	else if((void *)&m_nWidth == pValue)		str.Format(_T("VCR_WIDTH"));
+	else if((void *)&m_nCamDir == pValue)		str.Format(_T("VCR_CAMDIR"));
+
+	return str;
+}
+
+BOOL CVCR_PARM::ReadRecipe(CConfig *pFile)
+{
+	CString			str;	
+
+	str = GetFileString((void *)&m_bVCR);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bVCR);	
+
+	str = GetFileString((void *)&m_bAlarm);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bAlarm);	
+
+	str = GetFileString((void *)&m_bSetResult);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bSetResult);	
+
+	str = GetFileString((void *)&m_nVCPosX);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nVCPosX);	
+
+	str = GetFileString((void *)&m_nVCPosY);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nVCPosY);	
+
+	str = GetFileString((void *)&m_nHeight);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nHeight);	
+
+	str = GetFileString((void *)&m_nWidth);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nWidth);	
+
+	str = GetFileString((void *)&m_nCamDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nCamDir);		
+
+	return TRUE;
+}
+BOOL CVCR_PARM::WriteRecipe(CConfig *pFile)
+{
+	CString			str;	
+
+	str = GetFileString((void *)&m_bVCR);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bVCR);
+
+	str = GetFileString((void *)&m_bAlarm);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bAlarm);	
+
+	str = GetFileString((void *)&m_bSetResult);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bSetResult);	
+
+	str = GetFileString((void *)&m_nVCPosX);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nVCPosX);	
+
+	str = GetFileString((void *)&m_nVCPosY);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nVCPosY);	
+
+	str = GetFileString((void *)&m_nHeight);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nHeight);	
+
+	str = GetFileString((void *)&m_nWidth);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nWidth);	
+
+	str = GetFileString((void *)&m_nCamDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nCamDir);	
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CLIGHT_PARM
+CLIGHT_PARM::CLIGHT_PARM(void)
+{
+	Reset();
+}
+
+CLIGHT_PARM::~CLIGHT_PARM(void)
+{
+
+}
+
+CLIGHT_PARM& CLIGHT_PARM::operator=(CLIGHT_PARM& rh)
+{
+	if(this != &rh)
+	{
+		m_bLightControl = rh.m_bLightControl;
+		CopyMemory(m_nContValue,rh.m_nContValue,sizeof(int)*LIGHT_CONTROL_COUNT*LIGHT_CONTROL_CH_COUNT);		
+	}
+	return *this;
+}
+
+void CLIGHT_PARM::Reset()
+{
+	m_bLightControl = FALSE;
+	ZeroMemory(m_nContValue,sizeof(int)*LIGHT_CONTROL_COUNT*LIGHT_CONTROL_CH_COUNT);
+}
+
+CString CLIGHT_PARM::GetFileString(void *pValue)
+{
+	CString		str = _T("");	
+	int			i,j;
+
+	if((void *)&m_bLightControl == pValue)
+		str.Format(_T("LIGHT_CONT_USE"));
+	else
+		for(i=0;i<LIGHT_CONTROL_COUNT;i++)
+		{
+			for(j=0;j<LIGHT_CONTROL_CH_COUNT;j++)
+			{				
+				if((void *)&m_nContValue[i][j] == pValue)
+					str.Format(_T("LIGHT_CONT_VALUE_R_%d_%d"),i,j);			
+			}
+		}	
+
+		return str;
+}
+
+BOOL CLIGHT_PARM::ReadRecipe(CConfig *pFile)
+{
+	CString			str;	
+	int				i,j;
+
+	str = GetFileString((void *)&m_bLightControl);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bLightControl);
+
+	for(i=0;i<LIGHT_CONTROL_COUNT;i++)
+	{
+		for(j=0;j<LIGHT_CONTROL_CH_COUNT;j++)
+		{				
+			str = GetFileString((void *)&m_nContValue[i][j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nContValue[i][j]);
+		}		
+	}
+
+	return TRUE;
+}
+BOOL CLIGHT_PARM::WriteRecipe(CConfig *pFile)
+{
+	CString			str;	
+	int				i,j;
+
+	str = GetFileString((void *)&m_bLightControl);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bLightControl);
+
+	for(i=0;i<LIGHT_CONTROL_COUNT;i++)
+	{
+		for(j=0;j<LIGHT_CONTROL_CH_COUNT;j++)
+		{				
+			str = GetFileString((void *)&m_nContValue[i][j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nContValue[i][j]);
+		}	
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CETC_PARM
+CETC_PARM::CETC_PARM(void)
+{
+	Reset();
+}
+
+CETC_PARM::~CETC_PARM(void)
+{
+
+}
+
+CETC_PARM& CETC_PARM::operator=(CETC_PARM& rh)
+{
+	if(this != &rh)
+	{
+		m_nGlassFindthres_Top = rh.m_nGlassFindthres_Top;
+		m_nGlassFindHeight_Top = rh.m_nGlassFindHeight_Top;
+		m_nGlassFindthres_Left = rh.m_nGlassFindthres_Left;
+		m_nGlassLeftLineMargin[0] = rh.m_nGlassLeftLineMargin[0];
+		m_nGlassLeftLineMargin[1] = rh.m_nGlassLeftLineMargin[1];
+		m_nGlassFindWidth_Left = rh.m_nGlassFindWidth_Left;				
+	}
+	return *this;
+}
+
+void CETC_PARM::Reset()
+{
+	m_nGlassFindthres_Top = 0;
+	m_nGlassFindHeight_Top = 0;
+	m_nGlassFindthres_Left = 0;
+	m_nGlassLeftLineMargin[0] = m_nGlassLeftLineMargin[1] = 0;
+	m_nGlassFindWidth_Left = 0;		
+}
+
+CString CETC_PARM::GetFileString(void *pValue,int nIdx)
+{
+	CString		str = _T("");	
+
+	if((void *)&m_nGlassFindthres_Top == pValue)
+		str.Format(_T("ETC_GLASSFINDTHRES_TOP_%d"),nIdx);
+	else if((void *)&m_nGlassFindHeight_Top == pValue)
+		str.Format(_T("ETC_GLASSFINDHEIGHT_TOP_%d"),nIdx);
+	else if((void *)&m_nGlassFindthres_Left == pValue)
+		str.Format(_T("ETC_GLASSFINDTHRES_LEFT_%d"),nIdx);
+	else if((void *)&m_nGlassFindWidth_Left == pValue)
+		str.Format(_T("ETC_GLASSFINDWIDTH_LEFT_%d"),nIdx);
+	else
+	{		
+		for(int i=0;i<2;i++)
+		{
+			if((void *)&m_nGlassLeftLineMargin[i] == pValue)
+				str.Format(_T("ETC_GLASSFINDLEFT_LINEMARGIN_%d_%d"),nIdx,i);
+		}
+	}
+
+	return str;
+}
+
+BOOL CETC_PARM::ReadRecipe(CConfig *pFile,int nIdx)
+{
+	CString			str;		
+
+	str = GetFileString((void *)&m_nGlassFindthres_Top,nIdx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindthres_Top);
+
+	str = GetFileString((void *)&m_nGlassFindHeight_Top,nIdx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindHeight_Top);
+
+	str = GetFileString((void *)&m_nGlassFindthres_Left,nIdx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindthres_Left);
+
+	for (int i=0; i<2; i++)
+	{
+		str = GetFileString((void *)&m_nGlassLeftLineMargin[i],nIdx);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassLeftLineMargin[i]);
+	}	
+
+	str = GetFileString((void *)&m_nGlassFindWidth_Left,nIdx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindWidth_Left);	
+
+	return TRUE;
+}
+BOOL CETC_PARM::WriteRecipe(CConfig *pFile,int nIdx)
+{
+	CString			str;		
+
+	str = GetFileString((void *)&m_nGlassFindthres_Top,nIdx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindthres_Top);
+
+	str = GetFileString((void *)&m_nGlassFindHeight_Top,nIdx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindHeight_Top);
+
+	str = GetFileString((void *)&m_nGlassFindthres_Left,nIdx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindthres_Left);
+
+	for (int i=0; i<2; i++)
+	{
+		str = GetFileString((void *)&m_nGlassLeftLineMargin[i],nIdx);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassLeftLineMargin[i]);
+	}
+
+	str = GetFileString((void *)&m_nGlassFindWidth_Left,nIdx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGlassFindWidth_Left);
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CNOTCH_PARM
+CNOTCH_PARM::CNOTCH_PARM(void)
+{
+	Reset();
+}
+
+CNOTCH_PARM::~CNOTCH_PARM(void)
+{
+
+}
+
+CNOTCH_PARM& CNOTCH_PARM::operator=(CNOTCH_PARM& rh)
+{
+	if(this != &rh)
+	{
+		int			i;
+
+		std::vector<CPoint>::iterator	it;//20140528
+
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			m_NotchParm[i] = rh.m_NotchParm[i];
+
+			m_vecNotchPosition[i].clear();//20140528
+			for(it=rh.m_vecNotchPosition[i].begin();it!=rh.m_vecNotchPosition[i].end();it++)//20140528
+			{
+				m_vecNotchPosition[i].push_back(*it);
+			}
+		}	
+	}
+	return *this;
+}
+
+void CNOTCH_PARM::Reset()
+{
+	int			i;
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		m_NotchParm[i].Reset();
+		m_vecNotchPosition[i].clear();	//20140528
+	}
+}
+
+CString CNOTCH_PARM::GetFileString(void *pValue)
+{
+	CString		str = _T("");	
+	int			i;
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		if((void *)&m_NotchParm[i].bChipIns == pValue)
+			str.Format(_T("NOTCH_USE_CHIPINS_[%d]"),i);
+		else if((void *)&m_NotchParm[i].bSizeIns == pValue)
+			str.Format(_T("NOTCH_USE_SIZEINS_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nChipDiff == pValue)
+			str.Format(_T("NOTCH_CHIPDIFF_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nSizeDiff == pValue)
+			str.Format(_T("NOTCH_SIZEDIFF_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nDetThres == pValue)
+			str.Format(_T("NOTCH_DETTHRES_[%d]"),i);
+		else if((void *)&m_NotchParm[i].dBlank2EdgeRatio == pValue)
+			str.Format(_T("NOTCH_BLANK2EDGERATIO_[%d]"),i);		
+		else if((void *)&m_NotchParm[i].nSizeThres == pValue)
+			str.Format(_T("NOTCH_SIZETHRES_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nChipThres == pValue)
+			str.Format(_T("NOTCH_CHIPTHRES_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nVStart == pValue)
+			str.Format(_T("NOTCH_VSTART_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nVSize == pValue)
+			str.Format(_T("NOTCH_VSIZE_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nSkipSize == pValue)
+			str.Format(_T("NOTCH_SKIPSIZE_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nAlign2GlassPos == pValue)
+			str.Format(_T("NOTCH_ALIGN2GLASSPOS_[%d]"),i);		
+		else if((void *)&m_NotchParm[i].nJudgeBaseWidth == pValue)
+			str.Format(_T("NOTCH_CUTAREA_JUDGE_BASEWIDTH_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nJudgeDiffWidth == pValue)
+			str.Format(_T("NOTCH_CUTAREA_JUDGE_DIFFWIDTH_[%d]"),i);	
+		else if((void *)&m_NotchParm[i].bPointInsDimensionJudge == pValue)//20140721
+			str.Format(_T("NOTCH_USE_POINT_INS_DIMENSION_JUDGE_[%d]"),i);
+		else if((void *)&m_NotchParm[i].bPointInsChamferJudge == pValue)//20140721
+			str.Format(_T("NOTCH_USE_POINT_INS_CHAMFER_JUDGE_[%d]"),i);
+		else if((void *)&m_NotchParm[i].nPointInsAveCount == pValue)//20140528
+			str.Format(_T("NOTCH_USE_POINT_INS_AVE_COUNT_[%d]"),i);
+
+		for(int j=0;j<2;j++)
+		{
+			if((void *)&m_NotchParm[i].nMarkXPos[j] == pValue)
+				str.Format(_T("NOTCH_MARK_XPOS_[%d][%d]"),i,j);
+			else if((void *)&m_NotchParm[i].nMarkXSize[j] == pValue)
+				str.Format(_T("NOTCH_MARK_XSIZE_[%d][%d]"),i,j);
+			else if((void *)&m_NotchParm[i].nMarkYPos[j] == pValue)
+				str.Format(_T("NOTCH_MARK_YPOS_[%d][%d]"),i,j);
+			else if((void *)&m_NotchParm[i].nMarkYSize[j] == pValue)
+				str.Format(_T("NOTCH_MARK_YSIZE_[%d][%d]"),i,j);
+			else if((void *)&m_NotchParm[i].bSpChipIns[j] == pValue)
+				str.Format(_T("NOTCH_USE_SPCHIP_[%d][%d]"),i,j);
+			else if((void *)&m_NotchParm[i].nSpChipSize[j] == pValue)
+				str.Format(_T("NOTCH_SPCHIPINSSIZE_[%d][%d]"),i,j);
+		}		
+	}	
+
+	return str;
+}
+
+BOOL CNOTCH_PARM::ReadRecipe(CConfig *pFile)
+{
+	CString			str;		
+	int			i;
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_NotchParm[i].bChipIns);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bChipIns);
+
+		str = GetFileString((void *)&m_NotchParm[i].bSizeIns);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bSizeIns);
+
+		str = GetFileString((void *)&m_NotchParm[i].nChipDiff);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nChipDiff);
+
+		str = GetFileString((void *)&m_NotchParm[i].nSizeDiff);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nSizeDiff);
+
+		str = GetFileString((void *)&m_NotchParm[i].nDetThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nDetThres);
+
+		str = GetFileString((void *)&m_NotchParm[i].dBlank2EdgeRatio);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].dBlank2EdgeRatio);
+
+		str = GetFileString((void *)&m_NotchParm[i].nSizeThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nSizeThres);
+
+		str = GetFileString((void *)&m_NotchParm[i].nChipThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nChipThres);
+
+		str = GetFileString((void *)&m_NotchParm[i].nVStart);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nVStart);
+
+		str = GetFileString((void *)&m_NotchParm[i].nVSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nVSize);
+
+		str = GetFileString((void *)&m_NotchParm[i].nAlign2GlassPos);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nAlign2GlassPos);		
+
+		str = GetFileString((void *)&m_NotchParm[i].nJudgeBaseWidth);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nJudgeBaseWidth);
+
+		str = GetFileString((void *)&m_NotchParm[i].nJudgeDiffWidth);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nJudgeDiffWidth);
+
+		str = GetFileString((void *)&m_NotchParm[i].nSkipSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nSkipSize);
+
+		str = GetFileString((void *)&m_NotchParm[i].bPointInsDimensionJudge);//20140721
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bPointInsDimensionJudge);
+
+		str = GetFileString((void *)&m_NotchParm[i].bPointInsChamferJudge);//20140721
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bPointInsChamferJudge);
+
+		str = GetFileString((void *)&m_NotchParm[i].nPointInsAveCount);//20140528
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nPointInsAveCount);
+
+		for(int j=0;j<2;j++)
+		{
+			str = GetFileString((void *)&m_NotchParm[i].nMarkXPos[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nMarkXPos[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].nMarkXSize[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nMarkXSize[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].nMarkYPos[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nMarkYPos[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].nMarkYSize[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nMarkYSize[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].bSpChipIns[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bSpChipIns[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].nSpChipSize[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nSpChipSize[j]);
+		}	
+
+		int			nCount,iLoop;//20140528
+		CPoint	stuPos;//20140528
+		str.Format(_T("NOTCH_DETCOUNT[%d]"),i);//20140528
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nCount);//20140528		
+
+		int			nValue;
+		m_vecNotchPosition[i].clear();//20140528
+		for(iLoop=0;iLoop<nCount;iLoop++)//20140528
+		{
+			str.Format(_T("NOTCH_POS[%d]_X[%d]"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			stuPos.x = nValue;
+
+			str.Format(_T("NOTCH_POS[%d]_Y[%d]"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			stuPos.y = nValue;
+
+			m_vecNotchPosition[i].push_back(stuPos);
+		}
+
+		std::sort(m_vecNotchPosition[i].begin(),m_vecNotchPosition[i].end(),SortCPointYPos());//20140528
+
+	}
+
+	return TRUE;
+}
+
+BOOL CNOTCH_PARM::WriteRecipe(CConfig *pFile)
+{
+	CString			str;		
+	int			i;
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str = GetFileString((void *)&m_NotchParm[i].bChipIns);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bChipIns);
+
+		str = GetFileString((void *)&m_NotchParm[i].bSizeIns);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bSizeIns);
+
+		str = GetFileString((void *)&m_NotchParm[i].nChipDiff);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nChipDiff);
+
+		str = GetFileString((void *)&m_NotchParm[i].nSizeDiff);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nSizeDiff);
+
+		str = GetFileString((void *)&m_NotchParm[i].nDetThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nDetThres);
+
+		str = GetFileString((void *)&m_NotchParm[i].nSizeThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nSizeThres);
+
+		str = GetFileString((void *)&m_NotchParm[i].nChipThres);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nChipThres);
+
+		str = GetFileString((void *)&m_NotchParm[i].dBlank2EdgeRatio);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].dBlank2EdgeRatio);		
+
+		str = GetFileString((void *)&m_NotchParm[i].nVStart);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nVStart);
+
+		str = GetFileString((void *)&m_NotchParm[i].nVSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nVSize);
+
+		str = GetFileString((void *)&m_NotchParm[i].nAlign2GlassPos);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nAlign2GlassPos);
+
+		str = GetFileString((void *)&m_NotchParm[i].nJudgeBaseWidth);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nJudgeBaseWidth);
+
+		str = GetFileString((void *)&m_NotchParm[i].nJudgeDiffWidth);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nJudgeDiffWidth);
+
+		str = GetFileString((void *)&m_NotchParm[i].nSkipSize);
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nSkipSize);
+
+		str = GetFileString((void *)&m_NotchParm[i].bPointInsDimensionJudge);//20140721
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bPointInsDimensionJudge);
+
+		str = GetFileString((void *)&m_NotchParm[i].bPointInsChamferJudge);//20140721
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bPointInsChamferJudge);
+
+		str = GetFileString((void *)&m_NotchParm[i].nPointInsAveCount);//20140528
+		if(str.IsEmpty() == TRUE)
+			return FALSE;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nPointInsAveCount);
+
+		for(int j=0;j<2;j++)
+		{
+			str = GetFileString((void *)&m_NotchParm[i].nMarkXPos[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nMarkXPos[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].nMarkXSize[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nMarkXSize[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].nMarkYPos[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nMarkYPos[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].nMarkYSize[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nMarkYSize[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].bSpChipIns[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].bSpChipIns[j]);
+
+			str = GetFileString((void *)&m_NotchParm[i].nSpChipSize[j]);
+			if(str.IsEmpty() == TRUE)
+				return FALSE;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_NotchParm[i].nSpChipSize[j]);
+		}	
+
+		int nCount;//20140528
+		str.Format(_T("NOTCH_DETCOUNT[%d]"),i);//20140528
+		nCount = (int)m_vecNotchPosition[i].size();//20140528
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nCount);//20140528		
+
+		int iLoop = 0;//20140528
+		CPoint	stuPos;//20140528
+		std::vector<CPoint>::iterator	it;//20140528
+
+		for(it=m_vecNotchPosition[i].begin();it!=m_vecNotchPosition[i].end();it++,iLoop++)//20140528
+		{
+			stuPos = *it;
+
+			str.Format(_T("NOTCH_POS[%d]_X[%d]"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.x);
+
+			str.Format(_T("NOTCH_POS[%d]_Y[%d]"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.y);			
+		}
+	}
+
+	return TRUE;
+}
+
+BOOL CNOTCH_PARM::GetNotchSizeUse(int iPos)
+{
+	BOOL		bUse = FALSE;
+	int			i;
+
+	if(iPos > DIMENSION_D_DN)
+	{
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			bUse |= m_NotchParm[i].bSizeIns;
+		}
+	}
+	else
+	{
+		bUse = m_NotchParm[iPos].bSizeIns;
+	}
+
+	return bUse;
+}
+
+BOOL CNOTCH_PARM::GetNotchChipUse(int iPos)
+{
+	BOOL		bUse = FALSE;
+	int			i;
+
+	if(iPos > DIMENSION_D_DN)
+	{
+		for(i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			bUse |= m_NotchParm[i].bChipIns;
+		}
+	}
+	else
+	{
+		bUse = m_NotchParm[iPos].bChipIns;
+	}
+
+	return bUse;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CINSPECT_JUDGEMENT_PARM
+CINSPECT_JUDGEMENT_PARM::CINSPECT_JUDGEMENT_PARM(void)
+{
+	Reset();
+}
+
+CINSPECT_JUDGEMENT_PARM::~CINSPECT_JUDGEMENT_PARM(void)
+{
+}
+
+CINSPECT_JUDGEMENT_PARM& CINSPECT_JUDGEMENT_PARM::operator=(CINSPECT_JUDGEMENT_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();	
+
+		CopyMemory(corner_X,rh.corner_X,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE);
+		CopyMemory(corner_Y,rh.corner_Y,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE);
+		CopyMemory(grind,rh.grind,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE*2);
+		CopyMemory(chamfer,rh.chamfer,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE*2);
+		CopyMemory(cutting,rh.cutting,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE*2);
+		CopyMemory(ptAlign,rh.ptAlign,sizeof(CPoint)*MAX_DIMENSION_COUNT*MAX_MARKER_COUNT);
+		CopyMemory(nCFGrind,rh.nCFGrind,sizeof(int)*MAX_PANEL_SIDE);
+		CopyMemory(EdgeToSubMark,rh.EdgeToSubMark,sizeof(JUDGE_EDGE)*MAX_DIMENSION_COUNT);
+		CopyMemory(defect,rh.defect,sizeof(JUDGE_DEFECT)*MAX_DIMENSION_COUNT*3);
+		CopyMemory(Dimension,rh.Dimension,sizeof(JUDGE_EDGE)*MAX_DIMENSION_COUNT);
+		nCornerJugeLength = rh.nCornerJugeLength;
+		nCornerJugeDepth = rh.nCornerJugeDepth;
+		bUseLengthDepthComp = rh.bUseLengthDepthComp;
+		CopyMemory(AvgProfile,rh.AvgProfile,sizeof(JUDGE_AVG)*MAX_DIMENSION_COUNT);
+		CopyMemory(AvgChamfer,rh.AvgChamfer,sizeof(JUDGE_AVG)*MAX_DIMENSION_COUNT);
+
+		CopyMemory(nMinProfileNgCount,rh.nMinProfileNgCount,sizeof(nMinProfileNgCount));
+		CopyMemory(nMinProfileNgCount_MinDiff,rh.nMinProfileNgCount_MinDiff,sizeof(nMinProfileNgCount_MinDiff));
+	}
+	return *this;
+}
+
+void CINSPECT_JUDGEMENT_PARM::Reset()
+{	
+	ZeroMemory(corner_X,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE);
+	ZeroMemory(corner_Y,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE);
+	ZeroMemory(grind,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE*2);
+	ZeroMemory(chamfer,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE*2);
+	ZeroMemory(cutting,sizeof(JUDGE_EDGE)*MAX_PANEL_SIDE*2);
+	ZeroMemory(ptAlign,sizeof(CPoint)*MAX_DIMENSION_COUNT*MAX_MARKER_COUNT);
+	ZeroMemory(nCFGrind,sizeof(int)*MAX_PANEL_SIDE);
+	ZeroMemory(EdgeToSubMark,sizeof(JUDGE_EDGE)*MAX_DIMENSION_COUNT);
+	ZeroMemory(defect,sizeof(JUDGE_DEFECT)*MAX_DIMENSION_COUNT*3);
+	ZeroMemory(Dimension,sizeof(JUDGE_EDGE)*MAX_DIMENSION_COUNT);
+	nCornerJugeLength = nCornerJugeDepth = 0;
+	bUseLengthDepthComp = FALSE;
+	ZeroMemory(AvgProfile,sizeof(JUDGE_AVG)*MAX_DIMENSION_COUNT);
+	ZeroMemory(AvgChamfer,sizeof(JUDGE_AVG)*MAX_DIMENSION_COUNT);
+	ZeroMemory(nMinProfileNgCount,sizeof(nMinProfileNgCount));
+	ZeroMemory(nMinProfileNgCount_MinDiff,sizeof(nMinProfileNgCount_MinDiff));
+}
+
+BOOL CINSPECT_JUDGEMENT_PARM::ReadRecipe(CConfig *pFile)
+{
+	int		i,j;
+	CString	str;
+	int		nValue;
+
+	str.Format(_T("JUDGEMENT_CORNER_LENGTHDEPTH_USE"));
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,bUseLengthDepthComp);
+	str.Format(_T("JUDGEMENT_CORNER_LENGTH"));
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nCornerJugeLength);
+	str.Format(_T("JUDGEMENT_CORNER_DEPTH"));
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nCornerJugeDepth);
+
+	for(i=0;i<MAX_PANEL_SIDE;i++)
+	{
+		str.Format(_T("JUDGEMENT_CORNER_X_USE_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,corner_X[i].bError);
+		str.Format(_T("JUDGEMENT_CORNER_X_REFER_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,corner_X[i].nRefernce);
+		str.Format(_T("JUDGEMENT_CORNER_X_PLUS_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,corner_X[i].nTolPlus);
+		str.Format(_T("JUDGEMENT_CORNER_X_MINUS_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,corner_X[i].nTolMinus);
+
+		str.Format(_T("JUDGEMENT_CORNER_Y_USE_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,corner_Y[i].bError);
+		str.Format(_T("JUDGEMENT_CORNER_Y_REFER_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,corner_Y[i].nRefernce);
+		str.Format(_T("JUDGEMENT_CORNER_Y_PLUS_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,corner_Y[i].nTolPlus);
+		str.Format(_T("JUDGEMENT_CORNER_Y_MINUS_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,corner_Y[i].nTolMinus);
+
+		for(j=0;j<2;j++)
+		{
+			str.Format(_T("JUDGEMENT_GRIND_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,grind[j][i].bError);
+			str.Format(_T("JUDGEMENT_GRIND_REFER_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,grind[j][i].nRefernce);
+			str.Format(_T("JUDGEMENT_GRIND_PLUS_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,grind[j][i].nTolPlus);
+			str.Format(_T("JUDGEMENT_GRIND_MINUS_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,grind[j][i].nTolMinus);
+
+			str.Format(_T("JUDGEMENT_CHAMFER_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,chamfer[j][i].bError);
+			str.Format(_T("JUDGEMENT_CHAMFER_REFER_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,chamfer[j][i].nRefernce);
+			str.Format(_T("JUDGEMENT_CHAMFER_PLUS_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,chamfer[j][i].nTolPlus);
+			str.Format(_T("JUDGEMENT_CHAMFER_MINUS_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,chamfer[j][i].nTolMinus);
+
+			str.Format(_T("JUDGEMENT_CUTTING_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,cutting[j][i].bError);
+			str.Format(_T("JUDGEMENT_CUTTING_REFER_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,cutting[j][i].nRefernce);
+			str.Format(_T("JUDGEMENT_CUTTING_PLUS_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,cutting[j][i].nTolPlus);
+			str.Format(_T("JUDGEMENT_CUTTING_MINUS_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,cutting[j][i].nTolMinus);	
+		}
+
+		str.Format(_T("JUDGEMENT_CFGRIND%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nCFGrind[i]);		
+	}
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str.Format(_T("JUDGEMENT_AVG_PROFILE_USE_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,AvgProfile[i].bUse);
+		str.Format(_T("JUDGEMENT_AVG_PROFILE_DIFF_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,AvgProfile[i].nDiff);
+		str.Format(_T("JUDGEMENT_AVG_CHAMFER_USE_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,AvgChamfer[i].bUse);
+		str.Format(_T("JUDGEMENT_AVG_CHAMFER_DIFF_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,AvgChamfer[i].nDiff);
+
+		str.Format(_T("JUDGEMENT_MIN_PROFILE_NG_COUNT_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nMinProfileNgCount[i], 0);
+		str.Format(_T("JUDGEMENT_DIFF_PROFILE_NG_COUNT_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nMinProfileNgCount_MinDiff[i], 0);
+		
+		str.Format(_T("JUDGEMENT_SUBMARK_USE_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,EdgeToSubMark[i].bError);
+		str.Format(_T("JUDGEMENT_SUBMARK_REFER_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,EdgeToSubMark[i].nRefernce);
+		str.Format(_T("JUDGEMENT_SUBMARK_PLUS_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,EdgeToSubMark[i].nTolPlus);
+		str.Format(_T("JUDGEMENT_SUBMARK_MINUS_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,EdgeToSubMark[i].nTolMinus);	
+
+		str.Format(_T("DIMENSION_SUBMARK_USE_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,Dimension[i].bError);
+		str.Format(_T("DIMENSION_SUBMARK_REFER_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,Dimension[i].nRefernce);
+		str.Format(_T("DIMENSION_SUBMARK_PLUS_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,Dimension[i].nTolPlus);
+		str.Format(_T("DIMENSION_SUBMARK_MINUS_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,Dimension[i].nTolMinus);		
+
+		for(j=0;j<MAX_MARKER_COUNT;j++)
+		{
+			str.Format(_T("ALIGNPOSITION_X_%d_%d"),i,j);			
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			ptAlign[j][i].x = nValue;
+			str.Format(_T("ALIGNPOSITION_Y_%d_%d"),i,j);			
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			ptAlign[j][i].y = nValue;
+		}
+
+		for(j=0;j<3;j++)
+		{
+			str.Format(_T("JUDGEMENT_DEFECT_RNG_START_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].nRangeStart);
+			str.Format(_T("JUDGEMENT_DEFECT_RNG_END_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].nRangeEnd);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_AND_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_Side.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_Side.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_MERGE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_Side.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_SIZE_CX_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Chip_Side.szDefect.cx = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_SIZE_CY_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Chip_Side.szDefect.cy = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_AND_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_Side.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_Side.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_MERGE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_Side.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_SIZE_CX_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Burr_Side.szDefect.cx = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_SIZE_CY_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Burr_Side.szDefect.cy = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_AND_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Broken.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Broken.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_MERGE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Broken.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_SIZE_CX_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Broken.szDefect.cx = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_SIZE_CY_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Broken.szDefect.cy = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_AND_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Bevel.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Bevel.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_MERGE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Bevel.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_SIZE_CX_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Bevel.szDefect.cx = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_SIZE_CY_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Bevel.szDefect.cy = nValue;
+
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_AND_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_CF.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_CF.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_MERGE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_CF.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_SIZE_CX_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Chip_CF.szDefect.cx = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_SIZE_CY_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Chip_CF.szDefect.cy = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFAND_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_CF.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFUSE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_CF.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFMERGE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_CF.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFSIZE_CX_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Burr_CF.szDefect.cx = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFSIZE_CY_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Burr_CF.szDefect.cy = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKAND_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Crack.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKUSE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Crack.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKMERGE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Crack.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKSIZE_CX_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Crack.szDefect.cx = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKSIZE_CY_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Crack.szDefect.cy = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_AND_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Compare_Panel.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_USE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Compare_Panel.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_MERGE_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Compare_Panel.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_SIZE_CX_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Compare_Panel.szDefect.cx = nValue;
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_SIZE_CY_%d_%d"),i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			defect[i][j].Compare_Panel.szDefect.cy = nValue;			
+		}
+	}
+	return TRUE;
+}
+
+BOOL CINSPECT_JUDGEMENT_PARM::WriteRecipe(CConfig *pFile)
+{
+	int		i,j;
+	CString	str;
+	int		nValue;
+
+	str.Format(_T("JUDGEMENT_CORNER_LENGTHDEPTH_USE"));
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,bUseLengthDepthComp);
+	str.Format(_T("JUDGEMENT_CORNER_LENGTH"));
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nCornerJugeLength);
+	str.Format(_T("JUDGEMENT_CORNER_DEPTH"));
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nCornerJugeDepth);
+
+	for(i=0;i<MAX_PANEL_SIDE;i++)
+	{
+		str.Format(_T("JUDGEMENT_CORNER_X_USE_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,corner_X[i].bError);
+		str.Format(_T("JUDGEMENT_CORNER_X_REFER_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,corner_X[i].nRefernce);
+		str.Format(_T("JUDGEMENT_CORNER_X_PLUS_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,corner_X[i].nTolPlus);
+		str.Format(_T("JUDGEMENT_CORNER_X_MINUS_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,corner_X[i].nTolMinus);
+
+		str.Format(_T("JUDGEMENT_CORNER_Y_USE_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,corner_Y[i].bError);
+		str.Format(_T("JUDGEMENT_CORNER_Y_REFER_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,corner_Y[i].nRefernce);
+		str.Format(_T("JUDGEMENT_CORNER_Y_PLUS_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,corner_Y[i].nTolPlus);
+		str.Format(_T("JUDGEMENT_CORNER_Y_MINUS_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,corner_Y[i].nTolMinus);
+
+		for(j=0;j<2;j++)
+		{
+			str.Format(_T("JUDGEMENT_GRIND_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,grind[j][i].bError);
+			str.Format(_T("JUDGEMENT_GRIND_REFER_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,grind[j][i].nRefernce);
+			str.Format(_T("JUDGEMENT_GRIND_PLUS_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,grind[j][i].nTolPlus);
+			str.Format(_T("JUDGEMENT_GRIND_MINUS_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,grind[j][i].nTolMinus);
+
+			str.Format(_T("JUDGEMENT_CHAMFER_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,chamfer[j][i].bError);
+			str.Format(_T("JUDGEMENT_CHAMFER_REFER_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,chamfer[j][i].nRefernce);
+			str.Format(_T("JUDGEMENT_CHAMFER_PLUS_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,chamfer[j][i].nTolPlus);
+			str.Format(_T("JUDGEMENT_CHAMFER_MINUS_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,chamfer[j][i].nTolMinus);
+
+			str.Format(_T("JUDGEMENT_CUTTING_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,cutting[j][i].bError);
+			str.Format(_T("JUDGEMENT_CUTTING_REFER_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,cutting[j][i].nRefernce);
+			str.Format(_T("JUDGEMENT_CUTTING_PLUS_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,cutting[j][i].nTolPlus);
+			str.Format(_T("JUDGEMENT_CUTTING_MINUS_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,cutting[j][i].nTolMinus);			
+		}
+
+		str.Format(_T("JUDGEMENT_CFGRIND%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nCFGrind[i]);		
+	}
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{		
+		str.Format(_T("JUDGEMENT_AVG_PROFILE_USE_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,AvgProfile[i].bUse);
+		str.Format(_T("JUDGEMENT_AVG_PROFILE_DIFF_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,AvgProfile[i].nDiff);
+		str.Format(_T("JUDGEMENT_AVG_CHAMFER_USE_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,AvgChamfer[i].bUse);
+		str.Format(_T("JUDGEMENT_AVG_CHAMFER_DIFF_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,AvgChamfer[i].nDiff);
+
+		str.Format(_T("JUDGEMENT_MIN_PROFILE_NG_COUNT_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nMinProfileNgCount[i]);
+		str.Format(_T("JUDGEMENT_DIFF_PROFILE_NG_COUNT_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nMinProfileNgCount_MinDiff[i]);
+
+		str.Format(_T("JUDGEMENT_SUBMARK_USE_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,EdgeToSubMark[i].bError);
+		str.Format(_T("JUDGEMENT_SUBMARK_REFER_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,EdgeToSubMark[i].nRefernce);
+		str.Format(_T("JUDGEMENT_SUBMARK_PLUS_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,EdgeToSubMark[i].nTolPlus);
+		str.Format(_T("JUDGEMENT_SUBMARK_MINUS_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,EdgeToSubMark[i].nTolMinus);		
+
+		str.Format(_T("DIMENSION_SUBMARK_USE_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,Dimension[i].bError);
+		str.Format(_T("DIMENSION_SUBMARK_REFER_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,Dimension[i].nRefernce);
+		str.Format(_T("DIMENSION_SUBMARK_PLUS_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,Dimension[i].nTolPlus);
+		str.Format(_T("DIMENSION_SUBMARK_MINUS_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,Dimension[i].nTolMinus);
+
+		for(j=0;j<MAX_MARKER_COUNT;j++)
+		{
+			str.Format(_T("ALIGNPOSITION_X_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,ptAlign[j][i].x);
+			str.Format(_T("ALIGNPOSITION_Y_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,ptAlign[j][i].y);
+		}
+
+		for(j=0;j<3;j++)
+		{
+			str.Format(_T("JUDGEMENT_DEFECT_RNG_START_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].nRangeStart);
+			str.Format(_T("JUDGEMENT_DEFECT_RNG_END_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].nRangeEnd);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_AND_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_Side.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_Side.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_MERGE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_Side.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_SIZE_CX_%d_%d"),i,j);
+			nValue = defect[i][j].Chip_Side.szDefect.cx;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPSIDE_SIZE_CY_%d_%d"),i,j);
+			nValue = defect[i][j].Chip_Side.szDefect.cy;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_AND_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_Side.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_Side.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_MERGE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_Side.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_SIZE_CX_%d_%d"),i,j);
+			nValue = defect[i][j].Burr_Side.szDefect.cx;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_BURRSIDE_SIZE_CY_%d_%d"),i,j);
+			nValue = defect[i][j].Burr_Side.szDefect.cy;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_AND_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Broken.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Broken.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_MERGE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Broken.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_SIZE_CX_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+			nValue = defect[i][j].Broken.szDefect.cx;
+			str.Format(_T("JUDGEMENT_DEFECT_BROKEN_SIZE_CY_%d_%d"),i,j);
+			nValue = defect[i][j].Broken.szDefect.cy;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_AND_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Bevel.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Bevel.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_MERGE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Bevel.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_SIZE_CX_%d_%d"),i,j);
+			nValue = defect[i][j].Bevel.szDefect.cx;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_BEVEL_SIZE_CY_%d_%d"),i,j);
+			nValue = defect[i][j].Bevel.szDefect.cy;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_AND_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_CF.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_CF.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_MERGE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Chip_CF.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_SIZE_CX_%d_%d"),i,j);
+			nValue = defect[i][j].Chip_CF.szDefect.cx;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_CHIPCF_SIZE_CY_%d_%d"),i,j);
+			nValue = defect[i][j].Chip_CF.szDefect.cy;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFAND_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_CF.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFUSE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_CF.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFMERGE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Burr_CF.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFSIZE_CX_%d_%d"),i,j);
+			nValue = defect[i][j].Burr_CF.szDefect.cx;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_BURRCFSIZE_CY_%d_%d"),i,j);
+			nValue = defect[i][j].Burr_CF.szDefect.cy;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKAND_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Crack.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKUSE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Crack.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKMERGE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Crack.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKSIZE_CX_%d_%d"),i,j);
+			nValue = defect[i][j].Crack.szDefect.cx;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_CRACKSIZE_CY_%d_%d"),i,j);
+			nValue = defect[i][j].Crack.szDefect.cy;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_AND_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Compare_Panel.bConditionAND);
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_USE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Compare_Panel.bError);
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_MERGE_%d_%d"),i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,defect[i][j].Compare_Panel.nMerge);
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_SIZE_CX_%d_%d"),i,j);
+			nValue = defect[i][j].Compare_Panel.szDefect.cx;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+			str.Format(_T("JUDGEMENT_DEFECT_COMPARE_SIZE_CY_%d_%d"),i,j);
+			nValue = defect[i][j].Compare_Panel.szDefect.cy;
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+		}	
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CINSPECT_INFO_PARM
+CINSPECT_INFO_PARM::CINSPECT_INFO_PARM(void)
+{
+	Reset();
+}
+
+CINSPECT_INFO_PARM::~CINSPECT_INFO_PARM(void)
+{
+}
+
+CINSPECT_INFO_PARM& CINSPECT_INFO_PARM::operator=(CINSPECT_INFO_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();	
+		m_CutAreaParm = rh.m_CutAreaParm;
+		m_DimensionParm = rh.m_DimensionParm;
+		m_SplineParm = rh.m_SplineParm;	
+		m_CornerParm = rh.m_CornerParm;
+		m_NotchParm = rh.m_NotchParm;
+		m_VCRParm = rh.m_VCRParm;
+		CopyMemory(m_nRCutThresGlass,rh.m_nRCutThresGlass,sizeof(int)*MAX_DIMENSION_COUNT*2);
+		CopyMemory(m_nRCutThresChamfer,rh.m_nRCutThresChamfer,sizeof(int)*MAX_DIMENSION_COUNT*2);
+
+		std::vector<STU_EXTRA_CHIP_REG>::iterator it;		
+
+		for(it=rh.m_vecExtraChipReg.begin();it!=rh.m_vecExtraChipReg.end();it++)
+		{
+			m_vecExtraChipReg.push_back(*it);
+		}
+
+	}
+	return *this;
+}
+
+void CINSPECT_INFO_PARM::Reset()
+{
+	m_CutAreaParm.Reset();
+	m_DimensionParm.Reset();
+	m_SplineParm.Reset();
+	m_CornerParm.Reset();
+	m_NotchParm.Reset();
+	m_VCRParm.Reset();
+	m_vecExtraChipReg.clear();	
+	ZeroMemory(m_nRCutThresGlass,sizeof(int)*MAX_DIMENSION_COUNT*2);
+	ZeroMemory(m_nRCutThresChamfer,sizeof(int)*MAX_DIMENSION_COUNT*2);
+}
+
+BOOL CINSPECT_INFO_PARM::ReadRecipe(CConfig *pFile)
+{
+	m_CutAreaParm.ReadRecipe(pFile);
+	m_DimensionParm.ReadRecipe(pFile);	
+	m_SplineParm.ReadRecipe(pFile);	
+	m_CornerParm.ReadRecipe(pFile);	
+	m_NotchParm.ReadRecipe(pFile);	
+	m_VCRParm.ReadRecipe(pFile);
+
+	STU_EXTRA_CHIP_REG		stuPos;
+	int						iLoop,nCount,nValue;
+	CString					str;
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		for(iLoop=0;iLoop<2;iLoop++)
+		{
+			str.Format(_T("RCUT_THRES_GLASS_%d_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nRCutThresGlass[i][iLoop]);
+			str.Format(_T("RCUT_THRES_Chamfer_%d_%d"),i,iLoop);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nRCutThresChamfer[i][iLoop]);
+		}
+	}
+
+	str.Format(_T("EXTRA_CHIP_REG_COUNT"));
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nCount);
+
+	m_vecExtraChipReg.clear();
+	for(iLoop=0;iLoop<nCount;iLoop++)
+	{
+		stuPos.Reset();
+
+		str.Format(_T("EXTRA_CHIP_REG_DIMENSION_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+		stuPos.enSide = (DimensionDir)nValue;
+
+		str.Format(_T("EXTRA_CHIP_REG_TB_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.bTB);
+
+		str.Format(_T("EXTRA_CHIP_REG_START_Y_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nStartY);
+
+		str.Format(_T("EXTRA_CHIP_REG_END_Y_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nYSize);
+
+		str.Format(_T("EXTRA_CHIP_REG_SIZE_X_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nSizeX);
+
+		str.Format(_T("EXTRA_CHIP_REG_CHAMFER_THRES_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nChamferThres);		
+
+		str.Format(_T("EXTRA_CHIP_REG_CHIP_THRES_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nChipThres);		
+
+		str.Format(_T("EXTRA_CHIP_REG_JUDGEBASE_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nJudgeBase);
+
+		str.Format(_T("EXTRA_CHIP_REG_JUDGEDIFF_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nJudgeDiff);
+
+		str.Format(_T("EXTRA_CHIP_REG_CHIP_WIDTH_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nChipWidth);	
+
+		str.Format(_T("EXTRA_CHIP_REG_CHIP_HEIGHT_%d"),iLoop);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nChipHeight);	
+
+		m_vecExtraChipReg.push_back(stuPos);
+	}
+
+	return TRUE;
+}
+
+BOOL CINSPECT_INFO_PARM::WriteRecipe(CConfig *pFile)
+{
+	m_CutAreaParm.WriteRecipe(pFile);
+	m_DimensionParm.WriteRecipe(pFile);	
+	m_SplineParm.WriteRecipe(pFile);	
+	m_CornerParm.WriteRecipe(pFile);	
+	m_NotchParm.WriteRecipe(pFile);
+	m_VCRParm.WriteRecipe(pFile);
+
+	STU_EXTRA_CHIP_REG		stuPos;
+	int						iLoop,nCount,nValue;
+	CString					str;
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		for(iLoop=0;iLoop<2;iLoop++)
+		{
+			str.Format(_T("RCUT_THRES_GLASS_%d_%d"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nRCutThresGlass[i][iLoop]);
+			str.Format(_T("RCUT_THRES_Chamfer_%d_%d"),i,iLoop);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nRCutThresChamfer[i][iLoop]);
+		}
+	}
+
+	nCount = (int)m_vecExtraChipReg.size();
+	str.Format(_T("EXTRA_CHIP_REG_COUNT"));
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nCount);
+
+	for(iLoop=0;iLoop<nCount;iLoop++)
+	{
+		stuPos = m_vecExtraChipReg[iLoop];
+
+		str.Format(_T("EXTRA_CHIP_REG_DIMENSION_%d"),iLoop);
+		nValue = (int)stuPos.enSide;
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);		
+
+		str.Format(_T("EXTRA_CHIP_REG_TB_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.bTB);
+
+		str.Format(_T("EXTRA_CHIP_REG_START_Y_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nStartY);
+
+		str.Format(_T("EXTRA_CHIP_REG_END_Y_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nYSize);
+
+		str.Format(_T("EXTRA_CHIP_REG_SIZE_X_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nSizeX);
+
+		str.Format(_T("EXTRA_CHIP_REG_CHAMFER_THRES_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nChamferThres);		
+
+		str.Format(_T("EXTRA_CHIP_REG_CHIP_THRES_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nChipThres);		
+
+		str.Format(_T("EXTRA_CHIP_REG_JUDGEBASE_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nJudgeBase);
+
+		str.Format(_T("EXTRA_CHIP_REG_JUDGEDIFF_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nJudgeDiff);		
+
+		str.Format(_T("EXTRA_CHIP_REG_CHIP_WIDTH_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nChipWidth);	
+
+		str.Format(_T("EXTRA_CHIP_REG_CHIP_HEIGHT_%d"),iLoop);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,stuPos.nChipHeight);	
+	}
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CALIGNMARK_PARM
+CALIGNMARK_PARM::CALIGNMARK_PARM(void)
+{
+	for(int j = 0; j < MAX_MARKER_COUNT ; j++)
+		for(int i=0;i<MAX_POS_MARKER_COUNT;i++)
+			IpMarkImg[j][i] = NULL;
+	Reset();
+}
+
+CALIGNMARK_PARM::~CALIGNMARK_PARM(void)
+{
+
+}
+
+CALIGNMARK_PARM& CALIGNMARK_PARM::operator=(CALIGNMARK_PARM& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+		CopyMemory(m_bIsMark,rh.m_bIsMark,sizeof(BOOL)*MAX_MARKER_COUNT);		
+		CopyMemory(m_nMarkType,rh.m_nMarkType,sizeof(int)*MAX_MARKER_COUNT);		
+		CopyMemory(m_dMarkMatchingRate,rh.m_dMarkMatchingRate,sizeof(double)*MAX_MARKER_COUNT*MAX_POS_MARKER_COUNT);	
+		m_JudgeAlign = rh.m_JudgeAlign;		
+
+	}
+	return *this;
+}
+
+void CALIGNMARK_PARM::MarkImgDelete()
+{
+	for(int j = 0; j < MAX_MARKER_COUNT ; j++)
+	{
+		for(int i=0;i<MAX_POS_MARKER_COUNT;i++)
+		{
+			if(IpMarkImg[j][i])
+			{
+				cvReleaseImage(&IpMarkImg[j][i]);
+				IpMarkImg[j][i] = NULL;
+			}
+		}
+	}
+}
+
+void CALIGNMARK_PARM::Reset()
+{
+	ZeroMemory(m_bIsMark,sizeof(BOOL)*MAX_MARKER_COUNT);	
+	ZeroMemory(m_nMarkType,sizeof(int)*MAX_MARKER_COUNT);		
+	ZeroMemory(m_dMarkMatchingRate,sizeof(double)*MAX_MARKER_COUNT*MAX_POS_MARKER_COUNT);	
+	ZeroMemory(&m_JudgeAlign,sizeof(JUDGEEDGE));
+	MarkImgDelete();
+}
+
+BOOL CALIGNMARK_PARM::ReadRecipe(CConfig *pFile,int nIdx)
+{	
+
+	int			i;
+	CString		str;
+
+	for(i=0;i<MAX_MARKER_COUNT;i++)
+	{
+		str.Format(_T("ALIGNMARK_ISEXIT_MARKER_%d_%d"),nIdx,i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str, m_bIsMark[i]);	
+		str.Format(_T("ALIGNMARK_TYPE_MARKER_%d_%d"),nIdx,i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str, m_nMarkType[i]);	
+		for(int j=0;j<MAX_POS_MARKER_COUNT;j++)
+		{
+			str.Format(_T("ALIGNMARK_MATCHINGRATE_MARKER_%d_%d_%d"),nIdx,i,j);
+			pFile->GetItemValue((TCHAR*)(LPCTSTR)str, m_dMarkMatchingRate[i][j]);	
+		}
+	}
+
+	str.Format(_T("ALIGNMARK_JUGE_REF_%d"),nIdx);
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str, m_JudgeAlign.nRefernce);	
+	str.Format(_T("ALIGNMARK_JUGE_PLUS_%d"),nIdx);
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str, m_JudgeAlign.nTolPlus);	
+	str.Format(_T("ALIGNMARK_JUGE_MINUS_%d"),nIdx);
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str, m_JudgeAlign.nTolMinus);		
+
+	return TRUE;
+}
+BOOL CALIGNMARK_PARM::WriteRecipe(CConfig *pFile,int nIdx)
+{
+	int			i;
+	CString		str;
+
+	for(i=0;i<MAX_MARKER_COUNT;i++)
+	{
+		str.Format(_T("ALIGNMARK_ISEXIT_MARKER_%d_%d"),nIdx,i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str, m_bIsMark[i]);	
+		str.Format(_T("ALIGNMARK_TYPE_MARKER_%d_%d"),nIdx,i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str, m_nMarkType[i]);	
+
+		for(int j=0;j<MAX_POS_MARKER_COUNT;j++)
+		{
+			str.Format(_T("ALIGNMARK_MATCHINGRATE_MARKER_%d_%d_%d"),nIdx,i,j);
+			pFile->SetItemValue((TCHAR*)(LPCTSTR)str, m_dMarkMatchingRate[i][j]);	
+		}
+	}
+
+	str.Format(_T("ALIGNMARK_JUGE_REF_%d"),nIdx);
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str, m_JudgeAlign.nRefernce);	
+	str.Format(_T("ALIGNMARK_JUGE_PLUS_%d"),nIdx);
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str, m_JudgeAlign.nTolPlus);	
+	str.Format(_T("ALIGNMARK_JUGE_MINUS_%d"),nIdx);
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str, m_JudgeAlign.nTolMinus);
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+CHOLEINSPECT_PARM& CHOLEINSPECT_PARM::operator=(CHOLEINSPECT_PARM& rh)
+{
+	Reset();
+
+	m_nTotalHoleCount = rh.m_nTotalHoleCount;
+	m_vecHoleInsParam = rh.m_vecHoleInsParam;
+
+	return *this;
+}
+
+BOOL CHOLEINSPECT_PARM::ReadRecipe(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	int			nValue = 0;
+	CString		str;
+	str.Format(_T("HOLE_INSPECT_TOTAL_COUNT"));
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str, m_nTotalHoleCount);	
+
+	HOLE_INS_PARM holeInsParam;
+
+	m_vecHoleInsParam.clear();
+
+	for(int i=0;i<m_nTotalHoleCount;i++)
+	{
+		// 1. Side
+		str.Format(_T("HOLE_INSPECT_SIDE"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, holeInsParam.m_nSideIdx);
+
+		// 2. Template Area
+		str.Format(_T("HOLE_INSPECT_ROI_L"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, nValue);
+		holeInsParam.m_rtArea.left = nValue;
+
+		str.Format(_T("HOLE_INSPECT_ROI_T"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, nValue);
+		holeInsParam.m_rtArea.top = nValue;
+
+		str.Format(_T("HOLE_INSPECT_ROI_R"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, nValue);
+		holeInsParam.m_rtArea.right = nValue;
+
+		str.Format(_T("HOLE_INSPECT_ROI_B"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, nValue);
+		holeInsParam.m_rtArea.bottom = nValue;
+
+		// 3. Hole Area
+		str.Format(_T("HOLE_INSPECT_CIRCLE_L"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, nValue);
+		holeInsParam.m_rtHoleArea.left = nValue;
+
+		str.Format(_T("HOLE_INSPECT_CIRCLE_T"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, nValue);
+		holeInsParam.m_rtHoleArea.top = nValue;
+
+		str.Format(_T("HOLE_INSPECT_CIRCLE_R"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, nValue);
+		holeInsParam.m_rtHoleArea.right = nValue;
+
+		str.Format(_T("HOLE_INSPECT_CIRCLE_B"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, nValue);
+		holeInsParam.m_rtHoleArea.bottom = nValue;
+
+		// 4. Inspection Param
+		str.Format(_T("HOLE_INSPECT_THRESHOLD"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, holeInsParam.m_nThreshold);
+
+		str.Format(_T("HOLE_INSPECT_OFFSET"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, holeInsParam.m_nOffset);
+
+		str.Format(_T("HOLE_INSPECT_MINSIZE"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, holeInsParam.m_nMinSize);
+
+		str.Format(_T("HOLE_INSPECT_MATRATE"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, holeInsParam.m_dMatRate);
+
+		str.Format(_T("HOLE_INSPECT_TEMPLATE_IMG_PATH"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, holeInsParam.m_strTemplatePath);
+
+		m_vecHoleInsParam.push_back(holeInsParam);
+	}
+
+	return TRUE;
+}
+
+BOOL CHOLEINSPECT_PARM::WriteRecipe(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString		str;
+	str.Format(_T("HOLE_INSPECT_TOTAL_COUNT"));
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str, m_nTotalHoleCount);	
+
+	HOLE_INS_PARM holeInsParam;
+
+	for(int i=0;i<m_nTotalHoleCount;i++)
+	{
+		if(m_vecHoleInsParam.size() <= i)
+			continue;
+
+		// 1. Side
+		str.Format(_T("HOLE_INSPECT_SIDE"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_vecHoleInsParam[i].m_nSideIdx);
+
+		// 2. Template Area
+		str.Format(_T("HOLE_INSPECT_ROI_L"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, (int) m_vecHoleInsParam[i].m_rtArea.left);
+
+		str.Format(_T("HOLE_INSPECT_ROI_T"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, (int) m_vecHoleInsParam[i].m_rtArea.top);
+
+		str.Format(_T("HOLE_INSPECT_ROI_R"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, (int) m_vecHoleInsParam[i].m_rtArea.right);
+
+		str.Format(_T("HOLE_INSPECT_ROI_B"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, (int) m_vecHoleInsParam[i].m_rtArea.bottom);
+
+		// 3. Hole Area
+		str.Format(_T("HOLE_INSPECT_CIRCLE_L"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, (int) m_vecHoleInsParam[i].m_rtHoleArea.left);
+
+		str.Format(_T("HOLE_INSPECT_CIRCLE_T"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, (int) m_vecHoleInsParam[i].m_rtHoleArea.top);
+
+		str.Format(_T("HOLE_INSPECT_CIRCLE_R"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, (int) m_vecHoleInsParam[i].m_rtHoleArea.right);
+
+		str.Format(_T("HOLE_INSPECT_CIRCLE_B"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, (int) m_vecHoleInsParam[i].m_rtHoleArea.bottom);
+
+		// 4. Inspection Param
+		str.Format(_T("HOLE_INSPECT_THRESHOLD"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str,  m_vecHoleInsParam[i].m_nThreshold);
+
+		str.Format(_T("HOLE_INSPECT_OFFSET"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str,  m_vecHoleInsParam[i].m_nOffset);
+
+		str.Format(_T("HOLE_INSPECT_MINSIZE"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str,  m_vecHoleInsParam[i].m_nMinSize);
+
+		str.Format(_T("HOLE_INSPECT_MATRATE"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str,  m_vecHoleInsParam[i].m_dMatRate);		
+
+		str.Format(_T("HOLE_INSPECT_TEMPLATE_IMG_PATH"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str,  m_vecHoleInsParam[i].m_strTemplatePath);
+	}
+
+	return TRUE;
+}
+
+void CHOLEINSPECT_PARM::Reset()
+{
+	m_nTotalHoleCount = 0;
+	m_vecHoleInsParam.clear();
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+CProfileInspect_Prm& CProfileInspect_Prm::operator=(CProfileInspect_Prm& rh)
+{
+	Reset();
+
+	CopyMemory(m_bUseOriginAlignKey,rh.m_bUseOriginAlignKey,sizeof(BOOL)*MAX_DIMENSION_COUNT);
+	CopyMemory(m_nOriginAlignKeyOffsetX,rh.m_nOriginAlignKeyOffsetX,sizeof(int)*MAX_DIMENSION_COUNT);
+	CopyMemory(m_nOriginAlignKeyOffsetY,rh.m_nOriginAlignKeyOffsetY,sizeof(int)*MAX_DIMENSION_COUNT);
+	CopyMemory(m_nOriginAlignKeyOffsetDwX,rh.m_nOriginAlignKeyOffsetDwX,sizeof(int)*MAX_DIMENSION_COUNT);
+	CopyMemory(m_nOriginAlignKeyOffsetDwY,rh.m_nOriginAlignKeyOffsetDwY,sizeof(int)*MAX_DIMENSION_COUNT);
+	CopyMemory(m_nCADOffsetX,rh.m_nCADOffsetX,sizeof(int)*MAX_DIMENSION_COUNT);
+	CopyMemory(m_nCADOffsetY,rh.m_nCADOffsetY,sizeof(int)*MAX_DIMENSION_COUNT);
+	CopyMemory(m_stProfile,rh.m_stProfile,sizeof(ST_PROFILE_SETTING)*MAX_PROFILE_SETTING_COUNT);
+	CopyMemory(m_stCamferUp,rh.m_stCamferUp,sizeof(ST_CHAMFER_SETTING)*MAX_PROFILE_SETTING_COUNT);
+	CopyMemory(m_stCamferDn,rh.m_stCamferDn,sizeof(ST_CHAMFER_SETTING)*MAX_PROFILE_SETTING_COUNT);
+
+	return *this;
+}
+
+BOOL CProfileInspect_Prm::ReadRecipe(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	int			nValue = 0;
+	CString		str;
+	int			i;
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str.Format(_T("USE_ORIGIN_ALIGNKEY_OFFSET"));
+		pFile->GetItemValue(i,(TCHAR*)(LPCTSTR)str, m_bUseOriginAlignKey[i]);
+		str.Format(_T("ORIGIN_ALIGNKEY_OFFSET_X"));
+		pFile->GetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nOriginAlignKeyOffsetX[i]);
+		str.Format(_T("ORIGIN_ALIGNKEY_OFFSET_Y"));
+		pFile->GetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nOriginAlignKeyOffsetY[i]);
+		str.Format(_T("ORIGIN_ALIGNKEY_OFFSET_DW_X"));
+		pFile->GetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nOriginAlignKeyOffsetDwX[i]);
+		str.Format(_T("ORIGIN_ALIGNKEY_OFFSET_DW_Y"));
+		pFile->GetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nOriginAlignKeyOffsetDwY[i]);
+		str.Format(_T("CAD_PROFILE_OFFSET_X"));
+		pFile->GetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nCADOffsetX[i]);	
+		str.Format(_T("CAD_PROFILE_OFFSET_Y"));
+		pFile->GetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nCADOffsetY[i]);	
+	}
+
+	for(i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+	{		
+		str.Format(_T("PROFILE_PRM_X"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].x);
+		str.Format(_T("PROFILE_PRM_Y"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].y);
+		str.Format(_T("PROFILE_PRM_USE"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].use);
+		str.Format(_T("PROFILE_PRM_MINUS"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].minus);
+		str.Format(_T("PROFILE_PRM_PLUS"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].plus);
+		str.Format(_T("PROFILE_PRM_RADIUS"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].radius);
+		str.Format(_T("CHAMFER_UP_PRM_USE"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferUp[i].use);
+		str.Format(_T("CHAMFER_UP_PRM_REFERENCE"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferUp[i].reference);
+		str.Format(_T("CHAMFER_UP_PRM_MINUS"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferUp[i].minus);
+		str.Format(_T("CHAMFER_UP_PRM_PLUS"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferUp[i].plus);
+		str.Format(_T("CHAMFER_DN_PRM_USE"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferDn[i].use);
+		str.Format(_T("CHAMFER_DN_PRM_REFERENCE"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferDn[i].reference);
+		str.Format(_T("CHAMFER_DN_PRM_MINUS"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferDn[i].minus);
+		str.Format(_T("CHAMFER_DN_PRM_PLUS"));
+		pFile->GetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferDn[i].plus);
+	}	
+
+	return TRUE;
+}
+
+BOOL CProfileInspect_Prm::WriteRecipe(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	int			nValue = 0;
+	CString		str;
+	int			i;
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		str.Format(_T("USE_ORIGIN_ALIGNKEY_OFFSET"));
+		pFile->SetItemValue(i,(TCHAR*)(LPCTSTR)str, m_bUseOriginAlignKey[i]);
+		str.Format(_T("ORIGIN_ALIGNKEY_OFFSET_X"));
+		pFile->SetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nOriginAlignKeyOffsetX[i]);
+		str.Format(_T("ORIGIN_ALIGNKEY_OFFSET_Y"));
+		pFile->SetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nOriginAlignKeyOffsetY[i]);
+		str.Format(_T("ORIGIN_ALIGNKEY_OFFSET_DW_X"));
+		pFile->SetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nOriginAlignKeyOffsetDwX[i]);
+		str.Format(_T("ORIGIN_ALIGNKEY_OFFSET_DW_Y"));
+		pFile->SetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nOriginAlignKeyOffsetDwY[i]);
+		str.Format(_T("CAD_PROFILE_OFFSET_X"));
+		pFile->SetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nCADOffsetX[i]);	
+		str.Format(_T("CAD_PROFILE_OFFSET_Y"));
+		pFile->SetItemValue(i,(TCHAR*)(LPCTSTR)str, m_nCADOffsetY[i]);	
+	}
+
+	for(i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+	{		
+		str.Format(_T("PROFILE_PRM_X"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].x);
+		str.Format(_T("PROFILE_PRM_Y"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].y);
+		str.Format(_T("PROFILE_PRM_USE"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].use);
+		str.Format(_T("PROFILE_PRM_MINUS"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].minus);
+		str.Format(_T("PROFILE_PRM_PLUS"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].plus);
+		str.Format(_T("PROFILE_PRM_RADIUS"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stProfile[i].radius);
+		str.Format(_T("CHAMFER_UP_PRM_USE"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferUp[i].use);
+		str.Format(_T("CHAMFER_UP_PRM_REFERENCE"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferUp[i].reference);
+		str.Format(_T("CHAMFER_UP_PRM_MINUS"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferUp[i].minus);
+		str.Format(_T("CHAMFER_UP_PRM_PLUS"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferUp[i].plus);
+		str.Format(_T("CHAMFER_DN_PRM_USE"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferDn[i].use);
+		str.Format(_T("CHAMFER_DN_PRM_REFERENCE"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferDn[i].reference);
+		str.Format(_T("CHAMFER_DN_PRM_MINUS"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferDn[i].minus);
+		str.Format(_T("CHAMFER_DN_PRM_PLUS"));
+		pFile->SetItemValue(i, (TCHAR*)(LPCTSTR)str, m_stCamferDn[i].plus);
+	}	
+
+	return TRUE;
+}
+
+void CProfileInspect_Prm::Reset()
+{
+	ZeroMemory(m_bUseOriginAlignKey,sizeof(BOOL)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_nOriginAlignKeyOffsetX,sizeof(int)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_nOriginAlignKeyOffsetY,sizeof(int)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_nOriginAlignKeyOffsetDwX,sizeof(int)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_nOriginAlignKeyOffsetDwY,sizeof(int)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_nCADOffsetY,sizeof(int)*MAX_DIMENSION_COUNT);	
+	ZeroMemory(m_nCADOffsetX,sizeof(int)*MAX_DIMENSION_COUNT);
+	ZeroMemory(m_stProfile,sizeof(ST_PROFILE_SETTING)*MAX_PROFILE_SETTING_COUNT);
+	ZeroMemory(m_stCamferUp,sizeof(ST_CHAMFER_SETTING)*MAX_PROFILE_SETTING_COUNT);
+	ZeroMemory(m_stCamferDn,sizeof(ST_CHAMFER_SETTING)*MAX_PROFILE_SETTING_COUNT);	
+}
+
+//////////////////////////////////////////////////////////////////////////
+// CGlassRecipe
+CGlassRecipe::CGlassRecipe(void)
+{
+	Reset();
+}
+
+CGlassRecipe::~CGlassRecipe(void)
+{
+	DeleteExpAreaList();
+}
+
+CGlassRecipe& CGlassRecipe::operator=(CGlassRecipe& rh)
+{
+	if(this != &rh)
+	{
+		Reset();
+		m_RecieParm = rh.m_RecieParm;	
+		m_GlassParm = rh.m_GlassParm;						 
+		m_LightParm = rh.m_LightParm;		
+		CopyMemory(m_ETCParm,rh.m_ETCParm,sizeof(CETC_PARM)*MAX_DIMENSION_COUNT);
+		CopyMemory(m_AlignMarkParm,rh.m_AlignMarkParm,sizeof(CALIGNMARK_PARM)*MAX_DIMENSION_COUNT);
+
+		itUSER_DEFECT_AREA_LIST it;
+		ST_USER_DEFECT_AREA	stUserDefect;
+		itEXCEPTION_AREA_LIST	itExp;
+		EXECPTION_AREA			*pExp = NULL;
+
+		DeleteExpAreaList();
+
+		for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+		{
+			m_UserDefectPrm[i].clear();
+			for(it=rh.m_UserDefectPrm[i].begin();it!=rh.m_UserDefectPrm[i].end();it++)
+			{
+				stUserDefect = *it;
+				m_UserDefectPrm[i].push_back(stUserDefect);
+			}			
+
+			for(itExp=rh.m_ExpAreaPrm[i].begin();itExp!=rh.m_ExpAreaPrm[i].end();itExp++)
+			{
+				pExp = new EXECPTION_AREA();
+
+				pExp->CopyData(*itExp);
+				m_ExpAreaPrm[i].push_back(pExp);
+			}
+		}		
+
+		m_InspectInfoParm = rh.m_InspectInfoParm;
+		m_Judgement = rh.m_Judgement;		 
+		m_HoleInspectParm = rh.m_HoleInspectParm;
+		m_ProfilePrm = rh.m_ProfilePrm;
+
+	}
+	return *this;
+}
+
+void CGlassRecipe::DeleteExpAreaList()
+{
+	itEXCEPTION_AREA_LIST	itExp;	
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{		
+		for(itExp=m_ExpAreaPrm[i].begin();itExp!=m_ExpAreaPrm[i].end();itExp++)
+		{				
+			delete (*itExp);	
+		}
+		m_ExpAreaPrm[i].clear();		
+	}		
+}
+
+void CGlassRecipe::Reset()
+{
+	m_RecieParm.Reset();
+	m_GlassParm.Reset();			
+	m_LightParm.Reset();	
+	ZeroMemory(m_AlignMarkParm,sizeof(CALIGNMARK_PARM)*MAX_DIMENSION_COUNT);	
+	ZeroMemory(m_ETCParm,sizeof(CETC_PARM)*MAX_DIMENSION_COUNT);
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		m_UserDefectPrm[i].clear();				
+	}	
+
+	DeleteExpAreaList();
+
+	m_InspectInfoParm.Reset();	
+	m_Judgement.Reset();
+	m_ProfilePrm.Reset();
+}
+
+BOOL CGlassRecipe::MakeRecipeFileName(CString strRecipe)
+{
+	if (strRecipe.IsEmpty())
+		return FALSE;
+
+	CString			str;	
+
+	m_RecieParm.SetRecipeName(strRecipe);
+
+	str.Empty();
+	str = RECIPE_PATH;
+	str += "\\";
+	str += strRecipe;
+	str += ".rcp";
+	m_RecieParm.SetRecipeFileName(str);
+
+	return TRUE;
+}
+
+BOOL CGlassRecipe::ReadRecipe(CConfig *pFile)
+{
+	m_RecieParm.ReadRecipe(pFile);
+	m_GlassParm.ReadRecipe(pFile);			
+	m_LightParm.ReadRecipe(pFile);		
+	m_InspectInfoParm.ReadRecipe(pFile);
+	m_Judgement.ReadRecipe(pFile);
+	m_HoleInspectParm.ReadRecipe(pFile);
+	m_ProfilePrm.ReadRecipe(pFile);
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		m_ETCParm[i].ReadRecipe(pFile,i);
+		m_AlignMarkParm[i].ReadRecipe(pFile,i);
+	}		
+
+	LoadAlignMark();
+
+	LoadUserDefectList();
+
+	LoadExpAreaList();
+
+	return TRUE;
+}
+
+BOOL CGlassRecipe::WriteRecipe(CConfig *pFile)
+{
+	pFile->SetRewriteMode(FALSE);
+
+	m_RecieParm.WriteRecipe(pFile);
+	m_GlassParm.WriteRecipe(pFile);	
+	m_InspectInfoParm.WriteRecipe(pFile);			
+	m_LightParm.WriteRecipe(pFile);		
+	m_Judgement.WriteRecipe(pFile);
+	m_HoleInspectParm.WriteRecipe(pFile);
+	m_ProfilePrm.WriteRecipe(pFile);
+
+	for(int i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		m_ETCParm[i].WriteRecipe(pFile,i);
+		m_AlignMarkParm[i].WriteRecipe(pFile,i);
+	}
+
+	SaveAlignMark();
+
+	//pFile->SetRewriteMode(TRUE);
+	pFile->WriteToFile();
+
+	return TRUE;
+}
+
+BOOL CGlassRecipe::WriteRecipeFile()
+{
+	CString		strRecipe = m_RecieParm.m_strRecipeFileName;
+
+	m_RecipeFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strRecipe, FileMap_Mode);
+
+	return WriteRecipe(&m_RecipeFile);	
+}
+
+BOOL CGlassRecipe::ReadRecipeFile()
+{
+	CString		strRecipe = m_RecieParm.m_strRecipeFileName;	
+	if (!m_RecipeFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strRecipe, FileMap_Mode))
+	{		
+		Reset();
+		return FALSE;
+	}
+
+	return ReadRecipe(&m_RecipeFile);	
+}
+
+CString CGlassRecipe::GetRecipeName()
+{
+	return m_RecieParm.GetRecipeName();
+}
+
+BOOL CGlassRecipe::WriteRecipeFileBackUp()
+{
+	CString		strRecipe = m_RecieParm.m_strRecipeFileNameBackUp;
+
+	m_RecipeFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strRecipe, FileMap_Mode);
+
+	return WriteRecipe(&m_RecipeFile);	
+}
+
+int CGlassRecipe::GetLightValue(int iCon,int iCh)
+{
+	if(iCon	< 0 || iCon >= LIGHT_CONTROL_COUNT)
+		return 0;
+	if(iCh	< 0 || iCh >= LIGHT_CONTROL_CH_COUNT)
+		return 0;
+
+	return m_LightParm.m_nContValue[iCon][iCh];
+}
+
+CALIGNMARK_PARM	*CGlassRecipe::GetAlignMarkPrm(DimensionDir eDim)
+{
+	if(eDim < DIMENSION_A || eDim > DIMENSION_D_DN)
+		return NULL;
+
+	return &m_AlignMarkParm[eDim];
+}
+
+BOOL CGlassRecipe::LoadAlignMark()
+{
+	int		i,j;
+	CALIGNMARK_PARM	*pAlign;
+	CString	strPath;
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		pAlign = GetAlignMarkPrm((DimensionDir)i);
+		if(pAlign == NULL)
+			continue;
+
+		for( j = 0 ; j < MAX_MARKER_COUNT ; j++)
+		{			
+			for(int iPos=0;iPos<MAX_POS_MARKER_COUNT;iPos++)
+			{
+				strPath.Format(_T("%s\\%s\\Align_%d_%d_%d.bmp"),RECIPE_ALIGN_PATH,GetRecipeName(),i,j,iPos);
+				Load_Image(strPath,&pAlign->IpMarkImg[j][iPos]);
+			}
+		}
+	}
+	return TRUE;
+}
+
+BOOL CGlassRecipe::SaveAlignMark()
+{
+	int		i,j;
+	CALIGNMARK_PARM	*pAlign;
+	CString	strPath;
+
+	CreateDirectory(RECIPE_ALIGN_PATH,NULL);
+	strPath.Format(_T("%s\\%s"),RECIPE_ALIGN_PATH,GetRecipeName());
+	CreateDirectory(strPath,NULL);
+
+	for(i=0;i<MAX_DIMENSION_COUNT;i++)
+	{
+		pAlign = GetAlignMarkPrm((DimensionDir)i);
+		if(pAlign == NULL)
+			continue;
+
+		for( j = 0 ; j < MAX_MARKER_COUNT ; j++)
+		{			
+			for(int iPos=0;iPos<MAX_POS_MARKER_COUNT;iPos++)
+			{
+				strPath.Format(_T("%s\\%s\\Align_%d_%d_%d.bmp"),RECIPE_ALIGN_PATH,GetRecipeName(),i,j,iPos);
+				Save_Image(strPath,pAlign->IpMarkImg[j][iPos]);
+			}		
+		}
+	}
+	return TRUE;
+}
+
+pSTU_CUTAREA_PARM CGlassRecipe::GetCutAreaPrm(DimensionDir eDim)
+{
+	if(eDim < DIMENSION_A || eDim > DIMENSION_D_DN)
+		return NULL;
+
+	return m_InspectInfoParm.GetCutAreaParm(eDim);
+}
+
+CETC_PARM *CGlassRecipe::GetEtcPrm(DimensionDir eDim)
+{
+	if(eDim < DIMENSION_A || eDim > DIMENSION_D_DN)
+		return NULL;
+
+	return &m_ETCParm[eDim];
+}
+
+BOOL CGlassRecipe::MakeRecipeFileNameBackUp( CString strRecipe )
+{
+	if (strRecipe.IsEmpty())
+		return FALSE;
+
+	CString			str;	
+
+	str.Empty();
+	str = RECIPE_PATH;
+	str += _T("\\");
+	str += _T("BackUp");
+
+	CreateDirectory(str,NULL);		
+
+	str += _T("\\");
+	str += strRecipe;
+
+	CString			strtemp;
+	CTime	time = CTime::GetCurrentTime();
+
+	strtemp.Format(_T("_[%04d%02d%02d_%02d%02d%02d]"),time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
+	str +=strtemp;
+
+	str += _T(".rcp");
+	m_RecieParm.SetRecipeFileNameBackUp(str);
+
+	return TRUE;
+}
+
+BOOL CGlassRecipe::Save_Image(CString strPath,IplImage *IpImg)
+{
+	if(IpImg)
+	{		
+		USES_CONVERSION;
+		char str_filename[200];
+		sprintf_s(str_filename, "%s", W2A(strPath));
+
+		cvSaveImage(str_filename,IpImg);
+		return TRUE;
+	}
+	else
+	{
+		DeleteFile(strPath);
+	}
+	return FALSE;
+}
+
+BOOL CGlassRecipe::Load_Image(CString strPath,IplImage **pIpImg)
+{
+	if(*pIpImg)
+		cvReleaseImage(pIpImg);
+
+	USES_CONVERSION;
+	char str_filename[200];
+	sprintf_s(str_filename, "%s", W2A(strPath));
+
+	(*pIpImg) = cvLoadImage(str_filename,CV_LOAD_IMAGE_GRAYSCALE);	
+
+	if((*pIpImg))
+		return TRUE;
+
+	return FALSE;
+}
+
+BOOL CGlassRecipe::LoadUserDefectList()
+{
+	CString strRecipe;
+
+	strRecipe.Format(_T("%s\\UserDefect\\%s_UserDefectArea.ini"), RECIPE_PATH, GetRecipeName());	
+
+	CConfig profile;
+
+	if(profile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strRecipe, FileMap_Mode) == FALSE)
+	{
+		CFile File;
+		if (!File.Open((TCHAR*)(LPCTSTR)strRecipe, CFile::modeCreate))
+		{			
+			return FALSE;
+		}
+		File.Close();
+	}
+
+	CString			str;
+	for (int index = 0; index < MAX_DIMENSION_COUNT; index++)
+	{		
+		int list_count = 0;
+
+		m_UserDefectPrm[index].clear();
+
+		str.Format(_T("%d_cnt"),index);
+		profile.GetItemValue((TCHAR*)(LPCTSTR)str, list_count);
+
+		for (int count = 0; count < list_count; count++)
+		{
+			ST_USER_DEFECT_AREA user_defect_area;
+
+			str.Format(_T("%d_pos_x_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, user_defect_area.x);
+
+			str.Format(_T("%d_pos_y_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, user_defect_area.y);
+
+			str.Format(_T("%d_area_width_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, user_defect_area.area_width);
+
+			str.Format(_T("%d_area_height_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, user_defect_area.area_height);			
+
+			str.Format(_T("%d_defect_width_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, user_defect_area.defect_width);			
+
+			str.Format(_T("%d_defect_height_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, user_defect_area.defect_height);			
+
+			str.Format(_T("%d_defect_threshold_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, user_defect_area.defect_threshold);			
+
+			str.Format(_T("%d_defect_dilation_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, user_defect_area.defect_dilation);			
+
+			m_UserDefectPrm[index].push_back(user_defect_area);
+		}
+	}
+
+	return TRUE;
+}
+
+BOOL CGlassRecipe::SaveUserDefectList()
+{
+	CString strRecipe;
+
+	strRecipe.Format(_T("%s\\UserDefect\\%s_UserDefectArea.ini"), RECIPE_PATH, GetRecipeName());
+
+	CConfig profile;
+
+	if(profile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strRecipe, FileMap_Mode) == FALSE)
+	{
+		CFile File;
+		if (!File.Open((TCHAR*)(LPCTSTR)strRecipe, CFile::modeCreate))
+		{			
+			return FALSE;
+		}
+		File.Close();
+	}
+
+	CString					str;
+	itUSER_DEFECT_AREA_LIST it;
+	ST_USER_DEFECT_AREA	stUserDefect;
+	for (int index = 0; index < MAX_DIMENSION_COUNT; index++)
+	{		
+		int list_count = 0;
+
+		str.Format(_T("%d_cnt"),index);
+		list_count = (int)m_UserDefectPrm[index].size();
+		profile.SetItemValue((TCHAR*)(LPCTSTR)str, list_count);
+
+		int		count = 0;
+		for(it=m_UserDefectPrm[index].begin();it!=m_UserDefectPrm[index].end();it++,count++)
+		{
+			stUserDefect = *it;
+
+			str.Format(_T("%d_pos_x_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, stUserDefect.x);
+
+			str.Format(_T("%d_pos_y_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, stUserDefect.y);
+
+			str.Format(_T("%d_area_width_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, stUserDefect.area_width);
+
+			str.Format(_T("%d_area_height_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, stUserDefect.area_height);			
+
+			str.Format(_T("%d_defect_width_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, stUserDefect.defect_width);			
+
+			str.Format(_T("%d_defect_height_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, stUserDefect.defect_height);			
+
+			str.Format(_T("%d_defect_threshold_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, stUserDefect.defect_threshold);			
+
+			str.Format(_T("%d_defect_dilation_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, stUserDefect.defect_dilation);	
+
+		}
+	}
+
+	profile.WriteToFile();
+
+	return TRUE;
+}
+
+BOOL CGlassRecipe::LoadExpAreaList()
+{
+	CString strRecipe;
+
+	strRecipe.Format(_T("%s\\ExpArea\\%s_ExpArea.ins"), RECIPE_PATH, GetRecipeName());	
+
+	CConfig profile;
+
+	if(profile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strRecipe, FileMap_Mode) == FALSE)
+	{
+		CFile File;
+		if (!File.Open((TCHAR*)(LPCTSTR)strRecipe, CFile::modeCreate))
+		{			
+			return FALSE;
+		}
+		File.Close();
+	}
+
+	DeleteExpAreaList();
+
+	CString			str;
+	int				nValue;
+	for (int index = 0; index < MAX_DIMENSION_COUNT; index++)
+	{		
+		int list_count = 0;
+
+		str.Format(_T("%d_cnt"),index);
+		profile.GetItemValue((TCHAR*)(LPCTSTR)str, list_count);
+
+		for (int count = 0; count < list_count; count++)
+		{
+			EXECPTION_AREA	*pExp = new EXECPTION_AREA();
+
+			str.Format(_T("%d_AppDefect_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, pExp->nAppDefect);
+
+			str.Format(_T("%d_ErrSizeCX_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, nValue);
+			pExp->szErrSize.cx = nValue;
+
+			str.Format(_T("%d_ErrSizeCY_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, nValue);
+			pExp->szErrSize.cy = nValue;
+
+			str.Format(_T("%d_Area_Top_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, nValue);			
+			pExp->rc.top = nValue;
+
+			str.Format(_T("%d_Area_Bottom_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, nValue);					
+			pExp->rc.bottom = nValue;
+
+			str.Format(_T("%d_Area_Left_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, nValue);			
+			pExp->rc.left = nValue;
+
+			str.Format(_T("%d_Area_Right_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, nValue);			
+			pExp->rc.right = nValue;
+
+			str.Format(_T("%d_Area_Type_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, pExp->nAreaType);	
+
+			str.Format(_T("%d_DetectLimitedArea_%d"),index,count);
+			profile.GetItemValue((TCHAR*)(LPCTSTR)str, pExp->nDetectLimitedArea);
+
+			m_ExpAreaPrm[index].push_back(pExp);
+		}
+	}
+
+	return TRUE;
+}
+
+BOOL CGlassRecipe::SaveExpAreaList()
+{
+	CString strRecipe;
+
+	strRecipe.Format(_T("%s\\ExpArea\\%s_ExpArea.ins"), RECIPE_PATH, GetRecipeName());	
+
+	CConfig profile;
+
+	if(profile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strRecipe, FileMap_Mode) == FALSE)
+	{
+		CFile File;
+		if (!File.Open((TCHAR*)(LPCTSTR)strRecipe, CFile::modeCreate))
+		{			
+			return FALSE;
+		}
+		File.Close();
+	}
+
+	CString			str;
+	int				nValue;
+	EXECPTION_AREA	*pExp;
+	for (int index = 0; index < MAX_DIMENSION_COUNT; index++)
+	{			
+		int count = 0;
+
+		str.Format(_T("%d_cnt"),index);
+		profile.SetItemValue((TCHAR*)(LPCTSTR)str, (int)m_ExpAreaPrm[index].size());
+
+		for (itEXCEPTION_AREA_LIST it=m_ExpAreaPrm[index].begin();it!=m_ExpAreaPrm[index].end();it++)
+		{
+			pExp = *it;
+
+			str.Format(_T("%d_AppDefect_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, pExp->nAppDefect);
+
+			str.Format(_T("%d_ErrSizeCX_%d"),index,count);
+			nValue = pExp->szErrSize.cx;
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, nValue);			
+
+			str.Format(_T("%d_ErrSizeCY_%d"),index,count);
+			nValue = pExp->szErrSize.cy;
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, nValue);			
+
+			str.Format(_T("%d_Area_Top_%d"),index,count);
+			nValue = pExp->rc.top;
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, nValue);						
+
+			str.Format(_T("%d_Area_Bottom_%d"),index,count);
+			nValue = pExp->rc.bottom;
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, nValue);								
+
+			str.Format(_T("%d_Area_Left_%d"),index,count);
+			nValue = pExp->rc.left;
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, nValue);			
+
+			str.Format(_T("%d_Area_Right_%d"),index,count);
+			nValue = pExp->rc.right;
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, nValue);						
+
+			str.Format(_T("%d_Area_Type_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, pExp->nAreaType);	
+
+			str.Format(_T("%d_DetectLimitedArea_%d"),index,count);
+			profile.SetItemValue((TCHAR*)(LPCTSTR)str, pExp->nDetectLimitedArea);		
+
+			count++;
+		}
+	}
+
+	profile.WriteToFile();
+
+	return TRUE;
+}
\ No newline at end of file
diff --git a/ENRIT/Recipe/GlassRecipe.h b/ENRIT/Recipe/GlassRecipe.h
new file mode 100644
index 0000000..d307850
--- /dev/null
+++ b/ENRIT/Recipe/GlassRecipe.h
@@ -0,0 +1,1095 @@
+锘�#pragma once
+
+#include "cv.h"
+#include "highgui.h"
+#include "opencv.hpp"
+#include "core.hpp"
+#include <vector>
+#include <algorithm>//20140528
+#include "HardwareSettings.h"
+
+#define MAX_STRING_LENGTH			1024
+
+typedef struct tagJUDGEEDGE
+{
+	BOOL bError;			// 閿欒涓庡惁鈥�
+	int  nRefernce;			// 鏍囧噯 	
+	int  nTolPlus;			// +瀹硅璇樊
+	int  nTolMinus;			// -瀹硅璇樊
+	int  nSlant;			// 鏂滅嚎
+}JUDGEEDGE, *PJUDGEEDGE;
+
+typedef struct tagUserDefectArea
+{
+	int x;
+	int y;
+	int area_width;
+	int area_height;
+	int defect_threshold;
+	int defect_dilation;
+	int defect_width;
+	int defect_height;
+
+	void clear(void)
+	{
+		x = 0;
+		y = 0;
+		area_width = 0;
+		area_height = 0;
+		defect_threshold = 0;
+		defect_dilation = 0;
+		defect_width = 0;
+		defect_height = 0;
+	}
+
+	tagUserDefectArea(void)
+	{
+		clear();
+	}
+}ST_USER_DEFECT_AREA;
+
+typedef struct tagEXECPTION_AREA
+{
+	int		nAreaType;
+	CRect	rc;			// 鍖哄煙浣嶇疆锛圡ark 鍘熺偣锛�	
+	SIZE	szErrSize;  // 鍦ㄨ繖涓鍩熼�傜敤鐨凷ize    
+	int		nAppDefect; // 閫傜敤鐨凞efect绉嶇被
+	int		nDetectLimitedArea;	// 鏄惁浣跨敤鑷畾涔塕OI
+
+	void Init()
+	{
+		nAreaType  = 0;
+		nAppDefect = 0;
+		nDetectLimitedArea = 0;
+		rc = CRect(0,0,0,0);
+		szErrSize.cx = 0;
+		szErrSize.cy = 0;		
+	};
+
+	void CopyData(tagEXECPTION_AREA *pExp)
+	{
+		nAreaType = pExp->nAreaType;
+		rc = pExp->rc;
+		szErrSize = pExp->szErrSize;
+		nAppDefect = pExp->nAppDefect;
+		nDetectLimitedArea = pExp->nDetectLimitedArea;	
+	}
+
+}EXECPTION_AREA;
+
+typedef std::vector<EXECPTION_AREA*>  EXCEPTION_AREA_LIST;
+typedef EXCEPTION_AREA_LIST::iterator itEXCEPTION_AREA_LIST;
+typedef std::vector<ST_USER_DEFECT_AREA> USER_DEFECT_AREA_LIST;
+typedef std::vector<ST_USER_DEFECT_AREA>::iterator itUSER_DEFECT_AREA_LIST;
+
+typedef struct stLinkList
+{
+	CString m_strUpperName;
+	CString m_strStepName;
+	CString m_strInsName;
+
+public:
+	stLinkList()
+	{
+		reset();
+	}
+	void reset()
+	{
+		m_strUpperName = _T("");
+		m_strStepName = _T("");
+		m_strInsName = _T("");		
+	}
+} LinkList, *pLinkList;
+typedef std::vector<LinkList*>				VectorLinkList;
+typedef std::vector<LinkList*>::iterator	VectorLinkListIt;
+
+class CRECIPE_INFO_PARM
+{	
+public:
+	CRECIPE_INFO_PARM();
+	virtual ~CRECIPE_INFO_PARM(void);
+	CRECIPE_INFO_PARM& operator=(CRECIPE_INFO_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();
+	void		SetRecipeName(CString strRecipe);
+	void		SetRecipeFileName(CString strFile);
+
+	void		SetRecipeFileNameBackUp(CString strFile);
+	CString		GetRecipeName();
+	CString		GetRecipeFileName();
+
+
+public:
+	TCHAR		m_strRecipeName[MAX_STRING_LENGTH];			  // 閰嶆柟鍚嶇О
+	TCHAR		m_strRecipeFileName[MAX_STRING_LENGTH];		  // 閰嶆柟鏂囦欢鍚嶇О
+
+	TCHAR		m_strRecipeFileNameBackUp[MAX_STRING_LENGTH]; // 閰嶆柟鏂囦欢鍚嶅浠�
+	int			m_nSoftRevision;			
+};
+
+typedef struct _STU_EXTRA_CHIP_REG
+{
+	DimensionDir	enSide;
+	BOOL			bTB;
+	int				nStartY;
+	int				nYSize;			
+	int				nSizeX;
+	int				nChamferThres;
+	int				nChipThres;
+	int				nJudgeBase;
+	int				nJudgeDiff;
+	int				nChipWidth;
+	int				nChipHeight;
+
+	_STU_EXTRA_CHIP_REG()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		enSide = DIMENSION_NONE;
+		nStartY = nYSize = 0;		
+		nSizeX = nChamferThres = nChipThres = 0;
+		nJudgeBase = nJudgeDiff = 0;
+		nChipWidth = nChipHeight = 0;
+	}
+
+} STU_EXTRA_CHIP_REG, *pSTU_EXTRA_CHIP_REG;
+
+typedef struct _STU_CUTAREA_EXP_POS
+{
+	DimensionDir	enSide;
+	int				nPosY;
+	int				nSize;	
+	ExpRegionType	enERType;
+	int				nPosX;
+	int				nSizeX;
+
+	_STU_CUTAREA_EXP_POS()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		enSide = DIMENSION_NONE;
+		nPosY = nSize = 0;
+		enERType = ER_NONE;
+		nPosX = nSizeX = 0;
+	}
+
+} STU_CUTAREA_EXP_POS, *pSTU_CUTAREA_EXP_POS;
+
+typedef struct _STU_CUTAREA_PARM
+{
+	BOOL		m_bCutArea;			
+	int			m_nThresT,m_nThresB;	
+	int			m_nSearchWidth;	
+	int			m_nCalArea;	
+
+	_STU_CUTAREA_PARM()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_bCutArea = FALSE;
+		m_nThresT = m_nThresB = m_nSearchWidth = m_nCalArea = 0;		
+	}
+
+} STU_CUTAREA_PARM, *pSTU_CUTAREA_PARM;
+
+typedef struct _STU_CUTAREA_ALIGN_MARK//20140611
+{
+	BOOL		m_bCutAreaAlignMark;		
+	int			m_nMarkXPos[2];
+	int			m_nMarkXSize[2];
+	int			m_nMarkYPos[2];
+	int			m_nMarkYSize[2];
+	int			m_nAlign2GlassPos;
+
+	_STU_CUTAREA_ALIGN_MARK()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_bCutAreaAlignMark = FALSE;
+		for (int i=0; i<2; i++)
+		{
+			m_nMarkXPos[i] = 0;
+			m_nMarkXSize[i] = 0;
+			m_nMarkYPos[i] = 0;
+			m_nMarkYSize[i] = 0;			
+		}
+		m_nAlign2GlassPos = 0;			
+	}
+
+} STU_CUTAREA_ALIGN_MARK, *pSTU_CUTAREA_ALIGN_MARK;
+
+typedef struct _STU_CHIP_PARM
+{
+	BOOL		m_bChipping;
+	int			m_nThresMode;		// 0:Fixed,1:First Line,2:Max Line
+	int			m_nChippingInsArea;
+	int			m_nCrackINsArea;
+	int			m_nBrokenInsArea;
+	int			m_nChippingThres_T;
+	int			m_nChippingThres_T_White;
+	int			m_nChipDiffThres;
+
+	int			m_nChippingThres_B;
+	int			m_nChippingThres_T_L;
+	int			m_nChippingThres_B_L;
+	int			m_nCrackThres;
+	int			m_nBrokenThres;
+
+	// 20.11.14 - Candidate Filtering..
+	int			m_nChippingInsMinSize;
+	int			m_nCrackInsMinSize;
+	int			m_nBrokenInsMinSize;
+	int			m_nBurrInsMinSize;
+
+	int			m_nChippingInsSideFilterRange;
+	int			m_nCrackInsSideFilterRange;
+	int			m_nBrokenInsSideFilterRnage;
+	int			m_nBurrInsSideFilterRange;
+
+	_STU_CHIP_PARM()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_nThresMode = 0;
+		m_bChipping = FALSE;		
+		m_nChippingInsArea = m_nChippingThres_T = m_nChippingThres_B = 0;
+		m_nChippingThres_T_White = 255;
+		m_nCrackINsArea = m_nBrokenInsArea = 0;
+		m_nChippingThres_T_L = m_nChippingThres_B_L = 0;		
+		m_nCrackThres = m_nBrokenThres = 0;
+		m_nChipDiffThres = 255;
+
+		m_nChippingInsMinSize = m_nCrackInsMinSize = m_nBrokenInsMinSize = m_nBurrInsMinSize = 5;
+
+		m_nChippingInsSideFilterRange = m_nCrackInsSideFilterRange = m_nBrokenInsSideFilterRnage = m_nBurrInsSideFilterRange = 10;
+	}
+
+} STU_CHIP_PARM, *pSTU_CHIP_PARM;
+
+class CCUTAREA_PARM
+{	
+public:
+	CCUTAREA_PARM();
+	virtual ~CCUTAREA_PARM(void);
+	CCUTAREA_PARM& operator=(CCUTAREA_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();	
+	CString		GetFileString(void *pValue);
+	BOOL		GetCutAreaUse(int iPos);	
+	BOOL		GetChipUse(int iPos);		
+	BOOL		GetCutAreaAlignMarkUse(int iPos);//20140611
+
+	pSTU_CUTAREA_PARM	GetCutAreaParm(int iPos)
+	{
+		if(iPos>=0 && iPos<MAX_DIMENSION_COUNT)
+			return &m_stuCutAreaParm[iPos];
+		else
+			return NULL;		
+	}
+	pSTU_CHIP_PARM		GetChipParm(int iPos)
+	{		
+		if(iPos>=0 && iPos<MAX_DIMENSION_COUNT)
+			return &m_stuChipParm[iPos];
+		else
+			return NULL;						
+	}
+	std::vector<STU_CUTAREA_EXP_POS>	*GetExpArea(int iPos){return iPos>=0&&iPos<MAX_DIMENSION_COUNT?&m_vecCutAreaExpPos[iPos]:NULL;}
+
+	pSTU_CUTAREA_ALIGN_MARK		GetCutAreaAlignMark(int iPos)//20140611
+	{		
+		if(iPos>=0 && iPos<MAX_DIMENSION_COUNT)
+			return &m_stuCutAreaAlignMark[iPos];
+		else
+			return NULL;						
+	}
+
+public:	
+	STU_CUTAREA_PARM	m_stuCutAreaParm[MAX_DIMENSION_COUNT];
+	STU_CHIP_PARM		m_stuChipParm[MAX_DIMENSION_COUNT];
+	std::vector<STU_CUTAREA_EXP_POS> m_vecCutAreaExpPos[MAX_DIMENSION_COUNT];
+	STU_CUTAREA_ALIGN_MARK m_stuCutAreaAlignMark[MAX_DIMENSION_COUNT];//20140611
+};
+
+class CCORNER_PARM
+{	
+public:
+	CCORNER_PARM();
+	virtual ~CCORNER_PARM(void);
+	CCORNER_PARM& operator=(CCORNER_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();
+	CString		GetFileString(void *pValue);
+
+public:	
+	BOOL		m_bSaveImage;	
+
+	BOOL		m_bUse;
+	int			m_Thres[MAX_DIMENSION_COUNT];	
+};
+
+enum DIMEN_FIND_TYPE{DIM_TYPE_PATTERN=0,DIM_TYPE_BMPOS,DIM_TYPE_NONE};
+typedef struct _STU_DI_POS
+{
+	int			nBasePosX;
+	int			nBasePosY;
+	int			nSearchX;
+	int			nSearchY;
+
+	_STU_DI_POS()
+	{
+		nBasePosX = nBasePosY = nSearchX = nSearchY = 0;
+	}	
+} STU_DI_POS, *pSTU_DI_POS;
+
+typedef struct _STU_DIMEN_INS_PRM
+{
+	BOOL		m_bUsePos;		
+	int			m_nCamDir;
+	int			m_nJudgeSetSize;
+	int			m_nJudgeSizeRange;	
+	int			m_nOffset;
+	int			m_nDetThres;
+	DIMEN_FIND_TYPE			m_enDimenType;
+
+	_STU_DIMEN_INS_PRM()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_bUsePos = FALSE;
+		m_nJudgeSetSize = m_nJudgeSizeRange = m_nOffset = m_nDetThres = m_nCamDir = 0;
+		m_enDimenType = DIM_TYPE_NONE;
+	}
+} STU_DIMEN_INS_PRM, *pSTU_DIMEN_INS_PRM;
+
+class CDIMENSION_PARM
+{	
+public:
+	CDIMENSION_PARM();
+	virtual ~CDIMENSION_PARM(void);
+	CDIMENSION_PARM& operator=(CDIMENSION_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();
+	CString		GetFileString(void *pValue);
+	BOOL		GetDimenUse(int iPos);
+
+	pSTU_DIMEN_INS_PRM		GetDimenIns(int iPos){return iPos>=0&&iPos<MAX_DIMENSION_COUNT?&m_DimInsParm[iPos]:NULL;}
+	std::vector<STU_DI_POS>	*GetDimenPos(int iPos){return iPos>=0&&iPos<MAX_DIMENSION_COUNT?&m_vecDiPosition[iPos]:NULL;}
+
+public:				
+	BOOL					m_bSaveDimImage;
+	STU_DIMEN_INS_PRM		m_DimInsParm[MAX_DIMENSION_COUNT];
+	std::vector<STU_DI_POS> m_vecDiPosition[MAX_DIMENSION_COUNT];	
+};
+
+typedef struct _STU_SPLINE_CHIP_POS
+{
+	enum MAKE_IMAGE_METHOD{MAKE_METHOD_LINEAR=0,MAKE_METHOD_REGRESSION,MAKE_METHOD_NONE};
+	enum MAKE_IMAGE_POS{MAKE_IMAGE_POS_CCUT=0,MAKE_IMAGE_POS_RCUT,MAKE_IMAGE_POS_NONE};
+	enum SPLINE_INS_DIRECTION{SPLINE_INS_DIRECTION_X=0,SPLINE_INS_DIRECTION_Y,SPLINE_INS_DIRECTION_NONE};
+
+	BOOL		bUse;	
+	int			nStartX;
+	int			nEndX;	
+	int			nThres;
+	int			nFindThres;	
+	int			nInsRange;
+	int			nSkipDist;
+	MAKE_IMAGE_METHOD emMethod;
+	MAKE_IMAGE_POS	emPos;
+	SPLINE_INS_DIRECTION emDir;
+
+	_STU_SPLINE_CHIP_POS()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bUse = FALSE;
+		nStartX = nEndX = nThres = nFindThres = nInsRange = nSkipDist = 0;
+		emMethod = MAKE_METHOD_NONE;
+		emPos = MAKE_IMAGE_POS_NONE;	
+		emDir = SPLINE_INS_DIRECTION_NONE;
+	}
+} STU_SPLINE_CHIP_POS, *pSTU_SPLINE_CHIP_POS;
+
+typedef struct _STU_SPLINE_CHIP_PARM
+{	
+	BOOL		m_bSplineChip;		
+	int			m_nChipSize_Y;
+	int			m_nChipSize_X;
+	BOOL		m_bChipJudgeAnd;
+	int			m_nChipInsArea;
+	int			m_nChipThres;	
+	BOOL		m_bCornerUse;
+	int			m_nCornerThres;	
+	int			m_nCornerRange;
+	double		m_dChipStartTheta;
+	double		m_dChipEndTheta;
+	double		m_dChipDistTheta;
+
+	_STU_SPLINE_CHIP_PARM()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_bSplineChip = FALSE;
+		m_bChipJudgeAnd = FALSE;
+		m_nChipSize_X = m_nChipSize_Y = 0;		
+		m_nChipInsArea = m_nChipThres = 0;
+		m_bCornerUse = m_nCornerThres = m_nCornerRange = 0;
+		m_dChipDistTheta = m_dChipEndTheta = m_dChipDistTheta = 0;
+	}
+} STU_SPLINE_CHIP_PARM, *pSTU_SPLINE_CHIP_PARM;
+
+enum	EM_SPLINE_TYPE{EM_SP_CCUT=0,EM_SP_RCUT,EM_SP_NONE};
+typedef struct _STU_SPLINE_INS_PARM
+{
+	BOOL		m_bSpline;	
+	BOOL		m_bSplinePointJudge;	
+	int			m_DetMinPointDist;
+	
+	int			m_nStartCornerSize_Y;
+	int			m_nStartCornerRadius_um;
+
+	int			m_nEndCornerSize_Y;
+	int			m_nEndCornerRadius_um;
+
+	int			m_DetMinDist;
+	int			m_nLineThres;
+	EM_SPLINE_TYPE	m_emSPType;
+	BOOL		m_bSplineCorner;
+
+	int			m_nStartChamferSize;
+	int			m_nEndChamferSize;
+
+	_STU_SPLINE_INS_PARM()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_bSpline = FALSE;
+		m_bSplinePointJudge = FALSE;
+		m_DetMinPointDist = 50;
+
+		m_nStartCornerSize_Y = 0;
+		m_nStartCornerRadius_um = 0;
+
+		m_nEndCornerSize_Y = 0;
+		m_nEndCornerRadius_um = 0;
+
+		m_nLineThres = 0;	
+		m_DetMinDist = 50;
+		m_emSPType = EM_SP_NONE;
+		m_bSplineCorner = FALSE;
+
+		m_nStartChamferSize = -1;
+		m_nEndChamferSize = -1;
+	}
+} STU_SPLINE_INS_PARM, *pSTU_SPLINE_INS_PARM;
+
+class CSPLINE_PARM
+{	
+public:
+	CSPLINE_PARM();
+	virtual ~CSPLINE_PARM(void);
+	CSPLINE_PARM& operator=(CSPLINE_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();
+	CString		GetFileString(void *pValue);
+	BOOL		GetSplineUse(int iPos);
+	BOOL		GetSplineUsePointJudge(int iPos);
+	BOOL		GetSplineChipUse(int iPos);
+
+	pSTU_SPLINE_INS_PARM	GetSplineIns(int iPos){return iPos>=0&&iPos<MAX_DIMENSION_COUNT?&m_SP_InsParm[iPos]:NULL;}
+	pSTU_SPLINE_CHIP_PARM	GetSplineChipIns(int iPos){return iPos>=0&&iPos<MAX_DIMENSION_COUNT?&m_SP_ChipParm[iPos]:NULL;}
+	std::vector<STU_SPLINE_CHIP_POS>	*GetSplineChipPos(int iPos){return iPos>=0&&iPos<MAX_DIMENSION_COUNT?&m_vecSplineChip[iPos]:NULL;}
+
+public:	
+	BOOL						m_bSP_SaveImg;
+	STU_SPLINE_INS_PARM			m_SP_InsParm[MAX_DIMENSION_COUNT];
+	STU_SPLINE_CHIP_PARM		m_SP_ChipParm[MAX_DIMENSION_COUNT];
+	std::vector<STU_SPLINE_CHIP_POS> m_vecSplineChip[MAX_DIMENSION_COUNT];	
+};
+
+typedef struct _STU_NOTCH_POS//20140528
+{
+	int			nPosX;
+	int			nPosY;
+
+	_STU_NOTCH_POS()
+	{
+		nPosX = nPosY = 0;
+	}	
+} STU_NOTCH_POS, *pSTU_NOTCH_POS;
+
+enum EM_NOTCH_INS_DIR{INS_DIR_NORMAL = 0, INS_DIR_DY, INS_DIR_NONE};
+typedef struct _STU_NOTCH_DATA
+{
+	BOOL		bChipIns;
+	BOOL		bSizeIns;
+	int			nChipDiff;	
+	int			nSizeDiff;
+	int			nDetThres;		
+	int			nSizeThres;
+	int			nChipThres;
+	double		dBlank2EdgeRatio;
+	int			nVStart;
+	int			nVSize;
+	int			nMarkXPos[2];
+	int			nMarkXSize[2];
+	int			nMarkYPos[2];
+	int			nMarkYSize[2];
+	int			nAlign2GlassPos;
+	int			nJudgeBaseWidth;
+	int			nJudgeDiffWidth;
+
+	int			nSkipSize;
+	BOOL		bSpChipIns[2];
+	int			nSpChipSize[2];
+
+	BOOL		bPointInsDimensionJudge;//20140528
+	BOOL		bPointInsChamferJudge;//20140721
+	int			nPointInsAveCount;//20140528
+
+	_STU_NOTCH_DATA()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bChipIns = bSizeIns = FALSE;
+		nChipDiff = nSizeDiff = 0;
+		nDetThres = nSizeThres = 0;
+		nChipThres = nVStart = nVSize = 0;	
+		ZeroMemory(nMarkXPos,sizeof(int)*2);
+		ZeroMemory(nMarkXSize,sizeof(int)*2);
+		ZeroMemory(nMarkYPos,sizeof(int)*2);
+		ZeroMemory(nMarkYSize,sizeof(int)*2);				
+		nJudgeBaseWidth = nJudgeDiffWidth = 0;
+		nAlign2GlassPos = 0;
+		nSkipSize = 0;
+		dBlank2EdgeRatio = 0.;
+		ZeroMemory(bSpChipIns,sizeof(BOOL)*2);
+		ZeroMemory(nSpChipSize,sizeof(int)*2);
+		bPointInsDimensionJudge = FALSE;//20140721
+		bPointInsChamferJudge = FALSE;//20140721
+		nPointInsAveCount = 5;
+	}
+
+} STU_NOTCH_DATA, *pSTU_NOTCH_DATA;
+
+#define MAX_NOTCH_INS_POS_COUNT 100//20140528
+class CNOTCH_PARM
+{	
+public:
+	CNOTCH_PARM();
+	virtual ~CNOTCH_PARM(void);
+	CNOTCH_PARM& operator=(CNOTCH_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();
+	CString		GetFileString(void *pValue);	
+	BOOL		GetNotchSizeUse(int iPos);
+	BOOL		GetNotchChipUse(int iPos);
+
+	pSTU_NOTCH_DATA	GetNotchIns(int iPos){return iPos>=0&&iPos<MAX_DIMENSION_COUNT?&m_NotchParm[iPos]:NULL;}	
+	std::vector<CPoint>	*GetNotchPos(int iPos){return iPos>=0&&iPos<MAX_DIMENSION_COUNT?&m_vecNotchPosition[iPos]:NULL;}//20140528
+
+public:
+	STU_NOTCH_DATA m_NotchParm[MAX_DIMENSION_COUNT];
+	std::vector<CPoint> m_vecNotchPosition[MAX_DIMENSION_COUNT];//20140528
+};
+
+typedef struct _SortCPointYPos {//20140528
+	BOOL operator() (CPoint pt1, CPoint pt2) { return (pt1.y < pt2.y);}
+} SortCPointYPos;
+
+
+class CVCR_PARM
+{	
+public:
+	CVCR_PARM();
+	virtual ~CVCR_PARM(void);
+	CVCR_PARM& operator=(CVCR_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();
+	CString		GetFileString(void *pValue);
+	CRect		GetRect();
+
+public:
+	BOOL		m_bVCR;	
+	BOOL		m_bAlarm;
+	BOOL		m_bSetResult;
+	int			m_nVCPosY;
+	int			m_nVCPosX;
+	int			m_nHeight;
+	int			m_nWidth;
+	BOOL		m_nCamDir;
+};
+
+class CETC_PARM
+{	
+public:
+	CETC_PARM();
+	virtual ~CETC_PARM(void);
+	CETC_PARM& operator=(CETC_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile,int nIdx);
+	BOOL		WriteRecipe(CConfig *pFile,int nIdx);
+
+public:
+	void		Reset();
+	CString		GetFileString(void *pValue,int nIdx);
+
+public:	
+	int			m_nGlassFindthres_Top;
+	int			m_nGlassFindHeight_Top;
+	int			m_nGlassFindthres_Left;
+	int			m_nGlassFindWidth_Left;	
+	int			m_nGlassLeftLineMargin[2];	
+};
+//park
+enum LIGHT_CONTROL_METHOD{LIGHT_CONTROL_METHOD_AUTO=0,LIGHT_CONTROL_METHOD_MANUAL,LIGHT_CONTROL_METHOD_NONE};
+
+#define		LIGHT_CONTROL_COUNT			2
+#define		LIGHT_CONTROL_CH_COUNT		4
+
+class CLIGHT_PARM
+{	
+public:
+	CLIGHT_PARM();
+	virtual ~CLIGHT_PARM(void);
+	CLIGHT_PARM& operator=(CLIGHT_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();
+	CString		GetFileString(void *pValue);
+
+public:
+	BOOL		m_bLightControl;			
+	int			m_nContValue[LIGHT_CONTROL_COUNT][LIGHT_CONTROL_CH_COUNT];
+
+	void		SetContValue(int nIdx, int nCh, int nContValue);		
+};
+
+enum EM_GLASSTYPE_COMP{GLASSTYPE_RCUT=0,GLASSTYPE_CCUT,GLASSTYPE_NCUT};
+class CGLASS_INFO_PARM
+{	
+public:
+	CGLASS_INFO_PARM();
+	virtual ~CGLASS_INFO_PARM(void);
+	CGLASS_INFO_PARM& operator=(CGLASS_INFO_PARM& rh);
+
+public:
+	void			Reset();
+	BOOL			ReadRecipe(CConfig *pFile);
+	BOOL			WriteRecipe(CConfig *pFile);	
+	double			GetOneScanTime(){return m_dOneScanTime;}
+	BOOL			GetOneSacnMode(){return m_bOneScanMode;}
+
+protected:	
+	CString			GetFileString(void *pValue);	
+
+public:	
+	int					m_nGlassSizeX;
+	int					m_nGlassSizeY;
+	int					m_nGlassImageSize;
+	int					m_nGlassImageLeftMargin;	
+	BOOL				m_bGlassFullImageSave;
+	BOOL				m_bAllImageSave;
+	GlassDirection		m_OriginDirection;
+	CString				m_strDisp;	
+	BOOL				m_bGlassDefaultImageSave;
+	BOOL				m_bOneScanMode;
+	BOOL				m_bPanelReverse;
+	double				m_dOneScanTime;
+	EM_GLASSTYPE_COMP	m_emGlassType;
+	int					m_nFindGlassStartOffset[MAX_DIMENSION_COUNT];
+	int					m_nGlassFindHorPos[MAX_DIMENSION_COUNT];
+};
+
+typedef struct stuDEFECT_CONDITION
+{
+	BOOL bError;						// 鏄惁鍙戠敓閿欒
+	BOOL bConditionAND;					// TRUE: Width鍜孒eight閮芥弧瓒虫墠浼氬彂鐢烢rror
+	SIZE szDefect;						// Defect澶у皬
+	int  nMerge;						// 鍚堝苟
+
+	stuDEFECT_CONDITION(void)
+	{
+		bError = FALSE;
+		bConditionAND = FALSE;
+		szDefect.cx = 0;
+		szDefect.cy = 0;
+		nMerge = 0;
+	}
+}DEFECT_CONDITION;
+
+typedef struct tagJUDGE_DEFECT
+{
+
+	DEFECT_CONDITION Chip_Side;				
+	DEFECT_CONDITION Burr_Side;
+	DEFECT_CONDITION Broken;
+	DEFECT_CONDITION Bevel;
+	DEFECT_CONDITION Chip_CF;				
+	DEFECT_CONDITION Burr_CF;	
+	DEFECT_CONDITION Crack;
+	DEFECT_CONDITION Compare_Panel;
+
+	int nRangeStart;
+	int nRangeEnd;
+}JUDGE_DEFECT, *PJUDGE_DEFECT;
+
+typedef struct tagJUDGE_EDGE
+{
+	BOOL bError;			// 閿欒涓庡惁
+	int  nRefernce;			// 鏍囧噯 	
+	int  nTolPlus;			// +瀹硅璇樊
+	int  nTolMinus;			// -瀹硅璇樊
+}JUDGE_EDGE, *PJUDGE_EDGE;
+
+typedef struct tagJUDGE_AVG
+{
+	BOOL bUse;			
+	int  nDiff;					
+}JUDGE_AVG, *PJUDGE_AVG;
+
+#define		MAX_MARKER_COUNT		3
+#define		MAX_POS_MARKER_COUNT	3
+class CINSPECT_JUDGEMENT_PARM
+{
+public:
+	CINSPECT_JUDGEMENT_PARM(void);
+	virtual ~CINSPECT_JUDGEMENT_PARM(void);
+	CINSPECT_JUDGEMENT_PARM& operator=(CINSPECT_JUDGEMENT_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();	
+
+public:
+	JUDGE_EDGE	corner_X[MAX_PANEL_SIDE];
+	JUDGE_EDGE	corner_Y[MAX_PANEL_SIDE];
+	JUDGE_EDGE	grind[2][MAX_PANEL_SIDE];
+	JUDGE_EDGE	chamfer[2][MAX_PANEL_SIDE];
+	JUDGE_EDGE	cutting[2][MAX_PANEL_SIDE]; // 鎴柇閲忓垽瀹氭爣鍑�
+	CPoint		ptAlign[MAX_MARKER_COUNT][MAX_DIMENSION_COUNT];
+	JUDGE_EDGE	EdgeToSubMark[MAX_DIMENSION_COUNT];
+	JUDGE_DEFECT defect[MAX_DIMENSION_COUNT][3];	
+	JUDGE_EDGE	Dimension[MAX_DIMENSION_COUNT];	
+	int			nCFGrind[MAX_PANEL_SIDE];
+	BOOL		bUseLengthDepthComp;
+	int			nCornerJugeLength;
+	int			nCornerJugeDepth;
+	JUDGE_AVG	AvgProfile[MAX_DIMENSION_COUNT];
+	JUDGE_AVG	AvgChamfer[MAX_DIMENSION_COUNT];
+
+	int			nMinProfileNgCount[MAX_DIMENSION_COUNT];
+	int			nMinProfileNgCount_MinDiff[MAX_DIMENSION_COUNT];
+};
+
+class CINSPECT_INFO_PARM
+{
+public:
+	CINSPECT_INFO_PARM(void);
+	virtual ~CINSPECT_INFO_PARM(void);
+	CINSPECT_INFO_PARM& operator=(CINSPECT_INFO_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();	
+
+	BOOL		GetCutAreaUse(DimensionDir enDimen){return m_CutAreaParm.GetCutAreaUse((int)enDimen);}	
+	BOOL		GetCutAreaAlignMarkUse(DimensionDir enDimen){return m_CutAreaParm.GetCutAreaAlignMarkUse((int)enDimen);}
+	BOOL		GetChipUse(DimensionDir enDimen){return m_CutAreaParm.GetChipUse((int)enDimen);}	
+	BOOL		GetDimenUse(DimensionDir enDimen){return m_DimensionParm.GetDimenUse((int)enDimen);}
+	BOOL		GetSplineUse(DimensionDir enDimen){return m_SplineParm.GetSplineUse((int)enDimen);}
+	BOOL		GetSplineChipUse(DimensionDir enDimen){return m_SplineParm.GetSplineChipUse((int)enDimen);}
+	BOOL		GetNotchSizeUse(DimensionDir enDimen){return m_NotchParm.GetNotchSizeUse((int)enDimen);}
+	BOOL		GetNotchChipUse(DimensionDir enDimen){return m_NotchParm.GetNotchChipUse((int)enDimen);}
+	BOOL		GetSplineUsePointJudge(int iPos){return m_SplineParm.GetSplineUsePointJudge(iPos);}
+
+	CCUTAREA_PARM		*GetCutParm(){return &m_CutAreaParm;}
+	pSTU_CUTAREA_PARM	GetCutAreaParm(DimensionDir enDimen){return m_CutAreaParm.GetCutAreaParm((int)enDimen);}
+	pSTU_CHIP_PARM		GetChipParm(DimensionDir enDimen){return m_CutAreaParm.GetChipParm((int)enDimen);}
+	std::vector<STU_CUTAREA_EXP_POS>	*GetExpArea(DimensionDir enDimen){return m_CutAreaParm.GetExpArea((int)enDimen);}
+	pSTU_CUTAREA_ALIGN_MARK	GetCutAreaAlignMark(DimensionDir enDimen){return m_CutAreaParm.GetCutAreaAlignMark((int)enDimen);}//20140611
+
+	CCORNER_PARM		*GetCornerParm(){return &m_CornerParm;}
+
+	CDIMENSION_PARM			*GetDimensionParm(){return &m_DimensionParm;}
+	pSTU_DIMEN_INS_PRM		GetDimenIns(DimensionDir enDimen){return m_DimensionParm.GetDimenIns((int)enDimen);}
+	std::vector<STU_DI_POS>	*GetDimenPos(DimensionDir enDimen){return m_DimensionParm.GetDimenPos((int)enDimen);}
+
+	CSPLINE_PARM			*GetSplineParm(){return &m_SplineParm;}
+	pSTU_SPLINE_INS_PARM	GetSplineIns(DimensionDir enDimen){return m_SplineParm.GetSplineIns((int)enDimen);}
+	pSTU_SPLINE_CHIP_PARM	GetSplineChipIns(DimensionDir enDimen){return m_SplineParm.GetSplineChipIns((int)enDimen);}
+	std::vector<STU_SPLINE_CHIP_POS>	*GetSplineChipPos(DimensionDir enDimen){return m_SplineParm.GetSplineChipPos((int)enDimen);}
+
+	CNOTCH_PARM				*GetNotchParm(){return &m_NotchParm;}
+	pSTU_NOTCH_DATA			GetNotchIns(DimensionDir enDimen){return m_NotchParm.GetNotchIns((int)enDimen);}	
+
+public:	
+	CVCR_PARM			m_VCRParm;
+	CCUTAREA_PARM		m_CutAreaParm;
+	CCORNER_PARM		m_CornerParm;
+	CDIMENSION_PARM		m_DimensionParm;
+	CSPLINE_PARM		m_SplineParm;	
+	CNOTCH_PARM			m_NotchParm;
+	std::vector<STU_EXTRA_CHIP_REG> m_vecExtraChipReg;	
+
+	int					m_nRCutThresGlass[MAX_DIMENSION_COUNT][2];
+	int					m_nRCutThresChamfer[MAX_DIMENSION_COUNT][2];
+};
+
+
+class CALIGNMARK_PARM
+{	
+public:
+	CALIGNMARK_PARM();
+	virtual ~CALIGNMARK_PARM(void);
+	CALIGNMARK_PARM& operator=(CALIGNMARK_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile,int nIdx);
+	BOOL		WriteRecipe(CConfig *pFile,int nIdx);
+
+public:
+	void		Reset();		
+	void		MarkImgDelete();	
+
+public:
+	BOOL		m_bIsMark[MAX_MARKER_COUNT];	// 鏄惁瀛樺湪鏍囧織?
+	int			m_nMarkType[MAX_MARKER_COUNT];
+	double		m_dMarkMatchingRate[MAX_MARKER_COUNT][MAX_POS_MARKER_COUNT];		
+	JUDGEEDGE	m_JudgeAlign;		
+	IplImage	*IpMarkImg[MAX_MARKER_COUNT][MAX_POS_MARKER_COUNT];
+};
+
+enum	EM_INS_TYPE{EM_INS_EDGE=0,EM_INS_CORNER,EM_INS_DIMENSION,EM_INS_SPLINE,EM_INS_NOTCH,EM_INS_SPLINE_POINT_JUDGE};
+
+// Hole Inspsect Parameter
+struct HOLE_INS_PARM
+{
+	int		m_nSideIdx;
+	CRect	m_rtArea;
+	CRect	m_rtHoleArea;
+	int		m_nThreshold;
+	int		m_nOffset;
+	int		m_nMinSize;
+	double  m_dMatRate;
+	CString m_strTemplatePath;
+};
+
+class CHOLEINSPECT_PARM
+{	
+public:
+	CHOLEINSPECT_PARM()						{Reset();};
+	virtual ~CHOLEINSPECT_PARM(void)		{Reset();};
+	CHOLEINSPECT_PARM& operator=(CHOLEINSPECT_PARM& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();		
+
+public:
+	int						m_nTotalHoleCount;
+	vector<HOLE_INS_PARM>	m_vecHoleInsParam;
+};
+// End of Hole Inspsect Parameter
+
+typedef struct tagProfileSetting
+{
+	double x;
+	double y;
+	double radius;
+	double plus;
+	double minus;
+	BOOL use;
+
+	tagProfileSetting(void)
+	{
+		x = 0.0;
+		y = 0.0;
+		radius = 0.0;
+		plus = 50.0;
+		minus = 50.0;
+		use = TRUE;
+	}
+}ST_PROFILE_SETTING;
+
+typedef struct tagChamferSetting
+{
+	double reference;
+	double plus;
+	double minus;
+	BOOL use;
+
+	tagChamferSetting(void)
+	{
+		reference = 100.0;
+		plus = 50.0;
+		minus = 50.0;
+		use = TRUE;
+	}
+}ST_CHAMFER_SETTING;
+
+
+
+class CProfileInspect_Prm
+{	
+public:
+	CProfileInspect_Prm()						{Reset();};
+	virtual ~CProfileInspect_Prm(void)		{Reset();};
+	CProfileInspect_Prm& operator=(CProfileInspect_Prm& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+
+public:
+	void		Reset();		
+
+public:
+	BOOL			m_bUseOriginAlignKey[MAX_DIMENSION_COUNT];
+	int				m_nOriginAlignKeyOffsetX[MAX_DIMENSION_COUNT];
+	int				m_nOriginAlignKeyOffsetY[MAX_DIMENSION_COUNT];
+	int				m_nOriginAlignKeyOffsetDwX[MAX_DIMENSION_COUNT];
+	int				m_nOriginAlignKeyOffsetDwY[MAX_DIMENSION_COUNT];
+
+	int				m_nCADOffsetX[MAX_DIMENSION_COUNT];
+	int				m_nCADOffsetY[MAX_DIMENSION_COUNT];
+	ST_PROFILE_SETTING	m_stProfile[MAX_PROFILE_SETTING_COUNT];
+	ST_CHAMFER_SETTING	m_stCamferUp[MAX_PROFILE_SETTING_COUNT];
+	ST_CHAMFER_SETTING	m_stCamferDn[MAX_PROFILE_SETTING_COUNT];	
+};
+
+class CGlassRecipe
+{
+public:
+	CGlassRecipe(void);
+	virtual ~CGlassRecipe(void);
+	CGlassRecipe& operator=(CGlassRecipe& rh);
+
+public:
+	BOOL		ReadRecipe(CConfig *pFile);
+	BOOL		WriteRecipe(CConfig *pFile);
+	BOOL		WriteRecipeFile();	
+	BOOL		WriteRecipeFileBackUp();
+	BOOL		MakeRecipeFileName(CString strRecipe);	
+	BOOL		MakeRecipeFileNameBackUp(CString strRecipe);
+	BOOL		ReadRecipeFile();
+
+	int			GetLightValue(int iCon,int iCh);
+	CINSPECT_INFO_PARM	*GetInspectInfo(){return &m_InspectInfoParm;}
+	CALIGNMARK_PARM	*GetAlignMarkPrm(DimensionDir eDim);
+	BOOL		LoadAlignMark();
+	BOOL		SaveAlignMark();
+
+	pSTU_CUTAREA_PARM	GetCutAreaPrm(DimensionDir eDim);
+	CCORNER_PARM		*GetCornerParm(){return m_InspectInfoParm.GetCornerParm();}
+
+	CETC_PARM			*GetEtcPrm(DimensionDir eDim);
+
+	CINSPECT_JUDGEMENT_PARM	*GetJudgePrm(){return &m_Judgement;}
+	USER_DEFECT_AREA_LIST	*GetUserDefectList(DimensionDir eDim){return &m_UserDefectPrm[eDim];}
+	EXCEPTION_AREA_LIST		*GetExpAreaList(DimensionDir eDim){return &m_ExpAreaPrm[eDim];}
+	CHOLEINSPECT_PARM		*GetHolePrm(){return &m_HoleInspectParm;}
+
+	CDIMENSION_PARM			*GetDimensionParm(){return m_InspectInfoParm.GetDimensionParm();}
+	CProfileInspect_Prm		*GetProfileParm(){return &m_ProfilePrm;}
+	CGLASS_INFO_PARM		*GetGlassInfo(){return &m_GlassParm;}
+
+	CString		GetRecipeName();
+	void		Reset();	
+
+	BOOL		Save_Image(CString strPath,IplImage *IpImg);
+	BOOL		Load_Image(CString strPath,IplImage **pIpImg);
+
+	BOOL		LoadUserDefectList();
+	BOOL		SaveUserDefectList();
+	BOOL		LoadExpAreaList();
+	BOOL		SaveExpAreaList();
+	void		DeleteExpAreaList();
+
+public:
+	CRECIPE_INFO_PARM	m_RecieParm;
+	CGLASS_INFO_PARM	m_GlassParm;
+	CETC_PARM			m_ETCParm[MAX_DIMENSION_COUNT];
+	CLIGHT_PARM			m_LightParm;
+	CALIGNMARK_PARM		m_AlignMarkParm[MAX_DIMENSION_COUNT];
+	USER_DEFECT_AREA_LIST	m_UserDefectPrm[MAX_DIMENSION_COUNT];
+	EXCEPTION_AREA_LIST	m_ExpAreaPrm[MAX_DIMENSION_COUNT];
+
+	CINSPECT_INFO_PARM	m_InspectInfoParm;
+
+	CINSPECT_JUDGEMENT_PARM	m_Judgement;
+	CHOLEINSPECT_PARM		m_HoleInspectParm;
+	CProfileInspect_Prm		m_ProfilePrm;
+
+protected:
+	CConfig		m_RecipeFile;
+};
diff --git a/ENRIT/Recipe/HardwareSettings.cpp b/ENRIT/Recipe/HardwareSettings.cpp
new file mode 100644
index 0000000..5c2d269
--- /dev/null
+++ b/ENRIT/Recipe/HardwareSettings.cpp
@@ -0,0 +1,1813 @@
+锘�#include "StdAfx.h"
+#include "HardwareSettings.h"
+
+//////////////////////////////////////////////////////////////////////////
+// PLC Settings
+CPLCSettings::CPLCSettings(void)
+{
+	Reset();
+}
+
+CPLCSettings::~CPLCSettings(void)
+{
+
+}
+
+CPLCSettings& CPLCSettings::operator=(CPLCSettings& rhs)
+{
+	if(this != &rhs)
+	{
+		m_nPLCLoopTime = rhs.m_nPLCLoopTime;
+	}
+	return *this;
+}
+
+void CPLCSettings::Reset()
+{
+	m_nPLCLoopTime = 50;
+}
+
+CString CPLCSettings::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+
+	if((void *)&m_nPLCLoopTime == pValue)
+		str.Format(_T("PLC_LOOPTIME"));
+
+	return str;
+}
+
+BOOL CPLCSettings::ReadHardwareSettingsFile(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;	
+
+	str = GetFileString((void *)&m_nPLCLoopTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCLoopTime);
+
+	return TRUE;
+}
+
+BOOL CPLCSettings::ReadHardwareSettingsRegistry(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+
+	str = GetFileString((void *)&m_nPLCLoopTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCLoopTime);
+
+	return TRUE;
+}
+
+BOOL CPLCSettings::WriteHardwareSettingsFile(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+
+	str = GetFileString((void *)&m_nPLCLoopTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCLoopTime);
+
+	return TRUE;
+}
+
+BOOL CPLCSettings::WriteHardwareSettingsRegistry(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+
+	str = GetFileString((void *)&m_nPLCLoopTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCLoopTime);
+
+	return TRUE;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// Soft Settings
+CSoftSettings::CSoftSettings(void)
+{
+	Reset();
+}
+
+CSoftSettings::~CSoftSettings(void)
+{
+
+}
+
+CSoftSettings& CSoftSettings::operator=(CSoftSettings& rhs)
+{
+	if(this != &rhs)
+	{
+		int			i;
+
+		m_bUseLightImageSave = rhs.m_bUseLightImageSave;		
+		for(i=0;i<MAX_INS_PC;i++)
+		{
+			m_bInsPCUse[i] = rhs.m_bInsPCUse[i];
+		}
+		m_bUseVcrReadFail  = rhs.m_bUseVcrReadFail;
+	}
+	return *this;
+}
+
+void CSoftSettings::Reset()
+{
+	int			i;
+
+	m_bUseLightImageSave = FALSE;
+
+	for(i=0;i<MAX_INS_PC;i++)
+	{
+		m_bInsPCUse[i] = FALSE;
+	}
+
+	m_bUseVcrReadFail = FALSE;
+}
+
+CString CSoftSettings::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+
+	if((void *)&m_bUseVcrReadFail == pValue)
+		str.Format(_T("SOFT_USE_VCR_READ_FAIL"));
+
+	return str;
+}
+
+BOOL CSoftSettings::ReadHardwareSettingsFile(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				i;
+
+	str = GetFileString((void *)&m_bUseLightImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseLightImageSave);
+
+	for(i=0;i<MAX_INS_PC;i++)
+	{
+		str.Format(_T("INSPECTOR_PC_USE_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bInsPCUse[i]);	
+	}	
+
+	str = GetFileString((void *)&m_bUseVcrReadFail);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseVcrReadFail);
+
+	return TRUE;
+}
+
+BOOL CSoftSettings::ReadHardwareSettingsRegistry(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				i;
+
+	str = GetFileString((void *)&m_bUseLightImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseLightImageSave);
+
+	for(i=0;i<MAX_INS_PC;i++)
+	{
+		str.Format(_T("INSPECTOR_PC_USE_%d"),i);
+		pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bInsPCUse[i]);	
+	}
+
+	str = GetFileString((void *)&m_bUseVcrReadFail);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseVcrReadFail);
+
+	return TRUE;
+}
+
+BOOL CSoftSettings::WriteHardwareSettingsFile(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				i;
+
+	str = GetFileString((void *)&m_bUseLightImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseLightImageSave);
+
+	for(i=0;i<MAX_INS_PC;i++)
+	{
+		str.Format(_T("INSPECTOR_PC_USE_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bInsPCUse[i]);	
+	}
+
+	str = GetFileString((void *)&m_bUseVcrReadFail);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseVcrReadFail);
+
+	return TRUE;
+}
+
+BOOL CSoftSettings::WriteHardwareSettingsRegistry(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				i;
+
+	str = GetFileString((void *)&m_bUseLightImageSave);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseLightImageSave);
+
+	for(i=0;i<MAX_INS_PC;i++)
+	{
+		str.Format(_T("INSPECTOR_PC_USE_%d"),i);
+		pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bInsPCUse[i]);	
+	}
+
+	str = GetFileString((void *)&m_bUseVcrReadFail);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseVcrReadFail);
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Light Settings
+CHardwareLightSettings::CHardwareLightSettings(void)
+{
+	Reset();
+}
+
+CHardwareLightSettings::~CHardwareLightSettings(void)
+{
+
+}
+
+CHardwareLightSettings& CHardwareLightSettings::operator=(CHardwareLightSettings& rhs)
+{
+	if(this != &rhs)
+	{
+		m_nIndex = rhs.m_nIndex;
+		m_nPort = rhs.m_nPort;
+		m_emType = rhs.m_emType;
+		m_emMaker = rhs.m_emMaker;
+	}
+	return *this;
+}
+
+void CHardwareLightSettings::Reset()
+{
+	m_nIndex = -1;
+	m_nPort = -1;
+	m_emType = LIGHT_TYPE_NONE;
+	m_emMaker = MAKER_NONE;
+}
+
+CString CHardwareLightSettings::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+
+	if((void *)&m_nPort == pValue)
+		str.Format(_T("LIGHT_[%d]_PORT"),m_nIndex);
+	else if((void *)&m_emType == pValue)
+		str.Format(_T("LIGHT_[%d]_TYPE"),m_nIndex);
+	else if((void *)&m_emMaker == pValue)
+		str.Format(_T("LIGHT_[%d]_MAKER"),m_nIndex);
+	else if((void *)&m_nIndex == pValue)
+		str.Format(_T("LIGHT_[%d]_ID"),m_nIndex);
+
+	return str;
+}
+
+BOOL CHardwareLightSettings::ReadHardwareSettingsFile(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nIndex);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nIndex);
+
+	str = GetFileString((void *)&m_nPort);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nPort);
+
+	str = GetFileString((void *)&m_emType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_emType = (LIGHT_TYPE)nValue;
+
+	str = GetFileString((void *)&m_emMaker);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_emMaker = (LIGHT_MAKER)nValue;	
+
+	return TRUE;
+}
+
+BOOL CHardwareLightSettings::ReadHardwareSettingsRegistry(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nIndex);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nIndex);
+
+	str = GetFileString((void *)&m_nPort);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nPort);
+
+	str = GetFileString((void *)&m_emType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_emType = (LIGHT_TYPE)nValue;
+
+	str = GetFileString((void *)&m_emMaker);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_emMaker = (LIGHT_MAKER)nValue;	
+
+	return TRUE;
+}
+
+BOOL CHardwareLightSettings::WriteHardwareSettingsFile(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nIndex);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nIndex);
+
+	str = GetFileString((void *)&m_nPort);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nPort);
+
+	str = GetFileString((void *)&m_emType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_emType;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	str = GetFileString((void *)&m_emMaker);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_emMaker;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	return TRUE;
+}
+
+BOOL CHardwareLightSettings::WriteHardwareSettingsRegistry(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nIndex);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nIndex);
+
+	str = GetFileString((void *)&m_nPort);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nPort);
+
+	str = GetFileString((void *)&m_emType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_emType;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	str = GetFileString((void *)&m_emMaker);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_emMaker;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Camera Settings
+CCameraSettings::CCameraSettings(void)
+{	
+	Reset();
+}
+
+CCameraSettings::~CCameraSettings(void)
+{
+
+}
+
+CCameraSettings& CCameraSettings::operator=(CCameraSettings& rhs)
+{
+	if(this != &rhs)
+	{
+		m_iCamera = rhs.m_iCamera;
+		m_iScan = rhs.m_iScan;		
+		m_nMarginLeft = rhs.m_nMarginLeft;
+		m_nMarginRight = rhs.m_nMarginRight;
+		for(int i=0;i<MAX_STAGE_HAND_COUNT;i++)
+		{
+			m_dConvResolution[i] = rhs.m_dConvResolution[i];
+			m_dScanResolution[i] = rhs.m_dScanResolution[i];
+		}
+		m_nLightIdx_R = rhs.m_nLightIdx_R;
+		m_nLightIdx_T = rhs.m_nLightIdx_T;
+		m_nLightIdx_T_Ch = rhs.m_nLightIdx_T_Ch;
+		m_nLightIdx_R_Ch = rhs.m_nLightIdx_R_Ch;
+		m_enCamDir = rhs.m_enCamDir;
+		m_nGrabFrameCount = rhs.m_nGrabFrameCount;		
+		m_FrameSize = rhs.m_FrameSize;		
+		m_enInspectDir = rhs.m_enInspectDir;
+		m_eDimension = rhs.m_eDimension;
+		m_eScanDir = rhs.m_eScanDir;
+		m_nImgFlipx = rhs.m_nImgFlipx;
+	}
+	return *this;
+}
+
+void CCameraSettings::Reset()
+{	
+	m_iCamera = -1;
+	m_iScan = -1;	
+	m_nMarginLeft = m_nMarginRight = 0;
+	for(int i=0;i<MAX_STAGE_HAND_COUNT;i++)
+	{
+		m_dConvResolution[i] = m_dScanResolution[i] = 0;
+	}
+	m_nLightIdx_R = m_nLightIdx_T = -1;
+	m_nLightIdx_T_Ch = m_nLightIdx_R_Ch = -1;
+	m_enCamDir = CAMDIR_TOP;	
+	m_nGrabFrameCount = 0;	
+	m_FrameSize = CSize(0,0);
+	m_enInspectDir = INSPECTDIR_FORWARD;
+	m_eDimension = DIMENSION_NONE;
+	m_eScanDir = SCANGLASS_X;
+	m_nImgFlipx = FALSE;
+}
+
+CString CCameraSettings::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+
+	if((void *)&m_nMarginLeft == pValue)
+		str.Format(_T("CAM_[%d][%d]_MARGIN_LEFT"),m_iCamera,m_iScan);
+	else if((void *)&m_nMarginRight == pValue)
+		str.Format(_T("CAM_[%d][%d]_MARGIN_RIGHT"),m_iCamera,m_iScan);
+	else if((void *)&m_dConvResolution[0] == pValue)
+		str.Format(_T("CAM_[%d][%d]_CONVRES"),m_iCamera,m_iScan);
+	else if((void *)&m_dScanResolution[0] == pValue)
+		str.Format(_T("CAM_[%d][%d]_SCANRES"),m_iCamera,m_iScan);
+	else if((void *)&m_dConvResolution[1] == pValue)
+		str.Format(_T("CAM_[%d][%d]_CONVRES_1"),m_iCamera,m_iScan);
+	else if((void *)&m_dScanResolution[1] == pValue)
+		str.Format(_T("CAM_[%d][%d]_SCANRES_1"),m_iCamera,m_iScan);
+	else if((void *)&m_nLightIdx_R == pValue)
+		str.Format(_T("CAM_[%d][%d]_LIGHTIDX_R"),m_iCamera,m_iScan);
+	else if((void *)&m_nLightIdx_T == pValue)
+		str.Format(_T("CAM_[%d][%d]_LIGHTIDX_T"),m_iCamera,m_iScan);
+	else if((void *)&m_nLightIdx_T_Ch == pValue)
+		str.Format(_T("CAM_[%d][%d]_LIGHTIDX_T_CHANNEL"),m_iCamera,m_iScan);
+	else if((void *)&m_nLightIdx_R_Ch == pValue)
+		str.Format(_T("CAM_[%d][%d]_LIGHTIDX_R_CHANNEL"),m_iCamera,m_iScan);
+	else if((void *)&m_enCamDir == pValue)
+		str.Format(_T("CAM_[%d][%d]_CAMDIR"),m_iCamera,m_iScan);
+	else if((void *)&m_nGrabFrameCount == pValue)
+		str.Format(_T("CAM_[%d][%d]_GRABFRAMECOUNT"),m_iCamera,m_iScan);	
+	else if((void *)&m_FrameSize.cx == pValue)
+		str.Format(_T("CAM_[%d][%d]_FRAME_CX"),m_iCamera,m_iScan);
+	else if((void *)&m_FrameSize.cy == pValue)
+		str.Format(_T("CAM_[%d][%d]_FRAME_CY"),m_iCamera,m_iScan);	
+	else if((void *)&m_enInspectDir == pValue)
+		str.Format(_T("CAM_[%d][%d]_INSPECT_DIR"),m_iCamera,m_iScan);
+	else if((void *)&m_eDimension == pValue)
+		str.Format(_T("CAM_[%d][%d]_DIMENSION"),m_iCamera,m_iScan);
+	else if((void *)&m_eScanDir == pValue)
+		str.Format(_T("CAM_[%d][%d]_SCANDIR"),m_iCamera,m_iScan);
+	else if((void *)&m_nImgFlipx == pValue)
+		str.Format(_T("CAM_[%d][%d]_IMAGEFLIPX"),m_iCamera,m_iScan);
+
+
+	return str;
+}
+
+BOOL CCameraSettings::ReadHardwareSettingsFile(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nMarginLeft);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nMarginLeft);
+
+	str = GetFileString((void *)&m_nMarginRight);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nMarginRight);
+
+	str = GetFileString((void *)&m_dConvResolution[0]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dConvResolution[0]);
+
+	str = GetFileString((void *)&m_dScanResolution[0]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dScanResolution[0]);
+
+	str = GetFileString((void *)&m_dConvResolution[1]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dConvResolution[1]);
+
+	str = GetFileString((void *)&m_dScanResolution[1]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dScanResolution[1]);
+
+	str = GetFileString((void *)&m_nLightIdx_R);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_R);
+
+	str = GetFileString((void *)&m_nLightIdx_T);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_T);
+
+	str = GetFileString((void *)&m_nLightIdx_T_Ch);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_T_Ch);
+
+	str = GetFileString((void *)&m_nLightIdx_R_Ch);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_R_Ch);
+
+	str = GetFileString((void *)&m_enCamDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_enCamDir = (CAMERA_DIR)nValue;	
+
+	str = GetFileString((void *)&m_nGrabFrameCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGrabFrameCount);	
+
+	str = GetFileString((void *)&m_FrameSize.cx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;	
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_FrameSize.cx = nValue;
+
+	str = GetFileString((void *)&m_FrameSize.cy);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_FrameSize.cy = nValue;
+
+	str = GetFileString((void *)&m_enInspectDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_enInspectDir = (CAMERA_INSPECTION_DIR)nValue;
+
+	str = GetFileString((void *)&m_eDimension);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_eDimension = (DimensionDir)nValue;
+
+	str = GetFileString((void *)&m_eScanDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_eScanDir = (CAMERA_SCANDIR)nValue;
+
+	str = GetFileString((void *)&m_nImgFlipx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_nImgFlipx = (CAMERA_SCANDIR)nValue;
+
+	return TRUE;
+}
+
+BOOL CCameraSettings::ReadHardwareSettingsRegistry(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nMarginLeft);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nMarginLeft);
+
+	str = GetFileString((void *)&m_nMarginRight);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nMarginRight);
+
+	str = GetFileString((void *)&m_dConvResolution[0]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dConvResolution[0]);
+
+	str = GetFileString((void *)&m_dScanResolution[0]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dScanResolution[0]);
+
+	str = GetFileString((void *)&m_dConvResolution[1]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dConvResolution[1]);
+
+	str = GetFileString((void *)&m_dScanResolution[1]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_dScanResolution[1]);
+
+	str = GetFileString((void *)&m_nLightIdx_R);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_R);
+
+	str = GetFileString((void *)&m_nLightIdx_T);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_T);
+
+	str = GetFileString((void *)&m_nLightIdx_T_Ch);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_T_Ch);
+
+	str = GetFileString((void *)&m_nLightIdx_R_Ch);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_R_Ch);
+
+	str = GetFileString((void *)&m_enCamDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_enCamDir = (CAMERA_DIR)nValue;	
+
+	str = GetFileString((void *)&m_nGrabFrameCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,m_nGrabFrameCount);	
+
+	str = GetFileString((void *)&m_FrameSize.cx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;	
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+	m_FrameSize.cx = nValue;
+
+	str = GetFileString((void *)&m_FrameSize.cy);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+	m_FrameSize.cy = nValue;
+
+	str = GetFileString((void *)&m_enInspectDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_enInspectDir = (CAMERA_INSPECTION_DIR)nValue;
+
+	str = GetFileString((void *)&m_eDimension);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_eDimension = (DimensionDir)nValue;
+
+	str = GetFileString((void *)&m_eScanDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_eScanDir = (CAMERA_SCANDIR)nValue;
+
+	str = GetFileString((void *)&m_nImgFlipx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->GetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+	m_nImgFlipx = (CAMERA_SCANDIR)nValue;
+
+	return TRUE;
+}
+
+BOOL CCameraSettings::WriteHardwareSettingsFile(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nMarginLeft);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nMarginLeft);
+
+	str = GetFileString((void *)&m_nMarginRight);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nMarginRight);
+
+	str = GetFileString((void *)&m_dConvResolution[0]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dConvResolution[0]);
+
+	str = GetFileString((void *)&m_dScanResolution[0]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dScanResolution[0]);
+
+	str = GetFileString((void *)&m_dConvResolution[1]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dConvResolution[1]);
+
+	str = GetFileString((void *)&m_dScanResolution[1]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dScanResolution[1]);
+
+	str = GetFileString((void *)&m_nLightIdx_R);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_R);
+
+	str = GetFileString((void *)&m_nLightIdx_T);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_T);
+
+	str = GetFileString((void *)&m_nLightIdx_T_Ch);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_T_Ch);
+
+	str = GetFileString((void *)&m_nLightIdx_R_Ch);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_R_Ch);
+
+	str = GetFileString((void *)&m_enCamDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_enCamDir;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+	str = GetFileString((void *)&m_nGrabFrameCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGrabFrameCount);	
+
+	str = GetFileString((void *)&m_FrameSize.cx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_FrameSize.cx);
+
+	str = GetFileString((void *)&m_FrameSize.cy);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_FrameSize.cy);
+
+	str = GetFileString((void *)&m_enInspectDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_enInspectDir;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+	str = GetFileString((void *)&m_eDimension);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_eDimension;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	str = GetFileString((void *)&m_eScanDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_eScanDir;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	str = GetFileString((void *)&m_nImgFlipx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_nImgFlipx;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	return TRUE;
+}
+
+BOOL CCameraSettings::WriteHardwareSettingsRegistry(CConfig *pFile)
+{
+	if(pFile == NULL)
+		return FALSE;
+
+	CString			str;
+	int				nValue;
+
+	str = GetFileString((void *)&m_nMarginLeft);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nMarginLeft);
+
+	str = GetFileString((void *)&m_nMarginRight);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nMarginRight);
+
+	str = GetFileString((void *)&m_dConvResolution[0]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dConvResolution[0]);
+
+	str = GetFileString((void *)&m_dScanResolution[0]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dScanResolution[0]);
+
+	str = GetFileString((void *)&m_dConvResolution[1]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dConvResolution[1]);
+
+	str = GetFileString((void *)&m_dScanResolution[1]);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_dScanResolution[1]);
+
+	str = GetFileString((void *)&m_nLightIdx_R);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_R);
+
+	str = GetFileString((void *)&m_nLightIdx_T);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_T);
+
+	str = GetFileString((void *)&m_nLightIdx_T_Ch);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_T_Ch);
+
+	str = GetFileString((void *)&m_nLightIdx_R_Ch);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightIdx_R_Ch);
+
+	str = GetFileString((void *)&m_enCamDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_enCamDir;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+	str = GetFileString((void *)&m_nGrabFrameCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_nGrabFrameCount);	
+
+	str = GetFileString((void *)&m_FrameSize.cx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_FrameSize.cx);
+
+	str = GetFileString((void *)&m_FrameSize.cy);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,m_FrameSize.cy);
+
+	str = GetFileString((void *)&m_enInspectDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_enInspectDir;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+	str = GetFileString((void *)&m_eDimension);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_eDimension;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);
+
+	str = GetFileString((void *)&m_eScanDir);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_eScanDir;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	str = GetFileString((void *)&m_nImgFlipx);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	nValue = (int)m_nImgFlipx;
+	pFile->SetItemValue((TCHAR*)(LPCTSTR)str,nValue);	
+
+	return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// hardwareSettins
+CHardwareSettings::CHardwareSettings(void)
+{
+	m_pLightSettings = NULL;
+	m_pCameraSettings = NULL;
+	Reset();
+}
+
+CHardwareSettings::~CHardwareSettings(void)
+{
+	Reset();
+}
+
+CHardwareSettings& CHardwareSettings::operator=(CHardwareSettings& rhs)
+{
+	if(this != &rhs)
+	{
+		int				iLoop;
+
+		Reset();
+		m_nLightCount_Trans = rhs.m_nLightCount_Trans;
+		m_nLightCount_Reflect = rhs.m_nLightCount_Reflect;
+		SetLightCount(m_nLightCount_Trans,m_nLightCount_Reflect);
+		for(iLoop=0;iLoop<m_nLightCount_Trans+m_nLightCount_Reflect;iLoop++)
+			m_pLightSettings[iLoop] = rhs.m_pLightSettings[iLoop];
+
+		m_nBoardType = rhs.m_nBoardType;
+		m_nCameraCount = rhs.m_nCameraCount;
+		m_nScanCount = rhs.m_nScanCount;
+		SetCameraCount(m_nCameraCount,m_nScanCount);
+		for(iLoop=0;iLoop<m_nCameraCount*m_nScanCount;iLoop++)
+			m_pCameraSettings[iLoop] = rhs.m_pCameraSettings[iLoop];
+
+		m_strLineID = rhs.m_strLineID;
+		m_nPLCSignalRetry = rhs.m_nPLCSignalRetry;		
+
+		//		m_dOneScanTime = rhs.m_dOneScanTime;
+		m_nFolderRemoveDay = rhs.m_nFolderRemoveDay;
+
+		m_PLCSettings = rhs.m_PLCSettings;
+
+		m_SoftWareSettings = rhs.m_SoftWareSettings;				
+
+		m_bInsDirReverse = rhs.m_bInsDirReverse;
+		m_bUseColorVisual = rhs.m_bUseColorVisual;
+
+		m_bUseFreerun = rhs.m_bUseFreerun;
+		m_nFreerunPeriod = rhs.m_nFreerunPeriod;
+		m_nFreerunExposureTime = rhs.m_nFreerunExposureTime;
+
+		m_bTriggerBoardUse = rhs.m_bTriggerBoardUse;
+		m_nTriggerBoardComport = rhs.m_nTriggerBoardComport;
+
+		m_nFullImageCompressRatio = rhs.m_nFullImageCompressRatio;
+	}
+	return *this;
+}
+
+void CHardwareSettings::Reset()
+{		
+	//	m_dOneScanTime = 0.;
+	m_nLightCount_Trans = 0;	
+	m_nLightCount_Reflect = 0;	
+	m_nCameraCount = 0;
+	m_nScanCount = 0;
+	m_nFolderRemoveDay = 0;
+	m_nPLCSignalRetry = 0;
+	m_strLineID = "";
+	m_nBoardType = GRAB_LINK_BOARD;
+	if(m_pLightSettings != NULL)
+		delete[] m_pLightSettings, m_pLightSettings=NULL;
+	if(m_pCameraSettings != NULL)
+		delete[] m_pCameraSettings, m_pCameraSettings=NULL;
+	m_PLCSettings.Reset();
+	m_SoftWareSettings.Reset();	
+	m_bInsDirReverse = FALSE;
+	m_bUseColorVisual = TRUE;
+
+	m_bTriggerBoardUse = FALSE;
+	m_nTriggerBoardComport = 0;
+	m_nFullImageCompressRatio = 70;
+}
+
+void CHardwareSettings::SetLightCount(int nCountTrans,int nCountReflect)
+{
+	int		iLoop,nBackCount=0;
+	CHardwareLightSettings *pTmpSet = NULL;
+
+	if(m_pLightSettings != NULL)
+	{
+		if(m_nLightCount_Trans+m_nLightCount_Reflect > 0)
+		{
+			pTmpSet = new CHardwareLightSettings[m_nLightCount_Trans+m_nLightCount_Reflect];
+			for(iLoop=0;iLoop<m_nLightCount_Trans+m_nLightCount_Reflect;iLoop++)
+				pTmpSet[iLoop] = m_pLightSettings[iLoop];
+			nBackCount = m_nLightCount_Trans+m_nLightCount_Reflect;
+		}
+		delete[] m_pLightSettings, m_pLightSettings=NULL;
+	}
+
+	m_nLightCount_Trans = nCountTrans;	
+	m_nLightCount_Reflect = nCountReflect;
+	if(m_nLightCount_Trans+m_nLightCount_Reflect <= 0)
+		return;
+
+	m_pLightSettings = new CHardwareLightSettings[m_nLightCount_Trans+m_nLightCount_Reflect];
+
+	for(iLoop=0;iLoop<m_nLightCount_Trans+m_nLightCount_Reflect;iLoop++)
+		m_pLightSettings[iLoop].m_nIndex = iLoop;
+
+	if(pTmpSet != NULL)
+	{
+		for(iLoop=0;iLoop<nBackCount;iLoop++)
+		{
+			SetLightSettings(&pTmpSet[iLoop]);			
+		}
+		delete[] pTmpSet, pTmpSet = NULL;
+	}
+}
+
+CHardwareLightSettings *CHardwareSettings::GetLightSettings(int iLight)
+{
+	if(iLight < 0 || iLight >= m_nLightCount_Trans+m_nLightCount_Reflect)
+		return NULL;
+
+	for(int iLoop=0;iLoop<m_nLightCount_Trans+m_nLightCount_Reflect;iLoop++)
+	{
+		if(m_pLightSettings[iLoop].m_nIndex == iLight)
+			return &m_pLightSettings[iLoop];
+	}
+
+	return NULL;
+}
+
+BOOL CHardwareSettings::SetLightSettings(CHardwareLightSettings *pLight)
+{
+	if(pLight == NULL || m_nLightCount_Trans+m_nLightCount_Reflect <= 0 || m_pLightSettings == NULL)
+		return FALSE;
+
+	for(int iLoop=0;iLoop<m_nLightCount_Trans+m_nLightCount_Reflect;iLoop++)
+	{
+		if(m_pLightSettings[iLoop].m_nIndex == pLight->m_nIndex)
+		{
+			m_pLightSettings[iLoop] = *pLight;
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+BOOL CHardwareSettings::SetCameraCount(int nCameraCount,int nScanCount)
+{
+	CCameraSettings *ptmpSet = NULL;
+	int				nBackCamCnt = 0,nBackScanCnt = 0;
+	int				iLoop;
+
+	if(m_pCameraSettings != NULL)
+	{
+		if((m_nCameraCount*m_nScanCount) > 0)
+		{
+			ptmpSet = new CCameraSettings[m_nCameraCount*m_nScanCount];
+
+			for(iLoop=0;iLoop<m_nCameraCount*m_nScanCount;iLoop++)
+			{
+				ptmpSet[iLoop] = m_pCameraSettings[iLoop];
+			}
+			nBackCamCnt = m_nCameraCount;
+			nBackScanCnt = m_nScanCount;
+		}
+		delete[] m_pCameraSettings, m_pCameraSettings=NULL;		
+	}
+
+	m_nCameraCount = nCameraCount;
+	m_nScanCount = nScanCount;			
+
+	if(m_nCameraCount <= 0 || m_nScanCount <= 0)
+		return FALSE;
+
+	m_pCameraSettings = new CCameraSettings[m_nCameraCount*m_nScanCount];
+
+	int			iCam,iScan;
+
+	iLoop=0;
+	for(iCam=0;iCam<m_nCameraCount;iCam++)
+	{		
+		for(iScan=0;iScan<m_nScanCount;iScan++)
+		{
+			m_pCameraSettings[iLoop].m_iCamera = iCam;
+			m_pCameraSettings[iLoop].m_iScan = iScan;			
+			iLoop++;
+		}
+	}
+
+	if(ptmpSet != NULL)
+	{
+		for(iLoop=0;iLoop<nBackCamCnt*nBackScanCnt;iLoop++)
+		{
+			SetCameraSettings(&ptmpSet[iLoop]);			
+		}	
+		delete[] ptmpSet, ptmpSet=NULL;
+	}
+
+	return TRUE;
+}
+
+CCameraSettings	*CHardwareSettings::GetCameraSettings(int iCamera,int iScan)
+{
+	if(iCamera >= m_nCameraCount || iScan >= m_nScanCount 
+		|| m_nCameraCount <= 0 || m_nScanCount <= 0)
+		return NULL;
+
+	for(int iLoop=0;iLoop<m_nCameraCount*m_nScanCount;iLoop++)
+	{
+		if(m_pCameraSettings[iLoop].m_iCamera == iCamera && m_pCameraSettings[iLoop].m_iScan == iScan)
+			return &m_pCameraSettings[iLoop];
+	}
+
+	return NULL;
+}
+
+BOOL CHardwareSettings::SetCameraSettings(CCameraSettings *pCamera)
+{
+	if(pCamera == NULL || m_nCameraCount <= 0 || m_nScanCount <= 0)
+		return FALSE;
+
+	CCameraSettings	*pOrgCam = GetCameraSettings(pCamera->m_iCamera,pCamera->m_iScan);
+	if(pOrgCam == NULL)
+		return FALSE;
+
+	*pOrgCam = *pCamera;
+
+	return TRUE;
+}
+
+CString CHardwareSettings::GetFileString(void *pValue)
+{
+	CString		str = _T("");
+
+	if((void *)&m_nCameraCount == pValue)
+		str = _T("CAMERA_COUNT");
+	else if((void *)&m_nScanCount == pValue)
+		str = _T("SCAN_COUNT");
+	else if((void *)&m_nBoardType == pValue)
+		str = _T("BOARD_TYPE");
+	else if((void *)&m_nLightCount_Trans == pValue)
+		str = _T("LIGHT_COUNT_TRANS");
+	else if((void *)&m_nLightCount_Reflect == pValue)
+		str = _T("LIGHT_COUNT_REFLECT");	
+	// 	else if((void *)&m_dOneScanTime == pValue)
+	// 		str = "ONE_SCAN_TIME";	
+	else if((void *)&m_strLineID == pValue)
+		str = _T("LINE_ID");	
+	else if((void *)&m_nPLCSignalRetry == pValue)
+		str = _T("PLCSIGNAL_RETRY_COUNT");		
+	else if((void *)&m_bInsDirReverse == pValue)
+		str = _T("INSPECTOR_DIR_REVERSE");
+	else if((void *)&m_nFolderRemoveDay == pValue)
+		str = _T("FOLERREMOVEDAY");
+	else if((void *)&m_bUseColorVisual == pValue)
+		str = _T("USECOLORVISUAL");
+	else if((void *)&m_bUseFreerun == pValue)
+		str = _T("USE_FREERUN");
+	else if((void *)&m_nFreerunPeriod == pValue)
+		str = _T("FREERUN_PERIOD");
+	else if((void *)&m_nFreerunExposureTime == pValue)
+		str = _T("FREERUN_EXPOSURE");
+
+	else if((void *)&m_bTriggerBoardUse == pValue)
+		str = _T("TRIGGER_BOARD_USE");
+	else if((void *)&m_nTriggerBoardComport == pValue)
+		str = _T("TRIGGER_BOARD_COMPORT");
+	else if((void *)&m_nFullImageCompressRatio == pValue)
+		str = _T("FULL_IMAGE_SAVE_COMP_RATIO");
+
+	return str;
+}
+
+BOOL CHardwareSettings::ReadHardwareSettingsFile(CString strFile)
+{
+	CConfig		BasicInfoFile;
+	CString		str;
+	int			iCam,iScan,iLight,iLoop;	
+
+	if (!BasicInfoFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFile, FileMap_Mode))
+		return FALSE;
+
+	str = GetFileString((void *)&m_nCameraCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nCameraCount);
+
+	str = GetFileString((void *)&m_nScanCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nScanCount,5);	
+
+	str = GetFileString((void *)&m_nBoardType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	int		nType;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,nType,0);		
+	m_nBoardType = (BOARD_TYPE)nType;
+
+	// 	str = GetFileString((void *)&m_dOneScanTime);
+	// 	if(str.IsEmpty() == TRUE)
+	// 		return FALSE;
+	// 	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_dOneScanTime);	
+
+	str = GetFileString((void *)&m_strLineID);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_strLineID);		
+
+	str = GetFileString((void *)&m_nPLCSignalRetry);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCSignalRetry);			
+
+	str = GetFileString((void *)&m_bInsDirReverse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_bInsDirReverse);
+
+	str = GetFileString((void *)&m_bUseColorVisual);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
+
+
+	SetCameraCount(m_nCameraCount,m_nScanCount);
+	iLoop = 0;
+	for(iCam=0;iCam<m_nCameraCount;iCam++)
+	{
+		for(iScan=0;iScan<m_nScanCount;iScan++)
+		{
+			m_pCameraSettings[iLoop].ReadHardwareSettingsFile(&BasicInfoFile);		
+			iLoop++;
+		}
+	}
+
+	str = GetFileString((void *)&m_nLightCount_Trans);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Trans);	
+
+	str = GetFileString((void *)&m_nLightCount_Reflect);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Reflect);
+
+	str = GetFileString((void *)&m_nFolderRemoveDay);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nFolderRemoveDay);
+
+
+	SetLightCount(m_nLightCount_Trans,m_nLightCount_Reflect);
+	for(iLight=0;iLight<m_nLightCount_Trans+m_nLightCount_Reflect;iLight++)
+	{
+		m_pLightSettings[iLight].ReadHardwareSettingsFile(&BasicInfoFile);
+	}
+
+	str = GetFileString((void *)&m_bTriggerBoardUse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_bTriggerBoardUse);
+
+	str = GetFileString((void *)&m_nTriggerBoardComport);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nTriggerBoardComport);
+
+	str = GetFileString((void *)&m_nFullImageCompressRatio);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nFullImageCompressRatio);
+
+	m_PLCSettings.ReadHardwareSettingsFile(&BasicInfoFile);
+
+	m_SoftWareSettings.ReadHardwareSettingsFile(&BasicInfoFile);
+
+	str = GetFileString((void *)&m_bUseFreerun);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	int nTemp = 0;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,nTemp);
+	m_bUseFreerun = (BOOL) nTemp;
+
+	str = GetFileString((void *)&m_nFreerunPeriod);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunPeriod);
+
+	str = GetFileString((void *)&m_nFreerunExposureTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunExposureTime);
+
+	return TRUE;
+}
+
+BOOL CHardwareSettings::ReadHardwareSettingsRegistry()
+{
+	CString		str;
+	int			iCam,iScan,iLight,iLoop;	
+	CConfig		Register;
+
+	Register.SetRegiConfig(SHCU, KEY_BASIC, NULL, Registery_mode);
+
+	str = GetFileString((void *)&m_nCameraCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nCameraCount);
+
+	str = GetFileString((void *)&m_nScanCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nScanCount);	
+
+	str = GetFileString((void *)&m_nBoardType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	int		nType;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,nType,0);		
+	m_nBoardType = (BOARD_TYPE)nType;
+	
+	// 	str = GetFileString((void *)&m_dOneScanTime);
+	// 	if(str.IsEmpty() == TRUE)
+	// 		return FALSE;
+	// 	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_dOneScanTime);	
+
+	str = GetFileString((void *)&m_strLineID);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_strLineID);	
+
+	str = GetFileString((void *)&m_nPLCSignalRetry);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCSignalRetry);		
+
+	str = GetFileString((void *)&m_bInsDirReverse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_bInsDirReverse);
+
+	str = GetFileString((void *)&m_bUseColorVisual);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
+
+	SetCameraCount(m_nCameraCount,m_nScanCount);
+	iLoop = 0;
+	for(iCam=0;iCam<m_nCameraCount;iCam++)
+	{
+		for(iScan=0;iScan<m_nScanCount;iScan++)
+		{
+			m_pCameraSettings[iLoop].ReadHardwareSettingsRegistry(&Register);	
+			iLoop++;
+		}
+	}
+
+	str = GetFileString((void *)&m_nLightCount_Trans);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Trans);	
+
+	str = GetFileString((void *)&m_nLightCount_Reflect);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Reflect);
+
+	str = GetFileString((void *)&m_nFolderRemoveDay);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nFolderRemoveDay);
+
+	SetLightCount(m_nLightCount_Trans,m_nLightCount_Reflect);
+	for(iLight=0;iLight<m_nLightCount_Trans+m_nLightCount_Reflect;iLight++)
+	{
+		m_pLightSettings[iLight].ReadHardwareSettingsRegistry(&Register);
+	}
+
+	str = GetFileString((void *)&m_bTriggerBoardUse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_bTriggerBoardUse);
+
+	str = GetFileString((void *)&m_nTriggerBoardComport);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nTriggerBoardComport);
+
+	str = GetFileString((void *)&m_nFullImageCompressRatio);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nFullImageCompressRatio);
+
+	m_PLCSettings.ReadHardwareSettingsRegistry(&Register);
+
+	m_SoftWareSettings.ReadHardwareSettingsRegistry(&Register);
+
+	str = GetFileString((void *)&m_bUseFreerun);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	int nTemp = 0;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,nTemp);
+	m_bUseFreerun = (BOOL) nTemp;
+
+	str = GetFileString((void *)&m_nFreerunPeriod);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunPeriod);
+
+	str = GetFileString((void *)&m_nFreerunExposureTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunExposureTime);
+
+	return TRUE;
+}
+
+BOOL CHardwareSettings::WriteHardwareSettingsRegistry()
+{
+	CString				str;
+	int					iCam,iScan,iLight,iLoop;	
+	CConfig		Register;
+
+	Register.SetRegiConfig(SHCU, KEY_BASIC, NULL, Registery_mode);
+
+	str = GetFileString((void *)&m_nCameraCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nCameraCount);
+
+	str = GetFileString((void *)&m_nScanCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nScanCount);	
+
+	str = GetFileString((void *)&m_nBoardType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nBoardType);		
+
+	// 	str = GetFileString((void *)&m_dOneScanTime);
+	// 	if(str.IsEmpty() == TRUE)
+	// 		return FALSE;
+	// 	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_dOneScanTime);	
+
+	str = GetFileString((void *)&m_strLineID);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strLineID);	
+
+	str = GetFileString((void *)&m_nPLCSignalRetry);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCSignalRetry);	
+
+	str = GetFileString((void *)&m_bInsDirReverse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_bInsDirReverse);
+
+	str = GetFileString((void *)&m_bUseColorVisual);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
+
+	if(m_pCameraSettings != NULL)
+	{
+		iLoop = 0;
+		for(iCam=0;iCam<m_nCameraCount;iCam++)
+		{
+			for(iScan=0;iScan<m_nScanCount;iScan++)
+			{
+				m_pCameraSettings[iLoop].WriteHardwareSettingsRegistry(&Register);	
+				iLoop++;
+			}
+		}
+	}
+
+	str = GetFileString((void *)&m_nLightCount_Trans);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Trans);	
+
+	str = GetFileString((void *)&m_nLightCount_Reflect);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Reflect);
+
+	str = GetFileString((void *)&m_nFolderRemoveDay);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFolderRemoveDay);
+
+	if(m_pLightSettings != NULL)
+	{		
+		for(iLight=0;iLight<m_nLightCount_Trans+m_nLightCount_Reflect;iLight++)
+		{
+			m_pLightSettings[iLight].WriteHardwareSettingsRegistry(&Register);
+		}		
+	}
+
+	str = GetFileString((void *)&m_bTriggerBoardUse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_bTriggerBoardUse);
+
+	str = GetFileString((void *)&m_nTriggerBoardComport);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nTriggerBoardComport);
+
+	str = GetFileString((void *)&m_nFullImageCompressRatio);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFullImageCompressRatio);
+
+	m_PLCSettings.WriteHardwareSettingsRegistry(&Register);	
+
+	m_SoftWareSettings.WriteHardwareSettingsRegistry(&Register);
+
+	str = GetFileString((void *)&m_bUseFreerun);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,(int) m_bUseFreerun);
+
+	str = GetFileString((void *)&m_nFreerunPeriod);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunPeriod);
+
+	str = GetFileString((void *)&m_nFreerunExposureTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunExposureTime);
+
+	return TRUE;
+}
+
+BOOL CHardwareSettings::WriteHardwareSettingsFile(CString strFile)
+{
+	CConfig		BasicInfoFile;
+	CString				str;
+	int					iCam,iScan,iLight,iLoop;	
+
+	if(BasicInfoFile.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFile, FileMap_Mode) == FALSE)
+	{
+		CFile File;
+		if (!File.Open((TCHAR*)(LPCTSTR)strFile, CFile::modeCreate))
+		{			
+			return FALSE;
+		}
+		File.Close();
+	}
+
+	str = GetFileString((void *)&m_nCameraCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nCameraCount);
+
+	str = GetFileString((void *)&m_nScanCount);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nScanCount);	
+
+	str = GetFileString((void *)&m_nBoardType);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nBoardType);	
+	
+	// 	str = GetFileString((void *)&m_dOneScanTime);
+	// 	if(str.IsEmpty() == TRUE)
+	// 		return FALSE;
+	// 	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_dOneScanTime);	
+
+	str = GetFileString((void *)&m_strLineID);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(TCHAR*)(LPCTSTR)m_strLineID);	
+
+	str = GetFileString((void *)&m_nPLCSignalRetry);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nPLCSignalRetry);	
+
+	str = GetFileString((void *)&m_bInsDirReverse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bInsDirReverse);
+
+	str = GetFileString((void *)&m_bUseColorVisual);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual);
+
+	if(m_pCameraSettings != NULL)
+	{
+		iLoop = 0;
+		for(iCam=0;iCam<m_nCameraCount;iCam++)
+		{
+			for(iScan=0;iScan<m_nScanCount;iScan++)
+			{
+				m_pCameraSettings[iLoop].WriteHardwareSettingsFile(&BasicInfoFile);	
+				iLoop++;
+			}
+		}
+	}
+
+	str = GetFileString((void *)&m_nLightCount_Trans);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Trans);	
+
+	str = GetFileString((void *)&m_nLightCount_Reflect);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nLightCount_Reflect);
+
+	str = GetFileString((void *)&m_nFolderRemoveDay);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFolderRemoveDay);
+
+	if(m_pLightSettings != NULL)
+	{		
+		for(iLight=0;iLight<m_nLightCount_Trans+m_nLightCount_Reflect;iLight++)
+		{
+			m_pLightSettings[iLight].WriteHardwareSettingsFile(&BasicInfoFile);
+		}		
+	}
+
+	str = GetFileString((void *)&m_bTriggerBoardUse);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bTriggerBoardUse);
+
+	str = GetFileString((void *)&m_nTriggerBoardComport);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nTriggerBoardComport);
+
+	str = GetFileString((void *)&m_nFullImageCompressRatio);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFullImageCompressRatio);
+
+	m_PLCSettings.WriteHardwareSettingsFile(&BasicInfoFile);
+
+	m_SoftWareSettings.WriteHardwareSettingsFile(&BasicInfoFile);
+
+
+	str = GetFileString((void *)&m_bUseFreerun);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,(int) m_bUseFreerun);
+
+	str = GetFileString((void *)&m_nFreerunPeriod);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunPeriod);
+
+	str = GetFileString((void *)&m_nFreerunExposureTime);
+	if(str.IsEmpty() == TRUE)
+		return FALSE;
+	BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_nFreerunExposureTime);
+
+
+	BasicInfoFile.WriteToFile();
+
+	return TRUE;
+}
+
+
+int CHardwareSettings::GetScanToDimension(DimensionDir eDir)
+{
+	int			iScan,iFindScan;
+	int			iCam;
+	CCameraSettings *pCamera;
+
+	iFindScan = -1;
+	for(iCam=0;iCam<GetCameraCount();iCam++)
+	{
+		for(iScan=0;iScan<GetScanCount();iScan++)
+		{
+			pCamera = GetCameraSettings(iCam,iScan);
+			if(pCamera == NULL)
+				continue;
+
+			if(pCamera->m_eDimension == eDir)
+			{
+				iFindScan = iScan;
+				break;
+			}
+		}
+
+		if(iFindScan != -1)
+			break;
+	}
+	return iFindScan;
+}
+
+CAMERA_SCANDIR CHardwareSettings::GetScanToScanDir(int iCam,int iScan)
+{
+	CCameraSettings *pCamera;
+
+	pCamera = GetCameraSettings(iCam,iScan);
+	if(pCamera == NULL)
+		return SCANGLASS_NONE;
+
+	return pCamera->m_eScanDir;
+}
+
+int	CHardwareSettings::GetCameraIndexToDimension(DimensionDir eDir)
+{
+	CCameraSettings *pCamera;
+	int			iCam,iScan;
+
+	for(iCam=0;iCam<GetCameraCount();iCam++)
+	{
+		for(iScan=0;iScan<GetScanCount();iScan++)
+		{
+			pCamera = GetCameraSettings(iCam,iScan);
+			if(pCamera == NULL)
+				continue;
+
+			if(pCamera->m_eDimension == eDir)
+			{
+				return iCam;
+			}
+		}
+	}
+
+	return -1;
+}
\ No newline at end of file
diff --git a/ENRIT/Recipe/HardwareSettings.h b/ENRIT/Recipe/HardwareSettings.h
new file mode 100644
index 0000000..5a27f32
--- /dev/null
+++ b/ENRIT/Recipe/HardwareSettings.h
@@ -0,0 +1,204 @@
+锘�#pragma once
+
+#include "Global_Define.h"
+
+
+#define HARDWARE_SETTING_PATH _T("C:\\RCutProject\\Config\\Hardware.had") // 纭欢璁剧疆璺緞
+#define	KEY_BASIC		      _T("Software\\RCutProject\\BASIC\\")		  // 璁剧疆娉ㄥ唽琛ㄨ矾寰�
+#define MAX_CNC_COUNT	      6                                           // 鏈�澶ф暟鎺ф暟閲�
+#define MAX_NCUT_STAGE_COUNT  12                                          // NCUT鏈�澶ч樁娈垫暟
+#define MAX_CCUT_STAGE_COUNT  1                                           // CCUT鏈�澶ч樁娈垫暟
+#define MAX_ECUT_STAGE_COUNT  1                                           // ECUT鏈�澶ч樁娈垫暟
+#define MAX_FEEDBACK_STAGE    MAX_NCUT_STAGE_COUNT + MAX_CCUT_STAGE_COUNT + MAX_ECUT_STAGE_COUNT //鏈�澶у弽棣堥樁娈�
+#define MAC_SPINDLE_COUNT     6                                           //鏈�澶т富杞存暟閲�
+
+#define MAX_INS_PC	          4                                           
+#define START_IP_ADDRESS      100                                         // 璧峰IP鍦板潃
+
+
+class CPLCSettings
+{
+public:
+	CPLCSettings(void);
+	virtual ~CPLCSettings(void);
+	CPLCSettings& operator=(CPLCSettings& rhs);
+
+public:
+	void		Reset();
+	BOOL		ReadHardwareSettingsFile(CConfig *pFile);
+	BOOL		WriteHardwareSettingsFile(CConfig *pFile);
+	BOOL		ReadHardwareSettingsRegistry(CConfig *pFile);	
+	BOOL		WriteHardwareSettingsRegistry(CConfig *pFile);
+
+protected:
+	CString		GetFileString(void *pValue);
+
+public:	
+	int			m_nPLCLoopTime; //PLC寰幆鏃堕棿
+};
+
+class CSoftSettings
+{
+public:
+	CSoftSettings(void);
+	virtual ~CSoftSettings(void);
+	CSoftSettings& operator=(CSoftSettings& rhs);
+
+public:
+	void		Reset();
+	BOOL		ReadHardwareSettingsFile(CConfig *pFile);
+	BOOL		WriteHardwareSettingsFile(CConfig *pFile);
+	BOOL		ReadHardwareSettingsRegistry(CConfig *pFile);	
+	BOOL		WriteHardwareSettingsRegistry(CConfig *pFile);
+
+protected:
+	CString		GetFileString(void *pValue);
+
+public:		
+	BOOL				m_bUseLightImageSave;
+	BOOL				m_bInsPCUse[MAX_INS_PC];	
+	BOOL				m_bUseVcrReadFail;
+};
+
+class CHardwareLightSettings
+{
+public:
+	CHardwareLightSettings(void);
+	virtual ~CHardwareLightSettings(void);
+	CHardwareLightSettings& operator=(CHardwareLightSettings& rhs);
+
+public:
+	void		Reset();
+	BOOL		ReadHardwareSettingsFile(CConfig *pFile);
+	BOOL		WriteHardwareSettingsFile(CConfig *pFile);
+	BOOL		ReadHardwareSettingsRegistry(CConfig *pFile);	
+	BOOL		WriteHardwareSettingsRegistry(CConfig *pFile);
+
+protected:
+	CString		GetFileString(void *pValue);
+
+public:
+	int			m_nIndex;
+	int			m_nPort;
+	LIGHT_TYPE	m_emType;
+	LIGHT_MAKER m_emMaker;
+};
+
+class CCameraSettings
+{
+public:
+	CCameraSettings(void);
+	virtual ~CCameraSettings(void);
+	CCameraSettings& operator=(CCameraSettings& rhs);
+
+public:
+	void		Reset();
+	BOOL		ReadHardwareSettingsFile(CConfig *pFile);
+	BOOL		WriteHardwareSettingsFile(CConfig *pFile);
+	BOOL		ReadHardwareSettingsRegistry(CConfig *pFile);	
+	BOOL		WriteHardwareSettingsRegistry(CConfig *pFile);
+
+protected:
+	CString		GetFileString(void *pValue);
+
+public:		
+	int		m_iCamera;
+	int		m_iScan;
+	CSize	m_FrameSize;
+	int		m_nMarginLeft;
+	int		m_nMarginRight;
+	double	m_dConvResolution[MAX_STAGE_HAND_COUNT];
+	double	m_dScanResolution[MAX_STAGE_HAND_COUNT];
+	int		m_nLightIdx_R;
+	int		m_nLightIdx_R_Ch;
+	int		m_nLightIdx_T;
+	int		m_nLightIdx_T_Ch;		
+	CAMERA_DIR m_enCamDir;
+	CAMERA_INSPECTION_DIR m_enInspectDir;	
+	CAMERA_SCANDIR	m_eScanDir;
+	DimensionDir	m_eDimension;
+	int		m_nGrabFrameCount;		
+	BOOL	m_nImgFlipx;
+};
+
+class CHardwareSettings
+{
+public:
+	CHardwareSettings(void);
+	virtual ~CHardwareSettings(void);
+	CHardwareSettings& operator=(CHardwareSettings& rhs);
+
+public:
+	void						Reset();
+	BOOL						ReadHardwareSettingsFile(CString strFile);
+	BOOL						ReadHardwareSettingsRegistry();
+	BOOL						WriteHardwareSettingsFile(CString strFile);
+	BOOL						WriteHardwareSettingsRegistry();
+	CString						GetLineID(){return m_strLineID;}
+
+protected:
+	CString						GetFileString(void *pValue);
+
+	// Light
+public:		
+	void						SetLightCount(int nCountTrans,int nCountReflect);
+	CHardwareLightSettings		*GetLightSettings(){return m_pLightSettings;}
+	CHardwareLightSettings		*GetLightSettings(int iLight);	
+	BOOL						SetLightSettings(CHardwareLightSettings *pLight);
+
+
+public:
+	int							m_nLightCount_Trans;
+	int							m_nLightCount_Reflect;
+	CHardwareLightSettings		*m_pLightSettings;
+
+	// Camera
+public:
+	int							GetCameraCount(){return m_nCameraCount;}
+	int							GetScanCount(){return m_nScanCount;}
+	BOOL						SetCameraCount(int nCameraCount,int nScanCount);
+	CCameraSettings				*GetCameraSettings(){return m_pCameraSettings;}
+	CCameraSettings				*GetCameraSettings(int iCamera,int iScan);
+	BOOL						SetCameraSettings(CCameraSettings *pCamera);	
+
+	int							GetScanToDimension(DimensionDir eDir);
+	CAMERA_SCANDIR				GetScanToScanDir(int iCam,int iScan);
+	int							GetCameraIndexToDimension(DimensionDir eDir);
+
+	// PLC
+public:
+	CPLCSettings				*GetPLCSettings(){return &m_PLCSettings;}
+	void						SetPLCSettings(CPLCSettings *pPLC){m_PLCSettings=*pPLC;}
+
+public:		
+	int							m_nCameraCount;
+	int							m_nScanCount;		
+	int							m_nPLCSignalRetry;
+	BOARD_TYPE					m_nBoardType;
+	CCameraSettings				*m_pCameraSettings;
+	CPLCSettings				m_PLCSettings;
+	CString						m_strLineID;		
+	BOOL						m_bInsDirReverse;
+	int							m_nFolderRemoveDay;
+	BOOL						m_bUseColorVisual;
+
+	// Software
+public:
+	CSoftSettings				*GetSoftSettings(){return &m_SoftWareSettings;}		
+	CSoftSettings				m_SoftWareSettings;
+
+public:
+	BOOL						m_bUseFreerun;
+	int							m_nFreerunPeriod;
+	int							m_nFreerunExposureTime;
+
+public:
+	BOOL						GetTriggerBoardUse()		{return m_bTriggerBoardUse;}
+	int							GetTriggerBoardComport()	{return m_nTriggerBoardComport;}
+
+	BOOL						m_bTriggerBoardUse;
+	int							m_nTriggerBoardComport;
+
+public:
+	int							m_nFullImageCompressRatio;
+};
\ No newline at end of file
diff --git a/ENRIT/Thread/PriorityThread.cpp b/ENRIT/Thread/PriorityThread.cpp
new file mode 100644
index 0000000..c4ee047
--- /dev/null
+++ b/ENRIT/Thread/PriorityThread.cpp
@@ -0,0 +1,43 @@
+#include "StdAfx.h"
+#include "PriorityThread.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+CPriorityThread::CPriorityThread(IPriorityThread2Parent* pFT2P, int nPriority) : CWorkThreadPool(1), m_pPT2P(pFT2P)
+{
+	m_nPriority = nPriority;
+}
+
+CPriorityThread::~CPriorityThread(void)
+{
+
+}
+
+void CPriorityThread::WorkThreadProcess(PVOID pParameter)
+{
+	if (m_pPT2P==NULL) return;
+
+	CPriorityThreadData *pData = static_cast<CPriorityThreadData*>(pParameter);
+	if (pData==NULL) return;
+
+	HANDLE hThread = GetCurrentThread();
+	SetThreadPriority(hThread, m_nPriority);
+
+	m_pPT2P->IPT2P_PriorityThread(pData);	
+}
+
+BOOL CPriorityThread::AddPriorityThreadData(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+	CPriorityThreadData *pData = new CPriorityThreadData(this);
+	if (pData==NULL) return FALSE;
+
+	pData->m_unMsg = msg;
+	pData->m_WParam = wParam;
+	pData->m_LParam = lParam;
+	
+	return CreateWorkThread(pData);
+}
\ No newline at end of file
diff --git a/ENRIT/Thread/PriorityThread.h b/ENRIT/Thread/PriorityThread.h
new file mode 100644
index 0000000..91e1ef4
--- /dev/null
+++ b/ENRIT/Thread/PriorityThread.h
@@ -0,0 +1,39 @@
+#pragma once
+
+class CPriorityThreadData : public CWorkThreadData
+{
+public:
+	CPriorityThreadData(PVOID pPtr) : CWorkThreadData(pPtr)
+	{
+		m_unMsg = 0;
+		m_WParam = NULL;
+		m_LParam = NULL;
+	}
+	virtual ~CPriorityThreadData()
+	{
+	}
+
+	UINT		m_unMsg;
+	WPARAM		m_WParam;
+	LPARAM		m_LParam;
+};
+
+interface IPriorityThread2Parent
+{
+	virtual void IPT2P_PriorityThread(CPriorityThreadData* pData) = 0;
+};
+
+class CPriorityThread : public CWorkThreadPool
+{
+public:
+	CPriorityThread(IPriorityThread2Parent* pFT2P, int nPriority);
+	virtual ~CPriorityThread(void);
+	BOOL AddPriorityThreadData(UINT msg, WPARAM wParam = NULL, LPARAM lParam = NULL);
+
+protected:
+	virtual void WorkThreadProcess(PVOID pParameter);
+
+protected:
+	IPriorityThread2Parent*		m_pPT2P;
+	int							m_nPriority;	
+};
diff --git a/ENRIT/Thread/Thread_CheckSeq.cpp b/ENRIT/Thread/Thread_CheckSeq.cpp
new file mode 100644
index 0000000..918f478
--- /dev/null
+++ b/ENRIT/Thread/Thread_CheckSeq.cpp
@@ -0,0 +1,144 @@
+// ProcPADThread.cpp : implementation file
+//
+
+#include "StdAfx.h"
+#include "Thread_CheckSeq.h"
+#include "Glass_Data.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CThread_CheckSequence
+CThread_CheckSequence::CThread_CheckSequence(DWORD dwPeriod) : CTimerThreadPool(dwPeriod,1)
+{
+	m_pC2M = NULL;
+	m_pGlassData = NULL;
+}
+
+CThread_CheckSequence::~CThread_CheckSequence()
+{
+	ClearMessage();
+}
+
+BOOL CThread_CheckSequence::CreateThread()
+{
+	BOOL bReturn = TRUE;
+
+	// Thread 积己 饶 Thread 荐青
+	bReturn = CreateTimerThread(this);
+
+	return bReturn;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CThread_CheckSequence message handlers
+
+void CThread_CheckSequence::ClearMessage()
+{
+	CSingleLock MyLock(&m_csCheckMSG);
+	MyLock.Lock();
+
+	std::vector<CCheckSeqMessage>	*pVecCheckMSG;
+	pVecCheckMSG = GetVecCheckSeqMSG();	
+	pVecCheckMSG->clear();		
+
+	MyLock.Unlock();
+}
+
+void CThread_CheckSequence::TimerThreadProcess(PVOID pParameter)
+{
+	CThread_CheckSequence* pSeqThread = static_cast<CThread_CheckSequence*>(pParameter);
+	if(pSeqThread == NULL)
+		return;
+
+	if(pSeqThread->m_pC2M == NULL || pSeqThread->m_pGlassData == NULL)
+	{		
+		return;
+	}
+		
+	std::vector<CCheckSeqMessage>	*pVecCheckMSG,vecMSG;	
+	std::vector<CCheckSeqMessage>::iterator	it;
+	CCheckSeqMessage		SendCheckMSG;
+	CGlass_Data				*pStats = pSeqThread->m_pGlassData;
+
+	if(pStats == NULL)
+	{	
+		return;
+	}
+
+
+	CSingleLock SeqLock(&pSeqThread->m_csCheckMSG);
+	SeqLock.Lock();
+
+	pVecCheckMSG = GetVecCheckSeqMSG();
+	if(pVecCheckMSG->empty() == TRUE)
+	{
+		SeqLock.Unlock();
+		return;
+	}
+
+	vecMSG.resize(pVecCheckMSG->size());
+	std::copy(pVecCheckMSG->begin(),pVecCheckMSG->end(),vecMSG.begin());
+	pVecCheckMSG->clear();
+	
+	SeqLock.Unlock();
+
+	Sleep(0);
+
+	for(it=vecMSG.begin();it!=vecMSG.end();it++)
+	{		
+		SendCheckMSG = *it;
+
+		SendCheckMSG.dwTickEnd = GetTickCount();
+		SendCheckMSG.dwDuration = SendCheckMSG.dwTickEnd - SendCheckMSG.dwTickStart;
+
+		if(pStats->IsPostProcStart() == TRUE)		// Post Process啊 矫累登菌栏搁 了促 昏力 茄促.
+		{
+			it->bDelete = TRUE;
+			continue;
+		}				
+
+		if(SendCheckMSG.dwDuration >= SendCheckMSG.dwCheckTime)
+		{			
+			if(pStats->IsPostProcStart() == FALSE)
+				pSeqThread->m_pC2M->CheckSeqMSG_Received(&SendCheckMSG);				
+			it->bDelete = TRUE;
+		}		
+	}
+
+	CSingleLock MyLock(&pSeqThread->m_csCheckMSG);
+	MyLock.Lock();
+
+	pVecCheckMSG = pSeqThread->GetVecCheckSeqMSG();
+	for(it=vecMSG.begin();it!=vecMSG.end();it++)
+	{
+		if(it->bDelete == FALSE)
+		{
+			pVecCheckMSG->push_back(*it);
+		}
+	}	
+
+	vecMSG.clear();
+	MyLock.Unlock();
+}
+
+int CThread_CheckSequence::AddCheckSeqMSG(CHECKSEQ_MESSAGE_SECTION emSection,DWORD dwChkTime,int iScan)
+{
+	int			nCount = 0;
+
+	CSingleLock MyLock(&m_csCheckMSG);
+	MyLock.Lock();
+
+	CCheckSeqMessage	seqMsg;
+
+	seqMsg.SetCheck(emSection,dwChkTime,iScan);
+	m_VecCheckSeqMSG.push_back(seqMsg);
+	nCount = (int)m_VecCheckSeqMSG.size();
+
+	MyLock.Unlock();
+	return nCount;
+}
diff --git a/ENRIT/Thread/Thread_CheckSeq.h b/ENRIT/Thread/Thread_CheckSeq.h
new file mode 100644
index 0000000..a5dfe6f
--- /dev/null
+++ b/ENRIT/Thread/Thread_CheckSeq.h
@@ -0,0 +1,79 @@
+#pragma once
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <vector>
+
+class CGlass_Data;
+enum CHECKSEQ_MESSAGE_SECTION	{CHECKSEQ_SHORT_SCANSTART_OVERTIME=0,CHECKSEQ_SHORT_SCANSTART_COMPLETE,CHECKSEQ_LONG_SCANSTART_OVERTIME,CHECKSEQ_LONG_SCANSTART_COMPLETE,CHECKSEQ_ONESCAN_OVERTIME,CHECKSEQ_ONESCAN_COMPLETE
+	,CHECKSEQ_GLASS_INSPECTION_OVERTIME,CHECKSEQ_GLASS_INSPECTION_COMPLETE,CHECKSEQ_UNKNOWN};
+
+class CCheckSeqMessage
+{
+public:
+	CCheckSeqMessage(){Reset();}
+	virtual ~CCheckSeqMessage(){;}
+	void		Reset()
+	{
+		iScan = 0;
+		dwTickStart = dwTickEnd = dwDuration = dwCheckTime = 0;
+		emCheckSeq = CHECKSEQ_UNKNOWN;
+		bDelete = FALSE;
+	}
+	void		SetCheck(CHECKSEQ_MESSAGE_SECTION emCheck,DWORD dwChkTime,int ScanIdx)
+	{
+		Reset();
+
+		dwCheckTime = dwChkTime;
+		emCheckSeq = emCheck;
+		dwTickStart = GetTickCount();
+		iScan = ScanIdx;
+		bDelete = FALSE;
+	}
+
+	DWORD		dwTickStart;
+	DWORD		dwTickEnd;
+	DWORD		dwCheckTime;
+	DWORD		dwDuration;
+	int			iScan;
+	BOOL		bDelete;
+	CHECKSEQ_MESSAGE_SECTION emCheckSeq;
+};
+
+interface ICheckSequenceInterface2Parent
+{
+	virtual void		CheckSeqMSG_Received(CCheckSeqMessage *pCheckSeq) = 0;				
+};
+/////////////////////////////////////////////////////////////////////////////
+// CThread_CheckSequence thread
+
+#define		PAD_RECIPE_NAME_CNT			200
+class CThread_CheckSequence : public CTimerThreadPool
+{	
+public:
+	CThread_CheckSequence(DWORD dwPeriod=11);           // protected constructor used by dynamic creation
+	virtual ~CThread_CheckSequence();
+		
+	// Operations
+public:
+	BOOL		CreateThread();	
+	void		SetC2M(ICheckSequenceInterface2Parent *pC2M,CGlass_Data *pGlassData){m_pC2M=pC2M,m_pGlassData = pGlassData;}	
+	//void		SetC2M(ICheckSequenceInterface2Parent *pC2M){m_pC2M=pC2M;}	
+	void		ClearMessage();
+
+	virtual	void TimerThreadProcess(PVOID pParameter);
+
+	std::vector<CCheckSeqMessage>	*GetVecCheckSeqMSG(){return &m_VecCheckSeqMSG;}	
+	int			AddCheckSeqMSG(CHECKSEQ_MESSAGE_SECTION emSection,DWORD dwChkTime,int iScan);	
+		
+protected:
+	CCriticalSection		m_csCheckMSG;	
+	ICheckSequenceInterface2Parent		*m_pC2M;
+	std::vector<CCheckSeqMessage> m_VecCheckSeqMSG;
+	CGlass_Data				*m_pGlassData;	
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
diff --git a/ENRIT/Thread/Thread_ControlIF.cpp b/ENRIT/Thread/Thread_ControlIF.cpp
new file mode 100644
index 0000000..31b7d41
--- /dev/null
+++ b/ENRIT/Thread/Thread_ControlIF.cpp
@@ -0,0 +1,38 @@
+#include "StdAfx.h"
+#include "Thread_ControlIF.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+CThread_ControlIF::CThread_ControlIF(DWORD dwPeriod) : CTimerThreadPool(dwPeriod,1)
+{
+	m_pS2M = NULL;		
+}
+
+
+CThread_ControlIF::~CThread_ControlIF(void)
+{
+}
+
+BOOL CThread_ControlIF::CreateThread()
+{
+	BOOL bReturn = TRUE;
+
+	// Thread 积己 饶 Thread 荐青
+	bReturn = CreateTimerThread(this);
+
+	return bReturn;
+}
+
+void CThread_ControlIF::TimerThreadProcess(PVOID pParameter)
+{
+	CThread_ControlIF* pThread = static_cast<CThread_ControlIF*>(pParameter);
+	if(pThread == NULL)
+		return;
+
+	if(pThread->m_pS2M != NULL)	
+		pThread->m_pS2M->ControlProcess();			
+}
\ No newline at end of file
diff --git a/ENRIT/Thread/Thread_ControlIF.h b/ENRIT/Thread/Thread_ControlIF.h
new file mode 100644
index 0000000..09ef866
--- /dev/null
+++ b/ENRIT/Thread/Thread_ControlIF.h
@@ -0,0 +1,24 @@
+#pragma once
+
+interface IControlInterface2Parent
+{
+	virtual BOOL		ControlProcess() = 0;				
+};
+
+class CThread_ControlIF : public CTimerThreadPool
+{	
+public:
+	CThread_ControlIF(DWORD dwPeriod=100);
+	virtual ~CThread_ControlIF(void);
+
+public:
+	BOOL		CreateThread();		
+	void		SetControl2Main(IControlInterface2Parent *pS2M){m_pS2M = pS2M;}
+
+protected:
+	virtual	void TimerThreadProcess(PVOID pParameter);
+
+protected:		
+	IControlInterface2Parent	*m_pS2M;
+};
+
diff --git a/ENRIT/Thread/Thread_Send.cpp b/ENRIT/Thread/Thread_Send.cpp
new file mode 100644
index 0000000..5860e33
--- /dev/null
+++ b/ENRIT/Thread/Thread_Send.cpp
@@ -0,0 +1,175 @@
+// ProcPADThread.cpp : implementation file
+//
+
+#include "StdAfx.h"
+#include "Thread_Send.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CThread_SendMSG
+CThread_SendMSG::CThread_SendMSG(DWORD dwPeriod) : CTimerThreadPool(dwPeriod,1)
+{
+	m_pS2M = NULL;
+}
+
+CThread_SendMSG::~CThread_SendMSG()
+{
+	ClearMSG();
+}
+
+BOOL CThread_SendMSG::CreateThread()
+{
+	BOOL bReturn = TRUE;
+
+	// Thread 积己 饶 Thread 荐青
+	bReturn = CreateTimerThread(this);
+
+	return bReturn;
+}
+
+void CThread_SendMSG::TimerThreadProcess(PVOID pParameter)
+{
+	CThread_SendMSG* pSendThread = static_cast<CThread_SendMSG*>(pParameter);
+	if(pSendThread == NULL)
+		return;
+
+	if(pSendThread->m_pS2M == NULL)
+	{
+		return;
+	}
+
+	std::vector<CPostSendMessage>	*pVecNetMSG;
+	std::vector<CPostSendMessage>	vecMSG;
+	std::vector<CPostSendMessage>::iterator	it;
+
+	std::vector<CDisableSendMessage>	*pVecDisableMSG;
+	std::vector<CDisableSendMessage>	vecDisableMSG;	
+	std::vector<CDisableSendMessage>::iterator	itDis;
+
+	CPostSendMessage		SendNetMSG;
+	CDisableSendMessage		DisableMSG;
+
+	CSingleLock MyLock(&pSendThread->m_csNetMSG);
+	MyLock.Lock();
+
+	pVecNetMSG = pSendThread->GetVecSendMSG();
+	if(pVecNetMSG->empty() == FALSE)
+	{	
+		vecMSG.resize(pVecNetMSG->size());
+		std::copy(pVecNetMSG->begin(),pVecNetMSG->end(),vecMSG.begin());
+		pVecNetMSG->clear();			
+	}
+	
+	MyLock.Unlock();
+	Sleep(0);
+		
+	CSingleLock MyUnLock(&pSendThread->m_csDisableMSG);
+	MyUnLock.Lock();
+	pVecDisableMSG = pSendThread->GetVecDisableMSG();
+	if(pVecDisableMSG->empty() == FALSE)
+	{	
+		vecDisableMSG.resize(pVecDisableMSG->size());
+		std::copy(pVecDisableMSG->begin(),pVecDisableMSG->end(),vecDisableMSG.begin());
+		pVecDisableMSG->clear();					
+	}
+	MyUnLock.Unlock();
+	Sleep(0);
+
+	for(it=vecMSG.begin();it!=vecMSG.end();it++)
+	{
+		SendNetMSG = *it;
+
+		pSendThread->m_pS2M->SendMSG_Received(&SendNetMSG);
+	}
+	vecMSG.clear();
+
+	Sleep(0);
+
+	DWORD		dwTick;
+	for(itDis=vecDisableMSG.begin();itDis!=vecDisableMSG.end();itDis++)
+	{
+		DisableMSG = *itDis;
+		if(DisableMSG.dwStart <= 0 || DisableMSG.dwOntime <= 0)
+			continue;
+
+		dwTick = GetTickCount()-DisableMSG.dwStart;
+
+		if(dwTick >= DisableMSG.dwOntime)
+		{
+			DisableMSG.nValue = 0;
+			pSendThread->m_pS2M->SendMSG_Received(&DisableMSG);
+		}
+		else
+		{
+			CSingleLock MyUnLock(&pSendThread->m_csDisableMSG);
+			MyUnLock.Lock();
+			pSendThread->m_VecDisableMSG.push_back(DisableMSG);
+			MyUnLock.Unlock();
+		}
+	}
+	vecDisableMSG.clear();	
+}
+
+int	CThread_SendMSG::AddDisableMSG(SEND_MESSAGE_SECTION emSection,int nSignal, int nValue, DWORD dwOntime)
+{
+	CDisableSendMessage		DisableMsg;	
+
+	DisableMsg.emSection = emSection;	
+	DisableMsg.nSignal = nSignal;
+	DisableMsg.nValue = nValue;	
+	DisableMsg.dwOntime = dwOntime;
+	DisableMsg.dwStart = GetTickCount();
+
+	CSingleLock MyLock(&m_csDisableMSG);
+	MyLock.Lock();
+
+	m_VecDisableMSG.push_back(DisableMsg);
+	int nCount = (int)m_VecDisableMSG.size();
+
+	MyLock.Unlock();
+
+	return nCount;
+}
+
+int	CThread_SendMSG::AddSendMSG(SEND_MESSAGE_SECTION emSection,int nSignal, int nValue)
+{
+	CPostSendMessage		netMessage;	
+
+	netMessage.emSection = emSection;	
+	netMessage.nSignal = nSignal;
+	netMessage.nValue = nValue;	
+
+	CSingleLock MyLock(&m_csNetMSG);
+	MyLock.Lock();
+
+	m_VecSendMSG.push_back(netMessage);
+	int nCount = (int)m_VecSendMSG.size();
+
+	MyLock.Unlock();
+
+	return nCount;
+}
+
+BOOL CThread_SendMSG::ClearMSG()
+{
+	CSingleLock MyLock(&m_csNetMSG);
+	MyLock.Lock();
+
+	m_VecSendMSG.clear();
+
+	MyLock.Unlock();
+
+	CSingleLock MyUnLock(&m_csDisableMSG);
+	MyUnLock.Lock();
+
+	m_VecDisableMSG.clear();
+
+	MyUnLock.Unlock();
+
+	return TRUE;
+}
diff --git a/ENRIT/Thread/Thread_Send.h b/ENRIT/Thread/Thread_Send.h
new file mode 100644
index 0000000..9ae9728
--- /dev/null
+++ b/ENRIT/Thread/Thread_Send.h
@@ -0,0 +1,79 @@
+#pragma once
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <vector>
+
+enum SEND_MESSAGE_SECTION	{SEND_MESSAGE_ALL=0,SEND_MESSAGE_CONTROLSIGNAL,SEND_MESSAGE_ALARM,SEND_MESSAGE_REVIEWSIGNAL,SEND_MESSAGE_UNKNOWN};
+
+class CPostSendMessage
+{
+public:
+	CPostSendMessage(){Reset();}
+	virtual ~CPostSendMessage(){;}
+	void		Reset()
+	{
+		nSignal = nValue = -1;
+		emSection = SEND_MESSAGE_UNKNOWN;
+	}
+
+	SEND_MESSAGE_SECTION emSection;	
+	int nSignal;	
+	int nValue;
+}; 
+
+class CDisableSendMessage : public CPostSendMessage
+{
+public:
+	CDisableSendMessage(){Reset();}
+	virtual ~CDisableSendMessage(){;}
+	void		Reset()
+	{
+		CPostSendMessage::Reset();
+		dwOntime = dwStart = 0;
+	}
+
+	DWORD		dwOntime;
+	DWORD		dwStart;
+}; 
+
+
+interface IPLCSendInterface2Parent
+{
+	virtual void		SendMSG_Received(CPostSendMessage *pSendMSG) = 0;				
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// CThread_SendMSG thread
+
+#define		PAD_RECIPE_NAME_CNT			200
+class CThread_SendMSG : public CTimerThreadPool
+{
+public:
+	CThread_SendMSG(DWORD dwPeriod=15);           // protected constructor used by dynamic creation
+	virtual ~CThread_SendMSG();
+		
+public:	
+	BOOL		CreateThread();	
+	void		SetIN2P(IPLCSendInterface2Parent *pN2M){m_pS2M=pN2M;}
+
+	std::vector<CPostSendMessage>	*GetVecSendMSG(){return &m_VecSendMSG;}	
+	int			AddSendMSG(SEND_MESSAGE_SECTION emSection,int nSignal, int nValue);		
+
+	std::vector<CDisableSendMessage>	*GetVecDisableMSG(){return &m_VecDisableMSG;}	
+	int			AddDisableMSG(SEND_MESSAGE_SECTION emSection,int nSignal, int nValue, DWORD dwOntime);		
+
+	BOOL		ClearMSG();		
+
+	virtual	void TimerThreadProcess(PVOID pParameter);
+
+protected:
+	CCriticalSection		m_csNetMSG;	
+	CCriticalSection		m_csDisableMSG;
+	IPLCSendInterface2Parent		*m_pS2M;
+	std::vector<CPostSendMessage> m_VecSendMSG;	
+	std::vector<CDisableSendMessage> m_VecDisableMSG;	
+	
+};
diff --git a/ENRIT/Thread/Thread_ViewRefresh.cpp b/ENRIT/Thread/Thread_ViewRefresh.cpp
new file mode 100644
index 0000000..ea404de
--- /dev/null
+++ b/ENRIT/Thread/Thread_ViewRefresh.cpp
@@ -0,0 +1,96 @@
+#include "StdAfx.h"
+#include "Thread_ViewRefresh.h"
+
+
+CThread_ViewRefresh::CThread_ViewRefresh(DWORD dwPeriod) : CTimerThreadPool(dwPeriod,10)
+{
+	m_pV2M = NULL;
+}
+
+
+CThread_ViewRefresh::~CThread_ViewRefresh(void)
+{
+}
+
+BOOL CThread_ViewRefresh::CreateThread()
+{
+	BOOL bReturn = TRUE;
+
+	// Thread 积己 饶 Thread 荐青
+	bReturn = CreateTimerThread(this);
+
+	return bReturn;
+}
+
+void CThread_ViewRefresh::TimerThreadProcess(PVOID pParameter)
+{
+	CThread_ViewRefresh* pThread = static_cast<CThread_ViewRefresh*>(pParameter);
+	if(pThread == NULL)
+		return;
+
+	std::vector<CScheduleViewMessage>	*pVecViewMSG;
+	std::vector<CScheduleViewMessage>	vecMSG;
+	std::vector<CScheduleViewMessage>::iterator	it;
+	CScheduleViewMessage		SendViewMSG;
+
+	if(pThread->m_pV2M == NULL)
+	{
+		return;
+	}
+
+	CSingleLock mylock(&pThread->m_csViewMSG);
+	mylock.Lock();
+	pVecViewMSG = pThread->GetVecScheduleViewMSG();
+	if(pVecViewMSG->empty() == TRUE)
+	{
+		mylock.Unlock();
+		return;
+	}
+
+	vecMSG.resize(pVecViewMSG->size());
+	std::copy(pVecViewMSG->begin(),pVecViewMSG->end(),vecMSG.begin());
+	pVecViewMSG->clear();	
+	mylock.Unlock();
+
+	Sleep(0);
+
+	for(it=vecMSG.begin();it!=vecMSG.end();it++)
+	{
+		SendViewMSG = *it;
+
+		pThread->m_pV2M->Send_ViewRefresh(&SendViewMSG);
+	}
+	vecMSG.clear();
+
+}
+
+int	CThread_ViewRefresh::AddViewMSG(int nJobIndex,int nSide,int nState,int nDispLine)
+{
+	CSingleLock mylock(&m_csViewMSG);
+	mylock.Lock();
+
+	CScheduleViewMessage		ViewMessage;	
+
+	ViewMessage.ProcMsg.nJobIndex = nJobIndex;
+	ViewMessage.ProcMsg.nSide = nSide;
+	ViewMessage.ProcMsg.nState = nState;
+	ViewMessage.ProcMsg.nDispLine = nDispLine;
+
+	m_VecScheduleViewMSG.push_back(ViewMessage);
+	int nCount = (int)m_VecScheduleViewMSG.size();
+
+	mylock.Unlock();
+	return nCount;
+}
+
+
+BOOL CThread_ViewRefresh::ClearViewMSG()
+{
+	CSingleLock mylock(&m_csViewMSG);
+	mylock.Lock();
+
+	m_VecScheduleViewMSG.clear();
+
+	mylock.Unlock();
+	return TRUE;
+}
\ No newline at end of file
diff --git a/ENRIT/Thread/Thread_ViewRefresh.h b/ENRIT/Thread/Thread_ViewRefresh.h
new file mode 100644
index 0000000..d0d1d74
--- /dev/null
+++ b/ENRIT/Thread/Thread_ViewRefresh.h
@@ -0,0 +1,47 @@
+#pragma once
+
+#include "Global_Define.h"
+
+class CScheduleViewMessage
+{
+public:
+	CScheduleViewMessage(){Reset();}
+	virtual ~CScheduleViewMessage(){;}
+	void		Reset()
+	{
+		ZeroMemory(&ProcMsg,sizeof(PROG_MSG));
+	}
+
+	PROG_MSG		ProcMsg;
+};
+
+interface IViewRefreshInterface2Parent
+{
+	virtual void		Send_ViewRefresh(CScheduleViewMessage *pMSG) = 0;				
+};
+
+class CThread_ViewRefresh : public CTimerThreadPool
+{
+public:
+	CThread_ViewRefresh(DWORD dwPeriod=50);
+	virtual ~CThread_ViewRefresh(void);
+
+public:
+	BOOL		CreateThread();
+	void		SetIN2P(IViewRefreshInterface2Parent *pV2M){m_pV2M=pV2M;}
+
+	std::vector<CScheduleViewMessage>	*GetVecScheduleViewMSG(){return &m_VecScheduleViewMSG;}	
+	int			AddViewMSG(int nJobIndex,int nSide,int nState,int nDispLine);		
+
+	BOOL		ClearViewMSG();	
+
+protected:
+	virtual	void TimerThreadProcess(PVOID pParameter);	
+
+protected:
+	IViewRefreshInterface2Parent		*m_pV2M;
+
+	CCriticalSection		m_csViewMSG;		
+	std::vector<CScheduleViewMessage> m_VecScheduleViewMSG;
+};
+
diff --git a/ENRIT/TriggerBoard/TriggerBoard.zip b/ENRIT/TriggerBoard/TriggerBoard.zip
new file mode 100644
index 0000000..ed8abb5
--- /dev/null
+++ b/ENRIT/TriggerBoard/TriggerBoard.zip
Binary files differ
diff --git a/ENRIT/TriggerBoard/TriggerControl_Mvsol.cpp b/ENRIT/TriggerBoard/TriggerControl_Mvsol.cpp
new file mode 100644
index 0000000..413c3d0
--- /dev/null
+++ b/ENRIT/TriggerBoard/TriggerControl_Mvsol.cpp
@@ -0,0 +1,323 @@
+#include "StdAfx.h"
+#include "TriggerControl_Mvsol.h"
+
+CTriggerControl_Mvsol::CTriggerControl_Mvsol(void)
+{
+	m_hTriggerControl = NULL;
+}
+
+CTriggerControl_Mvsol::~CTriggerControl_Mvsol(void)
+{
+	DisConnect();
+}
+
+BOOL CTriggerControl_Mvsol::Connect(int nComPort)
+{
+	if(IsConnect() == TRUE)
+		return TRUE;
+
+	DCB dcb;
+
+	CString strPort;
+	strPort.Format(_T("COM%d"), nComPort);
+
+	m_hTriggerControl = CreateFile( strPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
+
+	if (m_hTriggerControl == INVALID_HANDLE_VALUE)
+	{
+		CloseHandle(m_hTriggerControl);
+		m_hTriggerControl = NULL;
+		return FALSE;
+	}
+
+	dcb.DCBlength = sizeof(DCB);
+	if (GetCommState(m_hTriggerControl,(LPDCB) &dcb))
+	{
+		dcb.DCBlength		= sizeof(DCB);
+		dcb.BaudRate		= CBR_115200;
+		dcb.ByteSize		= 8;
+		//dcb.fParity			= FALSE;
+		dcb.Parity			= NOPARITY;
+		//dcb.StopBits		= 1;
+		//dcb.fOutxCtsFlow	= 0;
+		//dcb.fOutxDsrFlow	= 0;
+		//dcb.fOutX			= 0;
+		//dcb.fInX			= 0;
+
+		// Serial Buadrate : 115,200bps
+		// Databit : 8
+		// Parity : None
+		// Stop bit : 1
+		// Flow control : None
+
+		if (!SetCommState(m_hTriggerControl,(LPDCB) &dcb))
+		{
+			CloseHandle(m_hTriggerControl);
+			m_hTriggerControl = NULL;
+			return FALSE;
+		}
+	}
+	else
+	{
+		CloseHandle(m_hTriggerControl);
+		m_hTriggerControl = NULL;
+		return FALSE;
+	}	
+
+	return TRUE;
+}
+
+BOOL CTriggerControl_Mvsol::DisConnect()
+{
+	if(IsConnect() == FALSE)
+		return TRUE;
+
+	if (m_hTriggerControl)
+		CloseHandle(m_hTriggerControl);
+	m_hTriggerControl = NULL;
+
+	return TRUE;
+}
+
+
+
+BOOL CTriggerControl_Mvsol::IsConnect()
+{
+	return (m_hTriggerControl == NULL) ? FALSE : TRUE;
+}
+
+// 飘府芭0锅 盲澄狼 浚内歹 涝仿阑 0锅栏肺 静扁
+// SND : 02 57 00 00 00 74 00 80 00 4B 03
+// ACK : 02 77 00 00 00 74 00 80 00 6B 03
+// 飘府芭1锅 盲澄狼 浚内歹 涝仿阑 0锅栏肺 静扁
+// SND : 02 57 00 01 00 74 00 80 00 4C 03
+// ACK : 02 77 00 01 00 74 00 80 00 6C 03
+// 飘府芭2锅 盲澄狼 浚内歹 涝仿阑 0锅栏肺 静扁
+// SND : 02 57 00 7D 22 00 74 00 80 00 4D 03
+// ACK : 02 77 00 7D 22 00 74 00 80 00 6D 03
+// 飘府芭3锅 盲澄狼 浚内歹 涝仿阑 0锅栏肺 静扁
+// SND : 02 57 00 7D 23 00 74 00 80 00 4E 03
+// ACK : 02 77 00 7D 23 00 74 00 80 00 6E 03
+
+// 飘府芭0锅 盲澄狼 浚内歹 涝仿阑 1锅栏肺 静扁
+// SND : 02 57 00 00 10 74 00 80 00 5B 03
+// ACK : 02 77 00 00 10 74 00 80 00 7B 03
+// 飘府芭1锅 盲澄狼 浚内歹 涝仿阑 1锅栏肺 静扁
+// SND : 02 57 00 01 10 74 00 80 00 5C 03
+// ACK : 02 77 00 00 10 74 00 80 00 7B 03
+// 飘府芭2锅 盲澄狼 浚内歹 涝仿阑 1锅栏肺 静扁
+// SND : 02 57 00 7D 22 10 74 00 80 00 5D 03
+// ACK : 02 77 00 7D 22 10 74 00 80 00 7D 5D 03
+// 飘府芭3锅 盲澄狼 浚内歹 涝仿阑 1锅栏肺 静扁
+// SND : 02 57 00 7D 23 10 74 00 80 00 5E 03
+// ACK : 02 77 00 7D 23 10 74 00 80 00 7E 03
+
+
+BOOL CTriggerControl_Mvsol::SetSelectEncoder(int nEncoderChanel)
+{
+	if(IsConnect() == FALSE)
+		return FALSE;
+
+	SetSelectEncoder_Trigger_Out_0(nEncoderChanel);
+	SetSelectEncoder_Trigger_Out_1(nEncoderChanel);
+	SetSelectEncoder_Trigger_Out_2(nEncoderChanel);
+	SetSelectEncoder_Trigger_Out_3(nEncoderChanel);
+
+	return TRUE;
+}
+
+BOOL CTriggerControl_Mvsol::SetSelectEncoder_Trigger_Out_0(int nEncoderChanel)
+{
+	BYTE Data[64];
+	memset(&Data[0],0x00,sizeof(Data));
+
+	DWORD dwIndex = 0;
+
+	switch(nEncoderChanel)
+	{
+	case 0:
+		// 02 57 00 00 00 74 00 80 00 4B 03
+		Data[dwIndex++] = 0x02;
+		Data[dwIndex++] = 0x57;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x74;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x80;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x4B;
+		Data[dwIndex++] = 0x03;
+		break;
+	case 1:
+		// 02 57 00 00 10 74 00 80 00 5B 03
+		Data[dwIndex++] = 0x02;
+		Data[dwIndex++] = 0x57;
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x10; 
+		Data[dwIndex++] = 0x74; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x80; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x5B; 
+		Data[dwIndex++] = 0x03;
+		break;
+	default:
+		return FALSE;
+	}
+
+	DWORD NumberOfBytesWritten;
+
+	BOOL bRet = WriteFile( m_hTriggerControl,(LPCVOID) Data, dwIndex,(LPDWORD) &NumberOfBytesWritten, NULL);
+
+	return bRet;
+}
+
+BOOL CTriggerControl_Mvsol::SetSelectEncoder_Trigger_Out_1(int nEncoderChanel)
+{
+	BYTE Data[64];
+	memset(&Data[0],0x00,sizeof(Data));
+
+	DWORD dwIndex = 0;
+
+	switch(nEncoderChanel)
+	{
+	case 0:
+		// 02 57 00 01 00 74 00 80 00 4C 03
+		Data[dwIndex++] = 0x02;
+		Data[dwIndex++] = 0x57;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x01;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x74;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x80;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x4C;
+		Data[dwIndex++] = 0x03;
+		break;
+	case 1:
+		// 02 57 00 01 10 74 00 80 00 5C 03
+		Data[dwIndex++] = 0x02;
+		Data[dwIndex++] = 0x57;
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x01; 
+		Data[dwIndex++] = 0x10; 
+		Data[dwIndex++] = 0x74; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x80; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x5C; 
+		Data[dwIndex++] = 0x03;
+		break;
+	default:
+		return FALSE;
+	}
+
+	DWORD NumberOfBytesWritten;
+
+	BOOL bRet = WriteFile( m_hTriggerControl,(LPCVOID) Data, dwIndex,(LPDWORD) &NumberOfBytesWritten, NULL);
+
+	return bRet;
+}
+
+BOOL CTriggerControl_Mvsol::SetSelectEncoder_Trigger_Out_2(int nEncoderChanel)
+{
+	BYTE Data[64];
+	memset(&Data[0],0x00,sizeof(Data));
+
+	DWORD dwIndex = 0;
+
+	switch(nEncoderChanel)
+	{
+	case 0:
+		// 02 57 00 7D 22 00 74 00 80 00 4D 03
+		Data[dwIndex++] = 0x02;
+		Data[dwIndex++] = 0x57;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x7D;
+		Data[dwIndex++] = 0x22;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x74;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x80;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x4D;
+		Data[dwIndex++] = 0x03;
+		break;
+	case 1:
+		// 02 57 00 7D 22 10 74 00 80 00 5D 03
+		Data[dwIndex++] = 0x02;
+		Data[dwIndex++] = 0x57;
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x7D; 
+		Data[dwIndex++] = 0x22; 
+		Data[dwIndex++] = 0x10; 
+		Data[dwIndex++] = 0x74; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x80; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x5D;
+		Data[dwIndex++] = 0x03;
+		break;
+	default:
+		return FALSE;
+	}
+
+	DWORD NumberOfBytesWritten;
+
+	BOOL bRet = WriteFile( m_hTriggerControl,(LPCVOID) Data, dwIndex,(LPDWORD) &NumberOfBytesWritten, NULL);
+
+	return bRet;
+}
+
+BOOL CTriggerControl_Mvsol::SetSelectEncoder_Trigger_Out_3(int nEncoderChanel)
+{
+	BYTE Data[64];
+	memset(&Data[0],0x00,sizeof(Data));
+
+	DWORD dwIndex = 0;
+
+	switch(nEncoderChanel)
+	{
+	case 0:
+		// 02 57 00 7D 23 00 74 00 80 00 4E 03
+		Data[dwIndex++] = 0x02;
+		Data[dwIndex++] = 0x57;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x7D;
+		Data[dwIndex++] = 0x23;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x74;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x80;
+		Data[dwIndex++] = 0x00;
+		Data[dwIndex++] = 0x4E;
+		Data[dwIndex++] = 0x03;
+		break;
+	case 1:
+		// 02 57 00 7D 23 10 74 00 80 00 5E 03
+		Data[dwIndex++] = 0x02;
+		Data[dwIndex++] = 0x57;
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x7D; 
+		Data[dwIndex++] = 0x23; 
+		Data[dwIndex++] = 0x10; 
+		Data[dwIndex++] = 0x74; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x80; 
+		Data[dwIndex++] = 0x00; 
+		Data[dwIndex++] = 0x5E;
+		Data[dwIndex++] = 0x03;
+		break;
+	default:
+		return FALSE;
+	}
+
+	DWORD NumberOfBytesWritten;
+
+	BOOL bRet = WriteFile( m_hTriggerControl,(LPCVOID) Data, dwIndex,(LPDWORD) &NumberOfBytesWritten, NULL);
+
+	return bRet;
+}
\ No newline at end of file
diff --git a/ENRIT/TriggerBoard/TriggerControl_Mvsol.h b/ENRIT/TriggerBoard/TriggerControl_Mvsol.h
new file mode 100644
index 0000000..b5e72d1
--- /dev/null
+++ b/ENRIT/TriggerBoard/TriggerControl_Mvsol.h
@@ -0,0 +1,30 @@
+#pragma once
+
+class CTriggerControl_Mvsol
+{
+public:
+	CTriggerControl_Mvsol(void);
+	~CTriggerControl_Mvsol(void);
+
+	BOOL IsConnect();
+
+	BOOL Connect(int nComPort);
+	BOOL DisConnect();
+
+public:
+	BOOL SetSelectEncoder(int nEncoderChanel);
+
+private:
+	BOOL SetSelectEncoder_Trigger_Out_0(int nEncoderChanel);
+	BOOL SetSelectEncoder_Trigger_Out_1(int nEncoderChanel);
+	BOOL SetSelectEncoder_Trigger_Out_2(int nEncoderChanel);
+	BOOL SetSelectEncoder_Trigger_Out_3(int nEncoderChanel);
+
+	BOOL SetDigitalInput_1(BOOL bOn);
+	BOOL SetDigitalInput_2(BOOL bOn);
+	BOOL SetDigitalInput_3(BOOL bOn);
+
+private:
+	HANDLE		  m_hTriggerControl;
+};
+
diff --git a/ENRIT/UITool/DisplayMessage.cpp b/ENRIT/UITool/DisplayMessage.cpp
new file mode 100644
index 0000000..7075c79
--- /dev/null
+++ b/ENRIT/UITool/DisplayMessage.cpp
@@ -0,0 +1,131 @@
+#include "StdAfx.h"
+#include "DisplayMessage.h"
+
+CDisplayMessage::CDisplayMessage()
+{
+	m_pDM2P	= NULL;
+	m_pFileLog = NULL;	
+
+	InitializeCriticalSection(&m_csLog);
+}
+
+CDisplayMessage::~CDisplayMessage(void)
+{
+	if (m_pFileLog)
+	{
+		delete m_pFileLog;
+		m_pFileLog = NULL;
+	}
+
+	DeleteCriticalSection(&m_csLog);
+}
+
+void CDisplayMessage::SetPath(const CString& strPath)
+{
+	m_strLogPath = strPath;
+
+	CreateDirectory(m_strLogPath, NULL);
+
+	m_FSLog.SetRemainDelete(m_strLogPath, TARGETTYPE_FILE, 300);	
+
+	MakeLogFile();
+}
+
+BOOL CDisplayMessage::MakeLogFile()
+{
+	// Log 贸府
+	if (m_strLogPath.IsEmpty())
+		return FALSE;
+
+	m_FSLog.CommitSchedule();
+
+	m_TimeLogFile = CTime::GetCurrentTime();
+	m_strLogFile.Format(_T("%s\\%04d%02d%02d.log"), m_strLogPath, m_TimeLogFile.GetYear(), m_TimeLogFile.GetMonth(), m_TimeLogFile.GetDay());
+
+	if (m_pFileLog)
+	{
+		delete m_pFileLog;
+		m_pFileLog = NULL;
+	}
+
+	m_pFileLog = new CStdioFile();
+
+	return TRUE;
+}
+
+void CDisplayMessage::DisplayMessage(const CString& strMessage)
+{
+	CString strValue = _T("");
+	//CTime time = CTime::GetCurrentTime();
+	//strValue.Format(_T("[%02d:%02d:%02d] %s"), time.GetHour(), time.GetMinute(), time.GetSecond(), strMessage);
+	
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+	strValue.Format(_T("[%02d:%02d:%02d.%03d] %s"), st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, strMessage);
+
+	WriteToFile(strValue);
+	if(m_pDM2P)
+	{
+		m_pDM2P->DisplayMessage((TCHAR*)(LPCTSTR)strValue);
+	}
+}
+
+void CDisplayMessage::DisplayMessage(const TCHAR* lpstrFormat, ...)
+{
+	va_list list;
+	TCHAR strText[2000] = {0};
+
+	va_start(list, lpstrFormat);
+	_vstprintf_s(strText, lpstrFormat, list);
+	va_end(list);
+
+	CString strValue = _T("");
+	//CTime time = CTime::GetCurrentTime();
+	//strValue.Format(_T("[%02d:%02d:%02d] %s"), time.GetHour(), time.GetMinute(), time.GetSecond(), strText);
+
+	SYSTEMTIME st;
+	GetLocalTime(&st);
+	strValue.Format(_T("[%02d:%02d:%02d.%03d] %s"), st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, strText);
+
+	WriteToFile(strValue);
+
+	if(m_pDM2P)
+	{
+		m_pDM2P->DisplayMessage((TCHAR*)(LPCTSTR)strValue);
+	}
+}
+
+BOOL CDisplayMessage::WriteToFile(const CString& strMessage)
+{
+	if(m_pFileLog == NULL)	return FALSE;
+
+	EnterCriticalSection(&m_csLog);
+
+	CTime time = CTime::GetCurrentTime();
+
+	if ((time.GetMonth() != m_TimeLogFile.GetMonth()) || (time.GetDay() != m_TimeLogFile.GetDay()) || !m_pFileLog)
+	{
+		MakeLogFile();
+	}
+
+	if ( !m_pFileLog->Open(m_strLogFile, CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate | CFile::shareDenyNone, &m_fileException) )
+	{
+		// #ifdef _DEBUG
+		// 		TCHAR   szCause[255] = {0};
+		// 		ex.GetErrorMessage(szCause, 255);
+		// 		TRACE(szCause);
+		// #endif
+		LeaveCriticalSection(&m_csLog);
+		return FALSE;
+	}
+
+	m_pFileLog->SeekToEnd();	
+	m_pFileLog->WriteString((TCHAR*)(LPCTSTR)strMessage);
+	m_pFileLog->Close();
+
+	LeaveCriticalSection(&m_csLog);
+
+	return TRUE;
+}
+
+
diff --git a/ENRIT/UITool/DisplayMessage.h b/ENRIT/UITool/DisplayMessage.h
new file mode 100644
index 0000000..bf369eb
--- /dev/null
+++ b/ENRIT/UITool/DisplayMessage.h
@@ -0,0 +1,42 @@
+// DisplayMessage.h: interface for the CDisplayMessage class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "Singleton.h"
+#include "IncludeSDK.h"
+
+interface IDisplyMessage2Parent
+{	
+	virtual void		DisplayMessage(TCHAR* str) = 0;	
+};
+
+class CDisplayMessage : public Singleton<CDisplayMessage>
+{
+public:
+	CDisplayMessage();
+	virtual ~CDisplayMessage(void);
+
+public:
+	void	SetDM2P(IDisplyMessage2Parent* pDM2P)		{ m_pDM2P = pDM2P; }
+	void	SetPath(const CString& strPath);
+	BOOL	MakeLogFile();
+	BOOL	WriteToFile(const CString& strMessage);
+	void	DisplayMessage(const CString& strMessage);
+	void	DisplayMessage(const TCHAR* lpstrFormat, ...);		
+
+public:
+	CTime						m_TimeLogFile;
+	CString						m_strLogPath;
+	CString						m_strLogFile;
+	IDisplyMessage2Parent*		m_pDM2P;
+	CRITICAL_SECTION			m_csLog;
+	CSISFolderScheduling		m_FSLog;
+
+
+	CStdioFile*					m_pFileLog;
+	CFileException				m_fileException;
+};
+
+#define g_pLog		CDisplayMessage::GetSingletonPtr()
\ No newline at end of file
diff --git a/ENRIT/UITool/General_Draw.cpp b/ENRIT/UITool/General_Draw.cpp
new file mode 100644
index 0000000..7b563a0
--- /dev/null
+++ b/ENRIT/UITool/General_Draw.cpp
@@ -0,0 +1,62 @@
+
+#include "StdAfx.h"
+#include "General_Draw.h"
+#include "Server_MemDC.h"
+
+CGeneralDraw::CGeneralDraw(void)
+{
+}
+
+CGeneralDraw::~CGeneralDraw(void)
+{
+}
+
+void CGeneralDraw::DrawPitureControl(CUIPictureControl &pPicture)
+{
+	if(pPicture.isVaildDC() == FALSE)
+		return;
+	
+	CBrush		brush,backbrush,brushDisable;	
+	HFONT		font,pOldFont;	
+	HDC			hDC;
+	CRect		rect = pPicture.m_rect;
+	
+	// create font
+	font = ::CreateFont(pPicture.m_nFontsize, 0, 0, 0, pPicture.m_nFontType, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, pPicture.m_strFont);	
+	
+	CControlMemDC memDC(pPicture.m_pDC, &rect);	
+	hDC = memDC.GetSafeHdc();
+	
+	pOldFont = (HFONT) ::SelectObject(hDC, font);		
+	if(::GetTextColor(hDC) != pPicture.m_colText) ::SetTextColor(hDC, pPicture.m_colText);
+	::SetBkMode(hDC, TRANSPARENT);	
+	
+	brushDisable.CreateSolidBrush(RGB(128,128,128));
+	brush.CreateSolidBrush(pPicture.m_colInner);
+	backbrush.CreateSolidBrush(pPicture.m_colBack);
+	::FillRect(hDC,&rect,(HBRUSH)backbrush);
+	rect.left += pPicture.m_nInnerOffset;
+	rect.right -= pPicture.m_nInnerOffset;
+	rect.top += pPicture.m_nInnerOffset;
+	rect.bottom -= pPicture.m_nInnerOffset;			
+	
+	if(pPicture.m_bEnable == TRUE)
+	{
+		::FillRect(hDC,&rect,(HBRUSH)brush);
+		rect.left += pPicture.m_FontOffset.x;
+		rect.top += pPicture.m_FontOffset.y;
+		::DrawText(hDC, pPicture.m_strData, pPicture.m_strData.GetLength(), &rect, pPicture.m_nAlign);
+	}
+	else
+	{
+		::FillRect(hDC,&rect,(HBRUSH)brushDisable);
+	}
+	
+	brush.DeleteObject();
+	backbrush.DeleteObject();
+	brushDisable.DeleteObject();
+	::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+	::DeleteObject(font);
+}
\ No newline at end of file
diff --git a/ENRIT/UITool/General_Draw.h b/ENRIT/UITool/General_Draw.h
new file mode 100644
index 0000000..b7d445f
--- /dev/null
+++ b/ENRIT/UITool/General_Draw.h
@@ -0,0 +1,240 @@
+#if !defined(__GENERALDRAW_INCLUDED__)
+#define __GENERALDRAW_INCLUDED__
+
+//////////////////////////////////////////////////////////////////////////
+// Color
+#define DLG_FONT_COLOR	RGB(255,255,255)
+#define DLG_BK_COLOR_1	RGB(0,128,128)
+#define DLG_BK_COLOR_2	RGB(5,64,128)
+#define DLG_BK_COLOR_3	RGB(10,20,30)
+#define DLG_BK_COLOR_4	RGB(0,0,0)
+
+//////////////////////////////////////////////////////////////////////////
+// Font Control
+const int MAX_FONT_COUNT = 9;
+class CFontControl
+{	
+public:
+	enum	EN_FONT_SECTION{EN_MAINFONT=0,EN_SUBFONT,EN_SUBFONT_NORMAL,EN_ITEMFONT,EN_DATAFONT,EN_BUTTONFONT,EN_HANFONT,EN_LARGEFONT,EN_MIDDLEFONT};
+
+	CFontControl()
+	{
+		CreateFont(&m_Font[EN_MAINFONT],16,_T("Arial"));
+		CreateFont(&m_Font[EN_SUBFONT],18,_T("Arial"));
+		CreateFont(&m_Font[EN_SUBFONT_NORMAL],18,_T("Arial"),FW_NORMAL);
+		CreateFont(&m_Font[EN_ITEMFONT],14,_T("Arial"));
+		CreateFont(&m_Font[EN_DATAFONT],12,_T("Arial"));
+		CreateFont(&m_Font[EN_BUTTONFONT],24,_T("Arial"));
+		CreateFont(&m_Font[EN_HANFONT],12,_T("奔覆眉"));
+		CreateFont(&m_Font[EN_LARGEFONT],48,_T("Arial"));
+		CreateFont(&m_Font[EN_MIDDLEFONT],35,_T("Arial"));
+	}
+	~CFontControl()
+	{
+		int			i;
+
+		for(i=0;i<MAX_FONT_COUNT;i++)
+		{
+			if(m_Font[i].GetSafeHandle() != NULL)
+				m_Font[i].DeleteObject();
+		}	
+	}	
+	CFont *GetFont(EN_FONT_SECTION enFont) {return m_Font[enFont].GetSafeHandle() != NULL?&m_Font[enFont]:NULL;}	
+	void SetFont(CWnd *pWnd,UINT nCID,EN_FONT_SECTION enFont)
+	{
+		if(enFont < 0 || enFont >= MAX_FONT_COUNT)
+			return;
+
+		pWnd->GetDlgItem(nCID)->SetFont(GetFont(enFont));
+	}
+	void CreateFont(CFont *pFont,int nFontSize,CString strFont,int nWidth=FW_BOLD)
+	{
+		if(pFont->GetSafeHandle() != NULL)
+			return;
+
+		pFont->CreateFont( nFontSize,// nHeight 
+			nFontSize/2, // nWidth 
+			0, // nEscapement 
+			0, // nOrientation 
+			nWidth , // nWeight 
+			0, // bItalic 
+			0, // bUnderline 
+			0, // cStrikeOut 
+			0, // nCharSet 
+			OUT_DEFAULT_PRECIS, // nOutPrecision 
+			0,                                 // nClipPrecision 
+			ANTIALIASED_QUALITY,       // nQuality
+			// nPitchAndFamily 
+			DEFAULT_PITCH | FF_DONTCARE, 
+			strFont );		
+	}
+protected:
+	CFont		m_Font[MAX_FONT_COUNT];
+};
+//////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////
+// Brush Control
+const int MAX_BRUSH_COUNT = 6;
+class CBrushControl
+{	
+public:
+	enum	EN_BRUSH_SECTION{EN_MAINBRUSH=0,EN_SUBBRUSH,EN_BACKBRUSH,EN_DATABRUSH,EN_MAINBKBRUSH,EN_WHITEBRUSH};
+	
+	CBrushControl()
+	{
+		CreateBrush(&m_Brush[EN_MAINBRUSH],RGB(0,128,128));
+		CreateBrush(&m_Brush[EN_SUBBRUSH],RGB(0,0,0));
+		CreateBrush(&m_Brush[EN_BACKBRUSH],RGB(5,64,128));
+		CreateBrush(&m_Brush[EN_DATABRUSH],RGB(180,150,190));
+		CreateBrush(&m_Brush[EN_MAINBKBRUSH],RGB(10,20,30));
+		CreateBrush(&m_Brush[EN_WHITEBRUSH],RGB(255,255,255));
+	}
+	~CBrushControl()
+	{
+		int			i;
+		
+		for(i=0;i<MAX_BRUSH_COUNT;i++)
+		{
+			if(m_Brush[i].GetSafeHandle() != NULL)
+				m_Brush[i].DeleteObject();
+		}	
+	}	
+	CBrush *GetBrush(EN_BRUSH_SECTION enBrush) {return m_Brush[enBrush].GetSafeHandle() != NULL?&m_Brush[enBrush]:NULL;}	
+	void CreateBrush(CBrush *pBrush,COLORREF crColor)
+	{
+		if(pBrush->GetSafeHandle() != NULL)
+			return;
+		
+		pBrush->CreateSolidBrush(crColor);
+	}
+protected:
+	CBrush		m_Brush[MAX_BRUSH_COUNT];
+};
+//////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////
+// Picture Box
+
+enum	EN_PICTURE_SECTION{EN_PICTURE_DEFAULT=0,EN_PICTURE_TITLEDEFAULT,EN_PICTURE_ITEMDEFAULT,EN_PICTURE_PROCESSDEFAULT,EN_PICTURE_PROCESSENABLE,EN_PICTURE_VALUEDEFAULT};
+class CUIPictureControl
+{
+public:
+	BOOL		m_bEnable;	
+	CDC			*m_pDC;
+	CString		m_strData;
+	CString		m_strFont;
+	int			m_nFontsize;
+	int			m_nInnerOffset;
+	COLORREF	m_colBack;
+	COLORREF	m_colInner;
+	COLORREF	m_colText;
+	UINT		m_nAlign;
+	CRect		m_rect;
+	UINT		m_nUID;
+	CWnd		*m_pWnd;
+	CPoint		m_FontOffset;
+	int			m_nFontType;
+	
+public:	
+	CUIPictureControl()
+	{
+		SetDefault();		
+	}
+	~CUIPictureControl()
+	{
+	}
+	BOOL isVaildDC(){return (m_pDC!=NULL&&m_pDC->GetSafeHdc()!=NULL)?TRUE:FALSE;}		
+	void SetDefault()
+	{
+		m_pWnd = NULL;
+		m_bEnable = TRUE;
+		m_pDC = NULL;
+		m_strData.Format(_T(""));
+		m_nInnerOffset = 2;
+		m_nFontsize = 12;
+		m_colBack = RGB(255,255,255);
+		m_colInner = RGB(0,0,0);
+		m_colText = RGB(255,255,255);
+		m_nAlign = DT_VCENTER|DT_CENTER;
+		m_rect = CRect(0,0,0,0);
+		m_nUID = 0;
+		m_FontOffset = CPoint(2,2);
+		m_nFontType = FW_BOLD;
+		m_strFont = _T("Arial");
+	}	
+	void SetTitleDefault(CWnd *pWnd,UINT cID)
+	{
+		if(pWnd == NULL)
+			return;
+
+		m_pWnd = pWnd;
+		m_nUID = cID;		
+		m_pDC = ((CWnd*)pWnd->GetDlgItem(cID))->GetDC();
+		((CWnd*)pWnd->GetDlgItem(cID))->GetClientRect(m_rect);				
+		m_nFontsize = 24;		
+		m_colInner = RGB(90,50,100);		
+		m_FontOffset = CPoint(4,4);
+	}
+	void SetItemDefault(CWnd *pWnd,UINT cID)
+	{
+		if(pWnd == NULL)
+			return;
+		
+		m_pWnd = pWnd;
+		m_nUID = cID;		
+		m_pDC = ((CWnd*)pWnd->GetDlgItem(cID))->GetDC();
+		((CWnd*)pWnd->GetDlgItem(cID))->GetClientRect(m_rect);				
+		m_nFontsize = 16;		
+		m_colBack = RGB(180,180,180);
+		m_colInner = RGB(0,110,110);
+		m_colText = RGB(230,230,230);
+		m_FontOffset = CPoint(4,4);
+	}
+	void SetProcessDefault(CWnd *pWnd,UINT cID)
+	{
+		if(pWnd == NULL)
+			return;
+
+		m_pWnd = pWnd;
+		m_nUID = cID;		
+		m_pDC = ((CWnd*)pWnd->GetDlgItem(cID))->GetDC();
+		((CWnd*)pWnd->GetDlgItem(cID))->GetClientRect(m_rect);				
+		m_nFontsize = 16;		
+		m_colBack = RGB(180,180,180);		
+		m_colInner = RGB(128,128,128);
+		m_colText = RGB(200,200,200);
+		m_FontOffset = CPoint(4,8);
+	}
+	void SetValueDefault(CWnd *pWnd,UINT cID)
+	{
+		if(pWnd == NULL)
+			return;
+
+		m_pWnd = pWnd;
+		m_nUID = cID;		
+		m_pDC = ((CWnd*)pWnd->GetDlgItem(cID))->GetDC();
+		((CWnd*)pWnd->GetDlgItem(cID))->GetClientRect(m_rect);				
+		m_nFontsize = 20;		
+		m_colBack = RGB(180,180,180);		
+		m_colInner = RGB(110,110,255);
+		m_colText = RGB(230,230,230);
+		m_FontOffset = CPoint(4,8);
+	}
+};
+
+class CGeneralDraw
+{
+public:
+	CGeneralDraw(void);
+	~CGeneralDraw(void);
+	
+	// Draw Picture Box
+public:
+	void	DrawPitureControl(CUIPictureControl &pPicture);
+};
+//////////////////////////////////////////////////////////////////////////
+
+
+#endif
\ No newline at end of file
diff --git a/ENRIT/UITool/MImageStatic.cpp b/ENRIT/UITool/MImageStatic.cpp
new file mode 100644
index 0000000..af503ca
--- /dev/null
+++ b/ENRIT/UITool/MImageStatic.cpp
@@ -0,0 +1,261 @@
+// MImageStatic.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "..\\resource.h"
+#include "MImageStatic.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CMImageStatic
+
+CMImageStatic::CMImageStatic()
+{
+	ZeroMemory(m_ImageBuf, DEFECTIMAGE_WIDTH * DEFECTIMAGE_HEIGHT + 1);
+	m_bSetImage = FALSE;
+	m_iShowGrid = 0;
+	m_iShowDefectRect = 0;
+
+	BITMAPINFO *pBitmapInfo = (BITMAPINFO *)m_BitmapInfo;
+
+	pBitmapInfo->bmiHeader.biBitCount = 8;
+	pBitmapInfo->bmiHeader.biClrUsed = 256;
+	pBitmapInfo->bmiHeader.biClrImportant = 0;
+	pBitmapInfo->bmiHeader.biCompression = 0;
+	pBitmapInfo->bmiHeader.biHeight = -DEFECTIMAGE_HEIGHT;		// flip view
+	pBitmapInfo->bmiHeader.biPlanes = 1;
+	pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+	pBitmapInfo->bmiHeader.biSizeImage = DEFECTIMAGE_HEIGHT*DEFECTIMAGE_WIDTH;
+	pBitmapInfo->bmiHeader.biWidth = DEFECTIMAGE_WIDTH;
+	pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
+	pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
+
+	for(int i=0 ; i<256 ; i++)
+	{
+		pBitmapInfo->bmiColors[i].rgbReserved = 0;
+		pBitmapInfo->bmiColors[i].rgbRed = i;
+		pBitmapInfo->bmiColors[i].rgbGreen = i;
+		pBitmapInfo->bmiColors[i].rgbBlue = i;
+	}
+}
+
+CMImageStatic::~CMImageStatic()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CMImageStatic, CStatic)
+	//{{AFX_MSG_MAP(CMImageStatic)
+	ON_WM_PAINT()
+	ON_WM_RBUTTONDOWN()
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CMImageStatic message handlers
+
+void CMImageStatic::DrawDotCenterLine(HDC hDC)
+{
+	int i, j;
+	COLORREF clrImage = RGB(200, 0, 0);
+
+	//miniont
+	for(i = 0; i < DEFECTIMAGE_HEIGHT; i++)
+	{
+		for(j = 0; j < DEFECTIMAGE_WIDTH; j++)
+		{			
+			if (m_iShowGrid==1)
+			{
+				if (i == DEFECTIMAGE_HEIGHT / 2)
+				{
+					if(j % 5 == 0)
+					{
+						::SetPixel(hDC, j, i, clrImage);
+					}
+					else
+					{
+						;
+					}
+				}
+				else
+				{
+					;
+				}
+				
+				if (j == DEFECTIMAGE_WIDTH / 2)
+				{
+					if(i % 5 == 0)
+					{
+						::SetPixel(hDC, j, i, clrImage);
+					}
+					else
+					{
+						;
+					}
+				}
+				else
+				{
+					;
+				}
+			}
+			else if (m_iShowGrid==2)
+			{
+				if(i == DEFECTIMAGE_HEIGHT / 2)
+				{
+					if(j % 5 == 0)
+					{
+						::SetPixel(hDC, j, i, clrImage);
+					}
+					else
+					{
+						;
+					}
+				}
+				else
+				{
+					;
+				}
+
+				if(j == DEFECTIMAGE_WIDTH / 7)
+				{
+					if(i % 5 == 0)	::SetPixel(hDC, j, i, clrImage);
+					else			 ;
+				}
+				else if(j == 6*DEFECTIMAGE_WIDTH / 7)
+				{
+					if(i % 5 == 0)	::SetPixel(hDC, j, i, clrImage);
+					else			 ;
+				}
+				else if(j == DEFECTIMAGE_WIDTH / 2)
+				{
+					if(i % 5 == 0)	::SetPixel(hDC, j, i, clrImage);
+					else			 ;
+				}
+			}
+		}
+	}
+}
+
+void CMImageStatic::OnPaint() 
+{
+	CPaintDC dc(this); // device context for painting
+
+	HDC		hDC = dc.GetSafeHdc();
+	
+	// TODO: Add your message handler code here
+	if (!m_bSetImage)
+	{
+		CClientDC WinDC(this);
+		CDC MemDC;
+		MemDC.CreateCompatibleDC(&WinDC);
+		CBitmap bitmap;
+		bitmap.LoadBitmap(IDB_BITMAP_DEFECT);
+		CBitmap *pOldBitmap = (CBitmap*)MemDC.SelectObject(&bitmap);
+		WinDC.BitBlt(0, 0, DEFECTIMAGE_WIDTH * 2, DEFECTIMAGE_HEIGHT * 2, &MemDC, 0, 0, SRCCOPY);
+		MemDC.SelectObject(pOldBitmap);
+
+		return;
+	}
+	else
+	{
+		int		nMode;
+		if((nMode = GetBkMode(hDC)) != TRANSPARENT)	::SetBkMode(hDC, TRANSPARENT);
+
+		HBITMAP		hBitmap, hOldBitmap;
+		HDC	hMemDC = ::CreateCompatibleDC(hDC);
+		hBitmap = ::CreateCompatibleBitmap(hDC, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT);
+		if(NULL == hBitmap)
+			return;
+			
+		hOldBitmap = (HBITMAP)::SelectObject(hMemDC, hBitmap);
+
+		::StretchDIBits(hMemDC, 0, 0, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT,
+		0, 0, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT, m_ImageBuf, (BITMAPINFO *)m_BitmapInfo, DIB_RGB_COLORS, SRCCOPY);
+
+		DrawDotCenterLine(hMemDC);
+
+		if(m_iShowDefectRect == 1)
+		{
+			CPen		PenRect;
+			PenRect.CreatePen(PS_SOLID, 1, RGB(255,0,0));
+			DrawRectangle(hMemDC,PenRect,m_rectDefect);
+			PenRect.DeleteObject();
+		}
+
+		::BitBlt(hDC, 0, 0, DEFECTIMAGE_WIDTH, DEFECTIMAGE_HEIGHT,
+			hMemDC, 0, 0, SRCCOPY);
+
+		::DeleteObject(::SelectObject(hMemDC,hOldBitmap));
+		::DeleteDC(hMemDC);
+
+		if(GetBkMode(hDC) != nMode)
+			::SetBkMode(hDC, nMode);
+	
+		
+	}
+	
+	// Do not call CStatic::OnPaint() for painting messages
+}
+
+void CMImageStatic::DrawRectangle(HDC hDC, HPEN hPen, CRect rect)
+{
+	HPEN	hOldPen= NULL;
+	HBRUSH	hOldBrush = NULL;
+
+	if(hPen)
+		hOldPen = (HPEN)::SelectObject(hDC ,hPen);
+
+	::MoveToEx(hDC, rect.left, rect.top, NULL);
+	::LineTo(hDC, rect.right, rect.top);
+	::LineTo(hDC, rect.right, rect.bottom);
+	::LineTo(hDC, rect.left, rect.bottom);
+	::LineTo(hDC, rect.left, rect.top);
+
+	if(hPen)
+		::SelectObject(hDC , (HPEN)hOldPen);
+}
+
+void CMImageStatic::OnRButtonDown(UINT nFlags, CPoint point)
+{
+	NMHDR		nmHeader;
+
+	nmHeader.idFrom = GetDlgCtrlID();
+	nmHeader.hwndFrom = GetSafeHwnd();
+	nmHeader.code = NM_DBLCLK;
+
+	::SendMessage(GetParent()->GetSafeHwnd(), WM_NOTIFY, (WPARAM)nmHeader.idFrom,  (LPARAM)&nmHeader );
+}
+
+void CMImageStatic::ResetImageStatic()
+{
+	// 搬窃 捞固瘤 滚欺甫 檬扁拳.
+	ZeroMemory(m_ImageBuf, DEFECTIMAGE_WIDTH * DEFECTIMAGE_HEIGHT + 1);
+	m_bSetImage = FALSE;
+	m_rectDefect = CRect(0,0,0,0);
+	Invalidate();
+}
+
+void CMImageStatic::ShowRect(CRect rect)
+{
+	m_rectDefect = rect;	
+}
+
+void CMImageStatic::ShowGrid(int iShow)
+{
+	m_iShowGrid = iShow;
+
+	Invalidate();
+}
+
+void CMImageStatic::ShowDefectRect(int iShow)
+{
+	m_iShowDefectRect = iShow;
+
+	Invalidate();
+}
+
diff --git a/ENRIT/UITool/MImageStatic.h b/ENRIT/UITool/MImageStatic.h
new file mode 100644
index 0000000..619d47b
--- /dev/null
+++ b/ENRIT/UITool/MImageStatic.h
@@ -0,0 +1,64 @@
+#if !defined(AFX_HMIMAGESTATIC_H__D74697CD_885E_4E7C_A9EA_2A57C3F51B4A__INCLUDED_)
+#define AFX_HMIMAGESTATIC_H__D74697CD_885E_4E7C_A9EA_2A57C3F51B4A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// HMImageStatic.h : header file
+//
+
+#include "DefectStorage.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CMImageStatic window
+
+class CMImageStatic : public CStatic
+{
+// Construction
+public:
+	CMImageStatic();
+
+// Attributes
+public:
+	UCHAR	m_ImageBuf[DEFECTIMAGE_WIDTH * DEFECTIMAGE_HEIGHT + 1];	// 搬窃 捞固瘤甫 焊咯林绰 滚欺.
+	BYTE m_BitmapInfo[sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)];
+	BOOL	m_bSetImage;	
+	void	ResetImageStatic();
+	void	ShowGrid(int iShow);	
+	void	ShowDefectRect(int iShow);
+	void	ShowRect(CRect rect);
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CMImageStatic)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CMImageStatic();
+
+	// Generated message map functions
+protected:
+	int		m_iShowGrid;
+	int		m_iShowDefectRect;
+	CRect	m_rectDefect;
+	//{{AFX_MSG(CMImageStatic)
+	void DrawDotCenterLine(HDC hDC);
+	void DrawRectangle(HDC hDC, HPEN hPen, CRect rect);
+
+	afx_msg void OnPaint();
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_HMIMAGESTATIC_H__D74697CD_885E_4E7C_A9EA_2A57C3F51B4A__INCLUDED_)
diff --git a/ENRIT/UITool/PixelPtr.h b/ENRIT/UITool/PixelPtr.h
new file mode 100644
index 0000000..3a22864
--- /dev/null
+++ b/ENRIT/UITool/PixelPtr.h
@@ -0,0 +1,40 @@
+#pragma once
+
+class CPixelPtr
+{
+public:
+	CPixelPtr(CImage &image)
+	{
+		m_cyImage = image.GetHeight();
+		m_pRow = new BYTE *[m_cyImage];
+		int nPitch = image.GetPitch();
+
+		BYTE *pRow = (BYTE *)image.GetBits();
+
+		for(int y=0 ; y<m_cyImage ; y++)
+		{
+			m_pRow[y] = (BYTE *)pRow;
+			pRow += nPitch;
+		}
+	}
+
+	virtual ~CPixelPtr(void)
+	{
+		if(m_pRow != NULL)
+			delete [] m_pRow;
+	}
+
+	BYTE *operator[](LONG index) {
+		ASSERT(index>=0 && index<m_cyImage);
+		return m_pRow[index];
+	}
+
+	BYTE *operator[](int index) {
+		ASSERT(index>=0 && index<m_cyImage);
+		return m_pRow[index];
+	}
+
+protected:
+	BYTE ** m_pRow;
+	int m_cyImage;
+};
\ No newline at end of file
diff --git a/ENRIT/UITool/Server_MemDC.h b/ENRIT/UITool/Server_MemDC.h
new file mode 100644
index 0000000..4fede22
--- /dev/null
+++ b/ENRIT/UITool/Server_MemDC.h
@@ -0,0 +1,104 @@
+#if !defined(CControlMemDC__INCLUDED_)
+#define CControlMemDC__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// MemDC.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CMemDC window
+
+class CControlMemDC : public CDC {
+private:	
+	CBitmap		m_bitmap;		// Offscreen bitmap
+	CBitmap*	m_oldBitmap;	// bitmap originally found in CControlMemDC
+	CDC*		m_pDC;			// Saves CDC passed in constructor
+	CRect		m_rect;			// Rectangle of drawing area.
+	BOOL		m_bMemDC;		// TRUE if CDC really is a Memory DC.
+public:
+
+	CControlMemDC(CDC* pDC, const CRect* pRect = NULL) : CDC()
+	{
+		ASSERT(pDC != NULL); 
+
+		// Some initialization
+		m_pDC = pDC;
+		m_oldBitmap = NULL;
+		m_bMemDC = !pDC->IsPrinting();
+
+		// Get the rectangle to draw
+		if (pRect == NULL) {
+			pDC->GetClipBox(&m_rect);
+		} else {
+			m_rect = *pRect;
+		}
+
+		if (m_bMemDC) {
+			// Create a Memory DC
+			CreateCompatibleDC(pDC);
+			pDC->LPtoDP(&m_rect);
+
+			m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+			m_oldBitmap = SelectObject(&m_bitmap);
+
+			SetMapMode(pDC->GetMapMode());
+
+			SetWindowExt(pDC->GetWindowExt());
+			SetViewportExt(pDC->GetViewportExt());
+
+			pDC->DPtoLP(&m_rect);
+			SetWindowOrg(m_rect.left, m_rect.top);
+		} else {
+			// Make a copy of the relevent parts of the current DC for printing
+			m_bPrinting = pDC->m_bPrinting;
+			m_hDC       = pDC->m_hDC;
+			m_hAttribDC = pDC->m_hAttribDC;
+		}
+
+		// Fill background 
+		FillSolidRect(m_rect, pDC->GetBkColor());
+	}
+
+	~CControlMemDC()	
+	{		
+		if (m_bMemDC) {
+			// Copy the offscreen bitmap onto the screen.
+			m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+				this, m_rect.left, m_rect.top, SRCCOPY);			
+
+			//Swap back the original bitmap.
+			SelectObject(m_oldBitmap);
+		} else {
+			// All we need to do is replace the DC with an illegal value,
+			// this keeps us from accidently deleting the handles associated with
+			// the CDC that was passed to the constructor.			
+			m_hDC = m_hAttribDC = NULL;
+		}	
+	}
+
+	// Allow usage as a pointer	
+	CControlMemDC* operator->() 
+	{
+		return this;
+	}	
+
+	// Allow usage as a pointer	
+	operator CControlMemDC*() 
+	{
+		return this;
+	}
+
+	CDC *GetOriginalDC()
+	{
+		return m_pDC;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_MEMDC_H__18BA4DAB_63FC_4FFA_83B0_2AFF3EDF0420__INCLUDED_)
diff --git a/ENRIT/UITool/Singleton.h b/ENRIT/UITool/Singleton.h
new file mode 100644
index 0000000..83e2111
--- /dev/null
+++ b/ENRIT/UITool/Singleton.h
@@ -0,0 +1,110 @@
+//////////////////////////////////////////////////////////////////////////////////////
+// Singleton.h: interface for the Singleton class.
+//////////////////////////////////////////////////////////////////////////////////////
+//    ex) sample
+//
+//    class Test : public Singleton < Test >
+//    {
+//    public:
+//	    Test* Sample( int num );
+//	    //...
+//    };
+//
+//
+//
+//    #define g_Test	Test::GetSingleton()
+//
+//    void SomeFuncton( void )
+//    {
+//	    Test * pTemp = Test::GetSingleton().Sample( 7 );
+//	    // or   Test * pTemp = g_Test.Sample( 7 );
+//    }
+//
+//////////////////////////////////////////////////////////////////////////////////////
+
+/*---------------------------------------------------------------------------
+
+# 颇老疙 : Singleton.h
+# 汲  疙 : interface for the Singleton template class.
+# 郴  仿 : 
+# 厚  绊 : 
+
+---------------------------------------------------------------------------*/
+
+#ifndef __SINGLETON_H__
+#define __SINGLETON_H__
+
+///////////////////////////////////////////////////////////////////////////////
+// include define statement
+///////////////////////////////////////////////////////////////////////////////
+
+#include "assert.h"
+#include <iostream>
+#include <mutex>
+
+///////////////////////////////////////////////////////////////////////////////
+// class define statement
+///////////////////////////////////////////////////////////////////////////////
+
+/*---------------------------------------------------------------------------
+
+# 努贰胶  疙 : Singleton
+# 何葛努贰胶 : 绝澜
+# 曼炼努贰胶 : 绝澜
+# 包府氓烙磊 : Voidhoon
+# 汲      疙 : 
+# 函      荐 : 
+# 郴      仿 : 
+# 巩  力  痢 : 
+
+---------------------------------------------------------------------------*/
+
+template <typename T> class Singleton
+{
+public:
+	// 删除拷贝构造函数和赋值运算符,确保单例
+	Singleton(const Singleton&) = delete;
+	Singleton& operator=(const Singleton&) = delete;
+
+	static void SetSingleton(T* pT)
+	{
+		assert(pT);
+		instance.reset(pT);
+	}
+
+    static T* GetSingleton(void)
+    {
+		std::call_once(flag, []() { instance.reset(new T); });
+		return instance.get();
+    }
+
+	static T* GetSingletonPtr(void)
+	{
+		std::call_once(flag, []() { instance.reset(new T); });
+		return instance.get();
+	}
+
+	static T& GetSingletonInstance(void)
+	{
+		std::call_once(flag, []() { instance.reset(new T); });
+		return *instance.get();
+	}
+
+protected:
+	Singleton() = default;
+	virtual ~Singleton() = default;
+
+private:
+	static std::unique_ptr<T> instance;
+	static std::once_flag flag;
+
+};
+
+// 初始化静态成员变量
+template <typename T>
+std::unique_ptr<T> Singleton<T>::instance = nullptr;
+
+template <typename T>
+std::once_flag Singleton<T>::flag;
+
+#endif
diff --git a/ENRIT/UITool/SlimScrollView.cpp b/ENRIT/UITool/SlimScrollView.cpp
new file mode 100644
index 0000000..7e4ecb1
--- /dev/null
+++ b/ENRIT/UITool/SlimScrollView.cpp
@@ -0,0 +1,937 @@
+// SampleView.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Server_MemDC.h"
+#include "SlimScrollView.h"
+#include "Global_Define.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CSlimScrollView
+#define UM_MOUSE_MOVE			(WM_USER + 7650)
+#define UM_MOUSE_LBUTTON_DOWN	(WM_USER + 7651)
+#define UM_MOUSE_RBUTTON_UP		(WM_USER + 7652)
+#define UM_MOUSE_LBUTTON_UP		(WM_USER + 7653)
+
+IMPLEMENT_DYNCREATE(CSlimScrollView, CScrollView)
+
+CSlimScrollView::CSlimScrollView()
+{
+	//m_Bitmap.LoadBitmap (IDB_BITMAP1);
+	
+	m_hMemDC = NULL;
+	m_hMainDC = NULL;
+	m_pBMI = NULL;
+
+	m_pParents = NULL;
+	m_pSetupIMG = NULL;
+	m_pScaleIMg = NULL;
+	m_pBrightHWnd = NULL;
+	m_hBitmap = NULL;
+
+	m_rtDefect.SetRect(0,0,0,0);
+	m_rtRect.SetRect(0,0,0,0);
+	m_bDefect = FALSE;
+	m_bRect = FALSE;
+	m_bZoomMode = FALSE;
+
+	m_pSetupIMG = new BYTE[SLIM_IMG_MAX_WIDTH*SLIM_IMG_MAX_HEIGHT*sizeof(BYTE)];
+	//m_pSetupIMG = (BYTE*)::VirtualAlloc(NULL, (SLIM_IMG_MAX_WIDTH*SLIM_IMG_MAX_HEIGHT)*sizeof(BYTE), MEM_COMMIT | MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE);
+
+	ZeroMemory(m_pSetupIMG,sizeof(BYTE)*SLIM_IMG_MAX_WIDTH*SLIM_IMG_MAX_HEIGHT);
+	m_pDispBuf = m_pSetupIMG;
+
+	m_zoomScale = 1.0;
+	m_ScaleWidth = m_ScaleHeight = m_ImageWidth = m_ImageHeight = 0;
+
+	m_bMessage = FALSE;
+
+	m_width = 0;
+	m_height = 0;
+
+	m_OriginPos = m_OffsetPos = m_MousePoint = CPoint(0,0);
+
+	m_pointSplineOffset = CPoint(0,0);
+	
+	DWORD bufsize = sizeof(BITMAPINFOHEADER)+ 256*sizeof(RGBQUAD);
+
+	m_pBMI = (BITMAPINFO *)new BYTE[bufsize];
+	// Set Bitmap information
+	m_pBMI->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
+	m_pBMI->bmiHeader.biPlanes=1; 
+	m_pBMI->bmiHeader.biBitCount=8; 
+	m_pBMI->bmiHeader.biCompression=0;   //BI_RGB; 
+	m_pBMI->bmiHeader.biXPelsPerMeter=0; 
+	m_pBMI->bmiHeader.biYPelsPerMeter=0; 
+	m_pBMI->bmiHeader.biClrUsed=256; 
+	m_pBMI->bmiHeader.biClrImportant=0; 
+
+	// Set Palette
+	for(WORD i=0 ; i< 256 ; i++) {
+		m_pBMI->bmiColors[i].rgbRed = (BYTE)i;
+		m_pBMI->bmiColors[i].rgbGreen = (BYTE)i;
+		m_pBMI->bmiColors[i].rgbBlue = (BYTE)i;
+		m_pBMI->bmiColors[i].rgbReserved = 0;
+	}
+
+	m_nNotchInsListIdx = -1;//20140528
+	m_bNotchInsPosMod = FALSE;//20140528
+}
+
+CSlimScrollView::~CSlimScrollView()
+{
+	if(m_pBMI)
+	{
+		delete[] m_pBMI,m_pBMI = NULL;
+	}
+	ReleaseMemory();
+}
+
+void CSlimScrollView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
+{
+	int		scroll_Pos;
+
+	if ( nSBCode==SB_ENDSCROLL ) {
+		scroll_Pos = GetScrollPos(SB_HORZ);		
+	}
+
+	::PostMessage(this->GetParent()->GetSafeHwnd(),MSG_SCANVIEW,NULL,NULL);	
+
+	CScrollView::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CSlimScrollView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
+{
+	int		scroll_Pos;
+
+	if ( nSBCode==SB_ENDSCROLL ) {
+		scroll_Pos = GetScrollPos(SB_VERT);
+	}
+	
+	CScrollView::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CSlimScrollView::EnlargeImage(BYTE *pInBuff, LONG wSrcWidth, LONG wSrcHeight, 
+								 BYTE *pOutBuff, LONG wDestWidth, LONG wDestHeight,double scale)
+								 
+{
+	if (scale <= 1)
+		return;
+	
+	double dFactor = 1 / scale;
+	double dXSrc = 0;
+	CSize  sizeSrc;
+	
+	sizeSrc.cx = wSrcWidth;
+	sizeSrc.cy = wSrcHeight;
+	
+	for (int nX = 0; nX < wDestWidth; nX++)
+	{
+		double dYSrc = 0;
+		
+		for (int nY = 0; nY < wDestHeight; nY++)
+		{
+			pOutBuff[nY * wDestWidth + nX] = CalcWeightedColor(pInBuff, sizeSrc, dXSrc, dYSrc);
+			
+			dYSrc += dFactor; // next dest pixel in source coords
+		}
+		
+		dXSrc += dFactor; // next dest pixel in source coords
+	}
+	
+	return;
+}
+
+BYTE CSlimScrollView::CalcWeightedColor(BYTE* pPixels, CSize size, double dX, double dY)
+{
+	// interpolate between the current pixel and its pixel to the right and down
+	int nX = (int)dX;
+	int nY = (int)dY;
+	
+	if (dX < 0 || dY < 0)
+		return pPixels[max(0, nY) * size.cx + max(0, nX)]; // closest
+	
+	BYTE* pVal = &pPixels[nY * size.cx + nX]; // current
+	
+	double dXFraction = dX - nX;
+	double dX1MinusFraction = 1 - dXFraction;
+	
+	double dYFraction = dY - nY;
+	double dY1MinusFraction = 1 - dYFraction;
+	
+	BYTE* pXP = &pPixels[nY * size.cx + CHKMIN(nX + 1, size.cx - 1)]; // x + 1
+	BYTE* pYP = &pPixels[CHKMIN(nY + 1, size.cy - 1) * size.cx + nX]; // y + 1
+	
+	int result = (int)((dX1MinusFraction * *pVal +
+		dXFraction * *pXP +
+		dY1MinusFraction * *pVal +
+		dYFraction * *pYP) / 2);
+	
+	return result;
+}
+
+void CSlimScrollView::ShrinkImage(BYTE *pInBuff, LONG wSrcWidth, LONG wSrcHeight, 
+								BYTE *pOutBuff, LONG wDestWidth, LONG wDestHeight,double scale)
+{
+	ASSERT (scale < 1 && scale > 0);
+	
+	if (scale >= 1 || scale <= 0)
+		return;
+	
+	double dFactor = 1 / scale;
+	double dXEnd = -dFactor / 2;
+	int nXStart, nXEnd = -1;
+	
+	for (int nX = 0; nX < wDestWidth; nX++)
+	{
+		int nYStart, nYEnd = -1;
+		double dYEnd = -dFactor / 2;
+		
+		nXStart = nXEnd + 1;
+		dXEnd += dFactor;
+		nXEnd = CHKMIN(wSrcWidth - 1, (int)dXEnd + 1);
+		
+		if (nXStart > nXEnd)
+			continue;
+		
+		for (int nY = 0; nY < wDestHeight; nY++)
+		{
+			nYStart = nYEnd + 1;
+			dYEnd += dFactor;
+			nYEnd = CHKMIN(wSrcHeight - 1, (int)dYEnd + 1);
+			
+			if (nYStart > nYEnd)
+				continue;
+			
+			int nCount = 0, nVal = 0;
+			
+			// average the pixels over the range
+			for (int nXSub = nXStart; nXSub <= nXEnd; nXSub++)
+			{
+				for (int nYSub = nYStart; nYSub <= nYEnd; nYSub++)
+				{
+					nVal += pInBuff[nYSub * wSrcWidth + nXSub];
+					nCount++;
+				}
+			}
+			
+			pOutBuff[nY * wDestWidth + nX] = nVal/nCount;
+		}
+	}
+	
+	return;
+}
+
+BOOL CSlimScrollView::DoZoomInOut()
+{	
+	if(m_pSetupIMG == NULL) return FALSE;
+
+	CSize	sizeTotal;
+
+	if(m_pScaleIMg != NULL) delete[] m_pScaleIMg, m_pScaleIMg=NULL;
+	m_pScaleIMg = new BYTE[m_ScaleWidth*m_ScaleHeight];
+	
+	if(m_ImageWidth == m_ScaleWidth && m_ImageHeight == m_ScaleHeight) 
+	{		
+		m_pDispBuf = m_pSetupIMG;
+	}
+	else
+	{
+		EnlargeImage(m_pSetupIMG,m_ImageWidth,m_ImageHeight,m_pScaleIMg,m_ScaleWidth,m_ScaleHeight,m_zoomScale);	
+		m_pDispBuf = m_pScaleIMg;		
+	}
+
+	InitGDI(m_ScaleWidth,m_ScaleHeight,TRUE);	
+
+	sizeTotal.cx = m_ScaleWidth;
+	sizeTotal.cy = m_ScaleHeight;
+
+	SetScrollSizes(MM_TEXT, sizeTotal);		
+	SetScrollRange(SB_HORZ,0,sizeTotal.cx,TRUE);
+	SetScrollRange(SB_VERT,0,sizeTotal.cy,TRUE);
+	EnableScrollBar(SB_BOTH,ESB_ENABLE_BOTH);
+	
+	Invalidate(TRUE);
+
+	return TRUE;
+}
+
+BOOL CSlimScrollView::CalcScaleSize()
+{
+	if(m_pSetupIMG == NULL) return FALSE;
+	
+	double		dCX,dCY;
+	LONG		oldWidth,oldHeight;
+	
+	oldWidth = m_ScaleWidth;
+	oldHeight = m_ScaleHeight;
+
+	dCX = (double)m_ImageWidth*m_zoomScale;
+	dCY = (double)m_ImageHeight*m_zoomScale;
+	
+	if((LONG)dCX == m_ScaleWidth && (LONG)dCY == m_ScaleHeight)
+		return FALSE;
+	
+	m_ScaleWidth = (LONG)dCX;
+	m_ScaleWidth = ((LONG)(m_ScaleWidth + 3) & ~3);
+	m_ScaleHeight = (LONG)dCY;	
+	m_ScaleHeight = ((LONG)(m_ScaleHeight + 3) & ~3);	
+
+	m_pRectPoint.x = (m_pRectPoint.x*m_ScaleWidth)/oldWidth;
+	m_pRectPoint.y = (m_pRectPoint.y*m_ScaleHeight)/oldHeight;
+
+	return TRUE;
+}
+
+BEGIN_MESSAGE_MAP(CSlimScrollView, CScrollView)
+	//{{AFX_MSG_MAP(CSlimScrollView)
+	ON_WM_MOUSEMOVE()
+	ON_WM_SETCURSOR()
+	ON_WM_VSCROLL()
+	ON_WM_HSCROLL()
+	ON_WM_ERASEBKGND()		
+	ON_WM_MOUSEACTIVATE()
+	ON_WM_RBUTTONDOWN()
+	ON_WM_RBUTTONUP()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_LBUTTONUP()
+	//}}AFX_MSG_MAP
+	ON_WM_LBUTTONDBLCLK()//20140528
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CSlimScrollView drawing
+int CSlimScrollView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) 
+
+{	
+	//    return CView::OnMouseActivate(pDesktopWnd, nHitTest, message);
+	
+    return MA_ACTIVATE;
+	
+}
+
+
+void CSlimScrollView::OnInitialUpdate()
+{
+	CScrollView::OnInitialUpdate();
+
+	CSize sizeTotal;
+	// TODO: calculate the total size of this view
+	sizeTotal.cx = m_ScaleWidth;
+	sizeTotal.cy = m_ScaleHeight;
+	SetScrollSizes(MM_TEXT, sizeTotal);
+}
+
+void CSlimScrollView::OnDraw(CDC* pDC)
+{
+	CDocument* pDoc = GetDocument();
+	HDC		hDC = pDC->GetSafeHdc();
+
+	CRect rt(0,0,m_width,m_height);
+	CControlMemDC	memDC(pDC,&rt);
+	m_hMemDC = memDC.GetSafeHdc();
+	
+	if(m_pDispBuf != NULL)
+	{
+		DrawImage(m_pDispBuf);
+		if(m_bDrawRect == TRUE && m_bMessage == FALSE)
+		{
+			CRect		rect = m_rtRect;
+
+			rect.left = (int)((double)rect.left*m_zoomScale);
+			rect.right = (int)((double)rect.right*m_zoomScale);
+			rect.top = (int)((double)rect.top*m_zoomScale);
+			rect.bottom = (int)((double)rect.bottom*m_zoomScale);
+			DrawRectangle(rect,RGB(255,0,0));
+			CPoint		point[2];
+
+			point[0] = CPoint(rect.left,rect.top+rect.Height()/2);
+			point[1] = CPoint(rect.right,rect.top+rect.Height()/2);
+			DrawLine(point[0].x,point[0].y,point[1].x,point[1].y,RGB(255,255,0));
+
+			point[0] = CPoint(rect.left+rect.Width()/2,rect.top);
+			point[1] = CPoint(rect.left+rect.Width()/2,rect.bottom);
+			DrawLine(point[0].x,point[0].y,point[1].x,point[1].y,RGB(255,255,0) );
+		}
+
+		DrawMark();
+
+		DrawPoint();
+
+		DrawNotchInsPos();//20140528
+
+		if((int)m_pSplinePos.size() > 0)
+			DrawSpline();
+	}		
+}
+
+void CSlimScrollView::DrawSpline()
+{
+	CPoint		point;
+	std::multimap<int, CSplinePoint>::iterator	it;
+
+	for(it=m_pSplinePos.begin();it!=m_pSplinePos.end();it++)
+	{		
+		point =	it->second.origin;
+		point.x = (int)((double)point.x*m_zoomScale);
+		point.y = (int)((double)point.y*m_zoomScale);		
+		::SetPixel(m_hMemDC,point.x,point.y,RGB(255,0,0));
+	}
+}
+
+void CSlimScrollView::DrawMark()
+{
+	COLORREF		colorOrigin = RGB(120,255,255);
+	COLORREF		colorOffset = RGB(255,50,50);
+	int				nDrawS = 5;
+	
+	if(m_OriginPos.x > 0 && m_OriginPos.y > 0)
+	{
+		DrawLine(m_OriginPos.x-nDrawS,m_OriginPos.y,m_OriginPos.x+nDrawS,m_OriginPos.y,colorOrigin);
+		DrawLine(m_OriginPos.x,m_OriginPos.y-nDrawS,m_OriginPos.x,m_OriginPos.y+nDrawS,colorOrigin);
+	}
+
+	if(m_OffsetPos.x > 0 && m_OffsetPos.y > 0)
+	{
+		DrawLine(m_OffsetPos.x-nDrawS,m_OffsetPos.y,m_OffsetPos.x+nDrawS,m_OffsetPos.y,colorOffset);
+		DrawLine(m_OffsetPos.x,m_OffsetPos.y-nDrawS,m_OffsetPos.x,m_OffsetPos.y+nDrawS,colorOffset);
+	}
+}
+
+void CSlimScrollView::DrawLine(long sx, long sy, long ex, long ey, COLORREF color,int nStyle)
+{
+	HPEN	pOldPen = (HPEN)::SelectObject(m_hMemDC,::CreatePen(nStyle, 1, color));
+	::MoveToEx(m_hMemDC, sx, sy, NULL);
+	::LineTo(m_hMemDC, ex, ey);	
+	::DeleteObject(::SelectObject(m_hMemDC, (HPEN)pOldPen));
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CSlimScrollView diagnostics
+
+#ifdef _DEBUG
+void CSlimScrollView::AssertValid() const
+{
+	CScrollView::AssertValid();
+}
+
+void CSlimScrollView::Dump(CDumpContext& dc) const
+{
+	CScrollView::Dump(dc);
+}
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CSlimScrollView message handlers
+
+BOOL CSlimScrollView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
+{
+	// TODO: Add your specialized code here and/or call the base class
+	
+	m_pParents = pParentWnd;
+
+
+	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
+}
+
+void CSlimScrollView::DisplayError()
+{
+	LPVOID lpMsgBuf;
+
+	FormatMessage( 
+		FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+		FORMAT_MESSAGE_FROM_SYSTEM | 
+		FORMAT_MESSAGE_IGNORE_INSERTS,
+		NULL,
+		GetLastError(),
+		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+		(LPTSTR) &lpMsgBuf,
+		0,
+		NULL 
+		);
+
+	CString	msg = (LPCTSTR)lpMsgBuf;
+	AfxMessageBox(msg);
+
+	LocalFree( lpMsgBuf );
+}
+
+
+BOOL CSlimScrollView::InitGDI(int width, int height, bool bColor)
+{
+
+	////////////////////////////////////////////////////////////////////////////////////////////////////////
+	if(m_width != width || m_height != height)
+	{
+		if(m_bZoomMode == FALSE)
+		{
+			if(m_pSetupIMG)
+			{
+				//VirtualFree(m_pSetupIMG, sizeof(BYTE)*(width*height), MEM_DECOMMIT);
+				//VirtualFree(m_pSetupIMG, 0, MEM_RELEASE); 
+				delete [] m_pSetupIMG;
+				m_pSetupIMG = NULL;
+				m_pDispBuf = NULL;
+			}
+
+			if(m_pSetupIMG == NULL)
+			{
+				//m_pSetupIMG = (BYTE*)::VirtualAlloc(NULL, (width*height)*sizeof(BYTE),MEM_COMMIT | MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE);
+
+				m_pSetupIMG = new BYTE[width * height * sizeof(BYTE) ];
+				ZeroMemory(m_pSetupIMG,sizeof(BYTE)*width*height);
+				m_pDispBuf = m_pSetupIMG;
+			}
+			if(m_pScaleIMg)
+			{
+				delete [] m_pScaleIMg;
+				m_pScaleIMg = NULL;
+			}
+			
+			m_pBMI->bmiHeader.biWidth=(LONG)width;
+			m_pBMI->bmiHeader.biHeight=-(LONG)height;
+		}
+		else
+		{
+			m_pBMI->bmiHeader.biWidth=(LONG)m_ScaleWidth;
+			m_pBMI->bmiHeader.biHeight=-(LONG)m_ScaleHeight;
+		}
+
+
+	}
+	m_width = width;
+	m_height = height;
+
+	m_pBMI->bmiHeader.biSizeImage= m_pBMI->bmiHeader.biWidth*m_pBMI->bmiHeader.biHeight;
+
+	SetScrollRange(SB_HORZ,0,m_width,TRUE);
+	SetScrollRange(SB_VERT,0,m_height,TRUE);	
+
+	return TRUE;
+}
+
+
+void CSlimScrollView::ReleaseMemory()
+{
+	m_pSplinePos.clear();
+	m_pNotchInsPos.clear();//20140528
+
+	if(m_pScaleIMg != NULL)
+	{
+		delete[] m_pScaleIMg, m_pScaleIMg=NULL;
+	}
+	if(m_pSetupIMG != NULL)
+	{
+		delete[] m_pSetupIMG, m_pSetupIMG=NULL;
+	}
+	m_width = 0;
+	m_height = 0;
+}
+
+void CSlimScrollView::DrawImage(LPBYTE pImg)
+{	
+	::SetDIBitsToDevice(m_hMemDC, 0, 0, m_width, m_height, 0, 0, 0, m_height, pImg, m_pBMI, DIB_RGB_COLORS);	
+}
+
+void CSlimScrollView::DrawRectangle(CRect rect,COLORREF color)
+{	
+	//BYTE		nFactor = (BYTE)((double)m_ScaleWidth*0.05)/2;
+	FV_ROI		roi;
+
+	roi.u1 = rect.left;
+	roi.u2 = rect.right;
+	roi.v1 = rect.top;
+	roi.v2 = rect.bottom;
+// 	roi.u1 = rect.left -nFactor;
+// 	roi.u2 = rect.right+nFactor;
+// 	roi.v1 = rect.top -nFactor;
+// 	roi.v2 = rect.bottom+nFactor;
+
+
+	HPEN	pOldPen = (HPEN)::SelectObject(m_hMemDC,::CreatePen(PS_SOLID, 1, color));
+	::MoveToEx(m_hMemDC, roi.u1, roi.v1, NULL);
+	::LineTo(m_hMemDC, roi.u2, roi.v1);
+	::LineTo(m_hMemDC, roi.u2, roi.v2);
+	::LineTo(m_hMemDC, roi.u1, roi.v2);
+	::LineTo(m_hMemDC, roi.u1, roi.v1);
+	::DeleteObject(::SelectObject(m_hMemDC, (HPEN)pOldPen));
+}
+
+void CSlimScrollView::DrawRefresh()
+{
+	Invalidate(FALSE);
+}
+
+BOOL CSlimScrollView::OnEraseBkgnd(CDC* pDC) 
+{
+	// TODO: Add your message handler code here and/or call default
+	
+	return TRUE;//CScrollView::OnEraseBkgnd(pDC);
+}
+
+void CSlimScrollView::DrawPoint()
+{
+	if(m_pDispBuf == NULL)
+		return;
+
+	HFONT		pFont, pOldFont;
+	pFont = ::CreateFont(14, 0, 0, 0, FW_BOLD, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		PROOF_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("arial"));
+	pOldFont = (HFONT)::SelectObject(m_hMemDC, (HFONT)pFont);
+
+	int nOldROP2 = ::SetROP2(m_hMemDC,R2_NOT);
+	int nOldBkMode = ::SetBkMode(m_hMemDC,TRANSPARENT);
+	COLORREF clrText = ::SetTextColor(m_hMemDC,RGB(0, 0, 0));
+	UINT nOldAlign = ::SetTextAlign(m_hMemDC,TA_CENTER);
+
+	CString str,strX,strY;
+	CPoint	point = m_MousePoint;
+	CRect	rect;
+	CBrush	brush,rectBrush;
+	int		nBright = 0;
+
+	if(m_pDispBuf != NULL)
+	{
+		CSize	szSize = CSize(m_ScaleWidth,m_ScaleHeight);
+		if(point.y >= szSize.cy || point.x >= szSize.cx)
+		{
+			;
+		}
+		else
+		{
+			nBright = *(m_pDispBuf+point.y*szSize.cx+point.x);
+		}
+	}
+
+	strX.Format(_T("%d"),point.x);
+	strY.Format(_T("%d"),point.y);
+	strX = GetMoneyRule(strX,1000);
+	strY = GetMoneyRule(strY,1000);
+	str.Format(_T("[%s][%s][%d]"), strX,strY,nBright);
+
+	brush.CreateSolidBrush(RGB(180,150,190));
+	rectBrush.CreateSolidBrush(RGB(5,64,128));
+
+	rect = CRect(m_MousePoint.x-(int)((double)(str.GetLength())*2.9),m_MousePoint.y+20,m_MousePoint.x+(int)((double)(str.GetLength())*2.9),m_MousePoint.y+20+16);
+	::FrameRect(m_hMemDC,rect, (HBRUSH)rectBrush);
+	rect.DeflateRect(1,1);
+	::FillRect(m_hMemDC,&rect,(HBRUSH)brush);
+	::TextOut(m_hMemDC, m_MousePoint.x, m_MousePoint.y+20, str, str.GetLength());
+
+	::SetTextColor(m_hMemDC,clrText);
+	::SetBkMode(m_hMemDC,nOldBkMode);
+	::SetROP2(m_hMemDC,nOldROP2);
+	::SetTextAlign(m_hMemDC,nOldAlign);
+	::DeleteObject(::SelectObject(m_hMemDC, (HFONT)pOldFont));
+	brush.DeleteObject();
+	rectBrush.DeleteObject();
+}
+
+CString CSlimScrollView::GetMoneyRule(CString strMoney, int nRuleSpace/*=0*/)
+{
+	BOOL bMinus = FALSE;
+	if( strMoney.Find(_T("-"),0 ) >= 0 )
+		bMinus = TRUE;
+
+	double dMoney =	_ttof(strMoney);
+	strMoney.Format(_T("%.0f"), dMoney);
+
+	CString strResult = _T(""), strTemp1, strTemp2, strTemp3, strTemp4;
+
+	strTemp4 = strMoney.Right(3);
+	strMoney = strMoney.Left(strMoney.GetLength()-3);
+	strTemp3 = strMoney.Right(3);
+	strMoney = strMoney.Left(strMoney.GetLength()-3);
+	strTemp2 = strMoney.Right(3);
+	strMoney = strMoney.Left(strMoney.GetLength()-3);
+	strTemp1 = strMoney.Right(3);	
+
+	strResult = strTemp1 +  ((strTemp1.GetLength() > 0) ? _T(",") : _T("")) + strTemp2 +  ((strTemp2.GetLength() > 0) ? _T(",") : _T("")) + strTemp3 + ((strTemp3.GetLength() > 0) ? _T(",") : _T("")) + strTemp4;
+
+	if( bMinus )
+	{
+		strResult = _T("-")+strResult;
+	}
+	return strResult;
+}
+
+
+void CSlimScrollView::OnMouseMove(UINT nFlags, CPoint point) 
+{
+	int cx = this->GetScrollPos(SB_HORZ) + point.x;
+	int cy = this->GetScrollPos(SB_VERT) + point.y;	
+
+	m_MousePoint = CPoint(cx,cy);
+	if(m_bRect)
+	{
+		m_rtRect.bottom =cy;
+		m_rtRect.right = cx;			
+	}
+
+	DrawRefresh();
+
+	if(m_bMessage)
+	{
+		GetParent()->PostMessage(MSG_SCANVIEW_MOUSEPOS,cx,cy);				
+	}
+
+	CScrollView::OnMouseMove(nFlags, point);
+}
+
+void CSlimScrollView::PostNcDestroy() 
+{
+	// TODO: Add your specialized code here and/or call the base class
+
+	CScrollView::PostNcDestroy();
+}
+
+BOOL CSlimScrollView::DestroyWindow() 
+{
+	// TODO: Add your specialized code here and/or call the base class
+	
+	return CScrollView::DestroyWindow();
+}
+
+void CSlimScrollView::OnRButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+
+	CScrollView::OnRButtonDown(nFlags, point);
+}
+
+void CSlimScrollView::OnRButtonUp(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+
+	
+	CScrollView::OnRButtonUp(nFlags, point);
+}
+
+void CSlimScrollView::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+
+	int cx = this->GetScrollPos(SB_HORZ);
+	int cy = this->GetScrollPos(SB_VERT);
+
+	if(!m_bRect)//20140528
+	{
+		m_rtRect.top = point.y + cy;
+		m_rtRect.left = point.x + cx;
+		//m_rtRect.right = 0;
+		//m_rtRect.bottom = 0;
+		m_bRect = TRUE;
+	}
+
+	if(m_bNotchInsPosMod == TRUE)//20140528
+	{
+		m_bNotchInsPosMod = FALSE;
+		
+		CPoint pointTemp;
+
+		pointTemp.y = point.y + cy;
+		pointTemp.x = point.x + cx;
+
+		//	m_pNotchInsPos.insert(std::make_pair(nCount, pointTemp));
+
+		GetParent()->PostMessage(MSG_SCANVIEW_POS_MOD, pointTemp.x, pointTemp.y);
+	}
+
+	CScrollView::OnLButtonDown(nFlags, point);
+}
+
+void CSlimScrollView::OnLButtonUp(UINT nFlags, CPoint point) 
+{
+	// TODO: Add your message handler code here and/or call default
+	int cx = this->GetScrollPos(SB_HORZ);
+	int cy = this->GetScrollPos(SB_VERT);
+	
+	if(m_bRect)
+	{		
+		if( m_rtRect.top > m_rtRect.bottom)
+		{
+			int tmp = m_rtRect.top;
+			m_rtRect.top = m_rtRect.bottom;
+			m_rtRect.bottom = tmp;
+		}
+		if( m_rtRect.left > m_rtRect.right)
+		{
+			int tmp = m_rtRect.left;
+			m_rtRect.left = m_rtRect.right;
+			m_rtRect.right = tmp;
+		}		
+	//	if(m_bMessage)
+	//		GetParent()->PostMessage(UM_MOUSE_LBUTTON_UP,MAKELONG(m_rtRect.left/m_zoomScale,m_rtRect.top/m_zoomScale),MAKELONG(m_rtRect.right/m_zoomScale,m_rtRect.bottom/m_zoomScale));		
+		m_bRect = FALSE;
+	}
+
+	CScrollView::OnLButtonUp(nFlags, point);
+}
+
+void CSlimScrollView::OnLButtonDblClk(UINT nFlags, CPoint point)//20140528
+{
+	//	int nCount = (int)m_pNotchInsPos.size();
+
+	int cx = this->GetScrollPos(SB_HORZ);
+	int cy = this->GetScrollPos(SB_VERT);
+
+	CPoint pointTemp;
+
+	pointTemp.y = point.y + cy;
+	pointTemp.x = point.x + cx;
+
+	//	m_pNotchInsPos.insert(std::make_pair(nCount, pointTemp));
+
+	GetParent()->PostMessage(MSG_SCANVIEW_POS_ADD, pointTemp.x, pointTemp.y);	
+
+	CScrollView::OnLButtonDblClk(nFlags, point);
+}
+
+void CSlimScrollView::SetMode(SLIM_MODECOMMAND nMode)
+{
+	m_nCurMode = nMode;
+	m_bZoomMode = TRUE;
+	switch(m_nCurMode)
+	{
+	case SLIM_MODE_ZOOMIN:
+		//m_pCursor = AfxGetApp()->LoadCursor(IDC_ARROW_CURSOR);
+		
+		if(m_zoomScale < SLIM_MAXZOOMIN)	
+		{
+			m_zoomScale += SLIM_SCALE_FACTOR;		
+			if(m_zoomScale > SLIM_MAXZOOMIN) m_zoomScale = SLIM_MAXZOOMIN;
+		}
+		
+		if(CalcScaleSize() == TRUE)
+			DoZoomInOut();
+		break;
+	case SLIM_MODE_ZOOMOUT:
+		//m_pCursor = AfxGetApp()->LoadCursor(IDC_ARROW_CURSOR);
+		if(m_zoomScale > SLIM_MAXZOOMOUT)
+		{
+			m_zoomScale -= SLIM_SCALE_FACTOR;			
+			if(m_zoomScale < SLIM_MAXZOOMOUT) m_zoomScale = SLIM_MAXZOOMOUT;
+		}
+		
+		if(CalcScaleSize() == TRUE)
+			DoZoomInOut();
+		break;
+	case SLIM_MODE_NORMAL:
+		DoOrigin();
+		break;
+	case SLIM_MODE_POINT:
+		//m_pCursor = AfxGetApp()->LoadCursor(IDC_ARROW_CURSOR);
+		break;
+	}
+	m_bZoomMode = FALSE;
+	Invalidate(TRUE);
+}
+void CSlimScrollView::DoOrigin()
+{
+	if(m_nCurMode == SLIM_MODE_NORMAL)
+	{
+		m_ScaleWidth = m_ImageWidth;
+		m_ScaleHeight = m_ImageHeight;
+		m_zoomScale = 1;
+		DoZoomInOut();
+	}
+	DrawRefresh();
+}
+
+CRect CSlimScrollView::GetDrawRect()
+{
+	if(m_rtRect.left < 0) m_rtRect.left = 0;
+	if(m_rtRect.right < 0) m_rtRect.right = 0;
+	if(m_rtRect.left >= m_ScaleWidth) m_rtRect.left = m_ScaleWidth-1;
+	if(m_rtRect.right >= m_ScaleWidth) m_rtRect.right = m_ScaleWidth-1;
+
+	if(m_rtRect.top < 0) m_rtRect.top = 0;
+	if(m_rtRect.bottom < 0) m_rtRect.bottom = 0;
+	if(m_rtRect.top >= m_ScaleHeight) m_rtRect.top = m_ScaleHeight-1;
+	if(m_rtRect.bottom >= m_ScaleHeight) m_rtRect.bottom = m_ScaleHeight-1;
+
+	return m_rtRect;
+}
+
+void CSlimScrollView::SetSplinePosition(std::multimap<int, CSplinePoint> *pPoint,CPoint pointOffset)
+{
+	if(pPoint == NULL)
+		return;
+
+	m_pSplinePos.clear();
+	m_pSplinePos.insert(pPoint->begin(),pPoint->end());
+	m_pointSplineOffset = pointOffset;
+}
+
+void CSlimScrollView::DrawNotchInsPos()//20140528
+{
+	if(m_bDrawNotchInsPos == TRUE)
+	{
+		std::multimap<int, CPoint>::iterator	it;
+		CRect rect;
+		COLORREF color;
+
+		for(it=m_pNotchInsPos.begin();it!=m_pNotchInsPos.end();it++)
+		{
+			if(it->first == m_nNotchInsListIdx)
+			{
+				color = RGB(255,255,0);
+
+				if(m_bNotchInsPosMod == TRUE)
+				{
+					rect.left = m_MousePoint.x-2;
+					rect.right = m_MousePoint.x+2;;
+					rect.top = m_MousePoint.y-2;
+					rect.bottom = m_MousePoint.y+2;		
+				}
+				else
+				{
+					rect.left = it->second.x-2;
+					rect.right = it->second.x+2;;
+					rect.top = it->second.y-2;
+					rect.bottom = it->second.y+2;
+				}
+			}
+			else
+			{
+				color = RGB(255,0,0);
+				rect.left = it->second.x-2;
+				rect.right = it->second.x+2;;
+				rect.top = it->second.y-2;
+				rect.bottom = it->second.y+2;
+			}
+			DrawRectangle(rect,color);
+		}
+
+		//DrawLine(m_nNotchCadCenterX,0,m_nNotchCadCenterX,m_ImageHeight,RGB(255,255,0));
+		DrawLine(0,m_nNotchCadCenterY,m_ImageWidth,m_nNotchCadCenterY,RGB(128,128,0));
+
+
+	}
+}
+
+void CSlimScrollView::SetNotchInsPosition( std::multimap<int, CPoint> *pPoint )
+{
+	if(pPoint == NULL)
+		return;
+
+	m_pNotchInsPos.clear();
+	m_pNotchInsPos.insert(pPoint->begin(),pPoint->end());
+
+	Invalidate(FALSE);
+}
+
+void CSlimScrollView::SetNotchCadCenterPos( int nPosX, int nPosY )
+{
+	m_nNotchCadCenterX = nPosX;
+	m_nNotchCadCenterY = nPosY;
+}
+
+
diff --git a/ENRIT/UITool/SlimScrollView.h b/ENRIT/UITool/SlimScrollView.h
new file mode 100644
index 0000000..5f14a33
--- /dev/null
+++ b/ENRIT/UITool/SlimScrollView.h
@@ -0,0 +1,195 @@
+#if !defined(AFX_SLIMSCROLLVIEW_H__08F7FD45_AE99_43B5_85BC_41CC19F62C8E__INCLUDED_)
+#define AFX_SLIMSCROLLVIEW_H__08F7FD45_AE99_43B5_85BC_41CC19F62C8E__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SampleView.h : header file
+//
+
+#define MSG_SCANVIEW (WM_USER+105)
+#define MSG_SCANVIEW_MOUSEPOS (WM_USER+106)
+#define MSG_SCANVIEW_POS_ADD (WM_USER+107)//20140528
+#define MSG_SCANVIEW_POS_MOD (WM_USER+108)//20140528
+
+enum SLIM_MODECOMMAND{SLIM_MODE_ZOOMIN=0,SLIM_MODE_ZOOMOUT,SLIM_MODE_NORMAL,SLIM_MODE_POINT};
+
+#define SLIM_MAXZOOMIN     10       // Maximum zoom-in factor
+#define SLIM_MAXZOOMOUT    2
+
+
+const LONG SLIM_IMG_MAX_WIDTH = 200;
+const LONG SLIM_IMG_MAX_HEIGHT = 120;
+const double SLIM_SCALE_FACTOR = 1;
+
+//Region of interest (ROI)
+#ifndef _FV_ROI_
+#define _FV_ROI_
+typedef struct {
+	LONG	u1;
+	LONG	v1;
+	LONG	u2;
+	LONG	v2;
+} FV_ROI, *FV_LPROI;
+#endif
+
+
+
+#ifndef RANGEIN
+#define RANGEIN(a, r1, r2)		(((a>=r1)&&(a<=r2)) ? (1) : (0))
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// 搬苞康惑 棺 搬苞甫 叼胶敲饭捞秦霖促.
+//////////////////////////////////////////////////////////////////////////
+class CSlimScrollView : public CScrollView
+{
+public:
+	CSlimScrollView();           // protected constructor used by dynamic creation	
+	virtual ~CSlimScrollView();
+	DECLARE_DYNCREATE(CSlimScrollView)
+
+public:		
+	void			SetBrightHwnd(CWnd *pWnd){m_pBrightHWnd=pWnd;}
+	void			SetOrgImgSize(int width, int height)
+					{m_ImageWidth=m_ScaleWidth=width,m_ImageHeight=m_ScaleHeight=height,m_zoomScale=1.0,m_pDispBuf=m_pSetupIMG;}
+	CSize			GetOrgImgSize(){return CSize(m_ImageWidth,m_ImageHeight);}
+	void			SetDrawRect(BOOL bDraw){m_bDrawRect=bDraw;}
+	void			SetDrawNotchInsPos(BOOL bDraw){m_bDrawNotchInsPos=bDraw;}//20140528
+	void			SetRectPoint(CPoint point){m_pRectPoint=point;}	
+	BOOL			InitGDI(int width, int height, bool bColor);
+	void			SetHWnd(CWnd *pWnd){m_pParents=pWnd;}
+	LPBYTE			GetBuffer(){return m_pSetupIMG;}	
+	void			DrawRefresh();
+	void			SetMode(SLIM_MODECOMMAND nMode);
+	void			SetDefectRect(CRect* a_rtDefect){ if(a_rtDefect) m_rtDefect.SetRect(a_rtDefect->left,a_rtDefect->top,a_rtDefect->right,a_rtDefect->bottom);}
+	void			SetDrawDefect(bool bDraw){m_bDefect = bDraw;}
+	void			SetSendMessage(bool bMessage){m_bMessage = bMessage;}
+	void			SetZoomMode(bool bZoom){m_bZoomMode = bZoom;}
+	void			ResetImgBuf(){ ZeroMemory(m_pSetupIMG,sizeof(BYTE)*m_width*m_height); m_pDispBuf = m_pSetupIMG;}
+	void			ReleaseMemory();	
+	void			SetMarkPos(CPoint origin,CPoint offset){m_OriginPos=origin,m_OffsetPos=offset;}	
+	CRect			GetDrawRect();	
+	void			SetSplinePosition(std::multimap<int, CSplinePoint> *pPoint,CPoint pointOffset);
+	std::multimap<int, CSplinePoint>	*GetSplinePos(){return &m_pSplinePos;}	
+	CPoint			GetSplineOffset(){return m_pointSplineOffset;}
+
+	void			SetNotchInsPosition(std::multimap<int, CPoint> *pPoint);//20140528
+	void			SetNotchInsListIdx(int Idx){m_nNotchInsListIdx = Idx;}//20140528
+	void			SetNotchInsPosMod(BOOL bMod){m_bNotchInsPosMod = bMod;}//20140528
+	void			SetNotchCadCenterPos(int nPosX, int nPosY);//20140528
+
+protected:
+	void			EnlargeImage(BYTE *pInBuff, LONG wSrcWidth, LONG wSrcHeight, 
+								 BYTE *pOutBuff, LONG wDestWidth, LONG wDestHeight,double scale);
+	BYTE			CalcWeightedColor(BYTE* pPixels, CSize size, double dX, double dY);
+	void			ShrinkImage(BYTE *pInBuff, LONG wSrcWidth, LONG wSrcHeight, 
+								BYTE *pOutBuff, LONG wDestWidth, LONG wDestHeight,double scale);
+	BOOL			CalcScaleSize();
+	BOOL			DoZoomInOut();
+	void			DisplayError();
+	void			DrawImage(LPBYTE pImg);
+	void			DrawRectangle(CRect rect,COLORREF color);
+	void			DrawMark();
+	void			DrawLine(long sx, long sy, long ex, long ey, COLORREF color,int nStyle=PS_SOLID);
+	void			DrawPoint();
+	void			DrawSpline();
+	void			DrawNotchInsPos();//20140528
+
+	void			DoOrigin();
+	CString			GetMoneyRule(CString strMoney, int nRuleSpace/*=0*/);
+
+
+private:
+	
+	HDC			m_hMemDC;
+	HDC			m_hMainDC;
+	CDC*		m_pDC;
+	BITMAPINFO	*m_pBMI;
+	
+	HWND		m_hImageWnd;
+	CWnd		*m_pParents;
+	LPBYTE		m_pSetupIMG;
+	LPBYTE		m_pScaleIMg;
+	LPBYTE		m_pDispBuf;
+	HBITMAP		m_hBitmap;	
+	
+	CPoint		m_pRectPoint;
+	BOOL		m_bDrawRect;
+	BOOL		m_bDrawNotchInsPos;//20140528
+
+	SLIM_MODECOMMAND	m_nCurMode;
+	HCURSOR		m_pCursor;
+	
+	LONG		m_ImageWidth;
+	LONG		m_ImageHeight;
+	LONG		m_ScaleWidth;	
+	LONG		m_ScaleHeight;
+	double		m_zoomScale;
+	CWnd*		m_pBrightHWnd;
+	CRect		m_rtDefect;
+	bool		m_bDefect;
+	CRect		m_rtRect;
+	bool		m_bRect;	
+	
+
+	bool		m_bMessage;
+	int			m_width;
+	int			m_height;
+
+	CPoint		m_OriginPos;
+	CPoint		m_OffsetPos;
+	CPoint		m_MousePoint;
+
+	bool		m_bZoomMode;		// 吝夸 淋 葛靛客 畴富 葛靛甫 备盒	
+	std::multimap<int, CSplinePoint> m_pSplinePos;	
+	CPoint		m_pointSplineOffset;
+
+	std::multimap<int, CPoint> m_pNotchInsPos;//20140528	
+	int			m_nNotchInsListIdx;//20140528
+	BOOL		m_bNotchInsPosMod;//20140528
+	int			m_nNotchCadCenterX;//20140528
+	int			m_nNotchCadCenterY;//20140528
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSlimScrollView)
+	public:
+	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
+	virtual BOOL DestroyWindow();
+	protected:
+	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
+	virtual void OnInitialUpdate();     // first time after construct
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+	
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+	// Generated message map functions
+	//{{AFX_MSG(CSlimScrollView)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);//20140528
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SAMPLEVIEW_H__08F7FD45_AE99_43B5_85BC_41CC19F62C8E__INCLUDED_)
diff --git a/ENRIT/UITool/Splash.cpp b/ENRIT/UITool/Splash.cpp
new file mode 100644
index 0000000..b5ad03c
--- /dev/null
+++ b/ENRIT/UITool/Splash.cpp
@@ -0,0 +1,357 @@
+//  ===========================================================================
+//  File    Splash.cpp
+//  Desc    The implementation file for the CSplash class.
+//  ===========================================================================
+
+#include "stdafx.h"
+#include "splash.h"
+#include "windowsx.h"
+
+//  ===========================================================================
+//  The following is used for layering support which is used in the 
+//  splash screen for transparency. In VC 6 these are not defined in the headers
+//  for user32.dll and hence we use mechanisms so that it can work in VC 6.
+//  We define the flags here and write code so that we can load the function
+//  from User32.dll explicitely and use it. This code requires Win2k and above
+//  to work.
+//  ===========================================================================
+typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)
+        (HWND hWnd, COLORREF cr, BYTE bAlpha, DWORD dwFlags);
+
+lpfnSetLayeredWindowAttributes g_pSetLayeredWindowAttributes;
+
+#define WS_EX_LAYERED 0x00080000 
+// #define LWA_COLORKEY 1 // Use color as the transparency color.
+// #define LWA_ALPHA    2 // Use bAlpha to determine the opacity of the layer
+
+//  ===========================================================================
+//  Func    ExtWndProc
+//  Desc    The windows procedure that is used to forward messages to the 
+//          CSplash class. CSplash sends the "this" pointer through the
+//          CreateWindowEx call and the pointer reaches here in the 
+//          WM_CREATE message. We store it here and use it for message 
+//          forwarding.
+//  ===========================================================================
+static LRESULT CALLBACK ExtWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    static CSplash * spl = NULL;
+    if(uMsg == WM_CREATE)
+    {
+        spl = (CSplash*)((LPCREATESTRUCT)lParam)->lpCreateParams;
+    }
+    if(spl)
+        return spl->WindowProc(hwnd, uMsg, wParam, lParam);
+    else
+        return DefWindowProc (hwnd, uMsg, wParam, lParam);
+}
+
+LRESULT CALLBACK CSplash::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    //  We need to handle on the WM_PAINT message
+    switch(uMsg)
+    {
+        HANDLE_MSG(hwnd, WM_PAINT, OnPaint);
+    }
+
+    return DefWindowProc (hwnd, uMsg, wParam, lParam) ;
+}
+
+void CSplash:: OnPaint(HWND hwnd)
+{
+    if (!m_hBitmap || m_uBitmap == 0)
+        return;
+
+	SetBitmap(m_uBitmap);
+    //  =======================================================================
+    //  Paint the background by BitBlting the bitmap
+    //  =======================================================================
+    PAINTSTRUCT ps ;
+    HDC hDC = BeginPaint (hwnd, &ps) ;
+
+    RECT   rect;
+	RECT rc;
+	HFONT		font, pOldFont;
+	LONG		startcv,i;
+	CString		strtmp;
+	
+    ::GetClientRect(m_hwnd, &rect);
+    
+    HDC hMemDC      = ::CreateCompatibleDC(hDC);
+    HBITMAP hOldBmp = (HBITMAP)::SelectObject(hMemDC, m_hBitmap);    
+	
+	// create font
+	font = ::CreateFont(14, 0, 0, 0, FW_BOLD, 0, 0, 0,
+			DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+			PROOF_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Tahoma"));
+
+	pOldFont = (HFONT) ::SelectObject(hMemDC, font);
+	
+	::SetBkMode(hMemDC, TRANSPARENT);	
+
+	startcv = 90;
+	rc.left = rect.left + 20;	
+	rc.right = rect.right - 10;	
+	
+	for(i=0;i<m_TXTCount;i++)
+	{
+		if(::GetTextColor(hMemDC) != m_TXTArr[i].color) ::SetTextColor(hMemDC, m_TXTArr[i].color);
+
+		rc.top = startcv;
+		rc.bottom = rc.top+14;
+		strtmp = m_TXTArr[i].strtxt;
+			
+		DrawText(hMemDC, strtmp, strtmp.GetLength(), &rc, 0);
+
+		startcv = rc.bottom + 5;
+	}
+
+    BitBlt(hDC, 0, 0, m_dwWidth, m_dwHeight, hMemDC, 0, 0, SRCCOPY);
+
+    ::SelectObject(hMemDC, hOldBmp);
+
+    ::DeleteDC(hMemDC);
+	DeleteObject(font);
+    
+    EndPaint (hwnd, &ps) ;
+}
+
+void CSplash::Init()
+{
+    //  =======================================================================
+    //  Initialize the variables
+    //  =======================================================================
+    m_hwnd = NULL;
+    m_lpszClassName = TEXT("SPLASH");
+    m_colTrans = 0;
+	m_uBitmap = 0;
+    //  =======================================================================
+    //  Keep the function pointer for the SetLayeredWindowAttributes function
+    //  in User32.dll ready
+    //  =======================================================================
+    HMODULE hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
+
+    g_pSetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)
+                        GetProcAddress(hUser32, "SetLayeredWindowAttributes");
+	
+	m_TXTCount = 0;
+	
+	ClearText();
+}
+
+CSplash::CSplash()
+{
+    Init();
+}
+
+CSplash::CSplash(UINT uBitmap, COLORREF colTrans)
+{
+    Init();
+
+    SetBitmap(uBitmap);
+    SetTransparentColor(colTrans);
+}
+
+CSplash::~CSplash()
+{	
+    FreeResources();
+}
+
+HWND CSplash::RegAndCreateWindow()
+{
+    //  =======================================================================
+    //  Register the window with ExtWndProc as the window procedure
+    //  =======================================================================
+    WNDCLASSEX wndclass;
+    wndclass.cbSize         = sizeof (wndclass);
+    wndclass.style          = CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW;
+    wndclass.lpfnWndProc    = ExtWndProc;
+    wndclass.cbClsExtra     = 0;
+    wndclass.cbWndExtra     = DLGWINDOWEXTRA;
+    wndclass.hInstance      = ::GetModuleHandle(NULL);
+    wndclass.hIcon          = NULL;
+    wndclass.hCursor        = ::LoadCursor( NULL, IDC_WAIT );
+    wndclass.hbrBackground  = (HBRUSH)::GetStockObject(LTGRAY_BRUSH);
+    wndclass.lpszMenuName   = NULL;
+    wndclass.lpszClassName  = m_lpszClassName;
+    wndclass.hIconSm        = NULL;
+
+    if(!RegisterClassEx (&wndclass))
+        return NULL;
+
+    //  =======================================================================
+    //  Create the window of the application, passing the this pointer so that
+    //  ExtWndProc can use that for message forwarding
+    //  =======================================================================
+    DWORD nScrWidth  = ::GetSystemMetrics(SM_CXFULLSCREEN);
+    DWORD nScrHeight = ::GetSystemMetrics(SM_CYFULLSCREEN);
+
+    int x = (nScrWidth  - m_dwWidth) / 2;
+    int y = (nScrHeight - m_dwHeight) / 2;
+//    m_hwnd = ::CreateWindowEx(WS_EX_TOPMOST|WS_EX_TOOLWINDOW, m_lpszClassName, 
+//                              TEXT("Banner"), WS_POPUP, x, y, 
+//                              m_dwWidth, m_dwHeight, NULL, NULL, NULL, this);
+
+	m_hwnd = ::CreateWindowEx(WS_EX_TOPMOST|WS_EX_TOOLWINDOW, m_lpszClassName, 
+                              TEXT("Banner"), WS_POPUP, x, y, 
+                              m_dwWidth, m_dwHeight, NULL, NULL, NULL, this);
+
+    //  =======================================================================
+    //  Display the window
+    //  =======================================================================
+    if(m_hwnd)
+    {
+      //  MakeTransparent();
+        ShowWindow   (m_hwnd, SW_SHOW) ;
+        UpdateWindow (m_hwnd);
+    }
+    return m_hwnd;
+}
+
+int CSplash::DoLoop()
+{
+    //  =======================================================================
+    //  Show the window
+    //  =======================================================================
+    if(!m_hwnd)
+        ShowSplash();
+
+    //  =======================================================================
+    //  Get into the modal loop
+    //  =======================================================================
+    MSG msg ;
+    while (GetMessage (&msg, NULL, 0, 0))
+    {
+        TranslateMessage (&msg) ;
+        DispatchMessage  (&msg) ;
+    }
+
+    return (int)msg.wParam ;
+
+}
+
+void CSplash::ShowSplash()
+{
+    CloseSplash();
+    RegAndCreateWindow();
+}
+
+void CSplash::ClearText()
+{
+	for(LONG i=0;i<MAX_SPLASH_SIZE;i++)
+	{
+		m_TXTArr[i].strtxt = _T("");
+		m_TXTArr[i].color = RGB(0,0,0);
+	}	
+}
+
+
+DWORD CSplash::SetBitmap(UINT uBitmap)
+{
+	HBITMAP hBitmap = NULL; 
+	HMODULE hInstResource = NULL;
+
+	m_uBitmap = uBitmap;
+
+	// Find correct resource handle
+	hInstResource = ::GetModuleHandle(NULL); //replace MFC dep. code 
+
+	// Load bitmap In
+	hBitmap = (HBITMAP)::LoadImage(hInstResource, MAKEINTRESOURCE(uBitmap),
+	IMAGE_BITMAP, 0, 0, 0);
+
+	return SetBitmap(hBitmap);
+}
+
+DWORD CSplash::SetBitmap(HBITMAP hBitmap)
+{
+    int nRetValue;
+    BITMAP  csBitmapSize;
+    
+    //  =======================================================================
+    //  Free loaded resource
+    //  =======================================================================
+    FreeResources();
+    
+    if (hBitmap)
+    {
+        m_hBitmap = hBitmap;
+        
+        //  ===================================================================
+        //  Get bitmap size
+        //  ===================================================================
+        nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
+        if (nRetValue == 0)
+        {
+            FreeResources();
+            return 0;
+        }
+        m_dwWidth = (DWORD)csBitmapSize.bmWidth;
+        m_dwHeight = (DWORD)csBitmapSize.bmHeight;
+    }
+       
+    return 1;
+}
+
+void CSplash::FreeResources()
+{
+    if (m_hBitmap)
+        ::DeleteObject (m_hBitmap);
+    m_hBitmap = NULL;
+}
+
+int CSplash::CloseSplash()
+{
+    
+    if(m_hwnd)
+    {
+        DestroyWindow(m_hwnd);
+        m_hwnd = 0;
+        UnregisterClass(m_lpszClassName, ::GetModuleHandle(NULL));
+        return 1;
+    }
+    return 0;
+}
+
+bool CSplash::SetTransparentColor(COLORREF col)
+{
+    m_colTrans = col;
+
+    return MakeTransparent();
+}
+
+bool CSplash::MakeTransparent()
+{
+    //  =======================================================================
+    //  Set the layered window style and make the required color transparent
+    //  =======================================================================
+    if(m_hwnd && g_pSetLayeredWindowAttributes && m_colTrans )
+    {
+        //  set layered style for the window
+        SetWindowLong(m_hwnd, GWL_EXSTYLE, GetWindowLong(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
+        //  call it with 0 alpha for the given color
+        g_pSetLayeredWindowAttributes(m_hwnd, m_colTrans, 0, LWA_COLORKEY);
+    }    
+    return TRUE;
+}
+
+void CSplash::SetText(CString strText,COLORREF color)
+{
+	LONG			i;
+	SPLASH_ARRAY	tmpArr;
+
+	if(m_TXTCount >= MAX_SPLASH_SIZE)
+	{
+		for(i=1;i<MAX_SPLASH_SIZE;i++)
+		{
+			m_TXTArr[i-1].color = m_TXTArr[i].color;
+			m_TXTArr[i-1].strtxt = m_TXTArr[i].strtxt;
+		}		
+		m_TXTCount--;
+	}
+	
+	m_TXTArr[m_TXTCount].color = color;
+	m_TXTArr[m_TXTCount++].strtxt = strText;
+	
+	InvalidateRgn(m_hwnd, NULL, true);
+	UpdateWindow (m_hwnd);
+}
\ No newline at end of file
diff --git a/ENRIT/UITool/Splash.h b/ENRIT/UITool/Splash.h
new file mode 100644
index 0000000..db5f9fb
--- /dev/null
+++ b/ENRIT/UITool/Splash.h
@@ -0,0 +1,117 @@
+//  ===========================================================================
+//  File    Splash.h
+//  Desc    The interface of the CSplash class
+//  ===========================================================================
+#ifndef _ABHI_SPLASH_H_
+#define _ABHI_SPLASH_H_
+
+#include <afxwin.h>
+
+#define		MAX_SPLASH_SIZE  12
+
+#ifndef __PNS_SPLASH_ARRAY__
+#define __PNS_SPLASH_ARRAY__
+typedef struct _SPLASH_ARRAY {
+	CString		strtxt;
+	COLORREF	color;
+}SPLASH_ARRAY, *LSPLASH_ARRAY;
+#endif 
+
+
+//  ===========================================================================
+//  Class   CSplash
+//  Desc    Use it for displaying splash screen for applications
+//          Works only on Win2000 , WinXP and later versions of Windows
+//  ===========================================================================
+class CSplash
+{
+public:
+    //  =======================================================================
+    //  Func   CSplash
+    //  Desc   Default constructor
+    //  =======================================================================
+    CSplash();
+    
+    //  =======================================================================
+    //  Func   CSplash
+    //  Desc   Constructor
+    //  Arg    Path of the Bitmap that will be show on the splash screen
+    //  Arg    The color on the bitmap that will be made transparent
+    //  =======================================================================
+    CSplash(UINT uBitmap, COLORREF colTrans);
+
+    //  =======================================================================
+    //  Func   ~CSplash
+    //  Desc   Desctructor
+    //  =======================================================================
+    virtual ~CSplash();
+
+    //  =======================================================================
+    //  Func   ShowSplash
+    //  Desc   Launches the non-modal splash screen
+    //  Ret    void 
+    //  =======================================================================
+    void			ShowSplash();
+
+    //  =======================================================================
+    //  Func   DoLoop
+    //  Desc   Launched the splash screen as a modal window. Not completely 
+    //         implemented.
+    //  Ret    int 
+    //  =======================================================================
+    int				DoLoop();
+
+    //  =======================================================================
+    //  Func   CloseSplash
+    //  Desc   Closes the splash screen started with ShowSplash
+    //  Ret    int 
+    //  =======================================================================
+    int				CloseSplash();
+
+    //  =======================================================================
+    //  Func   SetBitmap
+    //  Desc   Call this with the path of the bitmap. Not required to be used
+    //         when the construcutor with the image path has been used.
+    //  Ret    1 if succesfull
+    //  Arg    Either the file path or the handle to an already loaded bitmap
+    //  =======================================================================
+    DWORD			SetBitmap(UINT uBitmap);
+    DWORD			SetBitmap(HBITMAP hBitmap);
+
+    //  =======================================================================
+    //  Func   SetTransparentColor
+    //  Desc   This is used to make one of the color transparent
+    //  Ret    1 if succesfull
+    //  Arg    The colors RGB value. Not required if the color is specified 
+    //         using the constructor
+    //  =======================================================================
+    bool			SetTransparentColor(COLORREF col);
+
+    LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+    HWND			m_hwnd;
+
+	void			SetText(CString strText,COLORREF color);
+
+	void			ClearText();
+
+private:
+    void			Init();
+    void			OnPaint(HWND hwnd);
+    bool			MakeTransparent();
+    HWND			RegAndCreateWindow();    
+    void			FreeResources();
+
+	COLORREF		m_colTrans;
+    DWORD			m_dwWidth;
+    DWORD			m_dwHeight;
+    HBITMAP			m_hBitmap;
+    LPCTSTR			m_lpszClassName;		
+	UINT			m_uBitmap;
+
+	SPLASH_ARRAY	m_TXTArr[MAX_SPLASH_SIZE];
+	LONG			m_TXTCount;
+};
+
+
+#endif //_ABHI_SPLASH_H_
diff --git a/ENRIT/UITool/StopWatch.cpp b/ENRIT/UITool/StopWatch.cpp
new file mode 100644
index 0000000..d8c0c3b
--- /dev/null
+++ b/ENRIT/UITool/StopWatch.cpp
@@ -0,0 +1,45 @@
+// StopWatch.cpp: implementation of the CStopWatch class.
+//
+//////////////////////////////////////////////////////////////////////
+#include "stdafx.h"
+#include "StopWatch.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CStopWatch::CStopWatch()
+{
+	m_swFreq.LowPart = m_swFreq.HighPart = 0;
+	m_swStart = m_swFreq;
+	m_swEnd = m_swFreq;
+	m_fTimeforDuration = 0;
+
+	QueryPerformanceFrequency(&m_swFreq);
+//	m_swFreq.QuadPart = (LONGLONG)(2.41f*1024*1024*1024);
+}
+
+CStopWatch::~CStopWatch()
+{
+}
+
+void CStopWatch::Start(void)
+{
+	QueryPerformanceCounter(&m_swStart);
+}
+
+void CStopWatch::End(void)
+{
+	QueryPerformanceCounter(&m_swEnd);
+	m_fTimeforDuration = (m_swEnd.QuadPart - m_swStart.QuadPart)/(float)m_swFreq.QuadPart; 
+}
+
+
+
+
diff --git a/ENRIT/UITool/StopWatch.h b/ENRIT/UITool/StopWatch.h
new file mode 100644
index 0000000..f67e952
--- /dev/null
+++ b/ENRIT/UITool/StopWatch.h
@@ -0,0 +1,36 @@
+// StopWatch.h: interface for the CStopWatch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_STOPWATCH_H__C2068F0F_528F_43C3_9A72_ECA8A4DCAFA2__INCLUDED_)
+#define AFX_STOPWATCH_H__C2068F0F_528F_43C3_9A72_ECA8A4DCAFA2__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <afxwin.h>
+
+class CStopWatch  
+{
+public:
+	CStopWatch();
+	virtual ~CStopWatch();
+
+public:
+	void Start(void);
+	void End(void);
+	const float GetDurationSecond(void) const { return m_fTimeforDuration; }
+	const float GetDurationMilliSecond(void) const { return m_fTimeforDuration*1000.f; }
+
+public:
+	LARGE_INTEGER GetStartInteger(void) const { return m_swStart; }
+	LARGE_INTEGER GetEndInteger(void) const { return m_swEnd; }
+	LARGE_INTEGER GetFrequency(void) const { return m_swFreq; }
+
+protected:
+	LARGE_INTEGER		m_swFreq, m_swStart, m_swEnd;
+	float				m_fTimeforDuration;
+};
+
+#endif // !defined(AFX_STOPWATCH_H__C2068F0F_528F_43C3_9A72_ECA8A4DCAFA2__INCLUDED_)
diff --git a/ENRIT/UITool/btnenh.cpp b/ENRIT/UITool/btnenh.cpp
new file mode 100644
index 0000000..95519b6
--- /dev/null
+++ b/ENRIT/UITool/btnenh.cpp
@@ -0,0 +1,3065 @@
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+
+#include "stdafx.h"
+#include "btnenh.h"
+
+// Dispatch interfaces referenced by this interface
+#include "Font.h"
+#include "SurfaceColor.h"
+#include "TextDescriptor.h"
+#include "texture.h"
+#include "CellsManager.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CBtnEnh
+
+IMPLEMENT_DYNCREATE(CBtnEnh, CWnd)
+
+/////////////////////////////////////////////////////////////////////////////
+// CBtnEnh properties
+
+CString CBtnEnh::GetCaption()
+{
+	CString result;
+	GetProperty(DISPID_CAPTION, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetCaption(LPCTSTR propVal)
+{
+	SetProperty(DISPID_CAPTION, VT_BSTR, propVal);
+}
+
+long CBtnEnh::GetShape()
+{
+	long result;
+	GetProperty(0xb, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetShape(long propVal)
+{
+	SetProperty(0xb, VT_I4, propVal);
+}
+
+short CBtnEnh::GetRoundness()
+{
+	short result;
+	GetProperty(0xc, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetRoundness(short propVal)
+{
+	SetProperty(0xc, VT_I2, propVal);
+}
+
+long CBtnEnh::GetSlant()
+{
+	long result;
+	GetProperty(0xd, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSlant(long propVal)
+{
+	SetProperty(0xd, VT_I4, propVal);
+}
+
+long CBtnEnh::GetSurface()
+{
+	long result;
+	GetProperty(0xe, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSurface(long propVal)
+{
+	SetProperty(0xe, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetPictureTranspColor()
+{
+	unsigned long result;
+	GetProperty(0xf, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureTranspColor(unsigned long propVal)
+{
+	SetProperty(0xf, VT_I4, propVal);
+}
+
+CString CBtnEnh::GetSoundDown()
+{
+	CString result;
+	GetProperty(0x1, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSoundDown(LPCTSTR propVal)
+{
+	SetProperty(0x1, VT_BSTR, propVal);
+}
+
+CString CBtnEnh::GetSoundUp()
+{
+	CString result;
+	GetProperty(0x2, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSoundUp(LPCTSTR propVal)
+{
+	SetProperty(0x2, VT_BSTR, propVal);
+}
+
+CString CBtnEnh::GetCursor()
+{
+	CString result;
+	GetProperty(0x3, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetCursor(LPCTSTR propVal)
+{
+	SetProperty(0x3, VT_BSTR, propVal);
+}
+
+CString CBtnEnh::GetSoundMouseOver()
+{
+	CString result;
+	GetProperty(0x4, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSoundMouseOver(LPCTSTR propVal)
+{
+	SetProperty(0x4, VT_BSTR, propVal);
+}
+
+CString CBtnEnh::GetSoundMouseOut()
+{
+	CString result;
+	GetProperty(0x5, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSoundMouseOut(LPCTSTR propVal)
+{
+	SetProperty(0x5, VT_BSTR, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextLT()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x10, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextLT(LPDISPATCH propVal)
+{
+	SetProperty(0x10, VT_DISPATCH, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextCT()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x11, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextCT(LPDISPATCH propVal)
+{
+	SetProperty(0x11, VT_DISPATCH, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextRT()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x12, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextRT(LPDISPATCH propVal)
+{
+	SetProperty(0x12, VT_DISPATCH, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextLM()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x13, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextLM(LPDISPATCH propVal)
+{
+	SetProperty(0x13, VT_DISPATCH, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextRM()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x14, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextRM(LPDISPATCH propVal)
+{
+	SetProperty(0x14, VT_DISPATCH, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextLB()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x15, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextLB(LPDISPATCH propVal)
+{
+	SetProperty(0x15, VT_DISPATCH, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextCB()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x16, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextCB(LPDISPATCH propVal)
+{
+	SetProperty(0x16, VT_DISPATCH, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextRB()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x17, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextRB(LPDISPATCH propVal)
+{
+	SetProperty(0x17, VT_DISPATCH, propVal);
+}
+
+CString CBtnEnh::GetPicture()
+{
+	CString result;
+	GetProperty(0x6, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPicture(LPCTSTR propVal)
+{
+	SetProperty(0x6, VT_BSTR, propVal);
+}
+
+CString CBtnEnh::GetPicturePressed()
+{
+	CString result;
+	GetProperty(0x7, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPicturePressed(LPCTSTR propVal)
+{
+	SetProperty(0x7, VT_BSTR, propVal);
+}
+
+CString CBtnEnh::GetPictureMouseOver()
+{
+	CString result;
+	GetProperty(0x8, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureMouseOver(LPCTSTR propVal)
+{
+	SetProperty(0x8, VT_BSTR, propVal);
+}
+
+CString CBtnEnh::GetPictureCustom()
+{
+	CString result;
+	GetProperty(0x9, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureCustom(LPCTSTR propVal)
+{
+	SetProperty(0x9, VT_BSTR, propVal);
+}
+
+long CBtnEnh::GetPicturePosition()
+{
+	long result;
+	GetProperty(0x18, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPicturePosition(long propVal)
+{
+	SetProperty(0x18, VT_I4, propVal);
+}
+
+short CBtnEnh::GetPictureXOffset()
+{
+	short result;
+	GetProperty(0x19, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureXOffset(short propVal)
+{
+	SetProperty(0x19, VT_I2, propVal);
+}
+
+short CBtnEnh::GetPictureYOffset()
+{
+	short result;
+	GetProperty(0x1a, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureYOffset(short propVal)
+{
+	SetProperty(0x1a, VT_I2, propVal);
+}
+
+BOOL CBtnEnh::GetEnabled()
+{
+	BOOL result;
+	GetProperty(DISPID_ENABLED, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetEnabled(BOOL propVal)
+{
+	SetProperty(DISPID_ENABLED, VT_BOOL, propVal);
+}
+
+long CBtnEnh::GetPictureTranspMode()
+{
+	long result;
+	GetProperty(0x1b, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureTranspMode(long propVal)
+{
+	SetProperty(0x1b, VT_I4, propVal);
+}
+
+BOOL CBtnEnh::GetButtonCustomRaised()
+{
+	BOOL result;
+	GetProperty(0x1c, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetButtonCustomRaised(BOOL propVal)
+{
+	SetProperty(0x1c, VT_BOOL, propVal);
+}
+
+unsigned long CBtnEnh::GetBackColorContainer()
+{
+	unsigned long result;
+	GetProperty(0x1d, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetBackColorContainer(unsigned long propVal)
+{
+	SetProperty(0x1d, VT_I4, propVal);
+}
+
+BOOL CBtnEnh::GetMovePictureOnPress()
+{
+	BOOL result;
+	GetProperty(0x1e, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetMovePictureOnPress(BOOL propVal)
+{
+	SetProperty(0x1e, VT_BOOL, propVal);
+}
+
+short CBtnEnh::GetButtonRaiseFactor()
+{
+	short result;
+	GetProperty(0x1f, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetButtonRaiseFactor(short propVal)
+{
+	SetProperty(0x1f, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetHighlightColor()
+{
+	unsigned long result;
+	GetProperty(0x20, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetHighlightColor(unsigned long propVal)
+{
+	SetProperty(0x20, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetShadowColor()
+{
+	unsigned long result;
+	GetProperty(0x21, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetShadowColor(unsigned long propVal)
+{
+	SetProperty(0x21, VT_I4, propVal);
+}
+
+BOOL CBtnEnh::GetButtonCustomFitPicture()
+{
+	BOOL result;
+	GetProperty(0x22, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetButtonCustomFitPicture(BOOL propVal)
+{
+	SetProperty(0x22, VT_BOOL, propVal);
+}
+
+OLE_HANDLE CBtnEnh::GetHWnd()
+{
+	OLE_HANDLE result;
+	GetProperty(DISPID_HWND, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetHWnd(OLE_HANDLE propVal)
+{
+	SetProperty(DISPID_HWND, VT_I4, propVal);
+}
+
+COleFont CBtnEnh::GetFontTextCaption()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x23, VT_DISPATCH, (void*)&pDispatch);
+	return COleFont(pDispatch);
+}
+
+void CBtnEnh::SetFontTextCaption(LPDISPATCH propVal)
+{
+	SetProperty(0x23, VT_DISPATCH, propVal);
+}
+
+CString CBtnEnh::GetHyperlink()
+{
+	CString result;
+	GetProperty(0x24, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetHyperlink(LPCTSTR propVal)
+{
+	SetProperty(0x24, VT_BSTR, propVal);
+}
+
+BOOL CBtnEnh::GetEnableInternetLoadAtDT()
+{
+	BOOL result;
+	GetProperty(0xa, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetEnableInternetLoadAtDT(BOOL propVal)
+{
+	SetProperty(0xa, VT_BOOL, propVal);
+}
+
+long CBtnEnh::GetSmoothEdges()
+{
+	long result;
+	GetProperty(0x25, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSmoothEdges(long propVal)
+{
+	SetProperty(0x25, VT_I4, propVal);
+}
+
+CString CBtnEnh::GetTagEx()
+{
+	CString result;
+	GetProperty(0x26, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetTagEx(LPCTSTR propVal)
+{
+	SetProperty(0x26, VT_BSTR, propVal);
+}
+
+BOOL CBtnEnh::GetPictureKeepRatio()
+{
+	BOOL result;
+	GetProperty(0x27, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureKeepRatio(BOOL propVal)
+{
+	SetProperty(0x27, VT_BOOL, propVal);
+}
+
+long CBtnEnh::GetFocusMode()
+{
+	long result;
+	GetProperty(0x28, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetFocusMode(long propVal)
+{
+	SetProperty(0x28, VT_I4, propVal);
+}
+
+long CBtnEnh::GetSpecialEffect()
+{
+	long result;
+	GetProperty(0x29, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpecialEffect(long propVal)
+{
+	SetProperty(0x29, VT_I4, propVal);
+}
+
+short CBtnEnh::GetCaptionWordWrapPerc()
+{
+	short result;
+	GetProperty(0x2a, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetCaptionWordWrapPerc(short propVal)
+{
+	SetProperty(0x2a, VT_I2, propVal);
+}
+
+short CBtnEnh::GetOptimization()
+{
+	short result;
+	GetProperty(0x2b, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOptimization(short propVal)
+{
+	SetProperty(0x2b, VT_I2, propVal);
+}
+
+BOOL CBtnEnh::GetClickable()
+{
+	BOOL result;
+	GetProperty(0x2c, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetClickable(BOOL propVal)
+{
+	SetProperty(0x2c, VT_BOOL, propVal);
+}
+
+unsigned long CBtnEnh::GetBackColor()
+{
+	unsigned long result;
+	GetProperty(0x2d, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetBackColor(unsigned long propVal)
+{
+	SetProperty(0x2d, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetForeColor()
+{
+	unsigned long result;
+	GetProperty(0x2e, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetForeColor(unsigned long propVal)
+{
+	SetProperty(0x2e, VT_I4, propVal);
+}
+
+BOOL CBtnEnh::GetIgnoreSpaceBar()
+{
+	BOOL result;
+	GetProperty(0x2f, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetIgnoreSpaceBar(BOOL propVal)
+{
+	SetProperty(0x2f, VT_BOOL, propVal);
+}
+
+long CBtnEnh::GetSpecialEffectFactor()
+{
+	long result;
+	GetProperty(0x30, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpecialEffectFactor(long propVal)
+{
+	SetProperty(0x30, VT_I4, propVal);
+}
+
+CString CBtnEnh::GetTexture()
+{
+	CString result;
+	GetProperty(0x49, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetTexture(LPCTSTR propVal)
+{
+	SetProperty(0x49, VT_BSTR, propVal);
+}
+
+short CBtnEnh::GetTextureMode()
+{
+	short result;
+	GetProperty(0x4a, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetTextureMode(short propVal)
+{
+	SetProperty(0x4a, VT_I2, propVal);
+}
+
+short CBtnEnh::GetTextureLightIntensity()
+{
+	short result;
+	GetProperty(0x4b, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetTextureLightIntensity(short propVal)
+{
+	SetProperty(0x4b, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetTextureColorMix()
+{
+	unsigned long result;
+	GetProperty(0x4c, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetTextureColorMix(unsigned long propVal)
+{
+	SetProperty(0x4c, VT_I4, propVal);
+}
+
+short CBtnEnh::GetTextureColorMixPerc()
+{
+	short result;
+	GetProperty(0x4d, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetTextureColorMixPerc(short propVal)
+{
+	SetProperty(0x4d, VT_I2, propVal);
+}
+
+short CBtnEnh::GetTextureBevelFactor()
+{
+	short result;
+	GetProperty(0x4e, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetTextureBevelFactor(short propVal)
+{
+	SetProperty(0x4e, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetForeColorDisabled()
+{
+	unsigned long result;
+	GetProperty(0x4f, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetForeColorDisabled(unsigned long propVal)
+{
+	SetProperty(0x4f, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetBackColorDisabled()
+{
+	unsigned long result;
+	GetProperty(0x50, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetBackColorDisabled(unsigned long propVal)
+{
+	SetProperty(0x50, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetBackColorMouseOver()
+{
+	unsigned long result;
+	GetProperty(0x51, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetBackColorMouseOver(unsigned long propVal)
+{
+	SetProperty(0x51, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetBackColorFocus()
+{
+	unsigned long result;
+	GetProperty(0x52, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetBackColorFocus(unsigned long propVal)
+{
+	SetProperty(0x52, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetBackColorInterior()
+{
+	unsigned long result;
+	GetProperty(0x53, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetBackColorInterior(unsigned long propVal)
+{
+	SetProperty(0x53, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetForeColorMouseOver()
+{
+	unsigned long result;
+	GetProperty(0x54, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetForeColorMouseOver(unsigned long propVal)
+{
+	SetProperty(0x54, VT_I4, propVal);
+}
+
+long CBtnEnh::GetFlatPillowFactor()
+{
+	long result;
+	GetProperty(0x57, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetFlatPillowFactor(long propVal)
+{
+	SetProperty(0x57, VT_I4, propVal);
+}
+
+long CBtnEnh::GetShadowMode()
+{
+	long result;
+	GetProperty(0x58, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetShadowMode(long propVal)
+{
+	SetProperty(0x58, VT_I4, propVal);
+}
+
+long CBtnEnh::GetStyle()
+{
+	long result;
+	GetProperty(0x5f, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetStyle(long propVal)
+{
+	SetProperty(0x5f, VT_I4, propVal);
+}
+
+CString CBtnEnh::GetPictureDisabled()
+{
+	CString result;
+	GetProperty(0x60, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureDisabled(LPCTSTR propVal)
+{
+	SetProperty(0x60, VT_BSTR, propVal);
+}
+
+unsigned long CBtnEnh::GetForeColorPressed()
+{
+	unsigned long result;
+	GetProperty(0x61, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetForeColorPressed(unsigned long propVal)
+{
+	SetProperty(0x61, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetBackColorPressed()
+{
+	unsigned long result;
+	GetProperty(0x62, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetBackColorPressed(unsigned long propVal)
+{
+	SetProperty(0x62, VT_I4, propVal);
+}
+
+short CBtnEnh::GetValue()
+{
+	short result;
+	GetProperty(0x69, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetValue(short propVal)
+{
+	SetProperty(0x69, VT_I2, propVal);
+}
+
+long CBtnEnh::GetOrientation()
+{
+	long result;
+	GetProperty(0x6c, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOrientation(long propVal)
+{
+	SetProperty(0x6c, VT_I4, propVal);
+}
+
+CSurfaceColor CBtnEnh::GetColorSurfaceNormal()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x6d, VT_DISPATCH, (void*)&pDispatch);
+	return CSurfaceColor(pDispatch);
+}
+
+void CBtnEnh::SetColorSurfaceNormal(LPDISPATCH propVal)
+{
+	SetProperty(0x6d, VT_DISPATCH, propVal);
+}
+
+CSurfaceColor CBtnEnh::GetColorSurfaceMO()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x6e, VT_DISPATCH, (void*)&pDispatch);
+	return CSurfaceColor(pDispatch);
+}
+
+void CBtnEnh::SetColorSurfaceMO(LPDISPATCH propVal)
+{
+	SetProperty(0x6e, VT_DISPATCH, propVal);
+}
+
+CSurfaceColor CBtnEnh::GetColorSurfaceInternal()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x6f, VT_DISPATCH, (void*)&pDispatch);
+	return CSurfaceColor(pDispatch);
+}
+
+void CBtnEnh::SetColorSurfaceInternal(LPDISPATCH propVal)
+{
+	SetProperty(0x6f, VT_DISPATCH, propVal);
+}
+
+CSurfaceColor CBtnEnh::GetColorSurfaceFocus()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x70, VT_DISPATCH, (void*)&pDispatch);
+	return CSurfaceColor(pDispatch);
+}
+
+void CBtnEnh::SetColorSurfaceFocus(LPDISPATCH propVal)
+{
+	SetProperty(0x70, VT_DISPATCH, propVal);
+}
+
+CSurfaceColor CBtnEnh::GetColorSurfaceDisabled()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x71, VT_DISPATCH, (void*)&pDispatch);
+	return CSurfaceColor(pDispatch);
+}
+
+void CBtnEnh::SetColorSurfaceDisabled(LPDISPATCH propVal)
+{
+	SetProperty(0x71, VT_DISPATCH, propVal);
+}
+
+CSurfaceColor CBtnEnh::GetColorSurfacePressed()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x72, VT_DISPATCH, (void*)&pDispatch);
+	return CSurfaceColor(pDispatch);
+}
+
+void CBtnEnh::SetColorSurfacePressed(LPDISPATCH propVal)
+{
+	SetProperty(0x72, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrCaption()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x73, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrCaption(LPDISPATCH propVal)
+{
+	SetProperty(0x73, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrLT()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x74, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrLT(LPDISPATCH propVal)
+{
+	SetProperty(0x74, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrCT()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x75, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrCT(LPDISPATCH propVal)
+{
+	SetProperty(0x75, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrRT()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x76, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrRT(LPDISPATCH propVal)
+{
+	SetProperty(0x76, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrLM()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x77, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrLM(LPDISPATCH propVal)
+{
+	SetProperty(0x77, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrRM()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x78, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrRM(LPDISPATCH propVal)
+{
+	SetProperty(0x78, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrLB()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x79, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrLB(LPDISPATCH propVal)
+{
+	SetProperty(0x79, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrCB()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x7a, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrCB(LPDISPATCH propVal)
+{
+	SetProperty(0x7a, VT_DISPATCH, propVal);
+}
+
+CTextDescriptor CBtnEnh::GetTextDescrRB()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x7b, VT_DISPATCH, (void*)&pDispatch);
+	return CTextDescriptor(pDispatch);
+}
+
+void CBtnEnh::SetTextDescrRB(LPDISPATCH propVal)
+{
+	SetProperty(0x7b, VT_DISPATCH, propVal);
+}
+
+CTexture CBtnEnh::GetTextureSurface()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0x7c, VT_DISPATCH, (void*)&pDispatch);
+	return CTexture(pDispatch);
+}
+
+void CBtnEnh::SetTextureSurface(LPDISPATCH propVal)
+{
+	SetProperty(0x7c, VT_DISPATCH, propVal);
+}
+
+long CBtnEnh::GetFrameEffect()
+{
+	long result;
+	GetProperty(0x7f, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetFrameEffect(long propVal)
+{
+	SetProperty(0x7f, VT_I4, propVal);
+}
+
+BOOL CBtnEnh::GetOptionGroupDelimiter()
+{
+	BOOL result;
+	GetProperty(0x80, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOptionGroupDelimiter(BOOL propVal)
+{
+	SetProperty(0x80, VT_BOOL, propVal);
+}
+
+BOOL CBtnEnh::GetPictureVisible()
+{
+	BOOL result;
+	GetProperty(0x83, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureVisible(BOOL propVal)
+{
+	SetProperty(0x83, VT_BOOL, propVal);
+}
+
+long CBtnEnh::GetTextCaptionAlignment()
+{
+	long result;
+	GetProperty(0x8c, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetTextCaptionAlignment(long propVal)
+{
+	SetProperty(0x8c, VT_I4, propVal);
+}
+
+short CBtnEnh::GetSpotlightOffsetX()
+{
+	short result;
+	GetProperty(0x8d, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpotlightOffsetX(short propVal)
+{
+	SetProperty(0x8d, VT_I2, propVal);
+}
+
+short CBtnEnh::GetSpotlightOffsetY()
+{
+	short result;
+	GetProperty(0x8e, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpotlightOffsetY(short propVal)
+{
+	SetProperty(0x8e, VT_I2, propVal);
+}
+
+short CBtnEnh::GetSpotlightResizeWidth()
+{
+	short result;
+	GetProperty(0x8f, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpotlightResizeWidth(short propVal)
+{
+	SetProperty(0x8f, VT_I2, propVal);
+}
+
+short CBtnEnh::GetSpotlightResizeHeight()
+{
+	short result;
+	GetProperty(0x90, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpotlightResizeHeight(short propVal)
+{
+	SetProperty(0x90, VT_I2, propVal);
+}
+
+short CBtnEnh::GetCornerFactor()
+{
+	short result;
+	GetProperty(0x91, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetCornerFactor(short propVal)
+{
+	SetProperty(0x91, VT_I2, propVal);
+}
+
+BOOL CBtnEnh::GetUseAntialias()
+{
+	BOOL result;
+	GetProperty(0x92, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetUseAntialias(BOOL propVal)
+{
+	SetProperty(0x92, VT_BOOL, propVal);
+}
+
+CCellsManager CBtnEnh::GetCellsManager()
+{
+	LPDISPATCH pDispatch;
+	GetProperty(0xab, VT_DISPATCH, (void*)&pDispatch);
+	return CCellsManager(pDispatch);
+}
+
+void CBtnEnh::SetCellsManager(LPDISPATCH propVal)
+{
+	SetProperty(0xab, VT_DISPATCH, propVal);
+}
+
+BOOL CBtnEnh::GetHollowFrame()
+{
+	BOOL result;
+	GetProperty(0xaf, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetHollowFrame(BOOL propVal)
+{
+	SetProperty(0xaf, VT_BOOL, propVal);
+}
+
+long CBtnEnh::GetLightDirection()
+{
+	long result;
+	GetProperty(0xb0, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetLightDirection(long propVal)
+{
+	SetProperty(0xb0, VT_I4, propVal);
+}
+
+BOOL CBtnEnh::GetSpotlightVisible()
+{
+	BOOL result;
+	GetProperty(0xb1, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpotlightVisible(BOOL propVal)
+{
+	SetProperty(0xb1, VT_BOOL, propVal);
+}
+
+unsigned long CBtnEnh::GetSpotlightColor()
+{
+	unsigned long result;
+	GetProperty(0xb2, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpotlightColor(unsigned long propVal)
+{
+	SetProperty(0xb2, VT_I4, propVal);
+}
+
+short CBtnEnh::GetPictureTranspFactor()
+{
+	short result;
+	GetProperty(0xb3, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureTranspFactor(short propVal)
+{
+	SetProperty(0xb3, VT_I2, propVal);
+}
+
+short CBtnEnh::GetShapeHeadFactor()
+{
+	short result;
+	GetProperty(0xb4, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetShapeHeadFactor(short propVal)
+{
+	SetProperty(0xb4, VT_I2, propVal);
+}
+
+short CBtnEnh::GetShapeLineFactor()
+{
+	short result;
+	GetProperty(0xb5, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetShapeLineFactor(short propVal)
+{
+	SetProperty(0xb5, VT_I2, propVal);
+}
+
+short CBtnEnh::GetSurfaceTransparentFactor()
+{
+	short result;
+	GetProperty(0xb8, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSurfaceTransparentFactor(short propVal)
+{
+	SetProperty(0xb8, VT_I2, propVal);
+}
+
+BOOL CBtnEnh::GetRectHardEdges()
+{
+	BOOL result;
+	GetProperty(0xbb, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetRectHardEdges(BOOL propVal)
+{
+	SetProperty(0xbb, VT_BOOL, propVal);
+}
+
+BOOL CBtnEnh::GetSwapEffectsColors()
+{
+	BOOL result;
+	GetProperty(0xbc, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSwapEffectsColors(BOOL propVal)
+{
+	SetProperty(0xbc, VT_BOOL, propVal);
+}
+
+long CBtnEnh::GetSurfaceTransparentZone()
+{
+	long result;
+	GetProperty(0xbd, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSurfaceTransparentZone(long propVal)
+{
+	SetProperty(0xbd, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlossyEffectUpper()
+{
+	unsigned long result;
+	GetProperty(0xc1, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlossyEffectUpper(unsigned long propVal)
+{
+	SetProperty(0xc1, VT_I4, propVal);
+}
+
+short CBtnEnh::GetVistaOpacityGlossyEffectUpper()
+{
+	short result;
+	GetProperty(0xc2, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaOpacityGlossyEffectUpper(short propVal)
+{
+	SetProperty(0xc2, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlossyEffectLower()
+{
+	unsigned long result;
+	GetProperty(0xc3, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlossyEffectLower(unsigned long propVal)
+{
+	SetProperty(0xc3, VT_I4, propVal);
+}
+
+short CBtnEnh::GetVistaOpacityGlossyEffectLower()
+{
+	short result;
+	GetProperty(0xc4, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaOpacityGlossyEffectLower(short propVal)
+{
+	SetProperty(0xc4, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorOuterBorder()
+{
+	unsigned long result;
+	GetProperty(0xc5, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorOuterBorder(unsigned long propVal)
+{
+	SetProperty(0xc5, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorInnerBorder()
+{
+	unsigned long result;
+	GetProperty(0xc6, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorInnerBorder(unsigned long propVal)
+{
+	SetProperty(0xc6, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorInnerBorderPressed()
+{
+	unsigned long result;
+	GetProperty(0xc7, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorInnerBorderPressed(unsigned long propVal)
+{
+	SetProperty(0xc7, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorMiddleBorder()
+{
+	unsigned long result;
+	GetProperty(0xc8, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorMiddleBorder(unsigned long propVal)
+{
+	SetProperty(0xc8, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlossyEmphUpper()
+{
+	unsigned long result;
+	GetProperty(0xc9, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlossyEmphUpper(unsigned long propVal)
+{
+	SetProperty(0xc9, VT_I4, propVal);
+}
+
+short CBtnEnh::GetVistaOpacityGlossyEmphUpper()
+{
+	short result;
+	GetProperty(0xca, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaOpacityGlossyEmphUpper(short propVal)
+{
+	SetProperty(0xca, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlossyEmphLower()
+{
+	unsigned long result;
+	GetProperty(0xcb, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlossyEmphLower(unsigned long propVal)
+{
+	SetProperty(0xcb, VT_I4, propVal);
+}
+
+short CBtnEnh::GetVistaOpacityGlossyEmphLower()
+{
+	short result;
+	GetProperty(0xcc, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaOpacityGlossyEmphLower(short propVal)
+{
+	SetProperty(0xcc, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlossyEmphUpperPressed()
+{
+	unsigned long result;
+	GetProperty(0xcd, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlossyEmphUpperPressed(unsigned long propVal)
+{
+	SetProperty(0xcd, VT_I4, propVal);
+}
+
+short CBtnEnh::GetVistaOpacityGlossyEmphUpperPressed()
+{
+	short result;
+	GetProperty(0xce, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaOpacityGlossyEmphUpperPressed(short propVal)
+{
+	SetProperty(0xce, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlossyEmphLowerPressed()
+{
+	unsigned long result;
+	GetProperty(0xcf, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlossyEmphLowerPressed(unsigned long propVal)
+{
+	SetProperty(0xcf, VT_I4, propVal);
+}
+
+short CBtnEnh::GetVistaOpacityGlossyEmphLowerPressed()
+{
+	short result;
+	GetProperty(0xd0, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaOpacityGlossyEmphLowerPressed(short propVal)
+{
+	SetProperty(0xd0, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlowBack()
+{
+	unsigned long result;
+	GetProperty(0xd1, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlowBack(unsigned long propVal)
+{
+	SetProperty(0xd1, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlow()
+{
+	unsigned long result;
+	GetProperty(0xd2, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlow(unsigned long propVal)
+{
+	SetProperty(0xd2, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlowChecked()
+{
+	unsigned long result;
+	GetProperty(0xd3, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlowChecked(unsigned long propVal)
+{
+	SetProperty(0xd3, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlowCheckedMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xd4, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlowCheckedMouseOver(unsigned long propVal)
+{
+	SetProperty(0xd4, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorBackgroundChecked()
+{
+	unsigned long result;
+	GetProperty(0xd5, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorBackgroundChecked(unsigned long propVal)
+{
+	SetProperty(0xd5, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorBackgroundCheckedMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xd6, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorBackgroundCheckedMouseOver(unsigned long propVal)
+{
+	SetProperty(0xd6, VT_I4, propVal);
+}
+
+long CBtnEnh::GetVistaLook()
+{
+	long result;
+	GetProperty(0xd7, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaLook(long propVal)
+{
+	SetProperty(0xd7, VT_I4, propVal);
+}
+
+long CBtnEnh::GetVistaGlossyShape()
+{
+	long result;
+	GetProperty(0xd8, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaGlossyShape(long propVal)
+{
+	SetProperty(0xd8, VT_I4, propVal);
+}
+
+short CBtnEnh::GetVistaGlossySmoothFactor()
+{
+	short result;
+	GetProperty(0xd9, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaGlossySmoothFactor(short propVal)
+{
+	SetProperty(0xd9, VT_I2, propVal);
+}
+
+long CBtnEnh::GetSpotlightType()
+{
+	long result;
+	GetProperty(0xda, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSpotlightType(long propVal)
+{
+	SetProperty(0xda, VT_I4, propVal);
+}
+
+BOOL CBtnEnh::GetPictureReflectivityEnabled()
+{
+	BOOL result;
+	GetProperty(0xdb, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureReflectivityEnabled(BOOL propVal)
+{
+	SetProperty(0xdb, VT_BOOL, propVal);
+}
+
+short CBtnEnh::GetPictureReflectivityPerc()
+{
+	short result;
+	GetProperty(0xdc, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureReflectivityPerc(short propVal)
+{
+	SetProperty(0xdc, VT_I2, propVal);
+}
+
+short CBtnEnh::GetPictureReflectHeightPerc()
+{
+	short result;
+	GetProperty(0xdd, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetPictureReflectHeightPerc(short propVal)
+{
+	SetProperty(0xdd, VT_I2, propVal);
+}
+
+long CBtnEnh::GetProgressBarType()
+{
+	long result;
+	GetProperty(0xdf, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetProgressBarType(long propVal)
+{
+	SetProperty(0xdf, VT_I4, propVal);
+}
+
+long CBtnEnh::GetProgressBarMin()
+{
+	long result;
+	GetProperty(0xe0, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetProgressBarMin(long propVal)
+{
+	SetProperty(0xe0, VT_I4, propVal);
+}
+
+long CBtnEnh::GetProgressBarMax()
+{
+	long result;
+	GetProperty(0xe1, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetProgressBarMax(long propVal)
+{
+	SetProperty(0xe1, VT_I4, propVal);
+}
+
+long CBtnEnh::GetProgressBarValue()
+{
+	long result;
+	GetProperty(0xe2, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetProgressBarValue(long propVal)
+{
+	SetProperty(0xe2, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetProgressBarColor()
+{
+	unsigned long result;
+	GetProperty(0xe3, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetProgressBarColor(unsigned long propVal)
+{
+	SetProperty(0xe3, VT_I4, propVal);
+}
+
+long CBtnEnh::GetProgressBarFillMode()
+{
+	long result;
+	GetProperty(0xe4, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetProgressBarFillMode(long propVal)
+{
+	SetProperty(0xe4, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetVistaColorGlowBottom()
+{
+	unsigned long result;
+	GetProperty(0xe5, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaColorGlowBottom(unsigned long propVal)
+{
+	SetProperty(0xe5, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorInnerBorder()
+{
+	unsigned long result;
+	GetProperty(0xe6, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorInnerBorder(unsigned long propVal)
+{
+	SetProperty(0xe6, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorOuterBorder()
+{
+	unsigned long result;
+	GetProperty(0xe7, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorOuterBorder(unsigned long propVal)
+{
+	SetProperty(0xe7, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorNorthTop()
+{
+	unsigned long result;
+	GetProperty(0xe8, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorNorthTop(unsigned long propVal)
+{
+	SetProperty(0xe8, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorNorthBottom()
+{
+	unsigned long result;
+	GetProperty(0xe9, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorNorthBottom(unsigned long propVal)
+{
+	SetProperty(0xe9, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorSouthTop()
+{
+	unsigned long result;
+	GetProperty(0xea, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorSouthTop(unsigned long propVal)
+{
+	SetProperty(0xea, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorSouthBottom()
+{
+	unsigned long result;
+	GetProperty(0xeb, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorSouthBottom(unsigned long propVal)
+{
+	SetProperty(0xeb, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorInnerBorderMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xec, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorInnerBorderMouseOver(unsigned long propVal)
+{
+	SetProperty(0xec, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorOuterBorderMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xed, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorOuterBorderMouseOver(unsigned long propVal)
+{
+	SetProperty(0xed, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorNorthTopMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xee, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorNorthTopMouseOver(unsigned long propVal)
+{
+	SetProperty(0xee, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorNorthBottomMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xef, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorNorthBottomMouseOver(unsigned long propVal)
+{
+	SetProperty(0xef, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorSouthTopMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xf0, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorSouthTopMouseOver(unsigned long propVal)
+{
+	SetProperty(0xf0, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorSouthBottomMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xf1, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorSouthBottomMouseOver(unsigned long propVal)
+{
+	SetProperty(0xf1, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorInnerBorderPressed()
+{
+	unsigned long result;
+	GetProperty(0xf2, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorInnerBorderPressed(unsigned long propVal)
+{
+	SetProperty(0xf2, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorOuterBorderPressed()
+{
+	unsigned long result;
+	GetProperty(0xf3, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorOuterBorderPressed(unsigned long propVal)
+{
+	SetProperty(0xf3, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorNorthTopPressed()
+{
+	unsigned long result;
+	GetProperty(0xf4, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorNorthTopPressed(unsigned long propVal)
+{
+	SetProperty(0xf4, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorNorthBottomPressed()
+{
+	unsigned long result;
+	GetProperty(0xf5, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorNorthBottomPressed(unsigned long propVal)
+{
+	SetProperty(0xf5, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorSouthTopPressed()
+{
+	unsigned long result;
+	GetProperty(0xf6, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorSouthTopPressed(unsigned long propVal)
+{
+	SetProperty(0xf6, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2007ColorSouthBottomPressed()
+{
+	unsigned long result;
+	GetProperty(0xf7, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007ColorSouthBottomPressed(unsigned long propVal)
+{
+	SetProperty(0xf7, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorNorth()
+{
+	unsigned long result;
+	GetProperty(0xf8, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorNorth(unsigned long propVal)
+{
+	SetProperty(0xf8, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorSouth()
+{
+	unsigned long result;
+	GetProperty(0xf9, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorSouth(unsigned long propVal)
+{
+	SetProperty(0xf9, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorBorder()
+{
+	unsigned long result;
+	GetProperty(0xfa, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorBorder(unsigned long propVal)
+{
+	SetProperty(0xfa, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorNorthMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xfb, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorNorthMouseOver(unsigned long propVal)
+{
+	SetProperty(0xfb, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorSouthMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xfc, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorSouthMouseOver(unsigned long propVal)
+{
+	SetProperty(0xfc, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorBorderMouseOver()
+{
+	unsigned long result;
+	GetProperty(0xfd, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorBorderMouseOver(unsigned long propVal)
+{
+	SetProperty(0xfd, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorNorthPressed()
+{
+	unsigned long result;
+	GetProperty(0xfe, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorNorthPressed(unsigned long propVal)
+{
+	SetProperty(0xfe, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorSouthPressed()
+{
+	unsigned long result;
+	GetProperty(0xff, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorSouthPressed(unsigned long propVal)
+{
+	SetProperty(0xff, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetOffice2003ColorBorderPressed()
+{
+	unsigned long result;
+	GetProperty(0x100, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003ColorBorderPressed(unsigned long propVal)
+{
+	SetProperty(0x100, VT_I4, propVal);
+}
+
+BOOL CBtnEnh::GetToolTipEnabled()
+{
+	BOOL result;
+	GetProperty(0x101, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetToolTipEnabled(BOOL propVal)
+{
+	SetProperty(0x101, VT_BOOL, propVal);
+}
+
+CString CBtnEnh::GetToolTipTextNormal()
+{
+	CString result;
+	GetProperty(0x102, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetToolTipTextNormal(LPCTSTR propVal)
+{
+	SetProperty(0x102, VT_BSTR, propVal);
+}
+
+CString CBtnEnh::GetToolTipTextChecked()
+{
+	CString result;
+	GetProperty(0x103, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetToolTipTextChecked(LPCTSTR propVal)
+{
+	SetProperty(0x103, VT_BSTR, propVal);
+}
+
+short CBtnEnh::GetVistaOuterBorderWidth()
+{
+	short result;
+	GetProperty(0x104, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaOuterBorderWidth(short propVal)
+{
+	SetProperty(0x104, VT_I2, propVal);
+}
+
+short CBtnEnh::GetVistaMiddleBorderWidth()
+{
+	short result;
+	GetProperty(0x105, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaMiddleBorderWidth(short propVal)
+{
+	SetProperty(0x105, VT_I2, propVal);
+}
+
+short CBtnEnh::GetVistaInnerBorderWidth()
+{
+	short result;
+	GetProperty(0x106, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetVistaInnerBorderWidth(short propVal)
+{
+	SetProperty(0x106, VT_I2, propVal);
+}
+
+short CBtnEnh::GetOffice2007OuterBorderWidth()
+{
+	short result;
+	GetProperty(0x107, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007OuterBorderWidth(short propVal)
+{
+	SetProperty(0x107, VT_I2, propVal);
+}
+
+short CBtnEnh::GetOffice2007InnerBorderWidth()
+{
+	short result;
+	GetProperty(0x108, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2007InnerBorderWidth(short propVal)
+{
+	SetProperty(0x108, VT_I2, propVal);
+}
+
+short CBtnEnh::GetOffice2003BorderWidth()
+{
+	short result;
+	GetProperty(0x109, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetOffice2003BorderWidth(short propVal)
+{
+	SetProperty(0x109, VT_I2, propVal);
+}
+
+CString CBtnEnh::GetSplitButtonPicture()
+{
+	CString result;
+	GetProperty(0x10a, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSplitButtonPicture(LPCTSTR propVal)
+{
+	SetProperty(0x10a, VT_BSTR, propVal);
+}
+
+long CBtnEnh::GetSplitButtonType()
+{
+	long result;
+	GetProperty(0x10b, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSplitButtonType(long propVal)
+{
+	SetProperty(0x10b, VT_I4, propVal);
+}
+
+short CBtnEnh::GetSplitButtonArrowOffsetX()
+{
+	short result;
+	GetProperty(0x10c, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSplitButtonArrowOffsetX(short propVal)
+{
+	SetProperty(0x10c, VT_I2, propVal);
+}
+
+short CBtnEnh::GetSplitButtonArrowOffsetY()
+{
+	short result;
+	GetProperty(0x10d, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSplitButtonArrowOffsetY(short propVal)
+{
+	SetProperty(0x10d, VT_I2, propVal);
+}
+
+unsigned long CBtnEnh::GetSplitButtonArrowColor()
+{
+	unsigned long result;
+	GetProperty(0x10e, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSplitButtonArrowColor(unsigned long propVal)
+{
+	SetProperty(0x10e, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetSplitButtonHighlightColor()
+{
+	unsigned long result;
+	GetProperty(0x10f, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSplitButtonHighlightColor(unsigned long propVal)
+{
+	SetProperty(0x10f, VT_I4, propVal);
+}
+
+unsigned long CBtnEnh::GetSplitButtonShadowColor()
+{
+	unsigned long result;
+	GetProperty(0x110, VT_I4, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSplitButtonShadowColor(unsigned long propVal)
+{
+	SetProperty(0x110, VT_I4, propVal);
+}
+
+short CBtnEnh::GetSplitButtonSizePerc()
+{
+	short result;
+	GetProperty(0x111, VT_I2, (void*)&result);
+	return result;
+}
+
+void CBtnEnh::SetSplitButtonSizePerc(short propVal)
+{
+	SetProperty(0x111, VT_I2, propVal);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CBtnEnh operations
+
+void CBtnEnh::SetAuxText(short position, LPCTSTR Text, unsigned long Color, unsigned long ColorMouseOver, short xOffset, short yOffset, short iEffect, short nFactor)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR VTS_I4 VTS_I4 VTS_I2 VTS_I2 VTS_I2 VTS_I2;
+	InvokeHelper(0x31, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 position, Text, Color, ColorMouseOver, xOffset, yOffset, iEffect, nFactor);
+}
+
+LPUNKNOWN CBtnEnh::GetControlPtr()
+{
+	LPUNKNOWN result;
+	InvokeHelper(0x32, DISPATCH_METHOD, VT_UNKNOWN, (void*)&result, NULL);
+	return result;
+}
+
+void CBtnEnh::EnableSound(short nSound, BOOL bEnable)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BOOL;
+	InvokeHelper(0x33, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nSound, bEnable);
+}
+
+void CBtnEnh::DoClick()
+{
+	InvokeHelper(DISPID_DOCLICK, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+}
+
+void CBtnEnh::Refresh()
+{
+	InvokeHelper(DISPID_REFRESH, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+}
+
+void CBtnEnh::SetNSContainerColor(unsigned long Color)
+{
+	static BYTE parms[] =
+		VTS_I4;
+	InvokeHelper(0x34, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 Color);
+}
+
+CString CBtnEnh::GetAuxText(short position, unsigned long* pcolor, unsigned long* pcolorMouseOver, short* pxOffset, short* pyOffset, short* piEffect, short* pnFactor)
+{
+	CString result;
+	static BYTE parms[] =
+		VTS_I2 VTS_PI4 VTS_PI4 VTS_PI2 VTS_PI2 VTS_PI2 VTS_PI2;
+	InvokeHelper(0x35, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,
+		position, pcolor, pcolorMouseOver, pxOffset, pyOffset, piEffect, pnFactor);
+	return result;
+}
+
+long CBtnEnh::SetPictureFromHandle(long index, long hBmp)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4 VTS_I4;
+	InvokeHelper(0x36, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		index, hBmp);
+	return result;
+}
+
+long CBtnEnh::SetPictureFromMemory(long index, const VARIANT& pData, long sizeData)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4 VTS_VARIANT VTS_I4;
+	InvokeHelper(0x37, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		index, &pData, sizeData);
+	return result;
+}
+
+long CBtnEnh::SetAnimFromMemory(long index, const VARIANT& pData, long sizeData)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4 VTS_VARIANT VTS_I4;
+	InvokeHelper(0x38, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		index, &pData, sizeData);
+	return result;
+}
+
+long CBtnEnh::SetCursorFromHandle(long hCursor)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4;
+	InvokeHelper(0x39, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		hCursor);
+	return result;
+}
+
+long CBtnEnh::SetSoundFromMemory(long index, const VARIANT& pData, long sizeData)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4 VTS_VARIANT VTS_I4;
+	InvokeHelper(0x3a, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		index, &pData, sizeData);
+	return result;
+}
+
+void CBtnEnh::SetAutomaticRefresh(BOOL bAutoRefresh)
+{
+	static BYTE parms[] =
+		VTS_BOOL;
+	InvokeHelper(0x3b, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 bAutoRefresh);
+}
+
+void CBtnEnh::SetSoundSync(long sound, BOOL flag)
+{
+	static BYTE parms[] =
+		VTS_I4 VTS_BOOL;
+	InvokeHelper(0x3c, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 sound, flag);
+}
+
+void CBtnEnh::EnableAcceleratorForVB()
+{
+	InvokeHelper(0x3d, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+}
+
+void CBtnEnh::SetTextVisible(short nText, BOOL bVisible)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BOOL;
+	InvokeHelper(0x3e, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nText, bVisible);
+}
+
+void CBtnEnh::SetCaptionText(LPCTSTR Text, unsigned long Color, unsigned long ColorMouseOver, short xOffset, short yOffset, short iEffect, short nFactor, short nAngle)
+{
+	static BYTE parms[] =
+		VTS_BSTR VTS_I4 VTS_I4 VTS_I2 VTS_I2 VTS_I2 VTS_I2 VTS_I2;
+	InvokeHelper(0x3f, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 Text, Color, ColorMouseOver, xOffset, yOffset, iEffect, nFactor, nAngle);
+}
+
+CString CBtnEnh::GetCaptionText(unsigned long* pcolor, unsigned long* pcolorMouseOver, short* pxOffset, short* pyOffset, short* piEffect, short* pnFactor, short* pnAngle)
+{
+	CString result;
+	static BYTE parms[] =
+		VTS_PI4 VTS_PI4 VTS_PI2 VTS_PI2 VTS_PI2 VTS_PI2 VTS_PI2;
+	InvokeHelper(0x40, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,
+		pcolor, pcolorMouseOver, pxOffset, pyOffset, piEffect, pnFactor, pnAngle);
+	return result;
+}
+
+long CBtnEnh::SetPictureFromNet(long index, LPCTSTR strAddress, LPCTSTR strUsername, LPCTSTR strPassword)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4 VTS_BSTR VTS_BSTR VTS_BSTR;
+	InvokeHelper(0x41, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		index, strAddress, strUsername, strPassword);
+	return result;
+}
+
+long CBtnEnh::SetSoundFromNet(long index, LPCTSTR strAddress, LPCTSTR strUsername, LPCTSTR strPassword)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4 VTS_BSTR VTS_BSTR VTS_BSTR;
+	InvokeHelper(0x42, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		index, strAddress, strUsername, strPassword);
+	return result;
+}
+
+BOOL CBtnEnh::SetAnimFromNet(long index, LPCTSTR strAddress, LPCTSTR strUsername, LPCTSTR strPassword)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I4 VTS_BSTR VTS_BSTR VTS_BSTR;
+	InvokeHelper(0x43, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		index, strAddress, strUsername, strPassword);
+	return result;
+}
+
+void CBtnEnh::SetSurfaceColor(short nElement, unsigned long Color, short nGradientFactor, short nRender3D)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4 VTS_I2 VTS_I2;
+	InvokeHelper(0x44, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nElement, Color, nGradientFactor, nRender3D);
+}
+
+void CBtnEnh::MouseCapture(BOOL bCapture)
+{
+	static BYTE parms[] =
+		VTS_BOOL;
+	InvokeHelper(0x45, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 bCapture);
+}
+
+void CBtnEnh::GetSurfaceColor(short nElement, unsigned long* pcolor, short* pnGradientFactor, short* pnRender3D)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_PI4 VTS_PI2 VTS_PI2;
+	InvokeHelper(0x46, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nElement, pcolor, pnGradientFactor, pnRender3D);
+}
+
+void CBtnEnh::InternalRefresh()
+{
+	InvokeHelper(0x47, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+}
+
+void CBtnEnh::SetAuxTextString(short position, LPCTSTR Text)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0x48, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 position, Text);
+}
+
+BOOL CBtnEnh::ExportBtnImage(long nImage, LPCTSTR strFilename, long nFormat)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I4 VTS_BSTR VTS_I4;
+	InvokeHelper(0x55, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nImage, strFilename, nFormat);
+	return result;
+}
+
+void CBtnEnh::EditProperties(unsigned long colorText, unsigned long colorBack, long x, long y)
+{
+	static BYTE parms[] =
+		VTS_I4 VTS_I4 VTS_I4 VTS_I4;
+	InvokeHelper(0x56, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 colorText, colorBack, x, y);
+}
+
+short CBtnEnh::LoadTemplate(LPCTSTR strFilename)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_BSTR;
+	InvokeHelper(0x59, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		strFilename);
+	return result;
+}
+
+short CBtnEnh::SaveTemplate(LPCTSTR strFilename)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_BSTR;
+	InvokeHelper(0x5a, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		strFilename);
+	return result;
+}
+
+short CBtnEnh::LoadTemplateEx(LPCTSTR strFilename)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_BSTR;
+	InvokeHelper(0x5b, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		strFilename);
+	return result;
+}
+
+short CBtnEnh::SaveTemplateEx(LPCTSTR strFilename)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_BSTR;
+	InvokeHelper(0x5c, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		strFilename);
+	return result;
+}
+
+void CBtnEnh::SetHelpLink(short nPage, LPCTSTR strLink)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0x5d, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nPage, strLink);
+}
+
+void CBtnEnh::ShowEditingButtons(short lFlags, short bShow)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I2;
+	InvokeHelper(0x5e, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 lFlags, bShow);
+}
+
+void CBtnEnh::SetTextOnPos(short position, LPCTSTR strText)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0x63, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 position, strText);
+}
+
+CString CBtnEnh::GetTextOnPos(short position)
+{
+	CString result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x64, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,
+		position);
+	return result;
+}
+
+void CBtnEnh::SetTextSettingOnPos(short position, long pdesc, short nFlag)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4 VTS_I2;
+	InvokeHelper(0x65, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 position, pdesc, nFlag);
+}
+
+void CBtnEnh::GetTextSettingOnPos(short position, long pdesc)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x66, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 position, pdesc);
+}
+
+void CBtnEnh::SetSurfaceColorDesc(short nElement, long pdesc)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x67, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nElement, pdesc);
+}
+
+void CBtnEnh::GetSurfaceColorDesc(short nElement, long pdesc)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x68, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nElement, pdesc);
+}
+
+void CBtnEnh::SetEditingTplMode(short nMode)
+{
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x6a, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nMode);
+}
+
+void CBtnEnh::SetTemplateBinDir(long nType, LPCTSTR strDirPath)
+{
+	static BYTE parms[] =
+		VTS_I4 VTS_BSTR;
+	InvokeHelper(0x6b, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nType, strDirPath);
+}
+
+CString CBtnEnh::GetHelperString(short dispid, short nValue)
+{
+	CString result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I2;
+	InvokeHelper(0x7d, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,
+		dispid, nValue);
+	return result;
+}
+
+void CBtnEnh::ResetProperties()
+{
+	InvokeHelper(0x7e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+}
+
+long CBtnEnh::GetBackPicture(long hWndDest)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4;
+	InvokeHelper(0x81, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		hWndDest);
+	return result;
+}
+
+void CBtnEnh::SetBackPicture(long hBitmap)
+{
+	static BYTE parms[] =
+		VTS_I4;
+	InvokeHelper(0x82, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 hBitmap);
+}
+
+short CBtnEnh::AnimGetFramesRate()
+{
+	short result;
+	InvokeHelper(0x84, DISPATCH_METHOD, VT_I2, (void*)&result, NULL);
+	return result;
+}
+
+long CBtnEnh::AnimSetFramesRate(short nRate)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x85, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nRate);
+	return result;
+}
+
+short CBtnEnh::AnimGetFramesCount()
+{
+	short result;
+	InvokeHelper(0x86, DISPATCH_METHOD, VT_I2, (void*)&result, NULL);
+	return result;
+}
+
+long CBtnEnh::AnimShowFrame(short nFrame)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x87, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nFrame);
+	return result;
+}
+
+long CBtnEnh::AnimPause()
+{
+	long result;
+	InvokeHelper(0x88, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+	return result;
+}
+
+long CBtnEnh::AnimResume()
+{
+	long result;
+	InvokeHelper(0x89, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+	return result;
+}
+
+long CBtnEnh::AnimInvertPlay()
+{
+	long result;
+	InvokeHelper(0x8a, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+	return result;
+}
+
+void CBtnEnh::SetBackPictureVisible(BOOL bVisible)
+{
+	static BYTE parms[] =
+		VTS_BOOL;
+	InvokeHelper(0x8b, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 bVisible);
+}
+
+void CBtnEnh::ClearButtonCache()
+{
+	InvokeHelper(0x93, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+}
+
+short CBtnEnh::GetValueEx()
+{
+	short result;
+	InvokeHelper(0x94, DISPATCH_METHOD, VT_I2, (void*)&result, NULL);
+	return result;
+}
+
+void CBtnEnh::SetValueEx(short nValue)
+{
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x95, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nValue);
+}
+
+short CBtnEnh::LoadTplExInternal(LPCTSTR strFilename, long cxMax, long cyMax, long* pcxOrig, long* pcyOrig)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_BSTR VTS_I4 VTS_I4 VTS_PI4 VTS_PI4;
+	InvokeHelper(0x96, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		strFilename, cxMax, cyMax, pcxOrig, pcyOrig);
+	return result;
+}
+
+short CBtnEnh::SaveTplExInternal(LPCTSTR strFilename, long cx, long cy)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_BSTR VTS_I4 VTS_I4;
+	InvokeHelper(0x97, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		strFilename, cx, cy);
+	return result;
+}
+
+short CBtnEnh::CellCreate(short left, short top, short width, short height)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I2 VTS_I2 VTS_I2;
+	InvokeHelper(0x98, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		left, top, width, height);
+	return result;
+}
+
+short CBtnEnh::CellGetCount()
+{
+	short result;
+	InvokeHelper(0x99, DISPATCH_METHOD, VT_I2, (void*)&result, NULL);
+	return result;
+}
+
+long CBtnEnh::CellDelete(short nIndex)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x9a, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex);
+	return result;
+}
+
+long CBtnEnh::CellShow(short nIndex, BOOL bShow)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_BOOL;
+	InvokeHelper(0x9b, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, bShow);
+	return result;
+}
+
+long CBtnEnh::CellMove(short nIndex, short left, short top)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I2 VTS_I2;
+	InvokeHelper(0x9c, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, left, top);
+	return result;
+}
+
+long CBtnEnh::CellResize(short nIndex, short width, short height)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I2 VTS_I2;
+	InvokeHelper(0x9d, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, width, height);
+	return result;
+}
+
+long CBtnEnh::CellSetText(short nIndex, LPCTSTR strText)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0x9e, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, strText);
+	return result;
+}
+
+CTextDescriptor CBtnEnh::CellGetTextDescriptor(short nIndex)
+{
+	LPDISPATCH pDispatch;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x9f, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch, parms,
+		nIndex);
+	return CTextDescriptor(pDispatch);
+}
+
+long CBtnEnh::CellSetTextFont(short nIndex, LPCTSTR strFacename, short nHeight, BOOL bBold, BOOL bItalic, BOOL bUnder, BOOL bStrike)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR VTS_I2 VTS_BOOL VTS_BOOL VTS_BOOL VTS_BOOL;
+	InvokeHelper(0xa0, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, strFacename, nHeight, bBold, bItalic, bUnder, bStrike);
+	return result;
+}
+
+long CBtnEnh::CellSetTextWordWrap(short nIndex, BOOL bWordWrap)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_BOOL;
+	InvokeHelper(0xa1, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, bWordWrap);
+	return result;
+}
+
+long CBtnEnh::CellSetTextHorzAlign(short nIndex, long nAlign)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0xa2, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, nAlign);
+	return result;
+}
+
+long CBtnEnh::CellSetTextVertAlign(short nIndex, long nAlign)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0xa3, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, nAlign);
+	return result;
+}
+
+long CBtnEnh::CellSetPicture(short nIndex, LPCTSTR strFilename)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0xa4, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, strFilename);
+	return result;
+}
+
+long CBtnEnh::CellSetPictureDisabled(short nIndex, LPCTSTR strFilename)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0xa5, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, strFilename);
+	return result;
+}
+
+long CBtnEnh::CellSetPictureHorzAlign(short nIndex, long nAlign)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0xa6, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, nAlign);
+	return result;
+}
+
+long CBtnEnh::CellSetPictureVertAlign(short nIndex, long nAlign)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0xa7, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, nAlign);
+	return result;
+}
+
+long CBtnEnh::CellSetPictureStatic(short nIndex, BOOL bStatic)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_BOOL;
+	InvokeHelper(0xa8, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, bStatic);
+	return result;
+}
+
+long CBtnEnh::CellSetTestMode(short nIndex, BOOL bTestMode)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2 VTS_BOOL;
+	InvokeHelper(0xa9, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nIndex, bTestMode);
+	return result;
+}
+
+long CBtnEnh::GetButtonCacheSize()
+{
+	long result;
+	InvokeHelper(0xaa, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+	return result;
+}
+
+short CBtnEnh::GetHelperStringsNum(short dispid)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0xac, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		dispid);
+	return result;
+}
+
+short CBtnEnh::LoadCellsInternal(LPCTSTR strFilename)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_BSTR;
+	InvokeHelper(0xad, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		strFilename);
+	return result;
+}
+
+short CBtnEnh::SaveCellsInternal(LPCTSTR strFilename)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_BSTR;
+	InvokeHelper(0xae, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		strFilename);
+	return result;
+}
+
+CString CBtnEnh::GetVersion()
+{
+	CString result;
+	InvokeHelper(0xb6, DISPATCH_METHOD, VT_BSTR, (void*)&result, NULL);
+	return result;
+}
+
+CString CBtnEnh::GetEdition()
+{
+	CString result;
+	InvokeHelper(0xb7, DISPATCH_METHOD, VT_BSTR, (void*)&result, NULL);
+	return result;
+}
+
+void CBtnEnh::SetTotalTransparentFactor(short nNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0xb9, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 nNewValue);
+}
+
+void CBtnEnh::RefreshTransparentControl()
+{
+	InvokeHelper(0xba, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+}
+
+void CBtnEnh::EnableButtonCache(BOOL bEnable)
+{
+	static BYTE parms[] =
+		VTS_BOOL;
+	InvokeHelper(0xbe, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 bEnable);
+}
+
+void CBtnEnh::SetCustomPaintFunction(long pFunction)
+{
+	static BYTE parms[] =
+		VTS_I4;
+	InvokeHelper(0xbf, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 pFunction);
+}
+
+void CBtnEnh::SetClipChildren(BOOL bSet)
+{
+	static BYTE parms[] =
+		VTS_BOOL;
+	InvokeHelper(0xc0, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
+		 bSet);
+}
+
+long CBtnEnh::GetControlBitmap(long nImage)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I4;
+	InvokeHelper(0xde, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
+		nImage);
+	return result;
+}
+
+void CBtnEnh::AboutBox()
+{
+	InvokeHelper(0xfffffdd8, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+}
diff --git a/ENRIT/UITool/btnenh.h b/ENRIT/UITool/btnenh.h
new file mode 100644
index 0000000..c6342b0
--- /dev/null
+++ b/ENRIT/UITool/btnenh.h
@@ -0,0 +1,526 @@
+#if !defined(AFX_BTNENH_H__56F13D02_8CDD_42E1_9A73_46B206613CA4__INCLUDED_)
+#define AFX_BTNENH_H__56F13D02_8CDD_42E1_9A73_46B206613CA4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+
+// Dispatch interfaces referenced by this interface
+class COleFont;
+class CSurfaceColor;
+class CTextDescriptor;
+class CTexture;
+class CCellsManager;
+
+/////////////////////////////////////////////////////////////////////////////
+// CBtnEnh wrapper class
+
+class CBtnEnh : public CWnd
+{
+protected:
+	DECLARE_DYNCREATE(CBtnEnh)
+public:
+	CLSID const& GetClsid()
+	{
+		static CLSID const clsid
+			= { 0x40b5ce81, 0xc5a8, 0x11d2, { 0x81, 0x83, 0x0, 0x0, 0x24, 0x40, 0xdf, 0xd8 } };
+		return clsid;
+	}
+	virtual BOOL Create(LPCTSTR lpszClassName,
+		LPCTSTR lpszWindowName, DWORD dwStyle,
+		const RECT& rect,
+		CWnd* pParentWnd, UINT nID,
+		CCreateContext* pContext = NULL)
+	{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }
+
+    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
+		const RECT& rect, CWnd* pParentWnd, UINT nID,
+		CFile* pPersist = NULL, BOOL bStorage = FALSE,
+		BSTR bstrLicKey = NULL)
+	{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
+		pPersist, bStorage, bstrLicKey); }
+
+// Attributes
+public:
+	CString GetCaption();
+	void SetCaption(LPCTSTR);
+	long GetShape();
+	void SetShape(long);
+	short GetRoundness();
+	void SetRoundness(short);
+	long GetSlant();
+	void SetSlant(long);
+	long GetSurface();
+	void SetSurface(long);
+	unsigned long GetPictureTranspColor();
+	void SetPictureTranspColor(unsigned long);
+	CString GetSoundDown();
+	void SetSoundDown(LPCTSTR);
+	CString GetSoundUp();
+	void SetSoundUp(LPCTSTR);
+	CString GetCursor();
+	void SetCursor(LPCTSTR);
+	CString GetSoundMouseOver();
+	void SetSoundMouseOver(LPCTSTR);
+	CString GetSoundMouseOut();
+	void SetSoundMouseOut(LPCTSTR);
+	COleFont GetFontTextLT();
+	void SetFontTextLT(LPDISPATCH);
+	COleFont GetFontTextCT();
+	void SetFontTextCT(LPDISPATCH);
+	COleFont GetFontTextRT();
+	void SetFontTextRT(LPDISPATCH);
+	COleFont GetFontTextLM();
+	void SetFontTextLM(LPDISPATCH);
+	COleFont GetFontTextRM();
+	void SetFontTextRM(LPDISPATCH);
+	COleFont GetFontTextLB();
+	void SetFontTextLB(LPDISPATCH);
+	COleFont GetFontTextCB();
+	void SetFontTextCB(LPDISPATCH);
+	COleFont GetFontTextRB();
+	void SetFontTextRB(LPDISPATCH);
+	CString GetPicture();
+	void SetPicture(LPCTSTR);
+	CString GetPicturePressed();
+	void SetPicturePressed(LPCTSTR);
+	CString GetPictureMouseOver();
+	void SetPictureMouseOver(LPCTSTR);
+	CString GetPictureCustom();
+	void SetPictureCustom(LPCTSTR);
+	long GetPicturePosition();
+	void SetPicturePosition(long);
+	short GetPictureXOffset();
+	void SetPictureXOffset(short);
+	short GetPictureYOffset();
+	void SetPictureYOffset(short);
+	BOOL GetEnabled();
+	void SetEnabled(BOOL);
+	long GetPictureTranspMode();
+	void SetPictureTranspMode(long);
+	BOOL GetButtonCustomRaised();
+	void SetButtonCustomRaised(BOOL);
+	unsigned long GetBackColorContainer();
+	void SetBackColorContainer(unsigned long);
+	BOOL GetMovePictureOnPress();
+	void SetMovePictureOnPress(BOOL);
+	short GetButtonRaiseFactor();
+	void SetButtonRaiseFactor(short);
+	unsigned long GetHighlightColor();
+	void SetHighlightColor(unsigned long);
+	unsigned long GetShadowColor();
+	void SetShadowColor(unsigned long);
+	BOOL GetButtonCustomFitPicture();
+	void SetButtonCustomFitPicture(BOOL);
+	OLE_HANDLE GetHWnd();
+	void SetHWnd(OLE_HANDLE);
+	COleFont GetFontTextCaption();
+	void SetFontTextCaption(LPDISPATCH);
+	CString GetHyperlink();
+	void SetHyperlink(LPCTSTR);
+	BOOL GetEnableInternetLoadAtDT();
+	void SetEnableInternetLoadAtDT(BOOL);
+	long GetSmoothEdges();
+	void SetSmoothEdges(long);
+	CString GetTagEx();
+	void SetTagEx(LPCTSTR);
+	BOOL GetPictureKeepRatio();
+	void SetPictureKeepRatio(BOOL);
+	long GetFocusMode();
+	void SetFocusMode(long);
+	long GetSpecialEffect();
+	void SetSpecialEffect(long);
+	short GetCaptionWordWrapPerc();
+	void SetCaptionWordWrapPerc(short);
+	short GetOptimization();
+	void SetOptimization(short);
+	BOOL GetClickable();
+	void SetClickable(BOOL);
+	unsigned long GetBackColor();
+	void SetBackColor(unsigned long);
+	unsigned long GetForeColor();
+	void SetForeColor(unsigned long);
+	BOOL GetIgnoreSpaceBar();
+	void SetIgnoreSpaceBar(BOOL);
+	long GetSpecialEffectFactor();
+	void SetSpecialEffectFactor(long);
+	CString GetTexture();
+	void SetTexture(LPCTSTR);
+	short GetTextureMode();
+	void SetTextureMode(short);
+	short GetTextureLightIntensity();
+	void SetTextureLightIntensity(short);
+	unsigned long GetTextureColorMix();
+	void SetTextureColorMix(unsigned long);
+	short GetTextureColorMixPerc();
+	void SetTextureColorMixPerc(short);
+	short GetTextureBevelFactor();
+	void SetTextureBevelFactor(short);
+	unsigned long GetForeColorDisabled();
+	void SetForeColorDisabled(unsigned long);
+	unsigned long GetBackColorDisabled();
+	void SetBackColorDisabled(unsigned long);
+	unsigned long GetBackColorMouseOver();
+	void SetBackColorMouseOver(unsigned long);
+	unsigned long GetBackColorFocus();
+	void SetBackColorFocus(unsigned long);
+	unsigned long GetBackColorInterior();
+	void SetBackColorInterior(unsigned long);
+	unsigned long GetForeColorMouseOver();
+	void SetForeColorMouseOver(unsigned long);
+	long GetFlatPillowFactor();
+	void SetFlatPillowFactor(long);
+	long GetShadowMode();
+	void SetShadowMode(long);
+	long GetStyle();
+	void SetStyle(long);
+	CString GetPictureDisabled();
+	void SetPictureDisabled(LPCTSTR);
+	unsigned long GetForeColorPressed();
+	void SetForeColorPressed(unsigned long);
+	unsigned long GetBackColorPressed();
+	void SetBackColorPressed(unsigned long);
+	short GetValue();
+	void SetValue(short);
+	long GetOrientation();
+	void SetOrientation(long);
+	CSurfaceColor GetColorSurfaceNormal();
+	void SetColorSurfaceNormal(LPDISPATCH);
+	CSurfaceColor GetColorSurfaceMO();
+	void SetColorSurfaceMO(LPDISPATCH);
+	CSurfaceColor GetColorSurfaceInternal();
+	void SetColorSurfaceInternal(LPDISPATCH);
+	CSurfaceColor GetColorSurfaceFocus();
+	void SetColorSurfaceFocus(LPDISPATCH);
+	CSurfaceColor GetColorSurfaceDisabled();
+	void SetColorSurfaceDisabled(LPDISPATCH);
+	CSurfaceColor GetColorSurfacePressed();
+	void SetColorSurfacePressed(LPDISPATCH);
+	CTextDescriptor GetTextDescrCaption();
+	void SetTextDescrCaption(LPDISPATCH);
+	CTextDescriptor GetTextDescrLT();
+	void SetTextDescrLT(LPDISPATCH);
+	CTextDescriptor GetTextDescrCT();
+	void SetTextDescrCT(LPDISPATCH);
+	CTextDescriptor GetTextDescrRT();
+	void SetTextDescrRT(LPDISPATCH);
+	CTextDescriptor GetTextDescrLM();
+	void SetTextDescrLM(LPDISPATCH);
+	CTextDescriptor GetTextDescrRM();
+	void SetTextDescrRM(LPDISPATCH);
+	CTextDescriptor GetTextDescrLB();
+	void SetTextDescrLB(LPDISPATCH);
+	CTextDescriptor GetTextDescrCB();
+	void SetTextDescrCB(LPDISPATCH);
+	CTextDescriptor GetTextDescrRB();
+	void SetTextDescrRB(LPDISPATCH);
+	CTexture GetTextureSurface();
+	void SetTextureSurface(LPDISPATCH);
+	long GetFrameEffect();
+	void SetFrameEffect(long);
+	BOOL GetOptionGroupDelimiter();
+	void SetOptionGroupDelimiter(BOOL);
+	BOOL GetPictureVisible();
+	void SetPictureVisible(BOOL);
+	long GetTextCaptionAlignment();
+	void SetTextCaptionAlignment(long);
+	short GetSpotlightOffsetX();
+	void SetSpotlightOffsetX(short);
+	short GetSpotlightOffsetY();
+	void SetSpotlightOffsetY(short);
+	short GetSpotlightResizeWidth();
+	void SetSpotlightResizeWidth(short);
+	short GetSpotlightResizeHeight();
+	void SetSpotlightResizeHeight(short);
+	short GetCornerFactor();
+	void SetCornerFactor(short);
+	BOOL GetUseAntialias();
+	void SetUseAntialias(BOOL);
+	CCellsManager GetCellsManager();
+	void SetCellsManager(LPDISPATCH);
+	BOOL GetHollowFrame();
+	void SetHollowFrame(BOOL);
+	long GetLightDirection();
+	void SetLightDirection(long);
+	BOOL GetSpotlightVisible();
+	void SetSpotlightVisible(BOOL);
+	unsigned long GetSpotlightColor();
+	void SetSpotlightColor(unsigned long);
+	short GetPictureTranspFactor();
+	void SetPictureTranspFactor(short);
+	short GetShapeHeadFactor();
+	void SetShapeHeadFactor(short);
+	short GetShapeLineFactor();
+	void SetShapeLineFactor(short);
+	short GetSurfaceTransparentFactor();
+	void SetSurfaceTransparentFactor(short);
+	BOOL GetRectHardEdges();
+	void SetRectHardEdges(BOOL);
+	BOOL GetSwapEffectsColors();
+	void SetSwapEffectsColors(BOOL);
+	long GetSurfaceTransparentZone();
+	void SetSurfaceTransparentZone(long);
+	unsigned long GetVistaColorGlossyEffectUpper();
+	void SetVistaColorGlossyEffectUpper(unsigned long);
+	short GetVistaOpacityGlossyEffectUpper();
+	void SetVistaOpacityGlossyEffectUpper(short);
+	unsigned long GetVistaColorGlossyEffectLower();
+	void SetVistaColorGlossyEffectLower(unsigned long);
+	short GetVistaOpacityGlossyEffectLower();
+	void SetVistaOpacityGlossyEffectLower(short);
+	unsigned long GetVistaColorOuterBorder();
+	void SetVistaColorOuterBorder(unsigned long);
+	unsigned long GetVistaColorInnerBorder();
+	void SetVistaColorInnerBorder(unsigned long);
+	unsigned long GetVistaColorInnerBorderPressed();
+	void SetVistaColorInnerBorderPressed(unsigned long);
+	unsigned long GetVistaColorMiddleBorder();
+	void SetVistaColorMiddleBorder(unsigned long);
+	unsigned long GetVistaColorGlossyEmphUpper();
+	void SetVistaColorGlossyEmphUpper(unsigned long);
+	short GetVistaOpacityGlossyEmphUpper();
+	void SetVistaOpacityGlossyEmphUpper(short);
+	unsigned long GetVistaColorGlossyEmphLower();
+	void SetVistaColorGlossyEmphLower(unsigned long);
+	short GetVistaOpacityGlossyEmphLower();
+	void SetVistaOpacityGlossyEmphLower(short);
+	unsigned long GetVistaColorGlossyEmphUpperPressed();
+	void SetVistaColorGlossyEmphUpperPressed(unsigned long);
+	short GetVistaOpacityGlossyEmphUpperPressed();
+	void SetVistaOpacityGlossyEmphUpperPressed(short);
+	unsigned long GetVistaColorGlossyEmphLowerPressed();
+	void SetVistaColorGlossyEmphLowerPressed(unsigned long);
+	short GetVistaOpacityGlossyEmphLowerPressed();
+	void SetVistaOpacityGlossyEmphLowerPressed(short);
+	unsigned long GetVistaColorGlowBack();
+	void SetVistaColorGlowBack(unsigned long);
+	unsigned long GetVistaColorGlow();
+	void SetVistaColorGlow(unsigned long);
+	unsigned long GetVistaColorGlowChecked();
+	void SetVistaColorGlowChecked(unsigned long);
+	unsigned long GetVistaColorGlowCheckedMouseOver();
+	void SetVistaColorGlowCheckedMouseOver(unsigned long);
+	unsigned long GetVistaColorBackgroundChecked();
+	void SetVistaColorBackgroundChecked(unsigned long);
+	unsigned long GetVistaColorBackgroundCheckedMouseOver();
+	void SetVistaColorBackgroundCheckedMouseOver(unsigned long);
+	long GetVistaLook();
+	void SetVistaLook(long);
+	long GetVistaGlossyShape();
+	void SetVistaGlossyShape(long);
+	short GetVistaGlossySmoothFactor();
+	void SetVistaGlossySmoothFactor(short);
+	long GetSpotlightType();
+	void SetSpotlightType(long);
+	BOOL GetPictureReflectivityEnabled();
+	void SetPictureReflectivityEnabled(BOOL);
+	short GetPictureReflectivityPerc();
+	void SetPictureReflectivityPerc(short);
+	short GetPictureReflectHeightPerc();
+	void SetPictureReflectHeightPerc(short);
+	long GetProgressBarType();
+	void SetProgressBarType(long);
+	long GetProgressBarMin();
+	void SetProgressBarMin(long);
+	long GetProgressBarMax();
+	void SetProgressBarMax(long);
+	long GetProgressBarValue();
+	void SetProgressBarValue(long);
+	unsigned long GetProgressBarColor();
+	void SetProgressBarColor(unsigned long);
+	long GetProgressBarFillMode();
+	void SetProgressBarFillMode(long);
+	unsigned long GetVistaColorGlowBottom();
+	void SetVistaColorGlowBottom(unsigned long);
+	unsigned long GetOffice2007ColorInnerBorder();
+	void SetOffice2007ColorInnerBorder(unsigned long);
+	unsigned long GetOffice2007ColorOuterBorder();
+	void SetOffice2007ColorOuterBorder(unsigned long);
+	unsigned long GetOffice2007ColorNorthTop();
+	void SetOffice2007ColorNorthTop(unsigned long);
+	unsigned long GetOffice2007ColorNorthBottom();
+	void SetOffice2007ColorNorthBottom(unsigned long);
+	unsigned long GetOffice2007ColorSouthTop();
+	void SetOffice2007ColorSouthTop(unsigned long);
+	unsigned long GetOffice2007ColorSouthBottom();
+	void SetOffice2007ColorSouthBottom(unsigned long);
+	unsigned long GetOffice2007ColorInnerBorderMouseOver();
+	void SetOffice2007ColorInnerBorderMouseOver(unsigned long);
+	unsigned long GetOffice2007ColorOuterBorderMouseOver();
+	void SetOffice2007ColorOuterBorderMouseOver(unsigned long);
+	unsigned long GetOffice2007ColorNorthTopMouseOver();
+	void SetOffice2007ColorNorthTopMouseOver(unsigned long);
+	unsigned long GetOffice2007ColorNorthBottomMouseOver();
+	void SetOffice2007ColorNorthBottomMouseOver(unsigned long);
+	unsigned long GetOffice2007ColorSouthTopMouseOver();
+	void SetOffice2007ColorSouthTopMouseOver(unsigned long);
+	unsigned long GetOffice2007ColorSouthBottomMouseOver();
+	void SetOffice2007ColorSouthBottomMouseOver(unsigned long);
+	unsigned long GetOffice2007ColorInnerBorderPressed();
+	void SetOffice2007ColorInnerBorderPressed(unsigned long);
+	unsigned long GetOffice2007ColorOuterBorderPressed();
+	void SetOffice2007ColorOuterBorderPressed(unsigned long);
+	unsigned long GetOffice2007ColorNorthTopPressed();
+	void SetOffice2007ColorNorthTopPressed(unsigned long);
+	unsigned long GetOffice2007ColorNorthBottomPressed();
+	void SetOffice2007ColorNorthBottomPressed(unsigned long);
+	unsigned long GetOffice2007ColorSouthTopPressed();
+	void SetOffice2007ColorSouthTopPressed(unsigned long);
+	unsigned long GetOffice2007ColorSouthBottomPressed();
+	void SetOffice2007ColorSouthBottomPressed(unsigned long);
+	unsigned long GetOffice2003ColorNorth();
+	void SetOffice2003ColorNorth(unsigned long);
+	unsigned long GetOffice2003ColorSouth();
+	void SetOffice2003ColorSouth(unsigned long);
+	unsigned long GetOffice2003ColorBorder();
+	void SetOffice2003ColorBorder(unsigned long);
+	unsigned long GetOffice2003ColorNorthMouseOver();
+	void SetOffice2003ColorNorthMouseOver(unsigned long);
+	unsigned long GetOffice2003ColorSouthMouseOver();
+	void SetOffice2003ColorSouthMouseOver(unsigned long);
+	unsigned long GetOffice2003ColorBorderMouseOver();
+	void SetOffice2003ColorBorderMouseOver(unsigned long);
+	unsigned long GetOffice2003ColorNorthPressed();
+	void SetOffice2003ColorNorthPressed(unsigned long);
+	unsigned long GetOffice2003ColorSouthPressed();
+	void SetOffice2003ColorSouthPressed(unsigned long);
+	unsigned long GetOffice2003ColorBorderPressed();
+	void SetOffice2003ColorBorderPressed(unsigned long);
+	BOOL GetToolTipEnabled();
+	void SetToolTipEnabled(BOOL);
+	CString GetToolTipTextNormal();
+	void SetToolTipTextNormal(LPCTSTR);
+	CString GetToolTipTextChecked();
+	void SetToolTipTextChecked(LPCTSTR);
+	short GetVistaOuterBorderWidth();
+	void SetVistaOuterBorderWidth(short);
+	short GetVistaMiddleBorderWidth();
+	void SetVistaMiddleBorderWidth(short);
+	short GetVistaInnerBorderWidth();
+	void SetVistaInnerBorderWidth(short);
+	short GetOffice2007OuterBorderWidth();
+	void SetOffice2007OuterBorderWidth(short);
+	short GetOffice2007InnerBorderWidth();
+	void SetOffice2007InnerBorderWidth(short);
+	short GetOffice2003BorderWidth();
+	void SetOffice2003BorderWidth(short);
+	CString GetSplitButtonPicture();
+	void SetSplitButtonPicture(LPCTSTR);
+	long GetSplitButtonType();
+	void SetSplitButtonType(long);
+	short GetSplitButtonArrowOffsetX();
+	void SetSplitButtonArrowOffsetX(short);
+	short GetSplitButtonArrowOffsetY();
+	void SetSplitButtonArrowOffsetY(short);
+	unsigned long GetSplitButtonArrowColor();
+	void SetSplitButtonArrowColor(unsigned long);
+	unsigned long GetSplitButtonHighlightColor();
+	void SetSplitButtonHighlightColor(unsigned long);
+	unsigned long GetSplitButtonShadowColor();
+	void SetSplitButtonShadowColor(unsigned long);
+	short GetSplitButtonSizePerc();
+	void SetSplitButtonSizePerc(short);
+
+// Operations
+public:
+	void SetAuxText(short position, LPCTSTR Text, unsigned long Color, unsigned long ColorMouseOver, short xOffset, short yOffset, short iEffect, short nFactor);
+	LPUNKNOWN GetControlPtr();
+	void EnableSound(short nSound, BOOL bEnable);
+	void DoClick();
+	void Refresh();
+	void SetNSContainerColor(unsigned long Color);
+	CString GetAuxText(short position, unsigned long* pcolor, unsigned long* pcolorMouseOver, short* pxOffset, short* pyOffset, short* piEffect, short* pnFactor);
+	long SetPictureFromHandle(long index, long hBmp);
+	long SetPictureFromMemory(long index, const VARIANT& pData, long sizeData);
+	long SetAnimFromMemory(long index, const VARIANT& pData, long sizeData);
+	long SetCursorFromHandle(long hCursor);
+	long SetSoundFromMemory(long index, const VARIANT& pData, long sizeData);
+	void SetAutomaticRefresh(BOOL bAutoRefresh);
+	void SetSoundSync(long sound, BOOL flag);
+	void EnableAcceleratorForVB();
+	void SetTextVisible(short nText, BOOL bVisible);
+	void SetCaptionText(LPCTSTR Text, unsigned long Color, unsigned long ColorMouseOver, short xOffset, short yOffset, short iEffect, short nFactor, short nAngle);
+	CString GetCaptionText(unsigned long* pcolor, unsigned long* pcolorMouseOver, short* pxOffset, short* pyOffset, short* piEffect, short* pnFactor, short* pnAngle);
+	long SetPictureFromNet(long index, LPCTSTR strAddress, LPCTSTR strUsername, LPCTSTR strPassword);
+	long SetSoundFromNet(long index, LPCTSTR strAddress, LPCTSTR strUsername, LPCTSTR strPassword);
+	BOOL SetAnimFromNet(long index, LPCTSTR strAddress, LPCTSTR strUsername, LPCTSTR strPassword);
+	void SetSurfaceColor(short nElement, unsigned long Color, short nGradientFactor, short nRender3D);
+	void MouseCapture(BOOL bCapture);
+	void GetSurfaceColor(short nElement, unsigned long* pcolor, short* pnGradientFactor, short* pnRender3D);
+	void InternalRefresh();
+	void SetAuxTextString(short position, LPCTSTR Text);
+	BOOL ExportBtnImage(long nImage, LPCTSTR strFilename, long nFormat);
+	void EditProperties(unsigned long colorText, unsigned long colorBack, long x, long y);
+	short LoadTemplate(LPCTSTR strFilename);
+	short SaveTemplate(LPCTSTR strFilename);
+	short LoadTemplateEx(LPCTSTR strFilename);
+	short SaveTemplateEx(LPCTSTR strFilename);
+	void SetHelpLink(short nPage, LPCTSTR strLink);
+	void ShowEditingButtons(short lFlags, short bShow);
+	void SetTextOnPos(short position, LPCTSTR strText);
+	CString GetTextOnPos(short position);
+	void SetTextSettingOnPos(short position, long pdesc, short nFlag);
+	void GetTextSettingOnPos(short position, long pdesc);
+	void SetSurfaceColorDesc(short nElement, long pdesc);
+	void GetSurfaceColorDesc(short nElement, long pdesc);
+	void SetEditingTplMode(short nMode);
+	void SetTemplateBinDir(long nType, LPCTSTR strDirPath);
+	CString GetHelperString(short dispid, short nValue);
+	void ResetProperties();
+	long GetBackPicture(long hWndDest);
+	void SetBackPicture(long hBitmap);
+	short AnimGetFramesRate();
+	long AnimSetFramesRate(short nRate);
+	short AnimGetFramesCount();
+	long AnimShowFrame(short nFrame);
+	long AnimPause();
+	long AnimResume();
+	long AnimInvertPlay();
+	void SetBackPictureVisible(BOOL bVisible);
+	void ClearButtonCache();
+	short GetValueEx();
+	void SetValueEx(short nValue);
+	short LoadTplExInternal(LPCTSTR strFilename, long cxMax, long cyMax, long* pcxOrig, long* pcyOrig);
+	short SaveTplExInternal(LPCTSTR strFilename, long cx, long cy);
+	short CellCreate(short left, short top, short width, short height);
+	short CellGetCount();
+	long CellDelete(short nIndex);
+	long CellShow(short nIndex, BOOL bShow);
+	long CellMove(short nIndex, short left, short top);
+	long CellResize(short nIndex, short width, short height);
+	long CellSetText(short nIndex, LPCTSTR strText);
+	CTextDescriptor CellGetTextDescriptor(short nIndex);
+	long CellSetTextFont(short nIndex, LPCTSTR strFacename, short nHeight, BOOL bBold, BOOL bItalic, BOOL bUnder, BOOL bStrike);
+	long CellSetTextWordWrap(short nIndex, BOOL bWordWrap);
+	long CellSetTextHorzAlign(short nIndex, long nAlign);
+	long CellSetTextVertAlign(short nIndex, long nAlign);
+	long CellSetPicture(short nIndex, LPCTSTR strFilename);
+	long CellSetPictureDisabled(short nIndex, LPCTSTR strFilename);
+	long CellSetPictureHorzAlign(short nIndex, long nAlign);
+	long CellSetPictureVertAlign(short nIndex, long nAlign);
+	long CellSetPictureStatic(short nIndex, BOOL bStatic);
+	long CellSetTestMode(short nIndex, BOOL bTestMode);
+	long GetButtonCacheSize();
+	short GetHelperStringsNum(short dispid);
+	short LoadCellsInternal(LPCTSTR strFilename);
+	short SaveCellsInternal(LPCTSTR strFilename);
+	CString GetVersion();
+	CString GetEdition();
+	void SetTotalTransparentFactor(short nNewValue);
+	void RefreshTransparentControl();
+	void EnableButtonCache(BOOL bEnable);
+	void SetCustomPaintFunction(long pFunction);
+	void SetClipChildren(BOOL bSet);
+	long GetControlBitmap(long nImage);
+	void AboutBox();
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_BTNENH_H__56F13D02_8CDD_42E1_9A73_46B206613CA4__INCLUDED_)
diff --git a/ENRIT/UITool/cellsmanager.cpp b/ENRIT/UITool/cellsmanager.cpp
new file mode 100644
index 0000000..54e3cc3
--- /dev/null
+++ b/ENRIT/UITool/cellsmanager.cpp
@@ -0,0 +1,498 @@
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+
+#include "stdafx.h"
+#include "cellsmanager.h"
+
+// Dispatch interfaces referenced by this interface
+#include "TextDescriptor.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CCellsManager properties
+
+long CCellsManager::GetScaleUnit()
+{
+	long result;
+	GetProperty(0x1c, VT_I4, (void*)&result);
+	return result;
+}
+
+void CCellsManager::SetScaleUnit(long propVal)
+{
+	SetProperty(0x1c, VT_I4, propVal);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CCellsManager operations
+
+BOOL CCellsManager::AddCell(short nUniqueID, short nPercLeft, short nPercTop, short nPercWidth, short nPercHeight, LPCTSTR strText)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I2 VTS_I2 VTS_I2 VTS_I2 VTS_BSTR;
+	InvokeHelper(0x1, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, nPercLeft, nPercTop, nPercWidth, nPercHeight, strText);
+	return result;
+}
+
+BOOL CCellsManager::DeleteCell(short nUniqueID)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x2, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+short CCellsManager::GetCount()
+{
+	short result;
+	InvokeHelper(0x3, DISPATCH_METHOD, VT_I2, (void*)&result, NULL);
+	return result;
+}
+
+BOOL CCellsManager::FindCell(short nUniqueID)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x4, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+BOOL CCellsManager::GetLogFont(short nUniqueID, long pLogFont)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x5, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, pLogFont);
+	return result;
+}
+
+BOOL CCellsManager::SetLogFont(short nUniqueID, long pLogFont)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x6, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, pLogFont);
+	return result;
+}
+
+short CCellsManager::GetCellUniqueID(short nPosition)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x7, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		nPosition);
+	return result;
+}
+
+BOOL CCellsManager::GetCellPos(short nUniqueID, short* pPercLeft, short* pPercTop)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_PI2 VTS_PI2;
+	InvokeHelper(0x8, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, pPercLeft, pPercTop);
+	return result;
+}
+
+BOOL CCellsManager::SetCellPos(short nUniqueID, short nPercLeft, short nPercTop)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I2 VTS_I2;
+	InvokeHelper(0x9, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, nPercLeft, nPercTop);
+	return result;
+}
+
+BOOL CCellsManager::GetCellSize(short nUniqueID, short* pPercWidth, short* pPercHeight)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_PI2 VTS_PI2;
+	InvokeHelper(0xa, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, pPercWidth, pPercHeight);
+	return result;
+}
+
+BOOL CCellsManager::SetCellSize(short nUniqueID, short nPercWidth, short nPercHeight)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I2 VTS_I2;
+	InvokeHelper(0xb, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, nPercWidth, nPercHeight);
+	return result;
+}
+
+CString CCellsManager::GetInternalDib(short nUniqueID, short nPicture)
+{
+	CString result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I2;
+	InvokeHelper(0xc, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,
+		nUniqueID, nPicture);
+	return result;
+}
+
+BOOL CCellsManager::SetPictureFromHandle(short nUniqueID, long nPicture, long nHandle)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4 VTS_I4;
+	InvokeHelper(0xd, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, nPicture, nHandle);
+	return result;
+}
+
+BOOL CCellsManager::GetVisible(short nUniqueID)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0xe, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetVisible(short nUniqueID, BOOL bNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BOOL;
+	InvokeHelper(0xe, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, bNewValue);
+}
+
+CString CCellsManager::GetText(short nUniqueID)
+{
+	CString result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0xf, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetText(short nUniqueID, LPCTSTR lpszNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0xf, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, lpszNewValue);
+}
+
+CTextDescriptor CCellsManager::GetTextDescriptor(short nUniqueID)
+{
+	LPDISPATCH pDispatch;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x10, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, parms,
+		nUniqueID);
+	return CTextDescriptor(pDispatch);
+}
+
+void CCellsManager::SetPictureNormal(short nUniqueID, LPCTSTR lpszNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0x11, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, lpszNewValue);
+}
+
+long CCellsManager::GetTextHorzAlign(short nUniqueID)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x12, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetTextHorzAlign(short nUniqueID, long nNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x12, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, nNewValue);
+}
+
+long CCellsManager::GetTextVertAlign(short nUniqueID)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x13, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetTextVertAlign(short nUniqueID, long nNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x13, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, nNewValue);
+}
+
+long CCellsManager::GetPictureHorzAlign(short nUniqueID)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x14, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetPictureHorzAlign(short nUniqueID, long nNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x14, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, nNewValue);
+}
+
+long CCellsManager::GetPictureVertAlign(short nUniqueID)
+{
+	long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x15, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetPictureVertAlign(short nUniqueID, long nNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x15, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, nNewValue);
+}
+
+unsigned long CCellsManager::GetBackColor(short nUniqueID)
+{
+	unsigned long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x16, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetBackColor(short nUniqueID, unsigned long newValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x16, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, newValue);
+}
+
+unsigned long CCellsManager::GetBorderColor(short nUniqueID)
+{
+	unsigned long result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x17, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetBorderColor(short nUniqueID, unsigned long newValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x17, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, newValue);
+}
+
+short CCellsManager::GetBorderWidth(short nUniqueID)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x18, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetBorderWidth(short nUniqueID, short nNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I2;
+	InvokeHelper(0x18, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, nNewValue);
+}
+
+void CCellsManager::SetPictureDisabled(short nUniqueID, LPCTSTR lpszNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_BSTR;
+	InvokeHelper(0x19, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, lpszNewValue);
+}
+
+short CCellsManager::GetPictureTranspFactor(short nUniqueID)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x1a, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetPictureTranspFactor(short nUniqueID, short nNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I2;
+	InvokeHelper(0x1a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, nNewValue);
+}
+
+short CCellsManager::GetBackTranspFactor(short nUniqueID)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x1b, DISPATCH_PROPERTYGET, VT_I2, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+void CCellsManager::SetBackTranspFactor(short nUniqueID, short nNewValue)
+{
+	static BYTE parms[] =
+		VTS_I2 VTS_I2;
+	InvokeHelper(0x1b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
+		 nUniqueID, nNewValue);
+}
+
+BOOL CCellsManager::CellAdd(short nUniqueID, float fPosLeft, float fPosTop, float fWidth, float fHeight, LPCTSTR strText)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_R4 VTS_R4 VTS_R4 VTS_R4 VTS_BSTR;
+	InvokeHelper(0x1d, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, fPosLeft, fPosTop, fWidth, fHeight, strText);
+	return result;
+}
+
+BOOL CCellsManager::CellDelete(short nUniqueID)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x1e, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+short CCellsManager::CellGetCount()
+{
+	short result;
+	InvokeHelper(0x1f, DISPATCH_METHOD, VT_I2, (void*)&result, NULL);
+	return result;
+}
+
+BOOL CCellsManager::CellFind(short nUniqueID)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x20, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID);
+	return result;
+}
+
+BOOL CCellsManager::CellGetLogFont(short nUniqueID, long pLogFont)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x21, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, pLogFont);
+	return result;
+}
+
+BOOL CCellsManager::CellSetLogFont(short nUniqueID, long pLogFont)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4;
+	InvokeHelper(0x22, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, pLogFont);
+	return result;
+}
+
+short CCellsManager::CellGetUniqueID(short nPosition)
+{
+	short result;
+	static BYTE parms[] =
+		VTS_I2;
+	InvokeHelper(0x23, DISPATCH_METHOD, VT_I2, (void*)&result, parms,
+		nPosition);
+	return result;
+}
+
+BOOL CCellsManager::CellGetPos(short nUniqueID, float* pPosLeft, float* pPosTop)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_PR4 VTS_PR4;
+	InvokeHelper(0x24, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, pPosLeft, pPosTop);
+	return result;
+}
+
+BOOL CCellsManager::CellSetPos(short nUniqueID, float nPosLeft, float nPosTop)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_R4 VTS_R4;
+	InvokeHelper(0x25, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, nPosLeft, nPosTop);
+	return result;
+}
+
+BOOL CCellsManager::CellGetSize(short nUniqueID, float* pWidth, float* pHeight)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_PR4 VTS_PR4;
+	InvokeHelper(0x26, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, pWidth, pHeight);
+	return result;
+}
+
+BOOL CCellsManager::CellSetSize(short nUniqueID, float nWidth, float nHeight)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_R4 VTS_R4;
+	InvokeHelper(0x27, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, nWidth, nHeight);
+	return result;
+}
+
+BOOL CCellsManager::CellSetPictureFromHandle(short nUniqueID, long nPicture, long nHandle)
+{
+	BOOL result;
+	static BYTE parms[] =
+		VTS_I2 VTS_I4 VTS_I4;
+	InvokeHelper(0x28, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
+		nUniqueID, nPicture, nHandle);
+	return result;
+}
diff --git a/ENRIT/UITool/cellsmanager.h b/ENRIT/UITool/cellsmanager.h
new file mode 100644
index 0000000..e8480a6
--- /dev/null
+++ b/ENRIT/UITool/cellsmanager.h
@@ -0,0 +1,88 @@
+#if !defined(AFX_CELLSMANAGER_H__519A1760_5ECF_4E09_ADF7_27E85FC5E0F8__INCLUDED_)
+#define AFX_CELLSMANAGER_H__519A1760_5ECF_4E09_ADF7_27E85FC5E0F8__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+
+// Dispatch interfaces referenced by this interface
+class CTextDescriptor;
+
+/////////////////////////////////////////////////////////////////////////////
+// CCellsManager wrapper class
+
+class CCellsManager : public COleDispatchDriver
+{
+public:
+	CCellsManager() {}		// Calls COleDispatchDriver default constructor
+	CCellsManager(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
+	CCellsManager(const CCellsManager& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
+
+// Attributes
+public:
+	long GetScaleUnit();
+	void SetScaleUnit(long);
+
+// Operations
+public:
+	BOOL AddCell(short nUniqueID, short nPercLeft, short nPercTop, short nPercWidth, short nPercHeight, LPCTSTR strText);
+	BOOL DeleteCell(short nUniqueID);
+	short GetCount();
+	BOOL FindCell(short nUniqueID);
+	BOOL GetLogFont(short nUniqueID, long pLogFont);
+	BOOL SetLogFont(short nUniqueID, long pLogFont);
+	short GetCellUniqueID(short nPosition);
+	BOOL GetCellPos(short nUniqueID, short* pPercLeft, short* pPercTop);
+	BOOL SetCellPos(short nUniqueID, short nPercLeft, short nPercTop);
+	BOOL GetCellSize(short nUniqueID, short* pPercWidth, short* pPercHeight);
+	BOOL SetCellSize(short nUniqueID, short nPercWidth, short nPercHeight);
+	CString GetInternalDib(short nUniqueID, short nPicture);
+	BOOL SetPictureFromHandle(short nUniqueID, long nPicture, long nHandle);
+	BOOL GetVisible(short nUniqueID);
+	void SetVisible(short nUniqueID, BOOL bNewValue);
+	CString GetText(short nUniqueID);
+	void SetText(short nUniqueID, LPCTSTR lpszNewValue);
+	CTextDescriptor GetTextDescriptor(short nUniqueID);
+	void SetPictureNormal(short nUniqueID, LPCTSTR lpszNewValue);
+	long GetTextHorzAlign(short nUniqueID);
+	void SetTextHorzAlign(short nUniqueID, long nNewValue);
+	long GetTextVertAlign(short nUniqueID);
+	void SetTextVertAlign(short nUniqueID, long nNewValue);
+	long GetPictureHorzAlign(short nUniqueID);
+	void SetPictureHorzAlign(short nUniqueID, long nNewValue);
+	long GetPictureVertAlign(short nUniqueID);
+	void SetPictureVertAlign(short nUniqueID, long nNewValue);
+	unsigned long GetBackColor(short nUniqueID);
+	void SetBackColor(short nUniqueID, unsigned long newValue);
+	unsigned long GetBorderColor(short nUniqueID);
+	void SetBorderColor(short nUniqueID, unsigned long newValue);
+	short GetBorderWidth(short nUniqueID);
+	void SetBorderWidth(short nUniqueID, short nNewValue);
+	void SetPictureDisabled(short nUniqueID, LPCTSTR lpszNewValue);
+	short GetPictureTranspFactor(short nUniqueID);
+	void SetPictureTranspFactor(short nUniqueID, short nNewValue);
+	short GetBackTranspFactor(short nUniqueID);
+	void SetBackTranspFactor(short nUniqueID, short nNewValue);
+	BOOL CellAdd(short nUniqueID, float fPosLeft, float fPosTop, float fWidth, float fHeight, LPCTSTR strText);
+	BOOL CellDelete(short nUniqueID);
+	short CellGetCount();
+	BOOL CellFind(short nUniqueID);
+	BOOL CellGetLogFont(short nUniqueID, long pLogFont);
+	BOOL CellSetLogFont(short nUniqueID, long pLogFont);
+	short CellGetUniqueID(short nPosition);
+	BOOL CellGetPos(short nUniqueID, float* pPosLeft, float* pPosTop);
+	BOOL CellSetPos(short nUniqueID, float nPosLeft, float nPosTop);
+	BOOL CellGetSize(short nUniqueID, float* pWidth, float* pHeight);
+	BOOL CellSetSize(short nUniqueID, float nWidth, float nHeight);
+	BOOL CellSetPictureFromHandle(short nUniqueID, long nPicture, long nHandle);
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_CELLSMANAGER_H__519A1760_5ECF_4E09_ADF7_27E85FC5E0F8__INCLUDED_)
diff --git a/ENRIT/UITool/font.cpp b/ENRIT/UITool/font.cpp
new file mode 100644
index 0000000..4a9b88c
--- /dev/null
+++ b/ENRIT/UITool/font.cpp
@@ -0,0 +1,111 @@
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+
+#include "stdafx.h"
+#include "font.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// COleFont properties
+
+CString COleFont::GetName()
+{
+	CString result;
+	GetProperty(0x0, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void COleFont::SetName(LPCTSTR propVal)
+{
+	SetProperty(0x0, VT_BSTR, propVal);
+}
+
+CY COleFont::GetSize()
+{
+	CY result;
+	GetProperty(0x2, VT_CY, (void*)&result);
+	return result;
+}
+
+void COleFont::SetSize(const CY& propVal)
+{
+	SetProperty(0x2, VT_CY, &propVal);
+}
+
+BOOL COleFont::GetBold()
+{
+	BOOL result;
+	GetProperty(0x3, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void COleFont::SetBold(BOOL propVal)
+{
+	SetProperty(0x3, VT_BOOL, propVal);
+}
+
+BOOL COleFont::GetItalic()
+{
+	BOOL result;
+	GetProperty(0x4, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void COleFont::SetItalic(BOOL propVal)
+{
+	SetProperty(0x4, VT_BOOL, propVal);
+}
+
+BOOL COleFont::GetUnderline()
+{
+	BOOL result;
+	GetProperty(0x5, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void COleFont::SetUnderline(BOOL propVal)
+{
+	SetProperty(0x5, VT_BOOL, propVal);
+}
+
+BOOL COleFont::GetStrikethrough()
+{
+	BOOL result;
+	GetProperty(0x6, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void COleFont::SetStrikethrough(BOOL propVal)
+{
+	SetProperty(0x6, VT_BOOL, propVal);
+}
+
+short COleFont::GetWeight()
+{
+	short result;
+	GetProperty(0x7, VT_I2, (void*)&result);
+	return result;
+}
+
+void COleFont::SetWeight(short propVal)
+{
+	SetProperty(0x7, VT_I2, propVal);
+}
+
+short COleFont::GetCharset()
+{
+	short result;
+	GetProperty(0x8, VT_I2, (void*)&result);
+	return result;
+}
+
+void COleFont::SetCharset(short propVal)
+{
+	SetProperty(0x8, VT_I2, propVal);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// COleFont operations
diff --git a/ENRIT/UITool/font.h b/ENRIT/UITool/font.h
new file mode 100644
index 0000000..d3d0066
--- /dev/null
+++ b/ENRIT/UITool/font.h
@@ -0,0 +1,48 @@
+#if !defined(AFX_FONT_H__680D290B_7A37_47D6_8E9B_300045E3AE85__INCLUDED_)
+#define AFX_FONT_H__680D290B_7A37_47D6_8E9B_300045E3AE85__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+/////////////////////////////////////////////////////////////////////////////
+// COleFont wrapper class
+
+class COleFont : public COleDispatchDriver
+{
+public:
+	COleFont() {}		// Calls COleDispatchDriver default constructor
+	COleFont(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
+	COleFont(const COleFont& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
+
+// Attributes
+public:
+	CString GetName();
+	void SetName(LPCTSTR);
+	CY GetSize();
+	void SetSize(const CY&);
+	BOOL GetBold();
+	void SetBold(BOOL);
+	BOOL GetItalic();
+	void SetItalic(BOOL);
+	BOOL GetUnderline();
+	void SetUnderline(BOOL);
+	BOOL GetStrikethrough();
+	void SetStrikethrough(BOOL);
+	short GetWeight();
+	void SetWeight(short);
+	short GetCharset();
+	void SetCharset(short);
+
+// Operations
+public:
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_FONT_H__680D290B_7A37_47D6_8E9B_300045E3AE85__INCLUDED_)
diff --git a/ENRIT/UITool/surfacecolor.cpp b/ENRIT/UITool/surfacecolor.cpp
new file mode 100644
index 0000000..4389926
--- /dev/null
+++ b/ENRIT/UITool/surfacecolor.cpp
@@ -0,0 +1,75 @@
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+
+#include "stdafx.h"
+#include "surfacecolor.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CSurfaceColor properties
+
+unsigned long CSurfaceColor::GetColor()
+{
+	unsigned long result;
+	GetProperty(0x1, VT_I4, (void*)&result);
+	return result;
+}
+
+void CSurfaceColor::SetColor(unsigned long propVal)
+{
+	SetProperty(0x1, VT_I4, propVal);
+}
+
+long CSurfaceColor::GetGradientType()
+{
+	long result;
+	GetProperty(0x2, VT_I4, (void*)&result);
+	return result;
+}
+
+void CSurfaceColor::SetGradientType(long propVal)
+{
+	SetProperty(0x2, VT_I4, propVal);
+}
+
+short CSurfaceColor::GetGradientFactor()
+{
+	short result;
+	GetProperty(0x3, VT_I2, (void*)&result);
+	return result;
+}
+
+void CSurfaceColor::SetGradientFactor(short propVal)
+{
+	SetProperty(0x3, VT_I2, propVal);
+}
+
+long CSurfaceColor::GetRender3DType()
+{
+	long result;
+	GetProperty(0x4, VT_I4, (void*)&result);
+	return result;
+}
+
+void CSurfaceColor::SetRender3DType(long propVal)
+{
+	SetProperty(0x4, VT_I4, propVal);
+}
+
+unsigned long CSurfaceColor::GetColor2()
+{
+	unsigned long result;
+	GetProperty(0x5, VT_I4, (void*)&result);
+	return result;
+}
+
+void CSurfaceColor::SetColor2(unsigned long propVal)
+{
+	SetProperty(0x5, VT_I4, propVal);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CSurfaceColor operations
diff --git a/ENRIT/UITool/surfacecolor.h b/ENRIT/UITool/surfacecolor.h
new file mode 100644
index 0000000..1f8a020
--- /dev/null
+++ b/ENRIT/UITool/surfacecolor.h
@@ -0,0 +1,42 @@
+#if !defined(AFX_SURFACECOLOR_H__C6425A9A_E45A_4DD6_BB82_0603E9663A09__INCLUDED_)
+#define AFX_SURFACECOLOR_H__C6425A9A_E45A_4DD6_BB82_0603E9663A09__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+/////////////////////////////////////////////////////////////////////////////
+// CSurfaceColor wrapper class
+
+class CSurfaceColor : public COleDispatchDriver
+{
+public:
+	CSurfaceColor() {}		// Calls COleDispatchDriver default constructor
+	CSurfaceColor(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
+	CSurfaceColor(const CSurfaceColor& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
+
+// Attributes
+public:
+	unsigned long GetColor();
+	void SetColor(unsigned long);
+	long GetGradientType();
+	void SetGradientType(long);
+	short GetGradientFactor();
+	void SetGradientFactor(short);
+	long GetRender3DType();
+	void SetRender3DType(long);
+	unsigned long GetColor2();
+	void SetColor2(unsigned long);
+
+// Operations
+public:
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SURFACECOLOR_H__C6425A9A_E45A_4DD6_BB82_0603E9663A09__INCLUDED_)
diff --git a/ENRIT/UITool/textdescriptor.cpp b/ENRIT/UITool/textdescriptor.cpp
new file mode 100644
index 0000000..7c088e5
--- /dev/null
+++ b/ENRIT/UITool/textdescriptor.cpp
@@ -0,0 +1,279 @@
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+
+#include "stdafx.h"
+#include "textdescriptor.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CTextDescriptor properties
+
+unsigned long CTextDescriptor::GetColorNormal()
+{
+	unsigned long result;
+	GetProperty(0x1, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorNormal(unsigned long propVal)
+{
+	SetProperty(0x1, VT_I4, propVal);
+}
+
+unsigned long CTextDescriptor::GetColorMouseOver()
+{
+	unsigned long result;
+	GetProperty(0x2, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorMouseOver(unsigned long propVal)
+{
+	SetProperty(0x2, VT_I4, propVal);
+}
+
+unsigned long CTextDescriptor::GetColorPressed()
+{
+	unsigned long result;
+	GetProperty(0x3, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorPressed(unsigned long propVal)
+{
+	SetProperty(0x3, VT_I4, propVal);
+}
+
+unsigned long CTextDescriptor::GetColorSolidBack()
+{
+	unsigned long result;
+	GetProperty(0x4, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorSolidBack(unsigned long propVal)
+{
+	SetProperty(0x4, VT_I4, propVal);
+}
+
+unsigned long CTextDescriptor::GetColorBorder()
+{
+	unsigned long result;
+	GetProperty(0x5, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorBorder(unsigned long propVal)
+{
+	SetProperty(0x5, VT_I4, propVal);
+}
+
+short CTextDescriptor::GetOffsetX()
+{
+	short result;
+	GetProperty(0x6, VT_I2, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetOffsetX(short propVal)
+{
+	SetProperty(0x6, VT_I2, propVal);
+}
+
+short CTextDescriptor::GetOffsetY()
+{
+	short result;
+	GetProperty(0x7, VT_I2, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetOffsetY(short propVal)
+{
+	SetProperty(0x7, VT_I2, propVal);
+}
+
+long CTextDescriptor::GetSpecialEffect()
+{
+	long result;
+	GetProperty(0x8, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetSpecialEffect(long propVal)
+{
+	SetProperty(0x8, VT_I4, propVal);
+}
+
+short CTextDescriptor::GetSpecialEffectFactor()
+{
+	short result;
+	GetProperty(0x9, VT_I2, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetSpecialEffectFactor(short propVal)
+{
+	SetProperty(0x9, VT_I2, propVal);
+}
+
+short CTextDescriptor::GetAngle()
+{
+	short result;
+	GetProperty(0xa, VT_I2, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetAngle(short propVal)
+{
+	SetProperty(0xa, VT_I2, propVal);
+}
+
+short CTextDescriptor::GetTransparentFactor()
+{
+	short result;
+	GetProperty(0xb, VT_I2, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetTransparentFactor(short propVal)
+{
+	SetProperty(0xb, VT_I2, propVal);
+}
+
+BOOL CTextDescriptor::GetAntialias()
+{
+	BOOL result;
+	GetProperty(0xc, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetAntialias(BOOL propVal)
+{
+	SetProperty(0xc, VT_BOOL, propVal);
+}
+
+BOOL CTextDescriptor::GetSolidBack()
+{
+	BOOL result;
+	GetProperty(0xd, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetSolidBack(BOOL propVal)
+{
+	SetProperty(0xd, VT_BOOL, propVal);
+}
+
+CString CTextDescriptor::GetText()
+{
+	CString result;
+	GetProperty(0xe, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetText(LPCTSTR propVal)
+{
+	SetProperty(0xe, VT_BSTR, propVal);
+}
+
+BOOL CTextDescriptor::GetVisible()
+{
+	BOOL result;
+	GetProperty(0xf, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetVisible(BOOL propVal)
+{
+	SetProperty(0xf, VT_BOOL, propVal);
+}
+
+BOOL CTextDescriptor::GetBorder()
+{
+	BOOL result;
+	GetProperty(0x10, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetBorder(BOOL propVal)
+{
+	SetProperty(0x10, VT_BOOL, propVal);
+}
+
+BOOL CTextDescriptor::GetDoubleSpace()
+{
+	BOOL result;
+	GetProperty(0x11, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetDoubleSpace(BOOL propVal)
+{
+	SetProperty(0x11, VT_BOOL, propVal);
+}
+
+BOOL CTextDescriptor::GetSolidBackShadow()
+{
+	BOOL result;
+	GetProperty(0x12, VT_BOOL, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetSolidBackShadow(BOOL propVal)
+{
+	SetProperty(0x12, VT_BOOL, propVal);
+}
+
+unsigned long CTextDescriptor::GetColorHighlight()
+{
+	unsigned long result;
+	GetProperty(0x13, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorHighlight(unsigned long propVal)
+{
+	SetProperty(0x13, VT_I4, propVal);
+}
+
+unsigned long CTextDescriptor::GetColorShadow()
+{
+	unsigned long result;
+	GetProperty(0x14, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorShadow(unsigned long propVal)
+{
+	SetProperty(0x14, VT_I4, propVal);
+}
+
+unsigned long CTextDescriptor::GetColorHalo()
+{
+	unsigned long result;
+	GetProperty(0x15, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorHalo(unsigned long propVal)
+{
+	SetProperty(0x15, VT_I4, propVal);
+}
+
+unsigned long CTextDescriptor::GetColorSolidBackShadow()
+{
+	unsigned long result;
+	GetProperty(0x16, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTextDescriptor::SetColorSolidBackShadow(unsigned long propVal)
+{
+	SetProperty(0x16, VT_I4, propVal);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CTextDescriptor operations
diff --git a/ENRIT/UITool/textdescriptor.h b/ENRIT/UITool/textdescriptor.h
new file mode 100644
index 0000000..652ae18
--- /dev/null
+++ b/ENRIT/UITool/textdescriptor.h
@@ -0,0 +1,76 @@
+#if !defined(AFX_TEXTDESCRIPTOR_H__8439099C_F0E9_45BA_9D40_FCE6F4946E85__INCLUDED_)
+#define AFX_TEXTDESCRIPTOR_H__8439099C_F0E9_45BA_9D40_FCE6F4946E85__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+/////////////////////////////////////////////////////////////////////////////
+// CTextDescriptor wrapper class
+
+class CTextDescriptor : public COleDispatchDriver
+{
+public:
+	CTextDescriptor() {}		// Calls COleDispatchDriver default constructor
+	CTextDescriptor(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
+	CTextDescriptor(const CTextDescriptor& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
+
+// Attributes
+public:
+	unsigned long GetColorNormal();
+	void SetColorNormal(unsigned long);
+	unsigned long GetColorMouseOver();
+	void SetColorMouseOver(unsigned long);
+	unsigned long GetColorPressed();
+	void SetColorPressed(unsigned long);
+	unsigned long GetColorSolidBack();
+	void SetColorSolidBack(unsigned long);
+	unsigned long GetColorBorder();
+	void SetColorBorder(unsigned long);
+	short GetOffsetX();
+	void SetOffsetX(short);
+	short GetOffsetY();
+	void SetOffsetY(short);
+	long GetSpecialEffect();
+	void SetSpecialEffect(long);
+	short GetSpecialEffectFactor();
+	void SetSpecialEffectFactor(short);
+	short GetAngle();
+	void SetAngle(short);
+	short GetTransparentFactor();
+	void SetTransparentFactor(short);
+	BOOL GetAntialias();
+	void SetAntialias(BOOL);
+	BOOL GetSolidBack();
+	void SetSolidBack(BOOL);
+	CString GetText();
+	void SetText(LPCTSTR);
+	BOOL GetVisible();
+	void SetVisible(BOOL);
+	BOOL GetBorder();
+	void SetBorder(BOOL);
+	BOOL GetDoubleSpace();
+	void SetDoubleSpace(BOOL);
+	BOOL GetSolidBackShadow();
+	void SetSolidBackShadow(BOOL);
+	unsigned long GetColorHighlight();
+	void SetColorHighlight(unsigned long);
+	unsigned long GetColorShadow();
+	void SetColorShadow(unsigned long);
+	unsigned long GetColorHalo();
+	void SetColorHalo(unsigned long);
+	unsigned long GetColorSolidBackShadow();
+	void SetColorSolidBackShadow(unsigned long);
+
+// Operations
+public:
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_TEXTDESCRIPTOR_H__8439099C_F0E9_45BA_9D40_FCE6F4946E85__INCLUDED_)
diff --git a/ENRIT/UITool/texture.cpp b/ENRIT/UITool/texture.cpp
new file mode 100644
index 0000000..466ab7e
--- /dev/null
+++ b/ENRIT/UITool/texture.cpp
@@ -0,0 +1,75 @@
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+
+#include "stdafx.h"
+#include "texture.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CTexture properties
+
+CString CTexture::GetFilepath()
+{
+	CString result;
+	GetProperty(0x1, VT_BSTR, (void*)&result);
+	return result;
+}
+
+void CTexture::SetFilepath(LPCTSTR propVal)
+{
+	SetProperty(0x1, VT_BSTR, propVal);
+}
+
+long CTexture::GetMode()
+{
+	long result;
+	GetProperty(0x2, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTexture::SetMode(long propVal)
+{
+	SetProperty(0x2, VT_I4, propVal);
+}
+
+short CTexture::GetLightIntensity()
+{
+	short result;
+	GetProperty(0x3, VT_I2, (void*)&result);
+	return result;
+}
+
+void CTexture::SetLightIntensity(short propVal)
+{
+	SetProperty(0x3, VT_I2, propVal);
+}
+
+unsigned long CTexture::GetColorToMix()
+{
+	unsigned long result;
+	GetProperty(0x4, VT_I4, (void*)&result);
+	return result;
+}
+
+void CTexture::SetColorToMix(unsigned long propVal)
+{
+	SetProperty(0x4, VT_I4, propVal);
+}
+
+short CTexture::GetPercentageColorMix()
+{
+	short result;
+	GetProperty(0x5, VT_I2, (void*)&result);
+	return result;
+}
+
+void CTexture::SetPercentageColorMix(short propVal)
+{
+	SetProperty(0x5, VT_I2, propVal);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CTexture operations
diff --git a/ENRIT/UITool/texture.h b/ENRIT/UITool/texture.h
new file mode 100644
index 0000000..38455c4
--- /dev/null
+++ b/ENRIT/UITool/texture.h
@@ -0,0 +1,42 @@
+#if !defined(AFX_TEXTURE_H__AF25E66F_E258_4096_BA2D_3E2E9DB88B3D__INCLUDED_)
+#define AFX_TEXTURE_H__AF25E66F_E258_4096_BA2D_3E2E9DB88B3D__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
+
+// NOTE: Do not modify the contents of this file.  If this class is regenerated by
+//  Microsoft Visual C++, your modifications will be overwritten.
+
+/////////////////////////////////////////////////////////////////////////////
+// CTexture wrapper class
+
+class CTexture : public COleDispatchDriver
+{
+public:
+	CTexture() {}		// Calls COleDispatchDriver default constructor
+	CTexture(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
+	CTexture(const CTexture& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
+
+// Attributes
+public:
+	CString GetFilepath();
+	void SetFilepath(LPCTSTR);
+	long GetMode();
+	void SetMode(long);
+	short GetLightIntensity();
+	void SetLightIntensity(short);
+	unsigned long GetColorToMix();
+	void SetColorToMix(unsigned long);
+	short GetPercentageColorMix();
+	void SetPercentageColorMix(short);
+
+// Operations
+public:
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_TEXTURE_H__AF25E66F_E258_4096_BA2D_3E2E9DB88B3D__INCLUDED_)
diff --git a/ENRIT/View/DlgLicenseInfo.cpp b/ENRIT/View/DlgLicenseInfo.cpp
new file mode 100644
index 0000000..a58c19f
--- /dev/null
+++ b/ENRIT/View/DlgLicenseInfo.cpp
@@ -0,0 +1,88 @@
+// DlgLicenseInfo.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "DlgLicenseInfo.h"
+#include "afxdialogex.h"
+
+
+// CDlgLicenseInfo 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CDlgLicenseInfo, CDialogEx)
+
+CDlgLicenseInfo::CDlgLicenseInfo(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CDlgLicenseInfo::IDD, pParent)
+{
+
+}
+
+CDlgLicenseInfo::~CDlgLicenseInfo()
+{
+}
+
+void CDlgLicenseInfo::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+void CDlgLicenseInfo::UpdateLicenseInfo()
+{
+	if(g_pStatus->m_pLicenseChecker == NULL)
+		return;
+
+	SLicenseStatus status = g_pStatus->m_pLicenseChecker->GetLicenseInfo();
+
+	CWnd *pWnd = nullptr;
+	CString strValue = L"";
+
+	// serial no
+	strValue.Format(L"Serial NO = %s", status.strSerialNo);
+	pWnd = GetDlgItem(IDC_LBA_SERIAL_NO);
+	if (pWnd && pWnd->GetSafeHwnd())
+	{
+		SetDlgItemText(IDC_LBA_SERIAL_NO, strValue);
+	}
+
+	// key status
+	switch (status.nKeyStatus)
+	{
+	case LicenseKey_NotConnected:	// 楷搬 救凳
+		strValue = L"Key Status = Not Connected";
+		break;
+	case LicenseKey_NotCertified:	// 牢刘 救凳
+		strValue = L"Key Status = Not Certified";
+		break;
+	case LicenseKey_NotActivated:	// 劝己拳 救凳
+		strValue = L"Key Status = Not Activated";
+		break;
+	case LicenseKey_Activated:		// 劝己拳 凳
+		strValue = L"Key Status = Activated";
+		break;
+	}
+	pWnd = GetDlgItem(IDC_LBA_LOCK_STATUS);
+	if (pWnd && pWnd->GetSafeHwnd())
+	{
+		SetDlgItemText(IDC_LBA_LOCK_STATUS, strValue);
+	}
+	pWnd = GetDlgItem(IDC_LBA_LOCK_DUE_DATE);
+	if (pWnd && pWnd->GetSafeHwnd())
+	{
+		strValue.Format(_T("Licensed Time = %04d/%02d/%02d-%02d:%02d:%02d"), status.expTime.GetYear()
+			, status.expTime.GetMonth()
+			, status.expTime.GetDay()
+			, status.expTime.GetHour()
+			, status.expTime.GetMinute()
+			, status.expTime.GetSecond()
+			);
+
+		SetDlgItemText(IDC_LBA_LOCK_DUE_DATE, strValue);
+	}
+}
+
+BEGIN_MESSAGE_MAP(CDlgLicenseInfo, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CDlgLicenseInfo 皋矫瘤 贸府扁涝聪促.
diff --git a/ENRIT/View/DlgLicenseInfo.h b/ENRIT/View/DlgLicenseInfo.h
new file mode 100644
index 0000000..f3795e2
--- /dev/null
+++ b/ENRIT/View/DlgLicenseInfo.h
@@ -0,0 +1,24 @@
+#pragma once
+#include "StatusMonitor.h"
+
+// CDlgLicenseInfo 措拳 惑磊涝聪促.
+
+class CDlgLicenseInfo : public CDialogEx
+{
+	DECLARE_DYNAMIC(CDlgLicenseInfo)
+
+public:
+	CDlgLicenseInfo(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CDlgLicenseInfo();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DIALOG_LICENSE };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void UpdateLicenseInfo();
+};
diff --git a/ENRIT/View/DlgLogin.cpp b/ENRIT/View/DlgLogin.cpp
new file mode 100644
index 0000000..23f82ae
--- /dev/null
+++ b/ENRIT/View/DlgLogin.cpp
@@ -0,0 +1,120 @@
+// DlgLogin.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "DlgLogin.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CDlgLogin dialog
+
+
+CDlgLogin::CDlgLogin(CWnd* pParent /*=NULL*/)
+	: CDialog(CDlgLogin::IDD, pParent)
+{
+	//{{AFX_DATA_INIT(CDlgLogin)
+	m_strEditPassword = _T("");
+	m_strEditNewPwd1 = _T("");
+	m_strEditNewPwd2 = _T("");
+	//}}AFX_DATA_INIT
+
+	m_strOriginPwd = _T("");
+	m_bLoginOK = FALSE;
+}
+
+void CDlgLogin::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+	//{{AFX_DATA_MAP(CDlgLogin)
+	DDX_Text(pDX, IDC_EDIT_PASSWD, m_strEditPassword);
+	DDV_MaxChars(pDX, m_strEditPassword, 50);
+	DDX_Text(pDX, IDC_EDIT_NEWPASSWD1, m_strEditNewPwd1);
+	DDV_MaxChars(pDX, m_strEditNewPwd1, 50);
+	DDX_Text(pDX, IDC_EDIT_NEWPASSWD2, m_strEditNewPwd2);
+	DDV_MaxChars(pDX, m_strEditNewPwd2, 50);
+	//}}AFX_DATA_MAP
+}
+
+BEGIN_MESSAGE_MAP(CDlgLogin, CDialog)
+	//{{AFX_MSG_MAP(CDlgLogin)
+	ON_BN_CLICKED(IDC_BUTTON_CHANGE, OnButtonChange)
+	ON_BN_CLICKED(IDOK, &CDlgLogin::OnOK)
+	ON_BN_CLICKED(IDCANCEL, &CDlgLogin::OnCancel)
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDlgLogin message handlers
+
+void CDlgLogin::OnOK() 
+{
+	// TODO: Add extra validation here
+	UpdateData(TRUE);
+
+	if(m_strEditPassword == _T(""))
+	{
+		m_bLoginOK = TRUE;
+		CDialog::OnOK();
+	}
+
+	if (m_strOriginPwd == m_strEditPassword)
+	{
+		m_bLoginOK = TRUE;
+		CDialog::OnOK();
+	}	
+}
+
+void CDlgLogin::OnCancel() 
+{
+	// TODO: Add extra cleanup here
+	m_bLoginOK = FALSE;
+	
+	CDialog::OnCancel();
+}
+
+void CDlgLogin::OnButtonChange() 
+{
+	// TODO: Add your control notification handler code here
+	UpdateData(TRUE);
+
+	if(m_strOriginPwd.IsEmpty())
+		m_strOriginPwd = _T("sisvision");
+
+	if(m_strEditPassword != _T("sisvision"))
+	{
+		if (m_strEditPassword != m_strOriginPwd)
+		{
+			AfxMessageBox(_T("Incorrect Password"));
+			return;
+		}
+	}
+	
+	if (m_strEditNewPwd1 != m_strEditNewPwd2)
+	{
+		AfxMessageBox(_T("Difference new Password"));
+		return;
+	}
+
+	AfxGetApp()->WriteProfileString(_T("Login"), _T("Password"), m_strEditNewPwd1);
+
+	AfxMessageBox(_T("Change Password Completed"), MB_OK | MB_ICONINFORMATION);
+
+	m_bLoginOK = FALSE;
+
+	CDialog::OnCancel();
+}
+
+BOOL CDlgLogin::OnInitDialog() 
+{
+	CDialog::OnInitDialog();
+	
+
+	m_strOriginPwd = AfxGetApp()->GetProfileString(_T("Login"), _T("Password"), _T("sisvision"));
+	
+	return TRUE;
+}
diff --git a/ENRIT/View/DlgLogin.h b/ENRIT/View/DlgLogin.h
new file mode 100644
index 0000000..a2959b3
--- /dev/null
+++ b/ENRIT/View/DlgLogin.h
@@ -0,0 +1,41 @@
+#pragma once
+/////////////////////////////////////////////////////////////////////////////
+// CDlgLogin dialog
+#include "ENRIT.h"
+
+class CDlgLogin : public CDialog
+{
+// Construction
+public:
+	CDlgLogin(CWnd* pParent = NULL);   // standard constructor
+
+// Dialog Data
+	//{{AFX_DATA(CDlgLogin)
+	enum { IDD = IDD_DIALOG_LOGIN };
+	CString	m_strEditPassword;
+	CString	m_strEditNewPwd1;
+	CString	m_strEditNewPwd2;
+	//}}AFX_DATA
+
+	BOOL		m_bLoginOK;
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CDlgLogin)
+	protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+	//}}AFX_VIRTUAL
+
+// Implementation
+protected:
+	CString			m_strOriginPwd;
+
+	// Generated message map functions
+	//{{AFX_MSG(CDlgLogin)
+	virtual void OnOK();
+	virtual void OnCancel();
+	afx_msg void OnButtonChange();
+	virtual BOOL OnInitDialog();
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+};
diff --git a/ENRIT/View/FrameImg.cpp b/ENRIT/View/FrameImg.cpp
new file mode 100644
index 0000000..4d20c3a
--- /dev/null
+++ b/ENRIT/View/FrameImg.cpp
@@ -0,0 +1,3427 @@
+// FrameImg.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "FrameImg.h"
+#include <math.h>
+#include "Mainfrm.h"
+#include "PixelPtr.h"
+#include "ENRIT.h"
+
+const TCHAR *PANEL_SIDE_NAME[]		= {_T("A_TOP"), _T("B_TOP"), _T("C_TOP"), _T("D_TOP"),_T("A_BOT"), _T("B_BOT"), _T("C_BOT"), _T("D_BOT")};
+
+// CFrameImg
+IMPLEMENT_DYNAMIC(CFrameImg, CStatic)
+	
+CFrameImg::CFrameImg()
+{
+	m_pI2M = NULL;	
+	m_pHardware = NULL;
+	m_pRecipe = NULL;
+	m_pGlassData = NULL;
+	m_bVCRDraw  = TRUE;
+	m_Wnd_Event		= NULL;
+	m_nCam			= 0;
+	m_nSide			= 0;
+	
+	m_dZoom			= 1;
+
+	m_pBuffer	= NULL;
+	m_szTotBuffer = CSize(0,0);
+	m_szImg.cx  = IMAGE_WIDTH;
+	m_szImg.cy  = IMAGE_HEIGHT;
+	m_ptOrg.x	= 0;
+	m_ptOrg.y   = 0;
+
+	m_bModify			= 0;
+	m_nModeTracker		= 0;
+
+	m_szMark.cx			= 50;
+	m_szMark.cy			= 50;
+
+
+	m_pTracker	= NULL;	
+	m_pBmInfo	= NULL;	
+	m_ptMouseSaved.x = 0;
+	m_ptMouseSaved.y = 0;
+	ZeroMemory(&m_ManualMeausre,sizeof(MANUAL_MEASURE));
+
+	m_rcROI = CRect(0,0,m_szImg.cx,m_szImg.cy);
+
+	m_sideFont.CreateFont(25 , 15, 0, 0, 900 , FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+		DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN,_T("Arial"));
+
+
+	int x;
+	RGBQUAD ColorTable[256];
+	for(x=0; x<256; x++)
+	{
+		ColorTable[x].rgbBlue = ColorTable[x].rgbGreen = ColorTable[x].rgbRed = x;
+	}
+	m_ImageMagnify.Create(120,120,8);
+	m_ImageMagnify.SetColorTable(0,256,ColorTable);
+
+	m_bitModeDisplay.set(MODE_SHOW_MEASURE_LINE);
+	m_bitModeDisplay.set(MODE_SHOW_REF_LINE);
+	m_bitModeDisplay.set(MODE_SHOW_SUB_LINE);
+
+	m_refMark.rc = CRect(0,0,50,50);
+
+	m_pCompareArea = nullptr;
+
+	m_st_GdiItem.colorWhite			= RGB(255, 255, 255);
+	m_st_GdiItem.colorRed			= RGB(170,   0,   0);
+	m_st_GdiItem.colorGreen			= RGB(  0, 150,   0);
+	m_st_GdiItem.colorBlue			= RGB(  0,   0, 180);
+	m_st_GdiItem.colorBlack			= RGB(  1,   1,   1);
+	m_st_GdiItem.colorViolet		= RGB(150,   0, 150);
+	m_st_GdiItem.colorLightRed		= RGB(230, 200, 200);
+	m_st_GdiItem.colorLightBlue		= RGB(200, 200, 230);
+	m_st_GdiItem.colorLightGreen	= RGB(200, 230, 230);
+	m_st_GdiItem.colorLightGray		= RGB(210, 210, 210);
+	m_st_GdiItem.colorDarkGray		= RGB( 80,  80,  80);
+	m_st_GdiItem.colorGray			= RGB(110, 110, 110);
+	m_st_GdiItem.colorLightYellow	= RGB(250, 250,   0);
+	m_st_GdiItem.colorYellow		= RGB(180, 180,   0);
+	m_st_GdiItem.colorTitle			= RGB(180, 180, 180);
+	m_st_GdiItem.colorOrange		= RGB(250, 150,	  0);
+
+	m_bMouseLDown = FALSE;
+}
+
+CFrameImg::~CFrameImg()
+{
+	if(m_pBmInfo)
+		free(m_pBmInfo);
+}
+
+
+BEGIN_MESSAGE_MAP(CFrameImg, CStatic)
+	ON_WM_PAINT()
+	ON_WM_DESTROY()
+	ON_COMMAND(ID_PROFILE_CHECKALL		, &CFrameImg::OnProfileCheckall)
+	ON_COMMAND(ID_PROFILE_CLEARALL		, &CFrameImg::OnProfileClearall)
+	ON_COMMAND(ID_PROFILE_CURRENTX		, &CFrameImg::OnProfileCurrentx)
+	ON_COMMAND(ID_PROFILE_CURRENTY		, &CFrameImg::OnProfileCurrenty)
+	ON_COMMAND(ID_PROFILE_SAVEDX		, &CFrameImg::OnProfileSavedx)
+	ON_COMMAND(ID_PROFILE_SAVEDY		, &CFrameImg::OnProfileSavedy)
+	ON_COMMAND(ID_PROFILE_PROJECTIONX	, &CFrameImg::OnProfileProjectionx)
+	ON_COMMAND(ID_PROFILE_PROJECTIONY	, &CFrameImg::OnProfileProjectiony)
+	ON_WM_CONTEXTMENU()
+	ON_WM_MOUSEMOVE()
+	ON_COMMAND(ID_MEASURE_CHECKALL		, &CFrameImg::OnMeasureCheckall)
+	ON_COMMAND(ID_MEASURE_CLEARALL		, &CFrameImg::OnMeasureClearall)
+	ON_COMMAND(ID_MEASURE_DISTANCEX		, &CFrameImg::OnMeasureDistancex)
+	ON_COMMAND(ID_MEASURE_DISTANCEY		, &CFrameImg::OnMeasureDistancey)
+	
+	ON_COMMAND(ID_VIEW_CHECKALL			, &CFrameImg::OnViewCheckall)
+	ON_COMMAND(ID_VIEW_CLEARALL			, &CFrameImg::OnViewClearall)
+	ON_COMMAND(ID_VIEW_SHOW_MEASURE_LINE, &CFrameImg::OnViewShowMeasureLine)
+	ON_COMMAND(ID_VIEW_SHOW_REF_LINE	, &CFrameImg::OnViewShowRefLine)
+	ON_COMMAND(ID_IMGMODIFY_DRAWBRUSH	, &CFrameImg::OnImgmodifyDrawbrush)
+	
+	//ON_COMMAND(ID_IMAGE_MANIFY, &CFrameImg::OnImageManify)
+
+
+
+
+	ON_WM_CREATE()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_LBUTTONUP()
+	ON_WM_MOUSEACTIVATE()
+
+	//ON_MESSAGE(WM_FILTER_ITEM_SELECT_CHANGE, OnSelectExeptionItem)
+
+
+END_MESSAGE_MAP()
+
+
+// CFrameImg 皋矫瘤 贸府扁涝聪促.
+
+
+int CFrameImg::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CWnd::OnCreate(lpCreateStruct) == -1)
+		return -1;
+
+	GetClientRect(m_WndRect);
+
+
+/*
+	CDC     *pDC = GetDC();
+	m_memDC.CreateCompatibleDC(pDC);
+//	m_Bitmap.CreateCompatibleBitmap(pDC,m_szImg.cx,m_szImg.cy);
+	
+	ReleaseDC(pDC);
+
+*/
+	return 0;
+}
+
+void CFrameImg::ChangeRect()
+{
+	GetClientRect(m_WndRect);
+}
+
+CSize	CFrameImg::GetScanBufSize(int iSide)
+{
+	if(m_pHardware == NULL)
+		return CSize(0,0);
+
+	int iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)iSide);
+	if(iCam < 0)
+		return CSize(0,0);
+
+	CSize		szImg(0,0);
+
+	szImg.cy = g_pBase->m_pMemFrameNo[iCam];
+	szImg.cx = g_pBase->m_pFrameWidth[iCam];
+
+	return szImg;
+}
+
+void CFrameImg::InitBitMap()
+{
+	int i=0;
+	m_pBmInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFO)+256*sizeof(RGBQUAD));
+	m_pBmInfo->bmiHeader.biBitCount			= 8; 
+	m_pBmInfo->bmiHeader.biClrImportant		= 256;
+	m_pBmInfo->bmiHeader.biClrUsed			= 256;
+	m_pBmInfo->bmiHeader.biCompression		= BI_RGB;
+	m_pBmInfo->bmiHeader.biHeight			= -m_szImg.cy; 
+	m_pBmInfo->bmiHeader.biPlanes			= 1;
+	m_pBmInfo->bmiHeader.biSize				= sizeof( BITMAPINFOHEADER );
+	m_pBmInfo->bmiHeader.biSizeImage		= m_szImg.cx * m_szImg.cy; 
+	m_pBmInfo->bmiHeader.biWidth			= m_szImg.cx; 
+	m_pBmInfo->bmiHeader.biXPelsPerMeter=0;
+	m_pBmInfo->bmiHeader.biYPelsPerMeter=0;
+	for(i=0; i<256; i++) // Palette number is 256
+	{
+		m_pBmInfo->bmiColors[i].rgbRed= m_pBmInfo->bmiColors[i].rgbGreen = m_pBmInfo->bmiColors[i].rgbBlue = i; 
+		m_pBmInfo->bmiColors[i].rgbReserved = 0;
+	}
+
+}
+
+void CFrameImg::OnDestroy()
+{
+	CWnd::OnDestroy();
+	if(m_pBmInfo)
+	{
+		free(m_pBmInfo);
+		m_pBmInfo = NULL;
+	}
+//	m_memDC.DeleteDC();
+//	m_Bitmap.DeleteObject();
+	m_sideFont.DeleteObject();
+}
+
+
+void CFrameImg::SetMode(int nMode)		
+{ 
+	if(nMode == MODE_MARK_REG)
+	{
+		m_refMark.rc.left	= m_ptOrg.x + m_WndRect.Width()/2   - 50;
+		m_refMark.rc.top	= m_ptOrg.y + m_WndRect.Height()/2  - 50;
+		m_refMark.rc.right	= m_refMark.rc.left + 50;
+		m_refMark.rc.bottom	= m_refMark.rc.top  + 50;
+
+		
+		m_pTracker = &m_refMark;
+	}
+	else if((nMode == MODE_COMPARE_PANEL) || (nMode == MODE_USER_DEFECT_AREA))
+	{
+		if(m_pCompareArea == nullptr)
+			m_pCompareArea = new EXECPTION_AREA;
+
+		m_pCompareArea->rc.left = m_ptOrg.x + (m_WndRect.Width() / 2);
+		m_pCompareArea->rc.top = m_ptOrg.y + (m_WndRect.Height() / 2);
+		m_pCompareArea->rc.right	= m_pCompareArea->rc.left + 100;
+		m_pCompareArea->rc.bottom	= m_pCompareArea->rc.top  + 100;
+	}
+	m_bitModeDisplay.set(nMode);  
+}
+
+void CFrameImg::ResetMode(int nMode)	
+{ 
+	if(nMode == MODE_MARK_REG)
+	{
+		m_pTracker = NULL;
+	}
+	else if(((nMode == MODE_COMPARE_PANEL) || (nMode == MODE_USER_DEFECT_AREA)) && (m_pCompareArea != nullptr))
+	{
+		delete m_pCompareArea;
+		m_pCompareArea = nullptr;
+	}
+
+	m_bitModeDisplay.reset(nMode);
+}
+
+BOOL CFrameImg::GetMode(int nMode)
+{
+	return m_bitModeDisplay[nMode];
+}
+
+void CFrameImg::OnProfileCheckall()
+{
+	SetMode(MODE_PROFILE_X);
+	SetMode(MODE_PROFILE_Y);
+	SetMode(MODE_PROJECTION_X);
+	SetMode(MODE_PROJECTION_Y);
+
+	SetMode(MODE_SAVED_X);
+	SetMode(MODE_SAVED_Y);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnProfileClearall()
+{
+	ResetMode(MODE_PROFILE_X);
+	ResetMode(MODE_PROFILE_Y);
+	ResetMode(MODE_PROJECTION_X);
+	ResetMode(MODE_PROJECTION_Y);
+
+	ResetMode(MODE_SAVED_X);
+	ResetMode(MODE_SAVED_Y);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnProfileCurrentx()		
+{ 
+	m_bitModeDisplay[MODE_PROFILE_X] ? ResetMode(MODE_PROFILE_X) : SetMode(MODE_PROFILE_X);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnProfileCurrenty()		
+{ 
+	m_bitModeDisplay[MODE_PROFILE_Y] ? ResetMode(MODE_PROFILE_Y) : SetMode(MODE_PROFILE_Y);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnProfileProjectionx()	
+{ 
+	m_bitModeDisplay[MODE_PROJECTION_X] ? ResetMode(MODE_PROJECTION_X) : SetMode(MODE_PROJECTION_X);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnProfileProjectiony()	
+{ 
+	m_bitModeDisplay[MODE_PROJECTION_Y] ? ResetMode(MODE_PROJECTION_Y) : SetMode(MODE_PROJECTION_Y);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnProfileSavedx()		
+{ 
+	m_bitModeDisplay[MODE_SAVED_X] ? ResetMode(MODE_SAVED_X) : SetMode(MODE_SAVED_X);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnProfileSavedy()		
+{ 
+	m_bitModeDisplay[MODE_SAVED_Y] ? ResetMode(MODE_SAVED_Y) : SetMode(MODE_SAVED_Y);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnMeasureCheckall()
+{
+	SetMode(MODE_DISTANCE_X);
+	SetMode(MODE_DISTANCE_Y);
+	SetMode(MODE_DIAGONAL);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnMeasureClearall()
+{
+	ResetMode(MODE_DISTANCE_X);
+	ResetMode(MODE_DISTANCE_Y);
+	ResetMode(MODE_DIAGONAL);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnMeasureDistancex()
+{ 
+	m_bitModeDisplay[MODE_DISTANCE_X] ? ResetMode(MODE_DISTANCE_X) : SetMode(MODE_DISTANCE_X);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnMeasureDistancey()
+{ 
+	m_bitModeDisplay[MODE_DISTANCE_Y] ? ResetMode(MODE_DISTANCE_Y) : SetMode(MODE_DISTANCE_Y);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnMeasureDiagonal() 
+{
+	m_bitModeDisplay[MODE_DIAGONAL] ? ResetMode(MODE_DIAGONAL) : SetMode(MODE_DIAGONAL);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnImageManify()
+{
+	m_bitModeDisplay[MODE_MANIFY] ? ResetMode(MODE_MANIFY) : SetMode(MODE_MANIFY);
+	Invalidate(FALSE);
+}
+
+
+void CFrameImg::OnViewCheckall()
+{
+	SetMode(MODE_SHOW_MEASURE_LINE);
+	SetMode(MODE_SHOW_REF_LINE);
+	SetMode(MODE_SHOW_SUB_LINE);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnViewClearall()
+{
+	ResetMode(MODE_SHOW_MEASURE_LINE);
+	ResetMode(MODE_SHOW_REF_LINE);
+	ResetMode(MODE_SHOW_SUB_LINE);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnViewShowMeasureLine()
+{
+	m_bitModeDisplay[MODE_SHOW_MEASURE_LINE] ? ResetMode(MODE_SHOW_MEASURE_LINE) : SetMode(MODE_SHOW_MEASURE_LINE);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnViewShowRefLine()
+{
+	m_bitModeDisplay[MODE_SHOW_REF_LINE] ? ResetMode(MODE_SHOW_REF_LINE) : SetMode(MODE_SHOW_REF_LINE);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnViewShowSubLine()
+{
+	m_bitModeDisplay[MODE_SHOW_SUB_LINE] ? ResetMode(MODE_SHOW_SUB_LINE) : SetMode(MODE_SHOW_SUB_LINE);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::OnImgmodifyDrawbrush()
+{
+	m_bitModeDisplay[MODE_MODIFY_BRUSH] ? ResetMode(MODE_MODIFY_BRUSH) : SetMode(MODE_MODIFY_BRUSH);
+	Invalidate(FALSE);
+}
+
+void CFrameImg::DrawMagnify(CDC &dc)
+{
+	CPoint pt;
+
+
+	pt.x = m_ptOrg.x + int(m_ptMouseCurrent.x  / m_dZoom);
+	pt.y = int(m_ptMouseCurrent.y / m_dZoom);
+
+	if(pt.y < 8) pt.y = 8;
+	if(pt.x < 8) pt.x = 8;
+
+	if(pt.y > m_szImg.cy -50) pt.y	= m_szImg.cy -	50;
+	if(pt.x > m_szImg.cx - 50) pt.x = m_szImg.cx -	50;
+
+	CPixelPtr des(m_ImageMagnify);
+	for( int i=pt.y-7; i<pt.y+8; i++ ) 
+	{
+		for( int j=pt.x-7; j<pt.x+8; j++ ) 
+		{
+			for( int k=0; k<8; k++ ) 
+			{
+				for( int l=0; l<8; l++ ) 
+				{
+					des[((i-(pt.y-7))<<3) +k][((j-(pt.x-7))<<3)+l] = m_pBuffer[i * m_szImg.cx+ j];
+				}
+			}
+		}
+	}
+
+
+	m_ImageMagnify.Draw(dc.GetSafeHdc(),m_ptMouseCurrent.x - 60,m_ptMouseCurrent.y - 60,120,120);
+	CString strTmp;
+	strTmp.Format(_T("%d[x:%d,y:%d]"),m_pBuffer[pt.y * m_szImg.cx + pt.x],pt.x + m_ptOrg.x,pt.y + m_ptOrg.y);
+	dc.TextOut(m_ptMouseCurrent.x - 60 ,m_ptMouseCurrent.y - 60,strTmp);
+
+	/*
+	grp.DrawLine(&m_penRef,pt.x - 60 ,m_ptCur.y	 ,pt.x + 60 ,m_ptCur.y);
+	grp.DrawLine(&m_penRef,m_ptCur.x ,pt.y - 60	 ,m_ptCur.x ,pt.y + 60);
+
+
+	WCHAR		wStr[MAX_PATH];
+	FontFamily	fontFamily(L"奔覆眉");
+	Font		font(&fontFamily,11, FontStyleBold );
+
+	swprintf(wStr, L"%d[%d,%d]",m_Image.GetPixel(m_ptCur.x +  m_nScrStartX,m_ptCur.y) & 0xff,m_ptCur.x +  m_nScrStartX,m_ptCur.y);
+
+	if(m_ptCur.y -10 > 0)
+	grp.DrawString(wStr,-1,&font,PointF((REAL)m_ptCur.x  ,(REAL)m_ptCur.y-10),&m_strBrush);
+	else
+	grp.DrawString(wStr,-1,&font,PointF((REAL)m_ptCur.x  ,(REAL)m_ptCur.y),&m_strBrush);
+	*/
+}
+
+
+void CFrameImg::DrawProfileSaved(CDC &dc ,int nMode, CPoint pt)
+{
+	int x, y;
+	
+	CPen penX(PS_SOLID, 1, RGB(255,255,255));
+	CPen penY(PS_SOLID, 1, RGB(255,255,0));
+	CPen *pOldPen;
+	SIZE  szROIProfile;
+
+	//dc.SetROP2(R2_NOTMERGEPEN);	
+	pOldPen = (CPen*)dc.SelectObject(&penX);
+	int data1,data2;
+	int nProjectionCnt = 1;
+
+
+	if(nMode == 2 || nMode == 3)
+	{
+		nProjectionCnt = 64;
+	}
+
+
+
+	szROIProfile.cx =  CHKMIN(int(m_WndRect.Width()  / m_dZoom), m_szImg.cx);
+	szROIProfile.cy =  int(m_WndRect.Height()     / m_dZoom);   
+
+
+	if(nMode == 0 || nMode == 2)
+	{
+		dc.MoveTo(0	,pt.y);
+		dc.LineTo(m_WndRect.Width()	,pt.y);
+
+		for( x = m_ptOrg.x  ; x < m_ptOrg.x + szROIProfile.cx;x++)
+		{
+			data1 = 0;
+			data2 = 0;
+			for( y = pt.y - m_ptOrg.y  ; y < pt.y - m_ptOrg.y + nProjectionCnt;y++)
+			{
+				data1 +=  m_pBuffer[(y) * m_szImg.cx + x -1];
+				data2 +=  m_pBuffer[(y) * m_szImg.cx + x ];
+			}
+			data1 /= nProjectionCnt;
+			data2 /= nProjectionCnt;
+
+			dc.MoveTo(int((x-1  - m_ptOrg.x)* m_dZoom),data1);
+			dc.LineTo(int((x    - m_ptOrg.x)* m_dZoom),data2);
+		}	
+	}
+	else if(nMode == 1 || nMode == 3)
+	{
+		dc.SelectObject(&penY);
+
+		if(nMode == 3)
+		{
+			if(pt.x > m_szImg.cx -10)
+			{
+				pt.x = m_szImg.cx -10;
+			}
+		}
+		if(pt.x > 0 && pt.x < m_WndRect.Width())
+		{
+			dc.MoveTo(pt.x	, 0);
+			dc.LineTo(pt.x	, m_WndRect.Height());
+
+			int nMaxX = m_ptOrg.x + pt.x + nProjectionCnt;
+			for( y = 1 ; y < szROIProfile.cy;y++)
+			{
+				data1 = 0;
+				data2 = 0;
+				for( x = m_ptOrg.x + pt.x ; x < nMaxX ;x++)
+				{
+					data1 +=  m_pBuffer[int((y -1) * m_szImg.cx + (x / m_dZoom))];
+					data2 +=  m_pBuffer[int((y	)  * m_szImg.cx + (x / m_dZoom))];
+				}
+
+				data1 /= nProjectionCnt;
+				data2 /= nProjectionCnt;
+
+				dc.MoveTo(data1	, int((y -1) * m_dZoom));
+				dc.LineTo(data2 , int(y		 * m_dZoom));
+			}// for
+		}//if
+	}
+
+	dc.SelectObject(pOldPen);
+	dc.SetROP2(R2_COPYPEN); 
+}
+
+
+void CFrameImg::DrawProfile(CDC &dc ,int nMode, CPoint pt)
+{
+	int x, y;
+	CPen penX(PS_SOLID, 1, RGB(0,255,255));
+	CPen penY(PS_SOLID, 1, RGB(255,255,0));
+	CPen *pOldPen;
+	SIZE  szROIProfile;
+
+	dc.SetROP2(R2_NOTMERGEPEN);	
+	pOldPen = (CPen*)dc.SelectObject(&penX);
+	int data1,data2;
+	int nProjectionCnt = 1;
+
+
+	if(nMode == 2 || nMode == 3)
+	{
+		nProjectionCnt = 64;
+	}
+	
+	
+	szROIProfile.cx =  CHKMIN(int(m_WndRect.Width()  / m_dZoom), m_szImg.cx);
+	szROIProfile.cy =  int(m_WndRect.Height()	  / m_dZoom);   
+
+	if(nMode == 0 || nMode == 2)
+	{
+		if(pt.y > 0 && pt.y < m_WndRect.Height())
+		{
+
+			dc.MoveTo(0	,pt.y);
+			dc.LineTo(m_WndRect.Width()	,pt.y);
+
+			for( x = m_ptOrg.x  ; x < m_ptOrg.x + szROIProfile.cx;x++)
+			{
+				data1 = 0;
+				data2 = 0;
+				for( y = pt.y ; y < pt.y + nProjectionCnt;y++)
+				{
+					data1 +=  m_pBuffer[int(y / m_dZoom + 0.5) * m_szImg.cx + x  -1];
+					data2 +=  m_pBuffer[int(y / m_dZoom + 0.5) * m_szImg.cx + x  ];
+				}
+				data1 /= nProjectionCnt;
+				data2 /= nProjectionCnt;
+
+				dc.MoveTo(int((x-1  - m_ptOrg.x)* m_dZoom +0.5),data1);
+				dc.LineTo(int((x    - m_ptOrg.x)* m_dZoom +0.5),data2);
+			}
+		}	
+	}
+	else if(nMode == 1 || nMode == 3)
+	{
+		dc.SelectObject(&penY);
+
+		if(nMode == 3)
+		{
+			if(pt.x > m_szImg.cx -10)
+			{
+				pt.x = m_szImg.cx -10;
+			}
+		}
+		if(pt.x > 0 && pt.x < m_WndRect.Width())
+		{
+			dc.MoveTo(pt.x	, 0);
+			dc.LineTo(pt.x	, m_WndRect.Height());
+
+
+			int nMaxX = m_ptOrg.x + pt.x + nProjectionCnt;
+			for( y = 1 ; y < szROIProfile.cy;y++)
+			{
+
+
+				data1 = 0;
+				data2 = 0;
+				for( x = m_ptOrg.x + pt.x ; x < nMaxX ;x++)
+				{
+					data1 +=  m_pBuffer[int((y -1) * m_szImg.cx + (x / m_dZoom))];
+					data2 +=  m_pBuffer[int((y	)  * m_szImg.cx + (x / m_dZoom))];
+				}
+
+				data1 /= nProjectionCnt;
+				data2 /= nProjectionCnt;
+
+				dc.MoveTo(data1	, int((y -1) * m_dZoom));
+				dc.LineTo(data2 , int(y		 * m_dZoom));
+			}// for
+		}//if
+	}
+
+	dc.SelectObject(pOldPen);
+	dc.SetROP2(R2_COPYPEN); 
+}
+
+CRect CFrameImg::GetCompareRect(void)
+{
+	if(m_pCompareArea != nullptr)
+		return m_pCompareArea->rc;
+	else
+		return CRect(0,0,0,0);
+}
+
+void CFrameImg::ConvertOrgToScreen(CPoint pt,CPoint &det)
+{
+
+}
+
+void CFrameImg::DrawManualMeasure(CDC &dc)
+{
+	
+	CPen penX(PS_SOLID, 1, RGB(0,255,255));
+	CPen penY(PS_SOLID, 1, RGB(255,255,0));
+	CPen *pOldPen;
+	CBrush *pOldBruh;
+
+
+	//dc.SetROP2(R2_NOT);	
+	pOldPen =	(CPen*)dc.SelectObject(&penX);
+	pOldBruh =  (CBrush*)dc.SelectObject(&m_st_GdiItem.brushRed);
+
+
+	CPoint ptStart;
+	CPoint ptEnd;
+
+	ptStart.x = int((m_ManualMeausre.ptMeasureStart.x - m_ptOrg.x) * m_dZoom);
+	ptStart.y = int((m_ManualMeausre.ptMeasureStart.y - m_ptOrg.y) * m_dZoom);
+
+	ptEnd.x =  int((m_ManualMeausre.ptMeasureEnd.x - m_ptOrg.x) * m_dZoom);
+	ptEnd.y =  int((m_ManualMeausre.ptMeasureEnd.y - m_ptOrg.y) * m_dZoom);
+
+	dc.MoveTo(0					, ptStart.y);
+	dc.LineTo(m_WndRect.Width() , ptStart.y);
+	dc.MoveTo(ptStart.x 	, 0);
+	dc.LineTo(ptStart.x  , m_WndRect.Height());
+
+	dc.MoveTo(0					, ptEnd.y);
+	dc.LineTo(m_WndRect.Width() , ptEnd.y);
+	dc.MoveTo(ptEnd.x 	, 0);
+	dc.LineTo(ptEnd.x   , m_WndRect.Height());
+
+
+	(CPen*)dc.SelectObject(&penY);
+	dc.MoveTo(ptStart.x , ptStart.y);
+	dc.LineTo(ptEnd.x	, ptEnd.y);
+
+	dc.MoveTo(ptStart.x - 5,
+		ptStart.y - 5);
+
+	dc.LineTo(ptStart.x + 5,
+		ptStart.y + 5);
+
+	dc.MoveTo(ptStart.x + 5,
+		ptStart.y - 5);
+
+	dc.LineTo(ptStart.x - 5,
+		ptStart.y + 5);
+
+
+	dc.MoveTo(ptEnd.x - 5,
+		ptEnd.y - 5);
+
+	dc.LineTo(ptEnd.x + 5,
+		ptEnd.y + 5);
+
+
+	dc.MoveTo(ptEnd.x + 5,
+		ptEnd.y - 5);
+
+	dc.LineTo(ptEnd.x - 5,
+		ptEnd.y + 5);
+
+
+
+
+	//dc.SetBkMode(OPAQUE);
+	CString strTmp;
+	int nTmp;
+	CRect rc;
+	double dPosX,dPosY;
+
+	rc.top	  = m_ManualMeausre.ptMeasureStart.y;
+	rc.bottom = m_ManualMeausre.ptMeasureStart.y + 20;
+	rc.left	  = m_ManualMeausre.ptMeasureStart.x;
+	rc.right  = m_ManualMeausre.ptMeasureStart.x + 20;
+
+	if(m_ManualMeausre.bModifyStart)
+		m_ManualMeausre.nTextPos = 0;
+	else if(m_ManualMeausre.bModifyEnd || m_ManualMeausre.bStart)
+		m_ManualMeausre.nTextPos = 1;
+	else;
+
+
+	CPoint ptText;
+	const int TextsizeX = 150;
+	const int TextsizeY = 50;
+
+
+
+
+	if(m_ManualMeausre.nTextPos == 0)
+	{
+		if(ptStart.x > m_WndRect.Width()/2)
+			ptText.x  = ptStart.x  - TextsizeX;
+		else
+			ptText.x  = ptStart.x  + 5;
+
+		if(ptStart.y > m_WndRect.Height()/2)
+			ptText.y  =ptStart.y  - TextsizeY;
+		else
+			ptText.y  = ptStart.y  + 5;
+
+	}
+	else
+	{
+		if(ptEnd.x > m_WndRect.Width()/2)
+			ptText.x  = ptEnd.x  - TextsizeX;
+		else
+			ptText.x  = ptEnd.x  + 5;
+
+		if(ptEnd.y > m_WndRect.Height()/2)
+			ptText.y  = ptEnd.y  - TextsizeY;
+		else
+			ptText.y  = ptEnd.y  + 5;
+	}
+
+	dc.SetBkMode(TRANSPARENT);
+	dc.SetTextColor(RGB(255,0,0));
+
+	nTmp	= abs(m_ManualMeausre.ptMeasureStart.x - m_ManualMeausre.ptMeasureEnd.x);
+
+	double		dResH,dResV;
+
+	GetResolution(dResH,dResV);
+	
+	dPosX	= dResH *  nTmp/1000.0;
+	strTmp.Format(_T("X : %4.3f mm [%d pixel]"), dPosX , nTmp);
+	dc.TextOut( ptText.x + 5, ptText.y,strTmp);
+
+
+	dc.SetTextColor(RGB(255,60,160));
+	nTmp = abs(m_ManualMeausre.ptMeasureStart.y - m_ManualMeausre.ptMeasureEnd.y);
+
+
+	dPosY	= dResV  *  nTmp/1000.0;
+	strTmp.Format(_T("Y : %4.3f mm [%d pixel]"),dPosY, nTmp);
+	dc.TextOut( ptText.x + 5, ptText.y + 15 ,strTmp);
+
+
+	dc.SetTextColor(RGB(255,0,0));
+	dPosX = sqrtf(float(dPosX *dPosX + dPosY*dPosY));
+	strTmp.Format(_T("D : %4.3f mm "),dPosX);
+	dc.TextOut( ptText.x + 5, ptText.y + 30 ,strTmp);
+	
+	dc.SelectObject(pOldBruh);
+	dc.SelectObject(pOldPen);
+	dc.SetROP2(R2_COPYPEN); 
+
+}
+
+void CFrameImg::GetResolution(double &dH,double &dV)
+{
+	dH = dV = 0.;
+
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	if(m_pHardware != NULL)
+	{
+		int iScan = m_pHardware->GetScanToDimension((DimensionDir)m_nSide);
+		CCameraSettings *pCamera = m_pHardware->GetCameraSettings(m_nCam,iScan);
+		if(pCamera != NULL)
+		{
+			dH = pCamera->m_dConvResolution[nStageNo];
+			dV = pCamera->m_dScanResolution[nStageNo];
+		}
+	}
+
+	if(dH <= 0)
+		dH = 1.;
+	if(dV <= 0)
+		dV = 1.;
+}
+
+
+void CFrameImg::ViewUpdate(int nOpt /*= 0*/)
+{
+	if(!IsWindowVisible())
+		return;
+
+	CDC     *pDC = GetDC();
+	CDC		memDC;
+	CBitmap Bitmap,*pOldBitmap;
+	SIZE	bitmapSize;
+	CFont *pOldFont = NULL;
+
+	memDC.CreateCompatibleDC(pDC);
+	Bitmap.CreateCompatibleBitmap(pDC,m_WndRect.Width(),m_WndRect.Height());
+
+
+	bitmapSize.cx = int(m_szImg.cx * m_dZoom);
+	bitmapSize.cy = m_szImg.cy;
+
+
+
+
+	m_pBmInfo->bmiHeader.biWidth     = m_szImg.cx;
+	m_pBmInfo->bmiHeader.biHeight    = -int(m_WndRect.Height() / m_dZoom);//(m_szImg.cy);
+	m_pBmInfo->bmiHeader.biSizeImage =  m_pBmInfo->bmiHeader.biWidth *  m_pBmInfo->bmiHeader.biHeight;//m_szImg.cx * (m_szImg.cy / m_dZoom);
+
+
+
+
+	
+	memDC.SetStretchBltMode(COLORONCOLOR);
+
+	//Bitmap.CreateCompatibleBitmap(pDC,bitmapSize.cx,bitmapSize.cy);
+	//Bitmap.CreateCompatibleBitmap(pDC,m_WndRect.Width(),m_WndRect.Height());
+	pOldBitmap = (CBitmap*)memDC.SelectObject(&Bitmap);
+	if(m_pBuffer)
+	{
+	//	StretchDIBits(m_memDC.m_hDC, 0 , 0, bitmapSize.cx , bitmapSize.cy,
+	//		m_ptOrg.x,0,m_pBmInfo->bmiHeader.biWidth,abs(m_pBmInfo->bmiHeader.biHeight),
+	//		m_pBuffer,(BITMAPINFO*)m_pBmInfo,DIB_RGB_COLORS,SRCCOPY);
+
+
+		StretchDIBits(memDC.m_hDC, 0 , 0, m_WndRect.Width(),m_WndRect.Height(),
+					  m_ptOrg.x,0,int(m_WndRect.Width()/ m_dZoom),int(m_WndRect.Height()/ m_dZoom), //m_WndRect.Width(),m_WndRect.Height(),
+					  m_pBuffer,(BITMAPINFO*)m_pBmInfo,DIB_RGB_COLORS,SRCCOPY);
+	}
+
+	if(nOpt == 0 && m_ptOrg.y >= 0)
+	{
+		if(m_bitModeDisplay[MODE_MANIFY])
+			DrawMagnify(memDC);
+
+		if(m_bitModeDisplay[MODE_PROFILE_X])
+			DrawProfile(memDC,0,m_ptMouseCurrent);
+
+		if(m_bitModeDisplay[MODE_PROFILE_Y])
+			DrawProfile(memDC,1,m_ptMouseCurrent);
+
+		if(m_bitModeDisplay[MODE_SAVED_X])
+			DrawProfileSaved(memDC,0,m_ptMouseSaved);
+
+		if(m_bitModeDisplay[MODE_SAVED_Y])
+			DrawProfile(memDC,1,m_ptMouseSaved);
+
+		if(m_bitModeDisplay[MODE_PROJECTION_X])
+			DrawProfile(memDC,2,m_ptMouseCurrent);
+
+		if(m_bitModeDisplay[MODE_PROJECTION_Y])
+			DrawProfile(memDC,3,m_ptMouseCurrent);
+
+
+		if(m_bitModeDisplay[MODE_DISTANCE_X]
+			|| m_bitModeDisplay[MODE_DISTANCE_Y]
+			|| m_bitModeDisplay[MODE_DIAGONAL])
+			DrawManualMeasure(memDC);
+
+		DrawTest(memDC);
+		DrawProcessData(memDC);
+		DrawExpectionAear(memDC);
+		DrawUserDefectArea(memDC);
+		DrawHoleArea(memDC);
+
+		if (m_bitModeDisplay[MODE_SHOW_REF_LINE]) {
+			UpdateView_VisionResult(memDC);
+			UpDateView_MouseDownPos(memDC);
+		}
+
+
+		if(m_bitModeDisplay[MODE_MARK_REG])
+		{
+			Draw_TrakerRect(m_refMark.rc,memDC);
+		}
+		else if(((m_bitModeDisplay[MODE_USER_DEFECT_AREA]) || (m_bitModeDisplay[MODE_COMPARE_PANEL] == true)) && (m_pCompareArea != nullptr))
+		{
+			Draw_CompareRect(m_pCompareArea->rc, memDC);
+		}
+	}
+
+	
+	memDC.SetBkMode(TRANSPARENT);
+	memDC.SetTextColor(RGB(0,0,255));
+	//memDC.SetTextColor(RGB(45,200,45));
+
+	CString str;
+	str.Format(_T("%d"),m_ptOrg.y);
+	memDC.TextOut(m_WndRect.Width() - 50, 10, str);
+
+	int nTmp = int((m_ptMouseCurrent.y / m_dZoom) * m_szImg.cx + m_ptOrg.x + (m_ptMouseCurrent.x / m_dZoom));
+
+	int			nMaxLine = MAX_LIMIT_LINE * IMAGE_WIDTH;
+
+	if(m_szTotBuffer.cy > 0)
+	{
+		nMaxLine = (m_szTotBuffer.cy-1) * IMAGE_HEIGHT  * m_szTotBuffer.cx;
+	}
+
+
+	if(nTmp > -1 && nTmp < nMaxLine && m_ptOrg.y >= 0 && m_ptOrg.x >= 0 && m_pBuffer != NULL)
+	{
+		str.Format(_T("(%d / %d) [%d]"),  m_ptOrg.x + int(m_ptMouseCurrent.x / m_dZoom) , m_ptOrg.y + int(m_ptMouseCurrent.y / m_dZoom)
+			, m_pBuffer[nTmp]);
+		memDC.TextOut(10, m_WndRect.Height() - 45, str);
+
+		if ((0 != m_ptMouseDown.x || 0 != m_ptMouseDown.y) && BlVision_GetVisionRecipe()->getVisionSetOpen()) {    //鼠标改变
+			str.Format(_T("(%d / %d)"), m_ptMouseDown.x, m_ptMouseDown.y);
+			memDC.TextOut(10, m_WndRect.Height() - 25, str);
+
+			Point2I point, result, topResult, botResult;
+			point.x = m_ptMouseDown.x;
+			point.y = m_ptMouseDown.y;
+			if (BlVision_GetSoftVisionApp()->transformToStandard(m_nSide, point, result, topResult, botResult)) {
+				str.Format(_T("(%d / %d)"), result.x, result.y);
+				memDC.TextOut(110, m_WndRect.Height() - 25, str);
+
+				str.Format(_T("(%d / %d)"), topResult.x, topResult.y);
+				memDC.TextOut(210, m_WndRect.Height() - 25, str);
+
+				str.Format(_T("(%d / %d)"), botResult.x, botResult.y);
+				memDC.TextOut(310, m_WndRect.Height() - 25, str);
+			}
+		}
+	}
+
+	pOldFont = (CFont*)memDC.SelectObject(&m_sideFont);
+	memDC.SetTextColor(RGB(45, 200, 45));
+	memDC.TextOut(0,0,PANEL_SIDE_NAME[m_nSide]);
+	memDC.SetBkMode(OPAQUE);
+	
+
+	pDC->BitBlt(0,0,m_WndRect.Width(),m_WndRect.Height(),&memDC,0,0,SRCCOPY);
+
+	if(pOldFont)	memDC.SelectObject(pOldFont);
+
+	memDC.SelectObject(pOldBitmap);
+	Bitmap.DeleteObject();
+	ReleaseDC(&memDC);
+
+	ReleaseDC(pDC);
+}
+
+
+void CFrameImg::DrawTest(CDC &dc)
+{
+	CPen penX(PS_SOLID, 1, RGB(0,255,255));
+	CPen penY(PS_SOLID, 1, RGB(255,255,0));
+	CPen *pOldPen;
+
+	pOldPen = (CPen*)dc.SelectObject(&penX);
+	
+
+
+	dc.MoveTo(int((m_testMark.left - m_ptOrg.x) * m_dZoom),int((m_testMark.top)		* m_dZoom));
+	dc.LineTo(int((m_testMark.right- m_ptOrg.x) * m_dZoom),int((m_testMark.top)		* m_dZoom));
+	dc.LineTo(int((m_testMark.right- m_ptOrg.x) * m_dZoom),int((m_testMark.bottom)	* m_dZoom));
+	dc.LineTo(int((m_testMark.left - m_ptOrg.x) * m_dZoom),int((m_testMark.bottom)	* m_dZoom));
+	dc.LineTo(int((m_testMark.left - m_ptOrg.x) * m_dZoom),int((m_testMark.top)		* m_dZoom));
+
+	dc.MoveTo(int((m_testMark.left - m_ptOrg.x + m_testMark.Width()/2) * m_dZoom),int((m_testMark.top)		* m_dZoom));
+	dc.LineTo(int((m_testMark.left - m_ptOrg.x + m_testMark.Width()/2) * m_dZoom),int((m_testMark.bottom)	* m_dZoom));
+
+	dc.MoveTo(int((m_testMark.left - m_ptOrg.x) * m_dZoom),int((m_testMark.top		+ m_testMark.Height()/2)	* m_dZoom));
+	dc.LineTo(int((m_testMark.right- m_ptOrg.x) * m_dZoom),int((m_testMark.top		+ m_testMark.Height()/2)	* m_dZoom));
+
+
+	dc.SelectObject(pOldPen);
+	dc.SetROP2(R2_COPYPEN);
+}
+
+
+
+void CFrameImg::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊钦聪促.
+	// 弊府扁 皋矫瘤俊 措秦辑绰 CStatic::OnPaint()阑(甫) 龋免窍瘤 付绞矫坷.
+	ViewUpdate();
+}
+
+
+
+
+
+void CFrameImg::OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/)
+{
+	CPoint pt(m_ptMouseCurrent);
+	ClientToScreen(&pt);
+	CMenu muTemp, *pContextMenu;
+
+	muTemp.LoadMenu(IDR_MENU1);
+	pContextMenu = muTemp.GetSubMenu(0);
+
+
+	if(m_bitModeDisplay[MODE_PROFILE_X])
+		pContextMenu->CheckMenuItem(ID_PROFILE_CURRENTX,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_PROFILE_CURRENTX,MF_UNCHECKED);
+
+	if(m_bitModeDisplay[MODE_PROFILE_Y])
+		pContextMenu->CheckMenuItem(ID_PROFILE_CURRENTY,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_PROFILE_CURRENTY,MF_UNCHECKED);
+
+	if(m_bitModeDisplay[MODE_SAVED_X])
+		pContextMenu->CheckMenuItem(ID_PROFILE_SAVEDX,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_PROFILE_SAVEDX,MF_UNCHECKED);
+
+	if(m_bitModeDisplay[MODE_SAVED_Y])
+		pContextMenu->CheckMenuItem(ID_PROFILE_SAVEDY,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_PROFILE_SAVEDY,MF_UNCHECKED);
+
+
+
+	if(m_bitModeDisplay[MODE_PROJECTION_X])
+		pContextMenu->CheckMenuItem(ID_PROFILE_PROJECTIONX,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_PROFILE_PROJECTIONX,MF_UNCHECKED);
+
+	if(m_bitModeDisplay[MODE_PROJECTION_Y])
+		pContextMenu->CheckMenuItem(ID_PROFILE_PROJECTIONY,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_PROFILE_PROJECTIONY,MF_UNCHECKED);
+
+	if(m_bitModeDisplay[MODE_DISTANCE_X])
+		pContextMenu->CheckMenuItem(ID_MEASURE_DISTANCEX,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_MEASURE_DISTANCEX,MF_UNCHECKED);
+
+	if(m_bitModeDisplay[MODE_DISTANCE_Y])
+		pContextMenu->CheckMenuItem(ID_MEASURE_DISTANCEY,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_MEASURE_DISTANCEY,MF_UNCHECKED);
+
+
+/*
+	if(m_bitModeDisplay[MODE_DIAGONAL))
+		pContextMenu->CheckMenuItem(ID_MEASURE_DIAGONAL,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_MEASURE_DIAGONAL,MF_UNCHECKED);
+
+
+	if(m_bitModeDisplay[MODE_MANIFY))
+		pContextMenu->CheckMenuItem(ID_IMAGE_MANIFY,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_IMAGE_MANIFY,MF_UNCHECKED);
+*/
+
+
+	if(m_bitModeDisplay[MODE_SHOW_MEASURE_LINE])
+		pContextMenu->CheckMenuItem(ID_VIEW_SHOW_MEASURE_LINE,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_VIEW_SHOW_MEASURE_LINE,MF_UNCHECKED);
+
+
+	if(m_bitModeDisplay[MODE_SHOW_REF_LINE])
+		pContextMenu->CheckMenuItem(ID_VIEW_SHOW_REF_LINE,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_VIEW_SHOW_REF_LINE,MF_UNCHECKED);
+
+
+/*
+	if(m_bitModeDisplay[MODE_SHOW_SUB_LINE))
+		pContextMenu->CheckMenuItem(ID_VIEW_SHOW_SUB_LINE,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_VIEW_SHOW_SUB_LINE,MF_UNCHECKED);
+*/
+
+
+	if(m_bitModeDisplay[MODE_MODIFY_BRUSH])
+		pContextMenu->CheckMenuItem(ID_IMGMODIFY_DRAWBRUSH,MF_CHECKED);
+	else
+		pContextMenu->CheckMenuItem(ID_IMGMODIFY_DRAWBRUSH,MF_UNCHECKED);
+
+	
+	pContextMenu->TrackPopupMenu(TPM_LEFTALIGN , pt.x, pt.y, this);
+
+}
+
+void CFrameImg::OnMouseMove(UINT nFlags, CPoint point)
+{
+	m_ptMouseCurrent = point;
+
+
+	CString strTemp;
+
+	if(m_bMouseLDown == TRUE)
+	{
+		if(m_pTracker)
+		{
+			if(m_nModeTracker)
+			{
+				::SendMessage(m_Wnd_Event, WM_AREA_ITEM_MODIFY , 0, 0);
+			}
+
+			SetTrackerPos(m_nModeTracker,&m_pTracker->rc,point);
+		}
+		else if((m_pCompareArea != nullptr) && (m_nModeTracker))
+		{
+			::SendMessage(m_Wnd_Event, WM_AREA_ITEM_MODIFY , 0, 0);
+			SetTrackerPos(m_nModeTracker, &(m_pCompareArea->rc), point);
+		}
+
+		if(m_bitModeDisplay[MODE_MODIFY_BRUSH])
+		{
+			int x,y,k,l;
+			x = int(m_ptMouseCurrent.x / m_dZoom)+ m_ptOrg.x;
+			y = int(m_ptMouseCurrent.y / m_dZoom);
+
+			for(k = y -20 ; k < y+20 ; k++)
+			{
+				for(l = x -8; l < x + 8 ; l++)
+				{
+					m_pBuffer[k * m_szImg.cx  + l ] = 5;
+				}
+			}
+		}
+	}
+	//	m_ptOldMouse = point;
+
+
+	if(m_ManualMeausre.bStart == TRUE || m_ManualMeausre.bModifyEnd == TRUE)
+	{
+		m_ManualMeausre.ptMeasureEnd.x	= int(m_ptMouseCurrent.x / m_dZoom)  + m_ptOrg.x;
+		m_ManualMeausre.ptMeasureEnd.y	= int(m_ptMouseCurrent.y / m_dZoom)  + m_ptOrg.y;
+	}
+	else if(m_ManualMeausre.bModifyStart == TRUE)
+	{
+		m_ManualMeausre.ptMeasureStart.x = int(m_ptMouseCurrent.x / m_dZoom) + m_ptOrg.x;	
+		m_ManualMeausre.ptMeasureStart.y = int(m_ptMouseCurrent.y / m_dZoom)  + m_ptOrg.y;
+	}
+
+
+	ViewUpdate();
+	CWnd::OnMouseMove(nFlags, point);
+}
+
+CRect CFrameImg::GetMartRect()
+{
+	return m_refMark.rc;
+}
+
+void CFrameImg::SetMarkRect(CRect rc)
+{
+	m_refMark.rc = rc;
+}
+
+
+
+void CFrameImg::OnLButtonDown(UINT nFlags, CPoint point)
+{
+
+
+	m_ptMouseCurrent = point;
+	m_ptOldMouse	 = point;
+	m_bMouseLDown	 = TRUE;
+
+	if (m_bMouseLDown) {
+		m_ptMouseDown.x = m_ptOrg.x + int(m_ptMouseCurrent.x / m_dZoom);
+		m_ptMouseDown.y = m_ptOrg.y + int(m_ptMouseCurrent.y / m_dZoom);
+	}
+
+	if(m_bitModeDisplay[MODE_MARK_REG])
+	{
+		CPoint pt;
+
+		pt.x = int(point.x / m_dZoom + m_ptOrg.x);
+		pt.y = int(point.y/ m_dZoom  + m_ptOrg.y);
+
+		if(m_pTracker != NULL)
+			m_nModeTracker = (ChkTrackerAear(m_pTracker->rc,pt));
+	}
+	else if(((m_bitModeDisplay[MODE_USER_DEFECT_AREA]) ||(m_bitModeDisplay[MODE_COMPARE_PANEL] == 1)) && (m_pCompareArea != nullptr))
+	{
+		CPoint pt;
+
+		pt.x = static_cast<long>(point.x / m_dZoom) + m_ptOrg.x;
+		pt.y = static_cast<long>(point.y / m_dZoom) + m_ptOrg.y;
+
+		m_nModeTracker = ChkTrackerAear(m_pCompareArea->rc, pt);
+		SetTrackerPos(m_nModeTracker, &(m_pCompareArea->rc), point, 1);
+	}
+	else
+	{
+		m_nModeTracker = ChkExpetionAear(point);
+	}
+
+	if(m_pTracker != NULL)
+		SetTrackerPos(m_nModeTracker,&m_pTracker->rc,point,1);
+
+	CPoint ptTmp = point;
+
+	ptTmp.x = int(point.x / m_dZoom);
+	ptTmp.y = int(point.y / m_dZoom);
+
+#define PIT_INT_RANGE 30
+
+	if(m_ManualMeausre.bStart == FALSE)
+	{
+		if( m_ManualMeausre.ptMeasureStart.x  > ptTmp.x + m_ptOrg.x - PIT_INT_RANGE 
+		&&  m_ManualMeausre.ptMeasureStart.x  < ptTmp.x + m_ptOrg.x + PIT_INT_RANGE
+		&&  m_ManualMeausre.ptMeasureStart.y  > ptTmp.y + m_ptOrg.y - PIT_INT_RANGE 
+		&&  m_ManualMeausre.ptMeasureStart.y  < ptTmp.y + m_ptOrg.y + PIT_INT_RANGE )
+		{
+			if(m_ManualMeausre.bModifyStart)
+				m_ManualMeausre.bModifyStart = FALSE;
+			else
+				m_ManualMeausre.bModifyStart = TRUE;
+
+		}
+		else if(m_ManualMeausre.ptMeasureEnd.x  >  ptTmp.x + m_ptOrg.x - PIT_INT_RANGE 
+			&&	m_ManualMeausre.ptMeasureEnd.x  <  ptTmp.x + m_ptOrg.x + PIT_INT_RANGE
+			&&  m_ManualMeausre.ptMeasureEnd.y  >  ptTmp.y + m_ptOrg.y - PIT_INT_RANGE 
+			&&  m_ManualMeausre.ptMeasureEnd.y   < ptTmp.y + m_ptOrg.y + PIT_INT_RANGE )
+		{
+			if(m_ManualMeausre.bModifyEnd)
+				m_ManualMeausre.bModifyEnd = FALSE;
+			else
+				m_ManualMeausre.bModifyEnd = TRUE;
+		}
+		else
+		{
+			m_ManualMeausre.bModifyStart	= FALSE;
+			m_ManualMeausre.bModifyEnd		= FALSE;
+			m_ManualMeausre.bStart			= TRUE;
+			
+			m_ManualMeausre.ptMeasureStart.x= ptTmp.x  + m_ptOrg.x;
+			m_ManualMeausre.ptMeasureStart.y= ptTmp.y  + m_ptOrg.y;
+		}
+	}
+	else
+	{
+		m_ManualMeausre.bStart			= FALSE;
+	}
+
+	m_ptMouseSaved.x = point.x;
+	m_ptMouseSaved.y = int(point.y / m_dZoom)  +m_ptOrg.y;
+	//m_ptMouseSaved	= point; 
+
+	ViewUpdate();
+	CWnd::OnLButtonDown(nFlags, point);
+}
+
+void CFrameImg::OnLButtonUp(UINT nFlags, CPoint point)
+{
+	m_bMouseLDown	= FALSE;
+	ViewUpdate();
+	CWnd::OnLButtonUp(nFlags, point);
+}
+
+
+
+void CFrameImg::TrackerInsert()
+{
+	/*
+	EXECPTION_AREA *pTracker = new EXECPTION_AREA;
+
+
+	pTracker->szErrSize.cx = 300;
+	pTracker->szErrSize.cy = 300;
+
+	pTracker->nAppDefect = 1;
+
+
+	pTracker->rc.top	 = m_ptOrg.y + 100 - g_InsData[m_nLocalSide].ptMark[0].y; 
+	pTracker->rc.bottom	 = m_ptOrg.y + 200 - g_InsData[m_nLocalSide].ptMark[0].y;
+	pTracker->rc.left	 = m_ptOrg.x + 100 - g_InsData[m_nLocalSide].ptMark[0].x;
+	pTracker->rc.right	 = m_ptOrg.x + 200 - g_InsData[m_nLocalSide].ptMark[0].x;
+
+	m_Exception[m_nLocalSide].push_back(pTracker);
+
+	SetAcitveTracker(pTracker);
+	*/
+}
+
+
+BOOL CFrameImg::SetAcitveTracker(EXECPTION_AREA *pTracker,BOOL bReDraw /*= TRUE*/)
+{
+//	if(pTracker == NULL)
+	//	return FALSE;
+
+	m_pTracker = pTracker;
+	
+	if(bReDraw)	ViewUpdate();
+
+	return TRUE;
+}
+
+void CFrameImg::SetTrackerPos(int nTrackerMode,CRect * pRc,CPoint pt, int nMode /*= 0*/)
+{
+	if(m_pGlassData == NULL)
+		return;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+	if(pResInfo == NULL)
+		return;
+
+	double dOffsetX = (pResInfo->ptMark[1].x - pResInfo->ptMark[0].x) / double(pResInfo->ptMark[1].y - pResInfo->ptMark[0].y);		
+
+	pt.x  = int(pt.x / m_dZoom);
+	pt.y  = int(pt.y / m_dZoom);
+
+	if((m_bitModeDisplay[MODE_MARK_REG] == 1) || (m_bitModeDisplay[MODE_COMPARE_PANEL] == 1) || (m_bitModeDisplay[MODE_USER_DEFECT_AREA]))
+	{
+		pt.y = pt.y + m_ptOrg.y;// - m_pInsData->ptMark[0].y;
+		pt.x = pt.x + m_ptOrg.x;// - m_pInsData->ptMark[0].x - int(pt.y * m_pInsData->dOffsetX);
+	}
+	else
+	{
+		pt.y = int(pt.y + m_ptOrg.y - pResInfo->ptMark[0].y);
+		pt.x = int(pt.x + m_ptOrg.x - pResInfo->ptMark[0].x - int(pt.y * dOffsetX));
+	}
+
+	if(nMode == 1)
+	{
+		m_ptOldMouse = pt;
+		return;
+	}
+
+	const int nOffSet = 10;
+
+	switch(nTrackerMode)
+	{
+	case 1:
+		if(pRc->bottom - nOffSet < pt.y)
+			pRc->top = pRc->bottom - nOffSet;
+		else
+			pRc->top   = pt.y;
+
+		if(pRc->right - nOffSet < pt.x)
+			pRc->right = pRc->right -nOffSet;
+		else
+			pRc->left  = pt.x;
+		break;
+
+	case 2:
+		if(pRc->bottom - nOffSet < pt.y)
+			pRc->top = pRc->bottom - nOffSet;
+		else
+			pRc->top		= pt.y;
+
+		if(pRc->left + nOffSet > pt.x)
+			pRc->right = pRc->left + nOffSet;
+		else
+			pRc->right	= pt.x;
+		break;
+
+	case 3:
+		if(pRc->top + nOffSet > pt.y)
+			pRc->bottom = pRc->top + nOffSet;
+		else
+			pRc->bottom   = pt.y;
+
+		if(pRc->right - nOffSet < pt.x)
+			pRc->right = pRc->right -nOffSet;
+		else
+			pRc->left		= pt.x;
+		break;
+
+	case 4:
+		if(pRc->top + nOffSet > pt.y)
+			pRc->bottom = pRc->top + nOffSet;
+		else
+			pRc->bottom   = pt.y;
+
+		if(pRc->left + nOffSet > pt.x)
+			pRc->right = pRc->left + nOffSet;
+		else
+			pRc->right	= pt.x;
+		break;
+
+	case 5:
+		pRc->left		+= (pt.x - m_ptOldMouse.x);	
+		pRc->right		+= (pt.x - m_ptOldMouse.x);	
+		pRc->top		+= (pt.y - m_ptOldMouse.y);	
+		pRc->bottom		+= (pt.y - m_ptOldMouse.y);	
+		break;
+	}
+	m_ptOldMouse = pt;
+}
+
+void CFrameImg::SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe)
+{
+	m_pHardware = pHW;
+	m_pRecipe = pRecipe;
+}
+
+int CFrameImg::GetSideCamID(int nSide)
+{
+	int nCam	= 0;	
+
+	if(m_pHardware != NULL)
+	{
+		nCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)nSide);
+	}	
+	
+	return nCam;
+}
+
+int CFrameImg::GetSideScanIdx(int nSide)
+{
+	int iScan	= 0;	
+
+	if(m_pHardware != NULL)
+	{
+		iScan = m_pHardware->GetScanToDimension((DimensionDir)nSide);
+	}	
+
+	return iScan;
+}
+
+void CFrameImg::SetSide(int nSide)
+{
+	m_nSide	= nSide;
+	m_nCam  = GetSideCamID(m_nSide);
+}
+
+void CFrameImg::Draw_TrakerRect(CRect rcTracker,CDC &dc)
+{
+	CPen pen(PS_SOLID, 1, RGB(255,0,0));
+	CPen *pOldPen;
+
+	const int nWidth = 2;
+	dc.SetBkMode(TRANSPARENT);
+	pOldPen		= (CPen*)dc.SelectObject(&pen);
+
+	//Draw_Rectangle(dc,m_rcTraker);
+	CPoint ptOrg;
+
+	ptOrg.x = int(m_ptOrg.x * m_dZoom);
+	ptOrg.y = int(m_ptOrg.y * m_dZoom);
+
+	rcTracker.left		= int(rcTracker.left	* m_dZoom);
+	rcTracker.right		= int(rcTracker.right	* m_dZoom);
+	rcTracker.top		= int(rcTracker.top		* m_dZoom);
+	rcTracker.bottom	= int(rcTracker.bottom	* m_dZoom);
+
+	dc.MoveTo(rcTracker.left	+ nWidth - ptOrg.x, rcTracker.top				- ptOrg.y);
+	dc.LineTo(rcTracker.right	- nWidth - ptOrg.x, rcTracker.top				- ptOrg.y);
+
+	dc.MoveTo(rcTracker.right			 - ptOrg.x, rcTracker.top	 + nWidth	- ptOrg.y);
+	dc.LineTo(rcTracker.right			 - ptOrg.x, rcTracker.bottom - nWidth	- ptOrg.y);
+
+	dc.MoveTo(rcTracker.right	- nWidth - ptOrg.x, rcTracker.bottom			- ptOrg.y);
+	dc.LineTo(rcTracker.left	+ nWidth - ptOrg.x, rcTracker.bottom			- ptOrg.y);
+
+	dc.MoveTo(rcTracker.left			 - ptOrg.x	, rcTracker.bottom - nWidth- ptOrg.y);
+	dc.LineTo(rcTracker.left			 - ptOrg.x	, rcTracker.top + nWidth   - ptOrg.y);
+
+
+	CRect rc1;
+
+	rc1.top		= rcTracker.top	- nWidth		- ptOrg.y;
+	rc1.bottom	= rcTracker.top	+ nWidth		- ptOrg.y;
+	rc1.left	= rcTracker.left	- nWidth	- ptOrg.x;
+	rc1.right	= rcTracker.left	+ nWidth	- ptOrg.x;
+
+	Draw_Rectangle(dc,rc1);
+
+	rc1.top		= rcTracker.top	- nWidth		- ptOrg.y;
+	rc1.bottom	= rcTracker.top	+ nWidth		- ptOrg.y;
+	rc1.left	= rcTracker.right	- nWidth	- ptOrg.x;
+	rc1.right	= rcTracker.right	+ nWidth	- ptOrg.x;
+
+	Draw_Rectangle(dc,rc1);
+
+	rc1.top		= rcTracker.bottom - nWidth		- ptOrg.y;
+	rc1.bottom	= rcTracker.bottom + nWidth		- ptOrg.y;
+	rc1.left	= rcTracker.left	- nWidth	- ptOrg.x;
+	rc1.right	= rcTracker.left	+ nWidth	- ptOrg.x;
+
+	Draw_Rectangle(dc,rc1);
+
+	rc1.top		= rcTracker.bottom - nWidth		- ptOrg.y;
+	rc1.bottom	= rcTracker.bottom + nWidth		- ptOrg.y;
+	rc1.left	= rcTracker.right	- nWidth	- ptOrg.x;
+	rc1.right	= rcTracker.right	+ nWidth	- ptOrg.x;
+
+	Draw_Rectangle(dc,rc1);
+	dc.SelectObject(&pOldPen);
+}
+
+
+void CFrameImg::Draw_CompareRect(CRect rcCompareArea, CDC &dc)
+{
+	CPen pen(PS_SOLID, 2, RGB(255,0,0));
+	CPen *pOldPen;
+
+	const int nWidth = 2;
+	dc.SetBkMode(TRANSPARENT);
+	dc.SetTextColor(m_st_GdiItem.colorOrange);
+	pOldPen		= (CPen*)dc.SelectObject(&pen);
+
+	CPoint ptOrg;
+	ptOrg.x = static_cast<long>(m_ptOrg.x * m_dZoom);
+	ptOrg.y = static_cast<long>(m_ptOrg.y * m_dZoom);
+
+	rcCompareArea.left	= static_cast<long>(rcCompareArea.left	* m_dZoom);
+	rcCompareArea.right = static_cast<long>(rcCompareArea.right	* m_dZoom);
+	rcCompareArea.top	= static_cast<long>(rcCompareArea.top * m_dZoom);
+	rcCompareArea.bottom = static_cast<long>(rcCompareArea.bottom	* m_dZoom);
+
+	dc.MoveTo(rcCompareArea.left + nWidth - ptOrg.x, rcCompareArea.top - ptOrg.y);
+	dc.LineTo(rcCompareArea.right - nWidth - ptOrg.x, rcCompareArea.top - ptOrg.y);
+
+	dc.MoveTo(rcCompareArea.right - ptOrg.x, rcCompareArea.top + nWidth	- ptOrg.y);
+	dc.LineTo(rcCompareArea.right - ptOrg.x, rcCompareArea.bottom - nWidth - ptOrg.y);
+
+	dc.MoveTo(rcCompareArea.right- nWidth - ptOrg.x, rcCompareArea.bottom	- ptOrg.y);
+	dc.LineTo(rcCompareArea.left + nWidth - ptOrg.x, rcCompareArea.bottom - ptOrg.y);
+
+	dc.MoveTo(rcCompareArea.left - ptOrg.x, rcCompareArea.bottom - nWidth- ptOrg.y);
+	dc.LineTo(rcCompareArea.left - ptOrg.x, rcCompareArea.top + nWidth - ptOrg.y);
+
+	CString strAreaText;
+	strAreaText.Format(_T("X:%ld, Y:%ld, W:%ld, H:%ld"), 
+		rcCompareArea.left,
+		rcCompareArea.top,
+		(rcCompareArea.right-rcCompareArea.left),
+		(rcCompareArea.bottom-rcCompareArea.top));
+	dc.TextOut(rcCompareArea.left - ptOrg.x, rcCompareArea.top - ptOrg.y -20, strAreaText);
+
+	CRect rcPoint;
+	rcPoint.top		= rcCompareArea.top	- nWidth - ptOrg.y;
+	rcPoint.bottom	= rcCompareArea.top	+ nWidth - ptOrg.y;
+	rcPoint.left	= rcCompareArea.left	- nWidth - ptOrg.x;
+	rcPoint.right	= rcCompareArea.left	+ nWidth - ptOrg.x;
+	Draw_Rectangle(dc,rcPoint);
+
+	rcPoint.top = rcCompareArea.top	- nWidth - ptOrg.y;
+	rcPoint.bottom	= rcCompareArea.top	+ nWidth - ptOrg.y;
+	rcPoint.left	= rcCompareArea.right	- nWidth - ptOrg.x;
+	rcPoint.right	= rcCompareArea.right	+ nWidth - ptOrg.x;
+	Draw_Rectangle(dc,rcPoint);
+
+	rcPoint.top = rcCompareArea.bottom - nWidth	- ptOrg.y;
+	rcPoint.bottom	= rcCompareArea.bottom + nWidth	- ptOrg.y;
+	rcPoint.left	= rcCompareArea.left - nWidth - ptOrg.x;
+	rcPoint.right	= rcCompareArea.left + nWidth - ptOrg.x;
+	Draw_Rectangle(dc,rcPoint);
+
+	rcPoint.top = rcCompareArea.bottom - nWidth - ptOrg.y;
+	rcPoint.bottom	= rcCompareArea.bottom + nWidth	- ptOrg.y;
+	rcPoint.left	= rcCompareArea.right - nWidth - ptOrg.x;
+	rcPoint.right	= rcCompareArea.right + nWidth - ptOrg.x;
+	Draw_Rectangle(dc,rcPoint);
+
+	dc.SelectObject(&pOldPen);
+}
+
+void CFrameImg::Draw_Rectangle(CDC &dc,CRect rc, int nMode /*= 0*/)
+{
+
+	dc.MoveTo(rc.left	, rc.top);
+	dc.LineTo(rc.right	, rc.top);
+	dc.LineTo(rc.right	, rc.bottom);
+	dc.LineTo(rc.left	, rc.bottom);
+	dc.LineTo(rc.left	, rc.top);
+
+	if(nMode == 1)
+	{
+		dc.MoveTo(rc.left	, rc.top + rc.Height()/2);
+		dc.LineTo(rc.right	, rc.top + rc.Height()/2);
+
+
+		dc.MoveTo(rc.left + rc.Width()/2	, rc.top);
+		dc.LineTo(rc.left + rc.Width()/2	, rc.bottom);
+	}
+}
+
+
+
+
+int CFrameImg::ChkTrackerAear(CRect &rcTracker,CPoint pt)
+{
+	int nMode = 0;
+
+
+	CRect rcTmp;
+	//pt.y = pt.y + m_ptOrg.y  / m_dZoom;
+	//pt.x = pt.x + m_ptOrg.x  / m_dZoom;
+
+	const int nOffset = 10;
+
+	rcTmp.top	 = rcTracker.top	- nOffset;
+	rcTmp.bottom = rcTracker.top	+ nOffset;
+	rcTmp.left	 = rcTracker.left	- nOffset;
+	rcTmp.right	 = rcTracker.left	+ nOffset;
+
+	if(rcTmp.PtInRect(pt))
+	{
+		nMode = 1;
+	}
+
+	rcTmp.top	 = rcTracker.top	- nOffset;
+	rcTmp.bottom = rcTracker.top	+ nOffset;
+	rcTmp.left	 = rcTracker.right	- nOffset;
+	rcTmp.right	 = rcTracker.right	+ nOffset;
+
+	if(rcTmp.PtInRect(pt))
+	{
+		nMode = 2;
+	}
+
+
+	rcTmp.top	 = rcTracker.bottom	- nOffset;
+	rcTmp.bottom = rcTracker.bottom	+ nOffset;
+	rcTmp.left	 = rcTracker.left	- nOffset;
+	rcTmp.right	 = rcTracker.left	+ nOffset;
+
+	if(rcTmp.PtInRect(pt))
+	{
+		nMode = 3;
+	}
+
+	rcTmp.top	 = rcTracker.bottom	- nOffset;
+	rcTmp.bottom = rcTracker.bottom	+ nOffset;
+	rcTmp.left	 = rcTracker.right		- nOffset;
+	rcTmp.right	 = rcTracker.right		+ nOffset;
+
+	if(rcTmp.PtInRect(pt))
+	{
+		nMode = 4;
+	}
+
+	if(rcTracker.PtInRect(pt))
+	{
+		nMode = 5;
+	}
+
+	return nMode;
+}
+
+
+
+int CFrameImg::ChkExpetionAear(CPoint pt)
+{
+	if(m_pGlassData == NULL || m_pRecipe == NULL)
+		return 0;
+
+	int nMode = 0;
+	CRect rcTmp;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+	if(pResInfo == NULL)
+		return 0;
+
+	double dOffsetX = (pResInfo->ptMark[1].x - pResInfo->ptMark[0].x) / double(pResInfo->ptMark[1].y - pResInfo->ptMark[0].y);		
+
+	EXCEPTION_AREA_LIST *pExpList = m_pRecipe->GetExpAreaList((DimensionDir)m_nSide);
+	if(pExpList == NULL)
+		return 0;
+
+	pt.x  = int(pt.x / m_dZoom);
+	pt.y  = int(pt.y / m_dZoom);
+
+
+	pt.y = int((pt.y + m_ptOrg.y) - pResInfo->ptMark[0].y);
+	pt.x = int((pt.x + m_ptOrg.x) - pResInfo->ptMark[0].x - int(pt.y * dOffsetX));
+
+	itEXCEPTION_AREA_LIST it;
+	const int nOffset = 8;
+	for(it = pExpList->begin(); it != pExpList->end() ; it++)
+	{		
+
+		nMode = ChkTrackerAear((*it)->rc,pt);
+		if(nMode)
+			break;
+	}
+
+	if(m_bModify == TRUE)
+	{
+		if(nMode)
+		{
+			if(m_pTracker !=  (*it))
+			{
+				SetAcitveTracker((*it));
+				::SendMessage(m_Wnd_Event	, WM_AREA_ITEM_SELECT_CHANGE , 0, 0);
+			}
+			else
+			{
+				::SendMessage(m_Wnd_Event	, WM_AREA_ITEM_MODIFY , 0, 0);
+			}
+		}
+	}
+	return nMode;
+}
+
+void CFrameImg::DrawCADRCutChamfertResult(CDC &dc,CvPoint2D32f *ptMark)
+{
+	if(m_pGlassData == NULL || m_pRecipe == NULL)
+		return;	
+
+	switch(m_nSide)
+	{	
+	case DIMENSION_A_DN:
+	case DIMENSION_D_DN:
+	case DIMENSION_C:
+	case DIMENSION_C_DN:	
+		return;
+	}		
+
+	int				nIndex[2],nSize[2];
+	CString			str;
+
+	int				nUpDn = 1;	
+	int				x,y,k;
+	int				nOffset = (int)(3*m_dZoom);		
+	CPoint			ptTxt;	
+	CString			strDraw;
+
+	int			nIndexCunt = 1;
+
+	if(m_pRecipe->m_GlassParm.m_bPanelReverse == FALSE)
+	{
+		switch(m_nSide)
+		{
+		case DIMENSION_A:
+		case DIMENSION_A_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(1,nIndex[0],nSize[0],strDraw) == FALSE) // A 惑螟 开规氢, Q1(65) ~ Q4(69)
+				return;
+			if(m_pGlassData->GetProfileRCutInspectIndex(0,nIndex[1],nSize[1],strDraw) == FALSE) // A 窍螟 沥规氢, P1(60) ~ P4(64)
+				return;
+			nIndexCunt = 2;
+			break;
+		case DIMENSION_B:
+		case DIMENSION_B_DN:		
+			if(m_pGlassData->GetProfileRCutInspectIndex(2,nIndex[0],nSize[0],strDraw) == FALSE) // B 窍螟 沥规氢, N1(75) ~ N4(79)
+				return;
+			break;
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(3,nIndex[0],nSize[0],strDraw) == FALSE) // D 窍螟 开规氢, Q1(70) ~ Q4(74)
+				return;
+			break;
+		default:
+			return;
+		}
+	}
+	else
+	{
+		switch(m_nSide)
+		{
+		case DIMENSION_A:
+		case DIMENSION_A_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(0,nIndex[0],nSize[0],strDraw) == FALSE) // A 惑螟 沥规氢, P1(60) ~ P4(64)
+				return;
+			if(m_pGlassData->GetProfileRCutInspectIndex(1,nIndex[1],nSize[1],strDraw) == FALSE) // A 窍螟 开规氢, Q1(75) ~ Q4(79)
+				return;
+			nIndexCunt = 2;
+			break;
+		case DIMENSION_B:
+		case DIMENSION_B_DN:		
+			if(m_pGlassData->GetProfileRCutInspectIndex(3,nIndex[0],nSize[0],strDraw) == FALSE) // B 窍螟 开规氢, Q1(70) ~ Q4(74)
+				return;
+			break;
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(2,nIndex[0],nSize[0],strDraw) == FALSE) // D 窍螟 沥规氢, N1(65) ~ N4(69)
+				return;
+			break;
+		}
+	}
+
+	CPen   pen1(PS_SOLID, 1, RGB(255,255,0));
+	CPen   pen2(PS_SOLID, 1, RGB(0,255,0));	
+	CHAMFER_RESULT *pChamfer;
+
+	PROFILECHAMFER_RESULT_DATA *pProfileResult = m_pGlassData->GetProfileInspectData();
+	for(k=0;k<nIndexCunt;k++)
+	{	
+		for(int i=nIndex[k];i<nIndex[k]+nSize[k];i++)
+		{
+			pChamfer =	&pProfileResult->ResultChamfer[i][0];
+
+			dc.SelectObject(&pen2);
+
+			x = int((pChamfer->ptGlassLine.x - m_ptOrg.x) * m_dZoom);
+			y = int((pChamfer->ptGlassLine.y - m_ptOrg.y) * m_dZoom);
+
+			dc.MoveTo(x-nOffset,y-nOffset);
+			dc.LineTo(x + nOffset,y+nOffset);
+			dc.MoveTo(x-nOffset,y+nOffset);
+			dc.LineTo(x + nOffset,y-nOffset);	
+
+			ptTxt = CPoint(x-60,y-8);
+
+			dc.SelectObject(&pen1);
+
+			x = int((pChamfer->ptChamferLine.x - m_ptOrg.x) * m_dZoom);
+			y = int((pChamfer->ptChamferLine.y - m_ptOrg.y) * m_dZoom);
+
+			dc.MoveTo(x-nOffset,y-nOffset);
+			dc.LineTo(x + nOffset,y+nOffset);
+			dc.MoveTo(x-nOffset,y+nOffset);
+			dc.LineTo(x + nOffset,y-nOffset);	
+
+			dc.SetBkMode(TRANSPARENT);
+			//if(pProRes[i].bProfileJudge == TRUE && pProRes[i].stChamfer[nUpDn].bChamferJudge == TRUE)		
+			dc.SetTextColor(m_st_GdiItem.colorBlue);		
+			//else
+			//	dc.SetTextColor(m_st_GdiItem.colorRed);
+
+			strDraw.Format(_T("R_%d"),pChamfer->iIndex+1);
+			dc.TextOut(ptTxt.x ,ptTxt.y,strDraw);
+		}		
+	}
+}
+
+void CFrameImg::DrawCADRCutProfiletResult(CDC &dc,CvPoint2D32f *ptMark)
+{
+	if(m_pGlassData == NULL || m_pRecipe == NULL)
+		return;	
+
+	switch(m_nSide)
+	{
+	case DIMENSION_A:
+	case DIMENSION_B:
+	case DIMENSION_C:
+	case DIMENSION_C_DN:		
+		return;
+	}		
+
+	int				nIndex[2],nSize[2];
+	CString			str;
+	
+	int				nUpDn = 1;	
+	int				x,y,k;
+	int				nOffset = (int)(5*m_dZoom);		
+	CPoint			ptTxt;	
+	CString			strDraw;
+
+	if(m_nSide < MAX_PANEL_SIDE)
+		nUpDn = 0;
+
+	CPen   pen1(PS_SOLID, 1, RGB(128,255,255));
+	CPen   pen2(PS_SOLID, 2, RGB(0,255,0));
+	CPen   pen3(PS_SOLID, 1, RGB(255,255,0));
+	CPen   pen4(PS_SOLID, 1, RGB(0,255,0));	
+	CPen   pen5(PS_DASH, 1,RGB(0,255,255));	
+	
+	int			nIndexCunt = 1;
+
+	if(m_pRecipe->m_GlassParm.m_bPanelReverse == FALSE)
+	{
+		switch(m_nSide)
+		{
+		case DIMENSION_A:
+		case DIMENSION_A_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(1,nIndex[0],nSize[0],strDraw) == FALSE) // A 惑螟 开规氢, Q1(65) ~ Q4(69)
+				return;
+			if(m_pGlassData->GetProfileRCutInspectIndex(0,nIndex[1],nSize[1],strDraw) == FALSE) // A 窍螟 沥规氢, P1(60) ~ P4(64)
+				return;
+			nIndexCunt = 2;
+			break;
+		case DIMENSION_B:
+		case DIMENSION_B_DN:		
+			if(m_pGlassData->GetProfileRCutInspectIndex(2,nIndex[0],nSize[0],strDraw) == FALSE) // B 窍螟 沥规氢, N1(75) ~ N4(79)
+				return;
+			break;
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(3,nIndex[0],nSize[0],strDraw) == FALSE) // D 窍螟 开规氢, Q1(70) ~ Q4(74)
+				return;
+			break;
+		default:
+			return;
+		}
+	}
+	else
+	{
+		switch(m_nSide)
+		{
+		case DIMENSION_A:
+		case DIMENSION_A_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(0,nIndex[0],nSize[0],strDraw) == FALSE) // A 惑螟 沥规氢, P1(60) ~ P4(64)
+				return;
+			if(m_pGlassData->GetProfileRCutInspectIndex(1,nIndex[1],nSize[1],strDraw) == FALSE) // A 窍螟 开规氢, Q1(75) ~ Q4(79)
+				return;
+			nIndexCunt = 2;
+			break;
+		case DIMENSION_B:
+		case DIMENSION_B_DN:		
+			if(m_pGlassData->GetProfileRCutInspectIndex(3,nIndex[0],nSize[0],strDraw) == FALSE) // B 窍螟 开规氢, Q1(70) ~ Q4(74)
+				return;
+			break;
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			if(m_pGlassData->GetProfileRCutInspectIndex(2,nIndex[0],nSize[0],strDraw) == FALSE) // D 窍螟 沥规氢, N1(65) ~ N4(69)
+				return;
+			break;
+		}
+	}
+
+	for(k=0;k<nIndexCunt;k++)
+	{		
+		PROFILECHAMFER_RESULT_DATA *pProfileResult = m_pGlassData->GetProfileInspectData();
+
+		PROFILE_RCUT_PROCESSDATA *pProRes = &pProfileResult->RCutProcessData[nIndex[k]];
+
+		dc.SelectObject(&pen2);
+
+		x = int((pProRes[0].dCenterX - m_ptOrg.x) * m_dZoom);
+		y = int((pProRes[0].dCenterY - m_ptOrg.y) * m_dZoom);
+
+		dc.MoveTo(x-nOffset*2,y);
+		dc.LineTo(x + nOffset*2,y);
+		dc.MoveTo(x,y+nOffset*2);
+		dc.LineTo(x,y-nOffset*2);	
+
+	
+		CPoint		ptArc = CPoint((int)pProRes[0].dCenterX,(int)pProRes[0].dCenterY);
+		int			nRadius = (int)(pProRes[0].dPixelRadius* m_dZoom);
+
+		ptArc.x = int((pProRes[0].dCenterX - m_ptOrg.x) * m_dZoom);
+		ptArc.y = int((pProRes[0].dCenterY - m_ptOrg.y) * m_dZoom);
+
+		/*
+		dc.SelectObject(&pen4);
+		dc.SetBkMode(TRANSPARENT);
+
+		dc.SelectObject(GetStockObject(NULL_BRUSH));
+		dc.Ellipse(ptArc.x-nRadius,ptArc.y-nRadius,ptArc.x+nRadius,ptArc.y+nRadius);
+	*/
+
+		for(int i=0;i<nSize[k];i++)
+		{
+			if(pProRes[i].dCenterX <= 0 || pProRes[i].dCenterY <= 0)
+				continue;
+
+// 			dc.SelectObject(&pen1);
+// 
+// 			x = int((pProRes[i].dCADLineX - m_ptOrg.x) * m_dZoom);
+// 			y = int((pProRes[i].dCADLineY - m_ptOrg.y) * m_dZoom);
+// 
+// 			ptTxt = CPoint(x-60,y-8);
+// 
+// 			dc.MoveTo(x-nOffset,y-nOffset);
+// 			dc.LineTo(x + nOffset,y+nOffset);
+// 			dc.MoveTo(x-nOffset,y+nOffset);
+// 			dc.LineTo(x + nOffset,y-nOffset);				
+
+			dc.SelectObject(&pen3);
+	
+			x = int((pProRes[i].ptGlass.x - m_ptOrg.x) * m_dZoom);
+			y = int((pProRes[i].ptGlass.y - m_ptOrg.y) * m_dZoom);
+			
+			dc.MoveTo(x-nOffset,y-nOffset);
+			dc.LineTo(x + nOffset,y+nOffset);
+			dc.MoveTo(x-nOffset,y+nOffset);
+			dc.LineTo(x + nOffset,y-nOffset);
+
+			ptTxt = CPoint(x-100,y-8);
+
+			dc.SelectObject(&pen5);
+			dc.MoveTo(x,y);
+			dc.LineTo(ptArc.x,ptArc.y);
+
+			dc.SelectObject(&pen4);
+
+			x = int((pProRes[i].ptChamfer.x - m_ptOrg.x) * m_dZoom);
+			y = int((pProRes[i].ptChamfer.y - m_ptOrg.y) * m_dZoom);
+
+			dc.MoveTo(x-nOffset,y-nOffset);
+			dc.LineTo(x + nOffset,y+nOffset);
+			dc.MoveTo(x-nOffset,y+nOffset);
+			dc.LineTo(x + nOffset,y-nOffset);
+					
+
+			dc.SetBkMode(TRANSPARENT);
+			//if(pProRes[i].bProfileJudge == TRUE && pProRes[i].stChamfer[nUpDn].bChamferJudge == TRUE)		
+				dc.SetTextColor(m_st_GdiItem.colorBlue);		
+			//else
+			//	dc.SetTextColor(m_st_GdiItem.colorRed);
+
+			strDraw.Format(_T("R_%d"),pProRes[i].iIndex+1);
+			dc.TextOut(ptTxt.x ,ptTxt.y,strDraw);
+		}
+	}
+}
+
+void CFrameImg::DrawCADProfiletResult(CDC &dc,CvPoint2D32f *ptMark)
+{
+	if(m_pGlassData == NULL || m_pRecipe == NULL)
+		return;	
+
+	int				nIndex,nSize;
+	CString			str;
+
+	if(m_pGlassData->GetProfileInspectIndex(m_nSide,nIndex,nSize,str) == FALSE)
+		return;
+
+	PROFILECHAMFER_RESULT_DATA *pProfileResult = m_pGlassData->GetProfileInspectData();
+
+	PROFILE_RESULT *pProRes = NULL;
+	CHAMFER_RESULT *pChamferRes;
+	
+	int				nUpDn = 1;	
+	int				x,y,i;
+	int				nOffset = (int)(3*m_dZoom);		
+	CPoint			ptTxt;	
+	CString			strDraw;
+
+	if(m_nSide < MAX_PANEL_SIDE)
+		nUpDn = 0;
+		
+	CPen   pen1(PS_SOLID, 1, RGB(128,255,255));
+	CPen   pen2(PS_SOLID, 1, RGB(255,255,0));
+	CPen   pen3(PS_SOLID, 1, RGB(0,255,0));	
+	
+	for(i=nIndex;i<nIndex+nSize;i++)
+	{
+		pProRes = &pProfileResult->ProfileData[i];
+
+		switch(m_nSide)
+		{
+		case DIMENSION_A_DN:
+		case DIMENSION_B_DN:
+		case DIMENSION_D_DN:
+			{
+				dc.SelectObject(&pen1);
+
+				x = int((pProRes->ptFullImg.x - m_ptOrg.x) * m_dZoom);
+				y = int((pProRes->ptFullImg.y - m_ptOrg.y) * m_dZoom);
+
+				if(x-nOffset > 0 && y-nOffset > 0)
+				{
+					dc.MoveTo(x-nOffset,y-nOffset);
+					dc.LineTo(x + nOffset,y+nOffset);
+					dc.MoveTo(x-nOffset,y+nOffset);
+					dc.LineTo(x + nOffset,y-nOffset);
+				}				
+			}
+			break;
+		}		
+
+		pChamferRes = &pProfileResult->ResultChamfer[i][nUpDn];
+
+		dc.SelectObject(&pen2);
+
+		x = int((pChamferRes->nGlassLeft - m_ptOrg.x) * m_dZoom);
+		y = int((pChamferRes->ptChamferLine.y - m_ptOrg.y) * m_dZoom);
+
+		ptTxt = CPoint(x-60,y-8);
+
+		dc.MoveTo(x-nOffset,y-nOffset);
+		dc.LineTo(x + nOffset,y+nOffset);
+		dc.MoveTo(x-nOffset,y+nOffset);
+		dc.LineTo(x + nOffset,y-nOffset);
+
+		dc.SelectObject(&pen3);	
+
+		x = int((pChamferRes->ptChamferLine.x - m_ptOrg.x) * m_dZoom);
+		y = int((pChamferRes->ptChamferLine.y - m_ptOrg.y) * m_dZoom);
+
+		dc.MoveTo(x-nOffset,y-nOffset);
+		dc.LineTo(x + nOffset,y+nOffset);
+		dc.MoveTo(x-nOffset,y+nOffset);
+		dc.LineTo(x + nOffset,y-nOffset);		
+
+		dc.SetBkMode(TRANSPARENT);
+		if(pProRes->bProfileJudge == TRUE && pChamferRes->bChamferJudge == TRUE)		
+			dc.SetTextColor(m_st_GdiItem.colorBlue);		
+		else
+			dc.SetTextColor(m_st_GdiItem.colorRed);
+
+		strDraw.Format(_T("%s_%d"),str,pChamferRes->iIndex+1);
+		dc.TextOut(ptTxt.x ,ptTxt.y,strDraw);
+	}
+}
+
+void CFrameImg::DrawCADProfiletLine(CDC &dc,CvPoint2D32f *ptMark)
+{
+	if(m_pI2M == NULL)
+		return;
+		
+	if(m_pGlassData == NULL || m_pRecipe == NULL)
+		return;
+				
+	CSize		szROI;
+	int			y,yEnd;
+
+	szROI.cx =  CHKMIN(int(m_WndRect.Width()  / m_dZoom), m_szImg.cx);
+	szROI.cy =  int(m_WndRect.Height() / m_dZoom);   
+
+	y =  int((m_ptOrg.y));
+	yEnd = y+szROI.cy;
+
+	std::multimap<int, CPoint *> *pMap = m_pI2M->IF2M_GetCADProfileLine(m_nSide,y,yEnd);
+
+	if(pMap == NULL || (int)pMap->size() <= 0)
+		return;
+
+	std::multimap<int, CPoint *>::iterator	it,itEnd;	
+	CPoint		*pPoint,point;
+
+	it = pMap->lower_bound(y);	
+	itEnd = pMap->upper_bound(yEnd);
+
+	if (it == pMap->end())
+		return;
+
+	while (it != itEnd)
+	{
+		if (it == pMap->end())
+			break;
+
+		pPoint = it->second;
+		if(pPoint == NULL)
+		{
+			it++;
+			continue;
+		}
+		point.x = int((pPoint->x - m_ptOrg.x) * m_dZoom);
+		point.y = int((pPoint->y - m_ptOrg.y) * m_dZoom);
+
+		if(point.y < 0 || point.x < 0)
+		{			
+			it++;
+			continue;
+		}
+		dc.SetPixel(point,RGB(255,0,0));	
+		it++;
+	}	
+}
+
+void CFrameImg::DrawExpectionAear(CDC &dc)
+{
+	if(m_pGlassData == NULL || m_pRecipe == NULL)
+		return;
+
+	EXCEPTION_AREA_LIST *pExpList = m_pRecipe->GetExpAreaList((DimensionDir)m_nSide);
+	if(pExpList == NULL)
+		return;
+	
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+	if(pResInfo == NULL)
+		return;
+
+ 	if(pResInfo->ptMark[0].x < 1 || pResInfo->ptMark[0].y  < 1)
+ 		return;
+
+	double dOffsetX = (pResInfo->ptMark[1].x - pResInfo->ptMark[0].x) / double(pResInfo->ptMark[1].y - pResInfo->ptMark[0].y);		
+	
+	itEXCEPTION_AREA_LIST it;
+	CPen   penRed(PS_SOLID, 2, RGB(255,0,0)), *pOldPen;
+	CBrush hackBrush1,hackBrush2,*pOldBrush;
+	CRect rc,rc1;
+	hackBrush1.CreateHatchBrush(HS_BDIAGONAL, RGB(0,255,255));
+	hackBrush2.CreateHatchBrush(HS_DIAGCROSS, RGB(255,0,255));
+
+	pOldPen		= dc.SelectObject(&penRed);
+	pOldBrush   = dc.SelectObject(&hackBrush1);
+
+	if(!pExpList->empty())
+	{
+		dc.SetTextColor(RGB(0,0,255));
+		for(it = pExpList->begin(); it != pExpList->end() ; it++)
+		{	
+			if((*it) != m_pTracker)
+			{
+				rc.top		= (*it)->rc.top		- m_ptOrg.y + (int)pResInfo->ptMark[0].y;
+				rc.bottom	= (*it)->rc.bottom	- m_ptOrg.y + (int)pResInfo->ptMark[0].y;
+				rc.left		= (*it)->rc.left	- m_ptOrg.x + (int)pResInfo->ptMark[0].x + int((*it)->rc.top	 * dOffsetX);
+				rc.right	= (*it)->rc.right	- m_ptOrg.x + (int)pResInfo->ptMark[0].x + int((*it)->rc.top	 * dOffsetX);
+
+				rc.top		= int(rc.top	* m_dZoom);
+				rc.bottom	= int(rc.bottom * m_dZoom);
+				rc.left		= int(rc.left	* m_dZoom);
+				rc.right	= int(rc.right	* m_dZoom);
+
+				dc.SelectObject(&hackBrush1);
+				dc.Rectangle(rc);
+			
+
+				switch((*it)->nAreaType)
+				{
+				case 0:
+					dc.TextOut(rc.left ,rc.top,_T("Defect Exception"));
+					break;
+
+				case 1:
+					dc.TextOut(rc.left ,rc.top,_T("Measure Area"));
+					break;
+
+				case 2:
+					dc.TextOut(rc.left ,rc.top,_T("VCR"));
+					break;
+				}
+			}
+			else
+			{
+
+
+				CRect	rc2;
+				rc2 = (*it)->rc;
+
+				rc.top		= (*it)->rc.top		- m_ptOrg.y + (int)pResInfo->ptMark[0].y;
+				rc.bottom	= (*it)->rc.bottom	- m_ptOrg.y + (int)pResInfo->ptMark[0].y;
+				rc.left		= (*it)->rc.left	- m_ptOrg.x + (int)pResInfo->ptMark[0].x+ int((*it)->rc.top	 * dOffsetX);
+				rc.right	= (*it)->rc.right	- m_ptOrg.x + (int)pResInfo->ptMark[0].x+ int((*it)->rc.top	 * dOffsetX);
+
+				rc.top		= int(rc.top	* m_dZoom);
+				rc.bottom	= int(rc.bottom * m_dZoom);
+				rc.left		= int(rc.left	* m_dZoom);
+				rc.right	= int(rc.right	* m_dZoom);
+
+				if(m_bModify == TRUE)
+					dc.SelectObject(&hackBrush2);
+
+				dc.Rectangle(rc);
+
+				if(m_bModify == TRUE)
+				{
+					rc1.top		= rc.top - 5;
+					rc1.bottom	= rc.top + 5;
+					rc1.left	= rc.left - 5;
+					rc1.right	= rc.left + 5;
+
+					dc.Rectangle(rc1);
+
+					rc1.top		= rc.top - 5;
+					rc1.bottom	= rc.top + 5;
+					rc1.left	= rc.right - 5;
+					rc1.right	= rc.right + 5;
+
+					dc.Rectangle(rc1);
+
+					rc1.top		= rc.bottom - 5;
+					rc1.bottom	= rc.bottom + 5;
+					rc1.left	= rc.left - 5;
+					rc1.right	= rc.left + 5;
+
+					dc.Rectangle(rc1);
+
+					rc1.top		= rc.bottom - 5;
+					rc1.bottom	= rc.bottom + 5;
+					rc1.left	= rc.right - 5;
+					rc1.right	= rc.right + 5;
+
+					dc.Rectangle(rc1);
+				}
+
+				switch((*it)->nAreaType)
+				{
+				case 0:
+					dc.TextOut(rc.left ,rc.top,_T("Defect Exception"));
+					break;
+
+				case 1:
+					dc.TextOut(rc.left ,rc.top,_T("Measure Area"));
+					break;
+
+				case 2:
+					dc.TextOut(rc.left ,rc.top,_T("VCR"));
+					break;
+				}
+			}
+		}
+
+	}
+
+	dc.SelectObject(pOldPen);
+	dc.SelectObject(pOldBrush);
+
+	hackBrush1.DeleteObject();
+	hackBrush2.DeleteObject();
+}
+
+
+
+void CFrameImg::DrawUserDefectArea(CDC &dc)
+{
+	if(m_pGlassData == NULL || m_pRecipe == NULL)
+		return;
+	
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+	USER_DEFECT_AREA_LIST *pList = m_pRecipe->GetUserDefectList((DimensionDir)m_nSide);
+
+	if(pList == NULL || pResInfo == NULL)
+		return;
+
+	if ((pList->empty() == false))// && (pResInfo->ptMark[0].x > 0) && (pResInfo->ptMark[0].y > 0))
+	{
+		CPen   penRed(PS_SOLID, 2, RGB(255,165,0)), *pOldPen;
+		CRect rc,rc1;
+
+		pOldPen	= dc.SelectObject(&penRed);
+		dc.SetTextColor(m_st_GdiItem.colorOrange);
+
+		unsigned int list_index = 0;
+
+		for (itUSER_DEFECT_AREA_LIST it = pList->begin(); it != pList->end(); ++it)
+		{
+			rc.left = it->x - m_ptOrg.x + (int)pResInfo->ptMark[0].x;
+			rc.top = it->y - m_ptOrg.y + (int)pResInfo->ptMark[0].y;
+			rc.right = rc.left + it->area_width;
+			rc.bottom = rc.top + it->area_height;
+
+			rc.top		= int(rc.top	* m_dZoom);
+			rc.bottom	= int(rc.bottom * m_dZoom);
+			rc.left		= int(rc.left	* m_dZoom);
+			rc.right	= int(rc.right	* m_dZoom);
+
+			Draw_Rectangle(dc, rc);
+
+			CString strAreaText;
+
+			strAreaText.Format(_T("User Defect %d"), list_index);
+
+			dc.TextOut(rc.left, rc.top-20, strAreaText);
+
+			list_index++;
+		}
+
+		dc.SelectObject(pOldPen);
+	}
+}
+
+void CFrameImg::SetGlassData(CGlass_Data *pGlassData)
+{
+	m_pGlassData = pGlassData;
+}
+
+void CFrameImg::DrawProcessData(CDC &dc)
+{
+	if(m_pGlassData == NULL)
+		return;
+
+	CPen pen(PS_SOLID		, 3,RGB(0,0,255));
+	CPen pen2(PS_SOLID		, 1,RGB(0,255,255));	
+	CPen pen8(PS_SOLID		, 1,RGB(0,0,255));
+		
+	CPen			*pOldPen;	
+	int				x, y,k =0;
+	SIZE			szROI;	
+	CString			strTmp;	
+	int				nRefSide		= m_nSide %4;
+	int				nUpDn			= 0;
+	if(m_nSide < 4)	nUpDn = 0;
+	else			nUpDn = 1;	
+	int				nPos = 50;
+	double			dResH,dResV;
+
+	GetResolution(dResH,dResV);			
+
+	pOldPen = (CPen*)dc.SelectObject(&pen);
+	dc.SetROP2(R2_COPYPEN);		
+
+	dc.SelectObject(&pen2);
+	dc.SetBkMode(TRANSPARENT);
+	dc.SetTextColor(RGB(0,0,255));
+
+	CINSPECT_JUDGEMENT_PARM *pJudge = NULL;
+	if(m_pRecipe != NULL)
+	{
+		pJudge = m_pRecipe->GetJudgePrm();
+		strTmp.Format(_T("Ref:[%d]"),pJudge->grind[nUpDn][nRefSide].nRefernce);		
+	}
+	
+	dc.TextOut(120,3,strTmp);
+	// TFT CF Line阑 弊赴促.
+	
+	szROI.cx =  CHKMIN(int(m_WndRect.Width()  / m_dZoom), m_szImg.cx);
+	szROI.cy =  int(m_WndRect.Height() / m_dZoom);   
+	
+	y = (m_ptOrg.y) %m_szImg.cy;
+
+	BOOL		 bMark[3];
+	CvPoint2D32f ptMark[3];
+
+	int nHafMarkW = (int)(20 * m_dZoom); 
+	int nHafMarkH = (int)(15 * m_dZoom);
+
+
+	if(m_pRecipe != NULL)
+	{
+		CALIGNMARK_PARM *pAlignPrm = m_pRecipe->GetAlignMarkPrm((DimensionDir)m_nSide);
+
+		for(int i=0;i<MAX_POS_MARKER_COUNT;i++)
+		{
+			if(pAlignPrm->IpMarkImg[0][i])
+			{
+				nHafMarkW = (int)((pAlignPrm->IpMarkImg[0][i]->width /2) * m_dZoom);
+				nHafMarkH = (int)((pAlignPrm->IpMarkImg[0][i]->height/2) * m_dZoom);
+				break;
+			}
+		}
+	}
+
+	ZeroMemory(ptMark,sizeof(CvPoint2D32f)*3);
+	ZeroMemory(bMark,sizeof(BOOL)*3);
+
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+		if(pResInfo != NULL)
+		{
+			ptMark[0] = pResInfo->ptMark[0];
+			ptMark[1] = pResInfo->ptMark[1];
+			ptMark[2] = pResInfo->ptMark[2];
+			bMark[0] = pResInfo->bMark[0];
+			bMark[1] = pResInfo->bMark[1];
+			bMark[2] = pResInfo->bMark[2];
+		}		
+	}
+	 
+	DrawResultLine(dc,ptMark);	
+
+	DrawReferenceLine(dc,ptMark,bMark,nHafMarkW,nHafMarkH);	
+	
+	double dMinCircle1Y = 64997;
+	double dMinCircle1X = 500;
+	double dMinCircle2Y = 85658;
+	double dMinCircle2X = 500;
+
+	x = int((ptMark[1].x + (dMinCircle1X/dResH) - m_ptOrg.x) * m_dZoom) ;
+	y = int((ptMark[1].y - (dMinCircle1Y/dResV)- m_ptOrg.y) * m_dZoom) ;
+
+	dc.SelectObject(&pen8);
+
+	dc.MoveTo(x-7,y);
+	dc.LineTo(x+7,y);
+	dc.MoveTo(x,y-7);
+	dc.LineTo(x,y+7);
+	x = int((ptMark[1].x + (dMinCircle2X/dResH) - m_ptOrg.x) * m_dZoom) ;
+	y = int((ptMark[1].y - (dMinCircle2Y/dResV)- m_ptOrg.y) * m_dZoom) ;
+	
+	dc.MoveTo(x-7,y);
+	dc.LineTo(x+7,y);
+	dc.MoveTo(x,y-7);
+	dc.LineTo(x,y+7);
+
+	// Corner甫 弊赴促.	
+	DrawCorner(dc,ptMark);
+		
+	//Defect阑 弊赴促.
+	DrawDefect(dc);			
+		
+	DrawMeasureLine(dc,ptMark);
+
+	DrawCADProfiletLine(dc,ptMark);
+
+	DrawCADProfiletResult(dc,ptMark);
+
+	DrawCADRCutProfiletResult(dc,ptMark);
+
+	DrawCADRCutChamfertResult(dc,ptMark);
+
+	dc.SelectObject(pOldPen);	
+}
+
+
+
+void CFrameImg::DrawMeasureLine(CDC &dc,CvPoint2D32f *ptMark)
+{
+	if(m_pGlassData == NULL || m_pRecipe == NULL)
+		return;
+
+	if(IsAutoMeasureMode())
+	{
+		CPen pen2(PS_SOLID		, 1,RGB(0,255,255));
+
+		dc.SelectObject(&pen2);
+
+		dc.SetTextColor(m_st_GdiItem.colorRed);
+
+		double  dRefLine = 0;
+		double  dOffsetX	= 0.;
+		double	dResH,dResV;
+		int		nFrameIndex =  m_ptOrg.y /m_szImg.cy;
+		int		nRefSide	= m_nSide %4;
+
+		INS_EDGE_RESULT_INFO *pInsResult = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+		if(pInsResult == NULL)
+			return;
+
+		CINSPECT_JUDGEMENT_PARM *pInsJudge = m_pRecipe->GetJudgePrm();
+
+		GetResolution(dResH,dResV);
+
+		if((ptMark[1].y - ptMark[0].y) != 0)
+			dOffsetX = (ptMark[1].x - ptMark[0].x) / double(ptMark[1].y - ptMark[0].y);		
+
+		dRefLine = pInsResult->nCompRefFrame[nFrameIndex] - m_ptOrg.x;
+
+		int x = (int)(dRefLine + 0.5);
+		int y;
+
+		if(m_ptMouseCurrent.y  >  ((ptMark[0].y - m_ptOrg.y) * m_dZoom) 
+			&& m_ptMouseCurrent.y  <  ((ptMark[1].y - m_ptOrg.y) * m_dZoom))
+		{
+			CString strTmp;
+			int nValue;
+
+			int nTx = (int)(x * m_dZoom) - 40;
+			if(m_nSide < 4) // 惑何 
+			{
+				// CF LINE
+				dc.MoveTo((int)((pInsResult->nGrindframe[0][nFrameIndex]- m_ptOrg.x)	*	m_dZoom) , m_ptMouseCurrent.y);
+				dc.LineTo((int)(x	* m_dZoom) , m_ptMouseCurrent.y);
+
+				dc.MoveTo((int)((pInsResult->nGrindframe[0][nFrameIndex]- m_ptOrg.x) *	m_dZoom) , m_ptMouseCurrent.y - 20);
+				dc.LineTo((int)((pInsResult->nGrindframe[0][nFrameIndex]- m_ptOrg.x) *	m_dZoom) , m_ptMouseCurrent.y + 20);
+
+				dc.MoveTo((int)((pInsResult->nGrindframe[1][nFrameIndex]- m_ptOrg.x) *	m_dZoom) , m_ptMouseCurrent.y - 20);
+				dc.LineTo((int)((pInsResult->nGrindframe[1][nFrameIndex]- m_ptOrg.x) *	m_dZoom) , m_ptMouseCurrent.y + 20);
+
+				// Mark Line Pos
+				dc.MoveTo((int)(x * m_dZoom) , m_ptMouseCurrent.y - 20);
+				dc.LineTo((int)(x * m_dZoom) , m_ptMouseCurrent.y + 20);
+
+
+				nValue = int(abs(pInsResult->nGrindframe[0][nFrameIndex] - (x +m_ptOrg.x)) * dResH);
+
+				y =  (int)((ptMark[0].x) * m_dZoom) + 5;
+				strTmp.Format(_T("CF : %d um"),nValue);
+				dc.TextOut( nTx ,m_ptMouseCurrent.y + 15,strTmp);
+			
+				nValue =  CHKMAX(pInsJudge->grind[0][nRefSide].nRefernce,pInsJudge->grind[0][nRefSide].nRefernce) 
+						 - (int)(fabs(pInsResult->nGrindframe[1][nFrameIndex] - (dRefLine + m_ptOrg.x)) * dResH);
+
+				strTmp.Format(_T("GRIND : %d um"),pInsResult->nGrindData[nFrameIndex]);
+				//strTmp.Format("GRIND : %d um",nValue);
+				dc.TextOut( nTx ,m_ptMouseCurrent.y + 30,strTmp);
+			}
+			else // 窍何
+			{
+				// TFT LINE
+				dc.MoveTo((int)((pInsResult->nGrindframe[0][nFrameIndex]- m_ptOrg.x)	*	m_dZoom) , m_ptMouseCurrent.y);
+				dc.LineTo((int)(x	* m_dZoom) , m_ptMouseCurrent.y);
+
+				dc.MoveTo((int)((pInsResult->nGrindframe[0][nFrameIndex]- m_ptOrg.x) *	m_dZoom) , m_ptMouseCurrent.y - 20);
+				dc.LineTo((int)((pInsResult->nGrindframe[0][nFrameIndex]- m_ptOrg.x) *	m_dZoom) , m_ptMouseCurrent.y + 20);
+
+				dc.MoveTo((int)((pInsResult->nGrindframe[1][nFrameIndex]- m_ptOrg.x) *	m_dZoom) , m_ptMouseCurrent.y - 20);
+				dc.LineTo((int)((pInsResult->nGrindframe[1][nFrameIndex]- m_ptOrg.x) *	m_dZoom) , m_ptMouseCurrent.y + 20);
+
+				// Mark Line Pos
+				dc.MoveTo((int)(x * m_dZoom) , m_ptMouseCurrent.y - 20);
+				dc.LineTo((int)(x * m_dZoom) , m_ptMouseCurrent.y + 20);
+				
+				nValue = int(fabs(pInsResult->nGrindframe[0][nFrameIndex] - (dRefLine +m_ptOrg.x)) * dResH);
+
+				y =  (int)((ptMark[0].x) * m_dZoom);
+				strTmp.Format(_T("TFT : %d um"),nValue);
+				dc.TextOut(nTx ,m_ptMouseCurrent.y + 15,strTmp);
+				
+				nValue =  CHKMAX(pInsJudge->grind[0][nRefSide].nRefernce,pInsJudge->grind[0][nRefSide].nRefernce) 
+					- (int)(fabs(pInsResult->nGrindframe[1][nFrameIndex] - (dRefLine + m_ptOrg.x)) * dResH);
+				
+				//strTmp.Format("GRIND : %d um",nValue);
+				strTmp.Format(_T("GRIND : %d um"),pInsResult->nGrindData[nFrameIndex]);
+				dc.TextOut(nTx ,m_ptMouseCurrent.y + 30,strTmp);
+			}
+		}
+	}
+}
+
+void CFrameImg::DrawDefect(CDC &dc)
+{
+	if(m_pGlassData == NULL)
+		return;	
+
+	CPen pen5(PS_SOLID		, 1,m_st_GdiItem.colorRed);
+	CPen pen_OK(PS_SOLID		, 1,m_st_GdiItem.colorOrange);
+
+	double		dResH,dResV;
+	int			iDefect;
+	CRect		rcTmp,rcOrg;
+	int			nDefect = m_pGlassData->GetTotalDefectCount();
+	CInspectDefect	*pDefect = NULL;
+
+	GetResolution(dResH,dResV);
+
+	dc.SelectObject(&pen5);
+
+	for(iDefect = 0; iDefect < nDefect; iDefect++)
+	{
+		pDefect = m_pGlassData->GetDefect(iDefect);
+		if(pDefect == NULL)
+			continue;
+	
+		if(pDefect->m_nSideLoc != m_nSide)
+			continue;
+
+		if(pDefect->m_bJudgeDefect == TRUE)			dc.SelectObject(&pen5);
+		else										dc.SelectObject(&pen_OK);
+
+		rcOrg.left = (LONG)(pDefect->m_nPixelConv);
+		rcOrg.top = (LONG)(pDefect->m_nPixelScan);
+		rcOrg.right = rcOrg.left+pDefect->m_sPixelWidth;
+		rcOrg.bottom = rcOrg.top+pDefect->m_sPixelHeight;		
+
+		rcTmp.left		= int((rcOrg.left   - m_ptOrg.x )	* m_dZoom);
+		rcTmp.right		= int((rcOrg.right  - m_ptOrg.x )	* m_dZoom);
+		rcTmp.top		= int((rcOrg.top	- m_ptOrg.y)	* m_dZoom);
+		rcTmp.bottom	= int((rcOrg.bottom	- m_ptOrg.y)	* m_dZoom);
+
+		if(rcTmp.top    < 0 && rcTmp.bottom > 0 
+			|| rcTmp.top    > 0 && rcTmp.top    < m_WndRect.bottom +1
+			|| rcTmp.bottom > 0 && rcTmp.bottom < m_WndRect.bottom +1)
+		{
+			dc.MoveTo(int((rcOrg.left  - m_ptOrg.x ) * m_dZoom) , int((rcOrg.top	- m_ptOrg.y) * m_dZoom));
+			dc.LineTo(int((rcOrg.right - m_ptOrg.x ) * m_dZoom) , int((rcOrg.top	- m_ptOrg.y) * m_dZoom));
+			dc.LineTo(int((rcOrg.right - m_ptOrg.x ) * m_dZoom) , int((rcOrg.bottom	- m_ptOrg.y) * m_dZoom));
+			dc.LineTo(int((rcOrg.left  - m_ptOrg.x ) * m_dZoom) , int((rcOrg.bottom	- m_ptOrg.y) * m_dZoom));
+			dc.LineTo(int((rcOrg.left  - m_ptOrg.x ) * m_dZoom) , int((rcOrg.top	- m_ptOrg.y) * m_dZoom));
+		}
+	}	
+}
+
+void CFrameImg::DrawResultLine(CDC &dc,CvPoint2D32f *ptMark)
+{
+	if(m_nSide < 0 || m_nSide >= MAX_DIMENSION_COUNT)
+		return;
+
+	if(m_bitModeDisplay[MODE_SHOW_MEASURE_LINE])
+	{
+		CPen pen(PS_SOLID		, 3,RGB(0,0,255));
+		CPen pen6(PS_SOLID		, 1,RGB(0, 255,   128));
+		CPen pen7(PS_SOLID		, 1,RGB(255, 255,   128));
+
+		int				y;
+		SIZE			szROI;
+		CString			strTmp;
+		int				nFrameIndex =  m_ptOrg.y /m_szImg.cy;
+
+		INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+		if(pResInfo == NULL)
+			return;
+
+		int			nGlassStart = pResInfo->nGlassStartLine;
+		int			nGlassEnd = pResInfo->nGlassEndLine;
+
+		if(nGlassStart <= 0 || nGlassEnd <= 0)
+			return;
+
+		CINSPECT_JUDGEMENT_PARM *pJudge = NULL;
+		if(m_pRecipe != NULL)
+		{
+			pJudge = m_pRecipe->GetJudgePrm();			
+		}
+
+		szROI.cx =  CHKMIN(int(m_WndRect.Width()  / m_dZoom), m_szImg.cx);
+		szROI.cy =  int(m_WndRect.Height() / m_dZoom);   
+
+		y = (m_ptOrg.y) %m_szImg.cy;
+
+		(CPen*)dc.SelectObject(&pen);
+		if(nGlassStart > 0 )
+		{
+			y =  int((pResInfo->nGlassStartLine - m_ptOrg.y) * m_dZoom);
+
+			if( y > -1  &&  y < szROI.cy) 
+			{
+				dc.MoveTo(0,y);
+				dc.LineTo(m_WndRect.Width(),y);
+
+				strTmp.Format(_T("1.First Area"));
+				dc.TextOut(10,y+10,strTmp);
+			}
+		}
+
+		if(nGlassEnd > 0 )
+		{
+			y =  int((pResInfo->nGlassEndLine - m_ptOrg.y) * m_dZoom);
+
+			if( y > -1  &&  y < szROI.cy) 
+			{
+				dc.MoveTo(0,y);
+				dc.LineTo(m_WndRect.Width(),y);
+
+				strTmp.Format(_T("3.Third Area"));
+				dc.TextOut(10,y-20,strTmp);
+			}
+		}
+
+		int RangeST = 0;
+		if(pJudge != NULL)
+			RangeST = pJudge->defect[m_nSide][1].nRangeStart;
+
+		if(RangeST >= 0 )
+		{
+			y =  int((pResInfo->nGlassStartLine +RangeST - m_ptOrg.y) * m_dZoom);
+			if( y > -1 /* &&  y < szROI.cy*/) 
+			{
+				dc.MoveTo(0,y);
+				dc.LineTo(m_WndRect.Width(),y);
+
+				strTmp.Format(_T("1.First Area"));
+				dc.TextOut(10,y-20,strTmp);
+
+				strTmp.Format(_T("2.Secound Area"));
+				dc.TextOut(10,y+10,strTmp);
+			}
+		}
+
+		int RangeED = 0;
+		if(pJudge != NULL)
+			pJudge->defect[m_nSide][1].nRangeEnd;
+
+		if(RangeED >= 0 )
+		{
+			y =  int((pResInfo->nGlassStartLine +RangeED - m_ptOrg.y) * m_dZoom);
+			if( y > -1 /* &&  y < szROI.cy*/) 
+			{
+				dc.MoveTo(0,y);
+				dc.LineTo(m_WndRect.Width(),y);
+
+				strTmp.Format(_T("2.Secound Area"));
+				dc.TextOut(10,y-20,strTmp);
+
+				strTmp.Format(_T("3.Third Area"));
+				dc.TextOut(10,y+10,strTmp);
+			}
+		}
+
+		dc.SelectObject(&pen7 );		
+		dc.MoveTo(int((pResInfo->nGrindframe[0][nFrameIndex]- m_ptOrg.x) * m_dZoom),0);
+	//	dc.MoveTo(int((pResInfo->nGrindframe[0][nFrameIndex]- m_ptOrg.x) * m_dZoom), int(CHKMAX(0 ,(pResInfo->nGlassStartLine - m_ptOrg.y)* m_dZoom )));
+		
+		if(ptMark[1].y > 0)
+		{
+			dc.LineTo(int((pResInfo->nGrindframe[0][nFrameIndex]- m_ptOrg.x)* m_dZoom),m_WndRect.Height());
+			//dc.LineTo(int((pResInfo->nGrindframe[0][nFrameIndex]- m_ptOrg.x)* m_dZoom),CHKMIN(m_WndRect.Height(),int((pResInfo->nGlassEndLine - m_ptOrg.y) * m_dZoom )));
+		}
+		else
+		{
+			dc.LineTo(int((pResInfo->nGrindframe[0][nFrameIndex]- m_ptOrg.x) * m_dZoom),int(m_szImg.cy * m_dZoom));
+	
+			if(m_dZoom  < 1)
+			{		
+				for(int i = 1 ;  i <  5 ; i++)
+				{
+					if(m_szImg.cy * i * m_dZoom < m_WndRect.Height())
+					{
+						dc.MoveTo(int((pResInfo->nGrindframe[0][nFrameIndex+ i]- m_ptOrg.x) * m_dZoom),int(CHKMAX(m_szImg.cy *i * m_dZoom ,pResInfo->nGlassStartLine - m_ptOrg.y)* m_dZoom));
+						dc.LineTo(int((pResInfo->nGrindframe[0][nFrameIndex+ i]- m_ptOrg.x) * m_dZoom),int(m_szImg.cy* (i+1) * m_dZoom));
+					}
+				}
+			}
+		}
+		
+		dc.SelectObject(&pen6);
+		//dc.MoveTo(int((pResInfo->nGrindframe[1][nFrameIndex]- m_ptOrg.x) * m_dZoom),int(CHKMAX(0 ,(pResInfo->nGlassStartLine - m_ptOrg.y)* m_dZoom )));
+		dc.MoveTo(int((pResInfo->nGrindframe[1][nFrameIndex]- m_ptOrg.x) * m_dZoom),0);
+		
+		if(ptMark[1].y)
+			dc.LineTo(int((pResInfo->nGrindframe[1][nFrameIndex]- m_ptOrg.x)* m_dZoom),m_WndRect.Height());
+			//dc.LineTo(int((pResInfo->nGrindframe[1][nFrameIndex]- m_ptOrg.x)* m_dZoom),CHKMIN(m_WndRect.Height(),int((pResInfo->nGlassEndLine - m_ptOrg.y) * m_dZoom)) );
+		else
+		{
+			dc.LineTo(int((pResInfo->nGrindframe[1][nFrameIndex]- m_ptOrg.x) * m_dZoom) ,int(m_szImg.cy * m_dZoom));
+		
+			for(int i = 1 ;  i <  5 ; i++)
+			{
+				if(m_szImg.cy * i * m_dZoom < m_WndRect.Height()+1)
+				{
+					dc.MoveTo(int((pResInfo->nGrindframe[1][nFrameIndex+ i]- m_ptOrg.x) * m_dZoom),int(CHKMAX(m_szImg.cy *i * m_dZoom ,pResInfo->nGlassStartLine )* m_dZoom - m_ptOrg.y));
+					dc.LineTo(int((pResInfo->nGrindframe[1][nFrameIndex+ i]- m_ptOrg.x) * m_dZoom),int(m_szImg.cy* (i+1) * m_dZoom));
+				}
+			}
+		}		
+	}
+}
+
+void CFrameImg::DrawReferenceLine(CDC &dc,CvPoint2D32f *ptMark,BOOL *bMark,int nHafMarkW,int nHafMarkH)
+{
+	if(m_bitModeDisplay[MODE_SHOW_REF_LINE])
+	{
+		CPen pen2(PS_SOLID		, 1,RGB(0,255,255));
+		CPen pen5(PS_SOLID		, 1,m_st_GdiItem.colorRed);
+		CPen pen3(PS_DASH		, 1,RGB(255,0,255));		
+
+		INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+		if(pResInfo == NULL)
+			return;
+
+		int				nFrameIndex =  m_ptOrg.y /m_szImg.cy; //(m_ptOrg.y - (m_szImg.cy - m_WndRect.Height()))/m_szImg.cy;
+		int				nRefSide		= m_nSide %4;
+		int				nUpDn			= 0;
+		if(m_nSide < 4)	nUpDn = 0;
+		else			nUpDn = 1;
+		int				x,y;
+		double			dResH,dResV;
+
+		GetResolution(dResH,dResV);
+
+		// 付农甫 弊赴促.
+		dc.SelectObject(&pen2);
+
+		if(bMark[0])
+		{
+			dc.SelectObject(&pen2);
+			x = int((ptMark[0].x - m_ptOrg.x) * m_dZoom) - nHafMarkW;
+			y = int((ptMark[0].y - m_ptOrg.y) * m_dZoom) - nHafMarkH;
+
+			dc.MoveTo(x,y);
+			dc.LineTo(x + nHafMarkW *2,y);
+			dc.LineTo(x + nHafMarkW	*2,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y);
+
+			dc.MoveTo(x					,y + nHafMarkH);
+			dc.LineTo(x + nHafMarkW *2	,y + nHafMarkH);
+		}
+		else
+		{
+			dc.SelectObject(&pen5);
+			x = int((ptMark[0].x - m_ptOrg.x) * m_dZoom) - nHafMarkW;
+			y = int((ptMark[0].y - m_ptOrg.y) * m_dZoom) - nHafMarkH;
+
+			dc.MoveTo(x,y);
+			dc.LineTo(x + nHafMarkW *2,y);
+			dc.LineTo(x + nHafMarkW	*2,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y);
+
+			dc.MoveTo(x					,y + nHafMarkH);
+			dc.LineTo(x + nHafMarkW *2	,y + nHafMarkH);
+		}
+
+		if(bMark[1])
+		{
+			dc.SelectObject(&pen2);
+			x = int((ptMark[1].x - m_ptOrg.x) * m_dZoom) - nHafMarkW;
+			y = int((ptMark[1].y - m_ptOrg.y) * m_dZoom) - nHafMarkH;
+
+			dc.MoveTo(x,y);
+			dc.LineTo(x + nHafMarkW *2,y);
+			dc.LineTo(x + nHafMarkW	*2,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y);
+
+			dc.MoveTo(x					,y + nHafMarkH);
+			dc.LineTo(x + nHafMarkW *2	,y + nHafMarkH);
+		}
+		else
+		{
+			dc.SelectObject(&pen5);
+			x = int((ptMark[1].x - m_ptOrg.x) * m_dZoom) - nHafMarkW;
+			y = int((ptMark[1].y - m_ptOrg.y) * m_dZoom) - nHafMarkH;
+
+			dc.MoveTo(x,y);
+			dc.LineTo(x + nHafMarkW *2,y);
+			dc.LineTo(x + nHafMarkW	*2,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y);
+
+			dc.MoveTo(x					,y + nHafMarkH);
+			dc.LineTo(x + nHafMarkW *2	,y + nHafMarkH);
+		}
+
+		if(bMark[2])
+		{
+			dc.SelectObject(&pen2);
+			x = int((ptMark[2].x - m_ptOrg.x) * m_dZoom) - nHafMarkW;
+			y = int((ptMark[2].y - m_ptOrg.y) * m_dZoom) - nHafMarkH;
+
+			dc.MoveTo(x,y);
+			dc.LineTo(x + nHafMarkW *2,y);
+			dc.LineTo(x + nHafMarkW	*2,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y);
+
+			dc.MoveTo(x					,y + nHafMarkH);
+			dc.LineTo(x + nHafMarkW *2	,y + nHafMarkH);
+		}
+		else
+		{
+			dc.SelectObject(&pen5);
+			x = int((ptMark[2].x - m_ptOrg.x) * m_dZoom) - nHafMarkW;
+			y = int((ptMark[2].y - m_ptOrg.y) * m_dZoom) - nHafMarkH;
+
+			dc.MoveTo(x,y);
+			dc.LineTo(x + nHafMarkW *2,y);
+			dc.LineTo(x + nHafMarkW	*2,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y + nHafMarkH*2);
+			dc.LineTo(x				  ,y);
+
+			dc.MoveTo(x					,y + nHafMarkH);
+			dc.LineTo(x + nHafMarkW *2	,y + nHafMarkH);
+		}
+		
+		dc.SelectObject(&pen2);
+		dc.SetBkMode(TRANSPARENT);		
+		
+		x = int((ptMark[0].x - pResInfo->nMarkToEdge_X[0] - m_ptOrg.x) * m_dZoom);
+		y = int((ptMark[0].y - m_ptOrg.y - pResInfo->nMarkToEdge_Y[0]) * m_dZoom);
+
+
+		dc.MoveTo(x -20 ,y);
+		dc.LineTo(x - 5 ,y);
+		dc.MoveTo(x -10 ,y -5);
+		dc.LineTo(x - 5 ,y);
+		dc.LineTo(x -10 ,y +5);
+
+
+		x = int((ptMark[0].x - pResInfo->nMarkToEdge_X[0]- m_ptOrg.x) * m_dZoom);
+		y = int((ptMark[0].y - m_ptOrg.y - pResInfo->nMarkToEdge_Y[0]) * m_dZoom);
+
+
+		dc.MoveTo(x -20 ,y);
+		dc.LineTo(x - 5 ,y);
+		dc.MoveTo(x -10 ,y -5);
+		dc.LineTo(x - 5 ,y);
+		dc.LineTo(x -10 ,y +5);
+
+
+		x = int((ptMark[1].x - pResInfo->nMarkToEdge_X[1]- m_ptOrg.x) * m_dZoom);
+		y = int((ptMark[1].y - m_ptOrg.y + pResInfo->nMarkToEdge_Y[1]) * m_dZoom);
+
+		dc.MoveTo(x -20 ,y);
+		dc.LineTo(x - 5 ,y);
+		dc.MoveTo(x -10 ,y -5);
+		dc.LineTo(x - 5 ,y);
+		dc.LineTo(x -10 ,y +5);
+
+		x = int((ptMark[1].x - pResInfo->nMarkToEdge_X[0]- m_ptOrg.x) * m_dZoom);
+		y = int((ptMark[1].y - m_ptOrg.y + pResInfo->nMarkToEdge_Y[1]) * m_dZoom);
+
+		dc.MoveTo(x -20 ,y);
+		dc.LineTo(x - 5 ,y);
+		dc.MoveTo(x -10 ,y -5);
+		dc.LineTo(x - 5 ,y);
+		dc.LineTo(x -10 ,y +5);
+
+		//  Mark Line
+		dc.SelectObject(&pen3);
+		x = int((ptMark[0].x - m_ptOrg.x) * m_dZoom) ;
+		y = int((ptMark[0].y - m_ptOrg.y) * m_dZoom) ;
+		dc.MoveTo(x,y);
+		x = int((ptMark[1].x - m_ptOrg.x) * m_dZoom) ;
+		y = int((ptMark[1].y - m_ptOrg.y) * m_dZoom) ;
+		dc.LineTo(x	,y);
+
+// 		if(m_pRecipe != NULL)
+// 		{
+// 			CINSPECT_JUDGEMENT_PARM *pJuge = m_pRecipe->GetJudgePrm();
+// 			x = int((ptMark[0].x - m_ptOrg.x - int(pJuge->cutting[nUpDn][nRefSide].nRefernce / dResH)) * m_dZoom) ;
+// 			y = int((ptMark[0].y - m_ptOrg.y ) * m_dZoom ) ;
+// 			dc.MoveTo(x,y);
+// 			x = int((ptMark[1].x - m_ptOrg.x - int(pJuge->cutting[nUpDn][nRefSide].nRefernce / dResH)) * m_dZoom) ;
+// 			y = int((ptMark[1].y - m_ptOrg.y ) * m_dZoom) ;
+// 			dc.LineTo(x	,y);
+// 		}
+
+		double dD = 0.0010245;
+		DWORD data = long(dD * 1000);
+
+	}
+}
+
+void CFrameImg::DrawCorner(CDC &dc,CvPoint2D32f *ptMark)
+{
+	if(ptMark[0].x > 0)
+	{
+		CPen pen3(PS_DASH		, 1,RGB(255,0,255));	
+		CPen pen7(PS_SOLID		, 1,m_st_GdiItem.colorYellow);
+						
+		int i=0,j=0;
+		int x,y;
+
+		INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+		if(pResInfo == NULL)
+			return;
+
+		dc.SelectObject(&pen3);
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x)		* m_dZoom);
+		y = int((pResInfo->rcCorner[0].top    - m_ptOrg.y- 20) * m_dZoom);
+		dc.MoveTo(x,y);
+
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x)		* m_dZoom);
+		y = int((pResInfo->rcCorner[0].top    - m_ptOrg.y	  ) * m_dZoom);
+		dc.LineTo(x,y);
+
+		x = int((pResInfo->rcCorner[0].right   - m_ptOrg.x)	 * m_dZoom);
+		y = int((pResInfo->rcCorner[0].top		- m_ptOrg.y	-20) * m_dZoom);
+		dc.MoveTo(x,y);
+
+		x = int((pResInfo->rcCorner[0].right   - m_ptOrg.x)     * m_dZoom);
+		y = int((pResInfo->rcCorner[0].top		- m_ptOrg.y    ) * m_dZoom);
+		dc.LineTo(x,y);
+
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x)	    * m_dZoom);
+		y = int((pResInfo->rcCorner[0].top    - m_ptOrg.y -10)	* m_dZoom);
+		dc.MoveTo(x,y);
+
+		x = int((pResInfo->rcCorner[0].right   - m_ptOrg.x )	 * m_dZoom);
+		y = int((pResInfo->rcCorner[0].top     - m_ptOrg.y -10) * m_dZoom);
+		dc.LineTo(x,y);
+
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x-20)	* m_dZoom);
+		y = int((pResInfo->rcCorner[0].top    - m_ptOrg.y	 )	* m_dZoom);
+		dc.MoveTo(x,y);
+
+
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x)		* m_dZoom);
+		y = int((pResInfo->rcCorner[0].top    - m_ptOrg.y	  ) * m_dZoom);
+		dc.LineTo(x,y);
+
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x - 20) * m_dZoom);
+		y = int((pResInfo->rcCorner[0].bottom - m_ptOrg.y	   ) * m_dZoom);
+		dc.MoveTo(x,y);
+
+
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x	  ) * m_dZoom);
+		y = int((pResInfo->rcCorner[0].bottom - m_ptOrg.y    ) * m_dZoom);
+		dc.LineTo(x,y);
+
+
+
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x - 10) * m_dZoom);
+		y = int((pResInfo->rcCorner[0].top - m_ptOrg.y	   )	 * m_dZoom);
+		dc.MoveTo(x,y);
+
+
+		x = int((pResInfo->rcCorner[0].left   - m_ptOrg.x  -10) * m_dZoom);
+		y = int((pResInfo->rcCorner[0].bottom - m_ptOrg.y     ) * m_dZoom);
+		dc.LineTo(x,y);
+
+		//===================================================
+
+		x = int((pResInfo->rcCorner[1].left    - m_ptOrg.x)		* m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom  - m_ptOrg.y+ 20)	* m_dZoom);
+		dc.MoveTo(x,y);
+
+
+		x = int((pResInfo->rcCorner[1].left    - m_ptOrg.x)	* m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom  - m_ptOrg.y	  ) * m_dZoom);
+		dc.LineTo(x,y);
+
+
+
+		x = int((pResInfo->rcCorner[1].right   - m_ptOrg.x)	 * m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom	- m_ptOrg.y	+20) * m_dZoom);
+		dc.MoveTo(x,y);
+
+
+		x = int((pResInfo->rcCorner[1].right   - m_ptOrg.x)     * m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom	- m_ptOrg.y    ) * m_dZoom);
+		dc.LineTo(x,y);
+
+
+
+		x = int((pResInfo->rcCorner[1].left   - m_ptOrg.x)			* m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom  - m_ptOrg.y +10)	* m_dZoom);
+		dc.MoveTo(x,y);
+
+		x = int((pResInfo->rcCorner[1].right   - m_ptOrg.x )	 * m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom  - m_ptOrg.y +10) * m_dZoom);
+		dc.LineTo(x,y);
+
+		x = int((pResInfo->rcCorner[1].left   - m_ptOrg.x-20)	* m_dZoom);
+		y = int((pResInfo->rcCorner[1].top    - m_ptOrg.y	 )	* m_dZoom);
+		dc.MoveTo(x,y);
+
+
+		x = int((pResInfo->rcCorner[1].left   - m_ptOrg.x)		* m_dZoom);
+		y = int((pResInfo->rcCorner[1].top    - m_ptOrg.y	  ) * m_dZoom);
+		dc.LineTo(x,y);
+
+		x = int((pResInfo->rcCorner[1].left   - m_ptOrg.x - 20) * m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom - m_ptOrg.y	   ) * m_dZoom);
+		dc.MoveTo(x,y);
+
+
+		x = int((pResInfo->rcCorner[1].left   - m_ptOrg.x	  ) * m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom - m_ptOrg.y    ) * m_dZoom);
+		dc.LineTo(x,y);
+
+
+
+		x = int((pResInfo->rcCorner[1].left	- m_ptOrg.x - 10) * m_dZoom);
+		y = int((pResInfo->rcCorner[1].top		- m_ptOrg.y	   )  * m_dZoom);
+		dc.MoveTo(x,y);
+
+
+		x = int((pResInfo->rcCorner[1].left   - m_ptOrg.x  -10) * m_dZoom);
+		y = int((pResInfo->rcCorner[1].bottom - m_ptOrg.y     ) * m_dZoom);
+		dc.LineTo(x,y);
+
+		dc.SelectObject(&pen7);
+	}
+}
+
+void CFrameImg::DrawHoleArea(CDC &dc)
+{
+	if(m_pRecipe == NULL)
+		return;
+
+	CHOLEINSPECT_PARM* pHoleInsParm = &m_pRecipe->m_HoleInspectParm;
+
+	if(pHoleInsParm == NULL || pHoleInsParm->m_vecHoleInsParam.empty())
+		return;	
+
+	if(m_pGlassData == NULL)
+		return;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nSide);
+	if(pResInfo->ptMark[0].x < 1 || pResInfo->ptMark[0].y  < 1)
+		return;
+
+	double dOffsetX = (pResInfo->ptMark[1].x - pResInfo->ptMark[0].x) / double(pResInfo->ptMark[1].y - pResInfo->ptMark[0].y);		
+
+
+	itEXCEPTION_AREA_LIST it;
+	CPen   penRed(PS_SOLID, 2, RGB(255,0,0)), *pOldPen;
+	CBrush hackBrush1,hackBrush2,*pOldBrush;
+	CRect rc,rc1;
+	hackBrush1.CreateHatchBrush(HS_BDIAGONAL, RGB(50,255,255));
+	hackBrush2.CreateHatchBrush(HS_DIAGCROSS, RGB(255,0,255));
+
+	pOldPen		= dc.SelectObject(&penRed);
+	pOldBrush   = dc.SelectObject(&hackBrush1);
+
+	CString strHole;
+
+	for(int i=0; i<pHoleInsParm->m_vecHoleInsParam.size(); i++)
+	{
+		if(pHoleInsParm->m_vecHoleInsParam[i].m_nSideIdx != m_nSide)
+			continue;
+
+		dc.SetTextColor(RGB(255,255,0));
+
+		CRect rtArea = pHoleInsParm->m_vecHoleInsParam[i].m_rtArea;
+
+		rc.top		= rtArea.top	- m_ptOrg.y + (int)pResInfo->ptMark[0].y;
+		rc.bottom	= rtArea.bottom	- m_ptOrg.y + (int)pResInfo->ptMark[0].y;
+		rc.left		= rtArea.left	- m_ptOrg.x + (int)pResInfo->ptMark[0].x + int(rtArea.top * dOffsetX);
+		rc.right	= rtArea.right	- m_ptOrg.x + (int)pResInfo->ptMark[0].x + int(rtArea.top * dOffsetX);
+
+		rc.top		= int(rc.top	* m_dZoom);
+		rc.bottom	= int(rc.bottom * m_dZoom);
+		rc.left		= int(rc.left	* m_dZoom);
+		rc.right	= int(rc.right	* m_dZoom);
+
+		dc.SelectObject(&hackBrush1);
+		dc.Rectangle(rc);
+
+		strHole.Format(_T("Hole Inspect Area [%d]"), i+1);
+		dc.TextOut(rc.left ,rc.top, strHole);
+	}
+
+	dc.SelectObject(pOldPen);
+	dc.SelectObject(pOldBrush);
+
+	hackBrush1.DeleteObject();
+	hackBrush2.DeleteObject();
+}
+
+void CFrameImg::UpdataVisionResult(void) {
+	/* code */
+	if (!IsWindowVisible())
+		return;
+
+	CDC     *pDC = GetDC();
+	CDC		memDC;
+	CBitmap Bitmap, *pOldBitmap;
+	SIZE	bitmapSize;
+	CFont *pOldFont = NULL;
+
+	memDC.CreateCompatibleDC(pDC);
+	Bitmap.CreateCompatibleBitmap(pDC, m_WndRect.Width(), m_WndRect.Height());
+
+	bitmapSize.cx = int(m_szImg.cx * m_dZoom);
+	bitmapSize.cy = m_szImg.cy;
+
+	m_pBmInfo->bmiHeader.biWidth = m_szImg.cx;
+	m_pBmInfo->bmiHeader.biHeight = -int(m_WndRect.Height() / m_dZoom);//(m_szImg.cy);
+	m_pBmInfo->bmiHeader.biSizeImage = m_pBmInfo->bmiHeader.biWidth *  m_pBmInfo->bmiHeader.biHeight;//m_szImg.cx * (m_szImg.cy / m_dZoom);
+
+	memDC.SetStretchBltMode(COLORONCOLOR);
+
+	//Bitmap.CreateCompatibleBitmap(pDC,bitmapSize.cx,bitmapSize.cy);
+	//Bitmap.CreateCompatibleBitmap(pDC,m_WndRect.Width(),m_WndRect.Height());
+	pOldBitmap = (CBitmap*)memDC.SelectObject(&Bitmap);
+	if (m_pBuffer)
+	{
+		//	StretchDIBits(m_memDC.m_hDC, 0 , 0, bitmapSize.cx , bitmapSize.cy,
+		//		m_ptOrg.x,0,m_pBmInfo->bmiHeader.biWidth,abs(m_pBmInfo->bmiHeader.biHeight),
+		//		m_pBuffer,(BITMAPINFO*)m_pBmInfo,DIB_RGB_COLORS,SRCCOPY);
+
+
+		StretchDIBits(memDC.m_hDC, 0, 0, m_WndRect.Width(), m_WndRect.Height(),
+			m_ptOrg.x, 0, int(m_WndRect.Width() / m_dZoom), int(m_WndRect.Height() / m_dZoom), //m_WndRect.Width(),m_WndRect.Height(),
+			m_pBuffer, (BITMAPINFO*)m_pBmInfo, DIB_RGB_COLORS, SRCCOPY);
+	}
+
+	memDC.SetBkMode(TRANSPARENT);
+	memDC.SetTextColor(RGB(0, 0, 255));
+	//memDC.SetTextColor(RGB(45,200,45));
+	CString str;
+	str.Format(_T("%d"), m_ptOrg.y);
+	memDC.TextOut(m_WndRect.Width() - 50, 10, str);
+
+	int nTmp = int((m_ptMouseCurrent.y / m_dZoom) * m_szImg.cx + m_ptOrg.x + (m_ptMouseCurrent.x / m_dZoom));
+
+	int			nMaxLine = MAX_LIMIT_LINE * IMAGE_WIDTH;
+
+	if (m_szTotBuffer.cy > 0)
+	{
+		nMaxLine = (m_szTotBuffer.cy - 1) * IMAGE_HEIGHT  * m_szTotBuffer.cx;
+	}
+
+	if (nTmp > -1 && nTmp < nMaxLine && m_ptOrg.y >= 0 && m_ptOrg.x >= 0 && m_pBuffer != NULL)
+	{
+		str.Format(_T("(%d / %d) [%d]"), m_ptOrg.x + int(m_ptMouseCurrent.x / m_dZoom), m_ptOrg.y + int(m_ptMouseCurrent.y / m_dZoom)
+			, m_pBuffer[nTmp]);
+
+		memDC.TextOut(10, m_WndRect.Height() - 40, str);
+	}
+
+	pOldFont = (CFont*)memDC.SelectObject(&m_sideFont);
+	memDC.SetTextColor(RGB(45, 200, 45));
+	memDC.TextOut(0, 0, PANEL_SIDE_NAME[m_nSide]);
+	memDC.SetBkMode(OPAQUE);
+
+	UpdateView_VisionResult(memDC);
+
+
+	pDC->BitBlt(0, 0, m_WndRect.Width(), m_WndRect.Height(), &memDC, 0, 0, SRCCOPY);
+
+	if (pOldFont)	memDC.SelectObject(pOldFont);
+
+	memDC.SelectObject(pOldBitmap);
+	Bitmap.DeleteObject();
+	ReleaseDC(&memDC);
+
+	ReleaseDC(pDC);
+}
+
+void CFrameImg::UpDateView_MouseDownPos(CDC &dc) {
+	/* code */
+	if (m_pGlassData == NULL)
+		return;
+
+	if (!BlVision_GetVisionRecipe()->getVisionSetOpen())
+		return;
+
+	CPen pen(PS_SOLID, 1, RGB(255, 0, 255));
+	CBrush brush_Null;
+	brush_Null.CreateStockObject(NULL_BRUSH);
+
+	CPen* pOldPen = dc.SelectObject(&pen);
+	CBrush* pOldBrush = (CBrush*)dc.SelectObject(&brush_Null);
+
+	double		dResH, dResV;
+	CRect		rcTmp, rcOrg;
+
+	GetResolution(dResH, dResV);
+
+	dc.SelectObject(&pen);
+
+	dc.SelectObject(&pen);
+	CPoint ptMarkPos_wnd;
+	ptMarkPos_wnd.x = (int)((m_ptMouseDown.x - m_ptOrg.x) * m_dZoom);
+	ptMarkPos_wnd.y = (int)((m_ptMouseDown.y - m_ptOrg.y) * m_dZoom);
+	if (ptMarkPos_wnd.x > 0 && ptMarkPos_wnd.x < m_WndRect.right && ptMarkPos_wnd.y > 0 && ptMarkPos_wnd.y < m_WndRect.bottom) {
+		dc.MoveTo(ptMarkPos_wnd.x - 12, ptMarkPos_wnd.y - 12);
+		dc.LineTo(ptMarkPos_wnd.x + 12, ptMarkPos_wnd.y + 12);
+		dc.MoveTo(ptMarkPos_wnd.x + 12, ptMarkPos_wnd.y - 12);
+		dc.LineTo(ptMarkPos_wnd.x - 12, ptMarkPos_wnd.y + 12);
+	}
+
+	dc.SelectObject(pOldPen);
+	dc.SelectObject(pOldBrush);
+	brush_Null.DeleteObject();
+}
+
+void CFrameImg::UpdateView_VisionResult(CDC &dc) {
+	/* code */
+	DimensionDir eDir = (DimensionDir)(m_nSide);
+	CBlSideData *pSideData = BlVision_GetVisionRecipe()->getSideData(eDir);
+	if (NULL == pSideData) return;
+
+	int nCount = (int)(pSideData->m_vDispVisionResult.size());
+	if (nCount < 1) return;
+
+	if (m_pGlassData == NULL)
+		return;
+
+	CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
+	CPen pen_SearchArea(PS_DASH, 1, RGB(255, 0, 255));
+	CPen pen_Line(PS_DASH, 1, RGB(0, 255, 255));
+
+	CBrush brush_Null;
+	brush_Null.CreateStockObject(NULL_BRUSH);
+
+	CPen* pOldPen = dc.SelectObject(&pen);
+	CBrush* pOldBrush = (CBrush*)dc.SelectObject(&brush_Null);
+
+	double		dResH, dResV;
+	CRect		rcTmp, rcOrg;
+
+	GetResolution(dResH, dResV);
+
+	dc.SelectObject(&pen);
+
+	for (int iDefect = 0; iDefect < nCount; iDefect++) {
+		DispVisionResult inf = pSideData->m_vDispVisionResult[iDefect];
+		int nType = inf.nType;
+		if (0 == nType) {      //点
+			dc.SelectObject(&pen);
+			CPoint ptMarkPos_wnd;
+			ptMarkPos_wnd.x = (int)((inf.pointX - m_ptOrg.x) * m_dZoom);
+			ptMarkPos_wnd.y = (int)((inf.pointY - m_ptOrg.y) * m_dZoom);
+			if (ptMarkPos_wnd.x > 0 && ptMarkPos_wnd.x < m_WndRect.right && ptMarkPos_wnd.y > 0 && ptMarkPos_wnd.y < m_WndRect.bottom) {
+				dc.MoveTo(ptMarkPos_wnd.x - 5, ptMarkPos_wnd.y - 5);
+				dc.LineTo(ptMarkPos_wnd.x + 5, ptMarkPos_wnd.y + 5);
+				dc.MoveTo(ptMarkPos_wnd.x + 5, ptMarkPos_wnd.y - 5);
+				dc.LineTo(ptMarkPos_wnd.x - 5, ptMarkPos_wnd.y + 5);
+			}
+		}
+		else if (1 == nType) {     //矩形
+			if (4 == inf.eVision) {
+				dc.SelectObject(&pen);
+			}
+			else {
+				dc.SelectObject(&pen_SearchArea);
+			}
+			CPoint pt0, pt1, pt;
+			pt0.x = (int)((inf.rectX1 - m_ptOrg.x) * m_dZoom);
+			pt0.y = (int)((inf.rectY1 - m_ptOrg.y) * m_dZoom);
+			pt1.x = (int)((inf.rectX2 - m_ptOrg.x) * m_dZoom);
+			pt1.y = (int)((inf.rectY2 - m_ptOrg.y) * m_dZoom);
+			pt.x = (int)(0.5 * (pt0.x + pt1.x));
+			pt.y = (int)(0.5 * (pt0.y + pt1.y));
+			if (pt.x > 0 && pt.x < m_WndRect.right && pt.y > 0 && pt.y < m_WndRect.bottom) {
+				CRect rtMarkSearchPos_wnd = CRect(pt0.x, pt0.y, pt1.x, pt1.y);
+				dc.Rectangle(rtMarkSearchPos_wnd);
+			}
+		}
+		else if (2 == nType) {    //圆
+			dc.SelectObject(&pen);
+			CPoint pt;
+			pt.x = (int)((inf.circleX - m_ptOrg.x) * m_dZoom);
+			pt.y = (int)((inf.circleY - m_ptOrg.y) * m_dZoom);
+			int radius = (int)(inf.circleRadius * m_dZoom);
+			CPoint pt0, pt1;
+			pt0.x = pt.x - radius;
+			pt0.y = pt.y - radius;
+			pt1.x = pt.x + radius;
+			pt1.y = pt.y + radius;
+			if (pt.x > 0 && pt.x < m_WndRect.right && pt.y > 0 && pt.y < m_WndRect.bottom) {
+				CRect rtMarkSearchPos_wnd = CRect(pt0.x, pt0.y, pt1.x, pt1.y);
+				dc.Ellipse(rtMarkSearchPos_wnd);
+			}
+		}
+		else if (3 == nType) {    //直线
+			dc.SelectObject(&pen_Line);
+			CPoint pt0, pt1, pt;
+			pt0.x = (int)((inf.rectX1 - m_ptOrg.x) * m_dZoom);
+			pt0.y = (int)((inf.rectY1 - m_ptOrg.y) * m_dZoom);
+			pt1.x = (int)((inf.rectX2 - m_ptOrg.x) * m_dZoom);
+			pt1.y = (int)((inf.rectY2 - m_ptOrg.y) * m_dZoom);
+			pt.x = (int)(0.5 * (pt0.x + pt1.x));
+			pt.y = (int)(0.5 * (pt0.y + pt1.y));
+			if (pt.x > 0 && pt.x < m_WndRect.right && pt.y > 0 && pt.y < m_WndRect.bottom) {
+				dc.MoveTo(pt0.x, pt0.y);
+				dc.LineTo(pt1.x, pt1.y);
+			}
+		}
+		else if (4 == nType) {    //文本
+			dc.SetBkMode(TRANSPARENT);
+			dc.SetTextColor(RGB(0, 0, 255));
+			CPoint pt;
+			pt.x = (int)((inf.pointX - m_ptOrg.x) * m_dZoom);
+			pt.y = (int)((inf.pointY - m_ptOrg.y) * m_dZoom);
+			dc.TextOut(pt.x - 80, pt.y, inf.strName);
+		}
+	}
+
+	dc.SelectObject(pOldPen);
+	dc.SelectObject(pOldBrush);
+	brush_Null.DeleteObject();
+}
\ No newline at end of file
diff --git a/ENRIT/View/FrameImg.h b/ENRIT/View/FrameImg.h
new file mode 100644
index 0000000..5070575
--- /dev/null
+++ b/ENRIT/View/FrameImg.h
@@ -0,0 +1,187 @@
+#pragma once
+
+
+// CFrameImg
+#include <bitset>
+#include "Global_Define.h"
+#include "cv.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "Glass_Data.h"
+
+using namespace std;
+
+#define WM_AREA_ITEM_SELECT_CHANGE	WM_USER + 0x18
+#define WM_AREA_ITEM_MODIFY			 WM_USER + 0x19
+#define WM_FRAME_IMG_MOUSE_DN		 WM_USER + 0x1A
+
+enum eModeFrameImg{MODE_ZOOM_X=0,MODE_ZOOM_Y,MODE_PROFILE_X,MODE_PROFILE_Y,MODE_PROJECTION_X,MODE_PROJECTION_Y,MODE_SAVED_X,MODE_SAVED_Y
+	,MODE_DISTANCE_X,MODE_DISTANCE_Y,MODE_DIAGONAL,MODE_MARK_REG,MODE_MANIFY,MODE_AUTO_MEASURE,MODE_SHOW_MEASURE_LINE,MODE_SHOW_REF_LINE
+	,MODE_SHOW_SUB_LINE,MODE_MODIFY_BRUSH,MODE_SHOW_FRAM_RATE,MODE_COMPARE_PANEL,MODE_USER_DEFECT_AREA,MAX_DISPLAY_MODE,
+};	
+typedef  struct tagMANUAL_MEASURE
+{
+	BOOL		bStart;
+	BOOL		bModifyStart;
+	BOOL		bModifyEnd;
+	int			nTextPos;
+	CPoint		ptMeasureStart;
+	CPoint		ptMeasureEnd;
+
+}MANUAL_MEASURE;
+
+typedef	 struct tagMARK_REG
+{
+	BOOL		bDown;
+	CPoint		ptMark;
+}MARK_REG;
+
+class CFrameImg : public CWnd
+{
+	DECLARE_DYNAMIC(CFrameImg)
+
+public:
+	CFrameImg();
+	virtual ~CFrameImg();
+
+protected:
+	afx_msg void OnPaint();
+	afx_msg void OnDestroy();
+	afx_msg void OnProfileCheckall();
+	afx_msg void OnProfileClearall();
+	afx_msg void OnProfileCurrentx();
+	afx_msg void OnProfileCurrenty();
+	afx_msg void OnProfileSavedx();
+	afx_msg void OnProfileSavedy();
+	afx_msg void OnProfileProjectionx();
+	afx_msg void OnProfileProjectiony();
+	afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnMeasureCheckall();
+	afx_msg void OnMeasureClearall();
+	afx_msg void OnMeasureDistancex();
+	afx_msg void OnMeasureDistancey();
+	afx_msg void OnMeasureDiagonal();
+	afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnImageManify();
+	afx_msg void OnViewCheckall();
+	afx_msg void OnViewClearall();
+	afx_msg void OnViewShowMeasureLine();
+	afx_msg void OnViewShowRefLine();
+	afx_msg void OnViewShowSubLine();
+	afx_msg void OnImgmodifyDrawbrush();
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void		SetEventWnd(HWND hWnd) {m_Wnd_Event = hWnd; }		
+	void		InitBitMap();
+	void		SetImage(BYTE *pImg)			{m_pBuffer	= pImg; m_szTotBuffer=GetScanBufSize(m_nSide);}
+	void		SetGlassData(CGlass_Data *pGlassData);
+	void		SetSide(int nSide);		
+	int			GetSide(){return m_nSide;}
+	int			GetSideCamID(int nSide);
+	int			GetSideScanIdx(int nSide);
+	void		SetImgSize(long nX, long nY)   {m_szImg.cx =nX; m_szImg.cy = nY;}	
+	void		SetMode(int nMode);
+	BOOL		GetMode(int nMode);
+	void		ResetMode(int nMode);	
+	void		SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe);
+	BYTE*		GetImage()				 {return m_pBuffer;}
+	double		GetZoomData()			{return m_dZoom;}
+	void		SetZommMode(double dZoom)	{m_dZoom = dZoom;}
+	BOOL		IsAutoMeasureMode()	{return m_bitModeDisplay[MODE_AUTO_MEASURE];}	
+	void		ChangeRect();	
+
+	void		DrawProfile(CDC &dc ,int nMode, CPoint pt);
+	void		DrawProfileSaved(CDC &dc ,int nMode, CPoint pt);
+	void		DrawMagnify(CDC &dc);
+	void		DrawManualMeasure(CDC &dc);
+	void		DrawProcessData(CDC &dc);
+	void		ViewUpdate(int nOpt = 0);
+	void		DrawTest(CDC &dc);
+	void		DrawExpectionAear(CDC &dc);
+	void		DrawUserDefectArea(CDC &dc);
+	void		Draw_Rectangle(CDC &dc,CRect rc, int nMode = 0);
+	void		Draw_TrakerRect(CRect rcTracker,CDC &dc);
+	void		Draw_CompareRect(CRect rcCompareArea, CDC &dc);
+	void		DrawDefect(CDC &dc);
+	void		DrawMeasureLine(CDC &dc,CvPoint2D32f *ptMark);
+	void		DrawResultLine(CDC &dc,CvPoint2D32f *ptMark);
+	void		DrawReferenceLine(CDC &dc,CvPoint2D32f *ptMark,BOOL *bMark,int nHafMarkW,int nHafMarkH);
+	void		DrawCorner(CDC &dc,CvPoint2D32f *ptMark);
+	void		DrawHoleArea(CDC &dc);
+	void		DrawCADProfiletLine(CDC &dc,CvPoint2D32f *ptMark);
+	void		DrawCADProfiletResult(CDC &dc,CvPoint2D32f *ptMark);
+	void		DrawCADRCutProfiletResult(CDC &dc,CvPoint2D32f *ptMark);
+	void		DrawCADRCutChamfertResult(CDC &dc,CvPoint2D32f *ptMark);
+
+	// Tracker Function
+	void		SetTrackerModify(BOOL bAlbe)	{ m_bModify = bAlbe;}
+	void		TrackerInsert();
+	int			ChkExpetionAear(CPoint pt);
+	void		SetTrackerPos(int nTrackerMode,CRect * pRc,CPoint pt , int nMode = 0);
+	BOOL		SetAcitveTracker(EXECPTION_AREA *pTracker,BOOL bReDraw = TRUE);
+	int			ChkTrackerAear(CRect &rcTracker,CPoint pt);
+	//LRESULT OnSelectExeptionItem(WPARAM wParam, LPARAM lParam);
+	CRect		GetMartRect();
+	void		SetMarkRect(CRect rc);
+	CRect		GetCompareRect(void);		
+	void		SetMainInterface(IViewInterface2Parent *pI2M){m_pI2M=pI2M;}
+
+	void UpdataVisionResult(void);   //显示视觉结果
+	void UpdateView_VisionResult(CDC &dc);
+	void UpDateView_MouseDownPos(CDC &dc);
+
+private:
+	void		ConvertOrgToScreen(CPoint pt,CPoint &det);
+	void		GetResolution(double &dH,double &dV);	
+	CSize		GetScanBufSize(int iSide);
+	
+
+private:
+	HWND					m_Wnd_Event;
+	BOOL					m_bModify;
+	BOOL					m_bMouseLDown;
+	BOOL					m_bVCRDraw;
+	BYTE					*m_pBuffer;
+	CSize					m_szTotBuffer;
+	BITMAPINFO				*m_pBmInfo;		
+	double					m_dZoom;
+	int						m_nModeTracker;
+	CPoint					m_ptOldMouse;
+	int						m_nCam;
+	int						m_nSide;	
+	SIZE					m_szImg;
+	SIZE					m_szMark;
+	MANUAL_MEASURE			m_ManualMeausre;
+	CPoint					m_ptMouseSaved;		// Profile Save 扁瓷矫 荤侩
+
+	IViewInterface2Parent	*m_pI2M;
+	bitset<MAX_DISPLAY_MODE>		m_bitModeDisplay;	// 拳搁 葛靛 bit
+	CRect					m_rcROI;			// 泅力 焊咯瘤绊 乐绰 康开
+	CFont					m_sideFont;
+	CImage  				m_ImageMagnify;
+	EXECPTION_AREA			m_refMark;
+	EXECPTION_AREA			*m_pCompareArea;
+	_ST_GDI_ITEM			m_st_GdiItem;		
+	
+	CGlass_Data				*m_pGlassData;
+	CHardwareSettings		*m_pHardware;
+	CGlassRecipe		*m_pRecipe;
+//	CRecipe					m_RecipeManager;	
+
+public:	
+	CPoint			m_ptMouseCurrent;   // 泅犁 付快胶 谅钎
+	CPoint          m_ptMouseDown;
+	EXECPTION_AREA  *m_pTracker;
+	CRect			m_WndRect;
+	POINT			m_ptOrg;				// 傈眉 捞固瘤俊辑 Display 矫累 谅钎
+	CRect			m_testMark;
+
+	int				m_nModeTrackerVCR;
+	CPoint			m_ptOldMouseVCR;	
+};
+
+
diff --git a/ENRIT/View/GlassMap.cpp b/ENRIT/View/GlassMap.cpp
new file mode 100644
index 0000000..1fefac7
--- /dev/null
+++ b/ENRIT/View/GlassMap.cpp
@@ -0,0 +1,2542 @@
+// GlassMap.cpp: implementation of the CGlassMap class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "GlassMap.h"
+#include <math.h>
+#include "Global_Define.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CGlassMap::CGlassMap()
+{
+	m_nMinDefectSize	= 3;
+	m_nBlinkColor		= 0;	
+	m_pRecipe			= NULL;
+	m_pHardwareSetting	= NULL;
+
+	m_bSetZoomMode		= FALSE;
+	m_bZoomDrag			= FALSE;
+	m_bZoomInMode		= FALSE;	
+	m_rectZoomDrag.SetRect(0,0,0,0);
+	m_rectZoomWindow.SetRect(0,0,0,0);	
+
+	m_dZoomRatioH = m_dZoomRatioV = 1;
+
+	m_pMapDefect = NULL;
+	m_pSelDefect = NULL;
+	m_pGlassData = NULL;
+
+//iskang Add notch iamge view
+	m_bNotch = TRUE;
+	m_nNotchDir = NotchDir_Non;
+
+	m_BrushDefect[0].CreateSolidBrush(COLOR_0);
+	m_BrushDefect[1].CreateSolidBrush(COLOR_4);
+	m_BrushDefect[2].CreateSolidBrush(COLOR_2);
+	m_BrushDefect[3].CreateSolidBrush(COLOR_1);
+	m_BrushDefect[4].CreateSolidBrush(COLOR_4);
+
+	ZeroMemory(m_dGlasssize,sizeof(double)*2);
+
+	m_bTFTArea = FALSE;
+
+	int			i;	
+	for(i=0;i<4;i++)
+	{
+		ZeroMemory(m_nCutAreaSize[i],sizeof(int)*MAX_POINT_VALUE_CNT);
+		ZeroMemory(m_nDimensionSize[i],sizeof(int)*MAX_POINT_VALUE_CNT);		
+	}
+	ZeroMemory(m_dSplineSize,sizeof(double)*4);
+	ZeroMemory(m_nCutAreaAVG,sizeof(int)*4);
+	ZeroMemory(m_nDimensionAVG,sizeof(int)*4);
+
+	ZeroMemory(m_dCornerSize_X,sizeof(double)*4);
+	ZeroMemory(m_dCornerSize_Y,sizeof(double)*4);
+
+	m_ptrOtherSideClass = NULL;
+}
+
+CGlassMap::~CGlassMap()
+{
+	int			i;
+
+	for(i=0;i<RCUT_DEFECT_TYPECOUNT;i++)
+	{
+		m_BrushDefect[i].DeleteObject();
+	}
+}
+
+void CGlassMap::SetGlassRecipe(CHardwareSettings *pHard,CGlassRecipe* pRecipe,BOOL bTFTArea)
+{
+	m_pRecipe			= pRecipe;
+	if(pRecipe == NULL)
+		return;
+
+	m_pHardwareSetting = pHard;
+
+	m_bTFTArea = bTFTArea;
+
+//iskang Add notch iamge view
+	if(m_pRecipe->m_InspectInfoParm.GetNotchSizeUse(DIMENSION_NONE))
+	{
+		m_bNotch = TRUE;
+
+		//int ScanIndex=0;
+		DimensionDir enDir = DIMENSION_NONE; 
+
+		for(int j=0;j<MAX_SCAN_COUNT;j++)
+		{
+			if(m_pRecipe->m_InspectInfoParm.GetNotchSizeUse((DimensionDir)j)) enDir = (DimensionDir)j;
+		}
+		//DimensionDir enDir = m_pRecipe->m_GlassParm.GetScanToDimension(ScanIndex);
+
+		switch(enDir)
+		{
+		case DIMENSION_A:
+			m_nNotchDir=NotchDir_A;
+			break;
+		case DIMENSION_B:
+			m_nNotchDir=NotchDir_B;
+			break;
+		case DIMENSION_C:
+			m_nNotchDir=NotchDir_C;
+			break;
+		case DIMENSION_D:
+			m_nNotchDir=NotchDir_D;
+			break;
+		case DIMENSION_NONE:
+			m_nNotchDir=NotchDir_Non;
+			break;
+		}
+	}
+	else m_bNotch =FALSE , m_nNotchDir = NotchDir_Non;
+
+	GlassDirection GD =	m_pRecipe->m_GlassParm.m_OriginDirection;
+	if (GD == GD_LeftTop)
+		m_OriginDir	= OD_LeftTop;
+	else if (GD == GD_LeftBottom)
+		m_OriginDir = OD_LeftBottom;
+	else if (GD == GD_RightTop)
+		m_OriginDir = OD_RightTop;
+	else if (GD == GD_RightBottom)
+		m_OriginDir = OD_RightBottom;
+
+	m_nCCutSize			= m_nUnitSize * 20;
+	
+	switch(GD)
+	{
+	case GD_LeftTop:
+		m_PointCCut[0] = CPoint(m_RectMap.left, m_RectMap.top);
+		m_PointCCut[1] = CPoint(m_RectMap.left + m_nCCutSize, m_RectMap.top);
+		m_PointCCut[2] = CPoint(m_RectMap.left, m_nCCutSize + m_RectMap.top);
+		break;
+	case GD_LeftBottom:
+		m_PointCCut[0] = CPoint(m_RectMap.left, m_nMapHeight + m_RectMap.top);
+		m_PointCCut[1] = CPoint(m_RectMap.left + m_nCCutSize, m_nMapHeight + m_RectMap.top);
+		m_PointCCut[2] = CPoint(m_RectMap.left, m_nMapHeight - m_nCCutSize + m_RectMap.top);
+		break;
+	case GD_RightTop:
+		m_PointCCut[0] = CPoint(m_RectMap.left + m_nMapWidth, m_RectMap.top);
+		m_PointCCut[1] = CPoint(m_RectMap.left + m_nMapWidth - m_nCCutSize, m_RectMap.top);
+		m_PointCCut[2] = CPoint(m_RectMap.left + m_nMapWidth, m_nCCutSize + m_RectMap.top);
+		break;
+	case GD_RightBottom:
+		m_PointCCut[0] = CPoint(m_RectMap.left + m_nMapWidth, m_nMapHeight + m_RectMap.top);
+		m_PointCCut[1] = CPoint(m_RectMap.left + m_nMapWidth - m_nCCutSize, m_nMapHeight + m_RectMap.top);
+		m_PointCCut[2] = CPoint(m_RectMap.left + m_nMapWidth, m_nMapHeight - m_nCCutSize + m_RectMap.top);
+		break;
+	}
+
+	ZeroMemory(m_dGlasssize,sizeof(double)*2);
+
+	int			i;	
+	for(i=0;i<4;i++)
+	{
+		ZeroMemory(m_nCutAreaSize[i],sizeof(int)*MAX_POINT_VALUE_CNT);
+		ZeroMemory(m_nDimensionSize[i],sizeof(int)*MAX_POINT_VALUE_CNT);		
+	}
+	ZeroMemory(m_dSplineSize,sizeof(double)*4);
+	ZeroMemory(m_nCutAreaAVG,sizeof(int)*4);
+	ZeroMemory(m_nDimensionAVG,sizeof(int)*4);
+
+	ZeroMemory(m_dCornerSize_X,sizeof(double)*4);
+	ZeroMemory(m_dCornerSize_Y,sizeof(double)*4);
+
+	Invalidate();
+}
+
+int CGlassMap::GetSmallSize()
+{
+	int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+	if (nUnit == 0)
+		nUnit = 1;
+	
+	return static_cast<int>(m_nMinDefectSize * nUnit);
+}
+
+int CGlassMap::GetMidSize()
+{
+	int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+	if (nUnit == 0)
+		nUnit = 1;
+	
+	return static_cast<int>(m_nMinDefectSize * nUnit);
+}
+
+int CGlassMap::GetLargeSize()
+{
+	int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+	if (nUnit == 0)
+		nUnit = 1;
+	
+	return static_cast<int>(m_nMinDefectSize * nUnit);
+}
+
+int CGlassMap::GetHugeSize()
+{
+	int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+	if (nUnit == 0)
+		nUnit = 1;
+	
+	return static_cast<int>(m_nMinDefectSize * nUnit);
+}
+
+void	CGlassMap::CalDefectRect(CPoint &point,BOOL bRet,BOOL bDirOpt)
+{	
+	if(m_pRecipe == NULL)
+		return;
+
+	GlassDirection GD = m_pRecipe->m_GlassParm.m_OriginDirection;	
+	
+	switch(GD)
+	{
+	case GD_LeftTop:			
+		break;
+	case GD_LeftBottom:	
+		if(bRet==FALSE)
+			point.y = m_RectMap.bottom-point.y;		
+		else
+			point.y = m_rectGlass.Height()-point.y;
+		break;
+	case GD_RightTop:		
+		if(bRet==FALSE)
+			point.x = m_RectMap.right-point.x;		
+		else
+			point.x = m_rectGlass.Width()-point.x;		
+		break;
+	case GD_RightBottom:		
+		if(bRet==FALSE)
+		{
+			point.x = m_RectMap.right-point.x;		
+			point.y = m_RectMap.bottom-point.y;		
+		}
+		else
+		{
+			point.x = m_rectGlass.Width()-point.x;		
+			point.y = m_rectGlass.Height()-point.y;		
+		}
+		break;
+	}		
+}
+
+void	CGlassMap::CalDefectRect(CRect &rect,BOOL bRet,BOOL bDirOpt)
+{
+	if(m_pRecipe == NULL)
+		return;
+	
+	GlassDirection GD = m_pRecipe->m_GlassParm.m_OriginDirection;
+	
+	switch(GD)
+	{
+	case GD_LeftTop:			
+		break;
+	case GD_LeftBottom:	
+		if(bRet==FALSE)
+		{
+			rect.top = m_RectMap.bottom-rect.top;
+			rect.bottom = m_RectMap.bottom-rect.bottom;
+		}
+		else
+		{
+			rect.top = m_rectGlass.Height()-rect.top;
+			rect.bottom = m_rectGlass.Height()-rect.bottom;
+		}
+		break;
+	case GD_RightTop:		
+		if(bRet==FALSE)
+		{
+			rect.left = m_RectMap.right-rect.left;
+			rect.right = m_RectMap.right-rect.right;		
+		}
+		else
+		{
+			rect.left = m_rectGlass.Width()-rect.left;
+			rect.right = m_rectGlass.Width()-rect.right;
+		}
+		break;
+	case GD_RightBottom:	
+		if(bRet==FALSE)
+		{
+			rect.left = m_RectMap.right-rect.left;
+			rect.right = m_RectMap.right-rect.right;
+			rect.top = m_RectMap.bottom-rect.top;
+			rect.bottom = m_RectMap.bottom-rect.bottom;
+		}
+		else
+		{
+			rect.left = m_rectGlass.Width()-rect.left;
+			rect.right = m_rectGlass.Width()-rect.right;
+			rect.top = m_rectGlass.Height()-rect.top;
+			rect.bottom = m_rectGlass.Height()-rect.bottom;
+		}
+		break;
+	}	
+	rect.NormalizeRect();
+}
+
+void CGlassMap::DrawZoonInMode(CDC *pDC,CControlMemDC *memDC)
+{	
+	CDC BackDC;
+	CBitmap BackBmp;
+	CRect	rt;
+
+	BackDC.CreateCompatibleDC(pDC);
+	GetClientRect(&rt);
+	BackBmp.CreateCompatibleBitmap(pDC, rt.right, rt.bottom);
+	BackDC.SelectObject(BackBmp);
+
+	pDC->BitBlt(m_RectWnd.left, m_RectWnd.top, m_RectWnd.Width(), m_RectWnd.Height(),
+                    memDC, m_RectWnd.left, m_RectWnd.top, SRCCOPY);
+
+	BackDC.StretchBlt(0, 0, rt.right, rt.bottom, pDC, 0, 0, rt.right, rt.bottom, SRCCOPY);
+	CBrush brushGlass( RGB(0,0,0) );	
+	memDC->FillRect( &rt, &brushGlass );
+	memDC->StretchBlt(0, 0, rt.right, rt.bottom, &BackDC, m_rectZoomWindow.left, m_rectZoomWindow.top, m_rectZoomWindow.Width(), m_rectZoomWindow.Height(), SRCCOPY);
+
+	BackBmp.DeleteObject();
+	BackDC.DeleteDC();
+	brushGlass.DeleteObject();		
+}
+
+CString CGlassMap::GetPositionString(DimensionDir dir)
+{
+	CString		str;
+	int			nAddSide = 0;
+
+	if(m_bTFTArea == TRUE)
+		nAddSide = 4;
+
+	dir = (DimensionDir)(dir+nAddSide);
+		
+	switch(dir)
+	{
+	case DIMENSION_A: str = "A T Pos"; break;
+	case DIMENSION_B: str = "B T Pos"; break;
+	case DIMENSION_C: str = "C T Pos"; break;
+	case DIMENSION_D: str = "D T Pos"; break;
+	case DIMENSION_A_DN: str = "A B Pos"; break;
+	case DIMENSION_B_DN: str = "B B Pos"; break;
+	case DIMENSION_C_DN: str = "C B Pos"; break;
+	case DIMENSION_D_DN: str = "D B Pos"; break;
+	}
+	
+	return str;
+}
+
+#define	COLOR_PATTERN		RGB(20,20,20)
+#define	COLOR_BM			RGB(185,205,230)
+#define	COLOR_GLASS_BRUSH	RGB(0,0,0)
+#define	COLOR_GLASS_LINE_BRUSH	RGB(200,200,200)
+#define	COLOR_GLASS_PEN		RGB(255,255,255)
+#define	COLOR_GLASS_LINE_PEN	RGB(0,255,0)
+#define	COLOR_GLASS_SIZE_PEN	RGB(255,255,0)
+
+void CGlassMap::DrawDefects(MapDefect* pMapDefect,CGlass_Data *pGlassData)
+{
+	if (!pMapDefect)
+	{
+		m_pMapDefect = NULL;
+		m_pGlassData = NULL;
+	}
+	else
+	{
+		m_pMapDefect = pMapDefect;
+		m_pGlassData = pGlassData;
+	}
+
+	m_pSelDefect = NULL;
+	KillTimer(ID_TIMER_BLINK);
+}
+
+BOOL CGlassMap::SetSelectDefect(int nGlassDefectIdx)
+{
+	m_pSelDefect = NULL;
+	KillTimer(ID_TIMER_BLINK);
+	Invalidate(FALSE);
+
+	if (!m_pMapDefect)
+		return FALSE;
+
+	BOOL		bFind = FALSE;
+	
+	CInspectDefect* pDefect;
+	for (MapDefectIt it = m_pMapDefect->begin(); it != m_pMapDefect->end(); it++)
+	{
+		pDefect = static_cast<CInspectDefect*>(it->second);
+
+		// 眠盔惫 UI 函版
+		/*
+		if(pDefect == NULL || m_bTFTArea == TRUE && pDefect->m_nCameraID == 0)
+			continue;
+		else if(m_bTFTArea == FALSE && pDefect->m_nCameraID == 1)
+			continue;
+			*/
+
+		if (pDefect && pDefect->m_nGlassDefectIdx == nGlassDefectIdx)
+		{
+			m_pSelDefect = pDefect;
+			Invalidate(FALSE);
+			SetTimer(ID_TIMER_BLINK, 100, NULL);
+			bFind = TRUE;
+			break;
+		}
+	}
+
+	//for (MapDefectIt it = m_pMapDefect->begin(); it != m_pMapDefect->end(); it++)
+	for (MapDefectIt it = m_ptrOtherSideClass->m_pMapDefect->begin(); it != m_ptrOtherSideClass->m_pMapDefect->end(); it++)
+	{
+		pDefect = static_cast<CInspectDefect*>(it->second);
+		// 眠盔惫 UI 函版
+		/*
+		if(pDefect == NULL || m_bTFTArea == TRUE && pDefect->m_nCameraID == 0)
+			continue;
+		else if(m_bTFTArea == FALSE && pDefect->m_nCameraID == 1)
+			continue;
+			*/
+
+		if (pDefect && pDefect->m_nGlassDefectIdx == nGlassDefectIdx)
+		{
+			m_pSelDefect = pDefect;
+			Invalidate(FALSE);
+			SetTimer(ID_TIMER_BLINK, 100, NULL);
+			bFind = TRUE;
+			break;
+		}
+	}
+
+	return bFind;
+}
+
+void CGlassMap::SetGlasssize(int nIdx,double dValue)
+{
+	m_dGlasssize[nIdx] = dValue;
+
+	Invalidate(FALSE);
+}
+
+void CGlassMap::SetPointCutData(DimensionDir enDir,double *pCutArea,double dAvgVal)
+{
+	if(enDir < DIMENSION_A || enDir > DIMENSION_D)
+		return;
+
+	for(int i=0;i<MAX_POINT_VALUE_CNT;i++)
+	{
+		m_nCutAreaSize[enDir][i] = (int)pCutArea[i*2];
+	}
+
+	m_nCutAreaAVG[enDir] = (int)dAvgVal;
+}
+
+void CGlassMap::SetPointDimenData(DimensionDir enDir,double *pDimen,double dAvgVal)
+{
+	if(enDir < DIMENSION_A || enDir > DIMENSION_D)
+		return;
+
+	for(int i=0;i<MAX_POINT_VALUE_CNT;i++)
+	{
+		m_nDimensionSize[enDir][i] = (int)pDimen[i*2];
+	}
+
+	m_nDimensionAVG[enDir] = (int)dAvgVal;
+}
+
+void CGlassMap::SetSplineData(Disp_SplineLocation enDir,double dValue)
+{
+	if(enDir < Disp_Spline_BotRight || enDir > Disp_Spline_TopLeft)
+		return;
+
+	m_dSplineSize[enDir] = dValue;
+}
+
+void CGlassMap::SetCornerXData(Disp_SplineLocation enDir,double dValue)
+{
+	if(enDir < Disp_Spline_BotRight || enDir > Disp_Spline_TopLeft)
+		return;
+
+	m_dCornerSize_X[enDir] = dValue;
+}
+
+void CGlassMap::SetCornerYData(Disp_SplineLocation enDir,double dValue)
+{
+	if(enDir < Disp_Spline_BotRight || enDir > Disp_Spline_TopLeft)
+		return;
+
+	m_dCornerSize_Y[enDir] = dValue;
+}
+
+void CGlassMap::DrawGlassPosition(HDC hDC)
+{
+	if(m_pRecipe == NULL)
+		return;
+
+	HFONT		font,pOldFont;	
+
+	font = ::CreateFont(14, 0, 0, 0, FW_BOLD, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+	pOldFont = (HFONT) ::SelectObject(hDC, font);		
+	if(::GetTextColor(hDC) != COLOR_GLASS_BRUSH) ::SetTextColor(hDC, COLOR_GLASS_BRUSH);
+	::SetBkMode(hDC, TRANSPARENT);	
+
+	CBrush		BrushCCut( RGB(160,255,160) );
+	HBRUSH		pOldBrush = (HBRUSH)::SelectObject(hDC,(HBRUSH)BrushCCut);	
+
+	CString		str;
+	CRect		rect;
+	int			nOffset = 2;
+	int			nHSize = 60,nVSize = 16;
+	int			nBoxSize = 20;
+		
+	// D
+	rect = m_rectGlass;
+	rect.left = rect.left + nHSize/2;
+	rect.right = rect.left + nHSize;
+	rect.top = m_rectGlass.top + m_rectGlass.Height()/2 - nVSize/2;
+	rect.bottom = rect.top + nVSize;	
+	//rect.OffsetRect(0,-1*nBoxSize);
+	str = GetPositionString(DIMENSION_D);
+	if(m_pRecipe->GetInspectInfo()->GetCutAreaUse(DIMENSION_NONE) == TRUE || m_pRecipe->GetInspectInfo()->GetDimenUse(DIMENSION_NONE) == TRUE )
+	{
+		::FillRect(hDC,&rect,BrushCCut);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	
+	}
+	rect.OffsetRect(0,nVSize);
+	//DrawPointValue(hDC,rect,CPoint(0,0),&m_nCutAreaAVG[DIMENSION_D], &m_nDimensionAVG[DIMENSION_D],1);
+	//DrawPointValue(hDC,rect,CPoint(0,0),&m_nCutAreaAVG[DIMENSION_D],&(m_ptrOtherSideClass->m_nCutAreaAVG[DIMENSION_D]), &m_nDimensionAVG[DIMENSION_D],1);
+
+	// B
+	rect = m_rectGlass;	
+	rect.right = rect.right - nHSize/2;
+	rect.left = rect.right - nHSize;
+	rect.top = m_rectGlass.top + m_rectGlass.Height()/2 - nVSize/2;
+	rect.bottom = rect.top + nVSize;
+	//rect.OffsetRect(0,-1*nBoxSize);
+	str = GetPositionString(DIMENSION_B);
+	if(m_pRecipe->m_InspectInfoParm.GetCutAreaUse(DIMENSION_NONE) == TRUE || m_pRecipe->m_InspectInfoParm.GetDimenUse(DIMENSION_NONE) == TRUE )
+	{
+		::FillRect(hDC,&rect,BrushCCut);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	
+	}
+	rect.OffsetRect(0,nVSize);
+	//DrawPointValue(hDC,rect,CPoint(0,0),&m_nCutAreaAVG[DIMENSION_B],&m_nDimensionAVG[DIMENSION_B],1);
+	//DrawPointValue(hDC,rect,CPoint(0,0),&m_nCutAreaAVG[DIMENSION_B],&(m_ptrOtherSideClass->m_nCutAreaAVG[DIMENSION_B]), &m_nDimensionAVG[DIMENSION_B],1);
+
+	// A
+	rect = m_rectGlass;
+	rect.left = m_rectGlass.left + m_rectGlass.Width()/2 - nHSize/2;
+	rect.right = rect.left + nHSize;
+	rect.top = rect.top + nVSize*2;
+	rect.bottom = rect.top + nVSize;
+	//rect.OffsetRect(0,nOffset/2);
+	str = GetPositionString(DIMENSION_A);	
+	if(m_pRecipe->m_InspectInfoParm.GetCutAreaUse(DIMENSION_NONE) == TRUE || m_pRecipe->m_InspectInfoParm.GetDimenUse(DIMENSION_NONE) == TRUE )
+	{
+		::FillRect(hDC,&rect,BrushCCut);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+	}
+	rect.OffsetRect(0,nVSize);
+	//DrawPointValue(hDC,rect,CPoint(0,0),&m_nCutAreaAVG[DIMENSION_A],&m_nDimensionAVG[DIMENSION_A],1);
+	//DrawPointValue(hDC,rect,CPoint(0,0),&m_nCutAreaAVG[DIMENSION_A],&(m_ptrOtherSideClass->m_nCutAreaAVG[DIMENSION_A]), &m_nDimensionAVG[DIMENSION_A],1);
+
+	// C
+	rect = m_rectGlass;
+	rect.left = m_rectGlass.left + m_rectGlass.Width()/2 - nHSize/2;
+	rect.right = rect.left + nHSize;	
+	rect.top = m_rectGlass.bottom - nVSize*2;
+	rect.bottom = rect.top + nVSize;
+	//rect.OffsetRect(0,-1*nOffset -10);
+	str = GetPositionString(DIMENSION_C);	
+	if(m_pRecipe->m_InspectInfoParm.GetCutAreaUse(DIMENSION_NONE) == TRUE || m_pRecipe->m_InspectInfoParm.GetDimenUse(DIMENSION_NONE) == TRUE )
+	{
+		::FillRect(hDC,&rect,BrushCCut);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+	}
+	rect.OffsetRect(0,nVSize);
+	//DrawPointValue(hDC,rect,CPoint(0,0),&m_nCutAreaAVG[DIMENSION_C],&m_nDimensionAVG[DIMENSION_C],1);
+	//DrawPointValue(hDC,rect,CPoint(0,0),&m_nCutAreaAVG[DIMENSION_C],&(m_ptrOtherSideClass->m_nCutAreaAVG[DIMENSION_C]), &m_nDimensionAVG[DIMENSION_C],1);
+
+	::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+	::DeleteObject(font);
+	if(pOldBrush) ::SelectObject(hDC,(HBRUSH)pOldBrush);
+}
+
+static int compPoly(const void *a,const void *b)
+{
+	return *(int*)a - *(int*)b;
+}
+
+void CGlassMap::FillPolygon(HDC hDC,POINT *poly,int npoly,DWORD color,int nTop,int nBottom)
+{
+	int		*nodeX = new int[npoly];
+	int		i,j,x,y,nodes;
+
+	for(y=nTop;y<nBottom;y++)
+	{
+		nodes = 0;
+
+		for(i=0,j=npoly-1;i<npoly;j=i++)
+		{
+			if(poly[i].y < y && poly[j].y >= y || poly[j].y < y && poly[i].y >= y)
+			{
+				nodeX[nodes++] = (int)(poly[i].x + double(y-poly[i].y)*double(poly[j].x-poly[i].x)/double(poly[j].y-poly[i].y) + .5);
+			}
+		}
+
+		qsort(nodeX,nodes,sizeof(int),compPoly);
+
+		for(i=0;i<nodes;i+=2)
+		{
+		//	if(nodeX[i] >= m_rectGlass.Width())
+		//		break;
+			if(nodeX[i+1] > 0)
+			{
+				if(nodeX[i] < 0) nodeX[i] = 0;
+			//	if(nodeX[i+1] > m_rectGlass.Width()) nodeX[i+1] = m_rectGlass.Width();
+				for(x=nodeX[i];x<nodeX[i+1];x++)
+				{
+					::SetPixel(hDC,x,y,color);
+				}
+			}
+		}
+	}
+
+	delete[] nodeX;
+}
+
+void CGlassMap::DrawSplineValue(HDC hDC)
+{
+	Disp_SplineLocation enDir;
+	int					i;
+	CRect				rect;
+	CBrush				BrushSpline,*pOldBrush,BrushCutArea,BrushCutArea2;
+	CPen				Penouter;
+	const	int			nHSize = 40,nVSize = 14,nSkipSize = 5;
+	CString				str;
+
+	BrushCutArea.CreateSolidBrush(RGB(100,100,255));
+	BrushCutArea2.CreateSolidBrush(RGB(200,200,0));
+	BrushSpline.CreateSolidBrush(RGB(255,100,0));	
+	pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushSpline);
+
+	Penouter.CreatePen(PS_SOLID, 1, RGB(255,255,255));
+	HPEN OldPen = (HPEN)::SelectObject(hDC,Penouter);
+
+	HFONT		font,pOldFont;	
+
+	font = ::CreateFont(14, 0, 0, 0, FW_BOLD, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+	pOldFont = (HFONT) ::SelectObject(hDC, font);		
+	if(::GetTextColor(hDC) != COLOR_GLASS_BRUSH) ::SetTextColor(hDC, COLOR_GLASS_BRUSH);
+	::SetBkMode(hDC, TRANSPARENT);	
+
+	for(i=0;i<4;i++)
+	{
+		enDir = (Disp_SplineLocation)i;
+		switch(enDir)
+		{
+		case Disp_Spline_BotRight:
+			rect.top = m_rectGlass.bottom+nVSize*2;
+			rect.bottom = rect.top + nVSize;
+			rect.left = m_rectGlass.right;
+			rect.right = rect.left + nHSize;
+			rect.OffsetRect(-nSkipSize,-nSkipSize);
+			break;
+		
+		case Disp_Spline_BotLeft:
+			rect.top = m_rectGlass.bottom+nVSize*2;
+			rect.bottom = rect.top + nVSize;
+			rect.right = m_rectGlass.left;
+			rect.left = rect.right - nHSize;
+			rect.OffsetRect(nSkipSize,-nSkipSize);
+			break;
+		case Disp_Spline_TopRight:
+			rect.bottom = m_rectGlass.top;
+			rect.top = rect.bottom - nVSize;
+			rect.left = m_rectGlass.right;
+			rect.right = rect.left + nHSize;
+			rect.OffsetRect(-nSkipSize,nSkipSize);
+			break;
+		
+		case Disp_Spline_TopLeft:
+			rect.bottom = m_rectGlass.top;
+			rect.top = rect.bottom - nVSize;
+			rect.right = m_rectGlass.left;
+			rect.left = rect.right - nHSize;
+			rect.OffsetRect(nSkipSize,nSkipSize);
+			break;
+		}
+
+		int			nMapIndex = m_MapIndex.m_nIndex[4][i];	
+
+		if(m_bTFTArea == TRUE)
+		{
+			rect.OffsetRect(0,-rect.Height());
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea);
+			::FillRect(hDC,&rect, (HBRUSH)BrushCutArea);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+			str.Format(_T("%d"),nMapIndex);	
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	
+
+			nMapIndex--;
+			if(m_pGlassData == NULL)
+				str.Format(_T("0"));
+			else
+			{				
+				PROFILECHAMFER_RESULT_DATA *pProfile = m_pGlassData->GetProfileInspectData();
+				if(nMapIndex >= 0 && nMapIndex < MAX_PROFILE_SETTING_COUNT)
+				{
+					str.Format(_T("%.3f"),(double)pProfile->ProfileData[nMapIndex].nProfileDiff/1000.);					
+				}
+				else
+				{
+					str.Format(_T("0"));
+				}					
+			}
+
+			rect.OffsetRect(0,rect.Height());
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea2);
+			::FillRect(hDC,&rect, (HBRUSH)BrushCutArea2);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);				
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+		}
+		else
+		{
+			rect.OffsetRect(0,-(rect.Height()*2));
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea);
+			::FillRect(hDC,&rect, (HBRUSH)BrushCutArea);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+			str.Format(_T("%d"),nMapIndex);	
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	
+
+			nMapIndex--;
+			if(m_pGlassData == NULL)
+				str.Format(_T("0"));
+			else
+			{				
+				PROFILECHAMFER_RESULT_DATA *pProfile = m_pGlassData->GetProfileInspectData();
+				if(nMapIndex >= 0 && nMapIndex < MAX_PROFILE_SETTING_COUNT)
+				{
+					str.Format(_T("%.3f"),(double)pProfile->ResultChamfer[nMapIndex][0].nChamferCalThick/1000.);					
+				}
+				else
+				{
+					str.Format(_T("0"));
+				}					
+			}
+			rect.OffsetRect(0,rect.Height());
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea2);
+			::FillRect(hDC,&rect, (HBRUSH)BrushCutArea2);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);		
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	
+
+			if(m_pGlassData == NULL)
+				str.Format(_T("0"));
+			else
+			{
+				PROFILECHAMFER_RESULT_DATA *pProfile = m_pGlassData->GetProfileInspectData();
+				if(nMapIndex >= 0 && nMapIndex < MAX_PROFILE_SETTING_COUNT)
+				{
+					str.Format(_T("%.3f"),(double)pProfile->ResultChamfer[nMapIndex][1].nChamferCalThick/1000.);					
+				}
+				else
+				{
+					str.Format(_T("0"));
+				}					
+			}
+			rect.OffsetRect(0,rect.Height());
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushSpline);
+			::FillRect(hDC,&rect, (HBRUSH)BrushSpline);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);			
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	
+		}		
+	}
+
+	::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+	::DeleteObject(font);
+	::SelectObject(hDC , (HBRUSH)pOldBrush);
+	BrushSpline.DeleteObject();
+	BrushCutArea.DeleteObject();
+	BrushCutArea2.DeleteObject();
+}
+
+void CGlassMap::DrawCornerXValue( HDC hDC )
+{
+	if(m_pRecipe->m_InspectInfoParm.m_CornerParm.m_bUse == FALSE)
+		return ;
+
+	Disp_SplineLocation enDir;
+	int					i;
+	CRect				rect;
+	CBrush				BrushSpline,*pOldBrush;
+	CPen				Penouter;
+	const	int			nHSize = 40,nVSize = 14,nSkipSize = 5;
+	CString				str;
+
+	BrushSpline.CreateSolidBrush(RGB(100,255,20));
+	pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushSpline);
+
+	Penouter.CreatePen(PS_SOLID, 1, RGB(255,255,255));
+	HPEN OldPen = (HPEN)::SelectObject(hDC,Penouter);
+
+	HFONT		font,pOldFont;	
+
+	font = ::CreateFont(14, 0, 0, 0, FW_BOLD, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+	pOldFont = (HFONT) ::SelectObject(hDC, font);		
+	if(::GetTextColor(hDC) != COLOR_GLASS_BRUSH) ::SetTextColor(hDC, COLOR_GLASS_BRUSH);
+	::SetBkMode(hDC, TRANSPARENT);	
+
+	for(i=0;i<4;i++)
+	{
+		enDir = (Disp_SplineLocation)i;
+		switch(enDir)
+		{
+		case Disp_Spline_BotRight:
+			rect.top = m_rectGlass.bottom + nSkipSize;
+			rect.bottom = rect.top + nVSize;
+			rect.right = m_rectGlass.right - nSkipSize;
+			rect.left = rect.right - nHSize;
+			//rect.OffsetRect(-nSkipSize,-nSkipSize);
+			break;
+
+		case Disp_Spline_BotLeft:
+			rect.top = m_rectGlass.bottom + nSkipSize;
+			rect.bottom = rect.top + nVSize;
+			rect.left = m_rectGlass.left + nSkipSize;
+			rect.right = rect.left + nHSize;
+			//rect.OffsetRect(nSkipSize,-nSkipSize);
+			break;
+		case Disp_Spline_TopRight:
+			rect.bottom = m_rectGlass.top - nSkipSize;
+			rect.top = rect.bottom - nVSize;
+			rect.right = m_rectGlass.right - nSkipSize;
+			rect.left = rect.right - nHSize;
+			//rect.OffsetRect(-nSkipSize,nSkipSize);
+			break;
+
+		case Disp_Spline_TopLeft:
+			rect.bottom = m_rectGlass.top - nSkipSize;
+			rect.top = rect.bottom - nVSize;
+			rect.left = m_rectGlass.left + nSkipSize;
+			rect.right = rect.left + nHSize;
+			//rect.OffsetRect(nSkipSize,nSkipSize);
+			break;
+		}
+
+		::FillRect(hDC,&rect, (HBRUSH)BrushSpline);
+		::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+		str.Format(_T("%.0f"),m_dCornerSize_X[i]);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+	}
+
+	::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+	::DeleteObject(font);
+	::SelectObject(hDC , (HBRUSH)pOldBrush);
+	BrushSpline.DeleteObject();
+}
+
+void CGlassMap::DrawCornerYValue( HDC hDC )
+{
+	if(m_pRecipe->m_InspectInfoParm.GetCornerParm()->m_bUse == FALSE)
+		return ;
+
+	Disp_SplineLocation enDir;
+	int					i;
+	CRect				rect;
+	CBrush				BrushSpline,*pOldBrush;
+	CPen				Penouter;
+	const	int			nHSize = 40,nVSize = 14,nSkipSize = 5;
+	CString				str;
+
+	BrushSpline.CreateSolidBrush(RGB(100,255,20));
+	pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushSpline);
+
+	Penouter.CreatePen(PS_SOLID, 1, RGB(255,255,255));
+	HPEN OldPen = (HPEN)::SelectObject(hDC,Penouter);
+
+	HFONT		font,pOldFont;	
+
+	font = ::CreateFont(14, 0, 0, 0, FW_BOLD, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+	pOldFont = (HFONT) ::SelectObject(hDC, font);		
+	if(::GetTextColor(hDC) != COLOR_GLASS_BRUSH) ::SetTextColor(hDC, COLOR_GLASS_BRUSH);
+	::SetBkMode(hDC, TRANSPARENT);	
+
+	for(i=0;i<4;i++)
+	{
+		enDir = (Disp_SplineLocation)i;
+		switch(enDir)
+		{
+		case Disp_Spline_BotRight:
+			rect.bottom = m_rectGlass.bottom - nSkipSize;
+			rect.top = rect.bottom - nVSize;
+			rect.left = m_rectGlass.right + nSkipSize;
+			rect.right = rect.left + nHSize;
+			//rect.OffsetRect(-nSkipSize,-nSkipSize);
+			break;
+
+		case Disp_Spline_BotLeft:
+			rect.bottom = m_rectGlass.bottom - nSkipSize;
+			rect.top = rect.bottom - nVSize;
+			rect.right = m_rectGlass.left - nSkipSize;
+			rect.left = rect.right - nHSize;
+			//rect.OffsetRect(nSkipSize,-nSkipSize);
+			break;
+		case Disp_Spline_TopRight:
+			rect.top = m_rectGlass.top + nSkipSize;
+			rect.bottom = rect.top + nVSize;
+			rect.left = m_rectGlass.right + nSkipSize;
+			rect.right = rect.left + nHSize;
+			//rect.OffsetRect(-nSkipSize,nSkipSize);
+			break;
+
+		case Disp_Spline_TopLeft:
+			rect.top = m_rectGlass.top + nSkipSize;
+			rect.bottom = rect.top + nVSize;
+			rect.right = m_rectGlass.left - nSkipSize;
+			rect.left = rect.right - nHSize;
+			//rect.OffsetRect(nSkipSize,nSkipSize);
+			break;
+		}
+
+		::FillRect(hDC,&rect, (HBRUSH)BrushSpline);
+		::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+		str.Format(_T("%.0f"),m_dCornerSize_Y[i]);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+	}
+
+	::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+	::DeleteObject(font);
+	::SelectObject(hDC , (HBRUSH)pOldBrush);
+	BrushSpline.DeleteObject();
+}
+
+void CGlassMap::DrawPointValue(HDC hDC,CRect rectBase,CPoint pointSkip,int *pCurValue,int *pDimenValue,int nLoopCnt)
+{
+	CBrush	BrushCutArea,BrushDimension,BrushSpline,*pOldBrush;
+	CPen	Penouter;
+	CRect	rect;	
+	int		i;
+	CString	str;
+	
+	HFONT		font,pOldFont;	
+
+	font = ::CreateFont(14, 0, 0, 0, FW_BOLD, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+	pOldFont = (HFONT) ::SelectObject(hDC, font);		
+	if(::GetTextColor(hDC) != COLOR_GLASS_BRUSH) ::SetTextColor(hDC, COLOR_GLASS_BRUSH);
+	::SetBkMode(hDC, TRANSPARENT);	
+
+	BrushCutArea.CreateSolidBrush(RGB(100,100,255));
+	BrushDimension.CreateSolidBrush(RGB(255,100,0));
+	BrushSpline.CreateSolidBrush(RGB(255,60,200));	
+
+	Penouter.CreatePen(PS_SOLID, 1, RGB(255,255,255));
+	HPEN OldPen = (HPEN)::SelectObject(hDC,Penouter);
+		
+	for(i=0;i<nLoopCnt;i++)
+	{
+		rect = rectBase;
+		rect.OffsetRect(i*pointSkip.x,i*pointSkip.y);
+		pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea);
+		::FillRect(hDC,&rect, (HBRUSH)BrushCutArea);
+		::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+		str.Format(_T("%d"),pCurValue[i]);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+
+
+		rect.OffsetRect(0,rectBase.Height());
+		pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushDimension);
+		::FillRect(hDC,&rect, (HBRUSH)BrushDimension);
+		::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+		str.Format(_T("%d"),pDimenValue[i]);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+	}
+
+	::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+	::DeleteObject(font);
+	::SelectObject(hDC, (HPEN)OldPen);
+	::SelectObject(hDC , (HBRUSH)pOldBrush);
+	BrushCutArea.DeleteObject();
+	BrushDimension.DeleteObject();
+	BrushSpline.DeleteObject();
+}
+
+void CGlassMap::DrawPointValue(HDC hDC,CRect rectBase,CPoint pointSkip,int *pCurValue, int *pCurValue2, int *pDimenValue,int nIndex,int nLoopCnt)
+{
+	CBrush	BrushCutArea,BrushCutArea2,BrushDimension,BrushSpline,*pOldBrush;
+	CPen	Penouter;
+	CRect	rect;	
+	int		i;
+	CString	str;
+
+	HFONT		font,pOldFont;	
+
+	font = ::CreateFont(14, 0, 0, 0, FW_BOLD, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+	pOldFont = (HFONT) ::SelectObject(hDC, font);		
+	if(::GetTextColor(hDC) != COLOR_GLASS_BRUSH) ::SetTextColor(hDC, COLOR_GLASS_BRUSH);
+	::SetBkMode(hDC, TRANSPARENT);	
+
+	BrushCutArea.CreateSolidBrush(RGB(100,100,255));
+	BrushCutArea2.CreateSolidBrush(RGB(200,200,0));
+	BrushDimension.CreateSolidBrush(RGB(255,100,0));
+	BrushSpline.CreateSolidBrush(RGB(255,60,200));	
+
+	Penouter.CreatePen(PS_SOLID, 1, RGB(255,255,255));
+	HPEN OldPen = (HPEN)::SelectObject(hDC,Penouter);
+	pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea);
+
+	BOOL bFirst;
+	
+	for(i=0;i<nLoopCnt;i++)
+	{
+		bFirst = TRUE;
+		rect = rectBase;
+		rect.OffsetRect(i*pointSkip.x,i*pointSkip.y);
+		
+		if(m_bTFTArea == TRUE)
+		{
+			int			nMapIndex = m_MapIndex.m_nIndex[nIndex][i];
+			bFirst = FALSE;
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea);
+			::FillRect(hDC,&rect, (HBRUSH)BrushCutArea);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+			str.Format(_T("%d"),nMapIndex);	
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	
+
+			// Profile
+			rect.OffsetRect(0,rectBase.Height());					
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea2);
+			::FillRect(hDC,&rect, (HBRUSH)BrushCutArea2);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+
+			nMapIndex--;
+			if(m_pGlassData == NULL)
+				str.Format(_T("0"));
+			else
+			{				
+				PROFILECHAMFER_RESULT_DATA *pProfile = m_pGlassData->GetProfileInspectData();
+				if(nMapIndex >= 0 && nMapIndex < MAX_PROFILE_SETTING_COUNT)
+				{
+					str.Format(_T("%.3f"),(double)pProfile->ProfileData[nMapIndex].nProfileDiff/1000.);					
+				}
+				else
+				{
+					str.Format(_T("0"));
+				}					
+			}
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+
+		}
+		else
+		{
+			//Cut Top
+			bFirst = FALSE;
+			int			nMapIndex = m_MapIndex.m_nIndex[nIndex][i];
+
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea);
+			::FillRect(hDC,&rect, (HBRUSH)BrushCutArea);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+			str.Format(_T("%d"),nMapIndex);
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);	
+
+			// Chamfer Up
+			rect.OffsetRect(0,rectBase.Height());						 			
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushCutArea2);
+			::FillRect(hDC,&rect, (HBRUSH)BrushCutArea2);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+
+			nMapIndex--;
+			if(m_pGlassData == NULL)
+				str.Format(_T("0"));
+			else
+			{
+				PROFILECHAMFER_RESULT_DATA *pProfile = m_pGlassData->GetProfileInspectData();
+				if(nMapIndex >= 0 && nMapIndex < MAX_PROFILE_SETTING_COUNT)
+				{
+					str.Format(_T("%.3f"),(double)pProfile->ResultChamfer[nMapIndex][0].nChamferCalThick/1000.);					
+				}
+				else
+				{
+					str.Format(_T("0"));
+				}					
+			}
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+
+			// Chamfer Down
+			rect.OffsetRect(0,rectBase.Height());					
+			pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushDimension);
+			::FillRect(hDC,&rect, (HBRUSH)BrushDimension);
+			::Rectangle(hDC,rect.left,rect.top,rect.right,rect.bottom);
+			if(m_pGlassData == NULL)
+				str.Format(_T("0"));
+			else
+			{
+				PROFILECHAMFER_RESULT_DATA *pProfile = m_pGlassData->GetProfileInspectData();
+				if(nMapIndex >= 0 && nMapIndex < MAX_PROFILE_SETTING_COUNT)
+				{
+					str.Format(_T("%.3f"),(double)pProfile->ResultChamfer[nMapIndex][1].nChamferCalThick/1000.);					
+				}
+				else
+				{
+					str.Format(_T("0"));
+				}					
+			}
+			::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+		}				
+ 	}
+
+	::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+	::DeleteObject(font);
+	::SelectObject(hDC, (HPEN)OldPen);
+	::SelectObject(hDC , (HBRUSH)pOldBrush);
+	BrushCutArea.DeleteObject();
+	BrushDimension.DeleteObject();
+	BrushSpline.DeleteObject();
+}
+
+void CGlassMap::DrawPointValue(HDC hDC)
+{	
+	CRect	rect;	
+	int		nHSize = 45,nVSize = 14,nSkipSize = 10,nFirstSkip = 40,nFirstSkipH = 20;	
+	int		nDivSkip=(m_rectGlass.right-m_rectGlass.left-nFirstSkip*2-nHSize)/3;
+
+	//////////////////////////////////////////////////////////////////////////
+	// C
+	rect = m_rectGlass;
+	rect.top = m_rectGlass.bottom;
+	rect.bottom = rect.top + nVSize;
+	rect.right = rect.left + nHSize;
+	rect.OffsetRect(nFirstSkip,nSkipSize);	
+	
+	DrawPointValue(hDC,rect,CPoint(nDivSkip,0),m_nCutAreaSize[DIMENSION_C], m_ptrOtherSideClass->m_nCutAreaSize[DIMENSION_C], m_nDimensionSize[DIMENSION_C],DIMENSION_C,4);
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// A
+	rect = m_rectGlass;
+	rect.top = m_rectGlass.top - nVSize - 10;
+	rect.bottom = rect.top + nVSize;
+	rect.left = m_rectGlass.right;
+	rect.right = rect.left - nHSize;
+	rect.OffsetRect(-1*nFirstSkip,-1*(nSkipSize+nVSize));
+
+	DrawPointValue(hDC,rect,CPoint(-1*nDivSkip,0),m_nCutAreaSize[DIMENSION_A],m_ptrOtherSideClass->m_nCutAreaSize[DIMENSION_A], m_nDimensionSize[DIMENSION_A],DIMENSION_A,4);
+		
+	nDivSkip = (m_rectGlass.bottom-m_rectGlass.top-nSkipSize*3-nVSize*4)/2;
+	nFirstSkip = 60;
+	//////////////////////////////////////////////////////////////////////////
+	// B
+	rect = m_rectGlass;	
+	rect.bottom = rect.top + nVSize;
+	rect.left = m_rectGlass.right;
+	rect.right = rect.left + nHSize;
+	rect.OffsetRect(nSkipSize,nFirstSkipH);
+
+	DrawPointValue(hDC,rect,CPoint(0,nDivSkip),m_nCutAreaSize[DIMENSION_B],m_ptrOtherSideClass->m_nCutAreaSize[DIMENSION_B], m_nDimensionSize[DIMENSION_B],DIMENSION_B);
+
+	//////////////////////////////////////////////////////////////////////////
+	// D
+	rect = m_rectGlass;	
+	rect.bottom = rect.top + nVSize;
+	rect.right = m_rectGlass.left;
+	rect.left = rect.right - nHSize;
+	rect.OffsetRect(-1*nSkipSize,nFirstSkipH);
+
+	DrawPointValue(hDC,rect,CPoint(0,nDivSkip),m_nCutAreaSize[DIMENSION_D],m_ptrOtherSideClass->m_nCutAreaSize[DIMENSION_D],m_nDimensionSize[DIMENSION_D],DIMENSION_D);
+}
+
+void CGlassMap::DrawGlassBackGround(HDC hDC)
+{
+	CBrush BrushGlass,*pOldBrush,PolyBrush,PolySmallBrush,NotchBrush;
+	CPen PenGlass,PenInner,PenRemove;
+	CRect	rect,PieRect;
+	int CirclePie = 30;
+
+	BrushGlass.CreateSolidBrush(COLOR_GLASS_BRUSH);
+	pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushGlass);
+
+	::FillRect(hDC,&m_RectWnd, (HBRUSH)BrushGlass);
+	PenGlass.CreatePen(PS_SOLID, 4, COLOR_GLASS_LINE_BRUSH);	
+	DrawRect(hDC,PenGlass,m_RectWnd);
+
+	PenRemove.CreatePen(PS_SOLID, 2, COLOR_GLASS_BRUSH);
+	PenInner.CreatePen(PS_SOLID, 2, RGB(150,150,150));
+		
+	rect = m_rectGlass;	
+
+	const	int nOffset = 15;
+	const	int	nLineOffset = 20;
+	const	int	nPolyCnt = 6;	
+	int			i;
+	HPEN hOldPen = (HPEN)::SelectObject(hDC ,PenInner);
+
+	POINT	pPolyPointSmall[nPolyCnt];	
+
+	EM_GLASSTYPE_COMP emComp = m_pRecipe->m_GlassParm.m_emGlassType;
+
+	if(emComp == GLASSTYPE_RCUT)
+	{
+		POINT	pPolyPoint[18];		
+
+		PolyBrush.CreateSolidBrush(RGB(0,0,90));	
+		pOldBrush =	(CBrush*)::SelectObject(hDC ,(HBRUSH)PolyBrush);
+
+		// 奴逞 弊府扁
+		pPolyPoint[0].x = rect.left,			pPolyPoint[0].y = rect.top+nLineOffset;
+
+		pPolyPoint[1].x = rect.left,pPolyPoint[1].y = rect.bottom-nOffset;
+		pPolyPoint[2].x = rect.left,			pPolyPoint[2].y = rect.bottom-nOffset+2;
+		pPolyPoint[3].x = rect.left+3,			pPolyPoint[3].y = rect.bottom-nOffset+8;
+		pPolyPoint[4].x = rect.left+6,			pPolyPoint[4].y = rect.bottom-nOffset+11;
+		pPolyPoint[5].x = rect.left+12,			pPolyPoint[5].y = rect.bottom-nOffset+14;
+		pPolyPoint[6].x = rect.left+14,			pPolyPoint[6].y = rect.bottom-nOffset+15;
+		pPolyPoint[7].x = rect.left+nOffset,	pPolyPoint[7].y = rect.bottom;
+
+		pPolyPoint[8].x = rect.right-nOffset,	pPolyPoint[8].y = rect.bottom;
+
+		pPolyPoint[9].x = rect.right-nOffset+1,	pPolyPoint[9].y = rect.bottom;
+		pPolyPoint[10].x = rect.right-nOffset+3,pPolyPoint[10].y = rect.bottom-1;
+		pPolyPoint[11].x = rect.right-nOffset+9,pPolyPoint[11].y = rect.bottom-4;
+		pPolyPoint[12].x = rect.right-nOffset+12,pPolyPoint[12].y = rect.bottom-7;
+		pPolyPoint[13].x = rect.right,			pPolyPoint[13].y = rect.bottom-13;
+
+		pPolyPoint[14].x = rect.right,			pPolyPoint[14].y = rect.bottom-nOffset;
+
+		pPolyPoint[15].x = rect.right,			pPolyPoint[15].y = rect.top+nLineOffset;
+		pPolyPoint[16].x = rect.right-nOffset,	pPolyPoint[16].y = rect.top+nLineOffset;
+		pPolyPoint[17].x = rect.left+nOffset,	pPolyPoint[17].y = rect.top+nLineOffset;	
+
+		::BeginPath(hDC);
+		::MoveToEx(hDC,pPolyPoint[0].x,pPolyPoint[0].y,NULL);
+		for(i=1;i<18;i++)
+		{
+			::LineTo(hDC,pPolyPoint[i].x,pPolyPoint[i].y);
+		}
+		::LineTo(hDC,pPolyPoint[0].x,pPolyPoint[0].y);
+		::EndPath(hDC);
+		::StrokeAndFillPath(hDC);		
+	}
+	else if(emComp == GLASSTYPE_CCUT || emComp == GLASSTYPE_NCUT)
+	{
+		POINT	pPolyPoint[nPolyCnt];		
+
+		PolyBrush.CreateSolidBrush(RGB(0,0,90));	
+		pOldBrush =	(CBrush*)::SelectObject(hDC ,(HBRUSH)PolyBrush);
+
+		// 奴逞 弊府扁
+		pPolyPoint[0].x = rect.left,			pPolyPoint[0].y = rect.top+nLineOffset;
+		pPolyPoint[1].x = rect.left,			pPolyPoint[1].y = rect.bottom-nOffset;
+		pPolyPoint[2].x = rect.left+nOffset,	pPolyPoint[2].y = rect.bottom;
+		pPolyPoint[3].x = rect.right-nOffset,	pPolyPoint[3].y = rect.bottom;
+		pPolyPoint[4].x = rect.right,			pPolyPoint[4].y = rect.bottom-nOffset;
+		pPolyPoint[5].x = rect.right,			pPolyPoint[5].y = rect.top+nLineOffset;
+
+		::BeginPath(hDC);
+		::MoveToEx(hDC,pPolyPoint[0].x,pPolyPoint[0].y,NULL);
+		for(i=1;i<nPolyCnt;i++)
+		{
+			::LineTo(hDC,pPolyPoint[i].x,pPolyPoint[i].y);
+		}
+		::LineTo(hDC,pPolyPoint[0].x,pPolyPoint[0].y);
+		::EndPath(hDC);
+		::StrokeAndFillPath(hDC);
+	}
+
+	PolySmallBrush.CreateSolidBrush(RGB(83,78,78));	
+	pOldBrush =	(CBrush*)::SelectObject(hDC ,(HBRUSH)PolySmallBrush);
+
+	// 累篮逞(A) 弊府扁
+	pPolyPointSmall[0].x = rect.left,			pPolyPointSmall[0].y = rect.top+nLineOffset;
+	pPolyPointSmall[1].x = rect.right,			pPolyPointSmall[1].y = rect.top+nLineOffset;
+	pPolyPointSmall[2].x = rect.right,			pPolyPointSmall[2].y = rect.top+nOffset;
+	pPolyPointSmall[3].x = rect.right-nOffset,	pPolyPointSmall[3].y = rect.top;
+	pPolyPointSmall[4].x = rect.left+nOffset,	pPolyPointSmall[4].y = rect.top;
+	pPolyPointSmall[5].x = rect.left,			pPolyPointSmall[5].y = rect.top+nOffset;
+
+	::BeginPath(hDC);
+	::MoveToEx(hDC,pPolyPointSmall[0].x,pPolyPointSmall[0].y,NULL);
+	for(i=1;i<nPolyCnt;i++)
+	{
+		::LineTo(hDC,pPolyPointSmall[i].x,pPolyPointSmall[i].y);
+	}
+	::LineTo(hDC,pPolyPointSmall[0].x,pPolyPointSmall[0].y);
+	::EndPath(hDC);
+	::StrokeAndFillPath(hDC);
+	
+
+//iskang Add notch iamge view
+////////////////////////////////////////////
+
+//	m_bNotch = TRUE; m_nNotchDir = NotchDir_A;
+
+	if(emComp == GLASSTYPE_NCUT)
+	{
+		NotchBrush.CreateSolidBrush(COLOR_GLASS_BRUSH);	
+		pOldBrush =	(CBrush*)::SelectObject(hDC ,(HBRUSH)NotchBrush);
+
+		switch(m_nNotchDir)
+		{
+		case NotchDir_A:
+			PieRect.top = rect.top + CirclePie;
+			PieRect.left = rect.CenterPoint().x - CirclePie;
+			PieRect.right = rect.CenterPoint().x + CirclePie;
+			PieRect.bottom = rect.top - CirclePie;
+
+			::Pie(hDC,PieRect.left,PieRect.top,PieRect.right,PieRect.bottom,
+				PieRect.left,PieRect.CenterPoint().y,PieRect.right,PieRect.CenterPoint().y);
+
+			hOldPen = (HPEN)::SelectObject(hDC ,PenRemove); 
+			::MoveToEx(hDC,PieRect.left+1,PieRect.CenterPoint().y,NULL);
+			::LineTo(hDC,PieRect.right-2,PieRect.CenterPoint().y);
+			break;
+		case NotchDir_B:
+			PieRect.top = rect.CenterPoint().y + CirclePie;
+			PieRect.left = rect.right - CirclePie;
+			PieRect.right = rect.right + CirclePie;
+			PieRect.bottom = rect.CenterPoint().y - CirclePie;
+
+			::Pie(hDC,PieRect.left,PieRect.top,PieRect.right,PieRect.bottom,
+				PieRect.CenterPoint().x,PieRect.bottom,PieRect.CenterPoint().x,PieRect.top );
+
+			hOldPen = (HPEN)::SelectObject(hDC ,PenRemove); 
+
+			::MoveToEx(hDC,PieRect.CenterPoint().x,PieRect.top-2,NULL);
+			::LineTo(hDC,PieRect.CenterPoint().x,PieRect.bottom+2);
+			break;
+		case NotchDir_C:
+			PieRect.top = rect.bottom + CirclePie;
+			PieRect.left = rect.CenterPoint().x - CirclePie;
+			PieRect.right = rect.CenterPoint().x + CirclePie;
+			PieRect.bottom = rect.bottom - CirclePie;
+
+			::Pie(hDC,PieRect.left,PieRect.top,PieRect.right,PieRect.bottom,
+				PieRect.right,PieRect.CenterPoint().y, PieRect.left,PieRect.CenterPoint().y);
+
+			hOldPen = (HPEN)::SelectObject(hDC ,PenRemove); 
+
+			::MoveToEx(hDC,PieRect.left+1,PieRect.CenterPoint().y,NULL);
+			::LineTo(hDC,PieRect.right-3,PieRect.CenterPoint().y);
+			break;
+		case NotchDir_D:
+			PieRect.top = rect.CenterPoint().y + CirclePie;
+			PieRect.left = rect.left - CirclePie;
+			PieRect.right = rect.left + CirclePie;
+			PieRect.bottom = rect.CenterPoint().y - CirclePie;
+
+			::Pie(hDC,PieRect.left,PieRect.top,PieRect.right,PieRect.bottom,
+				PieRect.CenterPoint().x,PieRect.top,PieRect.CenterPoint().x,PieRect.bottom);
+
+			hOldPen = (HPEN)::SelectObject(hDC ,PenRemove); 
+
+			::MoveToEx(hDC,PieRect.CenterPoint().x,PieRect.top-3,NULL);
+			::LineTo(hDC,PieRect.CenterPoint().x,PieRect.bottom+1);
+			break;
+		}
+	}
+
+/////////////////////////////////////////////
+
+	if(m_pRecipe != NULL)
+	{
+		HFONT		font,pOldFont;	
+
+		font = ::CreateFont(16, 0, 0, 0, FW_BOLD, 0, 0, 0,
+			DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+			ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+		pOldFont = (HFONT) ::SelectObject(hDC, font);		
+		if(::GetTextColor(hDC) != RGB(0,200,0)) ::SetTextColor(hDC, RGB(0,200,0));
+		::SetBkMode(hDC, TRANSPARENT);	
+
+		CString		str;
+
+		str.Format(_T("%.3fmm X %.3fmm"),(double)m_pRecipe->m_GlassParm.m_nGlassSizeX/1000.,(double)m_pRecipe->m_GlassParm.m_nGlassSizeY/1000.);
+
+		rect.top = rect.top+rect.Height()/2-10;
+		rect.bottom = rect.top+20;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER);
+
+		/*
+		rect.top = rect.bottom + 10;
+		rect.bottom = rect.top+20;
+		if(::GetTextColor(hDC) != RGB(255,255,0)) ::SetTextColor(hDC, RGB(255,255,0));
+		int			x,y;
+		
+		y = (int)m_dGlasssize[1];
+		x = (int)m_dGlasssize[0];
+		str.Format(_T("%.3fmm X %.3fmm"),(double)x/1000,(double)y/1000);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER);
+		*/
+		::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+		::DeleteObject(font);
+	}
+
+	const	int			nHSize = 40,nVSize = 14,nSkipSize = 5;
+
+	if(m_pHardwareSetting != NULL && m_pRecipe != NULL && (emComp == GLASSTYPE_CCUT || emComp == GLASSTYPE_NCUT))
+	{
+		rect = m_rectGlass;
+
+		HFONT		font,pOldFont;	
+
+		font = ::CreateFont(18, 0, 0, 0, FW_BOLD, 0, 0, 0,
+			DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+			ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+		pOldFont = (HFONT) ::SelectObject(hDC, font);		
+		if(::GetTextColor(hDC) != RGB(0,200,0)) ::SetTextColor(hDC, RGB(255,255,0));
+		::SetBkMode(hDC, TRANSPARENT);	
+
+		CString		str;
+
+		str.Format(_T("2"));
+		
+		rect.bottom = m_rectGlass.top - nSkipSize;
+		rect.top = rect.bottom - nVSize;
+		rect.right = m_rectGlass.left - nSkipSize;
+		rect.left = rect.right - nHSize;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_BOTTOM);
+
+		str.Format(_T("4"));
+
+		rect.bottom = m_rectGlass.top - nSkipSize;
+		rect.top = rect.bottom - nVSize;
+		rect.left = m_rectGlass.right + nSkipSize;
+		rect.right = rect.left + nHSize;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_BOTTOM);
+
+		str.Format(_T("1"));
+
+		rect.top = m_rectGlass.bottom + nSkipSize;
+		rect.bottom = rect.top + nVSize;
+		rect.right = m_rectGlass.left - nSkipSize;
+		rect.left = rect.right - nHSize;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_TOP);
+			
+		str.Format(_T("3"));
+
+		rect.top = m_rectGlass.bottom + nSkipSize;
+		rect.bottom = rect.top + nVSize;
+		rect.left = m_rectGlass.right + nSkipSize;
+		rect.right = rect.left + nHSize;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_TOP);
+
+		::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+		::DeleteObject(font);
+	}
+
+	::SelectObject(hDC , (HPEN)hOldPen);
+	::SelectObject(hDC , (HBRUSH)pOldBrush);
+	BrushGlass.DeleteObject();
+	PenGlass.DeleteObject();
+	PenInner.DeleteObject();
+	PenRemove.DeleteObject();
+	PolyBrush.DeleteObject();
+	PolySmallBrush.DeleteObject();
+	NotchBrush.DeleteObject();
+}
+
+void CGlassMap::DrawGlassBackGroundRev(HDC hDC)
+{
+	CBrush BrushGlass,*pOldBrush,PolyBrush,PolySmallBrush,NotchBrush;
+	CPen PenGlass,PenInner,PenRemove;
+	CRect	rect,PieRect;
+	int CirclePie = 30;
+
+	BrushGlass.CreateSolidBrush(COLOR_GLASS_BRUSH);
+	pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)BrushGlass);
+
+	::FillRect(hDC,&m_RectWnd, (HBRUSH)BrushGlass);
+	PenGlass.CreatePen(PS_SOLID, 4, COLOR_GLASS_LINE_BRUSH);	
+	DrawRect(hDC,PenGlass,m_RectWnd);
+
+	PenRemove.CreatePen(PS_SOLID, 2, COLOR_GLASS_BRUSH);
+	PenInner.CreatePen(PS_SOLID, 2, RGB(150,150,150));
+
+	rect = m_rectGlass;	
+
+	const	int nOffset = 15;
+	const	int	nLineOffset = 20;
+	const	int	nPolyCnt = 6;	
+	int			i;
+	HPEN hOldPen = (HPEN)::SelectObject(hDC ,PenInner);
+
+	POINT	pPolyPointSmall[nPolyCnt];	
+
+	EM_GLASSTYPE_COMP emComp = m_pRecipe->m_GlassParm.m_emGlassType;
+
+	if(emComp == GLASSTYPE_RCUT)
+	{
+		POINT	pPolyPoint[18];		
+
+		PolyBrush.CreateSolidBrush(RGB(0,0,90));	
+		pOldBrush =	(CBrush*)::SelectObject(hDC ,(HBRUSH)PolyBrush);
+
+		// 奴逞 弊府扁
+		pPolyPoint[0].x = rect.left,			pPolyPoint[0].y = rect.top+nLineOffset;
+
+		pPolyPoint[1].x = rect.left,pPolyPoint[1].y = rect.bottom-nOffset;
+		pPolyPoint[2].x = rect.left,			pPolyPoint[2].y = rect.bottom-nOffset+2;
+		pPolyPoint[3].x = rect.left+3,			pPolyPoint[3].y = rect.bottom-nOffset+8;
+		pPolyPoint[4].x = rect.left+6,			pPolyPoint[4].y = rect.bottom-nOffset+11;
+		pPolyPoint[5].x = rect.left+12,			pPolyPoint[5].y = rect.bottom-nOffset+14;
+		pPolyPoint[6].x = rect.left+14,			pPolyPoint[6].y = rect.bottom-nOffset+15;
+		pPolyPoint[7].x = rect.left+nOffset,	pPolyPoint[7].y = rect.bottom;
+
+		pPolyPoint[8].x = rect.right-nOffset,	pPolyPoint[8].y = rect.bottom;
+
+		pPolyPoint[9].x = rect.right-nOffset+1,	pPolyPoint[9].y = rect.bottom;
+		pPolyPoint[10].x = rect.right-nOffset+3,pPolyPoint[10].y = rect.bottom-1;
+		pPolyPoint[11].x = rect.right-nOffset+9,pPolyPoint[11].y = rect.bottom-4;
+		pPolyPoint[12].x = rect.right-nOffset+12,pPolyPoint[12].y = rect.bottom-7;
+		pPolyPoint[13].x = rect.right,			pPolyPoint[13].y = rect.bottom-13;
+
+		pPolyPoint[14].x = rect.right,			pPolyPoint[14].y = rect.bottom-nOffset;
+
+		pPolyPoint[15].x = rect.right,			pPolyPoint[15].y = rect.top+nLineOffset;
+		pPolyPoint[16].x = rect.right-nOffset,	pPolyPoint[16].y = rect.top+nLineOffset;
+		pPolyPoint[17].x = rect.left+nOffset,	pPolyPoint[17].y = rect.top+nLineOffset;	
+
+		::BeginPath(hDC);
+		::MoveToEx(hDC,pPolyPoint[0].x,pPolyPoint[0].y,NULL);
+		for(i=1;i<18;i++)
+		{
+			::LineTo(hDC,pPolyPoint[i].x,pPolyPoint[i].y);
+		}
+		::LineTo(hDC,pPolyPoint[0].x,pPolyPoint[0].y);
+		::EndPath(hDC);
+		::StrokeAndFillPath(hDC);		
+	}
+	else if(emComp == GLASSTYPE_CCUT || emComp == GLASSTYPE_NCUT)
+	{
+		POINT	pPolyPoint[nPolyCnt];		
+
+		PolyBrush.CreateSolidBrush(RGB(0,0,90));	
+		pOldBrush =	(CBrush*)::SelectObject(hDC ,(HBRUSH)PolyBrush);
+
+		// 奴逞 弊府扁
+		pPolyPoint[0].x = rect.left,			pPolyPoint[0].y = rect.bottom-nLineOffset;
+		pPolyPoint[1].x = rect.left,			pPolyPoint[1].y = rect.top+nOffset;
+		pPolyPoint[2].x = rect.left+nOffset,	pPolyPoint[2].y = rect.top;
+		pPolyPoint[3].x = rect.right-nOffset,	pPolyPoint[3].y = rect.top;
+		pPolyPoint[4].x = rect.right,			pPolyPoint[4].y = rect.top+nOffset;
+		pPolyPoint[5].x = rect.right,			pPolyPoint[5].y = rect.bottom-nLineOffset;
+
+		::BeginPath(hDC);
+		::MoveToEx(hDC,pPolyPoint[0].x,pPolyPoint[0].y,NULL);
+		for(i=1;i<nPolyCnt;i++)
+		{
+			::LineTo(hDC,pPolyPoint[i].x,pPolyPoint[i].y);
+		}
+		::LineTo(hDC,pPolyPoint[0].x,pPolyPoint[0].y);
+		::EndPath(hDC);
+		::StrokeAndFillPath(hDC);
+	}
+
+	PolySmallBrush.CreateSolidBrush(RGB(83,78,78));	
+	pOldBrush =	(CBrush*)::SelectObject(hDC ,(HBRUSH)PolySmallBrush);
+
+	// 累篮逞(A) 弊府扁
+	pPolyPointSmall[0].x = rect.left,			pPolyPointSmall[0].y = rect.bottom-nLineOffset;
+	pPolyPointSmall[1].x = rect.right,			pPolyPointSmall[1].y = rect.bottom-nLineOffset;
+	pPolyPointSmall[2].x = rect.right,			pPolyPointSmall[2].y = rect.bottom-nOffset;
+	pPolyPointSmall[3].x = rect.right-nOffset,	pPolyPointSmall[3].y = rect.bottom;
+	pPolyPointSmall[4].x = rect.left+nOffset,	pPolyPointSmall[4].y = rect.bottom;
+	pPolyPointSmall[5].x = rect.left,			pPolyPointSmall[5].y = rect.bottom-nOffset;
+
+	::BeginPath(hDC);
+	::MoveToEx(hDC,pPolyPointSmall[0].x,pPolyPointSmall[0].y,NULL);
+	for(i=1;i<nPolyCnt;i++)
+	{
+		::LineTo(hDC,pPolyPointSmall[i].x,pPolyPointSmall[i].y);
+	}
+	::LineTo(hDC,pPolyPointSmall[0].x,pPolyPointSmall[0].y);
+	::EndPath(hDC);
+	::StrokeAndFillPath(hDC);
+
+
+	//iskang Add notch iamge view
+	////////////////////////////////////////////
+
+	//	m_bNotch = TRUE; m_nNotchDir = NotchDir_A;
+
+	if(emComp == GLASSTYPE_NCUT)
+	{
+		NotchBrush.CreateSolidBrush(COLOR_GLASS_BRUSH);	
+		pOldBrush =	(CBrush*)::SelectObject(hDC ,(HBRUSH)NotchBrush);
+
+		switch(m_nNotchDir)
+		{
+		case NotchDir_A:
+			PieRect.top = rect.bottom + CirclePie;
+			PieRect.left = rect.CenterPoint().x - CirclePie;
+			PieRect.right = rect.CenterPoint().x + CirclePie;
+			PieRect.bottom = rect.bottom - CirclePie;
+
+			::Pie(hDC,PieRect.left,PieRect.top,PieRect.right,PieRect.bottom,
+				PieRect.right,PieRect.CenterPoint().y, PieRect.left,PieRect.CenterPoint().y);
+
+			hOldPen = (HPEN)::SelectObject(hDC ,PenRemove); 
+
+			::MoveToEx(hDC,PieRect.left+1,PieRect.CenterPoint().y,NULL);
+			::LineTo(hDC,PieRect.right-3,PieRect.CenterPoint().y);
+			break;
+		case NotchDir_B:
+			PieRect.top = rect.CenterPoint().y + CirclePie;
+			PieRect.left = rect.left - CirclePie;
+			PieRect.right = rect.left + CirclePie;
+			PieRect.bottom = rect.CenterPoint().y - CirclePie;
+
+			::Pie(hDC,PieRect.left,PieRect.top,PieRect.right,PieRect.bottom,
+				PieRect.CenterPoint().x,PieRect.top,PieRect.CenterPoint().x,PieRect.bottom);
+
+			hOldPen = (HPEN)::SelectObject(hDC ,PenRemove); 
+
+			::MoveToEx(hDC,PieRect.CenterPoint().x,PieRect.top-3,NULL);
+			::LineTo(hDC,PieRect.CenterPoint().x,PieRect.bottom+1);
+			break;
+		case NotchDir_C:
+			PieRect.top = rect.top + CirclePie;
+			PieRect.left = rect.CenterPoint().x - CirclePie;
+			PieRect.right = rect.CenterPoint().x + CirclePie;
+			PieRect.bottom = rect.top - CirclePie;
+
+			::Pie(hDC,PieRect.left,PieRect.top,PieRect.right,PieRect.bottom,
+				PieRect.left,PieRect.CenterPoint().y,PieRect.right,PieRect.CenterPoint().y);
+
+			hOldPen = (HPEN)::SelectObject(hDC ,PenRemove); 
+			::MoveToEx(hDC,PieRect.left+1,PieRect.CenterPoint().y,NULL);
+			::LineTo(hDC,PieRect.right-2,PieRect.CenterPoint().y);
+			break;
+		case NotchDir_D:
+			PieRect.top = rect.CenterPoint().y + CirclePie;
+			PieRect.left = rect.right - CirclePie;
+			PieRect.right = rect.right + CirclePie;
+			PieRect.bottom = rect.CenterPoint().y - CirclePie;
+
+			::Pie(hDC,PieRect.left,PieRect.top,PieRect.right,PieRect.bottom,
+				PieRect.CenterPoint().x,PieRect.bottom,PieRect.CenterPoint().x,PieRect.top );
+
+			hOldPen = (HPEN)::SelectObject(hDC ,PenRemove); 
+
+			::MoveToEx(hDC,PieRect.CenterPoint().x,PieRect.top-2,NULL);
+			::LineTo(hDC,PieRect.CenterPoint().x,PieRect.bottom+2);
+			break;
+		}
+	}
+
+	/////////////////////////////////////////////
+
+	if(m_pRecipe != NULL)
+	{
+		HFONT		font,pOldFont;	
+
+		font = ::CreateFont(16, 0, 0, 0, FW_BOLD, 0, 0, 0,
+			DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+			ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+		pOldFont = (HFONT) ::SelectObject(hDC, font);		
+		if(::GetTextColor(hDC) != RGB(0,200,0)) ::SetTextColor(hDC, RGB(0,200,0));
+		::SetBkMode(hDC, TRANSPARENT);	
+
+		CString		str;
+
+		str.Format(_T("%.3fmm X %.3fmm"),(double)m_pRecipe->m_GlassParm.m_nGlassSizeX/1000.,(double)m_pRecipe->m_GlassParm.m_nGlassSizeY/1000.);
+
+		rect.top = rect.top+rect.Height()/2-10;
+		rect.bottom = rect.top+20;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER);
+
+		/*
+		rect.top = rect.bottom + 10;
+		rect.bottom = rect.top+20;
+		if(::GetTextColor(hDC) != RGB(255,255,0)) ::SetTextColor(hDC, RGB(255,255,0));
+		int			x,y;
+
+		y = (int)m_dGlasssize[1];
+		x = (int)m_dGlasssize[0];
+		str.Format(_T("%.3fmm X %.3fmm"),(double)x/1000,(double)y/1000);
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER);
+		*/
+
+		::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+		::DeleteObject(font);
+	}
+
+	const	int			nHSize = 40,nVSize = 14,nSkipSize = 5;
+
+	if(m_pHardwareSetting != NULL && m_pRecipe != NULL && (emComp == GLASSTYPE_CCUT || emComp == GLASSTYPE_NCUT))
+	{
+		rect = m_rectGlass;
+
+		HFONT		font,pOldFont;	
+
+		font = ::CreateFont(18, 0, 0, 0, FW_BOLD, 0, 0, 0,
+			DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+			ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("Arial"));	
+
+		pOldFont = (HFONT) ::SelectObject(hDC, font);		
+		if(::GetTextColor(hDC) != RGB(0,200,0)) ::SetTextColor(hDC, RGB(255,255,0));
+		::SetBkMode(hDC, TRANSPARENT);	
+
+		CString		str;
+		
+		str.Format(_T("4"));
+
+		rect.bottom = m_rectGlass.top - nSkipSize;
+		rect.top = rect.bottom - nVSize;
+		rect.right = m_rectGlass.left - nSkipSize;
+		rect.left = rect.right - nHSize;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_BOTTOM);
+
+		str.Format(_T("2"));
+
+		rect.bottom = m_rectGlass.top - nSkipSize;
+		rect.top = rect.bottom - nVSize;
+		rect.left = m_rectGlass.right + nSkipSize;
+		rect.right = rect.left + nHSize;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_BOTTOM);
+
+		str.Format(_T("3"));
+
+		rect.top = m_rectGlass.bottom + nSkipSize;
+		rect.bottom = rect.top + nVSize;
+		rect.right = m_rectGlass.left - nSkipSize;
+		rect.left = rect.right - nHSize;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_TOP);
+
+		str.Format(_T("1"));
+
+		rect.top = m_rectGlass.bottom + nSkipSize;
+		rect.bottom = rect.top + nVSize;
+		rect.left = m_rectGlass.right + nSkipSize;
+		rect.right = rect.left + nHSize;
+		::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_TOP);
+
+		::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+		::DeleteObject(font);
+	}
+
+	::SelectObject(hDC , (HPEN)hOldPen);
+	::SelectObject(hDC , (HBRUSH)pOldBrush);
+	BrushGlass.DeleteObject();
+	PenGlass.DeleteObject();
+	PenInner.DeleteObject();
+	PenRemove.DeleteObject();
+	PolyBrush.DeleteObject();
+	PolySmallBrush.DeleteObject();
+	NotchBrush.DeleteObject();
+}
+
+void CGlassMap::ReCalRectDraw()
+{
+	m_rectGlass = m_RectWnd;
+
+	int			nMarginWidth = 70;
+	int			nMarginHeight = 70;
+
+	m_rectGlass.left += nMarginWidth;
+	m_rectGlass.top += nMarginHeight;
+	m_rectGlass.right -= nMarginWidth;
+	m_rectGlass.bottom -= nMarginHeight;
+
+	m_nUnitSize = m_nMapWidth / m_rectGlass.Width();	
+
+	m_dWidthRatio = static_cast<double>(m_rectGlass.Width())/static_cast<double>(m_nMapWidth);
+	m_dHeightRatio = static_cast<double>(m_rectGlass.Height())/static_cast<double>(m_nMapHeight);		
+}
+
+///////////////////
+void CGlassMap::DrawTriangle(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius)
+{
+//	ASSERT(hDC);
+	HPEN	hOldPen= NULL;
+	HBRUSH	hOldBrush = NULL;
+	
+	if(hPen)
+		hOldPen = (HPEN)::SelectObject(hDC ,hPen);
+
+	int nShortY = nRadius/2;
+	int nShortX = nRadius*866/1000;
+
+	::MoveToEx(hDC, ptCenter.x, ptCenter.y-nRadius, NULL);
+	::LineTo(hDC, ptCenter.x-nShortX, ptCenter.y+nShortY);
+	::LineTo(hDC, ptCenter.x+nShortX, ptCenter.y+nShortY);
+	::LineTo(hDC, ptCenter.x, ptCenter.y-nRadius);
+
+	if(hPen)
+		::SelectObject(hDC , (HPEN)hOldPen);
+}
+
+
+///////////////////
+void CGlassMap::DrawCircle(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius)
+{
+//	ASSERT(hDC);
+	HPEN	hOldPen= NULL;
+	HBRUSH	hOldBrush = NULL;
+	
+	if(hPen)
+		hOldPen = (HPEN)::SelectObject(hDC ,hPen);
+	
+	::Arc(hDC, ptCenter.x-nRadius, ptCenter.y-nRadius,
+		ptCenter.x+nRadius, ptCenter.y+nRadius,
+		ptCenter.x-nRadius, ptCenter.y-nRadius,
+		ptCenter.x-nRadius, ptCenter.y-nRadius);  //Bottom
+	
+	if(hPen)
+		::SelectObject(hDC , (HPEN)hOldPen);
+}
+
+void CGlassMap::DrawCross(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius)
+{
+	HPEN	hOldPen= NULL;
+	HBRUSH	hOldBrush = NULL;
+	
+	if(hPen)
+		hOldPen = (HPEN)::SelectObject(hDC ,hPen);
+	
+	::MoveToEx(hDC, ptCenter.x-nRadius, ptCenter.y-nRadius, NULL);
+	::LineTo(hDC, ptCenter.x+nRadius, ptCenter.y+nRadius);
+
+	::MoveToEx(hDC, ptCenter.x+nRadius, ptCenter.y-nRadius, NULL);
+	::LineTo(hDC, ptCenter.x-nRadius, ptCenter.y+nRadius);
+
+	if(hPen)
+		::SelectObject(hDC , (HPEN)hOldPen);
+}
+
+void CGlassMap::DrawRightAngleCross(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius)
+{
+	HPEN	hOldPen= NULL;
+	HBRUSH	hOldBrush = NULL;
+	
+	if(hPen)
+		hOldPen = (HPEN)::SelectObject(hDC ,hPen);
+	
+	::MoveToEx(hDC, ptCenter.x-nRadius, ptCenter.y, NULL);
+	::LineTo(hDC, ptCenter.x+nRadius, ptCenter.y);
+
+	::MoveToEx(hDC, ptCenter.x, ptCenter.y-nRadius, NULL);
+	::LineTo(hDC, ptCenter.x, ptCenter.y+nRadius);
+
+	if(hPen)
+		::SelectObject(hDC , (HPEN)hOldPen);
+}
+
+void CGlassMap::DrawRect(HDC hDC, HPEN hPen, CRect rect)
+{
+	HPEN	hOldPen= NULL;
+	HBRUSH	hOldBrush = NULL;
+	
+	if(hPen)
+		hOldPen = (HPEN)::SelectObject(hDC ,hPen);
+	
+	::MoveToEx(hDC, rect.left, rect.top, NULL);
+	::LineTo(hDC, rect.right, rect.top);
+	::LineTo(hDC, rect.right, rect.bottom);
+	::LineTo(hDC, rect.left, rect.bottom);
+	::LineTo(hDC, rect.left, rect.top);
+
+	if(hPen)
+		::SelectObject(hDC , (HPEN)hOldPen);
+}
+
+void CGlassMap::DrawGlassArea(HDC hDC)
+{	
+	// CornerCut 弊府扁.
+	CBrush		BrushCCut( RGB(150,100,255) );	// 伎 寇胞(BM何)
+	HBRUSH		pOldBrush = (HBRUSH)::SelectObject(hDC,(HBRUSH)BrushCCut);	
+	HFONT		font,pOldFont;
+	CString		str;
+
+	CRect		rect = m_RectWnd;
+
+	rect.OffsetRect(2,2);
+	rect.right = rect.left + 100;
+	rect.bottom = rect.top + 20;
+
+	::FillRect(hDC,&rect,BrushCCut);		
+
+	font = ::CreateFont(16, 0, 0, 0, FW_BOLD, 0, 0, 0,
+		DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
+		ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, _T("奔覆眉"));	
+
+	pOldFont = (HFONT) ::SelectObject(hDC, font);		
+	if(::GetTextColor(hDC) != COLOR_GLASS_PEN) ::SetTextColor(hDC, COLOR_GLASS_PEN);
+	::SetBkMode(hDC, TRANSPARENT);		
+
+	rect.OffsetRect(2,2);
+	if(m_bTFTArea == TRUE)
+	{
+		str.Format(_T("Map 2"));	
+	}
+	else
+	{
+		str.Format(_T("Map 1"));	
+	}
+
+	::DrawText(hDC, str, str.GetLength(), &rect, DT_CENTER | DT_VCENTER);
+	
+	if(pOldBrush) ::SelectObject(hDC,(HBRUSH)pOldBrush);
+	::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));	
+	::DeleteObject(font);
+}
+
+void CGlassMap::DrawGlass(CDC* pDC)
+{
+	GetClientRect(&m_RectWnd);
+
+	if (!m_pRecipe)
+	{
+		pDC->Rectangle(&m_RectWnd);
+		return;
+	}
+
+	CControlMemDC	memDC(pDC,&m_RectWnd);
+	HDC			hDC = memDC.GetSafeHdc();
+
+	if(m_pHardwareSetting->m_bInsDirReverse == FALSE)
+		DrawGlassBackGround(hDC);
+	else
+		DrawGlassBackGroundRev(hDC);
+
+	DrawGlassArea(hDC);
+
+	DrawGlassPosition(hDC);
+
+	DrawPointValue(hDC);
+
+	DrawSplineValue(hDC);
+
+	//DrawCornerXValue(hDC);
+
+	//DrawCornerYValue(hDC);
+
+	DrawGlassDefect(hDC);
+}
+
+void CGlassMap::ConvertOriginToView(int iSide,CRect &RectDefect)
+{	
+	CRect			rect;
+	int				nSize;
+	DimensionDir	enDir = (DimensionDir)iSide;	
+
+	rect = RectDefect;
+	switch(enDir)
+	{
+	case DIMENSION_A:	
+	case DIMENSION_A_DN:
+		nSize = RectDefect.Height()/2;		
+		rect.top = m_rectGlass.top-nSize;
+		rect.bottom = m_rectGlass.top+nSize;	
+		rect.left = m_rectGlass.Width()-rect.right;
+		rect.right = rect.left+RectDefect.Width();
+		rect.OffsetRect(m_rectGlass.left,0);
+		break;
+	case DIMENSION_C:	
+	case DIMENSION_C_DN:	
+		nSize = RectDefect.Height()/2;		
+		rect.top = m_rectGlass.bottom-nSize;
+		rect.bottom = m_rectGlass.bottom+nSize;	
+		rect.left = m_rectGlass.Width()-rect.right;
+		rect.right = rect.left+RectDefect.Width();
+		rect.OffsetRect(m_rectGlass.left,0);
+		break;
+	case DIMENSION_B:		
+	case DIMENSION_B_DN:		
+		nSize = RectDefect.Width()/2;
+		rect.left = m_rectGlass.right-nSize;
+		rect.right = m_rectGlass.right+nSize;
+		rect.top = RectDefect.top;
+		rect.bottom = rect.top + RectDefect.Height();		
+		rect.OffsetRect(0,m_rectGlass.top);
+		break;
+	case DIMENSION_D:
+	case DIMENSION_D_DN:
+		nSize = RectDefect.Width()/2;
+		rect.left = m_rectGlass.left-nSize;
+		rect.right = m_rectGlass.left+nSize;
+		rect.top = RectDefect.top;
+		rect.bottom = rect.top + RectDefect.Height();		
+		rect.OffsetRect(0,m_rectGlass.top);
+		break;		
+	}
+
+	RectDefect = rect;
+}
+
+void CGlassMap::ConvertOriginToViewRev(int iSide,CRect &RectDefect)
+{	
+	CRect			rect;
+	int				nSize;
+	DimensionDir	enDir = (DimensionDir)iSide;
+
+	rect = RectDefect;
+	switch(enDir)
+	{
+	case DIMENSION_A:	
+	case DIMENSION_A_DN:
+		nSize = RectDefect.Height()/2;		
+		rect.top = m_rectGlass.top-nSize;
+		rect.bottom = m_rectGlass.top+nSize;	
+		rect.left = m_rectGlass.Width()-rect.right;
+		rect.right = rect.left+nSize;
+		rect.OffsetRect(m_rectGlass.left,0);
+		break;
+	case DIMENSION_C:	
+	case DIMENSION_C_DN:	
+		nSize = RectDefect.Height()/2;		
+		rect.top = m_rectGlass.bottom-nSize;
+		rect.bottom = m_rectGlass.bottom+nSize;	
+		rect.left = m_rectGlass.Width()-rect.right;
+		rect.right = rect.left+nSize;
+		rect.OffsetRect(m_rectGlass.left,0);
+		break;
+	case DIMENSION_B:		
+	case DIMENSION_B_DN:		
+		nSize = RectDefect.Width()/2;
+		rect.left = m_rectGlass.left-nSize;
+		rect.right = m_rectGlass.left+nSize;
+		rect.top = m_rectGlass.Height() - RectDefect.right;
+		rect.bottom = rect.top + nSize;		
+		rect.OffsetRect(0,m_rectGlass.top);
+		break;
+	case DIMENSION_D:
+	case DIMENSION_D_DN:
+		nSize = RectDefect.Width()/2;
+		rect.left = m_rectGlass.right-nSize;
+		rect.right = m_rectGlass.right+nSize;
+		rect.top = m_rectGlass.Height() - RectDefect.right;
+		rect.bottom = rect.top + nSize;		
+		rect.OffsetRect(0,m_rectGlass.top);
+		break;		
+	}
+
+	RectDefect = rect;
+}
+
+void CGlassMap::DrawGlassPreDefect(HDC hDC,MapDefect *pMapDefect,int iPre)
+{
+	if(pMapDefect == NULL)
+		return;
+
+	::SetBkMode(hDC,TRANSPARENT);
+	
+	CPen PenDefect, *pOldPen;
+	PenDefect.CreatePen(PS_SOLID, 1, RGB(0,0,0));
+	pOldPen = (CPen*)::SelectObject(hDC,(HPEN)PenDefect);	
+
+	int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+	if (nUnit == 0)
+		nUnit = 1;
+	int nDrawSize = 0;	
+	int nMidSize = static_cast<int>((m_nMinDefectSize + 3) * nUnit);	
+	int nX, nY,nDefectIdx=0;		
+
+	// 搬窃 弊府扁.
+	CRect RectDefect,rect;
+	CInspectDefect* pDefect;
+	MapDefectIt it;
+	for (it = pMapDefect->begin(); it != pMapDefect->end(); it++,nDefectIdx++)
+	{
+		pDefect = static_cast<CInspectDefect*>(it->second);
+		if (!pDefect)
+			continue;
+// 		if(m_bTFTArea == TRUE && pDefect->m_nCameraID == 0)
+// 			continue;
+// 		else if(m_bTFTArea == FALSE && pDefect->m_nCameraID == 1)
+// 			continue;			
+
+		nX = pDefect->m_nUMOriginX;	//scan
+		nY = pDefect->m_nUMOriginY;
+
+		nDrawSize = nMidSize;
+		
+		switch(pDefect->m_nSideLoc)
+		{
+		case DIMENSION_A:	
+		case DIMENSION_A_DN:			
+		case DIMENSION_C:	
+		case DIMENSION_C_DN:	
+			RectDefect.SetRect(nX - nDrawSize, nY - nDrawSize, nX + nDrawSize, nY + nDrawSize);
+			break;
+		case DIMENSION_B:		
+		case DIMENSION_B_DN:					
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			RectDefect.SetRect(nY - nDrawSize, nX - nDrawSize, nY + nDrawSize, nX + nDrawSize);
+			break;		
+		}
+
+		//RectDefect.SetRect(nX - nDrawSize, nY - nDrawSize, nX + nDrawSize, nY + nDrawSize);
+				
+		ConvertGlassToView(RectDefect);	
+		if(m_pHardwareSetting->m_bInsDirReverse)
+			ConvertOriginToViewRev(pDefect->m_sDefectLoc,RectDefect);
+		else
+			ConvertOriginToView(pDefect->m_sDefectLoc,RectDefect);
+			
+		::SelectObject(hDC,(HBRUSH)m_BrushDefect[iPre]);
+	
+		::Rectangle(hDC,RectDefect.left,RectDefect.top,RectDefect.right,RectDefect.bottom);			
+	}
+
+	::DeleteObject(::SelectObject(hDC, (HPEN)pOldPen));
+	::SetBkMode(hDC,OPAQUE);
+}
+
+void CGlassMap::DrawGlassDefect(HDC hDC)
+{
+	if(m_pMapDefect == NULL)
+		return;
+
+	::SetBkMode(hDC,TRANSPARENT);
+	
+	CPen PenDefect, *pOldPen;
+	PenDefect.CreatePen(PS_SOLID, 1, RGB(0,0,0));
+	pOldPen = (CPen*)::SelectObject(hDC,(HPEN)PenDefect);	
+
+	int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+	if (nUnit == 0)
+		nUnit = 1;
+	int nDrawSize = 0;	
+	int nMidSize = static_cast<int>((m_nMinDefectSize + 3) * nUnit);	
+	int nX, nY,nDefectIdx=0;		
+
+	// 搬窃 弊府扁.
+	CRect RectDefect,rect;
+	CInspectDefect* pDefect;
+	MapDefectIt it;
+	for (it = m_pMapDefect->begin(); it != m_pMapDefect->end(); it++,nDefectIdx++)
+	{
+		pDefect = static_cast<CInspectDefect*>(it->second);
+		if (!pDefect)
+			continue;
+		if(pDefect->m_bJudgeDefect == FALSE)
+			continue;
+
+		if(m_bTFTArea == TRUE)
+		{
+			if((CAMERA_DIR)pDefect->m_nDir == CAMDIR_TOP)
+				continue;
+		}
+		else
+		{
+			if((CAMERA_DIR)pDefect->m_nDir == CAMDIR_BOTTOM)
+				continue;
+		}
+
+ 		if(m_pSelDefect == pDefect)
+ 			continue;			
+		
+		nX = pDefect->m_nUMOriginX;	//scan
+		nY = pDefect->m_nUMOriginY;	
+
+		nDrawSize = nMidSize;
+		
+		switch(pDefect->m_nSideLoc)
+		{
+		case DIMENSION_A:	
+		case DIMENSION_A_DN:			
+		case DIMENSION_C:	
+		case DIMENSION_C_DN:	
+			RectDefect.SetRect(nX - nDrawSize, nY - nDrawSize, nX + nDrawSize, nY + nDrawSize);
+			break;
+		case DIMENSION_B:		
+		case DIMENSION_B_DN:					
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			RectDefect.SetRect(nY - nDrawSize, nX - nDrawSize, nY + nDrawSize, nX + nDrawSize);
+			break;		
+		}
+				
+		ConvertGlassToView(RectDefect);	
+		if(m_pHardwareSetting->m_bInsDirReverse)
+			ConvertOriginToViewRev(pDefect->m_nSideLoc,RectDefect);
+		else
+			ConvertOriginToView(pDefect->m_nSideLoc,RectDefect);			
+				
+		switch(pDefect->m_sDefectLoc)
+		{
+		case DefectLoc_Crack: ::SelectObject(hDC,(HBRUSH)m_BrushDefect[0]); break;
+		case DefectLoc_Broken: ::SelectObject(hDC,(HBRUSH)m_BrushDefect[0]); break;
+		case DefectLoc_Chip: ::SelectObject(hDC,(HBRUSH)m_BrushDefect[0]); break;
+		case DefectLoc_Chamfer: ::SelectObject(hDC,(HBRUSH)m_BrushDefect[3]); break;
+		case DefectLoc_Burr: SelectObject(hDC,(HBRUSH)m_BrushDefect[0]); break;
+		case DefectLoc_Profile: SelectObject(hDC,(HBRUSH)m_BrushDefect[2]); break;
+		default: ::SelectObject(hDC,(HBRUSH)m_BrushDefect[0]); break;
+		}		
+
+		::Rectangle(hDC,RectDefect.left,RectDefect.top,RectDefect.right,RectDefect.bottom);				
+	}
+	
+	::DeleteObject(::SelectObject(hDC, (HPEN)pOldPen));
+
+	// 急琶等 搬窃 弊府扁.
+	
+	for (it = m_pMapDefect->begin(); it != m_pMapDefect->end(); it++)
+	{
+		pDefect = static_cast<CInspectDefect*>(it->second);
+		
+		if (pDefect && m_pSelDefect && pDefect->m_nGlassDefectIdx == m_pSelDefect->m_nGlassDefectIdx)
+		{
+			if(pDefect->m_bJudgeDefect == FALSE)
+				continue;
+
+			int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+			int nSize = static_cast<int>((m_nMinDefectSize + 6) * nUnit);
+			
+			int nX, nY;
+			CRect rt;
+		
+			nX = pDefect->m_nUMOriginX;	//scan
+			nY = pDefect->m_nUMOriginY;
+
+			switch(pDefect->m_nSideLoc)
+			{
+			case DIMENSION_A:	
+			case DIMENSION_A_DN:			
+			case DIMENSION_C:	
+			case DIMENSION_C_DN:	
+				rt.SetRect(nX - nSize, nY - nSize, nX + nSize, nY + nSize);
+				break;
+			case DIMENSION_B:		
+			case DIMENSION_B_DN:					
+			case DIMENSION_D:
+			case DIMENSION_D_DN:
+				rt.SetRect(nY - nSize, nX - nSize, nY + nSize, nX + nSize);
+				break;		
+			}
+						
+			CBrush pBrushBlink(RGB(0, m_nBlinkColor, 255));								
+			
+			ConvertGlassToView(rt);		
+			if(m_pHardwareSetting->m_bInsDirReverse)
+				ConvertOriginToViewRev(pDefect->m_nSideLoc,rt);
+			else
+				ConvertOriginToView(pDefect->m_nSideLoc,rt);
+		
+			::SelectObject(hDC,(HBRUSH)pBrushBlink);
+
+			::Rectangle(hDC,rt.left,rt.top,rt.right,rt.bottom);			
+
+			m_nBlinkColor += 20;
+			if (m_nBlinkColor > 255)
+				m_nBlinkColor = 0;
+		}
+	}		
+
+	::SetBkMode(hDC,OPAQUE);
+}	
+
+void CGlassMap::DrawRectangle(HDC hDC, CRect rectDrag, COLORREF pencolor, COLORREF brushcolor)
+{	
+	CPen pen,*pOldPen;
+	CBrush brush,*pOldBrush;
+	
+	brush.CreateSolidBrush(brushcolor);
+	pOldBrush = (CBrush*)::SelectObject(hDC,(HBRUSH)brush);
+	
+	pen.CreatePen(PS_SOLID,1,pencolor);
+	pOldPen = (CPen*)::SelectObject(hDC,(HPEN)pen);
+	
+	::SetROP2(hDC,R2_XORPEN);
+
+	rectDrag.NormalizeRect();	
+	::Rectangle(hDC,rectDrag.left,rectDrag.top,rectDrag.right,rectDrag.bottom);
+	
+	if(pOldPen) ::SelectObject(hDC,(HPEN)pOldPen);
+	if(pOldBrush) ::SelectObject(hDC,(HBRUSH)pOldBrush);
+	::SetROP2(hDC,R2_COPYPEN);
+	
+	brush.DeleteObject();
+	pen.DeleteObject();	
+}
+
+void CGlassMap::MouseLBtnMove(CPoint& point)
+{
+	if(m_bZoomDrag == TRUE && m_bZoomInMode == FALSE && m_bSetZoomMode == TRUE)
+	{
+		m_rectZoomWindow.right = point.x;
+		m_rectZoomWindow.bottom = point.y;
+
+		Invalidate();		
+	}
+}
+
+void CGlassMap::MouseLBtnUp(CPoint& point)
+{
+	if(m_bZoomDrag == TRUE && m_bSetZoomMode == TRUE)
+	{
+		m_rectZoomWindow.right = point.x;
+		m_rectZoomWindow.bottom = point.y;
+		
+		m_rectZoomWindow.NormalizeRect();
+		CRect		rect = m_rectZoomWindow;
+		
+		if(abs(rect.left-rect.right) <= 1 || abs(rect.top-rect.bottom) <= 1)
+		{				
+			m_bZoomInMode = FALSE;
+			m_bZoomDrag = FALSE;			
+			return;
+		}
+		
+		ConvertViewToGlass(rect);
+		CalDefectRect(rect);
+		
+		m_rectZoomDrag = rect;				
+		
+		double		dRatio;
+		if(abs(m_rectZoomDrag.Width()) > abs(m_rectZoomDrag.Height()))	
+			dRatio = static_cast<double>(m_RectWnd.Width())/static_cast<double>(m_rectZoomDrag.Width());		
+		else	
+			dRatio = static_cast<double>(m_RectWnd.Width())/static_cast<double>(m_rectZoomDrag.Height());		
+
+		m_dZoomRatioH = static_cast<double>(m_RectWnd.Width())/static_cast<double>(m_rectZoomDrag.Width());
+		m_dZoomRatioV = static_cast<double>(m_RectWnd.Height())/static_cast<double>(m_rectZoomDrag.Height());		
+
+	//	m_dRatio = dRatio;		
+		m_bZoomInMode = TRUE;
+		m_bZoomDrag = FALSE;
+
+		Invalidate();		
+	}
+
+	ReleaseCapture();
+}
+
+void CGlassMap::MouseLBtnDwn(CPoint& point)
+{
+	SetCapture();
+	if(m_bZoomInMode == FALSE && m_bSetZoomMode == TRUE)
+	{
+		m_rectZoomWindow.left = point.x;
+		m_rectZoomWindow.top = point.y;
+
+		m_bZoomDrag = TRUE;		
+	}
+	
+	m_pSelDefect = NULL;
+	KillTimer(ID_TIMER_BLINK);
+	Invalidate(FALSE);
+
+	m_pSelDefect = FindSelDefect(point);
+	if (m_pSelDefect)
+	{
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_SELECTDEFECT, m_pSelDefect->m_nGlassDefectIdx, m_bTFTArea);
+
+		SetTimer(ID_TIMER_BLINK, 100, NULL);
+	}
+
+}
+
+void CGlassMap::MouseRBtnDwn(CPoint& point)
+{
+	if(m_bZoomInMode == TRUE)
+	{
+		if (IDYES == AfxMessageBox(_T("Do you want to return to original size?"), MB_YESNO | MB_ICONQUESTION))
+		{
+			ResetRatio();
+			m_bZoomInMode = FALSE;
+		}
+	}
+}
+
+void CGlassMap::MouseLBtnDblClk(CPoint& point)
+{	
+// 	m_pSelDefect = NULL;
+// 	KillTimer(ID_TIMER_BLINK);
+// 	Invalidate(FALSE);
+// 
+// 	m_pSelDefect = FindSelDefect(point);
+// 	if (m_pSelDefect)
+// 	{
+// 		if (m_pParentWnd)
+// 			m_pParentWnd->PostMessage(UM_MAP_SELECTDEFECT, m_pSelDefect->m_nGlassDefectIdx, 0);
+// 		
+// 		SetTimer(ID_TIMER_BLINK, 100, NULL);
+// 	}	
+}
+
+CInspectDefect* CGlassMap::FindSelDefect(CPoint pt)
+{
+	if (!m_pMapDefect)
+		return NULL;
+		
+	int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+	if (nUnit == 0)
+		nUnit = 1;
+	int nMidSize = static_cast<int>((m_nMinDefectSize + 3) * nUnit);	
+	int nX, nY;
+
+	CRect RectDefect,rect;
+	int	nDrawSize;
+	CInspectDefect* pDefect;
+	for (MapDefectIt it = m_pMapDefect->begin(); it != m_pMapDefect->end(); it++)
+	{		
+		pDefect = static_cast<CInspectDefect*>(it->second);
+		if (!pDefect)
+			continue;
+// 		if(m_bTFTArea == TRUE && pDefect->m_nCameraID == 0)
+// 			continue;
+// 		else if(m_bTFTArea == FALSE && pDefect->m_nCameraID == 1)
+// 			continue;
+		if(m_pSelDefect == pDefect)
+			continue;			
+
+		nX = pDefect->m_nUMOriginX;	//scan
+		nY = pDefect->m_nUMOriginY;
+
+		nDrawSize = nMidSize;
+
+		switch(pDefect->m_nSideLoc)
+		{
+		case DIMENSION_A:	
+		case DIMENSION_A_DN:			
+		case DIMENSION_C:	
+		case DIMENSION_C_DN:	
+			RectDefect.SetRect(nX - nDrawSize, nY - nDrawSize, nX + nDrawSize, nY + nDrawSize);
+			break;
+		case DIMENSION_B:		
+		case DIMENSION_B_DN:					
+		case DIMENSION_D:
+		case DIMENSION_D_DN:
+			RectDefect.SetRect(nY - nDrawSize, nX - nDrawSize, nY + nDrawSize, nX + nDrawSize);
+			break;		
+		}
+
+		//RectDefect.SetRect(nX - nDrawSize, nY - nDrawSize, nX + nDrawSize, nY + nDrawSize);
+
+		ConvertGlassToView(RectDefect);		
+		ConvertOriginToView(pDefect->m_sDefectLoc,RectDefect);
+
+		// 康开 救牢瘤 犬牢.
+		if (pt.x >= RectDefect.left && pt.x <= RectDefect.right && pt.y >= RectDefect.top && pt.y <= RectDefect.bottom)
+			return pDefect;
+	}
+
+	return NULL;
+}
+
+void CGlassMap::ZoomInDefectMap()
+{
+	if (!m_bIsMiniMap && m_bSetZoomMode == TRUE)
+	{			
+		CPoint		nPoint = m_rectZoomWindow.TopLeft();
+
+		//nPoint.x -= (m_RectMap.left/m_nUnitSize);
+		//nPoint.y -= m_RectMap.top/m_nUnitSize;
+		
+		if (m_OriginDir == OD_LeftTop)
+		{
+			m_PointWindowStart.x = static_cast<int>(nPoint.x * m_dRatio)*-1;
+			m_PointWindowStart.y = static_cast<int>(nPoint.y * m_dRatio)*-1;
+		}
+		else if (m_OriginDir == OD_LeftBottom)
+		{
+			m_PointWindowStart.x = static_cast<int>(nPoint.x * m_dRatio )*-1;
+			m_PointWindowStart.y = static_cast<int>((m_rectGlass.bottom-nPoint.y) * m_dRatio - m_rectGlass.Height())*-1;
+		}
+		else if (m_OriginDir == OD_RightTop)
+		{
+			m_PointWindowStart.x = static_cast<int>((m_rectGlass.right-nPoint.x) * m_dRatio - m_rectGlass.Width())*-1;
+			m_PointWindowStart.y = static_cast<int>(nPoint.y * m_dRatio)*-1;
+		}
+		else if (m_OriginDir == OD_RightBottom)
+		{
+			m_PointWindowStart.x = static_cast<int>((m_rectGlass.right-nPoint.x) * m_dRatio - m_rectGlass.Width())*-1;
+			m_PointWindowStart.y = static_cast<int>((m_rectGlass.bottom-nPoint.y) * m_dRatio - m_rectGlass.Height())*-1;
+		}	
+		
+		// 康开捞 哈绢唱瘤 臼档废 抗寇贸府.
+		if (m_PointWindowStart.x > 0)
+			m_PointWindowStart.x = 0;
+		else if (m_PointWindowStart.x < m_rectGlass.right * m_dRatio * -1 + m_rectGlass.Width())
+			m_PointWindowStart.x = static_cast<int>(m_rectGlass.right * m_dRatio) * -1 + m_rectGlass.Width();
+		if (m_PointWindowStart.y > 0)
+			m_PointWindowStart.y = 0;
+		else if (m_PointWindowStart.y < m_rectGlass.bottom * m_dRatio * -1 + m_rectGlass.Height())
+			m_PointWindowStart.y = static_cast<int>(m_rectGlass.bottom * m_dRatio) * -1 + m_rectGlass.Height();
+		
+		m_PointGlassStart = ConvertViewToGlass(CPoint(0, 0));
+		m_PointGlassEnd = ConvertViewToGlass(CPoint(m_rectGlass.right, m_rectGlass.bottom));
+		
+		if (m_pParentWnd)
+			m_pParentWnd->PostMessage(UM_MAP_CHANGED, 0, 0);
+
+		Invalidate();
+	}
+}
+
+void CGlassMap::Timer(UINT nIDEvent) 
+{
+// 	if (nIDEvent == ID_TIMER_BLINK && m_pSelDefect)
+// 	{
+// 		int nUnit = static_cast<int>(m_nUnitSize / m_dRatio);
+// 		if (nUnit == 0)
+// 			nUnit = 1;
+// 		int nSize = static_cast<int>((m_nMinDefectSize + 5) * nUnit);
+// 
+// 		int nX, nY;
+// 		CRect rt;
+// 		nX = m_pSelDefect->m_nUMOriginX;
+// 		nY = m_pSelDefect->m_nUMOriginY;
+// 		
+// 		rt.SetRect(nX - nSize, nY - nSize, nX + nSize, nY + nSize);							
+// 
+// 		ConvertGlassToView(rt);		
+// 		ConvertOriginToView(m_pSelDefect->m_nScanIdx,rt);		
+// 
+// 		InvalidateRect(&rt, TRUE);
+// 	}
+}
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
diff --git a/ENRIT/View/GlassMap.h b/ENRIT/View/GlassMap.h
new file mode 100644
index 0000000..6a79e2b
--- /dev/null
+++ b/ENRIT/View/GlassMap.h
@@ -0,0 +1,160 @@
+// GlassMap.h: interface for the CGlassMap class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include "InspectDefect.h"
+#include "Server_MemDC.h"
+#include "Global_Define.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "Glass_Data.h"
+
+#define RCUT_DEFECT_TYPECOUNT	5
+#define ID_TIMER_BLINK			9001
+#define ID_TIMER_MASKBLINK		9002
+
+#define	COLOR_0			RGB(255,0,0)		// TB
+#define	COLOR_1			RGB(0,0,255)		// TW
+#define	COLOR_2			RGB(0,200,200)		// RB
+#define	COLOR_3			RGB(88,224,88)		// RW
+#define	COLOR_4			RGB(100,0,100)		// BB
+#define	COLOR_5			RGB(128,0,0)		// BW
+#define	COLOR_6			RGB(0,100,0)		// CD
+#define	COLOR_7			RGB(255,128,0)	// NO
+#define	COLOR_8			RGB(0,128,128)			// NO
+#define	COLOR_9			RGB(0,5,128)
+#define	COLOR_10		RGB(0,255,0)
+			// NO
+
+#define COLOR_STACK_0	RGB(50,0,100)		// BML
+#define COLOR_STACK_1	RGB(70,100,50)		// BLU
+#define COLOR_STACK_2	RGB(90,200,0)		// GRN
+#define COLOR_STACK_3	RGB(110,0,100)		// RED
+#define COLOR_STACK_4	RGB(130,100,50)		// RPL
+#define COLOR_STACK_5	RGB(150,200,0)		// OCL
+#define COLOR_STACK_6	RGB(170,0,100)		// PS
+#define COLOR_STACK_7	RGB(190,100,50)		// ANL
+#define COLOR_STACK_8	RGB(210,200,0)		// FINAL
+#define COLOR_STACK_9	RGB(230,0,100)		// MASK
+
+#define	MAPSTACK_STEP_COUNT	10
+#define  UM_MAP_SELECTDEFECT		(WM_USER + 8763)
+
+#define MAX_POINT_VALUE_CNT		3
+enum Disp_SplineLocation		{ Disp_Spline_BotRight=0,Disp_Spline_BotLeft,Disp_Spline_TopRight,Disp_Spline_TopLeft,Disp_Spline_None };
+enum NotchDirArry				{NotchDir_A=0,NotchDir_B,NotchDir_C,NotchDir_D,NotchDir_Non};
+
+class CGlassMap : public CDefectMap
+{
+public:
+	CGlassMap();
+	virtual ~CGlassMap();
+
+	void				SetGlassRecipe(CHardwareSettings *pHard,CGlassRecipe* pRecipe,BOOL bTFTArea);		
+	void				ReCalRectDraw();
+	
+	virtual void		DrawGlass(CDC* pDC);
+	virtual void		MouseLBtnDblClk(CPoint& point);
+	virtual void		MouseLBtnDwn(CPoint& point);
+	virtual void		MouseLBtnMove(CPoint& point);
+	virtual void		MouseLBtnUp(CPoint& point);
+	virtual void		MouseRBtnDwn(CPoint& point);
+	virtual void		Timer(UINT nIDEvent);	
+	
+	void				ZoomInDefectMap();	
+	void				SetZoomMode(BOOL bSet){ m_bSetZoomMode = bSet; }
+		
+	BOOL				SetSelectDefect(int nGlassDefectIdx);
+	void				SetDrawMapRefresh(){Invalidate(FALSE);}
+	void				DrawDefects(MapDefect* pMapDefect,CGlass_Data *pGlassData);	
+	void				SetGlasssize(int nIdx,double dValue);
+	void				SetPointCutData(DimensionDir enDir,double *pCutArea,double dAvgVal);
+	void				SetPointDimenData(DimensionDir enDir,double *pDimen,double dAvgVal);
+	void				SetSplineData(Disp_SplineLocation enDir,double dValue);	
+	void				SetCornerXData(Disp_SplineLocation enDir,double dValue);
+	void				SetCornerYData(Disp_SplineLocation enDir,double dValue);
+	CInspectDefect		*GetSelectDefect(){return m_pSelDefect;}
+
+	void				SetMapIndex(_ST_MAPSETTINGS_INDEX MapIndex){m_MapIndex=MapIndex;}
+
+protected:	
+	int					m_nBlinkColor;	
+	BOOL				m_bSetZoomMode;
+	BOOL				m_bZoomDrag;
+	BOOL				m_bZoomInMode;
+	CRect				m_rectZoomDrag,m_rectZoomWindow;
+	double				m_dZoomRatioH;
+	double				m_dZoomRatioV;
+	double				m_dGlasssize[2];
+
+//iskang Add notch iamge view
+	BOOL				m_bNotch;
+	int					m_nNotchDir;
+		
+	int					m_nMinDefectSize;
+	inline int			GetSmallSize();
+	inline int			GetMidSize();
+	inline int			GetLargeSize();
+	inline int			GetHugeSize();	
+	
+	//////////////////////////////////////////////////////////////////////////
+	// Glass Info
+	CHardwareSettings	*m_pHardwareSetting;
+	CGlassRecipe	*m_pRecipe;		
+	MapDefect			*m_pMapDefect;
+	CInspectDefect		*m_pSelDefect;	
+	CGlass_Data			*m_pGlassData;
+	CBrush				m_BrushDefect[RCUT_DEFECT_TYPECOUNT];
+	CRect				m_rectGlass;
+	BOOL				m_bTFTArea;
+
+	int					m_nCutAreaSize[4][MAX_POINT_VALUE_CNT];
+	int					m_nCutAreaAVG[4];
+	int					m_nDimensionSize[4][MAX_POINT_VALUE_CNT];
+	int					m_nDimensionAVG[4];
+	double				m_dSplineSize[4];
+	double				m_dCornerSize_X[4];
+	double				m_dCornerSize_Y[4];
+	_ST_MAPSETTINGS_INDEX	m_MapIndex;
+
+protected:	
+	void		DrawGlassDefect(HDC hDC);
+	void		DrawGlassPreDefect(HDC hDC,MapDefect *pMapDefect,int iPre);
+	void		DrawGlassBackGround(HDC hDC);
+	void		DrawGlassBackGroundRev(HDC hDC);
+	void		DrawGlassPosition(HDC hDC);
+	void		DrawZoonInMode(CDC *pDC,CControlMemDC *memDC);		
+	void		DrawTriangle(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius);
+	void		DrawCircle(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius);
+	void		DrawCross(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius);
+	void		DrawRightAngleCross(HDC hDC, HPEN hPen, CPoint ptCenter, int nRadius);
+	void		DrawRect(HDC hDC, HPEN hPen, CRect rect);
+	void		DrawGlassArea(HDC hDC);				
+	void		DrawRectangle(HDC hDC, CRect rectDrag, COLORREF pencolor, COLORREF brushcolor);		
+	void		FillPolygon(HDC hDC,POINT *poly,int npoly,DWORD color,int nTop,int nBottom);
+	void		DrawPointValue(HDC hDC);
+	void		DrawPointValue(HDC hDC,CRect rectBase,CPoint pointSkip,int *pCurValue,int *pDimenValue,int nLoopCnt=MAX_POINT_VALUE_CNT);
+	void		DrawSplineValue(HDC hDC);
+	void		DrawCornerXValue(HDC hDC);
+	void		DrawCornerYValue(HDC hDC);
+
+protected:
+	void		CalDefectRect(CRect &rect,BOOL bRet=FALSE,BOOL bDirOpt=TRUE);
+	void		CalDefectRect(CPoint &point,BOOL bRet=FALSE,BOOL bDirOpt=TRUE);
+	CString		GetPositionString(DimensionDir dir);	
+	void		ConvertOriginToView(int iSide,CRect &RectDefect);
+	void		ConvertOriginToViewRev(int iSide,CRect &RectDefect);
+	CInspectDefect*	FindSelDefect(CPoint pt);
+
+	// 眠盔惫 - UI 函版
+protected:
+	CGlassMap*			m_ptrOtherSideClass;
+public:
+	void		SetOtherGlassMapPtr(CGlassMap* ptr){m_ptrOtherSideClass = ptr;}
+	CGlassMap*	GetOtherGlassMapPtr(){return m_ptrOtherSideClass;}
+	void		DrawPointValue(HDC hDC,CRect rectBase,CPoint pointSkip,int *pCurValue, int *pCurValue2, int *pDimenValue,int nIndex,int nLoopCnt=MAX_POINT_VALUE_CNT);
+};
+
+
diff --git a/ENRIT/View/ImgDefect.cpp b/ENRIT/View/ImgDefect.cpp
new file mode 100644
index 0000000..0140741
--- /dev/null
+++ b/ENRIT/View/ImgDefect.cpp
@@ -0,0 +1,463 @@
+// ImgDefect.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ImgDefect.h"
+#include "math.h"
+
+
+// CImgDefect
+
+IMPLEMENT_DYNAMIC(CImgDefect, CWnd)
+
+CImgDefect::CImgDefect():m_ptOrg(0,0),m_nCam(0),m_nSide(0),m_nMode(0),m_bMeasure(FALSE),m_nTurn(0),m_nTextPos(0)
+{
+	m_dPx = 10;
+	m_dPy = 10;
+
+	m_dRatioX = 1.0;
+	m_dRatioY = 1.0;
+
+}
+
+CImgDefect::~CImgDefect()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CImgDefect, CWnd)
+	ON_WM_CREATE()
+	ON_WM_DESTROY()
+	ON_WM_PAINT()
+	ON_WM_MOUSEMOVE()
+	ON_WM_LBUTTONDOWN()
+END_MESSAGE_MAP()
+
+
+
+// CImgDefect 皋矫瘤 贸府扁涝聪促.
+
+
+BOOL CImgDefect::Create(RECT const & rect, CWnd * pParentWnd /*= 0*/)
+{
+
+#ifdef	_DEBUG
+	ASSERT(pParentWnd);	// Exception
+#endif
+
+	return CWnd::Create(NULL, NULL, WS_VISIBLE | WS_CHILD, rect, pParentWnd, 0);
+}
+
+int CImgDefect::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+	if (CWnd::OnCreate(lpCreateStruct) == -1)
+		return -1;
+
+	GetClientRect(&m_WndRect);
+
+	return 0;
+}
+
+void CImgDefect::OnDestroy()
+{
+	CWnd::OnDestroy();
+	if(!m_img.IsNull())
+		m_img.Destroy();
+}
+
+void CImgDefect::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊钦聪促.
+	// 弊府扁 皋矫瘤俊 措秦辑绰 CWnd::OnPaint()阑(甫) 龋免窍瘤 付绞矫坷.
+
+	CDC *pDC = GetDC();
+
+	CDC memDC;
+	CBitmap	Bitmap ,*pOldBitmap;
+
+	memDC.CreateCompatibleDC(pDC);
+	Bitmap.CreateCompatibleBitmap(pDC,abs(m_WndRect.Width()),abs(m_WndRect.Height()));
+
+	pOldBitmap = (CBitmap*)memDC.SelectObject(&Bitmap);
+
+
+	if(!m_img.IsNull())
+	{
+
+		CRect rc;
+		rc= m_WndRect;
+
+		if(m_nMode == 1)
+		{
+			if(!m_img.IsNull())
+			{
+				int nStartX	= 0;
+				int nStartY = 0;
+				int nWidth	= m_img.GetWidth()-1;
+				int nHeight = m_img.GetHeight()-1;
+				memDC.SetStretchBltMode(COLORONCOLOR);
+
+
+				if(m_nTurn & 1)
+				{
+					nStartX = nWidth;
+					nWidth  = - nWidth;
+				}
+
+				if(m_nTurn & 2)
+				{
+					nStartY = nHeight;
+					nHeight  = - nHeight;
+				}
+
+				m_img.StretchBlt(memDC.GetSafeHdc(),0,0,m_WndRect.Width(),m_WndRect.Height(),nStartX,nStartY,nWidth,nHeight);
+
+				if(m_bMeasure)
+					DrawManualMeasure(memDC);
+			}
+		}
+		else // 角 Size Mode
+		{
+			rc.right  = m_img.GetWidth();
+			rc.bottom = m_img.GetHeight();
+			memDC.SetStretchBltMode(COLORONCOLOR);
+
+			m_img.Draw(memDC.GetSafeHdc(),-m_ptOrg.x,-m_ptOrg.y);
+			if(m_bMeasure)
+				DrawManualMeasure(memDC);
+		}
+	
+
+		DrawTextInfo(memDC);
+		pDC->BitBlt(0,0,m_WndRect.Width(),m_WndRect.Height(),&memDC,0,0,SRCCOPY);
+	}
+	memDC.SelectObject(pOldBitmap);
+	memDC.DeleteDC();
+	ReleaseDC(pDC);
+}
+
+
+void CImgDefect::SetDefectImage(int nSide,CString strPath,double dPixel_X,double dPixel_Y)
+{
+	m_nSide = nSide;
+
+	if(!m_img.IsNull())
+		m_img.Destroy();
+
+	if(!FAILED(m_img.Load(strPath)))
+	{
+		Invalidate(TRUE);
+
+		m_dPx = dPixel_X;
+		m_dPy = dPixel_Y;
+	}
+}
+
+int CImgDefect::GetImgWidth()
+{ 
+	if(!m_img.IsNull())
+		return m_img.GetWidth();
+	else
+		return 0;
+}
+
+int CImgDefect::GetImgHeight()
+{
+	if(!m_img.IsNull())
+		return m_img.GetHeight();
+	else
+		return 0;
+}
+
+
+void CImgDefect::OnMouseMove(UINT nFlags, CPoint point)
+{
+	if(!m_img.IsNull())
+	{
+		m_ptMouseCurrent = point;
+		m_ptMouseCurrent.x =  min(m_img.GetWidth(), point.x);
+		m_ptMouseCurrent.y =  min(m_img.GetHeight(), point.y);
+
+		if(m_ManualMeausre.bStart == TRUE || m_ManualMeausre.bModifyEnd == TRUE)
+		{
+			m_ManualMeausre.ptMeasureEnd.x	= m_ptMouseCurrent.x   + m_ptOrg.x;
+			m_ManualMeausre.ptMeasureEnd.y	= m_ptMouseCurrent.y   + m_ptOrg.y;
+		}
+		else if(m_ManualMeausre.bModifyStart == TRUE)
+		{
+			m_ManualMeausre.ptMeasureStart.x = m_ptMouseCurrent.x  + m_ptOrg.x;	
+			m_ManualMeausre.ptMeasureStart.y = m_ptMouseCurrent.y  + m_ptOrg.y;
+		}
+		Invalidate(FALSE);
+	}
+	CWnd::OnMouseMove(nFlags, point);
+}
+
+void CImgDefect::OnLButtonDown(UINT nFlags, CPoint point)
+{
+	if(!m_img.IsNull())
+	{
+		if(m_ManualMeausre.bStart == FALSE)
+		{
+			if( m_ManualMeausre.ptMeasureStart.x  > point.x + m_ptOrg.x - 5 
+				&&  m_ManualMeausre.ptMeasureStart.x  < point.x + m_ptOrg.x + 5
+				&&  m_ManualMeausre.ptMeasureStart.y  > point.y + m_ptOrg.y - 5 
+				&&  m_ManualMeausre.ptMeasureStart.y  < point.y + m_ptOrg.y + 5 )
+			{
+				if(m_ManualMeausre.bModifyStart)
+					m_ManualMeausre.bModifyStart = FALSE;
+				else
+					m_ManualMeausre.bModifyStart = TRUE;
+
+			}
+			else if(m_ManualMeausre.ptMeasureEnd.x  >  point.x + m_ptOrg.x - 5 
+				&&	m_ManualMeausre.ptMeasureEnd.x  <  point.x + m_ptOrg.x + 5
+				&&  m_ManualMeausre.ptMeasureEnd.y  >  point.y + m_ptOrg.y - 5 
+				&&  m_ManualMeausre.ptMeasureEnd.y   < point.y + m_ptOrg.y + 5 )
+			{
+				if(m_ManualMeausre.bModifyEnd)
+					m_ManualMeausre.bModifyEnd = FALSE;
+				else
+					m_ManualMeausre.bModifyEnd = TRUE;
+			}
+			else
+			{
+				m_ManualMeausre.bModifyStart	= FALSE;
+				m_ManualMeausre.bModifyEnd		= FALSE;
+				m_ManualMeausre.bStart			= TRUE;
+
+
+
+
+				m_ManualMeausre.ptMeasureStart.x= point.x  + m_ptOrg.x;
+				m_ManualMeausre.ptMeasureStart.y= point.y  + m_ptOrg.y;
+			}
+		}
+		else
+		{
+			m_ManualMeausre.bStart			= FALSE;
+		}
+		Invalidate(FALSE);
+	}
+
+
+	CWnd::OnLButtonDown(nFlags, point);
+}
+
+
+void CImgDefect::DrawManualMeasure(CDC &dc)
+{
+
+	CPen penX(PS_SOLID, 1, RGB(0,255,255));
+	CPen penY(PS_SOLID, 1, RGB(255,255,0));
+	CPen *pOldPen;
+	CBrush *pOldBruh;
+
+
+	CBrush BrushRed;
+
+	BrushRed.CreateSolidBrush(RGB(0xff,0x00,0x00));
+
+	//dc.SetROP2(R2_XORPEN);	
+	pOldPen =	(CPen*)dc.SelectObject(&penX);
+	pOldBruh =  (CBrush*)dc.SelectObject(BrushRed);
+
+
+	CPoint ptStart;
+	CPoint ptEnd;
+
+	ptStart.x = (m_ManualMeausre.ptMeasureStart.x - m_ptOrg.x);
+	ptStart.y = (m_ManualMeausre.ptMeasureStart.y - m_ptOrg.y);
+
+	ptEnd.x =  (m_ManualMeausre.ptMeasureEnd.x - m_ptOrg.x);
+	ptEnd.y =  (m_ManualMeausre.ptMeasureEnd.y - m_ptOrg.y);
+
+	dc.MoveTo(0					, ptStart.y);
+	dc.LineTo(m_img.GetWidth() , ptStart.y);
+	dc.MoveTo(ptStart.x 	, 0);
+	dc.LineTo(ptStart.x  , m_img.GetHeight());
+
+	dc.MoveTo(0					, ptEnd.y);
+	dc.LineTo(m_img.GetWidth() , ptEnd.y);
+	dc.MoveTo(ptEnd.x 	, 0);
+	dc.LineTo(ptEnd.x   , m_img.GetHeight());
+
+
+	(CPen*)dc.SelectObject(&penY);
+	dc.MoveTo(ptStart.x , ptStart.y);
+	dc.LineTo(ptEnd.x	, ptEnd.y);
+
+	dc.MoveTo(ptStart.x - 5,
+		ptStart.y - 5);
+
+	dc.LineTo(ptStart.x + 5,
+		ptStart.y + 5);
+
+	dc.MoveTo(ptStart.x + 5,
+		ptStart.y - 5);
+
+	dc.LineTo(ptStart.x - 5,
+		ptStart.y + 5);
+
+	dc.MoveTo(ptEnd.x - 5,
+		ptEnd.y - 5);
+
+	dc.LineTo(ptEnd.x + 5,
+		ptEnd.y + 5);
+
+	dc.MoveTo(ptEnd.x + 5,
+		ptEnd.y - 5);
+
+	dc.LineTo(ptEnd.x - 5,
+		ptEnd.y + 5);
+
+
+
+	CString strTmp;
+	int nTmp;
+	CRect rc;
+	double dPosX,dPosY;
+
+	rc.top	  = m_ManualMeausre.ptMeasureStart.y;
+	rc.bottom = m_ManualMeausre.ptMeasureStart.y + 20;
+	rc.left	  = m_ManualMeausre.ptMeasureStart.x;
+	rc.right  = m_ManualMeausre.ptMeasureStart.x + 20;
+
+	if(m_ManualMeausre.bModifyStart)
+		m_ManualMeausre.nTextPos = 0;
+	else if(m_ManualMeausre.bModifyEnd || m_ManualMeausre.bStart)
+		m_ManualMeausre.nTextPos = 1;
+	else;
+
+
+	CPoint ptText;
+	const int TextsizeX = 150;
+	const int TextsizeY = 50;
+
+	if(m_ManualMeausre.nTextPos == 0)
+	{
+		if(ptStart.x  > m_WndRect.Width()/2)
+			ptText.x  = ptStart.x  - TextsizeX;
+		else
+			ptText.x  = ptStart.x  + 5;
+
+		if(ptStart.y > m_img.GetHeight()/2)
+			ptText.y  =ptStart.y  - TextsizeY;
+		else
+			ptText.y  = ptStart.y  + 5;
+
+	}
+	else
+	{
+		if(ptEnd.x > m_WndRect.Width()/2)
+			ptText.x  = ptEnd.x  - TextsizeX;
+		else
+			ptText.x  = ptEnd.x  + 5;
+
+		if(ptEnd.y > m_img.GetHeight()/2)
+			ptText.y  = ptEnd.y  - TextsizeY;
+		else
+			ptText.y  = ptEnd.y  + 5;
+	}
+
+
+	dc.SetBkMode(TRANSPARENT);
+	dc.SetTextColor(RGB(255,0,0));
+
+	nTmp	= abs(m_ManualMeausre.ptMeasureStart.x - m_ManualMeausre.ptMeasureEnd.x);
+	dPosX	= m_dRatioX *  nTmp/1000.0 * m_dPx;
+	strTmp.Format(_T("X : %4.3f mm [%d pixel]"), dPosX , nTmp);
+	dc.TextOut( ptText.x + 5, ptText.y,strTmp);
+
+
+	dc.SetTextColor( RGB(250, 150,	  0));
+	nTmp = abs(m_ManualMeausre.ptMeasureStart.y - m_ManualMeausre.ptMeasureEnd.y);
+
+
+	dPosY	= m_dRatioY  *  nTmp/1000.0 * m_dPy;
+	strTmp.Format(_T("Y : %4.3f mm [%d pixel]"),dPosY, nTmp);
+	dc.TextOut( ptText.x + 5, ptText.y + 15 ,strTmp);
+
+
+	dc.SetTextColor(RGB(255,0,0));
+	dPosX = sqrtf(float(dPosX *dPosX + dPosY*dPosY));
+	strTmp.Format(_T("D : %4.3f mm "),dPosX);
+	dc.TextOut( ptText.x + 5, ptText.y + 30 ,strTmp);
+
+
+	//dc.SelectObject(pOldBruh);
+	dc.SelectObject(pOldPen);
+//	dc.SetROP2(R2_COPYPEN); 
+
+	BrushRed.DeleteObject();
+
+}
+
+void CImgDefect::SetImgTurn(int nMode)
+{
+	if(nMode == 1)
+	{
+		if(m_nTurn & 1)
+			m_nTurn &= 0xfe;
+		else
+			m_nTurn |= 1;
+	}
+	else
+	{
+		if(m_nTurn & 2)
+			m_nTurn &= 0xfd;
+		else
+			m_nTurn |= 2;
+
+	}
+	Invalidate(TRUE);
+
+	
+}
+
+void CImgDefect::DrawTextInfo(CDC &dc)
+{
+	int nAlign = 0;
+	CRect rc = m_WndRect;
+	switch(m_nTextPos)
+	{
+	case 0:
+		return;
+		break;
+
+	case 1:
+		rc.bottom = 40;
+		nAlign  = DT_LEFT | DT_TOP;
+		break;
+
+	case 2:
+		nAlign  = DT_RIGHT | DT_TOP;
+		rc.bottom = 40;
+		break;
+
+	case 3:
+		nAlign  = DT_LEFT | DT_BOTTOM;
+		rc.top = rc.bottom - 40;
+		break;
+
+	case 4:
+		nAlign  = DT_RIGHT | DT_BOTTOM;
+		rc.top = rc.bottom - 40;
+		break;
+	}
+	dc.SetBkMode(TRANSPARENT);
+	dc.SetTextColor(RGB(180, 180,   0));
+
+	CFont TextFont;
+	TextFont.CreateFont(30 , 0, 0, 0, 300 , FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+		DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN,_T("Arial"));
+
+	CFont *pOldFont = (CFont*) dc.SelectObject(&TextFont);
+	dc.DrawText(m_strTextInfo,rc,nAlign);
+
+
+	dc.SelectObject( pOldFont );
+	TextFont.DeleteObject();
+
+}
\ No newline at end of file
diff --git a/ENRIT/View/ImgDefect.h b/ENRIT/View/ImgDefect.h
new file mode 100644
index 0000000..143804d
--- /dev/null
+++ b/ENRIT/View/ImgDefect.h
@@ -0,0 +1,69 @@
+#pragma once
+
+
+// CImgDefect
+
+class CImgDefect : public CWnd
+{
+	DECLARE_DYNAMIC(CImgDefect)
+
+public:
+	CImgDefect();
+	virtual ~CImgDefect();
+
+	typedef  struct tagMANUAL_MEASURE
+	{
+		BOOL		bStart;
+		BOOL		bModifyStart;
+		BOOL		bModifyEnd;
+		int			nTextPos;
+		CPoint		ptMeasureStart;
+		CPoint		ptMeasureEnd;
+
+	}MANUAL_MEASURE;
+
+protected:
+	DECLARE_MESSAGE_MAP()
+
+
+private:
+	CRect	m_WndRect;
+	CImage	m_img;
+	int		m_nSide;
+	int		m_nCam;
+	int		m_nMode;
+	BOOL    m_bMeasure;
+	int		m_nTurn;
+	int		m_nTextPos;		// 0: Text 免仿 救窃 1: left Top, 2: rigt top, 3: left bottom, 4: right bottom
+	CString m_strTextInfo;
+	double	m_dPx,m_dPy;
+public:
+	double			m_dRatioX,m_dRatioY;
+	CPoint			m_ptOrg;
+	MANUAL_MEASURE	m_ManualMeausre;
+	CPoint			m_ptMouseCurrent;
+
+	BOOL Create(RECT const & rect, CWnd * pParentWnd);
+
+
+	void SetTextInfo(CString strInfo)	{m_strTextInfo = strInfo;}
+	void SetTextAlign(int nPos)			{m_nTextPos = nPos;}
+	void SetImgMode(int nMode)			{m_nMode	= nMode;}
+	void SetMeasureAble(BOOL bMeasure)	{m_bMeasure = bMeasure;}
+	void SetImgTurn(int nMode);
+	void SetDefectImage(int nSide,CString strPath,double dPixel_X,double dPixel_Y);
+	
+	int GetImgWidth();
+	int GetImgHeight();
+	void DrawManualMeasure(CDC &dc);
+	void DrawTextInfo(CDC &dc);
+
+public:
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnDestroy();
+	afx_msg void OnPaint();
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+};
+
+
diff --git a/ENRIT/View/ImgListView.cpp b/ENRIT/View/ImgListView.cpp
new file mode 100644
index 0000000..a2ca3a6
--- /dev/null
+++ b/ENRIT/View/ImgListView.cpp
@@ -0,0 +1,632 @@
+// ImgListView.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ImgListView.h"
+#include <vector>
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CImgListView
+
+IMPLEMENT_DYNCREATE(CImgListView, CScrollView)
+
+CImgListView::CImgListView():m_nAddItem(0)
+{
+	m_BgBrush.CreateSolidBrush(RGB(0,0,0));
+	m_pSelectItem	= NULL;
+}
+
+CImgListView::~CImgListView()
+{
+	DeleteItemAll();
+}
+
+
+BEGIN_MESSAGE_MAP(CImgListView, CScrollView)
+	//{{AFX_MSG_MAP(CImgListView)
+	ON_WM_SIZE()
+	ON_WM_PAINT()
+	ON_WM_LBUTTONDOWN()
+	ON_WM_LBUTTONDBLCLK()
+	//}}AFX_MSG_MAP
+	ON_WM_ERASEBKGND()
+	ON_WM_VSCROLL()
+	ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CImgListView drawing
+
+CPotoItem::CPotoItem()
+{
+	m_Img;
+	//m_strImgInfo	= "";
+	m_rcImg		= CRect(0,0,100,100);
+	m_bSelect		= 0;
+}
+
+CPotoItem::CPotoItem(CString strFilePath)
+{
+	m_bProcesing	= 0;
+	m_bSelect		= 0;
+	m_bValid		= m_Img.Load(strFilePath);	
+	m_rcImg			= CRect(0,0,100,100);
+}
+
+CPotoItem::CPotoItem(CString strFilePath,CString strFileName,CString strImgInfo)
+{
+	m_bProcesing	= 0;
+	m_bSelect		= 0;
+	_stprintf(m_Path,_T("%s%s"),strFilePath,strFileName);
+	m_bValid		= m_Img.Load(m_Path);	
+	m_rcImg			= CRect(0,0,100,100);
+}
+CPotoItem::~CPotoItem()
+{
+}
+
+
+void CPotoItem::Draw(CDC *pDC, CRect rcClient, CRect rcChange)
+{
+	//------------------------------------------------------
+	// 沥荤阿屈 农扁甫 爱绰 皋葛府DC 积己( MemDC )
+	//------------------------------------------------------
+
+	CDC MemDC;
+	MemDC.CreateCompatibleDC( pDC );
+	MemDC.SetStretchBltMode(COLORONCOLOR);
+	CBitmap MemBitmap;
+	MemBitmap.CreateCompatibleBitmap( pDC , rcChange.Width() , rcChange.Height()  );
+	CBitmap * pOldBitmap = (CBitmap *)MemDC.SelectObject( &MemBitmap );
+
+	// 硅版 磨窍扁
+	CRect rcMemDC(0, 0, rcChange.Width(), rcChange.Height());
+
+	if(m_bSelect)	
+		MemDC.FillRect( rcMemDC, &CBrush(RGB(200,100,0)));
+	else		
+		MemDC.FillRect( rcMemDC, &CBrush(RGB(255,255,255)));
+
+	if(m_bProcesing)
+		DrawRect(&MemDC,RGB(255,0,0),rcMemDC);
+	// 咯归篮 啊肺 技肺 5 
+	// Text 啊 静咯龙 傍埃 25
+	CRect rcImg (5, 5, rcChange.Width()-5, rcChange.Height()-ITEM_TEXT);
+	m_Img.Draw(MemDC.GetSafeHdc(), rcImg);
+	DrawText(&MemDC,RGB(0,0,255));
+
+
+	pDC->BitBlt( rcChange.left, rcChange.top, rcChange.Width(), rcChange.Height(), &MemDC, 0, 0, SRCCOPY );
+
+}
+
+void CPotoItem::DrawText(CDC *pDC, COLORREF color)
+{
+
+	CFont TextFont;
+	TextFont.CreateFont(12 , 0, 0, 0, 300 , FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+		DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN,_T("Arial"));
+
+	CFont *pOldFont = (CFont*) pDC->SelectObject(&TextFont);
+	int mode = pDC->SetBkMode( TRANSPARENT );
+	int modeText = pDC->SetTextColor( color );
+	//-----------------------------------------------------------
+	// 捞固瘤疙阑 拳搁俊 免仿茄促.
+	// File Name捞 15磊 捞惑 登搁 ~~ 肺 绵距 
+	//-----------------------------------------------------------
+	CString strtmp;
+	//	if(m_strName.GetLength() > 15)
+	//		strtmp = m_strName.Left(6) + "~~";// +m_strName.Right(4);
+	//	else
+	/*
+	if(m_strName.GetLength() > 20)
+	strtmp = m_strName.Left(20);
+	else
+	*/
+
+
+
+	//strtmp = m_strName;
+	//CRect rcText( 0 , ITEM_HEIGHT + 5 , ITEM_HEIGHT , ITEM_HEIGHT + ITEM_TEXT );
+	//pDC->DrawText( strtmp , rcText , DT_CENTER | DT_WORDBREAK );
+
+	//	strtmp.Format("%d X %d X %d",m_Img.GetWidth(),m_Img.GetHeight(),m_Img.GetBpp());
+	//	rcText = CRect( 0 , ITEM_HEIGHT + 20 , ITEM_HEIGHT , ITEM_HEIGHT + ITEM_TEXT );
+	//	pDC->DrawText( strtmp , rcText , DT_CENTER | DT_WORDBREAK );
+
+	pDC->SetTextColor( modeText );
+	pDC->SetBkMode( mode );
+	pDC->SelectObject( pOldFont );
+	TextFont.DeleteObject();
+}
+
+
+void CPotoItem::DrawRect(CDC *pDC, COLORREF color,CRect rc)
+{
+	CPen pen,*pOldPen;
+	pen.CreatePen(PS_SOLID,3,color);
+	pDC->SelectObject(GetStockObject(NULL_BRUSH));
+
+	pOldPen = (CPen *)pDC->SelectObject(&pen);
+
+	pDC->Rectangle(rc);
+	pDC->SelectObject(pOldPen);
+	pen.DeleteObject();
+}
+
+
+
+void CImgListView::OnInitialUpdate()
+{
+	CScrollView::OnInitialUpdate();
+
+	CSize sizeTotal;
+
+	// TODO: calculate the total size of this view
+	sizeTotal.cx = sizeTotal.cy = 100;
+	SetScrollSizes(MM_TEXT, sizeTotal);
+}
+
+void CImgListView::OnDraw(CDC* pDC)
+{
+	CDocument* pDoc = GetDocument();
+	// TODO: add draw code here
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CImgListView diagnostics
+
+#ifdef _DEBUG
+void CImgListView::AssertValid() const
+{
+	//CScrollView::AssertValid();
+}
+
+void CImgListView::Dump(CDumpContext& dc) const
+{
+	//CScrollView::Dump(dc);
+}
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CImgListView message handlers
+CRect CImgListView::GetItemRect(int nItem)
+{
+	CRect rc;
+	int left, top;
+
+	left = LEFT_MARJIN + ((nItem) % m_nHItem) * (ITEM_WIDTH+ITEM_ROW_MARJIN);
+	top  = TOP_MARJIN  + ((nItem) / m_nHItem) * (ITEM_HEIGHT+ITEM_TEXT+ITEM_COL_MARJIN);
+
+	rc.SetRect( left, top, left + ITEM_WIDTH, top + ITEM_HEIGHT + ITEM_TEXT );
+	return rc;
+}
+
+void CImgListView::UpdateItem()
+{
+	CString		mapKey;
+	CPotoItem   *pImgItem;
+	int count=0;
+	IMG_MAP::iterator		it_img;
+	if(!m_ImgMap.empty())
+	{
+		for(it_img = m_ImgMap.begin(); it_img !=m_ImgMap.end();it_img++)
+		{		
+			mapKey = (*it_img).first;
+			pImgItem = (*it_img).second;
+			pImgItem->m_rcImg = GetItemRect(count++);
+		}
+	}	
+	Invalidate( FALSE );
+}
+
+void CImgListView::SetPageSize()
+{
+	CSize sizeTotal;
+	int nHeight = 0;
+	nHeight = m_nAddItem / m_nHItem;
+	if( (m_nAddItem % m_nHItem) > 0 )
+		nHeight++;
+
+	sizeTotal.cx = LEFT_MARJIN + (m_nHItem * (ITEM_WIDTH+ITEM_ROW_MARJIN));
+	sizeTotal.cy = TOP_MARJIN + ((nHeight+1) * (ITEM_HEIGHT+ITEM_TEXT+ITEM_COL_MARJIN));
+	if((sizeTotal.cy >0 )&& (sizeTotal.cx >0))
+		SetScrollSizes( MM_TEXT, sizeTotal);
+}
+
+BOOL CImgListView::LoadImage(CString strFilePath)
+{
+	//m_nAddItem++;
+	//CPotoItem *pItem =  new CPotoItem(strFilePath);
+	return TRUE;
+}
+
+
+BOOL CImgListView::LoadImageFolder(CString strPath, CString strGlassID, CString strOp)
+{
+	CString		strFile;		
+	CString		strPattern;
+	CString		strExt;
+	BOOL		bRC = TRUE;
+	std::vector<CString>	VectorImageNames;
+
+	if ( strPath[strPath.GetLength() - 1] == TCHAR('\\') )	
+		strPattern.Format( TEXT("%s*.*"), strPath );
+	else
+		strPattern.Format( TEXT("%s\\*.*"), strPath );
+
+	HANDLE					hFind = NULL;
+	WIN32_FIND_DATA			FindFileData;
+	hFind = ::FindFirstFile(strPattern, &FindFileData);	// strat search	
+	if (hFind == INVALID_HANDLE_VALUE)
+	{
+		return FALSE;
+	}
+
+	// filter off the system files and directories
+	if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)  &&
+		!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)     &&
+		!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)     &&
+		!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY))
+	{  	  
+		// test file extension
+		strFile = FindFileData.cFileName;
+		strExt = strFile.Right(3);
+
+		if ( (strExt.CompareNoCase( TEXT("bmp") ) == 0) ||
+			(strExt.CompareNoCase( TEXT("jpg") ) == 0) ||
+			(strExt.CompareNoCase( TEXT("gif") ) == 0) ||
+			(strExt.CompareNoCase( TEXT("tif") ) == 0) ||
+			(strExt.CompareNoCase( TEXT("png") ) == 0) )
+		{
+			// save the image file name
+			VectorImageNames.push_back(strFile);
+		}
+	}  
+
+	// loop through to add all of them to our vector	
+	while (bRC)
+	{
+		bRC = ::FindNextFile(hFind, &FindFileData);
+		if (bRC)
+		{
+			// filter off the system files and directories
+			if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)  &&
+				!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)     &&
+				!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)     &&
+				!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY))
+			{
+				// test file extension
+				strFile = FindFileData.cFileName;
+				strExt = strFile.Right(3);
+
+				if ( (strExt.CompareNoCase( TEXT("bmp") ) == 0) ||
+					(strExt.CompareNoCase( TEXT("jpg") ) == 0) ||
+					(strExt.CompareNoCase( TEXT("gif") ) == 0) ||
+					(strExt.CompareNoCase( TEXT("tif") ) == 0) ||
+					(strExt.CompareNoCase( TEXT("png") ) == 0) )
+				{
+					// save the image file name
+					VectorImageNames.push_back(strFile);
+				}
+			}
+		}  
+		else
+		{
+			DWORD err = ::GetLastError();
+			if (err !=  ERROR_NO_MORE_FILES)
+			{
+
+				return FALSE;
+			}
+		}
+	} // end of while loop
+
+	// close the search handle
+	::FindClose(hFind);
+
+	// update the names, if any
+	if ( !VectorImageNames.empty() )
+	{
+		for(int i=0;i<(int)VectorImageNames.size();i++)
+		{
+			strFile = VectorImageNames[i];
+			if(strFile.IsEmpty() == TRUE)
+				continue;
+						
+			m_nAddItem++;
+
+			CPotoItem *pItem = new CPotoItem(strPath,strFile);
+			m_ImgMap[strFile] =pItem;	
+		}
+
+		UpdateItem();
+		SetPageSize();
+		Invalidate(FALSE);
+
+		return TRUE;
+	}	
+		
+	return FALSE;
+}
+
+
+
+BOOL CImgListView::SelectItemChk(CPoint point)
+{
+
+	CString				mapKey; 
+	CPotoItem			*pImgItem,*pImgItem2;
+	IMG_MAP::iterator	it_img,it_img2;
+	CRect				rcItem;
+	BOOL				bUpdate=0;
+	if(!m_ImgMap.empty())
+	{
+		for(it_img = m_ImgMap.begin(); it_img !=m_ImgMap.end();it_img++)
+		{		
+			pImgItem = (*it_img).second;
+			rcItem   = pImgItem->GetRect();
+			if(rcItem.PtInRect(point))
+			{
+				if(KEY_DOWN(VK_SHIFT))
+				{
+					pImgItem->ToggleSelected();
+				}
+				else
+				{
+					for(it_img2 = m_ImgMap.begin(); it_img2 != m_ImgMap.end();it_img2++)
+					{
+						pImgItem2 = (*it_img2).second;
+						pImgItem2->SetSelect(0);
+					}
+					pImgItem->SetSelect(1);					
+					m_pSelImg = &pImgItem->m_Img;
+					m_pSelectItem = pImgItem;
+					::SendMessage(GetParent()->m_hWnd,UM_CLK_ITEM_UPDATE, 0, NULL);
+					bUpdate =1;
+					break;
+				}
+				bUpdate =1;
+			}
+		}
+	}
+	return bUpdate;
+}
+
+
+
+void CImgListView::DeleteItemAll()
+{
+	m_pSelectItem = NULL;
+
+	m_nAddItem =0;
+	if(m_ImgMap.empty())
+		return;
+	IMG_MAP::iterator		it_img;
+	CString		mapKey;
+	CPotoItem   *pImgItem;
+
+	for(it_img = m_ImgMap.begin(); it_img !=m_ImgMap.end();it_img++)
+	{		
+		mapKey		= (*it_img).first;
+		pImgItem	= (*it_img).second;
+
+
+		if(pImgItem->m_Img.IsNull() == FALSE)
+		{
+			pImgItem->m_Img.Destroy();
+		}
+		delete pImgItem;
+	}
+	m_ImgMap.clear();
+}
+
+void CImgListView::OnSize(UINT nType, int cx, int cy) 
+{
+	CScrollView::OnSize(nType, cx, cy);
+
+	CRect rc;
+	GetClientRect(rc);
+	cx = rc.Width();
+	cy = rc.Height();
+
+	int nX = ITEM_WIDTH + ITEM_ROW_MARJIN;
+	int nHalfX = nX >> 1;
+	m_nHItem = cx / nX;
+
+	if( (cx % nX) > nHalfX )	m_nHItem++;
+
+	if( m_nHItem <= 1 )
+		m_nHItem = 1;
+
+
+	if( m_nHItemOld != m_nHItem )
+	{
+		m_nHItemOld = m_nHItem;
+		UpdateItem();
+		SetPageSize();
+	}	
+}
+
+void CImgListView::OnPaint() 
+{
+	CPaintDC dc(this); // device context for painting
+
+
+
+	CPoint ptScroll = GetScrollPosition();
+	dc.SetWindowOrg( ptScroll.x , ptScroll.y );
+	CRect rect;
+	GetClientRect(&rect); 
+
+
+
+	CRect rcInvalid = dc.m_ps.rcPaint;
+	dc.DPtoLP( &rcInvalid );
+
+	CDC MemDC;
+	CBitmap MemBitmap,* pOldBitmap;
+
+	MemDC.CreateCompatibleDC( &dc );
+	MemBitmap.CreateCompatibleBitmap( &dc , rect.Width() , rect.Height() );
+	pOldBitmap = (CBitmap *)MemDC.SelectObject( &MemBitmap );
+	MemDC.FillRect( &rect , &m_BgBrush );			// 硅版祸栏肺 快急 磨秦林绊...
+	MemDC.SetWindowOrg( ptScroll.x , ptScroll.y );	// SetWindowOrg()
+
+
+	IMG_MAP::iterator	it_img;
+	CString		mapKey;
+	CPotoItem   *pImgItem;
+	int i=0;
+	CRect tmpRc;
+	if(!m_ImgMap.empty())
+	{
+		for(it_img = m_ImgMap.begin(); it_img !=m_ImgMap.end();it_img++)
+		{		
+			mapKey = (*it_img).first;
+			pImgItem = (*it_img).second;
+			tmpRc  = pImgItem->m_rcImg;//=GetItemRect(i++);// rc ;
+
+
+			if( !tmpRc.IntersectRect( pImgItem->m_rcImg , rcInvalid ) )	
+			{
+				//辑肺 般摹绰 何盒捞 绝促绰 巴阑 唱鸥辰促.
+				//溜 泅犁 酒捞袍篮 拳搁俊 促矫 弊府瘤 臼绰促.
+				continue;
+			}	
+			pImgItem->Draw(&MemDC,rcInvalid,pImgItem->m_rcImg);		
+		}
+	}
+	dc.BitBlt( rcInvalid.left , rcInvalid.top , rcInvalid.Width() , rcInvalid.Height() , &MemDC , rcInvalid.left , rcInvalid.top , SRCCOPY );
+	MemDC.SelectObject( pOldBitmap );
+	MemDC.DeleteDC();
+	MemBitmap.DeleteObject();
+
+}
+
+BYTE* CImgListView::GetImagePoint()
+{
+	return (BYTE*)m_pSelImg->GetBits();
+} 
+
+TCHAR* CImgListView::GetSelectImgPath()
+{
+	if(m_pSelectItem)
+	{
+		return m_pSelectItem->m_Path;
+	}
+	return _T("");
+}
+
+
+
+void CImgListView::OnLButtonDown(UINT nFlags, CPoint point) 
+{
+	CPoint ptScroll(point);
+	ptScroll += GetScrollPosition();	// 胶农费等 谅钎甫 歹秦林绊...
+
+	if(SelectItemChk(ptScroll))		
+		Invalidate(FALSE);//Invalidate();
+
+	CScrollView::OnLButtonDown(nFlags, point);
+}
+
+void CImgListView::OnLButtonDblClk(UINT nFlags, CPoint point) 
+{
+	if(SelectItemChk(point))
+		Invalidate(FALSE);
+
+	CScrollView::OnLButtonDblClk(nFlags, point);
+}
+
+
+
+
+BOOL CImgListView::OnEraseBkgnd(CDC* pDC)
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+	CRect rect ;
+	GetClientRect(&rect);
+	pDC->FillRect(rect, &m_BgBrush);
+	return TRUE ; 
+	return CScrollView::OnEraseBkgnd(pDC);
+}
+
+
+void CImgListView::UpdateView()
+{
+
+
+	CDC * pDC = GetDC();
+	CRect rect;
+	GetClientRect(&rect); 
+
+	CPoint ptScroll = GetScrollPosition();
+	pDC->SetWindowOrg(ptScroll.x,ptScroll.y);
+	//----------------------------------------------------
+	// Invalidate 等 康开狼 谅钎甫 稠府 谅钎拌肺 函拳窍扁 
+	// 困秦辑 掘绢柯促.
+	//----------------------------------------------------
+	CRect rcInvalid;
+	GetClientRect(rcInvalid);
+	pDC->DPtoLP(&rcInvalid);
+
+
+	CDC MemDC;
+	CBitmap MemBitmap,* pOldBitmap;
+
+	MemDC.CreateCompatibleDC(pDC);
+	MemBitmap.CreateCompatibleBitmap(pDC , rect.Width() , rect.Height() );
+	pOldBitmap = (CBitmap *)MemDC.SelectObject( &MemBitmap );
+	//MemDC.FillRect( &rect , &m_BgBrush );			
+	MemDC.SetWindowOrg( ptScroll.x , ptScroll.y );	
+
+
+	IMG_MAP::iterator	it_img;
+	CString		mapKey;
+	CPotoItem   *pImgItem;
+	int i=0;
+	CRect tmpRc;
+	if(!m_ImgMap.empty())
+	{
+		for(it_img = m_ImgMap.begin(); it_img !=m_ImgMap.end();it_img++)
+		{		
+			mapKey		= (*it_img).first;
+			pImgItem	= (*it_img).second;
+			tmpRc		= pImgItem->m_rcImg;
+			if( !tmpRc.IntersectRect( pImgItem->m_rcImg , rcInvalid ) )	
+			{
+				//辑肺 般摹绰 何盒捞 绝促绰 巴阑 唱鸥辰促.
+				//溜 泅犁 酒捞袍篮 拳搁俊 促矫 弊府瘤 臼绰促.
+				continue;
+			}	
+			pImgItem->Draw(&MemDC,rcInvalid,pImgItem->m_rcImg);		
+		}
+	}
+	pDC->BitBlt( rcInvalid.left ,rcInvalid.top , rcInvalid.Width() , rcInvalid.Height() , &MemDC , rcInvalid.left , rcInvalid.top , SRCCOPY );
+	MemDC.SelectObject( pOldBitmap );
+	MemDC.DeleteDC();
+	MemBitmap.DeleteObject();
+
+	ReleaseDC(pDC);
+
+}
+
+void CImgListView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+	//UpdateView();
+	CScrollView::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CImgListView::OnDestroy()
+{
+	CScrollView::OnDestroy();
+	DeleteItemAll();
+}
diff --git a/ENRIT/View/ImgListView.h b/ENRIT/View/ImgListView.h
new file mode 100644
index 0000000..645037f
--- /dev/null
+++ b/ENRIT/View/ImgListView.h
@@ -0,0 +1,126 @@
+#if !defined(AFX_IMGLISTVIEW_H__C0DD00C1_EEA9_4E84_BB03_8DE83B2DEDEA__INCLUDED_)
+#define AFX_IMGLISTVIEW_H__C0DD00C1_EEA9_4E84_BB03_8DE83B2DEDEA__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ImgListView.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CImgListView view
+#include <map>
+using std::map;
+
+
+#define	    LEFT_MARJIN	 15
+#define		TOP_MARJIN	 15
+#define		ITEM_WIDTH	 380      // 蔼捞 官差绢具 窍骨肺 define捞唱 const绰 绢匡府瘤 臼绰促.
+#define		ITEM_HEIGHT	 320      // 
+#define		ITEM_TEXT    22			// 酒捞袍俊 措茄 臂磊 臭捞
+#define		ITEM_ROW_MARJIN	15		// 酒捞袍苞 酒捞袍狼 啊肺荤捞
+#define		ITEM_COL_MARJIN	 20		// 酒捞袍苞 酒捞袍狼 技肺荤捞
+
+class CPotoItem  
+{
+public:
+	CPotoItem();
+	CPotoItem(CString strFilePath);
+	CPotoItem(CString strFilePath,CString strFileName,CString strImgInfo =_T(""));
+	virtual ~CPotoItem();
+public:
+	void GetItemRect(int nItem);
+	void DrawRect(CDC *pDC, COLORREF color,CRect rc);
+	void DrawText(CDC* pDC, COLORREF color );
+	void Draw(CDC* pDC, CRect rcClient, CRect rcChange );
+
+	CImage  m_Img;
+	CRect	m_rcImg;
+	BOOL	m_bSelect;     // 急琶 登菌绰啊 
+	BOOL	m_bValid;      // 按眉狼 粮犁己 
+	BOOL    m_bProcesing;  // 贸府吝牢啊 
+	TCHAR   m_Path[MAX_PATH];
+
+	CRect   GetRect()				 { return m_rcImg; }
+	void	SetSelect( bool bState ) { m_bSelect = bState; }
+	void	ToggleSelected()		 { m_bSelect = !m_bSelect;}
+};
+
+
+typedef map<CString,CPotoItem*> IMG_MAP;
+
+#define	KEY_DOWN(VK_CODE) ((GetAsyncKeyState(VK_CODE) & 0x8000) ? 1 : 0)
+
+#define	UM_CLK_ITEM_UPDATE	WM_USER	+ 102
+class CImgListView : public CScrollView
+{
+protected:
+	CImgListView();           // protected constructor used by dynamic creation
+	DECLARE_DYNCREATE(CImgListView)
+
+	// Attributes
+public:
+
+	// Operations
+public:
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CImgListView)
+protected:
+	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
+	virtual void OnInitialUpdate();     // first time after construct
+	//}}AFX_VIRTUAL
+
+	// Implementation
+protected:
+	virtual ~CImgListView();
+#ifdef _DEBUG
+	virtual void AssertValid() const;
+	virtual void Dump(CDumpContext& dc) const;
+#endif
+
+	// Generated message map functions
+	//{{AFX_MSG(CImgListView)
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnPaint();
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+
+public:
+	IMG_MAP			m_ImgMap;
+	int				m_nHItem;		// 技肺肺 割俺啊 免仿捞 瞪巴牢啊?
+	int				m_nHItemOld;
+	int				m_nAddItem;		// 佬绢甸牢 酒捞袍狼 醚肮荐
+	CBrush			m_BgBrush;		// 硅版Brush
+	CImage*			m_pSelImg;
+	CPotoItem		*m_pSelectItem;
+public:
+	CImage*	GetSelImg() const	   {return m_pSelImg;};
+	void	DeleteItemAll();
+	BYTE*	GetImagePoint(); 
+	TCHAR*	GetSelectImgPath();
+
+	BOOL SelectItemChk(CPoint point);
+	BOOL  LoadImageFolder(CString strPath, CString strGlassID, CString strOp = _T(""));
+	BOOL  LoadImage(CString strFilePath);
+
+	void  SetPageSize();
+	void  UpdateItem();
+	CRect GetItemRect(int nItem);
+
+	void UpdateView();
+public:
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnDestroy();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_IMGLISTVIEW_H__C0DD00C1_EEA9_4E84_BB03_8DE83B2DEDEA__INCLUDED_)
diff --git a/ENRIT/View/ViewDefect.cpp b/ENRIT/View/ViewDefect.cpp
new file mode 100644
index 0000000..db26aa9
--- /dev/null
+++ b/ENRIT/View/ViewDefect.cpp
@@ -0,0 +1,583 @@
+// ViewDefect.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewDefect.h"
+#include "afxdialogex.h"
+#include "Global_Define.h"
+
+// CViewDefect 措拳 惑磊涝聪促.
+
+#define GRID_FIX_COLOR			RGB(144,200,246)
+#define GRID_COLOR				RGB(242,242,242)
+#define GRID_TEXT_COLOR			RGB(255,255,255)
+#define GRID_LINE_COLOR			GRID_FIX_COLOR
+
+const int	DEFECT_COLUMN_COUNT = 13;
+const TCHAR	*DEFECTLIST_COLUMN_ITEM[DEFECT_COLUMN_COUNT]	= {_T("No"),_T("Side"),_T("Type"),_T("Index"),_T("W Size(um)"),_T("H Size(um)"),_T("RScale(um"),_T("Xpos(um)"),_T("Ypos(um)"),_T("Cam")
+	,_T("ScanIdx"),_T("StartLine"),_T("Defect Idx")};
+const int	DEFECT_COLUMN_WIDHT[DEFECT_COLUMN_COUNT] = {40,60,60,80,80,80,80,80,40,40,80,80,80};
+
+IMPLEMENT_DYNAMIC(CViewDefect, CDialogEx)
+
+CViewDefect::CViewDefect(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewDefect::IDD, pParent)
+{
+	m_pHardware = NULL;
+	m_pGlassData = NULL;
+	m_pMapDefect = NULL;
+	m_bAsending = TRUE;	
+	m_pIV2M = NULL;
+	m_pSelDefect = NULL;
+}
+
+CViewDefect::~CViewDefect()
+{
+}
+
+void CViewDefect::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Control(pDX,IDC_GRD_DEFECT_LIST,m_GrdDefect);
+	DDX_Control(pDX, IDC_SCROLLBAR_DEFECT_H, m_ctrlScrollH);
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewDefect, CDialogEx)
+	ON_WM_HSCROLL()
+	ON_NOTIFY(NM_CLICK, IDC_GRD_DEFECT_LIST, OnGridClick)
+	ON_NOTIFY(NM_DBLCLK, IDC_GRD_DEFECT_LIST, OnGridDBClick)
+	ON_MESSAGE(UM_CLK_ITEM_UPDATE	, OnCImgListViewItemCLK)
+END_MESSAGE_MAP()
+
+BOOL CViewDefect::PreTranslateMessage(MSG* pMsg) 
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+BOOL CViewDefect::OnInitDialog(void)
+{
+	CDialogEx::OnInitDialog();	
+	
+	Init_DefectGrid();
+
+	GetDlgItem(IDC_STATIC_DEFECT_IMAGE)->GetWindowRect(&m_rcDefectImg);
+	ScreenToClient(m_rcDefectImg);
+
+	m_DefectImg.SetMeasureAble(TRUE);
+	m_DefectImg.Create(m_rcDefectImg, this);
+	
+	InitScrollInfo();
+
+	CRect rc;
+
+	m_pContextImgList.m_pNewViewClass = RUNTIME_CLASS(CImgListView);
+	m_pImgList = (CImgListView*)((CFrameWnd*)this)->CreateView(&m_pContextImgList);
+	ASSERT(m_pImgList);
+
+	GetDlgItem(IDC_STATIC_IMG_LIST)->GetWindowRect(rc);
+	ScreenToClient(rc);
+
+	m_pImgList->ShowWindow(SW_NORMAL);
+	m_pImgList->MoveWindow(rc);
+
+	return TRUE;
+}
+
+// CViewDefect 皋矫瘤 贸府扁涝聪促.
+void CViewDefect::SetRecipe(CHardwareSettings *pHW)
+{
+	m_pHardware = pHW;
+}
+
+void CViewDefect::SetGlassData(CGlass_Data *pGlass)
+{	
+	m_pGlassData = pGlass;	
+}
+
+void CViewDefect::OnGridClick(NMHDR *pNotifyStruct, LRESULT* /*pResult*/)
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
+
+	if(pItem->iRow == 0)
+	{
+		SortListDefect(pItem->iColumn);
+		FillDefectList();	
+	}	
+}
+
+void CViewDefect::SelectDefect( int nSelDefect )
+{
+	if(m_GrdDefect.GetRowCount() <= 1)
+		return;
+
+	int nListDefectIdx;
+	int	iRow,iCol=0;
+	CString		str;
+
+	if(m_nSelectedRow > 0)
+	{			
+		m_GrdDefect.SetItemState(m_nSelectedRow, m_nSelectedCol, m_GrdDefect.GetItemState(m_nSelectedRow, m_nSelectedCol) & ~GVIS_SELECTED & ~GVIS_FOCUSED);		
+		m_nSelectedRow = -1;
+		m_nSelectedCol = -1;
+	}
+
+	for (iRow = 1; iRow < m_GrdDefect.GetRowCount() ; iRow++)
+	{
+		str = m_GrdDefect.GetItemText(iRow, 0);
+		nListDefectIdx = _ttoi(str);
+		if (nListDefectIdx == nSelDefect)
+		{
+			m_GrdDefect.SetItemState(iRow,iCol, LVIS_SELECTED|LVIS_FOCUSED);
+			m_GrdDefect.EnsureVisible(iRow, 0);
+			m_nSelectedRow = iRow;
+			m_nSelectedCol = 0;
+			break;
+
+		}
+	}
+	m_GrdDefect.Invalidate();
+}
+
+LRESULT CViewDefect::OnCImgListViewItemCLK(WPARAM wParam, LPARAM lParam)
+{
+	CString strFileName = m_pImgList->GetSelectImgPath();	
+	
+	if((int)m_pSortDefect.size() <= 0)
+		return 0;
+
+	LISTDefectit		it;
+	CInspectDefect		*pDefect;
+
+	vector< pair<int,CInspectDefect*> > vec;	
+	CString			strFullPath;
+	int				nIndex = 0;
+
+	for(it = m_pSortDefect.begin(); it != m_pSortDefect.end(); ++it,nIndex++)
+	{
+		pDefect = *it;
+		if(pDefect == NULL)
+			continue;
+
+		strFullPath = pDefect->m_strDefectPath;
+		if(strFullPath.IsEmpty() == TRUE)
+			continue;
+				
+		strFileName.MakeUpper();
+		strFullPath.MakeUpper();
+		if(strFileName == strFullPath)
+		{
+			SelectDefect(pDefect->m_nGlassDefectIdx);
+			SetSelectDefectImg(nIndex+1);
+			break;
+		}
+	}
+
+	return 1;
+}
+
+void CViewDefect::SetSelectDefectImg(int iRow)
+{
+	if(m_pIV2M != NULL)
+	{
+		int			iDefect;
+
+		iDefect = _ttoi(m_GrdDefect.GetItemText(iRow,0));
+
+		m_pSelDefect = FindDefectBuffer(iDefect);		
+
+		if(m_pSelDefect == NULL)
+			return;
+
+		if(m_pSelDefect->m_strDefectPath.IsEmpty() == TRUE)
+			return;
+
+		int		nStageNo = g_pBase->m_nStageNo;
+
+		if(nStageNo < 0 || nStageNo > 1)
+			nStageNo = 0;
+
+		CCameraSettings *pCamera = NULL;
+		double		dResH=5,dResV=5;
+		if(m_pHardware != NULL)
+		{
+			pCamera = m_pHardware->GetCameraSettings(m_pSelDefect->m_nCameraID,m_pSelDefect->m_nScanIdx);
+			dResH = pCamera->m_dConvResolution[nStageNo];
+			dResV = pCamera->m_dScanResolution[nStageNo];
+		}
+
+		m_DefectImg.SetDefectImage(m_pSelDefect->m_nSideLoc,m_pSelDefect->m_strDefectPath,dResH, dResV);
+	}
+
+	InitScrollInfo();
+}
+
+void CViewDefect::OnGridDBClick(NMHDR *pNotifyStruct, LRESULT* pResult)
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
+	if (pItem->iRow < 0)
+		return;
+
+	m_nSelectedRow = pItem->iRow;
+	m_nSelectedCol = pItem->iColumn;
+
+	SetSelectDefectImg(m_nSelectedRow);	
+}
+
+CInspectDefect *CViewDefect::FindDefectBuffer(int iGlassIdx)
+{
+	if(m_pMapDefect == NULL)
+		return NULL;
+
+	MapDefectIt		it;
+	CInspectDefect	*pDefect;		
+
+	for(it=m_pMapDefect->begin();it!=m_pMapDefect->end();it++)
+	{
+		pDefect = static_cast<CInspectDefect*>(it->second);
+		if(pDefect == NULL)
+			continue;
+
+		if(pDefect->m_nGlassDefectIdx == iGlassIdx)
+		{
+			return pDefect;
+		}
+	}
+
+	return NULL;
+}
+
+void CViewDefect::InitScrollInfo()
+{
+	SCROLLINFO scrollInfoH;
+
+	scrollInfoH.cbSize		= sizeof(SCROLLINFO);
+	scrollInfoH.fMask		= SIF_ALL;
+	scrollInfoH.nMin		= 1;
+	scrollInfoH.nPos		= abs(m_DefectImg.m_ptOrg.x);
+	scrollInfoH.nTrackPos	= 64;
+	scrollInfoH.nMax		= m_DefectImg.GetImgWidth()	- m_rcDefectImg.Width();
+	scrollInfoH.nPage		= scrollInfoH.nMax - (m_DefectImg.GetImgWidth() - m_rcDefectImg.Width()); 
+
+	m_ctrlScrollH.SetScrollPos(abs(m_DefectImg.m_ptOrg.x));
+	m_ctrlScrollH.SetScrollInfo(&scrollInfoH);
+}
+
+void CViewDefect::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+	SCROLLINFO si;
+	si.fMask = SIF_ALL;
+	m_ctrlScrollH.GetScrollInfo(&si, SIF_ALL);
+
+	switch (nSBCode)
+	{
+	case SB_LINEUP:		si.nPos--;			break;
+	case SB_LINEDOWN:	si.nPos++;			break;
+	case SB_PAGEUP:		si.nPos-=si.nPage;	break;
+	case SB_PAGEDOWN:	si.nPos+=si.nPage;	break;
+	case SB_THUMBTRACK:	si.nPos=nPos;		break;
+	}
+
+	if (si.nPos>(int)(si.nMax-si.nMin-si.nPage+1)) si.nPos=si.nMax-si.nMin-si.nPage+1;
+	if (si.nPos<si.nMin) si.nPos=si.nMin;
+	si.fMask = SIF_POS;
+
+	m_ctrlScrollH.SetScrollInfo(&si);
+	//m_frameImg.m_ptOrg.x = si.nPos;
+	m_DefectImg.m_ptOrg.x = si.nPos;
+	m_DefectImg.Invalidate(FALSE);
+
+	CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CViewDefect::ResetView()
+{
+	m_pOrgDefect.clear();
+	m_pSortDefect.clear();
+
+	FillDefectList();
+
+	m_pImgList->DeleteItemAll();
+	m_pImgList->Invalidate(FALSE);
+}
+
+void CViewDefect::SortListDefect( int nCol )
+{
+	LISTDefectit		it;
+	CInspectDefect		*pDefect;
+
+	m_bAsending = !m_bAsending;
+	vector< pair<int,CInspectDefect*> > vec;	
+	int				nValue;		
+
+	for(it = m_pSortDefect.begin(); it != m_pSortDefect.end(); ++it)
+	{
+		pDefect = *it;
+
+		switch(nCol)
+		{
+		case 0: nValue = pDefect->m_nGlassDefectIdx; break;
+		case 1: nValue = pDefect->m_nSideLoc; break;	
+		case 2: nValue = pDefect->m_sDefectLoc; break;		
+		case 3: nValue = pDefect->m_nProfileIdx; break;		
+		case 4: nValue = pDefect->m_nUMSizeY; break;			
+		case 5: nValue = pDefect->m_nUMSizeX; break;
+		case 6: nValue = pDefect->m_nDefectRScale; break;
+		case 7:	nValue = pDefect->m_nUMOriginX; break;
+		case 8: nValue = pDefect->m_nUMOriginY;	break;				
+		case 9: nValue = pDefect->m_nCameraID; break;				
+		case 10:nValue = pDefect->m_nScanIdx; break;
+		case 11:nValue = pDefect->m_nPixelGlassStart; break;			
+		case 12:nValue = pDefect->m_nDefectIdx; break;		
+		default:
+			continue;
+		}
+
+		vec.push_back(make_pair(nValue,pDefect));
+	}
+
+	if(m_bAsending == TRUE)
+	{
+		std::sort(vec.begin(),vec.end(),greater< pair<int,CInspectDefect*> >());
+	}
+	else
+	{
+		std::sort(vec.begin(),vec.end(),less< pair<int,CInspectDefect*> >());
+	}
+
+	m_pSortDefect.clear();
+	vector< pair<int,CInspectDefect*> >::iterator itVec;
+	for(itVec = vec.begin(); itVec != vec.end(); ++itVec)
+	{
+		m_pSortDefect.push_back(itVec->second);			
+	}
+
+	vec.clear();		
+}
+
+void CViewDefect::SetDefectList(MapDefect* pMapDefect)
+{
+	if(pMapDefect == NULL)
+	{
+		m_pMapDefect = NULL;
+	}
+	else
+	{
+		m_pMapDefect = pMapDefect;
+
+		int			nDefectSize = (int)m_pMapDefect->size();
+		MapDefectIt		it;	
+		CInspectDefect	*pInsDefect;
+
+		for (MapDefectIt it = m_pMapDefect->begin(); it != m_pMapDefect->end(); it++)
+		{
+			pInsDefect = static_cast<CInspectDefect*>(it->second);
+
+			if (!pInsDefect)
+				continue;
+			if(pInsDefect->m_bJudgeDefect == FALSE)
+				continue;
+
+			m_pOrgDefect.push_back(pInsDefect);
+
+			m_pSortDefect.push_back(pInsDefect);
+		}			
+	}
+	
+	SortListDefect(0);
+	FillDefectList();	
+}
+
+void CViewDefect::SetDefectPath(CString strPath)
+{
+	m_strDefectPath = strPath;
+
+	m_pImgList->DeleteItemAll();
+	m_pImgList->Invalidate(FALSE);
+
+	if((int)m_pSortDefect.size() > 0)
+	{
+		CString		str = strPath + _T("\\");
+		m_pImgList->LoadImageFolder(str,g_pBase->m_strHPanelID);
+	}
+
+}
+
+void CViewDefect::FillDefectList()
+{
+	if(m_GrdDefect.GetSafeHwnd() == NULL)
+		return;
+
+	m_GrdDefect.SetRowCount((int)m_pSortDefect.size()+1);		
+
+	LISTDefectit		it;
+	CInspectDefect		*pDefect;
+	int					iRow,iCol;
+	CString				str;
+
+	iRow = 1;
+	for(it = m_pSortDefect.begin(); it != m_pSortDefect.end(); ++it,iRow++)
+	{
+		pDefect = *it;
+		if(pDefect == NULL)
+			continue;
+
+		iCol = 0;
+		str.Format(_T("%d"),pDefect->m_nGlassDefectIdx);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 1;
+		str.Format(_T("%s"),PANEL_SIDE[pDefect->m_nSideLoc]);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 2;
+		str = _T("Unknown");								
+
+		switch(pDefect->m_sDefectLoc)
+		{
+		case DefectLoc_Crack: str=_T("Crack"); break;
+		case DefectLoc_Broken: str=_T("Broken"); break;
+		case DefectLoc_Chip: 
+			{
+				if(pDefect->m_sSplineLoc == Spline_None)
+					str=_T("Chip"); 
+				else
+					str=_T("R_Chip"); 
+				break;
+			}
+		case DefectLoc_Chamfer: str=_T("Chamfer"); break;
+		case DefectLoc_Burr: str=_T("Burr"); break;
+		case DefectLoc_Thin: str=_T("Thin"); break;
+		case DefectLoc_Air: str=_T("Lifting"); break;
+		case DefectLoc_Notch: str=_T("NCut"); break;
+		case DefectLoc_Hole: str=_T("Hole"); break;
+		case DefectLoc_Profile: str=_T("Profile"); break;
+		case DefectLoc_KDist: str = _T("KDist"); break;
+		case DefectLoc_RCUTChip: str = _T("RCUTChip"); break;
+		}	
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 3;
+
+		int nIndex = pDefect->m_nProfileIdx;
+
+		if(pDefect->m_sDefectLoc == DefectLoc_Chamfer|| pDefect->m_sDefectLoc == DefectLoc_Profile)
+			nIndex += 1;
+
+		str.Format(_T("%d"),nIndex);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 4;
+		str.Format(_T("%d"),pDefect->m_nUMSizeY);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 5;
+		str.Format(_T("%d"),pDefect->m_nUMSizeX);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 6;
+		str.Format(_T("%d"),pDefect->m_nDefectRScale);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 7;
+		str.Format(_T("%d"),pDefect->m_nUMOriginX);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 8;
+		str.Format(_T("%d"),pDefect->m_nUMOriginY);
+		m_GrdDefect.SetItemText(iRow,iCol,str);		
+
+		iCol = 9;
+		str.Format(_T("%d"),pDefect->m_nCameraID);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 10;
+		str.Format(_T("%d"),pDefect->m_nScanIdx);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 11;
+		str.Format(_T("%d"),pDefect->m_nPixelGlassStart);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+
+		iCol = 12;
+		str.Format(_T("%d"),pDefect->m_nDefectIdx);
+		m_GrdDefect.SetItemText(iRow,iCol,str);
+	}
+
+	m_GrdDefect.Invalidate();
+}
+
+void CViewDefect::Init_DefectGrid()
+{
+	if(m_GrdDefect.GetSafeHwnd() == NULL)
+		return;
+
+// 	m_GrdDefect.GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
+// 	m_GrdDefect.GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
+// 	m_GrdDefect.GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
+// 	m_GrdDefect.SetFixedBkColor(GRID_FIX_COLOR);
+	m_GrdDefect.SetGridLines(GVL_BOTH);	
+
+	m_GrdDefect.SetColumnCount(DEFECT_COLUMN_COUNT);
+	m_GrdDefect.SetRowCount(1000);
+	m_GrdDefect.SetFixedRowCount(1);
+	m_GrdDefect.SetFixedColumnCount(0);
+	
+	CFont *pFont = m_GrdDefect.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_GrdDefect.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_GrdDefect.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_GrdDefect.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_GrdDefect.SetEditable(FALSE);
+	m_GrdDefect.EnableSelection(TRUE);
+
+	m_GrdDefect.SetFixedRowSelection(TRUE);	
+	m_GrdDefect.SetSingleRowSelection(TRUE);
+	m_GrdDefect.SetSingleColSelection(TRUE);	
+
+	Init_DefectGridHeader();
+
+	m_GrdDefect.Invalidate();
+}
+
+void CViewDefect::Init_DefectGridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<DEFECT_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText.Format(_T("%s"),DEFECTLIST_COLUMN_ITEM[iLoop]);
+		m_GrdDefect.SetItem(&Item);	
+		m_GrdDefect.SetColumnWidth(Item.col,DEFECT_COLUMN_WIDHT[iLoop]);
+	}		
+
+	m_GrdDefect.Invalidate();
+}
\ No newline at end of file
diff --git a/ENRIT/View/ViewDefect.h b/ENRIT/View/ViewDefect.h
new file mode 100644
index 0000000..4750195
--- /dev/null
+++ b/ENRIT/View/ViewDefect.h
@@ -0,0 +1,74 @@
+#pragma once
+
+#include "Global_Define.h"
+#include "ImgDefect.h"
+#include "InspectDefect.h"
+#include "ImgListView.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "Glass_Data.h"
+
+using namespace std;
+typedef std::vector<CInspectDefect*>				LISTDefect;
+typedef std::vector<CInspectDefect*>::iterator		LISTDefectit;
+
+// CViewDefect 措拳 惑磊涝聪促.
+
+class CViewDefect : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewDefect)
+
+public:
+	CViewDefect(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewDefect();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_DEFECT_VIEW };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual BOOL OnInitDialog(void);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnGridClick(NMHDR *pNotifyStruct, LRESULT* pResult);	
+	afx_msg void OnGridDBClick(NMHDR *pNotifyStruct, LRESULT* pResult);
+	LRESULT OnCImgListViewItemCLK(WPARAM wParam, LPARAM lParam);
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void			SetRecipe(CHardwareSettings *pHW);
+	void			SetV2M(IViewInterface2Parent* pV2M){m_pIV2M=pV2M;}
+	void			SetGlassData(CGlass_Data *pGlass);
+	void			SetDefectList(MapDefect* pMapDefect);
+	void			SetDefectPath(CString strPath);
+	void			ResetView();
+	
+protected:
+	void			Init_DefectGrid();
+	void			Init_DefectGridHeader();
+	void			InitScrollInfo();
+	void			FillDefectList();
+	void			SortListDefect(int nCol);
+	CInspectDefect	*FindDefectBuffer(int iGlassIdx);
+	void			SelectDefect(int nSelDefect);
+	void			SetSelectDefectImg(int iRow);
+
+protected:
+	CHardwareSettings		*m_pHardware;
+	IViewInterface2Parent	*m_pIV2M;
+	CGlass_Data				*m_pGlassData;	
+	CGridCtrl				m_GrdDefect;
+	LISTDefect				m_pOrgDefect;
+	LISTDefect				m_pSortDefect;	
+	CImgDefect				m_DefectImg;
+	CRect					m_rcDefectImg;
+	CScrollBar				m_ctrlScrollH;
+	BOOL					m_bAsending;
+	MapDefect				*m_pMapDefect;
+	int						m_nSelectedRow;
+	int						m_nSelectedCol;
+	CInspectDefect			*m_pSelDefect;
+	CImgListView			*m_pImgList;
+	CCreateContext			m_pContextImgList;
+	CString					m_strDefectPath;
+};
diff --git a/ENRIT/View/ViewException.cpp b/ENRIT/View/ViewException.cpp
new file mode 100644
index 0000000..9f52b4c
--- /dev/null
+++ b/ENRIT/View/ViewException.cpp
@@ -0,0 +1,598 @@
+// Dlg_Exception.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "ViewException.h"
+#include "afxdialogex.h"
+#include <bitset>
+#include "Glass_Data.h"
+
+const int EXPAREA_COLUMN_COUNT = 8;
+const char* EXPAREA_COLUMN_ITEM[EXPAREA_COLUMN_COUNT] = {"No","Px","Py","Width","Height","Error X","Error Y","Apply Defect"};
+const int EXPAREA_COLUMN_WIDHT[EXPAREA_COLUMN_COUNT] = {50,80,80,80,80,80,80,350};
+
+#define GRID_FIX_COLOR			RGB(144,200,246)
+#define GRID_COLOR				RGB(242,242,242)
+#define GRID_TEXT_COLOR			RGB(255,255,255)
+#define GRID_LINE_COLOR			GRID_FIX_COLOR
+
+// CViewException dialog
+
+IMPLEMENT_DYNAMIC(CViewException, CDialogEx)
+
+CViewException::CViewException(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewException::IDD, pParent)
+{
+	m_nExceptionType = 0;
+	m_index			 = 0;
+	m_ptOrg			 = CPoint (0,0);	
+	m_nSelectRow	 = 0;	
+
+	m_dEditPX = 0;
+	m_dEditPY = 0;
+	m_dEditROIWidth = 0;
+	m_dEditROIHeight = 0; 
+	m_nErrorDx = 0;
+	m_nErrorDy = 0;
+
+	m_pHardwareSetting = NULL;
+	m_pGlassRecipe = NULL;
+	m_pGlassData = NULL;
+	m_pExpArea = NULL;
+}
+
+CViewException::~CViewException()
+{
+	
+}
+
+void CViewException::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Text(pDX, IDC_EDIT_PX			, m_dEditPX);
+	DDX_Text(pDX, IDC_EDIT_PY			, m_dEditPY);
+	DDX_Text(pDX, IDC_EDIT_ROI_W		, m_dEditROIWidth);
+	DDX_Text(pDX, IDC_EDIT_ROI_H		, m_dEditROIHeight);
+	DDX_Text(pDX, IDC_EDIT_ERR_DX		, m_nErrorDx);
+	DDX_Text(pDX, IDC_EDIT_ERR_DY		, m_nErrorDy);
+
+	DDX_Control(pDX, IDC_CHK_TFT_CHIPPING	, m_chk_AppDefect[0]);
+	DDX_Control(pDX, IDC_CHK_TFT_BUR		, m_chk_AppDefect[1]);
+	DDX_Control(pDX, IDC_CHK_TFT_BROKEN		, m_chk_AppDefect[2]);
+	DDX_Control(pDX, IDC_CHK_CRACK			, m_chk_AppDefect[3]);
+	DDX_Control(pDX, IDC_CF_CHIPPING		, m_chk_AppDefect[4]);
+	DDX_Control(pDX, IDC_CF_BUR				, m_chk_AppDefect[5]);
+	DDX_Control(pDX, IDC_CHK_DETECT_LIMITED_AREA, m_chk_AppDefect[6]);
+	
+	DDX_Control(pDX, IDC_EXPAREA_LIST,m_GrdExpList);
+
+}
+
+
+BEGIN_MESSAGE_MAP(CViewException, CDialogEx)	
+	ON_BN_CLICKED(IDC_BTN_ADD			, &CViewException::OnBnClickedBtnAdd)
+	ON_BN_CLICKED(IDC_BTN_MODIFY		, &CViewException::OnBnClickedBtnModify)
+	ON_BN_CLICKED(IDC_BTN_DELETE		, &CViewException::OnBnClickedBtnDelete)
+	ON_BN_CLICKED(IDC_BTN_DELETE_ALL	, &CViewException::OnBnClickedBtnDeleteAll)	
+	
+	ON_BN_CLICKED(IDC_BTN_CLOSE, &CViewException::OnBnClickedBtnClose)	
+	ON_WM_PAINT()	
+	ON_NOTIFY(NM_DBLCLK, IDC_EXPAREA_LIST, OnGridDBClick)
+	ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+
+// CViewException message handlers
+
+
+BOOL CViewException::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	
+	Init_ExpAreaGrid();
+
+	for(int i = 0 ; i < 7 ; i++)
+	{
+		m_chk_AppDefect[i].m_nFlatStyle = CMFCButton::BUTTONSTYLE_FLAT;
+		m_chk_AppDefect[i].SetImage(IDB_CHECKNO32 );
+		m_chk_AppDefect[i].SetCheckedImage(IDB_CHECK32 );
+	}
+
+	return TRUE;  // return TRUE unless you set the focus to a control	
+}
+
+void CViewException::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		FillExpAreaGrid();
+		SetControlData();
+		UpdateData(FALSE);
+	}
+}
+
+void CViewException::SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe)
+{
+	m_pHardwareSetting = pHard;
+	m_pGlassRecipe = pRecipe;
+}
+
+void CViewException::SetIndex(int index)
+{
+	m_index = index;
+}
+
+void CViewException::Init_ExpAreaGrid()
+{
+	if(m_GrdExpList.GetSafeHwnd() == NULL)
+		return;
+
+	m_GrdExpList.GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
+	m_GrdExpList.GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
+	m_GrdExpList.GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
+	m_GrdExpList.SetFixedBkColor(GRID_FIX_COLOR);
+	m_GrdExpList.SetGridLines(GVL_BOTH);	
+
+	m_GrdExpList.SetColumnCount(EXPAREA_COLUMN_COUNT);
+	m_GrdExpList.SetRowCount(10);
+	m_GrdExpList.SetFixedRowCount(1);
+	m_GrdExpList.SetFixedColumnCount(0);
+	m_GrdExpList.ExpandColumnsToFit();
+
+	CFont *pFont = m_GrdExpList.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_GrdExpList.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_GrdExpList.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_GrdExpList.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_GrdExpList.SetEditable(FALSE);
+	m_GrdExpList.EnableSelection(TRUE);
+	m_GrdExpList.SetSingleRowSelection(TRUE);
+
+	Init_ExpAreaGridHeader();
+}
+
+void CViewException::Init_ExpAreaGridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<EXPAREA_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = EXPAREA_COLUMN_ITEM[iLoop];
+		m_GrdExpList.SetItem(&Item);	
+		m_GrdExpList.SetColumnWidth(Item.col,EXPAREA_COLUMN_WIDHT[iLoop]);
+	}
+
+	m_GrdExpList.Invalidate();
+}
+
+void CViewException::FillExpAreaGrid()
+{		
+	int			iRow,iCol;
+	CString		str;				
+
+	if(m_pGlassRecipe == NULL)
+		return;
+	if(m_pHardwareSetting == NULL)
+		return;
+
+	itEXCEPTION_AREA_LIST		it;
+	EXCEPTION_AREA_LIST			*pList = m_pGlassRecipe->GetExpAreaList((DimensionDir)m_index);
+	EXECPTION_AREA				*pExp;
+		
+	int			iCam = m_pHardwareSetting->GetCameraIndexToDimension((DimensionDir)m_index);
+	int			iScan = m_pHardwareSetting->GetScanToDimension((DimensionDir)m_index);
+	CCameraSettings	*pCamera = m_pHardwareSetting->GetCameraSettings(iCam,iScan);
+
+	if(pCamera == NULL)
+		return;
+
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double		dResV = pCamera->m_dScanResolution[nStageNo];
+	double		dResH = pCamera->m_dConvResolution[nStageNo];
+
+	if(dResV <= 0)
+		dResV = 1;
+	if(dResH <= 0)
+		dResH = 1;
+	
+	m_GrdExpList.SetRowCount((int)pList->size()+1);			
+	iRow = 1;		
+
+	for(it=pList->begin();it!=pList->end();it++)
+	{
+		iCol = 0;
+
+		pExp = *it;
+
+		str.Format(_T("%d"),iRow);
+		m_GrdExpList.SetItemText(iRow,iCol,str);
+		iCol++;
+
+		str.Format(_T("%.2f"), (double)(pExp->rc.left * dResH)/1000.0);			
+		m_GrdExpList.SetItemText(iRow,iCol,str);
+		iCol++;
+						
+		str.Format(_T("%.2f"), (double)(pExp->rc.top * dResV)/1000.0);			
+		m_GrdExpList.SetItemText(iRow,iCol,str);
+		iCol++;
+
+		str.Format(_T("%.2f"), (double)(pExp->rc.Width() * dResH)/1000.0);
+		m_GrdExpList.SetItemText(iRow,iCol,str);
+		iCol++;
+
+		str.Format(_T("%.2f"), (double)(pExp->rc.Height() * dResV)/1000.0);
+		m_GrdExpList.SetItemText(iRow,iCol,str);
+		iCol++;
+						
+		str.Format(_T("%d"),pExp->szErrSize.cx);
+		m_GrdExpList.SetItemText(iRow,iCol,str);
+		iCol++;
+
+		str.Format(_T("%d"),pExp->szErrSize.cy);
+		m_GrdExpList.SetItemText(iRow,iCol,str);
+		iCol++;
+
+		bitset<16> bit(pExp->nAppDefect);
+
+		str ="";
+		if(bit[0])	str.AppendFormat(_T("[TFT_CH]"));
+		if(bit[1])	str.AppendFormat(_T("[TFT_RE]"));
+		if(bit[2])	str.AppendFormat(_T("[BROKEN]"));
+		if(bit[3])	str.AppendFormat(_T("[CRACK]"));
+		if(bit[4])	str.AppendFormat(_T("[CF_CH]"));
+		if(bit[5])	str.AppendFormat(_T("[CF_RE]"));
+		if(bit[6])	str.AppendFormat(_T("[TR_KEY]"));
+		if(bit[7])	str.AppendFormat(_T("[DET_LIM_AR]"));
+			
+		m_GrdExpList.SetItemText(iRow,iCol,str);			
+
+		iRow++;
+	}
+
+	m_GrdExpList.Invalidate();	
+}
+
+void CViewException::OnBnClickedBtnAdd()
+{
+	if(m_pGlassData == NULL || m_pIE2P == NULL || m_pGlassRecipe == NULL || m_pHardwareSetting == NULL)
+		return;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_index);
+	if(pResInfo == NULL)
+		return;
+// 	if(pResInfo->ptMark[0].x < 1 || pResInfo->ptMark[0].y < 1)
+// 	{
+// 		AfxMessageBox(_T("Not Measure Image... This Function use after Measure"),MB_YESNO | MB_ICONQUESTION);
+// 		return;
+// 	}
+
+	CINSPECT_JUDGEMENT_PARM *pJudgePrm = m_pGlassRecipe->GetJudgePrm();
+	int			iCam = m_pHardwareSetting->GetCameraIndexToDimension((DimensionDir)m_index);
+	int			iScan = m_pHardwareSetting->GetScanToDimension((DimensionDir)m_index);
+	CCameraSettings	*pCamera = m_pHardwareSetting->GetCameraSettings(iCam,iScan);
+
+	if(pCamera == NULL)
+		return;
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double		dResV = pCamera->m_dScanResolution[nStageNo];
+	double		dResH = pCamera->m_dConvResolution[nStageNo];
+
+	if(dResV <= 0)
+		dResV = 1;
+	if(dResH <= 0)
+		dResH = 1;
+	
+	m_ptOrg = m_pIE2P->IE2P_GetFrameViewBasepoint();
+
+	int		nPixelY;
+	nPixelY = (int)(m_ptOrg.y + 100 - pResInfo->ptMark[0].y);
+
+	//檬扁 谅钎甫 持绰促.
+	m_dEditPX			=   pJudgePrm->cutting[m_index/4][m_index%4].nRefernce * 0.001 * (-1);
+	m_dEditPY			=	(double)nPixelY * dResV * 0.001; 
+ 
+	m_dEditROIWidth		= 1.7;
+	m_dEditROIHeight	= 1.6;
+	m_nErrorDx			= 500;
+	m_nErrorDy			= 500;
+
+	m_pExpArea = new EXECPTION_AREA();
+	m_pExpArea->Init();
+		
+	// Pixel 谅钎肺 函券茄促.
+	m_pExpArea->nAreaType   = m_nExceptionType;
+	m_pExpArea->rc.left		= int((m_dEditPX * 1000/dResH));//  - nPixelY * g_InsData[m_nSide].dOffsetX); 
+	m_pExpArea->rc.top		= int( m_dEditPY * 1000 /dResV);
+	m_pExpArea->rc.right	= int(m_pExpArea->rc.left + m_dEditROIWidth  * 1000 / dResH);
+	m_pExpArea->rc.bottom	= int(m_pExpArea->rc.top  + m_dEditROIHeight * 1000 / dResV);
+
+	m_pExpArea->nAppDefect	 = 0x1f;
+	m_pExpArea->szErrSize.cx = m_nErrorDx;
+	m_pExpArea->szErrSize.cy = m_nErrorDy;
+
+	// Filter 康开俊 眠啊
+	EXCEPTION_AREA_LIST *pList = m_pGlassRecipe->GetExpAreaList((DimensionDir)m_index);
+
+	pList->push_back(m_pExpArea);
+
+	m_pIE2P->IE2P_SetExpArea(m_index);
+	
+	FillExpAreaGrid();
+}
+
+void CViewException::OnBnClickedBtnModify()
+{		
+	if(m_pGlassData == NULL || m_pIE2P == NULL || m_pGlassRecipe == NULL || m_pHardwareSetting == NULL)
+		return;
+
+	if(m_pExpArea == NULL)
+		return;
+
+	UpdateData(TRUE);
+
+	double		dResV,dResH;
+
+	GetResolution(dResH,dResV);
+	
+	
+	m_pExpArea->nAreaType    = m_nExceptionType;
+	m_pExpArea->rc.top		 = int(m_dEditPY / dResV * 1000);
+	m_pExpArea->rc.left		 = int(m_dEditPX / dResH * 1000);
+
+	m_pExpArea->rc.bottom    = int(m_pExpArea->rc.top  + (m_dEditROIHeight/ dResV) * 1000);
+	m_pExpArea->rc.right     = int(m_pExpArea->rc.left + (m_dEditROIWidth/ dResH) * 1000);
+
+	m_pExpArea->szErrSize.cx = m_nErrorDx;
+	m_pExpArea->szErrSize.cy = m_nErrorDy;
+
+	bitset<16> bit;
+
+	((CButton*)GetDlgItem(IDC_CHK_TFT_CHIPPING))->GetCheck()? bit.set(0) : bit.reset(0);
+	((CButton*)GetDlgItem(IDC_CHK_TFT_BUR))->GetCheck()		? bit.set(1) : bit.reset(1);
+	((CButton*)GetDlgItem(IDC_CHK_TFT_BROKEN))->GetCheck()	? bit.set(2) : bit.reset(2);
+	((CButton*)GetDlgItem(IDC_CHK_CRACK))->GetCheck()		? bit.set(3) : bit.reset(3);
+	((CButton*)GetDlgItem(IDC_CF_CHIPPING))->GetCheck()		? bit.set(4) : bit.reset(4);
+	((CButton*)GetDlgItem(IDC_CF_BUR))->GetCheck()			? bit.set(5) : bit.reset(5);
+	((CButton*)GetDlgItem(IDC_CHK_DETECT_LIMITED_AREA))->GetCheck()			? bit.set(6) : bit.reset(6);
+	//	((CButton*)GetDlgItem(IDC_CHK_TRIMER_KEY))->GetCheck()	? bit.set(6) : bit.reset(6);
+
+	m_pExpArea->nAppDefect = bit.to_ulong();
+
+	FillExpAreaGrid();
+
+	m_pIE2P->IU2P_DrawRefresh();
+}
+
+
+void CViewException::OnBnClickedBtnDelete()
+{
+	if(m_pGlassData == NULL || m_pIE2P == NULL || m_pGlassRecipe == NULL || m_pHardwareSetting == NULL)
+		return;
+
+	m_pIE2P->IE2P_SetExpAreaTrackerReset();
+
+	EXCEPTION_AREA_LIST *pList = m_pGlassRecipe->GetExpAreaList((DimensionDir)m_index);
+	if(pList == NULL)
+		return;
+
+	for(itEXCEPTION_AREA_LIST it = pList->begin(); it != pList->end() ; it++)
+	{
+		if(m_pExpArea == (*it))
+		{			
+			delete m_pExpArea;
+			pList->erase(it);
+			m_pExpArea = NULL;			
+			m_nSelectRow = -1;
+			break;
+		}
+	}
+
+	FillExpAreaGrid();	
+	SetControlData();
+	m_pIE2P->IU2P_DrawRefresh();
+
+	Invalidate(FALSE);
+}
+
+
+void CViewException::OnBnClickedBtnDeleteAll()
+{
+	if(m_pGlassData == NULL || m_pIE2P == NULL || m_pGlassRecipe == NULL || m_pHardwareSetting == NULL)
+		return;
+
+	m_pIE2P->IE2P_SetExpAreaTrackerReset();
+
+	itEXCEPTION_AREA_LIST it;
+	EXCEPTION_AREA_LIST *pList = m_pGlassRecipe->GetExpAreaList((DimensionDir)m_index);
+	if(pList == NULL)
+		return;		
+
+	if(!pList->empty())
+	{
+		for(it = pList->begin(); it != pList->end() ; it++)
+		{
+			delete (*it);
+		}
+	}	
+	pList->clear();
+	m_nSelectRow = -1;
+
+	FillExpAreaGrid();	
+	SetControlData();
+
+	m_pIE2P->IU2P_DrawRefresh();
+	Invalidate(FALSE);
+}
+
+
+void CViewException::OnGridDBClick(NMHDR *pNotifyStruct, LRESULT* pResult)
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
+	if (pItem->iRow < 0)
+		return;
+
+	m_nSelectRow = pItem->iRow;	
+
+	if(m_pGlassRecipe == NULL)
+		return;
+
+	EXCEPTION_AREA_LIST *pList = m_pGlassRecipe->GetExpAreaList((DimensionDir)m_index);
+	if(pList == NULL)
+		return;
+
+	if((int)pList->size() < m_nSelectRow)
+		return;
+
+	itEXCEPTION_AREA_LIST it = pList->begin();
+
+	std::advance(it, m_nSelectRow-1);	
+
+	m_pExpArea = *it;
+
+	if(m_pIE2P != NULL)
+		m_pIE2P->IE2P_SetExpArea(m_index);
+
+	SetControlData();
+	
+	UpdateData(FALSE);	
+}
+
+void CViewException::SetControlData()
+{
+	if(m_nSelectRow >= 1 && m_GrdExpList.GetRowCount() > 1)
+	{
+		m_dEditPX			= _ttof(m_GrdExpList.GetItemText(m_nSelectRow,1));
+		m_dEditPY			= _ttof(m_GrdExpList.GetItemText(m_nSelectRow,2));
+		m_dEditROIWidth		= _ttof(m_GrdExpList.GetItemText(m_nSelectRow,3));
+		m_dEditROIHeight	= _ttof(m_GrdExpList.GetItemText(m_nSelectRow,4));
+		m_nErrorDx			= _ttoi(m_GrdExpList.GetItemText(m_nSelectRow,5));
+		m_nErrorDy			= _ttoi(m_GrdExpList.GetItemText(m_nSelectRow,6));
+	}
+	else
+	{
+		m_dEditPX = 0;
+		m_dEditPY = 0;
+		m_dEditROIWidth = 0;
+		m_dEditROIHeight = 0; 
+		m_nErrorDx = 0;
+		m_nErrorDy = 0;
+	}
+
+	bitset<16> bit(0);
+	if(m_pExpArea != NULL)
+		bit = m_pExpArea->nAppDefect;	
+
+	((CButton*)GetDlgItem(IDC_CHK_TFT_CHIPPING))->SetCheck(bit[0]);
+	((CButton*)GetDlgItem(IDC_CHK_TFT_BUR))->SetCheck(bit[1]);
+	((CButton*)GetDlgItem(IDC_CHK_TFT_BROKEN))->SetCheck(bit[2]);
+	((CButton*)GetDlgItem(IDC_CHK_CRACK))->SetCheck(bit[3]);
+	((CButton*)GetDlgItem(IDC_CF_CHIPPING))->SetCheck(bit[4]);
+	((CButton*)GetDlgItem(IDC_CF_BUR))->SetCheck(bit[5]);
+	((CButton*)GetDlgItem(IDC_CHK_DETECT_LIMITED_AREA))->SetCheck(bit[6]);
+}
+
+void CViewException::GetResolution(double &dH,double &dV)
+{
+	if(m_pHardwareSetting == NULL)
+		return;
+
+	int			iCam = m_pHardwareSetting->GetCameraIndexToDimension((DimensionDir)m_index);
+	int			iScan = m_pHardwareSetting->GetScanToDimension((DimensionDir)m_index);
+	CCameraSettings	*pCamera = m_pHardwareSetting->GetCameraSettings(iCam,iScan);
+
+	if(pCamera == NULL)
+		return;
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	dV = pCamera->m_dScanResolution[nStageNo];
+	dH = pCamera->m_dConvResolution[nStageNo];
+
+	if(dV <= 0)
+		dV = 1;
+	if(dH <= 0)
+		dH = 1;	
+
+}
+
+void CViewException::SetAreaChange(EXECPTION_AREA *pExp)
+{
+	m_pExpArea = pExp;
+}
+
+void CViewException::SetAreaModify(EXECPTION_AREA *pExp)
+{
+	if(m_pExpArea == NULL)
+		return;
+
+	double		dResH,dResV;
+
+	GetResolution(dResH,dResV);
+		
+	CString		strTmp;
+
+	strTmp.Format(_T("%4.3f"),(m_pExpArea->rc.left * dResH)/1000);
+	GetDlgItem(IDC_EDIT_PX)->SetWindowText(strTmp);
+
+
+	strTmp.Format(_T("%4.3f"),(m_pExpArea->rc.top * dResV)/1000);
+	GetDlgItem(IDC_EDIT_PY)->SetWindowText(strTmp);
+
+
+	strTmp.Format(_T("%4.3f"),(m_pExpArea->rc.Width()  * dResH)/1000);
+	GetDlgItem(IDC_EDIT_ROI_W)->SetWindowText(strTmp);
+
+
+	strTmp.Format(_T("%4.3f"),(m_pExpArea->rc.Height()  *dResV)/1000);
+	GetDlgItem(IDC_EDIT_ROI_H)->SetWindowText(strTmp);	
+
+	FillExpAreaGrid();	
+}
+
+void CViewException::OnBnClickedBtnClose()
+{
+	if(m_pIE2P != NULL)
+	{
+		m_pIE2P->IE2P_SetExpAreaTrackerReset();
+		m_pIE2P->IE2P_SetExpAreaDlgClose();
+	}
+
+	if(m_pGlassRecipe != NULL)
+		m_pGlassRecipe->SaveExpAreaList();
+
+	OnOK();
+
+}
+
+void CViewException::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	
+}
diff --git a/ENRIT/View/ViewException.h b/ENRIT/View/ViewException.h
new file mode 100644
index 0000000..a1a1429
--- /dev/null
+++ b/ENRIT/View/ViewException.h
@@ -0,0 +1,79 @@
+#pragma once
+
+#include "ENRIT.h"
+#include "Global_Define.h"
+#include "General_Draw.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+// CViewException dialog
+
+class CViewException : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewException)
+
+public:
+	CViewException(CWnd* pParent = NULL);   // standard constructor
+	virtual ~CViewException();
+
+// Dialog Data
+	enum { IDD = IDD_DLG_EXCEPTION };
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnBnClickedBtnAdd();
+	afx_msg void OnBnClickedBtnModify();
+	afx_msg void OnBnClickedBtnDelete();
+	afx_msg void OnBnClickedBtnDeleteAll();		
+	afx_msg void OnBnClickedBtnClose();	
+	afx_msg void OnPaint();
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	afx_msg void OnGridDBClick(NMHDR *pNotifyStruct, LRESULT* pResult);
+
+public:	
+	void			SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe);	
+	void			SetIndex(int index);
+	void			SetIU2P(IUserDefectInterface2Parent *pIE2P){m_pIE2P=pIE2P;}
+	void			SetGlassData(CGlass_Data *pGlass){m_pGlassData=pGlass;}
+
+	void			Init_ExpAreaGrid();
+	void			Init_ExpAreaGridHeader();		
+	void			FillExpAreaGrid();	
+
+	EXECPTION_AREA	*GetExpArea(){return m_pExpArea;}
+
+	void			SetAreaChange(EXECPTION_AREA *pExp);
+	void			SetAreaModify(EXECPTION_AREA *pExp);
+
+protected:
+	void			SetControlData();
+	void			GetResolution(double &dH,double &dV);
+
+private:
+	int				m_nExceptionType;	
+	int				m_nCam;
+
+	CGridCtrl			m_GrdExpList;
+	CHardwareSettings	*m_pHardwareSetting;
+	CGlassRecipe	*m_pGlassRecipe;	
+	CGlass_Data			*m_pGlassData;
+	int					m_index;	
+	IUserDefectInterface2Parent	*m_pIE2P;
+	CFontControl		m_FontControl;
+
+	CPoint			m_ptOrg;
+	EXECPTION_AREA  *m_pExpArea;
+	int				m_nSelectRow;
+	CMFCButton		m_chk_AppDefect[7];	
+	CMFCButton		m_rdo_AreaType[3];		
+		
+	double			m_dEditPX;
+	double			m_dEditPY;
+	double			m_dEditROIWidth;
+	double			m_dEditROIHeight;
+	int				m_nErrorDx;
+	int				m_nErrorDy;	
+	
+};
diff --git a/ENRIT/View/ViewHWSetting.cpp b/ENRIT/View/ViewHWSetting.cpp
new file mode 100644
index 0000000..3152e45
--- /dev/null
+++ b/ENRIT/View/ViewHWSetting.cpp
@@ -0,0 +1,796 @@
+// ViewHWSetting.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewHWSetting.h"
+#include "afxdialogex.h"
+#include "Global_Define.h"
+
+// CViewHWSetting 措拳 惑磊涝聪促.
+
+const int LIGHT_COLUMN_COUNT = 4;
+const TCHAR* LIGHT_COLUMN_ITEM[LIGHT_COLUMN_COUNT] = {_T("ID"),_T("Type"),_T("Port&IP"),_T("Maker")};
+const int LIGHT_COLUMN_WIDHT[LIGHT_COLUMN_COUNT] = {70,104,104,104};
+
+const int CAMERA_COLUMN_COUNT = 19;
+const TCHAR* CAMERA_COLUMN_ITEM[CAMERA_COLUMN_COUNT] = {_T("Cam Idx"),_T("Scan"),_T("Cam Dir."),_T("Scan Size"),_T("Dimension"),_T("Margin(L)"),_T("Margin(R)"),_T("0 Hand Resolution(H)")
+                                   ,_T("0 Hand Resolution(V)"),_T("1 Hand Resolution(H)"),_T("1 Hand Resolution(V)"),_T("Frame(H)"),_T("Frame(V)"),_T("Grab Count"),_T("Light R"),_T("Light R Channel"),_T("Light T"),_T("Light T Channel")
+									,_T("Image Flip X")};
+const int CAMERA_COLUMN_WIDHT[CAMERA_COLUMN_COUNT] = {60,50,80,80,80,80,80,120
+                                                      ,120,120,120,80,80,100,80,140,70,140
+													  ,140};
+
+#define GRID_FIX_COLOR			RGB(144,200,246)
+#define GRID_COLOR				RGB(242,242,242)
+#define GRID_TEXT_COLOR			RGB(255,255,255)
+#define GRID_LINE_COLOR			GRID_FIX_COLOR
+
+IMPLEMENT_DYNAMIC(CViewHWSetting, CDialogEx)
+
+CViewHWSetting::CViewHWSetting(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewHWSetting::IDD, pParent)
+{
+	m_pDlgHDSettingParm = new CHardwareSettings;
+	m_pHDSetting = NULL;
+	m_pDlgLicenseInfo = NULL;
+}
+
+CViewHWSetting::~CViewHWSetting()
+{
+	delete m_pDlgHDSettingParm;
+	m_pDlgHDSettingParm = NULL;
+}
+
+void CViewHWSetting::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Control(pDX, IDC_LIGHT_LIST, m_LightGrid);
+	DDX_Control(pDX, IDC_CAMERA_LIST, m_CameraGrid);
+
+	CPLCSettings *pPLC = m_pDlgHDSettingParm->GetPLCSettings();
+	if(pPLC != NULL)
+	{			
+		DDX_Text(pDX, IDC_EDIT_PLC_DELAY, pPLC->m_nPLCLoopTime);
+	}
+	
+	DDX_Text(pDX, IDC_EDIT_LIGHT_TRANS_COUNT, m_pDlgHDSettingParm->m_nLightCount_Trans);	
+	DDX_Text(pDX, IDC_EDIT_LIGHT_REFLECT_COUNT, m_pDlgHDSettingParm->m_nLightCount_Reflect);
+	
+	DDX_Text(pDX, IDC_EDIT_CAMERA_COUNT, m_pDlgHDSettingParm->m_nCameraCount);	
+	DDX_Text(pDX, IDC_EDIT_SCAN_COUNT, m_pDlgHDSettingParm->m_nScanCount);			
+	DDX_Text(pDX, IDC_EDIT_LINE_ID, m_pDlgHDSettingParm->m_strLineID);			
+	DDX_Check(pDX,IDC_CHK_INS_REVERSE,m_pDlgHDSettingParm->m_bInsDirReverse);
+	DDX_Text(pDX, IDC_EDIT_PLC_SIGNAL_RETRY_COUNT, m_pDlgHDSettingParm->m_nPLCSignalRetry);		
+	
+
+	DDX_Text(pDX,IDC_EDIT_FOLDER_REMOVE_DAY,m_pDlgHDSettingParm->m_nFolderRemoveDay);
+	
+	DDX_Check(pDX,IDC_CHK_USECOLORVISUAL,m_pDlgHDSettingParm->m_bUseColorVisual);
+
+	DDX_Check(pDX,IDC_CHECK_USE_FREERUN_INSPECT,m_pDlgHDSettingParm->m_bUseFreerun);
+	DDX_Text(pDX,IDC_EDIT_FREERUN_PERIOD,m_pDlgHDSettingParm->m_nFreerunPeriod);
+	DDX_Text(pDX,IDC_EDIT_PREERUN_EXPOSURETIME,m_pDlgHDSettingParm->m_nFreerunExposureTime);
+
+	DDX_Check(pDX,IDC_CHECK_USE_TRIGGER_BOARD,m_pDlgHDSettingParm->m_bTriggerBoardUse);
+	DDX_Text(pDX,IDC_EDIT_TRIGGER_COM_PORT, m_pDlgHDSettingParm->m_nTriggerBoardComport);
+	DDX_Text(pDX,IDC_EDIT_FULL_IMAGE_RATIO, m_pDlgHDSettingParm->m_nFullImageCompressRatio);
+
+	CDialogEx::DoDataExchange(pDX);
+}
+
+BOOL CViewHWSetting::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+BEGIN_EVENTSINK_MAP(CViewHWSetting, CDialogEx)
+	ON_EVENT(CViewHWSetting, IDC_BTN_HW_SAVE, DISPID_CLICK, CViewHWSetting::ClickHWSaveButton, VTS_NONE)
+	ON_EVENT(CViewHWSetting, IDC_BUT_LIGHTCNT_APPLY, DISPID_CLICK, CViewHWSetting::OnClickLightApply, VTS_NONE)
+	ON_EVENT(CViewHWSetting, IDC_BUT_CAMCNT_APPLY, DISPID_CLICK, CViewHWSetting::OnBnClickedButCamcntApply, VTS_NONE)
+	ON_EVENT(CViewHWSetting, IDC_BTN_TRIGGER_CH_ON, DISPID_CLICK, CViewHWSetting::ClickBtnTriggerChOn, VTS_NONE)
+	ON_EVENT(CViewHWSetting, IDC_BTN_TRIGGER_CH_OFF, DISPID_CLICK, CViewHWSetting::ClickBtnTriggerChOff, VTS_NONE)
+	ON_EVENT(CViewHWSetting, IDC_BUT_LICENSE_INFO, DISPID_CLICK, CViewHWSetting::ClickButLicenseInfo, VTS_NONE)
+	ON_EVENT(CViewHWSetting, IDC_BUT_KEY_SET, DISPID_CLICK, CViewHWSetting::ClickButKeySet, VTS_NONE)
+END_EVENTSINK_MAP()
+
+BEGIN_MESSAGE_MAP(CViewHWSetting, CDialogEx)
+	
+	ON_BN_CLICKED(IDC_BUTTON_CAL_FREERUN, &CViewHWSetting::OnBnClickedButtonCalFreerun)
+END_MESSAGE_MAP()
+
+BOOL CViewHWSetting::OnInitDialog()
+{
+	((CComboBox*)(GetDlgItem(IDC_COMBO_BORAD_TYPE)))->AddString(L"GrabLink");
+	((CComboBox*)(GetDlgItem(IDC_COMBO_BORAD_TYPE)))->AddString(L"Radient");
+	((CComboBox*)(GetDlgItem(IDC_COMBO_BORAD_TYPE)))->AddString(L"Sapera");
+
+	UpdateControlValue(TRUE);
+	Init_LightGrid();
+	Init_CameraGrid();
+
+	m_pDlgLicenseInfo = new CDlgLicenseInfo;
+	m_pDlgLicenseInfo->Create(CDlgLicenseInfo::IDD,this);
+	m_pDlgLicenseInfo->ShowWindow(SW_HIDE);
+
+	return TRUE;
+}
+// CViewHWSetting 皋矫瘤 贸府扁涝聪促.
+
+
+void CViewHWSetting::Init_LightGrid()
+{
+	if(m_LightGrid.GetSafeHwnd() == NULL)
+		return;
+
+	m_LightGrid.GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
+	m_LightGrid.GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
+	m_LightGrid.GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
+	m_LightGrid.SetFixedBkColor(GRID_FIX_COLOR);
+	m_LightGrid.SetGridLines(GVL_BOTH);	
+	
+	m_LightGrid.SetColumnCount(LIGHT_COLUMN_COUNT);
+	m_LightGrid.SetRowCount(10);
+	m_LightGrid.SetFixedRowCount(1);
+	m_LightGrid.SetFixedColumnCount(0);
+	m_LightGrid.ExpandColumnsToFit();
+
+	CFont *pFont = m_LightGrid.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_LightGrid.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_LightGrid.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_LightGrid.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_LightGrid.SetEditable(TRUE);
+	m_LightGrid.EnableSelection(TRUE);
+
+	Init_LightGridHeader();
+}
+
+void CViewHWSetting::Init_LightGridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<LIGHT_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = LIGHT_COLUMN_ITEM[iLoop];
+		m_LightGrid.SetItem(&Item);	
+		//m_LightGrid.SetColumnWidth(Item.col,LIGHT_COLUMN_WIDHT[iLoop]);
+	}
+
+	m_LightGrid.Invalidate();
+}
+
+void CViewHWSetting::Init_CameraGrid()
+{
+	if(m_CameraGrid.GetSafeHwnd() == NULL)
+		return;
+
+	m_CameraGrid.GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
+	m_CameraGrid.GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
+	m_CameraGrid.GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
+	m_CameraGrid.SetFixedBkColor(GRID_FIX_COLOR);
+	m_CameraGrid.SetGridLines(GVL_BOTH);	
+	
+	m_CameraGrid.SetColumnCount(CAMERA_COLUMN_COUNT);
+	m_CameraGrid.SetRowCount(10);
+	m_CameraGrid.SetFixedRowCount(1);
+	m_CameraGrid.SetFixedColumnCount(0);
+	m_CameraGrid.ExpandColumnsToFit();
+
+	CFont *pFont = m_CameraGrid.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_CameraGrid.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_CameraGrid.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_CameraGrid.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_CameraGrid.SetEditable(TRUE);
+	m_CameraGrid.EnableSelection(TRUE);
+
+	Init_CameraGridHeader();
+}
+
+void CViewHWSetting::Init_CameraGridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<CAMERA_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = CAMERA_COLUMN_ITEM[iLoop];
+		m_CameraGrid.SetItem(&Item);	
+		m_CameraGrid.SetColumnWidth(Item.col,CAMERA_COLUMN_WIDHT[iLoop]);
+	}
+
+	m_CameraGrid.Invalidate();
+}
+
+void CViewHWSetting::FillLightGrid(BOOL bWrite)
+{
+	CHardwareLightSettings *pLight = m_pDlgHDSettingParm->GetLightSettings();
+	if(pLight == NULL)
+		return;
+
+	CString str;		
+	int		nCol = 0, nRow;
+	int		iLoop;
+	const   TCHAR* SET_LIGHT_TYPE[] = {_T("Transfer"),_T("Reflect")};
+	const   TCHAR* SET_LIGHT_MAKER[] = {_T("LCP"),_T("AKP"),_T("No")};
+	CGridCellCombo *pCell;
+	CStringArray optType,optMaker;	
+
+	for(iLoop=0;iLoop<2;iLoop++)
+		optType.Add(SET_LIGHT_TYPE[iLoop]);
+	for(iLoop=0;iLoop<3;iLoop++)
+		optMaker.Add(SET_LIGHT_MAKER[iLoop]);
+	
+	if(bWrite == TRUE)
+	{ 
+		m_LightGrid.SetRowCount(m_pDlgHDSettingParm->m_nLightCount_Trans+m_pDlgHDSettingParm->m_nLightCount_Reflect+1);
+		for(iLoop=0;iLoop<m_pDlgHDSettingParm->m_nLightCount_Trans+m_pDlgHDSettingParm->m_nLightCount_Reflect;iLoop++)
+		{		
+			nCol = 0;	
+			nRow = iLoop+1;
+			str.Format(_T("%d"),pLight[iLoop].m_nIndex);
+			m_LightGrid.SetItemText(nRow,nCol,str);
+			nCol++;
+			
+			if (!m_LightGrid.SetCellType(nRow,nCol, RUNTIME_CLASS(CGridCellCombo)))
+				continue;
+			switch(pLight[iLoop].m_emType)
+			{
+			case LIGHT_TYPE_TRANS: str.Format(_T("%s"),SET_LIGHT_TYPE[0]); break;
+			case LIGHT_TYPE_REF: str.Format(_T("%s"),SET_LIGHT_TYPE[1]); break;
+			default: str.Format(_T("%s"),_T("No")); break;
+			}			
+			m_LightGrid.SetItemText(nRow,nCol,str);			
+
+			pCell = (CGridCellCombo*) m_LightGrid.GetCell(nRow,nCol);
+			pCell->SetOptions(optType);	
+			pCell->SetStyle(CBS_DROPDOWN);
+			nCol++;
+			
+			str.Format(_T("%d"),pLight[iLoop].m_nPort);
+			m_LightGrid.SetItemText(nRow,nCol,str);
+			nCol++;
+			
+			if (!m_LightGrid.SetCellType(nRow,nCol, RUNTIME_CLASS(CGridCellCombo)))
+				continue;
+			switch(pLight[iLoop].m_emMaker)
+			{
+			case MAKER_LCP: str.Format(_T("%s"),SET_LIGHT_MAKER[0]); break;			
+			case MAKER_AKP: str.Format(_T("%s"),SET_LIGHT_MAKER[1]); break;		
+			default: str.Format(_T("%s"),_T("No")); break;
+			}						
+			m_LightGrid.SetItemText(nRow,nCol,str);
+
+			pCell = (CGridCellCombo*) m_LightGrid.GetCell(nRow,nCol);
+			pCell->SetOptions(optMaker);	
+			pCell->SetStyle(CBS_DROPDOWN);
+			nCol++;
+		}
+		m_LightGrid.Invalidate();		
+	}
+	else
+	{
+		for(iLoop=0;iLoop<m_pDlgHDSettingParm->m_nLightCount_Trans+m_pDlgHDSettingParm->m_nLightCount_Reflect;iLoop++)
+		{		
+			nCol = 0;	
+			nRow = iLoop+1;			
+			str = m_LightGrid.GetItemText(nRow,nCol);
+			pLight[iLoop].m_nIndex = _ttoi(str);
+			nCol++;
+
+			str = m_LightGrid.GetItemText(nRow,nCol);			
+			int			i;
+			for(i=0;i<optType.GetCount();i++)
+			{
+				if(str.CollateNoCase(optType.GetAt(i)) == 0)
+				{
+					pLight[iLoop].m_emType = (LIGHT_TYPE)i;
+					break;
+				}
+			}
+			nCol++;
+
+			str = m_LightGrid.GetItemText(nRow,nCol);
+			pLight[iLoop].m_nPort = _ttoi(str);			
+			nCol++;
+
+			str = m_LightGrid.GetItemText(nRow,nCol);	
+			for(i=0;i<optMaker.GetCount();i++)
+			{
+				if(str.CollateNoCase(optMaker.GetAt(i)) == 0)
+				{
+					pLight[iLoop].m_emMaker = (LIGHT_MAKER)i;
+					break;
+				}
+			}
+			nCol++;						
+		}
+	}
+}
+
+void CViewHWSetting::FillCameraGrid(BOOL bWrite)
+{
+	CCameraSettings *pCamera;
+	int			iCam,iScan,i;
+	int			iRow,iCol;
+	CString		str;		
+	const   TCHAR* SET_CAMERA_DIR[] = {_T("Top"),_T("Bottom")};
+	const   TCHAR* SET_INS_DIR[] = {_T("Long"),_T("Short")};	
+	const   TCHAR* SET_INS_DIMENSION[] = {_T("A Top"),_T("B Top"),_T("C Top"),_T("D Top"),_T("A Bot"),_T("B Bot"),_T("C Bot"),_T("D Bot")};	
+	CStringArray	arrDir,arrInsDir,arrDimension;
+	CGridCellCombo *pCell;		
+	
+	for(i=0;i<2;i++)
+	{
+		arrDir.Add(SET_CAMERA_DIR[i]);		
+		arrInsDir.Add(SET_INS_DIR[i]);		
+	}	
+	for(i=0;i<8;i++)
+	{
+		arrDimension.Add(SET_INS_DIMENSION[i]);				
+	}	
+	
+	if(bWrite == TRUE)
+	{
+		m_CameraGrid.SetRowCount(m_pDlgHDSettingParm->m_nCameraCount*m_pDlgHDSettingParm->m_nScanCount+1);				
+		iRow = 1;
+		
+		for(iCam=0;iCam<m_pDlgHDSettingParm->m_nCameraCount;iCam++)
+		{			
+			for(iScan=0;iScan<m_pDlgHDSettingParm->m_nScanCount;iScan++)
+			{
+				iCol = 0;
+				
+				pCamera = m_pDlgHDSettingParm->GetCameraSettings(iCam,iScan);
+				if(pCamera == NULL)
+					continue;
+				
+				str.Format(_T("%d"),pCamera->m_iCamera);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_iScan);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;				
+
+				if (!m_CameraGrid.SetCellType(iRow,iCol, RUNTIME_CLASS(CGridCellCombo)))
+					continue;
+				switch(pCamera->m_enCamDir)
+				{
+				case CAMDIR_TOP: str.Format(_T("%s"),SET_CAMERA_DIR[0]); break;
+				case CAMDIR_BOTTOM: str.Format(_T("%s"),SET_CAMERA_DIR[1]); break;				
+				default: str.Format(_T("%s"),_T("No")); break;
+				}			
+				m_CameraGrid.SetItemText(iRow,iCol,str);	
+
+				pCell = (CGridCellCombo*) m_CameraGrid.GetCell(iRow,iCol);
+				pCell->SetOptions(arrDir);	
+				pCell->SetStyle(CBS_DROPDOWN);
+				iCol++;
+
+				if (!m_CameraGrid.SetCellType(iRow,iCol, RUNTIME_CLASS(CGridCellCombo)))
+					continue;
+				switch(pCamera->m_eScanDir)
+				{
+				case SCANGLASS_X: str.Format(_T("%s"),SET_INS_DIR[0]); break;
+				case SCANGLASS_Y: str.Format(_T("%s"),SET_INS_DIR[1]); break;				
+				default: str.Format(_T("%s"),_T("No")); break;
+				}			
+				m_CameraGrid.SetItemText(iRow,iCol,str);	
+
+				pCell = (CGridCellCombo*) m_CameraGrid.GetCell(iRow,iCol);
+				pCell->SetOptions(arrInsDir);	
+				pCell->SetStyle(CBS_DROPDOWN);
+				iCol++;			
+
+				if (!m_CameraGrid.SetCellType(iRow,iCol, RUNTIME_CLASS(CGridCellCombo)))
+					continue;
+				switch(pCamera->m_eDimension)
+				{
+				case DIMENSION_A: str.Format(_T("%s"),SET_INS_DIMENSION[0]); break;
+				case DIMENSION_B: str.Format(_T("%s"),SET_INS_DIMENSION[1]); break;				
+				case DIMENSION_C: str.Format(_T("%s"),SET_INS_DIMENSION[2]); break;				
+				case DIMENSION_D: str.Format(_T("%s"),SET_INS_DIMENSION[3]); break;				
+				case DIMENSION_A_DN: str.Format(_T("%s"),SET_INS_DIMENSION[4]); break;				
+				case DIMENSION_B_DN: str.Format(_T("%s"),SET_INS_DIMENSION[5]); break;				
+				case DIMENSION_C_DN: str.Format(_T("%s"),SET_INS_DIMENSION[6]); break;				
+				case DIMENSION_D_DN: str.Format(_T("%s"),SET_INS_DIMENSION[7]); break;				
+				default: str.Format(_T("%s"),_T("No")); break;
+				}			
+				m_CameraGrid.SetItemText(iRow,iCol,str);	
+
+				pCell = (CGridCellCombo*) m_CameraGrid.GetCell(iRow,iCol);
+				pCell->SetOptions(arrDimension);	
+				pCell->SetStyle(CBS_DROPDOWN);
+				iCol++;		
+
+				str.Format(_T("%d"),pCamera->m_nMarginLeft);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_nMarginRight);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%.10f"),pCamera->m_dConvResolution[0]);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%.10f"),pCamera->m_dScanResolution[0]);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;	
+
+				str.Format(_T("%.10f"),pCamera->m_dConvResolution[1]);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%.10f"),pCamera->m_dScanResolution[1]);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;	
+
+				str.Format(_T("%d"),pCamera->m_FrameSize.cx);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_FrameSize.cy);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_nGrabFrameCount);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_nLightIdx_R);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_nLightIdx_R_Ch);
+				m_CameraGrid.SetItemText(iRow,iCol,str);
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_nLightIdx_T);
+				m_CameraGrid.SetItemText(iRow,iCol,str);				
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_nLightIdx_T_Ch);
+				m_CameraGrid.SetItemText(iRow,iCol,str);				
+				iCol++;
+
+				str.Format(_T("%d"),pCamera->m_nImgFlipx);
+				m_CameraGrid.SetItemText(iRow,iCol,str);		
+				iCol++;				
+
+				iRow++;
+			}		
+
+			m_CameraGrid.Invalidate();
+		}			
+	}
+	else
+	{
+		iRow = 1;
+		
+		for(iCam=0;iCam<m_pDlgHDSettingParm->m_nCameraCount;iCam++)
+		{			
+			for(iScan=0;iScan<m_pDlgHDSettingParm->m_nScanCount;iScan++)
+			{
+				iCol = 0;			
+
+				pCamera = m_pDlgHDSettingParm->GetCameraSettings(iCam,iScan);
+				if(pCamera == NULL)
+					continue;			
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_iCamera = _ttoi(str);
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_iScan = _ttoi(str);
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_enCamDir = CAMDIR_NONE;
+				for(i=0;i<CAMDIR_NONE;i++)
+				{
+					if(str.CollateNoCase(arrDir.GetAt(i)) == 0)
+					{
+						pCamera->m_enCamDir = (CAMERA_DIR)i;
+						break;
+					}
+				}
+				iCol++;				
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_eScanDir = SCANGLASS_NONE;
+				for(i=0;i<SCANGLASS_NONE;i++)
+				{
+					if(str.CollateNoCase(arrInsDir.GetAt(i)) == 0)
+					{
+						pCamera->m_eScanDir = (CAMERA_SCANDIR)i;
+						break;
+					}
+				}
+				iCol++;	
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_eDimension = DIMENSION_NONE;
+				for(i=0;i<DIMENSION_NONE;i++)
+				{
+					if(str.CollateNoCase(arrDimension.GetAt(i)) == 0)
+					{
+						pCamera->m_eDimension = (DimensionDir)i;
+						break;
+					}
+				}
+				iCol++;	
+				
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_nMarginLeft = _ttoi(str);
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_nMarginRight = _ttoi(str);
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_dConvResolution[0] = _ttof(str);
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_dScanResolution[0] = _ttof(str);
+				iCol++;		
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_dConvResolution[1] = _ttof(str);
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_dScanResolution[1] = _ttof(str);
+				iCol++;	
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_FrameSize.cx = _ttoi(str);
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_FrameSize.cy = _ttoi(str);
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_nGrabFrameCount = _ttoi(str);
+				iCol++;		
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_nLightIdx_R = _ttoi(str);
+				iCol++;		
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_nLightIdx_R_Ch = _ttoi(str);
+				iCol++;	
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_nLightIdx_T = _ttoi(str);				
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_nLightIdx_T_Ch = _ttoi(str);				
+				iCol++;
+
+				str = m_CameraGrid.GetItemText(iRow,iCol);
+				pCamera->m_nImgFlipx = _ttoi(str);				
+				iCol++;
+
+				iRow++;
+			}		
+		}
+	}
+}
+
+void CViewHWSetting::SetSettingParm(CHardwareSettings *pParm)
+{
+	m_pDlgHDSettingParm->Reset();
+	m_pHDSetting = NULL;
+	if(pParm != NULL)
+	{
+		m_pHDSetting = pParm;
+		*m_pDlgHDSettingParm = *pParm;
+	}
+
+	UpdateControlValue(TRUE);
+}
+
+void CViewHWSetting::UpdateControlValue(BOOL bWrite)
+{
+	if(bWrite == TRUE)
+	{
+		UpdateData(FALSE);
+		FillLightGrid(TRUE);
+		FillCameraGrid(TRUE);
+
+		((CComboBox*)(GetDlgItem(IDC_COMBO_BORAD_TYPE)))->SetCurSel((int)m_pDlgHDSettingParm->m_nBoardType);		
+	}
+	else
+	{
+		UpdateData(TRUE);
+		FillLightGrid(FALSE);
+		FillCameraGrid(FALSE);
+		if(m_pHDSetting != NULL)
+		{
+			m_pDlgHDSettingParm->m_nBoardType = (BOARD_TYPE)((CComboBox*)(GetDlgItem(IDC_COMBO_BORAD_TYPE)))->GetCurSel();
+
+			*m_pHDSetting = *m_pDlgHDSettingParm;
+		}
+	}
+}
+
+void CViewHWSetting::OnClickLightApply()
+{
+	UpdateData(TRUE);
+
+	m_pDlgHDSettingParm->SetLightCount(m_pDlgHDSettingParm->m_nLightCount_Trans,m_pDlgHDSettingParm->m_nLightCount_Reflect);
+	FillLightGrid(TRUE);
+}
+
+void CViewHWSetting::View_LicenseInfo()
+{
+	if(m_pDlgLicenseInfo == NULL)
+		return;
+
+	m_pDlgLicenseInfo->UpdateLicenseInfo();
+	m_pDlgLicenseInfo->ShowWindow(SW_SHOW);
+}
+
+void CViewHWSetting::OnBnClickedButCamcntApply()
+{
+	UpdateData(TRUE);
+
+	m_pDlgHDSettingParm->SetCameraCount(m_pDlgHDSettingParm->m_nCameraCount,m_pDlgHDSettingParm->m_nScanCount);
+	FillCameraGrid(TRUE);
+}
+
+void CViewHWSetting::SaveHardwareFile()
+{
+	CreateDirectory(_T("C:\\RCutProject"),NULL);
+	CreateDirectory(_T("C:\\RCutProject\\Config"),NULL);
+	
+	CString	str;
+
+	str.Format(_T("C:\\RCutProject\\Config\\Hardware.had")); //HARDWARE_SETTING_PATH
+
+	UpdateControlValue(FALSE);	
+	if(m_pHDSetting->WriteHardwareSettingsFile(str) == FALSE)
+	{
+		AfxMessageBox(_T("Save Fail!"));
+	}
+}
+
+void CViewHWSetting::ClickHWSaveButton()
+{
+	if(m_pHDSetting == NULL)
+		return;
+
+	if (IDYES == AfxMessageBox(_T("Do you want to save? \n Restarting is required to change settings."), MB_YESNO | MB_ICONQUESTION))
+	{
+		UpdateControlValue(FALSE);
+
+#if OFFLINE_KEY == 0
+		if(m_pHDSetting->WriteHardwareSettingsRegistry() == FALSE)
+		{
+			AfxMessageBox(_T("Save Fail!"));
+			return;
+		}
+#endif
+
+		SaveHardwareFile();		
+	}
+}
+
+
+void CViewHWSetting::OnBnClickedButtonCalFreerun()
+{
+	CString strFreerunMotorSpeed = _T("");
+	CString strFreerunTargetResolution = _T(""); 
+
+	GetDlgItemText(IDC_EDIT_FREERUN_MOTOR_SPEED, strFreerunMotorSpeed); 
+	GetDlgItemText(IDC_EDIT_FREERUN_TARGET_RESOLUTION, strFreerunTargetResolution);
+
+	double dFreerunMotorSpeed = _wtof(strFreerunMotorSpeed);
+	double dFreerunTargetResolution = _wtof(strFreerunTargetResolution);
+
+	dFreerunMotorSpeed = (dFreerunMotorSpeed * 1000.0) / 60.0;
+
+	double dLineRate = dFreerunMotorSpeed/dFreerunTargetResolution;
+
+	double dPulseSize = 1000000.0/dLineRate;
+
+	CString strPulseSize;
+	CString strExposureTime;
+
+	strPulseSize.Format(_T("%d"), (int) dPulseSize);
+	strExposureTime.Format(_T("%d"), (int) (dPulseSize/2.0));
+
+	SetDlgItemText(IDC_EDIT_FREERUN_PERIOD, strPulseSize);
+	SetDlgItemText(IDC_EDIT_PREERUN_EXPOSURETIME, strExposureTime);
+}
+
+
+void CViewHWSetting::ClickBtnTriggerChOn()
+{
+	if(m_pTriggerBoard == NULL)
+		return;
+
+	m_pTriggerBoard->SetSelectEncoder(1);	
+}
+
+
+void CViewHWSetting::ClickBtnTriggerChOff()
+{
+	if(m_pTriggerBoard == NULL)
+		return;
+
+	m_pTriggerBoard->SetSelectEncoder(0);
+}
+
+void CViewHWSetting::OnDestroy()
+{
+	CDialogEx::OnDestroy();
+
+	if(m_pDlgLicenseInfo != NULL)
+	{
+		m_pDlgLicenseInfo->DestroyWindow();
+		delete m_pDlgLicenseInfo;
+		m_pDlgLicenseInfo = NULL;
+	}
+}
+
+void CViewHWSetting::ClickButLicenseInfo()
+{
+	View_LicenseInfo();
+}
+
+
+void CViewHWSetting::ClickButKeySet()
+{
+	// TODO: 在此处添加消息处理程序代码
+	BlVision_GetSoftVisionApp()->OpenKeySetWindow();
+}
diff --git a/ENRIT/View/ViewHWSetting.h b/ENRIT/View/ViewHWSetting.h
new file mode 100644
index 0000000..17fc30b
--- /dev/null
+++ b/ENRIT/View/ViewHWSetting.h
@@ -0,0 +1,69 @@
+#pragma once
+
+#include "btnenh.h"
+#include "General_Draw.h"
+#include "LightManager.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "TriggerControl_Mvsol.h"
+#include "DlgLicenseInfo.h"
+// CViewHWSetting 措拳 惑磊涝聪促.
+
+class CHardwareSettings;
+class CViewHWSetting : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewHWSetting)
+
+public:
+	CViewHWSetting(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewHWSetting();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_HWSETTING_VIEW };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnPaint();	
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+	void				SetSettingParm(CHardwareSettings *pParm);
+	void				UpdateControlValue(BOOL bWrite);
+	void				SetTriggerBoard(CTriggerControl_Mvsol* pTriggerBoard)	{m_pTriggerBoard = pTriggerBoard;}
+
+protected:
+	void				Init_LightGrid();	
+	void				Init_LightGridHeader();
+	void				Init_CameraGrid();
+	void				Init_CameraGridHeader();	
+	void				FillLightGrid(BOOL bWrite);
+	void				FillCameraGrid(BOOL bWrite);	
+
+	void				ClickHWSaveButton();
+	void				SaveHardwareFile();
+	void				OnBnClickedButCamcntApply();
+	void				OnClickLightApply();
+
+public:
+	void				View_LicenseInfo();
+
+protected:
+	CGridCtrl			m_LightGrid;
+	CGridCtrl			m_CameraGrid;
+	CFontControl		m_pFontControl;
+	CHardwareSettings	*m_pHDSetting;
+	CHardwareSettings	*m_pDlgHDSettingParm;
+
+	CTriggerControl_Mvsol*	m_pTriggerBoard;
+	CDlgLicenseInfo*	m_pDlgLicenseInfo;
+public:
+	afx_msg void OnBnClickedButtonCalFreerun();
+	void ClickBtnTriggerChOn();
+	void ClickBtnTriggerChOff();
+	afx_msg void OnDestroy();
+	void ClickButLicenseInfo();
+	void ClickButKeySet();
+};
diff --git a/ENRIT/View/ViewHoleRecipeSetting.cpp b/ENRIT/View/ViewHoleRecipeSetting.cpp
new file mode 100644
index 0000000..1b6cf69
--- /dev/null
+++ b/ENRIT/View/ViewHoleRecipeSetting.cpp
@@ -0,0 +1,1076 @@
+// DlgHoleRecipeSetting.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewHoleRecipeSetting.h"
+#include "afxdialogex.h"
+#include "Global_Define.h"
+
+const int HOLE_INSPECT_COLUMN_COUNT								= 11;
+const char* HOLE_INSPECT_COLUMN_ITEM[HOLE_INSPECT_COLUMN_COUNT] = {"Idx", "Side", "Pos L/T", "Pos R/B", "Circle L/T", "Circle R/B", "Threshold", "Offset", "MinSize", "Rate(%)", "Image Path"};
+const int HOLE_INSPECT_COLUMN_WIDHT[HOLE_INSPECT_COLUMN_COUNT]	= {30, 50, 60, 60, 60, 60, 60, 50, 50, 50, 100};
+
+#define GRID_FIX_COLOR			RGB(144,200,246)
+#define GRID_COLOR				RGB(242,242,242)
+#define GRID_TEXT_COLOR			RGB(255,255,255)
+#define GRID_LINE_COLOR			GRID_FIX_COLOR
+
+// CViewHoleRecipeSetting 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewHoleRecipeSetting, CDialog)
+
+CViewHoleRecipeSetting::CViewHoleRecipeSetting(CWnd* pParent /*=NULL*/)
+	: CDialog(CViewHoleRecipeSetting::IDD, pParent)
+{
+	m_pInterface = NULL;
+	m_pDlgRecipe = NULL;
+
+	m_vecSide.clear();
+	m_vecSide.push_back(_T("A Top"));
+	m_vecSide.push_back(_T("B Top"));
+	m_vecSide.push_back(_T("C Top"));
+	m_vecSide.push_back(_T("D Top"));
+	m_vecSide.push_back(_T("A Bot"));
+	m_vecSide.push_back(_T("B Bot"));
+	m_vecSide.push_back(_T("C Bot"));
+	m_vecSide.push_back(_T("D Bot"));
+
+	CreateDirectory(RECIPE_HOLE_TEMPLATE_PATH, NULL);
+}
+
+CViewHoleRecipeSetting::~CViewHoleRecipeSetting()
+{
+	m_vecSide.clear();
+}
+
+void CViewHoleRecipeSetting::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Control(pDX, IDC_HOLE_SETTING_LIST, m_HoleList);
+
+	CDialog::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewHoleRecipeSetting, CDialog)
+	ON_NOTIFY(GVN_ENDLABELEDIT, IDC_HOLE_SETTING_LIST, OnHoleListEditEnd)
+	ON_NOTIFY(NM_CLICK, IDC_HOLE_SETTING_LIST, &CViewHoleRecipeSetting::OnHoleListClick)
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewHoleRecipeSetting, CDialog)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_INSPECT_PROCESS, DISPID_CLICK, CViewHoleRecipeSetting::ClickHoleInspectProcess, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_VIEW_MODE, DISPID_CLICK, CViewHoleRecipeSetting::ClickViewMode, VTS_NONE)	
+
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_ROI_UP, DISPID_CLICK, CViewHoleRecipeSetting::ClickROIUp, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_ROI_LEFT, DISPID_CLICK, CViewHoleRecipeSetting::ClickROILeft, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_ROI_RIGHT, DISPID_CLICK, CViewHoleRecipeSetting::ClickROIRight, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_ROI_DN, DISPID_CLICK, CViewHoleRecipeSetting::ClickROIDown, VTS_NONE)
+
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_ROI_WIDTH_PLUS, DISPID_CLICK, CViewHoleRecipeSetting::ClickROIWidthUp, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_ROI_WIDTH_MINUS, DISPID_CLICK, CViewHoleRecipeSetting::ClickROIWidthDown, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_ROI_HEIGHT_PLUS, DISPID_CLICK, CViewHoleRecipeSetting::ClickROIHeightUp, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_ROI_HEIGHT_MINUS, DISPID_CLICK, CViewHoleRecipeSetting::ClickROIHeightDown, VTS_NONE)
+
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_CIRCLE_UP, DISPID_CLICK, CViewHoleRecipeSetting::ClickCircleUp, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_CIRCLE_LEFT, DISPID_CLICK, CViewHoleRecipeSetting::ClickCircleLeft, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_CIRCLE_RIGHT, DISPID_CLICK, CViewHoleRecipeSetting::ClickCircleRight, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_CIRCLE_DN, DISPID_CLICK, CViewHoleRecipeSetting::ClickCircleDown, VTS_NONE)
+
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_CIRCLE_WIDTH_PLUS, DISPID_CLICK, CViewHoleRecipeSetting::ClickCircleWidthUp, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_CIRCLE_WIDTH_MINUS, DISPID_CLICK, CViewHoleRecipeSetting::ClickCircleWidthDown, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_CIRCLE_HEIGHT_PLUS, DISPID_CLICK, CViewHoleRecipeSetting::ClickCircleHeightUp, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_BTN_CIRCLE_HEIGHT_MINUS, DISPID_CLICK, CViewHoleRecipeSetting::ClickCircleHeightDown, VTS_NONE)
+
+	ON_EVENT(CViewHoleRecipeSetting, IDC_UPDATE, DISPID_CLICK, CViewHoleRecipeSetting::ClickUpdate, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_ADD_AREA, DISPID_CLICK, CViewHoleRecipeSetting::ClickAdd, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_DEL_AREA, DISPID_CLICK, CViewHoleRecipeSetting::ClickDelete, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_SAVE, DISPID_CLICK, CViewHoleRecipeSetting::ClickSave, VTS_NONE)
+	ON_EVENT(CViewHoleRecipeSetting, IDC_EXIT, DISPID_CLICK, CViewHoleRecipeSetting::ClickExit, VTS_NONE)
+END_EVENTSINK_MAP()
+
+
+// CViewHoleRecipeSetting 皋矫瘤 贸府扁涝聪促.
+
+BOOL CViewHoleRecipeSetting::OnInitDialog()
+{
+	CDialog::OnInitDialog();
+
+	// TODO:  咯扁俊 眠啊 檬扁拳 累诀阑 眠啊钦聪促.
+	InitHoleList();
+
+	CRect rect;
+	GetDlgItem(IDC_STATIC_TEMPLATE_DISPLAY)->GetWindowRect(rect);
+	ScreenToClient(rect);
+	m_ImageView.Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WM_NOTIFY , rect, this, 0);
+	m_ImageView.ShowWindow(SW_SHOW);
+
+
+	CString strControlStep = _T("20");
+	SetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	UpdateData(TRUE);
+
+	return TRUE;
+}
+
+BOOL CViewHoleRecipeSetting::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+void CViewHoleRecipeSetting::SaveTempleteImage(int nIdx)
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(m_DisplayOrigin.GetImageExist() == FALSE)
+		return;
+
+	CString strRecipeName = m_pDlgRecipe->GetRecipeName();
+
+	strRecipeName = (strRecipeName.GetLength() == 0) ? _T("Test_Recipe") : strRecipeName; 
+
+	CString strDirPath;
+	strDirPath.Format(_T("%s\\%s"), RECIPE_HOLE_TEMPLATE_PATH, strRecipeName);
+	CreateDirectory(strDirPath, NULL);
+
+	CString strFilePath;
+
+	CTime currentTime = CTime::GetCurrentTime();
+	
+	strFilePath.Format(_T("%s\\%04d%02d%02d_%02d%02d%02d.bmp"), strDirPath
+		, currentTime.GetYear()
+		, currentTime.GetMonth()
+		, currentTime.GetDay()
+		, currentTime.GetHour()
+		, currentTime.GetMinute()
+		, currentTime.GetSecond());
+
+
+	m_DisplayOrigin.SaveImage(strFilePath, 100);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_strTemplatePath = strFilePath;
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickHoleInspectProcess()
+{
+	if(m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	IplImage* pViewImage = NULL;
+
+	m_pInterface->IHoleRecipe2RecipeVIew_HoleInspectProcess(nIdx, &pViewImage);
+
+	if(pViewImage != NULL)
+	{
+		m_ImageView.CopyImageFrom(pViewImage);
+		m_ImageView.Invalidate();
+
+		cvReleaseImage(&pViewImage);
+	}	
+}
+
+void CViewHoleRecipeSetting::ClickViewMode()
+{
+	if(m_ImageView.GetViewType() == ViewScale_Origin)	m_ImageView.SetViewType(ViewScale_Fit);
+	else												m_ImageView.SetViewType(ViewScale_Origin);
+
+	m_ImageView.Invalidate();
+}
+
+void CViewHoleRecipeSetting::ClickROIUp()
+{
+	if(m_pDlgRecipe == NULL || m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.OffsetRect(0, nStep * -1);
+
+	if(m_pInterface != NULL)
+		m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickROILeft()
+{
+	if(m_pDlgRecipe == NULL || m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.OffsetRect(nStep * -1, 0);
+
+	if(m_pInterface != NULL)
+		m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickROIRight()
+{
+	if(m_pDlgRecipe == NULL || m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.OffsetRect(nStep, 0);
+
+	if(m_pInterface != NULL)
+		m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickROIDown()
+{
+	if(m_pDlgRecipe == NULL || m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.OffsetRect(0, nStep);
+
+	if(m_pInterface != NULL)
+		m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickROIWidthUp()
+{
+	if(m_pDlgRecipe == NULL || m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.right += nStep;
+
+	if(m_pInterface != NULL)
+		m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickROIWidthDown()
+{
+	if(m_pDlgRecipe == NULL || m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.left < pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.right - nStep)
+		pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.right -= nStep;
+
+	if(m_pInterface != NULL)
+		m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickROIHeightUp()
+{
+	if(m_pDlgRecipe == NULL || m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.bottom += nStep;
+
+	if(m_pInterface != NULL)
+		m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickROIHeightDown()
+{
+	if(m_pDlgRecipe == NULL || m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_nSideIdx !=  m_pInterface->IHoleRecipe2RecipeView_GetCurrentSetSide())
+	{
+		AfxMessageBox(_T("Please, Check Recipe Set Side.."));
+		return;
+	}
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.top < pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.bottom - nStep)
+		pHoleParm->m_vecHoleInsParam[nIdx].m_rtArea.bottom -= nStep;
+
+	if(m_pInterface != NULL)
+		m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickCircleUp()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.OffsetRect(0, nStep * -1);
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickCircleLeft()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.OffsetRect(nStep * -1, 0);
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickCircleRight()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.OffsetRect(nStep, 0);
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickCircleDown()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.OffsetRect(0, nStep);
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickCircleWidthUp()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.right += nStep;
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickCircleWidthDown()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.left < pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.right - nStep)
+		pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.right -= nStep;
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickCircleHeightUp()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.bottom += nStep;
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickCircleHeightDown()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateData(FALSE);
+
+	CString strControlStep = _T("1");
+	GetDlgItemText(IDC_EDIT_CONTROL_STEP, strControlStep);
+
+	int nStep = _wtoi(strControlStep);
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.top < pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.bottom - nStep)
+		pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.bottom -= nStep;
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickUpdate()
+{
+	if(m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0 || pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_strTemplatePath.GetLength() != 0)
+	{
+		if(IDYES != AfxMessageBox(_T("There is an registered image, Change Image?"), MB_YESNO | MB_ICONQUESTION))
+			return;
+
+		DeleteFile(pHoleParm->m_vecHoleInsParam[nIdx].m_strTemplatePath);
+	}
+
+	IplImage* pImageBuffer = NULL;
+
+	if(m_pInterface->IHoleRecipe2RecipeView_GetHoleAreaImage(nIdx, &pImageBuffer) == FALSE)
+		return;
+
+ 	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.left=0;
+ 	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.top=0;
+ 	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.right=pImageBuffer->width;
+ 	pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea.bottom=pImageBuffer->height;
+
+	m_DisplayOrigin.CopyImageFrom(pImageBuffer);
+
+	// Regist TemplateImage
+	SaveTempleteImage(nIdx);
+
+	cvReleaseImage(&pImageBuffer);
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::ClickAdd()
+{
+	if(m_pInterface == NULL)
+		return;
+
+	int		nSideIdx;
+	CRect	rtArea;
+
+	BOOL bRet = m_pInterface->IHoleRecipe2RecipeView_AddHoleArea(nSideIdx, rtArea);
+
+	if(bRet == FALSE)
+		return;
+
+	HOLE_INS_PARM newHoleParm;
+	newHoleParm.m_nSideIdx = nSideIdx;
+	newHoleParm.m_rtArea = newHoleParm.m_rtHoleArea = rtArea;
+	newHoleParm.m_nThreshold = 30;
+	newHoleParm.m_nOffset = 5;
+	newHoleParm.m_nMinSize = 3;
+	newHoleParm.m_dMatRate = 85.0;
+	newHoleParm.m_strTemplatePath = _T("");
+
+	m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam.push_back(newHoleParm);
+	m_pDlgRecipe->m_HoleInspectParm.m_nTotalHoleCount = (int)m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam.size();
+
+	UpdateRecipeToHoleList();
+
+	m_pInterface->IHoleRecipe2RecipeView_UpdateFrameView();
+
+	m_HoleList.SetFocusCell((int) m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam.size(), 0);
+}
+
+void CViewHoleRecipeSetting::ClickDelete()
+{
+	if(m_pInterface == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0 || pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	CString strTemp;
+	strTemp.Format(_T("Delete Hole Inspect Area [%d]?"), nIdx+1);
+
+	if(IDYES != AfxMessageBox(strTemp, MB_YESNO | MB_ICONQUESTION))
+		return;
+
+	if(pHoleParm->m_vecHoleInsParam[nIdx].m_strTemplatePath.GetLength() != 0)
+		DeleteFile(pHoleParm->m_vecHoleInsParam[nIdx].m_strTemplatePath);
+
+	vector<HOLE_INS_PARM> newVector;
+
+	for(int i=0; i<(int) pHoleParm->m_vecHoleInsParam.size(); i++)
+	{
+		if(i == nIdx)
+			continue;
+
+		newVector.push_back(pHoleParm->m_vecHoleInsParam[i]);
+	}
+
+	pHoleParm->m_vecHoleInsParam.clear();
+	pHoleParm->m_vecHoleInsParam = newVector;
+
+	pHoleParm->m_nTotalHoleCount = (int) pHoleParm->m_vecHoleInsParam.size();
+
+	newVector.clear();
+
+	UpdateRecipeToHoleList();
+}
+
+void CViewHoleRecipeSetting::ClickSave()
+{
+	UpdateHoleListToRecipe();
+
+ 	if(m_pInterface != NULL)
+ 		m_pInterface->IHoleRecipe2RecipeView_SaveRecipe();
+}
+
+void CViewHoleRecipeSetting::ClickExit()
+{
+	ShowWindow(SW_HIDE);
+}
+
+void CViewHoleRecipeSetting::SetInterface(IHoleRecipeView2Parent* pInterface)
+{
+	m_pInterface = pInterface;
+}
+
+void CViewHoleRecipeSetting::SetRecipe(CGlassRecipe* pRecipe)
+{
+	if(pRecipe == NULL)
+		return;
+	
+	m_pDlgRecipe = pRecipe;
+
+	UpdateRecipeToHoleList();
+	UpdateHoleImage(-1);
+}
+
+void CViewHoleRecipeSetting::InitHoleList()
+{
+	if(m_HoleList.GetSafeHwnd() == NULL)
+		return;
+
+	m_HoleList.GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
+	m_HoleList.GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
+	m_HoleList.GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
+	m_HoleList.SetFixedBkColor(GRID_FIX_COLOR);
+	m_HoleList.SetGridLines(GVL_BOTH);	
+
+	m_HoleList.SetColumnCount(HOLE_INSPECT_COLUMN_COUNT);
+	m_HoleList.SetRowCount(1);
+	m_HoleList.SetFixedRowCount(1);
+	m_HoleList.SetFixedColumnCount(0);
+	m_HoleList.ExpandColumnsToFit();
+	m_HoleList.SetSingleRowSelection(TRUE);
+	m_HoleList.SetSingleColSelection(TRUE);
+
+	CFont *pFont = m_HoleList.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_HoleList.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_HoleList.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_HoleList.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_HoleList.SetEditable(TRUE);
+	m_HoleList.EnableSelection(TRUE);
+
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<HOLE_INSPECT_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = HOLE_INSPECT_COLUMN_ITEM[iLoop];
+		m_HoleList.SetItem(&Item);	
+		m_HoleList.SetColumnWidth(Item.col,HOLE_INSPECT_COLUMN_WIDHT[iLoop]);
+	}
+
+	m_HoleList.Invalidate();
+}
+
+void CViewHoleRecipeSetting::UpdateRecipeToHoleList()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	m_HoleList.SetRowCount(pHoleParm->m_nTotalHoleCount + 1);
+
+	CString strTemp;
+	
+	int nColIdx, nRowIdx;
+
+	for(int i=0; i<pHoleParm->m_nTotalHoleCount; i++)
+	{
+		if(pHoleParm->m_vecHoleInsParam.size() <= i)
+			continue;
+
+		nColIdx = 0;
+		nRowIdx = i + 1;
+
+		// 0. Index
+		strTemp.Format(_T("%d"), nRowIdx);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 1. Side
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, m_vecSide[pHoleParm->m_vecHoleInsParam[i].m_nSideIdx]);
+
+		// 2. ROI L/T
+		strTemp.Format(_T("%d, %d"), (int) pHoleParm->m_vecHoleInsParam[i].m_rtArea.left, (int) pHoleParm->m_vecHoleInsParam[i].m_rtArea.top);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 3. ROI R/B
+		strTemp.Format(_T("%d, %d"), (int) pHoleParm->m_vecHoleInsParam[i].m_rtArea.right, (int) pHoleParm->m_vecHoleInsParam[i].m_rtArea.bottom);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 4. Circle L/T
+		strTemp.Format(_T("%d, %d"), (int) pHoleParm->m_vecHoleInsParam[i].m_rtHoleArea.left, (int) pHoleParm->m_vecHoleInsParam[i].m_rtHoleArea.top);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 5. Circle R/B
+		strTemp.Format(_T("%d, %d"), (int) pHoleParm->m_vecHoleInsParam[i].m_rtHoleArea.right, (int) pHoleParm->m_vecHoleInsParam[i].m_rtHoleArea.bottom);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 6.  Threshold
+		strTemp.Format(_T("%d"), (int) pHoleParm->m_vecHoleInsParam[i].m_nThreshold);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 7.  Offset
+		strTemp.Format(_T("%d"), (int) pHoleParm->m_vecHoleInsParam[i].m_nOffset);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 8.  MinSize
+		strTemp.Format(_T("%d"), (int) pHoleParm->m_vecHoleInsParam[i].m_nMinSize);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 9.  MatRate
+		strTemp.Format(_T("%.2f"), pHoleParm->m_vecHoleInsParam[i].m_dMatRate);
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, strTemp);
+
+		// 10.  Image Path
+		m_HoleList.SetItemText(nRowIdx, nColIdx++, pHoleParm->m_vecHoleInsParam[i].m_strTemplatePath);
+	}
+
+	m_HoleList.Invalidate();
+}
+
+void CViewHoleRecipeSetting::UpdateHoleListToRecipe()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	int nRowCount = m_HoleList.GetRowCount() - 1;
+
+	int nColIdx = 0;
+	CString strTemp;
+
+	int nHoleIdx = 0;
+	for(int i=0; i<nRowCount; i++)
+	{
+		if(pHoleParm->m_vecHoleInsParam.size() <= i)
+			continue;
+
+		nColIdx = 6;
+
+		// 6. Threshold
+		strTemp = m_HoleList.GetItemText(i+1, nColIdx++);
+		pHoleParm->m_vecHoleInsParam[nHoleIdx].m_nThreshold = _wtoi(strTemp);
+
+		// 7. Offset
+		strTemp = m_HoleList.GetItemText(i+1, nColIdx++);
+		pHoleParm->m_vecHoleInsParam[nHoleIdx].m_nOffset = _wtoi(strTemp);
+
+		// 8. MinSize
+		strTemp = m_HoleList.GetItemText(i+1, nColIdx++);
+		pHoleParm->m_vecHoleInsParam[nHoleIdx].m_nMinSize = _wtoi(strTemp);
+
+		// 9. MatRate
+		strTemp = m_HoleList.GetItemText(i+1, nColIdx++);
+		pHoleParm->m_vecHoleInsParam[nHoleIdx].m_dMatRate = _wtof(strTemp);
+
+		nHoleIdx++;
+	}
+
+	pHoleParm->m_nTotalHoleCount = (int) pHoleParm->m_vecHoleInsParam.size();
+}
+
+void CViewHoleRecipeSetting::UpdateHoleImage(int nIdx)
+{
+	if(nIdx == -1)
+	{
+		m_ImageView.ClearImage(0);
+		m_ImageView.Invalidate();
+		return;
+	}
+
+	if(m_pInterface == NULL)
+		return;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	if(m_DisplayOrigin.GetImageExist() == FALSE)
+		return;
+
+	IplImage* pViewImage = cvCreateImage(cvSize(m_DisplayOrigin.GetWidth(), m_DisplayOrigin.GetHeight()), 8, 3);
+
+	cvCvtColor(m_DisplayOrigin.GetIplImage(), pViewImage, CV_GRAY2BGR);
+
+	CRect* pRtHole = &pHoleParm->m_vecHoleInsParam[nIdx].m_rtHoleArea;
+	int nOffset = pHoleParm->m_vecHoleInsParam[nIdx].m_nOffset;
+
+	cvEllipse(pViewImage, cvPoint(pRtHole->CenterPoint().x, pRtHole->CenterPoint().y), cvSize(pRtHole->Width()/2, pRtHole->Height()/2), 0.0, 0.0, 360.0, cvScalar(255,255,0), 1);
+	cvEllipse(pViewImage, cvPoint(pRtHole->CenterPoint().x, pRtHole->CenterPoint().y), cvSize((pRtHole->Width()/2)-nOffset, (pRtHole->Height()/2)-nOffset), 0, 0.0, 360.0, cvScalar(0,255,255), 1);
+
+	m_ImageView.CopyImageFrom(pViewImage);
+
+	cvReleaseImage(&pViewImage);
+
+	m_ImageView.Invalidate();
+}
+
+void CViewHoleRecipeSetting::OnHoleListEditEnd(NMHDR *pNotifyStruct, LRESULT* pResult)
+{
+	UpdateHoleListToRecipe();
+
+	UpdateRecipeToHoleList();
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+	int nIdx = FocusedID.row-1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	UpdateHoleImage(nIdx);
+}
+
+void CViewHoleRecipeSetting::OnHoleListClick(NMHDR *pNotifyStruct, LRESULT* pResult)
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CCellID FocusedID = m_HoleList.GetFocusCell();
+
+	int nIdx = FocusedID.row - 1;
+
+	CHOLEINSPECT_PARM* pHoleParm = &m_pDlgRecipe->m_HoleInspectParm;
+
+	if(nIdx < 0|| pHoleParm->m_vecHoleInsParam.size() <= nIdx)
+		return;
+
+	m_DisplayOrigin.LoadImage(pHoleParm->m_vecHoleInsParam[nIdx].m_strTemplatePath);
+
+	UpdateHoleImage(nIdx);
+}
diff --git a/ENRIT/View/ViewHoleRecipeSetting.h b/ENRIT/View/ViewHoleRecipeSetting.h
new file mode 100644
index 0000000..870b68a
--- /dev/null
+++ b/ENRIT/View/ViewHoleRecipeSetting.h
@@ -0,0 +1,93 @@
+#pragma once
+
+#include "GlassRecipe.h"
+
+// CViewHoleRecipeSetting 措拳 惑磊涝聪促.
+
+interface IHoleRecipeView2Parent
+{
+public:
+	virtual BOOL			IHoleRecipe2RecipeView_AddHoleArea(int& nSideIdx, CRect& rtArea) = 0;
+	virtual BOOL			IHoleRecipe2RecipeView_GetHoleAreaImage(int nHoleIdx, IplImage** pImageBuffer) = 0;
+	virtual void			IHoleRecipe2RecipeView_UpdateFrameView() = 0;
+	virtual void			IHoleRecipe2RecipeView_SaveRecipe() = 0;
+	virtual BOOL			IHoleRecipe2RecipeVIew_HoleInspectProcess(int nHoleIdx, IplImage** pImageBuffer)=0;
+	virtual int				IHoleRecipe2RecipeView_GetCurrentSetSide()=0;
+};
+
+class CViewHoleRecipeSetting : public CDialog
+{
+	DECLARE_DYNAMIC(CViewHoleRecipeSetting)
+
+public:
+	CViewHoleRecipeSetting(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewHoleRecipeSetting();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_RECIPE_HOLE };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+private:
+	IHoleRecipeView2Parent*		m_pInterface;
+
+	CGlassRecipe*			m_pDlgRecipe;
+	CGridCtrl					m_HoleList;
+
+	CImageBuffer				m_DisplayOrigin;
+	CImageViewer				m_ImageView;
+
+	vector<CString>				m_vecSide;
+
+public:
+	void SetInterface(IHoleRecipeView2Parent* pInterface);
+	void SetRecipe(CGlassRecipe* pRecipe);
+
+	void InitHoleList();
+	void UpdateRecipeToHoleList();
+	void UpdateHoleListToRecipe();
+
+	void UpdateHoleImage(int nIdx);
+
+public:
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+	void SaveTempleteImage(int nIdx);
+
+	void ClickHoleInspectProcess();
+	void ClickViewMode();
+
+	void ClickROIUp();
+	void ClickROILeft();
+	void ClickROIRight();
+	void ClickROIDown();
+
+	void ClickROIWidthUp();
+	void ClickROIWidthDown();
+	void ClickROIHeightUp();
+	void ClickROIHeightDown();
+
+	void ClickCircleUp();
+	void ClickCircleLeft();
+	void ClickCircleRight();
+	void ClickCircleDown();
+
+	void ClickCircleWidthUp();
+	void ClickCircleWidthDown();
+	void ClickCircleHeightUp();
+	void ClickCircleHeightDown();
+
+	void ClickUpdate();
+	void ClickAdd();
+	void ClickDelete();
+	void ClickSave();
+	void ClickExit();
+
+	afx_msg void OnHoleListEditEnd(NMHDR *pNotifyStruct, LRESULT* pResult);
+	afx_msg void OnHoleListClick(NMHDR *pNotifyStruct, LRESULT* pResult);
+};
diff --git a/ENRIT/View/ViewInsInformation.cpp b/ENRIT/View/ViewInsInformation.cpp
new file mode 100644
index 0000000..f10495d
--- /dev/null
+++ b/ENRIT/View/ViewInsInformation.cpp
@@ -0,0 +1,886 @@
+// ViewInsInformation.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ViewInsInformation.h"
+#include "afxdialogex.h"
+#include "Transfer_Data.h"
+#include <math.h>
+
+
+#include <gdiplus.h>
+using namespace Gdiplus;
+
+#define GRID_FIX_COLOR			RGB(144,200,246)
+#define GRID_COLOR				RGB(242,242,242)
+#define GRID_TEXT_COLOR			RGB(255,255,255)
+#define GRID_LINE_COLOR			GRID_FIX_COLOR
+
+// CViewInsInformation 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewInsInformation, CDialogEx)
+
+CViewInsInformation::CViewInsInformation(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewInsInformation::IDD, pParent)
+{	
+	m_pV2M = NULL;
+	m_pGlassRecipe = NULL;
+	m_pHardwareSetting = NULL;
+	m_bInitView = TRUE;
+	m_pGlassData = NULL;
+	m_pTransData = NULL;
+
+	DWORD bufsize = sizeof(BITMAPINFOHEADER)+ 256*sizeof(RGBQUAD);
+	m_pBMI = (BITMAPINFO *)new BYTE[bufsize];
+	// Set Bitmap information
+	m_pBMI->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
+	m_pBMI->bmiHeader.biPlanes=1; 
+	m_pBMI->bmiHeader.biBitCount=8; 
+	m_pBMI->bmiHeader.biCompression=0;   //BI_RGB; 
+	m_pBMI->bmiHeader.biXPelsPerMeter=0; 
+	m_pBMI->bmiHeader.biYPelsPerMeter=0; 
+	m_pBMI->bmiHeader.biClrUsed=256; 
+	m_pBMI->bmiHeader.biClrImportant=0; 
+
+	// Set Palette
+	int		i;
+	for(i=0 ; i< 256 ; i++) {
+		m_pBMI->bmiColors[i].rgbRed = (BYTE)i;
+		m_pBMI->bmiColors[i].rgbGreen = (BYTE)i;
+		m_pBMI->bmiColors[i].rgbBlue = (BYTE)i;
+		m_pBMI->bmiColors[i].rgbReserved = 0;
+	}
+	
+	for(i=0;i<4;i++)
+	{
+		m_pSplineImg[i] = NULL;
+		m_szSplineImg[i] = CSize(0,0);		
+	}
+
+	m_pNotchImg = NULL;
+	m_szNotchImg = CSize(0,0);		
+	m_HistoryData.Reset();
+}
+
+CViewInsInformation::~CViewInsInformation()
+{	
+	if(m_pBMI)
+	{
+		delete[] m_pBMI,m_pBMI = NULL;
+	}
+
+	for(int i=0;i<4;i++)
+	{
+		if(m_pSplineImg[i] != NULL)
+			delete[] m_pSplineImg[i];
+		m_pSplineImg[i]=NULL;		
+	}
+	if(m_pNotchImg != NULL)
+		delete[] m_pNotchImg;
+	m_pNotchImg = NULL;
+}
+
+void CViewInsInformation::DoDataExchange(CDataExchange* pDX)
+{		
+	DDX_Control(pDX,IDC_STATIC_MAP_UP,m_GlassMapCF);	
+	DDX_Control(pDX,IDC_STATIC_MAP_DW,m_GlassMapTFT);	
+	
+	DDX_Control(pDX,IDC_STATIC_RECIPE_TITLE,m_btnRecipeName);
+	DDX_Control(pDX,IDC_STATIC_GLASSID_TITLE,m_btnGlassID);
+	DDX_Control(pDX,IDC_STATIC_GLASSINFO_TITLE,m_btnRecipeInfo);
+
+	DDX_Control(pDX,IDC_STATIC_INSINFO_EQPNO,m_btnEQPNo);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_UNITNO,m_btnUnitNo);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ISGRIND,m_btnIsGrind);	
+	DDX_Control(pDX,IDC_STATIC_INSINFO_STAGENO,m_btnStageNo);		
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ROUGHPANLAYER,m_btnRoughPadLayer);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ROUGHPADCOUNT,m_btnRoughPadCount);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ROUGHNPADLAYER,m_btnRoughNPadLayer);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ROUGHNPADCOUNT,m_btnRoughNPadCount);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ROUGHPANLAYER_2,m_btnRoughPadLayer2);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ROUGHPADCOUNT_2,m_btnRoughPadCount2);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ROUGHNPADLAYER_2,m_btnRoughNPadLayer2);
+	DDX_Control(pDX,IDC_STATIC_INSINFO_ROUGHNPADCOUNT_2,m_btnRoughNPadCount2);
+
+	DDX_Control(pDX,IDC_GRD_MEASURE_RESULT_A,m_GrdMeasureLine[DIMENSION_A]);
+	DDX_Control(pDX,IDC_GRD_MEASURE_RESULT_B,m_GrdMeasureLine[DIMENSION_B]);
+	DDX_Control(pDX,IDC_GRD_MEASURE_RESULT_C,m_GrdMeasureLine[DIMENSION_C]);
+	DDX_Control(pDX,IDC_GRD_MEASURE_RESULT_D,m_GrdMeasureLine[DIMENSION_D]);
+	DDX_Control(pDX,IDC_GRD_MEASURE_RESULT_A_INLINE,m_GrdMeasureLine[DIMENSION_D+1]);
+	DDX_Control(pDX,IDC_GRD_MEASURE_RESULT_RCUT_A,m_GrdMeasureLine[DIMENSION_D+2]);
+	DDX_Control(pDX,IDC_GRD_MEASURE_RESULT_RCUT_C,m_GrdMeasureLine[DIMENSION_D+3]);
+	
+	
+	CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_EVENTSINK_MAP(CViewInsInformation, CDialogEx)
+	ON_EVENT(CViewInsInformation, IDC_BTN_INSINFO_MAPSETTINGS, DISPID_CLICK, CViewInsInformation::OnBnClickedMapSettings, VTS_NONE)
+END_EVENTSINK_MAP()
+
+BEGIN_MESSAGE_MAP(CViewInsInformation, CDialogEx)
+	ON_WM_SHOWWINDOW()
+	ON_WM_PAINT()			
+	ON_MESSAGE(UM_MAP_SELECTDEFECT, OnMapDefectSelected)
+	ON_BN_CLICKED(IDC_STATIC_INSINFO_GRP_2, &CViewInsInformation::OnBnClickedStaticInsinfoGrp2)
+END_MESSAGE_MAP()
+
+BOOL CViewInsInformation::OnInitDialog(void)
+{
+	CDialogEx::OnInitDialog();	
+	
+	Init_MeasureGrid();
+
+	Init_GlassMap();
+
+	SetControlData();	
+		
+	m_bNotchInspect = FALSE;
+	
+	ResetView();
+
+	CViewMapSettings DlgMap;
+
+	DlgMap.LoadMapSettings(m_MapSettingIndex);
+	SetGlassMapIndex();
+
+	return TRUE;
+}
+
+void CViewInsInformation::AddHistoryData(HISTORY_RESULT Data)
+{
+	m_HistoryData = Data;
+
+	Fill_MeasureGrid();
+}
+
+int			nGridColumnCnt[] = {PROFILE_INSPECT_SIZE_A_C,PROFILE_INSPECT_SIZE_B_D,PROFILE_INSPECT_SIZE_A_C,PROFILE_INSPECT_SIZE_B_D,PROFILE_INSPECT_SIZE_A_C,PROFILE_INSPECT_SIZE_B_D,PROFILE_INSPECT_SIZE_B_D};
+TCHAR		*strGrindString[]={_T("A"),_T("B"),_T("C"),_T("D"),_T("A"),_T("A"),_T("C")};
+UINT		eViewProfileIndex[] = {PROFILE_INSPECT_INDEX_A,PROFILE_INSPECT_INDEX_B,PROFILE_INSPECT_INDEX_C,PROFILE_INSPECT_INDEX_D,PROFILE_INSPECT_INDEX_CF,PROFILE_RCUT_INSPECT_INDEX_A,PROFILE_RCUT_INSPECT_INDEX_C};
+
+void CViewInsInformation::Fill_MeasureGrid()
+{
+	int			i,index,nProfileIndex;
+	COLORREF	colorRef[] = {RGB(200,0,0),RGB(0,0,200)};
+	COLORREF	color;
+	CString		str;
+	int			nRowIdx,iCol;
+	CGridCellBase	*pCell;
+	LOGFONT lf;
+	BOOL		bUseColor = TRUE;
+
+	if(m_pHardwareSetting != NULL)
+		bUseColor = m_pHardwareSetting->m_bUseColorVisual;
+
+	for(i=0;i<MAX_VIEWINFO_GRD_CNT;i++)
+	{
+		if(m_GrdMeasureLine[i].GetSafeHwnd() == NULL)
+			continue;
+
+		CFont *pFont = m_GrdMeasureLine[i].GetFont();
+		if (!pFont) 
+			continue;
+
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 16;
+		lf.lfWeight = FW_NORMAL;
+		_tcscpy(lf.lfFaceName, _T("Arial"));
+
+		for(index=0;index<nGridColumnCnt[i];index++)
+		{			
+			iCol = index+1;
+			nProfileIndex = eViewProfileIndex[i]+index;
+
+			nRowIdx = 1;
+			if(bUseColor == TRUE)
+				color = colorRef[m_HistoryData.bProfileJudge[nProfileIndex]];
+			else
+				color = colorRef[1];
+			pCell = m_GrdMeasureLine[i].GetCell(nRowIdx,iCol);
+			if(pCell != NULL)		
+			{
+				pCell->SetTextClr(color);		
+				pCell->SetFont(&lf);
+			}
+			str.Format(_T("%.3f"),(double)m_HistoryData.nProfileDiff[nProfileIndex]/1000.);
+			m_GrdMeasureLine[i].SetItemText(nRowIdx,iCol,str);	
+
+			nRowIdx = 2;
+			if(bUseColor == TRUE)
+				color = colorRef[m_HistoryData.bChamferJudgeUp[nProfileIndex]];
+			else
+				color = colorRef[1];
+
+			pCell = m_GrdMeasureLine[i].GetCell(nRowIdx,iCol);
+			if(pCell != NULL)		
+			{
+				pCell->SetTextClr(color);		
+				pCell->SetFont(&lf);
+			}
+			str.Format(_T("%.3f"),(double)m_HistoryData.nChamferThickUp[nProfileIndex]/1000.);
+			m_GrdMeasureLine[i].SetItemText(nRowIdx,iCol,str);
+
+			nRowIdx = 3;
+			if(bUseColor == TRUE)
+				color = colorRef[m_HistoryData.bChamferJudgeDn[nProfileIndex]];
+			else
+				color = colorRef[1];
+			pCell = m_GrdMeasureLine[i].GetCell(nRowIdx,iCol);
+			if(pCell != NULL)		
+			{
+				pCell->SetTextClr(color);		
+				pCell->SetFont(&lf);
+			}
+			str.Format(_T("%.3f"),(double)m_HistoryData.nChamferThickDn[nProfileIndex]/1000.);
+			m_GrdMeasureLine[i].SetItemText(nRowIdx,iCol,str);
+
+			if (i > MAX_VIEWINFO_GRD_CNT - 3 && (68 == nProfileIndex || 78 == nProfileIndex))
+			{
+				color = RGB(0, 225, 0);
+				for (int j = 1; j < 4; j++)
+				{
+					pCell = m_GrdMeasureLine[i].GetCell(j, iCol + 2);
+					if (pCell != NULL)
+					{
+						pCell->SetTextClr(color);
+						pCell->SetFont(&lf);
+					}
+				}
+
+				str.Format(_T("%.3f"), m_HistoryData.nAVGProfileDiff[i + 2] / 1000.);
+				m_GrdMeasureLine[i].SetItemText(1, iCol + 2, str);
+
+				str.Format(_T("%.3f"), m_HistoryData.nAVGChamferThickUp[i + 2] / 1000.);
+				m_GrdMeasureLine[i].SetItemText(2, iCol + 2, str);
+
+				str.Format(_T("%.3f"), m_HistoryData.nAVGChamferThickDn[i + 2] / 1000.);
+				m_GrdMeasureLine[i].SetItemText(3, iCol + 2, str);
+			}
+		}
+
+		iCol++;
+		color = RGB(0, 225, 0);
+		for (int j = 1; j < 4; j++)
+		{
+			pCell = m_GrdMeasureLine[i].GetCell(j, iCol);
+			if (pCell != NULL)
+			{
+				pCell->SetTextClr(color);
+				pCell->SetFont(&lf);
+			}
+		}
+
+		str.Format(_T("%.3f"), m_HistoryData.nAVGProfileDiff[i] / 1000.);
+		m_GrdMeasureLine[i].SetItemText(1, iCol, str);
+
+		str.Format(_T("%.3f"), m_HistoryData.nAVGChamferThickUp[i] / 1000.);
+		m_GrdMeasureLine[i].SetItemText(2, iCol, str);
+
+		str.Format(_T("%.3f"), m_HistoryData.nAVGChamferThickDn[i] / 1000.);
+		m_GrdMeasureLine[i].SetItemText(3, iCol, str);
+	}
+
+	for(i=0;i<MAX_VIEWINFO_GRD_CNT;i++)
+	{
+		if(m_GrdMeasureLine[i].GetSafeHwnd() == NULL)
+			continue;
+
+		m_GrdMeasureLine[i].Invalidate();
+	}
+}
+
+void CViewInsInformation::Init_MeasureGrid()
+{
+	int	i;
+	
+	for(i=0;i<MAX_VIEWINFO_GRD_CNT;i++)
+	{
+		if(m_GrdMeasureLine[i].GetSafeHwnd() == NULL)
+			continue;
+
+// 		m_GrdMeasureLine[i].GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
+// 		m_GrdMeasureLine[i].GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
+// 		m_GrdMeasureLine[i].GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
+// 		m_GrdMeasureLine[i].SetFixedBkColor(GRID_FIX_COLOR);
+		m_GrdMeasureLine[i].SetGridLines(GVL_BOTH);	
+
+		if (i > MAX_VIEWINFO_GRD_CNT - 3)
+		{
+			m_GrdMeasureLine[i].SetColumnCount(nGridColumnCnt[i] + 1 + 1 + 1);
+		}
+		else
+		{
+			m_GrdMeasureLine[i].SetColumnCount(nGridColumnCnt[i] + 1 + 1);
+		}
+
+		m_GrdMeasureLine[i].SetRowCount(4);
+		m_GrdMeasureLine[i].SetFixedRowCount(1);
+		m_GrdMeasureLine[i].SetFixedColumnCount(1);
+		m_GrdMeasureLine[i].ExpandToFit();
+
+		CFont *pFont = m_GrdMeasureLine[i].GetFont();
+		if (!pFont) 
+			return;
+
+		LOGFONT lf;	
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy(lf.lfFaceName, _T("Arial"));
+
+		m_GrdMeasureLine[i].GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_GrdMeasureLine[i].GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_GrdMeasureLine[i].GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+		m_GrdMeasureLine[i].SetEditable(FALSE);
+		m_GrdMeasureLine[i].EnableSelection(TRUE);
+
+		Init_MeasureGridHeader(&m_GrdMeasureLine[i], (nGridColumnCnt[i] + 1 + 1), strGrindString[i], eViewProfileIndex[i]);
+		if (i > MAX_VIEWINFO_GRD_CNT - 3)
+		{
+			GV_ITEM Item;
+			Item.mask = GVIF_TEXT;
+			Item.row = 0;
+			Item.col = nGridColumnCnt[i] + 1 + 1;
+			Item.strText.Format(_T("AVG"));
+
+			m_GrdMeasureLine[i].SetItem(&Item);
+			m_GrdMeasureLine[i].SetColumnWidth(Item.col, 80);
+		}
+	}
+}
+
+void CViewInsInformation::Init_MeasureGridHeader(CGridCtrl *pGrid,int nCount,CString strTitle,int nLineIndex)
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	Item.col = 0;
+
+	pGrid->SetColumnWidth(Item.col,90);
+	for(iLoop=1;iLoop<nCount;iLoop++)
+	{
+		Item.col = iLoop;
+		if (iLoop < nCount - 1)
+			Item.strText.Format(_T("%s-%02d"), strTitle, nLineIndex + iLoop);
+		else
+			Item.strText.Format(_T("AVG"));
+		pGrid->SetItem(&Item);		
+		pGrid->SetColumnWidth(Item.col,80);
+	}
+
+	Item.col = 0;
+	Item.row = 1;	
+	Item.strText = _T("PROFILE");
+	pGrid->SetItem(&Item);		
+
+	Item.row = 2;	
+	Item.strText = _T("CHAMFER_UP");
+	pGrid->SetItem(&Item);		
+
+	Item.row = 3;	
+	Item.strText = _T("CHAMFER_DN");
+	pGrid->SetItem(&Item);		
+
+	pGrid->Invalidate();
+}
+
+BOOL CViewInsInformation::PreTranslateMessage(MSG* pMsg) 
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialogEx::PreTranslateMessage(pMsg);
+}
+
+void CViewInsInformation::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		//ResetView();
+		Invalidate(FALSE);
+	}
+}
+
+void CViewInsInformation::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+		
+	//DrawUIControl();	
+
+	int		i;
+
+	for(i=0;i<4;i++)
+	{
+		((CWnd*)GetDlgItem(IDC_STATIC_IMG_RCUT_LEFT+i))->ShowWindow(TRUE);
+		if(m_pSplineImg[i] == NULL || m_szSplineImg[i].cx <= 0 || m_szSplineImg[i].cy <= 0)
+			continue;
+
+		CRect		crect;
+		((CWnd*)GetDlgItem(IDC_STATIC_IMG_RCUT_LEFT+i))->GetWindowRect(&crect);
+		this->ScreenToClient(&crect);
+		CControlMemDC	memDC(&dc,&crect);
+
+		m_pBMI->bmiHeader.biWidth=(LONG)m_szSplineImg[i].cx;
+		m_pBMI->bmiHeader.biHeight=-(LONG)m_szSplineImg[i].cy;
+		//::SetDIBitsToDevice(memDC.GetSafeHdc(), crect.left, crect.top, m_szSplineImg[i].cx, m_szSplineImg[i].cy, 0, 0, 0, m_szSplineImg[i].cy, m_pSplineImg[i], m_pBMI, DIB_RGB_COLORS);
+		::StretchDIBits(memDC.GetSafeHdc(), crect.left, crect.top, crect.Width(),crect.Height(),0, 0,m_szSplineImg[i].cx, m_szSplineImg[i].cy, (LPBYTE)m_pSplineImg[i], m_pBMI, DIB_RGB_COLORS,SRCCOPY);
+	}
+}
+
+void CViewInsInformation::SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe)
+{
+	m_pHardwareSetting = pHard;
+	m_pGlassRecipe = pRecipe;	
+
+	Refresh();
+}
+
+void CViewInsInformation::Refresh()
+{
+	if(m_pGlassRecipe != NULL)
+	{	
+		m_GlassMapCF.InitGlass(this,m_pGlassRecipe->m_GlassParm.m_nGlassSizeX,m_pGlassRecipe->m_GlassParm.m_nGlassSizeY,0);
+		m_GlassMapCF.ReCalRectDraw();
+		m_GlassMapCF.SetGlassRecipe(m_pHardwareSetting,m_pGlassRecipe,FALSE);
+
+		m_GlassMapTFT.InitGlass(this,m_pGlassRecipe->m_GlassParm.m_nGlassSizeX,m_pGlassRecipe->m_GlassParm.m_nGlassSizeY,0);
+		m_GlassMapTFT.ReCalRectDraw();
+		m_GlassMapTFT.SetGlassRecipe(m_pHardwareSetting,m_pGlassRecipe,TRUE);
+	}
+	
+	DrawUIControl();
+
+	Invalidate(FALSE);
+}
+
+void CViewInsInformation::DrawUITitle()
+{	
+	CString			str;
+
+	if(m_pGlassRecipe != NULL)
+	{
+		str.Format(_T("%s"),m_pGlassRecipe->GetRecipeName());
+		m_btnRecipeName.SetCaption(str);
+		str.Format(_T("%s"),m_pGlassRecipe->m_GlassParm.m_strDisp);
+		m_btnRecipeInfo.SetCaption(str);
+	}
+	
+	str.Format(_T("%s"),g_pBase->m_strHPanelID);
+
+	m_btnGlassID.SetCaption(str);
+}
+
+void CViewInsInformation::OnBnClickedMapSettings()
+{
+	CViewMapSettings		DlgMapSettings;
+
+	if(DlgMapSettings.DoModal() == IDOK)
+	{
+		m_MapSettingIndex =	*DlgMapSettings.GetMapData();
+		SetGlassMapIndex();
+
+		m_GlassMapCF.Invalidate();
+		m_GlassMapTFT.Invalidate();
+	}
+}
+
+void CViewInsInformation::DrawUIControl()
+{
+	DrawUITitle();
+	UpdateTransferData();
+}
+
+void CViewInsInformation::UpdateTransferData()
+{
+	if(m_pTransData == NULL)
+		return;
+
+	CTransfer_Data		*pTrans = m_pTransData;
+
+	CString			str;
+
+	str.Format(_T("%d"),pTrans->m_nEqpNo);
+	m_btnEQPNo.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nUnitNo);
+	m_btnUnitNo.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nisGrind);
+	m_btnIsGrind.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nHandNumber);
+	m_btnStageNo.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nRoughPadLayer);
+	m_btnRoughPadLayer.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nRoughPadCount);
+	m_btnRoughPadCount.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nRoughNonPadLayer);
+	m_btnRoughNPadLayer.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nRoughNonPadCount);
+	m_btnRoughNPadCount.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nPrePadLayer);
+	m_btnRoughPadLayer2.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nPrePadCount);
+	m_btnRoughPadCount2.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nPreNonPadLayer);
+	m_btnRoughNPadLayer2.SetCaption(str);
+	str.Format(_T("%d"),pTrans->m_nPreNonPadCount);
+	m_btnRoughNPadCount2.SetCaption(str);
+
+
+	// g_pBase俊绰 捞傈 臂扼胶 单捞磐啊 甸绢乐匙.. 弊贰辑 弥辟 拱幅单捞磐 罐篮吧肺 官厕
+	str.Format(_T("%s"),pTrans->m_strHPANELID);
+	m_btnGlassID.SetCaption(str);
+}
+
+CGlassMap *CViewInsInformation::GetDefectMap(BOOL bTFT)
+{
+	if(bTFT ==TRUE)
+		return &m_GlassMapTFT;
+	else
+		return &m_GlassMapCF;
+}
+
+void CViewInsInformation::SetGlassMapIndex()
+{
+	m_GlassMapCF.SetMapIndex(m_MapSettingIndex.m_nMapIndex[0]);
+	m_GlassMapTFT.SetMapIndex(m_MapSettingIndex.m_nMapIndex[1]);
+}
+
+void CViewInsInformation::Init_GlassMap()
+{
+	m_GlassMapTFT.InitGlass(GetParent(),0,0,0);
+	m_GlassMapCF.InitGlass(GetParent(),0,0,0);
+
+	m_GlassMapCF.SetOtherGlassMapPtr(&m_GlassMapTFT);
+	m_GlassMapTFT.SetOtherGlassMapPtr(&m_GlassMapCF);
+}
+
+void CViewInsInformation::ResetView()
+{
+	m_GlassMapTFT.SetGlasssize(0,0.);
+	m_GlassMapTFT.SetGlasssize(1,0.);	
+	m_GlassMapCF.SetGlasssize(0,0.);
+	m_GlassMapCF.SetGlasssize(1,0.);	
+	
+	SetSplineImg(NULL,CSize(0,0),INSPECTSPLINE_BUFFER::SPLINE_TOPLEFT);	
+	SetSplineImg(NULL,CSize(0,0),INSPECTSPLINE_BUFFER::SPLINE_TOPRIGHT);
+	SetSplineImg(NULL,CSize(0,0),INSPECTSPLINE_BUFFER::SPLINE_BOTTOMLEFT);
+	SetSplineImg(NULL,CSize(0,0),INSPECTSPLINE_BUFFER::SPLINE_BOTTOMRIGHT);
+	
+	m_bInitView = TRUE;
+
+	DrawUIControl();	
+
+	m_HistoryData.Reset();
+	Fill_MeasureGrid();
+}
+
+void CViewInsInformation::DrawMapRefresh()
+{
+	m_GlassMapTFT.SetDrawMapRefresh();
+	m_GlassMapCF.SetDrawMapRefresh();
+}
+
+void CViewInsInformation::SetTransferData(CTransfer_Data *pTrans)
+{
+	m_pTransData = pTrans;
+
+	UpdateTransferData();
+}
+
+void CViewInsInformation::SetGlassSize(int nIdx,double dValue)
+{
+	m_GlassMapTFT.SetGlasssize(nIdx,dValue);
+	m_GlassMapCF.SetGlasssize(nIdx,dValue);	
+}
+
+void CViewInsInformation::SetDefect(MapDefect* pMapDefect)
+{
+	m_GlassMapTFT.DrawDefects(pMapDefect,m_pGlassData);
+	m_GlassMapCF.DrawDefects(pMapDefect,m_pGlassData);	
+
+	m_bInitView = FALSE;
+	Invalidate(FALSE);
+}
+
+void CViewInsInformation::SetControlData()
+{	
+	m_FontControl.SetFont(this,IDC_STATIC_INSINFO_GRP_1,CFontControl::EN_SUBFONT);
+	m_FontControl.SetFont(this,IDC_STATIC_INSINFO_GRP_2,CFontControl::EN_SUBFONT);
+}
+
+
+void CViewInsInformation::SetCutAreaPointData(CAMERA_DIR Camdir,DimensionDir emDir,double *dValue,double dAvgVal)
+{
+	if(Camdir == CAMDIR_TOP)
+	{
+		m_GlassMapCF.SetPointCutData(emDir,dValue,dAvgVal);
+	}
+	else
+	{
+		m_GlassMapTFT.SetPointCutData(emDir,dValue,dAvgVal);		
+	}
+}
+
+void CViewInsInformation::SetDimenPointData(CAMERA_DIR Camdir,DimensionDir emDir ,double *dValue,double dAvgVal)
+{
+	m_GlassMapCF.SetPointDimenData(emDir,dValue,dAvgVal);
+	m_GlassMapTFT.SetPointDimenData(emDir,dValue,dAvgVal);		
+}
+
+void CViewInsInformation::SetSplineData(Disp_SplineLocation enDir,double dValue)
+{
+	m_GlassMapTFT.SetSplineData(enDir,dValue);
+	m_GlassMapCF.SetSplineData(enDir,dValue);
+}
+
+void CViewInsInformation::SetCornerXData(Disp_SplineLocation enDir,double dValue)
+{
+	m_GlassMapTFT.SetCornerXData(enDir,dValue);
+	m_GlassMapCF.SetCornerXData(enDir,dValue);
+}
+
+void CViewInsInformation::SetCornerYData(Disp_SplineLocation enDir,double dValue)
+{
+	m_GlassMapTFT.SetCornerYData(enDir,dValue);
+	m_GlassMapCF.SetCornerYData(enDir,dValue);
+}
+
+LRESULT CViewInsInformation::OnMapDefectSelected(WPARAM wParam, LPARAM lParam)
+{
+	int iDefect = static_cast<int>(wParam);
+	BOOL bTFT = static_cast<BOOL>(lParam);
+	
+	if(bTFT == TRUE)
+		m_GlassMapTFT.SetSelectDefect(iDefect);
+	else
+		m_GlassMapCF.SetSelectDefect(iDefect);
+
+	return 0;
+}
+
+BOOL CViewInsInformation::SetSplineImg(LPBYTE pImg,CSize szImg,int iPosition)
+{
+	BYTE				**pSplineImg = NULL;	
+	CSize				*szSpline;
+	BOOL				bFlip=FALSE;
+	BOOL				bLeftRight = FALSE;
+	int					nIndex = 0;
+
+	nIndex = iPosition;
+	switch (iPosition)
+	{
+	case INSPECTSPLINE_BUFFER::SPLINE_TOPLEFT:
+
+		break;
+	case INSPECTSPLINE_BUFFER::SPLINE_TOPRIGHT:
+		bLeftRight = TRUE;
+		bFlip = TRUE;	
+		break;
+	case INSPECTSPLINE_BUFFER::SPLINE_BOTTOMLEFT:
+		bFlip = FALSE;		
+		break;
+	case INSPECTSPLINE_BUFFER::SPLINE_BOTTOMRIGHT:
+		bFlip = TRUE;
+		bLeftRight = TRUE;
+		break;
+	default:
+		return FALSE;
+	}
+
+	pSplineImg = &m_pSplineImg[nIndex];		
+	szSpline = &m_szSplineImg[nIndex];
+
+	if(*pSplineImg != NULL)
+		delete[] *pSplineImg,*pSplineImg=NULL;	
+
+	CRect		crect;
+
+	((CWnd*)GetDlgItem(IDC_STATIC_IMG_RCUT_LEFT))->GetWindowRect(&crect);	
+
+	if(pImg == NULL || szImg.cx <= 0 || szImg.cy <= 0)
+	{		
+		*pSplineImg = new BYTE[crect.Width()*crect.Height()];
+		*szSpline = CSize(crect.Width(),crect.Height());
+		ZeroMemory(*pSplineImg,sizeof(BYTE)*crect.Width()*crect.Height());
+		return FALSE;
+	}
+
+	double		dScale;
+	CSize		szScale;	
+	int			nSize = min(szImg.cx,szImg.cy);
+
+	dScale = (double)crect.Width()/(double)nSize;
+	szScale.cx = szScale.cy = align_4byte((int)((double)nSize*dScale));
+
+	if(szScale.cx <= 0 || szScale.cy <= 0)
+	{
+		*pSplineImg = new BYTE[crect.Width()*crect.Height()];
+		*szSpline = CSize(crect.Width(),crect.Height());
+		ZeroMemory(*pSplineImg,sizeof(BYTE)*crect.Width()*crect.Height());
+		return FALSE;
+	}
+	if(dScale > 0 && dScale < 1)
+	{
+		*pSplineImg = new BYTE[szScale.cx*szScale.cy];
+		ZeroMemory(*pSplineImg,sizeof(BYTE)*szScale.cx*szScale.cy);
+		*szSpline  = szScale;
+
+		ShrinkImage(pImg,szImg.cx,szImg.cy,*pSplineImg,szScale.cx,szScale.cy,dScale);	
+	}
+	else if(dScale >= 1)
+	{
+		*pSplineImg = new BYTE[szImg.cx*szImg.cy];
+		CopyMemory(*pSplineImg,pImg,sizeof(BYTE)*szImg.cx*szImg.cy);
+		*szSpline=szImg;
+
+		// 22.06.13 bug....
+		szScale = szImg;
+	}
+
+	if(bFlip == TRUE)
+		FlipImage(*pSplineImg,szScale);
+	if(bLeftRight == TRUE)
+		ChangeLeftRight(*pSplineImg,szScale);
+
+	
+
+	return TRUE;
+}
+
+BOOL CViewInsInformation::FlipImage(LPBYTE pImg,CSize szImg)
+{
+ 	if(pImg == NULL || szImg.cx <= 0 || szImg.cy <= 0)
+ 		return FALSE;
+
+	LPBYTE		pTgt = new BYTE[szImg.cx*szImg.cy];
+	int			v,iPos;
+
+	iPos = 0;
+	for(v=szImg.cy-1;v>=0;v--,iPos++)
+	{
+		CopyMemory(&pTgt[iPos*szImg.cx], &pImg[v*szImg.cx], szImg.cx);
+	}
+	CopyMemory(pImg,pTgt, szImg.cx*szImg.cy);
+	delete[] pTgt,pTgt=NULL;
+
+	return TRUE;
+}
+
+BOOL CViewInsInformation::ChangeLeftRight(LPBYTE pImg,CSize szImg)
+{
+ 	if(pImg == NULL || szImg.cx <= 0 || szImg.cy <= 0)
+ 		return FALSE;
+
+	LPBYTE		pTgt = new BYTE[szImg.cx*szImg.cy];
+	int			v,u,iPos;
+	
+	for(v=0;v<szImg.cy;v++)
+	{
+		for(iPos=0,u=szImg.cx-1;u>=0;u--,iPos++)
+			pTgt[v*szImg.cx+iPos] = pImg[v*szImg.cx+u];		
+	}
+
+	CopyMemory(pImg,pTgt,szImg.cx*szImg.cy);
+	delete[] pTgt,pTgt=NULL;
+
+	return TRUE;
+}
+
+BOOL CViewInsInformation::RotateImage(LPBYTE pImg,CSize szImg)
+{
+	if(pImg == NULL || szImg.cx <= 0 || szImg.cy <= 0)
+		return FALSE;
+
+	if(szImg.cx != szImg.cy)
+		return TRUE;
+
+	LPBYTE		pTgt = new BYTE[szImg.cx*szImg.cy];
+	int			v,u;
+
+	for(u=0;u<szImg.cy;u++)
+	{
+		for(v=0;v<szImg.cx;v++)
+			pTgt[(szImg.cy-u-1)+v*szImg.cx] = pImg[v+u*szImg.cx];		
+	}
+
+	CopyMemory(pImg,pTgt,szImg.cx*szImg.cy);
+	delete[] pTgt,pTgt=NULL;
+
+	return TRUE;
+}
+
+void CViewInsInformation::ShrinkImage(BYTE *pInBuff, LONG wSrcWidth, LONG wSrcHeight, 
+								  BYTE *pOutBuff, LONG wDestWidth, LONG wDestHeight,double scale)
+{
+	if (scale >= 1 || scale <= 0)
+		return;
+
+	double dFactor = 1 / scale;
+	double dXEnd = -dFactor / 2;
+	int nXStart, nXEnd = -1;
+
+	for (int nX = 0; nX < wDestWidth; nX++)
+	{
+		int nYStart, nYEnd = -1;
+		double dYEnd = -dFactor / 2;
+
+		nXStart = nXEnd + 1;
+		dXEnd += dFactor;
+		nXEnd = CHKMIN(wSrcWidth - 1, (int)dXEnd + 1);
+
+		if (nXStart > nXEnd || nXEnd >= wSrcWidth)
+			continue;
+
+		for (int nY = 0; nY < wDestHeight; nY++)
+		{
+			nYStart = nYEnd + 1;
+			dYEnd += dFactor;
+			nYEnd = CHKMIN(wSrcHeight - 1, (int)dYEnd + 1);
+
+			if (nYStart > nYEnd || nYEnd >= wSrcHeight)
+				continue;
+
+			int nCount = 0, nVal = 0;
+
+			// average the pixels over the range
+			for (int nXSub = nXStart; nXSub <= nXEnd; nXSub++)
+			{
+				for (int nYSub = nYStart; nYSub <= nYEnd; nYSub++)
+				{
+					nVal += pInBuff[nYSub * wSrcWidth + nXSub];
+					nCount++;
+				}
+			}
+
+			if(nCount > 0)
+				pOutBuff[nY * wDestWidth + nX] = nVal/nCount;
+		}
+	}
+
+	return;
+}
+
+BOOL CViewInsInformation::SetNotchImg( LPBYTE pImg,CSize szImg,int bPosDir)
+{	
+	
+
+	return TRUE;
+}
+
+
+void CViewInsInformation::OnBnClickedStaticInsinfoGrp2()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+}
diff --git a/ENRIT/View/ViewInsInformation.h b/ENRIT/View/ViewInsInformation.h
new file mode 100644
index 0000000..75268a4
--- /dev/null
+++ b/ENRIT/View/ViewInsInformation.h
@@ -0,0 +1,140 @@
+#pragma once
+
+#include "btnenh.h"
+#include "ENRIT.h"
+#include "GlassMap.h"
+#include "History.h"
+#include "General_Draw.h"
+#include "MImageStatic.h"
+#include "ViewMapSettings.h"
+
+// CViewInsInformation 措拳 惑磊涝聪促.
+
+#define			MAX_HISTORY_COUNT	1000
+#define			_CURRENT_HISTORY_BACKUP_	_T("D:\\InspectionData\\History\\CurrentHistory.Bin")
+
+typedef std::vector<CInspectDefect*>				LISTDefect;
+typedef std::vector<CInspectDefect*>::iterator		LISTDefectit;
+
+class CHardwareSettings;
+class CGlassRecipe;
+class CDefect;
+class CGlass_Data;
+class CTransfer_Data;
+class CViewInsInformation : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewInsInformation)
+
+public:
+	CViewInsInformation(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewInsInformation();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_INSPECT_INFORMATION };
+
+protected:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual BOOL OnInitDialog(void);
+	afx_msg void OnPaint();
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);			
+	afx_msg LRESULT OnMapDefectSelected(WPARAM wParam, LPARAM lParam);	
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+	void				SetView2Main(IViewInterface2Parent *pV2M){m_pV2M=pV2M;}
+	void				SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe);
+	void				SetGlassData(CGlass_Data *pGlassData){m_pGlassData=pGlassData;}		
+	void				SetTransferData(CTransfer_Data *pTrans);
+	void				SetGlassSize(int nIdx,double dValue);
+	void				SetCutAreaPointData(CAMERA_DIR Camdir,DimensionDir emDir ,double *dValue,double dAvgVal);
+	void				SetDimenPointData(CAMERA_DIR Camdir,DimensionDir emDir ,double *dValue,double dAvgVal);
+	void				SetSplineData(Disp_SplineLocation enDir,double dValue);
+	void				SetCornerXData(Disp_SplineLocation enDir,double dValue);
+	void				SetCornerYData(Disp_SplineLocation enDir,double dValue);
+	void				AddHistoryData(HISTORY_RESULT Data);
+	void				SetDefect(MapDefect* pMapDefect);
+	BOOL				SetNotchImg(LPBYTE pImg,CSize szImg,int bPosDir);
+	BOOL				SetSplineImg(LPBYTE pImg,CSize szImg,int iPosition);
+
+	void				ViewRefresh(PROG_MSG ProcMsg);
+	void				DrawMapRefresh();
+	void				ResetView();
+	void				Refresh();		
+
+protected:
+	void				SetControlData();	
+
+#pragma region Defect Map
+public:
+	CGlassMap			*GetDefectMap(BOOL bTFT);
+
+protected:
+	void				Init_GlassMap();
+	void				SetGlassMapIndex();
+
+	CGlassMap			m_GlassMapCF;
+	CGlassMap			m_GlassMapTFT;		
+#pragma endregion Defect Map
+
+#pragma region Measurement Result Grid
+protected:
+//#define MAX_VIEWINFO_GRD_CNT		7
+	void				Init_MeasureGrid();
+	void				Init_MeasureGridHeader(CGridCtrl *pGrid,int nCount,CString strTitle,int nLineIndex);
+	void				Fill_MeasureGrid();
+
+	CGridCtrl			m_GrdMeasureLine[MAX_VIEWINFO_GRD_CNT];	
+#pragma endregion Measurement Result Grid
+	
+#pragma region Spline Image Display
+protected:
+	BOOL				FlipImage(LPBYTE pImg,CSize szImg);
+	BOOL				ChangeLeftRight(LPBYTE pImg,CSize szImg);
+	BOOL				RotateImage(LPBYTE pImg,CSize szImg);
+	void				ShrinkImage(BYTE *pInBuff, LONG wSrcWidth, LONG wSrcHeight, BYTE *pOutBuff, LONG wDestWidth, LONG wDestHeight,double scale);	
+
+	BOOL				m_bNotchInspect;
+	LPBYTE				m_pSplineImg[4];
+	CSize				m_szSplineImg[4];
+	LPBYTE				m_pNotchImg;
+	CSize				m_szNotchImg;	
+#pragma region Spline Image Display
+		
+	void				UpdateTransferData();
+	void				DrawUIControl();
+	void				DrawUITitle();	
+	void				OnBnClickedMapSettings();
+
+protected:	
+	_ST_MAPSETTINGS		m_MapSettingIndex;
+	HISTORY_RESULT		m_HistoryData;
+	IViewInterface2Parent	*m_pV2M;
+	BOOL				m_bInitView;	
+	CHardwareSettings	*m_pHardwareSetting;
+	CGlassRecipe	*m_pGlassRecipe;	
+	CFontControl		m_FontControl;
+	CGlass_Data			*m_pGlassData;
+	CTransfer_Data		*m_pTransData;
+	BITMAPINFO			*m_pBMI;
+
+	CBtnEnh				m_btnRecipeName;
+	CBtnEnh				m_btnGlassID;
+	CBtnEnh				m_btnRecipeInfo;
+
+	CBtnEnh				m_btnEQPNo;
+	CBtnEnh				m_btnUnitNo;
+	CBtnEnh				m_btnIsGrind;
+	CBtnEnh				m_btnStageNo;
+	CBtnEnh				m_btnRoughPadLayer;
+	CBtnEnh				m_btnRoughPadCount;
+	CBtnEnh				m_btnRoughNPadLayer;
+	CBtnEnh				m_btnRoughNPadCount;
+	CBtnEnh				m_btnRoughPadLayer2;
+	CBtnEnh				m_btnRoughPadCount2;
+	CBtnEnh				m_btnRoughNPadLayer2;
+	CBtnEnh				m_btnRoughNPadCount2;
+public:
+	afx_msg void OnBnClickedStaticInsinfoGrp2();
+};
diff --git a/ENRIT/View/ViewLampControl.cpp b/ENRIT/View/ViewLampControl.cpp
new file mode 100644
index 0000000..2cad608
--- /dev/null
+++ b/ENRIT/View/ViewLampControl.cpp
@@ -0,0 +1,640 @@
+// Dlg_LampControl.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ViewLampControl.h"
+#include "Global_Define.h"
+
+
+// CViewLampControl 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewLampControl, CDialog)
+	
+#define LAMP_MAX_VALUE 1023
+
+UINT nIDLampVal[] = {IDC_EDIT_LAMP_VALUE_1,IDC_EDIT_LAMP_VALUE_2,IDC_EDIT_LAMP_VALUE_3,IDC_EDIT_LAMP_VALUE_4,IDC_EDIT_LAMP_VALUE_5,IDC_EDIT_LAMP_VALUE_6,IDC_EDIT_LAMP_VALUE_7,IDC_EDIT_LAMP_VALUE_8};
+
+	CViewLampControl::CViewLampControl(CWnd* pParent /*=NULL*/)
+	: CDialog(CViewLampControl::IDD, pParent)
+{
+	m_pRecipe = NULL;
+	m_pIV2P = NULL;
+	m_Check_OnOff = TRUE;
+	ZeroMemory(m_nLampValue,sizeof(int)*8);
+	m_pHardware = NULL;
+	m_pRecipe = NULL;
+}
+
+CViewLampControl::~CViewLampControl()
+{
+
+}
+
+void CViewLampControl::DoDataExchange(CDataExchange* pDX)
+{
+	CDialog::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_SLIDER_1, m_ctrSlider[0]);
+	DDX_Control(pDX, IDC_SLIDER_2, m_ctrSlider[1]);
+	DDX_Control(pDX, IDC_SLIDER_3, m_ctrSlider[2]);
+	DDX_Control(pDX, IDC_SLIDER_4, m_ctrSlider[3]);
+	DDX_Control(pDX, IDC_SLIDER_5, m_ctrSlider[4]);
+	DDX_Control(pDX, IDC_SLIDER_6, m_ctrSlider[5]);
+	DDX_Control(pDX, IDC_SLIDER_7, m_ctrSlider[6]);
+	DDX_Control(pDX, IDC_SLIDER_8, m_ctrSlider[7]);
+
+	int				i;	
+
+	UINT nIDCmdOnOff[] = { IDC_CHECK_LAMP_ONOFF};
+	for (i = 0; i < eRcp_OnOff_End; i++) {
+		DDX_Control(pDX, nIDCmdOnOff[i], m_ctrlCmdOnOff[i]);
+	}
+
+	for(i=0;i<8;i++)
+	{
+		DDX_Text(pDX,nIDLampVal[i],m_nLampValue[i]);
+	}	
+}
+
+
+BEGIN_MESSAGE_MAP(CViewLampControl, CDialog)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_1, &CViewLampControl::OnNMCustomdrawSlider1)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_2, &CViewLampControl::OnNMCustomdrawSlider2)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_3, &CViewLampControl::OnNMCustomdrawSlider3)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_4, &CViewLampControl::OnNMCustomdrawSlider4)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_5, &CViewLampControl::OnNMCustomdrawSlider5)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_6, &CViewLampControl::OnNMCustomdrawSlider6)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_7, &CViewLampControl::OnNMCustomdrawSlider7)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_8, &CViewLampControl::OnNMCustomdrawSlider8)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_1, &CViewLampControl::OnNMReleasedcaptureSlider1)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_2, &CViewLampControl::OnNMReleasedcaptureSlider2)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_3, &CViewLampControl::OnNMReleasedcaptureSlider3)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_4, &CViewLampControl::OnNMReleasedcaptureSlider4)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_5, &CViewLampControl::OnNMReleasedcaptureSlider5)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_6, &CViewLampControl::OnNMReleasedcaptureSlider6)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_7, &CViewLampControl::OnNMReleasedcaptureSlider7)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_8, &CViewLampControl::OnNMReleasedcaptureSlider8)
+	ON_WM_DESTROY()	
+	ON_EN_CHANGE(IDC_EDIT_LAMP_VALUE_1, &CViewLampControl::OnChangeEditLampValue1)
+	ON_EN_CHANGE(IDC_EDIT_LAMP_VALUE_2, &CViewLampControl::OnChangeEditLampValue2)
+	ON_EN_CHANGE(IDC_EDIT_LAMP_VALUE_3, &CViewLampControl::OnChangeEditLampValue3)
+	ON_EN_CHANGE(IDC_EDIT_LAMP_VALUE_4, &CViewLampControl::OnChangeEditLampValue4)
+	ON_EN_CHANGE(IDC_EDIT_LAMP_VALUE_5, &CViewLampControl::OnChangeEditLampValue5)
+	ON_EN_CHANGE(IDC_EDIT_LAMP_VALUE_6, &CViewLampControl::OnChangeEditLampValue6)
+	ON_EN_CHANGE(IDC_EDIT_LAMP_VALUE_7, &CViewLampControl::OnChangeEditLampValue7)
+	ON_EN_CHANGE(IDC_EDIT_LAMP_VALUE_8, &CViewLampControl::OnChangeEditLampValue8)
+	ON_WM_SHOWWINDOW()
+	ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewLampControl, CDialogEx)
+	ON_EVENT(CViewLampControl, IDC_CHECK_LAMP_ONOFF, DISPID_CLICK, CViewLampControl::ClickChkLampOnOffButton, VTS_NONE)	
+	ON_EVENT(CViewLampControl, IDC_BTN_LAMP_CLOSE, DISPID_CLICK, CViewLampControl::ClickChkCloseButton, VTS_NONE)	
+
+END_EVENTSINK_MAP()
+
+
+BOOL CViewLampControl::OnInitDialog()
+{
+	CDialog::OnInitDialog();
+		
+	int			i;
+
+	for(i=0;i<8;i++)
+	{
+		m_ctrSlider[i].SetRange(0,255);
+		
+	}
+	
+	return TRUE;  // return TRUE unless you set the focus to a control
+	// 抗寇: OCX 加己 其捞瘤绰 FALSE甫 馆券秦具 钦聪促.
+}
+
+void CViewLampControl::ClickChkLampOnOffButton()
+{	
+	SetButtonOnOffEnable(FALSE);
+	
+	m_Check_OnOff = m_ctrlCmdOnOff[eRcp_OnOff_Use].GetValue();	
+
+	SetButtonOnOffEnable(TRUE);
+
+	if(m_Check_OnOff == FALSE)
+	{
+		LampAllOFF();	
+		m_ctrlCmdOnOff[eRcp_OnOff_Use].SetCaption(_T("Lamp Off"));
+	}
+	else
+	{
+		LampAllON();
+		m_ctrlCmdOnOff[eRcp_OnOff_Use].SetCaption(_T("Lamp On"));
+	}
+}
+
+void CViewLampControl::ClickChkCloseButton()
+{
+	UpdateData(TRUE);
+
+	int				index;
+
+	CLIGHT_PARM *pLightPrm = &m_pRecipe->m_LightParm;
+
+	int			iCon,iCh;
+
+	for(index=0;index<8;index++)
+	{
+		GetControl2ID(nIDLampVal[index],iCon,iCh);
+		pLightPrm->m_nContValue[iCon][iCh] = m_nLampValue[index];	
+	}	
+
+	LampAllON();
+	OnOK();
+}
+
+void CViewLampControl::SetButtonOnOffEnable(const BOOL& bEnable)
+{
+	int i;	
+
+	for (i = 0; i < eRcp_OnOff_End; i++) 
+	{
+		if (m_ctrlCmdOnOff[i].GetEnabled() != bEnable) {
+			m_ctrlCmdOnOff[i].SetEnabled(bEnable);
+		}
+	}	
+}
+
+void CViewLampControl::GetControl2ID(UINT nID,int &iCon,int &iCh)
+{
+	iCon = iCh = 0;
+
+	// RCut 4龋扁
+	if(m_pHardware != NULL)
+	{
+		int		nLineID = _ttoi(m_pHardware->GetLineID());		
+
+		if(nLineID == 4)
+		{
+			switch(nID)
+			{
+			case IDC_EDIT_LAMP_VALUE_1: 
+				iCon = 1;
+				iCh = 0; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_2:
+				iCon = 1;
+				iCh = 2; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_3:
+				iCon = 1;
+				iCh = 1; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_4:
+				iCon = 1;
+				iCh = 3; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_5:
+				iCon = 0;
+				iCh = 0; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_6:
+				iCon = 0;
+				iCh = 2; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_7:
+				iCon = 0;
+				iCh = 1; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_8:
+				iCon = 0;
+				iCh = 3; 	
+				break;
+			}
+		}
+		else if(nLineID == 3 || nLineID == 2 || nLineID == 1)
+		{
+			//	RCut 3龋扁
+			switch(nID)
+			{
+			case IDC_EDIT_LAMP_VALUE_1: 
+				iCon = 0;
+				iCh = 0; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_2:
+				iCon = 0;
+				iCh = 2; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_3:
+				iCon = 0;
+				iCh = 3; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_4:
+				iCon = 0;
+				iCh = 1; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_5:
+				iCon = 1;
+				iCh = 0; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_6:
+				iCon = 1;
+				iCh = 3; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_7:
+				iCon = 1;
+				iCh = 2; 
+				break;
+			case IDC_EDIT_LAMP_VALUE_8:
+				iCon = 1;
+				iCh = 1; 	
+				break;
+			}	
+		}
+		else
+		{
+			switch(nID)
+			{
+			case IDC_EDIT_LAMP_VALUE_1: 
+				if(m_pHardware->GetCameraSettings(0,0) != NULL)
+				{
+					iCon = m_pHardware->GetCameraSettings(0,0)->m_nLightIdx_R;;
+					iCh = m_pHardware->GetCameraSettings(0,0)->m_nLightIdx_R_Ch;;		
+				}
+				break;
+			case IDC_EDIT_LAMP_VALUE_2:
+				if(m_pHardware->GetCameraSettings(0,0) != NULL)
+				{
+					iCon = m_pHardware->GetCameraSettings(0,0)->m_nLightIdx_T;;
+					iCh = m_pHardware->GetCameraSettings(0,0)->m_nLightIdx_T_Ch;;	
+				}
+				break;
+			case IDC_EDIT_LAMP_VALUE_3:
+				if(m_pHardware->GetCameraSettings(1,0) != NULL)
+				{
+					iCon = m_pHardware->GetCameraSettings(1,0)->m_nLightIdx_R;;
+					iCh = m_pHardware->GetCameraSettings(1,0)->m_nLightIdx_R_Ch;;	
+				}
+				break;
+			case IDC_EDIT_LAMP_VALUE_4:
+				if(m_pHardware->GetCameraSettings(1,0) != NULL)
+				{
+					iCon = m_pHardware->GetCameraSettings(1,0)->m_nLightIdx_T;;
+					iCh = m_pHardware->GetCameraSettings(1,0)->m_nLightIdx_T_Ch;;	
+				}
+				break;
+			case IDC_EDIT_LAMP_VALUE_5:
+				if(m_pHardware->GetCameraSettings(2,0) != NULL)
+				{
+					iCon = m_pHardware->GetCameraSettings(2,0)->m_nLightIdx_R;;
+					iCh = m_pHardware->GetCameraSettings(2,0)->m_nLightIdx_R_Ch;;	
+				} 
+				break;
+			case IDC_EDIT_LAMP_VALUE_6:
+				if(m_pHardware->GetCameraSettings(2,0) != NULL)
+				{
+					iCon = m_pHardware->GetCameraSettings(2,0)->m_nLightIdx_T;;
+					iCh = m_pHardware->GetCameraSettings(2,0)->m_nLightIdx_T_Ch;;	
+				}
+				break;
+			case IDC_EDIT_LAMP_VALUE_7:
+				if(m_pHardware->GetCameraSettings(3,0) != NULL)
+				{
+					iCon = m_pHardware->GetCameraSettings(3,0)->m_nLightIdx_R;;
+					iCh = m_pHardware->GetCameraSettings(3,0)->m_nLightIdx_R_Ch;;	
+				} 
+				break;
+			case IDC_EDIT_LAMP_VALUE_8:
+				if(m_pHardware->GetCameraSettings(3,0) != NULL)
+				{
+					iCon = m_pHardware->GetCameraSettings(3,0)->m_nLightIdx_T;;
+					iCh = m_pHardware->GetCameraSettings(3,0)->m_nLightIdx_T_Ch;;	
+				}	
+				break;
+			}	
+		}
+	}
+	else
+	{
+		//	RCut 3龋扁
+		switch(nID)
+		{
+		case IDC_EDIT_LAMP_VALUE_1: 
+			iCon = 0;
+			iCh = 0; 
+			break;
+		case IDC_EDIT_LAMP_VALUE_2:
+			iCon = 0;
+			iCh = 2; 
+			break;
+		case IDC_EDIT_LAMP_VALUE_3:
+			iCon = 0;
+			iCh = 3; 
+			break;
+		case IDC_EDIT_LAMP_VALUE_4:
+			iCon = 0;
+			iCh = 1; 
+			break;
+		case IDC_EDIT_LAMP_VALUE_5:
+			iCon = 1;
+			iCh = 0; 
+			break;
+		case IDC_EDIT_LAMP_VALUE_6:
+			iCon = 1;
+			iCh = 3; 
+			break;
+		case IDC_EDIT_LAMP_VALUE_7:
+			iCon = 1;
+			iCh = 2; 
+			break;
+		case IDC_EDIT_LAMP_VALUE_8:
+			iCon = 1;
+			iCh = 1; 	
+			break;
+		}	
+	}
+}
+
+void CViewLampControl::SetData(CGlassRecipe *pRecipe,CHardwareSettings *pHard)
+{
+	m_pRecipe = pRecipe;
+	m_pHardware = pHard;
+
+	if(m_pHardware != NULL)
+	{
+		int		nLineID = _ttoi(m_pHardware->GetLineID());		
+
+		if(nLineID >= 5)
+		{
+			((CWnd*)GetDlgItem(IDC_STATIC_LAMP_MAX_VALUE))->SetWindowText(L"255");
+		}
+		else
+		{
+			((CWnd*)GetDlgItem(IDC_STATIC_LAMP_MAX_VALUE))->SetWindowText(L"1024");
+		}
+
+	}
+
+	CLIGHT_PARM *pLightPrm = &m_pRecipe->m_LightParm;
+
+	CString			strTemp;
+	int				iCon,iCh,index;
+
+	for(index=0;index<8;index++)
+	{
+		GetControl2ID(nIDLampVal[index],iCon,iCh);
+		m_nLampValue[index] = pLightPrm->m_nContValue[iCon][iCh];	
+		m_ctrSlider[index].SetPos(m_nLampValue[index]);
+	}	
+	
+	m_ctrlCmdOnOff[eRcp_OnOff_Use].SetValue(m_Check_OnOff);
+	if(m_Check_OnOff == TRUE)
+		m_ctrlCmdOnOff[eRcp_OnOff_Use].SetCaption(_T("Lamp Off"));
+
+	UpdateData(FALSE);
+}
+
+void CViewLampControl::LampValueUpdate(int nIndex,int ID)
+{
+	if(m_pHardware == NULL)
+		return;
+
+	int	nPos = m_ctrSlider[nIndex].GetPos();
+
+	m_nLampValue[nIndex] = nPos;		
+	
+	int		iCon;
+	int		iCh;
+
+	GetControl2ID(ID,iCon,iCh);
+	
+	if(m_pIV2P != NULL)
+	{
+		m_pIV2P->MLight_SetLightControlValue(iCon,iCh,nPos,TRUE);
+	}
+
+	Sleep(10);
+
+	UpdateData(FALSE);
+}
+
+void CViewLampControl::OnNMCustomdrawSlider1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+	
+	LampValueUpdate(0,IDC_EDIT_LAMP_VALUE_1);
+	*pResult = 0;
+}
+
+
+
+void CViewLampControl::OnNMCustomdrawSlider2(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+
+	LampValueUpdate(1,IDC_EDIT_LAMP_VALUE_2);
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMCustomdrawSlider3(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+
+	LampValueUpdate(2,IDC_EDIT_LAMP_VALUE_3);
+
+
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMCustomdrawSlider4(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+
+
+	LampValueUpdate(3,IDC_EDIT_LAMP_VALUE_4);
+
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMCustomdrawSlider5(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+
+
+	LampValueUpdate(4,IDC_EDIT_LAMP_VALUE_5);
+
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMCustomdrawSlider6(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+
+
+	LampValueUpdate(5,IDC_EDIT_LAMP_VALUE_6);
+
+	*pResult = 0;
+}
+void CViewLampControl::OnNMCustomdrawSlider7(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+
+
+	LampValueUpdate(6,IDC_EDIT_LAMP_VALUE_7);
+
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMCustomdrawSlider8(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+
+
+	LampValueUpdate(7,IDC_EDIT_LAMP_VALUE_8);
+
+	*pResult = 0;
+}
+
+
+void CViewLampControl::OnNMReleasedcaptureSlider1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	//SetLampMode(LAMP_MODE_REQ_CMD, 0);
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMReleasedcaptureSlider2(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	//SetLampMode(LAMP_MODE_REQ_CMD, 1);
+	*pResult = 0;
+}
+
+
+
+void CViewLampControl::OnNMReleasedcaptureSlider3(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	//SetLampMode(LAMP_MODE_REQ_CMD, 2);
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMReleasedcaptureSlider4(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	//SetLampMode(LAMP_MODE_REQ_CMD, 3);
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMReleasedcaptureSlider5(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	//SetLampMode(LAMP_MODE_REQ_CMD, 4);
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMReleasedcaptureSlider6(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	//SetLampMode(LAMP_MODE_REQ_CMD, 5);
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMReleasedcaptureSlider7(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	//SetLampMode(LAMP_MODE_REQ_CMD, 6);
+	*pResult = 0;
+}
+
+void CViewLampControl::OnNMReleasedcaptureSlider8(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	//SetLampMode(LAMP_MODE_REQ_CMD, 7);
+	*pResult = 0;
+}
+void CViewLampControl::SendLampControl(int nIndex)
+{
+	CString str;
+
+	int  nValue;
+	nValue = int(m_nLampValue[nIndex]/100.0 * LAMP_MAX_VALUE);
+	
+} 
+
+void CViewLampControl::OnDestroy()
+{
+	CDialog::OnDestroy();
+}
+
+void CViewLampControl::OnChangeEditLampValue1(){}//	SendLampControl(0);}
+void CViewLampControl::OnChangeEditLampValue2(){}//	SendLampControl(1);}
+void CViewLampControl::OnChangeEditLampValue3(){}//	SendLampControl(2);}
+void CViewLampControl::OnChangeEditLampValue4(){}//	SendLampControl(3);}
+void CViewLampControl::OnChangeEditLampValue5(){}//	SendLampControl(4);}
+void CViewLampControl::OnChangeEditLampValue6(){}//	SendLampControl(5);}
+void CViewLampControl::OnChangeEditLampValue7(){}//	SendLampControl(6);}
+void CViewLampControl::OnChangeEditLampValue8(){}//	SendLampControl(7);}
+
+
+void CViewLampControl::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	CDialog::OnShowWindow(bShow, nStatus);
+
+	if(bShow == TRUE)
+	{		
+		ClickChkLampOnOffButton();
+				
+		for(int i=0;i<8;i++)
+		{
+			LampValueUpdate(i,nIDLampVal[i]);
+		}	
+	}
+}
+
+
+void CViewLampControl::LampAllON()
+{
+	for(int i=0; i<8; i++)
+	{
+		int		iCon = i/LIGHT_CONTROL_CH_COUNT;
+		int		iCh = i%LIGHT_CONTROL_CH_COUNT;
+		
+		if(m_pIV2P != NULL)
+		{
+			m_pIV2P->MLight_OnOff(iCon,iCh,TRUE);
+		}
+		
+		Sleep(10);
+	}
+}
+
+void CViewLampControl::LampAllOFF()
+{
+	for(int i=0; i<8; i++)
+	{
+		int		iCon = i/LIGHT_CONTROL_CH_COUNT;
+		int		iCh = i%LIGHT_CONTROL_CH_COUNT;
+	
+		if(m_pIV2P != NULL)
+		{
+			m_pIV2P->MLight_OnOff(iCon,iCh,FALSE);
+		}
+
+		Sleep(10);
+	}
+}
+
+void CViewLampControl::EnableLampSlider(const bool bEnable)
+{
+	if(bEnable == false)
+	{
+		for(BYTE idx = 0; idx < 8; idx++)
+		{
+			m_ctrSlider[idx].EnableWindow(FALSE);
+		}
+	}
+	else
+	{
+		for(BYTE idx = 0; idx < 8; idx++)
+		{
+			m_ctrSlider[idx].EnableWindow(TRUE);
+		}
+	}
+}
+
+void CViewLampControl::OnTimer(UINT_PTR nIDEvent)
+{
+	
+	CDialog::OnTimer(nIDEvent);
+}
diff --git a/ENRIT/View/ViewLampControl.h b/ENRIT/View/ViewLampControl.h
new file mode 100644
index 0000000..feb6463
--- /dev/null
+++ b/ENRIT/View/ViewLampControl.h
@@ -0,0 +1,97 @@
+#pragma once
+#include "afxcmn.h"
+#include "ENRIT.h"
+#include "Global_Define.h"
+#include "btnenh.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "Glass_Data.h"
+// CViewLampControl 措拳 惑磊涝聪促.
+
+#define UM_LIGHT_APPLY_RECIPE (WM_USER + 4001)
+
+class		CGlassRecipe;
+class		CHardwareSettings;
+class CViewLampControl : public CDialog
+{
+	DECLARE_DYNAMIC(CViewLampControl)
+
+public:
+	CViewLampControl(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewLampControl();
+
+	// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_LAMP_CONTROL };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	void	ClickChkLampOnOffButton();
+	void	ClickChkCloseButton();
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+
+	virtual BOOL OnInitDialog();
+	afx_msg void OnNMCustomdrawSlider1(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMCustomdrawSlider2(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMCustomdrawSlider3(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMCustomdrawSlider4(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMCustomdrawSlider5(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMCustomdrawSlider6(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMCustomdrawSlider7(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMCustomdrawSlider8(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSlider1(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSlider2(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSlider3(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSlider4(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSlider5(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSlider6(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSlider7(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSlider8(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnDestroy();
+
+	afx_msg void OnBnClickedBtnLampClose();	
+	afx_msg void OnChangeEditLampValue1();
+	afx_msg void OnChangeEditLampValue2();
+	afx_msg void OnChangeEditLampValue3();
+	afx_msg void OnChangeEditLampValue4();
+	afx_msg void OnChangeEditLampValue5();
+	afx_msg void OnChangeEditLampValue6();
+	afx_msg void OnChangeEditLampValue7();
+	afx_msg void OnChangeEditLampValue8();
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	afx_msg void OnBnClickedButton1();
+	afx_msg void OnBnClickedButton2();	
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+
+public:
+	void				SetIV2P(IViewInterface2Parent *pIU2P){m_pIV2P=pIU2P;}
+	void				SetParent(CWnd *pWnd){m_pParent=pWnd;}
+	void				SetData(CGlassRecipe *pRecipe,CHardwareSettings *pHard);
+
+protected:	
+	enum			eViewLampOnOff {eRcp_OnOff_Use=0, eRcp_OnOff_End};
+	CBtnEnh			m_ctrlCmdOnOff[eRcp_OnOff_End];	
+	void			SetButtonOnOffEnable(const BOOL& bEnable);
+
+	void			GetControl2ID(UINT nID,int &iCon,int &iCh);
+
+	void LampValueUpdate(int nIndex,int ID);	
+	void SendLampControl(int nIndex);
+
+	void LampAllON();
+	void LampAllOFF();
+
+	void EnableLampSlider(const bool bEnable);	
+
+protected:		
+	IViewInterface2Parent			*m_pIV2P;
+	CGlassRecipe	*m_pRecipe;
+	CWnd				*m_pParent;
+	CHardwareSettings	*m_pHardware;
+	CSliderCtrl m_ctrSlider[8];
+	int			m_nLampValue[8];	
+	BOOL		m_Check_OnOff;
+	
+};
diff --git a/ENRIT/View/ViewLiveCam.cpp b/ENRIT/View/ViewLiveCam.cpp
new file mode 100644
index 0000000..9d1ebf9
--- /dev/null
+++ b/ENRIT/View/ViewLiveCam.cpp
@@ -0,0 +1,379 @@
+// ViewLiveCam.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewLiveCam.h"
+#include "afxdialogex.h"
+#include "Global_Define.h"
+
+// CViewLiveCam 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewLiveCam, CDialogEx)
+
+CViewLiveCam::CViewLiveCam(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewLiveCam::IDD, pParent)
+{
+	m_IV2M = NULL;
+	m_pGlassData = NULL;
+	m_pHardware = NULL;
+	for(int i=0;i<MAX_CAMERA_COUNT;i++)
+	{
+		m_dZoom[i] = 1;
+	}
+}
+
+CViewLiveCam::~CViewLiveCam()
+{
+}
+
+void CViewLiveCam::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Control(pDX, IDC_SCROLLBAR1			, m_ctrlScrollH[0]);
+	DDX_Control(pDX, IDC_SCROLLBAR2			, m_ctrlScrollH[1]);
+	DDX_Control(pDX, IDC_SCROLLBAR3			, m_ctrlScrollH[2]);
+	DDX_Control(pDX, IDC_SCROLLBAR4			, m_ctrlScrollH[3]);
+
+	CDialogEx::DoDataExchange(pDX);
+}
+		
+BEGIN_MESSAGE_MAP(CViewLiveCam, CDialogEx)
+	ON_MESSAGE(WM_LIVE_IMG_UPDATE	, OnLiveImgUpDate)
+	ON_WM_HSCROLL()
+	ON_WM_TIMER()
+	ON_WM_MOUSEWHEEL()	
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewLiveCam, CDialogEx)
+	ON_EVENT(CViewLiveCam, IDC_BTN_CAM_LIVE, DISPID_CLICK, CViewLiveCam::OnBnClickedBtnCamLive, VTS_NONE)
+	ON_EVENT(CViewLiveCam, IDC_BTN_STOP, DISPID_CLICK, CViewLiveCam::OnBnClickedBtnStop, VTS_NONE)
+	ON_EVENT(CViewLiveCam, IDC_RDO_SIGNAL1, DISPID_CLICK, CViewLiveCam::OnBnClickedRdoSignal1, VTS_NONE)
+	ON_EVENT(CViewLiveCam, IDC_RDO_SIGNAL2, DISPID_CLICK, CViewLiveCam::OnBnClickedRdoSignal2, VTS_NONE)
+	ON_EVENT(CViewLiveCam, IDC_BTN_CAM_SNAP, DISPID_CLICK, CViewLiveCam::OnBnClickedBtnCamSnap, VTS_NONE)	
+END_EVENTSINK_MAP()
+
+// CViewLiveCam 皋矫瘤 贸府扁涝聪促.
+int  CViewLiveCam::GetIndex(int nSide)
+{
+	int  nIndex = 0;
+
+	if(m_pHardware != NULL)
+	{
+		nIndex = m_pHardware->GetCameraIndexToDimension((DimensionDir)nSide);
+	}
+
+	return nIndex;
+}
+
+void CViewLiveCam::SetRecipe(CHardwareSettings *pHW)
+{
+	m_pHardware = pHW;
+
+	int nSide,i;
+	LPBYTE		plpBuf = NULL;
+	for(i = 0 ; i < 4 ; i++)
+	{
+		nSide = LiveGetSideIdx(i);
+
+		m_frameImg[i].SetSide(nSide);
+
+		plpBuf = NULL;
+		if(m_IV2M != NULL)
+			plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)nSide,0);
+		m_frameImg[i].SetImage(plpBuf);
+		m_frameImg[i].SetGlassData(m_pGlassData);	
+	}
+}
+
+BOOL CViewLiveCam::OnInitDialog()
+{	
+	UpdateData(FALSE);
+
+	CRect rc[4];
+	int i =0;
+
+
+	GetDlgItem(IDC_STATIC_CAM1)->GetWindowRect(rc[0]);
+	GetDlgItem(IDC_STATIC_CAM2)->GetWindowRect(rc[1]);
+	GetDlgItem(IDC_STATIC_CAM3)->GetWindowRect(rc[2]);
+	GetDlgItem(IDC_STATIC_CAM4)->GetWindowRect(rc[3]);
+		
+	for(i = 0 ; i < 4 ; i++)
+	{
+		ScreenToClient(rc[i]);		
+		m_frameImg[i].InitBitMap();
+		
+		m_frameImg[i].Create(NULL,NULL,WS_VISIBLE | WS_CHILD,rc[i],this,0);			
+
+		m_dZoom[i] = 1;
+		m_frameImg[i].SetZommMode(m_dZoom[i]);
+		m_frameImg[i].ViewUpdate();
+	}
+	InitScrollInfo(-1);
+
+	return TRUE;
+}
+
+int CViewLiveCam::LiveGetSideIdx(int nViewIndex)
+{
+	if(m_pHardware == NULL)
+		return 0;
+		
+	CCameraSettings *pCamera = NULL;
+
+	pCamera = m_pHardware->GetCameraSettings(nViewIndex,0);
+	if(pCamera == NULL)
+		return 0;
+
+	return (int)pCamera->m_eDimension;
+}
+
+BOOL CViewLiveCam::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+void CViewLiveCam::OnBnClickedBtnCamLive()
+{	
+	OnBnClickedBtnStop();
+	
+	int nDisplayFrame = 0;
+	if(m_nRdoSignal == 0)
+	{
+		nDisplayFrame = 20;
+	}	
+
+	if(m_IV2M != NULL)
+	{
+		m_IV2M->IV2M_SetLiveGrabCommand((DimensionDir)LiveGetSideIdx(0),FALSE);
+		m_IV2M->IV2M_SetLiveGrabCommand((DimensionDir)LiveGetSideIdx(1),FALSE);
+		m_IV2M->IV2M_SetLiveGrabCommand((DimensionDir)LiveGetSideIdx(2),FALSE);
+		m_IV2M->IV2M_SetLiveGrabCommand((DimensionDir)LiveGetSideIdx(3),FALSE);
+	}
+
+	SetTimer(1,100,NULL);	
+}
+
+void CViewLiveCam::OnTimer(UINT_PTR nIDEvent)
+{
+	for(int i = 0 ; i < 4 ; i++)
+	{
+		m_frameImg[i].ViewUpdate();
+	}
+
+	CDialogEx::OnTimer(nIDEvent);
+}
+
+void CViewLiveCam::OnBnClickedBtnStop()
+{
+	if(m_IV2M != NULL)
+	{
+		m_IV2M->IV2M_SetLiveGrabCommand((DimensionDir)LiveGetSideIdx(0),TRUE);
+		m_IV2M->IV2M_SetLiveGrabCommand((DimensionDir)LiveGetSideIdx(1),TRUE);
+		m_IV2M->IV2M_SetLiveGrabCommand((DimensionDir)LiveGetSideIdx(2),TRUE);
+		m_IV2M->IV2M_SetLiveGrabCommand((DimensionDir)LiveGetSideIdx(3),TRUE);
+	}
+	
+	KillTimer(1);
+}
+
+void CViewLiveCam::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+
+	int nIndex;
+
+	if(pScrollBar->m_hWnd		== m_ctrlScrollH[0].m_hWnd)
+	{
+		nIndex = 0;
+	}
+	else if(pScrollBar->m_hWnd	== m_ctrlScrollH[1].m_hWnd)
+	{
+		nIndex = 1;
+	}
+	else if(pScrollBar->m_hWnd	== m_ctrlScrollH[2].m_hWnd)
+	{
+		nIndex = 2;
+	}
+	else if(pScrollBar->m_hWnd	== m_ctrlScrollH[3].m_hWnd)
+	{
+		nIndex = 3;
+	}
+
+
+	if(nIndex != -1)
+	{
+		SCROLLINFO si;
+		si.fMask=SIF_ALL;
+		m_ctrlScrollH[nIndex].GetScrollInfo(&si,SIF_ALL);
+
+		switch(nSBCode)
+		{
+		case SB_LINEUP:
+			si.nPos--;
+			break;
+		case SB_LINEDOWN:
+			si.nPos++;
+			break;
+		case SB_PAGEUP:
+			si.nPos-=si.nPage;
+			break;
+		case SB_PAGEDOWN:
+			si.nPos+=si.nPage;
+			break;
+		case SB_THUMBTRACK:
+			si.nPos=nPos;			
+			break;
+		}
+
+		if(si.nPos>(int)(si.nMax-si.nMin-si.nPage+1)) si.nPos=si.nMax-si.nMin-si.nPage+1;
+		if(si.nPos<si.nMin) si.nPos=si.nMin;
+		si.fMask=SIF_POS;
+		m_ctrlScrollH[nIndex].SetScrollInfo(&si);	
+
+		m_frameImg[nIndex].m_ptOrg.x = si.nPos;
+		
+		PostMessage(WM_LIVE_IMG_UPDATE,NULL,nIndex);
+
+	}
+	CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CViewLiveCam::InitScrollInfo(int nCam /*= -1*/)
+{
+	int i =0;
+	SCROLLINFO scrollInfoH;
+
+	scrollInfoH.cbSize		= sizeof(SCROLLINFO);
+	scrollInfoH.fMask		= SIF_ALL;
+	scrollInfoH.nMin		= 1;
+	scrollInfoH.nPos		= 1;
+	scrollInfoH.nTrackPos	= 64;
+
+
+	scrollInfoH.nMax	= IMAGE_WIDTH;	
+
+	if(nCam == -1)
+	{
+		for(i = 0 ; i < 4 ; i++)
+		{
+			double dZoom = m_frameImg[i].GetZoomData();
+			scrollInfoH.nPage	= (int)(m_frameImg[i].m_WndRect.Width() / dZoom);
+
+			m_ctrlScrollH[i].SetScrollPos(0);
+			m_ctrlScrollH[i].SetScrollInfo(&scrollInfoH);
+		}
+	}
+	else
+	{
+		double dZoom = m_frameImg[nCam].GetZoomData();
+		scrollInfoH.nPage	= (int)(m_frameImg[nCam].m_WndRect.Width() / dZoom);
+
+		m_ctrlScrollH[nCam].SetScrollPos(0);
+		m_ctrlScrollH[nCam].SetScrollInfo(&scrollInfoH);
+	}
+}
+
+void CViewLiveCam::OnBnClickedRdoSignal1()
+{
+	m_nRdoSignal = 0;
+
+	OnBnClickedBtnStop();
+}
+
+
+void CViewLiveCam::OnBnClickedRdoSignal2()
+{
+	m_nRdoSignal = 1;
+	OnBnClickedBtnStop();
+}
+
+
+
+void CViewLiveCam::OnBnClickedBtnCamSnap()
+{
+	OnBnClickedBtnStop();
+}
+
+LRESULT CViewLiveCam::OnLiveImgUpDate(WPARAM wParam, LPARAM lParam)
+{
+	int nIndex  = int(lParam);	
+
+	m_frameImg[nIndex].ViewUpdate();
+
+	return 0;
+}
+
+BOOL CViewLiveCam::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+{
+	// TODO: Add your message handler code here and/or call default
+
+	CPoint		point = pt;
+	int			nIndex = -1;
+	CRect		rect;
+
+	ScreenToClient(&point);
+	for(int i = 0; i < MAX_CAMERA_COUNT;i++)
+	{
+		m_frameImg[i].GetWindowRect(rect);
+		ScreenToClient(&rect);
+
+		if(rect.PtInRect(point) == TRUE)
+		{
+			nIndex = i;
+			break;
+		}
+	}
+
+	if(nIndex == -1)
+		return 1;
+
+	if(zDelta > 0)
+	{
+		m_dZoom[nIndex] += 0.1;	
+
+		if(m_dZoom[nIndex] > 4)
+			m_dZoom[nIndex] = 4;
+	}
+	else
+	{
+		m_dZoom[nIndex] -= 0.1;	
+
+		if(m_dZoom[nIndex] < 0.1)
+			m_dZoom[nIndex] = 0.1;
+	}
+
+	UpdateZoom(nIndex);
+
+	return CDialogEx::OnMouseWheel(nFlags, zDelta, pt);
+}
+
+void CViewLiveCam::UpdateZoom(int nIndex)
+{
+	if(nIndex == -1)
+	{
+		for(int i = 0; i < MAX_CAMERA_COUNT;i++)
+		{
+			m_frameImg[i].SetZommMode(m_dZoom[i]);		
+			InitScrollInfo(-1);
+			m_frameImg[i].Invalidate(FALSE);
+		}	
+	}
+	else
+	{
+		m_frameImg[nIndex].SetZommMode(m_dZoom[nIndex]);		
+		InitScrollInfo(nIndex);
+		m_frameImg[nIndex].Invalidate(FALSE);
+	}
+}
\ No newline at end of file
diff --git a/ENRIT/View/ViewLiveCam.h b/ENRIT/View/ViewLiveCam.h
new file mode 100644
index 0000000..a3d158d
--- /dev/null
+++ b/ENRIT/View/ViewLiveCam.h
@@ -0,0 +1,55 @@
+#pragma once
+
+#include "FrameImg.h"
+// CViewLiveCam 措拳 惑磊涝聪促.
+
+class CHardwareSettings;
+class CGlass_Data;
+class CViewLiveCam : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewLiveCam)
+
+public:
+	CViewLiveCam(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewLiveCam();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_LIVECAM_VIEW };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);	
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	LRESULT OnLiveImgUpDate(WPARAM wParam, LPARAM lParam);
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+	void			SetRecipe(CHardwareSettings *pHW);
+	void			SetV2M(IViewInterface2Parent* pV2M){m_IV2M=pV2M;}
+	void			SetGlassData(CGlass_Data *pGlass){m_pGlassData = pGlass;}
+
+protected:
+	void			OnBnClickedBtnCamLive();
+	void			OnBnClickedBtnStop();
+	void			OnBnClickedRdoSignal1();
+	void			OnBnClickedRdoSignal2();
+	void			OnBnClickedBtnCamSnap();
+
+	void			InitScrollInfo(int nCam /*= -1*/);	
+	int				GetIndex(int nSide);
+	int				LiveGetSideIdx(int nViewIndex);
+	void			UpdateZoom(int nIndex);
+
+protected:
+	CFrameImg		m_frameImg[4];
+	CScrollBar		m_ctrlScrollH[4];	
+	CHardwareSettings		*m_pHardware;
+	CGlass_Data				*m_pGlassData;
+	IViewInterface2Parent	*m_IV2M;
+	double			m_dZoom[MAX_CAMERA_COUNT];
+	int				m_nRdoSignal;
+};
diff --git a/ENRIT/View/ViewMapSettings.cpp b/ENRIT/View/ViewMapSettings.cpp
new file mode 100644
index 0000000..f843fea
--- /dev/null
+++ b/ENRIT/View/ViewMapSettings.cpp
@@ -0,0 +1,289 @@
+// ViewMapSettings.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewMapSettings.h"
+#include "afxdialogex.h"
+
+#define GRID_FIX_COLOR			RGB(144,200,246)
+#define GRID_COLOR				RGB(242,242,242)
+#define GRID_TEXT_COLOR			RGB(255,255,255)
+#define GRID_LINE_COLOR			GRID_FIX_COLOR
+// CViewMapSettings 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewMapSettings, CDialogEx)
+
+CViewMapSettings::CViewMapSettings(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewMapSettings::IDD, pParent)
+{
+
+}
+
+CViewMapSettings::~CViewMapSettings()
+{
+}
+
+void CViewMapSettings::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Control(pDX,IDC_GRD_CF_MAPSETTINGS,m_MapGrid[0]);
+	DDX_Control(pDX,IDC_GRD_TFT_MAPSETTINGS,m_MapGrid[1]);
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewMapSettings, CDialogEx)
+	ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewMapSettings, CDialogEx)
+	ON_EVENT(CViewMapSettings, IDC_BTN_MAPSETTINGS_SAVE, DISPID_CLICK, CViewMapSettings::ClickMapSettinsSave, VTS_NONE)
+	ON_EVENT(CViewMapSettings, IDC_BTN_MAPSETTINGS_CLOSE, DISPID_CLICK, CViewMapSettings::OnClickMapSettinsClose, VTS_NONE)
+END_EVENTSINK_MAP()
+
+BOOL CViewMapSettings::OnInitDialog()
+{
+	UpdateData(FALSE);
+
+	Init_Grid();
+
+	ZeroMemory(&m_MapsSettings,sizeof(_ST_MAPSETTINGS));
+
+	return TRUE;
+}
+
+void CViewMapSettings::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		LoadMapSettings(m_MapsSettings);
+		Fill_Grid(TRUE);
+	}
+}
+
+void CViewMapSettings::LoadMapSettings(_ST_MAPSETTINGS &MapSettings)
+{
+	CString		strTaget = _T("C:\\RCutProject\\Config\\MapSettings.cfg");
+
+	CFileFind findFile;
+	BOOL bFind = findFile.FindFile(strTaget);
+	if(bFind == FALSE)
+		return;
+
+	CConfig Config;
+	CString	str;
+
+	if (!Config.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strTaget, FileMap_Mode))
+		return;
+
+	for(int k=0;k<2;k++)
+	{
+		for(int i=0;i<5;i++)
+		{
+			for(int j=0;j<4;j++)
+			{
+				str.Format(_T("MAP_%d_%d_%d"),k,i,j);
+				Config.GetItemValue((TCHAR*)(LPCTSTR)str, MapSettings.m_nMapIndex[k].m_nIndex[i][j]);
+			}
+		}	
+	}
+}
+
+void CViewMapSettings::SaveMapSettings(_ST_MAPSETTINGS MapSettings)
+{
+	CConfig Config;
+	CString	str;
+
+	CString		strTaget = _T("C:\\RCutProject\\Config\\MapSettings.cfg");	
+
+	Config.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strTaget, FileMap_Mode);	
+
+	Config.SetRewriteMode(FALSE);
+
+	for(int k=0;k<2;k++)
+	{
+		for(int i=0;i<5;i++)
+		{
+			for(int j=0;j<4;j++)
+			{
+				str.Format(_T("MAP_%d_%d_%d"),k,i,j);
+				Config.SetItemValue((TCHAR*)(LPCTSTR)str, MapSettings.m_nMapIndex[k].m_nIndex[i][j]);
+			}
+		}	
+	}
+
+	Config.WriteToFile();
+}
+
+void CViewMapSettings::ClickMapSettinsSave()
+{
+	Fill_Grid(FALSE);
+
+	SaveMapSettings(m_MapsSettings);
+
+	CDialogEx::OnOK();
+}
+
+void CViewMapSettings::OnClickMapSettinsClose()
+{
+	CDialogEx::OnCancel();
+}
+
+BOOL CViewMapSettings::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+// CViewMapSettings 皋矫瘤 贸府扁涝聪促.
+void CViewMapSettings::Init_Grid()
+{
+	for(int i=0;i<2;i++)
+	{
+		if(m_MapGrid[i].GetSafeHwnd() == NULL)
+			continue;
+
+		m_MapGrid[i].GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
+		m_MapGrid[i].GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
+		m_MapGrid[i].GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
+		m_MapGrid[i].SetFixedBkColor(GRID_FIX_COLOR);
+		m_MapGrid[i].SetGridLines(GVL_BOTH);	
+
+		m_MapGrid[i].SetColumnCount(5);
+		m_MapGrid[i].SetRowCount(6);
+		m_MapGrid[i].SetFixedRowCount(1);
+		m_MapGrid[i].SetFixedColumnCount(1);
+		m_MapGrid[i].ExpandColumnsToFit();
+
+		CFont *pFont = m_MapGrid[i].GetFont();
+		if (!pFont) 
+			return;
+
+		LOGFONT lf;	
+		pFont->GetLogFont(&lf);
+		lf.lfItalic = 0;
+		lf.lfHeight = 14;
+		lf.lfWeight = FW_BOLD;
+		_tcscpy(lf.lfFaceName, _T("Arial"));
+
+		m_MapGrid[i].GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+		m_MapGrid[i].GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+		m_MapGrid[i].GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+		m_MapGrid[i].SetEditable(TRUE);
+		m_MapGrid[i].EnableSelection(TRUE);
+
+		Init_GridHeader(&m_MapGrid[i]);
+	}
+}
+
+void CViewMapSettings::Init_GridHeader(CGridCtrl *pGrid)
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+	
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	Item.col = 0;
+
+	Item.strText = _T("Side");
+	pGrid->SetItem(&Item);	
+
+	nCol = 1;
+	for(iLoop=0;iLoop<5;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText.Format(_T("%d"),iLoop+1);
+		pGrid->SetItem(&Item);	
+	}
+		
+	Item.col = 0;
+	Item.row = 1;
+	Item.strText.Format(_T("A"));
+	pGrid->SetItem(&Item);	
+
+	Item.row = 2;
+	Item.strText.Format(_T("B"));
+	pGrid->SetItem(&Item);
+
+	Item.row = 3;
+	Item.strText.Format(_T("C"));
+	pGrid->SetItem(&Item);
+
+	Item.row = 4;
+	Item.strText.Format(_T("D"));
+	pGrid->SetItem(&Item);
+
+	Item.row = 5;
+	Item.strText.Format(_T("RCut"));
+	pGrid->SetItem(&Item);
+
+	pGrid->Invalidate();
+}
+
+void CViewMapSettings::Fill_Grid(BOOL bWrite)
+{
+	int			iRow,iCol;
+	int			*pIndex;
+	CString		str;
+
+	if(bWrite == TRUE)
+	{
+		for(int i=0;i<2;i++)
+		{
+			if(m_MapGrid[i].GetSafeHwnd() == NULL)
+				continue;			
+			
+			iRow = 1;
+			for(int k=0;k<5;k++)
+			{
+				pIndex = m_MapsSettings.m_nMapIndex[i].m_nIndex[k];
+
+				iCol = 1;
+				for(int j=0;j<4;j++)
+				{
+					str.Format(_T("%d"),pIndex[j]);
+					m_MapGrid[i].SetItemText(iRow,iCol,str);
+					iCol++;
+				}
+				iRow++;
+			}		
+
+			m_MapGrid[i].Invalidate();
+		}
+	}	
+	else
+	{
+		for(int i=0;i<2;i++)
+		{
+			if(m_MapGrid[i].GetSafeHwnd() == NULL)
+				continue;			
+
+			iRow = 1;
+			for(int k=0;k<5;k++)
+			{
+				pIndex = m_MapsSettings.m_nMapIndex[i].m_nIndex[k];
+
+				iCol = 1;
+				for(int j=0;j<4;j++)
+				{
+					str = m_MapGrid[i].GetItemText(iRow,iCol);
+					pIndex[j] = _ttoi(str);
+					iCol++;
+				}
+				iRow++;
+			}			
+		}
+	}
+}
\ No newline at end of file
diff --git a/ENRIT/View/ViewMapSettings.h b/ENRIT/View/ViewMapSettings.h
new file mode 100644
index 0000000..599e8d5
--- /dev/null
+++ b/ENRIT/View/ViewMapSettings.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "btnenh.h"
+#include "Global_Define.h"
+// CViewMapSettings 措拳 惑磊涝聪促.
+
+class CViewMapSettings : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewMapSettings)
+
+public:
+	CViewMapSettings(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewMapSettings();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_MAP_SETTINGS };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	void ClickMapSettinsSave();
+	void OnClickMapSettinsClose();
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+	void				LoadMapSettings(_ST_MAPSETTINGS &MapSettings);
+	void				SaveMapSettings(_ST_MAPSETTINGS MapSettings);
+	_ST_MAPSETTINGS		*GetMapData(){return &m_MapsSettings;}
+
+protected:
+	void				Init_Grid();
+	void				Init_GridHeader(CGridCtrl *pGrid);
+	void				Fill_Grid(BOOL bWrite);
+
+protected:
+	CGridCtrl			m_MapGrid[2];
+	_ST_MAPSETTINGS		m_MapsSettings;
+};
diff --git a/ENRIT/View/ViewPPIDNew.cpp b/ENRIT/View/ViewPPIDNew.cpp
new file mode 100644
index 0000000..f59ed9c
--- /dev/null
+++ b/ENRIT/View/ViewPPIDNew.cpp
@@ -0,0 +1,90 @@
+
+#include "stdafx.h"
+#include "ViewPPIDNew.h"
+
+
+// CViewPPIDNew 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewPPIDNew, CDialog)
+
+CViewPPIDNew::CViewPPIDNew(CWnd* pParent /*=NULL*/)
+	: CDialog(CViewPPIDNew::IDD, pParent)
+{
+	
+}
+
+CViewPPIDNew::~CViewPPIDNew()
+{
+}
+
+void CViewPPIDNew::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Text(pDX,IDC_EDIT_PPIDNEW_NAME,m_strNewRecipeName);
+
+	CDialog::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewPPIDNew, CDialog)
+	ON_WM_PAINT()
+	ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewPPIDNew, CDialog)
+	ON_EVENT(CViewPPIDNew, IDC_BTN_PPIDNEW_OK, DISPID_CLICK, CViewPPIDNew::ClickBtnPpidnewOk, VTS_NONE)
+	ON_EVENT(CViewPPIDNew, IDC_BTN_PPIDNEW_CANCEL, DISPID_CLICK, CViewPPIDNew::ClickBtnPpidnewCancel, VTS_NONE)
+END_EVENTSINK_MAP()
+
+// CViewPPIDNew 皋矫瘤 贸府扁涝聪促.
+
+BOOL CViewPPIDNew::OnInitDialog()
+{
+	m_FontControl.SetFont(this,IDC_EDIT_PPIDNEW_NAME,CFontControl::EN_BUTTONFONT);
+
+	return TRUE;
+}
+
+void CViewPPIDNew::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	
+	CGeneralDraw			pDraw;
+
+	CUIPictureControl		uiTitleRecipeName;
+	
+	uiTitleRecipeName.SetItemDefault(this,IDC_NEWPPID_NAME_TITLE);	
+	uiTitleRecipeName.m_nFontsize = 24;
+	uiTitleRecipeName.m_strData.Format(_T("%s"),_T("New PPID Name"));
+
+	pDraw.DrawPitureControl(uiTitleRecipeName);
+}
+
+void CViewPPIDNew::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	CDialog::OnShowWindow(bShow, nStatus);
+
+	if(bShow == TRUE)
+	{
+		((CWnd*)GetDlgItem(IDC_EDIT_PPIDNEW_NAME))->SetFocus();
+	}
+}
+
+void CViewPPIDNew::ClickBtnPpidnewOk()
+{
+	UpdateData(TRUE);
+
+	if(m_strNewRecipeName.IsEmpty() == TRUE)
+	{
+		AfxMessageBox(_T("Input Recipe Name"));
+		((CWnd*)GetDlgItem(IDC_EDIT_PPIDNEW_NAME))->SetFocus();
+		return;
+	}
+
+	OnOK();
+}
+
+
+void CViewPPIDNew::ClickBtnPpidnewCancel()
+{
+	OnCancel();
+}
diff --git a/ENRIT/View/ViewPPIDNew.h b/ENRIT/View/ViewPPIDNew.h
new file mode 100644
index 0000000..fbf4c6e
--- /dev/null
+++ b/ENRIT/View/ViewPPIDNew.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "ENRIT.h"
+#include "General_Draw.h"
+// CViewPPIDNew 措拳 惑磊涝聪促.
+
+class CViewPPIDNew : public CDialog
+{
+	DECLARE_DYNAMIC(CViewPPIDNew)
+
+public:
+	CViewPPIDNew(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewPPIDNew();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_PPID_NEW };
+
+protected:
+	virtual BOOL OnInitDialog();
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	DECLARE_MESSAGE_MAP()
+
+public:
+	CString			GetNewRecipeName(){return m_strNewRecipeName;}
+
+protected:
+	CString				m_strNewRecipeName;	
+	CFontControl		m_FontControl;
+
+public:
+	afx_msg void OnPaint();
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	DECLARE_EVENTSINK_MAP()
+	void ClickBtnPpidnewOk();
+	void ClickBtnPpidnewCancel();
+};
diff --git a/ENRIT/View/ViewRecipeChamferView.cpp b/ENRIT/View/ViewRecipeChamferView.cpp
new file mode 100644
index 0000000..b60c2fe
--- /dev/null
+++ b/ENRIT/View/ViewRecipeChamferView.cpp
@@ -0,0 +1,256 @@
+// ViewRecipeChamferView.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewRecipeChamferView.h"
+#include "afxdialogex.h"
+#include "Global_Define.h"
+
+UINT		nID_ChamferRef[]={IDC_EDIT_CHAMFER_SETTING_REF_1,IDC_EDIT_CHAMFER_SETTING_REF_2,IDC_EDIT_CHAMFER_SETTING_REF_3,IDC_EDIT_CHAMFER_SETTING_REF_4,IDC_EDIT_CHAMFER_SETTING_REF_5
+	,IDC_EDIT_CHAMFER_SETTING_REF_6,IDC_EDIT_CHAMFER_SETTING_REF_7,IDC_EDIT_CHAMFER_SETTING_REF_8,IDC_EDIT_CHAMFER_SETTING_REF_9,IDC_EDIT_CHAMFER_SETTING_REF_10
+	,IDC_EDIT_CHAMFER_SETTING_REF_11,IDC_EDIT_CHAMFER_SETTING_REF_12,IDC_EDIT_CHAMFER_SETTING_REF_13,IDC_EDIT_CHAMFER_SETTING_REF_14,IDC_EDIT_CHAMFER_SETTING_REF_15
+	,IDC_EDIT_CHAMFER_SETTING_REF_16,IDC_EDIT_CHAMFER_SETTING_REF_17,IDC_EDIT_CHAMFER_SETTING_REF_18,IDC_EDIT_CHAMFER_SETTING_REF_19,IDC_EDIT_CHAMFER_SETTING_REF_20
+	,IDC_EDIT_CHAMFER_SETTING_REF_21,IDC_EDIT_CHAMFER_SETTING_REF_22,IDC_EDIT_CHAMFER_SETTING_REF_23,IDC_EDIT_CHAMFER_SETTING_REF_24,IDC_EDIT_CHAMFER_SETTING_REF_25
+	,IDC_EDIT_CHAMFER_SETTING_REF_26,IDC_EDIT_CHAMFER_SETTING_REF_27,IDC_EDIT_CHAMFER_SETTING_REF_28,IDC_EDIT_CHAMFER_SETTING_REF_29,IDC_EDIT_CHAMFER_SETTING_REF_30
+	,IDC_EDIT_CHAMFER_SETTING_REF_31,IDC_EDIT_CHAMFER_SETTING_REF_32,IDC_EDIT_CHAMFER_SETTING_REF_33,IDC_EDIT_CHAMFER_SETTING_REF_34,IDC_EDIT_CHAMFER_SETTING_REF_35
+	,IDC_EDIT_CHAMFER_SETTING_REF_36,IDC_EDIT_CHAMFER_SETTING_REF_37,IDC_EDIT_CHAMFER_SETTING_REF_38,IDC_EDIT_CHAMFER_SETTING_REF_39,IDC_EDIT_CHAMFER_SETTING_REF_40
+	,IDC_EDIT_CHAMFER_SETTING_REF_41,IDC_EDIT_CHAMFER_SETTING_REF_42,IDC_EDIT_CHAMFER_SETTING_REF_43,IDC_EDIT_CHAMFER_SETTING_REF_44,IDC_EDIT_CHAMFER_SETTING_REF_45
+	,IDC_EDIT_CHAMFER_SETTING_REF_46,IDC_EDIT_CHAMFER_SETTING_REF_47,IDC_EDIT_CHAMFER_SETTING_REF_48,IDC_EDIT_CHAMFER_SETTING_REF_49,IDC_EDIT_CHAMFER_SETTING_REF_50
+	,IDC_EDIT_CHAMFER_SETTING_REF_51,IDC_EDIT_CHAMFER_SETTING_REF_52,IDC_EDIT_CHAMFER_SETTING_REF_53,IDC_EDIT_CHAMFER_SETTING_REF_54,IDC_EDIT_CHAMFER_SETTING_REF_55
+	,IDC_EDIT_CHAMFER_SETTING_REF_56,IDC_EDIT_CHAMFER_SETTING_REF_57,IDC_EDIT_CHAMFER_SETTING_REF_58,IDC_EDIT_CHAMFER_SETTING_REF_59,IDC_EDIT_CHAMFER_SETTING_REF_60
+	,IDC_EDIT_CHAMFER_SETTING_REF_61,IDC_EDIT_CHAMFER_SETTING_REF_62,IDC_EDIT_CHAMFER_SETTING_REF_63,IDC_EDIT_CHAMFER_SETTING_REF_64,IDC_EDIT_CHAMFER_SETTING_REF_65
+	,IDC_EDIT_CHAMFER_SETTING_REF_66,IDC_EDIT_CHAMFER_SETTING_REF_67,IDC_EDIT_CHAMFER_SETTING_REF_68,IDC_EDIT_CHAMFER_SETTING_REF_69,IDC_EDIT_CHAMFER_SETTING_REF_70
+	,IDC_EDIT_CHAMFER_SETTING_REF_71,IDC_EDIT_CHAMFER_SETTING_REF_72,IDC_EDIT_CHAMFER_SETTING_REF_73,IDC_EDIT_CHAMFER_SETTING_REF_74,IDC_EDIT_CHAMFER_SETTING_REF_75
+	,IDC_EDIT_CHAMFER_SETTING_REF_76,IDC_EDIT_CHAMFER_SETTING_REF_77,IDC_EDIT_CHAMFER_SETTING_REF_78,IDC_EDIT_CHAMFER_SETTING_REF_79};
+
+UINT		nID_ChamferPlus[]={IDC_EDIT_CHAMFER_SETTING_PLUS_1,IDC_EDIT_CHAMFER_SETTING_PLUS_2,IDC_EDIT_CHAMFER_SETTING_PLUS_3,IDC_EDIT_CHAMFER_SETTING_PLUS_4,IDC_EDIT_CHAMFER_SETTING_PLUS_5
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_6,IDC_EDIT_CHAMFER_SETTING_PLUS_7,IDC_EDIT_CHAMFER_SETTING_PLUS_8,IDC_EDIT_CHAMFER_SETTING_PLUS_9,IDC_EDIT_CHAMFER_SETTING_PLUS_10
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_11,IDC_EDIT_CHAMFER_SETTING_PLUS_12,IDC_EDIT_CHAMFER_SETTING_PLUS_13,IDC_EDIT_CHAMFER_SETTING_PLUS_14,IDC_EDIT_CHAMFER_SETTING_PLUS_15
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_16,IDC_EDIT_CHAMFER_SETTING_PLUS_17,IDC_EDIT_CHAMFER_SETTING_PLUS_18,IDC_EDIT_CHAMFER_SETTING_PLUS_19,IDC_EDIT_CHAMFER_SETTING_PLUS_20
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_21,IDC_EDIT_CHAMFER_SETTING_PLUS_22,IDC_EDIT_CHAMFER_SETTING_PLUS_23,IDC_EDIT_CHAMFER_SETTING_PLUS_24,IDC_EDIT_CHAMFER_SETTING_PLUS_25
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_26,IDC_EDIT_CHAMFER_SETTING_PLUS_27,IDC_EDIT_CHAMFER_SETTING_PLUS_28,IDC_EDIT_CHAMFER_SETTING_PLUS_29,IDC_EDIT_CHAMFER_SETTING_PLUS_30
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_31,IDC_EDIT_CHAMFER_SETTING_PLUS_32,IDC_EDIT_CHAMFER_SETTING_PLUS_33,IDC_EDIT_CHAMFER_SETTING_PLUS_34,IDC_EDIT_CHAMFER_SETTING_PLUS_35
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_36,IDC_EDIT_CHAMFER_SETTING_PLUS_37,IDC_EDIT_CHAMFER_SETTING_PLUS_38,IDC_EDIT_CHAMFER_SETTING_PLUS_39,IDC_EDIT_CHAMFER_SETTING_PLUS_40
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_41,IDC_EDIT_CHAMFER_SETTING_PLUS_42,IDC_EDIT_CHAMFER_SETTING_PLUS_43,IDC_EDIT_CHAMFER_SETTING_PLUS_44,IDC_EDIT_CHAMFER_SETTING_PLUS_45
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_46,IDC_EDIT_CHAMFER_SETTING_PLUS_47,IDC_EDIT_CHAMFER_SETTING_PLUS_48,IDC_EDIT_CHAMFER_SETTING_PLUS_49,IDC_EDIT_CHAMFER_SETTING_PLUS_50
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_51,IDC_EDIT_CHAMFER_SETTING_PLUS_52,IDC_EDIT_CHAMFER_SETTING_PLUS_53,IDC_EDIT_CHAMFER_SETTING_PLUS_54,IDC_EDIT_CHAMFER_SETTING_PLUS_55
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_56,IDC_EDIT_CHAMFER_SETTING_PLUS_57,IDC_EDIT_CHAMFER_SETTING_PLUS_58,IDC_EDIT_CHAMFER_SETTING_PLUS_59,IDC_EDIT_CHAMFER_SETTING_PLUS_60
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_61,IDC_EDIT_CHAMFER_SETTING_PLUS_62,IDC_EDIT_CHAMFER_SETTING_PLUS_63,IDC_EDIT_CHAMFER_SETTING_PLUS_64,IDC_EDIT_CHAMFER_SETTING_PLUS_65
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_66,IDC_EDIT_CHAMFER_SETTING_PLUS_67,IDC_EDIT_CHAMFER_SETTING_PLUS_68,IDC_EDIT_CHAMFER_SETTING_PLUS_69,IDC_EDIT_CHAMFER_SETTING_PLUS_70
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_71,IDC_EDIT_CHAMFER_SETTING_PLUS_72,IDC_EDIT_CHAMFER_SETTING_PLUS_73,IDC_EDIT_CHAMFER_SETTING_PLUS_74,IDC_EDIT_CHAMFER_SETTING_PLUS_75
+	,IDC_EDIT_CHAMFER_SETTING_PLUS_76,IDC_EDIT_CHAMFER_SETTING_PLUS_77,IDC_EDIT_CHAMFER_SETTING_PLUS_78,IDC_EDIT_CHAMFER_SETTING_PLUS_79};
+
+UINT		nID_ChamferMinus[]={IDC_EDIT_CHAMFER_SETTING_MINUS_1,IDC_EDIT_CHAMFER_SETTING_MINUS_2,IDC_EDIT_CHAMFER_SETTING_MINUS_3,IDC_EDIT_CHAMFER_SETTING_MINUS_4,IDC_EDIT_CHAMFER_SETTING_MINUS_5
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_6,IDC_EDIT_CHAMFER_SETTING_MINUS_7,IDC_EDIT_CHAMFER_SETTING_MINUS_8,IDC_EDIT_CHAMFER_SETTING_MINUS_9,IDC_EDIT_CHAMFER_SETTING_MINUS_10
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_11,IDC_EDIT_CHAMFER_SETTING_MINUS_12,IDC_EDIT_CHAMFER_SETTING_MINUS_13,IDC_EDIT_CHAMFER_SETTING_MINUS_14,IDC_EDIT_CHAMFER_SETTING_MINUS_15
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_16,IDC_EDIT_CHAMFER_SETTING_MINUS_17,IDC_EDIT_CHAMFER_SETTING_MINUS_18,IDC_EDIT_CHAMFER_SETTING_MINUS_19,IDC_EDIT_CHAMFER_SETTING_MINUS_20
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_21,IDC_EDIT_CHAMFER_SETTING_MINUS_22,IDC_EDIT_CHAMFER_SETTING_MINUS_23,IDC_EDIT_CHAMFER_SETTING_MINUS_24,IDC_EDIT_CHAMFER_SETTING_MINUS_25
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_26,IDC_EDIT_CHAMFER_SETTING_MINUS_27,IDC_EDIT_CHAMFER_SETTING_MINUS_28,IDC_EDIT_CHAMFER_SETTING_MINUS_29,IDC_EDIT_CHAMFER_SETTING_MINUS_30
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_31,IDC_EDIT_CHAMFER_SETTING_MINUS_32,IDC_EDIT_CHAMFER_SETTING_MINUS_33,IDC_EDIT_CHAMFER_SETTING_MINUS_34,IDC_EDIT_CHAMFER_SETTING_MINUS_35
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_36,IDC_EDIT_CHAMFER_SETTING_MINUS_37,IDC_EDIT_CHAMFER_SETTING_MINUS_38,IDC_EDIT_CHAMFER_SETTING_MINUS_39,IDC_EDIT_CHAMFER_SETTING_MINUS_40
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_41,IDC_EDIT_CHAMFER_SETTING_MINUS_42,IDC_EDIT_CHAMFER_SETTING_MINUS_43,IDC_EDIT_CHAMFER_SETTING_MINUS_44,IDC_EDIT_CHAMFER_SETTING_MINUS_45
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_46,IDC_EDIT_CHAMFER_SETTING_MINUS_47,IDC_EDIT_CHAMFER_SETTING_MINUS_48,IDC_EDIT_CHAMFER_SETTING_MINUS_49,IDC_EDIT_CHAMFER_SETTING_MINUS_50
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_51,IDC_EDIT_CHAMFER_SETTING_MINUS_52,IDC_EDIT_CHAMFER_SETTING_MINUS_53,IDC_EDIT_CHAMFER_SETTING_MINUS_54,IDC_EDIT_CHAMFER_SETTING_MINUS_55
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_56,IDC_EDIT_CHAMFER_SETTING_MINUS_57,IDC_EDIT_CHAMFER_SETTING_MINUS_58,IDC_EDIT_CHAMFER_SETTING_MINUS_59,IDC_EDIT_CHAMFER_SETTING_MINUS_60
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_61,IDC_EDIT_CHAMFER_SETTING_MINUS_62,IDC_EDIT_CHAMFER_SETTING_MINUS_63,IDC_EDIT_CHAMFER_SETTING_MINUS_64,IDC_EDIT_CHAMFER_SETTING_MINUS_65
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_66,IDC_EDIT_CHAMFER_SETTING_MINUS_67,IDC_EDIT_CHAMFER_SETTING_MINUS_68,IDC_EDIT_CHAMFER_SETTING_MINUS_69,IDC_EDIT_CHAMFER_SETTING_MINUS_70
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_71,IDC_EDIT_CHAMFER_SETTING_MINUS_72,IDC_EDIT_CHAMFER_SETTING_MINUS_73,IDC_EDIT_CHAMFER_SETTING_MINUS_74,IDC_EDIT_CHAMFER_SETTING_MINUS_75
+	,IDC_EDIT_CHAMFER_SETTING_MINUS_76,IDC_EDIT_CHAMFER_SETTING_MINUS_77,IDC_EDIT_CHAMFER_SETTING_MINUS_78,IDC_EDIT_CHAMFER_SETTING_MINUS_79};
+
+UINT		nID_ChamferUse[]={IDC_CHECK_CHAMFER_SETTING_1,IDC_CHECK_CHAMFER_SETTING_2,IDC_CHECK_CHAMFER_SETTING_3,IDC_CHECK_CHAMFER_SETTING_4,IDC_CHECK_CHAMFER_SETTING_5
+	,IDC_CHECK_CHAMFER_SETTING_6,IDC_CHECK_CHAMFER_SETTING_7,IDC_CHECK_CHAMFER_SETTING_8,IDC_CHECK_CHAMFER_SETTING_9,IDC_CHECK_CHAMFER_SETTING_10
+	,IDC_CHECK_CHAMFER_SETTING_11,IDC_CHECK_CHAMFER_SETTING_12,IDC_CHECK_CHAMFER_SETTING_13,IDC_CHECK_CHAMFER_SETTING_14,IDC_CHECK_CHAMFER_SETTING_15
+	,IDC_CHECK_CHAMFER_SETTING_16,IDC_CHECK_CHAMFER_SETTING_17,IDC_CHECK_CHAMFER_SETTING_18,IDC_CHECK_CHAMFER_SETTING_19,IDC_CHECK_CHAMFER_SETTING_20
+	,IDC_CHECK_CHAMFER_SETTING_21,IDC_CHECK_CHAMFER_SETTING_22,IDC_CHECK_CHAMFER_SETTING_23,IDC_CHECK_CHAMFER_SETTING_24,IDC_CHECK_CHAMFER_SETTING_25
+	,IDC_CHECK_CHAMFER_SETTING_26,IDC_CHECK_CHAMFER_SETTING_27,IDC_CHECK_CHAMFER_SETTING_28,IDC_CHECK_CHAMFER_SETTING_29,IDC_CHECK_CHAMFER_SETTING_30
+	,IDC_CHECK_CHAMFER_SETTING_31,IDC_CHECK_CHAMFER_SETTING_32,IDC_CHECK_CHAMFER_SETTING_33,IDC_CHECK_CHAMFER_SETTING_34,IDC_CHECK_CHAMFER_SETTING_35
+	,IDC_CHECK_CHAMFER_SETTING_36,IDC_CHECK_CHAMFER_SETTING_37,IDC_CHECK_CHAMFER_SETTING_38,IDC_CHECK_CHAMFER_SETTING_39,IDC_CHECK_CHAMFER_SETTING_40
+	,IDC_CHECK_CHAMFER_SETTING_41,IDC_CHECK_CHAMFER_SETTING_42,IDC_CHECK_CHAMFER_SETTING_43,IDC_CHECK_CHAMFER_SETTING_44,IDC_CHECK_CHAMFER_SETTING_45
+	,IDC_CHECK_CHAMFER_SETTING_46,IDC_CHECK_CHAMFER_SETTING_47,IDC_CHECK_CHAMFER_SETTING_48,IDC_CHECK_CHAMFER_SETTING_49,IDC_CHECK_CHAMFER_SETTING_50
+	,IDC_CHECK_CHAMFER_SETTING_51,IDC_CHECK_CHAMFER_SETTING_52,IDC_CHECK_CHAMFER_SETTING_53,IDC_CHECK_CHAMFER_SETTING_54,IDC_CHECK_CHAMFER_SETTING_55
+	,IDC_CHECK_CHAMFER_SETTING_56,IDC_CHECK_CHAMFER_SETTING_57,IDC_CHECK_CHAMFER_SETTING_58,IDC_CHECK_CHAMFER_SETTING_59,IDC_CHECK_CHAMFER_SETTING_60
+	,IDC_CHECK_CHAMFER_SETTING_61,IDC_CHECK_CHAMFER_SETTING_62,IDC_CHECK_CHAMFER_SETTING_63,IDC_CHECK_CHAMFER_SETTING_64,IDC_CHECK_CHAMFER_SETTING_65
+	,IDC_CHECK_CHAMFER_SETTING_66,IDC_CHECK_CHAMFER_SETTING_67,IDC_CHECK_CHAMFER_SETTING_68,IDC_CHECK_CHAMFER_SETTING_69,IDC_CHECK_CHAMFER_SETTING_70
+	,IDC_CHECK_CHAMFER_SETTING_71,IDC_CHECK_CHAMFER_SETTING_72,IDC_CHECK_CHAMFER_SETTING_73,IDC_CHECK_CHAMFER_SETTING_74,IDC_CHECK_CHAMFER_SETTING_75
+	,IDC_CHECK_CHAMFER_SETTING_76,IDC_CHECK_CHAMFER_SETTING_77,IDC_CHECK_CHAMFER_SETTING_78,IDC_CHECK_CHAMFER_SETTING_79};
+
+// CViewRecipeChamferView 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewRecipeChamferView, CDialogEx)
+
+CViewRecipeChamferView::CViewRecipeChamferView(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewRecipeChamferView::IDD, pParent)
+{
+	m_pHardware = NULL;
+	m_pDlgRecipe = NULL;
+	m_nUpDnSel = 0;
+}
+
+CViewRecipeChamferView::~CViewRecipeChamferView()
+{
+}
+
+void CViewRecipeChamferView::DoDataExchange(CDataExchange* pDX)
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CProfileInspect_Prm *pProfilPrm = m_pDlgRecipe->GetProfileParm();
+	int			i;
+
+	ST_CHAMFER_SETTING *pChPrm;
+
+	if(m_nUpDnSel == 0)	
+		pChPrm = pProfilPrm->m_stCamferUp;
+	else
+		pChPrm = pProfilPrm->m_stCamferDn;
+	
+	for(i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+	{
+		DDX_Text(pDX,nID_ChamferMinus[i],pChPrm[i].minus);		
+		DDX_Text(pDX,nID_ChamferPlus[i],pChPrm[i].plus);			
+		DDX_Text(pDX, nID_ChamferRef[i], pChPrm[i].reference);
+		DDX_Check(pDX,nID_ChamferUse[i],pChPrm[i].use);
+		DDX_Control(pDX,nID_ChamferUse[i],m_chkChamferUse[i]);
+	}
+
+	UINT nIDCmdUpDn[] = { IDC_BTN_CHAMFER_UP,IDC_BTN_CHAMFER_DOWN};
+	for (int i = 0; i < eRcp_End; i++) {
+		DDX_Control(pDX, nIDCmdUpDn[i], m_ctrlCmdUpDn[i]);
+	}
+
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewRecipeChamferView, CDialogEx)
+	ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewRecipeChamferView, CDialogEx)
+
+	ON_EVENT(CViewRecipeChamferView, IDC_BTN_CHAMFER_UP, DISPID_CLICK, CViewRecipeChamferView::ClickChkButUpDnSel, VTS_NONE)
+	ON_EVENT(CViewRecipeChamferView, IDC_BTN_CHAMFER_DOWN, DISPID_CLICK, CViewRecipeChamferView::ClickChkButUpDnSel, VTS_NONE)
+	ON_EVENT(CViewRecipeChamferView, IDC_BTN_CHAMFER_APPLY, DISPID_CLICK, CViewRecipeChamferView::ClickChkChamferApply, VTS_NONE)
+	
+END_EVENTSINK_MAP()
+
+// CViewRecipeChamferView 皋矫瘤 贸府扁涝聪促.
+void CViewRecipeChamferView::SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe)
+{
+	m_pHardware = pHW;
+	m_pDlgRecipe = pRecipe;
+}
+
+BOOL CViewRecipeChamferView::OnInitDialog()
+{	
+	for (int loop_count=0; loop_count<MAX_PROFILE_SETTING_COUNT; loop_count++)
+	{
+		m_chkChamferUse[loop_count].m_nFlatStyle = CMFCButton::BUTTONSTYLE_FLAT;
+		m_chkChamferUse[loop_count].SetImage(IDB_CHECKNO32);
+		m_chkChamferUse[loop_count].SetCheckedImage(IDB_CHECK32);
+	}
+
+	SetControlStyle();
+
+	return TRUE;
+}
+
+BOOL CViewRecipeChamferView::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+void CViewRecipeChamferView::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		UpdateData(FALSE);				
+
+		UINT nIDCmdUpDn[] = { IDC_BTN_CHAMFER_UP,IDC_BTN_CHAMFER_DOWN};
+
+		ChangeUpDnView(nIDCmdUpDn[m_nUpDnSel]);
+	}
+}
+
+void CViewRecipeChamferView::SetControlStyle(void)
+{
+	int			i;	
+
+	for(i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+	{
+		m_FontControl.SetFont(this,nID_ChamferMinus[i],CFontControl::EN_SUBFONT);
+		m_FontControl.SetFont(this,nID_ChamferPlus[i],CFontControl::EN_SUBFONT);		
+		m_FontControl.SetFont(this,nID_ChamferRef[i],CFontControl::EN_SUBFONT);		
+	}
+}
+
+void CViewRecipeChamferView::ClickChkChamferApply()
+{
+	UpdateData(TRUE);
+}
+
+void CViewRecipeChamferView::ClickChkButUpDnSel()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	UpdateData(TRUE);
+
+	ChangeUpDnView(nID);	
+}
+
+void CViewRecipeChamferView::ChangeUpDnView(UINT nID)
+{
+	SetButtonUpDnEnableAll(TRUE);	
+
+	eViewUpDn eSelView;
+
+	switch(nID)
+	{
+	case IDC_BTN_CHAMFER_UP:
+		m_nUpDnSel = 0;
+		eSelView = eRcp_Up;		
+		break;	
+	case IDC_BTN_CHAMFER_DOWN:
+		m_nUpDnSel = 1;
+		eSelView = eRcp_Dn;			
+		break;		
+	default:
+		return;
+	}
+
+	SetButtonUpDnSel(eSelView,FALSE);
+
+	UpdateData(FALSE);
+}
+
+void CViewRecipeChamferView::SetButtonUpDnEnableAll(const BOOL& bEnable)
+{
+	int i;
+	for (i = 0; i < eRcp_End; i++) 
+	{
+		if (m_ctrlCmdUpDn[i].GetEnabled() != bEnable) {
+			m_ctrlCmdUpDn[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+void CViewRecipeChamferView::SetButtonUpDnSel(eViewUpDn eSelView, BOOL bEnable)
+{
+	if(eSelView >= eRcp_End) return;
+	if(m_ctrlCmdUpDn[eSelView].GetEnabled() != bEnable){
+		m_ctrlCmdUpDn[eSelView].SetEnabled(bEnable);
+	}
+}
\ No newline at end of file
diff --git a/ENRIT/View/ViewRecipeChamferView.h b/ENRIT/View/ViewRecipeChamferView.h
new file mode 100644
index 0000000..0333eff
--- /dev/null
+++ b/ENRIT/View/ViewRecipeChamferView.h
@@ -0,0 +1,50 @@
+#pragma once
+
+#include "btnenh.h"
+#include "General_Draw.h"
+#include "Global_Define.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+// CViewRecipeChamferView 措拳 惑磊涝聪促.
+
+class CViewRecipeChamferView : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewRecipeChamferView)
+
+public:
+	CViewRecipeChamferView(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewRecipeChamferView();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_RECIPE_CHAMFERSETTING_VIEW };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	void ClickChkButUpDnSel();
+	void ClickChkChamferApply();
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+	void					SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe);
+
+protected:
+	void					SetControlStyle(void);
+
+	enum					eViewUpDn {eRcp_Up=0, eRcp_Dn, eRcp_End};
+	CBtnEnh					m_ctrlCmdUpDn[eRcp_End];	
+
+	void					ChangeUpDnView(UINT nID);
+	void					SetButtonUpDnEnableAll(const BOOL& bEnable);
+	void					SetButtonUpDnSel(eViewUpDn eSelView, BOOL bEnable);
+
+protected:	
+	CHardwareSettings		*m_pHardware;
+	CGlassRecipe		*m_pDlgRecipe;
+	CFontControl			m_FontControl;
+	int						m_nUpDnSel;
+	CMFCButton				m_chkChamferUse[MAX_PROFILE_SETTING_COUNT];
+};
diff --git a/ENRIT/View/ViewRecipeInspectionView.cpp b/ENRIT/View/ViewRecipeInspectionView.cpp
new file mode 100644
index 0000000..68cc5f0
--- /dev/null
+++ b/ENRIT/View/ViewRecipeInspectionView.cpp
@@ -0,0 +1,1026 @@
+// ViewRecipeInspectionView.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewRecipeInspectionView.h"
+#include "afxdialogex.h"
+#include "Global_Define.h"
+#include "FrameImg.h"
+
+// CViewRecipeInspectionView 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewRecipeInspectionView, CDialogEx)
+
+CViewRecipeInspectionView::CViewRecipeInspectionView(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewRecipeInspectionView::IDD, pParent)
+{
+	m_nCndRDSide = 0;
+	m_nCndMarkSel = 0;
+	m_nCndMarkPos = 0;
+	m_pDlgRecipe = NULL;
+	m_pHardware = NULL;
+	m_pI2M = NULL;
+	m_pViewSettingSpline = NULL;
+	m_pViewSettingNotch = NULL;
+	m_pViewHoleRecipeSetting = NULL;
+	m_pH2V = NULL;
+	m_pBmInfo = NULL;
+}
+
+CViewRecipeInspectionView::~CViewRecipeInspectionView()
+{
+	if(m_pViewSettingSpline != NULL)
+	{
+		delete m_pViewSettingSpline;
+		m_pViewSettingSpline = NULL;
+	}
+	if(m_pViewSettingNotch != NULL)
+	{
+		delete m_pViewSettingNotch;
+		m_pViewSettingNotch = NULL;
+	}
+	if(m_pViewHoleRecipeSetting != NULL)
+	{
+		delete m_pViewHoleRecipeSetting;
+		m_pViewHoleRecipeSetting = NULL;
+	}
+
+	if(m_pBmInfo)
+	{
+		delete[] m_pBmInfo,m_pBmInfo = NULL;
+	}
+}
+
+void CViewRecipeInspectionView::DoDataExchange(CDataExchange* pDX)
+{
+	int				i;	
+
+	UINT nIDCmdCorner[] = { IDC_CHECK_USE_CORNER};
+	for (i = 0; i < eRcp_Corner_End; i++) {
+		DDX_Control(pDX, nIDCmdCorner[i], m_ctrlCmdCorner[i]);
+	}
+
+	UINT nIDCmdSide[] = { IDC_RDO_SIDE_A,IDC_RDO_SIDE_B,IDC_RDO_SIDE_C,IDC_RDO_SIDE_D,IDC_RDO_SIDE_A_DN,IDC_RDO_SIDE_B_DN,IDC_RDO_SIDE_C_DN,IDC_RDO_SIDE_D_DN};
+	for (i = 0; i < eRcp_SideRD_End; i++) {
+		DDX_Control(pDX, nIDCmdSide[i], m_ctrlCmdSideBtn[i]);
+	}
+
+	UINT nIDMarkSel[] = { IDC_RDO_IS_MARK_UP,IDC_RDO_IS_MARK_DN};
+	for (i = 0; i < eRcp_MarkSel_End; i++) {
+		DDX_Control(pDX, nIDMarkSel[i], m_ctrlRDMarkBtn[i]);
+	}
+
+	UINT nIDMarkPos[] = { IDC_RDO_MARK_POS_1,IDC_RDO_MARK_POS_2,IDC_RDO_MARK_POS_3};
+	for (i = 0; i < eRcp_MarkPos_End; i++) {
+		DDX_Control(pDX, nIDMarkPos[i], m_ctrlRDMarkPos[i]);
+	}
+
+	UINT nIDMarkEn[] = { IDC_CHK_MARK_A1,IDC_CHK_MARK_B1,IDC_CHK_MARK_C1,IDC_CHK_MARK_D1,IDC_CHK_MARK_A2,IDC_CHK_MARK_B2,IDC_CHK_MARK_C2,IDC_CHK_MARK_D2
+						,IDC_CHK_MARK_A3,IDC_CHK_MARK_B3,IDC_CHK_MARK_C3,IDC_CHK_MARK_D3};
+	for (i = 0; i < eRcp_MarkEN_End; i++) {
+		DDX_Control(pDX, nIDMarkEn[i], m_ctrlMarkEnBtn[i]);
+	}
+
+	UINT nIDJudgeAnd[] = { IDC_CHECK_SIDE_CHIP_AND,IDC_CHECK_SIDE_BURR_AND,IDC_CHECK_SIDE_BROKEN_AND,IDC_CHECK_CF_CHIP_AND,IDC_CHECK_CF_BURR_AND,IDC_CHECK_CRACK_AND};
+	for (i = 0; i < eRcp_JudgeAnd_End; i++) {
+		DDX_Control(pDX, nIDJudgeAnd[i], m_ctrlJudgeAnd[i]);
+	}
+
+	UINT nIDJudgeUse[] = { IDC_CHECK_SIDE_CHIP_USE,IDC_CHECK_SIDE_BURR_USE,IDC_CHECK_SIDE_BROKEN_USE,IDC_CHECK_CF_CHIP_USE,IDC_CHECK_CF_BURR_USE,IDC_CHECK_CRACK_USE};
+	for (i = 0; i < eRcp_JudgeUse_End; i++) {
+		DDX_Control(pDX, nIDJudgeUse[i], m_ctrlJudgeUse[i]);
+	}
+
+	DDX_Control(pDX,IDC_CHECK_MARK_MODIFY,m_ctrlMarkModify);
+
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CProfileInspect_Prm *pProfilePrm = m_pDlgRecipe->GetProfileParm();
+
+	DDX_Text(pDX,IDC_EDIT_CAD_OFFSET_X,pProfilePrm->m_nCADOffsetX[m_nCndRDSide]);
+	DDX_Text(pDX,IDC_EDIT_CAD_OFFSET_Y,pProfilePrm->m_nCADOffsetY[m_nCndRDSide]);
+
+	DDX_Check(pDX,IDC_CHK_USE_ORIGINPT_ALIGNKEY,pProfilePrm->m_bUseOriginAlignKey[m_nCndRDSide]);
+	DDX_Text(pDX,IDC_EDIT_ORIGINPT_OFFSET_X,pProfilePrm->m_nOriginAlignKeyOffsetX[m_nCndRDSide]);
+	DDX_Text(pDX,IDC_EDIT_ORIGINPT_OFFSET_Y,pProfilePrm->m_nOriginAlignKeyOffsetY[m_nCndRDSide]);
+	DDX_Text(pDX,IDC_EDIT_ORIGINPT_OFFSET_X2,pProfilePrm->m_nOriginAlignKeyOffsetDwX[m_nCndRDSide]);
+	DDX_Text(pDX,IDC_EDIT_ORIGINPT_OFFSET_Y2,pProfilePrm->m_nOriginAlignKeyOffsetDwY[m_nCndRDSide]);
+
+	CALIGNMARK_PARM			*pAlignPrm = NULL;
+	CINSPECT_JUDGEMENT_PARM	*pJudge = m_pDlgRecipe->GetJudgePrm();
+
+	DDX_Text(pDX,IDC_EDIT_UP_REF_A,pJudge->ptAlign[0][DIMENSION_A].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_A,pJudge->ptAlign[0][DIMENSION_A].y);	
+	DDX_Text(pDX,IDC_EDIT_DN_REF_A,pJudge->ptAlign[1][DIMENSION_A].x);
+	DDX_Text(pDX,IDC_EDIT_DN_PLUS_TOL_A,pJudge->ptAlign[1][DIMENSION_A].y);
+	DDX_Text(pDX,IDC_EDIT_UP_REF_A3,pJudge->ptAlign[2][DIMENSION_A].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_A3,pJudge->ptAlign[2][DIMENSION_A].y);	
+
+	DDX_Text(pDX,IDC_EDIT_UP_REF_B,pJudge->ptAlign[0][DIMENSION_B].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_B,pJudge->ptAlign[0][DIMENSION_B].y);		
+	DDX_Text(pDX,IDC_EDIT_DN_REF_B,pJudge->ptAlign[1][DIMENSION_B].x);
+	DDX_Text(pDX,IDC_EDIT_DN_PLUS_TOL_B,pJudge->ptAlign[1][DIMENSION_B].y);	
+	DDX_Text(pDX,IDC_EDIT_UP_REF_B3,pJudge->ptAlign[2][DIMENSION_B].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_B3,pJudge->ptAlign[2][DIMENSION_B].y);	
+
+	DDX_Text(pDX,IDC_EDIT_UP_REF_C,pJudge->ptAlign[0][DIMENSION_C].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_C,pJudge->ptAlign[0][DIMENSION_C].y);	
+	DDX_Text(pDX,IDC_EDIT_DN_REF_C,pJudge->ptAlign[1][DIMENSION_C].x);
+	DDX_Text(pDX,IDC_EDIT_DN_PLUS_TOL_C,pJudge->ptAlign[1][DIMENSION_C].y);
+	DDX_Text(pDX,IDC_EDIT_UP_REF_C3,pJudge->ptAlign[2][DIMENSION_C].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_C3,pJudge->ptAlign[2][DIMENSION_C].y);
+
+	DDX_Text(pDX,IDC_EDIT_UP_REF_D,pJudge->ptAlign[0][DIMENSION_D].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_D,pJudge->ptAlign[0][DIMENSION_D].y);	
+	DDX_Text(pDX,IDC_EDIT_DN_REF_D,pJudge->ptAlign[1][DIMENSION_D].x);
+	DDX_Text(pDX,IDC_EDIT_DN_PLUS_TOL_D,pJudge->ptAlign[1][DIMENSION_D].y);
+	DDX_Text(pDX,IDC_EDIT_UP_REF_D3,pJudge->ptAlign[2][DIMENSION_D].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_D3,pJudge->ptAlign[2][DIMENSION_D].y);
+
+	DDX_Text(pDX,IDC_EDIT_UP_REF_A2,pJudge->ptAlign[0][DIMENSION_A_DN].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_A2,pJudge->ptAlign[0][DIMENSION_A_DN].y);	
+	DDX_Text(pDX,IDC_EDIT_DN_REF_A2,pJudge->ptAlign[1][DIMENSION_A_DN].x);
+	DDX_Text(pDX,IDC_EDIT_DN_PLUS_TOL_A2,pJudge->ptAlign[1][DIMENSION_A_DN].y);
+
+	DDX_Text(pDX,IDC_EDIT_UP_REF_B2,pJudge->ptAlign[0][DIMENSION_B_DN].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_B2,pJudge->ptAlign[0][DIMENSION_B_DN].y);		
+	DDX_Text(pDX,IDC_EDIT_DN_REF_B2,pJudge->ptAlign[1][DIMENSION_B_DN].x);
+	DDX_Text(pDX,IDC_EDIT_DN_PLUS_TOL_B2,pJudge->ptAlign[1][DIMENSION_B_DN].y);	
+
+	DDX_Text(pDX,IDC_EDIT_UP_REF_C2,pJudge->ptAlign[0][DIMENSION_C_DN].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_C2,pJudge->ptAlign[0][DIMENSION_C_DN].y);	
+	DDX_Text(pDX,IDC_EDIT_DN_REF_C2,pJudge->ptAlign[1][DIMENSION_C_DN].x);
+	DDX_Text(pDX,IDC_EDIT_DN_PLUS_TOL_C2,pJudge->ptAlign[1][DIMENSION_C_DN].y);
+
+	DDX_Text(pDX,IDC_EDIT_UP_REF_D2,pJudge->ptAlign[0][DIMENSION_D_DN].x);
+	DDX_Text(pDX,IDC_EDIT_UP_PLUS_TOL_D2,pJudge->ptAlign[0][DIMENSION_D_DN].y);	
+	DDX_Text(pDX,IDC_EDIT_DN_REF_D2,pJudge->ptAlign[1][DIMENSION_D_DN].x);
+	DDX_Text(pDX,IDC_EDIT_DN_PLUS_TOL_D2,pJudge->ptAlign[1][DIMENSION_D_DN].y);
+
+
+	DDX_Text(pDX,IDC_EDIT_CORNER1_X,pJudge->corner_X[DIMENSION_A].nRefernce);
+	DDX_Text(pDX,IDC_EDIT_CORNER1_Y,pJudge->corner_Y[DIMENSION_A].nRefernce);
+	DDX_Text(pDX,IDC_EDIT_CORNER1_PLUS_TOL,pJudge->corner_X[DIMENSION_A].nTolPlus);
+	DDX_Text(pDX,IDC_EDIT_CORNER1_MINUS_TOL,pJudge->corner_X[DIMENSION_A].nTolMinus);
+
+	DDX_Text(pDX,IDC_EDIT_CORNER2_X,pJudge->corner_X[DIMENSION_B].nRefernce);
+	DDX_Text(pDX,IDC_EDIT_CORNER2_Y,pJudge->corner_Y[DIMENSION_B].nRefernce);
+	DDX_Text(pDX,IDC_EDIT_CORNER2_PLUS_TOL,pJudge->corner_X[DIMENSION_B].nTolPlus);
+	DDX_Text(pDX,IDC_EDIT_CORNER2_MINUS_TOL,pJudge->corner_X[DIMENSION_B].nTolMinus);
+
+	DDX_Text(pDX,IDC_EDIT_CORNER3_X,pJudge->corner_X[DIMENSION_C].nRefernce);
+	DDX_Text(pDX,IDC_EDIT_CORNER3_Y,pJudge->corner_Y[DIMENSION_C].nRefernce);
+	DDX_Text(pDX,IDC_EDIT_CORNER3_PLUS_TOL,pJudge->corner_X[DIMENSION_C].nTolPlus);
+	DDX_Text(pDX,IDC_EDIT_CORNER3_MINUS_TOL,pJudge->corner_X[DIMENSION_C].nTolMinus);
+
+	DDX_Text(pDX,IDC_EDIT_CORNER4_X,pJudge->corner_X[DIMENSION_D].nRefernce);
+	DDX_Text(pDX,IDC_EDIT_CORNER4_Y,pJudge->corner_Y[DIMENSION_D].nRefernce);
+	DDX_Text(pDX,IDC_EDIT_CORNER4_PLUS_TOL,pJudge->corner_X[DIMENSION_D].nTolPlus);
+	DDX_Text(pDX,IDC_EDIT_CORNER4_MINUS_TOL,pJudge->corner_X[DIMENSION_D].nTolMinus);
+
+	DDX_Check(pDX,IDC_CHK_USE_AVG_PROFILE_JUDGEMENT,pJudge->AvgProfile[m_nCndRDSide].bUse);
+	DDX_Text(pDX,IDC_EDIT_AVG_PROFILE_DIFF,pJudge->AvgProfile[m_nCndRDSide].nDiff);
+	DDX_Check(pDX,IDC_CHK_USE_AVG_CHAMFER_JUDGEMENT,pJudge->AvgChamfer[m_nCndRDSide].bUse);
+	DDX_Text(pDX,IDC_EDIT_AVG_CHAMFER_DIFF,pJudge->AvgChamfer[m_nCndRDSide].nDiff);
+
+	DDX_Text(pDX,IDC_EDIT_PROFILE_NG_COUNT,pJudge->nMinProfileNgCount[m_nCndRDSide]);
+	DDX_Text(pDX,IDC_EDIT_PROFILE_NG_COUNT_MIN_DIFF,pJudge->nMinProfileNgCount_MinDiff[m_nCndRDSide]);
+	
+
+	CCORNER_PARM		*pCornerPrm = m_pDlgRecipe->GetCornerParm();
+	DDX_Text(pDX,IDC_EDIT_TH_CONOR,pCornerPrm->m_Thres[(DimensionDir)m_nCndRDSide]);
+
+	pSTU_CUTAREA_PARM pCutPrm;
+	pCutPrm = m_pDlgRecipe->GetCutAreaPrm((DimensionDir)m_nCndRDSide);	
+	DDX_Text(pDX,IDC_EDIT_TH_EDGE_LINE,pCutPrm->m_nThresT);
+	DDX_Text(pDX,IDC_EDIT_TH_EDGE_LINE2,pCutPrm->m_nThresB);
+
+	pSTU_CHIP_PARM pChipPrm = m_pDlgRecipe->GetInspectInfo()->GetChipParm((DimensionDir)m_nCndRDSide);
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_CHIP,pChipPrm->m_nChippingThres_T);
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_CHIP_WHITE,pChipPrm->m_nChippingThres_T_White);
+
+	DDX_Text(pDX,IDC_EDIT_TH_IN_CHIP2,pChipPrm->m_nChippingThres_B);	
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_BURR2,pChipPrm->m_nChippingThres_T_L);	
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_CRACK,pChipPrm->m_nCrackThres);		
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_BROKEN,pChipPrm->m_nBrokenThres);		
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_CHIPDIFFTHRES,pChipPrm->m_nChipDiffThres);			
+
+	CINSPECT_INFO_PARM *pInsPrm = m_pDlgRecipe->GetInspectInfo();
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_RCUT_TOP_GLASS,pInsPrm->m_nRCutThresGlass[m_nCndRDSide][0]);		
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_RCUT_BOT_GLASS,pInsPrm->m_nRCutThresGlass[m_nCndRDSide][1]);	
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_RCUT_TOP_CHAMFER,pInsPrm->m_nRCutThresChamfer[m_nCndRDSide][0]);		
+	DDX_Text(pDX,IDC_EDIT_TH_SIDE_RCUT_BOT_CHAMFER,pInsPrm->m_nRCutThresChamfer[m_nCndRDSide][1]);	
+
+	CETC_PARM		*pEtcPrm = m_pDlgRecipe->GetEtcPrm((DimensionDir)m_nCndRDSide);	
+	DDX_Text(pDX,IDC_EDIT_TH_LINE,pEtcPrm->m_nGlassFindthres_Top);
+	
+	DDX_Text(pDX,IDC_EDIT_LONG_LENGTH,m_pDlgRecipe->m_GlassParm.m_nGlassSizeX);
+	DDX_Text(pDX,IDC_EDIT_SHORT_LENGTH,m_pDlgRecipe->m_GlassParm.m_nGlassSizeY);
+
+	DDX_Check(pDX,IDC_CHECK_PANEL_REVERSE, m_pDlgRecipe->m_GlassParm.m_bPanelReverse);
+
+	DDX_Text(pDX,IDC_EDIT_SCAN_TIME,m_pDlgRecipe->m_GlassParm.m_dOneScanTime);
+
+	DDX_Text(pDX,IDC_EDIT_START_LINE_CHK,m_pDlgRecipe->m_GlassParm.m_nGlassFindHorPos[m_nCndRDSide]);
+	DDX_Text(pDX,IDC_EDIT_SKIP_LINE,m_pDlgRecipe->m_GlassParm.m_nFindGlassStartOffset[m_nCndRDSide]);	
+
+	DDX_Text(pDX, IDC_EDIT_SIDE_DX_CHIP			, pJudge->defect[m_nCndRDSide][0].Chip_Side.szDefect.cx);
+	DDX_Text(pDX, IDC_EDIT_SIDE_DY_CHIP			, pJudge->defect[m_nCndRDSide][0].Chip_Side.szDefect.cy);
+
+	DDX_Text(pDX, IDC_EDIT_SIDE_DX_BURR			, pJudge->defect[m_nCndRDSide][0].Burr_Side.szDefect.cx);
+	DDX_Text(pDX, IDC_EDIT_SIDE_DY_BURR			, pJudge->defect[m_nCndRDSide][0].Burr_Side.szDefect.cy);
+
+	DDX_Text(pDX, IDC_EDIT_CRACK_DX				, pJudge->defect[m_nCndRDSide][0].Crack.szDefect.cx);
+	DDX_Text(pDX, IDC_EDIT_CRACK_DY				, pJudge->defect[m_nCndRDSide][0].Crack.szDefect.cy);
+
+	//kss-> add cfchip,burr
+	DDX_Text(pDX, IDC_EDIT_CF_DX_CHIP			, pJudge->defect[m_nCndRDSide][0].Chip_CF.szDefect.cx);
+	DDX_Text(pDX, IDC_EDIT_CF_DY_CHIP			, pJudge->defect[m_nCndRDSide][0].Chip_CF.szDefect.cy);
+
+	DDX_Text(pDX, IDC_EDIT_CF_DX_BURR			, pJudge->defect[m_nCndRDSide][0].Burr_CF.szDefect.cx);
+	DDX_Text(pDX, IDC_EDIT_CF_DY_BURR			, pJudge->defect[m_nCndRDSide][0].Burr_CF.szDefect.cy);
+
+	DDX_Text(pDX, IDC_EDIT_SIDE_DX_BROKEN		, pJudge->defect[m_nCndRDSide][0].Broken.szDefect.cx);
+	DDX_Text(pDX, IDC_EDIT_SIDE_DY_BROKEN		, pJudge->defect[m_nCndRDSide][0].Broken.szDefect.cy);
+
+	pAlignPrm = m_pDlgRecipe->GetAlignMarkPrm((DimensionDir)m_nCndRDSide);
+
+	DDX_Text(pDX, IDC_EDIT_MARK_RATE1, pAlignPrm->m_dMarkMatchingRate[0][m_nCndMarkPos]);
+	DDX_Text(pDX, IDC_EDIT_MARK_RATE2, pAlignPrm->m_dMarkMatchingRate[1][m_nCndMarkPos]);
+	DDX_Text(pDX, IDC_EDIT_MARK_RATE3, pAlignPrm->m_dMarkMatchingRate[2][m_nCndMarkPos]);
+
+	DDX_Radio(pDX,IDC_RDO_BRIGHT_MARK,pAlignPrm->m_nMarkType[0]);
+	
+
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewRecipeInspectionView, CDialogEx)
+	ON_WM_SHOWWINDOW()
+	ON_WM_PAINT()	
+	ON_CONTROL_RANGE(BN_CLICKED,IDC_RDO_BRIGHT_MARK,IDC_RDO_USER_MARK,&CViewRecipeInspectionView::OnClickAlignMarkType)	
+	ON_MESSAGE(UM_SPLINE_APPLY_RECIPE	,&CViewRecipeInspectionView::OnSplineApplyRecipe)
+	ON_MESSAGE(UM_NOTCH_APPLY_RECIPE	,&CViewRecipeInspectionView::OnNotchApplyRecipe)	
+END_MESSAGE_MAP()
+
+// CViewRecipeInspectionView 皋矫瘤 贸府扁涝聪促.
+BEGIN_EVENTSINK_MAP(CViewRecipeInspectionView, CDialogEx)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_USE_CORNER, DISPID_CLICK, CViewRecipeInspectionView::ClickChkUseCornerButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_SIDE_A, DISPID_CLICK, CViewRecipeInspectionView::ClickChkSideSelButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_SIDE_B, DISPID_CLICK, CViewRecipeInspectionView::ClickChkSideSelButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_SIDE_C, DISPID_CLICK, CViewRecipeInspectionView::ClickChkSideSelButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_SIDE_D, DISPID_CLICK, CViewRecipeInspectionView::ClickChkSideSelButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_SIDE_A_DN, DISPID_CLICK, CViewRecipeInspectionView::ClickChkSideSelButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_SIDE_B_DN, DISPID_CLICK, CViewRecipeInspectionView::ClickChkSideSelButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_SIDE_C_DN, DISPID_CLICK, CViewRecipeInspectionView::ClickChkSideSelButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_SIDE_D_DN, DISPID_CLICK, CViewRecipeInspectionView::ClickChkSideSelButton, VTS_NONE)	
+
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_IS_MARK_UP, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkSelButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_IS_MARK_DN, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkSelButton, VTS_NONE)	
+
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_MARK_POS_1, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkPosButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_MARK_POS_2, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkPosButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_RDO_MARK_POS_3, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkPosButton, VTS_NONE)		
+
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_A1, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_A2, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_B1, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_B2, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_C1, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_C2, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_D1, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_D2, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_A3, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_B3, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_C3, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHK_MARK_D3, DISPID_CLICK, CViewRecipeInspectionView::ClickChkMarkEnableButton, VTS_NONE)	
+
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_SIDE_CHIP_AND, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeAndButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_SIDE_BURR_AND, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeAndButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_SIDE_BROKEN_AND, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeAndButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_CF_CHIP_AND, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeAndButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_CF_BURR_AND, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeAndButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_CRACK_AND, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeAndButton, VTS_NONE)	
+
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_SIDE_CHIP_USE, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeUSEButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_SIDE_BURR_USE, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeUSEButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_SIDE_BROKEN_USE, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeUSEButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_CF_CHIP_USE, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeUSEButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_CF_BURR_USE, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeUSEButton, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_CRACK_USE, DISPID_CLICK, CViewRecipeInspectionView::ClickChkJudgeUSEButton, VTS_NONE)		
+
+	ON_EVENT(CViewRecipeInspectionView, IDC_CHECK_MARK_MODIFY, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedCheckMarkModify, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK1_UPDATE, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedMarkUpdate_1, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK1_DEL, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedMarkDelete_1, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK2_UPDATE, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedMarkUpdate_2, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK2_DEL, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedMarkDelete_2, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK3_UPDATE, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedMarkUpdate_3, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK3_DEL, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedMarkDelete_3, VTS_NONE)
+
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK_LEFT, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedBtnMarkLeft, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK_UP, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedBtnMarkUp, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK_DN, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedBtnMarkDn, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BTN_MARK_RIGHT, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedBtnMarkRight, VTS_NONE)	
+
+	ON_EVENT(CViewRecipeInspectionView, IDC_BUTTON_HOLE_SETTING, DISPID_CLICK, CViewRecipeInspectionView::ClickHoleSettingButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeInspectionView, IDC_BUTTON_RCUT_SETTING, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedBtnRCutSettins, VTS_NONE)
+	ON_EVENT(CViewRecipeInspectionView, IDC_BUTTON_NOTCH_SETTING, DISPID_CLICK, CViewRecipeInspectionView::OnBnClickedBtnNotchSettins, VTS_NONE)
+
+END_EVENTSINK_MAP()
+
+BOOL CViewRecipeInspectionView::OnInitDialog()
+{
+	UpdateData(FALSE);
+
+	SetFontControl();
+
+	Init_BitmapInfo();
+	
+	m_pViewSettingSpline = new CViewSettingSpline;
+	m_pViewSettingSpline->Create(CViewSettingSpline::IDD,this);
+	m_pViewSettingSpline->SetParent(this);
+	m_pViewSettingSpline->ShowWindow(SW_HIDE);
+
+	m_pViewSettingNotch = new CViewSettingNotch;
+	m_pViewSettingNotch->Create(CViewSettingNotch::IDD,this);
+	m_pViewSettingNotch->SetParent(this);
+	m_pViewSettingNotch->ShowWindow(SW_HIDE);
+
+	m_pViewHoleRecipeSetting = new CViewHoleRecipeSetting;
+	m_pViewHoleRecipeSetting->Create(CViewHoleRecipeSetting::IDD,this);
+	m_pViewHoleRecipeSetting->ShowWindow(SW_HIDE);	
+
+	return TRUE;
+}
+
+void CViewRecipeInspectionView::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		UpdateData(FALSE);				
+		ChangViewCdmSide(IDC_RDO_SIDE_A+m_nCndRDSide);
+		ChangeViewMarkSel(IDC_RDO_IS_MARK_UP+m_nCndMarkSel);			
+		ChangeViewMarkPos(IDC_RDO_MARK_POS_1+m_nCndMarkPos);		
+	}
+}
+
+BOOL CViewRecipeInspectionView::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+// CViewRecipeInspectionView 皋矫瘤 贸府扁涝聪促.
+void CViewRecipeInspectionView::SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe)
+{
+	m_pHardware = pHW;
+	m_pDlgRecipe = pRecipe;
+
+	//UpdateData(FALSE);
+}
+
+void CViewRecipeInspectionView::OnClickAlignMarkType(UINT nID)
+{
+	UpdateData(TRUE);
+}
+
+void CViewRecipeInspectionView::OnBnClickedBtnRCutSettins()
+{
+	if(m_pViewSettingSpline != NULL)
+	{
+		m_pViewSettingSpline->SetIndex(m_nCndRDSide);
+		m_pViewSettingSpline->SetRecipe(m_pHardware,m_pDlgRecipe);		
+		m_pViewSettingSpline->ShowWindow(SW_SHOW);
+	}
+}
+
+void CViewRecipeInspectionView::OnBnClickedBtnNotchSettins()
+{
+	if(m_pViewSettingNotch != NULL)
+	{
+		m_pViewSettingNotch->SetIndex(m_nCndRDSide);
+		m_pViewSettingNotch->SetRecipe(m_pHardware,m_pDlgRecipe);		
+		m_pViewSettingNotch->ShowWindow(SW_SHOW);
+	}
+}
+
+void CViewRecipeInspectionView::ClickHoleSettingButton()
+{
+	if(m_pViewHoleRecipeSetting == NULL)
+		return;
+
+	m_pViewHoleRecipeSetting->SetRecipe(m_pDlgRecipe);
+	m_pViewHoleRecipeSetting->SetInterface(m_pH2V);
+	m_pViewHoleRecipeSetting->ShowWindow(SW_SHOW);
+}
+
+void CViewRecipeInspectionView::SetFontControl()
+{
+	const	int nFontCnt = 110;
+	UINT nIDFont[nFontCnt] = { IDC_EDIT_UP_REF_A,IDC_EDIT_UP_PLUS_TOL_A,IDC_EDIT_UP_MINUS_TOL_A,IDC_EDIT_DN_REF_A,IDC_EDIT_DN_PLUS_TOL_A,IDC_EDIT_DN_MINUS_TOL_A
+							,IDC_EDIT_UP_REF_B,IDC_EDIT_UP_PLUS_TOL_B,IDC_EDIT_UP_MINUS_TOL_B,IDC_EDIT_DN_REF_B,IDC_EDIT_DN_PLUS_TOL_B,IDC_EDIT_DN_MINUS_TOL_B
+							,IDC_EDIT_UP_REF_C,IDC_EDIT_UP_PLUS_TOL_C,IDC_EDIT_UP_MINUS_TOL_C,IDC_EDIT_DN_REF_C,IDC_EDIT_DN_PLUS_TOL_C,IDC_EDIT_DN_MINUS_TOL_C
+							,IDC_EDIT_UP_REF_D,IDC_EDIT_UP_PLUS_TOL_D,IDC_EDIT_UP_MINUS_TOL_D,IDC_EDIT_DN_REF_D,IDC_EDIT_DN_PLUS_TOL_D,IDC_EDIT_DN_MINUS_TOL_D
+							,IDC_EDIT_UP_REF_A2,IDC_EDIT_UP_PLUS_TOL_A2,IDC_EDIT_DN_REF_A2,IDC_EDIT_DN_PLUS_TOL_A2
+							,IDC_EDIT_UP_REF_B2,IDC_EDIT_UP_PLUS_TOL_B2,IDC_EDIT_DN_REF_B2,IDC_EDIT_DN_PLUS_TOL_B2
+							,IDC_EDIT_UP_REF_C2,IDC_EDIT_UP_PLUS_TOL_C2,IDC_EDIT_DN_REF_C2,IDC_EDIT_DN_PLUS_TOL_C2
+							,IDC_EDIT_UP_REF_D2,IDC_EDIT_UP_PLUS_TOL_D2,IDC_EDIT_DN_REF_D2,IDC_EDIT_DN_PLUS_TOL_D2
+							,IDC_EDIT_UP_REF_A3,IDC_EDIT_UP_PLUS_TOL_A3,IDC_EDIT_UP_REF_B3,IDC_EDIT_UP_PLUS_TOL_B3
+							,IDC_EDIT_UP_REF_C3,IDC_EDIT_UP_PLUS_TOL_C3,IDC_EDIT_UP_REF_D3,IDC_EDIT_UP_PLUS_TOL_D3
+							,IDC_EDIT_CORNER1_X,IDC_EDIT_CORNER1_Y,IDC_EDIT_CORNER1_PLUS_TOL,IDC_EDIT_CORNER1_MINUS_TOL
+							,IDC_EDIT_CORNER2_X,IDC_EDIT_CORNER2_Y,IDC_EDIT_CORNER2_PLUS_TOL,IDC_EDIT_CORNER2_MINUS_TOL
+							,IDC_EDIT_CORNER3_X,IDC_EDIT_CORNER3_Y,IDC_EDIT_CORNER3_PLUS_TOL,IDC_EDIT_CORNER3_MINUS_TOL
+							,IDC_EDIT_CORNER4_X,IDC_EDIT_CORNER4_Y,IDC_EDIT_CORNER4_PLUS_TOL,IDC_EDIT_CORNER4_MINUS_TOL
+							,IDC_EDIT_LONG_LENGTH,IDC_EDIT_SHORT_LENGTH, IDC_EDIT_SCAN_TIME
+							,IDC_EDIT_START_LINE_CHK,IDC_EDIT_SKIP_LINE
+							,IDC_EDIT_TH_CONOR,IDC_EDIT_TH_EDGE_LINE,IDC_EDIT_TH_EDGE_LINE2,IDC_EDIT_TH_SIDE_CHIP,IDC_EDIT_TH_IN_CHIP2,IDC_EDIT_TH_SIDE_BURR2,IDC_EDIT_TH_IN_BURR2,IDC_EDIT_TH_LINE
+							,IDC_EDIT_SIDE_DX_CHIP,IDC_EDIT_SIDE_DY_CHIP,IDC_EDIT_SIDE_DX_BURR,IDC_EDIT_SIDE_DY_BURR,IDC_EDIT_SIDE_DX_BROKEN,IDC_EDIT_SIDE_DY_BROKEN
+							,IDC_EDIT_CF_DX_CHIP,IDC_EDIT_CF_DY_CHIP,IDC_EDIT_CF_DX_BURR,IDC_EDIT_CF_DY_BURR,IDC_EDIT_CRACK_DX,IDC_EDIT_CRACK_DY
+							,IDC_EDIT_MARK_RATE1,IDC_EDIT_MARK_RATE2,IDC_EDIT_MARK_RATE3,IDC_EDIT_CAD_OFFSET_X,IDC_EDIT_CAD_OFFSET_Y
+							,IDC_EDIT_TH_SIDE_RCUT_BOT_CHAMFER,IDC_EDIT_TH_SIDE_RCUT_BOT_GLASS,IDC_EDIT_TH_SIDE_RCUT_TOP_CHAMFER,IDC_EDIT_TH_SIDE_RCUT_TOP_GLASS
+							,IDC_EDIT_TH_SIDE_CRACK,IDC_EDIT_TH_SIDE_BROKEN,IDC_EDIT_TH_SIDE_CHIPDIFFTHRES,IDC_EDIT_TH_SIDE_CHIP_WHITE
+							,IDC_EDIT_AVG_PROFILE_DIFF,IDC_EDIT_AVG_CHAMFER_DIFF,IDC_EDIT_ORIGINPT_OFFSET_X,IDC_EDIT_ORIGINPT_OFFSET_Y,IDC_EDIT_ORIGINPT_OFFSET_X2,IDC_EDIT_ORIGINPT_OFFSET_Y2, IDC_EDIT_PROFILE_NG_COUNT,IDC_EDIT_PROFILE_NG_COUNT_MIN_DIFF};
+	
+	for(int i=0;i<nFontCnt;i++)
+		m_FontControl.SetFont(this,nIDFont[i],CFontControl::EN_SUBFONT_NORMAL);	
+}
+
+void CViewRecipeInspectionView::SetControlButton()
+{
+	CINSPECT_JUDGEMENT_PARM		*pJudge = m_pDlgRecipe->GetJudgePrm();
+
+	m_ctrlJudgeAnd[eRcp_JudgeAnd_Chip].SetValue(!pJudge->defect[m_nCndRDSide][0].Chip_Side.bConditionAND);
+	m_ctrlJudgeAnd[eRcp_JudgeAnd_Burr].SetValue(!pJudge->defect[m_nCndRDSide][0].Burr_Side.bConditionAND);
+	m_ctrlJudgeAnd[eRcp_JudgeAnd_Broken].SetValue(!pJudge->defect[m_nCndRDSide][0].Broken.bConditionAND);
+	m_ctrlJudgeAnd[eRcp_JudgeAnd_CFChip].SetValue(!pJudge->defect[m_nCndRDSide][0].Chip_CF.bConditionAND);
+	m_ctrlJudgeAnd[eRcp_JudgeAnd_CFBurr].SetValue(!pJudge->defect[m_nCndRDSide][0].Burr_CF.bConditionAND);
+	m_ctrlJudgeAnd[eRcp_JudgeAnd_Crack].SetValue(!pJudge->defect[m_nCndRDSide][0].Crack.bConditionAND);
+
+	m_ctrlJudgeUse[eRcp_JudgeUse_Chip].SetValue(!pJudge->defect[m_nCndRDSide][0].Chip_Side.bError);
+	m_ctrlJudgeUse[eRcp_JudgeUse_Burr].SetValue(!pJudge->defect[m_nCndRDSide][0].Burr_Side.bError);
+	m_ctrlJudgeUse[eRcp_JudgeUse_Broken].SetValue(!pJudge->defect[m_nCndRDSide][0].Broken.bError);
+	m_ctrlJudgeUse[eRcp_JudgeUse_CFChip].SetValue(!pJudge->defect[m_nCndRDSide][0].Chip_CF.bError);
+	m_ctrlJudgeUse[eRcp_JudgeUse_CFBurr].SetValue(!pJudge->defect[m_nCndRDSide][0].Burr_CF.bError);
+	m_ctrlJudgeUse[eRcp_JudgeUse_Crack].SetValue(!pJudge->defect[m_nCndRDSide][0].Crack.bError);	
+
+	CCORNER_PARM	*pCornerPrm = m_pDlgRecipe->GetCornerParm();
+	m_ctrlCmdCorner[eRcp_Corner_Use].SetValue(!pCornerPrm->m_bUse);
+
+	ChangeMarkEnable(FALSE);	
+}
+
+void CViewRecipeInspectionView::ClickChkUseCornerButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	SetButtonEnable(FALSE);
+
+	CCORNER_PARM	*pCornerPrm;
+	switch(nID)
+	{
+	case IDC_CHECK_USE_CORNER:
+		pCornerPrm = m_pDlgRecipe->GetCornerParm();
+		pCornerPrm->m_bUse = !m_ctrlCmdCorner[eRcp_Corner_Use].GetValue();
+		break;	
+	}
+
+	SetButtonEnable(TRUE);
+}
+
+void CViewRecipeInspectionView::ClickChkJudgeUSEButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	SetButtonJudgeUseEnable(FALSE);
+
+	CINSPECT_JUDGEMENT_PARM		*pJudge = m_pDlgRecipe->GetJudgePrm();
+
+	switch(nID)
+	{
+	case IDC_CHECK_SIDE_CHIP_USE:
+		pJudge->defect[m_nCndRDSide][0].Chip_Side.bError = !m_ctrlJudgeUse[eRcp_JudgeUse_Chip].GetValue();	
+		break;
+	case IDC_CHECK_SIDE_BURR_USE:
+		pJudge->defect[m_nCndRDSide][0].Burr_Side.bError = !m_ctrlJudgeUse[eRcp_JudgeUse_Burr].GetValue();
+		break;
+	case IDC_CHECK_SIDE_BROKEN_USE:
+		pJudge->defect[m_nCndRDSide][0].Broken.bError = !m_ctrlJudgeUse[eRcp_JudgeUse_Broken].GetValue();
+		break;
+	case IDC_CHECK_CF_CHIP_USE:
+		pJudge->defect[m_nCndRDSide][0].Chip_CF.bError = !m_ctrlJudgeUse[eRcp_JudgeUse_CFChip].GetValue();
+		break;
+	case IDC_CHECK_CF_BURR_USE:
+		pJudge->defect[m_nCndRDSide][0].Burr_CF.bError = !m_ctrlJudgeUse[eRcp_JudgeUse_CFBurr].GetValue();
+		break;
+	case IDC_CHECK_CRACK_USE:
+		pJudge->defect[m_nCndRDSide][0].Crack.bError = !m_ctrlJudgeUse[eRcp_JudgeUse_Crack].GetValue();
+		break;	
+	}
+
+	SetButtonJudgeUseEnable(TRUE);
+}
+
+void CViewRecipeInspectionView::ClickChkJudgeAndButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	SetButtonJudgeAndEnable(FALSE);
+
+	CINSPECT_JUDGEMENT_PARM		*pJudge = m_pDlgRecipe->GetJudgePrm();
+
+	switch(nID)
+	{
+	case IDC_CHECK_SIDE_CHIP_AND:
+		pJudge->defect[m_nCndRDSide][0].Chip_Side.bConditionAND = !m_ctrlJudgeAnd[eRcp_JudgeAnd_Chip].GetValue();	
+		break;
+	case IDC_CHECK_SIDE_BURR_AND:
+		pJudge->defect[m_nCndRDSide][0].Burr_Side.bConditionAND = !m_ctrlJudgeAnd[eRcp_JudgeAnd_Burr].GetValue();
+		break;
+	case IDC_CHECK_SIDE_BROKEN_AND:
+		pJudge->defect[m_nCndRDSide][0].Broken.bConditionAND = !m_ctrlJudgeAnd[eRcp_JudgeAnd_Broken].GetValue();
+		break;
+	case IDC_CHECK_CF_CHIP_AND:
+		pJudge->defect[m_nCndRDSide][0].Chip_CF.bConditionAND = !m_ctrlJudgeAnd[eRcp_JudgeAnd_CFChip].GetValue();
+		break;
+	case IDC_CHECK_CF_BURR_AND:
+		pJudge->defect[m_nCndRDSide][0].Burr_CF.bConditionAND = !m_ctrlJudgeAnd[eRcp_JudgeAnd_CFBurr].GetValue();
+		break;
+	case IDC_CHECK_CRACK_AND:
+		pJudge->defect[m_nCndRDSide][0].Crack.bConditionAND = !m_ctrlJudgeAnd[eRcp_JudgeAnd_Crack].GetValue();
+		break;	
+	}
+
+	SetButtonJudgeAndEnable(TRUE);
+}
+
+void CViewRecipeInspectionView::SetButtonMarkSelTB(eViewMarkSel eSelView, BOOL bEnable)
+{
+	if(eSelView >= eRcp_MarkSel_End) return;
+	if(m_ctrlRDMarkBtn[eSelView].GetEnabled() != bEnable){
+		m_ctrlRDMarkBtn[eSelView].SetEnabled(bEnable);
+	}
+}
+
+void CViewRecipeInspectionView::SetButtonMarkPos(eViewMarkPos eSelView, BOOL bEnable)
+{
+	if(eSelView >= eRcp_MarkPos_End) return;
+	if(m_ctrlRDMarkPos[eSelView].GetEnabled() != bEnable){
+		m_ctrlRDMarkPos[eSelView].SetEnabled(bEnable);
+	}
+}
+
+void CViewRecipeInspectionView::SetButtonEnableCmdSide(const BOOL& bEnable)
+{
+	int i;
+
+	for (i = 0; i < eRcp_SideRD_End; i++) 
+	{
+		if (m_ctrlCmdSideBtn[i].GetEnabled() != bEnable) {
+			m_ctrlCmdSideBtn[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+void CViewRecipeInspectionView::ChangeMarkEnable(BOOL bWrite)
+{
+	UINT nTopID[] = { DIMENSION_A,DIMENSION_B,DIMENSION_C,DIMENSION_D};
+	UINT nBotID[] = { DIMENSION_A_DN,DIMENSION_B_DN,DIMENSION_C_DN,DIMENSION_D_DN};
+
+	int			i;
+	CALIGNMARK_PARM *pAlignPrm;
+
+	if(bWrite == TRUE)
+	{
+		for(i=0;i<eRcp_MarkEN_A_DN;i++)
+		{
+			if(m_nCndMarkSel == 0)
+			{
+				pAlignPrm = m_pDlgRecipe->GetAlignMarkPrm((DimensionDir)nTopID[i]);
+				pAlignPrm->m_bIsMark[0] = !m_ctrlMarkEnBtn[i].GetValue();
+				pAlignPrm->m_bIsMark[1] = !m_ctrlMarkEnBtn[i+eRcp_MarkEN_A_DN].GetValue();
+				pAlignPrm->m_bIsMark[2] = !m_ctrlMarkEnBtn[i+eRcp_MarkEN_Sub_A].GetValue();
+			}
+			else
+			{
+				pAlignPrm = m_pDlgRecipe->GetAlignMarkPrm((DimensionDir)nBotID[i]);
+				pAlignPrm->m_bIsMark[0] = !m_ctrlMarkEnBtn[i].GetValue();
+				pAlignPrm->m_bIsMark[1] = !m_ctrlMarkEnBtn[i+eRcp_MarkEN_A_DN].GetValue();
+				pAlignPrm->m_bIsMark[2] = !m_ctrlMarkEnBtn[i+eRcp_MarkEN_Sub_A].GetValue();
+			}
+		}
+	}
+	else
+	{
+		for(i=0;i<eRcp_MarkEN_A_DN;i++)
+		{
+			if(m_nCndMarkSel == 0)
+			{
+				pAlignPrm = m_pDlgRecipe->GetAlignMarkPrm((DimensionDir)nTopID[i]);
+				m_ctrlMarkEnBtn[i].SetValue(!pAlignPrm->m_bIsMark[0]);
+				m_ctrlMarkEnBtn[i+eRcp_MarkEN_A_DN].SetValue(!pAlignPrm->m_bIsMark[1]);			
+				m_ctrlMarkEnBtn[i+eRcp_MarkEN_Sub_A].SetValue(!pAlignPrm->m_bIsMark[2]);		
+			}
+			else
+			{
+				pAlignPrm = m_pDlgRecipe->GetAlignMarkPrm((DimensionDir)nBotID[i]);
+				m_ctrlMarkEnBtn[i].SetValue(!pAlignPrm->m_bIsMark[0]);
+				m_ctrlMarkEnBtn[i+eRcp_MarkEN_A_DN].SetValue(!pAlignPrm->m_bIsMark[1]);
+				m_ctrlMarkEnBtn[i+eRcp_MarkEN_Sub_A].SetValue(!pAlignPrm->m_bIsMark[2]);
+			}
+		}
+	}
+}
+
+void CViewRecipeInspectionView::ChangeViewMarkPos(UINT nID)
+{
+	SetButtonMarkPosEnableAll(TRUE);
+
+	switch(nID)
+	{
+	case IDC_RDO_MARK_POS_1:
+		m_nCndMarkPos = 0;
+		SetButtonMarkPos(eRcp_MarkPos_1,FALSE);
+		break;	
+	case IDC_RDO_MARK_POS_2:
+		m_nCndMarkPos = 1;
+		SetButtonMarkPos(eRcp_MarkPos_2,FALSE);
+		break;
+	case IDC_RDO_MARK_POS_3:
+		m_nCndMarkPos = 2;
+		SetButtonMarkPos(eRcp_MarkPos_3,FALSE);
+		break;
+	}
+
+	DrawMarkImage();	
+}
+
+void CViewRecipeInspectionView::ChangeViewMarkSel(UINT nID)
+{
+	SetButtonMarkEnableAll(TRUE);
+
+	switch(nID)
+	{
+	case IDC_RDO_IS_MARK_UP:
+		m_nCndMarkSel = 0;
+		SetButtonMarkSelTB(eRcp_MarkSel_T,FALSE);
+		break;	
+	case IDC_RDO_IS_MARK_DN:
+		m_nCndMarkSel = 1;
+		SetButtonMarkSelTB(eRcp_MarkSel_B,FALSE);
+		break;
+	}
+
+	ChangeMarkEnable(FALSE);
+}
+
+void CViewRecipeInspectionView::ClickChkMarkEnableButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	SetButtonMarkEnAllEnable(FALSE);
+
+	ChangeMarkEnable(TRUE);
+
+	SetButtonMarkEnAllEnable(TRUE);
+}
+
+void CViewRecipeInspectionView::ClickChkMarkSelButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	ChangeViewMarkSel(nID);
+}
+
+void CViewRecipeInspectionView::ClickChkMarkPosButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	ChangeViewMarkPos(nID);
+	UpdateData(FALSE);
+}
+
+void CViewRecipeInspectionView::ClickChkSideSelButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	UpdateData(TRUE);
+
+	ChangViewCdmSide(nID);	
+}
+
+void CViewRecipeInspectionView::SetEnableCmdSide(eViewCmdSide eSelView, BOOL bEnable)
+{
+	if(eSelView >= eRcp_SideRD_End) return;
+	if(m_ctrlCmdSideBtn[eSelView].GetEnabled() != bEnable){
+		m_ctrlCmdSideBtn[eSelView].SetEnabled(bEnable);
+	}
+}
+
+void CViewRecipeInspectionView::ChangViewCdmSide(UINT nID)
+{
+	SetButtonEnableCmdSide(TRUE);	
+
+	//UpdateData(TRUE);
+
+	eViewCmdSide eSelView;
+
+	switch(nID)
+	{
+	case IDC_RDO_SIDE_A:
+		m_nCndRDSide = 0;
+		eSelView = eRcp_SideRD_A;		
+		break;	
+	case IDC_RDO_SIDE_B:
+		m_nCndRDSide = 1;
+		eSelView = eRcp_SideRD_B;		
+		break;
+	case IDC_RDO_SIDE_C:
+		m_nCndRDSide = 2;
+		eSelView = eRcp_SideRD_C;		
+		break;
+	case IDC_RDO_SIDE_D:
+		m_nCndRDSide = 3;
+		eSelView = eRcp_SideRD_D;		
+		break;
+	case IDC_RDO_SIDE_A_DN:
+		m_nCndRDSide = 4;
+		eSelView = eRcp_SideRD_A_DN;		
+		break;
+	case IDC_RDO_SIDE_B_DN:
+		m_nCndRDSide = 5;
+		eSelView = eRcp_SideRD_B_DN;		
+		break;
+	case IDC_RDO_SIDE_C_DN:
+		m_nCndRDSide = 6;
+		eSelView = eRcp_SideRD_C_DN;		
+		break;
+	case IDC_RDO_SIDE_D_DN:
+		m_nCndRDSide = 7;
+		eSelView = eRcp_SideRD_D_DN;		
+		break;
+	default:
+		return;
+	}
+
+	SetEnableCmdSide(eSelView,FALSE);
+
+	ChangeSideSelect(eSelView);
+
+	UpdateData(FALSE);
+}
+
+void CViewRecipeInspectionView::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	DrawMarkImage();
+}
+
+void CViewRecipeInspectionView::ChangeSideSelect(eViewCmdSide eSelView)
+{	
+	SetControlButton();
+
+	if(m_pI2M != NULL)
+	{
+		m_pI2M->IInspectRecipe2RecipeView_ChangeSide(m_nCndRDSide);
+	}
+
+	ChangeViewMarkPos(IDC_RDO_MARK_POS_1+m_nCndMarkPos);	
+}
+
+void CViewRecipeInspectionView::SetButtonMarkEnableAll(const BOOL& bEnable)
+{
+	int i;
+	for (i = 0; i < eRcp_MarkSel_End; i++) 
+	{
+		if (m_ctrlRDMarkBtn[i].GetEnabled() != bEnable) {
+			m_ctrlRDMarkBtn[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+void CViewRecipeInspectionView::SetButtonMarkPosEnableAll(const BOOL& bEnable)
+{
+	int i;
+	for (i = 0; i < eRcp_MarkPos_End; i++) 
+	{
+		if (m_ctrlRDMarkPos[i].GetEnabled() != bEnable) {
+			m_ctrlRDMarkPos[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+void CViewRecipeInspectionView::SetButtonMarkEnAllEnable(const BOOL& bEnable)
+{
+	int i;
+	for (i = 0; i < eRcp_MarkEN_End; i++) 
+	{
+		if (m_ctrlMarkEnBtn[i].GetEnabled() != bEnable) {
+			m_ctrlMarkEnBtn[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+void CViewRecipeInspectionView::SetButtonEnable(const BOOL& bEnable)
+{
+	int i;	
+
+	for (i = 0; i < eRcp_Corner_End; i++) 
+	{
+		if (m_ctrlCmdCorner[i].GetEnabled() != bEnable) {
+			m_ctrlCmdCorner[i].SetEnabled(bEnable);
+		}
+	}	
+}
+
+void CViewRecipeInspectionView::SetButtonJudgeAndEnable(const BOOL& bEnable)
+{
+	int i;
+	for (i = 0; i < eRcp_JudgeAnd_End; i++) 
+	{
+		if (m_ctrlJudgeAnd[i].GetEnabled() != bEnable) {
+			m_ctrlJudgeAnd[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+void CViewRecipeInspectionView::SetButtonJudgeUseEnable(const BOOL& bEnable)
+{
+	int i;
+	for (i = 0; i < eRcp_JudgeUse_End; i++) 
+	{
+		if (m_ctrlJudgeUse[i].GetEnabled() != bEnable) {
+			m_ctrlJudgeUse[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+void CViewRecipeInspectionView::Refresh()
+{
+	UpdateData(FALSE);
+}
+
+void CViewRecipeInspectionView::Init_BitmapInfo()
+{
+	SIZE sz;
+	sz.cx = 100;sz.cy = 100;
+
+	m_pBmInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFO)+256*sizeof(RGBQUAD));
+	m_pBmInfo->bmiHeader.biBitCount			= 8; 
+	m_pBmInfo->bmiHeader.biClrImportant		= 256;
+	m_pBmInfo->bmiHeader.biClrUsed			= 256;
+	m_pBmInfo->bmiHeader.biCompression		= BI_RGB;
+	m_pBmInfo->bmiHeader.biHeight			= -sz.cy; 
+	m_pBmInfo->bmiHeader.biPlanes			= 1;
+	m_pBmInfo->bmiHeader.biSize				= sizeof( BITMAPINFOHEADER );
+	m_pBmInfo->bmiHeader.biSizeImage		= sz.cx * sz.cy; 
+	m_pBmInfo->bmiHeader.biWidth			= sz.cx; 
+	m_pBmInfo->bmiHeader.biXPelsPerMeter=0;
+	m_pBmInfo->bmiHeader.biYPelsPerMeter=0;
+	for(int i=0; i<256; i++) // Palette number is 256
+	{
+		m_pBmInfo->bmiColors[i].rgbRed= m_pBmInfo->bmiColors[i].rgbGreen = m_pBmInfo->bmiColors[i].rgbBlue = i; 
+		m_pBmInfo->bmiColors[i].rgbReserved = 0;
+	}
+}
+
+void CViewRecipeInspectionView::DrawMarkImage()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CALIGNMARK_PARM		*pAlignPrm = m_pDlgRecipe->GetAlignMarkPrm((DimensionDir)m_nCndRDSide);
+	if(pAlignPrm == NULL)
+		return;
+
+	CRect rc;
+	CDC *pStaticDC;
+	CWnd *pWnd[MAX_MARKER_COUNT];
+	pWnd[0] = GetDlgItem(IDC_STATIC_MARK1);
+	pWnd[1] = GetDlgItem(IDC_STATIC_MARK2);
+	pWnd[2] = GetDlgItem(IDC_STATIC_MARK3);
+
+	CPen pen(PS_SOLID, 1, RGB(255,0,0)), *pOldPen;
+
+	for(int i = 0; i < MAX_MARKER_COUNT ; i++)
+	{	
+		pWnd[i]->GetClientRect(&rc);
+		pStaticDC = pWnd[i]->GetDC();
+
+		if(pAlignPrm->IpMarkImg[i][m_nCndMarkPos])
+		{	
+			m_pBmInfo->bmiHeader.biWidth		= pAlignPrm->IpMarkImg[i][m_nCndMarkPos]->width;
+			m_pBmInfo->bmiHeader.biHeight		= -pAlignPrm->IpMarkImg[i][m_nCndMarkPos]->height;
+			m_pBmInfo->bmiHeader.biSizeImage	= pAlignPrm->IpMarkImg[i][m_nCndMarkPos]->width * pAlignPrm->IpMarkImg[i][m_nCndMarkPos]->height;
+			pStaticDC->SetStretchBltMode(COLORONCOLOR);
+			StretchDIBits(pStaticDC->GetSafeHdc(), 0 , 0, rc.Width(),rc.Height(),
+				0,0,pAlignPrm->IpMarkImg[i][m_nCndMarkPos]->width,pAlignPrm->IpMarkImg[i][m_nCndMarkPos]->height
+				,pAlignPrm->IpMarkImg[i][m_nCndMarkPos]->imageData,(BITMAPINFO*)m_pBmInfo,DIB_RGB_COLORS,SRCCOPY);	
+		}
+		else
+		{
+			pStaticDC->FillRect(rc,&CBrush(RGB(0,0,0)));	
+		}
+
+		pOldPen = pStaticDC->SelectObject(&pen);
+
+
+		pStaticDC->MoveTo(CPoint(0,rc.Height()/2));
+		pStaticDC->LineTo(CPoint(rc.Width(),rc.Height()/2));
+		pStaticDC->MoveTo(CPoint(rc.Width()/2,0));
+		pStaticDC->LineTo(CPoint(rc.Width()/2,rc.Height()));
+
+		pStaticDC->SelectObject(&pOldPen);
+		pWnd[i]->ReleaseDC(pStaticDC);
+	}
+
+}
+
+void CViewRecipeInspectionView::OnBnClickedCheckMarkModify()
+{
+	if(m_pI2M == NULL)
+		return;
+
+	m_pI2M->IInspectRecipe2RecipeView_ModifyMarker(m_ctrlMarkModify.GetValue());
+}
+
+void CViewRecipeInspectionView::OnBnClickedMarkUpdate_1()	{SetRefMark(0);}
+void CViewRecipeInspectionView::OnBnClickedMarkUpdate_2()	{SetRefMark(1);}
+void CViewRecipeInspectionView::OnBnClickedMarkUpdate_3()	{SetRefMark(2);}
+void CViewRecipeInspectionView::OnBnClickedMarkDelete_1()	{Del_Mark(0);}
+void CViewRecipeInspectionView::OnBnClickedMarkDelete_2()	{Del_Mark(1);}
+void CViewRecipeInspectionView::OnBnClickedMarkDelete_3()	{Del_Mark(2);}
+
+void CViewRecipeInspectionView::Del_Mark(int nMark)
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CALIGNMARK_PARM		*pAlignPrm = m_pDlgRecipe->GetAlignMarkPrm((DimensionDir)m_nCndRDSide);
+	if(pAlignPrm == NULL)
+		return;
+
+	if(AfxMessageBox(_T("Do you want delete?"),MB_YESNO) != IDYES)
+		return;
+
+	if(pAlignPrm->IpMarkImg[nMark][m_nCndMarkPos])
+		cvReleaseImage(&pAlignPrm->IpMarkImg[nMark][m_nCndMarkPos]);
+
+	pAlignPrm->IpMarkImg[nMark][m_nCndMarkPos] = NULL;
+
+	CString		strPath;
+	strPath.Format(_T("%s\\%s\\Align_%d_%d.bmp"),RECIPE_ALIGN_PATH,m_pDlgRecipe->GetRecipeName(),m_nCndRDSide,nMark);
+	::DeleteFile(strPath);
+
+	DrawMarkImage();
+}
+
+void CViewRecipeInspectionView::SetRefMark(int nPos)
+{
+	if(m_pI2M == NULL || m_pDlgRecipe == NULL)
+		return;
+
+	if(m_pI2M->IInspectRecipe2RecipeView_SetMarker(nPos,m_nCndMarkPos) == FALSE)
+		return;	
+
+	DrawMarkImage();
+}
+
+void CViewRecipeInspectionView::SetMarkPos(int nOff_X,int nOff_Y)
+{
+	if(m_ctrlMarkModify.GetValue() == 0)
+		return;
+	if(m_pI2M == NULL)
+		return;
+
+	m_pI2M->IInspectRecipe2RecipeView_SetMarkerPos(nOff_X,nOff_Y);
+}
+
+void CViewRecipeInspectionView::OnBnClickedBtnMarkUp()		{SetMarkPos(0,-1);}
+void CViewRecipeInspectionView::OnBnClickedBtnMarkDn()		{SetMarkPos(0,1);}
+void CViewRecipeInspectionView::OnBnClickedBtnMarkLeft()		{SetMarkPos(-1,0);}
+void CViewRecipeInspectionView::OnBnClickedBtnMarkRight()	{SetMarkPos(1,0);}
+
+LRESULT	CViewRecipeInspectionView::OnSplineApplyRecipe(WPARAM wParam, LPARAM lParam)
+{
+
+	return 0;
+}
+
+LRESULT	CViewRecipeInspectionView::OnNotchApplyRecipe(WPARAM wParam, LPARAM lParam)
+{
+
+	return 0;
+}
\ No newline at end of file
diff --git a/ENRIT/View/ViewRecipeInspectionView.h b/ENRIT/View/ViewRecipeInspectionView.h
new file mode 100644
index 0000000..ef3b6e3
--- /dev/null
+++ b/ENRIT/View/ViewRecipeInspectionView.h
@@ -0,0 +1,132 @@
+#pragma once
+
+#include "btnenh.h"
+#include "General_Draw.h"
+#include "ViewHoleRecipeSetting.h"
+#include "HoleInspector.h"
+#include "ViewSettingSpline.h"
+#include "ViewSettingNotch.h"
+
+interface IInspectRecipeView2Parent
+{
+public:
+	virtual BOOL			IInspectRecipe2RecipeView_SetMarker(int nPos,int nMarkPos) = 0;
+	virtual void			IInspectRecipe2RecipeView_SetMarkerPos(int nOff_X,int nOff_Y) = 0;
+	virtual void			IInspectRecipe2RecipeView_ModifyMarker(BOOL bModify) = 0;
+	virtual void			IInspectRecipe2RecipeView_ChangeSide(int iSide) = 0;
+};
+
+// CViewRecipeInspectionView 措拳 惑磊涝聪促.
+class CHardwareSettings;
+class CGlassRecipe;
+class CViewRecipeInspectionView : public CDialogEx
+								
+{
+	DECLARE_DYNAMIC(CViewRecipeInspectionView)
+
+public:
+	CViewRecipeInspectionView(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewRecipeInspectionView();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_RECIPE_INSPECTSETTING_VIEW };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	afx_msg void OnClickAlignMarkType(UINT nID);	
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);	
+	afx_msg void OnPaint();	
+	LRESULT	OnSplineApplyRecipe(WPARAM wParam, LPARAM lParam);	
+	LRESULT	OnNotchApplyRecipe(WPARAM wParam, LPARAM lParam);	
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+	void			SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe);
+	void			DrawMarkImage();	
+	void			Refresh();
+	void			SetI2M(IInspectRecipeView2Parent *pI2M){m_pI2M=pI2M;}
+	void			SetH2M(IHoleRecipeView2Parent *pH2M){m_pH2V=pH2M;}
+
+protected:
+	enum			eViewCorner {eRcp_Corner_Use=0, eRcp_Corner_End};
+	CBtnEnh			m_ctrlCmdCorner[eRcp_Corner_End];	
+	enum			eViewCmdSide {eRcp_SideRD_A=0, eRcp_SideRD_B, eRcp_SideRD_C, eRcp_SideRD_D,eRcp_SideRD_A_DN,eRcp_SideRD_B_DN,eRcp_SideRD_C_DN,eRcp_SideRD_D_DN,eRcp_SideRD_End};		
+	CBtnEnh			m_ctrlCmdSideBtn[eRcp_SideRD_End];	
+	enum			eViewMarkSel {eRcp_MarkSel_T=0, eRcp_MarkSel_B, eRcp_MarkSel_End};		
+	CBtnEnh			m_ctrlRDMarkBtn[eRcp_MarkSel_End];	
+	enum			eViewMarkPos {eRcp_MarkPos_1=0, eRcp_MarkPos_2,eRcp_MarkPos_3,eRcp_MarkPos_End};
+	CBtnEnh			m_ctrlRDMarkPos[eRcp_MarkPos_End];	
+	enum			eViewMarkEnable {eRcp_MarkEN_A=0, eRcp_MarkEN_B, eRcp_MarkEN_C,eRcp_MarkEN_D,eRcp_MarkEN_A_DN,eRcp_MarkEN_B_DN,eRcp_MarkEN_C_DN,eRcp_MarkEN_D_DN
+									,eRcp_MarkEN_Sub_A, eRcp_MarkEN_Sub_B, eRcp_MarkEN_Sub_C,eRcp_MarkEN_Sub_D, eRcp_MarkEN_End};		
+	CBtnEnh			m_ctrlMarkEnBtn[eRcp_MarkEN_End];	
+	enum			eViewJudgeAnd {eRcp_JudgeAnd_Chip=0,eRcp_JudgeAnd_Burr,eRcp_JudgeAnd_Broken,eRcp_JudgeAnd_CFChip,eRcp_JudgeAnd_CFBurr,eRcp_JudgeAnd_Crack, eRcp_JudgeAnd_End};		
+	CBtnEnh			m_ctrlJudgeAnd[eRcp_JudgeAnd_End];	
+	enum			eViewJudgeUse {eRcp_JudgeUse_Chip=0,eRcp_JudgeUse_Burr,eRcp_JudgeUse_Broken,eRcp_JudgeUse_CFChip,eRcp_JudgeUse_CFBurr,eRcp_JudgeUse_Crack, eRcp_JudgeUse_End};		
+	CBtnEnh			m_ctrlJudgeUse[eRcp_JudgeUse_End];		
+	CBtnEnh			m_ctrlMarkModify;
+
+protected:
+	void			ClickChkUseCornerButton();
+	void			ClickChkSideSelButton();
+	void			ClickChkMarkSelButton();
+	void			ClickChkMarkPosButton();
+	void			ClickChkMarkEnableButton();
+	void			ClickChkJudgeAndButton();
+	void			ClickChkJudgeUSEButton();	
+	void			OnBnClickedCheckMarkModify();
+	void			OnBnClickedMarkUpdate_1();
+	void			OnBnClickedMarkUpdate_2();
+	void			OnBnClickedMarkUpdate_3();
+	void			OnBnClickedMarkDelete_1();
+	void			OnBnClickedMarkDelete_2();
+	void			OnBnClickedMarkDelete_3();
+	void			OnBnClickedBtnMarkLeft();
+	void			OnBnClickedBtnMarkUp();
+	void			OnBnClickedBtnMarkDn();
+	void			OnBnClickedBtnMarkRight();
+	void			ClickHoleSettingButton();
+	void			OnBnClickedBtnRCutSettins();
+	void			OnBnClickedBtnNotchSettins();
+
+	void			SetButtonEnable(const BOOL& bEnable);	
+	void			ChangViewCdmRD(int nID);	
+	void			SetFontControl();
+	void			SetControlButton();	
+	void			SetButtonEnableCmdSide(const BOOL& bEnable);
+	void			SetEnableCmdSide(eViewCmdSide eSelView, BOOL bEnable);
+	void			ChangViewCdmSide(UINT nID);
+	void			SetButtonMarkEnableAll(const BOOL& bEnable);
+	void			SetButtonMarkSelTB(eViewMarkSel eSelView, BOOL bEnable);
+	void			SetButtonMarkPosEnableAll(const BOOL& bEnable);
+	void			SetButtonMarkPos(eViewMarkPos eSelView, BOOL bEnable);
+	void			ChangeViewMarkSel(UINT nID);
+	void			ChangeViewMarkPos(UINT nID);
+	void			ChangeMarkEnable(BOOL bWrite);
+	void			SetButtonMarkEnAllEnable(const BOOL& bEnable);
+
+	void			SetButtonJudgeAndEnable(const BOOL& bEnable);
+	void			SetButtonJudgeUseEnable(const BOOL& bEnable);	
+
+	void			ChangeSideSelect(eViewCmdSide eSelView);
+	void			SetRefMark(int nPos);
+	void			Del_Mark(int nMark);
+	void			SetMarkPos(int nOff_X,int nOff_Y);
+	void			Init_BitmapInfo();
+
+protected:
+	BITMAPINFO		*m_pBmInfo;
+	CViewSettingSpline			*m_pViewSettingSpline;
+	CViewSettingNotch			*m_pViewSettingNotch;
+	CViewHoleRecipeSetting		*m_pViewHoleRecipeSetting;
+	IHoleRecipeView2Parent		*m_pH2V;	
+	int				m_nCndRDSide;
+	int				m_nCndMarkSel;	
+	int				m_nCndMarkPos;
+	CHardwareSettings	*m_pHardware;
+	CGlassRecipe	*m_pDlgRecipe;
+	IInspectRecipeView2Parent	*m_pI2M;
+	CFontControl				m_FontControl;
+};
diff --git a/ENRIT/View/ViewRecipeList.cpp b/ENRIT/View/ViewRecipeList.cpp
new file mode 100644
index 0000000..017464a
--- /dev/null
+++ b/ENRIT/View/ViewRecipeList.cpp
@@ -0,0 +1,696 @@
+
+#include "stdafx.h"
+#include "ViewRecipeList.h"
+#include "ViewRecipeNew.h"
+#include "ViewPPIDNew.h"
+
+const int LIST_COLUMN_COUNT = 2;
+const TCHAR* LIST_COLUMN_ITEM[LIST_COLUMN_COUNT] = {_T("No"),_T("Recipe")};
+const int LIST_COLUMN_WIDHT[LIST_COLUMN_COUNT] = {50,275};
+
+const int PPIDLIST_COLUMN_COUNT = 3;
+const TCHAR* PPIDLIST_COLUMN_ITEM[PPIDLIST_COLUMN_COUNT] = {_T("No"),_T("PLC Index"),_T("Recipe")};
+const int PPIDLIST_COLUMN_WIDHT[PPIDLIST_COLUMN_COUNT] = {50,130,145};
+
+// CViewRecipeList 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewRecipeList, CDialogEx)
+
+CViewRecipeList::CViewRecipeList(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewRecipeList::IDD, pParent)
+{
+	m_strRecipeName.Empty();
+	m_strPPIDName.Empty();
+	m_strSelectRecipe.Empty();
+	m_VectorLinkList = NULL;
+	m_pParent = pParent;
+}
+
+CViewRecipeList::~CViewRecipeList()
+{
+}
+
+void CViewRecipeList::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Control(pDX,IDC_RECIPE_LIST,m_ListRecipe);
+	DDX_Control(pDX,IDC_PPID_LIST,m_ListPPID);
+	
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewRecipeList, CDialogEx)
+	
+	ON_WM_SHOWWINDOW()
+	ON_BN_CLICKED(IDC_BUT_LIST_NEWRECIPE, &CViewRecipeList::OnBnClickedButListNewrecipe)
+	ON_BN_CLICKED(IDC_BUT_LIST_SELECT, &CViewRecipeList::OnBnClickedButListSelect)
+	ON_BN_CLICKED(IDC_BUT_LIST_EXIT, &CViewRecipeList::OnBnClickedButListExit)
+	ON_NOTIFY(NM_CLICK, IDC_RECIPE_LIST, OnListRecipeClick)	
+	ON_NOTIFY(NM_CLICK, IDC_PPID_LIST, OnListPPIDClick)
+	ON_WM_PAINT()
+	ON_BN_CLICKED(IDC_BUT_LIST_NEWPPID, &CViewRecipeList::OnBnClickedButListNewppid)
+	ON_BN_CLICKED(IDC_BUT_LIST_DELPPID, &CViewRecipeList::OnBnClickedButListDelppid)
+	ON_BN_CLICKED(IDC_BUTTON_LINK, &CViewRecipeList::OnBnClickedButtonLink)
+	ON_BN_CLICKED(IDC_BUT_LIST_DELRECIPE, &CViewRecipeList::OnBnClickedButListDelrecipe)//20141006	
+END_MESSAGE_MAP()
+
+
+BOOL CViewRecipeList::OnInitDialog()
+{
+	SetControl();
+	Init_PPIDGrid();
+
+	return TRUE;
+}
+
+void CViewRecipeList::SetRecipeName(CString strPPID,CString strRecipe)
+{
+	m_strPPIDName = strPPID;
+	m_strRecipeName = strRecipe;	
+}
+
+void CViewRecipeList::LoadRecipeList()
+{
+	m_arrRecipeList.RemoveAll();
+	m_arrRecipeFileList.RemoveAll();
+
+	CString		strPath;
+	CString		strFileName,strFilePath;
+	CFileFind	finder;
+
+	strPath.Format(_T("%s\\*.rcp"),RECIPE_PATH);
+
+	BOOL		bWorking = finder.FindFile(strPath);		
+
+	while (bWorking)
+	{
+		bWorking = finder.FindNextFile();		
+
+		if (finder.IsDots())
+			continue;		
+
+		if (!finder.IsDirectory())
+		{
+			strFilePath = finder.GetFilePath();
+			strFileName = finder.GetFileTitle();		
+
+			m_arrRecipeList.Add(strFileName);
+			m_arrRecipeFileList.Add(strFilePath);
+		}
+	}
+	finder.Close();		
+}
+
+// CViewRecipeList 皋矫瘤 贸府扁涝聪促.
+
+void CViewRecipeList::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	CDialogEx::OnShowWindow(bShow, nStatus);
+	
+	if(bShow == TRUE)
+	{		
+		UpdateData(FALSE);
+		Init_PPIDGrid();
+		LoadRecipeList();
+		FillRecipeList();
+		FillPPIDList();
+	}
+}
+
+void CViewRecipeList::SetControl()
+{
+	m_FontControl.SetFont(this,IDC_BUT_LIST_NEWRECIPE,CFontControl::EN_ITEMFONT);
+	m_FontControl.SetFont(this,IDC_BUT_LIST_NEWPPID,CFontControl::EN_ITEMFONT);
+	m_FontControl.SetFont(this,IDC_BUT_LIST_DELPPID,CFontControl::EN_ITEMFONT);
+	m_FontControl.SetFont(this,IDC_BUT_LIST_DELRECIPE,CFontControl::EN_ITEMFONT);
+
+	m_FontControl.SetFont(this,IDC_BUT_LIST_SELECT,CFontControl::EN_ITEMFONT);
+	m_FontControl.SetFont(this,IDC_BUT_LIST_EXIT,CFontControl::EN_ITEMFONT);		
+
+	HBITMAP	BmpArrow= ::LoadBitmap(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDB_BITMAP_RECIPE_LINKARROW));
+	((CButton*)GetDlgItem(IDC_BUTTON_LINK))->SetBitmap(BmpArrow);
+}
+
+void CViewRecipeList::FillPPIDList()
+{
+	if(m_ListPPID.GetSafeHwnd() == NULL)
+		return;
+
+	if(m_VectorLinkList == NULL)
+	{
+		m_ListPPID.SetRowCount(1);
+		return;
+	}
+
+	m_ListPPID.SetRowCount((int)m_VectorLinkList->size()+1);
+
+	int			nRowCnt = (int)m_VectorLinkList->size()+1;
+	int			iRow,iCol;	
+	CString		str;
+
+	iRow = 1;
+	LinkList* pList = NULL;
+	for (VectorLinkListIt it = m_VectorLinkList->begin(); it != m_VectorLinkList->end(); it++)
+	{	
+		pList = *it;
+		if(!pList)
+			continue;
+
+		iCol = 0;				
+		str.Format(_T("%d"),iRow);
+		m_ListPPID.SetItemText(iRow,iCol,str);
+		iCol++;
+
+		str.Format(_T("%s"),pList->m_strUpperName);
+		m_ListPPID.SetItemText(iRow,iCol,str);		
+		iCol++;
+
+		str.Format(_T("%s"),pList->m_strInsName);
+		m_ListPPID.SetItemText(iRow,iCol,str);		
+
+		iRow++;
+	}
+
+	m_ListPPID.Invalidate();
+}
+
+void CViewRecipeList::FillRecipeList()
+{
+	Init_Grid();
+
+	if(m_ListRecipe.GetSafeHwnd() == NULL)
+		return;
+
+	int			nRowCnt = (int)m_arrRecipeList.GetSize()+1;
+	int			iRow,iCol;	
+	CString		str;
+
+	for(iRow=1;iRow<nRowCnt;iRow++)
+	{				
+		iCol = 0;				
+		str.Format(_T("%d"),iRow);
+		m_ListRecipe.SetItemText(iRow,iCol,str);
+		iCol++;
+
+		str.Format(_T("%s"),m_arrRecipeList.GetAt(iRow-1));
+		m_ListRecipe.SetItemText(iRow,iCol,str);		
+	}
+
+	m_ListRecipe.Invalidate();
+}
+
+void CViewRecipeList::Init_Grid()
+{
+	if(m_ListRecipe.GetSafeHwnd() == NULL)
+		return;
+
+	m_ListRecipe.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xE0));
+	m_ListRecipe.SetGridLines(GVL_BOTH);	
+
+	m_ListRecipe.SetColumnCount(LIST_COLUMN_COUNT);
+	m_ListRecipe.SetRowCount((int)m_arrRecipeList.GetSize()+1);
+	m_ListRecipe.SetFixedRowCount(1);
+	m_ListRecipe.SetFixedColumnCount(0);
+	m_ListRecipe.ExpandColumnsToFit();
+
+	CFont *pFont = m_ListRecipe.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_ListRecipe.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_ListRecipe.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_ListRecipe.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_ListRecipe.SetEditable(FALSE);
+	m_ListRecipe.EnableSelection(TRUE);
+
+	Init_GridHeader();
+}
+
+void CViewRecipeList::Init_GridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<LIST_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = LIST_COLUMN_ITEM[iLoop];
+		m_ListRecipe.SetItem(&Item);	
+		m_ListRecipe.SetColumnWidth(Item.col,LIST_COLUMN_WIDHT[iLoop]);
+	}
+
+	m_ListRecipe.Invalidate();
+}
+
+void CViewRecipeList::Init_PPIDGrid()
+{
+	if(m_ListPPID.GetSafeHwnd() == NULL)
+		return;
+
+	m_ListPPID.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xE0));
+	m_ListPPID.SetGridLines(GVL_BOTH);	
+
+	m_ListPPID.SetColumnCount(PPIDLIST_COLUMN_COUNT);
+	m_ListPPID.SetRowCount(1);
+	m_ListPPID.SetFixedRowCount(1);
+	m_ListPPID.SetFixedColumnCount(0);
+	m_ListPPID.ExpandColumnsToFit();
+
+	CFont *pFont = m_ListPPID.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_ListPPID.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_ListPPID.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_ListPPID.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_ListPPID.SetEditable(FALSE);
+	m_ListPPID.EnableSelection(TRUE);
+
+	Init_PPIDGridHeader();
+}
+
+void CViewRecipeList::Init_PPIDGridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<PPIDLIST_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = PPIDLIST_COLUMN_ITEM[iLoop];
+		m_ListPPID.SetItem(&Item);	
+		m_ListPPID.SetColumnWidth(Item.col,PPIDLIST_COLUMN_WIDHT[iLoop]);
+	}
+
+	m_ListPPID.Invalidate();
+}
+
+void CViewRecipeList::OnBnClickedButListNewrecipe()
+{	
+	CString				strNewRecipe,strCopyRecipe,strNewComment;
+	
+	strCopyRecipe = m_strSelectRecipe;//20141006
+	
+	CViewRecipeNew	dlgRecipeNew;
+
+	if(dlgRecipeNew.DoModal() == IDOK)
+	{
+		strNewRecipe = dlgRecipeNew.GetNewRecipeName();
+		strNewComment = dlgRecipeNew.GetNewRecipeComment();
+		if(strNewRecipe.IsEmpty() == TRUE)
+		{
+			AfxMessageBox(_T("No Recipe Name"));
+			return;
+		}
+
+		if(strCopyRecipe.IsEmpty() == FALSE)
+		{
+			///////20141006
+			CString str;
+
+			str.Format(_T("Copy [%s] -> [%s]?"),strCopyRecipe,strNewRecipe);
+
+			if (IDNO == AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION))
+			{
+				str.Format(_T("Create New [%s]?"),strNewRecipe);
+
+				if (IDNO == AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION))
+					return;
+
+				CGlassRecipe	GlassRecipe;
+
+				GlassRecipe.Reset();
+				GlassRecipe.MakeRecipeFileName(strNewRecipe);
+				GlassRecipe.m_GlassParm.m_strDisp = strNewComment;
+				if(GlassRecipe.WriteRecipeFile() == FALSE)
+					AfxMessageBox(_T("Write New Recipe Fail!"));
+			}		
+			else
+			{
+				CString			strOrg,strTgt;	
+
+				strOrg.Format(_T("%s\\%s.rcp"),RECIPE_PATH,strCopyRecipe);
+				strTgt.Format(_T("%s\\%s.rcp"),RECIPE_PATH,strNewRecipe);
+
+				if(CopyFile(strOrg,strTgt,FALSE) == FALSE)
+					AfxMessageBox(_T("Copy Recipe Fail!"));				
+
+				CString		strSide[MAX_PANEL_SIDE] = {_T("A"),_T("B"),_T("C"),_T("D")};
+
+				// Spline
+				for(int i=0;i<MAX_PANEL_SIDE;i++)
+				{
+					strOrg.Format(_T("C:\\RCutProject\\Spline\\%s_RCut_%s.bmp"),strCopyRecipe,strSide[i]);
+					strTgt.Format(_T("C:\\RCutProject\\Spline\\%s_RCut_%s.bmp"),strNewRecipe,strSide[i]);
+					CopyFile(strOrg,strTgt,FALSE);
+
+					strOrg.Format(_T("C:\\RCutProject\\Spline\\%s_RCut_%s.rcut"),strCopyRecipe,strSide[i]);
+					strTgt.Format(_T("C:\\RCutProject\\Spline\\%s_RCut_%s.rcut"),strNewRecipe,strSide[i]);
+					CopyFile(strOrg,strTgt,FALSE);
+
+					strOrg.Format(_T("C:\\RCutProject\\Profile\\%s_%s_CAD.bmp"),strCopyRecipe,strSide[i]);
+					strTgt.Format(_T("C:\\RCutProject\\Profile\\%s_%s_CAD.bmp"),strNewRecipe,strSide[i]);
+					CopyFile(strOrg,strTgt,FALSE);
+
+					strOrg.Format(_T("C:\\RCutProject\\Profile\\%s_%s.prf"),strCopyRecipe,strSide[i]);
+					strTgt.Format(_T("C:\\RCutProject\\Profile\\%s_%s.prf"),strNewRecipe,strSide[i]);
+					CopyFile(strOrg,strTgt,FALSE);
+				}
+
+				// User Defect
+				strOrg.Format(_T("C:\\RCutProject\\Recipe\\UserDefect\\%s_UserDefectArea.ini"),strCopyRecipe);
+				strTgt.Format(_T("C:\\RCutProject\\Recipe\\UserDefect\\%s_UserDefectArea.ini"),strNewRecipe);
+				CopyFile(strOrg,strTgt,FALSE);
+
+				// Exp Area
+				strOrg.Format(_T("C:\\RCutProject\\Recipe\\ExpArea\\%s_ExpArea.ins"),strCopyRecipe);
+				strTgt.Format(_T("C:\\RCutProject\\Recipe\\ExpArea\\%s_ExpArea.ins"),strNewRecipe);
+				CopyFile(strOrg,strTgt,FALSE);
+
+				// Align
+				strTgt.Format(_T("C:\\RCutProject\\Align\\%s"),strNewRecipe);
+				CreateDirectory(strTgt,NULL);
+
+				strOrg.Format(_T("C:\\RCutProject\\Align\\%s\\*.bmp"),strCopyRecipe);
+
+				CFileFind	pFinder;
+				BOOL		bWorking;
+				CString		szFile,szName;
+				int			nIndex;
+
+				bWorking = pFinder.FindFile(strOrg);		
+				while (bWorking)		
+				{		
+					bWorking = pFinder.FindNextFile();		
+
+					if(pFinder.IsDots()) continue;		
+					if(pFinder.IsDirectory()) continue;		
+
+					szFile = pFinder.GetFilePath();     
+					nIndex = szFile.ReverseFind('\\');
+					if(nIndex < 0) 
+						continue;
+					szName = szFile.Right(szFile.GetLength()-(nIndex+1));
+					if(szName.IsEmpty() == TRUE) 
+						continue;
+
+					strTgt.Format(_T("C:\\RCutProject\\Align\\%s\\%s"),strNewRecipe,szName);
+					CopyFile(szFile,strTgt,FALSE);
+				}				
+			}			
+		}
+		else
+		{
+			///////20141006
+			CString str;
+
+			str.Format(_T("Create new [%s]?"),strNewRecipe);
+
+			if (IDNO == AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION))
+				return;
+			///////20141006			
+
+			CGlassRecipe	GlassRecipe;
+
+			GlassRecipe.Reset();
+			GlassRecipe.MakeRecipeFileName(strNewRecipe);
+			GlassRecipe.m_GlassParm.m_strDisp = strNewComment;
+			if(GlassRecipe.WriteRecipeFile() == FALSE)
+				AfxMessageBox(_T("Write New Recipe Fail!"));
+		}
+
+		LoadRecipeList();
+		FillRecipeList();
+	}	
+}
+
+void CViewRecipeList::OnBnClickedButListSelect()
+{
+	m_pParent->PostMessage(UM_SELECT_RECIPE,NULL,NULL);
+	OnOK();
+}
+
+void CViewRecipeList::OnBnClickedButListExit()
+{
+	OnCancel();
+}
+
+void CViewRecipeList::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	
+	CGeneralDraw			pDraw;
+	CUIPictureControl		uiTitleRecipeName;
+	CUIPictureControl		uiTitlePPIDName;
+
+	uiTitleRecipeName.SetItemDefault(this,IDC_LIST_RECIPE_NAME);		
+	uiTitleRecipeName.m_strData.Format(_T("%s"),m_strRecipeName);
+	pDraw.DrawPitureControl(uiTitleRecipeName);
+	
+	uiTitlePPIDName.SetTitleDefault(this,IDC_LIST_PPID_NAME);	
+	uiTitlePPIDName.m_strData.Format(_T("%s"),m_strPPIDName);
+	pDraw.DrawPitureControl(uiTitlePPIDName);
+	
+}
+
+void CViewRecipeList::OnListPPIDClick(NMHDR *pNotifyStruct, LRESULT* pResult)
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
+
+	if(pItem->iRow <= 0 || m_VectorLinkList == NULL || pItem->iRow > (int)m_VectorLinkList->size())
+		return;
+
+	VectorLinkListIt it;
+	LinkList* pList = NULL;
+	int			nIndex = pItem->iRow-1;
+	int			nCount = 0;
+	
+	m_strRecipeName.Empty();
+	m_strPPIDName.Empty();
+	m_strSelectRecipe.Empty();
+
+	for (it = m_VectorLinkList->begin(); it != m_VectorLinkList->end(); it++,nCount++)
+	{	
+		pList = *it;
+		if(!pList)
+			continue;
+
+		if(nCount == nIndex)
+		{
+			m_strPPIDName = pList->m_strUpperName;
+			break;
+		}		
+	}
+
+	if(m_strPPIDName.IsEmpty() == TRUE)
+		return;	
+	
+	for (it = m_VectorLinkList->begin(); it != m_VectorLinkList->end(); it++)
+	{	
+		pList = *it;
+		if(!pList)
+			continue;
+		if(pList->m_strUpperName.CompareNoCase(m_strPPIDName) == 0)
+		{
+			m_strRecipeName = pList->m_strInsName;	
+		}		
+	}	
+
+	Invalidate(FALSE);
+}
+
+void CViewRecipeList::OnListRecipeClick(NMHDR *pNotifyStruct, LRESULT* pResult)
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;	
+
+	m_strSelectRecipe.Empty();
+	if(pItem->iRow <= 0 || pItem->iRow > (int)m_arrRecipeList.GetSize())
+		return;
+
+	int			nIndex = pItem->iRow-1;
+
+	m_strSelectRecipe = m_arrRecipeList.GetAt(nIndex);
+}
+
+
+void CViewRecipeList::OnBnClickedButListNewppid()
+{
+	if(m_VectorLinkList == NULL)
+		return;
+
+	CViewPPIDNew			dlgPPID;
+	CString					strNewPPID;
+
+	if(dlgPPID.DoModal() == IDOK)
+	{
+		strNewPPID = dlgPPID.GetNewRecipeName();		
+		if(strNewPPID.IsEmpty() == TRUE)
+		{
+			AfxMessageBox(_T("No PPID Name"));
+			return;
+		}
+
+		LinkList* pList = NULL;
+		for (VectorLinkListIt it = m_VectorLinkList->begin(); it != m_VectorLinkList->end(); it++)
+		{	
+			pList = *it;
+			if(!pList)
+				continue;
+			if(strNewPPID == pList->m_strUpperName)
+			{
+				AfxMessageBox(_T("Already existing Upper PPID"));
+				return;
+			}		
+		}	
+		
+		strNewPPID.MakeUpper();
+		LinkList* pSetList = new LinkList;
+		pSetList->m_strUpperName = strNewPPID;		
+		m_VectorLinkList->push_back(pSetList);
+
+		m_strPPIDName = strNewPPID;
+		FillPPIDList();
+		UpdateData(FALSE);
+	}		
+}
+
+void CViewRecipeList::OnBnClickedButListDelppid()
+{	
+	LinkList* pList = NULL;
+	for (VectorLinkListIt it = m_VectorLinkList->begin(); it != m_VectorLinkList->end(); it++)
+	{
+		pList = *it;
+		if (pList)
+		{
+			if(pList->m_strUpperName.CollateNoCase(m_strPPIDName) == 0)
+			{
+				if (IDNO == AfxMessageBox(_T("Are you sure you want to delete?"), MB_YESNO | MB_ICONQUESTION))
+					return;
+
+				m_VectorLinkList->erase(it);
+				delete pList;
+				break;
+			}
+		}		
+	}		
+	
+	FillPPIDList();	
+}
+
+void CViewRecipeList::OnBnClickedButtonLink()
+{
+	if(m_strSelectRecipe.IsEmpty() == TRUE)
+	{
+		AfxMessageBox(_T("Please select Recipe."));
+		return;
+	}
+
+	CString			str;
+
+	str.Format(_T("Are you sure you want to connect PPID [%s] to Recipe [%s]?"),m_strPPIDName,m_strSelectRecipe);
+	if (IDNO == AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION))
+		return;
+
+	m_strRecipeName = m_strSelectRecipe;
+
+	LinkList* pList = NULL;
+	for (VectorLinkListIt it = m_VectorLinkList->begin(); it != m_VectorLinkList->end(); it++)
+	{
+		pList = *it;
+		if (pList)
+		{
+			if(pList->m_strUpperName.CollateNoCase(m_strPPIDName) == 0)
+			{				
+				pList->m_strInsName = m_strRecipeName;
+				break;
+			}
+		}		
+	}	
+
+	FillPPIDList();	
+	Invalidate(FALSE);
+}
+
+void CViewRecipeList::OnBnClickedButListDelrecipe()//20141006
+{
+	if(m_strSelectRecipe.IsEmpty())
+	{
+		AfxMessageBox(_T("Please select a recipe to delete."));
+		return;
+	}
+
+	CString str;
+
+	str.Format(_T("Are you sure you want to delete the [%s]recipe?"),m_strSelectRecipe);
+
+	if (IDNO == AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION))
+		return;
+
+	CString strPath;
+
+	strPath.Format(_T("%s\\%s.rcp"),RECIPE_PATH,m_strSelectRecipe);
+
+	DeleteFile(strPath);
+
+	for (int i=0; i<4; i++)
+	{
+		strPath.Format(_T("C:\\RCutProject\\MasterImage\\%s_Dimension_[%d].bmp"),m_strSelectRecipe,i);
+		DeleteFile(strPath);
+
+		strPath.Format(_T("C:\\RCutProject\\Notch\\%s_[%d].notch"),m_strSelectRecipe,i);
+		DeleteFile(strPath);
+
+		strPath.Format(_T("C:\\RCutProject\\Notch\\%s_[%d]_notch.bmp"),m_strSelectRecipe,i);
+		DeleteFile(strPath);
+
+		strPath.Format(_T("C:\\RCutProject\\Notch\\%s_[%d]_Notch_org.bmp"),m_strSelectRecipe,i);
+		DeleteFile(strPath);
+
+		strPath.Format(_T("C:\\RCutProject\\Notch\\%s_Notch_Align_Mark_[%d].bmp"),m_strSelectRecipe,i);
+		DeleteFile(strPath);		
+	}
+
+	strPath.Format(_T("C:\\RCutProject\\Spline\\%s_CCut.bmp"),m_strSelectRecipe);
+	DeleteFile(strPath);
+
+	strPath.Format(_T("C:\\RCutProject\\Spline\\%s_CCut.ccut"),m_strSelectRecipe);
+	DeleteFile(strPath);
+
+	strPath.Format(_T("C:\\RCutProject\\Spline\\%s_CCut_org.bmp"),m_strSelectRecipe);
+	DeleteFile(strPath);
+
+	strPath.Format(_T("C:\\RCutProject\\Spline\\%s_RCut.bmp"),m_strSelectRecipe);
+	DeleteFile(strPath);
+
+	strPath.Format(_T("C:\\RCutProject\\Spline\\%s_RCut.ccut"),m_strSelectRecipe);
+	DeleteFile(strPath);
+
+	strPath.Format(_T("C:\\RCutProject\\Spline\\%s_RCut_org.bmp"),m_strSelectRecipe);
+	DeleteFile(strPath);	
+
+	LoadRecipeList();
+	FillRecipeList();
+}
+
diff --git a/ENRIT/View/ViewRecipeList.h b/ENRIT/View/ViewRecipeList.h
new file mode 100644
index 0000000..3e59ce1
--- /dev/null
+++ b/ENRIT/View/ViewRecipeList.h
@@ -0,0 +1,72 @@
+#pragma once
+
+#include "General_Draw.h"
+
+#include "ENRIT.h"
+#include "Global_Define.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+#include "Glass_Data.h"
+
+// CViewRecipeList 措拳 惑磊涝聪促.
+
+#define		UM_SELECT_RECIPE					(WM_USER + 1001)
+
+class CViewRecipeList : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewRecipeList)
+
+public:
+	CViewRecipeList(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewRecipeList();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_RECIPE_LIST };
+
+protected:
+	virtual BOOL OnInitDialog();
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	afx_msg void OnBnClickedButListNewrecipe();
+	afx_msg void OnBnClickedButListSelect();
+	afx_msg void OnBnClickedButListExit();
+	afx_msg void OnPaint();
+	afx_msg void OnListRecipeClick(NMHDR *pNotifyStruct, LRESULT* pResult);
+	afx_msg void OnListPPIDClick(NMHDR *pNotifyStruct, LRESULT* pResult);
+	afx_msg void OnBnClickedButListNewppid();
+	afx_msg void OnBnClickedButListDelppid();
+	afx_msg void OnBnClickedButtonLink();
+	afx_msg void OnBnClickedButListDelrecipe();//20141006
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void		SetRecipeName(CString strPPID,CString strRecipe);
+	CString		GetRecipeName(){return m_strRecipeName;}
+	CString		GetPPIDName(){return m_strPPIDName;}
+	void		SetLinkList(VectorLinkList *pList){m_VectorLinkList=pList;}
+	void		SetParent(CWnd *pWnd){m_pParent=pWnd;}
+
+protected:
+	void		LoadRecipeList();
+	void		FillRecipeList();
+	void		Init_Grid();	
+	void		Init_GridHeader();
+	void		Init_PPIDGrid();	
+	void		Init_PPIDGridHeader();
+	void		FillPPIDList();
+	void		SetControl();	
+
+protected:
+	CGridCtrl			m_ListRecipe;
+	CGridCtrl			m_ListPPID;
+	CString				m_strPPIDName;
+	CString				m_strRecipeName;	
+	CString				m_strSelectRecipe;
+	CStringArray		m_arrRecipeList;
+	CStringArray		m_arrRecipeFileList;	
+	CFontControl		m_FontControl;
+	VectorLinkList		*m_VectorLinkList;
+	CWnd				*m_pParent;
+	
+};
diff --git a/ENRIT/View/ViewRecipeNew.cpp b/ENRIT/View/ViewRecipeNew.cpp
new file mode 100644
index 0000000..cdcb9cc
--- /dev/null
+++ b/ENRIT/View/ViewRecipeNew.cpp
@@ -0,0 +1,97 @@
+//
+
+#include "stdafx.h"
+#include "ViewRecipeNew.h"
+
+
+// CViewRecipeNew 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewRecipeNew, CDialog)
+
+CViewRecipeNew::CViewRecipeNew(CWnd* pParent /*=NULL*/)
+	: CDialog(CViewRecipeNew::IDD, pParent)
+{
+	
+}
+
+CViewRecipeNew::~CViewRecipeNew()
+{
+}
+
+void CViewRecipeNew::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Text(pDX,IDC_EDIT_RECIPENEW_NAME,m_strNewRecipeName);
+	DDX_Text(pDX,IDC_EDIT_RECIPENEW_COMMENT,m_strNewRecipeComment);
+	
+	CDialog::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewRecipeNew, CDialog)	
+	ON_WM_PAINT()
+	ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewRecipeNew, CDialog)
+	ON_EVENT(CViewRecipeNew, IDC_BTN_RECIPENEW_OK, DISPID_CLICK, CViewRecipeNew::ClickBtnRecipenewOk, VTS_NONE)
+	ON_EVENT(CViewRecipeNew, IDC_BTN_RECIPENEW_CANCEL, DISPID_CLICK, CViewRecipeNew::ClickBtnRecipenewCancel, VTS_NONE)
+END_EVENTSINK_MAP()
+// CViewRecipeNew 皋矫瘤 贸府扁涝聪促.
+
+BOOL CViewRecipeNew::OnInitDialog()
+{	
+	m_FontControl.SetFont(this,IDC_EDIT_RECIPENEW_NAME,CFontControl::EN_MIDDLEFONT);
+	m_FontControl.SetFont(this,IDC_EDIT_RECIPENEW_COMMENT,CFontControl::EN_MIDDLEFONT);
+
+	return TRUE;
+}
+
+void CViewRecipeNew::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	
+	CGeneralDraw			pDraw;
+	CUIPictureControl		uiTitleRecipeName,uiTitleComment;
+
+	uiTitleRecipeName.SetItemDefault(this,IDC_NEWRECIPE_NAME_TITLE);	
+	uiTitleRecipeName.m_nFontsize = 24;
+	uiTitleRecipeName.m_strData.Format(_T("%s"),_T("New Recipe Name"));
+
+	uiTitleComment.SetItemDefault(this,IDC_NEWRECIPE_NAME_TITLE2);	
+	uiTitleComment.m_nFontsize = 24;
+	uiTitleComment.m_strData.Format(_T("%s"),_T("Comment"));
+
+	pDraw.DrawPitureControl(uiTitleRecipeName);
+	pDraw.DrawPitureControl(uiTitleComment);
+}
+
+void CViewRecipeNew::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	CDialog::OnShowWindow(bShow, nStatus);
+
+	if(bShow == TRUE)
+	{
+		((CWnd*)GetDlgItem(IDC_EDIT_RECIPENEW_NAME))->SetFocus();
+	}
+}
+
+
+void CViewRecipeNew::ClickBtnRecipenewOk()
+{
+	UpdateData(TRUE);
+
+	if(m_strNewRecipeName.IsEmpty() == TRUE)
+	{
+		AfxMessageBox(_T("Input Recipe Name"));
+		((CWnd*)GetDlgItem(IDC_EDIT_RECIPENEW_NAME))->SetFocus();
+		return;
+	}
+
+	OnOK();
+}
+
+
+void CViewRecipeNew::ClickBtnRecipenewCancel()
+{
+	OnCancel();
+}
diff --git a/ENRIT/View/ViewRecipeNew.h b/ENRIT/View/ViewRecipeNew.h
new file mode 100644
index 0000000..dae4fb6
--- /dev/null
+++ b/ENRIT/View/ViewRecipeNew.h
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "ENRIT.h"
+#include "General_Draw.h"
+
+
+class CViewRecipeNew : public CDialog
+{
+	DECLARE_DYNAMIC(CViewRecipeNew)
+
+public:
+	CViewRecipeNew(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewRecipeNew();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_RECIPE_NEW };
+
+protected:
+	virtual BOOL OnInitDialog();
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	afx_msg void OnPaint();
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);	
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+	void ClickBtnRecipenewOk();
+	void ClickBtnRecipenewCancel();
+
+public:
+	CString			GetNewRecipeName(){return m_strNewRecipeName;}
+	CString			GetNewRecipeComment(){return m_strNewRecipeComment;}
+
+protected:
+	CString				m_strNewRecipeName;	
+	CString				m_strNewRecipeComment;	
+	CFontControl		m_FontControl;
+
+};
diff --git a/ENRIT/View/ViewRecipeProfileView.cpp b/ENRIT/View/ViewRecipeProfileView.cpp
new file mode 100644
index 0000000..1877287
--- /dev/null
+++ b/ENRIT/View/ViewRecipeProfileView.cpp
@@ -0,0 +1,366 @@
+// ViewRecipeProfileView.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewRecipeProfileView.h"
+#include "afxdialogex.h"
+#include "Global_Define.h"
+
+// CViewRecipeProfileView 措拳 惑磊涝聪促.
+
+
+UINT		nID_Y[]={IDC_EDIT_PROFILE_SETTING_Y_1,IDC_EDIT_PROFILE_SETTING_Y_2,IDC_EDIT_PROFILE_SETTING_Y_3,IDC_EDIT_PROFILE_SETTING_Y_4,IDC_EDIT_PROFILE_SETTING_Y_5
+	,IDC_EDIT_PROFILE_SETTING_Y_6,IDC_EDIT_PROFILE_SETTING_Y_7,IDC_EDIT_PROFILE_SETTING_Y_8,IDC_EDIT_PROFILE_SETTING_Y_9,IDC_EDIT_PROFILE_SETTING_Y_10
+	,IDC_EDIT_PROFILE_SETTING_Y_11,IDC_EDIT_PROFILE_SETTING_Y_12,IDC_EDIT_PROFILE_SETTING_Y_13,IDC_EDIT_PROFILE_SETTING_Y_14,IDC_EDIT_PROFILE_SETTING_Y_15
+	,IDC_EDIT_PROFILE_SETTING_Y_16,IDC_EDIT_PROFILE_SETTING_Y_17,IDC_EDIT_PROFILE_SETTING_Y_18,IDC_EDIT_PROFILE_SETTING_Y_19,IDC_EDIT_PROFILE_SETTING_Y_20
+	,IDC_EDIT_PROFILE_SETTING_Y_21,IDC_EDIT_PROFILE_SETTING_Y_22,IDC_EDIT_PROFILE_SETTING_Y_23,IDC_EDIT_PROFILE_SETTING_Y_24,IDC_EDIT_PROFILE_SETTING_Y_25
+	,IDC_EDIT_PROFILE_SETTING_Y_26,IDC_EDIT_PROFILE_SETTING_Y_27,IDC_EDIT_PROFILE_SETTING_Y_28,IDC_EDIT_PROFILE_SETTING_Y_29,IDC_EDIT_PROFILE_SETTING_Y_30
+	,IDC_EDIT_PROFILE_SETTING_Y_31,IDC_EDIT_PROFILE_SETTING_Y_32,IDC_EDIT_PROFILE_SETTING_Y_33,IDC_EDIT_PROFILE_SETTING_Y_34,IDC_EDIT_PROFILE_SETTING_Y_35
+	,IDC_EDIT_PROFILE_SETTING_Y_36,IDC_EDIT_PROFILE_SETTING_Y_37,IDC_EDIT_PROFILE_SETTING_Y_38,IDC_EDIT_PROFILE_SETTING_Y_39,IDC_EDIT_PROFILE_SETTING_Y_40
+	,IDC_EDIT_PROFILE_SETTING_Y_41,IDC_EDIT_PROFILE_SETTING_Y_42,IDC_EDIT_PROFILE_SETTING_Y_43,IDC_EDIT_PROFILE_SETTING_Y_44,IDC_EDIT_PROFILE_SETTING_Y_45
+	,IDC_EDIT_PROFILE_SETTING_Y_46,IDC_EDIT_PROFILE_SETTING_Y_47,IDC_EDIT_PROFILE_SETTING_Y_48,IDC_EDIT_PROFILE_SETTING_Y_49,IDC_EDIT_PROFILE_SETTING_Y_50
+	,IDC_EDIT_PROFILE_SETTING_Y_51,IDC_EDIT_PROFILE_SETTING_Y_52,IDC_EDIT_PROFILE_SETTING_Y_53,IDC_EDIT_PROFILE_SETTING_Y_54,IDC_EDIT_PROFILE_SETTING_Y_55
+	,IDC_EDIT_PROFILE_SETTING_Y_56,IDC_EDIT_PROFILE_SETTING_Y_57,IDC_EDIT_PROFILE_SETTING_Y_58,IDC_EDIT_PROFILE_SETTING_Y_59};
+
+UINT		nID_Plus[]={IDC_EDIT_PROFILE_SETTING_PLUS_1,IDC_EDIT_PROFILE_SETTING_PLUS_2,IDC_EDIT_PROFILE_SETTING_PLUS_3,IDC_EDIT_PROFILE_SETTING_PLUS_4,IDC_EDIT_PROFILE_SETTING_PLUS_5
+	,IDC_EDIT_PROFILE_SETTING_PLUS_6,IDC_EDIT_PROFILE_SETTING_PLUS_7,IDC_EDIT_PROFILE_SETTING_PLUS_8,IDC_EDIT_PROFILE_SETTING_PLUS_9,IDC_EDIT_PROFILE_SETTING_PLUS_10
+	,IDC_EDIT_PROFILE_SETTING_PLUS_11,IDC_EDIT_PROFILE_SETTING_PLUS_12,IDC_EDIT_PROFILE_SETTING_PLUS_13,IDC_EDIT_PROFILE_SETTING_PLUS_14,IDC_EDIT_PROFILE_SETTING_PLUS_15
+	,IDC_EDIT_PROFILE_SETTING_PLUS_16,IDC_EDIT_PROFILE_SETTING_PLUS_17,IDC_EDIT_PROFILE_SETTING_PLUS_18,IDC_EDIT_PROFILE_SETTING_PLUS_19,IDC_EDIT_PROFILE_SETTING_PLUS_20
+	,IDC_EDIT_PROFILE_SETTING_PLUS_21,IDC_EDIT_PROFILE_SETTING_PLUS_22,IDC_EDIT_PROFILE_SETTING_PLUS_23,IDC_EDIT_PROFILE_SETTING_PLUS_24,IDC_EDIT_PROFILE_SETTING_PLUS_25
+	,IDC_EDIT_PROFILE_SETTING_PLUS_26,IDC_EDIT_PROFILE_SETTING_PLUS_27,IDC_EDIT_PROFILE_SETTING_PLUS_28,IDC_EDIT_PROFILE_SETTING_PLUS_29,IDC_EDIT_PROFILE_SETTING_PLUS_30
+	,IDC_EDIT_PROFILE_SETTING_PLUS_31,IDC_EDIT_PROFILE_SETTING_PLUS_32,IDC_EDIT_PROFILE_SETTING_PLUS_33,IDC_EDIT_PROFILE_SETTING_PLUS_34,IDC_EDIT_PROFILE_SETTING_PLUS_35
+	,IDC_EDIT_PROFILE_SETTING_PLUS_36,IDC_EDIT_PROFILE_SETTING_PLUS_37,IDC_EDIT_PROFILE_SETTING_PLUS_38,IDC_EDIT_PROFILE_SETTING_PLUS_39,IDC_EDIT_PROFILE_SETTING_PLUS_40
+	,IDC_EDIT_PROFILE_SETTING_PLUS_41,IDC_EDIT_PROFILE_SETTING_PLUS_42,IDC_EDIT_PROFILE_SETTING_PLUS_43,IDC_EDIT_PROFILE_SETTING_PLUS_44,IDC_EDIT_PROFILE_SETTING_PLUS_45
+	,IDC_EDIT_PROFILE_SETTING_PLUS_46,IDC_EDIT_PROFILE_SETTING_PLUS_47,IDC_EDIT_PROFILE_SETTING_PLUS_48,IDC_EDIT_PROFILE_SETTING_PLUS_49,IDC_EDIT_PROFILE_SETTING_PLUS_50
+	,IDC_EDIT_PROFILE_SETTING_PLUS_51,IDC_EDIT_PROFILE_SETTING_PLUS_52,IDC_EDIT_PROFILE_SETTING_PLUS_53,IDC_EDIT_PROFILE_SETTING_PLUS_54,IDC_EDIT_PROFILE_SETTING_PLUS_55
+	,IDC_EDIT_PROFILE_SETTING_PLUS_56,IDC_EDIT_PROFILE_SETTING_PLUS_57,IDC_EDIT_PROFILE_SETTING_PLUS_58,IDC_EDIT_PROFILE_SETTING_PLUS_59,IDC_EDIT_PROFILE_SETTING_PLUS_60
+	,IDC_EDIT_PROFILE_SETTING_PLUS_61,IDC_EDIT_PROFILE_SETTING_PLUS_62,IDC_EDIT_PROFILE_SETTING_PLUS_63,IDC_EDIT_PROFILE_SETTING_PLUS_64,IDC_EDIT_PROFILE_SETTING_PLUS_65
+	,IDC_EDIT_PROFILE_SETTING_PLUS_66,IDC_EDIT_PROFILE_SETTING_PLUS_67,IDC_EDIT_PROFILE_SETTING_PLUS_68,IDC_EDIT_PROFILE_SETTING_PLUS_69,IDC_EDIT_PROFILE_SETTING_PLUS_70
+	,IDC_EDIT_PROFILE_SETTING_PLUS_71,IDC_EDIT_PROFILE_SETTING_PLUS_72,IDC_EDIT_PROFILE_SETTING_PLUS_73,IDC_EDIT_PROFILE_SETTING_PLUS_74,IDC_EDIT_PROFILE_SETTING_PLUS_75
+	,IDC_EDIT_PROFILE_SETTING_PLUS_76,IDC_EDIT_PROFILE_SETTING_PLUS_77,IDC_EDIT_PROFILE_SETTING_PLUS_78,IDC_EDIT_PROFILE_SETTING_PLUS_79};
+
+UINT		nID_Minus[]={IDC_EDIT_PROFILE_SETTING_MINUS_1,IDC_EDIT_PROFILE_SETTING_MINUS_2,IDC_EDIT_PROFILE_SETTING_MINUS_3,IDC_EDIT_PROFILE_SETTING_MINUS_4,IDC_EDIT_PROFILE_SETTING_MINUS_5
+	,IDC_EDIT_PROFILE_SETTING_MINUS_6,IDC_EDIT_PROFILE_SETTING_MINUS_7,IDC_EDIT_PROFILE_SETTING_MINUS_8,IDC_EDIT_PROFILE_SETTING_MINUS_9,IDC_EDIT_PROFILE_SETTING_MINUS_10
+	,IDC_EDIT_PROFILE_SETTING_MINUS_11,IDC_EDIT_PROFILE_SETTING_MINUS_12,IDC_EDIT_PROFILE_SETTING_MINUS_13,IDC_EDIT_PROFILE_SETTING_MINUS_14,IDC_EDIT_PROFILE_SETTING_MINUS_15
+	,IDC_EDIT_PROFILE_SETTING_MINUS_16,IDC_EDIT_PROFILE_SETTING_MINUS_17,IDC_EDIT_PROFILE_SETTING_MINUS_18,IDC_EDIT_PROFILE_SETTING_MINUS_19,IDC_EDIT_PROFILE_SETTING_MINUS_20
+	,IDC_EDIT_PROFILE_SETTING_MINUS_21,IDC_EDIT_PROFILE_SETTING_MINUS_22,IDC_EDIT_PROFILE_SETTING_MINUS_23,IDC_EDIT_PROFILE_SETTING_MINUS_24,IDC_EDIT_PROFILE_SETTING_MINUS_25
+	,IDC_EDIT_PROFILE_SETTING_MINUS_26,IDC_EDIT_PROFILE_SETTING_MINUS_27,IDC_EDIT_PROFILE_SETTING_MINUS_28,IDC_EDIT_PROFILE_SETTING_MINUS_29,IDC_EDIT_PROFILE_SETTING_MINUS_30
+	,IDC_EDIT_PROFILE_SETTING_MINUS_31,IDC_EDIT_PROFILE_SETTING_MINUS_32,IDC_EDIT_PROFILE_SETTING_MINUS_33,IDC_EDIT_PROFILE_SETTING_MINUS_34,IDC_EDIT_PROFILE_SETTING_MINUS_35
+	,IDC_EDIT_PROFILE_SETTING_MINUS_36,IDC_EDIT_PROFILE_SETTING_MINUS_37,IDC_EDIT_PROFILE_SETTING_MINUS_38,IDC_EDIT_PROFILE_SETTING_MINUS_39,IDC_EDIT_PROFILE_SETTING_MINUS_40
+	,IDC_EDIT_PROFILE_SETTING_MINUS_41,IDC_EDIT_PROFILE_SETTING_MINUS_42,IDC_EDIT_PROFILE_SETTING_MINUS_43,IDC_EDIT_PROFILE_SETTING_MINUS_44,IDC_EDIT_PROFILE_SETTING_MINUS_45
+	,IDC_EDIT_PROFILE_SETTING_MINUS_46,IDC_EDIT_PROFILE_SETTING_MINUS_47,IDC_EDIT_PROFILE_SETTING_MINUS_48,IDC_EDIT_PROFILE_SETTING_MINUS_49,IDC_EDIT_PROFILE_SETTING_MINUS_50
+	,IDC_EDIT_PROFILE_SETTING_MINUS_51,IDC_EDIT_PROFILE_SETTING_MINUS_52,IDC_EDIT_PROFILE_SETTING_MINUS_53,IDC_EDIT_PROFILE_SETTING_MINUS_54,IDC_EDIT_PROFILE_SETTING_MINUS_55
+	,IDC_EDIT_PROFILE_SETTING_MINUS_56,IDC_EDIT_PROFILE_SETTING_MINUS_57,IDC_EDIT_PROFILE_SETTING_MINUS_58,IDC_EDIT_PROFILE_SETTING_MINUS_59,IDC_EDIT_PROFILE_SETTING_MINUS_60
+	,IDC_EDIT_PROFILE_SETTING_MINUS_61,IDC_EDIT_PROFILE_SETTING_MINUS_62,IDC_EDIT_PROFILE_SETTING_MINUS_63,IDC_EDIT_PROFILE_SETTING_MINUS_64,IDC_EDIT_PROFILE_SETTING_MINUS_65
+	,IDC_EDIT_PROFILE_SETTING_MINUS_66,IDC_EDIT_PROFILE_SETTING_MINUS_67,IDC_EDIT_PROFILE_SETTING_MINUS_68,IDC_EDIT_PROFILE_SETTING_MINUS_69,IDC_EDIT_PROFILE_SETTING_MINUS_70
+	,IDC_EDIT_PROFILE_SETTING_MINUS_71,IDC_EDIT_PROFILE_SETTING_MINUS_72,IDC_EDIT_PROFILE_SETTING_MINUS_73,IDC_EDIT_PROFILE_SETTING_MINUS_74,IDC_EDIT_PROFILE_SETTING_MINUS_75
+	,IDC_EDIT_PROFILE_SETTING_MINUS_76,IDC_EDIT_PROFILE_SETTING_MINUS_77,IDC_EDIT_PROFILE_SETTING_MINUS_78,IDC_EDIT_PROFILE_SETTING_MINUS_79};
+
+UINT		nID_Use[]={IDC_CHECK_PROFILE_SETTING_1,IDC_CHECK_PROFILE_SETTING_2,IDC_CHECK_PROFILE_SETTING_3,IDC_CHECK_PROFILE_SETTING_4,IDC_CHECK_PROFILE_SETTING_5
+	,IDC_CHECK_PROFILE_SETTING_6,IDC_CHECK_PROFILE_SETTING_7,IDC_CHECK_PROFILE_SETTING_8,IDC_CHECK_PROFILE_SETTING_9,IDC_CHECK_PROFILE_SETTING_10
+	,IDC_CHECK_PROFILE_SETTING_11,IDC_CHECK_PROFILE_SETTING_12,IDC_CHECK_PROFILE_SETTING_13,IDC_CHECK_PROFILE_SETTING_14,IDC_CHECK_PROFILE_SETTING_15
+	,IDC_CHECK_PROFILE_SETTING_16,IDC_CHECK_PROFILE_SETTING_17,IDC_CHECK_PROFILE_SETTING_18,IDC_CHECK_PROFILE_SETTING_19,IDC_CHECK_PROFILE_SETTING_20
+	,IDC_CHECK_PROFILE_SETTING_21,IDC_CHECK_PROFILE_SETTING_22,IDC_CHECK_PROFILE_SETTING_23,IDC_CHECK_PROFILE_SETTING_24,IDC_CHECK_PROFILE_SETTING_25
+	,IDC_CHECK_PROFILE_SETTING_26,IDC_CHECK_PROFILE_SETTING_27,IDC_CHECK_PROFILE_SETTING_28,IDC_CHECK_PROFILE_SETTING_29,IDC_CHECK_PROFILE_SETTING_30
+	,IDC_CHECK_PROFILE_SETTING_31,IDC_CHECK_PROFILE_SETTING_32,IDC_CHECK_PROFILE_SETTING_33,IDC_CHECK_PROFILE_SETTING_34,IDC_CHECK_PROFILE_SETTING_35
+	,IDC_CHECK_PROFILE_SETTING_36,IDC_CHECK_PROFILE_SETTING_37,IDC_CHECK_PROFILE_SETTING_38,IDC_CHECK_PROFILE_SETTING_39,IDC_CHECK_PROFILE_SETTING_40
+	,IDC_CHECK_PROFILE_SETTING_41,IDC_CHECK_PROFILE_SETTING_42,IDC_CHECK_PROFILE_SETTING_43,IDC_CHECK_PROFILE_SETTING_44,IDC_CHECK_PROFILE_SETTING_45
+	,IDC_CHECK_PROFILE_SETTING_46,IDC_CHECK_PROFILE_SETTING_47,IDC_CHECK_PROFILE_SETTING_48,IDC_CHECK_PROFILE_SETTING_49,IDC_CHECK_PROFILE_SETTING_50
+	,IDC_CHECK_PROFILE_SETTING_51,IDC_CHECK_PROFILE_SETTING_52,IDC_CHECK_PROFILE_SETTING_53,IDC_CHECK_PROFILE_SETTING_54,IDC_CHECK_PROFILE_SETTING_55
+	,IDC_CHECK_PROFILE_SETTING_56,IDC_CHECK_PROFILE_SETTING_57,IDC_CHECK_PROFILE_SETTING_58,IDC_CHECK_PROFILE_SETTING_59,IDC_CHECK_PROFILE_SETTING_60
+	,IDC_CHECK_PROFILE_SETTING_61,IDC_CHECK_PROFILE_SETTING_62,IDC_CHECK_PROFILE_SETTING_63,IDC_CHECK_PROFILE_SETTING_64,IDC_CHECK_PROFILE_SETTING_65
+	,IDC_CHECK_PROFILE_SETTING_66,IDC_CHECK_PROFILE_SETTING_67,IDC_CHECK_PROFILE_SETTING_68,IDC_CHECK_PROFILE_SETTING_69,IDC_CHECK_PROFILE_SETTING_70
+	,IDC_CHECK_PROFILE_SETTING_71,IDC_CHECK_PROFILE_SETTING_72,IDC_CHECK_PROFILE_SETTING_73,IDC_CHECK_PROFILE_SETTING_74,IDC_CHECK_PROFILE_SETTING_75
+	,IDC_CHECK_PROFILE_SETTING_76,IDC_CHECK_PROFILE_SETTING_77,IDC_CHECK_PROFILE_SETTING_78,IDC_CHECK_PROFILE_SETTING_79};
+
+UINT		nID_Radius[]={IDC_EDIT_PROFILE_SETTING_R_60
+	,IDC_EDIT_PROFILE_SETTING_R_61,IDC_EDIT_PROFILE_SETTING_R_62,IDC_EDIT_PROFILE_SETTING_R_63,IDC_EDIT_PROFILE_SETTING_R_64,IDC_EDIT_PROFILE_SETTING_R_65
+	,IDC_EDIT_PROFILE_SETTING_R_66,IDC_EDIT_PROFILE_SETTING_R_67,IDC_EDIT_PROFILE_SETTING_R_68,IDC_EDIT_PROFILE_SETTING_R_69,IDC_EDIT_PROFILE_SETTING_R_70
+	,IDC_EDIT_PROFILE_SETTING_R_71,IDC_EDIT_PROFILE_SETTING_R_72,IDC_EDIT_PROFILE_SETTING_R_73,IDC_EDIT_PROFILE_SETTING_R_74,IDC_EDIT_PROFILE_SETTING_R_75
+	,IDC_EDIT_PROFILE_SETTING_R_76,IDC_EDIT_PROFILE_SETTING_R_77,IDC_EDIT_PROFILE_SETTING_R_78,IDC_EDIT_PROFILE_SETTING_R_79
+	};
+
+
+IMPLEMENT_DYNAMIC(CViewRecipeProfileView, CDialogEx)
+
+CViewRecipeProfileView::CViewRecipeProfileView(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewRecipeProfileView::IDD, pParent)
+{
+	m_pProfileProc = new CProfileCADProc;
+	m_pHardware = NULL;
+	m_pDlgRecipe = NULL;
+
+	m_splash.SetBitmap(IDB_SPLASH);
+	m_splash.SetTransparentColor(RGB(128,128,128));
+}
+
+CViewRecipeProfileView::~CViewRecipeProfileView()
+{
+	delete m_pProfileProc;
+	m_pProfileProc = NULL;
+}
+
+void CViewRecipeProfileView::DoDataExchange(CDataExchange* pDX)
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+
+	CProfileInspect_Prm *pProfilPrm = m_pDlgRecipe->GetProfileParm();
+	int			i;
+
+	ST_PROFILE_SETTING *pPFPrm = pProfilPrm->m_stProfile;
+	for(i=0;i<59;i++)
+	{
+		DDX_Text(pDX,nID_Y[i],pPFPrm[i].y);		
+	}
+
+	int			nIndex=59;		
+	DDX_Text(pDX,IDC_EDIT_PROFILE_SETTING_X_60,pPFPrm[nIndex].x);		
+	DDX_Text(pDX,IDC_EDIT_PROFILE_SETTING_R_Y_60,pPFPrm[nIndex].y);	
+	nIndex=64;		
+	DDX_Text(pDX,IDC_EDIT_PROFILE_SETTING_X_65,pPFPrm[nIndex].x);		
+	DDX_Text(pDX,IDC_EDIT_PROFILE_SETTING_R_Y_65,pPFPrm[nIndex].y);	
+	nIndex=69;		
+	DDX_Text(pDX,IDC_EDIT_PROFILE_SETTING_X_70,pPFPrm[nIndex].x);	
+	DDX_Text(pDX,IDC_EDIT_PROFILE_SETTING_R_Y_70,pPFPrm[nIndex].y);	
+	nIndex=74;		
+	DDX_Text(pDX,IDC_EDIT_PROFILE_SETTING_X_75,pPFPrm[nIndex].x);	
+	DDX_Text(pDX,IDC_EDIT_PROFILE_SETTING_R_Y_75,pPFPrm[nIndex].y);	
+	
+	nIndex = 59;
+	for(i=0;i<20;i++)
+	{
+		DDX_Text(pDX,nID_Radius[i],pPFPrm[nIndex].radius);		
+		nIndex++;
+	}
+
+	for(i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+	{
+		DDX_Text(pDX,nID_Minus[i],pPFPrm[i].minus);		
+		DDX_Text(pDX,nID_Plus[i],pPFPrm[i].plus);	
+		DDX_Control(pDX, nID_Use[i], m_chkProfileUse[i]);
+		DDX_Check(pDX, nID_Use[i], pPFPrm[i].use);
+	}	
+
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewRecipeProfileView, CDialogEx)
+	ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewRecipeProfileView, CDialogEx)
+	
+	ON_EVENT(CViewRecipeProfileView, IDC_BTN_PROFILE_MAKECAD, DISPID_CLICK, CViewRecipeProfileView::ClickChkButMakeCAD, VTS_NONE)
+	ON_EVENT(CViewRecipeProfileView, IDC_BTN_PROFILE_APPLY, DISPID_CLICK, CViewRecipeProfileView::ClickChkButProfileApplay, VTS_NONE)
+	ON_EVENT(CViewRecipeProfileView, IDC_BTN_PROFILE_TEST_RUN, DISPID_CLICK, CViewRecipeProfileView::ClickChkButProfileTestRun, VTS_NONE)
+
+END_EVENTSINK_MAP()
+
+BOOL CViewRecipeProfileView::OnInitDialog()
+{	
+	for (int loop_count=0; loop_count<MAX_PROFILE_SETTING_COUNT; loop_count++)
+	{
+		m_chkProfileUse[loop_count].m_nFlatStyle = CMFCButton::BUTTONSTYLE_FLAT;
+		m_chkProfileUse[loop_count].SetImage(IDB_CHECKNO32);
+		m_chkProfileUse[loop_count].SetCheckedImage(IDB_CHECK32);
+	}
+
+	SetControlStyle();
+
+	return TRUE;
+}
+
+void CViewRecipeProfileView::SetControlStyle(void)
+{
+	int			i;
+
+	for(i=0;i<59;i++)
+	{
+		m_FontControl.SetFont(this,nID_Y[i],CFontControl::EN_MAINFONT);
+	}
+
+	for(i=0;i<20;i++)
+	{
+		m_FontControl.SetFont(this,nID_Radius[i],CFontControl::EN_MAINFONT);
+	}
+
+	for(i=0;i<MAX_PROFILE_SETTING_COUNT;i++)
+	{
+		m_FontControl.SetFont(this,nID_Minus[i],CFontControl::EN_MAINFONT);
+		m_FontControl.SetFont(this,nID_Plus[i],CFontControl::EN_MAINFONT);		
+	}
+
+	m_FontControl.SetFont(this,IDC_EDIT_PROFILE_SETTING_X_60,CFontControl::EN_MAINFONT);
+	m_FontControl.SetFont(this,IDC_EDIT_PROFILE_SETTING_R_Y_60,CFontControl::EN_MAINFONT);
+	m_FontControl.SetFont(this,IDC_EDIT_PROFILE_SETTING_X_65,CFontControl::EN_MAINFONT);
+	m_FontControl.SetFont(this,IDC_EDIT_PROFILE_SETTING_R_Y_65,CFontControl::EN_MAINFONT);
+	m_FontControl.SetFont(this,IDC_EDIT_PROFILE_SETTING_X_70,CFontControl::EN_MAINFONT);
+	m_FontControl.SetFont(this,IDC_EDIT_PROFILE_SETTING_R_Y_70,CFontControl::EN_MAINFONT);
+	m_FontControl.SetFont(this,IDC_EDIT_PROFILE_SETTING_X_75,CFontControl::EN_MAINFONT);
+	m_FontControl.SetFont(this,IDC_EDIT_PROFILE_SETTING_R_Y_75,CFontControl::EN_MAINFONT);	
+}
+
+BOOL CViewRecipeProfileView::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+void CViewRecipeProfileView::ClickChkButMakeCAD()
+{
+	if(m_pDlgRecipe == NULL || m_pProfileProc == NULL)
+		return;
+
+	if (IDNO == AfxMessageBox(_T("Do you want to Make Profile Data?"), MB_YESNO | MB_ICONQUESTION))
+		return;
+
+	CString			strFile,strModel,strImg,strComment;
+	const TCHAR*	strCAD[]= {_T("A"),_T("B"),_T("C"),_T("D")};
+	int				iSide,nProlineCnt;
+
+	//SetSlashText(GLOBAL_DEFINE::emShow, _T(""), RGB(0,0,0));
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Make Profile Start"), RGB(0,0,0));
+
+	std::multimap<int, CPoint*> mapProfile,mapAlignProfile;
+	std::multimap<int, CPoint*>::iterator it;
+
+	for(iSide=0;iSide<MAX_PANEL_SIDE;iSide++)
+	{
+		strFile.Format(_T("C:\\RCutProject\\Profile\\%s_%s_CAD.bmp"),m_pDlgRecipe->GetRecipeName(),strCAD[iSide]);
+
+		strComment.Format(_T("Make Profile CAD %s Side Start"),strCAD[iSide]);
+		SetSlashText(GLOBAL_DEFINE::emText, strComment, RGB(0,0,0));
+
+		m_pProfileProc->SetProfileData(&mapProfile,&mapAlignProfile);
+		nProlineCnt = m_pProfileProc->MakeProfileCAD(iSide,strFile);
+		if(nProlineCnt <= 0)
+		{
+			strComment.Format(_T("Make Profile CAD %s Side Fail"),strCAD[iSide]);
+			SetSlashText(GLOBAL_DEFINE::emText, strComment, RGB(255,0,0));
+
+			g_pLog->DisplayMessage(_T("%s Find Make Profile Fail!"),strCAD[iSide]);
+			continue;
+		}
+		
+		strComment.Format(_T("Make Profile CAD %s Side Success"),strCAD[iSide]);
+		SetSlashText(GLOBAL_DEFINE::emText, strComment, RGB(0,0,255));
+
+		strModel.Format(_T("C:\\RCutProject\\Profile\\%s_%s.prf"),m_pDlgRecipe->GetRecipeName(),strCAD[iSide]);
+		strImg.Format(_T("C:\\RCutProject\\Profile\\%s_%s.jpg"),m_pDlgRecipe->GetRecipeName(),strCAD[iSide]);
+
+		strComment.Format(_T("Write Profile CAD %s Side Start"),strCAD[iSide]);
+		SetSlashText(GLOBAL_DEFINE::emText, strComment, RGB(0,0,0));
+
+		if(m_pProfileProc->WriteProfileData(strModel,strImg) == FALSE)
+		{
+			strComment.Format(_T("Write Profile CAD Fail %s"),strModel);
+			SetSlashText(GLOBAL_DEFINE::emText, strComment, RGB(255,0,0));
+
+			g_pLog->DisplayMessage(_T("%s Make Profile Data Fail!"),strCAD[iSide]);
+			continue;
+		}
+
+		strComment.Format(_T("Write Profile CAD %s Success : %s"),strCAD[iSide],strModel);
+		SetSlashText(GLOBAL_DEFINE::emText, strComment, RGB(0,0,255));
+		g_pLog->DisplayMessage(_T("%s Write Profile Success : %s"),strCAD[iSide],strModel);
+
+		for(it=mapProfile.begin();it!=mapProfile.end();it++)
+		{
+			CPoint		*pPoint = it->second;
+			if(pPoint == NULL)
+				continue;
+
+			delete pPoint;
+			pPoint = NULL;
+		}
+		mapProfile.clear();
+
+		for(it=mapAlignProfile.begin();it!=mapAlignProfile.end();it++)
+		{
+			CPoint		*pPoint = it->second;
+			if(pPoint == NULL)
+				continue;
+
+			delete pPoint;
+			pPoint = NULL;
+		}
+		mapAlignProfile.clear();
+	}
+
+	SetSlashText(GLOBAL_DEFINE::emText, _T("Make Profile End"), RGB(0,0,0));
+	Sleep(3000);
+	SetSlashText(GLOBAL_DEFINE::emHide, _T(""), RGB(0,0,0));
+}
+
+
+void CViewRecipeProfileView::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		UpdateData(FALSE);				
+	}
+}
+
+void CViewRecipeProfileView::ClickChkButProfileApplay()
+{
+	UpdateData(TRUE);
+}
+
+void CViewRecipeProfileView::ClickChkButProfileTestRun()
+{
+	if(m_pProfileProc == NULL)
+		return;
+
+	CString			str=_T("C:\\RCutProject\\Profile\\TEST5_B.prf");
+
+	m_pProfileProc->ReadProfileData(str);
+
+	CPoint		ptFirst,ptSecond;
+
+	ptFirst = CPoint(2160,32512);
+	ptSecond = CPoint(2186,66030);
+
+	//m_pProfileProc->RotateProfileData(ptFirst,ptSecond);
+
+}
+
+void CViewRecipeProfileView::SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe)
+{
+	m_pHardware = pHW;
+	m_pDlgRecipe = pRecipe;
+
+	//UpdateData(FALSE);
+}
+
+void CViewRecipeProfileView::SetSlashText(EmSplashCmd emCommand, CString strLog, UINT nColor)
+{
+	CString strText = _T("        ");
+	strText += strLog;
+
+	switch(emCommand)
+	{
+	case emShow:			m_splash.ShowSplash();
+		break;
+	case emHide:			m_splash.CloseSplash();
+		break;
+	case emText:			m_splash.SetText(strText, nColor);
+		break;
+	default:
+		break;
+	}
+}
\ No newline at end of file
diff --git a/ENRIT/View/ViewRecipeProfileView.h b/ENRIT/View/ViewRecipeProfileView.h
new file mode 100644
index 0000000..b93219e
--- /dev/null
+++ b/ENRIT/View/ViewRecipeProfileView.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include "btnenh.h"
+#include "Global_Define.h"
+#include "Splash.h"
+#include "General_Draw.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+
+// CViewRecipeProfileView 措拳 惑磊涝聪促.
+
+class CHardwareSettings;
+class CGlassRecipe;
+class CViewRecipeProfileView : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewRecipeProfileView)
+
+public:
+	CViewRecipeProfileView(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewRecipeProfileView();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_RECIPE_PROFILESETTING_VIEW };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	void		 ClickChkButMakeCAD();
+	void		 ClickChkButProfileApplay();
+	void		ClickChkButProfileTestRun();
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+	void					SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe);
+
+protected:
+	void					SetSlashText(EmSplashCmd emCommand, CString strLog, UINT nColor);	
+
+public:
+	void					SetControlStyle(void);
+
+protected:
+	CProfileCADProc			*m_pProfileProc;
+	CHardwareSettings		*m_pHardware;
+	CGlassRecipe		*m_pDlgRecipe;
+	CSplash					m_splash;
+	CMFCButton				m_chkProfileUse[MAX_PROFILE_SETTING_COUNT];
+	CFontControl			m_FontControl;
+};
diff --git a/ENRIT/View/ViewRecipeSetting.cpp b/ENRIT/View/ViewRecipeSetting.cpp
new file mode 100644
index 0000000..b4cb48f
--- /dev/null
+++ b/ENRIT/View/ViewRecipeSetting.cpp
@@ -0,0 +1,1734 @@
+锘�// ViewRecipeSetting.cpp : 澶囨硡 棰囪�佹稘鑱績.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewRecipeSetting.h"
+#include "afxdialogex.h"
+#include "ViewRecipeList.h"
+#include "ViewUserDefectArea.h"
+#include "ViewException.h"
+#include "ViewLampControl.h"
+#include "DlgLogin.h"
+// CViewRecipeSetting 鎺嫵 鎯戠娑濊仾淇�.
+
+IMPLEMENT_DYNAMIC(CViewRecipeSetting, CDialogEx)
+
+static CViewRecipeSetting *m_pThis = NULL;
+CViewRecipeSetting::CViewRecipeSetting(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewRecipeSetting::IDD, pParent)
+{
+	m_pDlgRecipe = new CGlassRecipe;	
+	m_IV2M = NULL;
+	m_pGlassData = NULL;
+	m_pViewRecipeList = NULL;	
+	m_pViewUserDefect = NULL;
+	m_pViewExpArea = NULL;	
+	m_pviewLightControl = NULL;
+	m_pHardware = NULL;
+	m_pViewRecipeInspection = NULL;
+	m_pViewRecipeProfile = NULL;
+	m_pViewRecipeChamfer = NULL;
+	m_nCndRDSide = 0;
+	m_nCndSelect = 0;
+
+	m_pVisionSetDlg = NULL;
+	m_pThis = this;
+}
+
+CViewRecipeSetting::~CViewRecipeSetting()
+{
+	DeleteVectorList();	
+
+	delete m_pDlgRecipe;
+	m_pDlgRecipe = NULL;
+
+	if(m_pViewRecipeList != NULL)
+	{
+		delete m_pViewRecipeList;
+		m_pViewRecipeList = NULL;
+	}	
+	if(m_pViewUserDefect != NULL)
+	{
+		delete m_pViewUserDefect;
+		m_pViewUserDefect = NULL;
+	}
+	if(m_pViewExpArea != NULL)
+	{
+		delete m_pViewExpArea;
+		m_pViewExpArea = NULL;
+	}	
+	if(m_pviewLightControl != NULL)
+	{
+		delete m_pviewLightControl;
+		m_pviewLightControl = NULL;
+	}
+	if(m_pViewRecipeInspection != NULL)
+	{
+		delete m_pViewRecipeInspection;
+		m_pViewRecipeInspection = NULL;
+	}
+	if(m_pViewRecipeProfile != NULL)
+	{
+		delete m_pViewRecipeProfile;
+		m_pViewRecipeProfile = NULL;
+	}
+	if(m_pViewRecipeChamfer != NULL)
+	{
+		delete m_pViewRecipeChamfer;
+		m_pViewRecipeChamfer = NULL;
+	}
+	
+	if (NULL != m_pVisionSetDlg) {
+		if (0 == BlVision_GetSoftVisionApp()->ReleaseWindow(m_pVisionSetDlg)) {
+			m_pVisionSetDlg = NULL;
+		}
+	}
+}
+
+void CViewRecipeSetting::DoDataExchange(CDataExchange* pDX)
+{	
+	DDX_Control(pDX, IDC_STATIC_RECIPE_NAME, m_ctrlRecipeName);	
+	DDX_Control(pDX, IDC_STATIC_RECIPE_COMMENT, m_ctrlRecipeComment);	
+	DDX_Control(pDX, IDC_BUTTON_RECIPE_LIST, m_ctrlRecipList);	
+
+	DDX_Control(pDX, IDC_SLIDER_ZOOM2				, m_sliderZoom);
+	DDX_Control(pDX, IDC_SCROLLBAR_V				, m_ctrlScrollV);
+	DDX_Control(pDX, IDC_SCROLLBAR_H				, m_ctrlScrollH);	
+
+	UINT nIDCmdSelect[] = { IDC_RDO_RCP_INSPECT_SETTING,IDC_RDO_RCP_PROFILE_SETTING,IDC_RDO_RCP_CHAMFER_SETTING};
+	for (int i = 0; i < eRcp_End; i++) {
+		DDX_Control(pDX, nIDCmdSelect[i], m_ctrlCmdSelect[i]);
+	}
+
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewRecipeSetting, CDialogEx)
+	ON_WM_SHOWWINDOW()
+	ON_WM_HSCROLL()
+	ON_WM_VSCROLL()
+	ON_WM_MOUSEWHEEL()
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_ZOOM2, &CViewRecipeSetting::OnNMCustomdrawSliderZoom2)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_ZOOM2, &CViewRecipeSetting::OnNMReleasedcaptureSliderZoom2)
+	ON_MESSAGE(WM_POCESS_STATUS		, &CViewRecipeSetting::OnProcessStatus)
+	ON_MESSAGE(UM_SELECT_RECIPE, &CViewRecipeSetting::OnSelectRecipe)	
+	ON_MESSAGE(WM_AREA_ITEM_MODIFY			,&CViewRecipeSetting::OnAreaModify)
+	ON_MESSAGE(WM_AREA_ITEM_SELECT_CHANGE	,&CViewRecipeSetting::OnAreaChange)	
+	ON_MESSAGE(UM_LIGHT_APPLY_RECIPE	,&CViewRecipeSetting::OnLightApplyRecipe)	
+END_MESSAGE_MAP()
+
+
+// CViewRecipeSetting 鐨嬬煫鐦� 璐稿簻鎵佹稘鑱績.
+BEGIN_EVENTSINK_MAP(CViewRecipeSetting, CDialogEx)
+	ON_EVENT(CViewRecipeSetting, IDC_BTN_IMG_LOAD, DISPID_CLICK, CViewRecipeSetting::ClickImgLoadButton, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BTN_IMG_SAVE, DISPID_CLICK, CViewRecipeSetting::ClickImgSaveButton, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BTN_IMG_INIT, DISPID_CLICK, CViewRecipeSetting::ClickInitProcessButton, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BTN_IMG_PROCESS, DISPID_CLICK, CViewRecipeSetting::ClickInspectProcessButton, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BTN_RECIPE_SAVE, DISPID_CLICK, CViewRecipeSetting::ClickRecipeSaveButton, VTS_NONE)	
+	ON_EVENT(CViewRecipeSetting, IDC_BUTTON_RECIPE_LIST, DISPID_CLICK, CViewRecipeSetting::ClickRecipeListButton, VTS_NONE)		
+	ON_EVENT(CViewRecipeSetting, IDC_BUTTON_OPEN_USER_DEFECT_VIEW, DISPID_CLICK, CViewRecipeSetting::OnBnClickedBtnUserDefect, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BTN_FILTER_LIST1, DISPID_CLICK, CViewRecipeSetting::OnBnClickedBtnExpRegion, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BUTTON_LIGHT_CONTROL, DISPID_CLICK, CViewRecipeSetting::OnBnClickedBtnLightControl, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_RDO_RCP_INSPECT_SETTING, DISPID_CLICK, CViewRecipeSetting::ClickChkSelectlButton, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_RDO_RCP_PROFILE_SETTING, DISPID_CLICK, CViewRecipeSetting::ClickChkSelectlButton, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_RDO_RCP_CHAMFER_SETTING, DISPID_CLICK, CViewRecipeSetting::ClickChkSelectlButton, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BUTTON_LANG_ENGLISH, DISPID_CLICK, CViewRecipeSetting::OnClickButtonLang, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BUTTON_LANG_KOREAN, DISPID_CLICK, CViewRecipeSetting::OnClickButtonLang, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BUTTON_LANG_CHINESE, DISPID_CLICK, CViewRecipeSetting::OnClickButtonLang, VTS_NONE)
+	ON_EVENT(CViewRecipeSetting, IDC_BUTTON_VISION_SET, DISPID_CLICK, CViewRecipeSetting::ClickButtonVisionSet, VTS_NONE)
+END_EVENTSINK_MAP()
+
+BOOL CViewRecipeSetting::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+BOOL CViewRecipeSetting::OnInitDialog()
+{
+	UpdateData(FALSE);	
+
+	m_pViewRecipeList = new CViewRecipeList;
+	m_pViewRecipeList->Create(CViewRecipeList::IDD,this);
+	m_pViewRecipeList->SetParent(this);
+	m_pViewRecipeList->ShowWindow(SW_HIDE);	
+
+	m_pViewUserDefect = new CViewUserDefectArea;
+	m_pViewUserDefect->Create(CViewUserDefectArea::IDD,this);
+	m_pViewUserDefect->SetIU2P(static_cast<IUserDefectInterface2Parent*>(this));
+	m_pViewUserDefect->ShowWindow(SW_HIDE);
+
+	m_pViewExpArea = new CViewException;
+	m_pViewExpArea->Create(CViewException::IDD,this);
+	m_pViewExpArea->SetIU2P(static_cast<IUserDefectInterface2Parent*>(this));
+	m_pViewExpArea->ShowWindow(SW_HIDE);	
+
+	m_pviewLightControl = new CViewLampControl;
+	m_pviewLightControl->Create(CViewLampControl::IDD,this);
+	m_pviewLightControl->ShowWindow(SW_HIDE);
+	m_pviewLightControl->SetParent(this);	
+
+	m_pViewRecipeInspection = new CViewRecipeInspectionView;
+	m_pViewRecipeInspection->Create(CViewRecipeInspectionView::IDD,this);	
+	m_pViewRecipeInspection->SetI2M((IInspectRecipeView2Parent*)this);
+	m_pViewRecipeInspection->SetH2M((IHoleRecipeView2Parent*)this);
+
+	CRect	rect,cRect;
+
+	((CWnd*)GetDlgItem(IDC_STATIC_RECIPE_BASE_BAR))->GetWindowRect(rect);
+	ScreenToClient(&rect);	
+	m_pViewRecipeInspection->GetClientRect(cRect);	
+	cRect.OffsetRect(rect.left,rect.bottom + 5);
+	m_pViewRecipeInspection->MoveWindow(cRect);
+	m_pViewRecipeInspection->ShowWindow(SW_HIDE);
+	
+	m_pViewRecipeProfile = new CViewRecipeProfileView;
+	m_pViewRecipeProfile->Create(CViewRecipeProfileView::IDD,this);	
+	m_pViewRecipeProfile->MoveWindow(cRect);
+	m_pViewRecipeProfile->ShowWindow(SW_HIDE);
+
+	m_pViewRecipeChamfer = new CViewRecipeChamferView;
+	m_pViewRecipeChamfer->Create(CViewRecipeChamferView::IDD,this);
+	m_pViewRecipeChamfer->MoveWindow(cRect);
+	m_pViewRecipeChamfer->ShowWindow(SW_HIDE);
+
+	m_sliderZoom.SetRange(0,8);
+	m_sliderZoom.SetPos(4);
+	
+	m_frameImg.InitBitMap();
+	m_frameImg.SetSide(0);	
+
+	GetDlgItem(IDC_STATIC_SELECT_IMG)->GetWindowRect(m_rcFrameImg);
+	GetDlgItem(IDC_STATIC_SELECT_IMG)->DestroyWindow();
+
+	ScreenToClient(m_rcFrameImg);
+	m_frameImg.Create(NULL,NULL,WS_VISIBLE | WS_CHILD,m_rcFrameImg,this,0);
+
+	InitScrollInfo();
+
+	LoadLinkFile(LINK_FILE_NAME);	
+
+	m_pVisionEvent = new IVisionEvent(onMsgVisionEvent, onMsgLogEvent);
+	BlVision_GetSoftVisionApp()->setImageEventSignal(m_pVisionEvent);
+
+	return TRUE;
+}
+
+void CViewRecipeSetting::onMsgVisionEvent(int code, int eDir) {
+	/* code */
+	if (1 == code) {     //鑾峰彇鍖哄煙鏁版嵁
+		m_pThis->SetFrameRegion();
+	}
+	else if (2 == code) {    //鑾峰彇鏁堟灉
+		m_pThis->DispAllResult();
+	}
+}
+
+void CViewRecipeSetting::onMsgLogEvent(int level, std::string strText) {
+	/* code */
+	CString str = CA2T(strText.c_str());
+	g_pLog->DisplayMessage(str);
+}
+
+void CViewRecipeSetting::SetFrameRegion(void) {
+	/* code */
+	if (!m_frameImg.GetMode(MODE_MARK_REG)) return;
+
+	IVisionRecipe *pInstance = BlVision_GetVisionRecipe();
+	if (NULL == pInstance) return;
+
+	CRect rtMeasureRect = m_frameImg.GetMartRect();
+	pInstance->setFrame(rtMeasureRect.left, rtMeasureRect.top, rtMeasureRect.right, rtMeasureRect.bottom);
+}
+
+void CViewRecipeSetting::DispAllResult(void) {
+	/* code */
+	m_frameImg.UpdataVisionResult();
+}
+
+void CViewRecipeSetting::ClickChkSelectlButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	UpdateData(TRUE);
+
+	ChangeRcpView(nID);	
+}
+
+void CViewRecipeSetting::SetButtonSelectEnableAll(const BOOL& bEnable)
+{
+	int i;
+	for (i = 0; i < eRcp_End; i++) 
+	{
+		if (m_ctrlCmdSelect[i].GetEnabled() != bEnable) {
+			m_ctrlCmdSelect[i].SetEnabled(bEnable);
+		}
+	}
+}
+
+void CViewRecipeSetting::SetButtonSelectSel(eViewSelect eSelView, BOOL bEnable)
+{
+	if(eSelView >= eRcp_End) return;
+	if(m_ctrlCmdSelect[eSelView].GetEnabled() != bEnable){
+		m_ctrlCmdSelect[eSelView].SetEnabled(bEnable);
+	}
+}
+
+void CViewRecipeSetting::ChangeRcpView(UINT nID)
+{
+	SetButtonSelectEnableAll(TRUE);	
+	
+	eViewSelect eSelView;
+	UINT		nViewID;
+	switch(nID)
+	{
+	case IDC_RDO_RCP_INSPECT_SETTING:
+		m_nCndSelect = 0;
+		eSelView = eRcp_Inspection;		
+		nViewID = CViewRecipeInspectionView::IDD;
+		break;	
+	case IDC_RDO_RCP_PROFILE_SETTING:
+		m_nCndSelect = 1;
+		eSelView = eRcp_Profile;	
+		nViewID = CViewRecipeProfileView::IDD;
+		break;	
+	case IDC_RDO_RCP_CHAMFER_SETTING:
+		m_nCndSelect = 2;
+		eSelView = eRcp_Chamfer;	
+		nViewID = CViewRecipeChamferView::IDD;
+		break;
+	default:
+		return;
+	}
+
+	SetButtonSelectSel(eSelView,FALSE);
+
+	ChangeSelectView(nViewID);
+}
+
+void CViewRecipeSetting::ChangeSelectView(UINT nViewID)
+{
+	UINT		nShow;		
+
+	UINT		eFrameView[] = {CViewRecipeInspectionView::IDD,CViewRecipeProfileView::IDD,CViewRecipeChamferView::IDD};
+
+	for(int i=0; i<eRcp_End; i++)
+	{
+		if(eFrameView[i] == nViewID)
+			nShow = SW_SHOW;
+		else
+			nShow = SW_HIDE;
+
+		switch(i)
+		{
+		case eRcp_Inspection: m_pViewRecipeInspection->ShowWindow(nShow); break;
+		case eRcp_Profile: m_pViewRecipeProfile->ShowWindow(nShow); break;	
+		case eRcp_Chamfer: m_pViewRecipeChamfer->ShowWindow(nShow); break;
+		}
+	}
+}
+
+void CViewRecipeSetting::ClickImgLoadButton()
+{
+	if(m_IV2M == NULL)
+		return;
+
+	m_IV2M->IV2M_LoadImageFullFile(m_nCndRDSide,m_pGlassData);
+	
+	m_frameImg.Invalidate(FALSE);
+	InitScrollInfo();
+}
+
+void CViewRecipeSetting::ClickImgSaveButton()
+{	
+	CPoint ptStart;
+	int nLength;
+	const int nOneFrameSize = 50000;
+	CString strPath,strLog;
+	int iSide  = m_nCndRDSide;
+	int nTotalLength = 0;
+	int nFrame = 0;
+
+	if(m_pGlassData == NULL || m_IV2M == NULL || m_pHardware == NULL)
+		return;
+	
+	int			iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)iSide);
+	int			iScan = m_pHardware->GetScanToDimension((DimensionDir)iSide);
+
+	CCameraSettings *pCamera = m_pHardware->GetCameraSettings(iCam,iScan);
+	if(pCamera == NULL)
+		return;
+		
+	CGlassRecipe *pGlassRcp = m_pGlassData->GetGlassRecipe();
+	CString		strRcpName = pGlassRcp->GetRecipeName();
+
+	nTotalLength = pCamera->m_nGrabFrameCount*pCamera->m_FrameSize.cy;
+	nFrame = nTotalLength/nOneFrameSize;
+
+	ptStart.x = 0;
+	ptStart.y =  max(0,0);
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)iSide);
+	if(pEdgeInfo != NULL)
+	{
+		ptStart.y = max(0,pEdgeInfo->nGlassStartLine-1000);
+		
+		nTotalLength = min((pEdgeInfo->nGlassEndLine + 1000) - ptStart.y,pCamera->m_nGrabFrameCount*pCamera->m_FrameSize.cy);
+	}	
+
+	CString			strGlassID = g_pBase->m_strHPanelID;
+	if(strGlassID.IsEmpty() == TRUE)
+	{
+		strGlassID = _T("Manual_ID");
+	}
+
+	if(strRcpName.IsEmpty() == TRUE)
+	{
+		strRcpName = _T("TestRcp");
+	}
+
+	strGlassID.Trim(_T(' '));
+
+	CTime	time = CTime::GetCurrentTime();
+
+	CString			strDate,strTime;
+
+	strDate.Format(_T("%04d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay());
+	strTime.Format(_T("%02d%02d%02d"),time.GetHour(),time.GetMinute(),time.GetSecond());
+
+	for(int i = 0; i < nFrame ; i++)
+	{
+		nLength = nOneFrameSize;
+
+		strPath.Format(_T("%sDebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],i);
+				
+		m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);		
+		ptStart.y += nLength; 
+	}
+
+	nLength = nTotalLength%nOneFrameSize;
+	if(nLength)
+	{		
+		strPath.Format(_T("%sDebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],nFrame);
+
+		m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);		
+	}
+
+	//AfxMessageBox(_T("Save Completed"));
+}
+
+void CViewRecipeSetting::ClickInitProcessButton()
+{
+	InitView();
+
+	if(m_IV2M != NULL)
+	{
+		m_IV2M->IV2M_InitView(VIEW_RECIPE);
+	}
+}
+
+void CViewRecipeSetting::ClickInspectProcessButton()
+{
+	DimensionDir		eDim = (DimensionDir)m_nCndRDSide;
+
+	m_IV2M->IV2M_InspectionProcess(eDim);	
+}
+
+void CViewRecipeSetting::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		UpdateData(FALSE);		
+
+		m_frameImg.SetRecipe(m_pHardware,m_pDlgRecipe);
+		m_frameImg.SetGlassData(m_pGlassData);	
+		m_frameImg.SetSide(m_nCndRDSide);
+
+		InitScrollInfo();
+
+		UINT		eViewID[] = {IDC_RDO_RCP_INSPECT_SETTING,IDC_RDO_RCP_PROFILE_SETTING};
+
+		ChangeRcpView(eViewID[m_nCndSelect]);
+	}
+}
+
+void CViewRecipeSetting::SetGlassData(CGlass_Data *pGlass)
+{
+	m_pGlassData = pGlass;
+}
+
+void CViewRecipeSetting::ViewRefresh(PROG_MSG ProcMsg)
+{
+	SendMessage(WM_POCESS_STATUS,(WPARAM)&ProcMsg, ProcMsg.nSide);
+}
+
+void CViewRecipeSetting::SetV2M(IViewInterface2Parent* pV2M)
+{
+	m_IV2M = pV2M;
+	if(m_pviewLightControl != NULL)
+		m_pviewLightControl->SetIV2P(static_cast<IViewInterface2Parent*>(m_IV2M));
+	m_frameImg.SetMainInterface(m_IV2M);
+}
+
+void CViewRecipeSetting::InitView()
+{
+	m_pGlassData= NULL;
+
+	if(m_IV2M != NULL)
+	{		
+		LPBYTE plpBuf = NULL;
+		if(m_IV2M != NULL)
+			plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)m_nCndRDSide,0);
+		m_frameImg.SetImage(plpBuf);				
+	}
+
+	m_frameImg.SetGlassData(m_pGlassData);	
+	m_frameImg.SetRecipe(m_pHardware,m_pDlgRecipe);
+	m_frameImg.SetSide(m_nCndRDSide);
+
+	InitScrollInfo(TRUE);
+}
+
+void CViewRecipeSetting::SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe)
+{
+	m_pHardware = pHW;
+	m_pRecipe = pRecipe;
+
+	if(pRecipe != NULL)
+	{
+		*m_pDlgRecipe = *pRecipe;
+	}
+
+	if(m_IV2M != NULL)
+	{		
+		LPBYTE plpBuf = NULL;
+		if(m_IV2M != NULL)
+			plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)m_nCndRDSide,0);
+		m_frameImg.SetImage(plpBuf);	
+	}
+
+	m_frameImg.SetGlassData(m_pGlassData);			
+	m_frameImg.SetRecipe(m_pHardware,m_pDlgRecipe);
+	m_frameImg.SetSide(m_nCndRDSide);
+
+	InitScrollInfo();
+
+	m_strRecipeName = m_pDlgRecipe->GetRecipeName();
+	m_ctrlRecipeName.SetCaption(m_strRecipeName);		
+	m_ctrlRecipeComment.SetCaption(m_pDlgRecipe->m_GlassParm.m_strDisp);	
+	
+	if(m_pViewRecipeInspection)
+		m_pViewRecipeInspection->SetRecipe(m_pHardware,m_pDlgRecipe);
+	if(m_pViewRecipeProfile)
+		m_pViewRecipeProfile->SetRecipe(m_pHardware,m_pDlgRecipe);
+	if(m_pViewRecipeChamfer)
+		m_pViewRecipeChamfer->SetRecipe(m_pHardware,m_pDlgRecipe);
+
+	std::string strVisionName = BlVision_GetVisionRecipe()->getVisionName();
+	CW2A pszConvertedAnsiString(m_strRecipeName);
+	if (strVisionName.compare(pszConvertedAnsiString) != 0)
+	{
+		auto startTime = std::chrono::high_resolution_clock::now();
+		BlVision_GetVisionRecipe()->setVisionName(pszConvertedAnsiString);
+		BlVision_GetVisionRecipe()->open();
+		auto endTime = std::chrono::high_resolution_clock::now();
+		auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
+		g_pLog->DisplayMessage(_T("Read VisionRecipe %s %lld milliseconds"), m_strRecipeName, duration.count());
+	}
+
+	int nGlassSizeX = m_pDlgRecipe->m_GlassParm.m_nGlassSizeX;
+	int nGlassSizeY = m_pDlgRecipe->m_GlassParm.m_nGlassSizeY;
+	BlVision_GetVisionRecipe()->setGlassSize(nGlassSizeX, nGlassSizeY);
+}
+
+void CViewRecipeSetting::InitScrollInfo(BOOL bInitPos /*= FALSE*/)
+{
+	int i =0;
+
+	SCROLLINFO scrollInfoV;
+	SCROLLINFO scrollInfoH;
+	
+	int nPos_V = m_ctrlScrollV.GetScrollPos();
+	int nPos_H = m_ctrlScrollH.GetScrollPos();
+
+	if(bInitPos)
+	{
+		nPos_V = 0;
+		nPos_H = 0;
+	}
+
+	scrollInfoV.cbSize		 = sizeof(SCROLLINFO);
+	scrollInfoV.fMask		 = SIF_ALL;
+	scrollInfoV.nMin		 = 1;
+	if(scrollInfoV.nMin < 1)
+		scrollInfoV.nMin = 1;
+	scrollInfoV.nPos		 = 1;
+	scrollInfoV.nTrackPos	 = 400;
+	scrollInfoV.nMax		= INT_MAX;
+
+	scrollInfoH.cbSize		= sizeof(SCROLLINFO);
+	scrollInfoH.fMask		= SIF_ALL;
+	scrollInfoH.nMin		= 1;
+	scrollInfoH.nPos		= 1;
+	scrollInfoH.nTrackPos	= 64;
+
+	double dZoom = m_frameImg.GetZoomData();
+
+	scrollInfoV.nPage	= m_rcFrameImg.Height();
+	scrollInfoH.nPage	= int(m_rcFrameImg.Width() / dZoom);
+	scrollInfoH.nMax	= IMAGE_WIDTH;
+		
+	if(m_pGlassData != NULL)
+	{
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nCndRDSide);
+		if(pEdgeInfo != NULL)
+		{
+			int		nEndLIne = pEdgeInfo->nGlassEndLine;
+			if(nEndLIne <= 0)
+				nEndLIne = pEdgeInfo->nPreGlassEndLine;
+
+			scrollInfoV.nMax	= nEndLIne - pEdgeInfo->nGlassStartLine + (int)(m_rcFrameImg.Height() * dZoom);
+		}
+	}
+	else
+	{
+		if(m_nCndRDSide%2)
+			scrollInfoV.nMax	= MAX_IMAGE_LINE_SHORT - int(m_rcFrameImg.Height() / dZoom);
+		else
+			scrollInfoV.nMax	= MAX_IMAGE_LINE_LONG - int(m_rcFrameImg.Height() / dZoom);
+	}
+		
+	if(m_pHardware == NULL)
+	{
+		if(m_nCndRDSide%2)
+			scrollInfoV.nMax	= min(MAX_IMAGE_LINE_SHORT - int(m_rcFrameImg.Height() / dZoom),scrollInfoV.nMax);
+		else
+			scrollInfoV.nMax	= min(MAX_IMAGE_LINE_LONG - int(m_rcFrameImg.Height() / dZoom),scrollInfoV.nMax);
+	}
+	else
+	{
+		int iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)m_nCndRDSide);
+		int nMaxLine = g_pBase->m_pMemFrameNo[iCam]*g_pBase->m_pFrameHeight[iCam];
+
+		scrollInfoV.nMax	= min(nMaxLine - int(m_rcFrameImg.Height() / dZoom),scrollInfoV.nMax);
+	}
+	
+	m_ctrlScrollV.SetScrollInfo(&scrollInfoV);
+	m_ctrlScrollV.SetScrollPos(nPos_V);
+
+	m_ctrlScrollH.SetScrollInfo(&scrollInfoH);
+	m_ctrlScrollH.SetScrollPos(nPos_H);
+}
+
+void CViewRecipeSetting::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	if(pScrollBar->m_hWnd == m_ctrlScrollH.m_hWnd)
+	{
+		SCROLLINFO si;
+		si.fMask=SIF_ALL;
+		m_ctrlScrollH.GetScrollInfo(&si,SIF_ALL);
+
+		switch(nSBCode)
+		{
+		case SB_LINEUP:
+			si.nPos--;
+			break;
+		case SB_LINEDOWN:
+			si.nPos++;
+			break;
+		case SB_PAGEUP:
+			si.nPos-=si.nPage;
+			break;
+		case SB_PAGEDOWN:
+			si.nPos+=si.nPage;
+			break;
+		case SB_THUMBTRACK:
+			si.nPos=nPos;
+			break;
+		}
+
+		if(si.nPos>(int)(si.nMax-si.nMin-si.nPage+1)) si.nPos=si.nMax-si.nMin-si.nPage+1;
+		if(si.nPos<si.nMin) si.nPos=si.nMin;
+		si.fMask=SIF_POS;
+
+		m_ctrlScrollH.SetScrollInfo(&si);
+		m_frameImg.m_ptOrg.x = si.nPos;
+		m_frameImg.ViewUpdate();
+	}
+	CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CViewRecipeSetting::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	if(!pScrollBar->m_hWnd)
+	{
+		CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar);
+		return;
+	}
+
+
+	if(pScrollBar->m_hWnd == m_ctrlScrollV.m_hWnd)
+	{
+		int pos;
+		SCROLLINFO si;
+		si.fMask=SIF_ALL;
+
+		m_ctrlScrollV.GetScrollInfo(&si,SIF_ALL);
+
+		switch(nSBCode)
+		{
+
+		case SB_LINEUP:
+			si.nPos = si.nPos -1;
+			break;
+		case SB_LINEDOWN:
+			si.nPos = si.nPos +1;
+			break;
+		case SB_PAGEUP:
+			si.nPos-=si.nPage;
+			break;
+		case SB_PAGEDOWN:
+			si.nPos+=si.nPage;
+			break;
+		case SB_THUMBTRACK:
+			si.nPos = si.nTrackPos;
+			break;
+
+		}
+
+		if(si.nPos>(int)(si.nMax-si.nMin -si.nPage+1)) 
+			si.nPos=si.nMax-si.nMin-si.nPage+1;
+
+		if(si.nPos<si.nMin) 
+			si.nPos=si.nMin;
+
+		si.fMask=SIF_POS;
+		pos = si.nPos - 1;
+		pos += 0;//g_GrabInfo[m_nCndRDSide].nStartLine;
+		
+		m_ctrlScrollV.SetScrollInfo(&si);
+
+		LPBYTE plpBuf = NULL;
+		
+				
+		if(m_pGlassData != NULL)
+		{
+			INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nCndRDSide);
+			if(pEdgeInfo != NULL)
+				m_frameImg.m_ptOrg.y = max(0,pos + pEdgeInfo->nGlassStartLine - m_frameImg.m_WndRect.Height()/2);								
+		}
+		else
+			m_frameImg.m_ptOrg.y = max(0,pos - m_frameImg.m_WndRect.Height()/2);
+
+		if(m_IV2M != NULL)
+		{					
+			if(m_IV2M != NULL)
+				plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)m_nCndRDSide,m_frameImg.m_ptOrg.y);
+		}
+
+		m_frameImg.SetImage(plpBuf);
+		m_frameImg.SetGlassData(m_pGlassData);			
+		m_frameImg.ViewUpdate();
+	}
+
+	CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CViewRecipeSetting::UpdateZoom()
+{
+	m_frameImg.SetZommMode(m_dZoom);
+	InitScrollInfo();
+	m_frameImg.Invalidate(FALSE);
+}
+
+void CViewRecipeSetting::OnNMCustomdrawSliderZoom2(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+	
+	CString strTmp;
+	int nPos = m_sliderZoom.GetPos();
+
+
+	if(nPos > 4)
+		m_dZoom = 1 +  (nPos - 4)  * 0.25;
+	else if(nPos < 4)
+		m_dZoom = 1 /double(5-nPos);
+	else
+		m_dZoom = 1;
+
+
+	strTmp.Format(_T("X %.2f"),m_dZoom);
+	GetDlgItem(IDC_ST_ZOOM2)->SetWindowText(strTmp);
+
+	*pResult = 0;
+}
+
+void CViewRecipeSetting::OnNMReleasedcaptureSliderZoom2(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	// TODO: Add your control notification handler code here
+	this->SetFocus();
+	UpdateZoom();
+	*pResult = 0;
+}
+
+BOOL CViewRecipeSetting::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+{
+	// TODO: Add your message handler code here and/or call default
+
+	int nPos = m_sliderZoom.GetPos();
+	if(zDelta > 0)
+		m_sliderZoom.SetPos(nPos+1);
+	else
+		m_sliderZoom.SetPos(nPos-1);
+
+	UpdateZoom();
+
+	return CDialogEx::OnMouseWheel(nFlags, zDelta, pt);
+}
+
+LRESULT	CViewRecipeSetting::OnLightApplyRecipe(WPARAM wParam, LPARAM lParam)
+{
+	return 0;
+}
+
+LRESULT CViewRecipeSetting::OnProcessStatus(WPARAM wParam, LPARAM lParam)
+{
+	PROG_MSG MsgJob = *((PROG_MSG*)wParam);
+		
+	if(MsgJob.nSide != m_nCndRDSide)
+		return 0;
+
+	if(MsgJob.nState == 2)
+	{
+		InitScrollInfo();
+
+		double dZoom = m_frameImg.GetZoomData();
+				
+		if(m_pGlassData != NULL)
+		{
+			INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)MsgJob.nSide);
+			if(pEdgeInfo != NULL)
+				m_frameImg.m_ptOrg.y = CHKMAX(0,pEdgeInfo->nGlassStartLine - (int)((m_frameImg.m_WndRect.Height()/2)/ dZoom));								
+		}
+		m_frameImg.SetGlassData(m_pGlassData);		
+		
+		if(m_IV2M != NULL)
+		{		
+			LPBYTE plpBuf = NULL;
+			if(m_IV2M != NULL)
+				plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)MsgJob.nSide,m_frameImg.m_ptOrg.y);
+			m_frameImg.SetImage(plpBuf);
+		}		
+	}
+	else
+	{		
+		InitScrollInfo();
+
+		m_frameImg.m_ptOrg.y = MsgJob.nDispLine;		
+		if(m_IV2M != NULL)
+		{		
+			LPBYTE plpBuf = NULL;
+			if(m_IV2M != NULL)
+				plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)MsgJob.nSide,m_frameImg.m_ptOrg.y);
+			m_frameImg.SetImage(plpBuf);
+		}
+		
+		m_frameImg.SetGlassData(m_pGlassData);	
+		
+	}
+
+	m_frameImg.ViewUpdate();
+
+	return 1;
+}
+
+void CViewRecipeSetting::ClickRecipeListButton()
+{
+	if(m_pViewRecipeList  != NULL)
+	{
+		m_pViewRecipeList->SetRecipeName(m_strPPIDName,m_strRecipeName);
+		m_pViewRecipeList->SetLinkList(&m_VectorLinkList);		
+		m_pViewRecipeList->ShowWindow(SW_SHOW);
+	}
+}
+
+void CViewRecipeSetting::ClickRecipeSaveButton()
+{
+	if(m_pDlgRecipe == NULL)
+		return;
+
+	CDlgLogin		login;
+
+	login.DoModal();
+	if (login.m_bLoginOK == FALSE)
+	{
+		//AfxMessageBox(_T("Login failed! Please try again."));
+		return;
+	}		
+				
+	//if(IDYES == AfxMessageBox(_T("Save Parameter?"), MB_YESNO | MB_ICONQUESTION))
+	{			
+		if(m_pViewRecipeInspection != NULL)
+			m_pViewRecipeInspection->UpdateData(TRUE);
+
+		UpdateData(TRUE);
+		
+		if(m_strRecipeName.IsEmpty() == TRUE)
+		{
+			AfxMessageBox(_T("No Select Recipe"), MB_OK | MB_ICONERROR);
+			return;
+		}
+
+		// 鎬ョ惗绛� Recipe 鑽愭播.				
+		if (m_pDlgRecipe->WriteRecipeFile() == FALSE)		
+		{
+			AfxMessageBox(_T("Save Fail"), MB_OK | MB_ICONERROR);
+			return;
+		}
+
+		m_pDlgRecipe->MakeRecipeFileNameBackUp(m_strRecipeName);
+		m_pDlgRecipe->WriteRecipeFileBackUp();
+
+		if(m_IV2M != NULL)
+			m_IV2M->IV2M_RecipeChange(m_strRecipeName);
+
+		BlVision_GetVisionRecipe()->save();
+	}
+}
+
+BOOL CViewRecipeSetting::LoadLinkFile(CString strFilePath)
+{
+	CConfig cfg;
+	if(!cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode))
+	{		
+		CStdioFile File;
+		CFileException ex;
+
+		if (File.Open(strFilePath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex) == FALSE)
+			return FALSE;
+
+		File.Close();
+
+		if(!cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode))
+			return FALSE;
+	}
+
+	int		nCount;
+
+	cfg.GetItemValue(_T("UPPER_NUMBER"), nCount, 0);
+
+	if(nCount <= 0 || nCount >= 1000)
+		return FALSE;
+
+	DeleteVectorList();
+
+	int i;
+	CString strValue = _T("");
+
+	for(i = 0; i < nCount; i++)
+	{
+		LinkList* pList = new LinkList();
+		cfg.GetItemValue(i, _T("UPPER_NAME"), strValue, _T("NoName"));
+		strValue.MakeUpper();
+		pList->m_strUpperName=strValue;
+
+		cfg.GetItemValue(i, _T("STEP_NAME"), strValue, _T("NoName"));
+		strValue.MakeUpper();
+		pList->m_strStepName=strValue;	
+
+		cfg.GetItemValue(i, _T("INS_NAME"), strValue, _T("NoName"));
+		strValue.MakeUpper();
+		pList->m_strInsName=strValue;
+
+		m_VectorLinkList.push_back(pList);
+	}	
+	return TRUE;
+}
+
+void CViewRecipeSetting::DeleteVectorList()
+{
+	// Vector 鏄忓姏
+	LinkList* pList = NULL;
+	for (VectorLinkListIt it = m_VectorLinkList.begin(); it != m_VectorLinkList.end(); it++)
+	{
+		pList = *it;
+		if (pList)
+			delete pList;
+	}
+	m_VectorLinkList.clear();
+}
+
+BOOL CViewRecipeSetting::WriteLinkFile(CString strFilePath)
+{
+	CConfig cfg;
+	if(!cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode))
+	{
+		CStdioFile		File;
+		CFileException ex;
+
+		if (File.Open(strFilePath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite, &ex) == FALSE)
+			return FALSE;
+
+		File.Close();
+
+		if(!cfg.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFilePath, FileMap_Mode))
+			return FALSE;
+	}
+
+	int		nCount = (int)m_VectorLinkList.size();
+
+	cfg.SetItemValue(_T("UPPER_NUMBER"), nCount);
+
+	if(nCount <= 0 || nCount >= 1000)
+		return FALSE;
+
+	int i = 0;
+	CString strValue = _T("");
+
+	LinkList* pList;
+	for(VectorLinkListIt it = m_VectorLinkList.begin(); it != m_VectorLinkList.end(); it++)
+	{
+		pList = *it;
+		if(pList == NULL)
+			continue;
+
+		cfg.SetItemValue(i, _T("UPPER_NAME"), (TCHAR*)(LPCTSTR)pList->m_strUpperName);		
+		cfg.SetItemValue(i, _T("STEP_NAME"), (TCHAR*)(LPCTSTR)pList->m_strStepName);
+		cfg.SetItemValue(i, _T("INS_NAME"), (TCHAR*)(LPCTSTR)pList->m_strInsName);
+
+		i++;
+	}	
+	cfg.WriteToFile();
+
+	return TRUE;
+}
+
+LRESULT CViewRecipeSetting::OnSelectRecipe(WPARAM wParam, LPARAM lParam)
+{
+	if(m_pViewRecipeList != NULL)
+	{
+		m_strPPIDName = m_pViewRecipeList->GetPPIDName();
+		m_strRecipeName = m_pViewRecipeList->GetRecipeName();
+		ChangeRecipe();		
+		WriteLinkFile(LINK_FILE_NAME);
+	}
+
+	return 0;
+}
+
+POINT CViewRecipeSetting::IE2P_GetFrameViewBasepoint()
+{
+	return m_frameImg.m_ptOrg;
+}
+
+void CViewRecipeSetting::IE2P_SetExpAreaTrackerReset()
+{
+	m_frameImg.SetAcitveTracker(NULL);
+}
+
+void CViewRecipeSetting::IE2P_SetExpArea(int iSide)
+{
+	if(m_pViewExpArea == NULL || m_pGlassData == NULL)
+		return;
+
+	CPoint ptOrg;	
+
+	EXECPTION_AREA *pExpArea = m_pViewExpArea->GetExpArea();
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)iSide);
+	if(pResInfo == NULL)
+		return;
+
+	m_frameImg.SetAcitveTracker(pExpArea);
+	ptOrg.x = CHKMAX(0,(int)(pExpArea->rc.left +  pResInfo->ptMark[0].x));
+	ptOrg.y = CHKMAX(0,(int)(pExpArea->rc.top  +  pResInfo->ptMark[0].y - m_frameImg.m_WndRect.Height()/2));
+
+	m_frameImg.m_ptOrg.y = ptOrg.y;
+
+	LPBYTE plpBuf = NULL;
+	if(m_IV2M != NULL)
+		plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)iSide,ptOrg.y);
+	m_frameImg.SetImage(plpBuf);		
+
+	SCROLLINFO si;
+	si.fMask=SIF_ALL;
+	m_ctrlScrollV.GetScrollInfo(&si,SIF_ALL);
+	si.nPos = CHKMAX(pResInfo->nGlassStartLine  - m_frameImg.m_WndRect.Height()/2 +1,ptOrg.y - pResInfo->nGlassStartLine  - m_frameImg.m_WndRect.Height()/2 +1);
+	m_ctrlScrollV.SetScrollInfo(&si);
+	m_frameImg.ViewUpdate();
+}
+
+void CViewRecipeSetting::IU2P_DrawRefresh()
+{
+	m_frameImg.Invalidate(FALSE);
+}
+
+void CViewRecipeSetting::IU2P_DrawRect(BOOL bSet)
+{
+	if(m_pGlassData == NULL)
+		return;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nCndRDSide);
+	if(pResInfo == NULL)
+		return;
+
+	if(bSet == TRUE)
+	{
+		//if(pResInfo->ptMark[0].x > 0 && pResInfo->ptMark[0].y > 0)
+		{
+			m_frameImg.SetMode(MODE_USER_DEFECT_AREA);
+			m_frameImg.Invalidate(FALSE);
+		}
+	}
+	else
+	{
+		m_frameImg.ResetMode(MODE_USER_DEFECT_AREA);
+		m_frameImg.Invalidate(FALSE);
+	}
+}
+
+CRect CViewRecipeSetting::IU2P_GetCompareRect()
+{
+	CRect		rect = CRect(0,0,0,0);
+
+	if(m_pGlassData == NULL)
+		return rect;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nCndRDSide);
+	if(pResInfo == NULL)
+		return rect;
+
+	//if(pResInfo->ptMark[0].x > 0 && pResInfo->ptMark[0].y > 0)
+	{
+		rect = m_frameImg.GetCompareRect();
+	}
+
+	return rect;
+}
+
+void CViewRecipeSetting::ChangeRecipe()
+{
+	m_pDlgRecipe->Reset();
+
+	ReadRecipe(m_strRecipeName);
+	
+	m_strRecipeName = m_pDlgRecipe->GetRecipeName();
+	m_ctrlRecipeName.SetCaption(m_strRecipeName);	
+	m_ctrlRecipeComment.SetCaption(m_pDlgRecipe->m_GlassParm.m_strDisp);	
+
+	if(m_pViewRecipeInspection != NULL)
+	{
+		m_pViewRecipeInspection->SetRecipe(m_pHardware,m_pDlgRecipe);
+		m_pViewRecipeInspection->DrawMarkImage();
+		m_pViewRecipeInspection->Refresh();
+	}
+
+	std::string strVisionName = BlVision_GetVisionRecipe()->getVisionName();
+	CW2A pszConvertedAnsiString(m_strRecipeName);
+	if (strVisionName.compare(pszConvertedAnsiString) != 0)
+	{
+		auto startTime = std::chrono::high_resolution_clock::now();
+		BlVision_GetVisionRecipe()->setVisionName(pszConvertedAnsiString);
+		BlVision_GetVisionRecipe()->open();
+		auto endTime = std::chrono::high_resolution_clock::now();
+		auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
+		g_pLog->DisplayMessage(_T("Read VisionRecipe %s %lld milliseconds"), m_strRecipeName, duration.count());
+	}
+
+	int nGlassSizeX = m_pDlgRecipe->m_GlassParm.m_nGlassSizeX;
+	int nGlassSizeY = m_pDlgRecipe->m_GlassParm.m_nGlassSizeY;
+	BlVision_GetVisionRecipe()->setGlassSize(nGlassSizeX, nGlassSizeY);
+
+	UpdateData(FALSE);
+}
+
+BOOL CViewRecipeSetting::ReadRecipe(CString strRecipe)
+{
+	if(strRecipe.IsEmpty() == TRUE)
+	{
+		//AfxMessageBox("Recipe Name鎹� 缁濆毤鑱績.");
+		return FALSE;	
+	}
+
+	m_pDlgRecipe->Reset();
+
+	if(m_pDlgRecipe->MakeRecipeFileName(strRecipe) == FALSE)
+		return FALSE;
+
+	return m_pDlgRecipe->ReadRecipeFile();
+}
+
+void CViewRecipeSetting::IInspectRecipe2RecipeView_ChangeSide(int iSide)
+{
+	m_nCndRDSide = iSide;
+
+	InitScrollInfo();
+
+	m_frameImg.SetSide(m_nCndRDSide);
+
+	if(m_IV2M != NULL)
+	{		
+		LPBYTE plpBuf = NULL;
+		if(m_IV2M != NULL)
+			plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)m_nCndRDSide,m_frameImg.m_ptOrg.y);
+		m_frameImg.SetImage(plpBuf);			
+	}	
+
+	m_frameImg.SetRecipe(m_pHardware,m_pDlgRecipe);
+	m_frameImg.SetGlassData(m_pGlassData);	
+	m_frameImg.ViewUpdate();	
+
+	if (NULL != m_pVisionSetDlg) {
+		ISoftVisionApp *pApp = BlVision_GetSoftVisionApp();
+		int nDir = (DimensionDir)(iSide);
+		pApp->ChangeDimension(m_pVisionSetDlg, nDir);
+	}
+}
+
+BOOL CViewRecipeSetting::IInspectRecipe2RecipeView_SetMarker(int nPos,int nMarkPos)
+{
+	if(!m_frameImg.GetMode(MODE_MARK_REG))
+		return FALSE;
+	if(m_IV2M == NULL || m_pDlgRecipe == NULL)
+		return FALSE;
+
+	CALIGNMARK_PARM		*pAlignPrm = m_pDlgRecipe->GetAlignMarkPrm((DimensionDir)m_nCndRDSide);
+	if(pAlignPrm == NULL)
+		return FALSE;
+
+	CRect rc(m_frameImg.GetMartRect()); 
+	CvRect roi;
+	
+	LPBYTE		lpImg = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)m_nCndRDSide,rc.top);
+	IplImage *IpScr = cvCreateImageHeader(cvSize(IMAGE_WIDTH,IMAGE_HEIGHT),8,1);
+	cvSetData(IpScr,lpImg ,IMAGE_WIDTH);
+
+	roi.x		= rc.left;
+	roi.y		= 0;
+	roi.width	= rc.Width();
+	roi.height	= rc.Height();
+		
+
+	if(pAlignPrm->m_nMarkType[0] == 0 || pAlignPrm->m_nMarkType[0] == 1)
+	{
+		CvRect rcMark = Get_MaxPattern(IpScr,roi,pAlignPrm->m_nMarkType[0]);
+
+		if(rcMark.width > 10 && rcMark.height > 10)
+		{
+			roi.x = max(0,rcMark.x - 10);
+			roi.y = max(0,rcMark.y - 10);
+			roi.width  = min(IMAGE_WIDTH  - roi.x,rcMark.width  +20);
+			roi.height = min(IMAGE_HEIGHT - roi.y,rcMark.height +20);
+
+			CvPoint2D32f ptCenter = Get_MarkCenter(IpScr,roi,pAlignPrm->m_nMarkType[0]);
+
+			roi.x = int(ptCenter.x - rcMark.width/2.0 + 0.5);
+			roi.y = int(ptCenter.y - rcMark.height/2.0 + 0.5);
+
+			roi.width  = rcMark.width;
+			roi.height = rcMark.height;
+		}	
+	}
+	
+
+	if(roi.x >= 0 && roi.y >= 0)
+	{
+		if(pAlignPrm->IpMarkImg[nPos][nMarkPos])
+			cvReleaseImage(&pAlignPrm->IpMarkImg[nPos][nMarkPos]);
+
+		//cvSetImageROI(IpScr,roi);
+
+		pAlignPrm->IpMarkImg[nPos][nMarkPos] = cvCreateImage(cvSize(roi.width,roi.height),8,1);
+
+		BYTE		*pOrg,*pTgt;
+		int			iPos = 0;
+ 		for(int i=roi.y;i<roi.y+roi.height;i++,iPos++)
+		{
+			pOrg = (BYTE *)(IpScr->imageData+i*IpScr->widthStep+roi.x);
+			pTgt = (BYTE *)(pAlignPrm->IpMarkImg[nPos][nMarkPos]->imageData+iPos*pAlignPrm->IpMarkImg[nPos][nMarkPos]->widthStep);
+			CopyMemory(pTgt, pOrg, roi.width);
+		}
+	}
+
+	cvReleaseImageHeader(&IpScr);	
+
+	return TRUE;
+}
+
+void CViewRecipeSetting::IInspectRecipe2RecipeView_SetMarkerPos(int nOff_X,int nOff_Y)
+{
+	CRect rc;
+	rc = m_frameImg.GetMartRect();
+	rc.OffsetRect(nOff_X,nOff_Y);
+	m_frameImg.SetMarkRect(rc);
+	m_frameImg.ViewUpdate();
+}
+
+void CViewRecipeSetting::IInspectRecipe2RecipeView_ModifyMarker(BOOL bModify)
+{
+	if(bModify == TRUE)
+	{
+		m_frameImg.SetMode(MODE_MARK_REG);
+	}
+	else
+	{
+		m_frameImg.ResetMode(MODE_MARK_REG);
+	}
+	m_frameImg.Invalidate(FALSE);
+}
+
+CvRect CViewRecipeSetting::Get_MaxPattern(IplImage *IpScr,CvRect roi,int nMode,int nOffSet)
+{
+	cvSetImageROI(IpScr,roi);
+
+	IplImage *Bin = cvCreateImage(cvSize(roi.width,roi.height),8,1);
+
+	double dMean = cvAvg(IpScr).val[0];
+
+	if(nMode == 0)
+		cvThreshold(IpScr,Bin,dMean + nOffSet,255,CV_THRESH_BINARY);
+	else
+		cvThreshold(IpScr,Bin,dMean - nOffSet,255,CV_THRESH_BINARY_INV);
+
+	CvMemStorage* storage = cvCreateMemStorage(0);
+	CvSeq *contours = 0;
+	cvFindContours(Bin,storage,&contours,sizeof(CvContour),CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
+
+	
+	CvRect rect;
+	CvRect rect_max = cvRect(0,0,0,0);
+
+	for(;contours!=0;contours=contours->h_next)
+	{
+		rect = cvBoundingRect(contours);
+
+		if(rect.width * rect.height > rect_max.width * rect_max.height)	
+		{
+			rect_max = rect;
+		}
+	}
+	cvResetImageROI(IpScr);
+	cvSetImageROI(IpScr,rect_max);
+	
+	rect_max.x += roi.x;
+	rect_max.y += roi.y;
+	cvResetImageROI(IpScr);
+	cvReleaseMemStorage(&storage);
+	cvReleaseImage(&Bin);
+	return rect_max;
+}
+
+CvPoint2D32f  CViewRecipeSetting::Get_MarkCenter(IplImage *IpScr,CvRect roi,int nMode,int nOffSet)
+{
+	cvSetImageROI(IpScr,roi);
+	IplImage *Bin = cvCreateImage(cvSize(roi.width,roi.height),8,1);
+
+	double dMean = cvAvg(IpScr).val[0];
+
+	switch(nMode)
+	{
+	case 0:
+		cvThreshold(IpScr,Bin,dMean + nOffSet,255,CV_THRESH_BINARY);
+		break;
+
+	case 1:
+		cvThreshold(IpScr,Bin,dMean - nOffSet,255,CV_THRESH_BINARY_INV);
+		break;
+
+	case 2:
+		cvCanny(IpScr,Bin,100,50,3);
+		break;
+	}
+
+	cvResetImageROI(IpScr);
+
+	//cvSaveImage(Data,Bin)
+	int i,j,nPos1,nPos2,nCnt1,nCnt2;
+	
+	float *ptCenter_X = new float[roi.height]; 
+
+	float *ptCenter_Y = new float[roi.width];
+
+	BYTE *pData;
+
+	nCnt1 = nCnt2 = 0;
+	for(i = 0; i < roi.height; i++)
+	{
+		nPos1 = nPos2 = 0;
+	
+		pData = (BYTE *)(&Bin->imageData[i * Bin->widthStep]);
+		for(j = 1; j < roi.width ; j++)
+		{
+			if(pData[j])
+			{
+				nPos1 = j;
+				break;
+			}
+		}
+
+		for(j = roi.width -1 ; j > 1 ; j--)
+		{
+			if(pData[j])
+			{		
+				nPos2 = j;
+				break;
+			}
+		}
+
+		if(nPos1 && nPos2)
+			ptCenter_X[nCnt1++] = (float)((nPos1 + nPos2)/2.0);
+	}
+	
+
+	for(j = 1 ; j< roi.width; j++)
+	{
+		nPos1 = nPos2 = 0;
+		for(i =  1; i < roi.height ; i++)
+		{
+			pData = (BYTE *)(&Bin->imageData[i * Bin->widthStep + j]);
+
+			if(*pData)
+			{
+				nPos1 = i;
+				break;
+			}
+		}
+
+		for(i =  roi.height -1; i >  1 ; i--)
+		{
+			pData = (BYTE *)(&Bin->imageData[i * Bin->widthStep + j]);
+
+			if(*pData)
+			{		
+				nPos2 = i;
+				break;
+			}
+		}
+
+		if(nPos1 && nPos2)
+			ptCenter_Y[nCnt2++] = (float)((nPos1 + nPos2)/2.0);
+	}
+
+	if(nCnt1)
+		sort(ptCenter_X,&ptCenter_X[nCnt1]);
+	if(nCnt2)
+		sort(ptCenter_Y,&ptCenter_Y[nCnt2]);
+
+
+	CvPoint2D32f ptCenter;
+
+	ptCenter.x = ptCenter.y = 0;
+
+	if(nCnt1 > 10 && nCnt2 > 10)
+	{
+		
+		for(i = nCnt1/2 - 5; i < nCnt1/2 + 5; i++)
+			ptCenter.x += ptCenter_X[i];
+
+		for(i = nCnt2/2 - 5; i < nCnt2/2 + 5; i++)
+			ptCenter.y += ptCenter_Y[i];
+
+		ptCenter.x = (float)(ptCenter.x / 10.0 + roi.x);
+		ptCenter.y = (float)(ptCenter.y / 10.0 + roi.y);
+	}
+	else
+	{
+
+		ptCenter.x = (float)(ptCenter_X[nCnt1/2]/2.0 + roi.x);
+		ptCenter.y = (float)(ptCenter_Y[nCnt2/2]/2.0 + roi.y);
+	}
+
+	delete [] ptCenter_X;
+	delete [] ptCenter_Y;
+
+
+	cvReleaseImage(&Bin);
+
+	return ptCenter;
+}
+
+void CViewRecipeSetting::OnBnClickedBtnUserDefect()
+{
+	if(m_pViewUserDefect != NULL)
+	{
+		m_pViewUserDefect->SetIndex(m_nCndRDSide);
+		m_pViewUserDefect->SetRecipe(m_pHardware,m_pDlgRecipe);
+		m_pViewUserDefect->SetGlassData(m_pGlassData);		
+		m_pViewUserDefect->ShowWindow(SW_SHOW);
+	}
+}
+
+void CViewRecipeSetting::IE2P_SetExpAreaDlgClose()
+{
+	m_bShowExpArea = FALSE;
+	m_frameImg.SetTrackerModify(FALSE);
+	m_frameImg.ResetMode(MODE_MARK_REG);
+	m_frameImg.Invalidate(FALSE);
+}
+
+void CViewRecipeSetting::OnBnClickedBtnExpRegion()
+{	
+	if(m_pViewExpArea != NULL)
+	{
+		m_frameImg.SetTrackerModify(TRUE);
+		m_frameImg.SetMode(MODE_MARK_REG);
+		m_frameImg.SetEventWnd(GetSafeHwnd());
+
+		m_pViewExpArea->SetRecipe(m_pHardware,m_pDlgRecipe);
+		m_pViewExpArea->SetGlassData(m_pGlassData);
+		m_pViewExpArea->SetIndex(m_nCndRDSide);
+		m_pViewExpArea->ShowWindow(SW_SHOW);
+		m_bShowExpArea = TRUE;
+	}
+}
+
+LRESULT CViewRecipeSetting::OnAreaModify(WPARAM wParam, LPARAM lParam)
+{
+	if(m_bShowExpArea == FALSE)
+		return 1;
+
+	if(m_pViewExpArea != NULL)
+	{
+		m_pViewExpArea->SetAreaModify(m_frameImg.m_pTracker);
+	}
+
+	return 1;
+}
+
+LRESULT CViewRecipeSetting::OnAreaChange(WPARAM wParam, LPARAM lParam)
+{
+	if(m_bShowExpArea == FALSE)
+		return 1;
+
+	if(m_pViewExpArea != NULL)
+	{
+		m_pViewExpArea->SetAreaChange(m_frameImg.m_pTracker);
+	}
+	return 1;
+}
+
+BOOL CViewRecipeSetting::IHoleRecipe2RecipeView_AddHoleArea(int& nSideIdx, CRect& rtArea)
+{
+	if(m_pGlassData == NULL)
+		return FALSE;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nCndRDSide);
+	if(pResInfo == NULL)
+		return FALSE;
+
+	if(pResInfo->ptMark[0].x < 1 || pResInfo->ptMark[0].y  < 1)
+	{
+		AfxMessageBox(_T("Not Measure Image... This Function use after Measure"));
+		return FALSE;
+	}
+
+	nSideIdx		= m_nCndRDSide;
+	rtArea.left		= (int)(m_frameImg.m_ptOrg.x - pResInfo->ptMark[0].x + 50);
+	rtArea.top		= (int)(m_frameImg.m_ptOrg.y - pResInfo->ptMark[0].y + 50);
+	rtArea.right	= rtArea.left + 150;
+	rtArea.bottom	= rtArea.top + 150;
+
+	return TRUE;
+}
+
+BOOL CViewRecipeSetting::IHoleRecipe2RecipeView_GetHoleAreaImage(int nHoleIdx, IplImage** pImageBuffer)
+{
+	if(m_IV2M == NULL || pImageBuffer == NULL || m_pDlgRecipe == NULL)
+		return FALSE;
+
+	if(m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_nSideIdx != m_nCndRDSide)
+		return FALSE;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nCndRDSide);
+	if(pResInfo == NULL)
+		return FALSE;
+
+	if(pResInfo->ptMark[0].x < 1 || pResInfo->ptMark[0].y  < 1)
+	{
+		AfxMessageBox(_T("Not Measure Image... This Function use after Measure"));
+		return FALSE;
+	}
+
+	if(*(pImageBuffer) != NULL)
+		cvReleaseImage(pImageBuffer);
+
+	(*pImageBuffer) = cvCreateImage(cvSize(m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.Width(), m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.Height()), 8, 1);
+	cvZero((*pImageBuffer));
+
+	int nStartX = (int)(pResInfo->ptMark[0].x + m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.left);
+	int nStartY = (int)(pResInfo->ptMark[0].y + m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.top);
+
+	BYTE* pGrabBuffer = NULL;
+
+	for(int i=0; i< (*pImageBuffer)->height; i++)
+	{
+		pGrabBuffer = m_IV2M->IV2M_GetGrabBufferByDimension((GLOBAL_DEFINE::DimensionDir) m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_nSideIdx, nStartY + i);
+
+		if(pGrabBuffer == NULL)
+			continue;
+
+		memcpy(&(*pImageBuffer)->imageData[(*pImageBuffer)->widthStep*i], pGrabBuffer+nStartX, sizeof(BYTE)*(*pImageBuffer)->width);
+	}
+
+	return TRUE;
+}
+
+void CViewRecipeSetting::IHoleRecipe2RecipeView_UpdateFrameView()
+{
+	m_frameImg.SetRecipe(m_pHardware, m_pDlgRecipe);
+	m_frameImg.ViewUpdate();
+}
+
+void CViewRecipeSetting::IHoleRecipe2RecipeView_SaveRecipe()
+{
+	ClickRecipeSaveButton();
+}
+
+void CViewRecipeSetting::OnBnClickedBtnLightControl()
+{
+	if(m_pviewLightControl != NULL)
+	{
+		m_pviewLightControl->SetData(m_pDlgRecipe,m_pHardware);
+		m_pviewLightControl->SetParent(this);
+		m_pviewLightControl->ShowWindow(SW_SHOW);
+	}
+}
+
+BOOL CViewRecipeSetting::IHoleRecipe2RecipeVIew_HoleInspectProcess(int nHoleIdx, IplImage** pImageBuffer)
+{
+	if(m_pDlgRecipe == NULL || pImageBuffer == NULL)
+		return FALSE;
+
+	INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_nCndRDSide);
+	if(pResInfo == NULL)
+		return FALSE;
+
+
+	if(pResInfo->ptMark[0].x < 1 || pResInfo->ptMark[0].y  < 1)
+	{
+		AfxMessageBox(_T("Not Measure Image... This Function use after Measure"));
+		return FALSE;
+	}
+
+	if(nHoleIdx < 0 || m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam.size() <= nHoleIdx)
+		return FALSE;
+
+	if(m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_nSideIdx != m_nCndRDSide)
+		return FALSE;
+
+	IplImage* pTargetImage = cvCreateImage(cvSize(m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.Width(), m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.Height()), 8, 1);
+	cvZero(pTargetImage);
+
+	int nStartX = (int)(pResInfo->ptMark[0].x + m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.left);
+	int nStartY = (int)(pResInfo->ptMark[0].y + m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.top);
+
+	BYTE* pGrabBuffer = NULL;
+
+	for(int i=0; i< m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_rtArea.Height(); i++)
+	{
+		pGrabBuffer = m_IV2M->IV2M_GetGrabBufferByDimension((GLOBAL_DEFINE::DimensionDir) m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx].m_nSideIdx, nStartY + i);
+
+		if(pGrabBuffer == NULL)
+			continue;
+
+		memcpy(&pTargetImage->imageData[pTargetImage->widthStep*i], pGrabBuffer+nStartX, sizeof(BYTE)*pTargetImage->width);
+	}
+
+	CHoleInspector holeInspector;
+	std::vector<CRect> vecDefectList;
+
+	CPoint ptMatchingPos;
+
+	holeInspector.HoleInspect_TemplateMatching(&m_pDlgRecipe->m_HoleInspectParm.m_vecHoleInsParam[nHoleIdx], pTargetImage, vecDefectList, ptMatchingPos, pImageBuffer);
+
+	cvReleaseImage(&pTargetImage);
+
+	return TRUE;
+}
+
+int CViewRecipeSetting::IHoleRecipe2RecipeView_GetCurrentSetSide()
+{
+	return m_nCndRDSide;
+}
+
+void CViewRecipeSetting::OnClickButtonLang()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	int nRet = -1;
+	switch (g_pLang->m_eSelectLangType)
+	{
+	case emLanguageType::emLanguageType_EN:
+		nRet = MessageBox(_T("After changing the language, restart the software."), _T("Hint"), MB_OKCANCEL | MB_ICONINFORMATION);
+		break;
+	case emLanguageType::emLanguageType_KR:
+		nRet = MessageBox(_T("鞏胳柎毳� 氤�瓴巾暅 頉� 靻岉攧韸胳洦鞏措ゼ 雼れ嫓 鞁滌瀾頃橃嫮鞁滌槫."), _T("鞝滌嫓"), MB_OKCANCEL | MB_ICONINFORMATION);
+		break;
+	case emLanguageType::emLanguageType_CH:
+		nRet = MessageBox(_T("鍒囨崲璇█鍚庯紝璇烽噸鍚蒋浠躲��"), _T("鎻愮ず"), MB_OKCANCEL | MB_ICONINFORMATION);
+		break;
+	default:
+		return;
+	}
+
+	if (IDOK == nRet)
+	{
+		emLanguageType eSelLang;
+		switch (nID)
+		{
+		case IDC_BUTTON_LANG_ENGLISH:
+			eSelLang = emLanguageType::emLanguageType_EN;
+			break;
+		case IDC_BUTTON_LANG_KOREAN:
+			eSelLang = emLanguageType::emLanguageType_KR;
+			break;
+		case IDC_BUTTON_LANG_CHINESE:
+			eSelLang = emLanguageType::emLanguageType_CH;
+			break;
+		default:
+			return;
+		}
+
+		CString strPath;
+		strPath.Format(_T("%s\\LanguageType.ini"), LANGUAGE_DIR_PATH);
+		CT2CA pszConvertedAnsiString(strPath, CP_UTF8);
+		g_pLang->SaveLanguageSetting(std::string(pszConvertedAnsiString), eSelLang);
+	}
+}
+
+void CViewRecipeSetting::ClickButtonVisionSet()
+{
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+	IVisionRecipe *pInstance = BlVision_GetVisionRecipe();
+	CW2A pszHPanelID(g_pBase->m_strHPanelID);
+	pInstance->setProductNo(pszHPanelID);
+	if (NULL == pInstance) return;
+	if (!pInstance->getVisionUse()) {
+		BlVision_GetSoftVisionApp()->OpenKeySetWindow();
+		return;
+	}
+
+	ISoftVisionApp *pApp = BlVision_GetSoftVisionApp();
+	if (NULL == m_pVisionSetDlg) {
+		m_pVisionSetDlg = pApp->CreateVisionWindow();
+	}
+
+
+	m_pVisionSetDlg->ShowWindow(SW_SHOW);
+	int nDir = (DimensionDir)(m_nCndRDSide);
+	pApp->SetVisionOpen(TRUE);
+	pApp->ChangeDimension(m_pVisionSetDlg, nDir);
+
+//	BlVision_GetSoftVisionApp()->OpenVisionWindow();
+}
diff --git a/ENRIT/View/ViewRecipeSetting.h b/ENRIT/View/ViewRecipeSetting.h
new file mode 100644
index 0000000..98c66e6
--- /dev/null
+++ b/ENRIT/View/ViewRecipeSetting.h
@@ -0,0 +1,157 @@
+#pragma once
+
+#include "btnenh.h"
+#include "General_Draw.h"
+#include "FrameImg.h"
+#include "Global_Define.h"
+#include "ViewRecipeInspectionView.h"
+#include "ViewRecipeProfileView.h"
+#include "ViewRecipeChamferView.h"
+
+// CViewRecipeSetting 措拳 惑磊涝聪促.
+
+class CHardwareLightSettings;
+class CGlassRecipe;
+class CGlass_Data;
+class CViewRecipeList;
+class CViewUserDefectArea;
+class CViewException;
+class CViewLampControl;
+class CViewRecipeSetting : public CDialogEx
+							,public IUserDefectInterface2Parent			
+							, public IHoleRecipeView2Parent
+							, public IInspectRecipeView2Parent
+{
+	DECLARE_DYNAMIC(CViewRecipeSetting)
+
+public:
+	CViewRecipeSetting(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewRecipeSetting();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_RECIPE_VIEW };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	LRESULT OnProcessStatus(WPARAM wParam, LPARAM lParam);
+	afx_msg void OnPaint();	
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);	
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnNMCustomdrawSliderZoom2(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSliderZoom2(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	afx_msg LRESULT OnSelectRecipe(WPARAM wParam, LPARAM lParam);	
+	LRESULT	OnLightApplyRecipe(WPARAM wParam, LPARAM lParam);	
+	LRESULT OnAreaModify(WPARAM wParam, LPARAM lParam);
+	LRESULT OnAreaChange(WPARAM wParam, LPARAM lParam);	
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+protected:		
+	CBtnEnh			m_ctrlRecipeName,m_ctrlRecipList,m_ctrlRecipeComment;	
+	IVisionEvent *m_pVisionEvent = nullptr;
+
+public:
+	void			SetRecipe(CHardwareSettings *pHW,CGlassRecipe *pRecipe);
+	void			SetV2M(IViewInterface2Parent* pV2M);
+	void			SetGlassData(CGlass_Data *pGlass);
+	void			ViewRefresh(PROG_MSG ProcMsg);
+	void			InitView();
+
+	static void			 onMsgVisionEvent(int code, int eDir);
+	static void          onMsgLogEvent(int level, std::string strText);
+	void                DispAllResult(void);
+	void                SetFrameRegion(void);
+
+protected:
+	enum			eViewSelect {eRcp_Inspection=0, eRcp_Profile, eRcp_Chamfer, eRcp_End};
+	CBtnEnh			m_ctrlCmdSelect[eRcp_End];	
+
+	void			ClickChkSelectlButton();
+	void			SetButtonSelectEnableAll(const BOOL& bEnable);
+	void			SetButtonSelectSel(eViewSelect eSelView, BOOL bEnable);
+	void			ChangeRcpView(UINT nID);
+	void			ChangeSelectView(UINT nViewID);
+
+	void			ClickImgLoadButton();
+	void			ClickImgSaveButton();
+	void			ClickInitProcessButton();
+	void			ClickInspectProcessButton();		
+	void			ClickRecipeSaveButton();
+	void			ClickRecipeListButton();	
+	void			OnBnClickedBtnUserDefect();
+	void			OnBnClickedBtnExpRegion();
+	void			OnBnClickedBtnLightControl();
+	void			OnClickButtonLang();
+
+protected:
+	virtual void		IU2P_DrawRect(BOOL bSet);
+	virtual CRect		IU2P_GetCompareRect();
+	virtual void		IU2P_DrawRefresh();
+
+	virtual void		IE2P_SetExpArea(int iSide);
+	virtual POINT		IE2P_GetFrameViewBasepoint();
+	virtual void		IE2P_SetExpAreaTrackerReset();	
+	virtual void		IE2P_SetExpAreaDlgClose();
+
+	virtual BOOL		IHoleRecipe2RecipeView_AddHoleArea(int& nSideIdx, CRect& rtArea);
+	virtual BOOL		IHoleRecipe2RecipeView_GetHoleAreaImage(int nHoleIdx, IplImage** pImageBuffer);
+	virtual void		IHoleRecipe2RecipeView_UpdateFrameView();
+	virtual void		IHoleRecipe2RecipeView_SaveRecipe();
+	virtual BOOL		IHoleRecipe2RecipeVIew_HoleInspectProcess(int nHoleIdx, IplImage** pImageBuffer);
+	virtual int			IHoleRecipe2RecipeView_GetCurrentSetSide();
+
+	virtual BOOL		IInspectRecipe2RecipeView_SetMarker(int nPos,int nMarkPos);
+	virtual void		IInspectRecipe2RecipeView_SetMarkerPos(int nOff_X,int nOff_Y);
+	virtual void		IInspectRecipe2RecipeView_ModifyMarker(BOOL bModify);
+	virtual void		IInspectRecipe2RecipeView_ChangeSide(int iSide);
+
+protected:
+	void			InitScrollInfo(BOOL bInitPos = FALSE);
+	void			UpdateZoom();
+	
+	BOOL			LoadLinkFile(CString strFilePath);
+	void			DeleteVectorList();
+	BOOL			WriteLinkFile(CString strFilePath);
+	void			ChangeRecipe();
+	BOOL			ReadRecipe(CString strRecipe);		
+	
+protected:
+	CvPoint2D32f	Get_MarkCenter(IplImage *IpScr,CvRect roi,int nMode,int nOffSet = 20);
+	CvRect			Get_MaxPattern(IplImage *IpScr,CvRect roi,int nMode,int nOffSet = 20); 
+
+protected:
+	CHardwareSettings			*m_pHardware;
+	CGlassRecipe			*m_pRecipe;
+	CGlassRecipe			*m_pDlgRecipe;
+	CGlass_Data					*m_pGlassData;
+	CViewRecipeList				*m_pViewRecipeList;	
+	CViewUserDefectArea			*m_pViewUserDefect;
+	CViewException				*m_pViewExpArea;	
+	CViewLampControl			*m_pviewLightControl;
+	CViewRecipeInspectionView	*m_pViewRecipeInspection;
+	CViewRecipeProfileView		*m_pViewRecipeProfile;
+	CViewRecipeChamferView		*m_pViewRecipeChamfer;
+	BOOL						m_bShowExpArea;
+		
+	VectorLinkList				m_VectorLinkList;	
+	IViewInterface2Parent		*m_IV2M;	
+	
+
+	double						m_dZoom;
+	CFrameImg					m_frameImg;
+	CRect						m_rcFrameImg;
+	CScrollBar					m_ctrlScrollV,m_ctrlScrollH;
+	CSliderCtrl					m_sliderZoom;
+	CString						m_strRecipeName,m_strPPIDName;
+
+	CDialogEx* m_pVisionSetDlg;
+
+	int							m_nCndRDSide;	
+	int							m_nCndSelect;
+public:
+	void ClickButtonVisionSet();
+};
diff --git a/ENRIT/View/ViewScanImage.cpp b/ENRIT/View/ViewScanImage.cpp
new file mode 100644
index 0000000..25de260
--- /dev/null
+++ b/ENRIT/View/ViewScanImage.cpp
@@ -0,0 +1,1404 @@
+// ViewScanImage.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ENRIT.h"
+#include "ViewScanImage.h"
+#include "afxdialogex.h"
+#include "Global_Define.h"
+#include "Glass_Data.h"
+
+enum TYPE_MANUAL_CMD
+{
+	M_CMD_PROC_SHORT_START,
+	M_CMD_PROC_LONG_START,
+	M_CMD_PROC_ALL_START,
+	M_CMD_IMG_LOAD_ALL,
+	M_CMD_IMG_SAVE_ALL,
+	M_CMD_IMG_LOAD_SIDE,
+	M_CMD_IMG_SAVE_SIDE,
+
+};
+
+// CViewScanImage 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewScanImage, CDialogEx)
+
+CViewScanImage::CViewScanImage(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewScanImage::IDD, pParent)
+{
+	m_nShowSelect	 =0;
+	m_dZoom = 1;
+	m_pManualProcess = NULL;
+	m_nIndex		= 0;
+	m_nThreadCmd	= 0;
+	m_IV2M = NULL;
+	m_pHardware = NULL;
+	m_pGlassData = NULL;	
+}
+
+CViewScanImage::~CViewScanImage()
+{
+}
+
+void CViewScanImage::DoDataExchange(CDataExchange* pDX)
+{
+	DDX_Control(pDX, IDC_SCROLLBAR_V_1		, m_ctrlScrollV[0]);
+	DDX_Control(pDX, IDC_SCROLLBAR_V_2		, m_ctrlScrollV[1]);
+	DDX_Control(pDX, IDC_SCROLLBAR_V_3		, m_ctrlScrollV[2]);
+	DDX_Control(pDX, IDC_SCROLLBAR_V_4		, m_ctrlScrollV[3]);
+	DDX_Control(pDX, IDC_SCROLLBAR_V_5		, m_ctrlScrollV[4]);
+	DDX_Control(pDX, IDC_SCROLLBAR_V_6		, m_ctrlScrollV[5]);
+	DDX_Control(pDX, IDC_SCROLLBAR_V_7		, m_ctrlScrollV[6]);
+	DDX_Control(pDX, IDC_SCROLLBAR_V_8		, m_ctrlScrollV[7]);
+
+	DDX_Control(pDX, IDC_SCROLLBAR_H_1		, m_ctrlScrollH[0]);
+	DDX_Control(pDX, IDC_SCROLLBAR_H_2		, m_ctrlScrollH[1]);
+	DDX_Control(pDX, IDC_SCROLLBAR_H_3		, m_ctrlScrollH[2]);
+	DDX_Control(pDX, IDC_SCROLLBAR_H_4		, m_ctrlScrollH[3]);
+	DDX_Control(pDX, IDC_SCROLLBAR_H_5		, m_ctrlScrollH[4]);
+	DDX_Control(pDX, IDC_SCROLLBAR_H_6		, m_ctrlScrollH[5]);
+	DDX_Control(pDX, IDC_SCROLLBAR_H_7		, m_ctrlScrollH[6]);
+	DDX_Control(pDX, IDC_SCROLLBAR_H_8		, m_ctrlScrollH[7]);
+
+
+	DDX_Control(pDX, IDC_BTN_LOAD1			, m_btnLoad[0]);
+	DDX_Control(pDX, IDC_BTN_LOAD2			, m_btnLoad[1]);
+	DDX_Control(pDX, IDC_BTN_LOAD3			, m_btnLoad[2]);
+	DDX_Control(pDX, IDC_BTN_LOAD4			, m_btnLoad[3]);
+
+	DDX_Control(pDX, IDC_BTN_LOAD5			, m_btnLoad[4]);
+	DDX_Control(pDX, IDC_BTN_LOAD6			, m_btnLoad[5]);
+	DDX_Control(pDX, IDC_BTN_LOAD7			, m_btnLoad[6]);
+	DDX_Control(pDX, IDC_BTN_LOAD8			, m_btnLoad[7]);
+
+
+
+	DDX_Control(pDX, IDC_BTN_SAVE1			, m_btnSave[0]);
+	DDX_Control(pDX, IDC_BTN_SAVE2			, m_btnSave[1]);
+	DDX_Control(pDX, IDC_BTN_SAVE3			, m_btnSave[2]);
+	DDX_Control(pDX, IDC_BTN_SAVE4			, m_btnSave[3]);
+
+	DDX_Control(pDX, IDC_BTN_SAVE5			, m_btnSave[4]);
+	DDX_Control(pDX, IDC_BTN_SAVE6			, m_btnSave[5]);
+	DDX_Control(pDX, IDC_BTN_SAVE7			, m_btnSave[6]);
+	DDX_Control(pDX, IDC_BTN_SAVE8			, m_btnSave[7]);
+
+
+
+	DDX_Control(pDX, IDC_UPDN_WIDTH1		, m_chkWithScorll[0]);
+	DDX_Control(pDX, IDC_UPDN_WIDTH2		, m_chkWithScorll[1]);
+	DDX_Control(pDX, IDC_UPDN_WIDTH3		, m_chkWithScorll[2]);
+	DDX_Control(pDX, IDC_UPDN_WIDTH4		, m_chkWithScorll[3]);
+
+	DDX_Control(pDX, IDC_UPDN_WIDTH5		, m_chkWithScorll[4]);
+	DDX_Control(pDX, IDC_UPDN_WIDTH6		, m_chkWithScorll[5]);
+	DDX_Control(pDX, IDC_UPDN_WIDTH7		, m_chkWithScorll[6]);
+	DDX_Control(pDX, IDC_UPDN_WIDTH8		, m_chkWithScorll[7]);
+
+
+	DDX_Control(pDX, IDC_STATIC_CAM_INFO1	, m_staticCamInfo[0]);
+	DDX_Control(pDX, IDC_STATIC_CAM_INFO2	, m_staticCamInfo[1]);
+	DDX_Control(pDX, IDC_STATIC_CAM_INFO3	, m_staticCamInfo[2]);
+	DDX_Control(pDX, IDC_STATIC_CAM_INFO4	, m_staticCamInfo[3]);
+
+	DDX_Control(pDX, IDC_STATIC_CAM_INFO5	, m_staticCamInfo[4]);
+	DDX_Control(pDX, IDC_STATIC_CAM_INFO6	, m_staticCamInfo[5]);
+	DDX_Control(pDX, IDC_STATIC_CAM_INFO7	, m_staticCamInfo[6]);
+	DDX_Control(pDX, IDC_STATIC_CAM_INFO8	, m_staticCamInfo[7]);
+
+	DDX_Control(pDX, IDC_SLIDER_ZOOM, m_sliderZoom);
+
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewScanImage, CDialogEx)
+	ON_WM_VSCROLL()
+	ON_WM_HSCROLL()
+	
+	ON_BN_CLICKED(IDC_BTN_LOAD1, &CViewScanImage::OnBnClickedBtnLoad1)
+	ON_BN_CLICKED(IDC_BTN_SAVE1, &CViewScanImage::OnBnClickedBtnSave1)
+	ON_BN_CLICKED(IDC_BTN_LOAD2, &CViewScanImage::OnBnClickedBtnLoad2)
+	ON_BN_CLICKED(IDC_BTN_SAVE2, &CViewScanImage::OnBnClickedBtnSave2)
+	ON_BN_CLICKED(IDC_BTN_LOAD3, &CViewScanImage::OnBnClickedBtnLoad3)
+	ON_BN_CLICKED(IDC_BTN_SAVE3, &CViewScanImage::OnBnClickedBtnSave3)
+	ON_BN_CLICKED(IDC_BTN_LOAD4, &CViewScanImage::OnBnClickedBtnLoad4)
+	ON_BN_CLICKED(IDC_BTN_SAVE4, &CViewScanImage::OnBnClickedBtnSave4)
+	ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_ZOOM, &CViewScanImage::OnNMCustomdrawSliderZoom)
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_ZOOM, &CViewScanImage::OnNMReleasedcaptureSliderZoom)
+	ON_WM_MOUSEWHEEL()
+	ON_BN_CLICKED(IDC_UPDN_WIDTH1,		&CViewScanImage::OnBnClickedUpdnWidth1)
+ 	
+	ON_BN_CLICKED(IDC_UPDN_WIDTH2,		&CViewScanImage::OnBnClickedUpdnWidth2)
+	ON_BN_CLICKED(IDC_UPDN_WIDTH3,		&CViewScanImage::OnBnClickedUpdnWidth3)
+	ON_BN_CLICKED(IDC_UPDN_WIDTH4,		&CViewScanImage::OnBnClickedUpdnWidth4)
+	ON_BN_CLICKED(IDC_UPDN_WIDTH6,		&CViewScanImage::OnBnClickedUpdnWidth6)
+	ON_BN_CLICKED(IDC_UPDN_WIDTH5,		&CViewScanImage::OnBnClickedUpdnWidth5)
+	ON_BN_CLICKED(IDC_UPDN_WIDTH7,		&CViewScanImage::OnBnClickedUpdnWidth7)
+	ON_BN_CLICKED(IDC_UPDN_WIDTH8,		&CViewScanImage::OnBnClickedUpdnWidth8)
+	ON_BN_CLICKED(IDC_BTN_LOAD5,		&CViewScanImage::OnBnClickedBtnLoad5)
+	ON_BN_CLICKED(IDC_BTN_SAVE5,		&CViewScanImage::OnBnClickedBtnSave5)
+	ON_BN_CLICKED(IDC_BTN_LOAD6,		&CViewScanImage::OnBnClickedBtnLoad6)
+	ON_BN_CLICKED(IDC_BTN_SAVE6,		&CViewScanImage::OnBnClickedBtnSave6)
+	ON_BN_CLICKED(IDC_BTN_LOAD7,		&CViewScanImage::OnBnClickedBtnLoad7)
+	ON_BN_CLICKED(IDC_BTN_SAVE7,		&CViewScanImage::OnBnClickedBtnSave7)
+	ON_BN_CLICKED(IDC_BTN_LOAD8,		&CViewScanImage::OnBnClickedBtnLoad8)
+	ON_BN_CLICKED(IDC_BTN_SAVE8,		&CViewScanImage::OnBnClickedBtnSave8)		
+	ON_BN_CLICKED(IDC_CHECK_AUTO_SIZE, &CViewScanImage::OnBnClickedCheckAutoSize)
+	ON_WM_SHOWWINDOW()
+	ON_WM_TIMER()
+	ON_WM_PAINT()
+ 	ON_MESSAGE(WM_POCESS_STATUS		, OnProcessStatus) 	
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewScanImage, CDialogEx)
+	ON_EVENT(CViewScanImage, IDC_BTN_IMG_SHORT, DISPID_CLICK, CViewScanImage::OnBnClickedBtnImgShort, VTS_NONE)
+	ON_EVENT(CViewScanImage, IDC_BTN_IMG_LONG, DISPID_CLICK, CViewScanImage::OnBnClickedBtnImgLong, VTS_NONE)
+	ON_EVENT(CViewScanImage, IDC_BTN_IMG_BOTH, DISPID_CLICK, CViewScanImage::OnBnClickedBtnImgBoth, VTS_NONE)
+	ON_EVENT(CViewScanImage, IDC_BTN_INIT_DISPLAY, DISPID_CLICK, CViewScanImage::OnBnClickedBtnInitDisplay, VTS_NONE)
+	ON_EVENT(CViewScanImage, IDC_BTN_PROC, DISPID_CLICK, CViewScanImage::OnBnClickedBtnProc, VTS_NONE)
+	ON_EVENT(CViewScanImage, IDC_BTN_LOAD_ALL, DISPID_CLICK, CViewScanImage::OnBnClickedLoadAll, VTS_NONE)
+	ON_EVENT(CViewScanImage, IDC_SAVE_ALL, DISPID_CLICK, CViewScanImage::OnBnClickedSaveAll, VTS_NONE)
+END_EVENTSINK_MAP()
+
+
+// CViewScanImage 皋矫瘤 贸府扁涝聪促.
+BOOL CViewScanImage::OnInitDialog()
+{
+	UpdateData(FALSE);
+
+	m_sliderZoom.SetRange(0,8);
+	m_sliderZoom.SetPos(0);
+
+	int i;
+	for( i = 0; i < MAX_PANEL_SIDE  * UPDN_TYPE;i++)
+	{
+		m_btnLoad[i].m_bTransparent = TRUE;
+		m_btnSave[i].m_bTransparent = TRUE;
+
+
+		m_btnLoad[i].SetImage(IDB_BTN_LOAD, IDB_BTN_LOAD_PUSH);
+		m_btnSave[i].SetImage(IDB_BTN_SAVE, IDB_BTN_SAVE_PUSH);
+		m_chkWithScorll[i].SetImage(IDB_LED_OFF);
+		m_chkWithScorll[i].SetCheckedImage(IDB_LED_ON);
+		m_bWithScroll[i] = 1;
+	}
+
+	int nSide;
+	CRect rc2(0,0,10,10);
+	for(i = 0 ; i < MAX_PANEL_SIDE * UPDN_TYPE; i++)
+	{
+		nSide = GetSideIdx(i);
+		//C,CB A, AB,  D,DB , B,BB 
+
+		m_frameImg[i].SetSide(nSide);
+		m_frameImg[i].InitBitMap();
+		m_frameImg[i].SetGlassData(m_pGlassData);
+		m_frameImg[i].Create(NULL,NULL,WS_VISIBLE | WS_CHILD,rc2,this,0);
+		m_frameImg[i].SetImage(GetBufferPoint(i,0));
+	}
+
+	m_bInitDlg = TRUE;
+
+	ChangeCtrPos(3);
+
+	SetZoom(0.2);
+
+	m_nShowSelect = 0;
+
+	return TRUE;
+}
+
+BOOL CViewScanImage::PreTranslateMessage(MSG* pMsg)
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+void CViewScanImage::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		int nSide;		
+		CString		strTitle;
+		for(int i = 0 ; i < MAX_PANEL_SIDE * UPDN_TYPE; i++)
+		{
+			nSide = GetSideIdx(i);
+			m_frameImg[i].SetSide(nSide);			
+			m_frameImg[i].SetGlassData(m_pGlassData);			
+			m_frameImg[i].SetImage(GetBufferPoint(i,0));
+			m_frameImg[i].ViewUpdate();
+
+			if(m_pHardware != NULL)
+			{
+				CCameraSettings *pCamera = NULL;
+				if(i < MAX_PANEL_SIDE)	// Long side
+				{
+					pCamera = m_pHardware->GetCameraSettings(i,0);
+				}
+				else
+				{
+					pCamera = m_pHardware->GetCameraSettings(i%MAX_PANEL_SIDE,1);
+				}
+				
+				pCamera->m_iCamera;
+				pCamera->m_iScan;
+				strTitle.Format(_T("BORD[%d]  CHANNEL[%d]"),pCamera->m_iCamera,pCamera->m_iScan);
+				m_staticCamInfo[i].SetWindowText(strTitle);
+			}			
+		}
+
+		m_bInitDlg = TRUE;
+
+		ChangeCtrPos(m_nShowSelect);		
+
+		SetZoom(0.2);
+	}
+}
+
+void CViewScanImage::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+
+	
+}
+
+void    CViewScanImage::SetZoom(double dZoom)
+{
+	m_dZoom = dZoom;
+	UpdateZoom();
+}
+
+void CViewScanImage::SetGlassData(CGlass_Data* pGlass)
+{
+	m_pGlassData = pGlass;
+}
+
+BYTE* CViewScanImage::GetBufferPoint(int nViewIndex,int nPos /*= 0*/)
+{
+	BYTE *add = NULL;
+	int nIdx_Side	 = GetSideIdx(nViewIndex);
+
+	LPBYTE plpBuf = NULL;
+	if(m_IV2M != NULL)
+		plpBuf = m_IV2M->IV2M_GetGrabBufferByDimension((DimensionDir)nIdx_Side,nPos);
+	
+	return plpBuf;
+}
+
+LRESULT CViewScanImage::OnProcessStatus(WPARAM wParam, LPARAM lParam)
+{
+	PROG_MSG MsgJob = *((PROG_MSG*)wParam);	
+
+	int nIndex = GetViewIndex(MsgJob.nSide);
+	if(MsgJob.nState == 2)
+	{
+		InitScrollInfo(MsgJob.nSide,1);
+
+		m_ctrlScrollV[nIndex].EnableWindow(TRUE);
+
+		double dZoom = m_frameImg[nIndex].GetZoomData();
+
+		m_frameImg[nIndex].m_ptOrg.y = MsgJob.nDispLine;
+
+		if(m_pGlassData != NULL)
+		{
+			INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)MsgJob.nSide);	
+			if(pEdgeInfo != NULL)
+				m_frameImg[nIndex].m_ptOrg.y = CHKMAX(0,pEdgeInfo->nGlassStartLine - (int)((m_frameImg[nIndex].m_WndRect.Height()/2)/ dZoom));								
+		}		
+
+		m_frameImg[nIndex].SetImage( GetBufferPoint(nIndex,m_frameImg[nIndex].m_ptOrg.y));
+		m_frameImg[nIndex].SetGlassData(m_pGlassData);
+		m_frameImg[nIndex].ViewUpdate();
+	}
+	else
+	{
+		if(fabs(m_dZoom - 1.) > 0.01)
+		{
+			m_dZoom = 0.2;		
+			m_sliderZoom.SetPos(0);
+
+			CString strTmp;
+			strTmp.Format(_T("X %.2f"),m_dZoom);
+			GetDlgItem(IDC_ST_ZOOM)->SetWindowText(strTmp);
+
+			UpdateZoom();
+		}
+
+		//g_pLog->DisplayMessage(_T("Frame Display %d"),nIndex);
+
+		m_frameImg[nIndex].m_ptOrg.y = MsgJob.nDispLine;
+		m_frameImg[nIndex].SetImage(GetBufferPoint(nIndex,m_frameImg[nIndex].m_ptOrg.y));
+		m_frameImg[nIndex].SetGlassData(m_pGlassData);
+		m_frameImg[nIndex].ViewUpdate();
+	}
+	return 1;
+}
+
+void CViewScanImage::SetRecipe(CHardwareSettings *pHW)
+{
+	m_pHardware = pHW;
+}
+
+void CViewScanImage::ResetView()
+{
+	for(int i = 0; i <8 ; i++)
+	{
+		m_ctrlScrollV[i].EnableWindow(FALSE);
+	}	
+}
+
+void CViewScanImage::ViewRefresh(PROG_MSG ProcMsg)
+{
+	SendMessage(WM_POCESS_STATUS,(WPARAM)&ProcMsg, ProcMsg.nSide);
+}
+
+int CViewScanImage::GetSideIdx(int nViewIndex)
+{
+	int nID = 0;
+		
+	switch(nViewIndex)
+	{
+	case 0:	nID = DIMENSION_C;					break;
+	case 1: nID = DIMENSION_C + MAX_PANEL_SIDE;	break;
+	case 2: nID = DIMENSION_A;					break;
+	case 3: nID = DIMENSION_A + MAX_PANEL_SIDE;	break;
+	case 4: nID = DIMENSION_D;					break;
+	case 5: nID = DIMENSION_D + MAX_PANEL_SIDE;	break;
+	case 6: nID = DIMENSION_B;					break;
+	case 7: nID = DIMENSION_B + MAX_PANEL_SIDE;	break;
+	default:
+		AfxMessageBox(_T("CViewImage::GetPanelID(int nViewIndex) call Error"));
+		break;
+	}
+	
+	return nID;
+}
+
+void CViewScanImage::ChangeCtrPos(int nMode)
+{
+	m_nShowSelect = nMode;
+
+	int nInfo			= 20;
+	int nHScroll		= 20;
+	int nImgWidth		= 450;
+	int nImgHeight		= 400;
+
+	int i = 0;
+	CPoint OrgPt(10,5),pt;
+	pt = OrgPt;
+
+
+	SetRedraw(FALSE);
+	for(i = 0; i < 8 ; i ++)
+	{
+		m_btnLoad[i].SetRedraw(FALSE);
+		m_btnSave[i].SetRedraw(FALSE);
+		m_staticCamInfo[i].SetRedraw(FALSE);
+		m_ctrlScrollV[i].SetRedraw(FALSE);
+		m_ctrlScrollH[i].SetRedraw(FALSE);
+		m_chkWithScorll[i].SetRedraw(FALSE);
+		m_frameImg[i].SetRedraw(FALSE);
+	}
+
+	switch(nMode)
+	{
+	case 0:
+
+		// Long 
+		pt.x = OrgPt.x;
+		pt.y = OrgPt.y; 
+
+
+		for(i = 0; i < 4; i++)
+		{
+			m_btnLoad[i].MoveWindow(pt.x,pt.y,nInfo,nInfo,FALSE);
+			m_btnSave[i].MoveWindow(pt.x + nImgWidth - nInfo ,pt.y,nInfo,nInfo,FALSE);
+			m_staticCamInfo[i].MoveWindow(pt.x + nInfo ,pt.y,nImgWidth - nInfo *2 ,nInfo,FALSE);
+			m_frameImg[i].MoveWindow(pt.x,pt.y + nInfo,nImgWidth,nImgHeight,FALSE);	
+			m_frameImg[i].ChangeRect();
+
+			m_chkWithScorll[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo + nImgHeight,nHScroll,nInfo,FALSE);
+			m_ctrlScrollV[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo,nHScroll,nImgHeight,FALSE);
+			m_ctrlScrollH[i].MoveWindow(pt.x,pt.y + nInfo + nImgHeight,nImgWidth,nInfo,FALSE);
+			pt.x += nImgWidth + nHScroll;
+		}
+
+		// Short
+		pt.x = OrgPt.x;
+		pt.y = OrgPt.y + nImgHeight + nInfo + nHScroll + 10; 
+		for(i = 4; i < 8; i++)
+		{
+			m_btnLoad[i].MoveWindow(pt.x,pt.y,nInfo,nInfo,FALSE);
+			m_btnSave[i].MoveWindow(pt.x + nImgWidth - nInfo ,pt.y,nInfo,nInfo,FALSE);
+			m_staticCamInfo[i].MoveWindow(pt.x + nInfo ,pt.y,nImgWidth - nInfo *2 ,nInfo,FALSE);
+			m_frameImg[i].MoveWindow(pt.x,pt.y + nInfo,nImgWidth,nImgHeight,FALSE);	
+			m_frameImg[i].ChangeRect();
+
+			m_chkWithScorll[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo + nImgHeight,nHScroll,nInfo,FALSE);
+			m_ctrlScrollV[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo,nHScroll,nImgHeight,FALSE);
+			m_ctrlScrollH[i].MoveWindow(pt.x,pt.y + nInfo + nImgHeight,nImgWidth,nInfo,FALSE);
+			pt.x += nImgWidth + nHScroll;
+		}
+		break;
+
+	case 1: // long
+		pt.x = OrgPt.x;
+		pt.y = OrgPt.y;
+
+		nImgHeight = 850;
+		for(i = 0; i < 4; i++)
+		{
+			m_btnLoad[i].MoveWindow(pt.x,pt.y,nInfo,nInfo,FALSE);
+			m_btnSave[i].MoveWindow(pt.x + nImgWidth - nInfo ,pt.y,nInfo,nInfo,FALSE);
+			m_staticCamInfo[i].MoveWindow(pt.x + nInfo ,pt.y,nImgWidth - nInfo *2 ,nInfo,FALSE);
+			m_frameImg[i].MoveWindow(pt.x,pt.y + nInfo,nImgWidth,nImgHeight);	
+			m_frameImg[i].ChangeRect();
+			m_chkWithScorll[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo + nImgHeight,nHScroll,nInfo,FALSE);
+			m_ctrlScrollV[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo,nHScroll,nImgHeight,FALSE);
+			m_ctrlScrollH[i].MoveWindow(pt.x,pt.y + nInfo + nImgHeight,nImgWidth,nInfo,FALSE);
+			pt.x += nImgWidth + nHScroll;
+		}
+		break;
+
+
+	case 2:// Short
+		pt.x = OrgPt.x;
+		pt.y = OrgPt.y;
+		nImgHeight = 850;
+		for(i = 4; i < 8; i++)
+		{
+			m_btnLoad[i].MoveWindow(pt.x,pt.y,nInfo,nInfo,FALSE);
+			m_btnSave[i].MoveWindow(pt.x + nImgWidth - nInfo ,pt.y,nInfo,nInfo,FALSE);
+			m_staticCamInfo[i].MoveWindow(pt.x + nInfo ,pt.y,nImgWidth - nInfo *2 ,nInfo,FALSE);
+			m_frameImg[i].MoveWindow(pt.x,pt.y + nInfo,nImgWidth,nImgHeight,FALSE);	
+			m_frameImg[i].ChangeRect();
+			m_chkWithScorll[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo + nImgHeight,nHScroll,nInfo,FALSE);
+			m_ctrlScrollV[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo,nHScroll,nImgHeight,FALSE);
+			m_ctrlScrollH[i].MoveWindow(pt.x,pt.y + nInfo + nImgHeight,nImgWidth,nInfo,FALSE);
+			pt.x += nImgWidth + nHScroll;
+		}
+		break;
+	case 3:
+
+		// Long 
+		pt.x = OrgPt.x;
+		pt.y = OrgPt.y; 
+
+
+		for(i = 0; i < 4; i++)
+		{
+			m_btnLoad[i].MoveWindow(pt.x,pt.y,nInfo,nInfo,FALSE);
+			m_btnSave[i].MoveWindow(pt.x + nImgWidth - nInfo ,pt.y,nInfo,nInfo,FALSE);
+			m_staticCamInfo[i].MoveWindow(pt.x + nInfo ,pt.y,nImgWidth - nInfo *2 ,nInfo,FALSE);
+			m_frameImg[i].MoveWindow(pt.x,pt.y + nInfo,nImgWidth,nImgHeight,FALSE);	
+			m_frameImg[i].ChangeRect();
+
+			m_chkWithScorll[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo + nImgHeight,nHScroll,nInfo,FALSE);
+			m_ctrlScrollV[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo,nHScroll,nImgHeight,FALSE);
+			m_ctrlScrollH[i].MoveWindow(pt.x,pt.y + nInfo + nImgHeight,nImgWidth,nInfo,FALSE);
+			pt.x += nImgWidth + nHScroll;
+		}
+
+
+		// Short
+		pt.x = OrgPt.x;
+		pt.y = OrgPt.y + nImgHeight + nInfo + nHScroll + 10; 
+		for(i = 4; i < 8; i++)
+		{
+			m_btnLoad[i].MoveWindow(pt.x,pt.y,nInfo,nInfo,FALSE);
+			m_btnSave[i].MoveWindow(pt.x + nImgWidth - nInfo ,pt.y,nInfo,nInfo,FALSE);
+			m_staticCamInfo[i].MoveWindow(pt.x + nInfo ,pt.y,nImgWidth - nInfo *2 ,nInfo,FALSE);
+			m_frameImg[i].MoveWindow(pt.x,pt.y + nInfo,nImgWidth,nImgHeight,FALSE);	
+			m_frameImg[i].ChangeRect();
+
+			m_chkWithScorll[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo + nImgHeight,nHScroll,nInfo,FALSE);
+			m_ctrlScrollV[i].MoveWindow(pt.x + nImgWidth,pt.y + nInfo,nHScroll,nImgHeight,FALSE);
+			m_ctrlScrollH[i].MoveWindow(pt.x,pt.y + nInfo + nImgHeight,nImgWidth,nInfo,FALSE);
+			pt.x += nImgWidth + nHScroll;
+		}
+		break;
+	}
+
+	switch(nMode)
+	{
+	case 0:
+		for(i = 0; i < 8; i++)
+		{
+			m_btnLoad[i].ShowWindow(SW_SHOW);
+			m_btnSave[i].ShowWindow(SW_SHOW);
+			m_staticCamInfo[i].ShowWindow(SW_SHOW);
+			m_ctrlScrollV[i].ShowWindow(SW_SHOW);
+			m_ctrlScrollH[i].ShowWindow(SW_SHOW);
+			m_chkWithScorll[i].ShowWindow(SW_SHOW);
+			m_frameImg[i].ShowWindow(SW_SHOW);	
+		}
+		break;
+
+	case 1:
+		for(i = 4; i < 8; i++)
+		{
+			m_btnLoad[i].ShowWindow(SW_HIDE);
+			m_btnSave[i].ShowWindow(SW_HIDE);
+			m_staticCamInfo[i].ShowWindow(SW_HIDE);
+			m_ctrlScrollV[i].ShowWindow(SW_HIDE);
+			m_ctrlScrollH[i].ShowWindow(SW_HIDE);
+			m_chkWithScorll[i].ShowWindow(SW_HIDE);
+			m_frameImg[i].ShowWindow(SW_HIDE);	
+		}
+
+		for(i = 0; i < 4; i++)
+		{
+			m_btnLoad[i].ShowWindow(SW_SHOW);
+			m_btnSave[i].ShowWindow(SW_SHOW);
+			m_staticCamInfo[i].ShowWindow(SW_SHOW);
+			m_ctrlScrollV[i].ShowWindow(SW_SHOW);
+			m_ctrlScrollH[i].ShowWindow(SW_SHOW);
+			m_chkWithScorll[i].ShowWindow(SW_SHOW);
+			m_frameImg[i].ShowWindow(SW_SHOW);	
+		}
+		break;
+
+	case 2:
+		for(i = 0; i < 4; i++)
+		{
+			m_btnLoad[i].ShowWindow(SW_HIDE);
+			m_btnSave[i].ShowWindow(SW_HIDE);
+			m_staticCamInfo[i].ShowWindow(SW_HIDE);
+			m_ctrlScrollV[i].ShowWindow(SW_HIDE);
+			m_ctrlScrollH[i].ShowWindow(SW_HIDE);
+			m_chkWithScorll[i].ShowWindow(SW_HIDE);
+			m_frameImg[i].ShowWindow(SW_HIDE);	
+		}
+
+		for(i = 4; i < 8; i++)
+		{
+			m_btnLoad[i].ShowWindow(SW_SHOW);
+			m_btnSave[i].ShowWindow(SW_SHOW);
+			m_staticCamInfo[i].ShowWindow(SW_SHOW);
+			m_ctrlScrollV[i].ShowWindow(SW_SHOW);
+			m_ctrlScrollH[i].ShowWindow(SW_SHOW);
+			m_chkWithScorll[i].ShowWindow(SW_SHOW);
+			m_frameImg[i].ShowWindow(SW_SHOW);	
+		}
+		break;
+	case 3:
+		for(i = 0; i < 8; i++)
+		{
+			m_btnLoad[i].ShowWindow(SW_HIDE);
+			m_btnSave[i].ShowWindow(SW_HIDE);
+			m_staticCamInfo[i].ShowWindow(SW_HIDE);
+			m_ctrlScrollV[i].ShowWindow(SW_HIDE);
+			m_ctrlScrollH[i].ShowWindow(SW_HIDE);
+			m_chkWithScorll[i].ShowWindow(SW_HIDE);
+			m_frameImg[i].ShowWindow(SW_HIDE);	
+		}
+		break;
+	}
+	//InitScrollInfo(-1,1);
+	SetRedraw(TRUE);
+	Invalidate(TRUE);
+}
+
+void CViewScanImage::InitScrollInfo(int nSide /*= -1*/,int nScrollPos /*= 0*/)
+{
+	int i =0;
+	SCROLLINFO scrollInfoV;
+	SCROLLINFO scrollInfoH;
+
+	int nPos_V;
+	int nPos_H;
+
+	scrollInfoV.cbSize		 = sizeof(SCROLLINFO);
+	scrollInfoV.fMask		 = SIF_ALL;
+	scrollInfoV.nMin		 = 1;
+	scrollInfoV.nPos		 = 1;
+	scrollInfoV.nTrackPos	 = 400;
+	scrollInfoV.nMax = INT_MAX;
+
+
+	scrollInfoH.cbSize		= sizeof(SCROLLINFO);
+	scrollInfoH.fMask		= SIF_ALL;
+	scrollInfoH.nMin		= 1;
+	scrollInfoH.nPos		= 1;
+	scrollInfoH.nTrackPos	= 64;
+	
+	double dZoom = m_frameImg[0].GetZoomData();
+
+
+	scrollInfoV.nPage	= m_frameImg[0].m_WndRect.Height();
+	scrollInfoH.nPage	= (int)(m_frameImg[0].m_WndRect.Width() / dZoom);	
+	scrollInfoH.nMax	= IMAGE_WIDTH;
+	
+	INS_EDGE_RESULT_INFO *pResInfo = NULL;
+	if(nSide == -1)
+	{
+		for(i = 0 ; i < MAX_PANEL_SIDE * UPDN_TYPE; i++)
+		{
+			nSide = GetSideIdx(i);	
+
+			nPos_V = m_ctrlScrollV[i].GetScrollPos();
+			nPos_H = m_ctrlScrollH[i].GetScrollPos();
+
+			if(nScrollPos == 0)
+			{
+				nPos_V = 0;
+				nPos_H = 0;
+			}
+
+			if(m_pGlassData != NULL)
+			{
+				pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)nSide);
+			}
+			
+			if(pResInfo != NULL)
+			{
+				int		nEndLIne = pResInfo->nGlassEndLine;
+				if(nEndLIne <= 0)
+					nEndLIne = pResInfo->nPreGlassEndLine;
+				scrollInfoV.nMax	= nEndLIne - pResInfo->nGlassStartLine + (int)(m_frameImg[i].m_WndRect.Height() * dZoom);
+			}
+			else
+			{
+				if(i%2)
+					scrollInfoV.nMax	= MAX_IMAGE_LINE_LONG - (int)(m_frameImg[i].m_WndRect.Height() / dZoom);
+				else
+					scrollInfoV.nMax	= MAX_IMAGE_LINE_SHORT - (int)(m_frameImg[i].m_WndRect.Height() / dZoom);
+			}
+
+			if(m_pHardware == NULL)
+			{
+				if(i%2)
+					scrollInfoV.nMax	= CHKMIN(MAX_IMAGE_LINE_LONG - (int)(m_frameImg[i].m_WndRect.Height() / dZoom),scrollInfoV.nMax);
+				else
+					scrollInfoV.nMax	= CHKMIN(MAX_IMAGE_LINE_SHORT - (int)(m_frameImg[i].m_WndRect.Height() / dZoom),scrollInfoV.nMax);
+			}
+			else
+			{
+				int iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)nSide);
+				int nMaxLine = g_pBase->m_pMemFrameNo[iCam]*g_pBase->m_pFrameHeight[iCam];
+
+				scrollInfoV.nMax	= CHKMIN(nMaxLine - int(m_frameImg[i].m_WndRect.Height() / dZoom),scrollInfoV.nMax);
+			}
+
+			m_ctrlScrollV[i].SetScrollInfo(&scrollInfoV);
+			m_ctrlScrollV[i].SetScrollPos(nPos_V);
+
+			m_ctrlScrollH[i].SetScrollInfo(&scrollInfoH);
+			m_ctrlScrollH[i].SetScrollPos(nPos_H);
+		}
+	}
+	else
+	{
+		int		iView = GetViewIndex(nSide);		
+
+		if(m_pGlassData != NULL)
+		{
+			pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)nSide);
+		}
+		
+		nPos_V = m_ctrlScrollV[iView].GetScrollPos();
+		nPos_H = m_ctrlScrollH[iView].GetScrollPos();
+
+		if(pResInfo != NULL)
+		{
+			int		nEndLIne = pResInfo->nGlassEndLine;
+			if(nEndLIne <= 0)
+				nEndLIne = pResInfo->nPreGlassEndLine;			
+
+			scrollInfoV.nMax	= nEndLIne - pResInfo->nGlassStartLine + m_frameImg[iView].m_WndRect.Height();
+		}
+
+		if(m_pHardware == NULL)
+		{
+			if(i%2)
+				scrollInfoV.nMax	= CHKMIN(MAX_IMAGE_LINE_LONG - (int)(m_frameImg[iView].m_WndRect.Height() / dZoom),scrollInfoV.nMax);
+			else
+				scrollInfoV.nMax	= CHKMIN(MAX_IMAGE_LINE_SHORT - (int)(m_frameImg[iView].m_WndRect.Height() / dZoom),scrollInfoV.nMax);
+
+		}
+		else
+		{
+			int iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)nSide);
+			int nMaxLine = g_pBase->m_pMemFrameNo[iCam]*g_pBase->m_pFrameHeight[iCam];
+
+			scrollInfoV.nMax	= CHKMIN(nMaxLine - int(m_frameImg[iView].m_WndRect.Height() / dZoom),scrollInfoV.nMax);
+		}
+
+
+		if(nScrollPos == 0)
+		{
+			nPos_V = 0;
+			nPos_H = 0;
+		}
+		
+		scrollInfoV.nPos = nPos_V;
+		m_ctrlScrollV[iView].SetScrollInfo(&scrollInfoV);
+		m_ctrlScrollV[iView].SetScrollPos(nPos_V);
+		
+		scrollInfoH.nPos = nPos_H;
+		m_ctrlScrollH[iView].SetScrollInfo(&scrollInfoH);
+		m_ctrlScrollH[iView].SetScrollPos(nPos_H);
+	}
+
+}
+
+void CViewScanImage::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	int pos;
+	int nScrolIndex = -1;
+	int i,nSide =-1;
+		
+	for(i = 0; i < MAX_PANEL_SIDE * UPDN_TYPE ; i++)
+	{
+		if(pScrollBar->m_hWnd==m_ctrlScrollV[i].m_hWnd)
+		{
+			nScrolIndex = i;
+			break;
+		}
+	}
+
+	if(nScrolIndex != -1)
+	{
+
+		nSide	   = GetSideIdx(nScrolIndex);
+
+		SCROLLINFO si;
+
+		si.fMask=SIF_ALL;
+		m_ctrlScrollV[nScrolIndex].GetScrollInfo(&si,SIF_ALL);
+
+		switch(nSBCode)
+		{
+
+		case SB_LINEUP:
+			si.nPos = si.nPos -1;
+			break;
+		case SB_LINEDOWN:
+			si.nPos = si.nPos +1;
+			break;
+		case SB_PAGEUP:
+			si.nPos-=si.nPage;
+			break;
+		case SB_PAGEDOWN:
+			si.nPos+=si.nPage;
+			break;
+		case SB_THUMBTRACK:
+			si.nPos = si.nTrackPos;
+			break;
+
+		}
+
+		if(si.nPos>(int)(si.nMax-si.nMin -si.nPage+1)) 
+			si.nPos=si.nMax-si.nMin-si.nPage+1;
+
+		if(si.nPos<si.nMin) 
+			si.nPos=si.nMin;
+
+		si.fMask=SIF_POS;
+		pos = si.nPos - 1;
+
+
+		int nOffset = 0;
+		INS_EDGE_RESULT_INFO *pResInfo = NULL;
+
+		if(m_bWithScroll[nScrolIndex] == TRUE) 
+		{
+			if(nScrolIndex%2 == 0)
+			{
+				for(i = nScrolIndex ; i < nScrolIndex +2; i++)
+				{
+					nSide		= GetSideIdx(i);
+					m_ctrlScrollV[i].SetScrollInfo(&si);
+										
+					if(m_pGlassData != NULL)
+					{
+						pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)nSide);
+					}
+					if(pResInfo != NULL)
+					{
+						m_frameImg[i].m_ptOrg.y =  max(0,pos + pResInfo->nGlassStartLine - m_frameImg[i].m_WndRect.Height()/2);
+					}
+					else
+						m_frameImg[i].m_ptOrg.y =  max(0,pos - m_frameImg[i].m_WndRect.Height()/2);
+				
+					m_frameImg[i].SetSide(nSide);
+					m_frameImg[i].SetImage(GetBufferPoint(i,m_frameImg[i].m_ptOrg.y));
+					m_frameImg[i].SetGlassData(m_pGlassData);					
+					m_frameImg[i].ViewUpdate();
+				}
+			}
+			else if(nScrolIndex == 1 || nScrolIndex == 5)
+			{
+				for(i = nScrolIndex -1; i < nScrolIndex +3; i++)
+				{
+					nSide		= GetSideIdx(i);
+					m_ctrlScrollV[i].SetScrollInfo(&si);
+					if(m_pGlassData != NULL)
+					{
+						pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)nSide);
+					}
+					if(pResInfo != NULL)
+					{
+						m_frameImg[i].m_ptOrg.y =  max(0,pos + pResInfo->nGlassStartLine - m_frameImg[i].m_WndRect.Height()/2);
+					}
+					else
+						m_frameImg[i].m_ptOrg.y =  max(0,pos - m_frameImg[i].m_WndRect.Height()/2);
+
+					m_frameImg[i].SetSide(nSide);
+					m_frameImg[i].SetGlassData(m_pGlassData);					
+					m_frameImg[i].SetImage(GetBufferPoint(i,m_frameImg[i].m_ptOrg.y));					
+					m_frameImg[i].ViewUpdate();	
+				}
+			}
+			else
+			{
+				m_ctrlScrollV[nScrolIndex].SetScrollInfo(&si);
+				if(m_pGlassData != NULL)
+				{
+					pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)nSide);
+				}
+				if(pResInfo != NULL)
+				{
+					m_frameImg[nScrolIndex].m_ptOrg.y =  max(0,pos + pResInfo->nGlassStartLine - m_frameImg[i].m_WndRect.Height()/2);
+				}
+				else
+					m_frameImg[nScrolIndex].m_ptOrg.y =  max(0,pos - m_frameImg[nScrolIndex].m_WndRect.Height()/2);
+
+				m_frameImg[nScrolIndex].SetSide(nSide);
+				m_frameImg[nScrolIndex].SetGlassData(m_pGlassData);								
+				m_frameImg[nScrolIndex].SetImage(GetBufferPoint(i,m_frameImg[nScrolIndex].m_ptOrg.y));				
+				m_frameImg[nScrolIndex].ViewUpdate();	
+			}
+		}
+		else
+		{
+			m_ctrlScrollV[nScrolIndex].SetScrollInfo(&si);
+			if(m_pGlassData != NULL)
+			{
+				pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)nSide);
+			}
+			if(pResInfo != NULL)
+			{
+				m_frameImg[nScrolIndex].m_ptOrg.y =  max(0,pos + pResInfo->nGlassStartLine - m_frameImg[i].m_WndRect.Height()/2);
+			}
+			else
+				m_frameImg[nScrolIndex].m_ptOrg.y =  max(0,pos - m_frameImg[nScrolIndex].m_WndRect.Height()/2);
+
+			m_frameImg[nScrolIndex].SetSide(nSide);
+			m_frameImg[nScrolIndex].SetGlassData(m_pGlassData);	
+			m_frameImg[nScrolIndex].SetImage(GetBufferPoint(nScrolIndex,m_frameImg[nScrolIndex].m_ptOrg.y));			
+			m_frameImg[nScrolIndex].ViewUpdate();	
+		}
+	}
+	CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CViewScanImage::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+	// TODO: 咯扁俊 皋矫瘤 贸府扁 内靛甫 眠啊 棺/肚绰 扁夯蔼阑 龋免钦聪促.
+	if(!pScrollBar)
+	{
+		return CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar);
+	}
+
+
+	int nScrolIndex = -1;
+	int nSide		= -1;
+
+	//CString strTemp;
+	//strTemp.Format("%d", (int)nPos);
+	//theApp.SetStatusBarText(strTemp);
+
+
+	int i =0;
+	for(i = 0; i < MAX_PANEL_SIDE * UPDN_TYPE ; i++)
+	{
+		if(pScrollBar->m_hWnd==m_ctrlScrollH[i].m_hWnd)
+		{
+			nScrolIndex = i;
+			break;
+		}
+	}
+
+	if(nScrolIndex != -1)
+	{
+		nSide = GetSideIdx(nScrolIndex);
+
+		SCROLLINFO si;
+		si.fMask=SIF_ALL;
+		m_ctrlScrollH[nScrolIndex].GetScrollInfo(&si,SIF_ALL);
+
+		switch(nSBCode)
+		{
+		case SB_LINEUP:
+			si.nPos--;
+			break;
+		case SB_LINEDOWN:
+			si.nPos++;
+			break;
+		case SB_PAGEUP:
+			si.nPos-=si.nPage;
+			break;
+		case SB_PAGEDOWN:
+			si.nPos+=si.nPage;
+			break;
+		case SB_THUMBTRACK:
+			si.nPos=nPos;
+			break;
+		}
+
+		if(si.nPos>(int)(si.nMax-si.nMin-si.nPage+1)) si.nPos=si.nMax-si.nMin-si.nPage+1;
+		if(si.nPos<si.nMin) si.nPos=si.nMin;
+		si.fMask=SIF_POS;
+		m_ctrlScrollH[nScrolIndex].SetScrollInfo(&si);
+
+
+		m_frameImg[nScrolIndex].m_ptOrg.x = si.nPos;
+		m_frameImg[nScrolIndex].ViewUpdate();
+	}
+
+	CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+int CViewScanImage::GetViewIndex(int nSide)
+{
+	int nID = 0;
+
+	switch(nSide)
+	{
+	case 0:	nID = DIMENSION_C;					break;
+	case 1: nID = DIMENSION_C + MAX_PANEL_SIDE;	break;
+	case 2: nID = DIMENSION_A;					break;
+	case 3: nID = DIMENSION_A + MAX_PANEL_SIDE;	break;
+	case 4: nID = DIMENSION_D;					break;
+	case 5: nID = DIMENSION_D + MAX_PANEL_SIDE;	break;
+	case 6: nID = DIMENSION_B;					break;
+	case 7: nID = DIMENSION_B + MAX_PANEL_SIDE;	break;
+
+	default:
+		AfxMessageBox(_T("CViewImage::GetViewIndex(int nSide) call Error"));
+		break;
+	}
+
+	return nID;
+}
+
+void CViewScanImage::UpdateZoom()
+{
+	for(int i = 0; i < MAX_PANEL_SIDE  * UPDN_TYPE;i++)
+	{
+		m_frameImg[i].SetZommMode(m_dZoom);		
+		InitScrollInfo(-1,1);
+		m_frameImg[i].Invalidate(FALSE);
+	}	
+}
+
+void CViewScanImage::OnBnClickedBtnImgBoth()	{ChangeCtrPos(0);}
+void CViewScanImage::OnBnClickedBtnImgShort()	{ChangeCtrPos(2);}
+void CViewScanImage::OnBnClickedBtnImgLong()	{ChangeCtrPos(1);}
+
+void CViewScanImage::OnBnClickedUpdnWidth1()  {(m_bWithScroll[0] == FALSE) ? m_bWithScroll[0] = TRUE : m_bWithScroll[0] = FALSE;}
+void CViewScanImage::OnBnClickedUpdnWidth2()  {(m_bWithScroll[1] == FALSE) ? m_bWithScroll[1] = TRUE : m_bWithScroll[1] = FALSE;}
+void CViewScanImage::OnBnClickedUpdnWidth3()  {(m_bWithScroll[2] == FALSE) ? m_bWithScroll[2] = TRUE : m_bWithScroll[2] = FALSE;}
+void CViewScanImage::OnBnClickedUpdnWidth4()  {(m_bWithScroll[3] == FALSE) ? m_bWithScroll[3] = TRUE : m_bWithScroll[3] = FALSE;}
+void CViewScanImage::OnBnClickedUpdnWidth6()  {(m_bWithScroll[4] == FALSE) ? m_bWithScroll[4] = TRUE : m_bWithScroll[4] = FALSE;}
+void CViewScanImage::OnBnClickedUpdnWidth5()  {(m_bWithScroll[5] == FALSE) ? m_bWithScroll[5] = TRUE : m_bWithScroll[5] = FALSE;}
+void CViewScanImage::OnBnClickedUpdnWidth7()  {(m_bWithScroll[6] == FALSE) ? m_bWithScroll[6] = TRUE : m_bWithScroll[6] = FALSE;}
+void CViewScanImage::OnBnClickedUpdnWidth8()  {(m_bWithScroll[7] == FALSE) ? m_bWithScroll[7] = TRUE : m_bWithScroll[7] = FALSE;}
+
+
+
+void CViewScanImage::OnBnClickedBtnLoad1() {ManualThreadStart(M_CMD_IMG_LOAD_SIDE,0);	}
+void CViewScanImage::OnBnClickedBtnLoad2() {ManualThreadStart(M_CMD_IMG_LOAD_SIDE,1);	}
+void CViewScanImage::OnBnClickedBtnLoad3() {ManualThreadStart(M_CMD_IMG_LOAD_SIDE,2);	}
+void CViewScanImage::OnBnClickedBtnLoad4() {ManualThreadStart(M_CMD_IMG_LOAD_SIDE,3);	}
+void CViewScanImage::OnBnClickedBtnLoad5() {ManualThreadStart(M_CMD_IMG_LOAD_SIDE,4);	}
+void CViewScanImage::OnBnClickedBtnLoad6() {ManualThreadStart(M_CMD_IMG_LOAD_SIDE,5);	}
+void CViewScanImage::OnBnClickedBtnLoad7() {ManualThreadStart(M_CMD_IMG_LOAD_SIDE,6);	}
+void CViewScanImage::OnBnClickedBtnLoad8() {ManualThreadStart(M_CMD_IMG_LOAD_SIDE,7);	}
+
+
+void CViewScanImage::OnBnClickedBtnSave1() {ManualThreadStart(M_CMD_IMG_SAVE_SIDE,0);	}
+void CViewScanImage::OnBnClickedBtnSave2() {ManualThreadStart(M_CMD_IMG_SAVE_SIDE,1);	}
+void CViewScanImage::OnBnClickedBtnSave3() {ManualThreadStart(M_CMD_IMG_SAVE_SIDE,2);	}
+void CViewScanImage::OnBnClickedBtnSave4() {ManualThreadStart(M_CMD_IMG_SAVE_SIDE,3);	}
+void CViewScanImage::OnBnClickedBtnSave5() {ManualThreadStart(M_CMD_IMG_SAVE_SIDE,4);	}
+void CViewScanImage::OnBnClickedBtnSave6() {ManualThreadStart(M_CMD_IMG_SAVE_SIDE,5);	}
+void CViewScanImage::OnBnClickedBtnSave7() {ManualThreadStart(M_CMD_IMG_SAVE_SIDE,6);	}
+void CViewScanImage::OnBnClickedBtnSave8() {ManualThreadStart(M_CMD_IMG_SAVE_SIDE,7);	}
+
+void CViewScanImage::OnBnClickedLoadAll()  {ManualThreadStart(M_CMD_IMG_LOAD_ALL,-1);}
+void CViewScanImage::OnBnClickedSaveAll()  {ManualThreadStart(M_CMD_IMG_SAVE_ALL,-1);}
+
+BOOL CViewScanImage::ManualThreadStart(int nCmd,int nIndex /*= -1*/)
+{
+	if(m_pManualProcess)
+	{
+		DWORD dwExitCode;
+		dwExitCode=::WaitForSingleObject(m_pManualProcess->m_hThread, 1000); 
+		if((::GetExitCodeThread(m_pManualProcess->m_hThread ,&dwExitCode))&& (dwExitCode == STILL_ACTIVE))
+		{
+			::TerminateThread(m_pManualProcess->m_hThread, dwExitCode);  
+
+			m_pManualProcess = NULL;
+		}
+	}
+	m_nIndex		= nIndex;
+	m_nThreadCmd	= nCmd;
+	m_pManualProcess = AfxBeginThread(ManualProcessAll,this);
+
+	return TRUE;
+}
+
+BOOL CViewScanImage::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+{
+	int nPos = m_sliderZoom.GetPos();
+	if(zDelta > 0)
+		m_sliderZoom.SetPos(nPos+1);
+	else
+		m_sliderZoom.SetPos(nPos-1);
+
+	UpdateZoom();
+	return CDialogEx::OnMouseWheel(nFlags, zDelta, pt);
+}
+
+void CViewScanImage::SaveFullImageAll()
+{
+	if(m_pGlassData == NULL || m_IV2M == NULL)
+		return;
+
+	int				iView;
+	CPoint			ptStart;
+	int				nLength;
+	const int		nOneFrameSize = 50000;
+	CString			strPath,strLog;
+	int				iSide;
+	int				nTotalLength = 0;
+	int				nFrame = 0;
+	INS_EDGE_RESULT_INFO *pResInfo=NULL;
+	CGlassRecipe *pGlassRcp = m_pGlassData->GetGlassRecipe();
+
+#if OFFLINE_KEY
+	if (nullptr == pGlassRcp) return;
+#endif
+
+	CString			strRcpName = pGlassRcp->GetRecipeName();
+	CString			strGlassID = g_pBase->m_strHPanelID;
+
+	if(strGlassID.IsEmpty() == TRUE)
+	{
+		strGlassID = _T("Manual_ID");
+	}
+	if(strRcpName.IsEmpty() == TRUE)
+	{
+		strRcpName = _T("TestRcp");
+	}
+
+	strGlassID.Trim(_T(' '));
+
+	CTime	time = CTime::GetCurrentTime();
+
+	CString			strDate,strTime;
+
+	strDate.Format(_T("%04d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay());
+	strTime.Format(_T("%02d%02d%02d"),time.GetHour(),time.GetMinute(),time.GetSecond());
+
+	for(iView=0;iView<MAX_DIMENSION_COUNT;iView++)
+	{
+		iSide  = GetSideIdx(iView);		
+
+		int			iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)iSide);
+		int			iScan = m_pHardware->GetScanToDimension((DimensionDir)iSide);
+
+		CCameraSettings *pCamera = m_pHardware->GetCameraSettings(iCam,iScan);
+		if(pCamera == NULL)
+			return;
+
+		nTotalLength = (pCamera->m_nGrabFrameCount-1)*pCamera->m_FrameSize.cy;
+		//nFrame = nTotalLength/nOneFrameSize;
+
+		ptStart.x = 0;
+		ptStart.y =  max(0,0);
+
+		int			nMaxSize = (pCamera->m_nGrabFrameCount-1)*pCamera->m_FrameSize.cy;
+
+		INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)iSide);
+		if(pEdgeInfo != NULL)
+		{
+			ptStart.y = max(0,pEdgeInfo->nGlassStartLine-1000);
+
+			nTotalLength = min((int)((pEdgeInfo->nPreGlassEndLine + 1000) - ptStart.y),nMaxSize);
+		}	
+
+		if(nTotalLength < 10000)
+			nTotalLength = nMaxSize;
+
+		nFrame = nTotalLength/nOneFrameSize;
+		if(ptStart.y < 0)
+			ptStart.y = 0;
+		
+		for(int i = 0; i < nFrame ; i++)
+		{
+			nLength = nOneFrameSize;
+
+			if(ptStart.y+nLength >= nMaxSize)
+				continue;
+
+			strPath.Format(_T("%sDebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],i);
+
+			m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);		
+
+			g_pLog->DisplayMessage(_T("%s %d Save Completed : %s"),PANEL_SIDE[iSide],i,strPath);
+
+			ptStart.y += nLength; 
+		}
+
+		nLength = nTotalLength%nOneFrameSize;
+		if(nLength > 10)
+		{		
+			if(ptStart.y+nLength < nMaxSize)
+			{
+				strPath.Format(_T("%sDebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],nFrame);		
+
+				m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);		
+			}			
+		}
+
+		g_pLog->DisplayMessage(_T("%s %d Save Completed : %s"),PANEL_SIDE[iSide],nFrame,strPath);
+	}
+}
+
+void CViewScanImage::SaveFullImage(int nViewIndex)
+{
+	CPoint ptStart;
+	int nLength;
+	const int nOneFrameSize = 50000;
+	CString strPath,strLog;
+	int iSide  = GetSideIdx(nViewIndex);
+	int nTotalLength = 0;
+	int nFrame = 0;
+
+	if(m_pGlassData == NULL || m_IV2M == NULL)
+		return;
+	
+	CGlassRecipe *pGlassRcp = m_pGlassData->GetGlassRecipe();
+	CString		strRcpName = pGlassRcp->GetRecipeName();
+
+	int			iCam = m_pHardware->GetCameraIndexToDimension((DimensionDir)iSide);
+	int			iScan = m_pHardware->GetScanToDimension((DimensionDir)iSide);
+
+	CCameraSettings *pCamera = m_pHardware->GetCameraSettings(iCam,iScan);
+	if(pCamera == NULL)
+		return;
+
+	nTotalLength = pCamera->m_nGrabFrameCount*pCamera->m_FrameSize.cy;
+	nFrame = nTotalLength/nOneFrameSize;
+
+	ptStart.x = 0;
+	ptStart.y =  max(0,0);
+
+	INS_EDGE_RESULT_INFO *pEdgeInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)iSide);
+	if(pEdgeInfo != NULL)
+	{
+		ptStart.y = max(0,pEdgeInfo->nGlassStartLine-1000);
+
+		nTotalLength = min((pEdgeInfo->nGlassEndLine + 1000) - ptStart.y,pCamera->m_nGrabFrameCount*pCamera->m_FrameSize.cy);
+	}	
+	
+	CString			strGlassID = g_pBase->m_strHPanelID;
+	if(strGlassID.IsEmpty() == TRUE)
+	{
+		strGlassID = _T("Manual_ID");
+	}
+
+	if(strRcpName.IsEmpty() == TRUE)
+	{
+		strRcpName = _T("TestRcp");
+	}
+
+	strGlassID.Trim(_T(' '));
+
+	CTime	time = CTime::GetCurrentTime();
+
+	CString			strDate,strTime;
+
+	strDate.Format(_T("%04d%02d%02d"),time.GetYear(),time.GetMonth(),time.GetDay());
+	strTime.Format(_T("%02d%02d%02d"),time.GetHour(),time.GetMinute(),time.GetSecond());
+
+	for(int i = 0; i < nFrame ; i++)
+	{
+		nLength = nOneFrameSize;
+	
+		strPath.Format(_T("%sDebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],i);
+
+		m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);		
+		ptStart.y += nLength; 
+
+		g_pLog->DisplayMessage(_T("%s %d Save Completed : %s"),PANEL_SIDE[iSide],i,strPath);
+	}
+
+	
+	nLength = nTotalLength%nOneFrameSize;
+	if(nLength)
+	{		
+		strPath.Format(_T("%sDebugFullImage\\%s\\%s\\%s\\%s\\%s__%s_%d"),PATH_INSPECTION_DATA,strDate,strRcpName,strGlassID,strTime,strGlassID,PANEL_SIDE[iSide],nFrame);		
+
+		m_IV2M->IV2M_SaveFullImage(strPath,iSide,ptStart,nLength);		
+
+		g_pLog->DisplayMessage(_T("%s %d Save Completed : %s"),PANEL_SIDE[iSide],nFrame,strPath);
+	}
+
+
+}
+
+UINT CViewScanImage::ManualProcessAll(LPVOID pParam)
+{
+	CViewScanImage *pDlg = (CViewScanImage*)pParam;
+	int i =0;
+	if(pDlg->m_nThreadCmd == M_CMD_PROC_ALL_START 
+		|| pDlg->m_nThreadCmd == M_CMD_PROC_SHORT_START
+		|| pDlg->m_nThreadCmd == M_CMD_PROC_LONG_START)
+	{
+		pDlg->m_IV2M->IV2M_InspectionProcessAll(pDlg->m_nThreadCmd);
+	}
+	else if(pDlg->m_nThreadCmd == M_CMD_IMG_LOAD_ALL)
+	{
+		if(pDlg->m_IV2M == NULL)
+			return 0;
+
+		pDlg->m_IV2M->IV2M_LoadImageFullFile(-1,pDlg->m_pGlassData, [&] (BYTE iSide)
+		{
+			int			iView = pDlg->GetViewIndex(iSide);		
+
+			pDlg->InitScrollInfo(iSide,0);
+			pDlg->m_frameImg[iView].Invalidate(FALSE);
+			pDlg->m_frameImg[iView].Invalidate();
+		});
+	}
+	else if(pDlg->m_nThreadCmd == M_CMD_IMG_SAVE_ALL)
+	{
+		pDlg->SaveFullImageAll();		
+	}
+	else if(pDlg->m_nThreadCmd == M_CMD_IMG_LOAD_SIDE)
+	{
+		pDlg->m_IV2M->IV2M_LoadImageFullFile(pDlg->GetSideIdx(pDlg->m_nIndex),pDlg->m_pGlassData, [&] (BYTE iSide)
+		{
+			int			iView = pDlg->GetViewIndex(iSide);		
+
+			pDlg->InitScrollInfo(iSide,0);
+			pDlg->m_frameImg[iView].Invalidate(FALSE);
+			pDlg->m_frameImg[iView].Invalidate();
+		});
+	}
+	else if(pDlg->m_nThreadCmd == M_CMD_IMG_SAVE_SIDE)
+	{
+		pDlg->SaveFullImage(pDlg->m_nIndex);
+	}
+	else;
+
+	return 0;
+}
+
+void CViewScanImage::OnTimer(UINT_PTR nIDEvent)
+{
+#if FALSE
+	if(nIDEvent == 1)
+	{
+		
+	}
+#endif
+	CDialogEx::OnTimer(nIDEvent);
+}
+
+void CViewScanImage::OnNMCustomdrawSliderZoom(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+	// TODO: Add your control notification handler code here
+
+	CString strTmp;
+	int nPos = m_sliderZoom.GetPos();
+
+
+	if(nPos > 4)
+		m_dZoom = 1 +  (nPos - 4)  * 0.25;
+	//	m_dZoom = 1 +  (nPos - 4)  * 0.2;
+	else if(nPos < 4)
+		m_dZoom = 1 /double(5-nPos);
+	else
+		m_dZoom = 1;
+
+
+	strTmp.Format(_T("X %.2f"),m_dZoom);
+	GetDlgItem(IDC_ST_ZOOM)->SetWindowText(strTmp);
+	*pResult = 0;
+}
+
+void CViewScanImage::OnNMReleasedcaptureSliderZoom(NMHDR *pNMHDR, LRESULT *pResult)
+{
+	UpdateZoom();
+	*pResult = 0;
+}
+
+void CViewScanImage::OnBnClickedBtnInitDisplay()
+{
+	for(int i = 0; i <8 ; i++)
+	{
+		InitScrollInfo(i,0);		
+
+		int nSide	 = GetSideIdx(i);
+
+		m_frameImg[i].SetSide(nSide);
+		m_frameImg[i].SetImage(GetBufferPoint(i,0));
+		m_frameImg[i].ViewUpdate();
+	}	
+
+	if(m_IV2M != NULL)
+	{
+		m_IV2M->IV2M_InitView(VIEW_SCANIMAGE);
+	}
+}
+
+void CViewScanImage::OnBnClickedBtnProc()
+{
+	switch(m_nShowSelect)
+	{
+	case 0: 
+		ManualThreadStart(M_CMD_PROC_ALL_START	);
+		break;
+
+	case 1: 
+		ManualThreadStart(M_CMD_PROC_LONG_START	); 	
+		break;
+
+	case 2:
+		ManualThreadStart(M_CMD_PROC_SHORT_START);  
+		break;
+	}
+}
+
+void CViewScanImage::OnBnClickedCheckAutoSize()
+{	
+
+	BOOL bCheck = ((CButton*)GetDlgItem(IDC_CHECK_AUTO_SIZE))->GetCheck();
+
+	for(int i = 0 ; i < 8 ; i++)
+	{
+		if(bCheck)
+			m_frameImg[i].SetMode(MODE_AUTO_MEASURE); 
+		else
+			m_frameImg[i].ResetMode(MODE_AUTO_MEASURE); 
+	}
+}
\ No newline at end of file
diff --git a/ENRIT/View/ViewScanImage.h b/ENRIT/View/ViewScanImage.h
new file mode 100644
index 0000000..04431cd
--- /dev/null
+++ b/ENRIT/View/ViewScanImage.h
@@ -0,0 +1,114 @@
+#pragma once
+
+#include "FrameImg.h"
+#include "afxcmn.h"
+// CViewScanImage 措拳 惑磊涝聪促.
+
+class CHardwareSettings;
+class CGlass_Data;
+class CViewScanImage : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewScanImage)
+
+public:
+	CViewScanImage(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewScanImage();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_SCANIMAGE_VIEW };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	afx_msg void OnPaint();		
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnBnClickedBtnLoad1();
+	afx_msg void OnBnClickedBtnSave1();
+	afx_msg void OnBnClickedBtnLoad2();
+	afx_msg void OnBnClickedBtnSave2();
+	afx_msg void OnBnClickedBtnLoad3();
+	afx_msg void OnBnClickedBtnSave3();
+	afx_msg void OnBnClickedBtnLoad4();
+	afx_msg void OnBnClickedBtnSave4();
+	afx_msg void OnNMCustomdrawSliderZoom(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg void OnNMReleasedcaptureSliderZoom(NMHDR *pNMHDR, LRESULT *pResult);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	afx_msg void OnBnClickedUpdnWidth1();	
+	afx_msg void OnBnClickedUpdnWidth2();
+	afx_msg void OnBnClickedUpdnWidth3();
+	afx_msg void OnBnClickedUpdnWidth4();
+	afx_msg void OnBnClickedUpdnWidth6();
+	afx_msg void OnBnClickedUpdnWidth5();
+	afx_msg void OnBnClickedUpdnWidth7();
+	afx_msg void OnBnClickedUpdnWidth8();		
+	afx_msg void OnBnClickedBtnLoad5();
+	afx_msg void OnBnClickedBtnSave5();
+	afx_msg void OnBnClickedBtnLoad6();
+	afx_msg void OnBnClickedBtnSave6();
+	afx_msg void OnBnClickedBtnLoad7();
+	afx_msg void OnBnClickedBtnSave7();
+	afx_msg void OnBnClickedBtnLoad8();
+	afx_msg void OnBnClickedBtnSave8();
+	afx_msg void OnBnClickedButton1();
+	afx_msg void OnBnClickedButton2();	
+	afx_msg void OnBnClickedCheckAutoSize();
+	afx_msg void OnBnClickedBtnCommunication();
+	afx_msg void OnBnClickedCheckAutoView();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	LRESULT OnProcessStatus(WPARAM wParam, LPARAM lParam);
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+public:
+	void			SetRecipe(CHardwareSettings *pHW);
+	void			SetV2M(IViewInterface2Parent* pV2M){m_IV2M=pV2M;}
+	void			SetGlassData(CGlass_Data *pGlass);
+	void			ResetView();
+	void			ViewRefresh(PROG_MSG ProcMsg);	
+
+protected:
+	void			OnBnClickedBtnImgShort();
+	void			OnBnClickedBtnImgLong();
+	void			OnBnClickedBtnImgBoth();
+	void			OnBnClickedBtnInitDisplay();
+	void			OnBnClickedBtnProc();
+	void			OnBnClickedLoadAll();
+	void			OnBnClickedSaveAll();
+
+protected:
+	int				GetSideIdx(int nViewIndex);
+	BYTE			*GetBufferPoint(int nViewIndex,int nPos = 0);
+	void			ChangeCtrPos(int nMode);
+	void			InitScrollInfo(int nSide = -1,int nScrollPos = 0);
+	int				GetViewIndex(int nSideIdx);
+	void			SetZoom(double dZoom);
+	void			UpdateZoom();
+	BOOL			ManualThreadStart(int nCmd,int nIndex = -1);			
+	static UINT		ManualProcessAll(LPVOID pParam);
+	void			SaveFullImage(int nViewIndex);
+	void			SaveFullImageAll();	
+
+protected:
+	CMFCButton		m_btnLoad[MAX_PANEL_SIDE * UPDN_TYPE];
+	CMFCButton		m_btnSave[MAX_PANEL_SIDE * UPDN_TYPE];
+	CMFCButton		m_chkWithScorll[MAX_PANEL_SIDE * UPDN_TYPE];
+	CStatic			m_staticCamInfo[MAX_PANEL_SIDE * UPDN_TYPE];
+	CWinThread		*m_pManualProcess;	
+	int				m_nIndex;
+	int				m_nThreadCmd;
+
+	CSliderCtrl		m_sliderZoom;
+	double			m_dZoom;
+
+	CScrollBar		m_ctrlScrollV[MAX_PANEL_SIDE * UPDN_TYPE],m_ctrlScrollH[MAX_PANEL_SIDE * UPDN_TYPE];
+	BOOL			m_bWithScroll[MAX_PANEL_SIDE * UPDN_TYPE];
+	CFrameImg		m_frameImg[MAX_PANEL_SIDE * UPDN_TYPE];
+	int				m_nShowSelect;
+	BOOL			m_bInitDlg;
+	CHardwareSettings		*m_pHardware;
+	IViewInterface2Parent	*m_IV2M;
+	CGlass_Data				*m_pGlassData;	
+};
diff --git a/ENRIT/View/ViewSettingNotch.cpp b/ENRIT/View/ViewSettingNotch.cpp
new file mode 100644
index 0000000..0dd4359
--- /dev/null
+++ b/ENRIT/View/ViewSettingNotch.cpp
@@ -0,0 +1,1485 @@
+// D:\RCut_Project_130206\RecipeEditor\Dialog\DlgSettingNotch.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ViewSettingNotch.h"
+
+const int NOTCH_GRID_COLUMN_COUNT = 5;//20140528
+const char* NOTCH_GRID_COLUMN_ITEM[NOTCH_GRID_COLUMN_COUNT] = {"No","X Pos(um)","Y Pos(um)","X Pos(Pixel)","Y Pos(Pixel)"};//20140528
+const int NOTCH_GRID_COLUMN_WIDTH[NOTCH_GRID_COLUMN_COUNT] = {30,62,62,62,62};//20140528
+
+// CViewSettingNotch 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewSettingNotch, CDialog)
+
+CViewSettingNotch::CViewSettingNotch(CWnd* pParent /*=NULL*/)
+: CDialog(CViewSettingNotch::IDD, pParent)
+{
+	m_pHardwareSetting = NULL;
+	m_pGlassRecipe = NULL;
+	m_DlgGlassRecipe.Reset();
+	m_pMainView = NULL;
+	m_pMasterView = NULL;
+	m_nCutListIdx = 0;
+	m_index = 0;
+	m_nNotchCadCenterX = 0;//20140528
+	m_nNotchCadCenterY = 0;//20140528
+	m_nAlignMark2CadCenter = 0;//20140528
+}
+
+CViewSettingNotch::~CViewSettingNotch()
+{
+	if(m_pMainView != NULL)	
+	{		
+		m_pMainView=NULL;	
+	}
+
+	if(m_pMasterView != NULL)
+	{	
+		m_pMasterView = NULL;
+	}
+}
+
+void CViewSettingNotch::DoDataExchange(CDataExchange* pDX)
+{
+	CNOTCH_PARM *pNotch = m_DlgGlassRecipe.m_InspectInfoParm.GetNotchParm();
+
+	DDX_Check(pDX,IDC_CHECK_USE_NOTCH_CHIP_INS,pNotch->GetNotchIns(m_index)->bChipIns);
+	DDX_Check(pDX,IDC_CHECK_USE_NOTCH_SIZE_INS,pNotch->GetNotchIns(m_index)->bSizeIns);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_CHIP_DIFF,pNotch->GetNotchIns(m_index)->nChipDiff);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_SIZE_DIFF,pNotch->GetNotchIns(m_index)->nSizeDiff);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_DET_THRES,pNotch->GetNotchIns(m_index)->nDetThres);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_SIZE_THRES,pNotch->GetNotchIns(m_index)->nSizeThres);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_CHIP_THRES,pNotch->GetNotchIns(m_index)->nChipThres);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_BLANK2EDGERATIO,pNotch->GetNotchIns(m_index)->dBlank2EdgeRatio);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_VSTART,pNotch->GetNotchIns(m_index)->nVStart);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_VSIZE,pNotch->GetNotchIns(m_index)->nVSize);	
+	DDX_Text(pDX,IDC_EDIT_NOTCH_BASE_THICK,pNotch->GetNotchIns(m_index)->nJudgeBaseWidth);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_THICK_DIFF,pNotch->GetNotchIns(m_index)->nJudgeDiffWidth);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_MARK_XPOS_TOP,pNotch->GetNotchIns(m_index)->nMarkXPos[0]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_MARK_XSIZE_TOP,pNotch->GetNotchIns(m_index)->nMarkXSize[0]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_MARK_YPOS_TOP,pNotch->GetNotchIns(m_index)->nMarkYPos[0]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_MARK_YSIZE_TOP,pNotch->GetNotchIns(m_index)->nMarkYSize[0]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_MARK_XPOS_BOT,pNotch->GetNotchIns(m_index)->nMarkXPos[1]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_MARK_XSIZE_BOT,pNotch->GetNotchIns(m_index)->nMarkXSize[1]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_MARK_YPOS_BOT,pNotch->GetNotchIns(m_index)->nMarkYPos[1]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_MARK_YSIZE_BOT,pNotch->GetNotchIns(m_index)->nMarkYSize[1]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_ALIGN2GLASS,pNotch->GetNotchIns(m_index)->nAlign2GlassPos);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_SKIPSIZE,pNotch->GetNotchIns(m_index)->nSkipSize);
+	DDX_Check(pDX,IDC_CHECK_USE_NOTCH_TOPSP_CHIP,pNotch->GetNotchIns(m_index)->bSpChipIns[0]);
+	DDX_Check(pDX,IDC_CHECK_USE_NOTCH_BOTSP_CHIP,pNotch->GetNotchIns(m_index)->bSpChipIns[1]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_TOPSP_INSSIZE,pNotch->GetNotchIns(m_index)->nSpChipSize[0]);
+	DDX_Text(pDX,IDC_EDIT_NOTCH_BOTSP_INSSIZE,pNotch->GetNotchIns(m_index)->nSpChipSize[1]);
+	DDX_Control(pDX,IDC_NOTCH_LIST,m_ListNotchPos);//20140528
+	DDX_Check(pDX,IDC_CHK_NOTCH_INS_POINT_JUDGE_DIMENSION_USE,pNotch->GetNotchIns(m_index)->bPointInsDimensionJudge);//20140528
+	DDX_Check(pDX,IDC_CHK_NOTCH_INS_POINT_JUDGE_CHAMFER_USE,pNotch->GetNotchIns(m_index)->bPointInsChamferJudge);//20140728
+	DDX_Text(pDX,IDC_EDIT_NOTCH_INS_POINT_AVE_COUNT,pNotch->GetNotchIns(m_index)->nPointInsAveCount);//20140528
+		
+	CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_EVENTSINK_MAP(CViewSettingNotch, CDialog)
+	ON_EVENT(CViewSettingNotch, IDC_BTN_NOTCH_OK, DISPID_CLICK, CViewSettingNotch::ClickBtnNotchOk, VTS_NONE)
+	ON_EVENT(CViewSettingNotch, IDC_BTN_NOTCH_CANCEL, DISPID_CLICK, CViewSettingNotch::ClickBtnNotchCancel, VTS_NONE)
+END_EVENTSINK_MAP()
+
+BEGIN_MESSAGE_MAP(CViewSettingNotch, CDialog)	
+	ON_WM_SHOWWINDOW()
+	ON_WM_PAINT()
+	ON_BN_CLICKED(IDC_BUT_NOTCH_LOAD, &CViewSettingNotch::OnBnClickedButNotchLoad)	
+	ON_BN_CLICKED(IDC_BUT_NOTCH_SELECTLINE, &CViewSettingNotch::OnBnClickedButNotchSelectline)
+	ON_BN_CLICKED(IDC_BUT_NOTCH_FINALFIND, &CViewSettingNotch::OnBnClickedButNotchFinalfind)
+	ON_BN_CLICKED(IDC_BUT_NOTCH_SAVE_MASTER, &CViewSettingNotch::OnBnClickedButNotchSaveMaster)
+	ON_BN_CLICKED(IDC_CHECK_USE_NOTCH_CHIP_INS, &CViewSettingNotch::OnBnClickedCheckUseNotchChipIns)
+	ON_BN_CLICKED(IDC_CHECK_USE_NOTCH_SIZE_INS, &CViewSettingNotch::OnBnClickedCheckUseNotchChipIns)
+	ON_BN_CLICKED(IDC_CHECK_USE_NOTCH_TOPSP_CHIP, &CViewSettingNotch::OnBnClickedCheckUseNotchChipIns)
+	ON_BN_CLICKED(IDC_CHECK_USE_NOTCH_BOTSP_CHIP, &CViewSettingNotch::OnBnClickedCheckUseNotchChipIns)
+	ON_BN_CLICKED(IDC_BUT_NOTCH_MARK_LOAD, &CViewSettingNotch::OnBnClickedButNotchMarkLoad)
+	ON_BN_CLICKED(IDC_BUT_NOTCH_MARK_SAVE_MASTER, &CViewSettingNotch::OnBnClickedButNotchMarkSaveMaster)
+	ON_BN_CLICKED(IDC_BUT_NOTCH_POS_ADD, &CViewSettingNotch::OnBnClickedButNotchPosAdd)//20140528
+	ON_BN_CLICKED(IDC_BUT_NOTCH_POS_DEL, &CViewSettingNotch::OnBnClickedButNotchPosDel)//20140528
+	ON_BN_CLICKED(IDC_BUT_NOTCH_POS_MOD, &CViewSettingNotch::OnBnClickedButNotchPosMod)//20140528
+	ON_NOTIFY(NM_CLICK, IDC_NOTCH_LIST, OnListNotchPosClick)	//20140528
+	ON_NOTIFY(GVN_ENDLABELEDIT, IDC_NOTCH_LIST,OnListNotchPosEdit)//20140528
+	ON_MESSAGE(MSG_SCANVIEW_POS_ADD, OnNotchInsPosAdd)//20140528
+	ON_MESSAGE(MSG_SCANVIEW_POS_MOD, OnNotchInsPosMod)//20140528
+	
+	
+END_MESSAGE_MAP()
+
+// CViewSettingNotch 皋矫瘤 贸府扁涝聪促.
+
+BOOL CViewSettingNotch::OnInitDialog()
+{
+	CDialog::OnInitDialog();
+
+	InitImageControl();
+
+	SetControl();
+
+	Init_Grid();//20140528
+
+	return TRUE;  // 器目胶甫 牧飘费俊 汲沥窍瘤 臼栏搁 TRUE甫 馆券钦聪促.
+}
+
+BOOL CViewSettingNotch::PreTranslateMessage(MSG* pMsg) 
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+void CViewSettingNotch::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		FillGrid(TRUE,m_index);//20140528
+		UpDateNotchData(TRUE);
+		SetEnControl();		
+	}
+	else
+	{
+		UpdateDlgData();
+		GetParent()->PostMessage(UM_UPDATE_RECIPE,EM_NOTCH_RCP,NULL);
+	}
+}
+
+void CViewSettingNotch::SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe)
+{
+	m_pHardwareSetting = pHard;
+	m_pGlassRecipe = pRecipe;
+
+	if(m_pGlassRecipe != NULL)
+	{
+		m_DlgGlassRecipe = *m_pGlassRecipe;
+	}
+
+	m_pMainView->ReleaseMemory();//20140528
+	m_pMainView->SetZoomMode(FALSE);//20140528
+	m_pMainView->InitGDI(2048,1024,FALSE);//20140528
+	m_pMainView->SetOrgImgSize(2048,1024);//20140528
+	m_pMainView->SetZoomMode(TRUE);//20140528
+	m_pMainView->SetDrawRect(FALSE);//20140528
+	m_pMainView->Invalidate(FALSE);//20140528
+	
+	UpdateData(FALSE);
+	FillGrid(TRUE,m_index);//20140528
+	UpDateNotchData(TRUE);//20140528
+	SetEnControl();
+}
+
+void CViewSettingNotch::UpDateNotchData(BOOL bWrite)
+{
+	CNOTCH_PARM *pNotch = m_DlgGlassRecipe.m_InspectInfoParm.GetNotchParm();
+
+	if(bWrite == FALSE)
+	{	
+	
+	}
+	else
+	{
+		UpdateData(FALSE);
+	}
+}
+
+void CViewSettingNotch::UpdateDlgData()
+{
+	UpdateData(TRUE);
+	FillGrid(FALSE,m_index);//20140528
+	UpDateNotchData(FALSE);
+
+	if(m_pGlassRecipe != NULL)
+	{
+		m_pGlassRecipe->m_InspectInfoParm.m_NotchParm = m_DlgGlassRecipe.m_InspectInfoParm.m_NotchParm;
+	}
+}
+
+void CViewSettingNotch::SetControl()
+{
+	m_uiTitle_1.SetItemDefault(this,IDC_NOTCH_TITLE_1);
+
+	m_uiTitle_1.m_strData.Format(_T("CAD Image Master Processing"));
+	m_uiTitle_1.m_FontOffset = CPoint(4,2);
+
+	m_uiTitle_2.SetItemDefault(this,IDC_NOTCH_TITLE_2);
+
+	m_uiTitle_2.m_strData.Format(_T("Mark Image Master Processing"));
+	m_uiTitle_2.m_FontOffset = CPoint(4,2);
+
+	m_uiTitle_3.SetItemDefault(this,IDC_NOTCH_TITLE_3);//20140528
+
+	m_uiTitle_3.m_strData.Format(_T("Pos Setting"));//20140528
+	m_uiTitle_3.m_FontOffset = CPoint(4,2);//20140528
+}
+
+void CViewSettingNotch::InitImageControl()
+{
+	CRect		crect;
+	CSize		sizeTotal;
+	((CWnd*)GetDlgItem(IDC_NOTCH_IMAGE))->GetWindowRect(&crect);		
+	ScreenToClient(&crect);
+
+	m_pMainView = new CSlimScrollView;
+	m_pMainView->Create(NULL, NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL, crect, this, IDC_NOTCH_IMAGE, NULL); 	
+	sizeTotal = CSize(2048,1024);	
+	m_pMainView->SetScrollSizes(MM_TEXT, sizeTotal);	
+	m_pMainView->InitGDI(sizeTotal.cx,sizeTotal.cy,FALSE);
+	m_pMainView->SetOrgImgSize(sizeTotal.cx,sizeTotal.cy);
+	m_pMainView->SetHWnd(this);
+	m_pMainView->SetSendMessage(FALSE);
+	m_pMainView->SetDrawRect(FALSE);
+	m_pMainView->SetZoomMode(TRUE);
+	
+	((CWnd*)GetDlgItem(IDC_NOTCH_MASTER_IMAGE_VIEW))->GetWindowRect(&crect);		
+	ScreenToClient(&crect);
+	m_pMasterView = new CSlimScrollView;
+	m_pMasterView->Create(NULL, NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL, crect, this, IDC_NOTCH_MASTER_IMAGE_VIEW, NULL); 	
+	sizeTotal = CSize(200,200);	
+	m_pMasterView->SetScrollSizes(MM_TEXT, sizeTotal);	
+	m_pMasterView->InitGDI(sizeTotal.cx,sizeTotal.cy,FALSE);
+	m_pMasterView->SetOrgImgSize(sizeTotal.cx,sizeTotal.cy);
+	m_pMasterView->SetHWnd(this);
+	m_pMasterView->SetSendMessage(FALSE);
+	m_pMasterView->SetDrawRect(FALSE);
+	m_pMasterView->SetZoomMode(TRUE);
+}
+
+// CViewSettingNotch 皋矫瘤 贸府扁涝聪促.
+
+void CViewSettingNotch::OnBnClickedButNotchLoad()
+{
+	CString strFileName,strpath;
+
+	strpath.Format(_T("D:\\Image\\scanimage\\*.bmp"));
+
+	// file select
+	CFileDialog	filedlg( TRUE, _T("*.bmp"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Image file (*.bmp)|*.bmp|"), NULL );
+	if(IDCANCEL == filedlg.DoModal())	
+		return;
+
+	strFileName = filedlg.GetPathName();
+	if(m_ImageMain.ReadFromFile(strFileName) == FALSE)
+	{
+		AfxMessageBox(_T("Image Load Fail!"));
+		return;
+	}
+
+// 	strFileName = _T("D:\\Image\\test.bmp");
+// 	CBufferAttach		attach(strFileName);
+// 	attach.AttachToFile(m_ImageMain);
+
+	ShowMainImage();
+}
+
+void CViewSettingNotch::ShowMainImage()
+{
+	if(m_ImageMain.IsValidBuffer() == FALSE || m_pMainView == NULL)
+	{
+		m_pMainView->ReleaseMemory();
+		m_pMainView->SetZoomMode(FALSE);
+		m_pMainView->InitGDI(2048,1024,FALSE);
+		m_pMainView->SetOrgImgSize(2048,1024);
+		m_pMainView->SetZoomMode(TRUE);
+		m_pMainView->SetDrawRect(FALSE);
+		m_pMainView->Invalidate(FALSE);
+		return;
+	}
+
+	m_pMainView->ReleaseMemory();	
+	m_pMainView->SetZoomMode(FALSE);
+	m_pMainView->InitGDI(m_ImageMain.GetDataWidth(),m_ImageMain.GetHeight(),FALSE);
+	m_pMainView->SetOrgImgSize(m_ImageMain.GetDataWidth(),m_ImageMain.GetHeight());
+	m_pMainView->SetDrawRect(FALSE);
+	m_pMainView->SetZoomMode(TRUE);
+
+	BYTE* pTgtBuf = m_pMainView->GetBuffer();	
+	if(pTgtBuf == NULL)
+	{
+		return;
+	}
+	CopyMemory(pTgtBuf,m_ImageMain.GetDataAddress(0,0),m_ImageMain.GetDataWidth()*m_ImageMain.GetHeight());
+
+	m_pMainView->SetScrollSizes(MM_TEXT, CSize(m_ImageMain.GetDataWidth(),m_ImageMain.GetHeight()));
+	m_pMainView->Invalidate(FALSE);
+}
+
+void CViewSettingNotch::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	
+	CGeneralDraw			pDraw;
+
+	pDraw.DrawPitureControl(m_uiTitle_1);	
+	pDraw.DrawPitureControl(m_uiTitle_2);	
+	pDraw.DrawPitureControl(m_uiTitle_3);//20140528	
+}
+
+void CViewSettingNotch::OnBnClickedButNotchFindline()
+{
+	if(m_ImageMain.IsValidBuffer() == FALSE || m_pMainView == NULL)
+		return;
+
+	BYTE* pTgtBuf = m_pMainView->GetBuffer();	
+	if(pTgtBuf == NULL)
+	{
+		return;
+	}
+	CopyMemory(pTgtBuf,m_ImageMain.GetDataAddress(0,0),m_ImageMain.GetWidth()*m_ImageMain.GetHeight());
+
+	LPBYTE			lpImg = m_pMainView->GetBuffer();
+	CSize			szImg = m_pMainView->GetOrgImgSize();
+	CRect			rect(0,0,szImg.cx,szImg.cy);
+
+	if(lpImg == NULL)
+		return;
+
+	CSPLINE_PARM *pSpline = &m_DlgGlassRecipe.m_InspectInfoParm.m_SplineParm;
+
+	UpdateData(TRUE);
+
+	COwnerBuffer	pTgt(szImg.cx,szImg.cy);
+	CEdgeProc		EdgeProc;	
+
+	// 	ZeroMemory(pTgt.GetDataAddress(0,0),pTgt.GetDataSize());
+	// 	glassFind.ThresholdProcessing(lpImg,szImg,pSpline->m_nLineThres,0);
+	// 
+	// 	CCCLabeling		labeling;
+	// 	CSISBuffer	lpOrg(lpImg,szImg.cx,szImg.cy);
+	// 	labeling.DoPerimeterLine(lpOrg,pTgt);
+	// 	CopyMemory(lpImg,pTgt.GetDataAddress(0,0),pTgt.GetDataSize());
+
+	EdgeProc.CannyEdgeProcessing(lpImg,rect,GM_Sobel,80,pTgt);
+	CopyMemory(lpImg,pTgt.GetDataAddress(0,0),pTgt.GetDataSize());
+
+
+	CString				strFile = _T("D:\\Image\\CannyEdge.bmp");
+	CBufferAttach		attach(strFile);
+	CSISBuffer		mosis(pTgt.GetDataAddress(0,0),szImg.cx,szImg.cy);
+	attach.AttachToFile(mosis);
+
+	m_pMainView->SetDrawRect(FALSE);
+	m_pMainView->Invalidate(FALSE);
+}
+
+void CViewSettingNotch::OnBnClickedButNotchSelectline()
+{
+	m_pMainView->SetDrawRect(TRUE);
+}
+
+void CViewSettingNotch::OnBnClickedButNotchFinalfind()
+{
+	LPBYTE			lpImg = m_pMainView->GetBuffer();
+	CSize			szImg = m_pMainView->GetOrgImgSize();	
+
+	if(lpImg == NULL)
+		return;
+
+	CRect			rectSel = m_pMainView->GetDrawRect();
+	if(rectSel.IsRectEmpty() == TRUE)
+	{
+		AfxMessageBox(_T("No Selection Region.!"));
+		return;
+	}
+
+	CSISBuffer	lpOrg(lpImg,szImg.cx,szImg.cy);
+	COwnerBuffer	lpBuffer(szImg.cx,szImg.cy);
+	CRect			rect(0,0,szImg.cx,szImg.cy);	
+
+	lpBuffer.CopyBtoA(lpBuffer,0,0,lpOrg,rect);
+
+	int				nMaxIdx;	
+
+	CSplineInspect		pLabeling(&lpBuffer);	
+
+
+	if(pLabeling.LabelingProcess() == TRUE)
+	{
+		//	m_pLabeling.MakeContourMapImage("D:\\Image\\ContourMap");	
+
+		pLabeling.LabelingCounting();
+		pLabeling.LabelFiltering(100);
+		nMaxIdx = pLabeling.GetRectInLabelMaxIndex(rectSel);		
+
+		if(nMaxIdx > 0)
+		{
+			if(pLabeling.GetLabelPosition(nMaxIdx) == TRUE)
+			{
+				std::multimap<int, CSplinePoint> *pPoint = pLabeling.GetSplinePos();								
+				if(pPoint != NULL)
+				{
+					m_pMainView->SetSplinePosition(pPoint,pLabeling.GetSplineOffset());			
+					// 
+					// 					CPoint		point;
+					// 					std::multimap<int, CSplinePoint>::iterator	it;
+					// 
+					// 					COwnerBuffer	lpImg(szImg.cx,szImg.cy);
+					// 					ZeroMemory(lpImg.GetDataAddress(0,0),lpImg.GetDataSize());
+					// 					for(it=pPoint->begin();it!=pPoint->end();it++)
+					// 					{		
+					// 						point =	it->second.origin;
+					// 						point.x = (int)((double)point.x);
+					// 						point.y = (int)((double)point.y);								
+					// 						lpImg.SetPixel(point.x,point.y,255);						
+					// 					}
+					// 
+					// 					CString		str = "D:\\Image\\NoChiCut\\Master.bmp";
+					// 					CBufferAttach		attach(str);
+					// 					attach.AttachToFile(lpImg);
+				}			
+			}
+		}
+	}	
+
+	m_pMainView->Invalidate(FALSE);
+}
+
+void CViewSettingNotch::OnBnClickedButNotchSaveMaster()
+{	
+	CString				strFile;
+	std::multimap<int, CSplinePoint> *pPoint;
+	CPoint				pointOffset;
+
+	pPoint = m_pMainView->GetSplinePos();	
+	pointOffset = m_pMainView->GetSplineOffset();
+
+	CString str;
+	str.Format(_T("Notch[%d] Master Data Save?"),m_index);
+
+	if(pPoint != NULL && (int)pPoint->size() > 0)
+	{
+		if(IDNO == AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION))
+			return;
+	}
+	else
+	{
+		AfxMessageBox(_T("No Data."));
+	}
+
+	CreateDirectory(PATH_NOTCH_IMAGE,NULL);
+
+	CNotchCut		notchCut;
+	strFile.Format(_T("%s\\%s_[%d].notch"),PATH_NOTCH_IMAGE,m_pGlassRecipe->GetRecipeName(),m_index);
+	
+	CString strCut;
+	strCut.Format(_T("[%d]_Notch"),m_index);
+
+	if(notchCut.WriteModelData(strFile,m_pGlassRecipe->GetRecipeName(),strCut,pPoint) == TRUE)
+	{
+		CString		strMsg;
+
+		strMsg.Format(_T("%s Saved."),strFile);
+
+		strFile.Format(_T("%s\\%s_[%d]_notch.bmp"),PATH_NOTCH_IMAGE,m_pGlassRecipe->GetRecipeName(),m_index);
+		CBufferAttach		attach(strFile);
+		attach.AttachToFile(m_ImageMain);
+
+		AfxMessageBox(strMsg);
+	}
+	else
+	{
+		AfxMessageBox(_T("No Data."));
+	}
+
+	// 	CCCLabeling		pLabeling;
+	// 	strFile.Format("C:\\RCutProject\\NoChi\\%s.nochi",m_pGlassRecipe->GetRecipeName());
+	// 	if(pLabeling.WriteModelData(strFile,m_pGlassRecipe->GetRecipeName(),"RCut",pPoint,pointOffset) == TRUE)
+	// 	{
+	// 		CString		strMsg;
+	// 
+	// 		strMsg.Format("%s俊 历厘 登菌嚼聪促.",strFile);
+	// 
+	// 		strFile.Format("C:\\RCutProject\\NoChi\\%s_nochi.bmp",m_pGlassRecipe->GetRecipeName());
+	// 		CBufferAttach		attach(strFile);
+	// 		attach.AttachToFile(m_ImageMain);
+	// 
+	// 		AfxMessageBox(strMsg);
+	// 	}
+	// 	else
+	// 	{
+	// 		AfxMessageBox("Data啊 绝嚼聪促.");
+	// 	}
+
+	LoadNotchCadImage();//20140528
+}
+
+void CViewSettingNotch::SetEnControl()
+{
+	CNOTCH_PARM *pNotch = m_DlgGlassRecipe.m_InspectInfoParm.GetNotchParm();
+	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_CHIP_DIFF))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_CHECK_USE_NOTCH_CHIP_INS))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_CHIP_DIFF))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_SIZE_DIFF))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_DET_THRES))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_SIZE_THRES))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_CHIP_THRES))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_BLANK2EDGERATIO))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_VSTART))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_VSIZE))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);		
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_BASE_THICK))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_THICK_DIFF))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_LOAD))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_SELECTLINE))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_FINALFIND))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_SAVE_MASTER))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_MARK_LOAD))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_MARK_SAVE_MASTER))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_MARK_XPOS_TOP))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_MARK_XSIZE_TOP))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_MARK_YPOS_TOP))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_MARK_YSIZE_TOP))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_MARK_XPOS_BOT))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_MARK_XSIZE_BOT))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_MARK_YPOS_BOT))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_MARK_YSIZE_BOT))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_ALIGN2GLASS))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_SKIPSIZE))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_CHECK_USE_NOTCH_TOPSP_CHIP))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_TOPSP_INSSIZE))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_CHECK_USE_NOTCH_BOTSP_CHIP))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_BOTSP_INSSIZE))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);	
+	if(pNotch->GetNotchIns(m_index)->bSizeIns)
+	{
+		((CWnd*)GetDlgItem(IDC_NOTCH_MASTER_IMAGE_VIEW))->EnableWindow(SW_SHOW);
+		m_pMasterView->ShowWindow(SW_SHOW);
+
+		((CWnd*)GetDlgItem(IDC_NOTCH_IMAGE))->EnableWindow(SW_SHOW);//20140528
+		m_pMainView->ShowWindow(SW_SHOW);//20140528
+	}
+	else
+	{
+		((CWnd*)GetDlgItem(IDC_NOTCH_MASTER_IMAGE_VIEW))->EnableWindow(SW_HIDE);
+		m_pMasterView->ShowWindow(SW_HIDE);
+
+		((CWnd*)GetDlgItem(IDC_NOTCH_IMAGE))->EnableWindow(SW_HIDE);//20140528
+		m_pMainView->ShowWindow(SW_HIDE);//20140528
+	}
+	
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_POS_ADD))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);//20140528
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_POS_DEL))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);//20140528
+	((CWnd*)GetDlgItem(IDC_BUT_NOTCH_POS_MOD))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);//20140528
+	((CWnd*)GetDlgItem(IDC_NOTCH_LIST))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);//20140528
+	((CWnd*)GetDlgItem(IDC_CHK_NOTCH_INS_POINT_JUDGE_DIMENSION_USE))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);//20140528
+	((CWnd*)GetDlgItem(IDC_CHK_NOTCH_INS_POINT_JUDGE_CHAMFER_USE))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);//20140528
+	((CWnd*)GetDlgItem(IDC_EDIT_NOTCH_INS_POINT_AVE_COUNT))->EnableWindow(pNotch->GetNotchIns(m_index)->bSizeIns);//20140528
+		
+	LoadMasterImage();
+	LoadNotchCadImage();//20140528
+
+}
+void CViewSettingNotch::OnBnClickedCheckUseNotchChipIns()
+{
+	UpdateData(TRUE);
+
+	SetEnControl();
+}
+
+void CViewSettingNotch::OnBnClickedButNotchMarkLoad()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+	CString strFileName;	
+
+	// file select
+	CFileDialog	filedlg( TRUE, _T("*.bmp"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Image file (*.bmp)|*.bmp|"), NULL );
+	if(IDCANCEL == filedlg.DoModal())	
+		return;
+
+	strFileName = filedlg.GetPathName();
+	if(m_ImageMain.ReadFromFile(strFileName) == FALSE)
+	{
+		AfxMessageBox(_T("Image Load Fail!"));
+		return;
+	}
+
+	ShowMainImage();
+
+	m_pMainView->SetDrawRect(TRUE);
+}
+
+#define align_4byte(in)		((in + 3)/4)*4
+void CViewSettingNotch::OnBnClickedButNotchMarkSaveMaster()
+{
+	// TODO: 咯扁俊 牧飘费 舅覆 贸府扁 内靛甫 眠啊钦聪促.
+	if(m_pMainView == NULL)
+		return;
+
+	CString	strFile,strRecipe,strMsg,str;
+
+	CGLASS_INFO_PARM *pGlass = &m_DlgGlassRecipe.m_GlassParm;
+	
+	switch(m_index)
+	{
+	case DIMENSION_A: strMsg.Format(_T("A Pos"));	break;
+	case DIMENSION_B: strMsg.Format(_T("B Pos"));	break;
+	case DIMENSION_C: strMsg.Format(_T("C Pos"));	break;
+	case DIMENSION_D: strMsg.Format(_T("D Pos"));	break;
+	}
+
+	str.Format(_T("%s Mark Master Image Save?"),strMsg);
+	if (IDNO == AfxMessageBox(str, MB_YESNO | MB_ICONQUESTION))
+		return;
+
+	BYTE* pImg = m_pMainView->GetBuffer();	
+	CSize szImg = m_pMainView->GetOrgImgSize();
+	if(pImg == NULL || szImg.cx <= 0 || szImg.cy <= 0)
+	{
+		AfxMessageBox(_T("No Image."));
+		return;
+	}
+
+	CreateDirectory(PATH_NOTCH_IMAGE,NULL);
+
+	CRect	rect = m_pMainView->GetDrawRect();
+	if(rect.IsRectEmpty() == TRUE)
+	{
+		AfxMessageBox(_T("No Save Region"));
+		return;
+	}
+
+	int		nWidth = align_4byte(rect.Width());
+	rect.right = rect.left+nWidth;				
+	if(rect.right >= szImg.cx)
+		rect.right = szImg.cx-4;
+
+	strRecipe = m_DlgGlassRecipe.GetRecipeName();
+	strFile.Format(_T("%s\\%s_Notch_Align_Mark_[%d].bmp"),PATH_NOTCH_IMAGE,strRecipe,m_index);
+
+	CSISBuffer		buffer(pImg,szImg.cx,szImg.cy);
+
+
+	int		nCropWidth = rect.Width();
+	int		nCropHeight = rect.Height();
+
+	if(nCropWidth< 10 || nCropHeight<10)
+	{
+		AfxMessageBox(_T("Reselect Image Region"));
+		return;
+	}
+	else
+		;
+
+	nCropWidth = (nCropWidth/2)*2; 		// Width甫 碍力肺 娄荐拳
+	nCropHeight = (nCropHeight/2)*2; 	// Height甫 碍力肺 娄荐拳
+
+	rect.right = rect.left + nCropWidth;
+	rect.bottom = rect.top + nCropHeight;
+
+	int		nCropPitch = (rect.Width()+0x3)&~0x3;
+
+	double	dCenterX;
+	double  dCenterY;
+
+	int nYStart = rect.top;
+	int nXStart = rect.left;
+
+	LPBYTE lpStart = pImg + (nYStart % szImg.cy) * szImg.cx + nXStart;
+	LPBYTE pCopyBuf = new BYTE[rect.Width()*rect.Height()];
+
+	for (int i = 0; i < rect.Height(); i++)
+	{
+		memcpy(pCopyBuf + i * rect.Width(), lpStart + i * szImg.cx, rect.Width());		
+	}
+
+	CSISBuffer		bufferTest(pCopyBuf,rect.Width(), rect.Height());
+
+	if(TRUE == GetSymmetricPoint(bufferTest.GetDataAddress(), bufferTest.GetWidth(), bufferTest.GetHeight(), nCropPitch, &dCenterX, &dCenterY))
+	{
+		double		dOffsetX = dCenterX-nCropWidth/2.;
+		double		dOffsetY = dCenterY-nCropHeight/2.;
+
+		if(dOffsetX<0)
+			dOffsetX += -0.5;
+		else
+			dOffsetX += 0.5;
+
+		if(dOffsetY<0)
+			dOffsetY += -0.5;
+		else
+			dOffsetY += 0.5;
+
+		int		nOffsetX = (int)(dOffsetX);
+		int		nOffsetY = (int)(dOffsetY);
+		rect.OffsetRect(nOffsetX, nOffsetY);
+	}
+	else
+	{
+		AfxMessageBox(_T("Reselect Image Region"));
+		return;
+	}
+
+	CRect rectCrop = CRect(rect.CenterPoint().x, rect.CenterPoint().y, rect.CenterPoint().x, rect.CenterPoint().y);
+	rectCrop.InflateRect(nCropWidth/2, nCropHeight/2);
+
+	CCropBuffer			cropBufferCenter(buffer,rectCrop);
+
+	CBufferAttach		attachCenter(strFile);
+
+	attachCenter.AttachToFile(cropBufferCenter);
+
+	LoadMasterImage();
+}
+
+void CViewSettingNotch::LoadMasterImage()
+{
+	CString			strFile;
+	CString			strRecipe = m_DlgGlassRecipe.GetRecipeName();
+
+	m_ImageMaster[m_index].ReleaseImage();
+	strFile.Format(_T("%s\\%s_Notch_Align_Mark_[%d].bmp"),PATH_NOTCH_IMAGE,strRecipe,m_index);
+	m_ImageMaster[m_index].ReadFromFile(strFile);	
+
+	ShowMasterImage();
+}
+
+void CViewSettingNotch::ShowMasterImage()
+{
+	if(m_ImageMaster[m_index].IsValidBuffer() == FALSE || m_pMasterView == NULL)
+	{
+		m_pMasterView->ReleaseMemory();
+		m_pMasterView->SetZoomMode(FALSE);
+		m_pMasterView->InitGDI(200,200,FALSE);
+		m_pMasterView->SetOrgImgSize(200,200);
+		m_pMasterView->SetZoomMode(TRUE);
+		m_pMasterView->SetMarkPos(CPoint(0,0),CPoint(0,0));	
+		m_pMasterView->Invalidate(FALSE);
+		return;
+	}
+
+	m_pMasterView->ReleaseMemory();	
+	m_pMasterView->SetZoomMode(FALSE);
+	m_pMasterView->InitGDI(m_ImageMaster[m_index].GetDataWidth(),m_ImageMaster[m_index].GetHeight(),FALSE);
+	m_pMasterView->SetOrgImgSize(m_ImageMaster[m_index].GetDataWidth(),m_ImageMaster[m_index].GetHeight());
+	m_pMasterView->SetDrawRect(TRUE);
+	m_pMasterView->SetZoomMode(TRUE);
+
+	BYTE* pTgtBuf = m_pMasterView->GetBuffer();	
+	if(pTgtBuf == NULL)
+	{
+		return;
+	}
+	CopyMemory(pTgtBuf,m_ImageMaster[m_index].GetDataAddress(0,0),m_ImageMaster[m_index].GetWidth()*m_ImageMaster[m_index].GetHeight());
+
+	m_pMasterView->SetScrollSizes(MM_TEXT, CSize(m_ImageMaster[m_index].GetDataWidth(),m_ImageMaster[m_index].GetHeight()));
+	m_pMasterView->SetMarkPos(CPoint(m_ImageMaster[m_index].GetDataWidth()/2,m_ImageMaster[m_index].GetHeight()/2),CPoint(0,0));	
+	m_pMasterView->Invalidate(FALSE);	
+}
+
+void CViewSettingNotch::Init_Grid()//20140528
+{
+	if(m_ListNotchPos.GetSafeHwnd() == NULL)
+		return;
+
+	m_ListNotchPos.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xE0));
+	m_ListNotchPos.SetGridLines(GVL_BOTH);	
+
+	m_ListNotchPos.SetColumnCount(NOTCH_GRID_COLUMN_COUNT);
+	m_ListNotchPos.SetRowCount(5);
+	m_ListNotchPos.SetFixedRowCount(1);
+	m_ListNotchPos.SetFixedColumnCount(1);
+	m_ListNotchPos.ExpandColumnsToFit();
+
+	CFont *pFont = m_ListNotchPos.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_ListNotchPos.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_ListNotchPos.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_ListNotchPos.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_ListNotchPos.SetEditable(TRUE);
+	m_ListNotchPos.EnableSelection(TRUE);
+
+	Init_GridHeader();
+}
+
+void CViewSettingNotch::Init_GridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<NOTCH_GRID_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = NOTCH_GRID_COLUMN_ITEM[iLoop];
+		m_ListNotchPos.SetItem(&Item);
+		m_ListNotchPos.SetColumnWidth(Item.col,NOTCH_GRID_COLUMN_WIDTH[iLoop]);
+	}
+
+	m_ListNotchPos.Invalidate();
+}
+
+void CViewSettingNotch::FillGrid( BOOL bWrite,int nCurIdx )
+{
+	CNOTCH_PARM *pParm = m_DlgGlassRecipe.m_InspectInfoParm.GetNotchParm();
+	std::vector<CPoint>::iterator	it;
+	CString str;		
+	int		nCol = 0, nRow;
+	int		iLoop;		
+	CPoint stPos;
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double dScanRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dScanResolution[nStageNo];
+	double dConvRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dConvResolution[nStageNo];
+
+	if(bWrite == TRUE)
+	{
+		iLoop = 1;
+		m_ListNotchPos.SetRowCount((int)pParm->m_vecNotchPosition[nCurIdx].size()+1);
+
+		for(it=pParm->m_vecNotchPosition[nCurIdx].begin();it!=pParm->m_vecNotchPosition[nCurIdx].end();it++,iLoop++)
+		{				
+			stPos = *it;
+
+			nCol = 0;	
+			nRow = iLoop;
+
+			str.Format(_T("%d"),nRow);
+			m_ListNotchPos.SetItemText(nRow,nCol,str);
+			nCol++;
+
+			str.Format(_T("%d"),(int)(stPos.x*dConvRes));
+			m_ListNotchPos.SetItemText(nRow,nCol,str);
+			nCol++;
+
+			str.Format(_T("%d"),(int)(stPos.y*dScanRes)+m_nAlignMark2CadCenter);
+			m_ListNotchPos.SetItemText(nRow,nCol,str);		
+			nCol++;
+
+			str.Format(_T("%d"),stPos.x);
+			m_ListNotchPos.SetItemText(nRow,nCol,str);
+			nCol++;
+
+			str.Format(_T("%d"),stPos.y);
+			m_ListNotchPos.SetItemText(nRow,nCol,str);		
+		}
+		m_ListNotchPos.Invalidate();
+
+		DrawNotchInsPos();
+	}
+	else
+	{		
+		pParm->m_vecNotchPosition[nCurIdx].clear();
+		int nRowCnt = m_ListNotchPos.GetRowCount();
+		for(iLoop=1;iLoop<nRowCnt;iLoop++)
+		{		
+			nCol = 3;	
+			nRow = iLoop;						
+
+			str = m_ListNotchPos.GetItemText(nRow,nCol);			
+			stPos.x = _ttoi(str);
+			nCol++;
+
+			str = m_ListNotchPos.GetItemText(nRow,nCol);			
+			stPos.y = _ttoi(str);
+			
+			pParm->m_vecNotchPosition[nCurIdx].push_back(stPos);
+		}
+	}
+}
+
+void CViewSettingNotch::OnBnClickedButNotchPosAdd()
+{
+	int nRowCnt = m_ListNotchPos.GetRowCount();
+
+	if(nRowCnt >= MAX_NOTCH_INS_POS_COUNT+1)
+	{
+		AfxMessageBox(_T("Up to 100 can be registered."));
+		return;
+	}
+
+	CPoint stPos(0,0);
+	CNOTCH_PARM *pParm = m_DlgGlassRecipe.m_InspectInfoParm.GetNotchParm();
+
+	pParm->m_vecNotchPosition[m_index].push_back(stPos);
+	FillGrid(TRUE,m_index);
+}
+
+void CViewSettingNotch::OnBnClickedButNotchPosDel()
+{
+	if(m_nCutListIdx <= 0 || m_nCutListIdx >= m_ListNotchPos.GetRowCount())
+		return;
+
+	if (IDNO == AfxMessageBox(_T("Delete Data?"), MB_YESNO | MB_ICONQUESTION))
+		return;
+
+	CPoint	stPos;
+	CString		str;
+	int			nCol = 3;
+
+	str = m_ListNotchPos.GetItemText(m_nCutListIdx,nCol);
+	stPos.x = _ttoi(str);
+	nCol++;
+
+	str = m_ListNotchPos.GetItemText(m_nCutListIdx,nCol);
+	stPos.y = _ttoi(str);
+	nCol++;
+
+	CNOTCH_PARM *pParm = m_DlgGlassRecipe.m_InspectInfoParm.GetNotchParm();
+	std::vector<CPoint>::iterator	it;
+
+	for(it=pParm->m_vecNotchPosition[m_index].begin();it!=pParm->m_vecNotchPosition[m_index].end();it++)
+	{	
+		if(it->x == stPos.x && it->y == stPos.y)
+		{
+			pParm->m_vecNotchPosition[m_index].erase(it);
+			break;
+		}
+	}
+
+	FillGrid(TRUE,m_index);
+}
+
+void CViewSettingNotch::OnBnClickedButNotchPosMod()
+{
+	m_pMainView->SetNotchInsPosMod(TRUE);
+}
+
+void CViewSettingNotch::OnListNotchPosClick( NMHDR *pNotifyStruct, LRESULT* pResult )
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
+
+	if(pItem->iRow <= 0 || pItem->iRow > (int)m_ListNotchPos.GetRowCount())
+		return;
+
+	m_nCutListIdx = pItem->iRow;
+
+	m_pMainView->SetNotchInsListIdx(m_nCutListIdx);
+
+	Invalidate(FALSE);
+}
+
+void CViewSettingNotch::LoadNotchCadImage()
+{
+	m_nNotchCadCenterX = m_nNotchCadCenterY = 0;
+	m_nAlignMark2CadCenter = 0;
+
+	CString			strFile;
+	CString			strRecipe = m_DlgGlassRecipe.GetRecipeName();
+
+	m_ImageMain.ReleaseImage();
+	strFile.Format(_T("%s\\%s_[%d]_notch.bmp"),PATH_NOTCH_IMAGE,strRecipe,m_index);
+	if(m_ImageMain.ReadFromFile(strFile) == FALSE)
+		return;
+
+// 	strFile = "D:\\Image\\test_cad.bmp";
+// 	CBufferAttach		attach(strFile);
+// 	attach.AttachToFile(m_ImageMain);
+
+	CNotchCut		notchCut;
+	CNOTCH_PARM *pNotch = m_DlgGlassRecipe.m_InspectInfoParm.GetNotchParm();
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double dScanRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dScanResolution[nStageNo];
+	double dConvRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dConvResolution[nStageNo];
+
+	notchCut.FindCenterPos(m_ImageMain,m_nNotchCadCenterX,m_nNotchCadCenterY);
+
+	m_nAlignMark2CadCenter = (int)(pNotch->GetNotchIns(m_index)->nVStart - m_nNotchCadCenterY*dScanRes);
+
+	ShowMainImage();
+
+	DrawNotchInsPos();
+}
+
+void CViewSettingNotch::DrawNotchInsPos()
+{
+	int iLoop;
+	int nCol;
+	int nRow;
+	CString str;
+
+	int nRowCnt = m_ListNotchPos.GetRowCount();
+
+	m_NotchInsPoint.clear();
+	CPoint stPos;
+	
+	for(iLoop=1;iLoop<nRowCnt;iLoop++)
+	{		
+		nCol = 3;	
+		nRow = iLoop;						
+
+		str = m_ListNotchPos.GetItemText(nRow,nCol);			
+		stPos.x= _ttoi(str);
+		nCol++;
+
+		str = m_ListNotchPos.GetItemText(nRow,nCol);			
+		stPos.y = _ttoi(str);
+
+		m_NotchInsPoint.insert(std::make_pair(iLoop, stPos));
+	}
+
+	m_pMainView->SetNotchInsPosition(&m_NotchInsPoint);
+	m_pMainView->SetDrawNotchInsPos(TRUE);
+	m_pMainView->SetNotchCadCenterPos(m_nNotchCadCenterX,m_nNotchCadCenterY);
+}
+
+LRESULT CViewSettingNotch::OnNotchInsPosAdd( WPARAM wParam, LPARAM lParam )
+{
+	int nPosX, nPosY;
+
+	nPosX = (int)wParam;
+	nPosY = (int)lParam;
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double dScanRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dScanResolution[nStageNo];
+	double dConvRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dConvResolution[nStageNo];
+	
+	int nCol = 0;	
+	int nRowCnt = m_ListNotchPos.GetRowCount();
+
+	if(nRowCnt >= MAX_NOTCH_INS_POS_COUNT+1)
+	{
+		AfxMessageBox(_T("Up to 100 can be registered."));
+		return -1;
+	}
+
+	CString str;
+
+	nPosX = FindNotchInsXPos(nPosY);
+
+	m_ListNotchPos.SetRowCount(nRowCnt+1);
+	
+	str.Format(_T("%d"),nRowCnt);
+	m_ListNotchPos.SetItemText(nRowCnt,nCol,str);
+	nCol++;
+
+	str.Format(_T("%d"),(int)(nPosX*dConvRes));
+	m_ListNotchPos.SetItemText(nRowCnt,nCol,str);
+	nCol++;
+
+	str.Format(_T("%d"),(int)(nPosY*dScanRes + m_nAlignMark2CadCenter));
+	m_ListNotchPos.SetItemText(nRowCnt,nCol,str);
+	nCol++;
+
+	str.Format(_T("%d"),nPosX);
+	m_ListNotchPos.SetItemText(nRowCnt,nCol,str);
+	nCol++;
+
+	str.Format(_T("%d"),nPosY);
+	m_ListNotchPos.SetItemText(nRowCnt,nCol,str);	
+	
+	m_ListNotchPos.Invalidate();
+
+	DrawNotchInsPos();
+
+	return 0;
+}
+
+
+LRESULT CViewSettingNotch::OnNotchInsPosMod( WPARAM wParam, LPARAM lParam )
+{
+	int nPosX, nPosY;
+
+	nPosX = (int)wParam;
+	nPosY = (int)lParam;
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double dScanRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dScanResolution[nStageNo];
+	double dConvRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dConvResolution[nStageNo];
+
+	int nCol = 1;	
+	CString str;
+
+	nPosX = FindNotchInsXPos(nPosY);
+
+	str.Format(_T("%d"),(int)(nPosX*dConvRes));
+	m_ListNotchPos.SetItemText(m_nCutListIdx,nCol,str);
+	nCol++;
+
+	str.Format(_T("%d"),(int)(nPosY*dScanRes + m_nAlignMark2CadCenter));
+	m_ListNotchPos.SetItemText(m_nCutListIdx,nCol,str);	
+	nCol++;
+
+	str.Format(_T("%d"),nPosX);
+	m_ListNotchPos.SetItemText(m_nCutListIdx,nCol,str);
+	nCol++;
+
+	str.Format(_T("%d"),nPosY);
+	m_ListNotchPos.SetItemText(m_nCutListIdx,nCol,str);	
+
+	m_ListNotchPos.Invalidate();
+
+	DrawNotchInsPos();
+
+	return 0;
+}
+
+void CViewSettingNotch::OnListNotchPosEdit( NMHDR *pNotifyStruct, LRESULT* pResult )
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
+
+	if(pItem->iRow <= 0 || pItem->iRow > (int)m_ListNotchPos.GetRowCount())
+		return;
+
+	CString str;
+	int		nStageNo = g_pBase->m_nStageNo;
+
+	if(nStageNo < 0 || nStageNo > 1)
+		nStageNo = 0;
+
+	double dScanRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dScanResolution[nStageNo];
+	double dConvRes = m_pHardwareSetting->GetCameraSettings(0,0)->m_dConvResolution[nStageNo];
+	
+	int nPosX;
+	int nPosY;
+
+	int nCol;
+
+	if(pItem->iColumn == 2 || pItem->iColumn == 1)
+	{
+		str = m_ListNotchPos.GetItemText(pItem->iRow,2);		
+		nPosY = _ttoi(str);
+		nPosY = (int)((nPosY-m_nAlignMark2CadCenter)/dScanRes);
+
+		nCol = 1;	
+
+		nPosX = FindNotchInsXPos(nPosY);
+
+		str.Format(_T("%d"),(int)(nPosX*dConvRes));
+		m_ListNotchPos.SetItemText(pItem->iRow,nCol,str);
+		nCol++;		
+		nCol++;
+
+		str.Format(_T("%d"),(int)nPosX);
+		m_ListNotchPos.SetItemText(pItem->iRow,nCol,str);		
+		nCol++;
+
+		str.Format(_T("%d"),(int)nPosY);
+		m_ListNotchPos.SetItemText(pItem->iRow,nCol,str);	
+	}
+	else if(pItem->iColumn == 4 || pItem->iColumn == 3)
+	{
+		str = m_ListNotchPos.GetItemText(pItem->iRow,4);		
+		nPosY = _ttoi(str);
+
+		nCol = 1;	
+
+		nPosX = FindNotchInsXPos(nPosY);
+
+		str.Format(_T("%d"),(int)(nPosX*dConvRes));
+		m_ListNotchPos.SetItemText(pItem->iRow,nCol,str);
+		nCol++;		
+
+		str.Format(_T("%d"),(int)(nPosY*dScanRes) + m_nAlignMark2CadCenter);
+		m_ListNotchPos.SetItemText(pItem->iRow,nCol,str);		
+		nCol++;
+
+		str.Format(_T("%d"),(int)nPosX);
+		m_ListNotchPos.SetItemText(pItem->iRow,nCol,str);
+		nCol++;	
+	}	
+
+	m_ListNotchPos.Invalidate();
+
+	DrawNotchInsPos();
+}
+
+int CViewSettingNotch::FindNotchInsXPos(int nPosY)
+{
+	int iLoop;
+	int nValue;
+	int nPosX = 0;
+
+	for (iLoop = 0; iLoop<m_ImageMain.GetWidth(); iLoop++)
+	{
+		nValue = m_ImageMain.GetPixel(iLoop, nPosY);
+
+		if(nValue == 255)
+		{
+			nPosX = iLoop;
+			break;
+		}
+	}
+
+	return nPosX;
+}
+
+BOOL CViewSettingNotch::GetSymmetricPoint( LPBYTE pImage, int nWidth, int nHeight, int nPitch, double *pdCenterX, double *pdCenterY )//20140611
+{
+	CSISBuffer		buffer(pImage,nWidth,nHeight);
+	CString strFile;
+	strFile = _T("C:\\RCutProject\\CutArea\\GetSymmetricPoint_org.bmp");
+	CBufferAttach		attachCenter(strFile);
+	attachCenter.AttachToFile(buffer);
+
+	int		*pProjectionLine = new int[nHeight];
+	int		*pProjectionColumn = new int[nWidth];
+
+	int		nLine[1000]={0,};
+	int		nColumn[1000]={0,};
+
+	ProjectionLineDirection(pImage, nWidth, nHeight, nPitch, pProjectionLine);
+	ProjectionColumnDirection(pImage, nWidth, nHeight, nPitch, pProjectionColumn);
+
+	memcpy(nLine, pProjectionLine, nHeight*sizeof(int));
+	memcpy(nColumn, pProjectionColumn, nWidth*sizeof(int));
+
+	if(NULL != pdCenterX)
+		*pdCenterX = SysmetricCorrelationSearch(pProjectionColumn, nWidth);
+
+	if(NULL != pdCenterY)
+		*pdCenterY = SysmetricCorrelationSearch(pProjectionLine, nHeight);
+
+	delete [] pProjectionLine;
+	delete [] pProjectionColumn;
+
+	return TRUE;
+}
+
+void CViewSettingNotch::ProjectionLineDirection( LPBYTE pImage, int nWidth, int nHeight, int nPitch, int *pProjectionResult )//20140611
+{
+	int iWidth;
+	int iHeight;
+	int nAddress=0;
+
+	int nSum;
+
+	for(iHeight=0 ; iHeight<nHeight ; iHeight++)
+	{
+		nSum = 0;
+		nAddress = nPitch*iHeight;
+		for(iWidth=0 ; iWidth<nWidth ; iWidth++)
+		{
+			nSum += *(pImage+nAddress+iWidth);
+		}
+		*(pProjectionResult+iHeight) = nSum;
+	}
+}
+
+void CViewSettingNotch::ProjectionColumnDirection( LPBYTE pImage, int nWidth, int nHeight, int nPitch, int *pProjectionResult )//20140611
+{
+	int iWidth;
+	int iHeight;
+	int nAddress=0;
+
+	int nSum;
+
+	for(iWidth=0 ; iWidth<nWidth ; iWidth++)
+	{
+		nSum = 0;
+		nAddress = iWidth;
+		for(iHeight=0 ; iHeight<nHeight ; iHeight++)
+		{
+			nSum += *(pImage+nAddress);
+			nAddress += nPitch;
+		}
+		*(pProjectionResult+iWidth) = nSum;
+	}
+}
+
+double CViewSettingNotch::SysmetricCorrelationSearch( int *pnData, int nData )//20140611
+{	
+	if(nData < 12)
+	{
+		return nData/2.;
+	}
+
+	int		nStart;
+	int		nEnd;
+
+	nStart = nData/4;
+	nEnd = nData*3/4;
+
+	int		iIndexDivision;
+	int		nLowMargin;
+	int		nHighMargin;
+	int		nMinimumMargin;
+
+	int		iIndex;
+
+	int		*pDataLow = (int *)malloc(nData/2*sizeof(int));
+	int		*pDataHigh = (int *)malloc(nData/2*sizeof(int));
+	double  *pdProfile = (double *)malloc(nData/2*sizeof(double));
+	memset(pdProfile, 0x00, nData/2*sizeof(double));
+
+	double	dScores[1000]={0,};
+	//	int		nLow[1000]={0,};
+	//	int		nHigh[1000]={0,};
+
+	for(iIndexDivision=nStart ; iIndexDivision<nEnd ; iIndexDivision++)
+	{
+		nLowMargin = iIndexDivision;
+		nHighMargin = nData-1-iIndexDivision;
+
+		nMinimumMargin = nData/4;
+		// 		if(nLowMargin>nHighMargin)
+		// 		{
+		// 			nMinimumMargin = nHighMargin;
+		// 		}
+		// 		else
+		// 		{
+		// 			nMinimumMargin = nLowMargin;
+		// 		}
+
+		//		memset(nLow, 0x00, 1000*sizeof(int));
+		//		memset(nHigh, 0x00, 1000*sizeof(int));
+
+		for(iIndex=0 ; iIndex<nMinimumMargin ; iIndex++)
+		{
+			//nLow[iIndex] = 
+			pDataLow[iIndex] = pnData[iIndexDivision-iIndex];
+			//nHigh[iIndex] = 
+			pDataHigh[iIndex] = pnData[iIndexDivision+iIndex];
+		}
+
+		pdProfile[iIndexDivision-nStart] = PEARSONCorrelationCoefficent(pDataLow, pDataHigh, nMinimumMargin);
+	}
+
+	memcpy(dScores, pdProfile, nData/2*sizeof(double));
+
+	int nMaxPosition = STATSGetMaxPosition(pdProfile, nData/2);
+	double dMaxPosition;
+
+	if(nMaxPosition==0)
+	{
+		dMaxPosition = 0;
+	}
+	else if(0 == pdProfile[nMaxPosition+1])
+	{
+		dMaxPosition = nMaxPosition;
+	}
+	else
+	{
+		dMaxPosition = ParabolicInterpolation(pdProfile[nMaxPosition-1], pdProfile[nMaxPosition], pdProfile[nMaxPosition+1], nMaxPosition);
+	}
+
+	delete [] pDataLow;
+	delete [] pDataHigh;
+
+	return (nStart+dMaxPosition+0.5);
+}
+
+double CViewSettingNotch::PEARSONCorrelationCoefficent( int *pSourceData, int *pDestinationData, int nData )//20140611
+{
+	//	assert(0 != nData);
+
+	double dSourceAverage = STATSGetMeanValue(pSourceData, nData);
+	double dDestinationAverage = STATSGetMeanValue(pSourceData, nData);
+	double dSourceDeviation;
+	double dDestinationDeviation;
+
+	double dNumeratorSummation = 0;
+	double dDenominatorSummation = 0;
+	double dSourceDeiviationSqureSummation = 0;
+	double dDestinationDeiviationSqureSummation = 0;
+
+	double dPearsonCorrelationCoefficent;
+
+	int		iIndex;
+	for(iIndex=0 ; iIndex<nData ; iIndex++)
+	{
+		dSourceDeviation = (float)(*(pSourceData+iIndex) - dSourceAverage);
+		dDestinationDeviation = (float)(*(pDestinationData+iIndex) - dDestinationAverage);
+
+		dNumeratorSummation += dSourceDeviation*dDestinationDeviation;
+		dSourceDeiviationSqureSummation += dSourceDeviation*dSourceDeviation;
+		dDestinationDeiviationSqureSummation += dDestinationDeviation*dDestinationDeviation;
+	}
+
+	dDenominatorSummation = sqrt(dSourceDeiviationSqureSummation*dDestinationDeiviationSqureSummation);
+
+	if(0 != dDenominatorSummation)
+		dPearsonCorrelationCoefficent = dNumeratorSummation/dDenominatorSummation;
+	else 
+		return 0;
+
+	return dPearsonCorrelationCoefficent;
+}
+
+double CViewSettingNotch::STATSGetMeanValue( int *pImageSource, int nDataCount )//20140611
+{
+	if(0 == nDataCount)
+		return 0;
+	else
+		return STATSGetSumValue(pImageSource, nDataCount)/(double)nDataCount;
+}
+
+double CViewSettingNotch::STATSGetSumValue( int *pImageSource, int nDataCount )
+{
+	int		iIndex;
+	double	dSumResult=0;
+
+	for(iIndex=0 ; iIndex<nDataCount ; iIndex++)
+	{
+		dSumResult += *(pImageSource+iIndex);
+	}
+
+	return dSumResult;
+}
+
+int CViewSettingNotch::STATSGetMaxPosition( double *pData, int nDataCount )//20140611
+{
+	double	dMax = *pData;
+	int		iIndex;
+	int		iMaxAddress=0;
+
+	for(iIndex=0 ; iIndex<nDataCount ; iIndex++)
+	{
+		if(*(pData+iIndex) > dMax)
+		{
+			dMax = *(pData+iIndex);
+			iMaxAddress = iIndex;
+		}
+	}
+
+	return iMaxAddress;
+}
+
+double CViewSettingNotch::ParabolicInterpolation( double dPrevious, double dCenter,double dNext,int nCenterX )//20140611
+{
+	double	dE;
+	double	dNumerator;
+	double	dDenominator;
+
+	dNumerator = dPrevious - dNext;
+	dDenominator = dPrevious + dNext - 2*dCenter;
+
+	if(0 == dDenominator) dDenominator = 0.0000001;
+	dE = 0.5*dNumerator/dDenominator;
+
+	return (double)(nCenterX + dE);
+}
+
+void CViewSettingNotch::ClickBtnNotchOk()
+{
+	UpdateDlgData();
+	m_pParent->PostMessage(UM_NOTCH_APPLY_RECIPE,NULL,NULL);
+	CDialog::OnOK();
+}
+
+
+void CViewSettingNotch::ClickBtnNotchCancel()
+{
+	CDialog::OnCancel();
+}
diff --git a/ENRIT/View/ViewSettingNotch.h b/ENRIT/View/ViewSettingNotch.h
new file mode 100644
index 0000000..757e629
--- /dev/null
+++ b/ENRIT/View/ViewSettingNotch.h
@@ -0,0 +1,118 @@
+#pragma once
+
+#include "General_Draw.h"
+#include "SlimScrollView.h"
+#include "ENRIT.h"
+#include "Global_Define.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+// CViewSettingNotch 措拳 惑磊涝聪促.
+
+#define PATH_NOTCH_IMAGE  _T("c:\\RCutProject\\Notch")
+
+#define		UM_NOTCH_APPLY_RECIPE					(WM_USER + 3001)
+
+class CViewSettingNotch : public CDialog
+{
+	DECLARE_DYNAMIC(CViewSettingNotch)
+
+public:
+	CViewSettingNotch(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewSettingNotch();
+
+	// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_NOTCH_SETTING };
+
+protected:
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.	
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);	
+	afx_msg void OnPaint();
+
+	afx_msg void OnBnClickedButNotchLoad();
+	afx_msg void OnBnClickedButNotchFindline();
+	afx_msg void OnBnClickedButNotchSelectline();
+	afx_msg void OnBnClickedButNotchFinalfind();
+	afx_msg void OnBnClickedButNotchSaveMaster();
+
+	afx_msg void OnBnClickedCheckUseNotchChipIns();
+	
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void				SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe);
+	void				UpdateDlgData();
+	void				SetIndex(int index){m_index = index;}
+	void				SetParent(CWnd *pWnd){m_pParent=pWnd;}
+
+protected:
+	void				SetControl();
+	void				InitImageControl();
+	void				ShowMainImage();
+	void				SetEnControl();
+	void				LoadMasterImage();
+	void				ShowMasterImage();
+
+	void				UpDateNotchData(BOOL bWrite);
+	void				Init_Grid();//20140528
+	void				Init_GridHeader();//20140528
+	void				FillGrid(BOOL bWrite,int nCurIdx);//20140528
+
+	void				LoadNotchCadImage();//20140528
+	void				DrawNotchInsPos();//20140528
+	int					FindNotchInsXPos(int nPosY);//20140528
+
+	BOOL				GetSymmetricPoint(LPBYTE pImage, int nWidth, int nHeight, int nPitch, double *pdCenterX, double *pdCenterY);//20140611
+	void				ProjectionLineDirection(LPBYTE pImage, int nWidth, int nHeight, int nPitch, int *pProjectionResult);//20140611
+	void				ProjectionColumnDirection(LPBYTE pImage, int nWidth, int nHeight, int nPitch, int *pProjectionResult);//20140611
+	double				SysmetricCorrelationSearch(int *pnData, int nData);//20140611
+	double				PEARSONCorrelationCoefficent(int *pSourceData, int *pDestinationData, int nData);//20140611
+	double				STATSGetMeanValue(int *pImageSource, int nDataCount);//20140611
+	double				STATSGetSumValue(int *pImageSource, int nDataCount);//20140611
+	int					STATSGetMaxPosition(double *pData, int nDataCount);//20140611
+	double				ParabolicInterpolation(double dPrevious, double dCenter,double dNext,int nCenterX);//20140611
+
+protected:
+	CFontControl		m_FontControl;
+	CBrushControl		m_pBrushControl;
+	CGridCtrl			m_ListNotchPos;//20140528
+
+	CUIPictureControl	m_uiTitle_1;
+	CUIPictureControl	m_uiTitle_2;
+	CUIPictureControl	m_uiTitle_3;//20140528
+	
+protected:
+	CGlassRecipe	*m_pGlassRecipe;
+	CGlassRecipe	m_DlgGlassRecipe;
+	CHardwareSettings	*m_pHardwareSetting;
+	CSlimScrollView		*m_pMainView;
+	CSlimScrollView		*m_pMasterView;
+	CSISImageBuffer		m_ImageMain;	
+	int					m_nCutListIdx;
+	CSISImageBuffer		m_ImageMaster[MAX_SCAN_COUNT];
+	std::multimap<int, CPoint> m_NotchInsPoint;//20140528
+	int					m_nNotchCadCenterX;//20140528
+	int					m_nNotchCadCenterY;//20140528
+	int					m_nAlignMark2CadCenter;//20140528
+	CWnd				*m_pParent;
+
+protected:
+	//CCCLabeling			m_pProcessLabel;
+
+public:
+	CComboBox			m_cboComp;
+	int					m_index;
+	afx_msg void OnBnClickedButNotchMarkLoad();
+	afx_msg void OnBnClickedButNotchMarkSaveMaster();
+	afx_msg void OnBnClickedButNotchPosAdd();//20140528
+	afx_msg void OnBnClickedButNotchPosDel();//20140528
+	afx_msg void OnListNotchPosClick(NMHDR *pNotifyStruct, LRESULT* pResult);//20140528
+	afx_msg void OnListNotchPosEdit(NMHDR *pNotifyStruct, LRESULT* pResult);//20140528
+	afx_msg LRESULT OnNotchInsPosAdd(WPARAM wParam, LPARAM lParam);//20140528
+	afx_msg LRESULT OnNotchInsPosMod(WPARAM wParam, LPARAM lParam);//20140528
+	afx_msg void OnBnClickedButNotchPosMod();//20140528
+	DECLARE_EVENTSINK_MAP()
+	void ClickBtnNotchOk();
+	void ClickBtnNotchCancel();
+};
diff --git a/ENRIT/View/ViewSettingSpline.cpp b/ENRIT/View/ViewSettingSpline.cpp
new file mode 100644
index 0000000..84d9927
--- /dev/null
+++ b/ENRIT/View/ViewSettingSpline.cpp
@@ -0,0 +1,999 @@
+// D:\01.WORK\Project\02. 2012\05. Edge Grinding\Source\RCut_Project\RecipeEditor\Dialog\DlgSettingGlass.cpp : 备泅 颇老涝聪促.
+//
+
+#include "stdafx.h"
+#include "ViewSettingSpline.h"
+
+
+const int SPLINE_COLUMN_COUNT = 9;
+const char* SPLINE_COLUMN_ITEM[SPLINE_COLUMN_COUNT] = {"No","Use","Ins.Dir","Start X","End X","Line Thres","Defect Thres","Skip Dist","Ins.Range"};
+const int SPLINE_COLUMN_WIDTH[SPLINE_COLUMN_COUNT] = {60,74,74,74,74,74,84,74,74};
+
+// CViewSettingSpline 措拳 惑磊涝聪促.
+
+IMPLEMENT_DYNAMIC(CViewSettingSpline, CDialog)
+	
+CViewSettingSpline::CViewSettingSpline(CWnd* pParent /*=NULL*/)
+	: CDialog(CViewSettingSpline::IDD, pParent)
+{
+	m_pHardwareSetting = NULL;
+	m_pGlassRecipe = NULL;
+	m_DlgGlassRecipe.Reset();
+	m_pMainView = NULL;
+	m_nCutListIdx = 0;
+	m_index = 0;
+}
+
+CViewSettingSpline::~CViewSettingSpline()
+{
+	if(m_pMainView != NULL)	
+	{		
+		m_pMainView=NULL;	
+	}
+}
+
+void CViewSettingSpline::DoDataExchange(CDataExchange* pDX)
+{
+	CSPLINE_PARM *pSpline = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+	
+	//STU_SPLINE_INS_PARM
+	DDX_Check(pDX,IDC_CHECK_USE_SPLINE,pSpline->GetSplineIns(m_index)->m_bSpline);
+
+	DDX_Text(pDX,IDC_EDIT_SPLINE_START_CORNER_R_RADIUS, pSpline->GetSplineIns(m_index)->m_nStartCornerRadius_um);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_START_CORNER_R_SIZE_Y, pSpline->GetSplineIns(m_index)->m_nStartCornerSize_Y);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_END_CORNER_R_RADIUS, pSpline->GetSplineIns(m_index)->m_nEndCornerRadius_um);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_END_CORNER_R_SIZE_Y, pSpline->GetSplineIns(m_index)->m_nEndCornerSize_Y);
+
+	DDX_Text(pDX,IDC_EDIT_START_CHAMFER_SIZE,pSpline->GetSplineIns(m_index)->m_nStartChamferSize);
+	DDX_Text(pDX,IDC_EDIT_END_CHAMFER_SIZE,pSpline->GetSplineIns(m_index)->m_nEndChamferSize);
+
+	DDX_Text(pDX,IDC_EDIT_SPLINE_JUDGE_DIST,pSpline->GetSplineIns(m_index)->m_DetMinDist);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_LINE_THRES,pSpline->GetSplineIns(m_index)->m_nLineThres);
+	DDX_Control(pDX, IDC_CBO_SPLINE_TYPE, m_cboComp);
+
+	DDX_Control(pDX,IDC_SPLINE_LIST,m_ListSplinePos);
+
+	DDX_Check(pDX,IDC_CHECK_USE_SPLINE2,pSpline->GetSplineIns(m_index)->m_bSplineCorner);
+
+	DDX_Check(pDX,IDC_CHECK_USE_SPLINECHIP,pSpline->GetSplineChipIns(m_index)->m_bSplineChip);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_CHIPSIZE_Y,pSpline->GetSplineChipIns(m_index)->m_nChipSize_Y);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_CHIPSIZE_X,pSpline->GetSplineChipIns(m_index)->m_nChipSize_X);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_CHIPINSAREA,pSpline->GetSplineChipIns(m_index)->m_nChipInsArea);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_CHIPTHRES_TOP,pSpline->GetSplineChipIns(m_index)->m_nChipThres);
+	DDX_Check(pDX,IDC_CHECK_USE_SP_COR_USE,pSpline->GetSplineChipIns(m_index)->m_bCornerUse);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_COR_THRES,pSpline->GetSplineChipIns(m_index)->m_nCornerThres);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_COR_RANGE,pSpline->GetSplineChipIns(m_index)->m_nCornerRange);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_CHIP_START_THETA,pSpline->GetSplineChipIns(m_index)->m_dChipStartTheta);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_CHIP_END_THETA,pSpline->GetSplineChipIns(m_index)->m_dChipEndTheta);
+	DDX_Text(pDX,IDC_EDIT_SPLINE_CHIP_DIST_THETA,pSpline->GetSplineChipIns(m_index)->m_dChipDistTheta);
+
+	DDX_Control(pDX, IDC_CHECK_SPLINE_CHIP_AND, m_ctrlJudgeAnd);
+
+	CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CViewSettingSpline, CDialog)	
+	ON_WM_SHOWWINDOW()
+	ON_CONTROL_RANGE(BN_CLICKED,IDC_BUT_SPLINE_IMAGE_MINUS,IDC_BUT_SPLINE_IMAGE_PLUS,OnBnClickZoomMode)
+	ON_WM_PAINT()
+	ON_BN_CLICKED(IDC_BUT_SPLINE_FINDLINE, &CViewSettingSpline::OnBnClickedButSplineFindline)
+	ON_BN_CLICKED(IDC_BUT_SPLINE_ORGIMAGE, &CViewSettingSpline::OnBnClickedButSplineOrgimage)
+	ON_BN_CLICKED(IDC_CHECK_USE_SPLINE,OnClickUseSpline)
+	ON_BN_CLICKED(IDC_CHECK_USE_SPLINE2,OnClickUseSpline2)
+	ON_BN_CLICKED(IDC_BUT_ADD_SPLINE_CHIP, &CViewSettingSpline::OnBnClickedButAddSplineChip)
+	ON_BN_CLICKED(IDC_BUT_DEL_SPLINE_CHIP, &CViewSettingSpline::OnBnClickedButDelSplineChip)
+	ON_BN_CLICKED(IDC_BUT_SPLINE_LOAD, &CViewSettingSpline::OnBnClickedButSplineLoad)
+	ON_BN_CLICKED(IDC_BUT_SPLINE_SELECTLINE, &CViewSettingSpline::OnBnClickedButSplineSelectline)
+	ON_BN_CLICKED(IDC_BUT_SPLINE_FINALFIND, &CViewSettingSpline::OnBnClickedButSplineFinalfind)
+	ON_BN_CLICKED(IDC_BUT_SPLINE_SAVE_RCUT_MASTER, &CViewSettingSpline::OnBnClickedButSplineSaveRcutMaster)
+	ON_BN_CLICKED(IDC_BUT_SPLINE_READ_MASTER, &CViewSettingSpline::OnBnClickedButSplineReadMaster)
+	ON_BN_CLICKED(IDC_BUT_SPLINE_INSPECTION, &CViewSettingSpline::OnBnClickedButSplineInspection)
+	ON_BN_CLICKED(IDC_BUT_SPLINE_READ_MASTER_C, &CViewSettingSpline::OnBnClickedButSplineReadMasterC)
+	ON_NOTIFY(NM_CLICK, IDC_SPLINE_LIST, OnListSplineClick)
+	ON_BN_CLICKED(IDC_CHECK_USE_SPLINECHIP, &CViewSettingSpline::OnBnClickedCheckUseSplinechip)
+	ON_BN_CLICKED(IDC_CHECK_USE_SP_COR_USE, &CViewSettingSpline::OnBnClickedCheckUseSplinechip)	
+END_MESSAGE_MAP()
+
+BEGIN_EVENTSINK_MAP(CViewSettingSpline, CDialog)
+	ON_EVENT(CViewSettingSpline, IDC_CHECK_SPLINE_CHIP_AND, DISPID_CLICK, CViewSettingSpline::ClickChkJudgeAndButton, VTS_NONE)
+	ON_EVENT(CViewSettingSpline, IDC_BTN_SPLINE_OK, DISPID_CLICK, CViewSettingSpline::ClickBtnSplineOk, VTS_NONE)
+	ON_EVENT(CViewSettingSpline, IDC_BTN_SPLINE_CANCEL, DISPID_CLICK, CViewSettingSpline::ClickBtnSplineCancel, VTS_NONE)
+END_EVENTSINK_MAP()
+
+BOOL CViewSettingSpline::OnInitDialog()
+{
+	CDialog::OnInitDialog();
+
+	InitImageControl();
+
+	SetControl();
+
+	Init_Grid();
+
+	return TRUE;  // 器目胶甫 牧飘费俊 汲沥窍瘤 臼栏搁 TRUE甫 馆券钦聪促.
+}
+
+BOOL CViewSettingSpline::PreTranslateMessage(MSG* pMsg) 
+{
+	if( pMsg->message == WM_KEYDOWN )
+	{
+		if(pMsg->wParam == VK_RETURN
+			|| pMsg->wParam == VK_ESCAPE )
+		{
+			::TranslateMessage(pMsg);
+			::DispatchMessage(pMsg);
+			return TRUE;                    // DO NOT process further
+		}
+	}
+
+	return CDialog::PreTranslateMessage(pMsg);
+}
+
+void CViewSettingSpline::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	if(bShow == TRUE)
+	{
+		UpDateSplineData(TRUE);
+		FillGrid(TRUE);
+		SetEnControl();		
+	}
+	else
+	{
+		UpdateDlgData();
+		GetParent()->PostMessage(UM_UPDATE_RECIPE,EM_SPLINE_RCP,NULL);
+	}
+}
+
+void CViewSettingSpline::SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe)
+{
+	m_pHardwareSetting = pHard;
+	m_pGlassRecipe = pRecipe;
+
+	if(m_pGlassRecipe != NULL)
+	{
+		m_DlgGlassRecipe = *m_pGlassRecipe;
+	}
+
+	UpDateSplineData(TRUE);
+	UpdateData(FALSE);
+	SetEnControl();
+	FillGrid(TRUE);	
+
+	CSPLINE_PARM *pSpline = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+
+	m_ctrlJudgeAnd.SetValue(!pSpline->GetSplineChipIns(m_index)->m_bChipJudgeAnd);
+}
+
+void CViewSettingSpline::ClickChkJudgeAndButton()
+{
+	UINT nID = GetFocus()->GetDlgCtrlID();
+
+	if (m_ctrlJudgeAnd.GetEnabled() != FALSE) {
+		m_ctrlJudgeAnd.SetEnabled(FALSE);
+	}
+	
+	CSPLINE_PARM *pSpline = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+
+	pSpline->GetSplineChipIns(m_index)->m_bChipJudgeAnd = !m_ctrlJudgeAnd.GetValue();	
+
+	if (m_ctrlJudgeAnd.GetEnabled() != TRUE) {
+		m_ctrlJudgeAnd.SetEnabled(TRUE);
+	}
+}
+
+void CViewSettingSpline::UpDateSplineData(BOOL bWrite)
+{
+	CSPLINE_PARM *pSpline = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+
+	if(bWrite == FALSE)
+	{	
+// 		if(pSpline->GetSplineIns(m_index)->m_bSpline == TRUE)
+// 			m_pGlassRecipe->m_GlassParm.m_GlassInsSetting[m_index].emSplineInsType = SP_INS_RCUT;
+// 		else if(pSpline->GetSplineIns(m_index)->m_bSplineCorner= TRUE)
+// 			m_pGlassRecipe->m_GlassParm.m_GlassInsSetting[m_index].emSplineInsType = SP_INS_CORNER;
+		
+		//pSpline->GetSplineIns(m_index)->m_emSPType = (EM_SPLINE_TYPE)m_cboComp.GetCurSel();
+		pSpline->GetSplineIns(m_index)->m_emSPType = EM_SP_RCUT;
+	}
+	else
+	{
+// 		if(m_pGlassRecipe->m_GlassParm.m_GlassInsSetting[m_index].emSplineInsType == SP_INS_RCUT)
+// 			pSpline->GetSplineIns(m_index)->m_bSpline = TRUE;
+// 		else if(m_pGlassRecipe->m_GlassParm.m_GlassInsSetting[m_index].emSplineInsType == SP_INS_CORNER)
+// 			pSpline->GetSplineIns(m_index)->m_bSplineCorner = TRUE;
+		
+		m_cboComp.SetCurSel((int)pSpline->GetSplineIns(m_index)->m_emSPType);
+		UpdateData(FALSE);
+	}
+}
+
+void CViewSettingSpline::UpdateDlgData()
+{
+	UpdateData(TRUE);
+	UpDateSplineData(FALSE);
+	FillGrid(FALSE);	
+
+	if(m_pGlassRecipe != NULL)
+	{
+		m_pGlassRecipe->m_InspectInfoParm.m_SplineParm.m_SP_InsParm[m_index] = m_DlgGlassRecipe.m_InspectInfoParm.m_SplineParm.m_SP_InsParm[m_index];
+		m_pGlassRecipe->m_InspectInfoParm.m_SplineParm.m_vecSplineChip[m_index] = m_DlgGlassRecipe.m_InspectInfoParm.m_SplineParm.m_vecSplineChip[m_index];
+		m_pGlassRecipe->m_InspectInfoParm.m_SplineParm.m_SP_ChipParm[m_index] = m_DlgGlassRecipe.m_InspectInfoParm.m_SplineParm.m_SP_ChipParm[m_index];
+	}
+}
+
+void CViewSettingSpline::SetControl()
+{
+	
+}
+
+void CViewSettingSpline::InitImageControl()
+{
+	CRect		crect;
+	CSize		sizeTotal;
+	((CWnd*)GetDlgItem(IDC_SPLINE_IMAGE))->GetWindowRect(&crect);		
+	ScreenToClient(&crect);
+
+	m_pMainView = new CSlimScrollView;
+	m_pMainView->Create(NULL, NULL, WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL, crect, this, IDC_SPLINE_IMAGE, NULL); 	
+	sizeTotal = CSize(2048,1024);	
+	m_pMainView->SetScrollSizes(MM_TEXT, sizeTotal);	
+	m_pMainView->InitGDI(sizeTotal.cx,sizeTotal.cy,FALSE);
+	m_pMainView->SetOrgImgSize(sizeTotal.cx,sizeTotal.cy);
+	m_pMainView->SetHWnd(this);
+	m_pMainView->SetSendMessage(FALSE);
+	m_pMainView->SetDrawRect(FALSE);
+	m_pMainView->SetZoomMode(TRUE);
+}
+
+// CViewSettingSpline 皋矫瘤 贸府扁涝聪促.
+
+void CViewSettingSpline::OnBnClickedButSplineLoad()
+{
+	CString strFileName,strpath;
+
+	strpath.Format(_T("D:\\Image\\scanimage\\*.bmp"));
+
+	// file select
+	CFileDialog	filedlg( TRUE, _T("*.bmp"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Image file (*.bmp)|*.bmp|"), NULL );
+	if(IDCANCEL == filedlg.DoModal())	
+		return;
+
+	strFileName = filedlg.GetPathName();
+	if(m_ImageMain.ReadFromFile(strFileName) == FALSE)
+	{
+		AfxMessageBox(_T("捞固瘤 颇老 佬扁 角菩!"));
+		return;
+	}
+	/*
+	strFileName = _T("D:\\Image\\test.bmp");
+	CBufferAttach		attach(strFileName);
+	attach.AttachToFile(m_ImageMain);
+	*/
+
+	ShowMainImage();
+}
+
+void CViewSettingSpline::ShowMainImage()
+{
+	if(m_ImageMain.IsValidBuffer() == FALSE || m_pMainView == NULL)
+	{
+		m_pMainView->ReleaseMemory();
+		m_pMainView->SetZoomMode(FALSE);
+		m_pMainView->InitGDI(2048,1024,FALSE);
+		m_pMainView->SetOrgImgSize(2048,1024);
+		m_pMainView->SetZoomMode(TRUE);
+		m_pMainView->SetDrawRect(FALSE);
+		m_pMainView->Invalidate(FALSE);
+		return;
+	}
+
+	m_pMainView->ReleaseMemory();	
+	m_pMainView->SetZoomMode(FALSE);
+	m_pMainView->InitGDI(m_ImageMain.GetDataWidth(),m_ImageMain.GetHeight(),FALSE);
+	m_pMainView->SetOrgImgSize(m_ImageMain.GetDataWidth(),m_ImageMain.GetHeight());
+	m_pMainView->SetDrawRect(FALSE);
+	m_pMainView->SetZoomMode(TRUE);
+
+	BYTE* pTgtBuf = m_pMainView->GetBuffer();	
+	if(pTgtBuf == NULL)
+	{
+		return;
+	}
+	CopyMemory(pTgtBuf,m_ImageMain.GetDataAddress(0,0),m_ImageMain.GetDataWidth()*m_ImageMain.GetHeight());
+
+	m_pMainView->SetScrollSizes(MM_TEXT, CSize(m_ImageMain.GetDataWidth(),m_ImageMain.GetHeight()));
+	m_pMainView->Invalidate(FALSE);
+}
+
+void CViewSettingSpline::OnBnClickZoomMode(UINT nID)
+{
+	if(m_pMainView == NULL)
+		return;
+
+	int		nCommand = nID-IDC_BUT_SPLINE_IMAGE_MINUS;
+
+	m_pMainView->SetZoomMode(TRUE);
+	switch(nCommand)
+	{
+	case 0: m_pMainView->SetMode(SLIM_MODE_ZOOMOUT);	break;		
+	case 1: m_pMainView->SetMode(SLIM_MODE_NORMAL); break;
+	case 2: m_pMainView->SetMode(SLIM_MODE_ZOOMIN); break;
+	}
+}
+void CViewSettingSpline::OnPaint()
+{
+	CPaintDC dc(this); // device context for painting
+	
+	CGeneralDraw			pDraw;
+
+	CUIPictureControl		uiTitle_1;
+
+	uiTitle_1.SetItemDefault(this,IDC_SPLINE_TITLE_1);
+	uiTitle_1.m_strData.Format(_T("Image Master Processing"));
+	uiTitle_1.m_FontOffset = CPoint(4,2);
+	pDraw.DrawPitureControl(uiTitle_1);	
+}
+
+void CViewSettingSpline::OnBnClickedButSplineFindline()
+{
+	if(m_ImageMain.IsValidBuffer() == FALSE || m_pMainView == NULL)
+		return;
+
+	BYTE* pTgtBuf = m_pMainView->GetBuffer();	
+	if(pTgtBuf == NULL)
+	{
+		return;
+	}
+	CopyMemory(pTgtBuf,m_ImageMain.GetDataAddress(0,0),m_ImageMain.GetWidth()*m_ImageMain.GetHeight());
+	
+	LPBYTE			lpImg = m_pMainView->GetBuffer();
+	CSize			szImg = m_pMainView->GetOrgImgSize();
+	CRect			rect(0,0,szImg.cx,szImg.cy);
+
+	if(lpImg == NULL)
+		return;
+
+	CSPLINE_PARM *pSpline = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+
+	UpdateData(TRUE);
+
+//	CGlassFind		glassFind;	
+//	glassFind.CannyEdgeProcessing(lpImg,rect,GM_Sobel,pSpline->m_FindThres[0]);
+//	glassFind.ThresholdProcessing(lpImg,szImg,85,0);
+
+	/*CString				strFile = "D:\\Image\\CannyEdge.bmp";
+	CBufferAttach		attach(strFile);
+	CSISBuffer		mosis(lpImg,szImg.cx,szImg.cy);
+	attach.AttachToFile(mosis);*/
+
+	m_pMainView->SetDrawRect(FALSE);
+	m_pMainView->Invalidate(FALSE);
+}
+
+void CViewSettingSpline::OnBnClickedButSplineSelectline()
+{
+	m_pMainView->SetDrawRect(TRUE);
+}
+
+void CViewSettingSpline::OnBnClickedButSplineFinalfind()
+{
+	LPBYTE			lpImg = m_pMainView->GetBuffer();
+	CSize			szImg = m_pMainView->GetOrgImgSize();	
+
+	if(lpImg == NULL)
+		return;
+	
+	const int		nOffset = 2;
+	CSISBuffer		lpOrg(lpImg,szImg.cx,szImg.cy);	
+	CRect			rect(nOffset,nOffset,szImg.cx-nOffset,szImg.cy-nOffset);	
+
+	int			nWidth = align_4byte(rect.Width());
+	rect.right = rect.left + nWidth;	
+
+	COwnerBuffer	lpBuffer(rect.Width(),rect.Height());
+	
+	lpBuffer.CopyBtoA(lpBuffer,0,0,lpOrg,rect);
+	
+	CSplineInspect		pLabeling(&lpBuffer);	
+	
+	if(pLabeling.FindCADLine() == TRUE)
+	{
+		std::multimap<int, CSplinePoint> *pPoint = pLabeling.GetSplinePos();								
+		if(pPoint != NULL)
+		{
+			m_pMainView->SetSplinePosition(pPoint,pLabeling.GetSplineOffset());					
+		}	
+	}
+		
+	m_pMainView->Invalidate(FALSE);
+}
+
+void CViewSettingSpline::OnBnClickedButSplineSaveRcutMaster()
+{	
+	CString				strFile;
+	std::multimap<int, CSplinePoint> *pPoint;
+	CPoint				pointOffset;
+
+	CString strSplineType;
+	CString strFileExtension;
+	CString strCutName;
+	CString	strSide;
+
+	switch((DimensionDir)m_index)
+	{
+	case DIMENSION_A:
+	case DIMENSION_A_DN:
+		strSide = _T("A");
+		break;
+	case DIMENSION_B:
+	case DIMENSION_B_DN:
+		strSide = _T("B");
+		break;
+	case DIMENSION_C:
+	case DIMENSION_C_DN:
+		strSide = _T("C");
+		break;
+	case DIMENSION_D:
+	case DIMENSION_D_DN:
+		strSide = _T("D");
+		break;
+	}
+
+// 	switch(m_cboComp.GetCurSel())
+// 	{
+// 	case 0: strSplineType = _T("CCUT"); strFileExtension = _T("ccut"); strCutName = _T("CCut"); break;
+// 	case 1: strSplineType = _T("RCUT"); strFileExtension = _T("rcut"); strCutName = _T("RCut"); break;
+// 	}
+
+	strSplineType = _T("RCUT");
+	strFileExtension = _T("rcut");
+	strCutName = _T("RCut");
+
+	CString strTemp;
+	strTemp.Format(_T("%s Save as Master Data?"),strSplineType);
+
+	pPoint = m_pMainView->GetSplinePos();	
+	pointOffset = m_pMainView->GetSplineOffset();
+
+	if(pPoint != NULL && (int)pPoint->size() > 0)
+	{
+		if(IDNO == AfxMessageBox(strTemp, MB_YESNO | MB_ICONQUESTION))
+			return;
+	}
+	else
+	{
+		AfxMessageBox(_T("No Data."));
+	}
+
+	CSplineInspect		pLabeling;
+	strFile.Format(_T("C:\\RCutProject\\Spline\\%s_%s_%s.%s"),m_pGlassRecipe->GetRecipeName(),strSplineType,strSide,strFileExtension);
+	/*
+	if(pLabeling.WriteModelData(strFile,m_pGlassRecipe->GetRecipeName(),strCutName,pPoint,pointOffset) == TRUE)
+	{
+		CString		strMsg;
+
+		strMsg.Format(_T("%s Save Success."),strFile);
+
+		strFile.Format(_T("C:\\RCutProject\\Spline\\%s_%s_%s.bmp"),m_pGlassRecipe->GetRecipeName(),strSplineType,strSide);
+		CBufferAttach		attach(strFile);
+		attach.AttachToFile(m_ImageMain);
+		
+		AfxMessageBox(strMsg);
+	}
+	else
+	{
+		AfxMessageBox(_T("No Data."));
+	}
+	*/
+}
+
+void CViewSettingSpline::OnBnClickedButSplineSaveCcutMaster()
+{
+	CString				strFile;
+	std::multimap<int, CSplinePoint> *pPoint;
+	CPoint				pointOffset;
+
+	pPoint = m_pMainView->GetSplinePos();	
+	pointOffset = m_pMainView->GetSplineOffset();
+
+	if(pPoint != NULL && (int)pPoint->size() > 0)
+	{
+		if(IDNO == AfxMessageBox(_T("C-Cut Save as Master Data?"), MB_YESNO | MB_ICONQUESTION))
+			return;
+	}
+	else
+	{
+		AfxMessageBox(_T("No Data."));
+	}
+
+	CSplineInspect		pLabeling;
+	strFile.Format(_T("C:\\RCutProject\\Spline\\%s_CCUT.ccut"),m_pGlassRecipe->GetRecipeName());
+	/*
+	if(pLabeling.WriteModelData(strFile,m_pGlassRecipe->GetRecipeName(),_T("CCut"),pPoint,pointOffset) == TRUE)
+	{
+		CString		strMsg;
+
+		strMsg.Format(_T("%s Save Success."),strFile);
+
+		strFile.Format(_T("C:\\RCutProject\\Spline\\%s_CCUT.bmp"),m_pGlassRecipe->GetRecipeName());
+		CBufferAttach		attach(strFile);
+		attach.AttachToFile(m_ImageMain);
+
+		AfxMessageBox(strMsg);
+	}
+	else
+	{
+		AfxMessageBox(_T("No Data."));
+	}
+	*/
+}
+
+void CViewSettingSpline::OnBnClickedButSplineOrgimage()
+{
+	ShowMainImage();
+}
+
+void CViewSettingSpline::OnClickUseSpline()
+{
+	UpdateData(TRUE);
+
+	CSPLINE_PARM *pSpline = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+
+	pSpline->GetSplineIns(m_index)->m_bSplineCorner = FALSE;
+
+	UpdateData(FALSE);
+
+	SetEnControl();
+}
+
+void CViewSettingSpline::OnClickUseSpline2()
+{
+	UpdateData(TRUE);
+
+	CSPLINE_PARM *pSpline = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+
+	pSpline->GetSplineIns(m_index)->m_bSpline = FALSE;
+	
+	UpdateData(FALSE);
+
+	SetEnControl();
+}
+
+void CViewSettingSpline::SetEnControl()
+{
+	return;
+
+	CSPLINE_PARM *pSpline = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+
+	((CWnd*)GetDlgItem(IDC_EDIT_SPLINE_YPOS))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);	
+	((CWnd*)GetDlgItem(IDC_EDIT_SPLINE_JUDGE_DIST))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);	
+	((CWnd*)GetDlgItem(IDC_EDIT_SPLINE_LINE_THRES))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+	((CWnd*)GetDlgItem(IDC_SPLINE_LIST))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+	((CWnd*)GetDlgItem(IDC_CBO_SPLINE_TYPE))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+
+	((CWnd*)GetDlgItem(IDC_BUT_ADD_SPLINE_CHIP))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+	((CWnd*)GetDlgItem(IDC_BUT_DEL_SPLINE_CHIP))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+	((CWnd*)GetDlgItem(IDC_BUT_SPLINE_LOAD))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+	((CWnd*)GetDlgItem(IDC_BUT_SPLINE_SELECTLINE))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+	((CWnd*)GetDlgItem(IDC_BUT_SPLINE_FINALFIND))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+	((CWnd*)GetDlgItem(IDC_BUT_SPLINE_SAVE_RCUT_MASTER))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);
+	
+	if(pSpline->GetSplineIns(m_index)->m_bSpline == FALSE)
+	{
+		pSpline->GetSplineChipIns(m_index)->m_bSplineChip = FALSE;
+		pSpline->GetSplineChipIns(m_index)->m_bCornerUse = FALSE;
+	}	
+
+	if(pSpline->GetSplineChipIns(m_index)->m_bSplineChip == FALSE)
+	{
+		pSpline->GetSplineChipIns(m_index)->m_bCornerUse = FALSE;
+	}
+
+	((CWnd*)GetDlgItem(IDC_CHECK_USE_SPLINECHIP))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline);	
+	//((CWnd*)GetDlgItem(IDC_EDIT_SPLINE_CHIPSIZE))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline&&pSpline->GetSplineChipIns(m_index)->m_bSplineChip);
+	((CWnd*)GetDlgItem(IDC_EDIT_SPLINE_CHIPINSAREA))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline&&pSpline->GetSplineChipIns(m_index)->m_bSplineChip);
+	((CWnd*)GetDlgItem(IDC_EDIT_SPLINE_CHIPTHRES_TOP))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline&&pSpline->GetSplineChipIns(m_index)->m_bSplineChip);
+	((CWnd*)GetDlgItem(IDC_CHECK_USE_SP_COR_USE))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline&&pSpline->GetSplineChipIns(m_index)->m_bSplineChip);
+	((CWnd*)GetDlgItem(IDC_EDIT_SPLINE_COR_THRES))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline&&pSpline->GetSplineChipIns(m_index)->m_bSplineChip&&pSpline->GetSplineChipIns(m_index)->m_bCornerUse);
+	((CWnd*)GetDlgItem(IDC_EDIT_SPLINE_COR_RANGE))->EnableWindow(pSpline->GetSplineIns(m_index)->m_bSpline&&pSpline->GetSplineChipIns(m_index)->m_bSplineChip&&pSpline->GetSplineChipIns(m_index)->m_bCornerUse);
+	UpdateData(FALSE);
+}
+
+void CViewSettingSpline::OnBnClickedButSplineReadMaster()
+{
+	CString		strFile;
+
+	strFile.Format(_T("C:\\RCutProject\\Spline\\%s_RCUT.rcut"),m_pGlassRecipe->GetRecipeName());
+// 	if(m_pProcessLabel.ReadModelData(strFile,m_pGlassRecipe->GetRecipeName()) == TRUE)
+// 		AfxMessageBox(_T("Read Success"));
+}
+
+void CViewSettingSpline::OnBnClickedButSplineInspection()
+{
+/*
+	UpdateData(TRUE);
+
+	CGlassFind		glassfind;
+	CSPLINE_PARM	*pSpline = &m_DlgGlassRecipe.m_SplineParm;
+	CETC_PARM		*pEtc = &m_DlgGlassRecipe.m_ETCParm;
+	CCUTAREA_PARM	*pCut =	&m_DlgGlassRecipe.m_CutAreaParm;
+	CRect			rect;
+	int				nLeftLine;
+
+	rect.left =  0;
+	rect.right = rect.left + pEtc->m_nGlassFindWidth_Left;
+	rect.top = m_ImageMain.GetHeight()-100;
+	rect.bottom = m_ImageMain.GetHeight();
+	nLeftLine = (int)glassfind.FindGlassHorizontalLine(m_ImageMain.GetDataAddress(0,0),CSize(m_ImageMain.GetDataWidth(),m_ImageMain.GetHeight()),rect,pEtc->m_nGlassFindthres_Left,TRUE);
+	if(nLeftLine <= 0)
+		return;
+
+	double			dResult[3];
+	SPLINE_ERR_MSG	enMsg;
+	COwnerBuffer	pOrg,pBin,pRes;
+	enMsg = m_pProcessLabel.InspectSpline("HpanelID","Cut",0,0,0,m_ImageMain,pSpline->m_FindThres[0],pSpline->m_DetMinDist,nLeftLine,0,dResult,pCut->m_bChipping
+		,pCut->m_nChippingInsArea,pCut->m_nChippingThres,pOrg,pBin,pRes,0);
+
+	int			nVCnt;
+	CSISBuffer *pInspectImg =	m_pProcessLabel.GetInspectImage(nVCnt);
+
+	glassfind.SetGlassScanRecipe(CSize(pInspectImg->GetDataWidth(),nVCnt),pCut->m_bCutArea,FALSE,50,pCut->m_nCutAreaDiff/10,pCut->m_nCutAreaDiff/10
+		,10,10,0,0,10);
+
+	rect = CRect(0,0,pInspectImg->GetDataWidth(),nVCnt);
+
+	COwnerBuffer		pInsOrg,pInsBin,pInsRes,pChipLeft,pChipRight;
+	glassfind.Inspection(pInspectImg->GetDataAddress(0,0),rect,0,0,pInsOrg,pInsBin,pInsRes,pChipLeft,pChipRight,*pInspectImg,FALSE,20,pCut->m_nChippingThres,FALSE);
+
+	std::vector<CChipBlob> *pResult = glassfind.GetBlobResult();
+	if((int)pResult->size() > 0)
+	{
+
+	}
+
+	CString			strFile,strFolder;
+
+	strFolder.Format("D:\\Image\\Spline");
+	CreateDirectory(strFolder,NULL);
+
+	strFile.Format("%s\\Spline_Org[%.3f].bmp",strFolder,dResult[2]);
+	CBufferAttach	attachOrg(strFile);
+	attachOrg.AttachToFile(pOrg);
+
+	strFile.Format("%s\\Spline_Tgt[%.3f].bmp",strFolder,dResult[2]);
+	CBufferAttach	attachBin(strFile);
+	attachBin.AttachToFile(pBin);
+
+	strFile.Format("%s\\Spline_Res[%.3f].bmp",strFolder,dResult[2]);
+	CBufferAttach	attachRes(strFile);
+	attachRes.AttachToFile(pRes);
+
+	strFile.Format("%s\\Spline_InsOrg.bmp",strFolder);
+	CBufferAttach	attach1(strFile);
+	attach1.AttachToFile(pInsOrg);
+
+	strFile.Format("%s\\Spline_InsBin.bmp",strFolder);
+	CBufferAttach	attach2(strFile);
+	attach2.AttachToFile(pInsBin);
+
+	strFile.Format("%s\\Spline_InsRes.bmp",strFolder);
+	CBufferAttach	attach3(strFile);
+	attach3.AttachToFile(pInsRes);
+
+	strFile.Format("%s\\Spline_ChipLeft.bmp",strFolder);
+	CBufferAttach	attach4(strFile);
+	attach4.AttachToFile(pChipLeft);
+
+	strFile.Format("%s\\Spline_ChipRight.bmp",strFolder);
+	CBufferAttach	attach5(strFile);
+	attach5.AttachToFile(pChipRight);
+
+	CString			str;
+	if(enMsg == SPLINE_INS_SUCESS)
+	{
+		str.Format("己傍 : min[%.2f],max[%.2f],avg[%.2f],avgThick[%.3f]",dResult[0],dResult[1],dResult[2],glassfind.GetAvgThick());
+		AfxMessageBox(str);
+	}
+	else
+	{		
+		switch(enMsg)
+		{
+		case ERR_SPLINE_EMPTYMASTER: str = "Master 绝澜"; break;
+		case ERR_SPLINE_EDGEPROCESS: str = "Edge 俊矾"; break;
+		case ERR_SPLINE_LABELPROCESS: str = "Label 俊矾"; break;
+		case ERR_SPLINE_LABELCOUNT: str = "Label Count 俊矾"; break;
+		case ERR_SPLINE_INDEXFIND: str = "Max Index Find 俊矾"; break;
+		case ERR_SPLINE_LABELPOSITION: str = "Label Position 俊矾"; break;
+		case ERR_SPLINE_POSITIONNULL: str = "Position Null"; break;	
+		case ERR_SPLINE_INS_CNT_SHORT: str = "line Count 何练"; break;	
+		default: str = "Error"; break;
+		}
+
+		AfxMessageBox(str);
+	}
+*/
+}
+
+void CViewSettingSpline::OnBnClickedButSplineReadMasterC()
+{
+	CString		strFile;
+
+	strFile.Format(_T("C:\\RCutProject\\Spline\\%s_CCUT.ccut"),m_pGlassRecipe->GetRecipeName());
+// 	if(m_pProcessLabel.ReadModelData(strFile,m_pGlassRecipe->GetRecipeName()) == TRUE)
+// 		AfxMessageBox(_T("Read Success"));
+}
+
+
+void CViewSettingSpline::Init_Grid()
+{
+	if(m_ListSplinePos.GetSafeHwnd() == NULL)
+		return;
+
+	m_ListSplinePos.GetDefaultCell(FALSE, FALSE)->SetBackClr(RGB(0xFF, 0xFF, 0xE0));
+	m_ListSplinePos.SetGridLines(GVL_BOTH);	
+
+	m_ListSplinePos.SetColumnCount(SPLINE_COLUMN_COUNT);
+	m_ListSplinePos.SetRowCount(10);
+	m_ListSplinePos.SetFixedRowCount(1);
+	m_ListSplinePos.SetFixedColumnCount(0);
+	//m_ListSplinePos.ExpandColumnsToFit();
+
+	CFont *pFont = m_ListSplinePos.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_ListSplinePos.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_ListSplinePos.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_ListSplinePos.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_ListSplinePos.SetEditable(TRUE);
+	m_ListSplinePos.EnableSelection(TRUE);
+
+	Init_GridHeader();
+}
+
+void CViewSettingSpline::Init_GridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<SPLINE_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = SPLINE_COLUMN_ITEM[iLoop];		
+		m_ListSplinePos.SetItem(&Item);
+		m_ListSplinePos.SetColumnWidth(Item.col,SPLINE_COLUMN_WIDTH[iLoop]);
+	}
+
+	m_ListSplinePos.Invalidate();
+}
+
+void CViewSettingSpline::FillGrid(BOOL bWrite)
+{
+	CSPLINE_PARM *pParm = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();
+	std::vector<STU_SPLINE_CHIP_POS>::iterator	it;
+	CString str;		
+	int		nCol = 0, nRow;
+	int		iLoop;		
+	STU_SPLINE_CHIP_POS stPos;
+	const   TCHAR* SET_USE_TYPE[2] = {_T("No Use"),_T("Use")};	
+	const   TCHAR* SET_INS_DIR[3] = {_T("X"),_T("Y"),_T("None")};	
+	CStringArray optUse,optIns;	
+	CGridCellCombo *pCell;
+
+	for(iLoop=0;iLoop<2;iLoop++)
+	{
+		optUse.Add(SET_USE_TYPE[iLoop]);
+	}
+
+	for(iLoop=0;iLoop<3;iLoop++)
+	{
+		optIns.Add(SET_INS_DIR[iLoop]);
+	}
+
+	if(bWrite == TRUE)
+	{
+		iLoop = 1;
+		m_ListSplinePos.SetRowCount((int)pParm->m_vecSplineChip[m_index].size()+1);
+		for(it=pParm->m_vecSplineChip[m_index].begin();it!=pParm->m_vecSplineChip[m_index].end();it++,iLoop++)
+		{				
+			stPos = *it;
+
+			nCol = 0;	
+			nRow = iLoop;
+			str.Format(_T("%d"),nRow);
+			m_ListSplinePos.SetItemText(nRow,nCol,str);
+			nCol++;			
+
+			if (!m_ListSplinePos.SetCellType(nRow,nCol, RUNTIME_CLASS(CGridCellCombo)))
+				continue;			
+
+			if(stPos.bUse == TRUE)
+				str.Format(_T("%s"),SET_USE_TYPE[1]);
+			else
+				str.Format(_T("%s"),SET_USE_TYPE[0]);			
+			m_ListSplinePos.SetItemText(nRow,nCol,str);		
+
+			pCell = (CGridCellCombo*) m_ListSplinePos.GetCell(nRow,nCol);
+			pCell->SetOptions(optUse);	
+			pCell->SetStyle(CBS_DROPDOWN);	
+			nCol++;			
+
+			if (!m_ListSplinePos.SetCellType(nRow,nCol, RUNTIME_CLASS(CGridCellCombo)))
+				continue;
+
+			str.Format(_T("%s"),SET_INS_DIR[stPos.emDir]);		
+			m_ListSplinePos.SetItemText(nRow,nCol,str);		
+
+			pCell = (CGridCellCombo*) m_ListSplinePos.GetCell(nRow,nCol);
+			pCell->SetOptions(optIns);	
+			pCell->SetStyle(CBS_DROPDOWN);	
+			nCol++;		
+
+			str.Format(_T("%d"),stPos.nStartX);
+			m_ListSplinePos.SetItemText(nRow,nCol,str);
+			nCol++;
+
+			str.Format(_T("%d"),stPos.nEndX);
+			m_ListSplinePos.SetItemText(nRow,nCol,str);
+			nCol++;
+		
+			str.Format(_T("%d"),stPos.nThres);
+			m_ListSplinePos.SetItemText(nRow,nCol,str);
+			nCol++;
+
+			str.Format(_T("%d"),stPos.nFindThres);
+			m_ListSplinePos.SetItemText(nRow,nCol,str);
+			nCol++;
+
+			str.Format(_T("%d"),stPos.nSkipDist);
+			m_ListSplinePos.SetItemText(nRow,nCol,str);
+			nCol++;
+
+			str.Format(_T("%d"),stPos.nInsRange);
+			m_ListSplinePos.SetItemText(nRow,nCol,str);
+			nCol++;
+				
+		}
+		m_ListSplinePos.Invalidate();		
+	}
+	else
+	{		
+		pParm->m_vecSplineChip[m_index].clear();
+		int nRowCnt = m_ListSplinePos.GetRowCount();
+		for(iLoop=1;iLoop<nRowCnt;iLoop++)
+		{		
+			nCol = 1;	
+			nRow = iLoop;	
+
+			stPos.emPos = STU_SPLINE_CHIP_POS::MAKE_IMAGE_POS_RCUT;
+
+			str = m_ListSplinePos.GetItemText(nRow,nCol);			
+			stPos.bUse = FALSE;
+			for(int i=0;i<optUse.GetCount();i++)
+			{
+				if(str.CollateNoCase(optUse.GetAt(i)) == 0)
+				{
+					stPos.bUse = (BOOL)i;
+					break;
+				}
+			}	
+			nCol++;		
+
+			str = m_ListSplinePos.GetItemText(nRow,nCol);	
+			stPos.emDir = STU_SPLINE_CHIP_POS::SPLINE_INS_DIRECTION_NONE;
+			for(int i=0;i<optIns.GetCount();i++)
+			{
+				if(str.CollateNoCase(optIns.GetAt(i)) == 0)
+				{
+					stPos.emDir = (STU_SPLINE_CHIP_POS::SPLINE_INS_DIRECTION)i;
+					break;
+				}
+			}	
+			nCol++;		
+
+			str = m_ListSplinePos.GetItemText(nRow,nCol);			
+			stPos.nStartX = _ttoi(str);
+			nCol++;
+
+			str = m_ListSplinePos.GetItemText(nRow,nCol);			
+			stPos.nEndX = _ttoi(str);	
+			nCol++;			
+
+			str = m_ListSplinePos.GetItemText(nRow,nCol);			
+			stPos.nThres = _ttoi(str);	
+			nCol++;
+
+			str = m_ListSplinePos.GetItemText(nRow,nCol);			
+			stPos.nFindThres = _ttoi(str);	
+			nCol++;
+
+			str = m_ListSplinePos.GetItemText(nRow,nCol);			
+			stPos.nSkipDist = _ttoi(str);	
+			nCol++;
+
+			str = m_ListSplinePos.GetItemText(nRow,nCol);			
+			stPos.nInsRange = _ttoi(str);	
+			nCol++;
+
+			stPos.emMethod = STU_SPLINE_CHIP_POS::MAKE_METHOD_REGRESSION;					
+
+			pParm->m_vecSplineChip[m_index].push_back(stPos);
+		}
+	}
+}
+void CViewSettingSpline::OnBnClickedButAddSplineChip()
+{
+	STU_SPLINE_CHIP_POS stPos;
+	CSPLINE_PARM *pParm = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();;
+
+	pParm->m_vecSplineChip[m_index].push_back(stPos);
+	FillGrid(TRUE);
+}
+
+void CViewSettingSpline::OnBnClickedButDelSplineChip()
+{
+	if(m_nCutListIdx <= 0 || m_nCutListIdx >= m_ListSplinePos.GetRowCount())
+		return;
+
+	if (IDNO == AfxMessageBox(_T("Delete Data?"), MB_YESNO | MB_ICONQUESTION))
+		return;	
+
+	int			nCnt;
+	CSPLINE_PARM *pParm = m_DlgGlassRecipe.m_InspectInfoParm.GetSplineParm();;
+	std::vector<STU_SPLINE_CHIP_POS>::iterator	it;
+
+	nCnt = 1;
+	for(it=pParm->m_vecSplineChip[m_index].begin();it!=pParm->m_vecSplineChip[m_index].end();it++,nCnt++)
+	{	
+		if(nCnt == m_nCutListIdx)
+		{
+			pParm->m_vecSplineChip[m_index].erase(it);
+			break;
+		}
+	}
+
+	FillGrid(TRUE);
+}
+
+void CViewSettingSpline::OnListSplineClick(NMHDR *pNotifyStruct, LRESULT* pResult)
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
+
+	if(pItem->iRow <= 0 || pItem->iRow > (int)m_ListSplinePos.GetRowCount())
+		return;
+
+	m_nCutListIdx = pItem->iRow;	
+
+	Invalidate(FALSE);
+}
+
+void CViewSettingSpline::OnBnClickedCheckUseSplinechip()
+{
+	UpdateData(TRUE);
+	 
+	SetEnControl();
+}
+
+void CViewSettingSpline::ClickBtnSplineOk()
+{
+	UpdateDlgData();
+	m_pParent->PostMessage(UM_SPLINE_APPLY_RECIPE,NULL,NULL);
+	CDialog::OnOK();
+}
+
+
+void CViewSettingSpline::ClickBtnSplineCancel()
+{
+	CDialog::OnCancel();
+}
diff --git a/ENRIT/View/ViewSettingSpline.h b/ENRIT/View/ViewSettingSpline.h
new file mode 100644
index 0000000..9f609ba
--- /dev/null
+++ b/ENRIT/View/ViewSettingSpline.h
@@ -0,0 +1,94 @@
+#pragma once
+
+#include "General_Draw.h"
+#include "SlimScrollView.h"
+#include "ENRIT.h"
+#include "btnenh.h"
+#include "HardwareSettings.h"
+#include "GlassRecipe.h"
+// CViewSettingSpline 措拳 惑磊涝聪促.
+
+#define		UM_SPLINE_APPLY_RECIPE					(WM_USER + 2001)
+
+class CViewSettingSpline : public CDialog
+{
+	DECLARE_DYNAMIC(CViewSettingSpline)
+
+public:
+	CViewSettingSpline(CWnd* pParent = NULL);   // 钎霖 积己磊涝聪促.
+	virtual ~CViewSettingSpline();
+
+// 措拳 惑磊 单捞磐涝聪促.
+	enum { IDD = IDD_DLG_SPLINE_SETTING };
+
+protected:
+	virtual BOOL OnInitDialog();
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 瘤盔涝聪促.	
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);	
+	afx_msg void OnBnClickedButSplineLoad();
+	afx_msg void OnBnClickZoomMode(UINT nID);
+	afx_msg void OnPaint();
+	afx_msg void OnBnClickedButSplineFindline();
+	afx_msg void OnBnClickedButSplineOrgimage();
+	afx_msg void OnClickUseSpline();
+	afx_msg void OnClickUseSpline2();
+	afx_msg void OnBnClickedButSplineSelectline();
+	afx_msg void OnBnClickedButSplineFinalfind();
+	afx_msg void OnBnClickedButSplineSaveRcutMaster();
+	afx_msg void OnBnClickedButSplineSaveCcutMaster();
+	afx_msg void OnListSplineClick(NMHDR *pNotifyStruct, LRESULT* pResult);
+	DECLARE_MESSAGE_MAP()
+	DECLARE_EVENTSINK_MAP()
+
+	void				ClickBtnSplineOk();
+	void				ClickBtnSplineCancel();
+
+public:
+	void				SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe);
+	void				UpdateDlgData();
+	void				SetIndex(int index){m_index = index;}
+	void				SetParent(CWnd *pWnd){m_pParent=pWnd;}
+
+protected:
+	void				SetControl();
+	void				InitImageControl();
+	void				ShowMainImage();
+	void				SetEnControl();
+
+	void				Init_Grid();
+	void				Init_GridHeader();
+	void				FillGrid(BOOL bWrite);
+
+	void				UpDateSplineData(BOOL bWrite);
+
+protected:
+	CFontControl		m_FontControl;
+	CBrushControl		m_pBrushControl;	
+	CGridCtrl			m_ListSplinePos;
+
+protected:
+	CGlassRecipe		*m_pGlassRecipe;
+	CGlassRecipe		m_DlgGlassRecipe;
+	CHardwareSettings	*m_pHardwareSetting;
+	CSlimScrollView		*m_pMainView;
+	CSISImageBuffer		m_ImageMain;	
+	int					m_nCutListIdx;
+	CWnd				*m_pParent;
+	CBtnEnh				m_ctrlJudgeAnd;
+
+protected:
+	CSplineInspect			m_pProcessLabel;
+		
+public:
+	afx_msg void OnBnClickedButSplineReadMaster();
+	afx_msg void OnBnClickedButSplineInspection();
+	afx_msg void OnBnClickedButSplineReadMasterC();
+	afx_msg void OnBnClickedButAddSplineChip();
+	afx_msg void OnBnClickedButDelSplineChip();
+	afx_msg void OnBnClickedCheckUseSplinechip();
+	void			ClickChkJudgeAndButton();
+	CComboBox			m_cboComp;
+	int					m_index;
+	
+};
diff --git a/ENRIT/View/ViewUserDefectArea.cpp b/ENRIT/View/ViewUserDefectArea.cpp
new file mode 100644
index 0000000..64604b8
--- /dev/null
+++ b/ENRIT/View/ViewUserDefectArea.cpp
@@ -0,0 +1,437 @@
+
+#include "stdafx.h"
+#include "ViewUserDefectArea.h"
+#include "afxdialogex.h"
+#include "Glass_Data.h"
+
+const int USERDEFECT_COLUMN_COUNT = 9;
+const char* USERDEFECT_COLUMN_ITEM[USERDEFECT_COLUMN_COUNT] = {"No","POS X","POS Y","AREA WIDTH","AREA HEIGHT","DEFECT WIDTH","DEFECT HEIGHT","THRESHOLD","DILATION"};
+const int USERDEFECT_COLUMN_WIDHT[USERDEFECT_COLUMN_COUNT] = {40,90,90,90,90,90,90,90,70};
+
+#define GRID_FIX_COLOR			RGB(144,200,246)
+#define GRID_COLOR				RGB(242,242,242)
+#define GRID_TEXT_COLOR			RGB(255,255,255)
+#define GRID_LINE_COLOR			GRID_FIX_COLOR
+
+IMPLEMENT_DYNAMIC(CViewUserDefectArea, CDialogEx)
+
+CViewUserDefectArea::CViewUserDefectArea(CWnd* pParent /*=NULL*/)
+	: CDialogEx(CViewUserDefectArea::IDD, pParent)		
+{
+	m_pGlassData = NULL;
+	m_pHardwareSetting = NULL;
+	m_pGlassRecipe = NULL;
+	m_pIU2P = NULL;
+	m_nSelectRow = -1;
+}
+
+CViewUserDefectArea::~CViewUserDefectArea()
+{
+	
+}
+
+void CViewUserDefectArea::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+
+	DDX_Control(pDX, IDC_EDIT_USER_DEFECT_AREA_WIDTH, m_EditDefectAreaWidth);
+	DDX_Control(pDX, IDC_EDIT_USER_DEFECT_AREA_HEIGHT, m_EditDefectAreaHeight);
+	DDX_Control(pDX, IDC_EDIT_USER_DEFECT_AREA_THRESHOLD, m_EditDefectAreaThreshold);
+	DDX_Control(pDX, IDC_EDIT_USER_DEFECT_AREA_DILATION, m_EditDefectAreaDilation);
+	DDX_Control(pDX, IDC_USERDEFECT_LIST, m_GrdUserDefect);
+
+	DDX_Text(pDX, IDC_EDIT_USER_DEFECT_AREA_WIDTH, m_stUserDefectArea.defect_width);
+	DDX_Text(pDX, IDC_EDIT_USER_DEFECT_AREA_HEIGHT, m_stUserDefectArea.defect_height);
+	DDX_Text(pDX, IDC_EDIT_USER_DEFECT_AREA_THRESHOLD, m_stUserDefectArea.defect_threshold);
+	DDX_Text(pDX, IDC_EDIT_USER_DEFECT_AREA_DILATION, m_stUserDefectArea.defect_dilation);
+}
+
+
+BEGIN_MESSAGE_MAP(CViewUserDefectArea, CDialogEx)
+	ON_WM_SHOWWINDOW()
+	ON_BN_CLICKED(IDC_BUTTON_USER_DEFECT_AREA_DRAW, &CViewUserDefectArea::OnBnClickedButtonUserDefectAreaDraw)
+	ON_BN_CLICKED(IDC_BUTTON_USER_DEFECT_AREA_ADD, &CViewUserDefectArea::OnBnClickedButtonUserDefectAreaAdd)
+	ON_BN_CLICKED(IDC_BUTTO_USER_DEFECT_AREA_SAVE, &CViewUserDefectArea::OnBnClickedButtoUserDefectAreaSave)
+	ON_BN_CLICKED(IDC_BUTTON_USER_DEFECT_AREA_MODIFY, &CViewUserDefectArea::OnBnClickedButtonUserDefectAreaModify)	
+	ON_BN_CLICKED(IDC_BUTTON_USER_DEFECT_AREA_DELETE, &CViewUserDefectArea::OnBnClickedButtonUserDefectAreaDelete)
+	ON_NOTIFY(NM_DBLCLK, IDC_USERDEFECT_LIST, OnGridDBClick)
+END_MESSAGE_MAP()
+
+void CViewUserDefectArea::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+	CDialogEx::OnShowWindow(bShow, nStatus);
+
+	if(bShow == TRUE)
+	{		
+		UpdateData(FALSE);
+		FillUserDefectGrid(TRUE);
+	}
+}
+
+void CViewUserDefectArea::SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe)
+{
+	m_pHardwareSetting = pHard;
+	m_pGlassRecipe = pRecipe;
+}
+
+void CViewUserDefectArea::SetIndex(int index)
+{
+	m_index = index;
+	FillUserDefectGrid(TRUE);
+}
+
+
+void CViewUserDefectArea::OnBnClickedButtonUserDefectAreaDraw()
+{	
+	if(m_pIU2P != NULL)
+	{
+		m_pIU2P->IU2P_DrawRect(TRUE);
+	}
+}
+
+void CViewUserDefectArea::OnBnClickedButtonUserDefectAreaAdd()
+{
+	if(m_pGlassData == NULL || m_pGlassRecipe == NULL)
+		return;
+
+	if(m_pIU2P != NULL)
+	{
+		CRect	rect =	m_pIU2P->IU2P_GetCompareRect();
+
+		INS_EDGE_RESULT_INFO *pResInfo = m_pGlassData->GetEdgeResultInfo((DimensionDir)m_index);
+		if(pResInfo == NULL)
+			return;
+
+		//if(pResInfo->ptMark[0].x > 0 && pResInfo->ptMark[0].y > 0)
+		{
+			ST_USER_DEFECT_AREA		stUserDefect;
+
+			stUserDefect.x = rect.left - static_cast<int>(pResInfo->ptMark[0].x);
+			stUserDefect.y = rect.top - static_cast<int>(pResInfo->ptMark[0].y);
+			stUserDefect.area_width = rect.Width();
+			stUserDefect.area_height = rect.Height();
+
+			USER_DEFECT_AREA_LIST *pList = m_pGlassRecipe->GetUserDefectList((DimensionDir)m_index);
+			if(pList == NULL)
+				return;
+
+			pList->push_back(stUserDefect);
+
+			FillUserDefectGrid(TRUE);
+
+			UpdateData(FALSE);
+		}
+
+		m_pIU2P->IU2P_DrawRect(FALSE);
+	}
+}
+
+
+BOOL CViewUserDefectArea::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	FONT_STYLE.CreateFont(14, 0, 0, 0, 300 , FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
+		DEFAULT_QUALITY, DEFAULT_PITCH | FF_ROMAN, _T("Arial"));
+
+	m_EditDefectAreaWidth.SetFont(&FONT_STYLE);
+	m_EditDefectAreaHeight.SetFont(&FONT_STYLE);
+	m_EditDefectAreaThreshold.SetFont(&FONT_STYLE);
+	m_EditDefectAreaDilation.SetFont(&FONT_STYLE);	
+
+	Init_UserDefectGrid();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+}
+
+
+void CViewUserDefectArea::OnBnClickedButtoUserDefectAreaSave()
+{
+	if(m_pGlassRecipe != NULL)
+	{
+		m_pGlassRecipe->SaveUserDefectList();
+		if(m_pIU2P != NULL)
+			m_pIU2P->IU2P_DrawRefresh();
+	}
+}
+
+
+void CViewUserDefectArea::OnBnClickedButtonUserDefectAreaModify()
+{
+	if(m_pGlassRecipe == NULL)
+		return;
+
+	if(m_nSelectRow < 0)
+		return;
+
+	USER_DEFECT_AREA_LIST *pList = m_pGlassRecipe->GetUserDefectList((DimensionDir)m_index);
+	if(pList == NULL)
+		return;
+
+	if((int)pList->size() < m_nSelectRow)
+		return;
+
+	itUSER_DEFECT_AREA_LIST it = pList->begin();
+
+	std::advance(it, m_nSelectRow-1);
+
+	UpdateData(TRUE);
+
+	it->defect_width = m_stUserDefectArea.defect_width;
+	it->defect_height = m_stUserDefectArea.defect_height;
+	it->defect_threshold = m_stUserDefectArea.defect_threshold;
+	it->defect_dilation = m_stUserDefectArea.defect_dilation;
+
+	m_pGlassRecipe->SaveUserDefectList();
+	FillUserDefectGrid(TRUE);
+
+	m_stUserDefectArea.defect_width = 0;
+	m_stUserDefectArea.defect_height = 0;
+	m_stUserDefectArea.defect_threshold = 0;
+	m_stUserDefectArea.defect_dilation = 0;
+
+	UpdateData(FALSE);
+
+}
+
+void CViewUserDefectArea::OnGridDBClick(NMHDR *pNotifyStruct, LRESULT* pResult)
+{
+	NM_GRIDVIEW* pItem = (NM_GRIDVIEW*) pNotifyStruct;
+	if (pItem->iRow < 0)
+		return;
+
+	m_nSelectRow = pItem->iRow;	
+
+	if(m_pGlassRecipe == NULL)
+		return;
+	
+	USER_DEFECT_AREA_LIST *pList = m_pGlassRecipe->GetUserDefectList((DimensionDir)m_index);
+	if(pList == NULL)
+		return;
+
+	if((int)pList->size() < m_nSelectRow)
+		return;
+
+	itUSER_DEFECT_AREA_LIST it = pList->begin();
+
+	std::advance(it, m_nSelectRow-1);	
+
+	m_stUserDefectArea.defect_width = it->defect_width;
+	m_stUserDefectArea.defect_height = it->defect_height;
+	m_stUserDefectArea.defect_threshold = it->defect_threshold;
+	m_stUserDefectArea.defect_dilation = it->defect_dilation;
+
+	UpdateData(FALSE);
+}
+
+void CViewUserDefectArea::OnBnClickedButtonUserDefectAreaDelete()
+{
+	if(m_pGlassRecipe == NULL)
+		return;
+
+	USER_DEFECT_AREA_LIST *pList = m_pGlassRecipe->GetUserDefectList((DimensionDir)m_index);
+	if(pList == NULL)
+		return;
+
+	if((int)pList->size() < m_nSelectRow)
+		return;
+
+	itUSER_DEFECT_AREA_LIST it = pList->begin();
+
+	std::advance(it, m_nSelectRow-1);	
+
+	pList->erase(it);
+
+	FillUserDefectGrid(TRUE);
+
+	m_pGlassRecipe->SaveUserDefectList();
+
+	m_stUserDefectArea.defect_width = 0;
+	m_stUserDefectArea.defect_height = 0;
+	m_stUserDefectArea.defect_threshold = 0;
+	m_stUserDefectArea.defect_dilation = 0;
+
+	UpdateData(FALSE);
+
+	if(m_pIU2P != NULL)
+	{
+		m_pIU2P->IU2P_DrawRefresh();
+	}
+}
+
+
+void CViewUserDefectArea::Init_UserDefectGrid()
+{
+	if(m_GrdUserDefect.GetSafeHwnd() == NULL)
+		return;
+
+	m_GrdUserDefect.GetDefaultCell(TRUE, FALSE)->SetBackClr(GRID_FIX_COLOR);
+	m_GrdUserDefect.GetDefaultCell(FALSE, TRUE)->SetBackClr(GRID_FIX_COLOR);
+	m_GrdUserDefect.GetDefaultCell(FALSE, FALSE)->SetBackClr(GRID_COLOR);
+	m_GrdUserDefect.SetFixedBkColor(GRID_FIX_COLOR);
+	m_GrdUserDefect.SetGridLines(GVL_BOTH);	
+
+	m_GrdUserDefect.SetColumnCount(USERDEFECT_COLUMN_COUNT);
+	m_GrdUserDefect.SetRowCount(10);
+	m_GrdUserDefect.SetFixedRowCount(1);
+	m_GrdUserDefect.SetFixedColumnCount(0);
+	m_GrdUserDefect.ExpandColumnsToFit();
+
+	CFont *pFont = m_GrdUserDefect.GetFont();
+	if (!pFont) 
+		return;
+
+	LOGFONT lf;	
+	pFont->GetLogFont(&lf);
+	lf.lfItalic = 0;
+	lf.lfHeight = 14;
+	lf.lfWeight = FW_BOLD;
+	_tcscpy(lf.lfFaceName, _T("Arial"));
+
+	m_GrdUserDefect.GetDefaultCell(TRUE, FALSE)->SetFont(&lf);
+	m_GrdUserDefect.GetDefaultCell(FALSE, TRUE)->SetFont(&lf);
+	m_GrdUserDefect.GetDefaultCell(TRUE, TRUE)->SetFont(&lf);	
+	m_GrdUserDefect.SetEditable(FALSE);
+	m_GrdUserDefect.SetSingleRowSelection(TRUE);
+	m_GrdUserDefect.EnableSelection(TRUE);
+
+	Init_UserDefectGridHeader();
+}
+
+void CViewUserDefectArea::Init_UserDefectGridHeader()
+{
+	CString str;	
+	GV_ITEM Item;	
+	int		nCol = 0;
+	int		iLoop;
+
+	Item.mask = GVIF_TEXT;	
+	Item.row = 0;
+	for(iLoop=0;iLoop<USERDEFECT_COLUMN_COUNT;iLoop++)
+	{
+		Item.col = nCol++;	
+		Item.strText = USERDEFECT_COLUMN_ITEM[iLoop];
+		m_GrdUserDefect.SetItem(&Item);	
+		m_GrdUserDefect.SetColumnWidth(Item.col,USERDEFECT_COLUMN_WIDHT[iLoop]);
+	}
+
+	m_GrdUserDefect.Invalidate();
+}
+
+void CViewUserDefectArea::FillUserDefectGrid(BOOL bWrite)
+{		
+	int			iRow,iCol;
+	CString		str;				
+
+	if(m_pGlassRecipe == NULL)
+		return;
+
+	itUSER_DEFECT_AREA_LIST		it;
+	USER_DEFECT_AREA_LIST		*pList = m_pGlassRecipe->GetUserDefectList((DimensionDir)m_index);
+	ST_USER_DEFECT_AREA			stUserDefect;
+
+	if(bWrite == TRUE)
+	{
+		m_GrdUserDefect.SetRowCount((int)pList->size()+1);			
+
+		iRow = 1;		
+
+		for(it=pList->begin();it!=pList->end();it++)
+		{
+			iCol = 0;
+
+			stUserDefect = *it;
+
+			str.Format(_T("%d"),iRow);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+
+			str.Format(_T("%d"),stUserDefect.x);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+
+			str.Format(_T("%d"),stUserDefect.y);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+			
+			str.Format(_T("%d"),stUserDefect.area_width);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+
+			str.Format(_T("%d"),stUserDefect.area_height);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+
+			str.Format(_T("%d"),stUserDefect.defect_width);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+
+			str.Format(_T("%d"),stUserDefect.defect_height);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+
+			str.Format(_T("%d"),stUserDefect.defect_threshold);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+
+			str.Format(_T("%d"),stUserDefect.defect_dilation);
+			m_GrdUserDefect.SetItemText(iRow,iCol,str);
+			iCol++;
+
+			iRow++;
+		}
+
+		m_GrdUserDefect.Invalidate();
+		
+	}
+	else
+	{
+		iRow = 1;
+		int			nRow = m_GrdUserDefect.GetRowCount();
+
+		pList->clear();
+
+		if(iRow <= nRow)
+			return;
+		
+		for(iRow=1;iRow<nRow;iRow++)
+		{			
+			iCol = 1;
+
+			stUserDefect.clear();
+
+			str = m_GrdUserDefect.GetItemText(iRow,iCol);
+			stUserDefect.x = _ttoi(str);
+			iCol++;
+
+			str = m_GrdUserDefect.GetItemText(iRow,iCol);
+			stUserDefect.y = _ttoi(str);
+			iCol++;
+
+			str = m_GrdUserDefect.GetItemText(iRow,iCol);
+			stUserDefect.area_width = _ttoi(str);
+			iCol++;
+
+			str = m_GrdUserDefect.GetItemText(iRow,iCol);
+			stUserDefect.area_height = _ttoi(str);
+			iCol++;
+
+			str = m_GrdUserDefect.GetItemText(iRow,iCol);
+			stUserDefect.defect_width = _ttoi(str);
+			iCol++;
+
+			str = m_GrdUserDefect.GetItemText(iRow,iCol);
+			stUserDefect.defect_height = _ttoi(str);
+			iCol++;
+
+			str = m_GrdUserDefect.GetItemText(iRow,iCol);
+			stUserDefect.defect_threshold = _ttoi(str);
+			iCol++;
+
+			str = m_GrdUserDefect.GetItemText(iRow,iCol);
+			stUserDefect.defect_dilation = _ttoi(str);
+			
+			pList->push_back(stUserDefect);
+		}
+	}
+}
\ No newline at end of file
diff --git a/ENRIT/View/ViewUserDefectArea.h b/ENRIT/View/ViewUserDefectArea.h
new file mode 100644
index 0000000..53624ce
--- /dev/null
+++ b/ENRIT/View/ViewUserDefectArea.h
@@ -0,0 +1,58 @@
+#pragma once
+
+#include <list>
+#include "afxwin.h"
+#include "afxcmn.h"
+#include "ENRIT.h"
+#include "Global_Define.h"
+#include "GlassRecipe.h"
+#include "HardwareSettings.h"
+
+class CViewUserDefectArea : public CDialogEx
+{
+	DECLARE_DYNAMIC(CViewUserDefectArea)
+
+public:
+	CViewUserDefectArea(CWnd* pParent = NULL);
+	virtual ~CViewUserDefectArea();
+
+	enum { IDD = IDD_DIALOG_USER_DEFECT_AREA };
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);
+	afx_msg void OnBnClickedButtonUserDefectAreaDraw();
+	afx_msg void OnBnClickedButtonUserDefectAreaAdd();	
+	virtual BOOL OnInitDialog();	
+	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+	afx_msg void OnBnClickedButtoUserDefectAreaSave();
+	afx_msg void OnBnClickedButtonUserDefectAreaModify();	
+	afx_msg void OnBnClickedButtonUserDefectAreaDelete();
+	afx_msg void OnGridDBClick(NMHDR *pNotifyStruct, LRESULT* pResult);
+	DECLARE_MESSAGE_MAP()
+
+public:
+	void				SetRecipe(CHardwareSettings *pHard,CGlassRecipe *pRecipe);	
+	void				SetIndex(int index);
+	void				SetIU2P(IUserDefectInterface2Parent *pIU2P){m_pIU2P=pIU2P;}
+	void				SetGlassData(CGlass_Data *pGlass){m_pGlassData=pGlass;}
+
+protected:
+	void				Init_UserDefectGrid();
+	void				Init_UserDefectGridHeader();		
+	void				FillUserDefectGrid(BOOL bWrite);	
+
+protected:
+	CGridCtrl			m_GrdUserDefect;
+	CHardwareSettings	*m_pHardwareSetting;
+	CGlassRecipe	*m_pGlassRecipe;	
+	CGlass_Data			*m_pGlassData;
+	int					m_index;	
+	IUserDefectInterface2Parent	*m_pIU2P;
+	CFont				FONT_STYLE;	
+	int					m_nSelectRow;
+	CEdit				m_EditDefectAreaWidth;
+	CEdit				m_EditDefectAreaHeight;
+	CEdit				m_EditDefectAreaThreshold;
+	CEdit				m_EditDefectAreaDilation;
+	ST_USER_DEFECT_AREA m_stUserDefectArea;
+};
diff --git a/ENRIT/res/BmpWarning.bmp b/ENRIT/res/BmpWarning.bmp
new file mode 100644
index 0000000..1ca9c3c
--- /dev/null
+++ b/ENRIT/res/BmpWarning.bmp
Binary files differ
diff --git a/ENRIT/res/Defect Image.bmp b/ENRIT/res/Defect Image.bmp
new file mode 100644
index 0000000..e815a82
--- /dev/null
+++ b/ENRIT/res/Defect Image.bmp
Binary files differ
diff --git a/ENRIT/res/ENRIT.ico b/ENRIT/res/ENRIT.ico
new file mode 100644
index 0000000..d56fbcd
--- /dev/null
+++ b/ENRIT/res/ENRIT.ico
Binary files differ
diff --git a/ENRIT/res/ENRIT.rc2 b/ENRIT/res/ENRIT.rc2
new file mode 100644
index 0000000..37dac3a
--- /dev/null
+++ b/ENRIT/res/ENRIT.rc2
Binary files differ
diff --git a/ENRIT/res/ENRITDoc.ico b/ENRIT/res/ENRITDoc.ico
new file mode 100644
index 0000000..96365d4
--- /dev/null
+++ b/ENRIT/res/ENRITDoc.ico
Binary files differ
diff --git a/ENRIT/res/ICON/CANCEL.ICO b/ENRIT/res/ICON/CANCEL.ICO
new file mode 100644
index 0000000..1aa70fc
--- /dev/null
+++ b/ENRIT/res/ICON/CANCEL.ICO
Binary files differ
diff --git a/ENRIT/res/ICON/LedOff.ico b/ENRIT/res/ICON/LedOff.ico
new file mode 100644
index 0000000..89c7611
--- /dev/null
+++ b/ENRIT/res/ICON/LedOff.ico
Binary files differ
diff --git a/ENRIT/res/ICON/LedOn.ico b/ENRIT/res/ICON/LedOn.ico
new file mode 100644
index 0000000..858d60f
--- /dev/null
+++ b/ENRIT/res/ICON/LedOn.ico
Binary files differ
diff --git a/ENRIT/res/ICON/MYSL.ICO b/ENRIT/res/ICON/MYSL.ICO
new file mode 100644
index 0000000..3bbf249
--- /dev/null
+++ b/ENRIT/res/ICON/MYSL.ICO
Binary files differ
diff --git a/ENRIT/res/ICON/OK.ICO b/ENRIT/res/ICON/OK.ICO
new file mode 100644
index 0000000..0e58410
--- /dev/null
+++ b/ENRIT/res/ICON/OK.ICO
Binary files differ
diff --git a/ENRIT/res/ICON/SETUP1.ICO b/ENRIT/res/ICON/SETUP1.ICO
new file mode 100644
index 0000000..5373820
--- /dev/null
+++ b/ENRIT/res/ICON/SETUP1.ICO
Binary files differ
diff --git a/ENRIT/res/ICON/add2.ico b/ENRIT/res/ICON/add2.ico
new file mode 100644
index 0000000..835ed97
--- /dev/null
+++ b/ENRIT/res/ICON/add2.ico
Binary files differ
diff --git a/ENRIT/res/ICON/arrow_down_blue.ico b/ENRIT/res/ICON/arrow_down_blue.ico
new file mode 100644
index 0000000..7629a48
--- /dev/null
+++ b/ENRIT/res/ICON/arrow_down_blue.ico
Binary files differ
diff --git a/ENRIT/res/ICON/arrow_left_blue.ico b/ENRIT/res/ICON/arrow_left_blue.ico
new file mode 100644
index 0000000..a3598e1
--- /dev/null
+++ b/ENRIT/res/ICON/arrow_left_blue.ico
Binary files differ
diff --git a/ENRIT/res/ICON/arrow_right_blue.ico b/ENRIT/res/ICON/arrow_right_blue.ico
new file mode 100644
index 0000000..7bf050c
--- /dev/null
+++ b/ENRIT/res/ICON/arrow_right_blue.ico
Binary files differ
diff --git a/ENRIT/res/ICON/arrow_up_blue.ico b/ENRIT/res/ICON/arrow_up_blue.ico
new file mode 100644
index 0000000..ccb129a
--- /dev/null
+++ b/ENRIT/res/ICON/arrow_up_blue.ico
Binary files differ
diff --git a/ENRIT/res/ICON/check.ico b/ENRIT/res/ICON/check.ico
new file mode 100644
index 0000000..139b4be
--- /dev/null
+++ b/ENRIT/res/ICON/check.ico
Binary files differ
diff --git a/ENRIT/res/ICON/check1.ico b/ENRIT/res/ICON/check1.ico
new file mode 100644
index 0000000..ba95955
--- /dev/null
+++ b/ENRIT/res/ICON/check1.ico
Binary files differ
diff --git a/ENRIT/res/ICON/check7.ico b/ENRIT/res/ICON/check7.ico
new file mode 100644
index 0000000..6ee3287
--- /dev/null
+++ b/ENRIT/res/ICON/check7.ico
Binary files differ
diff --git a/ENRIT/res/ICON/copy.ico b/ENRIT/res/ICON/copy.ico
new file mode 100644
index 0000000..dd28640
--- /dev/null
+++ b/ENRIT/res/ICON/copy.ico
Binary files differ
diff --git a/ENRIT/res/ICON/delete2.ico b/ENRIT/res/ICON/delete2.ico
new file mode 100644
index 0000000..961f35d
--- /dev/null
+++ b/ENRIT/res/ICON/delete2.ico
Binary files differ
diff --git a/ENRIT/res/ICON/edit.ico b/ENRIT/res/ICON/edit.ico
new file mode 100644
index 0000000..9166739
--- /dev/null
+++ b/ENRIT/res/ICON/edit.ico
Binary files differ
diff --git a/ENRIT/res/ICON/gear_preferences.ico b/ENRIT/res/ICON/gear_preferences.ico
new file mode 100644
index 0000000..224595f
--- /dev/null
+++ b/ENRIT/res/ICON/gear_preferences.ico
Binary files differ
diff --git a/ENRIT/res/ICON/gear_run.ico b/ENRIT/res/ICON/gear_run.ico
new file mode 100644
index 0000000..d9e8fd2
--- /dev/null
+++ b/ENRIT/res/ICON/gear_run.ico
Binary files differ
diff --git a/ENRIT/res/ICON/gear_stop.ico b/ENRIT/res/ICON/gear_stop.ico
new file mode 100644
index 0000000..e5b97ec
--- /dev/null
+++ b/ENRIT/res/ICON/gear_stop.ico
Binary files differ
diff --git a/ENRIT/res/ICON/ico00003.ico b/ENRIT/res/ICON/ico00003.ico
new file mode 100644
index 0000000..a96d772
--- /dev/null
+++ b/ENRIT/res/ICON/ico00003.ico
Binary files differ
diff --git a/ENRIT/res/ICON/ico00004.ico b/ENRIT/res/ICON/ico00004.ico
new file mode 100644
index 0000000..2acff2c
--- /dev/null
+++ b/ENRIT/res/ICON/ico00004.ico
Binary files differ
diff --git a/ENRIT/res/ICON/icon3.ico b/ENRIT/res/ICON/icon3.ico
new file mode 100644
index 0000000..4491986
--- /dev/null
+++ b/ENRIT/res/ICON/icon3.ico
Binary files differ
diff --git a/ENRIT/res/ICON/icon4.ico b/ENRIT/res/ICON/icon4.ico
new file mode 100644
index 0000000..da53d0b
--- /dev/null
+++ b/ENRIT/res/ICON/icon4.ico
Binary files differ
diff --git a/ENRIT/res/ICON/icon5.ico b/ENRIT/res/ICON/icon5.ico
new file mode 100644
index 0000000..a01b604
--- /dev/null
+++ b/ENRIT/res/ICON/icon5.ico
Binary files differ
diff --git a/ENRIT/res/ICON/idisk.ico b/ENRIT/res/ICON/idisk.ico
new file mode 100644
index 0000000..f0edb71
--- /dev/null
+++ b/ENRIT/res/ICON/idisk.ico
Binary files differ
diff --git a/ENRIT/res/ICON/load1.ico b/ENRIT/res/ICON/load1.ico
new file mode 100644
index 0000000..10ac33b
--- /dev/null
+++ b/ENRIT/res/ICON/load1.ico
Binary files differ
diff --git a/ENRIT/res/ICON/navigate_down.ico b/ENRIT/res/ICON/navigate_down.ico
new file mode 100644
index 0000000..122d30e
--- /dev/null
+++ b/ENRIT/res/ICON/navigate_down.ico
Binary files differ
diff --git a/ENRIT/res/ICON/navigate_left.ico b/ENRIT/res/ICON/navigate_left.ico
new file mode 100644
index 0000000..b5ec411
--- /dev/null
+++ b/ENRIT/res/ICON/navigate_left.ico
Binary files differ
diff --git a/ENRIT/res/ICON/navigate_right.ico b/ENRIT/res/ICON/navigate_right.ico
new file mode 100644
index 0000000..0a5ec6a
--- /dev/null
+++ b/ENRIT/res/ICON/navigate_right.ico
Binary files differ
diff --git a/ENRIT/res/ICON/navigate_up.ico b/ENRIT/res/ICON/navigate_up.ico
new file mode 100644
index 0000000..17c5e66
--- /dev/null
+++ b/ENRIT/res/ICON/navigate_up.ico
Binary files differ
diff --git a/ENRIT/res/ICON/replace248.ico b/ENRIT/res/ICON/replace248.ico
new file mode 100644
index 0000000..2e11c6c
--- /dev/null
+++ b/ENRIT/res/ICON/replace248.ico
Binary files differ
diff --git a/ENRIT/res/ICON/save1.ico b/ENRIT/res/ICON/save1.ico
new file mode 100644
index 0000000..2f16ae7
--- /dev/null
+++ b/ENRIT/res/ICON/save1.ico
Binary files differ
diff --git a/ENRIT/res/ICON/save_as.ico b/ENRIT/res/ICON/save_as.ico
new file mode 100644
index 0000000..63f7d9c
--- /dev/null
+++ b/ENRIT/res/ICON/save_as.ico
Binary files differ
diff --git a/ENRIT/res/ICON/view.ico b/ENRIT/res/ICON/view.ico
new file mode 100644
index 0000000..1a7bba4
--- /dev/null
+++ b/ENRIT/res/ICON/view.ico
Binary files differ
diff --git a/ENRIT/res/ICON/view_next.ico b/ENRIT/res/ICON/view_next.ico
new file mode 100644
index 0000000..a3e83f5
--- /dev/null
+++ b/ENRIT/res/ICON/view_next.ico
Binary files differ
diff --git a/ENRIT/res/ICON/view_previous.ico b/ENRIT/res/ICON/view_previous.ico
new file mode 100644
index 0000000..350db63
--- /dev/null
+++ b/ENRIT/res/ICON/view_previous.ico
Binary files differ
diff --git a/ENRIT/res/ICON/warning.ico b/ENRIT/res/ICON/warning.ico
new file mode 100644
index 0000000..5ade262
--- /dev/null
+++ b/ENRIT/res/ICON/warning.ico
Binary files differ
diff --git a/ENRIT/res/Load1_Nor.bmp b/ENRIT/res/Load1_Nor.bmp
new file mode 100644
index 0000000..28fbd04
--- /dev/null
+++ b/ENRIT/res/Load1_Nor.bmp
Binary files differ
diff --git a/ENRIT/res/Load1_Push.bmp b/ENRIT/res/Load1_Push.bmp
new file mode 100644
index 0000000..98c701e
--- /dev/null
+++ b/ENRIT/res/Load1_Push.bmp
Binary files differ
diff --git a/ENRIT/res/MenuBar.bmp b/ENRIT/res/MenuBar.bmp
new file mode 100644
index 0000000..608a063
--- /dev/null
+++ b/ENRIT/res/MenuBar.bmp
Binary files differ
diff --git a/ENRIT/res/RecipeList_LinkArrow.bmp b/ENRIT/res/RecipeList_LinkArrow.bmp
new file mode 100644
index 0000000..9dc8dcc
--- /dev/null
+++ b/ENRIT/res/RecipeList_LinkArrow.bmp
Binary files differ
diff --git a/ENRIT/res/Right_Arrow.bmp b/ENRIT/res/Right_Arrow.bmp
new file mode 100644
index 0000000..cca8a22
--- /dev/null
+++ b/ENRIT/res/Right_Arrow.bmp
Binary files differ
diff --git a/ENRIT/res/SIS_Splash.bmp b/ENRIT/res/SIS_Splash.bmp
new file mode 100644
index 0000000..133e9ea
--- /dev/null
+++ b/ENRIT/res/SIS_Splash.bmp
Binary files differ
diff --git a/ENRIT/res/Save1_Nor.bmp b/ENRIT/res/Save1_Nor.bmp
new file mode 100644
index 0000000..06fdef2
--- /dev/null
+++ b/ENRIT/res/Save1_Nor.bmp
Binary files differ
diff --git a/ENRIT/res/Save1_Push.bmp b/ENRIT/res/Save1_Push.bmp
new file mode 100644
index 0000000..5ede200
--- /dev/null
+++ b/ENRIT/res/Save1_Push.bmp
Binary files differ
diff --git a/ENRIT/res/bitmap1.bmp b/ENRIT/res/bitmap1.bmp
new file mode 100644
index 0000000..6a36826
--- /dev/null
+++ b/ENRIT/res/bitmap1.bmp
Binary files differ
diff --git a/ENRIT/res/bitmap_r.bmp b/ENRIT/res/bitmap_r.bmp
new file mode 100644
index 0000000..cca8a22
--- /dev/null
+++ b/ENRIT/res/bitmap_r.bmp
Binary files differ
diff --git a/ENRIT/res/bmp00001.bmp b/ENRIT/res/bmp00001.bmp
new file mode 100644
index 0000000..4919393
--- /dev/null
+++ b/ENRIT/res/bmp00001.bmp
Binary files differ
diff --git a/ENRIT/res/bmp00002.bmp b/ENRIT/res/bmp00002.bmp
new file mode 100644
index 0000000..d335498
--- /dev/null
+++ b/ENRIT/res/bmp00002.bmp
Binary files differ
diff --git a/ENRIT/res/bmp00003.bmp b/ENRIT/res/bmp00003.bmp
new file mode 100644
index 0000000..a0eb383
--- /dev/null
+++ b/ENRIT/res/bmp00003.bmp
Binary files differ
diff --git a/ENRIT/res/bmp00004.bmp b/ENRIT/res/bmp00004.bmp
new file mode 100644
index 0000000..6e8e840
--- /dev/null
+++ b/ENRIT/res/bmp00004.bmp
Binary files differ
diff --git a/ENRIT/res/bmpInfo.bmp b/ENRIT/res/bmpInfo.bmp
new file mode 100644
index 0000000..a4d15ea
--- /dev/null
+++ b/ENRIT/res/bmpInfo.bmp
Binary files differ
diff --git a/ENRIT/res/btn_load.bmp b/ENRIT/res/btn_load.bmp
new file mode 100644
index 0000000..99093d9
--- /dev/null
+++ b/ENRIT/res/btn_load.bmp
Binary files differ
diff --git a/ENRIT/res/buttons.bmp b/ENRIT/res/buttons.bmp
new file mode 100644
index 0000000..4cea2e0
--- /dev/null
+++ b/ENRIT/res/buttons.bmp
Binary files differ
diff --git a/ENRIT/res/check.bmp b/ENRIT/res/check.bmp
new file mode 100644
index 0000000..623610d
--- /dev/null
+++ b/ENRIT/res/check.bmp
Binary files differ
diff --git a/ENRIT/res/check32.bmp b/ENRIT/res/check32.bmp
new file mode 100644
index 0000000..8087414
--- /dev/null
+++ b/ENRIT/res/check32.bmp
Binary files differ
diff --git a/ENRIT/res/checkno.bmp b/ENRIT/res/checkno.bmp
new file mode 100644
index 0000000..c090e83
--- /dev/null
+++ b/ENRIT/res/checkno.bmp
Binary files differ
diff --git a/ENRIT/res/checkno32.bmp b/ENRIT/res/checkno32.bmp
new file mode 100644
index 0000000..4ed56b4
--- /dev/null
+++ b/ENRIT/res/checkno32.bmp
Binary files differ
diff --git a/ENRIT/res/filelarge.bmp b/ENRIT/res/filelarge.bmp
new file mode 100644
index 0000000..06e3778
--- /dev/null
+++ b/ENRIT/res/filelarge.bmp
Binary files differ
diff --git a/ENRIT/res/filesmall.bmp b/ENRIT/res/filesmall.bmp
new file mode 100644
index 0000000..ef481d3
--- /dev/null
+++ b/ENRIT/res/filesmall.bmp
Binary files differ
diff --git a/ENRIT/res/image.bmp b/ENRIT/res/image.bmp
new file mode 100644
index 0000000..b8c763b
--- /dev/null
+++ b/ENRIT/res/image.bmp
Binary files differ
diff --git a/ENRIT/res/listCell.bmp b/ENRIT/res/listCell.bmp
new file mode 100644
index 0000000..a7ade36
--- /dev/null
+++ b/ENRIT/res/listCell.bmp
Binary files differ
diff --git a/ENRIT/res/main.bmp b/ENRIT/res/main.bmp
new file mode 100644
index 0000000..9393d8e
--- /dev/null
+++ b/ENRIT/res/main.bmp
Binary files differ
diff --git a/ENRIT/res/play.bmp b/ENRIT/res/play.bmp
new file mode 100644
index 0000000..b019b45
--- /dev/null
+++ b/ENRIT/res/play.bmp
Binary files differ
diff --git a/ENRIT/res/play_hot.bmp b/ENRIT/res/play_hot.bmp
new file mode 100644
index 0000000..d160933
--- /dev/null
+++ b/ENRIT/res/play_hot.bmp
Binary files differ
diff --git a/ENRIT/res/propicons.bmp b/ENRIT/res/propicons.bmp
new file mode 100644
index 0000000..e904664
--- /dev/null
+++ b/ENRIT/res/propicons.bmp
Binary files differ
diff --git a/ENRIT/res/radio_of.bmp b/ENRIT/res/radio_of.bmp
new file mode 100644
index 0000000..5b59125
--- /dev/null
+++ b/ENRIT/res/radio_of.bmp
Binary files differ
diff --git a/ENRIT/res/radio_of32.bmp b/ENRIT/res/radio_of32.bmp
new file mode 100644
index 0000000..8e11940
--- /dev/null
+++ b/ENRIT/res/radio_of32.bmp
Binary files differ
diff --git a/ENRIT/res/radio_on.bmp b/ENRIT/res/radio_on.bmp
new file mode 100644
index 0000000..92cc528
--- /dev/null
+++ b/ENRIT/res/radio_on.bmp
Binary files differ
diff --git a/ENRIT/res/radio_on32.bmp b/ENRIT/res/radio_on32.bmp
new file mode 100644
index 0000000..49332bc
--- /dev/null
+++ b/ENRIT/res/radio_on32.bmp
Binary files differ
diff --git a/ENRIT/res/stop.bmp b/ENRIT/res/stop.bmp
new file mode 100644
index 0000000..7553a84
--- /dev/null
+++ b/ENRIT/res/stop.bmp
Binary files differ
diff --git a/ENRIT/res/stop_hot.bmp b/ENRIT/res/stop_hot.bmp
new file mode 100644
index 0000000..66a7b0c
--- /dev/null
+++ b/ENRIT/res/stop_hot.bmp
Binary files differ
diff --git a/ENRIT/res/writelarge.bmp b/ENRIT/res/writelarge.bmp
new file mode 100644
index 0000000..34a5de0
--- /dev/null
+++ b/ENRIT/res/writelarge.bmp
Binary files differ
diff --git a/ENRIT/res/writesmall.bmp b/ENRIT/res/writesmall.bmp
new file mode 100644
index 0000000..7260ef2
--- /dev/null
+++ b/ENRIT/res/writesmall.bmp
Binary files differ
diff --git "a/ENRIT/res/\346\227\203\346\216\252\356\237\262\351\234\233_ico" "b/ENRIT/res/\346\227\203\346\216\252\356\237\262\351\234\233_ico"
new file mode 100644
index 0000000..37bbfa7
--- /dev/null
+++ "b/ENRIT/res/\346\227\203\346\216\252\356\237\262\351\234\233_ico"
Binary files differ
diff --git "a/ENRIT/res/\354\271\264\353\251\224\353\235\274.ico" "b/ENRIT/res/\354\271\264\353\251\224\353\235\274.ico"
new file mode 100644
index 0000000..37bbfa7
--- /dev/null
+++ "b/ENRIT/res/\354\271\264\353\251\224\353\235\274.ico"
Binary files differ
diff --git a/ENRIT/resource.h b/ENRIT/resource.h
new file mode 100644
index 0000000..6609744
--- /dev/null
+++ b/ENRIT/resource.h
Binary files differ
diff --git a/ENRIT/stdafx.cpp b/ENRIT/stdafx.cpp
new file mode 100644
index 0000000..825fc17
--- /dev/null
+++ b/ENRIT/stdafx.cpp
@@ -0,0 +1,8 @@
+
+// stdafx.cpp : 钎霖 器窃 颇老父 甸绢 乐绰 家胶 颇老涝聪促.
+// ENRIT.pch绰 固府 哪颇老等 庆歹啊 邓聪促.
+// stdafx.obj俊绰 固府 哪颇老等 屈侥 沥焊啊 器窃邓聪促.
+
+#include "stdafx.h"
+
+
diff --git a/ENRIT/stdafx.h b/ENRIT/stdafx.h
new file mode 100644
index 0000000..ca8a4ab
--- /dev/null
+++ b/ENRIT/stdafx.h
@@ -0,0 +1,84 @@
+
+// stdafx.h : 磊林 荤侩窍瘤父 磊林 函版登瘤绰 臼绰
+// 钎霖 矫胶袍 器窃 颇老 棺 橇肺璃飘 包访 器窃 颇老捞 
+// 甸绢 乐绰 器窃 颇老涝聪促.
+
+#pragma once
+
+#ifndef _SECURE_ATL
+#define _SECURE_ATL 1
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 芭狼 荤侩登瘤 臼绰 郴侩篮 Windows 庆歹俊辑 力寇钦聪促.
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 老何 CString 积己磊绰 疙矫利栏肺 急攫邓聪促.
+
+// MFC狼 傍烹 何盒苞 公矫 啊瓷茄 版绊 皋矫瘤俊 措茄 见扁扁甫 秦力钦聪促.
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h>         // MFC 琴缴 棺 钎霖 备己 夸家涝聪促.
+#include <afxext.h>         // MFC 犬厘涝聪促.
+
+
+#include <afxdisp.h>        // MFC 磊悼拳 努贰胶涝聪促.
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // Internet Explorer 4 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>             // Windows 傍侩 牧飘费俊 措茄 MFC 瘤盔涝聪促.
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxcontrolbars.h>     // MFC狼 府夯 棺 牧飘费 阜措 瘤盔
+
+
+#include <afxsock.h>            // MFC 家南 犬厘
+
+#include "InspectionBase.h"
+#include "DisplayMessage.h"
+#include "StatusMonitor.h"
+#include "BICommon.h"
+
+#include "IncludeSDK.h"
+
+//#ifdef _DEBUG
+//#pragma comment(lib, "CHThreadPoolD.lib")
+//#pragma comment(lib, "SISControlsD.lib")
+//#pragma comment(lib, "ConfigFileManagerD.lib")
+//#pragma comment (lib, "SharedMapDllD.lib")
+//#pragma comment (lib, "SISBufferD.lib")
+//#pragma comment (lib, "EdgeInspectD.lib")
+//#pragma comment (lib, "SISAssemD.lib")
+//#pragma comment (lib, "CHImageBufferD.lib")
+//#pragma comment (lib, "FreeImage.lib")
+//#pragma comment(lib, "../Common_Class/OpenCV/opencv_3.1/lib/opencv_core310.lib")
+//#pragma comment(lib, "../Common_Class/OpenCV/opencv_3.1/lib/opencv_highgui310.lib")
+//#pragma comment(lib, "../Common_Class/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib")
+//#pragma comment(lib, "../Common_Class/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib")
+//#pragma comment (lib, "../Common_Class/EuresysCam/Lib/amd64/MultiCam.lib")
+//#else
+//#pragma comment(lib, "CHThreadPool.lib")
+//#pragma comment(lib, "SISControls.lib")
+//#pragma comment(lib, "ConfigFileManager.lib")
+//#pragma comment (lib, "SharedMapDll.lib")
+//#pragma comment (lib, "SISBuffer.lib")
+//#pragma comment (lib, "EdgeInspect.lib")
+//#pragma comment (lib, "SISAssem.lib")
+//#pragma comment (lib, "CHImageBuffer.lib")
+//#pragma comment (lib, "FreeImage.lib")
+//#pragma comment(lib, "../Common_Class/OpenCV/opencv_3.1/lib/opencv_core310.lib")
+//#pragma comment(lib, "../Common_Class/OpenCV/opencv_3.1/lib/opencv_highgui310.lib")
+//#pragma comment(lib, "../Common_Class/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib")
+//#pragma comment(lib, "../Common_Class/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib")
+//#pragma comment (lib, "../Common_Class/EuresysCam/Lib/amd64/MultiCam.lib")
+//#endif
+
+
+
+
diff --git a/ENRIT/targetver.h b/ENRIT/targetver.h
new file mode 100644
index 0000000..ad5ca61
--- /dev/null
+++ b/ENRIT/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// 器窃 SDKDDKVer.h绰 荤侩 啊瓷茄 Windows 敲阀汽 吝 滚傈捞 啊厘 臭篮 敲阀汽阑 沥狼钦聪促.
+
+// 捞傈 Windows 敲阀汽俊 措秦 览侩 橇肺弊伐阑 呼靛窍妨绰 版快俊绰 SDKDDKVer.h甫 器窃窍扁 傈俊
+// WinSDKVer.h甫 器窃窍绊 _WIN32_WINNT 概农肺甫 瘤盔窍妨绰 敲阀汽栏肺 汲沥窍绞矫坷.
+
+#include <SDKDDKVer.h>
diff --git a/ENRUTResources_zh-CN/ENRUTResources_zh-CN.cpp b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.cpp
new file mode 100644
index 0000000..2a8cdae
--- /dev/null
+++ b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.cpp
@@ -0,0 +1,64 @@
+锘�// ENRUTResources_zh-CN.cpp: 瀹氫箟 DLL 鐨勫垵濮嬪寲渚嬬▼銆�
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "ENRUTResources_zh-CN.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+//
+//TODO:  濡傛灉姝� DLL 鐩稿浜� MFC DLL 鏄姩鎬侀摼鎺ョ殑锛�
+//		鍒欎粠姝� DLL 瀵煎嚭鐨勪换浣曡皟鍏�
+//		MFC 鐨勫嚱鏁板繀椤诲皢 AFX_MANAGE_STATE 瀹忔坊鍔犲埌
+//		璇ュ嚱鏁扮殑鏈�鍓嶉潰銆�
+//
+//		渚嬪: 
+//
+//		extern "C" BOOL PASCAL EXPORT ExportedFunction()
+//		{
+//			AFX_MANAGE_STATE(AfxGetStaticModuleState());
+//			// 姝ゅ涓烘櫘閫氬嚱鏁颁綋
+//		}
+//
+//		姝ゅ畯鍏堜簬浠讳綍 MFC 璋冪敤
+//		鍑虹幇鍦ㄦ瘡涓嚱鏁颁腑鍗佸垎閲嶈銆�  杩欐剰鍛崇潃
+//		瀹冨繀椤讳綔涓轰互涓嬮」涓殑绗竴涓鍙�:
+//		鍑虹幇锛岀敋鑷冲厛浜庢墍鏈夊璞″彉閲忓0鏄庯紝
+//		杩欐槸鍥犱负瀹冧滑鐨勬瀯閫犲嚱鏁板彲鑳界敓鎴� MFC
+//		DLL 璋冪敤銆�
+//
+//		鏈夊叧鍏朵粬璇︾粏淇℃伅锛�
+//		璇峰弬闃� MFC 鎶�鏈鏄� 33 鍜� 58銆�
+//
+
+// CENRUTResourceszhCNApp
+
+BEGIN_MESSAGE_MAP(CENRUTResourceszhCNApp, CWinApp)
+END_MESSAGE_MAP()
+
+
+// CENRUTResourceszhCNApp 鏋勯��
+
+CENRUTResourceszhCNApp::CENRUTResourceszhCNApp()
+{
+	// TODO:  鍦ㄦ澶勬坊鍔犳瀯閫犱唬鐮侊紝
+	// 灏嗘墍鏈夐噸瑕佺殑鍒濆鍖栨斁缃湪 InitInstance 涓�
+}
+
+
+// 鍞竴鐨� CENRUTResourceszhCNApp 瀵硅薄
+
+CENRUTResourceszhCNApp theApp;
+
+
+// CENRUTResourceszhCNApp 鍒濆鍖�
+
+BOOL CENRUTResourceszhCNApp::InitInstance()
+{
+	CWinApp::InitInstance();
+
+	return TRUE;
+}
diff --git a/ENRUTResources_zh-CN/ENRUTResources_zh-CN.def b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.def
new file mode 100644
index 0000000..012896d
--- /dev/null
+++ b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.def
@@ -0,0 +1,6 @@
+锘�; ENRUTResources_zh-CN.def: 澹版槑 DLL 鐨勬ā鍧楀弬鏁般��
+
+LIBRARY
+
+EXPORTS
+    ; 姝ゅ鍙互鏄樉寮忓鍑�
diff --git a/ENRUTResources_zh-CN/ENRUTResources_zh-CN.h b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.h
new file mode 100644
index 0000000..43e9695
--- /dev/null
+++ b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.h
@@ -0,0 +1,27 @@
+锘�// ENRUTResources_zh-CN.h: ENRUTResources_zh-CN DLL 鐨勪富鏍囧ご鏂囦欢
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "鍦ㄥ寘鍚鏂囦欢涔嬪墠鍖呭惈 'pch.h' 浠ョ敓鎴� PCH"
+#endif
+
+#include "resource.h"		// 涓荤鍙�
+
+
+// CENRUTResourceszhCNApp
+// 鏈夊叧姝ょ被瀹炵幇鐨勪俊鎭紝璇峰弬闃� ENRUTResources_zh-CN.cpp
+//
+
+class CENRUTResourceszhCNApp : public CWinApp
+{
+public:
+	CENRUTResourceszhCNApp();
+
+// 閲嶅啓
+public:
+	virtual BOOL InitInstance();
+
+	DECLARE_MESSAGE_MAP()
+};
diff --git a/ENRUTResources_zh-CN/ENRUTResources_zh-CN.rc b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.rc
new file mode 100644
index 0000000..40a6818
--- /dev/null
+++ b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.rc
Binary files differ
diff --git a/ENRUTResources_zh-CN/ENRUTResources_zh-CN.vcxproj b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.vcxproj
new file mode 100644
index 0000000..ffeab3c
--- /dev/null
+++ b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.vcxproj
@@ -0,0 +1,292 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>17.0</VCProjectVersion>
+    <ProjectGuid>{3BFA9C33-C5B7-44F8-8DAA-95414BE3213A}</ProjectGuid>
+    <Keyword>MFCDLLProj</Keyword>
+    <RootNamespace>ENRUTResourceszhCN</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\ENRUTResources_zh-CN.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <ModuleDefinitionFile>.\ENRUTResources_zh-CN.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <ModuleDefinitionFile>.\ENRUTResources_zh-CN.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <ModuleDefinitionFile>.\ENRUTResources_zh-CN.def</ModuleDefinitionFile>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="ENRUTResources_zh-CN.cpp" />
+    <ClCompile Include="pch.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ENRUTResources_zh-CN.def" />
+    <None Include="res\ENRUTResources_zh-CN.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="ENRUTResources_zh-CN.h" />
+    <ClInclude Include="framework.h" />
+    <ClInclude Include="pch.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="ENRUTResources_zh-CN.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\bitmap_d.bmp" />
+    <Image Include="res\bitmap_w.bmp" />
+    <Image Include="res\bmp00004.bmp" />
+    <Image Include="res\bmp00005.bmp" />
+    <Image Include="res\bmp00006.bmp" />
+    <Image Include="res\bmp00007.bmp" />
+    <Image Include="res\bmp00008.bmp" />
+    <Image Include="res\bmp00009.bmp" />
+    <Image Include="res\bmp00010.bmp" />
+    <Image Include="res\bmp00011.bmp" />
+    <Image Include="res\bmp00012.bmp" />
+    <Image Include="res\bmp00013.bmp" />
+    <Image Include="res\bmp00014.bmp" />
+    <Image Include="res\bmp00015.bmp" />
+    <Image Include="res\bmp00016.bmp" />
+    <Image Include="res\bmp00017.bmp" />
+    <Image Include="res\bmp00018.bmp" />
+    <Image Include="res\bmp00019.bmp" />
+    <Image Include="res\bmp00020.bmp" />
+    <Image Include="res\bmp00021.bmp" />
+    <Image Include="res\bmp00022.bmp" />
+    <Image Include="res\bmp00023.bmp" />
+    <Image Include="res\bmp00024.bmp" />
+    <Image Include="res\bmp00025.bmp" />
+    <Image Include="res\bmp00026.bmp" />
+    <Image Include="res\bmp_info.bmp" />
+    <Image Include="res\btn_save.bmp" />
+    <Image Include="res\checkno3.bmp" />
+    <Image Include="res\filelarg.bmp" />
+    <Image Include="res\filesmal.bmp" />
+    <Image Include="res\icon\ico00001.ico" />
+    <Image Include="res\icon\ico00002.ico" />
+    <Image Include="res\icon\ico00005.ico" />
+    <Image Include="res\icon\ico00006.ico" />
+    <Image Include="res\icon\ico00007.ico" />
+    <Image Include="res\icon\ico00008.ico" />
+    <Image Include="res\icon\ico00009.ico" />
+    <Image Include="res\icon\ico00010.ico" />
+    <Image Include="res\icon\ico00011.ico" />
+    <Image Include="res\icon\ico00012.ico" />
+    <Image Include="res\icon\ico00013.ico" />
+    <Image Include="res\icon\ico00014.ico" />
+    <Image Include="res\icon\ico00015.ico" />
+    <Image Include="res\icon\icon_add.ico" />
+    <Image Include="res\icon\icon_app.ico" />
+    <Image Include="res\icon\icon_arr.ico" />
+    <Image Include="res\icon\icon_can.ico" />
+    <Image Include="res\icon\icon_cha.ico" />
+    <Image Include="res\icon\icon_chk.ico" />
+    <Image Include="res\icon\icon_ck_.ico" />
+    <Image Include="res\icon\icon_cop.ico" />
+    <Image Include="res\icon\icon_del.ico" />
+    <Image Include="res\icon\icon_dis.ico" />
+    <Image Include="res\icon\icon_dow.ico" />
+    <Image Include="res\icon\icon_edi.ico" />
+    <Image Include="res\icon\icon_gea.ico" />
+    <Image Include="res\icon\icon_lef.ico" />
+    <Image Include="res\icon\icon_loa.ico" />
+    <Image Include="res\icon\icon_pc.ico" />
+    <Image Include="res\icon\icon_rep.ico" />
+    <Image Include="res\icon\icon_rig.ico" />
+    <Image Include="res\icon\icon_sav.ico" />
+    <Image Include="res\icon\icon_up.ico" />
+    <Image Include="res\icon\icon_up_.ico" />
+    <Image Include="res\icon\icon_vie.ico" />
+    <Image Include="res\icon\icon_war.ico" />
+    <Image Include="res\icon\idr_enri.ico" />
+    <Image Include="res\icon\idr_main.ico" />
+    <Image Include="res\icon\led_off.ico" />
+    <Image Include="res\icon\led_on.ico" />
+    <Image Include="res\led_off.bmp" />
+    <Image Include="res\led_on.bmp" />
+    <Image Include="res\list_cel.bmp" />
+    <Image Include="res\menu_bar.bmp" />
+    <Image Include="res\propicon.bmp" />
+    <Image Include="res\splash.bmp" />
+    <Image Include="res\writelar.bmp" />
+    <Image Include="res\writesma.bmp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/ENRUTResources_zh-CN/ENRUTResources_zh-CN.vcxproj.filters b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.vcxproj.filters
new file mode 100644
index 0000000..af83b70
--- /dev/null
+++ b/ENRUTResources_zh-CN/ENRUTResources_zh-CN.vcxproj.filters
@@ -0,0 +1,291 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="ENRUTResources_zh-CN.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="pch.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="ENRUTResources_zh-CN.def">
+      <Filter>婧愭枃浠�</Filter>
+    </None>
+    <None Include="res\ENRUTResources_zh-CN.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="framework.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="ENRUTResources_zh-CN.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="pch.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="ENRUTResources_zh-CN.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\writesma.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\writelar.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00026.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00025.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\splash.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00024.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00023.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00022.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00021.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\propicon.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00020.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00019.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\menu_bar.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00018.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\list_cel.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\led_on.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\led_off.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00017.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\filesmal.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\filelarg.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\checkno3.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00016.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00015.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00014.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00013.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00012.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00011.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\btn_save.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00010.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00009.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00008.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00007.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp_info.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bitmap_w.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00006.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00005.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bmp00004.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\bitmap_d.bmp">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\idr_main.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\idr_enri.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\led_on.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\led_off.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_war.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00015.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00014.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_vie.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_up_.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_up.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_sav.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_rig.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_rep.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_pc.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00013.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_loa.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00012.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_lef.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00011.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00010.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_gea.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_edi.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_dow.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00009.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_dis.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_del.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_cop.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_ck_.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00008.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00007.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00006.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_chk.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_cha.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_can.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00005.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00002.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\ico00001.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_arr.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_app.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+    <Image Include="res\icon\icon_add.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/ENRUTResources_zh-CN/framework.h b/ENRUTResources_zh-CN/framework.h
new file mode 100644
index 0000000..610704b
--- /dev/null
+++ b/ENRUTResources_zh-CN/framework.h
@@ -0,0 +1,35 @@
+锘�#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 浠� Windows 澶翠腑鎺掗櫎鏋佸皯浣跨敤鐨勮祫鏂�
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 鏌愪簺 CString 鏋勯�犲嚱鏁板皢鏄樉寮忕殑
+
+#include <afxwin.h>         // MFC 鏍稿績缁勪欢鍜屾爣鍑嗙粍浠�
+#include <afxext.h>         // MFC 鎵╁睍
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h>         // MFC OLE 绫�
+#include <afxodlgs.h>       // MFC OLE 瀵硅瘽妗嗙被
+#include <afxdisp.h>        // MFC 鑷姩鍖栫被
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h>                      // MFC ODBC 鏁版嵁搴撶被
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h>                     // MFC DAO 鏁版嵁搴撶被
+#endif // _AFX_NO_DAO_SUPPORT
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC 瀵� Internet Explorer 4 鍏叡鎺т欢鐨勬敮鎸�
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>                     // MFC 瀵� Windows 鍏叡鎺т欢鐨勬敮鎸�
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
diff --git a/ENRUTResources_zh-CN/pch.cpp b/ENRUTResources_zh-CN/pch.cpp
new file mode 100644
index 0000000..b6fb8f4
--- /dev/null
+++ b/ENRUTResources_zh-CN/pch.cpp
@@ -0,0 +1,5 @@
+锘�// pch.cpp: 涓庨缂栬瘧鏍囧ご瀵瑰簲鐨勬簮鏂囦欢
+
+#include "pch.h"
+
+// 褰撲娇鐢ㄩ缂栬瘧鐨勫ご鏃讹紝闇�瑕佷娇鐢ㄦ婧愭枃浠讹紝缂栬瘧鎵嶈兘鎴愬姛銆�
diff --git a/ENRUTResources_zh-CN/pch.h b/ENRUTResources_zh-CN/pch.h
new file mode 100644
index 0000000..9660927
--- /dev/null
+++ b/ENRUTResources_zh-CN/pch.h
@@ -0,0 +1,13 @@
+锘�// pch.h: 杩欐槸棰勭紪璇戞爣澶存枃浠躲��
+// 涓嬫柟鍒楀嚭鐨勬枃浠朵粎缂栬瘧涓�娆★紝鎻愰珮浜嗗皢鏉ョ敓鎴愮殑鐢熸垚鎬ц兘銆�
+// 杩欒繕灏嗗奖鍝� IntelliSense 鎬ц兘锛屽寘鎷唬鐮佸畬鎴愬拰璁稿浠g爜娴忚鍔熻兘銆�
+// 浣嗘槸锛屽鏋滄澶勫垪鍑虹殑鏂囦欢涓殑浠讳綍涓�涓湪鐢熸垚涔嬮棿鏈夋洿鏂帮紝瀹冧滑鍏ㄩ儴閮藉皢琚噸鏂扮紪璇戙��
+// 璇峰嬁鍦ㄦ澶勬坊鍔犺棰戠箒鏇存柊鐨勬枃浠讹紝杩欏皢浣垮緱鎬ц兘浼樺娍鏃犳晥銆�
+
+#ifndef PCH_H
+#define PCH_H
+
+// 娣诲姞瑕佸湪姝ゅ棰勭紪璇戠殑鏍囧ご
+#include "framework.h"
+
+#endif //PCH_H
diff --git a/ENRUTResources_zh-CN/res/ENRUTResources_zh-CN.rc2 b/ENRUTResources_zh-CN/res/ENRUTResources_zh-CN.rc2
new file mode 100644
index 0000000..0c8a93c
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/ENRUTResources_zh-CN.rc2
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bitmap_d.bmp b/ENRUTResources_zh-CN/res/bitmap_d.bmp
new file mode 100644
index 0000000..dfc7a8e
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bitmap_d.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bitmap_w.bmp b/ENRUTResources_zh-CN/res/bitmap_w.bmp
new file mode 100644
index 0000000..1ca9c3c
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bitmap_w.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00004.bmp b/ENRUTResources_zh-CN/res/bmp00004.bmp
new file mode 100644
index 0000000..9dc8dcc
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00004.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00005.bmp b/ENRUTResources_zh-CN/res/bmp00005.bmp
new file mode 100644
index 0000000..cca8a22
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00005.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00006.bmp b/ENRUTResources_zh-CN/res/bmp00006.bmp
new file mode 100644
index 0000000..cca8a22
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00006.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00007.bmp b/ENRUTResources_zh-CN/res/bmp00007.bmp
new file mode 100644
index 0000000..28fbd04
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00007.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00008.bmp b/ENRUTResources_zh-CN/res/bmp00008.bmp
new file mode 100644
index 0000000..98c701e
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00008.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00009.bmp b/ENRUTResources_zh-CN/res/bmp00009.bmp
new file mode 100644
index 0000000..99093d9
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00009.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00010.bmp b/ENRUTResources_zh-CN/res/bmp00010.bmp
new file mode 100644
index 0000000..a0eb383
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00010.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00011.bmp b/ENRUTResources_zh-CN/res/bmp00011.bmp
new file mode 100644
index 0000000..d335498
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00011.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00012.bmp b/ENRUTResources_zh-CN/res/bmp00012.bmp
new file mode 100644
index 0000000..5ede200
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00012.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00013.bmp b/ENRUTResources_zh-CN/res/bmp00013.bmp
new file mode 100644
index 0000000..4cea2e0
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00013.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00014.bmp b/ENRUTResources_zh-CN/res/bmp00014.bmp
new file mode 100644
index 0000000..623610d
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00014.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00015.bmp b/ENRUTResources_zh-CN/res/bmp00015.bmp
new file mode 100644
index 0000000..8087414
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00015.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00016.bmp b/ENRUTResources_zh-CN/res/bmp00016.bmp
new file mode 100644
index 0000000..c090e83
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00016.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00017.bmp b/ENRUTResources_zh-CN/res/bmp00017.bmp
new file mode 100644
index 0000000..b8c763b
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00017.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00018.bmp b/ENRUTResources_zh-CN/res/bmp00018.bmp
new file mode 100644
index 0000000..9393d8e
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00018.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00019.bmp b/ENRUTResources_zh-CN/res/bmp00019.bmp
new file mode 100644
index 0000000..b019b45
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00019.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00020.bmp b/ENRUTResources_zh-CN/res/bmp00020.bmp
new file mode 100644
index 0000000..d160933
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00020.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00021.bmp b/ENRUTResources_zh-CN/res/bmp00021.bmp
new file mode 100644
index 0000000..5b59125
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00021.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00022.bmp b/ENRUTResources_zh-CN/res/bmp00022.bmp
new file mode 100644
index 0000000..8e11940
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00022.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00023.bmp b/ENRUTResources_zh-CN/res/bmp00023.bmp
new file mode 100644
index 0000000..92cc528
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00023.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00024.bmp b/ENRUTResources_zh-CN/res/bmp00024.bmp
new file mode 100644
index 0000000..49332bc
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00024.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00025.bmp b/ENRUTResources_zh-CN/res/bmp00025.bmp
new file mode 100644
index 0000000..7553a84
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00025.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp00026.bmp b/ENRUTResources_zh-CN/res/bmp00026.bmp
new file mode 100644
index 0000000..66a7b0c
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp00026.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/bmp_info.bmp b/ENRUTResources_zh-CN/res/bmp_info.bmp
new file mode 100644
index 0000000..a4d15ea
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/bmp_info.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/btn_save.bmp b/ENRUTResources_zh-CN/res/btn_save.bmp
new file mode 100644
index 0000000..06fdef2
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/btn_save.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/checkno3.bmp b/ENRUTResources_zh-CN/res/checkno3.bmp
new file mode 100644
index 0000000..4ed56b4
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/checkno3.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/filelarg.bmp b/ENRUTResources_zh-CN/res/filelarg.bmp
new file mode 100644
index 0000000..06e3778
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/filelarg.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/filesmal.bmp b/ENRUTResources_zh-CN/res/filesmal.bmp
new file mode 100644
index 0000000..ef481d3
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/filesmal.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00001.ico b/ENRUTResources_zh-CN/res/icon/ico00001.ico
new file mode 100644
index 0000000..a3598e1
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00001.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00002.ico b/ENRUTResources_zh-CN/res/icon/ico00002.ico
new file mode 100644
index 0000000..7bf050c
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00002.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00005.ico b/ENRUTResources_zh-CN/res/icon/ico00005.ico
new file mode 100644
index 0000000..ccb129a
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00005.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00006.ico b/ENRUTResources_zh-CN/res/icon/ico00006.ico
new file mode 100644
index 0000000..139b4be
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00006.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00007.ico b/ENRUTResources_zh-CN/res/icon/ico00007.ico
new file mode 100644
index 0000000..a01b604
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00007.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00008.ico b/ENRUTResources_zh-CN/res/icon/ico00008.ico
new file mode 100644
index 0000000..6ee3287
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00008.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00009.ico b/ENRUTResources_zh-CN/res/icon/ico00009.ico
new file mode 100644
index 0000000..2f16ae7
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00009.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00010.ico b/ENRUTResources_zh-CN/res/icon/ico00010.ico
new file mode 100644
index 0000000..d9e8fd2
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00010.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00011.ico b/ENRUTResources_zh-CN/res/icon/ico00011.ico
new file mode 100644
index 0000000..e5b97ec
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00011.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00012.ico b/ENRUTResources_zh-CN/res/icon/ico00012.ico
new file mode 100644
index 0000000..a96d772
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00012.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00013.ico b/ENRUTResources_zh-CN/res/icon/ico00013.ico
new file mode 100644
index 0000000..10ac33b
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00013.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00014.ico b/ENRUTResources_zh-CN/res/icon/ico00014.ico
new file mode 100644
index 0000000..a3e83f5
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00014.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/ico00015.ico b/ENRUTResources_zh-CN/res/icon/ico00015.ico
new file mode 100644
index 0000000..350db63
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/ico00015.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_add.ico b/ENRUTResources_zh-CN/res/icon/icon_add.ico
new file mode 100644
index 0000000..835ed97
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_add.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_app.ico b/ENRUTResources_zh-CN/res/icon/icon_app.ico
new file mode 100644
index 0000000..ba95955
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_app.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_arr.ico b/ENRUTResources_zh-CN/res/icon/icon_arr.ico
new file mode 100644
index 0000000..7629a48
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_arr.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_can.ico b/ENRUTResources_zh-CN/res/icon/icon_can.ico
new file mode 100644
index 0000000..1aa70fc
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_can.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_cha.ico b/ENRUTResources_zh-CN/res/icon/icon_cha.ico
new file mode 100644
index 0000000..4491986
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_cha.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_chk.ico b/ENRUTResources_zh-CN/res/icon/icon_chk.ico
new file mode 100644
index 0000000..da53d0b
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_chk.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_ck_.ico b/ENRUTResources_zh-CN/res/icon/icon_ck_.ico
new file mode 100644
index 0000000..0e58410
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_ck_.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_cop.ico b/ENRUTResources_zh-CN/res/icon/icon_cop.ico
new file mode 100644
index 0000000..dd28640
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_cop.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_del.ico b/ENRUTResources_zh-CN/res/icon/icon_del.ico
new file mode 100644
index 0000000..961f35d
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_del.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_dis.ico b/ENRUTResources_zh-CN/res/icon/icon_dis.ico
new file mode 100644
index 0000000..f0edb71
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_dis.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_dow.ico b/ENRUTResources_zh-CN/res/icon/icon_dow.ico
new file mode 100644
index 0000000..122d30e
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_dow.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_edi.ico b/ENRUTResources_zh-CN/res/icon/icon_edi.ico
new file mode 100644
index 0000000..9166739
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_edi.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_gea.ico b/ENRUTResources_zh-CN/res/icon/icon_gea.ico
new file mode 100644
index 0000000..224595f
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_gea.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_lef.ico b/ENRUTResources_zh-CN/res/icon/icon_lef.ico
new file mode 100644
index 0000000..b5ec411
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_lef.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_loa.ico b/ENRUTResources_zh-CN/res/icon/icon_loa.ico
new file mode 100644
index 0000000..3bbf249
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_loa.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_pc.ico b/ENRUTResources_zh-CN/res/icon/icon_pc.ico
new file mode 100644
index 0000000..5373820
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_pc.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_rep.ico b/ENRUTResources_zh-CN/res/icon/icon_rep.ico
new file mode 100644
index 0000000..2e11c6c
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_rep.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_rig.ico b/ENRUTResources_zh-CN/res/icon/icon_rig.ico
new file mode 100644
index 0000000..0a5ec6a
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_rig.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_sav.ico b/ENRUTResources_zh-CN/res/icon/icon_sav.ico
new file mode 100644
index 0000000..63f7d9c
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_sav.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_up.ico b/ENRUTResources_zh-CN/res/icon/icon_up.ico
new file mode 100644
index 0000000..17c5e66
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_up.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_up_.ico b/ENRUTResources_zh-CN/res/icon/icon_up_.ico
new file mode 100644
index 0000000..2acff2c
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_up_.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_vie.ico b/ENRUTResources_zh-CN/res/icon/icon_vie.ico
new file mode 100644
index 0000000..1a7bba4
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_vie.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/icon_war.ico b/ENRUTResources_zh-CN/res/icon/icon_war.ico
new file mode 100644
index 0000000..5ade262
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/icon_war.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/idr_enri.ico b/ENRUTResources_zh-CN/res/icon/idr_enri.ico
new file mode 100644
index 0000000..900968a
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/idr_enri.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/idr_main.ico b/ENRUTResources_zh-CN/res/icon/idr_main.ico
new file mode 100644
index 0000000..37bbfa7
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/idr_main.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/led_off.ico b/ENRUTResources_zh-CN/res/icon/led_off.ico
new file mode 100644
index 0000000..89c7611
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/led_off.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/icon/led_on.ico b/ENRUTResources_zh-CN/res/icon/led_on.ico
new file mode 100644
index 0000000..858d60f
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/icon/led_on.ico
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/led_off.bmp b/ENRUTResources_zh-CN/res/led_off.bmp
new file mode 100644
index 0000000..4919393
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/led_off.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/led_on.bmp b/ENRUTResources_zh-CN/res/led_on.bmp
new file mode 100644
index 0000000..6a36826
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/led_on.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/list_cel.bmp b/ENRUTResources_zh-CN/res/list_cel.bmp
new file mode 100644
index 0000000..a7ade36
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/list_cel.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/menu_bar.bmp b/ENRUTResources_zh-CN/res/menu_bar.bmp
new file mode 100644
index 0000000..608a063
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/menu_bar.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/propicon.bmp b/ENRUTResources_zh-CN/res/propicon.bmp
new file mode 100644
index 0000000..e904664
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/propicon.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/splash.bmp b/ENRUTResources_zh-CN/res/splash.bmp
new file mode 100644
index 0000000..133e9ea
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/splash.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/writelar.bmp b/ENRUTResources_zh-CN/res/writelar.bmp
new file mode 100644
index 0000000..34a5de0
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/writelar.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/res/writesma.bmp b/ENRUTResources_zh-CN/res/writesma.bmp
new file mode 100644
index 0000000..7260ef2
--- /dev/null
+++ b/ENRUTResources_zh-CN/res/writesma.bmp
Binary files differ
diff --git a/ENRUTResources_zh-CN/resource.h b/ENRUTResources_zh-CN/resource.h
new file mode 100644
index 0000000..7ec31a2
--- /dev/null
+++ b/ENRUTResources_zh-CN/resource.h
@@ -0,0 +1,1621 @@
+锘�//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ 鐢熸垚鐨勫寘鍚枃浠躲��
+// 渚� ENRUTResources_zh-CN.rc 浣跨敤
+//
+#define IDC_BUTTON_CHANGE               3
+#define IDP_OLE_INIT_FAILED             100
+#define IDD_ABOUTBOX                    100
+#define IDD_DIALOG_LOGIN                103
+#define IDP_SOCKETS_INIT_FAILED         104
+#define IDB_WRITESMALL                  110
+#define IDB_WRITELARGE                  111
+#define IDB_MAIN                        112
+#define IDB_BUTTONS                     113
+#define IDB_FILELARGE                   114
+#define IDB_FILESMALL                   115
+#define IDR_MAINFRAME                   128
+#define IDD_DLG_RECIPE_LIST             129
+#define IDB_BITMAP_DEFECT               130
+#define IDR_ENRITTYPE                   130
+#define IDD_DLG_RECIPE_NEW              130
+#define IDB_PLAY                        133
+#define IDB_STOP                        134
+#define IDB_STOP_HOT                    135
+#define IDB_PLAY_HOT                    136
+#define IDB_IMAGE                       137
+#define IDD_DLG_PPID_NEW                138
+#define IDD_DIALOG_VERSION              139
+#define IDB_RADIO_ON                    146
+#define IDD_DLG_NOTCH_SETTING           146
+#define IDB_PROPICONS                   147
+#define IDB_CHECKNO                     151
+#define IDB_RADIO_OFF                   152
+#define IDI_LED_OFF                     152
+#define IDD_DLG_LAMP_CONTROL            152
+#define IDB_CHECK32                     153
+#define IDI_LED_ON                      153
+#define IDB_CHECKNO32                   154
+#define IDI_ICON_CHK_ON                 154
+#define IDB_RADIO_OFF32                 155
+#define IDI_ICON_CHK_OFF                155
+#define IDI_ICON_APP                    179
+#define IDI_ICON_CANCEL                 180
+#define IDI_ICON_CHK_ON2                181
+#define IDI_ICON_CHK_OFF_2              182
+#define IDI_ICON_LOAD_SM                183
+#define IDI_ICON_CK_OK                  184
+#define IDI_ICON_DISK_SM                185
+#define IDI_ICON_LOAD_BIG               186
+#define IDI_ICON_DISK_BIG               188
+#define IDI_ICON_PC                     189
+#define IDI_ICON_CHANGE                 192
+#define IDD_DLG_EXCEPTION               203
+#define IDI_ICON_LEFT_RIGHT             206
+#define IDI_ICON_UP_DOWN                207
+#define IDB_BTN_LOAD                    214
+#define IDB_BTN_LOAD_PUSH               215
+#define IDB_BTN_SAVE_PUSH               217
+#define IDB_BTN_SAVE                    219
+#define IDB_SPLASH                      310
+#define IDD_DLG_RCUT_MAIN_VIEW          311
+#define IDD_DIALOG_LICENSE              312
+#define IDD_DLG_INSPECT_INFORMATION     313
+#define IDD_DLG_SCANIMAGE_VIEW          314
+#define IDD_DLG_RECIPE_VIEW             315
+#define IDD_DLG_LIVECAM_VIEW            316
+#define IDR_MENU1                       317
+#define IDD_DLG_HWSETTING_VIEW          317
+#define IDB_LED_ON                      318
+#define IDR_ALIGN_POP_UP                319
+#define IDB_LED_OFF                     319
+#define IDB_BTN_SAVE_NORMAL             321
+#define IDB_BTN_LOAD_PUSH1              322
+#define IDB_BTN_LOAD1                   323
+#define IDB_RADIO_ON32                  324
+#define IDB_CHECK                       327
+#define IDB_BITMAP_RIGHTARROW           328
+#define IDB_BITMAP_RECIPE_LINKARROW     329
+#define IDD_DLG_RECIPE_HOLE             331
+#define IDB_BITMAP_RIGHTARROW1          332
+#define IDB_MENU_BAR                    334
+#define IDB_BMP_INFO                    335
+#define IDB_BITMAP_WARNING              336
+#define IDI_ICON_ADD                    336
+#define IDI_ICON_COPY                   337
+#define IDI_ICON_DELETE                 338
+#define IDI_ICON_EDIT                   339
+#define IDD_DLG_MAP_SETTINGS            339
+#define IDI_ICON_GEAR_CHK               340
+#define IDI_ICON_GEAR_RUN               341
+#define IDI_ICON_GEAR_STOP              342
+#define IDI_ICON_DOWN                   343
+#define IDI_ICON_LEFT                   344
+#define IDI_ICON_RIGHT                  345
+#define IDI_ICON_UP                     346
+#define IDI_ICON_SAVEAS                 347
+#define IDI_ICON_VIEW                   348
+#define IDI_ICON_VIEW_NEXT              349
+#define IDI_ICON_VIEW_PREVIOUS          350
+#define IDI_ICON_WARNING                351
+#define IDI_ICON_REPLACE48              371
+#define IDI_ICON_ARR_DN                 375
+#define IDI_ICON_ARR_LEFT               376
+#define IDI_ICON_ARR_RIGHT              377
+#define IDI_ICON_ARR_UP                 378
+#define IDB_LIST_CELL1                  386
+#define IDD_DIALOG_USER_DEFECT_AREA     390
+#define IDD_DLG_RECIPE_INSPECTSETTING_VIEW 392
+#define IDD_DLG_RECIPE_PROFILESETTING_VIEW 393
+#define IDD_DLG_RECIPE_CHAMFERSETTING_VIEW 394
+#define IDD_DLG_DEFECT_VIEW             395
+#define IDD_DLG_SPLINE_SETTING          396
+#define IDC_COMBO_BORAD_TYPE            1000
+#define IDC_STATIC_LAMP_MAX_VALUE       1001
+#define IDC_BTN_MAIN_INSINFOR           1002
+#define IDC_LBA_SERIAL_NO               1002
+#define IDC_BTN_MAIN_IMAGE_VIEW         1003
+#define IDC_LBA_LOCK_STATUS             1003
+#define IDC_BTN_MAIN_RECIPE_VIEW        1004
+#define IDC_LBA_LOCK_DUE_DATE           1004
+#define IDC_BTN_MAIN_HW_VIEW            1005
+#define IDC_STATIC_RECIPE_TITLE         1005
+#define IDC_EDIT_PLC_DELAY              1005
+#define IDC_BTN_MAIN_EXIT               1006
+#define IDC_EDIT_LIGHT_TRANS_COUNT      1006
+#define IDC_BTN_MAIN_LIVE_CAM_VIEW      1007
+#define IDC_STATIC_GLASSINFO_TITLE      1007
+#define IDC_EDIT_LIGHT_REFLECT_COUNT    1007
+#define IDC_BTN_MAIN_DEFECTVIEW         1008
+#define IDC_STATIC_MAP_UP               1008
+#define IDC_LIGHT_LIST                  1008
+#define IDC_STATIC_MAP_DW               1009
+#define IDC_EDIT_CAMERA_COUNT           1009
+#define IDC_RECIPE_LIST                 1010
+#define IDC_GRD_MEASURE_RESULT_B        1010
+#define IDC_EDIT_FOLDER_REMOVE_DAY      1010
+#define IDC_STATIC_DEFECT_IMAGE         1010
+#define IDC_LIST_RECIPE_NAME            1011
+#define IDC_STATIC_GLASSID_TITLE        1011
+#define IDC_CAMERA_LIST                 1011
+#define IDC_SCROLLBAR_V                 1012
+#define IDC_PPID_LIST                   1012
+#define IDC_GRD_MEASURE_RESULT_C        1012
+#define IDC_EDIT_SCAN_COUNT             1012
+#define IDC_SCROLLBAR_H                 1013
+#define IDC_LIST_PPID_NAME              1013
+#define IDC_GRD_MEASURE_RESULT_D        1013
+#define IDC_BUT_LIGHTCNT_APPLY          1013
+#define IDC_BTN_IMG_INIT                1014
+#define IDC_GRD_MEASURE_RESULT_A        1014
+#define IDC_BTN_HW_SAVE                 1014
+#define IDC_BTN_SAVE1                   1015
+#define IDC_BTN_IMG_PROCESS             1015
+#define IDC_BTN_MAPSETTINGS_CLOSE       1015
+#define IDC_GRD_MEASURE_RESULT_A_INLINE 1015
+#define IDC_EDIT_LINE_ID                1015
+#define IDC_BTN_SAVE5                   1016
+#define IDC_BTN_IMG_LOAD                1016
+#define IDC_GRD_MEASURE_RESULT_RCUT_A   1016
+#define IDC_BUT_CAMCNT_APPLY            1016
+#define IDC_BTN_SAVE2                   1017
+#define IDC_BTN_IMG_SAVE                1017
+#define IDC_GRD_MEASURE_RESULT_RCUT_C   1017
+#define IDC_EDIT_PLC_SIGNAL_RETRY_COUNT 1017
+#define IDC_BTN_SAVE3                   1018
+#define IDC_BTN_TRIGGER_CH_ON           1018
+#define IDC_BTN_SAVE4                   1019
+#define IDC_BTN_TRIGGER_CH_OFF          1019
+#define IDC_BTN_SAVE6                   1020
+#define IDC_BUT_LIST_SELECT             1020
+#define IDC_BUT_LICENSE_INFO            1020
+#define IDC_BTN_SAVE7                   1021
+#define IDC_BUT_LIST_EXIT               1021
+#define IDC_BTN_SAVE8                   1022
+#define IDC_NEWRECIPE_NAME_TITLE        1022
+#define IDC_STATIC_SELECT_IMG           1023
+#define IDC_NEWRECIPE_NAME_TITLE2       1023
+#define IDC_BUT_LIST_NEWRECIPE          1023
+#define IDC_STATIC_IMG_2                1024
+#define IDC_EDIT_RECIPENEW_NAME         1024
+#define IDC_BUT_LIST_DELRECIPE          1024
+#define IDC_STATIC_IMG_3                1025
+#define IDC_EDIT_RECIPENEW_COMMENT      1025
+#define IDC_BUT_LIST_NEWPPID            1025
+#define IDC_STATIC_IMG_4                1026
+#define IDC_BUT_LIST_DELPPID            1026
+#define IDC_STATIC_HISTORY_TITLE2       1026
+#define IDC_STATIC_IMG_6                1027
+#define IDC_CHK_MARK_A1                 1027
+#define IDC_STATIC_HISTORY_TITLE3       1027
+#define IDC_STATIC_IMG_7                1028
+#define IDC_CHK_MARK_B1                 1028
+#define IDC_GRD_DEFECT_LIST             1028
+#define IDC_STATIC_IMG_8                1029
+#define IDC_CHK_MARK_C1                 1029
+#define IDC_CHK_MARK_D1                 1030
+#define IDC_CHK_MARK_A2                 1031
+#define IDC_SLIDER_1                    1031
+#define IDC_CHK_MARK_B2                 1032
+#define IDC_CHK_INS_REVERSE             1032
+#define IDC_CHK_MARK_C2                 1033
+#define IDC_SLIDER_3                    1033
+#define IDC_CHK_MARK_D2                 1034
+#define IDC_SLIDER_2                    1034
+#define IDC_EDIT_TH_LINE                1035
+#define IDC_EDIT_MARK_RATE1             1036
+#define IDC_SLIDER_4                    1036
+#define IDC_EDIT_MARK_RATE2             1037
+#define IDC_SLIDER_5                    1037
+#define IDC_SLIDER_6                    1038
+#define IDC_EDIT_TH_EDGE_LINE           1039
+#define IDC_SLIDER_7                    1039
+#define IDC_BTN_LAMP_CLOSE              1040
+#define IDC_EDIT_MARK_RATE3             1041
+#define IDC_SLIDER_8                    1041
+#define IDC_EDIT_TH_SIDE_CHIP           1043
+#define IDC_CHK_MARK_A3                 1044
+#define IDC_BTN_RECIPENEW_OK            1045
+#define IDC_EDIT_START_LINE_CHK         1045
+#define IDC_BTN_RECIPENEW_CANCEL        1046
+#define IDC_CHK_MARK_B3                 1046
+#define IDC_SAVE                        1046
+#define IDC_CHK_MARK_C3                 1047
+#define IDC_EXIT                        1047
+#define IDC_BTN_PPIDNEW_OK              1047
+#define IDC_CHECK_SIDE_CHIP_AND         1048
+#define IDC_HOLE_SETTING_LIST           1048
+#define IDC_BTN_PPIDNEW_CANCEL          1048
+#define IDC_CHECK_USE_CORNER            1049
+#define IDC_ADD_AREA                    1049
+#define IDC_USERDEFECT_LIST             1049
+#define IDC_BTN_RECIPE_SAVE             1050
+#define IDC_CHK_MARK_D3                 1050
+#define IDC_DEL_AREA                    1050
+#define IDC_EXPAREA_LIST                1050
+#define IDC_BTN_SPLINE_OK               1051
+#define IDC_SCROLLBAR_V_4               1051
+#define IDC_EDIT_TH_SIDE_CRACK          1051
+#define IDC_UPDATE                      1051
+#define IDC_BTN_SPLINE_CANCEL           1052
+#define IDC_SCROLLBAR_H_1               1052
+#define IDC_CHECK_MARK_MODIFY           1052
+#define IDC_BTN_CIRCLE_UP               1052
+#define IDC_SCROLLBAR_V_3               1053
+#define IDC_EDIT_TH_SIDE_BROKEN         1053
+#define IDC_BTN_CIRCLE_LEFT             1053
+#define IDC_BTN_NOTCH_OK                1053
+#define IDC_SCROLLBAR_V_2               1054
+#define IDC_EDIT_TH_SIDE_CHIPDIFFTHRES  1054
+#define IDC_BTN_CIRCLE_RIGHT            1054
+#define IDC_BTN_NOTCH_CANCEL            1054
+#define IDC_SCROLLBAR_V_1               1055
+#define IDC_CHECK_PANEL_REVERSE         1055
+#define IDC_BTN_CIRCLE_DN               1055
+#define IDC_BUT_NOTCH_POS_DEL           1055
+#define IDC_SCROLLBAR_H_2               1056
+#define IDC_EDIT_TH_IN_CHIP2            1056
+#define IDC_BTN_CIRCLE_WIDTH_PLUS       1056
+#define IDC_SCROLLBAR_H_3               1057
+#define IDC_BTN_FILTER_LIST1            1057
+#define IDC_EDIT_TH_SIDE_CHIP_WHITE     1057
+#define IDC_BTN_CIRCLE_WIDTH_MINUS      1057
+#define IDC_SCROLLBAR_H_4               1058
+#define IDC_BTN_PROFILE_MAKECAD         1058
+#define IDC_EDIT_TH_IN_BURR2            1058
+#define IDC_BTN_CIRCLE_HEIGHT_MINUS     1058
+#define IDC_BTN_LOAD1                   1059
+#define IDC_BTN_PROFILE_APPLY           1059
+#define IDC_EDIT_TH_SIDE_BURR2          1059
+#define IDC_BTN_CIRCLE_HEIGHT_PLUS      1059
+#define IDC_BTN_LOAD2                   1060
+#define IDC_BTN_PROFILE_TEST_RUN        1060
+#define IDC_EDIT_TH_EDGE_LINE2          1060
+#define IDC_STATIC_TEMPLATE_IMAGE       1060
+#define IDC_BTN_LOAD3                   1061
+#define IDC_CHECK_CF_CHIP_AND           1061
+#define IDC_EDIT_CONTROL_STEP           1061
+#define IDC_BTN_CHAMFER_APPLY           1061
+#define IDC_BTN_LOAD4                   1062
+#define IDC_EDIT_TH_SIDE_RCUT_TOP_GLASS 1062
+#define IDC_STATIC_TEMPLATE_DISPLAY     1062
+#define IDC_BTN_CHAMFER_DOWN            1062
+#define IDC_CHECK_LAMP_ONOFF            1062
+#define IDC_BTN_LOAD_ALL                1063
+#define IDC_EDIT_SIDE_DX_CHIP           1063
+#define IDC_STEP_TITLE                  1063
+#define IDC_BTN_CHAMFER_UP              1063
+#define IDC_BTN_INIT_DISPLAY            1064
+#define IDC_EDIT_SIDE_DY_CHIP           1064
+#define IDC_SCROLLBAR_DEFECT_H          1064
+#define IDC_EDIT_PASSWD                 1064
+#define IDC_SCROLLBAR_V_5               1065
+#define IDC_EDIT_SIDE_DX_BURR           1065
+#define IDC_INSPECT_PROCESS             1065
+#define IDC_STATIC_IMG_LIST             1065
+#define IDC_EDIT_NEWPASSWD1             1065
+#define IDC_SAVE_ALL                    1066
+#define IDC_EDIT_SIDE_DY_BURR           1066
+#define IDC_VIEW_MODE                   1066
+#define IDC_STATIC_INSINFO_GRP_1        1066
+#define IDC_EDIT_NEWPASSWD2             1066
+#define IDC_STATIC_IMG_1                1067
+#define IDC_EDIT_SIDE_DX_BROKEN         1067
+#define IDC_STATIC_INSINFO_GRP_2        1067
+#define IDC_STATIC_CAM_INFO1            1068
+#define IDC_EDIT_SIDE_DY_BROKEN         1068
+#define IDC_BTN_INSINFO_MAPSETTINGS     1068
+#define IDC_STATIC_CAM_INFO2            1069
+#define IDC_EDIT_CAD_OFFSET_X           1069
+#define IDC_BTN_ROI_LEFT                1069
+#define IDC_GRD_CF_MAPSETTINGS          1069
+#define IDC_STATIC_CAM_INFO3            1070
+#define IDC_EDIT_CF_DX_CHIP             1070
+#define IDC_BTN_ROI_UP                  1070
+#define IDC_GRD_TFT_MAPSETTINGS         1070
+#define IDC_STATIC_CAM_INFO4            1071
+#define IDC_CHECK_SIDE_BURR_AND         1071
+#define IDC_BTN_ROI_RIGHT               1071
+#define IDC_BTN_MAPSETTINGS_SAVE        1071
+#define IDC_CHECK_SIDE_BROKEN_AND       1072
+#define IDC_BTN_ROI_DN                  1072
+#define IDC_CHK_USECOLORVISUAL          1072
+#define IDC_STATIC_SUBJECT              1072
+#define IDC_EDIT_CF_DY_CHIP             1073
+#define IDC_BTN_ROI_WIDTH_PLUS          1073
+#define IDC_UPDN_WIDTH1                 1074
+#define IDC_EDIT_CF_DX_BURR             1074
+#define IDC_BTN_ROI_WIDTH_MINUS         1074
+#define IDC_BTN_PROC                    1075
+#define IDC_EDIT_CF_DY_BURR             1075
+#define IDC_BTN_ROI_HEIGHT_MINUS        1075
+#define IDC_SLIDER_ZOOM                 1076
+#define IDC_CHECK_CF_BURR_AND           1076
+#define IDC_BTN_ROI_HEIGHT_PLUS         1076
+#define IDC_BTN_IMG_SHORT               1077
+#define IDC_EDIT_CRACK_DX               1077
+#define IDC_BTN_IMG_LONG                1078
+#define IDC_EDIT_CRACK_DY               1078
+#define IDC_BTN_IMG_BOTH                1079
+#define IDC_CHECK_CRACK_AND             1079
+#define IDC_ST_ZOOM                     1080
+#define IDC_EDIT_CAD_OFFSET_Y           1080
+#define IDC_STATIC_CAM_INFO5            1081
+#define IDC_EDIT_TH_SIDE_RCUT_TOP_CHAMFER 1081
+#define IDC_STATIC_CAM_INFO6            1082
+#define IDC_EDIT_TH_SIDE_RCUT_BOT_GLASS 1082
+#define IDC_STATIC_CAM_INFO7            1083
+#define IDC_EDIT_TH_SIDE_RCUT_BOT_CHAMFER 1083
+#define IDC_STATIC_CAM_INFO8            1084
+#define IDC_CHK_USE_AVG_PROFILE_JUDGEMENT 1084
+#define IDC_STATIC_IMG_5                1085
+#define IDC_EDIT_TH_CONOR               1085
+#define IDC_SCROLLBAR_V_6               1086
+#define IDC_EDIT_AVG_PROFILE_DIFF       1086
+#define IDC_SCROLLBAR_V_7               1087
+#define IDC_CHECK_SIDE_CHIP_USE         1087
+#define IDC_SCROLLBAR_V_8               1088
+#define IDC_CHECK_SIDE_BURR_USE         1088
+#define IDC_SCROLLBAR_H_5               1089
+#define IDC_CHECK_SIDE_BROKEN_USE       1089
+#define IDC_BTN_CAM_LIVE                1089
+#define IDC_SCROLLBAR_H_6               1090
+#define IDC_SLIDER_ZOOM2                1090
+#define IDC_CHK_USE_AVG_CHAMFER_JUDGEMENT 1090
+#define IDC_BTN_CAM_SNAP                1090
+#define IDC_CHECK_AUTO_SIZE             1091
+#define IDC_EDIT_AVG_CHAMFER_DIFF       1091
+#define IDC_BTN_STOP                    1091
+#define IDC_UPDN_WIDTH3                 1092
+#define IDC_CHECK_CF_CHIP_USE           1092
+#define IDC_UPDN_WIDTH4                 1093
+#define IDC_CHK_USE_ORIGINPT_ALIGNKEY   1093
+#define IDC_SCROLLBAR_H_7               1094
+#define IDC_EDIT_UP_REF_A               1094
+#define IDC_SCROLLBAR_H_8               1095
+#define IDC_EDIT_UP_PLUS_TOL_A          1095
+#define IDC_BTN_LOAD5                   1096
+#define IDC_EDIT_UP_MINUS_TOL_A         1096
+#define IDC_BTN_LOAD6                   1097
+#define IDC_ST_ZOOM2                    1097
+#define IDC_EDIT_UP_REF_A2              1097
+#define IDC_BTN_LOAD7                   1098
+#define IDC_EDIT_DN_REF_A               1098
+#define IDC_BTN_LOAD8                   1099
+#define IDC_EDIT_DN_PLUS_TOL_A          1099
+#define IDC_UPDN_WIDTH6                 1100
+#define IDC_EDIT_DN_MINUS_TOL_A         1100
+#define IDC_UPDN_WIDTH7                 1101
+#define IDC_EDIT_UP_REF_B               1101
+#define IDC_UPDN_WIDTH8                 1102
+#define IDC_EDIT_UP_PLUS_TOL_B          1102
+#define IDC_EDIT_UP_MINUS_TOL_B         1103
+#define IDC_EDIT_DN_REF_B               1104
+#define IDC_STATIC_PROFILE_SETTING_1    1105
+#define IDC_EDIT_DN_PLUS_TOL_B          1105
+#define IDC_EDIT_DN_MINUS_TOL_B         1106
+#define IDC_STATIC_PROFILE_SETTING_Y    1107
+#define IDC_EDIT_UP_REF_C               1107
+#define IDC_STATIC_PROFILE_SETTING_PLUS 1108
+#define IDC_EDIT_UP_PLUS_TOL_C          1108
+#define IDC_STATIC_PROFILE_SETTING_MINUS 1109
+#define IDC_EDIT_UP_MINUS_TOL_C         1109
+#define IDC_CHECK_PROFILE_SETTING_1     1110
+#define IDC_EDIT_DN_REF_C               1110
+#define IDC_EDIT_PROFILE_SETTING_Y_1    1111
+#define IDC_EDIT_DN_PLUS_TOL_C          1111
+#define IDC_EDIT_PROFILE_SETTING_PLUS_1 1112
+#define IDC_EDIT_DN_MINUS_TOL_C         1112
+#define IDC_EDIT_PROFILE_SETTING_MINUS_1 1113
+#define IDC_EDIT_UP_REF_D               1113
+#define IDC_STATIC_PROFILE_SETTING_2    1114
+#define IDC_EDIT_UP_PLUS_TOL_D          1114
+#define IDC_STATIC_CHAMFER_SETTING_1    1114
+#define IDC_CHECK_PROFILE_SETTING_2     1115
+#define IDC_EDIT_UP_MINUS_TOL_D         1115
+#define IDC_STATIC_CHAMFER_SETTING_REF  1115
+#define IDC_EDIT_PROFILE_SETTING_Y_2    1116
+#define IDC_EDIT_DN_REF_D               1116
+#define IDC_STATIC_CHAMFER_SETTING_2    1116
+#define IDC_EDIT_PROFILE_SETTING_PLUS_2 1117
+#define IDC_EDIT_DN_PLUS_TOL_D          1117
+#define IDC_STATIC_CHAMFER_SETTING_PLUS 1117
+#define IDC_EDIT_PROFILE_SETTING_MINUS_2 1118
+#define IDC_EDIT_DN_MINUS_TOL_D         1118
+#define IDC_STATIC_CHAMFER_SETTING_MINUS 1118
+#define IDC_STATIC_PROFILE_SETTING_3    1119
+#define IDC_CHECK_CF_BURR_USE           1119
+#define IDC_CHECK_CHAMFER_SETTING_1     1119
+#define IDC_STATIC_PROFILE_SETTING_4    1120
+#define IDC_EDIT_LONG_LENGTH            1120
+#define IDC_EDIT_CHAMFER_SETTING_REF_1  1120
+#define IDC_EDIT_SCAN_SPEED             1120
+#define IDC_STATIC_PROFILE_SETTING_5    1121
+#define IDC_EDIT_SHORT_LENGTH           1121
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_1 1121
+#define IDC_EDIT_SCAN_SPEED_RATE        1121
+#define IDC_STATIC_PROFILE_SETTING_6    1122
+#define IDC_EDIT_CORNER1_X              1122
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_1 1122
+#define IDC_STATIC_PROFILE_SETTING_7    1123
+#define IDC_EDIT_SCAN_TIME              1123
+#define IDC_STATIC_CHAMFER_SETTING_3    1123
+#define IDC_EDIT_EXPOSURE               1123
+#define IDC_STATIC_PROFILE_SETTING_8    1124
+#define IDC_EDIT_CORNER1_PLUS_TOL       1124
+#define IDC_STATIC_CHAMFER_SETTING_4    1124
+#define IDC_EDIT_FRM_RATE_1             1124
+#define IDC_STATIC_PROFILE_SETTING_9    1125
+#define IDC_EDIT_CORNER1_MINUS_TOL      1125
+#define IDC_STATIC_CHAMFER_SETTING_5    1125
+#define IDC_EDIT_FRM_RATE_2             1125
+#define IDC_STATIC_PROFILE_SETTING_10   1126
+#define IDC_EDIT_UP_PLUS_TOL_A2         1126
+#define IDC_STATIC_CHAMFER_SETTING_6    1126
+#define IDC_EDIT_FRM_RATE_3             1126
+#define IDC_STATIC_PROFILE_SETTING_11   1127
+#define IDC_CHECK_CRACK_USE             1127
+#define IDC_STATIC_CHAMFER_SETTING_7    1127
+#define IDC_EDIT_FRM_RATE_4             1127
+#define IDC_STATIC_PROFILE_SETTING_12   1128
+#define IDC_EDIT_DN_REF_A2              1128
+#define IDC_STATIC_CHAMFER_SETTING_8    1128
+#define IDC_STATIC_PROFILE_SETTING_13   1129
+#define IDC_EDIT_DN_PLUS_TOL_A2         1129
+#define IDC_STATIC_CHAMFER_SETTING_9    1129
+#define IDC_SPLINE_IMAGE                1130
+#define IDC_STATIC_PROFILE_SETTING_14   1130
+#define IDC_EDIT_CORNER2_X              1130
+#define IDC_STATIC_CHAMFER_SETTING_10   1130
+#define IDC_BUTTON_USER_DEFECT_AREA_DRAW 1130
+#define IDC_CHECK_USE_SPLINE            1131
+#define IDC_STATIC_PROFILE_SETTING_15   1131
+#define IDC_EDIT_CORNER2_PLUS_TOL       1131
+#define IDC_STATIC_CHAMFER_SETTING_11   1131
+#define IDC_BUTTON_USER_DEFECT_AREA_ADD 1131
+#define IDC_BUT_SPLINE_LOAD             1132
+#define IDC_STATIC_PROFILE_SETTING_16   1132
+#define IDC_EDIT_CORNER2_MINUS_TOL      1132
+#define IDC_STATIC_CHAMFER_SETTING_12   1132
+#define IDC_BUTTON_USER_DEFECT_AREA_MODIFY 1132
+#define IDC_BUT_SPLINE_IMAGE_MINUS      1133
+#define IDC_STATIC_PROFILE_SETTING_17   1133
+#define IDC_EDIT_CORNER3_X              1133
+#define IDC_STATIC_CHAMFER_SETTING_13   1133
+#define IDC_BUTTON_USER_DEFECT_AREA_DELETE 1133
+#define IDC_BUT_SPLINE_IMAGE_1X         1134
+#define IDC_STATIC_PROFILE_SETTING_18   1134
+#define IDC_EDIT_CORNER3_PLUS_TOL       1134
+#define IDC_STATIC_CHAMFER_SETTING_14   1134
+#define IDC_BUTTO_USER_DEFECT_AREA_SAVE 1134
+#define IDC_BUT_SPLINE_IMAGE_PLUS       1135
+#define IDC_STATIC_PROFILE_SETTING_19   1135
+#define IDC_EDIT_CORNER3_MINUS_TOL      1135
+#define IDC_STATIC_CHAMFER_SETTING_15   1135
+#define IDC_SPLINE_TITLE_1              1136
+#define IDC_STATIC_PROFILE_SETTING_20   1136
+#define IDC_EDIT_CORNER4_X              1136
+#define IDC_STATIC_CHAMFER_SETTING_16   1136
+#define IDC_BUT_SPLINE_FINDLINE         1137
+#define IDC_STATIC_PROFILE_SETTING_21   1137
+#define IDC_EDIT_CORNER4_PLUS_TOL       1137
+#define IDC_STATIC_CHAMFER_SETTING_17   1137
+#define IDC_CHECK_USE_SPLINE2           1138
+#define IDC_STATIC_PROFILE_SETTING_22   1138
+#define IDC_EDIT_CORNER4_MINUS_TOL      1138
+#define IDC_STATIC_CHAMFER_SETTING_18   1138
+#define IDC_BUT_SPLINE_ORGIMAGE         1139
+#define IDC_STATIC_PROFILE_SETTING_23   1139
+#define IDC_EDIT_CORNER1_Y              1139
+#define IDC_STATIC_CHAMFER_SETTING_19   1139
+#define IDC_BUT_SPLINE_READ_MASTER      1140
+#define IDC_CHECK_PROFILE_SETTING_3     1140
+#define IDC_EDIT_CORNER2_Y              1140
+#define IDC_STATIC_CHAMFER_SETTING_20   1140
+#define IDC_STATIC_5                    1140
+#define IDC_BUT_SPLINE_SELECTLINE       1141
+#define IDC_CHECK_PROFILE_SETTING_4     1141
+#define IDC_EDIT_UP_REF_B2              1141
+#define IDC_STATIC_CHAMFER_SETTING_21   1141
+#define IDC_BUT_NOTCH_POS_ADD           1141
+#define IDC_STATIC_6                    1141
+#define IDC_BUT_SPLINE_FINALFIND        1142
+#define IDC_CHECK_PROFILE_SETTING_5     1142
+#define IDC_EDIT_CORNER3_Y              1142
+#define IDC_CHECK_CHAMFER_SETTING_2     1142
+#define IDC_EDIT_NOTCH_INS_POINT_AVE_COUNT 1142
+#define IDC_BUT_SPLINE_SAVE_RCUT_MASTER 1143
+#define IDC_CHECK_PROFILE_SETTING_6     1143
+#define IDC_EDIT_CORNER4_Y              1143
+#define IDC_CHECK_CHAMFER_SETTING_3     1143
+#define IDC_CHK_NOTCH_INS_POINT_JUDGE_DIMENSION_USE 1143
+#define IDC_STATIC_8                    1143
+#define IDC_CHECK_USE_SPLINECHIP        1144
+#define IDC_CHECK_PROFILE_SETTING_7     1144
+#define IDC_EDIT_UP_PLUS_TOL_B2         1144
+#define IDC_CHECK_CHAMFER_SETTING_4     1144
+#define IDC_CHK_NOTCH_INS_POINT_JUDGE_CHAMFER_USE 1144
+#define IDC_STATIC_9                    1144
+#define IDC_EDIT_SPLINE_JUDGE_DIST      1145
+#define IDC_CHECK_PROFILE_SETTING_8     1145
+#define IDC_EDIT_DN_REF_B2              1145
+#define IDC_CHECK_CHAMFER_SETTING_5     1145
+#define IDC_BUT_SPLINE_INSPECTION       1146
+#define IDC_CHECK_PROFILE_SETTING_9     1146
+#define IDC_EDIT_DN_PLUS_TOL_B2         1146
+#define IDC_CHECK_CHAMFER_SETTING_6     1146
+#define IDC_BUT_SPLINE_READ_MASTER_C    1147
+#define IDC_CHECK_PROFILE_SETTING_10    1147
+#define IDC_EDIT_UP_REF_C2              1147
+#define IDC_CHECK_CHAMFER_SETTING_7     1147
+#define IDC_EDIT_LAMP_VALUE_1           1147
+#define IDC_SPLINE_LIST                 1148
+#define IDC_CHECK_PROFILE_SETTING_11    1148
+#define IDC_EDIT_UP_PLUS_TOL_C2         1148
+#define IDC_CHECK_CHAMFER_SETTING_8     1148
+#define IDC_EDIT_LAMP_VALUE_2           1148
+#define IDC_BUT_ADD_SPLINE_CHIP         1149
+#define IDC_CHECK_PROFILE_SETTING_12    1149
+#define IDC_EDIT_DN_REF_C2              1149
+#define IDC_CHECK_CHAMFER_SETTING_9     1149
+#define IDC_EDIT_LAMP_VALUE_3           1149
+#define IDC_BUT_DEL_SPLINE_CHIP         1150
+#define IDC_CHECK_PROFILE_SETTING_13    1150
+#define IDC_EDIT_DN_PLUS_TOL_C2         1150
+#define IDC_CHECK_CHAMFER_SETTING_10    1150
+#define IDC_EDIT_LAMP_VALUE_4           1150
+#define IDC_EDIT_SPLINE_LINE_THRES      1151
+#define IDC_CHECK_PROFILE_SETTING_14    1151
+#define IDC_EDIT_UP_REF_D2              1151
+#define IDC_CHECK_CHAMFER_SETTING_11    1151
+#define IDC_EDIT_LAMP_VALUE_5           1151
+#define IDC_EDIT_SPLINE_CHIPSIZE_X      1152
+#define IDC_CHECK_PROFILE_SETTING_15    1152
+#define IDC_EDIT_UP_PLUS_TOL_D2         1152
+#define IDC_CHECK_CHAMFER_SETTING_12    1152
+#define IDC_EDIT_LAMP_VALUE_6           1152
+#define IDC_EDIT_SPLINE_YPOS            1153
+#define IDC_EDIT_SPLINE_START_CORNER_R_SIZE_Y 1153
+#define IDC_CHECK_PROFILE_SETTING_16    1153
+#define IDC_EDIT_DN_REF_D2              1153
+#define IDC_CHECK_CHAMFER_SETTING_13    1153
+#define IDC_EDIT_LAMP_VALUE_7           1153
+#define IDC_EDIT_SPLINE_CHIPINSAREA     1154
+#define IDC_CHECK_PROFILE_SETTING_17    1154
+#define IDC_EDIT_DN_PLUS_TOL_D2         1154
+#define IDC_EDIT_CHAMFER_SETTING_REF_2  1154
+#define IDC_EDIT_LAMP_VALUE_8           1154
+#define IDC_EDIT_SPLINE_CHIPTHRES_TOP   1155
+#define IDC_CHECK_PROFILE_SETTING_18    1155
+#define IDC_EDIT_UP_REF_A3              1155
+#define IDC_EDIT_CHAMFER_SETTING_REF_3  1155
+#define IDC_EDIT_SPLINE_CHIP_START_THETA 1156
+#define IDC_CHECK_PROFILE_SETTING_19    1156
+#define IDC_EDIT_UP_PLUS_TOL_A3         1156
+#define IDC_EDIT_CHAMFER_SETTING_REF_4  1156
+#define IDC_STATIC_IMG_RCUT_LEFT        1156
+#define IDC_EDIT_SPLINE_CHIP_END_THETA  1157
+#define IDC_CHECK_PROFILE_SETTING_20    1157
+#define IDC_EDIT_UP_REF_B3              1157
+#define IDC_EDIT_CHAMFER_SETTING_REF_5  1157
+#define IDC_STATIC_LABEL_3              1157
+#define IDC_STATIC_IMG_RCUT_RIGHT       1157
+#define IDC_EDIT_SPLINE_CHIP_DIST_THETA 1158
+#define IDC_CHECK_PROFILE_SETTING_21    1158
+#define IDC_EDIT_UP_PLUS_TOL_B3         1158
+#define IDC_EDIT_CHAMFER_SETTING_REF_6  1158
+#define IDC_STATIC_LABEL_4              1158
+#define IDC_STATIC_IMG_CCUT_LEFT        1158
+#define IDC_EDIT_SPLINE_END_CORNER_R_SIZE_Y 1159
+#define IDC_CHECK_PROFILE_SETTING_22    1159
+#define IDC_EDIT_UP_REF_C3              1159
+#define IDC_EDIT_CHAMFER_SETTING_REF_7  1159
+#define IDC_STATIC_LABEL_5              1159
+#define IDC_STATIC_IMG_CCUT_RIGHT       1159
+#define IDC_EDIT_USER_DEFECT_AREA_WIDTH 1159
+#define IDC_EDIT_START_CHAMFER_SIZE     1160
+#define IDC_CHECK_PROFILE_SETTING_23    1160
+#define IDC_BTN_MARK_RIGHT              1160
+#define IDC_EDIT_CHAMFER_SETTING_REF_8  1160
+#define IDC_STATIC_LABEL_6              1160
+#define IDC_EDIT_USER_DEFECT_AREA_HEIGHT 1160
+#define IDC_EDIT_END_CHAMFER_SIZE       1161
+#define IDC_BTN_MARK_UP                 1161
+#define IDC_EDIT_CHAMFER_SETTING_REF_9  1161
+#define IDC_STATIC_LABEL_7              1161
+#define IDC_EDIT_USER_DEFECT_AREA_THRESHOLD 1161
+#define IDC_EDIT_SPLINE_START_CORNER_R_RADIUS 1162
+#define IDC_STATIC_PROFILE_SETTING_Y2   1162
+#define IDC_BTN_MARK_DN                 1162
+#define IDC_EDIT_CHAMFER_SETTING_REF_10 1162
+#define IDC_STATIC_LABEL_8              1162
+#define IDC_EDIT_USER_DEFECT_AREA_DILATION 1162
+#define IDC_EDIT_SPLINE_END_CORNER_R_RADIUS 1163
+#define IDC_STATIC_PROFILE_SETTING_PLUS2 1163
+#define IDC_BTN_MARK2_DEL               1163
+#define IDC_EDIT_CHAMFER_SETTING_REF_11 1163
+#define IDC_STATIC_LABEL_9              1163
+#define IDC_STATIC_PROFILE_SETTING_MINUS2 1164
+#define IDC_BTN_MARK3_DEL               1164
+#define IDC_EDIT_CHAMFER_SETTING_REF_12 1164
+#define IDC_STATIC_LABEL_10             1164
+#define IDC_EDIT_PROFILE_SETTING_Y_3    1165
+#define IDC_EDIT_UP_PLUS_TOL_C3         1165
+#define IDC_EDIT_CHAMFER_SETTING_REF_13 1165
+#define IDC_EDIT_PROFILE_SETTING_Y_4    1166
+#define IDC_EDIT_UP_REF_D3              1166
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_2 1166
+#define IDC_EDIT_PROFILE_SETTING_Y_5    1167
+#define IDC_EDIT_UP_PLUS_TOL_D3         1167
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_3 1167
+#define IDC_EDIT_PROFILE_SETTING_Y_6    1168
+#define IDC_EDIT_ORIGINPT_OFFSET_X      1168
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_4 1168
+#define IDC_EDIT_PROFILE_SETTING_Y_7    1169
+#define IDC_EDIT_ORIGINPT_OFFSET_Y      1169
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_5 1169
+#define IDC_STATIC_APP_SIDE             1169
+#define IDC_EDIT_PROFILE_SETTING_Y_8    1170
+#define IDC_EDIT_ORIGINPT_OFFSET_X2     1170
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_6 1170
+#define IDC_STATIC_CAM1                 1170
+#define IDC_EDIT_PROFILE_SETTING_Y_9    1171
+#define IDC_EDIT_ORIGINPT_OFFSET_Y2     1171
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_7 1171
+#define IDC_STATIC_CAM2                 1171
+#define IDC_EDIT_PROFILE_SETTING_Y_10   1172
+#define IDC_EDIT_PROFILE_NG_COUNT       1172
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_8 1172
+#define IDC_STATIC_APP_SIDE2            1172
+#define IDC_CHECK_USE_FREERUN_INSPECT   1172
+#define IDC_EDIT_PROFILE_SETTING_Y_11   1173
+#define IDC_EDIT_PROFILE_NG_COUNT_MIN_DIFF 1173
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_9 1173
+#define IDC_STATIC_CAM3                 1173
+#define IDC_EDIT_FREERUN_MOTOR_SPEED    1173
+#define IDC_EDIT_PROFILE_SETTING_Y_12   1174
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_10 1174
+#define IDC_STATIC_APP_SIDE3            1174
+#define IDC_EDIT_FREERUN_TARGET_RESOLUTION 1174
+#define IDC_EDIT_PROFILE_SETTING_Y_13   1175
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_11 1175
+#define IDC_STATIC_CAM4                 1175
+#define IDC_EDIT_FREERUN_PERIOD         1175
+#define IDC_EDIT_PROFILE_SETTING_Y_14   1176
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_12 1176
+#define IDC_STATIC_APP_SIDE4            1176
+#define IDC_EDIT_PREERUN_EXPOSURETIME   1176
+#define IDC_EDIT_PROFILE_SETTING_Y_15   1177
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_13 1177
+#define IDC_SCROLLBAR1                  1177
+#define IDC_BUTTON_CAL_FREERUN          1177
+#define IDC_EDIT_SPLINE_CHIPSIZE_Y      1178
+#define IDC_EDIT_PROFILE_SETTING_Y_16   1178
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_2 1178
+#define IDC_SCROLLBAR2                  1178
+#define IDC_EDIT_TRIGGER_COM_PORT       1178
+#define IDC_CHECK_SPLINE_CHIP_AND       1179
+#define IDC_EDIT_PROFILE_SETTING_Y_17   1179
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_3 1179
+#define IDC_SCROLLBAR3                  1179
+#define IDC_CHECK_USE_TRIGGER_BOARD     1179
+#define IDC_EDIT_PROFILE_SETTING_Y_18   1180
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_4 1180
+#define IDC_SCROLLBAR4                  1180
+#define IDC_EDIT_FULL_IMAGE_RATIO       1180
+#define IDC_EDIT_PROFILE_SETTING_Y_19   1181
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_5 1181
+#define IDC_RDO_SIGNAL1                 1181
+#define IDC_EDIT_PROFILE_SETTING_Y_20   1182
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_6 1182
+#define IDC_RDO_SIGNAL2                 1182
+#define IDC_EDIT_PROFILE_SETTING_Y_21   1183
+#define IDC_BTN_MARK1_UPDATE            1183
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_7 1183
+#define IDC_EDIT_PROFILE_SETTING_PLUS_3 1184
+#define IDC_BTN_MARK2_UPDATE            1184
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_8 1184
+#define IDC_EDIT_PROFILE_SETTING_PLUS_4 1185
+#define IDC_BTN_MARK3_UPDATE            1185
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_9 1185
+#define IDC_EDIT_PROFILE_SETTING_PLUS_5 1186
+#define IDC_STATIC_MARK1                1186
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_10 1186
+#define IDC_EDIT_PROFILE_SETTING_PLUS_6 1187
+#define IDC_STATIC_MARK2                1187
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_11 1187
+#define IDC_EDIT_PROFILE_SETTING_PLUS_7 1188
+#define IDC_STATIC_MARK3                1188
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_12 1188
+#define IDC_EDIT_PROFILE_SETTING_PLUS_8 1189
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_13 1189
+#define IDC_EDIT_PROFILE_SETTING_PLUS_9 1190
+#define IDC_BTN_MARK_LEFT               1190
+#define IDC_CHECK_CHAMFER_SETTING_14    1190
+#define IDC_EDIT_PROFILE_SETTING_PLUS_10 1191
+#define IDC_CHECK_CHAMFER_SETTING_15    1191
+#define IDC_EDIT_PROFILE_SETTING_PLUS_11 1192
+#define IDC_CHECK_CHAMFER_SETTING_16    1192
+#define IDC_EDIT_PROFILE_SETTING_PLUS_12 1193
+#define IDC_CHECK_CHAMFER_SETTING_17    1193
+#define IDC_EDIT_PROFILE_SETTING_PLUS_13 1194
+#define IDC_BTN_MARK1_DEL               1194
+#define IDC_CHECK_CHAMFER_SETTING_18    1194
+#define IDC_EDIT_PROFILE_SETTING_PLUS_14 1195
+#define IDC_CHECK_CHAMFER_SETTING_19    1195
+#define IDC_EDIT_PROFILE_SETTING_MINUS_3 1196
+#define IDC_CHECK_CHAMFER_SETTING_20    1196
+#define IDC_EDIT_PROFILE_SETTING_MINUS_4 1197
+#define IDC_CHECK_CHAMFER_SETTING_21    1197
+#define IDC_EDIT_PROFILE_SETTING_MINUS_5 1198
+#define IDC_EDIT_CHAMFER_SETTING_REF_14 1198
+#define IDC_EDIT_PROFILE_SETTING_MINUS_6 1199
+#define IDC_EDIT_CHAMFER_SETTING_REF_15 1199
+#define IDC_EDIT_PROFILE_SETTING_MINUS_7 1200
+#define IDC_EDIT_CHAMFER_SETTING_REF_16 1200
+#define IDC_EDIT_PROFILE_SETTING_MINUS_8 1201
+#define IDC_EDIT_CHAMFER_SETTING_REF_17 1201
+#define IDC_NEWPPID_NAME_TITLE          1201
+#define IDC_EDIT_PROFILE_SETTING_MINUS_9 1202
+#define IDC_EDIT_CHAMFER_SETTING_REF_18 1202
+#define IDC_EDIT_PPIDNEW_NAME           1202
+#define IDC_EDIT_PROFILE_SETTING_MINUS_10 1203
+#define IDC_BUTTON_LINK                 1203
+#define IDC_EDIT_CHAMFER_SETTING_REF_19 1203
+#define IDC_EDIT_PROFILE_SETTING_MINUS_11 1204
+#define IDC_EDIT_CHAMFER_SETTING_REF_20 1204
+#define IDC_EDIT_PROFILE_SETTING_MINUS_12 1205
+#define IDC_EDIT_CHAMFER_SETTING_REF_21 1205
+#define IDC_EDIT_PROFILE_SETTING_MINUS_13 1206
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_14 1206
+#define IDC_EDIT_PROFILE_SETTING_MINUS_14 1207
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_15 1207
+#define IDC_CHECK_USE_SP_COR_USE        1208
+#define IDC_EDIT_PROFILE_SETTING_PLUS_15 1208
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_16 1208
+#define IDC_EDIT_PROFILE_SETTING_PLUS_16 1209
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_17 1209
+#define IDC_EDIT_PROFILE_SETTING_PLUS_17 1210
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_18 1210
+#define IDC_EDIT_PX                     1210
+#define IDC_EDIT_PROFILE_SETTING_PLUS_18 1211
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_19 1211
+#define IDC_EDIT_PY                     1211
+#define IDC_EDIT_PROFILE_SETTING_PLUS_19 1212
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_20 1212
+#define IDC_EDIT_ROI_W                  1212
+#define IDC_EDIT_PROFILE_SETTING_PLUS_20 1213
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_21 1213
+#define IDC_EDIT_ROI_H                  1213
+#define IDC_EDIT_SPLINE_COR_THRES       1214
+#define IDC_EDIT_PROFILE_SETTING_PLUS_21 1214
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_14 1214
+#define IDC_BTN_ADD                     1214
+#define IDC_EDIT_PROFILE_SETTING_MINUS_15 1215
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_15 1215
+#define IDC_BTN_MODIFY                  1215
+#define IDC_EDIT_SPLINE_COR_RANGE       1216
+#define IDC_EDIT_PROFILE_SETTING_MINUS_16 1216
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_16 1216
+#define IDC_BTN_DELETE                  1216
+#define IDC_EDIT_PROFILE_SETTING_MINUS_17 1217
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_17 1217
+#define IDC_BTN_DELETE_ALL              1217
+#define IDC_EDIT_PROFILE_SETTING_MINUS_18 1218
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_18 1218
+#define IDC_EDIT_PROFILE_SETTING_MINUS_19 1219
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_19 1219
+#define IDC_EDIT_ERR_DX                 1219
+#define IDC_EDIT_PROFILE_SETTING_MINUS_20 1220
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_20 1220
+#define IDC_EDIT_ERR_DY                 1220
+#define IDC_EDIT_PROFILE_SETTING_MINUS_21 1221
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_21 1221
+#define IDC_CHK_TFT_CHIPPING            1221
+#define IDC_EDIT_PROFILE_SETTING_Y_22   1222
+#define IDC_STATIC_CHAMFER_SETTING_22   1222
+#define IDC_CHK_TFT_BUR                 1222
+#define IDC_EDIT_PROFILE_SETTING_PLUS_22 1223
+#define IDC_CHECK_CHAMFER_SETTING_22    1223
+#define IDC_CHK_TFT_BROKEN              1223
+#define IDC_EDIT_PROFILE_SETTING_MINUS_22 1224
+#define IDC_STATIC_CHAMFER_SETTING_REF2 1224
+#define IDC_EDIT_PROFILE_SETTING_Y_23   1225
+#define IDC_STATIC_CHAMFER_SETTING_PLUS2 1225
+#define IDC_CF_CHIPPING                 1225
+#define IDC_EDIT_PROFILE_SETTING_PLUS_23 1226
+#define IDC_STATIC_CHAMFER_SETTING_MINUS2 1226
+#define IDC_CF_BUR                      1226
+#define IDC_EDIT_PROFILE_SETTING_MINUS_23 1227
+#define IDC_EDIT_CHAMFER_SETTING_REF_22 1227
+#define IDC_CHK_CRACK                   1227
+#define IDC_STATIC_PROFILE_SETTING_24   1228
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_22 1228
+#define IDC_CHK_DETECT_LIMITED_AREA     1228
+#define IDC_STATIC_PROFILE_SETTING_25   1229
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_22 1229
+#define IDC_UPDN_WIDTH2                 1230
+#define IDC_STATIC_PROFILE_SETTING_26   1230
+#define IDC_STATIC_CHAMFER_SETTING_23   1230
+#define IDC_UPDN_WIDTH5                 1231
+#define IDC_STATIC_PROFILE_SETTING_27   1231
+#define IDC_STATIC_CHAMFER_SETTING_24   1231
+#define IDC_STATIC_PROFILE_SETTING_28   1232
+#define IDC_STATIC_CHAMFER_SETTING_25   1232
+#define IDC_STATIC_PROFILE_SETTING_29   1233
+#define IDC_STATIC_GND1                 1233
+#define IDC_STATIC_CHAMFER_SETTING_26   1233
+#define IDC_STATIC_PROFILE_SETTING_30   1234
+#define IDC_STATIC33                    1234
+#define IDC_STATIC_CHAMFER_SETTING_27   1234
+#define IDC_STATIC_PROFILE_SETTING_31   1235
+#define IDC_STATIC_GND2                 1235
+#define IDC_STATIC_CHAMFER_SETTING_28   1235
+#define IDC_STATIC_PROFILE_SETTING_32   1236
+#define IDC_STATIC_GND3                 1236
+#define IDC_STATIC_CHAMFER_SETTING_29   1236
+#define IDC_STATIC_PROFILE_SETTING_33   1237
+#define IDC_STATIC_C1                   1237
+#define IDC_STATIC_CHAMFER_SETTING_30   1237
+#define IDC_STATIC_PROFILE_SETTING_34   1238
+#define IDC_STATIC_GND4                 1238
+#define IDC_STATIC_CHAMFER_SETTING_31   1238
+#define IDC_STATIC_PROFILE_SETTING_35   1239
+#define IDC_STATIC_C2                   1239
+#define IDC_STATIC_CHAMFER_SETTING_32   1239
+#define IDC_STATIC_RECIPE_BASE_BAR      1240
+#define IDC_STATIC_PROFILE_SETTING_36   1240
+#define IDC_STATIC_C3                   1240
+#define IDC_STATIC_CHAMFER_SETTING_33   1240
+#define IDC_STATIC_RECIPE_NAME          1241
+#define IDC_STATIC_PROFILE_SETTING_37   1241
+#define IDC_STATIC36                    1241
+#define IDC_STATIC_CHAMFER_SETTING_34   1241
+#define IDC_STATIC_PROFILE_SETTING_38   1242
+#define IDC_EDIT_SKIP_LINE              1242
+#define IDC_STATIC_CHAMFER_SETTING_35   1242
+#define IDC_STATIC_RECIPE_COMMENT       1243
+#define IDC_STATIC_PROFILE_SETTING_39   1243
+#define IDC_STATIC_GND5                 1243
+#define IDC_STATIC_CHAMFER_SETTING_36   1243
+#define IDC_STATIC_PROFILE_SETTING_40   1244
+#define IDC_STATIC_C4                   1244
+#define IDC_STATIC_CHAMFER_SETTING_37   1244
+#define IDC_STATIC_PROFILE_SETTING_41   1245
+#define IDC_STATIC_C5                   1245
+#define IDC_STATIC_CHAMFER_SETTING_38   1245
+#define IDC_STATIC_PROFILE_SETTING_42   1246
+#define IDC_STATIC_C6                   1246
+#define IDC_STATIC_CHAMFER_SETTING_39   1246
+#define IDC_CHECK_PROFILE_SETTING_24    1247
+#define IDC_STATIC_C44                  1247
+#define IDC_STATIC_CHAMFER_SETTING_40   1247
+#define IDC_CHECK_PROFILE_SETTING_25    1248
+#define IDC_STATIC_C7                   1248
+#define IDC_STATIC_CHAMFER_SETTING_41   1248
+#define IDC_CHECK_PROFILE_SETTING_26    1249
+#define IDC_STATIC_C8                   1249
+#define IDC_STATIC_CHAMFER_SETTING_42   1249
+#define IDC_CHECK_PROFILE_SETTING_27    1250
+#define IDC_STATIC_C9                   1250
+#define IDC_CHECK_CHAMFER_SETTING_23    1250
+#define IDC_CHECK_PROFILE_SETTING_28    1251
+#define IDC_STATIC_C10                  1251
+#define IDC_CHECK_CHAMFER_SETTING_24    1251
+#define IDC_CHECK_PROFILE_SETTING_29    1252
+#define IDC_STATIC_C11                  1252
+#define IDC_CHECK_CHAMFER_SETTING_25    1252
+#define IDC_BTN_CLOSE                   1252
+#define IDC_CHECK_PROFILE_SETTING_30    1253
+#define IDC_STATIC_C12                  1253
+#define IDC_CHECK_CHAMFER_SETTING_26    1253
+#define IDC_CHECK_PROFILE_SETTING_31    1254
+#define IDC_STATIC_C13                  1254
+#define IDC_CHECK_CHAMFER_SETTING_27    1254
+#define IDC_CHECK_PROFILE_SETTING_32    1255
+#define IDC_STATIC_C25                  1255
+#define IDC_CHECK_CHAMFER_SETTING_28    1255
+#define IDC_CHECK_PROFILE_SETTING_33    1256
+#define IDC_STATIC_C45                  1256
+#define IDC_CHECK_CHAMFER_SETTING_29    1256
+#define IDC_STATIC_INSINFO_EQPNO        1256
+#define IDC_CHECK_PROFILE_SETTING_34    1257
+#define IDC_STATIC_C46                  1257
+#define IDC_CHECK_CHAMFER_SETTING_30    1257
+#define IDC_STATIC_INSINFO_UNITNO       1257
+#define IDC_CHECK_PROFILE_SETTING_35    1258
+#define IDC_STATIC_C26                  1258
+#define IDC_CHECK_CHAMFER_SETTING_31    1258
+#define IDC_EDIT_PROFILE_SETTING_Y_24   1259
+#define IDC_STATIC_C27                  1259
+#define IDC_CHECK_CHAMFER_SETTING_32    1259
+#define IDC_EDIT_PROFILE_SETTING_Y_25   1260
+#define IDC_STATIC_C28                  1260
+#define IDC_CHECK_CHAMFER_SETTING_33    1260
+#define IDC_EDIT_PROFILE_SETTING_Y_26   1261
+#define IDC_STATIC_C29                  1261
+#define IDC_CHECK_CHAMFER_SETTING_34    1261
+#define IDC_EDIT_PROFILE_SETTING_Y_27   1262
+#define IDC_STATIC_C47                  1262
+#define IDC_CHECK_CHAMFER_SETTING_35    1262
+#define IDC_STATIC_INSINFO_ROUGHPANLAYER 1262
+#define IDC_STATIC_102                  1263
+#define IDC_EDIT_PROFILE_SETTING_Y_28   1263
+#define IDC_STATIC_C48                  1263
+#define IDC_CHECK_CHAMFER_SETTING_36    1263
+#define IDC_STATIC_INSINFO_ROUGHPADCOUNT 1263
+#define IDC_EDIT_PROFILE_SETTING_Y_29   1264
+#define IDC_STATIC_101                  1264
+#define IDC_CHECK_CHAMFER_SETTING_37    1264
+#define IDC_STATIC_INSINFO_ROUGHNPADLAYER 1264
+#define IDC_EDIT_PROFILE_SETTING_Y_30   1265
+#define IDC_STATIC_103                  1265
+#define IDC_CHECK_CHAMFER_SETTING_38    1265
+#define IDC_STATIC_INSINFO_ROUGHNPADCOUNT 1265
+#define IDC_CBO_SPLINE_TYPE             1266
+#define IDC_EDIT_PROFILE_SETTING_Y_31   1266
+#define IDC_STATIC_C34                  1266
+#define IDC_CHECK_CHAMFER_SETTING_39    1266
+#define IDC_EDIT_PROFILE_SETTING_Y_32   1267
+#define IDC_STATIC_C35                  1267
+#define IDC_CHECK_CHAMFER_SETTING_40    1267
+#define IDC_NOTCH_IMAGE                 1267
+#define IDC_EDIT_PROFILE_SETTING_Y_33   1268
+#define IDC_STATIC_C49                  1268
+#define IDC_CHECK_CHAMFER_SETTING_41    1268
+#define IDC_CHECK_USE_NOTCH_CHIP_INS    1268
+#define IDC_STATIC_C36                  1268
+#define IDC_EDIT_PROFILE_SETTING_Y_34   1269
+#define IDC_STATIC_107                  1269
+#define IDC_CHECK_CHAMFER_SETTING_42    1269
+#define IDC_BUT_NOTCH_LOAD              1269
+#define IDC_STATIC_C37                  1269
+#define IDC_EDIT_PROFILE_SETTING_Y_35   1270
+#define IDC_STATIC_108                  1270
+#define IDC_EDIT_CHAMFER_SETTING_REF_23 1270
+#define IDC_NOTCH_TITLE_1               1270
+#define IDC_STATIC_INSINFO_ROUGHPANLAYER_2 1270
+#define IDC_EDIT_PROFILE_SETTING_PLUS_24 1271
+#define IDC_STATIC_C50                  1271
+#define IDC_EDIT_CHAMFER_SETTING_REF_24 1271
+#define IDC_STATIC_INSINFO_ROUGHPADCOUNT_2 1271
+#define IDC_EDIT_PROFILE_SETTING_PLUS_25 1272
+#define IDC_STATIC_C51                  1272
+#define IDC_EDIT_CHAMFER_SETTING_REF_25 1272
+#define IDC_BUT_NOTCH_SELECTLINE        1272
+#define IDC_STATIC_INSINFO_ROUGHNPADLAYER_2 1272
+#define IDC_EDIT_PROFILE_SETTING_PLUS_26 1273
+#define IDC_EDIT_CHAMFER_SETTING_REF_26 1273
+#define IDC_BUT_NOTCH_FINALFIND         1273
+#define IDC_STATIC_INSINFO_ROUGHNPADCOUNT_2 1273
+#define IDC_EDIT_PROFILE_SETTING_PLUS_27 1274
+#define IDC_EDIT_CHAMFER_SETTING_REF_27 1274
+#define IDC_BUT_NOTCH_SAVE_MASTER       1274
+#define IDC_STATIC_C30                  1274
+#define IDC_EDIT_PROFILE_SETTING_PLUS_28 1275
+#define IDC_EDIT_CHAMFER_SETTING_REF_28 1275
+#define IDC_CHECK_USE_NOTCH_SIZE_INS    1275
+#define IDC_STATIC_INSINFO_ISGRIND      1275
+#define IDC_EDIT_PROFILE_SETTING_PLUS_29 1276
+#define IDC_STATIC_TOL_C1               1276
+#define IDC_EDIT_CHAMFER_SETTING_REF_29 1276
+#define IDC_NOTCH_TITLE_2               1276
+#define IDC_STATIC_C52                  1276
+#define IDC_EDIT_PROFILE_SETTING_PLUS_30 1277
+#define IDC_STATIC_TOL_C2               1277
+#define IDC_EDIT_CHAMFER_SETTING_REF_30 1277
+#define IDC_CHECK_USE_NOTCH_TOPSP_CHIP  1277
+#define IDC_STATIC_INSINFO_STAGENO      1277
+#define IDC_EDIT_PROFILE_SETTING_PLUS_31 1278
+#define IDC_EDIT_CHAMFER_SETTING_REF_31 1278
+#define IDC_CHECK_USE_NOTCH_BOTSP_CHIP  1278
+#define IDC_EDIT_PROFILE_SETTING_PLUS_32 1279
+#define IDC_EDIT_CHAMFER_SETTING_REF_32 1279
+#define IDC_NOTCH_TITLE_3               1279
+#define IDC_EDIT_PROFILE_SETTING_PLUS_33 1280
+#define IDC_EDIT_CHAMFER_SETTING_REF_33 1280
+#define IDC_EDIT_NOTCH_CHIP_DIFF        1280
+#define IDC_EDIT_PROFILE_SETTING_PLUS_34 1281
+#define IDC_STATIC34                    1281
+#define IDC_EDIT_CHAMFER_SETTING_REF_34 1281
+#define IDC_EDIT_NOTCH_SIZE_DIFF        1281
+#define IDC_EDIT_PROFILE_SETTING_PLUS_35 1282
+#define IDC_STATIC35                    1282
+#define IDC_EDIT_CHAMFER_SETTING_REF_35 1282
+#define IDC_EDIT_NOTCH_DET_THRES        1282
+#define IDC_EDIT_PROFILE_SETTING_MINUS_24 1283
+#define IDC_STATIC37                    1283
+#define IDC_EDIT_CHAMFER_SETTING_REF_36 1283
+#define IDC_EDIT_NOTCH_SIZE_THRES       1283
+#define IDC_EDIT_PROFILE_SETTING_MINUS_25 1284
+#define IDC_EDIT_CHAMFER_SETTING_REF_37 1284
+#define IDC_BUT_NOTCH_MARK_LOAD         1284
+#define IDC_EDIT_PROFILE_SETTING_MINUS_26 1285
+#define IDC_EDIT_CHAMFER_SETTING_REF_38 1285
+#define IDC_EDIT_NOTCH_CHIP_THRES       1285
+#define IDC_EDIT_PROFILE_SETTING_MINUS_27 1286
+#define IDC_EDIT_CHAMFER_SETTING_REF_39 1286
+#define IDC_EDIT_NOTCH_VSTART           1286
+#define IDC_EDIT_PROFILE_SETTING_MINUS_28 1287
+#define IDC_EDIT_CHAMFER_SETTING_REF_40 1287
+#define IDC_EDIT_NOTCH_VSIZE            1287
+#define IDC_EDIT_PROFILE_SETTING_MINUS_29 1288
+#define IDC_EDIT_CHAMFER_SETTING_REF_41 1288
+#define IDC_EDIT_NOTCH_MARK_XPOS_TOP    1288
+#define IDC_EDIT_PROFILE_SETTING_MINUS_30 1289
+#define IDC_EDIT_CHAMFER_SETTING_REF_42 1289
+#define IDC_EDIT_NOTCH_MARK_XSIZE_TOP   1289
+#define IDC_EDIT_PROFILE_SETTING_MINUS_31 1290
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_23 1290
+#define IDC_EDIT_NOTCH_BASE_THICK       1290
+#define IDC_EDIT_PROFILE_SETTING_MINUS_32 1291
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_24 1291
+#define IDC_EDIT_NOTCH_THICK_DIFF       1291
+#define IDC_EDIT_PROFILE_SETTING_MINUS_33 1292
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_25 1292
+#define IDC_BUT_NOTCH_MARK_SAVE_MASTER  1292
+#define IDC_EDIT_PROFILE_SETTING_MINUS_34 1293
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_26 1293
+#define IDC_NOTCH_MASTER_IMAGE_VIEW     1293
+#define IDC_EDIT_PROFILE_SETTING_MINUS_35 1294
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_27 1294
+#define IDC_EDIT_NOTCH_MARK_YPOS_TOP    1294
+#define IDC_CHECK_PROFILE_SETTING_36    1295
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_28 1295
+#define IDC_EDIT_NOTCH_MARK_YSIZE_TOP   1295
+#define IDC_CHECK_PROFILE_SETTING_37    1296
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_29 1296
+#define IDC_EDIT_NOTCH_MARK_XPOS_BOT    1296
+#define IDC_CHECK_PROFILE_SETTING_38    1297
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_30 1297
+#define IDC_EDIT_NOTCH_MARK_XSIZE_BOT   1297
+#define IDC_CHECK_PROFILE_SETTING_39    1298
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_31 1298
+#define IDC_EDIT_NOTCH_MARK_YPOS_BOT    1298
+#define IDC_CHECK_PROFILE_SETTING_40    1299
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_32 1299
+#define IDC_EDIT_NOTCH_MARK_YSIZE_BOT   1299
+#define IDC_CHECK_PROFILE_SETTING_41    1300
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_33 1300
+#define IDC_EDIT_NOTCH_ALIGN2GLASS      1300
+#define IDC_CHECK_PROFILE_SETTING_42    1301
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_34 1301
+#define IDC_EDIT_NOTCH_SKIPSIZE         1301
+#define IDC_EDIT_PROFILE_SETTING_Y_36   1302
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_35 1302
+#define IDC_EDIT_NOTCH_TOPSP_INSSIZE    1302
+#define IDC_EDIT_PROFILE_SETTING_Y_37   1303
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_23 1303
+#define IDC_EDIT_NOTCH_BOTSP_INSSIZE    1303
+#define IDC_EDIT_PROFILE_SETTING_Y_38   1304
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_24 1304
+#define IDC_EDIT_NOTCH_BLANK2EDGERATIO  1304
+#define IDC_EDIT_PROFILE_SETTING_Y_39   1305
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_25 1305
+#define IDC_EDIT_PROFILE_SETTING_Y_40   1306
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_26 1306
+#define IDC_EDIT_PROFILE_SETTING_Y_41   1307
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_27 1307
+#define IDC_NOTCH_LIST                  1307
+#define IDC_EDIT_PROFILE_SETTING_Y_42   1308
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_28 1308
+#define IDC_EDIT_PROFILE_SETTING_PLUS_36 1309
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_29 1309
+#define IDC_BUT_NOTCH_POS_MOD           1309
+#define IDC_EDIT_PROFILE_SETTING_PLUS_37 1310
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_30 1310
+#define IDC_EDIT_PROFILE_SETTING_PLUS_38 1311
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_31 1311
+#define IDC_EDIT_PROFILE_SETTING_PLUS_39 1312
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_32 1312
+#define IDC_EDIT_PROFILE_SETTING_PLUS_40 1313
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_33 1313
+#define IDC_EDIT_PROFILE_SETTING_PLUS_41 1314
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_34 1314
+#define IDC_EDIT_PROFILE_SETTING_PLUS_42 1315
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_35 1315
+#define IDC_EDIT_PROFILE_SETTING_MINUS_36 1316
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_36 1316
+#define IDC_EDIT_PROFILE_SETTING_MINUS_37 1317
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_37 1317
+#define IDC_EDIT_PROFILE_SETTING_MINUS_38 1318
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_38 1318
+#define IDC_EDIT_PROFILE_SETTING_MINUS_39 1319
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_39 1319
+#define IDC_EDIT_PROFILE_SETTING_MINUS_40 1320
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_40 1320
+#define IDC_EDIT_PROFILE_SETTING_MINUS_41 1321
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_41 1321
+#define IDC_EDIT_SPLINE_COR_CHIP_SIZE   1322
+#define IDC_EDIT_PROFILE_SETTING_MINUS_42 1322
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_42 1322
+#define IDC_STATIC_PROFILE_SETTING_43   1323
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_36 1323
+#define IDC_CHECK_PROFILE_SETTING_43    1324
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_37 1324
+#define IDC_STATIC_C16                  1325
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_38 1325
+#define IDC_STATIC_PROFILE_SETTING_Y3   1326
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_39 1326
+#define IDC_STATIC_PROFILE_SETTING_PLUS3 1327
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_40 1327
+#define IDC_STATIC_PROFILE_SETTING_MINUS3 1328
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_41 1328
+#define IDC_EDIT_PROFILE_SETTING_Y_43   1329
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_42 1329
+#define IDC_VERSION_COMPANYNAME         1329
+#define IDC_EDIT_PROFILE_SETTING_PLUS_43 1330
+#define IDC_STATIC_CHAMFER_SETTING_43   1330
+#define IDC_EDIT_PROFILE_SETTING_MINUS_43 1331
+#define IDC_CHECK_CHAMFER_SETTING_43    1331
+#define IDC_VERSION_FILEDESCRIPTION     1331
+#define IDC_STATIC_PROFILE_SETTING_44   1332
+#define IDC_STATIC_CHAMFER_SETTING_REF3 1332
+#define IDC_VERSION_FILEVERSION         1332
+#define IDC_STATIC_PROFILE_SETTING_45   1333
+#define IDC_STATIC_CHAMFER_SETTING_PLUS3 1333
+#define IDC_VERSION_PRODUCTVERSION      1333
+#define IDC_STATIC_PROFILE_SETTING_46   1334
+#define IDC_STATIC_CHAMFER_SETTING_MINUS3 1334
+#define IDC_VERSION_INTERNALNAME        1334
+#define IDC_STATIC_PROFILE_SETTING_47   1335
+#define IDC_STATIC_CHAMFER_SETTING_44   1335
+#define IDC_VERSION_LEGALCOPYRIGHT      1335
+#define IDC_STATIC_PROFILE_SETTING_48   1336
+#define IDC_STATIC_CHAMFER_SETTING_45   1336
+#define IDC_VERSION_ORIGINALFILENAME    1336
+#define IDC_STATIC_PROFILE_SETTING_49   1337
+#define IDC_STATIC_CHAMFER_SETTING_46   1337
+#define IDC_STATIC_PROFILE_SETTING_50   1338
+#define IDC_STATIC_CHAMFER_SETTING_47   1338
+#define IDC_VERSION_PRODUCTNAME         1338
+#define IDC_STATIC_PROFILE_SETTING_51   1339
+#define IDC_STATIC_CHAMFER_SETTING_48   1339
+#define IDC_VERSION_UPDATE              1339
+#define IDC_STATIC_PROFILE_SETTING_52   1340
+#define IDC_STATIC_CHAMFER_SETTING_49   1340
+#define IDC_STATIC_PROFILE_SETTING_53   1341
+#define IDC_STATIC_CHAMFER_SETTING_50   1341
+#define IDC_STATIC_PROFILE_SETTING_54   1342
+#define IDC_STATIC_CHAMFER_SETTING_51   1342
+#define IDC_STATIC_PROFILE_SETTING_55   1343
+#define IDC_STATIC_CHAMFER_SETTING_52   1343
+#define IDC_STATIC_PROFILE_SETTING_56   1344
+#define IDC_STATIC_CHAMFER_SETTING_53   1344
+#define IDC_STATIC_PROFILE_SETTING_57   1345
+#define IDC_STATIC_CHAMFER_SETTING_54   1345
+#define IDC_STATIC_PROFILE_SETTING_58   1346
+#define IDC_STATIC_CHAMFER_SETTING_55   1346
+#define IDC_STATIC_PROFILE_SETTING_59   1347
+#define IDC_STATIC_CHAMFER_SETTING_56   1347
+#define IDC_CHECK_PROFILE_SETTING_44    1348
+#define IDC_STATIC_CHAMFER_SETTING_57   1348
+#define IDC_CHECK_PROFILE_SETTING_45    1349
+#define IDC_STATIC_CHAMFER_SETTING_58   1349
+#define IDC_CHECK_PROFILE_SETTING_46    1350
+#define IDC_STATIC_CHAMFER_SETTING_59   1350
+#define IDC_CHECK_PROFILE_SETTING_47    1351
+#define IDC_EDIT_CHAMFER_SETTING_REF_43 1351
+#define IDC_CHECK_PROFILE_SETTING_48    1352
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_43 1352
+#define IDC_CHECK_PROFILE_SETTING_49    1353
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_43 1353
+#define IDC_CHECK_PROFILE_SETTING_50    1354
+#define IDC_CHECK_CHAMFER_SETTING_44    1354
+#define IDC_CHECK_PROFILE_SETTING_51    1355
+#define IDC_CHECK_CHAMFER_SETTING_45    1355
+#define IDC_CHECK_PROFILE_SETTING_52    1356
+#define IDC_CHECK_CHAMFER_SETTING_46    1356
+#define IDC_CHECK_PROFILE_SETTING_53    1357
+#define IDC_CHECK_CHAMFER_SETTING_47    1357
+#define IDC_CHECK_PROFILE_SETTING_54    1358
+#define IDC_CHECK_CHAMFER_SETTING_48    1358
+#define IDC_CHECK_PROFILE_SETTING_55    1359
+#define IDC_CHECK_CHAMFER_SETTING_49    1359
+#define IDC_CHECK_PROFILE_SETTING_56    1360
+#define IDC_CHECK_CHAMFER_SETTING_50    1360
+#define IDC_EDIT_PROFILE_SETTING_Y_44   1361
+#define IDC_CHECK_CHAMFER_SETTING_51    1361
+#define IDC_EDIT_PROFILE_SETTING_Y_45   1362
+#define IDC_CHECK_CHAMFER_SETTING_52    1362
+#define IDC_EDIT_PROFILE_SETTING_Y_46   1363
+#define IDC_CHECK_CHAMFER_SETTING_53    1363
+#define IDC_EDIT_PROFILE_SETTING_Y_47   1364
+#define IDC_CHECK_CHAMFER_SETTING_54    1364
+#define IDC_EDIT_PROFILE_SETTING_Y_48   1365
+#define IDC_CHECK_CHAMFER_SETTING_55    1365
+#define IDC_EDIT_PROFILE_SETTING_Y_49   1366
+#define IDC_EDIT_CHAMFER_SETTING_REF_44 1366
+#define IDC_EDIT_PROFILE_SETTING_Y_50   1367
+#define IDC_EDIT_CHAMFER_SETTING_REF_45 1367
+#define IDC_EDIT_PROFILE_SETTING_Y_51   1368
+#define IDC_EDIT_CHAMFER_SETTING_REF_46 1368
+#define IDC_EDIT_PROFILE_SETTING_Y_52   1369
+#define IDC_EDIT_CHAMFER_SETTING_REF_47 1369
+#define IDC_EDIT_PROFILE_SETTING_Y_53   1370
+#define IDC_EDIT_CHAMFER_SETTING_REF_48 1370
+#define IDC_EDIT_PROFILE_SETTING_Y_54   1371
+#define IDC_EDIT_CHAMFER_SETTING_REF_49 1371
+#define IDC_EDIT_PROFILE_SETTING_Y_55   1372
+#define IDC_EDIT_CHAMFER_SETTING_REF_50 1372
+#define IDC_EDIT_PROFILE_SETTING_Y_56   1373
+#define IDC_EDIT_CHAMFER_SETTING_REF_51 1373
+#define IDC_EDIT_PROFILE_SETTING_PLUS_44 1374
+#define IDC_EDIT_CHAMFER_SETTING_REF_52 1374
+#define IDC_EDIT_PROFILE_SETTING_PLUS_45 1375
+#define IDC_EDIT_CHAMFER_SETTING_REF_53 1375
+#define IDC_EDIT_PROFILE_SETTING_PLUS_46 1376
+#define IDC_EDIT_CHAMFER_SETTING_REF_54 1376
+#define IDC_EDIT_PROFILE_SETTING_PLUS_47 1377
+#define IDC_EDIT_CHAMFER_SETTING_REF_55 1377
+#define IDC_EDIT_PROFILE_SETTING_PLUS_48 1378
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_44 1378
+#define IDC_EDIT_PROFILE_SETTING_PLUS_49 1379
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_45 1379
+#define IDC_EDIT_PROFILE_SETTING_PLUS_50 1380
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_46 1380
+#define IDC_EDIT_PROFILE_SETTING_PLUS_51 1381
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_47 1381
+#define IDC_EDIT_PROFILE_SETTING_PLUS_52 1382
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_48 1382
+#define IDC_EDIT_PROFILE_SETTING_PLUS_53 1383
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_49 1383
+#define IDC_EDIT_PROFILE_SETTING_PLUS_54 1384
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_50 1384
+#define IDC_EDIT_PROFILE_SETTING_PLUS_55 1385
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_51 1385
+#define IDC_EDIT_PROFILE_SETTING_PLUS_56 1386
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_52 1386
+#define IDC_EDIT_PROFILE_SETTING_MINUS_44 1387
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_53 1387
+#define IDC_EDIT_PROFILE_SETTING_MINUS_45 1388
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_54 1388
+#define IDC_EDIT_PROFILE_SETTING_MINUS_46 1389
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_55 1389
+#define IDC_EDIT_PROFILE_SETTING_MINUS_47 1390
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_44 1390
+#define IDC_EDIT_PROFILE_SETTING_MINUS_48 1391
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_45 1391
+#define IDC_EDIT_PROFILE_SETTING_MINUS_49 1392
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_46 1392
+#define IDC_EDIT_PROFILE_SETTING_MINUS_50 1393
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_47 1393
+#define IDC_EDIT_PROFILE_SETTING_MINUS_51 1394
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_48 1394
+#define IDC_EDIT_PROFILE_SETTING_MINUS_52 1395
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_49 1395
+#define IDC_EDIT_PROFILE_SETTING_MINUS_53 1396
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_50 1396
+#define IDC_EDIT_PROFILE_SETTING_MINUS_54 1397
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_51 1397
+#define IDC_EDIT_PROFILE_SETTING_MINUS_55 1398
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_52 1398
+#define IDC_EDIT_PROFILE_SETTING_MINUS_56 1399
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_53 1399
+#define IDC_CHECK_PROFILE_SETTING_57    1400
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_54 1400
+#define IDC_CHECK_PROFILE_SETTING_58    1401
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_55 1401
+#define IDC_CHECK_PROFILE_SETTING_59    1402
+#define IDC_CHECK_CHAMFER_SETTING_56    1402
+#define IDC_EDIT_PROFILE_SETTING_Y_57   1403
+#define IDC_CHECK_CHAMFER_SETTING_57    1403
+#define IDC_EDIT_PROFILE_SETTING_Y_58   1404
+#define IDC_STATIC_NOTCH_TH2            1404
+#define IDC_CHECK_CHAMFER_SETTING_58    1404
+#define IDC_EDIT_PROFILE_SETTING_Y_59   1405
+#define IDC_CHECK_CHAMFER_SETTING_59    1405
+#define IDC_EDIT_PROFILE_SETTING_PLUS_57 1406
+#define IDC_EDIT_CHAMFER_SETTING_REF_56 1406
+#define IDC_EDIT_PROFILE_SETTING_PLUS_58 1407
+#define IDC_EDIT_CHAMFER_SETTING_REF_57 1407
+#define IDC_EDIT_PROFILE_SETTING_PLUS_59 1408
+#define IDC_EDIT_CHAMFER_SETTING_REF_58 1408
+#define IDC_EDIT_PROFILE_SETTING_MINUS_57 1409
+#define IDC_EDIT_CHAMFER_SETTING_REF_59 1409
+#define IDC_EDIT_PROFILE_SETTING_MINUS_58 1410
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_56 1410
+#define IDC_EDIT_PROFILE_SETTING_MINUS_59 1411
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_57 1411
+#define IDC_STATIC_PROFILE_SETTING_60   1412
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_58 1412
+#define IDC_CHECK_PROFILE_SETTING_60    1413
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_59 1413
+#define IDC_STATIC_C17                  1414
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_56 1414
+#define IDC_STATIC_C18                  1415
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_57 1415
+#define IDC_BUTTON_OPEN_USER_DEFECT_VIEW 1416
+#define IDC_STATIC_PROFILE_SETTING_R    1416
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_58 1416
+#define IDC_STATIC_C19                  1417
+#define IDC_BUTTON_RCUT_SETTING         1417
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_59 1417
+#define IDC_STATIC_PROFILE_SETTING_PLUS4 1418
+#define IDC_BUTTON_NOTCH_SETTING        1418
+#define IDC_STATIC_CHAMFER_SETTING_60   1418
+#define IDC_BUTTON_RECIPE_LIST          1419
+#define IDC_STATIC_PROFILE_SETTING_MINUS4 1419
+#define IDC_CHECK_CHAMFER_SETTING_60    1419
+#define IDC_STATIC_C20                  1420
+#define IDC_BUTTON_HOLE_SETTING         1420
+#define IDC_STATIC_CHAMFER_SETTING_REF4 1420
+#define IDC_BUTTON_LIGHT_CONTROL        1421
+#define IDC_EDIT_PROFILE_SETTING_PLUS_60 1421
+#define IDC_STATIC_CHAMFER_SETTING_PLUS4 1421
+#define IDC_EDIT_PROFILE_SETTING_MINUS_60 1422
+#define IDC_STATIC_CHAMFER_SETTING_MINUS4 1422
+#define IDC_BUTTON_LANG_ENGLISH         1422
+#define IDC_STATIC_PROFILE_SETTING_61   1423
+#define IDC_EDIT_CHAMFER_SETTING_REF_60 1423
+#define IDC_BUTTON_LANG_KOREAN          1423
+#define IDC_STATIC_PROFILE_SETTING_62   1424
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_60 1424
+#define IDC_BUTTON_LANG_KOREAN2         1424
+#define IDC_BUTTON_LANG_CHINESE         1424
+#define IDC_STATIC_PROFILE_SETTING_63   1425
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_60 1425
+#define IDC_STATIC_PROFILE_SETTING_64   1426
+#define IDC_STATIC_CHAMFER_SETTING_61   1426
+#define IDC_STATIC_PROFILE_SETTING_65   1427
+#define IDC_STATIC_CHAMFER_SETTING_62   1427
+#define IDC_STATIC_PROFILE_SETTING_66   1428
+#define IDC_STATIC_CHAMFER_SETTING_63   1428
+#define IDC_STATIC_PROFILE_SETTING_67   1429
+#define IDC_STATIC_CHAMFER_SETTING_64   1429
+#define IDC_STATIC_PROFILE_SETTING_68   1430
+#define IDC_STATIC_CHAMFER_SETTING_65   1430
+#define IDC_STATIC_PROFILE_SETTING_69   1431
+#define IDC_STATIC_CHAMFER_SETTING_66   1431
+#define IDC_STATIC_PROFILE_SETTING_70   1432
+#define IDC_STATIC_CHAMFER_SETTING_67   1432
+#define IDC_STATIC_PROFILE_SETTING_71   1433
+#define IDC_STATIC_CHAMFER_SETTING_68   1433
+#define IDC_STATIC_PROFILE_SETTING_72   1434
+#define IDC_STATIC_CHAMFER_SETTING_69   1434
+#define IDC_STATIC_PROFILE_SETTING_73   1435
+#define IDC_STATIC_CHAMFER_SETTING_70   1435
+#define IDC_STATIC_PROFILE_SETTING_74   1436
+#define IDC_STATIC_CHAMFER_SETTING_71   1436
+#define IDC_STATIC_PROFILE_SETTING_75   1437
+#define IDC_STATIC_CHAMFER_SETTING_72   1437
+#define IDC_STATIC_PROFILE_SETTING_76   1438
+#define IDC_STATIC_CHAMFER_SETTING_73   1438
+#define IDC_STATIC_PROFILE_SETTING_77   1439
+#define IDC_STATIC_CHAMFER_SETTING_74   1439
+#define IDC_STATIC_PROFILE_SETTING_78   1440
+#define IDC_STATIC_CHAMFER_SETTING_75   1440
+#define IDC_STATIC_PROFILE_SETTING_79   1441
+#define IDC_STATIC_CHAMFER_SETTING_76   1441
+#define IDC_CHECK_PROFILE_SETTING_61    1442
+#define IDC_STATIC_CHAMFER_SETTING_77   1442
+#define IDC_CHECK_PROFILE_SETTING_62    1443
+#define IDC_STATIC_CHAMFER_SETTING_78   1443
+#define IDC_CHECK_PROFILE_SETTING_63    1444
+#define IDC_STATIC_CHAMFER_SETTING_79   1444
+#define IDC_CHECK_PROFILE_SETTING_64    1445
+#define IDC_CHECK_CHAMFER_SETTING_61    1445
+#define IDC_CHECK_PROFILE_SETTING_65    1446
+#define IDC_CHECK_CHAMFER_SETTING_62    1446
+#define IDC_CHECK_PROFILE_SETTING_66    1447
+#define IDC_CHECK_CHAMFER_SETTING_63    1447
+#define IDC_CHECK_PROFILE_SETTING_67    1448
+#define IDC_CHECK_CHAMFER_SETTING_64    1448
+#define IDC_CHECK_PROFILE_SETTING_68    1449
+#define IDC_CHECK_CHAMFER_SETTING_65    1449
+#define IDC_CHECK_PROFILE_SETTING_69    1450
+#define IDC_CHECK_CHAMFER_SETTING_66    1450
+#define IDC_CHECK_PROFILE_SETTING_70    1451
+#define IDC_CHECK_CHAMFER_SETTING_67    1451
+#define IDC_CHECK_PROFILE_SETTING_71    1452
+#define IDC_CHECK_CHAMFER_SETTING_68    1452
+#define IDC_CHECK_PROFILE_SETTING_72    1453
+#define IDC_CHECK_CHAMFER_SETTING_69    1453
+#define IDC_CHECK_PROFILE_SETTING_73    1454
+#define IDC_CHECK_CHAMFER_SETTING_70    1454
+#define IDC_CHECK_PROFILE_SETTING_74    1455
+#define IDC_CHECK_CHAMFER_SETTING_71    1455
+#define IDC_CHECK_PROFILE_SETTING_75    1456
+#define IDC_CHECK_CHAMFER_SETTING_72    1456
+#define IDC_CHECK_PROFILE_SETTING_76    1457
+#define IDC_CHECK_CHAMFER_SETTING_73    1457
+#define IDC_CHECK_PROFILE_SETTING_77    1458
+#define IDC_CHECK_CHAMFER_SETTING_74    1458
+#define IDC_CHECK_PROFILE_SETTING_78    1459
+#define IDC_CHECK_CHAMFER_SETTING_75    1459
+#define IDC_CHECK_PROFILE_SETTING_79    1460
+#define IDC_CHECK_CHAMFER_SETTING_76    1460
+#define IDC_BUTTON_SYSTEM_EXIT          1460
+#define IDC_STATIC_C21                  1461
+#define IDC_CHECK_CHAMFER_SETTING_77    1461
+#define IDC_STATIC_C22                  1462
+#define IDC_CHECK_CHAMFER_SETTING_78    1462
+#define IDC_STATIC_C23                  1463
+#define IDC_CHECK_CHAMFER_SETTING_79    1463
+#define IDC_STATIC_C24                  1464
+#define IDC_EDIT_CHAMFER_SETTING_REF_61 1464
+#define IDC_STATIC_PROFILE_SETTING_R2   1465
+#define IDC_EDIT_CHAMFER_SETTING_REF_62 1465
+#define IDC_STATIC_PROFILE_SETTING_R3   1466
+#define IDC_EDIT_CHAMFER_SETTING_REF_63 1466
+#define IDC_EDIT_CHAMFER_SETTING_REF_64 1467
+#define IDC_EDIT_PROFILE_SETTING_PLUS_61 1468
+#define IDC_EDIT_CHAMFER_SETTING_REF_65 1468
+#define IDC_EDIT_PROFILE_SETTING_PLUS_62 1469
+#define IDC_EDIT_CHAMFER_SETTING_REF_66 1469
+#define IDC_EDIT_PROFILE_SETTING_PLUS_63 1470
+#define IDC_EDIT_CHAMFER_SETTING_REF_67 1470
+#define IDC_EDIT_PROFILE_SETTING_PLUS_64 1471
+#define IDC_EDIT_CHAMFER_SETTING_REF_68 1471
+#define IDC_EDIT_PROFILE_SETTING_PLUS_65 1472
+#define IDC_EDIT_CHAMFER_SETTING_REF_69 1472
+#define IDC_EDIT_PROFILE_SETTING_PLUS_66 1473
+#define IDC_EDIT_CHAMFER_SETTING_REF_70 1473
+#define IDC_EDIT_PROFILE_SETTING_PLUS_67 1474
+#define IDC_EDIT_CHAMFER_SETTING_REF_71 1474
+#define IDC_EDIT_PROFILE_SETTING_PLUS_68 1475
+#define IDC_EDIT_CHAMFER_SETTING_REF_72 1475
+#define IDC_EDIT_PROFILE_SETTING_PLUS_69 1476
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_61 1476
+#define IDC_EDIT_PROFILE_SETTING_PLUS_70 1477
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_62 1477
+#define IDC_EDIT_PROFILE_SETTING_PLUS_71 1478
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_63 1478
+#define IDC_EDIT_PROFILE_SETTING_PLUS_72 1479
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_64 1479
+#define IDC_EDIT_PROFILE_SETTING_PLUS_73 1480
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_65 1480
+#define IDC_EDIT_PROFILE_SETTING_PLUS_74 1481
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_66 1481
+#define IDC_EDIT_PROFILE_SETTING_PLUS_75 1482
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_67 1482
+#define IDC_EDIT_PROFILE_SETTING_PLUS_76 1483
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_68 1483
+#define IDC_EDIT_PROFILE_SETTING_PLUS_77 1484
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_69 1484
+#define IDC_EDIT_PROFILE_SETTING_PLUS_78 1485
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_70 1485
+#define IDC_EDIT_PROFILE_SETTING_PLUS_79 1486
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_71 1486
+#define IDC_EDIT_PROFILE_SETTING_MINUS_61 1487
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_72 1487
+#define IDC_EDIT_PROFILE_SETTING_MINUS_62 1488
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_61 1488
+#define IDC_EDIT_PROFILE_SETTING_MINUS_63 1489
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_62 1489
+#define IDC_EDIT_PROFILE_SETTING_MINUS_64 1490
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_63 1490
+#define IDC_EDIT_PROFILE_SETTING_MINUS_65 1491
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_64 1491
+#define IDC_EDIT_PROFILE_SETTING_MINUS_66 1492
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_65 1492
+#define IDC_EDIT_PROFILE_SETTING_MINUS_67 1493
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_66 1493
+#define IDC_EDIT_PROFILE_SETTING_MINUS_68 1494
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_67 1494
+#define IDC_EDIT_PROFILE_SETTING_MINUS_69 1495
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_68 1495
+#define IDC_EDIT_PROFILE_SETTING_MINUS_70 1496
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_69 1496
+#define IDC_EDIT_PROFILE_SETTING_MINUS_71 1497
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_70 1497
+#define IDC_EDIT_PROFILE_SETTING_MINUS_72 1498
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_71 1498
+#define IDC_EDIT_PROFILE_SETTING_MINUS_73 1499
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_72 1499
+#define IDC_EDIT_PROFILE_SETTING_MINUS_74 1500
+#define IDC_EDIT_CHAMFER_SETTING_REF_73 1500
+#define IDC_EDIT_PROFILE_SETTING_MINUS_75 1501
+#define IDC_EDIT_CHAMFER_SETTING_REF_74 1501
+#define IDC_EDIT_PROFILE_SETTING_MINUS_76 1502
+#define IDC_EDIT_CHAMFER_SETTING_REF_75 1502
+#define IDC_EDIT_PROFILE_SETTING_MINUS_77 1503
+#define IDC_EDIT_CHAMFER_SETTING_REF_76 1503
+#define IDC_EDIT_PROFILE_SETTING_MINUS_78 1504
+#define IDC_EDIT_CHAMFER_SETTING_REF_77 1504
+#define IDC_EDIT_PROFILE_SETTING_MINUS_79 1505
+#define IDC_EDIT_CHAMFER_SETTING_REF_78 1505
+#define IDC_EDIT_PROFILE_SETTING_X_60   1506
+#define IDC_EDIT_CHAMFER_SETTING_REF_79 1506
+#define IDC_EDIT_PROFILE_SETTING_X_65   1507
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_73 1507
+#define IDC_EDIT_PROFILE_SETTING_X_70   1508
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_74 1508
+#define IDC_EDIT_PROFILE_SETTING_X_75   1509
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_75 1509
+#define IDC_EDIT_PROFILE_SETTING_R_60   1510
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_76 1510
+#define IDC_EDIT_PROFILE_SETTING_R_61   1511
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_77 1511
+#define IDC_EDIT_PROFILE_SETTING_R_62   1512
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_78 1512
+#define IDC_EDIT_PROFILE_SETTING_R_63   1513
+#define IDC_EDIT_CHAMFER_SETTING_PLUS_79 1513
+#define IDC_EDIT_PROFILE_SETTING_R_64   1514
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_73 1514
+#define IDC_EDIT_PROFILE_SETTING_R_65   1515
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_74 1515
+#define IDC_EDIT_PROFILE_SETTING_R_66   1516
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_75 1516
+#define IDC_EDIT_PROFILE_SETTING_R_67   1517
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_76 1517
+#define IDC_EDIT_PROFILE_SETTING_R_68   1518
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_77 1518
+#define IDC_EDIT_PROFILE_SETTING_R_69   1519
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_78 1519
+#define IDC_EDIT_PROFILE_SETTING_R_70   1520
+#define IDC_EDIT_CHAMFER_SETTING_MINUS_79 1520
+#define IDC_EDIT_PROFILE_SETTING_R_71   1521
+#define IDC_STATIC_C14                  1521
+#define IDC_EDIT_PROFILE_SETTING_R_72   1522
+#define IDC_STATIC_C31                  1522
+#define IDC_EDIT_PROFILE_SETTING_R_73   1523
+#define IDC_STATIC_C32                  1523
+#define IDC_EDIT_PROFILE_SETTING_R_74   1524
+#define IDC_STATIC_C33                  1524
+#define IDC_EDIT_PROFILE_SETTING_R_75   1525
+#define IDC_STATIC_C38                  1525
+#define IDC_EDIT_PROFILE_SETTING_R_76   1526
+#define IDC_STATIC_C39                  1526
+#define IDC_EDIT_PROFILE_SETTING_R_77   1527
+#define IDC_STATIC_C40                  1527
+#define IDC_EDIT_PROFILE_SETTING_R_78   1528
+#define IDC_STATIC_C41                  1528
+#define IDC_EDIT_PROFILE_SETTING_R_79   1529
+#define IDC_STATIC_C42                  1529
+#define IDC_STATIC_C15                  1530
+#define IDC_STATIC_C43                  1530
+#define IDC_EDIT_PROFILE_SETTING_R_Y_60 1531
+#define IDC_EDIT_PROFILE_SETTING_R_Y_65 1536
+#define IDC_EDIT_PROFILE_SETTING_R_Y_70 1541
+#define IDC_EDIT_PROFILE_SETTING_R_Y_75 1546
+#define IDC_RDO_IS_MARK_UP              1780
+#define IDC_RDO_IS_MARK_DN              1781
+#define IDC_RDO_MARK_POS_1              1782
+#define IDC_RDO_MARK_POS_2              1783
+#define IDC_RDO_MARK_POS_3              1784
+#define IDC_RDO_BRIGHT_MARK             1790
+#define IDC_RDO_DARK_MARK               1791
+#define IDC_RDO_USER_MARK               1792
+#define IDC_RDO_SIDE_A                  1800
+#define IDC_RDO_SIDE_B                  1801
+#define IDC_RDO_SIDE_C                  1802
+#define IDC_RDO_SIDE_D                  1803
+#define IDC_RDO_SIDE_A_DN               1804
+#define IDC_RDO_SIDE_B_DN               1805
+#define IDC_RDO_SIDE_C_DN               1806
+#define IDC_RDO_SIDE_D_DN               1807
+#define IDC_RDO_RCP_INSPECT_SETTING     1808
+#define IDC_RDO_RCP_PROFILE_SETTING     1809
+#define IDC_RDO_RCP_CHAMFER_SETTING     1810
+#define ID_PROFILE_CHECKALL             32782
+#define ID_PROFILE_CLEARALL             32783
+#define ID_PROFILE_CURRENTX             32784
+#define ID_PROFILE_CURRENTY             32785
+#define ID_PROFILE_SAVEDX               32786
+#define ID_PROFILE_SAVEDY               32787
+#define ID_PROFILE_PROJECTIONX          32788
+#define ID_PROFILE_PROJECTIONY          32789
+#define ID_MEASURE_CHECKALL             32790
+#define ID_MEASURE_CLEARALL             32791
+#define ID_MEASURE_DISTANCEX            32792
+#define ID_MEASURE_DISTANCEY            32793
+#define ID_MEASURE_DIAGONAL             32794
+#define ID_IMAGE_MANIFY                 32795
+#define ID_VIEW_CHECKALL                32796
+#define ID_VIEW_CLEARALL                32797
+#define ID_VIEW_SHOW_MEASURE_LINE       32798
+#define ID_VIEW_SHOW_REF_LINE           32799
+#define ID_VIEW_SHOW_SUB_LINE           32800
+#define ID_IMGMODIFY_DRAWBRUSH          32801
+#define ID_VIEW_SHOW_MEASURE_DATA       32812
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        1024
+#define _APS_NEXT_COMMAND_VALUE         32771
+#define _APS_NEXT_CONTROL_VALUE         1001
+#define _APS_NEXT_SYMED_VALUE           1000
+#endif
+#endif
diff --git a/ENRUTResources_zh-CN/targetver.h b/ENRUTResources_zh-CN/targetver.h
new file mode 100644
index 0000000..79934a3
--- /dev/null
+++ b/ENRUTResources_zh-CN/targetver.h
@@ -0,0 +1,8 @@
+锘�#pragma once
+
+// 鍖呮嫭 SDKDDKVer.h 灏嗗畾涔夊彲鐢ㄧ殑鏈�楂樼増鏈殑 Windows 骞冲彴銆�
+
+//濡傛灉瑕佷负浠ュ墠鐨� Windows 骞冲彴鐢熸垚搴旂敤绋嬪簭锛岃鍖呮嫭 WinSDKVer.h锛屽苟
+// 灏� _WIN32_WINNT 瀹忚缃负瑕佹敮鎸佺殑骞冲彴锛岀劧鍚庡啀鍖呮嫭 SDKDDKVer.h銆�
+
+#include <SDKDDKVer.h>
diff --git a/Global_Include/ExpireDayDefine.h b/Global_Include/ExpireDayDefine.h
new file mode 100644
index 0000000..072594a
--- /dev/null
+++ b/Global_Include/ExpireDayDefine.h
@@ -0,0 +1,18 @@
+typedef struct _STU_EXPIRE_DAY
+{
+	int		m_nYear;	
+	int		m_nMonth;
+	int		m_nDay;
+	int		m_nCode;
+
+	_STU_EXPIRE_DAY()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_nYear = m_nMonth = m_nDay = 0;
+		m_nCode = 32783762;
+	}
+
+} STU_EXPIRE_DAY, *pSTU_EXPIRE_DAY;
\ No newline at end of file
diff --git a/Global_Include/FreeImage.h b/Global_Include/FreeImage.h
new file mode 100644
index 0000000..29b7803
--- /dev/null
+++ b/Global_Include/FreeImage.h
@@ -0,0 +1,1102 @@
+// ==========================================================
+// FreeImage 3
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+//
+// Contributors:
+// - see changes log named 'Whatsnew.txt', see header of each .h and .cpp file
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifndef FREEIMAGE_H
+#define FREEIMAGE_H
+
+// Version information ------------------------------------------------------
+
+#define FREEIMAGE_MAJOR_VERSION   3
+#define FREEIMAGE_MINOR_VERSION   15
+#define FREEIMAGE_RELEASE_SERIAL  3
+
+// Compiler options ---------------------------------------------------------
+
+#include <wchar.h>	// needed for UNICODE functions
+
+#if defined(FREEIMAGE_LIB)
+	#define DLL_API
+	#define DLL_CALLCONV
+#else
+	#if defined(_WIN32) || defined(__WIN32__)
+		#define DLL_CALLCONV __stdcall
+		// The following ifdef block is the standard way of creating macros which make exporting 
+		// from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS
+		// symbol defined on the command line. this symbol should not be defined on any project
+		// that uses this DLL. This way any other project whose source files include this file see 
+		// DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
+		// defined with this macro as being exported.
+		#ifdef FREEIMAGE_EXPORTS
+			#define DLL_API __declspec(dllexport)
+		#else
+			#define DLL_API __declspec(dllimport)
+		#endif // FREEIMAGE_EXPORTS
+	#else 
+		// try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
+		#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+			#ifndef GCC_HASCLASSVISIBILITY
+				#define GCC_HASCLASSVISIBILITY
+			#endif
+		#endif // __GNUC__
+		#define DLL_CALLCONV
+		#if defined(GCC_HASCLASSVISIBILITY)
+			#define DLL_API __attribute__ ((visibility("default")))
+		#else
+			#define DLL_API
+		#endif		
+	#endif // WIN32 / !WIN32
+#endif // FREEIMAGE_LIB
+
+// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined
+// If your big endian system isn't being detected, add an OS specific check
+#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \
+	(defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \
+	defined(__BIG_ENDIAN__)
+#define FREEIMAGE_BIGENDIAN
+#endif // BYTE_ORDER
+
+// This really only affects 24 and 32 bit formats, the rest are always RGB order.
+#define FREEIMAGE_COLORORDER_BGR	0
+#define FREEIMAGE_COLORORDER_RGB	1
+#if defined(FREEIMAGE_BIGENDIAN)
+#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
+#else
+#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
+#endif
+
+// Ensure 4-byte enums if we're using Borland C++ compilers
+#if defined(__BORLANDC__)
+#pragma option push -b
+#endif
+
+// For C compatibility --------------------------------------------------------
+
+#ifdef __cplusplus
+#define FI_DEFAULT(x)	= x
+#define FI_ENUM(x)      enum x
+#define FI_STRUCT(x)	struct x
+#else
+#define FI_DEFAULT(x)
+#define FI_ENUM(x)      typedef int x; enum x
+#define FI_STRUCT(x)	typedef struct x x; struct x
+#endif
+
+// Bitmap types -------------------------------------------------------------
+
+FI_STRUCT (FIBITMAP) { void *data; };
+FI_STRUCT (FIMULTIBITMAP) { void *data; };
+
+// Types used in the library (directly copied from Windows) -----------------
+
+#if defined(__MINGW32__) && defined(_WINDOWS_H)
+#define _WINDOWS_	// prevent a bug in MinGW32
+#endif // __MINGW32__
+
+#ifndef _WINDOWS_
+#define _WINDOWS_
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET  0
+#define SEEK_CUR  1
+#define SEEK_END  2
+#endif
+
+#ifndef _MSC_VER
+// define portable types for 32-bit / 64-bit OS
+#include <inttypes.h>
+typedef int32_t BOOL;
+typedef uint8_t BYTE;
+typedef uint16_t WORD;
+typedef uint32_t DWORD;
+typedef int32_t LONG;
+typedef int64_t FIINT64;
+typedef uint64_t FIUINT64;
+#else
+// MS is not C99 ISO compliant
+typedef long BOOL;
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef unsigned long DWORD;
+typedef long LONG;
+typedef signed __int64 FIINT64;
+typedef unsigned __int64 FIUINT64;
+#endif // _MSC_VER
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif // WIN32
+
+typedef struct tagRGBQUAD {
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
+  BYTE rgbBlue;
+  BYTE rgbGreen;
+  BYTE rgbRed;
+#else
+  BYTE rgbRed;
+  BYTE rgbGreen;
+  BYTE rgbBlue;
+#endif // FREEIMAGE_COLORORDER
+  BYTE rgbReserved;
+} RGBQUAD;
+
+typedef struct tagRGBTRIPLE {
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
+  BYTE rgbtBlue;
+  BYTE rgbtGreen;
+  BYTE rgbtRed;
+#else
+  BYTE rgbtRed;
+  BYTE rgbtGreen;
+  BYTE rgbtBlue;
+#endif // FREEIMAGE_COLORORDER
+} RGBTRIPLE;
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif // WIN32
+
+typedef struct tagBITMAPINFOHEADER{
+  DWORD biSize;
+  LONG  biWidth; 
+  LONG  biHeight; 
+  WORD  biPlanes; 
+  WORD  biBitCount;
+  DWORD biCompression; 
+  DWORD biSizeImage; 
+  LONG  biXPelsPerMeter; 
+  LONG  biYPelsPerMeter; 
+  DWORD biClrUsed; 
+  DWORD biClrImportant;
+} BITMAPINFOHEADER, *PBITMAPINFOHEADER; 
+
+typedef struct tagBITMAPINFO { 
+  BITMAPINFOHEADER bmiHeader; 
+  RGBQUAD          bmiColors[1];
+} BITMAPINFO, *PBITMAPINFO;
+
+#endif // _WINDOWS_
+
+// Types used in the library (specific to FreeImage) ------------------------
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif // WIN32
+
+/** 48-bit RGB 
+*/
+typedef struct tagFIRGB16 {
+	WORD red;
+	WORD green;
+	WORD blue;
+} FIRGB16;
+
+/** 64-bit RGBA
+*/
+typedef struct tagFIRGBA16 {
+	WORD red;
+	WORD green;
+	WORD blue;
+	WORD alpha;
+} FIRGBA16;
+
+/** 96-bit RGB Float
+*/
+typedef struct tagFIRGBF {
+	float red;
+	float green;
+	float blue;
+} FIRGBF;
+
+/** 128-bit RGBA Float
+*/
+typedef struct tagFIRGBAF {
+	float red;
+	float green;
+	float blue;
+	float alpha;
+} FIRGBAF;
+
+/** Data structure for COMPLEX type (complex number)
+*/
+typedef struct tagFICOMPLEX {
+    /// real part
+	double r;
+	/// imaginary part
+    double i;
+} FICOMPLEX;
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif // WIN32
+
+// Indexes for byte arrays, masks and shifts for treating pixels as words ---
+// These coincide with the order of RGBQUAD and RGBTRIPLE -------------------
+
+#ifndef FREEIMAGE_BIGENDIAN
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
+// Little Endian (x86 / MS Windows, Linux) : BGR(A) order
+#define FI_RGBA_RED				2
+#define FI_RGBA_GREEN			1
+#define FI_RGBA_BLUE			0
+#define FI_RGBA_ALPHA			3
+#define FI_RGBA_RED_MASK		0x00FF0000
+#define FI_RGBA_GREEN_MASK		0x0000FF00
+#define FI_RGBA_BLUE_MASK		0x000000FF
+#define FI_RGBA_ALPHA_MASK		0xFF000000
+#define FI_RGBA_RED_SHIFT		16
+#define FI_RGBA_GREEN_SHIFT		8
+#define FI_RGBA_BLUE_SHIFT		0
+#define FI_RGBA_ALPHA_SHIFT		24
+#else
+// Little Endian (x86 / MaxOSX) : RGB(A) order
+#define FI_RGBA_RED				0
+#define FI_RGBA_GREEN			1
+#define FI_RGBA_BLUE			2
+#define FI_RGBA_ALPHA			3
+#define FI_RGBA_RED_MASK		0x000000FF
+#define FI_RGBA_GREEN_MASK		0x0000FF00
+#define FI_RGBA_BLUE_MASK		0x00FF0000
+#define FI_RGBA_ALPHA_MASK		0xFF000000
+#define FI_RGBA_RED_SHIFT		0
+#define FI_RGBA_GREEN_SHIFT		8
+#define FI_RGBA_BLUE_SHIFT		16
+#define FI_RGBA_ALPHA_SHIFT		24
+#endif // FREEIMAGE_COLORORDER
+#else
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
+// Big Endian (PPC / none) : BGR(A) order
+#define FI_RGBA_RED				2
+#define FI_RGBA_GREEN			1
+#define FI_RGBA_BLUE			0
+#define FI_RGBA_ALPHA			3
+#define FI_RGBA_RED_MASK		0x0000FF00
+#define FI_RGBA_GREEN_MASK		0x00FF0000
+#define FI_RGBA_BLUE_MASK		0xFF000000
+#define FI_RGBA_ALPHA_MASK		0x000000FF
+#define FI_RGBA_RED_SHIFT		8
+#define FI_RGBA_GREEN_SHIFT		16
+#define FI_RGBA_BLUE_SHIFT		24
+#define FI_RGBA_ALPHA_SHIFT		0
+#else
+// Big Endian (PPC / Linux, MaxOSX) : RGB(A) order
+#define FI_RGBA_RED				0
+#define FI_RGBA_GREEN			1
+#define FI_RGBA_BLUE			2
+#define FI_RGBA_ALPHA			3
+#define FI_RGBA_RED_MASK		0xFF000000
+#define FI_RGBA_GREEN_MASK		0x00FF0000
+#define FI_RGBA_BLUE_MASK		0x0000FF00
+#define FI_RGBA_ALPHA_MASK		0x000000FF
+#define FI_RGBA_RED_SHIFT		24
+#define FI_RGBA_GREEN_SHIFT		16
+#define FI_RGBA_BLUE_SHIFT		8
+#define FI_RGBA_ALPHA_SHIFT		0
+#endif // FREEIMAGE_COLORORDER
+#endif // FREEIMAGE_BIGENDIAN
+
+#define FI_RGBA_RGB_MASK		(FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK)
+
+// The 16bit macros only include masks and shifts, since each color element is not byte aligned
+
+#define FI16_555_RED_MASK		0x7C00
+#define FI16_555_GREEN_MASK		0x03E0
+#define FI16_555_BLUE_MASK		0x001F
+#define FI16_555_RED_SHIFT		10
+#define FI16_555_GREEN_SHIFT	5
+#define FI16_555_BLUE_SHIFT		0
+#define FI16_565_RED_MASK		0xF800
+#define FI16_565_GREEN_MASK		0x07E0
+#define FI16_565_BLUE_MASK		0x001F
+#define FI16_565_RED_SHIFT		11
+#define FI16_565_GREEN_SHIFT	5
+#define FI16_565_BLUE_SHIFT		0
+
+// ICC profile support ------------------------------------------------------
+
+#define FIICC_DEFAULT			0x00
+#define FIICC_COLOR_IS_CMYK		0x01
+
+FI_STRUCT (FIICCPROFILE) { 
+	WORD    flags;	// info flag
+	DWORD	size;	// profile's size measured in bytes
+	void   *data;	// points to a block of contiguous memory containing the profile
+};
+
+// Important enums ----------------------------------------------------------
+
+/** I/O image format identifiers.
+*/
+FI_ENUM(FREE_IMAGE_FORMAT) {
+	FIF_UNKNOWN = -1,
+	FIF_BMP		= 0,
+	FIF_ICO		= 1,
+	FIF_JPEG	= 2,
+	FIF_JNG		= 3,
+	FIF_KOALA	= 4,
+	FIF_LBM		= 5,
+	FIF_IFF = FIF_LBM,
+	FIF_MNG		= 6,
+	FIF_PBM		= 7,
+	FIF_PBMRAW	= 8,
+	FIF_PCD		= 9,
+	FIF_PCX		= 10,
+	FIF_PGM		= 11,
+	FIF_PGMRAW	= 12,
+	FIF_PNG		= 13,
+	FIF_PPM		= 14,
+	FIF_PPMRAW	= 15,
+	FIF_RAS		= 16,
+	FIF_TARGA	= 17,
+	FIF_TIFF	= 18,
+	FIF_WBMP	= 19,
+	FIF_PSD		= 20,
+	FIF_CUT		= 21,
+	FIF_XBM		= 22,
+	FIF_XPM		= 23,
+	FIF_DDS		= 24,
+	FIF_GIF     = 25,
+	FIF_HDR		= 26,
+	FIF_FAXG3	= 27,
+	FIF_SGI		= 28,
+	FIF_EXR		= 29,
+	FIF_J2K		= 30,
+	FIF_JP2		= 31,
+	FIF_PFM		= 32,
+	FIF_PICT	= 33,
+	FIF_RAW		= 34
+};
+
+/** Image type used in FreeImage.
+*/
+FI_ENUM(FREE_IMAGE_TYPE) {
+	FIT_UNKNOWN = 0,	// unknown type
+	FIT_BITMAP  = 1,	// standard image			: 1-, 4-, 8-, 16-, 24-, 32-bit
+	FIT_UINT16	= 2,	// array of unsigned short	: unsigned 16-bit
+	FIT_INT16	= 3,	// array of short			: signed 16-bit
+	FIT_UINT32	= 4,	// array of unsigned long	: unsigned 32-bit
+	FIT_INT32	= 5,	// array of long			: signed 32-bit
+	FIT_FLOAT	= 6,	// array of float			: 32-bit IEEE floating point
+	FIT_DOUBLE	= 7,	// array of double			: 64-bit IEEE floating point
+	FIT_COMPLEX	= 8,	// array of FICOMPLEX		: 2 x 64-bit IEEE floating point
+	FIT_RGB16	= 9,	// 48-bit RGB image			: 3 x 16-bit
+	FIT_RGBA16	= 10,	// 64-bit RGBA image		: 4 x 16-bit
+	FIT_RGBF	= 11,	// 96-bit RGB float image	: 3 x 32-bit IEEE floating point
+	FIT_RGBAF	= 12	// 128-bit RGBA float image	: 4 x 32-bit IEEE floating point
+};
+
+/** Image color type used in FreeImage.
+*/
+FI_ENUM(FREE_IMAGE_COLOR_TYPE) {
+	FIC_MINISWHITE = 0,		// min value is white
+    FIC_MINISBLACK = 1,		// min value is black
+    FIC_RGB        = 2,		// RGB color model
+    FIC_PALETTE    = 3,		// color map indexed
+	FIC_RGBALPHA   = 4,		// RGB color model with alpha channel
+	FIC_CMYK       = 5		// CMYK color model
+};
+
+/** Color quantization algorithms.
+Constants used in FreeImage_ColorQuantize.
+*/
+FI_ENUM(FREE_IMAGE_QUANTIZE) {
+    FIQ_WUQUANT = 0,		// Xiaolin Wu color quantization algorithm
+    FIQ_NNQUANT = 1			// NeuQuant neural-net quantization algorithm by Anthony Dekker
+};
+
+/** Dithering algorithms.
+Constants used in FreeImage_Dither.
+*/
+FI_ENUM(FREE_IMAGE_DITHER) {
+    FID_FS			= 0,	// Floyd & Steinberg error diffusion
+	FID_BAYER4x4	= 1,	// Bayer ordered dispersed dot dithering (order 2 dithering matrix)
+	FID_BAYER8x8	= 2,	// Bayer ordered dispersed dot dithering (order 3 dithering matrix)
+	FID_CLUSTER6x6	= 3,	// Ordered clustered dot dithering (order 3 - 6x6 matrix)
+	FID_CLUSTER8x8	= 4,	// Ordered clustered dot dithering (order 4 - 8x8 matrix)
+	FID_CLUSTER16x16= 5,	// Ordered clustered dot dithering (order 8 - 16x16 matrix)
+	FID_BAYER16x16	= 6		// Bayer ordered dispersed dot dithering (order 4 dithering matrix)
+};
+
+/** Lossless JPEG transformations
+Constants used in FreeImage_JPEGTransform
+*/
+FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
+	FIJPEG_OP_NONE			= 0,	// no transformation
+	FIJPEG_OP_FLIP_H		= 1,	// horizontal flip
+	FIJPEG_OP_FLIP_V		= 2,	// vertical flip
+	FIJPEG_OP_TRANSPOSE		= 3,	// transpose across UL-to-LR axis
+	FIJPEG_OP_TRANSVERSE	= 4,	// transpose across UR-to-LL axis
+	FIJPEG_OP_ROTATE_90		= 5,	// 90-degree clockwise rotation
+	FIJPEG_OP_ROTATE_180	= 6,	// 180-degree rotation
+	FIJPEG_OP_ROTATE_270	= 7		// 270-degree clockwise (or 90 ccw)
+};
+
+/** Tone mapping operators.
+Constants used in FreeImage_ToneMapping.
+*/
+FI_ENUM(FREE_IMAGE_TMO) {
+    FITMO_DRAGO03	 = 0,	// Adaptive logarithmic mapping (F. Drago, 2003)
+	FITMO_REINHARD05 = 1,	// Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
+	FITMO_FATTAL02	 = 2	// Gradient domain high dynamic range compression (R. Fattal, 2002)
+};
+
+/** Upsampling / downsampling filters. 
+Constants used in FreeImage_Rescale.
+*/
+FI_ENUM(FREE_IMAGE_FILTER) {
+	FILTER_BOX		  = 0,	// Box, pulse, Fourier window, 1st order (constant) b-spline
+	FILTER_BICUBIC	  = 1,	// Mitchell & Netravali's two-param cubic filter
+	FILTER_BILINEAR   = 2,	// Bilinear filter
+	FILTER_BSPLINE	  = 3,	// 4th order (cubic) b-spline
+	FILTER_CATMULLROM = 4,	// Catmull-Rom spline, Overhauser spline
+	FILTER_LANCZOS3	  = 5	// Lanczos3 filter
+};
+
+/** Color channels.
+Constants used in color manipulation routines.
+*/
+FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) {
+	FICC_RGB	= 0,	// Use red, green and blue channels
+	FICC_RED	= 1,	// Use red channel
+	FICC_GREEN	= 2,	// Use green channel
+	FICC_BLUE	= 3,	// Use blue channel
+	FICC_ALPHA	= 4,	// Use alpha channel
+	FICC_BLACK	= 5,	// Use black channel
+	FICC_REAL	= 6,	// Complex images: use real part
+	FICC_IMAG	= 7,	// Complex images: use imaginary part
+	FICC_MAG	= 8,	// Complex images: use magnitude
+	FICC_PHASE	= 9		// Complex images: use phase
+};
+
+// Metadata support ---------------------------------------------------------
+
+/**
+  Tag data type information (based on TIFF specifications)
+
+  Note: RATIONALs are the ratio of two 32-bit integer values.
+*/
+FI_ENUM(FREE_IMAGE_MDTYPE) {
+	FIDT_NOTYPE		= 0,	// placeholder 
+	FIDT_BYTE		= 1,	// 8-bit unsigned integer 
+	FIDT_ASCII		= 2,	// 8-bit bytes w/ last byte null 
+	FIDT_SHORT		= 3,	// 16-bit unsigned integer 
+	FIDT_LONG		= 4,	// 32-bit unsigned integer 
+	FIDT_RATIONAL	= 5,	// 64-bit unsigned fraction 
+	FIDT_SBYTE		= 6,	// 8-bit signed integer 
+	FIDT_UNDEFINED	= 7,	// 8-bit untyped data 
+	FIDT_SSHORT		= 8,	// 16-bit signed integer 
+	FIDT_SLONG		= 9,	// 32-bit signed integer 
+	FIDT_SRATIONAL	= 10,	// 64-bit signed fraction 
+	FIDT_FLOAT		= 11,	// 32-bit IEEE floating point 
+	FIDT_DOUBLE		= 12,	// 64-bit IEEE floating point 
+	FIDT_IFD		= 13,	// 32-bit unsigned integer (offset) 
+	FIDT_PALETTE	= 14,	// 32-bit RGBQUAD 
+	FIDT_LONG8		= 16,	// 64-bit unsigned integer 
+	FIDT_SLONG8		= 17,	// 64-bit signed integer
+	FIDT_IFD8		= 18	// 64-bit unsigned integer (offset)
+};
+
+/**
+  Metadata models supported by FreeImage
+*/
+FI_ENUM(FREE_IMAGE_MDMODEL) {
+	FIMD_NODATA			= -1,
+	FIMD_COMMENTS		= 0,	// single comment or keywords
+	FIMD_EXIF_MAIN		= 1,	// Exif-TIFF metadata
+	FIMD_EXIF_EXIF		= 2,	// Exif-specific metadata
+	FIMD_EXIF_GPS		= 3,	// Exif GPS metadata
+	FIMD_EXIF_MAKERNOTE = 4,	// Exif maker note metadata
+	FIMD_EXIF_INTEROP	= 5,	// Exif interoperability metadata
+	FIMD_IPTC			= 6,	// IPTC/NAA metadata
+	FIMD_XMP			= 7,	// Abobe XMP metadata
+	FIMD_GEOTIFF		= 8,	// GeoTIFF metadata
+	FIMD_ANIMATION		= 9,	// Animation metadata
+	FIMD_CUSTOM			= 10,	// Used to attach other metadata types to a dib
+	FIMD_EXIF_RAW		= 11	// Exif metadata as a raw buffer
+};
+
+/**
+  Handle to a metadata model
+*/
+FI_STRUCT (FIMETADATA) { void *data; };
+
+/**
+  Handle to a FreeImage tag
+*/
+FI_STRUCT (FITAG) { void *data; };
+
+// File IO routines ---------------------------------------------------------
+
+#ifndef FREEIMAGE_IO
+#define FREEIMAGE_IO
+
+typedef void* fi_handle;
+typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
+typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
+typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin);
+typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle);
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif // WIN32
+
+FI_STRUCT(FreeImageIO) {
+	FI_ReadProc  read_proc;     // pointer to the function used to read data
+    FI_WriteProc write_proc;    // pointer to the function used to write data
+    FI_SeekProc  seek_proc;     // pointer to the function used to seek
+    FI_TellProc  tell_proc;     // pointer to the function used to aquire the current position
+};
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif // WIN32
+
+/**
+Handle to a memory I/O stream
+*/
+FI_STRUCT (FIMEMORY) { void *data; };
+
+#endif // FREEIMAGE_IO
+
+// Plugin routines ----------------------------------------------------------
+
+#ifndef PLUGINS
+#define PLUGINS
+
+typedef const char *(DLL_CALLCONV *FI_FormatProc)(void);
+typedef const char *(DLL_CALLCONV *FI_DescriptionProc)(void);
+typedef const char *(DLL_CALLCONV *FI_ExtensionListProc)(void);
+typedef const char *(DLL_CALLCONV *FI_RegExprProc)(void);
+typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read);
+typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data);
+typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data);
+typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data);
+typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data);
+typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data);
+typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle);
+typedef const char *(DLL_CALLCONV *FI_MimeProc)(void);
+typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp);
+typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type);
+typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(void);
+typedef BOOL (DLL_CALLCONV *FI_SupportsNoPixelsProc)(void);
+
+FI_STRUCT (Plugin) {
+	FI_FormatProc format_proc;
+	FI_DescriptionProc description_proc;
+	FI_ExtensionListProc extension_proc;
+	FI_RegExprProc regexpr_proc;
+	FI_OpenProc open_proc;
+	FI_CloseProc close_proc;
+	FI_PageCountProc pagecount_proc;
+	FI_PageCapabilityProc pagecapability_proc;
+	FI_LoadProc load_proc;
+	FI_SaveProc save_proc;
+	FI_ValidateProc validate_proc;
+	FI_MimeProc mime_proc;
+	FI_SupportsExportBPPProc supports_export_bpp_proc;
+	FI_SupportsExportTypeProc supports_export_type_proc;
+	FI_SupportsICCProfilesProc supports_icc_profiles_proc;
+	FI_SupportsNoPixelsProc supports_no_pixels_proc;
+};
+
+typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
+
+#endif // PLUGINS
+
+
+// Load / Save flag constants -----------------------------------------------
+
+#define FIF_LOAD_NOPIXELS 0x8000 // loading: load the image header only (not supported by all plugins)
+
+#define BMP_DEFAULT         0
+#define BMP_SAVE_RLE        1
+#define CUT_DEFAULT         0
+#define DDS_DEFAULT			0
+#define EXR_DEFAULT			0		// save data as half with piz-based wavelet compression
+#define EXR_FLOAT			0x0001	// save data as float instead of as half (not recommended)
+#define EXR_NONE			0x0002	// save with no compression
+#define EXR_ZIP				0x0004	// save with zlib compression, in blocks of 16 scan lines
+#define EXR_PIZ				0x0008	// save with piz-based wavelet compression
+#define EXR_PXR24			0x0010	// save with lossy 24-bit float compression
+#define EXR_B44				0x0020	// save with lossy 44% float compression - goes to 22% when combined with EXR_LC
+#define EXR_LC				0x0040	// save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
+#define FAXG3_DEFAULT		0
+#define GIF_DEFAULT			0
+#define GIF_LOAD256			1		// Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color
+#define GIF_PLAYBACK		2		// 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading
+#define HDR_DEFAULT			0
+#define ICO_DEFAULT         0
+#define ICO_MAKEALPHA		1		// convert to 32bpp and create an alpha channel from the AND-mask when loading
+#define IFF_DEFAULT         0
+#define J2K_DEFAULT			0		// save with a 16:1 rate
+#define JP2_DEFAULT			0		// save with a 16:1 rate
+#define JPEG_DEFAULT        0		// loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420)
+#define JPEG_FAST           0x0001	// load the file as fast as possible, sacrificing some quality
+#define JPEG_ACCURATE       0x0002	// load the file with the best quality, sacrificing some speed
+#define JPEG_CMYK			0x0004	// load separated CMYK "as is" (use | to combine with other load flags)
+#define JPEG_EXIFROTATE		0x0008	// load and rotate according to Exif 'Orientation' tag if available
+#define JPEG_QUALITYSUPERB  0x80	// save with superb quality (100:1)
+#define JPEG_QUALITYGOOD    0x0100	// save with good quality (75:1)
+#define JPEG_QUALITYNORMAL  0x0200	// save with normal quality (50:1)
+#define JPEG_QUALITYAVERAGE 0x0400	// save with average quality (25:1)
+#define JPEG_QUALITYBAD     0x0800	// save with bad quality (10:1)
+#define JPEG_PROGRESSIVE	0x2000	// save as a progressive-JPEG (use | to combine with other save flags)
+#define JPEG_SUBSAMPLING_411 0x1000		// save with high 4x1 chroma subsampling (4:1:1) 
+#define JPEG_SUBSAMPLING_420 0x4000		// save with medium 2x2 medium chroma subsampling (4:2:0) - default value
+#define JPEG_SUBSAMPLING_422 0x8000		// save with low 2x1 chroma subsampling (4:2:2) 
+#define JPEG_SUBSAMPLING_444 0x10000	// save with no chroma subsampling (4:4:4)
+#define JPEG_OPTIMIZE		0x20000		// on saving, compute optimal Huffman coding tables (can reduce a few percent of file size)
+#define JPEG_BASELINE		0x40000		// save basic JPEG, without metadata or any markers
+#define KOALA_DEFAULT       0
+#define LBM_DEFAULT         0
+#define MNG_DEFAULT         0
+#define PCD_DEFAULT         0
+#define PCD_BASE            1		// load the bitmap sized 768 x 512
+#define PCD_BASEDIV4        2		// load the bitmap sized 384 x 256
+#define PCD_BASEDIV16       3		// load the bitmap sized 192 x 128
+#define PCX_DEFAULT         0
+#define PFM_DEFAULT         0
+#define PICT_DEFAULT        0
+#define PNG_DEFAULT         0
+#define PNG_IGNOREGAMMA		1		// loading: avoid gamma correction
+#define PNG_Z_BEST_SPEED			0x0001	// save using ZLib level 1 compression flag (default value is 6)
+#define PNG_Z_DEFAULT_COMPRESSION	0x0006	// save using ZLib level 6 compression flag (default recommended value)
+#define PNG_Z_BEST_COMPRESSION		0x0009	// save using ZLib level 9 compression flag (default value is 6)
+#define PNG_Z_NO_COMPRESSION		0x0100	// save without ZLib compression
+#define PNG_INTERLACED				0x0200	// save using Adam7 interlacing (use | to combine with other save flags)
+#define PNM_DEFAULT         0
+#define PNM_SAVE_RAW        0       // If set the writer saves in RAW format (i.e. P4, P5 or P6)
+#define PNM_SAVE_ASCII      1       // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
+#define PSD_DEFAULT         0
+#define PSD_CMYK			1		// reads tags for separated CMYK (default is conversion to RGB)
+#define PSD_LAB				2		// reads tags for CIELab (default is conversion to RGB)
+#define RAS_DEFAULT         0
+#define RAW_DEFAULT         0		// load the file as linear RGB 48-bit
+#define RAW_PREVIEW			1		// try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit
+#define RAW_DISPLAY			2		// load the file as RGB 24-bit
+#define RAW_HALFSIZE		4		// output a half-size color image
+#define SGI_DEFAULT			0
+#define TARGA_DEFAULT       0
+#define TARGA_LOAD_RGB888   1       // If set the loader converts RGB555 and ARGB8888 -> RGB888.
+#define TARGA_SAVE_RLE		2		// If set, the writer saves with RLE compression
+#define TIFF_DEFAULT        0
+#define TIFF_CMYK			0x0001	// reads/stores tags for separated CMYK (use | to combine with compression flags)
+#define TIFF_PACKBITS       0x0100  // save using PACKBITS compression
+#define TIFF_DEFLATE        0x0200  // save using DEFLATE compression (a.k.a. ZLIB compression)
+#define TIFF_ADOBE_DEFLATE  0x0400  // save using ADOBE DEFLATE compression
+#define TIFF_NONE           0x0800  // save without any compression
+#define TIFF_CCITTFAX3		0x1000  // save using CCITT Group 3 fax encoding
+#define TIFF_CCITTFAX4		0x2000  // save using CCITT Group 4 fax encoding
+#define TIFF_LZW			0x4000	// save using LZW compression
+#define TIFF_JPEG			0x8000	// save using JPEG compression
+#define TIFF_LOGLUV			0x10000	// save using LogLuv compression
+#define WBMP_DEFAULT        0
+#define XBM_DEFAULT			0
+#define XPM_DEFAULT			0
+
+// Background filling options ---------------------------------------------------------
+// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas
+
+#define FI_COLOR_IS_RGB_COLOR			0x00	// RGBQUAD color is a RGB color (contains no valid alpha channel)
+#define FI_COLOR_IS_RGBA_COLOR			0x01	// RGBQUAD color is a RGBA color (contains a valid alpha channel)
+#define FI_COLOR_FIND_EQUAL_COLOR		0x02	// For palettized images: lookup equal RGB color from palette
+#define FI_COLOR_ALPHA_IS_INDEX			0x04	// The color's rgbReserved member (alpha) contains the palette index to be used
+#define FI_COLOR_PALETTE_SEARCH_MASK	(FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX)	// No color lookup is performed
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Init / Error routines ----------------------------------------------------
+
+DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE));
+DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void);
+
+// Version routines ---------------------------------------------------------
+
+DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void);
+DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void);
+
+// Message output functions -------------------------------------------------
+
+typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg);
+typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg); 
+
+DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf); 
+DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf);
+DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...);
+
+// Allocate / Clone / Unload routines ---------------------------------------
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
+DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib);
+DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib);
+
+// Header loading routines
+DLL_API BOOL DLL_CALLCONV FreeImage_HasPixels(FIBITMAP *dib);
+
+// Load / Save routines -----------------------------------------------------
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
+
+// Memory I/O stream routines -----------------------------------------------
+
+DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0));
+DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0));
+DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream);
+DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin);
+DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes);
+DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
+DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
+
+DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_SaveMultiBitmapToMemory(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FIMEMORY *stream, int flags);
+
+// Plugin Interface ---------------------------------------------------------
+
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterExternalPlugin(const char *path, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
+DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void);
+DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable);
+DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif);
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format);
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif);
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename);
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsNoPixels(FREE_IMAGE_FORMAT fif);
+
+// Multipaging interface ----------------------------------------------------
+
+DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0));
+DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_SaveMultiBitmapToHandle(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0));
+DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap);
+DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data);
+DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data);
+DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page);
+DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page);
+DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed);
+DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count);
+
+// Filetype request routines ------------------------------------------------
+
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0));
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0));
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0));
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0));
+
+// Image type request routine -----------------------------------------------
+
+DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib);
+
+// FreeImage helper routines ------------------------------------------------
+
+DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void);
+DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
+DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
+
+// Pixel access routines ----------------------------------------------------
+
+DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib);
+DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline);
+
+DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
+
+// DIB info routines --------------------------------------------------------
+
+DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib);
+DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib);
+
+DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib);
+DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res);
+DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res);
+
+DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib);
+DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib);
+DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib);
+
+DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib);
+
+DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib);
+DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib);
+DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled);
+DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count);
+DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib);
+DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index);
+DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib);
+
+DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetThumbnail(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetThumbnail(FIBITMAP *dib, FIBITMAP *thumbnail);
+
+// ICC profile routines -----------------------------------------------------
+
+DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib);
+DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size);
+DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib);
+
+// Line conversion routines -------------------------------------------------
+
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels);
+
+// Smart conversion routines ------------------------------------------------
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm);
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
+DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToFloat(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToUINT16(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGB16(FIBITMAP *dib);
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE));
+
+// tone mapping operators
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param FI_DEFAULT(0), double second_param FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05Ex(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0), double adaptation FI_DEFAULT(1), double color_correction FI_DEFAULT(0));
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85));
+
+// ZLib interface -----------------------------------------------------------
+
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size);
+
+// --------------------------------------------------------------------------
+// Metadata routines --------------------------------------------------------
+// --------------------------------------------------------------------------
+
+// tag creation / destruction
+DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(void);
+DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag);
+DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag);
+
+// tag getters and setters
+DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag);
+DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag);
+DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag);
+DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag);
+DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag);
+DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag);
+DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag);
+
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value);
+
+// iterator
+DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag);
+DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag);
+DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle);
+
+// metadata setter and getter
+DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag);
+
+// helpers
+DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src);
+
+// tag to C string conversion
+DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL));
+
+// --------------------------------------------------------------------------
+// Image manipulation toolkit -----------------------------------------------
+// --------------------------------------------------------------------------
+
+// rotation and flipping
+/// @deprecated see FreeImage_Rotate
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask);
+DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
+DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
+
+// upsampling / downsampling
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE));
+
+// color manipulation routines (point operations)
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma);
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage);
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage);
+DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK));
+DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert);
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE));
+DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap);
+DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha);
+DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices,	BYTE *dstindices, unsigned count, BOOL swap);
+DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b);
+
+// channel processing routines
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
+
+// copy / paste / composite routines
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom);
+DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL));
+DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
+DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom);
+DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib);
+
+// background filling routines
+DLL_API BOOL DLL_CALLCONV FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_EnlargeCanvas(FIBITMAP *src, int left, int top, int right, int bottom, const void *color, int options FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateEx(int width, int height, int bpp, const RGBQUAD *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, const void *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
+
+// miscellaneous algorithms
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3));
+
+// restore the borland-specific enum size option
+#if defined(__BORLANDC__)
+#pragma option pop
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FREEIMAGE_H
diff --git a/Global_Include/SharedMemoryDefine.h b/Global_Include/SharedMemoryDefine.h
new file mode 100644
index 0000000..128c4ba
--- /dev/null
+++ b/Global_Include/SharedMemoryDefine.h
@@ -0,0 +1,47 @@
+#define PLC_CONNECTOR_ALIVE	0
+
+
+#define PLC_READ_ADDRESS_LENGTH 14
+#define PLC_WRITEWORD_TIMER_COUNT	10
+#define PLC_WRITEWORD_TIMER_SIZE	24
+#define PLC_WRITEWORD_LONGDATA_COUNT	3
+#define PLC_LONGDATA_MAXSIZE		1024
+#define PLC_MAX_WORDSIZE		512
+
+#define PLC_WRITEWORD_SIGNAL		0
+#define PLC_WRITEWORD_ADDRESS		(PLC_WRITEWORD_SIGNAL+1)
+#define PLC_WRITEWORD_VALUE			(PLC_WRITEWORD_ADDRESS+14)
+#define PLC_WRITEWORD_TIMER			(PLC_WRITEWORD_VALUE+2)
+
+//10俺 静扁 荤侩
+
+#define PLC_WRITELONG_SIGNAL		(PLC_WRITEWORD_TIMER_COUNT*PLC_WRITEWORD_TIMER_SIZE+10)
+#define PLC_WRITELONG_ADDRESS		(PLC_WRITELONG_SIGNAL+1)
+#define PLC_WRITELONG_WORDLENGTH	(PLC_WRITELONG_ADDRESS+14)
+#define PLC_WRITELONG_DATA			(PLC_WRITELONG_WORDLENGTH+4)
+
+#define PLC_READ_SIGNAL0			(PLC_WRITELONG_SIGNAL+(PLC_WRITEWORD_LONGDATA_COUNT*PLC_LONGDATA_MAXSIZE)+10)
+#define PLC_READ_SIGNAL1			(PLC_READ_SIGNAL0+2)
+#define PLC_READ_SIGNAL2			(PLC_READ_SIGNAL1+2)
+#define PLC_READ_SIGNAL3			(PLC_READ_SIGNAL2+2)
+#define PLC_READ_SIGNAL4			(PLC_READ_SIGNAL3+2)
+
+//拱幅 单捞磐 傈侩
+#define PLC_READ_LONGDATA_SIGNAL_1	(PLC_READ_SIGNAL4+10)
+#define PLC_READ_LONGDATA_ADDRESS_1	(PLC_READ_LONGDATA_SIGNAL_1+2)
+#define PLC_READ_LONGDATA_LENGTH_1	(PLC_READ_LONGDATA_ADDRESS_1+14)
+#define PLC_READ_LONGDATA_VALUE_1	(PLC_READ_LONGDATA_LENGTH_1+14)
+
+//老馆利牢 单捞磐 佬扁侩
+#define PLC_READ_LONGDATA_SIGNAL_2	(PLC_READ_LONGDATA_VALUE_1+PLC_LONGDATA_MAXSIZE+10)
+#define PLC_READ_LONGDATA_ADDRESS_2	(PLC_READ_LONGDATA_SIGNAL_2+2)
+#define PLC_READ_LONGDATA_LENGTH_2	(PLC_READ_LONGDATA_ADDRESS_2+14)
+#define PLC_READ_LONGDATA_VALUE_2	(PLC_READ_LONGDATA_LENGTH_2+14)
+
+//Z绵力绢 厚悼扁 佬扁侩
+#define PLC_READ_LONGDATA_SIGNAL_3	(PLC_READ_LONGDATA_VALUE_2+PLC_LONGDATA_MAXSIZE+10)
+#define PLC_READ_LONGDATA_ADDRESS_3	(PLC_READ_LONGDATA_SIGNAL_3+2)
+#define PLC_READ_LONGDATA_LENGTH_3	(PLC_READ_LONGDATA_ADDRESS_3+14)
+#define PLC_READ_LONGDATA_VALUE_3	(PLC_READ_LONGDATA_LENGTH_3+14)
+
+#define SHARED_MEMORY_SIZE			PLC_READ_LONGDATA_VALUE_3+PLC_LONGDATA_MAXSIZE+20
diff --git a/Lib/ApiVisionSDK/include/ClsVision.h b/Lib/ApiVisionSDK/include/ClsVision.h
new file mode 100644
index 0000000..9994083
--- /dev/null
+++ b/Lib/ApiVisionSDK/include/ClsVision.h
@@ -0,0 +1,421 @@
+#ifndef CLS_VISION_H
+#define CLS_VISION_H
+
+#ifdef EXPORT_DLL_BASE_VISION
+#define EXPORTED_VISION _declspec(dllexport)
+#else
+#define EXPORTED_VISION _declspec(dllimport)
+#endif
+
+class EXPORTED_VISION ClsVision
+{
+public:
+	ClsVision();
+	~ClsVision();
+
+public:
+	//1. 获取当前的软件版本
+	static std::string GetVersion(void);
+
+	//2. 获取更新内容
+	static std::string GetUpdate(void);
+
+	//4. 获取当前的目录
+	static std::string GetAppPathA();
+
+public:
+	//1. 仿射变换
+	static ParaAffine2D VectorAngleToRigid(Point2D ptOrigine, double angleOrigine, Point2D ptTarget, double angleTarget);
+
+	//2. 点到点的距离
+	static double DistancePP(Point2D pt1, Point2D pt2);
+
+	//3. 点到直线的距离
+	static double DistancePL(Point2D pt, Line2D line);
+
+	//4. 直线的交点
+	static Point2D LineIntersection(Line2D line1, Line2D line2);
+
+	//5. 直线的角度
+	static double LineAngle(Line2D line);
+
+	//6. 直线与直线的夹角
+	double AngleLL(Line2D line1, Line2D line2);
+
+	//7. 坐标转换
+	static Point2D CoordinateTransform(Point2D pt, ParaAffine2D affine);
+
+	//8. 点到直线的垂足
+	static Point2D ProjectionPL(Point2D pt, Line2D line);
+
+	//9. 角度转换为弧度
+	static double DegreeToRad(double angle);
+
+	//10. 弧度转换为角度
+	static double RadToDegree(double rad);
+
+	//11. Cos值
+	static double GetCos(double rad);
+
+	//12. Sin值
+	static double GetSin(double rad);
+
+	//13. 最小二乘法直线拟合
+	static void FitLiner(Point2D *ptArray, int sz, double &ka, double &kb);
+
+	//14. 拟合圆
+	static Circle2D FitCircle(Point2D *ptArray, int sz);
+
+	//15. 直线的刚性变换
+	static ParaAffine2D LineVectorToRigid(Line2D lineStandard, Line2D lineReal);
+
+	//16. 三点成员
+	static Circle2D ThreePointsToCircle(Point2D pt1, Point2D pt2, Point2D pt3);
+
+	//17. 执行标定,仿射变化
+	static ParaAffine2D VectorToHomMat2d(std::vector<Point2D> vPtOrigine, std::vector<Point2D> vPtTarget);
+
+	//18. 刚性变换
+	static ParaAffine2D VectorToRigid(std::vector<Point2D> vPtOrigine, std::vector<Point2D> vPtTarget);
+
+	//19. 仿射参数
+	static void HomMat2dToAffinePar(ParaAffine2D affine, double &xMmvsp, double &yMmvsp, double &angle, double &theta);
+
+	//20. 仿射变换
+	static ParaAffine2D VectorToSimilarity(std::vector<Point2D> vPtOrigine, std::vector<Point2D> vPtTarget);
+
+	//21. 创建圆的离散点
+	static void GenCirclePoints(Point2I ptCenter, double radius, double stepLength, std::vector<Point2I> &vPtCircle);
+
+	//22. 执行标定
+	static CalibrateResult CameraCalibrate(double *px, double *py, double *xmm, double *ymm, int sz);
+
+	//23. 坐标转换
+	static Point2D CoordinateTransform(Point2D pt, CalibrateResult calibrate);
+
+	//24. 相机标定
+	static void CalibrateCamera(Point2D *ptArrayCamera, Point2D *ptArrayWorld, int sz, ParaCalibrate &result);
+
+	//25. 旋转中心
+	static Point2D GetRotateCenter(Point2D ptOrigine, Point2D ptRotate, double angle);
+
+	//26. XYTheta标定
+	static void CalibrateXyTheta(std::vector<Point2D> vPtOrgine, std::vector<Point2D> vPtReal, double angle, ParaCalibrate &result);
+
+public:
+	//1. 对象是否存在
+	static bool ObjectExist(HalconCpp::HObject &hObject);
+
+	//2. 拷贝图像
+	static void CopyImage(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget);
+
+	//3. 产生空对象
+	static void GenEmptyObject(HalconCpp::HObject &hObject);
+
+	//4. 均值滤波
+	static void ImageMean(HalconCpp::HObject &hObject, int maskWidth, int maskHeight, HalconCpp::HObject &hTarget);
+
+	//5. 灰度闭运算
+	static void GrayClosing(HalconCpp::HObject &hObject, int maskWidth, int maskHeight, HalconCpp::HObject &hTarget);
+
+	//6. 灰度开运算
+	static void GrayOpening(HalconCpp::HObject &hObject, int maskWidth, int maskHeight, HalconCpp::HObject &hTarget);
+
+	//7. 图像均值
+	static void ImageIntensity(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, double &avgResult, double &stdResult);
+
+	//8. 图像直方图统计
+	static void GetHistogram(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, int sz, int *aryHist);
+
+	//9. 对象组合
+	static void ObjectConcat(HalconCpp::HObject &hObject1, HalconCpp::HObject &hObject2, HalconCpp::HObject &hTarget);
+
+	//10. 截取区域
+	static void ReduceDomain(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//11. 截取图像
+	static void CropDomain(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget);
+
+	//12. 区域转换为图像
+	static void RegionToBin(HalconCpp::HObject &hRegion, int width, int height, HalconCpp::HObject &hTarget);
+
+	//13. 创建NCC匹配句柄
+	static HalconCpp::HTuple CreateNccModel(HalconCpp::HObject &hObject, double angleStart, double angleEnd, double angleStep, int limitTime);
+
+	//14. 释放模板ID
+	static void ClearNccModel(HalconCpp::HTuple id);
+
+	//15. 查找模板
+	static void FindNccModel(HalconCpp::HObject &hObject, HalconCpp::HTuple idModel, double minScore, int numMatches, std::vector<ParaMatch> &vResult);
+
+	//16. 图像中值
+	static void ImageMedian(HalconCpp::HObject &hObject, double radius, HalconCpp::HObject &hTarget);
+
+	//17. 图像差值
+	static void ImageSub(HalconCpp::HObject &hObject1, HalconCpp::HObject &hObject2, double mul, int gray, HalconCpp::HObject &hTarget);
+
+	//18. 图像转换
+	static void AffineTransImage(HalconCpp::HObject &hImage, ParaAffine2D affine, HalconCpp::HObject &hTarget);
+
+	//19. 投影直方图
+	static void ProjectHistogram(HalconCpp::HObject &hImage, int pLeft, int pTop, int pRight, int pBottom, double *aryHor, double *aryVer);
+
+	//20. 图像的乘法
+	static void ImageMul(HalconCpp::HObject &hObject, double mul, HalconCpp::HObject &hTarget);
+
+	//21. 对象数量
+	static int ObjectNumber(HalconCpp::HObject &hObject);
+
+	//22. 获取图像大小
+	static void GetImageSize(HalconCpp::HObject &hObject, int &width, int &height);
+
+	//23. 读取图像
+	static void ReadImage(HalconCpp::HObject &hObject, std::string &fileName);
+
+	//24. 获取像素
+	static bool GetImagePixel(HalconCpp::HObject &hObject, Point2D pt, int &bResult, int &gResult, int &rResult);
+
+	//25. 图像区域分割
+	static void ImageThreshold(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, int minThreshold, int maxThreshold);
+
+	//26. uchar转换为图像
+	static void DataToObject(uchar *data, int width, int height, HalconCpp::HObject &hObject);
+
+	//27. 图像放大
+	static void ZoomImageFactor(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, double xRate, double yRate);
+
+	//28. 图像放大
+	static void ZoomImageSize(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, int width, int hegiht);
+
+	//29. 创建Shape模板
+	static HalconCpp::HTuple CreateShapeModel(HalconCpp::HObject &hObject, double angleStart, double angleEnd, double angleStep, int minContrast, int minCostTime);
+
+	//30. 释放Shape
+	static void ClearShapeModel(HalconCpp::HTuple id);
+
+	//31. 查找Shape模板
+	static void FindShapeModel(HalconCpp::HObject &hObject, HalconCpp::HTuple idModel, double minScore, int numMatches, std::vector<ParaMatch> &vResult);
+
+	//32. 清理所有NCC模板
+	static void ClearAllNccModel();
+
+	//33. 清理所有的Shape模板
+	static void ClearAllShapeModel();
+
+	//34. 获取区域
+	static void GetDomain(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget);
+
+	//35. Shape定位轮廓
+	static void GetShapeContour(HalconCpp::HObject &hContour, int id);
+
+	//36. 轮廓转化
+	static void AffineTransContour(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, ParaAffine2D affine);
+
+	//37. 图像灰度化
+	static void ImageToGray(HalconCpp::HObject &hObject, int iGray, HalconCpp::HObject &hTarget);
+
+	//38. 局部增强
+	static void ImageEmphasize(HalconCpp::HObject &hObject, int maskWidth, int maskHeight, double rate, HalconCpp::HObject &hTarget);
+
+	//39. 创建图像
+	static void GenImageConst(HalconCpp::HObject &hImage, int width, int height, int gray);
+
+	//40. 大律法
+	static int Otsu(int *aryData, int sz);
+
+	//41. 截取ROI区域的图像并纠正
+	static void GetAndAdjustRectImage(HalconCpp::HObject &hObject, HalconCpp::HObject &hRegion, int modeAngle, HalconCpp::HObject &hTarget);
+
+	//42. 截取ROI区域的图像并纠正
+	static void GetAndAdjustRectImage(HalconCpp::HObject &hObject, double cx, double cy, double angle, int width, int height, HalconCpp::HObject &hTarget);
+
+	//43. 创建图像
+	static void GenImage(const unsigned char* data, HalconCpp::HObject &hImage, int imgType, int width, int height);
+
+	//44. 创建椭圆区域
+	static void GenEllipse(HalconCpp::HObject &hRegion, double x, double y, double angle, double length1, double length2);
+
+	//45. 图像选择
+	static void ImageRotate(HalconCpp::HObject &hObject, int angle, HalconCpp::HObject &hTarget);
+
+	//46. 截图图像 
+	static void ImageDraw(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, int left, int top, int width, int height);
+
+	//47. 截图带角度图像
+	static void GetAngleImage(HalconCpp::HObject &hObject, HalconCpp::HObject &hTarget, Point2D center, double angle, int width, int height);
+
+public:
+	//1. 区域是否存在
+	static bool RegionExist(HalconCpp::HObject &hRegion);
+
+	//2. 区域合并
+	static void RegionUnion2(HalconCpp::HObject &hRegion1, HalconCpp::HObject &hRegion2, HalconCpp::HObject &hTarget);
+
+	//3. 区域差值
+	static void RegionDiffer(HalconCpp::HObject &hRegion1, HalconCpp::HObject &hRegion2, HalconCpp::HObject &hTarget);
+
+	//4. 区域交集
+	static void RegionIntersection(HalconCpp::HObject &hRegion1, HalconCpp::HObject &hRegion2, HalconCpp::HObject &hTarget);
+
+	//5. 区域连通
+	static void RegionConnect(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//6. 区域闭运算
+	static void RegionClosing(HalconCpp::HObject &hRegion, double radius, HalconCpp::HObject &hTarget);
+
+	//7. 区域开运算
+	static void RegionOpening(HalconCpp::HObject &hRegion, double radius, HalconCpp::HObject &hTarget);
+
+	//8. 区域腐蚀
+	static void RegionErosion(HalconCpp::HObject &hRegion, double radius, HalconCpp::HObject &hTarget);
+
+	//9. 区域膨胀
+	static void RegionDilation(HalconCpp::HObject &hRegion, double radius, HalconCpp::HObject &hTarget);
+
+	//10. 区域合并
+	static void RegionUnion(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//11. 区域转换
+	static void AffineTransRegion(HalconCpp::HObject &hRegion, ParaAffine2D affine, HalconCpp::HObject &hTarget);
+
+	//12. 判断点在区域里面
+	static bool JudgeInRegion(Point2D pt, HalconCpp::HObject &hRegion);
+
+	//13. 区域中心
+	static void AreaCenter(HalconCpp::HObject &hRegion, int &area, double &x, double &y);
+
+	//14. 面积赛选
+	static void SelectShape(HalconCpp::HObject &hRegion, std::string strMode, double minValue, double maxValue, HalconCpp::HObject &hTarget);
+
+	//15. 最大区域
+	static void MaxRegion(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//16. 最小外接圆
+	static void SmallestCircle(HalconCpp::HObject &hRegion, double &x, double &y, double &radius);
+
+	//17. 最小外接矩形
+	static void SmallestRectangle(HalconCpp::HObject &hRegion, double &x1, double &y1, double &x2, double &y2);
+
+	//18. 区域最小外界矩形 
+	static void SmallestRectangle2(HalconCpp::HObject &hRegion, double &x, double &y, double &angle, double &xa, double &xb);
+
+	//19. 创建矩形2
+	static void GenRectangle2(HalconCpp::HObject &hTarget, double x, double y, double angle, double xa, double xb);
+
+	//20. 创建圆
+	static void GenCircle(HalconCpp::HObject &hObject, double x, double y, double radius);
+
+	//21. 创建直线区域
+	static void GenRegionLine(HalconCpp::HObject &hRegion, double x1, double y1, double x2, double y2);
+
+	//22. 产生矩形
+	static void GenRectangle1(HalconCpp::HObject &hTarget, double x1, double y1, double x2, double y2);
+
+	//23.产生多边行区域
+	static void GenRegionPolygonFilled(HalconCpp::HObject &hTarget, Point2D *ptArray, int sz);
+
+	//24. 产生十字
+	static void GenCrossObject(HalconCpp::HObject &hObject, Point2D pt, double sz, double angle);
+
+	//25. 产生区域轮廓
+	static void GenContourRegion(HalconCpp::HObject &hRegion, std::string strMode, HalconCpp::HObject &hTarget);
+
+	//26. 选择对象
+	static void SelectObject(HalconCpp::HObject &hObject, HalconCpp::HObject &hSelected, int idx);
+
+	//27. 区域填充
+	static void FillUp(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget);
+
+	//28. 创建矩形1
+	static void GenRectangle1(HalconCpp::HObject &hTarget, std::vector<double> vX1, std::vector<double> vY1, std::vector<double> vX2, std::vector<double> vY2);
+
+	//29. 创建矩形2
+	static void GenRectangle2(HalconCpp::HObject &hTarget, std::vector<double> vX, std::vector<double> vY, std::vector<double> vAngle, std::vector<double> vLength1, std::vector<double> vLength2);
+
+	//30. 创建圆
+	static void GenCircle(HalconCpp::HObject &hTarget, std::vector<double> vX, std::vector<double> vY, std::vector<double> vRadius);
+
+	//31. 获取直方图区域
+	static void GenDispZft(HalconCpp::HObject &hImage, int dispWidth, int dispHeight, HalconCpp::HObject &hZftObject);
+
+	//32. 区域膨胀
+	static void RegionDilationRectangle(HalconCpp::HObject &hRegion, HalconCpp::HObject &hTarget, int width, int height);
+
+	//33. 产生区域
+	static void GenRegionPoints(HalconCpp::HObject &hRegion, std::vector<Point2I> vPoints);
+
+public:
+	//1. 显示模式
+	static void SetDraw(HalconCpp::HTuple id, std::string strMode);
+
+	//2. 显示位置
+	static void SetTposition(HalconCpp::HTuple id, int left, int top);
+
+	//3. 显示颜色
+	static void SetColor(HalconCpp::HTuple id, std::string strColor);
+
+	//4. 写文字
+	static void WriteString(HalconCpp::HTuple id, std::string str);
+
+	//5. 设置字体
+	static void SetFont(HalconCpp::HTuple id, int sz);
+
+	//6. 显示字符
+	static void DispMessage(HalconCpp::HTuple id, std::string str, int xPos, int yPos, std::string strColor, std::string strBox);
+
+	//7. 颜色转换
+	static std::string ToColor(int iColor);
+
+	//8. 设置颜色
+	static void SetRgb(HalconCpp::HTuple id, int red, int green, int blue);
+
+	//29. rgb转换为颜色
+	static std::string Rgb2Color(int r, int g, int b);
+
+public:
+	//1. 检测判断
+	static bool JudgeResult(double value, double fzMin, double fzMax);
+
+	//2. 排序
+	static void SortArray(double *data, int sz, int iType);
+
+	//4. 获取2个点的中点
+	static Point2D GetPointCenter(Point2D pt1, Point2D pt2);
+
+	//7. 格式转换
+	static Point2I PointToInt(Point2D pt);
+
+	//8. 格式转换
+	static Point2D PointToDouble(Point2I pt);
+
+	//9. 数据合并, 公式 = 10000 * int1 + int2, int1, int2, 不运输超过10000 
+	static int IntegerUnion(int int1, int int2);
+
+	//10. 数据分解
+	static void IntegerDivide(int intInput, int &int1, int &int2);
+
+	//11. 点坐标合并,用于查找
+	static int PointToInteger(Point2I pt);
+
+	//12. 整数转换为坐标
+	static Point2I IntegerToPoint(int intIntput);
+
+	//13. 字符串分割
+	static int SplitString(std::string strInput, std::string strSeparator, std::vector<std::string> &vOutString);
+
+	//14. 判断double数据是否无效
+	static bool IsNaN(double value);
+
+	//15 格式化字符串
+	static std::string FormatString(const char *lpcszFormat, ...);
+
+	//16. 字符分割
+	static int StringSplit(const std::string& strScr, const std::string& delim, std::vector<std::string>& strings);
+	static void StringTrim(std::string& s);
+
+	//17. Tuple是否为空
+	static bool TupleNil(HalconCpp::HTuple hvData);
+};
+
+#endif
+
diff --git a/Lib/ApiVisionSDK/include/IClsDisplay.h b/Lib/ApiVisionSDK/include/IClsDisplay.h
new file mode 100644
index 0000000..0d4b516
--- /dev/null
+++ b/Lib/ApiVisionSDK/include/IClsDisplay.h
@@ -0,0 +1,171 @@
+/**************************************************************************************************
+		Copyright 2020-2022 深圳市八零联合装备有限公司
+		All rights reserved.
+
+		Author: zhenbin,jiang
+		Date: 2021-03-23
+		Version: V1.0.0
+
+		Description:
+			本模块主要是显示基类,包括创建ROI,编辑ROI等
+
+***************************************************************************************************/
+#ifndef I_CLS_DISPLAY_H
+#define I_CLS_DISPLAY_H
+
+typedef enum DISP_TYPE
+{
+	DISP_OBJECT = 0,        //外部显示的特征, 如DispObj();
+	DISP_REGION = 1,        //ROI区域, 如DispRegion();
+	DISP_CROSS = 2,         //显示十字,如DispCross()
+	DISP_SELECT = 3         //显示旋转, 如DispSelect()
+}DISP_TYPE;
+
+typedef enum BOOUNION_MOUSE_EVENT
+{
+	NO_EVENT = -1,                //无事件
+	LEFT_MOUSE_BUTTON_DOWN = 0,   //左键按下
+	LEFT_MOUSE_BUTTON_UP = 1,     //左键按上
+	LEFT_MOUSE_BUTTON_DOUBLE = 2, //左键双击
+	RIGHT_MOUSE_BUTTON_DOWN = 3,  //右键按下
+	RIGHT_MOUSE_BUTTON_UP = 4,    //右键按上
+	WHEEL_MOUSE_BUTTON = 5,       //滚动事件
+	MOUSE_BUTTON_MOVE = 6,       //鼠标移动
+	DRAG_SCROLL_MOVE = 7         //拖动事件
+}BOOUNION_MOUSE_EVENT;
+
+typedef struct _InfRegion
+{
+	int tyShape;  //1是矩形1;2是矩形2;4是圆形;8是任意形状
+	std::vector<double> vInfPos;    //位置信息
+}InfRegion;
+
+//显示位置、比例、像素值
+typedef std::function<void(int msgEvent, int x, int y, double rate, int pixel)> ImageOperateCallback;
+class IClsDisplay
+{
+public:
+	virtual ~IClsDisplay() {};
+
+	//0. 创建窗体
+	virtual void OpenWindow(__int64 id, int width, int height) = 0;
+
+	//1. 自动窗体大小
+	virtual void AutoWindowSize(int width, int height) = 0;
+
+	//2. 设置类型
+	virtual void SetShapeType(int shape) = 0;
+
+	//3. 显示对象
+	virtual void DispObj(HalconCpp::HObject &hObject) = 0;
+
+	//4. 清理窗体
+	virtual void ClearWindow(void) = 0;
+
+	//5. 显示范围
+	virtual void SetPart(int x1, int y1, int x2, int y2) = 0;
+
+	//6. 设置字体
+	virtual void SetFont(int font) = 0;
+
+	//7. 显示字符
+	virtual void DispMessage(int x, int y, std::string str, std::string strColor, std::string strBox) = 0;
+
+	//8. 画图
+	virtual void DrawRegion(void) = 0;
+
+	//9. 编辑区域
+	virtual void EditRegion(void) = 0;
+
+	//10. 显示图像
+	virtual void DispImage(void) = 0;
+
+	//11. 显示ROI区域
+	virtual void DispRegion(void) = 0;
+
+	//12. 显示屏蔽区域
+	virtual void DispCross(void) = 0;
+
+	//13. 窗体是否存在
+	virtual bool WindowIsExist(void) = 0;
+
+	//14. 关闭窗体
+	virtual void CloseWindow(void) = 0;
+
+	//15. 加载显示图
+	virtual void GenImage(const unsigned char* data, int imgType, int width, int height) = 0;
+
+	//16. 获取图像
+	virtual HalconCpp::HObject& GetImage(void) = 0;
+
+	//17. 获取区域
+	virtual HalconCpp::HObject& GetRegion(void) = 0;
+
+	//18. 获取选择区域
+	virtual HalconCpp::HObject& GetSelect(void) = 0;
+
+	//19. 设置图像
+	virtual void SetImage(HalconCpp::HObject &hObject) = 0;
+
+	//20. 设置区域
+	virtual void SetRegion(HalconCpp::HObject &hRegion) = 0;
+
+	//21. 设置选择区域
+	virtual void SetSelect(HalconCpp::HObject &hRegion) = 0;
+
+	//22. 设置颜色
+	virtual void SetColor(std::string color, DISP_TYPE disp) = 0;
+
+	//23. 设置模式
+	virtual void SetDraw(std::string draw, DISP_TYPE disp) = 0;
+
+	//24. 显示选择
+	virtual void DispSelect(void) = 0;
+
+	//25. 设置当前的操作状态
+	virtual void SetOperFlag(OPER_FLAG flag) = 0;
+
+	//26 回调函数
+	virtual void SetOperatorCallback(ImageOperateCallback callback) = 0;
+
+	//27. 获取十字
+	virtual HalconCpp::HObject& GetCross(void) = 0;
+
+	//28. 设置十字
+	virtual void SetCross(HalconCpp::HObject &cross) = 0;
+
+	//29. 设置背景颜色
+	virtual void SetBackgroundColor(std::string strColor) = 0;
+
+	//30. 设置显示线的类型. <1为实线, 否则为虚线
+	virtual void SetLineStyle(int lineStyle, DISP_TYPE disp) = 0;
+
+	//31. 图像坐标转换为窗体的坐标
+	virtual Point2I PixelToClient(Point2I pos) = 0;
+
+	//32. 刷新不使能
+	virtual void UnableFlush(void) = 0;
+
+	//33. 刷新使能
+	virtual void AbleFlush(void) = 0;
+
+	//34. 当前的编辑状态
+	virtual OPER_FLAG GetOperMode(void) = 0;
+
+	//35. 窗体ID
+	virtual HalconCpp::HTuple GetDisplayID(void) = 0;
+
+	//36. 位置信息
+	virtual InfRegion GetInfRegion(void) = 0;
+
+	//37. 设置位置信息
+	virtual void SetInfRegion(InfRegion inf) = 0;
+
+	//38. 设置左上定点坐标
+	virtual void SetLtPoint(int xPos, int yPos) = 0;
+
+	//39. 获取左上点的坐标
+	virtual Point2I GetLtPoint(void) = 0;
+};
+
+#endif
diff --git a/Lib/ApiVisionSDK/include/VisionLib.h b/Lib/ApiVisionSDK/include/VisionLib.h
new file mode 100644
index 0000000..32173db
--- /dev/null
+++ b/Lib/ApiVisionSDK/include/VisionLib.h
@@ -0,0 +1,15 @@
+#ifndef VISION_LIB
+#define VISION_LIB
+
+#ifdef EXPORT_DLL_BASE_VISION
+#include "IClsDisplay.h"
+#define EXPORTED_VISION _declspec(dllexport)
+#else
+#define EXPORTED_VISION _declspec(dllimport)
+#endif
+
+extern "C" EXPORTED_VISION IClsDisplay* ClsDisplay_Create(void);
+extern "C" EXPORTED_VISION void ClsDisplay_Free(IClsDisplay *pClsDisplay);
+
+#endif
+
diff --git a/Lib/BaseDisplaySDK/include/BaseDisplayLib.h b/Lib/BaseDisplaySDK/include/BaseDisplayLib.h
new file mode 100644
index 0000000..646313d
--- /dev/null
+++ b/Lib/BaseDisplaySDK/include/BaseDisplayLib.h
@@ -0,0 +1,24 @@
+#ifndef BASE_DISPLAY_LIB
+#define BASE_DISPLAY_LIB
+
+#include "IClsShape.h"
+#include "IImageDisplay.h"
+
+#ifdef EXPORT_DLL_BASE_DISPLAY
+#define EXPORTED_BASE_DISPLAY _declspec(dllexport)
+#else
+#define EXPORTED_BASE_DISPLAY _declspec(dllimport)
+#endif
+
+//1. 获取当前的版本
+extern "C" EXPORTED_BASE_DISPLAY int Display_GetVersion(char* pszVersion, const int nBufferSize);
+//2. 创建ClsDisplay模块
+extern "C" EXPORTED_BASE_DISPLAY IImageDisplay* Display_CreateDisplay(void);
+//3. 释放模块
+extern "C" EXPORTED_BASE_DISPLAY void Display_FreeDisplay(IImageDisplay *pClsDisplay);
+//4. 创建ClsShape模块
+extern "C" EXPORTED_BASE_DISPLAY IClsShape* Display_CreateClsShape(void);
+//5. 释放模块
+extern "C" EXPORTED_BASE_DISPLAY void Display_FreeShape(IClsShape *pShape);
+
+#endif
diff --git a/Lib/BaseDisplaySDK/include/BaseVision.h b/Lib/BaseDisplaySDK/include/BaseVision.h
new file mode 100644
index 0000000..a530f44
--- /dev/null
+++ b/Lib/BaseDisplaySDK/include/BaseVision.h
@@ -0,0 +1,90 @@
+#ifndef BASE_VISION_H
+#define BASE_VISION_H
+
+#ifdef EXPORT_DLL_BASE_DISPLAY
+#define EXPORTED_BASE_DISPLAY _declspec(dllexport)
+#else
+#define EXPORTED_BASE_DISPLAY _declspec(dllimport)
+#endif
+
+#include "typesdef.h"
+
+
+class EXPORTED_BASE_DISPLAY BaseVision
+{
+public:
+	BaseVision();
+	~BaseVision();
+
+public:
+	//1. 获取当前的软件版本
+	static std::string GetVersion(void);
+
+	//2. 获取更新内容
+	static std::string GetUpdate(void);
+
+	//3. 获取当前的目录
+	static std::string GetAppPathA();
+
+public:
+	//1. 画矩形
+	static bool drawRect1(CDC* pDC, RECT1 rect, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//2. 画圆形
+	static bool drawCircle(CDC* pDC, Circle2D cirle, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//3. 画直线
+	static bool drawLine(CDC* pDC, Line2D line, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//4. 画十字价
+	static bool drawCross(CDC* pDC, CROSS cross, COLORREF color, int lineWidth);
+
+	//5. 画布矩形2
+	static bool drawRect2(CDC* pDC, RECT2 rect, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//6. 旋转变换公式
+	static Point2D rotatePoint(Point2D pt, Point2D ptCenter, double angle);
+
+	//7. 画任意区域
+	static bool drawRegion(CDC* pDC, Region2D region, bool isDraw, COLORREF color, COLORREF bgColor);
+
+	//8. 初始化图像
+	static bool createImage(CImage &image, int width, int height, COLORREF color);
+
+	//9. 拷贝图像
+	static bool copyImage(const CImage *pSrcImage, CImage &destImage);
+
+	//10. 坐标转换
+	static Point2I toPoint2I(Point2D pt);
+
+	//11. 坐标转换
+	static Point2D toPoint2D(Point2I pt);
+
+	//12. 2点距离
+	static double distancePP(double x1, double y1, double x2, double y2);
+
+	//13. 2点的角度
+	static double anglePP(double x1, double y1, double x2, double y2);
+
+	//14. 判断点是否在直线边界上
+	static bool judgeLinePoint(Point2D pt, Line2D line, double fzDist);
+
+	//15. 判断点与点是否相邻
+	static bool judgePointNear(Point2D pt0, Point2D pt1, double fzDist);
+
+	//16. 点到直线的距离
+	static double distancePL(double px, double py, double lineX1, double lineY1, double lineX2, double lineY2);
+
+	//17. 图像二值化
+	static void imageThreshold(CImage *image, int minThreshold, int maxThreshold);
+
+	//18. 宝贝数据
+	static bool bmpToImage(CBitmap *pBitmap, CImage &image);
+
+	//19. 判断文件是否存在
+	static bool fileIsExist(std::string fileName);
+
+};
+
+#endif
+
diff --git a/Lib/BaseDisplaySDK/include/IClsShape.h b/Lib/BaseDisplaySDK/include/IClsShape.h
new file mode 100644
index 0000000..a63b4ee
--- /dev/null
+++ b/Lib/BaseDisplaySDK/include/IClsShape.h
@@ -0,0 +1,40 @@
+#ifndef ICLS_SHAPE_H
+#define ICLS_SHAPE_H
+
+#include "typesdef.h"
+
+class IClsShape
+{
+public:
+	virtual ~IClsShape() {};
+
+public:
+	//1. 设置shape
+	virtual int setShape(int shape) = 0;
+
+	//2. 设置参数
+	virtual bool setValue(const RECT1 value) = 0;
+	virtual bool setValue(const RECT2 value) = 0;
+	virtual bool setValue(const Circle2D value) = 0;
+	virtual bool setValue(const Region2D value) = 0;
+	virtual bool setValue(const Line2D value) = 0;
+	virtual bool setValue(const CROSS value) = 0;
+
+public:
+	//1. 获取形态
+	virtual int getShape(void) = 0;
+
+	//2. 获取数据
+	virtual bool getValue(RECT1 &value) = 0;
+	virtual bool getValue(RECT2 &value) = 0;
+	virtual bool getValue(Circle2D &value) = 0;
+	virtual bool getValue(Region2D &value) = 0;
+	virtual bool getValue(Line2D &value) = 0;
+	virtual bool getValue(CROSS &value) = 0;
+
+public:
+	//1. 拷贝数据
+	virtual bool copy(IClsShape *pShape) = 0;
+
+};
+#endif
diff --git a/Lib/BaseDisplaySDK/include/IImageDisplay.h b/Lib/BaseDisplaySDK/include/IImageDisplay.h
new file mode 100644
index 0000000..1c1bff6
--- /dev/null
+++ b/Lib/BaseDisplaySDK/include/IImageDisplay.h
@@ -0,0 +1,91 @@
+#ifndef IIMAGE_DISPLAY_H
+#define IIMAGE_DISPLAY_H
+
+#include "IClsShape.h"
+
+class IImageDisplay
+{
+public:
+	virtual ~IImageDisplay() {};
+
+public:
+	//1. 设置模式
+	virtual int setOperFlag(OPER_FLAG flag) = 0;
+
+	//2. 设置Shape类型
+	virtual int setShape(int shape) = 0;
+
+	//3. 设置回调事件
+	virtual int setMouseCallback(ImageMouseCallback mouseEvent) = 0;
+
+	//4. 设置区域
+	virtual int setRegion(IClsShape *pShape) = 0;
+
+	//5. 设置图像
+	virtual int setImage(CImage &image) = 0;
+
+	//6. 设置颜色
+	virtual int setDrawColor(COLORREF color) = 0;
+
+	//7. 设置背景颜色
+	virtual int setEditColor(COLORREF color) = 0;
+
+	//8. 设置十字线
+	virtual int ShowCross(bool valid) = 0;
+
+	//9. 设置十字的颜色
+	virtual int setCrossColor(COLORREF color) = 0;
+
+public:
+	//1. 获取shape类型
+	virtual int getShape(void) = 0;
+
+	//2. 获取region
+	virtual IClsShape* getRegion(void) = 0;
+
+	//3. 获取图像
+	virtual CImage& getImage(void) = 0;
+
+
+public:
+	//1. 显示图像
+	virtual void dispImage(void) = 0;
+
+	//2. 显示区域
+	virtual void dispRegion(void) = 0;
+
+	//3. 创建窗体
+	virtual void openWindow(__int64 id) = 0;
+
+	//4. 设置背景颜色
+	virtual void setBgColor(COLORREF color) = 0;
+
+	//5. 自动设置大小
+	virtual void autoSize(int imgWidth, int imgHeight) = 0;
+
+	//6. 显示图像
+	virtual void dispObj(CImage &image) = 0;
+
+	//7. 清理显示对象
+	virtual void clearObj(void) = 0;
+
+	//8. 关闭窗体
+	virtual void closeWindow(void) = 0;
+
+	//9. 获取当前的句柄
+	virtual CWnd* getWnd(void) = 0;
+
+	//10. 窗体坐标转换
+	virtual Point2D toImagePoint(Point2D point) = 0;
+
+	//11. 转换窗体坐标
+	virtual Point2D toWindowPoint(Point2D point) = 0;
+
+	//12. 显示画面
+	virtual void dispFrame(IClsShape *pShape) = 0;
+
+	//13. 显示十字架
+	virtual void dispCross(void) = 0;
+};
+
+#endif
diff --git a/Lib/BaseDisplaySDK/include/typesdef.h b/Lib/BaseDisplaySDK/include/typesdef.h
new file mode 100644
index 0000000..7006e35
--- /dev/null
+++ b/Lib/BaseDisplaySDK/include/typesdef.h
@@ -0,0 +1,150 @@
+#ifndef TYPES_DEF_H
+#define TYPES_DEF_H
+
+#include <Windows.h>
+#include <iostream>
+#include <stdlib.h>
+#include <assert.h>
+#include <string>
+#include <map>
+#include <vector>
+#include <math.h>
+#include <atlimage.h>
+#include <io.h>
+#include <functional>
+
+//SDK版本号
+#define   VERSION_NO     "1.0.0.0"  
+typedef unsigned char uchar;
+typedef BYTE uchar;
+
+typedef std::function<void(int msgEvent, int x, int y, double rate)> ImageMouseCallback;
+
+//角度转换
+#define _RadToDeg(x) (double)(x) * 57.295779513082
+#define _DegToRad(x) (double)(x) / 57.295779513082
+#define  FUNC_OK                  1    //函数运行OK
+#define  FUNC_NG                  0    //函数运行NG
+
+typedef enum OPER_FLAG
+{
+	DEFAULT_OPER_FLAG = 0,          //没有任何操作
+	DRAW_OPER_FLAG,                 //画图
+	EDIT_OPER_FLAG,                 //编辑
+	SELECT_OPER_FLAG,               //选择
+	SCROLL_OPER_FLAG                  //拖动模式
+}OPER_FLAG;
+
+//ROI区域
+#define ROI_ALL_TYPE        0                  /* 所有格式 */
+#define ROI_RECT1           1                  /* 矩形区域1 */
+#define ROI_RECT2           2                  /* 矩形区域2 */
+#define ROI_CIRCLE          4                  /* 圆形区域 */
+#define ROI_REGION          8                  /* 任意区域 */
+#define ROI_LINE            16                 /* 直线区域 */
+#define ROI_CROSS           32                 /* 十字架区域 */
+#define UNKNOW_SHAPE        64                 /* 没有任何区域 */
+
+//点1
+typedef struct _Point2I
+{
+	int x;
+	int y;
+}Point2I;
+
+//点2
+typedef struct _Point2D
+{
+	double x;
+	double y;
+}Point2D;
+
+//矩形1的坐标
+typedef struct _RECT1
+{
+	Point2I pt0;
+	Point2I pt1;
+}RECT1;
+
+//矩形2的坐标
+typedef struct _RECT2
+{
+	Point2D pt;
+	double angle;
+	double width;
+	double height;
+}RECT2;
+
+//圆形坐标
+typedef struct _Circle2D
+{
+	Point2D pt;
+	double radius;
+}Circle2D;
+
+//区域数据
+typedef struct _Region2D
+{
+	std::vector<Point2D> vPtData;
+}Region2D;
+
+//直线
+typedef struct _Line2D
+{
+	Point2D pt0;
+	Point2D pt1;
+}Line2D;
+
+typedef struct _CROSS
+{
+	Point2D pt;
+	double size;
+}CROSS;
+
+//标定数据结构
+typedef struct _ParaAffine2D
+{
+	double kx0;    /* 仿射变换关系 */
+	double kx1;    /* 仿射变换关系 */
+	double kx2;    /* 仿射变换关系 */
+	double ky0;    /* 仿射变换关系 */
+	double ky1;    /* 仿射变换关系 */
+	double ky2;    /* 仿射变换关系 */
+}ParaAffine2D;
+
+//标定参数
+typedef struct _ParaCalibrate
+{
+	ParaAffine2D affine;   /* 2D转换关系 jiang, 2020-08-29 */
+	double xMmvsp;         /* X方向的图像当量 */
+	double yMmvsp;         /* Y方向的图像当量 */
+	double angle;          /* 2个坐标系的夹角 */
+	double theta;          /* 2个坐标系的倾斜角 */
+}ParaCalibrate;
+
+//模板参数
+typedef struct _ParaMatch
+{
+	Point2D pt;          /* 定位的中点 */
+	double angle;        /* 定位的角度 */
+	double score;        /* 定位的分数 */
+	int mirror;          //是否镜像,1表示没有镜像, 0表示旋转180度,2表示水平镜像,3表示垂直镜像
+}ParaMatch;
+
+//相机标定参数
+typedef struct _CalibrateResult
+{
+	double kx0;       /*X方向系数*/
+	double kx1;       /*X方向系数*/
+	double kx2;       /*X方向系数*/
+	double kx3;       /*X方向系数*/
+	double kx4;       /*X方向系数*/
+	double ky0;       /*Y方向系数*/
+	double ky1;       /*Y方向系数*/
+	double ky2;       /*Y方向系数*/
+	double ky3;       /*Y方向系数*/
+	double ky4;       /*Y方向系数*/
+}CalibrateResult;
+
+#endif
+
diff --git a/Lib/BlGrabber/include/FrameBufferController.h b/Lib/BlGrabber/include/FrameBufferController.h
new file mode 100644
index 0000000..46ee4fe
--- /dev/null
+++ b/Lib/BlGrabber/include/FrameBufferController.h
@@ -0,0 +1,125 @@
+#pragma once
+
+#include <deque>
+#include "../../ENRIT/Define/Global_Define.h"
+
+class AFX_EXT_CLASS CMultiBuffer	// 促吝 滚欺 汲沥, m_nBuff 俺狼 滚欺甫 积己 棺 包府(咯矾 俺狼 胶牡 滚欺 历厘)
+{	
+	BYTE*	m_pTotalBuff;	// m_BuffCnt 俺荐 父怒狼 滚欺甫 茄波锅俊 且寸.
+	int		m_BuffCnt;		// 滚欺狼 俺荐
+	SIZE_T	m_BuffSize;		// 俺喊 滚欺狼 农扁 (frameWidth * frameHeight * frameCnt
+
+							// 滚欺绰 n俺狼 Frame 栏肺 积己 : Width * Height * Cnt
+	int		m_FrameWidth, m_FrameHeight;
+	int		m_FrameCnt;
+public:
+	int		GetFrameWidth() { return m_FrameWidth; }
+	int		GetFrameHeight() { return m_FrameHeight; }
+	int		GetFrameCount() { return m_FrameCnt; }
+	int		GetBuffCount() { return m_BuffCnt; }
+	SIZE_T	GetFrameSize() { return GetFrameWidth()*GetFrameHeight(); }
+
+public:
+	CMultiBuffer() { m_BuffCnt = 0; m_pTotalBuff = NULL; m_FrameWidth = m_FrameHeight = m_FrameCnt = 0; }
+	~CMultiBuffer()
+	{
+		if (m_pTotalBuff)
+		{
+			VirtualFree(m_pTotalBuff, 0, MEM_RELEASE);
+			m_pTotalBuff = NULL;
+		}
+	}
+	BYTE*	GetMultiBuffData(int id) { return m_pTotalBuff + m_BuffSize*id; }
+	int		CreateMultiBuff(int buffCnt, int frameWidth, int frameHeight, int frameCnt)
+	{
+		m_BuffCnt = buffCnt;
+		m_FrameWidth = frameWidth;
+		m_FrameHeight = frameHeight;
+		m_FrameCnt = frameCnt;
+		m_BuffSize = (SIZE_T)frameWidth*frameHeight*frameCnt;
+
+		SIZE_T frameSize = frameWidth* frameHeight;
+		SIZE_T TotalBufferSize = frameSize*frameCnt*buffCnt;
+
+		m_pTotalBuff = (BYTE*)VirtualAlloc(NULL, TotalBufferSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+		if (m_pTotalBuff == NULL)
+		{
+			return FALSE;
+		}
+
+		ZeroMemory(m_pTotalBuff, sizeof(BYTE)*TotalBufferSize);
+
+		return TRUE;
+	}
+
+	void	ClearBuffer()
+	{
+		SIZE_T frameSize = m_FrameWidth * m_FrameHeight;
+		SIZE_T TotalBufferSize = frameSize * m_FrameCnt*m_BuffCnt;
+
+		ZeroMemory(m_pTotalBuff, sizeof(BYTE)*TotalBufferSize);
+	}
+};
+
+class AFX_EXT_CLASS CFrameBufferController
+{
+public:
+	CFrameBufferController(void);
+	virtual ~CFrameBufferController(void);
+
+public:
+	void			ClearBuffer();
+	BOOL			CreateBuffer(int iCamera, int nFrameWidth, int nFrameHeight, int nFrameCnt, int nBufferCnt = 1);
+	CMultiBuffer*	GetMultiBuffer() { return &m_MultiBuffer; }
+	BYTE			*GetMultiBuffData(int id) { return m_MultiBuffer.GetMultiBuffData(id); }
+
+	void			SetMutualEx(BOOL bEnter)
+	{
+		if (bEnter == TRUE)
+			EnterCriticalSection(&m_csProcBuffer);
+		else
+			LeaveCriticalSection(&m_csProcBuffer);
+	}
+
+	int				GetCameraIdx() { return m_nCameraIdx; }
+	LPBYTE			GetFrameBuferHeader(int iScan, int iFrame);
+	BOOL			CheckProcFrame(int iFrame);
+	BOOL			SetFrameBuffer(int iScan, int iFrame, LPBYTE lpBuffer);
+	LPBYTE			GetFrameHeaderLine(int iScan, int nLine = 0);
+	LPBYTE			GetFrameHeader_Line_FromStartLine(int iScan, int iFrame, int nStartLine = 0);
+	int				GetFrameWidth() { return GetMultiBuffer()->GetFrameWidth(); }
+	int				GetFrameHeight() { return GetMultiBuffer()->GetFrameHeight(); }
+	int				GetFrameCount() { return GetMultiBuffer()->GetFrameCount(); }
+	int				GetFrameSize() { return (int)GetMultiBuffer()->GetFrameSize(); }
+
+protected:
+	CRITICAL_SECTION	m_csProcBuffer;	// Critical Section
+	CMultiBuffer	m_MultiBuffer;
+	int				m_nCameraIdx;
+};
+
+struct stFrameIndex
+{
+	stFrameIndex()
+	{
+		nScanIdx = -1;
+		nFrameIdx = -1;
+	}
+	stFrameIndex(const stFrameIndex &rhs)
+	{
+		this->nScanIdx = rhs.nScanIdx;
+		this->nFrameIdx = rhs.nFrameIdx;
+	}
+	stFrameIndex(int nScan, int nGrab)
+	{
+		nScanIdx = nScan;
+		nFrameIdx = nGrab;
+	}
+
+	int nScanIdx;
+	int nFrameIdx;
+};
+
+typedef deque<stFrameIndex> dqGrabIdx;
+typedef deque<stFrameIndex>::iterator dqGrabIdxIt;
+
diff --git a/Lib/BlGrabber/include/GrabberControl.h b/Lib/BlGrabber/include/GrabberControl.h
new file mode 100644
index 0000000..f4d8260
--- /dev/null
+++ b/Lib/BlGrabber/include/GrabberControl.h
@@ -0,0 +1,79 @@
+#pragma once
+
+#include "FrameBufferController.h"
+#define INITX64_SUCCESS				0
+#define INITX64_FAIL_GETSERVER		11
+#define INITX64_FAIL_CREATEACQ		12
+#define INITX64_FAIL_TDIDIRECTION	13
+#define INITX64_FAIL_CAMNVIC		14
+#define INITX64_FAIL_CREATEBUFFER	15
+#define INITX64_FAIL_VIRTUALBUFFER	16
+#define INITX64_FAIL_CREATEXFER		17
+#define INITX64_FAIL_INVALID		18
+
+typedef enum { eMIL_GRAB_OFF = 0, eMIL_GRAB_ON, eMIL_SNAP_ON } _eGrabStatus_;
+
+#define MAX_DFC_PATH 1024
+typedef struct _tag_struct_Grabber_Intialize_Parameter_
+{
+	HWND hWnd;
+	BOOL bDemo;
+
+	int	 nScanCount;
+	int  nGrabBufCount;
+	int	 nGrabBufSize; // rcut 增加
+	int  nFrameWidth;
+	int  nFrameHeight;
+	int	 nConnectPort;
+	int	 nImgFlipX;
+	int	 nCameraIdx;
+	int	 nCameraScan;
+	int	 nBoardIdx;
+	int  nBoardCh;
+	char cDCFPath[MAX_DFC_PATH];
+	char cVICPath[MAX_DFC_PATH];
+	int	 nExposure;
+	int	 nExposureDelay;
+
+	_tag_struct_Grabber_Intialize_Parameter_()
+	{
+		ZeroMemory(this, sizeof(this));
+	}
+} _GRABBER_INIT_PARAM_;
+
+class AFX_EXT_CLASS CGrabberControl
+{
+public:
+	CGrabberControl(void);
+	virtual ~CGrabberControl(void);
+
+public:
+	virtual BOOL	Initialize(void *pParam, int *pErrorCode, int iBoard = 0) = 0;	// Grabber 檬扁拳
+	virtual BOOL	InitializeBuffer(void *pParam) = 0;
+	//////////////////////////////////////////////////////////////////////////
+	// Deinit
+	virtual BOOL	Deinitialize() = 0;
+
+	virtual BOOL	GrabScanStart(int iScan, BOOL bFreeRun, int nPeriod, int nExposure = 10, BOOL bAuto = TRUE) = 0;
+	virtual BOOL	GrabLiveStart(int nExposure = 15) = 0;
+	virtual BOOL	GrabScanStop() = 0;
+
+	virtual BOOL	IsGrabbing() = 0;
+	virtual int		IsAcqFrame(int nFrameNo, int nThreadIdx = -1) = 0;
+
+	virtual LPBYTE	GetFrameHeader(int iScan, int nFrameNo, BOOL* bSuccess = NULL) = 0;
+	virtual LPBYTE	GetFrameHeaderLine(int iScan, int nLine, BOOL* bSuccess = NULL) = 0;
+	virtual BOOL	GetSmallImage(int iScan, LPBYTE lpIn, int nXStart, int nYStart, int nXSize, int nYSize, BOOL bMustMapping = TRUE) = 0;
+
+	virtual int		GetStartFrameIdx() { return 0; }
+	virtual int		GetEndFrameIdx() { return 0; }
+
+	virtual void	SetSimulFrame(int nFrame) = 0;
+	virtual int		GetGrabFrameCount() = 0;
+	virtual void	ClearGrabIdx() = 0;
+	virtual stFrameIndex	GetGrabFrame() = 0;
+	virtual stFrameIndex	GetGrabFrameNoRemove() = 0;
+	virtual CFrameBufferController	*GetFrameBuffer() = 0;
+	virtual BOOL	SetTriggerMode(BOOL bExTrigger) = 0;
+};
+
diff --git a/Lib/BlVisionPro/include/BlSideData.h b/Lib/BlVisionPro/include/BlSideData.h
new file mode 100644
index 0000000..d884de5
--- /dev/null
+++ b/Lib/BlVisionPro/include/BlSideData.h
@@ -0,0 +1,91 @@
+#ifndef BL_SIDE_DATA
+#define BL_SIDE_DATA
+
+#ifdef EXPORT_BLVISION_DLL
+#include "../Lib/BaseDisplaySDK/include/typesdef.h"
+#define EXPORTED_BLVISION _declspec(dllexport)
+#else
+#define EXPORTED_BLVISION _declspec(dllimport)
+#endif
+
+
+typedef struct _SideLineInf 
+{
+	int nSideLine;
+	int nThres;
+	int left;
+	int top;
+	int width;
+	int height;
+}SideLineInf;
+
+//检测结果
+typedef struct _DispVisionResult {
+	int eDir;     //面参数
+	int nType;     //0,Point;  1;表示Rect;   2,表示圆; 3, 直线; 4,文本
+	int eVision;  //视觉类型
+	int rectX1;  //矩形参数
+	int rectY1;  //矩形参数
+	int rectX2;  //矩形参数
+	int rectY2;  //矩形参数
+	int pointX;  //点参数
+	int pointY;  //点参数
+	int circleX;  //圆参数
+	int circleY;  //圆参数
+	int circleRadius;  //圆参数 
+	CString strName;   //名称
+	int showROI;       //0,表示NG; 1,表示ROI
+}DispVisionResult;
+
+
+class EXPORTED_BLVISION CBlSideData
+{
+public:
+	CBlSideData();
+	~CBlSideData();
+
+public:
+	//1. 重置
+	void Reset(void);
+
+	//2. 获取位置
+	Point2I getPose(int nType);
+
+public:
+	//1. 分辨率
+	double	m_dPixelSizeX;   //X方向的分辨率         
+	double	m_dPixelSizeY;   //Y方向的分辨率
+
+	//2. 检测结束
+	BOOL m_bInspection_Complete;   //是否检测结速
+
+	//3.Top Mark Info
+	BOOL m_bTopMark_Find;       //是否查找TopMark
+	Point2I m_mTopMark;         //TopMark的位置
+	Point2I m_mTopBzMark;		//TopBzMark的位置
+
+	//4. Bottom Mark Info
+	BOOL m_bBotMark_Find;       //是否查找BotMark
+	Point2I m_mBotMark;         //BotMark的位置
+	Point2I m_mBotBzMark;		//BotBzMark的位置
+
+	//5. 查找Top Point
+	BOOL m_bTopPoint_Find;
+	Point2I m_mTopPoint;       //TopPoint的位置
+	Point2I m_mTopBzPoint;     //TopBzPoint的位置
+
+	//6. 查找Bot Point
+	BOOL m_bBotPoint_Find;
+	Point2I m_mBotPoint;     //BotPoint的位置
+    Point2I m_mBotBzPoint;   //BotBzPoint的位置
+
+	//7. Edge
+	int m_nStartLine;
+	int m_nEndLine;
+
+	//8. 检测结果
+	std::map<int, SideLineInf> m_mapSideLineInf;
+	std::vector<DispVisionResult> m_vDispVisionResult;
+};
+
+#endif
diff --git a/Lib/BlVisionPro/include/BlVisionLib.h b/Lib/BlVisionPro/include/BlVisionLib.h
new file mode 100644
index 0000000..bd8ee6c
--- /dev/null
+++ b/Lib/BlVisionPro/include/BlVisionLib.h
@@ -0,0 +1,19 @@
+#ifndef BL_VISION_H
+#define BL_VISION_H
+
+#include "IVisionRecipe.h"
+#include "ISoftVisionApp.h"
+
+#ifdef EXPORT_BLVISION_DLL
+#define EXPORTED_BLVISION _declspec(dllexport)
+#else
+#define EXPORTED_BLVISION _declspec(dllimport)
+#endif
+
+extern "C" EXPORTED_BLVISION int BlVision_GetVersion(char *pszVersion, int nBufferSize);
+extern "C" EXPORTED_BLVISION IVisionRecipe* BlVision_GetVisionRecipe(void);
+extern "C" EXPORTED_BLVISION ISoftVisionApp* BlVision_GetSoftVisionApp(void);
+
+
+
+#endif
diff --git a/Lib/BlVisionPro/include/ISoftVisionApp.h b/Lib/BlVisionPro/include/ISoftVisionApp.h
new file mode 100644
index 0000000..f4c5d84
--- /dev/null
+++ b/Lib/BlVisionPro/include/ISoftVisionApp.h
@@ -0,0 +1,110 @@
+#ifndef ISOFT_VISION_APP_H
+#define ISOFT_VISION_APP_H
+
+#include <functional>
+#include <iostream>
+
+enum DefectNgType {
+	DefectNg_OK = 0,    //OK
+	DefectNg_Chip,      //Chip
+	DefectNg_Broken,    //破损
+	DefectNg_Grind,     //研磨
+	DefectNg_Dist_Cut,  //切割精度
+	DefectNg_Corner_Dist,    //角精度
+	DefectNg_Unknown          //指错误
+};
+
+#define NG_INF_TOTAL          1000
+typedef struct _NgInfo
+{
+	int eDir;                //检测面
+	int id;                  //检测ID
+	CString strName;        //名称
+	int xPosPxl;            //X位置
+	int yPosPxl;            //Y位置
+	double result;          //结果   Measure
+	double xResult;          //结果  Chip
+	double yResult;         //结果   Chip
+	double minValue;        //下限
+	double maxValue;        //限制
+	int ngType;             //缺陷类型
+	bool isRes;             //检测结果
+	int x1;                 //缺陷的最小矩形
+	int y1;                 //缺陷的最小矩形
+	int x2;                 //缺陷的最小矩形
+	int y2;                 //缺陷的最小矩形
+	int eVision;            //视觉算法
+}NgInfo;
+
+
+//typedef std::function<void(int msgEvent, int x, int y, double rate, int pixel)> ImageVisionEvent;
+//typedef std::function<void(int code, int eDir)> ImageVisionEvent;
+
+class IVisionEvent
+{
+public:
+	//1. 接收到数据事件
+	using MsgReceivedEvent = void(*)(int code, int eDir);
+
+	//2. 日志信息
+	using MsgLogEvent = void(*)(int level, std::string strText);
+
+
+public:
+	IVisionEvent(MsgReceivedEvent msgRcvCb = nullptr, MsgLogEvent msgLogEvent = nullptr) {
+		/* code */
+		m_msgRcvCb = msgRcvCb;
+		m_msgLogCb = msgLogEvent;
+	};
+
+	void clear() {
+		/* code */
+		m_msgRcvCb = NULL;
+		m_msgLogCb = NULL;
+	}
+public:
+	MsgReceivedEvent m_msgRcvCb = NULL;
+	MsgLogEvent m_msgLogCb = NULL;
+};
+
+class ISoftVisionApp
+{
+public:
+	virtual ~ISoftVisionApp() {};
+
+public:
+	//1. 打开视觉窗体
+	virtual int OpenVisionWindow(void) = 0;
+	virtual CDialogEx* CreateVisionWindow(void) = 0;
+	virtual int ReleaseWindow(CDialogEx *pDlg) = 0;
+	virtual void ChangeDimension(CDialogEx *pDlg, int nDir) = 0;
+	virtual void SetVisionOpen(BOOL isOpen) = 0;
+
+	//2. 设置屏蔽
+	virtual void OpenKeySetWindow(void) = 0;
+
+	//3. 坐标转换
+	virtual Point2I getPose(int eDir, int xPoxPxl, int yPosPxl) = 0;
+
+	//4. 执行视觉处理
+	virtual int Execute(int eDir, NgInfo *ngArray) = 0;
+
+	//5. 设置回调时间
+	virtual void setImageEventSignal(IVisionEvent *pEvent) = 0;
+
+	//6. 坐标转换,统一坐标系统
+	virtual bool transformToStandard(int eDir, Point2I point, Point2I &result,  Point2I &topResult, Point2I &botResult) = 0;
+
+	//7. 检测Cut线
+	virtual bool findCutLine(int eDir, int toTopY, int toLineDist, int nEndThres, Point2I &result) = 0;
+	virtual double DistancePL(Point2D pose, Line2D line) = 0;
+
+	//8. 检测Norch缺陷	
+	virtual int findNorchDefect(int eDir, std::vector<Point2D> vPoints, CRect roiRect, int nThres, int nOffset, int nBinThres,
+		int szType, int xFzSize, int yFzSize, CRect* aryResult) = 0;
+
+	//9. 设置平台,0是平台1, 1是平台2
+    virtual void setStage(int nStage) = 0;
+};
+
+#endif
diff --git a/Lib/BlVisionPro/include/IVisionRecipe.h b/Lib/BlVisionPro/include/IVisionRecipe.h
new file mode 100644
index 0000000..3824565
--- /dev/null
+++ b/Lib/BlVisionPro/include/IVisionRecipe.h
@@ -0,0 +1,67 @@
+#ifndef IVISION_RECIPE_H
+#define IVISION_RECIPE_H
+
+#define EI_VISION_RECIPE    0
+#define RCUT_VISION_RECIPE  1
+#define NI_VISION_RECIPE    2
+
+#include "BlSideData.h"
+
+//配方数据管理
+class IVisionRecipe
+{
+public:
+	virtual ~IVisionRecipe() {};
+
+public:
+	//1. 设置配方路径
+	virtual int setWorkDir(const char *pszPath) = 0;
+
+	//2. 保存
+	virtual int save(void) = 0;
+
+	//3. 打开
+	virtual int open(void) = 0;
+
+	//4. 获取采集卡
+	virtual CGrabberControl* getGrabberControl(int iCam) = 0;
+
+	//5. 设置采集开
+	virtual int setGrabberControl(CGrabberControl *pGrabberControl, int iCam) = 0;
+
+	//6. 相机相机信息
+	virtual int setCameraSetting(DimensionDir eDir, int iCam, int iScan) = 0;
+
+	//7. 初始化
+	virtual int init(void) = 0;
+
+	//8. 获取SideData
+	virtual CBlSideData* getSideData(DimensionDir eDir) = 0;
+
+	//9. 设置配方类型
+	virtual int setRecipeType(int nType) = 0;
+
+	//10. 获取配方类型
+	virtual int getRecipeType(void) = 0;
+
+	//11. 获取信息
+	virtual bool getVisionUse(void) = 0;
+
+	//12. 设置区域
+	virtual void setFrame(int x1, int y1, int x2, int y2) = 0;
+
+	//13. 设置配方名称
+	virtual int setVisionName(const char* pszPath) = 0;
+	virtual int setProductNo(const char* pszNo) = 0;
+
+	//14. 获取配方名称
+	virtual std::string getVisionName(void) = 0;
+
+	//15. 设置屏幕尺寸
+	virtual void setGlassSize(int x, int y) = 0;
+
+	//16. 窗体是否打开
+	virtual BOOL getVisionSetOpen(void) = 0;
+};
+
+#endif
diff --git a/Lib/CHImageBuffer/include/ImageBuffer.h b/Lib/CHImageBuffer/include/ImageBuffer.h
new file mode 100644
index 0000000..50e5ff3
--- /dev/null
+++ b/Lib/CHImageBuffer/include/ImageBuffer.h
@@ -0,0 +1,101 @@
+#pragma once
+
+#include "cxcore.h"
+#include "cv.h"
+#include "highgui.h"
+
+enum ImageBandType	{ ImageBand_Red=0, ImageBand_Green, ImageBand_Blue, ImageBand_Gray, ImageBand_Color, ImageBand_Count };
+
+class AFX_EXT_CLASS CImageBuffer
+{
+public:
+	CImageBuffer(void);
+	CImageBuffer(int nWidth, int nHeight, int nDepth=8, int nChannels=1);
+	virtual ~CImageBuffer(void);
+
+public: // virtual functions
+	virtual BOOL	CreateImage(int nWidth, int nHeight, int nDepth=8, int nChannels=1);
+	virtual BOOL	CreateImageHeader(int nWidth, int nHeight, int nDepth=8, int nChannels=1);
+	virtual BOOL	GetImageExist(void) const;
+	virtual BOOL	GetAllocatedData(void) const;
+
+	virtual void	ReleaseImage(void);
+	virtual int		GetHeight(void) const;
+	virtual int		GetWidth(void) const;
+	virtual int		GetWidthStep(void) const;
+	virtual int		GetDepth(void) const;
+	virtual int		GetChannels(void) const;
+	virtual int		GetBpp(void) const;
+	virtual int		GetImageSize(void) const;
+
+	virtual char*	GetImageBuffer(void);
+	virtual char*	GetImageBufferOrigin(void);
+	virtual const char*	GetImageBuffer(void) const;
+	virtual const char*	GetImageBufferOrigin(void) const;
+	virtual int		GetPixelValue(int x, int y) const;
+	virtual int		SetPixelValue(int x, int y, int nR, int nG, int nB);
+	virtual int		SetPixelValue(int x, int y, int nR, int nG, int nB, int nA);
+
+	virtual BOOL	LoadImage(const CString& strFilename);
+	virtual BOOL	SaveImage(const CString& strFilename, int nQiality=95) const;
+
+public: // common functions
+	// clear
+	BOOL	ClearImage(int nValue);
+	BOOL	ClearImage(int nValue, int nA);
+
+	// copy func
+	BOOL	CopyImageTo(CImageBuffer *pToImage) const;
+	BOOL	CopyImageTo(IplImage *pToImage) const;
+	BOOL	CopyImageFrom(const CImageBuffer *pFromImage);
+	BOOL	CopyImageFrom(const IplImage *pFromImage);
+
+	// show func
+	void	ShowImage(HDC hDC, const CRect& dstRect);
+	void	ShowImage(HDC hDC, const CRect& srcRect, const CRect& dstRect);
+	void	ShowImage(HDC hDC, int nSx, int nSy, int nWidth, int nHeight, int nFromX, int nFromY);
+
+	// get image data
+	BOOL	GetSubImage(int nSx, int nSy, int nWidth, int nHeight, CImageBuffer *pGetImage);
+	BOOL	GetSubImage(int nSx, int nSy, int nWidth, int nHeight, int nChannels, BYTE *pGetBuffer);
+	BOOL	GetSubImage(const CRect& rtRect, CImageBuffer *pGetImage);
+	BOOL	GetSubImage(const CRect& rtRect, int nChannels, BYTE *pGetBuffer);
+
+	BOOL	GetBandImage(int nColorBand, CImageBuffer* pGetImage) const;
+	BOOL	GetBandImage(int nColorBand, int nSx, int nSy, int nWidth, int nHeight, CImageBuffer* pGetImage);
+	BOOL	GetBandImage(int nColorBand, int nSx, int nSy, int nWidth, int nHeight, BYTE* pGetBuffer);
+	BOOL	GetBandImage(int nColorBand, const CRect& rtRect, CImageBuffer* pGetImage);
+	BOOL	GetBandImage(int nColorBand, const CRect& rtRect, BYTE* pGetBuffer);
+
+	// set image data
+	BOOL	SetSubImage(int nSx, int nSy, int nWidth, int nHeight, CImageBuffer* pSetImage);
+	BOOL	SetSubImage(int nSx, int nSy, int nWidth, int nHeight, int nBpp, BYTE *pSetBuffer);
+	BOOL	SetSubImage(const CRect& rtRect, CImageBuffer *pSetImage);
+	BOOL	SetSubImage(const CRect& rtRect, int nChannels, BYTE *pSetBuffer);
+
+	// draw function
+	BOOL	DrawLine(CPoint ptPos1, CPoint ptPos2, DWORD nColor, int nThickness=1, int nLineType=8, int nShift=0 );
+	BOOL	DrawRectangle(CPoint ptPos1, CPoint ptPos2, DWORD nColor, int nThickness=1, int nLineType=8, int nShift=0 );
+	BOOL	DrawCircle(CPoint ptCenter, int nRadius, DWORD nColor, int nThickness=1, int nLineType=8, int nShift=0 );
+	BOOL	DrawEllipse(CPoint ptCenter, CPoint ptSize, double dAngle, DWORD nColor, int nThickness=1, int nLineType=8, int nShift=0);
+	BOOL	DrawText(CPoint ptPoint, DWORD nColor, const CString& strText);
+
+	// buffer access
+	IplImage*			GetIplImage(void);
+	BOOL				SetImageBufferPtr(char* pPtr);
+
+	BOOL			DIBtoIplImage(HBITMAP& hbmp, HDC hdc=NULL);
+	BOOL			DCtoIplImage(CDC* pDC, const CRect& rect);
+
+	// 4Ch Image..
+	CvScalar GetPixelScalar(int x, int y);
+
+protected:
+	static void		FillBitmapInfo(BITMAPINFO* bmi, int width, int height, int bpp, int origin);
+
+	BOOL		m_bAllocatedData;
+
+public:
+	IplImage	*m_pImageData;
+};
+
diff --git a/Lib/CHImageBuffer/include/ImageViewer.h b/Lib/CHImageBuffer/include/ImageViewer.h
new file mode 100644
index 0000000..a0ffaa1
--- /dev/null
+++ b/Lib/CHImageBuffer/include/ImageViewer.h
@@ -0,0 +1,219 @@
+#pragma once
+
+
+// CImageViewer
+
+#include "ImageBuffer.h"
+#include <d2d1.h>
+#include <wincodec.h>
+#include <vector>
+#include <list>
+#include "afxmt.h"
+
+enum ViewScaleType			{ ViewScale_Origin=0, ViewScale_Zoom, ViewScale_Fit, ViewScale_Count };
+enum DrawObjectType			{ DrawObject_Line=0, DrawObject_Rectangle, DrawObject_Ellipse, DrawObject_Polygon, DrawObject_Count };
+enum ColorBandShiftValue	{ AlphaShiftValue = 24, RedShiftValue = 16, GreenShiftValue = 8, BlueShiftValue = 0 };
+
+#define SafeRelease(T)		if(T)	{T->Release(); T = 0; }
+#define SafeDelete(T)		if(T)	{delete T; T = 0; }
+
+static UINT MakeColor(BYTE a, BYTE r, BYTE g, BYTE b)
+{
+	return (((UINT) (b) <<  BlueShiftValue) |
+		((UINT) (g) <<	GreenShiftValue) |
+		((UINT) (r) <<  RedShiftValue) |
+		((UINT) (a) <<	AlphaShiftValue));
+}
+
+struct SDoublePos
+{
+	SDoublePos(double dX=0, double dY=0) 
+	{
+		dPosX = dX;
+		dPosY = dY;
+	}
+	double dPosX;
+	double dPosY;
+};
+typedef std::vector<SDoublePos>						VectorDoublePos;
+typedef std::vector<SDoublePos>::iterator			VectorDoublePosIt;
+typedef std::vector<SDoublePos>::const_iterator		constVectorDoublePosIt;
+
+struct SDrawObject
+{
+public:
+	SDrawObject()	{ Reset(); }
+	~SDrawObject()	{ Reset(); }
+
+	void Reset()
+	{
+		nIndex			= 0;
+		nType			= DrawObject_Line;
+		strName			= _T("");
+		nPenColor		= MakeColor(0,255,0,0);
+		nBrushColor		= MakeColor(0,0,0,0);
+		dPenOpacity		= 0.6;
+		dBrushOpacity	= 0.2;
+		dPenSize		= 1; // 1pixel
+
+		dPosX			= 0.0;			
+		dPosY			= 0.0;		
+		dSizeX			= 0.0;
+		dSizeY			= 0.0;
+
+		vecPolygon.clear();
+	}
+
+	double Left() const		{ return dPosX; }
+	double Top() const		{ return dPosY; }
+	double Right() const	{ return (dPosX+dSizeX); }
+	double Bottom() const	{ return (dPosY+dSizeY); }
+	double Width() const	{ return dSizeX; }
+	double Height() const	{ return dSizeY; }
+
+	int				nIndex;
+	int				nType;
+	CString			strName;
+	UINT			nPenColor;
+	double			dPenOpacity;	//(0~1)
+	UINT			nBrushColor;	//
+	double			dBrushOpacity;	//(0~1)
+
+	double			dPenSize;
+	double			dPosX;
+	double			dPosY;
+	double			dSizeX;
+	double			dSizeY;
+
+	VectorDoublePos	vecPolygon;
+};
+typedef std::list<SDrawObject>					ListDrawObject;
+typedef std::list<SDrawObject>::iterator		ListDrawObjectIt;
+typedef std::list<SDrawObject>::const_iterator	constListDrawObjectIt;
+
+class AFX_EXT_CLASS CImageViewer : public CWnd, public CImageBuffer
+{
+	DECLARE_DYNAMIC(CImageViewer)
+
+public:
+	CImageViewer(CWnd* pParentWnd=NULL);
+	virtual ~CImageViewer();
+
+	BOOL LoadImage(const CString& strFilename);
+
+protected:
+	DECLARE_MESSAGE_MAP()
+
+public:
+	// setter
+	void	SetViewType(int nType);
+	void	SetDrawViewName(BOOL bDraw);
+	void	SetDrawObject(BOOL bDraw);
+	void	SetDrawRoi(BOOL bDraw);
+	void	SetViewName(const CString& strValue);
+	void	SetRoiRect(const CRect& rtRect);
+
+	void	SetScale(double dScale);
+	void	SetWidthScale(double dScale);
+	void	SetHeightScale(double dScale);
+
+	// getter
+	int		GetViewType() const;
+	BOOL	GetDrawViewName() const;
+	BOOL	GetDrawObject() const;
+	BOOL	GetDrawRoi() const;
+	CString	GetViewName() const;
+	CRect	GetRoiRect() const;
+		
+	double	GetScale() const;
+	double	GetWidthScale(void) const;
+	double	GetHeightScale(void) const;
+	
+	int		GetHScrollPos(void) const;
+	int		GetVScrollPos(void) const;
+	int		GetScaleWidth(void);
+	int		GetScaleHeight(void);
+
+	// draw object
+	void	AddDrawObject(const SDrawObject& drawObject);
+	void	DeleteAllDrawObject(void);
+
+	// clear screen
+	void	ClearScreen();
+public:
+	afx_msg void OnPaint();
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+
+protected:
+	CWnd				*m_pParentWnd;
+	
+	// scroll pos
+	int					m_nVScroll;
+	int					m_nHScroll;
+
+	// max scroll pos
+	int					m_nMaxVScroll;
+	int					m_nMaxHScroll;
+
+	// image draw
+	int					m_nViewType;
+	int					m_nScaleWidth;
+	int					m_nScaleHeight;
+	double				m_dWidthScale; 
+	double				m_dHeightScale;
+
+	// draw view name
+	BOOL				m_bDrawViewName;
+	CString				m_strViewName;
+	
+	// draw roi
+	BOOL				m_bDrawRoi;
+	SDrawObject			m_rtRoiRect;
+
+	// draw object
+	BOOL				m_bDrawObject;
+	ListDrawObject		m_listDrawObject;
+	
+protected:
+	void DrawViewName();
+	void DrawRoi();
+	void DrawObject();
+	void DrawObject(const SDrawObject& object);
+	void CalculateRect();	
+
+protected:
+	BOOL CreateRenderTarget(const CRect& rtRect);
+	int CreateWicBitmap(int nWidthStep, int nHeight, int nChannels, BYTE* pBuffer);
+
+	static BOOL IntersectsWith(const D2D1_RECT_F& rect1, const D2D1_RECT_F& rect2)
+	{
+		return (	rect1.left		< rect2.right &&
+			rect1.top		< rect2.bottom &&
+			rect1.right		> rect2.left &&
+			rect1.bottom	> rect2.top);
+	}
+
+protected:
+	IWICImagingFactory		*m_pWICFactory;
+	IWICBitmap				*m_pWICBitmap;
+	IWICFormatConverter		*m_pWICFormatConverter;
+
+	ID2D1Factory			*m_pD2DFactory;
+	ID2D1HwndRenderTarget	*m_pD2DRenderTarget;
+	ID2D1Bitmap				*m_pD2DBitmap;
+	CCriticalSection		*m_pD2DCriticalSection;
+
+	int						m_nWicBitmapWidthStep;
+	int						m_nWicBitmapHeight;
+	int						m_nWicBitmapChannels;
+	CRect					m_rtViewRect;
+	CRect					m_rtOrgViewRect;
+	D2D1_RECT_F				m_rtSourceRect;
+	D2D1_RECT_F				m_rtDestRect;
+	D2D1_RECT_F				m_rtRenderRect;
+};
+
+
diff --git a/Lib/CHThreadPool/include/ThreadData.h b/Lib/CHThreadPool/include/ThreadData.h
new file mode 100644
index 0000000..84fcb66
--- /dev/null
+++ b/Lib/CHThreadPool/include/ThreadData.h
@@ -0,0 +1,20 @@
+#pragma once
+
+class CWorkThreadData
+{
+public:
+	CWorkThreadData(PVOID pPtr) 
+	{
+		pCallerPtr = pPtr;
+		bProcessed = false;
+	}
+
+	virtual ~CWorkThreadData()
+	{
+		pCallerPtr = NULL;
+		bProcessed = false;
+	}
+	PVOID	pCallerPtr;
+	bool	bProcessed;
+};
+
diff --git a/Lib/CHThreadPool/include/ThreadPool.h b/Lib/CHThreadPool/include/ThreadPool.h
new file mode 100644
index 0000000..8ec7fb5
--- /dev/null
+++ b/Lib/CHThreadPool/include/ThreadPool.h
@@ -0,0 +1,42 @@
+#pragma once
+
+typedef struct _CH_TP_CALLBACK_ENVIRON 
+{
+	TP_VERSION                         Version;
+	PTP_POOL                           Pool;
+	PTP_CLEANUP_GROUP                  CleanupGroup;
+	PTP_CLEANUP_GROUP_CANCEL_CALLBACK  CleanupGroupCancelCallback;
+	PVOID                              RaceDll;
+	struct _ACTIVATION_CONTEXT        *ActivationContext;
+	PTP_SIMPLE_CALLBACK                FinalizationCallback;
+	union {
+		DWORD                          Flags;
+		struct {
+			DWORD                      LongFunction :  1;
+			DWORD                      Persistent   :  1;
+			DWORD                      Private      : 30;
+		} s;
+	} u;    
+	TP_CALLBACK_PRIORITY               CallbackPriority;
+	DWORD                              Size;
+} CH_TP_CALLBACK_ENVIRON;
+
+class AFX_EXT_CLASS CThreadPool
+{
+public:
+	CThreadPool(int nThreadCount=1);
+	virtual ~CThreadPool(void);
+	int	GetThreadCount() const;
+
+private:
+	void CreateThreadPools(int nThreadCount=1);
+	void CloseThreadPools();
+
+protected:
+	int						m_nThreadCount;
+	int						m_nRollback;
+	PTP_POOL				m_pPool;
+	CH_TP_CALLBACK_ENVIRON	m_CallBackEnviron;
+	PTP_CLEANUP_GROUP		m_pCleanupGroup;
+};
+
diff --git a/Lib/CHThreadPool/include/TimerThreadPool.h b/Lib/CHThreadPool/include/TimerThreadPool.h
new file mode 100644
index 0000000..11f92a2
--- /dev/null
+++ b/Lib/CHThreadPool/include/TimerThreadPool.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "ThreadPool.h"
+
+class AFX_EXT_CLASS CTimerThreadPool : public CThreadPool
+{
+public:
+	CTimerThreadPool(DWORD dwPeriod=100, int nThreadCount=1);
+	virtual ~CTimerThreadPool(void);
+	DWORD GetPeriod() const;
+	virtual BOOL StartThread();
+	virtual void StopThread();
+
+protected:
+	virtual void TimerThreadProcess(PVOID pParameter) = 0;
+
+protected:
+	BOOL CreateTimerThread(PVOID pParameter);
+	void CloseTimerThread();
+	static VOID CALLBACK TimerCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_TIMER pTimer);
+
+protected:
+	DWORD					m_dwPeriod;
+	PTP_TIMER				m_pTimer;
+	PTP_TIMER_CALLBACK		m_pTimerCallback;
+};
+
diff --git a/Lib/CHThreadPool/include/WaitThreadPool.h b/Lib/CHThreadPool/include/WaitThreadPool.h
new file mode 100644
index 0000000..4ed47be
--- /dev/null
+++ b/Lib/CHThreadPool/include/WaitThreadPool.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "ThreadPool.h"
+
+class AFX_EXT_CLASS CWaitThreadPool : public CThreadPool
+{
+public:
+	CWaitThreadPool(int nThreadCount=1);
+	virtual ~CWaitThreadPool(void);
+	virtual BOOL SetEvent1();
+	virtual BOOL ResetEvent1();
+		
+protected:
+	virtual void WaitThreadProcess(PVOID pParameter) = 0;
+
+protected:
+	BOOL CreateWaitThread(PVOID pParameter);
+	void CloseWaitThread();
+	static VOID CALLBACK WaitCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_WAIT pWait, TP_WAIT_RESULT WaitResult);
+
+protected:
+	HANDLE					m_hEvent;
+	PTP_WAIT				m_pWait;
+	PTP_WAIT_CALLBACK		m_pWaitCallback;
+};
\ No newline at end of file
diff --git a/Lib/CHThreadPool/include/WorkThreadArray.h b/Lib/CHThreadPool/include/WorkThreadArray.h
new file mode 100644
index 0000000..7cbe254
--- /dev/null
+++ b/Lib/CHThreadPool/include/WorkThreadArray.h
@@ -0,0 +1,29 @@
+#pragma once
+#include "WorkThreadPool.h"
+
+interface IWorkThreadArray2Parent
+{
+	virtual void WorkThreadProcessArray(PVOID pParameter) = 0;
+};
+
+class AFX_EXT_CLASS CWorkThreadArray : public CWorkThreadPool
+{
+public:
+	CWorkThreadArray();
+	CWorkThreadArray(IWorkThreadArray2Parent* pInterface, int nThreadPool);
+	~CWorkThreadArray(void);
+
+	void			SetInterface(IWorkThreadArray2Parent* pInterface)	{m_pInterface = pInterface;};
+
+	BOOL			CreateWorkThread(PVOID pParameter);
+
+	virtual void	WorkThreadProcess(PVOID pParameter);
+
+	BOOL			GetComplete()	{return m_bComplete;};
+
+private:
+
+	IWorkThreadArray2Parent* m_pInterface;
+
+	BOOL					 m_bComplete;
+};
\ No newline at end of file
diff --git a/Lib/CHThreadPool/include/WorkThreadPool.h b/Lib/CHThreadPool/include/WorkThreadPool.h
new file mode 100644
index 0000000..025de09
--- /dev/null
+++ b/Lib/CHThreadPool/include/WorkThreadPool.h
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "ThreadData.h"
+#include "ThreadPool.h"
+
+#include <deque>
+typedef std::deque<CWorkThreadData*>				DequeWorkThreadData;
+typedef std::deque<CWorkThreadData*>::iterator		DequeWorkThreadDataIt;
+
+class AFX_EXT_CLASS CWorkThreadPool : public CThreadPool
+{
+public:
+	CWorkThreadPool(int nThreadCount=1);
+	virtual ~CWorkThreadPool(void);
+	size_t GetThreadDataCount();
+
+protected:
+	virtual void WorkThreadProcess(PVOID pParameter) = 0;
+
+protected:
+	BOOL CreateWorkThread(PVOID pParameter);
+	void CloseWorkThread();
+	void ClearThreadData();
+	static VOID CALLBACK WorkCallback(PTP_CALLBACK_INSTANCE pInstance, PVOID pParameter, PTP_WORK pWork);
+
+private:
+	CWorkThreadData* AddThreadData(CWorkThreadData* pThreadData);
+
+protected:
+	PTP_WORK				m_pWork;
+	PTP_WORK_CALLBACK		m_pWorkCallback;
+
+private:
+	DequeWorkThreadData		m_deqThreadData;
+	CCriticalSection		m_csThreadData;
+};
+
diff --git a/Lib/ConfigFileManager/include/BasedConfig.h b/Lib/ConfigFileManager/include/BasedConfig.h
new file mode 100644
index 0000000..917c802
--- /dev/null
+++ b/Lib/ConfigFileManager/include/BasedConfig.h
@@ -0,0 +1,67 @@
+// BasedConfig.h: interface for the CBasedConfig class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_BASEDCONFIG_H__90C1B236_E7C5_450C_9B90_52079419DA37__INCLUDED_)
+#define AFX_BASEDCONFIG_H__90C1B236_E7C5_450C_9B90_52079419DA37__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+/*!
+* \brief
+* 牢磐其捞胶 努贰胶 
+* 
+* 颇老 涝免仿 扼捞宏矾府狼 牢磐其捞胶 努贰胶
+* 
+*/
+class CBasedConfig  
+{
+public:
+	CBasedConfig();
+	virtual ~CBasedConfig();
+
+	virtual BOOL	Initialize(HKEY hKey, CString strKey, CString strFilename) = 0;									//!> 檬扁拳 窃荐 牢磐其捞胶
+	
+	//////////////////////////////////////////////////////////////////////////
+	virtual BOOL	SetItemValue(CString strName,  CString& strvalue) = 0;											//!> Set 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : CString屈  
+	virtual BOOL	SetItemValue(CString strName, int& nValue) = 0;													//!> Set 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : int屈  
+	virtual BOOL	SetItemValue(CString strName, unsigned short &sValue) = 0;										//!> Set 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	virtual BOOL	SetItemValue(CString strName, double& dValue) = 0;												//!> Set 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	virtual BOOL	SetItemValue(int nIdx, CString strName, CString& strvalue) = 0;									//!> Set 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : CString屈  
+	virtual BOOL	SetItemValue(int nIdx, CString strName, int& nValue) = 0;										//!> Set 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : int屈  
+	virtual BOOL	SetItemValue(int nIdx, CString strName, unsigned short &sValue) = 0;							//!> Set 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	virtual BOOL	SetItemValue(int nIdx, CString strName, double& dValue) = 0;									//!> Set 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	//////////////////////////////////////////////////////////////////////////
+	virtual int		GetItemValue(CString strName, CString& strValue, CString strDefault) = 0;						//!> Get 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : CString屈  
+	virtual int		GetItemValue(CString strName, int& nValue, int nDefault) = 0;									//!> Get 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : int屈  
+	virtual int		GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault) = 0;				//!> Get 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	virtual int		GetItemValue(CString strName, double& dValue, double dDefault) = 0;								//!> Get 牢磐其捞胶 strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	virtual int		GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault) = 0;				//!> Get 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : CString屈  
+	virtual int		GetItemValue(int nIdx, CString strName, int& nValue, int nDefault) = 0;							//!> Get 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : int屈  
+	virtual int		GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault) = 0;	//!> Get 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : unsigned short屈 
+	virtual int		GetItemValue(int nIdx, CString strName, double& dValue, double dDefault) = 0;					//!> Get 牢磐其捞胶 nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	virtual BOOL	RemoveAllItem() = 0;																			//!> 肺靛等 皋葛府狼 葛电 亲格阑 昏力
+	virtual BOOL	RemoveItem(CString strName) = 0;																//!> strName 捞抚阑 啊柳 亲格阑 昏力
+	virtual BOOL	RemoveItem(int nIdx, CString strName) = 0;														//!> 硅凯(nIdx), strName 捞抚阑 啊柳 亲格阑 昏力
+
+	
+	virtual BOOL	WriteToFile() = 0;																				//!> 颇老俊 亲格 静扁 ( 皋葛府 -> 颇老 )
+
+	virtual void	SetRewriteMode(BOOL bRewrite) = 0;																//!> ReWrite 葛靛狼 汲沥 ( TRUE老 版快 皋葛府客 颇老阑 角矫埃 悼扁拳 茄促)
+	virtual BOOL	GetRewriteMode() = 0;																			//!> ReWrite 葛靛 惑怕 罐扁
+	
+
+	// OhByungGil  Modify -> LogFile Write
+	virtual void	SetLogMode(BOOL bMode) = 0;																		//!> 肺弊 葛靛狼 汲沥 ( TRUE老 版快 亲格捞 函版瞪 矫俊 肺弊甫 免仿茄促. )
+	virtual BOOL	GetLogMode() = 0;																				//!> 肺弊 葛靛 惑怕 罐扁
+	virtual void	SetLogFilePath(CString strLogFilePath) = 0;														//!> 肺弊 颇老狼 版肺 汲沥
+	virtual CString GetLogFilePath() = 0;																			//!> 汲沥等 肺弊 颇老狼 版肺 罐扁
+};
+
+#endif // !defined(AFX_BASEDCONFIG_H__90C1B236_E7C5_450C_9B90_52079419DA37__INCLUDED_)
diff --git a/Lib/ConfigFileManager/include/Config.h b/Lib/ConfigFileManager/include/Config.h
new file mode 100644
index 0000000..93357ab
--- /dev/null
+++ b/Lib/ConfigFileManager/include/Config.h
@@ -0,0 +1,89 @@
+// HMRegiConfig.h: interface for the CConfig class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_)
+#define AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "BasedConfig.h"
+
+enum Grouping	//!> 颇老 包府 葛碘 弊缝
+{
+	FileMap_Mode = 1,		///> STL Map 捞侩 包府
+	FileManager_Mode = 2,	///> MFC COblist 捞侩 包府
+	Registery_mode = 4,		///> 饭瘤胶飘府 包府
+	Ini_Mode = 5			///> INI 颇老 捞侩 包府
+};
+
+#define SHLM	HKEY_LOCAL_MACHINE
+#define SHCU	HKEY_CURRENT_USER
+#define SHCR	HKEY_CLASSES_ROOT
+
+/*!
+* \brief
+* 单捞磐 包府 努贰胶 
+* 
+* 单捞磐 包府 努贰胶肺辑 (颇老 包府, 饭瘤胶飘府 包府甫 瘤盔茄促.) \n\n
+* 颇老 葛靛\n
+* SetRegiConfig 阑 捞侩窍咯 颇老 坷锹矫 皋葛府肺 颇老狼 郴侩阑 利犁 茄促. \n
+* 单捞磐 涝/免仿 饶 WriteToFile 窃荐甫 烹秦辑 悼扁拳 窍芭唱 ReWriteMode甫 捞侩窍咯 角矫埃 悼扁拳 且 荐 乐促.
+*/
+class AFX_EXT_CLASS CConfig  
+{
+public:
+	CConfig();
+	virtual ~CConfig();
+
+	BOOL	SetLogWriteMode(BOOL bUse,CString strFilePath);													//!> 肺弊 葛靛 汲沥
+	
+	BOOL	SetRegiConfig(HKEY hKey, CString strKey, TCHAR* szFilename, Grouping Select = FileMap_Mode);	//!> 颇老/饭瘤胶飘府 肺靛 
+
+	BOOL	DeleteAllItem();																				//!> 傈眉 单捞磐 昏力
+	BOOL	DeleteValue(CString strvalue);																	//!> 急琶 单捞磐 昏力
+	BOOL	DeleteValue(CString strvalue, int nIdx);														//!> 急琶 单捞磐 昏力
+
+	// File_Mode 父 利侩.
+	BOOL	WriteToFile();																					//!> FIle Mode 老 版快 皋葛府狼 郴侩阑 颇老俊 历厘茄促.
+	void	SetRewriteMode(BOOL bRewrite);																	//!> FIle Mode 老 版快 角矫埃 悼扁拳 葛靛甫 汲沥茄促.
+	BOOL	GetRewriteMode();																				//!> File Mode 老 版快 角矫埃 悼扁拳 葛靛 咯何甫 馆券茄促.
+
+	CString	GetFilePath();																					//!> File Mode 老 版快 包府窍绰 颇老狼 版肺甫 馆券茄促.
+
+	//////////////////////////////////////////////////////////////////////////
+	BOOL	SetItemValue(CString strName,  CString strvalue);												//!> Set strName : 亲格备盒磊 鸥涝 : CString屈  
+	BOOL	SetItemValue(CString strName, int nValue);														//!> Set strName : 亲格备盒磊 鸥涝 : int屈  
+	BOOL	SetItemValue(CString strName, unsigned short sValue);											//!> Set strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	BOOL	SetItemValue(CString strName, double dValue);													//!> Set strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	BOOL	SetItemValue(int nIdx, CString strName, CString strvalue);										//!> Set nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : CString屈  
+	BOOL	SetItemValue(int nIdx, CString strName, int nValue);											//!> Set nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : int屈  
+	BOOL	SetItemValue(int nIdx, CString strName, unsigned short sValue);									//!> Set nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : unsigned short屈
+	BOOL	SetItemValue(int nIdx, CString strName, double dValue);											//!> Set nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	//////////////////////////////////////////////////////////////////////////
+	int		GetItemValue(CString strName, CString& strValue, CString strDefault = _T(""));					//!> Get strName : 亲格备盒磊 鸥涝 : CString屈  
+	int		GetItemValue(CString strName, int& nValue, int nDefault = 0);									//!> Get strName : 亲格备盒磊 鸥涝 : int屈  
+	int		GetItemValue(CString strName, unsigned short &nValue, unsigned short sDefault = 0);				//!> Get strName : 亲格备盒磊 鸥涝 : unsigned short屈  
+	int		GetItemValue(CString strName, double& dValue, double dDefault = 0.0);							//!> Get strName : 亲格备盒磊 鸥涝 : double屈  
+	
+	int		GetItemValue(int nIdx, CString strName, CString& strValue, CString strDefault = _T(""));		//!> Get nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : CString屈  
+	int		GetItemValue(int nIdx, CString strName, int& nValue, int nDefault = 0);							//!> Get nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : int屈  
+	int		GetItemValue(int nIdx, CString strName, unsigned short &nValue, unsigned short sDefault = 0);	//!> Get nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : unsigned short屈
+	int		GetItemValue(int nIdx, CString strName, double& dValue, double dDefault = 0.0);					//!> Get nIdx : 硅凯 牢郸胶, strName : 亲格备盒磊 鸥涝 : double屈  
+
+public:
+	
+	Grouping		m_Classification;																		///> 颇老/饭瘤胶飘府 包府 鸥涝
+
+protected:
+	
+	CBasedConfig	*m_pConfig;																				///> 扁夯 按眉 器牢磐
+
+	CString			m_strFilePath;																			///> 颇老 版肺
+};
+
+#endif // !defined(AFX_CONFIG_H__F8E1E3C1_3652_4862_BC5B_B089CDD610CD__INCLUDED_)
diff --git a/Lib/ConfigFileManager/include/FileIOInterface.h b/Lib/ConfigFileManager/include/FileIOInterface.h
new file mode 100644
index 0000000..d0c362a
--- /dev/null
+++ b/Lib/ConfigFileManager/include/FileIOInterface.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "Config.h"
+
+class AFX_EXT_CLASS CFileIOInterface
+{
+public:
+	CFileIOInterface(void);
+	virtual ~CFileIOInterface(void);
+
+#pragma region Interface Function
+	virtual BOOL LoadData(CConfig* pConfig) = 0;
+	virtual BOOL SaveData(CConfig* pConfig) = 0;
+#pragma endregion Interface Function
+};
+
diff --git a/Lib/ConfigFileManager/include/FileVersionManager.h b/Lib/ConfigFileManager/include/FileVersionManager.h
new file mode 100644
index 0000000..cbb95d6
--- /dev/null
+++ b/Lib/ConfigFileManager/include/FileVersionManager.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "Config.h"
+
+class AFX_EXT_CLASS CFileVersionManager
+{
+public:
+	CFileVersionManager(void);
+	virtual ~CFileVersionManager(void);
+
+	BOOL	LoadData(CConfig* pConfig);
+	BOOL	SaveData(CConfig* pConfig);
+
+	CString			GetVersion();
+	int				GetSoftRev();
+private:
+	CString			m_strVersion;
+	int				m_nSoftRev;
+};
+
diff --git a/Lib/EdgeInspect/include/BLOB_Tool.h b/Lib/EdgeInspect/include/BLOB_Tool.h
new file mode 100644
index 0000000..c225689
--- /dev/null
+++ b/Lib/EdgeInspect/include/BLOB_Tool.h
@@ -0,0 +1,82 @@
+#if !defined(__FV_BLOB_INCLUDED__)
+#define __FV_BLOB_INCLUDED__
+
+#include <map>
+#include <list>
+#include <vector>
+
+
+class CEdgeBlobData  
+{
+public:
+	CEdgeBlobData()
+	{
+		Reset();
+	}
+
+	CEdgeBlobData(int x, int y)
+	{
+		Reset();
+		fCenterX = (float)x;
+		fCenterY = (float)y;
+	}
+
+	CEdgeBlobData(int left, int top, int right, int bottom)
+	{
+		Reset();
+
+		nLeft	= left;
+		nTop	= top;
+		nRight	= right;
+		nBottom	= bottom;
+		fCenterX = float(left) + float(right-left) / 2.f;
+		fCenterY = float(top) + float(bottom-top) / 2.f;
+	}
+
+	void Reset()
+	{
+		fCenterX		= 0;
+		fCenterY		= 0;
+		nLeft			= 0;
+		nTop			= 0;
+		nRight			= 0;
+		nBottom			= 0;
+		fMassCenterX	= 0;
+		fMassCenterY	= 0;
+		nPixelCount		= 0;
+		fMatchScore		= 0;
+		bFiltering		= FALSE;
+	}
+
+	int Width()		{ return nRight - nLeft + 1; }
+	int Height()	{ return nBottom - nTop + 1; }
+
+	float	fCenterX;
+	float	fCenterY;
+	int		nLeft;
+	int		nTop;
+	int		nRight;
+	int		nBottom;
+	int		nPixelCount;
+	float	fMassCenterX;
+	float	fMassCenterY;
+	float	fMatchScore;
+	BOOL	bFiltering;
+};
+
+typedef std::list<CEdgeBlobData*>					ListEdgeBlobData;
+typedef std::list<CEdgeBlobData*>::iterator			ListEdgeBlobDataIt;
+
+class AFX_EXT_CLASS CBlobTool
+{
+	// Construction
+public:
+	CBlobTool();
+	~CBlobTool();
+
+public:
+	bool				BlobAnalysis(BYTE *pImageData, int nWidth, int nHeight, int nStep, ListEdgeBlobData &blobList, int nMergeRange);		
+
+};
+
+#endif
\ No newline at end of file
diff --git a/Lib/EdgeInspect/include/ChamferInspect.h b/Lib/EdgeInspect/include/ChamferInspect.h
new file mode 100644
index 0000000..a5cbb4f
--- /dev/null
+++ b/Lib/EdgeInspect/include/ChamferInspect.h
@@ -0,0 +1,310 @@
+#if !defined(AFX_CHAMFERINSPECT_H_INCLUDED_)
+#define AFX_CHAMFERINSPECT_H_INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ChamferInspect.h : header file
+//
+#include <list>
+#include <vector>
+#include "EDGE_DIPM.h"
+
+#include <opencv.hpp>
+#include <highgui.hpp>
+#include <core.hpp>
+#include <imgproc.hpp>
+
+
+//Search data
+#ifndef _GLASSFINDDATA_
+#define _GLASSFINDDATA_
+typedef struct GlassFindData{
+	int				*pPos;	
+	int				nPosCnt;
+	short			nWidth;	
+
+	GlassFindData()
+	{
+		pPos = NULL;
+		Reset();
+	}
+	void Reset()
+	{
+		nWidth = 0;		
+		nPosCnt = 0;
+		if(pPos != NULL)
+			delete[] pPos, pPos = NULL;
+	}
+	GlassFindData& operator=(const GlassFindData &rh)
+	{	
+		Reset();
+		nPosCnt = rh.nPosCnt;
+		nWidth = rh.nWidth;	
+
+		if(nPosCnt > 0)
+		{
+			pPos = new int[nPosCnt];
+			CopyMemory(pPos,rh.pPos,sizeof(int)*nPosCnt);
+		}				
+		return *this;
+	}
+	void GetMinMaxPos(int &nMin,int &nMax)
+	{
+		nMin = INT_MAX;
+		nMax = 0;
+
+		if(pPos == NULL || nPosCnt <= 0)
+			return;
+
+		int			iLoop,nValue;
+		for(iLoop=0;iLoop<nPosCnt;iLoop++)
+		{
+			nValue = pPos[iLoop];
+			if(nMin > nValue) nMin = nValue;
+			if(nMax < nValue) nMax = nValue;
+		}
+	}
+} GLASSFINDDATA, *LGLASSFINDDATA;
+#endif
+
+#ifndef _EDGE_POS_
+#define _EDGE_POS_
+typedef struct EdgePos{
+	double	dLeft;
+	double	dRight;
+	int		nPos;
+
+	void	Reset()
+	{
+		dLeft = dRight = 0;
+		nPos = 0;
+	}
+} EDGEPOS, *LEDGEPOS;
+#endif
+
+typedef struct _STU_CHIPPINGINS_EXP_POS
+{
+	int			nSide;
+	int			nPosY;
+	int			nSize;	
+	int			nERType;//130115
+	int			nPosX;//130115
+	int			nSizeX;//130115
+
+	_STU_CHIPPINGINS_EXP_POS()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		nSide = 4;
+		nPosY = nSize = 0;
+		nERType = 2;//130115
+		nPosX = nSizeX = 0;//130115
+	}
+
+} STU_CHIPPINGINS_EXP_POS, *pSTU_CHIPPINGINS_EXP_POS;
+
+typedef struct _STU_EXTRA_POLY
+{
+	int			nSL,nST;
+	int			nEL,nEB;
+	int			nTheHeight;
+	double		dTheta;
+
+	_STU_EXTRA_POLY()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		nSL = nST = nEL = nEB = nTheHeight = 0;
+		dTheta = 0.;
+	}
+
+} STU_EXTRA_POLY, *pSTU_EXTRA_POLY;
+
+/////////////////////////////////////////////////////////////////////////////
+// CChamferInspect window
+
+enum ChipErrCode	{ERR_CHIP_SUCCESS = 0, ERR_CHIP_IMAGE_NULL_01,ERR_CHIP_IMAGE_NULL_02,ERR_CHIP_IMAGE_NULL_03,ERR_CHIP_PREPROCESS,
+					ERR_CHIP_FIND_FORELINE, ERR_CHIP_FIND_RIGHTLINE,ERR_CHIP_SUBPIXEL,ERR_CHIP_CHECK_CHIPRECT};
+
+enum ChipThresMode	{THRESMODE_FIXED=0,THRESMODE_ADAPTIVE,THRESMODE_ADAPTIVE_MAX};
+
+#define		MAX_CHIP_DEFECT_COUNT			1000
+#define		MAX_CHIP_PAIR_DEFECT_COUNT		20000
+
+typedef struct _InspectParam
+{
+	BOOL bUse_ChipIns;
+	BOOL bUse_CrackIns;
+	BOOL bUse_BrokenIns;
+	BOOL bUse_BurrIns;
+
+	int nChipThres;
+	int nChipThres_White;
+	int nChipDiffThres;
+	int nCrackThres;
+	int nBrokenThres;
+	int nBurrThres;
+
+	int nChipMinSize;
+	int nCrackMinSize;
+	int nBrokenMinSize;
+	int nBurrMinSize;
+
+	int nChipSideFilterSize;
+	int nCrackSideFilterSize;
+	int nBrokenSideFilterSize;
+	int nBurrSideFilterSize;
+
+	_InspectParam()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bUse_ChipIns = bUse_CrackIns = bUse_BrokenIns = bUse_BurrIns = FALSE;
+
+		nChipThres = 15;
+		nChipThres_White = 255;
+		nChipDiffThres = 30;
+		nCrackThres = 15;
+		nBrokenThres = 15;
+		nBurrThres = 15;
+
+		nChipMinSize = nCrackMinSize = nBrokenMinSize = nBurrMinSize = 5;
+
+		nChipSideFilterSize = nCrackSideFilterSize = nBrokenSideFilterSize = nBurrSideFilterSize = 10;
+	}
+
+} InspectParam, *pInspectParam;
+
+class AFX_EXT_CLASS CChamferInspect
+{
+// Construction
+public:
+	CChamferInspect();
+	virtual ~CChamferInspect();
+
+// Chamfer & Chip
+public:
+	ChipErrCode			Inspection(int *nResult,LPBYTE lpHeader,int nFrameWidth,CRect &rectChamfer,int nChamferThres,BOOL bChipIns,BOOL bChamfer,CRect &rectChip,CRect &rectCrack,CRect &rectBroken
+		,int nChipThres,int nChipIDiffThres,int nCrackThres,int nBrokenThres,int nBurrThres,BOOL bSaveDebug=FALSE,int *nPreForeLine=NULL,ChipThresMode emThresMode=THRESMODE_FIXED,int iFrame = 0);	
+
+	ChipErrCode			Inspection(int *nResult,LPBYTE lpHeader,int nFrameWidth,CRect &rectChamfer,int nChamferThres,BOOL bChipIns,BOOL bChamfer,CRect &rectChip,CRect &rectCrack,CRect &rectBroken, 
+		InspectParam insParam, BOOL bSaveDebug=FALSE,int *nPreForeLine=NULL,ChipThresMode emThresMode=THRESMODE_FIXED,int iFrame = 0);
+	
+	BOOL				ChipInspection(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,int nChipThres,int nBurrThres,int nEdgeLeft,int nEdgeRight);
+	BOOL				ChipInspection_Binarization(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,CRect &rectCrack,CRect &rectBroken,int nChipThres,int nChipDiffThres,int nCrackThres,int nBrokenThres
+						,int nBurrThres,int nEdgeLeft,int nEdgeRight,BOOL bSaveDebug,int iFrame);
+
+	BOOL				ChipInspection_Binarization_OpenCV(LPBYTE lpHeader,int nFrameWidth,CRect &rectChip,CRect &rectCrack,CRect &rectBroken,InspectParam insParam,int nEdgeLeft,int nEdgeRight,BOOL bSaveDebug,int iFrame);
+
+	void				BinalizeFind_Chip(CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectInsReg,CSISBuffer &pImgSave,BOOL bSaveImage,BOOL bPolar=TRUE);
+	double				FindBPosLine(CSISBuffer &bufferOrg,int nThres);
+	int					GetForeEdgeLine(int iPos){return m_nForeEdgeLine[iPos];}	
+	CChipBlob			*GetDefectResult(){return m_DefectBlob;}	
+	int					GetDefectCount(){return m_nDefectCnt;}
+	double				GetAvgThick(){return m_dAvgThick;}
+	double				GetAreaAVG(LPBYTE pImg,CRect &rectIns,CRect &rect);
+	double				GetConvRes(){return m_dConvResolution;}
+
+	ChipErrCode			InspectCorner_Extra(CSISBuffer &BufferIns,int nThres,int nTop,int nLeft,BOOL bReset=TRUE,int nMergeReange=4);
+	ChipErrCode			InspectCorner_ExtraPoly(CSISBuffer &BufferIns,int nThres,int nTop,int nLeft,STU_EXTRA_POLY &stuPoly,BOOL bReset=TRUE,int nMergeReange=4);
+
+	// Binarization..
+	BOOL				Binarization_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, int nThresholdLow, int nThresholdHigh);
+	BOOL				Binarization_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, int nThresholdLow, int nThresholdHigh, int nThresholdPitch, int nPitch, int iFram=0, BOOL bSave=FALSE);
+	BOOL				Blob_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, std::vector<CChipBlob>* vecBlobList, ChipResionType s_RegionType,DefectPosType s_DefectPos, int nMinSize, int nSideFilter, BOOL bROIOffset=TRUE);
+
+
+protected:
+	void				ReleaseBuffer();
+	void				ResetValue();
+	void				ReleaseChipBuffer();
+	BOOL				CopyBuffer(CSISBuffer &bufferOrg,COwnerBuffer &bufferTgt);
+	BOOL				PreProcessing(LPBYTE pImg,CRect &rectIns,COwnerBuffer &BufferCanny);	
+	BOOL				FindEdgeLine(LPBYTE pImg,CRect &rectIns);
+	int					FindForeCastLine(CSISBuffer &pBuffer,CRect &rectIns,int &nforecast_S,int &nforecast_E,BOOL bChamfer);
+	BOOL				Binarization(CSISBuffer &pOrg,COwnerBuffer &pBin,int nSetThres);
+	BOOL				FindAdptThres(CSISBuffer &pOrg,CSISBuffer &CannyImg,int &nSetThres,int nForecast_S,ChipThresMode emThresMode);
+	double				FindTraceLine(CSISBuffer &CannyImg,int nStart);
+	BOOL				FindRightLine(CSISBuffer &pBuffer,CRect &rtIns,double dLeftLine,double &dRightLine,int nThres);
+	BOOL				FindRightLine_Bin(CSISBuffer &pBuffer,int &nforecast_S,double &dRightLine);
+	double				GetSubPixelThick(CSISBuffer &pBuffer,int nForecast_S,double dForecast_E,int nThres,double &dLeftEdge,double &dRightEdge);	
+
+	void				VConvolutionConvC(CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,int nSetPitch,CRect &rectInsReg);
+	BOOL				VertCalPitchConv(CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectIns,CSize szConv,int nPitch,int nPitch2);
+	BOOL				FilteringEdgeBlob(std::vector<CChipBlob> &vecBlob,int nBaseLeft,int nBaseRight,int nDetMargin,int nImgBurrMargin);
+	BOOL				InsertEdgeBlobToDefect(std::vector<CChipBlob> &vecBlob);
+
+	void				VConvolutionConvC_Com(COwnerBuffer &pRes,CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,int nSetPitch,CRect &rectInsReg);
+	BOOL				VertCalPitchConv_Com(COwnerBuffer &pRes,CSISBuffer &pImg,int nThres,ChipResionType s_RegionType,DefectPosType s_DefectPos,CRect &rectIns,CSize szConv,int nPitch,int nPitch2);
+
+// Corner Chip
+public:
+	BOOL				ChipInspection_Corner(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID,int iScan, int iThread,int iFrame,CSISBuffer &ChipBuffer,int nChipThres,int nChipInsWidth,int nEdgeRight, double dGradient, double dIntercept, int nDetMargin = 1, int nMargin = 2, int nMarginY = 2);
+	void				SetCutAreaExpPos(int nSide,int nPosY, int nSize, int nERType, int nPosX, int nSizeX);
+	void				GetCutAreaExpPos(CRect rectInsOrg,int nEdgeLeft, int nGlassStartLine,CRect &rectExpRegion, int nChipInsWidth, double dFindLeft);
+	ChipErrCode			Inspection_OnlyChip(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID, int iScan,int iFrame, int nIndex
+											,CRect &rectIns,CSISBuffer &ChipBuffer,int nChipInsWidth,int nChipThres, int nChipThres_L,BOOL bChipIns, int nDetMargin, double dLeftThres, CRect rectInsOrg
+											,int nGlassStartLine,int nGlassEndLine, int nFrameHeight,int nCPosXOffset, int nDPosXOffset, int nCPosYOffsetStart, int nCPosYOffsetEnd, int nDPosYOffsetStart
+											, int nDPosYOffsetEnd, int nChippingInsOffset, double dFindLeft, int nAirThres);
+protected:
+	void				VConvolutionConvC_Polygon(CSISBuffer &pSaveImg,BOOL bSaveImage,int nCamID,int iScan,int iFrame,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,int nSetPitch, double dGradient, double dIntercept, int nDetMargin, double dLeft, int nOffset, int nOffsetY);
+	BOOL				BlobDefect_Pixel_TypeRegionFilter(std::vector<CChipBlob> &vecBlob,std::vector<CChipPair> &vecPair,int nChipThres,int nMergeDist=2);
+	BOOL				FilteringDiagonalEdgeBlob(std::vector<CChipBlob> &vecBlob);
+	BOOL				OnlyChipInspection(int nMergeRange,BOOL bSaveImage,CString strHpanelID, int nCamID, int iScan,int iFrame, int nIndex,CSISBuffer &ChipBuffer
+											,int nChipThres, int nChipThres_L,int nChipInsWidth,int nEdgeLeft,int nEdgeRight, CRect rectInsOrg, int nGlassStartLine
+											,int nGlassEndLine, int nFrameHeight, int nCPosXOffset, int nDPosXOffset, int nCPosYOffsetStart, int nCPosYOffsetEnd, int nDPosYOffsetStart, int nDPosYOffsetEnd, int nDetMargin = 1, int nChippingInsOffset = 0 ,double dFindLeft=0,int nAirThres = 200);
+	void				BinalizeFind_CornerChip(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch,CRect rectExpRegion,int iFrame=0, int nIndex=0, int nCamID=0, int iScan=0, int nChippingInsOffset=0);
+	void				BinalizeFind_CornerChip_White(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch, CRect rectInsOrg,int nGlassStartLine,int nGlassEndLine, int nFrameHeight,int nCPosXOffset, int nDPosXOffset, int	nCPosYOffsetStart, int nCPosYOffsetEnd, int nDPosYOffsetStart, int nDPosYOffsetEnd, CRect rectExpRegion, int iFrame, int nIndex, int nCamID, int iScan);
+	BOOL				FilteringEdgeBlob_TypeFilter(std::vector<CChipBlob> &vecBlob,ChipResionType emSide,int nBaseLine,int nDetMargin);
+	void				VConvolutionConvC_CornerChip(CSISBuffer &pSaveImg,BOOL bSaveImage,CString strHpanelID, CSISBuffer &pImg,int nThres,std::vector<CChipPair> &vecPair,ChipResionType s_RegionType,int nSetPitch,int iFrame=0, int nIndex=0, int nCamID=0, int iScan=0);
+
+// General
+public:
+	void				ResetPairDefect(){m_nChipPairIndex=0;}
+	int					GetPairDefectCount(){return m_nChipPairIndex;}
+	CChipPair			*GetPairDefect(int iIndex);	
+	BOOL				BlobDefect_Pixel(std::vector<CChipBlob> &vecBlob,int nChipThres,int nMergeDist=2);
+	BOOL				InsertPairing(int x, int y, int sub, int threshold, int graySrc, int grayRef,ChipResionType s_RegionType,DefectPosType s_DefectPos, BOOL bEdgeDefect = FALSE, double dThick=0.);		
+	void				SetConvResolution(double dRes){m_dConvResolution=dRes;}
+	void				ResetSaveIndex(){m_nSaveIndex = 0;}
+	BOOL				CopyRectImg(LPBYTE pOrg,LPBYTE pTgt,CSize szImg,CRect &rectIns);
+
+protected:
+	BOOL				MergeDivision(std::vector<CChipBlob> &vecBlob, int nMergePixel = 4);
+	BOOL				MergeMix(std::vector<CChipBlob> &vecBlob, int nMergePixel = 4);
+	void				CheckDefectRect(CChipBlob& Defect, int nX, int nY);
+	int					CalcRScale(CPoint* pVertex);
+	void				SetBrokenDefect(CRect rectDefect);
+	BOOL				AssertRect(CRect rect,CSize szImg);
+
+protected:
+	double				m_dConvResolution;
+	LGLASSFINDDATA		m_pGlassEdgeLine;
+	int					m_nGlassEdgeLineCnt;
+	int					*m_pCannyWidthCnt;
+	int					m_nForeEdgeLine[2];
+	double				m_dAvgThick;
+	CChipBlob			*m_DefectBlob;
+	int					m_nDefectCnt;
+	std::vector<STU_CHIPPINGINS_EXP_POS>	m_expInsArea;
+	int					m_nSaveIndex;	
+	CChipPair			*m_pChipPairBuf;
+	int					m_nChipPairIndex;
+	BOOL				*m_bMerged;
+	BOOL				*m_bTemp;
+	int					*m_lFirstIndex;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_CHAMFERINSPECT_H_INCLUDED_)
diff --git a/Lib/EdgeInspect/include/CornerCut.h b/Lib/EdgeInspect/include/CornerCut.h
new file mode 100644
index 0000000..7b89355
--- /dev/null
+++ b/Lib/EdgeInspect/include/CornerCut.h
@@ -0,0 +1,84 @@
+#pragma once
+
+enum CORNERCUR_DIR{CO_LT=0,CO_LB,CO_RT,CO_RB};
+enum ERRCODE_CORNERCUT{ERR_CO_IMAGENULL=0,ERR_CO_INSRECTNULL,ERR_CO_FINDVERT,ERR_CO_FINDHOR,ERR_CO_SUCCESS};
+
+struct sCoPoint {
+	double x, y;
+};
+
+struct sCoLine {
+	double mx, my;
+	double sx, sy;
+};
+
+using namespace std;
+
+class AFX_EXT_CLASS CCornerCut
+{
+public:
+	CCornerCut(void);
+	~CCornerCut(void);
+
+public:
+	ERRCODE_CORNERCUT	Inspection(LPBYTE pImg,CSize szImg,CRect &rectIns,int iFrame,int nLowThres,int nHighThres,CORNERCUR_DIR nDir, CString strHPanelID,BOOL bSaveImage
+									,COwnerBuffer	&pOrg,double &dResWidth,double &dResHeight);
+	void		GetData(sCoPoint *pPoint){CopyMemory(pPoint,m_nCornerPoint,sizeof(sCoPoint)*3);}
+
+protected:
+	BOOL		FindOuterLine(LPBYTE pImg,CRect rectIns,CORNERCUR_DIR nDir);
+	BOOL		FindOuterHori(LPBYTE pImg,CRect rectIns,double nYPos,double nStartX,CORNERCUR_DIR nDir);
+	BOOL		FindOuterVert(LPBYTE pImg,CRect rectIns,double nYPos,double nStartX,CORNERCUR_DIR nDir);
+	void		SaveMarkImage(LPBYTE pBuffer,CRect &rectIns);
+
+	void		AssertOnFrameRect(CRect &rect,CSize szImg=CSize(0,0));
+	float		AdaptiveThreshold(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
+	float		GetThresholdValue(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
+	BOOL		CopyEdgeImg(LPBYTE pImg,CSize szImg,CRect &rectIns);
+	void		ThresholdProcessing(LPBYTE pImg,CSize szImg,int nThres,int nDir);
+	void		ThresholdProcLowHigh(CSISBuffer &pImg,int nLowThres,int nHighThres);
+
+	BOOL		FindVerticalLine(LPBYTE pImg,CRect rectIns,int &nVertLine,CORNERCUR_DIR nDir);
+	BOOL		FindHorizontalLine(LPBYTE pImg,CRect rectIns,int &nHorLine,CORNERCUR_DIR nDir);
+	BOOL		FindCornerPoint(LPBYTE pImg,CRect rectIns,sCoPoint point,CORNERCUR_DIR nDir);
+	int			DetectLine(LPBYTE pImg,CRect rectIns,sCoPoint point,BOOL bDir,BOOL bReverse,CORNERCUR_DIR nDir,sCoPoint &pointResult);
+	void		GetRegionInfo(sCoPoint point,CORNERCUR_DIR nDir,BOOL bDir,int &nStart,int &nEnd,BOOL &bReverse,int nWidth,int nHeight);
+	int			GetHorCount(LPBYTE pImg,int v,sCoPoint point,BOOL bDir,int nWidth,int nSetCount);
+	int			GetVertCount(LPBYTE pImg,int u,sCoPoint point,BOOL bDir,int nWidth,int nHeight,int nSetCount);
+	void		CalculateLenght(double &dResWidth,double &dResHeight);
+
+	template<typename T>
+	inline void swapN(T a,T b)
+	{
+		T	c;	
+		c = a;	
+		a = b;	
+		b = c;
+	}
+
+	inline void swapLong(LONG &a,LONG &b)
+	{
+		LONG	c;	
+		c = a;	
+		a = b;	
+		b = c;
+	}
+
+protected:
+	BOOL		FindFirstPoint(CRect &rectIns);
+	double		ransac_line_fitting(sCoPoint *data, int no_data, sCoLine &model, double distance_threshold);
+	bool		find_in_samples (sCoPoint *samples, int no_samples, sCoPoint *data);
+	void		get_samples (sCoPoint *samples, int no_samples, sCoPoint *data, int no_data);
+	int			compute_model_parameter(sCoPoint samples[], int no_samples, sCoLine &model);
+	double		compute_distance(sCoLine &line, sCoPoint &x);
+	double		model_verification (sCoPoint *inliers, int *no_inliers, sCoLine &estimated_model, sCoPoint *data, int no_data, double distance_threshold);
+	BOOL		LineInterSection(CPoint p1,CPoint p2,CPoint p3,CPoint p4,double &dInterX,double &dInterY);
+	void		bresenham_Line(COwnerBuffer *pRes,CPoint posStart,CPoint posEnd,BYTE color);
+	
+protected:	
+	LPBYTE		m_pInsImg;
+
+	sCoPoint		m_nCornerPoint[3];
+	sCoPoint		*m_pOuterLineH,*m_pOuterLineV;
+	int			m_nOuterCountH,m_nOuterCountV;
+};
diff --git a/Lib/EdgeInspect/include/EDGE_DIPM.h b/Lib/EdgeInspect/include/EDGE_DIPM.h
new file mode 100644
index 0000000..b28a7b4
--- /dev/null
+++ b/Lib/EdgeInspect/include/EDGE_DIPM.h
@@ -0,0 +1,437 @@
+//==================================================================================
+// DIPM.h : Declaration of DIPM
+//==================================================================================
+
+#ifndef __EDGE_DIPM__
+#define __EDGE_DIPM__
+
+//#include "stdafx.h"
+#include "cv.h"
+#include "highgui.h"
+#include "opencv.hpp"
+#include "core.hpp"
+#include <math.h>
+#include <map>
+#include <list>
+#include <vector>
+
+//Define DLL IM/EXPORTs
+
+#ifndef DLLEXPORT
+#define DLLEXPORT		__declspec(dllexport)
+#endif
+
+#ifndef DLLIMPORT
+#define DLLIMPORT		__declspec(dllimport)
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////
+// MACRO definitions
+
+#define align_4byte(in) ((in + 3)/4)*4
+
+// Memory allocation MACRO for compatible with windows SDK
+#define memalloc(flags, cb)		(GlobalLock(GlobalAlloc((flags),(cb))))
+#define memfree(lp)	\
+		(GlobalUnlock((HGLOBAL)GlobalHandle(lp)),(BOOL)GlobalFree((HGLOBAL)GlobalHandle(lp)))
+
+////////////////////////////////////////////////////////////////////////////////////
+// Constant definitions
+
+#define ROUND(a)				(a+0.5)
+#define FLOOR(a)				(a)
+
+// Numerical MACRO's
+#define	M_PI					acos(-1.0)
+#define M_RADIAN(x)				(((M_PI)*(x))/180.0)
+#define M_DEGREE(x)				(((180.0)*(x))/M_PI)
+
+#ifndef RANGEIN
+#define RANGEIN(a, r1, r2)		(((a>=r1)&&(a<=r2)) ? (1) : (0))
+#endif
+
+// Logical MACRO's
+#define MINIMUM(a, b)			((a)<(b) ? (a) : (b))
+#define MAXIMUM(a, b)			((a)>(b) ? (a) : (b))
+#define MIDDLE(a, b, c)			(((a>b)&&(a<c)) ? (1) : (0))
+
+enum	enGradientMask{GM_Sobel, GM_Prewitt, GM_Roberts};
+
+struct sPoint {
+	double x, y;
+};
+
+struct sLine {
+	double mx, my;
+	double sx, sy;
+};
+
+typedef struct rtiTEMP_RESULT
+{
+	float		 fRat;
+	CvPoint2D32f pt;
+}TEMP_RESULT;
+
+typedef  struct _rtiTEMP_MATCH_DATA
+{
+	double dMaxRate;
+	double dMinRate;
+	double dPt_X;
+	double dPt_Y;
+
+	_rtiTEMP_MATCH_DATA(void)
+	{
+		dMaxRate = 0.0;
+		dMinRate = 0.0;
+		dPt_X = 0.0;
+		dPt_Y = 0.0;
+	}
+}TEMP_MATCH_DATA;
+
+enum ChipPair	{CHIPDEFPAIR_NOTDEFINE = 0, CHIPDEFPAIR_PPAIR, CHIPDEFPAIR_MPAIR, CHIPDEFPAIR_SIDE, CHIPDEFPAIR_LARGE, CHIPDEFPAIR_UNPAIR };
+enum ChipType	{CHIPDEFTYPE_BLACK = 0, CHIPDEFTYPE_WHITE, CHIPDEFTYPE_MIXED, CHIPDEFTYPE_NODEFECT, CHIPDEFTYPE_DELETE};
+enum ChipResionType	{CHIPREGTYPE_LEFT = 0, CHIPREGTYPE_RIGHT, CHIPREGTYPE_RIGHT_WHITE, CHIPREGTYPE_NONE};
+enum DefectPosType	{INS_DEFECT_CHIP = 0, INS_DEFECT_BURR, INS_DEFECT_CRACK, INS_DEFECT_BROKEN,INS_DEFECT_NONE};
+enum ChipPosType	{CHIPPOSTYPE_BIN = 0, CHIPPOSTYPE_CEN, CHIPPOSTYPE_SP,CHIPPOSTYPE_NONE};
+
+// Directional information
+#define IM_NEGATIVE				101
+#define IM_POSITIVE				102
+#define IM_HORIZONTAL			103
+#define IM_VERTICAL				104
+#define IM_LEFT					105
+#define IM_RIGHT				106
+
+//Gray level
+#define IM_BLACK				0
+#define IM_WHITE				255
+
+//Image
+#ifndef _IMAGE_
+#define _IMAGE_
+typedef struct ImImage {
+	unsigned char	*buf;
+	int	cu;
+	int	cv;
+} IMAGE;
+#endif
+
+//Position in 2D
+#ifndef _IMPOS2D_
+#define _IMPOS2D_
+typedef struct ImPos2D {
+	double		u;
+	double		v;
+} IMPOS2D;
+#endif
+
+//Region of interest (ROI)
+#ifndef _ROI_
+#define _ROI_
+typedef struct ImRoi {
+	int	u1;
+	int	v1;
+	int	u2;
+	int	v2;
+} ROI, *LPROI;
+#endif
+
+class CChipBlob
+{
+public:	
+	ChipResionType	s_RegionType;
+	ChipPair	s_DefectPair;
+	ChipType	s_DefectType;
+	ChipPosType	s_DefectPosType;
+	DefectPosType s_DefectJudgeType;
+	int			s_nIndex;
+	int			s_nDefectArea;
+	int			s_nDefectX;
+	int			s_nDefectY;
+	int			s_xLevelSrcMax;
+	int			s_yLevelSrcMax;
+	int			s_nDefectRScale;
+	CRect		s_DefectRect;
+	short		s_sDefectPeak;
+
+	short		s_sLevelSrcMin;
+	short		s_sLevelSrcMax;
+	short		s_sLevelSrcAvg;
+	short		s_sLevelRefMin;
+	short		s_sLevelRefMax;
+	short		s_sLevelRefAvg;
+	short		s_sLevelDiffMin;
+	short		s_sLevelDiffMax;
+	short		s_sLevelDiffAvg;
+	int			s_nLevelSrcSum;
+	int			s_nLevelRefSum;
+	int			s_nLevelDiffSum;
+	short		s_sThreshold;	
+	BOOL		s_bRemoved;
+	double		s_dThick;
+	BOOL		s_bCornerChip;
+
+	CPoint		s_ptVertex[8];
+
+	CChipBlob()
+	{
+		Reset();
+	}
+	void Reset()
+	{		
+		s_RegionType		= CHIPREGTYPE_NONE;
+		s_DefectPair		= CHIPDEFPAIR_NOTDEFINE;
+		s_DefectType		= CHIPDEFTYPE_NODEFECT;
+		s_DefectJudgeType   = INS_DEFECT_NONE;
+		s_nIndex			= 0;
+		s_nDefectArea		= 0;
+		s_nDefectX			= 0;
+		s_nDefectY			= 0;
+		s_nDefectRScale		= 0;
+		// 20080525 捞霖锐
+		s_DefectRect.SetRect(INT_MAX, INT_MAX, 0, 0);
+		s_sDefectPeak		= 0;
+
+		s_sLevelSrcMin		= 2048;
+		s_sLevelSrcMax		= 0;
+		s_xLevelSrcMax		= 0;
+		s_yLevelSrcMax		= 0;
+		s_sLevelSrcAvg		= 0;
+		s_sLevelRefMin		= 2048;
+		s_sLevelRefMax		= 0;
+		s_sLevelRefAvg		= 0;
+		s_sLevelDiffMin		= 2048;
+		s_sLevelDiffMax		= 0;
+		s_sLevelDiffAvg		= 0;
+		s_nLevelSrcSum		= 0;	
+		s_nLevelRefSum		= 0;
+		s_nLevelDiffSum		= 0;
+
+		s_sThreshold		= 0;
+		s_dThick			= 0.;
+		s_bCornerChip		= FALSE;
+
+		// 20080525 捞霖锐
+		s_ptVertex[0]		= MAKELONG(32760, 32760);
+		s_ptVertex[1]		= MAKELONG(32760, 0);
+		s_ptVertex[2]		= MAKELONG(32760, 32760);
+		s_ptVertex[3]		= MAKELONG(0, 32760);
+		s_ptVertex[4]		= MAKELONG(0, 32760);
+		s_ptVertex[5]		= MAKELONG(0, 0);
+		s_ptVertex[6]		= MAKELONG(32760, 0);
+		s_ptVertex[7]		= MAKELONG(0, 0);
+
+		s_bRemoved			= FALSE;
+	}
+
+	void SetDefectPair(ChipPair DP)
+	{
+		if (s_DefectPair < DP)
+			s_DefectPair = DP;
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+	CChipBlob& operator=(const CChipBlob& rhs)
+	{
+		if(this != &rhs)
+		{			
+			s_RegionType		= rhs.s_RegionType;
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_DefectJudgeType	= rhs.s_DefectJudgeType;
+			s_nIndex			= rhs.s_nIndex;
+			s_nDefectArea		= rhs.s_nDefectArea;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nDefectRScale		= rhs.s_nDefectRScale;
+			s_DefectRect		= rhs.s_DefectRect;
+			s_sDefectPeak		= rhs.s_sDefectPeak;
+
+			s_sLevelSrcMin		= rhs.s_sLevelSrcMin;
+			s_sLevelSrcMax		= rhs.s_sLevelSrcMax;
+			s_xLevelSrcMax		= rhs.s_xLevelSrcMax;
+			s_yLevelSrcMax		= rhs.s_yLevelSrcMax;
+			s_sLevelSrcAvg		= rhs.s_sLevelSrcAvg;
+			s_sLevelRefMin		= rhs.s_sLevelRefMin;
+			s_sLevelRefMax		= rhs.s_sLevelRefMax;
+			s_sLevelRefAvg		= rhs.s_sLevelRefAvg;
+			s_sLevelDiffMin		= rhs.s_sLevelDiffMin;
+			s_sLevelDiffMax		= rhs.s_sLevelDiffMax;
+			s_sLevelDiffAvg		= rhs.s_sLevelDiffAvg;
+			s_nLevelSrcSum		= rhs.s_nLevelSrcSum;
+			s_nLevelRefSum		= rhs.s_nLevelRefSum;
+			s_nLevelDiffSum		= rhs.s_nLevelDiffSum;
+
+			s_sThreshold		= rhs.s_sThreshold;
+			s_dThick			= rhs.s_dThick;
+			s_bCornerChip		= rhs.s_bCornerChip;
+
+			int i;
+			for(i= 0; i< 8; i++)
+			{
+				s_ptVertex[i]= rhs.s_ptVertex[i];
+			}		
+			s_bRemoved			= rhs.s_bRemoved;
+		}
+		return *this;
+	}
+
+	// + 楷魂磊 坷滚肺爹.
+	CChipBlob operator+(const CChipBlob& rhs)
+	{
+		if (s_DefectPair < rhs.s_DefectPair)
+			s_DefectPair = rhs.s_DefectPair;
+
+		s_nDefectArea += rhs.s_nDefectArea;
+
+		if (s_ptVertex[0].x >= rhs.s_ptVertex[0].x)	// LT
+			s_ptVertex[0] = rhs.s_ptVertex[0];
+		if (s_ptVertex[1].x >= rhs.s_ptVertex[1].x)	// LB
+			s_ptVertex[1] = rhs.s_ptVertex[1];
+		if (s_ptVertex[2].y >= rhs.s_ptVertex[2].y)	// TL
+			s_ptVertex[2] = rhs.s_ptVertex[2];
+		if (s_ptVertex[3].y >= rhs.s_ptVertex[3].y)	// TR
+			s_ptVertex[3] = rhs.s_ptVertex[3];
+		if (s_ptVertex[4].x <= rhs.s_ptVertex[4].x)	// RT
+			s_ptVertex[4] = rhs.s_ptVertex[4];
+		if (s_ptVertex[5].x <= rhs.s_ptVertex[5].x)	// RB
+			s_ptVertex[5] = rhs.s_ptVertex[5];
+		if (s_ptVertex[6].y <= rhs.s_ptVertex[6].y)	// BL
+			s_ptVertex[6] = rhs.s_ptVertex[6];
+		if (s_ptVertex[7].y <= rhs.s_ptVertex[7].y)	// BR
+			s_ptVertex[7] = rhs.s_ptVertex[7];
+
+		s_nDefectRScale = (s_nDefectRScale + rhs.s_nDefectRScale);
+		if (s_DefectRect.left > rhs.s_DefectRect.left)
+			s_DefectRect.left = rhs.s_DefectRect.left;
+		if (s_DefectRect.top > rhs.s_DefectRect.top)
+			s_DefectRect.top = rhs.s_DefectRect.top;
+		if (s_DefectRect.right < rhs.s_DefectRect.right)
+			s_DefectRect.right = rhs.s_DefectRect.right;
+		if (s_DefectRect.bottom < rhs.s_DefectRect.bottom)
+			s_DefectRect.bottom = rhs.s_DefectRect.bottom;
+		if (s_sDefectPeak < rhs.s_sDefectPeak)
+			s_sDefectPeak		= rhs.s_sDefectPeak;
+
+		s_nDefectX = (s_DefectRect.right + s_DefectRect.left) / 2;
+		s_nDefectY = (s_DefectRect.bottom + s_DefectRect.top) / 2;
+
+		if (s_sLevelSrcMin > rhs.s_sLevelSrcMin)
+			s_sLevelSrcMin		= rhs.s_sLevelSrcMin;
+		if (s_sLevelSrcMax < rhs.s_sLevelSrcMax)
+		{
+			s_sLevelSrcMax		= rhs.s_sLevelSrcMax;
+			s_xLevelSrcMax		= rhs.s_xLevelSrcMax;
+			s_yLevelSrcMax		= rhs.s_yLevelSrcMax;
+		}
+		s_sLevelSrcAvg			= (s_sLevelSrcAvg + rhs.s_sLevelSrcAvg) / 2;
+		if (s_sLevelRefMin > rhs.s_sLevelRefMin)
+			s_sLevelRefMin		= rhs.s_sLevelRefMin;
+		if (s_sLevelRefMax < rhs.s_sLevelRefMax)
+			s_sLevelRefMax		= rhs.s_sLevelRefMax;
+		s_sLevelRefAvg			= (s_sLevelRefAvg + rhs.s_sLevelRefAvg) / 2;
+		if (s_sLevelDiffMin > rhs.s_sLevelDiffMin)
+			s_sLevelDiffMin		= rhs.s_sLevelDiffMin;
+		if (s_sLevelDiffMax < rhs.s_sLevelDiffMax)
+			s_sLevelDiffMax		= rhs.s_sLevelDiffMax;
+		s_sLevelDiffAvg			= (s_sLevelDiffAvg + rhs.s_sLevelDiffAvg) / 2;
+		s_nLevelSrcSum		+= rhs.s_nLevelSrcSum;
+		s_nLevelRefSum		+= rhs.s_nLevelRefSum;
+		s_nLevelDiffSum		+= rhs.s_nLevelDiffSum;
+
+		if (s_sThreshold < rhs.s_sThreshold)
+			s_sThreshold		= rhs.s_sThreshold;
+
+		if(s_dThick < rhs.s_dThick)
+			s_dThick = rhs.s_dThick;
+
+		s_bCornerChip			|= rhs.s_bCornerChip;
+
+		return *this;
+	}
+
+};
+
+class CChipPair
+{
+public:		
+	ChipPair	s_DefectPair;
+	ChipType	s_DefectType;
+	ChipResionType	s_RegionType;
+	DefectPosType	s_DefectPosType;
+	float		s_fDefectPeak;
+	int			s_nDefectX;
+	int			s_nDefectY;
+	int			s_nGraySrc;
+	int			s_nGrayRef;	
+	double		s_dThick;
+	BOOL		s_bCornerChip;
+
+	CChipPair()
+	{
+		Reset();
+	}
+	void Reset()
+	{		
+		s_DefectPair = CHIPDEFPAIR_NOTDEFINE;
+		s_DefectType = CHIPDEFTYPE_NODEFECT;
+		s_RegionType = CHIPREGTYPE_NONE;
+		s_DefectPosType = INS_DEFECT_NONE;
+		s_fDefectPeak = 0.0;
+		s_nDefectX = 0;
+		s_nDefectY = 0;
+		s_nGraySrc = 0;
+		s_nGrayRef = 0;
+		s_dThick = 0.;
+		s_bCornerChip = FALSE;
+	}
+	void SetPeak(int nPeak, int nKernelThres, int nCalcPixel)
+	{
+		s_fDefectPeak= static_cast<float>(abs(nPeak));
+		s_fDefectPeak -= static_cast<float>(nKernelThres);
+		s_fDefectPeak /= static_cast<float>(nCalcPixel);
+	}
+
+	// 汗荤 积己磊.
+	CChipPair(const CChipPair& rhs)
+	{
+		if(this != &rhs)
+		{		
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_fDefectPeak		= rhs.s_fDefectPeak;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nGraySrc			= rhs.s_nGraySrc;
+			s_nGrayRef			= rhs.s_nGrayRef;	
+			s_RegionType		= rhs.s_RegionType;	
+			s_dThick			= rhs.s_dThick;	
+			s_bCornerChip		= rhs.s_bCornerChip;
+			s_DefectPosType		= rhs.s_DefectPosType;
+		}
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+	CChipPair& operator=(const CChipPair& rhs)
+	{
+		if(this != &rhs)
+		{		
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_fDefectPeak		= rhs.s_fDefectPeak;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nGraySrc			= rhs.s_nGraySrc;
+			s_nGrayRef			= rhs.s_nGrayRef;
+			s_RegionType		= rhs.s_RegionType;	
+			s_dThick			= rhs.s_dThick;
+			s_bCornerChip		= rhs.s_bCornerChip;
+		}
+		return *this;
+	}
+};
+
+#endif
+
+// End of FV_DIPM.h
+////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/Lib/EdgeInspect/include/EdgeFind.h b/Lib/EdgeInspect/include/EdgeFind.h
new file mode 100644
index 0000000..4399b10
--- /dev/null
+++ b/Lib/EdgeInspect/include/EdgeFind.h
@@ -0,0 +1,211 @@
+// EdgeFind.h: interface for the CEdgeFind class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_EDGEFIND_H__390230EE_3748_47C9_B543_04276FAFACA4__INCLUDED_)
+#define AFX_EDGEFIND_H__390230EE_3748_47C9_B543_04276FAFACA4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "EDGE_DIPM.h"
+
+class CSISBuffer;
+class CEdgeProc;
+
+enum	EDGELINE_DIR{DIR_HORIZONTAL=0,DIR_VERTICAL};
+enum	EDGELINE_POLAR{POLAR_WTOB=0,POLAR_BTOW,POLAR_ANY};
+enum	enEdgeFindType{EDGE_MAXCONTRAST=0,EDGE_FIRSTEDGE,EDGE_PROJECTION,EDGE_NONE};
+enum	EdgeSearchType		{ SearchTypeMinMax, SearchTypeOut2In, SearchTypeIn2Out };
+enum	EdgeSignalType		{ EdgeTypeNegative=0, EdgeTypePositive, EdgeTypeNone };
+enum	EdgeResultType		{ EdgeResultMid=0, EdgeResultLeft, EdgeResultRight,  };
+enum	SubPixelType		{ SubPixelLinear=0, SubPixelQuadratic, SubPixelRegression };
+enum	PreProcessType		{ PreProcNone=0, PreProcSobel };
+enum    TriangleResult		{	ImageFailModel=-1, ImageFailSource=-2, ImageFailSub=-3, ImageFailBandModel=-4, ImageFailBandSource=-5,
+								RecipeFailModel=-6, RecipeFailMarker=-7, RecipeFailFormula=-8, 
+								ProcessFailModel=-9, ProcessFailMarker=-10, ProcessFailFormula=-11, 
+								ResultFailModel=-12, ResultFailMarker=-13, ResultFailFormula=-14, 
+								EdgeFailLeft=-15, EdgeFailRight=-16, PreProcessFail=-17,
+								ProcessSuccess=1, ProcessNone=0 };
+
+//Projection data
+#ifndef _IMPROJ_
+#define _IMPROJ_
+enum	PROJECTION_TYPE{PROJECTION_VERTICAL=0,PROJECTION_HORIZONTAL};
+typedef struct ImProj{
+	int		x;
+	int		f;
+} IMPROJ, *LPIMPROJ;
+#endif
+
+class CPolynomial
+{
+public:
+	CPolynomial()		{ Reset(); }
+	CPolynomial(int degree, double coef)
+	{
+		nDegree = degree;
+		dCoef	= coef;
+	}
+	~CPolynomial()		{ Reset(); }
+	void Reset()
+	{
+		nDegree = 0;
+		dCoef	= 0.0;
+	}
+	int		nDegree;
+	double	dCoef;
+};
+
+typedef std::list<CPolynomial*>				ListPolynomial;
+typedef std::list<CPolynomial*>::iterator	ListPolynomialIt;
+
+typedef std::vector<double>					VectorDouble;
+typedef std::vector<double>::iterator		VectorDoubleIt;
+
+typedef std::vector<int>					VectorInteger;
+typedef std::vector<int>::iterator			VectorIntegerIt;
+
+class AFX_EXT_CLASS CEdgeResult
+{
+public:
+	CEdgeResult()		{ Reset(); }
+
+	CEdgeResult(int indexValue, int signalValue, int positionValue, double edgeValue)
+	{
+
+		nIndex			= indexValue;
+		nSignal			= signalValue;
+		nEdgePosition	= positionValue;
+		dEdgeValue		= edgeValue;
+
+		nEdgeType		= EdgeResultMid;
+		dPosition		= 0.0;
+		dStrength		= 0.0;
+
+		nLeftPosition	= positionValue;
+		nRightPosition	= positionValue;
+	}
+
+	CEdgeResult(int indexValue, int signalValue, double positionValue, double strengthValue)
+	{
+
+		nIndex		= indexValue;
+		nSignal		= signalValue;
+		dPosition	= positionValue;
+		dStrength	= strengthValue;
+
+		nEdgeType		= EdgeResultMid;
+		nLeftPosition	= 0;
+		nRightPosition	= 0;
+	}
+
+	~CEdgeResult()	{ Reset(); }
+
+	void Reset()
+	{
+		nEdgeType		= EdgeResultMid;
+		nIndex			= -1;
+		nSignal			= EdgeTypeNone;
+		nEdgePosition	= 0;
+		dEdgeValue		= 0.0;
+		dPosition		= 0.0;
+		dStrength		= 0.0;
+
+		nLeftPosition	= 0;
+		nRightPosition	= 0;
+	}
+
+	int		nEdgeType;
+	int		nIndex;
+	int		nSignal;
+	int		nEdgePosition;
+	double	dEdgeValue;
+
+	int		nLeftPosition;
+	int		nRightPosition;
+
+	double	dPosition;
+	double	dStrength;
+};
+typedef std::vector<CEdgeResult>			VectorEdgeResult;
+typedef std::vector<CEdgeResult>::iterator	VectorEdgeResultIt;
+
+class AFX_EXT_CLASS CEdgeFind
+{
+	CSISBuffer		*m_Buffer;
+	LPIMPROJ			m_pHproj;	
+	LPIMPROJ			m_pVproj;
+	VectorDouble		m_vectorEdgeData;
+	VectorInteger		m_vectorEdgeType;
+	VectorDouble		m_vectorImageData;	
+	VectorEdgeResult	m_vectorEdgeResult;
+
+public:
+	CEdgeFind();
+	virtual ~CEdgeFind();
+
+public:
+	int Find_LeftEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+	int Find_RightEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+
+public:
+	int	Find_LeftCanny(CSISBuffer *pBuffer,int nThres);
+	double FindLine_H(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,EDGELINE_POLAR enDir,EdgeSignalType enSignalType,enEdgeFindType enFind);
+	double FindLine_V(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,EDGELINE_POLAR enDir,EdgeSignalType enSignalType,enEdgeFindType enFind,BOOL bTop);
+	double FindGlassHorizontalLine(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,BOOL bDir, int nDist = 20);	
+	double FindGlassVerticalLine(LPBYTE pImg,CSize szImg,CRect &rectIns,int nThres,BOOL bDir,int nDist = 10);
+	double FindLineSubPixel(LPBYTE pImg,CSize szImg,CRect &rectIns,int nPosiThres,int nNegaThres,EDGELINE_DIR enDir,EdgeSearchType enSearchType,EdgeSignalType enSignalType,int nKernelSize=2);
+
+protected:
+	void AssertOnFrameRect(CRect &rect,CSize szImg=CSize(0,0));
+	BOOL FV_ProjGet(LPBYTE src,CSize szImg, CRect &rect, PROJECTION_TYPE type, IMPROJ* res, ULONG* max, ULONG* min);	
+	int	 FindMaxContrastEx(IMPROJ* src, int nStart,int nEnd, long Width, long Height, EDGELINE_POLAR enDir, long Thresh,BOOL bForward=TRUE);
+	int	 FindFirstEdge(IMPROJ* src, int nStart,int nEnd, long Width, long Height, EDGELINE_POLAR enDir, long Thresh,BOOL bForward=TRUE);	
+	int	 FindMaxContrast(CSISBuffer &bufferOrg,CRect rect,BOOL bHor,int &nMaxDiff,BOOL bForward=TRUE);		
+	BOOL QuadraticRegression(VectorDouble& vectorX, VectorDouble& vectorY, double& a0, double& a1, double& a2);
+	bool parabolicInterpolate(double hm, double h0, double hp, double *c);
+	BOOL FindGlssEdgeLine(int &nPos,CRect rect,LPIMPROJ pProj,BOOL bDir,PROJECTION_TYPE nType,int nThres,int nContiValue,int nDist);
+
+protected:
+	BOOL				CalculateInterpolateLinear(CEdgeResult& edgeResult, double dEdgeThreshold);
+	BOOL				CalculateInterpolateQuadratic(CEdgeResult& edgeResult);
+	BOOL				CalculateInterpolateRegression(CEdgeResult& edgeResult);
+	void				CalculateEdgePosition(int nSubPixelType, double dPosiThres, double dNegaThres);
+	BOOL				CalculateImageValue(EDGELINE_DIR nDirection, BYTE *pImage, int nWidth, int nHeight, CRect &rect,int nStep, VectorDouble& vectorImageData);
+	BOOL				CalculateEdgeValue(const VectorDouble& vectorImageData, VectorDouble& vectorEdgeData, int nKernelSize);
+	BOOL				CalculateEdgeValue(const VectorDouble& vectorImageData, VectorDouble& vectorEdgeData, VectorInteger& vectorEdgeType, double dPositiveThres, double dNegativeThres, int nKernelSize);
+	BOOL				CalculateEdgeValue(EDGELINE_DIR nDirection, short *pImage, int nWidth, int nHeight, int nStep, VectorDouble& vectorEdgeData, VectorInteger& vectorEdgeType, double dPositiveThres, double dNegativeThres);
+	BOOL				GetEdgeLeftPosition(int nEdgeType, int nSearchType, int nStartPos, double& dPosition);
+	BOOL				GetEdgeRightPosition(int nEdgeType, int nSearchType, int nStartPos, double& dPosition);
+
+	double				AbsSum(double init, double x);
+	double				Sum(double init, double x);
+	static double		Square(double init, double x);
+	static double		Cubic(double init, double x);
+	static double		ForthPower(double init, double x);
+	double				Combi(VectorDouble& vectorX, VectorDouble& vectorY, int n, int r);
+	void				InsertPolynomial(ListPolynomial &listPolynomial, int degree, double coef);
+	void				RemovePolynomial(ListPolynomial& listPolynomial);
+	BOOL				CalculateLagrange(VectorDouble& vectorX, VectorDouble& vectorY, ListPolynomial& listPolynomial);
+
+	template <class T> 
+	inline void imMinMax(const T *map, int count, T& min, T& max)
+	{
+		min = *map++;
+		max = min;
+		for (int i = 1; i < count; i++)
+		{
+			T value = *map++;
+
+			if (value > max)
+				max = value;
+			else if (value < min)
+				min = value;
+		}
+	}
+};
+
+
+#endif // !defined(AFX_EDGEFIND_H__390230EE_3748_47C9_B543_04276FAFACA4__INCLUDED_)
diff --git a/Lib/EdgeInspect/include/EdgeProc.h b/Lib/EdgeInspect/include/EdgeProc.h
new file mode 100644
index 0000000..7715bc1
--- /dev/null
+++ b/Lib/EdgeInspect/include/EdgeProc.h
@@ -0,0 +1,75 @@
+// EdgeProc.h: interface for the CEdgeProc class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_EDGEPROC_H_INCLUDED_)
+#define AFX_EDGEPROC_H_INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+#include "EDGE_DIPM.h"
+#include <vector>
+
+class CSISBuffer;
+
+
+class AFX_EXT_CLASS CEdgeProc
+{
+	int		m_nGX[3][3], m_nGY[3][3];
+	BYTE	m_btBackground,m_btWhite;
+
+public:
+	CEdgeProc();
+	virtual ~CEdgeProc();
+
+public:
+	BOOL				CannyEdgeProcessing(LPBYTE pImageBuf,CRect &rectIns,enGradientMask enMask,int nThres,CSISBuffer &ptgt);	
+	float				catmullRomSpline(float x, float v0,float v1, float v2,float v3) ;	
+	void				ThresholdProcessing(LPBYTE pImg,CSize szImg,int nThres,int nDir);
+	unsigned char		OtsuoBinary(CSISBuffer &pOrg,CRect rect,int nOpt=1);
+	float				AdaptiveThreshold(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
+	BOOL				HSobelBoundary(LPBYTE lpInImg, LPBYTE lpOutImg, int nWidth, int nBufWidth, int nHeight,int nThres);
+	BOOL				VSobelBoundary(LPBYTE lpInImg, LPBYTE lpOutImg, int nWidth, int nBufWidth, int nHeight,int nThres);
+	void				LocalHistogramEqualization(BYTE *image,int width,int height,int wsize,BYTE *out);
+	void				Adaptive_Binarization(BYTE *gray,int width,int height,int datawidth,int w/*window Size=15*/,double k/*factor=0.2*/,BYTE *bimage,CRect rect);	
+	void				ThresholdByIntegralImage(BYTE *image,int width,int height,int datawidth,int wsz,BYTE *matrix);
+		
+	
+	BOOL				IMMovePoint(IMPOS2D iPos, IMPOS2D *oPos, IMPOS2D B_P);
+	BOOL				IMGetRotImg(ROI aoi, CSISBuffer Org, CSISBuffer Tgt, IMPOS2D pCen, double sinRad, double cosRad);
+	BOOL				IMRotatePoint(IMPOS2D iPos, IMPOS2D *oPos, IMPOS2D B_P, double sinRad, double cosRad);
+	BOOL				IMRotatePoint(IMPOS2D iPos, IMPOS2D *oPos, double sinRad, double cosRad);
+	int					IMROICenX(ROI roi) { return	(int)(roi.u1 + (roi.u2 - roi.u1) / 2 + 0.5); }
+	int					IMROICenY(ROI roi) { return	(int)(roi.v1 + (roi.v2 - roi.v1) / 2 + 0.5); }
+	int					IMROIWidth(ROI roi) { return	(int)(roi.u2 - roi.u1 + 1); }
+	int					IMROIHeight(ROI roi) { return	(int)(roi.v2 - roi.v1 + 1); }
+
+public:
+	BOOL				CvFindMark(CSISBuffer lpOrg,IplImage *IpMark,CRect rcIns,TEMP_RESULT &result, double  dRate);
+	TEMP_MATCH_DATA		Cv_TempleateMath(CvRect roi,IplImage* IpSrc	,IplImage* IpTem);
+
+public:
+	BOOL				RotatePoint(CPoint iPos, CPoint *oPos, CPoint B_P, double sinRad, double cosRad);
+	BOOL				RotatePoint(CPoint iPos, double &dXPos,double &dYPos, double sinRad, double cosRad);
+	BOOL				RotatePoint(CPoint iPos, double &dXPos,double &dYPos, CPoint B_P, double sinRad, double cosRad);
+	BOOL				RotatePoint(CvPoint2D32f  iPos, double &dXPos,double &dYPos, CvPoint2D32f  B_P, double sinRad, double cosRad);
+	BOOL				RotatePoint(CvPoint2D32f iPos, double &dXPos,double &dYPos, double sinRad, double cosRad);
+	BOOL				RotatePoint(CPoint iPos, CPoint *oPos, double sinRad, double cosRad);	
+	BOOL				MovePoint(CPoint iPos, CPoint *oPos, CPoint B_P);
+	double				GetTheta(sPoint *pLinedata,int nLineCnt,int nRange=20);
+
+protected:
+	int					MaximizeDiscriminantFunction(double * p);
+	void				imCalcHistogram(LPBYTE pOrg, int nWidth,int nHeight, unsigned long* histo, int cumulative,CRect rect);	
+	float				GetThresholdValue(BYTE* pImageData, int nWidth, int nHeight, int nStep, int nThresValue);
+	void				MakeIntegralImage(BYTE *image,int width,int height,int datawidth,int *intImage);	
+
+protected:
+	int					m_subthick;			// sub-thickness
+};
+
+
+#endif // !defined(AFX_EDGEPROC_H_INCLUDED_)
diff --git a/Lib/EdgeInspect/include/NotchCut.h b/Lib/EdgeInspect/include/NotchCut.h
new file mode 100644
index 0000000..b284864
--- /dev/null
+++ b/Lib/EdgeInspect/include/NotchCut.h
@@ -0,0 +1,276 @@
+#pragma once
+
+#include <map>
+#include <list>
+#include <vector>
+#include "SplineInspect.h"
+#include "ChamferInspect.h"
+#include "EDGE_DIPM.h"
+
+using namespace std;
+
+enum	EM_NOTCH_MSG_ERR{ERR_NO_MASTERIMG=0,ERR_NO_ORGIMG,ERR_FIND_POS,NORMAL_EXE};
+
+typedef struct  _NOTCH_Parm_STU
+{
+	BOOL		bChipIns;
+	BOOL		bSizeIns;
+	int			nChipDiff;	
+	int			nSizeDiff;
+	int			nDetThres;	
+	int			nEdgeThres;
+	int			nSizeThres;
+	int			nChipThres;
+	int			nSkipSize;
+	double		dBlank2EdgeRatio;
+	BOOL		bSplineChip[2];	
+	int			nSpInsSize[2];	
+	int			nChamferSize;
+	int			nChamferDiff;
+	int			nNoDetSkipSize;
+	int			nDetSkipSize;
+	double		dCamRes;
+	int			nPointInsAveCount;
+
+	_NOTCH_Parm_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bChipIns = bSizeIns = bSplineChip[0] = bSplineChip[1] = FALSE;
+		nChipDiff = nDetThres = nEdgeThres = nChipThres = nSkipSize = 0;
+		nSpInsSize[0] = nSpInsSize[1] = nSizeDiff = nChamferSize = nChamferDiff = nNoDetSkipSize = nDetSkipSize = 0;
+		dCamRes = dBlank2EdgeRatio = 0.;
+		nPointInsAveCount = 5;
+	}
+}NOTCH_Parm_STU;
+
+typedef struct  _NOTCH_Master_STU
+{
+	BOOL			bLoad;
+	COwnerBuffer	imgBuf;
+	int				nPosX;
+	int				nPosY;	
+	int				nMaxX;
+	int				nMaxY;
+
+	_NOTCH_Master_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		bLoad = FALSE;
+		imgBuf.ReleaseSpace();		
+		nPosX = nPosY = nMaxX = nMaxY = 0;
+	}		
+}NOTCH_Master_STU;
+
+typedef struct  _PointD
+{
+	double		X,Y;
+
+	_PointD()
+	{
+		Reset();
+	}
+	_PointD(double dX,double dY)
+	{
+		X = dX;
+		Y = dY;
+	}
+	void Reset()
+	{
+		X = Y = 0.;
+	}		
+}PointD;
+
+typedef struct  _NOTCH_ObjFind_STU
+{
+	double		dMatPosX;
+	double		dMatPosY;
+	int			nEdgeTop;
+	int			nEdgeBot;
+
+	_NOTCH_ObjFind_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		dMatPosX = dMatPosY = 0.;
+		nEdgeTop = nEdgeBot = 0;
+	}
+}NOTCH_ObjFind_STU;
+
+typedef struct  _NOTCH_Merge_STU
+{
+	int			nStart;
+	int			nEnd;
+	int			nSize;
+
+	_NOTCH_Merge_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		nStart = nEnd = -1;
+		nSize = 0;
+	}
+}NOTCH_Merge_STU;
+
+typedef struct  _NOTCH_Circle_STU
+{
+	PointD		pointF;
+	PointD		pointS;
+
+	_NOTCH_Circle_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		pointF = pointS = PointD(0,0);
+	}
+}NOTCH_Circle_STU;
+
+typedef struct  _NOTCH_RangePos_STU
+{
+	CPoint		pointCAD;
+	CPoint		pointImg;
+	double		dDist;
+	int			nInsCount;//20140528
+
+	_NOTCH_RangePos_STU()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		pointCAD = pointImg = CPoint(0,0);
+		dDist = 0.;
+		nInsCount = 0;//20140528
+	}
+}NOTCH_RangePos_STU,*pNOTCH_RangePos_STU;
+
+struct SortYPos : public std::binary_function<pair<int,CPoint>, pair<int,CPoint>, bool>
+{
+	bool operator()(const pair<int,CPoint> & lhs, const pair<int,CPoint> & rhs)
+	{
+		return lhs.second.y > rhs.second.y;
+	}
+};
+struct ResSortYPos : public std::binary_function<pair<int,CPoint>, pair<int,CPoint>, bool>
+{
+	bool operator()(const pair<int,CPoint> & lhs, const pair<int,CPoint> & rhs)
+	{
+		return lhs.second.y < rhs.second.y;
+	}
+};
+struct SortSPYPos : public std::binary_function<pair<int,CSplinePoint>, pair<int,CSplinePoint>, bool>
+{
+	bool operator()(const pair<int,CSplinePoint> & lhs, const pair<int,CSplinePoint> & rhs)
+	{
+		return lhs.second.rotate.y < rhs.second.rotate.y;
+	}
+};
+#define MAX_NOTCH_SCAN_COUNT 4
+#define MAX_NOTCH_DEFECT_COUNT	1000
+
+class CSISBuffer;
+
+class AFX_EXT_CLASS CNotchCut
+{
+public:
+	CNotchCut(void);	
+	virtual ~CNotchCut(void);
+
+public:
+	void		Reset();
+	BOOL		LoadData(CString strFile);	
+	BOOL		CopyModelData(CNotchCut *pNotch);
+	BOOL		AdjustTilt(int index,double dTheta,double baseCenY);
+	void		SetParm(NOTCH_Parm_STU &parm);
+	int			NotchExecute(CSISBuffer &pOrg,double *dResult,double *dResult_Dy,pNOTCH_RangePos_STU pRangeRes,pNOTCH_RangePos_STU pRangeRes_Dy,pNOTCH_RangePos_STU pRangeRes_Cham,int nRangeCnt,COwnerBuffer &pRes,COwnerBuffer &pRes_Dy,COwnerBuffer &pRes_Cham,double *dAvgThick,int iDimension
+		, double *dFeedbackXY, int icam,double *dGlassXY,double dAlign2GlassX,int iLeftLine,BOOL bSaveDebug,CString strSavePath,double dTheta);	//20140528
+	BOOL		WriteModelData(CString strFile,CString strRecipe,CString strCut,std::multimap<int, CSplinePoint> *pPoint);
+	BOOL		ReadModelData(CString strFile,int index);
+	CChipBlob	*GetResultDefect(){return m_ResultDefect;}
+	int			GetDefectCount(){return m_nDefectCount;}
+	void		SetNotchInsPoint(std::vector<CPoint> *InsPoint, int index);//20140528
+	void		FindCenterPos(CSISBuffer &pImg,int &nPosX,int &nPosY,int nSkipSize=10);//20140528
+
+protected:
+	BOOL		CalDiffXY(std::multimap<int,CSplinePoint>	*mapDist,double *dDx,double *dDy);
+	void		CalRangeVal(std::multimap<int,CSplinePoint>	*mapDist,double *dResDist,pNOTCH_RangePos_STU dRangeRes,int nRangeCnt,int nCenX,int nCenY,int nStartX,int nFirstY,int nLastY);
+	void		CalRangeVal_New(std::multimap<int,CSplinePoint>	*mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dResDist,double *dResDist_Dy,pNOTCH_RangePos_STU dRangeRes,pNOTCH_RangePos_STU dRangeRes_Dy,pNOTCH_RangePos_STU dRangeRes_Cham,int nRangeCnt,int nCenX,int nCenY,int nStartX,int nFirstY,int nLastY,std::multimap<int,CSplinePoint> *mapChamfer);//20140528
+	int			CropDataXY2(std::multimap<int,CSplinePoint> *mapCrop,std::multimap<int,CSplinePoint> *mapDist,int nStartX,int nFirstY,int nLastY,double *dResDist);
+	int			CropDataXY2_Chamfer(std::multimap<int,CSplinePoint> *mapCrop,std::multimap<int,CSplinePoint> *mapDist,int nStartX,int nFirstY,int nLastY);//20140528
+	CSplinePoint	FindCenter2Vec(std::multimap<int,CSplinePoint> *mapCrop,int nCenY,int *nPosition);
+	void		GetRangeAvgThick(std::multimap<int,CSplinePoint> *mapCrop,pNOTCH_RangePos_STU pReangeRes,CSplinePoint spCenter,int nRangeCnt);
+	void		GetRangeAvgThick_New(std::multimap<int,CSplinePoint> *mapCrop,pNOTCH_RangePos_STU pReangeRes,CPoint point,int nRangeCnt);//20140528
+	void		GetRangeAvgThick_New_Cham(std::multimap<int,CSplinePoint> *mapCropChamfer,pNOTCH_RangePos_STU pReangeRes,CPoint point,int nRangeCnt);//20140528
+	void		Inspection_Size(CSISBuffer &pOrg,COwnerBuffer &pRes,COwnerBuffer &pRes_Dy,COwnerBuffer &pRes_Cham,CSISBuffer &pBinEdge,CSISBuffer &pBin,double *dChamferAvgThick,double *dChipAvgThick,int nCenX,int nCenY,int nGlass2Edge,double *dFeedbackXY
+		,int iDimension, int icam, std::multimap<int,CSplinePoint> *mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dGlassXY,double *dResult,std::multimap<int,CSplinePoint> *mapChamfer,double dTheta);	//20140528
+	void		ThinImage(CSISBuffer &pBinThin,int iscan, int icam);	
+	BOOL		DistInspection(CSISBuffer &pTgt,CSISBuffer &pOrg,double *dResult,double *dRangeRes,double *dAvgThick,int nCenX,int nCenY,int nGlass2Edge, double *dFeedbackXY,int iscan, int icam);
+	BOOL		DistInspection_New(CSISBuffer &pBin,CSISBuffer &pOrg,double *dChamferThick,double *dChipAvgThick,int nCenX,int nCenY,int nGlass2Edge
+		, double *dFeedbackXY,int iDimension, int icam, std::multimap<int,CSplinePoint> *mapDist,std::multimap<int,CSplinePoint> *mapDist_Dy,double *dGlassXY,int *nUpVPos,int *nDwVPos,std::multimap<int,CSplinePoint> *mapChamfer,double dTheta);	//20140528
+	BOOL		Inspection_SpChip(CSISBuffer &pBin,CSISBuffer &pOrg,int nGlass2Edge,int nUpVPos,int nDwVPos);
+	int			Defect_Analyze(std::multimap<double,CDetectPoint> *mapDist,double dAvgThick);
+	void		GetSpChipData(vector<pair<int,CPoint>> *pVec,CRect *rectIns);
+	double		Detect_Position(CSISBuffer &pBin,CSISBuffer &pOrg,std::multimap<double,CDetectPoint> *mapDist
+		,vector<pair<int,CPoint>> *vecData);
+	void		DrawImgRect(CSISBuffer &pOrg,double dX,double dY,int nValue=128);
+	int			AnalysisThick(CRect rectImg,double dRes,int nJudgeThick,double dAvgThick);
+	int			GetRangeDivThick(std::multimap<int, CSplinePoint> *mapCrop,CSplinePoint	spCenter,int nCenterPos,pNOTCH_RangePos_STU pRangeRes,int nRangeCnt,BOOL bOpt,int nDivRange);
+	void		SetBrokenDefect(CPoint pointBroken);
+
+protected:	
+	void		AssertRect(CRect &rect,CSISBuffer pOrg);	
+	int			FindLeftLine(CSISBuffer &pImg,CRect rect,int nThres);
+	int			FindLeftLineReal(CSISBuffer &pImg,CRect rect,int nThres);
+	void		SetNotchImgResPoint(COwnerBuffer *pRes,pNOTCH_RangePos_STU RangeVal,int nRangeCnt);
+	void		bresenham_Line(COwnerBuffer *pRes,CPoint posStart,CPoint posEnd,BYTE color);
+
+protected:
+	void		FindRealPos(CSISBuffer &pOrg,CSISBuffer &pBin,int iLeftLine,int &nCenX,int &nCenY
+		,int *nStartX,int *nFisrtY,int *nLastY,int iCam,int iDem,int nSkipSize=10);	
+	void		FindYPosMerge(std::vector<int> *vList,std::vector<NOTCH_Merge_STU> *vMergeList);
+	void		FindYPosPixel(CSISBuffer &pImg,CRect rect,std::vector<int> *vList,int nThres,int u,BOOL bDir=TRUE);
+	int			FindAccumYPos(CSISBuffer &pImg,CRect rect,int nThres);
+	void		FindRealAccumXY(CSISBuffer &pImg,CRect rect,int nThres,int *nStartX,int *nFirstY,int *nLastY);
+	double		FindRealAccumYPos(CSISBuffer &pImg,int nSkipSize,int nThres,int *iLeftLine);	
+	double		FindRealCenter(CSISBuffer &pImg,CRect rect,int nThres,int *nStartX,int *nFirstY,int *nLastY);	
+	void		FindRealYPosMerge(std::vector<int> *vList,std::vector<NOTCH_Merge_STU> *vMergeList);
+	void		MakeFoldImage(CSISBuffer &pImg,int nPosY);
+	void		MakeReal2Cad(CSISBuffer &pOrg,int nCenX,int nCenY,int iDimension=0, int icam=0);	
+	void		MakeReal2AlignCad(CSISBuffer &pOrg,int nCenY,int nForeX,int iDimension=0, int icam=0);	
+	void		MakeReal2Cad_Image(CSISBuffer &pOrg,COwnerBuffer &pRes,int nValue=128);
+	void		ResetData();
+	PointD		GetCenterPointFrom3Points(const PointD& S, const PointD& M, const PointD& E);
+	void		Exe_ChipInspect(CSISBuffer &pBin,CSISBuffer &pOrg,int iCam);
+	double		FindCenterThickness(CSISBuffer &pOrg,CSISBuffer &pBin,int nCenX,int nCenY,int icam,int iDimension);
+
+public:	
+	vector<pair<int,CPoint>> m_mapMaster;
+	std::multimap<int, CPoint> m_mapOrgMaster[MAX_NOTCH_SCAN_COUNT];
+	std::multimap<int, CPoint> m_mapAlignMaster[MAX_NOTCH_SCAN_COUNT];
+	vector<pair<int,CPoint>> m_mapMaster_InsPos;//20140528
+	std::multimap<int, CPoint> m_mapOrgMaster_InsPos[MAX_NOTCH_SCAN_COUNT];//20140528
+	std::multimap<int, CPoint> m_mapAlignMaster_InsPos[MAX_NOTCH_SCAN_COUNT];//20140528
+	vector<pair<int,CSplinePoint>> m_mapChipData;
+	CChipBlob		m_ResultDefect[MAX_NOTCH_DEFECT_COUNT];
+	int				m_nDefectCount;	
+
+public:
+	NOTCH_Parm_STU		m_InsParm;
+	NOTCH_Master_STU	m_MasterParm[MAX_NOTCH_SCAN_COUNT];
+	NOTCH_Master_STU	m_AlignMasterParm[MAX_NOTCH_SCAN_COUNT];
+	NOTCH_ObjFind_STU	m_ObjectInfo;	
+	BOOL				m_bSaveDebug;
+	CString				m_strSavePath;
+	int					m_nNoDetCount,m_nTotalCount;
+};
diff --git a/Lib/EdgeInspect/include/ProfileCADProc.h b/Lib/EdgeInspect/include/ProfileCADProc.h
new file mode 100644
index 0000000..17ccc86
--- /dev/null
+++ b/Lib/EdgeInspect/include/ProfileCADProc.h
@@ -0,0 +1,68 @@
+#pragma once
+
+#include <map>
+#include <list>
+#include <vector>
+#include "cv.h"
+
+typedef struct STU_PROFILE_POSITION_
+{	
+	int			iSide;
+	int			iScan;
+	int			iIndex;
+	int			nMin;
+	int			nMax;
+	CPoint		point;
+	BOOL		bFindPos;	
+
+public:
+	STU_PROFILE_POSITION_()
+	{		
+		iSide = iScan = iIndex = 0;
+		nMin = nMax = 0;
+		point = CPoint(-1,-1);
+		bFindPos = FALSE;	
+	}	
+}STU_PROFILE_POSITION, *pSTU_PROFILE_POSITION;
+
+using namespace std;
+class AFX_EXT_CLASS CProfileCADProc
+{
+public:
+	CProfileCADProc(void);
+	virtual ~CProfileCADProc(void);
+
+public:
+	void		SetProfileData(std::multimap<int, CPoint*> *pmapProfile,std::multimap<int, CPoint*> *pmapAlignProfile);
+	void		SetProfileOrigin(CPoint ptOrigin);
+	int			MakeProfileCAD(int iSide,CString strFile);
+	BOOL		WriteProfileData(CString strFile,CString strImg=_T(""));
+	BOOL		ReadProfileData(CString strFile);	
+	BOOL		RotateProfileData(CvPoint2D32f ptFirst,CvPoint2D32f ptSecond,CvPoint2D32f ptOffset);
+	BOOL		GetProfilePosition(std::vector< pair<int,STU_PROFILE_POSITION*> > &vecProfile);
+	CPoint		GetProfileOrigin(){return m_pointMasterMin;}
+	CPoint		GetProfileMax(){return m_pointMasterMax;}
+	CPoint		FindCADPoint(CvPoint2D32f ptCenter,double dTheta,int nRange);
+	CPoint		FindCADPoint(CvPoint2D32f ptCenter,double dTheta,int nRange,LPBYTE	lpImg,int nWidth,int nHeight,CPoint &ptGlass,CPoint &ptChamfer,int nGlassthres,int nChamferThres);
+	CPoint		FindCADPointY(int nX,BOOL bStart);
+	CPoint		FindCADPointY(int nX,BOOL bStart,LPBYTE	lpImg,int nWidth,int nHeight,CPoint &ptGlass,CPoint &ptChamfer,int nGlassthres,int nChamferThres);
+	BOOL		FindGlassLine(CPoint ptOrigin,int nRange,double dTheta,LPBYTE lpImg,int nWidth,int nHeight,int nGlassThres,int nChamferThres,CPoint &ptGlass,CPoint &ptChamfer);
+	void		Reset();
+
+protected:
+	int			FindProfileLine(CSISBuffer &BufCad);
+	BOOL		SaveImageJPG(CString strFile,CSISBuffer &buffer);
+
+protected:
+	BOOL		m_bLoadMaster;
+	std::multimap<int, CPoint*> *m_pmapProfile;		
+	std::multimap<int, CPoint*> *m_pmapAlignProfile;		
+	CPoint		m_ptOrigin;
+	CPoint		m_pointMasterMax;
+	CPoint		m_pointMasterMin;
+	double		m_dTheta;
+	CPoint		m_ptOffset;
+	CPoint		m_ptAlign;
+	CPoint		m_ptOriginOffset;
+};
+
diff --git a/Lib/EdgeInspect/include/RANSAC_LineFittingAlgorithm.h b/Lib/EdgeInspect/include/RANSAC_LineFittingAlgorithm.h
new file mode 100644
index 0000000..a4f33d3
--- /dev/null
+++ b/Lib/EdgeInspect/include/RANSAC_LineFittingAlgorithm.h
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "EDGE_DIPM.h"
+
+class AFX_EXT_CLASS CLineFitting
+{
+public:
+	CLineFitting(void);	
+	virtual ~CLineFitting(void);
+	
+public:
+	double ransac_line_fitting(sPoint *data, int no_data, sLine &model, double distance_threshold);
+
+protected:
+	double	model_verification (sPoint *inliers, int *no_inliers, sLine &estimated_model, sPoint *data, int no_data, double distance_threshold);
+	double	compute_distance(sLine &line, sPoint &x);
+	int		compute_model_parameter(sPoint samples[], int no_samples, sLine &model);
+	void	get_samples (sPoint *samples, int no_samples, sPoint *data, int no_data);
+	bool	find_in_samples (sPoint *samples, int no_samples, sPoint *data);
+};
diff --git a/Lib/EdgeInspect/include/SISEdgeFind.h b/Lib/EdgeInspect/include/SISEdgeFind.h
new file mode 100644
index 0000000..6105ca8
--- /dev/null
+++ b/Lib/EdgeInspect/include/SISEdgeFind.h
@@ -0,0 +1,162 @@
+// EdgeFind.h: interface for the CSISEdgeFind class.
+//
+//////////////////////////////////////////////////////////////////////
+#pragma once
+
+#include <map>
+
+class CSISBuffer;
+
+
+// defect count 扁馆栏肺 cutoff point 甫 茫酒 霖促.
+// AddCountData甫 烹茄 规过苞 FindCutoff_Continue甫 烹茄 规过 滴啊瘤啊 乐促.
+class AFX_EXT_CLASS CCutoffFind
+{
+	int m_nContinuousCutoff;
+	int *m_pCountData;
+public:
+	int	m_maxCount;
+	int m_nCountData;
+	CCutoffFind()
+	{
+		m_nCountData= 0;
+		m_pCountData= NULL;
+	}
+	virtual ~CCutoffFind()
+	{
+		if(m_pCountData)
+			delete m_pCountData;
+	}
+	BOOL SetSize(int nData)
+	{
+		m_nCountData= nData;
+		if(m_pCountData)
+			delete m_pCountData;
+		m_pCountData= new int[nData];
+		return TRUE;
+	}
+
+	// 鉴瞒利栏肺 龋免登搁 cutoff牢瘤甫 魄喊秦 楷加 cutoff count甫 府畔秦 霖促.
+	int AddCountData(int data, int nCutoff)
+	{
+		if(data >= nCutoff)
+		{
+			m_nContinuousCutoff++;
+			return m_nContinuousCutoff;
+		}
+		m_nContinuousCutoff= 0;
+		return 0;
+	}
+
+
+	void SetCountData(int iData, int data)
+	{
+		m_pCountData[iData]= data;
+	}
+	// 沥,开规氢栏肺 line by line 八荤窍哥 Cutoff_Continuous甫 茫酒 辰促.  Cutoff_Continuous啊 绝栏搁 false, Cutoff 困摹绰 沥规氢 扁霖狼 index捞促.
+	// nContinue俺荐 捞惑 瘤加利栏肺 cutoff啊 积败具 Cutoff_Continuous肺 埃林茄促.
+	BOOL FindCutoff_Continuous(BOOL bForwardScan, int nCutoff, int nContinue, int &iForwardResult,int nOffset=0)
+	{
+		int i;
+		int nOccur= 0;
+
+		if(bForwardScan)
+		{
+			for(i= nOffset; i< m_nCountData; i++)
+			{
+				if(m_pCountData[i] >= nCutoff)
+				{
+					nOccur++;
+					if(nOccur >= nContinue)
+					{
+						iForwardResult= i- nContinue+ 1;
+						return TRUE;
+					}
+				}else
+				{
+					nOccur= 0;
+				}
+			}
+			return FALSE;
+		}
+
+		for(i= m_nCountData-1; i >= nOffset; i--)
+		{
+			if(m_pCountData[i] >= nCutoff)
+			{
+				nOccur++;
+				if(nOccur >= nContinue)
+				{
+					iForwardResult= i+ nContinue;
+					return TRUE;
+				}
+			}else
+			{
+				nOccur= 0;
+			}
+		}
+		return FALSE;
+	}
+};
+
+enum SISEdgePos{eEP_LEFT, eEP_TOP, eEP_RIGHT, eEP_BOTTOM};
+
+struct stEdgeLRResult
+{
+	int iFrame;
+	int nPos;
+};
+
+typedef std::multimap<int, stEdgeLRResult> mapEdgeResult;
+typedef std::multimap<int, stEdgeLRResult>::iterator mapEdgeResultIt;
+
+class AFX_EXT_CLASS CSISEdgeFind
+{
+public:
+	CSISEdgeFind();
+	virtual ~CSISEdgeFind();
+
+protected:
+	CSISBuffer		*m_Buffer;
+
+	//Left Result
+	mapEdgeResult		m_mapLeftEdge;
+	//Right Result
+	mapEdgeResult		m_mapRightEdge;
+	//Top Result
+	int					m_nTopEdge;
+	//Bottom Result
+	int					m_nBottomEdge;
+
+public:
+	void				ResetEdge();
+
+	int					GetEdgeResult(SISEdgePos eEP, int iFrame = 0, BOOL bNearResult = FALSE);
+	BOOL				IsFindEdge(SISEdgePos eEP, int iFrame = 0);
+
+public:
+	BOOL FindEdge_ToTop(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect);
+	BOOL FindEdge_ToBottom(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect);
+	BOOL FindEdge_ToLeft(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset);
+	BOOL FindEdge_ToRight(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset);
+	BOOL FindEdge_ToRightROI(CSISBuffer *pBuffer, int &offset, double pitch, int threshold, double rDefect,int nOffset,CRect rtROI);
+
+public:
+	int Find_LeftEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+	int Find_RightEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+	int Find_TopEdge(CSISBuffer *pBuffer, double pitch, int threshold, double rDefect, int nContinue);
+	int Find_GlassStart(CSISBuffer *pBuffer, double pitch);
+public:
+	void GetCount_X(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find,int nOffset);
+	void GetCount_XROI(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find,int nOffset,CRect rtROI);
+	void GetCount_Y(CSISBuffer *pBuffer, double pitch, int threshold, CCutoffFind &find);
+
+	int ImageProjection(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist = 8, int nContinue = 2);
+	int	ImageProjection_R(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist = 8, int nContinue = 2);
+	int	ImageProjection_Vert(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist = 8, int nContinue = 2);
+	int	ImageProjection_Vert_R(BYTE* pBuff, int nWidth, int nHeight, CRect ROI, int nThres, int nDist = 8, int nContinue = 2);
+
+	int	FindEdge(CSISBuffer framebuffer, SISEdgePos eEP, CRect rtROI, int nThres);
+	int	FindEdgeVert(CSISBuffer framebuffer, SISEdgePos eEP, CRect rtROI, int nThres);
+};
+
diff --git a/Lib/EdgeInspect/include/SplineInspect.h b/Lib/EdgeInspect/include/SplineInspect.h
new file mode 100644
index 0000000..52c271b
--- /dev/null
+++ b/Lib/EdgeInspect/include/SplineInspect.h
@@ -0,0 +1,251 @@
+#pragma once
+
+#include "RANSAC_LineFittingAlgorithm.h"
+#include "EdgeProc.h"
+#include "EdgeFind.h"
+#include "ChamferInspect.h"
+#include <map>
+#include <vector>
+
+using namespace std;
+
+enum	SPLINE_ERR_MSG{ERR_SPLINE_EMPTYMASTER=1,ERR_SPLINE_EDGEPROCESS,ERR_SPLINE_LABELPROCESS,ERR_SPLINE_LABELCOUNT,ERR_SPLINE_INDEXFIND
+,ERR_SPLINE_LABELPOSITION,ERR_SPLINE_POSITIONNULL,ERR_SPLINE_INS_CNT_SHORT,ERR_SPLINE_IMAGE_NULL,ERR_SPLINE_IMAGE_NULL_02
+,ERR_SPLINE_IMAGE_NULL_03,SPLINE_INS_SUCESS};
+
+#define MAX_SPLINE_DEFECT_COUNT		1000
+
+class CSplinePoint
+{
+public:
+	CSplinePoint()		{ Reset(); }	
+	void Reset()
+	{
+		origin = rotate = CPoint(0,0);		
+		dThick = dTheta = 0.;
+		bFind = FALSE;
+	}
+
+	CPoint	origin;
+	CPoint	rotate;
+	double	dThick;
+	double	dTheta;
+	BOOL	bFind;
+};
+
+class CImagePoint
+{
+public:
+	CImagePoint()		{ Reset(); }	
+	void Reset()
+	{
+		imgPos = originPos = CPoint(0,0);	
+		dTheta = 0.;
+		nInsWidth = 0;
+	}
+
+	CPoint	imgPos;
+	CPoint	originPos;
+	double	dTheta;
+	int		nInsWidth;
+};
+
+class CResultDefect
+{
+public:
+	CResultDefect()		{ Reset(); }	
+	void Reset()
+	{
+		dThick = 0.;
+		rectDefect = CRect(0,0,0,0);
+	}
+
+	CRect		rectDefect;
+	double		dThick;
+};
+
+class CDetectPoint
+{
+public:
+	CDetectPoint()		{ Reset(); }	
+	void Reset()
+	{
+		orgX = orgY = 0.;
+		imgX = imgY = 0.;
+		dTheta = dDist = 0.;
+		bFind = FALSE;
+	}
+
+	double	orgX,orgY;
+	double	imgX,imgY;
+	double	dTheta;
+	double	dDist;
+	BOOL    bFind;
+};
+
+struct SortOrginYPos : public std::binary_function<pair<int,CSplinePoint>, pair<int,CSplinePoint>, bool>
+{
+	bool operator()(const pair<int,CSplinePoint> & lhs, const pair<int,CSplinePoint> & rhs)
+	{
+		return lhs.second.origin.y > rhs.second.origin.y;
+	}
+};
+
+enum SPLINECHIP_INS_METHOD{METHOD_INS_LINE=0,METHOD_INT_ROUND};
+enum MAKE_IMAGE_METHOD{MAKE_METHOD_LINEAR=0,MAKE_METHOD_REGRESSION,MAKE_METHOD_NONE};
+enum SPLINE_INS_DIR{SPLINE_INS_DIRECTION_X=0,SPLINE_INS_DIRECTION_Y,SPLINE_INS_DIRECTION_NONE};
+
+typedef struct  _CHIP_INS_REGION
+{
+public:
+	_CHIP_INS_REGION()		{ Reset(); }	
+	void Reset()
+	{
+		bUse = FALSE;
+		nStartX = nEndX = nThres = nFindThres = nSkipDist = nInsRange = 0;
+		emMethod = MAKE_METHOD_NONE;
+		emDir = SPLINE_INS_DIRECTION_NONE;
+		nCornerYSize = -1;
+	}
+
+	BOOL		bUse;
+	int			nStartX;
+	int			nEndX;
+	int			nCornerYSize;
+	int			nThres;
+	int			nFindThres;
+	int			nSkipDist;
+	int			nInsRange;
+	MAKE_IMAGE_METHOD emMethod;
+	SPLINE_INS_DIR	emDir;
+}CHIP_INS_REGION;
+
+#define		SPLINE_RESULT_DATA_CNT  2
+#define		SPLINE_RANGE_RESULT_CNT 5
+
+class AFX_EXT_CLASS CSplineModel
+{
+public:
+	CSplineModel(void);		
+	virtual ~CSplineModel(void);
+
+public:
+	BOOL		CopyModelData(CSplineModel *pSpline);
+	BOOL		WriteModelData(CString strFile,CString strRecipe,CString strCut,std::multimap<int, CSplinePoint> *pPoint,CPoint pointOffset);
+	BOOL		WriteCSVData(CString strFile,CPoint *pPoint,int nCnt,CPoint pointOffset);
+	BOOL		ReadModelData(CString strFile,CString strRecipe);
+	BOOL		IsLoadMasterImg(){return m_bLoadMasterImg;}
+	CString		GetLoadModelRecipe(){return m_strLoadModel;}
+	CSize		GetMasterDataSize(){return CSize(m_pointMasterMax.x,m_pointMasterMax.y);}
+	std::multimap<int, CPoint> *GetMasterData(){return &m_mapMasterPos;}
+	CPoint		GetptMasterMax(){return m_pointMasterMax;}
+	CPoint		GetptMasterMin(){return m_pointMasterMin;}
+	void		ClearModelData();
+
+protected:
+	BOOL		AdjustTilt(std::multimap<int, CSplinePoint> *pPos);
+	double		GetTilt(std::multimap<int, CSplinePoint> *pPos,double &dCenX,double &dCenY);	
+
+protected:
+	BOOL		m_bLoadMasterImg;
+	CString		m_strLoadModel;
+	CPoint		m_pointMasterMax,m_pointMasterMin;	
+	std::multimap<int, CPoint> m_mapMasterPos;	
+};
+
+class CSISBuffer;
+class AFX_EXT_CLASS CSplineInspect
+{
+public:
+	CSplineInspect(void);	
+	CSplineInspect(CSISBuffer *lpBuffer);
+	virtual ~CSplineInspect(void);
+
+public:
+	SPLINE_ERR_MSG	InspectSpline(CSISBuffer &pImg,CRect &rectCrop,int nDetDist,int nThres,BOOL bFlip,BOOL bSaveImg,BOOL bSaveDebug);
+	double			InspectSplineChip(CSISBuffer pImg,int nPosLeft,CHIP_INS_REGION &insRegion,double dRes,int nJudgeThick,COwnerBuffer &pRes
+		,BOOL bFlip,int iReg,BOOL bSaveDebug,SPLINECHIP_INS_METHOD enOpt=METHOD_INT_ROUND);
+
+	// 荐沥 滚傈
+	double			InspectSplineChip_New(CSISBuffer pImg,int nPosLeft,CHIP_INS_REGION &insRegion,double dRes,int nJudgeThick
+		,BOOL bFlip,int iReg,BOOL bSaveDebug,SPLINECHIP_INS_METHOD enOpt=METHOD_INT_ROUND);
+	int			InspectChipBin_New(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns);
+	BOOL		Blob_OpenCV(CSISBuffer* pOriginImg, COwnerBuffer* pBinImage, CRect rtInsRect, std::vector<CChipBlob>* vecBlobList, ChipResionType s_RegionType,DefectPosType s_DefectPos, int nMinSize, int nSideFilter, BOOL bROIOffset=TRUE);
+	int			FilteringDefect_New(CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns,double dRes,int nJudge,CRect &insRect,BOOL bFlip);
+
+public:	
+	CChipBlob	*GetResultDefect(){return m_ResultDefect;}
+	int			GetResultDefectCount(){return m_nDefectCount;}
+	double		*GetResultData(){return m_dResultData;}	
+	double		*GetRangeData(){return m_dRangeResult;}
+	CSISBuffer	*GetSplineOrgImg(){return (CSISBuffer*)&m_insSplineOrg;}
+	CSISBuffer	*GetSplineResImg(){return (CSISBuffer*)&m_insSplineRes;}
+
+	BOOL		FindCADLine();
+	BOOL		LabelingProcess();
+	BOOL		LabelingCounting();
+	BOOL		LabelFiltering(int nFilterCnt);
+	int			GetRectInLabelMaxIndex(CRect &rect);
+	BOOL		GetLabelPosition(int nIdx);
+	std::multimap<int, CSplinePoint>	*GetSplinePos(){return &m_mapSplinePos;}
+	CPoint		GetSplineOffset(){return CPoint(m_nSplineOffsetX,m_nSplineOffsetY);}
+	BOOL		CheckBuffer();
+	BOOL		CheckRange(int x,int y,CSISBuffer *buffer);	
+	void		ContourTracing(int cy, int cx, int labelindex, int tracingdirection);
+	BOOL		CheckRectToBuffer(CRect &rect);
+	BOOL		Tracer(int *cy, int *cx, int *tracingdirection);
+	void		ReleaseBuffer();
+	BOOL		SetImage(CSISBuffer *lpBuffer);
+	void		SetMasterModelData(CSplineModel *pMaster){m_pSpModel=pMaster;}
+
+protected:
+	void		ReleaseBlob();
+	void		ResetValue();	
+	BOOL		FindForeLine(CSISBuffer &pBuffer,int *nForeLine,double &dTheta);
+	BOOL		ShiftNRotateImage(CSISBuffer pOrg,CSISBuffer pBin,COwnerBuffer &pProcess,COwnerBuffer &pProcImg,int *nForeLine,double dTheta,CPoint &pPosImg);
+	BOOL		DistInspection(CEdgeProc &EdgeProc,CSISBuffer &pTgt,double *dResult,double *dRangeRes);
+	int			GetSplineValue(CEdgeProc &glassFind,CSISBuffer pOrg,double dXPos,double dYPos);	
+	void		MakeSplineResultImage(COwnerBuffer &pRes,CSISBuffer &pProcess);
+	BOOL		AdjustTilt(std::multimap<int, CSplinePoint> *pPos);
+	double		GetTilt(std::multimap<int, CSplinePoint> *pPos,double &dCenX,double &dCenY);	
+
+protected:
+	BOOL		CopyRectImg(LPBYTE pOrg,LPBYTE pTgt,CSize szImg,CRect &rectIns);
+	BOOL		MakeCADLine(CHIP_INS_REGION & insRegion,std::multimap<int, CPoint> &mapData,CPoint &pointMin,CPoint &pointMax,SPLINECHIP_INS_METHOD enOpt=METHOD_INT_ROUND);
+	double		GetCAD2ImgOffset(std::multimap<int, CPoint> &mapData,CSISBuffer pBin,CPoint pointMin,CPoint pointMax,int nGap=30);
+	void		MakeInspectResultImage(CSISBuffer &pRes,std::multimap<int, CSplinePoint> &mapIns);
+	void		MakeInspectResultImage(CSISBuffer &pRes,std::multimap<int, CPoint> &mapIns);
+	void		MakeSplineDebugImg(COwnerBuffer &pRes,std::multimap<int, CPoint> *pMaster,std::multimap<int, CSplinePoint> *pData);	
+	BOOL		MakeInspectLine(std::multimap<int, CPoint> &mapData,std::multimap<int, CSplinePoint> &mapIns,double dYPos,SPLINECHIP_INS_METHOD enOpt=METHOD_INT_ROUND);	
+	double		InspectChip(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns);
+	int			InspectChipBin(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns);
+	int			InspectChipBin_Diagonal(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns);
+
+	int			FilteringDefect(CHIP_INS_REGION &insRegion,std::multimap<int, CSplinePoint> &mapIns,double dRes,int nJudge,CRect &insRect,BOOL bFlip);
+	double		FindThick(CEdgeProc &EdgeProc,CSISBuffer pOrg,CRect &insRect,CPoint pointSet,CPoint &pointRotate,double dTheta,int nDetThres);
+	int			AnalysisThick(CEdgeProc &EdgeProc,CRect rectImg,double dRes,int nJudgeThick,double dAvgThick,BOOL bFlip,std::multimap<int, CSplinePoint> &mapIns);	
+
+public:		
+	double		m_dImageTheta;
+	CPoint		m_pointPosLeft;
+	CPoint		m_pointDiffImg;	
+	CSplineModel	*m_pSpModel;
+	std::multimap<int, CSplinePoint> m_mapSplinePos;
+	CChipBlob	m_ResultDefect[MAX_SPLINE_DEFECT_COUNT];
+	double		m_dRangeResult[SPLINE_RANGE_RESULT_CNT];
+	int			m_nDefectCount;
+	CSize			m_szImageOrg;
+	double		m_dResultData[SPLINE_RESULT_DATA_CNT];	
+	COwnerBuffer	m_insSplineOrg,m_insSplineRes;
+	CChamferInspect		m_ChamferIns;
+	
+	int				m_nSplineOffsetX;
+	int				m_nSplineOffsetY;
+	int				m_nCCCount;
+	CSISBuffer		*m_lpBuffer;	
+	int				**m_pLabelMap;
+	int				m_nMaxContourIdx;
+	int				m_nMaxContourCount;
+	int				**m_pContourMap;
+	int				*m_pContourCnt;
+};
diff --git a/Lib/EuresysCam/Dll/MultiCam.dll b/Lib/EuresysCam/Dll/MultiCam.dll
new file mode 100644
index 0000000..e2988fd
--- /dev/null
+++ b/Lib/EuresysCam/Dll/MultiCam.dll
Binary files differ
diff --git a/Lib/EuresysCam/Include/CCallbacks.h b/Lib/EuresysCam/Include/CCallbacks.h
new file mode 100644
index 0000000..e8ea96e
--- /dev/null
+++ b/Lib/EuresysCam/Include/CCallbacks.h
@@ -0,0 +1,46 @@
+// CCALLBACKS.H - C CALLBACKS LAYER
+
+#if !defined(__CCALLBACKS_H__)
+#define __CCALLBACKS_H__
+
+typedef void (MCAPI *PMCPP_C_CALLBACK)(void *Context, void *Caller, void *Info);
+
+namespace Euresys
+{
+	namespace MultiCam
+	{
+		// ********************************************************************************************
+		// Callback class (continued)
+		// --------------------------
+
+		class CFunctionCallback : public Callback
+		{
+		private:
+			void *Context;
+			PMCPP_C_CALLBACK Function;
+
+		public:
+			CFunctionCallback(void *aContext, PMCPP_C_CALLBACK aFunction) :
+			Context(aContext),
+			Function(aFunction)
+			{
+			}
+			~CFunctionCallback()
+			{
+			}
+
+			void Run(MultiCamObjectWithSignaling &caller, SignalInfo &info)
+			{
+				Function(Context, &caller, &info);
+			}
+
+            void RunUntyped(MultiCamObjectWithSignaling *caller, SignalInfo &info)
+			{
+				Function(Context, caller, &info);
+			}
+		};
+	}
+}
+
+
+#endif
diff --git a/Lib/EuresysCam/Include/ESFilter.h b/Lib/EuresysCam/Include/ESFilter.h
new file mode 100644
index 0000000..da41bbe
--- /dev/null
+++ b/Lib/EuresysCam/Include/ESFilter.h
@@ -0,0 +1,225 @@
+//
+// Euresys DirectShow input filter
+//
+// public definitions & interfaces
+//
+
+#pragma once
+
+#include "multicam.h"
+
+typedef enum {
+	ESF_STANDARD_PAL = 0,
+	ESF_STANDARD_NTSC
+} ESF_VIDEO_STANDARD;
+
+typedef enum {
+  ESF_RESOLUTION_FRAME = 0,
+  ESF_RESOLUTION_FIELD,
+  ESF_RESOLUTION_CIF,
+  ESF_RESOLUTION_QCIF,
+  ESF_RESOLUTION_CUSTOM
+} ESF_RESOLUTION;
+
+typedef enum {
+  ESF_BITRATECONTROL_CBR = 0,
+  ESF_BITRATECONTROL_VBR
+} ESF_BITRATECONTROL;
+
+typedef enum {
+  ESF_GOPSTRUCTURE_IONLY = 0,
+  ESF_GOPSTRUCTURE_IPONLY,
+  ESF_GOPSTRUCTURE_IPB
+} ESF_GOPSTRUCTURE;
+// {C8D2D5D0-02DF-41d4-BD80-7681CD059B52}
+DEFINE_GUID(CLSID_ESFilter, 
+0xc8d2d5d0, 0x2df, 0x41d4, 0xbd, 0x80, 0x76, 0x81, 0xcd, 0x5, 0x9b, 0x52);
+
+//
+// IESFProperties Interface
+//
+// {EC67FA27-4176-4659-ADCF-944D0941667F}
+DEFINE_GUID(IID_IESFProperties, 
+0xec67fa27, 0x4176, 0x4659, 0xad, 0xcf, 0x94, 0x4d, 0x9, 0x41, 0x66, 0x7f);
+
+interface IESFProperties : public IUnknown
+{
+  // Capture rate control
+  STDMETHOD(GetCaptureRateRange)(double *plMinValue, double *plMaxValue, double *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetCaptureRate)(double lValue) = 0;
+  STDMETHOD(GetCaptureRate)(double *plValue) = 0;
+  // Resolution selection
+  STDMETHOD(SetResolution)(ESF_RESOLUTION Resolution, long lWidth = 0, long lHeight = 0) = 0; // Width and height are ignored if Resolution is not ESF_RESOLUTION_CUSTOM.
+  STDMETHOD(GetResolution)(ESF_RESOLUTION *pResolution, long *plWidth = NULL, long *plHeight = NULL) = 0;
+  STDMETHOD(GetCustomResolutionRange)(long *plMinWidth, long *plMaxWidth, long *plMinHeight, long *plMaxHeight) = 0;
+  // Brightness control
+  STDMETHOD(GetBrightnessRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetBrightness)(long lValue) = 0;
+  STDMETHOD(GetBrightness)(long *plValue) = 0;
+  // Contrast control
+  STDMETHOD(GetContrastRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetContrast)(long lValue) = 0;
+  STDMETHOD(GetContrast)(long *plValue) = 0;
+  // Saturation control
+  STDMETHOD(GetSaturationRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetSaturation)(long lValue) = 0;
+  STDMETHOD(GetSaturation)(long *plValue) = 0;
+  // Camera specification
+  STDMETHOD(GetVideoStandard)(ESF_VIDEO_STANDARD *pStandard, bool *pbMonochrome) = 0;
+  STDMETHOD(SetVideoStandard)(ESF_VIDEO_STANDARD Standard, bool bMonochrome) = 0;
+  // Source selection
+  STDMETHOD(GetBoardRange)(long *plMinValue, long *plMaxValue) = 0;
+  STDMETHOD(SetBoard)(long lBoardId) = 0;
+  STDMETHOD(GetBoard)(long *plBoardId) = 0;
+  STDMETHOD(GetConnectorRange)(long *plMinValue, long *plMaxValue) = 0;
+  STDMETHOD(SetConnector)(long lConnectorId) = 0;
+  STDMETHOD(GetConnector)(long *plConnectorId) = 0;
+  // Capture Region selection
+  STDMETHOD(GetCaptureRegionSizeRange)(long *plMinSizeX, long *plMaxSizeX, long *plMinSizeY, long *plMaxSizeY) = 0;
+  STDMETHOD(SetCaptureRegionSize)(long lSizeX, long lSizeY) = 0;
+  STDMETHOD(GetCaptureRegionSize)(long *plSizeX, long *plSizeY) = 0;
+  STDMETHOD(GetCaptureRegionPosRange)(long *plMinPositionX, long *plMaxPositionX, long *plMinPositionY, long *plMaxPositionY) = 0;
+  STDMETHOD(SetCaptureRegionPos)(long lPositionX, long lPositionY) = 0;
+  STDMETHOD(GetCaptureRegionPos)(long *plPositionX, long *plPositionY) = 0;
+  // Output Format selection
+  STDMETHOD(GetOutputFormatsList)(ULONG *pcElems, GUID **ppElems) = 0;
+  STDMETHOD(SetOutputFormat)(GUID Format) = 0;
+  STDMETHOD(GetOutputFormat)(GUID *pFormat) = 0;
+  // Individual Control
+  STDMETHOD(SetIndividualControl)(bool bActive) = 0;
+  STDMETHOD(GetIndividualControl)(bool *pbActive) = 0;
+  // Video Signal detection
+  STDMETHOD(IsVideoSignalPresent)(void) = 0;
+  // Camera specification with broadcast support
+  STDMETHOD(GetVideoStandardEx)(ESF_VIDEO_STANDARD *pStandard, bool *pbMonochrome, bool *pbBroadcast) = 0;
+  STDMETHOD(SetVideoStandardEx)(ESF_VIDEO_STANDARD Standard, bool bMonochrome, bool bBroadcast) = 0;
+};
+
+//
+// IESFCompression Interface
+//
+// {A41D0CDA-FE6D-46b7-BBF9-3FF677CDABB7}
+DEFINE_GUID(IID_IESFCompression, 
+0xa41d0cda, 0xfe6d, 0x46b7, 0xbb, 0xf9, 0x3f, 0xf6, 0x77, 0xcd, 0xab, 0xb7);
+
+interface IESFCompression : public IUnknown
+{
+  // Bitrate Control
+  STDMETHOD(SetBitrateControl)(ESF_BITRATECONTROL BitrateControl) = 0;
+  STDMETHOD(GetBitrateControl)(ESF_BITRATECONTROL *pBitrateControl) = 0;
+  // Average Bit Rate
+  STDMETHOD(GetAverageBitrateRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetAverageBitrate)(long lValue) = 0;
+  STDMETHOD(GetAverageBitrate)(long *plValue) = 0;
+  // Video Quality 
+  STDMETHOD(GetVideoQualityRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetVideoQuality)(long lValue) = 0;
+  STDMETHOD(GetVideoQuality)(long *plValue) = 0;
+  // Gop structure
+  STDMETHOD(SetGopStructure)(ESF_GOPSTRUCTURE GopStructure) = 0;
+  STDMETHOD(GetGopStructure)(ESF_GOPSTRUCTURE *pGopStructure) = 0;
+  STDMETHOD(GetGopSizeRange)(long *plMinValue, long *plMaxValue, long *plDefaultValue = NULL) = 0;
+  STDMETHOD(SetGopSize)(long lValue) = 0;
+  STDMETHOD(GetGopSize)(long *plValue) = 0;
+};
+
+//
+// IMCBord Interface
+//
+// {A97BB8BD-9ABE-44e0-9F5A-E055A6B6FA36}
+DEFINE_GUID(IID_IMCBoard, 
+0xa97bb8bd, 0x9abe, 0x44e0, 0x9f, 0x5a, 0xe0, 0x55, 0xa6, 0xb6, 0xfa, 0x36);
+
+interface IMCBoard : public IUnknown
+{
+  STDMETHOD(GetParamFloat)(UINT32 unParamId, double *pdValue) = 0;
+  STDMETHOD(GetParamInt)(UINT32 unParamId, long *plValue) = 0;
+  STDMETHOD(GetParamStr)(UINT32 unParamId, PWSTR pszValue, long ccValue) = 0;
+  STDMETHOD(GetParamNmFloat)(PCWSTR pszName, double *pdValue) = 0;
+  STDMETHOD(GetParamNmInt)(PCWSTR pszName, long *plValue) = 0;
+  STDMETHOD(GetParamNmStr)(PCWSTR pszName, PWSTR pszValue, long ccValue) = 0;
+  STDMETHOD(SetParamFloat)(UINT32 unParamId, double dValue) = 0;
+  STDMETHOD(SetParamInt)(UINT32 unParamId, long lValue) = 0;
+  STDMETHOD(SetParamStr)(UINT32 unParamId, PCWSTR pszValue) = 0;
+  STDMETHOD(SetParamNmFloat)(PCWSTR pszName, double dValue) = 0;
+  STDMETHOD(SetParamNmInt)(PCWSTR pszName, long lValue) = 0;
+  STDMETHOD(SetParamNmStr)(PCWSTR pszName, PCWSTR pszValue) = 0;
+};
+
+//
+// IMCEnumBords Interface
+//
+// {C1A9226F-D740-439a-A8CC-FFB46977FBC3}
+DEFINE_GUID(IID_IMCEnumBoards, 
+0xc1a9226f, 0xd740, 0x439a, 0xa8, 0xcc, 0xff, 0xb4, 0x69, 0x77, 0xfb, 0xc3);
+
+interface IMCEnumBoards : public IUnknown
+{
+	STDMETHOD(Next)(ULONG celt, IMCBoard **ppEureCard, ULONG *pceltFetched) = 0;
+	STDMETHOD(Skip)(ULONG celt) = 0;
+	STDMETHOD(Reset)() = 0;
+	STDMETHOD(Clone)(IMCEnumBoards **ppEnumBoards) = 0;
+};
+
+//
+// IMCConfig Interface
+//
+// {7377EB18-82DE-43ff-8DB2-01FEA57EEA66}
+DEFINE_GUID(IID_IMCConfig, 
+0x7377eb18, 0x82de, 0x43ff, 0x8d, 0xb2, 0x1, 0xfe, 0xa5, 0x7e, 0xea, 0x66);
+
+interface IMCConfig : public IUnknown
+{
+  STDMETHOD(GetBoardEnum)(IMCEnumBoards **ppEnumBoards) = 0;
+};
+
+
+//
+// IESFAllocatorNegociation
+//
+// {3475FA59-2661-4d91-BA60-9FE92E180395}
+DEFINE_GUID(IID_IESFAllocatorNegociation, 
+0x3475fa59, 0x2661, 0x4d91, 0xba, 0x60, 0x9f, 0xe9, 0x2e, 0x18, 0x3, 0x95);
+
+interface IESFAllocatorNegociation : public IUnknown
+{
+  STDMETHOD(UseInputPinAllocator)(BOOL bUseInputPinAllocator) = 0;
+};
+
+//
+// Property Pages GUIDS
+//
+
+// Configuration Property page
+// {CE39B2A2-DF66-4D8B-93CD-DC6A1EADF09A}
+DEFINE_GUID(CLSID_ConfigPropPage, 
+0xCE39B2A2, 0xDF66, 0x4D8B, 0x93, 0xCD, 0xDC, 0x6A, 0x1E, 0xAD, 0xF0, 0x9A);
+
+// Adjustment Property page
+// {E873C3B6-950F-45CD-A184-95428036FB6A}
+DEFINE_GUID(CLSID_AdjustPropPage, 
+0xE873C3B6, 0x950F, 0x45CD, 0xA1, 0x84, 0x95, 0x42, 0x80, 0x36, 0xFB, 0x6A);
+
+// Compression Property page
+// {15CF19B6-1F28-4B06-A3D8-FC58B7A108C5}
+DEFINE_GUID(CLSID_CompressionPropPage, 
+0x15CF19B6, 0x1F28, 0x4B06, 0xA3, 0xD8, 0xFC, 0x58, 0xB7, 0xA1, 0x08, 0xC5);
+
+//
+// Filter Events
+//
+
+#define EC_ESF_SIGNAL_LOST            EC_USER + 0x00
+#define EC_ESF_SIGNAL_RESTORED        EC_USER + 0x01
+
+//
+// Error Codes
+//
+#define MCSTATUS_TO_HRESULT(status) \
+  MAKE_HRESULT((status == MC_OK)? SEVERITY_SUCCESS : SEVERITY_ERROR, FACILITY_ITF, (0x4000 - status))
+#define HRESULT_TO_MCSTATUS(hr) (MCSTATUS)(0x4000 - HRESULT_CODE(hr))
+
+#define E_ESF_BAD_PARAMETER   (MCSTATUS_TO_HRESULT(MC_BAD_PARAMETER))
+#define E_ESF_OUT_OF_BOUND    (MCSTATUS_TO_HRESULT(MC_OUT_OF_BOUND))
+#define E_ESF_INVALID_VALUE   (MCSTATUS_TO_HRESULT(MC_INVALID_VALUE))
+#define E_ESF_FATAL_ERROR	  (MCSTATUS_TO_HRESULT(MC_FATAL_ERROR))
diff --git a/Lib/EuresysCam/Include/MCpp_Board.h b/Lib/EuresysCam/Include/MCpp_Board.h
new file mode 100644
index 0000000..600e91b
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_Board.h
@@ -0,0 +1,35 @@
+// MCpp_Board.h - MULTICAM C++ API - Board
+#if !defined(__MCPP_BOARD_H__)
+#define __MCPP_BOARD_H__
+
+// ********************************************************************************************
+// Board class
+// -----------
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    class Board : public MultiCamObjectWithSignaling
+    {
+      WRAPPING_MEMBERS
+
+    public:
+      Board(int index);
+      ~Board();
+
+      template <class T>
+      void RegisterCallback(T *owner, void (T::*callbackMethod)(Board &, SignalInfo &), MCSIGNAL signal)
+      {
+        if (owner == NULL || callbackMethod == NULL)
+        {
+          ::Euresys::MultiCam::Exception e(MC_INTERNAL_ERROR, "Invalid callback object or function");
+          throw e;
+        }
+
+        Callback *cb = new UserCallback<T, Board>(owner, callbackMethod);
+        RegisterCallbackInternal(cb, signal);
+      }
+    };
+  }
+}
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_BoardImpl.h b/Lib/EuresysCam/Include/MCpp_BoardImpl.h
new file mode 100644
index 0000000..08b002a
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_BoardImpl.h
@@ -0,0 +1,33 @@
+// MCpp_BoardImpl.h - MULTICAM C++ API - BoardImpl
+#if !defined(__MCPP_BOARDIMPL_H__)
+#define __MCPP_BOARDIMPL_H__
+
+#include "MCpp_Board.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline Board::Board(int Index)
+    {
+      WRAPPING_MEMBERS_INIT
+
+      Handle = MC_BOARD + Index;
+
+      // Make sure the handle is valid (i.e., this object corresponds to a MultiCam Board object)
+      MCSTATUS status;
+      int ix;
+      status = McGetParamInt(Handle, MC_DriverIndex, &ix);
+      if (status != MC_OK || ix != Index)
+        ThrowMultiCamException(MC_NO_BOARD_FOUND);
+    }
+
+    inline Board::~Board()
+    {
+      WRAPPING_MEMBERS_UNINIT
+    }
+
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_BoardList.h b/Lib/EuresysCam/Include/MCpp_BoardList.h
new file mode 100644
index 0000000..cd5e6eb
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_BoardList.h
@@ -0,0 +1,53 @@
+// MCpp_Board.h - MULTICAM C++ API - BoardList
+#if !defined(__MCPP_BOARDLIST_H__)
+#define __MCPP_BOARDLIST_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // BoardList class
+    // ---------------
+    class BoardListImpl
+    {
+    private:
+      Board **List;
+      int Count;
+
+    public:
+      BoardListImpl();
+      ~BoardListImpl();
+      void Init();
+
+      Board *operator[] (int driverIndex) { return GetBoardByDriverIndex(driverIndex); }
+      Board *GetBoardByDriverIndex(int driverIndex);
+      Board *GetBoardByPciPosition(int pciPosition);
+      Board *GetBoardByBoardName(const char *boardName);
+      Board *GetBoardByBoardIdentifier(const char *boardIdentifier);
+      int GetCount();
+      void Clear();
+    };
+
+    inline BoardListImpl* GetBoardListImpl()
+    {
+      static BoardListImpl impl;
+      return &impl;
+    }
+
+    class BoardList
+    {
+    public:
+      void Init() { GetBoardListImpl()->Init(); }
+      Board *operator[] (int driverIndex) { return GetBoardListImpl()->GetBoardByDriverIndex(driverIndex); }
+      Board *GetBoardByDriverIndex(int driverIndex) { return GetBoardListImpl()->GetBoardByDriverIndex(driverIndex); }
+      Board *GetBoardByPciPosition(int pciPosition) { return GetBoardListImpl()->GetBoardByPciPosition(pciPosition); }
+      Board *GetBoardByBoardName(const char *boardName) { return GetBoardListImpl()->GetBoardByBoardName(boardName); }
+      Board *GetBoardByBoardIdentifier(const char *boardIdentifier) { return GetBoardListImpl()->GetBoardByBoardIdentifier(boardIdentifier); }
+      int GetCount() { return GetBoardListImpl()->GetCount(); }
+      void Clear() { GetBoardListImpl()->Clear(); }
+    };
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_BoardListImpl.h b/Lib/EuresysCam/Include/MCpp_BoardListImpl.h
new file mode 100644
index 0000000..289ca5e
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_BoardListImpl.h
@@ -0,0 +1,145 @@
+// MCpp_BoardImpl.h - MULTICAM C++ API - BoardListImpl
+#if !defined(__MCPP_BOARDLISTIMPL_H__)
+#define __MCPP_BOARDLISTIMPL_H__
+
+#include <cstring>
+#include "MCpp_BoardList.h"
+
+namespace
+{
+
+int mc_stricmp(const char *s1, const char *s2)
+{
+#if defined(__GNUC__)
+   return strcasecmp(s1, s2);
+#elif defined(_MSC_VER) && _MSC_VER >= 1400
+   // Visual Studio 8 or higher deprecate stricmp.
+   return _stricmp(s1, s2);
+#else
+   return stricmp(s1, s2);
+#endif
+}
+}
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+//    BoardListImpl* GetBoardListImpl()
+
+    inline BoardListImpl::BoardListImpl()
+    {
+      List = NULL;
+      Count = 0;
+    }
+
+    inline BoardListImpl::~BoardListImpl()
+    {
+      Clear();
+    }
+
+    inline void BoardListImpl::Clear()
+    {
+      int i;
+
+      if (List != NULL)
+      {
+        for (i = 0 ; i < Count ; i++)
+        {
+          if (List[i] != NULL)
+            delete List[i];
+        }
+        delete[] List;
+      }
+      List = NULL;
+      Count = 0;
+    }
+
+    // Initialization
+    inline void BoardListImpl::Init()
+    {
+      int i;
+
+      if (List != NULL) // Already initialized
+        return;
+
+      Config.GetParam(MC_BoardCount, Count);
+      if (Count > 0)
+      {
+        List = new Board *[Count];
+        for (i = 0 ; i < Count ; i++)
+          List[i] = NULL;
+        for (i = 0 ; i < Count ; i++)
+          List[i] = new Board(i);
+      }
+    }
+
+    // Accessors
+
+    inline Board *BoardListImpl::GetBoardByDriverIndex(int DriverIndex)
+    {
+      if (DriverIndex >= 0 && DriverIndex < Count)
+        return List[DriverIndex];
+      else
+      {
+        ThrowMultiCamException(MC_NO_BOARD_FOUND);
+        return NULL;
+      }
+    }
+
+    inline Board *BoardListImpl::GetBoardByPciPosition(int PciPosition)
+    {
+      int i;
+      int pos;
+
+      for (i = 0 ; i < Count ; i++)
+      {
+        List[i]->GetParam(MC_PciPosition, pos);
+        if (pos == PciPosition)
+          return List[i];
+      }
+
+      ThrowMultiCamException(MC_NO_BOARD_FOUND);
+      return NULL;
+    }
+
+    inline Board *BoardListImpl::GetBoardByBoardName(const char *BoardName)
+    {
+      int i;
+      char name[64];
+
+      for (i = 0 ; i < Count ; i++)
+      {
+        List[i]->GetParam(MC_BoardName, name, sizeof(name));
+        if (mc_stricmp(name, BoardName) == 0)
+          return List[i];
+      }
+
+      ThrowMultiCamException(MC_NO_BOARD_FOUND);
+      return NULL;
+    }
+
+    inline Board *BoardListImpl::GetBoardByBoardIdentifier(const char *BoardIdentifier)
+    {
+      int i;
+      char id[64];
+
+      for (i = 0 ; i < Count ; i++)
+      {
+        List[i]->GetParam(MC_BoardIdentifier, id, sizeof(id));
+        if (mc_stricmp(id, BoardIdentifier) == 0)
+          return List[i];
+      }
+
+      ThrowMultiCamException(MC_NO_BOARD_FOUND);
+      return NULL;
+    }
+
+    inline int BoardListImpl::GetCount()
+    {
+      return Count;
+    }
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_Callback.h b/Lib/EuresysCam/Include/MCpp_Callback.h
new file mode 100644
index 0000000..205d422
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_Callback.h
@@ -0,0 +1,47 @@
+// MCpp_Callback.h - MULTICAM C++ API - Callback
+#if !defined(__MCPP_CALLBACK_H__)
+#define __MCPP_CALLBACK_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // Callback class
+    // --------------
+    class Callback
+    {
+    public:
+      virtual ~Callback() = 0;
+      virtual void RunUntyped(MultiCamObjectWithSignaling *object, SignalInfo &info) = 0;
+    };
+
+    template <class T, class OwnerType> class UserCallback : public Callback
+    {
+    private:
+      T *Object;
+      void (T::*Function)(OwnerType &channel, SignalInfo &info);
+
+    public:
+      UserCallback(T *obj, void (T::*f)(OwnerType &channel, SignalInfo &info)) :
+          Object(obj),
+            Function(f)
+          {
+          }
+          inline ~UserCallback()
+          {
+          }
+
+          void Run(OwnerType &channel, SignalInfo &info)
+          {
+            (Object->*Function)(channel, info);
+          }
+          void RunUntyped(MultiCamObjectWithSignaling *caller, SignalInfo &info)
+          {
+            Run(*reinterpret_cast<OwnerType*>(caller), info);
+          }
+    };
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_CallbackImpl.h b/Lib/EuresysCam/Include/MCpp_CallbackImpl.h
new file mode 100644
index 0000000..6c4690b
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_CallbackImpl.h
@@ -0,0 +1,15 @@
+// MCpp_CallbackImpl.h - MULTICAM C++ API - CallbackImpl
+#if !defined(__MCPP_CALLBACKIMPL_H__)
+#define __MCPP_CALLBACKIMPL_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline Callback::~Callback()
+    {
+    }
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_Channel.h b/Lib/EuresysCam/Include/MCpp_Channel.h
new file mode 100644
index 0000000..832f66f
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_Channel.h
@@ -0,0 +1,56 @@
+// MCpp_Channel.h - MULTICAM C++ API - Channel
+#if !defined(__MCPP_CHANNEL_H__)
+#define __MCPP_CHANNEL_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+
+    // ********************************************************************************************
+    // Channel class
+    // -------------
+    class Channel : public MultiCamObjectWithSignaling
+    {
+      WRAPPING_MEMBERS
+
+    protected:
+      virtual Surface *GetSurface(MCHANDLE Handle);
+      Internal::Container<Surface*> *SurfaceList;
+      void InitChannel(Board *board);
+
+    public:
+      Channel(Board *board, int connector);
+      Channel(Board *board, const char *connector);
+      inline ~Channel();
+      operator MCHANDLE() { return Handle; }
+
+      void SetActive();
+      void SetIdle();
+      void Prepare();
+
+      template <class TT>
+      void RegisterCallback(TT *owner, void (TT::*callbackMethod)(Channel &, SignalInfo &), MCSIGNAL signal)
+      {
+        if (owner == NULL || callbackMethod == NULL)
+        {
+          ::Euresys::MultiCam::Exception e(MC_INTERNAL_ERROR, "Invalid callback object or function");
+          throw e;
+        }
+
+
+        Callback *cb = new UserCallback<TT, Channel>(owner, callbackMethod);
+        RegisterCallbackInternal(cb, signal);
+      }
+
+      Surface *GetSurfaceByIndex(unsigned int index)
+      {
+        Surface *surf;
+        GetParam(MC_Cluster + index, surf);
+        return surf;
+      }
+    };
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_ChannelImpl.h b/Lib/EuresysCam/Include/MCpp_ChannelImpl.h
new file mode 100644
index 0000000..ed4f369
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_ChannelImpl.h
@@ -0,0 +1,139 @@
+// MCpp_ChannelImpl.h - MULTICAM C++ API - ChannelImpl
+#if !defined(__MCPP_CHANNELIMPL_H__)
+#define __MCPP_CHANNELIMPL_H__
+
+#include "MCpp_Channel.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // Constructors
+    inline Channel::Channel(Board *b, int Connector) :
+    SurfaceList(NULL)
+    {
+      try {
+        InitChannel(b);
+        SetParam(MC_Connector, Connector);
+      } catch (...) {
+        if (Handle != 0)
+          McDelete(Handle);
+        delete SurfaceList;
+        throw;
+      }
+    }
+
+    inline Channel::Channel(Board *b, const char *Connector) :
+    SurfaceList(NULL)
+    {
+      try {
+        InitChannel(b);
+        SetParam(MC_Connector, Connector);
+      } catch (...) {
+        if (Handle != 0)
+          McDelete(Handle);
+        delete SurfaceList;
+        throw;
+      }
+    }
+
+    inline void Channel::InitChannel(Board *b)
+    {
+      WRAPPING_MEMBERS_INIT
+
+      MCSTATUS status;
+      MCHANDLE handle;
+      int boardIx;
+
+      status = McCreate(MC_CHANNEL, &handle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_CREATE, "Channel");
+      Handle = handle;
+
+      b->GetParam(MC_DriverIndex, boardIx);
+      SetParam(MC_DriverIndex, boardIx);
+
+      SurfaceList = new Internal::List<Surface *, 16>();
+    }
+
+    // Destructor
+    inline Channel::~Channel()
+    {
+      MCSTATUS status;
+      int i;
+
+      if (Handle != 0)
+      {
+        status = McDelete(Handle);
+        if (status != MC_OK)
+          ThrowMultiCamException(status, TYPE_DELETE, "Channel");
+      }
+
+      for (i = 0 ; i < SurfaceList->GetCount() ; i++)
+      {
+        if (SurfaceList->At(i) != NULL)
+          delete SurfaceList->At(i);
+      }
+      delete SurfaceList;
+
+      WRAPPING_MEMBERS_UNINIT
+    }
+
+    // Channel activation
+    inline void Channel::SetActive()
+    {
+      SetParam(MC_ChannelState, MC_ChannelState_ACTIVE);
+    }
+
+    // Channel deactivation
+    inline void Channel::SetIdle()
+    {
+      int state;
+
+      GetParam(MC_ChannelState, state);
+      if (state == MC_ChannelState_ACTIVE)
+        SetParam(MC_ChannelState, MC_ChannelState_IDLE);
+    }
+
+    // Channel preparation
+    inline void Channel::Prepare()
+    {
+      int state;
+
+      GetParam(MC_ChannelState, state);
+      if (state == MC_ChannelState_ORPHAN)
+        SetParam(MC_ChannelState, MC_ChannelState_IDLE);
+      else if (state != MC_ChannelState_ACTIVE)
+        SetParam(MC_ChannelState, MC_ChannelState_READY);
+    }
+
+    // Get Surface from handle
+    inline Surface *Channel::GetSurface(MCHANDLE sHandle)
+    {
+      MCSTATUS status;
+      void *address;
+      Surface *surface;
+
+      if ((sHandle & 0xF0000000) != (MC_DEFAULT_SURFACE_HANDLE & 0xF0000000))
+        ThrowMultiCamException(MC_INVALID_VALUE);
+      status = McGetParamPtr(sHandle, MC_sctxt, &address);
+      if (status != MC_OK)
+      {
+        Euresys::MultiCam::Exception e(status, "礐++ Internal Error");
+        throw e;
+      }
+
+      if (address != NULL)
+        surface = reinterpret_cast<Surface *>(address);
+      else
+      {
+        surface = new Surface(sHandle);
+        SurfaceList->Add(surface);
+      }
+
+      return surface;
+    }
+
+  }
+}
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_Configuration.h b/Lib/EuresysCam/Include/MCpp_Configuration.h
new file mode 100644
index 0000000..3d01a8d
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_Configuration.h
@@ -0,0 +1,61 @@
+// MCpp_Configuration.h - MULTICAM C++ API - Configuration
+#if !defined(__MCPP_CONFIGURATION_H__)
+#define __MCPP_CONFIGURATION_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // Configuration class
+    // -------------------
+    class ConfigurationImpl : public MultiCamObject
+    {
+    public:
+      ConfigurationImpl();
+      ~ConfigurationImpl();
+    };
+
+    ConfigurationImpl* GetConfigurationImpl();
+
+    class Configuration
+    {
+    public:
+      void SetParam(MCPARAMID param, int value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, unsigned int value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, INT64 value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, const char *value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, double value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, Surface &value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(MCPARAMID param, void *value) { GetConfigurationImpl()->SetParam(param, value); }
+
+      void SetParam(const char *param, int value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, unsigned int value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, INT64 value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, const char *value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, double value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, Surface &value) { GetConfigurationImpl()->SetParam(param, value); }
+      void SetParam(const char *param, void *value) { GetConfigurationImpl()->SetParam(param, value); }
+
+      void GetParam(MCPARAMID param, int &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, unsigned int &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, INT64 &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, char *value, int maxLength) { GetConfigurationImpl()->GetParam(param, value, maxLength); }
+      void GetParam(MCPARAMID param, double &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, Surface *&value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(MCPARAMID param, void *&value) { GetConfigurationImpl()->GetParam(param, value); }
+
+      void GetParam(const char *param, int &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, unsigned int &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, INT64 &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, char *value, int maxLength) { GetConfigurationImpl()->GetParam(param, value, maxLength); }
+      void GetParam(const char *param, double &value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, Surface *&value) { GetConfigurationImpl()->GetParam(param, value); }
+      void GetParam(const char *param, void *&value) { GetConfigurationImpl()->GetParam(param, value); }
+
+      MCHANDLE GetHandle() { return GetConfigurationImpl()->GetHandle(); }
+    };
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_ConfigurationImpl.h b/Lib/EuresysCam/Include/MCpp_ConfigurationImpl.h
new file mode 100644
index 0000000..da95add
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_ConfigurationImpl.h
@@ -0,0 +1,28 @@
+// MCpp_ConfigurationImpl.h - MULTICAM C++ API - ConfigurationImpl
+#if !defined(__MCPP_CONFIGURATIONIMPL_H__)
+#define __MCPP_CONFIGURATIONIMPL_H__
+
+#include "MCpp_Configuration.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline ConfigurationImpl::ConfigurationImpl()
+    {
+      Handle = MC_CONFIGURATION;
+    }
+
+    inline ConfigurationImpl::~ConfigurationImpl()
+    {
+    }
+
+    inline ConfigurationImpl* GetConfigurationImpl()
+    {
+      static ConfigurationImpl impl;
+      return &impl;
+    }
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_Exception.h b/Lib/EuresysCam/Include/MCpp_Exception.h
new file mode 100644
index 0000000..dde3a43
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_Exception.h
@@ -0,0 +1,32 @@
+// MCpp_Exception.h - MULTICAM C++ API - Exception
+#if !defined(__MCPP_EXCEPTION_H__)
+#define __MCPP_EXCEPTION_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // Exceptions
+    // ----------
+#define MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE	1024
+    struct Exception
+    {
+    private:
+      char McDescription[MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE];
+
+    public:
+      Exception(int error, const char *desc);
+      Exception(Exception &e);
+      Exception& operator=(Exception &e);
+      inline ~Exception();
+
+      int Error;
+      const char *What();
+      MCSTATUS GetMcStatus() { return Error; }
+    };
+
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_ExceptionImpl.h b/Lib/EuresysCam/Include/MCpp_ExceptionImpl.h
new file mode 100644
index 0000000..d2e30e2
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_ExceptionImpl.h
@@ -0,0 +1,41 @@
+// MCpp_ExceptionImpl.h - MULTICAM C++ API - ExceptionImpl
+#if !defined(__MCPP_EXCEPTIONIMPL_H__)
+#define __MCPP_EXCEPTIONIMPL_H__
+
+#include <cstring>
+#include "MCpp_Exception.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline Exception::Exception(INT32 anError, const char *desc)
+    {
+      Error = anError ;
+      strncpy(McDescription, desc, MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE);
+    }
+
+    inline Exception::Exception(Exception &e)
+    {
+      Error = e.Error ;
+      strncpy(McDescription, e.What(), MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE);
+    }
+
+    inline Exception& Exception::operator=(Exception& e) 
+    { 
+      Error = e.Error ;
+      strncpy(McDescription, e.What(), MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE);
+      return *this; 
+    }
+
+    inline Exception::~Exception()
+    {
+    }
+
+    inline const char *Exception::What()
+    {
+      return McDescription;
+    }
+  }
+}
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_MultiCamObject.h b/Lib/EuresysCam/Include/MCpp_MultiCamObject.h
new file mode 100644
index 0000000..f13ed68
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_MultiCamObject.h
@@ -0,0 +1,59 @@
+// MCpp_MulticamObject.h - MULTICAM C++ API - MulticamObject
+#if !defined(__MCPP_MULTICAMOBJECT_H__)
+#define __MCPP_MULTICAMOBJECT_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // MultiCamObject: base class for Configuration, Board, Surface and Channel classes
+    // --------------------------------------------------------------------------------
+    struct Exception;
+    class Surface;
+    class MultiCamObject
+    {
+    protected:
+      MCHANDLE Handle;
+      virtual Surface *GetSurface(MCHANDLE handle);
+    public:
+      MultiCamObject();
+      virtual ~MultiCamObject() {}
+
+    public:
+      void SetParam(MCPARAMID param, int value);
+      void SetParam(MCPARAMID param, unsigned int value);
+      void SetParam(MCPARAMID param, INT64 value);
+      void SetParam(MCPARAMID param, const char *value);
+      void SetParam(MCPARAMID param, double value);
+      void SetParam(MCPARAMID param, Surface &value);
+      void SetParam(MCPARAMID param, void *value);
+      void SetParam(const char *param, int value);
+      void SetParam(const char *param, unsigned int value);
+      void SetParam(const char *param, INT64 value);
+      void SetParam(const char *param, const char *value);
+      void SetParam(const char *param, double value);
+      void SetParam(const char *param, Surface &value);
+      void SetParam(const char *param, void *value);
+
+      void GetParam(MCPARAMID param, int &value);
+      void GetParam(MCPARAMID param, unsigned int &value);
+      void GetParam(MCPARAMID param, INT64 &value);
+      void GetParam(MCPARAMID param, char *value, int maxLength);
+      void GetParam(MCPARAMID param, double &value);
+      void GetParam(MCPARAMID param, Surface *&value);
+      void GetParam(MCPARAMID param, void *&value);
+      void GetParam(const char *param, int &value);
+      void GetParam(const char *param, unsigned int &value);
+      void GetParam(const char *param, INT64 &value);
+      void GetParam(const char *param, char *value, int maxLength);
+      void GetParam(const char *param, double &value);
+      void GetParam(const char *param, Surface *&value);
+      void GetParam(const char *param, void *&value);
+
+      MCHANDLE GetHandle();
+    };
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_MultiCamObjectImpl.h b/Lib/EuresysCam/Include/MCpp_MultiCamObjectImpl.h
new file mode 100644
index 0000000..17d3dd8
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_MultiCamObjectImpl.h
@@ -0,0 +1,264 @@
+// MCpp_MulticamObjectImpl.h - MULTICAM C++ API - MulticamObjectImpl
+#if !defined(__MCPP_MULTICAMOBJECTIMPL_H__)
+#define __MCPP_MULTICAMOBJECTIMPL_H__
+
+#include "MCpp_MultiCamObject.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline MultiCamObject::MultiCamObject() : Handle(0)
+    {
+    }
+
+    // Get Surface from handle
+    inline Surface *MultiCamObject::GetSurface(MCHANDLE )
+    {
+      ThrowMultiCamException(MC_BAD_PARAMETER);
+      return NULL;
+    }
+
+    // SetParam
+    inline void MultiCamObject::SetParam(MCPARAMID Param, int Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamInt(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, unsigned int Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamInt(Handle, Param, (INT32)Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, (int)Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, INT64 Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamInt64(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, const char *Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamStr(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, double Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamFloat(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, Surface &Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamInst(Handle, Param, Value.Handle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, (int)Value.Handle);
+    }
+    inline void MultiCamObject::SetParam(MCPARAMID Param, void *Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamPtr(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Handle, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, int Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmInt(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, unsigned int Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmInt(Handle, Param, (INT32)Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, (int)Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, INT64 Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmInt64(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, const char *Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmStr(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, double Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmFloat(Handle, Param, Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, Surface &Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmInst(Handle, Param, Value.Handle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_SET, Param, (int)Value.Handle);
+    }
+    inline void MultiCamObject::SetParam(const char *Param, void *Value)
+    {
+      MCSTATUS status;
+
+      status = McSetParamNmPtr(Handle, Param, Value);
+      if (status != MC_OK)
+          ThrowMultiCamException(status, TYPE_SET, Param, Value);
+    }
+
+    // GetParam
+    inline void MultiCamObject::GetParam(MCPARAMID Param, int &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamInt(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, unsigned int &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamInt(Handle, Param, (PINT32)&Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, INT64 &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamInt64(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, char *Value, int MaxLength)
+    {
+      MCSTATUS status;
+
+      status = McGetParamStr(Handle, Param, Value, MaxLength);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, double &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamFloat(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, Surface *&Value)
+    {
+      MCSTATUS status;
+      MCHANDLE sHandle;
+
+      status = McGetParamInst(Handle, Param, &sHandle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+
+      Value = GetSurface(sHandle);
+    }
+    inline void MultiCamObject::GetParam(MCPARAMID Param, void *&Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamPtr(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Handle, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, int &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmInt(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, unsigned int &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmInt(Handle, Param, (PINT32)&Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, INT64 &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmInt64(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, char *Value, int MaxLength)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmStr(Handle, Param, Value, MaxLength);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, double &Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmFloat(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, Surface *&Value)
+    {
+      MCSTATUS status;
+      MCHANDLE sHandle;
+
+      status = McGetParamNmInst(Handle, Param, &sHandle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+
+      Value = GetSurface(sHandle);
+    }
+    inline void MultiCamObject::GetParam(const char *Param, void *&Value)
+    {
+      MCSTATUS status;
+
+      status = McGetParamNmPtr(Handle, Param, &Value);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET, Param);
+    }
+
+    // GetHandle
+    inline MCHANDLE MultiCamObject::GetHandle()
+    {
+      return Handle;
+    }
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h b/Lib/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h
new file mode 100644
index 0000000..2685f3e
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_MultiCamObjectWithSignaling.h
@@ -0,0 +1,58 @@
+// MCpp_MulticamObjectWithSignaling.h - MULTICAM C++ API - MulticamObjectWithSignaling
+#if !defined(__MCPP_MULTICAMOBJECTWITHSIGNALING_H__)
+#define __MCPP_MULTICAMOBJECTWITHSIGNALING_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+
+    namespace Internal 
+    {
+      template<typename T>
+      class Container 
+      {
+      public:
+        Container() {}
+        virtual inline ~Container() {}
+        virtual T At(int Index) const = 0;
+        virtual int GetCount() const = 0;
+        virtual int Add(T &item) = 0;
+        virtual void Assign(int , T ) {}
+        virtual void DeleteAll() {}
+      };
+    }
+
+    class SignalInfo;
+    class Callback;
+    template <class T, class OwnerType> class UserCallback;
+
+    class MultiCamObjectWithSignaling : public MultiCamObject
+    {
+    private:
+      Internal::Container<Callback*> *Callbacks;
+      bool CbReg;
+
+      void GetSignalInfo(PMCSIGNALINFO mcInfo, SignalInfo *Info);
+
+    public:
+      void CbRoutine(PMCSIGNALINFO mcInfo);
+      void RegisterCallbackInternal(Callback *cb, MCSIGNAL Signal);
+
+      MultiCamObjectWithSignaling();
+      virtual ~MultiCamObjectWithSignaling();
+
+      void UnregisterCallback(MCSIGNAL signal);
+      void RegisterRawCallback(void *, void *, int);
+
+      void WaitSignal(MCSIGNAL signal, unsigned int timeout, SignalInfo &info) { WaitForSignal(signal, timeout, info); }
+      void WaitForSignal(MCSIGNAL signal, unsigned int timeout, SignalInfo &info);
+      void GetSignalInfo(MCSIGNAL signal, SignalInfo &info);
+
+    };
+
+
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h b/Lib/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h
new file mode 100644
index 0000000..774bdce
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_MultiCamObjectWithSignalingImpl.h
@@ -0,0 +1,142 @@
+// MCpp_MulticamObjectWithSignalingImpl.h - MULTICAM C++ API - MulticamObjectWithSignalingImpl
+#if !defined(__MCPP_MULTICAMOBJECTWITHSIGNALINGIMPL_H__)
+#define __MCPP_MULTICAMOBJECTWITHSIGNALINGIMPL_H__
+
+#include "MCpp_MultiCamObjectWithSignaling.h"
+#include "containers.h"
+#include "CCallbacks.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline MultiCamObjectWithSignaling::MultiCamObjectWithSignaling() : CbReg(false)
+    {
+      Callbacks = new Euresys::MultiCam::Internal::AssociativeArray < Callback* > ();
+    }
+
+    inline MultiCamObjectWithSignaling::~MultiCamObjectWithSignaling()
+    {
+      if (Callbacks != NULL)
+      {
+        Callbacks->DeleteAll();
+        delete Callbacks;
+      }
+    }
+
+    // Callback dispatcher routine
+    inline void MultiCamObjectWithSignaling::CbRoutine(PMCSIGNALINFO mcInfo)
+    {
+      SignalInfo info;
+      Callback *cb = NULL;
+
+      GetSignalInfo(mcInfo, &info);
+
+      if (info.Signal <= 0 )
+        return;
+
+      cb = Callbacks->At(info.Signal);
+      if (cb == NULL)
+        cb = Callbacks->At(MC_SIG_ANY);
+
+      if (cb != NULL)
+        cb->RunUntyped(this, info);
+    }
+
+    // WaitSignal
+    inline void MultiCamObjectWithSignaling::WaitForSignal(MCSIGNAL Signal, unsigned int Timeout, SignalInfo &Info)
+    {
+      MCSTATUS status;
+      MCSIGNALINFO mcInfo;
+
+      status = McWaitSignal(Handle, Signal, Timeout, &mcInfo);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_WAIT_SIGNAL);
+      GetSignalInfo(&mcInfo, &Info);
+    }
+
+    // GetSignalInfo
+    inline void MultiCamObjectWithSignaling::GetSignalInfo(MCSIGNAL Signal, SignalInfo &Info)
+    {
+      MCSTATUS status;
+      MCSIGNALINFO mcInfo;
+
+      status = McGetSignalInfo(Handle, Signal, &mcInfo);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_GET_SIGNALINFO);
+      GetSignalInfo(&mcInfo, &Info);
+    }
+
+    // Convert MCSIGNALINFO to Euresys.MultiCam.SignalInfo
+    inline void MultiCamObjectWithSignaling::GetSignalInfo(PMCSIGNALINFO mcInfo, SignalInfo *Info)
+    {
+      Info->Signal = mcInfo->Signal;
+
+      if (Info->Signal == MC_SIG_SURFACE_FILLED ||
+        Info->Signal == MC_SIG_SURFACE_PROCESSING)
+        Info->Surf = GetSurface(mcInfo->SignalInfo);
+      else
+        Info->Surf = NULL;
+    }
+
+    inline void MultiCamObjectWithSignaling::RegisterCallbackInternal(Callback *cb, MCSIGNAL Signal)
+    {
+      if (Signal < 0)
+        ThrowMultiCamException(MC_OUT_OF_BOUND, TYPE_REGISTER_CB);
+
+      // Register the user callback
+      if (Callbacks->At(Signal) != NULL)
+        delete Callbacks->At(Signal);
+      Callbacks->Assign(Signal, cb);
+
+      // Register the global callback function (if necessary)
+      if (!CbReg)
+      {
+        MCSTATUS status = McRegisterCallback(Handle, GlobalCallbackFunction, this);
+        if (status != MC_OK)
+          ThrowMultiCamException(status, TYPE_REGISTER_CB);
+        CbReg = true;
+      }
+    }
+
+    inline void MultiCamObjectWithSignaling::RegisterRawCallback(void *CbFunction, void *CbContext, int Signal)
+    {
+      if (CbFunction == NULL)
+      {
+        Euresys::MultiCam::Exception e(MC_INTERNAL_ERROR, "Invalid callback function");
+        throw e;
+      }
+
+      Callback *cb = new Euresys::MultiCam::CFunctionCallback(CbContext, (PMCPP_C_CALLBACK)CbFunction);
+      RegisterCallbackInternal(cb, Signal);
+    }
+
+    inline void MultiCamObjectWithSignaling::UnregisterCallback(MCSIGNAL Signal)
+    {
+      if (Signal < 0)
+        ThrowMultiCamException(MC_OUT_OF_BOUND, TYPE_UNREGISTER_CB);
+
+      // Unregister the user callback
+      Callback *cb = Callbacks->At(Signal);
+      Callbacks->Assign(Signal, NULL);
+      delete cb;
+
+      // Unregister the global callback function (if necessary)
+      if (CbReg)
+      {
+        int i;
+        int count = Callbacks->GetCount();
+        for (i = 0 ; i <= count && Callbacks->At(i) == NULL ; i++);
+        if (i > Callbacks->GetCount())
+        {
+          MCSTATUS status = McRegisterCallback(Handle, NULL, NULL);
+          if (status != MC_OK)
+            ThrowMultiCamException(status, TYPE_UNREGISTER_CB);
+          CbReg = false;
+        }
+      }
+    }
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_SignalInfo.h b/Lib/EuresysCam/Include/MCpp_SignalInfo.h
new file mode 100644
index 0000000..877d20b
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_SignalInfo.h
@@ -0,0 +1,30 @@
+// MCpp_SignalInfo.h - MULTICAM C++ API - SignalInfo
+#if !defined(__MCPP_SIGNALINFO_H__)
+#define __MCPP_SIGNALINFO_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // SignalInfo class
+    // ----------------
+    class SignalInfo
+    {
+      WRAPPING_MEMBERS
+
+    public:
+      SignalInfo() 
+      {
+        WRAPPING_MEMBERS_INIT
+      };
+      ~SignalInfo();
+
+    public:
+      MCSIGNAL Signal;
+      Surface *Surf;
+    };
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_SignalInfoImpl.h b/Lib/EuresysCam/Include/MCpp_SignalInfoImpl.h
new file mode 100644
index 0000000..2333c20
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_SignalInfoImpl.h
@@ -0,0 +1,18 @@
+// MCpp_SignalInfoImpl.h - MULTICAM C++ API - SignalInfoImpl
+#if !defined(__MCPP_SIGNALINFOIMPL_H__)
+#define __MCPP_SIGNALINFOIMPL_H__
+
+#include "MCpp_SignalInfo.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline SignalInfo::~SignalInfo()
+    {
+      WRAPPING_MEMBERS_UNINIT
+    }
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_Surface.h b/Lib/EuresysCam/Include/MCpp_Surface.h
new file mode 100644
index 0000000..3a6afda
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_Surface.h
@@ -0,0 +1,33 @@
+// MCpp_Surface.h - MULTICAM C++ API - Surface
+#if !defined(__MCPP_SURFACE_H__)
+#define __MCPP_SURFACE_H__
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // Surface class
+    // -------------
+
+    class Surface : public MultiCamObject
+    {
+      WRAPPING_MEMBERS
+
+    protected:
+      bool UserSurface;
+    public:
+      Surface(MCHANDLE aHandle);
+
+    public:
+      Surface();
+      inline ~Surface();
+      operator MCHANDLE() { return Handle; }
+
+      void Reserve();
+      void Free();
+    };
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_SurfaceImpl.h b/Lib/EuresysCam/Include/MCpp_SurfaceImpl.h
new file mode 100644
index 0000000..299578f
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_SurfaceImpl.h
@@ -0,0 +1,77 @@
+// MCpp_SurfaceImpl.h - MULTICAM C++ API - SurfaceImpl
+#if !defined(__MCPP_SURFACEIMPL_H__)
+#define __MCPP_SURFACEIMPL_H__
+
+#include "MCpp_Surface.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    inline Surface::Surface()
+    {
+      WRAPPING_MEMBERS_INIT
+
+      MCSTATUS status;
+      MCHANDLE handle;
+
+      status = McCreate(MC_DEFAULT_SURFACE_HANDLE, &handle);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_CREATE, "Surface");
+      Handle = handle;
+      UserSurface = true;
+
+      // Link the MultiCam Surface to this object
+      SetParam(MC_sctxt, this);
+    }
+
+    inline Surface::Surface(MCHANDLE aHandle)
+    {
+      WRAPPING_MEMBERS_INIT
+
+      Handle = aHandle;
+      UserSurface = false;
+
+      // Link the MultiCam Surface to this object
+      SetParam(MC_sctxt, this);
+    }
+
+    inline Surface::~Surface()
+    {
+      MCSTATUS status;
+
+      if (Handle != 0)
+      {
+        if (UserSurface)
+        {
+          status = McDelete(Handle);
+          if (status != MC_OK)
+            ThrowMultiCamException(status, TYPE_DELETE, "Surface");
+        }
+        else
+        {
+          try {
+            SetParam(MC_sctxt, (void *)NULL);
+          }
+          catch (Euresys::MultiCam::Exception &) // MultiCam may already have deleted the surface
+          {
+          }
+        }
+      }
+      WRAPPING_MEMBERS_UNINIT
+    }
+
+    // Manual surface reservation
+    inline void Surface::Reserve()
+    {
+      SetParam(MC_SurfaceState, MC_SurfaceState_RESERVED);
+    }
+
+    inline void Surface::Free()
+    {
+      SetParam(MC_SurfaceState, MC_SurfaceState_FREE);
+    }
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_global.h b/Lib/EuresysCam/Include/MCpp_global.h
new file mode 100644
index 0000000..db0d786
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_global.h
@@ -0,0 +1,65 @@
+// MCpp_globalImpl.h - MULTICAM C++ API - GlobalsImpl
+#if !defined(__MCPP_GLOBAL_H__)
+#define __MCPP_GLOBAL_H__
+
+// ****************************************************************************************************
+// Exception description
+//
+//typedef
+typedef enum
+{
+  TYPE_NO_OP,
+  TYPE_SET,
+  TYPE_GET,
+  TYPE_CREATE,
+  TYPE_DELETE,
+  TYPE_WAIT_SIGNAL,
+  TYPE_GET_SIGNALINFO,
+  TYPE_REGISTER_CB,
+  TYPE_UNREGISTER_CB,
+  TYPE_OPENDRIVER,
+  TYPE_PARAMINFO,
+  TYPE_ENUMERATE
+} OperationType;
+
+static const char *OperationStr[] =
+{
+  "",
+  "Cannot set param",
+  "Cannot get param",
+  "Cannot create",
+  "Cannot delete",
+  "Wait Signal Error",
+  "Get Signal Information Error",
+  "Register Callback Error",
+  "Unregister Callback Error",
+  "Cannot open MultiCam driver",
+  "Cannot get parameter info",
+  "Enumerate parameters Error"
+};
+
+void MCAPI GlobalCallbackFunction(PMCSIGNALINFO CbInfo);
+void ThrowMultiCamException(MCSTATUS reportedStatus, OperationType Type = TYPE_NO_OP, const char *Name = NULL, const char *Value = NULL);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE , MCPARAMID ParamId, const char *Value = NULL);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, int Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, INT64 Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, double Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, void *Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, int Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, INT64 Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, double Value);
+void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, void *Value);
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // MultiCam initialization and cleanup functions
+    // ---------------------------------------------
+    void Initialize();
+    void Terminate();
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/MCpp_globalImpl.h b/Lib/EuresysCam/Include/MCpp_globalImpl.h
new file mode 100644
index 0000000..8d0e4ec
--- /dev/null
+++ b/Lib/EuresysCam/Include/MCpp_globalImpl.h
@@ -0,0 +1,136 @@
+// MCpp_globalImpl.h - MULTICAM C++ API - GlobalsImpl
+#if !defined(__MCPP_GLOBALIMPL_H__)
+#define __MCPP_GLOBALIMPL_H__
+
+#include "MCpp_global.h"
+#include <cstdio>
+
+// ****************************************************************************************************
+// Global callback function
+// ------------------------
+
+inline void MCAPI GlobalCallbackFunction(PMCSIGNALINFO CbInfo)
+{
+  Euresys::MultiCam::MultiCamObjectWithSignaling *signaler = reinterpret_cast<Euresys::MultiCam::MultiCamObjectWithSignaling *>(CbInfo->Context);
+  if (signaler != NULL)
+    signaler->CbRoutine(CbInfo);
+}
+
+
+inline void ThrowMultiCamException(MCSTATUS reportedStatus, OperationType Type, const char *Name, const char *Value)
+{
+  int aStatus = -reportedStatus;
+  char ErrorDesc[256];
+
+  char Description[MCPP_MAX_EXCEPTION_DESCRIPTION_SIZE];
+
+  if (McGetParamStr(MC_CONFIGURATION, MC_ErrorDesc+aStatus, ErrorDesc, 256) != MC_OK)
+    sprintf(ErrorDesc, "Unknown error");
+
+  if (Type == TYPE_NO_OP)
+    sprintf(Description, "%s", ErrorDesc);
+
+  else if (Type == TYPE_SET)
+    sprintf(Description, "%s '%s' to value '%s': %s", OperationStr[Type], Name? Name:"Unknown parameter", Value? Value:"", ErrorDesc);
+
+  else if (Type == TYPE_GET)
+    sprintf(Description, "%s '%s': %s", OperationStr[Type], Name? Name:"unknown parameter", ErrorDesc);
+
+  else if (Type == TYPE_CREATE || Type == TYPE_DELETE)
+    sprintf(Description, "%s %s: %s", OperationStr[Type], Name? Name:"", ErrorDesc);
+
+  else
+    sprintf(Description, "%s: %s", OperationStr[Type], ErrorDesc);
+
+  Euresys::MultiCam::Exception e(reportedStatus, Description);
+  throw e;
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE , MCPARAMID ParamId, const char *Value)
+{
+  char paramStr[64];
+
+  sprintf(paramStr, "%i", ParamId);
+  ThrowMultiCamException(reportedStatus, Type, paramStr, Value);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, int Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%d", Value);
+  ThrowMultiCamException(reportedStatus, Type, Name, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, INT64 Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "0x%llx", Value);
+  ThrowMultiCamException(reportedStatus, Type, Name, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, double Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%f", Value);
+  ThrowMultiCamException(reportedStatus, Type, Name, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, const char *Name, void *Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%p", Value);
+  ThrowMultiCamException(reportedStatus, Type, Name, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, int Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%d", Value);
+  ThrowMultiCamException(reportedStatus, Type, Instance, ParamId, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, double Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%f", Value);
+  ThrowMultiCamException(reportedStatus, Type, Instance, ParamId, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, INT64 Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "0x%llx", Value);
+  ThrowMultiCamException(reportedStatus, Type, Instance, ParamId, ValueStr);
+}
+
+inline void ThrowMultiCamException (MCSTATUS reportedStatus, OperationType Type, MCHANDLE Instance, MCPARAMID ParamId, void *Value)
+{
+  char ValueStr[64];
+  sprintf(ValueStr, "%p", Value);
+  ThrowMultiCamException(reportedStatus, Type, Instance, ParamId, ValueStr);
+}
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    // ********************************************************************************************
+    // MultiCam initialization and cleanup functions
+    // ---------------------------------------------
+    inline void Initialize()
+    {
+      MCSTATUS status;
+      status = McOpenDriver(NULL);
+      if (status != MC_OK)
+        ThrowMultiCamException(status, TYPE_OPENDRIVER);
+      Boards.Init();
+    }
+
+    inline void Terminate()
+    {
+      McCloseDriver();
+    }
+  }
+}
+
+#endif
diff --git a/Lib/EuresysCam/Include/McDef.h b/Lib/EuresysCam/Include/McDef.h
new file mode 100644
index 0000000..8539bf2
--- /dev/null
+++ b/Lib/EuresysCam/Include/McDef.h
@@ -0,0 +1,72 @@
+
+// MCDEF.H -- MULTICAM DEFINITIONS
+
+#ifndef _MULTICAM_DEF_
+#define _MULTICAM_DEF_
+
+// CALLBACK REASONS
+#define MC_MAX_EVENTS                       12
+#define MC_SIG_ANY                          0
+#define MC_SIG_SURFACE_PROCESSING           1
+#define MC_SIG_SURFACE_FILLED               2
+#define MC_SIG_UNRECOVERABLE_OVERRUN        3
+#define MC_SIG_FRAMETRIGGER_VIOLATION       4
+#define MC_SIG_START_EXPOSURE               5
+#define MC_SIG_END_EXPOSURE                 6
+#define MC_SIG_ACQUISITION_FAILURE          7
+#define MC_SIG_CLUSTER_UNAVAILABLE          8
+#define MC_SIG_RELEASE                      9
+#define MC_SIG_END_ACQUISITION_SEQUENCE     10
+#define MC_SIG_START_ACQUISITION_SEQUENCE   11
+#define MC_SIG_END_CHANNEL_ACTIVITY         12
+
+#define MC_SIG_GOLOW            (1 << 12)
+#define MC_SIG_GOHIGH           (2 << 12)
+#define MC_SIG_GOOPEN           (3 << 12)
+
+#define MC_MAX_BOARD_EVENTS     (3 << 12)
+
+// STATUS CODE
+#define MC_MAX_ERRORS_STD               27
+#define MC_OK                           0
+#define MC_NO_BOARD_FOUND               -1
+#define MC_BAD_PARAMETER                -2
+#define MC_IO_ERROR                     -3
+#define MC_INTERNAL_ERROR               -4
+#define MC_NO_MORE_RESOURCES            -5
+#define MC_IN_USE                       -6
+#define MC_NOT_SUPPORTED                -7
+#define MC_DATABASE_ERROR               -8
+#define MC_OUT_OF_BOUND                 -9
+#define MC_INSTANCE_NOT_FOUND           -10
+#define MC_INVALID_HANDLE               -11
+#define MC_TIMEOUT                      -12
+#define MC_INVALID_VALUE                -13
+#define MC_RANGE_ERROR                  -14
+#define MC_BAD_HW_CONFIG                -15
+#define MC_NO_EVENT                     -16
+#define MC_LICENSE_NOT_GRANTED          -17
+#define MC_FATAL_ERROR                  -18
+#define MC_HW_EVENT_CONFLICT            -19
+#define MC_FILE_NOT_FOUND               -20
+#define MC_OVERFLOW                     -21
+#define MC_INVALID_PARAMETER_SETTING    -22
+#define MC_PARAMETER_ILLEGAL_ACCESS     -23
+#define MC_CLUSTER_BUSY                 -24
+#define MC_SERVICE_ERROR                -25
+#define MC_INVALID_SURFACE              -26
+
+#define MC_MAX_ERRORS_MPF               3
+#define MC_MPF_ERROR_BASE               -100
+#define MC_BAD_GRABBER_CONFIG           -101
+#define MC_ILLEGAL_PAGELENGTH_VALUE     -102
+
+// MULTICAM CONSTANTS
+#define MC_INFINITE         -1
+#define MC_INDETERMINATE    -1
+#define MC_LOW_PART         0
+#define MC_HIGH_PART        1
+#define MC_DISABLE          0
+#define MC_UNKNOWN          -2
+
+#endif // _MULTICAM_DEF_
diff --git a/Lib/EuresysCam/Include/McIo.h b/Lib/EuresysCam/Include/McIo.h
new file mode 100644
index 0000000..ec5b079
--- /dev/null
+++ b/Lib/EuresysCam/Include/McIo.h
@@ -0,0 +1,231 @@
+
+// MCIO.H -- MULTICAM IO DEFINITIONS
+
+#ifndef _MULTICAM_IO_
+#define _MULTICAM_IO_
+
+// I/O ADDRESSING
+#define MC_A1IN         28
+#define MC_A1OUT        28
+#define MC_A2IN         29
+#define MC_A2OUT        29
+#define MC_ACC1         21
+#define MC_ACC2         22
+#define MC_ACC3         23
+#define MC_ACC4         24
+#define MC_ACK          27
+#define MC_ADVAL        23
+#define MC_AFVAL        22
+#define MC_ALVAL        21
+#define MC_ASPARE       24
+#define MC_B1IN         38
+#define MC_B1OUT        38
+#define MC_B2IN         39
+#define MC_B2OUT        39
+#define MC_BCC1         31
+#define MC_BCC2         32
+#define MC_BCC3         33
+#define MC_BCC4         34
+#define MC_BCK          37
+#define MC_BDVAL        33
+#define MC_BFVAL        32
+#define MC_BLVAL        31
+#define MC_BSPARE       34
+#define MC_CC1          21
+#define MC_CC2          22
+#define MC_CC3          23
+#define MC_CC4          24
+#define MC_CK           27
+#define MC_DVAL         23
+#define MC_FVAL         22
+#define MC_GRN          52
+#define MC_GRNA         52
+#define MC_GRNB         54
+#define MC_GRNX         52
+#define MC_GRNY         54
+#define MC_GRNZ         56
+#define MC_IN1          1
+#define MC_IN2          2
+#define MC_IN3          3
+#define MC_IN4          4
+#define MC_IN5          5
+#define MC_IN6          6
+#define MC_IN7          7
+#define MC_IN8          8
+#define MC_IN9          9
+#define MC_IN10         10
+#define MC_IN11         11
+#define MC_IN12         12
+#define MC_IN13         13
+#define MC_IN14         14
+#define MC_IN15         15
+#define MC_IN16         16
+#define MC_IN17         17
+#define MC_IN18         18
+#define MC_IN19         19
+#define MC_IN20         20
+#define MC_LVAL         21
+#define MC_OUT1         1
+#define MC_OUT2         2
+#define MC_OUT3         3
+#define MC_OUT4         4
+#define MC_OUT5         5
+#define MC_OUT6         6
+#define MC_OUT7         7
+#define MC_OUT8         8
+#define MC_OUT9         9
+#define MC_OUT10        10
+#define MC_OUT11        11
+#define MC_OUT12        12
+#define MC_OUT13        13
+#define MC_OUT14        14
+#define MC_OUT15        15
+#define MC_OUT16        16
+#define MC_OUT17        17
+#define MC_OUT18        18
+#define MC_OUT19        19
+#define MC_OUT20        20
+#define MC_RED          51
+#define MC_REDA         51
+#define MC_REDB         53
+#define MC_REDX         51
+#define MC_REDY         53
+#define MC_REDZ         55
+#define MC_SPARE        24
+#define MC_STR          17
+#define MC_STX          17
+#define MC_STY          18
+#define MC_STZ          19
+#define MC_TRG          17
+#define MC_TRX          17
+#define MC_TRY          18
+#define MC_TRZ          19
+#define MC_XCK          27
+#define MC_XEIN         26
+#define MC_XEOUT        26
+#define MC_XGIN         24
+#define MC_XGOUT        24
+#define MC_XHIN         23
+#define MC_XHOUT        23
+#define MC_XRIN         22
+#define MC_XROUT        22
+#define MC_XVIN         25
+#define MC_XVOUT        25
+#define MC_YCK          37
+#define MC_YEIN         36
+#define MC_YEOUT        36
+#define MC_YGIN         34
+#define MC_YGOUT        34
+#define MC_YHIN         33
+#define MC_YHOUT        33
+#define MC_YRIN         32
+#define MC_YROUT        32
+#define MC_YVIN         35
+#define MC_YVOUT        35
+#define MC_ZCK          47
+#define MC_ZEIN         46
+#define MC_ZEOUT        46
+#define MC_ZGIN         44
+#define MC_ZGOUT        44
+#define MC_ZHIN         43
+#define MC_ZHOUT        43
+#define MC_ZRIN         42
+#define MC_ZROUT        42
+#define MC_ZVIN         45
+#define MC_ZVOUT        45
+#define MC_MV0_IN1      21
+#define MC_MV0_IN2      22
+#define MC_MV0_IN3      23
+#define MC_MV0_IN4      24
+#define MC_MV0_IN5      25
+#define MC_MV1_IN1      26
+#define MC_MV1_IN2      27
+#define MC_MV1_IN3      28
+#define MC_MV1_IN4      29
+#define MC_MV1_IN5      30
+#define MC_MV2_IN1      31
+#define MC_MV2_IN2      32
+#define MC_MV2_IN3      33
+#define MC_MV2_IN4      34
+#define MC_MV2_IN5      35
+#define MC_MV3_IN1      36
+#define MC_MV3_IN2      37
+#define MC_MV3_IN3      38
+#define MC_MV3_IN4      39
+#define MC_MV3_IN5      40
+#define MC_MV0_OUT1     21
+#define MC_MV0_OUT2     22
+#define MC_MV0_OUT3     23
+#define MC_MV0_OUT4     24
+#define MC_MV0_OUT5     25
+#define MC_MV1_OUT1     26
+#define MC_MV1_OUT2     27
+#define MC_MV1_OUT3     28
+#define MC_MV1_OUT4     29
+#define MC_MV1_OUT5     30
+#define MC_MV2_OUT1     31
+#define MC_MV2_OUT2     32
+#define MC_MV2_OUT3     33
+#define MC_MV2_OUT4     34
+#define MC_MV2_OUT5     35
+#define MC_MV3_OUT1     36
+#define MC_MV3_OUT2     37
+#define MC_MV3_OUT3     38
+#define MC_MV3_OUT4     39
+#define MC_MV3_OUT5     40
+#define MC_MIO0_IN1     100
+#define MC_MIO0_IN2     101
+#define MC_MIO0_IN3     102
+#define MC_MIO0_IN4     103
+#define MC_MIO1_IN1     104
+#define MC_MIO1_IN2     105
+#define MC_MIO1_IN3     106
+#define MC_MIO1_IN4     107
+#define MC_MIO2_IN1     108
+#define MC_MIO2_IN2     109
+#define MC_MIO2_IN3     110
+#define MC_MIO2_IN4     111
+#define MC_MIO3_IN1     112
+#define MC_MIO3_IN2     113
+#define MC_MIO3_IN3     114
+#define MC_MIO3_IN4     115
+#define MC_MIO4_IN1     116
+#define MC_MIO4_IN2     117
+#define MC_MIO4_IN3     118
+#define MC_MIO4_IN4     119
+#define MC_MIOSB_IN1    120
+#define MC_MIOSB_IN2    121
+#define MC_MIOSB_IN3    122
+#define MC_MIOSB_IN4    123
+#define MC_MIOSB_IN5    124
+#define MC_MIOSB_IN6    125
+#define MC_MIO0_OUT1    100
+#define MC_MIO0_OUT2    101
+#define MC_MIO0_OUT3    102
+#define MC_MIO0_OUT4    103
+#define MC_MIO1_OUT1    104
+#define MC_MIO1_OUT2    105
+#define MC_MIO1_OUT3    106
+#define MC_MIO1_OUT4    107
+#define MC_MIO2_OUT1    108
+#define MC_MIO2_OUT2    109
+#define MC_MIO2_OUT3    110
+#define MC_MIO2_OUT4    111
+#define MC_MIO3_OUT1    112
+#define MC_MIO3_OUT2    113
+#define MC_MIO3_OUT3    114
+#define MC_MIO3_OUT4    115
+#define MC_MIO4_OUT1    116
+#define MC_MIO4_OUT2    117
+#define MC_MIO4_OUT3    118
+#define MC_MIO4_OUT4    119
+#define MC_MIOSB_OUT1   120
+#define MC_MIOSB_OUT2   121
+#define MC_MIOSB_OUT3   122
+#define MC_MIOSB_OUT4   123
+#define MC_MIOSB_OUT5   124
+#define MC_MIOSB_OUT6   125
+
+#define MC_MAX_IO_INDEX 125
+
+#endif // _MULTICAM_IO_
diff --git a/Lib/EuresysCam/Include/McParams.h b/Lib/EuresysCam/Include/McParams.h
new file mode 100644
index 0000000..42648bf
--- /dev/null
+++ b/Lib/EuresysCam/Include/McParams.h
@@ -0,0 +1,20872 @@
+// McParams.h Parameter Identifier File
+// Created: 2018/04/23
+// This file has been generated automatically and should not be modified
+#ifndef _McParams_
+#define _McParams_
+
+
+#define MC_DriverIndex                           (MCPARAMID)(    0 << 14)
+#define MC_PciPosition                           (MCPARAMID)(    1 << 14)
+#define MC_BoardName                             (MCPARAMID)(    2 << 14)
+#define MC_BoardIdentifier                       (MCPARAMID)(    3 << 14)
+#define MC_NameBoard                             (MCPARAMID)(    4 << 14)
+#define MC_SerialNumber                          (MCPARAMID)(    5 << 14)
+#define MC_BoardType                             (MCPARAMID)(    6 << 14)
+#define MC_BoardType_MULTI                         1
+#define MC_BoardType_MULTIPLUS                     2
+#define MC_BoardType_MULTIEXPRESS                  3
+#define MC_BoardType_GAMMA                         4
+#define MC_BoardType_ALPHA                         5
+#define MC_BoardType_PRESTISSIMO                   6
+#define MC_BoardType_VALUE                         7
+#define MC_BoardType_EXPERT                        8
+#define MC_BoardType_STREAM                        9
+#define MC_BoardType_ALPHA_CPCI                   10
+#define MC_BoardType_IOTA                         11
+#define MC_BoardType_ALPHA_2                      12
+#define MC_BoardType_PICOLO                       13
+#define MC_BoardType_PICOLO_PRO2                  14
+#define MC_BoardType_PICOLO_PRO3I                 15
+#define MC_BoardType_PICOLO_PRO3E                 16
+#define MC_BoardType_PICOLO_TETRA                 17
+#define MC_BoardType_PICOLO_JETX                  18
+#define MC_BoardType_EXPERT_2                     19
+#define MC_BoardType_EXPERT_2_CPCI                20
+#define MC_BoardType_VALUE_CPCI                   21
+#define MC_BoardType_COLORSCAN                    22
+#define MC_BoardType_COLORSCAN_CPCI               23
+#define MC_BoardType_PICOLO_TETRAX                24
+#define MC_BoardType_JUNIOR_4                     25
+#define MC_BoardType_DOMINO_HARMONY               26
+#define MC_BoardType_DOMINO_MELODY                27
+#define MC_BoardType_DOMINO_SYMPHONY              28
+#define MC_BoardType_DOMINO_DELTA                 29
+#define MC_BoardType_GRABLINK_AVENUE              30
+#define MC_BoardType_PICOLO_ALERT                 31
+#define MC_BoardType_PICOLO_DILIGENT              32
+#define MC_BoardType_PICOLO_TYMO                  33
+#define MC_BoardType_PICOLO_FULL_ALERT            34
+#define MC_BoardType_PICOLO_ALERT_RC              35
+#define MC_BoardType_QUICKPACK_CFA                36
+#define MC_BoardType_PICOLO_ALERT_PCIe            37
+#define MC_BoardType_GRABLINK_EXPRESS_PCIe        38
+#define MC_BoardType_PICOLO_DILIGENT_PLUS_PCIe    39
+#define MC_BoardType_PICOLO_ALERT_RC_PCIe         40
+#define MC_BoardType_DOMINO_SYMPHONY_PCI          41
+#define MC_BoardType_DOMINO_SYMPHONY_PCIe         42
+#define MC_BoardType_GRABLINK_QUICKPACK_CFA_PCIe  43
+#define MC_BoardType_GRABLINK_FULL                44
+#define MC_BoardType_GRABLINK_DUALBASE            45
+#define MC_BoardType_GRABLINK_BASE                46
+#define MC_BoardType_GRABLINK_FULL_XR             47
+#define MC_ModuleType                            (MCPARAMID)(    7 << 14)
+#define MC_ModuleType_NONE                         1
+#define MC_ModuleType_DIG16                        2
+#define MC_ModuleType_DIG32                        3
+#define MC_ModuleType_DIG16_C_2K644                4
+#define MC_ModuleType_DIG16_C_2K422                5
+#define MC_ModuleType_DIG16_C_CUSTOM               6
+#define MC_ModuleType_DIG32_B_8K644                7
+#define MC_ModuleType_DIG32_B_2K422                8
+#define MC_ModuleType_DIG32_B_CUSTOM               9
+#define MC_ModuleType_DIG32_644                   10
+#define MC_ModuleType_DIG32_C_2K422               11
+#define MC_ModuleType_DIG32_C_CUSTOM              12
+#define MC_ModuleType_DIG16_644                   13
+#define MC_ModuleType_DIG16_422                   14
+#define MC_ModuleType_DIG32_422                   15
+#define MC_ModuleType_CAMERALINK                  16
+#define MC_OemSafetyLock                         (MCPARAMID)(    8 << 14)
+#define MC_OemSafetyKey                          (MCPARAMID)(    9 << 14)
+#define MC_EvolutionNumber                       (MCPARAMID)(   10 << 14)
+#define MC_CamFile                               (MCPARAMID)(   11 << 14)
+#define MC_Cluster                               (MCPARAMID)(   12 << 14)
+#define MC_ClusterMode                           (MCPARAMID)(   13 << 14)
+#define MC_ClusterMode_AUTO                        1
+#define MC_ClusterMode_MANUAL                      2
+#define MC_ClusterMask                           (MCPARAMID)(   14 << 14)
+#define MC_ClusterMask_NONE                        1
+#define MC_ClusterMask_SKIP                        2
+#define MC_ClusterMask_HOLD                        3
+#define MC_ClusterMask_DELAY                       4
+#define MC_ClusterMask_STOP                        5
+#define MC_ChannelState                          (MCPARAMID)(   15 << 14)
+#define MC_ChannelState_IDLE                       1
+#define MC_ChannelState_ACTIVE                     2
+#define MC_ChannelState_READY                      3
+#define MC_ChannelState_FREE                       4
+#define MC_ChannelState_ORPHAN                     5
+#define MC_LineIndex                             (MCPARAMID)(   16 << 14)
+#define MC_SurfaceIndex                          (MCPARAMID)(   17 << 14)
+#define MC_TriggerMode                           (MCPARAMID)(   18 << 14)
+#define MC_TriggerMode_TIMER                       1
+#define MC_TriggerMode_GRABBER                     2
+#define MC_InitialPause                          (MCPARAMID)(   19 << 14)
+#define MC_Pause                                 (MCPARAMID)(   20 << 14)
+#define MC_InitialTrigger                        (MCPARAMID)(   21 << 14)
+#define MC_Trigger                               (MCPARAMID)(   22 << 14)
+#define MC_Trigger_PAUSE                           1
+#define MC_Trigger_GOHIGH                          2
+#define MC_Trigger_GOLOW                           3
+#define MC_GrabCount                             (MCPARAMID)(   23 << 14)
+#define MC_SignalEnable                          (MCPARAMID)(   24 << 14)
+#define MC_SignalEnable_NONE                       1
+#define MC_SignalEnable_PROCESSING                 2
+#define MC_SignalEnable_FILLED                     3
+#define MC_SignalEnable_OFF                        4
+#define MC_SignalEnable_ON                         5
+#define MC_SignalEnable_AFTER_EAS                  6
+#define MC_SignalEvent                           (MCPARAMID)(   25 << 14)
+#define MC_Usage                                 (MCPARAMID)(   26 << 14)
+#define MC_SurfaceSize                           (MCPARAMID)(   27 << 14)
+#define MC_SurfaceAddr                           (MCPARAMID)(   28 << 14)
+#define MC_SurfacePitch                          (MCPARAMID)(   29 << 14)
+#define MC_PlaneCount                            (MCPARAMID)(   30 << 14)
+#define MC_SurfaceState                          (MCPARAMID)(   31 << 14)
+#define MC_SurfaceState_FREE                       1
+#define MC_SurfaceState_FILLING                    2
+#define MC_SurfaceState_FILLED                     3
+#define MC_SurfaceState_PROCESSING                 4
+#define MC_SurfaceState_RESERVED                   5
+#define MC_SurfaceContext                        (MCPARAMID)(   32 << 14)
+#define MC_DebugMode                             (MCPARAMID)(   33 << 14)
+#define MC_ResourceId                            (MCPARAMID)(   34 << 14)
+#define MC_ResourceId_DSP1                         1
+#define MC_ResourceId_DSP2                         2
+#define MC_ResourceId_DSP12                        3
+#define MC_ResourceId_DSP3                         3
+#define MC_ResourceId_DSP4                         4
+#define MC_Source                                (MCPARAMID)(   35 << 14)
+#define MC_ProcessFile                           (MCPARAMID)(   36 << 14)
+#define MC_Black                                 (MCPARAMID)(   37 << 14)
+#define MC_White                                 (MCPARAMID)(   38 << 14)
+#define MC_BlackProfile                          (MCPARAMID)(   39 << 14)
+#define MC_WhiteProfile                          (MCPARAMID)(   40 << 14)
+#define MC_ProcessType                           (MCPARAMID)(   41 << 14)
+#define MC_ProcessorState                        (MCPARAMID)(   42 << 14)
+#define MC_ProcessorState_OFF                      1
+#define MC_ProcessorState_ON                       2
+#define MC_FillCount                             (MCPARAMID)(   43 << 14)
+#define MC_Gain                                  (MCPARAMID)(   44 << 14)
+#define MC_PageDuration                          (MCPARAMID)(   45 << 14)
+#define MC_OverrunCount                          (MCPARAMID)(   46 << 14)
+#define MC_Level                                 (MCPARAMID)(   47 << 14)
+#define MC_SurfaceLocation                       (MCPARAMID)(   48 << 14)
+#define MC_SurfaceLocation_HOST                    1
+#define MC_SurfaceLocation_DSP                     2
+#define MC_SurfaceLocation_BOARD                   3
+#define MC_SurfaceLocation_PHYSICAL                4
+#define MC_ErrorHandling                         (MCPARAMID)(   49 << 14)
+#define MC_ErrorHandling_NONE                      1
+#define MC_ErrorHandling_MSGBOX                    2
+#define MC_ErrorHandling_EXCEPTION                 3
+#define MC_ErrorHandling_MSGEXCEPTION              4
+#define MC_ForceTrig                             (MCPARAMID)(   50 << 14)
+#define MC_ForceTrig_TRIG                          1
+#define MC_ParamBlock                            (MCPARAMID)(   51 << 14)
+#define MC_SurfaceFormat                         (MCPARAMID)(   52 << 14)
+#define MC_SurfaceFormat_RAW                       1
+#define MC_SurfaceFormat_RGB24                     2
+#define MC_SurfaceFormat_PLANAR24                  3
+#define MC_SurfaceFormat_SPLITX                    4
+#define MC_Lookup                                (MCPARAMID)(   53 << 14)
+#define MC_Flags                                 (MCPARAMID)(   54 << 14)
+#define MC_HardwareKey                           (MCPARAMID)(   55 << 14)
+#define MC_AcqTimeout_ms                         (MCPARAMID)(   56 << 14)
+#define MC_LineTriggerViolation                  (MCPARAMID)(   57 << 14)
+#define MC_FrameTriggerViolation                 (MCPARAMID)(   58 << 14)
+#define MC_BoardTopology                         (MCPARAMID)(   59 << 14)
+#define MC_BoardTopology_3_3_0                     1
+#define MC_BoardTopology_2_3_1                     2
+#define MC_BoardTopology_2_2_2                     3
+#define MC_BoardTopology_2_2_1                     4
+#define MC_BoardTopology_1_3_1                     5
+#define MC_BoardTopology_1_1_2                     6
+#define MC_BoardTopology_1_1_1                     7
+#define MC_BoardTopology_2_2_11                    8
+#define MC_BoardTopology_11_3_1                    9
+#define MC_BoardTopology_11_11_2                  10
+#define MC_BoardTopology_11_11_11                 11
+#define MC_BoardTopology_0_3_1                    12
+#define MC_BoardTopology_2_2_0                    13
+#define MC_BoardTopology_2_2                      14
+#define MC_BoardTopology_2_1                      15
+#define MC_BoardTopology_1_1                      16
+#define MC_BoardTopology_2_11                     17
+#define MC_BoardTopology_11_11                    18
+#define MC_BoardTopology_0_2                      19
+#define MC_BoardTopology_1_1_1_1                  20
+#define MC_GrabberConfig                         (MCPARAMID)(   60 << 14)
+#define MC_GrabberConfig_1_1_1                     1
+#define MC_GrabberConfig_1_1_2                     2
+#define MC_GrabberConfig_2_0                       3
+#define MC_GrabberConfig_1_1                       4
+#define MC_GrabberConfig_0_2                       5
+#define MC_GrabberConfig_2_2_0                     6
+#define MC_MPFRevision                           (MCPARAMID)(   61 << 14)
+#define MC_BoardCount                            (MCPARAMID)(   62 << 14)
+#define MC_RemainingGrab                         (MCPARAMID)(   63 << 14)
+#define MC_ElapsedGrab                           (MCPARAMID)(   64 << 14)
+#define MC_LineDelay                             (MCPARAMID)(   65 << 14)
+#define MC_LutIndex                              (MCPARAMID)(   66 << 14)
+#define MC_InputLut                              (MCPARAMID)(   67 << 14)
+#define MC_SurfaceInfo                           (MCPARAMID)(   68 << 14)
+#define MC_GrabDuration_us                       (MCPARAMID)(   69 << 14)
+#define MC_SerialControlA                        (MCPARAMID)(   70 << 14)
+#define MC_SerialControlB                        (MCPARAMID)(   71 << 14)
+#define MC_TimeCode                              (MCPARAMID)(   72 << 14)
+#define MC_GenerateSignal                        (MCPARAMID)(   73 << 14)
+#define MC_GenerateSignal_EACH_EVENT               1
+#define MC_GenerateSignal_LATEST_EVENT             2
+#define MC_SignalHandling                        (MCPARAMID)(   74 << 14)
+#define MC_SignalHandling_ANY                      1
+#define MC_SignalHandling_CALLBACK_SIGNALING       2
+#define MC_SignalHandling_WAITING_SIGNALING        3
+#define MC_SignalHandling_OS_EVENT_SIGNALING       4
+#define MC_Parity                                (MCPARAMID)(   75 << 14)
+#define MC_Parity_NA                               1
+#define MC_Parity_UP                               2
+#define MC_Parity_DOWN                             3
+#define MC_Parity_UPDW                             4
+#define MC_Parity_DWUP                             5
+#define MC_TimeAnsi                              (MCPARAMID)(   76 << 14)
+#define MC_TimeStamp_us                          (MCPARAMID)(   77 << 14)
+#define MC_WatchdogResetsCount                   (MCPARAMID)(   78 << 14)
+#define MC_StartupTimeout_s                      (MCPARAMID)(   79 << 14)
+#define MC_ApplicationTimeout_s                  (MCPARAMID)(   80 << 14)
+#define MC_ErrorLog                              (MCPARAMID)(   81 << 14)
+#define MC_SurfaceCount                          (MCPARAMID)(   82 << 14)
+#define MC_sctxt                                 (MCPARAMID)(   83 << 14)
+#define MC_SurfaceSizeX                          (MCPARAMID)(   84 << 14)
+#define MC_SurfaceSizeY                          (MCPARAMID)(   85 << 14)
+#define MC_SurfaceColorFormat                    (MCPARAMID)(   86 << 14)
+#define MC_FilledPlanes                          (MCPARAMID)(   87 << 14)
+#define MC_SAB                                   (MCPARAMID)(   88 << 14)
+#define MC_TransferReport                        (MCPARAMID)(   89 << 14)
+#define MC_TransferReport_OK                       1
+#define MC_TransferReport_FIFO_OVERRUN             2
+#define MC_BufferAddress                         (MCPARAMID)(   90 << 14)
+#define MC_FrameType                             (MCPARAMID)(   91 << 14)
+#define MC_FrameType_I                             1
+#define MC_FrameType_P                             2
+#define MC_FrameType_B                             3
+#define MC_LastInSequence                        (MCPARAMID)(   92 << 14)
+#define MC_LastInSequence_TRUE                     1
+#define MC_LastInSequence_FALSE                    2
+#define MC_SurfaceReserved6                      (MCPARAMID)(   93 << 14)
+#define MC_SurfaceReserved7                      (MCPARAMID)(   94 << 14)
+#define MC_SurfaceReserved8                      (MCPARAMID)(   95 << 14)
+#define MC_SurfaceReserved9                      (MCPARAMID)(   96 << 14)
+#define MC_ParamInfoStructSize                   (MCPARAMID)(   97 << 14)
+#define MC_ErrorDesc                             (MCPARAMID)(   98 << 14)
+#define MC_MaxEvents                             (MCPARAMID)(   99 << 14)
+#define MC_CallbackPriority                      (MCPARAMID)(  100 << 14)
+#define MC_CallbackPriority_LOWEST                 1
+#define MC_CallbackPriority_BELOW_NORMAL           2
+#define MC_CallbackPriority_NORMAL                 3
+#define MC_CallbackPriority_ABOVE_NORMAL           4
+#define MC_CallbackPriority_HIGHEST                5
+#define MC_CallbackPriority_TIME_CRITICAL          6
+#define MC_CurrentTime_us                        (MCPARAMID)(  101 << 14)
+#define MC_MementoCritical                       (MCPARAMID)(  102 << 14)
+#define MC_MementoError                          (MCPARAMID)(  103 << 14)
+#define MC_MementoWarning                        (MCPARAMID)(  104 << 14)
+#define MC_MementoNotice                         (MCPARAMID)(  105 << 14)
+#define MC_MementoInfo                           (MCPARAMID)(  106 << 14)
+#define MC_MementoDebug                          (MCPARAMID)(  107 << 14)
+#define MC_MementoVerbose                        (MCPARAMID)(  108 << 14)
+#define MC_TrigMode                              (MCPARAMID)(  512 << 14)
+#define MC_TrigMode_INT                            1
+#define MC_TrigMode_EXT                            2
+#define MC_TrigMode_SOFT                           3
+#define MC_TrigMode_ENC                            3
+#define MC_TrigMode_EXTRC                          4
+#define MC_TrigMode_AUTO                           5
+#define MC_TrigMode_IMMEDIATE                      6
+#define MC_TrigMode_HARD                           7
+#define MC_TrigMode_COMBINED                       8
+#define MC_TrigCtl                               (MCPARAMID)(  513 << 14)
+#define MC_TrigCtl_TGOLOW                          1
+#define MC_TrigCtl_TGOHIGH                         2
+#define MC_TrigCtl_VGOLOW                          3
+#define MC_TrigCtl_VGOHIGH                         4
+#define MC_TrigFlt                               (MCPARAMID)(  514 << 14)
+#define MC_ExpScl                                (MCPARAMID)(  515 << 14)
+#define MC_ExpTrm                                (MCPARAMID)(  516 << 14)
+#define MC_DataWidth                             (MCPARAMID)(  517 << 14)
+#define MC_LinePeriod                            (MCPARAMID)(  518 << 14)
+#define MC_ImagePixelSize                        (MCPARAMID)(  519 << 14)
+#define MC_FramePeriod                           (MCPARAMID)(  520 << 14)
+#define MC_SensorWidth                           (MCPARAMID)(  521 << 14)
+#define MC_SensorHeight                          (MCPARAMID)(  522 << 14)
+#define MC_ImageSizeX                            (MCPARAMID)(  523 << 14)
+#define MC_ImageSizeY                            (MCPARAMID)(  524 << 14)
+#define MC_ImageFlipY                            (MCPARAMID)(  525 << 14)
+#define MC_ImageFlipY_OFF                          1
+#define MC_ImageFlipY_ON                           2
+#define MC_CameraChannels                        (MCPARAMID)(  526 << 14)
+#define MC_AcqScl                                (MCPARAMID)(  527 << 14)
+#define MC_AcqCount                              (MCPARAMID)(  528 << 14)
+#define MC_AcqShift                              (MCPARAMID)(  529 << 14)
+#define MC_AcqSplit                              (MCPARAMID)(  530 << 14)
+#define MC_FrameShift                            (MCPARAMID)(  531 << 14)
+#define MC_VcamCount                             (MCPARAMID)(  532 << 14)
+#define MC_StrCtl                                (MCPARAMID)(  533 << 14)
+#define MC_StrCtl_LOW                              1
+#define MC_StrCtl_HIGH                             2
+#define MC_StrCtl_PLSLOW                           3
+#define MC_StrCtl_PLSHIGH                          4
+#define MC_StrLvl                                (MCPARAMID)(  534 << 14)
+#define MC_StrLvl_DIS                              1
+#define MC_StrLvl_TTL                              2
+#define MC_StrLvl_OC                               3
+#define MC_StrLvl_OE                               4
+#define MC_StrPos                                (MCPARAMID)(  535 << 14)
+#define MC_StrDur                                (MCPARAMID)(  536 << 14)
+#define MC_PendLines                             (MCPARAMID)(  537 << 14)
+#define MC_FrameRstCtl                           (MCPARAMID)(  538 << 14)
+#define MC_FrameRstCtl_TPLSLOW                     1
+#define MC_FrameRstCtl_TPLSHIGH                    2
+#define MC_FrameRstCtl_DPLSLOW                     3
+#define MC_FrameRstCtl_DPLSHIGH                    4
+#define MC_FrameRstPos                           (MCPARAMID)(  539 << 14)
+#define MC_FrameRstDur                           (MCPARAMID)(  540 << 14)
+#define MC_ExpMode                               (MCPARAMID)(  541 << 14)
+#define MC_ExpMode_Reset_Width                     1
+#define MC_ExpMode_Dual_Reset_Interval             2
+#define MC_ExpMode_Reset_To_Expose_interval        3
+#define MC_ExpDur                                (MCPARAMID)(  542 << 14)
+#define MC_LineValCtl                            (MCPARAMID)(  543 << 14)
+#define MC_LineValCtl_LOW                          1
+#define MC_LineValCtl_HIGH                         2
+#define MC_LineValCtl_TLOW                         3
+#define MC_LineValCtl_THIGH                        4
+#define MC_FrameValCtl                           (MCPARAMID)(  544 << 14)
+#define MC_FrameValCtl_LOW                         1
+#define MC_FrameValCtl_HIGH                        2
+#define MC_FrameValCtl_TLOW                        3
+#define MC_FrameValCtl_THIGH                       4
+#define MC_FrameValFlt                           (MCPARAMID)(  545 << 14)
+#define MC_FrameValFlt_0                           1
+#define MC_FrameValFlt_4                           2
+#define MC_FrameValFlt_16                          3
+#define MC_FrameValFlt_64                          4
+#define MC_ExpCtl                                (MCPARAMID)(  546 << 14)
+#define MC_ExpCtl_TPLSLOW                          1
+#define MC_ExpCtl_TPLSHIGH                         2
+#define MC_ExpCtl_DPLSLOW                          3
+#define MC_ExpCtl_DPLSHIGH                         4
+#define MC_ClockPhase                            (MCPARAMID)(  547 << 14)
+#define MC_ClockPhase_0                            1
+#define MC_ClockPhase_90                           2
+#define MC_ClockPhase_180                          3
+#define MC_ClockPhase_270                          4
+#define MC_DataDelay                             (MCPARAMID)(  548 << 14)
+#define MC_DataDelay_NONE                          1
+#define MC_DataDelay_SLIGHT                        2
+#define MC_TestPat                               (MCPARAMID)(  549 << 14)
+#define MC_TestPat_OFF                             1
+#define MC_TestPat_ON                              2
+#define MC_TestPat_LaneID                          3
+#define MC_Line3Ctl                              (MCPARAMID)(  550 << 14)
+#define MC_Line3Ctl_RESET                          1
+#define MC_Line3Ctl_DLOW                           2
+#define MC_Line3Ctl_DHIGH                          3
+#define MC_Line3Ctl_TLOW                           4
+#define MC_Line3Ctl_THIGH                          5
+#define MC_Line3Ctl_EXPOSE                         6
+#define MC_Line4Ctl                              (MCPARAMID)(  551 << 14)
+#define MC_Line4Ctl_LOW                            1
+#define MC_Line4Ctl_HIGH                           2
+#define MC_Line4Ctl_REFCKA                         3
+#define MC_Line5Ctl                              (MCPARAMID)(  552 << 14)
+#define MC_Line5Ctl_EXPOSE                         1
+#define MC_Line5Ctl_DLOW                           2
+#define MC_Line5Ctl_DHIGH                          3
+#define MC_Line5Ctl_TLOW                           4
+#define MC_Line5Ctl_THIGH                          5
+#define MC_Line5Ctl_RESET                          6
+#define MC_Line6Ctl                              (MCPARAMID)(  553 << 14)
+#define MC_Line6Ctl_LOW                            1
+#define MC_Line6Ctl_HIGH                           2
+#define MC_BitMask                               (MCPARAMID)(  554 << 14)
+#define MC_RdoutTrm                              (MCPARAMID)(  555 << 14)
+#define MC_SacqLoc                               (MCPARAMID)(  556 << 14)
+#define MC_EacqLoc                               (MCPARAMID)(  557 << 14)
+#define MC_ExpDurT                               (MCPARAMID)(  558 << 14)
+#define MC_ImageSizeXModulo                      (MCPARAMID)(  559 << 14)
+#define MC_PerScl                                (MCPARAMID)(  560 << 14)
+#define MC_PerCnt                                (MCPARAMID)(  561 << 14)
+#define MC_EncScl                                (MCPARAMID)(  562 << 14)
+#define MC_RateCode                              (MCPARAMID)(  563 << 14)
+#define MC_SensorLength                          (MCPARAMID)(  564 << 14)
+#define MC_PageLength                            (MCPARAMID)(  565 << 14)
+#define MC_LineForbidPos                         (MCPARAMID)(  566 << 14)
+#define MC_LineSkipHold                          (MCPARAMID)(  567 << 14)
+#define MC_LineSkipHold_SKIP                       1
+#define MC_LineSkipHold_HOLD                       2
+#define MC_LineRstCtl                            (MCPARAMID)(  568 << 14)
+#define MC_LineRstCtl_PLSLOW                       1
+#define MC_LineRstCtl_PLSHIGH                      2
+#define MC_ExpCtl_PLSLOW                           1
+#define MC_ExpCtl_PLSHIGH                          2
+#define MC_FifoDepth                             (MCPARAMID)(  569 << 14)
+#define MC_FifoWidth                             (MCPARAMID)(  570 << 14)
+#define MC_FifoLineSize                          (MCPARAMID)(  571 << 14)
+#define MC_BackendInterruptMask                  (MCPARAMID)(  572 << 14)
+#define MC_ColorInputFormat                      (MCPARAMID)(  573 << 14)
+#define MC_ColorInputFormat_SerialBGR              1
+#define MC_ColorInputFormat_SerialRGB              2
+#define MC_ColorInputFormat_ParallelRGB            3
+#define MC_ColorOutputFormat                     (MCPARAMID)(  574 << 14)
+#define MC_ColorOutputFormat_Packed24              1
+#define MC_ColorOutputFormat_Planar8               2
+#define MC_ColorOutputFormat_Planar16              3
+#define MC_PageTrigMode                          (MCPARAMID)(  575 << 14)
+#define MC_PageTrigMode_INT                        1
+#define MC_PageTrigMode_EXT                        2
+#define MC_PageTrigMode_DELAY                      3
+#define MC_PageTrigMode_FVAL                       4
+#define MC_PageTrigMode_SOFT                       5
+#define MC_PageTrigCtl                           (MCPARAMID)(  576 << 14)
+#define MC_PageTrigCtl_TGOLOW                      1
+#define MC_PageTrigCtl_TGOHIGH                     2
+#define MC_PageTrigCtl_VGOLOW                      3
+#define MC_PageTrigCtl_VGOHIGH                     4
+#define MC_PageTrigCtl_DGOLOW                      5
+#define MC_PageTrigCtl_DGOHIGH                     6
+#define MC_PageTrigFlt                           (MCPARAMID)(  577 << 14)
+#define MC_PageDelay                             (MCPARAMID)(  578 << 14)
+#define MC_FrameForbidPos                        (MCPARAMID)(  579 << 14)
+#define MC_FrameSkipHold                         (MCPARAMID)(  580 << 14)
+#define MC_FrameSkipHold_SKIP                      1
+#define MC_FrameSkipHold_HOLD                      2
+#define MC_PageSkipHold                          (MCPARAMID)(  581 << 14)
+#define MC_PageSkipHold_SKIP                       1
+#define MC_PageSkipHold_HOLD                       2
+#define MC_Block                                 (MCPARAMID)(  582 << 14)
+#define MC_Atom                                  (MCPARAMID)(  583 << 14)
+#define MC_ChannelTopology                       (MCPARAMID)(  584 << 14)
+#define MC_ChannelTopology_Single                  1
+#define MC_ChannelTopology_DualXPair               2
+#define MC_ChannelTopology_DualXTap                3
+#define MC_ChannelTopology_DualXEnd                4
+#define MC_ChannelTopology_DualYPair               5
+#define MC_ChannelTopology_DualYEnd                6
+#define MC_ChannelTopology_Triple                  7
+#define MC_ChannelTopology_QuadX                   8
+#define MC_CameraTimings                         (MCPARAMID)(  585 << 14)
+#define MC_CameraTimings_Mono                      1
+#define MC_CameraTimings_Duo                       2
+#define MC_XChannels                             (MCPARAMID)(  586 << 14)
+#define MC_YChannels                             (MCPARAMID)(  587 << 14)
+#define MC_BlockSize                             (MCPARAMID)(  588 << 14)
+#define MC_PixelComponents                       (MCPARAMID)(  589 << 14)
+#define MC_BackEndProg                           (MCPARAMID)(  590 << 14)
+#define MC_BackEndProg_AB12                        1
+#define MC_BackEndProg_CD12                        2
+#define MC_BackEndProg_AB24                        3
+#define MC_BackEndProg_CD24                        4
+#define MC_BackEndProg_ABCD22                      5
+#define MC_BackEndProg_BGR24                       6
+#define MC_BackEndProg_PLANAR8                     7
+#define MC_BackEndProg_ABCD11                      8
+#define MC_BackEndProg_X                           9
+#define MC_DesiredLinePitch                      (MCPARAMID)(  591 << 14)
+#define MC_EncoderPitch                          (MCPARAMID)(  592 << 14)
+#define MC_MaxLineFrequency                      (MCPARAMID)(  593 << 14)
+#define MC_PixelClockFrequency                   (MCPARAMID)(  594 << 14)
+#define MC_LinePitch                             (MCPARAMID)(  595 << 14)
+#define MC_MinLineFrequency                      (MCPARAMID)(  596 << 14)
+#define MC_DesiredVCLKFrequency                  (MCPARAMID)(  597 << 14)
+#define MC_EffectiveVCLKFrequency                (MCPARAMID)(  598 << 14)
+#define MC_VCLKFrequencyError                    (MCPARAMID)(  599 << 14)
+#define MC_Smin                                  (MCPARAMID)(  600 << 14)
+#define MC_FVR                                   (MCPARAMID)(  601 << 14)
+#define MC_Rmin                                  (MCPARAMID)(  602 << 14)
+#define MC_Rmax                                  (MCPARAMID)(  603 << 14)
+#define MC_MinEncoderFrequency                   (MCPARAMID)(  604 << 14)
+#define MC_FrameCount                            (MCPARAMID)(  605 << 14)
+#define MC_MoleculeSize                          (MCPARAMID)(  606 << 14)
+#define MC_ZChannels                             (MCPARAMID)(  607 << 14)
+#define MC_Alines                                (MCPARAMID)(  608 << 14)
+#define MC_StartReadout                          (MCPARAMID)(  609 << 14)
+#define MC_StartReadout_Auto                       1
+#define MC_StartReadout_LineSync                   2
+#define MC_StartReadout_Flex                       3
+#define MC_StartReadout_FlexD                      4
+#define MC_StartReadout_FlexU                      5
+#define MC_FifoCap4                              (MCPARAMID)(  610 << 14)
+#define MC_Exposure                              (MCPARAMID)(  611 << 14)
+#define MC_MinExpose                             (MCPARAMID)(  612 << 14)
+#define MC_ExpPscl                               (MCPARAMID)(  613 << 14)
+#define MC_ExpTerm                               (MCPARAMID)(  614 << 14)
+#define MC_PageCount                             (MCPARAMID)(  615 << 14)
+#define MC_MinLinePeriod                         (MCPARAMID)(  616 << 14)
+#define MC_MinResetWidth                         (MCPARAMID)(  617 << 14)
+#define MC_ExpWidth                              (MCPARAMID)(  618 << 14)
+#define MC_StrWidth                              (MCPARAMID)(  619 << 14)
+#define MC_RstWidth                              (MCPARAMID)(  620 << 14)
+#define MC_Str2Rst                               (MCPARAMID)(  621 << 14)
+#define MC_MinRstWidth                           (MCPARAMID)(  622 << 14)
+#define MC_ExpTrim                               (MCPARAMID)(  623 << 14)
+#define MC_ExpTrimFactor                         (MCPARAMID)(  624 << 14)
+#define MC_Periodic                              (MCPARAMID)(  625 << 14)
+#define MC_DacCmd                                (MCPARAMID)(  626 << 14)
+#define MC_DacCmd_DAC_A8                           1
+#define MC_DacCmd_DAC_A9                           2
+#define MC_DacCmd_DAC_B8                           3
+#define MC_DacCmd_DAC_B9                           4
+#define MC_DacData                               (MCPARAMID)(  627 << 14)
+#define MC_Destination                           (MCPARAMID)(  628 << 14)
+#define MC_Destination_PC                          1
+#define MC_Destination_DSP1                        2
+#define MC_Destination_DSP2                        3
+#define MC_REFCKA_Frequency                      (MCPARAMID)(  629 << 14)
+#define MC_Gating                                (MCPARAMID)(  630 << 14)
+#define MC_Gating_POST                             1
+#define MC_Gating_PRE                              2
+#define MC_DataClockPolarity                     (MCPARAMID)(  631 << 14)
+#define MC_DataClockPolarity_POS                   1
+#define MC_DataClockPolarity_NEG                   2
+#define MC_TimingClockSource                     (MCPARAMID)(  632 << 14)
+#define MC_TimingClockSource_EXT                   1
+#define MC_TimingClockSource_REFCKA                2
+#define MC_EncSvalue                             (MCPARAMID)(  633 << 14)
+#define MC_ReadoutTC                             (MCPARAMID)(  634 << 14)
+#define MC_USS                                   (MCPARAMID)(  635 << 14)
+#define MC_USOutM                                (MCPARAMID)(  636 << 14)
+#define MC_USOutM_ABCD4                            1
+#define MC_USOutM_ABCD2                            2
+#define MC_USOutM_BADC2                            3
+#define MC_USOutM_ACBD2                            4
+#define MC_USOutM_CADB2                            5
+#define MC_USOutM_BADC1                            6
+#define MC_USOutM_DCBA1                            7
+#define MC_USOutM_CBA1                             8
+#define MC_USOutM_CBA3                             9
+#define MC_USOutM_ABC3                            10
+#define MC_USOutM_X                               11
+#define MC_USOutM_ABCD1                           12
+#define MC_ChannelOrder                          (MCPARAMID)(  637 << 14)
+#define MC_ChannelOrder_Direct                     1
+#define MC_ChannelOrder_Invert                     2
+#define MC_DataLanes                             (MCPARAMID)(  638 << 14)
+#define MC_DataLanes_P                             1
+#define MC_DataLanes_R                             2
+#define MC_DataLanes_PQ                            3
+#define MC_DataLanes_PR                            4
+#define MC_DataLanes_RS                            5
+#define MC_DataLanes_PRS                           6
+#define MC_DataLanes_PQRS                          7
+#define MC_DataLanes_PQR                           8
+#define MC_DataLanes_PRQS                          9
+#define MC_DataLanes_PQS                          10
+#define MC_DataLanes_RSQ                          11
+#define MC_USOutD                                (MCPARAMID)(  639 << 14)
+#define MC_USOutD_AB2                              1
+#define MC_USOutD_AB1                              2
+#define MC_USOutD_BA1                              3
+#define MC_USOutD_CD2                              4
+#define MC_USOutD_CD1                              5
+#define MC_USOutD_DC1                              6
+#define MC_USOutD_X                                7
+#define MC_DualLaneComb                          (MCPARAMID)(  640 << 14)
+#define MC_DualLaneComb_PQ                         1
+#define MC_DualLaneComb_PR                         2
+#define MC_ModuleID                              (MCPARAMID)(  641 << 14)
+#define MC_FifoType                              (MCPARAMID)(  642 << 14)
+#define MC_FifoType_Unknown                        1
+#define MC_FifoType_TwoK                           2
+#define MC_FifoType_EightK                         3
+#define MC_ElectricalInterfaceType               (MCPARAMID)(  643 << 14)
+#define MC_ElectricalInterfaceType_Unknown         1
+#define MC_ElectricalInterfaceType_422             2
+#define MC_ElectricalInterfaceType_644             3
+#define MC_ElectricalInterfaceType_CameraLink      4
+#define MC_Period                                (MCPARAMID)(  644 << 14)
+#define MC_RGBLanes                              (MCPARAMID)(  645 << 14)
+#define MC_RGBLanes_PRS                            1
+#define MC_RGBLanes_PQR                            2
+#define MC_RGBLanes_PQS                            3
+#define MC_RGBLanes_RSQ                            4
+#define MC_SWAP16                                (MCPARAMID)(  646 << 14)
+#define MC_SWAP16_OFF                              1
+#define MC_SWAP16_ON                               2
+#define MC_Clanes                                (MCPARAMID)(  647 << 14)
+#define MC_Clanes_X                                1
+#define MC_Clanes_P                                2
+#define MC_Clanes_R                                3
+#define MC_Clanes_PQ                               4
+#define MC_Clanes_PR                               5
+#define MC_Clanes_RS                               6
+#define MC_Clanes_P_Q                              7
+#define MC_Clanes_P_R                              8
+#define MC_Clanes_R_S                              9
+#define MC_Clanes_PR_QS                           10
+#define MC_Clanes_PQ_RS                           11
+#define MC_Clanes_P_R_S                           12
+#define MC_Clanes_P_Q_R                           13
+#define MC_Clanes_P_Q_S                           14
+#define MC_Clanes_R_S_Q                           15
+#define MC_Clanes_P_Q_R_S                         16
+#define MC_USLanes                               (MCPARAMID)(  648 << 14)
+#define MC_USLanes_X                               1
+#define MC_USLanes_P                               2
+#define MC_USLanes_Q                               3
+#define MC_USLanes_R                               4
+#define MC_USLanes_S                               5
+#define MC_USLanes_PQ                              6
+#define MC_USLanes_PR                              7
+#define MC_USLanes_RS                              8
+#define MC_USLanes_PRS                             9
+#define MC_USLanes_PQR                            10
+#define MC_USLanes_PQS                            11
+#define MC_USLanes_RSQ                            12
+#define MC_USLanes_PRQS                           13
+#define MC_USLanes_PQRS                           14
+#define MC_CableAlign                            (MCPARAMID)(  649 << 14)
+#define MC_CableAlign_Left                         1
+#define MC_CableAlign_Right                        2
+#define MC_CameraWidth                           (MCPARAMID)(  650 << 14)
+#define MC_PortSize                              (MCPARAMID)(  651 << 14)
+#define MC_Ubit                                  (MCPARAMID)(  652 << 14)
+#define MC_Dbit                                  (MCPARAMID)(  653 << 14)
+#define MC_Umask                                 (MCPARAMID)(  654 << 14)
+#define MC_Dmask                                 (MCPARAMID)(  655 << 14)
+#define MC_MSmask                                (MCPARAMID)(  656 << 14)
+#define MC_LSmask                                (MCPARAMID)(  657 << 14)
+#define MC_Dwidth                                (MCPARAMID)(  658 << 14)
+#define MC_ALIGN                                 (MCPARAMID)(  659 << 14)
+#define MC_ImagePixelAlign                       (MCPARAMID)(  660 << 14)
+#define MC_ImagePixelAlign_Left                    1
+#define MC_ImagePixelAlign_Right                   2
+#define MC_CWidth                                (MCPARAMID)(  661 << 14)
+#define MC_ModType                               (MCPARAMID)(  662 << 14)
+#define MC_ModType_Unknown                         1
+#define MC_ModType_NoModule                        2
+#define MC_ModType_D16A                            3
+#define MC_ModType_D32AB                           4
+#define MC_ModType_D32B                            5
+#define MC_ModType_D16C                            6
+#define MC_ModType_D32C                            7
+#define MC_ModType_CameraLink                      8
+#define MC_NextTrigMode                          (MCPARAMID)(  663 << 14)
+#define MC_TrigEdge                              (MCPARAMID)(  664 << 14)
+#define MC_TrigEdge_GOHIGH                         1
+#define MC_TrigEdge_GOLOW                          2
+#define MC_TrigFilter                            (MCPARAMID)(  665 << 14)
+#define MC_TrigFilter_OFF                          1
+#define MC_TrigFilter_ON                           2
+#define MC_TrigLine                              (MCPARAMID)(  666 << 14)
+#define MC_TrigLine_NOM                            1
+#define MC_TrigLine_ALT1                           2
+#define MC_TrigLine_ALT2                           3
+#define MC_TrigLine_ALT3                           4
+#define MC_TrigLine_ALT4                           5
+#define MC_MapConTim                             (MCPARAMID)(  667 << 14)
+#define MC_MapConTim_XYZ                           1
+#define MC_MapConTim_ZYX                           2
+#define MC_MapConTim_YZX                           3
+#define MC_MapConTim_XZY                           4
+#define MC_MapConTim_ZXY                           5
+#define MC_MapConTim_YXZ                           6
+#define MC_MapDigTim                             (MCPARAMID)(  668 << 14)
+#define MC_MapDigTim_ABD                           1
+#define MC_MapDigTim_ACD                           2
+#define MC_MapDigTim_ABC                           3
+#define MC_MapDigTim_BCC                           4
+#define MC_MapDigTim_BBC                           5
+#define MC_MapDigTim_BCD                           6
+#define MC_MapDigTim_BBD                           7
+#define MC_MapTimCon                             (MCPARAMID)(  669 << 14)
+#define MC_MapTimCon_TXYZ                          1
+#define MC_MapTimCon_TZYX                          2
+#define MC_MapTimCon_TYZX                          3
+#define MC_MapTimCon_TXZY                          4
+#define MC_MapTimCon_TZXY                          5
+#define MC_MapTimCon_TYXZ                          6
+#define MC_MapTimDig                             (MCPARAMID)(  670 << 14)
+#define MC_MapTimDig_TXXZZ                         1
+#define MC_MapTimDig_TXXXZ                         2
+#define MC_MapTimDig_TXZZZ                         3
+#define MC_MapTimDig_TXYZZ                         4
+#define MC_MapTimDig_TXYYZ                         5
+#define MC_MapTimDig_TXXYZ                         6
+#define MC_MapLaneX1                             (MCPARAMID)(  671 << 14)
+#define MC_MapLaneX1_OFF                           1
+#define MC_MapLaneX1_A                             2
+#define MC_MapLaneX2                             (MCPARAMID)(  672 << 14)
+#define MC_MapLaneX2_OFF                           1
+#define MC_MapLaneX2_B                             2
+#define MC_MapLaneX3                             (MCPARAMID)(  673 << 14)
+#define MC_MapLaneX3_OFF                           1
+#define MC_MapLaneX3_A                             2
+#define MC_MapLaneX3_C                             3
+#define MC_MapLaneX3_CLK                           4
+#define MC_MapLaneY1                             (MCPARAMID)(  674 << 14)
+#define MC_MapLaneY1_OFF                           1
+#define MC_MapLaneY1_A                             2
+#define MC_MapLaneY1_C                             3
+#define MC_MapLaneY1_D                             4
+#define MC_MapLaneY2                             (MCPARAMID)(  675 << 14)
+#define MC_MapLaneY2_OFF                           1
+#define MC_MapLaneY2_B                             2
+#define MC_MapLaneY2_D                             3
+#define MC_MapLaneY3                             (MCPARAMID)(  676 << 14)
+#define MC_MapLaneY3_OFF                           1
+#define MC_MapLaneY3_B                             2
+#define MC_MapLaneY3_C                             3
+#define MC_MapLaneY3_D                             4
+#define MC_MapLaneY3_CLK                           5
+#define MC_MapLaneZ1                             (MCPARAMID)(  677 << 14)
+#define MC_MapLaneZ1_OFF                           1
+#define MC_MapLaneZ1_A                             2
+#define MC_MapLaneZ1_C                             3
+#define MC_MapLaneZ2                             (MCPARAMID)(  678 << 14)
+#define MC_MapLaneZ2_OFF                           1
+#define MC_MapLaneZ2_B                             2
+#define MC_MapLaneZ2_C                             3
+#define MC_MapLaneZ2_D                             4
+#define MC_MapLaneZ3                             (MCPARAMID)(  679 << 14)
+#define MC_MapLaneZ3_OFF                           1
+#define MC_MapLaneZ3_CLK                           2
+#define MC_ClkSynth1                             (MCPARAMID)(  680 << 14)
+#define MC_ClkSynth2                             (MCPARAMID)(  681 << 14)
+#define MC_Connector                             (MCPARAMID)(  682 << 14)
+#define MC_Connector_X                             1
+#define MC_Connector_Y                             2
+#define MC_Connector_Z                             3
+#define MC_Connector_XBIS                          4
+#define MC_Connector_YBIS                          5
+#define MC_Connector_ZBIS                          6
+#define MC_GrabWindow                            (MCPARAMID)(  683 << 14)
+#define MC_GrabWindow_STD                          1
+#define MC_GrabWindow_NOBLACK                      2
+#define MC_GrabWindow_NOLOSS                       3
+#define MC_GrabWindow_MAN                          4
+#define MC_GrbCount                              (MCPARAMID)(  684 << 14)
+#define MC_OffsetX_Tk                            (MCPARAMID)(  685 << 14)
+#define MC_OffsetY_Ln                            (MCPARAMID)(  686 << 14)
+#define MC_LineDurTrim                           (MCPARAMID)(  687 << 14)
+#define MC_CableComp                             (MCPARAMID)(  688 << 14)
+#define MC_Filter                                (MCPARAMID)(  689 << 14)
+#define MC_Filter_NONE                             1
+#define MC_Filter_10MHZ                            2
+#define MC_Filter_5MHZ                             3
+#define MC_Filter_5MHZ_PAL                         4
+#define MC_Filter_5MHZ_NTSC                        5
+#define MC_CalPat                                (MCPARAMID)(  690 << 14)
+#define MC_CalPat_NONE                             1
+#define MC_CalPat_CAL                              2
+#define MC_CalPat_TPG                              3
+#define MC_LutEn                                 (MCPARAMID)(  691 << 14)
+#define MC_LutEn_OFF                               1
+#define MC_LutEn_ON                                2
+#define MC_ImageBufLoc                           (MCPARAMID)(  692 << 14)
+#define MC_LutBufLoc                             (MCPARAMID)(  693 << 14)
+#define MC_ConnectLoc                            (MCPARAMID)(  694 << 14)
+#define MC_ConnectLoc_UPPER                        1
+#define MC_ConnectLoc_CENTER                       2
+#define MC_ConnectLoc_LOWER                        3
+#define MC_TimUnit                               (MCPARAMID)(  695 << 14)
+#define MC_TimUnit_TX                              1
+#define MC_TimUnit_TY                              2
+#define MC_TimUnit_TZ                              3
+#define MC_DigUnit1                              (MCPARAMID)(  696 << 14)
+#define MC_DigUnit1_A                              1
+#define MC_DigUnit1_B                              2
+#define MC_DigUnit1_C                              3
+#define MC_DigUnit1_D                              4
+#define MC_DigUnit2                              (MCPARAMID)(  697 << 14)
+#define MC_DigUnit2_NONE                           1
+#define MC_DigUnit2_A                              2
+#define MC_DigUnit2_B                              3
+#define MC_DigUnit2_C                              4
+#define MC_DigUnit2_D                              5
+#define MC_DigUnit3                              (MCPARAMID)(  698 << 14)
+#define MC_DigUnit3_NONE                           1
+#define MC_DigUnit3_A                              2
+#define MC_DigUnit3_B                              3
+#define MC_DigUnit3_C                              4
+#define MC_DigUnit3_D                              5
+#define MC_SelClkSynth                           (MCPARAMID)(  699 << 14)
+#define MC_SelClkSynth_NONE                        1
+#define MC_SelClkSynth_CLK1                        2
+#define MC_SelClkSynth_CLK2                        3
+#define MC_Camera                                (MCPARAMID)(  700 << 14)
+#define MC_Camera_CCIR                             1
+#define MC_Camera_EIA                              2
+#define MC_Camera_CV_M1                            3
+#define MC_Camera_CV_M10C                          4
+#define MC_Camera_CV_M10E                          5
+#define MC_Camera_CV_M50                           6
+#define MC_Camera_XC_55                            7
+#define MC_Camera_SIMUL                            8
+#define MC_Camera_CV_M40                           9
+#define MC_Camera_CUSTOM                          10
+#define MC_Camera_XC_HR300                        11
+#define MC_CamConfig                             (MCPARAMID)(  701 << 14)
+#define MC_CamConfig_STD                           1
+#define MC_CamConfig_TEST                          2
+#define MC_CamConfig_I50SA                         3
+#define MC_CamConfig_I60SA                         4
+#define MC_CamConfig_P25SA                         5
+#define MC_CamConfig_P30SA                         6
+#define MC_CamConfig_P50SA                         7
+#define MC_CamConfig_P60SA                         8
+#define MC_CamConfig_P25RA                         9
+#define MC_CamConfig_P30RA                        10
+#define MC_CamConfig_P50RA                        11
+#define MC_CamConfig_P60RA                        12
+#define MC_CamConfig_P12RD                        13
+#define MC_CamConfig_P60RD                        14
+#define MC_CamConfig_P100RA                       15
+#define MC_Scanning                              (MCPARAMID)(  702 << 14)
+#define MC_Scanning_PROGRESSIVE                    1
+#define MC_Scanning_INTERLACE                      2
+#define MC_Standard                              (MCPARAMID)(  703 << 14)
+#define MC_Standard_CCIR                           1
+#define MC_Standard_EIA                            2
+#define MC_PixelClk_Hz                           (MCPARAMID)(  704 << 14)
+#define MC_LineRate_Hz                           (MCPARAMID)(  705 << 14)
+#define MC_HCsyncDur_ns                          (MCPARAMID)(  706 << 14)
+#define MC_HCsyncBfr_ns                          (MCPARAMID)(  707 << 14)
+#define MC_HCSyncAft_ns                          (MCPARAMID)(  708 << 14)
+#define MC_Vtotal_Ln                             (MCPARAMID)(  709 << 14)
+#define MC_Vactive_Ln                            (MCPARAMID)(  710 << 14)
+#define MC_VCsyncAft_Ln                          (MCPARAMID)(  711 << 14)
+#define MC_VsyncAft_Ln                           (MCPARAMID)(  712 << 14)
+#define MC_HdriveDur_ns                          (MCPARAMID)(  713 << 14)
+#define MC_VdriveDur_Ln                          (MCPARAMID)(  714 << 14)
+#define MC_HsyncDly_ns                           (MCPARAMID)(  715 << 14)
+#define MC_HdriveDly_ns                          (MCPARAMID)(  716 << 14)
+#define MC_HVdriveCtl                            (MCPARAMID)(  717 << 14)
+#define MC_HVdriveCtl_NONE                         1
+#define MC_HVdriveCtl_TTL                          2
+#define MC_HVdriveCtl_DIFF                         3
+#define MC_HVdriveEdge                           (MCPARAMID)(  718 << 14)
+#define MC_HVdriveEdge_GOLOW                       1
+#define MC_HVdriveEdge_GOHIGH                      2
+#define MC_PixelClkCtl                           (MCPARAMID)(  719 << 14)
+#define MC_PixelClkCtl_NONE                        1
+#define MC_PixelClkCtl_TTL                         2
+#define MC_PixelClkCtl_DIFF                        3
+#define MC_PixelClkEdge                          (MCPARAMID)(  720 << 14)
+#define MC_PixelClkEdge_GOHIGH                     1
+#define MC_PixelClkEdge_GOLOW                      2
+#define MC_VsyncCtl                              (MCPARAMID)(  721 << 14)
+#define MC_VsyncCtl_NONE                           1
+#define MC_VsyncCtl_TTL                            2
+#define MC_VsyncCtl_DIFF                           3
+#define MC_HsyncCtl                              (MCPARAMID)(  722 << 14)
+#define MC_HsyncCtl_NONE                           1
+#define MC_HsyncCtl_TTL                            2
+#define MC_HsyncCtl_DIFF                           3
+#define MC_HsyncEdge                             (MCPARAMID)(  723 << 14)
+#define MC_HsyncEdge_GOLOW                         1
+#define MC_HsyncEdge_GOHIGH                        2
+#define MC_VsyncEdge                             (MCPARAMID)(  724 << 14)
+#define MC_VsyncEdge_GOLOW                         1
+#define MC_VsyncEdge_GOHIGH                        2
+#define MC_ICS9161Code                           (MCPARAMID)(  725 << 14)
+#define MC_SyncMode                              (MCPARAMID)(  726 << 14)
+#define MC_SyncMode_MASTER                         1
+#define MC_SyncMode_ANALOG                         2
+#define MC_SyncMode_DIGITAL                        3
+#define MC_VCgatePos_Ln                          (MCPARAMID)(  727 << 14)
+#define MC_Operation                             (MCPARAMID)(  728 << 14)
+#define MC_Operation_SYNC                          1
+#define MC_Operation_VCAM                          2
+#define MC_Operation_CTL                           3
+#define MC_Cable                                 (MCPARAMID)(  729 << 14)
+#define MC_Cable_A15_C01                           1
+#define MC_Cable_A15_C02                           2
+#define MC_Cable_A15_C03                           3
+#define MC_Cable_A15_C04                           4
+#define MC_Cable_A15_C05                           5
+#define MC_FrameRstEdge                          (MCPARAMID)(  730 << 14)
+#define MC_FrameRstEdge_GOLOW                      1
+#define MC_FrameRstEdge_GOHIGH                     2
+#define MC_LineDur_Tk                            (MCPARAMID)(  731 << 14)
+#define MC_LineDur_ns                            (MCPARAMID)(  732 << 14)
+#define MC_SampleClk_Hz                          (MCPARAMID)(  733 << 14)
+#define MC_TCU_ps                                (MCPARAMID)(  734 << 14)
+#define MC_Hactive_ns                            (MCPARAMID)(  735 << 14)
+#define MC_Hactive_Tk                            (MCPARAMID)(  736 << 14)
+#define MC_GrabSizeX_Tk                          (MCPARAMID)(  737 << 14)
+#define MC_GrabSizeX_ns                          (MCPARAMID)(  738 << 14)
+#define MC_GrabPosX_ns                           (MCPARAMID)(  739 << 14)
+#define MC_X_ACQOn                               (MCPARAMID)(  740 << 14)
+#define MC_X_ACQOff                              (MCPARAMID)(  741 << 14)
+#define MC_ClmDur_ns                             (MCPARAMID)(  742 << 14)
+#define MC_ClmPos_ns                             (MCPARAMID)(  743 << 14)
+#define MC_X_CLMOn                               (MCPARAMID)(  744 << 14)
+#define MC_X_CLMOff                              (MCPARAMID)(  745 << 14)
+#define MC_X_HPLL                                (MCPARAMID)(  746 << 14)
+#define MC_X_ENDR                                (MCPARAMID)(  747 << 14)
+#define MC_X_HOn                                 (MCPARAMID)(  748 << 14)
+#define MC_X_HOff                                (MCPARAMID)(  749 << 14)
+#define MC_X_MIDX                                (MCPARAMID)(  750 << 14)
+#define MC__VActive                              (MCPARAMID)(  751 << 14)
+#define MC_GrabSizeY_Ln                          (MCPARAMID)(  752 << 14)
+#define MC_GrabPosY_Ln                           (MCPARAMID)(  753 << 14)
+#define MC_ADelay1_ns                            (MCPARAMID)(  754 << 14)
+#define MC_ADelay2_ns                            (MCPARAMID)(  755 << 14)
+#define MC_ADelay3_ns                            (MCPARAMID)(  756 << 14)
+#define MC_DDelay2                               (MCPARAMID)(  757 << 14)
+#define MC_DDelay3                               (MCPARAMID)(  758 << 14)
+#define MC_AcqStep                               (MCPARAMID)(  759 << 14)
+#define MC__MIDXQ                                (MCPARAMID)(  760 << 14)
+#define MC__ASEL                                 (MCPARAMID)(  761 << 14)
+#define MC__BSEL                                 (MCPARAMID)(  762 << 14)
+#define MC__CSEL                                 (MCPARAMID)(  763 << 14)
+#define MC__DSEL                                 (MCPARAMID)(  764 << 14)
+#define MC__PShift1                              (MCPARAMID)(  765 << 14)
+#define MC__PShift2                              (MCPARAMID)(  766 << 14)
+#define MC__Dig321Mask                           (MCPARAMID)(  767 << 14)
+#define MC__VCODIV                               (MCPARAMID)(  768 << 14)
+#define MC__SELH                                 (MCPARAMID)(  769 << 14)
+#define MC__SELH_NONE                              1
+#define MC__SELH_HDS                               2
+#define MC__SELH_DETS                              3
+#define MC__SELH_QS                                4
+#define MC__SELV                                 (MCPARAMID)(  770 << 14)
+#define MC__SELV_NONE                              1
+#define MC__SELV_VDS                               2
+#define MC__SELV_DETV                              3
+#define MC__ASSY11                               (MCPARAMID)(  771 << 14)
+#define MC__ASSY12                               (MCPARAMID)(  772 << 14)
+#define MC__ASSY13                               (MCPARAMID)(  773 << 14)
+#define MC__ASSY14                               (MCPARAMID)(  774 << 14)
+#define MC__ASSY21                               (MCPARAMID)(  775 << 14)
+#define MC__ASSY22                               (MCPARAMID)(  776 << 14)
+#define MC__ASSY23                               (MCPARAMID)(  777 << 14)
+#define MC__ASSY24                               (MCPARAMID)(  778 << 14)
+#define MC__SIZX                                 (MCPARAMID)(  779 << 14)
+#define MC__SIZY                                 (MCPARAMID)(  780 << 14)
+#define MC__STARTU1                              (MCPARAMID)(  781 << 14)
+#define MC__STARTU2                              (MCPARAMID)(  782 << 14)
+#define MC__STARTD1                              (MCPARAMID)(  783 << 14)
+#define MC__STARTD2                              (MCPARAMID)(  784 << 14)
+#define MC__STEPX                                (MCPARAMID)(  785 << 14)
+#define MC__STEPY                                (MCPARAMID)(  786 << 14)
+#define MC__OFSU                                 (MCPARAMID)(  787 << 14)
+#define MC__OFSD                                 (MCPARAMID)(  788 << 14)
+#define MC__SELINC                               (MCPARAMID)(  789 << 14)
+#define MC__SELINC_EOL                             1
+#define MC__SELINC_EOF                             2
+#define MC__SELINC_EOL2                            3
+#define MC__SELINC_EOF2                            4
+#define MC__YChannels                            (MCPARAMID)(  790 << 14)
+#define MC__TFINC                                (MCPARAMID)(  791 << 14)
+#define MC_SWICodeMask                           (MCPARAMID)(  792 << 14)
+#define MC_SASCodeMask                           (MCPARAMID)(  793 << 14)
+#define MC_EAPCodeMask                           (MCPARAMID)(  794 << 14)
+#define MC_NOWCodeMask                           (MCPARAMID)(  795 << 14)
+#define MC_Gain1Ctl                              (MCPARAMID)(  796 << 14)
+#define MC_Gain1Ctl_LIN                            1
+#define MC_Gain1Ctl_p3DB                           2
+#define MC_Gain1Ctl_p2DB                           3
+#define MC_Gain1Ctl_p1DB                           4
+#define MC_Gain1Ctl_0DB                            5
+#define MC_Gain1Ctl_m1DB                           6
+#define MC_Gain1Ctl_m2DB                           7
+#define MC_Gain1Ctl_m3DB                           8
+#define MC_Gain1                                 (MCPARAMID)(  797 << 14)
+#define MC_Offset1                               (MCPARAMID)(  798 << 14)
+#define MC_Gain2Ctl                              (MCPARAMID)(  799 << 14)
+#define MC_Gain2Ctl_LIN                            1
+#define MC_Gain2Ctl_p3DB                           2
+#define MC_Gain2Ctl_p2DB                           3
+#define MC_Gain2Ctl_p1DB                           4
+#define MC_Gain2Ctl_0DB                            5
+#define MC_Gain2Ctl_m1DB                           6
+#define MC_Gain2Ctl_m2DB                           7
+#define MC_Gain2Ctl_m3DB                           8
+#define MC_Gain2                                 (MCPARAMID)(  800 << 14)
+#define MC_Offset2                               (MCPARAMID)(  801 << 14)
+#define MC_Gain3Ctl                              (MCPARAMID)(  802 << 14)
+#define MC_Gain3Ctl_LIN                            1
+#define MC_Gain3Ctl_p3DB                           2
+#define MC_Gain3Ctl_p2DB                           3
+#define MC_Gain3Ctl_p1DB                           4
+#define MC_Gain3Ctl_0DB                            5
+#define MC_Gain3Ctl_m1DB                           6
+#define MC_Gain3Ctl_m2DB                           7
+#define MC_Gain3Ctl_m3DB                           8
+#define MC_Gain3                                 (MCPARAMID)(  803 << 14)
+#define MC_Offset3                               (MCPARAMID)(  804 << 14)
+#define MC_NominalGainACode                      (MCPARAMID)(  805 << 14)
+#define MC_NominalGainBCode                      (MCPARAMID)(  806 << 14)
+#define MC_NominalGainCCode                      (MCPARAMID)(  807 << 14)
+#define MC_NominalGainDCode                      (MCPARAMID)(  808 << 14)
+#define MC__NominalGain1Code                     (MCPARAMID)(  809 << 14)
+#define MC__NominalGain2Code                     (MCPARAMID)(  810 << 14)
+#define MC__NominalGain3Code                     (MCPARAMID)(  811 << 14)
+#define MC__Gain1Code                            (MCPARAMID)(  812 << 14)
+#define MC__Gain2Code                            (MCPARAMID)(  813 << 14)
+#define MC__Gain3Code                            (MCPARAMID)(  814 << 14)
+#define MC_X_IPLLOn                              (MCPARAMID)(  815 << 14)
+#define MC_X_IPLLOff                             (MCPARAMID)(  816 << 14)
+#define MC_ModuleType_Unknown                      1
+#define MC_ModuleType_NoModule                     2
+#define MC_ModuleType_D16A                         3
+#define MC_ModuleType_D32AB                        4
+#define MC_ModuleType_D32B                         5
+#define MC_ModuleType_D16C                         6
+#define MC_ModuleType_D32C                         7
+#define MC_NextTrigMode_REPEAT                     1
+#define MC_NextTrigMode_HARD                       2
+#define MC_NextTrigMode_SOFT                       3
+#define MC_NextTrigMode_COMBINED                   4
+#define MC_AcqMode                               (MCPARAMID)(  817 << 14)
+#define MC_AcqMode_GRABBER                         1
+#define MC_AcqMode_TIMER                           2
+#define MC_AcqMode_SYSTEM                          3
+#define MC_TrigCtl_TTL                             1
+#define MC_JumperCK                              (MCPARAMID)(  818 << 14)
+#define MC_JumperCK_CKDPOS                         1
+#define MC_JumperCK_CKDNEG                         2
+#define MC_JumperCK_CKSPOS                         3
+#define MC_JumperCK_CKSNEG                         4
+#define MC_JumperCK_ZLANE                          5
+#define MC_JumperCK_EMPTY                          6
+#define MC_JumperL1                              (MCPARAMID)(  819 << 14)
+#define MC_JumperL1_DT                             1
+#define MC_JumperL1_DU                             2
+#define MC_JumperL1_ST                             3
+#define MC_JumperL1_SU                             4
+#define MC_JumperL2                              (MCPARAMID)(  820 << 14)
+#define MC_JumperL2_DT                             1
+#define MC_JumperL2_DU                             2
+#define MC_JumperL2_ST                             3
+#define MC_JumperL2_SU                             4
+#define MC_JumperH                               (MCPARAMID)(  821 << 14)
+#define MC_JumperH_TTL                             1
+#define MC_JumperH_DPOS                            2
+#define MC_JumperH_DNEG                            3
+#define MC_JumperV                               (MCPARAMID)(  822 << 14)
+#define MC_JumperV_TTL                             1
+#define MC_JumperV_DPOS                            2
+#define MC_JumperV_DNEG                            3
+#define MC_ADresolution                          (MCPARAMID)(  823 << 14)
+#define MC_ADresolution_8BIT                       1
+#define MC_ADresolution_10BIT                      2
+#define MC_LineDurTrimOK                         (MCPARAMID)(  824 << 14)
+#define MC_LineDurTrimOK_YES                       1
+#define MC_LineDurTrimOK_NO                        2
+#define MC_OffsetX_Px                            (MCPARAMID)(  825 << 14)
+#define MC_WindowX_Px                            (MCPARAMID)(  826 << 14)
+#define MC_WindowY_Ln                            (MCPARAMID)(  827 << 14)
+#define MC_WindowX_Tk                            (MCPARAMID)(  828 << 14)
+#define MC_VdriveDly_Ln                          (MCPARAMID)(  829 << 14)
+#define MC_Expose_us                             (MCPARAMID)(  830 << 14)
+#define MC_ExposeTrim                            (MCPARAMID)(  831 << 14)
+#define MC_TrueExp_us                            (MCPARAMID)(  832 << 14)
+#define MC_StrobeLevel                           (MCPARAMID)(  833 << 14)
+#define MC_StrobeLevel_PLSHIGH                     1
+#define MC_StrobeLevel_PLSLOW                      2
+#define MC_StrobeLevel_HIGH                        3
+#define MC_StrobeLevel_LOW                         4
+#define MC_StrobeDur                             (MCPARAMID)(  834 << 14)
+#define MC_StrobePos                             (MCPARAMID)(  835 << 14)
+#define MC_StrobeCtl                             (MCPARAMID)(  836 << 14)
+#define MC_StrobeCtl_NONE                          1
+#define MC_StrobeCtl_TTL                           2
+#define MC_StrobeLine                            (MCPARAMID)(  837 << 14)
+#define MC_StrobeLine_NOM                          1
+#define MC_StrobeLine_ALT1                         2
+#define MC_StrobeLine_ALT2                         3
+#define MC_StrobeLine_ALT3                         4
+#define MC_StrobeLine_ALT4                         5
+#define MC_GainCtl                               (MCPARAMID)(  838 << 14)
+#define MC_GainCtl_LIN                             1
+#define MC_GainCtl_p3DB                            2
+#define MC_GainCtl_p2DB                            3
+#define MC_GainCtl_p1DB                            4
+#define MC_GainCtl_0DB                             5
+#define MC_GainCtl_m1DB                            6
+#define MC_GainCtl_m2DB                            7
+#define MC_GainCtl_m3DB                            8
+#define MC_GainTrim1                             (MCPARAMID)(  839 << 14)
+#define MC_GainTrim2                             (MCPARAMID)(  840 << 14)
+#define MC_GainTrim3                             (MCPARAMID)(  841 << 14)
+#define MC_Offset                                (MCPARAMID)(  842 << 14)
+#define MC_OffsetTrim1                           (MCPARAMID)(  843 << 14)
+#define MC_OffsetTrim2                           (MCPARAMID)(  844 << 14)
+#define MC_OffsetTrim3                           (MCPARAMID)(  845 << 14)
+#define MC__Offset1Code                          (MCPARAMID)(  846 << 14)
+#define MC__Offset2Code                          (MCPARAMID)(  847 << 14)
+#define MC__Offset3Code                          (MCPARAMID)(  848 << 14)
+#define MC__Tk_Px                                (MCPARAMID)(  849 << 14)
+#define MC___MSFBuild                            (MCPARAMID)(  850 << 14)
+#define MC___MSFError                            (MCPARAMID)(  851 << 14)
+#define MC_PinGATE                               (MCPARAMID)(  852 << 14)
+#define MC_PinGATE_UNUSED                          1
+#define MC_PinGATE_VSYNC                           2
+#define MC_PinVIO                                (MCPARAMID)(  853 << 14)
+#define MC_PinVIO_UNUSED                           1
+#define MC_PinVIO_VSYNC                            2
+#define MC_Cable_A15_C06                           6
+#define MC_Cable_A15_C07                           7
+#define MC_Premier                               (MCPARAMID)(  854 << 14)
+#define MC_Premier_AA                              1
+#define MC_Premier_BB                              2
+#define MC_Premier_CC                              3
+#define MC_Premier_DD                              4
+#define MC_Premier_ZZ                              5
+#define MC_ParamIn2                              (MCPARAMID)(  855 << 14)
+#define MC_Auteur                                (MCPARAMID)(  856 << 14)
+#define MC_Auteur_TOI                              1
+#define MC_Auteur_MOI                              2
+#define MC_Auteur_EUX                              3
+#define MC_Auteur_NOUS                             4
+#define MC_Auteur_LUI                              5
+#define MC_Menteur                               (MCPARAMID)(  857 << 14)
+#define MC_ParamIn8                              (MCPARAMID)(  858 << 14)
+#define MC_ParamOut1                             (MCPARAMID)(  859 << 14)
+#define MC_ParamOut1_XX                            1
+#define MC_ParamOut1_YY                            2
+#define MC_ParamOut1_ZZ                            3
+#define MC_Carton                                (MCPARAMID)(  860 << 14)
+#define MC_Carton_ALPHA                            1
+#define MC_Carton_BETA                             2
+#define MC_Carton_GAMMA                            3
+#define MC_Carton_DELTA                            4
+#define MC_ParamOut4                             (MCPARAMID)(  861 << 14)
+#define MC_ParamOut5                             (MCPARAMID)(  862 << 14)
+#define MC_Arthur                                (MCPARAMID)(  863 << 14)
+#define MC_Arthur_X                                1
+#define MC_Arthur_Y                                2
+#define MC_Arthur_Z                                3
+#define MC_Acteur                                (MCPARAMID)(  864 << 14)
+#define MC_Acteur_JOE                              1
+#define MC__CFG                                  (MCPARAMID)(  865 << 14)
+#define MC__CFG_MONOCAM                            1
+#define MC__CFG_DUOCAMA                            2
+#define MC__CFG_DUOCAMB                            3
+#define MC_TapCount                              (MCPARAMID)(  866 << 14)
+#define MC__Bend16                               (MCPARAMID)(  867 << 14)
+#define MC__Bend15                               (MCPARAMID)(  868 << 14)
+#define MC__Bend14                               (MCPARAMID)(  869 << 14)
+#define MC__Bend13                               (MCPARAMID)(  870 << 14)
+#define MC__Bend12                               (MCPARAMID)(  871 << 14)
+#define MC__Bend11                               (MCPARAMID)(  872 << 14)
+#define MC__Bend10                               (MCPARAMID)(  873 << 14)
+#define MC__Bend9                                (MCPARAMID)(  874 << 14)
+#define MC__Bend8                                (MCPARAMID)(  875 << 14)
+#define MC__Bend7                                (MCPARAMID)(  876 << 14)
+#define MC__Bend6                                (MCPARAMID)(  877 << 14)
+#define MC__Bend5                                (MCPARAMID)(  878 << 14)
+#define MC__Bend4                                (MCPARAMID)(  879 << 14)
+#define MC__Bend3                                (MCPARAMID)(  880 << 14)
+#define MC__Bend2                                (MCPARAMID)(  881 << 14)
+#define MC__Bend1                                (MCPARAMID)(  882 << 14)
+#define MC_CamCount                              (MCPARAMID)(  883 << 14)
+#define MC_ChannelTopology_QUADXTAP                9
+#define MC_BackEndProg_ABC34                      10
+#define MC_BackEndProg_ABCD44                     11
+#define MC_BackEndOption                         (MCPARAMID)(  884 << 14)
+#define MC_TimingClockFrequency                  (MCPARAMID)(  885 << 14)
+#define MC_TapCount_ONE                            1
+#define MC_TapCount_TWO                            2
+#define MC_TapCount_THREE                          3
+#define MC_TapCount_FOUR                           4
+#define MC_TapCount_TWO_Y_END                      5
+#define MC_USOutM_ABC1                            13
+#define MC_BlockCount                            (MCPARAMID)(  886 << 14)
+#define MC_PlaneTopology                         (MCPARAMID)(  887 << 14)
+#define MC_PlaneTopology_SINGLE                    1
+#define MC_PlaneTopology_MULTIPLE                  2
+#define MC_Line1Cfg                              (MCPARAMID)(  888 << 14)
+#define MC_Line1Cfg_DIFF_IN_T                      1
+#define MC_Line1Cfg_TTL_IN_Z                       2
+#define MC_RX1                                   (MCPARAMID)(  889 << 14)
+#define MC_TX1                                   (MCPARAMID)(  890 << 14)
+#define MC_Line2Cfg                              (MCPARAMID)(  891 << 14)
+#define MC_Line2Cfg_DIFF_IN_T                      1
+#define MC_Line2Cfg_TTL_IN_Z                       2
+#define MC_RX2                                   (MCPARAMID)(  892 << 14)
+#define MC_TX2                                   (MCPARAMID)(  893 << 14)
+#define MC_SX12                                  (MCPARAMID)(  894 << 14)
+#define MC_Line3Cfg                              (MCPARAMID)(  895 << 14)
+#define MC_Line3Cfg_DIFF_OUT                       1
+#define MC_Line3Cfg_TTL_OUT                        2
+#define MC_Line4Cfg                              (MCPARAMID)(  896 << 14)
+#define MC_Line4Cfg_DIFF_OUT                       1
+#define MC_Line4Cfg_DIFF_IN_T                      2
+#define MC_Line4Cfg_TTL_IN_Z                       3
+#define MC_RX4                                   (MCPARAMID)(  897 << 14)
+#define MC_TX4                                   (MCPARAMID)(  898 << 14)
+#define MC_SX34                                  (MCPARAMID)(  899 << 14)
+#define MC_Line5Cfg                              (MCPARAMID)(  900 << 14)
+#define MC_Line5Cfg_DIFF_OUT                       1
+#define MC_Line5Cfg_TTL_OUT                        2
+#define MC_Line6Cfg                              (MCPARAMID)(  901 << 14)
+#define MC_Line6Cfg_DIFF_OUT                       1
+#define MC_Line6Cfg_TTL_OUT                        2
+#define MC_SX56                                  (MCPARAMID)(  902 << 14)
+#define MC_Line6Ctl_RESET                          3
+#define MC_Line6Ctl_EXPOSE                         4
+#define MC_Line4Ctl_DCLKIN                         4
+#define MC_TPFrequencyRatio                      (MCPARAMID)(  903 << 14)
+#define MC__DCGComb                              (MCPARAMID)(  904 << 14)
+#define MC__DCGComb_NO                             1
+#define MC__DCGComb_YES                            2
+#define MC_TimUnitN                              (MCPARAMID)(  905 << 14)
+#define MC_TimUnitN_UNKNOWN                        1
+#define MC_TimUnitN_FREE                           2
+#define MC_TimUnitN_USEDX                          3
+#define MC_TimUnitN_USEDY                          4
+#define MC_TimUnitN_CONFLICT                       5
+#define MC_MapConTim_XY                            7
+#define MC_MapDigTim_NONE                          8
+#define MC_MapTimCon_TXY                           7
+#define MC_MapTimDig_TXX                           7
+#define MC_MapTimDig_TXY                           8
+#define MC_MapLaneY1_B                             5
+#define MC_MapLaneX1_B                             3
+#define MC_MapLaneX2_A                             3
+#define MC_MapLaneY2_A                             4
+#define MC__BoardType                            (MCPARAMID)(  906 << 14)
+#define MC__BoardType__ALPHA                       1
+#define MC__BoardType__GAMMA                       2
+#define MC_MapConTim_YX                            8
+#define MC_MapTimCon_TYX                           8
+#define MC_VCSync                                (MCPARAMID)(  907 << 14)
+#define MC_VCSync_NO                               1
+#define MC_VCSync_YES                              2
+#define MC__Integer1                             (MCPARAMID)(  908 << 14)
+#define MC__SlowMode                             (MCPARAMID)(  909 << 14)
+#define MC__SlowMode_OFF                           1
+#define MC__SlowMode_ON                            2
+#define MC_Expose_Tk                             (MCPARAMID)(  910 << 14)
+#define MC__ST_StrxCtl                           (MCPARAMID)(  911 << 14)
+#define MC__ST_StrxCtl_High                        1
+#define MC__ST_StrxCtl_Low                         2
+#define MC__ST_StryCtl                           (MCPARAMID)(  912 << 14)
+#define MC__ST_StryCtl_High                        1
+#define MC__ST_StryCtl_Low                         2
+#define MC__ST_StrzCtl                           (MCPARAMID)(  913 << 14)
+#define MC__ST_StrzCtl_High                        1
+#define MC__ST_StrzCtl_Low                         2
+#define MC__ST_TVxCtl                            (MCPARAMID)(  914 << 14)
+#define MC__ST_TVxCtl_High                         1
+#define MC__ST_TVxCtl_Low                          2
+#define MC__ST_TVxCtl_Input                        3
+#define MC__ST_TVyCtl                            (MCPARAMID)(  915 << 14)
+#define MC__ST_TVyCtl_High                         1
+#define MC__ST_TVyCtl_Low                          2
+#define MC__ST_TVyCtl_Input                        3
+#define MC__ST_TVzCtl                            (MCPARAMID)(  916 << 14)
+#define MC__ST_TVzCtl_High                         1
+#define MC__ST_TVzCtl_Low                          2
+#define MC__ST_TVzCtl_Input                        3
+#define MC__ST_THxCtl                            (MCPARAMID)(  917 << 14)
+#define MC__ST_THxCtl_High                         1
+#define MC__ST_THxCtl_Low                          2
+#define MC__ST_THxCtl_Input                        3
+#define MC__ST_THyCtl                            (MCPARAMID)(  918 << 14)
+#define MC__ST_THyCtl_High                         1
+#define MC__ST_THyCtl_Low                          2
+#define MC__ST_THyCtl_Input                        3
+#define MC__ST_THzCtl                            (MCPARAMID)(  919 << 14)
+#define MC__ST_THzCtl_High                         1
+#define MC__ST_THzCtl_Low                          2
+#define MC__ST_THzCtl_Input                        3
+#define MC__ST_TExCtl                            (MCPARAMID)(  920 << 14)
+#define MC__ST_TExCtl_High                         1
+#define MC__ST_TExCtl_Low                          2
+#define MC__ST_TExCtl_Input                        3
+#define MC__ST_TEyCtl                            (MCPARAMID)(  921 << 14)
+#define MC__ST_TEyCtl_High                         1
+#define MC__ST_TEyCtl_Low                          2
+#define MC__ST_TEyCtl_Input                        3
+#define MC__ST_TEzCtl                            (MCPARAMID)(  922 << 14)
+#define MC__ST_TEzCtl_High                         1
+#define MC__ST_TEzCtl_Low                          2
+#define MC__ST_TEzCtl_Input                        3
+#define MC__ST_TGxCtl                            (MCPARAMID)(  923 << 14)
+#define MC__ST_TGxCtl_High                         1
+#define MC__ST_TGxCtl_Low                          2
+#define MC__ST_TGxCtl_Input                        3
+#define MC__ST_TGyCtl                            (MCPARAMID)(  924 << 14)
+#define MC__ST_TGyCtl_High                         1
+#define MC__ST_TGyCtl_Low                          2
+#define MC__ST_TGyCtl_Input                        3
+#define MC__ST_TGzCtl                            (MCPARAMID)(  925 << 14)
+#define MC__ST_TGzCtl_High                         1
+#define MC__ST_TGzCtl_Low                          2
+#define MC__ST_TGzCtl_Input                        3
+#define MC__ST_TRxCtl                            (MCPARAMID)(  926 << 14)
+#define MC__ST_TRxCtl_High                         1
+#define MC__ST_TRxCtl_Low                          2
+#define MC__ST_TRxCtl_Input                        3
+#define MC__ST_TRyCtl                            (MCPARAMID)(  927 << 14)
+#define MC__ST_TRyCtl_High                         1
+#define MC__ST_TRyCtl_Low                          2
+#define MC__ST_TRyCtl_Input                        3
+#define MC__ST_TRzCtl                            (MCPARAMID)(  928 << 14)
+#define MC__ST_TRzCtl_High                         1
+#define MC__ST_TRzCtl_Low                          2
+#define MC__ST_TRzCtl_Input                        3
+#define MC__ST_Out1Ctl                           (MCPARAMID)(  929 << 14)
+#define MC__ST_Out1Ctl_High                        1
+#define MC__ST_Out1Ctl_Low                         2
+#define MC__ST_Out2Ctl                           (MCPARAMID)(  930 << 14)
+#define MC__ST_Out2Ctl_High                        1
+#define MC__ST_Out2Ctl_Low                         2
+#define MC__ST_Out3Ctl                           (MCPARAMID)(  931 << 14)
+#define MC__ST_Out3Ctl_High                        1
+#define MC__ST_Out3Ctl_Low                         2
+#define MC__ST_Out4Ctl                           (MCPARAMID)(  932 << 14)
+#define MC__ST_Out4Ctl_High                        1
+#define MC__ST_Out4Ctl_Low                         2
+#define MC_Destination_DSP12                       4
+#define MC__ST_aFilter                           (MCPARAMID)(  933 << 14)
+#define MC__ST_aFilter_NONE                        1
+#define MC__ST_aFilter_10MHZ                       2
+#define MC__ST_aFilter_5MHZ                        3
+#define MC__ST_aFilter_5MHZ_PAL                    4
+#define MC__ST_aFilter_5MHZ_NTSC                   5
+#define MC__ST_bFilter                           (MCPARAMID)(  934 << 14)
+#define MC__ST_bFilter_NONE                        1
+#define MC__ST_bFilter_10MHZ                       2
+#define MC__ST_bFilter_5MHZ                        3
+#define MC__ST_bFilter_5MHZ_PAL                    4
+#define MC__ST_bFilter_5MHZ_NTSC                   5
+#define MC_CamConfig_P25RD                        16
+#define MC__TIMATIM                              (MCPARAMID)(  935 << 14)
+#define MC__DIGATIM                              (MCPARAMID)(  936 << 14)
+#define MC_CamConfig_P30RD                        17
+#define MC_Clanes_qP_QS                           17
+#define MC_Clanes_sR_SQ                           18
+#define MC_MMmask                                (MCPARAMID)(  937 << 14)
+#define MC_GrabberConfig_0_3_1                     7
+#define MC__ASSY31                               (MCPARAMID)(  938 << 14)
+#define MC__ASSY32                               (MCPARAMID)(  939 << 14)
+#define MC__ASSY33                               (MCPARAMID)(  940 << 14)
+#define MC__ASSY34                               (MCPARAMID)(  941 << 14)
+#define MC__PShiftA                              (MCPARAMID)(  942 << 14)
+#define MC__PShiftB                              (MCPARAMID)(  943 << 14)
+#define MC__PShiftC                              (MCPARAMID)(  944 << 14)
+#define MC__PShiftD                              (MCPARAMID)(  945 << 14)
+#define MC__PShift3                              (MCPARAMID)(  946 << 14)
+#define MC__CPHASE                               (MCPARAMID)(  947 << 14)
+#define MC__CPHASE_INDEPENDENT                     1
+#define MC__CPHASE_GROUPED                         2
+#define MC_Camera_HV_C20AEK                       12
+#define MC_Camera_XC_003                          13
+#define MC__RSTFIFO                              (MCPARAMID)(  948 << 14)
+#define MC__RSTFIFO_DISABLED                       1
+#define MC__RSTFIFO_ENABLED                        2
+#define MC__Fields                               (MCPARAMID)(  949 << 14)
+#define MC__UpField                              (MCPARAMID)(  950 << 14)
+#define MC__STARTU3                              (MCPARAMID)(  951 << 14)
+#define MC__STARTD3                              (MCPARAMID)(  952 << 14)
+#define MC_Cable_A15_C08                           8
+#define MC_Cable_A15_C09                           9
+#define MC_LutSelect1                            (MCPARAMID)(  953 << 14)
+#define MC_LutSelect2                            (MCPARAMID)(  954 << 14)
+#define MC_LutSelect3                            (MCPARAMID)(  955 << 14)
+#define MC_InputFilter                           (MCPARAMID)(  956 << 14)
+#define MC_InputFilter_NONE                        1
+#define MC_InputFilter_10MHZ                       2
+#define MC_InputFilter_5MHZ                        3
+#define MC_InputFilter_5MHZ_PAL                    4
+#define MC_InputFilter_5MHZ_NTSC                   5
+#define MC_VideoFilter                           (MCPARAMID)(  957 << 14)
+#define MC_VideoFilter_NONE                        1
+#define MC_VideoFilter_10MHZ                       2
+#define MC_VideoFilter_5MHZ                        3
+#define MC_VideoFilter_5MHZ_PAL                    4
+#define MC_VideoFilter_5MHZ_NTSC                   5
+#define MC_SYNCLoadSet                           (MCPARAMID)(  958 << 14)
+#define MC_VCAMLoadSet                           (MCPARAMID)(  959 << 14)
+#define MC_SWISet                                (MCPARAMID)(  960 << 14)
+#define MC_SASSet                                (MCPARAMID)(  961 << 14)
+#define MC_EAPSet                                (MCPARAMID)(  962 << 14)
+#define MC_NOWSet                                (MCPARAMID)(  963 << 14)
+#define MC___MSFError_Check                      (MCPARAMID)(  964 << 14)
+#define MC___MSFError_Check_PASS                   1
+#define MC___MSFError_Check_FAIL                   2
+#define MC___GrabberConfig_Check                 (MCPARAMID)(  965 << 14)
+#define MC___GrabberConfig_Check_PASS              1
+#define MC___GrabberConfig_Check_FAIL              2
+#define MC___Alpha_TimUnitN_Check                (MCPARAMID)(  966 << 14)
+#define MC___Alpha_TimUnitN_Check_PASS             1
+#define MC___Alpha_TimUnitN_Check_FAIL             2
+#define MC___Alpha_SyncMode_Check                (MCPARAMID)(  967 << 14)
+#define MC___Alpha_SyncMode_Check_PASS             1
+#define MC___Alpha_SyncMode_Check_FAIL             2
+#define MC___Alpha_ADresolution_Check            (MCPARAMID)(  968 << 14)
+#define MC___Alpha_ADresolution_Check_PASS         1
+#define MC___Alpha_ADresolution_Check_FAIL         2
+#define MC___Alpha_CalPat_Check                  (MCPARAMID)(  969 << 14)
+#define MC___Alpha_CalPat_Check_PASS               1
+#define MC___Alpha_CalPat_Check_FAIL               2
+#define MC_GrabberConfig_Filter                  (MCPARAMID)(  970 << 14)
+#define MC_TrigMode_Filter                       (MCPARAMID)(  971 << 14)
+#define MC_Connector_Filter                      (MCPARAMID)(  972 << 14)
+#define MC_ConnectLoc_Filter                     (MCPARAMID)(  973 << 14)
+#define MC_ADresolution_Filter                   (MCPARAMID)(  974 << 14)
+#define MC_CalPat_Filter                         (MCPARAMID)(  975 << 14)
+#define MC_ChannelTopology_Filter                (MCPARAMID)(  976 << 14)
+#define MC_SyncMode_Filter                       (MCPARAMID)(  977 << 14)
+#define MC_Cable_Filter                          (MCPARAMID)(  978 << 14)
+#define MC_Camera_KP_F3                           14
+#define MC_Camera_KP_F3W                          15
+#define MC_Camera_Generic                         16
+#define MC_Camera_Generic_RGB                     17
+#define MC_NextTrigMode_SAME                       5
+#define MC_CamConfig_I50RA                        18
+#define MC_Cable_A15_C10                          10
+#define MC_X_VRSTOn                              (MCPARAMID)(  979 << 14)
+#define MC_X_VRSTOff                             (MCPARAMID)(  980 << 14)
+#define MC__DeltaX_SIGEOL_RSTOn                  (MCPARAMID)(  981 << 14)
+#define MC__DeltaX_SIGEOL_RSTOff                 (MCPARAMID)(  982 << 14)
+#define MC_Camera_HV_C20AP                        12
+#define MC_Operation_SPECIAL                       4
+#define MC_HV_C20AP_AsyncLoadSet                 (MCPARAMID)(  983 << 14)
+#define MC_CamConfig_P100SA                       19
+#define MC_HReset                                (MCPARAMID)(  984 << 14)
+#define MC_HReset_NO                               1
+#define MC_HReset_YES                              2
+#define MC__ETimebase                            (MCPARAMID)(  985 << 14)
+#define MC__ETimebase_READOUT_TIMER                1
+#define MC__ETimebase_TIMING_CLOCK                 2
+#define MC__E_Tk                                 (MCPARAMID)(  986 << 14)
+#define MC__ESpan_us                             (MCPARAMID)(  987 << 14)
+#define MC__ESpan_Tk                             (MCPARAMID)(  988 << 14)
+#define MC__EXPOn_E                              (MCPARAMID)(  989 << 14)
+#define MC__EXPOff_E                             (MCPARAMID)(  990 << 14)
+#define MC__ExposeWidth_E                        (MCPARAMID)(  991 << 14)
+#define MC__StrobeWidth_E                        (MCPARAMID)(  992 << 14)
+#define MC__STROn_E                              (MCPARAMID)(  993 << 14)
+#define MC__STROff_E                             (MCPARAMID)(  994 << 14)
+#define MC__EXPWidth_E                           (MCPARAMID)(  995 << 14)
+#define MC__STRWidth_E                           (MCPARAMID)(  996 << 14)
+#define MC__ENDE_E                               (MCPARAMID)(  997 << 14)
+#define MC_ExpEdge                               (MCPARAMID)(  998 << 14)
+#define MC_ExpEdge_GOLOW                           1
+#define MC_ExpEdge_GOHIGH                          2
+#define MC__TrueExp_Tk                           (MCPARAMID)(  999 << 14)
+#define MC__ExposeTrim_pc                        (MCPARAMID)( 1000 << 14)
+#define MC_CamConfig_P100RA_G                     20
+#define MC_ExposeOverlap                         (MCPARAMID)( 1001 << 14)
+#define MC_ExposeOverlap_FORBID                    1
+#define MC_ExposeOverlap_ALLOW                     2
+#define MC__TrigLine                             (MCPARAMID)( 1002 << 14)
+#define MC_D4Input                               (MCPARAMID)( 1003 << 14)
+#define MC_D4Input_ON                              1
+#define MC_D4Input_OFF                             2
+#define MC__Category                             (MCPARAMID)( 1004 << 14)
+#define MC__Category_Camera_Specification          1
+#define MC__Category_Camera_Timing                 2
+#define MC__Category_Camera_Features               3
+#define MC__Category_Line_Scan_Features            4
+#define MC__Category_Trigger_Control               5
+#define MC__Category_Exposure_Control              6
+#define MC__Category_Strobe_Control                7
+#define MC__Category_Board_Linkage                 8
+#define MC__Category_Board_Configuration           9
+#define MC__Category_Grabber_Configuration        10
+#define MC__Category_Grabber_Timing               11
+#define MC__Category_Grabber_Conditioning         12
+#define MC__Category_Cluster_Linkage              13
+#define MC_CamConfig_FACTORY                      21
+#define MC_TapStructure                          (MCPARAMID)( 1005 << 14)
+#define MC_TapStructure_SINGLE_A                   1
+#define MC_TapStructure_DUAL_A                     2
+#define MC_TapStructure_TRIPLE_A                   3
+#define MC_Manufacturer                          (MCPARAMID)( 1006 << 14)
+#define MC_Manufacturer_NONE                       1
+#define MC_Manufacturer_HITACHI                    2
+#define MC_Manufacturer_JAI                        3
+#define MC_Manufacturer_SONY                       4
+#define MC_Imaging                               (MCPARAMID)( 1007 << 14)
+#define MC_Imaging_AREA                            1
+#define MC_Spectrum                              (MCPARAMID)( 1008 << 14)
+#define MC_Spectrum_BW                             1
+#define MC_Spectrum_COLOR                          2
+#define MC_Spectrum_IR                             3
+#define MC_DataLink                              (MCPARAMID)( 1009 << 14)
+#define MC_DataLink_ANALOG                         1
+#define MC_ColorMethod                           (MCPARAMID)( 1010 << 14)
+#define MC_ColorMethod_NONE                        1
+#define MC_ColorMethod_PRISM                       2
+#define MC_ColorMethod_RGB                         3
+#define MC_Expose                                (MCPARAMID)( 1011 << 14)
+#define MC_Expose_PLSTRG                           3
+#define MC_Expose_PLSCTL                           4
+#define MC_Expose_WIDTH                            5
+#define MC_Expose_INTCTL                           6
+#define MC_Expose_INTPRM                           7
+#define MC_Expose_EXTPRM                           8
+#define MC_Readout                               (MCPARAMID)( 1012 << 14)
+#define MC_Readout_PLSTRG                          1
+#define MC_Readout_WIDTH                           2
+#define MC_Readout_INTCTL                          3
+#define MC__Category_Channel_Management           14
+#define MC__Category_Exception_Management         15
+#define MC__Category_Board_Information            16
+#define MC__ScanMode                             (MCPARAMID)( 1013 << 14)
+#define MC__ScanMode_PROGRESSIVE                   1
+#define MC__ScanMode_INTERLACE                     2
+#define MC_ENDSet                                (MCPARAMID)( 1014 << 14)
+#define MC_EncoderTrim                           (MCPARAMID)( 1015 << 14)
+#define MC__BitCalcArg                           (MCPARAMID)( 1016 << 14)
+#define MC__XTALTrim                             (MCPARAMID)( 1017 << 14)
+#define MC__REFCKATrim                           (MCPARAMID)( 1018 << 14)
+#define MC__BoardType__VALUE                       3
+#define MC__BoardType__EXPERT                      4
+#define MC_Camera_Generic_Dual                    18
+#define MC_Camera_1000m                           19
+#define MC_TapStructure_SINGLE_B                   4
+#define MC_TapStructure_SINGLE_W                   5
+#define MC_TapStructure_DUAL_B                     6
+#define MC_TapStructure_DUAL_B2                    7
+#define MC_TapStructure_DUAL_W                     8
+#define MC_TapStructure_DUAL_W2                    9
+#define MC_TapStructure_TRIPLE_B                  10
+#define MC_TapStructure_TRIPLE_W                  11
+#define MC_TapStructure_QUAD_B                    12
+#define MC_TapStructure_QUAD_B2                   13
+#define MC_TapStructure_QUAD_B4                   14
+#define MC_TapStructure_OCTAL_B2                  15
+#define MC_TapStructure_Filter                   (MCPARAMID)( 1019 << 14)
+#define MC_Operation_PAGE                          5
+#define MC_Operation_WEB                           6
+#define MC_Manufacturer_ADIMEC                     5
+#define MC_DataLink_CAMERALINK                     2
+#define MC_DataClk_Hz                            (MCPARAMID)( 1020 << 14)
+#define MC_Hactive_Px                            (MCPARAMID)( 1021 << 14)
+#define MC_HsyncAft_ns                           (MCPARAMID)( 1022 << 14)
+#define MC_VsyncPst_Ln                           (MCPARAMID)( 1023 << 14)
+#define MC_HsyncPst_ns                           (MCPARAMID)( 1024 << 14)
+#define MC_VgatePos_Ln                           (MCPARAMID)( 1025 << 14)
+#define MC_CameraDataWidth                       (MCPARAMID)( 1026 << 14)
+#define MC_CameraDataWidth_8BIT                    1
+#define MC_CameraDataWidth_10BIT                   2
+#define MC_CameraDataWidth_12BIT                   3
+#define MC_CameraDataWidth_14BIT                   4
+#define MC_CameraDataWidth_16BIT                   5
+#define MC_PixelClkCtl_BUILTIN                     4
+#define MC_PixelClkEdge_BUILTIN                    3
+#define MC_HsyncCtl_BUILTIN                        4
+#define MC_VsyncCtl_BUILTIN                        4
+#define MC_ResetCtl                              (MCPARAMID)( 1027 << 14)
+#define MC_ResetCtl_NONE                           1
+#define MC_ResetCtl_TTL                            2
+#define MC_ResetCtl_DIFF                           3
+#define MC_ResetEdge                             (MCPARAMID)( 1028 << 14)
+#define MC_ResetEdge_GOHIGH                        1
+#define MC_ResetEdge_GOLOW                         2
+#define MC_AuxResetCtl                           (MCPARAMID)( 1029 << 14)
+#define MC_AuxResetCtl_NONE                        1
+#define MC_AuxResetCtl_TTL                         2
+#define MC_AuxResetCtl_DIFF                        3
+#define MC_AuxResetEdge                          (MCPARAMID)( 1030 << 14)
+#define MC_AuxResetEdge_GOHIGH                     1
+#define MC_AuxResetEdge_GOLOW                      2
+#define MC_ResetDur                              (MCPARAMID)( 1031 << 14)
+#define MC_ResetPos                              (MCPARAMID)( 1032 << 14)
+#define MC_ExposeMin_us                          (MCPARAMID)( 1033 << 14)
+#define MC_ExposeMax_us                          (MCPARAMID)( 1034 << 14)
+#define MC_FvalMode                              (MCPARAMID)( 1035 << 14)
+#define MC_FvalMode_FN                             1
+#define MC_FvalMode_FA                             2
+#define MC_FvalMode_FC                             3
+#define MC_FvalMode_PC                             4
+#define MC_LvalMode                              (MCPARAMID)( 1036 << 14)
+#define MC_LvalMode_LA                             1
+#define MC_LvalMode_LP                             2
+#define MC_LvalMode_LB                             3
+#define MC_LvalMode_LC                             4
+#define MC_DvalMode                              (MCPARAMID)( 1037 << 14)
+#define MC_DvalMode_DN                             1
+#define MC_DvalMode_DG                             2
+#define MC_DvalMode_DC                             3
+#define MC_Cable_CL_C01                           11
+#define MC__Category_Cable_Features               17
+#define MC__Category_Encoder_Control              18
+#define MC_PageDelay_Ln                          (MCPARAMID)( 1038 << 14)
+#define MC_PageLength_Ln                         (MCPARAMID)( 1039 << 14)
+#define MC_GrabberDataWidth                      (MCPARAMID)( 1040 << 14)
+#define MC_GrabberDataWidth_8BIT                   1
+#define MC_GrabberDataWidth_10BIT                  2
+#define MC_GrabberDataWidth_12BIT                  3
+#define MC_GrabberDataWidth_14BIT                  4
+#define MC_GrabberDataWidth_16BIT                  5
+#define MC__CDC_SRC                              (MCPARAMID)( 1041 << 14)
+#define MC__CDC_SRC_CAMERA                         1
+#define MC__CDC_SRC_TPG                            2
+#define MC__CDC_ISIZE                            (MCPARAMID)( 1042 << 14)
+#define MC__CDC_ISIZE_BASE8                        1
+#define MC__CDC_ISIZE_BASE10                       2
+#define MC__CDC_ISIZE_BASE12                       3
+#define MC__CDC_ISIZE_BASE14                       4
+#define MC__CDC_ISIZE_BASE16                       5
+#define MC__CDC_ALIGN                            (MCPARAMID)( 1043 << 14)
+#define MC__CDC_ALIGN_BYTE                         1
+#define MC__CDC_ALIGN_WORDMS                       2
+#define MC__CDC_ALIGN_WORDLS                       3
+#define MC__CDC_FALLOC1                          (MCPARAMID)( 1044 << 14)
+#define MC__CDC_FALLOC1_256_0                      1
+#define MC__CDC_FALLOC1_128_0                      2
+#define MC__CDC_FALLOC1_128_128                    3
+#define MC__CDC_FALLOC1_64_0                       4
+#define MC__CDC_FALLOC1_64_64                      5
+#define MC__CDC_FALLOC1_64_128                     6
+#define MC__CDC_FALLOC1_64_192                     7
+#define MC__CDC_FALLOC2                          (MCPARAMID)( 1045 << 14)
+#define MC__CDC_FALLOC2_256_0                      1
+#define MC__CDC_FALLOC2_128_0                      2
+#define MC__CDC_FALLOC2_128_128                    3
+#define MC__CDC_FALLOC2_64_0                       4
+#define MC__CDC_FALLOC2_64_64                      5
+#define MC__CDC_FALLOC2_64_128                     6
+#define MC__CDC_FALLOC2_64_192                     7
+#define MC__CDC_FALLOC3                          (MCPARAMID)( 1046 << 14)
+#define MC__CDC_FALLOC3_256_0                      1
+#define MC__CDC_FALLOC3_128_0                      2
+#define MC__CDC_FALLOC3_128_128                    3
+#define MC__CDC_FALLOC3_64_0                       4
+#define MC__CDC_FALLOC3_64_64                      5
+#define MC__CDC_FALLOC3_64_128                     6
+#define MC__CDC_FALLOC3_64_192                     7
+#define MC__CBA_FALLOC1                          (MCPARAMID)( 1047 << 14)
+#define MC__CBA_FALLOC1_256_0                      1
+#define MC__CBA_FALLOC1_128_0                      2
+#define MC__CBA_FALLOC1_128_128                    3
+#define MC__CBA_FALLOC1_64_0                       4
+#define MC__CBA_FALLOC1_64_64                      5
+#define MC__CBA_FALLOC1_64_128                     6
+#define MC__CBA_FALLOC1_64_192                     7
+#define MC__CBA_FALLOC2                          (MCPARAMID)( 1048 << 14)
+#define MC__CBA_FALLOC2_256_0                      1
+#define MC__CBA_FALLOC2_128_0                      2
+#define MC__CBA_FALLOC2_128_128                    3
+#define MC__CBA_FALLOC2_64_0                       4
+#define MC__CBA_FALLOC2_64_64                      5
+#define MC__CBA_FALLOC2_64_128                     6
+#define MC__CBA_FALLOC2_64_192                     7
+#define MC__CBA_FALLOC3                          (MCPARAMID)( 1049 << 14)
+#define MC__CBA_FALLOC3_256_0                      1
+#define MC__CBA_FALLOC3_128_0                      2
+#define MC__CBA_FALLOC3_128_128                    3
+#define MC__CBA_FALLOC3_64_0                       4
+#define MC__CBA_FALLOC3_64_64                      5
+#define MC__CBA_FALLOC3_64_128                     6
+#define MC__CBA_FALLOC3_64_192                     7
+#define MC__CBA_FALLOC4                          (MCPARAMID)( 1050 << 14)
+#define MC__CBA_FALLOC4_256_0                      1
+#define MC__CBA_FALLOC4_128_0                      2
+#define MC__CBA_FALLOC4_128_128                    3
+#define MC__CBA_FALLOC4_64_0                       4
+#define MC__CBA_FALLOC4_64_64                      5
+#define MC__CBA_FALLOC4_64_128                     6
+#define MC__CBA_FALLOC4_64_192                     7
+#define MC__WIC                                  (MCPARAMID)( 1051 << 14)
+#define MC__WIC_ONE                                1
+#define MC__WIC_TWO                                2
+#define MC__WIC_THREE                              3
+#define MC__WIC_FOUR                               4
+#define MC__CBA_SHIFT1                           (MCPARAMID)( 1052 << 14)
+#define MC__CBA_SHIFT2                           (MCPARAMID)( 1053 << 14)
+#define MC__CBA_SHIFT3                           (MCPARAMID)( 1054 << 14)
+#define MC__CBA_SHIFT4                           (MCPARAMID)( 1055 << 14)
+#define MC_Connector_X_Y                           7
+#define MC__CBA_GROUP1                           (MCPARAMID)( 1056 << 14)
+#define MC__ASSY                                 (MCPARAMID)( 1057 << 14)
+#define MC__ASSY_ONE                               1
+#define MC__ASSY_TWO                               2
+#define MC__ASSY_THREE                             3
+#define MC__ASSY_FOUR                              4
+#define MC__CBA_GROUP2                           (MCPARAMID)( 1058 << 14)
+#define MC__CBA_GROUP3                           (MCPARAMID)( 1059 << 14)
+#define MC__CDC_ISIZE_MEDIUM8                      6
+#define MC__CDC_ISIZE_MEDIUM10                     7
+#define MC__CDC_ISIZE_MEDIUM12                     8
+#define MC__CAM                                  (MCPARAMID)( 1060 << 14)
+#define MC__CAM_MONOCAM                            1
+#define MC__CAM_DUOCAM                             2
+#define MC__CTA_START01                          (MCPARAMID)( 1061 << 14)
+#define MC__CTA_START11                          (MCPARAMID)( 1062 << 14)
+#define MC__CTA_START02                          (MCPARAMID)( 1063 << 14)
+#define MC__CTA_START12                          (MCPARAMID)( 1064 << 14)
+#define MC__BW                                   (MCPARAMID)( 1065 << 14)
+#define MC__ISIZX                                (MCPARAMID)( 1066 << 14)
+#define MC__ISIZYF                               (MCPARAMID)( 1067 << 14)
+#define MC__ISIZY                                (MCPARAMID)( 1068 << 14)
+#define MC__WX                                   (MCPARAMID)( 1069 << 14)
+#define MC__WY                                   (MCPARAMID)( 1070 << 14)
+#define MC__DirX1                                (MCPARAMID)( 1071 << 14)
+#define MC__DirX2                                (MCPARAMID)( 1072 << 14)
+#define MC__DirX3                                (MCPARAMID)( 1073 << 14)
+#define MC__DirY1                                (MCPARAMID)( 1074 << 14)
+#define MC__DirY2                                (MCPARAMID)( 1075 << 14)
+#define MC__DirY3                                (MCPARAMID)( 1076 << 14)
+#define MC_ImagePitch                            (MCPARAMID)( 1077 << 14)
+#define MC__PITCH1                               (MCPARAMID)( 1078 << 14)
+#define MC__PITCH2                               (MCPARAMID)( 1079 << 14)
+#define MC__PITCH3                               (MCPARAMID)( 1080 << 14)
+#define MC__InterlaceFactor                      (MCPARAMID)( 1081 << 14)
+#define MC__CTA_STEPX1                           (MCPARAMID)( 1082 << 14)
+#define MC__CTA_STEPX2                           (MCPARAMID)( 1083 << 14)
+#define MC__CTA_STEPX3                           (MCPARAMID)( 1084 << 14)
+#define MC__CTA_STEPY1                           (MCPARAMID)( 1085 << 14)
+#define MC__CTA_STEPY2                           (MCPARAMID)( 1086 << 14)
+#define MC__CTA_STEPY3                           (MCPARAMID)( 1087 << 14)
+#define MC__OFSD1                                (MCPARAMID)( 1088 << 14)
+#define MC__OFSD2                                (MCPARAMID)( 1089 << 14)
+#define MC__OFSD3                                (MCPARAMID)( 1090 << 14)
+#define MC__OFSU1                                (MCPARAMID)( 1091 << 14)
+#define MC__OFSU2                                (MCPARAMID)( 1092 << 14)
+#define MC__OFSU3                                (MCPARAMID)( 1093 << 14)
+#define MC__CTA_OFSD1                            (MCPARAMID)( 1094 << 14)
+#define MC__CTA_OFSD2                            (MCPARAMID)( 1095 << 14)
+#define MC__CTA_OFSD3                            (MCPARAMID)( 1096 << 14)
+#define MC__CTA_OFSU1                            (MCPARAMID)( 1097 << 14)
+#define MC__CTA_OFSU2                            (MCPARAMID)( 1098 << 14)
+#define MC__CTA_OFSU3                            (MCPARAMID)( 1099 << 14)
+#define MC__CTA_SELINC                           (MCPARAMID)( 1100 << 14)
+#define MC__CTA_SELINC_EOL                         1
+#define MC__CTA_SELINC_EOF                         2
+#define MC__CTA_SELINC_EOL2                        3
+#define MC__CTA_SELINC_EOF2                        4
+#define MC__Xchannels                            (MCPARAMID)( 1101 << 14)
+#define MC__CTA_OFS01                            (MCPARAMID)( 1102 << 14)
+#define MC__CTA_OFS11                            (MCPARAMID)( 1103 << 14)
+#define MC__CTA_OFS02                            (MCPARAMID)( 1104 << 14)
+#define MC__CTA_OFS12                            (MCPARAMID)( 1105 << 14)
+#define MC__CTA_TFINC                            (MCPARAMID)( 1106 << 14)
+#define MC__CBA_PSHIFT1                          (MCPARAMID)( 1107 << 14)
+#define MC__CBA_PSHIFT2                          (MCPARAMID)( 1108 << 14)
+#define MC__CBA_PSHIFT3                          (MCPARAMID)( 1109 << 14)
+#define MC__CBA_PSHIFT4                          (MCPARAMID)( 1110 << 14)
+#define MC_CamConfig_P25SC_S8                     22
+#define MC_CamConfig_P25SC_S10                    23
+#define MC_CamConfig_P50SC_D8                     24
+#define MC_CamConfig_P50SC_D10                    25
+#define MC_HsyncAft_Tk                           (MCPARAMID)( 1111 << 14)
+#define MC_HsyncPst_Tk                           (MCPARAMID)( 1112 << 14)
+#define MC__PITCH1_mw                            (MCPARAMID)( 1113 << 14)
+#define MC__PITCH2_mw                            (MCPARAMID)( 1114 << 14)
+#define MC__PITCH3_mw                            (MCPARAMID)( 1115 << 14)
+#define MC__SIZX_mw                              (MCPARAMID)( 1116 << 14)
+#define MC__STARTU1_mw                           (MCPARAMID)( 1117 << 14)
+#define MC__STARTU2_mw                           (MCPARAMID)( 1118 << 14)
+#define MC__STARTU3_mw                           (MCPARAMID)( 1119 << 14)
+#define MC__STARTD1_mw                           (MCPARAMID)( 1120 << 14)
+#define MC__STARTD2_mw                           (MCPARAMID)( 1121 << 14)
+#define MC__STARTD3_mw                           (MCPARAMID)( 1122 << 14)
+#define MC__OFSU1_mw                             (MCPARAMID)( 1123 << 14)
+#define MC__OFSU2_mw                             (MCPARAMID)( 1124 << 14)
+#define MC__OFSU3_mw                             (MCPARAMID)( 1125 << 14)
+#define MC__OFSD1_mw                             (MCPARAMID)( 1126 << 14)
+#define MC__OFSD2_mw                             (MCPARAMID)( 1127 << 14)
+#define MC__OFSD3_mw                             (MCPARAMID)( 1128 << 14)
+#define MC__IPitch_mw                            (MCPARAMID)( 1129 << 14)
+#define MC__Pitch_mw                             (MCPARAMID)( 1130 << 14)
+#define MC_GrabSizeX_Px                          (MCPARAMID)( 1131 << 14)
+#define MC_CamConfig_P50SC                        26
+#define MC_GrabberDataWidth_Filter               (MCPARAMID)( 1132 << 14)
+#define MC_GrabSizeXStep_Px                      (MCPARAMID)( 1133 << 14)
+#define MC_CamConfig_Filter                      (MCPARAMID)( 1134 << 14)
+#define MC__VLC_LCNT                             (MCPARAMID)( 1135 << 14)
+#define MC__VLC_LBFR                             (MCPARAMID)( 1136 << 14)
+#define MC__VLC_LAFT                             (MCPARAMID)( 1137 << 14)
+#define MC__VLC_DCNT                             (MCPARAMID)( 1138 << 14)
+#define MC__VLC_DBFR                             (MCPARAMID)( 1139 << 14)
+#define MC__VLC_DAFT                             (MCPARAMID)( 1140 << 14)
+#define MC__x_INDEX                              (MCPARAMID)( 1141 << 14)
+#define MC__D1_INDEX                             (MCPARAMID)( 1142 << 14)
+#define MC__D2_INDEX                             (MCPARAMID)( 1143 << 14)
+#define MC__D3_INDEX                             (MCPARAMID)( 1144 << 14)
+#define MC__D4_INDEX                             (MCPARAMID)( 1145 << 14)
+#define MC_FutureUseLoadSet                      (MCPARAMID)( 1146 << 14)
+#define MC_DigUnit1_E                              5
+#define MC_DigUnit1_F                              6
+#define MC_DigUnit1_G                              7
+#define MC_DigUnit1_H                              8
+#define MC_Camera_A201b                           21
+#define MC_CamConfig_P30SC                        27
+#define MC_Manufacturer_BASLER                     6
+#define MC_Cable_CL_C02                           12
+#define MC_LinePitch_Filter                      (MCPARAMID)( 1147 << 14)
+#define MC_PageDelay_Ln_Filter                   (MCPARAMID)( 1148 << 14)
+#define MC_PageLength_Ln_Filter                  (MCPARAMID)( 1149 << 14)
+#define MC_EncoderPitch_Filter                   (MCPARAMID)( 1150 << 14)
+#define MC_Camera_Filter                         (MCPARAMID)( 1151 << 14)
+#define MC_Operation_Filter                      (MCPARAMID)( 1152 << 14)
+#define MC___Unsupported_Parameter_Filter        (MCPARAMID)( 1153 << 14)
+#define MC_MAN_GrabWindow_Filter                 (MCPARAMID)( 1154 << 14)
+#define MC_Camera_A202k                           22
+#define MC_Camera_Manufacturer_Filter            (MCPARAMID)( 1155 << 14)
+#define MC_CableName                             (MCPARAMID)( 1156 << 14)
+#define MC_CableName_CameraLink_Standard           1
+#define MC_CableName_Basler_Channel_Link           2
+#define MC___CamConfig_Check                     (MCPARAMID)( 1157 << 14)
+#define MC___CamConfig_Check_PASS                  1
+#define MC___CamConfig_Check_FAIL                  2
+#define MC_CamConfig_P48SC                        28
+#define MC_ResetLine                             (MCPARAMID)( 1158 << 14)
+#define MC_ResetLine_CC1                           1
+#define MC_ResetLine_CC2                           2
+#define MC_ResetLine_CC3                           3
+#define MC_ResetLine_CC4                           4
+#define MC_AuxresetLine                          (MCPARAMID)( 1159 << 14)
+#define MC_AuxresetLine_CC1                        1
+#define MC_AuxresetLine_CC2                        2
+#define MC_AuxresetLine_CC3                        3
+#define MC_AuxresetLine_CC4                        4
+#define MC_CamConfig_P50SM                        29
+#define MC__ClkSynthReq                          (MCPARAMID)( 1160 << 14)
+#define MC__ClkSynthReq_NONE                       1
+#define MC__ClkSynthReq_CS1                        2
+#define MC__ClkSynthReq_CS2                        3
+#define MC_ClkSynth1_UNKNOWN                       1
+#define MC_ClkSynth1_FREE                          2
+#define MC_ClkSynth1_USEDX                         3
+#define MC_ClkSynth1_USEDY                         4
+#define MC_ClkSynth1_USEDZ                         5
+#define MC_ClkSynth2_UNKNOWN                       1
+#define MC_ClkSynth2_FREE                          2
+#define MC_ClkSynth2_USEDX                         3
+#define MC_ClkSynth2_USEDY                         4
+#define MC_ClkSynth2_USEDZ                         5
+#define MC_ClkSynth1_XXX                           6
+#define MC_ClkSynth2_XXX                           6
+#define MC___Gamma_ClkSynth_Check                (MCPARAMID)( 1161 << 14)
+#define MC___Gamma_ClkSynth_Check_PASS             1
+#define MC___Gamma_ClkSynth_Check_FAIL             2
+#define MC_ClkSynth1_Hz                          (MCPARAMID)( 1162 << 14)
+#define MC_ClkSynth2_Hz                          (MCPARAMID)( 1163 << 14)
+#define MC__VerticalSyncMode                     (MCPARAMID)( 1164 << 14)
+#define MC__VerticalSyncMode_ANALOG                1
+#define MC__VerticalSyncMode_DIGITAL               2
+#define MC__VerticalSyncMode_MASTER                3
+#define MC__SYNC_Line1_Type                      (MCPARAMID)( 1165 << 14)
+#define MC_TimUnitN_XXX                            6
+#define MC__SSC                                  (MCPARAMID)( 1166 << 14)
+#define MC__SSC_CCIR                               1
+#define MC__SSC_EIA                                2
+#define MC__SSC_CCIR_2                             3
+#define MC__SSC_EIA_2                              4
+#define MC__SSC_OUTOFRANGE                         5
+#define MC__SELH_SSC                               5
+#define MC__SYNC_Line1_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line1_Type_BLANK_VRSTON           2
+#define MC__SYNC_Line1_Dur                       (MCPARAMID)( 1167 << 14)
+#define MC__SYNC_Line2_Type                      (MCPARAMID)( 1168 << 14)
+#define MC__SYNC_Line2_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line2_Dur                       (MCPARAMID)( 1169 << 14)
+#define MC__SYNC_Line3_Type                      (MCPARAMID)( 1170 << 14)
+#define MC__SYNC_Line3_Type_ACQ_VRSTOFF            1
+#define MC__SYNC_Line3_Dur                       (MCPARAMID)( 1171 << 14)
+#define MC__SYNC_Line4_Type                      (MCPARAMID)( 1172 << 14)
+#define MC__SYNC_Line4_Type_ACQ_VRSTOFF            1
+#define MC__SYNC_Line4_Type_ACQ_VRSTON             2
+#define MC__SYNC_Line4_Dur                       (MCPARAMID)( 1173 << 14)
+#define MC__SYNC_Line5_Type                      (MCPARAMID)( 1174 << 14)
+#define MC__SYNC_Line5_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line5_Type_BLANK_VRSTON           2
+#define MC__SYNC_Line5_Dur                       (MCPARAMID)( 1175 << 14)
+#define MC__SYNC_Acq_Dur                         (MCPARAMID)( 1176 << 14)
+#define MC__SYNC_Vrst_Dur                        (MCPARAMID)( 1177 << 14)
+#define MC__SYNC_RefV2Acq_Gap                    (MCPARAMID)( 1178 << 14)
+#define MC__SYNC_Field_Dur                       (MCPARAMID)( 1179 << 14)
+#define MC__SYNC_Eacq2Vrst_Gap                   (MCPARAMID)( 1180 << 14)
+#define MC__SYNC_Vrst2Bacq_Gap                   (MCPARAMID)( 1181 << 14)
+#define MC__SYNC_Vtotal_Check                    (MCPARAMID)( 1182 << 14)
+#define MC__SYNC_Eacq2Vrst_Phase                 (MCPARAMID)( 1183 << 14)
+#define MC__SYNC_Eacq2Vrst_Phase_BEFORE            1
+#define MC__SYNC_Eacq2Vrst_Phase_SAME              2
+#define MC__SYNC_Eacq2Vrst_Phase_AFTER             3
+#define MC_ClkSynth1_OFF                           7
+#define MC_ClkSynth1_TX                            8
+#define MC_ClkSynth1_TY                            9
+#define MC_ClkSynth1_TZ                           10
+#define MC_ClkSynth2_OFF                           7
+#define MC_ClkSynth2_TX                            8
+#define MC_ClkSynth2_TY                            9
+#define MC_ClkSynth2_TZ                           10
+#define MC__PllControl                           (MCPARAMID)( 1184 << 14)
+#define MC__PllControl_YES                         1
+#define MC__PllControl_NO                          2
+#define MC_CamConfig_P50RM_G                      30
+#define MC__DigUnit1                             (MCPARAMID)( 1185 << 14)
+#define MC__DigUnit2                             (MCPARAMID)( 1186 << 14)
+#define MC__DigUnit3                             (MCPARAMID)( 1187 << 14)
+#define MC__TimUnit                              (MCPARAMID)( 1188 << 14)
+#define MC_CSTSet                                (MCPARAMID)( 1189 << 14)
+#define MC_WSTSet                                (MCPARAMID)( 1190 << 14)
+#define MC_PixelClkLine                          (MCPARAMID)( 1191 << 14)
+#define MC_PixelClkLine_CK                         1
+#define MC_ResetLine_RST                           5
+#define MC_ResetLine_EXP                           6
+#define MC_ResetLine_GATE                          7
+#define MC_ResetLine_HIO                           8
+#define MC_ResetLine_VIO                           9
+#define MC_ResetLine_DUAL                         10
+#define MC_AuxResetLine_RST                        5
+#define MC_AuxResetLine_EXP                        6
+#define MC_AuxResetLine_GATE                       7
+#define MC_AuxResetLine_HIO                        8
+#define MC_AuxResetLine_VIO                        9
+#define MC_AuxResetLine_DUAL                      10
+#define MC_VsyncLine                             (MCPARAMID)( 1192 << 14)
+#define MC_VsyncLine_RST                           1
+#define MC_VsyncLine_EXP                           2
+#define MC_VsyncLine_GATE                          3
+#define MC_VsyncLine_HIO                           4
+#define MC_VsyncLine_VIO                           5
+#define MC_VsyncLine_DUAL                          6
+#define MC_HsyncLine                             (MCPARAMID)( 1193 << 14)
+#define MC_HsyncLine_RST                           1
+#define MC_HsyncLine_EXP                           2
+#define MC_HsyncLine_GATE                          3
+#define MC_HsyncLine_HIO                           4
+#define MC_HsyncLine_VIO                           5
+#define MC_HsyncLine_DUAL                          6
+#define MC_CableName_UNKNOWN                       3
+#define MC_CableName_Single_Channel_R              4
+#define MC_CableName_Single_Channel_RC             5
+#define MC_CableName_Single_Channel_RGC_2          6
+#define MC_CableName_Dual_Channel                  7
+#define MC_CableName_Dual_Channel_RG               8
+#define MC_CableName_Dual_Channel_RG_2             9
+#define MC_CableName_Triple_Channel_R             10
+#define MC_ColorMethod_Filter                    (MCPARAMID)( 1194 << 14)
+#define MC_GCE_Filter                            (MCPARAMID)( 1195 << 14)
+#define MC__TrueExp_us                           (MCPARAMID)( 1196 << 14)
+#define MC_StrobeMode                            (MCPARAMID)( 1197 << 14)
+#define MC_StrobeMode_Filter                     (MCPARAMID)( 1198 << 14)
+#define MC_StrobeMode_NONE                         1
+#define MC_StrobeMode_AUTO                         2
+#define MC_StrobeMode_MAN                          3
+#define MC_SampleTrim                            (MCPARAMID)( 1199 << 14)
+#define MC_DigUnit2_Filter                       (MCPARAMID)( 1200 << 14)
+#define MC_DigUnit3_Filter                       (MCPARAMID)( 1201 << 14)
+#define MC_SampleTrim_Filter                     (MCPARAMID)( 1202 << 14)
+#define MC_Manufacturer_MY_CAMERAS                 7
+#define MC___GrabberTiming_Check                 (MCPARAMID)( 1203 << 14)
+#define MC___GrabberTiming_Check_PASS              1
+#define MC___GrabberTiming_Check_FAIL              2
+#define MC__HDC_DCNT                             (MCPARAMID)( 1204 << 14)
+#define MC__HBC_HPRE                             (MCPARAMID)( 1205 << 14)
+#define MC__HBC_DBFR_Expected                    (MCPARAMID)( 1206 << 14)
+#define MC__HBC_DBFR                             (MCPARAMID)( 1207 << 14)
+#define MC__HBC_DBFR_Check                       (MCPARAMID)( 1208 << 14)
+#define MC__HBC_DBFR_Check_PASS                    1
+#define MC__HBC_DBFR_Check_FAIL                    2
+#define MC__HAC_DAFT                             (MCPARAMID)( 1209 << 14)
+#define MC__VBC_LBFR                             (MCPARAMID)( 1210 << 14)
+#define MC__VAC_LAFT                             (MCPARAMID)( 1211 << 14)
+#define MC__SCC_CC1                              (MCPARAMID)( 1212 << 14)
+#define MC__SCC_CC1_CTL1                           1
+#define MC__SCC_CC1_CTL2                           2
+#define MC__SCC_CC1_XCTL2                          3
+#define MC__SCC_CC1_LOW                            4
+#define MC__SCC_CC1_CTL1n                          5
+#define MC__SCC_CC1_CTL2n                          6
+#define MC__SCC_CC1_XCTL2n                         7
+#define MC__SCC_CC1_HIGH                           8
+#define MC__SCC_CC2                              (MCPARAMID)( 1213 << 14)
+#define MC__SCC_CC2_CTL1                           1
+#define MC__SCC_CC2_CTL2                           2
+#define MC__SCC_CC2_XCTL2                          3
+#define MC__SCC_CC2_LOW                            4
+#define MC__SCC_CC2_CTL1n                          5
+#define MC__SCC_CC2_CTL2n                          6
+#define MC__SCC_CC2_XCTL2n                         7
+#define MC__SCC_CC2_HIGH                           8
+#define MC__SCC_CC3                              (MCPARAMID)( 1214 << 14)
+#define MC__SCC_CC3_CTL1                           1
+#define MC__SCC_CC3_CTL2                           2
+#define MC__SCC_CC3_XCTL2                          3
+#define MC__SCC_CC3_LOW                            4
+#define MC__SCC_CC3_CTL1n                          5
+#define MC__SCC_CC3_CTL2n                          6
+#define MC__SCC_CC3_XCTL2n                         7
+#define MC__SCC_CC3_HIGH                           8
+#define MC__SCC_CC4                              (MCPARAMID)( 1215 << 14)
+#define MC__SCC_CC4_CTL1                           1
+#define MC__SCC_CC4_CTL2                           2
+#define MC__SCC_CC4_XCTL2                          3
+#define MC__SCC_CC4_LOW                            4
+#define MC__SCC_CC4_CTL1n                          5
+#define MC__SCC_CC4_CTL2n                          6
+#define MC__SCC_CC4_XCTL2n                         7
+#define MC__SCC_CC4_HIGH                           8
+#define MC_CC1Usage                              (MCPARAMID)( 1216 << 14)
+#define MC_CC1Usage_SOFT                           1
+#define MC_CC1Usage_LOW                            2
+#define MC_CC1Usage_HIGH                           3
+#define MC_CC1Usage_RESET                          4
+#define MC_CC1Usage_AUXRESET                       5
+#define MC_CC1Usage_ACQPHASE                       6
+#define MC_CC1Usage_ACQSEQUENCE                    7
+#define MC_CCxUsage_Filter                       (MCPARAMID)( 1217 << 14)
+#define MC_CC2Usage                              (MCPARAMID)( 1218 << 14)
+#define MC_CC2Usage_SOFT                           1
+#define MC_CC2Usage_LOW                            2
+#define MC_CC2Usage_HIGH                           3
+#define MC_CC2Usage_RESET                          4
+#define MC_CC2Usage_AUXRESET                       5
+#define MC_CC2Usage_ACQPHASE                       6
+#define MC_CC2Usage_ACQSEQUENCE                    7
+#define MC_CC3Usage                              (MCPARAMID)( 1219 << 14)
+#define MC_CC3Usage_SOFT                           1
+#define MC_CC3Usage_LOW                            2
+#define MC_CC3Usage_HIGH                           3
+#define MC_CC3Usage_RESET                          4
+#define MC_CC3Usage_AUXRESET                       5
+#define MC_CC3Usage_ACQPHASE                       6
+#define MC_CC3Usage_ACQSEQUENCE                    7
+#define MC_CC4Usage                              (MCPARAMID)( 1220 << 14)
+#define MC_CC4Usage_SOFT                           1
+#define MC_CC4Usage_LOW                            2
+#define MC_CC4Usage_HIGH                           3
+#define MC_CC4Usage_RESET                          4
+#define MC_CC4Usage_AUXRESET                       5
+#define MC_CC4Usage_ACQPHASE                       6
+#define MC_CC4Usage_ACQSEQUENCE                    7
+#define MC__STRB                                 (MCPARAMID)( 1221 << 14)
+#define MC__CID                                  (MCPARAMID)( 1222 << 14)
+#define MC__OUT1                                 (MCPARAMID)( 1223 << 14)
+#define MC__OUT2                                 (MCPARAMID)( 1224 << 14)
+#define MC__OUT3                                 (MCPARAMID)( 1225 << 14)
+#define MC__OUT4                                 (MCPARAMID)( 1226 << 14)
+#define MC__VBC_LBFR_Expected                    (MCPARAMID)( 1227 << 14)
+#define MC__VBC_LBFR_Check                       (MCPARAMID)( 1228 << 14)
+#define MC__VBC_LBFR_Check_PASS                    1
+#define MC__VBC_LBFR_Check_FAIL                    2
+#define MC__VBC_VPRE                             (MCPARAMID)( 1229 << 14)
+#define MC__VLC_LCINIT                           (MCPARAMID)( 1230 << 14)
+#define MC_Camera_TM_1020_15CL                    23
+#define MC_Camera_TM_1320_15CL                    24
+#define MC_Camera_SVS282CSCL                      25
+#define MC_Camera_SVS285MFCL                      26
+#define MC_Camera_SVS285MSCL                      27
+#define MC_CamConfig_P15SC                        31
+#define MC_CamConfig_I10SC                        32
+#define MC_CamConfig_P22SC                        33
+#define MC_Manufacturer_PULNIX                     8
+#define MC_Manufacturer_VISTEK                     9
+#define MC_ColorMethod_BAYER                       4
+#define MC__DRS_CPAR                             (MCPARAMID)( 1231 << 14)
+#define MC__DRS_CSAP                             (MCPARAMID)( 1232 << 14)
+#define MC__DRS_CFLD                             (MCPARAMID)( 1233 << 14)
+#define MC__TRG_FTPOL_SAS                        (MCPARAMID)( 1234 << 14)
+#define MC__TRG_FTPOL_SAS_NONE                     1
+#define MC__TRG_FTPOL_SAS_DIRECT                   2
+#define MC__TRG_FTPOL_SAS_INVERT                   3
+#define MC__TRG_FTPOL_SAP                        (MCPARAMID)( 1235 << 14)
+#define MC__TRG_FTPOL_SAP_NONE                     1
+#define MC__TRG_FTPOL_SAP_DIRECT                   2
+#define MC__TRG_FTPOL_SAP_INVERT                   3
+#define MC_TrigFilter_MEDIUM                       3
+#define MC_TrigFilter_STRONG                       4
+#define MC__TRG_FTFLT                            (MCPARAMID)( 1236 << 14)
+#define MC__TRG_FTFLT_NONE                         1
+#define MC__TRG_FTFLT_200ns                        2
+#define MC__TRG_FTFLT_3200ns                       3
+#define MC_TrigLine_CAM                            6
+#define MC__TRG_FTSEL_SAS                        (MCPARAMID)( 1237 << 14)
+#define MC__TRG_FTSEL_SAS_DA1                      1
+#define MC__TRG_FTSEL_SAS_DA2                      2
+#define MC__TRG_FTSEL_SAS_CAMSIG                   3
+#define MC__TRG_FTSEL_SAS_TRG                      4
+#define MC__TRG_FTSEL_SAS_FORCE                    5
+#define MC__TRG_FTSEL_SAP                        (MCPARAMID)( 1238 << 14)
+#define MC__TRG_FTSEL_SAP_KEEP                     1
+#define MC__TRG_FTSEL_SAP_FORCE                    2
+#define MC__STM1_T1CLK                           (MCPARAMID)( 1239 << 14)
+#define MC__STM1_T1CLK_PRESCALER                   1
+#define MC__STM1_T1CLK_LTRIGS                      2
+#define MC__STM1_T1CLK_PPLS                        3
+#define MC__STM1_T1SCAL                          (MCPARAMID)( 1240 << 14)
+#define MC__STM1_T1SCAL_100ns                      1
+#define MC__STM1_T1SCAL_1us                        2
+#define MC__STM1_T1SCAL_10us                       3
+#define MC__STM1_T1SCAL_100us                      4
+#define MC__STM1_T1SCAL_1ms                        5
+#define MC__PRM1_T1POS_CTL1On                    (MCPARAMID)( 1241 << 14)
+#define MC__PRM1_T1POS_CTL1Off                   (MCPARAMID)( 1242 << 14)
+#define MC__PRM1_T1POS_PulseSq                   (MCPARAMID)( 1243 << 14)
+#define MC__PRM1_T1POS_PulseEnd                  (MCPARAMID)( 1244 << 14)
+#define MC___Timer1_Check                        (MCPARAMID)( 1245 << 14)
+#define MC___Timer1_Check_PASS                     1
+#define MC___Timer1_Check_FAIL                     2
+#define MC__STM1_T1SCAL_OVER                       6
+#define MC_Camera_SVS084MFCL                      28
+#define MC_Camera_SVS084MSCL                      29
+#define MC_Camera_SVS085MFCL                      30
+#define MC_Camera_SVS085MSCL                      31
+#define MC_Camera_SVS204MFCL                      32
+#define MC_Camera_SVS204MSCL                      33
+#define MC_CamConfig_P21SC                        34
+#define MC_CamConfig_P42SC                        35
+#define MC_CamConfig_P13SC                        36
+#define MC_CamConfig_P25SC                        37
+#define MC_CamConfig_P64SC                        38
+#define MC_CamConfig_P94SC                        39
+#define MC__T1Span_10ns                          (MCPARAMID)( 1246 << 14)
+#define MC__T1_10ns                              (MCPARAMID)( 1247 << 14)
+#define MC__EXPWidth_10ns                        (MCPARAMID)( 1248 << 14)
+#define MC__EXPWidth_T1                          (MCPARAMID)( 1249 << 14)
+#define MC__TRG_FTSEL                            (MCPARAMID)( 1250 << 14)
+#define MC__TRG_FTSEL_DA1                          6
+#define MC__TRG_FTSEL_DA2                          7
+#define MC__TRG_FTSEL_CAMSIG                       8
+#define MC__TRG_FTSEL_TRG                          9
+#define MC__TRG_FTRIG_SAS                        (MCPARAMID)( 1251 << 14)
+#define MC__TRG_FTRIG_SAS_KEEP                     1
+#define MC__TRG_FTRIG_SAS_FORCE                    2
+#define MC__TRG_FTRIG_EAP                        (MCPARAMID)( 1252 << 14)
+#define MC__TRG_FTRIG_EAP_KEEP                     1
+#define MC__TRG_FTRIG_EAP_FORCE                    2
+#define MC__TRG_FTPOL_EAP                        (MCPARAMID)( 1253 << 14)
+#define MC__TRG_FTPOL_EAP_NONE                     1
+#define MC__TRG_FTPOL_EAP_DIRECT                   2
+#define MC__TRG_FTPOL_EAP_INVERT                   3
+#define MC_Camera_CV_A11                          34
+#define MC_CamConfig_P30SM                        40
+#define MC_CamConfig_P30RM_G                      41
+#define MC_Cable_A15_C11                          13
+#define MC_CableName_Single_Channel_RGC           11
+#define MC_EASQet                                (MCPARAMID)( 1254 << 14)
+#define MC_CamConfig_P30RG                        42
+#define MC_CamConfig_P50RG                        43
+#define MC__STM2_T2SCAL                          (MCPARAMID)( 1255 << 14)
+#define MC__STM2_T2SCAL_100ns                      1
+#define MC__STM2_T2SCAL_1us                        2
+#define MC__STM2_T2SCAL_10us                       3
+#define MC__STM2_T2SCAL_100us                      4
+#define MC__STM2_T2SCAL_1ms                        5
+#define MC__STM2_T2SCAL_OVER                       6
+#define MC__PRM2_T2POS_CTL2On                    (MCPARAMID)( 1256 << 14)
+#define MC__PRM2_T2POS_CTL2Off                   (MCPARAMID)( 1257 << 14)
+#define MC__PRM2_T2POS_PulseEnd                  (MCPARAMID)( 1258 << 14)
+#define MC__T2Span_10ns                          (MCPARAMID)( 1259 << 14)
+#define MC_StrobeCtl_ITTL                          3
+#define MC_StrobeCtl_IOC                           4
+#define MC_StrobeCtl_IOE                           5
+#define MC__EXPWidth_T2                          (MCPARAMID)( 1260 << 14)
+#define MC__STRWidth_T2                          (MCPARAMID)( 1261 << 14)
+#define MC__STROn_T2                             (MCPARAMID)( 1262 << 14)
+#define MC__STROff_T2                            (MCPARAMID)( 1263 << 14)
+#define MC_Imaging_LINE                            2
+#define MC_Imaging_TDI                             3
+#define MC_CamConfig_P15RG                        44
+#define MC_Camera_XC_HR50                         35
+#define MC_CamConfig_P60SM                        45
+#define MC_CamConfig_P60RM_G                      46
+#define MC_CamConfig_P60RA_G                      47
+#define MC_CamConfig_P22RG                        48
+#define MC__ACQV_Line1_Dur                       (MCPARAMID)( 1264 << 14)
+#define MC__IDLEV_Line2_Type                     (MCPARAMID)( 1265 << 14)
+#define MC__IDLEV_Line2_Type_BLANK_VRSTON          1
+#define MC__IDLEV_Line2_Type_BLANK_VRSTOFF         2
+#define MC__IDLEV_Line2_Dur                      (MCPARAMID)( 1266 << 14)
+#define MC__ACQV_Line2_Dur                       (MCPARAMID)( 1267 << 14)
+#define MC__ACQV_Line3_Dur                       (MCPARAMID)( 1268 << 14)
+#define MC__ACQV_Line4_Dur                       (MCPARAMID)( 1269 << 14)
+#define MC__ACQV_Acq_Dur                         (MCPARAMID)( 1270 << 14)
+#define MC__ACQV_PreAcq_Dur                      (MCPARAMID)( 1271 << 14)
+#define MC__ACQV_Total_Dur                       (MCPARAMID)( 1272 << 14)
+#define MC_Camera_CS8530                          36
+#define MC_Manufacturer_TELI                      10
+#define MC_CamConfig_P48RG                        49
+#define MC_Camera_CS8531                          37
+#define MC_Camera_CS8531D                         38
+#define MC_CamConfig_P120SM                       50
+#define MC_CamConfig_P120RM_G                     51
+#define MC_CamConfig_P30RA_G                      52
+#define MC_CamConfig_P50RM                        53
+#define MC_CamConfig_P60RM                        54
+#define MC_CamConfig_P120RM                       55
+#define MC_CamConfig_P30RM                        56
+#define MC_ColorRegistration                     (MCPARAMID)( 1273 << 14)
+#define MC_ColorRegistration_GB                    1
+#define MC_ColorRegistration_BG                    2
+#define MC_ColorRegistration_RG                    3
+#define MC_ColorRegistration_GR                    4
+#define MC_ImageColorRegistration                (MCPARAMID)( 1274 << 14)
+#define MC_ImageColorRegistration_GB               1
+#define MC_ImageColorRegistration_BG               2
+#define MC_ImageColorRegistration_RG               3
+#define MC_ImageColorRegistration_GR               4
+#define MC__OffsetX0                             (MCPARAMID)( 1275 << 14)
+#define MC__OffsetY0                             (MCPARAMID)( 1276 << 14)
+#define MC_CamConfig_P30SD                        57
+#define MC_VdriveLine                            (MCPARAMID)( 1277 << 14)
+#define MC_VdriveLine_RST                          1
+#define MC_VdriveLine_EXP                          2
+#define MC_VdriveLine_GATE                         3
+#define MC_VdriveLine_HIO                          4
+#define MC_VdriveLine_VIO                          5
+#define MC_VdriveLine_DUAL                         6
+#define MC_HdriveLine                            (MCPARAMID)( 1278 << 14)
+#define MC_HdriveLine_RST                          1
+#define MC_HdriveLine_EXP                          2
+#define MC_HdriveLine_GATE                         3
+#define MC_HdriveLine_HIO                          4
+#define MC_HdriveLine_VIO                          5
+#define MC_HdriveLine_DUAL                         6
+#define MC__TrimmedExpose_us                     (MCPARAMID)( 1279 << 14)
+#define MC_PixelClkLine_NC                         2
+#define MC_ResetLine_NC                           11
+#define MC_AuxResetLine_NC                        11
+#define MC_VsyncLine_NC                            7
+#define MC_HsyncLine_NC                            7
+#define MC_VdriveLine_NC                           7
+#define MC_HdriveLine_NC                           7
+#define MC_Cable_A15_C12                          14
+#define MC_CableName_Triple_Channel_RG            12
+#define MC__CDU_CAL                              (MCPARAMID)( 1280 << 14)
+#define MC_Camera_SKCm141TC                       39
+#define MC_CamConfig_P10SA                        58
+#define MC_CamConfig_P10SM                        59
+#define MC_CamConfig_P10RM                        60
+#define MC_CamConfig_P10RA                        61
+#define MC_Manufacturer_IKEGAMI                   11
+#define MC_CableName_Triple_Channel_RGC_3         13
+#define MC__PinUsed                              (MCPARAMID)( 1281 << 14)
+#define MC_Camera_SKC_141TC                       40
+#define MC_Camera_CV_M50C                         41
+#define MC_CamConfig_I25SA                        62
+#define MC_CamConfig_P50                          63
+#define MC_CamConfig_P50SD                        64
+#define MC_CamConfig_P50RD                        65
+#define MC_CamConfig_P10SD                        66
+#define MC_CamConfig_P10RD                        67
+#define MC_CamConfig_P25RG                        68
+#define MC_CamConfig_P64RG                        69
+#define MC_CamConfig_P42RG                        70
+#define MC_CamConfig_P94RG                        71
+#define MC_Camera_STC_1000                        42
+#define MC_CamConfig_P60SD                        72
+#define MC_Manufacturer_SENTECH                   12
+#define MC__DIS_FALT                             (MCPARAMID)( 1282 << 14)
+#define MC__DIS_FALT_NORMAL                        1
+#define MC__DIS_FALT_ALTERNATE                     2
+#define MC__DIS_SPOL                             (MCPARAMID)( 1283 << 14)
+#define MC__DIS_SPOL_DIRECT                        1
+#define MC__DIS_SPOL_INVERT                        2
+#define MC__DIS_FPOL                             (MCPARAMID)( 1284 << 14)
+#define MC__DIS_FPOL_DIRECT                        1
+#define MC__DIS_FPOL_INVERT                        2
+#define MC__DIS_LPOL                             (MCPARAMID)( 1285 << 14)
+#define MC__DIS_LPOL_DIRECT                        1
+#define MC__DIS_LPOL_INVERT                        2
+#define MC__DIS_DPOL                             (MCPARAMID)( 1286 << 14)
+#define MC__DIS_DPOL_DIRECT                        1
+#define MC__DIS_DPOL_INVERT                        2
+#define MC__DRS_CPAR_NONE                          1
+#define MC__DRS_CPAR_LVAL_AFT                      2
+#define MC__DRS_CPAR_LVAL_BFR                      3
+#define MC__DRS_CPAR_SPARE_AFT                     4
+#define MC__DRS_CPAR_SPARE_BFR                     5
+#define MC__DRS_CSAP_ONNEXTFVAL                    1
+#define MC__DRS_CSAP_ONNEXTFVAL_PAR0               2
+#define MC__DRS_CSAP_ONNEXTFVAL_PAR1               3
+#define MC__DRS_CFLD_ONEFIELD                      1
+#define MC__DRS_CFLD_TWOFIELDS                     2
+#define MC__DRS_CACQ                             (MCPARAMID)( 1287 << 14)
+#define MC__DRS_CACQ_LINE                          1
+#define MC__DRS_CACQ_LINEandVALD                   2
+#define MC__DRS_CEOL                             (MCPARAMID)( 1288 << 14)
+#define MC__DRS_CEOL_DLAST                         1
+#define MC__DRS_CEOL_DSTOP                         2
+#define MC__DRS_CEOL_LVALE                         3
+#define MC__DRS_CEOL_DVALE                         4
+#define MC__DRS_CSOL                             (MCPARAMID)( 1289 << 14)
+#define MC__DRS_CSOL_LVALS                         1
+#define MC__DRS_CSOL_FVALSorLVALE                  2
+#define MC__DRS_CSOL_FVALSorDLAST                  3
+#define MC_Camera_NoCamera                        43
+#define MC_LvalMode_LN                             5
+#define MC_Camera_TMC_1000                        44
+#define MC_Camera_TMC_6700                        45
+#define MC_Camera_A501k                           46
+#define MC_CamConfig_P60SC                        73
+#define MC_CamConfig_P60RG                        74
+#define MC_CamConfig_P74SC                        75
+#define MC_CamConfig_P74RG                        76
+#define MC_Cable_CL_C03                           15
+#define MC_CableName_Pulnix_Adapter               14
+#define MC_Camera_XC_8500CE                       47
+#define MC_Cable_A15_C13                          16
+#define MC_CableName_Dual_Channel_RG_2_A          15
+#define MC_StrobeLine_Filter                     (MCPARAMID)( 1290 << 14)
+#define MC_StrobeLine_STZ                          6
+#define MC__CBA_GROUP4                           (MCPARAMID)( 1291 << 14)
+#define MC__STB_STB_x                            (MCPARAMID)( 1292 << 14)
+#define MC__STB_STB_x_FromCTL1_x                   1
+#define MC__STB_STB_x_FromCTL2_x                   2
+#define MC__STB_STB_x_FromXCTL2_x                  3
+#define MC__STB_Qx1SRC                           (MCPARAMID)( 1293 << 14)
+#define MC__STB_Qx1SRC_LOW                         1
+#define MC__STB_Qx1SRC_HIGH                        2
+#define MC__STB_Qx1SRC_FromSTB_X                   3
+#define MC__STB_Qx1SRC_FromSTB_X_Inverted          4
+#define MC__STB_x1STYL                           (MCPARAMID)( 1294 << 14)
+#define MC__STB_x1STYL_TTLIN                       1
+#define MC__STB_x1STYL_12VIN                       2
+#define MC__STB_x1STYL_TTLOUT                      3
+#define MC__STB_x1STYL_OCOUT                       4
+#define MC__STB_x1STYL_OEOUT                       5
+#define MC__STB_Qx2SRC                           (MCPARAMID)( 1295 << 14)
+#define MC__STB_Qx2SRC_LOW                         1
+#define MC__STB_Qx2SRC_HIGH                        2
+#define MC__STB_Qx2SRC_FromSTB_X                   3
+#define MC__STB_Qx2SRC_FromSTB_X_Inverted          4
+#define MC__STB_x2STYL                           (MCPARAMID)( 1296 << 14)
+#define MC__STB_x2STYL_TTLIN                       1
+#define MC__STB_x2STYL_12VIN                       2
+#define MC__STB_x2STYL_TTLOUT                      3
+#define MC__STB_x2STYL_OCOUT                       4
+#define MC__STB_x2STYL_OEOUT                       5
+#define MC__STR_STR_X                            (MCPARAMID)( 1297 << 14)
+#define MC__STR_STR_X_LOW                          1
+#define MC__STR_STR_X_HIGH                         2
+#define MC__STR_STR_X_FromSTB_X                    3
+#define MC__STR_STR_X_FromSTB_X_Inverted           4
+#define MC___StrobeStyle_Check                   (MCPARAMID)( 1298 << 14)
+#define MC___StrobeStyle_Check_PASS                1
+#define MC___StrobeStyle_Check_FAIL                2
+#define MC_STRUsage                              (MCPARAMID)( 1299 << 14)
+#define MC_STRUsage_FREE                           1
+#define MC_STRUsage_STROBE                         2
+#define MC_A1Usage                               (MCPARAMID)( 1300 << 14)
+#define MC_A1Usage_FREE                            1
+#define MC_A1Usage_STROBE                          2
+#define MC_A2Usage                               (MCPARAMID)( 1301 << 14)
+#define MC_A2Usage_FREE                            1
+#define MC_A2Usage_STROBE                          2
+#define MC_DefaultLoadSet                        (MCPARAMID)( 1302 << 14)
+#define MC__TRG_FTMOD                            (MCPARAMID)( 1303 << 14)
+#define MC__TRG_FTMOD_SKIP                         1
+#define MC__TRG_FTMOD_HOLD                         2
+#define MC__TRG_FTRES_FB                         (MCPARAMID)( 1304 << 14)
+#define MC__TRG_FTRES_FB_NO                        1
+#define MC__TRG_FTRES_FB_YES                       2
+#define MC__TRG_FTRES_T1                         (MCPARAMID)( 1305 << 14)
+#define MC__TRG_FTRES_T1_NO                        1
+#define MC__TRG_FTRES_T1_YES                       2
+#define MC__TRG_FTRES_T2                         (MCPARAMID)( 1306 << 14)
+#define MC__TRG_FTRES_T2_NO                        1
+#define MC__TRG_FTRES_T2_YES                       2
+#define MC__TRG_FTPOL_TE                         (MCPARAMID)( 1307 << 14)
+#define MC__TRG_FTPOL_TE_NONE                      1
+#define MC__TRG_FTPOL_TE_DIRECT                    2
+#define MC__TRG_FTPOL_TE_INVERT                    3
+#define MC__TRG_FTRIG_TE                         (MCPARAMID)( 1308 << 14)
+#define MC__TRG_FTRIG_TE_KEEP                      1
+#define MC__TRG_FTRIG_TE_FORCE                     2
+#define MC_Camera_STC_1100b                       48
+#define MC__DRS_CSOL_FVALSorEOL                    4
+#define MC_TriggerSkipHold                       (MCPARAMID)( 1309 << 14)
+#define MC_TriggerSkipHold_SKIP                    1
+#define MC_TriggerSkipHold_HOLD                    2
+#define MC_LineScanOnly_Filter                   (MCPARAMID)( 1310 << 14)
+#define MC_ExposeRecovery_us                     (MCPARAMID)( 1311 << 14)
+#define MC_ReadoutRecovery_us                    (MCPARAMID)( 1312 << 14)
+#define MC__EXPOffWidthForbid_10ns               (MCPARAMID)( 1313 << 14)
+#define MC__EXPOffWidth_T1                       (MCPARAMID)( 1314 << 14)
+#define MC__LineDur_ns                           (MCPARAMID)( 1315 << 14)
+#define MC__ReadoutDur_10ns                      (MCPARAMID)( 1316 << 14)
+#define MC_Cable_A15_C14                          17
+#define MC_CableName_Single_Channel_RGC_A         16
+#define MC__EXPOffWidth_10ns                     (MCPARAMID)( 1317 << 14)
+#define MC__MaxReadoutRate_Hz                    (MCPARAMID)( 1318 << 14)
+#define MC__MaxTriggerRate_Hz                    (MCPARAMID)( 1319 << 14)
+#define MC_CableName_Triple_Channel_RG_3          17
+#define MC___IOLoopBack                          (MCPARAMID)( 1320 << 14)
+#define MC___IOLoopBack_DISABLE                    1
+#define MC___IOLoopBack_ENABLE                     2
+#define MC_Camera_ICD_FA41                        49
+#define MC_CableName_Single_Channel_R_A           18
+#define MC_Camera_SKC_131                         50
+#define MC_CamConfig_P12SA                        77
+#define MC_CamConfig_P12SD                        78
+#define MC_CamConfig_P12RA                        79
+#define MC_Operation_LONG_EXPOSURE                 7
+#define MC__Vtotal_Ln                            (MCPARAMID)( 1321 << 14)
+#define MC_CamConfig_P50SM_L                      80
+#define MC__VLC_LCSNS                            (MCPARAMID)( 1322 << 14)
+#define MC__VLC_LCSNS_NORMAL                       1
+#define MC__VLC_LCSNS_SENSE                        2
+#define MC__VAC_VPOST                            (MCPARAMID)( 1323 << 14)
+#define MC__VAC_VPOST_FVALE_Post                   1
+#define MC__VAC_VPOST_FVALE_NoPost                 2
+#define MC__VAC_VPOST_LVALE_NoPost                 3
+#define MC__VAC_VPOST_LLAST_NoPost                 4
+#define MC__CTA_SELFLH                           (MCPARAMID)( 1324 << 14)
+#define MC__CTA_SELFLH_EOI                         1
+#define MC__CTA_SELFLH_EOL                         2
+#define MC_Camera_CV_A50C                         51
+#define MC_CamConfig_P25SM_L                      81
+#define MC_Camera_iMVS157                         52
+#define MC_Manufacturer_FASTCOM                   13
+#define MC_CC3Usage_READOUTALLOWED                 8
+#define MC_CC4Usage_TRIGGERALLOWED                 8
+#define MC__SCC_CC3_ACQUIREALLOWED                 9
+#define MC__SCC_CC3_ACQUIREALLOWEDn               10
+#define MC__SCC_CC4_TRIGGERALLOWED                 9
+#define MC__SCC_CC4_TRIGGERALLOWEDn               10
+#define MC__SCC_CC3_READOUTALLOWED                11
+#define MC__SCC_CC3_READOUTALLOWEDn               12
+#define MC__VactiveMax_Ln                        (MCPARAMID)( 1325 << 14)
+#define MC_Camera_TM_6702                         53
+#define MC_Cable_A15_C15                          19
+#define MC_CableName_Single_Ch                    19
+#define MC_CableName_Single_Channel_R_B           20
+#define MC_Camera_VCC_870                         54
+#define MC_CamConfig_P12SM                        82
+#define MC_CamConfig_P12RM                        83
+#define MC_Manufacturer_CIS                       14
+#define MC_AreaScanOnly_Filter                   (MCPARAMID)( 1326 << 14)
+#define MC_TrigCtl_ITTL                            5
+#define MC_TrigCtl_I12V                            6
+#define MC_TrigLine_TRG                            7
+#define MC_TrigLine_Filter                       (MCPARAMID)( 1327 << 14)
+#define MC_ColorMethod_TRILINEAR                   5
+#define MC_LineRateMode                          (MCPARAMID)( 1328 << 14)
+#define MC_LineRateMode_CAMERA                     1
+#define MC_LineRateMode_PERIOD                     2
+#define MC_LineRateMode_PULSE                      3
+#define MC_LineRateMode_CONVERT                    4
+#define MC_Period_us                             (MCPARAMID)( 1329 << 14)
+#define MC_PeriodTrim                            (MCPARAMID)( 1330 << 14)
+#define MC_LineTrigCtl                           (MCPARAMID)( 1331 << 14)
+#define MC_LineTrigCtl_ITTL                        1
+#define MC_LineTrigCtl_I12V                        2
+#define MC_LineTrigCtl_TTL                         3
+#define MC_LineTrigEdge                          (MCPARAMID)( 1332 << 14)
+#define MC_LineTrigEdge_GOHIGH                     1
+#define MC_LineTrigEdge_GOLOW                      2
+#define MC_LineTrigFilter                        (MCPARAMID)( 1333 << 14)
+#define MC_LineTrigFilter_OFF                      1
+#define MC_LineTrigFilter_MEDIUM                   2
+#define MC_LineTrigFilter_STRONG                   3
+#define MC_LineTrigLine                          (MCPARAMID)( 1334 << 14)
+#define MC_LineTrigLine_NOM                        1
+#define MC_LineTrigLine_TRG                        2
+#define MC_LineTrigLine_CAM                        3
+#define MC_ConverterTrim                         (MCPARAMID)( 1335 << 14)
+#define MC_MaxSpeed                              (MCPARAMID)( 1336 << 14)
+#define MC_MinSpeed                              (MCPARAMID)( 1337 << 14)
+#define MC__TRG_FTRES_EOF                        (MCPARAMID)( 1338 << 14)
+#define MC__TRG_FTRES_EOF_NO                       1
+#define MC__TRG_FTRES_EOF_YES                      2
+#define MC_MAN_GrabWindowY_Filter                (MCPARAMID)( 1339 << 14)
+#define MC_ImageFlipX                            (MCPARAMID)( 1340 << 14)
+#define MC_ImageFlipX_OFF                          1
+#define MC_CS3920_AsyncLoadSet                   (MCPARAMID)( 1341 << 14)
+#define MC__Expose_us                            (MCPARAMID)( 1342 << 14)
+#define MC_Camera_CS3920                          55
+#define MC_CamConfig_I7SA                         84
+#define MC_CamConfig_I7RA                         85
+#define MC_Cable_A15_C16                          21
+#define MC_CableName_Single_Channel_R_C           21
+#define MC__CTA_SELFLH_EOI_S                       3
+#define MC_Camera_CV_M4CL                         56
+#define MC_CamConfig_P24SC                        86
+#define MC_CamConfig_P24RG                        87
+#define MC_CamConfig_I15SA                        88
+#define MC_CamConfig_I15RA                        89
+#define MC__TrimmedExpose_10ns                   (MCPARAMID)( 1343 << 14)
+#define MC_Camera_CV_M50E                         57
+#define MC_CamConfig_P60SM_L                      90
+#define MC_CamConfig_I30SA                        91
+#define MC_Camera_CV_A50E                         58
+#define MC_CamConfig_P30SM_L                      92
+#define MC_Camera_CV_M7CL                         59
+#define MC_Camera_ICD_FA41E                       60
+#define MC_CamConfig_P25RA_G                      93
+#define MC_CamConfig_P50RA_G                      94
+#define MC_StrobeCtl_Filter                      (MCPARAMID)( 1344 << 14)
+#define MC_CamConfig_I60RA                        95
+#define MC_CamConfig_I120SA                       96
+#define MC_CamConfig_I120RA                       97
+#define MC__HDC_DCADV                            (MCPARAMID)( 1345 << 14)
+#define MC__HDC_DCADV_PERMANENT                    1
+#define MC__HDC_DCADV_VALD                         2
+#define MC_ImageFlipX_ON                           2
+#define MC_MaxLineRate_Hz                        (MCPARAMID)( 1346 << 14)
+#define MC_LineRateMode_Filter                   (MCPARAMID)( 1347 << 14)
+#define MC__T2Span_T2                            (MCPARAMID)( 1348 << 14)
+#define MC__PRM2_T2POS_1                         (MCPARAMID)( 1349 << 14)
+#define MC__PRM2_T2PLS1_1                        (MCPARAMID)( 1350 << 14)
+#define MC__PRM2_T2PLS2_1                        (MCPARAMID)( 1351 << 14)
+#define MC__PRM2_T2POS_2                         (MCPARAMID)( 1352 << 14)
+#define MC__PRM2_T2PLS1_2                        (MCPARAMID)( 1353 << 14)
+#define MC__PRM2_T2PLS2_2                        (MCPARAMID)( 1354 << 14)
+#define MC__PRM2_T2POS_3                         (MCPARAMID)( 1355 << 14)
+#define MC__PRM2_T2PLS1_3                        (MCPARAMID)( 1356 << 14)
+#define MC__PRM2_T2PLS2_3                        (MCPARAMID)( 1357 << 14)
+#define MC__PRM2_T2POS_4                         (MCPARAMID)( 1358 << 14)
+#define MC__PRM2_T2PLS1_4                        (MCPARAMID)( 1359 << 14)
+#define MC__PRM2_T2PLS2_4                        (MCPARAMID)( 1360 << 14)
+#define MC__PRM2_T2POS_5                         (MCPARAMID)( 1361 << 14)
+#define MC__PRM2_T2PLS1_5                        (MCPARAMID)( 1362 << 14)
+#define MC__PRM2_T2PLS2_5                        (MCPARAMID)( 1363 << 14)
+#define MC__STM2_T2SEL                           (MCPARAMID)( 1364 << 14)
+#define MC__STM2_T2SEL_OFF                         1
+#define MC__STM2_T2SEL_OnLTRIGS                    2
+#define MC__STM2_T2SEL_OnLTRIGE                    3
+#define MC__STM2_T2SEL_OnPPLS                      4
+#define MC__STM2_T2SEL_OnGO1                       5
+#define MC__STM2_T2SEL_OnEND2                      6
+#define MC__T2_10ns                              (MCPARAMID)( 1365 << 14)
+#define MC__ResetDur_T2                          (MCPARAMID)( 1366 << 14)
+#define MC__ReadoutDur_T2                        (MCPARAMID)( 1367 << 14)
+#define MC__ExposureController                   (MCPARAMID)( 1368 << 14)
+#define MC__ExposureController_CAMERA              1
+#define MC__ExposureController_GRABBER             2
+#define MC__Category_Timer1_Control               19
+#define MC__Category_Timer2_Control               20
+#define MC__TRG_LTPOL                            (MCPARAMID)( 1369 << 14)
+#define MC__TRG_LTPOL_NONE                         1
+#define MC__TRG_LTPOL_DIRECT                       2
+#define MC__TRG_LTPOL_INVERT                       3
+#define MC__TRG_LTFLT                            (MCPARAMID)( 1370 << 14)
+#define MC__TRG_LTFLT_NONE                         1
+#define MC__TRG_LTFLT_200ns                        2
+#define MC__TRG_LTFLT_3200ns                       3
+#define MC__TRG_LTSEL                            (MCPARAMID)( 1371 << 14)
+#define MC__TRG_LTSEL_DA1                          1
+#define MC__TRG_LTSEL_DA2                          2
+#define MC__TRG_LTSEL_CAMSIG                       3
+#define MC__TRG_LTSEL_TRG                          4
+#define MC_Encoder_Filter                        (MCPARAMID)( 1372 << 14)
+#define MC_LineTrigCtl_Filter                    (MCPARAMID)( 1373 << 14)
+#define MC_LineTrig_Filter                       (MCPARAMID)( 1374 << 14)
+#define MC_Period_Filter                         (MCPARAMID)( 1375 << 14)
+#define MC_Perio_Filter                          (MCPARAMID)( 1376 << 14)
+#define MC_A1Usage_TRIGGER                         3
+#define MC_A1Usage_LINETRIGGER                     4
+#define MC_A2Usage_TRIGGER                         3
+#define MC_A2Usage_LINETRIGGER                     4
+#define MC__TrigLineNeeded                       (MCPARAMID)( 1377 << 14)
+#define MC__TrigLineNeeded_NO                      1
+#define MC__TrigLineNeeded_YES                     2
+#define MC__TrigLine_NONE                          3
+#define MC__TrigLine_DA1                           4
+#define MC__TrigLine_DA2                           5
+#define MC__TrigLine_CAMSIG                        6
+#define MC__TrigLine_TRG                           7
+#define MC__LineTrigLineNeeded                   (MCPARAMID)( 1378 << 14)
+#define MC__LineTrigLineNeeded_NO                  1
+#define MC__LineTrigLineNeeded_YES                 2
+#define MC__LineTrigLine                         (MCPARAMID)( 1379 << 14)
+#define MC__LineTrigLine_NONE                      3
+#define MC__LineTrigLine_DA1                       4
+#define MC__LineTrigLine_CAMSIG                    5
+#define MC__LineTrigLine_TRG                       6
+#define MC__StrobeLine                           (MCPARAMID)( 1380 << 14)
+#define MC__StrobeLine_NONE                        1
+#define MC__StrobeLine_QA1                         2
+#define MC__StrobeLine_QA2                         3
+#define MC__StrobeLine_STR                         4
+#define MC__Category_System_IO                    21
+#define MC_TRGUsage                              (MCPARAMID)( 1381 << 14)
+#define MC_TRGUsage_FREE                           1
+#define MC_TRGUsage_TRIGGER                        2
+#define MC_TRGUsage_LINETRIGGER                    3
+#define MC_TrigCtl_Filter                        (MCPARAMID)( 1382 << 14)
+#define MC__TrimmedPeriod_10ns                   (MCPARAMID)( 1383 << 14)
+#define MC__PG_10ns                              (MCPARAMID)( 1384 << 14)
+#define MC__TrimmedK_1000                        (MCPARAMID)( 1385 << 14)
+#define MC__SP_Ideal                             (MCPARAMID)( 1386 << 14)
+#define MC_GrabField                             (MCPARAMID)( 1387 << 14)
+#define MC_NextGrabField                         (MCPARAMID)( 1388 << 14)
+#define MC__PM_Criteria                          (MCPARAMID)( 1389 << 14)
+#define MC__PM_Criteria_NORMAL                     1
+#define MC__PM_Criteria_WIDERANGE                  2
+#define MC__PM_Criteria_HIGHRESOLUTION             3
+#define MC__K_Criteria                           (MCPARAMID)( 1390 << 14)
+#define MC__K_Criteria_NORMAL                      1
+#define MC__K_Criteria_FASTUPDATE                  2
+#define MC__K_Criteria_HIGHRESOLUTION              3
+#define MC__Nmin                                 (MCPARAMID)( 1391 << 14)
+#define MC__Mmin                                 (MCPARAMID)( 1392 << 14)
+#define MC__PSClockFrequency_MHz                 (MCPARAMID)( 1393 << 14)
+#define MC__TrimmedPeriod_PSC                    (MCPARAMID)( 1394 << 14)
+#define MC__SP_Desired                           (MCPARAMID)( 1395 << 14)
+#define MC__TrimmedK_10000                       (MCPARAMID)( 1396 << 14)
+#define MC__SEmin_Desired                        (MCPARAMID)( 1397 << 14)
+#define MC__Keff_10000                           (MCPARAMID)( 1398 << 14)
+#define MC__CPM_PMSDIV_Update                    (MCPARAMID)( 1399 << 14)
+#define MC__CPG_PGCNT_Update                     (MCPARAMID)( 1400 << 14)
+#define MC__Vactive_Ln                           (MCPARAMID)( 1401 << 14)
+#define MC__VCsyncAft_Ln                         (MCPARAMID)( 1402 << 14)
+#define MC_GrabField_FLD                           1
+#define MC_GrabField_UP                            2
+#define MC_GrabField_DOWN                          3
+#define MC_GrabField_FRAME                         4
+#define MC_GrabField_UPDW                          5
+#define MC_GrabField_DWUP                          6
+#define MC_GrabField_NONE                          7
+#define MC_NextGrabField_FLD                       1
+#define MC_NextGrabField_UP                        2
+#define MC_NextGrabField_DOWN                      3
+#define MC_NextGrabField_FRAME                     4
+#define MC_NextGrabField_UPDW                      5
+#define MC_NextGrabField_DWUP                      6
+#define MC_NextGrabField_KEEP                      7
+#define MC_NextGrabField_SAME                      8
+#define MC_NextGrabField_CHANGE                    9
+#define MC_INTLoadSet                            (MCPARAMID)( 1403 << 14)
+#define MC_MaxSpeed_Max                          (MCPARAMID)( 1404 << 14)
+#define MC_MaxSpeed_Min                          (MCPARAMID)( 1405 << 14)
+#define MC__RateConverterControl                 (MCPARAMID)( 1406 << 14)
+#define MC__RateConverterControl_STANDARD          1
+#define MC__RateConverterControl_EXTENDED          2
+#define MC___Encoder_Check                       (MCPARAMID)( 1407 << 14)
+#define MC___Encoder_Check_PASS                    1
+#define MC___Encoder_Check_FAIL                    2
+#define MC__CPG_PGSCAL_Key                       (MCPARAMID)( 1408 << 14)
+#define MC__CPG_PGSCAL_Key_Top_Check             (MCPARAMID)( 1409 << 14)
+#define MC__CPG_PGSCAL_Key_Top_Check_PASS          1
+#define MC__CPG_PGSCAL_Key_Top_Check_FAIL          2
+#define MC__CPM_PMISCAL_Key                      (MCPARAMID)( 1410 << 14)
+#define MC__CPM_PMISCAL_Key_Top_Check            (MCPARAMID)( 1411 << 14)
+#define MC__CPM_PMISCAL_Key_Top_Check_PASS         1
+#define MC__CPM_PMISCAL_Key_Top_Check_FAIL         2
+#define MC__CPM_PMSDIV_Top_Check                 (MCPARAMID)( 1412 << 14)
+#define MC__CPM_PMSDIV_Top_Check_PASS              1
+#define MC__CPM_PMSDIV_Top_Check_FAIL              2
+#define MC__CPG_PGMOD                            (MCPARAMID)( 1413 << 14)
+#define MC__CPG_PGMOD_OFF                          1
+#define MC__CPG_PGMOD_FREE_RUN                     2
+#define MC__CPG_PGMOD_PM_CONTROLLED                3
+#define MC__CPM_PMISCAL                          (MCPARAMID)( 1414 << 14)
+#define MC__CPM_PMSDIV                           (MCPARAMID)( 1415 << 14)
+#define MC__CPG_PGCNT                            (MCPARAMID)( 1416 << 14)
+#define MC__CPG_PGSCAL                           (MCPARAMID)( 1417 << 14)
+#define MC__TrimmedK_10000_MAX                   (MCPARAMID)( 1418 << 14)
+#define MC__TrimmedK_10000_MIN                   (MCPARAMID)( 1419 << 14)
+#define MC__TrimmedKeff_10000                    (MCPARAMID)( 1420 << 14)
+#define MC_MaxSpeedEffective                     (MCPARAMID)( 1421 << 14)
+#define MC_MaxSpeed_Check_Key                    (MCPARAMID)( 1422 << 14)
+#define MC_MaxSpeed_Check                        (MCPARAMID)( 1423 << 14)
+#define MC_MaxSpeed_Check_PASS                     1
+#define MC_MaxSpeed_Check_FAIL                     2
+#define MC__TrimmedK_Check_Key                   (MCPARAMID)( 1424 << 14)
+#define MC__TrimmedK_Check                       (MCPARAMID)( 1425 << 14)
+#define MC__TrimmedK_Check_PASS                    1
+#define MC__TrimmedK_Check_FAIL                    2
+#define MC__SE_Factor_Key                        (MCPARAMID)( 1426 << 14)
+#define MC__SE_Factor_Key_Top_Check              (MCPARAMID)( 1427 << 14)
+#define MC__SE_Factor_Key_Top_Check_PASS           1
+#define MC__SE_Factor_Key_Top_Check_FAIL           2
+#define MC__SE_Factor                            (MCPARAMID)( 1428 << 14)
+#define MC__M_Ratio                              (MCPARAMID)( 1429 << 14)
+#define MC__M_Ratio_Top_Check                    (MCPARAMID)( 1430 << 14)
+#define MC__M_Ratio_Top_Check_PASS                 1
+#define MC__M_Ratio_Top_Check_FAIL                 2
+#define MC__SP_Factor_Key                        (MCPARAMID)( 1431 << 14)
+#define MC__SP_Factor_Key_Top_Check              (MCPARAMID)( 1432 << 14)
+#define MC__SP_Factor_Key_Top_Check_PASS           1
+#define MC__SP_Factor_Key_Top_Check_FAIL           2
+#define MC__SP_Factor                            (MCPARAMID)( 1433 << 14)
+#define MC_NextTrigMode_Filter                   (MCPARAMID)( 1434 << 14)
+#define MC_MinSpeed_Check                        (MCPARAMID)( 1435 << 14)
+#define MC_MinSpeed_Check_PASS                     1
+#define MC_MinSpeed_Check_FAIL                     2
+#define MC___Encoder_Warning_Check               (MCPARAMID)( 1436 << 14)
+#define MC___Encoder_Warning_Check_PASS            1
+#define MC___Encoder_Warning_Check_FAIL            2
+#define MC__EncoderMaxSpeed                      (MCPARAMID)( 1437 << 14)
+#define MC__EncoderMaxSpeed_Check                (MCPARAMID)( 1438 << 14)
+#define MC__EncoderMaxSpeed_Check_PASS             1
+#define MC__EncoderMaxSpeed_Check_FAIL             2
+#define MC__EncoderMinSpeed                      (MCPARAMID)( 1439 << 14)
+#define MC__EncoderMinSpeed_Check                (MCPARAMID)( 1440 << 14)
+#define MC__EncoderMinSpeed_Check_PASS             1
+#define MC__EncoderMinSpeed_Check_FAIL             2
+#define MC_X_VRSTMID                             (MCPARAMID)( 1441 << 14)
+#define MC__SYNC_Line1_Type_BLANK_VRSTMID          3
+#define MC__SYNC_Line4_Type_ACQ_VRSTMID            3
+#define MC__SYNC_Line5_Type_BLANK_VRSTMID          3
+#define MC__SYNC_Line6_Type                      (MCPARAMID)( 1442 << 14)
+#define MC__SYNC_Line6_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line6_Type_BLANK_VRSTON           2
+#define MC__SYNC_Line6_Type_BLANK_VRSTMID          3
+#define MC__SYNC_Line6_Dur                       (MCPARAMID)( 1443 << 14)
+#define MC__SYNC_Line7_Type                      (MCPARAMID)( 1444 << 14)
+#define MC__SYNC_Line7_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line7_Dur                       (MCPARAMID)( 1445 << 14)
+#define MC__SYNC_Line8_Type                      (MCPARAMID)( 1446 << 14)
+#define MC__SYNC_Line8_Type_ACQ_VRSTOFF            1
+#define MC__SYNC_Line8_Type_ACQ_VRSTON             2
+#define MC__SYNC_Line8_Type_ACQ_VRSTMID            3
+#define MC__SYNC_Line8_Dur                       (MCPARAMID)( 1447 << 14)
+#define MC__SYNC_Line9_Type                      (MCPARAMID)( 1448 << 14)
+#define MC__SYNC_Line9_Type_BLANK_VRSTOFF          1
+#define MC__SYNC_Line9_Type_BLANK_VRSTON           2
+#define MC__SYNC_Line9_Type_BLANK_VRSTMID          3
+#define MC__SYNC_Line9_Dur                       (MCPARAMID)( 1449 << 14)
+#define MC__MID_Eacq2Vrst_Gap                    (MCPARAMID)( 1450 << 14)
+#define MC__MID_Vrst2Bacq_Gap                    (MCPARAMID)( 1451 << 14)
+#define MC__SYNC_Line10_Type                     (MCPARAMID)( 1452 << 14)
+#define MC__SYNC_Line10_Type_ACQ_VRSTOFF           1
+#define MC__SYNC_Line10_Dur                      (MCPARAMID)( 1453 << 14)
+#define MC_MATLoadSet                            (MCPARAMID)( 1454 << 14)
+#define MC__K_SP                                 (MCPARAMID)( 1455 << 14)
+#define MC__M_SP                                 (MCPARAMID)( 1456 << 14)
+#define MC__M_SP_10                              (MCPARAMID)( 1457 << 14)
+#define MC__TrimmedK_16384                       (MCPARAMID)( 1458 << 14)
+#define MC__K_SP_16384                           (MCPARAMID)( 1459 << 14)
+#define MC__TrimmedK_131072                      (MCPARAMID)( 1460 << 14)
+#define MC_VCSYNC1                               (MCPARAMID)( 1461 << 14)
+#define MC_VCSYNC2                               (MCPARAMID)( 1462 << 14)
+#define MC_BACK1                                 (MCPARAMID)( 1463 << 14)
+#define MC_BACK2                                 (MCPARAMID)( 1464 << 14)
+#define MC__VdriveDur_Ln                         (MCPARAMID)( 1465 << 14)
+#define MC__VdriveDly_Ln                         (MCPARAMID)( 1466 << 14)
+#define MC__L_16384                              (MCPARAMID)( 1467 << 14)
+#define MC__INT_Eacq2Vrst_Gap                    (MCPARAMID)( 1468 << 14)
+#define MC__INT_Vrst2Bacq_Gap                    (MCPARAMID)( 1469 << 14)
+#define MC__SYNC_Line4_Type_BLANK_VRSTMID          4
+#define MC__INITD1_SELV1                         (MCPARAMID)( 1470 << 14)
+#define MC__INT_BEFORE                           (MCPARAMID)( 1471 << 14)
+#define MC__INT_CHOIX                            (MCPARAMID)( 1472 << 14)
+#define MC__Equalization                         (MCPARAMID)( 1473 << 14)
+#define MC_TrigFilter_Filter                     (MCPARAMID)( 1474 << 14)
+#define MC__TRG_FTFLT_100ns                        4
+#define MC__TRG_FTFLT_500ns                        5
+#define MC__TRG_FTFLT_2500ns                       6
+#define MC_LineTrigFilter_Filter                 (MCPARAMID)( 1475 << 14)
+#define MC__TRG_LTFLT_100ns                        4
+#define MC__TRG_LTFLT_500ns                        5
+#define MC__TRG_LTFLT_2500ns                       6
+#define MC__STM1_T1CLK_EOL                         4
+#define MC__EquaCCIR                             (MCPARAMID)( 1476 << 14)
+#define MC_PageModeOnly_Filter                   (MCPARAMID)( 1477 << 14)
+#define MC_AllButWebMode_Filter                  (MCPARAMID)( 1478 << 14)
+#define MC__IndexField                           (MCPARAMID)( 1479 << 14)
+#define MC_Camera_LD3521PGx                       61
+#define MC_Camera_LD3522PGx                       62
+#define MC_Camera_LD3523PGx                       63
+#define MC_Camera_LD3541PGx                       64
+#define MC_Camera_LD3542PGx                       65
+#define MC_Camera_LD3543PGx                       66
+#define MC_Camera_L101k                           67
+#define MC_Camera_L103k                           68
+#define MC_Camera_L104k                           69
+#define MC_Camera_A301bc                          70
+#define MC_CamConfig_L512SP                       98
+#define MC_CamConfig_L1024SP                      99
+#define MC_CamConfig_L2048SP                     100
+#define MC_CamConfig_L1024RC                     101
+#define MC_CamConfig_L1024RG                     102
+#define MC_CamConfig_L2048RG                     103
+#define MC_CamConfig_L2048RC                     104
+#define MC_CamConfig_P80SC                       105
+#define MC_CamConfig_P80RG                       106
+#define MC_Manufacturer_PERKINELMER               15
+#define MC_Camera_L301bc                          71
+#define MC_CamConfig_L2098SP                     107
+#define MC_CamConfig_L2098RC                     108
+#define MC_CamConfig_L2098RG                     109
+#define MC_Camera_L401k                           72
+#define MC_Camera_L402k                           73
+#define MC_Camera_L403k                           74
+#define MC_CamConfig_L4096SP                     110
+#define MC_CamConfig_L4096RC                     111
+#define MC_CamConfig_L4096RG                     112
+#define MC_Camera_P2_2x_06k40                     75
+#define MC_Camera_P2_2x_08k40                     76
+#define MC_CamConfig_L6144SP                     113
+#define MC_CamConfig_L6144RC                     114
+#define MC_CamConfig_L6144RG                     115
+#define MC_CamConfig_L8192SP                     116
+#define MC_CamConfig_L8192RC                     117
+#define MC_CamConfig_L8192RG                     118
+#define MC_Manufacturer_DALSA                     16
+#define MC_CamConfig_L512RG                      119
+#define MC_Camera_AVIIVA                          77
+#define MC_CamConfig_L512RC                      120
+#define MC_Manufacturer_ATMEL                     17
+#define MC_Camera_P2_2x_01k40                     78
+#define MC_Camera_P2_2x_02k40                     79
+#define MC_Camera_P2_2x_04k40                     80
+#define MC_Camera_AVIIVA0514                      81
+#define MC_Camera_AVIIVA1014                      82
+#define MC_Camera_AVIIVA2014                      83
+#define MC_Camera_AVIIVA4010                      84
+#define MC_ChannelTopology_DUALXMID               10
+#define MC_FvalMode_LA                             5
+#define MC_LvalMode_DG                             6
+#define MC__DIS_LALT                             (MCPARAMID)( 1480 << 14)
+#define MC__DIS_LALT_NORMAL                        1
+#define MC__DIS_LALT_ALTERNATE                     2
+#define MC__DIS_DALT                             (MCPARAMID)( 1481 << 14)
+#define MC__DIS_DALT_NORMAL                        1
+#define MC__DIS_DALT_ALTERNATE                     2
+#define MC_Camera_TI_324A                         85
+#define MC_CamConfig_I60SM                       121
+#define MC_Manufacturer_NEC                       18
+#define MC_CamConfig_P400SM                      122
+#define MC_Camera_CV_A1                           86
+#define MC_CamConfig_P16SA                       123
+#define MC_CamConfig_P16RA                       124
+#define MC_CamConfig_P16RA_G                     125
+#define MC_CamConfig_P16SM                       126
+#define MC_CamConfig_P16RM                       127
+#define MC_CamConfig_P16RM_G                     128
+#define MC_CamConfig_P16SD                       129
+#define MC_CamConfig_P16RD                       130
+#define MC_CamConfig_P16RD_G                     131
+#define MC_Camera_CV_M77                          87
+#define MC_Cable_A15_C17                          22
+#define MC_CableName_Triple_Channel_RG_2          22
+#define MC_CamConfig_P10RG                       132
+#define MC_CamConfig_P10RC                       133
+#define MC__CDC_ISIZE_8BIT                         9
+#define MC__CDC_ISIZE_10BIT                       10
+#define MC__CDC_ISIZE_12BIT                       11
+#define MC__CDC_ISIZE_14BIT                       12
+#define MC__CDC_ISIZE_16BIT                       13
+#define MC__CDC_CLCFG                            (MCPARAMID)( 1482 << 14)
+#define MC__CDC_CLCFG_BASE                         1
+#define MC__CDC_CLCFG_MEDIUM                       2
+#define MC__CDC_MTAP                             (MCPARAMID)( 1483 << 14)
+#define MC__CDC_MTAP_ONETAP                        1
+#define MC__CDC_MTAP_TWOTAPS                       2
+#define MC__CDC_FSLIC                            (MCPARAMID)( 1484 << 14)
+#define MC__CBA_DCEN1                            (MCPARAMID)( 1485 << 14)
+#define MC__CBA_DCEN1_ENABLED                      1
+#define MC__CBA_DCEN1_DISABLED                     2
+#define MC__CBA_DCEN2                            (MCPARAMID)( 1486 << 14)
+#define MC__CBA_DCEN2_ENABLED                      1
+#define MC__CBA_DCEN2_DISABLED                     2
+#define MC__CBA_DCEN3                            (MCPARAMID)( 1487 << 14)
+#define MC__CBA_DCEN3_ENABLED                      1
+#define MC__CBA_DCEN3_DISABLED                     2
+#define MC__CDC_FSLIC_ONE256                       1
+#define MC__CDC_FSLIC_TWO128                       2
+#define MC__CDC_FSLIC_FOUR64                       3
+#define MC__CDC_FSLIC_EIGHT32                      4
+#define MC_TapStructure_TRIPLE_W2                 16
+#define MC__W1_INDEX                             (MCPARAMID)( 1488 << 14)
+#define MC__W2_INDEX                             (MCPARAMID)( 1489 << 14)
+#define MC__W3_INDEX                             (MCPARAMID)( 1490 << 14)
+#define MC__W4_INDEX                             (MCPARAMID)( 1491 << 14)
+#define MC__GCL_CLCFG                            (MCPARAMID)( 1492 << 14)
+#define MC__GCL_CLCFG_BASE                         1
+#define MC__GCL_CLCFG_MEDIUM                       2
+#define MC__AllAssyMask                          (MCPARAMID)( 1493 << 14)
+#define MC__UsedAssyMask                         (MCPARAMID)( 1494 << 14)
+#define MC_TrigLine_TRX                            8
+#define MC_TrigLine_TRY                            9
+#define MC_TrigLine_TRZ                           10
+#define MC__StrobeLine_QB1                         5
+#define MC__StrobeLine_QB2                         6
+#define MC__StrobeLine_STX                         7
+#define MC__StrobeLine_STY                         8
+#define MC__StrobeLine_STZ                         9
+#define MC_LineTrigLine_TRX                        4
+#define MC_LineTrigLine_TRY                        5
+#define MC_LineTrigLine_TRZ                        6
+#define MC__LineTrigLine_DB1                       7
+#define MC__LineTrigLine_TRX                       8
+#define MC__LineTrigLine_TRY                       9
+#define MC__LineTrigLine_TRZ                      10
+#define MC__TRG_LTSEL_DB1                          5
+#define MC__TRG_LTSEL_TRX                          6
+#define MC__TRG_LTSEL_TRY                          7
+#define MC__TRG_LTSEL_TRZ                          8
+#define MC_TRXUsage                              (MCPARAMID)( 1495 << 14)
+#define MC_TRXUsage_FREE                           1
+#define MC_TRXUsage_TRIGGER                        2
+#define MC_TRXUsage_LINETRIGGER                    3
+#define MC_TRYUsage                              (MCPARAMID)( 1496 << 14)
+#define MC_TRYUsage_FREE                           1
+#define MC_TRYUsage_TRIGGER                        2
+#define MC_TRYUsage_LINETRIGGER                    3
+#define MC_TRZUsage                              (MCPARAMID)( 1497 << 14)
+#define MC_TRZUsage_FREE                           1
+#define MC_TRZUsage_TRIGGER                        2
+#define MC_TRZUsage_LINETRIGGER                    3
+#define MC_STXUsage                              (MCPARAMID)( 1498 << 14)
+#define MC_STXUsage_FREE                           1
+#define MC_STXUsage_STROBEX                        2
+#define MC_STXUsage_STROBEY                        3
+#define MC_STYUsage                              (MCPARAMID)( 1499 << 14)
+#define MC_STYUsage_FREE                           1
+#define MC_STYUsage_STROBEX                        2
+#define MC_STYUsage_STROBEY                        3
+#define MC_STZUsage                              (MCPARAMID)( 1500 << 14)
+#define MC_STZUsage_FREE                           1
+#define MC_STZUsage_STROBEX                        2
+#define MC_STZUsage_STROBEY                        3
+#define MC_B1Usage                               (MCPARAMID)( 1501 << 14)
+#define MC_B1Usage_FREE                            1
+#define MC_B1Usage_STROBE                          2
+#define MC_B2Usage                               (MCPARAMID)( 1502 << 14)
+#define MC_B2Usage_FREE                            1
+#define MC_B2Usage_STROBE                          2
+#define MC__STR_STR_X_FromSTB_Y                    5
+#define MC__STR_STR_X_FromSTB_Y_Inverted           6
+#define MC__STR_STR_Y                            (MCPARAMID)( 1503 << 14)
+#define MC__STR_STR_Y_LOW                          1
+#define MC__STR_STR_Y_HIGH                         2
+#define MC__STR_STR_Y_FromSTB_X                    3
+#define MC__STR_STR_Y_FromSTB_X_Inverted           4
+#define MC__STR_STR_Y_FromSTB_Y                    5
+#define MC__STR_STR_Y_FromSTB_Y_Inverted           6
+#define MC__STR_STR_Z                            (MCPARAMID)( 1504 << 14)
+#define MC__STR_STR_Z_LOW                          1
+#define MC__STR_STR_Z_HIGH                         2
+#define MC__STR_STR_Z_FromSTB_X                    3
+#define MC__STR_STR_Z_FromSTB_X_Inverted           4
+#define MC__STR_STR_Z_FromSTB_Y                    5
+#define MC__STR_STR_Z_FromSTB_Y_Inverted           6
+#define MC__TrigLine_CAMSIGA                       8
+#define MC__TrigLine_DB1                           9
+#define MC__TrigLine_DB2                          10
+#define MC__TrigLine_CAMSIGB                      11
+#define MC__TrigLine_TRGX                         12
+#define MC__TrigLine_TRGY                         13
+#define MC__TrigLine_TRGZ                         14
+#define MC__TrigLine_TRX                          15
+#define MC__TrigLine_TRY                          16
+#define MC__TrigLine_TRZ                          17
+#define MC__TRG_FTSEL_D1                          10
+#define MC__TRG_FTSEL_D2                          11
+#define MC__TRG_FTSEL_TRX                         12
+#define MC__TRG_FTSEL_TRY                         13
+#define MC__TRG_FTSEL_TRZ                         14
+#define MC__LineTrigLine_CAMSIGA                  11
+#define MC__LineTrigLine_CAMSIGB                  12
+#define MC__TRG_LTSEL_D1                           9
+#define MC__TRG_LTSEL_D2                          10
+#define MC__CWR_SFA01                            (MCPARAMID)( 1505 << 14)
+#define MC__CWR_SFA11                            (MCPARAMID)( 1506 << 14)
+#define MC__CWR_SFA02                            (MCPARAMID)( 1507 << 14)
+#define MC__CWR_SFA12                            (MCPARAMID)( 1508 << 14)
+#define MC__CWR_SFA03                            (MCPARAMID)( 1509 << 14)
+#define MC__CWR_SFA13                            (MCPARAMID)( 1510 << 14)
+#define MC__CWR_SFA04                            (MCPARAMID)( 1511 << 14)
+#define MC__CWR_SFA14                            (MCPARAMID)( 1512 << 14)
+#define MC__STARTU4_mw                           (MCPARAMID)( 1513 << 14)
+#define MC__STARTD4_mw                           (MCPARAMID)( 1514 << 14)
+#define MC__DirX4                                (MCPARAMID)( 1515 << 14)
+#define MC__DirY4                                (MCPARAMID)( 1516 << 14)
+#define MC__CTA_STEPX4                           (MCPARAMID)( 1517 << 14)
+#define MC__CTA_STEPY4                           (MCPARAMID)( 1518 << 14)
+#define MC__CWR_WXP1                             (MCPARAMID)( 1519 << 14)
+#define MC__CWR_WXP2                             (MCPARAMID)( 1520 << 14)
+#define MC__CWR_WXP3                             (MCPARAMID)( 1521 << 14)
+#define MC__CWR_WXP4                             (MCPARAMID)( 1522 << 14)
+#define MC__CWR_NLA01                            (MCPARAMID)( 1523 << 14)
+#define MC__CWR_NLA11                            (MCPARAMID)( 1524 << 14)
+#define MC__CWR_NLA02                            (MCPARAMID)( 1525 << 14)
+#define MC__CWR_NLA12                            (MCPARAMID)( 1526 << 14)
+#define MC__CWR_NLA03                            (MCPARAMID)( 1527 << 14)
+#define MC__CWR_NLA13                            (MCPARAMID)( 1528 << 14)
+#define MC__CWR_NLA04                            (MCPARAMID)( 1529 << 14)
+#define MC__CWR_NLA14                            (MCPARAMID)( 1530 << 14)
+#define MC__CWR_NPA01                            (MCPARAMID)( 1531 << 14)
+#define MC__CWR_NPA11                            (MCPARAMID)( 1532 << 14)
+#define MC__CWR_NPA02                            (MCPARAMID)( 1533 << 14)
+#define MC__CWR_NPA12                            (MCPARAMID)( 1534 << 14)
+#define MC__CWR_NPA03                            (MCPARAMID)( 1535 << 14)
+#define MC__CWR_NPA13                            (MCPARAMID)( 1536 << 14)
+#define MC__CWR_NPA04                            (MCPARAMID)( 1537 << 14)
+#define MC__CWR_NPA14                            (MCPARAMID)( 1538 << 14)
+#define MC__CWR_WYP1                             (MCPARAMID)( 1539 << 14)
+#define MC__CWR_WYP2                             (MCPARAMID)( 1540 << 14)
+#define MC__CWR_WYP3                             (MCPARAMID)( 1541 << 14)
+#define MC__CWR_WYP4                             (MCPARAMID)( 1542 << 14)
+#define MC__PITCH4_mw                            (MCPARAMID)( 1543 << 14)
+#define MC_Connector_M                             8
+#define MC_Connector_A                             9
+#define MC_Connector_B                            10
+#define MC_ConnectLoc_BOTH                         4
+#define MC___Connector_Check                     (MCPARAMID)( 1544 << 14)
+#define MC___Connector_Check_PASS                  1
+#define MC___Connector_Check_FAIL                  2
+#define MC__CDC_TPG                              (MCPARAMID)( 1545 << 14)
+#define MC__CDC_TPG_ENABLE                         1
+#define MC__CDC_TPG_DISABLE                        2
+#define MC__ASSYE11                              (MCPARAMID)( 1546 << 14)
+#define MC__ASSYE12                              (MCPARAMID)( 1547 << 14)
+#define MC__ASSYE13                              (MCPARAMID)( 1548 << 14)
+#define MC__ASSYE14                              (MCPARAMID)( 1549 << 14)
+#define MC__ASSYE15                              (MCPARAMID)( 1550 << 14)
+#define MC__ASSYE16                              (MCPARAMID)( 1551 << 14)
+#define MC__ASSYE17                              (MCPARAMID)( 1552 << 14)
+#define MC__ASSYE18                              (MCPARAMID)( 1553 << 14)
+#define MC__ASSYE21                              (MCPARAMID)( 1554 << 14)
+#define MC__ASSYE22                              (MCPARAMID)( 1555 << 14)
+#define MC__ASSYE23                              (MCPARAMID)( 1556 << 14)
+#define MC__ASSYE24                              (MCPARAMID)( 1557 << 14)
+#define MC__ASSYE25                              (MCPARAMID)( 1558 << 14)
+#define MC__ASSYE26                              (MCPARAMID)( 1559 << 14)
+#define MC__ASSYE27                              (MCPARAMID)( 1560 << 14)
+#define MC__ASSYE28                              (MCPARAMID)( 1561 << 14)
+#define MC__ASSYE31                              (MCPARAMID)( 1562 << 14)
+#define MC__ASSYE32                              (MCPARAMID)( 1563 << 14)
+#define MC__ASSYE33                              (MCPARAMID)( 1564 << 14)
+#define MC__ASSYE34                              (MCPARAMID)( 1565 << 14)
+#define MC__ASSYE35                              (MCPARAMID)( 1566 << 14)
+#define MC__ASSYE36                              (MCPARAMID)( 1567 << 14)
+#define MC__ASSYE37                              (MCPARAMID)( 1568 << 14)
+#define MC__ASSYE38                              (MCPARAMID)( 1569 << 14)
+#define MC__ASSYE41                              (MCPARAMID)( 1570 << 14)
+#define MC__ASSYE42                              (MCPARAMID)( 1571 << 14)
+#define MC__ASSYE43                              (MCPARAMID)( 1572 << 14)
+#define MC__ASSYE44                              (MCPARAMID)( 1573 << 14)
+#define MC__ASSYE45                              (MCPARAMID)( 1574 << 14)
+#define MC__ASSYE46                              (MCPARAMID)( 1575 << 14)
+#define MC__ASSYE47                              (MCPARAMID)( 1576 << 14)
+#define MC__ASSYE48                              (MCPARAMID)( 1577 << 14)
+#define MC__ASSY41                               (MCPARAMID)( 1578 << 14)
+#define MC__ASSY42                               (MCPARAMID)( 1579 << 14)
+#define MC__ASSY43                               (MCPARAMID)( 1580 << 14)
+#define MC__ASSY44                               (MCPARAMID)( 1581 << 14)
+#define MC__ASSYE51                              (MCPARAMID)( 1582 << 14)
+#define MC__ASSYE52                              (MCPARAMID)( 1583 << 14)
+#define MC__ASSYE53                              (MCPARAMID)( 1584 << 14)
+#define MC__ASSYE54                              (MCPARAMID)( 1585 << 14)
+#define MC__ASSYE55                              (MCPARAMID)( 1586 << 14)
+#define MC__ASSYE56                              (MCPARAMID)( 1587 << 14)
+#define MC__ASSYE57                              (MCPARAMID)( 1588 << 14)
+#define MC__ASSYE58                              (MCPARAMID)( 1589 << 14)
+#define MC__ASSYE61                              (MCPARAMID)( 1590 << 14)
+#define MC__ASSYE62                              (MCPARAMID)( 1591 << 14)
+#define MC__ASSYE63                              (MCPARAMID)( 1592 << 14)
+#define MC__ASSYE64                              (MCPARAMID)( 1593 << 14)
+#define MC__ASSYE65                              (MCPARAMID)( 1594 << 14)
+#define MC__ASSYE66                              (MCPARAMID)( 1595 << 14)
+#define MC__ASSYE67                              (MCPARAMID)( 1596 << 14)
+#define MC__ASSYE68                              (MCPARAMID)( 1597 << 14)
+#define MC__ASSYE71                              (MCPARAMID)( 1598 << 14)
+#define MC__ASSYE72                              (MCPARAMID)( 1599 << 14)
+#define MC__ASSYE73                              (MCPARAMID)( 1600 << 14)
+#define MC__ASSYE74                              (MCPARAMID)( 1601 << 14)
+#define MC__ASSYE75                              (MCPARAMID)( 1602 << 14)
+#define MC__ASSYE76                              (MCPARAMID)( 1603 << 14)
+#define MC__ASSYE77                              (MCPARAMID)( 1604 << 14)
+#define MC__ASSYE78                              (MCPARAMID)( 1605 << 14)
+#define MC__ASSYE81                              (MCPARAMID)( 1606 << 14)
+#define MC__ASSYE82                              (MCPARAMID)( 1607 << 14)
+#define MC__ASSYE83                              (MCPARAMID)( 1608 << 14)
+#define MC__ASSYE84                              (MCPARAMID)( 1609 << 14)
+#define MC__ASSYE85                              (MCPARAMID)( 1610 << 14)
+#define MC__ASSYE86                              (MCPARAMID)( 1611 << 14)
+#define MC__ASSYE87                              (MCPARAMID)( 1612 << 14)
+#define MC__ASSYE88                              (MCPARAMID)( 1613 << 14)
+#define MC__AllMyAssyMask                        (MCPARAMID)( 1614 << 14)
+#define MC__c_INDEX                              (MCPARAMID)( 1615 << 14)
+#define MC__D5_INDEX                             (MCPARAMID)( 1616 << 14)
+#define MC__D6_INDEX                             (MCPARAMID)( 1617 << 14)
+#define MC__D7_INDEX                             (MCPARAMID)( 1618 << 14)
+#define MC__D8_INDEX                             (MCPARAMID)( 1619 << 14)
+#define MC__W5_INDEX                             (MCPARAMID)( 1620 << 14)
+#define MC__W6_INDEX                             (MCPARAMID)( 1621 << 14)
+#define MC__W7_INDEX                             (MCPARAMID)( 1622 << 14)
+#define MC__W8_INDEX                             (MCPARAMID)( 1623 << 14)
+#define MC__CWR_SFA05                            (MCPARAMID)( 1624 << 14)
+#define MC__CWR_SFA06                            (MCPARAMID)( 1625 << 14)
+#define MC__CWR_SFA07                            (MCPARAMID)( 1626 << 14)
+#define MC__CWR_SFA08                            (MCPARAMID)( 1627 << 14)
+#define MC__CWR_NLA05                            (MCPARAMID)( 1628 << 14)
+#define MC__CWR_NLA06                            (MCPARAMID)( 1629 << 14)
+#define MC__CWR_NLA07                            (MCPARAMID)( 1630 << 14)
+#define MC__CWR_NLA08                            (MCPARAMID)( 1631 << 14)
+#define MC__CWR_WYP5                             (MCPARAMID)( 1632 << 14)
+#define MC__CWR_WYP6                             (MCPARAMID)( 1633 << 14)
+#define MC__CWR_WYP7                             (MCPARAMID)( 1634 << 14)
+#define MC__CWR_WYP8                             (MCPARAMID)( 1635 << 14)
+#define MC__PITCH5_mw                            (MCPARAMID)( 1636 << 14)
+#define MC__PITCH6_mw                            (MCPARAMID)( 1637 << 14)
+#define MC__PITCH7_mw                            (MCPARAMID)( 1638 << 14)
+#define MC__PITCH8_mw                            (MCPARAMID)( 1639 << 14)
+#define MC__STARTU5_mw                           (MCPARAMID)( 1640 << 14)
+#define MC__STARTU6_mw                           (MCPARAMID)( 1641 << 14)
+#define MC__STARTU7_mw                           (MCPARAMID)( 1642 << 14)
+#define MC__STARTU8_mw                           (MCPARAMID)( 1643 << 14)
+#define MC__DirX5                                (MCPARAMID)( 1644 << 14)
+#define MC__DirX6                                (MCPARAMID)( 1645 << 14)
+#define MC__DirX7                                (MCPARAMID)( 1646 << 14)
+#define MC__DirX8                                (MCPARAMID)( 1647 << 14)
+#define MC__DirY5                                (MCPARAMID)( 1648 << 14)
+#define MC__DirY6                                (MCPARAMID)( 1649 << 14)
+#define MC__DirY7                                (MCPARAMID)( 1650 << 14)
+#define MC__DirY8                                (MCPARAMID)( 1651 << 14)
+#define MC__CWR_NPA05                            (MCPARAMID)( 1652 << 14)
+#define MC__CWR_NPA06                            (MCPARAMID)( 1653 << 14)
+#define MC__CWR_NPA07                            (MCPARAMID)( 1654 << 14)
+#define MC__CWR_NPA08                            (MCPARAMID)( 1655 << 14)
+#define MC__CWR_WXP5                             (MCPARAMID)( 1656 << 14)
+#define MC__CWR_WXP6                             (MCPARAMID)( 1657 << 14)
+#define MC__CWR_WXP7                             (MCPARAMID)( 1658 << 14)
+#define MC__CWR_WXP8                             (MCPARAMID)( 1659 << 14)
+#define MC__CBA_PSHIFT5                          (MCPARAMID)( 1660 << 14)
+#define MC__CBA_PSHIFT6                          (MCPARAMID)( 1661 << 14)
+#define MC__CBA_PSHIFT7                          (MCPARAMID)( 1662 << 14)
+#define MC__CBA_PSHIFT8                          (MCPARAMID)( 1663 << 14)
+#define MC__PSHIFT                               (MCPARAMID)( 1664 << 14)
+#define MC__MTAP                                 (MCPARAMID)( 1665 << 14)
+#define MC_ChannelTopology_OCTALXTAP              11
+#define MC__ASSY_EIGHT                             5
+#define MC__WIC_EIGHT                              5
+#define MC_Camera_XC_ST50CE                       88
+#define MC_CamConfig_I50SM                       134
+#define MC_Camera_CS8550D                         89
+#define MC_CamConfig_I120SM                      135
+#define MC_Cable_A15_C18                          23
+#define MC_CableName_Single_Channel_RGC_B         23
+#define MC__W_STEP                               (MCPARAMID)( 1666 << 14)
+#define MC__WSTEP                                (MCPARAMID)( 1667 << 14)
+#define MC__FBL_FBLIMIT                          (MCPARAMID)( 1668 << 14)
+#define MC__FBSIZE                               (MCPARAMID)( 1669 << 14)
+#define MC_Camera_L301kc                          90
+#define MC_Camera_XC_ST70CE                       91
+#define MC_ChannelTopology_QUADXPAIRTAP           12
+#define MC_ChannelTopology_QUADXPAIREND           13
+#define MC_ChannelTopology_QUADXPAIRMID           14
+#define MC__Live                                 (MCPARAMID)( 1670 << 14)
+#define MC__CPHASE1                              (MCPARAMID)( 1671 << 14)
+#define MC__CPHASE2                              (MCPARAMID)( 1672 << 14)
+#define MC__CPHASE3                              (MCPARAMID)( 1673 << 14)
+#define MC__CPHASE4                              (MCPARAMID)( 1674 << 14)
+#define MC__CPHASE5                              (MCPARAMID)( 1675 << 14)
+#define MC__CPHASE6                              (MCPARAMID)( 1676 << 14)
+#define MC__CPHASE7                              (MCPARAMID)( 1677 << 14)
+#define MC__CPHASE8                              (MCPARAMID)( 1678 << 14)
+#define MC_TapStructure_QUAD_W2                   17
+#define MC__WMAX                                 (MCPARAMID)( 1679 << 14)
+#define MC__D1_WINDEX                            (MCPARAMID)( 1680 << 14)
+#define MC__D2_WINDEX                            (MCPARAMID)( 1681 << 14)
+#define MC__D3_WINDEX                            (MCPARAMID)( 1682 << 14)
+#define MC__D4_WINDEX                            (MCPARAMID)( 1683 << 14)
+#define MC__D5_WINDEX                            (MCPARAMID)( 1684 << 14)
+#define MC__D6_WINDEX                            (MCPARAMID)( 1685 << 14)
+#define MC__D7_WINDEX                            (MCPARAMID)( 1686 << 14)
+#define MC__D8_XINDEX                            (MCPARAMID)( 1687 << 14)
+#define MC__D8_WINDEX                            (MCPARAMID)( 1688 << 14)
+#define MC__VLC_OVRALIGN                         (MCPARAMID)( 1689 << 14)
+#define MC__VLC_OVRALIGN_ONELINE                   1
+#define MC__VLC_OVRALIGN_SIXTEENLINES              2
+#define MC_Camera_P2_4x_06k40                     92
+#define MC_Camera_P2_4x_04k40                     93
+#define MC_Camera_P2_4x_08k40                     94
+#define MC__Category_Board_Selection              22
+#define MC__Category_Input_Output_Control         23
+#define MC_InputConfig___17                      (MCPARAMID)( 1690 << 14)
+#define MC_InputFunction___17                    (MCPARAMID)( 1691 << 14)
+#define MC_InputState___17                       (MCPARAMID)( 1692 << 14)
+#define MC_InputStyle___17                       (MCPARAMID)( 1693 << 14)
+#define MC_OutputConfig___17                     (MCPARAMID)( 1694 << 14)
+#define MC_OutputFunction___17                   (MCPARAMID)( 1695 << 14)
+#define MC_OutputState___17                      (MCPARAMID)( 1696 << 14)
+#define MC_OutputStyle___17                      (MCPARAMID)( 1697 << 14)
+#define MC_InputOwner___17                       (MCPARAMID)( 1698 << 14)
+#define MC_OutputOwner___17                      (MCPARAMID)( 1699 << 14)
+#define MC_Camera_A102k                           95
+#define MC_TimUnitN_PLL                          (MCPARAMID)( 1700 << 14)
+#define MC_TimUnitN_PLL_NONE                       1
+#define MC_TimUnitN_PLL_NEEDED                     2
+#define MC_TimUnitN_DetV                         (MCPARAMID)( 1701 << 14)
+#define MC_TimUnitN_DetV_NONE                      1
+#define MC_TimUnitN_DetV_NEEDED                    2
+#define MC_TimUnitN_DetP                         (MCPARAMID)( 1702 << 14)
+#define MC_TimUnitN_DetP_NONE                      1
+#define MC_TimUnitN_DetP_NEEDED                    2
+#define MC_TimUnitN_ClockSynth                   (MCPARAMID)( 1703 << 14)
+#define MC_TimUnitN_ClockSynth_NONE                1
+#define MC_TimUnitN_ClockSynth_NEEDED              2
+#define MC_TimUnitNUsage                         (MCPARAMID)( 1704 << 14)
+#define MC_TimUnitNUsage_UNUSED                    1
+#define MC_TimUnitNUsage_EXCLUSIVE                 2
+#define MC_TimUnitNUsage_SHARED                    3
+#define MC__TRG_FTPOL                            (MCPARAMID)( 1705 << 14)
+#define MC__TRG_FTPOL_DIRECT                       4
+#define MC__TRG_FTPOL_INVERT                       5
+#define MC__TRG_FFTA                             (MCPARAMID)( 1706 << 14)
+#define MC__TRG_FFTA_YES                           1
+#define MC__TRG_FFTA_NO                            2
+#define MC__TRG_NFTA                             (MCPARAMID)( 1707 << 14)
+#define MC__TRG_NFTA_YES                           1
+#define MC__TRG_NFTA_NO                            2
+#define MC__TRG_FTSS                             (MCPARAMID)( 1708 << 14)
+#define MC__TRG_FTSS_YES                           1
+#define MC__TRG_FTSS_NO                            2
+#define MC_CamConfig_P60RD_G                     136
+#define MC__BoardType__STREAM                      5
+#define MC__BoardType__CLASSIC                     6
+#define MC_MY_PARAMETER                          (MCPARAMID)( 1709 << 14)
+#define MC_MY_PARAMETER_YES                        1
+#define MC_MY_PARAMETER_NO                         2
+#define MC_Camera_TM_9701                         96
+#define MC_Cable_A15_C19                          24
+#define MC_CableName_Single_Channel_R_D           24
+#define MC_Camera_KP_F2B                          97
+#define MC_Camera_DT4100                          98
+#define MC_CamConfig_P10SC                       137
+#define MC_Manufacturer_DUNCANTECH                19
+#define MC_Camera_SKC_141                         99
+#define MC_CamConfig_P15SA                       138
+#define MC_CamConfig_P15SM                       139
+#define MC_CamConfig_P15RA                       140
+#define MC_CamConfig_P15RM                       141
+#define MC_CamConfig_P15SD                       142
+#define MC_CamConfig_P15RD                       143
+#define MC_Camera_XC_7500                        100
+#define MC__VerticalSyncMode_MASTER_V              4
+#define MC__VerticalSyncMode_MASTER_R              5
+#define MC__VerticalSyncMode_MASTER_A              6
+#define MC__VerticalSyncMode_FAIL                  7
+#define MC___VerticalSyncMode_Check              (MCPARAMID)( 1710 << 14)
+#define MC___VerticalSyncMode_Check_PASS           1
+#define MC___VerticalSyncMode_Check_FAIL           2
+#define MC_CamConfig_P60RM_R                     144
+#define MC_Camera_Std_BW_CCIR                    101
+#define MC_Camera_Std_BW_EIA                     102
+#define MC_Camera_Std_RGB_CCIR                   103
+#define MC_Camera_Std_RGB_EIA                    104
+#define MC_Manufacturer_STANDARD_CAMERAS          20
+#define MC_Camera_KP_M32P                        105
+#define MC_Camera_CV_M7CLp                       106
+#define MC__MSP                                  (MCPARAMID)( 1711 << 14)
+#define MC__MSP_100                              (MCPARAMID)( 1712 << 14)
+#define MC_Camera_XC_ST50                        107
+#define MC_ColorStorage                          (MCPARAMID)( 1713 << 14)
+#define MC_ColorStorage_PACKED                     1
+#define MC_Expose_Fld                            (MCPARAMID)( 1714 << 14)
+#define MC__STR_STR_X_HOLD                         7
+#define MC__STR_STR_Y_HOLD                         7
+#define MC__STR_STR_Z_HOLD                         7
+#define MC_Camera_InterlaceFR                    108
+#define MC_Camera_ProgressiveFR                  109
+#define MC_Camera_LongExposeFR                   110
+#define MC_Camera_GrabberExposeAR                111
+#define MC_Camera_CameraExposeAR                 112
+#define MC_CamConfig_IxxSA                       145
+#define MC_CamConfig_IxxSM                       146
+#define MC_CamConfig_PxxSA                       147
+#define MC_CamConfig_PxxSD                       148
+#define MC_CamConfig_PxxSM                       149
+#define MC_CamConfig_IxxSM_L                     150
+#define MC_CamConfig_PxxSM_L                     151
+#define MC_CamConfig_PxxRA                       152
+#define MC_CamConfig_PxxRA_D                     153
+#define MC_CamConfig_PxxRA_M                     154
+#define MC_CamConfig_PxxRD                       155
+#define MC_CamConfig_PxxRM_A                     156
+#define MC_CamConfig_PxxRM_D                     157
+#define MC_CamConfig_PxxRM_1                     158
+#define MC_CamConfig_PxxRM_2                     159
+#define MC_Cable_A15_C00                          25
+#define MC_CableName_My_Cable                     25
+#define MC_VSyncMode                             (MCPARAMID)( 1715 << 14)
+#define MC_VSyncMode_UNKNOWN                       1
+#define MC_VSyncMode_MASTER                        2
+#define MC_VSyncMode_ANALOG                        3
+#define MC_VSyncMode_DIGITAL                       4
+#define MC___Individual_Check                    (MCPARAMID)( 1716 << 14)
+#define MC___Individual_Check_PASS                 1
+#define MC___Individual_Check_FAIL                 2
+#define MC_Camera_1600m                          113
+#define MC_CamConfig_P33SC                       160
+#define MC_CamConfig_P33RG                       161
+#define MC__DRS_PPOL                             (MCPARAMID)( 1717 << 14)
+#define MC__DRS_PPOL_DIRECT                        1
+#define MC__DRS_PPOL_INVERT                        2
+#define MC_ColorStorage_PLANAR                     2
+#define MC_ImagePlaneCount                       (MCPARAMID)( 1718 << 14)
+#define MC_FifoOrdering                          (MCPARAMID)( 1719 << 14)
+#define MC_FifoOrdering_PROGRESSIVE                1
+#define MC_FifoOrdering_INTERLACEDFIELD            2
+#define MC_FifoOrdering_DUALYEND                   3
+#define MC__DRS_PSRC                             (MCPARAMID)( 1720 << 14)
+#define MC__DRS_PSRC_SPARE                         1
+#define MC__DRS_PSRC_LVAL                          2
+#define MC__DRS_PSRC_DVAL                          3
+#define MC__DRS_PPOL_NONE                          3
+#define MC_ParityDetection                       (MCPARAMID)( 1721 << 14)
+#define MC_ParityDetection_NONE                    1
+#define MC_ParityDetection_FI_SPARE                2
+#define MC_ParityDetection_FI_SPARE_INV            3
+#define MC_ParityDetection_FIXEDFRAME              4
+#define MC_ParityDetection_FIXEDFRAME_INV          5
+#define MC__DRS_PSRC_NONE                          4
+#define MC_ParityDetection_FI_LVAL                 6
+#define MC_ParityDetection_FI_LVAL_INV             7
+#define MC_ParityDetection_FI_DVAL                 8
+#define MC_ParityDetection_FI_DVAL_INV             9
+#define MC__Category_Cluster                      24
+#define MC_GrabField_Filter                      (MCPARAMID)( 1722 << 14)
+#define MC__SSC_HR70                               6
+#define MC_Camera_XC_HR70                        114
+#define MC_CamConfig_P30RM_2                     162
+#define MC_CamConfig_P30RA_D                     163
+#define MC_PixelBurst                            (MCPARAMID)( 1723 << 14)
+#define MC_FifoSizeX                             (MCPARAMID)( 1724 << 14)
+#define MC_FifoSizeY                             (MCPARAMID)( 1725 << 14)
+#define MC_ImageSizingX                          (MCPARAMID)( 1726 << 14)
+#define MC_ImageSizingX_FIXED                      1
+#define MC_ImageSizingY                          (MCPARAMID)( 1727 << 14)
+#define MC_ImageSizingY_FIXED                      1
+#define MC_ImageSizingY_VARIABLE                   2
+#define MC_CamConfig_P60RA_D                     164
+#define MC_CamConfig_P60RM_D                     165
+#define MC_CamConfig_P120RM_D                    166
+#define MC_CamConfig_P106RM_D                    167
+#define MC_CableName_Single_Channel_RG            26
+#define MC__CWI_CWI                              (MCPARAMID)( 1728 << 14)
+#define MC_CamConfig_P106SM                      168
+#define MC__BoardType__ALPHA_cPCI                  7
+#define MC__BoardType__ALPHA_EV                    8
+#define MC__AssyType                             (MCPARAMID)( 1729 << 14)
+#define MC__AssyType__ALPHA                        1
+#define MC__AssyType__GAMMA                        2
+#define MC_GrabberConfig_0_0_1_1                   8
+#define MC_GrabberConfig_0_1_1_0                   9
+#define MC_GrabberConfig_1_0_0_1                  10
+#define MC_GrabberConfig_1_1_0_0                  11
+#define MC_MapTimCon_TXYXY                         9
+#define MC_Connector_CAM0                         11
+#define MC_Connector_CAM1                         12
+#define MC_Connector_CAM2                         13
+#define MC_Connector_CAM3                         14
+#define MC_ConnectLoc_RIGHTMOST                    5
+#define MC_ConnectLoc_MIDDLERIGHT                  6
+#define MC_ConnectLoc_MIDDLELEFT                   7
+#define MC_ConnectLoc_LEFTMOST                     8
+#define MC_TimUnit_DetP                          (MCPARAMID)( 1730 << 14)
+#define MC_TimUnit_DetP_NONE                       1
+#define MC_TimUnit_DetP_NEEDED                     2
+#define MC_TimUnit_PLL                           (MCPARAMID)( 1731 << 14)
+#define MC_TimUnit_PLL_NONE                        1
+#define MC_TimUnit_PLL_NEEDED                      2
+#define MC_TimUnit_DetV                          (MCPARAMID)( 1732 << 14)
+#define MC_TimUnit_DetV_NONE                       1
+#define MC_TimUnit_DetV_NEEDED                     2
+#define MC_Camera_TM_6710CL                      115
+#define MC_CamConfig_P120SC                      169
+#define MC_CamConfig_P120RG                      170
+#define MC_InputConfig                           (MCPARAMID)( 1733 << 14)
+#define MC_InputConfig_SOFT                        1
+#define MC_InputConfig_FREE                        2
+#define MC_InputFunction                         (MCPARAMID)( 1734 << 14)
+#define MC_InputState                            (MCPARAMID)( 1735 << 14)
+#define MC_InputStyle                            (MCPARAMID)( 1736 << 14)
+#define MC_NullSet_Enum_Filter                   (MCPARAMID)( 1737 << 14)
+#define MC_InputStyle_TTL_Only_Filter            (MCPARAMID)( 1738 << 14)
+#define MC_InputStyle_InsulatedIO_Filter         (MCPARAMID)( 1739 << 14)
+#define MC_OutputConfig                          (MCPARAMID)( 1740 << 14)
+#define MC_OutputFunction                        (MCPARAMID)( 1741 << 14)
+#define MC_OutputState                           (MCPARAMID)( 1742 << 14)
+#define MC_OutputState_NONE_Only_Filter          (MCPARAMID)( 1743 << 14)
+#define MC_FullSet_Enum_Filter                   (MCPARAMID)( 1744 << 14)
+#define MC_OutputState_STX                       (MCPARAMID)( 1745 << 14)
+#define MC_OutputState_STX_HOLD                    1
+#define MC_OutputState_STX_LOW                     2
+#define MC_OutputState_STX_HIGH                    3
+#define MC_OutputState_STY                       (MCPARAMID)( 1746 << 14)
+#define MC_OutputState_STY_HOLD                    1
+#define MC_OutputState_STY_LOW                     2
+#define MC_OutputState_STY_HIGH                    3
+#define MC_OutputState_STZ                       (MCPARAMID)( 1747 << 14)
+#define MC_OutputState_STZ_HOLD                    1
+#define MC_OutputState_STZ_LOW                     2
+#define MC_OutputState_STZ_HIGH                    3
+#define MC_OutputStyle                           (MCPARAMID)( 1748 << 14)
+#define MC_OutputStyle_TTL_Only_Filter           (MCPARAMID)( 1749 << 14)
+#define MC_OutputStyle_InsulatedIO_Filter        (MCPARAMID)( 1750 << 14)
+#define MC_OutputState_OUT1                      (MCPARAMID)( 1751 << 14)
+#define MC_OutputState_OUT1_HOLD                   1
+#define MC_OutputState_OUT1_LOW                    2
+#define MC_OutputState_OUT1_HIGH                   3
+#define MC_OutputState_OUT2                      (MCPARAMID)( 1752 << 14)
+#define MC_OutputState_OUT2_HOLD                   1
+#define MC_OutputState_OUT2_LOW                    2
+#define MC_OutputState_OUT2_HIGH                   3
+#define MC_OutputState_OUT3                      (MCPARAMID)( 1753 << 14)
+#define MC_OutputState_OUT3_HOLD                   1
+#define MC_OutputState_OUT3_LOW                    2
+#define MC_OutputState_OUT3_HIGH                   3
+#define MC_OutputState_OUT4                      (MCPARAMID)( 1754 << 14)
+#define MC_OutputState_OUT4_HOLD                   1
+#define MC_OutputState_OUT4_LOW                    2
+#define MC_OutputState_OUT4_HIGH                   3
+#define MC_OutputState_STR_X                     (MCPARAMID)( 1755 << 14)
+#define MC_OutputState_STR_X_HOLD                  1
+#define MC_OutputState_STR_X_LOW                   2
+#define MC_OutputState_STR_X_HIGH                  3
+#define MC_OutputState_InsulatedIO_Filter        (MCPARAMID)( 1756 << 14)
+#define MC_OutputState_A1                        (MCPARAMID)( 1757 << 14)
+#define MC_OutputState_A1_HOLD                     1
+#define MC_OutputState_A1_LOW                      2
+#define MC_OutputState_A1_HIGH                     3
+#define MC_OutputState_A2                        (MCPARAMID)( 1758 << 14)
+#define MC_OutputState_A2_HOLD                     1
+#define MC_OutputState_A2_LOW                      2
+#define MC_OutputState_A2_HIGH                     3
+#define MC_Camera_TM_2016_8CL                    116
+#define MC_CamConfig_P08SC                       171
+#define MC_CamConfig_P08RG                       172
+#define MC_CamConfig_P8SC                        173
+#define MC_CamConfig_P8RG                        174
+#define MC__INITD2_SELV2                         (MCPARAMID)( 1759 << 14)
+#define MC__INITD3_SELV3                         (MCPARAMID)( 1760 << 14)
+#define MC_GrabberConfig_2_00                     12
+#define MC_GrabberConfig_10_10                    13
+#define MC_GrabberConfig_10_01                    14
+#define MC_GrabberConfig_01_10                    15
+#define MC_GrabberConfig_11_00                    16
+#define MC_GrabberConfig_0_11                     17
+#define MC_GrabberConfig_00_11                    18
+#define MC_GrabberConfig_01_01                    19
+#define MC_NextInputState                        (MCPARAMID)( 1761 << 14)
+#define MC_NextInputState_LOW                      1
+#define MC_NextInputState_HIGH                     2
+#define MC_Camera_KP_F120CL                      117
+#define MC_Camera_KP120CL                        118
+#define MC_InputStyle_CMOS_Only_Filter           (MCPARAMID)( 1762 << 14)
+#define MC_InputStyle_CHANNELLINK_Filter         (MCPARAMID)( 1763 << 14)
+#define MC_OutputStyle_OC_Only_Filter            (MCPARAMID)( 1764 << 14)
+#define MC_OutputState_1                         (MCPARAMID)( 1765 << 14)
+#define MC_OutputState_1_HOLD                      1
+#define MC_OutputState_1_LOW                       2
+#define MC_OutputState_1_HIGH                      3
+#define MC_OutputState_2                         (MCPARAMID)( 1766 << 14)
+#define MC_OutputState_2_HOLD                      1
+#define MC_OutputState_2_LOW                       2
+#define MC_OutputState_2_HIGH                      3
+#define MC_OutputState_3                         (MCPARAMID)( 1767 << 14)
+#define MC_OutputState_3_HOLD                      1
+#define MC_OutputState_3_LOW                       2
+#define MC_OutputState_3_HIGH                      3
+#define MC_OutputState_4                         (MCPARAMID)( 1768 << 14)
+#define MC_OutputState_4_HOLD                      1
+#define MC_OutputState_4_LOW                       2
+#define MC_OutputState_4_HIGH                      3
+#define MC_OutputState_5                         (MCPARAMID)( 1769 << 14)
+#define MC_OutputState_5_HOLD                      1
+#define MC_OutputState_5_LOW                       2
+#define MC_OutputState_5_HIGH                      3
+#define MC_OutputState_6                         (MCPARAMID)( 1770 << 14)
+#define MC_OutputState_6_HOLD                      1
+#define MC_OutputState_6_LOW                       2
+#define MC_OutputState_6_HIGH                      3
+#define MC_OutputState_7                         (MCPARAMID)( 1771 << 14)
+#define MC_OutputState_7_HOLD                      1
+#define MC_OutputState_7_LOW                       2
+#define MC_OutputState_7_HIGH                      3
+#define MC_OutputState_8                         (MCPARAMID)( 1772 << 14)
+#define MC_OutputState_8_HOLD                      1
+#define MC_OutputState_8_LOW                       2
+#define MC_OutputState_8_HIGH                      3
+#define MC_OutputState_9                         (MCPARAMID)( 1773 << 14)
+#define MC_OutputState_9_HOLD                      1
+#define MC_OutputState_9_LOW                       2
+#define MC_OutputState_9_HIGH                      3
+#define MC_OutputState_10                        (MCPARAMID)( 1774 << 14)
+#define MC_OutputState_10_HOLD                     1
+#define MC_OutputState_10_LOW                      2
+#define MC_OutputState_10_HIGH                     3
+#define MC_OutputState_11                        (MCPARAMID)( 1775 << 14)
+#define MC_OutputState_11_HOLD                     1
+#define MC_OutputState_11_LOW                      2
+#define MC_OutputState_11_HIGH                     3
+#define MC_OutputState_12                        (MCPARAMID)( 1776 << 14)
+#define MC_OutputState_12_HOLD                     1
+#define MC_OutputState_12_LOW                      2
+#define MC_OutputState_12_HIGH                     3
+#define MC_OutputState_13                        (MCPARAMID)( 1777 << 14)
+#define MC_OutputState_13_HOLD                     1
+#define MC_OutputState_13_LOW                      2
+#define MC_OutputState_13_HIGH                     3
+#define MC_OutputState_14                        (MCPARAMID)( 1778 << 14)
+#define MC_OutputState_14_HOLD                     1
+#define MC_OutputState_14_LOW                      2
+#define MC_OutputState_14_HIGH                     3
+#define MC_OutputState_15                        (MCPARAMID)( 1779 << 14)
+#define MC_OutputState_15_HOLD                     1
+#define MC_OutputState_15_LOW                      2
+#define MC_OutputState_15_HIGH                     3
+#define MC_OutputState_16                        (MCPARAMID)( 1780 << 14)
+#define MC_OutputState_16_HOLD                     1
+#define MC_OutputState_16_LOW                      2
+#define MC_OutputState_16_HIGH                     3
+#define MC_OutputState_17                        (MCPARAMID)( 1781 << 14)
+#define MC_OutputState_17_HOLD                     1
+#define MC_OutputState_17_LOW                      2
+#define MC_OutputState_17_HIGH                     3
+#define MC_OutputState_18                        (MCPARAMID)( 1782 << 14)
+#define MC_OutputState_18_HOLD                     1
+#define MC_OutputState_18_LOW                      2
+#define MC_OutputState_18_HIGH                     3
+#define MC_OutputState_19                        (MCPARAMID)( 1783 << 14)
+#define MC_OutputState_19_HOLD                     1
+#define MC_OutputState_19_LOW                      2
+#define MC_OutputState_19_HIGH                     3
+#define MC_OutputState_28                        (MCPARAMID)( 1784 << 14)
+#define MC_OutputState_28_HOLD                     1
+#define MC_OutputState_28_LOW                      2
+#define MC_OutputState_28_HIGH                     3
+#define MC_OutputState_29                        (MCPARAMID)( 1785 << 14)
+#define MC_OutputState_29_HOLD                     1
+#define MC_OutputState_29_LOW                      2
+#define MC_OutputState_29_HIGH                     3
+#define MC_OutputState_38                        (MCPARAMID)( 1786 << 14)
+#define MC_OutputState_38_HOLD                     1
+#define MC_OutputState_38_LOW                      2
+#define MC_OutputState_38_HIGH                     3
+#define MC_OutputState_39                        (MCPARAMID)( 1787 << 14)
+#define MC_OutputState_39_HOLD                     1
+#define MC_OutputState_39_LOW                      2
+#define MC_OutputState_39_HIGH                     3
+#define MC_Camera_PAL                            119
+#define MC_Camera_NTSC                           120
+#define MC_TapStructure_SINGLE_C                  18
+#define MC_TapStructure_SINGLE_S                  19
+#define MC_DataLink_COMPOSITE                      3
+#define MC_Standard_PAL                            3
+#define MC_Standard_NTSC                           4
+#define MC_Standard_SECAM                          5
+#define MC_Hsquare_Px                            (MCPARAMID)( 1788 << 14)
+#define MC_TrigMode_PAUSE                          9
+#define MC_NextTrigMode_IMMEDIATE                  6
+#define MC_NextTrigMode_PAUSE                      7
+#define MC_NextTrigMode_TIMER                      8
+#define MC_Delay_ms                              (MCPARAMID)( 1789 << 14)
+#define MC_NextDelay_ms                          (MCPARAMID)( 1790 << 14)
+#define MC_TrigEdge_HIGH                           3
+#define MC_TrigEdge_LOW                            4
+#define MC_TrigLine_IO                            11
+#define MC_TrigIO                                (MCPARAMID)( 1791 << 14)
+#define MC_StrobeLine_IO                           7
+#define MC_StrobeIO                              (MCPARAMID)( 1792 << 14)
+#define MC_Connector_VID1_COMP                    15
+#define MC_Connector_VID2_COMP                    16
+#define MC_Connector_VID3_COMP                    17
+#define MC_Connector_VID4_COMP                    18
+#define MC_PixelFormat                           (MCPARAMID)( 1793 << 14)
+#define MC_PixelFormat_RGB32                       1
+#define MC_PixelFormat_RGB24                       2
+#define MC_PixelFormat_RGB16                       3
+#define MC_PixelFormat_RGB15                       4
+#define MC_PixelFormat_YUV2                        5
+#define MC_PixelFormat_Y8                          6
+#define MC_PixelFormat_TGB8                        7
+#define MC_PixelFormat_RAW8                        8
+#define MC_OutputState__xx_                      (MCPARAMID)( 1794 << 14)
+#define MC_OutputState__xx__HOLD                   1
+#define MC_OutputState__xx__LOW                    2
+#define MC_OutputState__xx__HIGH                   3
+#define MC_InputStyle_InsulatedIO_Only_Filter    (MCPARAMID)( 1795 << 14)
+#define MC_InputPinName                          (MCPARAMID)( 1796 << 14)
+#define MC_InputPinName_UNKNOWN                    1
+#define MC_InputPinName_IN1                        2
+#define MC_InputPinName_IN2                        3
+#define MC_InputPinName_IN3                        4
+#define MC_InputPinName_IN4                        5
+#define MC_InputPinName_TRX                        6
+#define MC_InputPinName_TRY                        7
+#define MC_InputPinName_TRZ                        8
+#define MC_InputPinName_CK                         9
+#define MC_InputPinName_RST                       10
+#define MC_InputPinName_HIO                       11
+#define MC_InputPinName_GATE                      12
+#define MC_InputPinName_VIO                       13
+#define MC_InputPinName_EXP                       14
+#define MC_InputConnectorName                    (MCPARAMID)( 1797 << 14)
+#define MC_InputConnectorName_UNKNOWN              1
+#define MC_InputConnectorName_TR_ST                2
+#define MC_InputConnectorName_CAMX                 3
+#define MC_InputConnectorName_CAMY                 4
+#define MC_InputConnectorName_CAMZ                 5
+#define MC_InputConnectorName_PIO                  6
+#define MC_OutputPinName                         (MCPARAMID)( 1798 << 14)
+#define MC_OutputPinName_UNKNOWN                   1
+#define MC_OutputPinName_OUT1                      2
+#define MC_OutputPinName_OUT2                      3
+#define MC_OutputPinName_OUT3                      4
+#define MC_OutputPinName_OUT4                      5
+#define MC_OutputPinName_STX                       6
+#define MC_OutputPinName_STY                       7
+#define MC_OutputPinName_STZ                       8
+#define MC_OutputConnectorName                   (MCPARAMID)( 1799 << 14)
+#define MC_OutputConnectorName_UNKNOWN             1
+#define MC_OutputConnectorName_TR_ST               2
+#define MC_OutputConnectorName_CAMX                3
+#define MC_OutputConnectorName_CAMY                4
+#define MC_OutputConnectorName_CAMZ                5
+#define MC_OutputConnectorName_PIO                 6
+#define MC_InputPinName_IO1                       15
+#define MC_InputPinName_IO2                       16
+#define MC_InputPinName_IO3                       17
+#define MC_InputPinName_IO4                       18
+#define MC_InputPinName_IO5                       19
+#define MC_InputPinName_IO6                       20
+#define MC_InputPinName_IO7                       21
+#define MC_InputPinName_IO8                       22
+#define MC_InputPinName_IO9                       23
+#define MC_InputPinName_IO10                      24
+#define MC_InputPinName_IO11                      25
+#define MC_InputPinName_IO12                      26
+#define MC_InputPinName_IO13                      27
+#define MC_InputPinName_IO14                      28
+#define MC_InputPinName_IO15                      29
+#define MC_InputPinName_IO16                      30
+#define MC_InputPinName_TRG                       31
+#define MC_InputPinName_A1                        32
+#define MC_InputPinName_B1                        33
+#define MC_InputPinName_A2                        34
+#define MC_InputPinName_B2                        35
+#define MC_InputPinName_FVAL                      36
+#define MC_InputPinName_LVAL                      37
+#define MC_InputPinName_DVAL                      38
+#define MC_InputPinName_SPARE                     39
+#define MC_InputConnectorName_SYSTEM               7
+#define MC_InputConnectorName_IO                   8
+#define MC_InputConnectorName_CAMERA               9
+#define MC_InputConnectorName_CAMERA_A            10
+#define MC_InputConnectorName_CAMERA_B            11
+#define MC_OutputPinName_OUT5                      9
+#define MC_OutputPinName_OUT6                     10
+#define MC_OutputPinName_OUT7                     11
+#define MC_OutputPinName_OUT8                     12
+#define MC_OutputPinName_OUT9                     13
+#define MC_OutputPinName_OUT10                    14
+#define MC_OutputPinName_OUT11                    15
+#define MC_OutputPinName_OUT12                    16
+#define MC_OutputPinName_OUT13                    17
+#define MC_OutputPinName_OUT14                    18
+#define MC_OutputPinName_OUT15                    19
+#define MC_OutputPinName_OUT16                    20
+#define MC_OutputPinName_STR                      21
+#define MC_OutputPinName_A1                       22
+#define MC_OutputPinName_B1                       23
+#define MC_OutputPinName_A2                       24
+#define MC_OutputPinName_B2                       25
+#define MC_OutputPinName_CC1                      26
+#define MC_OutputPinName_CC2                      27
+#define MC_OutputPinName_CC3                      28
+#define MC_OutputPinName_CC4                      29
+#define MC_OutputConnectorName_SYSTEM              7
+#define MC_OutputConnectorName_IO                  8
+#define MC_OutputConnectorName_CAMERA              9
+#define MC_OutputConnectorName_CAMERA_A           10
+#define MC_OutputConnectorName_CAMERA_B           11
+#define MC_OutputPinName_IO1                      30
+#define MC_OutputPinName_IO2                      31
+#define MC_OutputPinName_IO3                      32
+#define MC_OutputPinName_IO4                      33
+#define MC_OutputPinName_IO5                      34
+#define MC_OutputPinName_IO6                      35
+#define MC_OutputPinName_IO7                      36
+#define MC_OutputPinName_IO8                      37
+#define MC_OutputPinName_IO9                      38
+#define MC_OutputPinName_IO10                     39
+#define MC_OutputPinName_IO11                     40
+#define MC_OutputPinName_IO12                     41
+#define MC_OutputPinName_IO13                     42
+#define MC_OutputPinName_IO14                     43
+#define MC_OutputPinName_IO15                     44
+#define MC_OutputPinName_IO16                     45
+#define MC___CAMLoopBack                         (MCPARAMID)( 1800 << 14)
+#define MC___CAMLoopBack_DISABLE                   1
+#define MC___CAMLoopBack_ENABLE                    2
+#define MC_GrabberConfig_00_2                     20
+#define MC_GrabberConfig_10_00                    21
+#define MC_GrabberConfig_01_00                    22
+#define MC_GrabberConfig_00_10                    23
+#define MC_GrabberConfig_00_01                    24
+#define MC_GrabberConfig_00_00                    25
+#define MC_MapTimDig_TYX                           9
+#define MC_MapTimDig_TYY                          10
+#define MC__BitMask                              (MCPARAMID)( 1801 << 14)
+#define MC_ConnectLoc_SECOND                       9
+#define MC_ConnectLoc_THIRD                       10
+#define MC_ConnectLoc_FOURTH                      11
+#define MC_Camera_CSB4000CL                      121
+#define MC_Cable_S15_C00                          27
+#define MC_Cable_S15_C01                          28
+#define MC_Cable_S15_C02                          29
+#define MC_CamConfig_P8RC                        175
+#define MC_STOPASMode                            (MCPARAMID)( 1802 << 14)
+#define MC_STOPASMode_AUTO                         1
+#define MC_STOPASMode_MANUAL                       2
+#define MC_OutputPinName_RED                      46
+#define MC_OutputPinName_GREEN                    47
+#define MC_OutputConnectorName_LEDX               12
+#define MC_OutputConnectorName_LEDY               13
+#define MC_OutputConnectorName_LEDZ               14
+#define MC_OutputState_51                        (MCPARAMID)( 1803 << 14)
+#define MC_OutputState_51_HOLD                     1
+#define MC_OutputState_51_LOW                      2
+#define MC_OutputState_51_HIGH                     3
+#define MC_OutputStyle_LED_Filter                (MCPARAMID)( 1804 << 14)
+#define MC_OutputState_52                        (MCPARAMID)( 1805 << 14)
+#define MC_OutputState_52_HOLD                     1
+#define MC_OutputState_52_LOW                      2
+#define MC_OutputState_52_HIGH                     3
+#define MC_OutputState_53                        (MCPARAMID)( 1806 << 14)
+#define MC_OutputState_53_HOLD                     1
+#define MC_OutputState_53_LOW                      2
+#define MC_OutputState_53_HIGH                     3
+#define MC_OutputState_54                        (MCPARAMID)( 1807 << 14)
+#define MC_OutputState_54_HOLD                     1
+#define MC_OutputState_54_LOW                      2
+#define MC_OutputState_54_HIGH                     3
+#define MC_OutputState_55                        (MCPARAMID)( 1808 << 14)
+#define MC_OutputState_55_HOLD                     1
+#define MC_OutputState_55_LOW                      2
+#define MC_OutputState_55_HIGH                     3
+#define MC_OutputState_56                        (MCPARAMID)( 1809 << 14)
+#define MC_OutputState_56_HOLD                     1
+#define MC_OutputState_56_LOW                      2
+#define MC_OutputState_56_HIGH                     3
+#define MC_OutputConnectorName_LED                15
+#define MC_OutputConnectorName_LEDA               16
+#define MC_OutputConnectorName_LEDB               17
+#define MC_BoardTopology_1_11                     21
+#define MC_ConfigGrabber                         (MCPARAMID)( 1810 << 14)
+#define MC_ConfigGrabber_pX                        1
+#define MC_ConfigGrabber_pXBIS                     2
+#define MC_ConfigGrabber_pY                        3
+#define MC_ConfigGrabber_pYBIS                     4
+#define MC_ConfigGrabber_pZ                        5
+#define MC_ConfigGrabber_pZBIS                     6
+#define MC_ConfigGrabber_mX                        7
+#define MC_ConfigGrabber_mXBIS                     8
+#define MC_ConfigGrabber_mY                        9
+#define MC_ConfigGrabber_mYBIS                    10
+#define MC_ConfigGrabber_mZ                       11
+#define MC_ConfigGrabber_mZBIS                    12
+#define MC_ConfigGrabber_PASS                     13
+#define MC_ConfigGrabber_FAIL                     14
+#define MC_NextGrabberConfig                     (MCPARAMID)( 1811 << 14)
+#define MC_NextGrabberConfig_FAIL                  1
+#define MC_NextGrabberConfig_00_00                 2
+#define MC_NextGrabberConfig_2_00                  3
+#define MC_NextGrabberConfig_00_2                  4
+#define MC_NextGrabberConfig_10_00                 5
+#define MC_NextGrabberConfig_01_00                 6
+#define MC_NextGrabberConfig_00_10                 7
+#define MC_NextGrabberConfig_00_01                 8
+#define MC_NextGrabberConfig_10_10                 9
+#define MC_NextGrabberConfig_01_10                10
+#define MC_NextGrabberConfig_10_01                11
+#define MC_NextGrabberConfig_01_01                12
+#define MC_NextGrabberConfig_2_0                  13
+#define MC_NextGrabberConfig_0_2                  14
+#define MC_NextGrabberConfig_1_1                  15
+#define MC_ConfigGrabber_Filter                  (MCPARAMID)( 1812 << 14)
+#define MC_BoardTopology_Filter                  (MCPARAMID)( 1813 << 14)
+#define MC_InputConfig_Filter                    (MCPARAMID)( 1814 << 14)
+#define MC_ConnectorName                         (MCPARAMID)( 1815 << 14)
+#define MC_ConnectorName_UNKNOWN                   1
+#define MC_ConnectorName_SYSTEM                    2
+#define MC_ConnectorName_IO                        3
+#define MC_ConnectorName_CAMERA                    4
+#define MC_ConnectorName_CAMERA_A                  5
+#define MC_ConnectorName_CAMERA_B                  6
+#define MC_ConnectorName_LED                       7
+#define MC_ConnectorName_LEDA                      8
+#define MC_ConnectorName_LEDB                      9
+#define MC_OutputConfig_Filter                   (MCPARAMID)( 1816 << 14)
+#define MC_InputConfig_Filter_17                 (MCPARAMID)( 1817 << 14)
+#define MC_InputConfig_Filter_21                 (MCPARAMID)( 1818 << 14)
+#define MC_InputConfig_Filter_22                 (MCPARAMID)( 1819 << 14)
+#define MC_InputConfig_Filter_23                 (MCPARAMID)( 1820 << 14)
+#define MC_InputConfig_Filter_24                 (MCPARAMID)( 1821 << 14)
+#define MC_InputConfig_Filter_27                 (MCPARAMID)( 1822 << 14)
+#define MC_InputConfig_Filter_28                 (MCPARAMID)( 1823 << 14)
+#define MC_InputConfig_Filter_29                 (MCPARAMID)( 1824 << 14)
+#define MC_OutputConfig_Filter_17                (MCPARAMID)( 1825 << 14)
+#define MC_OutputConfig_Filter_28                (MCPARAMID)( 1826 << 14)
+#define MC_OutputConfig_Filter_29                (MCPARAMID)( 1827 << 14)
+#define MC_OutputConfig_Filter_51                (MCPARAMID)( 1828 << 14)
+#define MC_OutputConfig_Filter_52                (MCPARAMID)( 1829 << 14)
+#define MC_InputConfig_Filter_1                  (MCPARAMID)( 1830 << 14)
+#define MC_InputConfig_Filter_2                  (MCPARAMID)( 1831 << 14)
+#define MC_InputConfig_Filter_3                  (MCPARAMID)( 1832 << 14)
+#define MC_InputConfig_Filter_4                  (MCPARAMID)( 1833 << 14)
+#define MC_InputConfig_Filter_5                  (MCPARAMID)( 1834 << 14)
+#define MC_InputConfig_Filter_6                  (MCPARAMID)( 1835 << 14)
+#define MC_InputConfig_Filter_7                  (MCPARAMID)( 1836 << 14)
+#define MC_InputConfig_Filter_8                  (MCPARAMID)( 1837 << 14)
+#define MC_InputConfig_Filter_9                  (MCPARAMID)( 1838 << 14)
+#define MC_InputConfig_Filter_10                 (MCPARAMID)( 1839 << 14)
+#define MC_InputConfig_Filter_11                 (MCPARAMID)( 1840 << 14)
+#define MC_InputConfig_Filter_12                 (MCPARAMID)( 1841 << 14)
+#define MC_InputConfig_Filter_13                 (MCPARAMID)( 1842 << 14)
+#define MC_InputConfig_Filter_14                 (MCPARAMID)( 1843 << 14)
+#define MC_InputConfig_Filter_15                 (MCPARAMID)( 1844 << 14)
+#define MC_InputConfig_Filter_16                 (MCPARAMID)( 1845 << 14)
+#define MC_InputConfig_Filter_18                 (MCPARAMID)( 1846 << 14)
+#define MC_InputConfig_Filter_19                 (MCPARAMID)( 1847 << 14)
+#define MC_InputConfig_Filter_31                 (MCPARAMID)( 1848 << 14)
+#define MC_InputConfig_Filter_32                 (MCPARAMID)( 1849 << 14)
+#define MC_InputConfig_Filter_33                 (MCPARAMID)( 1850 << 14)
+#define MC_InputConfig_Filter_34                 (MCPARAMID)( 1851 << 14)
+#define MC_InputConfig_Filter_37                 (MCPARAMID)( 1852 << 14)
+#define MC_InputConfig_Filter_38                 (MCPARAMID)( 1853 << 14)
+#define MC_InputConfig_Filter_39                 (MCPARAMID)( 1854 << 14)
+#define MC_OutputConfig_Filter_1                 (MCPARAMID)( 1855 << 14)
+#define MC_OutputConfig_Filter_2                 (MCPARAMID)( 1856 << 14)
+#define MC_OutputConfig_Filter_3                 (MCPARAMID)( 1857 << 14)
+#define MC_OutputConfig_Filter_4                 (MCPARAMID)( 1858 << 14)
+#define MC_OutputConfig_Filter_5                 (MCPARAMID)( 1859 << 14)
+#define MC_OutputConfig_Filter_6                 (MCPARAMID)( 1860 << 14)
+#define MC_OutputConfig_Filter_7                 (MCPARAMID)( 1861 << 14)
+#define MC_OutputConfig_Filter_8                 (MCPARAMID)( 1862 << 14)
+#define MC_OutputConfig_Filter_9                 (MCPARAMID)( 1863 << 14)
+#define MC_OutputConfig_Filter_10                (MCPARAMID)( 1864 << 14)
+#define MC_OutputConfig_Filter_11                (MCPARAMID)( 1865 << 14)
+#define MC_OutputConfig_Filter_12                (MCPARAMID)( 1866 << 14)
+#define MC_OutputConfig_Filter_13                (MCPARAMID)( 1867 << 14)
+#define MC_OutputConfig_Filter_14                (MCPARAMID)( 1868 << 14)
+#define MC_OutputConfig_Filter_15                (MCPARAMID)( 1869 << 14)
+#define MC_OutputConfig_Filter_16                (MCPARAMID)( 1870 << 14)
+#define MC_OutputConfig_Filter_18                (MCPARAMID)( 1871 << 14)
+#define MC_OutputConfig_Filter_19                (MCPARAMID)( 1872 << 14)
+#define MC_OutputConfig_Filter_38                (MCPARAMID)( 1873 << 14)
+#define MC_OutputConfig_Filter_39                (MCPARAMID)( 1874 << 14)
+#define MC_OutputConfig_Filter_53                (MCPARAMID)( 1875 << 14)
+#define MC_OutputConfig_Filter_54                (MCPARAMID)( 1876 << 14)
+#define MC_ConnectorName_TR_ST                    10
+#define MC_ConnectorName_CAMX                     11
+#define MC_ConnectorName_CAMY                     12
+#define MC_ConnectorName_CAMZ                     13
+#define MC_ConnectorName_PIO                      14
+#define MC_ConnectorName_LEDX                     15
+#define MC_ConnectorName_LEDY                     16
+#define MC_ConnectorName_LEDZ                     17
+#define MC_InputConfig_Filter_25                 (MCPARAMID)( 1877 << 14)
+#define MC_InputConfig_Filter_26                 (MCPARAMID)( 1878 << 14)
+#define MC_InputConfig_Filter_35                 (MCPARAMID)( 1879 << 14)
+#define MC_InputConfig_Filter_36                 (MCPARAMID)( 1880 << 14)
+#define MC_InputConfig_Filter_42                 (MCPARAMID)( 1881 << 14)
+#define MC_InputConfig_Filter_43                 (MCPARAMID)( 1882 << 14)
+#define MC_InputConfig_Filter_44                 (MCPARAMID)( 1883 << 14)
+#define MC_InputConfig_Filter_45                 (MCPARAMID)( 1884 << 14)
+#define MC_InputConfig_Filter_46                 (MCPARAMID)( 1885 << 14)
+#define MC_InputConfig_Filter_47                 (MCPARAMID)( 1886 << 14)
+#define MC_OutputConfig_Filter_55                (MCPARAMID)( 1887 << 14)
+#define MC_OutputConfig_Filter_56                (MCPARAMID)( 1888 << 14)
+#define MC_InputFunction_UNKNOWN                   1
+#define MC_InputFunction_SOFT                      2
+#define MC_InputFunction_OUTPUT                    3
+#define MC_InputFunction_TRIG                      4
+#define MC_InputFunction_LINETRIG                  5
+#define MC_InputFunction_HSYNC                     6
+#define MC_InputFunction_VSYNC                     7
+#define MC_InputFunction_CLOCK                     8
+#define MC_InputFunction_NONE                      9
+#define MC_InputFunction_CAMERA                   10
+#define MC_InputState_NONE                         1
+#define MC_InputState_LOW                          2
+#define MC_InputState_HIGH                         3
+#define MC_InputState_WENTLOW                      4
+#define MC_InputState_WENTHIGH                     5
+#define MC_InputStyle_TTL                          1
+#define MC_InputStyle_ITTL                         2
+#define MC_InputStyle_I12V                         3
+#define MC_InputStyle_RS422                        4
+#define MC_InputStyle_LVDS                         5
+#define MC_InputStyle_DIFF                         6
+#define MC_OutputConfig_SOFT                       1
+#define MC_OutputConfig_FREE                       2
+#define MC_OutputFunction_UNKNOWN                  1
+#define MC_OutputFunction_SOFT                     2
+#define MC_OutputFunction_INPUT                    3
+#define MC_OutputFunction_WATCHDOG                 4
+#define MC_OutputFunction_ALARM                    5
+#define MC_OutputFunction_SYSTEM                   6
+#define MC_OutputFunction_TIED                     7
+#define MC_OutputFunction_STROBE                   8
+#define MC_OutputFunction_RESET                    9
+#define MC_OutputFunction_AUXRESET                10
+#define MC_OutputFunction_HDRIVE                  11
+#define MC_OutputFunction_VDRIVE                  12
+#define MC_OutputFunction_CLOCK                   13
+#define MC_OutputFunction_NONE                    14
+#define MC_OutputState_NONE                        4
+#define MC_OutputState_LOW                         5
+#define MC_OutputState_HIGH                        6
+#define MC_OutputState_TOGGLE                      7
+#define MC_OutputStyle_TTL                         1
+#define MC_OutputStyle_ITTL                        2
+#define MC_OutputStyle_IOC                         3
+#define MC_OutputStyle_IOE                         4
+#define MC_OutputStyle_RELAY                       5
+#define MC_OutputStyle_LED                         6
+#define MC_InputFunction_FVAL                     11
+#define MC_InputFunction_LVAL                     12
+#define MC_InputFunction_DVAL                     13
+#define MC_InputFunction_SPARE                    14
+#define MC_InputStyle_CHANNELLINK                  7
+#define MC_InputStyle_CMOS                         8
+#define MC_OutputStyle_OC                          7
+#define MC_InputStyle_Filter17                   (MCPARAMID)( 1889 << 14)
+#define MC_InputStyle_Filter_17                  (MCPARAMID)( 1890 << 14)
+#define MC_InputStyle_Filter18                   (MCPARAMID)( 1891 << 14)
+#define MC_InputStyle_Filter_18                  (MCPARAMID)( 1892 << 14)
+#define MC_InputStyle_Filter19                   (MCPARAMID)( 1893 << 14)
+#define MC_InputStyle_Filter_19                  (MCPARAMID)( 1894 << 14)
+#define MC_OutputStyle_Filter17                  (MCPARAMID)( 1895 << 14)
+#define MC_OutputStyle_Filter_17                 (MCPARAMID)( 1896 << 14)
+#define MC_OutputStyle_Filter18                  (MCPARAMID)( 1897 << 14)
+#define MC_OutputStyle_Filter_18                 (MCPARAMID)( 1898 << 14)
+#define MC_OutputStyle_Filter19                  (MCPARAMID)( 1899 << 14)
+#define MC_OutputStyle_Filter_19                 (MCPARAMID)( 1900 << 14)
+#define MC_InputStyle_Filter_1                   (MCPARAMID)( 1901 << 14)
+#define MC_InputStyle_Filter_2                   (MCPARAMID)( 1902 << 14)
+#define MC_InputStyle_Filter_3                   (MCPARAMID)( 1903 << 14)
+#define MC_InputStyle_Filter_4                   (MCPARAMID)( 1904 << 14)
+#define MC_OutputStyle_Filter_1                  (MCPARAMID)( 1905 << 14)
+#define MC_OutputStyle_Filter_2                  (MCPARAMID)( 1906 << 14)
+#define MC_OutputStyle_Filter_3                  (MCPARAMID)( 1907 << 14)
+#define MC_OutputStyle_Filter_4                  (MCPARAMID)( 1908 << 14)
+#define MC_InputStyle_Filter_28                  (MCPARAMID)( 1909 << 14)
+#define MC_InputStyle_Filter_29                  (MCPARAMID)( 1910 << 14)
+#define MC_OutputStyle_Filter_28                 (MCPARAMID)( 1911 << 14)
+#define MC_OutputStyle_Filter_29                 (MCPARAMID)( 1912 << 14)
+#define MC_InputStyle_Filter_5                   (MCPARAMID)( 1913 << 14)
+#define MC_InputStyle_Filter_6                   (MCPARAMID)( 1914 << 14)
+#define MC_InputStyle_Filter_7                   (MCPARAMID)( 1915 << 14)
+#define MC_InputStyle_Filter_8                   (MCPARAMID)( 1916 << 14)
+#define MC_InputStyle_Filter_9                   (MCPARAMID)( 1917 << 14)
+#define MC_InputStyle_Filter_10                  (MCPARAMID)( 1918 << 14)
+#define MC_InputStyle_Filter_11                  (MCPARAMID)( 1919 << 14)
+#define MC_InputStyle_Filter_12                  (MCPARAMID)( 1920 << 14)
+#define MC_InputStyle_Filter_13                  (MCPARAMID)( 1921 << 14)
+#define MC_InputStyle_Filter_14                  (MCPARAMID)( 1922 << 14)
+#define MC_InputStyle_Filter_15                  (MCPARAMID)( 1923 << 14)
+#define MC_InputStyle_Filter_16                  (MCPARAMID)( 1924 << 14)
+#define MC_InputStyle_Filter_38                  (MCPARAMID)( 1925 << 14)
+#define MC_InputStyle_Filter_39                  (MCPARAMID)( 1926 << 14)
+#define MC_OutputStyle_Filter_5                  (MCPARAMID)( 1927 << 14)
+#define MC_OutputStyle_Filter_6                  (MCPARAMID)( 1928 << 14)
+#define MC_OutputStyle_Filter_7                  (MCPARAMID)( 1929 << 14)
+#define MC_OutputStyle_Filter_8                  (MCPARAMID)( 1930 << 14)
+#define MC_OutputStyle_Filter_9                  (MCPARAMID)( 1931 << 14)
+#define MC_OutputStyle_Filter_10                 (MCPARAMID)( 1932 << 14)
+#define MC_OutputStyle_Filter_11                 (MCPARAMID)( 1933 << 14)
+#define MC_OutputStyle_Filter_12                 (MCPARAMID)( 1934 << 14)
+#define MC_OutputStyle_Filter_13                 (MCPARAMID)( 1935 << 14)
+#define MC_OutputStyle_Filter_14                 (MCPARAMID)( 1936 << 14)
+#define MC_OutputStyle_Filter_15                 (MCPARAMID)( 1937 << 14)
+#define MC_OutputStyle_Filter_16                 (MCPARAMID)( 1938 << 14)
+#define MC_OutputStyle_Filter_38                 (MCPARAMID)( 1939 << 14)
+#define MC_OutputStyle_Filter_39                 (MCPARAMID)( 1940 << 14)
+#define MC_TimUnitN_USEDXBIS                       7
+#define MC_TimUnitN_USEDYBIS                       8
+#define MC_GrabberConfig_1_1_0                    26
+#define MC_GrabberConfig_1_0_1                    27
+#define MC_GrabberConfig_0_1_1                    28
+#define MC_GrabberConfig_1_0_0                    29
+#define MC_GrabberConfig_0_1_0                    30
+#define MC_GrabberConfig_0_0_1                    31
+#define MC_GrabberConfig_2_0_2                    32
+#define MC_GrabberConfig_0_2_2                    33
+#define MC_GrabberConfig_2_0_0                    34
+#define MC_GrabberConfig_0_2_0                    35
+#define MC_GrabberConfig_0_0_2                    36
+#define MC_GrabberConfig_3_0_0                    37
+#define MC_GrabberConfig_0_3_0                    38
+#define MC_GrabberConfig_1_0_2                    39
+#define MC_GrabberConfig_0_1_2                    40
+#define MC_GrabberConfig_2_0_1                    41
+#define MC_GrabberConfig_0_2_1                    42
+#define MC_GrabberConfig_1_3_0                    43
+#define MC_NextGrabberConfig_00_00_00             16
+#define MC_NextGrabberConfig_1_1_1                17
+#define MC_NextGrabberConfig_1_1_2                18
+#define MC_NextGrabberConfig_2_2_0                19
+#define MC_NextGrabberConfig_0_3_1                20
+#define MC_OutputState_Filter_17                 (MCPARAMID)( 1941 << 14)
+#define MC_OutputState_Filter_18                 (MCPARAMID)( 1942 << 14)
+#define MC_OutputState_Filter_19                 (MCPARAMID)( 1943 << 14)
+#define MC_OutputState_Filter_51                 (MCPARAMID)( 1944 << 14)
+#define MC_OutputState_Filter_52                 (MCPARAMID)( 1945 << 14)
+#define MC_OutputState_Filter_53                 (MCPARAMID)( 1946 << 14)
+#define MC_OutputState_Filter_54                 (MCPARAMID)( 1947 << 14)
+#define MC_OutputState_Filter_28                 (MCPARAMID)( 1948 << 14)
+#define MC_OutputState_Filter_29                 (MCPARAMID)( 1949 << 14)
+#define MC_OutputState_Filter_1                  (MCPARAMID)( 1950 << 14)
+#define MC_OutputState_Filter_2                  (MCPARAMID)( 1951 << 14)
+#define MC_OutputState_Filter_3                  (MCPARAMID)( 1952 << 14)
+#define MC_OutputState_Filter_4                  (MCPARAMID)( 1953 << 14)
+#define MC_OutputState_Filter_5                  (MCPARAMID)( 1954 << 14)
+#define MC_OutputState_Filter_6                  (MCPARAMID)( 1955 << 14)
+#define MC_OutputState_Filter_7                  (MCPARAMID)( 1956 << 14)
+#define MC_OutputState_Filter_8                  (MCPARAMID)( 1957 << 14)
+#define MC_OutputState_Filter_9                  (MCPARAMID)( 1958 << 14)
+#define MC_OutputState_Filter_10                 (MCPARAMID)( 1959 << 14)
+#define MC_OutputState_Filter_11                 (MCPARAMID)( 1960 << 14)
+#define MC_OutputState_Filter_12                 (MCPARAMID)( 1961 << 14)
+#define MC_OutputState_Filter_13                 (MCPARAMID)( 1962 << 14)
+#define MC_OutputState_Filter_14                 (MCPARAMID)( 1963 << 14)
+#define MC_OutputState_Filter_15                 (MCPARAMID)( 1964 << 14)
+#define MC_OutputState_Filter_16                 (MCPARAMID)( 1965 << 14)
+#define MC_OutputState_Filter_38                 (MCPARAMID)( 1966 << 14)
+#define MC_OutputState_Filter_39                 (MCPARAMID)( 1967 << 14)
+#define MC_NextGrabberConfig_1_1_0                21
+#define MC_NextGrabberConfig_1_0_1                22
+#define MC_NextGrabberConfig_0_1_1                23
+#define MC_NextGrabberConfig_1_0_0                24
+#define MC_NextGrabberConfig_0_1_0                25
+#define MC_NextGrabberConfig_0_0_1                26
+#define MC_NextGrabberConfig_2_0_2                27
+#define MC_NextGrabberConfig_0_2_2                28
+#define MC_NextGrabberConfig_2_0_0                29
+#define MC_NextGrabberConfig_0_2_0                30
+#define MC_NextGrabberConfig_0_0_2                31
+#define MC_NextGrabberConfig_3_0_0                32
+#define MC_NextGrabberConfig_0_3_0                33
+#define MC_NextGrabberConfig_1_0_2                34
+#define MC_NextGrabberConfig_0_1_2                35
+#define MC_NextGrabberConfig_2_0_1                36
+#define MC_NextGrabberConfig_0_2_1                37
+#define MC_NextGrabberConfig_1_3_0                38
+#define MC_GrabberConfig_00_00_00                 44
+#define MC_OutputState_Filter_55                 (MCPARAMID)( 1968 << 14)
+#define MC_OutputState_Filter_56                 (MCPARAMID)( 1969 << 14)
+#define MC_BoardTopology_2_0                      22
+#define MC_GrabberConfig_11_10_00                 45
+#define MC_GrabberConfig_11_01_00                 46
+#define MC_GrabberConfig_11_00_10                 47
+#define MC_GrabberConfig_11_00_01                 48
+#define MC_GrabberConfig_10_11_00                 49
+#define MC_GrabberConfig_10_10_10                 50
+#define MC_GrabberConfig_10_10_01                 51
+#define MC_GrabberConfig_10_01_10                 52
+#define MC_GrabberConfig_10_O1_01                 53
+#define MC_GrabberConfig_10_00_11                 54
+#define MC_GrabberConfig_01_11_00                 55
+#define MC_GrabberConfig_01_10_10                 56
+#define MC_GrabberConfig_01_10_01                 57
+#define MC_GrabberConfig_01_01_10                 58
+#define MC_GrabberConfig_01_01_01                 59
+#define MC_GrabberConfig_01_00_11                 60
+#define MC_GrabberConfig_00_11_10                 61
+#define MC_GrabberConfig_00_11_01                 62
+#define MC_GrabberConfig_00_10_11                 63
+#define MC_GrabberConfig_00_01_11                 64
+#define MC_GrabberConfig_11_00_00                 65
+#define MC_GrabberConfig_10_10_00                 66
+#define MC_GrabberConfig_10_01_00                 67
+#define MC_GrabberConfig_10_00_10                 68
+#define MC_GrabberConfig_10_00_01                 69
+#define MC_GrabberConfig_01_10_00                 70
+#define MC_GrabberConfig_01_01_00                 71
+#define MC_GrabberConfig_01_00_10                 72
+#define MC_GrabberConfig_01_00_01                 73
+#define MC_GrabberConfig_00_11_00                 74
+#define MC_GrabberConfig_00_10_10                 75
+#define MC_GrabberConfig_00_10_01                 76
+#define MC_GrabberConfig_00_01_10                 77
+#define MC_GrabberConfig_00_01_01                 78
+#define MC_GrabberConfig_00_00_11                 79
+#define MC_GrabberConfig_10_00_00                 80
+#define MC_GrabberConfig_01_00_00                 81
+#define MC_GrabberConfig_00_01_00                 82
+#define MC_GrabberConfig_00_00_10                 83
+#define MC_GrabberConfig_00_00_01                 84
+#define MC_GrabberConfig_10_01_01                 85
+#define MC_GrabberConfig_00_10_00                 86
+#define MC_NextGrabberConfig_11_10_00             39
+#define MC_NextGrabberConfig_11_01_00             40
+#define MC_NextGrabberConfig_11_00_10             41
+#define MC_NextGrabberConfig_11_00_01             42
+#define MC_NextGrabberConfig_10_11_00             43
+#define MC_NextGrabberConfig_10_10_10             44
+#define MC_NextGrabberConfig_10_10_01             45
+#define MC_NextGrabberConfig_10_01_10             46
+#define MC_NextGrabberConfig_10_01_01             47
+#define MC_NextGrabberConfig_10_00_11             48
+#define MC_NextGrabberConfig_01_11_00             49
+#define MC_NextGrabberConfig_01_10_10             50
+#define MC_NextGrabberConfig_01_10_01             51
+#define MC_NextGrabberConfig_01_01_10             52
+#define MC_NextGrabberConfig_01_01_01             53
+#define MC_NextGrabberConfig_01_00_11             54
+#define MC_NextGrabberConfig_00_11_10             55
+#define MC_NextGrabberConfig_00_11_01             56
+#define MC_NextGrabberConfig_00_10_11             57
+#define MC_NextGrabberConfig_00_01_11             58
+#define MC_NextGrabberConfig_11_00_00             59
+#define MC_NextGrabberConfig_10_10_00             60
+#define MC_NextGrabberConfig_10_01_00             61
+#define MC_NextGrabberConfig_10_00_10             62
+#define MC_NextGrabberConfig_10_00_01             63
+#define MC_NextGrabberConfig_01_10_00             64
+#define MC_NextGrabberConfig_01_01_00             65
+#define MC_NextGrabberConfig_01_00_10             66
+#define MC_NextGrabberConfig_01_00_01             67
+#define MC_NextGrabberConfig_00_11_00             68
+#define MC_NextGrabberConfig_00_10_10             69
+#define MC_NextGrabberConfig_00_10_01             70
+#define MC_NextGrabberConfig_00_01_10             71
+#define MC_NextGrabberConfig_00_01_01             72
+#define MC_NextGrabberConfig_00_00_11             73
+#define MC_NextGrabberConfig_10_00_00             74
+#define MC_NextGrabberConfig_01_00_00             75
+#define MC_NextGrabberConfig_00_10_00             76
+#define MC_NextGrabberConfig_00_01_00             77
+#define MC_NextGrabberConfig_00_00_10             78
+#define MC_NextGrabberConfig_00_00_01             79
+#define MC_MapDigTim_AA                            9
+#define MC_MapDigTim_AB                           10
+#define MC_MapDigTim_BA                           11
+#define MC_MapDigTim_BB                           12
+#define MC_DesignNumber                          (MCPARAMID)( 1970 << 14)
+#define MC_DesignNumber_A                          1
+#define MC_DesignNumber_B                          2
+#define MC__Board_Type                           (MCPARAMID)( 1971 << 14)
+#define MC__Board_Type__ALPHA                      1
+#define MC__Board_Type__GAMMA                      2
+#define MC__Board_Type__ALPHA_cPCI                 3
+#define MC_TimUnitNUsage_SHARE                     4
+#define MC__BoardType__ALPHA_A                     9
+#define MC__BoardType__ALPHA_B                    10
+#define MC__DIGTIM                               (MCPARAMID)( 1972 << 14)
+#define MC_BoardTopologyRead                     (MCPARAMID)( 1973 << 14)
+#define MC_BoardTopologyRead_1_1                   1
+#define MC_BoardTopologyRead_2_1                   2
+#define MC_BoardTopologyRead_2_2                   3
+#define MC_BoardTopologyRead_1_11                  4
+#define MC_BoardTopologyRead_2_11                  5
+#define MC_BoardTopologyRead_11_11                 6
+#define MC_BoardTopologyRead_0_2                   7
+#define MC_BoardTopologyRead_2_0                   8
+#define MC_ChannelIndex                          (MCPARAMID)( 1974 << 14)
+#define MC_BoardIndex                            (MCPARAMID)( 1975 << 14)
+#define MC_GrabberIndex                          (MCPARAMID)( 1976 << 14)
+#define MC_ConnectorIndex                        (MCPARAMID)( 1977 << 14)
+#define MC_BayerOnly_Filter                      (MCPARAMID)( 1978 << 14)
+#define MC__Board_Type__IOTA                       4
+#define MC_Spectrum_Filter                       (MCPARAMID)( 1979 << 14)
+#define MC__BoardType__IOTA                       11
+#define MC___SyncMode_Check                      (MCPARAMID)( 1980 << 14)
+#define MC___SyncMode_Check_PASS                   1
+#define MC___SyncMode_Check_FAIL                   2
+#define MC___ADresolution_Check                  (MCPARAMID)( 1981 << 14)
+#define MC___ADresolution_Check_PASS               1
+#define MC___ADresolution_Check_FAIL               2
+#define MC___CalPat_Check                        (MCPARAMID)( 1982 << 14)
+#define MC___CalPat_Check_PASS                     1
+#define MC___CalPat_Check_FAIL                     2
+#define MC_BoardTopology_1_                       23
+#define MC__PRM2_T2OVR                           (MCPARAMID)( 1983 << 14)
+#define MC__PRM2_T2OVR_PROTECT                     1
+#define MC__PRM2_T2OVR_NOPROTECT                   2
+#define MC__HBC_POST                             (MCPARAMID)( 1984 << 14)
+#define MC__HBC_HPOST                            (MCPARAMID)( 1985 << 14)
+#define MC__DRS_CSOL_FVALS                         5
+#define MC__HDC_DCINIT                           (MCPARAMID)( 1986 << 14)
+#define MC__HDC_DCINIT_SOL                         1
+#define MC__HDC_DCINIT_LOOP                        2
+#define MC_Camera_PC_640CL                       122
+#define MC_CamConfig_P60RC                       176
+#define MC_Camera_1M28_SA                        123
+#define MC_CamConfig_P27SC                       177
+#define MC_CamConfig_P27RC                       178
+#define MC__TrueExp_T2                           (MCPARAMID)( 1987 << 14)
+#define MC__Upstream                             (MCPARAMID)( 1988 << 14)
+#define MC__Upstream_ON                            1
+#define MC__Upstream_OFF                           2
+#define MC__DTC_VUS_CST                          (MCPARAMID)( 1989 << 14)
+#define MC__DTC_VUS_CST_INPUT                      1
+#define MC__DTC_VUS_CST_CUS2                       2
+#define MC__DTC_VUS_CST_CUS2INV                    3
+#define MC__DTC_VUS_CST_SUS2                       4
+#define MC__DTC_VUS_CST_SUS2INV                    5
+#define MC__DTC_VUS_CST_LOW                        6
+#define MC__DTC_VUS_CST_HIGH                       7
+#define MC__DTC_VUS_CST_KEEP                       8
+#define MC__DTC_VUS_END                          (MCPARAMID)( 1990 << 14)
+#define MC__DTC_VUS_END_INPUT                      1
+#define MC__DTC_VUS_END_CUS2                       2
+#define MC__DTC_VUS_END_CUS2INV                    3
+#define MC__DTC_VUS_END_SUS2                       4
+#define MC__DTC_VUS_END_SUS2INV                    5
+#define MC__DTC_VUS_END_LOW                        6
+#define MC__DTC_VUS_END_HIGH                       7
+#define MC__DTC_VUS_END_KEEP                       8
+#define MC__DTC_RUS_CST                          (MCPARAMID)( 1991 << 14)
+#define MC__DTC_RUS_CST_INPUT                      1
+#define MC__DTC_RUS_CST_CUS2                       2
+#define MC__DTC_RUS_CST_CUS2INV                    3
+#define MC__DTC_RUS_CST_SUS2                       4
+#define MC__DTC_RUS_CST_SUS2INV                    5
+#define MC__DTC_RUS_CST_LOW                        6
+#define MC__DTC_RUS_CST_HIGH                       7
+#define MC__DTC_RUS_CST_KEEP                       8
+#define MC__DTC_RUS_END                          (MCPARAMID)( 1992 << 14)
+#define MC__DTC_RUS_END_INPUT                      1
+#define MC__DTC_RUS_END_CUS2                       2
+#define MC__DTC_RUS_END_CUS2INV                    3
+#define MC__DTC_RUS_END_SUS2                       4
+#define MC__DTC_RUS_END_SUS2INV                    5
+#define MC__DTC_RUS_END_LOW                        6
+#define MC__DTC_RUS_END_HIGH                       7
+#define MC__DTC_RUS_END_KEEP                       8
+#define MC_Camera_2M30_SA                        124
+#define MC_RequiredGrabbers                      (MCPARAMID)( 1993 << 14)
+#define MC_RequiredGrabber                       (MCPARAMID)( 1994 << 14)
+#define MC_RequiredGrabber_ONE                     1
+#define MC_RequiredGrabber_TWO                     2
+#define MC_RequiredGrabber_THREE                   3
+#define MC_RequiredGrabber_FOUR                    4
+#define MC_NextConfigGrabber                     (MCPARAMID)( 1995 << 14)
+#define MC_NextConfigGrabber_NONE                  1
+#define MC_NextConfigGrabber_mX                    2
+#define MC_NextConfigGrabber_mXBIS                 3
+#define MC_NextConfigGrabber_mY                    4
+#define MC_NextConfigGrabber_mYBIS                 5
+#define MC_NextConfigGrabber_mZ                    6
+#define MC_NextConfigGrabber_mZBIS                 7
+#define MC__NCGKey                               (MCPARAMID)( 1996 << 14)
+#define MC__NCGKey_STD                             1
+#define MC__NCGKey_ALT                             2
+#define MC_TimUnitNConfig                        (MCPARAMID)( 1997 << 14)
+#define MC_TimUnitNConfig_FREE                     1
+#define MC_TimUnitNConfig_A0_00                    2
+#define MC_TimUnitNConfig_0A_00                    3
+#define MC_TimUnitNConfig_00_A0                    4
+#define MC_TimUnitNConfig_00_0A                    5
+#define MC_TimUnitNConfig_C0_00                    6
+#define MC_TimUnitNConfig_C0_M0                    7
+#define MC_TimUnitNConfig_00_C0                    8
+#define MC_TimUnitNConfig_M0_C0                    9
+#define MC_ConfigTimUnitN                        (MCPARAMID)( 1998 << 14)
+#define MC_ConfigTimUnitN_UNUSED                   1
+#define MC_ConfigTimUnitN_ANALOG                   2
+#define MC_ConfigTimUnitN_MASTER                   3
+#define MC_NextTimUnitNConfig                    (MCPARAMID)( 1999 << 14)
+#define MC_NextTimUnitNConfig_FAIL                 1
+#define MC_NextTimUnitNConfig_FREE                 2
+#define MC_NextTimUnitNConfig_A0_00                3
+#define MC_NextTimUnitNConfig_0A_00                4
+#define MC_NextTimUnitNConfig_00_A0                5
+#define MC_NextTimUnitNConfig_00_0A                6
+#define MC_NextTimUnitNConfig_C0_00                7
+#define MC_NextTimUnitNConfig_C0_M0                8
+#define MC_NextTimUnitNConfig_00_C0                9
+#define MC_NextTimUnitNConfig_M0_C0               10
+#define MC_TimUnitNCheck                         (MCPARAMID)( 2000 << 14)
+#define MC_TimUnitNCheck_PASS                      1
+#define MC_TimUnitNCheck_FAIL                      2
+#define MC_ConfigClkSynthFreq                    (MCPARAMID)( 2001 << 14)
+#define MC_ClkSynthFreq                          (MCPARAMID)( 2002 << 14)
+#define MC_ChannelResourcesTimeout               (MCPARAMID)( 2003 << 14)
+#define MC_BoardTopology_MONO                     24
+#define MC_BoardTopology_DUO                      25
+#define MC_ConfigGrabberFailure                  (MCPARAMID)( 2004 << 14)
+#define MC_ConfigGrabberFailure_NONE               1
+#define MC_ConfigGrabberFailure_Connector_InUse    2
+#define MC_ConfigGrabberFailure_TUN_InUse          3
+#define MC_ConfigGrabberFailure_TUN_ShareMaster    4
+#define MC_ConfigGrabberFailure_Out_of_ADC_resource   5
+#define MC_ConfigGrabberFailure_Invalid_Config_PS   6
+#define MC_ConfigGrabberFailure_Invalid_Config     7
+#define MC_NextGrabberConfig_0_0_0_0              80
+#define MC_NextGrabberConfig_1_0_0_0              81
+#define MC_NextGrabberConfig_0_1_0_0              82
+#define MC_NextGrabberConfig_0_0_1_0              83
+#define MC_NextGrabberConfig_0_0_0_1              84
+#define MC_NextGrabberConfig_1_1_0_0              85
+#define MC_NextGrabberConfig_1_0_0_1              86
+#define MC_NextGrabberConfig_0_1_1_0              87
+#define MC_NextGrabberConfig_0_0_1_1              88
+#define MC_GrabberConfig_0_0_0_0                  87
+#define MC_GrabberConfig_1_0_0_0                  88
+#define MC_GrabberConfig_0_1_0_0                  89
+#define MC_GrabberConfig_0_0_1_0                  90
+#define MC_GrabberConfig_0_0_0_1                  91
+#define MC_SequencesR1_JumpNEXTACQ               (MCPARAMID)( 2005 << 14)
+#define MC_SequencesR1_JumpNEXTACQ_ACQR2           1
+#define MC_SequencesR1_JumpNEXTACQ_IDLER2          2
+#define MC_Camera_A302b                          125
+#define MC_INITC_GPTCOUNT                        (MCPARAMID)( 2006 << 14)
+#define MC__GrabMode                             (MCPARAMID)( 2007 << 14)
+#define MC__GrabMode_RAW                           1
+#define MC__GrabMode_XY                            2
+#define MC__RawGrabSizeX_Px                      (MCPARAMID)( 2008 << 14)
+#define MC__NotLive                              (MCPARAMID)( 2009 << 14)
+#define MC__nLive                                (MCPARAMID)( 2010 << 14)
+#define MC__STB_Qx1SRC_FromSTB_Y                   5
+#define MC__STB_Qx1SRC_FromSTB_Y_Inverted          6
+#define MC__STB_Qx2SRC_FromSTB_Y                   5
+#define MC__STB_Qx2SRC_FromSTB_Y_Inverted          6
+#define MC_B1Usage_TRIGGER                         3
+#define MC_B1Usage_LINETRIGGER                     4
+#define MC__BoardType__PICOLO_PRO2                12
+#define MC__BoardType__PICOLO                     13
+#define MC_BreakEffect                           (MCPARAMID)( 2011 << 14)
+#define MC_BreakEffect_ABORT                       1
+#define MC_BreakEffect_FINISH                      2
+#define MC_INITC_GPTCOUNT_ms                     (MCPARAMID)( 2012 << 14)
+#define MC_GrabberPartition                      (MCPARAMID)( 2013 << 14)
+#define MC_GrabberPartition_A                      1
+#define MC_GrabberPartition_B                      2
+#define MC_GrabberPartition_C                      3
+#define MC_GrabberPartition_D                      4
+#define MC_GrabberPartition_E                      5
+#define MC_GrabberPartition_F                      6
+#define MC_GrabberPartition_G                      7
+#define MC_GrabberPartition_H                      8
+#define MC_GrabberPartition_I                      9
+#define MC_NextGrabberPartition                  (MCPARAMID)( 2014 << 14)
+#define MC_NextGrabberPartition_A                  1
+#define MC_NextGrabberPartition_B                  2
+#define MC_NextGrabberPartition_C                  3
+#define MC_NextGrabberPartition_D                  4
+#define MC_NextGrabberPartition_E                  5
+#define MC_NextGrabberPartition_F                  6
+#define MC_NextGrabberPartition_G                  7
+#define MC_NextGrabberPartition_H                  8
+#define MC_NextGrabberPartition_I                  9
+#define MC_NextGrabberPartition_HOLD              10
+#define MC_ConfigGrabberFailure_InvalidPartition   8
+#define MC_NextGrabberPartition_A111              11
+#define MC_NextGrabberPartition_B222              12
+#define MC_NextGrabberPartition_C222              13
+#define MC_NextGrabberPartition_D222              14
+#define MC_GrabberPartition_A111                  10
+#define MC_GrabberPartition_B222                  11
+#define MC_GrabberPartition_C222                  12
+#define MC_GrabberPartition_D222                  13
+#define MC_NextGrabberPartition_A112              15
+#define MC_NextGrabberPartition_B221              16
+#define MC_NextGrabberPartition_C221              17
+#define MC_NextGrabberPartition_D221              18
+#define MC_NextGrabberPartition_E330              19
+#define MC_NextGrabberPartition_F330              20
+#define MC_GrabberPartition_A112                  14
+#define MC_GrabberPartition_B221                  15
+#define MC_GrabberPartition_C221                  16
+#define MC_GrabberPartition_D221                  17
+#define MC_GrabberPartition_E330                  18
+#define MC_GrabberPartition_F330                  19
+#define MC_GrabberPartition_A131                  20
+#define MC_GrabberPartition_F131                  21
+#define MC_GrabberPartition_G131                  22
+#define MC_GrabberPartition_C231                  23
+#define MC_GrabberPartition_F231                  24
+#define MC_GrabberPartition_H111111               25
+#define MC_GrabberPartition_I111111               26
+#define MC_NextGrabberPartition_A131              21
+#define MC_NextGrabberPartition_F131              22
+#define MC_NextGrabberPartition_G131              23
+#define MC_NextGrabberPartition_C231              24
+#define MC_NextGrabberPartition_F231              25
+#define MC_NextGrabberPartition_H111111           26
+#define MC_NextGrabberPartition_I111111           27
+#define MC___BISConnector_Check                  (MCPARAMID)( 2015 << 14)
+#define MC___BISConnector_Check_PASS               1
+#define MC___BISConnector_Check_FAIL               2
+#define MC___TAG_Check                           (MCPARAMID)( 2016 << 14)
+#define MC___TAG_Check_PASS                        1
+#define MC___TAG_Check_FAIL                        2
+#define MC__HBC_HPHAS                            (MCPARAMID)( 2017 << 14)
+#define MC__Category_Sequence_Control             25
+#define MC___SequenceLoad_Check                  (MCPARAMID)( 2018 << 14)
+#define MC___SequenceLoad_Check_PASS               1
+#define MC___SequenceLoad_Check_FAIL               2
+#define MC___WaitCamSync                         (MCPARAMID)( 2019 << 14)
+#define MC___WaitCamSync_OFF                       1
+#define MC___WaitCamSync_ON                        2
+#define MC_TXState                               (MCPARAMID)( 2020 << 14)
+#define MC_TXState_STOPPED                         1
+#define MC_TXState_RUNNING                         2
+#define MC_TYState                               (MCPARAMID)( 2021 << 14)
+#define MC_TYState_STOPPED                         1
+#define MC_TYState_RUNNING                         2
+#define MC_TUState                               (MCPARAMID)( 2022 << 14)
+#define MC_TUState_STOPPED                         1
+#define MC_TUState_RUNNING                         2
+#define MC__CamConfigX                           (MCPARAMID)( 2023 << 14)
+#define MC__CamConfigY                           (MCPARAMID)( 2024 << 14)
+#define MC__CamConfig                            (MCPARAMID)( 2025 << 14)
+#define MC_PartialPage                           (MCPARAMID)( 2026 << 14)
+#define MC_LineCount                             (MCPARAMID)( 2027 << 14)
+#define MC__VLC_LCSNS_PARTIALPAGE                  3
+#define MC__VLC_PartialLCNT                      (MCPARAMID)( 2028 << 14)
+#define MC__STM1_T1SCAL_200ns                      7
+#define MC__PRM1_T1POS_SIG1On                    (MCPARAMID)( 2029 << 14)
+#define MC__PRM1_T1POS_SIG1Off                   (MCPARAMID)( 2030 << 14)
+#define MC__SCC_CC1_T1SIG1                         9
+#define MC__SCC_CC1_T1SIG2                        10
+#define MC__SCC_CC1_T1SIG1n                       11
+#define MC__SCC_CC1_T1SIG2n                       12
+#define MC__SCC_CC2_T1SIG1                         9
+#define MC__SCC_CC2_T1SIG2                        10
+#define MC__SCC_CC2_T1SIG1n                       11
+#define MC__SCC_CC2_T1SIG2n                       12
+#define MC__SCC_CC3_T1SIG1                        13
+#define MC__SCC_CC3_T1SIG2                        14
+#define MC__SCC_CC3_T1SIG1n                       15
+#define MC__SCC_CC3_T1SIG2n                       16
+#define MC__SCC_CC4_T1SIG1                        11
+#define MC__SCC_CC4_T1SIG2                        12
+#define MC__SCC_CC4_T1SIG1n                       13
+#define MC__SCC_CC4_T1SIG2n                       14
+#define MC__PRM1_T1POS_xx                        (MCPARAMID)( 2031 << 14)
+#define MC__PRM1_T1DEF_xx                        (MCPARAMID)( 2032 << 14)
+#define MC__PRM1_T1DEF_01                        (MCPARAMID)( 2033 << 14)
+#define MC__PRM1_T1POS_01                        (MCPARAMID)( 2034 << 14)
+#define MC__PRM1_T1DEF_02                        (MCPARAMID)( 2035 << 14)
+#define MC__PRM1_T1POS_02                        (MCPARAMID)( 2036 << 14)
+#define MC__PRM1_T1DEF_03                        (MCPARAMID)( 2037 << 14)
+#define MC__PRM1_T1POS_03                        (MCPARAMID)( 2038 << 14)
+#define MC__PRM1_T1DEF_04                        (MCPARAMID)( 2039 << 14)
+#define MC__PRM1_T1POS_04                        (MCPARAMID)( 2040 << 14)
+#define MC__PRM1_T1DEF_05                        (MCPARAMID)( 2041 << 14)
+#define MC__PRM1_T1POS_05                        (MCPARAMID)( 2042 << 14)
+#define MC__PRM1_T1DEF_06                        (MCPARAMID)( 2043 << 14)
+#define MC__PRM1_T1POS_06                        (MCPARAMID)( 2044 << 14)
+#define MC__PRM1_T1DEF_07                        (MCPARAMID)( 2045 << 14)
+#define MC__PRM1_T1POS_07                        (MCPARAMID)( 2046 << 14)
+#define MC__PRM1_T1DEF_08                        (MCPARAMID)( 2047 << 14)
+#define MC__PRM1_T1POS_08                        (MCPARAMID)( 2048 << 14)
+#define MC__PRM1_T1DEF_09                        (MCPARAMID)( 2049 << 14)
+#define MC__PRM1_T1POS_09                        (MCPARAMID)( 2050 << 14)
+#define MC__PRM1_T1DEF_10                        (MCPARAMID)( 2051 << 14)
+#define MC__PRM1_T1POS_10                        (MCPARAMID)( 2052 << 14)
+#define MC__PRM1_T1DEF_11                        (MCPARAMID)( 2053 << 14)
+#define MC__PRM1_T1POS_11                        (MCPARAMID)( 2054 << 14)
+#define MC__PRM1_T1DEF_12                        (MCPARAMID)( 2055 << 14)
+#define MC__PRM1_T1POS_12                        (MCPARAMID)( 2056 << 14)
+#define MC__PRM1_T1DEF_13                        (MCPARAMID)( 2057 << 14)
+#define MC__PRM1_T1POS_13                        (MCPARAMID)( 2058 << 14)
+#define MC__PRM1_T1DEF_14                        (MCPARAMID)( 2059 << 14)
+#define MC__PRM1_T1POS_14                        (MCPARAMID)( 2060 << 14)
+#define MC__PRM1_T1DEF_15                        (MCPARAMID)( 2061 << 14)
+#define MC__PRM1_T1POS_15                        (MCPARAMID)( 2062 << 14)
+#define MC__PRM1_T1DEF_16                        (MCPARAMID)( 2063 << 14)
+#define MC__PRM1_T1POS_16                        (MCPARAMID)( 2064 << 14)
+#define MC__RESETOn_T1                           (MCPARAMID)( 2065 << 14)
+#define MC__RESETOff_T1                          (MCPARAMID)( 2066 << 14)
+#define MC__AUXRESETOn_T1                        (MCPARAMID)( 2067 << 14)
+#define MC__AUXRESETOff_T1                       (MCPARAMID)( 2068 << 14)
+#define MC__STROBEOn_T1                          (MCPARAMID)( 2069 << 14)
+#define MC__STROBEOff_T1                         (MCPARAMID)( 2070 << 14)
+#define MC__USEROn_T1                            (MCPARAMID)( 2071 << 14)
+#define MC__USEROff_T1                           (MCPARAMID)( 2072 << 14)
+#define MC__SQ1_T1                               (MCPARAMID)( 2073 << 14)
+#define MC__T1Avail_T1                           (MCPARAMID)( 2074 << 14)
+#define MC__STROBEWidth_T1                       (MCPARAMID)( 2075 << 14)
+#define MC__TrueExp_T1                           (MCPARAMID)( 2076 << 14)
+#define MC__Category_Timers_Control               26
+#define MC__ResetDur_T1                          (MCPARAMID)( 2077 << 14)
+#define MC__T1Span_T1                            (MCPARAMID)( 2078 << 14)
+#define MC__ReadoutDur_T1                        (MCPARAMID)( 2079 << 14)
+#define MC_LUT0                                  (MCPARAMID)( 2080 << 14)
+#define MC_TOTOa                                 (MCPARAMID)( 2081 << 14)
+#define MC_TOTOa_NO_VALUE                          1
+#define MC_TOTOa_NO_VALUE2                         2
+#define MC_TOTOb                                 (MCPARAMID)( 2082 << 14)
+#define MC_TOTOb_NO_VALUE                          1
+#define MC_TOTOb_NO_VALUE2                         2
+#define MC_TOTOc                                 (MCPARAMID)( 2083 << 14)
+#define MC_TOTOc_NO_VALUE                          1
+#define MC_TOTOc_NO_VALUE2                         2
+#define MC__LUT0                                 (MCPARAMID)( 2084 << 14)
+#define MC__LUT1                                 (MCPARAMID)( 2085 << 14)
+#define MC__LUT2                                 (MCPARAMID)( 2086 << 14)
+#define MC__LUTMODE                              (MCPARAMID)( 2087 << 14)
+#define MC__LUTMODE_BYPASS                         1
+#define MC__LUTMODE_SINGLE                         2
+#define MC__LUTMODE_TRIPLE                         3
+#define MC__LUT0_0                                 1
+#define MC__LUT0_1                                 2
+#define MC__LUT0_2                                 3
+#define MC__LUT0_3                                 4
+#define MC__LUT0_4                                 5
+#define MC__LUT0_titi                              6
+#define MC__LUT0_tutu                              7
+#define MC__LUT1_titi                              1
+#define MC__LUT1_tutu                              2
+#define MC__LUT2_titi                              1
+#define MC__LUT2_tutu                              2
+#define MC__LUTAVAILABLE                         (MCPARAMID)( 2088 << 14)
+#define MC__LUTAVAILABLE_NONE                      1
+#define MC__LUTAVAILABLE_SINGLE8                   2
+#define MC__LUTAVAILABLE_TRIPLE8                   3
+#define MC__LUTAVAILABLE_SINGLE10                  4
+#define MC__LUTAVAILABLE_TRIPLE10                  5
+#define MC__T2POS                                (MCPARAMID)( 2089 << 14)
+#define MC__PRM2_T2POS                           (MCPARAMID)( 2090 << 14)
+#define MC__STM2_T2CLK                           (MCPARAMID)( 2091 << 14)
+#define MC__STM2_T2CLK_T1CLK                       1
+#define MC__STM2_T2CLK_LTRIG                       2
+#define MC__STM2_T2CLK_PPLS                        3
+#define MC__STM2_T2SEL_FTRIGS                      7
+#define MC__STM2_T2SEL_SAP                         8
+#define MC__STM2_T2SEL_EAP                         9
+#define MC__STB_Qx1SRC_T1SIG3                      7
+#define MC__STB_Qx1SRC_T1SIG4                      8
+#define MC__STB_Qx1POL                           (MCPARAMID)( 2092 << 14)
+#define MC__STB_Qx1POL_DIRECT                      1
+#define MC__STB_Qx1POL_INVERT                      2
+#define MC__STB_Qx2SRC_T1SIG3                      7
+#define MC__STB_Qx2SRC_T1SIG4                      8
+#define MC__STB_Qx2POL                           (MCPARAMID)( 2093 << 14)
+#define MC__STB_Qx2POL_DIRECT                      1
+#define MC__STB_Qx2POL_INVERT                      2
+#define MC__STB_Qx1POL_HOLD                        3
+#define MC__STB_Qx2POL_HOLD                        3
+#define MC__STR_STXPOL                           (MCPARAMID)( 2094 << 14)
+#define MC__STR_STXPOL_DIRECT                      1
+#define MC__STR_STXPOL_INVERT                      2
+#define MC__STR_STXPOL_HOLD                        3
+#define MC__STR_STXSRC                           (MCPARAMID)( 2095 << 14)
+#define MC__STR_STXSRC_LOW                         1
+#define MC__STR_STXSRC_T1SIG3_X                    2
+#define MC__STR_STXSRC_T1SIG4_X                    3
+#define MC__STR_STXSRC_HOLD                        4
+#define MC__STM1_T1SEL                           (MCPARAMID)( 2096 << 14)
+#define MC__STM1_T1SEL_FTRIGS                      1
+#define MC__STM1_T1SEL_LTRIGS                      2
+#define MC__STM1_T1SEL_PPLS                        3
+#define MC__STM1_T1SEL_OFF                         4
+#define MC__STR_STXSPOL                          (MCPARAMID)( 2097 << 14)
+#define MC__STR_STXSPOL_DIRECT                     1
+#define MC__STR_STXSPOL_INVERT                     2
+#define MC__STR_STXSPOL_HOLD                       3
+#define MC__STR_STXSRC_T1SIG3_Y                    5
+#define MC__STR_STXSRC_T1SIG4_Y                    6
+#define MC__STR_STYSPOL                          (MCPARAMID)( 2098 << 14)
+#define MC__STR_STYSPOL_DIRECT                     1
+#define MC__STR_STYSPOL_INVERT                     2
+#define MC__STR_STYSPOL_HOLD                       3
+#define MC__STR_STZSPOL                          (MCPARAMID)( 2099 << 14)
+#define MC__STR_STZSPOL_DIRECT                     1
+#define MC__STR_STZSPOL_INVERT                     2
+#define MC__STR_STZSPOL_HOLD                       3
+#define MC__STR_STYPOL                           (MCPARAMID)( 2100 << 14)
+#define MC__STR_STYPOL_DIRECT                      1
+#define MC__STR_STYPOL_INVERT                      2
+#define MC__STR_STYPOL_HOLD                        3
+#define MC__STR_STZPOL                           (MCPARAMID)( 2101 << 14)
+#define MC__STR_STZPOL_DIRECT                      1
+#define MC__STR_STZPOL_INVERT                      2
+#define MC__STR_STZPOL_HOLD                        3
+#define MC__STR_STYSRC                           (MCPARAMID)( 2102 << 14)
+#define MC__STR_STYSRC_LOW                         1
+#define MC__STR_STYSRC_T1SIG3_X                    2
+#define MC__STR_STYSRC_T1SIG4_X                    3
+#define MC__STR_STYSRC_T1SIG3_Y                    4
+#define MC__STR_STYSRC_T1SIG4_Y                    5
+#define MC__STR_STYSRC_HOLD                        6
+#define MC__STR_STZSRC                           (MCPARAMID)( 2103 << 14)
+#define MC__STR_STZSRC_LOW                         1
+#define MC__STR_STZSRC_T1SIG3_X                    2
+#define MC__STR_STZSRC_T1SIG4_X                    3
+#define MC__STR_STZSRC_T1SIG3_Y                    4
+#define MC__STR_STZSRC_T1SIG4_Y                    5
+#define MC__STR_STZSRC_HOLD                        6
+#define MC__STB_Qx1SRC_T1SIG3_Inverted             9
+#define MC__STB_Qx1SRC_T1SIG4_Inverted            10
+#define MC__STB_Qx1SRC_HOLD                       11
+#define MC__STB_Qx2SRC_T1SIG3_Inverted             9
+#define MC__STB_Qx2SRC_T1SIG4_Inverted            10
+#define MC__STB_Qx2SRC_HOLD                       11
+#define MC__INITC_USY                            (MCPARAMID)( 2104 << 14)
+#define MC__INITC_USY_TY2Y                         1
+#define MC__INITC_USY_TX2Y                         2
+#define MC__4xFsc_Color_kHz                      (MCPARAMID)( 2105 << 14)
+#define MC__SampledPixels_Ln                     (MCPARAMID)( 2106 << 14)
+#define MC__STEPX1                               (MCPARAMID)( 2107 << 14)
+#define MC__STEPX2                               (MCPARAMID)( 2108 << 14)
+#define MC__STEPX3                               (MCPARAMID)( 2109 << 14)
+#define MC__STEPY1                               (MCPARAMID)( 2110 << 14)
+#define MC__STEPY2                               (MCPARAMID)( 2111 << 14)
+#define MC__STEPY3                               (MCPARAMID)( 2112 << 14)
+#define MC_Connector_STEREOXY                     19
+#define MC_NextConfigGrabber_mSTEREOXY             8
+#define MC_ConfigGrabber_pSTEREOXY                15
+#define MC_ConfigGrabber_mSTEREOXY                16
+#define MC__Cameras                              (MCPARAMID)( 2113 << 14)
+#define MC__TkPx                                 (MCPARAMID)( 2114 << 14)
+#define MC__Images                               (MCPARAMID)( 2115 << 14)
+#define MC_NextGrabberConfig_STEREOXY             89
+#define MC_GrabberConfig_STEREOXY                 92
+#define MC_OutputConfig_Filter_21                (MCPARAMID)( 2116 << 14)
+#define MC_OutputState_Filter_21                 (MCPARAMID)( 2117 << 14)
+#define MC_OutputState_21                        (MCPARAMID)( 2118 << 14)
+#define MC_OutputState_21_HOLD                     1
+#define MC_OutputState_21_LOW                      2
+#define MC_OutputState_21_HIGH                     3
+#define MC_OutputStyle_Filter_21                 (MCPARAMID)( 2119 << 14)
+#define MC_OutputConfig_Filter_22                (MCPARAMID)( 2120 << 14)
+#define MC_OutputState_Filter_22                 (MCPARAMID)( 2121 << 14)
+#define MC_OutputState_22                        (MCPARAMID)( 2122 << 14)
+#define MC_OutputState_22_HOLD                     1
+#define MC_OutputState_22_LOW                      2
+#define MC_OutputState_22_HIGH                     3
+#define MC_OutputStyle_Filter_22                 (MCPARAMID)( 2123 << 14)
+#define MC_OutputConfig_Filter_23                (MCPARAMID)( 2124 << 14)
+#define MC_OutputState_Filter_23                 (MCPARAMID)( 2125 << 14)
+#define MC_OutputState_23                        (MCPARAMID)( 2126 << 14)
+#define MC_OutputState_23_HOLD                     1
+#define MC_OutputState_23_LOW                      2
+#define MC_OutputState_23_HIGH                     3
+#define MC_OutputStyle_Filter_23                 (MCPARAMID)( 2127 << 14)
+#define MC_OutputConfig_Filter_24                (MCPARAMID)( 2128 << 14)
+#define MC_OutputState_Filter_24                 (MCPARAMID)( 2129 << 14)
+#define MC_OutputState_24                        (MCPARAMID)( 2130 << 14)
+#define MC_OutputState_24_HOLD                     1
+#define MC_OutputState_24_LOW                      2
+#define MC_OutputState_24_HIGH                     3
+#define MC_OutputStyle_Filter_24                 (MCPARAMID)( 2131 << 14)
+#define MC_OutputConfig_Filter_31                (MCPARAMID)( 2132 << 14)
+#define MC_OutputState_Filter_31                 (MCPARAMID)( 2133 << 14)
+#define MC_OutputState_31                        (MCPARAMID)( 2134 << 14)
+#define MC_OutputState_31_HOLD                     1
+#define MC_OutputState_31_LOW                      2
+#define MC_OutputState_31_HIGH                     3
+#define MC_OutputStyle_Filter_31                 (MCPARAMID)( 2135 << 14)
+#define MC_OutputConfig_Filter_32                (MCPARAMID)( 2136 << 14)
+#define MC_OutputState_Filter_32                 (MCPARAMID)( 2137 << 14)
+#define MC_OutputState_32                        (MCPARAMID)( 2138 << 14)
+#define MC_OutputState_32_HOLD                     1
+#define MC_OutputState_32_LOW                      2
+#define MC_OutputState_32_HIGH                     3
+#define MC_OutputStyle_Filter_32                 (MCPARAMID)( 2139 << 14)
+#define MC_OutputConfig_Filter_33                (MCPARAMID)( 2140 << 14)
+#define MC_OutputState_Filter_33                 (MCPARAMID)( 2141 << 14)
+#define MC_OutputState_33                        (MCPARAMID)( 2142 << 14)
+#define MC_OutputState_33_HOLD                     1
+#define MC_OutputState_33_LOW                      2
+#define MC_OutputState_33_HIGH                     3
+#define MC_OutputStyle_Filter_33                 (MCPARAMID)( 2143 << 14)
+#define MC_OutputConfig_Filter_34                (MCPARAMID)( 2144 << 14)
+#define MC_OutputState_Filter_34                 (MCPARAMID)( 2145 << 14)
+#define MC_OutputState_34                        (MCPARAMID)( 2146 << 14)
+#define MC_OutputState_34_HOLD                     1
+#define MC_OutputState_34_LOW                      2
+#define MC_OutputState_34_HIGH                     3
+#define MC_OutputStyle_Filter_34                 (MCPARAMID)( 2147 << 14)
+#define MC_OutputStyle_LVDS                        8
+#define MC_OffsetD1WaitAft                       (MCPARAMID)( 2148 << 14)
+#define MC_INITD1State                           (MCPARAMID)( 2149 << 14)
+#define MC_INITD1Signature1                      (MCPARAMID)( 2150 << 14)
+#define MC_INITD1Signature2                      (MCPARAMID)( 2151 << 14)
+#define MC_INITD1Condition                       (MCPARAMID)( 2152 << 14)
+#define MC_TrigDelay_us                          (MCPARAMID)( 2153 << 14)
+#define MC_TriggerDelay_Tk                       (MCPARAMID)( 2154 << 14)
+#define MC_TrigDelay_Tk                          (MCPARAMID)( 2155 << 14)
+#define MC_TrigDelay_E                           (MCPARAMID)( 2156 << 14)
+#define MC_TrueTrigDelay_Tk                      (MCPARAMID)( 2157 << 14)
+#define MC_TrueTrigDelay_us                      (MCPARAMID)( 2158 << 14)
+#define MC__SampleClk_KHz                        (MCPARAMID)( 2159 << 14)
+#define MC_TrigDelay_T1                          (MCPARAMID)( 2160 << 14)
+#define MC_INITCrecord                           (MCPARAMID)( 2161 << 14)
+#define MC_INITCsignature                        (MCPARAMID)( 2162 << 14)
+#define MC_INITCcondition                        (MCPARAMID)( 2163 << 14)
+#define MC_OUTPUTrecord                          (MCPARAMID)( 2164 << 14)
+#define MC_OUT17index                            (MCPARAMID)( 2165 << 14)
+#define MC_OUT17signature                        (MCPARAMID)( 2166 << 14)
+#define MC_OUT17condition                        (MCPARAMID)( 2167 << 14)
+#define MC_OUT18index                            (MCPARAMID)( 2168 << 14)
+#define MC_OUT18signature                        (MCPARAMID)( 2169 << 14)
+#define MC_OUT18condition                        (MCPARAMID)( 2170 << 14)
+#define MC_OUT19index                            (MCPARAMID)( 2171 << 14)
+#define MC_OUT19signature                        (MCPARAMID)( 2172 << 14)
+#define MC_OUT19condition                        (MCPARAMID)( 2173 << 14)
+#define MC_MANTRIGcondition                      (MCPARAMID)( 2174 << 14)
+#define MC__HactiveMax_Px                        (MCPARAMID)( 2175 << 14)
+#define MC_ImageXStep_Px                         (MCPARAMID)( 2176 << 14)
+#define MC_ImageYStep_Ln                         (MCPARAMID)( 2177 << 14)
+#define MC_RoundedOffsetX_Px                     (MCPARAMID)( 2178 << 14)
+#define MC_RoundedOffsetY_Ln                     (MCPARAMID)( 2179 << 14)
+#define MC_FifoOffsetX                           (MCPARAMID)( 2180 << 14)
+#define MC_FifoOffsetY                           (MCPARAMID)( 2181 << 14)
+#define MC_HTotal_Px                             (MCPARAMID)( 2182 << 14)
+#define MC_ImageSizingX_VARIABLE                   2
+#define MC_ImageOffset_X                         (MCPARAMID)( 2183 << 14)
+#define MC_ImageOffset_Y                         (MCPARAMID)( 2184 << 14)
+#define MC_ImageOffsetX                          (MCPARAMID)( 2185 << 14)
+#define MC_ImageOffsetY                          (MCPARAMID)( 2186 << 14)
+#define MC__Category__Grabber_LUT                 27
+#define MC__Category_zGrabber_LUT                 28
+#define MC__STM1_T1SEL_OnLTRIGS                    5
+#define MC__STM1_T1SEL_OnLTRIGE                    6
+#define MC__STM1_T1SEL_OnPPLS                      7
+#define MC__STM1_T1SEL_OnGO1                       8
+#define MC__STM1_T1SEL_OnEND2                      9
+#define MC__STM2_T2CLK_EOL                         4
+#define MC__STROBEWidth_us                       (MCPARAMID)( 2187 << 14)
+#define MC__StrobeStart_us                       (MCPARAMID)( 2188 << 14)
+#define MC__EXPOSEStart_T1                       (MCPARAMID)( 2189 << 14)
+#define MC_Camera_VCC_810                        126
+#define MC_PreStrobe_us                          (MCPARAMID)( 2190 << 14)
+#define MC_ImagePlaneSize                        (MCPARAMID)( 2191 << 14)
+#define MC__EXPOn2STROBEOff_T1                   (MCPARAMID)( 2192 << 14)
+#define MC__PREEXPWidth_T1                       (MCPARAMID)( 2193 << 14)
+#define MC__DRS_CSOL_LTriggeredLVALS               6
+#define MC__SrobeWidth_us                        (MCPARAMID)( 2194 << 14)
+#define MC__ExposeRecovery_T1                    (MCPARAMID)( 2195 << 14)
+#define MC__MaxTimer1TriggerRate_Hz              (MCPARAMID)( 2196 << 14)
+#define MC__EXPOn_T1                             (MCPARAMID)( 2197 << 14)
+#define MC__EXPOff_T1                            (MCPARAMID)( 2198 << 14)
+#define MC__HactiveRef_Px                        (MCPARAMID)( 2199 << 14)
+#define MC__VactiveRef_Ln                        (MCPARAMID)( 2200 << 14)
+#define MC__RoundedActiveSizeX                   (MCPARAMID)( 2201 << 14)
+#define MC__RoundedActiveSizeY                   (MCPARAMID)( 2202 << 14)
+#define MC_ActiveXStep_Px                        (MCPARAMID)( 2203 << 14)
+#define MC__PREEXPWidth_us                       (MCPARAMID)( 2204 << 14)
+#define MC__StrobeStop_us                        (MCPARAMID)( 2205 << 14)
+#define MC___MAXIMUM_T1                          (MCPARAMID)( 2206 << 14)
+#define MC_Camera_VCC_850A                       127
+#define MC_Camera_VCC_870A                       128
+#define MC__CTD_TDSCAL                           (MCPARAMID)( 2207 << 14)
+#define MC__CTD_TDSCAL_1us                         1
+#define MC__CTD_TDSCAL_10us                        2
+#define MC__CTD_TDSCAL_100us                       3
+#define MC__CTD_TDSCAL_1ms                         4
+#define MC__TD_us                                (MCPARAMID)( 2208 << 14)
+#define MC_TrigDelay_TD                          (MCPARAMID)( 2209 << 14)
+#define MC__CTD_TDCLK                            (MCPARAMID)( 2210 << 14)
+#define MC__CTD_TDCLK_PRESCAL                      1
+#define MC__CTD_TDCLK_LTRIG                        2
+#define MC__CTD_TDCLK_PPLS                         3
+#define MC__CTD_TDCLK_EOL                          4
+#define MC__CTD_TDMOD                            (MCPARAMID)( 2211 << 14)
+#define MC__CTD_TDMOD_Bypass                       1
+#define MC__CTD_TDMOD_Enable                       2
+#define MC__CTD_TDCNT                            (MCPARAMID)( 2212 << 14)
+#define MC__CTD_TDSCAL_ns                        (MCPARAMID)( 2213 << 14)
+#define MC_TrueTrigDelay_ns                      (MCPARAMID)( 2214 << 14)
+#define MC_Connector_VID1                         20
+#define MC_Connector_VID2                         21
+#define MC_Connector_VID3                         22
+#define MC_Connector_VID4                         23
+#define MC_Connector_VID5                         24
+#define MC_Connector_VID6                         25
+#define MC_Connector_VID7                         26
+#define MC_Connector_VID8                         27
+#define MC_Connector_VID9                         28
+#define MC_Connector_VID10                        29
+#define MC_Connector_VID11                        30
+#define MC_Connector_VID12                        31
+#define MC_Connector_VID13                        32
+#define MC_Connector_VID14                        33
+#define MC_Connector_VID15                        34
+#define MC_Connector_VID16                        35
+#define MC_TrigLine_PG                            12
+#define MC_TrigLine_LTACT                         13
+#define MC__TrigLine_PG                           18
+#define MC__TrigLine_LTACT                        19
+#define MC__TRG_FTSEL_PG                          15
+#define MC__TRG_FTSEL_LTACT                       16
+#define MC_PGRCUsage                             (MCPARAMID)( 2215 << 14)
+#define MC_PGRCUsage_Unused                        1
+#define MC_PGRCUsage_PG_FT                         2
+#define MC_PGRCUsage_LTActFT                       3
+#define MC_PGRCUsage_PG_LT                         4
+#define MC_PGRCUsage_PG_PT                         5
+#define MC_PGRCUsage_RC_LTActPT                    6
+#define MC__PG_Check                             (MCPARAMID)( 2216 << 14)
+#define MC__PG_Check_PASS                          1
+#define MC__PG_Check_FAIL                          2
+#define MC__LTACT_Check                          (MCPARAMID)( 2217 << 14)
+#define MC__LTACT_Check_PASS                       1
+#define MC__LTACT_Check_FAIL                       2
+#define MC__TrigLine_PGA                          20
+#define MC__TrigLine_LTACTA                       21
+#define MC__TrigLine_PGB                          22
+#define MC__TrigLine_LTACTB                       23
+#define MC__PGRCUsage_Check                      (MCPARAMID)( 2218 << 14)
+#define MC__PGRCUsage_Check_PASS                   1
+#define MC__PGRCUsage_Check_FAIL                   2
+#define MC_PostReadoutRecovery_us                (MCPARAMID)( 2219 << 14)
+#define MC__EAP2EXPOn_us                         (MCPARAMID)( 2220 << 14)
+#define MC__EAP2EXPOn_T1                         (MCPARAMID)( 2221 << 14)
+#define MC__Category_Grabber_LUT                  29
+#define MC__DRS_CSOL_PickedOutLVALS                7
+#define MC_FrameRate_mHz                         (MCPARAMID)( 2222 << 14)
+#define MC_FrameDur_us                           (MCPARAMID)( 2223 << 14)
+#define MC_STXUsage_PPLS                           4
+#define MC_STYUsage_PPLS                           4
+#define MC__STR_STXSRC_PPLS_X                      7
+#define MC__STR_STYSRC_PPLS_Y                      7
+#define MC_STRUsage_PPLS                           3
+#define MC_ColorFormat                           (MCPARAMID)( 2224 << 14)
+#define MC_ColorFormat_RGB24                       1
+#define MC_ColorFormat_BGR24                       2
+#define MC_ColorFormat_RGB32                       3
+#define MC_ColorFormat_BGR32                       4
+#define MC_ColorFormat_RGB16                       5
+#define MC_ColorFormat_RGB15                       6
+#define MC_ColorFormat_Y8                          7
+#define MC_ColorFormat_YUV422                      8
+#define MC_ColorGain                             (MCPARAMID)( 2225 << 14)
+#define MC_ColorGainTrimU                        (MCPARAMID)( 2226 << 14)
+#define MC_ColorGainTrimV                        (MCPARAMID)( 2227 << 14)
+#define MC_ColorGainTrimHue                      (MCPARAMID)( 2228 << 14)
+#define MC__Contrast                             (MCPARAMID)( 2229 << 14)
+#define MC__Brightness                           (MCPARAMID)( 2230 << 14)
+#define MC__SaturationU                          (MCPARAMID)( 2231 << 14)
+#define MC__SaturationV                          (MCPARAMID)( 2232 << 14)
+#define MC__Hue                                  (MCPARAMID)( 2233 << 14)
+#define MC_Camera_COLIBRI2048CL                  129
+#define MC_CamConfig_L2048RGM                    179
+#define MC_Manufacturer_TVI                       21
+#define MC_Camera_CAMERA_CCIR                    130
+#define MC_Camera_CAMERA_EIA                     131
+#define MC_Camera_CAMERA_PAL                     132
+#define MC_Camera_CAMERA_NTSC                    133
+#define MC____Camera                             (MCPARAMID)( 2234 << 14)
+#define MC____Camera_CCIR                          1
+#define MC____Camera_EIA                           2
+#define MC____Camera_PAL                           3
+#define MC____Camera_NTSC                          4
+#define MC__NormalSizeX_px                       (MCPARAMID)( 2235 << 14)
+#define MC__NormalOffsetX_Px                     (MCPARAMID)( 2236 << 14)
+#define MC__SamplingScaleX                       (MCPARAMID)( 2237 << 14)
+#define MC__UserScaleX                           (MCPARAMID)( 2238 << 14)
+#define MC__FullScaleX                           (MCPARAMID)( 2239 << 14)
+#define MC__FullOffsetX_Px                       (MCPARAMID)( 2240 << 14)
+#define MC_ColorGainTrimHue_Filter               (MCPARAMID)( 2241 << 14)
+#define MC_Camera_COLIBRI1024CL                  134
+#define MC_Camera_MyCameraLink                   135
+#define MC_CamConfig_L1024RGM                    180
+#define MC_CamConfig_PxxSC                       181
+#define MC_CamConfig_PxxRC                       182
+#define MC_CamConfig_PxxRG                       183
+#define MC_CamConfig_IxxSC                       184
+#define MC_CamConfig_LxxxxSP                     185
+#define MC_CamConfig_LxxxxRC                     186
+#define MC_CamConfig_LxxxxRG                     187
+#define MC__FullOffsetY_Ln                       (MCPARAMID)( 2242 << 14)
+#define MC__NormalSizeY_Ln                       (MCPARAMID)( 2243 << 14)
+#define MC__FullScaleY                           (MCPARAMID)( 2244 << 14)
+#define MC__FullFrameSizeY_Ln                    (MCPARAMID)( 2245 << 14)
+#define MC_Camera_PRICOLOR1024C                  136
+#define MC_Camera_PRICOLOR2048C                  137
+#define MC_dummydhfjsdhk                         (MCPARAMID)( 2246 << 14)
+#define MC_Camera_AViiVA_C2CL4010                138
+#define MC_CamConfig_L1365RG                     188
+#define MC_CamConfig_L4096RGS                    189
+#define MC_OutputState_WENTLOW                     8
+#define MC_OutputState_WENTHIGH                    9
+#define MC_OutputState_PULSE                      10
+#define MC_Camera_CV_M4CLp                       139
+#define MC_Camera_VCC_8350                       140
+#define MC_Camera_VCC_8550                       141
+#define MC_CamConfig_P60RM_A                     190
+#define MC_OutputConfig_Filter_41                (MCPARAMID)( 2247 << 14)
+#define MC_OutputState_Filter_41                 (MCPARAMID)( 2248 << 14)
+#define MC_OutputState_41                        (MCPARAMID)( 2249 << 14)
+#define MC_OutputState_41_HOLD                     1
+#define MC_OutputState_41_LOW                      2
+#define MC_OutputState_41_HIGH                     3
+#define MC_OutputConfig_Filter_42                (MCPARAMID)( 2250 << 14)
+#define MC_OutputState_Filter_42                 (MCPARAMID)( 2251 << 14)
+#define MC_OutputState_42                        (MCPARAMID)( 2252 << 14)
+#define MC_OutputState_42_HOLD                     1
+#define MC_OutputState_42_LOW                      2
+#define MC_OutputState_42_HIGH                     3
+#define MC_ColorStorage_WORD                       3
+#define MC_ColorStorage_Filter                   (MCPARAMID)( 2253 << 14)
+#define MC_ImagePixelAlign_Filter                (MCPARAMID)( 2254 << 14)
+#define MC__CameraColorFormat                    (MCPARAMID)( 2255 << 14)
+#define MC__CameraColorFormat_MONOCHROME           1
+#define MC__CameraColorFormat_BAYER                2
+#define MC__CameraColorFormat_ParallelRGB          3
+#define MC__CameraColorFormat_UNKNOWN              4
+#define MC_ColorFormat_GRABBER                     9
+#define MC_ColorFormat_Y10                        10
+#define MC_ColorFormat_Y12                        11
+#define MC_ColorFormat_Y14                        12
+#define MC_ColorFormat_Y16                        13
+#define MC_ColorFormat_BAYER8                     14
+#define MC_ColorFormat_BAYER10                    15
+#define MC_ColorFormat_BAYER12                    16
+#define MC_ColorFormat_BAYER14                    17
+#define MC_ColorFormat_BAYER16                    18
+#define MC_ColorFormat_RGB30                      19
+#define MC_ColorFormat_RGB36                      20
+#define MC_ColorFormat_RGB42                      21
+#define MC_ColorFormat_RGB48                      22
+#define MC_ColorFormat_ARGB32                     23
+#define MC_ColorFormat_RAW8                       24
+#define MC_ColorFormat_RAW10                      25
+#define MC_ColorFormat_RAW12                      26
+#define MC_ColorFormat_RAW14                      27
+#define MC_ColorFormat_RAW16                      28
+#define MC_ColorFormat_Filter                    (MCPARAMID)( 2256 << 14)
+#define MC___ColorFormat_Check                   (MCPARAMID)( 2257 << 14)
+#define MC___ColorFormat_Check_PASS                1
+#define MC___ColorFormat_Check_FAIL                2
+#define MC__BoardType__PICOLO_PRO3I               14
+#define MC_ConnectorCount                        (MCPARAMID)( 2258 << 14)
+#define MC_ColorFormat_RGB24PL                    29
+#define MC_ColorFormat_RGB30PL                    30
+#define MC_ColorFormat_RGB36PL                    31
+#define MC_ColorFormat_RGB42PL                    32
+#define MC_ColorFormat_RGB48PL                    33
+#define MC_ColorFormat_                          (MCPARAMID)( 2259 << 14)
+#define MC_ColorFormat__Y8                        34
+#define MC_ColorFormat__Y10                       35
+#define MC_ColorFormat__Y12                       36
+#define MC_ColorFormat__Y14                       37
+#define MC_ColorFormat__Y16                       38
+#define MC_ColorFormat__BAYER8                    39
+#define MC_ColorFormat__BAYER10                   40
+#define MC_ColorFormat__BAYER12                   41
+#define MC_ColorFormat__BAYER14                   42
+#define MC_ColorFormat__BAYER16                   43
+#define MC_ColorFormat__RGB24                     44
+#define MC_ColorFormat__ARGB32                    45
+#define MC_ColorFormat__RGB24PL                   46
+#define MC_ColorFormat__RGB30PL                   47
+#define MC_ColorFormat__RGB36PL                   48
+#define MC_ColorFormat__RGB42PL                   49
+#define MC_ColorFormat__RGB48PL                   50
+#define MC_ColorFormat__RAW8                      51
+#define MC_ColorFormat__RAW10                     52
+#define MC_ColorFormat__RAW12                     53
+#define MC_ColorFormat__RAW14                     54
+#define MC_ColorFormat__RAW16                     55
+#define MC_ColorFormat__GRABBER                   56
+#define MC_InputConfig_Filter_20                 (MCPARAMID)( 2260 << 14)
+#define MC_InputStyle_Filter_20                  (MCPARAMID)( 2261 << 14)
+#define MC_InputPinName_IO17                      40
+#define MC_InputPinName_IO18                      41
+#define MC_InputPinName_IO19                      42
+#define MC_InputPinName_IO20                      43
+#define MC_OutputPinName_IO17                     48
+#define MC_OutputPinName_IO18                     49
+#define MC_OutputPinName_IO19                     50
+#define MC_OutputPinName_IO20                     51
+#define MC_InputMaxId_1                          (MCPARAMID)( 2262 << 14)
+#define MC_InputMaxId_2                          (MCPARAMID)( 2263 << 14)
+#define MC_InputMaxId_3                          (MCPARAMID)( 2264 << 14)
+#define MC_InputMaxId_4                          (MCPARAMID)( 2265 << 14)
+#define MC_InputMaxId_5                          (MCPARAMID)( 2266 << 14)
+#define MC_InputMaxId_6                          (MCPARAMID)( 2267 << 14)
+#define MC_InputMaxId_7                          (MCPARAMID)( 2268 << 14)
+#define MC_InputMaxId_8                          (MCPARAMID)( 2269 << 14)
+#define MC_InputMaxId_9                          (MCPARAMID)( 2270 << 14)
+#define MC_InputMaxId_10                         (MCPARAMID)( 2271 << 14)
+#define MC_InputMaxId_11                         (MCPARAMID)( 2272 << 14)
+#define MC_InputMaxId_12                         (MCPARAMID)( 2273 << 14)
+#define MC_InputMaxId_13                         (MCPARAMID)( 2274 << 14)
+#define MC_InputMaxId_14                         (MCPARAMID)( 2275 << 14)
+#define MC_InputMaxId_15                         (MCPARAMID)( 2276 << 14)
+#define MC_InputMaxId_16                         (MCPARAMID)( 2277 << 14)
+#define MC_InputMaxId_17                         (MCPARAMID)( 2278 << 14)
+#define MC_InputMaxId_18                         (MCPARAMID)( 2279 << 14)
+#define MC_InputMaxId_19                         (MCPARAMID)( 2280 << 14)
+#define MC_InputMaxId_20                         (MCPARAMID)( 2281 << 14)
+#define MC_OutputConfig_Filter_20                (MCPARAMID)( 2282 << 14)
+#define MC_OutputState_Filter_20                 (MCPARAMID)( 2283 << 14)
+#define MC_OutputStyle_Filter_20                 (MCPARAMID)( 2284 << 14)
+#define MC_OutputState_20                        (MCPARAMID)( 2285 << 14)
+#define MC_OutputState_20_HOLD                     1
+#define MC_OutputState_20_LOW                      2
+#define MC_OutputState_20_HIGH                     3
+#define MC_MIO_0_Present                         (MCPARAMID)( 2286 << 14)
+#define MC_MIO_1_Present                         (MCPARAMID)( 2287 << 14)
+#define MC_MIO_2_Present                         (MCPARAMID)( 2288 << 14)
+#define MC_MIO_3_Present                         (MCPARAMID)( 2289 << 14)
+#define MC_MIO_4_Present                         (MCPARAMID)( 2290 << 14)
+#define MC___InputId_1                           (MCPARAMID)( 2291 << 14)
+#define MC___InputId_2                           (MCPARAMID)( 2292 << 14)
+#define MC___InputId_3                           (MCPARAMID)( 2293 << 14)
+#define MC___InputId_4                           (MCPARAMID)( 2294 << 14)
+#define MC___InputId_5                           (MCPARAMID)( 2295 << 14)
+#define MC___InputId_6                           (MCPARAMID)( 2296 << 14)
+#define MC___InputId_7                           (MCPARAMID)( 2297 << 14)
+#define MC___InputId_8                           (MCPARAMID)( 2298 << 14)
+#define MC___InputId_9                           (MCPARAMID)( 2299 << 14)
+#define MC___InputId_10                          (MCPARAMID)( 2300 << 14)
+#define MC___InputId_11                          (MCPARAMID)( 2301 << 14)
+#define MC___InputId_12                          (MCPARAMID)( 2302 << 14)
+#define MC___InputId_13                          (MCPARAMID)( 2303 << 14)
+#define MC___InputId_14                          (MCPARAMID)( 2304 << 14)
+#define MC___InputId_15                          (MCPARAMID)( 2305 << 14)
+#define MC___InputId_16                          (MCPARAMID)( 2306 << 14)
+#define MC___InputId_17                          (MCPARAMID)( 2307 << 14)
+#define MC___InputId_18                          (MCPARAMID)( 2308 << 14)
+#define MC___InputId_19                          (MCPARAMID)( 2309 << 14)
+#define MC___InputId_20                          (MCPARAMID)( 2310 << 14)
+#define MC___OutputId_1                          (MCPARAMID)( 2311 << 14)
+#define MC_OutputMaxId_1                         (MCPARAMID)( 2312 << 14)
+#define MC___OutputId_2                          (MCPARAMID)( 2313 << 14)
+#define MC_OutputMaxId_2                         (MCPARAMID)( 2314 << 14)
+#define MC___OutputId_3                          (MCPARAMID)( 2315 << 14)
+#define MC_OutputMaxId_3                         (MCPARAMID)( 2316 << 14)
+#define MC___OutputId_4                          (MCPARAMID)( 2317 << 14)
+#define MC_OutputMaxId_4                         (MCPARAMID)( 2318 << 14)
+#define MC___OutputId_5                          (MCPARAMID)( 2319 << 14)
+#define MC_OutputMaxId_5                         (MCPARAMID)( 2320 << 14)
+#define MC___OutputId_6                          (MCPARAMID)( 2321 << 14)
+#define MC_OutputMaxId_6                         (MCPARAMID)( 2322 << 14)
+#define MC___OutputId_7                          (MCPARAMID)( 2323 << 14)
+#define MC_OutputMaxId_7                         (MCPARAMID)( 2324 << 14)
+#define MC___OutputId_8                          (MCPARAMID)( 2325 << 14)
+#define MC_OutputMaxId_8                         (MCPARAMID)( 2326 << 14)
+#define MC___OutputId_9                          (MCPARAMID)( 2327 << 14)
+#define MC_OutputMaxId_9                         (MCPARAMID)( 2328 << 14)
+#define MC___OutputId_10                         (MCPARAMID)( 2329 << 14)
+#define MC_OutputMaxId_10                        (MCPARAMID)( 2330 << 14)
+#define MC___OutputId_11                         (MCPARAMID)( 2331 << 14)
+#define MC_OutputMaxId_11                        (MCPARAMID)( 2332 << 14)
+#define MC___OutputId_12                         (MCPARAMID)( 2333 << 14)
+#define MC_OutputMaxId_12                        (MCPARAMID)( 2334 << 14)
+#define MC___OutputId_13                         (MCPARAMID)( 2335 << 14)
+#define MC_OutputMaxId_13                        (MCPARAMID)( 2336 << 14)
+#define MC___OutputId_14                         (MCPARAMID)( 2337 << 14)
+#define MC_OutputMaxId_14                        (MCPARAMID)( 2338 << 14)
+#define MC___OutputId_15                         (MCPARAMID)( 2339 << 14)
+#define MC_OutputMaxId_15                        (MCPARAMID)( 2340 << 14)
+#define MC___OutputId_16                         (MCPARAMID)( 2341 << 14)
+#define MC_OutputMaxId_16                        (MCPARAMID)( 2342 << 14)
+#define MC___OutputId_17                         (MCPARAMID)( 2343 << 14)
+#define MC_OutputMaxId_17                        (MCPARAMID)( 2344 << 14)
+#define MC___OutputId_18                         (MCPARAMID)( 2345 << 14)
+#define MC_OutputMaxId_18                        (MCPARAMID)( 2346 << 14)
+#define MC___OutputId_19                         (MCPARAMID)( 2347 << 14)
+#define MC_OutputMaxId_19                        (MCPARAMID)( 2348 << 14)
+#define MC___OutputId_20                         (MCPARAMID)( 2349 << 14)
+#define MC_OutputMaxId_20                        (MCPARAMID)( 2350 << 14)
+#define MC___InputId_21                          (MCPARAMID)( 2351 << 14)
+#define MC_InputMaxId_21                         (MCPARAMID)( 2352 << 14)
+#define MC_InputStyle_Filter_21                  (MCPARAMID)( 2353 << 14)
+#define MC___InputId_22                          (MCPARAMID)( 2354 << 14)
+#define MC_InputMaxId_22                         (MCPARAMID)( 2355 << 14)
+#define MC_InputStyle_Filter_22                  (MCPARAMID)( 2356 << 14)
+#define MC___InputId_23                          (MCPARAMID)( 2357 << 14)
+#define MC_InputMaxId_23                         (MCPARAMID)( 2358 << 14)
+#define MC_InputStyle_Filter_23                  (MCPARAMID)( 2359 << 14)
+#define MC___InputId_24                          (MCPARAMID)( 2360 << 14)
+#define MC_InputMaxId_24                         (MCPARAMID)( 2361 << 14)
+#define MC_InputStyle_Filter_24                  (MCPARAMID)( 2362 << 14)
+#define MC___InputId_25                          (MCPARAMID)( 2363 << 14)
+#define MC_InputMaxId_25                         (MCPARAMID)( 2364 << 14)
+#define MC_InputStyle_Filter_25                  (MCPARAMID)( 2365 << 14)
+#define MC___InputId_26                          (MCPARAMID)( 2366 << 14)
+#define MC_InputMaxId_26                         (MCPARAMID)( 2367 << 14)
+#define MC_InputStyle_Filter_26                  (MCPARAMID)( 2368 << 14)
+#define MC___InputId_27                          (MCPARAMID)( 2369 << 14)
+#define MC_InputMaxId_27                         (MCPARAMID)( 2370 << 14)
+#define MC_InputStyle_Filter_27                  (MCPARAMID)( 2371 << 14)
+#define MC___InputId_28                          (MCPARAMID)( 2372 << 14)
+#define MC_InputMaxId_28                         (MCPARAMID)( 2373 << 14)
+#define MC___InputId_29                          (MCPARAMID)( 2374 << 14)
+#define MC_InputMaxId_29                         (MCPARAMID)( 2375 << 14)
+#define MC_InputConfig_Filter_30                 (MCPARAMID)( 2376 << 14)
+#define MC___InputId_30                          (MCPARAMID)( 2377 << 14)
+#define MC_InputMaxId_30                         (MCPARAMID)( 2378 << 14)
+#define MC_InputStyle_Filter_30                  (MCPARAMID)( 2379 << 14)
+#define MC___InputId_31                          (MCPARAMID)( 2380 << 14)
+#define MC_InputMaxId_31                         (MCPARAMID)( 2381 << 14)
+#define MC_InputStyle_Filter_31                  (MCPARAMID)( 2382 << 14)
+#define MC___InputId_32                          (MCPARAMID)( 2383 << 14)
+#define MC_InputMaxId_32                         (MCPARAMID)( 2384 << 14)
+#define MC_InputStyle_Filter_32                  (MCPARAMID)( 2385 << 14)
+#define MC___InputId_33                          (MCPARAMID)( 2386 << 14)
+#define MC_InputMaxId_33                         (MCPARAMID)( 2387 << 14)
+#define MC_InputStyle_Filter_33                  (MCPARAMID)( 2388 << 14)
+#define MC___InputId_34                          (MCPARAMID)( 2389 << 14)
+#define MC_InputMaxId_34                         (MCPARAMID)( 2390 << 14)
+#define MC_InputStyle_Filter_34                  (MCPARAMID)( 2391 << 14)
+#define MC___InputId_35                          (MCPARAMID)( 2392 << 14)
+#define MC_InputMaxId_35                         (MCPARAMID)( 2393 << 14)
+#define MC_InputStyle_Filter_35                  (MCPARAMID)( 2394 << 14)
+#define MC___InputId_36                          (MCPARAMID)( 2395 << 14)
+#define MC_InputMaxId_36                         (MCPARAMID)( 2396 << 14)
+#define MC_InputStyle_Filter_36                  (MCPARAMID)( 2397 << 14)
+#define MC___InputId_37                          (MCPARAMID)( 2398 << 14)
+#define MC_InputMaxId_37                         (MCPARAMID)( 2399 << 14)
+#define MC_InputStyle_Filter_37                  (MCPARAMID)( 2400 << 14)
+#define MC___InputId_38                          (MCPARAMID)( 2401 << 14)
+#define MC_InputMaxId_38                         (MCPARAMID)( 2402 << 14)
+#define MC___InputId_39                          (MCPARAMID)( 2403 << 14)
+#define MC_InputMaxId_39                         (MCPARAMID)( 2404 << 14)
+#define MC_InputConfig_Filter_40                 (MCPARAMID)( 2405 << 14)
+#define MC___InputId_40                          (MCPARAMID)( 2406 << 14)
+#define MC_InputMaxId_40                         (MCPARAMID)( 2407 << 14)
+#define MC_InputStyle_Filter_40                  (MCPARAMID)( 2408 << 14)
+#define MC_InputPinName_I1_0                      44
+#define MC_InputPinName_I2_0                      45
+#define MC_InputPinName_I3_0                      46
+#define MC_InputPinName_I4_0                      47
+#define MC_InputPinName_I1_1                      48
+#define MC_InputPinName_I2_1                      49
+#define MC_InputPinName_I3_1                      50
+#define MC_InputPinName_I4_1                      51
+#define MC_InputPinName_I1_2                      52
+#define MC_InputPinName_I2_2                      53
+#define MC_InputPinName_I3_2                      54
+#define MC_InputPinName_I4_2                      55
+#define MC_InputPinName_I1_3                      56
+#define MC_InputPinName_I2_3                      57
+#define MC_InputPinName_I3_3                      58
+#define MC_InputPinName_I4_3                      59
+#define MC_InputPinName_I1_4                      60
+#define MC_InputPinName_I2_4                      61
+#define MC_InputPinName_I3_4                      62
+#define MC_InputPinName_I4_4                      63
+#define MC___OutputId_21                         (MCPARAMID)( 2409 << 14)
+#define MC_OutputMaxId_21                        (MCPARAMID)( 2410 << 14)
+#define MC___OutputId_22                         (MCPARAMID)( 2411 << 14)
+#define MC_OutputMaxId_22                        (MCPARAMID)( 2412 << 14)
+#define MC___OutputId_23                         (MCPARAMID)( 2413 << 14)
+#define MC_OutputMaxId_23                        (MCPARAMID)( 2414 << 14)
+#define MC___OutputId_24                         (MCPARAMID)( 2415 << 14)
+#define MC_OutputMaxId_24                        (MCPARAMID)( 2416 << 14)
+#define MC_OutputConfig_Filter_25                (MCPARAMID)( 2417 << 14)
+#define MC___OutputId_25                         (MCPARAMID)( 2418 << 14)
+#define MC_OutputMaxId_25                        (MCPARAMID)( 2419 << 14)
+#define MC_OutputState_Filter_25                 (MCPARAMID)( 2420 << 14)
+#define MC_OutputStyle_Filter_25                 (MCPARAMID)( 2421 << 14)
+#define MC_OutputState_25                        (MCPARAMID)( 2422 << 14)
+#define MC_OutputState_25_HOLD                     1
+#define MC_OutputState_25_LOW                      2
+#define MC_OutputState_25_HIGH                     3
+#define MC_OutputConfig_Filter_26                (MCPARAMID)( 2423 << 14)
+#define MC___OutputId_26                         (MCPARAMID)( 2424 << 14)
+#define MC_OutputMaxId_26                        (MCPARAMID)( 2425 << 14)
+#define MC_OutputState_Filter_26                 (MCPARAMID)( 2426 << 14)
+#define MC_OutputStyle_Filter_26                 (MCPARAMID)( 2427 << 14)
+#define MC_OutputState_26                        (MCPARAMID)( 2428 << 14)
+#define MC_OutputState_26_HOLD                     1
+#define MC_OutputState_26_LOW                      2
+#define MC_OutputState_26_HIGH                     3
+#define MC_OutputConfig_Filter_27                (MCPARAMID)( 2429 << 14)
+#define MC___OutputId_27                         (MCPARAMID)( 2430 << 14)
+#define MC_OutputMaxId_27                        (MCPARAMID)( 2431 << 14)
+#define MC_OutputState_Filter_27                 (MCPARAMID)( 2432 << 14)
+#define MC_OutputStyle_Filter_27                 (MCPARAMID)( 2433 << 14)
+#define MC_OutputState_27                        (MCPARAMID)( 2434 << 14)
+#define MC_OutputState_27_HOLD                     1
+#define MC_OutputState_27_LOW                      2
+#define MC_OutputState_27_HIGH                     3
+#define MC___OutputId_28                         (MCPARAMID)( 2435 << 14)
+#define MC_OutputMaxId_28                        (MCPARAMID)( 2436 << 14)
+#define MC___OutputId_29                         (MCPARAMID)( 2437 << 14)
+#define MC_OutputMaxId_29                        (MCPARAMID)( 2438 << 14)
+#define MC_OutputConfig_Filter_30                (MCPARAMID)( 2439 << 14)
+#define MC___OutputId_30                         (MCPARAMID)( 2440 << 14)
+#define MC_OutputMaxId_30                        (MCPARAMID)( 2441 << 14)
+#define MC_OutputState_Filter_30                 (MCPARAMID)( 2442 << 14)
+#define MC_OutputStyle_Filter_30                 (MCPARAMID)( 2443 << 14)
+#define MC_OutputState_30                        (MCPARAMID)( 2444 << 14)
+#define MC_OutputState_30_HOLD                     1
+#define MC_OutputState_30_LOW                      2
+#define MC_OutputState_30_HIGH                     3
+#define MC___OutputId_31                         (MCPARAMID)( 2445 << 14)
+#define MC_OutputMaxId_31                        (MCPARAMID)( 2446 << 14)
+#define MC___OutputId_32                         (MCPARAMID)( 2447 << 14)
+#define MC_OutputMaxId_32                        (MCPARAMID)( 2448 << 14)
+#define MC___OutputId_33                         (MCPARAMID)( 2449 << 14)
+#define MC_OutputMaxId_33                        (MCPARAMID)( 2450 << 14)
+#define MC___OutputId_34                         (MCPARAMID)( 2451 << 14)
+#define MC_OutputMaxId_34                        (MCPARAMID)( 2452 << 14)
+#define MC_OutputConfig_Filter_35                (MCPARAMID)( 2453 << 14)
+#define MC___OutputId_35                         (MCPARAMID)( 2454 << 14)
+#define MC_OutputMaxId_35                        (MCPARAMID)( 2455 << 14)
+#define MC_OutputState_Filter_35                 (MCPARAMID)( 2456 << 14)
+#define MC_OutputStyle_Filter_35                 (MCPARAMID)( 2457 << 14)
+#define MC_OutputState_35                        (MCPARAMID)( 2458 << 14)
+#define MC_OutputState_35_HOLD                     1
+#define MC_OutputState_35_LOW                      2
+#define MC_OutputState_35_HIGH                     3
+#define MC_OutputConfig_Filter_36                (MCPARAMID)( 2459 << 14)
+#define MC___OutputId_36                         (MCPARAMID)( 2460 << 14)
+#define MC_OutputMaxId_36                        (MCPARAMID)( 2461 << 14)
+#define MC_OutputState_Filter_36                 (MCPARAMID)( 2462 << 14)
+#define MC_OutputStyle_Filter_36                 (MCPARAMID)( 2463 << 14)
+#define MC_OutputState_36                        (MCPARAMID)( 2464 << 14)
+#define MC_OutputState_36_HOLD                     1
+#define MC_OutputState_36_LOW                      2
+#define MC_OutputState_36_HIGH                     3
+#define MC_OutputConfig_Filter_37                (MCPARAMID)( 2465 << 14)
+#define MC___OutputId_37                         (MCPARAMID)( 2466 << 14)
+#define MC_OutputMaxId_37                        (MCPARAMID)( 2467 << 14)
+#define MC_OutputState_Filter_37                 (MCPARAMID)( 2468 << 14)
+#define MC_OutputStyle_Filter_37                 (MCPARAMID)( 2469 << 14)
+#define MC_OutputState_37                        (MCPARAMID)( 2470 << 14)
+#define MC_OutputState_37_HOLD                     1
+#define MC_OutputState_37_LOW                      2
+#define MC_OutputState_37_HIGH                     3
+#define MC___OutputId_38                         (MCPARAMID)( 2471 << 14)
+#define MC_OutputMaxId_38                        (MCPARAMID)( 2472 << 14)
+#define MC___OutputId_39                         (MCPARAMID)( 2473 << 14)
+#define MC_OutputMaxId_39                        (MCPARAMID)( 2474 << 14)
+#define MC_OutputConfig_Filter_40                (MCPARAMID)( 2475 << 14)
+#define MC___OutputId_40                         (MCPARAMID)( 2476 << 14)
+#define MC_OutputMaxId_40                        (MCPARAMID)( 2477 << 14)
+#define MC_OutputState_Filter_40                 (MCPARAMID)( 2478 << 14)
+#define MC_OutputStyle_Filter_40                 (MCPARAMID)( 2479 << 14)
+#define MC_OutputState_40                        (MCPARAMID)( 2480 << 14)
+#define MC_OutputState_40_HOLD                     1
+#define MC_OutputState_40_LOW                      2
+#define MC_OutputState_40_HIGH                     3
+#define MC_OutputPinName_O1_0                     52
+#define MC_OutputPinName_O2_0                     53
+#define MC_OutputPinName_O3_0                     54
+#define MC_OutputPinName_O4_0                     55
+#define MC_OutputPinName_O1_1                     56
+#define MC_OutputPinName_O2_1                     57
+#define MC_OutputPinName_O3_1                     58
+#define MC_OutputPinName_O4_1                     59
+#define MC_OutputPinName_O1_2                     60
+#define MC_OutputPinName_O2_2                     61
+#define MC_OutputPinName_O3_2                     62
+#define MC_OutputPinName_O4_2                     63
+#define MC_OutputPinName_O1_3                     64
+#define MC_OutputPinName_O2_3                     65
+#define MC_OutputPinName_O3_3                     66
+#define MC_OutputPinName_O4_3                     67
+#define MC_OutputPinName_O1_4                     68
+#define MC_OutputPinName_O2_4                     69
+#define MC_OutputPinName_O3_4                     70
+#define MC_OutputPinName_O4_4                     71
+#define MC_ColorTrap                             (MCPARAMID)( 2481 << 14)
+#define MC_ColorTrap_ENABLE                        1
+#define MC_ColorTrap_DISABLE                       2
+#define MC_ColorKiller                           (MCPARAMID)( 2482 << 14)
+#define MC_ColorKiller_ENABLE                      1
+#define MC_ColorKiller_DISABLE                     2
+#define MC_DataCoring                            (MCPARAMID)( 2483 << 14)
+#define MC_DataCoring_NONE                         1
+#define MC_DataCoring_CORING8                      2
+#define MC_DataCoring_CORING16                     3
+#define MC_DataCoring_CORING32                     4
+#define MC_DataRange                             (MCPARAMID)( 2484 << 14)
+#define MC_DataRange_FULL                          1
+#define MC_DataRange_RESTRICT                      2
+#define MC_GammaRemoval                          (MCPARAMID)( 2485 << 14)
+#define MC_GammaRemoval_ENABLE                     1
+#define MC_GammaRemoval_DISABLE                    2
+#define MC_MaxInputIndex                         (MCPARAMID)( 2486 << 14)
+#define MC_MaxOutputIndex                        (MCPARAMID)( 2487 << 14)
+#define MC_BoardTopology_1_11_0                   26
+#define MC_BoardTopology_1_01_2                   27
+#define MC_BoardTopology_1_2_0                    28
+#define MC_Connector_YC                           36
+#define MC_InputPinName_I1                        64
+#define MC_InputPinName_I2                        65
+#define MC_InputPinName_I3                        66
+#define MC_InputPinName_I4                        67
+#define MC_OutputPinName_O1                       72
+#define MC_OutputPinName_O2                       73
+#define MC_OutputPinName_O3                       74
+#define MC_OutputPinName_O4                       75
+#define MC_InputConfig_Filter_MC_MV0_IN1         (MCPARAMID)( 2488 << 14)
+#define MC___InputId_MC_MV0_IN1                  (MCPARAMID)( 2489 << 14)
+#define MC_InputMaxId_MC_MV0_IN1                 (MCPARAMID)( 2490 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN1          (MCPARAMID)( 2491 << 14)
+#define MC_InputConfig_Filter_MC_MV0_IN2         (MCPARAMID)( 2492 << 14)
+#define MC___InputId_MC_MV0_IN2                  (MCPARAMID)( 2493 << 14)
+#define MC_InputMaxId_MC_MV0_IN2                 (MCPARAMID)( 2494 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN2          (MCPARAMID)( 2495 << 14)
+#define MC_InputConfig_Filter_MC_MV0_IN3         (MCPARAMID)( 2496 << 14)
+#define MC___InputId_MC_MV0_IN3                  (MCPARAMID)( 2497 << 14)
+#define MC_InputMaxId_MC_MV0_IN3                 (MCPARAMID)( 2498 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN3          (MCPARAMID)( 2499 << 14)
+#define MC_InputConfig_Filter_MC_MV0_IN4         (MCPARAMID)( 2500 << 14)
+#define MC___InputId_MC_MV0_IN4                  (MCPARAMID)( 2501 << 14)
+#define MC_InputMaxId_MC_MV0_IN4                 (MCPARAMID)( 2502 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN4          (MCPARAMID)( 2503 << 14)
+#define MC_InputConfig_Filter_MC_MV0_IN5         (MCPARAMID)( 2504 << 14)
+#define MC___InputId_MC_MV0_IN5                  (MCPARAMID)( 2505 << 14)
+#define MC_InputMaxId_MC_MV0_IN5                 (MCPARAMID)( 2506 << 14)
+#define MC_InputStyle_Filter_MC_MV0_IN5          (MCPARAMID)( 2507 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN1         (MCPARAMID)( 2508 << 14)
+#define MC___InputId_MC_MV1_IN1                  (MCPARAMID)( 2509 << 14)
+#define MC_InputMaxId_MC_MV1_IN1                 (MCPARAMID)( 2510 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN1          (MCPARAMID)( 2511 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN2         (MCPARAMID)( 2512 << 14)
+#define MC___InputId_MC_MV1_IN2                  (MCPARAMID)( 2513 << 14)
+#define MC_InputMaxId_MC_MV1_IN2                 (MCPARAMID)( 2514 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN2          (MCPARAMID)( 2515 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN3         (MCPARAMID)( 2516 << 14)
+#define MC___InputId_MC_MV1_IN3                  (MCPARAMID)( 2517 << 14)
+#define MC_InputMaxId_MC_MV1_IN3                 (MCPARAMID)( 2518 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN3          (MCPARAMID)( 2519 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN4         (MCPARAMID)( 2520 << 14)
+#define MC___InputId_MC_MV1_IN4                  (MCPARAMID)( 2521 << 14)
+#define MC_InputMaxId_MC_MV1_IN4                 (MCPARAMID)( 2522 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN4          (MCPARAMID)( 2523 << 14)
+#define MC_InputConfig_Filter_MC_MV1_IN5         (MCPARAMID)( 2524 << 14)
+#define MC___InputId_MC_MV1_IN5                  (MCPARAMID)( 2525 << 14)
+#define MC_InputMaxId_MC_MV1_IN5                 (MCPARAMID)( 2526 << 14)
+#define MC_InputStyle_Filter_MC_MV1_IN5          (MCPARAMID)( 2527 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN1         (MCPARAMID)( 2528 << 14)
+#define MC___InputId_MC_MV2_IN1                  (MCPARAMID)( 2529 << 14)
+#define MC_InputMaxId_MC_MV2_IN1                 (MCPARAMID)( 2530 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN1          (MCPARAMID)( 2531 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN2         (MCPARAMID)( 2532 << 14)
+#define MC___InputId_MC_MV2_IN2                  (MCPARAMID)( 2533 << 14)
+#define MC_InputMaxId_MC_MV2_IN2                 (MCPARAMID)( 2534 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN2          (MCPARAMID)( 2535 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN3         (MCPARAMID)( 2536 << 14)
+#define MC___InputId_MC_MV2_IN3                  (MCPARAMID)( 2537 << 14)
+#define MC_InputMaxId_MC_MV2_IN3                 (MCPARAMID)( 2538 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN3          (MCPARAMID)( 2539 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN4         (MCPARAMID)( 2540 << 14)
+#define MC___InputId_MC_MV2_IN4                  (MCPARAMID)( 2541 << 14)
+#define MC_InputMaxId_MC_MV2_IN4                 (MCPARAMID)( 2542 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN4          (MCPARAMID)( 2543 << 14)
+#define MC_InputConfig_Filter_MC_MV2_IN5         (MCPARAMID)( 2544 << 14)
+#define MC___InputId_MC_MV2_IN5                  (MCPARAMID)( 2545 << 14)
+#define MC_InputMaxId_MC_MV2_IN5                 (MCPARAMID)( 2546 << 14)
+#define MC_InputStyle_Filter_MC_MV2_IN5          (MCPARAMID)( 2547 << 14)
+#define MC_InputConfig_Filter_MC_MIO0_IN1        (MCPARAMID)( 2548 << 14)
+#define MC___InputId_MC_MIO0_IN1                 (MCPARAMID)( 2549 << 14)
+#define MC_InputMaxId_MC_MIO0_IN1                (MCPARAMID)( 2550 << 14)
+#define MC_InputStyle_Filter_MC_MIO0_IN1         (MCPARAMID)( 2551 << 14)
+#define MC_InputConfig_Filter_MC_MIO0_IN2        (MCPARAMID)( 2552 << 14)
+#define MC___InputId_MC_MIO0_IN2                 (MCPARAMID)( 2553 << 14)
+#define MC_InputMaxId_MC_MIO0_IN2                (MCPARAMID)( 2554 << 14)
+#define MC_InputStyle_Filter_MC_MIO0_IN2         (MCPARAMID)( 2555 << 14)
+#define MC_InputConfig_Filter_MC_MIO0_IN3        (MCPARAMID)( 2556 << 14)
+#define MC___InputId_MC_MIO0_IN3                 (MCPARAMID)( 2557 << 14)
+#define MC_InputMaxId_MC_MIO0_IN3                (MCPARAMID)( 2558 << 14)
+#define MC_InputStyle_Filter_MC_MIO0_IN3         (MCPARAMID)( 2559 << 14)
+#define MC_InputConfig_Filter_MC_MIO0_IN4        (MCPARAMID)( 2560 << 14)
+#define MC___InputId_MC_MIO0_IN4                 (MCPARAMID)( 2561 << 14)
+#define MC_InputMaxId_MC_MIO0_IN4                (MCPARAMID)( 2562 << 14)
+#define MC_InputStyle_Filter_MC_MIO0_IN4         (MCPARAMID)( 2563 << 14)
+#define MC_InputConfig_Filter_MC_MIO1_IN1        (MCPARAMID)( 2564 << 14)
+#define MC___InputId_MC_MIO1_IN1                 (MCPARAMID)( 2565 << 14)
+#define MC_InputMaxId_MC_MIO1_IN1                (MCPARAMID)( 2566 << 14)
+#define MC_InputStyle_Filter_MC_MIO1_IN1         (MCPARAMID)( 2567 << 14)
+#define MC_InputConfig_Filter_MC_MIO1_IN2        (MCPARAMID)( 2568 << 14)
+#define MC___InputId_MC_MIO1_IN2                 (MCPARAMID)( 2569 << 14)
+#define MC_InputMaxId_MC_MIO1_IN2                (MCPARAMID)( 2570 << 14)
+#define MC_InputStyle_Filter_MC_MIO1_IN2         (MCPARAMID)( 2571 << 14)
+#define MC_InputConfig_Filter_MC_MIO1_IN3        (MCPARAMID)( 2572 << 14)
+#define MC___InputId_MC_MIO1_IN3                 (MCPARAMID)( 2573 << 14)
+#define MC_InputMaxId_MC_MIO1_IN3                (MCPARAMID)( 2574 << 14)
+#define MC_InputStyle_Filter_MC_MIO1_IN3         (MCPARAMID)( 2575 << 14)
+#define MC_InputConfig_Filter_MC_MIO1_IN4        (MCPARAMID)( 2576 << 14)
+#define MC___InputId_MC_MIO1_IN4                 (MCPARAMID)( 2577 << 14)
+#define MC_InputMaxId_MC_MIO1_IN4                (MCPARAMID)( 2578 << 14)
+#define MC_InputStyle_Filter_MC_MIO1_IN4         (MCPARAMID)( 2579 << 14)
+#define MC_InputConfig_Filter_MC_MIO2_IN1        (MCPARAMID)( 2580 << 14)
+#define MC___InputId_MC_MIO2_IN1                 (MCPARAMID)( 2581 << 14)
+#define MC_InputMaxId_MC_MIO2_IN1                (MCPARAMID)( 2582 << 14)
+#define MC_InputStyle_Filter_MC_MIO2_IN1         (MCPARAMID)( 2583 << 14)
+#define MC_InputConfig_Filter_MC_MIO2_IN2        (MCPARAMID)( 2584 << 14)
+#define MC___InputId_MC_MIO2_IN2                 (MCPARAMID)( 2585 << 14)
+#define MC_InputMaxId_MC_MIO2_IN2                (MCPARAMID)( 2586 << 14)
+#define MC_InputStyle_Filter_MC_MIO2_IN2         (MCPARAMID)( 2587 << 14)
+#define MC_InputConfig_Filter_MC_MIO2_IN3        (MCPARAMID)( 2588 << 14)
+#define MC___InputId_MC_MIO2_IN3                 (MCPARAMID)( 2589 << 14)
+#define MC_InputMaxId_MC_MIO2_IN3                (MCPARAMID)( 2590 << 14)
+#define MC_InputStyle_Filter_MC_MIO2_IN3         (MCPARAMID)( 2591 << 14)
+#define MC_InputConfig_Filter_MC_MIO2_IN4        (MCPARAMID)( 2592 << 14)
+#define MC___InputId_MC_MIO2_IN4                 (MCPARAMID)( 2593 << 14)
+#define MC_InputMaxId_MC_MIO2_IN4                (MCPARAMID)( 2594 << 14)
+#define MC_InputStyle_Filter_MC_MIO2_IN4         (MCPARAMID)( 2595 << 14)
+#define MC_InputConfig_Filter_MC_MIO3_IN1        (MCPARAMID)( 2596 << 14)
+#define MC___InputId_MC_MIO3_IN1                 (MCPARAMID)( 2597 << 14)
+#define MC_InputMaxId_MC_MIO3_IN1                (MCPARAMID)( 2598 << 14)
+#define MC_InputStyle_Filter_MC_MIO3_IN1         (MCPARAMID)( 2599 << 14)
+#define MC_InputConfig_Filter_MC_MIO3_IN2        (MCPARAMID)( 2600 << 14)
+#define MC___InputId_MC_MIO3_IN2                 (MCPARAMID)( 2601 << 14)
+#define MC_InputMaxId_MC_MIO3_IN2                (MCPARAMID)( 2602 << 14)
+#define MC_InputStyle_Filter_MC_MIO3_IN2         (MCPARAMID)( 2603 << 14)
+#define MC_InputConfig_Filter_MC_MIO3_IN3        (MCPARAMID)( 2604 << 14)
+#define MC___InputId_MC_MIO3_IN3                 (MCPARAMID)( 2605 << 14)
+#define MC_InputMaxId_MC_MIO3_IN3                (MCPARAMID)( 2606 << 14)
+#define MC_InputStyle_Filter_MC_MIO3_IN3         (MCPARAMID)( 2607 << 14)
+#define MC_InputConfig_Filter_MC_MIO3_IN4        (MCPARAMID)( 2608 << 14)
+#define MC___InputId_MC_MIO3_IN4                 (MCPARAMID)( 2609 << 14)
+#define MC_InputMaxId_MC_MIO3_IN4                (MCPARAMID)( 2610 << 14)
+#define MC_InputStyle_Filter_MC_MIO3_IN4         (MCPARAMID)( 2611 << 14)
+#define MC_InputConfig_Filter_MC_MIO4_IN1        (MCPARAMID)( 2612 << 14)
+#define MC___InputId_MC_MIO4_IN1                 (MCPARAMID)( 2613 << 14)
+#define MC_InputMaxId_MC_MIO4_IN1                (MCPARAMID)( 2614 << 14)
+#define MC_InputStyle_Filter_MC_MIO4_IN1         (MCPARAMID)( 2615 << 14)
+#define MC_InputConfig_Filter_MC_MIO4_IN2        (MCPARAMID)( 2616 << 14)
+#define MC___InputId_MC_MIO4_IN2                 (MCPARAMID)( 2617 << 14)
+#define MC_InputMaxId_MC_MIO4_IN2                (MCPARAMID)( 2618 << 14)
+#define MC_InputStyle_Filter_MC_MIO4_IN2         (MCPARAMID)( 2619 << 14)
+#define MC_InputConfig_Filter_MC_MIO4_IN3        (MCPARAMID)( 2620 << 14)
+#define MC___InputId_MC_MIO4_IN3                 (MCPARAMID)( 2621 << 14)
+#define MC_InputMaxId_MC_MIO4_IN3                (MCPARAMID)( 2622 << 14)
+#define MC_InputStyle_Filter_MC_MIO4_IN3         (MCPARAMID)( 2623 << 14)
+#define MC_InputConfig_Filter_MC_MIO4_IN4        (MCPARAMID)( 2624 << 14)
+#define MC___InputId_MC_MIO4_IN4                 (MCPARAMID)( 2625 << 14)
+#define MC_InputMaxId_MC_MIO4_IN4                (MCPARAMID)( 2626 << 14)
+#define MC_InputStyle_Filter_MC_MIO4_IN4         (MCPARAMID)( 2627 << 14)
+#define MC_OutputConfig_Filter_MC_MV0_OUT1       (MCPARAMID)( 2628 << 14)
+#define MC___OutputId_MC_MV0_OUT1                (MCPARAMID)( 2629 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT1               (MCPARAMID)( 2630 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT1        (MCPARAMID)( 2631 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT1        (MCPARAMID)( 2632 << 14)
+#define MC_OutputState_MC_MV0_OUT1               (MCPARAMID)( 2633 << 14)
+#define MC_OutputState_MC_MV0_OUT1_HOLD            1
+#define MC_OutputState_MC_MV0_OUT1_LOW             2
+#define MC_OutputState_MC_MV0_OUT1_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV0_OUT2       (MCPARAMID)( 2634 << 14)
+#define MC___OutputId_MC_MV0_OUT2                (MCPARAMID)( 2635 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT2               (MCPARAMID)( 2636 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT2        (MCPARAMID)( 2637 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT2        (MCPARAMID)( 2638 << 14)
+#define MC_OutputState_MC_MV0_OUT2               (MCPARAMID)( 2639 << 14)
+#define MC_OutputState_MC_MV0_OUT2_HOLD            1
+#define MC_OutputState_MC_MV0_OUT2_LOW             2
+#define MC_OutputState_MC_MV0_OUT2_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV0_OUT3       (MCPARAMID)( 2640 << 14)
+#define MC___OutputId_MC_MV0_OUT3                (MCPARAMID)( 2641 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT3               (MCPARAMID)( 2642 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT3        (MCPARAMID)( 2643 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT3        (MCPARAMID)( 2644 << 14)
+#define MC_OutputState_MC_MV0_OUT3               (MCPARAMID)( 2645 << 14)
+#define MC_OutputState_MC_MV0_OUT3_HOLD            1
+#define MC_OutputState_MC_MV0_OUT3_LOW             2
+#define MC_OutputState_MC_MV0_OUT3_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV0_OUT4       (MCPARAMID)( 2646 << 14)
+#define MC___OutputId_MC_MV0_OUT4                (MCPARAMID)( 2647 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT4               (MCPARAMID)( 2648 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT4        (MCPARAMID)( 2649 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT4        (MCPARAMID)( 2650 << 14)
+#define MC_OutputState_MC_MV0_OUT4               (MCPARAMID)( 2651 << 14)
+#define MC_OutputState_MC_MV0_OUT4_HOLD            1
+#define MC_OutputState_MC_MV0_OUT4_LOW             2
+#define MC_OutputState_MC_MV0_OUT4_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV0_OUT5       (MCPARAMID)( 2652 << 14)
+#define MC___OutputId_MC_MV0_OUT5                (MCPARAMID)( 2653 << 14)
+#define MC_OutputMaxId_MC_MV0_OUT5               (MCPARAMID)( 2654 << 14)
+#define MC_OutputState_Filter_MC_MV0_OUT5        (MCPARAMID)( 2655 << 14)
+#define MC_OutputStyle_Filter_MC_MV0_OUT5        (MCPARAMID)( 2656 << 14)
+#define MC_OutputState_MC_MV0_OUT5               (MCPARAMID)( 2657 << 14)
+#define MC_OutputState_MC_MV0_OUT5_HOLD            1
+#define MC_OutputState_MC_MV0_OUT5_LOW             2
+#define MC_OutputState_MC_MV0_OUT5_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT1       (MCPARAMID)( 2658 << 14)
+#define MC___OutputId_MC_MV1_OUT1                (MCPARAMID)( 2659 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT1               (MCPARAMID)( 2660 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT1        (MCPARAMID)( 2661 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT1        (MCPARAMID)( 2662 << 14)
+#define MC_OutputState_MC_MV1_OUT1               (MCPARAMID)( 2663 << 14)
+#define MC_OutputState_MC_MV1_OUT1_HOLD            1
+#define MC_OutputState_MC_MV1_OUT1_LOW             2
+#define MC_OutputState_MC_MV1_OUT1_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT2       (MCPARAMID)( 2664 << 14)
+#define MC___OutputId_MC_MV1_OUT2                (MCPARAMID)( 2665 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT2               (MCPARAMID)( 2666 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT2        (MCPARAMID)( 2667 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT2        (MCPARAMID)( 2668 << 14)
+#define MC_OutputState_MC_MV1_OUT2               (MCPARAMID)( 2669 << 14)
+#define MC_OutputState_MC_MV1_OUT2_HOLD            1
+#define MC_OutputState_MC_MV1_OUT2_LOW             2
+#define MC_OutputState_MC_MV1_OUT2_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT3       (MCPARAMID)( 2670 << 14)
+#define MC___OutputId_MC_MV1_OUT3                (MCPARAMID)( 2671 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT3               (MCPARAMID)( 2672 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT3        (MCPARAMID)( 2673 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT3        (MCPARAMID)( 2674 << 14)
+#define MC_OutputState_MC_MV1_OUT3               (MCPARAMID)( 2675 << 14)
+#define MC_OutputState_MC_MV1_OUT3_HOLD            1
+#define MC_OutputState_MC_MV1_OUT3_LOW             2
+#define MC_OutputState_MC_MV1_OUT3_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT4       (MCPARAMID)( 2676 << 14)
+#define MC___OutputId_MC_MV1_OUT4                (MCPARAMID)( 2677 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT4               (MCPARAMID)( 2678 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT4        (MCPARAMID)( 2679 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT4        (MCPARAMID)( 2680 << 14)
+#define MC_OutputState_MC_MV1_OUT4               (MCPARAMID)( 2681 << 14)
+#define MC_OutputState_MC_MV1_OUT4_HOLD            1
+#define MC_OutputState_MC_MV1_OUT4_LOW             2
+#define MC_OutputState_MC_MV1_OUT4_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV1_OUT5       (MCPARAMID)( 2682 << 14)
+#define MC___OutputId_MC_MV1_OUT5                (MCPARAMID)( 2683 << 14)
+#define MC_OutputMaxId_MC_MV1_OUT5               (MCPARAMID)( 2684 << 14)
+#define MC_OutputState_Filter_MC_MV1_OUT5        (MCPARAMID)( 2685 << 14)
+#define MC_OutputStyle_Filter_MC_MV1_OUT5        (MCPARAMID)( 2686 << 14)
+#define MC_OutputState_MC_MV1_OUT5               (MCPARAMID)( 2687 << 14)
+#define MC_OutputState_MC_MV1_OUT5_HOLD            1
+#define MC_OutputState_MC_MV1_OUT5_LOW             2
+#define MC_OutputState_MC_MV1_OUT5_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT1       (MCPARAMID)( 2688 << 14)
+#define MC___OutputId_MC_MV2_OUT1                (MCPARAMID)( 2689 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT1               (MCPARAMID)( 2690 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT1        (MCPARAMID)( 2691 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT1        (MCPARAMID)( 2692 << 14)
+#define MC_OutputState_MC_MV2_OUT1               (MCPARAMID)( 2693 << 14)
+#define MC_OutputState_MC_MV2_OUT1_HOLD            1
+#define MC_OutputState_MC_MV2_OUT1_LOW             2
+#define MC_OutputState_MC_MV2_OUT1_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT2       (MCPARAMID)( 2694 << 14)
+#define MC___OutputId_MC_MV2_OUT2                (MCPARAMID)( 2695 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT2               (MCPARAMID)( 2696 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT2        (MCPARAMID)( 2697 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT2        (MCPARAMID)( 2698 << 14)
+#define MC_OutputState_MC_MV2_OUT2               (MCPARAMID)( 2699 << 14)
+#define MC_OutputState_MC_MV2_OUT2_HOLD            1
+#define MC_OutputState_MC_MV2_OUT2_LOW             2
+#define MC_OutputState_MC_MV2_OUT2_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT3       (MCPARAMID)( 2700 << 14)
+#define MC___OutputId_MC_MV2_OUT3                (MCPARAMID)( 2701 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT3               (MCPARAMID)( 2702 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT3        (MCPARAMID)( 2703 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT3        (MCPARAMID)( 2704 << 14)
+#define MC_OutputState_MC_MV2_OUT3               (MCPARAMID)( 2705 << 14)
+#define MC_OutputState_MC_MV2_OUT3_HOLD            1
+#define MC_OutputState_MC_MV2_OUT3_LOW             2
+#define MC_OutputState_MC_MV2_OUT3_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT4       (MCPARAMID)( 2706 << 14)
+#define MC___OutputId_MC_MV2_OUT4                (MCPARAMID)( 2707 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT4               (MCPARAMID)( 2708 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT4        (MCPARAMID)( 2709 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT4        (MCPARAMID)( 2710 << 14)
+#define MC_OutputState_MC_MV2_OUT4               (MCPARAMID)( 2711 << 14)
+#define MC_OutputState_MC_MV2_OUT4_HOLD            1
+#define MC_OutputState_MC_MV2_OUT4_LOW             2
+#define MC_OutputState_MC_MV2_OUT4_HIGH            3
+#define MC_OutputConfig_Filter_MC_MV2_OUT5       (MCPARAMID)( 2712 << 14)
+#define MC___OutputId_MC_MV2_OUT5                (MCPARAMID)( 2713 << 14)
+#define MC_OutputMaxId_MC_MV2_OUT5               (MCPARAMID)( 2714 << 14)
+#define MC_OutputState_Filter_MC_MV2_OUT5        (MCPARAMID)( 2715 << 14)
+#define MC_OutputStyle_Filter_MC_MV2_OUT5        (MCPARAMID)( 2716 << 14)
+#define MC_OutputState_MC_MV2_OUT5               (MCPARAMID)( 2717 << 14)
+#define MC_OutputState_MC_MV2_OUT5_HOLD            1
+#define MC_OutputState_MC_MV2_OUT5_LOW             2
+#define MC_OutputState_MC_MV2_OUT5_HIGH            3
+#define MC_OutputConfig_Filter_MC_MIO0_OUT1      (MCPARAMID)( 2718 << 14)
+#define MC___OutputId_MC_MIO0_OUT1               (MCPARAMID)( 2719 << 14)
+#define MC_OutputMaxId_MC_MIO0_OUT1              (MCPARAMID)( 2720 << 14)
+#define MC_OutputState_Filter_MC_MIO0_OUT1       (MCPARAMID)( 2721 << 14)
+#define MC_OutputStyle_Filter_MC_MIO0_OUT1       (MCPARAMID)( 2722 << 14)
+#define MC_OutputState_MC_MIO0_OUT1              (MCPARAMID)( 2723 << 14)
+#define MC_OutputState_MC_MIO0_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO0_OUT1_LOW            2
+#define MC_OutputState_MC_MIO0_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO0_OUT2      (MCPARAMID)( 2724 << 14)
+#define MC___OutputId_MC_MIO0_OUT2               (MCPARAMID)( 2725 << 14)
+#define MC_OutputMaxId_MC_MIO0_OUT2              (MCPARAMID)( 2726 << 14)
+#define MC_OutputState_Filter_MC_MIO0_OUT2       (MCPARAMID)( 2727 << 14)
+#define MC_OutputStyle_Filter_MC_MIO0_OUT2       (MCPARAMID)( 2728 << 14)
+#define MC_OutputState_MC_MIO0_OUT2              (MCPARAMID)( 2729 << 14)
+#define MC_OutputState_MC_MIO0_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO0_OUT2_LOW            2
+#define MC_OutputState_MC_MIO0_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO0_OUT3      (MCPARAMID)( 2730 << 14)
+#define MC___OutputId_MC_MIO0_OUT3               (MCPARAMID)( 2731 << 14)
+#define MC_OutputMaxId_MC_MIO0_OUT3              (MCPARAMID)( 2732 << 14)
+#define MC_OutputState_Filter_MC_MIO0_OUT3       (MCPARAMID)( 2733 << 14)
+#define MC_OutputStyle_Filter_MC_MIO0_OUT3       (MCPARAMID)( 2734 << 14)
+#define MC_OutputState_MC_MIO0_OUT3              (MCPARAMID)( 2735 << 14)
+#define MC_OutputState_MC_MIO0_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO0_OUT3_LOW            2
+#define MC_OutputState_MC_MIO0_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO0_OUT4      (MCPARAMID)( 2736 << 14)
+#define MC___OutputId_MC_MIO0_OUT4               (MCPARAMID)( 2737 << 14)
+#define MC_OutputMaxId_MC_MIO0_OUT4              (MCPARAMID)( 2738 << 14)
+#define MC_OutputState_Filter_MC_MIO0_OUT4       (MCPARAMID)( 2739 << 14)
+#define MC_OutputStyle_Filter_MC_MIO0_OUT4       (MCPARAMID)( 2740 << 14)
+#define MC_OutputState_MC_MIO0_OUT4              (MCPARAMID)( 2741 << 14)
+#define MC_OutputState_MC_MIO0_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO0_OUT4_LOW            2
+#define MC_OutputState_MC_MIO0_OUT4_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO1_OUT1      (MCPARAMID)( 2742 << 14)
+#define MC___OutputId_MC_MIO1_OUT1               (MCPARAMID)( 2743 << 14)
+#define MC_OutputMaxId_MC_MIO1_OUT1              (MCPARAMID)( 2744 << 14)
+#define MC_OutputState_Filter_MC_MIO1_OUT1       (MCPARAMID)( 2745 << 14)
+#define MC_OutputStyle_Filter_MC_MIO1_OUT1       (MCPARAMID)( 2746 << 14)
+#define MC_OutputState_MC_MIO1_OUT1              (MCPARAMID)( 2747 << 14)
+#define MC_OutputState_MC_MIO1_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO1_OUT1_LOW            2
+#define MC_OutputState_MC_MIO1_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO1_OUT2      (MCPARAMID)( 2748 << 14)
+#define MC___OutputId_MC_MIO1_OUT2               (MCPARAMID)( 2749 << 14)
+#define MC_OutputMaxId_MC_MIO1_OUT2              (MCPARAMID)( 2750 << 14)
+#define MC_OutputState_Filter_MC_MIO1_OUT2       (MCPARAMID)( 2751 << 14)
+#define MC_OutputStyle_Filter_MC_MIO1_OUT2       (MCPARAMID)( 2752 << 14)
+#define MC_OutputState_MC_MIO1_OUT2              (MCPARAMID)( 2753 << 14)
+#define MC_OutputState_MC_MIO1_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO1_OUT2_LOW            2
+#define MC_OutputState_MC_MIO1_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO1_OUT3      (MCPARAMID)( 2754 << 14)
+#define MC___OutputId_MC_MIO1_OUT3               (MCPARAMID)( 2755 << 14)
+#define MC_OutputMaxId_MC_MIO1_OUT3              (MCPARAMID)( 2756 << 14)
+#define MC_OutputState_Filter_MC_MIO1_OUT3       (MCPARAMID)( 2757 << 14)
+#define MC_OutputStyle_Filter_MC_MIO1_OUT3       (MCPARAMID)( 2758 << 14)
+#define MC_OutputState_MC_MIO1_OUT3              (MCPARAMID)( 2759 << 14)
+#define MC_OutputState_MC_MIO1_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO1_OUT3_LOW            2
+#define MC_OutputState_MC_MIO1_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO1_OUT4      (MCPARAMID)( 2760 << 14)
+#define MC___OutputId_MC_MIO1_OUT4               (MCPARAMID)( 2761 << 14)
+#define MC_OutputMaxId_MC_MIO1_OUT4              (MCPARAMID)( 2762 << 14)
+#define MC_OutputState_Filter_MC_MIO1_OUT4       (MCPARAMID)( 2763 << 14)
+#define MC_OutputStyle_Filter_MC_MIO1_OUT4       (MCPARAMID)( 2764 << 14)
+#define MC_OutputState_MC_MIO1_OUT4              (MCPARAMID)( 2765 << 14)
+#define MC_OutputState_MC_MIO1_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO1_OUT4_LOW            2
+#define MC_OutputState_MC_MIO1_OUT4_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO2_OUT1      (MCPARAMID)( 2766 << 14)
+#define MC___OutputId_MC_MIO2_OUT1               (MCPARAMID)( 2767 << 14)
+#define MC_OutputMaxId_MC_MIO2_OUT1              (MCPARAMID)( 2768 << 14)
+#define MC_OutputState_Filter_MC_MIO2_OUT1       (MCPARAMID)( 2769 << 14)
+#define MC_OutputStyle_Filter_MC_MIO2_OUT1       (MCPARAMID)( 2770 << 14)
+#define MC_OutputState_MC_MIO2_OUT1              (MCPARAMID)( 2771 << 14)
+#define MC_OutputState_MC_MIO2_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO2_OUT1_LOW            2
+#define MC_OutputState_MC_MIO2_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO2_OUT2      (MCPARAMID)( 2772 << 14)
+#define MC___OutputId_MC_MIO2_OUT2               (MCPARAMID)( 2773 << 14)
+#define MC_OutputMaxId_MC_MIO2_OUT2              (MCPARAMID)( 2774 << 14)
+#define MC_OutputState_Filter_MC_MIO2_OUT2       (MCPARAMID)( 2775 << 14)
+#define MC_OutputStyle_Filter_MC_MIO2_OUT2       (MCPARAMID)( 2776 << 14)
+#define MC_OutputState_MC_MIO2_OUT2              (MCPARAMID)( 2777 << 14)
+#define MC_OutputState_MC_MIO2_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO2_OUT2_LOW            2
+#define MC_OutputState_MC_MIO2_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO2_OUT3      (MCPARAMID)( 2778 << 14)
+#define MC___OutputId_MC_MIO2_OUT3               (MCPARAMID)( 2779 << 14)
+#define MC_OutputMaxId_MC_MIO2_OUT3              (MCPARAMID)( 2780 << 14)
+#define MC_OutputState_Filter_MC_MIO2_OUT3       (MCPARAMID)( 2781 << 14)
+#define MC_OutputStyle_Filter_MC_MIO2_OUT3       (MCPARAMID)( 2782 << 14)
+#define MC_OutputState_MC_MIO2_OUT3              (MCPARAMID)( 2783 << 14)
+#define MC_OutputState_MC_MIO2_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO2_OUT3_LOW            2
+#define MC_OutputState_MC_MIO2_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO2_OUT4      (MCPARAMID)( 2784 << 14)
+#define MC___OutputId_MC_MIO2_OUT4               (MCPARAMID)( 2785 << 14)
+#define MC_OutputMaxId_MC_MIO2_OUT4              (MCPARAMID)( 2786 << 14)
+#define MC_OutputState_Filter_MC_MIO2_OUT4       (MCPARAMID)( 2787 << 14)
+#define MC_OutputStyle_Filter_MC_MIO2_OUT4       (MCPARAMID)( 2788 << 14)
+#define MC_OutputState_MC_MIO2_OUT4              (MCPARAMID)( 2789 << 14)
+#define MC_OutputState_MC_MIO2_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO2_OUT4_LOW            2
+#define MC_OutputState_MC_MIO2_OUT4_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO3_OUT1      (MCPARAMID)( 2790 << 14)
+#define MC___OutputId_MC_MIO3_OUT1               (MCPARAMID)( 2791 << 14)
+#define MC_OutputMaxId_MC_MIO3_OUT1              (MCPARAMID)( 2792 << 14)
+#define MC_OutputState_Filter_MC_MIO3_OUT1       (MCPARAMID)( 2793 << 14)
+#define MC_OutputStyle_Filter_MC_MIO3_OUT1       (MCPARAMID)( 2794 << 14)
+#define MC_OutputState_MC_MIO3_OUT1              (MCPARAMID)( 2795 << 14)
+#define MC_OutputState_MC_MIO3_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO3_OUT1_LOW            2
+#define MC_OutputState_MC_MIO3_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO3_OUT2      (MCPARAMID)( 2796 << 14)
+#define MC___OutputId_MC_MIO3_OUT2               (MCPARAMID)( 2797 << 14)
+#define MC_OutputMaxId_MC_MIO3_OUT2              (MCPARAMID)( 2798 << 14)
+#define MC_OutputState_Filter_MC_MIO3_OUT2       (MCPARAMID)( 2799 << 14)
+#define MC_OutputStyle_Filter_MC_MIO3_OUT2       (MCPARAMID)( 2800 << 14)
+#define MC_OutputState_MC_MIO3_OUT2              (MCPARAMID)( 2801 << 14)
+#define MC_OutputState_MC_MIO3_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO3_OUT2_LOW            2
+#define MC_OutputState_MC_MIO3_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO3_OUT3      (MCPARAMID)( 2802 << 14)
+#define MC___OutputId_MC_MIO3_OUT3               (MCPARAMID)( 2803 << 14)
+#define MC_OutputMaxId_MC_MIO3_OUT3              (MCPARAMID)( 2804 << 14)
+#define MC_OutputState_Filter_MC_MIO3_OUT3       (MCPARAMID)( 2805 << 14)
+#define MC_OutputStyle_Filter_MC_MIO3_OUT3       (MCPARAMID)( 2806 << 14)
+#define MC_OutputState_MC_MIO3_OUT3              (MCPARAMID)( 2807 << 14)
+#define MC_OutputState_MC_MIO3_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO3_OUT3_LOW            2
+#define MC_OutputState_MC_MIO3_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO3_OUT4      (MCPARAMID)( 2808 << 14)
+#define MC___OutputId_MC_MIO3_OUT4               (MCPARAMID)( 2809 << 14)
+#define MC_OutputMaxId_MC_MIO3_OUT4              (MCPARAMID)( 2810 << 14)
+#define MC_OutputState_Filter_MC_MIO3_OUT4       (MCPARAMID)( 2811 << 14)
+#define MC_OutputStyle_Filter_MC_MIO3_OUT4       (MCPARAMID)( 2812 << 14)
+#define MC_OutputState_MC_MIO3_OUT4              (MCPARAMID)( 2813 << 14)
+#define MC_OutputState_MC_MIO3_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO3_OUT4_LOW            2
+#define MC_OutputState_MC_MIO3_OUT4_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO4_OUT1      (MCPARAMID)( 2814 << 14)
+#define MC___OutputId_MC_MIO4_OUT1               (MCPARAMID)( 2815 << 14)
+#define MC_OutputMaxId_MC_MIO4_OUT1              (MCPARAMID)( 2816 << 14)
+#define MC_OutputState_Filter_MC_MIO4_OUT1       (MCPARAMID)( 2817 << 14)
+#define MC_OutputStyle_Filter_MC_MIO4_OUT1       (MCPARAMID)( 2818 << 14)
+#define MC_OutputState_MC_MIO4_OUT1              (MCPARAMID)( 2819 << 14)
+#define MC_OutputState_MC_MIO4_OUT1_HOLD           1
+#define MC_OutputState_MC_MIO4_OUT1_LOW            2
+#define MC_OutputState_MC_MIO4_OUT1_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO4_OUT2      (MCPARAMID)( 2820 << 14)
+#define MC___OutputId_MC_MIO4_OUT2               (MCPARAMID)( 2821 << 14)
+#define MC_OutputMaxId_MC_MIO4_OUT2              (MCPARAMID)( 2822 << 14)
+#define MC_OutputState_Filter_MC_MIO4_OUT2       (MCPARAMID)( 2823 << 14)
+#define MC_OutputStyle_Filter_MC_MIO4_OUT2       (MCPARAMID)( 2824 << 14)
+#define MC_OutputState_MC_MIO4_OUT2              (MCPARAMID)( 2825 << 14)
+#define MC_OutputState_MC_MIO4_OUT2_HOLD           1
+#define MC_OutputState_MC_MIO4_OUT2_LOW            2
+#define MC_OutputState_MC_MIO4_OUT2_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO4_OUT3      (MCPARAMID)( 2826 << 14)
+#define MC___OutputId_MC_MIO4_OUT3               (MCPARAMID)( 2827 << 14)
+#define MC_OutputMaxId_MC_MIO4_OUT3              (MCPARAMID)( 2828 << 14)
+#define MC_OutputState_Filter_MC_MIO4_OUT3       (MCPARAMID)( 2829 << 14)
+#define MC_OutputStyle_Filter_MC_MIO4_OUT3       (MCPARAMID)( 2830 << 14)
+#define MC_OutputState_MC_MIO4_OUT3              (MCPARAMID)( 2831 << 14)
+#define MC_OutputState_MC_MIO4_OUT3_HOLD           1
+#define MC_OutputState_MC_MIO4_OUT3_LOW            2
+#define MC_OutputState_MC_MIO4_OUT3_HIGH           3
+#define MC_OutputConfig_Filter_MC_MIO4_OUT4      (MCPARAMID)( 2832 << 14)
+#define MC___OutputId_MC_MIO4_OUT4               (MCPARAMID)( 2833 << 14)
+#define MC_OutputMaxId_MC_MIO4_OUT4              (MCPARAMID)( 2834 << 14)
+#define MC_OutputState_Filter_MC_MIO4_OUT4       (MCPARAMID)( 2835 << 14)
+#define MC_OutputStyle_Filter_MC_MIO4_OUT4       (MCPARAMID)( 2836 << 14)
+#define MC_OutputState_MC_MIO4_OUT4              (MCPARAMID)( 2837 << 14)
+#define MC_OutputState_MC_MIO4_OUT4_HOLD           1
+#define MC_OutputState_MC_MIO4_OUT4_LOW            2
+#define MC_OutputState_MC_MIO4_OUT4_HIGH           3
+#define MC_PreStrobe_Tk                          (MCPARAMID)( 2838 << 14)
+#define MC__STRWidth_Tk                          (MCPARAMID)( 2839 << 14)
+#define MC__EXPOn2STROBEOff_E                    (MCPARAMID)( 2840 << 14)
+#define MC__PREEXPWidth_E                        (MCPARAMID)( 2841 << 14)
+#define MC_PinHIO_Usage                          (MCPARAMID)( 2842 << 14)
+#define MC_PinHIO_Usage_NONE                       1
+#define MC_PinHIO_Usage_INPUT                      2
+#define MC_PinHIO_Usage_LOW                        3
+#define MC_PinHIO_Usage_HIGH                       4
+#define MC_PinHIO_Usage_HDRIVE                     5
+#define MC_PinHIO_Usage_HSYNC                      6
+#define MC_PinVIO_Usage                          (MCPARAMID)( 2843 << 14)
+#define MC_PinVIO_Usage_NONE                       1
+#define MC_PinVIO_Usage_INPUT                      2
+#define MC_PinVIO_Usage_LOW                        3
+#define MC_PinVIO_Usage_HIGH                       4
+#define MC_PinVIO_Usage_VDRIVE                     5
+#define MC_PinVIO_Usage_RESET                      6
+#define MC_PinVIO_Usage_AUXRESET                   7
+#define MC_PinVIO_Usage_VSYNC                      8
+#define MC_PinGATE_Usage                         (MCPARAMID)( 2844 << 14)
+#define MC_PinGATE_Usage_NONE                      1
+#define MC_PinGATE_Usage_INPUT                     2
+#define MC_PinGATE_Usage_LOW                       3
+#define MC_PinGATE_Usage_HIGH                      4
+#define MC_PinGATE_Usage_HSYNC                     5
+#define MC_PinGATE_Usage_VSYNC                     6
+#define MC_PinEXP_Usage                          (MCPARAMID)( 2845 << 14)
+#define MC_PinEXP_Usage_NONE                       1
+#define MC_PinEXP_Usage_INPUT                      2
+#define MC_PinEXP_Usage_LOW                        3
+#define MC_PinEXP_Usage_HIGH                       4
+#define MC_PinEXP_Usage_HDRIVE                     5
+#define MC_PinEXP_Usage_HSYNC                      6
+#define MC_PinRST_Usage                          (MCPARAMID)( 2846 << 14)
+#define MC_PinRST_Usage_NONE                       1
+#define MC_PinRST_Usage_INPUT                      2
+#define MC_PinRST_Usage_LOW                        3
+#define MC_PinRST_Usage_HIGH                       4
+#define MC_PinRST_Usage_VDRIVE                     5
+#define MC_PinRST_Usage_RESET                      6
+#define MC_PinRST_Usage_AUXRESET                   7
+#define MC_PinRST_Usage_VSYNC                      8
+#define MC_CameraControlSignalSet                (MCPARAMID)( 2847 << 14)
+#define MC_CameraControlSignalSet_NONE             1
+#define MC_CameraControlSignalSet_RESET            2
+#define MC_CameraControlSignalSet_RESET_VSYNC      3
+#define MC_CameraControlSignalSet_HDRIVE_VDRIVE    4
+#define MC_CameraControlSignalSet_HDRIVE_RESET     5
+#define MC_CameraControlSignalSet_HDRIVE_RESET_VSYNC   6
+#define MC_CameraControlSignalSet_HDRIVE_RESET_AUXRESET   7
+#define MC_CameraControlSignalSet_CLK_HSYNC_VSYNC   8
+#define MC_CameraControlSignalSet_RESET_CLK_HSYNC_VSYNC   9
+#define MC_CameraControlSignalSet_INVALID         10
+#define MC_CameraSignalSet                       (MCPARAMID)( 2848 << 14)
+#define MC_CameraSignalSet_A1                      1
+#define MC_CameraSignalSet_B1                      2
+#define MC_CameraSignalSet_C1                      3
+#define MC_CameraSignalSet_D1                      4
+#define MC_CameraSignalSet_E1                      5
+#define MC_CameraSignalSet_F1                      6
+#define MC_CameraSignalSet_G1                      7
+#define MC_CameraSignalSet_H1                      8
+#define MC_CameraSignalSet_I1                      9
+#define MC_CameraSignalSet_A2                     10
+#define MC_CameraSignalSet_B2                     11
+#define MC_CameraSignalSet_C2                     12
+#define MC_CameraSignalSet_D2                     13
+#define MC_CameraSignalSet_E2                     14
+#define MC_CameraSignalSet_F2                     15
+#define MC_CameraSignalSet_G2                     16
+#define MC_CameraSignalSet_H2                     17
+#define MC_CameraSignalSet_I2                     18
+#define MC_CameraSignalSet_A3                     19
+#define MC_CameraSignalSet_B3                     20
+#define MC_CameraSignalSet_C3                     21
+#define MC_CameraSignalSet_D3                     22
+#define MC_CameraSignalSet_E3                     23
+#define MC_CameraSignalSet_F3                     24
+#define MC_CameraSignalSet_G3                     25
+#define MC_CameraSignalSet_INVALID                26
+#define MC_ConnectorConfigX                      (MCPARAMID)( 2849 << 14)
+#define MC_ConnectorConfigX_FREE                   1
+#define MC_ConnectorConfigX_A1                     2
+#define MC_ConnectorConfigX_B1                     3
+#define MC_ConnectorConfigX_C1                     4
+#define MC_ConnectorConfigX_D1                     5
+#define MC_ConnectorConfigX_E1                     6
+#define MC_ConnectorConfigX_F1                     7
+#define MC_ConnectorConfigX_G1                     8
+#define MC_ConnectorConfigX_H1                     9
+#define MC_ConnectorConfigX_I1                    10
+#define MC_ConnectorConfigX_A2                    11
+#define MC_ConnectorConfigX_B2                    12
+#define MC_ConnectorConfigX_C2                    13
+#define MC_ConnectorConfigX_D2                    14
+#define MC_ConnectorConfigX_E2                    15
+#define MC_ConnectorConfigX_F2                    16
+#define MC_ConnectorConfigX_G2                    17
+#define MC_ConnectorConfigX_H2                    18
+#define MC_ConnectorConfigX_I2                    19
+#define MC_ConnectorConfigX_A3                    20
+#define MC_ConnectorConfigX_B3                    21
+#define MC_ConnectorConfigX_C3                    22
+#define MC_ConnectorConfigX_D3                    23
+#define MC_ConnectorConfigX_E3                    24
+#define MC_ConnectorConfigX_F3                    25
+#define MC_ConnectorConfigX_G3                    26
+#define MC_ConnectorConfigX_A1_A1                 27
+#define MC_ConnectorConfigX_B1_A1                 28
+#define MC_ConnectorConfigX_B1_B1                 29
+#define MC_ConnectorConfigX_C1_A1                 30
+#define MC_ConnectorConfigX_C1_B1                 31
+#define MC_ConnectorConfigX_C1_C1                 32
+#define MC_ConnectorConfigX_D1_A1                 33
+#define MC_ConnectorConfigX_D1_B1                 34
+#define MC_ConnectorConfigX_D1_C1                 35
+#define MC_ConnectorConfigX_D1_D1                 36
+#define MC_ConnectorConfigX_E1_A1                 37
+#define MC_ConnectorConfigX_E1_B1                 38
+#define MC_ConnectorConfigX_E1_C1                 39
+#define MC_ConnectorConfigX_E1_D1                 40
+#define MC_ConnectorConfigX_E1_E1                 41
+#define MC_ConnectorConfigX_F1_A1                 42
+#define MC_ConnectorConfigX_F1_B1                 43
+#define MC_ConnectorConfigX_F1_D1                 44
+#define MC_ConnectorConfigX_F1_E1                 45
+#define MC_ConnectorConfigX_F1_F1                 46
+#define MC_ConnectorConfigX_G1_A1                 47
+#define MC_ConnectorConfigX_G1_G1                 48
+#define MC_ConnectorConfigX_H1_A1                 49
+#define MC_ConnectorConfigX_H1_B1                 50
+#define MC_ConnectorConfigX_H1_C1                 51
+#define MC_ConnectorConfigX_H1_D1                 52
+#define MC_ConnectorConfigX_H1_E1                 53
+#define MC_ConnectorConfigX_H1_F1                 54
+#define MC_ConnectorConfigX_H1_G1                 55
+#define MC_ConnectorConfigX_I1_A1                 56
+#define MC_ConnectorConfigX_I1_B1                 57
+#define MC_ConnectorConfigX_I1_D1                 58
+#define MC_ConnectorConfigX_I1_E1                 59
+#define MC_ConnectorConfigX_Filter               (MCPARAMID)( 2850 << 14)
+#define MC_ConnectorConfigY                      (MCPARAMID)( 2851 << 14)
+#define MC_ConnectorConfigY_FREE                   1
+#define MC_ConnectorConfigY_A1                     2
+#define MC_ConnectorConfigY_B1                     3
+#define MC_ConnectorConfigY_C1                     4
+#define MC_ConnectorConfigY_D1                     5
+#define MC_ConnectorConfigY_E1                     6
+#define MC_ConnectorConfigY_F1                     7
+#define MC_ConnectorConfigY_G1                     8
+#define MC_ConnectorConfigY_H1                     9
+#define MC_ConnectorConfigY_I1                    10
+#define MC_ConnectorConfigY_A2                    11
+#define MC_ConnectorConfigY_B2                    12
+#define MC_ConnectorConfigY_C2                    13
+#define MC_ConnectorConfigY_D2                    14
+#define MC_ConnectorConfigY_E2                    15
+#define MC_ConnectorConfigY_F2                    16
+#define MC_ConnectorConfigY_G2                    17
+#define MC_ConnectorConfigY_H2                    18
+#define MC_ConnectorConfigY_I2                    19
+#define MC_ConnectorConfigY_A1_A1                 20
+#define MC_ConnectorConfigY_B1_A1                 21
+#define MC_ConnectorConfigY_B1_B1                 22
+#define MC_ConnectorConfigY_C1_A1                 23
+#define MC_ConnectorConfigY_C1_B1                 24
+#define MC_ConnectorConfigY_C1_C1                 25
+#define MC_ConnectorConfigY_D1_A1                 26
+#define MC_ConnectorConfigY_D1_B1                 27
+#define MC_ConnectorConfigY_D1_C1                 28
+#define MC_ConnectorConfigY_D1_D1                 29
+#define MC_ConnectorConfigY_E1_A1                 30
+#define MC_ConnectorConfigY_E1_B1                 31
+#define MC_ConnectorConfigY_E1_C1                 32
+#define MC_ConnectorConfigY_E1_D1                 33
+#define MC_ConnectorConfigY_E1_E1                 34
+#define MC_ConnectorConfigY_F1_A1                 35
+#define MC_ConnectorConfigY_F1_B1                 36
+#define MC_ConnectorConfigY_F1_D1                 37
+#define MC_ConnectorConfigY_F1_E1                 38
+#define MC_ConnectorConfigY_F1_F1                 39
+#define MC_ConnectorConfigY_G1_A1                 40
+#define MC_ConnectorConfigY_G1_G1                 41
+#define MC_ConnectorConfigY_H1_A1                 42
+#define MC_ConnectorConfigY_H1_B1                 43
+#define MC_ConnectorConfigY_H1_C1                 44
+#define MC_ConnectorConfigY_H1_D1                 45
+#define MC_ConnectorConfigY_H1_E1                 46
+#define MC_ConnectorConfigY_H1_F1                 47
+#define MC_ConnectorConfigY_H1_G1                 48
+#define MC_ConnectorConfigY_I1_A1                 49
+#define MC_ConnectorConfigY_I1_B1                 50
+#define MC_ConnectorConfigY_I1_D1                 51
+#define MC_ConnectorConfigY_I1_E1                 52
+#define MC_ConnectorConfigY_Filter               (MCPARAMID)( 2852 << 14)
+#define MC_ConnectorConfigY_A3                    53
+#define MC_ConnectorConfigY_B3                    54
+#define MC_ConnectorConfigY_C3                    55
+#define MC_ConnectorConfigY_D3                    56
+#define MC_ConnectorConfigY_E3                    57
+#define MC_ConnectorConfigY_F3                    58
+#define MC_ConnectorConfigY_G3                    59
+#define MC_ConnectorConfigZ                      (MCPARAMID)( 2853 << 14)
+#define MC_ConnectorConfigZ_FREE                   1
+#define MC_ConnectorConfigZ_A1                     2
+#define MC_ConnectorConfigZ_B1                     3
+#define MC_ConnectorConfigZ_C1                     4
+#define MC_ConnectorConfigZ_D1                     5
+#define MC_ConnectorConfigZ_E1                     6
+#define MC_ConnectorConfigZ_F1                     7
+#define MC_ConnectorConfigZ_G1                     8
+#define MC_ConnectorConfigZ_H1                     9
+#define MC_ConnectorConfigZ_I1                    10
+#define MC_ConnectorConfigZ_A2                    11
+#define MC_ConnectorConfigZ_B2                    12
+#define MC_ConnectorConfigZ_C2                    13
+#define MC_ConnectorConfigZ_D2                    14
+#define MC_ConnectorConfigZ_E2                    15
+#define MC_ConnectorConfigZ_F2                    16
+#define MC_ConnectorConfigZ_G2                    17
+#define MC_ConnectorConfigZ_H2                    18
+#define MC_ConnectorConfigZ_I2                    19
+#define MC_ConnectorConfigZ_A1_A1                 20
+#define MC_ConnectorConfigZ_B1_A1                 21
+#define MC_ConnectorConfigZ_B1_B1                 22
+#define MC_ConnectorConfigZ_C1_A1                 23
+#define MC_ConnectorConfigZ_C1_B1                 24
+#define MC_ConnectorConfigZ_C1_C1                 25
+#define MC_ConnectorConfigZ_D1_A1                 26
+#define MC_ConnectorConfigZ_D1_B1                 27
+#define MC_ConnectorConfigZ_D1_C1                 28
+#define MC_ConnectorConfigZ_D1_D1                 29
+#define MC_ConnectorConfigZ_E1_A1                 30
+#define MC_ConnectorConfigZ_E1_B1                 31
+#define MC_ConnectorConfigZ_E1_C1                 32
+#define MC_ConnectorConfigZ_E1_D1                 33
+#define MC_ConnectorConfigZ_E1_E1                 34
+#define MC_ConnectorConfigZ_F1_A1                 35
+#define MC_ConnectorConfigZ_F1_B1                 36
+#define MC_ConnectorConfigZ_F1_D1                 37
+#define MC_ConnectorConfigZ_F1_E1                 38
+#define MC_ConnectorConfigZ_F1_F1                 39
+#define MC_ConnectorConfigZ_G1_A1                 40
+#define MC_ConnectorConfigZ_G1_G1                 41
+#define MC_ConnectorConfigZ_H1_A1                 42
+#define MC_ConnectorConfigZ_H1_B1                 43
+#define MC_ConnectorConfigZ_H1_C1                 44
+#define MC_ConnectorConfigZ_H1_D1                 45
+#define MC_ConnectorConfigZ_H1_E1                 46
+#define MC_ConnectorConfigZ_H1_F1                 47
+#define MC_ConnectorConfigZ_H1_G1                 48
+#define MC_ConnectorConfigZ_I1_A1                 49
+#define MC_ConnectorConfigZ_I1_B1                 50
+#define MC_ConnectorConfigZ_I1_D1                 51
+#define MC_ConnectorConfigZ_I1_E1                 52
+#define MC_ConnectorConfigZ_Filter               (MCPARAMID)( 2854 << 14)
+#define MC_ConnectorConfig                       (MCPARAMID)( 2855 << 14)
+#define MC_ConnectorConfig_FREE                   60
+#define MC_ConnectorConfig_A1                     61
+#define MC_ConnectorConfig_B1                     62
+#define MC_ConnectorConfig_C1                     63
+#define MC_ConnectorConfig_D1                     64
+#define MC_ConnectorConfig_E1                     65
+#define MC_ConnectorConfig_F1                     66
+#define MC_ConnectorConfig_G1                     67
+#define MC_ConnectorConfig_H1                     68
+#define MC_ConnectorConfig_I1                     69
+#define MC_ConnectorConfig_A2                     70
+#define MC_ConnectorConfig_B2                     71
+#define MC_ConnectorConfig_C2                     72
+#define MC_ConnectorConfig_D2                     73
+#define MC_ConnectorConfig_E2                     74
+#define MC_ConnectorConfig_F2                     75
+#define MC_ConnectorConfig_G2                     76
+#define MC_ConnectorConfig_H2                     77
+#define MC_ConnectorConfig_I2                     78
+#define MC_ConnectorConfig_A3                     79
+#define MC_ConnectorConfig_B3                     80
+#define MC_ConnectorConfig_C3                     81
+#define MC_ConnectorConfig_D3                     82
+#define MC_ConnectorConfig_E3                     83
+#define MC_ConnectorConfig_F3                     84
+#define MC_ConnectorConfig_G3                     85
+#define MC_ConnectorConfig_A1_A1                  86
+#define MC_ConnectorConfig_B1_A1                  87
+#define MC_ConnectorConfig_B1_B1                  88
+#define MC_ConnectorConfig_C1_A1                  89
+#define MC_ConnectorConfig_C1_B1                  90
+#define MC_ConnectorConfig_C1_C1                  91
+#define MC_ConnectorConfig_D1_A1                  92
+#define MC_ConnectorConfig_D1_B1                  93
+#define MC_ConnectorConfig_D1_C1                  94
+#define MC_ConnectorConfig_D1_D1                  95
+#define MC_ConnectorConfig_E1_A1                  96
+#define MC_ConnectorConfig_E1_B1                  97
+#define MC_ConnectorConfig_E1_C1                  98
+#define MC_ConnectorConfig_E1_D1                  99
+#define MC_ConnectorConfig_E1_E1                 100
+#define MC_ConnectorConfig_F1_A1                 101
+#define MC_ConnectorConfig_F1_B1                 102
+#define MC_ConnectorConfig_F1_D1                 103
+#define MC_ConnectorConfig_F1_E1                 104
+#define MC_ConnectorConfig_F1_F1                 105
+#define MC_ConnectorConfig_G1_A1                 106
+#define MC_ConnectorConfig_G1_G1                 107
+#define MC_ConnectorConfig_H1_A1                 108
+#define MC_ConnectorConfig_H1_B1                 109
+#define MC_ConnectorConfig_H1_C1                 110
+#define MC_ConnectorConfig_H1_D1                 111
+#define MC_ConnectorConfig_H1_E1                 112
+#define MC_ConnectorConfig_H1_F1                 113
+#define MC_ConnectorConfig_H1_G1                 114
+#define MC_ConnectorConfig_I1_A1                 115
+#define MC_ConnectorConfig_I1_B1                 116
+#define MC_ConnectorConfig_I1_D1                 117
+#define MC_ConnectorConfig_I1_E1                 118
+#define MC_CameraSignalSetX                      (MCPARAMID)( 2856 << 14)
+#define MC_CameraSignalSetXBIS                   (MCPARAMID)( 2857 << 14)
+#define MC_CameraSignalSetY                      (MCPARAMID)( 2858 << 14)
+#define MC_CameraSignalSetYBIS                   (MCPARAMID)( 2859 << 14)
+#define MC_ConnectorXTopology                    (MCPARAMID)( 2860 << 14)
+#define MC_ConnectorYTopology                    (MCPARAMID)( 2861 << 14)
+#define MC_CameraSignalSetZ                      (MCPARAMID)( 2862 << 14)
+#define MC_CameraSignalSetZBIS                   (MCPARAMID)( 2863 << 14)
+#define MC_ConnectorZTopology                    (MCPARAMID)( 2864 << 14)
+#define MC_ConnectorPort                         (MCPARAMID)( 2865 << 14)
+#define MC_ConnectorPort_PRIMARY                   1
+#define MC_ConnectorPort_SECONDARY                 2
+#define MC_ConnectorTopology                     (MCPARAMID)( 2866 << 14)
+#define MC_ConnectorCameraCount                  (MCPARAMID)( 2867 << 14)
+#define MC_RCable                                (MCPARAMID)( 2868 << 14)
+#define MC_RCable_NONE                             1
+#define MC_RCable_A15_C01                          2
+#define MC_RCable_A15_C02                          3
+#define MC_RCable_A15_C03                          4
+#define MC_RCable_A15_C04                          5
+#define MC_RCable_A15_C05                          6
+#define MC_RCable_A15_C06                          7
+#define MC_RCable_A15_C07                          8
+#define MC_RCable_A15_C08                          9
+#define MC_RCable_A15_C09                         10
+#define MC_RCable_A15_C10                         11
+#define MC_RCable_A15_C11                         12
+#define MC_RCable_A15_C12                         13
+#define MC_RCable_A15_C13                         14
+#define MC_RCable_A15_C14                         15
+#define MC_RCable_A15_C15                         16
+#define MC_RCable_A15_C16                         17
+#define MC_RCable_A15_C17                         18
+#define MC_RCable_A15_C18                         19
+#define MC_RCable_A15_C19                         20
+#define MC_CamCable_Check                        (MCPARAMID)( 2869 << 14)
+#define MC_CamCable_Check_PASS                     1
+#define MC_CamCable_Check_FAIL                     2
+#define MC_Cable_A15_C110000000                   30
+#define MC_Cable_A15_C110010000                   31
+#define MC_Cable_A15_C110210000                   32
+#define MC_Cable_A15_C111100000                   33
+#define MC_Cable_A15_C111010000                   34
+#define MC_Cable_A15_C111210000                   35
+#define MC_Cable_A15_C111020000                   36
+#define MC_Cable_A15_C112200000                   37
+#define MC_Cable_A15_C112210000                   38
+#define MC_Cable_A15_C210000000                   39
+#define MC_Cable_A15_C210010000                   40
+#define MC_Cable_A15_C210210000                   41
+#define MC_Cable_A15_C211100000                   42
+#define MC_Cable_A15_C211010000                   43
+#define MC_Cable_A15_C211210000                   44
+#define MC_Cable_A15_C211020000                   45
+#define MC_Cable_A15_C212200000                   46
+#define MC_Cable_A15_C212210000                   47
+#define MC_Cable_A15_C310000000                   48
+#define MC_Cable_A15_C310010000                   49
+#define MC_Cable_A15_C310210000                   50
+#define MC_Cable_A15_C311100000                   51
+#define MC_Cable_A15_C311010000                   52
+#define MC_Cable_A15_C311210000                   53
+#define MC_Cable_A15_C311020000                   54
+#define MC_Cable_A15_C110001000                   55
+#define MC_Cable_A15_C110011000                   56
+#define MC_Cable_A15_C110211000                   57
+#define MC_Cable_A15_C111101000                   58
+#define MC_Cable_A15_C111011000                   59
+#define MC_Cable_A15_C111211000                   60
+#define MC_Cable_A15_C111021000                   61
+#define MC_Cable_A15_C112201000                   62
+#define MC_Cable_A15_C112211000                   63
+#define MC_Cable_A15_C110011001                   64
+#define MC_Cable_A15_C110211001                   65
+#define MC_Cable_A15_C111101001                   66
+#define MC_Cable_A15_C111011001                   67
+#define MC_Cable_A15_C111211001                   68
+#define MC_Cable_A15_C112201001                   69
+#define MC_Cable_A15_C112211001                   70
+#define MC_Cable_A15_C110211021                   71
+#define MC_Cable_A15_C111101021                   72
+#define MC_Cable_A15_C111011021                   73
+#define MC_Cable_A15_C112201021                   74
+#define MC_Cable_A15_C111101110                   75
+#define MC_Cable_A15_C111011110                   76
+#define MC_Cable_A15_C111211110                   77
+#define MC_Cable_A15_C112201110                   78
+#define MC_Cable_A15_C112211110                   79
+#define MC_Cable_A15_C111011101                   80
+#define MC_Cable_A15_C111211101                   81
+#define MC_Cable_A15_C112201101                   82
+#define MC_Cable_A15_C112211101                   83
+#define MC_Cable_A15_C111211121                   84
+#define MC_Cable_A15_C112201121                   85
+#define MC_Cable_A15_C111021102                   86
+#define MC_Cable_A15_C112201102                   87
+#define MC_CableName_One_Camera_Single_Channel_A  27
+#define MC_CableName_One_Camera_Single_Channel_B  28
+#define MC_CableName_One_Camera_Single_Channel_C  29
+#define MC_CableName_One_Camera_Single_Channel_D  30
+#define MC_CableName_One_Camera_Single_Channel_E  31
+#define MC_CableName_One_Camera_Single_Channel_F  32
+#define MC_CableName_One_Camera_Single_Channel_G  33
+#define MC_CableName_One_Camera_Single_Channel_H  34
+#define MC_CableName_One_Camera_Single_Channel_I  35
+#define MC_CableName_One_Camera_Dual_Channel_A    36
+#define MC_CableName_One_Camera_Dual_Channel_B    37
+#define MC_CableName_One_Camera_Dual_Channel_C    38
+#define MC_CableName_One_Camera_Dual_Channel_D    39
+#define MC_CableName_One_Camera_Dual_Channel_E    40
+#define MC_CableName_One_Camera_Dual_Channel_F    41
+#define MC_CableName_One_Camera_Dual_Channel_G    42
+#define MC_CableName_One_Camera_Dual_Channel_H    43
+#define MC_CableName_One_Camera_Dual_Channel_I    44
+#define MC_CableName_One_Camera_Triple_Channel_A  45
+#define MC_CableName_One_Camera_Triple_Channel_B  46
+#define MC_CableName_One_Camera_Triple_Channel_C  47
+#define MC_CableName_One_Camera_Triple_Channel_D  48
+#define MC_CableName_One_Camera_Triple_Channel_E  49
+#define MC_CableName_One_Camera_Triple_Channel_F  50
+#define MC_CableName_One_Camera_Triple_Channel_G  51
+#define MC_CableName_Two_Cameras_Single_Channel_AA  52
+#define MC_CableName_Two_Cameras_Single_Channel_BA  53
+#define MC_CableName_Two_Cameras_Single_Channel_CA  54
+#define MC_CableName_Two_Cameras_Single_Channel_DA  55
+#define MC_CableName_Two_Cameras_Single_Channel_EA  56
+#define MC_CableName_Two_Cameras_Single_Channel_FA  57
+#define MC_CableName_Two_Cameras_Single_Channel_GA  58
+#define MC_CableName_Two_Cameras_Single_Channel_HA  59
+#define MC_CableName_Two_Cameras_Single_Channel_IA  60
+#define MC_CableName_Two_Cameras_Single_Channel_BB  61
+#define MC_CableName_Two_Cameras_Single_Channel_CB  62
+#define MC_CableName_Two_Cameras_Single_Channel_DB  63
+#define MC_CableName_Two_Cameras_Single_Channel_EB  64
+#define MC_CableName_Two_Cameras_Single_Channel_FB  65
+#define MC_CableName_Two_Cameras_Single_Channel_HB  66
+#define MC_CableName_Two_Cameras_Single_Channel_IB  67
+#define MC_CableName_Two_Cameras_Single_Channel_CC  68
+#define MC_CableName_Two_Cameras_Single_Channel_DC  69
+#define MC_CableName_Two_Cameras_Single_Channel_EC  70
+#define MC_CableName_Two_Cameras_Single_Channel_HC  71
+#define MC_CableName_Two_Cameras_Single_Channel_DD  72
+#define MC_CableName_Two_Cameras_Single_Channel_ED  73
+#define MC_CableName_Two_Cameras_Single_Channel_FD  74
+#define MC_CableName_Two_Cameras_Single_Channel_HD  75
+#define MC_CableName_Two_Cameras_Single_Channel_ID  76
+#define MC_CableName_Two_Cameras_Single_Ehannel_EE  77
+#define MC_CableName_Two_Cameras_Single_Ehannel_FE  78
+#define MC_CableName_Two_Cameras_Single_Ehannel_HE  79
+#define MC_CableName_Two_Cameras_Single_Ehannel_IE  80
+#define MC_CableName_Two_Cameras_Single_Channel_FF  81
+#define MC_CableName_Two_Cameras_Single_Channel_HF  82
+#define MC_CableName_Two_Cameras_Single_Ehannel_GG  83
+#define MC_CableName_Two_Cameras_Single_Ehannel_HG  84
+#define MC_CCCount                               (MCPARAMID)( 2870 << 14)
+#define MC_CCCount_ONE                             1
+#define MC_CCCount_TWO                             2
+#define MC_CableType                             (MCPARAMID)( 2871 << 14)
+#define MC_Cable_A15_T2A                          88
+#define MC_Cable_A15_T2B                          89
+#define MC_Cable_A15_T2C                          90
+#define MC_Cable_A15_T2D                          91
+#define MC_Cable_A15_T2E                          92
+#define MC_Cable_A15_T2F                          93
+#define MC_Cable_A15_T2G                          94
+#define MC_Cable_A15_T2H                          95
+#define MC_Cable_A15_T2I                          96
+#define MC_Cable_A15_T1A                          97
+#define MC_Cable_A15_T1B                          98
+#define MC_Cable_A15_T1C                          99
+#define MC_Cable_A15_T1D                         100
+#define MC_Cable_A15_T1E                         101
+#define MC_Cable_A15_T1F                         102
+#define MC_Cable_A15_T1G                         103
+#define MC_Cable_A15_T1H                         104
+#define MC_Cable_A15_T1I                         105
+#define MC_Cable_A15_T3A                         106
+#define MC_Cable_A15_T3B                         107
+#define MC_Cable_A15_T3C                         108
+#define MC_Cable_A15_T3D                         109
+#define MC_Cable_A15_T3E                         110
+#define MC_Cable_A15_T3F                         111
+#define MC_Cable_A15_T3G                         112
+#define MC_Cable_A15_T11AA                       113
+#define MC_Cable_A15_T11BA                       114
+#define MC_Cable_A15_T11BB                       115
+#define MC_Cable_A15_T11CA                       116
+#define MC_Cable_A15_T11CB                       117
+#define MC_Cable_A15_T11CC                       118
+#define MC_Cable_A15_T11DA                       119
+#define MC_Cable_A15_T11DB                       120
+#define MC_Cable_A15_T11DC                       121
+#define MC_Cable_A15_T11DD                       122
+#define MC_Cable_A15_T11EA                       123
+#define MC_Cable_A15_T11EB                       124
+#define MC_Cable_A15_T11EC                       125
+#define MC_Cable_A15_T11ED                       126
+#define MC_Cable_A15_T11EE                       127
+#define MC_Cable_A15_T11FA                       128
+#define MC_Cable_A15_T11FB                       129
+#define MC_Cable_A15_T11FD                       130
+#define MC_Cable_A15_T11FE                       131
+#define MC_Cable_A15_T11FF                       132
+#define MC_Cable_A15_T11GA                       133
+#define MC_Cable_A15_T11GG                       134
+#define MC_Cable_A15_T11HA                       135
+#define MC_Cable_A15_T11HB                       136
+#define MC_Cable_A15_T11HC                       137
+#define MC_Cable_A15_T11HD                       138
+#define MC_Cable_A15_T11HE                       139
+#define MC_Cable_A15_T11HF                       140
+#define MC_Cable_A15_T11HG                       141
+#define MC_Cable_A15_T11IA                       142
+#define MC_Cable_A15_T11IB                       143
+#define MC_Cable_A15_T11ID                       144
+#define MC_Cable_A15_T11IE                       145
+#define MC_CableName_Two_Cameras_Single_Channel_EE  85
+#define MC_CableName_Two_Cameras_Single_Channel_FE  86
+#define MC_CableName_Two_Cameras_Single_Channel_GG  87
+#define MC_CableName_Two_Cameras_Single_Channel_HE  88
+#define MC_CableName_Two_Cameras_Single_Channel_HG  89
+#define MC_CableName_Two_Cameras_Single_Channel_IE  90
+#define MC_CableXTopology                        (MCPARAMID)( 2872 << 14)
+#define MC_CableYTopology                        (MCPARAMID)( 2873 << 14)
+#define MC_CableTopology                         (MCPARAMID)( 2874 << 14)
+#define MC_CableZTopology                        (MCPARAMID)( 2875 << 14)
+#define MC_Camera_CV_M30                         142
+#define MC_CamConfig_P120SA                      191
+#define MC_CamConfig_P120RA                      192
+#define MC_CableModel                            (MCPARAMID)( 2876 << 14)
+#define MC_CableModel_SPECIFIC                     1
+#define MC_CableModel_GENERIC                      2
+#define MC__PrimaryTopology                      (MCPARAMID)( 2877 << 14)
+#define MC__SecondaryTopology                    (MCPARAMID)( 2878 << 14)
+#define MC__MyTopology                           (MCPARAMID)( 2879 << 14)
+#define MC_CableTopology_CSS_Check               (MCPARAMID)( 2880 << 14)
+#define MC_CableTopology_CSS_Check_PASS            1
+#define MC_CableTopology_CSS_Check_FAIL            2
+#define MC_CableTopology_Swap_Check              (MCPARAMID)( 2881 << 14)
+#define MC_CableTopology_Swap_Check_PASS           1
+#define MC_CableTopology_Swap_Check_FAIL           2
+#define MC_CableTopology_Validity_Check          (MCPARAMID)( 2882 << 14)
+#define MC_CableTopology_Validity_Check_PASS       1
+#define MC_CableTopology_Validity_Check_FAIL       2
+#define MC___CableTopology_Check                 (MCPARAMID)( 2883 << 14)
+#define MC___CableTopology_Check_PASS              1
+#define MC___CableTopology_Check_FAIL              2
+#define MC___CamCable_Check                      (MCPARAMID)( 2884 << 14)
+#define MC___CamCable_Check_PASS                   1
+#define MC___CamCable_Check_FAIL                   2
+#define MC_RCableV                               (MCPARAMID)( 2885 << 14)
+#define MC_RCableV_A                               1
+#define MC_RCableV_B                               2
+#define MC_CorrectedCableTopology                (MCPARAMID)( 2886 << 14)
+#define MC__CableTopology                        (MCPARAMID)( 2887 << 14)
+#define MC_INITD1Signature                       (MCPARAMID)( 2888 << 14)
+#define MC_INITD2Signature                       (MCPARAMID)( 2889 << 14)
+#define MC_DigUnitRecord                         (MCPARAMID)( 2890 << 14)
+#define MC_INITD2Condition                       (MCPARAMID)( 2891 << 14)
+#define MC_GainCtl_p6DB                            9
+#define MC_GainCtl_p5DB                           10
+#define MC_GainCtl_p4DB                           11
+#define MC_GainCtl_Filter                        (MCPARAMID)( 2892 << 14)
+#define MC__NominalGain                          (MCPARAMID)( 2893 << 14)
+#define MC_GainLinMin                            (MCPARAMID)( 2894 << 14)
+#define MC_GainLinMax                            (MCPARAMID)( 2895 << 14)
+#define MC_GainDBMin                             (MCPARAMID)( 2896 << 14)
+#define MC_GainDBMax                             (MCPARAMID)( 2897 << 14)
+#define MC_CamConfig_P240RA                      193
+#define MC__PhaseLength                          (MCPARAMID)( 2898 << 14)
+#define MC_SceneLength                           (MCPARAMID)( 2899 << 14)
+#define MC__BoardType__PICOLO_TETRA               15
+#define MC__BoardType__PICOLO_JETSTREAM           16
+#define MC_InputMaxId_                           (MCPARAMID)( 2900 << 14)
+#define MC_OutputMaxId_                          (MCPARAMID)( 2901 << 14)
+#define MC_Operation_LONGPAGE                      8
+#define MC_SGASet                                (MCPARAMID)( 2902 << 14)
+#define MC__GAP_MODE                             (MCPARAMID)( 2903 << 14)
+#define MC__GAP_MODE_SINGLE_SEQ                    1
+#define MC__GAP_MODE_MULTIPLE_SEQ                  2
+#define MC__COVER_MODE                           (MCPARAMID)( 2904 << 14)
+#define MC__COVER_MODE_ON                          1
+#define MC__COVER_MODE_OFF                         2
+#define MC_STZUsage_COVERX                         4
+#define MC_STZUsage_COVERY                         5
+#define MC__STR_STZSRC_COVER_X                     7
+#define MC__STR_STZSRC_COVER_Y                     8
+#define MC_STZUsage_TRIGX                          6
+#define MC_STZUsage_TRIGY                          7
+#define MC__STR_STZSRC_TRIG_X                      9
+#define MC__STR_STZSRC_TRIG_Y                     10
+#define MC_EndTrigEdge                           (MCPARAMID)( 2905 << 14)
+#define MC_EndTrigEdge_GOHIGH                      1
+#define MC_EndTrigEdge_GOLOW                       2
+#define MC_EndTrigLine                           (MCPARAMID)( 2906 << 14)
+#define MC_EndTrigLine_NOM                         1
+#define MC_EndTrigLine_ALT1                        2
+#define MC_EndTrigLine_ALT2                        3
+#define MC_EndTrigLine_PG                          4
+#define MC_EndTrigLine_LTACT                       5
+#define MC_EndTrigLine_TRX                         6
+#define MC_EndTrigLine_TRY                         7
+#define MC_EndTrigLine_TRZ                         8
+#define MC_EndTrigLine_NONE                        9
+#define MC_Camera_YD5040                         143
+#define MC_EndTrigLine_TRG                        10
+#define MC__SP_Factor_Min_1                      (MCPARAMID)( 2907 << 14)
+#define MC__SP_Factor_AMin_PG                    (MCPARAMID)( 2908 << 14)
+#define MC__SP_Factor_AMin_RC                    (MCPARAMID)( 2909 << 14)
+#define MC__SP_Factor_RMAx_RC                    (MCPARAMID)( 2910 << 14)
+#define MC_CamConfig_L4096RP                     194
+#define MC_PCIDeviceID                           (MCPARAMID)( 2911 << 14)
+#define MC_PCIVendorID                           (MCPARAMID)( 2912 << 14)
+#define MC_PCISubDeviceID                        (MCPARAMID)( 2913 << 14)
+#define MC_PCISubVendorID                        (MCPARAMID)( 2914 << 14)
+#define MC___TrigLine_Check                      (MCPARAMID)( 2915 << 14)
+#define MC___TrigLine_Check_PASS                   1
+#define MC___TrigLine_Check_FAIL                   2
+#define MC_EndTrigMode                           (MCPARAMID)( 2916 << 14)
+#define MC_EndTrigMode_AUTO                        1
+#define MC_EndTrigMode_HARD                        2
+#define MC_HFRModeOnly_Filter                    (MCPARAMID)( 2917 << 14)
+#define MC__FrameCountModulo                     (MCPARAMID)( 2918 << 14)
+#define MC_SetLength_Fr                          (MCPARAMID)( 2919 << 14)
+#define MC__HFR_MODE                             (MCPARAMID)( 2920 << 14)
+#define MC__HFR_MODE_ON                            1
+#define MC__HFR_MODE_OFF                           2
+#define MC__TotalSetLength                       (MCPARAMID)( 2921 << 14)
+#define MC_FrameGrabSizeY_Ln                     (MCPARAMID)( 2922 << 14)
+#define MC_AsyncOverlapLoadSet                   (MCPARAMID)( 2923 << 14)
+#define MC__SequenceLoadSet                      (MCPARAMID)( 2924 << 14)
+#define MC__SequenceLoadSet_NONE                   1
+#define MC__SequenceLoadSet_S1                     2
+#define MC__SequenceLoadSet_S2                     3
+#define MC__SequenceLoadSet_I1                     4
+#define MC__SequenceLoadSet_I2                     5
+#define MC__SequenceLoadSet_M                      6
+#define MC__SequenceLoadSet_V                      7
+#define MC__SequenceLoadSet_O                      8
+#define MC__SequenceLoadSet_Z                      9
+#define MC__SequenceLoadSet_X1                    10
+#define MC__SequenceLoadSet_X2                    11
+#define MC_NONELoadSet                           (MCPARAMID)( 2925 << 14)
+#define MC_CamConfig_P60RM_O                     195
+#define MC__TotalFrameCount                      (MCPARAMID)( 2926 << 14)
+#define MC__SequenceLoadSet_W                     12
+#define MC__ACQW_Line1_Dur                       (MCPARAMID)( 2927 << 14)
+#define MC__ACQW_Acq_Dur                         (MCPARAMID)( 2928 << 14)
+#define MC__ACQW_Line3_Dur                       (MCPARAMID)( 2929 << 14)
+#define MC__ACQW_Line5_Dur                       (MCPARAMID)( 2930 << 14)
+#define MC_ASYNCI2LoadSet                        (MCPARAMID)( 2931 << 14)
+#define MC_FieldParityOrder                      (MCPARAMID)( 2932 << 14)
+#define MC_FieldParityOrder_UNDEFINED              1
+#define MC_FieldParityOrder_DWUP                   2
+#define MC_FieldParityOrder_UPDW                   3
+#define MC_AnalogGrabPosY_Ln                     (MCPARAMID)( 2933 << 14)
+#define MC_FrameSetLength_Fr                     (MCPARAMID)( 2934 << 14)
+#define MC_ACReset                               (MCPARAMID)( 2935 << 14)
+#define MC_ACReset_NO                              1
+#define MC_ACReset_YES                             2
+#define MC_ACResetWidth_us                       (MCPARAMID)( 2936 << 14)
+#define MC_ACResetPostDelay_us                   (MCPARAMID)( 2937 << 14)
+#define MC__PLL_LOCK_TIME_ms                     (MCPARAMID)( 2938 << 14)
+#define MC_INITC1_GPTCOUNT_us                    (MCPARAMID)( 2939 << 14)
+#define MC_INITC1_GPTCOUNT                       (MCPARAMID)( 2940 << 14)
+#define MC_INITC2_GPTCOUNT_us                    (MCPARAMID)( 2941 << 14)
+#define MC_INITC2_GPTCOUNT                       (MCPARAMID)( 2942 << 14)
+#define MC_Light                                 (MCPARAMID)( 2943 << 14)
+#define MC_Camera_AViiVA_M4CL6007                144
+#define MC__BoardType__COLORSCAN                  17
+#define MC_Strobe_Filter                         (MCPARAMID)( 2944 << 14)
+#define MC_SHC_DarkBackground                    (MCPARAMID)( 2945 << 14)
+#define MC_SHC_LightBackground                   (MCPARAMID)( 2946 << 14)
+#define MC_SHC_Dark                              (MCPARAMID)( 2947 << 14)
+#define MC_SHC_Light                             (MCPARAMID)( 2948 << 14)
+#define MC_SHC_UseIndex                          (MCPARAMID)( 2949 << 14)
+#define MC_SHC_StoreIndex                        (MCPARAMID)( 2950 << 14)
+#define MC_LUT_Table                             (MCPARAMID)( 2951 << 14)
+#define MC_LUT_Contrast                          (MCPARAMID)( 2952 << 14)
+#define MC_LUT_Brightness                        (MCPARAMID)( 2953 << 14)
+#define MC_LUT_Visibility                        (MCPARAMID)( 2954 << 14)
+#define MC_LUT_Negative                          (MCPARAMID)( 2955 << 14)
+#define MC_LUT_Negative_TRUE                       1
+#define MC_LUT_Negative_FALSE                      2
+#define MC_LUT_UseIndex                          (MCPARAMID)( 2956 << 14)
+#define MC_LUT_StoreIndex                        (MCPARAMID)( 2957 << 14)
+#define MC_SHC_UsePhysicalIndex                  (MCPARAMID)( 2958 << 14)
+#define MC_LUT_UsePhysicalIndex                  (MCPARAMID)( 2959 << 14)
+#define MC_SHC_OffsetAdjust                      (MCPARAMID)( 2960 << 14)
+#define MC_CamConfig_LxxxxRP                     196
+#define MC_CamConfig_L2098RP                     197
+#define MC_CamConfig_L2048RP                     198
+#define MC_CamConfig_L7500SP                     199
+#define MC_CamConfig_L7500RC                     200
+#define MC_CamConfig_L7500RG                     201
+#define MC_CamConfig_L7500RP                     202
+#define MC_CamConfig_L8192RP                     203
+#define MC_Camera_NUCL4096D                      145
+#define MC_Camera_NUCL7500D                      146
+#define MC_Camera_YD5060                         147
+#define MC_CamConfig_L6144RP                     204
+#define MC_Manufacturer_NED                       22
+#define MC_ColorRegistration_RGB                   5
+#define MC_ColorRegistration_GBR                   6
+#define MC_ColorRegistration_BRG                   7
+#define MC_ColorGap                              (MCPARAMID)( 2961 << 14)
+#define MC_STARTR_GPTCOUNT_us                    (MCPARAMID)( 2962 << 14)
+#define MC_STARTR_GPTCOUNT                       (MCPARAMID)( 2963 << 14)
+#define MC__SEQE_E                               (MCPARAMID)( 2964 << 14)
+#define MC_PostExpose_us                         (MCPARAMID)( 2965 << 14)
+#define MC_PostExpose_Tk                         (MCPARAMID)( 2966 << 14)
+#define MC_PostExpose_E                          (MCPARAMID)( 2967 << 14)
+#define MC__CSC_NROT                             (MCPARAMID)( 2968 << 14)
+#define MC__CSC_LNCPT                            (MCPARAMID)( 2969 << 14)
+#define MC__LCA_R1                               (MCPARAMID)( 2970 << 14)
+#define MC__LCA_R2                               (MCPARAMID)( 2971 << 14)
+#define MC__LCA_R3                               (MCPARAMID)( 2972 << 14)
+#define MC__LCA_R4                               (MCPARAMID)( 2973 << 14)
+#define MC__LCA_G1                               (MCPARAMID)( 2974 << 14)
+#define MC__LCA_G2                               (MCPARAMID)( 2975 << 14)
+#define MC__LCA_G3                               (MCPARAMID)( 2976 << 14)
+#define MC__LCA_G4                               (MCPARAMID)( 2977 << 14)
+#define MC__LCA_B1                               (MCPARAMID)( 2978 << 14)
+#define MC__LCA_B2                               (MCPARAMID)( 2979 << 14)
+#define MC__LCA_B3                               (MCPARAMID)( 2980 << 14)
+#define MC__LCA_B4                               (MCPARAMID)( 2981 << 14)
+#define MC__CSC_FMT                              (MCPARAMID)( 2982 << 14)
+#define MC__TilesX                               (MCPARAMID)( 2983 << 14)
+#define MC__TilesY                               (MCPARAMID)( 2984 << 14)
+#define MC_ScanDirection                         (MCPARAMID)( 2985 << 14)
+#define MC_ScanDirection_FORWARD                   1
+#define MC_ScanDirection_REVERSE                   2
+#define MC__ScanDelayR_Ln                        (MCPARAMID)( 2986 << 14)
+#define MC__ScanDelayG_Ln                        (MCPARAMID)( 2987 << 14)
+#define MC__ScanDelayB_Ln                        (MCPARAMID)( 2988 << 14)
+#define MC__RBT_DAV                              (MCPARAMID)( 2989 << 14)
+#define MC__RBT_OVF                              (MCPARAMID)( 2990 << 14)
+#define MC__BAD_LBAD                             (MCPARAMID)( 2991 << 14)
+#define MC__BAD_CBAD                             (MCPARAMID)( 2992 << 14)
+#define MC_CreationModel                         (MCPARAMID)( 2993 << 14)
+#define MC_CreationModel_COLORSCAN_M               1
+#define MC_CreationModel_VALUE_M                   2
+#define MC_CreationModel_EXPERT_M                  3
+#define MC_CreationModel_EXPERT_A                  4
+#define MC_CreationModel_EXPERT_B                  5
+#define MC_CreationModel_ALPHA_X                   6
+#define MC_CreationModel_ALPHA_XBIS                7
+#define MC_CreationModel_ALPHA_Y                   8
+#define MC_CreationModel_ALPHA_YBIS                9
+#define MC_CreationModel_IOTA_X                   10
+#define MC_CreationModel_GAMMA_X                  11
+#define MC_CreationModel_GAMMA_XBIS               12
+#define MC_CreationModel_GAMMA_Y                  13
+#define MC_CreationModel_GAMMA_YBIS               14
+#define MC_CreationModel_GAMMA_Z                  15
+#define MC_CreationModel_GAMMA_ZBIS               16
+#define MC_CreationModel_FAIL                     17
+#define MC_TileSizeX_Px                          (MCPARAMID)( 2994 << 14)
+#define MC_TileCountX                            (MCPARAMID)( 2995 << 14)
+#define MC_TileSizeY_Ln                          (MCPARAMID)( 2996 << 14)
+#define MC_TileCountY                            (MCPARAMID)( 2997 << 14)
+#define MC_ImageFlipX_Filter                     (MCPARAMID)( 2998 << 14)
+#define MC_ImageFlipY_Filter                     (MCPARAMID)( 2999 << 14)
+#define MC__BoardType__PICOLO_JETX                18
+#define MC_Camera_MyColorScanCameraLink          148
+#define MC_CamConfig_LxxxxSC                     205
+#define MC_CamConfig_LxxxxRG2                    206
+#define MC_CamConfig_L1024SC                     207
+#define MC_CamConfig_L2048SC                     208
+#define MC_CamConfig_L2098SC                     209
+#define MC_CamConfig_L4096SC                     210
+#define MC_CamConfig_L6144SC                     211
+#define MC_CamConfig_L7500SC                     212
+#define MC_CamConfig_L8192SC                     213
+#define MC_CameraRateMode                        (MCPARAMID)( 3000 << 14)
+#define MC_CameraRateMode_FREERUNNING              1
+#define MC_CameraRateMode_CONTROLLED               2
+#define MC_CameraRateMode_UNKNOWN                  3
+#define MC_LineCaptureMode                       (MCPARAMID)( 3001 << 14)
+#define MC_LineCaptureMode_ALL                     1
+#define MC_LineCaptureMode_PICK                    2
+#define MC___CameraRateMode_Check                (MCPARAMID)( 3002 << 14)
+#define MC___CameraRateMode_Check_PASS             1
+#define MC___CameraRateMode_Check_FAIL             2
+#define MC___LineRateMode_Check                  (MCPARAMID)( 3003 << 14)
+#define MC___LineRateMode_Check_PASS               1
+#define MC___LineRateMode_Check_FAIL               2
+#define MC_CrossPitch                            (MCPARAMID)( 3004 << 14)
+#define MC_CrossPitch_Filter                     (MCPARAMID)( 3005 << 14)
+#define MC_ScanDelayCompensation                 (MCPARAMID)( 3006 << 14)
+#define MC_ScanDelayCompensation_DISABLED          1
+#define MC_ScanDelayCompensation_ENABLED           2
+#define MC__ScanDelay_Ln                         (MCPARAMID)( 3007 << 14)
+#define MC__GrabberOffset                        (MCPARAMID)( 3008 << 14)
+#define MC_ColorFormat_JPEG                       57
+#define MC__CamConfig_INVALID                      1
+#define MC__CamConfig_AREA_SP                      2
+#define MC__CamConfig_AREA_RP                      3
+#define MC__CamConfig_AREA_SC                      4
+#define MC__CamConfig_AREA_RC                      5
+#define MC__CamConfig_AREA_RG                      6
+#define MC__CamConfig_AREA_RG2                     7
+#define MC__CamConfig_LINE_SP                      8
+#define MC__CamConfig_LINE_RP                      9
+#define MC__CamConfig_LINE_SC                     10
+#define MC__CamConfig_LINE_RC                     11
+#define MC__CamConfig_LINE_RG                     12
+#define MC__CamConfig_LINE_RG2                    13
+#define MC__CamConfig_TDI_SP                      14
+#define MC__CamConfig_TDI_RP                      15
+#define MC___CameraConfig_Check                  (MCPARAMID)( 3009 << 14)
+#define MC___CameraConfig_Check_PASS               1
+#define MC___CameraConfig_Check_FAIL               2
+#define MC__CSC_SEQ                              (MCPARAMID)( 3010 << 14)
+#define MC_ColorScanBypass                       (MCPARAMID)( 3011 << 14)
+#define MC_ColorScanBypass_OFF                     1
+#define MC_ColorScanBypass_ON                      2
+#define MC__CSC_BYP                              (MCPARAMID)( 3012 << 14)
+#define MC__CSC_SQM                              (MCPARAMID)( 3013 << 14)
+#define MC__STM1_T1SEL_T1END                      10
+#define MC__STM1_LRSEL                           (MCPARAMID)( 3014 << 14)
+#define MC__STM1_LRSEL_FTRIGS                      1
+#define MC__STM1_LRSEL_LTRIGS                      2
+#define MC__STM1_LRSEL_PPLS                        3
+#define MC__STM1_LRSEL_OFF                         4
+#define MC_SHC_InDataWidth                       (MCPARAMID)( 3015 << 14)
+#define MC_SHC_OutDataWidth                      (MCPARAMID)( 3016 << 14)
+#define MC_LUT_InDataWidth                       (MCPARAMID)( 3017 << 14)
+#define MC_LUT_OutDataWidth                      (MCPARAMID)( 3018 << 14)
+#define MC_Camera_AViiVA_M4CL8007                149
+#define MC_BoardTopology_UNIFORM                  29
+#define MC_BoardTopology_1_2                      30
+#define MC_BoardTopology_3_0                      31
+#define MC_BoardTopology_0_3                      32
+#define MC_CreationModel_COLORSCAN                18
+#define MC_CreationModel_0x801DFFFF               19
+#define MC_CreationModel_0                        20
+#define MC_CreationModel_0x8009FFFF               21
+#define MC_CreationModel_0x800AFFFF               22
+#define MC_CreationModel_0x800BFFFF               23
+#define MC_CreationModel_0x800CFFFF               24
+#define MC_CreationModel_MC_CHANNEL_GAMMA_X       25
+#define MC_CreationModel_MC_CHANNEL_GAMMA_XBIS    26
+#define MC_CreationModel_MC_CHANNEL_GAMMA_Y       27
+#define MC_CreationModel_MC_CHANNEL_GAMMA_YBIS    28
+#define MC_CreationModel_MC_CHANNEL_GAMMA_Z       29
+#define MC_CreationModel_MC_CHANNEL_GAMMA_ZBIS    30
+#define MC_BoardInUse                            (MCPARAMID)( 3019 << 14)
+#define MC__NormalOffsetXParity                  (MCPARAMID)( 3020 << 14)
+#define MC_ChannelCount                          (MCPARAMID)( 3021 << 14)
+#define MC_Camera_CV_A33                         150
+#define MC_CamConfig_P117SC                      214
+#define MC_CamConfig_P117RG                      215
+#define MC___PCIID_Check                         (MCPARAMID)( 3022 << 14)
+#define MC___PCIID_Check_PASS                      1
+#define MC___PCIID_Check_FAIL                      2
+#define MC__PCIBridge                            (MCPARAMID)( 3023 << 14)
+#define MC__PCIBridge_PLX9054                      1
+#define MC__PCIBridge_PLX9656                      2
+#define MC__PCIBridge_UNKNOWN                      3
+#define MC_Camera_A402k                          151
+#define MC__Category_Signaling                    30
+#define MC_AcquisitionCleanup                    (MCPARAMID)( 3024 << 14)
+#define MC_AcquisitionCleanup_DISABLED             1
+#define MC_AcquisitionCleanup_ENABLED              2
+#define MC_RecycleIfNecessary                    (MCPARAMID)( 3025 << 14)
+#define MC_RecycleIfNecessary_YES                  1
+#define MC_RecycleIfNecessary_NO                   2
+#define MC_Camera_CS6910CL                       152
+#define MC___FieldPeriod                         (MCPARAMID)( 3026 << 14)
+#define MC___SwitchingGrabDelay                  (MCPARAMID)( 3027 << 14)
+#define MC_HardTrigOnly_Filter                   (MCPARAMID)( 3028 << 14)
+#define MC_NextGrabField_Filter                  (MCPARAMID)( 3029 << 14)
+#define MC_GrabFld_Filter                        (MCPARAMID)( 3030 << 14)
+#define MC__NextGrabFieldParity                  (MCPARAMID)( 3031 << 14)
+#define MC__NextGrabFieldParity_ANY                1
+#define MC__NextGrabFieldParity_UP                 2
+#define MC__NextGrabFieldParity_DOWN               3
+#define MC__NextGrabFieldParity_KEEP               4
+#define MC__NextGrabFieldParity_CHANGE             5
+#define MC__R1FieldNumber                        (MCPARAMID)( 3032 << 14)
+#define MC__R1Parity                             (MCPARAMID)( 3033 << 14)
+#define MC__R1Parity_UP                            1
+#define MC__R1Parity_DOWN                          2
+#define MC__Category_Sequence_Interlace_Master    31
+#define MC__Vref_BACQR1_H                        (MCPARAMID)( 3034 << 14)
+#define MC__Vref_BACQR2_H                        (MCPARAMID)( 3035 << 14)
+#define MC__BACQR1_EACQR1_H                      (MCPARAMID)( 3036 << 14)
+#define MC__BACQR2_EACQR2_H                      (MCPARAMID)( 3037 << 14)
+#define MC__Vref_EACQR1_H                        (MCPARAMID)( 3038 << 14)
+#define MC__Vref_EACQR2_H                        (MCPARAMID)( 3039 << 14)
+#define MC__EACQR1_BACQR2_H                      (MCPARAMID)( 3040 << 14)
+#define MC__VDRIVEDur_H                          (MCPARAMID)( 3041 << 14)
+#define MC__SYNC_IM_VRSTOn_Pos                   (MCPARAMID)( 3042 << 14)
+#define MC__SYNC_IM_VRSTOff_Pos                  (MCPARAMID)( 3043 << 14)
+#define MC__SYNC_IM_ACQR1On_Pos                  (MCPARAMID)( 3044 << 14)
+#define MC__SYNC_IM_ACQR1Off_Pos                 (MCPARAMID)( 3045 << 14)
+#define MC__SYNC_IM_VRSTMIDOn_Pos                (MCPARAMID)( 3046 << 14)
+#define MC__SYNC_IM_VRSTMIDOff_Pos               (MCPARAMID)( 3047 << 14)
+#define MC__SYNC_IM_ACQR2On_Pos                  (MCPARAMID)( 3048 << 14)
+#define MC__SYNC_IM_ACQR2Off_Pos                 (MCPARAMID)( 3049 << 14)
+#define MC__SYNC_IM_R1_Line1_RPT                 (MCPARAMID)( 3050 << 14)
+#define MC__SYNC_IM_R1_Line2_RPT                 (MCPARAMID)( 3051 << 14)
+#define MC__SYNC_IM_R1_Line3_RPT                 (MCPARAMID)( 3052 << 14)
+#define MC__SYNC_IM_R1_Line4_RPT                 (MCPARAMID)( 3053 << 14)
+#define MC__SYNC_IM_R2_Line1_RPT                 (MCPARAMID)( 3054 << 14)
+#define MC__SYNC_IM_R2_Line2_RPT                 (MCPARAMID)( 3055 << 14)
+#define MC__SYNC_IM_R2_Line3_RPT                 (MCPARAMID)( 3056 << 14)
+#define MC__SYNC_IM_R2_Line4_RPT                 (MCPARAMID)( 3057 << 14)
+#define MC__SYNC_IM_IDLER1_Line1_RPT             (MCPARAMID)( 3058 << 14)
+#define MC__SYNC_IM_IDLER1_Line2_RPT             (MCPARAMID)( 3059 << 14)
+#define MC__SYNC_IM_IDLER1_Line3_RPT             (MCPARAMID)( 3060 << 14)
+#define MC__SYNC_IM_IDLER2_Line1_RPT             (MCPARAMID)( 3061 << 14)
+#define MC__SYNC_IM_IDLER2_Line2_RPT             (MCPARAMID)( 3062 << 14)
+#define MC__SYNC_IM_IDLER2_Line3_RPT             (MCPARAMID)( 3063 << 14)
+#define MC__SYNC_IM_ACQR_Line1_RPT               (MCPARAMID)( 3064 << 14)
+#define MC__SYNC_IM_ACQR1_Line2_RPT              (MCPARAMID)( 3065 << 14)
+#define MC__SYNC_IM_ACQR1_Line3_RPT              (MCPARAMID)( 3066 << 14)
+#define MC__SYNC_IM_ACQR1_Line4_RPT              (MCPARAMID)( 3067 << 14)
+#define MC__SYNC_IM_ACQR1_Line5_RPT              (MCPARAMID)( 3068 << 14)
+#define MC__SYNC_IM_ACQR2_Line2_RPT              (MCPARAMID)( 3069 << 14)
+#define MC__SYNC_IM_ACQR2_Line3_RPT              (MCPARAMID)( 3070 << 14)
+#define MC__SYNC_IM_ACQR2_Line4_RPT              (MCPARAMID)( 3071 << 14)
+#define MC__SYNC_IM_ACQR2_Line5_RPT              (MCPARAMID)( 3072 << 14)
+#define MC_F0                                    (MCPARAMID)( 3073 << 14)
+#define MC_F1                                    (MCPARAMID)( 3074 << 14)
+#define MC_F2                                    (MCPARAMID)( 3075 << 14)
+#define MC_I0                                    (MCPARAMID)( 3076 << 14)
+#define MC__Period_Min_us                        (MCPARAMID)( 3077 << 14)
+#define MC__Period_Min_PG                        (MCPARAMID)( 3078 << 14)
+#define MC__STB_x1STYL_HOLD                        6
+#define MC__STB_x2STYL_HOLD                        6
+#define MC___MSFWarning_Check                    (MCPARAMID)( 3079 << 14)
+#define MC___MSFWarning_Check_PASS                 1
+#define MC___MSFWarning_Check_FAIL                 2
+#define MC___TrigFilter_Check                    (MCPARAMID)( 3080 << 14)
+#define MC___TrigFilter_Check_PASS                 1
+#define MC___TrigFilter_Check_FAIL                 2
+#define MC___LineTrigFilter_Check                (MCPARAMID)( 3081 << 14)
+#define MC___LineTrigFilter_Check_PASS             1
+#define MC___LineTrigFilter_Check_FAIL             2
+#define MC_DecimationFactorY                     (MCPARAMID)( 3082 << 14)
+#define MC_InputConfig_Filter_MC_IN1             (MCPARAMID)( 3083 << 14)
+#define MC___InputId_MC_IN1                      (MCPARAMID)( 3084 << 14)
+#define MC_OutputConfig_Filter_MC_OUT1           (MCPARAMID)( 3085 << 14)
+#define MC___OutputId_MC_OUT1                    (MCPARAMID)( 3086 << 14)
+#define MC_OutputState_Filter_MC_OUT1            (MCPARAMID)( 3087 << 14)
+#define MC_OutputStyle_Filter_MC_OUT1            (MCPARAMID)( 3088 << 14)
+#define MC_OutputState_MC_OUT1                   (MCPARAMID)( 3089 << 14)
+#define MC_OutputState_MC_OUT1_HOLD                1
+#define MC_OutputState_MC_OUT1_LOW                 2
+#define MC_OutputState_MC_OUT1_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT2           (MCPARAMID)( 3090 << 14)
+#define MC___OutputId_MC_OUT2                    (MCPARAMID)( 3091 << 14)
+#define MC_OutputState_Filter_MC_OUT2            (MCPARAMID)( 3092 << 14)
+#define MC_OutputStyle_Filter_MC_OUT2            (MCPARAMID)( 3093 << 14)
+#define MC_OutputState_MC_OUT2                   (MCPARAMID)( 3094 << 14)
+#define MC_OutputState_MC_OUT2_HOLD                1
+#define MC_OutputState_MC_OUT2_LOW                 2
+#define MC_OutputState_MC_OUT2_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT3           (MCPARAMID)( 3095 << 14)
+#define MC___OutputId_MC_OUT3                    (MCPARAMID)( 3096 << 14)
+#define MC_OutputState_Filter_MC_OUT3            (MCPARAMID)( 3097 << 14)
+#define MC_OutputStyle_Filter_MC_OUT3            (MCPARAMID)( 3098 << 14)
+#define MC_OutputState_MC_OUT3                   (MCPARAMID)( 3099 << 14)
+#define MC_OutputState_MC_OUT3_HOLD                1
+#define MC_OutputState_MC_OUT3_LOW                 2
+#define MC_OutputState_MC_OUT3_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT4           (MCPARAMID)( 3100 << 14)
+#define MC___OutputId_MC_OUT4                    (MCPARAMID)( 3101 << 14)
+#define MC_OutputState_Filter_MC_OUT4            (MCPARAMID)( 3102 << 14)
+#define MC_OutputStyle_Filter_MC_OUT4            (MCPARAMID)( 3103 << 14)
+#define MC_OutputState_MC_OUT4                   (MCPARAMID)( 3104 << 14)
+#define MC_OutputState_MC_OUT4_HOLD                1
+#define MC_OutputState_MC_OUT4_LOW                 2
+#define MC_OutputState_MC_OUT4_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT5           (MCPARAMID)( 3105 << 14)
+#define MC___OutputId_MC_OUT5                    (MCPARAMID)( 3106 << 14)
+#define MC_OutputState_Filter_MC_OUT5            (MCPARAMID)( 3107 << 14)
+#define MC_OutputStyle_Filter_MC_OUT5            (MCPARAMID)( 3108 << 14)
+#define MC_OutputState_MC_OUT5                   (MCPARAMID)( 3109 << 14)
+#define MC_OutputState_MC_OUT5_HOLD                1
+#define MC_OutputState_MC_OUT5_LOW                 2
+#define MC_OutputState_MC_OUT5_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT6           (MCPARAMID)( 3110 << 14)
+#define MC___OutputId_MC_OUT6                    (MCPARAMID)( 3111 << 14)
+#define MC_OutputState_Filter_MC_OUT6            (MCPARAMID)( 3112 << 14)
+#define MC_OutputStyle_Filter_MC_OUT6            (MCPARAMID)( 3113 << 14)
+#define MC_OutputState_MC_OUT6                   (MCPARAMID)( 3114 << 14)
+#define MC_OutputState_MC_OUT6_HOLD                1
+#define MC_OutputState_MC_OUT6_LOW                 2
+#define MC_OutputState_MC_OUT6_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT7           (MCPARAMID)( 3115 << 14)
+#define MC___OutputId_MC_OUT7                    (MCPARAMID)( 3116 << 14)
+#define MC_OutputState_Filter_MC_OUT7            (MCPARAMID)( 3117 << 14)
+#define MC_OutputStyle_Filter_MC_OUT7            (MCPARAMID)( 3118 << 14)
+#define MC_OutputState_MC_OUT7                   (MCPARAMID)( 3119 << 14)
+#define MC_OutputState_MC_OUT7_HOLD                1
+#define MC_OutputState_MC_OUT7_LOW                 2
+#define MC_OutputState_MC_OUT7_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT8           (MCPARAMID)( 3120 << 14)
+#define MC___OutputId_MC_OUT8                    (MCPARAMID)( 3121 << 14)
+#define MC_OutputState_Filter_MC_OUT8            (MCPARAMID)( 3122 << 14)
+#define MC_OutputStyle_Filter_MC_OUT8            (MCPARAMID)( 3123 << 14)
+#define MC_OutputState_MC_OUT8                   (MCPARAMID)( 3124 << 14)
+#define MC_OutputState_MC_OUT8_HOLD                1
+#define MC_OutputState_MC_OUT8_LOW                 2
+#define MC_OutputState_MC_OUT8_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT9           (MCPARAMID)( 3125 << 14)
+#define MC___OutputId_MC_OUT9                    (MCPARAMID)( 3126 << 14)
+#define MC_OutputState_Filter_MC_OUT9            (MCPARAMID)( 3127 << 14)
+#define MC_OutputStyle_Filter_MC_OUT9            (MCPARAMID)( 3128 << 14)
+#define MC_OutputState_MC_OUT9                   (MCPARAMID)( 3129 << 14)
+#define MC_OutputState_MC_OUT9_HOLD                1
+#define MC_OutputState_MC_OUT9_LOW                 2
+#define MC_OutputState_MC_OUT9_HIGH                3
+#define MC_OutputConfig_Filter_MC_OUT10          (MCPARAMID)( 3130 << 14)
+#define MC___OutputId_MC_OUT10                   (MCPARAMID)( 3131 << 14)
+#define MC_OutputState_Filter_MC_OUT10           (MCPARAMID)( 3132 << 14)
+#define MC_OutputStyle_Filter_MC_OUT10           (MCPARAMID)( 3133 << 14)
+#define MC_OutputState_MC_OUT10                  (MCPARAMID)( 3134 << 14)
+#define MC_OutputState_MC_OUT10_HOLD               1
+#define MC_OutputState_MC_OUT10_LOW                2
+#define MC_OutputState_MC_OUT10_HIGH               3
+#define MC_OutputConfig_Filter_MC_OUT11          (MCPARAMID)( 3135 << 14)
+#define MC___OutputId_MC_OUT11                   (MCPARAMID)( 3136 << 14)
+#define MC_OutputState_Filter_MC_OUT11           (MCPARAMID)( 3137 << 14)
+#define MC_OutputStyle_Filter_MC_OUT11           (MCPARAMID)( 3138 << 14)
+#define MC_OutputState_MC_OUT11                  (MCPARAMID)( 3139 << 14)
+#define MC_OutputState_MC_OUT11_HOLD               1
+#define MC_OutputState_MC_OUT11_LOW                2
+#define MC_OutputState_MC_OUT11_HIGH               3
+#define MC_OutputConfig_Filter_MC_OUT12          (MCPARAMID)( 3140 << 14)
+#define MC___OutputId_MC_OUT12                   (MCPARAMID)( 3141 << 14)
+#define MC_OutputState_Filter_MC_OUT12           (MCPARAMID)( 3142 << 14)
+#define MC_OutputStyle_Filter_MC_OUT12           (MCPARAMID)( 3143 << 14)
+#define MC_OutputState_MC_OUT12                  (MCPARAMID)( 3144 << 14)
+#define MC_OutputState_MC_OUT12_HOLD               1
+#define MC_OutputState_MC_OUT12_LOW                2
+#define MC_OutputState_MC_OUT12_HIGH               3
+#define MC_OutputConfig_Filter_MC_OUT13          (MCPARAMID)( 3145 << 14)
+#define MC___OutputId_MC_OUT13                   (MCPARAMID)( 3146 << 14)
+#define MC_OutputState_Filter_MC_OUT13           (MCPARAMID)( 3147 << 14)
+#define MC_OutputStyle_Filter_MC_OUT13           (MCPARAMID)( 3148 << 14)
+#define MC_OutputState_MC_OUT13                  (MCPARAMID)( 3149 << 14)
+#define MC_OutputState_MC_OUT13_HOLD               1
+#define MC_OutputState_MC_OUT13_LOW                2
+#define MC_OutputState_MC_OUT13_HIGH               3
+#define MC_INTERLACERR4LoadSet                   (MCPARAMID)( 3150 << 14)
+#define MC__ASYNC_IRR4_VRST1Off_Pos              (MCPARAMID)( 3151 << 14)
+#define MC__ASYNC_IRR4_VRST2MIDOn_Pos            (MCPARAMID)( 3152 << 14)
+#define MC__ASYNC_IRR4_VRST2MIDOff_Pos           (MCPARAMID)( 3153 << 14)
+#define MC__ASYNC_IRR4_VRST3On_Pos               (MCPARAMID)( 3154 << 14)
+#define MC__ASYNC_IRR4_VRST3Off_Pos              (MCPARAMID)( 3155 << 14)
+#define MC__ASYNC_IRR4_ACQR1On_Pos               (MCPARAMID)( 3156 << 14)
+#define MC__ASYNC_IRR4_ACQR1Off_Pos              (MCPARAMID)( 3157 << 14)
+#define MC__ASYNC_IRR4_VRST4MIDOn_Pos            (MCPARAMID)( 3158 << 14)
+#define MC__ASYNC_IRR4_VRSTMIDOff_Pos            (MCPARAMID)( 3159 << 14)
+#define MC__ASYNC_IRR4_ACQR2On_Pos               (MCPARAMID)( 3160 << 14)
+#define MC__ASYNC_IRR4_ACQR2Off_Pos              (MCPARAMID)( 3161 << 14)
+#define MC__ASYNC_IRR4_Field1_Line1_RPT          (MCPARAMID)( 3162 << 14)
+#define MC__ASYNC_IRR4_Field1_Line2_RPT          (MCPARAMID)( 3163 << 14)
+#define MC__ASYNC_IRR4_Field2_Line1_RPT          (MCPARAMID)( 3164 << 14)
+#define MC__ASYNC_IRR4_Field2_Line3_RPT          (MCPARAMID)( 3165 << 14)
+#define MC__ASYNC_IRR4_Field3_Line1_RPT          (MCPARAMID)( 3166 << 14)
+#define MC__ASYNC_IRR4_Field3_Line2_RPT          (MCPARAMID)( 3167 << 14)
+#define MC__ASYNC_IRR4_Field3_Line3_RPT          (MCPARAMID)( 3168 << 14)
+#define MC__ASYNC_IRR4_Field3_Line4_RPT          (MCPARAMID)( 3169 << 14)
+#define MC__ASYNC_IRR4_Field4_Line1_RPT          (MCPARAMID)( 3170 << 14)
+#define MC__ASYNC_IRR4_Field4_Line2_RPT          (MCPARAMID)( 3171 << 14)
+#define MC__ASYNC_IRR4_Field4_Line3_RPT          (MCPARAMID)( 3172 << 14)
+#define MC__SequenceLoadSet_RR4                   13
+#define MC__Category_Sequence_Interlace_RR4       32
+#define MC__ASYNC_IRR4_VRST4MIDOff_Pos           (MCPARAMID)( 3173 << 14)
+#define MC__ASYNC_IRR4_Field2_Line2_RPT          (MCPARAMID)( 3174 << 14)
+#define MC__ASYNC_IRR4_Field4_Line4_RPT          (MCPARAMID)( 3175 << 14)
+#define MC_CamConfig_IxxRM_4                     216
+#define MC_ChannelTopology_QUADXQUAD              15
+#define MC_Camera_A403k                          153
+#define MC___ExposeReadout_Check                 (MCPARAMID)( 3176 << 14)
+#define MC___ExposeReadout_Check_PASS              1
+#define MC___ExposeReadout_Check_FAIL              2
+#define MC__CamConfig_AREA_RG1                    16
+#define MC__ExposeReadout                        (MCPARAMID)( 3177 << 14)
+#define MC__ExposeReadout_INVALID                  1
+#define MC__ExposeReadout_AREA_SP                  2
+#define MC__ExposeReadout_AREA_RP                  3
+#define MC__ExposeReadout_AREA_SC                  4
+#define MC__ExposeReadout_AREA_RC                  5
+#define MC__ExposeReadout_AREA_RG                  6
+#define MC__ExposeReadout_AREA_RG1                 7
+#define MC__ExposeReadout_AREA_RG2                 8
+#define MC__RESETSource                          (MCPARAMID)( 3178 << 14)
+#define MC__RESETSource_CUS2                       1
+#define MC__RESETSource_SUS2                       2
+#define MC_ExposureController                    (MCPARAMID)( 3179 << 14)
+#define MC_ExposureController_GRABBER              1
+#define MC_ExposureController_CAMERA               2
+#define MC_ExposureController_NONE                 3
+#define MC_Camera_InterlaceRR                    154
+#define MC_CamConfig_IxxRM                       217
+#define MC_Camera_4000m                          155
+#define MC_CamConfig_P16SC                       218
+#define MC_CamConfig_P16RG                       219
+#define MC_CamConfig_I50SM_R                     220
+#define MC_CamConfig_I60SM_R                     221
+#define MC_CamConfig_IxxSM_R                     222
+#define MC__ExposeReadout_AREA_SL                  9
+#define MC___LongPage_Check                      (MCPARAMID)( 3180 << 14)
+#define MC___LongPage_Check_PASS                   1
+#define MC___LongPage_Check_FAIL                   2
+#define MC___LongPage_BoardCheck                 (MCPARAMID)( 3181 << 14)
+#define MC___LongPage_BoardCheck_PASS              1
+#define MC___LongPage_BoardCheck_FAIL              2
+#define MC___LongPage_ParamCoherencyCheck        (MCPARAMID)( 3182 << 14)
+#define MC___LongPage_ParamCoherencyCheck_PASS     1
+#define MC___LongPage_ParamCoherencyCheck_FAIL     2
+#define MC__CSC_LNCPT_RESIDUE                    (MCPARAMID)( 3183 << 14)
+#define MC_ResidualTileCountY                    (MCPARAMID)( 3184 << 14)
+#define MC_Camera_KP_F100BCL                     156
+#define MC_B2Usage_TRIGGER                         3
+#define MC_Camera_XC_ES30                        157
+#define MC_Camera_XC_ES30CE                      158
+#define MC_Camera_2000m                          159
+#define MC_Camera_TM_4000CL                      160
+#define MC_CamConfig_P32SC                       223
+#define MC_CamConfig_P32RG                       224
+#define MC__BoardType__PICOLO_TETRAX              19
+#define MC__BoardType__JUNIOR_4                   20
+#define MC_Camera_SI_M100                        161
+#define MC_CamConfig_P17SA                       225
+#define MC_CamConfig_P17RA                       226
+#define MC_CamConfig_P17RA_G                     227
+#define MC_Manufacturer_COSTAR                    23
+#define MC_Camera_CS8541D                        162
+#define MC__Board_Type__HARMONY                    5
+#define MC__BoardType__HARMONY                    21
+#define MC_GrabberIx                             (MCPARAMID)( 3185 << 14)
+#define MC_Tap                                   (MCPARAMID)( 3186 << 14)
+#define MC_HSLane                                (MCPARAMID)( 3187 << 14)
+#define MC_VSLane                                (MCPARAMID)( 3188 << 14)
+#define MC_ASR                                   (MCPARAMID)( 3189 << 14)
+#define MC_TLD_S                                 (MCPARAMID)( 3190 << 14)
+#define MC_HPD_S                                 (MCPARAMID)( 3191 << 14)
+#define MC_SPD_S                                 (MCPARAMID)( 3192 << 14)
+#define MC_OffsetGate_S                          (MCPARAMID)( 3193 << 14)
+#define MC_EMN                                   (MCPARAMID)( 3194 << 14)
+#define MC_EMX                                   (MCPARAMID)( 3195 << 14)
+#define MC_OMN                                   (MCPARAMID)( 3196 << 14)
+#define MC_OMX                                   (MCPARAMID)( 3197 << 14)
+#define MC_TLD                                   (MCPARAMID)( 3198 << 14)
+#define MC__TLD_S                                (MCPARAMID)( 3199 << 14)
+#define MC_SPD                                   (MCPARAMID)( 3200 << 14)
+#define MC__SPD_S                                (MCPARAMID)( 3201 << 14)
+#define MC_HPD                                   (MCPARAMID)( 3202 << 14)
+#define MC__HPD_S                                (MCPARAMID)( 3203 << 14)
+#define MC_SSB                                   (MCPARAMID)( 3204 << 14)
+#define MC_SBP                                   (MCPARAMID)( 3205 << 14)
+#define MC__OffsetGate_S                         (MCPARAMID)( 3206 << 14)
+#define MC_SVA                                   (MCPARAMID)( 3207 << 14)
+#define MC_SSA                                   (MCPARAMID)( 3208 << 14)
+#define MC_VCC                                   (MCPARAMID)( 3209 << 14)
+#define MC_LAC                                   (MCPARAMID)( 3210 << 14)
+#define MC_TAC                                   (MCPARAMID)( 3211 << 14)
+#define MC_MNS_R                                 (MCPARAMID)( 3212 << 14)
+#define MC__MNS                                  (MCPARAMID)( 3213 << 14)
+#define MC_MNS                                   (MCPARAMID)( 3214 << 14)
+#define MC_MXS_R                                 (MCPARAMID)( 3215 << 14)
+#define MC__MXS                                  (MCPARAMID)( 3216 << 14)
+#define MC_MXS                                   (MCPARAMID)( 3217 << 14)
+#define MC_VSC                                   (MCPARAMID)( 3218 << 14)
+#define MC_VSC_INTERLACE                           1
+#define MC_VSC_PROGRESSIVE                         2
+#define MC_CDC                                   (MCPARAMID)( 3219 << 14)
+#define MC_CDC_PAL                                 1
+#define MC_CDC_NTSC                                2
+#define MC_CDC_MONOCHROME                          3
+#define MC_CDC_PAL_TRAP                            4
+#define MC_CDC_NTSC_TRAP                           5
+#define MC_SPC                                   (MCPARAMID)( 3220 << 14)
+#define MC_SPC_PAL_SYNC                            1
+#define MC_SPC_PAL_EVEN                            2
+#define MC_SPC_PAL_ODD                             3
+#define MC_SPC_NTSC_SYNC                           4
+#define MC_SPC_NTSC_EVEN                           5
+#define MC_SPC_NTSC_ODD                            6
+#define MC_ChannelIx                             (MCPARAMID)( 3221 << 14)
+#define MC__SyncPhase                            (MCPARAMID)( 3222 << 14)
+#define MC__SyncPhase_EVEN                         1
+#define MC__SyncPhase_ODD                          2
+#define MC_DRP_R                                 (MCPARAMID)( 3223 << 14)
+#define MC_RHL_R                                 (MCPARAMID)( 3224 << 14)
+#define MC_RHA                                   (MCPARAMID)( 3225 << 14)
+#define MC_RHL                                   (MCPARAMID)( 3226 << 14)
+#define MC_RHD                                   (MCPARAMID)( 3227 << 14)
+#define MC_RHT                                   (MCPARAMID)( 3228 << 14)
+#define MC_RVA                                   (MCPARAMID)( 3229 << 14)
+#define MC_RVL                                   (MCPARAMID)( 3230 << 14)
+#define MC_RVD                                   (MCPARAMID)( 3231 << 14)
+#define MC_RVT                                   (MCPARAMID)( 3232 << 14)
+#define MC_RHD_0                                 (MCPARAMID)( 3233 << 14)
+#define MC_RHD_1                                 (MCPARAMID)( 3234 << 14)
+#define MC_RHD_2                                 (MCPARAMID)( 3235 << 14)
+#define MC_DummyRHD_0                            (MCPARAMID)( 3236 << 14)
+#define MC_DummyRHD_1                            (MCPARAMID)( 3237 << 14)
+#define MC_DummyRHD_2                            (MCPARAMID)( 3238 << 14)
+#define MC_AlphaComponent                        (MCPARAMID)( 3239 << 14)
+#define MC_DRL                                   (MCPARAMID)( 3240 << 14)
+#define MC__Gain                                 (MCPARAMID)( 3241 << 14)
+#define MC__Offset                               (MCPARAMID)( 3242 << 14)
+#define MC_SBS                                   (MCPARAMID)( 3243 << 14)
+#define MC_URG_0                                 (MCPARAMID)( 3244 << 14)
+#define MC__Gain_0                               (MCPARAMID)( 3245 << 14)
+#define MC_URG_1                                 (MCPARAMID)( 3246 << 14)
+#define MC__Gain_1                               (MCPARAMID)( 3247 << 14)
+#define MC_URG_2                                 (MCPARAMID)( 3248 << 14)
+#define MC__Gain_2                               (MCPARAMID)( 3249 << 14)
+#define MC_URO_0                                 (MCPARAMID)( 3250 << 14)
+#define MC__Offset_0                             (MCPARAMID)( 3251 << 14)
+#define MC_URO_1                                 (MCPARAMID)( 3252 << 14)
+#define MC__Offset_1                             (MCPARAMID)( 3253 << 14)
+#define MC_URO_2                                 (MCPARAMID)( 3254 << 14)
+#define MC__Offset_2                             (MCPARAMID)( 3255 << 14)
+#define MC_KernelIx                              (MCPARAMID)( 3256 << 14)
+#define MC_CVN                                   (MCPARAMID)( 3257 << 14)
+#define MC_KAS                                   (MCPARAMID)( 3258 << 14)
+#define MC_Kernel                                (MCPARAMID)( 3259 << 14)
+#define MC_Kernel_F12_CT_NTSC                      1
+#define MC_Kernel_F12_S1_NTSC                      2
+#define MC_Kernel_F13_CT_NTSC                      3
+#define MC_Kernel_F13_CT_PAL                       4
+#define MC_Kernel_F13_S1_NTSC                      5
+#define MC_Kernel_F13_S1_PAL                       6
+#define MC_Kernel_F13_S2_PAL                       7
+#define MC_Kernel_F15_CT_PAL                       8
+#define MC_Kernel_F15_S1_PAL                       9
+#define MC_Kernel_F18_S1_HIRES                    10
+#define MC_Kernel_F20_S1_HIRES                    11
+#define MC_Kernel_F23_S1_HIRES                    12
+#define MC_Kernel_F25_S1_HIRES                    13
+#define MC_Kernel_F25_S1_NTSC                     14
+#define MC_Kernel_F28_S1_HIRES                    15
+#define MC_Kernel_F30_S1_PAL                      16
+#define MC_Kernel_F32_S1_HIRES                    17
+#define MC_Kernel_F35_S1_HIRES                    18
+#define MC_Kernel_F40_S1_HIRES                    19
+#define MC__SyncPhase_ANY                          3
+#define MC_JpegQuality                           (MCPARAMID)( 3260 << 14)
+#define MC_Module_12_Present                     (MCPARAMID)( 3261 << 14)
+#define MC_ModuleVideoAddress_                   (MCPARAMID)( 3262 << 14)
+#define MC_InputStyle_Filter_MC_IN1              (MCPARAMID)( 3263 << 14)
+#define MC_InputConfig_Filter_MC_IN2             (MCPARAMID)( 3264 << 14)
+#define MC___InputId_MC_IN2                      (MCPARAMID)( 3265 << 14)
+#define MC_InputStyle_Filter_MC_IN2              (MCPARAMID)( 3266 << 14)
+#define MC_InputConfig_Filter_MC_IN3             (MCPARAMID)( 3267 << 14)
+#define MC___InputId_MC_IN3                      (MCPARAMID)( 3268 << 14)
+#define MC_InputStyle_Filter_MC_IN3              (MCPARAMID)( 3269 << 14)
+#define MC_InputConfig_Filter_MC_IN4             (MCPARAMID)( 3270 << 14)
+#define MC___InputId_MC_IN4                      (MCPARAMID)( 3271 << 14)
+#define MC_InputStyle_Filter_MC_IN4              (MCPARAMID)( 3272 << 14)
+#define MC_InputConfig_Filter_MC_IN5             (MCPARAMID)( 3273 << 14)
+#define MC___InputId_MC_IN5                      (MCPARAMID)( 3274 << 14)
+#define MC_InputStyle_Filter_MC_IN5              (MCPARAMID)( 3275 << 14)
+#define MC__ChannelActivationDelay               (MCPARAMID)( 3276 << 14)
+#define MC_Camera_XC_56                          163
+#define MC_Camera_MV_D640                        164
+#define MC_Camera_MV_D1024                       165
+#define MC_CamConfig_P200SC                      228
+#define MC_CamConfig_P200RG                      229
+#define MC_CamConfig_P75SC                       230
+#define MC_CamConfig_P75RG                       231
+#define MC_Manufacturer_PHOTONFOCUS               24
+#define MC_AcqStep_Px                            (MCPARAMID)( 3277 << 14)
+#define MC_CamConfig_P200RC                      232
+#define MC_GrabWindow_FIT                          5
+#define MC_MIO_SB_Present                        (MCPARAMID)( 3278 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN1       (MCPARAMID)( 3279 << 14)
+#define MC___InputId_MC_MIOSB_IN1                (MCPARAMID)( 3280 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN1        (MCPARAMID)( 3281 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN2       (MCPARAMID)( 3282 << 14)
+#define MC___InputId_MC_MIOSB_IN2                (MCPARAMID)( 3283 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN2        (MCPARAMID)( 3284 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN3       (MCPARAMID)( 3285 << 14)
+#define MC___InputId_MC_MIOSB_IN3                (MCPARAMID)( 3286 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN3        (MCPARAMID)( 3287 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN4       (MCPARAMID)( 3288 << 14)
+#define MC___InputId_MC_MIOSB_IN4                (MCPARAMID)( 3289 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN4        (MCPARAMID)( 3290 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN5       (MCPARAMID)( 3291 << 14)
+#define MC___InputId_MC_MIOSB_IN5                (MCPARAMID)( 3292 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN5        (MCPARAMID)( 3293 << 14)
+#define MC_InputConfig_Filter_MC_MIOSB_IN6       (MCPARAMID)( 3294 << 14)
+#define MC___InputId_MC_MIOSB_IN6                (MCPARAMID)( 3295 << 14)
+#define MC_InputStyle_Filter_MC_MIOSB_IN6        (MCPARAMID)( 3296 << 14)
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT1     (MCPARAMID)( 3297 << 14)
+#define MC___OutputId_MC_MIOSB_OUT1              (MCPARAMID)( 3298 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT1      (MCPARAMID)( 3299 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT1      (MCPARAMID)( 3300 << 14)
+#define MC_OutputState_MC_MIOSB_OUT1             (MCPARAMID)( 3301 << 14)
+#define MC_OutputState_MC_MIOSB_OUT1_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT1_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT1_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT2     (MCPARAMID)( 3302 << 14)
+#define MC___OutputId_MC_MIOSB_OUT2              (MCPARAMID)( 3303 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT2      (MCPARAMID)( 3304 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT2      (MCPARAMID)( 3305 << 14)
+#define MC_OutputState_MC_MIOSB_OUT2             (MCPARAMID)( 3306 << 14)
+#define MC_OutputState_MC_MIOSB_OUT2_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT2_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT2_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT3     (MCPARAMID)( 3307 << 14)
+#define MC___OutputId_MC_MIOSB_OUT3              (MCPARAMID)( 3308 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT3      (MCPARAMID)( 3309 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT3      (MCPARAMID)( 3310 << 14)
+#define MC_OutputState_MC_MIOSB_OUT3             (MCPARAMID)( 3311 << 14)
+#define MC_OutputState_MC_MIOSB_OUT3_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT3_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT3_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT4     (MCPARAMID)( 3312 << 14)
+#define MC___OutputId_MC_MIOSB_OUT4              (MCPARAMID)( 3313 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT4      (MCPARAMID)( 3314 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT4      (MCPARAMID)( 3315 << 14)
+#define MC_OutputState_MC_MIOSB_OUT4             (MCPARAMID)( 3316 << 14)
+#define MC_OutputState_MC_MIOSB_OUT4_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT4_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT4_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT5     (MCPARAMID)( 3317 << 14)
+#define MC___OutputId_MC_MIOSB_OUT5              (MCPARAMID)( 3318 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT5      (MCPARAMID)( 3319 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT5      (MCPARAMID)( 3320 << 14)
+#define MC_OutputState_MC_MIOSB_OUT5             (MCPARAMID)( 3321 << 14)
+#define MC_OutputState_MC_MIOSB_OUT5_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT5_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT5_HIGH          3
+#define MC_OutputConfig_Filter_MC_MIOSB_OUT6     (MCPARAMID)( 3322 << 14)
+#define MC___OutputId_MC_MIOSB_OUT6              (MCPARAMID)( 3323 << 14)
+#define MC_OutputState_Filter_MC_MIOSB_OUT6      (MCPARAMID)( 3324 << 14)
+#define MC_OutputStyle_Filter_MC_MIOSB_OUT6      (MCPARAMID)( 3325 << 14)
+#define MC_OutputState_MC_MIOSB_OUT6             (MCPARAMID)( 3326 << 14)
+#define MC_OutputState_MC_MIOSB_OUT6_HOLD          1
+#define MC_OutputState_MC_MIOSB_OUT6_LOW           2
+#define MC_OutputState_MC_MIOSB_OUT6_HIGH          3
+#define MC_InputPinName_I5                        68
+#define MC_InputPinName_I6                        69
+#define MC_OutputPinName_O5                       76
+#define MC_OutputPinName_O6                       77
+#define MC_FLT                                   (MCPARAMID)( 3327 << 14)
+#define MC_FLT_OFF                                 1
+#define MC_FLT_ON                                  2
+#define MC__DigitizersMask                       (MCPARAMID)( 3328 << 14)
+#define MC_IDP_CFG                               (MCPARAMID)( 3329 << 14)
+#define MC_TRM                                   (MCPARAMID)( 3330 << 14)
+#define MC_TRM_OFF                                 1
+#define MC_TRM_ON                                  2
+#define MC__VideoLanesMask                       (MCPARAMID)( 3331 << 14)
+#define MC_IDP_TRM                               (MCPARAMID)( 3332 << 14)
+#define MC_BufferSize                            (MCPARAMID)( 3333 << 14)
+#define MC_MinBufferSize                         (MCPARAMID)( 3334 << 14)
+#define MC_MinBufferPitch                        (MCPARAMID)( 3335 << 14)
+#define MC_BufferPitch                           (MCPARAMID)( 3336 << 14)
+#define MC__ScaleFactor                          (MCPARAMID)( 3337 << 14)
+#define MC_GainTrim1_Filter                      (MCPARAMID)( 3338 << 14)
+#define MC_GainTrim2_Filter                      (MCPARAMID)( 3339 << 14)
+#define MC_GainTrim3_Filter                      (MCPARAMID)( 3340 << 14)
+#define MC_OffsetTrim1_Filter                    (MCPARAMID)( 3341 << 14)
+#define MC_OffsetTrim2_Filter                    (MCPARAMID)( 3342 << 14)
+#define MC_OffsetTrim3_Filter                    (MCPARAMID)( 3343 << 14)
+#define MC_ConnectorName_DIGITAL_IO               18
+#define MC_ConnectorName_DB9                      19
+#define MC_Scaling                               (MCPARAMID)( 3344 << 14)
+#define MC_Scaling_ENABLE                          1
+#define MC_Scaling_DISABLE                         2
+#define MC_Camera_CV_M9CL                        166
+#define MC_CamConfig_P30RG_O                     233
+#define MC_Camera_XC_HR57                        167
+#define MC_Camera_XC_HR58                        168
+#define MC_Camera_VCC_8350CL                     169
+#define MC_Camera_VCC_8550CL                     170
+#define MC_Camera_VCC_8750CL                     171
+#define MC_Camera_VCC_8850CL                     172
+#define MC_Camera_1600c                          173
+#define MC_CamConfig_P12SC                       234
+#define MC_CamConfig_P12RG                       235
+#define MC_CamConfig_P30RC                       236
+#define MC_CamConfig_P16RC                       237
+#define MC_CamConfig_P12RC                       238
+#define MC_Camera_1600c_S                        174
+#define MC_Camera_1600c_D                        175
+#define MC_Camera_1600c_S_RGB                    176
+#define MC_Camera_1600c_D_RGB                    177
+#define MC_CamConfig_P17SC                       239
+#define MC_CamConfig_P17RG                       240
+#define MC_CamConfig_P34SC                       241
+#define MC_CamConfig_P34RG                       242
+#define MC_TapStructure_HEX_B2                    20
+#define MC_ChannelTopology_MEDIUM_2T24_1X2_1Y     16
+#define MC__ASSY_SIX                               6
+#define MC__UserScaleY                           (MCPARAMID)( 3345 << 14)
+#define MC_InputConfig_Filter_MC_IN6             (MCPARAMID)( 3346 << 14)
+#define MC___InputId_MC_IN6                      (MCPARAMID)( 3347 << 14)
+#define MC_InputStyle_Filter_MC_IN6              (MCPARAMID)( 3348 << 14)
+#define MC_InputConfig_Filter_MC_IN7             (MCPARAMID)( 3349 << 14)
+#define MC___InputId_MC_IN7                      (MCPARAMID)( 3350 << 14)
+#define MC_InputStyle_Filter_MC_IN7              (MCPARAMID)( 3351 << 14)
+#define MC_InputConfig_Filter_MC_IN8             (MCPARAMID)( 3352 << 14)
+#define MC___InputId_MC_IN8                      (MCPARAMID)( 3353 << 14)
+#define MC_InputStyle_Filter_MC_IN8              (MCPARAMID)( 3354 << 14)
+#define MC_InputConfig_Filter_MC_IN9             (MCPARAMID)( 3355 << 14)
+#define MC___InputId_MC_IN9                      (MCPARAMID)( 3356 << 14)
+#define MC_InputStyle_Filter_MC_IN9              (MCPARAMID)( 3357 << 14)
+#define MC_InputConfig_Filter_MC_IN10            (MCPARAMID)( 3358 << 14)
+#define MC___InputId_MC_IN10                     (MCPARAMID)( 3359 << 14)
+#define MC_InputStyle_Filter_MC_IN10             (MCPARAMID)( 3360 << 14)
+#define MC_InputConfig_Filter_MC_IN11            (MCPARAMID)( 3361 << 14)
+#define MC___InputId_MC_IN11                     (MCPARAMID)( 3362 << 14)
+#define MC_InputStyle_Filter_MC_IN11             (MCPARAMID)( 3363 << 14)
+#define MC_InputConfig_Filter_MC_IN12            (MCPARAMID)( 3364 << 14)
+#define MC___InputId_MC_IN12                     (MCPARAMID)( 3365 << 14)
+#define MC_InputStyle_Filter_MC_IN12             (MCPARAMID)( 3366 << 14)
+#define MC_InputConfig_Filter_MC_IN13            (MCPARAMID)( 3367 << 14)
+#define MC___InputId_MC_IN13                     (MCPARAMID)( 3368 << 14)
+#define MC_InputStyle_Filter_MC_IN13             (MCPARAMID)( 3369 << 14)
+#define MC_ConnectorName_IO_LINES                 20
+#define MC_ConnectorName_IO_SCREW_TERMINAL        21
+#define MC_Camera_1000m_D                        178
+#define MC_Camera_1000m_S                        179
+#define MC_Camera_1600m_D                        180
+#define MC_Camera_1600m_S                        181
+#define MC_Camera_2000m_D                        182
+#define MC_Camera_2000m_S                        183
+#define MC_Camera_4000m_D                        184
+#define MC_Camera_4000m_S                        185
+#define MC_ConnectorName_CTL                      22
+#define MC_RCable_A15_C20                         21
+#define MC_Cable_A15_C20                         146
+#define MC_CableName_Single_Channel_Teli_Remote_Head  91
+#define MC__Board_Type__MELODY                     6
+#define MC__BoardType__MELODY                     22
+#define MC_BoardTopology_1                        33
+#define MC_CamConfig_P17SD                       243
+#define MC_CamConfig_P17RD_G                     244
+#define MC_CamConfig_P17RD                       245
+#define MC_ColorFormat_YV12                       58
+#define MC_HSamplePeriod                         (MCPARAMID)( 3370 << 14)
+#define MC_VSamplePeriod                         (MCPARAMID)( 3371 << 14)
+#define MC_Camera_NSUF7400CL                     186
+#define MC_CamConfig_L12500RP                    246
+#define MC_ConverterMute                         (MCPARAMID)( 3372 << 14)
+#define MC_ConverterMute_OFF                       1
+#define MC_ConverterMute_ON                        2
+#define MC__CPG_PGMOD_PM_CONTROLLED_LR             4
+#define MC_ColorFormat_YVU9                       59
+#define MC_ComponentSwap                         (MCPARAMID)( 3373 << 14)
+#define MC_Camera_SU51                           187
+#define MC_Camera_SU74                           188
+#define MC_CamConfig_L7400RP                     247
+#define MC_CamConfig_L5150SP                     248
+#define MC_CamConfig_L5150RP                     249
+#define MC_CamConfig_L7400SP                     250
+#define MC_ColorFormat_YUV9                       60
+#define MC_ColorFormat_YUV422PL                   61
+#define MC_ColorFormat_YUV411PL                   62
+#define MC_ColorFormat_IYUV                       63
+#define MC_ColorFormat_I420                       64
+#define MC_ColorFormat_Y42B                       65
+#define MC_ColorFormat_Y41B                       66
+#define MC_Camera_KP_F200CL                      189
+#define MC_OnMinSpeed                            (MCPARAMID)( 3374 << 14)
+#define MC_OnMinSpeed_IDLING                       1
+#define MC_OnMinSpeed_MUTING                       2
+#define MC_ColorFormat_YUV411                     67
+#define MC_FrameRate_Hz                          (MCPARAMID)( 3375 << 14)
+#define MC_PhaseTrigMode                         (MCPARAMID)( 3376 << 14)
+#define MC_PhaseTrigMode_IMMEDIATE                 1
+#define MC_PhaseTrigMode_HARD                      2
+#define MC_PhaseTrigMode_SOFT                      3
+#define MC_PhaseTrigMode_COMBINED                  4
+#define MC_PhaseTrigMode_TIMER                     5
+#define MC_TimerPeriodFl_ms                      (MCPARAMID)( 3377 << 14)
+#define MC_TimerPeriod_ms                        (MCPARAMID)( 3378 << 14)
+#define MC_StandardFrameRate_Hz                  (MCPARAMID)( 3379 << 14)
+#define MC__FrameRate_Hz                         (MCPARAMID)( 3380 << 14)
+#define MC__ImageWidth                           (MCPARAMID)( 3381 << 14)
+#define MC__FifoWidth                            (MCPARAMID)( 3382 << 14)
+#define MC__EndOfLineWidth                       (MCPARAMID)( 3383 << 14)
+#define MC__ConvolverOutputSize                  (MCPARAMID)( 3384 << 14)
+#define MC_TimerPeriodFl_us                      (MCPARAMID)( 3385 << 14)
+#define MC_TimerPeriod_us                        (MCPARAMID)( 3386 << 14)
+#define MC_SeqTrigMode                           (MCPARAMID)( 3387 << 14)
+#define MC_SeqTrigMode_IMMEDIATE                   1
+#define MC_SeqTrigMode_HARD                        2
+#define MC_SeqTrigMode_SOFT                        3
+#define MC_SeqTrigMode_COMBINED                    4
+#define MC_ControlledFrameRate                   (MCPARAMID)( 3388 << 14)
+#define MC_ControlledFrameRate_YES                 1
+#define MC_ControlledFrameRate_NO                  2
+#define MC_SeqCount                              (MCPARAMID)( 3389 << 14)
+#define MC__NextTrigMode                         (MCPARAMID)( 3390 << 14)
+#define MC__NextTrigMode_IMMEDIATE                 1
+#define MC__NextTrigMode_HARD                      2
+#define MC__NextTrigMode_SOFT                      3
+#define MC__NextTrigMode_COMBINED                  4
+#define MC_EndTrigEdge_HIGH                        3
+#define MC_EndTrigEdge_LOW                         4
+#define MC__DRS_CACQ_FRAME                         3
+#define MC__TrigLineSupported                    (MCPARAMID)( 3391 << 14)
+#define MC__TrigLineSupported_YES                  1
+#define MC__TrigLineSupported_NO                   2
+#define MC_Camera_2000c_D                        190
+#define MC_TransferInfoLocation                  (MCPARAMID)( 3392 << 14)
+#define MC_TransferInfoLocation_LOCAL              1
+#define MC_TransferInfoLocation_HOST               2
+#define MC__CDC_TPGTAP1                          (MCPARAMID)( 3393 << 14)
+#define MC__CDC_TPGTAP2                          (MCPARAMID)( 3394 << 14)
+#define MC__CDC_TPGTAP3                          (MCPARAMID)( 3395 << 14)
+#define MC__Board_Type__DELTA                      7
+#define MC__BoardType__DELTA                      23
+#define MC_GrabberConfig_1_0_1_0                  93
+#define MC_GrabberConfig_0_1_0_1                  94
+#define MC_Connector_X1                          119
+#define MC_Connector_X2                          120
+#define MC_Connector_Y1                          121
+#define MC_Connector_Y2                          122
+#define MC_NextGrabberConfig_1_0_1_0              90
+#define MC_NextGrabberConfig_0_1_0_1              91
+#define MC_ConnectorName_CAMX1                    23
+#define MC_ConnectorName_CAMX2                    24
+#define MC_ConnectorName_CAMY1                    25
+#define MC_ConnectorName_CAMY2                    26
+#define MC_BoardTopology_1_3                      34
+#define MC_BoardTopology_3_1                      35
+#define MC__Category_Synchronization              33
+#define MC__Category_Acquisition_control          34
+#define MC_AcquisitionMode                       (MCPARAMID)( 3396 << 14)
+#define MC_AcquisitionMode_SNAPSHOT                1
+#define MC_AcquisitionMode_HFR                     2
+#define MC_AcquisitionMode_PAGE                    3
+#define MC_AcquisitionMode_WEB                     4
+#define MC_AcquisitionMode_LONGPAGE                5
+#define MC_AcquisitionMode_Filter                (MCPARAMID)( 3397 << 14)
+#define MC_ActivityLength_Sq                     (MCPARAMID)( 3398 << 14)
+#define MC_SeqLength_Ph                          (MCPARAMID)( 3399 << 14)
+#define MC_SeqLength_Sl                          (MCPARAMID)( 3400 << 14)
+#define MC_SeqLength_Ln                          (MCPARAMID)( 3401 << 14)
+#define MC_PhaseLength_Sl                        (MCPARAMID)( 3402 << 14)
+#define MC_Operation_UNUSED                        9
+#define MC__WFC_ACQCNT                           (MCPARAMID)( 3403 << 14)
+#define MC__WSC_TotalFrameCount                  (MCPARAMID)( 3404 << 14)
+#define MC_PageLength_LowLimit_Ln                (MCPARAMID)( 3405 << 14)
+#define MC_ActivityLength                        (MCPARAMID)( 3406 << 14)
+#define MC_SeqLength_Fr                          (MCPARAMID)( 3407 << 14)
+#define MC_SeqLength_Pg                          (MCPARAMID)( 3408 << 14)
+#define MC_PhaseLength_Fr                        (MCPARAMID)( 3409 << 14)
+#define MC_SIMSTARTCHSet                         (MCPARAMID)( 3410 << 14)
+#define MC_Dummy                                 (MCPARAMID)( 3411 << 14)
+#define MC_PhaseLength_Optimal_Fr                (MCPARAMID)( 3412 << 14)
+#define MC_PhaseLength_Minimal_Fr                (MCPARAMID)( 3413 << 14)
+#define MC_PageLength_Optimal_Ln                 (MCPARAMID)( 3414 << 14)
+#define MC_PageLength_Minimal_Ln                 (MCPARAMID)( 3415 << 14)
+#define MC_KST                                   (MCPARAMID)( 3416 << 14)
+#define MC_KST_PREDEFINED                          1
+#define MC_KST_CUSTOM                              2
+#define MC_KST_FROMFILE                            3
+#define MC_SHP                                   (MCPARAMID)( 3417 << 14)
+#define MC_SHP_LOWPASS                             1
+#define MC_SHP_COLORTRAP                           2
+#define MC_SHP_PASSBAND                            3
+#define MC_SHP_PEAKING                             4
+#define MC_SHP_PEAKTRAP                            5
+#define MC_PhaseLength_Pg                        (MCPARAMID)( 3418 << 14)
+#define MC_KASR                                  (MCPARAMID)( 3419 << 14)
+#define MC_KDN                                   (MCPARAMID)( 3420 << 14)
+#define MC_BWF                                   (MCPARAMID)( 3421 << 14)
+#define MC_CBF                                   (MCPARAMID)( 3422 << 14)
+#define MC_PWF                                   (MCPARAMID)( 3423 << 14)
+#define MC_CFF                                   (MCPARAMID)( 3424 << 14)
+#define MC_CWF                                   (MCPARAMID)( 3425 << 14)
+#define MC_SSN                                   (MCPARAMID)( 3426 << 14)
+#define MC_EndTrigMode_Filter                    (MCPARAMID)( 3427 << 14)
+#define MC_BreakEffect_Filter                    (MCPARAMID)( 3428 << 14)
+#define MC_HMode                                 (MCPARAMID)( 3429 << 14)
+#define MC_HMode_ANALOG_LANE1                      1
+#define MC_HMode_DIGITAL_PULSED                    2
+#define MC_HMode_DIGITAL_MIXED                     3
+#define MC_HMode_LOCAL                             4
+#define MC_VMode                                 (MCPARAMID)( 3430 << 14)
+#define MC_VMode_ANALOG_LANE1                      1
+#define MC_VMode_DIGITAL_PULSED                    2
+#define MC_VMode_DIGITAL_MIXED                     3
+#define MC_VMode_LOCAL                             4
+#define MC_HReference                            (MCPARAMID)( 3431 << 14)
+#define MC_HReference_CAMERA                       1
+#define MC_HReference_LOCAL                        2
+#define MC_HReference_REMOTE                       3
+#define MC_VReference                            (MCPARAMID)( 3432 << 14)
+#define MC_VReference_CAMERA                       1
+#define MC_VReference_LOCAL                        2
+#define MC_VReference_REMOTE                       3
+#define MC_KernelAddress                         (MCPARAMID)( 3433 << 14)
+#define MC_KernelNB                              (MCPARAMID)( 3434 << 14)
+#define MC___HFR_Check                           (MCPARAMID)( 3435 << 14)
+#define MC___HFR_Check_PASS                        1
+#define MC___HFR_Check_FAIL                        2
+#define MC___HFR_BoardCheck                      (MCPARAMID)( 3436 << 14)
+#define MC___HFR_BoardCheck_PASS                   1
+#define MC___HFR_BoardCheck_FAIL                   2
+#define MC_AcquisitionMode_INVALID                 6
+#define MC___FilteredParams_Check                (MCPARAMID)( 3437 << 14)
+#define MC___FilteredParams_Check_PASS             1
+#define MC___FilteredParams_Check_FAIL             2
+#define MC_LogFilePath                           (MCPARAMID)( 3438 << 14)
+#define MC__AutomaticParamsCheck                 (MCPARAMID)( 3439 << 14)
+#define MC__AutomaticParamsCheck_YES               1
+#define MC__AutomaticParamsCheck_NO                2
+#define MC__FilteredParams_Check                 (MCPARAMID)( 3440 << 14)
+#define MC__FilteredParams_Check_PASS              1
+#define MC__FilteredParams_Check_FAIL              2
+#define MC_ParamsConsistency                     (MCPARAMID)( 3441 << 14)
+#define MC_ParamsConsistency_PASS                  1
+#define MC_ParamsConsistency_FAIL                  2
+#define MC_ParamsErrorLog                        (MCPARAMID)( 3442 << 14)
+#define MC_ParamsConsistencyCheck                (MCPARAMID)( 3443 << 14)
+#define MC_ParamsConsistencyCheck_AUTO             1
+#define MC_ParamsConsistencyCheck_MANUAL           2
+#define MC_TargetFrameRate_Hz                    (MCPARAMID)( 3444 << 14)
+#define MC_AcquisitionMode_VIDEO                   7
+#define MC_NextTrigMode_PERIODIC                   9
+#define MC_TrigLineIndex                         (MCPARAMID)( 3445 << 14)
+#define MC_EndTrigLineIndex                      (MCPARAMID)( 3446 << 14)
+#define MC_EndTrigCtl                            (MCPARAMID)( 3447 << 14)
+#define MC_EndTrigCtl_TTL                          1
+#define MC__BCC_Value                            (MCPARAMID)( 3448 << 14)
+#define MC__BCC_Value_PASS                         1
+#define MC__BCC_Value_FAIL                         2
+#define MC__BCC_Expert                           (MCPARAMID)( 3449 << 14)
+#define MC__BCC_Expert_PASS                        1
+#define MC__BCC_Expert_FAIL                        2
+#define MC__BCC_Expert2                          (MCPARAMID)( 3450 << 14)
+#define MC__BCC_Expert2_PASS                       1
+#define MC__BCC_Expert2_FAIL                       2
+#define MC__BCC_ColorScan                        (MCPARAMID)( 3451 << 14)
+#define MC__BCC_ColorScan_PASS                     1
+#define MC__BCC_ColorScan_FAIL                     2
+#define MC_PerSecond_Fr                          (MCPARAMID)( 3452 << 14)
+#define MC_Camera_XCLmV500                       191
+#define MC_Camera_XCLmX700                       192
+#define MC_Camera_XCLmU1000                      193
+#define MC_Camera_XCLmU1000C                     194
+#define MC_CableName_CameraLink_Miniature         92
+#define MC_Camera_XCL_V500                       195
+#define MC_Camera_XCL_X700                       196
+#define MC_Camera_XCL_U1000                      197
+#define MC_Camera_XCL_U1000C                     198
+#define MC_Cable_CL_C04                          147
+#define MC_Elapsed_Fr                            (MCPARAMID)( 3453 << 14)
+#define MC_Remaining_Fr                          (MCPARAMID)( 3454 << 14)
+#define MC_Elapsed_Pg                            (MCPARAMID)( 3455 << 14)
+#define MC_Elapsed_Ln                            (MCPARAMID)( 3456 << 14)
+#define MC_Remaining_Pg                          (MCPARAMID)( 3457 << 14)
+#define MC_Remaining_Ln                          (MCPARAMID)( 3458 << 14)
+#define MC_Camera_CS8550i_01                     199
+#define MC_Camera_CS8550i                        200
+#define MC_Camera_KP_F30                         201
+#define MC_Camera_KP_F30x                        202
+#define MC_CamConfig_P70RA                       251
+#define MC_CamConfig_P70RM                       252
+#define MC_CamConfig_P70SA                       253
+#define MC_CamConfig_P70SM                       254
+#define MC_TrigCtl_DIFF                            7
+#define MC_StrobeCtl_DIFF                          6
+#define MC_MDMPEnable                            (MCPARAMID)( 3459 << 14)
+#define MC_MDMPEnable_TRUE                         1
+#define MC_MDMPEnable_FALSE                        2
+#define MC__Category_D3_Signal_Properties         35
+#define MC__Category_D3_Kernel_Properties         36
+#define MC__Category_D3_Configuration             37
+#define MC__Category_D3_Resampler                 38
+#define MC__Category_D3_Resampling                39
+#define MC__BoardType__SYMPHONY                   24
+#define MC_STARTCHSet                            (MCPARAMID)( 3460 << 14)
+#define MC_InputPinName_ENHANCED_IO1              70
+#define MC_InputPinName_ENHANCED_IO2              71
+#define MC_InputPinName_ENHANCED_IO3              72
+#define MC_InputPinName_ENHANCED_IO4              73
+#define MC_InputPinName_TR                        74
+#define MC_InputPinName_CC1                       75
+#define MC_InputPinName_CC2                       76
+#define MC_InputPinName_CC3                       77
+#define MC_InputPinName_CC4                       78
+#define MC_InputPinName_CC5                       79
+#define MC_InputPinLocked                        (MCPARAMID)( 3461 << 14)
+#define MC_InputPinLocked_TRUE                     1
+#define MC_InputPinLocked_FALSE                    2
+#define MC_OutputState_LOOP1                      11
+#define MC_OutputState_LOOP2                      12
+#define MC_OutputPinName_Enhanced_IO1             78
+#define MC_OutputPinName_Enhanced_IO2             79
+#define MC_OutputPinName_Enhanced_IO3             80
+#define MC_OutputPinName_Enhanced_IO4             81
+#define MC_OutputPinName_ST                       82
+#define MC_OutputPinName_CC5                      83
+#define MC_OutputState_17_LOOP1                    4
+#define MC_OutputState_17_LOOP2                    5
+#define MC_OutputState_18_LOOP1                    4
+#define MC_OutputState_18_LOOP2                    5
+#define MC_OutputState_1_LOOP1                     6
+#define MC_OutputState_1_LOOP2                     7
+#define MC_OutputState_2_LOOP1                     4
+#define MC_OutputState_2_LOOP2                     5
+#define MC_OutputState_3_LOOP1                     4
+#define MC_OutputState_3_LOOP2                     5
+#define MC_OutputState_4_LOOP1                     4
+#define MC_OutputState_4_LOOP2                     5
+#define MC_OutputState_22_LOOP1                    4
+#define MC_OutputState_22_LOOP2                    5
+#define MC_OutputState_23_LOOP1                    4
+#define MC_OutputState_23_LOOP2                    5
+#define MC_OutputState_24_LOOP1                    4
+#define MC_OutputState_24_LOOP2                    5
+#define MC_OutputState_25_LOOP1                    4
+#define MC_OutputState_25_LOOP2                    5
+#define MC_OutputState_26_LOOP1                    4
+#define MC_OutputState_26_LOOP2                    5
+#define MC_OutputState_32_LOOP1                    4
+#define MC_OutputState_32_LOOP2                    5
+#define MC_OutputState_33_LOOP1                    4
+#define MC_OutputState_33_LOOP2                    5
+#define MC_OutputState_34_LOOP1                    4
+#define MC_OutputState_34_LOOP2                    5
+#define MC_OutputState_35_LOOP1                    4
+#define MC_OutputState_35_LOOP2                    5
+#define MC_OutputState_36_LOOP1                    4
+#define MC_OutputState_36_LOOP2                    5
+#define MC_OutputStyle_DIFF                        9
+#define MC_MDMPDec                               (MCPARAMID)( 3462 << 14)
+#define MC_MDMPOffset                            (MCPARAMID)( 3463 << 14)
+#define MC_HdriveLine_CC1                          8
+#define MC_HdriveLine_CC2                          9
+#define MC_HdriveLine_CC3                         10
+#define MC_HdriveLine_CC4                         11
+#define MC_HdriveLine_CC5                         12
+#define MC_VdriveLine_CC1                          8
+#define MC_VdriveLine_CC2                          9
+#define MC_VdriveLine_CC3                         10
+#define MC_VdriveLine_CC4                         11
+#define MC_VdriveLine_CC5                         12
+#define MC_ResetLine_CC5                          12
+#define MC_AuxResetLine_CC5                       12
+#define MC_HsyncLine_CC1                           8
+#define MC_HsyncLine_CC2                           9
+#define MC_HsyncLine_CC3                          10
+#define MC_HsyncLine_CC4                          11
+#define MC_HsyncLine_CC5                          12
+#define MC_VsyncLine_CC1                           8
+#define MC_VsyncLine_CC2                           9
+#define MC_VsyncLine_CC3                          10
+#define MC_VsyncLine_CC4                          11
+#define MC_VsyncLine_CC5                          12
+#define MC_CsyncLine                             (MCPARAMID)( 3464 << 14)
+#define MC_CsyncLine_NC                            1
+#define MC_CsyncLine_CC1                           2
+#define MC_CsyncLine_CC2                           3
+#define MC_CsyncLine_CC3                           4
+#define MC_CsyncLine_CC4                           5
+#define MC_CsyncLine_CC5                           6
+#define MC_GainG                                 (MCPARAMID)( 3465 << 14)
+#define MC_GainR                                 (MCPARAMID)( 3466 << 14)
+#define MC_GainB                                 (MCPARAMID)( 3467 << 14)
+#define MC_OffsetG                               (MCPARAMID)( 3468 << 14)
+#define MC_OffsetR                               (MCPARAMID)( 3469 << 14)
+#define MC_OffsetB                               (MCPARAMID)( 3470 << 14)
+#define MC_PinCC1_Usage                          (MCPARAMID)( 3471 << 14)
+#define MC_PinCC1_Usage_NONE                       1
+#define MC_PinCC1_Usage_INPUT                      2
+#define MC_PinCC1_Usage_LOW                        3
+#define MC_PinCC1_Usage_HIGH                       4
+#define MC_PinCC1_Usage_VDRIVE                     5
+#define MC_PinCC1_Usage_RESET                      6
+#define MC_PinCC1_Usage_AUXRESET                   7
+#define MC_PinCC1_Usage_HDRIVE                     8
+#define MC_PinCC1_Dir                            (MCPARAMID)( 3472 << 14)
+#define MC_PinCC1_Dir_INPUT                        1
+#define MC_PinCC1_Dir_OUTPUT                       2
+#define MC_PinCC1_PinCC2_STYLE                   (MCPARAMID)( 3473 << 14)
+#define MC_PinCC1_PinCC2_STYLE_TTL                 1
+#define MC_PinCC1_PinCC2_STYLE_LVDS                2
+#define MC_PinCC1_Source                         (MCPARAMID)( 3474 << 14)
+#define MC_PinCC1_Source_LOW                       1
+#define MC_PinCC1_Source_HIGH                      2
+#define MC_PinCC1_Source_HDRIVE                    3
+#define MC_PinCC1_Source_VDRIVE                    4
+#define MC_PinCC1_Source_RESET                     5
+#define MC_PinCC1_Source_AUXRESET                  6
+#define MC_PinCC1_Source_UNKNOWN                   7
+#define MC_PinCC3_PinCC4_Style                   (MCPARAMID)( 3475 << 14)
+#define MC_PinCC3_PinCC4_Style_TTL                 1
+#define MC_PinCC3_PinCC4_Style_LVDS                2
+#define MC_PinCC2_Dir                            (MCPARAMID)( 3476 << 14)
+#define MC_PinCC2_Dir_INPUT                        1
+#define MC_PinCC2_Dir_OUTPUT                       2
+#define MC_PinCC2_Source                         (MCPARAMID)( 3477 << 14)
+#define MC_PinCC2_Source_LOW                       1
+#define MC_PinCC2_Source_HIGH                      2
+#define MC_PinCC2_Source_HDRIVE                    3
+#define MC_PinCC2_Source_VDRIVE                    4
+#define MC_PinCC2_Source_RESET                     5
+#define MC_PinCC2_Source_AUXRESET                  6
+#define MC_PinCC2_Source_UNKNOWN                   7
+#define MC_PinCC3_Dir                            (MCPARAMID)( 3478 << 14)
+#define MC_PinCC3_Dir_INPUT                        1
+#define MC_PinCC3_Dir_OUTPUT                       2
+#define MC_PinCC3_Source                         (MCPARAMID)( 3479 << 14)
+#define MC_PinCC3_Source_LOW                       1
+#define MC_PinCC3_Source_HIGH                      2
+#define MC_PinCC3_Source_HDRIVE                    3
+#define MC_PinCC3_Source_VDRIVE                    4
+#define MC_PinCC3_Source_RESET                     5
+#define MC_PinCC3_Source_AUXRESET                  6
+#define MC_PinCC3_Source_UNKNOWN                   7
+#define MC_PinCC4_Dir                            (MCPARAMID)( 3480 << 14)
+#define MC_PinCC4_Dir_INPUT                        1
+#define MC_PinCC4_Dir_OUTPUT                       2
+#define MC_PinCC4_Source                         (MCPARAMID)( 3481 << 14)
+#define MC_PinCC4_Source_LOW                       1
+#define MC_PinCC4_Source_HIGH                      2
+#define MC_PinCC4_Source_HDRIVE                    3
+#define MC_PinCC4_Source_VDRIVE                    4
+#define MC_PinCC4_Source_RESET                     5
+#define MC_PinCC4_Source_AUXRESET                  6
+#define MC_PinCC4_Source_UNKNOWN                   7
+#define MC_PinCC5_Dir                            (MCPARAMID)( 3482 << 14)
+#define MC_PinCC5_Dir_INPUT                        1
+#define MC_PinCC5_Dir_OUTPUT                       2
+#define MC_PinCC5_Source                         (MCPARAMID)( 3483 << 14)
+#define MC_PinCC5_Source_LOW                       1
+#define MC_PinCC5_Source_HIGH                      2
+#define MC_PinCC5_Source_HDRIVE                    3
+#define MC_PinCC5_Source_VDRIVE                    4
+#define MC_PinCC5_Source_RESET                     5
+#define MC_PinCC5_Source_AUXRESET                  6
+#define MC_PinCC5_Source_UNKNOWN                   7
+#define MC_PinSMIO1_Dir                          (MCPARAMID)( 3484 << 14)
+#define MC_PinSMIO1_Dir_INPUT                      1
+#define MC_PinSMIO1_Dir_OUTPUT                     2
+#define MC_PinSMIO1_Dir_UNKNOWN                    3
+#define MC_PinSMIO1_Source                       (MCPARAMID)( 3485 << 14)
+#define MC_PinSMIO1_Source_LOW                     1
+#define MC_PinSMIO1_Source_HIGH                    2
+#define MC_PinSMIO1_Source_STROBE                  3
+#define MC_PinSMIO1_Source_UNKNOWN                 4
+#define MC_PinSMIO2_Dir                          (MCPARAMID)( 3486 << 14)
+#define MC_PinSMIO2_Dir_INPUT                      1
+#define MC_PinSMIO2_Dir_OUTPUT                     2
+#define MC_PinSMIO2_Dir_UNKNOWN                    3
+#define MC_PinSMIO2_Source                       (MCPARAMID)( 3487 << 14)
+#define MC_PinSMIO2_Source_LOW                     1
+#define MC_PinSMIO2_Source_HIGH                    2
+#define MC_PinSMIO2_Source_STROBE                  3
+#define MC_PinSMIO2_Source_UNKNOWN                 4
+#define MC_PinSTR_Source                         (MCPARAMID)( 3488 << 14)
+#define MC_PinSTR_Source_LOW                       1
+#define MC_PinSTR_Source_HIGH                      2
+#define MC_PinSTR_Source_STROBE                    3
+#define MC_PinSTR_Source_UNKNOWN                   4
+#define MC_TrigLine_IO1                           14
+#define MC_TrigLine_IO2                           15
+#define MC_TrigLine_IO3                           16
+#define MC_TrigLine_IO4                           17
+#define MC__TrigLine_IO1                          24
+#define MC__TrigLine_IO2                          25
+#define MC__TrigLine_IO3                          26
+#define MC__TrigLine_IO4                          27
+#define MC_StrobeLine_IO1                          8
+#define MC_StrobeLine_IO2                          9
+#define MC_StrobeLine_IO3                         10
+#define MC_StrobeLine_IO4                         11
+#define MC_StrobeLine_STX                         12
+#define MC_StrobeLine_STY                         13
+#define MC__StrobeLine_IO1                        10
+#define MC__StrobeLine_IO2                        11
+#define MC__StrobeLine_IO3                        12
+#define MC__StrobeLine_IO4                        13
+#define MC_PinSMIO3_Dir                          (MCPARAMID)( 3489 << 14)
+#define MC_PinSMIO3_Dir_INPUT                      1
+#define MC_PinSMIO3_Dir_OUTPUT                     2
+#define MC_PinSMIO3_Dir_UNKNOWN                    3
+#define MC_PinSMIO3_Source                       (MCPARAMID)( 3490 << 14)
+#define MC_PinSMIO3_Source_LOW                     1
+#define MC_PinSMIO3_Source_HIGH                    2
+#define MC_PinSMIO3_Source_STROBE                  3
+#define MC_PinSMIO3_Source_UNKNOWN                 4
+#define MC_PinSMIO4_Dir                          (MCPARAMID)( 3491 << 14)
+#define MC_PinSMIO4_Dir_INPUT                      1
+#define MC_PinSMIO4_Dir_OUTPUT                     2
+#define MC_PinSMIO4_Dir_UNKNOWN                    3
+#define MC_PinSMIO4_Source                       (MCPARAMID)( 3492 << 14)
+#define MC_PinSMIO4_Source_LOW                     1
+#define MC_PinSMIO4_Source_HIGH                    2
+#define MC_PinSMIO4_Source_STROBE                  3
+#define MC_PinSMIO4_Source_UNKNOWN                 4
+#define MC_PinSTX_Source                         (MCPARAMID)( 3493 << 14)
+#define MC_PinSTX_Source_LOW                       1
+#define MC_PinSTX_Source_HIGH                      2
+#define MC_PinSTX_Source_STROBE                    3
+#define MC_PinSTX_Source_UNKNOWN                   4
+#define MC_PinSTY_Source                         (MCPARAMID)( 3494 << 14)
+#define MC_PinSTY_Source_LOW                       1
+#define MC_PinSTY_Source_HIGH                      2
+#define MC_PinSTY_Source_STROBE                    3
+#define MC_PinSTY_Source_UNKNOWN                   4
+#define MC_TrigCtl_LVDS                            8
+#define MC_StrobeCtl_OPTO                          7
+#define MC_TrigLine_TR                            18
+#define MC_StrobeLine_ST                          14
+#define MC_OutputStyle_OPTO                       10
+#define MC_HsyncCtl_LVDS                           5
+#define MC_VsyncCtl_LVDS                           5
+#define MC_TDScale_100ns                         (MCPARAMID)( 3495 << 14)
+#define MC_TrigDelay_TDSCL                       (MCPARAMID)( 3496 << 14)
+#define MC_TrigDelay_TDScale                     (MCPARAMID)( 3497 << 14)
+#define MC__EScale_100ns                         (MCPARAMID)( 3498 << 14)
+#define MC__Expose_E                             (MCPARAMID)( 3499 << 14)
+#define MC__PostExpose_E                         (MCPARAMID)( 3500 << 14)
+#define MC__RESETOn_E                            (MCPARAMID)( 3501 << 14)
+#define MC__RESETOff_E                           (MCPARAMID)( 3502 << 14)
+#define MC__OpenVsyncGate_E                      (MCPARAMID)( 3503 << 14)
+#define MC__SScale_100ns                         (MCPARAMID)( 3504 << 14)
+#define MC_EXPOn2STROBEOff_E                     (MCPARAMID)( 3505 << 14)
+#define MC__PreStrobe_E                          (MCPARAMID)( 3506 << 14)
+#define MC__PREEXP_us                            (MCPARAMID)( 3507 << 14)
+#define MC__EXP_us                               (MCPARAMID)( 3508 << 14)
+#define MC__POSTEXP_us                           (MCPARAMID)( 3509 << 14)
+#define MC__PREEXP_E                             (MCPARAMID)( 3510 << 14)
+#define MC__EXP_E                                (MCPARAMID)( 3511 << 14)
+#define MC__POSTEXP_E                            (MCPARAMID)( 3512 << 14)
+#define MC__SSpan_us                             (MCPARAMID)( 3513 << 14)
+#define MC__EXP_S                                (MCPARAMID)( 3514 << 14)
+#define MC__PreStrobe_S                          (MCPARAMID)( 3515 << 14)
+#define MC__STR_S                                (MCPARAMID)( 3516 << 14)
+#define MC_EXPOn2STROBEOff_S                     (MCPARAMID)( 3517 << 14)
+#define MC_EXPOn2STROff_S                        (MCPARAMID)( 3518 << 14)
+#define MC__EXPOn2STROff_S                       (MCPARAMID)( 3519 << 14)
+#define MC__STPOS_DSB                            (MCPARAMID)( 3520 << 14)
+#define MC__STPOS_ASB                            (MCPARAMID)( 3521 << 14)
+#define MC__STPOS_SLO                            (MCPARAMID)( 3522 << 14)
+#define MC__STPOS_End                            (MCPARAMID)( 3523 << 14)
+#define MC__ETPOS_AuxResetOn                     (MCPARAMID)( 3524 << 14)
+#define MC__ETPOS_AuxResetOff                    (MCPARAMID)( 3525 << 14)
+#define MC__ETPOS_ResetOn                        (MCPARAMID)( 3526 << 14)
+#define MC__ETPOS_ResetOff                       (MCPARAMID)( 3527 << 14)
+#define MC__ETPOS_OpenVsyncGate                  (MCPARAMID)( 3528 << 14)
+#define MC__ETPOS_CloseVsyncGate                 (MCPARAMID)( 3529 << 14)
+#define MC__ETPOS_End                            (MCPARAMID)( 3530 << 14)
+#define MC_Readout_us                            (MCPARAMID)( 3531 << 14)
+#define MC__RDO_us                               (MCPARAMID)( 3532 << 14)
+#define MC__RSpan_us                             (MCPARAMID)( 3533 << 14)
+#define MC__RScale_100ns                         (MCPARAMID)( 3534 << 14)
+#define MC__RDO_E                                (MCPARAMID)( 3535 << 14)
+#define MC__RTPOS_SR                             (MCPARAMID)( 3536 << 14)
+#define MC__RTPOS_NSLA                           (MCPARAMID)( 3537 << 14)
+#define MC__RTPOS_End                            (MCPARAMID)( 3538 << 14)
+#define MC__Category_Readout_Control              40
+#define MC__TrueExp_100ns                        (MCPARAMID)( 3539 << 14)
+#define MC__ExposeTrimFactor                     (MCPARAMID)( 3540 << 14)
+#define MC__PREEXP_100ns                         (MCPARAMID)( 3541 << 14)
+#define MC__EXP_100ns                            (MCPARAMID)( 3542 << 14)
+#define MC__POSTEXP_100ns                        (MCPARAMID)( 3543 << 14)
+#define MC__ESpan_100ns                          (MCPARAMID)( 3544 << 14)
+#define MC_Readout_100ns                         (MCPARAMID)( 3545 << 14)
+#define MC__RDO_100ns                            (MCPARAMID)( 3546 << 14)
+#define MC__RSpan_100s                           (MCPARAMID)( 3547 << 14)
+#define MC__SSpan_100ns                          (MCPARAMID)( 3548 << 14)
+#define MC__RSpan_100ns                          (MCPARAMID)( 3549 << 14)
+#define MC_TDTScale_100ns                        (MCPARAMID)( 3550 << 14)
+#define MC__ETSpan_100ns                         (MCPARAMID)( 3551 << 14)
+#define MC__ETScale_100ns                        (MCPARAMID)( 3552 << 14)
+#define MC__RTSpan_100ns                         (MCPARAMID)( 3553 << 14)
+#define MC__RTScale_100ns                        (MCPARAMID)( 3554 << 14)
+#define MC__STSpan_100ns                         (MCPARAMID)( 3555 << 14)
+#define MC__STScale_100ns                        (MCPARAMID)( 3556 << 14)
+#define MC_TrigDelay_T                           (MCPARAMID)( 3557 << 14)
+#define MC__ETPOS_EndExpose                      (MCPARAMID)( 3558 << 14)
+#define MC_HCsyncToClamp_ns                      (MCPARAMID)( 3559 << 14)
+#define MC_ClampDur_ns                           (MCPARAMID)( 3560 << 14)
+#define MC_SyncPattern                           (MCPARAMID)( 3561 << 14)
+#define MC_SyncPattern_PALSYNC                     1
+#define MC_SyncPattern_NTSCSYNC                    2
+#define MC_SyncPattern_PALEVEN                     3
+#define MC_SyncPattern_PALODD                      4
+#define MC_SyncPattern_NTSCEVEN                    5
+#define MC_SyncPattern_NTSCODD                     6
+#define MC_VideoFilter_Filter                    (MCPARAMID)( 3562 << 14)
+#define MC_VrefSearchWindowLeft_IT               (MCPARAMID)( 3563 << 14)
+#define MC_VrefSearchWindowRight_IT              (MCPARAMID)( 3564 << 14)
+#define MC_Vsync2Vref_IT                         (MCPARAMID)( 3565 << 14)
+#define MC_VrefSearchWindowLeft_TT               (MCPARAMID)( 3566 << 14)
+#define MC_VrefSearchWindowRight_TT              (MCPARAMID)( 3567 << 14)
+#define MC_Vsync2Vref_TT                         (MCPARAMID)( 3568 << 14)
+#define MC_VideoFilter_COLORTRAP                   6
+#define MC_VsyncLNB                              (MCPARAMID)( 3569 << 14)
+#define MC_Expose_Filter                         (MCPARAMID)( 3570 << 14)
+#define MC_Readout_Filter                        (MCPARAMID)( 3571 << 14)
+#define MC__RDO_R                                (MCPARAMID)( 3572 << 14)
+#define MC__RTSS                                 (MCPARAMID)( 3573 << 14)
+#define MC__RTSS_OpenVsyncGate                     1
+#define MC__RTSS_GatedVsync                        2
+#define MC__VsyncFilter                          (MCPARAMID)( 3574 << 14)
+#define MC__VsyncFilter_OFF                        1
+#define MC__VsyncFilter_ON                         2
+#define MC__VsyncFilter_MEDIUM                     3
+#define MC__VsyncFilter_STRONG                     4
+#define MC__PREEXP_S                             (MCPARAMID)( 3575 << 14)
+#define MC__TrigDelay_S                          (MCPARAMID)( 3576 << 14)
+#define MC_Gain_Filter                           (MCPARAMID)( 3577 << 14)
+#define MC_Camera_IK_TF1                         203
+#define MC_Camera_IK_TF5                         204
+#define MC_Camera_IK_TF7                         205
+#define MC_Manufacturer_TOSHIBA                   25
+#define MC_RCable_A15_C21                         22
+#define MC_Cable_A15_C21                         148
+#define MC_CableName_Triple_Channel_RGB           93
+#define MC_SeqLength_Fr_Filter                   (MCPARAMID)( 3578 << 14)
+#define MC_SeqLength_Pg_Filter                   (MCPARAMID)( 3579 << 14)
+#define MC_SeqLength_Ln_Filter                   (MCPARAMID)( 3580 << 14)
+#define MC_PhaseLength_Fr_Filter                 (MCPARAMID)( 3581 << 14)
+#define MC_CCE_Filter                            (MCPARAMID)( 3582 << 14)
+#define MC___PageLength_Error_Check              (MCPARAMID)( 3583 << 14)
+#define MC___PageLength_Error_Check_PASS           1
+#define MC___PageLength_Error_Check_FAIL           2
+#define MC__Category_Camera_Advanced_Features     41
+#define MC_CamConfig_PxxRG_PartialScan           255
+#define MC_SonyXCL_V500PartialScan_Filter        (MCPARAMID)( 3584 << 14)
+#define MC_SonyXCL_X700PartialScan_Filter        (MCPARAMID)( 3585 << 14)
+#define MC_SonyXCL_U1000PartialScan_Filter       (MCPARAMID)( 3586 << 14)
+#define MC_SonyXCL_U1000CPartialScan_Filter      (MCPARAMID)( 3587 << 14)
+#define MC_SonyXCL_V500_FPS                      (MCPARAMID)( 3588 << 14)
+#define MC_SonyXCL_V500_RPS                      (MCPARAMID)( 3589 << 14)
+#define MC_SonyXCL_X700_FPS                      (MCPARAMID)( 3590 << 14)
+#define MC_SonyXCL_X700_RPS                      (MCPARAMID)( 3591 << 14)
+#define MC_SonyXCL_U1000_Start                   (MCPARAMID)( 3592 << 14)
+#define MC_SonyXCL_U1000_End                     (MCPARAMID)( 3593 << 14)
+#define MC_SonyXCL_U1000C_Start                  (MCPARAMID)( 3594 << 14)
+#define MC_SonyXCL_U1000C_End                    (MCPARAMID)( 3595 << 14)
+#define MC_SonyXCL_V500PartialScanFrameRate_mHz  (MCPARAMID)( 3596 << 14)
+#define MC_SonyXCL_V500PartialScanVactive_Ln     (MCPARAMID)( 3597 << 14)
+#define MC_SonyXCL_X700PartialScanFrameRate_mHz  (MCPARAMID)( 3598 << 14)
+#define MC_SonyXCL_X700PartialScanVactive_Ln     (MCPARAMID)( 3599 << 14)
+#define MC_SonyXCL_U1000PartialScanFrameRate_mHz (MCPARAMID)( 3600 << 14)
+#define MC_SonyXCL_U1000PartialScanVactive_Ln    (MCPARAMID)( 3601 << 14)
+#define MC_SonyXCL_U1000CPartialScanFrameRate_mHz (MCPARAMID)( 3602 << 14)
+#define MC_SonyXCL_U1000CPartialScanVactive_Ln   (MCPARAMID)( 3603 << 14)
+#define MC_DvalMode_DID2P0                         4
+#define MC__HDC_DCADV_INTERNAL_D2P0                3
+#define MC_LUT__Data                             (MCPARAMID)( 3604 << 14)
+#define MC__BoardType__AVENUE                     25
+#define MC_TrigLine_ISOA1                         19
+#define MC_TrigLine_ISOA2                         20
+#define MC_TrigLine_TRA1                          21
+#define MC_TrigLine_TRA2                          22
+#define MC_EndTrigLine_IO1                        11
+#define MC_EndTrigLine_IO2                        12
+#define MC_EndTrigLine_IO3                        13
+#define MC_EndTrigLine_IO4                        14
+#define MC_EndTrigLine_ISOA1                      15
+#define MC_EndTrigLine_ISOA2                      16
+#define MC_EndTrigLine_TRA1                       17
+#define MC_EndTrigLine_TRA2                       18
+#define MC__TrigLine_ISOA1                        28
+#define MC__TrigLine_ISOA2                        29
+#define MC__TrigLine_TRA1                         30
+#define MC__TrigLine_TRA2                         31
+#define MC_StrobeLine_ISOA1                       15
+#define MC_StrobeLine_ISOA2                       16
+#define MC_StrobeLine_STA                         17
+#define MC__StrobeLine_ISOA1                      14
+#define MC__StrobeLine_ISOA2                      15
+#define MC__StrobeLine_STA                        16
+#define MC_LineTrigCtl_LVDS                        4
+#define MC_LineTrigLine_IO1                        7
+#define MC_LineTrigLine_IO2                        8
+#define MC_LineTrigLine_IO3                        9
+#define MC_LineTrigLine_IO4                       10
+#define MC_LineTrigLine_ISOA1                     11
+#define MC_LineTrigLine_ISOA2                     12
+#define MC_LineTrigLine_TRA1                      13
+#define MC_LineTrigLine_TRA2                      14
+#define MC__LineTrigLine_IO1                      13
+#define MC__LineTrigLine_IO2                      14
+#define MC__LineTrigLine_IO3                      15
+#define MC__LineTrigLine_IO4                      16
+#define MC__LineTrigLine_ISOA1                    17
+#define MC__LineTrigLine_ISOA2                    18
+#define MC__LineTrigLine_TRA1                     19
+#define MC__LineTrigLine_TRA2                     20
+#define MC__TRG_LTSEL_A1                          11
+#define MC__TRG_LTSEL_A2                          12
+#define MC__TRG_LTSEL_TRG1                        13
+#define MC__TRG_LTSEL_TRG2                        14
+#define MC__TRG_LTSEL_IO1                         15
+#define MC__TRG_LTSEL_IO2                         16
+#define MC__TRG_LTSEL_IO3                         17
+#define MC__TRG_LTSEL_IO4                         18
+#define MC__TRG_FTSEL_TRG1                        17
+#define MC__TRG_FTSEL_TRG2                        18
+#define MC__TRG_FTSEL_IO1                         19
+#define MC__TRG_FTSEL_IO2                         20
+#define MC__TRG_FTSEL_IO3                         21
+#define MC__TRG_FTSEL_IO4                         22
+#define MC_IO1Usage                              (MCPARAMID)( 3605 << 14)
+#define MC_IO1Usage_FREE                           1
+#define MC_IO1Usage_STROBE                         2
+#define MC_IO1Usage_TRIGGER                        3
+#define MC_IO1Usage_LINETRIGGER                    4
+#define MC_IO2Usage                              (MCPARAMID)( 3606 << 14)
+#define MC_IO2Usage_FREE                           1
+#define MC_IO2Usage_STROBE                         2
+#define MC_IO2Usage_TRIGGER                        3
+#define MC_IO2Usage_LINETRIGGER                    4
+#define MC_IO3Usage                              (MCPARAMID)( 3607 << 14)
+#define MC_IO3Usage_FREE                           1
+#define MC_IO3Usage_STROBE                         2
+#define MC_IO3Usage_TRIGGER                        3
+#define MC_IO3Usage_LINETRIGGER                    4
+#define MC_IO4Usage                              (MCPARAMID)( 3608 << 14)
+#define MC_IO4Usage_FREE                           1
+#define MC_IO4Usage_STROBE                         2
+#define MC_IO4Usage_TRIGGER                        3
+#define MC_IO4Usage_LINETRIGGER                    4
+#define MC_ISOA1Usage                            (MCPARAMID)( 3609 << 14)
+#define MC_ISOA1Usage_FREE                         1
+#define MC_ISOA1Usage_STROBE                       2
+#define MC_ISOA1Usage_TRIGGER                      3
+#define MC_ISOA1Usage_LINETRIGGER                  4
+#define MC_ISOA2Usage                            (MCPARAMID)( 3610 << 14)
+#define MC_ISOA2Usage_FREE                         1
+#define MC_ISOA2Usage_STROBE                       2
+#define MC_ISOA2Usage_TRIGGER                      3
+#define MC_ISOA2Usage_LINETRIGGER                  4
+#define MC_TRA1Usage                             (MCPARAMID)( 3611 << 14)
+#define MC_TRA1Usage_FREE                          1
+#define MC_TRA1Usage_STROBE                        2
+#define MC_TRA1Usage_TRIGGER                       3
+#define MC_TRA1Usage_LINETRIGGER                   4
+#define MC_TRA2Usage                             (MCPARAMID)( 3612 << 14)
+#define MC_TRA2Usage_FREE                          1
+#define MC_TRA2Usage_STROBE                        2
+#define MC_TRA2Usage_TRIGGER                       3
+#define MC_TRA2Usage_LINETRIGGER                   4
+#define MC_STAUsage                              (MCPARAMID)( 3613 << 14)
+#define MC_STAUsage_FREE                           1
+#define MC_STAUsage_STROBE                         2
+#define MC_STAUsage_TRIGGER                        3
+#define MC_STAUsage_LINETRIGGER                    4
+#define MC__STR_STR1POL                          (MCPARAMID)( 3614 << 14)
+#define MC__STR_STR1POL_DIRECT                     1
+#define MC__STR_STR1POL_INVERT                     2
+#define MC__STR_STR1POL_HOLD                       3
+#define MC__STR_STR1SRC                          (MCPARAMID)( 3615 << 14)
+#define MC__STR_STR1SRC_LOW                        1
+#define MC__STR_STR1SRC_T1SIG3_X                   2
+#define MC__STR_STR1SRC_T1SIG4_X                   3
+#define MC__STR_STR1SRC_PPLS_X                     4
+#define MC__STR_STR1SRC_HOLD                       5
+#define MC__STB_A1STYL                           (MCPARAMID)( 3616 << 14)
+#define MC__STB_A1STYL_TTLIN                       1
+#define MC__STB_A1STYL_12VIN                       2
+#define MC__STB_A1STYL_TTLOUT                      3
+#define MC__STB_A1STYL_OCOUT                       4
+#define MC__STB_A1STYL_OEOUT                       5
+#define MC__STB_A1STYL_HOLD                        6
+#define MC__STB_A2STYL                           (MCPARAMID)( 3617 << 14)
+#define MC__STB_A2STYL_TTLIN                       1
+#define MC__STB_A2STYL_12VIN                       2
+#define MC__STB_A2STYL_TTLOUT                      3
+#define MC__STB_A2STYL_OCOUT                       4
+#define MC__STB_A2STYL_OEOUT                       5
+#define MC__STB_A2STYL_HOLD                        6
+#define MC__STB_QA1SRC                           (MCPARAMID)( 3618 << 14)
+#define MC__STB_QA1SRC_LOW                         1
+#define MC__STB_QA1SRC_T1SIG3                      2
+#define MC__STB_QA1SRC_T1SIG4                      3
+#define MC__STB_QA1SRC_HIGH                        4
+#define MC__STB_QA1SRC_T1SIG3_Inverted             5
+#define MC__STB_QA1SRC_T1SIG4_Inverted             6
+#define MC__STB_QA1SRC_HOLD                        7
+#define MC__STB_QA2SRC                           (MCPARAMID)( 3619 << 14)
+#define MC__STB_QA2SRC_LOW                         1
+#define MC__STB_QA2SRC_T1SIG3                      2
+#define MC__STB_QA2SRC_T1SIG4                      3
+#define MC__STB_QA2SRC_HIGH                        4
+#define MC__STB_QA2SRC_T1SIG3_Inverted             5
+#define MC__STB_QA2SRC_T1SIG4_Inverted             6
+#define MC__STB_QA2SRC_HOLD                        7
+#define MC__STB_QA1POL                           (MCPARAMID)( 3620 << 14)
+#define MC__STB_QA1POL_DIRECT                      1
+#define MC__STB_QA1POL_INVERT                      2
+#define MC__STB_QA1POL_HOLD                        3
+#define MC__STB_QA2POL                           (MCPARAMID)( 3621 << 14)
+#define MC__STB_QA2POL_DIRECT                      1
+#define MC__STB_QA2POL_INVERT                      2
+#define MC__STB_QA2POL_HOLD                        3
+#define MC_InputPinName_TRA1                      80
+#define MC_InputPinName_TRA2                      81
+#define MC_InputPinName_ISOA1                     82
+#define MC_InputPinName_ISOA2                     83
+#define MC_OutputPinName_STA                      84
+#define MC_OutputPinName_ISOA1                    85
+#define MC_OutputPinName_ISOA2                    86
+#define MC_OutputState_LOOP                       13
+#define MC_OutputState_1_LOOP                      8
+#define MC_OutputState_2_LOOP                      6
+#define MC_OutputState_3_LOOP                      6
+#define MC_OutputState_4_LOOP                      6
+#define MC_OutputState_LOOP3                      14
+#define MC_OutputState_LOOP4                      15
+#define MC_OutputState_17_LOOP3                    6
+#define MC_OutputState_17_LOOP4                    7
+#define MC_OutputState_21_LOOP1                    4
+#define MC_OutputState_21_LOOP2                    5
+#define MC_OutputState_21_LOOP3                    6
+#define MC_OutputState_21_LOOP4                    7
+#define MC_OutputState_22_LOOP3                    6
+#define MC_OutputState_22_LOOP4                    7
+#define MC_OutputState_23_LOOP3                    6
+#define MC_OutputState_23_LOOP4                    7
+#define MC_OutputState_24_LOOP3                    6
+#define MC_OutputState_24_LOOP4                    7
+#define MC_ISOA1Usage_USER                         5
+#define MC_ISOA2Usage_USER                         5
+#define MC_EndTrigLine_Filter                    (MCPARAMID)( 3622 << 14)
+#define MC_EndTrigCtl_Filter                     (MCPARAMID)( 3623 << 14)
+#define MC_EndTrigCtl_LVDS                         2
+#define MC_EndTrigCtl_ITTL                         3
+#define MC_EndTrigCtl_I12V                         4
+#define MC_StrobeLine_STR                         18
+#define MC_ColorFormat_UINT32                     68
+#define MC_CamConfig_L4080SP                     256
+#define MC_CamConfig_L4080RC                     257
+#define MC_CamConfig_L4080RG                     258
+#define MC__CSIO_CSIO1Out                        (MCPARAMID)( 3624 << 14)
+#define MC__CSIO_CSIO1Out_T1SIG3                   1
+#define MC__CSIO_CSIO1Out_T1SIG4                   2
+#define MC__CSIO_CSIO1Out_PPLS                     3
+#define MC__CSIO_CSIO1Out_HOLD                     4
+#define MC__CSIO_CSIO1Dir                        (MCPARAMID)( 3625 << 14)
+#define MC__CSIO_CSIO1Dir_DIRECT                   1
+#define MC__CSIO_CSIO1Dir_INVERT                   2
+#define MC__CSIO_CSIO1Dir_HOLD                     3
+#define MC__CSIO_CSIO2Out                        (MCPARAMID)( 3626 << 14)
+#define MC__CSIO_CSIO2Out_T1SIG3                   1
+#define MC__CSIO_CSIO2Out_T1SIG4                   2
+#define MC__CSIO_CSIO2Out_PPLS                     3
+#define MC__CSIO_CSIO2Out_HOLD                     4
+#define MC__CSIO_CSIO2Dir                        (MCPARAMID)( 3627 << 14)
+#define MC__CSIO_CSIO2Dir_DIRECT                   1
+#define MC__CSIO_CSIO2Dir_INVERT                   2
+#define MC__CSIO_CSIO2Dir_HOLD                     3
+#define MC__CSIO_CSIO3Out                        (MCPARAMID)( 3628 << 14)
+#define MC__CSIO_CSIO3Out_T1SIG3                   1
+#define MC__CSIO_CSIO3Out_T1SIG4                   2
+#define MC__CSIO_CSIO3Out_PPLS                     3
+#define MC__CSIO_CSIO3Out_HOLD                     4
+#define MC__CSIO_CSIO3Dir                        (MCPARAMID)( 3629 << 14)
+#define MC__CSIO_CSIO3Dir_DIRECT                   1
+#define MC__CSIO_CSIO3Dir_INVERT                   2
+#define MC__CSIO_CSIO3Dir_HOLD                     3
+#define MC__CSIO_CSIO4Out                        (MCPARAMID)( 3630 << 14)
+#define MC__CSIO_CSIO4Out_T1SIG3                   1
+#define MC__CSIO_CSIO4Out_T1SIG4                   2
+#define MC__CSIO_CSIO4Out_PPLS                     3
+#define MC__CSIO_CSIO4Out_HOLD                     4
+#define MC__CSIO_CSIO4Dir                        (MCPARAMID)( 3631 << 14)
+#define MC__CSIO_CSIO4Dir_DIRECT                   1
+#define MC__CSIO_CSIO4Dir_INVERT                   2
+#define MC__CSIO_CSIO4Dir_HOLD                     3
+#define MC__CSIO_CSIO1Out_T1SIG3X                  5
+#define MC__CSIO_CSIO1Out_T1SIG4X                  6
+#define MC__CSIO_CSIO2Out_T1SIG3X                  5
+#define MC__CSIO_CSIO2Out_T1SIG4X                  6
+#define MC__CSIO_CSIO3Out_T1SIG3X                  5
+#define MC__CSIO_CSIO3Out_T1SIG4X                  6
+#define MC__CSIO_CSIO4Out_T1SIG3X                  5
+#define MC__CSIO_CSIO4Out_T1SIG4X                  6
+#define MC__CSIO_CSIO1Dir_IO_Output                4
+#define MC__CSIO_CSIO1Dir_IO_nOutput               5
+#define MC__CSIO_CSIO1Dir_IO_Input                 6
+#define MC__CSIO_CSIO2Dir_IO_Output                4
+#define MC__CSIO_CSIO2Dir_IO_nOutput               5
+#define MC__CSIO_CSIO2Dir_IO_Input                 6
+#define MC__CSIO_CSIO3Dir_IO_Output                4
+#define MC__CSIO_CSIO3Dir_IO_nOutput               5
+#define MC__CSIO_CSIO3Dir_IO_Input                 6
+#define MC__CSIO_CSIO4Dir_IO_Output                4
+#define MC__CSIO_CSIO4Dir_IO_nOutput               5
+#define MC__CSIO_CSIO4Dir_IO_Input                 6
+#define MC__CSIO_CSIO1Out_PPLSX                    7
+#define MC__CSIO_CSIO2Out_PPLSX                    7
+#define MC__CSIO_CSIO3Out_PPLSX                    7
+#define MC__CSIO_CSIO4Out_PPLSX                    7
+#define MC_ColorFormat_FLOAT32                    69
+#define MC_Toto                                  (MCPARAMID)( 3632 << 14)
+#define MC_LineTrigLine_Filter                   (MCPARAMID)( 3633 << 14)
+#define MC_OutputState_18_LOOP3                    6
+#define MC_OutputState_18_LOOP4                    7
+#define MC_OutputState_19_LOOP1                    4
+#define MC_OutputState_19_LOOP2                    5
+#define MC_OutputState_19_LOOP3                    6
+#define MC_OutputState_19_LOOP4                    7
+#define MC_OutputState_31_LOOP1                    4
+#define MC_OutputState_31_LOOP2                    5
+#define MC_OutputState_31_LOOP3                    6
+#define MC_OutputState_31_LOOP4                    7
+#define MC_OutputState_32_LOOP3                    6
+#define MC_OutputState_32_LOOP4                    7
+#define MC_OutputState_33_LOOP3                    6
+#define MC_OutputState_33_LOOP4                    7
+#define MC_OutputState_34_LOOP3                    6
+#define MC_OutputState_34_LOOP4                    7
+#define MC_Camera_MV_D1024_80_CL_8               206
+#define MC_Camera_MV_D1024_160_CL_8              207
+#define MC_Camera_MV_D640_66_CL_10               208
+#define MC_Camera_MV_D640C_66_CL_10              209
+#define MC_Camera_MV_D640_33_CL_10               210
+#define MC_Camera_MV_D640C_33_CL_10              211
+#define MC_Camera_TMC_4000CL                     212
+#define MC_CamConfig_P30SC_Base                  259
+#define MC_CamConfig_P30RG_Base                  260
+#define MC_CamConfig_P30RG_O_Base                261
+#define MC_CamConfig_P30SC_Medium                262
+#define MC_CamConfig_P30RG_Medium                263
+#define MC_CamConfig_P30RG_O_Medium              264
+#define MC_CamConfig_L512SC                      265
+#define MC_CamConfig_L512RP                      266
+#define MC_CamConfig_P15RC                       267
+#define MC_CamConfig_P100SC                      268
+#define MC_CamConfig_P100RC                      269
+#define MC_CamConfig_P150SC                      270
+#define MC_CamConfig_P150RG                      271
+#define MC_CamConfig_L1024RG_Base                272
+#define MC_CamConfig_L1024RG_Medium              273
+#define MC_CamConfig_L2048RG_Base                274
+#define MC_CamConfig_L2048RG_Medium              275
+#define MC_CamConfig_L1024RP                     276
+#define MC_CamConfig_L4080SC                     277
+#define MC_CamConfig_L4080RP                     278
+#define MC_Manufacturer_SVS_VISTEK                26
+#define MC_PageLength_TileHeight_Key             (MCPARAMID)( 3634 << 14)
+#define MC___PageLength_TileHeight_Check         (MCPARAMID)( 3635 << 14)
+#define MC___PageLength_TileHeight_Check_PASS      1
+#define MC___PageLength_TileHeight_Check_FAIL      2
+#define MC_ProductionTest                        (MCPARAMID)( 3636 << 14)
+#define MC_ProductionTest_DISABLED                 1
+#define MC_ProductionTest_ENABLED                  2
+#define MC__ReadoutDur_us                        (MCPARAMID)( 3637 << 14)
+#define MC_ForceTrig_ENDTRIG                       2
+#define MC_ForceTrig_Filter                      (MCPARAMID)( 3638 << 14)
+#define MC_EndTrigFilter                         (MCPARAMID)( 3639 << 14)
+#define MC_EndTrigFilter_OFF                       1
+#define MC_EndTrigFilter_MEDIUM                    2
+#define MC_EndTrigFilter_STRONG                    3
+#define MC_EndTrigFilter_ON                        4
+#define MC_EndTrigFilter_Filter                  (MCPARAMID)( 3640 << 14)
+#define MC__EndTrigLine                          (MCPARAMID)( 3641 << 14)
+#define MC__EndTrigLine_NONE                       1
+#define MC__EndTrigLine_IO1                        2
+#define MC__EndTrigLine_IO2                        3
+#define MC__EndTrigLine_IO3                        4
+#define MC__EndTrigLine_IO4                        5
+#define MC__EndTrigLine_ISOA1                      6
+#define MC__EndTrigLine_ISOA2                      7
+#define MC__EndTrigLine_TRA1                       8
+#define MC__EndTrigLine_TRA2                       9
+#define MC__EndTrigLine_LTACT                     10
+#define MC__EndTrigLine_PG                        11
+#define MC__TRG_EFTPOL                           (MCPARAMID)( 3642 << 14)
+#define MC__TRG_EFTPOL_DIRECT                      1
+#define MC__TRG_EFTPOL_INVERT                      2
+#define MC__TRG_EFTSEL                           (MCPARAMID)( 3643 << 14)
+#define MC__TRG_EFTSEL_NA                          1
+#define MC__TRG_EFTSEL_D1                          2
+#define MC__TRG_EFTSEL_D2                          3
+#define MC__TRG_EFTSEL_PG                          4
+#define MC__TRG_EFTSEL_LTACT                       5
+#define MC__TRG_EFTSEL_TRX                         6
+#define MC__TRG_EFTSEL_TRY                         7
+#define MC__TRG_EFTSEL_TRZ                         8
+#define MC__TRG_EFTSEL_DA1                         9
+#define MC__TRG_EFTSEL_DA2                        10
+#define MC__TRG_EFTSEL_TRG1                       11
+#define MC__TRG_EFTSEL_TRG2                       12
+#define MC__TRG_EFTSEL_IO1                        13
+#define MC__TRG_EFTSEL_IO2                        14
+#define MC__TRG_EFTSEL_IO3                        15
+#define MC__TRG_EFTSEL_IO4                        16
+#define MC__EndTrigLine_DA1                       12
+#define MC__EndTrigLine_DA2                       13
+#define MC__EndTrigLine_PGA                       14
+#define MC__EndTrigLine_DB1                       15
+#define MC__EndTrigLine_DB2                       16
+#define MC__EndTrigLine_PGB                       17
+#define MC__EndTrigLine_TRX                       18
+#define MC__EndTrigLine_TRY                       19
+#define MC__EndTrigLine_TRZ                       20
+#define MC_SimMANTRIGSet                         (MCPARAMID)( 3644 << 14)
+#define MC__EndTrigLineNeeded                    (MCPARAMID)( 3645 << 14)
+#define MC__EndTrigLineNeeded_NO                   1
+#define MC__EndTrigLineNeeded_YES                  2
+#define MC__VCOFrequency                         (MCPARAMID)( 3646 << 14)
+#define MC__SSC_CV_A1                              7
+#define MC__CBA_DIRX_w                           (MCPARAMID)( 3647 << 14)
+#define MC_PartialPageLength_Ln                  (MCPARAMID)( 3648 << 14)
+#define MC__LQS_COUNT0                           (MCPARAMID)( 3649 << 14)
+#define MC__LQS_COUNT1                           (MCPARAMID)( 3650 << 14)
+#define MC__LQS_COUNT2                           (MCPARAMID)( 3651 << 14)
+#define MC_PPBUFSize_GrabSizeXStep_Px            (MCPARAMID)( 3652 << 14)
+#define MC_ADR_GrabSizeXStep_Px                  (MCPARAMID)( 3653 << 14)
+#define MC__ADR_ComponentSize_Byte               (MCPARAMID)( 3654 << 14)
+#define MC__ADR_SliceSize_Byte                   (MCPARAMID)( 3655 << 14)
+#define MC__ADR_InputBytePerComponent            (MCPARAMID)( 3656 << 14)
+#define MC__ADR_OutputBytePerComponent           (MCPARAMID)( 3657 << 14)
+#define MC__ADR_OutputsSteps64bit                (MCPARAMID)( 3658 << 14)
+#define MC__ADR_ImageSizeX_Component             (MCPARAMID)( 3659 << 14)
+#define MC__ADR_TotalSliceCount                  (MCPARAMID)( 3660 << 14)
+#define MC__ADR_LastSliceSize_64bit              (MCPARAMID)( 3661 << 14)
+#define MC_LineCaptureMode_ADR                     3
+#define MC__CPG_PGFRAC                           (MCPARAMID)( 3662 << 14)
+#define MC__MinPitch_mw                          (MCPARAMID)( 3663 << 14)
+#define MC__ADR_OutputFormat                     (MCPARAMID)( 3664 << 14)
+#define MC__ADR_OutputFormat_8BIT                  1
+#define MC__ADR_OutputFormat_10BIT                 2
+#define MC__ADR_OutputFormat_12BIT                 3
+#define MC__ADR_OutputFormat_14BIT                 4
+#define MC__ADR_OutputFormat_16BIT                 5
+#define MC__ADR_SliceSize_Component              (MCPARAMID)( 3665 << 14)
+#define MC_MinIntractionLead                     (MCPARAMID)( 3666 << 14)
+#define MC_VSyncSearchWindowLeft_TT              (MCPARAMID)( 3667 << 14)
+#define MC_VSyncSearchWindowRight_TT             (MCPARAMID)( 3668 << 14)
+#define MC_VSyncFoundLNB                         (MCPARAMID)( 3669 << 14)
+#define MC_TimerFrequency                        (MCPARAMID)( 3670 << 14)
+#define MC_Fc_Hz                                 (MCPARAMID)( 3671 << 14)
+#define MC_Fp1_Hz                                (MCPARAMID)( 3672 << 14)
+#define MC_RCR                                   (MCPARAMID)( 3673 << 14)
+#define MC_Fe1_Hz                                (MCPARAMID)( 3674 << 14)
+#define MC__PM_N0                                (MCPARAMID)( 3675 << 14)
+#define MC__PG_SF0                               (MCPARAMID)( 3676 << 14)
+#define MC__Category_Rate_Converter               42
+#define MC__PG_U                                 (MCPARAMID)( 3677 << 14)
+#define MC__PG_S_U_max                           (MCPARAMID)( 3678 << 14)
+#define MC__PG_U_max                             (MCPARAMID)( 3679 << 14)
+#define MC__PG_S_max                             (MCPARAMID)( 3680 << 14)
+#define MC__PG_S                                 (MCPARAMID)( 3681 << 14)
+#define MC__PM_N1                                (MCPARAMID)( 3682 << 14)
+#define MC__PM_PMSDIV                            (MCPARAMID)( 3683 << 14)
+#define MC__PM_M                                 (MCPARAMID)( 3684 << 14)
+#define MC__PM_N2                                (MCPARAMID)( 3685 << 14)
+#define MC_Fp2_Hz                                (MCPARAMID)( 3686 << 14)
+#define MC_Fe2_Hz                                (MCPARAMID)( 3687 << 14)
+#define MC_Fm_Hz                                 (MCPARAMID)( 3688 << 14)
+#define MC_RCDR                                  (MCPARAMID)( 3689 << 14)
+#define MC___RCDR_Check                          (MCPARAMID)( 3690 << 14)
+#define MC___RCDR_Check_PASS                       1
+#define MC___RCDR_Check_FAIL                       2
+#define MC___PM_PMSDIV_Range_Check               (MCPARAMID)( 3691 << 14)
+#define MC___PM_PMSDIV_Range_Check_PASS            1
+#define MC___PM_PMSDIV_Range_Check_FAIL            2
+#define MC___PG_U_Check                          (MCPARAMID)( 3692 << 14)
+#define MC___PG_U_Check_PASS                       1
+#define MC___PG_U_Check_FAIL                       2
+#define MC_SamplingPitch                         (MCPARAMID)( 3693 << 14)
+#define MC__TrimmedKFactor                       (MCPARAMID)( 3694 << 14)
+#define MC__TrimmedKFactor_Check                 (MCPARAMID)( 3695 << 14)
+#define MC__TrimmedKFactor_Check_PASS              1
+#define MC__TrimmedKFactor_Check_FAIL              2
+#define MC__TrimmedPeriod_s                      (MCPARAMID)( 3696 << 14)
+#define MC__Category_Periodic_Timer               43
+#define MC__TrimmedPeriod_us                     (MCPARAMID)( 3697 << 14)
+#define MC_RC_Fc_Hz                              (MCPARAMID)( 3698 << 14)
+#define MC_PT_Fc_Hz                              (MCPARAMID)( 3699 << 14)
+#define MC_PT_Po_s                               (MCPARAMID)( 3700 << 14)
+#define MC__PT_S_U_max                           (MCPARAMID)( 3701 << 14)
+#define MC__PT_U_max                             (MCPARAMID)( 3702 << 14)
+#define MC__PT_U                                 (MCPARAMID)( 3703 << 14)
+#define MC__PT_S_max                             (MCPARAMID)( 3704 << 14)
+#define MC__PT_S                                 (MCPARAMID)( 3705 << 14)
+#define MC__PT_N                                 (MCPARAMID)( 3706 << 14)
+#define MC__PGSCAL                               (MCPARAMID)( 3707 << 14)
+#define MC__PGFRAC                               (MCPARAMID)( 3708 << 14)
+#define MC__KFactorTrim                          (MCPARAMID)( 3709 << 14)
+#define MC__Vtotal_ms                            (MCPARAMID)( 3710 << 14)
+#define MC__Expose_ms                            (MCPARAMID)( 3711 << 14)
+#define MC_MaxCameraLineRate                     (MCPARAMID)( 3712 << 14)
+#define MC_MaxDownwebLineRate                    (MCPARAMID)( 3713 << 14)
+#define MC__MinIntractionLead                    (MCPARAMID)( 3714 << 14)
+#define MC__MinIntractionLead_S                  (MCPARAMID)( 3715 << 14)
+#define MC_SimABORTGASet                         (MCPARAMID)( 3716 << 14)
+#define MC_ExpectedSeqLength_Ln                  (MCPARAMID)( 3717 << 14)
+#define MC__PT_S_min                             (MCPARAMID)( 3718 << 14)
+#define MC___PT_PGCNT_Range_Check                (MCPARAMID)( 3719 << 14)
+#define MC___PT_PGCNT_Range_Check_PASS             1
+#define MC___PT_PGCNT_Range_Check_FAIL             2
+#define MC_SkippedLineCount                      (MCPARAMID)( 3720 << 14)
+#define MC__CTD_ETDMOD                           (MCPARAMID)( 3721 << 14)
+#define MC__CTD_ETDMOD_Bypass                      1
+#define MC__CTD_ETDMOD_Enable                      2
+#define MC__ETD_TDCNT                            (MCPARAMID)( 3722 << 14)
+#define MC_EndPageDelay_Ln                       (MCPARAMID)( 3723 << 14)
+#define MC__ETD_TDMOD                            (MCPARAMID)( 3724 << 14)
+#define MC__ETD_TDMOD_Bypass                       1
+#define MC__ETD_TDMOD_Enable                       2
+#define MC_AssyPixelSize                         (MCPARAMID)( 3725 << 14)
+#define MC_LineCaptureMode_LineCaptureMode_Filter   4
+#define MC_LineCaptureMode_Filter                (MCPARAMID)( 3726 << 14)
+#define MC_IDP_SWITCH                            (MCPARAMID)( 3727 << 14)
+#define MC_IDP_SWITCH_TURN_ON                      1
+#define MC_IDP_SWITCH_TURN_OFF                     2
+#define MC_LineDur_Px                            (MCPARAMID)( 3728 << 14)
+#define MC__SampledPixels_Px                     (MCPARAMID)( 3729 << 14)
+#define MC_ActiveLineDurNoBlack_ns               (MCPARAMID)( 3730 << 14)
+#define MC_LineDurNoBlack_Px                     (MCPARAMID)( 3731 << 14)
+#define MC_MaxHCsyncAft_ns                       (MCPARAMID)( 3732 << 14)
+#define MC_MaxHCsyncBfr_ns                       (MCPARAMID)( 3733 << 14)
+#define MC__NoBlackOffset                        (MCPARAMID)( 3734 << 14)
+#define MC__NoBlackOffset_Px                     (MCPARAMID)( 3735 << 14)
+#define MC__NoBlackScale                         (MCPARAMID)( 3736 << 14)
+#define MC__ModelId                              (MCPARAMID)( 3737 << 14)
+#define MC__ModuleId                             (MCPARAMID)( 3738 << 14)
+#define MC_ImagePixelAlign_N_A                     3
+#define MC__Peak                                 (MCPARAMID)( 3739 << 14)
+#define MC__Peak_OFF                               1
+#define MC__Peak_ON                                2
+#define MC__Hfilt                                (MCPARAMID)( 3740 << 14)
+#define MC__Majs                                 (MCPARAMID)( 3741 << 14)
+#define MC__BoardType__PICOLO_ALERT               26
+#define MC__Dummy                                (MCPARAMID)( 3742 << 14)
+#define MC___PageLength_TileHeight_Check_ErrorMsg (MCPARAMID)( 3743 << 14)
+#define MC_NextTrigMode_NextTrigMode              10
+#define MC__TED_TDCLK                            (MCPARAMID)( 3744 << 14)
+#define MC__TED_TDCLK_PRESCAL                      1
+#define MC__TED_TDCLK_LTRIG                        2
+#define MC__TED_TDCLK_PPLS                         3
+#define MC__TED_TDCLK_EOL                          4
+#define MC__TED_TDMOD                            (MCPARAMID)( 3745 << 14)
+#define MC__TED_TDMOD_Bypass                       1
+#define MC__TED_TDMOD_Enable                       2
+#define MC__ETD_ETDMOD                           (MCPARAMID)( 3746 << 14)
+#define MC__ETD_ETDMOD_Bypass                      1
+#define MC__ETD_ETDMOD_Enable                      2
+#define MC__TED_TDSCAL_ns                        (MCPARAMID)( 3747 << 14)
+#define MC__TED_TDCNT                            (MCPARAMID)( 3748 << 14)
+#define MC__ETD_ETDCNT                           (MCPARAMID)( 3749 << 14)
+#define MC_PageDelay_Filter                      (MCPARAMID)( 3750 << 14)
+#define MC_EndPageDelay_Filter                   (MCPARAMID)( 3751 << 14)
+#define MC_BoardStartSet                         (MCPARAMID)( 3752 << 14)
+#define MC__HDHalfPeriod_25ns                    (MCPARAMID)( 3753 << 14)
+#define MC__HDPulseWidth_25ns                    (MCPARAMID)( 3754 << 14)
+#define MC__VDPeriod_halfHD                      (MCPARAMID)( 3755 << 14)
+#define MC__VDPulseWidth_halfHD                  (MCPARAMID)( 3756 << 14)
+#define MC__CameraSyncEnable                     (MCPARAMID)( 3757 << 14)
+#define MC__CameraSyncEnable_ENABLE                1
+#define MC__CameraSyncEnable_DISABLE               2
+#define MC___DisableCamDigIO                     (MCPARAMID)( 3758 << 14)
+#define MC___DisableCamDigIO_DISABLE               1
+#define MC___DisableCamDigIO_ENABLE                2
+#define MC__Board_Type__ALERT                      8
+#define MC__Category_Low_Level                    44
+#define MC__BoardType__ALERT                      27
+#define MC_BEC_SrcFlipX                          (MCPARAMID)( 3759 << 14)
+#define MC_BEC_SrcFlipX_ON                         1
+#define MC_BEC_SrcFlipX_OFF                        2
+#define MC_BEC_SrcVertRes                        (MCPARAMID)( 3760 << 14)
+#define MC_BEC_SrcVertRes_HALFRES                  1
+#define MC_BEC_SrcVertRes_FULLRES                  2
+#define MC_BEC_SrcSizeY                          (MCPARAMID)( 3761 << 14)
+#define MC_SrcOffsetAddressY                     (MCPARAMID)( 3762 << 14)
+#define MC_BEC_SrcOffsetAddressY                 (MCPARAMID)( 3763 << 14)
+#define MC_BEC_SrcCAPM                           (MCPARAMID)( 3764 << 14)
+#define MC_BEC_SrcCAPM_CField                      1
+#define MC_BEC_SrcCAPM_CFrame                      2
+#define MC_FEC_CAPM                              (MCPARAMID)( 3765 << 14)
+#define MC_FEC_CAPM_CField                         1
+#define MC_FEC_CAPM_CFrame                         2
+#define MC_FEC_HPRE                              (MCPARAMID)( 3766 << 14)
+#define MC_FEC_VPIM                              (MCPARAMID)( 3767 << 14)
+#define MC_FEC_VPIM_EvenIsUp                       1
+#define MC_FEC_VPIM_EvenIsDown                     2
+#define MC_FEC_VSTD                              (MCPARAMID)( 3768 << 14)
+#define MC_FEC_VSTD_PAL_SQ                         1
+#define MC_FEC_VSTD_NTSC_SQ                        2
+#define MC_FEC_VSTD_PAL_BROAD                      3
+#define MC_FEC_VSTD_NTSC_BROAD                     4
+#define MC_FEC_VSTD_SimA                           5
+#define MC_FEC_VSTD_SimB                           6
+#define MC_FEC_VSTD_SimC                           7
+#define MC_FEC_VSTD_SimD                           8
+#define MC_BusIdx                                (MCPARAMID)( 3769 << 14)
+#define MC_DeviceIdx                             (MCPARAMID)( 3770 << 14)
+#define MC__FPGA_Model                           (MCPARAMID)( 3771 << 14)
+#define MC__FPGA_Model_HARMONY_DUOCAM              1
+#define MC__FPGA_Model_HARMONY_MONOCAM_RGB         2
+#define MC__FPGA_Model_MELODY_MONOCAM              3
+#define MC__CONV_OUTPUT_GRANULARITY_             (MCPARAMID)( 3772 << 14)
+#define MC_D3_CONVOLVER_BLOCKS                   (MCPARAMID)( 3773 << 14)
+#define MC__DMA_TRANSFER_GRANULARITY_            (MCPARAMID)( 3774 << 14)
+#define MC__IMAGE_TRANSFER_GRANULARITY_          (MCPARAMID)( 3775 << 14)
+#define MC__Rounded_RHD                          (MCPARAMID)( 3776 << 14)
+#define MC_RAS_R                                 (MCPARAMID)( 3777 << 14)
+#define MC_Connector_UNDEFINED                   123
+#define MC_BEC_VScaleFactor                      (MCPARAMID)( 3778 << 14)
+#define MC_FEC_VPRE                              (MCPARAMID)( 3779 << 14)
+#define MC_FEC_VACT                              (MCPARAMID)( 3780 << 14)
+#define MC_FEC_VBarrelShift                      (MCPARAMID)( 3781 << 14)
+#define MC_FEC_VBarrelShift_1BIT                   1
+#define MC_FEC_VBarrelShift_2BIT                   2
+#define MC_FEC_VBarrelShift_3BIT                   3
+#define MC_FEC_VBarrelShift_0BIT                   4
+#define MC_FEC_HBarrelShift                      (MCPARAMID)( 3782 << 14)
+#define MC_FEC_HBarrelShift_0BIT                   1
+#define MC_FEC_HBarrelShift_1BIT                   2
+#define MC_FEC_HBarrelShift_2BIT                   3
+#define MC_BEC_HScaleFactor                      (MCPARAMID)( 3783 << 14)
+#define MC_BEC_SrcOffetX                         (MCPARAMID)( 3784 << 14)
+#define MC_BEC_DestSizeX                         (MCPARAMID)( 3785 << 14)
+#define MC_BEC_EnableCSC                         (MCPARAMID)( 3786 << 14)
+#define MC_BEC_EnableCSC_ON                        1
+#define MC_BEC_EnableCSC_OFF                       2
+#define MC_BEC_Offset_Y                          (MCPARAMID)( 3787 << 14)
+#define MC_BEC_Gain_Y                            (MCPARAMID)( 3788 << 14)
+#define MC_BEC_Gain_Cr1                          (MCPARAMID)( 3789 << 14)
+#define MC_BEC_Gain_Cr2                          (MCPARAMID)( 3790 << 14)
+#define MC_BEC_Gain_Cb1                          (MCPARAMID)( 3791 << 14)
+#define MC_BEC_Gain_Cb2                          (MCPARAMID)( 3792 << 14)
+#define MC_BEC_Gain_Cr_1                         (MCPARAMID)( 3793 << 14)
+#define MC_BEC_Gain_Cr_2                         (MCPARAMID)( 3794 << 14)
+#define MC_BEC_Gain_Cb_1                         (MCPARAMID)( 3795 << 14)
+#define MC_BEC_Gain_Cb_2                         (MCPARAMID)( 3796 << 14)
+#define MC_PixelTiming                           (MCPARAMID)( 3797 << 14)
+#define MC_PixelTiming_SQUARE                      1
+#define MC_PixelTiming_BROADCAST                   2
+#define MC_Resolution                            (MCPARAMID)( 3798 << 14)
+#define MC_Resolution_FRAME                        1
+#define MC_Resolution_FLD                          2
+#define MC_Resolution_CIF                          3
+#define MC_Resolution_QCIF                         4
+#define MC_BEC_VBarrelShift                      (MCPARAMID)( 3799 << 14)
+#define MC_BEC_VBarrelShift_0BIT                   1
+#define MC_BEC_VBarrelShift_1BIT                   2
+#define MC_BEC_VBarrelShift_2BIT                   3
+#define MC_BEC_HBarrelShift                      (MCPARAMID)( 3800 << 14)
+#define MC_BEC_HBarrelShift_0BIT                   1
+#define MC_BEC_HBarrelShift_1BIT                   2
+#define MC_BEC_HBarrelShift_2BIT                   3
+#define MC__Y_Ln                                 (MCPARAMID)( 3801 << 14)
+#define MC_Resolution_CUSTOM                       5
+#define MC_Resolution_Filter                     (MCPARAMID)( 3802 << 14)
+#define MC__ScaleX                               (MCPARAMID)( 3803 << 14)
+#define MC__RoundedScaledWindowX                 (MCPARAMID)( 3804 << 14)
+#define MC__ScaledWindowX                        (MCPARAMID)( 3805 << 14)
+#define MC_ScaledWindowX                         (MCPARAMID)( 3806 << 14)
+#define MC__ScaleY                               (MCPARAMID)( 3807 << 14)
+#define MC__ScaledWindowY                        (MCPARAMID)( 3808 << 14)
+#define MC_ScaledWindowY                         (MCPARAMID)( 3809 << 14)
+#define MC_ColorFormat_YUV444                     70
+#define MC_ColorFormat_Y41P                       71
+#define MC_ColorFormat_Y42P                       72
+#define MC_ColorFormat_IYU2                       73
+#define MC_ColorFormat_YUV444PL                   74
+#define MC_ColorFormat_YUV411PL_DEC               75
+#define MC_ColorFormat_YUV422PL_DEC               76
+#define MC__HSP                                  (MCPARAMID)( 3810 << 14)
+#define MC__VSP                                  (MCPARAMID)( 3811 << 14)
+#define MC__BPP                                  (MCPARAMID)( 3812 << 14)
+#define MC__Pixel_Assembly_Granularity           (MCPARAMID)( 3813 << 14)
+#define MC__TransferredImageSizeX                (MCPARAMID)( 3814 << 14)
+#define MC__B4PP                                 (MCPARAMID)( 3815 << 14)
+#define MC__Max_OffsetX_Px                       (MCPARAMID)( 3816 << 14)
+#define MC__Min_OffsetX_Px                       (MCPARAMID)( 3817 << 14)
+#define MC__LeftMargin_Max_Px                    (MCPARAMID)( 3818 << 14)
+#define MC__LeftMargin_Px                        (MCPARAMID)( 3819 << 14)
+#define MC__TopMargin_Max_Ln                     (MCPARAMID)( 3820 << 14)
+#define MC__TopMargin_Ln                         (MCPARAMID)( 3821 << 14)
+#define MC_ImageColorSpace                       (MCPARAMID)( 3822 << 14)
+#define MC_ImageColorSpace_YUV                     1
+#define MC_ImageColorSpace_RGB                     2
+#define MC_VsyncAft_Ln_Bit0                      (MCPARAMID)( 3823 << 14)
+#define MC_GainY_f                               (MCPARAMID)( 3824 << 14)
+#define MC__GainC_f                              (MCPARAMID)( 3825 << 14)
+#define MC__CSC_GainY_4_7                        (MCPARAMID)( 3826 << 14)
+#define MC__CSC_GainCrR_4_7                      (MCPARAMID)( 3827 << 14)
+#define MC__CSC_GainCrG_S3_7                     (MCPARAMID)( 3828 << 14)
+#define MC__CSC_GainCbB_4_7                      (MCPARAMID)( 3829 << 14)
+#define MC__CSC_GainCbG_S3_7                     (MCPARAMID)( 3830 << 14)
+#define MC__GainU_f                              (MCPARAMID)( 3831 << 14)
+#define MC__GainV_f                              (MCPARAMID)( 3832 << 14)
+#define MC_ScalersGain_f                         (MCPARAMID)( 3833 << 14)
+#define MC_GainU_f                               (MCPARAMID)( 3834 << 14)
+#define MC_GainV_f                               (MCPARAMID)( 3835 << 14)
+#define MC__CSC_GainCbG_S2_7                     (MCPARAMID)( 3836 << 14)
+#define MC_GainY                                 (MCPARAMID)( 3837 << 14)
+#define MC_GainU                                 (MCPARAMID)( 3838 << 14)
+#define MC_GainV                                 (MCPARAMID)( 3839 << 14)
+#define MC__CSC_GainY                            (MCPARAMID)( 3840 << 14)
+#define MC__CSC_GainCrR                          (MCPARAMID)( 3841 << 14)
+#define MC__CSC_GainCrG                          (MCPARAMID)( 3842 << 14)
+#define MC__CSC_GainCbB                          (MCPARAMID)( 3843 << 14)
+#define MC__CSC_GainCbG                          (MCPARAMID)( 3844 << 14)
+#define MC_ScalersGain                           (MCPARAMID)( 3845 << 14)
+#define MC_ScaleY                                (MCPARAMID)( 3846 << 14)
+#define MC_ScaleX                                (MCPARAMID)( 3847 << 14)
+#define MC_ScalerXGain                           (MCPARAMID)( 3848 << 14)
+#define MC_ScalerYGain                           (MCPARAMID)( 3849 << 14)
+#define MC_BEC_VideoOutFormat                    (MCPARAMID)( 3850 << 14)
+#define MC_BEC_VideoOutFormat_YUV444_Packed        1
+#define MC_BEC_VideoOutFormat_YUV444_Planar        2
+#define MC_BEC_VideoOutFormat_YUV422_Packed        3
+#define MC_BEC_VideoOutFormat_YUV422_Planar        4
+#define MC_BEC_VideoOutFormat_YUV422_Planar_Decimated   5
+#define MC_BEC_VideoOutFormat_YUV411_Packed        6
+#define MC_BEC_VideoOutFormat_YUV411_Planar        7
+#define MC_BEC_VideoOutFormat_YUV411_Planar_Decimated   8
+#define MC_BEC_VideoOutFormat_RGB15_Packed         9
+#define MC_BEC_VideoOutFormat_RGB16_Packed        10
+#define MC_BEC_VideoOutFormat_RGB24_Packed        11
+#define MC_BEC_VideoOutFormat_RGB24_Planar        12
+#define MC_BEC_VideoOutFormat_ARGB32_Packed       13
+#define MC_BEC_VideoOutFormat_Y8                  14
+#define MC_Camera_SIMA                           213
+#define MC_BEC_SrcOffsetX                        (MCPARAMID)( 3851 << 14)
+#define MC_Standard_SIMA                           6
+#define MC__FCR                                  (MCPARAMID)( 3852 << 14)
+#define MC_FEC_FCR                               (MCPARAMID)( 3853 << 14)
+#define MC_DataRange_Filter                      (MCPARAMID)( 3854 << 14)
+#define MC_ColorFormat_MJPG                       77
+#define MC_VideoSamplingPeriod                   (MCPARAMID)( 3855 << 14)
+#define MC_ImageWidth                            (MCPARAMID)( 3856 << 14)
+#define MC_VerticalSamplingPeriod                (MCPARAMID)( 3857 << 14)
+#define MC_Go                                    (MCPARAMID)( 3858 << 14)
+#define MC_CaptureRate                           (MCPARAMID)( 3859 << 14)
+#define MC_CaptureRate_Slider                    (MCPARAMID)( 3860 << 14)
+#define MC_CaptureRate_Max                       (MCPARAMID)( 3861 << 14)
+#define MC_CaptureRate_Min                       (MCPARAMID)( 3862 << 14)
+#define MC_CaptureRate_Default                   (MCPARAMID)( 3863 << 14)
+#define MC_CaptureRate_SliderF                   (MCPARAMID)( 3864 << 14)
+#define MC_InterfaceLayer                        (MCPARAMID)( 3865 << 14)
+#define MC_InterfaceLayer_DISABLED                 1
+#define MC_InterfaceLayer_ENABLED                  2
+#define MC_Brightness_Slider                     (MCPARAMID)( 3866 << 14)
+#define MC_Brightness                            (MCPARAMID)( 3867 << 14)
+#define MC_Brightness_SliderF                    (MCPARAMID)( 3868 << 14)
+#define MC_Brightness_Max                        (MCPARAMID)( 3869 << 14)
+#define MC_Brightness_Min                        (MCPARAMID)( 3870 << 14)
+#define MC_Brightness_Default                    (MCPARAMID)( 3871 << 14)
+#define MC_Contrast_Slider                       (MCPARAMID)( 3872 << 14)
+#define MC_Contrast                              (MCPARAMID)( 3873 << 14)
+#define MC_Contrast_SliderF                      (MCPARAMID)( 3874 << 14)
+#define MC_Contrast_Max                          (MCPARAMID)( 3875 << 14)
+#define MC_Contrast_Min                          (MCPARAMID)( 3876 << 14)
+#define MC_Contrast_Default                      (MCPARAMID)( 3877 << 14)
+#define MC_Saturation_Slider                     (MCPARAMID)( 3878 << 14)
+#define MC_Saturation                            (MCPARAMID)( 3879 << 14)
+#define MC_Saturation_SliderF                    (MCPARAMID)( 3880 << 14)
+#define MC_Saturation_Max                        (MCPARAMID)( 3881 << 14)
+#define MC_Saturation_Min                        (MCPARAMID)( 3882 << 14)
+#define MC_Saturation_Default                    (MCPARAMID)( 3883 << 14)
+#define MC_CaptureRate_Slider_Default            (MCPARAMID)( 3884 << 14)
+#define MC_Contrast_Slider_Default               (MCPARAMID)( 3885 << 14)
+#define MC_Saturation_Slider_Default             (MCPARAMID)( 3886 << 14)
+#define MC_Brightness_Slider_Default             (MCPARAMID)( 3887 << 14)
+#define MC__CaptureRate_Max_x1000                (MCPARAMID)( 3888 << 14)
+#define MC_FEC_VPIM_OddIsUp                        3
+#define MC_StandardFrameRate_mHz                 (MCPARAMID)( 3889 << 14)
+#define MC_VideoStandard                         (MCPARAMID)( 3890 << 14)
+#define MC_VideoStandard_PAL                       1
+#define MC_VideoStandard_NTSC                      2
+#define MC_OutputFormat                          (MCPARAMID)( 3891 << 14)
+#define MC_OutputFormat_YUY2                       1
+#define MC_OutputFormat_YV12                       2
+#define MC_OutputFormat_Y41P                       3
+#define MC_OutputFormat_IYUV                       4
+#define MC_OutputFormat_YVU9                       5
+#define MC_OutputFormat_RGB24                      6
+#define MC_OutputFormat_RGB555                     7
+#define MC_OutputFormat_RGB565                     8
+#define MC_OutputFormat_RGB8                       9
+#define MC_OutputFormat_ARGB32                    10
+#define MC_CaptureRegion                         (MCPARAMID)( 3892 << 14)
+#define MC_CaptureRegion_FRAME                     1
+#define MC_CaptureRegion_FLD                       2
+#define MC_CaptureRegion_CIF                       3
+#define MC_CaptureRegion_QCIF                      4
+#define MC_CaptureRegion_CUSTOM                    5
+#define MC_CaptureRegionXSize_Slider             (MCPARAMID)( 3893 << 14)
+#define MC_CaptureRegionXSize                    (MCPARAMID)( 3894 << 14)
+#define MC_CaptureRegionXSize_Max                (MCPARAMID)( 3895 << 14)
+#define MC_CaptureRegionXSize_Min                (MCPARAMID)( 3896 << 14)
+#define MC_CaptureRegionXSize_Default            (MCPARAMID)( 3897 << 14)
+#define MC_CaptureRegionXSize_Slider_Default     (MCPARAMID)( 3898 << 14)
+#define MC_CaptureRegionXSize_SliderF            (MCPARAMID)( 3899 << 14)
+#define MC_CaptureRegionYSize_Slider             (MCPARAMID)( 3900 << 14)
+#define MC_CaptureRegionYSize                    (MCPARAMID)( 3901 << 14)
+#define MC_CaptureRegionYSize_SliderF            (MCPARAMID)( 3902 << 14)
+#define MC_CaptureRegionYSize_Max                (MCPARAMID)( 3903 << 14)
+#define MC_CaptureRegionYSize_Min                (MCPARAMID)( 3904 << 14)
+#define MC_CaptureRegionYSize_Default            (MCPARAMID)( 3905 << 14)
+#define MC_CaptureRegionYSize_Slider_Default     (MCPARAMID)( 3906 << 14)
+#define MC_CaptureRegionXPosition_Slider         (MCPARAMID)( 3907 << 14)
+#define MC_CaptureRegionXPosition                (MCPARAMID)( 3908 << 14)
+#define MC_CaptureRegionXPosition_SliderF        (MCPARAMID)( 3909 << 14)
+#define MC_CaptureRegionXPosition_Max            (MCPARAMID)( 3910 << 14)
+#define MC_CaptureRegionXPosition_Min            (MCPARAMID)( 3911 << 14)
+#define MC_CaptureRegionXPosition_Default        (MCPARAMID)( 3912 << 14)
+#define MC_CaptureRegionXPosition_Slider_Default (MCPARAMID)( 3913 << 14)
+#define MC_CaptureRegionXPosition_Span           (MCPARAMID)( 3914 << 14)
+#define MC_CaptureRegionYPosition_Slider         (MCPARAMID)( 3915 << 14)
+#define MC_CaptureRegionYPosition                (MCPARAMID)( 3916 << 14)
+#define MC_CaptureRegionYPosition_SliderF        (MCPARAMID)( 3917 << 14)
+#define MC_CaptureRegionYPosition_Span           (MCPARAMID)( 3918 << 14)
+#define MC_CaptureRegionYPosition_Max            (MCPARAMID)( 3919 << 14)
+#define MC_CaptureRegionYPosition_Min            (MCPARAMID)( 3920 << 14)
+#define MC_CaptureRegionYPosition_Default        (MCPARAMID)( 3921 << 14)
+#define MC_CaptureRegionYPosition_Slider_Default (MCPARAMID)( 3922 << 14)
+#define MC__PixelClock_x2                        (MCPARAMID)( 3923 << 14)
+#define MC_EffLineDur_Px                         (MCPARAMID)( 3924 << 14)
+#define MC__PixelClock                           (MCPARAMID)( 3925 << 14)
+#define MC__PLL_fl                               (MCPARAMID)( 3926 << 14)
+#define MC__PLL_int                              (MCPARAMID)( 3927 << 14)
+#define MC_ObjectName_Slider                     (MCPARAMID)( 3928 << 14)
+#define MC_ObjectName_SliderF                    (MCPARAMID)( 3929 << 14)
+#define MC_ObjectName_Max                        (MCPARAMID)( 3930 << 14)
+#define MC_ObjectName_Min                        (MCPARAMID)( 3931 << 14)
+#define MC_ObjectName_Default                    (MCPARAMID)( 3932 << 14)
+#define MC_ObjectName_Slider_Default             (MCPARAMID)( 3933 << 14)
+#define MC_EffPixelClock                         (MCPARAMID)( 3934 << 14)
+#define MC_EffPixelClock_x2                      (MCPARAMID)( 3935 << 14)
+#define MC_Brightness_Span                       (MCPARAMID)( 3936 << 14)
+#define MC__PageLength_Ln_Check                  (MCPARAMID)( 3937 << 14)
+#define MC__LimitedScaleX                        (MCPARAMID)( 3938 << 14)
+#define MC__LimitedScaleY                        (MCPARAMID)( 3939 << 14)
+#define MC_ImageXSize_Slider                     (MCPARAMID)( 3940 << 14)
+#define MC_ImageXSize                            (MCPARAMID)( 3941 << 14)
+#define MC_ImageXSize_SliderF                    (MCPARAMID)( 3942 << 14)
+#define MC_ImageXSize_Max                        (MCPARAMID)( 3943 << 14)
+#define MC_ImageXSize_Min                        (MCPARAMID)( 3944 << 14)
+#define MC_ImageXSize_Default                    (MCPARAMID)( 3945 << 14)
+#define MC_ImageXSize_Slider_Default             (MCPARAMID)( 3946 << 14)
+#define MC_ImageYSize_Slider                     (MCPARAMID)( 3947 << 14)
+#define MC_ImageYSize                            (MCPARAMID)( 3948 << 14)
+#define MC_ImageYSize_SliderF                    (MCPARAMID)( 3949 << 14)
+#define MC_ImageYSize_Max                        (MCPARAMID)( 3950 << 14)
+#define MC_ImageYSize_Min                        (MCPARAMID)( 3951 << 14)
+#define MC_ImageYSize_Default                    (MCPARAMID)( 3952 << 14)
+#define MC_ImageYSize_Slider_Default             (MCPARAMID)( 3953 << 14)
+#define MC_ResolutionX_Slider                    (MCPARAMID)( 3954 << 14)
+#define MC_ResolutionX                           (MCPARAMID)( 3955 << 14)
+#define MC_ResolutionX_SliderF                   (MCPARAMID)( 3956 << 14)
+#define MC_ResolutionX_Max                       (MCPARAMID)( 3957 << 14)
+#define MC_ResolutionX_Min                       (MCPARAMID)( 3958 << 14)
+#define MC_ResolutionX_Default                   (MCPARAMID)( 3959 << 14)
+#define MC_ResolutionX_Slider_Default            (MCPARAMID)( 3960 << 14)
+#define MC_ResolutionY_Slider                    (MCPARAMID)( 3961 << 14)
+#define MC_ResolutionY                           (MCPARAMID)( 3962 << 14)
+#define MC_ResolutionY_SliderF                   (MCPARAMID)( 3963 << 14)
+#define MC_ResolutionY_Max                       (MCPARAMID)( 3964 << 14)
+#define MC_ResolutionY_Min                       (MCPARAMID)( 3965 << 14)
+#define MC_ResolutionY_Default                   (MCPARAMID)( 3966 << 14)
+#define MC_ResolutionY_Slider_Default            (MCPARAMID)( 3967 << 14)
+#define MC_AnalogHSLane                          (MCPARAMID)( 3968 << 14)
+#define MC_DigitalHSLane                         (MCPARAMID)( 3969 << 14)
+#define MC__ResolutionX_Max                      (MCPARAMID)( 3970 << 14)
+#define MC__ResolutionX_Min                      (MCPARAMID)( 3971 << 14)
+#define MC__ResolutionY_Max                      (MCPARAMID)( 3972 << 14)
+#define MC__ResolutionY_Min                      (MCPARAMID)( 3973 << 14)
+#define MC_FieldSizeY                            (MCPARAMID)( 3974 << 14)
+#define MC__SyncPhaseLock                        (MCPARAMID)( 3975 << 14)
+#define MC__SyncPhaseLock_TRUE                     1
+#define MC__SyncPhaseLock_FALSE                    2
+#define MC__FieldsInSignal                       (MCPARAMID)( 3976 << 14)
+#define MC__GrabbedFields                        (MCPARAMID)( 3977 << 14)
+#define MC_InterfaceParameters                   (MCPARAMID)( 3978 << 14)
+#define MC_InterfaceParameters_DISABLE             1
+#define MC_InterfaceParameters_ENABLE              2
+#define MC_CsyncCtl                              (MCPARAMID)( 3979 << 14)
+#define MC_CsyncCtl_NONE                           1
+#define MC_CsyncCtl_TTL                            2
+#define MC_CsyncCtl_DIFF                           3
+#define MC_CsyncCtl_LVDS                           4
+#define MC_CsyncEdge                             (MCPARAMID)( 3980 << 14)
+#define MC_CsyncEdge_GOLOW                         1
+#define MC_CsyncEdge_GOHIGH                        2
+#define MC_CsyncLine_HIO                           7
+#define MC_CsyncLine_GATE                          8
+#define MC_TargetFrameRate_mHz                   (MCPARAMID)( 3981 << 14)
+#define MC_Monochrome                            (MCPARAMID)( 3982 << 14)
+#define MC__BoardType__PICOLO_DILIGENT            28
+#define MC_ResolutionY_Rule                      (MCPARAMID)( 3983 << 14)
+#define MC_ResolutionY_FeedbackRule              (MCPARAMID)( 3984 << 14)
+#define MC_ResolutionYMaxRule                    (MCPARAMID)( 3985 << 14)
+#define MC_OutputFormat_RGB32                     11
+#define MC_CX_VACTIVE                            (MCPARAMID)( 3986 << 14)
+#define MC_WISPackages                           (MCPARAMID)( 3987 << 14)
+#define MC__WIS_CompressMode                     (MCPARAMID)( 3988 << 14)
+#define MC__WIS_CompressMode_MPEG1                 1
+#define MC__WIS_CompressMode_MPEG2                 2
+#define MC__WIS_CompressMode_H263                  3
+#define MC__WIS_CompressMode_MPEG4                 4
+#define MC__WIS_CompressMode_MJPEG                 5
+#define MC_MPEGPackages                          (MCPARAMID)( 3989 << 14)
+#define MC_MPEGXPackage                          (MCPARAMID)( 3990 << 14)
+#define MC_ICXYIVLCPackage                       (MCPARAMID)( 3991 << 14)
+#define MC_MPEGXTBLPackage                       (MCPARAMID)( 3992 << 14)
+#define MC__WIS_SequenceMode                     (MCPARAMID)( 3993 << 14)
+#define MC__WIS_SequenceMode_IP                    1
+#define MC__WIS_SequenceMode_IPB                   2
+#define MC_QDEQTBLPackage                        (MCPARAMID)( 3994 << 14)
+#define MC_OSDPackage                            (MCPARAMID)( 3995 << 14)
+#define MC_WISPackage                            (MCPARAMID)( 3996 << 14)
+#define MC_WindowY_SLn                           (MCPARAMID)( 3997 << 14)
+#define MC_BEC_StorageType                       (MCPARAMID)( 3998 << 14)
+#define MC_BEC_StorageType_PACKED                  1
+#define MC_BEC_StorageType_PLANAR                  2
+#define MC_BEC_ChromaSwap                        (MCPARAMID)( 3999 << 14)
+#define MC_BEC_ChromaSwap_OFF                      1
+#define MC_BEC_ChromaSwap_ON                       2
+#define MC_Vactive_Noblack_Ln                    (MCPARAMID)( 4000 << 14)
+#define MC_WindowX_Noblack_Px                    (MCPARAMID)( 4001 << 14)
+#define MC_Hactive_Noblack_Px                    (MCPARAMID)( 4002 << 14)
+#define MC_ENC_CompressMode                      (MCPARAMID)( 4003 << 14)
+#define MC_ENC_CompressMode_MPEG4                  1
+#define MC_ENC_CompressMode_MJPEG                  2
+#define MC_DIVX_MPEG4                            (MCPARAMID)( 4004 << 14)
+#define MC_MS_MPEG4                              (MCPARAMID)( 4005 << 14)
+#define MC_ENC_Mjpeg                             (MCPARAMID)( 4006 << 14)
+#define MC_ENC_SequenceMode                      (MCPARAMID)( 4007 << 14)
+#define MC_ENC_SequenceMode_IONLY                  1
+#define MC_ENC_SequenceMode_IPONLY                 2
+#define MC_ENC_SequenceMode_IPB                    3
+#define MC_ENC_GopMode                           (MCPARAMID)( 4008 << 14)
+#define MC_ENC_GopMode_OPEN                        1
+#define MC_ENC_GopMode_CLOSE                       2
+#define MC_ENC_GopSize                           (MCPARAMID)( 4009 << 14)
+#define MC_ENC_GopSizeGranularity                (MCPARAMID)( 4010 << 14)
+#define MC_ENC_Mpeg4Mode                         (MCPARAMID)( 4011 << 14)
+#define MC_ENC_Mpeg4Mode_DX50                      1
+#define MC_ENC_Mpeg4Mode_MP4S                      2
+#define MC_ENC_DeinterlaceMode                   (MCPARAMID)( 4012 << 14)
+#define MC_ENC_SearchRange                       (MCPARAMID)( 4013 << 14)
+#define MC_ENC_GopHeaderEn                       (MCPARAMID)( 4014 << 14)
+#define MC_ENC_SeqHeaderEn                       (MCPARAMID)( 4015 << 14)
+#define MC_ENC_AspectRatio                       (MCPARAMID)( 4016 << 14)
+#define MC_MJPEG                                 (MCPARAMID)( 4017 << 14)
+#define MC_ENC_SequenceMode_Filter               (MCPARAMID)( 4018 << 14)
+#define MC_TCFGVIDEOEX                           (MCPARAMID)( 4019 << 14)
+#define MC_TVIDEOCFGFIX                          (MCPARAMID)( 4020 << 14)
+#define MC_ENC_CompressMode_MPEG1                  3
+#define MC_ENC_CompressMode_MPEG2                  4
+#define MC_ENC_CompressMode_H263                   5
+#define MC__MIIR                                 (MCPARAMID)( 4021 << 14)
+#define MC_PixelTiming_Filter                    (MCPARAMID)( 4022 << 14)
+#define MC_ENC_DeinterlaceMode_INTERPOLATION       1
+#define MC_ENC_DeinterlaceMode_INTERLACED_ENCODING   2
+#define MC_ENC_DeinterlaceMode_WEAVING             3
+#define MC_ENC_DeinterlaceMode_BLENDING            4
+#define MC_ENC_DeinterlaceMode_MOTION_DETECTION    5
+#define MC_ENC_DVDCompliant                      (MCPARAMID)( 4023 << 14)
+#define MC_ENC_MaxGopSize                        (MCPARAMID)( 4024 << 14)
+#define MC_ENC_BRCTRLreserved                    (MCPARAMID)( 4025 << 14)
+#define MC_ENC_QMIN                              (MCPARAMID)( 4026 << 14)
+#define MC_ENC_QMAX                              (MCPARAMID)( 4027 << 14)
+#define MC_ENC_BRCWindowSize                     (MCPARAMID)( 4028 << 14)
+#define MC_ENC_MBEnable                          (MCPARAMID)( 4029 << 14)
+#define MC_ENC_DupEn                             (MCPARAMID)( 4030 << 14)
+#define MC_ENC_BitrateControl                    (MCPARAMID)( 4031 << 14)
+#define MC_ENC_BitrateControl_CBR                  1
+#define MC_ENC_BitrateControl_CQ                   2
+#define MC_ENC_BitrateControl_IQPQBQ               3
+#define MC_ENC_TargetBitrate                     (MCPARAMID)( 4032 << 14)
+#define MC_ENC_CBRConvergingSpeed                (MCPARAMID)( 4033 << 14)
+#define MC_ENC_Lambda                            (MCPARAMID)( 4034 << 14)
+#define MC_ENC_Q                                 (MCPARAMID)( 4035 << 14)
+#define MC_ENC_IQ                                (MCPARAMID)( 4036 << 14)
+#define MC_ENC_PQ                                (MCPARAMID)( 4037 << 14)
+#define MC_ENC_BQ                                (MCPARAMID)( 4038 << 14)
+#define MC_ENC_VBVBuffer                         (MCPARAMID)( 4039 << 14)
+#define MC_ENC_PeakBitrate                       (MCPARAMID)( 4040 << 14)
+#define MC_ENC_BitrateControl_CONSTANT_BITRATE     4
+#define MC_ENC_BitrateControl_CONSTANT_QUALITY     5
+#define MC_ENC_BitrateControl_FIXED_QUALITY        6
+#define MC_CBR_Filter                            (MCPARAMID)( 4041 << 14)
+#define MC_VBR_Filter                            (MCPARAMID)( 4042 << 14)
+#define MC_NBR_Filter                            (MCPARAMID)( 4043 << 14)
+#define MC_OutputFormat_MJPG                      12
+#define MC_ENC_Mpeg4Mode_Filter                  (MCPARAMID)( 4044 << 14)
+#define MC_CompressedStream                      (MCPARAMID)( 4045 << 14)
+#define MC_OutputFormat_Filter                   (MCPARAMID)( 4046 << 14)
+#define MC_StandardFramesPerSecond               (MCPARAMID)( 4047 << 14)
+#define MC_ENC_DropFrame                         (MCPARAMID)( 4048 << 14)
+#define MC_ENC_1001FrameRate                     (MCPARAMID)( 4049 << 14)
+#define MC_ENC_DropFrame_Fl                      (MCPARAMID)( 4050 << 14)
+#define MC_ENC_VSyncBitPlane                     (MCPARAMID)( 4051 << 14)
+#define MC_ENC_FingerprintEnable                 (MCPARAMID)( 4052 << 14)
+#define MC_ENC_Quality                           (MCPARAMID)( 4053 << 14)
+#define MC_ENC_Quality2Q                         (MCPARAMID)( 4054 << 14)
+#define MC_DirectShowSupport                     (MCPARAMID)( 4055 << 14)
+#define MC_DirectShowSupport_TRUE                  1
+#define MC_DirectShowSupport_FALSE                 2
+#define MC__HSyncOffsetGate_S                    (MCPARAMID)( 4056 << 14)
+#define MC_HSyncOffsetGate_S                     (MCPARAMID)( 4057 << 14)
+#define MC__HSyncDly_S                           (MCPARAMID)( 4058 << 14)
+#define MC_HSyncDly_S                            (MCPARAMID)( 4059 << 14)
+#define MC__TransferredScaleX                    (MCPARAMID)( 4060 << 14)
+#define MC_VideoLane                             (MCPARAMID)( 4061 << 14)
+#define MC_ScaleX512                             (MCPARAMID)( 4062 << 14)
+#define MC__TransferredScaleX512                 (MCPARAMID)( 4063 << 14)
+#define MC_ScaleX1000                            (MCPARAMID)( 4064 << 14)
+#define MC_ENC_Mpeg4RepeatSeqHead                (MCPARAMID)( 4065 << 14)
+#define MC_ColorFormat_DX50                       78
+#define MC_ColorFormat_MP4S                       79
+#define MC_ScaleY256                             (MCPARAMID)( 4066 << 14)
+#define MC_ScaleY1000                            (MCPARAMID)( 4067 << 14)
+#define MC_ScaleY128                             (MCPARAMID)( 4068 << 14)
+#define MC__TransferredImageSizeY                (MCPARAMID)( 4069 << 14)
+#define MC__EndOfImageHeight                     (MCPARAMID)( 4070 << 14)
+#define MC_FilterDly_ns                          (MCPARAMID)( 4071 << 14)
+#define MC__VSyncSearchWindowLeft_TT             (MCPARAMID)( 4072 << 14)
+#define MC__VSyncSearchWindowRight_TT            (MCPARAMID)( 4073 << 14)
+#define MC__RoundHSyncDly_S                      (MCPARAMID)( 4074 << 14)
+#define MC_BufferOffset                          (MCPARAMID)( 4075 << 14)
+#define MC_OutputFormat_DX50                      13
+#define MC_OutputFormat_MP4S                      14
+#define MC_VideoBusIdx                           (MCPARAMID)( 4076 << 14)
+#define MC_I2cBusIdx                             (MCPARAMID)( 4077 << 14)
+#define MC_UnreleasedFeatureFiltering            (MCPARAMID)( 4078 << 14)
+#define MC_UnreleasedFeatureFiltering_YES          1
+#define MC_UnreleasedFeatureFiltering_NO           2
+#define MC_TrigDelay_us_Filter                   (MCPARAMID)( 4079 << 14)
+#define MC_Even                                  (MCPARAMID)( 4080 << 14)
+#define MC_Even_UP                                 1
+#define MC_Even_DOWN                               2
+#define MC_Odd                                   (MCPARAMID)( 4081 << 14)
+#define MC_Odd_UP                                  1
+#define MC_Odd_DOWN                                2
+#define MC_HReference_Filter                     (MCPARAMID)( 4082 << 14)
+#define MC_VReference_Filter                     (MCPARAMID)( 4083 << 14)
+#define MC_HdriveLine_Filter                     (MCPARAMID)( 4084 << 14)
+#define MC_VdriveLine_Filter                     (MCPARAMID)( 4085 << 14)
+#define MC_ResetLine_Filter                      (MCPARAMID)( 4086 << 14)
+#define MC_AuxResetLine_Filter                   (MCPARAMID)( 4087 << 14)
+#define MC_HsyncLine_Filter                      (MCPARAMID)( 4088 << 14)
+#define MC_VsyncLine_Filter                      (MCPARAMID)( 4089 << 14)
+#define MC_CsyncLine_Filter                      (MCPARAMID)( 4090 << 14)
+#define MC_PinCC1_PinCC2_Style_DIFF                3
+#define MC_PinCC3_PinCC4_Style_DIFF                3
+#define MC_CameraControlSignalSet_CSYNC           11
+#define MC_CameraControlSignalSet_HSYNC           12
+#define MC_CameraControlSignalSet_CSYNC_VSYNC     13
+#define MC_CameraControlSignalSet_HSYNC_VSYNC     14
+#define MC_CameraControlSignalSet_HDRIVE          15
+#define MC_CameraControlSignalSet_HDRIVE_VSYNC    16
+#define MC_CameraControlSignalSet_RESET_HSYNC_VSYNC  17
+#define MC_CameraControlSignalSet_VSYNC           18
+#define MC_ENC_1001FrameRate_Fl                  (MCPARAMID)( 4091 << 14)
+#define MC_ENC_OutputWidth                       (MCPARAMID)( 4092 << 14)
+#define MC_ENC_OutputHeight                      (MCPARAMID)( 4093 << 14)
+#define MC__SurfaceCount                         (MCPARAMID)( 4094 << 14)
+#define MC_NoblackWindowHeight_Ln                (MCPARAMID)( 4095 << 14)
+#define MC_NoblackWindowOffset_Ln                (MCPARAMID)( 4096 << 14)
+#define MC_ENC_FrameDur_ms                       (MCPARAMID)( 4097 << 14)
+#define MC_ENC_FrameDur_ms_Fl                    (MCPARAMID)( 4098 << 14)
+#define MC_ENC_FrameDur_us                       (MCPARAMID)( 4099 << 14)
+#define MC_ENC_FrameDur_us_Fl                    (MCPARAMID)( 4100 << 14)
+#define MC_PixelClkLine_Filter                   (MCPARAMID)( 4101 << 14)
+#define MC_ENC_HSubOffset                        (MCPARAMID)( 4102 << 14)
+#define MC_ENC_HScaleFactor                      (MCPARAMID)( 4103 << 14)
+#define MC_ENC_VScaleFactor                      (MCPARAMID)( 4104 << 14)
+#define MC_ENC_VSubOffset                        (MCPARAMID)( 4105 << 14)
+#define MC_BitrateControl                        (MCPARAMID)( 4106 << 14)
+#define MC_BitrateControl_CBR                      1
+#define MC_BitrateControl_VBR                      2
+#define MC_BitrateControl_Filter                 (MCPARAMID)( 4107 << 14)
+#define MC_AverageBitrate                        (MCPARAMID)( 4108 << 14)
+#define MC_AverageBitrate_Filter                 (MCPARAMID)( 4109 << 14)
+#define MC_VideoQuality                          (MCPARAMID)( 4110 << 14)
+#define MC_VideoQuality_Filter                   (MCPARAMID)( 4111 << 14)
+#define MC__Category_Compression                  45
+#define MC__AverageBitrateFeedback               (MCPARAMID)( 4112 << 14)
+#define MC_SequenceMode                          (MCPARAMID)( 4113 << 14)
+#define MC_SequenceMode_IONLY                      1
+#define MC_SequenceMode_IPONLY                     2
+#define MC_SequenceMode_IPB                        3
+#define MC_SequenceMode_Filter                   (MCPARAMID)( 4114 << 14)
+#define MC_KeyFrameInterval                      (MCPARAMID)( 4115 << 14)
+#define MC_KeyFrameInterval_Filter               (MCPARAMID)( 4116 << 14)
+#define MC_CaptureRegionYSize_Ln                 (MCPARAMID)( 4117 << 14)
+#define MC_GopSize                               (MCPARAMID)( 4118 << 14)
+#define MC_GopSize_Filter                        (MCPARAMID)( 4119 << 14)
+#define MC_CaptureRegionXSize_Px                 (MCPARAMID)( 4120 << 14)
+#define MC_ContrastSliderSlope1                  (MCPARAMID)( 4121 << 14)
+#define MC_ObjectName_Slope                      (MCPARAMID)( 4122 << 14)
+#define MC_Contrast_Slope                        (MCPARAMID)( 4123 << 14)
+#define MC_Contrast_Offset                       (MCPARAMID)( 4124 << 14)
+#define MC_Saturation_Slope                      (MCPARAMID)( 4125 << 14)
+#define MC_Saturation_Offset                     (MCPARAMID)( 4126 << 14)
+#define MC_Brightness_Slope                      (MCPARAMID)( 4127 << 14)
+#define MC_Brightness_Offset                     (MCPARAMID)( 4128 << 14)
+#define MC_SubChIdx                              (MCPARAMID)( 4129 << 14)
+#define MC_VHSync                                (MCPARAMID)( 4130 << 14)
+#define MC_VHSync_NO                               1
+#define MC_VHSync_YES                              2
+#define MC_CXEND_Record                          (MCPARAMID)( 4131 << 14)
+#define MC_FRONTEND_Record                       (MCPARAMID)( 4132 << 14)
+#define MC_CXEND_Signature                       (MCPARAMID)( 4133 << 14)
+#define MC_FRONTEND_Signature                    (MCPARAMID)( 4134 << 14)
+#define MC__FRONTEND_Condition                   (MCPARAMID)( 4135 << 14)
+#define MC__CXEND_Condition                      (MCPARAMID)( 4136 << 14)
+#define MC_TargetFrameRate_Hz_Feedback           (MCPARAMID)( 4137 << 14)
+#define MC_CameraControlSignalSet_RESET_HSYNC     19
+#define MC_MaxAnalysisLead                       (MCPARAMID)( 4138 << 14)
+#define MC__MaxAnalysisLead                      (MCPARAMID)( 4139 << 14)
+#define MC__SamplingBufferSize_Ln                (MCPARAMID)( 4140 << 14)
+#define MC__Category_Master_Sync_Control          46
+#define MC_ConnectorCheckSet                     (MCPARAMID)( 4141 << 14)
+#define MC_VideoBridgeCheckSet                   (MCPARAMID)( 4142 << 14)
+#define MC_VrefAft_Ln                            (MCPARAMID)( 4143 << 14)
+#define MC_Vsync2Vref_H                          (MCPARAMID)( 4144 << 14)
+#define MC_Effective_TrigDelay_100ns             (MCPARAMID)( 4145 << 14)
+#define MC__EXPOn2STROff_100ns                   (MCPARAMID)( 4146 << 14)
+#define MC__STDUR_100ns                          (MCPARAMID)( 4147 << 14)
+#define MC__STPOS_DSB_100ns                      (MCPARAMID)( 4148 << 14)
+#define MC__STPOS_ASB_100ns                      (MCPARAMID)( 4149 << 14)
+#define MC_VideoTerminator                       (MCPARAMID)( 4150 << 14)
+#define MC_VideoTerminator_OFF                     1
+#define MC_VideoTerminator_ON                      2
+#define MC_VideoTerminator_JUMPER                  3
+#define MC_GopStructure                          (MCPARAMID)( 4151 << 14)
+#define MC_GopStructure_IONLY                      1
+#define MC_GopStructure_IPONLY                     2
+#define MC_GopStructure_IPB                        3
+#define MC_GopStructure_Filter                   (MCPARAMID)( 4152 << 14)
+#define MC_BCC_VideoOutputSelector               (MCPARAMID)( 4153 << 14)
+#define MC_VideoOuputSelection                   (MCPARAMID)( 4154 << 14)
+#define MC_VideoOuputSelection_VID1                1
+#define MC_VideoOuputSelection_VID2                2
+#define MC_VideoOuputSelection_VID3                3
+#define MC_VideoOuputSelection_VID4                4
+#define MC_VideoOuputSelection_CASCADE             5
+#define MC_VideoOutputSelection                  (MCPARAMID)( 4155 << 14)
+#define MC_VideoOutputSelection_VID1               1
+#define MC_VideoOutputSelection_VID2               2
+#define MC_VideoOutputSelection_VID3               3
+#define MC_VideoOutputSelection_VID4               4
+#define MC_VideoOutputSelection_CASCADE            5
+#define MC_DetectedSignalStrength                (MCPARAMID)( 4156 << 14)
+#define MC_DetectedSignalStrength_NORMAL           1
+#define MC_DetectedSignalStrength_HIGH             2
+#define MC_DetectedSignalStrength_LOW              3
+#define MC_PinSMIO1_Source_STROBE_INV              5
+#define MC_PinSMIO2_Source_STROBE_INV              5
+#define MC_PinSTX_Source_ON                        5
+#define MC_PinSTX_Source_OFF                       6
+#define MC_PinSTY_Source_ON                        5
+#define MC_PinSTY_Source_OFF                       6
+#define MC_PinSMIO3_Source_STROBE_INV              5
+#define MC_PinSMIO4_Source_STROBE_INV              5
+#define MC_StrobeLevel_Filter                    (MCPARAMID)( 4157 << 14)
+#define MC_Hactive_Nominal_Px                    (MCPARAMID)( 4158 << 14)
+#define MC_DetectedSignalStrength_TOO_HIGH         4
+#define MC_DetectedSignalStrength_TOO_LOW          5
+#define MC_BEC_SrcCAPM_CUp                         3
+#define MC_BEC_SrcCAPM_CDown                       4
+#define MC_FEC_CAPM_CUp                            3
+#define MC_FEC_CAPM_CDown                          4
+#define MC__DelayedStandardFrameRate_Hz          (MCPARAMID)( 4159 << 14)
+#define MC__Delayed_WindowY_Ln                   (MCPARAMID)( 4160 << 14)
+#define MC_InputState_DISCONNECTED                 6
+#define MC_FEC_SWITCH                            (MCPARAMID)( 4161 << 14)
+#define MC_FEC_SWITCH_Forbidden                    1
+#define MC_FEC_SWITCH_Allowed                      2
+#define MC__ImageSizeX                           (MCPARAMID)( 4162 << 14)
+#define MC__ImageSizeY                           (MCPARAMID)( 4163 << 14)
+#define MC__RFields                              (MCPARAMID)( 4164 << 14)
+#define MC__AverageBitratePoints                 (MCPARAMID)( 4165 << 14)
+#define MC__DownScalingFactor                    (MCPARAMID)( 4166 << 14)
+#define MC__AvgBitrateRedFactor                  (MCPARAMID)( 4167 << 14)
+#define MC___AvgBitrateRedFactor                 (MCPARAMID)( 4168 << 14)
+#define MC_HardwareTriggerNeeded                 (MCPARAMID)( 4169 << 14)
+#define MC_HardwareTriggerNeeded_NO                1
+#define MC_HardwareTriggerNeeded_YES               2
+#define MC_CaptureStrategy                       (MCPARAMID)( 4170 << 14)
+#define MC_CaptureStrategy_SPEED                   1
+#define MC_CaptureStrategy_UNITY                   2
+#define MC_ResolutionXMinRule                    (MCPARAMID)( 4171 << 14)
+#define MC_ResolutionYMinRule                    (MCPARAMID)( 4172 << 14)
+#define MC_ENC_HCropping                         (MCPARAMID)( 4173 << 14)
+#define MC_ENC_HCropping_YES                       1
+#define MC_ENC_HCropping_NO                        2
+#define MC_ENC_VCropping                         (MCPARAMID)( 4174 << 14)
+#define MC_ENC_VCropping_YES                       1
+#define MC_ENC_VCropping_NO                        2
+#define MC_ENC_LastLine                          (MCPARAMID)( 4175 << 14)
+#define MC_CameraControlSignalSet_UNAVAILABLE     20
+#define MC_CameraControlSignalSet_UNAVAILABLE_PxxRA_M  21
+#define MC_CameraControlSignalSet_UNAVAILABLE_PxxRM_1  22
+#define MC_CameraControlSignalSet_UNAVAILABLE_PxxRM_2  23
+#define MC__RST_100ns                            (MCPARAMID)( 4176 << 14)
+#define MC__RST_E                                (MCPARAMID)( 4177 << 14)
+#define MC_HID                                   (MCPARAMID)( 4178 << 14)
+#define MC_VID                                   (MCPARAMID)( 4179 << 14)
+#define MC_HVID                                  (MCPARAMID)( 4180 << 14)
+#define MC_VrefSearchWindowLeft_ms               (MCPARAMID)( 4181 << 14)
+#define MC_VrefSearchWindowRight_ms              (MCPARAMID)( 4182 << 14)
+#define MC_Vsync2Vref_ms                         (MCPARAMID)( 4183 << 14)
+#define MC_VSyncSearchWindowLeft_ms              (MCPARAMID)( 4184 << 14)
+#define MC_VSyncSearchWindowRight_ms             (MCPARAMID)( 4185 << 14)
+#define MC_StandardFrameRate_mHz_Int             (MCPARAMID)( 4186 << 14)
+#define MC_StandardFrameRate_Hz_Int              (MCPARAMID)( 4187 << 14)
+#define MC__VideoDecoderType                     (MCPARAMID)( 4188 << 14)
+#define MC__VideoDecoderType_D3                    1
+#define MC__VideoDecoderType_CLASSIC               2
+#define MC_CaptureRate_1                         (MCPARAMID)( 4189 << 14)
+#define MC_CaptureRate_10                        (MCPARAMID)( 4190 << 14)
+#define MC_CaptureRate_11                        (MCPARAMID)( 4191 << 14)
+#define MC_CaptureRate_12                        (MCPARAMID)( 4192 << 14)
+#define MC_CaptureRate_8                         (MCPARAMID)( 4193 << 14)
+#define MC_CaptureRate_3                         (MCPARAMID)( 4194 << 14)
+#define MC_CaptureRate_4                         (MCPARAMID)( 4195 << 14)
+#define MC_CaptureRate_5                         (MCPARAMID)( 4196 << 14)
+#define MC_CaptureRate_7                         (MCPARAMID)( 4197 << 14)
+#define MC_CaptureRate_6                         (MCPARAMID)( 4198 << 14)
+#define MC_CaptureRate_2                         (MCPARAMID)( 4199 << 14)
+#define MC_CaptureRate_9                         (MCPARAMID)( 4200 << 14)
+#define MC_HCsyncBfr_Px                          (MCPARAMID)( 4201 << 14)
+#define MC_HCsyncAft_Px                          (MCPARAMID)( 4202 << 14)
+#define MC_VideoSlewTime_ns                      (MCPARAMID)( 4203 << 14)
+#define MC__LeftMargin_Max_1000                  (MCPARAMID)( 4204 << 14)
+#define MC__TopMargin_Max_1000                   (MCPARAMID)( 4205 << 14)
+#define MC__CaptureRateControl                   (MCPARAMID)( 4206 << 14)
+#define MC_SignalStrength                        (MCPARAMID)( 4207 << 14)
+#define MC_SignalStrength_NORMAL                   1
+#define MC_SignalStrength_STRONG                   2
+#define MC_SignalStrength_WEAK                     3
+#define MC_SignalStrength_TOO_STRONG               4
+#define MC_SignalStrength_TOO_WEAK                 5
+#define MC__FPGA_Model_HARMONY_3_1                 4
+#define MC_MicroBlazeIx                          (MCPARAMID)( 4208 << 14)
+#define MC_InputFunction_FREE                     15
+#define MC_InputFunction_RESERVED                 16
+#define MC_InputState_OPEN                         7
+#define MC_InputStyle_AUTO                         9
+#define MC_InputStyle_RELAY                       10
+#define MC_InputStyle_5V                          11
+#define MC_InputStyle_12V                         12
+#define MC_InputFilter_FILTER_10ms                 6
+#define MC_InputFilter_FILTER_100ms                7
+#define MC_OutputFunction_FREE                    15
+#define MC_OutputStyle_SSRLY                      11
+#define MC_ConnectorName_PROFESSIONAL_IO          27
+#define MC_WatchdogResetsCount_OLD               (MCPARAMID)( 4209 << 14)
+#define MC_StartupTimeout_128ms                  (MCPARAMID)( 4210 << 14)
+#define MC_ApplicationTimeout_128ms              (MCPARAMID)( 4211 << 14)
+#define MC_GainY_VB                              (MCPARAMID)( 4212 << 14)
+#define MC_GainU_VB                              (MCPARAMID)( 4213 << 14)
+#define MC_GainV_VB                              (MCPARAMID)( 4214 << 14)
+#define MC_Offset_VB                             (MCPARAMID)( 4215 << 14)
+#define MC_GainY_CX                              (MCPARAMID)( 4216 << 14)
+#define MC_GainU_CX                              (MCPARAMID)( 4217 << 14)
+#define MC_GainV_CX                              (MCPARAMID)( 4218 << 14)
+#define MC_Offset_CX                             (MCPARAMID)( 4219 << 14)
+#define MC__SIZY_PerField                        (MCPARAMID)( 4220 << 14)
+#define MC__Tk_X_Px                              (MCPARAMID)( 4221 << 14)
+#define MC__Category__ADR_Process                 47
+#define MC__ADR_GrabSizeX_Component              (MCPARAMID)( 4222 << 14)
+#define MC_OffsetY_VB                            (MCPARAMID)( 4223 << 14)
+#define MC_OffsetY_CX                            (MCPARAMID)( 4224 << 14)
+#define MC_GainY_AfterCX                         (MCPARAMID)( 4225 << 14)
+#define MC_GainY_AfterVB                         (MCPARAMID)( 4226 << 14)
+#define MC_GainU_AfterCX                         (MCPARAMID)( 4227 << 14)
+#define MC_GainU_AfterVB                         (MCPARAMID)( 4228 << 14)
+#define MC_GainV_AfterCX                         (MCPARAMID)( 4229 << 14)
+#define MC_GainV_AfterVB                         (MCPARAMID)( 4230 << 14)
+#define MC_OffsetY_AfterCX                       (MCPARAMID)( 4231 << 14)
+#define MC_OffsetY_AfterVB                       (MCPARAMID)( 4232 << 14)
+#define MC__GainY_AfterCX                        (MCPARAMID)( 4233 << 14)
+#define MC__GainY_AfterVB                        (MCPARAMID)( 4234 << 14)
+#define MC__GainU_AfterCX                        (MCPARAMID)( 4235 << 14)
+#define MC__GainU_AfterVB                        (MCPARAMID)( 4236 << 14)
+#define MC__GainV_AfterCX                        (MCPARAMID)( 4237 << 14)
+#define MC__GainV_AfterVB                        (MCPARAMID)( 4238 << 14)
+#define MC__OffsetY_AfterCX                      (MCPARAMID)( 4239 << 14)
+#define MC__OffsetY_AfterVB                      (MCPARAMID)( 4240 << 14)
+#define MC__CSIO_CSIO1Out_LOW                      8
+#define MC__CSIO_CSIO2Out_LOW                      8
+#define MC__CSIO_CSIO3Out_LOW                      8
+#define MC__CSIO_CSIO4Out_LOW                      8
+#define MC__STR_SREF                             (MCPARAMID)( 4241 << 14)
+#define MC__STR_SREF_TSB                           1
+#define MC__STR_SREF_CSB                           2
+#define MC_TrigEdge_Filter                       (MCPARAMID)( 4242 << 14)
+#define MC_EndTrigEdge_Filter                    (MCPARAMID)( 4243 << 14)
+#define MC_Camera_CAMERA_sPAL                    214
+#define MC_Camera_CAMERA_sNTSC                   215
+#define MC_Camera_CAMERA_sCCIR                   216
+#define MC_Camera_CAMERA_sEIA                    217
+#define MC_Standard_sPAL                           7
+#define MC_Standard_sNTSC                          8
+#define MC_FEC_VSTD_sPAL_SQ                        9
+#define MC_FEC_VSTD_sNTSC_SQ                      10
+#define MC_FEC_VSTD_sPAL_BROAD                    11
+#define MC_FEC_VSTD_sNTSC_BROAD                   12
+#define MC_Board_Name                            (MCPARAMID)( 4244 << 14)
+#define MC_Board_Name_Unknown                      1
+#define MC_Board_Name_Alert                        2
+#define MC_Board_Name_Diligent                     3
+#define MC_Board_Family                          (MCPARAMID)( 4245 << 14)
+#define MC_Board_Family_Unknown                    1
+#define MC_CaptureStrategy_Filter                (MCPARAMID)( 4246 << 14)
+#define MC__VBC_LBFR_GEOM                        (MCPARAMID)( 4247 << 14)
+#define MC_LUT_Filter                            (MCPARAMID)( 4248 << 14)
+#define MC_LUT_nbr                               (MCPARAMID)( 4249 << 14)
+#define MC__ImageSizeX_Interface                 (MCPARAMID)( 4250 << 14)
+#define MC__ImageSizeY_Interface                 (MCPARAMID)( 4251 << 14)
+#define MC_WhiteCrush                            (MCPARAMID)( 4252 << 14)
+#define MC_WhiteCrush_ON                           1
+#define MC_WhiteCrush_OFF                          2
+#define MC__BoardType__PICOLO_TYMO                29
+#define MC_Connector_YC1                         124
+#define MC_Connector_YC2                         125
+#define MC_Connector_YC3                         126
+#define MC_Connector_YC4                         127
+#define MC_VideoOutputSelection_VID5               6
+#define MC_VideoOutputSelection_VID6               7
+#define MC_VideoOutputSelection_VID7               8
+#define MC_VideoOutputSelection_VID8               9
+#define MC_VideoOutputSelection_VID9              10
+#define MC_VideoOutputSelection_VID10             11
+#define MC_VideoOutputSelection_VID11             12
+#define MC_VideoOutputSelection_VID12             13
+#define MC_VideoOutputSelection_VID13             14
+#define MC_VideoOutputSelection_VID14             15
+#define MC_VideoOutputSelection_VID15             16
+#define MC_VideoOutputSelection_VID16             17
+#define MC__Range                                (MCPARAMID)( 4253 << 14)
+#define MC__NormalContrast                       (MCPARAMID)( 4254 << 14)
+#define MC_AutoAgc                               (MCPARAMID)( 4255 << 14)
+#define MC_AutoAgc_ENABLED                         1
+#define MC_AutoAgc_DISABLED                        2
+#define MC_AutoVga                               (MCPARAMID)( 4256 << 14)
+#define MC_AutoVga_ENABLED                         1
+#define MC_AutoVga_DISABLED                        2
+#define MC__CDC_MTAP_OneTimeSlot                   3
+#define MC__CDC_MTAP_TwoTimeSlots_MultiplexedBits   4
+#define MC__CDC_MTAP_TwoTimeSlots_MultiplexedTaps   5
+#define MC__CDC_MTAP_ThreeTimeSlots_MultiplexedTaps   6
+#define MC__CDC_ALIGN_Bit8                         4
+#define MC__CDC_ALIGN_Bit10                        5
+#define MC__CDC_ALIGN_Bit12                        6
+#define MC__CDC_ALIGN_Bit14                        7
+#define MC__CDC_ALIGN_Bit16                        8
+#define MC__CDA_TRAIL_LD                         (MCPARAMID)( 4257 << 14)
+#define MC__CDA_LEAD1                            (MCPARAMID)( 4258 << 14)
+#define MC__CDA_TRAIL_INI1                       (MCPARAMID)( 4259 << 14)
+#define MC_TRAIL_MODULO                          (MCPARAMID)( 4260 << 14)
+#define MC__CDA_LEAD2                            (MCPARAMID)( 4261 << 14)
+#define MC__CDA_TRAIL_INI2                       (MCPARAMID)( 4262 << 14)
+#define MC__CDA_LEAD3                            (MCPARAMID)( 4263 << 14)
+#define MC__CDA_TRAIL_INI3                       (MCPARAMID)( 4264 << 14)
+#define MC__CDA_LEAD4                            (MCPARAMID)( 4265 << 14)
+#define MC__CDA_TRAIL_INI4                       (MCPARAMID)( 4266 << 14)
+#define MC__CDA_TRAIL_PADDING                    (MCPARAMID)( 4267 << 14)
+#define MC__CDA_TRAIL_PADDING_OneAssemblyCycle     1
+#define MC__CDA_TRAIL_PADDING_TwoAssemblyCycle     2
+#define MC_TapConfiguration                      (MCPARAMID)( 4268 << 14)
+#define MC_TapConfiguration_BASE_1T8               1
+#define MC_TapConfiguration_BASE_1T10              2
+#define MC_TapConfiguration_BASE_1T12              3
+#define MC_TapConfiguration_BASE_1T14              4
+#define MC_TapConfiguration_BASE_1T16              5
+#define MC_TapConfiguration_BASE_1T24              6
+#define MC_TapConfiguration_BASE_2T8               7
+#define MC_TapConfiguration_BASE_2T10              8
+#define MC_TapConfiguration_BASE_2T12              9
+#define MC_TapConfiguration_BASE_3T8              10
+#define MC_TapConfiguration_BASE_1T30B2           11
+#define MC_TapConfiguration_BASE_1T36B2           12
+#define MC_TapConfiguration_BASE_1T42B2           13
+#define MC_TapConfiguration_BASE_1T48B2           14
+#define MC_TapConfiguration_BASE_2T14B2           15
+#define MC_TapConfiguration_BASE_2T16B2           16
+#define MC_TapConfiguration_BASE_2T24B2           17
+#define MC_TapConfiguration_BASE_3T10B2           18
+#define MC_TapConfiguration_BASE_3T12B2           19
+#define MC_TapConfiguration_BASE_3T14B2           20
+#define MC_TapConfiguration_BASE_3T16B2           21
+#define MC_TapConfiguration_BASE_4T8B2            22
+#define MC_TapConfiguration_BASE_4T10B2           23
+#define MC_TapConfiguration_BASE_4T12B2           24
+#define MC_TapConfiguration_BASE_1T24B3           25
+#define MC_TapConfiguration_BASE_1T30B3           26
+#define MC_TapConfiguration_BASE_1T36B3           27
+#define MC_TapConfiguration_BASE_1T42B3           28
+#define MC_TapConfiguration_BASE_1T48B3           29
+#define MC_TapConfiguration_MEDIUM_1T30           30
+#define MC_TapConfiguration_MEDIUM_1T36           31
+#define MC_TapConfiguration_MEDIUM_1T42           32
+#define MC_TapConfiguration_MEDIUM_1T48           33
+#define MC_TapConfiguration_MEDIUM_2T14           34
+#define MC_TapConfiguration_MEDIUM_2T16           35
+#define MC_TapConfiguration_MEDIUM_2T24           36
+#define MC_TapConfiguration_MEDIUM_3T10           37
+#define MC_TapConfiguration_MEDIUM_3T12           38
+#define MC_TapConfiguration_MEDIUM_3T14           39
+#define MC_TapConfiguration_MEDIUM_3T16           40
+#define MC_TapConfiguration_MEDIUM_4T8            41
+#define MC_TapConfiguration_MEDIUM_4T10           42
+#define MC_TapConfiguration_MEDIUM_4T12           43
+#define MC_TapConfiguration_MEDIUM_8T8B2          44
+#define MC_TapConfiguration_FULL_8T8              45
+#define MC_TapConfiguration_Filter               (MCPARAMID)( 4269 << 14)
+#define MC__GCL_CLCFG_FULL                         3
+#define MC_WIS_DeinterlaceMode                   (MCPARAMID)( 4270 << 14)
+#define MC_WIS_DeinterlaceMode_INTERPOLATION       1
+#define MC_WIS_DeinterlaceMode_WEAVING             2
+#define MC_WIS_DeinterlaceMode_BLENDING            3
+#define MC_CL_ConfigurationClass                 (MCPARAMID)( 4271 << 14)
+#define MC_CL_ConfigurationClass_BASE              1
+#define MC_CL_ConfigurationClass_MEDIUM            2
+#define MC_CL_ConfigurationClass_FULL              3
+#define MC_CL_BitDepth                           (MCPARAMID)( 4272 << 14)
+#define MC_TapGeometry                           (MCPARAMID)( 4273 << 14)
+#define MC_TapGeometry_1X                          1
+#define MC_TapGeometry_1X2                         2
+#define MC_TapGeometry_2X                          3
+#define MC_TapGeometry_2XE                         4
+#define MC_TapGeometry_2XM                         5
+#define MC_TapGeometry_1X3                         6
+#define MC_TapGeometry_3X                          7
+#define MC_TapGeometry_1X4                         8
+#define MC_TapGeometry_4X                          9
+#define MC_TapGeometry_2X2                        10
+#define MC_TapGeometry_2X2E                       11
+#define MC_TapGeometry_2X2M                       12
+#define MC_TapGeometry_1X8                        13
+#define MC_TapGeometry_8X                         14
+#define MC_TapGeometry_4X2                        15
+#define MC_TapGeometry_1X_1Y                      16
+#define MC_TapGeometry_1X2_1Y                     17
+#define MC_TapGeometry_2X_1Y                      18
+#define MC_TapGeometry_2XE_1Y                     19
+#define MC_TapGeometry_2XM_1Y                     20
+#define MC_TapGeometry_1X_1Y2                     21
+#define MC_TapGeometry_1X_2YE                     22
+#define MC_TapGeometry_1X3_1Y                     23
+#define MC_TapGeometry_3X_1Y                      24
+#define MC_TapGeometry_1X4_1Y                     25
+#define MC_TapGeometry_4X_1Y                      26
+#define MC_TapGeometry_2X2_1Y                     27
+#define MC_TapGeometry_2X2E_1Y                    28
+#define MC_TapGeometry_2X2M_1Y                    29
+#define MC_TapGeometry_1X2_2YE                    30
+#define MC_TapGeometry_2X_2YE                     31
+#define MC_TapGeometry_2XE_2YE                    32
+#define MC_TapGeometry_2XM_2YE                    33
+#define MC_TapGeometry_1X8_1Y                     34
+#define MC_TapGeometry_8X_1Y                      35
+#define MC_TapGeometry_4X2_1Y                     36
+#define MC_TapGeometry_2X2E_2YE                   37
+#define MC_CompressionType                       (MCPARAMID)( 4274 << 14)
+#define MC_CompressionType_NONE                    1
+#define MC_CompressionType_DX50                    2
+#define MC_CompressionType_MP4S                    3
+#define MC_TapGeometry_Filter                    (MCPARAMID)( 4275 << 14)
+#define MC_CL_Tapcount                           (MCPARAMID)( 4276 << 14)
+#define MC_AssyConfig                            (MCPARAMID)( 4277 << 14)
+#define MC_AssyConfig_SINGLE                       1
+#define MC_AssyConfig_DUALXPAIR                    2
+#define MC_AssyConfig_DUALXTAP                     3
+#define MC_AssyConfig_DUALXEND                     4
+#define MC_AssyConfig_DUALXMID                     5
+#define MC_AssyConfig_DUALYPAIR                    6
+#define MC_AssyConfig_DUALYEND                     7
+#define MC_AssyConfig_TRIPLE                       8
+#define MC_AssyConfig_QUADXTAP                     9
+#define MC_AssyConfig_QUADXPAIRTAP                10
+#define MC_AssyConfig_QUADXPAIREND                11
+#define MC_AssyConfig_QUADXPAIRMID                12
+#define MC_AssyConfig_OCTALXTAP                   13
+#define MC_AssyConfig_QUADXQUAD                   14
+#define MC_AssyConfig_MEDIUM_2T24_1X2_1Y          15
+#define MC_CL_PixelComponentBitDepth             (MCPARAMID)( 4278 << 14)
+#define MC__CDC_ISIZE_BIT8                        14
+#define MC__CDC_ISIZE_BIT10                       15
+#define MC__CDC_ISIZE_BIT12                       16
+#define MC__CDC_ISIZE_BIT14                       17
+#define MC__CDC_ISIZE_BIT16                       18
+#define MC__CDC_ISIZE_BIT10T2                     19
+#define MC__CDC_ISIZE_BIT12T2                     20
+#define MC__CDC_ISIZE_BIT14T2                     21
+#define MC__CDC_ISIZE_BIT16T2                     22
+#define MC_AssyPixelComponentSize                (MCPARAMID)( 4279 << 14)
+#define MC_AssyComponentCount                    (MCPARAMID)( 4280 << 14)
+#define MC_AssyConfig_INVALID                     16
+#define MC__Category_InputDataProcessing          48
+#define MC_FifoPitchOffset                       (MCPARAMID)( 4281 << 14)
+#define MC_FifoSizeOffset                        (MCPARAMID)( 4282 << 14)
+#define MC_FifoPitch                             (MCPARAMID)( 4283 << 14)
+#define MC_FifoSize                              (MCPARAMID)( 4284 << 14)
+#define MC__Category_WindowControllers            49
+#define MC__SFA01                                (MCPARAMID)( 4285 << 14)
+#define MC__SFA02                                (MCPARAMID)( 4286 << 14)
+#define MC__SFA03                                (MCPARAMID)( 4287 << 14)
+#define MC__SFA04                                (MCPARAMID)( 4288 << 14)
+#define MC__SFA05                                (MCPARAMID)( 4289 << 14)
+#define MC__SFA06                                (MCPARAMID)( 4290 << 14)
+#define MC__SFA07                                (MCPARAMID)( 4291 << 14)
+#define MC__SFA08                                (MCPARAMID)( 4292 << 14)
+#define MC_TapConfiguration_INVALID               46
+#define MC__CDA_INDEX_MAP                        (MCPARAMID)( 4293 << 14)
+#define MC__CWR_INDEX_MAP                        (MCPARAMID)( 4294 << 14)
+#define MC__Lead_W1                              (MCPARAMID)( 4295 << 14)
+#define MC__Lead_W2                              (MCPARAMID)( 4296 << 14)
+#define MC__Lead_W3                              (MCPARAMID)( 4297 << 14)
+#define MC__Lead_W4                              (MCPARAMID)( 4298 << 14)
+#define MC__Lead_D1                              (MCPARAMID)( 4299 << 14)
+#define MC__Lead_D2                              (MCPARAMID)( 4300 << 14)
+#define MC__Lead_D3                              (MCPARAMID)( 4301 << 14)
+#define MC__Lead_D4                              (MCPARAMID)( 4302 << 14)
+#define MC__CDA_P1INDEX                          (MCPARAMID)( 4303 << 14)
+#define MC__CDA_P2INDEX                          (MCPARAMID)( 4304 << 14)
+#define MC__CDA_P3INDEX                          (MCPARAMID)( 4305 << 14)
+#define MC__CDA_P4INDEX                          (MCPARAMID)( 4306 << 14)
+#define MC__AssyPerWindow                        (MCPARAMID)( 4307 << 14)
+#define MC_CL_TimeSlots                          (MCPARAMID)( 4308 << 14)
+#define MC_ASW_1                                 (MCPARAMID)( 4309 << 14)
+#define MC__ASW_1                                (MCPARAMID)( 4310 << 14)
+#define MC__ASW_2                                (MCPARAMID)( 4311 << 14)
+#define MC__ASW_3                                (MCPARAMID)( 4312 << 14)
+#define MC__ASW_4                                (MCPARAMID)( 4313 << 14)
+#define MC__RightMargin_Px                       (MCPARAMID)( 4314 << 14)
+#define MC_FifoWindowOffsetX_Px                  (MCPARAMID)( 4315 << 14)
+#define MC_FifoWindowOffsetY_Ln                  (MCPARAMID)( 4316 << 14)
+#define MC_OffsetX_Px_MinBound                   (MCPARAMID)( 4317 << 14)
+#define MC_OffsetX_Px_MaxBound                   (MCPARAMID)( 4318 << 14)
+#define MC_OffsetY_Ln_MinBound                   (MCPARAMID)( 4319 << 14)
+#define MC_OffsetY_Ln_MaxBound                   (MCPARAMID)( 4320 << 14)
+#define MC_ImageLeadPadding                      (MCPARAMID)( 4321 << 14)
+#define MC_ImageTrailPadding                     (MCPARAMID)( 4322 << 14)
+#define MC_XferSizeX                             (MCPARAMID)( 4323 << 14)
+#define MC_BufferOffsetX                         (MCPARAMID)( 4324 << 14)
+#define MC_XferSizeY                             (MCPARAMID)( 4325 << 14)
+#define MC_BufferOffsetY                         (MCPARAMID)( 4326 << 14)
+#define MC_FifoOffsetX_Unaligned                 (MCPARAMID)( 4327 << 14)
+#define MC_FifoBufferSkew                        (MCPARAMID)( 4328 << 14)
+#define MC_FifoBufferHomeAddress                 (MCPARAMID)( 4329 << 14)
+#define MC_TrigEdge_GOOPEN                         5
+#define MC_TrigEdge_OPEN                           6
+#define MC_EndTrigEdge_GOOPEN                      5
+#define MC_EndTrigEdge_OPEN                        6
+#define MC__PllMax                               (MCPARAMID)( 4330 << 14)
+#define MC__PllMaxOffset                         (MCPARAMID)( 4331 << 14)
+#define MC_MltpLineAnlShift                      (MCPARAMID)( 4332 << 14)
+#define MC_WoiOrgX                               (MCPARAMID)( 4333 << 14)
+#define MC_WOI_GrabWindow_Filter                 (MCPARAMID)( 4334 << 14)
+#define MC_WoiOrgY                               (MCPARAMID)( 4335 << 14)
+#define MC_WoiWidth                              (MCPARAMID)( 4336 << 14)
+#define MC_WoiHeight                             (MCPARAMID)( 4337 << 14)
+#define MC_CameraWoiBankSetup                    (MCPARAMID)( 4338 << 14)
+#define MC_CameraWoiBankSelect                   (MCPARAMID)( 4339 << 14)
+#define MC_GrabWindow_WOI                          6
+#define MC_GrabWindow_Filter                     (MCPARAMID)( 4340 << 14)
+#define MC__Category_CLCAM_Interface              50
+#define MC_CLCAM_Topology                        (MCPARAMID)( 4341 << 14)
+#define MC_CLCAM_Topology_SINGLE                   1
+#define MC_CLCAM_Topology_DUALXPAIR                2
+#define MC_CLCAM_Topology_DUALXTAP                 3
+#define MC_CLCAM_Topology_DUALXEND                 4
+#define MC_CLCAM_Topology_DUALXMID                 5
+#define MC_CLCAM_Topology_DUALYPAIR                6
+#define MC_CLCAM_Topology_DUALYEND                 7
+#define MC_CLCAM_Topology_TRIPLE                   8
+#define MC_CLCAM_Topology_QUADXTAP                 9
+#define MC_CLCAM_Topology_QUADXPAIRTAP            10
+#define MC_CLCAM_Topology_QUADXPAIREND            11
+#define MC_CLCAM_Topology_QUADXPAIRMID            12
+#define MC_CLCAM_Topology_TRIPLEXPAIR             13
+#define MC_CLCAM_DataWidth                       (MCPARAMID)( 4342 << 14)
+#define MC_CLCAM_ClockFreq_KHz                   (MCPARAMID)( 4343 << 14)
+#define MC_CLCAM_FramePeriod                     (MCPARAMID)( 4344 << 14)
+#define MC_CLCAM_FrameBlanking                   (MCPARAMID)( 4345 << 14)
+#define MC_CLCAM_LinePeriod                      (MCPARAMID)( 4346 << 14)
+#define MC_CLCAM_LineBlanking                    (MCPARAMID)( 4347 << 14)
+#define MC_CLCAM_LineInitialdelay                (MCPARAMID)( 4348 << 14)
+#define MC_CLCAM_LineCount                       (MCPARAMID)( 4349 << 14)
+#define MC_CLCAM_DataInitialDelay                (MCPARAMID)( 4350 << 14)
+#define MC_CLCAM_Databurst                       (MCPARAMID)( 4351 << 14)
+#define MC_CLCAM_DataBurstGap                    (MCPARAMID)( 4352 << 14)
+#define MC_CLCAM_DataBurstCount                  (MCPARAMID)( 4353 << 14)
+#define MC_CLCAM_DataGating                      (MCPARAMID)( 4354 << 14)
+#define MC_CLCAM_LVALNone                        (MCPARAMID)( 4355 << 14)
+#define MC_CLCAM_FVALNone                        (MCPARAMID)( 4356 << 14)
+#define MC_CLCAM_DataIncrement                   (MCPARAMID)( 4357 << 14)
+#define MC_CLCAM_DataArrangement                 (MCPARAMID)( 4358 << 14)
+#define MC_CLCAM_OPModeFreeRun                   (MCPARAMID)( 4359 << 14)
+#define MC_CLCAM_OPModeExpWidth                  (MCPARAMID)( 4360 << 14)
+#define MC_CLCAM_AsyncResetPin                   (MCPARAMID)( 4361 << 14)
+#define MC_CLCAM_Power                           (MCPARAMID)( 4362 << 14)
+#define MC_MaxWoiBanks                           (MCPARAMID)( 4363 << 14)
+#define MC_MaxWoiPerBank                         (MCPARAMID)( 4364 << 14)
+#define MC_WoiGranularity                        (MCPARAMID)( 4365 << 14)
+#define MC_ComponentStorageOrder                 (MCPARAMID)( 4366 << 14)
+#define MC_ComponentStorageOrder_DIRECT            1
+#define MC_ComponentStorageOrder_REVERSE           2
+#define MC_InputFilter_OFF                         8
+#define MC_WoiMinWidth                           (MCPARAMID)( 4367 << 14)
+#define MC_WoiMaxWidth                           (MCPARAMID)( 4368 << 14)
+#define MC_WoiMinHeight                          (MCPARAMID)( 4369 << 14)
+#define MC_WoiMaxHeight                          (MCPARAMID)( 4370 << 14)
+#define MC_TrigCtl_AUTO                            9
+#define MC_TrigCtl_RELAY                          10
+#define MC_TrigCtl_5V                             11
+#define MC_TrigCtl_12V                            12
+#define MC_TrigFilter_FILTER_10ms                  5
+#define MC_TrigFilter_FILTER_100ms                 6
+#define MC_EndTrigCtl_AUTO                         5
+#define MC_EndTrigCtl_RELAY                        6
+#define MC_EndTrigCtl_5V                           7
+#define MC_EndTrigCtl_12V                          8
+#define MC_EndTrigFilter_FILTER_10ms               5
+#define MC_EndTrigFilter_FILTER_100ms              6
+#define MC_WoiSaveMemoryBank                     (MCPARAMID)( 4371 << 14)
+#define MC_WoiSaveMemoryBank_YES                   1
+#define MC_WoiSaveMemoryBank_NO                    2
+#define MC_WoiSaveMemoryBankAfterWoiBankSetup    (MCPARAMID)( 4372 << 14)
+#define MC_WoiSaveMemoryBankAfterWoiBankSetup_YES   1
+#define MC_WoiSaveMemoryBankAfterWoiBankSetup_NO   2
+#define MC_SaveMemoryBank                        (MCPARAMID)( 4373 << 14)
+#define MC_SaveMemoryBank_YES                      1
+#define MC_SaveMemoryBank_NO                       2
+#define MC__CDA_LEADASSYNR1                      (MCPARAMID)( 4374 << 14)
+#define MC__CDA_LEADASSYNR2                      (MCPARAMID)( 4375 << 14)
+#define MC__CDA_LEADASSYNR3                      (MCPARAMID)( 4376 << 14)
+#define MC__CDA_LEADASSYNR4                      (MCPARAMID)( 4377 << 14)
+#define MC__CDA_REFASSYNR1                       (MCPARAMID)( 4378 << 14)
+#define MC__CDA_REFASSYNR2                       (MCPARAMID)( 4379 << 14)
+#define MC__CDA_REFASSYNR3                       (MCPARAMID)( 4380 << 14)
+#define MC__CDA_REFASSYNR4                       (MCPARAMID)( 4381 << 14)
+#define MC_CheckRamp_DataIncrement               (MCPARAMID)( 4382 << 14)
+#define MC_DefaultConnector                      (MCPARAMID)( 4383 << 14)
+#define MC_DefaultConnector_M                      1
+#define MC_DefaultConnector_A                      2
+#define MC_DefaultConnector_B                      3
+#define MC___MSFError_Check_Filter               (MCPARAMID)( 4384 << 14)
+#define MC_CLCAM_TapMultiplexingMode             (MCPARAMID)( 4385 << 14)
+#define MC_CLCAM_TapMultiplexingMode_OneTimeSlot   1
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_MultiplexedBits   2
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_MultiplexedTaps   3
+#define MC_CLCAM_TapMultiplexingMode_ThreeTimeSlots_MultiplexedTaps   4
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_TwoMultiplexedTaps   5
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_FourMultiplexedTaps   6
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_SixMultiplexedTaps   7
+#define MC_CLCAM_TapMultiplexingMode_TwoTimeSlots_EightMultiplexedTaps   8
+#define MC__CDC_MTAP_TwoTimeSlots_TwoMultiplexedTaps   7
+#define MC__CDC_MTAP_TwoTimeSlots_FourMultiplexedTaps   8
+#define MC__CDC_MTAP_TwoTimeSlots_SixMultiplexedTaps   9
+#define MC__CDC_MTAP_TwoTimeSlots_EightMultiplexedTaps  10
+#define MC_CLCAM_Geometry                        (MCPARAMID)( 4386 << 14)
+#define MC_CLCAM_Geometry_TG_1X                    1
+#define MC_CLCAM_Geometry_TG_1X2                   2
+#define MC_CLCAM_Geometry_TG_2X                    3
+#define MC_CLCAM_Geometry_TG_2XE                   4
+#define MC_CLCAM_Geometry_TG_2XM                   5
+#define MC_CLCAM_Geometry_TG_1X_1Y2                6
+#define MC_CLCAM_Geometry_TG_1X_2YE                7
+#define MC_CLCAM_Geometry_TG_1X3                   8
+#define MC_CLCAM_Geometry_TG_3X                    9
+#define MC_CLCAM_Geometry_TG_1X4                  10
+#define MC_CLCAM_Geometry_TG_4X                   11
+#define MC_CLCAM_Geometry_TG_2X2                  12
+#define MC_CLCAM_Geometry_TG_2X2E                 13
+#define MC_CLCAM_Geometry_TG_2X2M                 14
+#define MC_CLCAM_Geometry_TG_1X2_2YE              15
+#define MC_CLCAM_Geometry_TG_2X_2YE               16
+#define MC_CLCAM_Geometry_TG_2XE_2YE              17
+#define MC_CLCAM_Geometry_TG_2XM_2YE              18
+#define MC_CLCAM_Geometry_TG_1X8                  19
+#define MC_CLCAM_Geometry_TG_8X                   20
+#define MC_CLCAM_Geometry_TG_4X2                  21
+#define MC_CLCAM_Geometry_TG_2X2E_2YE             22
+#define MC_ActiveDroopCompensation               (MCPARAMID)( 4387 << 14)
+#define MC_ActiveDroopCompensation_ENABLED         1
+#define MC_ActiveDroopCompensation_DISABLED        2
+#define MC_AnalogClamping                        (MCPARAMID)( 4388 << 14)
+#define MC_AnalogClamping_ENABLED                  1
+#define MC_AnalogClamping_DISABLED                 2
+#define MC_PhaseRate_AbsoluteUpperLimit_mHz      (MCPARAMID)( 4389 << 14)
+#define MC_PhaseRate_Optimal_mHz                 (MCPARAMID)( 4390 << 14)
+#define MC__VgaGain                              (MCPARAMID)( 4391 << 14)
+#define MC_CLCAM_MinLineRate_Hz                  (MCPARAMID)( 4392 << 14)
+#define MC_CLCAM_MinFrameRate_mHz                (MCPARAMID)( 4393 << 14)
+#define MC_SrcSizeY                              (MCPARAMID)( 4394 << 14)
+#define MC__Requested_GainY                      (MCPARAMID)( 4395 << 14)
+#define MC__Requested_GainU                      (MCPARAMID)( 4396 << 14)
+#define MC__Requested_GainV                      (MCPARAMID)( 4397 << 14)
+#define MC__Requested_OffsetY                    (MCPARAMID)( 4398 << 14)
+#define MC__TwinGrabberIndex                     (MCPARAMID)( 4399 << 14)
+#define MC__Twin_GainY                           (MCPARAMID)( 4400 << 14)
+#define MC__Twin_GainU                           (MCPARAMID)( 4401 << 14)
+#define MC__Twin_GainV                           (MCPARAMID)( 4402 << 14)
+#define MC__Twin_OffsetY                         (MCPARAMID)( 4403 << 14)
+#define MC__Luma_xmin                            (MCPARAMID)( 4404 << 14)
+#define MC__Luma_xmax                            (MCPARAMID)( 4405 << 14)
+#define MC_WindowXY_Filter                       (MCPARAMID)( 4406 << 14)
+#define MC__Twin_GainY_VB                        (MCPARAMID)( 4407 << 14)
+#define MC__Twin_GainU_VB                        (MCPARAMID)( 4408 << 14)
+#define MC__Twin_GainV_VB                        (MCPARAMID)( 4409 << 14)
+#define MC__Twin_OffsetY_VB                      (MCPARAMID)( 4410 << 14)
+#define MC_BEC_TwinOffset_Y                      (MCPARAMID)( 4411 << 14)
+#define MC_BEC_TwinGain_Y                        (MCPARAMID)( 4412 << 14)
+#define MC_BEC_Twin_Gain_Cr_1                    (MCPARAMID)( 4413 << 14)
+#define MC_BEC_Twin_Gain_Cr_2                    (MCPARAMID)( 4414 << 14)
+#define MC_BEC_Twin_Gain_Cb_1                    (MCPARAMID)( 4415 << 14)
+#define MC_BEC_Twin_Gain_Cb_2                    (MCPARAMID)( 4416 << 14)
+#define MC_CameraConfigMessageBuilder            (MCPARAMID)( 4417 << 14)
+#define MC_CameraConfigMessageBuilder_NONE         1
+#define MC_CameraConfigMessageBuilder_CSB4000CL    2
+#define MC__Twin_CSC_GainY                       (MCPARAMID)( 4418 << 14)
+#define MC__Twin_CSC_GainCrR                     (MCPARAMID)( 4419 << 14)
+#define MC__Twin_CSC_GainCrG                     (MCPARAMID)( 4420 << 14)
+#define MC__Twin_CSC_GainCbB                     (MCPARAMID)( 4421 << 14)
+#define MC__Twin_CSC_GainCbG                     (MCPARAMID)( 4422 << 14)
+#define MC__CTD_TDCLK_HRWP                         5
+#define MC__TRG_EFTFLT                           (MCPARAMID)( 4423 << 14)
+#define MC__TRG_EFTFLT_100ns                       1
+#define MC__TRG_EFTFLT_500ns                       2
+#define MC__TRG_EFTFLT_2500ns                      3
+#define MC__CTD_TDCLK_REFTIC                       6
+#define MC__RawGrabSizeY_Ln                      (MCPARAMID)( 4424 << 14)
+#define MC__IsExpert2                            (MCPARAMID)( 4425 << 14)
+#define MC__IsExpert2_YES                          1
+#define MC__IsExpert2_NO                           2
+#define MC__CameraWindowingAvailable             (MCPARAMID)( 4426 << 14)
+#define MC__CameraWindowingAvailable_YES           1
+#define MC__CameraWindowingAvailable_NO            2
+#define MC__RawGrabSizeX_Log2                    (MCPARAMID)( 4427 << 14)
+#define MC_CL_TapCount_Y                         (MCPARAMID)( 4428 << 14)
+#define MC_CL_TapCount_X                         (MCPARAMID)( 4429 << 14)
+#define MC_CamConfig_IxxSA_D                     279
+#define MC_CamConfig_IxxSD                       280
+#define MC_CamConfig_PxxSA_D                     281
+#define MC__LQS_COUNT3                           (MCPARAMID)( 4430 << 14)
+#define MC__TRG_TM                               (MCPARAMID)( 4431 << 14)
+#define MC__TRG_TM_IMM                             1
+#define MC__TRG_TM_HRD                             2
+#define MC__TRG_TM_SFT                             3
+#define MC__TRG_TM_CMB                             4
+#define MC__TRG_NTM                              (MCPARAMID)( 4432 << 14)
+#define MC__TRG_NTM_RPT                            1
+#define MC__TRG_NTM_HRD                            2
+#define MC__TRG_NTM_SFT                            3
+#define MC__TRG_NTM_CMB                            4
+#define MC__TRG_NTM_PER                            5
+#define MC_CameraWoiBankSetupCmd                 (MCPARAMID)( 4433 << 14)
+#define MC_CameraWoiBankSelectCmd                (MCPARAMID)( 4434 << 14)
+#define MC_BruSelonDC                            (MCPARAMID)( 4435 << 14)
+#define MC_BruSelonDC_Forbidden                    1
+#define MC_BruSelonDC_Allowed                      2
+#define MC_FEC_DITHER                            (MCPARAMID)( 4436 << 14)
+#define MC_FEC_DITHER_Forbidden                    1
+#define MC_FEC_DITHER_Allowed                      2
+#define MC_VgaGain                               (MCPARAMID)( 4437 << 14)
+#define MC_VsyncBfrEndExp_us                     (MCPARAMID)( 4438 << 14)
+#define MC_StrobeMode_OFF                          4
+#define MC__CSIO_CSIO2Out_LOX                      9
+#define MC___IO1Usage_Check                      (MCPARAMID)( 4439 << 14)
+#define MC___IO1Usage_Check_PASS                   1
+#define MC___IO1Usage_Check_FAIL                   2
+#define MC___IO2Usage_Check                      (MCPARAMID)( 4440 << 14)
+#define MC___IO2Usage_Check_PASS                   1
+#define MC___IO2Usage_Check_FAIL                   2
+#define MC___IO3Usage_Check                      (MCPARAMID)( 4441 << 14)
+#define MC___IO3Usage_Check_PASS                   1
+#define MC___IO3Usage_Check_FAIL                   2
+#define MC___IO4Usage_Check                      (MCPARAMID)( 4442 << 14)
+#define MC___IO4Usage_Check_PASS                   1
+#define MC___IO4Usage_Check_FAIL                   2
+#define MC___ISOA2Usage_Check                    (MCPARAMID)( 4443 << 14)
+#define MC___ISOA2Usage_Check_PASS                 1
+#define MC___ISOA2Usage_Check_FAIL                 2
+#define MC___TRA1Usage_Check                     (MCPARAMID)( 4444 << 14)
+#define MC___TRA1Usage_Check_PASS                  1
+#define MC___TRA1Usage_Check_FAIL                  2
+#define MC___TRA2Usage_Check                     (MCPARAMID)( 4445 << 14)
+#define MC___TRA2Usage_Check_PASS                  1
+#define MC___TRA2Usage_Check_FAIL                  2
+#define MC___ISOA1Usage_Check                    (MCPARAMID)( 4446 << 14)
+#define MC___ISOA1Usage_Check_PASS                 1
+#define MC___ISOA1Usage_Check_FAIL                 2
+#define MC_Gain_s                                (MCPARAMID)( 4447 << 14)
+#define MC__Twin_GainY_s                         (MCPARAMID)( 4448 << 14)
+#define MC__CBA_READ_RATE                        (MCPARAMID)( 4449 << 14)
+#define MC__CBA_READ_RATE_FULL                     1
+#define MC__CBA_READ_RATE_HALF                     2
+#define MC_GrabWindow_WOI_NO                       7
+#define MC_GrabWindow_WOI_YES                      8
+#define MC_FifoSizeX_inbytes                     (MCPARAMID)( 4450 << 14)
+#define MC_Camera_CSB1100CL                      218
+#define MC_CamConfig_P22RC                       282
+#define MC___FPGA_Model_Check                    (MCPARAMID)( 4451 << 14)
+#define MC___FPGA_Model_Check_PASS                 1
+#define MC___FPGA_Model_Check_FAIL                 2
+#define MC_WoiLvalCount                          (MCPARAMID)( 4452 << 14)
+#define MC_WoiPixelCount                         (MCPARAMID)( 4453 << 14)
+#define MC_ECASet                                (MCPARAMID)( 4454 << 14)
+#define MC_WoiFvalHigh_Tk                        (MCPARAMID)( 4455 << 14)
+#define MC_WoiMinTriggerDisableTime_Tk           (MCPARAMID)( 4456 << 14)
+#define MC_WoiReadoutTime_Tk                     (MCPARAMID)( 4457 << 14)
+#define MC_WoiReadoutDur_Tk                      (MCPARAMID)( 4458 << 14)
+#define MC_WoiReadoutDur_10ns                    (MCPARAMID)( 4459 << 14)
+#define MC_IoCapability                          (MCPARAMID)( 4460 << 14)
+#define MC___MinHactive_Check                    (MCPARAMID)( 4461 << 14)
+#define MC___MinHactive_Check_PASS                 1
+#define MC___MinHactive_Check_FAIL                 2
+#define MC_VIOS_WatchdogConfigSet                (MCPARAMID)( 4462 << 14)
+#define MC_LinePitchGranularity                  (MCPARAMID)( 4463 << 14)
+#define MC__BoardType__CFA                        30
+#define MC__PP_OutputXStep_Bytes                 (MCPARAMID)( 4464 << 14)
+#define MC__Category_CFA_PixelProcessor           51
+#define MC__Category_CFA_PixelProcessor_Local     52
+#define MC_TOI_USR_OrgX_Px                       (MCPARAMID)( 4465 << 14)
+#define MC_TOI_REF_OrgX_Px                       (MCPARAMID)( 4466 << 14)
+#define MC_TOI_USR_OrgY_Ln                       (MCPARAMID)( 4467 << 14)
+#define MC_TOI_USR_Width_Px                      (MCPARAMID)( 4468 << 14)
+#define MC_TOI_USR_Height_Ln                     (MCPARAMID)( 4469 << 14)
+#define MC_TOI_USR_Granularity_Px                (MCPARAMID)( 4470 << 14)
+#define MC_TOI_USR_MinWidth_Px                   (MCPARAMID)( 4471 << 14)
+#define MC_TOI_USR_MaxWidth_Px                   (MCPARAMID)( 4472 << 14)
+#define MC_TOI_USR_MinHeight_Px                  (MCPARAMID)( 4473 << 14)
+#define MC_TOI_REF_OrgY_Ln                       (MCPARAMID)( 4474 << 14)
+#define MC_TOI_REF_Width_Px                      (MCPARAMID)( 4475 << 14)
+#define MC_TOI_REF_Height_Ln                     (MCPARAMID)( 4476 << 14)
+#define MC_TOI_USR_MinHeight_Ln                  (MCPARAMID)( 4477 << 14)
+#define MC_TOI_USR_MaxHeight_Ln                  (MCPARAMID)( 4478 << 14)
+#define MC_TOI_EXT_OrgX_Px                       (MCPARAMID)( 4479 << 14)
+#define MC_TOI_EXT_OrgY_Ln                       (MCPARAMID)( 4480 << 14)
+#define MC_TOI_EXT_Width_Px                      (MCPARAMID)( 4481 << 14)
+#define MC_TOI_EXT_Height_Ln                     (MCPARAMID)( 4482 << 14)
+#define MC_TOI_FSR_OrgX_Px                       (MCPARAMID)( 4483 << 14)
+#define MC_TOI_FSR_OrgY_Ln                       (MCPARAMID)( 4484 << 14)
+#define MC_TOI_FSR_Width_Px                      (MCPARAMID)( 4485 << 14)
+#define MC_TOI_FSR_Height_Ln                     (MCPARAMID)( 4486 << 14)
+#define MC_TOI_XFR_OffsetX_Bytes                 (MCPARAMID)( 4487 << 14)
+#define MC_TOI_XFR_OffsetY_Lines                 (MCPARAMID)( 4488 << 14)
+#define MC_TOI_XFR_Width_Bytes                   (MCPARAMID)( 4489 << 14)
+#define MC_TOI_XFR_Height_Lines                  (MCPARAMID)( 4490 << 14)
+#define MC_ColorComponentCount                   (MCPARAMID)( 4491 << 14)
+#define MC_AssyColorStorage                      (MCPARAMID)( 4492 << 14)
+#define MC_AssyColorStorage_PACKED                 1
+#define MC_AssyColorStorage_PLANAR                 2
+#define MC_ColorFormat_ARGB64                     80
+#define MC_ColorFormat_RGB15Y8                    81
+#define MC_ColorFormat_RGB16Y8                    82
+#define MC_ColorFormat_RGB24Y8                    83
+#define MC_ColorFormat_RGB24Y10                   84
+#define MC_ColorFormat_RGB24Y12                   85
+#define MC_ColorFormat_RGB24Y16                   86
+#define MC_ColorFormat_YRGB32                     87
+#define MC_ColorFormat_YRGB64                     88
+#define MC_ColorFormat_RGB24PLY8                  89
+#define MC_ColorFormat_RGB30PLY8                  90
+#define MC_ColorFormat_RGB36PLY8                  91
+#define MC_ColorFormat_RGB48PLY8                  92
+#define MC_ColorFormat_RGB24PLY10                 93
+#define MC_ColorFormat_RGB30PLY10                 94
+#define MC_ColorFormat_RGB36PLY10                 95
+#define MC_ColorFormat_RGB48PLY10                 96
+#define MC_ColorFormat_RGB24PLY12                 97
+#define MC_ColorFormat_RGB30PLY12                 98
+#define MC_ColorFormat_RGB36PLY12                 99
+#define MC_ColorFormat_RGB48PLY12                100
+#define MC_ColorFormat_RGB24PLY16                101
+#define MC_ColorFormat_RGB30PLY16                102
+#define MC_ColorFormat_RGB36PLY16                103
+#define MC_ColorFormat_RGB48PLY16                104
+#define MC_Camera_CV_M8CL                        219
+#define MC_ScaleX4096                            (MCPARAMID)( 4493 << 14)
+#define MC_ScaleY4096                            (MCPARAMID)( 4494 << 14)
+#define MC_TOI_XFR_Granularity_Bytes             (MCPARAMID)( 4495 << 14)
+#define MC_Param                                 (MCPARAMID)( 4496 << 14)
+#define MC_FifoOffsetX0                          (MCPARAMID)( 4497 << 14)
+#define MC_FifoOffsetX1                          (MCPARAMID)( 4498 << 14)
+#define MC_FifoOffsetX2                          (MCPARAMID)( 4499 << 14)
+#define MC_FifoOffsetX3                          (MCPARAMID)( 4500 << 14)
+#define MC_XferSizeX0                            (MCPARAMID)( 4501 << 14)
+#define MC_XferSizeX1                            (MCPARAMID)( 4502 << 14)
+#define MC_XferSizeX2                            (MCPARAMID)( 4503 << 14)
+#define MC_XferSizeX3                            (MCPARAMID)( 4504 << 14)
+#define MC_FifoSizeX0                            (MCPARAMID)( 4505 << 14)
+#define MC_FifoSizeX1                            (MCPARAMID)( 4506 << 14)
+#define MC_FifoSizeX2                            (MCPARAMID)( 4507 << 14)
+#define MC_FifoSizeX3                            (MCPARAMID)( 4508 << 14)
+#define MC_BufferOffsetX_Unaligned               (MCPARAMID)( 4509 << 14)
+#define MC_BufferOffsetX0                        (MCPARAMID)( 4510 << 14)
+#define MC_BufferOffsetX1                        (MCPARAMID)( 4511 << 14)
+#define MC_BufferOffsetX2                        (MCPARAMID)( 4512 << 14)
+#define MC_BufferOffsetX3                        (MCPARAMID)( 4513 << 14)
+#define MC_FifoSizeY0                            (MCPARAMID)( 4514 << 14)
+#define MC_XferSizeY0                            (MCPARAMID)( 4515 << 14)
+#define MC_FifoOffsetY0                          (MCPARAMID)( 4516 << 14)
+#define MC_BufferOffsetY0                        (MCPARAMID)( 4517 << 14)
+#define MC_TOI_XFR_Granularity_Px                (MCPARAMID)( 4518 << 14)
+#define MC_TOI_XFR_OffsetX_Px                    (MCPARAMID)( 4519 << 14)
+#define MC_TOI_XFR_OffsetY_Ln                    (MCPARAMID)( 4520 << 14)
+#define MC_TOI_XFR_Height_Ln                     (MCPARAMID)( 4521 << 14)
+#define MC_TOI_XFR_OrgX_Px                       (MCPARAMID)( 4522 << 14)
+#define MC_TOI_XFR_OrgY_Ln                       (MCPARAMID)( 4523 << 14)
+#define MC_TOI_XFR_Width_Px                      (MCPARAMID)( 4524 << 14)
+#define MC_TOI_EXT_Margin                        (MCPARAMID)( 4525 << 14)
+#define MC_TOI_FSR_OrgX                          (MCPARAMID)( 4526 << 14)
+#define MC_TOI_FSR_Width                         (MCPARAMID)( 4527 << 14)
+#define MC_FBSizeX_Px                            (MCPARAMID)( 4528 << 14)
+#define MC_FBSizeY_Ln                            (MCPARAMID)( 4529 << 14)
+#define MC_GWPixelSize                           (MCPARAMID)( 4530 << 14)
+#define MC_GWSizeX_Px                            (MCPARAMID)( 4531 << 14)
+#define MC_GWSizeY_Ln                            (MCPARAMID)( 4532 << 14)
+#define MC__Category_CFA_PixelProcessor_LowLevel  53
+#define MC_WRF_1stLineRep0                       (MCPARAMID)( 4533 << 14)
+#define MC_WRF_1stLineRep0_ON                      1
+#define MC_WRF_1stLineRep0_OFF                     2
+#define MC_WRF_1stLineRep1                       (MCPARAMID)( 4534 << 14)
+#define MC_WRF_1stLineRep1_ON                      1
+#define MC_WRF_1stLineRep1_OFF                     2
+#define MC_TOI_EXT_Bot_Ln                        (MCPARAMID)( 4535 << 14)
+#define MC_WRF_LastLineRep0                      (MCPARAMID)( 4536 << 14)
+#define MC_WRF_LastLineRep0_ON                     1
+#define MC_WRF_LastLineRep0_OFF                    2
+#define MC_WRF_LastLineRep1                      (MCPARAMID)( 4537 << 14)
+#define MC_WRF_LastLineRep1_ON                     1
+#define MC_WRF_LastLineRep1_OFF                    2
+#define MC_TOI_EXT_Right_Px                      (MCPARAMID)( 4538 << 14)
+#define MC_WRF_1stColRep0                        (MCPARAMID)( 4539 << 14)
+#define MC_WRF_1stColRep0_ON                       1
+#define MC_WRF_1stColRep0_OFF                      2
+#define MC_WRF_LastColRep0                       (MCPARAMID)( 4540 << 14)
+#define MC_WRF_LastColRep0_ON                      1
+#define MC_WRF_LastColRep0_OFF                     2
+#define MC_GWPixelComponentSize                  (MCPARAMID)( 4541 << 14)
+#define MC_WRF_ColumnIx0                         (MCPARAMID)( 4542 << 14)
+#define MC_WRF_TOIwidth0                         (MCPARAMID)( 4543 << 14)
+#define MC_WRF_Line10                            (MCPARAMID)( 4544 << 14)
+#define MC_WRF_Line10_GB                           1
+#define MC_WRF_Line10_BG                           2
+#define MC_WRF_Line10_RG                           3
+#define MC_WRF_Line10_GR                           4
+#define MC_GWColorRegistration                   (MCPARAMID)( 4545 << 14)
+#define MC_ColorRegistrationTOI0                 (MCPARAMID)( 4546 << 14)
+#define MC_ImagePlaneType                        (MCPARAMID)( 4547 << 14)
+#define MC_ImagePlaneType_Y                        1
+#define MC_ImagePlaneType_R                        2
+#define MC_ImagePlaneType_G                        3
+#define MC_ImagePlaneType_B                        4
+#define MC_ImagePlaneType_RGB                      5
+#define MC_ImagePlaneType_ARGB                     6
+#define MC_ImagePlaneType_YRGB                     7
+#define MC_ImagePlaneType_BAYER                    8
+#define MC_ImagePlaneType_RAW                      9
+#define MC_ImagePlaneType_UNUSED                  10
+#define MC_ImagePlanePixelSize                   (MCPARAMID)( 4548 << 14)
+#define MC_WRF_XferSize00                        (MCPARAMID)( 4549 << 14)
+#define MC_WRF_XferSize10                        (MCPARAMID)( 4550 << 14)
+#define MC_WRF_XferSize20                        (MCPARAMID)( 4551 << 14)
+#define MC_WRF_XferSize30                        (MCPARAMID)( 4552 << 14)
+#define MC_WRF_TOIheight0                        (MCPARAMID)( 4553 << 14)
+#define MC_LastTOIIndex                          (MCPARAMID)( 4554 << 14)
+#define MC_WRF_LastTOI0                          (MCPARAMID)( 4555 << 14)
+#define MC_WRF_LastTOI0_TRUE                       1
+#define MC_WRF_LastTOI0_FALSE                      2
+#define MC_FBPlanePitch                          (MCPARAMID)( 4556 << 14)
+#define MC_FBFormat                              (MCPARAMID)( 4557 << 14)
+#define MC_FBFormat_MONO8                          1
+#define MC_FBFormat_MONO16                         2
+#define MC_FBFormat_PLANAR8                        3
+#define MC_FBFormat_PLANAR16                       4
+#define MC_WRF_TOIGap0                           (MCPARAMID)( 4558 << 14)
+#define MC_TOICount                              (MCPARAMID)( 4559 << 14)
+#define MC_WRF_TOIoffset0                        (MCPARAMID)( 4560 << 14)
+#define MC_FBPitch                               (MCPARAMID)( 4561 << 14)
+#define MC_FBPlaneCount                          (MCPARAMID)( 4562 << 14)
+#define MC_FBPixelComponentSize                  (MCPARAMID)( 4563 << 14)
+#define MC_WRF_NbOfLine0                         (MCPARAMID)( 4564 << 14)
+#define MC_WRF_1stColRep1                        (MCPARAMID)( 4565 << 14)
+#define MC_WRF_1stColRep1_ON                       1
+#define MC_WRF_1stColRep1_OFF                      2
+#define MC_WRF_LastColRep1                       (MCPARAMID)( 4566 << 14)
+#define MC_WRF_LastColRep1_ON                      1
+#define MC_WRF_LastColRep1_OFF                     2
+#define MC_WRF_ColumnIx1                         (MCPARAMID)( 4567 << 14)
+#define MC_WRF_TOIwidth1                         (MCPARAMID)( 4568 << 14)
+#define MC_ColorRegistrationTOI1                 (MCPARAMID)( 4569 << 14)
+#define MC_WRF_Line11                            (MCPARAMID)( 4570 << 14)
+#define MC_WRF_Line11_GB                           1
+#define MC_WRF_Line11_BG                           2
+#define MC_WRF_Line11_RG                           3
+#define MC_WRF_Line11_GR                           4
+#define MC_WRF_XferSize01                        (MCPARAMID)( 4571 << 14)
+#define MC_WRF_XferSize11                        (MCPARAMID)( 4572 << 14)
+#define MC_WRF_XferSize21                        (MCPARAMID)( 4573 << 14)
+#define MC_WRF_XferSize31                        (MCPARAMID)( 4574 << 14)
+#define MC_WRF_TOIheight1                        (MCPARAMID)( 4575 << 14)
+#define MC_WRF_LastTOI1                          (MCPARAMID)( 4576 << 14)
+#define MC_WRF_LastTOI1_TRUE                       1
+#define MC_WRF_LastTOI1_FALSE                      2
+#define MC_WRF_TOIoffset1                        (MCPARAMID)( 4577 << 14)
+#define MC_WRF_TOIGap1                           (MCPARAMID)( 4578 << 14)
+#define MC_WRF_NbOfLine1                         (MCPARAMID)( 4579 << 14)
+#define MC_COF_mux1_sel                          (MCPARAMID)( 4580 << 14)
+#define MC_COF_mux1_sel_BYTE1                      1
+#define MC_COF_mux1_sel_BYTE2                      2
+#define MC_COF_mux1_sel_BYTE3                      3
+#define MC_COF_mux1_sel_INVALID                    4
+#define MC_COF_mux2_sel                          (MCPARAMID)( 4581 << 14)
+#define MC_COF_mux2_sel_BYTE2                      1
+#define MC_COF_mux2_sel_BYTE4                      2
+#define MC_COF_mux2_sel_INVALID                    3
+#define MC_COF_mux3_sel                          (MCPARAMID)( 4582 << 14)
+#define MC_COF_mux3_sel_BYTE2                      1
+#define MC_COF_mux3_sel_BYTE3                      2
+#define MC_COF_mux3_sel_BYTE4                      3
+#define MC_COF_mux3_sel_BYTE6                      4
+#define MC_COF_mux3_sel_INVALID                    5
+#define MC_COF_mux4_sel                          (MCPARAMID)( 4583 << 14)
+#define MC_COF_mux4_sel_BYTE2                      1
+#define MC_COF_mux4_sel_BYTE4                      2
+#define MC_COF_mux4_sel_BYTE8                      3
+#define MC_COF_mux4_sel_INVALID                    4
+#define MC_COF_mux5_sel                          (MCPARAMID)( 4584 << 14)
+#define MC_COF_mux5_sel_BYTE1                      1
+#define MC_COF_mux5_sel_BYTE2                      2
+#define MC_COF_mux5_sel_BYTE3                      3
+#define MC_COF_mux5_sel_BYTE4                      4
+#define MC_COF_mux5_sel_BYTE5                      5
+#define MC_COF_mux5_sel_BYTE6                      6
+#define MC_COF_mux5_sel_INVALID                    7
+#define MC_COF_mux6_sel                          (MCPARAMID)( 4585 << 14)
+#define MC_COF_mux6_sel_BYTE2                      1
+#define MC_COF_mux6_sel_BYTE4                      2
+#define MC_COF_mux6_sel_BYTE6                      3
+#define MC_COF_mux6_sel_INVALID                    4
+#define MC_COF_mux7_sel                          (MCPARAMID)( 4586 << 14)
+#define MC_COF_mux7_sel_BYTE2                      1
+#define MC_COF_mux7_sel_BYTE3                      2
+#define MC_COF_mux7_sel_BYTE6                      3
+#define MC_COF_mux7_sel_BYTE7                      4
+#define MC_COF_mux7_sel_BYTE8                      5
+#define MC_COF_mux7_sel_INVALID                    6
+#define MC_COF_mux8_sel                          (MCPARAMID)( 4587 << 14)
+#define MC_COF_mux8_sel_BYTE4                      1
+#define MC_COF_mux8_sel_BYTE8                      2
+#define MC_COF_mux8_sel_INVALID                    3
+#define MC_COF_mux7_sel_UNUSED                     7
+#define MC_COF_mux8_sel_UNUSED                     4
+#define MC_COF_Config                            (MCPARAMID)( 4588 << 14)
+#define MC_COF_Config_Y8DUAL                       1
+#define MC_COF_Config_RGB24                        2
+#define MC_COF_Config_ARGB32                       3
+#define MC_COF_Config_RGB24PL                      4
+#define MC_COF_Config_RGB30PL                      5
+#define MC_COF_Config_INVALID                      6
+#define MC_COF_mux1_sel_UNUSED                     5
+#define MC_COF_mux6_sel_UNUSED                     5
+#define MC_COF_AELevel1                          (MCPARAMID)( 4589 << 14)
+#define MC_COF_AELevel2                          (MCPARAMID)( 4590 << 14)
+#define MC_COF_AELevel3                          (MCPARAMID)( 4591 << 14)
+#define MC_COF_AELevel4                          (MCPARAMID)( 4592 << 14)
+#define MC_COF_AELevel5                          (MCPARAMID)( 4593 << 14)
+#define MC_COF_AELevel6                          (MCPARAMID)( 4594 << 14)
+#define MC_COF_AELevel7                          (MCPARAMID)( 4595 << 14)
+#define MC_COF_AELevel8                          (MCPARAMID)( 4596 << 14)
+#define MC_WWR_Plane0_Inst0                      (MCPARAMID)( 4597 << 14)
+#define MC_WWR_Plane0_Inst1                      (MCPARAMID)( 4598 << 14)
+#define MC_WWR_Plane0_Inst2                      (MCPARAMID)( 4599 << 14)
+#define MC_WWR_Plane0_Inst3                      (MCPARAMID)( 4600 << 14)
+#define MC_WWR_Plane1_Inst0                      (MCPARAMID)( 4601 << 14)
+#define MC_WWR_Plane1_Inst1                      (MCPARAMID)( 4602 << 14)
+#define MC_WWR_Plane1_Inst2                      (MCPARAMID)( 4603 << 14)
+#define MC_WWR_Plane1_Inst3                      (MCPARAMID)( 4604 << 14)
+#define MC_WWR_Plane2_Inst0                      (MCPARAMID)( 4605 << 14)
+#define MC_WWR_Plane2_Inst1                      (MCPARAMID)( 4606 << 14)
+#define MC_WWR_Plane2_Inst2                      (MCPARAMID)( 4607 << 14)
+#define MC_WWR_Plane2_Inst3                      (MCPARAMID)( 4608 << 14)
+#define MC_WWR_Plane3_Inst0                      (MCPARAMID)( 4609 << 14)
+#define MC_WWR_Plane3_Inst1                      (MCPARAMID)( 4610 << 14)
+#define MC_WWR_Plane3_Inst2                      (MCPARAMID)( 4611 << 14)
+#define MC_WWR_Plane3_Inst3                      (MCPARAMID)( 4612 << 14)
+#define MC_COF_WWR_Plane0_Inst0                  (MCPARAMID)( 4613 << 14)
+#define MC_COF_WWR_Plane0_Inst1                  (MCPARAMID)( 4614 << 14)
+#define MC_COF_WWR_Plane0_Inst2                  (MCPARAMID)( 4615 << 14)
+#define MC_COF_WWR_Plane0_Inst3                  (MCPARAMID)( 4616 << 14)
+#define MC_COF_WWR_Plane1_Inst0                  (MCPARAMID)( 4617 << 14)
+#define MC_COF_WWR_Plane1_Inst1                  (MCPARAMID)( 4618 << 14)
+#define MC_COF_WWR_Plane1_Inst2                  (MCPARAMID)( 4619 << 14)
+#define MC_COF_WWR_Plane1_Inst3                  (MCPARAMID)( 4620 << 14)
+#define MC_COF_WWR_Plane2_Inst0                  (MCPARAMID)( 4621 << 14)
+#define MC_COF_WWR_Plane2_Inst1                  (MCPARAMID)( 4622 << 14)
+#define MC_COF_WWR_Plane2_Inst2                  (MCPARAMID)( 4623 << 14)
+#define MC_COF_WWR_Plane2_Inst3                  (MCPARAMID)( 4624 << 14)
+#define MC_COF_WWR_Plane3_Inst0                  (MCPARAMID)( 4625 << 14)
+#define MC_COF_WWR_Plane3_Inst1                  (MCPARAMID)( 4626 << 14)
+#define MC_COF_WWR_Plane3_Inst2                  (MCPARAMID)( 4627 << 14)
+#define MC_COF_WWR_Plane3_Inst3                  (MCPARAMID)( 4628 << 14)
+#define MC_COF_WWR_ProgSize_Plane0               (MCPARAMID)( 4629 << 14)
+#define MC_COF_WWR_ProgSize_Plane1               (MCPARAMID)( 4630 << 14)
+#define MC_COF_WWR_ProgSize_Plane2               (MCPARAMID)( 4631 << 14)
+#define MC_COF_WWR_ProgSize_Plane3               (MCPARAMID)( 4632 << 14)
+#define MC_CPC_PPOF_bitWiseRouter                (MCPARAMID)( 4633 << 14)
+#define MC_OutputFormatterConfig                 (MCPARAMID)( 4634 << 14)
+#define MC_OutputFormatterConfig_Y8QUAD            1
+#define MC_OutputFormatterConfig_Y8DUAL            2
+#define MC_OutputFormatterConfig_Y10QUAD           3
+#define MC_OutputFormatterConfig_Y10DUAL           4
+#define MC_OutputFormatterConfig_Y12QUAD           5
+#define MC_OutputFormatterConfig_Y12DUAL           6
+#define MC_OutputFormatterConfig_Y16QUAD           7
+#define MC_OutputFormatterConfig_Y16DUAL           8
+#define MC_OutputFormatterConfig_RGB15             9
+#define MC_OutputFormatterConfig_RGB16            10
+#define MC_OutputFormatterConfig_RGB24            11
+#define MC_OutputFormatterConfig_ARGB32           12
+#define MC_OutputFormatterConfig_RGB30            13
+#define MC_OutputFormatterConfig_RGB32            14
+#define MC_OutputFormatterConfig_RGB48            15
+#define MC_OutputFormatterConfig_ARGB64           16
+#define MC_OutputFormatterConfig_RGB24PL          17
+#define MC_OutputFormatterConfig_RGB30PL          18
+#define MC_OutputFormatterConfig_RGB36PL          19
+#define MC_OutputFormatterConfig_RGB48PL          20
+#define MC_OutputFormatterConfig_RGB15Y8          21
+#define MC_OutputFormatterConfig_RGB16Y8          22
+#define MC_OutputFormatterConfig_RGB24Y8          23
+#define MC_OutputFormatterConfig_RGB24Y10         24
+#define MC_OutputFormatterConfig_RGB24Y12         25
+#define MC_OutputFormatterConfig_RGB24Y16         26
+#define MC_OutputFormatterConfig_YRGB32           27
+#define MC_OutputFormatterConfig_YRGB64           28
+#define MC_OutputFormatterConfig_RGB24PLY8        29
+#define MC_OutputFormatterConfig_RGB24PLY10       30
+#define MC_OutputFormatterConfig_RGB24PLY12       31
+#define MC_OutputFormatterConfig_RGB24PLY16       32
+#define MC_OutputFormatterConfig_RGB30PLY8        33
+#define MC_OutputFormatterConfig_RGB36PLY8        34
+#define MC_OutputFormatterConfig_RGB48PLY8        35
+#define MC_OutputFormatterConfig_RGB30PLY10       36
+#define MC_OutputFormatterConfig_RGB30PLY12       37
+#define MC_OutputFormatterConfig_RGB30PLY16       38
+#define MC_OutputFormatterConfig_RGB36PLY10       39
+#define MC_OutputFormatterConfig_RGB36PLY12       40
+#define MC_OutputFormatterConfig_RGB36PLY16       41
+#define MC_OutputFormatterConfig_RGB48PLY10       42
+#define MC_OutputFormatterConfig_RGB48PLY12       43
+#define MC_OutputFormatterConfig_RGB48PLY16       44
+#define MC_COF_mux8                              (MCPARAMID)( 4635 << 14)
+#define MC_COF_mux7                              (MCPARAMID)( 4636 << 14)
+#define MC_COF_mux6                              (MCPARAMID)( 4637 << 14)
+#define MC_COF_mux5                              (MCPARAMID)( 4638 << 14)
+#define MC_COF_mux4                              (MCPARAMID)( 4639 << 14)
+#define MC_COF_mux3                              (MCPARAMID)( 4640 << 14)
+#define MC_COF_mux2                              (MCPARAMID)( 4641 << 14)
+#define MC_COF_mux1                              (MCPARAMID)( 4642 << 14)
+#define MC_COF_WWR_ProgNr                        (MCPARAMID)( 4643 << 14)
+#define MC_PixelProcessorConfiguration           (MCPARAMID)( 4644 << 14)
+#define MC_PixelProcessorConfiguration_BAYER2RGB   1
+#define MC_PixelProcessorConfiguration_BAYER2RGBY   2
+#define MC_PixelProcessorConfiguration_BAYER2Y     3
+#define MC_PixelProcessorConfiguration_BAYER2BAYER   4
+#define MC_PixelProcessorConfiguration_RGB2RGB     5
+#define MC_PixelProcessorConfiguration_RGB2RGBY    6
+#define MC_PixelProcessorConfiguration_RGB2Y       7
+#define MC_PixelProcessorConfiguration_Y2Y         8
+#define MC_CFD_Mode                              (MCPARAMID)( 4645 << 14)
+#define MC_CFD_Mode_ADVANCED                       1
+#define MC_CFD_Mode_LEGACY                         2
+#define MC_CFD_Mode_Filter                       (MCPARAMID)( 4646 << 14)
+#define MC_CPC_DECODER_BYPASS                    (MCPARAMID)( 4647 << 14)
+#define MC_CPC_DECODER_BYPASS_TRUE                 1
+#define MC_CPC_DECODER_BYPASS_FALSE                2
+#define MC_CPC_DECODER_ALGO                      (MCPARAMID)( 4648 << 14)
+#define MC_CPC_DECODER_ALGO_ADVANCED               1
+#define MC_CPC_DECODER_ALGO_LEGACY                 2
+#define MC_CPC_PPSB_Dither                       (MCPARAMID)( 4649 << 14)
+#define MC_CPC_PPSB_Dither_ON                      1
+#define MC_CPC_PPSB_Dither_OFF                     2
+#define MC_CPC_PPSB_DataTyp                      (MCPARAMID)( 4650 << 14)
+#define MC_CPC_PPSB_DataTyp_Y8                     1
+#define MC_CPC_PPSB_DataTyp_Y16                    2
+#define MC_CPC_PPSB_DataTyp_RGB24                  3
+#define MC_CPC_PPSB_DataTyp_RGB48                  4
+#define MC_CPC_PPSB_DataTyp_BAYER8                 5
+#define MC_CPC_PPSB_DataTyp_BAYER16                6
+#define MC_ColorFormatClass                      (MCPARAMID)( 4651 << 14)
+#define MC_ColorFormatClass_RGB                    1
+#define MC_ColorFormatClass_RGBY                   2
+#define MC_ColorFormatClass_Y                      3
+#define MC_ColorFormatClass_BAYER                  4
+#define MC_COF_RAM_k_8                           (MCPARAMID)( 4652 << 14)
+#define MC_COF_RAM_k_7                           (MCPARAMID)( 4653 << 14)
+#define MC_COF_RAM_k_6                           (MCPARAMID)( 4654 << 14)
+#define MC_COF_RAM_k_5                           (MCPARAMID)( 4655 << 14)
+#define MC_COF_RAM_k_4                           (MCPARAMID)( 4656 << 14)
+#define MC_COF_RAM_k_3                           (MCPARAMID)( 4657 << 14)
+#define MC_COF_RAM_k_2                           (MCPARAMID)( 4658 << 14)
+#define MC_COF_RAM_k_1                           (MCPARAMID)( 4659 << 14)
+#define MC_COF_RAM_l_8                           (MCPARAMID)( 4660 << 14)
+#define MC_COF_RAM_l_7                           (MCPARAMID)( 4661 << 14)
+#define MC_COF_RAM_l_6                           (MCPARAMID)( 4662 << 14)
+#define MC_COF_RAM_l_5                           (MCPARAMID)( 4663 << 14)
+#define MC_COF_RAM_l_4                           (MCPARAMID)( 4664 << 14)
+#define MC_COF_RAM_l_3                           (MCPARAMID)( 4665 << 14)
+#define MC_COF_RAM_l_2                           (MCPARAMID)( 4666 << 14)
+#define MC_COF_RAM_l_1                           (MCPARAMID)( 4667 << 14)
+#define MC_TOI_XFR_RightX_Px                     (MCPARAMID)( 4668 << 14)
+#define MC_TOI_XFR_BotY_Ln                       (MCPARAMID)( 4669 << 14)
+#define MC_TOI_DMA_FifoSizeX                     (MCPARAMID)( 4670 << 14)
+#define MC_TOI_DMA_FifoSizeX_Px                  (MCPARAMID)( 4671 << 14)
+#define MC_TOI_DMA_FifoOffsetXPx                 (MCPARAMID)( 4672 << 14)
+#define MC_TOI_DMA_FifoOffsetX_Px                (MCPARAMID)( 4673 << 14)
+#define MC_TOI_DMA_FifoSizeY_Ln                  (MCPARAMID)( 4674 << 14)
+#define MC_TOI_DMA_FifoOffsetY_Ln                (MCPARAMID)( 4675 << 14)
+#define MC_COF_WWR_15                            (MCPARAMID)( 4676 << 14)
+#define MC_COF_WWR_14                            (MCPARAMID)( 4677 << 14)
+#define MC_COF_WWR_13                            (MCPARAMID)( 4678 << 14)
+#define MC_COF_WWR_12                            (MCPARAMID)( 4679 << 14)
+#define MC_COF_WWR_11                            (MCPARAMID)( 4680 << 14)
+#define MC_COF_WWR_10                            (MCPARAMID)( 4681 << 14)
+#define MC_COF_WWR_09                            (MCPARAMID)( 4682 << 14)
+#define MC_COF_WWR_08                            (MCPARAMID)( 4683 << 14)
+#define MC_COF_WWR_07                            (MCPARAMID)( 4684 << 14)
+#define MC_COF_WWR_06                            (MCPARAMID)( 4685 << 14)
+#define MC_COF_WWR_05                            (MCPARAMID)( 4686 << 14)
+#define MC_COF_WWR_04                            (MCPARAMID)( 4687 << 14)
+#define MC_COF_WWR_03                            (MCPARAMID)( 4688 << 14)
+#define MC_COF_WWR_02                            (MCPARAMID)( 4689 << 14)
+#define MC_COF_WWR_01                            (MCPARAMID)( 4690 << 14)
+#define MC_COF_WWR_00                            (MCPARAMID)( 4691 << 14)
+#define MC_COF_WWR_Inst15                        (MCPARAMID)( 4692 << 14)
+#define MC_COF_WWR_Inst14                        (MCPARAMID)( 4693 << 14)
+#define MC_COF_WWR_Inst13                        (MCPARAMID)( 4694 << 14)
+#define MC_COF_WWR_Inst12                        (MCPARAMID)( 4695 << 14)
+#define MC_COF_WWR_Inst11                        (MCPARAMID)( 4696 << 14)
+#define MC_COF_WWR_Inst10                        (MCPARAMID)( 4697 << 14)
+#define MC_COF_WWR_Inst09                        (MCPARAMID)( 4698 << 14)
+#define MC_COF_WWR_Inst08                        (MCPARAMID)( 4699 << 14)
+#define MC_COF_WWR_Inst07                        (MCPARAMID)( 4700 << 14)
+#define MC_COF_WWR_Inst06                        (MCPARAMID)( 4701 << 14)
+#define MC_COF_WWR_Inst05                        (MCPARAMID)( 4702 << 14)
+#define MC_COF_WWR_Inst04                        (MCPARAMID)( 4703 << 14)
+#define MC_COF_WWR_Inst03                        (MCPARAMID)( 4704 << 14)
+#define MC_COF_WWR_Inst02                        (MCPARAMID)( 4705 << 14)
+#define MC_COF_WWR_Inst01                        (MCPARAMID)( 4706 << 14)
+#define MC_COF_WWR_Inst00                        (MCPARAMID)( 4707 << 14)
+#define MC_TOI_DMA_BufferOffsetX_Px              (MCPARAMID)( 4708 << 14)
+#define MC_TOI_DMA_BufferOffsetY_Ln              (MCPARAMID)( 4709 << 14)
+#define MC_CPC_GAIN_0                            (MCPARAMID)( 4710 << 14)
+#define MC_CPC_GAIN_1                            (MCPARAMID)( 4711 << 14)
+#define MC_CPC_GAIN_2                            (MCPARAMID)( 4712 << 14)
+#define MC_CFD_Usage                             (MCPARAMID)( 4713 << 14)
+#define MC_CFD_Usage_UNUSED                        1
+#define MC_CFD_Usage_USED                          2
+#define MC_WBO_Usage                             (MCPARAMID)( 4714 << 14)
+#define MC_WBO_Usage_UNUSED                        1
+#define MC_WBO_Usage_USED                          2
+#define MC_WBO_Mode                              (MCPARAMID)( 4715 << 14)
+#define MC_WBO_Mode_NONE                           1
+#define MC_WBO_Mode_MANUAL                         2
+#define MC_WBO_Mode_CONTINUOUS                     3
+#define MC_WBO_Mode_ONCE                           4
+#define MC_WBO_Mode_Filter                       (MCPARAMID)( 4716 << 14)
+#define MC_WBO_GainR                             (MCPARAMID)( 4717 << 14)
+#define MC_WBO_Gain_Filter                       (MCPARAMID)( 4718 << 14)
+#define MC_WBO_GainG                             (MCPARAMID)( 4719 << 14)
+#define MC_WBO_GainB                             (MCPARAMID)( 4720 << 14)
+#define MC_WRF_TOIPitch0                         (MCPARAMID)( 4721 << 14)
+#define MC_WRF_TOIPitch1                         (MCPARAMID)( 4722 << 14)
+#define MC_TOI_USR_CountX                        (MCPARAMID)( 4723 << 14)
+#define MC_TOI_USR_CountY                        (MCPARAMID)( 4724 << 14)
+#define MC_TOI_USR_Topology                      (MCPARAMID)( 4725 << 14)
+#define MC_TOI_USR_Topology_INVALID                1
+#define MC_TOI_USR_Topology_1X_1Y                  2
+#define MC_TOI_USR_Topology_1X_2Y                  3
+#define MC_TOI_USR_Topology_2X_2Y                  4
+#define MC_TOI_USR_Topology_2X_4Y                  5
+#define MC_TOI_USR_Count                         (MCPARAMID)( 4726 << 14)
+#define MC_TOIWidth                              (MCPARAMID)( 4727 << 14)
+#define MC_TOIHeight                             (MCPARAMID)( 4728 << 14)
+#define MC_TOIHeight_LastRow                     (MCPARAMID)( 4729 << 14)
+#define MC_FirstTOILastRowIndex                  (MCPARAMID)( 4730 << 14)
+#define MC_TOIHeightLastRow                      (MCPARAMID)( 4731 << 14)
+#define MC_TOI_USR_LastIndex                     (MCPARAMID)( 4732 << 14)
+#define MC_TOI_USR_Width                         (MCPARAMID)( 4733 << 14)
+#define MC_TOI_USR_Height                        (MCPARAMID)( 4734 << 14)
+#define MC_TOI_USR_HeightLastRow                 (MCPARAMID)( 4735 << 14)
+#define MC_TOI_USR_FirstTOILastRowIndex          (MCPARAMID)( 4736 << 14)
+#define MC_WRF_TOI_USR_Width0                    (MCPARAMID)( 4737 << 14)
+#define MC_WRF_TOI_USR_Height0                   (MCPARAMID)( 4738 << 14)
+#define MC_WRF_TOI_USR_Width1                    (MCPARAMID)( 4739 << 14)
+#define MC_WRF_TOI_USR_Height1                   (MCPARAMID)( 4740 << 14)
+#define MC_TOI_USR_CountX_Min                    (MCPARAMID)( 4741 << 14)
+#define MC_WRF_1stLineRep2                       (MCPARAMID)( 4742 << 14)
+#define MC_WRF_1stLineRep2_ON                      1
+#define MC_WRF_1stLineRep2_OFF                     2
+#define MC_WRF_LastLineRep2                      (MCPARAMID)( 4743 << 14)
+#define MC_WRF_LastLineRep2_ON                     1
+#define MC_WRF_LastLineRep2_OFF                    2
+#define MC_WRF_1stColRep2                        (MCPARAMID)( 4744 << 14)
+#define MC_WRF_1stColRep2_ON                       1
+#define MC_WRF_1stColRep2_OFF                      2
+#define MC_WRF_LastColRep2                       (MCPARAMID)( 4745 << 14)
+#define MC_WRF_LastColRep2_ON                      1
+#define MC_WRF_LastColRep2_OFF                     2
+#define MC_WRF_ColumnIx2                         (MCPARAMID)( 4746 << 14)
+#define MC_WRF_TOIwidth2                         (MCPARAMID)( 4747 << 14)
+#define MC_ColorRegistrationTOI2                 (MCPARAMID)( 4748 << 14)
+#define MC_WRF_Line12                            (MCPARAMID)( 4749 << 14)
+#define MC_WRF_Line12_GB                           1
+#define MC_WRF_Line12_BG                           2
+#define MC_WRF_Line12_RG                           3
+#define MC_WRF_Line12_GR                           4
+#define MC_WRF_XferSize02                        (MCPARAMID)( 4750 << 14)
+#define MC_WRF_XferSize12                        (MCPARAMID)( 4751 << 14)
+#define MC_WRF_XferSize22                        (MCPARAMID)( 4752 << 14)
+#define MC_WRF_XferSize32                        (MCPARAMID)( 4753 << 14)
+#define MC_WRF_TOIheight2                        (MCPARAMID)( 4754 << 14)
+#define MC_WRF_LastTOI2                          (MCPARAMID)( 4755 << 14)
+#define MC_WRF_LastTOI2_TRUE                       1
+#define MC_WRF_LastTOI2_FALSE                      2
+#define MC_WRF_TOIoffset2                        (MCPARAMID)( 4756 << 14)
+#define MC_WRF_TOIPitch2                         (MCPARAMID)( 4757 << 14)
+#define MC_WRF_NbOfLine2                         (MCPARAMID)( 4758 << 14)
+#define MC_WRF_1stLineRep3                       (MCPARAMID)( 4759 << 14)
+#define MC_WRF_1stLineRep3_ON                      1
+#define MC_WRF_1stLineRep3_OFF                     2
+#define MC_WRF_LastLineRep3                      (MCPARAMID)( 4760 << 14)
+#define MC_WRF_LastLineRep3_ON                     1
+#define MC_WRF_LastLineRep3_OFF                    2
+#define MC_WRF_1stColRep3                        (MCPARAMID)( 4761 << 14)
+#define MC_WRF_1stColRep3_ON                       1
+#define MC_WRF_1stColRep3_OFF                      2
+#define MC_WRF_LastColRep3                       (MCPARAMID)( 4762 << 14)
+#define MC_WRF_LastColRep3_ON                      1
+#define MC_WRF_LastColRep3_OFF                     2
+#define MC_WRF_ColumnIx3                         (MCPARAMID)( 4763 << 14)
+#define MC_WRF_TOIwidth3                         (MCPARAMID)( 4764 << 14)
+#define MC_ColorRegistrationTOI3                 (MCPARAMID)( 4765 << 14)
+#define MC_WRF_Line13                            (MCPARAMID)( 4766 << 14)
+#define MC_WRF_Line13_GB                           1
+#define MC_WRF_Line13_BG                           2
+#define MC_WRF_Line13_RG                           3
+#define MC_WRF_Line13_GR                           4
+#define MC_WRF_XferSize03                        (MCPARAMID)( 4767 << 14)
+#define MC_WRF_XferSize13                        (MCPARAMID)( 4768 << 14)
+#define MC_WRF_XferSize23                        (MCPARAMID)( 4769 << 14)
+#define MC_WRF_XferSize33                        (MCPARAMID)( 4770 << 14)
+#define MC_WRF_TOIheight3                        (MCPARAMID)( 4771 << 14)
+#define MC_WRF_LastTOI3                          (MCPARAMID)( 4772 << 14)
+#define MC_WRF_LastTOI3_TRUE                       1
+#define MC_WRF_LastTOI3_FALSE                      2
+#define MC_WRF_TOIoffset3                        (MCPARAMID)( 4773 << 14)
+#define MC_WRF_TOIPitch3                         (MCPARAMID)( 4774 << 14)
+#define MC_WRF_NbOfLine3                         (MCPARAMID)( 4775 << 14)
+#define MC_WRF_1stLineRep4                       (MCPARAMID)( 4776 << 14)
+#define MC_WRF_1stLineRep4_ON                      1
+#define MC_WRF_1stLineRep4_OFF                     2
+#define MC_WRF_LastLineRep4                      (MCPARAMID)( 4777 << 14)
+#define MC_WRF_LastLineRep4_ON                     1
+#define MC_WRF_LastLineRep4_OFF                    2
+#define MC_WRF_1stColRep4                        (MCPARAMID)( 4778 << 14)
+#define MC_WRF_1stColRep4_ON                       1
+#define MC_WRF_1stColRep4_OFF                      2
+#define MC_WRF_LastColRep4                       (MCPARAMID)( 4779 << 14)
+#define MC_WRF_LastColRep4_ON                      1
+#define MC_WRF_LastColRep4_OFF                     2
+#define MC_WRF_ColumnIx4                         (MCPARAMID)( 4780 << 14)
+#define MC_WRF_TOIwidth4                         (MCPARAMID)( 4781 << 14)
+#define MC_ColorRegistrationTOI4                 (MCPARAMID)( 4782 << 14)
+#define MC_WRF_Line14                            (MCPARAMID)( 4783 << 14)
+#define MC_WRF_Line14_GB                           1
+#define MC_WRF_Line14_BG                           2
+#define MC_WRF_Line14_RG                           3
+#define MC_WRF_Line14_GR                           4
+#define MC_WRF_XferSize04                        (MCPARAMID)( 4784 << 14)
+#define MC_WRF_XferSize14                        (MCPARAMID)( 4785 << 14)
+#define MC_WRF_XferSize24                        (MCPARAMID)( 4786 << 14)
+#define MC_WRF_XferSize34                        (MCPARAMID)( 4787 << 14)
+#define MC_WRF_TOIheight4                        (MCPARAMID)( 4788 << 14)
+#define MC_WRF_LastTOI4                          (MCPARAMID)( 4789 << 14)
+#define MC_WRF_LastTOI4_TRUE                       1
+#define MC_WRF_LastTOI4_FALSE                      2
+#define MC_WRF_TOIoffset4                        (MCPARAMID)( 4790 << 14)
+#define MC_WRF_TOIPitch4                         (MCPARAMID)( 4791 << 14)
+#define MC_WRF_NbOfLine4                         (MCPARAMID)( 4792 << 14)
+#define MC_WRF_1stLineRep5                       (MCPARAMID)( 4793 << 14)
+#define MC_WRF_1stLineRep5_ON                      1
+#define MC_WRF_1stLineRep5_OFF                     2
+#define MC_WRF_LastLineRep5                      (MCPARAMID)( 4794 << 14)
+#define MC_WRF_LastLineRep5_ON                     1
+#define MC_WRF_LastLineRep5_OFF                    2
+#define MC_WRF_1stColRep5                        (MCPARAMID)( 4795 << 14)
+#define MC_WRF_1stColRep5_ON                       1
+#define MC_WRF_1stColRep5_OFF                      2
+#define MC_WRF_LastColRep5                       (MCPARAMID)( 4796 << 14)
+#define MC_WRF_LastColRep5_ON                      1
+#define MC_WRF_LastColRep5_OFF                     2
+#define MC_WRF_ColumnIx5                         (MCPARAMID)( 4797 << 14)
+#define MC_WRF_TOIwidth5                         (MCPARAMID)( 4798 << 14)
+#define MC_ColorRegistrationTOI5                 (MCPARAMID)( 4799 << 14)
+#define MC_WRF_Line15                            (MCPARAMID)( 4800 << 14)
+#define MC_WRF_Line15_GB                           1
+#define MC_WRF_Line15_BG                           2
+#define MC_WRF_Line15_RG                           3
+#define MC_WRF_Line15_GR                           4
+#define MC_WRF_XferSize05                        (MCPARAMID)( 4801 << 14)
+#define MC_WRF_XferSize15                        (MCPARAMID)( 4802 << 14)
+#define MC_WRF_XferSize25                        (MCPARAMID)( 4803 << 14)
+#define MC_WRF_XferSize35                        (MCPARAMID)( 4804 << 14)
+#define MC_WRF_TOIheight5                        (MCPARAMID)( 4805 << 14)
+#define MC_WRF_LastTOI5                          (MCPARAMID)( 4806 << 14)
+#define MC_WRF_LastTOI5_TRUE                       1
+#define MC_WRF_LastTOI5_FALSE                      2
+#define MC_WRF_TOIoffset5                        (MCPARAMID)( 4807 << 14)
+#define MC_WRF_TOIPitch5                         (MCPARAMID)( 4808 << 14)
+#define MC_WRF_NbOfLine5                         (MCPARAMID)( 4809 << 14)
+#define MC_WRF_1stLineRep6                       (MCPARAMID)( 4810 << 14)
+#define MC_WRF_1stLineRep6_ON                      1
+#define MC_WRF_1stLineRep6_OFF                     2
+#define MC_WRF_LastLineRep6                      (MCPARAMID)( 4811 << 14)
+#define MC_WRF_LastLineRep6_ON                     1
+#define MC_WRF_LastLineRep6_OFF                    2
+#define MC_WRF_1stColRep6                        (MCPARAMID)( 4812 << 14)
+#define MC_WRF_1stColRep6_ON                       1
+#define MC_WRF_1stColRep6_OFF                      2
+#define MC_WRF_LastColRep6                       (MCPARAMID)( 4813 << 14)
+#define MC_WRF_LastColRep6_ON                      1
+#define MC_WRF_LastColRep6_OFF                     2
+#define MC_WRF_ColumnIx6                         (MCPARAMID)( 4814 << 14)
+#define MC_WRF_TOIwidth6                         (MCPARAMID)( 4815 << 14)
+#define MC_ColorRegistrationTOI6                 (MCPARAMID)( 4816 << 14)
+#define MC_WRF_Line16                            (MCPARAMID)( 4817 << 14)
+#define MC_WRF_Line16_GB                           1
+#define MC_WRF_Line16_BG                           2
+#define MC_WRF_Line16_RG                           3
+#define MC_WRF_Line16_GR                           4
+#define MC_WRF_XferSize06                        (MCPARAMID)( 4818 << 14)
+#define MC_WRF_XferSize16                        (MCPARAMID)( 4819 << 14)
+#define MC_WRF_XferSize26                        (MCPARAMID)( 4820 << 14)
+#define MC_WRF_XferSize36                        (MCPARAMID)( 4821 << 14)
+#define MC_WRF_TOIheight6                        (MCPARAMID)( 4822 << 14)
+#define MC_WRF_LastTOI6                          (MCPARAMID)( 4823 << 14)
+#define MC_WRF_LastTOI6_TRUE                       1
+#define MC_WRF_LastTOI6_FALSE                      2
+#define MC_WRF_TOIoffset6                        (MCPARAMID)( 4824 << 14)
+#define MC_WRF_TOIPitch6                         (MCPARAMID)( 4825 << 14)
+#define MC_WRF_NbOfLine6                         (MCPARAMID)( 4826 << 14)
+#define MC_WRF_1stLineRep7                       (MCPARAMID)( 4827 << 14)
+#define MC_WRF_1stLineRep7_ON                      1
+#define MC_WRF_1stLineRep7_OFF                     2
+#define MC_WRF_LastLineRep7                      (MCPARAMID)( 4828 << 14)
+#define MC_WRF_LastLineRep7_ON                     1
+#define MC_WRF_LastLineRep7_OFF                    2
+#define MC_WRF_1stColRep7                        (MCPARAMID)( 4829 << 14)
+#define MC_WRF_1stColRep7_ON                       1
+#define MC_WRF_1stColRep7_OFF                      2
+#define MC_WRF_LastColRep7                       (MCPARAMID)( 4830 << 14)
+#define MC_WRF_LastColRep7_ON                      1
+#define MC_WRF_LastColRep7_OFF                     2
+#define MC_WRF_ColumnIx7                         (MCPARAMID)( 4831 << 14)
+#define MC_WRF_TOIwidth7                         (MCPARAMID)( 4832 << 14)
+#define MC_ColorRegistrationTOI7                 (MCPARAMID)( 4833 << 14)
+#define MC_WRF_Line17                            (MCPARAMID)( 4834 << 14)
+#define MC_WRF_Line17_GB                           1
+#define MC_WRF_Line17_BG                           2
+#define MC_WRF_Line17_RG                           3
+#define MC_WRF_Line17_GR                           4
+#define MC_WRF_XferSize07                        (MCPARAMID)( 4835 << 14)
+#define MC_WRF_XferSize17                        (MCPARAMID)( 4836 << 14)
+#define MC_WRF_XferSize27                        (MCPARAMID)( 4837 << 14)
+#define MC_WRF_XferSize37                        (MCPARAMID)( 4838 << 14)
+#define MC_WRF_TOIheight7                        (MCPARAMID)( 4839 << 14)
+#define MC_WRF_LastTOI7                          (MCPARAMID)( 4840 << 14)
+#define MC_WRF_LastTOI7_TRUE                       1
+#define MC_WRF_LastTOI7_FALSE                      2
+#define MC_WRF_TOIoffset7                        (MCPARAMID)( 4841 << 14)
+#define MC_WRF_TOIPitch7                         (MCPARAMID)( 4842 << 14)
+#define MC_WRF_NbOfLine7                         (MCPARAMID)( 4843 << 14)
+#define MC_WRF_XferSizeM100                      (MCPARAMID)( 4844 << 14)
+#define MC_WRF_XferSizeM110                      (MCPARAMID)( 4845 << 14)
+#define MC_WRF_XferSizeM120                      (MCPARAMID)( 4846 << 14)
+#define MC_WRF_XferSizeM130                      (MCPARAMID)( 4847 << 14)
+#define MC_WRF_XferSizeM101                      (MCPARAMID)( 4848 << 14)
+#define MC_WRF_XferSizeM111                      (MCPARAMID)( 4849 << 14)
+#define MC_WRF_XferSizeM121                      (MCPARAMID)( 4850 << 14)
+#define MC_WRF_XferSizeM131                      (MCPARAMID)( 4851 << 14)
+#define MC_WRF_XferSizeM102                      (MCPARAMID)( 4852 << 14)
+#define MC_WRF_XferSizeM112                      (MCPARAMID)( 4853 << 14)
+#define MC_WRF_XferSizeM122                      (MCPARAMID)( 4854 << 14)
+#define MC_WRF_XferSizeM132                      (MCPARAMID)( 4855 << 14)
+#define MC_WRF_XferSizeM103                      (MCPARAMID)( 4856 << 14)
+#define MC_WRF_XferSizeM113                      (MCPARAMID)( 4857 << 14)
+#define MC_WRF_XferSizeM123                      (MCPARAMID)( 4858 << 14)
+#define MC_WRF_XferSizeM133                      (MCPARAMID)( 4859 << 14)
+#define MC_WRF_XferSizeM104                      (MCPARAMID)( 4860 << 14)
+#define MC_WRF_XferSizeM114                      (MCPARAMID)( 4861 << 14)
+#define MC_WRF_XferSizeM124                      (MCPARAMID)( 4862 << 14)
+#define MC_WRF_XferSizeM134                      (MCPARAMID)( 4863 << 14)
+#define MC_WRF_XferSizeM105                      (MCPARAMID)( 4864 << 14)
+#define MC_WRF_XferSizeM115                      (MCPARAMID)( 4865 << 14)
+#define MC_WRF_XferSizeM125                      (MCPARAMID)( 4866 << 14)
+#define MC_WRF_XferSizeM135                      (MCPARAMID)( 4867 << 14)
+#define MC_WRF_XferSizeM106                      (MCPARAMID)( 4868 << 14)
+#define MC_WRF_XferSizeM116                      (MCPARAMID)( 4869 << 14)
+#define MC_WRF_XferSizeM126                      (MCPARAMID)( 4870 << 14)
+#define MC_WRF_XferSizeM136                      (MCPARAMID)( 4871 << 14)
+#define MC_WRF_XferSizeM107                      (MCPARAMID)( 4872 << 14)
+#define MC_WRF_XferSizeM117                      (MCPARAMID)( 4873 << 14)
+#define MC_WRF_XferSizeM127                      (MCPARAMID)( 4874 << 14)
+#define MC_WRF_XferSizeM137                      (MCPARAMID)( 4875 << 14)
+#define MC_SurfacePlaneName                      (MCPARAMID)( 4876 << 14)
+#define MC_SurfacePlaneName_UNUSED                 1
+#define MC_SurfacePlaneName_Y                      2
+#define MC_SurfacePlaneName_R                      3
+#define MC_SurfacePlaneName_G                      4
+#define MC_SurfacePlaneName_B                      5
+#define MC_SurfacePlaneName_RGB                    6
+#define MC_SurfacePlaneName_YRGB                   7
+#define MC_ColorRegistration_Filter              (MCPARAMID)( 4877 << 14)
+#define MC__ColorRegistration                    (MCPARAMID)( 4878 << 14)
+#define MC__ImageColorRegistration               (MCPARAMID)( 4879 << 14)
+#define MC__ColorRegistrationX                   (MCPARAMID)( 4880 << 14)
+#define MC__ColorRegistrationY                   (MCPARAMID)( 4881 << 14)
+#define MC__EnumParamName_                       (MCPARAMID)( 4882 << 14)
+#define MC__EnumParamName__GB                      1
+#define MC__EnumParamName__BG                      2
+#define MC__EnumParamName__RG                      3
+#define MC__EnumParamName__GR                      4
+#define MC__Filter_                              (MCPARAMID)( 4883 << 14)
+#define MC_GWColorRegistrationX                  (MCPARAMID)( 4884 << 14)
+#define MC_GWColorRegistrationY                  (MCPARAMID)( 4885 << 14)
+#define MC_ColorRegistration_TOI0X               (MCPARAMID)( 4886 << 14)
+#define MC_ColorRegistration_TOI0Y               (MCPARAMID)( 4887 << 14)
+#define MC_ColorRegistration_TOI1X               (MCPARAMID)( 4888 << 14)
+#define MC_ColorRegistration_TOI1Y               (MCPARAMID)( 4889 << 14)
+#define MC_ColorRegistration_TOI2X               (MCPARAMID)( 4890 << 14)
+#define MC_ColorRegistration_TOI2Y               (MCPARAMID)( 4891 << 14)
+#define MC_ColorRegistration_TOI3X               (MCPARAMID)( 4892 << 14)
+#define MC_ColorRegistration_TOI3Y               (MCPARAMID)( 4893 << 14)
+#define MC_ColorRegistration_TOI4X               (MCPARAMID)( 4894 << 14)
+#define MC_ColorRegistration_TOI4Y               (MCPARAMID)( 4895 << 14)
+#define MC_ColorRegistration_TOI5X               (MCPARAMID)( 4896 << 14)
+#define MC_ColorRegistration_TOI5Y               (MCPARAMID)( 4897 << 14)
+#define MC_ColorRegistration_TOI6X               (MCPARAMID)( 4898 << 14)
+#define MC_ColorRegistration_TOI6Y               (MCPARAMID)( 4899 << 14)
+#define MC_ColorRegistration_TOI7X               (MCPARAMID)( 4900 << 14)
+#define MC_ColorRegistration_TOI7Y               (MCPARAMID)( 4901 << 14)
+#define MC__ImageColorRegistrationX              (MCPARAMID)( 4902 << 14)
+#define MC__ImageColorRegistrationY              (MCPARAMID)( 4903 << 14)
+#define MC_ColorRegistrationX_TOI0               (MCPARAMID)( 4904 << 14)
+#define MC_ColorRegistrationY_TOI0               (MCPARAMID)( 4905 << 14)
+#define MC_ColorRegistrationX_TOI1               (MCPARAMID)( 4906 << 14)
+#define MC_ColorRegistrationY_TOI1               (MCPARAMID)( 4907 << 14)
+#define MC_ColorRegistrationX_TOI2               (MCPARAMID)( 4908 << 14)
+#define MC_ColorRegistrationY_TOI2               (MCPARAMID)( 4909 << 14)
+#define MC_ColorRegistrationX_TOI3               (MCPARAMID)( 4910 << 14)
+#define MC_ColorRegistrationY_TOI3               (MCPARAMID)( 4911 << 14)
+#define MC_ColorRegistrationX_TOI4               (MCPARAMID)( 4912 << 14)
+#define MC_ColorRegistrationY_TOI4               (MCPARAMID)( 4913 << 14)
+#define MC_ColorRegistrationX_TOI5               (MCPARAMID)( 4914 << 14)
+#define MC_ColorRegistrationY_TOI5               (MCPARAMID)( 4915 << 14)
+#define MC_ColorRegistrationX_TOI6               (MCPARAMID)( 4916 << 14)
+#define MC_ColorRegistrationY_TOI6               (MCPARAMID)( 4917 << 14)
+#define MC_ColorRegistrationX_TOI7               (MCPARAMID)( 4918 << 14)
+#define MC_ColorRegistrationY_TOI7               (MCPARAMID)( 4919 << 14)
+#define MC_FSS_FBSIZE                            (MCPARAMID)( 4920 << 14)
+#define MC_RightToiColumnFlag                    (MCPARAMID)( 4921 << 14)
+#define MC_RightToiColumnFlag_FALSE                1
+#define MC_RightToiColumnFlag_TRUE                 2
+#define MC_TOI_FSR_RightX                        (MCPARAMID)( 4922 << 14)
+#define MC_CPC_PPSB_DataTyp_PASSTHROUGH            7
+#define MC_Sampling                              (MCPARAMID)( 4923 << 14)
+#define MC_Sampling_SQUARE                         1
+#define MC_Sampling_BROADCAST                      2
+#define MC_Broadcast                             (MCPARAMID)( 4924 << 14)
+#define MC__IScale1000                           (MCPARAMID)( 4925 << 14)
+#define MC__XScale65536                          (MCPARAMID)( 4926 << 14)
+#define MC__XScale_Float                         (MCPARAMID)( 4927 << 14)
+#define MC__XScale_10000                         (MCPARAMID)( 4928 << 14)
+#define MC_StrobeCtl_SSRLY                         8
+#define MC_StrobeLine_OUT1                        19
+#define MC_StrobeLine_OUT2                        20
+#define MC_StrobeLine_OUT3                        21
+#define MC_StrobeLine_OUT4                        22
+#define MC__StrobeRate                           (MCPARAMID)( 4929 << 14)
+#define MC__StrobeRate_ANYFIELD                    1
+#define MC__StrobeRate_UPFIELD                     2
+#define MC__StrobeRate_DWFIELD                     3
+#define MC__STROBEDur_Filt                       (MCPARAMID)( 4930 << 14)
+#define MC__STROBEPos_Filt                       (MCPARAMID)( 4931 << 14)
+#define MC__STROBEAcc                            (MCPARAMID)( 4932 << 14)
+#define MC__STROBEGenOperating_                  (MCPARAMID)( 4933 << 14)
+#define MC__STROBEGenOperating__NORM               1
+#define MC__STROBEGenOperating__INVER              2
+#define MC__ST_EventGate                         (MCPARAMID)( 4934 << 14)
+#define MC__ST_EventGate_OFF                       1
+#define MC__ST_EventGate_EVENT1                    2
+#define MC__ST_EventGate_EVENT2                    3
+#define MC__ST_ParityGate                        (MCPARAMID)( 4935 << 14)
+#define MC__ST_ParityGate_ANY                      1
+#define MC__ST_ParityGate_UP                       2
+#define MC__ST_ParityGate_DOWN                     3
+#define MC__VField_Ln                            (MCPARAMID)( 4936 << 14)
+#define MC__ST_Time1_Ln                          (MCPARAMID)( 4937 << 14)
+#define MC_AccumulationMode                      (MCPARAMID)( 4938 << 14)
+#define MC_AccumulationMode_FLD                    1
+#define MC_AccumulationMode_FRAME                  2
+#define MC__ST_Time2_Ln                          (MCPARAMID)( 4939 << 14)
+#define MC_SEC_ST_EventGate                      (MCPARAMID)( 4940 << 14)
+#define MC_SEC_ST_ParityGate                     (MCPARAMID)( 4941 << 14)
+#define MC_SEC_ST_Time1                          (MCPARAMID)( 4942 << 14)
+#define MC_SEC_ST_Time2                          (MCPARAMID)( 4943 << 14)
+#define MC_BEC_SrcCAPM_CUpDown                     5
+#define MC_BEC_SrcCAPM_CDownUp                     6
+#define MC_FEC_CAPM_CUpDown                        5
+#define MC_FEC_CAPM_CDownUp                        6
+#define MC_TrigLine_I1                            23
+#define MC_TrigLine_I2                            24
+#define MC_TrigLine_I3                            25
+#define MC_TrigLine_I4                            26
+#define MC_EndTrigLine_I1                         19
+#define MC_EndTrigLine_I2                         20
+#define MC_EndTrigLine_I3                         21
+#define MC_EndTrigLine_I4                         22
+#define MC__InitTrigMode                         (MCPARAMID)( 4944 << 14)
+#define MC__InitTrigMode_SELFTRIG                  1
+#define MC__InitTrigMode_SOFTTRIG                  2
+#define MC__InitTrigMode_HARDTRIG                  3
+#define MC__InitTrigMode_COMBTRIG                  4
+#define MC__NextTrigMode_SELFTRIG                  5
+#define MC__NextTrigMode_SOFTTRIG                  6
+#define MC__NextTrigMode_HARDTRIG                  7
+#define MC__NextTrigMode_COMBTRIG                  8
+#define MC__HardTrigEvent                        (MCPARAMID)( 4945 << 14)
+#define MC__HardTrigEvent_GOHIGH                   1
+#define MC__HardTrigEvent_GOLOW                    2
+#define MC__HardTrigEvent_GOOPEN                   3
+#define MC__HardEndTrigEvent                     (MCPARAMID)( 4946 << 14)
+#define MC__HardEndTrigEvent_DISABLED              1
+#define MC__HardEndTrigEvent_GOHIGH                2
+#define MC__HardEndTrigEvent_GOLOW                 3
+#define MC__HardEndTrigEvent_GOOPEN                4
+#define MC__IO_Mask                              (MCPARAMID)( 4947 << 14)
+#define MC__IO_Mask_BLOCKING                       1
+#define MC__IO_Mask_NONBLOCKING                    2
+#define MC__TrigDelay_Fld                        (MCPARAMID)( 4948 << 14)
+#define MC__TrigLineUsed                         (MCPARAMID)( 4949 << 14)
+#define MC__TrigLineUsed_TRUE                      1
+#define MC__TrigLineUsed_FALSE                     2
+#define MC__EndTrigLineUsed                      (MCPARAMID)( 4950 << 14)
+#define MC__EndTrigLineUsed_TRUE                   1
+#define MC__EndTrigLineUsed_FALSE                  2
+#define MC__TrigDelayMin_us                      (MCPARAMID)( 4951 << 14)
+#define MC__TrigDelayMAX_us                      (MCPARAMID)( 4952 << 14)
+#define MC__FieldLength_us                       (MCPARAMID)( 4953 << 14)
+#define MC_TEC_SoftTrig                          (MCPARAMID)( 4954 << 14)
+#define MC_TEC_InitTrigMode                      (MCPARAMID)( 4955 << 14)
+#define MC_TEC_NextTrigMode                      (MCPARAMID)( 4956 << 14)
+#define MC_TEC_HardTrigEvent                     (MCPARAMID)( 4957 << 14)
+#define MC_TEC_HardEndTrigEvent                  (MCPARAMID)( 4958 << 14)
+#define MC_TEC_IO_Mask                           (MCPARAMID)( 4959 << 14)
+#define MC_TEC_TrigDelay_Fld                     (MCPARAMID)( 4960 << 14)
+#define MC__IO_LineReserved                      (MCPARAMID)( 4961 << 14)
+#define MC__IO_LineReserved_BLOCKING               1
+#define MC__IO_LineReserved_NONBLOCKING            2
+#define MC_TEC_IOLineReserved                    (MCPARAMID)( 4962 << 14)
+#define MC__IO_LineReserved_RESERVED               3
+#define MC__IO_LineReserved_NONRESERVED            4
+#define MC_StrobeLevel_CLOSED                      5
+#define MC_StrobeField                           (MCPARAMID)( 4963 << 14)
+#define MC_StrobeField_BOTH                        1
+#define MC_StrobeField_UP                          2
+#define MC_StrobeField_DW                          3
+#define MC_StrobeLine_NONE                        23
+#define MC_TrigLine_NONE                          27
+#define MC__ST_NPC_Time1_Ln                      (MCPARAMID)( 4964 << 14)
+#define MC__ST_NPC_Time2_Ln                      (MCPARAMID)( 4965 << 14)
+#define MC__NoPollingCover_Ln                    (MCPARAMID)( 4966 << 14)
+#define MC_SEC_ST_NPC_Time1                      (MCPARAMID)( 4967 << 14)
+#define MC_SEC_ST_NPC_Time2                      (MCPARAMID)( 4968 << 14)
+#define MC_LUT_Method                            (MCPARAMID)( 4969 << 14)
+#define MC_LUT_Method_RESPONSE_CONTROL             1
+#define MC_LUT_Method_EMPHASIS                     2
+#define MC_LUT_Method_THRESHOLD                    3
+#define MC_LUT_Method_TABLE                        4
+#define MC_LUT_Method_COLORSCAN                    5
+#define MC_LUT_Emphasis                          (MCPARAMID)( 4970 << 14)
+#define MC_LUT_SlicingLevel                      (MCPARAMID)( 4971 << 14)
+#define MC_LUT_SlicingBand                       (MCPARAMID)( 4972 << 14)
+#define MC_LUT_LightResponse                     (MCPARAMID)( 4973 << 14)
+#define MC_LUT_BandResponse                      (MCPARAMID)( 4974 << 14)
+#define MC_LUT_DarkResponse                      (MCPARAMID)( 4975 << 14)
+#define MC_TrigLineIndex_I1                        1
+#define MC_TrigLineIndex_I2                        2
+#define MC_TrigLineIndex_I3                        3
+#define MC_TrigLineIndex_I4                        4
+#define MC_TrigLineIndex_NONE                      5
+#define MC_EndTrigLineIndex_I1                     1
+#define MC_EndTrigLineIndex_I2                     2
+#define MC_EndTrigLineIndex_I3                     3
+#define MC_EndTrigLineIndex_I4                     4
+#define MC_EndTrigLineIndex_NONE                   5
+#define MC__IO_LineReservedForTrigger            (MCPARAMID)( 4976 << 14)
+#define MC__IO_LineReservedForTrigger_RESERVED     1
+#define MC__IO_LineReservedForTrigger_NONRESERVED   2
+#define MC_TEC_IOLineReservedForTrigger          (MCPARAMID)( 4977 << 14)
+#define MC_OldStandardFrameRate_Hz               (MCPARAMID)( 4978 << 14)
+#define MC_StandardFramesPerSecond_Int           (MCPARAMID)( 4979 << 14)
+#define MC__IsUpEnoughForGrabFieldFld            (MCPARAMID)( 4980 << 14)
+#define MC__IsUpEnoughForGrabFieldFld_YES          1
+#define MC__IsUpEnoughForGrabFieldFld_NO           2
+#define MC_CaptureRateDefault                    (MCPARAMID)( 4981 << 14)
+#define MC_WBC_MODE                              (MCPARAMID)( 4982 << 14)
+#define MC_WBC_MODE_NONE                           1
+#define MC_WBC_MODE_MANUAL                         2
+#define MC_WBC_MODE_ONCE                           3
+#define MC_WBC_MODE_CONTINUOUS                     4
+#define MC_WBC_HIGH_THRESHOLD                    (MCPARAMID)( 4983 << 14)
+#define MC_WBC_ERROR_THRESHOLD                   (MCPARAMID)( 4984 << 14)
+#define MC_MPC_MIN_PIXEL_COUNT                   (MCPARAMID)( 4985 << 14)
+#define MC_WBC_F                                 (MCPARAMID)( 4986 << 14)
+#define MC_WBC_F_OFF                               1
+#define MC_WBC_F_ON                                2
+#define MC__Category_CFA_AWB                      54
+#define MC__Category_CFA_AWB_Local                55
+#define MC__Category_CFA_AWB_LowLevel             56
+#define MC__Category_CFA_WhiteBalanceOperator     57
+#define MC__Category_CFA_WhiteBalanceOperator_Local  58
+#define MC__Category_CFA_WhiteBalanceOperator_LowLevel  59
+#define MC_ROIName_TOI_USR_CountX_Min            (MCPARAMID)( 4987 << 14)
+#define MC_ROIName_TOI_USR_CountX                (MCPARAMID)( 4988 << 14)
+#define MC_ROIName_TOI_USR_CountY                (MCPARAMID)( 4989 << 14)
+#define MC_ROIName_TOI_USR_Count                 (MCPARAMID)( 4990 << 14)
+#define MC_ROIName_TOI_USR_LastIndex             (MCPARAMID)( 4991 << 14)
+#define MC_ROIName_TOI_USR_Width                 (MCPARAMID)( 4992 << 14)
+#define MC_ROIName_TOI_USR_Height                (MCPARAMID)( 4993 << 14)
+#define MC_ROIName_TOI_USR_HeightLastRow         (MCPARAMID)( 4994 << 14)
+#define MC_ROIName_TOI_USR_FirstTOILastRowIndex  (MCPARAMID)( 4995 << 14)
+#define MC_ROIName_TOI_USR_Width_Px              (MCPARAMID)( 4996 << 14)
+#define MC_ROIName_TOI_USR_Height_Ln             (MCPARAMID)( 4997 << 14)
+#define MC_ROIName_TOI_USR_OrgX_Px               (MCPARAMID)( 4998 << 14)
+#define MC_ROIName_TOI_USR_OrgY_Ln               (MCPARAMID)( 4999 << 14)
+#define MC_XFR_TOI_USR_CountX_Min                (MCPARAMID)( 5000 << 14)
+#define MC_XFR_TOI_USR_CountX                    (MCPARAMID)( 5001 << 14)
+#define MC_XFR_TOI_USR_CountY                    (MCPARAMID)( 5002 << 14)
+#define MC_XFR_TOI_USR_Count                     (MCPARAMID)( 5003 << 14)
+#define MC_XFR_TOI_USR_LastIndex                 (MCPARAMID)( 5004 << 14)
+#define MC_XFR_TOI_USR_Width                     (MCPARAMID)( 5005 << 14)
+#define MC_XFR_TOI_USR_Height                    (MCPARAMID)( 5006 << 14)
+#define MC_XFR_TOI_USR_HeightLastRow             (MCPARAMID)( 5007 << 14)
+#define MC_XFR_TOI_USR_FirstTOILastRowIndex      (MCPARAMID)( 5008 << 14)
+#define MC_XFR_TOI_USR_Width_Px                  (MCPARAMID)( 5009 << 14)
+#define MC_XFR_TOI_USR_Height_Ln                 (MCPARAMID)( 5010 << 14)
+#define MC_XFR_TOI_USR_OrgX_Px                   (MCPARAMID)( 5011 << 14)
+#define MC_XFR_TOI_USR_OrgY_Ln                   (MCPARAMID)( 5012 << 14)
+#define MC_XFR_TOI_XFR_OrgX_Px                   (MCPARAMID)( 5013 << 14)
+#define MC_XFRTOI_XFR_OrgX_Px                    (MCPARAMID)( 5014 << 14)
+#define MC_XFRTOI_XFR_RightX_Px                  (MCPARAMID)( 5015 << 14)
+#define MC_XFRTOI_XFR_Width_Px                   (MCPARAMID)( 5016 << 14)
+#define MC_XFRTOI_XFR_OrgY_Ln                    (MCPARAMID)( 5017 << 14)
+#define MC_XFRTOI_XFR_BotY_Ln                    (MCPARAMID)( 5018 << 14)
+#define MC_XFRTOI_XFR_Height_Ln                  (MCPARAMID)( 5019 << 14)
+#define MC_XFRTOI_DMA_FifoSizeX_Px               (MCPARAMID)( 5020 << 14)
+#define MC_XFRTOI_DMA_FifoOffsetX_Px             (MCPARAMID)( 5021 << 14)
+#define MC_XFRTOI_DMA_BufferOffsetX_Px           (MCPARAMID)( 5022 << 14)
+#define MC_XFRTOI_DMA_FifoSizeY_Ln               (MCPARAMID)( 5023 << 14)
+#define MC_XFRTOI_DMA_FifoOffsetY_Ln             (MCPARAMID)( 5024 << 14)
+#define MC_XFRTOI_DMA_BufferOffsetY_Ln           (MCPARAMID)( 5025 << 14)
+#define MC_XFR_TOI_XFR_RightX_Px                 (MCPARAMID)( 5026 << 14)
+#define MC_XFR_TOI_XFR_Width_Px                  (MCPARAMID)( 5027 << 14)
+#define MC_XFR_TOI_XFR_OrgY_Ln                   (MCPARAMID)( 5028 << 14)
+#define MC_XFR_TOI_XFR_BotY_Ln                   (MCPARAMID)( 5029 << 14)
+#define MC_XFR_TOI_XFR_Height_Ln                 (MCPARAMID)( 5030 << 14)
+#define MC_XFR_TOI_DMA_FifoSizeX_Px              (MCPARAMID)( 5031 << 14)
+#define MC_XFR_TOI_DMA_FifoOffsetX_Px            (MCPARAMID)( 5032 << 14)
+#define MC_XFR_TOI_DMA_BufferOffsetX_Px          (MCPARAMID)( 5033 << 14)
+#define MC_XFR_TOI_DMA_FifoSizeY_Ln              (MCPARAMID)( 5034 << 14)
+#define MC_XFR_TOI_DMA_FifoOffsetY_Ln            (MCPARAMID)( 5035 << 14)
+#define MC_XFR_TOI_DMA_BufferOffsetY_Ln          (MCPARAMID)( 5036 << 14)
+#define MC_XFR__TOI_XFR_OrgX_Px                  (MCPARAMID)( 5037 << 14)
+#define MC_XFR_TOI_REF_OrgX_Px                   (MCPARAMID)( 5038 << 14)
+#define MC_XFR_TOI_REF_OrgY_Ln                   (MCPARAMID)( 5039 << 14)
+#define MC_XFR_TOI_REF_Width_Px                  (MCPARAMID)( 5040 << 14)
+#define MC_XFR_TOI_REF_Height_Ln                 (MCPARAMID)( 5041 << 14)
+#define MC_XFR_TOI_EXT_OrgX_Px                   (MCPARAMID)( 5042 << 14)
+#define MC_XFR_TOI_EXT_OrgY_Ln                   (MCPARAMID)( 5043 << 14)
+#define MC_XFR_TOI_EXT_Width_Px                  (MCPARAMID)( 5044 << 14)
+#define MC_XFR_TOI_EXT_Height_Ln                 (MCPARAMID)( 5045 << 14)
+#define MC_XFR_TOI_EXT_Right_Px                  (MCPARAMID)( 5046 << 14)
+#define MC_XFR_TOI_EXT_Bot_Ln                    (MCPARAMID)( 5047 << 14)
+#define MC_XFR_TOI_FSR_OrgX                      (MCPARAMID)( 5048 << 14)
+#define MC_XFR_TOI_FSR_RightX                    (MCPARAMID)( 5049 << 14)
+#define MC_XFR_TOI_FSR_Width                     (MCPARAMID)( 5050 << 14)
+#define MC_XFR_TOI_FSR_OrgY_Ln                   (MCPARAMID)( 5051 << 14)
+#define MC_XFR_TOI_FSR_Height_Ln                 (MCPARAMID)( 5052 << 14)
+#define MC_XFR_TOI_FSR_OrgX_Px                   (MCPARAMID)( 5053 << 14)
+#define MC_FifoSizeX0_Private                    (MCPARAMID)( 5054 << 14)
+#define MC_XFR_FifoSizeX0                        (MCPARAMID)( 5055 << 14)
+#define MC_XFR_FifoSizeX1                        (MCPARAMID)( 5056 << 14)
+#define MC_XFR_FifoSizeX2                        (MCPARAMID)( 5057 << 14)
+#define MC_XFR_FifoSizeX3                        (MCPARAMID)( 5058 << 14)
+#define MC_XferSizeX0_Private                    (MCPARAMID)( 5059 << 14)
+#define MC_XFR_XferSizeX0                        (MCPARAMID)( 5060 << 14)
+#define MC_XFR_XferSizeX1                        (MCPARAMID)( 5061 << 14)
+#define MC_XFR_XferSizeX2                        (MCPARAMID)( 5062 << 14)
+#define MC_XFR_XferSizeX3                        (MCPARAMID)( 5063 << 14)
+#define MC_XFR_FifoOffsetX0                      (MCPARAMID)( 5064 << 14)
+#define MC_XFR_FifoOffsetX1                      (MCPARAMID)( 5065 << 14)
+#define MC_XFR_FifoOffsetX2                      (MCPARAMID)( 5066 << 14)
+#define MC_XFR_FifoOffsetX3                      (MCPARAMID)( 5067 << 14)
+#define MC_XFR_BufferOffsetX0                    (MCPARAMID)( 5068 << 14)
+#define MC_XFR_BufferOffsetX1                    (MCPARAMID)( 5069 << 14)
+#define MC_XFR_BufferOffsetX2                    (MCPARAMID)( 5070 << 14)
+#define MC_XFR_BufferOffsetX3                    (MCPARAMID)( 5071 << 14)
+#define MC_FifoSizeY0_Private                    (MCPARAMID)( 5072 << 14)
+#define MC_XFR_FifoSizeY0                        (MCPARAMID)( 5073 << 14)
+#define MC_XFR_XferSizeY0                        (MCPARAMID)( 5074 << 14)
+#define MC_XFR_FifoOffsetY0                      (MCPARAMID)( 5075 << 14)
+#define MC_XFR_BufferOffsetY0                    (MCPARAMID)( 5076 << 14)
+#define MC_XF_ROI_TOI_USR_CountX_Min             (MCPARAMID)( 5077 << 14)
+#define MC_XF_ROI_TOI_USR_CountX                 (MCPARAMID)( 5078 << 14)
+#define MC_XF_ROI_TOI_USR_CountY                 (MCPARAMID)( 5079 << 14)
+#define MC_XF_ROI_TOI_USR_Count                  (MCPARAMID)( 5080 << 14)
+#define MC_XF_ROI_TOI_USR_LastIndex              (MCPARAMID)( 5081 << 14)
+#define MC_XF_ROI_TOI_USR_Width                  (MCPARAMID)( 5082 << 14)
+#define MC_XF_ROI_TOI_USR_Height                 (MCPARAMID)( 5083 << 14)
+#define MC_XF_ROI_TOI_USR_HeightLastRow          (MCPARAMID)( 5084 << 14)
+#define MC_XF_ROI_TOI_USR_FirstTOILastRowIndex   (MCPARAMID)( 5085 << 14)
+#define MC_XF_ROI_TOI_USR_Width_Px               (MCPARAMID)( 5086 << 14)
+#define MC_XF_ROI_TOI_USR_Height_Ln              (MCPARAMID)( 5087 << 14)
+#define MC_XF_ROI_TOI_USR_OrgX_Px                (MCPARAMID)( 5088 << 14)
+#define MC_XF_ROI_TOI_USR_OrgY_Ln                (MCPARAMID)( 5089 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgX_Px                (MCPARAMID)( 5090 << 14)
+#define MC_XF_ROI_TOI_XFR_RightX_Px              (MCPARAMID)( 5091 << 14)
+#define MC_XF_ROI_TOI_XFR_Width_Px               (MCPARAMID)( 5092 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgY_Ln                (MCPARAMID)( 5093 << 14)
+#define MC_XF_ROI_TOI_XFR_BotY_Ln                (MCPARAMID)( 5094 << 14)
+#define MC_XF_ROI_TOI_XFR_Height_Ln              (MCPARAMID)( 5095 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeX_Px           (MCPARAMID)( 5096 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetX_Px         (MCPARAMID)( 5097 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetX_Px       (MCPARAMID)( 5098 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeY_Ln           (MCPARAMID)( 5099 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetY_Ln         (MCPARAMID)( 5100 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetY_Ln       (MCPARAMID)( 5101 << 14)
+#define MC_XF_ROI_TOI_REF_OrgX_Px                (MCPARAMID)( 5102 << 14)
+#define MC_XF_ROI_TOI_REF_OrgY_Ln                (MCPARAMID)( 5103 << 14)
+#define MC_XF_ROI_TOI_REF_Width_Px               (MCPARAMID)( 5104 << 14)
+#define MC_XF_ROI_TOI_REF_Height_Ln              (MCPARAMID)( 5105 << 14)
+#define MC_XF_ROI_TOI_EXT_OrgX_Px                (MCPARAMID)( 5106 << 14)
+#define MC_XF_ROI_TOI_EXT_OrgY_Ln                (MCPARAMID)( 5107 << 14)
+#define MC_XF_ROI_TOI_EXT_Width_Px               (MCPARAMID)( 5108 << 14)
+#define MC_XF_ROI_TOI_EXT_Height_Ln              (MCPARAMID)( 5109 << 14)
+#define MC_XF_ROI_TOI_EXT_Right_Px               (MCPARAMID)( 5110 << 14)
+#define MC_XF_ROI_TOI_EXT_Bot_Ln                 (MCPARAMID)( 5111 << 14)
+#define MC_XF_ROI_TOI_FSR_OrgX                   (MCPARAMID)( 5112 << 14)
+#define MC_XF_ROI_TOI_FSR_RightX                 (MCPARAMID)( 5113 << 14)
+#define MC_XF_ROI_TOI_FSR_Width                  (MCPARAMID)( 5114 << 14)
+#define MC_XF_ROI_TOI_FSR_OrgY_Ln                (MCPARAMID)( 5115 << 14)
+#define MC_XF_ROI_TOI_FSR_Height_Ln              (MCPARAMID)( 5116 << 14)
+#define MC_XF_ROI_TOI_FSR_OrgX_Px                (MCPARAMID)( 5117 << 14)
+#define MC_AWB_ROI_TOI_USR_CountX_Min            (MCPARAMID)( 5118 << 14)
+#define MC_AWB_ROI_TOI_USR_CountX                (MCPARAMID)( 5119 << 14)
+#define MC_AWB_ROI_TOI_USR_CountY                (MCPARAMID)( 5120 << 14)
+#define MC_AWB_ROI_TOI_USR_Count                 (MCPARAMID)( 5121 << 14)
+#define MC_AWB_ROI_TOI_USR_LastIndex             (MCPARAMID)( 5122 << 14)
+#define MC_AWB_ROI_TOI_USR_Width                 (MCPARAMID)( 5123 << 14)
+#define MC_AWB_ROI_TOI_USR_Height                (MCPARAMID)( 5124 << 14)
+#define MC_AWB_ROI_TOI_USR_HeightLastRow         (MCPARAMID)( 5125 << 14)
+#define MC_AWB_ROI_TOI_USR_FirstTOILastRowIndex  (MCPARAMID)( 5126 << 14)
+#define MC_AWB_ROI_TOI_USR_Width_Px              (MCPARAMID)( 5127 << 14)
+#define MC_AWB_ROI_TOI_USR_Height_Ln             (MCPARAMID)( 5128 << 14)
+#define MC_AWB_ROI_TOI_USR_OrgX_Px               (MCPARAMID)( 5129 << 14)
+#define MC_XF_ROI_RightToiColumnFlag             (MCPARAMID)( 5130 << 14)
+#define MC_XF_ROI_RightToiColumnFlag_FALSE         1
+#define MC_XF_ROI_RightToiColumnFlag_TRUE          2
+#define MC_AWB_ROI_RightToiColumnFlag            (MCPARAMID)( 5131 << 14)
+#define MC_AWB_ROI_RightToiColumnFlag_FALSE        1
+#define MC_AWB_ROI_RightToiColumnFlag_TRUE         2
+#define MC_AWB_ROI_TOI_USR_OrgY_Ln               (MCPARAMID)( 5132 << 14)
+#define MC_AWB_ROI_TOI_XFR_OrgX_Px               (MCPARAMID)( 5133 << 14)
+#define MC_AWB_ROI_TOI_XFR_RightX_Px             (MCPARAMID)( 5134 << 14)
+#define MC_AWB_ROI_TOI_XFR_Width_Px              (MCPARAMID)( 5135 << 14)
+#define MC_AWB_ROI_TOI_XFR_OrgY_Ln               (MCPARAMID)( 5136 << 14)
+#define MC_AWB_ROI_TOI_XFR_BotY_Ln               (MCPARAMID)( 5137 << 14)
+#define MC_AWB_ROI_TOI_XFR_Height_Ln             (MCPARAMID)( 5138 << 14)
+#define MC_AWB_ROI_TOI_DMA_FifoSizeX_Px          (MCPARAMID)( 5139 << 14)
+#define MC_AWB_ROI_TOI_DMA_FifoOffsetX_Px        (MCPARAMID)( 5140 << 14)
+#define MC_AWB_ROI_TOI_DMA_BufferOffsetX_Px      (MCPARAMID)( 5141 << 14)
+#define MC_AWB_ROI_TOI_DMA_FifoSizeY_Ln          (MCPARAMID)( 5142 << 14)
+#define MC_AWB_ROI_TOI_DMA_FifoOffsetY_Ln        (MCPARAMID)( 5143 << 14)
+#define MC_AWB_ROI_TOI_DMA_BufferOffsetY_Ln      (MCPARAMID)( 5144 << 14)
+#define MC_AWB_ROI_TOI_REF_OrgX_Px               (MCPARAMID)( 5145 << 14)
+#define MC_AWB_ROI_TOI_REF_OrgY_Ln               (MCPARAMID)( 5146 << 14)
+#define MC_AWB_ROI_TOI_REF_Width_Px              (MCPARAMID)( 5147 << 14)
+#define MC_AWB_ROI_TOI_REF_Height_Ln             (MCPARAMID)( 5148 << 14)
+#define MC_AWB_ROI_TOI_EXT_OrgX_Px               (MCPARAMID)( 5149 << 14)
+#define MC_AWB_ROI_TOI_EXT_OrgY_Ln               (MCPARAMID)( 5150 << 14)
+#define MC_AWB_ROI_TOI_EXT_Width_Px              (MCPARAMID)( 5151 << 14)
+#define MC_AWB_ROI_TOI_EXT_Height_Ln             (MCPARAMID)( 5152 << 14)
+#define MC_AWB_ROI_TOI_EXT_Right_Px              (MCPARAMID)( 5153 << 14)
+#define MC_AWB_ROI_TOI_EXT_Bot_Ln                (MCPARAMID)( 5154 << 14)
+#define MC_AWB_ROI_TOI_FSR_OrgX                  (MCPARAMID)( 5155 << 14)
+#define MC_AWB_ROI_TOI_FSR_RightX                (MCPARAMID)( 5156 << 14)
+#define MC_AWB_ROI_TOI_FSR_Width                 (MCPARAMID)( 5157 << 14)
+#define MC_AWB_ROI_TOI_FSR_OrgY_Ln               (MCPARAMID)( 5158 << 14)
+#define MC_AWB_ROI_TOI_FSR_Height_Ln             (MCPARAMID)( 5159 << 14)
+#define MC_AWB_ROI_TOI_FSR_OrgX_Px               (MCPARAMID)( 5160 << 14)
+#define MC_XF_ROI_WRF_1stLineRep0                (MCPARAMID)( 5161 << 14)
+#define MC_XF_ROI_WRF_1stLineRep0_ON               1
+#define MC_XF_ROI_WRF_1stLineRep0_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep0               (MCPARAMID)( 5162 << 14)
+#define MC_XF_ROI_WRF_LastLineRep0_ON              1
+#define MC_XF_ROI_WRF_LastLineRep0_OFF             2
+#define MC_XF_ROI_WRF_1stColRep0                 (MCPARAMID)( 5163 << 14)
+#define MC_XF_ROI_WRF_1stColRep0_ON                1
+#define MC_XF_ROI_WRF_1stColRep0_OFF               2
+#define MC_XF_ROI_WRF_LastColRep0                (MCPARAMID)( 5164 << 14)
+#define MC_XF_ROI_WRF_LastColRep0_ON               1
+#define MC_XF_ROI_WRF_LastColRep0_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx0                  (MCPARAMID)( 5165 << 14)
+#define MC_XF_ROI_WRF_TOIwidth0                  (MCPARAMID)( 5166 << 14)
+#define MC_XF_ROI_WRF_Line10                     (MCPARAMID)( 5167 << 14)
+#define MC_XF_ROI_WRF_Line10_GB                    1
+#define MC_XF_ROI_WRF_Line10_BG                    2
+#define MC_XF_ROI_WRF_Line10_RG                    3
+#define MC_XF_ROI_WRF_Line10_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM100               (MCPARAMID)( 5168 << 14)
+#define MC_XF_ROI_WRF_XferSizeM110               (MCPARAMID)( 5169 << 14)
+#define MC_XF_ROI_WRF_XferSizeM120               (MCPARAMID)( 5170 << 14)
+#define MC_XF_ROI_WRF_XferSizeM130               (MCPARAMID)( 5171 << 14)
+#define MC_XF_ROI_WRF_TOIheight0                 (MCPARAMID)( 5172 << 14)
+#define MC_XF_ROI_WRF_LastTOI0                   (MCPARAMID)( 5173 << 14)
+#define MC_XF_ROI_WRF_LastTOI0_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI0_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset0                 (MCPARAMID)( 5174 << 14)
+#define MC_XF_ROI_WRF_TOIPitch0                  (MCPARAMID)( 5175 << 14)
+#define MC_XF_ROI_WRF_NbOfLine0                  (MCPARAMID)( 5176 << 14)
+#define MC_XF_ROI_WRF_1stLineRep1                (MCPARAMID)( 5177 << 14)
+#define MC_XF_ROI_WRF_1stLineRep1_ON               1
+#define MC_XF_ROI_WRF_1stLineRep1_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep1               (MCPARAMID)( 5178 << 14)
+#define MC_XF_ROI_WRF_LastLineRep1_ON              1
+#define MC_XF_ROI_WRF_LastLineRep1_OFF             2
+#define MC_XF_ROI_WRF_1stColRep1                 (MCPARAMID)( 5179 << 14)
+#define MC_XF_ROI_WRF_1stColRep1_ON                1
+#define MC_XF_ROI_WRF_1stColRep1_OFF               2
+#define MC_XF_ROI_WRF_LastColRep1                (MCPARAMID)( 5180 << 14)
+#define MC_XF_ROI_WRF_LastColRep1_ON               1
+#define MC_XF_ROI_WRF_LastColRep1_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx1                  (MCPARAMID)( 5181 << 14)
+#define MC_XF_ROI_WRF_TOIwidth1                  (MCPARAMID)( 5182 << 14)
+#define MC_XF_ROI_WRF_Line11                     (MCPARAMID)( 5183 << 14)
+#define MC_XF_ROI_WRF_Line11_GB                    1
+#define MC_XF_ROI_WRF_Line11_BG                    2
+#define MC_XF_ROI_WRF_Line11_RG                    3
+#define MC_XF_ROI_WRF_Line11_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM101               (MCPARAMID)( 5184 << 14)
+#define MC_XF_ROI_WRF_XferSizeM111               (MCPARAMID)( 5185 << 14)
+#define MC_XF_ROI_WRF_XferSizeM121               (MCPARAMID)( 5186 << 14)
+#define MC_XF_ROI_WRF_XferSizeM131               (MCPARAMID)( 5187 << 14)
+#define MC_XF_ROI_WRF_TOIheight1                 (MCPARAMID)( 5188 << 14)
+#define MC_XF_ROI_WRF_LastTOI1                   (MCPARAMID)( 5189 << 14)
+#define MC_XF_ROI_WRF_LastTOI1_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI1_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset1                 (MCPARAMID)( 5190 << 14)
+#define MC_XF_ROI_WRF_TOIPitch1                  (MCPARAMID)( 5191 << 14)
+#define MC_XF_ROI_WRF_NbOfLine1                  (MCPARAMID)( 5192 << 14)
+#define MC_XF_ROI_WRF_1stLineRep2                (MCPARAMID)( 5193 << 14)
+#define MC_XF_ROI_WRF_1stLineRep2_ON               1
+#define MC_XF_ROI_WRF_1stLineRep2_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep2               (MCPARAMID)( 5194 << 14)
+#define MC_XF_ROI_WRF_LastLineRep2_ON              1
+#define MC_XF_ROI_WRF_LastLineRep2_OFF             2
+#define MC_XF_ROI_WRF_1stColRep2                 (MCPARAMID)( 5195 << 14)
+#define MC_XF_ROI_WRF_1stColRep2_ON                1
+#define MC_XF_ROI_WRF_1stColRep2_OFF               2
+#define MC_XF_ROI_WRF_LastColRep2                (MCPARAMID)( 5196 << 14)
+#define MC_XF_ROI_WRF_LastColRep2_ON               1
+#define MC_XF_ROI_WRF_LastColRep2_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx2                  (MCPARAMID)( 5197 << 14)
+#define MC_XF_ROI_WRF_TOIwidth2                  (MCPARAMID)( 5198 << 14)
+#define MC_XF_ROI_WRF_Line12                     (MCPARAMID)( 5199 << 14)
+#define MC_XF_ROI_WRF_Line12_GB                    1
+#define MC_XF_ROI_WRF_Line12_BG                    2
+#define MC_XF_ROI_WRF_Line12_RG                    3
+#define MC_XF_ROI_WRF_Line12_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM102               (MCPARAMID)( 5200 << 14)
+#define MC_XF_ROI_WRF_XferSizeM112               (MCPARAMID)( 5201 << 14)
+#define MC_XF_ROI_WRF_XferSizeM122               (MCPARAMID)( 5202 << 14)
+#define MC_XF_ROI_WRF_XferSizeM132               (MCPARAMID)( 5203 << 14)
+#define MC_XF_ROI_WRF_TOIheight2                 (MCPARAMID)( 5204 << 14)
+#define MC_XF_ROI_WRF_LastTOI2                   (MCPARAMID)( 5205 << 14)
+#define MC_XF_ROI_WRF_LastTOI2_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI2_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset2                 (MCPARAMID)( 5206 << 14)
+#define MC_XF_ROI_WRF_TOIPitch2                  (MCPARAMID)( 5207 << 14)
+#define MC_XF_ROI_WRF_NbOfLine2                  (MCPARAMID)( 5208 << 14)
+#define MC_XF_ROI_WRF_1stLineRep3                (MCPARAMID)( 5209 << 14)
+#define MC_XF_ROI_WRF_1stLineRep3_ON               1
+#define MC_XF_ROI_WRF_1stLineRep3_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep3               (MCPARAMID)( 5210 << 14)
+#define MC_XF_ROI_WRF_LastLineRep3_ON              1
+#define MC_XF_ROI_WRF_LastLineRep3_OFF             2
+#define MC_XF_ROI_WRF_1stColRep3                 (MCPARAMID)( 5211 << 14)
+#define MC_XF_ROI_WRF_1stColRep3_ON                1
+#define MC_XF_ROI_WRF_1stColRep3_OFF               2
+#define MC_XF_ROI_WRF_LastColRep3                (MCPARAMID)( 5212 << 14)
+#define MC_XF_ROI_WRF_LastColRep3_ON               1
+#define MC_XF_ROI_WRF_LastColRep3_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx3                  (MCPARAMID)( 5213 << 14)
+#define MC_XF_ROI_WRF_TOIwidth3                  (MCPARAMID)( 5214 << 14)
+#define MC_XF_ROI_WRF_Line13                     (MCPARAMID)( 5215 << 14)
+#define MC_XF_ROI_WRF_Line13_GB                    1
+#define MC_XF_ROI_WRF_Line13_BG                    2
+#define MC_XF_ROI_WRF_Line13_RG                    3
+#define MC_XF_ROI_WRF_Line13_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM103               (MCPARAMID)( 5216 << 14)
+#define MC_XF_ROI_WRF_XferSizeM113               (MCPARAMID)( 5217 << 14)
+#define MC_XF_ROI_WRF_XferSizeM123               (MCPARAMID)( 5218 << 14)
+#define MC_XF_ROI_WRF_XferSizeM133               (MCPARAMID)( 5219 << 14)
+#define MC_XF_ROI_WRF_TOIheight3                 (MCPARAMID)( 5220 << 14)
+#define MC_XF_ROI_WRF_LastTOI3                   (MCPARAMID)( 5221 << 14)
+#define MC_XF_ROI_WRF_LastTOI3_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI3_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset3                 (MCPARAMID)( 5222 << 14)
+#define MC_XF_ROI_WRF_TOIPitch3                  (MCPARAMID)( 5223 << 14)
+#define MC_XF_ROI_WRF_NbOfLine3                  (MCPARAMID)( 5224 << 14)
+#define MC_XF_ROI_WRF_1stLineRep4                (MCPARAMID)( 5225 << 14)
+#define MC_XF_ROI_WRF_1stLineRep4_ON               1
+#define MC_XF_ROI_WRF_1stLineRep4_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep4               (MCPARAMID)( 5226 << 14)
+#define MC_XF_ROI_WRF_LastLineRep4_ON              1
+#define MC_XF_ROI_WRF_LastLineRep4_OFF             2
+#define MC_XF_ROI_WRF_1stColRep4                 (MCPARAMID)( 5227 << 14)
+#define MC_XF_ROI_WRF_1stColRep4_ON                1
+#define MC_XF_ROI_WRF_1stColRep4_OFF               2
+#define MC_XF_ROI_WRF_LastColRep4                (MCPARAMID)( 5228 << 14)
+#define MC_XF_ROI_WRF_LastColRep4_ON               1
+#define MC_XF_ROI_WRF_LastColRep4_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx4                  (MCPARAMID)( 5229 << 14)
+#define MC_XF_ROI_WRF_TOIwidth4                  (MCPARAMID)( 5230 << 14)
+#define MC_XF_ROI_WRF_Line14                     (MCPARAMID)( 5231 << 14)
+#define MC_XF_ROI_WRF_Line14_GB                    1
+#define MC_XF_ROI_WRF_Line14_BG                    2
+#define MC_XF_ROI_WRF_Line14_RG                    3
+#define MC_XF_ROI_WRF_Line14_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM104               (MCPARAMID)( 5232 << 14)
+#define MC_XF_ROI_WRF_XferSizeM114               (MCPARAMID)( 5233 << 14)
+#define MC_XF_ROI_WRF_XferSizeM124               (MCPARAMID)( 5234 << 14)
+#define MC_XF_ROI_WRF_XferSizeM134               (MCPARAMID)( 5235 << 14)
+#define MC_XF_ROI_WRF_TOIheight4                 (MCPARAMID)( 5236 << 14)
+#define MC_XF_ROI_WRF_LastTOI4                   (MCPARAMID)( 5237 << 14)
+#define MC_XF_ROI_WRF_LastTOI4_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI4_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset4                 (MCPARAMID)( 5238 << 14)
+#define MC_XF_ROI_WRF_TOIPitch4                  (MCPARAMID)( 5239 << 14)
+#define MC_XF_ROI_WRF_NbOfLine4                  (MCPARAMID)( 5240 << 14)
+#define MC_XF_ROI_WRF_1stLineRep5                (MCPARAMID)( 5241 << 14)
+#define MC_XF_ROI_WRF_1stLineRep5_ON               1
+#define MC_XF_ROI_WRF_1stLineRep5_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep5               (MCPARAMID)( 5242 << 14)
+#define MC_XF_ROI_WRF_LastLineRep5_ON              1
+#define MC_XF_ROI_WRF_LastLineRep5_OFF             2
+#define MC_XF_ROI_WRF_1stColRep5                 (MCPARAMID)( 5243 << 14)
+#define MC_XF_ROI_WRF_1stColRep5_ON                1
+#define MC_XF_ROI_WRF_1stColRep5_OFF               2
+#define MC_XF_ROI_WRF_LastColRep5                (MCPARAMID)( 5244 << 14)
+#define MC_XF_ROI_WRF_LastColRep5_ON               1
+#define MC_XF_ROI_WRF_LastColRep5_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx5                  (MCPARAMID)( 5245 << 14)
+#define MC_XF_ROI_WRF_TOIwidth5                  (MCPARAMID)( 5246 << 14)
+#define MC_XF_ROI_WRF_Line15                     (MCPARAMID)( 5247 << 14)
+#define MC_XF_ROI_WRF_Line15_GB                    1
+#define MC_XF_ROI_WRF_Line15_BG                    2
+#define MC_XF_ROI_WRF_Line15_RG                    3
+#define MC_XF_ROI_WRF_Line15_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM105               (MCPARAMID)( 5248 << 14)
+#define MC_XF_ROI_WRF_XferSizeM115               (MCPARAMID)( 5249 << 14)
+#define MC_XF_ROI_WRF_XferSizeM125               (MCPARAMID)( 5250 << 14)
+#define MC_XF_ROI_WRF_XferSizeM135               (MCPARAMID)( 5251 << 14)
+#define MC_XF_ROI_WRF_TOIheight5                 (MCPARAMID)( 5252 << 14)
+#define MC_XF_ROI_WRF_LastTOI5                   (MCPARAMID)( 5253 << 14)
+#define MC_XF_ROI_WRF_LastTOI5_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI5_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset5                 (MCPARAMID)( 5254 << 14)
+#define MC_XF_ROI_WRF_TOIPitch5                  (MCPARAMID)( 5255 << 14)
+#define MC_XF_ROI_WRF_NbOfLine5                  (MCPARAMID)( 5256 << 14)
+#define MC_XF_ROI_WRF_1stLineRep6                (MCPARAMID)( 5257 << 14)
+#define MC_XF_ROI_WRF_1stLineRep6_ON               1
+#define MC_XF_ROI_WRF_1stLineRep6_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep6               (MCPARAMID)( 5258 << 14)
+#define MC_XF_ROI_WRF_LastLineRep6_ON              1
+#define MC_XF_ROI_WRF_LastLineRep6_OFF             2
+#define MC_XF_ROI_WRF_1stColRep6                 (MCPARAMID)( 5259 << 14)
+#define MC_XF_ROI_WRF_1stColRep6_ON                1
+#define MC_XF_ROI_WRF_1stColRep6_OFF               2
+#define MC_XF_ROI_WRF_LastColRep6                (MCPARAMID)( 5260 << 14)
+#define MC_XF_ROI_WRF_LastColRep6_ON               1
+#define MC_XF_ROI_WRF_LastColRep6_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx6                  (MCPARAMID)( 5261 << 14)
+#define MC_XF_ROI_WRF_TOIwidth6                  (MCPARAMID)( 5262 << 14)
+#define MC_XF_ROI_WRF_Line16                     (MCPARAMID)( 5263 << 14)
+#define MC_XF_ROI_WRF_Line16_GB                    1
+#define MC_XF_ROI_WRF_Line16_BG                    2
+#define MC_XF_ROI_WRF_Line16_RG                    3
+#define MC_XF_ROI_WRF_Line16_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM106               (MCPARAMID)( 5264 << 14)
+#define MC_XF_ROI_WRF_XferSizeM116               (MCPARAMID)( 5265 << 14)
+#define MC_XF_ROI_WRF_XferSizeM126               (MCPARAMID)( 5266 << 14)
+#define MC_XF_ROI_WRF_XferSizeM136               (MCPARAMID)( 5267 << 14)
+#define MC_XF_ROI_WRF_TOIheight6                 (MCPARAMID)( 5268 << 14)
+#define MC_XF_ROI_WRF_LastTOI6                   (MCPARAMID)( 5269 << 14)
+#define MC_XF_ROI_WRF_LastTOI6_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI6_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset6                 (MCPARAMID)( 5270 << 14)
+#define MC_XF_ROI_WRF_TOIPitch6                  (MCPARAMID)( 5271 << 14)
+#define MC_XF_ROI_WRF_NbOfLine6                  (MCPARAMID)( 5272 << 14)
+#define MC_XF_ROI_WRF_1stLineRep7                (MCPARAMID)( 5273 << 14)
+#define MC_XF_ROI_WRF_1stLineRep7_ON               1
+#define MC_XF_ROI_WRF_1stLineRep7_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep7               (MCPARAMID)( 5274 << 14)
+#define MC_XF_ROI_WRF_LastLineRep7_ON              1
+#define MC_XF_ROI_WRF_LastLineRep7_OFF             2
+#define MC_XF_ROI_WRF_1stColRep7                 (MCPARAMID)( 5275 << 14)
+#define MC_XF_ROI_WRF_1stColRep7_ON                1
+#define MC_XF_ROI_WRF_1stColRep7_OFF               2
+#define MC_XF_ROI_WRF_LastColRep7                (MCPARAMID)( 5276 << 14)
+#define MC_XF_ROI_WRF_LastColRep7_ON               1
+#define MC_XF_ROI_WRF_LastColRep7_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx7                  (MCPARAMID)( 5277 << 14)
+#define MC_XF_ROI_WRF_TOIwidth7                  (MCPARAMID)( 5278 << 14)
+#define MC_XF_ROI_WRF_Line17                     (MCPARAMID)( 5279 << 14)
+#define MC_XF_ROI_WRF_Line17_GB                    1
+#define MC_XF_ROI_WRF_Line17_BG                    2
+#define MC_XF_ROI_WRF_Line17_RG                    3
+#define MC_XF_ROI_WRF_Line17_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM107               (MCPARAMID)( 5280 << 14)
+#define MC_XF_ROI_WRF_XferSizeM117               (MCPARAMID)( 5281 << 14)
+#define MC_XF_ROI_WRF_XferSizeM127               (MCPARAMID)( 5282 << 14)
+#define MC_XF_ROI_WRF_XferSizeM137               (MCPARAMID)( 5283 << 14)
+#define MC_XF_ROI_WRF_TOIheight7                 (MCPARAMID)( 5284 << 14)
+#define MC_XF_ROI_WRF_LastTOI7                   (MCPARAMID)( 5285 << 14)
+#define MC_XF_ROI_WRF_LastTOI7_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI7_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset7                 (MCPARAMID)( 5286 << 14)
+#define MC_XF_ROI_WRF_TOIPitch7                  (MCPARAMID)( 5287 << 14)
+#define MC_XF_ROI_WRF_NbOfLine7                  (MCPARAMID)( 5288 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep0               (MCPARAMID)( 5289 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep0_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep0_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep0              (MCPARAMID)( 5290 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep0_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep0_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep0                (MCPARAMID)( 5291 << 14)
+#define MC_AWB_ROI_WRF_1stColRep0_ON               1
+#define MC_AWB_ROI_WRF_1stColRep0_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep0               (MCPARAMID)( 5292 << 14)
+#define MC_AWB_ROI_WRF_LastColRep0_ON              1
+#define MC_AWB_ROI_WRF_LastColRep0_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx0                 (MCPARAMID)( 5293 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth0                 (MCPARAMID)( 5294 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI0        (MCPARAMID)( 5295 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI0        (MCPARAMID)( 5296 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI1        (MCPARAMID)( 5297 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI1        (MCPARAMID)( 5298 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI2        (MCPARAMID)( 5299 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI2        (MCPARAMID)( 5300 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI3        (MCPARAMID)( 5301 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI3        (MCPARAMID)( 5302 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI4        (MCPARAMID)( 5303 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI4        (MCPARAMID)( 5304 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI5        (MCPARAMID)( 5305 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI5        (MCPARAMID)( 5306 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI6        (MCPARAMID)( 5307 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI6        (MCPARAMID)( 5308 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI7        (MCPARAMID)( 5309 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI7        (MCPARAMID)( 5310 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI0       (MCPARAMID)( 5311 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI0       (MCPARAMID)( 5312 << 14)
+#define MC_AWB_ROI_WRF_Line10                    (MCPARAMID)( 5313 << 14)
+#define MC_AWB_ROI_WRF_Line10_GB                   1
+#define MC_AWB_ROI_WRF_Line10_BG                   2
+#define MC_AWB_ROI_WRF_Line10_RG                   3
+#define MC_AWB_ROI_WRF_Line10_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM100              (MCPARAMID)( 5314 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM110              (MCPARAMID)( 5315 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM120              (MCPARAMID)( 5316 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM130              (MCPARAMID)( 5317 << 14)
+#define MC_AWB_ROI_WRF_TOIheight0                (MCPARAMID)( 5318 << 14)
+#define MC_AWB_ROI_WRF_LastTOI0                  (MCPARAMID)( 5319 << 14)
+#define MC_AWB_ROI_WRF_LastTOI0_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI0_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset0                (MCPARAMID)( 5320 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch0                 (MCPARAMID)( 5321 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine0                 (MCPARAMID)( 5322 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep1               (MCPARAMID)( 5323 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep1_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep1_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep1              (MCPARAMID)( 5324 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep1_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep1_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep1                (MCPARAMID)( 5325 << 14)
+#define MC_AWB_ROI_WRF_1stColRep1_ON               1
+#define MC_AWB_ROI_WRF_1stColRep1_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep1               (MCPARAMID)( 5326 << 14)
+#define MC_AWB_ROI_WRF_LastColRep1_ON              1
+#define MC_AWB_ROI_WRF_LastColRep1_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx1                 (MCPARAMID)( 5327 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth1                 (MCPARAMID)( 5328 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI1       (MCPARAMID)( 5329 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI1       (MCPARAMID)( 5330 << 14)
+#define MC_AWB_ROI_WRF_Line11                    (MCPARAMID)( 5331 << 14)
+#define MC_AWB_ROI_WRF_Line11_GB                   1
+#define MC_AWB_ROI_WRF_Line11_BG                   2
+#define MC_AWB_ROI_WRF_Line11_RG                   3
+#define MC_AWB_ROI_WRF_Line11_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM101              (MCPARAMID)( 5332 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM111              (MCPARAMID)( 5333 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM121              (MCPARAMID)( 5334 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM131              (MCPARAMID)( 5335 << 14)
+#define MC_AWB_ROI_WRF_TOIheight1                (MCPARAMID)( 5336 << 14)
+#define MC_AWB_ROI_WRF_LastTOI1                  (MCPARAMID)( 5337 << 14)
+#define MC_AWB_ROI_WRF_LastTOI1_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI1_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset1                (MCPARAMID)( 5338 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch1                 (MCPARAMID)( 5339 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine1                 (MCPARAMID)( 5340 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep2               (MCPARAMID)( 5341 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep2_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep2_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep2              (MCPARAMID)( 5342 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep2_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep2_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep2                (MCPARAMID)( 5343 << 14)
+#define MC_AWB_ROI_WRF_1stColRep2_ON               1
+#define MC_AWB_ROI_WRF_1stColRep2_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep2               (MCPARAMID)( 5344 << 14)
+#define MC_AWB_ROI_WRF_LastColRep2_ON              1
+#define MC_AWB_ROI_WRF_LastColRep2_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx2                 (MCPARAMID)( 5345 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth2                 (MCPARAMID)( 5346 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI2       (MCPARAMID)( 5347 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI2       (MCPARAMID)( 5348 << 14)
+#define MC_AWB_ROI_WRF_Line12                    (MCPARAMID)( 5349 << 14)
+#define MC_AWB_ROI_WRF_Line12_GB                   1
+#define MC_AWB_ROI_WRF_Line12_BG                   2
+#define MC_AWB_ROI_WRF_Line12_RG                   3
+#define MC_AWB_ROI_WRF_Line12_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM102              (MCPARAMID)( 5350 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM112              (MCPARAMID)( 5351 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM122              (MCPARAMID)( 5352 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM132              (MCPARAMID)( 5353 << 14)
+#define MC_AWB_ROI_WRF_TOIheight2                (MCPARAMID)( 5354 << 14)
+#define MC_AWB_ROI_WRF_LastTOI2                  (MCPARAMID)( 5355 << 14)
+#define MC_AWB_ROI_WRF_LastTOI2_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI2_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset2                (MCPARAMID)( 5356 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch2                 (MCPARAMID)( 5357 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine2                 (MCPARAMID)( 5358 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep3               (MCPARAMID)( 5359 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep3_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep3_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep3              (MCPARAMID)( 5360 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep3_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep3_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep3                (MCPARAMID)( 5361 << 14)
+#define MC_AWB_ROI_WRF_1stColRep3_ON               1
+#define MC_AWB_ROI_WRF_1stColRep3_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep3               (MCPARAMID)( 5362 << 14)
+#define MC_AWB_ROI_WRF_LastColRep3_ON              1
+#define MC_AWB_ROI_WRF_LastColRep3_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx3                 (MCPARAMID)( 5363 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth3                 (MCPARAMID)( 5364 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI3       (MCPARAMID)( 5365 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI3       (MCPARAMID)( 5366 << 14)
+#define MC_AWB_ROI_WRF_Line13                    (MCPARAMID)( 5367 << 14)
+#define MC_AWB_ROI_WRF_Line13_GB                   1
+#define MC_AWB_ROI_WRF_Line13_BG                   2
+#define MC_AWB_ROI_WRF_Line13_RG                   3
+#define MC_AWB_ROI_WRF_Line13_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM103              (MCPARAMID)( 5368 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM113              (MCPARAMID)( 5369 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM123              (MCPARAMID)( 5370 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM133              (MCPARAMID)( 5371 << 14)
+#define MC_AWB_ROI_WRF_TOIheight3                (MCPARAMID)( 5372 << 14)
+#define MC_AWB_ROI_WRF_LastTOI3                  (MCPARAMID)( 5373 << 14)
+#define MC_AWB_ROI_WRF_LastTOI3_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI3_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset3                (MCPARAMID)( 5374 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch3                 (MCPARAMID)( 5375 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine3                 (MCPARAMID)( 5376 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep4               (MCPARAMID)( 5377 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep4_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep4_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep4              (MCPARAMID)( 5378 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep4_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep4_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep4                (MCPARAMID)( 5379 << 14)
+#define MC_AWB_ROI_WRF_1stColRep4_ON               1
+#define MC_AWB_ROI_WRF_1stColRep4_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep4               (MCPARAMID)( 5380 << 14)
+#define MC_AWB_ROI_WRF_LastColRep4_ON              1
+#define MC_AWB_ROI_WRF_LastColRep4_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx4                 (MCPARAMID)( 5381 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth4                 (MCPARAMID)( 5382 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI4       (MCPARAMID)( 5383 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI4       (MCPARAMID)( 5384 << 14)
+#define MC_AWB_ROI_WRF_Line14                    (MCPARAMID)( 5385 << 14)
+#define MC_AWB_ROI_WRF_Line14_GB                   1
+#define MC_AWB_ROI_WRF_Line14_BG                   2
+#define MC_AWB_ROI_WRF_Line14_RG                   3
+#define MC_AWB_ROI_WRF_Line14_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM104              (MCPARAMID)( 5386 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM114              (MCPARAMID)( 5387 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM124              (MCPARAMID)( 5388 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM134              (MCPARAMID)( 5389 << 14)
+#define MC_AWB_ROI_WRF_TOIheight4                (MCPARAMID)( 5390 << 14)
+#define MC_AWB_ROI_WRF_LastTOI4                  (MCPARAMID)( 5391 << 14)
+#define MC_AWB_ROI_WRF_LastTOI4_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI4_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset4                (MCPARAMID)( 5392 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch4                 (MCPARAMID)( 5393 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine4                 (MCPARAMID)( 5394 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep5               (MCPARAMID)( 5395 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep5_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep5_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep5              (MCPARAMID)( 5396 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep5_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep5_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep5                (MCPARAMID)( 5397 << 14)
+#define MC_AWB_ROI_WRF_1stColRep5_ON               1
+#define MC_AWB_ROI_WRF_1stColRep5_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep5               (MCPARAMID)( 5398 << 14)
+#define MC_AWB_ROI_WRF_LastColRep5_ON              1
+#define MC_AWB_ROI_WRF_LastColRep5_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx5                 (MCPARAMID)( 5399 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth5                 (MCPARAMID)( 5400 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI5       (MCPARAMID)( 5401 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI5       (MCPARAMID)( 5402 << 14)
+#define MC_AWB_ROI_WRF_Line15                    (MCPARAMID)( 5403 << 14)
+#define MC_AWB_ROI_WRF_Line15_GB                   1
+#define MC_AWB_ROI_WRF_Line15_BG                   2
+#define MC_AWB_ROI_WRF_Line15_RG                   3
+#define MC_AWB_ROI_WRF_Line15_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM105              (MCPARAMID)( 5404 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM115              (MCPARAMID)( 5405 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM125              (MCPARAMID)( 5406 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM135              (MCPARAMID)( 5407 << 14)
+#define MC_AWB_ROI_WRF_TOIheight5                (MCPARAMID)( 5408 << 14)
+#define MC_AWB_ROI_WRF_LastTOI5                  (MCPARAMID)( 5409 << 14)
+#define MC_AWB_ROI_WRF_LastTOI5_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI5_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset5                (MCPARAMID)( 5410 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch5                 (MCPARAMID)( 5411 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine5                 (MCPARAMID)( 5412 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep6               (MCPARAMID)( 5413 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep6_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep6_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep6              (MCPARAMID)( 5414 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep6_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep6_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep6                (MCPARAMID)( 5415 << 14)
+#define MC_AWB_ROI_WRF_1stColRep6_ON               1
+#define MC_AWB_ROI_WRF_1stColRep6_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep6               (MCPARAMID)( 5416 << 14)
+#define MC_AWB_ROI_WRF_LastColRep6_ON              1
+#define MC_AWB_ROI_WRF_LastColRep6_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx6                 (MCPARAMID)( 5417 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth6                 (MCPARAMID)( 5418 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI6       (MCPARAMID)( 5419 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI6       (MCPARAMID)( 5420 << 14)
+#define MC_AWB_ROI_WRF_Line16                    (MCPARAMID)( 5421 << 14)
+#define MC_AWB_ROI_WRF_Line16_GB                   1
+#define MC_AWB_ROI_WRF_Line16_BG                   2
+#define MC_AWB_ROI_WRF_Line16_RG                   3
+#define MC_AWB_ROI_WRF_Line16_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM106              (MCPARAMID)( 5422 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM116              (MCPARAMID)( 5423 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM126              (MCPARAMID)( 5424 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM136              (MCPARAMID)( 5425 << 14)
+#define MC_AWB_ROI_WRF_TOIheight6                (MCPARAMID)( 5426 << 14)
+#define MC_AWB_ROI_WRF_LastTOI6                  (MCPARAMID)( 5427 << 14)
+#define MC_AWB_ROI_WRF_LastTOI6_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI6_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset6                (MCPARAMID)( 5428 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch6                 (MCPARAMID)( 5429 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine6                 (MCPARAMID)( 5430 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep7               (MCPARAMID)( 5431 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep7_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep7_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep7              (MCPARAMID)( 5432 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep7_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep7_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep7                (MCPARAMID)( 5433 << 14)
+#define MC_AWB_ROI_WRF_1stColRep7_ON               1
+#define MC_AWB_ROI_WRF_1stColRep7_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep7               (MCPARAMID)( 5434 << 14)
+#define MC_AWB_ROI_WRF_LastColRep7_ON              1
+#define MC_AWB_ROI_WRF_LastColRep7_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx7                 (MCPARAMID)( 5435 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth7                 (MCPARAMID)( 5436 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI7       (MCPARAMID)( 5437 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI7       (MCPARAMID)( 5438 << 14)
+#define MC_AWB_ROI_WRF_Line17                    (MCPARAMID)( 5439 << 14)
+#define MC_AWB_ROI_WRF_Line17_GB                   1
+#define MC_AWB_ROI_WRF_Line17_BG                   2
+#define MC_AWB_ROI_WRF_Line17_RG                   3
+#define MC_AWB_ROI_WRF_Line17_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM107              (MCPARAMID)( 5440 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM117              (MCPARAMID)( 5441 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM127              (MCPARAMID)( 5442 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM137              (MCPARAMID)( 5443 << 14)
+#define MC_AWB_ROI_WRF_TOIheight7                (MCPARAMID)( 5444 << 14)
+#define MC_AWB_ROI_WRF_LastTOI7                  (MCPARAMID)( 5445 << 14)
+#define MC_AWB_ROI_WRF_LastTOI7_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI7_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset7                (MCPARAMID)( 5446 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch7                 (MCPARAMID)( 5447 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine7                 (MCPARAMID)( 5448 << 14)
+#define MC_WBO_OrgX                              (MCPARAMID)( 5449 << 14)
+#define MC_WBO_OrgX_Max                          (MCPARAMID)( 5450 << 14)
+#define MC_WBO_OrgX_Check                        (MCPARAMID)( 5451 << 14)
+#define MC_WBO_OrgX_Check_PASS                     1
+#define MC_WBO_OrgX_Check_FAIL                     2
+#define MC_WBO_OrgY                              (MCPARAMID)( 5452 << 14)
+#define MC_WBO_OrgY_Max                          (MCPARAMID)( 5453 << 14)
+#define MC_WBO_OrgY_Check                        (MCPARAMID)( 5454 << 14)
+#define MC_WBO_OrgY_Check_PASS                     1
+#define MC_WBO_OrgY_Check_FAIL                     2
+#define MC_WBO_AWB_AREA_Filter                   (MCPARAMID)( 5455 << 14)
+#define MC_WBO_Width                             (MCPARAMID)( 5456 << 14)
+#define MC_WBO_Width_Max                         (MCPARAMID)( 5457 << 14)
+#define MC_WBO_Width_Check                       (MCPARAMID)( 5458 << 14)
+#define MC_WBO_Width_Check_PASS                    1
+#define MC_WBO_Width_Check_FAIL                    2
+#define MC_WBO_Height                            (MCPARAMID)( 5459 << 14)
+#define MC_WBO_Height_Max                        (MCPARAMID)( 5460 << 14)
+#define MC_WBO_Height_Check                      (MCPARAMID)( 5461 << 14)
+#define MC_WBO_Height_Check_PASS                   1
+#define MC_WBO_Height_Check_FAIL                   2
+#define MC__Category_CFA_TOIExtractor             60
+#define MC__Category_CFA_TOIExtractor_Local       61
+#define MC__Category_CFA_TOIExtractor_LowLevel    62
+#define MC_XF_ROI_TOI_USR_WidthLastCol           (MCPARAMID)( 5462 << 14)
+#define MC_AWB_ROI_TOI_USR_WidthLastCol          (MCPARAMID)( 5463 << 14)
+#define MC_XF_ROI_TOI_USR_LastColFlag            (MCPARAMID)( 5464 << 14)
+#define MC_XF_ROI_TOI_USR_LastColFlag_YES          1
+#define MC_XF_ROI_TOI_USR_LastColFlag_NO           2
+#define MC_AWB_ROI_TOI_USR_LastColFlag           (MCPARAMID)( 5465 << 14)
+#define MC_AWB_ROI_TOI_USR_LastColFlag_YES         1
+#define MC_AWB_ROI_TOI_USR_LastColFlag_NO          2
+#define MC_XF_ROIOrgX                            (MCPARAMID)( 5466 << 14)
+#define MC_XF_ROIOrgY                            (MCPARAMID)( 5467 << 14)
+#define MC_AWB_ROIOrgX                           (MCPARAMID)( 5468 << 14)
+#define MC_AWB_ROIOrgY                           (MCPARAMID)( 5469 << 14)
+#define MC_WBO_AWB_AREA_Check_Filter             (MCPARAMID)( 5470 << 14)
+#define MC_XF_ROI_WRF_1stLineRep8                (MCPARAMID)( 5471 << 14)
+#define MC_XF_ROI_WRF_1stLineRep8_ON               1
+#define MC_XF_ROI_WRF_1stLineRep8_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep8               (MCPARAMID)( 5472 << 14)
+#define MC_XF_ROI_WRF_LastLineRep8_ON              1
+#define MC_XF_ROI_WRF_LastLineRep8_OFF             2
+#define MC_XF_ROI_WRF_1stColRep8                 (MCPARAMID)( 5473 << 14)
+#define MC_XF_ROI_WRF_1stColRep8_ON                1
+#define MC_XF_ROI_WRF_1stColRep8_OFF               2
+#define MC_XF_ROI_WRF_LastColRep8                (MCPARAMID)( 5474 << 14)
+#define MC_XF_ROI_WRF_LastColRep8_ON               1
+#define MC_XF_ROI_WRF_LastColRep8_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx8                  (MCPARAMID)( 5475 << 14)
+#define MC_XF_ROI_WRF_TOIwidth8                  (MCPARAMID)( 5476 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI8        (MCPARAMID)( 5477 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI8        (MCPARAMID)( 5478 << 14)
+#define MC_XF_ROI_WRF_Line18                     (MCPARAMID)( 5479 << 14)
+#define MC_XF_ROI_WRF_Line18_GB                    1
+#define MC_XF_ROI_WRF_Line18_BG                    2
+#define MC_XF_ROI_WRF_Line18_RG                    3
+#define MC_XF_ROI_WRF_Line18_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM108               (MCPARAMID)( 5480 << 14)
+#define MC_XF_ROI_WRF_XferSizeM118               (MCPARAMID)( 5481 << 14)
+#define MC_XF_ROI_WRF_XferSizeM128               (MCPARAMID)( 5482 << 14)
+#define MC_XF_ROI_WRF_XferSizeM138               (MCPARAMID)( 5483 << 14)
+#define MC_XF_ROI_WRF_TOIheight8                 (MCPARAMID)( 5484 << 14)
+#define MC_XF_ROI_WRF_LastTOI8                   (MCPARAMID)( 5485 << 14)
+#define MC_XF_ROI_WRF_LastTOI8_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI8_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset8                 (MCPARAMID)( 5486 << 14)
+#define MC_XF_ROI_WRF_TOIPitch8                  (MCPARAMID)( 5487 << 14)
+#define MC_XF_ROI_WRF_NbOfLine8                  (MCPARAMID)( 5488 << 14)
+#define MC_XF_ROI_WRF_1stLineRep9                (MCPARAMID)( 5489 << 14)
+#define MC_XF_ROI_WRF_1stLineRep9_ON               1
+#define MC_XF_ROI_WRF_1stLineRep9_OFF              2
+#define MC_XF_ROI_WRF_LastLineRep9               (MCPARAMID)( 5490 << 14)
+#define MC_XF_ROI_WRF_LastLineRep9_ON              1
+#define MC_XF_ROI_WRF_LastLineRep9_OFF             2
+#define MC_XF_ROI_WRF_1stColRep9                 (MCPARAMID)( 5491 << 14)
+#define MC_XF_ROI_WRF_1stColRep9_ON                1
+#define MC_XF_ROI_WRF_1stColRep9_OFF               2
+#define MC_XF_ROI_WRF_LastColRep9                (MCPARAMID)( 5492 << 14)
+#define MC_XF_ROI_WRF_LastColRep9_ON               1
+#define MC_XF_ROI_WRF_LastColRep9_OFF              2
+#define MC_XF_ROI_WRF_ColumnIx9                  (MCPARAMID)( 5493 << 14)
+#define MC_XF_ROI_WRF_TOIwidth9                  (MCPARAMID)( 5494 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI9        (MCPARAMID)( 5495 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI9        (MCPARAMID)( 5496 << 14)
+#define MC_XF_ROI_WRF_Line19                     (MCPARAMID)( 5497 << 14)
+#define MC_XF_ROI_WRF_Line19_GB                    1
+#define MC_XF_ROI_WRF_Line19_BG                    2
+#define MC_XF_ROI_WRF_Line19_RG                    3
+#define MC_XF_ROI_WRF_Line19_GR                    4
+#define MC_XF_ROI_WRF_XferSizeM109               (MCPARAMID)( 5498 << 14)
+#define MC_XF_ROI_WRF_XferSizeM119               (MCPARAMID)( 5499 << 14)
+#define MC_XF_ROI_WRF_XferSizeM129               (MCPARAMID)( 5500 << 14)
+#define MC_XF_ROI_WRF_XferSizeM139               (MCPARAMID)( 5501 << 14)
+#define MC_XF_ROI_WRF_TOIheight9                 (MCPARAMID)( 5502 << 14)
+#define MC_XF_ROI_WRF_LastTOI9                   (MCPARAMID)( 5503 << 14)
+#define MC_XF_ROI_WRF_LastTOI9_TRUE                1
+#define MC_XF_ROI_WRF_LastTOI9_FALSE               2
+#define MC_XF_ROI_WRF_TOIoffset9                 (MCPARAMID)( 5504 << 14)
+#define MC_XF_ROI_WRF_TOIPitch9                  (MCPARAMID)( 5505 << 14)
+#define MC_XF_ROI_WRF_NbOfLine9                  (MCPARAMID)( 5506 << 14)
+#define MC_XF_ROI_WRF_1stLineRep10               (MCPARAMID)( 5507 << 14)
+#define MC_XF_ROI_WRF_1stLineRep10_ON              1
+#define MC_XF_ROI_WRF_1stLineRep10_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep10              (MCPARAMID)( 5508 << 14)
+#define MC_XF_ROI_WRF_LastLineRep10_ON             1
+#define MC_XF_ROI_WRF_LastLineRep10_OFF            2
+#define MC_XF_ROI_WRF_1stColRep10                (MCPARAMID)( 5509 << 14)
+#define MC_XF_ROI_WRF_1stColRep10_ON               1
+#define MC_XF_ROI_WRF_1stColRep10_OFF              2
+#define MC_XF_ROI_WRF_LastColRep10               (MCPARAMID)( 5510 << 14)
+#define MC_XF_ROI_WRF_LastColRep10_ON              1
+#define MC_XF_ROI_WRF_LastColRep10_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx10                 (MCPARAMID)( 5511 << 14)
+#define MC_XF_ROI_WRF_TOIwidth10                 (MCPARAMID)( 5512 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI10       (MCPARAMID)( 5513 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI10       (MCPARAMID)( 5514 << 14)
+#define MC_XF_ROI_WRF_Line110                    (MCPARAMID)( 5515 << 14)
+#define MC_XF_ROI_WRF_Line110_GB                   1
+#define MC_XF_ROI_WRF_Line110_BG                   2
+#define MC_XF_ROI_WRF_Line110_RG                   3
+#define MC_XF_ROI_WRF_Line110_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1010              (MCPARAMID)( 5516 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1110              (MCPARAMID)( 5517 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1210              (MCPARAMID)( 5518 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1310              (MCPARAMID)( 5519 << 14)
+#define MC_XF_ROI_WRF_TOIheight10                (MCPARAMID)( 5520 << 14)
+#define MC_XF_ROI_WRF_LastTOI10                  (MCPARAMID)( 5521 << 14)
+#define MC_XF_ROI_WRF_LastTOI10_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI10_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset10                (MCPARAMID)( 5522 << 14)
+#define MC_XF_ROI_WRF_TOIPitch10                 (MCPARAMID)( 5523 << 14)
+#define MC_XF_ROI_WRF_NbOfLine10                 (MCPARAMID)( 5524 << 14)
+#define MC_XF_ROI_WRF_1stLineRep11               (MCPARAMID)( 5525 << 14)
+#define MC_XF_ROI_WRF_1stLineRep11_ON              1
+#define MC_XF_ROI_WRF_1stLineRep11_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep11              (MCPARAMID)( 5526 << 14)
+#define MC_XF_ROI_WRF_LastLineRep11_ON             1
+#define MC_XF_ROI_WRF_LastLineRep11_OFF            2
+#define MC_XF_ROI_WRF_1stColRep11                (MCPARAMID)( 5527 << 14)
+#define MC_XF_ROI_WRF_1stColRep11_ON               1
+#define MC_XF_ROI_WRF_1stColRep11_OFF              2
+#define MC_XF_ROI_WRF_LastColRep11               (MCPARAMID)( 5528 << 14)
+#define MC_XF_ROI_WRF_LastColRep11_ON              1
+#define MC_XF_ROI_WRF_LastColRep11_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx11                 (MCPARAMID)( 5529 << 14)
+#define MC_XF_ROI_WRF_TOIwidth11                 (MCPARAMID)( 5530 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI11       (MCPARAMID)( 5531 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI11       (MCPARAMID)( 5532 << 14)
+#define MC_XF_ROI_WRF_Line111                    (MCPARAMID)( 5533 << 14)
+#define MC_XF_ROI_WRF_Line111_GB                   1
+#define MC_XF_ROI_WRF_Line111_BG                   2
+#define MC_XF_ROI_WRF_Line111_RG                   3
+#define MC_XF_ROI_WRF_Line111_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1011              (MCPARAMID)( 5534 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1111              (MCPARAMID)( 5535 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1211              (MCPARAMID)( 5536 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1311              (MCPARAMID)( 5537 << 14)
+#define MC_XF_ROI_WRF_TOIheight11                (MCPARAMID)( 5538 << 14)
+#define MC_XF_ROI_WRF_LastTOI11                  (MCPARAMID)( 5539 << 14)
+#define MC_XF_ROI_WRF_LastTOI11_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI11_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset11                (MCPARAMID)( 5540 << 14)
+#define MC_XF_ROI_WRF_TOIPitch11                 (MCPARAMID)( 5541 << 14)
+#define MC_XF_ROI_WRF_NbOfLine11                 (MCPARAMID)( 5542 << 14)
+#define MC_XF_ROI_WRF_1stLineRep12               (MCPARAMID)( 5543 << 14)
+#define MC_XF_ROI_WRF_1stLineRep12_ON              1
+#define MC_XF_ROI_WRF_1stLineRep12_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep12              (MCPARAMID)( 5544 << 14)
+#define MC_XF_ROI_WRF_LastLineRep12_ON             1
+#define MC_XF_ROI_WRF_LastLineRep12_OFF            2
+#define MC_XF_ROI_WRF_1stColRep12                (MCPARAMID)( 5545 << 14)
+#define MC_XF_ROI_WRF_1stColRep12_ON               1
+#define MC_XF_ROI_WRF_1stColRep12_OFF              2
+#define MC_XF_ROI_WRF_LastColRep12               (MCPARAMID)( 5546 << 14)
+#define MC_XF_ROI_WRF_LastColRep12_ON              1
+#define MC_XF_ROI_WRF_LastColRep12_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx12                 (MCPARAMID)( 5547 << 14)
+#define MC_XF_ROI_WRF_TOIwidth12                 (MCPARAMID)( 5548 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI12       (MCPARAMID)( 5549 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI12       (MCPARAMID)( 5550 << 14)
+#define MC_XF_ROI_WRF_Line112                    (MCPARAMID)( 5551 << 14)
+#define MC_XF_ROI_WRF_Line112_GB                   1
+#define MC_XF_ROI_WRF_Line112_BG                   2
+#define MC_XF_ROI_WRF_Line112_RG                   3
+#define MC_XF_ROI_WRF_Line112_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1012              (MCPARAMID)( 5552 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1112              (MCPARAMID)( 5553 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1212              (MCPARAMID)( 5554 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1312              (MCPARAMID)( 5555 << 14)
+#define MC_XF_ROI_WRF_TOIheight12                (MCPARAMID)( 5556 << 14)
+#define MC_XF_ROI_WRF_LastTOI12                  (MCPARAMID)( 5557 << 14)
+#define MC_XF_ROI_WRF_LastTOI12_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI12_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset12                (MCPARAMID)( 5558 << 14)
+#define MC_XF_ROI_WRF_TOIPitch12                 (MCPARAMID)( 5559 << 14)
+#define MC_XF_ROI_WRF_NbOfLine12                 (MCPARAMID)( 5560 << 14)
+#define MC_XF_ROI_WRF_1stLineRep13               (MCPARAMID)( 5561 << 14)
+#define MC_XF_ROI_WRF_1stLineRep13_ON              1
+#define MC_XF_ROI_WRF_1stLineRep13_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep13              (MCPARAMID)( 5562 << 14)
+#define MC_XF_ROI_WRF_LastLineRep13_ON             1
+#define MC_XF_ROI_WRF_LastLineRep13_OFF            2
+#define MC_XF_ROI_WRF_1stColRep13                (MCPARAMID)( 5563 << 14)
+#define MC_XF_ROI_WRF_1stColRep13_ON               1
+#define MC_XF_ROI_WRF_1stColRep13_OFF              2
+#define MC_XF_ROI_WRF_LastColRep13               (MCPARAMID)( 5564 << 14)
+#define MC_XF_ROI_WRF_LastColRep13_ON              1
+#define MC_XF_ROI_WRF_LastColRep13_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx13                 (MCPARAMID)( 5565 << 14)
+#define MC_XF_ROI_WRF_TOIwidth13                 (MCPARAMID)( 5566 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI13       (MCPARAMID)( 5567 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI13       (MCPARAMID)( 5568 << 14)
+#define MC_XF_ROI_WRF_Line113                    (MCPARAMID)( 5569 << 14)
+#define MC_XF_ROI_WRF_Line113_GB                   1
+#define MC_XF_ROI_WRF_Line113_BG                   2
+#define MC_XF_ROI_WRF_Line113_RG                   3
+#define MC_XF_ROI_WRF_Line113_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1013              (MCPARAMID)( 5570 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1113              (MCPARAMID)( 5571 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1213              (MCPARAMID)( 5572 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1313              (MCPARAMID)( 5573 << 14)
+#define MC_XF_ROI_WRF_TOIheight13                (MCPARAMID)( 5574 << 14)
+#define MC_XF_ROI_WRF_LastTOI13                  (MCPARAMID)( 5575 << 14)
+#define MC_XF_ROI_WRF_LastTOI13_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI13_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset13                (MCPARAMID)( 5576 << 14)
+#define MC_XF_ROI_WRF_TOIPitch13                 (MCPARAMID)( 5577 << 14)
+#define MC_XF_ROI_WRF_NbOfLine13                 (MCPARAMID)( 5578 << 14)
+#define MC_XF_ROI_WRF_1stLineRep14               (MCPARAMID)( 5579 << 14)
+#define MC_XF_ROI_WRF_1stLineRep14_ON              1
+#define MC_XF_ROI_WRF_1stLineRep14_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep14              (MCPARAMID)( 5580 << 14)
+#define MC_XF_ROI_WRF_LastLineRep14_ON             1
+#define MC_XF_ROI_WRF_LastLineRep14_OFF            2
+#define MC_XF_ROI_WRF_1stColRep14                (MCPARAMID)( 5581 << 14)
+#define MC_XF_ROI_WRF_1stColRep14_ON               1
+#define MC_XF_ROI_WRF_1stColRep14_OFF              2
+#define MC_XF_ROI_WRF_LastColRep14               (MCPARAMID)( 5582 << 14)
+#define MC_XF_ROI_WRF_LastColRep14_ON              1
+#define MC_XF_ROI_WRF_LastColRep14_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx14                 (MCPARAMID)( 5583 << 14)
+#define MC_XF_ROI_WRF_TOIwidth14                 (MCPARAMID)( 5584 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI14       (MCPARAMID)( 5585 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI14       (MCPARAMID)( 5586 << 14)
+#define MC_XF_ROI_WRF_Line114                    (MCPARAMID)( 5587 << 14)
+#define MC_XF_ROI_WRF_Line114_GB                   1
+#define MC_XF_ROI_WRF_Line114_BG                   2
+#define MC_XF_ROI_WRF_Line114_RG                   3
+#define MC_XF_ROI_WRF_Line114_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1014              (MCPARAMID)( 5588 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1114              (MCPARAMID)( 5589 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1214              (MCPARAMID)( 5590 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1314              (MCPARAMID)( 5591 << 14)
+#define MC_XF_ROI_WRF_TOIheight14                (MCPARAMID)( 5592 << 14)
+#define MC_XF_ROI_WRF_LastTOI14                  (MCPARAMID)( 5593 << 14)
+#define MC_XF_ROI_WRF_LastTOI14_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI14_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset14                (MCPARAMID)( 5594 << 14)
+#define MC_XF_ROI_WRF_TOIPitch14                 (MCPARAMID)( 5595 << 14)
+#define MC_XF_ROI_WRF_NbOfLine14                 (MCPARAMID)( 5596 << 14)
+#define MC_XF_ROI_WRF_1stLineRep15               (MCPARAMID)( 5597 << 14)
+#define MC_XF_ROI_WRF_1stLineRep15_ON              1
+#define MC_XF_ROI_WRF_1stLineRep15_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep15              (MCPARAMID)( 5598 << 14)
+#define MC_XF_ROI_WRF_LastLineRep15_ON             1
+#define MC_XF_ROI_WRF_LastLineRep15_OFF            2
+#define MC_XF_ROI_WRF_1stColRep15                (MCPARAMID)( 5599 << 14)
+#define MC_XF_ROI_WRF_1stColRep15_ON               1
+#define MC_XF_ROI_WRF_1stColRep15_OFF              2
+#define MC_XF_ROI_WRF_LastColRep15               (MCPARAMID)( 5600 << 14)
+#define MC_XF_ROI_WRF_LastColRep15_ON              1
+#define MC_XF_ROI_WRF_LastColRep15_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx15                 (MCPARAMID)( 5601 << 14)
+#define MC_XF_ROI_WRF_TOIwidth15                 (MCPARAMID)( 5602 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI15       (MCPARAMID)( 5603 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI15       (MCPARAMID)( 5604 << 14)
+#define MC_XF_ROI_WRF_Line115                    (MCPARAMID)( 5605 << 14)
+#define MC_XF_ROI_WRF_Line115_GB                   1
+#define MC_XF_ROI_WRF_Line115_BG                   2
+#define MC_XF_ROI_WRF_Line115_RG                   3
+#define MC_XF_ROI_WRF_Line115_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1015              (MCPARAMID)( 5606 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1115              (MCPARAMID)( 5607 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1215              (MCPARAMID)( 5608 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1315              (MCPARAMID)( 5609 << 14)
+#define MC_XF_ROI_WRF_TOIheight15                (MCPARAMID)( 5610 << 14)
+#define MC_XF_ROI_WRF_LastTOI15                  (MCPARAMID)( 5611 << 14)
+#define MC_XF_ROI_WRF_LastTOI15_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI15_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset15                (MCPARAMID)( 5612 << 14)
+#define MC_XF_ROI_WRF_TOIPitch15                 (MCPARAMID)( 5613 << 14)
+#define MC_XF_ROI_WRF_NbOfLine15                 (MCPARAMID)( 5614 << 14)
+#define MC_XF_ROI_WRF_1stLineRep16               (MCPARAMID)( 5615 << 14)
+#define MC_XF_ROI_WRF_1stLineRep16_ON              1
+#define MC_XF_ROI_WRF_1stLineRep16_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep16              (MCPARAMID)( 5616 << 14)
+#define MC_XF_ROI_WRF_LastLineRep16_ON             1
+#define MC_XF_ROI_WRF_LastLineRep16_OFF            2
+#define MC_XF_ROI_WRF_1stColRep16                (MCPARAMID)( 5617 << 14)
+#define MC_XF_ROI_WRF_1stColRep16_ON               1
+#define MC_XF_ROI_WRF_1stColRep16_OFF              2
+#define MC_XF_ROI_WRF_LastColRep16               (MCPARAMID)( 5618 << 14)
+#define MC_XF_ROI_WRF_LastColRep16_ON              1
+#define MC_XF_ROI_WRF_LastColRep16_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx16                 (MCPARAMID)( 5619 << 14)
+#define MC_XF_ROI_WRF_TOIwidth16                 (MCPARAMID)( 5620 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI16       (MCPARAMID)( 5621 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI16       (MCPARAMID)( 5622 << 14)
+#define MC_XF_ROI_WRF_Line116                    (MCPARAMID)( 5623 << 14)
+#define MC_XF_ROI_WRF_Line116_GB                   1
+#define MC_XF_ROI_WRF_Line116_BG                   2
+#define MC_XF_ROI_WRF_Line116_RG                   3
+#define MC_XF_ROI_WRF_Line116_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1016              (MCPARAMID)( 5624 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1116              (MCPARAMID)( 5625 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1216              (MCPARAMID)( 5626 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1316              (MCPARAMID)( 5627 << 14)
+#define MC_XF_ROI_WRF_TOIheight16                (MCPARAMID)( 5628 << 14)
+#define MC_XF_ROI_WRF_LastTOI16                  (MCPARAMID)( 5629 << 14)
+#define MC_XF_ROI_WRF_LastTOI16_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI16_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset16                (MCPARAMID)( 5630 << 14)
+#define MC_XF_ROI_WRF_TOIPitch16                 (MCPARAMID)( 5631 << 14)
+#define MC_XF_ROI_WRF_NbOfLine16                 (MCPARAMID)( 5632 << 14)
+#define MC_XF_ROI_WRF_1stLineRep17               (MCPARAMID)( 5633 << 14)
+#define MC_XF_ROI_WRF_1stLineRep17_ON              1
+#define MC_XF_ROI_WRF_1stLineRep17_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep17              (MCPARAMID)( 5634 << 14)
+#define MC_XF_ROI_WRF_LastLineRep17_ON             1
+#define MC_XF_ROI_WRF_LastLineRep17_OFF            2
+#define MC_XF_ROI_WRF_1stColRep17                (MCPARAMID)( 5635 << 14)
+#define MC_XF_ROI_WRF_1stColRep17_ON               1
+#define MC_XF_ROI_WRF_1stColRep17_OFF              2
+#define MC_XF_ROI_WRF_LastColRep17               (MCPARAMID)( 5636 << 14)
+#define MC_XF_ROI_WRF_LastColRep17_ON              1
+#define MC_XF_ROI_WRF_LastColRep17_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx17                 (MCPARAMID)( 5637 << 14)
+#define MC_XF_ROI_WRF_TOIwidth17                 (MCPARAMID)( 5638 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI17       (MCPARAMID)( 5639 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI17       (MCPARAMID)( 5640 << 14)
+#define MC_XF_ROI_WRF_Line117                    (MCPARAMID)( 5641 << 14)
+#define MC_XF_ROI_WRF_Line117_GB                   1
+#define MC_XF_ROI_WRF_Line117_BG                   2
+#define MC_XF_ROI_WRF_Line117_RG                   3
+#define MC_XF_ROI_WRF_Line117_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1017              (MCPARAMID)( 5642 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1117              (MCPARAMID)( 5643 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1217              (MCPARAMID)( 5644 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1317              (MCPARAMID)( 5645 << 14)
+#define MC_XF_ROI_WRF_TOIheight17                (MCPARAMID)( 5646 << 14)
+#define MC_XF_ROI_WRF_LastTOI17                  (MCPARAMID)( 5647 << 14)
+#define MC_XF_ROI_WRF_LastTOI17_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI17_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset17                (MCPARAMID)( 5648 << 14)
+#define MC_XF_ROI_WRF_TOIPitch17                 (MCPARAMID)( 5649 << 14)
+#define MC_XF_ROI_WRF_NbOfLine17                 (MCPARAMID)( 5650 << 14)
+#define MC_XF_ROI_WRF_1stLineRep18               (MCPARAMID)( 5651 << 14)
+#define MC_XF_ROI_WRF_1stLineRep18_ON              1
+#define MC_XF_ROI_WRF_1stLineRep18_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep18              (MCPARAMID)( 5652 << 14)
+#define MC_XF_ROI_WRF_LastLineRep18_ON             1
+#define MC_XF_ROI_WRF_LastLineRep18_OFF            2
+#define MC_XF_ROI_WRF_1stColRep18                (MCPARAMID)( 5653 << 14)
+#define MC_XF_ROI_WRF_1stColRep18_ON               1
+#define MC_XF_ROI_WRF_1stColRep18_OFF              2
+#define MC_XF_ROI_WRF_LastColRep18               (MCPARAMID)( 5654 << 14)
+#define MC_XF_ROI_WRF_LastColRep18_ON              1
+#define MC_XF_ROI_WRF_LastColRep18_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx18                 (MCPARAMID)( 5655 << 14)
+#define MC_XF_ROI_WRF_TOIwidth18                 (MCPARAMID)( 5656 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI18       (MCPARAMID)( 5657 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI18       (MCPARAMID)( 5658 << 14)
+#define MC_XF_ROI_WRF_Line118                    (MCPARAMID)( 5659 << 14)
+#define MC_XF_ROI_WRF_Line118_GB                   1
+#define MC_XF_ROI_WRF_Line118_BG                   2
+#define MC_XF_ROI_WRF_Line118_RG                   3
+#define MC_XF_ROI_WRF_Line118_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1018              (MCPARAMID)( 5660 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1118              (MCPARAMID)( 5661 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1218              (MCPARAMID)( 5662 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1318              (MCPARAMID)( 5663 << 14)
+#define MC_XF_ROI_WRF_TOIheight18                (MCPARAMID)( 5664 << 14)
+#define MC_XF_ROI_WRF_LastTOI18                  (MCPARAMID)( 5665 << 14)
+#define MC_XF_ROI_WRF_LastTOI18_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI18_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset18                (MCPARAMID)( 5666 << 14)
+#define MC_XF_ROI_WRF_TOIPitch18                 (MCPARAMID)( 5667 << 14)
+#define MC_XF_ROI_WRF_NbOfLine18                 (MCPARAMID)( 5668 << 14)
+#define MC_XF_ROI_WRF_1stLineRep19               (MCPARAMID)( 5669 << 14)
+#define MC_XF_ROI_WRF_1stLineRep19_ON              1
+#define MC_XF_ROI_WRF_1stLineRep19_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep19              (MCPARAMID)( 5670 << 14)
+#define MC_XF_ROI_WRF_LastLineRep19_ON             1
+#define MC_XF_ROI_WRF_LastLineRep19_OFF            2
+#define MC_XF_ROI_WRF_1stColRep19                (MCPARAMID)( 5671 << 14)
+#define MC_XF_ROI_WRF_1stColRep19_ON               1
+#define MC_XF_ROI_WRF_1stColRep19_OFF              2
+#define MC_XF_ROI_WRF_LastColRep19               (MCPARAMID)( 5672 << 14)
+#define MC_XF_ROI_WRF_LastColRep19_ON              1
+#define MC_XF_ROI_WRF_LastColRep19_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx19                 (MCPARAMID)( 5673 << 14)
+#define MC_XF_ROI_WRF_TOIwidth19                 (MCPARAMID)( 5674 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI19       (MCPARAMID)( 5675 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI19       (MCPARAMID)( 5676 << 14)
+#define MC_XF_ROI_WRF_Line119                    (MCPARAMID)( 5677 << 14)
+#define MC_XF_ROI_WRF_Line119_GB                   1
+#define MC_XF_ROI_WRF_Line119_BG                   2
+#define MC_XF_ROI_WRF_Line119_RG                   3
+#define MC_XF_ROI_WRF_Line119_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1019              (MCPARAMID)( 5678 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1119              (MCPARAMID)( 5679 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1219              (MCPARAMID)( 5680 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1319              (MCPARAMID)( 5681 << 14)
+#define MC_XF_ROI_WRF_TOIheight19                (MCPARAMID)( 5682 << 14)
+#define MC_XF_ROI_WRF_LastTOI19                  (MCPARAMID)( 5683 << 14)
+#define MC_XF_ROI_WRF_LastTOI19_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI19_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset19                (MCPARAMID)( 5684 << 14)
+#define MC_XF_ROI_WRF_TOIPitch19                 (MCPARAMID)( 5685 << 14)
+#define MC_XF_ROI_WRF_NbOfLine19                 (MCPARAMID)( 5686 << 14)
+#define MC_XF_ROI_WRF_1stLineRep20               (MCPARAMID)( 5687 << 14)
+#define MC_XF_ROI_WRF_1stLineRep20_ON              1
+#define MC_XF_ROI_WRF_1stLineRep20_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep20              (MCPARAMID)( 5688 << 14)
+#define MC_XF_ROI_WRF_LastLineRep20_ON             1
+#define MC_XF_ROI_WRF_LastLineRep20_OFF            2
+#define MC_XF_ROI_WRF_1stColRep20                (MCPARAMID)( 5689 << 14)
+#define MC_XF_ROI_WRF_1stColRep20_ON               1
+#define MC_XF_ROI_WRF_1stColRep20_OFF              2
+#define MC_XF_ROI_WRF_LastColRep20               (MCPARAMID)( 5690 << 14)
+#define MC_XF_ROI_WRF_LastColRep20_ON              1
+#define MC_XF_ROI_WRF_LastColRep20_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx20                 (MCPARAMID)( 5691 << 14)
+#define MC_XF_ROI_WRF_TOIwidth20                 (MCPARAMID)( 5692 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI20       (MCPARAMID)( 5693 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI20       (MCPARAMID)( 5694 << 14)
+#define MC_XF_ROI_WRF_Line120                    (MCPARAMID)( 5695 << 14)
+#define MC_XF_ROI_WRF_Line120_GB                   1
+#define MC_XF_ROI_WRF_Line120_BG                   2
+#define MC_XF_ROI_WRF_Line120_RG                   3
+#define MC_XF_ROI_WRF_Line120_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1020              (MCPARAMID)( 5696 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1120              (MCPARAMID)( 5697 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1220              (MCPARAMID)( 5698 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1320              (MCPARAMID)( 5699 << 14)
+#define MC_XF_ROI_WRF_TOIheight20                (MCPARAMID)( 5700 << 14)
+#define MC_XF_ROI_WRF_LastTOI20                  (MCPARAMID)( 5701 << 14)
+#define MC_XF_ROI_WRF_LastTOI20_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI20_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset20                (MCPARAMID)( 5702 << 14)
+#define MC_XF_ROI_WRF_TOIPitch20                 (MCPARAMID)( 5703 << 14)
+#define MC_XF_ROI_WRF_NbOfLine20                 (MCPARAMID)( 5704 << 14)
+#define MC_XF_ROI_WRF_1stLineRep21               (MCPARAMID)( 5705 << 14)
+#define MC_XF_ROI_WRF_1stLineRep21_ON              1
+#define MC_XF_ROI_WRF_1stLineRep21_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep21              (MCPARAMID)( 5706 << 14)
+#define MC_XF_ROI_WRF_LastLineRep21_ON             1
+#define MC_XF_ROI_WRF_LastLineRep21_OFF            2
+#define MC_XF_ROI_WRF_1stColRep21                (MCPARAMID)( 5707 << 14)
+#define MC_XF_ROI_WRF_1stColRep21_ON               1
+#define MC_XF_ROI_WRF_1stColRep21_OFF              2
+#define MC_XF_ROI_WRF_LastColRep21               (MCPARAMID)( 5708 << 14)
+#define MC_XF_ROI_WRF_LastColRep21_ON              1
+#define MC_XF_ROI_WRF_LastColRep21_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx21                 (MCPARAMID)( 5709 << 14)
+#define MC_XF_ROI_WRF_TOIwidth21                 (MCPARAMID)( 5710 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI21       (MCPARAMID)( 5711 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI21       (MCPARAMID)( 5712 << 14)
+#define MC_XF_ROI_WRF_Line121                    (MCPARAMID)( 5713 << 14)
+#define MC_XF_ROI_WRF_Line121_GB                   1
+#define MC_XF_ROI_WRF_Line121_BG                   2
+#define MC_XF_ROI_WRF_Line121_RG                   3
+#define MC_XF_ROI_WRF_Line121_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1021              (MCPARAMID)( 5714 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1121              (MCPARAMID)( 5715 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1221              (MCPARAMID)( 5716 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1321              (MCPARAMID)( 5717 << 14)
+#define MC_XF_ROI_WRF_TOIheight21                (MCPARAMID)( 5718 << 14)
+#define MC_XF_ROI_WRF_LastTOI21                  (MCPARAMID)( 5719 << 14)
+#define MC_XF_ROI_WRF_LastTOI21_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI21_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset21                (MCPARAMID)( 5720 << 14)
+#define MC_XF_ROI_WRF_TOIPitch21                 (MCPARAMID)( 5721 << 14)
+#define MC_XF_ROI_WRF_NbOfLine21                 (MCPARAMID)( 5722 << 14)
+#define MC_XF_ROI_WRF_1stLineRep22               (MCPARAMID)( 5723 << 14)
+#define MC_XF_ROI_WRF_1stLineRep22_ON              1
+#define MC_XF_ROI_WRF_1stLineRep22_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep22              (MCPARAMID)( 5724 << 14)
+#define MC_XF_ROI_WRF_LastLineRep22_ON             1
+#define MC_XF_ROI_WRF_LastLineRep22_OFF            2
+#define MC_XF_ROI_WRF_1stColRep22                (MCPARAMID)( 5725 << 14)
+#define MC_XF_ROI_WRF_1stColRep22_ON               1
+#define MC_XF_ROI_WRF_1stColRep22_OFF              2
+#define MC_XF_ROI_WRF_LastColRep22               (MCPARAMID)( 5726 << 14)
+#define MC_XF_ROI_WRF_LastColRep22_ON              1
+#define MC_XF_ROI_WRF_LastColRep22_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx22                 (MCPARAMID)( 5727 << 14)
+#define MC_XF_ROI_WRF_TOIwidth22                 (MCPARAMID)( 5728 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI22       (MCPARAMID)( 5729 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI22       (MCPARAMID)( 5730 << 14)
+#define MC_XF_ROI_WRF_Line122                    (MCPARAMID)( 5731 << 14)
+#define MC_XF_ROI_WRF_Line122_GB                   1
+#define MC_XF_ROI_WRF_Line122_BG                   2
+#define MC_XF_ROI_WRF_Line122_RG                   3
+#define MC_XF_ROI_WRF_Line122_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1022              (MCPARAMID)( 5732 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1122              (MCPARAMID)( 5733 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1222              (MCPARAMID)( 5734 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1322              (MCPARAMID)( 5735 << 14)
+#define MC_XF_ROI_WRF_TOIheight22                (MCPARAMID)( 5736 << 14)
+#define MC_XF_ROI_WRF_LastTOI22                  (MCPARAMID)( 5737 << 14)
+#define MC_XF_ROI_WRF_LastTOI22_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI22_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset22                (MCPARAMID)( 5738 << 14)
+#define MC_XF_ROI_WRF_TOIPitch22                 (MCPARAMID)( 5739 << 14)
+#define MC_XF_ROI_WRF_NbOfLine22                 (MCPARAMID)( 5740 << 14)
+#define MC_XF_ROI_WRF_1stLineRep23               (MCPARAMID)( 5741 << 14)
+#define MC_XF_ROI_WRF_1stLineRep23_ON              1
+#define MC_XF_ROI_WRF_1stLineRep23_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep23              (MCPARAMID)( 5742 << 14)
+#define MC_XF_ROI_WRF_LastLineRep23_ON             1
+#define MC_XF_ROI_WRF_LastLineRep23_OFF            2
+#define MC_XF_ROI_WRF_1stColRep23                (MCPARAMID)( 5743 << 14)
+#define MC_XF_ROI_WRF_1stColRep23_ON               1
+#define MC_XF_ROI_WRF_1stColRep23_OFF              2
+#define MC_XF_ROI_WRF_LastColRep23               (MCPARAMID)( 5744 << 14)
+#define MC_XF_ROI_WRF_LastColRep23_ON              1
+#define MC_XF_ROI_WRF_LastColRep23_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx23                 (MCPARAMID)( 5745 << 14)
+#define MC_XF_ROI_WRF_TOIwidth23                 (MCPARAMID)( 5746 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI23       (MCPARAMID)( 5747 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI23       (MCPARAMID)( 5748 << 14)
+#define MC_XF_ROI_WRF_Line123                    (MCPARAMID)( 5749 << 14)
+#define MC_XF_ROI_WRF_Line123_GB                   1
+#define MC_XF_ROI_WRF_Line123_BG                   2
+#define MC_XF_ROI_WRF_Line123_RG                   3
+#define MC_XF_ROI_WRF_Line123_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1023              (MCPARAMID)( 5750 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1123              (MCPARAMID)( 5751 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1223              (MCPARAMID)( 5752 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1323              (MCPARAMID)( 5753 << 14)
+#define MC_XF_ROI_WRF_TOIheight23                (MCPARAMID)( 5754 << 14)
+#define MC_XF_ROI_WRF_LastTOI23                  (MCPARAMID)( 5755 << 14)
+#define MC_XF_ROI_WRF_LastTOI23_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI23_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset23                (MCPARAMID)( 5756 << 14)
+#define MC_XF_ROI_WRF_TOIPitch23                 (MCPARAMID)( 5757 << 14)
+#define MC_XF_ROI_WRF_NbOfLine23                 (MCPARAMID)( 5758 << 14)
+#define MC_XF_ROI_WRF_1stLineRep24               (MCPARAMID)( 5759 << 14)
+#define MC_XF_ROI_WRF_1stLineRep24_ON              1
+#define MC_XF_ROI_WRF_1stLineRep24_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep24              (MCPARAMID)( 5760 << 14)
+#define MC_XF_ROI_WRF_LastLineRep24_ON             1
+#define MC_XF_ROI_WRF_LastLineRep24_OFF            2
+#define MC_XF_ROI_WRF_1stColRep24                (MCPARAMID)( 5761 << 14)
+#define MC_XF_ROI_WRF_1stColRep24_ON               1
+#define MC_XF_ROI_WRF_1stColRep24_OFF              2
+#define MC_XF_ROI_WRF_LastColRep24               (MCPARAMID)( 5762 << 14)
+#define MC_XF_ROI_WRF_LastColRep24_ON              1
+#define MC_XF_ROI_WRF_LastColRep24_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx24                 (MCPARAMID)( 5763 << 14)
+#define MC_XF_ROI_WRF_TOIwidth24                 (MCPARAMID)( 5764 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI24       (MCPARAMID)( 5765 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI24       (MCPARAMID)( 5766 << 14)
+#define MC_XF_ROI_WRF_Line124                    (MCPARAMID)( 5767 << 14)
+#define MC_XF_ROI_WRF_Line124_GB                   1
+#define MC_XF_ROI_WRF_Line124_BG                   2
+#define MC_XF_ROI_WRF_Line124_RG                   3
+#define MC_XF_ROI_WRF_Line124_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1024              (MCPARAMID)( 5768 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1124              (MCPARAMID)( 5769 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1224              (MCPARAMID)( 5770 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1324              (MCPARAMID)( 5771 << 14)
+#define MC_XF_ROI_WRF_TOIheight24                (MCPARAMID)( 5772 << 14)
+#define MC_XF_ROI_WRF_LastTOI24                  (MCPARAMID)( 5773 << 14)
+#define MC_XF_ROI_WRF_LastTOI24_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI24_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset24                (MCPARAMID)( 5774 << 14)
+#define MC_XF_ROI_WRF_TOIPitch24                 (MCPARAMID)( 5775 << 14)
+#define MC_XF_ROI_WRF_NbOfLine24                 (MCPARAMID)( 5776 << 14)
+#define MC_XF_ROI_WRF_1stLineRep25               (MCPARAMID)( 5777 << 14)
+#define MC_XF_ROI_WRF_1stLineRep25_ON              1
+#define MC_XF_ROI_WRF_1stLineRep25_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep25              (MCPARAMID)( 5778 << 14)
+#define MC_XF_ROI_WRF_LastLineRep25_ON             1
+#define MC_XF_ROI_WRF_LastLineRep25_OFF            2
+#define MC_XF_ROI_WRF_1stColRep25                (MCPARAMID)( 5779 << 14)
+#define MC_XF_ROI_WRF_1stColRep25_ON               1
+#define MC_XF_ROI_WRF_1stColRep25_OFF              2
+#define MC_XF_ROI_WRF_LastColRep25               (MCPARAMID)( 5780 << 14)
+#define MC_XF_ROI_WRF_LastColRep25_ON              1
+#define MC_XF_ROI_WRF_LastColRep25_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx25                 (MCPARAMID)( 5781 << 14)
+#define MC_XF_ROI_WRF_TOIwidth25                 (MCPARAMID)( 5782 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI25       (MCPARAMID)( 5783 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI25       (MCPARAMID)( 5784 << 14)
+#define MC_XF_ROI_WRF_Line125                    (MCPARAMID)( 5785 << 14)
+#define MC_XF_ROI_WRF_Line125_GB                   1
+#define MC_XF_ROI_WRF_Line125_BG                   2
+#define MC_XF_ROI_WRF_Line125_RG                   3
+#define MC_XF_ROI_WRF_Line125_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1025              (MCPARAMID)( 5786 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1125              (MCPARAMID)( 5787 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1225              (MCPARAMID)( 5788 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1325              (MCPARAMID)( 5789 << 14)
+#define MC_XF_ROI_WRF_TOIheight25                (MCPARAMID)( 5790 << 14)
+#define MC_XF_ROI_WRF_LastTOI25                  (MCPARAMID)( 5791 << 14)
+#define MC_XF_ROI_WRF_LastTOI25_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI25_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset25                (MCPARAMID)( 5792 << 14)
+#define MC_XF_ROI_WRF_TOIPitch25                 (MCPARAMID)( 5793 << 14)
+#define MC_XF_ROI_WRF_NbOfLine25                 (MCPARAMID)( 5794 << 14)
+#define MC_XF_ROI_WRF_1stLineRep26               (MCPARAMID)( 5795 << 14)
+#define MC_XF_ROI_WRF_1stLineRep26_ON              1
+#define MC_XF_ROI_WRF_1stLineRep26_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep26              (MCPARAMID)( 5796 << 14)
+#define MC_XF_ROI_WRF_LastLineRep26_ON             1
+#define MC_XF_ROI_WRF_LastLineRep26_OFF            2
+#define MC_XF_ROI_WRF_1stColRep26                (MCPARAMID)( 5797 << 14)
+#define MC_XF_ROI_WRF_1stColRep26_ON               1
+#define MC_XF_ROI_WRF_1stColRep26_OFF              2
+#define MC_XF_ROI_WRF_LastColRep26               (MCPARAMID)( 5798 << 14)
+#define MC_XF_ROI_WRF_LastColRep26_ON              1
+#define MC_XF_ROI_WRF_LastColRep26_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx26                 (MCPARAMID)( 5799 << 14)
+#define MC_XF_ROI_WRF_TOIwidth26                 (MCPARAMID)( 5800 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI26       (MCPARAMID)( 5801 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI26       (MCPARAMID)( 5802 << 14)
+#define MC_XF_ROI_WRF_Line126                    (MCPARAMID)( 5803 << 14)
+#define MC_XF_ROI_WRF_Line126_GB                   1
+#define MC_XF_ROI_WRF_Line126_BG                   2
+#define MC_XF_ROI_WRF_Line126_RG                   3
+#define MC_XF_ROI_WRF_Line126_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1026              (MCPARAMID)( 5804 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1126              (MCPARAMID)( 5805 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1226              (MCPARAMID)( 5806 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1326              (MCPARAMID)( 5807 << 14)
+#define MC_XF_ROI_WRF_TOIheight26                (MCPARAMID)( 5808 << 14)
+#define MC_XF_ROI_WRF_LastTOI26                  (MCPARAMID)( 5809 << 14)
+#define MC_XF_ROI_WRF_LastTOI26_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI26_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset26                (MCPARAMID)( 5810 << 14)
+#define MC_XF_ROI_WRF_TOIPitch26                 (MCPARAMID)( 5811 << 14)
+#define MC_XF_ROI_WRF_NbOfLine26                 (MCPARAMID)( 5812 << 14)
+#define MC_XF_ROI_WRF_1stLineRep27               (MCPARAMID)( 5813 << 14)
+#define MC_XF_ROI_WRF_1stLineRep27_ON              1
+#define MC_XF_ROI_WRF_1stLineRep27_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep27              (MCPARAMID)( 5814 << 14)
+#define MC_XF_ROI_WRF_LastLineRep27_ON             1
+#define MC_XF_ROI_WRF_LastLineRep27_OFF            2
+#define MC_XF_ROI_WRF_1stColRep27                (MCPARAMID)( 5815 << 14)
+#define MC_XF_ROI_WRF_1stColRep27_ON               1
+#define MC_XF_ROI_WRF_1stColRep27_OFF              2
+#define MC_XF_ROI_WRF_LastColRep27               (MCPARAMID)( 5816 << 14)
+#define MC_XF_ROI_WRF_LastColRep27_ON              1
+#define MC_XF_ROI_WRF_LastColRep27_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx27                 (MCPARAMID)( 5817 << 14)
+#define MC_XF_ROI_WRF_TOIwidth27                 (MCPARAMID)( 5818 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI27       (MCPARAMID)( 5819 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI27       (MCPARAMID)( 5820 << 14)
+#define MC_XF_ROI_WRF_Line127                    (MCPARAMID)( 5821 << 14)
+#define MC_XF_ROI_WRF_Line127_GB                   1
+#define MC_XF_ROI_WRF_Line127_BG                   2
+#define MC_XF_ROI_WRF_Line127_RG                   3
+#define MC_XF_ROI_WRF_Line127_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1027              (MCPARAMID)( 5822 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1127              (MCPARAMID)( 5823 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1227              (MCPARAMID)( 5824 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1327              (MCPARAMID)( 5825 << 14)
+#define MC_XF_ROI_WRF_TOIheight27                (MCPARAMID)( 5826 << 14)
+#define MC_XF_ROI_WRF_LastTOI27                  (MCPARAMID)( 5827 << 14)
+#define MC_XF_ROI_WRF_LastTOI27_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI27_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset27                (MCPARAMID)( 5828 << 14)
+#define MC_XF_ROI_WRF_TOIPitch27                 (MCPARAMID)( 5829 << 14)
+#define MC_XF_ROI_WRF_NbOfLine27                 (MCPARAMID)( 5830 << 14)
+#define MC_XF_ROI_WRF_1stLineRep28               (MCPARAMID)( 5831 << 14)
+#define MC_XF_ROI_WRF_1stLineRep28_ON              1
+#define MC_XF_ROI_WRF_1stLineRep28_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep28              (MCPARAMID)( 5832 << 14)
+#define MC_XF_ROI_WRF_LastLineRep28_ON             1
+#define MC_XF_ROI_WRF_LastLineRep28_OFF            2
+#define MC_XF_ROI_WRF_1stColRep28                (MCPARAMID)( 5833 << 14)
+#define MC_XF_ROI_WRF_1stColRep28_ON               1
+#define MC_XF_ROI_WRF_1stColRep28_OFF              2
+#define MC_XF_ROI_WRF_LastColRep28               (MCPARAMID)( 5834 << 14)
+#define MC_XF_ROI_WRF_LastColRep28_ON              1
+#define MC_XF_ROI_WRF_LastColRep28_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx28                 (MCPARAMID)( 5835 << 14)
+#define MC_XF_ROI_WRF_TOIwidth28                 (MCPARAMID)( 5836 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI28       (MCPARAMID)( 5837 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI28       (MCPARAMID)( 5838 << 14)
+#define MC_XF_ROI_WRF_Line128                    (MCPARAMID)( 5839 << 14)
+#define MC_XF_ROI_WRF_Line128_GB                   1
+#define MC_XF_ROI_WRF_Line128_BG                   2
+#define MC_XF_ROI_WRF_Line128_RG                   3
+#define MC_XF_ROI_WRF_Line128_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1028              (MCPARAMID)( 5840 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1128              (MCPARAMID)( 5841 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1228              (MCPARAMID)( 5842 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1328              (MCPARAMID)( 5843 << 14)
+#define MC_XF_ROI_WRF_TOIheight28                (MCPARAMID)( 5844 << 14)
+#define MC_XF_ROI_WRF_LastTOI28                  (MCPARAMID)( 5845 << 14)
+#define MC_XF_ROI_WRF_LastTOI28_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI28_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset28                (MCPARAMID)( 5846 << 14)
+#define MC_XF_ROI_WRF_TOIPitch28                 (MCPARAMID)( 5847 << 14)
+#define MC_XF_ROI_WRF_NbOfLine28                 (MCPARAMID)( 5848 << 14)
+#define MC_XF_ROI_WRF_1stLineRep29               (MCPARAMID)( 5849 << 14)
+#define MC_XF_ROI_WRF_1stLineRep29_ON              1
+#define MC_XF_ROI_WRF_1stLineRep29_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep29              (MCPARAMID)( 5850 << 14)
+#define MC_XF_ROI_WRF_LastLineRep29_ON             1
+#define MC_XF_ROI_WRF_LastLineRep29_OFF            2
+#define MC_XF_ROI_WRF_1stColRep29                (MCPARAMID)( 5851 << 14)
+#define MC_XF_ROI_WRF_1stColRep29_ON               1
+#define MC_XF_ROI_WRF_1stColRep29_OFF              2
+#define MC_XF_ROI_WRF_LastColRep29               (MCPARAMID)( 5852 << 14)
+#define MC_XF_ROI_WRF_LastColRep29_ON              1
+#define MC_XF_ROI_WRF_LastColRep29_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx29                 (MCPARAMID)( 5853 << 14)
+#define MC_XF_ROI_WRF_TOIwidth29                 (MCPARAMID)( 5854 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI29       (MCPARAMID)( 5855 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI29       (MCPARAMID)( 5856 << 14)
+#define MC_XF_ROI_WRF_Line129                    (MCPARAMID)( 5857 << 14)
+#define MC_XF_ROI_WRF_Line129_GB                   1
+#define MC_XF_ROI_WRF_Line129_BG                   2
+#define MC_XF_ROI_WRF_Line129_RG                   3
+#define MC_XF_ROI_WRF_Line129_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1029              (MCPARAMID)( 5858 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1129              (MCPARAMID)( 5859 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1229              (MCPARAMID)( 5860 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1329              (MCPARAMID)( 5861 << 14)
+#define MC_XF_ROI_WRF_TOIheight29                (MCPARAMID)( 5862 << 14)
+#define MC_XF_ROI_WRF_LastTOI29                  (MCPARAMID)( 5863 << 14)
+#define MC_XF_ROI_WRF_LastTOI29_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI29_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset29                (MCPARAMID)( 5864 << 14)
+#define MC_XF_ROI_WRF_TOIPitch29                 (MCPARAMID)( 5865 << 14)
+#define MC_XF_ROI_WRF_NbOfLine29                 (MCPARAMID)( 5866 << 14)
+#define MC_XF_ROI_WRF_1stLineRep30               (MCPARAMID)( 5867 << 14)
+#define MC_XF_ROI_WRF_1stLineRep30_ON              1
+#define MC_XF_ROI_WRF_1stLineRep30_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep30              (MCPARAMID)( 5868 << 14)
+#define MC_XF_ROI_WRF_LastLineRep30_ON             1
+#define MC_XF_ROI_WRF_LastLineRep30_OFF            2
+#define MC_XF_ROI_WRF_1stColRep30                (MCPARAMID)( 5869 << 14)
+#define MC_XF_ROI_WRF_1stColRep30_ON               1
+#define MC_XF_ROI_WRF_1stColRep30_OFF              2
+#define MC_XF_ROI_WRF_LastColRep30               (MCPARAMID)( 5870 << 14)
+#define MC_XF_ROI_WRF_LastColRep30_ON              1
+#define MC_XF_ROI_WRF_LastColRep30_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx30                 (MCPARAMID)( 5871 << 14)
+#define MC_XF_ROI_WRF_TOIwidth30                 (MCPARAMID)( 5872 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI30       (MCPARAMID)( 5873 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI30       (MCPARAMID)( 5874 << 14)
+#define MC_XF_ROI_WRF_Line130                    (MCPARAMID)( 5875 << 14)
+#define MC_XF_ROI_WRF_Line130_GB                   1
+#define MC_XF_ROI_WRF_Line130_BG                   2
+#define MC_XF_ROI_WRF_Line130_RG                   3
+#define MC_XF_ROI_WRF_Line130_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1030              (MCPARAMID)( 5876 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1130              (MCPARAMID)( 5877 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1230              (MCPARAMID)( 5878 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1330              (MCPARAMID)( 5879 << 14)
+#define MC_XF_ROI_WRF_TOIheight30                (MCPARAMID)( 5880 << 14)
+#define MC_XF_ROI_WRF_LastTOI30                  (MCPARAMID)( 5881 << 14)
+#define MC_XF_ROI_WRF_LastTOI30_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI30_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset30                (MCPARAMID)( 5882 << 14)
+#define MC_XF_ROI_WRF_TOIPitch30                 (MCPARAMID)( 5883 << 14)
+#define MC_XF_ROI_WRF_NbOfLine30                 (MCPARAMID)( 5884 << 14)
+#define MC_XF_ROI_WRF_1stLineRep31               (MCPARAMID)( 5885 << 14)
+#define MC_XF_ROI_WRF_1stLineRep31_ON              1
+#define MC_XF_ROI_WRF_1stLineRep31_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep31              (MCPARAMID)( 5886 << 14)
+#define MC_XF_ROI_WRF_LastLineRep31_ON             1
+#define MC_XF_ROI_WRF_LastLineRep31_OFF            2
+#define MC_XF_ROI_WRF_1stColRep31                (MCPARAMID)( 5887 << 14)
+#define MC_XF_ROI_WRF_1stColRep31_ON               1
+#define MC_XF_ROI_WRF_1stColRep31_OFF              2
+#define MC_XF_ROI_WRF_LastColRep31               (MCPARAMID)( 5888 << 14)
+#define MC_XF_ROI_WRF_LastColRep31_ON              1
+#define MC_XF_ROI_WRF_LastColRep31_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx31                 (MCPARAMID)( 5889 << 14)
+#define MC_XF_ROI_WRF_TOIwidth31                 (MCPARAMID)( 5890 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI31       (MCPARAMID)( 5891 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI31       (MCPARAMID)( 5892 << 14)
+#define MC_XF_ROI_WRF_Line131                    (MCPARAMID)( 5893 << 14)
+#define MC_XF_ROI_WRF_Line131_GB                   1
+#define MC_XF_ROI_WRF_Line131_BG                   2
+#define MC_XF_ROI_WRF_Line131_RG                   3
+#define MC_XF_ROI_WRF_Line131_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1031              (MCPARAMID)( 5894 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1131              (MCPARAMID)( 5895 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1231              (MCPARAMID)( 5896 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1331              (MCPARAMID)( 5897 << 14)
+#define MC_XF_ROI_WRF_TOIheight31                (MCPARAMID)( 5898 << 14)
+#define MC_XF_ROI_WRF_LastTOI31                  (MCPARAMID)( 5899 << 14)
+#define MC_XF_ROI_WRF_LastTOI31_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI31_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset31                (MCPARAMID)( 5900 << 14)
+#define MC_XF_ROI_WRF_TOIPitch31                 (MCPARAMID)( 5901 << 14)
+#define MC_XF_ROI_WRF_NbOfLine31                 (MCPARAMID)( 5902 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep8               (MCPARAMID)( 5903 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep8_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep8_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep8              (MCPARAMID)( 5904 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep8_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep8_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep8                (MCPARAMID)( 5905 << 14)
+#define MC_AWB_ROI_WRF_1stColRep8_ON               1
+#define MC_AWB_ROI_WRF_1stColRep8_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep8               (MCPARAMID)( 5906 << 14)
+#define MC_AWB_ROI_WRF_LastColRep8_ON              1
+#define MC_AWB_ROI_WRF_LastColRep8_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx8                 (MCPARAMID)( 5907 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth8                 (MCPARAMID)( 5908 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI8       (MCPARAMID)( 5909 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI8       (MCPARAMID)( 5910 << 14)
+#define MC_AWB_ROI_WRF_Line18                    (MCPARAMID)( 5911 << 14)
+#define MC_AWB_ROI_WRF_Line18_GB                   1
+#define MC_AWB_ROI_WRF_Line18_BG                   2
+#define MC_AWB_ROI_WRF_Line18_RG                   3
+#define MC_AWB_ROI_WRF_Line18_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM108              (MCPARAMID)( 5912 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM118              (MCPARAMID)( 5913 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM128              (MCPARAMID)( 5914 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM138              (MCPARAMID)( 5915 << 14)
+#define MC_AWB_ROI_WRF_TOIheight8                (MCPARAMID)( 5916 << 14)
+#define MC_AWB_ROI_WRF_LastTOI8                  (MCPARAMID)( 5917 << 14)
+#define MC_AWB_ROI_WRF_LastTOI8_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI8_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset8                (MCPARAMID)( 5918 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch8                 (MCPARAMID)( 5919 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine8                 (MCPARAMID)( 5920 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep9               (MCPARAMID)( 5921 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep9_ON              1
+#define MC_AWB_ROI_WRF_1stLineRep9_OFF             2
+#define MC_AWB_ROI_WRF_LastLineRep9              (MCPARAMID)( 5922 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep9_ON             1
+#define MC_AWB_ROI_WRF_LastLineRep9_OFF            2
+#define MC_AWB_ROI_WRF_1stColRep9                (MCPARAMID)( 5923 << 14)
+#define MC_AWB_ROI_WRF_1stColRep9_ON               1
+#define MC_AWB_ROI_WRF_1stColRep9_OFF              2
+#define MC_AWB_ROI_WRF_LastColRep9               (MCPARAMID)( 5924 << 14)
+#define MC_AWB_ROI_WRF_LastColRep9_ON              1
+#define MC_AWB_ROI_WRF_LastColRep9_OFF             2
+#define MC_AWB_ROI_WRF_ColumnIx9                 (MCPARAMID)( 5925 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth9                 (MCPARAMID)( 5926 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI9       (MCPARAMID)( 5927 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI9       (MCPARAMID)( 5928 << 14)
+#define MC_AWB_ROI_WRF_Line19                    (MCPARAMID)( 5929 << 14)
+#define MC_AWB_ROI_WRF_Line19_GB                   1
+#define MC_AWB_ROI_WRF_Line19_BG                   2
+#define MC_AWB_ROI_WRF_Line19_RG                   3
+#define MC_AWB_ROI_WRF_Line19_GR                   4
+#define MC_AWB_ROI_WRF_XferSizeM109              (MCPARAMID)( 5930 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM119              (MCPARAMID)( 5931 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM129              (MCPARAMID)( 5932 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM139              (MCPARAMID)( 5933 << 14)
+#define MC_AWB_ROI_WRF_TOIheight9                (MCPARAMID)( 5934 << 14)
+#define MC_AWB_ROI_WRF_LastTOI9                  (MCPARAMID)( 5935 << 14)
+#define MC_AWB_ROI_WRF_LastTOI9_TRUE               1
+#define MC_AWB_ROI_WRF_LastTOI9_FALSE              2
+#define MC_AWB_ROI_WRF_TOIoffset9                (MCPARAMID)( 5936 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch9                 (MCPARAMID)( 5937 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine9                 (MCPARAMID)( 5938 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep10              (MCPARAMID)( 5939 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep10_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep10_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep10             (MCPARAMID)( 5940 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep10_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep10_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep10               (MCPARAMID)( 5941 << 14)
+#define MC_AWB_ROI_WRF_1stColRep10_ON              1
+#define MC_AWB_ROI_WRF_1stColRep10_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep10              (MCPARAMID)( 5942 << 14)
+#define MC_AWB_ROI_WRF_LastColRep10_ON             1
+#define MC_AWB_ROI_WRF_LastColRep10_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx10                (MCPARAMID)( 5943 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth10                (MCPARAMID)( 5944 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI10      (MCPARAMID)( 5945 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI10      (MCPARAMID)( 5946 << 14)
+#define MC_AWB_ROI_WRF_Line110                   (MCPARAMID)( 5947 << 14)
+#define MC_AWB_ROI_WRF_Line110_GB                  1
+#define MC_AWB_ROI_WRF_Line110_BG                  2
+#define MC_AWB_ROI_WRF_Line110_RG                  3
+#define MC_AWB_ROI_WRF_Line110_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1010             (MCPARAMID)( 5948 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1110             (MCPARAMID)( 5949 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1210             (MCPARAMID)( 5950 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1310             (MCPARAMID)( 5951 << 14)
+#define MC_AWB_ROI_WRF_TOIheight10               (MCPARAMID)( 5952 << 14)
+#define MC_AWB_ROI_WRF_LastTOI10                 (MCPARAMID)( 5953 << 14)
+#define MC_AWB_ROI_WRF_LastTOI10_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI10_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset10               (MCPARAMID)( 5954 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch10                (MCPARAMID)( 5955 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine10                (MCPARAMID)( 5956 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep11              (MCPARAMID)( 5957 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep11_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep11_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep11             (MCPARAMID)( 5958 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep11_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep11_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep11               (MCPARAMID)( 5959 << 14)
+#define MC_AWB_ROI_WRF_1stColRep11_ON              1
+#define MC_AWB_ROI_WRF_1stColRep11_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep11              (MCPARAMID)( 5960 << 14)
+#define MC_AWB_ROI_WRF_LastColRep11_ON             1
+#define MC_AWB_ROI_WRF_LastColRep11_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx11                (MCPARAMID)( 5961 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth11                (MCPARAMID)( 5962 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI11      (MCPARAMID)( 5963 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI11      (MCPARAMID)( 5964 << 14)
+#define MC_AWB_ROI_WRF_Line111                   (MCPARAMID)( 5965 << 14)
+#define MC_AWB_ROI_WRF_Line111_GB                  1
+#define MC_AWB_ROI_WRF_Line111_BG                  2
+#define MC_AWB_ROI_WRF_Line111_RG                  3
+#define MC_AWB_ROI_WRF_Line111_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1011             (MCPARAMID)( 5966 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1111             (MCPARAMID)( 5967 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1211             (MCPARAMID)( 5968 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1311             (MCPARAMID)( 5969 << 14)
+#define MC_AWB_ROI_WRF_TOIheight11               (MCPARAMID)( 5970 << 14)
+#define MC_AWB_ROI_WRF_LastTOI11                 (MCPARAMID)( 5971 << 14)
+#define MC_AWB_ROI_WRF_LastTOI11_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI11_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset11               (MCPARAMID)( 5972 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch11                (MCPARAMID)( 5973 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine11                (MCPARAMID)( 5974 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep12              (MCPARAMID)( 5975 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep12_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep12_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep12             (MCPARAMID)( 5976 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep12_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep12_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep12               (MCPARAMID)( 5977 << 14)
+#define MC_AWB_ROI_WRF_1stColRep12_ON              1
+#define MC_AWB_ROI_WRF_1stColRep12_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep12              (MCPARAMID)( 5978 << 14)
+#define MC_AWB_ROI_WRF_LastColRep12_ON             1
+#define MC_AWB_ROI_WRF_LastColRep12_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx12                (MCPARAMID)( 5979 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth12                (MCPARAMID)( 5980 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI12      (MCPARAMID)( 5981 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI12      (MCPARAMID)( 5982 << 14)
+#define MC_AWB_ROI_WRF_Line112                   (MCPARAMID)( 5983 << 14)
+#define MC_AWB_ROI_WRF_Line112_GB                  1
+#define MC_AWB_ROI_WRF_Line112_BG                  2
+#define MC_AWB_ROI_WRF_Line112_RG                  3
+#define MC_AWB_ROI_WRF_Line112_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1012             (MCPARAMID)( 5984 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1112             (MCPARAMID)( 5985 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1212             (MCPARAMID)( 5986 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1312             (MCPARAMID)( 5987 << 14)
+#define MC_AWB_ROI_WRF_TOIheight12               (MCPARAMID)( 5988 << 14)
+#define MC_AWB_ROI_WRF_LastTOI12                 (MCPARAMID)( 5989 << 14)
+#define MC_AWB_ROI_WRF_LastTOI12_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI12_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset12               (MCPARAMID)( 5990 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch12                (MCPARAMID)( 5991 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine12                (MCPARAMID)( 5992 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep13              (MCPARAMID)( 5993 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep13_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep13_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep13             (MCPARAMID)( 5994 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep13_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep13_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep13               (MCPARAMID)( 5995 << 14)
+#define MC_AWB_ROI_WRF_1stColRep13_ON              1
+#define MC_AWB_ROI_WRF_1stColRep13_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep13              (MCPARAMID)( 5996 << 14)
+#define MC_AWB_ROI_WRF_LastColRep13_ON             1
+#define MC_AWB_ROI_WRF_LastColRep13_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx13                (MCPARAMID)( 5997 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth13                (MCPARAMID)( 5998 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI13      (MCPARAMID)( 5999 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI13      (MCPARAMID)( 6000 << 14)
+#define MC_AWB_ROI_WRF_Line113                   (MCPARAMID)( 6001 << 14)
+#define MC_AWB_ROI_WRF_Line113_GB                  1
+#define MC_AWB_ROI_WRF_Line113_BG                  2
+#define MC_AWB_ROI_WRF_Line113_RG                  3
+#define MC_AWB_ROI_WRF_Line113_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1013             (MCPARAMID)( 6002 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1113             (MCPARAMID)( 6003 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1213             (MCPARAMID)( 6004 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1313             (MCPARAMID)( 6005 << 14)
+#define MC_AWB_ROI_WRF_TOIheight13               (MCPARAMID)( 6006 << 14)
+#define MC_AWB_ROI_WRF_LastTOI13                 (MCPARAMID)( 6007 << 14)
+#define MC_AWB_ROI_WRF_LastTOI13_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI13_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset13               (MCPARAMID)( 6008 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch13                (MCPARAMID)( 6009 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine13                (MCPARAMID)( 6010 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep14              (MCPARAMID)( 6011 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep14_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep14_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep14             (MCPARAMID)( 6012 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep14_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep14_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep14               (MCPARAMID)( 6013 << 14)
+#define MC_AWB_ROI_WRF_1stColRep14_ON              1
+#define MC_AWB_ROI_WRF_1stColRep14_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep14              (MCPARAMID)( 6014 << 14)
+#define MC_AWB_ROI_WRF_LastColRep14_ON             1
+#define MC_AWB_ROI_WRF_LastColRep14_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx14                (MCPARAMID)( 6015 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth14                (MCPARAMID)( 6016 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI14      (MCPARAMID)( 6017 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI14      (MCPARAMID)( 6018 << 14)
+#define MC_AWB_ROI_WRF_Line114                   (MCPARAMID)( 6019 << 14)
+#define MC_AWB_ROI_WRF_Line114_GB                  1
+#define MC_AWB_ROI_WRF_Line114_BG                  2
+#define MC_AWB_ROI_WRF_Line114_RG                  3
+#define MC_AWB_ROI_WRF_Line114_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1014             (MCPARAMID)( 6020 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1114             (MCPARAMID)( 6021 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1214             (MCPARAMID)( 6022 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1314             (MCPARAMID)( 6023 << 14)
+#define MC_AWB_ROI_WRF_TOIheight14               (MCPARAMID)( 6024 << 14)
+#define MC_AWB_ROI_WRF_LastTOI14                 (MCPARAMID)( 6025 << 14)
+#define MC_AWB_ROI_WRF_LastTOI14_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI14_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset14               (MCPARAMID)( 6026 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch14                (MCPARAMID)( 6027 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine14                (MCPARAMID)( 6028 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep15              (MCPARAMID)( 6029 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep15_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep15_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep15             (MCPARAMID)( 6030 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep15_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep15_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep15               (MCPARAMID)( 6031 << 14)
+#define MC_AWB_ROI_WRF_1stColRep15_ON              1
+#define MC_AWB_ROI_WRF_1stColRep15_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep15              (MCPARAMID)( 6032 << 14)
+#define MC_AWB_ROI_WRF_LastColRep15_ON             1
+#define MC_AWB_ROI_WRF_LastColRep15_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx15                (MCPARAMID)( 6033 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth15                (MCPARAMID)( 6034 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI15      (MCPARAMID)( 6035 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI15      (MCPARAMID)( 6036 << 14)
+#define MC_AWB_ROI_WRF_Line115                   (MCPARAMID)( 6037 << 14)
+#define MC_AWB_ROI_WRF_Line115_GB                  1
+#define MC_AWB_ROI_WRF_Line115_BG                  2
+#define MC_AWB_ROI_WRF_Line115_RG                  3
+#define MC_AWB_ROI_WRF_Line115_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1015             (MCPARAMID)( 6038 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1115             (MCPARAMID)( 6039 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1215             (MCPARAMID)( 6040 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1315             (MCPARAMID)( 6041 << 14)
+#define MC_AWB_ROI_WRF_TOIheight15               (MCPARAMID)( 6042 << 14)
+#define MC_AWB_ROI_WRF_LastTOI15                 (MCPARAMID)( 6043 << 14)
+#define MC_AWB_ROI_WRF_LastTOI15_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI15_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset15               (MCPARAMID)( 6044 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch15                (MCPARAMID)( 6045 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine15                (MCPARAMID)( 6046 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep16              (MCPARAMID)( 6047 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep16_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep16_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep16             (MCPARAMID)( 6048 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep16_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep16_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep16               (MCPARAMID)( 6049 << 14)
+#define MC_AWB_ROI_WRF_1stColRep16_ON              1
+#define MC_AWB_ROI_WRF_1stColRep16_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep16              (MCPARAMID)( 6050 << 14)
+#define MC_AWB_ROI_WRF_LastColRep16_ON             1
+#define MC_AWB_ROI_WRF_LastColRep16_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx16                (MCPARAMID)( 6051 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth16                (MCPARAMID)( 6052 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI16      (MCPARAMID)( 6053 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI16      (MCPARAMID)( 6054 << 14)
+#define MC_AWB_ROI_WRF_Line116                   (MCPARAMID)( 6055 << 14)
+#define MC_AWB_ROI_WRF_Line116_GB                  1
+#define MC_AWB_ROI_WRF_Line116_BG                  2
+#define MC_AWB_ROI_WRF_Line116_RG                  3
+#define MC_AWB_ROI_WRF_Line116_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1016             (MCPARAMID)( 6056 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1116             (MCPARAMID)( 6057 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1216             (MCPARAMID)( 6058 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1316             (MCPARAMID)( 6059 << 14)
+#define MC_AWB_ROI_WRF_TOIheight16               (MCPARAMID)( 6060 << 14)
+#define MC_AWB_ROI_WRF_LastTOI16                 (MCPARAMID)( 6061 << 14)
+#define MC_AWB_ROI_WRF_LastTOI16_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI16_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset16               (MCPARAMID)( 6062 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch16                (MCPARAMID)( 6063 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine16                (MCPARAMID)( 6064 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep17              (MCPARAMID)( 6065 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep17_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep17_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep17             (MCPARAMID)( 6066 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep17_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep17_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep17               (MCPARAMID)( 6067 << 14)
+#define MC_AWB_ROI_WRF_1stColRep17_ON              1
+#define MC_AWB_ROI_WRF_1stColRep17_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep17              (MCPARAMID)( 6068 << 14)
+#define MC_AWB_ROI_WRF_LastColRep17_ON             1
+#define MC_AWB_ROI_WRF_LastColRep17_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx17                (MCPARAMID)( 6069 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth17                (MCPARAMID)( 6070 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI17      (MCPARAMID)( 6071 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI17      (MCPARAMID)( 6072 << 14)
+#define MC_AWB_ROI_WRF_Line117                   (MCPARAMID)( 6073 << 14)
+#define MC_AWB_ROI_WRF_Line117_GB                  1
+#define MC_AWB_ROI_WRF_Line117_BG                  2
+#define MC_AWB_ROI_WRF_Line117_RG                  3
+#define MC_AWB_ROI_WRF_Line117_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1017             (MCPARAMID)( 6074 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1117             (MCPARAMID)( 6075 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1217             (MCPARAMID)( 6076 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1317             (MCPARAMID)( 6077 << 14)
+#define MC_AWB_ROI_WRF_TOIheight17               (MCPARAMID)( 6078 << 14)
+#define MC_AWB_ROI_WRF_LastTOI17                 (MCPARAMID)( 6079 << 14)
+#define MC_AWB_ROI_WRF_LastTOI17_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI17_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset17               (MCPARAMID)( 6080 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch17                (MCPARAMID)( 6081 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine17                (MCPARAMID)( 6082 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep18              (MCPARAMID)( 6083 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep18_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep18_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep18             (MCPARAMID)( 6084 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep18_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep18_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep18               (MCPARAMID)( 6085 << 14)
+#define MC_AWB_ROI_WRF_1stColRep18_ON              1
+#define MC_AWB_ROI_WRF_1stColRep18_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep18              (MCPARAMID)( 6086 << 14)
+#define MC_AWB_ROI_WRF_LastColRep18_ON             1
+#define MC_AWB_ROI_WRF_LastColRep18_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx18                (MCPARAMID)( 6087 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth18                (MCPARAMID)( 6088 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI18      (MCPARAMID)( 6089 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI18      (MCPARAMID)( 6090 << 14)
+#define MC_AWB_ROI_WRF_Line118                   (MCPARAMID)( 6091 << 14)
+#define MC_AWB_ROI_WRF_Line118_GB                  1
+#define MC_AWB_ROI_WRF_Line118_BG                  2
+#define MC_AWB_ROI_WRF_Line118_RG                  3
+#define MC_AWB_ROI_WRF_Line118_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1018             (MCPARAMID)( 6092 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1118             (MCPARAMID)( 6093 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1218             (MCPARAMID)( 6094 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1318             (MCPARAMID)( 6095 << 14)
+#define MC_AWB_ROI_WRF_TOIheight18               (MCPARAMID)( 6096 << 14)
+#define MC_AWB_ROI_WRF_LastTOI18                 (MCPARAMID)( 6097 << 14)
+#define MC_AWB_ROI_WRF_LastTOI18_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI18_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset18               (MCPARAMID)( 6098 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch18                (MCPARAMID)( 6099 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine18                (MCPARAMID)( 6100 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep19              (MCPARAMID)( 6101 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep19_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep19_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep19             (MCPARAMID)( 6102 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep19_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep19_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep19               (MCPARAMID)( 6103 << 14)
+#define MC_AWB_ROI_WRF_1stColRep19_ON              1
+#define MC_AWB_ROI_WRF_1stColRep19_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep19              (MCPARAMID)( 6104 << 14)
+#define MC_AWB_ROI_WRF_LastColRep19_ON             1
+#define MC_AWB_ROI_WRF_LastColRep19_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx19                (MCPARAMID)( 6105 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth19                (MCPARAMID)( 6106 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI19      (MCPARAMID)( 6107 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI19      (MCPARAMID)( 6108 << 14)
+#define MC_AWB_ROI_WRF_Line119                   (MCPARAMID)( 6109 << 14)
+#define MC_AWB_ROI_WRF_Line119_GB                  1
+#define MC_AWB_ROI_WRF_Line119_BG                  2
+#define MC_AWB_ROI_WRF_Line119_RG                  3
+#define MC_AWB_ROI_WRF_Line119_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1019             (MCPARAMID)( 6110 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1119             (MCPARAMID)( 6111 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1219             (MCPARAMID)( 6112 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1319             (MCPARAMID)( 6113 << 14)
+#define MC_AWB_ROI_WRF_TOIheight19               (MCPARAMID)( 6114 << 14)
+#define MC_AWB_ROI_WRF_LastTOI19                 (MCPARAMID)( 6115 << 14)
+#define MC_AWB_ROI_WRF_LastTOI19_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI19_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset19               (MCPARAMID)( 6116 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch19                (MCPARAMID)( 6117 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine19                (MCPARAMID)( 6118 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep20              (MCPARAMID)( 6119 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep20_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep20_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep20             (MCPARAMID)( 6120 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep20_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep20_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep20               (MCPARAMID)( 6121 << 14)
+#define MC_AWB_ROI_WRF_1stColRep20_ON              1
+#define MC_AWB_ROI_WRF_1stColRep20_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep20              (MCPARAMID)( 6122 << 14)
+#define MC_AWB_ROI_WRF_LastColRep20_ON             1
+#define MC_AWB_ROI_WRF_LastColRep20_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx20                (MCPARAMID)( 6123 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth20                (MCPARAMID)( 6124 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI20      (MCPARAMID)( 6125 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI20      (MCPARAMID)( 6126 << 14)
+#define MC_AWB_ROI_WRF_Line120                   (MCPARAMID)( 6127 << 14)
+#define MC_AWB_ROI_WRF_Line120_GB                  1
+#define MC_AWB_ROI_WRF_Line120_BG                  2
+#define MC_AWB_ROI_WRF_Line120_RG                  3
+#define MC_AWB_ROI_WRF_Line120_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1020             (MCPARAMID)( 6128 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1120             (MCPARAMID)( 6129 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1220             (MCPARAMID)( 6130 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1320             (MCPARAMID)( 6131 << 14)
+#define MC_AWB_ROI_WRF_TOIheight20               (MCPARAMID)( 6132 << 14)
+#define MC_AWB_ROI_WRF_LastTOI20                 (MCPARAMID)( 6133 << 14)
+#define MC_AWB_ROI_WRF_LastTOI20_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI20_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset20               (MCPARAMID)( 6134 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch20                (MCPARAMID)( 6135 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine20                (MCPARAMID)( 6136 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep21              (MCPARAMID)( 6137 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep21_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep21_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep21             (MCPARAMID)( 6138 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep21_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep21_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep21               (MCPARAMID)( 6139 << 14)
+#define MC_AWB_ROI_WRF_1stColRep21_ON              1
+#define MC_AWB_ROI_WRF_1stColRep21_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep21              (MCPARAMID)( 6140 << 14)
+#define MC_AWB_ROI_WRF_LastColRep21_ON             1
+#define MC_AWB_ROI_WRF_LastColRep21_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx21                (MCPARAMID)( 6141 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth21                (MCPARAMID)( 6142 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI21      (MCPARAMID)( 6143 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI21      (MCPARAMID)( 6144 << 14)
+#define MC_AWB_ROI_WRF_Line121                   (MCPARAMID)( 6145 << 14)
+#define MC_AWB_ROI_WRF_Line121_GB                  1
+#define MC_AWB_ROI_WRF_Line121_BG                  2
+#define MC_AWB_ROI_WRF_Line121_RG                  3
+#define MC_AWB_ROI_WRF_Line121_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1021             (MCPARAMID)( 6146 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1121             (MCPARAMID)( 6147 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1221             (MCPARAMID)( 6148 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1321             (MCPARAMID)( 6149 << 14)
+#define MC_AWB_ROI_WRF_TOIheight21               (MCPARAMID)( 6150 << 14)
+#define MC_AWB_ROI_WRF_LastTOI21                 (MCPARAMID)( 6151 << 14)
+#define MC_AWB_ROI_WRF_LastTOI21_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI21_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset21               (MCPARAMID)( 6152 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch21                (MCPARAMID)( 6153 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine21                (MCPARAMID)( 6154 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep22              (MCPARAMID)( 6155 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep22_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep22_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep22             (MCPARAMID)( 6156 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep22_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep22_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep22               (MCPARAMID)( 6157 << 14)
+#define MC_AWB_ROI_WRF_1stColRep22_ON              1
+#define MC_AWB_ROI_WRF_1stColRep22_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep22              (MCPARAMID)( 6158 << 14)
+#define MC_AWB_ROI_WRF_LastColRep22_ON             1
+#define MC_AWB_ROI_WRF_LastColRep22_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx22                (MCPARAMID)( 6159 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth22                (MCPARAMID)( 6160 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI22      (MCPARAMID)( 6161 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI22      (MCPARAMID)( 6162 << 14)
+#define MC_AWB_ROI_WRF_Line122                   (MCPARAMID)( 6163 << 14)
+#define MC_AWB_ROI_WRF_Line122_GB                  1
+#define MC_AWB_ROI_WRF_Line122_BG                  2
+#define MC_AWB_ROI_WRF_Line122_RG                  3
+#define MC_AWB_ROI_WRF_Line122_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1022             (MCPARAMID)( 6164 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1122             (MCPARAMID)( 6165 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1222             (MCPARAMID)( 6166 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1322             (MCPARAMID)( 6167 << 14)
+#define MC_AWB_ROI_WRF_TOIheight22               (MCPARAMID)( 6168 << 14)
+#define MC_AWB_ROI_WRF_LastTOI22                 (MCPARAMID)( 6169 << 14)
+#define MC_AWB_ROI_WRF_LastTOI22_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI22_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset22               (MCPARAMID)( 6170 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch22                (MCPARAMID)( 6171 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine22                (MCPARAMID)( 6172 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep23              (MCPARAMID)( 6173 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep23_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep23_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep23             (MCPARAMID)( 6174 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep23_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep23_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep23               (MCPARAMID)( 6175 << 14)
+#define MC_AWB_ROI_WRF_1stColRep23_ON              1
+#define MC_AWB_ROI_WRF_1stColRep23_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep23              (MCPARAMID)( 6176 << 14)
+#define MC_AWB_ROI_WRF_LastColRep23_ON             1
+#define MC_AWB_ROI_WRF_LastColRep23_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx23                (MCPARAMID)( 6177 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth23                (MCPARAMID)( 6178 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI23      (MCPARAMID)( 6179 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI23      (MCPARAMID)( 6180 << 14)
+#define MC_AWB_ROI_WRF_Line123                   (MCPARAMID)( 6181 << 14)
+#define MC_AWB_ROI_WRF_Line123_GB                  1
+#define MC_AWB_ROI_WRF_Line123_BG                  2
+#define MC_AWB_ROI_WRF_Line123_RG                  3
+#define MC_AWB_ROI_WRF_Line123_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1023             (MCPARAMID)( 6182 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1123             (MCPARAMID)( 6183 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1223             (MCPARAMID)( 6184 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1323             (MCPARAMID)( 6185 << 14)
+#define MC_AWB_ROI_WRF_TOIheight23               (MCPARAMID)( 6186 << 14)
+#define MC_AWB_ROI_WRF_LastTOI23                 (MCPARAMID)( 6187 << 14)
+#define MC_AWB_ROI_WRF_LastTOI23_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI23_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset23               (MCPARAMID)( 6188 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch23                (MCPARAMID)( 6189 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine23                (MCPARAMID)( 6190 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep24              (MCPARAMID)( 6191 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep24_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep24_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep24             (MCPARAMID)( 6192 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep24_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep24_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep24               (MCPARAMID)( 6193 << 14)
+#define MC_AWB_ROI_WRF_1stColRep24_ON              1
+#define MC_AWB_ROI_WRF_1stColRep24_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep24              (MCPARAMID)( 6194 << 14)
+#define MC_AWB_ROI_WRF_LastColRep24_ON             1
+#define MC_AWB_ROI_WRF_LastColRep24_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx24                (MCPARAMID)( 6195 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth24                (MCPARAMID)( 6196 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI24      (MCPARAMID)( 6197 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI24      (MCPARAMID)( 6198 << 14)
+#define MC_AWB_ROI_WRF_Line124                   (MCPARAMID)( 6199 << 14)
+#define MC_AWB_ROI_WRF_Line124_GB                  1
+#define MC_AWB_ROI_WRF_Line124_BG                  2
+#define MC_AWB_ROI_WRF_Line124_RG                  3
+#define MC_AWB_ROI_WRF_Line124_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1024             (MCPARAMID)( 6200 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1124             (MCPARAMID)( 6201 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1224             (MCPARAMID)( 6202 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1324             (MCPARAMID)( 6203 << 14)
+#define MC_AWB_ROI_WRF_TOIheight24               (MCPARAMID)( 6204 << 14)
+#define MC_AWB_ROI_WRF_LastTOI24                 (MCPARAMID)( 6205 << 14)
+#define MC_AWB_ROI_WRF_LastTOI24_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI24_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset24               (MCPARAMID)( 6206 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch24                (MCPARAMID)( 6207 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine24                (MCPARAMID)( 6208 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep25              (MCPARAMID)( 6209 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep25_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep25_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep25             (MCPARAMID)( 6210 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep25_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep25_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep25               (MCPARAMID)( 6211 << 14)
+#define MC_AWB_ROI_WRF_1stColRep25_ON              1
+#define MC_AWB_ROI_WRF_1stColRep25_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep25              (MCPARAMID)( 6212 << 14)
+#define MC_AWB_ROI_WRF_LastColRep25_ON             1
+#define MC_AWB_ROI_WRF_LastColRep25_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx25                (MCPARAMID)( 6213 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth25                (MCPARAMID)( 6214 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI25      (MCPARAMID)( 6215 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI25      (MCPARAMID)( 6216 << 14)
+#define MC_AWB_ROI_WRF_Line125                   (MCPARAMID)( 6217 << 14)
+#define MC_AWB_ROI_WRF_Line125_GB                  1
+#define MC_AWB_ROI_WRF_Line125_BG                  2
+#define MC_AWB_ROI_WRF_Line125_RG                  3
+#define MC_AWB_ROI_WRF_Line125_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1025             (MCPARAMID)( 6218 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1125             (MCPARAMID)( 6219 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1225             (MCPARAMID)( 6220 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1325             (MCPARAMID)( 6221 << 14)
+#define MC_AWB_ROI_WRF_TOIheight25               (MCPARAMID)( 6222 << 14)
+#define MC_AWB_ROI_WRF_LastTOI25                 (MCPARAMID)( 6223 << 14)
+#define MC_AWB_ROI_WRF_LastTOI25_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI25_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset25               (MCPARAMID)( 6224 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch25                (MCPARAMID)( 6225 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine25                (MCPARAMID)( 6226 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep26              (MCPARAMID)( 6227 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep26_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep26_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep26             (MCPARAMID)( 6228 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep26_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep26_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep26               (MCPARAMID)( 6229 << 14)
+#define MC_AWB_ROI_WRF_1stColRep26_ON              1
+#define MC_AWB_ROI_WRF_1stColRep26_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep26              (MCPARAMID)( 6230 << 14)
+#define MC_AWB_ROI_WRF_LastColRep26_ON             1
+#define MC_AWB_ROI_WRF_LastColRep26_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx26                (MCPARAMID)( 6231 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth26                (MCPARAMID)( 6232 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI26      (MCPARAMID)( 6233 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI26      (MCPARAMID)( 6234 << 14)
+#define MC_AWB_ROI_WRF_Line126                   (MCPARAMID)( 6235 << 14)
+#define MC_AWB_ROI_WRF_Line126_GB                  1
+#define MC_AWB_ROI_WRF_Line126_BG                  2
+#define MC_AWB_ROI_WRF_Line126_RG                  3
+#define MC_AWB_ROI_WRF_Line126_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1026             (MCPARAMID)( 6236 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1126             (MCPARAMID)( 6237 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1226             (MCPARAMID)( 6238 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1326             (MCPARAMID)( 6239 << 14)
+#define MC_AWB_ROI_WRF_TOIheight26               (MCPARAMID)( 6240 << 14)
+#define MC_AWB_ROI_WRF_LastTOI26                 (MCPARAMID)( 6241 << 14)
+#define MC_AWB_ROI_WRF_LastTOI26_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI26_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset26               (MCPARAMID)( 6242 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch26                (MCPARAMID)( 6243 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine26                (MCPARAMID)( 6244 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep27              (MCPARAMID)( 6245 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep27_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep27_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep27             (MCPARAMID)( 6246 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep27_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep27_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep27               (MCPARAMID)( 6247 << 14)
+#define MC_AWB_ROI_WRF_1stColRep27_ON              1
+#define MC_AWB_ROI_WRF_1stColRep27_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep27              (MCPARAMID)( 6248 << 14)
+#define MC_AWB_ROI_WRF_LastColRep27_ON             1
+#define MC_AWB_ROI_WRF_LastColRep27_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx27                (MCPARAMID)( 6249 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth27                (MCPARAMID)( 6250 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI27      (MCPARAMID)( 6251 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI27      (MCPARAMID)( 6252 << 14)
+#define MC_AWB_ROI_WRF_Line127                   (MCPARAMID)( 6253 << 14)
+#define MC_AWB_ROI_WRF_Line127_GB                  1
+#define MC_AWB_ROI_WRF_Line127_BG                  2
+#define MC_AWB_ROI_WRF_Line127_RG                  3
+#define MC_AWB_ROI_WRF_Line127_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1027             (MCPARAMID)( 6254 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1127             (MCPARAMID)( 6255 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1227             (MCPARAMID)( 6256 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1327             (MCPARAMID)( 6257 << 14)
+#define MC_AWB_ROI_WRF_TOIheight27               (MCPARAMID)( 6258 << 14)
+#define MC_AWB_ROI_WRF_LastTOI27                 (MCPARAMID)( 6259 << 14)
+#define MC_AWB_ROI_WRF_LastTOI27_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI27_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset27               (MCPARAMID)( 6260 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch27                (MCPARAMID)( 6261 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine27                (MCPARAMID)( 6262 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep28              (MCPARAMID)( 6263 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep28_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep28_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep28             (MCPARAMID)( 6264 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep28_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep28_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep28               (MCPARAMID)( 6265 << 14)
+#define MC_AWB_ROI_WRF_1stColRep28_ON              1
+#define MC_AWB_ROI_WRF_1stColRep28_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep28              (MCPARAMID)( 6266 << 14)
+#define MC_AWB_ROI_WRF_LastColRep28_ON             1
+#define MC_AWB_ROI_WRF_LastColRep28_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx28                (MCPARAMID)( 6267 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth28                (MCPARAMID)( 6268 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI28      (MCPARAMID)( 6269 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI28      (MCPARAMID)( 6270 << 14)
+#define MC_AWB_ROI_WRF_Line128                   (MCPARAMID)( 6271 << 14)
+#define MC_AWB_ROI_WRF_Line128_GB                  1
+#define MC_AWB_ROI_WRF_Line128_BG                  2
+#define MC_AWB_ROI_WRF_Line128_RG                  3
+#define MC_AWB_ROI_WRF_Line128_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1028             (MCPARAMID)( 6272 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1128             (MCPARAMID)( 6273 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1228             (MCPARAMID)( 6274 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1328             (MCPARAMID)( 6275 << 14)
+#define MC_AWB_ROI_WRF_TOIheight28               (MCPARAMID)( 6276 << 14)
+#define MC_AWB_ROI_WRF_LastTOI28                 (MCPARAMID)( 6277 << 14)
+#define MC_AWB_ROI_WRF_LastTOI28_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI28_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset28               (MCPARAMID)( 6278 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch28                (MCPARAMID)( 6279 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine28                (MCPARAMID)( 6280 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep29              (MCPARAMID)( 6281 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep29_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep29_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep29             (MCPARAMID)( 6282 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep29_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep29_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep29               (MCPARAMID)( 6283 << 14)
+#define MC_AWB_ROI_WRF_1stColRep29_ON              1
+#define MC_AWB_ROI_WRF_1stColRep29_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep29              (MCPARAMID)( 6284 << 14)
+#define MC_AWB_ROI_WRF_LastColRep29_ON             1
+#define MC_AWB_ROI_WRF_LastColRep29_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx29                (MCPARAMID)( 6285 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth29                (MCPARAMID)( 6286 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI29      (MCPARAMID)( 6287 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI29      (MCPARAMID)( 6288 << 14)
+#define MC_AWB_ROI_WRF_Line129                   (MCPARAMID)( 6289 << 14)
+#define MC_AWB_ROI_WRF_Line129_GB                  1
+#define MC_AWB_ROI_WRF_Line129_BG                  2
+#define MC_AWB_ROI_WRF_Line129_RG                  3
+#define MC_AWB_ROI_WRF_Line129_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1029             (MCPARAMID)( 6290 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1129             (MCPARAMID)( 6291 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1229             (MCPARAMID)( 6292 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1329             (MCPARAMID)( 6293 << 14)
+#define MC_AWB_ROI_WRF_TOIheight29               (MCPARAMID)( 6294 << 14)
+#define MC_AWB_ROI_WRF_LastTOI29                 (MCPARAMID)( 6295 << 14)
+#define MC_AWB_ROI_WRF_LastTOI29_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI29_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset29               (MCPARAMID)( 6296 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch29                (MCPARAMID)( 6297 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine29                (MCPARAMID)( 6298 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep30              (MCPARAMID)( 6299 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep30_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep30_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep30             (MCPARAMID)( 6300 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep30_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep30_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep30               (MCPARAMID)( 6301 << 14)
+#define MC_AWB_ROI_WRF_1stColRep30_ON              1
+#define MC_AWB_ROI_WRF_1stColRep30_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep30              (MCPARAMID)( 6302 << 14)
+#define MC_AWB_ROI_WRF_LastColRep30_ON             1
+#define MC_AWB_ROI_WRF_LastColRep30_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx30                (MCPARAMID)( 6303 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth30                (MCPARAMID)( 6304 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI30      (MCPARAMID)( 6305 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI30      (MCPARAMID)( 6306 << 14)
+#define MC_AWB_ROI_WRF_Line130                   (MCPARAMID)( 6307 << 14)
+#define MC_AWB_ROI_WRF_Line130_GB                  1
+#define MC_AWB_ROI_WRF_Line130_BG                  2
+#define MC_AWB_ROI_WRF_Line130_RG                  3
+#define MC_AWB_ROI_WRF_Line130_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1030             (MCPARAMID)( 6308 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1130             (MCPARAMID)( 6309 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1230             (MCPARAMID)( 6310 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1330             (MCPARAMID)( 6311 << 14)
+#define MC_AWB_ROI_WRF_TOIheight30               (MCPARAMID)( 6312 << 14)
+#define MC_AWB_ROI_WRF_LastTOI30                 (MCPARAMID)( 6313 << 14)
+#define MC_AWB_ROI_WRF_LastTOI30_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI30_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset30               (MCPARAMID)( 6314 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch30                (MCPARAMID)( 6315 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine30                (MCPARAMID)( 6316 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep31              (MCPARAMID)( 6317 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep31_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep31_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep31             (MCPARAMID)( 6318 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep31_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep31_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep31               (MCPARAMID)( 6319 << 14)
+#define MC_AWB_ROI_WRF_1stColRep31_ON              1
+#define MC_AWB_ROI_WRF_1stColRep31_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep31              (MCPARAMID)( 6320 << 14)
+#define MC_AWB_ROI_WRF_LastColRep31_ON             1
+#define MC_AWB_ROI_WRF_LastColRep31_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx31                (MCPARAMID)( 6321 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth31                (MCPARAMID)( 6322 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI31      (MCPARAMID)( 6323 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI31      (MCPARAMID)( 6324 << 14)
+#define MC_AWB_ROI_WRF_Line131                   (MCPARAMID)( 6325 << 14)
+#define MC_AWB_ROI_WRF_Line131_GB                  1
+#define MC_AWB_ROI_WRF_Line131_BG                  2
+#define MC_AWB_ROI_WRF_Line131_RG                  3
+#define MC_AWB_ROI_WRF_Line131_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1031             (MCPARAMID)( 6326 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1131             (MCPARAMID)( 6327 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1231             (MCPARAMID)( 6328 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1331             (MCPARAMID)( 6329 << 14)
+#define MC_AWB_ROI_WRF_TOIheight31               (MCPARAMID)( 6330 << 14)
+#define MC_AWB_ROI_WRF_LastTOI31                 (MCPARAMID)( 6331 << 14)
+#define MC_AWB_ROI_WRF_LastTOI31_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI31_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset31               (MCPARAMID)( 6332 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch31                (MCPARAMID)( 6333 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine31                (MCPARAMID)( 6334 << 14)
+#define MC_ROIName_WRF_1stLineRep0               (MCPARAMID)( 6335 << 14)
+#define MC_ROIName_WRF_1stLineRep0_ON              1
+#define MC_ROIName_WRF_1stLineRep0_OFF             2
+#define MC_ROIName_WRF_LastLineRep0              (MCPARAMID)( 6336 << 14)
+#define MC_ROIName_WRF_LastLineRep0_ON             1
+#define MC_ROIName_WRF_LastLineRep0_OFF            2
+#define MC_ROIName_WRF_1stColRep0                (MCPARAMID)( 6337 << 14)
+#define MC_ROIName_WRF_1stColRep0_ON               1
+#define MC_ROIName_WRF_1stColRep0_OFF              2
+#define MC_ROIName_WRF_LastColRep0               (MCPARAMID)( 6338 << 14)
+#define MC_ROIName_WRF_LastColRep0_ON              1
+#define MC_ROIName_WRF_LastColRep0_OFF             2
+#define MC_ROIName_WRF_ColumnIx0                 (MCPARAMID)( 6339 << 14)
+#define MC_ROIName_WRF_TOIwidth0                 (MCPARAMID)( 6340 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI0       (MCPARAMID)( 6341 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI0       (MCPARAMID)( 6342 << 14)
+#define MC_ROIName_WRF_Line10                    (MCPARAMID)( 6343 << 14)
+#define MC_ROIName_WRF_Line10_GB                   1
+#define MC_ROIName_WRF_Line10_BG                   2
+#define MC_ROIName_WRF_Line10_RG                   3
+#define MC_ROIName_WRF_Line10_GR                   4
+#define MC_ROIName_WRF_XferSizeM100              (MCPARAMID)( 6344 << 14)
+#define MC_ROIName_WRF_XferSizeM110              (MCPARAMID)( 6345 << 14)
+#define MC_ROIName_WRF_XferSizeM120              (MCPARAMID)( 6346 << 14)
+#define MC_ROIName_WRF_XferSizeM130              (MCPARAMID)( 6347 << 14)
+#define MC_ROIName_WRF_TOIheight0                (MCPARAMID)( 6348 << 14)
+#define MC_ROIName_WRF_LastTOI0                  (MCPARAMID)( 6349 << 14)
+#define MC_ROIName_WRF_LastTOI0_TRUE               1
+#define MC_ROIName_WRF_LastTOI0_FALSE              2
+#define MC_ROIName_WRF_TOIoffset0                (MCPARAMID)( 6350 << 14)
+#define MC_ROIName_WRF_TOIPitch0                 (MCPARAMID)( 6351 << 14)
+#define MC_ROIName_WRF_NbOfLine0                 (MCPARAMID)( 6352 << 14)
+#define MC_ROIName_WRF_1stLineRep1               (MCPARAMID)( 6353 << 14)
+#define MC_ROIName_WRF_1stLineRep1_ON              1
+#define MC_ROIName_WRF_1stLineRep1_OFF             2
+#define MC_ROIName_WRF_LastLineRep1              (MCPARAMID)( 6354 << 14)
+#define MC_ROIName_WRF_LastLineRep1_ON             1
+#define MC_ROIName_WRF_LastLineRep1_OFF            2
+#define MC_ROIName_WRF_1stColRep1                (MCPARAMID)( 6355 << 14)
+#define MC_ROIName_WRF_1stColRep1_ON               1
+#define MC_ROIName_WRF_1stColRep1_OFF              2
+#define MC_ROIName_WRF_LastColRep1               (MCPARAMID)( 6356 << 14)
+#define MC_ROIName_WRF_LastColRep1_ON              1
+#define MC_ROIName_WRF_LastColRep1_OFF             2
+#define MC_ROIName_WRF_ColumnIx1                 (MCPARAMID)( 6357 << 14)
+#define MC_ROIName_WRF_TOIwidth1                 (MCPARAMID)( 6358 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI1       (MCPARAMID)( 6359 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI1       (MCPARAMID)( 6360 << 14)
+#define MC_ROIName_WRF_Line11                    (MCPARAMID)( 6361 << 14)
+#define MC_ROIName_WRF_Line11_GB                   1
+#define MC_ROIName_WRF_Line11_BG                   2
+#define MC_ROIName_WRF_Line11_RG                   3
+#define MC_ROIName_WRF_Line11_GR                   4
+#define MC_ROIName_WRF_XferSizeM101              (MCPARAMID)( 6362 << 14)
+#define MC_ROIName_WRF_XferSizeM111              (MCPARAMID)( 6363 << 14)
+#define MC_ROIName_WRF_XferSizeM121              (MCPARAMID)( 6364 << 14)
+#define MC_ROIName_WRF_XferSizeM131              (MCPARAMID)( 6365 << 14)
+#define MC_ROIName_WRF_TOIheight1                (MCPARAMID)( 6366 << 14)
+#define MC_ROIName_WRF_LastTOI1                  (MCPARAMID)( 6367 << 14)
+#define MC_ROIName_WRF_LastTOI1_TRUE               1
+#define MC_ROIName_WRF_LastTOI1_FALSE              2
+#define MC_ROIName_WRF_TOIoffset1                (MCPARAMID)( 6368 << 14)
+#define MC_ROIName_WRF_TOIPitch1                 (MCPARAMID)( 6369 << 14)
+#define MC_ROIName_WRF_NbOfLine1                 (MCPARAMID)( 6370 << 14)
+#define MC_ROIName_WRF_1stLineRep2               (MCPARAMID)( 6371 << 14)
+#define MC_ROIName_WRF_1stLineRep2_ON              1
+#define MC_ROIName_WRF_1stLineRep2_OFF             2
+#define MC_ROIName_WRF_LastLineRep2              (MCPARAMID)( 6372 << 14)
+#define MC_ROIName_WRF_LastLineRep2_ON             1
+#define MC_ROIName_WRF_LastLineRep2_OFF            2
+#define MC_ROIName_WRF_1stColRep2                (MCPARAMID)( 6373 << 14)
+#define MC_ROIName_WRF_1stColRep2_ON               1
+#define MC_ROIName_WRF_1stColRep2_OFF              2
+#define MC_ROIName_WRF_LastColRep2               (MCPARAMID)( 6374 << 14)
+#define MC_ROIName_WRF_LastColRep2_ON              1
+#define MC_ROIName_WRF_LastColRep2_OFF             2
+#define MC_ROIName_WRF_ColumnIx2                 (MCPARAMID)( 6375 << 14)
+#define MC_ROIName_WRF_TOIwidth2                 (MCPARAMID)( 6376 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI2       (MCPARAMID)( 6377 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI2       (MCPARAMID)( 6378 << 14)
+#define MC_ROIName_WRF_Line12                    (MCPARAMID)( 6379 << 14)
+#define MC_ROIName_WRF_Line12_GB                   1
+#define MC_ROIName_WRF_Line12_BG                   2
+#define MC_ROIName_WRF_Line12_RG                   3
+#define MC_ROIName_WRF_Line12_GR                   4
+#define MC_ROIName_WRF_XferSizeM102              (MCPARAMID)( 6380 << 14)
+#define MC_ROIName_WRF_XferSizeM112              (MCPARAMID)( 6381 << 14)
+#define MC_ROIName_WRF_XferSizeM122              (MCPARAMID)( 6382 << 14)
+#define MC_ROIName_WRF_XferSizeM132              (MCPARAMID)( 6383 << 14)
+#define MC_ROIName_WRF_TOIheight2                (MCPARAMID)( 6384 << 14)
+#define MC_ROIName_WRF_LastTOI2                  (MCPARAMID)( 6385 << 14)
+#define MC_ROIName_WRF_LastTOI2_TRUE               1
+#define MC_ROIName_WRF_LastTOI2_FALSE              2
+#define MC_ROIName_WRF_TOIoffset2                (MCPARAMID)( 6386 << 14)
+#define MC_ROIName_WRF_TOIPitch2                 (MCPARAMID)( 6387 << 14)
+#define MC_ROIName_WRF_NbOfLine2                 (MCPARAMID)( 6388 << 14)
+#define MC_ROIName_WRF_1stLineRep3               (MCPARAMID)( 6389 << 14)
+#define MC_ROIName_WRF_1stLineRep3_ON              1
+#define MC_ROIName_WRF_1stLineRep3_OFF             2
+#define MC_ROIName_WRF_LastLineRep3              (MCPARAMID)( 6390 << 14)
+#define MC_ROIName_WRF_LastLineRep3_ON             1
+#define MC_ROIName_WRF_LastLineRep3_OFF            2
+#define MC_ROIName_WRF_1stColRep3                (MCPARAMID)( 6391 << 14)
+#define MC_ROIName_WRF_1stColRep3_ON               1
+#define MC_ROIName_WRF_1stColRep3_OFF              2
+#define MC_ROIName_WRF_LastColRep3               (MCPARAMID)( 6392 << 14)
+#define MC_ROIName_WRF_LastColRep3_ON              1
+#define MC_ROIName_WRF_LastColRep3_OFF             2
+#define MC_ROIName_WRF_ColumnIx3                 (MCPARAMID)( 6393 << 14)
+#define MC_ROIName_WRF_TOIwidth3                 (MCPARAMID)( 6394 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI3       (MCPARAMID)( 6395 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI3       (MCPARAMID)( 6396 << 14)
+#define MC_ROIName_WRF_Line13                    (MCPARAMID)( 6397 << 14)
+#define MC_ROIName_WRF_Line13_GB                   1
+#define MC_ROIName_WRF_Line13_BG                   2
+#define MC_ROIName_WRF_Line13_RG                   3
+#define MC_ROIName_WRF_Line13_GR                   4
+#define MC_ROIName_WRF_XferSizeM103              (MCPARAMID)( 6398 << 14)
+#define MC_ROIName_WRF_XferSizeM113              (MCPARAMID)( 6399 << 14)
+#define MC_ROIName_WRF_XferSizeM123              (MCPARAMID)( 6400 << 14)
+#define MC_ROIName_WRF_XferSizeM133              (MCPARAMID)( 6401 << 14)
+#define MC_ROIName_WRF_TOIheight3                (MCPARAMID)( 6402 << 14)
+#define MC_ROIName_WRF_LastTOI3                  (MCPARAMID)( 6403 << 14)
+#define MC_ROIName_WRF_LastTOI3_TRUE               1
+#define MC_ROIName_WRF_LastTOI3_FALSE              2
+#define MC_ROIName_WRF_TOIoffset3                (MCPARAMID)( 6404 << 14)
+#define MC_ROIName_WRF_TOIPitch3                 (MCPARAMID)( 6405 << 14)
+#define MC_ROIName_WRF_NbOfLine3                 (MCPARAMID)( 6406 << 14)
+#define MC_ROIName_WRF_1stLineRep4               (MCPARAMID)( 6407 << 14)
+#define MC_ROIName_WRF_1stLineRep4_ON              1
+#define MC_ROIName_WRF_1stLineRep4_OFF             2
+#define MC_ROIName_WRF_LastLineRep4              (MCPARAMID)( 6408 << 14)
+#define MC_ROIName_WRF_LastLineRep4_ON             1
+#define MC_ROIName_WRF_LastLineRep4_OFF            2
+#define MC_ROIName_WRF_1stColRep4                (MCPARAMID)( 6409 << 14)
+#define MC_ROIName_WRF_1stColRep4_ON               1
+#define MC_ROIName_WRF_1stColRep4_OFF              2
+#define MC_ROIName_WRF_LastColRep4               (MCPARAMID)( 6410 << 14)
+#define MC_ROIName_WRF_LastColRep4_ON              1
+#define MC_ROIName_WRF_LastColRep4_OFF             2
+#define MC_ROIName_WRF_ColumnIx4                 (MCPARAMID)( 6411 << 14)
+#define MC_ROIName_WRF_TOIwidth4                 (MCPARAMID)( 6412 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI4       (MCPARAMID)( 6413 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI4       (MCPARAMID)( 6414 << 14)
+#define MC_ROIName_WRF_Line14                    (MCPARAMID)( 6415 << 14)
+#define MC_ROIName_WRF_Line14_GB                   1
+#define MC_ROIName_WRF_Line14_BG                   2
+#define MC_ROIName_WRF_Line14_RG                   3
+#define MC_ROIName_WRF_Line14_GR                   4
+#define MC_ROIName_WRF_XferSizeM104              (MCPARAMID)( 6416 << 14)
+#define MC_ROIName_WRF_XferSizeM114              (MCPARAMID)( 6417 << 14)
+#define MC_ROIName_WRF_XferSizeM124              (MCPARAMID)( 6418 << 14)
+#define MC_ROIName_WRF_XferSizeM134              (MCPARAMID)( 6419 << 14)
+#define MC_ROIName_WRF_TOIheight4                (MCPARAMID)( 6420 << 14)
+#define MC_ROIName_WRF_LastTOI4                  (MCPARAMID)( 6421 << 14)
+#define MC_ROIName_WRF_LastTOI4_TRUE               1
+#define MC_ROIName_WRF_LastTOI4_FALSE              2
+#define MC_ROIName_WRF_TOIoffset4                (MCPARAMID)( 6422 << 14)
+#define MC_ROIName_WRF_TOIPitch4                 (MCPARAMID)( 6423 << 14)
+#define MC_ROIName_WRF_NbOfLine4                 (MCPARAMID)( 6424 << 14)
+#define MC_ROIName_WRF_1stLineRep5               (MCPARAMID)( 6425 << 14)
+#define MC_ROIName_WRF_1stLineRep5_ON              1
+#define MC_ROIName_WRF_1stLineRep5_OFF             2
+#define MC_ROIName_WRF_LastLineRep5              (MCPARAMID)( 6426 << 14)
+#define MC_ROIName_WRF_LastLineRep5_ON             1
+#define MC_ROIName_WRF_LastLineRep5_OFF            2
+#define MC_ROIName_WRF_1stColRep5                (MCPARAMID)( 6427 << 14)
+#define MC_ROIName_WRF_1stColRep5_ON               1
+#define MC_ROIName_WRF_1stColRep5_OFF              2
+#define MC_ROIName_WRF_LastColRep5               (MCPARAMID)( 6428 << 14)
+#define MC_ROIName_WRF_LastColRep5_ON              1
+#define MC_ROIName_WRF_LastColRep5_OFF             2
+#define MC_ROIName_WRF_ColumnIx5                 (MCPARAMID)( 6429 << 14)
+#define MC_ROIName_WRF_TOIwidth5                 (MCPARAMID)( 6430 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI5       (MCPARAMID)( 6431 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI5       (MCPARAMID)( 6432 << 14)
+#define MC_ROIName_WRF_Line15                    (MCPARAMID)( 6433 << 14)
+#define MC_ROIName_WRF_Line15_GB                   1
+#define MC_ROIName_WRF_Line15_BG                   2
+#define MC_ROIName_WRF_Line15_RG                   3
+#define MC_ROIName_WRF_Line15_GR                   4
+#define MC_ROIName_WRF_XferSizeM105              (MCPARAMID)( 6434 << 14)
+#define MC_ROIName_WRF_XferSizeM115              (MCPARAMID)( 6435 << 14)
+#define MC_ROIName_WRF_XferSizeM125              (MCPARAMID)( 6436 << 14)
+#define MC_ROIName_WRF_XferSizeM135              (MCPARAMID)( 6437 << 14)
+#define MC_ROIName_WRF_TOIheight5                (MCPARAMID)( 6438 << 14)
+#define MC_ROIName_WRF_LastTOI5                  (MCPARAMID)( 6439 << 14)
+#define MC_ROIName_WRF_LastTOI5_TRUE               1
+#define MC_ROIName_WRF_LastTOI5_FALSE              2
+#define MC_ROIName_WRF_TOIoffset5                (MCPARAMID)( 6440 << 14)
+#define MC_ROIName_WRF_TOIPitch5                 (MCPARAMID)( 6441 << 14)
+#define MC_ROIName_WRF_NbOfLine5                 (MCPARAMID)( 6442 << 14)
+#define MC_ROIName_WRF_1stLineRep6               (MCPARAMID)( 6443 << 14)
+#define MC_ROIName_WRF_1stLineRep6_ON              1
+#define MC_ROIName_WRF_1stLineRep6_OFF             2
+#define MC_ROIName_WRF_LastLineRep6              (MCPARAMID)( 6444 << 14)
+#define MC_ROIName_WRF_LastLineRep6_ON             1
+#define MC_ROIName_WRF_LastLineRep6_OFF            2
+#define MC_ROIName_WRF_1stColRep6                (MCPARAMID)( 6445 << 14)
+#define MC_ROIName_WRF_1stColRep6_ON               1
+#define MC_ROIName_WRF_1stColRep6_OFF              2
+#define MC_ROIName_WRF_LastColRep6               (MCPARAMID)( 6446 << 14)
+#define MC_ROIName_WRF_LastColRep6_ON              1
+#define MC_ROIName_WRF_LastColRep6_OFF             2
+#define MC_ROIName_WRF_ColumnIx6                 (MCPARAMID)( 6447 << 14)
+#define MC_ROIName_WRF_TOIwidth6                 (MCPARAMID)( 6448 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI6       (MCPARAMID)( 6449 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI6       (MCPARAMID)( 6450 << 14)
+#define MC_ROIName_WRF_Line16                    (MCPARAMID)( 6451 << 14)
+#define MC_ROIName_WRF_Line16_GB                   1
+#define MC_ROIName_WRF_Line16_BG                   2
+#define MC_ROIName_WRF_Line16_RG                   3
+#define MC_ROIName_WRF_Line16_GR                   4
+#define MC_ROIName_WRF_XferSizeM106              (MCPARAMID)( 6452 << 14)
+#define MC_ROIName_WRF_XferSizeM116              (MCPARAMID)( 6453 << 14)
+#define MC_ROIName_WRF_XferSizeM126              (MCPARAMID)( 6454 << 14)
+#define MC_ROIName_WRF_XferSizeM136              (MCPARAMID)( 6455 << 14)
+#define MC_ROIName_WRF_TOIheight6                (MCPARAMID)( 6456 << 14)
+#define MC_ROIName_WRF_LastTOI6                  (MCPARAMID)( 6457 << 14)
+#define MC_ROIName_WRF_LastTOI6_TRUE               1
+#define MC_ROIName_WRF_LastTOI6_FALSE              2
+#define MC_ROIName_WRF_TOIoffset6                (MCPARAMID)( 6458 << 14)
+#define MC_ROIName_WRF_TOIPitch6                 (MCPARAMID)( 6459 << 14)
+#define MC_ROIName_WRF_NbOfLine6                 (MCPARAMID)( 6460 << 14)
+#define MC_ROIName_WRF_1stLineRep7               (MCPARAMID)( 6461 << 14)
+#define MC_ROIName_WRF_1stLineRep7_ON              1
+#define MC_ROIName_WRF_1stLineRep7_OFF             2
+#define MC_ROIName_WRF_LastLineRep7              (MCPARAMID)( 6462 << 14)
+#define MC_ROIName_WRF_LastLineRep7_ON             1
+#define MC_ROIName_WRF_LastLineRep7_OFF            2
+#define MC_ROIName_WRF_1stColRep7                (MCPARAMID)( 6463 << 14)
+#define MC_ROIName_WRF_1stColRep7_ON               1
+#define MC_ROIName_WRF_1stColRep7_OFF              2
+#define MC_ROIName_WRF_LastColRep7               (MCPARAMID)( 6464 << 14)
+#define MC_ROIName_WRF_LastColRep7_ON              1
+#define MC_ROIName_WRF_LastColRep7_OFF             2
+#define MC_ROIName_WRF_ColumnIx7                 (MCPARAMID)( 6465 << 14)
+#define MC_ROIName_WRF_TOIwidth7                 (MCPARAMID)( 6466 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI7       (MCPARAMID)( 6467 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI7       (MCPARAMID)( 6468 << 14)
+#define MC_ROIName_WRF_Line17                    (MCPARAMID)( 6469 << 14)
+#define MC_ROIName_WRF_Line17_GB                   1
+#define MC_ROIName_WRF_Line17_BG                   2
+#define MC_ROIName_WRF_Line17_RG                   3
+#define MC_ROIName_WRF_Line17_GR                   4
+#define MC_ROIName_WRF_XferSizeM107              (MCPARAMID)( 6470 << 14)
+#define MC_ROIName_WRF_XferSizeM117              (MCPARAMID)( 6471 << 14)
+#define MC_ROIName_WRF_XferSizeM127              (MCPARAMID)( 6472 << 14)
+#define MC_ROIName_WRF_XferSizeM137              (MCPARAMID)( 6473 << 14)
+#define MC_ROIName_WRF_TOIheight7                (MCPARAMID)( 6474 << 14)
+#define MC_ROIName_WRF_LastTOI7                  (MCPARAMID)( 6475 << 14)
+#define MC_ROIName_WRF_LastTOI7_TRUE               1
+#define MC_ROIName_WRF_LastTOI7_FALSE              2
+#define MC_ROIName_WRF_TOIoffset7                (MCPARAMID)( 6476 << 14)
+#define MC_ROIName_WRF_TOIPitch7                 (MCPARAMID)( 6477 << 14)
+#define MC_ROIName_WRF_NbOfLine7                 (MCPARAMID)( 6478 << 14)
+#define MC_ROIName_WRF_1stLineRep8               (MCPARAMID)( 6479 << 14)
+#define MC_ROIName_WRF_1stLineRep8_ON              1
+#define MC_ROIName_WRF_1stLineRep8_OFF             2
+#define MC_ROIName_WRF_LastLineRep8              (MCPARAMID)( 6480 << 14)
+#define MC_ROIName_WRF_LastLineRep8_ON             1
+#define MC_ROIName_WRF_LastLineRep8_OFF            2
+#define MC_ROIName_WRF_1stColRep8                (MCPARAMID)( 6481 << 14)
+#define MC_ROIName_WRF_1stColRep8_ON               1
+#define MC_ROIName_WRF_1stColRep8_OFF              2
+#define MC_ROIName_WRF_LastColRep8               (MCPARAMID)( 6482 << 14)
+#define MC_ROIName_WRF_LastColRep8_ON              1
+#define MC_ROIName_WRF_LastColRep8_OFF             2
+#define MC_ROIName_WRF_ColumnIx8                 (MCPARAMID)( 6483 << 14)
+#define MC_ROIName_WRF_TOIwidth8                 (MCPARAMID)( 6484 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI8       (MCPARAMID)( 6485 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI8       (MCPARAMID)( 6486 << 14)
+#define MC_ROIName_WRF_Line18                    (MCPARAMID)( 6487 << 14)
+#define MC_ROIName_WRF_Line18_GB                   1
+#define MC_ROIName_WRF_Line18_BG                   2
+#define MC_ROIName_WRF_Line18_RG                   3
+#define MC_ROIName_WRF_Line18_GR                   4
+#define MC_ROIName_WRF_XferSizeM108              (MCPARAMID)( 6488 << 14)
+#define MC_ROIName_WRF_XferSizeM118              (MCPARAMID)( 6489 << 14)
+#define MC_ROIName_WRF_XferSizeM128              (MCPARAMID)( 6490 << 14)
+#define MC_ROIName_WRF_XferSizeM138              (MCPARAMID)( 6491 << 14)
+#define MC_ROIName_WRF_TOIheight8                (MCPARAMID)( 6492 << 14)
+#define MC_ROIName_WRF_LastTOI8                  (MCPARAMID)( 6493 << 14)
+#define MC_ROIName_WRF_LastTOI8_TRUE               1
+#define MC_ROIName_WRF_LastTOI8_FALSE              2
+#define MC_ROIName_WRF_TOIoffset8                (MCPARAMID)( 6494 << 14)
+#define MC_ROIName_WRF_TOIPitch8                 (MCPARAMID)( 6495 << 14)
+#define MC_ROIName_WRF_NbOfLine8                 (MCPARAMID)( 6496 << 14)
+#define MC_ROIName_WRF_1stLineRep9               (MCPARAMID)( 6497 << 14)
+#define MC_ROIName_WRF_1stLineRep9_ON              1
+#define MC_ROIName_WRF_1stLineRep9_OFF             2
+#define MC_ROIName_WRF_LastLineRep9              (MCPARAMID)( 6498 << 14)
+#define MC_ROIName_WRF_LastLineRep9_ON             1
+#define MC_ROIName_WRF_LastLineRep9_OFF            2
+#define MC_ROIName_WRF_1stColRep9                (MCPARAMID)( 6499 << 14)
+#define MC_ROIName_WRF_1stColRep9_ON               1
+#define MC_ROIName_WRF_1stColRep9_OFF              2
+#define MC_ROIName_WRF_LastColRep9               (MCPARAMID)( 6500 << 14)
+#define MC_ROIName_WRF_LastColRep9_ON              1
+#define MC_ROIName_WRF_LastColRep9_OFF             2
+#define MC_ROIName_WRF_ColumnIx9                 (MCPARAMID)( 6501 << 14)
+#define MC_ROIName_WRF_TOIwidth9                 (MCPARAMID)( 6502 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI9       (MCPARAMID)( 6503 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI9       (MCPARAMID)( 6504 << 14)
+#define MC_ROIName_WRF_Line19                    (MCPARAMID)( 6505 << 14)
+#define MC_ROIName_WRF_Line19_GB                   1
+#define MC_ROIName_WRF_Line19_BG                   2
+#define MC_ROIName_WRF_Line19_RG                   3
+#define MC_ROIName_WRF_Line19_GR                   4
+#define MC_ROIName_WRF_XferSizeM109              (MCPARAMID)( 6506 << 14)
+#define MC_ROIName_WRF_XferSizeM119              (MCPARAMID)( 6507 << 14)
+#define MC_ROIName_WRF_XferSizeM129              (MCPARAMID)( 6508 << 14)
+#define MC_ROIName_WRF_XferSizeM139              (MCPARAMID)( 6509 << 14)
+#define MC_ROIName_WRF_TOIheight9                (MCPARAMID)( 6510 << 14)
+#define MC_ROIName_WRF_LastTOI9                  (MCPARAMID)( 6511 << 14)
+#define MC_ROIName_WRF_LastTOI9_TRUE               1
+#define MC_ROIName_WRF_LastTOI9_FALSE              2
+#define MC_ROIName_WRF_TOIoffset9                (MCPARAMID)( 6512 << 14)
+#define MC_ROIName_WRF_TOIPitch9                 (MCPARAMID)( 6513 << 14)
+#define MC_ROIName_WRF_NbOfLine9                 (MCPARAMID)( 6514 << 14)
+#define MC_ROIName_WRF_1stLineRep10              (MCPARAMID)( 6515 << 14)
+#define MC_ROIName_WRF_1stLineRep10_ON             1
+#define MC_ROIName_WRF_1stLineRep10_OFF            2
+#define MC_ROIName_WRF_LastLineRep10             (MCPARAMID)( 6516 << 14)
+#define MC_ROIName_WRF_LastLineRep10_ON            1
+#define MC_ROIName_WRF_LastLineRep10_OFF           2
+#define MC_ROIName_WRF_1stColRep10               (MCPARAMID)( 6517 << 14)
+#define MC_ROIName_WRF_1stColRep10_ON              1
+#define MC_ROIName_WRF_1stColRep10_OFF             2
+#define MC_ROIName_WRF_LastColRep10              (MCPARAMID)( 6518 << 14)
+#define MC_ROIName_WRF_LastColRep10_ON             1
+#define MC_ROIName_WRF_LastColRep10_OFF            2
+#define MC_ROIName_WRF_ColumnIx10                (MCPARAMID)( 6519 << 14)
+#define MC_ROIName_WRF_TOIwidth10                (MCPARAMID)( 6520 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI10      (MCPARAMID)( 6521 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI10      (MCPARAMID)( 6522 << 14)
+#define MC_ROIName_WRF_Line110                   (MCPARAMID)( 6523 << 14)
+#define MC_ROIName_WRF_Line110_GB                  1
+#define MC_ROIName_WRF_Line110_BG                  2
+#define MC_ROIName_WRF_Line110_RG                  3
+#define MC_ROIName_WRF_Line110_GR                  4
+#define MC_ROIName_WRF_XferSizeM1010             (MCPARAMID)( 6524 << 14)
+#define MC_ROIName_WRF_XferSizeM1110             (MCPARAMID)( 6525 << 14)
+#define MC_ROIName_WRF_XferSizeM1210             (MCPARAMID)( 6526 << 14)
+#define MC_ROIName_WRF_XferSizeM1310             (MCPARAMID)( 6527 << 14)
+#define MC_ROIName_WRF_TOIheight10               (MCPARAMID)( 6528 << 14)
+#define MC_ROIName_WRF_LastTOI10                 (MCPARAMID)( 6529 << 14)
+#define MC_ROIName_WRF_LastTOI10_TRUE              1
+#define MC_ROIName_WRF_LastTOI10_FALSE             2
+#define MC_ROIName_WRF_TOIoffset10               (MCPARAMID)( 6530 << 14)
+#define MC_ROIName_WRF_TOIPitch10                (MCPARAMID)( 6531 << 14)
+#define MC_ROIName_WRF_NbOfLine10                (MCPARAMID)( 6532 << 14)
+#define MC_ROIName_WRF_1stLineRep11              (MCPARAMID)( 6533 << 14)
+#define MC_ROIName_WRF_1stLineRep11_ON             1
+#define MC_ROIName_WRF_1stLineRep11_OFF            2
+#define MC_ROIName_WRF_LastLineRep11             (MCPARAMID)( 6534 << 14)
+#define MC_ROIName_WRF_LastLineRep11_ON            1
+#define MC_ROIName_WRF_LastLineRep11_OFF           2
+#define MC_ROIName_WRF_1stColRep11               (MCPARAMID)( 6535 << 14)
+#define MC_ROIName_WRF_1stColRep11_ON              1
+#define MC_ROIName_WRF_1stColRep11_OFF             2
+#define MC_ROIName_WRF_LastColRep11              (MCPARAMID)( 6536 << 14)
+#define MC_ROIName_WRF_LastColRep11_ON             1
+#define MC_ROIName_WRF_LastColRep11_OFF            2
+#define MC_ROIName_WRF_ColumnIx11                (MCPARAMID)( 6537 << 14)
+#define MC_ROIName_WRF_TOIwidth11                (MCPARAMID)( 6538 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI11      (MCPARAMID)( 6539 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI11      (MCPARAMID)( 6540 << 14)
+#define MC_ROIName_WRF_Line111                   (MCPARAMID)( 6541 << 14)
+#define MC_ROIName_WRF_Line111_GB                  1
+#define MC_ROIName_WRF_Line111_BG                  2
+#define MC_ROIName_WRF_Line111_RG                  3
+#define MC_ROIName_WRF_Line111_GR                  4
+#define MC_ROIName_WRF_XferSizeM1011             (MCPARAMID)( 6542 << 14)
+#define MC_ROIName_WRF_XferSizeM1111             (MCPARAMID)( 6543 << 14)
+#define MC_ROIName_WRF_XferSizeM1211             (MCPARAMID)( 6544 << 14)
+#define MC_ROIName_WRF_XferSizeM1311             (MCPARAMID)( 6545 << 14)
+#define MC_ROIName_WRF_TOIheight11               (MCPARAMID)( 6546 << 14)
+#define MC_ROIName_WRF_LastTOI11                 (MCPARAMID)( 6547 << 14)
+#define MC_ROIName_WRF_LastTOI11_TRUE              1
+#define MC_ROIName_WRF_LastTOI11_FALSE             2
+#define MC_ROIName_WRF_TOIoffset11               (MCPARAMID)( 6548 << 14)
+#define MC_ROIName_WRF_TOIPitch11                (MCPARAMID)( 6549 << 14)
+#define MC_ROIName_WRF_NbOfLine11                (MCPARAMID)( 6550 << 14)
+#define MC_ROIName_WRF_1stLineRep12              (MCPARAMID)( 6551 << 14)
+#define MC_ROIName_WRF_1stLineRep12_ON             1
+#define MC_ROIName_WRF_1stLineRep12_OFF            2
+#define MC_ROIName_WRF_LastLineRep12             (MCPARAMID)( 6552 << 14)
+#define MC_ROIName_WRF_LastLineRep12_ON            1
+#define MC_ROIName_WRF_LastLineRep12_OFF           2
+#define MC_ROIName_WRF_1stColRep12               (MCPARAMID)( 6553 << 14)
+#define MC_ROIName_WRF_1stColRep12_ON              1
+#define MC_ROIName_WRF_1stColRep12_OFF             2
+#define MC_ROIName_WRF_LastColRep12              (MCPARAMID)( 6554 << 14)
+#define MC_ROIName_WRF_LastColRep12_ON             1
+#define MC_ROIName_WRF_LastColRep12_OFF            2
+#define MC_ROIName_WRF_ColumnIx12                (MCPARAMID)( 6555 << 14)
+#define MC_ROIName_WRF_TOIwidth12                (MCPARAMID)( 6556 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI12      (MCPARAMID)( 6557 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI12      (MCPARAMID)( 6558 << 14)
+#define MC_ROIName_WRF_Line112                   (MCPARAMID)( 6559 << 14)
+#define MC_ROIName_WRF_Line112_GB                  1
+#define MC_ROIName_WRF_Line112_BG                  2
+#define MC_ROIName_WRF_Line112_RG                  3
+#define MC_ROIName_WRF_Line112_GR                  4
+#define MC_ROIName_WRF_XferSizeM1012             (MCPARAMID)( 6560 << 14)
+#define MC_ROIName_WRF_XferSizeM1112             (MCPARAMID)( 6561 << 14)
+#define MC_ROIName_WRF_XferSizeM1212             (MCPARAMID)( 6562 << 14)
+#define MC_ROIName_WRF_XferSizeM1312             (MCPARAMID)( 6563 << 14)
+#define MC_ROIName_WRF_TOIheight12               (MCPARAMID)( 6564 << 14)
+#define MC_ROIName_WRF_LastTOI12                 (MCPARAMID)( 6565 << 14)
+#define MC_ROIName_WRF_LastTOI12_TRUE              1
+#define MC_ROIName_WRF_LastTOI12_FALSE             2
+#define MC_ROIName_WRF_TOIoffset12               (MCPARAMID)( 6566 << 14)
+#define MC_ROIName_WRF_TOIPitch12                (MCPARAMID)( 6567 << 14)
+#define MC_ROIName_WRF_NbOfLine12                (MCPARAMID)( 6568 << 14)
+#define MC_ROIName_WRF_1stLineRep13              (MCPARAMID)( 6569 << 14)
+#define MC_ROIName_WRF_1stLineRep13_ON             1
+#define MC_ROIName_WRF_1stLineRep13_OFF            2
+#define MC_ROIName_WRF_LastLineRep13             (MCPARAMID)( 6570 << 14)
+#define MC_ROIName_WRF_LastLineRep13_ON            1
+#define MC_ROIName_WRF_LastLineRep13_OFF           2
+#define MC_ROIName_WRF_1stColRep13               (MCPARAMID)( 6571 << 14)
+#define MC_ROIName_WRF_1stColRep13_ON              1
+#define MC_ROIName_WRF_1stColRep13_OFF             2
+#define MC_ROIName_WRF_LastColRep13              (MCPARAMID)( 6572 << 14)
+#define MC_ROIName_WRF_LastColRep13_ON             1
+#define MC_ROIName_WRF_LastColRep13_OFF            2
+#define MC_ROIName_WRF_ColumnIx13                (MCPARAMID)( 6573 << 14)
+#define MC_ROIName_WRF_TOIwidth13                (MCPARAMID)( 6574 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI13      (MCPARAMID)( 6575 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI13      (MCPARAMID)( 6576 << 14)
+#define MC_ROIName_WRF_Line113                   (MCPARAMID)( 6577 << 14)
+#define MC_ROIName_WRF_Line113_GB                  1
+#define MC_ROIName_WRF_Line113_BG                  2
+#define MC_ROIName_WRF_Line113_RG                  3
+#define MC_ROIName_WRF_Line113_GR                  4
+#define MC_ROIName_WRF_XferSizeM1013             (MCPARAMID)( 6578 << 14)
+#define MC_ROIName_WRF_XferSizeM1113             (MCPARAMID)( 6579 << 14)
+#define MC_ROIName_WRF_XferSizeM1213             (MCPARAMID)( 6580 << 14)
+#define MC_ROIName_WRF_XferSizeM1313             (MCPARAMID)( 6581 << 14)
+#define MC_ROIName_WRF_TOIheight13               (MCPARAMID)( 6582 << 14)
+#define MC_ROIName_WRF_LastTOI13                 (MCPARAMID)( 6583 << 14)
+#define MC_ROIName_WRF_LastTOI13_TRUE              1
+#define MC_ROIName_WRF_LastTOI13_FALSE             2
+#define MC_ROIName_WRF_TOIoffset13               (MCPARAMID)( 6584 << 14)
+#define MC_ROIName_WRF_TOIPitch13                (MCPARAMID)( 6585 << 14)
+#define MC_ROIName_WRF_NbOfLine13                (MCPARAMID)( 6586 << 14)
+#define MC_ROIName_WRF_1stLineRep14              (MCPARAMID)( 6587 << 14)
+#define MC_ROIName_WRF_1stLineRep14_ON             1
+#define MC_ROIName_WRF_1stLineRep14_OFF            2
+#define MC_ROIName_WRF_LastLineRep14             (MCPARAMID)( 6588 << 14)
+#define MC_ROIName_WRF_LastLineRep14_ON            1
+#define MC_ROIName_WRF_LastLineRep14_OFF           2
+#define MC_ROIName_WRF_1stColRep14               (MCPARAMID)( 6589 << 14)
+#define MC_ROIName_WRF_1stColRep14_ON              1
+#define MC_ROIName_WRF_1stColRep14_OFF             2
+#define MC_ROIName_WRF_LastColRep14              (MCPARAMID)( 6590 << 14)
+#define MC_ROIName_WRF_LastColRep14_ON             1
+#define MC_ROIName_WRF_LastColRep14_OFF            2
+#define MC_ROIName_WRF_ColumnIx14                (MCPARAMID)( 6591 << 14)
+#define MC_ROIName_WRF_TOIwidth14                (MCPARAMID)( 6592 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI14      (MCPARAMID)( 6593 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI14      (MCPARAMID)( 6594 << 14)
+#define MC_ROIName_WRF_Line114                   (MCPARAMID)( 6595 << 14)
+#define MC_ROIName_WRF_Line114_GB                  1
+#define MC_ROIName_WRF_Line114_BG                  2
+#define MC_ROIName_WRF_Line114_RG                  3
+#define MC_ROIName_WRF_Line114_GR                  4
+#define MC_ROIName_WRF_XferSizeM1014             (MCPARAMID)( 6596 << 14)
+#define MC_ROIName_WRF_XferSizeM1114             (MCPARAMID)( 6597 << 14)
+#define MC_ROIName_WRF_XferSizeM1214             (MCPARAMID)( 6598 << 14)
+#define MC_ROIName_WRF_XferSizeM1314             (MCPARAMID)( 6599 << 14)
+#define MC_ROIName_WRF_TOIheight14               (MCPARAMID)( 6600 << 14)
+#define MC_ROIName_WRF_LastTOI14                 (MCPARAMID)( 6601 << 14)
+#define MC_ROIName_WRF_LastTOI14_TRUE              1
+#define MC_ROIName_WRF_LastTOI14_FALSE             2
+#define MC_ROIName_WRF_TOIoffset14               (MCPARAMID)( 6602 << 14)
+#define MC_ROIName_WRF_TOIPitch14                (MCPARAMID)( 6603 << 14)
+#define MC_ROIName_WRF_NbOfLine14                (MCPARAMID)( 6604 << 14)
+#define MC_ROIName_WRF_1stLineRep15              (MCPARAMID)( 6605 << 14)
+#define MC_ROIName_WRF_1stLineRep15_ON             1
+#define MC_ROIName_WRF_1stLineRep15_OFF            2
+#define MC_ROIName_WRF_LastLineRep15             (MCPARAMID)( 6606 << 14)
+#define MC_ROIName_WRF_LastLineRep15_ON            1
+#define MC_ROIName_WRF_LastLineRep15_OFF           2
+#define MC_ROIName_WRF_1stColRep15               (MCPARAMID)( 6607 << 14)
+#define MC_ROIName_WRF_1stColRep15_ON              1
+#define MC_ROIName_WRF_1stColRep15_OFF             2
+#define MC_ROIName_WRF_LastColRep15              (MCPARAMID)( 6608 << 14)
+#define MC_ROIName_WRF_LastColRep15_ON             1
+#define MC_ROIName_WRF_LastColRep15_OFF            2
+#define MC_ROIName_WRF_ColumnIx15                (MCPARAMID)( 6609 << 14)
+#define MC_ROIName_WRF_TOIwidth15                (MCPARAMID)( 6610 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI15      (MCPARAMID)( 6611 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI15      (MCPARAMID)( 6612 << 14)
+#define MC_ROIName_WRF_Line115                   (MCPARAMID)( 6613 << 14)
+#define MC_ROIName_WRF_Line115_GB                  1
+#define MC_ROIName_WRF_Line115_BG                  2
+#define MC_ROIName_WRF_Line115_RG                  3
+#define MC_ROIName_WRF_Line115_GR                  4
+#define MC_ROIName_WRF_XferSizeM1015             (MCPARAMID)( 6614 << 14)
+#define MC_ROIName_WRF_XferSizeM1115             (MCPARAMID)( 6615 << 14)
+#define MC_ROIName_WRF_XferSizeM1215             (MCPARAMID)( 6616 << 14)
+#define MC_ROIName_WRF_XferSizeM1315             (MCPARAMID)( 6617 << 14)
+#define MC_ROIName_WRF_TOIheight15               (MCPARAMID)( 6618 << 14)
+#define MC_ROIName_WRF_LastTOI15                 (MCPARAMID)( 6619 << 14)
+#define MC_ROIName_WRF_LastTOI15_TRUE              1
+#define MC_ROIName_WRF_LastTOI15_FALSE             2
+#define MC_ROIName_WRF_TOIoffset15               (MCPARAMID)( 6620 << 14)
+#define MC_ROIName_WRF_TOIPitch15                (MCPARAMID)( 6621 << 14)
+#define MC_ROIName_WRF_NbOfLine15                (MCPARAMID)( 6622 << 14)
+#define MC_ROIName_WRF_1stLineRep16              (MCPARAMID)( 6623 << 14)
+#define MC_ROIName_WRF_1stLineRep16_ON             1
+#define MC_ROIName_WRF_1stLineRep16_OFF            2
+#define MC_ROIName_WRF_LastLineRep16             (MCPARAMID)( 6624 << 14)
+#define MC_ROIName_WRF_LastLineRep16_ON            1
+#define MC_ROIName_WRF_LastLineRep16_OFF           2
+#define MC_ROIName_WRF_1stColRep16               (MCPARAMID)( 6625 << 14)
+#define MC_ROIName_WRF_1stColRep16_ON              1
+#define MC_ROIName_WRF_1stColRep16_OFF             2
+#define MC_ROIName_WRF_LastColRep16              (MCPARAMID)( 6626 << 14)
+#define MC_ROIName_WRF_LastColRep16_ON             1
+#define MC_ROIName_WRF_LastColRep16_OFF            2
+#define MC_ROIName_WRF_ColumnIx16                (MCPARAMID)( 6627 << 14)
+#define MC_ROIName_WRF_TOIwidth16                (MCPARAMID)( 6628 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI16      (MCPARAMID)( 6629 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI16      (MCPARAMID)( 6630 << 14)
+#define MC_ROIName_WRF_Line116                   (MCPARAMID)( 6631 << 14)
+#define MC_ROIName_WRF_Line116_GB                  1
+#define MC_ROIName_WRF_Line116_BG                  2
+#define MC_ROIName_WRF_Line116_RG                  3
+#define MC_ROIName_WRF_Line116_GR                  4
+#define MC_ROIName_WRF_XferSizeM1016             (MCPARAMID)( 6632 << 14)
+#define MC_ROIName_WRF_XferSizeM1116             (MCPARAMID)( 6633 << 14)
+#define MC_ROIName_WRF_XferSizeM1216             (MCPARAMID)( 6634 << 14)
+#define MC_ROIName_WRF_XferSizeM1316             (MCPARAMID)( 6635 << 14)
+#define MC_ROIName_WRF_TOIheight16               (MCPARAMID)( 6636 << 14)
+#define MC_ROIName_WRF_LastTOI16                 (MCPARAMID)( 6637 << 14)
+#define MC_ROIName_WRF_LastTOI16_TRUE              1
+#define MC_ROIName_WRF_LastTOI16_FALSE             2
+#define MC_ROIName_WRF_TOIoffset16               (MCPARAMID)( 6638 << 14)
+#define MC_ROIName_WRF_TOIPitch16                (MCPARAMID)( 6639 << 14)
+#define MC_ROIName_WRF_NbOfLine16                (MCPARAMID)( 6640 << 14)
+#define MC_ROIName_WRF_1stLineRep17              (MCPARAMID)( 6641 << 14)
+#define MC_ROIName_WRF_1stLineRep17_ON             1
+#define MC_ROIName_WRF_1stLineRep17_OFF            2
+#define MC_ROIName_WRF_LastLineRep17             (MCPARAMID)( 6642 << 14)
+#define MC_ROIName_WRF_LastLineRep17_ON            1
+#define MC_ROIName_WRF_LastLineRep17_OFF           2
+#define MC_ROIName_WRF_1stColRep17               (MCPARAMID)( 6643 << 14)
+#define MC_ROIName_WRF_1stColRep17_ON              1
+#define MC_ROIName_WRF_1stColRep17_OFF             2
+#define MC_ROIName_WRF_LastColRep17              (MCPARAMID)( 6644 << 14)
+#define MC_ROIName_WRF_LastColRep17_ON             1
+#define MC_ROIName_WRF_LastColRep17_OFF            2
+#define MC_ROIName_WRF_ColumnIx17                (MCPARAMID)( 6645 << 14)
+#define MC_ROIName_WRF_TOIwidth17                (MCPARAMID)( 6646 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI17      (MCPARAMID)( 6647 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI17      (MCPARAMID)( 6648 << 14)
+#define MC_ROIName_WRF_Line117                   (MCPARAMID)( 6649 << 14)
+#define MC_ROIName_WRF_Line117_GB                  1
+#define MC_ROIName_WRF_Line117_BG                  2
+#define MC_ROIName_WRF_Line117_RG                  3
+#define MC_ROIName_WRF_Line117_GR                  4
+#define MC_ROIName_WRF_XferSizeM1017             (MCPARAMID)( 6650 << 14)
+#define MC_ROIName_WRF_XferSizeM1117             (MCPARAMID)( 6651 << 14)
+#define MC_ROIName_WRF_XferSizeM1217             (MCPARAMID)( 6652 << 14)
+#define MC_ROIName_WRF_XferSizeM1317             (MCPARAMID)( 6653 << 14)
+#define MC_ROIName_WRF_TOIheight17               (MCPARAMID)( 6654 << 14)
+#define MC_ROIName_WRF_LastTOI17                 (MCPARAMID)( 6655 << 14)
+#define MC_ROIName_WRF_LastTOI17_TRUE              1
+#define MC_ROIName_WRF_LastTOI17_FALSE             2
+#define MC_ROIName_WRF_TOIoffset17               (MCPARAMID)( 6656 << 14)
+#define MC_ROIName_WRF_TOIPitch17                (MCPARAMID)( 6657 << 14)
+#define MC_ROIName_WRF_NbOfLine17                (MCPARAMID)( 6658 << 14)
+#define MC_ROIName_WRF_1stLineRep18              (MCPARAMID)( 6659 << 14)
+#define MC_ROIName_WRF_1stLineRep18_ON             1
+#define MC_ROIName_WRF_1stLineRep18_OFF            2
+#define MC_ROIName_WRF_LastLineRep18             (MCPARAMID)( 6660 << 14)
+#define MC_ROIName_WRF_LastLineRep18_ON            1
+#define MC_ROIName_WRF_LastLineRep18_OFF           2
+#define MC_ROIName_WRF_1stColRep18               (MCPARAMID)( 6661 << 14)
+#define MC_ROIName_WRF_1stColRep18_ON              1
+#define MC_ROIName_WRF_1stColRep18_OFF             2
+#define MC_ROIName_WRF_LastColRep18              (MCPARAMID)( 6662 << 14)
+#define MC_ROIName_WRF_LastColRep18_ON             1
+#define MC_ROIName_WRF_LastColRep18_OFF            2
+#define MC_ROIName_WRF_ColumnIx18                (MCPARAMID)( 6663 << 14)
+#define MC_ROIName_WRF_TOIwidth18                (MCPARAMID)( 6664 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI18      (MCPARAMID)( 6665 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI18      (MCPARAMID)( 6666 << 14)
+#define MC_ROIName_WRF_Line118                   (MCPARAMID)( 6667 << 14)
+#define MC_ROIName_WRF_Line118_GB                  1
+#define MC_ROIName_WRF_Line118_BG                  2
+#define MC_ROIName_WRF_Line118_RG                  3
+#define MC_ROIName_WRF_Line118_GR                  4
+#define MC_ROIName_WRF_XferSizeM1018             (MCPARAMID)( 6668 << 14)
+#define MC_ROIName_WRF_XferSizeM1118             (MCPARAMID)( 6669 << 14)
+#define MC_ROIName_WRF_XferSizeM1218             (MCPARAMID)( 6670 << 14)
+#define MC_ROIName_WRF_XferSizeM1318             (MCPARAMID)( 6671 << 14)
+#define MC_ROIName_WRF_TOIheight18               (MCPARAMID)( 6672 << 14)
+#define MC_ROIName_WRF_LastTOI18                 (MCPARAMID)( 6673 << 14)
+#define MC_ROIName_WRF_LastTOI18_TRUE              1
+#define MC_ROIName_WRF_LastTOI18_FALSE             2
+#define MC_ROIName_WRF_TOIoffset18               (MCPARAMID)( 6674 << 14)
+#define MC_ROIName_WRF_TOIPitch18                (MCPARAMID)( 6675 << 14)
+#define MC_ROIName_WRF_NbOfLine18                (MCPARAMID)( 6676 << 14)
+#define MC_ROIName_WRF_1stLineRep19              (MCPARAMID)( 6677 << 14)
+#define MC_ROIName_WRF_1stLineRep19_ON             1
+#define MC_ROIName_WRF_1stLineRep19_OFF            2
+#define MC_ROIName_WRF_LastLineRep19             (MCPARAMID)( 6678 << 14)
+#define MC_ROIName_WRF_LastLineRep19_ON            1
+#define MC_ROIName_WRF_LastLineRep19_OFF           2
+#define MC_ROIName_WRF_1stColRep19               (MCPARAMID)( 6679 << 14)
+#define MC_ROIName_WRF_1stColRep19_ON              1
+#define MC_ROIName_WRF_1stColRep19_OFF             2
+#define MC_ROIName_WRF_LastColRep19              (MCPARAMID)( 6680 << 14)
+#define MC_ROIName_WRF_LastColRep19_ON             1
+#define MC_ROIName_WRF_LastColRep19_OFF            2
+#define MC_ROIName_WRF_ColumnIx19                (MCPARAMID)( 6681 << 14)
+#define MC_ROIName_WRF_TOIwidth19                (MCPARAMID)( 6682 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI19      (MCPARAMID)( 6683 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI19      (MCPARAMID)( 6684 << 14)
+#define MC_ROIName_WRF_Line119                   (MCPARAMID)( 6685 << 14)
+#define MC_ROIName_WRF_Line119_GB                  1
+#define MC_ROIName_WRF_Line119_BG                  2
+#define MC_ROIName_WRF_Line119_RG                  3
+#define MC_ROIName_WRF_Line119_GR                  4
+#define MC_ROIName_WRF_XferSizeM1019             (MCPARAMID)( 6686 << 14)
+#define MC_ROIName_WRF_XferSizeM1119             (MCPARAMID)( 6687 << 14)
+#define MC_ROIName_WRF_XferSizeM1219             (MCPARAMID)( 6688 << 14)
+#define MC_ROIName_WRF_XferSizeM1319             (MCPARAMID)( 6689 << 14)
+#define MC_ROIName_WRF_TOIheight19               (MCPARAMID)( 6690 << 14)
+#define MC_ROIName_WRF_LastTOI19                 (MCPARAMID)( 6691 << 14)
+#define MC_ROIName_WRF_LastTOI19_TRUE              1
+#define MC_ROIName_WRF_LastTOI19_FALSE             2
+#define MC_ROIName_WRF_TOIoffset19               (MCPARAMID)( 6692 << 14)
+#define MC_ROIName_WRF_TOIPitch19                (MCPARAMID)( 6693 << 14)
+#define MC_ROIName_WRF_NbOfLine19                (MCPARAMID)( 6694 << 14)
+#define MC_ROIName_WRF_1stLineRep20              (MCPARAMID)( 6695 << 14)
+#define MC_ROIName_WRF_1stLineRep20_ON             1
+#define MC_ROIName_WRF_1stLineRep20_OFF            2
+#define MC_ROIName_WRF_LastLineRep20             (MCPARAMID)( 6696 << 14)
+#define MC_ROIName_WRF_LastLineRep20_ON            1
+#define MC_ROIName_WRF_LastLineRep20_OFF           2
+#define MC_ROIName_WRF_1stColRep20               (MCPARAMID)( 6697 << 14)
+#define MC_ROIName_WRF_1stColRep20_ON              1
+#define MC_ROIName_WRF_1stColRep20_OFF             2
+#define MC_ROIName_WRF_LastColRep20              (MCPARAMID)( 6698 << 14)
+#define MC_ROIName_WRF_LastColRep20_ON             1
+#define MC_ROIName_WRF_LastColRep20_OFF            2
+#define MC_ROIName_WRF_ColumnIx20                (MCPARAMID)( 6699 << 14)
+#define MC_ROIName_WRF_TOIwidth20                (MCPARAMID)( 6700 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI20      (MCPARAMID)( 6701 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI20      (MCPARAMID)( 6702 << 14)
+#define MC_ROIName_WRF_Line120                   (MCPARAMID)( 6703 << 14)
+#define MC_ROIName_WRF_Line120_GB                  1
+#define MC_ROIName_WRF_Line120_BG                  2
+#define MC_ROIName_WRF_Line120_RG                  3
+#define MC_ROIName_WRF_Line120_GR                  4
+#define MC_ROIName_WRF_XferSizeM1020             (MCPARAMID)( 6704 << 14)
+#define MC_ROIName_WRF_XferSizeM1120             (MCPARAMID)( 6705 << 14)
+#define MC_ROIName_WRF_XferSizeM1220             (MCPARAMID)( 6706 << 14)
+#define MC_ROIName_WRF_XferSizeM1320             (MCPARAMID)( 6707 << 14)
+#define MC_ROIName_WRF_TOIheight20               (MCPARAMID)( 6708 << 14)
+#define MC_ROIName_WRF_LastTOI20                 (MCPARAMID)( 6709 << 14)
+#define MC_ROIName_WRF_LastTOI20_TRUE              1
+#define MC_ROIName_WRF_LastTOI20_FALSE             2
+#define MC_ROIName_WRF_TOIoffset20               (MCPARAMID)( 6710 << 14)
+#define MC_ROIName_WRF_TOIPitch20                (MCPARAMID)( 6711 << 14)
+#define MC_ROIName_WRF_NbOfLine20                (MCPARAMID)( 6712 << 14)
+#define MC_ROIName_WRF_1stLineRep21              (MCPARAMID)( 6713 << 14)
+#define MC_ROIName_WRF_1stLineRep21_ON             1
+#define MC_ROIName_WRF_1stLineRep21_OFF            2
+#define MC_ROIName_WRF_LastLineRep21             (MCPARAMID)( 6714 << 14)
+#define MC_ROIName_WRF_LastLineRep21_ON            1
+#define MC_ROIName_WRF_LastLineRep21_OFF           2
+#define MC_ROIName_WRF_1stColRep21               (MCPARAMID)( 6715 << 14)
+#define MC_ROIName_WRF_1stColRep21_ON              1
+#define MC_ROIName_WRF_1stColRep21_OFF             2
+#define MC_ROIName_WRF_LastColRep21              (MCPARAMID)( 6716 << 14)
+#define MC_ROIName_WRF_LastColRep21_ON             1
+#define MC_ROIName_WRF_LastColRep21_OFF            2
+#define MC_ROIName_WRF_ColumnIx21                (MCPARAMID)( 6717 << 14)
+#define MC_ROIName_WRF_TOIwidth21                (MCPARAMID)( 6718 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI21      (MCPARAMID)( 6719 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI21      (MCPARAMID)( 6720 << 14)
+#define MC_ROIName_WRF_Line121                   (MCPARAMID)( 6721 << 14)
+#define MC_ROIName_WRF_Line121_GB                  1
+#define MC_ROIName_WRF_Line121_BG                  2
+#define MC_ROIName_WRF_Line121_RG                  3
+#define MC_ROIName_WRF_Line121_GR                  4
+#define MC_ROIName_WRF_XferSizeM1021             (MCPARAMID)( 6722 << 14)
+#define MC_ROIName_WRF_XferSizeM1121             (MCPARAMID)( 6723 << 14)
+#define MC_ROIName_WRF_XferSizeM1221             (MCPARAMID)( 6724 << 14)
+#define MC_ROIName_WRF_XferSizeM1321             (MCPARAMID)( 6725 << 14)
+#define MC_ROIName_WRF_TOIheight21               (MCPARAMID)( 6726 << 14)
+#define MC_ROIName_WRF_LastTOI21                 (MCPARAMID)( 6727 << 14)
+#define MC_ROIName_WRF_LastTOI21_TRUE              1
+#define MC_ROIName_WRF_LastTOI21_FALSE             2
+#define MC_ROIName_WRF_TOIoffset21               (MCPARAMID)( 6728 << 14)
+#define MC_ROIName_WRF_TOIPitch21                (MCPARAMID)( 6729 << 14)
+#define MC_ROIName_WRF_NbOfLine21                (MCPARAMID)( 6730 << 14)
+#define MC_ROIName_WRF_1stLineRep22              (MCPARAMID)( 6731 << 14)
+#define MC_ROIName_WRF_1stLineRep22_ON             1
+#define MC_ROIName_WRF_1stLineRep22_OFF            2
+#define MC_ROIName_WRF_LastLineRep22             (MCPARAMID)( 6732 << 14)
+#define MC_ROIName_WRF_LastLineRep22_ON            1
+#define MC_ROIName_WRF_LastLineRep22_OFF           2
+#define MC_ROIName_WRF_1stColRep22               (MCPARAMID)( 6733 << 14)
+#define MC_ROIName_WRF_1stColRep22_ON              1
+#define MC_ROIName_WRF_1stColRep22_OFF             2
+#define MC_ROIName_WRF_LastColRep22              (MCPARAMID)( 6734 << 14)
+#define MC_ROIName_WRF_LastColRep22_ON             1
+#define MC_ROIName_WRF_LastColRep22_OFF            2
+#define MC_ROIName_WRF_ColumnIx22                (MCPARAMID)( 6735 << 14)
+#define MC_ROIName_WRF_TOIwidth22                (MCPARAMID)( 6736 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI22      (MCPARAMID)( 6737 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI22      (MCPARAMID)( 6738 << 14)
+#define MC_ROIName_WRF_Line122                   (MCPARAMID)( 6739 << 14)
+#define MC_ROIName_WRF_Line122_GB                  1
+#define MC_ROIName_WRF_Line122_BG                  2
+#define MC_ROIName_WRF_Line122_RG                  3
+#define MC_ROIName_WRF_Line122_GR                  4
+#define MC_ROIName_WRF_XferSizeM1022             (MCPARAMID)( 6740 << 14)
+#define MC_ROIName_WRF_XferSizeM1122             (MCPARAMID)( 6741 << 14)
+#define MC_ROIName_WRF_XferSizeM1222             (MCPARAMID)( 6742 << 14)
+#define MC_ROIName_WRF_XferSizeM1322             (MCPARAMID)( 6743 << 14)
+#define MC_ROIName_WRF_TOIheight22               (MCPARAMID)( 6744 << 14)
+#define MC_ROIName_WRF_LastTOI22                 (MCPARAMID)( 6745 << 14)
+#define MC_ROIName_WRF_LastTOI22_TRUE              1
+#define MC_ROIName_WRF_LastTOI22_FALSE             2
+#define MC_ROIName_WRF_TOIoffset22               (MCPARAMID)( 6746 << 14)
+#define MC_ROIName_WRF_TOIPitch22                (MCPARAMID)( 6747 << 14)
+#define MC_ROIName_WRF_NbOfLine22                (MCPARAMID)( 6748 << 14)
+#define MC_ROIName_WRF_1stLineRep23              (MCPARAMID)( 6749 << 14)
+#define MC_ROIName_WRF_1stLineRep23_ON             1
+#define MC_ROIName_WRF_1stLineRep23_OFF            2
+#define MC_ROIName_WRF_LastLineRep23             (MCPARAMID)( 6750 << 14)
+#define MC_ROIName_WRF_LastLineRep23_ON            1
+#define MC_ROIName_WRF_LastLineRep23_OFF           2
+#define MC_ROIName_WRF_1stColRep23               (MCPARAMID)( 6751 << 14)
+#define MC_ROIName_WRF_1stColRep23_ON              1
+#define MC_ROIName_WRF_1stColRep23_OFF             2
+#define MC_ROIName_WRF_LastColRep23              (MCPARAMID)( 6752 << 14)
+#define MC_ROIName_WRF_LastColRep23_ON             1
+#define MC_ROIName_WRF_LastColRep23_OFF            2
+#define MC_ROIName_WRF_ColumnIx23                (MCPARAMID)( 6753 << 14)
+#define MC_ROIName_WRF_TOIwidth23                (MCPARAMID)( 6754 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI23      (MCPARAMID)( 6755 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI23      (MCPARAMID)( 6756 << 14)
+#define MC_ROIName_WRF_Line123                   (MCPARAMID)( 6757 << 14)
+#define MC_ROIName_WRF_Line123_GB                  1
+#define MC_ROIName_WRF_Line123_BG                  2
+#define MC_ROIName_WRF_Line123_RG                  3
+#define MC_ROIName_WRF_Line123_GR                  4
+#define MC_ROIName_WRF_XferSizeM1023             (MCPARAMID)( 6758 << 14)
+#define MC_ROIName_WRF_XferSizeM1123             (MCPARAMID)( 6759 << 14)
+#define MC_ROIName_WRF_XferSizeM1223             (MCPARAMID)( 6760 << 14)
+#define MC_ROIName_WRF_XferSizeM1323             (MCPARAMID)( 6761 << 14)
+#define MC_ROIName_WRF_TOIheight23               (MCPARAMID)( 6762 << 14)
+#define MC_ROIName_WRF_LastTOI23                 (MCPARAMID)( 6763 << 14)
+#define MC_ROIName_WRF_LastTOI23_TRUE              1
+#define MC_ROIName_WRF_LastTOI23_FALSE             2
+#define MC_ROIName_WRF_TOIoffset23               (MCPARAMID)( 6764 << 14)
+#define MC_ROIName_WRF_TOIPitch23                (MCPARAMID)( 6765 << 14)
+#define MC_ROIName_WRF_NbOfLine23                (MCPARAMID)( 6766 << 14)
+#define MC_ROIName_WRF_1stLineRep24              (MCPARAMID)( 6767 << 14)
+#define MC_ROIName_WRF_1stLineRep24_ON             1
+#define MC_ROIName_WRF_1stLineRep24_OFF            2
+#define MC_ROIName_WRF_LastLineRep24             (MCPARAMID)( 6768 << 14)
+#define MC_ROIName_WRF_LastLineRep24_ON            1
+#define MC_ROIName_WRF_LastLineRep24_OFF           2
+#define MC_ROIName_WRF_1stColRep24               (MCPARAMID)( 6769 << 14)
+#define MC_ROIName_WRF_1stColRep24_ON              1
+#define MC_ROIName_WRF_1stColRep24_OFF             2
+#define MC_ROIName_WRF_LastColRep24              (MCPARAMID)( 6770 << 14)
+#define MC_ROIName_WRF_LastColRep24_ON             1
+#define MC_ROIName_WRF_LastColRep24_OFF            2
+#define MC_ROIName_WRF_ColumnIx24                (MCPARAMID)( 6771 << 14)
+#define MC_ROIName_WRF_TOIwidth24                (MCPARAMID)( 6772 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI24      (MCPARAMID)( 6773 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI24      (MCPARAMID)( 6774 << 14)
+#define MC_ROIName_WRF_Line124                   (MCPARAMID)( 6775 << 14)
+#define MC_ROIName_WRF_Line124_GB                  1
+#define MC_ROIName_WRF_Line124_BG                  2
+#define MC_ROIName_WRF_Line124_RG                  3
+#define MC_ROIName_WRF_Line124_GR                  4
+#define MC_ROIName_WRF_XferSizeM1024             (MCPARAMID)( 6776 << 14)
+#define MC_ROIName_WRF_XferSizeM1124             (MCPARAMID)( 6777 << 14)
+#define MC_ROIName_WRF_XferSizeM1224             (MCPARAMID)( 6778 << 14)
+#define MC_ROIName_WRF_XferSizeM1324             (MCPARAMID)( 6779 << 14)
+#define MC_ROIName_WRF_TOIheight24               (MCPARAMID)( 6780 << 14)
+#define MC_ROIName_WRF_LastTOI24                 (MCPARAMID)( 6781 << 14)
+#define MC_ROIName_WRF_LastTOI24_TRUE              1
+#define MC_ROIName_WRF_LastTOI24_FALSE             2
+#define MC_ROIName_WRF_TOIoffset24               (MCPARAMID)( 6782 << 14)
+#define MC_ROIName_WRF_TOIPitch24                (MCPARAMID)( 6783 << 14)
+#define MC_ROIName_WRF_NbOfLine24                (MCPARAMID)( 6784 << 14)
+#define MC_ROIName_WRF_1stLineRep25              (MCPARAMID)( 6785 << 14)
+#define MC_ROIName_WRF_1stLineRep25_ON             1
+#define MC_ROIName_WRF_1stLineRep25_OFF            2
+#define MC_ROIName_WRF_LastLineRep25             (MCPARAMID)( 6786 << 14)
+#define MC_ROIName_WRF_LastLineRep25_ON            1
+#define MC_ROIName_WRF_LastLineRep25_OFF           2
+#define MC_ROIName_WRF_1stColRep25               (MCPARAMID)( 6787 << 14)
+#define MC_ROIName_WRF_1stColRep25_ON              1
+#define MC_ROIName_WRF_1stColRep25_OFF             2
+#define MC_ROIName_WRF_LastColRep25              (MCPARAMID)( 6788 << 14)
+#define MC_ROIName_WRF_LastColRep25_ON             1
+#define MC_ROIName_WRF_LastColRep25_OFF            2
+#define MC_ROIName_WRF_ColumnIx25                (MCPARAMID)( 6789 << 14)
+#define MC_ROIName_WRF_TOIwidth25                (MCPARAMID)( 6790 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI25      (MCPARAMID)( 6791 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI25      (MCPARAMID)( 6792 << 14)
+#define MC_ROIName_WRF_Line125                   (MCPARAMID)( 6793 << 14)
+#define MC_ROIName_WRF_Line125_GB                  1
+#define MC_ROIName_WRF_Line125_BG                  2
+#define MC_ROIName_WRF_Line125_RG                  3
+#define MC_ROIName_WRF_Line125_GR                  4
+#define MC_ROIName_WRF_XferSizeM1025             (MCPARAMID)( 6794 << 14)
+#define MC_ROIName_WRF_XferSizeM1125             (MCPARAMID)( 6795 << 14)
+#define MC_ROIName_WRF_XferSizeM1225             (MCPARAMID)( 6796 << 14)
+#define MC_ROIName_WRF_XferSizeM1325             (MCPARAMID)( 6797 << 14)
+#define MC_ROIName_WRF_TOIheight25               (MCPARAMID)( 6798 << 14)
+#define MC_ROIName_WRF_LastTOI25                 (MCPARAMID)( 6799 << 14)
+#define MC_ROIName_WRF_LastTOI25_TRUE              1
+#define MC_ROIName_WRF_LastTOI25_FALSE             2
+#define MC_ROIName_WRF_TOIoffset25               (MCPARAMID)( 6800 << 14)
+#define MC_ROIName_WRF_TOIPitch25                (MCPARAMID)( 6801 << 14)
+#define MC_ROIName_WRF_NbOfLine25                (MCPARAMID)( 6802 << 14)
+#define MC_ROIName_WRF_1stLineRep26              (MCPARAMID)( 6803 << 14)
+#define MC_ROIName_WRF_1stLineRep26_ON             1
+#define MC_ROIName_WRF_1stLineRep26_OFF            2
+#define MC_ROIName_WRF_LastLineRep26             (MCPARAMID)( 6804 << 14)
+#define MC_ROIName_WRF_LastLineRep26_ON            1
+#define MC_ROIName_WRF_LastLineRep26_OFF           2
+#define MC_ROIName_WRF_1stColRep26               (MCPARAMID)( 6805 << 14)
+#define MC_ROIName_WRF_1stColRep26_ON              1
+#define MC_ROIName_WRF_1stColRep26_OFF             2
+#define MC_ROIName_WRF_LastColRep26              (MCPARAMID)( 6806 << 14)
+#define MC_ROIName_WRF_LastColRep26_ON             1
+#define MC_ROIName_WRF_LastColRep26_OFF            2
+#define MC_ROIName_WRF_ColumnIx26                (MCPARAMID)( 6807 << 14)
+#define MC_ROIName_WRF_TOIwidth26                (MCPARAMID)( 6808 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI26      (MCPARAMID)( 6809 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI26      (MCPARAMID)( 6810 << 14)
+#define MC_ROIName_WRF_Line126                   (MCPARAMID)( 6811 << 14)
+#define MC_ROIName_WRF_Line126_GB                  1
+#define MC_ROIName_WRF_Line126_BG                  2
+#define MC_ROIName_WRF_Line126_RG                  3
+#define MC_ROIName_WRF_Line126_GR                  4
+#define MC_ROIName_WRF_XferSizeM1026             (MCPARAMID)( 6812 << 14)
+#define MC_ROIName_WRF_XferSizeM1126             (MCPARAMID)( 6813 << 14)
+#define MC_ROIName_WRF_XferSizeM1226             (MCPARAMID)( 6814 << 14)
+#define MC_ROIName_WRF_XferSizeM1326             (MCPARAMID)( 6815 << 14)
+#define MC_ROIName_WRF_TOIheight26               (MCPARAMID)( 6816 << 14)
+#define MC_ROIName_WRF_LastTOI26                 (MCPARAMID)( 6817 << 14)
+#define MC_ROIName_WRF_LastTOI26_TRUE              1
+#define MC_ROIName_WRF_LastTOI26_FALSE             2
+#define MC_ROIName_WRF_TOIoffset26               (MCPARAMID)( 6818 << 14)
+#define MC_ROIName_WRF_TOIPitch26                (MCPARAMID)( 6819 << 14)
+#define MC_ROIName_WRF_NbOfLine26                (MCPARAMID)( 6820 << 14)
+#define MC_ROIName_WRF_1stLineRep27              (MCPARAMID)( 6821 << 14)
+#define MC_ROIName_WRF_1stLineRep27_ON             1
+#define MC_ROIName_WRF_1stLineRep27_OFF            2
+#define MC_ROIName_WRF_LastLineRep27             (MCPARAMID)( 6822 << 14)
+#define MC_ROIName_WRF_LastLineRep27_ON            1
+#define MC_ROIName_WRF_LastLineRep27_OFF           2
+#define MC_ROIName_WRF_1stColRep27               (MCPARAMID)( 6823 << 14)
+#define MC_ROIName_WRF_1stColRep27_ON              1
+#define MC_ROIName_WRF_1stColRep27_OFF             2
+#define MC_ROIName_WRF_LastColRep27              (MCPARAMID)( 6824 << 14)
+#define MC_ROIName_WRF_LastColRep27_ON             1
+#define MC_ROIName_WRF_LastColRep27_OFF            2
+#define MC_ROIName_WRF_ColumnIx27                (MCPARAMID)( 6825 << 14)
+#define MC_ROIName_WRF_TOIwidth27                (MCPARAMID)( 6826 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI27      (MCPARAMID)( 6827 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI27      (MCPARAMID)( 6828 << 14)
+#define MC_ROIName_WRF_Line127                   (MCPARAMID)( 6829 << 14)
+#define MC_ROIName_WRF_Line127_GB                  1
+#define MC_ROIName_WRF_Line127_BG                  2
+#define MC_ROIName_WRF_Line127_RG                  3
+#define MC_ROIName_WRF_Line127_GR                  4
+#define MC_ROIName_WRF_XferSizeM1027             (MCPARAMID)( 6830 << 14)
+#define MC_ROIName_WRF_XferSizeM1127             (MCPARAMID)( 6831 << 14)
+#define MC_ROIName_WRF_XferSizeM1227             (MCPARAMID)( 6832 << 14)
+#define MC_ROIName_WRF_XferSizeM1327             (MCPARAMID)( 6833 << 14)
+#define MC_ROIName_WRF_TOIheight27               (MCPARAMID)( 6834 << 14)
+#define MC_ROIName_WRF_LastTOI27                 (MCPARAMID)( 6835 << 14)
+#define MC_ROIName_WRF_LastTOI27_TRUE              1
+#define MC_ROIName_WRF_LastTOI27_FALSE             2
+#define MC_ROIName_WRF_TOIoffset27               (MCPARAMID)( 6836 << 14)
+#define MC_ROIName_WRF_TOIPitch27                (MCPARAMID)( 6837 << 14)
+#define MC_ROIName_WRF_NbOfLine27                (MCPARAMID)( 6838 << 14)
+#define MC_ROIName_WRF_1stLineRep28              (MCPARAMID)( 6839 << 14)
+#define MC_ROIName_WRF_1stLineRep28_ON             1
+#define MC_ROIName_WRF_1stLineRep28_OFF            2
+#define MC_ROIName_WRF_LastLineRep28             (MCPARAMID)( 6840 << 14)
+#define MC_ROIName_WRF_LastLineRep28_ON            1
+#define MC_ROIName_WRF_LastLineRep28_OFF           2
+#define MC_ROIName_WRF_1stColRep28               (MCPARAMID)( 6841 << 14)
+#define MC_ROIName_WRF_1stColRep28_ON              1
+#define MC_ROIName_WRF_1stColRep28_OFF             2
+#define MC_ROIName_WRF_LastColRep28              (MCPARAMID)( 6842 << 14)
+#define MC_ROIName_WRF_LastColRep28_ON             1
+#define MC_ROIName_WRF_LastColRep28_OFF            2
+#define MC_ROIName_WRF_ColumnIx28                (MCPARAMID)( 6843 << 14)
+#define MC_ROIName_WRF_TOIwidth28                (MCPARAMID)( 6844 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI28      (MCPARAMID)( 6845 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI28      (MCPARAMID)( 6846 << 14)
+#define MC_ROIName_WRF_Line128                   (MCPARAMID)( 6847 << 14)
+#define MC_ROIName_WRF_Line128_GB                  1
+#define MC_ROIName_WRF_Line128_BG                  2
+#define MC_ROIName_WRF_Line128_RG                  3
+#define MC_ROIName_WRF_Line128_GR                  4
+#define MC_ROIName_WRF_XferSizeM1028             (MCPARAMID)( 6848 << 14)
+#define MC_ROIName_WRF_XferSizeM1128             (MCPARAMID)( 6849 << 14)
+#define MC_ROIName_WRF_XferSizeM1228             (MCPARAMID)( 6850 << 14)
+#define MC_ROIName_WRF_XferSizeM1328             (MCPARAMID)( 6851 << 14)
+#define MC_ROIName_WRF_TOIheight28               (MCPARAMID)( 6852 << 14)
+#define MC_ROIName_WRF_LastTOI28                 (MCPARAMID)( 6853 << 14)
+#define MC_ROIName_WRF_LastTOI28_TRUE              1
+#define MC_ROIName_WRF_LastTOI28_FALSE             2
+#define MC_ROIName_WRF_TOIoffset28               (MCPARAMID)( 6854 << 14)
+#define MC_ROIName_WRF_TOIPitch28                (MCPARAMID)( 6855 << 14)
+#define MC_ROIName_WRF_NbOfLine28                (MCPARAMID)( 6856 << 14)
+#define MC_ROIName_WRF_1stLineRep29              (MCPARAMID)( 6857 << 14)
+#define MC_ROIName_WRF_1stLineRep29_ON             1
+#define MC_ROIName_WRF_1stLineRep29_OFF            2
+#define MC_ROIName_WRF_LastLineRep29             (MCPARAMID)( 6858 << 14)
+#define MC_ROIName_WRF_LastLineRep29_ON            1
+#define MC_ROIName_WRF_LastLineRep29_OFF           2
+#define MC_ROIName_WRF_1stColRep29               (MCPARAMID)( 6859 << 14)
+#define MC_ROIName_WRF_1stColRep29_ON              1
+#define MC_ROIName_WRF_1stColRep29_OFF             2
+#define MC_ROIName_WRF_LastColRep29              (MCPARAMID)( 6860 << 14)
+#define MC_ROIName_WRF_LastColRep29_ON             1
+#define MC_ROIName_WRF_LastColRep29_OFF            2
+#define MC_ROIName_WRF_ColumnIx29                (MCPARAMID)( 6861 << 14)
+#define MC_ROIName_WRF_TOIwidth29                (MCPARAMID)( 6862 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI29      (MCPARAMID)( 6863 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI29      (MCPARAMID)( 6864 << 14)
+#define MC_ROIName_WRF_Line129                   (MCPARAMID)( 6865 << 14)
+#define MC_ROIName_WRF_Line129_GB                  1
+#define MC_ROIName_WRF_Line129_BG                  2
+#define MC_ROIName_WRF_Line129_RG                  3
+#define MC_ROIName_WRF_Line129_GR                  4
+#define MC_ROIName_WRF_XferSizeM1029             (MCPARAMID)( 6866 << 14)
+#define MC_ROIName_WRF_XferSizeM1129             (MCPARAMID)( 6867 << 14)
+#define MC_ROIName_WRF_XferSizeM1229             (MCPARAMID)( 6868 << 14)
+#define MC_ROIName_WRF_XferSizeM1329             (MCPARAMID)( 6869 << 14)
+#define MC_ROIName_WRF_TOIheight29               (MCPARAMID)( 6870 << 14)
+#define MC_ROIName_WRF_LastTOI29                 (MCPARAMID)( 6871 << 14)
+#define MC_ROIName_WRF_LastTOI29_TRUE              1
+#define MC_ROIName_WRF_LastTOI29_FALSE             2
+#define MC_ROIName_WRF_TOIoffset29               (MCPARAMID)( 6872 << 14)
+#define MC_ROIName_WRF_TOIPitch29                (MCPARAMID)( 6873 << 14)
+#define MC_ROIName_WRF_NbOfLine29                (MCPARAMID)( 6874 << 14)
+#define MC_ROIName_WRF_1stLineRep30              (MCPARAMID)( 6875 << 14)
+#define MC_ROIName_WRF_1stLineRep30_ON             1
+#define MC_ROIName_WRF_1stLineRep30_OFF            2
+#define MC_ROIName_WRF_LastLineRep30             (MCPARAMID)( 6876 << 14)
+#define MC_ROIName_WRF_LastLineRep30_ON            1
+#define MC_ROIName_WRF_LastLineRep30_OFF           2
+#define MC_ROIName_WRF_1stColRep30               (MCPARAMID)( 6877 << 14)
+#define MC_ROIName_WRF_1stColRep30_ON              1
+#define MC_ROIName_WRF_1stColRep30_OFF             2
+#define MC_ROIName_WRF_LastColRep30              (MCPARAMID)( 6878 << 14)
+#define MC_ROIName_WRF_LastColRep30_ON             1
+#define MC_ROIName_WRF_LastColRep30_OFF            2
+#define MC_ROIName_WRF_ColumnIx30                (MCPARAMID)( 6879 << 14)
+#define MC_ROIName_WRF_TOIwidth30                (MCPARAMID)( 6880 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI30      (MCPARAMID)( 6881 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI30      (MCPARAMID)( 6882 << 14)
+#define MC_ROIName_WRF_Line130                   (MCPARAMID)( 6883 << 14)
+#define MC_ROIName_WRF_Line130_GB                  1
+#define MC_ROIName_WRF_Line130_BG                  2
+#define MC_ROIName_WRF_Line130_RG                  3
+#define MC_ROIName_WRF_Line130_GR                  4
+#define MC_ROIName_WRF_XferSizeM1030             (MCPARAMID)( 6884 << 14)
+#define MC_ROIName_WRF_XferSizeM1130             (MCPARAMID)( 6885 << 14)
+#define MC_ROIName_WRF_XferSizeM1230             (MCPARAMID)( 6886 << 14)
+#define MC_ROIName_WRF_XferSizeM1330             (MCPARAMID)( 6887 << 14)
+#define MC_ROIName_WRF_TOIheight30               (MCPARAMID)( 6888 << 14)
+#define MC_ROIName_WRF_LastTOI30                 (MCPARAMID)( 6889 << 14)
+#define MC_ROIName_WRF_LastTOI30_TRUE              1
+#define MC_ROIName_WRF_LastTOI30_FALSE             2
+#define MC_ROIName_WRF_TOIoffset30               (MCPARAMID)( 6890 << 14)
+#define MC_ROIName_WRF_TOIPitch30                (MCPARAMID)( 6891 << 14)
+#define MC_ROIName_WRF_NbOfLine30                (MCPARAMID)( 6892 << 14)
+#define MC_ROIName_WRF_1stLineRep31              (MCPARAMID)( 6893 << 14)
+#define MC_ROIName_WRF_1stLineRep31_ON             1
+#define MC_ROIName_WRF_1stLineRep31_OFF            2
+#define MC_ROIName_WRF_LastLineRep31             (MCPARAMID)( 6894 << 14)
+#define MC_ROIName_WRF_LastLineRep31_ON            1
+#define MC_ROIName_WRF_LastLineRep31_OFF           2
+#define MC_ROIName_WRF_1stColRep31               (MCPARAMID)( 6895 << 14)
+#define MC_ROIName_WRF_1stColRep31_ON              1
+#define MC_ROIName_WRF_1stColRep31_OFF             2
+#define MC_ROIName_WRF_LastColRep31              (MCPARAMID)( 6896 << 14)
+#define MC_ROIName_WRF_LastColRep31_ON             1
+#define MC_ROIName_WRF_LastColRep31_OFF            2
+#define MC_ROIName_WRF_ColumnIx31                (MCPARAMID)( 6897 << 14)
+#define MC_ROIName_WRF_TOIwidth31                (MCPARAMID)( 6898 << 14)
+#define MC_ROIName_ColorRegistrationX_TOI31      (MCPARAMID)( 6899 << 14)
+#define MC_ROIName_ColorRegistrationY_TOI31      (MCPARAMID)( 6900 << 14)
+#define MC_ROIName_WRF_Line131                   (MCPARAMID)( 6901 << 14)
+#define MC_ROIName_WRF_Line131_GB                  1
+#define MC_ROIName_WRF_Line131_BG                  2
+#define MC_ROIName_WRF_Line131_RG                  3
+#define MC_ROIName_WRF_Line131_GR                  4
+#define MC_ROIName_WRF_XferSizeM1031             (MCPARAMID)( 6902 << 14)
+#define MC_ROIName_WRF_XferSizeM1131             (MCPARAMID)( 6903 << 14)
+#define MC_ROIName_WRF_XferSizeM1231             (MCPARAMID)( 6904 << 14)
+#define MC_ROIName_WRF_XferSizeM1331             (MCPARAMID)( 6905 << 14)
+#define MC_ROIName_WRF_TOIheight31               (MCPARAMID)( 6906 << 14)
+#define MC_ROIName_WRF_LastTOI31                 (MCPARAMID)( 6907 << 14)
+#define MC_ROIName_WRF_LastTOI31_TRUE              1
+#define MC_ROIName_WRF_LastTOI31_FALSE             2
+#define MC_ROIName_WRF_TOIoffset31               (MCPARAMID)( 6908 << 14)
+#define MC_ROIName_WRF_TOIPitch31                (MCPARAMID)( 6909 << 14)
+#define MC_ROIName_WRF_NbOfLine31                (MCPARAMID)( 6910 << 14)
+#define MC__CamConfig_AREA_RG_DX                  17
+#define MC__EXP2On_T1                            (MCPARAMID)( 6911 << 14)
+#define MC__EXP2Off_T1                           (MCPARAMID)( 6912 << 14)
+#define MC__RESET2On_T1                          (MCPARAMID)( 6913 << 14)
+#define MC__RESET2Off_T1                         (MCPARAMID)( 6914 << 14)
+#define MC__STROBE2On_T1                         (MCPARAMID)( 6915 << 14)
+#define MC__STROBE2Off_T1                        (MCPARAMID)( 6916 << 14)
+#define MC__EXPGap_T1                            (MCPARAMID)( 6917 << 14)
+#define MC__EXP2Width_T1                         (MCPARAMID)( 6918 << 14)
+#define MC__STROBE2Width_T1                      (MCPARAMID)( 6919 << 14)
+#define MC__EXP2On2STROBE2Off_T1                 (MCPARAMID)( 6920 << 14)
+#define MC_DoubleExposure_Filter                 (MCPARAMID)( 6921 << 14)
+#define MC_Expose2_us                            (MCPARAMID)( 6922 << 14)
+#define MC__EXP2Width_10ns                       (MCPARAMID)( 6923 << 14)
+#define MC_ExposeGapMin_us                       (MCPARAMID)( 6924 << 14)
+#define MC_ExposeGap_us                          (MCPARAMID)( 6925 << 14)
+#define MC__EXPGap_10ns                          (MCPARAMID)( 6926 << 14)
+#define MC_Strobe2Dur                            (MCPARAMID)( 6927 << 14)
+#define MC_Strobe2_Filter                        (MCPARAMID)( 6928 << 14)
+#define MC_Strobe2Pos                            (MCPARAMID)( 6929 << 14)
+#define MC_CompressionType_MJPG                    4
+#define MC_CompressionType_JPEG                    5
+#define MC_Strobe2Ctl                            (MCPARAMID)( 6930 << 14)
+#define MC_Strobe2Ctl_TTL                          1
+#define MC_Strobe2Ctl_ITTL                         2
+#define MC_Strobe2Ctl_IOC                          3
+#define MC_Strobe2Ctl_IOE                          4
+#define MC_Strobe2Ctl_OPTO                         5
+#define MC_Strobe2Line                           (MCPARAMID)( 6931 << 14)
+#define MC_Strobe2Line_NOM                         1
+#define MC_Strobe2Line_STR                         2
+#define MC_Strobe2Line_STX                         3
+#define MC_Strobe2Line_STY                         4
+#define MC_Strobe2Line_STZ                         5
+#define MC_Strobe2Line_ALT1                        6
+#define MC_Strobe2Line_ALT2                        7
+#define MC_Strobe2Line_IO1                         8
+#define MC_Strobe2Line_IO2                         9
+#define MC_Strobe2Line_IO3                        10
+#define MC_Strobe2Line_IO4                        11
+#define MC_Strobe2Line_ISOA1                      12
+#define MC_Strobe2Line_ISOA2                      13
+#define MC_Strobe2Line_STA                        14
+#define MC_Strobe2Line_Filter                    (MCPARAMID)( 6932 << 14)
+#define MC__Strobe2Line                          (MCPARAMID)( 6933 << 14)
+#define MC__Strobe2Line_NONE                       1
+#define MC__Strobe2Line_IO1                        2
+#define MC__Strobe2Line_IO2                        3
+#define MC__Strobe2Line_IO3                        4
+#define MC__Strobe2Line_IO4                        5
+#define MC__Strobe2Line_ISOA1                      6
+#define MC__Strobe2Line_ISOA2                      7
+#define MC__Strobe2Line_STA                        8
+#define MC_IO1Usage_STROBE2                        5
+#define MC_IO2Usage_STROBE2                        5
+#define MC_IO3Usage_STROBE2                        5
+#define MC_IO4Usage_STROBE2                        5
+#define MC_ISOA1Usage_STROBE2                      6
+#define MC_ISOA2Usage_STROBE2                      6
+#define MC___STAUsage_Check                      (MCPARAMID)( 6934 << 14)
+#define MC___STAUsage_Check_PASS                   1
+#define MC___STAUsage_Check_FAIL                   2
+#define MC_STAUsage_STROBE2                        5
+#define MC_Strobe2Level                          (MCPARAMID)( 6935 << 14)
+#define MC_Strobe2Level_PLSHIGH                    1
+#define MC_Strobe2Level_PLSLOW                     2
+#define MC__STROBE2_Def_On                       (MCPARAMID)( 6936 << 14)
+#define MC__STROBE2_Def_Off                      (MCPARAMID)( 6937 << 14)
+#define MC__RESET2_Def_On                        (MCPARAMID)( 6938 << 14)
+#define MC__RESET2_Def_Off                       (MCPARAMID)( 6939 << 14)
+#define MC_CamConfig_P50RG_DX                    283
+#define MC_Expose_WIDTH_DX                         9
+#define MC__RealTrigDelay_us                     (MCPARAMID)( 6940 << 14)
+#define MC_XF_ROI_LeftTOIColumnFlag              (MCPARAMID)( 6941 << 14)
+#define MC_AWB_ROI_LeftTOIColumnFlag             (MCPARAMID)( 6942 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd0                (MCPARAMID)( 6943 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd1                (MCPARAMID)( 6944 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd2                (MCPARAMID)( 6945 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd3                (MCPARAMID)( 6946 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd4                (MCPARAMID)( 6947 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd5                (MCPARAMID)( 6948 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd6                (MCPARAMID)( 6949 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd7                (MCPARAMID)( 6950 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd0               (MCPARAMID)( 6951 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd1               (MCPARAMID)( 6952 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd2               (MCPARAMID)( 6953 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd3               (MCPARAMID)( 6954 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd4               (MCPARAMID)( 6955 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd5               (MCPARAMID)( 6956 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd6               (MCPARAMID)( 6957 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd7               (MCPARAMID)( 6958 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd8                (MCPARAMID)( 6959 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd9                (MCPARAMID)( 6960 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd10               (MCPARAMID)( 6961 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd11               (MCPARAMID)( 6962 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd12               (MCPARAMID)( 6963 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd13               (MCPARAMID)( 6964 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd14               (MCPARAMID)( 6965 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd15               (MCPARAMID)( 6966 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd16               (MCPARAMID)( 6967 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd17               (MCPARAMID)( 6968 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd18               (MCPARAMID)( 6969 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd19               (MCPARAMID)( 6970 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd20               (MCPARAMID)( 6971 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd21               (MCPARAMID)( 6972 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd22               (MCPARAMID)( 6973 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd23               (MCPARAMID)( 6974 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd24               (MCPARAMID)( 6975 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd25               (MCPARAMID)( 6976 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd26               (MCPARAMID)( 6977 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd27               (MCPARAMID)( 6978 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd28               (MCPARAMID)( 6979 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd29               (MCPARAMID)( 6980 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd30               (MCPARAMID)( 6981 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd31               (MCPARAMID)( 6982 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd8               (MCPARAMID)( 6983 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd9               (MCPARAMID)( 6984 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd10              (MCPARAMID)( 6985 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd11              (MCPARAMID)( 6986 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd12              (MCPARAMID)( 6987 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd13              (MCPARAMID)( 6988 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd14              (MCPARAMID)( 6989 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd15              (MCPARAMID)( 6990 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd16              (MCPARAMID)( 6991 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd17              (MCPARAMID)( 6992 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd18              (MCPARAMID)( 6993 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd19              (MCPARAMID)( 6994 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd20              (MCPARAMID)( 6995 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd21              (MCPARAMID)( 6996 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd22              (MCPARAMID)( 6997 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd23              (MCPARAMID)( 6998 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd24              (MCPARAMID)( 6999 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd25              (MCPARAMID)( 7000 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd26              (MCPARAMID)( 7001 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd27              (MCPARAMID)( 7002 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd28              (MCPARAMID)( 7003 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd29              (MCPARAMID)( 7004 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd30              (MCPARAMID)( 7005 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd31              (MCPARAMID)( 7006 << 14)
+#define MC_XF_ROI_WRF_1stLineRep32               (MCPARAMID)( 7007 << 14)
+#define MC_XF_ROI_WRF_1stLineRep32_ON              1
+#define MC_XF_ROI_WRF_1stLineRep32_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep32              (MCPARAMID)( 7008 << 14)
+#define MC_XF_ROI_WRF_LastLineRep32_ON             1
+#define MC_XF_ROI_WRF_LastLineRep32_OFF            2
+#define MC_XF_ROI_WRF_1stColRep32                (MCPARAMID)( 7009 << 14)
+#define MC_XF_ROI_WRF_1stColRep32_ON               1
+#define MC_XF_ROI_WRF_1stColRep32_OFF              2
+#define MC_XF_ROI_WRF_LastColRep32               (MCPARAMID)( 7010 << 14)
+#define MC_XF_ROI_WRF_LastColRep32_ON              1
+#define MC_XF_ROI_WRF_LastColRep32_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx32                 (MCPARAMID)( 7011 << 14)
+#define MC_XF_ROI_WRF_TOIwidth32                 (MCPARAMID)( 7012 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI32       (MCPARAMID)( 7013 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI32       (MCPARAMID)( 7014 << 14)
+#define MC_XF_ROI_WRF_Line132                    (MCPARAMID)( 7015 << 14)
+#define MC_XF_ROI_WRF_Line132_GB                   1
+#define MC_XF_ROI_WRF_Line132_BG                   2
+#define MC_XF_ROI_WRF_Line132_RG                   3
+#define MC_XF_ROI_WRF_Line132_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1032              (MCPARAMID)( 7016 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1132              (MCPARAMID)( 7017 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1232              (MCPARAMID)( 7018 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1332              (MCPARAMID)( 7019 << 14)
+#define MC_XF_ROI_WRF_TOIheight32                (MCPARAMID)( 7020 << 14)
+#define MC_XF_ROI_WRF_LastTOI32                  (MCPARAMID)( 7021 << 14)
+#define MC_XF_ROI_WRF_LastTOI32_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI32_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset32                (MCPARAMID)( 7022 << 14)
+#define MC_XF_ROI_WRF_TOIPitch32                 (MCPARAMID)( 7023 << 14)
+#define MC_XF_ROI_WRF_NbOfLine32                 (MCPARAMID)( 7024 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd32               (MCPARAMID)( 7025 << 14)
+#define MC_XF_ROI_WRF_1stLineRep33               (MCPARAMID)( 7026 << 14)
+#define MC_XF_ROI_WRF_1stLineRep33_ON              1
+#define MC_XF_ROI_WRF_1stLineRep33_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep33              (MCPARAMID)( 7027 << 14)
+#define MC_XF_ROI_WRF_LastLineRep33_ON             1
+#define MC_XF_ROI_WRF_LastLineRep33_OFF            2
+#define MC_XF_ROI_WRF_1stColRep33                (MCPARAMID)( 7028 << 14)
+#define MC_XF_ROI_WRF_1stColRep33_ON               1
+#define MC_XF_ROI_WRF_1stColRep33_OFF              2
+#define MC_XF_ROI_WRF_LastColRep33               (MCPARAMID)( 7029 << 14)
+#define MC_XF_ROI_WRF_LastColRep33_ON              1
+#define MC_XF_ROI_WRF_LastColRep33_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx33                 (MCPARAMID)( 7030 << 14)
+#define MC_XF_ROI_WRF_TOIwidth33                 (MCPARAMID)( 7031 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI33       (MCPARAMID)( 7032 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI33       (MCPARAMID)( 7033 << 14)
+#define MC_XF_ROI_WRF_Line133                    (MCPARAMID)( 7034 << 14)
+#define MC_XF_ROI_WRF_Line133_GB                   1
+#define MC_XF_ROI_WRF_Line133_BG                   2
+#define MC_XF_ROI_WRF_Line133_RG                   3
+#define MC_XF_ROI_WRF_Line133_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1033              (MCPARAMID)( 7035 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1133              (MCPARAMID)( 7036 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1233              (MCPARAMID)( 7037 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1333              (MCPARAMID)( 7038 << 14)
+#define MC_XF_ROI_WRF_TOIheight33                (MCPARAMID)( 7039 << 14)
+#define MC_XF_ROI_WRF_LastTOI33                  (MCPARAMID)( 7040 << 14)
+#define MC_XF_ROI_WRF_LastTOI33_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI33_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset33                (MCPARAMID)( 7041 << 14)
+#define MC_XF_ROI_WRF_TOIPitch33                 (MCPARAMID)( 7042 << 14)
+#define MC_XF_ROI_WRF_NbOfLine33                 (MCPARAMID)( 7043 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd33               (MCPARAMID)( 7044 << 14)
+#define MC_XF_ROI_WRF_1stLineRep34               (MCPARAMID)( 7045 << 14)
+#define MC_XF_ROI_WRF_1stLineRep34_ON              1
+#define MC_XF_ROI_WRF_1stLineRep34_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep34              (MCPARAMID)( 7046 << 14)
+#define MC_XF_ROI_WRF_LastLineRep34_ON             1
+#define MC_XF_ROI_WRF_LastLineRep34_OFF            2
+#define MC_XF_ROI_WRF_1stColRep34                (MCPARAMID)( 7047 << 14)
+#define MC_XF_ROI_WRF_1stColRep34_ON               1
+#define MC_XF_ROI_WRF_1stColRep34_OFF              2
+#define MC_XF_ROI_WRF_LastColRep34               (MCPARAMID)( 7048 << 14)
+#define MC_XF_ROI_WRF_LastColRep34_ON              1
+#define MC_XF_ROI_WRF_LastColRep34_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx34                 (MCPARAMID)( 7049 << 14)
+#define MC_XF_ROI_WRF_TOIwidth34                 (MCPARAMID)( 7050 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI34       (MCPARAMID)( 7051 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI34       (MCPARAMID)( 7052 << 14)
+#define MC_XF_ROI_WRF_Line134                    (MCPARAMID)( 7053 << 14)
+#define MC_XF_ROI_WRF_Line134_GB                   1
+#define MC_XF_ROI_WRF_Line134_BG                   2
+#define MC_XF_ROI_WRF_Line134_RG                   3
+#define MC_XF_ROI_WRF_Line134_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1034              (MCPARAMID)( 7054 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1134              (MCPARAMID)( 7055 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1234              (MCPARAMID)( 7056 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1334              (MCPARAMID)( 7057 << 14)
+#define MC_XF_ROI_WRF_TOIheight34                (MCPARAMID)( 7058 << 14)
+#define MC_XF_ROI_WRF_LastTOI34                  (MCPARAMID)( 7059 << 14)
+#define MC_XF_ROI_WRF_LastTOI34_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI34_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset34                (MCPARAMID)( 7060 << 14)
+#define MC_XF_ROI_WRF_TOIPitch34                 (MCPARAMID)( 7061 << 14)
+#define MC_XF_ROI_WRF_NbOfLine34                 (MCPARAMID)( 7062 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd34               (MCPARAMID)( 7063 << 14)
+#define MC_XF_ROI_WRF_1stLineRep35               (MCPARAMID)( 7064 << 14)
+#define MC_XF_ROI_WRF_1stLineRep35_ON              1
+#define MC_XF_ROI_WRF_1stLineRep35_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep35              (MCPARAMID)( 7065 << 14)
+#define MC_XF_ROI_WRF_LastLineRep35_ON             1
+#define MC_XF_ROI_WRF_LastLineRep35_OFF            2
+#define MC_XF_ROI_WRF_1stColRep35                (MCPARAMID)( 7066 << 14)
+#define MC_XF_ROI_WRF_1stColRep35_ON               1
+#define MC_XF_ROI_WRF_1stColRep35_OFF              2
+#define MC_XF_ROI_WRF_LastColRep35               (MCPARAMID)( 7067 << 14)
+#define MC_XF_ROI_WRF_LastColRep35_ON              1
+#define MC_XF_ROI_WRF_LastColRep35_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx35                 (MCPARAMID)( 7068 << 14)
+#define MC_XF_ROI_WRF_TOIwidth35                 (MCPARAMID)( 7069 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI35       (MCPARAMID)( 7070 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI35       (MCPARAMID)( 7071 << 14)
+#define MC_XF_ROI_WRF_Line135                    (MCPARAMID)( 7072 << 14)
+#define MC_XF_ROI_WRF_Line135_GB                   1
+#define MC_XF_ROI_WRF_Line135_BG                   2
+#define MC_XF_ROI_WRF_Line135_RG                   3
+#define MC_XF_ROI_WRF_Line135_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1035              (MCPARAMID)( 7073 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1135              (MCPARAMID)( 7074 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1235              (MCPARAMID)( 7075 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1335              (MCPARAMID)( 7076 << 14)
+#define MC_XF_ROI_WRF_TOIheight35                (MCPARAMID)( 7077 << 14)
+#define MC_XF_ROI_WRF_LastTOI35                  (MCPARAMID)( 7078 << 14)
+#define MC_XF_ROI_WRF_LastTOI35_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI35_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset35                (MCPARAMID)( 7079 << 14)
+#define MC_XF_ROI_WRF_TOIPitch35                 (MCPARAMID)( 7080 << 14)
+#define MC_XF_ROI_WRF_NbOfLine35                 (MCPARAMID)( 7081 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd35               (MCPARAMID)( 7082 << 14)
+#define MC_XF_ROI_WRF_1stLineRep36               (MCPARAMID)( 7083 << 14)
+#define MC_XF_ROI_WRF_1stLineRep36_ON              1
+#define MC_XF_ROI_WRF_1stLineRep36_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep36              (MCPARAMID)( 7084 << 14)
+#define MC_XF_ROI_WRF_LastLineRep36_ON             1
+#define MC_XF_ROI_WRF_LastLineRep36_OFF            2
+#define MC_XF_ROI_WRF_1stColRep36                (MCPARAMID)( 7085 << 14)
+#define MC_XF_ROI_WRF_1stColRep36_ON               1
+#define MC_XF_ROI_WRF_1stColRep36_OFF              2
+#define MC_XF_ROI_WRF_LastColRep36               (MCPARAMID)( 7086 << 14)
+#define MC_XF_ROI_WRF_LastColRep36_ON              1
+#define MC_XF_ROI_WRF_LastColRep36_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx36                 (MCPARAMID)( 7087 << 14)
+#define MC_XF_ROI_WRF_TOIwidth36                 (MCPARAMID)( 7088 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI36       (MCPARAMID)( 7089 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI36       (MCPARAMID)( 7090 << 14)
+#define MC_XF_ROI_WRF_Line136                    (MCPARAMID)( 7091 << 14)
+#define MC_XF_ROI_WRF_Line136_GB                   1
+#define MC_XF_ROI_WRF_Line136_BG                   2
+#define MC_XF_ROI_WRF_Line136_RG                   3
+#define MC_XF_ROI_WRF_Line136_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1036              (MCPARAMID)( 7092 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1136              (MCPARAMID)( 7093 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1236              (MCPARAMID)( 7094 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1336              (MCPARAMID)( 7095 << 14)
+#define MC_XF_ROI_WRF_TOIheight36                (MCPARAMID)( 7096 << 14)
+#define MC_XF_ROI_WRF_LastTOI36                  (MCPARAMID)( 7097 << 14)
+#define MC_XF_ROI_WRF_LastTOI36_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI36_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset36                (MCPARAMID)( 7098 << 14)
+#define MC_XF_ROI_WRF_TOIPitch36                 (MCPARAMID)( 7099 << 14)
+#define MC_XF_ROI_WRF_NbOfLine36                 (MCPARAMID)( 7100 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd36               (MCPARAMID)( 7101 << 14)
+#define MC_XF_ROI_WRF_1stLineRep37               (MCPARAMID)( 7102 << 14)
+#define MC_XF_ROI_WRF_1stLineRep37_ON              1
+#define MC_XF_ROI_WRF_1stLineRep37_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep37              (MCPARAMID)( 7103 << 14)
+#define MC_XF_ROI_WRF_LastLineRep37_ON             1
+#define MC_XF_ROI_WRF_LastLineRep37_OFF            2
+#define MC_XF_ROI_WRF_1stColRep37                (MCPARAMID)( 7104 << 14)
+#define MC_XF_ROI_WRF_1stColRep37_ON               1
+#define MC_XF_ROI_WRF_1stColRep37_OFF              2
+#define MC_XF_ROI_WRF_LastColRep37               (MCPARAMID)( 7105 << 14)
+#define MC_XF_ROI_WRF_LastColRep37_ON              1
+#define MC_XF_ROI_WRF_LastColRep37_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx37                 (MCPARAMID)( 7106 << 14)
+#define MC_XF_ROI_WRF_TOIwidth37                 (MCPARAMID)( 7107 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI37       (MCPARAMID)( 7108 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI37       (MCPARAMID)( 7109 << 14)
+#define MC_XF_ROI_WRF_Line137                    (MCPARAMID)( 7110 << 14)
+#define MC_XF_ROI_WRF_Line137_GB                   1
+#define MC_XF_ROI_WRF_Line137_BG                   2
+#define MC_XF_ROI_WRF_Line137_RG                   3
+#define MC_XF_ROI_WRF_Line137_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1037              (MCPARAMID)( 7111 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1137              (MCPARAMID)( 7112 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1237              (MCPARAMID)( 7113 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1337              (MCPARAMID)( 7114 << 14)
+#define MC_XF_ROI_WRF_TOIheight37                (MCPARAMID)( 7115 << 14)
+#define MC_XF_ROI_WRF_LastTOI37                  (MCPARAMID)( 7116 << 14)
+#define MC_XF_ROI_WRF_LastTOI37_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI37_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset37                (MCPARAMID)( 7117 << 14)
+#define MC_XF_ROI_WRF_TOIPitch37                 (MCPARAMID)( 7118 << 14)
+#define MC_XF_ROI_WRF_NbOfLine37                 (MCPARAMID)( 7119 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd37               (MCPARAMID)( 7120 << 14)
+#define MC_XF_ROI_WRF_1stLineRep38               (MCPARAMID)( 7121 << 14)
+#define MC_XF_ROI_WRF_1stLineRep38_ON              1
+#define MC_XF_ROI_WRF_1stLineRep38_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep38              (MCPARAMID)( 7122 << 14)
+#define MC_XF_ROI_WRF_LastLineRep38_ON             1
+#define MC_XF_ROI_WRF_LastLineRep38_OFF            2
+#define MC_XF_ROI_WRF_1stColRep38                (MCPARAMID)( 7123 << 14)
+#define MC_XF_ROI_WRF_1stColRep38_ON               1
+#define MC_XF_ROI_WRF_1stColRep38_OFF              2
+#define MC_XF_ROI_WRF_LastColRep38               (MCPARAMID)( 7124 << 14)
+#define MC_XF_ROI_WRF_LastColRep38_ON              1
+#define MC_XF_ROI_WRF_LastColRep38_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx38                 (MCPARAMID)( 7125 << 14)
+#define MC_XF_ROI_WRF_TOIwidth38                 (MCPARAMID)( 7126 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI38       (MCPARAMID)( 7127 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI38       (MCPARAMID)( 7128 << 14)
+#define MC_XF_ROI_WRF_Line138                    (MCPARAMID)( 7129 << 14)
+#define MC_XF_ROI_WRF_Line138_GB                   1
+#define MC_XF_ROI_WRF_Line138_BG                   2
+#define MC_XF_ROI_WRF_Line138_RG                   3
+#define MC_XF_ROI_WRF_Line138_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1038              (MCPARAMID)( 7130 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1138              (MCPARAMID)( 7131 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1238              (MCPARAMID)( 7132 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1338              (MCPARAMID)( 7133 << 14)
+#define MC_XF_ROI_WRF_TOIheight38                (MCPARAMID)( 7134 << 14)
+#define MC_XF_ROI_WRF_LastTOI38                  (MCPARAMID)( 7135 << 14)
+#define MC_XF_ROI_WRF_LastTOI38_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI38_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset38                (MCPARAMID)( 7136 << 14)
+#define MC_XF_ROI_WRF_TOIPitch38                 (MCPARAMID)( 7137 << 14)
+#define MC_XF_ROI_WRF_NbOfLine38                 (MCPARAMID)( 7138 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd38               (MCPARAMID)( 7139 << 14)
+#define MC_XF_ROI_WRF_1stLineRep39               (MCPARAMID)( 7140 << 14)
+#define MC_XF_ROI_WRF_1stLineRep39_ON              1
+#define MC_XF_ROI_WRF_1stLineRep39_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep39              (MCPARAMID)( 7141 << 14)
+#define MC_XF_ROI_WRF_LastLineRep39_ON             1
+#define MC_XF_ROI_WRF_LastLineRep39_OFF            2
+#define MC_XF_ROI_WRF_1stColRep39                (MCPARAMID)( 7142 << 14)
+#define MC_XF_ROI_WRF_1stColRep39_ON               1
+#define MC_XF_ROI_WRF_1stColRep39_OFF              2
+#define MC_XF_ROI_WRF_LastColRep39               (MCPARAMID)( 7143 << 14)
+#define MC_XF_ROI_WRF_LastColRep39_ON              1
+#define MC_XF_ROI_WRF_LastColRep39_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx39                 (MCPARAMID)( 7144 << 14)
+#define MC_XF_ROI_WRF_TOIwidth39                 (MCPARAMID)( 7145 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI39       (MCPARAMID)( 7146 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI39       (MCPARAMID)( 7147 << 14)
+#define MC_XF_ROI_WRF_Line139                    (MCPARAMID)( 7148 << 14)
+#define MC_XF_ROI_WRF_Line139_GB                   1
+#define MC_XF_ROI_WRF_Line139_BG                   2
+#define MC_XF_ROI_WRF_Line139_RG                   3
+#define MC_XF_ROI_WRF_Line139_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1039              (MCPARAMID)( 7149 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1139              (MCPARAMID)( 7150 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1239              (MCPARAMID)( 7151 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1339              (MCPARAMID)( 7152 << 14)
+#define MC_XF_ROI_WRF_TOIheight39                (MCPARAMID)( 7153 << 14)
+#define MC_XF_ROI_WRF_LastTOI39                  (MCPARAMID)( 7154 << 14)
+#define MC_XF_ROI_WRF_LastTOI39_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI39_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset39                (MCPARAMID)( 7155 << 14)
+#define MC_XF_ROI_WRF_TOIPitch39                 (MCPARAMID)( 7156 << 14)
+#define MC_XF_ROI_WRF_NbOfLine39                 (MCPARAMID)( 7157 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd39               (MCPARAMID)( 7158 << 14)
+#define MC_XF_ROI_WRF_1stLineRep40               (MCPARAMID)( 7159 << 14)
+#define MC_XF_ROI_WRF_1stLineRep40_ON              1
+#define MC_XF_ROI_WRF_1stLineRep40_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep40              (MCPARAMID)( 7160 << 14)
+#define MC_XF_ROI_WRF_LastLineRep40_ON             1
+#define MC_XF_ROI_WRF_LastLineRep40_OFF            2
+#define MC_XF_ROI_WRF_1stColRep40                (MCPARAMID)( 7161 << 14)
+#define MC_XF_ROI_WRF_1stColRep40_ON               1
+#define MC_XF_ROI_WRF_1stColRep40_OFF              2
+#define MC_XF_ROI_WRF_LastColRep40               (MCPARAMID)( 7162 << 14)
+#define MC_XF_ROI_WRF_LastColRep40_ON              1
+#define MC_XF_ROI_WRF_LastColRep40_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx40                 (MCPARAMID)( 7163 << 14)
+#define MC_XF_ROI_WRF_TOIwidth40                 (MCPARAMID)( 7164 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI40       (MCPARAMID)( 7165 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI40       (MCPARAMID)( 7166 << 14)
+#define MC_XF_ROI_WRF_Line140                    (MCPARAMID)( 7167 << 14)
+#define MC_XF_ROI_WRF_Line140_GB                   1
+#define MC_XF_ROI_WRF_Line140_BG                   2
+#define MC_XF_ROI_WRF_Line140_RG                   3
+#define MC_XF_ROI_WRF_Line140_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1040              (MCPARAMID)( 7168 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1140              (MCPARAMID)( 7169 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1240              (MCPARAMID)( 7170 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1340              (MCPARAMID)( 7171 << 14)
+#define MC_XF_ROI_WRF_TOIheight40                (MCPARAMID)( 7172 << 14)
+#define MC_XF_ROI_WRF_LastTOI40                  (MCPARAMID)( 7173 << 14)
+#define MC_XF_ROI_WRF_LastTOI40_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI40_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset40                (MCPARAMID)( 7174 << 14)
+#define MC_XF_ROI_WRF_TOIPitch40                 (MCPARAMID)( 7175 << 14)
+#define MC_XF_ROI_WRF_NbOfLine40                 (MCPARAMID)( 7176 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd40               (MCPARAMID)( 7177 << 14)
+#define MC_XF_ROI_WRF_1stLineRep41               (MCPARAMID)( 7178 << 14)
+#define MC_XF_ROI_WRF_1stLineRep41_ON              1
+#define MC_XF_ROI_WRF_1stLineRep41_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep41              (MCPARAMID)( 7179 << 14)
+#define MC_XF_ROI_WRF_LastLineRep41_ON             1
+#define MC_XF_ROI_WRF_LastLineRep41_OFF            2
+#define MC_XF_ROI_WRF_1stColRep41                (MCPARAMID)( 7180 << 14)
+#define MC_XF_ROI_WRF_1stColRep41_ON               1
+#define MC_XF_ROI_WRF_1stColRep41_OFF              2
+#define MC_XF_ROI_WRF_LastColRep41               (MCPARAMID)( 7181 << 14)
+#define MC_XF_ROI_WRF_LastColRep41_ON              1
+#define MC_XF_ROI_WRF_LastColRep41_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx41                 (MCPARAMID)( 7182 << 14)
+#define MC_XF_ROI_WRF_TOIwidth41                 (MCPARAMID)( 7183 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI41       (MCPARAMID)( 7184 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI41       (MCPARAMID)( 7185 << 14)
+#define MC_XF_ROI_WRF_Line141                    (MCPARAMID)( 7186 << 14)
+#define MC_XF_ROI_WRF_Line141_GB                   1
+#define MC_XF_ROI_WRF_Line141_BG                   2
+#define MC_XF_ROI_WRF_Line141_RG                   3
+#define MC_XF_ROI_WRF_Line141_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1041              (MCPARAMID)( 7187 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1141              (MCPARAMID)( 7188 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1241              (MCPARAMID)( 7189 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1341              (MCPARAMID)( 7190 << 14)
+#define MC_XF_ROI_WRF_TOIheight41                (MCPARAMID)( 7191 << 14)
+#define MC_XF_ROI_WRF_LastTOI41                  (MCPARAMID)( 7192 << 14)
+#define MC_XF_ROI_WRF_LastTOI41_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI41_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset41                (MCPARAMID)( 7193 << 14)
+#define MC_XF_ROI_WRF_TOIPitch41                 (MCPARAMID)( 7194 << 14)
+#define MC_XF_ROI_WRF_NbOfLine41                 (MCPARAMID)( 7195 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd41               (MCPARAMID)( 7196 << 14)
+#define MC_XF_ROI_WRF_1stLineRep42               (MCPARAMID)( 7197 << 14)
+#define MC_XF_ROI_WRF_1stLineRep42_ON              1
+#define MC_XF_ROI_WRF_1stLineRep42_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep42              (MCPARAMID)( 7198 << 14)
+#define MC_XF_ROI_WRF_LastLineRep42_ON             1
+#define MC_XF_ROI_WRF_LastLineRep42_OFF            2
+#define MC_XF_ROI_WRF_1stColRep42                (MCPARAMID)( 7199 << 14)
+#define MC_XF_ROI_WRF_1stColRep42_ON               1
+#define MC_XF_ROI_WRF_1stColRep42_OFF              2
+#define MC_XF_ROI_WRF_LastColRep42               (MCPARAMID)( 7200 << 14)
+#define MC_XF_ROI_WRF_LastColRep42_ON              1
+#define MC_XF_ROI_WRF_LastColRep42_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx42                 (MCPARAMID)( 7201 << 14)
+#define MC_XF_ROI_WRF_TOIwidth42                 (MCPARAMID)( 7202 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI42       (MCPARAMID)( 7203 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI42       (MCPARAMID)( 7204 << 14)
+#define MC_XF_ROI_WRF_Line142                    (MCPARAMID)( 7205 << 14)
+#define MC_XF_ROI_WRF_Line142_GB                   1
+#define MC_XF_ROI_WRF_Line142_BG                   2
+#define MC_XF_ROI_WRF_Line142_RG                   3
+#define MC_XF_ROI_WRF_Line142_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1042              (MCPARAMID)( 7206 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1142              (MCPARAMID)( 7207 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1242              (MCPARAMID)( 7208 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1342              (MCPARAMID)( 7209 << 14)
+#define MC_XF_ROI_WRF_TOIheight42                (MCPARAMID)( 7210 << 14)
+#define MC_XF_ROI_WRF_LastTOI42                  (MCPARAMID)( 7211 << 14)
+#define MC_XF_ROI_WRF_LastTOI42_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI42_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset42                (MCPARAMID)( 7212 << 14)
+#define MC_XF_ROI_WRF_TOIPitch42                 (MCPARAMID)( 7213 << 14)
+#define MC_XF_ROI_WRF_NbOfLine42                 (MCPARAMID)( 7214 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd42               (MCPARAMID)( 7215 << 14)
+#define MC_XF_ROI_WRF_1stLineRep43               (MCPARAMID)( 7216 << 14)
+#define MC_XF_ROI_WRF_1stLineRep43_ON              1
+#define MC_XF_ROI_WRF_1stLineRep43_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep43              (MCPARAMID)( 7217 << 14)
+#define MC_XF_ROI_WRF_LastLineRep43_ON             1
+#define MC_XF_ROI_WRF_LastLineRep43_OFF            2
+#define MC_XF_ROI_WRF_1stColRep43                (MCPARAMID)( 7218 << 14)
+#define MC_XF_ROI_WRF_1stColRep43_ON               1
+#define MC_XF_ROI_WRF_1stColRep43_OFF              2
+#define MC_XF_ROI_WRF_LastColRep43               (MCPARAMID)( 7219 << 14)
+#define MC_XF_ROI_WRF_LastColRep43_ON              1
+#define MC_XF_ROI_WRF_LastColRep43_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx43                 (MCPARAMID)( 7220 << 14)
+#define MC_XF_ROI_WRF_TOIwidth43                 (MCPARAMID)( 7221 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI43       (MCPARAMID)( 7222 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI43       (MCPARAMID)( 7223 << 14)
+#define MC_XF_ROI_WRF_Line143                    (MCPARAMID)( 7224 << 14)
+#define MC_XF_ROI_WRF_Line143_GB                   1
+#define MC_XF_ROI_WRF_Line143_BG                   2
+#define MC_XF_ROI_WRF_Line143_RG                   3
+#define MC_XF_ROI_WRF_Line143_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1043              (MCPARAMID)( 7225 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1143              (MCPARAMID)( 7226 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1243              (MCPARAMID)( 7227 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1343              (MCPARAMID)( 7228 << 14)
+#define MC_XF_ROI_WRF_TOIheight43                (MCPARAMID)( 7229 << 14)
+#define MC_XF_ROI_WRF_LastTOI43                  (MCPARAMID)( 7230 << 14)
+#define MC_XF_ROI_WRF_LastTOI43_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI43_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset43                (MCPARAMID)( 7231 << 14)
+#define MC_XF_ROI_WRF_TOIPitch43                 (MCPARAMID)( 7232 << 14)
+#define MC_XF_ROI_WRF_NbOfLine43                 (MCPARAMID)( 7233 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd43               (MCPARAMID)( 7234 << 14)
+#define MC_XF_ROI_WRF_1stLineRep44               (MCPARAMID)( 7235 << 14)
+#define MC_XF_ROI_WRF_1stLineRep44_ON              1
+#define MC_XF_ROI_WRF_1stLineRep44_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep44              (MCPARAMID)( 7236 << 14)
+#define MC_XF_ROI_WRF_LastLineRep44_ON             1
+#define MC_XF_ROI_WRF_LastLineRep44_OFF            2
+#define MC_XF_ROI_WRF_1stColRep44                (MCPARAMID)( 7237 << 14)
+#define MC_XF_ROI_WRF_1stColRep44_ON               1
+#define MC_XF_ROI_WRF_1stColRep44_OFF              2
+#define MC_XF_ROI_WRF_LastColRep44               (MCPARAMID)( 7238 << 14)
+#define MC_XF_ROI_WRF_LastColRep44_ON              1
+#define MC_XF_ROI_WRF_LastColRep44_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx44                 (MCPARAMID)( 7239 << 14)
+#define MC_XF_ROI_WRF_TOIwidth44                 (MCPARAMID)( 7240 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI44       (MCPARAMID)( 7241 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI44       (MCPARAMID)( 7242 << 14)
+#define MC_XF_ROI_WRF_Line144                    (MCPARAMID)( 7243 << 14)
+#define MC_XF_ROI_WRF_Line144_GB                   1
+#define MC_XF_ROI_WRF_Line144_BG                   2
+#define MC_XF_ROI_WRF_Line144_RG                   3
+#define MC_XF_ROI_WRF_Line144_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1044              (MCPARAMID)( 7244 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1144              (MCPARAMID)( 7245 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1244              (MCPARAMID)( 7246 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1344              (MCPARAMID)( 7247 << 14)
+#define MC_XF_ROI_WRF_TOIheight44                (MCPARAMID)( 7248 << 14)
+#define MC_XF_ROI_WRF_LastTOI44                  (MCPARAMID)( 7249 << 14)
+#define MC_XF_ROI_WRF_LastTOI44_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI44_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset44                (MCPARAMID)( 7250 << 14)
+#define MC_XF_ROI_WRF_TOIPitch44                 (MCPARAMID)( 7251 << 14)
+#define MC_XF_ROI_WRF_NbOfLine44                 (MCPARAMID)( 7252 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd44               (MCPARAMID)( 7253 << 14)
+#define MC_XF_ROI_WRF_1stLineRep45               (MCPARAMID)( 7254 << 14)
+#define MC_XF_ROI_WRF_1stLineRep45_ON              1
+#define MC_XF_ROI_WRF_1stLineRep45_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep45              (MCPARAMID)( 7255 << 14)
+#define MC_XF_ROI_WRF_LastLineRep45_ON             1
+#define MC_XF_ROI_WRF_LastLineRep45_OFF            2
+#define MC_XF_ROI_WRF_1stColRep45                (MCPARAMID)( 7256 << 14)
+#define MC_XF_ROI_WRF_1stColRep45_ON               1
+#define MC_XF_ROI_WRF_1stColRep45_OFF              2
+#define MC_XF_ROI_WRF_LastColRep45               (MCPARAMID)( 7257 << 14)
+#define MC_XF_ROI_WRF_LastColRep45_ON              1
+#define MC_XF_ROI_WRF_LastColRep45_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx45                 (MCPARAMID)( 7258 << 14)
+#define MC_XF_ROI_WRF_TOIwidth45                 (MCPARAMID)( 7259 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI45       (MCPARAMID)( 7260 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI45       (MCPARAMID)( 7261 << 14)
+#define MC_XF_ROI_WRF_Line145                    (MCPARAMID)( 7262 << 14)
+#define MC_XF_ROI_WRF_Line145_GB                   1
+#define MC_XF_ROI_WRF_Line145_BG                   2
+#define MC_XF_ROI_WRF_Line145_RG                   3
+#define MC_XF_ROI_WRF_Line145_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1045              (MCPARAMID)( 7263 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1145              (MCPARAMID)( 7264 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1245              (MCPARAMID)( 7265 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1345              (MCPARAMID)( 7266 << 14)
+#define MC_XF_ROI_WRF_TOIheight45                (MCPARAMID)( 7267 << 14)
+#define MC_XF_ROI_WRF_LastTOI45                  (MCPARAMID)( 7268 << 14)
+#define MC_XF_ROI_WRF_LastTOI45_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI45_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset45                (MCPARAMID)( 7269 << 14)
+#define MC_XF_ROI_WRF_TOIPitch45                 (MCPARAMID)( 7270 << 14)
+#define MC_XF_ROI_WRF_NbOfLine45                 (MCPARAMID)( 7271 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd45               (MCPARAMID)( 7272 << 14)
+#define MC_XF_ROI_WRF_1stLineRep46               (MCPARAMID)( 7273 << 14)
+#define MC_XF_ROI_WRF_1stLineRep46_ON              1
+#define MC_XF_ROI_WRF_1stLineRep46_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep46              (MCPARAMID)( 7274 << 14)
+#define MC_XF_ROI_WRF_LastLineRep46_ON             1
+#define MC_XF_ROI_WRF_LastLineRep46_OFF            2
+#define MC_XF_ROI_WRF_1stColRep46                (MCPARAMID)( 7275 << 14)
+#define MC_XF_ROI_WRF_1stColRep46_ON               1
+#define MC_XF_ROI_WRF_1stColRep46_OFF              2
+#define MC_XF_ROI_WRF_LastColRep46               (MCPARAMID)( 7276 << 14)
+#define MC_XF_ROI_WRF_LastColRep46_ON              1
+#define MC_XF_ROI_WRF_LastColRep46_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx46                 (MCPARAMID)( 7277 << 14)
+#define MC_XF_ROI_WRF_TOIwidth46                 (MCPARAMID)( 7278 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI46       (MCPARAMID)( 7279 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI46       (MCPARAMID)( 7280 << 14)
+#define MC_XF_ROI_WRF_Line146                    (MCPARAMID)( 7281 << 14)
+#define MC_XF_ROI_WRF_Line146_GB                   1
+#define MC_XF_ROI_WRF_Line146_BG                   2
+#define MC_XF_ROI_WRF_Line146_RG                   3
+#define MC_XF_ROI_WRF_Line146_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1046              (MCPARAMID)( 7282 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1146              (MCPARAMID)( 7283 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1246              (MCPARAMID)( 7284 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1346              (MCPARAMID)( 7285 << 14)
+#define MC_XF_ROI_WRF_TOIheight46                (MCPARAMID)( 7286 << 14)
+#define MC_XF_ROI_WRF_LastTOI46                  (MCPARAMID)( 7287 << 14)
+#define MC_XF_ROI_WRF_LastTOI46_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI46_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset46                (MCPARAMID)( 7288 << 14)
+#define MC_XF_ROI_WRF_TOIPitch46                 (MCPARAMID)( 7289 << 14)
+#define MC_XF_ROI_WRF_NbOfLine46                 (MCPARAMID)( 7290 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd46               (MCPARAMID)( 7291 << 14)
+#define MC_XF_ROI_WRF_1stLineRep47               (MCPARAMID)( 7292 << 14)
+#define MC_XF_ROI_WRF_1stLineRep47_ON              1
+#define MC_XF_ROI_WRF_1stLineRep47_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep47              (MCPARAMID)( 7293 << 14)
+#define MC_XF_ROI_WRF_LastLineRep47_ON             1
+#define MC_XF_ROI_WRF_LastLineRep47_OFF            2
+#define MC_XF_ROI_WRF_1stColRep47                (MCPARAMID)( 7294 << 14)
+#define MC_XF_ROI_WRF_1stColRep47_ON               1
+#define MC_XF_ROI_WRF_1stColRep47_OFF              2
+#define MC_XF_ROI_WRF_LastColRep47               (MCPARAMID)( 7295 << 14)
+#define MC_XF_ROI_WRF_LastColRep47_ON              1
+#define MC_XF_ROI_WRF_LastColRep47_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx47                 (MCPARAMID)( 7296 << 14)
+#define MC_XF_ROI_WRF_TOIwidth47                 (MCPARAMID)( 7297 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI47       (MCPARAMID)( 7298 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI47       (MCPARAMID)( 7299 << 14)
+#define MC_XF_ROI_WRF_Line147                    (MCPARAMID)( 7300 << 14)
+#define MC_XF_ROI_WRF_Line147_GB                   1
+#define MC_XF_ROI_WRF_Line147_BG                   2
+#define MC_XF_ROI_WRF_Line147_RG                   3
+#define MC_XF_ROI_WRF_Line147_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1047              (MCPARAMID)( 7301 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1147              (MCPARAMID)( 7302 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1247              (MCPARAMID)( 7303 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1347              (MCPARAMID)( 7304 << 14)
+#define MC_XF_ROI_WRF_TOIheight47                (MCPARAMID)( 7305 << 14)
+#define MC_XF_ROI_WRF_LastTOI47                  (MCPARAMID)( 7306 << 14)
+#define MC_XF_ROI_WRF_LastTOI47_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI47_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset47                (MCPARAMID)( 7307 << 14)
+#define MC_XF_ROI_WRF_TOIPitch47                 (MCPARAMID)( 7308 << 14)
+#define MC_XF_ROI_WRF_NbOfLine47                 (MCPARAMID)( 7309 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd47               (MCPARAMID)( 7310 << 14)
+#define MC_XF_ROI_WRF_1stLineRep48               (MCPARAMID)( 7311 << 14)
+#define MC_XF_ROI_WRF_1stLineRep48_ON              1
+#define MC_XF_ROI_WRF_1stLineRep48_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep48              (MCPARAMID)( 7312 << 14)
+#define MC_XF_ROI_WRF_LastLineRep48_ON             1
+#define MC_XF_ROI_WRF_LastLineRep48_OFF            2
+#define MC_XF_ROI_WRF_1stColRep48                (MCPARAMID)( 7313 << 14)
+#define MC_XF_ROI_WRF_1stColRep48_ON               1
+#define MC_XF_ROI_WRF_1stColRep48_OFF              2
+#define MC_XF_ROI_WRF_LastColRep48               (MCPARAMID)( 7314 << 14)
+#define MC_XF_ROI_WRF_LastColRep48_ON              1
+#define MC_XF_ROI_WRF_LastColRep48_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx48                 (MCPARAMID)( 7315 << 14)
+#define MC_XF_ROI_WRF_TOIwidth48                 (MCPARAMID)( 7316 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI48       (MCPARAMID)( 7317 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI48       (MCPARAMID)( 7318 << 14)
+#define MC_XF_ROI_WRF_Line148                    (MCPARAMID)( 7319 << 14)
+#define MC_XF_ROI_WRF_Line148_GB                   1
+#define MC_XF_ROI_WRF_Line148_BG                   2
+#define MC_XF_ROI_WRF_Line148_RG                   3
+#define MC_XF_ROI_WRF_Line148_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1048              (MCPARAMID)( 7320 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1148              (MCPARAMID)( 7321 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1248              (MCPARAMID)( 7322 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1348              (MCPARAMID)( 7323 << 14)
+#define MC_XF_ROI_WRF_TOIheight48                (MCPARAMID)( 7324 << 14)
+#define MC_XF_ROI_WRF_LastTOI48                  (MCPARAMID)( 7325 << 14)
+#define MC_XF_ROI_WRF_LastTOI48_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI48_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset48                (MCPARAMID)( 7326 << 14)
+#define MC_XF_ROI_WRF_TOIPitch48                 (MCPARAMID)( 7327 << 14)
+#define MC_XF_ROI_WRF_NbOfLine48                 (MCPARAMID)( 7328 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd48               (MCPARAMID)( 7329 << 14)
+#define MC_XF_ROI_WRF_1stLineRep49               (MCPARAMID)( 7330 << 14)
+#define MC_XF_ROI_WRF_1stLineRep49_ON              1
+#define MC_XF_ROI_WRF_1stLineRep49_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep49              (MCPARAMID)( 7331 << 14)
+#define MC_XF_ROI_WRF_LastLineRep49_ON             1
+#define MC_XF_ROI_WRF_LastLineRep49_OFF            2
+#define MC_XF_ROI_WRF_1stColRep49                (MCPARAMID)( 7332 << 14)
+#define MC_XF_ROI_WRF_1stColRep49_ON               1
+#define MC_XF_ROI_WRF_1stColRep49_OFF              2
+#define MC_XF_ROI_WRF_LastColRep49               (MCPARAMID)( 7333 << 14)
+#define MC_XF_ROI_WRF_LastColRep49_ON              1
+#define MC_XF_ROI_WRF_LastColRep49_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx49                 (MCPARAMID)( 7334 << 14)
+#define MC_XF_ROI_WRF_TOIwidth49                 (MCPARAMID)( 7335 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI49       (MCPARAMID)( 7336 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI49       (MCPARAMID)( 7337 << 14)
+#define MC_XF_ROI_WRF_Line149                    (MCPARAMID)( 7338 << 14)
+#define MC_XF_ROI_WRF_Line149_GB                   1
+#define MC_XF_ROI_WRF_Line149_BG                   2
+#define MC_XF_ROI_WRF_Line149_RG                   3
+#define MC_XF_ROI_WRF_Line149_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1049              (MCPARAMID)( 7339 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1149              (MCPARAMID)( 7340 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1249              (MCPARAMID)( 7341 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1349              (MCPARAMID)( 7342 << 14)
+#define MC_XF_ROI_WRF_TOIheight49                (MCPARAMID)( 7343 << 14)
+#define MC_XF_ROI_WRF_LastTOI49                  (MCPARAMID)( 7344 << 14)
+#define MC_XF_ROI_WRF_LastTOI49_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI49_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset49                (MCPARAMID)( 7345 << 14)
+#define MC_XF_ROI_WRF_TOIPitch49                 (MCPARAMID)( 7346 << 14)
+#define MC_XF_ROI_WRF_NbOfLine49                 (MCPARAMID)( 7347 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd49               (MCPARAMID)( 7348 << 14)
+#define MC_XF_ROI_WRF_1stLineRep50               (MCPARAMID)( 7349 << 14)
+#define MC_XF_ROI_WRF_1stLineRep50_ON              1
+#define MC_XF_ROI_WRF_1stLineRep50_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep50              (MCPARAMID)( 7350 << 14)
+#define MC_XF_ROI_WRF_LastLineRep50_ON             1
+#define MC_XF_ROI_WRF_LastLineRep50_OFF            2
+#define MC_XF_ROI_WRF_1stColRep50                (MCPARAMID)( 7351 << 14)
+#define MC_XF_ROI_WRF_1stColRep50_ON               1
+#define MC_XF_ROI_WRF_1stColRep50_OFF              2
+#define MC_XF_ROI_WRF_LastColRep50               (MCPARAMID)( 7352 << 14)
+#define MC_XF_ROI_WRF_LastColRep50_ON              1
+#define MC_XF_ROI_WRF_LastColRep50_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx50                 (MCPARAMID)( 7353 << 14)
+#define MC_XF_ROI_WRF_TOIwidth50                 (MCPARAMID)( 7354 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI50       (MCPARAMID)( 7355 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI50       (MCPARAMID)( 7356 << 14)
+#define MC_XF_ROI_WRF_Line150                    (MCPARAMID)( 7357 << 14)
+#define MC_XF_ROI_WRF_Line150_GB                   1
+#define MC_XF_ROI_WRF_Line150_BG                   2
+#define MC_XF_ROI_WRF_Line150_RG                   3
+#define MC_XF_ROI_WRF_Line150_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1050              (MCPARAMID)( 7358 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1150              (MCPARAMID)( 7359 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1250              (MCPARAMID)( 7360 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1350              (MCPARAMID)( 7361 << 14)
+#define MC_XF_ROI_WRF_TOIheight50                (MCPARAMID)( 7362 << 14)
+#define MC_XF_ROI_WRF_LastTOI50                  (MCPARAMID)( 7363 << 14)
+#define MC_XF_ROI_WRF_LastTOI50_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI50_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset50                (MCPARAMID)( 7364 << 14)
+#define MC_XF_ROI_WRF_TOIPitch50                 (MCPARAMID)( 7365 << 14)
+#define MC_XF_ROI_WRF_NbOfLine50                 (MCPARAMID)( 7366 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd50               (MCPARAMID)( 7367 << 14)
+#define MC_XF_ROI_WRF_1stLineRep51               (MCPARAMID)( 7368 << 14)
+#define MC_XF_ROI_WRF_1stLineRep51_ON              1
+#define MC_XF_ROI_WRF_1stLineRep51_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep51              (MCPARAMID)( 7369 << 14)
+#define MC_XF_ROI_WRF_LastLineRep51_ON             1
+#define MC_XF_ROI_WRF_LastLineRep51_OFF            2
+#define MC_XF_ROI_WRF_1stColRep51                (MCPARAMID)( 7370 << 14)
+#define MC_XF_ROI_WRF_1stColRep51_ON               1
+#define MC_XF_ROI_WRF_1stColRep51_OFF              2
+#define MC_XF_ROI_WRF_LastColRep51               (MCPARAMID)( 7371 << 14)
+#define MC_XF_ROI_WRF_LastColRep51_ON              1
+#define MC_XF_ROI_WRF_LastColRep51_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx51                 (MCPARAMID)( 7372 << 14)
+#define MC_XF_ROI_WRF_TOIwidth51                 (MCPARAMID)( 7373 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI51       (MCPARAMID)( 7374 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI51       (MCPARAMID)( 7375 << 14)
+#define MC_XF_ROI_WRF_Line151                    (MCPARAMID)( 7376 << 14)
+#define MC_XF_ROI_WRF_Line151_GB                   1
+#define MC_XF_ROI_WRF_Line151_BG                   2
+#define MC_XF_ROI_WRF_Line151_RG                   3
+#define MC_XF_ROI_WRF_Line151_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1051              (MCPARAMID)( 7377 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1151              (MCPARAMID)( 7378 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1251              (MCPARAMID)( 7379 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1351              (MCPARAMID)( 7380 << 14)
+#define MC_XF_ROI_WRF_TOIheight51                (MCPARAMID)( 7381 << 14)
+#define MC_XF_ROI_WRF_LastTOI51                  (MCPARAMID)( 7382 << 14)
+#define MC_XF_ROI_WRF_LastTOI51_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI51_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset51                (MCPARAMID)( 7383 << 14)
+#define MC_XF_ROI_WRF_TOIPitch51                 (MCPARAMID)( 7384 << 14)
+#define MC_XF_ROI_WRF_NbOfLine51                 (MCPARAMID)( 7385 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd51               (MCPARAMID)( 7386 << 14)
+#define MC_XF_ROI_WRF_1stLineRep52               (MCPARAMID)( 7387 << 14)
+#define MC_XF_ROI_WRF_1stLineRep52_ON              1
+#define MC_XF_ROI_WRF_1stLineRep52_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep52              (MCPARAMID)( 7388 << 14)
+#define MC_XF_ROI_WRF_LastLineRep52_ON             1
+#define MC_XF_ROI_WRF_LastLineRep52_OFF            2
+#define MC_XF_ROI_WRF_1stColRep52                (MCPARAMID)( 7389 << 14)
+#define MC_XF_ROI_WRF_1stColRep52_ON               1
+#define MC_XF_ROI_WRF_1stColRep52_OFF              2
+#define MC_XF_ROI_WRF_LastColRep52               (MCPARAMID)( 7390 << 14)
+#define MC_XF_ROI_WRF_LastColRep52_ON              1
+#define MC_XF_ROI_WRF_LastColRep52_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx52                 (MCPARAMID)( 7391 << 14)
+#define MC_XF_ROI_WRF_TOIwidth52                 (MCPARAMID)( 7392 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI52       (MCPARAMID)( 7393 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI52       (MCPARAMID)( 7394 << 14)
+#define MC_XF_ROI_WRF_Line152                    (MCPARAMID)( 7395 << 14)
+#define MC_XF_ROI_WRF_Line152_GB                   1
+#define MC_XF_ROI_WRF_Line152_BG                   2
+#define MC_XF_ROI_WRF_Line152_RG                   3
+#define MC_XF_ROI_WRF_Line152_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1052              (MCPARAMID)( 7396 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1152              (MCPARAMID)( 7397 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1252              (MCPARAMID)( 7398 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1352              (MCPARAMID)( 7399 << 14)
+#define MC_XF_ROI_WRF_TOIheight52                (MCPARAMID)( 7400 << 14)
+#define MC_XF_ROI_WRF_LastTOI52                  (MCPARAMID)( 7401 << 14)
+#define MC_XF_ROI_WRF_LastTOI52_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI52_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset52                (MCPARAMID)( 7402 << 14)
+#define MC_XF_ROI_WRF_TOIPitch52                 (MCPARAMID)( 7403 << 14)
+#define MC_XF_ROI_WRF_NbOfLine52                 (MCPARAMID)( 7404 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd52               (MCPARAMID)( 7405 << 14)
+#define MC_XF_ROI_WRF_1stLineRep53               (MCPARAMID)( 7406 << 14)
+#define MC_XF_ROI_WRF_1stLineRep53_ON              1
+#define MC_XF_ROI_WRF_1stLineRep53_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep53              (MCPARAMID)( 7407 << 14)
+#define MC_XF_ROI_WRF_LastLineRep53_ON             1
+#define MC_XF_ROI_WRF_LastLineRep53_OFF            2
+#define MC_XF_ROI_WRF_1stColRep53                (MCPARAMID)( 7408 << 14)
+#define MC_XF_ROI_WRF_1stColRep53_ON               1
+#define MC_XF_ROI_WRF_1stColRep53_OFF              2
+#define MC_XF_ROI_WRF_LastColRep53               (MCPARAMID)( 7409 << 14)
+#define MC_XF_ROI_WRF_LastColRep53_ON              1
+#define MC_XF_ROI_WRF_LastColRep53_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx53                 (MCPARAMID)( 7410 << 14)
+#define MC_XF_ROI_WRF_TOIwidth53                 (MCPARAMID)( 7411 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI53       (MCPARAMID)( 7412 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI53       (MCPARAMID)( 7413 << 14)
+#define MC_XF_ROI_WRF_Line153                    (MCPARAMID)( 7414 << 14)
+#define MC_XF_ROI_WRF_Line153_GB                   1
+#define MC_XF_ROI_WRF_Line153_BG                   2
+#define MC_XF_ROI_WRF_Line153_RG                   3
+#define MC_XF_ROI_WRF_Line153_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1053              (MCPARAMID)( 7415 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1153              (MCPARAMID)( 7416 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1253              (MCPARAMID)( 7417 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1353              (MCPARAMID)( 7418 << 14)
+#define MC_XF_ROI_WRF_TOIheight53                (MCPARAMID)( 7419 << 14)
+#define MC_XF_ROI_WRF_LastTOI53                  (MCPARAMID)( 7420 << 14)
+#define MC_XF_ROI_WRF_LastTOI53_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI53_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset53                (MCPARAMID)( 7421 << 14)
+#define MC_XF_ROI_WRF_TOIPitch53                 (MCPARAMID)( 7422 << 14)
+#define MC_XF_ROI_WRF_NbOfLine53                 (MCPARAMID)( 7423 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd53               (MCPARAMID)( 7424 << 14)
+#define MC_XF_ROI_WRF_1stLineRep54               (MCPARAMID)( 7425 << 14)
+#define MC_XF_ROI_WRF_1stLineRep54_ON              1
+#define MC_XF_ROI_WRF_1stLineRep54_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep54              (MCPARAMID)( 7426 << 14)
+#define MC_XF_ROI_WRF_LastLineRep54_ON             1
+#define MC_XF_ROI_WRF_LastLineRep54_OFF            2
+#define MC_XF_ROI_WRF_1stColRep54                (MCPARAMID)( 7427 << 14)
+#define MC_XF_ROI_WRF_1stColRep54_ON               1
+#define MC_XF_ROI_WRF_1stColRep54_OFF              2
+#define MC_XF_ROI_WRF_LastColRep54               (MCPARAMID)( 7428 << 14)
+#define MC_XF_ROI_WRF_LastColRep54_ON              1
+#define MC_XF_ROI_WRF_LastColRep54_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx54                 (MCPARAMID)( 7429 << 14)
+#define MC_XF_ROI_WRF_TOIwidth54                 (MCPARAMID)( 7430 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI54       (MCPARAMID)( 7431 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI54       (MCPARAMID)( 7432 << 14)
+#define MC_XF_ROI_WRF_Line154                    (MCPARAMID)( 7433 << 14)
+#define MC_XF_ROI_WRF_Line154_GB                   1
+#define MC_XF_ROI_WRF_Line154_BG                   2
+#define MC_XF_ROI_WRF_Line154_RG                   3
+#define MC_XF_ROI_WRF_Line154_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1054              (MCPARAMID)( 7434 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1154              (MCPARAMID)( 7435 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1254              (MCPARAMID)( 7436 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1354              (MCPARAMID)( 7437 << 14)
+#define MC_XF_ROI_WRF_TOIheight54                (MCPARAMID)( 7438 << 14)
+#define MC_XF_ROI_WRF_LastTOI54                  (MCPARAMID)( 7439 << 14)
+#define MC_XF_ROI_WRF_LastTOI54_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI54_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset54                (MCPARAMID)( 7440 << 14)
+#define MC_XF_ROI_WRF_TOIPitch54                 (MCPARAMID)( 7441 << 14)
+#define MC_XF_ROI_WRF_NbOfLine54                 (MCPARAMID)( 7442 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd54               (MCPARAMID)( 7443 << 14)
+#define MC_XF_ROI_WRF_1stLineRep55               (MCPARAMID)( 7444 << 14)
+#define MC_XF_ROI_WRF_1stLineRep55_ON              1
+#define MC_XF_ROI_WRF_1stLineRep55_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep55              (MCPARAMID)( 7445 << 14)
+#define MC_XF_ROI_WRF_LastLineRep55_ON             1
+#define MC_XF_ROI_WRF_LastLineRep55_OFF            2
+#define MC_XF_ROI_WRF_1stColRep55                (MCPARAMID)( 7446 << 14)
+#define MC_XF_ROI_WRF_1stColRep55_ON               1
+#define MC_XF_ROI_WRF_1stColRep55_OFF              2
+#define MC_XF_ROI_WRF_LastColRep55               (MCPARAMID)( 7447 << 14)
+#define MC_XF_ROI_WRF_LastColRep55_ON              1
+#define MC_XF_ROI_WRF_LastColRep55_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx55                 (MCPARAMID)( 7448 << 14)
+#define MC_XF_ROI_WRF_TOIwidth55                 (MCPARAMID)( 7449 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI55       (MCPARAMID)( 7450 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI55       (MCPARAMID)( 7451 << 14)
+#define MC_XF_ROI_WRF_Line155                    (MCPARAMID)( 7452 << 14)
+#define MC_XF_ROI_WRF_Line155_GB                   1
+#define MC_XF_ROI_WRF_Line155_BG                   2
+#define MC_XF_ROI_WRF_Line155_RG                   3
+#define MC_XF_ROI_WRF_Line155_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1055              (MCPARAMID)( 7453 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1155              (MCPARAMID)( 7454 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1255              (MCPARAMID)( 7455 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1355              (MCPARAMID)( 7456 << 14)
+#define MC_XF_ROI_WRF_TOIheight55                (MCPARAMID)( 7457 << 14)
+#define MC_XF_ROI_WRF_LastTOI55                  (MCPARAMID)( 7458 << 14)
+#define MC_XF_ROI_WRF_LastTOI55_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI55_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset55                (MCPARAMID)( 7459 << 14)
+#define MC_XF_ROI_WRF_TOIPitch55                 (MCPARAMID)( 7460 << 14)
+#define MC_XF_ROI_WRF_NbOfLine55                 (MCPARAMID)( 7461 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd55               (MCPARAMID)( 7462 << 14)
+#define MC_XF_ROI_WRF_1stLineRep56               (MCPARAMID)( 7463 << 14)
+#define MC_XF_ROI_WRF_1stLineRep56_ON              1
+#define MC_XF_ROI_WRF_1stLineRep56_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep56              (MCPARAMID)( 7464 << 14)
+#define MC_XF_ROI_WRF_LastLineRep56_ON             1
+#define MC_XF_ROI_WRF_LastLineRep56_OFF            2
+#define MC_XF_ROI_WRF_1stColRep56                (MCPARAMID)( 7465 << 14)
+#define MC_XF_ROI_WRF_1stColRep56_ON               1
+#define MC_XF_ROI_WRF_1stColRep56_OFF              2
+#define MC_XF_ROI_WRF_LastColRep56               (MCPARAMID)( 7466 << 14)
+#define MC_XF_ROI_WRF_LastColRep56_ON              1
+#define MC_XF_ROI_WRF_LastColRep56_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx56                 (MCPARAMID)( 7467 << 14)
+#define MC_XF_ROI_WRF_TOIwidth56                 (MCPARAMID)( 7468 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI56       (MCPARAMID)( 7469 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI56       (MCPARAMID)( 7470 << 14)
+#define MC_XF_ROI_WRF_Line156                    (MCPARAMID)( 7471 << 14)
+#define MC_XF_ROI_WRF_Line156_GB                   1
+#define MC_XF_ROI_WRF_Line156_BG                   2
+#define MC_XF_ROI_WRF_Line156_RG                   3
+#define MC_XF_ROI_WRF_Line156_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1056              (MCPARAMID)( 7472 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1156              (MCPARAMID)( 7473 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1256              (MCPARAMID)( 7474 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1356              (MCPARAMID)( 7475 << 14)
+#define MC_XF_ROI_WRF_TOIheight56                (MCPARAMID)( 7476 << 14)
+#define MC_XF_ROI_WRF_LastTOI56                  (MCPARAMID)( 7477 << 14)
+#define MC_XF_ROI_WRF_LastTOI56_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI56_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset56                (MCPARAMID)( 7478 << 14)
+#define MC_XF_ROI_WRF_TOIPitch56                 (MCPARAMID)( 7479 << 14)
+#define MC_XF_ROI_WRF_NbOfLine56                 (MCPARAMID)( 7480 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd56               (MCPARAMID)( 7481 << 14)
+#define MC_XF_ROI_WRF_1stLineRep57               (MCPARAMID)( 7482 << 14)
+#define MC_XF_ROI_WRF_1stLineRep57_ON              1
+#define MC_XF_ROI_WRF_1stLineRep57_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep57              (MCPARAMID)( 7483 << 14)
+#define MC_XF_ROI_WRF_LastLineRep57_ON             1
+#define MC_XF_ROI_WRF_LastLineRep57_OFF            2
+#define MC_XF_ROI_WRF_1stColRep57                (MCPARAMID)( 7484 << 14)
+#define MC_XF_ROI_WRF_1stColRep57_ON               1
+#define MC_XF_ROI_WRF_1stColRep57_OFF              2
+#define MC_XF_ROI_WRF_LastColRep57               (MCPARAMID)( 7485 << 14)
+#define MC_XF_ROI_WRF_LastColRep57_ON              1
+#define MC_XF_ROI_WRF_LastColRep57_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx57                 (MCPARAMID)( 7486 << 14)
+#define MC_XF_ROI_WRF_TOIwidth57                 (MCPARAMID)( 7487 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI57       (MCPARAMID)( 7488 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI57       (MCPARAMID)( 7489 << 14)
+#define MC_XF_ROI_WRF_Line157                    (MCPARAMID)( 7490 << 14)
+#define MC_XF_ROI_WRF_Line157_GB                   1
+#define MC_XF_ROI_WRF_Line157_BG                   2
+#define MC_XF_ROI_WRF_Line157_RG                   3
+#define MC_XF_ROI_WRF_Line157_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1057              (MCPARAMID)( 7491 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1157              (MCPARAMID)( 7492 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1257              (MCPARAMID)( 7493 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1357              (MCPARAMID)( 7494 << 14)
+#define MC_XF_ROI_WRF_TOIheight57                (MCPARAMID)( 7495 << 14)
+#define MC_XF_ROI_WRF_LastTOI57                  (MCPARAMID)( 7496 << 14)
+#define MC_XF_ROI_WRF_LastTOI57_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI57_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset57                (MCPARAMID)( 7497 << 14)
+#define MC_XF_ROI_WRF_TOIPitch57                 (MCPARAMID)( 7498 << 14)
+#define MC_XF_ROI_WRF_NbOfLine57                 (MCPARAMID)( 7499 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd57               (MCPARAMID)( 7500 << 14)
+#define MC_XF_ROI_WRF_1stLineRep58               (MCPARAMID)( 7501 << 14)
+#define MC_XF_ROI_WRF_1stLineRep58_ON              1
+#define MC_XF_ROI_WRF_1stLineRep58_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep58              (MCPARAMID)( 7502 << 14)
+#define MC_XF_ROI_WRF_LastLineRep58_ON             1
+#define MC_XF_ROI_WRF_LastLineRep58_OFF            2
+#define MC_XF_ROI_WRF_1stColRep58                (MCPARAMID)( 7503 << 14)
+#define MC_XF_ROI_WRF_1stColRep58_ON               1
+#define MC_XF_ROI_WRF_1stColRep58_OFF              2
+#define MC_XF_ROI_WRF_LastColRep58               (MCPARAMID)( 7504 << 14)
+#define MC_XF_ROI_WRF_LastColRep58_ON              1
+#define MC_XF_ROI_WRF_LastColRep58_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx58                 (MCPARAMID)( 7505 << 14)
+#define MC_XF_ROI_WRF_TOIwidth58                 (MCPARAMID)( 7506 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI58       (MCPARAMID)( 7507 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI58       (MCPARAMID)( 7508 << 14)
+#define MC_XF_ROI_WRF_Line158                    (MCPARAMID)( 7509 << 14)
+#define MC_XF_ROI_WRF_Line158_GB                   1
+#define MC_XF_ROI_WRF_Line158_BG                   2
+#define MC_XF_ROI_WRF_Line158_RG                   3
+#define MC_XF_ROI_WRF_Line158_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1058              (MCPARAMID)( 7510 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1158              (MCPARAMID)( 7511 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1258              (MCPARAMID)( 7512 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1358              (MCPARAMID)( 7513 << 14)
+#define MC_XF_ROI_WRF_TOIheight58                (MCPARAMID)( 7514 << 14)
+#define MC_XF_ROI_WRF_LastTOI58                  (MCPARAMID)( 7515 << 14)
+#define MC_XF_ROI_WRF_LastTOI58_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI58_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset58                (MCPARAMID)( 7516 << 14)
+#define MC_XF_ROI_WRF_TOIPitch58                 (MCPARAMID)( 7517 << 14)
+#define MC_XF_ROI_WRF_NbOfLine58                 (MCPARAMID)( 7518 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd58               (MCPARAMID)( 7519 << 14)
+#define MC_XF_ROI_WRF_1stLineRep59               (MCPARAMID)( 7520 << 14)
+#define MC_XF_ROI_WRF_1stLineRep59_ON              1
+#define MC_XF_ROI_WRF_1stLineRep59_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep59              (MCPARAMID)( 7521 << 14)
+#define MC_XF_ROI_WRF_LastLineRep59_ON             1
+#define MC_XF_ROI_WRF_LastLineRep59_OFF            2
+#define MC_XF_ROI_WRF_1stColRep59                (MCPARAMID)( 7522 << 14)
+#define MC_XF_ROI_WRF_1stColRep59_ON               1
+#define MC_XF_ROI_WRF_1stColRep59_OFF              2
+#define MC_XF_ROI_WRF_LastColRep59               (MCPARAMID)( 7523 << 14)
+#define MC_XF_ROI_WRF_LastColRep59_ON              1
+#define MC_XF_ROI_WRF_LastColRep59_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx59                 (MCPARAMID)( 7524 << 14)
+#define MC_XF_ROI_WRF_TOIwidth59                 (MCPARAMID)( 7525 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI59       (MCPARAMID)( 7526 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI59       (MCPARAMID)( 7527 << 14)
+#define MC_XF_ROI_WRF_Line159                    (MCPARAMID)( 7528 << 14)
+#define MC_XF_ROI_WRF_Line159_GB                   1
+#define MC_XF_ROI_WRF_Line159_BG                   2
+#define MC_XF_ROI_WRF_Line159_RG                   3
+#define MC_XF_ROI_WRF_Line159_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1059              (MCPARAMID)( 7529 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1159              (MCPARAMID)( 7530 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1259              (MCPARAMID)( 7531 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1359              (MCPARAMID)( 7532 << 14)
+#define MC_XF_ROI_WRF_TOIheight59                (MCPARAMID)( 7533 << 14)
+#define MC_XF_ROI_WRF_LastTOI59                  (MCPARAMID)( 7534 << 14)
+#define MC_XF_ROI_WRF_LastTOI59_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI59_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset59                (MCPARAMID)( 7535 << 14)
+#define MC_XF_ROI_WRF_TOIPitch59                 (MCPARAMID)( 7536 << 14)
+#define MC_XF_ROI_WRF_NbOfLine59                 (MCPARAMID)( 7537 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd59               (MCPARAMID)( 7538 << 14)
+#define MC_XF_ROI_WRF_1stLineRep60               (MCPARAMID)( 7539 << 14)
+#define MC_XF_ROI_WRF_1stLineRep60_ON              1
+#define MC_XF_ROI_WRF_1stLineRep60_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep60              (MCPARAMID)( 7540 << 14)
+#define MC_XF_ROI_WRF_LastLineRep60_ON             1
+#define MC_XF_ROI_WRF_LastLineRep60_OFF            2
+#define MC_XF_ROI_WRF_1stColRep60                (MCPARAMID)( 7541 << 14)
+#define MC_XF_ROI_WRF_1stColRep60_ON               1
+#define MC_XF_ROI_WRF_1stColRep60_OFF              2
+#define MC_XF_ROI_WRF_LastColRep60               (MCPARAMID)( 7542 << 14)
+#define MC_XF_ROI_WRF_LastColRep60_ON              1
+#define MC_XF_ROI_WRF_LastColRep60_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx60                 (MCPARAMID)( 7543 << 14)
+#define MC_XF_ROI_WRF_TOIwidth60                 (MCPARAMID)( 7544 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI60       (MCPARAMID)( 7545 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI60       (MCPARAMID)( 7546 << 14)
+#define MC_XF_ROI_WRF_Line160                    (MCPARAMID)( 7547 << 14)
+#define MC_XF_ROI_WRF_Line160_GB                   1
+#define MC_XF_ROI_WRF_Line160_BG                   2
+#define MC_XF_ROI_WRF_Line160_RG                   3
+#define MC_XF_ROI_WRF_Line160_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1060              (MCPARAMID)( 7548 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1160              (MCPARAMID)( 7549 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1260              (MCPARAMID)( 7550 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1360              (MCPARAMID)( 7551 << 14)
+#define MC_XF_ROI_WRF_TOIheight60                (MCPARAMID)( 7552 << 14)
+#define MC_XF_ROI_WRF_LastTOI60                  (MCPARAMID)( 7553 << 14)
+#define MC_XF_ROI_WRF_LastTOI60_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI60_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset60                (MCPARAMID)( 7554 << 14)
+#define MC_XF_ROI_WRF_TOIPitch60                 (MCPARAMID)( 7555 << 14)
+#define MC_XF_ROI_WRF_NbOfLine60                 (MCPARAMID)( 7556 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd60               (MCPARAMID)( 7557 << 14)
+#define MC_XF_ROI_WRF_1stLineRep61               (MCPARAMID)( 7558 << 14)
+#define MC_XF_ROI_WRF_1stLineRep61_ON              1
+#define MC_XF_ROI_WRF_1stLineRep61_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep61              (MCPARAMID)( 7559 << 14)
+#define MC_XF_ROI_WRF_LastLineRep61_ON             1
+#define MC_XF_ROI_WRF_LastLineRep61_OFF            2
+#define MC_XF_ROI_WRF_1stColRep61                (MCPARAMID)( 7560 << 14)
+#define MC_XF_ROI_WRF_1stColRep61_ON               1
+#define MC_XF_ROI_WRF_1stColRep61_OFF              2
+#define MC_XF_ROI_WRF_LastColRep61               (MCPARAMID)( 7561 << 14)
+#define MC_XF_ROI_WRF_LastColRep61_ON              1
+#define MC_XF_ROI_WRF_LastColRep61_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx61                 (MCPARAMID)( 7562 << 14)
+#define MC_XF_ROI_WRF_TOIwidth61                 (MCPARAMID)( 7563 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI61       (MCPARAMID)( 7564 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI61       (MCPARAMID)( 7565 << 14)
+#define MC_XF_ROI_WRF_Line161                    (MCPARAMID)( 7566 << 14)
+#define MC_XF_ROI_WRF_Line161_GB                   1
+#define MC_XF_ROI_WRF_Line161_BG                   2
+#define MC_XF_ROI_WRF_Line161_RG                   3
+#define MC_XF_ROI_WRF_Line161_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1061              (MCPARAMID)( 7567 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1161              (MCPARAMID)( 7568 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1261              (MCPARAMID)( 7569 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1361              (MCPARAMID)( 7570 << 14)
+#define MC_XF_ROI_WRF_TOIheight61                (MCPARAMID)( 7571 << 14)
+#define MC_XF_ROI_WRF_LastTOI61                  (MCPARAMID)( 7572 << 14)
+#define MC_XF_ROI_WRF_LastTOI61_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI61_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset61                (MCPARAMID)( 7573 << 14)
+#define MC_XF_ROI_WRF_TOIPitch61                 (MCPARAMID)( 7574 << 14)
+#define MC_XF_ROI_WRF_NbOfLine61                 (MCPARAMID)( 7575 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd61               (MCPARAMID)( 7576 << 14)
+#define MC_XF_ROI_WRF_1stLineRep62               (MCPARAMID)( 7577 << 14)
+#define MC_XF_ROI_WRF_1stLineRep62_ON              1
+#define MC_XF_ROI_WRF_1stLineRep62_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep62              (MCPARAMID)( 7578 << 14)
+#define MC_XF_ROI_WRF_LastLineRep62_ON             1
+#define MC_XF_ROI_WRF_LastLineRep62_OFF            2
+#define MC_XF_ROI_WRF_1stColRep62                (MCPARAMID)( 7579 << 14)
+#define MC_XF_ROI_WRF_1stColRep62_ON               1
+#define MC_XF_ROI_WRF_1stColRep62_OFF              2
+#define MC_XF_ROI_WRF_LastColRep62               (MCPARAMID)( 7580 << 14)
+#define MC_XF_ROI_WRF_LastColRep62_ON              1
+#define MC_XF_ROI_WRF_LastColRep62_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx62                 (MCPARAMID)( 7581 << 14)
+#define MC_XF_ROI_WRF_TOIwidth62                 (MCPARAMID)( 7582 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI62       (MCPARAMID)( 7583 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI62       (MCPARAMID)( 7584 << 14)
+#define MC_XF_ROI_WRF_Line162                    (MCPARAMID)( 7585 << 14)
+#define MC_XF_ROI_WRF_Line162_GB                   1
+#define MC_XF_ROI_WRF_Line162_BG                   2
+#define MC_XF_ROI_WRF_Line162_RG                   3
+#define MC_XF_ROI_WRF_Line162_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1062              (MCPARAMID)( 7586 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1162              (MCPARAMID)( 7587 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1262              (MCPARAMID)( 7588 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1362              (MCPARAMID)( 7589 << 14)
+#define MC_XF_ROI_WRF_TOIheight62                (MCPARAMID)( 7590 << 14)
+#define MC_XF_ROI_WRF_LastTOI62                  (MCPARAMID)( 7591 << 14)
+#define MC_XF_ROI_WRF_LastTOI62_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI62_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset62                (MCPARAMID)( 7592 << 14)
+#define MC_XF_ROI_WRF_TOIPitch62                 (MCPARAMID)( 7593 << 14)
+#define MC_XF_ROI_WRF_NbOfLine62                 (MCPARAMID)( 7594 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd62               (MCPARAMID)( 7595 << 14)
+#define MC_XF_ROI_WRF_1stLineRep63               (MCPARAMID)( 7596 << 14)
+#define MC_XF_ROI_WRF_1stLineRep63_ON              1
+#define MC_XF_ROI_WRF_1stLineRep63_OFF             2
+#define MC_XF_ROI_WRF_LastLineRep63              (MCPARAMID)( 7597 << 14)
+#define MC_XF_ROI_WRF_LastLineRep63_ON             1
+#define MC_XF_ROI_WRF_LastLineRep63_OFF            2
+#define MC_XF_ROI_WRF_1stColRep63                (MCPARAMID)( 7598 << 14)
+#define MC_XF_ROI_WRF_1stColRep63_ON               1
+#define MC_XF_ROI_WRF_1stColRep63_OFF              2
+#define MC_XF_ROI_WRF_LastColRep63               (MCPARAMID)( 7599 << 14)
+#define MC_XF_ROI_WRF_LastColRep63_ON              1
+#define MC_XF_ROI_WRF_LastColRep63_OFF             2
+#define MC_XF_ROI_WRF_ColumnIx63                 (MCPARAMID)( 7600 << 14)
+#define MC_XF_ROI_WRF_TOIwidth63                 (MCPARAMID)( 7601 << 14)
+#define MC_XF_ROI_ColorRegistrationX_TOI63       (MCPARAMID)( 7602 << 14)
+#define MC_XF_ROI_ColorRegistrationY_TOI63       (MCPARAMID)( 7603 << 14)
+#define MC_XF_ROI_WRF_Line163                    (MCPARAMID)( 7604 << 14)
+#define MC_XF_ROI_WRF_Line163_GB                   1
+#define MC_XF_ROI_WRF_Line163_BG                   2
+#define MC_XF_ROI_WRF_Line163_RG                   3
+#define MC_XF_ROI_WRF_Line163_GR                   4
+#define MC_XF_ROI_WRF_XferSizeM1063              (MCPARAMID)( 7605 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1163              (MCPARAMID)( 7606 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1263              (MCPARAMID)( 7607 << 14)
+#define MC_XF_ROI_WRF_XferSizeM1363              (MCPARAMID)( 7608 << 14)
+#define MC_XF_ROI_WRF_TOIheight63                (MCPARAMID)( 7609 << 14)
+#define MC_XF_ROI_WRF_LastTOI63                  (MCPARAMID)( 7610 << 14)
+#define MC_XF_ROI_WRF_LastTOI63_TRUE               1
+#define MC_XF_ROI_WRF_LastTOI63_FALSE              2
+#define MC_XF_ROI_WRF_TOIoffset63                (MCPARAMID)( 7611 << 14)
+#define MC_XF_ROI_WRF_TOIPitch63                 (MCPARAMID)( 7612 << 14)
+#define MC_XF_ROI_WRF_NbOfLine63                 (MCPARAMID)( 7613 << 14)
+#define MC_XF_ROI_WRF_TOI_EndAdd63               (MCPARAMID)( 7614 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep32              (MCPARAMID)( 7615 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep32_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep32_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep32             (MCPARAMID)( 7616 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep32_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep32_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep32               (MCPARAMID)( 7617 << 14)
+#define MC_AWB_ROI_WRF_1stColRep32_ON              1
+#define MC_AWB_ROI_WRF_1stColRep32_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep32              (MCPARAMID)( 7618 << 14)
+#define MC_AWB_ROI_WRF_LastColRep32_ON             1
+#define MC_AWB_ROI_WRF_LastColRep32_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx32                (MCPARAMID)( 7619 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth32                (MCPARAMID)( 7620 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI32      (MCPARAMID)( 7621 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI32      (MCPARAMID)( 7622 << 14)
+#define MC_AWB_ROI_WRF_Line132                   (MCPARAMID)( 7623 << 14)
+#define MC_AWB_ROI_WRF_Line132_GB                  1
+#define MC_AWB_ROI_WRF_Line132_BG                  2
+#define MC_AWB_ROI_WRF_Line132_RG                  3
+#define MC_AWB_ROI_WRF_Line132_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1032             (MCPARAMID)( 7624 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1132             (MCPARAMID)( 7625 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1232             (MCPARAMID)( 7626 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1332             (MCPARAMID)( 7627 << 14)
+#define MC_AWB_ROI_WRF_TOIheight32               (MCPARAMID)( 7628 << 14)
+#define MC_AWB_ROI_WRF_LastTOI32                 (MCPARAMID)( 7629 << 14)
+#define MC_AWB_ROI_WRF_LastTOI32_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI32_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset32               (MCPARAMID)( 7630 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch32                (MCPARAMID)( 7631 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine32                (MCPARAMID)( 7632 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd32              (MCPARAMID)( 7633 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep33              (MCPARAMID)( 7634 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep33_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep33_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep33             (MCPARAMID)( 7635 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep33_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep33_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep33               (MCPARAMID)( 7636 << 14)
+#define MC_AWB_ROI_WRF_1stColRep33_ON              1
+#define MC_AWB_ROI_WRF_1stColRep33_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep33              (MCPARAMID)( 7637 << 14)
+#define MC_AWB_ROI_WRF_LastColRep33_ON             1
+#define MC_AWB_ROI_WRF_LastColRep33_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx33                (MCPARAMID)( 7638 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth33                (MCPARAMID)( 7639 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI33      (MCPARAMID)( 7640 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI33      (MCPARAMID)( 7641 << 14)
+#define MC_AWB_ROI_WRF_Line133                   (MCPARAMID)( 7642 << 14)
+#define MC_AWB_ROI_WRF_Line133_GB                  1
+#define MC_AWB_ROI_WRF_Line133_BG                  2
+#define MC_AWB_ROI_WRF_Line133_RG                  3
+#define MC_AWB_ROI_WRF_Line133_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1033             (MCPARAMID)( 7643 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1133             (MCPARAMID)( 7644 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1233             (MCPARAMID)( 7645 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1333             (MCPARAMID)( 7646 << 14)
+#define MC_AWB_ROI_WRF_TOIheight33               (MCPARAMID)( 7647 << 14)
+#define MC_AWB_ROI_WRF_LastTOI33                 (MCPARAMID)( 7648 << 14)
+#define MC_AWB_ROI_WRF_LastTOI33_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI33_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset33               (MCPARAMID)( 7649 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch33                (MCPARAMID)( 7650 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine33                (MCPARAMID)( 7651 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd33              (MCPARAMID)( 7652 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep34              (MCPARAMID)( 7653 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep34_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep34_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep34             (MCPARAMID)( 7654 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep34_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep34_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep34               (MCPARAMID)( 7655 << 14)
+#define MC_AWB_ROI_WRF_1stColRep34_ON              1
+#define MC_AWB_ROI_WRF_1stColRep34_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep34              (MCPARAMID)( 7656 << 14)
+#define MC_AWB_ROI_WRF_LastColRep34_ON             1
+#define MC_AWB_ROI_WRF_LastColRep34_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx34                (MCPARAMID)( 7657 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth34                (MCPARAMID)( 7658 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI34      (MCPARAMID)( 7659 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI34      (MCPARAMID)( 7660 << 14)
+#define MC_AWB_ROI_WRF_Line134                   (MCPARAMID)( 7661 << 14)
+#define MC_AWB_ROI_WRF_Line134_GB                  1
+#define MC_AWB_ROI_WRF_Line134_BG                  2
+#define MC_AWB_ROI_WRF_Line134_RG                  3
+#define MC_AWB_ROI_WRF_Line134_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1034             (MCPARAMID)( 7662 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1134             (MCPARAMID)( 7663 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1234             (MCPARAMID)( 7664 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1334             (MCPARAMID)( 7665 << 14)
+#define MC_AWB_ROI_WRF_TOIheight34               (MCPARAMID)( 7666 << 14)
+#define MC_AWB_ROI_WRF_LastTOI34                 (MCPARAMID)( 7667 << 14)
+#define MC_AWB_ROI_WRF_LastTOI34_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI34_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset34               (MCPARAMID)( 7668 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch34                (MCPARAMID)( 7669 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine34                (MCPARAMID)( 7670 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd34              (MCPARAMID)( 7671 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep35              (MCPARAMID)( 7672 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep35_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep35_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep35             (MCPARAMID)( 7673 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep35_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep35_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep35               (MCPARAMID)( 7674 << 14)
+#define MC_AWB_ROI_WRF_1stColRep35_ON              1
+#define MC_AWB_ROI_WRF_1stColRep35_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep35              (MCPARAMID)( 7675 << 14)
+#define MC_AWB_ROI_WRF_LastColRep35_ON             1
+#define MC_AWB_ROI_WRF_LastColRep35_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx35                (MCPARAMID)( 7676 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth35                (MCPARAMID)( 7677 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI35      (MCPARAMID)( 7678 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI35      (MCPARAMID)( 7679 << 14)
+#define MC_AWB_ROI_WRF_Line135                   (MCPARAMID)( 7680 << 14)
+#define MC_AWB_ROI_WRF_Line135_GB                  1
+#define MC_AWB_ROI_WRF_Line135_BG                  2
+#define MC_AWB_ROI_WRF_Line135_RG                  3
+#define MC_AWB_ROI_WRF_Line135_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1035             (MCPARAMID)( 7681 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1135             (MCPARAMID)( 7682 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1235             (MCPARAMID)( 7683 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1335             (MCPARAMID)( 7684 << 14)
+#define MC_AWB_ROI_WRF_TOIheight35               (MCPARAMID)( 7685 << 14)
+#define MC_AWB_ROI_WRF_LastTOI35                 (MCPARAMID)( 7686 << 14)
+#define MC_AWB_ROI_WRF_LastTOI35_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI35_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset35               (MCPARAMID)( 7687 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch35                (MCPARAMID)( 7688 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine35                (MCPARAMID)( 7689 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd35              (MCPARAMID)( 7690 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep36              (MCPARAMID)( 7691 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep36_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep36_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep36             (MCPARAMID)( 7692 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep36_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep36_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep36               (MCPARAMID)( 7693 << 14)
+#define MC_AWB_ROI_WRF_1stColRep36_ON              1
+#define MC_AWB_ROI_WRF_1stColRep36_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep36              (MCPARAMID)( 7694 << 14)
+#define MC_AWB_ROI_WRF_LastColRep36_ON             1
+#define MC_AWB_ROI_WRF_LastColRep36_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx36                (MCPARAMID)( 7695 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth36                (MCPARAMID)( 7696 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI36      (MCPARAMID)( 7697 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI36      (MCPARAMID)( 7698 << 14)
+#define MC_AWB_ROI_WRF_Line136                   (MCPARAMID)( 7699 << 14)
+#define MC_AWB_ROI_WRF_Line136_GB                  1
+#define MC_AWB_ROI_WRF_Line136_BG                  2
+#define MC_AWB_ROI_WRF_Line136_RG                  3
+#define MC_AWB_ROI_WRF_Line136_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1036             (MCPARAMID)( 7700 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1136             (MCPARAMID)( 7701 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1236             (MCPARAMID)( 7702 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1336             (MCPARAMID)( 7703 << 14)
+#define MC_AWB_ROI_WRF_TOIheight36               (MCPARAMID)( 7704 << 14)
+#define MC_AWB_ROI_WRF_LastTOI36                 (MCPARAMID)( 7705 << 14)
+#define MC_AWB_ROI_WRF_LastTOI36_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI36_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset36               (MCPARAMID)( 7706 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch36                (MCPARAMID)( 7707 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine36                (MCPARAMID)( 7708 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd36              (MCPARAMID)( 7709 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep37              (MCPARAMID)( 7710 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep37_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep37_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep37             (MCPARAMID)( 7711 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep37_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep37_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep37               (MCPARAMID)( 7712 << 14)
+#define MC_AWB_ROI_WRF_1stColRep37_ON              1
+#define MC_AWB_ROI_WRF_1stColRep37_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep37              (MCPARAMID)( 7713 << 14)
+#define MC_AWB_ROI_WRF_LastColRep37_ON             1
+#define MC_AWB_ROI_WRF_LastColRep37_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx37                (MCPARAMID)( 7714 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth37                (MCPARAMID)( 7715 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI37      (MCPARAMID)( 7716 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI37      (MCPARAMID)( 7717 << 14)
+#define MC_AWB_ROI_WRF_Line137                   (MCPARAMID)( 7718 << 14)
+#define MC_AWB_ROI_WRF_Line137_GB                  1
+#define MC_AWB_ROI_WRF_Line137_BG                  2
+#define MC_AWB_ROI_WRF_Line137_RG                  3
+#define MC_AWB_ROI_WRF_Line137_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1037             (MCPARAMID)( 7719 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1137             (MCPARAMID)( 7720 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1237             (MCPARAMID)( 7721 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1337             (MCPARAMID)( 7722 << 14)
+#define MC_AWB_ROI_WRF_TOIheight37               (MCPARAMID)( 7723 << 14)
+#define MC_AWB_ROI_WRF_LastTOI37                 (MCPARAMID)( 7724 << 14)
+#define MC_AWB_ROI_WRF_LastTOI37_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI37_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset37               (MCPARAMID)( 7725 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch37                (MCPARAMID)( 7726 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine37                (MCPARAMID)( 7727 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd37              (MCPARAMID)( 7728 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep38              (MCPARAMID)( 7729 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep38_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep38_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep38             (MCPARAMID)( 7730 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep38_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep38_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep38               (MCPARAMID)( 7731 << 14)
+#define MC_AWB_ROI_WRF_1stColRep38_ON              1
+#define MC_AWB_ROI_WRF_1stColRep38_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep38              (MCPARAMID)( 7732 << 14)
+#define MC_AWB_ROI_WRF_LastColRep38_ON             1
+#define MC_AWB_ROI_WRF_LastColRep38_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx38                (MCPARAMID)( 7733 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth38                (MCPARAMID)( 7734 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI38      (MCPARAMID)( 7735 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI38      (MCPARAMID)( 7736 << 14)
+#define MC_AWB_ROI_WRF_Line138                   (MCPARAMID)( 7737 << 14)
+#define MC_AWB_ROI_WRF_Line138_GB                  1
+#define MC_AWB_ROI_WRF_Line138_BG                  2
+#define MC_AWB_ROI_WRF_Line138_RG                  3
+#define MC_AWB_ROI_WRF_Line138_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1038             (MCPARAMID)( 7738 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1138             (MCPARAMID)( 7739 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1238             (MCPARAMID)( 7740 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1338             (MCPARAMID)( 7741 << 14)
+#define MC_AWB_ROI_WRF_TOIheight38               (MCPARAMID)( 7742 << 14)
+#define MC_AWB_ROI_WRF_LastTOI38                 (MCPARAMID)( 7743 << 14)
+#define MC_AWB_ROI_WRF_LastTOI38_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI38_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset38               (MCPARAMID)( 7744 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch38                (MCPARAMID)( 7745 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine38                (MCPARAMID)( 7746 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd38              (MCPARAMID)( 7747 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep39              (MCPARAMID)( 7748 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep39_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep39_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep39             (MCPARAMID)( 7749 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep39_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep39_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep39               (MCPARAMID)( 7750 << 14)
+#define MC_AWB_ROI_WRF_1stColRep39_ON              1
+#define MC_AWB_ROI_WRF_1stColRep39_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep39              (MCPARAMID)( 7751 << 14)
+#define MC_AWB_ROI_WRF_LastColRep39_ON             1
+#define MC_AWB_ROI_WRF_LastColRep39_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx39                (MCPARAMID)( 7752 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth39                (MCPARAMID)( 7753 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI39      (MCPARAMID)( 7754 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI39      (MCPARAMID)( 7755 << 14)
+#define MC_AWB_ROI_WRF_Line139                   (MCPARAMID)( 7756 << 14)
+#define MC_AWB_ROI_WRF_Line139_GB                  1
+#define MC_AWB_ROI_WRF_Line139_BG                  2
+#define MC_AWB_ROI_WRF_Line139_RG                  3
+#define MC_AWB_ROI_WRF_Line139_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1039             (MCPARAMID)( 7757 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1139             (MCPARAMID)( 7758 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1239             (MCPARAMID)( 7759 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1339             (MCPARAMID)( 7760 << 14)
+#define MC_AWB_ROI_WRF_TOIheight39               (MCPARAMID)( 7761 << 14)
+#define MC_AWB_ROI_WRF_LastTOI39                 (MCPARAMID)( 7762 << 14)
+#define MC_AWB_ROI_WRF_LastTOI39_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI39_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset39               (MCPARAMID)( 7763 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch39                (MCPARAMID)( 7764 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine39                (MCPARAMID)( 7765 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd39              (MCPARAMID)( 7766 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep40              (MCPARAMID)( 7767 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep40_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep40_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep40             (MCPARAMID)( 7768 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep40_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep40_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep40               (MCPARAMID)( 7769 << 14)
+#define MC_AWB_ROI_WRF_1stColRep40_ON              1
+#define MC_AWB_ROI_WRF_1stColRep40_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep40              (MCPARAMID)( 7770 << 14)
+#define MC_AWB_ROI_WRF_LastColRep40_ON             1
+#define MC_AWB_ROI_WRF_LastColRep40_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx40                (MCPARAMID)( 7771 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth40                (MCPARAMID)( 7772 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI40      (MCPARAMID)( 7773 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI40      (MCPARAMID)( 7774 << 14)
+#define MC_AWB_ROI_WRF_Line140                   (MCPARAMID)( 7775 << 14)
+#define MC_AWB_ROI_WRF_Line140_GB                  1
+#define MC_AWB_ROI_WRF_Line140_BG                  2
+#define MC_AWB_ROI_WRF_Line140_RG                  3
+#define MC_AWB_ROI_WRF_Line140_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1040             (MCPARAMID)( 7776 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1140             (MCPARAMID)( 7777 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1240             (MCPARAMID)( 7778 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1340             (MCPARAMID)( 7779 << 14)
+#define MC_AWB_ROI_WRF_TOIheight40               (MCPARAMID)( 7780 << 14)
+#define MC_AWB_ROI_WRF_LastTOI40                 (MCPARAMID)( 7781 << 14)
+#define MC_AWB_ROI_WRF_LastTOI40_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI40_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset40               (MCPARAMID)( 7782 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch40                (MCPARAMID)( 7783 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine40                (MCPARAMID)( 7784 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd40              (MCPARAMID)( 7785 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep41              (MCPARAMID)( 7786 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep41_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep41_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep41             (MCPARAMID)( 7787 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep41_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep41_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep41               (MCPARAMID)( 7788 << 14)
+#define MC_AWB_ROI_WRF_1stColRep41_ON              1
+#define MC_AWB_ROI_WRF_1stColRep41_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep41              (MCPARAMID)( 7789 << 14)
+#define MC_AWB_ROI_WRF_LastColRep41_ON             1
+#define MC_AWB_ROI_WRF_LastColRep41_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx41                (MCPARAMID)( 7790 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth41                (MCPARAMID)( 7791 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI41      (MCPARAMID)( 7792 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI41      (MCPARAMID)( 7793 << 14)
+#define MC_AWB_ROI_WRF_Line141                   (MCPARAMID)( 7794 << 14)
+#define MC_AWB_ROI_WRF_Line141_GB                  1
+#define MC_AWB_ROI_WRF_Line141_BG                  2
+#define MC_AWB_ROI_WRF_Line141_RG                  3
+#define MC_AWB_ROI_WRF_Line141_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1041             (MCPARAMID)( 7795 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1141             (MCPARAMID)( 7796 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1241             (MCPARAMID)( 7797 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1341             (MCPARAMID)( 7798 << 14)
+#define MC_AWB_ROI_WRF_TOIheight41               (MCPARAMID)( 7799 << 14)
+#define MC_AWB_ROI_WRF_LastTOI41                 (MCPARAMID)( 7800 << 14)
+#define MC_AWB_ROI_WRF_LastTOI41_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI41_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset41               (MCPARAMID)( 7801 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch41                (MCPARAMID)( 7802 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine41                (MCPARAMID)( 7803 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd41              (MCPARAMID)( 7804 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep42              (MCPARAMID)( 7805 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep42_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep42_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep42             (MCPARAMID)( 7806 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep42_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep42_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep42               (MCPARAMID)( 7807 << 14)
+#define MC_AWB_ROI_WRF_1stColRep42_ON              1
+#define MC_AWB_ROI_WRF_1stColRep42_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep42              (MCPARAMID)( 7808 << 14)
+#define MC_AWB_ROI_WRF_LastColRep42_ON             1
+#define MC_AWB_ROI_WRF_LastColRep42_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx42                (MCPARAMID)( 7809 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth42                (MCPARAMID)( 7810 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI42      (MCPARAMID)( 7811 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI42      (MCPARAMID)( 7812 << 14)
+#define MC_AWB_ROI_WRF_Line142                   (MCPARAMID)( 7813 << 14)
+#define MC_AWB_ROI_WRF_Line142_GB                  1
+#define MC_AWB_ROI_WRF_Line142_BG                  2
+#define MC_AWB_ROI_WRF_Line142_RG                  3
+#define MC_AWB_ROI_WRF_Line142_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1042             (MCPARAMID)( 7814 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1142             (MCPARAMID)( 7815 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1242             (MCPARAMID)( 7816 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1342             (MCPARAMID)( 7817 << 14)
+#define MC_AWB_ROI_WRF_TOIheight42               (MCPARAMID)( 7818 << 14)
+#define MC_AWB_ROI_WRF_LastTOI42                 (MCPARAMID)( 7819 << 14)
+#define MC_AWB_ROI_WRF_LastTOI42_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI42_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset42               (MCPARAMID)( 7820 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch42                (MCPARAMID)( 7821 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine42                (MCPARAMID)( 7822 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd42              (MCPARAMID)( 7823 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep43              (MCPARAMID)( 7824 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep43_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep43_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep43             (MCPARAMID)( 7825 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep43_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep43_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep43               (MCPARAMID)( 7826 << 14)
+#define MC_AWB_ROI_WRF_1stColRep43_ON              1
+#define MC_AWB_ROI_WRF_1stColRep43_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep43              (MCPARAMID)( 7827 << 14)
+#define MC_AWB_ROI_WRF_LastColRep43_ON             1
+#define MC_AWB_ROI_WRF_LastColRep43_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx43                (MCPARAMID)( 7828 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth43                (MCPARAMID)( 7829 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI43      (MCPARAMID)( 7830 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI43      (MCPARAMID)( 7831 << 14)
+#define MC_AWB_ROI_WRF_Line143                   (MCPARAMID)( 7832 << 14)
+#define MC_AWB_ROI_WRF_Line143_GB                  1
+#define MC_AWB_ROI_WRF_Line143_BG                  2
+#define MC_AWB_ROI_WRF_Line143_RG                  3
+#define MC_AWB_ROI_WRF_Line143_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1043             (MCPARAMID)( 7833 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1143             (MCPARAMID)( 7834 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1243             (MCPARAMID)( 7835 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1343             (MCPARAMID)( 7836 << 14)
+#define MC_AWB_ROI_WRF_TOIheight43               (MCPARAMID)( 7837 << 14)
+#define MC_AWB_ROI_WRF_LastTOI43                 (MCPARAMID)( 7838 << 14)
+#define MC_AWB_ROI_WRF_LastTOI43_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI43_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset43               (MCPARAMID)( 7839 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch43                (MCPARAMID)( 7840 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine43                (MCPARAMID)( 7841 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd43              (MCPARAMID)( 7842 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep44              (MCPARAMID)( 7843 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep44_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep44_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep44             (MCPARAMID)( 7844 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep44_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep44_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep44               (MCPARAMID)( 7845 << 14)
+#define MC_AWB_ROI_WRF_1stColRep44_ON              1
+#define MC_AWB_ROI_WRF_1stColRep44_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep44              (MCPARAMID)( 7846 << 14)
+#define MC_AWB_ROI_WRF_LastColRep44_ON             1
+#define MC_AWB_ROI_WRF_LastColRep44_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx44                (MCPARAMID)( 7847 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth44                (MCPARAMID)( 7848 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI44      (MCPARAMID)( 7849 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI44      (MCPARAMID)( 7850 << 14)
+#define MC_AWB_ROI_WRF_Line144                   (MCPARAMID)( 7851 << 14)
+#define MC_AWB_ROI_WRF_Line144_GB                  1
+#define MC_AWB_ROI_WRF_Line144_BG                  2
+#define MC_AWB_ROI_WRF_Line144_RG                  3
+#define MC_AWB_ROI_WRF_Line144_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1044             (MCPARAMID)( 7852 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1144             (MCPARAMID)( 7853 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1244             (MCPARAMID)( 7854 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1344             (MCPARAMID)( 7855 << 14)
+#define MC_AWB_ROI_WRF_TOIheight44               (MCPARAMID)( 7856 << 14)
+#define MC_AWB_ROI_WRF_LastTOI44                 (MCPARAMID)( 7857 << 14)
+#define MC_AWB_ROI_WRF_LastTOI44_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI44_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset44               (MCPARAMID)( 7858 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch44                (MCPARAMID)( 7859 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine44                (MCPARAMID)( 7860 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd44              (MCPARAMID)( 7861 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep45              (MCPARAMID)( 7862 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep45_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep45_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep45             (MCPARAMID)( 7863 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep45_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep45_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep45               (MCPARAMID)( 7864 << 14)
+#define MC_AWB_ROI_WRF_1stColRep45_ON              1
+#define MC_AWB_ROI_WRF_1stColRep45_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep45              (MCPARAMID)( 7865 << 14)
+#define MC_AWB_ROI_WRF_LastColRep45_ON             1
+#define MC_AWB_ROI_WRF_LastColRep45_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx45                (MCPARAMID)( 7866 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth45                (MCPARAMID)( 7867 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI45      (MCPARAMID)( 7868 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI45      (MCPARAMID)( 7869 << 14)
+#define MC_AWB_ROI_WRF_Line145                   (MCPARAMID)( 7870 << 14)
+#define MC_AWB_ROI_WRF_Line145_GB                  1
+#define MC_AWB_ROI_WRF_Line145_BG                  2
+#define MC_AWB_ROI_WRF_Line145_RG                  3
+#define MC_AWB_ROI_WRF_Line145_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1045             (MCPARAMID)( 7871 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1145             (MCPARAMID)( 7872 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1245             (MCPARAMID)( 7873 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1345             (MCPARAMID)( 7874 << 14)
+#define MC_AWB_ROI_WRF_TOIheight45               (MCPARAMID)( 7875 << 14)
+#define MC_AWB_ROI_WRF_LastTOI45                 (MCPARAMID)( 7876 << 14)
+#define MC_AWB_ROI_WRF_LastTOI45_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI45_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset45               (MCPARAMID)( 7877 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch45                (MCPARAMID)( 7878 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine45                (MCPARAMID)( 7879 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd45              (MCPARAMID)( 7880 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep46              (MCPARAMID)( 7881 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep46_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep46_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep46             (MCPARAMID)( 7882 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep46_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep46_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep46               (MCPARAMID)( 7883 << 14)
+#define MC_AWB_ROI_WRF_1stColRep46_ON              1
+#define MC_AWB_ROI_WRF_1stColRep46_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep46              (MCPARAMID)( 7884 << 14)
+#define MC_AWB_ROI_WRF_LastColRep46_ON             1
+#define MC_AWB_ROI_WRF_LastColRep46_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx46                (MCPARAMID)( 7885 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth46                (MCPARAMID)( 7886 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI46      (MCPARAMID)( 7887 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI46      (MCPARAMID)( 7888 << 14)
+#define MC_AWB_ROI_WRF_Line146                   (MCPARAMID)( 7889 << 14)
+#define MC_AWB_ROI_WRF_Line146_GB                  1
+#define MC_AWB_ROI_WRF_Line146_BG                  2
+#define MC_AWB_ROI_WRF_Line146_RG                  3
+#define MC_AWB_ROI_WRF_Line146_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1046             (MCPARAMID)( 7890 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1146             (MCPARAMID)( 7891 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1246             (MCPARAMID)( 7892 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1346             (MCPARAMID)( 7893 << 14)
+#define MC_AWB_ROI_WRF_TOIheight46               (MCPARAMID)( 7894 << 14)
+#define MC_AWB_ROI_WRF_LastTOI46                 (MCPARAMID)( 7895 << 14)
+#define MC_AWB_ROI_WRF_LastTOI46_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI46_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset46               (MCPARAMID)( 7896 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch46                (MCPARAMID)( 7897 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine46                (MCPARAMID)( 7898 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd46              (MCPARAMID)( 7899 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep47              (MCPARAMID)( 7900 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep47_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep47_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep47             (MCPARAMID)( 7901 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep47_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep47_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep47               (MCPARAMID)( 7902 << 14)
+#define MC_AWB_ROI_WRF_1stColRep47_ON              1
+#define MC_AWB_ROI_WRF_1stColRep47_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep47              (MCPARAMID)( 7903 << 14)
+#define MC_AWB_ROI_WRF_LastColRep47_ON             1
+#define MC_AWB_ROI_WRF_LastColRep47_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx47                (MCPARAMID)( 7904 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth47                (MCPARAMID)( 7905 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI47      (MCPARAMID)( 7906 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI47      (MCPARAMID)( 7907 << 14)
+#define MC_AWB_ROI_WRF_Line147                   (MCPARAMID)( 7908 << 14)
+#define MC_AWB_ROI_WRF_Line147_GB                  1
+#define MC_AWB_ROI_WRF_Line147_BG                  2
+#define MC_AWB_ROI_WRF_Line147_RG                  3
+#define MC_AWB_ROI_WRF_Line147_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1047             (MCPARAMID)( 7909 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1147             (MCPARAMID)( 7910 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1247             (MCPARAMID)( 7911 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1347             (MCPARAMID)( 7912 << 14)
+#define MC_AWB_ROI_WRF_TOIheight47               (MCPARAMID)( 7913 << 14)
+#define MC_AWB_ROI_WRF_LastTOI47                 (MCPARAMID)( 7914 << 14)
+#define MC_AWB_ROI_WRF_LastTOI47_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI47_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset47               (MCPARAMID)( 7915 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch47                (MCPARAMID)( 7916 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine47                (MCPARAMID)( 7917 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd47              (MCPARAMID)( 7918 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep48              (MCPARAMID)( 7919 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep48_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep48_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep48             (MCPARAMID)( 7920 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep48_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep48_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep48               (MCPARAMID)( 7921 << 14)
+#define MC_AWB_ROI_WRF_1stColRep48_ON              1
+#define MC_AWB_ROI_WRF_1stColRep48_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep48              (MCPARAMID)( 7922 << 14)
+#define MC_AWB_ROI_WRF_LastColRep48_ON             1
+#define MC_AWB_ROI_WRF_LastColRep48_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx48                (MCPARAMID)( 7923 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth48                (MCPARAMID)( 7924 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI48      (MCPARAMID)( 7925 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI48      (MCPARAMID)( 7926 << 14)
+#define MC_AWB_ROI_WRF_Line148                   (MCPARAMID)( 7927 << 14)
+#define MC_AWB_ROI_WRF_Line148_GB                  1
+#define MC_AWB_ROI_WRF_Line148_BG                  2
+#define MC_AWB_ROI_WRF_Line148_RG                  3
+#define MC_AWB_ROI_WRF_Line148_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1048             (MCPARAMID)( 7928 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1148             (MCPARAMID)( 7929 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1248             (MCPARAMID)( 7930 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1348             (MCPARAMID)( 7931 << 14)
+#define MC_AWB_ROI_WRF_TOIheight48               (MCPARAMID)( 7932 << 14)
+#define MC_AWB_ROI_WRF_LastTOI48                 (MCPARAMID)( 7933 << 14)
+#define MC_AWB_ROI_WRF_LastTOI48_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI48_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset48               (MCPARAMID)( 7934 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch48                (MCPARAMID)( 7935 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine48                (MCPARAMID)( 7936 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd48              (MCPARAMID)( 7937 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep49              (MCPARAMID)( 7938 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep49_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep49_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep49             (MCPARAMID)( 7939 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep49_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep49_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep49               (MCPARAMID)( 7940 << 14)
+#define MC_AWB_ROI_WRF_1stColRep49_ON              1
+#define MC_AWB_ROI_WRF_1stColRep49_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep49              (MCPARAMID)( 7941 << 14)
+#define MC_AWB_ROI_WRF_LastColRep49_ON             1
+#define MC_AWB_ROI_WRF_LastColRep49_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx49                (MCPARAMID)( 7942 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth49                (MCPARAMID)( 7943 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI49      (MCPARAMID)( 7944 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI49      (MCPARAMID)( 7945 << 14)
+#define MC_AWB_ROI_WRF_Line149                   (MCPARAMID)( 7946 << 14)
+#define MC_AWB_ROI_WRF_Line149_GB                  1
+#define MC_AWB_ROI_WRF_Line149_BG                  2
+#define MC_AWB_ROI_WRF_Line149_RG                  3
+#define MC_AWB_ROI_WRF_Line149_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1049             (MCPARAMID)( 7947 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1149             (MCPARAMID)( 7948 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1249             (MCPARAMID)( 7949 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1349             (MCPARAMID)( 7950 << 14)
+#define MC_AWB_ROI_WRF_TOIheight49               (MCPARAMID)( 7951 << 14)
+#define MC_AWB_ROI_WRF_LastTOI49                 (MCPARAMID)( 7952 << 14)
+#define MC_AWB_ROI_WRF_LastTOI49_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI49_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset49               (MCPARAMID)( 7953 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch49                (MCPARAMID)( 7954 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine49                (MCPARAMID)( 7955 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd49              (MCPARAMID)( 7956 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep50              (MCPARAMID)( 7957 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep50_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep50_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep50             (MCPARAMID)( 7958 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep50_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep50_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep50               (MCPARAMID)( 7959 << 14)
+#define MC_AWB_ROI_WRF_1stColRep50_ON              1
+#define MC_AWB_ROI_WRF_1stColRep50_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep50              (MCPARAMID)( 7960 << 14)
+#define MC_AWB_ROI_WRF_LastColRep50_ON             1
+#define MC_AWB_ROI_WRF_LastColRep50_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx50                (MCPARAMID)( 7961 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth50                (MCPARAMID)( 7962 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI50      (MCPARAMID)( 7963 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI50      (MCPARAMID)( 7964 << 14)
+#define MC_AWB_ROI_WRF_Line150                   (MCPARAMID)( 7965 << 14)
+#define MC_AWB_ROI_WRF_Line150_GB                  1
+#define MC_AWB_ROI_WRF_Line150_BG                  2
+#define MC_AWB_ROI_WRF_Line150_RG                  3
+#define MC_AWB_ROI_WRF_Line150_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1050             (MCPARAMID)( 7966 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1150             (MCPARAMID)( 7967 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1250             (MCPARAMID)( 7968 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1350             (MCPARAMID)( 7969 << 14)
+#define MC_AWB_ROI_WRF_TOIheight50               (MCPARAMID)( 7970 << 14)
+#define MC_AWB_ROI_WRF_LastTOI50                 (MCPARAMID)( 7971 << 14)
+#define MC_AWB_ROI_WRF_LastTOI50_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI50_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset50               (MCPARAMID)( 7972 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch50                (MCPARAMID)( 7973 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine50                (MCPARAMID)( 7974 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd50              (MCPARAMID)( 7975 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep51              (MCPARAMID)( 7976 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep51_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep51_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep51             (MCPARAMID)( 7977 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep51_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep51_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep51               (MCPARAMID)( 7978 << 14)
+#define MC_AWB_ROI_WRF_1stColRep51_ON              1
+#define MC_AWB_ROI_WRF_1stColRep51_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep51              (MCPARAMID)( 7979 << 14)
+#define MC_AWB_ROI_WRF_LastColRep51_ON             1
+#define MC_AWB_ROI_WRF_LastColRep51_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx51                (MCPARAMID)( 7980 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth51                (MCPARAMID)( 7981 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI51      (MCPARAMID)( 7982 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI51      (MCPARAMID)( 7983 << 14)
+#define MC_AWB_ROI_WRF_Line151                   (MCPARAMID)( 7984 << 14)
+#define MC_AWB_ROI_WRF_Line151_GB                  1
+#define MC_AWB_ROI_WRF_Line151_BG                  2
+#define MC_AWB_ROI_WRF_Line151_RG                  3
+#define MC_AWB_ROI_WRF_Line151_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1051             (MCPARAMID)( 7985 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1151             (MCPARAMID)( 7986 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1251             (MCPARAMID)( 7987 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1351             (MCPARAMID)( 7988 << 14)
+#define MC_AWB_ROI_WRF_TOIheight51               (MCPARAMID)( 7989 << 14)
+#define MC_AWB_ROI_WRF_LastTOI51                 (MCPARAMID)( 7990 << 14)
+#define MC_AWB_ROI_WRF_LastTOI51_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI51_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset51               (MCPARAMID)( 7991 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch51                (MCPARAMID)( 7992 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine51                (MCPARAMID)( 7993 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd51              (MCPARAMID)( 7994 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep52              (MCPARAMID)( 7995 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep52_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep52_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep52             (MCPARAMID)( 7996 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep52_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep52_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep52               (MCPARAMID)( 7997 << 14)
+#define MC_AWB_ROI_WRF_1stColRep52_ON              1
+#define MC_AWB_ROI_WRF_1stColRep52_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep52              (MCPARAMID)( 7998 << 14)
+#define MC_AWB_ROI_WRF_LastColRep52_ON             1
+#define MC_AWB_ROI_WRF_LastColRep52_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx52                (MCPARAMID)( 7999 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth52                (MCPARAMID)( 8000 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI52      (MCPARAMID)( 8001 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI52      (MCPARAMID)( 8002 << 14)
+#define MC_AWB_ROI_WRF_Line152                   (MCPARAMID)( 8003 << 14)
+#define MC_AWB_ROI_WRF_Line152_GB                  1
+#define MC_AWB_ROI_WRF_Line152_BG                  2
+#define MC_AWB_ROI_WRF_Line152_RG                  3
+#define MC_AWB_ROI_WRF_Line152_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1052             (MCPARAMID)( 8004 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1152             (MCPARAMID)( 8005 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1252             (MCPARAMID)( 8006 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1352             (MCPARAMID)( 8007 << 14)
+#define MC_AWB_ROI_WRF_TOIheight52               (MCPARAMID)( 8008 << 14)
+#define MC_AWB_ROI_WRF_LastTOI52                 (MCPARAMID)( 8009 << 14)
+#define MC_AWB_ROI_WRF_LastTOI52_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI52_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset52               (MCPARAMID)( 8010 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch52                (MCPARAMID)( 8011 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine52                (MCPARAMID)( 8012 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd52              (MCPARAMID)( 8013 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep53              (MCPARAMID)( 8014 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep53_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep53_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep53             (MCPARAMID)( 8015 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep53_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep53_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep53               (MCPARAMID)( 8016 << 14)
+#define MC_AWB_ROI_WRF_1stColRep53_ON              1
+#define MC_AWB_ROI_WRF_1stColRep53_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep53              (MCPARAMID)( 8017 << 14)
+#define MC_AWB_ROI_WRF_LastColRep53_ON             1
+#define MC_AWB_ROI_WRF_LastColRep53_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx53                (MCPARAMID)( 8018 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth53                (MCPARAMID)( 8019 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI53      (MCPARAMID)( 8020 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI53      (MCPARAMID)( 8021 << 14)
+#define MC_AWB_ROI_WRF_Line153                   (MCPARAMID)( 8022 << 14)
+#define MC_AWB_ROI_WRF_Line153_GB                  1
+#define MC_AWB_ROI_WRF_Line153_BG                  2
+#define MC_AWB_ROI_WRF_Line153_RG                  3
+#define MC_AWB_ROI_WRF_Line153_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1053             (MCPARAMID)( 8023 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1153             (MCPARAMID)( 8024 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1253             (MCPARAMID)( 8025 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1353             (MCPARAMID)( 8026 << 14)
+#define MC_AWB_ROI_WRF_TOIheight53               (MCPARAMID)( 8027 << 14)
+#define MC_AWB_ROI_WRF_LastTOI53                 (MCPARAMID)( 8028 << 14)
+#define MC_AWB_ROI_WRF_LastTOI53_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI53_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset53               (MCPARAMID)( 8029 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch53                (MCPARAMID)( 8030 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine53                (MCPARAMID)( 8031 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd53              (MCPARAMID)( 8032 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep54              (MCPARAMID)( 8033 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep54_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep54_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep54             (MCPARAMID)( 8034 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep54_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep54_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep54               (MCPARAMID)( 8035 << 14)
+#define MC_AWB_ROI_WRF_1stColRep54_ON              1
+#define MC_AWB_ROI_WRF_1stColRep54_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep54              (MCPARAMID)( 8036 << 14)
+#define MC_AWB_ROI_WRF_LastColRep54_ON             1
+#define MC_AWB_ROI_WRF_LastColRep54_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx54                (MCPARAMID)( 8037 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth54                (MCPARAMID)( 8038 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI54      (MCPARAMID)( 8039 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI54      (MCPARAMID)( 8040 << 14)
+#define MC_AWB_ROI_WRF_Line154                   (MCPARAMID)( 8041 << 14)
+#define MC_AWB_ROI_WRF_Line154_GB                  1
+#define MC_AWB_ROI_WRF_Line154_BG                  2
+#define MC_AWB_ROI_WRF_Line154_RG                  3
+#define MC_AWB_ROI_WRF_Line154_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1054             (MCPARAMID)( 8042 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1154             (MCPARAMID)( 8043 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1254             (MCPARAMID)( 8044 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1354             (MCPARAMID)( 8045 << 14)
+#define MC_AWB_ROI_WRF_TOIheight54               (MCPARAMID)( 8046 << 14)
+#define MC_AWB_ROI_WRF_LastTOI54                 (MCPARAMID)( 8047 << 14)
+#define MC_AWB_ROI_WRF_LastTOI54_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI54_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset54               (MCPARAMID)( 8048 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch54                (MCPARAMID)( 8049 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine54                (MCPARAMID)( 8050 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd54              (MCPARAMID)( 8051 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep55              (MCPARAMID)( 8052 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep55_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep55_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep55             (MCPARAMID)( 8053 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep55_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep55_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep55               (MCPARAMID)( 8054 << 14)
+#define MC_AWB_ROI_WRF_1stColRep55_ON              1
+#define MC_AWB_ROI_WRF_1stColRep55_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep55              (MCPARAMID)( 8055 << 14)
+#define MC_AWB_ROI_WRF_LastColRep55_ON             1
+#define MC_AWB_ROI_WRF_LastColRep55_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx55                (MCPARAMID)( 8056 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth55                (MCPARAMID)( 8057 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI55      (MCPARAMID)( 8058 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI55      (MCPARAMID)( 8059 << 14)
+#define MC_AWB_ROI_WRF_Line155                   (MCPARAMID)( 8060 << 14)
+#define MC_AWB_ROI_WRF_Line155_GB                  1
+#define MC_AWB_ROI_WRF_Line155_BG                  2
+#define MC_AWB_ROI_WRF_Line155_RG                  3
+#define MC_AWB_ROI_WRF_Line155_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1055             (MCPARAMID)( 8061 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1155             (MCPARAMID)( 8062 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1255             (MCPARAMID)( 8063 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1355             (MCPARAMID)( 8064 << 14)
+#define MC_AWB_ROI_WRF_TOIheight55               (MCPARAMID)( 8065 << 14)
+#define MC_AWB_ROI_WRF_LastTOI55                 (MCPARAMID)( 8066 << 14)
+#define MC_AWB_ROI_WRF_LastTOI55_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI55_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset55               (MCPARAMID)( 8067 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch55                (MCPARAMID)( 8068 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine55                (MCPARAMID)( 8069 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd55              (MCPARAMID)( 8070 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep56              (MCPARAMID)( 8071 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep56_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep56_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep56             (MCPARAMID)( 8072 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep56_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep56_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep56               (MCPARAMID)( 8073 << 14)
+#define MC_AWB_ROI_WRF_1stColRep56_ON              1
+#define MC_AWB_ROI_WRF_1stColRep56_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep56              (MCPARAMID)( 8074 << 14)
+#define MC_AWB_ROI_WRF_LastColRep56_ON             1
+#define MC_AWB_ROI_WRF_LastColRep56_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx56                (MCPARAMID)( 8075 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth56                (MCPARAMID)( 8076 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI56      (MCPARAMID)( 8077 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI56      (MCPARAMID)( 8078 << 14)
+#define MC_AWB_ROI_WRF_Line156                   (MCPARAMID)( 8079 << 14)
+#define MC_AWB_ROI_WRF_Line156_GB                  1
+#define MC_AWB_ROI_WRF_Line156_BG                  2
+#define MC_AWB_ROI_WRF_Line156_RG                  3
+#define MC_AWB_ROI_WRF_Line156_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1056             (MCPARAMID)( 8080 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1156             (MCPARAMID)( 8081 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1256             (MCPARAMID)( 8082 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1356             (MCPARAMID)( 8083 << 14)
+#define MC_AWB_ROI_WRF_TOIheight56               (MCPARAMID)( 8084 << 14)
+#define MC_AWB_ROI_WRF_LastTOI56                 (MCPARAMID)( 8085 << 14)
+#define MC_AWB_ROI_WRF_LastTOI56_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI56_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset56               (MCPARAMID)( 8086 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch56                (MCPARAMID)( 8087 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine56                (MCPARAMID)( 8088 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd56              (MCPARAMID)( 8089 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep57              (MCPARAMID)( 8090 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep57_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep57_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep57             (MCPARAMID)( 8091 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep57_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep57_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep57               (MCPARAMID)( 8092 << 14)
+#define MC_AWB_ROI_WRF_1stColRep57_ON              1
+#define MC_AWB_ROI_WRF_1stColRep57_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep57              (MCPARAMID)( 8093 << 14)
+#define MC_AWB_ROI_WRF_LastColRep57_ON             1
+#define MC_AWB_ROI_WRF_LastColRep57_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx57                (MCPARAMID)( 8094 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth57                (MCPARAMID)( 8095 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI57      (MCPARAMID)( 8096 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI57      (MCPARAMID)( 8097 << 14)
+#define MC_AWB_ROI_WRF_Line157                   (MCPARAMID)( 8098 << 14)
+#define MC_AWB_ROI_WRF_Line157_GB                  1
+#define MC_AWB_ROI_WRF_Line157_BG                  2
+#define MC_AWB_ROI_WRF_Line157_RG                  3
+#define MC_AWB_ROI_WRF_Line157_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1057             (MCPARAMID)( 8099 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1157             (MCPARAMID)( 8100 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1257             (MCPARAMID)( 8101 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1357             (MCPARAMID)( 8102 << 14)
+#define MC_AWB_ROI_WRF_TOIheight57               (MCPARAMID)( 8103 << 14)
+#define MC_AWB_ROI_WRF_LastTOI57                 (MCPARAMID)( 8104 << 14)
+#define MC_AWB_ROI_WRF_LastTOI57_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI57_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset57               (MCPARAMID)( 8105 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch57                (MCPARAMID)( 8106 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine57                (MCPARAMID)( 8107 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd57              (MCPARAMID)( 8108 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep58              (MCPARAMID)( 8109 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep58_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep58_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep58             (MCPARAMID)( 8110 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep58_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep58_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep58               (MCPARAMID)( 8111 << 14)
+#define MC_AWB_ROI_WRF_1stColRep58_ON              1
+#define MC_AWB_ROI_WRF_1stColRep58_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep58              (MCPARAMID)( 8112 << 14)
+#define MC_AWB_ROI_WRF_LastColRep58_ON             1
+#define MC_AWB_ROI_WRF_LastColRep58_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx58                (MCPARAMID)( 8113 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth58                (MCPARAMID)( 8114 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI58      (MCPARAMID)( 8115 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI58      (MCPARAMID)( 8116 << 14)
+#define MC_AWB_ROI_WRF_Line158                   (MCPARAMID)( 8117 << 14)
+#define MC_AWB_ROI_WRF_Line158_GB                  1
+#define MC_AWB_ROI_WRF_Line158_BG                  2
+#define MC_AWB_ROI_WRF_Line158_RG                  3
+#define MC_AWB_ROI_WRF_Line158_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1058             (MCPARAMID)( 8118 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1158             (MCPARAMID)( 8119 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1258             (MCPARAMID)( 8120 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1358             (MCPARAMID)( 8121 << 14)
+#define MC_AWB_ROI_WRF_TOIheight58               (MCPARAMID)( 8122 << 14)
+#define MC_AWB_ROI_WRF_LastTOI58                 (MCPARAMID)( 8123 << 14)
+#define MC_AWB_ROI_WRF_LastTOI58_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI58_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset58               (MCPARAMID)( 8124 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch58                (MCPARAMID)( 8125 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine58                (MCPARAMID)( 8126 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd58              (MCPARAMID)( 8127 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep59              (MCPARAMID)( 8128 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep59_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep59_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep59             (MCPARAMID)( 8129 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep59_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep59_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep59               (MCPARAMID)( 8130 << 14)
+#define MC_AWB_ROI_WRF_1stColRep59_ON              1
+#define MC_AWB_ROI_WRF_1stColRep59_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep59              (MCPARAMID)( 8131 << 14)
+#define MC_AWB_ROI_WRF_LastColRep59_ON             1
+#define MC_AWB_ROI_WRF_LastColRep59_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx59                (MCPARAMID)( 8132 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth59                (MCPARAMID)( 8133 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI59      (MCPARAMID)( 8134 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI59      (MCPARAMID)( 8135 << 14)
+#define MC_AWB_ROI_WRF_Line159                   (MCPARAMID)( 8136 << 14)
+#define MC_AWB_ROI_WRF_Line159_GB                  1
+#define MC_AWB_ROI_WRF_Line159_BG                  2
+#define MC_AWB_ROI_WRF_Line159_RG                  3
+#define MC_AWB_ROI_WRF_Line159_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1059             (MCPARAMID)( 8137 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1159             (MCPARAMID)( 8138 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1259             (MCPARAMID)( 8139 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1359             (MCPARAMID)( 8140 << 14)
+#define MC_AWB_ROI_WRF_TOIheight59               (MCPARAMID)( 8141 << 14)
+#define MC_AWB_ROI_WRF_LastTOI59                 (MCPARAMID)( 8142 << 14)
+#define MC_AWB_ROI_WRF_LastTOI59_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI59_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset59               (MCPARAMID)( 8143 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch59                (MCPARAMID)( 8144 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine59                (MCPARAMID)( 8145 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd59              (MCPARAMID)( 8146 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep60              (MCPARAMID)( 8147 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep60_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep60_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep60             (MCPARAMID)( 8148 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep60_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep60_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep60               (MCPARAMID)( 8149 << 14)
+#define MC_AWB_ROI_WRF_1stColRep60_ON              1
+#define MC_AWB_ROI_WRF_1stColRep60_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep60              (MCPARAMID)( 8150 << 14)
+#define MC_AWB_ROI_WRF_LastColRep60_ON             1
+#define MC_AWB_ROI_WRF_LastColRep60_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx60                (MCPARAMID)( 8151 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth60                (MCPARAMID)( 8152 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI60      (MCPARAMID)( 8153 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI60      (MCPARAMID)( 8154 << 14)
+#define MC_AWB_ROI_WRF_Line160                   (MCPARAMID)( 8155 << 14)
+#define MC_AWB_ROI_WRF_Line160_GB                  1
+#define MC_AWB_ROI_WRF_Line160_BG                  2
+#define MC_AWB_ROI_WRF_Line160_RG                  3
+#define MC_AWB_ROI_WRF_Line160_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1060             (MCPARAMID)( 8156 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1160             (MCPARAMID)( 8157 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1260             (MCPARAMID)( 8158 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1360             (MCPARAMID)( 8159 << 14)
+#define MC_AWB_ROI_WRF_TOIheight60               (MCPARAMID)( 8160 << 14)
+#define MC_AWB_ROI_WRF_LastTOI60                 (MCPARAMID)( 8161 << 14)
+#define MC_AWB_ROI_WRF_LastTOI60_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI60_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset60               (MCPARAMID)( 8162 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch60                (MCPARAMID)( 8163 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine60                (MCPARAMID)( 8164 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd60              (MCPARAMID)( 8165 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep61              (MCPARAMID)( 8166 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep61_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep61_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep61             (MCPARAMID)( 8167 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep61_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep61_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep61               (MCPARAMID)( 8168 << 14)
+#define MC_AWB_ROI_WRF_1stColRep61_ON              1
+#define MC_AWB_ROI_WRF_1stColRep61_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep61              (MCPARAMID)( 8169 << 14)
+#define MC_AWB_ROI_WRF_LastColRep61_ON             1
+#define MC_AWB_ROI_WRF_LastColRep61_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx61                (MCPARAMID)( 8170 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth61                (MCPARAMID)( 8171 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI61      (MCPARAMID)( 8172 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI61      (MCPARAMID)( 8173 << 14)
+#define MC_AWB_ROI_WRF_Line161                   (MCPARAMID)( 8174 << 14)
+#define MC_AWB_ROI_WRF_Line161_GB                  1
+#define MC_AWB_ROI_WRF_Line161_BG                  2
+#define MC_AWB_ROI_WRF_Line161_RG                  3
+#define MC_AWB_ROI_WRF_Line161_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1061             (MCPARAMID)( 8175 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1161             (MCPARAMID)( 8176 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1261             (MCPARAMID)( 8177 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1361             (MCPARAMID)( 8178 << 14)
+#define MC_AWB_ROI_WRF_TOIheight61               (MCPARAMID)( 8179 << 14)
+#define MC_AWB_ROI_WRF_LastTOI61                 (MCPARAMID)( 8180 << 14)
+#define MC_AWB_ROI_WRF_LastTOI61_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI61_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset61               (MCPARAMID)( 8181 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch61                (MCPARAMID)( 8182 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine61                (MCPARAMID)( 8183 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd61              (MCPARAMID)( 8184 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep62              (MCPARAMID)( 8185 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep62_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep62_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep62             (MCPARAMID)( 8186 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep62_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep62_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep62               (MCPARAMID)( 8187 << 14)
+#define MC_AWB_ROI_WRF_1stColRep62_ON              1
+#define MC_AWB_ROI_WRF_1stColRep62_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep62              (MCPARAMID)( 8188 << 14)
+#define MC_AWB_ROI_WRF_LastColRep62_ON             1
+#define MC_AWB_ROI_WRF_LastColRep62_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx62                (MCPARAMID)( 8189 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth62                (MCPARAMID)( 8190 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI62      (MCPARAMID)( 8191 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI62      (MCPARAMID)( 8192 << 14)
+#define MC_AWB_ROI_WRF_Line162                   (MCPARAMID)( 8193 << 14)
+#define MC_AWB_ROI_WRF_Line162_GB                  1
+#define MC_AWB_ROI_WRF_Line162_BG                  2
+#define MC_AWB_ROI_WRF_Line162_RG                  3
+#define MC_AWB_ROI_WRF_Line162_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1062             (MCPARAMID)( 8194 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1162             (MCPARAMID)( 8195 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1262             (MCPARAMID)( 8196 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1362             (MCPARAMID)( 8197 << 14)
+#define MC_AWB_ROI_WRF_TOIheight62               (MCPARAMID)( 8198 << 14)
+#define MC_AWB_ROI_WRF_LastTOI62                 (MCPARAMID)( 8199 << 14)
+#define MC_AWB_ROI_WRF_LastTOI62_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI62_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset62               (MCPARAMID)( 8200 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch62                (MCPARAMID)( 8201 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine62                (MCPARAMID)( 8202 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd62              (MCPARAMID)( 8203 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep63              (MCPARAMID)( 8204 << 14)
+#define MC_AWB_ROI_WRF_1stLineRep63_ON             1
+#define MC_AWB_ROI_WRF_1stLineRep63_OFF            2
+#define MC_AWB_ROI_WRF_LastLineRep63             (MCPARAMID)( 8205 << 14)
+#define MC_AWB_ROI_WRF_LastLineRep63_ON            1
+#define MC_AWB_ROI_WRF_LastLineRep63_OFF           2
+#define MC_AWB_ROI_WRF_1stColRep63               (MCPARAMID)( 8206 << 14)
+#define MC_AWB_ROI_WRF_1stColRep63_ON              1
+#define MC_AWB_ROI_WRF_1stColRep63_OFF             2
+#define MC_AWB_ROI_WRF_LastColRep63              (MCPARAMID)( 8207 << 14)
+#define MC_AWB_ROI_WRF_LastColRep63_ON             1
+#define MC_AWB_ROI_WRF_LastColRep63_OFF            2
+#define MC_AWB_ROI_WRF_ColumnIx63                (MCPARAMID)( 8208 << 14)
+#define MC_AWB_ROI_WRF_TOIwidth63                (MCPARAMID)( 8209 << 14)
+#define MC_AWB_ROI_ColorRegistrationX_TOI63      (MCPARAMID)( 8210 << 14)
+#define MC_AWB_ROI_ColorRegistrationY_TOI63      (MCPARAMID)( 8211 << 14)
+#define MC_AWB_ROI_WRF_Line163                   (MCPARAMID)( 8212 << 14)
+#define MC_AWB_ROI_WRF_Line163_GB                  1
+#define MC_AWB_ROI_WRF_Line163_BG                  2
+#define MC_AWB_ROI_WRF_Line163_RG                  3
+#define MC_AWB_ROI_WRF_Line163_GR                  4
+#define MC_AWB_ROI_WRF_XferSizeM1063             (MCPARAMID)( 8213 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1163             (MCPARAMID)( 8214 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1263             (MCPARAMID)( 8215 << 14)
+#define MC_AWB_ROI_WRF_XferSizeM1363             (MCPARAMID)( 8216 << 14)
+#define MC_AWB_ROI_WRF_TOIheight63               (MCPARAMID)( 8217 << 14)
+#define MC_AWB_ROI_WRF_LastTOI63                 (MCPARAMID)( 8218 << 14)
+#define MC_AWB_ROI_WRF_LastTOI63_TRUE              1
+#define MC_AWB_ROI_WRF_LastTOI63_FALSE             2
+#define MC_AWB_ROI_WRF_TOIoffset63               (MCPARAMID)( 8219 << 14)
+#define MC_AWB_ROI_WRF_TOIPitch63                (MCPARAMID)( 8220 << 14)
+#define MC_AWB_ROI_WRF_NbOfLine63                (MCPARAMID)( 8221 << 14)
+#define MC_AWB_ROI_WRF_TOI_EndAdd63              (MCPARAMID)( 8222 << 14)
+#define MC_XF_TOI_USR_Check                      (MCPARAMID)( 8223 << 14)
+#define MC_XF_TOI_USR_Check_PASS                   1
+#define MC_XF_TOI_USR_Check_FAIL                   2
+#define MC_AWB_TOI_USR_Check                     (MCPARAMID)( 8224 << 14)
+#define MC_AWB_TOI_USR_Check_PASS                  1
+#define MC_AWB_TOI_USR_Check_FAIL                  2
+#define MC_WBO_AREA_Check                        (MCPARAMID)( 8225 << 14)
+#define MC_WBO_AREA_Check_PASS                     1
+#define MC_WBO_AREA_Check_FAIL                     2
+#define MC_AWB_ROI_TOI_USR_Check                 (MCPARAMID)( 8226 << 14)
+#define MC_AWB_ROI_TOI_USR_Check_PASS              1
+#define MC_AWB_ROI_TOI_USR_Check_FAIL              2
+#define MC_WBO_ROI_Check                         (MCPARAMID)( 8227 << 14)
+#define MC_WBO_ROI_Check_PASS                      1
+#define MC_WBO_ROI_Check_FAIL                      2
+#define MC_XF_ROI_TOI_USR_Check                  (MCPARAMID)( 8228 << 14)
+#define MC_XF_ROI_TOI_USR_Check_PASS               1
+#define MC_XF_ROI_TOI_USR_Check_FAIL               2
+#define MC_CLCAM_ReadoutDelay                    (MCPARAMID)( 8229 << 14)
+#define MC_LUT_SlicingDefSize                    (MCPARAMID)( 8230 << 14)
+#define MC_LUT_Reload                            (MCPARAMID)( 8231 << 14)
+#define MC_TOI_FSR_Alignment                     (MCPARAMID)( 8232 << 14)
+#define MC_MaxSpeedLimiter                       (MCPARAMID)( 8233 << 14)
+#define MC_MaxSpeedLimiter_OFF                     1
+#define MC_MaxSpeedLimiter_ON                      2
+#define MC_MaxCamerateRateLimiter                (MCPARAMID)( 8234 << 14)
+#define MC_MaxCamerateRateLimiter_OFF              1
+#define MC_MaxCamerateRateLimiter_ON               2
+#define MC_SpeedLimit                            (MCPARAMID)( 8235 << 14)
+#define MC_SpeedLimit_CAMERA                       1
+#define MC__CameraPeriod_Min_us                  (MCPARAMID)( 8236 << 14)
+#define MC__PGPeriod_Min_us                      (MCPARAMID)( 8237 << 14)
+#define MC_SpeedLimitSpecifier                   (MCPARAMID)( 8238 << 14)
+#define MC_SpeedLimitSpecifier_CAMERA              1
+#define MC_SpeedLimitSpecifier_USER                2
+#define MC_SpeedLimitSpecifier_BOTH                3
+#define MC_MaxSpeedOptimal                       (MCPARAMID)( 8239 << 14)
+#define MC_UpperSpeedLimitSpecifier              (MCPARAMID)( 8240 << 14)
+#define MC_UpperSpeedLimitSpecifier_CAMERA         1
+#define MC_UpperSpeedLimitSpecifier_USER           2
+#define MC_UpperSpeedLimitSpecifier_BOTH           3
+#define MC__CameraPeriod_Min_PG                  (MCPARAMID)( 8241 << 14)
+#define MC__UserDefinedPeriod_Min_PG             (MCPARAMID)( 8242 << 14)
+#define MC_MinSpeed_Float                        (MCPARAMID)( 8243 << 14)
+#define MC__TrimmedKeff_Float                    (MCPARAMID)( 8244 << 14)
+#define MC__TrimmedKeff                          (MCPARAMID)( 8245 << 14)
+#define MC_EncoderMaxSpeedEffective              (MCPARAMID)( 8246 << 14)
+#define MC_EncoderMinSpeed                       (MCPARAMID)( 8247 << 14)
+#define MC__TrimmedK_Max                         (MCPARAMID)( 8248 << 14)
+#define MC__TrimmedK_Min                         (MCPARAMID)( 8249 << 14)
+#define MC__K_Ratio                              (MCPARAMID)( 8250 << 14)
+#define MC__M_Ratio_Float                        (MCPARAMID)( 8251 << 14)
+#define MC_GWPlaneSizeX                          (MCPARAMID)( 8252 << 14)
+#define MC__BackEndCtrl                          (MCPARAMID)( 8253 << 14)
+#define MC__BackEndCtrl_TwoStroke                  1
+#define MC__BackEndCtrl_OnTheFly                   2
+#define MC__BackEndCtrlMode                      (MCPARAMID)( 8254 << 14)
+#define MC__BackEndCtrlMode_TwoStroke              1
+#define MC__BackEndCtrlMode_OnTheFly               2
+#define MC_GrabberErrors                         (MCPARAMID)( 8255 << 14)
+#define MC_GrabberOverruns                       (MCPARAMID)( 8256 << 14)
+#define MC__AMAX                                 (MCPARAMID)( 8257 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin0           (MCPARAMID)( 8258 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width0                (MCPARAMID)( 8259 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin1           (MCPARAMID)( 8260 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width1                (MCPARAMID)( 8261 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin2           (MCPARAMID)( 8262 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width2                (MCPARAMID)( 8263 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin3           (MCPARAMID)( 8264 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width3                (MCPARAMID)( 8265 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin4           (MCPARAMID)( 8266 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width4                (MCPARAMID)( 8267 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin5           (MCPARAMID)( 8268 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width5                (MCPARAMID)( 8269 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin6           (MCPARAMID)( 8270 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width6                (MCPARAMID)( 8271 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin7           (MCPARAMID)( 8272 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width7                (MCPARAMID)( 8273 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin8           (MCPARAMID)( 8274 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width8                (MCPARAMID)( 8275 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin9           (MCPARAMID)( 8276 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width9                (MCPARAMID)( 8277 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin10          (MCPARAMID)( 8278 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width10               (MCPARAMID)( 8279 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin11          (MCPARAMID)( 8280 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width11               (MCPARAMID)( 8281 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin12          (MCPARAMID)( 8282 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width12               (MCPARAMID)( 8283 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin13          (MCPARAMID)( 8284 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width13               (MCPARAMID)( 8285 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin14          (MCPARAMID)( 8286 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width14               (MCPARAMID)( 8287 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin15          (MCPARAMID)( 8288 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width15               (MCPARAMID)( 8289 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin16          (MCPARAMID)( 8290 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width16               (MCPARAMID)( 8291 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin17          (MCPARAMID)( 8292 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width17               (MCPARAMID)( 8293 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin18          (MCPARAMID)( 8294 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width18               (MCPARAMID)( 8295 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin19          (MCPARAMID)( 8296 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width19               (MCPARAMID)( 8297 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin20          (MCPARAMID)( 8298 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width20               (MCPARAMID)( 8299 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin21          (MCPARAMID)( 8300 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width21               (MCPARAMID)( 8301 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin22          (MCPARAMID)( 8302 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width22               (MCPARAMID)( 8303 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin23          (MCPARAMID)( 8304 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width23               (MCPARAMID)( 8305 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin24          (MCPARAMID)( 8306 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width24               (MCPARAMID)( 8307 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin25          (MCPARAMID)( 8308 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width25               (MCPARAMID)( 8309 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin26          (MCPARAMID)( 8310 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width26               (MCPARAMID)( 8311 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin27          (MCPARAMID)( 8312 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width27               (MCPARAMID)( 8313 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin28          (MCPARAMID)( 8314 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width28               (MCPARAMID)( 8315 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin29          (MCPARAMID)( 8316 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width29               (MCPARAMID)( 8317 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin30          (MCPARAMID)( 8318 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width30               (MCPARAMID)( 8319 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin31          (MCPARAMID)( 8320 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width31               (MCPARAMID)( 8321 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration0         (MCPARAMID)( 8322 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration0_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration0_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration0_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration0_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration1         (MCPARAMID)( 8323 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration1_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration1_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration1_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration1_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration2         (MCPARAMID)( 8324 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration2_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration2_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration2_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration2_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration3         (MCPARAMID)( 8325 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration3_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration3_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration3_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration3_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration4         (MCPARAMID)( 8326 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration4_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration4_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration4_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration4_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration5         (MCPARAMID)( 8327 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration5_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration5_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration5_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration5_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration6         (MCPARAMID)( 8328 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration6_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration6_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration6_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration6_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration7         (MCPARAMID)( 8329 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration7_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration7_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration7_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration7_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration8         (MCPARAMID)( 8330 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration8_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration8_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration8_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration8_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration9         (MCPARAMID)( 8331 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration9_GB        1
+#define MC_XF_ROI_WRF_ColorRegistration9_BG        2
+#define MC_XF_ROI_WRF_ColorRegistration9_RG        3
+#define MC_XF_ROI_WRF_ColorRegistration9_GR        4
+#define MC_XF_ROI_WRF_ColorRegistration10        (MCPARAMID)( 8332 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration10_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration10_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration10_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration10_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration11        (MCPARAMID)( 8333 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration11_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration11_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration11_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration11_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration12        (MCPARAMID)( 8334 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration12_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration12_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration12_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration12_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration13        (MCPARAMID)( 8335 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration13_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration13_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration13_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration13_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration14        (MCPARAMID)( 8336 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration14_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration14_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration14_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration14_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration15        (MCPARAMID)( 8337 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration15_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration15_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration15_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration15_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration16        (MCPARAMID)( 8338 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration16_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration16_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration16_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration16_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration17        (MCPARAMID)( 8339 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration17_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration17_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration17_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration17_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration18        (MCPARAMID)( 8340 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration18_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration18_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration18_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration18_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration19        (MCPARAMID)( 8341 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration19_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration19_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration19_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration19_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration20        (MCPARAMID)( 8342 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration20_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration20_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration20_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration20_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration21        (MCPARAMID)( 8343 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration21_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration21_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration21_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration21_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration22        (MCPARAMID)( 8344 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration22_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration22_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration22_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration22_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration23        (MCPARAMID)( 8345 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration23_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration23_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration23_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration23_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration24        (MCPARAMID)( 8346 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration24_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration24_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration24_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration24_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration25        (MCPARAMID)( 8347 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration25_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration25_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration25_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration25_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration26        (MCPARAMID)( 8348 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration26_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration26_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration26_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration26_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration27        (MCPARAMID)( 8349 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration27_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration27_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration27_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration27_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration28        (MCPARAMID)( 8350 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration28_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration28_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration28_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration28_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration29        (MCPARAMID)( 8351 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration29_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration29_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration29_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration29_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration30        (MCPARAMID)( 8352 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration30_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration30_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration30_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration30_GR       4
+#define MC_XF_ROI_WRF_ColorRegistration31        (MCPARAMID)( 8353 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration31_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration31_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration31_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration31_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration0        (MCPARAMID)( 8354 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration0_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration0_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration0_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration0_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration1        (MCPARAMID)( 8355 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration1_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration1_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration1_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration1_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration2        (MCPARAMID)( 8356 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration2_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration2_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration2_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration2_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration3        (MCPARAMID)( 8357 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration3_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration3_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration3_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration3_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration4        (MCPARAMID)( 8358 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration4_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration4_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration4_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration4_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration5        (MCPARAMID)( 8359 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration5_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration5_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration5_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration5_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration6        (MCPARAMID)( 8360 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration6_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration6_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration6_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration6_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration7        (MCPARAMID)( 8361 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration7_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration7_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration7_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration7_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration8        (MCPARAMID)( 8362 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration8_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration8_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration8_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration8_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration9        (MCPARAMID)( 8363 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration9_GB       1
+#define MC_AWB_ROI_WRF_ColorRegistration9_BG       2
+#define MC_AWB_ROI_WRF_ColorRegistration9_RG       3
+#define MC_AWB_ROI_WRF_ColorRegistration9_GR       4
+#define MC_AWB_ROI_WRF_ColorRegistration10       (MCPARAMID)( 8364 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration10_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration10_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration10_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration10_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration11       (MCPARAMID)( 8365 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration11_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration11_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration11_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration11_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration12       (MCPARAMID)( 8366 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration12_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration12_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration12_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration12_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration13       (MCPARAMID)( 8367 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration13_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration13_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration13_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration13_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration14       (MCPARAMID)( 8368 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration14_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration14_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration14_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration14_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration15       (MCPARAMID)( 8369 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration15_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration15_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration15_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration15_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration16       (MCPARAMID)( 8370 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration16_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration16_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration16_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration16_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration17       (MCPARAMID)( 8371 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration17_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration17_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration17_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration17_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration18       (MCPARAMID)( 8372 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration18_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration18_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration18_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration18_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration19       (MCPARAMID)( 8373 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration19_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration19_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration19_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration19_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration20       (MCPARAMID)( 8374 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration20_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration20_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration20_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration20_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration21       (MCPARAMID)( 8375 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration21_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration21_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration21_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration21_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration22       (MCPARAMID)( 8376 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration22_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration22_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration22_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration22_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration23       (MCPARAMID)( 8377 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration23_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration23_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration23_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration23_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration24       (MCPARAMID)( 8378 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration24_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration24_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration24_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration24_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration25       (MCPARAMID)( 8379 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration25_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration25_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration25_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration25_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration26       (MCPARAMID)( 8380 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration26_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration26_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration26_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration26_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration27       (MCPARAMID)( 8381 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration27_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration27_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration27_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration27_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration28       (MCPARAMID)( 8382 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration28_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration28_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration28_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration28_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration29       (MCPARAMID)( 8383 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration29_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration29_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration29_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration29_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration30       (MCPARAMID)( 8384 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration30_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration30_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration30_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration30_GR      4
+#define MC_AWB_ROI_WRF_ColorRegistration31       (MCPARAMID)( 8385 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration31_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration31_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration31_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration31_GR      4
+#define MC_XF_ROI_TOI_XFR_NextX_Px               (MCPARAMID)( 8386 << 14)
+#define MC_XF_ROI_TOI_XFR_NextY_Ln               (MCPARAMID)( 8387 << 14)
+#define MC_XF_ROI_TOI_EXT_RightX_Px              (MCPARAMID)( 8388 << 14)
+#define MC_XF_ROI_TOI_EXT_NextY_Ln               (MCPARAMID)( 8389 << 14)
+#define MC_XF_ROI_TOI_FSR_NextX                  (MCPARAMID)( 8390 << 14)
+#define MC_AWB_ROI_TOI_EXT_RightX_Px             (MCPARAMID)( 8391 << 14)
+#define MC_AWB_ROI_TOI_EXT_NextY_Ln              (MCPARAMID)( 8392 << 14)
+#define MC_AWB_ROI_TOI_FSR_NextX                 (MCPARAMID)( 8393 << 14)
+#define MC_XF_ROI_TOI_EXT_NextX_Px               (MCPARAMID)( 8394 << 14)
+#define MC_AWB_ROI_TOI_EXT_NextX_Px              (MCPARAMID)( 8395 << 14)
+#define MC_LiveSimRun                            (MCPARAMID)( 8396 << 14)
+#define MC_LiveSimRun_LIVE                         1
+#define MC_LiveSimRun_SIM                          2
+#define MC_AWB_ROI_TOI_REF_EndX_Px               (MCPARAMID)( 8397 << 14)
+#define MC_TOI_XFR_Granularity_IPx               (MCPARAMID)( 8398 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgX_IPx               (MCPARAMID)( 8399 << 14)
+#define MC_XF_ROI_TOI_XFR_NextX_IPx              (MCPARAMID)( 8400 << 14)
+#define MC_XF_ROI_TOI_XFR_Width_IPx              (MCPARAMID)( 8401 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeX_IPx          (MCPARAMID)( 8402 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetX_IPx        (MCPARAMID)( 8403 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetX_IPx      (MCPARAMID)( 8404 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgY_ILn               (MCPARAMID)( 8405 << 14)
+#define MC_XF_ROI_TOI_XFR_NextY_ILn              (MCPARAMID)( 8406 << 14)
+#define MC_XF_ROI_TOI_XFR_Height_ILn             (MCPARAMID)( 8407 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeY_ILn          (MCPARAMID)( 8408 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetY_ILn        (MCPARAMID)( 8409 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetY_ILn      (MCPARAMID)( 8410 << 14)
+#define MC_ImageYStep_ILn                        (MCPARAMID)( 8411 << 14)
+#define MC_OutputFormatterConfig_RGB10_10_10      45
+#define MC_OutputFormatterConfig_RGB10_12_10      46
+#define MC_ColorFormat_RGB10_10_10               105
+#define MC_ColorFormat_RGB10_12_10               106
+#define MC_AWSizeX_Px                            (MCPARAMID)( 8412 << 14)
+#define MC_AWSizeY_Ln                            (MCPARAMID)( 8413 << 14)
+#define MC_AWColorRegistrationX                  (MCPARAMID)( 8414 << 14)
+#define MC_AWColorRegistrationY                  (MCPARAMID)( 8415 << 14)
+#define MC_AWPlaneSizeX                          (MCPARAMID)( 8416 << 14)
+#define MC_GWOrgX_Px                             (MCPARAMID)( 8417 << 14)
+#define MC_GWOrgY_Ln                             (MCPARAMID)( 8418 << 14)
+#define MC_ImageSizeX_MinBound                   (MCPARAMID)( 8419 << 14)
+#define MC_ImageSizeX_MaxBound                   (MCPARAMID)( 8420 << 14)
+#define MC_ImageSizeY_MinBound                   (MCPARAMID)( 8421 << 14)
+#define MC_ImageSizeY_MaxBound                   (MCPARAMID)( 8422 << 14)
+#define MC_Bidon                                 (MCPARAMID)( 8423 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd0               (MCPARAMID)( 8424 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd1               (MCPARAMID)( 8425 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd2               (MCPARAMID)( 8426 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd3               (MCPARAMID)( 8427 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd4               (MCPARAMID)( 8428 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd5               (MCPARAMID)( 8429 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd6               (MCPARAMID)( 8430 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd7               (MCPARAMID)( 8431 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd8               (MCPARAMID)( 8432 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd9               (MCPARAMID)( 8433 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd10              (MCPARAMID)( 8434 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd11              (MCPARAMID)( 8435 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd12              (MCPARAMID)( 8436 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd13              (MCPARAMID)( 8437 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd14              (MCPARAMID)( 8438 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd15              (MCPARAMID)( 8439 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd16              (MCPARAMID)( 8440 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd17              (MCPARAMID)( 8441 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd18              (MCPARAMID)( 8442 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd19              (MCPARAMID)( 8443 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd20              (MCPARAMID)( 8444 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd21              (MCPARAMID)( 8445 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd22              (MCPARAMID)( 8446 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd23              (MCPARAMID)( 8447 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd24              (MCPARAMID)( 8448 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd25              (MCPARAMID)( 8449 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd26              (MCPARAMID)( 8450 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd27              (MCPARAMID)( 8451 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd28              (MCPARAMID)( 8452 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd29              (MCPARAMID)( 8453 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd30              (MCPARAMID)( 8454 << 14)
+#define MC_ROIName_WRF_TOI_EndAdd31              (MCPARAMID)( 8455 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd0                (MCPARAMID)( 8456 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd1                (MCPARAMID)( 8457 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd2                (MCPARAMID)( 8458 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd3                (MCPARAMID)( 8459 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd4                (MCPARAMID)( 8460 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd5                (MCPARAMID)( 8461 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd6                (MCPARAMID)( 8462 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd7                (MCPARAMID)( 8463 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd8                (MCPARAMID)( 8464 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd9                (MCPARAMID)( 8465 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd10               (MCPARAMID)( 8466 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd11               (MCPARAMID)( 8467 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd12               (MCPARAMID)( 8468 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd13               (MCPARAMID)( 8469 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd14               (MCPARAMID)( 8470 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd15               (MCPARAMID)( 8471 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd16               (MCPARAMID)( 8472 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd17               (MCPARAMID)( 8473 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd18               (MCPARAMID)( 8474 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd19               (MCPARAMID)( 8475 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd20               (MCPARAMID)( 8476 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd21               (MCPARAMID)( 8477 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd22               (MCPARAMID)( 8478 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd23               (MCPARAMID)( 8479 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd24               (MCPARAMID)( 8480 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd25               (MCPARAMID)( 8481 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd26               (MCPARAMID)( 8482 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd27               (MCPARAMID)( 8483 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd28               (MCPARAMID)( 8484 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd29               (MCPARAMID)( 8485 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd30               (MCPARAMID)( 8486 << 14)
+#define MC_XF_ROI_WRF_TOI_NxtAdd31               (MCPARAMID)( 8487 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd0               (MCPARAMID)( 8488 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd1               (MCPARAMID)( 8489 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd2               (MCPARAMID)( 8490 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd3               (MCPARAMID)( 8491 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd4               (MCPARAMID)( 8492 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd5               (MCPARAMID)( 8493 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd6               (MCPARAMID)( 8494 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd7               (MCPARAMID)( 8495 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd8               (MCPARAMID)( 8496 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd9               (MCPARAMID)( 8497 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd10              (MCPARAMID)( 8498 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd11              (MCPARAMID)( 8499 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd12              (MCPARAMID)( 8500 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd13              (MCPARAMID)( 8501 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd14              (MCPARAMID)( 8502 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd15              (MCPARAMID)( 8503 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd16              (MCPARAMID)( 8504 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd17              (MCPARAMID)( 8505 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd18              (MCPARAMID)( 8506 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd19              (MCPARAMID)( 8507 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd20              (MCPARAMID)( 8508 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd21              (MCPARAMID)( 8509 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd22              (MCPARAMID)( 8510 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd23              (MCPARAMID)( 8511 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd24              (MCPARAMID)( 8512 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd25              (MCPARAMID)( 8513 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd26              (MCPARAMID)( 8514 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd27              (MCPARAMID)( 8515 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd28              (MCPARAMID)( 8516 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd29              (MCPARAMID)( 8517 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd30              (MCPARAMID)( 8518 << 14)
+#define MC_AWB_ROI_WRF_TOI_NxtAdd31              (MCPARAMID)( 8519 << 14)
+#define MC_XF_ROI_WRF_XferSizeM10_xx_            (MCPARAMID)( 8520 << 14)
+#define MC_XF_ROI_WRF_XferSizeM11_xx_            (MCPARAMID)( 8521 << 14)
+#define MC_XF_ROI_WRF_XferSizeM12_xx_            (MCPARAMID)( 8522 << 14)
+#define MC_XF_ROI_WRF_XferSizeM13_xx_            (MCPARAMID)( 8523 << 14)
+#define MC_XF_ROI_XFR_OrgX_IPx                   (MCPARAMID)( 8524 << 14)
+#define MC_XF_ROI_XFR_NextX_IPx                  (MCPARAMID)( 8525 << 14)
+#define MC__Effective_Window_OrgX_Px             (MCPARAMID)( 8526 << 14)
+#define MC_OffsetX_Trim                          (MCPARAMID)( 8527 << 14)
+#define MC_Test_Error                            (MCPARAMID)( 8528 << 14)
+#define MC_Test_Overrun                          (MCPARAMID)( 8529 << 14)
+#define MC_OffsetX_Effective_Px                  (MCPARAMID)( 8530 << 14)
+#define MC_Window_OrgX_Effective_Px              (MCPARAMID)( 8531 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration32        (MCPARAMID)( 8532 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration32_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration32_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration32_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration32_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd32               (MCPARAMID)( 8533 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration33        (MCPARAMID)( 8534 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration33_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration33_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration33_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration33_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd33               (MCPARAMID)( 8535 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration34        (MCPARAMID)( 8536 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration34_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration34_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration34_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration34_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd34               (MCPARAMID)( 8537 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration35        (MCPARAMID)( 8538 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration35_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration35_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration35_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration35_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd35               (MCPARAMID)( 8539 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration36        (MCPARAMID)( 8540 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration36_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration36_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration36_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration36_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd36               (MCPARAMID)( 8541 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration37        (MCPARAMID)( 8542 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration37_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration37_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration37_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration37_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd37               (MCPARAMID)( 8543 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration38        (MCPARAMID)( 8544 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration38_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration38_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration38_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration38_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd38               (MCPARAMID)( 8545 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration39        (MCPARAMID)( 8546 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration39_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration39_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration39_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration39_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd39               (MCPARAMID)( 8547 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration40        (MCPARAMID)( 8548 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration40_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration40_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration40_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration40_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd40               (MCPARAMID)( 8549 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration41        (MCPARAMID)( 8550 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration41_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration41_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration41_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration41_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd41               (MCPARAMID)( 8551 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration42        (MCPARAMID)( 8552 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration42_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration42_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration42_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration42_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd42               (MCPARAMID)( 8553 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration43        (MCPARAMID)( 8554 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration43_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration43_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration43_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration43_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd43               (MCPARAMID)( 8555 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration44        (MCPARAMID)( 8556 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration44_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration44_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration44_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration44_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd44               (MCPARAMID)( 8557 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration45        (MCPARAMID)( 8558 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration45_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration45_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration45_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration45_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd45               (MCPARAMID)( 8559 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration46        (MCPARAMID)( 8560 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration46_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration46_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration46_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration46_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd46               (MCPARAMID)( 8561 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration47        (MCPARAMID)( 8562 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration47_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration47_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration47_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration47_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd47               (MCPARAMID)( 8563 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration48        (MCPARAMID)( 8564 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration48_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration48_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration48_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration48_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd48               (MCPARAMID)( 8565 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration49        (MCPARAMID)( 8566 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration49_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration49_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration49_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration49_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd49               (MCPARAMID)( 8567 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration50        (MCPARAMID)( 8568 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration50_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration50_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration50_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration50_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd50               (MCPARAMID)( 8569 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration51        (MCPARAMID)( 8570 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration51_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration51_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration51_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration51_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd51               (MCPARAMID)( 8571 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration52        (MCPARAMID)( 8572 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration52_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration52_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration52_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration52_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd52               (MCPARAMID)( 8573 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration53        (MCPARAMID)( 8574 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration53_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration53_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration53_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration53_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd53               (MCPARAMID)( 8575 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration54        (MCPARAMID)( 8576 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration54_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration54_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration54_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration54_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd54               (MCPARAMID)( 8577 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration55        (MCPARAMID)( 8578 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration55_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration55_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration55_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration55_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd55               (MCPARAMID)( 8579 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration56        (MCPARAMID)( 8580 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration56_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration56_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration56_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration56_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd56               (MCPARAMID)( 8581 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration57        (MCPARAMID)( 8582 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration57_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration57_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration57_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration57_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd57               (MCPARAMID)( 8583 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration58        (MCPARAMID)( 8584 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration58_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration58_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration58_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration58_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd58               (MCPARAMID)( 8585 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration59        (MCPARAMID)( 8586 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration59_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration59_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration59_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration59_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd59               (MCPARAMID)( 8587 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration60        (MCPARAMID)( 8588 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration60_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration60_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration60_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration60_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd60               (MCPARAMID)( 8589 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration61        (MCPARAMID)( 8590 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration61_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration61_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration61_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration61_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd61               (MCPARAMID)( 8591 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration62        (MCPARAMID)( 8592 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration62_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration62_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration62_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration62_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd62               (MCPARAMID)( 8593 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration63        (MCPARAMID)( 8594 << 14)
+#define MC_XF_ROI_WRF_ColorRegistration63_GB       1
+#define MC_XF_ROI_WRF_ColorRegistration63_BG       2
+#define MC_XF_ROI_WRF_ColorRegistration63_RG       3
+#define MC_XF_ROI_WRF_ColorRegistration63_GR       4
+#define MC_XF_ROI_WRF_TOI_NxtAdd63               (MCPARAMID)( 8595 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration32       (MCPARAMID)( 8596 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration32_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration32_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration32_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration32_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd32              (MCPARAMID)( 8597 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration33       (MCPARAMID)( 8598 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration33_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration33_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration33_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration33_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd33              (MCPARAMID)( 8599 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration34       (MCPARAMID)( 8600 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration34_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration34_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration34_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration34_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd34              (MCPARAMID)( 8601 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration35       (MCPARAMID)( 8602 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration35_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration35_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration35_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration35_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd35              (MCPARAMID)( 8603 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration36       (MCPARAMID)( 8604 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration36_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration36_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration36_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration36_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd36              (MCPARAMID)( 8605 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration37       (MCPARAMID)( 8606 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration37_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration37_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration37_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration37_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd37              (MCPARAMID)( 8607 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration38       (MCPARAMID)( 8608 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration38_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration38_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration38_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration38_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd38              (MCPARAMID)( 8609 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration39       (MCPARAMID)( 8610 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration39_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration39_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration39_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration39_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd39              (MCPARAMID)( 8611 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration40       (MCPARAMID)( 8612 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration40_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration40_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration40_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration40_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd40              (MCPARAMID)( 8613 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration41       (MCPARAMID)( 8614 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration41_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration41_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration41_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration41_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd41              (MCPARAMID)( 8615 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration42       (MCPARAMID)( 8616 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration42_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration42_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration42_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration42_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd42              (MCPARAMID)( 8617 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration43       (MCPARAMID)( 8618 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration43_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration43_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration43_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration43_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd43              (MCPARAMID)( 8619 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration44       (MCPARAMID)( 8620 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration44_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration44_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration44_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration44_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd44              (MCPARAMID)( 8621 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration45       (MCPARAMID)( 8622 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration45_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration45_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration45_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration45_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd45              (MCPARAMID)( 8623 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration46       (MCPARAMID)( 8624 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration46_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration46_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration46_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration46_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd46              (MCPARAMID)( 8625 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration47       (MCPARAMID)( 8626 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration47_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration47_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration47_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration47_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd47              (MCPARAMID)( 8627 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration48       (MCPARAMID)( 8628 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration48_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration48_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration48_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration48_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd48              (MCPARAMID)( 8629 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration49       (MCPARAMID)( 8630 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration49_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration49_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration49_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration49_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd49              (MCPARAMID)( 8631 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration50       (MCPARAMID)( 8632 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration50_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration50_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration50_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration50_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd50              (MCPARAMID)( 8633 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration51       (MCPARAMID)( 8634 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration51_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration51_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration51_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration51_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd51              (MCPARAMID)( 8635 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration52       (MCPARAMID)( 8636 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration52_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration52_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration52_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration52_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd52              (MCPARAMID)( 8637 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration53       (MCPARAMID)( 8638 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration53_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration53_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration53_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration53_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd53              (MCPARAMID)( 8639 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration54       (MCPARAMID)( 8640 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration54_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration54_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration54_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration54_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd54              (MCPARAMID)( 8641 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration55       (MCPARAMID)( 8642 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration55_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration55_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration55_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration55_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd55              (MCPARAMID)( 8643 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration56       (MCPARAMID)( 8644 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration56_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration56_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration56_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration56_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd56              (MCPARAMID)( 8645 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration57       (MCPARAMID)( 8646 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration57_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration57_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration57_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration57_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd57              (MCPARAMID)( 8647 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration58       (MCPARAMID)( 8648 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration58_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration58_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration58_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration58_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd58              (MCPARAMID)( 8649 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration59       (MCPARAMID)( 8650 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration59_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration59_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration59_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration59_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd59              (MCPARAMID)( 8651 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration60       (MCPARAMID)( 8652 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration60_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration60_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration60_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration60_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd60              (MCPARAMID)( 8653 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration61       (MCPARAMID)( 8654 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration61_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration61_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration61_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration61_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd61              (MCPARAMID)( 8655 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration62       (MCPARAMID)( 8656 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration62_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration62_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration62_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration62_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd62              (MCPARAMID)( 8657 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration63       (MCPARAMID)( 8658 << 14)
+#define MC_AWB_ROI_WRF_ColorRegistration63_GB      1
+#define MC_AWB_ROI_WRF_ColorRegistration63_BG      2
+#define MC_AWB_ROI_WRF_ColorRegistration63_RG      3
+#define MC_AWB_ROI_WRF_ColorRegistration63_GR      4
+#define MC_AWB_ROI_WRF_TOI_NxtAdd63              (MCPARAMID)( 8659 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin32          (MCPARAMID)( 8660 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width32               (MCPARAMID)( 8661 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin33          (MCPARAMID)( 8662 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width33               (MCPARAMID)( 8663 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin34          (MCPARAMID)( 8664 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width34               (MCPARAMID)( 8665 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin35          (MCPARAMID)( 8666 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width35               (MCPARAMID)( 8667 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin36          (MCPARAMID)( 8668 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width36               (MCPARAMID)( 8669 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin37          (MCPARAMID)( 8670 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width37               (MCPARAMID)( 8671 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin38          (MCPARAMID)( 8672 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width38               (MCPARAMID)( 8673 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin39          (MCPARAMID)( 8674 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width39               (MCPARAMID)( 8675 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin40          (MCPARAMID)( 8676 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width40               (MCPARAMID)( 8677 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin41          (MCPARAMID)( 8678 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width41               (MCPARAMID)( 8679 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin42          (MCPARAMID)( 8680 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width42               (MCPARAMID)( 8681 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin43          (MCPARAMID)( 8682 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width43               (MCPARAMID)( 8683 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin44          (MCPARAMID)( 8684 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width44               (MCPARAMID)( 8685 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin45          (MCPARAMID)( 8686 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width45               (MCPARAMID)( 8687 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin46          (MCPARAMID)( 8688 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width46               (MCPARAMID)( 8689 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin47          (MCPARAMID)( 8690 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width47               (MCPARAMID)( 8691 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin48          (MCPARAMID)( 8692 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width48               (MCPARAMID)( 8693 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin49          (MCPARAMID)( 8694 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width49               (MCPARAMID)( 8695 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin50          (MCPARAMID)( 8696 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width50               (MCPARAMID)( 8697 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin51          (MCPARAMID)( 8698 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width51               (MCPARAMID)( 8699 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin52          (MCPARAMID)( 8700 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width52               (MCPARAMID)( 8701 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin53          (MCPARAMID)( 8702 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width53               (MCPARAMID)( 8703 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin54          (MCPARAMID)( 8704 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width54               (MCPARAMID)( 8705 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin55          (MCPARAMID)( 8706 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width55               (MCPARAMID)( 8707 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin56          (MCPARAMID)( 8708 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width56               (MCPARAMID)( 8709 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin57          (MCPARAMID)( 8710 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width57               (MCPARAMID)( 8711 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin58          (MCPARAMID)( 8712 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width58               (MCPARAMID)( 8713 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin59          (MCPARAMID)( 8714 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width59               (MCPARAMID)( 8715 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin60          (MCPARAMID)( 8716 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width60               (MCPARAMID)( 8717 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin61          (MCPARAMID)( 8718 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width61               (MCPARAMID)( 8719 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin62          (MCPARAMID)( 8720 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width62               (MCPARAMID)( 8721 << 14)
+#define MC_AWB_ROI_WRF_AWB_LeftMargin63          (MCPARAMID)( 8722 << 14)
+#define MC_AWB_ROI_WRF_AWB_Width63               (MCPARAMID)( 8723 << 14)
+#define MC_AWSizeX_fPx                           (MCPARAMID)( 8724 << 14)
+#define MC_GWSizeX_fPx                           (MCPARAMID)( 8725 << 14)
+#define MC_GWOrgX_fPx                            (MCPARAMID)( 8726 << 14)
+#define MC_TOI_USR_MinWidth_fPx                  (MCPARAMID)( 8727 << 14)
+#define MC_TOI_USR_MaxWidth_fPx                  (MCPARAMID)( 8728 << 14)
+#define MC_XF_ROI_TOI_USR_Width_fPx              (MCPARAMID)( 8729 << 14)
+#define MC_XF_ROI_TOI_USR_OrgX_fPx               (MCPARAMID)( 8730 << 14)
+#define MC_XF_ROI_TOI_REF_OrgX_fPx               (MCPARAMID)( 8731 << 14)
+#define MC_XF_ROI_TOI_REF_Width_fPx              (MCPARAMID)( 8732 << 14)
+#define MC_XF_ROI_TOI_EXT_OrgX_fPx               (MCPARAMID)( 8733 << 14)
+#define MC_XF_ROI_TOI_EXT_Width_fPx              (MCPARAMID)( 8734 << 14)
+#define MC_XF_ROI_TOI_EXT_NextX_fPx              (MCPARAMID)( 8735 << 14)
+#define MC_XF_ROI_TOI_FSR_OrgX_fPx               (MCPARAMID)( 8736 << 14)
+#define MC_AWB_ROI_TOI_USR_Width_fPx             (MCPARAMID)( 8737 << 14)
+#define MC_AWB_ROI_TOI_USR_OrgX_fPx              (MCPARAMID)( 8738 << 14)
+#define MC_AWB_ROI_TOI_REF_OrgX_fPx              (MCPARAMID)( 8739 << 14)
+#define MC_AWB_ROI_TOI_REF_EndX_fPx              (MCPARAMID)( 8740 << 14)
+#define MC_AWB_ROI_TOI_REF_Width_fPx             (MCPARAMID)( 8741 << 14)
+#define MC_AWB_ROI_TOI_EXT_OrgX_fPx              (MCPARAMID)( 8742 << 14)
+#define MC_AWB_ROI_TOI_EXT_Width_fPx             (MCPARAMID)( 8743 << 14)
+#define MC_AWB_ROI_TOI_EXT_NextX_fPx             (MCPARAMID)( 8744 << 14)
+#define MC_AWB_ROI_TOI_FSR_OrgX_fPx              (MCPARAMID)( 8745 << 14)
+#define MC_TOI_XFR_Granularity_fsPx              (MCPARAMID)( 8746 << 14)
+#define MC_XF_ROI_XFR_OrgX_fsPx                  (MCPARAMID)( 8747 << 14)
+#define MC_XF_ROI_XFR_NextX_fsPx                 (MCPARAMID)( 8748 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgX_fsPx              (MCPARAMID)( 8749 << 14)
+#define MC_XF_ROI_TOI_XFR_NextX_fsPx             (MCPARAMID)( 8750 << 14)
+#define MC_XF_ROI_TOI_XFR_Width_fsPx             (MCPARAMID)( 8751 << 14)
+#define MC_XF_ROI_TOI_XFR_OrgY_sLn               (MCPARAMID)( 8752 << 14)
+#define MC_XF_ROI_TOI_XFR_NextY_sLn              (MCPARAMID)( 8753 << 14)
+#define MC_XF_ROI_TOI_XFR_Height_sLn             (MCPARAMID)( 8754 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeX_fsPx         (MCPARAMID)( 8755 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetX_fsPx       (MCPARAMID)( 8756 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetX_fsPx     (MCPARAMID)( 8757 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoSizeY_sLn          (MCPARAMID)( 8758 << 14)
+#define MC_XF_ROI_TOI_DMA_FifoOffsetY_sLn        (MCPARAMID)( 8759 << 14)
+#define MC_XF_ROI_TOI_DMA_BufferOffsetY_sLn      (MCPARAMID)( 8760 << 14)
+#define MC_WindowOrgX_Px                         (MCPARAMID)( 8761 << 14)
+#define MC_WindowOrgX_Max_Px                     (MCPARAMID)( 8762 << 14)
+#define MC_WindowEndX_Px                         (MCPARAMID)( 8763 << 14)
+#define MC_WindowOrgX_fPx                        (MCPARAMID)( 8764 << 14)
+#define MC_WindowOrgY_Ln                         (MCPARAMID)( 8765 << 14)
+#define MC_WindowOrgY_Max_Ln                     (MCPARAMID)( 8766 << 14)
+#define MC_ImageColorRegistration_Filter         (MCPARAMID)( 8767 << 14)
+#define MC_WindowX_Effective_Px                  (MCPARAMID)( 8768 << 14)
+#define MC_WindowY_Effective_Ln                  (MCPARAMID)( 8769 << 14)
+#define MC_WindowX_Px_Max                        (MCPARAMID)( 8770 << 14)
+#define MC_WindowY_Ln_Max                        (MCPARAMID)( 8771 << 14)
+#define MC_WBO_OrgX_fPx                          (MCPARAMID)( 8772 << 14)
+#define MC_GrabberError_Number_31                (MCPARAMID)( 8773 << 14)
+#define MC_GrabberError_Number_30                (MCPARAMID)( 8774 << 14)
+#define MC_GrabberError_Number_29                (MCPARAMID)( 8775 << 14)
+#define MC_GrabberError_Number_28                (MCPARAMID)( 8776 << 14)
+#define MC_GrabberError_Number_27                (MCPARAMID)( 8777 << 14)
+#define MC_GrabberError_Number_26                (MCPARAMID)( 8778 << 14)
+#define MC_GrabberError_Number_25                (MCPARAMID)( 8779 << 14)
+#define MC_GrabberError_Number_24                (MCPARAMID)( 8780 << 14)
+#define MC_GrabberError_Number_23                (MCPARAMID)( 8781 << 14)
+#define MC_GrabberError_Number_22                (MCPARAMID)( 8782 << 14)
+#define MC_GrabberError_Number_21                (MCPARAMID)( 8783 << 14)
+#define MC_GrabberError_Number_20                (MCPARAMID)( 8784 << 14)
+#define MC_GrabberError_VdmaIncoherency          (MCPARAMID)( 8785 << 14)
+#define MC_GrabberError_Number_18                (MCPARAMID)( 8786 << 14)
+#define MC_GrabberError_Number_17                (MCPARAMID)( 8787 << 14)
+#define MC_GrabberError_IntractionDpFifo         (MCPARAMID)( 8788 << 14)
+#define MC_GrabberError_Number_15                (MCPARAMID)( 8789 << 14)
+#define MC_GrabberError_Number_14                (MCPARAMID)( 8790 << 14)
+#define MC_GrabberError_Number_13                (MCPARAMID)( 8791 << 14)
+#define MC_GrabberError_Number_12                (MCPARAMID)( 8792 << 14)
+#define MC_GrabberError_Number_11                (MCPARAMID)( 8793 << 14)
+#define MC_GrabberError_Number_10                (MCPARAMID)( 8794 << 14)
+#define MC_GrabberError_Number_9                 (MCPARAMID)( 8795 << 14)
+#define MC_GrabberError_Number_8                 (MCPARAMID)( 8796 << 14)
+#define MC_GrabberError_Number_7                 (MCPARAMID)( 8797 << 14)
+#define MC_GrabberError_Number_6                 (MCPARAMID)( 8798 << 14)
+#define MC_GrabberError_Number_5                 (MCPARAMID)( 8799 << 14)
+#define MC_GrabberError_BackEnd4                 (MCPARAMID)( 8800 << 14)
+#define MC_GrabberError_BackEnd3                 (MCPARAMID)( 8801 << 14)
+#define MC_GrabberError_BackEnd2                 (MCPARAMID)( 8802 << 14)
+#define MC_GrabberError_BackEnd1                 (MCPARAMID)( 8803 << 14)
+#define MC_GrabberOverrun_Number_31              (MCPARAMID)( 8804 << 14)
+#define MC_GrabberOverrun_Number_30              (MCPARAMID)( 8805 << 14)
+#define MC_GrabberOverrun_Number_29              (MCPARAMID)( 8806 << 14)
+#define MC_GrabberOverrun_Number_28              (MCPARAMID)( 8807 << 14)
+#define MC_GrabberOverrun_Number_27              (MCPARAMID)( 8808 << 14)
+#define MC_GrabberOverrun_Number_26              (MCPARAMID)( 8809 << 14)
+#define MC_GrabberOverrun_Number_25              (MCPARAMID)( 8810 << 14)
+#define MC_GrabberOverrun_Number_24              (MCPARAMID)( 8811 << 14)
+#define MC_GrabberOverrun_Number_23              (MCPARAMID)( 8812 << 14)
+#define MC_GrabberOverrun_Number_22              (MCPARAMID)( 8813 << 14)
+#define MC_GrabberOverrun_Number_21              (MCPARAMID)( 8814 << 14)
+#define MC_GrabberOverrun_Number_20              (MCPARAMID)( 8815 << 14)
+#define MC_GrabberOverrun_Number_19              (MCPARAMID)( 8816 << 14)
+#define MC_GrabberOverrun_Number_18              (MCPARAMID)( 8817 << 14)
+#define MC_GrabberOverrun_Number_17              (MCPARAMID)( 8818 << 14)
+#define MC_GrabberOverrun_Number_16              (MCPARAMID)( 8819 << 14)
+#define MC_GrabberOverrun_Number_15              (MCPARAMID)( 8820 << 14)
+#define MC_GrabberOverrun_Number_14              (MCPARAMID)( 8821 << 14)
+#define MC_GrabberOverrun_Number_13              (MCPARAMID)( 8822 << 14)
+#define MC_GrabberOverrun_Number_12              (MCPARAMID)( 8823 << 14)
+#define MC_GrabberOverrun_Number_11              (MCPARAMID)( 8824 << 14)
+#define MC_GrabberOverrun_Number_10              (MCPARAMID)( 8825 << 14)
+#define MC_GrabberOverrun_Number_9               (MCPARAMID)( 8826 << 14)
+#define MC_GrabberOverrun_Number_8               (MCPARAMID)( 8827 << 14)
+#define MC_GrabberOverrun_Acquisition            (MCPARAMID)( 8828 << 14)
+#define MC_GrabberOverrun_FrameTrigger           (MCPARAMID)( 8829 << 14)
+#define MC_GrabberOverrun_LineTrigger            (MCPARAMID)( 8830 << 14)
+#define MC_GrabberOverrun_Number_4               (MCPARAMID)( 8831 << 14)
+#define MC_GrabberOverrun_Number_3               (MCPARAMID)( 8832 << 14)
+#define MC_GrabberOverrun_Number_2               (MCPARAMID)( 8833 << 14)
+#define MC_GrabberOverrun_Number_1               (MCPARAMID)( 8834 << 14)
+#define MC_GrabberError_Number_4                 (MCPARAMID)( 8835 << 14)
+#define MC_GrabberError_Number_3                 (MCPARAMID)( 8836 << 14)
+#define MC_GrabberError_Number_2                 (MCPARAMID)( 8837 << 14)
+#define MC_GrabberError_Number_1                 (MCPARAMID)( 8838 << 14)
+#define MC_GrabberError_DivideBy0                (MCPARAMID)( 8839 << 14)
+#define MC_GrabberError_GainError                (MCPARAMID)( 8840 << 14)
+#define MC_GrabberError_GainOutOfSpec            (MCPARAMID)( 8841 << 14)
+#define MC_GrabberOverrun_GainOutOfSpec          (MCPARAMID)( 8842 << 14)
+#define MC_CPC_PPSB_Scaling                      (MCPARAMID)( 8843 << 14)
+#define MC_CPC_PPSB_Scaling_ON                     1
+#define MC_CPC_PPSB_Scaling_OFF                    2
+#define MC_GrabberError_PPSBincoherency          (MCPARAMID)( 8844 << 14)
+#define MC_GrabberError_PPSBunderflow            (MCPARAMID)( 8845 << 14)
+#define MC_GrabberError_PPSBoverflow             (MCPARAMID)( 8846 << 14)
+#define MC_GrabberError_ScalerIncoherency        (MCPARAMID)( 8847 << 14)
+#define MC_GrabberError_ScalerUnderflow          (MCPARAMID)( 8848 << 14)
+#define MC_GrabberError_ScalerOverflow           (MCPARAMID)( 8849 << 14)
+#define MC_GrabberError_PPOFincoherency          (MCPARAMID)( 8850 << 14)
+#define MC_GrabberError_PPOFoverflow             (MCPARAMID)( 8851 << 14)
+#define MC_GrabberError_PPOFunderflow            (MCPARAMID)( 8852 << 14)
+#define MC_Wic1_StartFrameAddress_byte           (MCPARAMID)( 8853 << 14)
+#define MC_Wic2_StartFrameAddress_byte           (MCPARAMID)( 8854 << 14)
+#define MC_Wic3_StartFrameAddress_byte           (MCPARAMID)( 8855 << 14)
+#define MC_Wic4_StartFrameAddress_byte           (MCPARAMID)( 8856 << 14)
+#define MC_Wic5_StartFrameAddress_byte           (MCPARAMID)( 8857 << 14)
+#define MC_Wic6_StartFrameAddress_byte           (MCPARAMID)( 8858 << 14)
+#define MC_Wic7_StartFrameAddress_byte           (MCPARAMID)( 8859 << 14)
+#define MC_ImageSizeX_Effective_Px               (MCPARAMID)( 8860 << 14)
+#define MC_XF_ROI_TOI_EXT_FBaligned_OrgX         (MCPARAMID)( 8861 << 14)
+#define MC_XF_ROI_TOI_EXT_FBaligned_Width        (MCPARAMID)( 8862 << 14)
+#define MC_XF_ROI_TOI_EXT_FBaligned_NextX        (MCPARAMID)( 8863 << 14)
+#define MC_AWB_ROI_TOI_EXT_FBaligned_OrgX        (MCPARAMID)( 8864 << 14)
+#define MC_AWB_ROI_TOI_EXT_FBaligned_Width       (MCPARAMID)( 8865 << 14)
+#define MC_AWB_ROI_TOI_EXT_FBaligned_NextX       (MCPARAMID)( 8866 << 14)
+#define MC_XF_ROI_XF_ROI_TOI_EXT_FBaligned_OrgX  (MCPARAMID)( 8867 << 14)
+#define MC_XF_ROI_XF_ROI_TOI_EXT_FBaligned_Width (MCPARAMID)( 8868 << 14)
+#define MC_XF_ROI_XF_ROI_TOI_EXT_FBaligned_NextX (MCPARAMID)( 8869 << 14)
+#define MC_XF_ROI_XF_ROI_TOI_EXT_FBaligned_LeftMargin (MCPARAMID)( 8870 << 14)
+#define MC_AWB_ROI_XF_ROI_TOI_EXT_FBaligned_OrgX (MCPARAMID)( 8871 << 14)
+#define MC_AWB_ROI_XF_ROI_TOI_EXT_FBaligned_Width (MCPARAMID)( 8872 << 14)
+#define MC_AWB_ROI_XF_ROI_TOI_EXT_FBaligned_NextX (MCPARAMID)( 8873 << 14)
+#define MC_AWB_ROI_XF_ROI_TOI_EXT_FBaligned_LeftMargin (MCPARAMID)( 8874 << 14)
+#define MC_XF_ROI_TOI_EXT_FBaligned_LeftMargin   (MCPARAMID)( 8875 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin0             (MCPARAMID)( 8876 << 14)
+#define MC_XF_ROI_WRF_XF_Width0                  (MCPARAMID)( 8877 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin1             (MCPARAMID)( 8878 << 14)
+#define MC_XF_ROI_WRF_XF_Width1                  (MCPARAMID)( 8879 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin2             (MCPARAMID)( 8880 << 14)
+#define MC_XF_ROI_WRF_XF_Width2                  (MCPARAMID)( 8881 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin3             (MCPARAMID)( 8882 << 14)
+#define MC_XF_ROI_WRF_XF_Width3                  (MCPARAMID)( 8883 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin4             (MCPARAMID)( 8884 << 14)
+#define MC_XF_ROI_WRF_XF_Width4                  (MCPARAMID)( 8885 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin5             (MCPARAMID)( 8886 << 14)
+#define MC_XF_ROI_WRF_XF_Width5                  (MCPARAMID)( 8887 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin6             (MCPARAMID)( 8888 << 14)
+#define MC_XF_ROI_WRF_XF_Width6                  (MCPARAMID)( 8889 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin7             (MCPARAMID)( 8890 << 14)
+#define MC_XF_ROI_WRF_XF_Width7                  (MCPARAMID)( 8891 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin8             (MCPARAMID)( 8892 << 14)
+#define MC_XF_ROI_WRF_XF_Width8                  (MCPARAMID)( 8893 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin9             (MCPARAMID)( 8894 << 14)
+#define MC_XF_ROI_WRF_XF_Width9                  (MCPARAMID)( 8895 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin10            (MCPARAMID)( 8896 << 14)
+#define MC_XF_ROI_WRF_XF_Width10                 (MCPARAMID)( 8897 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin11            (MCPARAMID)( 8898 << 14)
+#define MC_XF_ROI_WRF_XF_Width11                 (MCPARAMID)( 8899 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin12            (MCPARAMID)( 8900 << 14)
+#define MC_XF_ROI_WRF_XF_Width12                 (MCPARAMID)( 8901 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin13            (MCPARAMID)( 8902 << 14)
+#define MC_XF_ROI_WRF_XF_Width13                 (MCPARAMID)( 8903 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin14            (MCPARAMID)( 8904 << 14)
+#define MC_XF_ROI_WRF_XF_Width14                 (MCPARAMID)( 8905 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin15            (MCPARAMID)( 8906 << 14)
+#define MC_XF_ROI_WRF_XF_Width15                 (MCPARAMID)( 8907 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin16            (MCPARAMID)( 8908 << 14)
+#define MC_XF_ROI_WRF_XF_Width16                 (MCPARAMID)( 8909 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin17            (MCPARAMID)( 8910 << 14)
+#define MC_XF_ROI_WRF_XF_Width17                 (MCPARAMID)( 8911 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin18            (MCPARAMID)( 8912 << 14)
+#define MC_XF_ROI_WRF_XF_Width18                 (MCPARAMID)( 8913 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin19            (MCPARAMID)( 8914 << 14)
+#define MC_XF_ROI_WRF_XF_Width19                 (MCPARAMID)( 8915 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin20            (MCPARAMID)( 8916 << 14)
+#define MC_XF_ROI_WRF_XF_Width20                 (MCPARAMID)( 8917 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin21            (MCPARAMID)( 8918 << 14)
+#define MC_XF_ROI_WRF_XF_Width21                 (MCPARAMID)( 8919 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin22            (MCPARAMID)( 8920 << 14)
+#define MC_XF_ROI_WRF_XF_Width22                 (MCPARAMID)( 8921 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin23            (MCPARAMID)( 8922 << 14)
+#define MC_XF_ROI_WRF_XF_Width23                 (MCPARAMID)( 8923 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin24            (MCPARAMID)( 8924 << 14)
+#define MC_XF_ROI_WRF_XF_Width24                 (MCPARAMID)( 8925 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin25            (MCPARAMID)( 8926 << 14)
+#define MC_XF_ROI_WRF_XF_Width25                 (MCPARAMID)( 8927 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin26            (MCPARAMID)( 8928 << 14)
+#define MC_XF_ROI_WRF_XF_Width26                 (MCPARAMID)( 8929 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin27            (MCPARAMID)( 8930 << 14)
+#define MC_XF_ROI_WRF_XF_Width27                 (MCPARAMID)( 8931 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin28            (MCPARAMID)( 8932 << 14)
+#define MC_XF_ROI_WRF_XF_Width28                 (MCPARAMID)( 8933 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin29            (MCPARAMID)( 8934 << 14)
+#define MC_XF_ROI_WRF_XF_Width29                 (MCPARAMID)( 8935 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin30            (MCPARAMID)( 8936 << 14)
+#define MC_XF_ROI_WRF_XF_Width30                 (MCPARAMID)( 8937 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin31            (MCPARAMID)( 8938 << 14)
+#define MC_XF_ROI_WRF_XF_Width31                 (MCPARAMID)( 8939 << 14)
+#define MC_LUT_Method_LEGACY                       6
+#define MC_WBO_Status                            (MCPARAMID)( 8940 << 14)
+#define MC__ImageSizeX_dup                       (MCPARAMID)( 8941 << 14)
+#define MC__WindowX_Effective_Px_dup             (MCPARAMID)( 8942 << 14)
+#define MC_CalPatYValue                          (MCPARAMID)( 8943 << 14)
+#define MC_FEC_CalPatYValue                      (MCPARAMID)( 8944 << 14)
+#define MC_Bidule                                (MCPARAMID)( 8945 << 14)
+#define MC_COF_AE_Level1_0                       (MCPARAMID)( 8946 << 14)
+#define MC_COF_AE_Level2_0                       (MCPARAMID)( 8947 << 14)
+#define MC_COF_AE_Level3_0                       (MCPARAMID)( 8948 << 14)
+#define MC_COF_AE_Level4_0                       (MCPARAMID)( 8949 << 14)
+#define MC_COF_AE_Level5_0                       (MCPARAMID)( 8950 << 14)
+#define MC_COF_AE_Level6_0                       (MCPARAMID)( 8951 << 14)
+#define MC_COF_AE_Level7_0                       (MCPARAMID)( 8952 << 14)
+#define MC_COF_AE_Level8_0                       (MCPARAMID)( 8953 << 14)
+#define MC_COF_AE_Level1_1                       (MCPARAMID)( 8954 << 14)
+#define MC_COF_AE_Level2_1                       (MCPARAMID)( 8955 << 14)
+#define MC_COF_AE_Level3_1                       (MCPARAMID)( 8956 << 14)
+#define MC_COF_AE_Level4_1                       (MCPARAMID)( 8957 << 14)
+#define MC_COF_AE_Level5_1                       (MCPARAMID)( 8958 << 14)
+#define MC_COF_AE_Level6_1                       (MCPARAMID)( 8959 << 14)
+#define MC_COF_AE_Level7_1                       (MCPARAMID)( 8960 << 14)
+#define MC_COF_AE_Level8_1                       (MCPARAMID)( 8961 << 14)
+#define MC_COF_AE_Level1_2                       (MCPARAMID)( 8962 << 14)
+#define MC_COF_AE_Level2_2                       (MCPARAMID)( 8963 << 14)
+#define MC_COF_AE_Level3_2                       (MCPARAMID)( 8964 << 14)
+#define MC_COF_AE_Level4_2                       (MCPARAMID)( 8965 << 14)
+#define MC_COF_AE_Level5_2                       (MCPARAMID)( 8966 << 14)
+#define MC_COF_AE_Level6_2                       (MCPARAMID)( 8967 << 14)
+#define MC_COF_AE_Level7_2                       (MCPARAMID)( 8968 << 14)
+#define MC_COF_AE_Level8_2                       (MCPARAMID)( 8969 << 14)
+#define MC_COF_AE_Level1_3                       (MCPARAMID)( 8970 << 14)
+#define MC_COF_AE_Level2_3                       (MCPARAMID)( 8971 << 14)
+#define MC_COF_AE_Level3_3                       (MCPARAMID)( 8972 << 14)
+#define MC_COF_AE_Level4_3                       (MCPARAMID)( 8973 << 14)
+#define MC_COF_AE_Level5_3                       (MCPARAMID)( 8974 << 14)
+#define MC_COF_AE_Level6_3                       (MCPARAMID)( 8975 << 14)
+#define MC_COF_AE_Level7_3                       (MCPARAMID)( 8976 << 14)
+#define MC_COF_AE_Level8_3                       (MCPARAMID)( 8977 << 14)
+#define MC_COF_AE_Level1_4                       (MCPARAMID)( 8978 << 14)
+#define MC_COF_AE_Level2_4                       (MCPARAMID)( 8979 << 14)
+#define MC_COF_AE_Level3_4                       (MCPARAMID)( 8980 << 14)
+#define MC_COF_AE_Level4_4                       (MCPARAMID)( 8981 << 14)
+#define MC_COF_AE_Level5_4                       (MCPARAMID)( 8982 << 14)
+#define MC_COF_AE_Level6_4                       (MCPARAMID)( 8983 << 14)
+#define MC_COF_AE_Level7_4                       (MCPARAMID)( 8984 << 14)
+#define MC_COF_AE_Level8_4                       (MCPARAMID)( 8985 << 14)
+#define MC_COF_AE_Level1_5                       (MCPARAMID)( 8986 << 14)
+#define MC_COF_AE_Level2_5                       (MCPARAMID)( 8987 << 14)
+#define MC_COF_AE_Level3_5                       (MCPARAMID)( 8988 << 14)
+#define MC_COF_AE_Level4_5                       (MCPARAMID)( 8989 << 14)
+#define MC_COF_AE_Level5_5                       (MCPARAMID)( 8990 << 14)
+#define MC_COF_AE_Level6_5                       (MCPARAMID)( 8991 << 14)
+#define MC_COF_AE_Level7_5                       (MCPARAMID)( 8992 << 14)
+#define MC_COF_AE_Level8_5                       (MCPARAMID)( 8993 << 14)
+#define MC_COF_AE_Level1_6                       (MCPARAMID)( 8994 << 14)
+#define MC_COF_AE_Level2_6                       (MCPARAMID)( 8995 << 14)
+#define MC_COF_AE_Level3_6                       (MCPARAMID)( 8996 << 14)
+#define MC_COF_AE_Level4_6                       (MCPARAMID)( 8997 << 14)
+#define MC_COF_AE_Level5_6                       (MCPARAMID)( 8998 << 14)
+#define MC_COF_AE_Level6_6                       (MCPARAMID)( 8999 << 14)
+#define MC_COF_AE_Level7_6                       (MCPARAMID)( 9000 << 14)
+#define MC_COF_AE_Level8_6                       (MCPARAMID)( 9001 << 14)
+#define MC_COF_AE_Level1_7                       (MCPARAMID)( 9002 << 14)
+#define MC_COF_AE_Level2_7                       (MCPARAMID)( 9003 << 14)
+#define MC_COF_AE_Level3_7                       (MCPARAMID)( 9004 << 14)
+#define MC_COF_AE_Level4_7                       (MCPARAMID)( 9005 << 14)
+#define MC_COF_AE_Level5_7                       (MCPARAMID)( 9006 << 14)
+#define MC_COF_AE_Level6_7                       (MCPARAMID)( 9007 << 14)
+#define MC_COF_AE_Level7_7                       (MCPARAMID)( 9008 << 14)
+#define MC_COF_AE_Level8_7                       (MCPARAMID)( 9009 << 14)
+#define MC_COF_AE_Level1_8                       (MCPARAMID)( 9010 << 14)
+#define MC_COF_AE_Level2_8                       (MCPARAMID)( 9011 << 14)
+#define MC_COF_AE_Level3_8                       (MCPARAMID)( 9012 << 14)
+#define MC_COF_AE_Level4_8                       (MCPARAMID)( 9013 << 14)
+#define MC_COF_AE_Level5_8                       (MCPARAMID)( 9014 << 14)
+#define MC_COF_AE_Level6_8                       (MCPARAMID)( 9015 << 14)
+#define MC_COF_AE_Level7_8                       (MCPARAMID)( 9016 << 14)
+#define MC_COF_AE_Level8_8                       (MCPARAMID)( 9017 << 14)
+#define MC_COF_AE_Level1_9                       (MCPARAMID)( 9018 << 14)
+#define MC_COF_AE_Level2_9                       (MCPARAMID)( 9019 << 14)
+#define MC_COF_AE_Level3_9                       (MCPARAMID)( 9020 << 14)
+#define MC_COF_AE_Level4_9                       (MCPARAMID)( 9021 << 14)
+#define MC_COF_AE_Level5_9                       (MCPARAMID)( 9022 << 14)
+#define MC_COF_AE_Level6_9                       (MCPARAMID)( 9023 << 14)
+#define MC_COF_AE_Level7_9                       (MCPARAMID)( 9024 << 14)
+#define MC_COF_AE_Level8_9                       (MCPARAMID)( 9025 << 14)
+#define MC_COF_AE_Level1_10                      (MCPARAMID)( 9026 << 14)
+#define MC_COF_AE_Level2_10                      (MCPARAMID)( 9027 << 14)
+#define MC_COF_AE_Level3_10                      (MCPARAMID)( 9028 << 14)
+#define MC_COF_AE_Level4_10                      (MCPARAMID)( 9029 << 14)
+#define MC_COF_AE_Level5_10                      (MCPARAMID)( 9030 << 14)
+#define MC_COF_AE_Level6_10                      (MCPARAMID)( 9031 << 14)
+#define MC_COF_AE_Level7_10                      (MCPARAMID)( 9032 << 14)
+#define MC_COF_AE_Level8_10                      (MCPARAMID)( 9033 << 14)
+#define MC_COF_AE_Level1_11                      (MCPARAMID)( 9034 << 14)
+#define MC_COF_AE_Level2_11                      (MCPARAMID)( 9035 << 14)
+#define MC_COF_AE_Level3_11                      (MCPARAMID)( 9036 << 14)
+#define MC_COF_AE_Level4_11                      (MCPARAMID)( 9037 << 14)
+#define MC_COF_AE_Level5_11                      (MCPARAMID)( 9038 << 14)
+#define MC_COF_AE_Level6_11                      (MCPARAMID)( 9039 << 14)
+#define MC_COF_AE_Level7_11                      (MCPARAMID)( 9040 << 14)
+#define MC_COF_AE_Level8_11                      (MCPARAMID)( 9041 << 14)
+#define MC_COF_AE_Level1_12                      (MCPARAMID)( 9042 << 14)
+#define MC_COF_AE_Level2_12                      (MCPARAMID)( 9043 << 14)
+#define MC_COF_AE_Level3_12                      (MCPARAMID)( 9044 << 14)
+#define MC_COF_AE_Level4_12                      (MCPARAMID)( 9045 << 14)
+#define MC_COF_AE_Level5_12                      (MCPARAMID)( 9046 << 14)
+#define MC_COF_AE_Level6_12                      (MCPARAMID)( 9047 << 14)
+#define MC_COF_AE_Level7_12                      (MCPARAMID)( 9048 << 14)
+#define MC_COF_AE_Level8_12                      (MCPARAMID)( 9049 << 14)
+#define MC_COF_AE_Level1_13                      (MCPARAMID)( 9050 << 14)
+#define MC_COF_AE_Level2_13                      (MCPARAMID)( 9051 << 14)
+#define MC_COF_AE_Level3_13                      (MCPARAMID)( 9052 << 14)
+#define MC_COF_AE_Level4_13                      (MCPARAMID)( 9053 << 14)
+#define MC_COF_AE_Level5_13                      (MCPARAMID)( 9054 << 14)
+#define MC_COF_AE_Level6_13                      (MCPARAMID)( 9055 << 14)
+#define MC_COF_AE_Level7_13                      (MCPARAMID)( 9056 << 14)
+#define MC_COF_AE_Level8_13                      (MCPARAMID)( 9057 << 14)
+#define MC_COF_AE_Level1_14                      (MCPARAMID)( 9058 << 14)
+#define MC_COF_AE_Level2_14                      (MCPARAMID)( 9059 << 14)
+#define MC_COF_AE_Level3_14                      (MCPARAMID)( 9060 << 14)
+#define MC_COF_AE_Level4_14                      (MCPARAMID)( 9061 << 14)
+#define MC_COF_AE_Level5_14                      (MCPARAMID)( 9062 << 14)
+#define MC_COF_AE_Level6_14                      (MCPARAMID)( 9063 << 14)
+#define MC_COF_AE_Level7_14                      (MCPARAMID)( 9064 << 14)
+#define MC_COF_AE_Level8_14                      (MCPARAMID)( 9065 << 14)
+#define MC_COF_AE_Level1_15                      (MCPARAMID)( 9066 << 14)
+#define MC_COF_AE_Level2_15                      (MCPARAMID)( 9067 << 14)
+#define MC_COF_AE_Level3_15                      (MCPARAMID)( 9068 << 14)
+#define MC_COF_AE_Level4_15                      (MCPARAMID)( 9069 << 14)
+#define MC_COF_AE_Level5_15                      (MCPARAMID)( 9070 << 14)
+#define MC_COF_AE_Level6_15                      (MCPARAMID)( 9071 << 14)
+#define MC_COF_AE_Level7_15                      (MCPARAMID)( 9072 << 14)
+#define MC_COF_AE_Level8_15                      (MCPARAMID)( 9073 << 14)
+#define MC_COF_AE_Level1_16                      (MCPARAMID)( 9074 << 14)
+#define MC_COF_AE_Level2_16                      (MCPARAMID)( 9075 << 14)
+#define MC_COF_AE_Level3_16                      (MCPARAMID)( 9076 << 14)
+#define MC_COF_AE_Level4_16                      (MCPARAMID)( 9077 << 14)
+#define MC_COF_AE_Level5_16                      (MCPARAMID)( 9078 << 14)
+#define MC_COF_AE_Level6_16                      (MCPARAMID)( 9079 << 14)
+#define MC_COF_AE_Level7_16                      (MCPARAMID)( 9080 << 14)
+#define MC_COF_AE_Level8_16                      (MCPARAMID)( 9081 << 14)
+#define MC_COF_AE_Level1_17                      (MCPARAMID)( 9082 << 14)
+#define MC_COF_AE_Level2_17                      (MCPARAMID)( 9083 << 14)
+#define MC_COF_AE_Level3_17                      (MCPARAMID)( 9084 << 14)
+#define MC_COF_AE_Level4_17                      (MCPARAMID)( 9085 << 14)
+#define MC_COF_AE_Level5_17                      (MCPARAMID)( 9086 << 14)
+#define MC_COF_AE_Level6_17                      (MCPARAMID)( 9087 << 14)
+#define MC_COF_AE_Level7_17                      (MCPARAMID)( 9088 << 14)
+#define MC_COF_AE_Level8_17                      (MCPARAMID)( 9089 << 14)
+#define MC_COF_AE_Level1_18                      (MCPARAMID)( 9090 << 14)
+#define MC_COF_AE_Level2_18                      (MCPARAMID)( 9091 << 14)
+#define MC_COF_AE_Level3_18                      (MCPARAMID)( 9092 << 14)
+#define MC_COF_AE_Level4_18                      (MCPARAMID)( 9093 << 14)
+#define MC_COF_AE_Level5_18                      (MCPARAMID)( 9094 << 14)
+#define MC_COF_AE_Level6_18                      (MCPARAMID)( 9095 << 14)
+#define MC_COF_AE_Level7_18                      (MCPARAMID)( 9096 << 14)
+#define MC_COF_AE_Level8_18                      (MCPARAMID)( 9097 << 14)
+#define MC_COF_AE_Level1_19                      (MCPARAMID)( 9098 << 14)
+#define MC_COF_AE_Level2_19                      (MCPARAMID)( 9099 << 14)
+#define MC_COF_AE_Level3_19                      (MCPARAMID)( 9100 << 14)
+#define MC_COF_AE_Level4_19                      (MCPARAMID)( 9101 << 14)
+#define MC_COF_AE_Level5_19                      (MCPARAMID)( 9102 << 14)
+#define MC_COF_AE_Level6_19                      (MCPARAMID)( 9103 << 14)
+#define MC_COF_AE_Level7_19                      (MCPARAMID)( 9104 << 14)
+#define MC_COF_AE_Level8_19                      (MCPARAMID)( 9105 << 14)
+#define MC_COF_AE_Level1_20                      (MCPARAMID)( 9106 << 14)
+#define MC_COF_AE_Level2_20                      (MCPARAMID)( 9107 << 14)
+#define MC_COF_AE_Level3_20                      (MCPARAMID)( 9108 << 14)
+#define MC_COF_AE_Level4_20                      (MCPARAMID)( 9109 << 14)
+#define MC_COF_AE_Level5_20                      (MCPARAMID)( 9110 << 14)
+#define MC_COF_AE_Level6_20                      (MCPARAMID)( 9111 << 14)
+#define MC_COF_AE_Level7_20                      (MCPARAMID)( 9112 << 14)
+#define MC_COF_AE_Level8_20                      (MCPARAMID)( 9113 << 14)
+#define MC_COF_AE_Level1_21                      (MCPARAMID)( 9114 << 14)
+#define MC_COF_AE_Level2_21                      (MCPARAMID)( 9115 << 14)
+#define MC_COF_AE_Level3_21                      (MCPARAMID)( 9116 << 14)
+#define MC_COF_AE_Level4_21                      (MCPARAMID)( 9117 << 14)
+#define MC_COF_AE_Level5_21                      (MCPARAMID)( 9118 << 14)
+#define MC_COF_AE_Level6_21                      (MCPARAMID)( 9119 << 14)
+#define MC_COF_AE_Level7_21                      (MCPARAMID)( 9120 << 14)
+#define MC_COF_AE_Level8_21                      (MCPARAMID)( 9121 << 14)
+#define MC_COF_AE_Level1_22                      (MCPARAMID)( 9122 << 14)
+#define MC_COF_AE_Level2_22                      (MCPARAMID)( 9123 << 14)
+#define MC_COF_AE_Level3_22                      (MCPARAMID)( 9124 << 14)
+#define MC_COF_AE_Level4_22                      (MCPARAMID)( 9125 << 14)
+#define MC_COF_AE_Level5_22                      (MCPARAMID)( 9126 << 14)
+#define MC_COF_AE_Level6_22                      (MCPARAMID)( 9127 << 14)
+#define MC_COF_AE_Level7_22                      (MCPARAMID)( 9128 << 14)
+#define MC_COF_AE_Level8_22                      (MCPARAMID)( 9129 << 14)
+#define MC_COF_AE_Level1_23                      (MCPARAMID)( 9130 << 14)
+#define MC_COF_AE_Level2_23                      (MCPARAMID)( 9131 << 14)
+#define MC_COF_AE_Level3_23                      (MCPARAMID)( 9132 << 14)
+#define MC_COF_AE_Level4_23                      (MCPARAMID)( 9133 << 14)
+#define MC_COF_AE_Level5_23                      (MCPARAMID)( 9134 << 14)
+#define MC_COF_AE_Level6_23                      (MCPARAMID)( 9135 << 14)
+#define MC_COF_AE_Level7_23                      (MCPARAMID)( 9136 << 14)
+#define MC_COF_AE_Level8_23                      (MCPARAMID)( 9137 << 14)
+#define MC_COF_AE_Level1_24                      (MCPARAMID)( 9138 << 14)
+#define MC_COF_AE_Level2_24                      (MCPARAMID)( 9139 << 14)
+#define MC_COF_AE_Level3_24                      (MCPARAMID)( 9140 << 14)
+#define MC_COF_AE_Level4_24                      (MCPARAMID)( 9141 << 14)
+#define MC_COF_AE_Level5_24                      (MCPARAMID)( 9142 << 14)
+#define MC_COF_AE_Level6_24                      (MCPARAMID)( 9143 << 14)
+#define MC_COF_AE_Level7_24                      (MCPARAMID)( 9144 << 14)
+#define MC_COF_AE_Level8_24                      (MCPARAMID)( 9145 << 14)
+#define MC_COF_AE_Level1_25                      (MCPARAMID)( 9146 << 14)
+#define MC_COF_AE_Level2_25                      (MCPARAMID)( 9147 << 14)
+#define MC_COF_AE_Level3_25                      (MCPARAMID)( 9148 << 14)
+#define MC_COF_AE_Level4_25                      (MCPARAMID)( 9149 << 14)
+#define MC_COF_AE_Level5_25                      (MCPARAMID)( 9150 << 14)
+#define MC_COF_AE_Level6_25                      (MCPARAMID)( 9151 << 14)
+#define MC_COF_AE_Level7_25                      (MCPARAMID)( 9152 << 14)
+#define MC_COF_AE_Level8_25                      (MCPARAMID)( 9153 << 14)
+#define MC_COF_AE_Level1_26                      (MCPARAMID)( 9154 << 14)
+#define MC_COF_AE_Level2_26                      (MCPARAMID)( 9155 << 14)
+#define MC_COF_AE_Level3_26                      (MCPARAMID)( 9156 << 14)
+#define MC_COF_AE_Level4_26                      (MCPARAMID)( 9157 << 14)
+#define MC_COF_AE_Level5_26                      (MCPARAMID)( 9158 << 14)
+#define MC_COF_AE_Level6_26                      (MCPARAMID)( 9159 << 14)
+#define MC_COF_AE_Level7_26                      (MCPARAMID)( 9160 << 14)
+#define MC_COF_AE_Level8_26                      (MCPARAMID)( 9161 << 14)
+#define MC_COF_AE_Level1_27                      (MCPARAMID)( 9162 << 14)
+#define MC_COF_AE_Level2_27                      (MCPARAMID)( 9163 << 14)
+#define MC_COF_AE_Level3_27                      (MCPARAMID)( 9164 << 14)
+#define MC_COF_AE_Level4_27                      (MCPARAMID)( 9165 << 14)
+#define MC_COF_AE_Level5_27                      (MCPARAMID)( 9166 << 14)
+#define MC_COF_AE_Level6_27                      (MCPARAMID)( 9167 << 14)
+#define MC_COF_AE_Level7_27                      (MCPARAMID)( 9168 << 14)
+#define MC_COF_AE_Level8_27                      (MCPARAMID)( 9169 << 14)
+#define MC_COF_AE_Level1_28                      (MCPARAMID)( 9170 << 14)
+#define MC_COF_AE_Level2_28                      (MCPARAMID)( 9171 << 14)
+#define MC_COF_AE_Level3_28                      (MCPARAMID)( 9172 << 14)
+#define MC_COF_AE_Level4_28                      (MCPARAMID)( 9173 << 14)
+#define MC_COF_AE_Level5_28                      (MCPARAMID)( 9174 << 14)
+#define MC_COF_AE_Level6_28                      (MCPARAMID)( 9175 << 14)
+#define MC_COF_AE_Level7_28                      (MCPARAMID)( 9176 << 14)
+#define MC_COF_AE_Level8_28                      (MCPARAMID)( 9177 << 14)
+#define MC_COF_AE_Level1_29                      (MCPARAMID)( 9178 << 14)
+#define MC_COF_AE_Level2_29                      (MCPARAMID)( 9179 << 14)
+#define MC_COF_AE_Level3_29                      (MCPARAMID)( 9180 << 14)
+#define MC_COF_AE_Level4_29                      (MCPARAMID)( 9181 << 14)
+#define MC_COF_AE_Level5_29                      (MCPARAMID)( 9182 << 14)
+#define MC_COF_AE_Level6_29                      (MCPARAMID)( 9183 << 14)
+#define MC_COF_AE_Level7_29                      (MCPARAMID)( 9184 << 14)
+#define MC_COF_AE_Level8_29                      (MCPARAMID)( 9185 << 14)
+#define MC_COF_AE_Level1_30                      (MCPARAMID)( 9186 << 14)
+#define MC_COF_AE_Level2_30                      (MCPARAMID)( 9187 << 14)
+#define MC_COF_AE_Level3_30                      (MCPARAMID)( 9188 << 14)
+#define MC_COF_AE_Level4_30                      (MCPARAMID)( 9189 << 14)
+#define MC_COF_AE_Level5_30                      (MCPARAMID)( 9190 << 14)
+#define MC_COF_AE_Level6_30                      (MCPARAMID)( 9191 << 14)
+#define MC_COF_AE_Level7_30                      (MCPARAMID)( 9192 << 14)
+#define MC_COF_AE_Level8_30                      (MCPARAMID)( 9193 << 14)
+#define MC_COF_AE_Level1_31                      (MCPARAMID)( 9194 << 14)
+#define MC_COF_AE_Level2_31                      (MCPARAMID)( 9195 << 14)
+#define MC_COF_AE_Level3_31                      (MCPARAMID)( 9196 << 14)
+#define MC_COF_AE_Level4_31                      (MCPARAMID)( 9197 << 14)
+#define MC_COF_AE_Level5_31                      (MCPARAMID)( 9198 << 14)
+#define MC_COF_AE_Level6_31                      (MCPARAMID)( 9199 << 14)
+#define MC_COF_AE_Level7_31                      (MCPARAMID)( 9200 << 14)
+#define MC_COF_AE_Level8_31                      (MCPARAMID)( 9201 << 14)
+#define MC_COF_AELevel1_0                        (MCPARAMID)( 9202 << 14)
+#define MC_COF_AELevel2_0                        (MCPARAMID)( 9203 << 14)
+#define MC_COF_AELevel3_0                        (MCPARAMID)( 9204 << 14)
+#define MC_COF_AELevel4_0                        (MCPARAMID)( 9205 << 14)
+#define MC_COF_AELevel5_0                        (MCPARAMID)( 9206 << 14)
+#define MC_COF_AELevel6_0                        (MCPARAMID)( 9207 << 14)
+#define MC_COF_AELevel7_0                        (MCPARAMID)( 9208 << 14)
+#define MC_COF_AELevel8_0                        (MCPARAMID)( 9209 << 14)
+#define MC_COF_AELevel1_1                        (MCPARAMID)( 9210 << 14)
+#define MC_COF_AELevel2_1                        (MCPARAMID)( 9211 << 14)
+#define MC_COF_AELevel3_1                        (MCPARAMID)( 9212 << 14)
+#define MC_COF_AELevel4_1                        (MCPARAMID)( 9213 << 14)
+#define MC_COF_AELevel5_1                        (MCPARAMID)( 9214 << 14)
+#define MC_COF_AELevel6_1                        (MCPARAMID)( 9215 << 14)
+#define MC_COF_AELevel7_1                        (MCPARAMID)( 9216 << 14)
+#define MC_COF_AELevel8_1                        (MCPARAMID)( 9217 << 14)
+#define MC_COF_AELevel1_2                        (MCPARAMID)( 9218 << 14)
+#define MC_COF_AELevel2_2                        (MCPARAMID)( 9219 << 14)
+#define MC_COF_AELevel3_2                        (MCPARAMID)( 9220 << 14)
+#define MC_COF_AELevel4_2                        (MCPARAMID)( 9221 << 14)
+#define MC_COF_AELevel5_2                        (MCPARAMID)( 9222 << 14)
+#define MC_COF_AELevel6_2                        (MCPARAMID)( 9223 << 14)
+#define MC_COF_AELevel7_2                        (MCPARAMID)( 9224 << 14)
+#define MC_COF_AELevel8_2                        (MCPARAMID)( 9225 << 14)
+#define MC_COF_AELevel1_3                        (MCPARAMID)( 9226 << 14)
+#define MC_COF_AELevel2_3                        (MCPARAMID)( 9227 << 14)
+#define MC_COF_AELevel3_3                        (MCPARAMID)( 9228 << 14)
+#define MC_COF_AELevel4_3                        (MCPARAMID)( 9229 << 14)
+#define MC_COF_AELevel5_3                        (MCPARAMID)( 9230 << 14)
+#define MC_COF_AELevel6_3                        (MCPARAMID)( 9231 << 14)
+#define MC_COF_AELevel7_3                        (MCPARAMID)( 9232 << 14)
+#define MC_COF_AELevel8_3                        (MCPARAMID)( 9233 << 14)
+#define MC_COF_AELevel1_4                        (MCPARAMID)( 9234 << 14)
+#define MC_COF_AELevel2_4                        (MCPARAMID)( 9235 << 14)
+#define MC_COF_AELevel3_4                        (MCPARAMID)( 9236 << 14)
+#define MC_COF_AELevel4_4                        (MCPARAMID)( 9237 << 14)
+#define MC_COF_AELevel5_4                        (MCPARAMID)( 9238 << 14)
+#define MC_COF_AELevel6_4                        (MCPARAMID)( 9239 << 14)
+#define MC_COF_AELevel7_4                        (MCPARAMID)( 9240 << 14)
+#define MC_COF_AELevel8_4                        (MCPARAMID)( 9241 << 14)
+#define MC_COF_AELevel1_5                        (MCPARAMID)( 9242 << 14)
+#define MC_COF_AELevel2_5                        (MCPARAMID)( 9243 << 14)
+#define MC_COF_AELevel3_5                        (MCPARAMID)( 9244 << 14)
+#define MC_COF_AELevel4_5                        (MCPARAMID)( 9245 << 14)
+#define MC_COF_AELevel5_5                        (MCPARAMID)( 9246 << 14)
+#define MC_COF_AELevel6_5                        (MCPARAMID)( 9247 << 14)
+#define MC_COF_AELevel7_5                        (MCPARAMID)( 9248 << 14)
+#define MC_COF_AELevel8_5                        (MCPARAMID)( 9249 << 14)
+#define MC_COF_AELevel1_6                        (MCPARAMID)( 9250 << 14)
+#define MC_COF_AELevel2_6                        (MCPARAMID)( 9251 << 14)
+#define MC_COF_AELevel3_6                        (MCPARAMID)( 9252 << 14)
+#define MC_COF_AELevel4_6                        (MCPARAMID)( 9253 << 14)
+#define MC_COF_AELevel5_6                        (MCPARAMID)( 9254 << 14)
+#define MC_COF_AELevel6_6                        (MCPARAMID)( 9255 << 14)
+#define MC_COF_AELevel7_6                        (MCPARAMID)( 9256 << 14)
+#define MC_COF_AELevel8_6                        (MCPARAMID)( 9257 << 14)
+#define MC_COF_AELevel1_7                        (MCPARAMID)( 9258 << 14)
+#define MC_COF_AELevel2_7                        (MCPARAMID)( 9259 << 14)
+#define MC_COF_AELevel3_7                        (MCPARAMID)( 9260 << 14)
+#define MC_COF_AELevel4_7                        (MCPARAMID)( 9261 << 14)
+#define MC_COF_AELevel5_7                        (MCPARAMID)( 9262 << 14)
+#define MC_COF_AELevel6_7                        (MCPARAMID)( 9263 << 14)
+#define MC_COF_AELevel7_7                        (MCPARAMID)( 9264 << 14)
+#define MC_COF_AELevel8_7                        (MCPARAMID)( 9265 << 14)
+#define MC_COF_AELevel1_8                        (MCPARAMID)( 9266 << 14)
+#define MC_COF_AELevel2_8                        (MCPARAMID)( 9267 << 14)
+#define MC_COF_AELevel3_8                        (MCPARAMID)( 9268 << 14)
+#define MC_COF_AELevel4_8                        (MCPARAMID)( 9269 << 14)
+#define MC_COF_AELevel5_8                        (MCPARAMID)( 9270 << 14)
+#define MC_COF_AELevel6_8                        (MCPARAMID)( 9271 << 14)
+#define MC_COF_AELevel7_8                        (MCPARAMID)( 9272 << 14)
+#define MC_COF_AELevel8_8                        (MCPARAMID)( 9273 << 14)
+#define MC_COF_AELevel1_9                        (MCPARAMID)( 9274 << 14)
+#define MC_COF_AELevel2_9                        (MCPARAMID)( 9275 << 14)
+#define MC_COF_AELevel3_9                        (MCPARAMID)( 9276 << 14)
+#define MC_COF_AELevel4_9                        (MCPARAMID)( 9277 << 14)
+#define MC_COF_AELevel5_9                        (MCPARAMID)( 9278 << 14)
+#define MC_COF_AELevel6_9                        (MCPARAMID)( 9279 << 14)
+#define MC_COF_AELevel7_9                        (MCPARAMID)( 9280 << 14)
+#define MC_COF_AELevel8_9                        (MCPARAMID)( 9281 << 14)
+#define MC_COF_AELevel1_10                       (MCPARAMID)( 9282 << 14)
+#define MC_COF_AELevel2_10                       (MCPARAMID)( 9283 << 14)
+#define MC_COF_AELevel3_10                       (MCPARAMID)( 9284 << 14)
+#define MC_COF_AELevel4_10                       (MCPARAMID)( 9285 << 14)
+#define MC_COF_AELevel5_10                       (MCPARAMID)( 9286 << 14)
+#define MC_COF_AELevel6_10                       (MCPARAMID)( 9287 << 14)
+#define MC_COF_AELevel7_10                       (MCPARAMID)( 9288 << 14)
+#define MC_COF_AELevel8_10                       (MCPARAMID)( 9289 << 14)
+#define MC_COF_AELevel1_11                       (MCPARAMID)( 9290 << 14)
+#define MC_COF_AELevel2_11                       (MCPARAMID)( 9291 << 14)
+#define MC_COF_AELevel3_11                       (MCPARAMID)( 9292 << 14)
+#define MC_COF_AELevel4_11                       (MCPARAMID)( 9293 << 14)
+#define MC_COF_AELevel5_11                       (MCPARAMID)( 9294 << 14)
+#define MC_COF_AELevel6_11                       (MCPARAMID)( 9295 << 14)
+#define MC_COF_AELevel7_11                       (MCPARAMID)( 9296 << 14)
+#define MC_COF_AELevel8_11                       (MCPARAMID)( 9297 << 14)
+#define MC_COF_AELevel1_12                       (MCPARAMID)( 9298 << 14)
+#define MC_COF_AELevel2_12                       (MCPARAMID)( 9299 << 14)
+#define MC_COF_AELevel3_12                       (MCPARAMID)( 9300 << 14)
+#define MC_COF_AELevel4_12                       (MCPARAMID)( 9301 << 14)
+#define MC_COF_AELevel5_12                       (MCPARAMID)( 9302 << 14)
+#define MC_COF_AELevel6_12                       (MCPARAMID)( 9303 << 14)
+#define MC_COF_AELevel7_12                       (MCPARAMID)( 9304 << 14)
+#define MC_COF_AELevel8_12                       (MCPARAMID)( 9305 << 14)
+#define MC_COF_AELevel1_13                       (MCPARAMID)( 9306 << 14)
+#define MC_COF_AELevel2_13                       (MCPARAMID)( 9307 << 14)
+#define MC_COF_AELevel3_13                       (MCPARAMID)( 9308 << 14)
+#define MC_COF_AELevel4_13                       (MCPARAMID)( 9309 << 14)
+#define MC_COF_AELevel5_13                       (MCPARAMID)( 9310 << 14)
+#define MC_COF_AELevel6_13                       (MCPARAMID)( 9311 << 14)
+#define MC_COF_AELevel7_13                       (MCPARAMID)( 9312 << 14)
+#define MC_COF_AELevel8_13                       (MCPARAMID)( 9313 << 14)
+#define MC_COF_AELevel1_14                       (MCPARAMID)( 9314 << 14)
+#define MC_COF_AELevel2_14                       (MCPARAMID)( 9315 << 14)
+#define MC_COF_AELevel3_14                       (MCPARAMID)( 9316 << 14)
+#define MC_COF_AELevel4_14                       (MCPARAMID)( 9317 << 14)
+#define MC_COF_AELevel5_14                       (MCPARAMID)( 9318 << 14)
+#define MC_COF_AELevel6_14                       (MCPARAMID)( 9319 << 14)
+#define MC_COF_AELevel7_14                       (MCPARAMID)( 9320 << 14)
+#define MC_COF_AELevel8_14                       (MCPARAMID)( 9321 << 14)
+#define MC_COF_AELevel1_15                       (MCPARAMID)( 9322 << 14)
+#define MC_COF_AELevel2_15                       (MCPARAMID)( 9323 << 14)
+#define MC_COF_AELevel3_15                       (MCPARAMID)( 9324 << 14)
+#define MC_COF_AELevel4_15                       (MCPARAMID)( 9325 << 14)
+#define MC_COF_AELevel5_15                       (MCPARAMID)( 9326 << 14)
+#define MC_COF_AELevel6_15                       (MCPARAMID)( 9327 << 14)
+#define MC_COF_AELevel7_15                       (MCPARAMID)( 9328 << 14)
+#define MC_COF_AELevel8_15                       (MCPARAMID)( 9329 << 14)
+#define MC_COF_AELevel1_16                       (MCPARAMID)( 9330 << 14)
+#define MC_COF_AELevel2_16                       (MCPARAMID)( 9331 << 14)
+#define MC_COF_AELevel3_16                       (MCPARAMID)( 9332 << 14)
+#define MC_COF_AELevel4_16                       (MCPARAMID)( 9333 << 14)
+#define MC_COF_AELevel5_16                       (MCPARAMID)( 9334 << 14)
+#define MC_COF_AELevel6_16                       (MCPARAMID)( 9335 << 14)
+#define MC_COF_AELevel7_16                       (MCPARAMID)( 9336 << 14)
+#define MC_COF_AELevel8_16                       (MCPARAMID)( 9337 << 14)
+#define MC_COF_AELevel1_17                       (MCPARAMID)( 9338 << 14)
+#define MC_COF_AELevel2_17                       (MCPARAMID)( 9339 << 14)
+#define MC_COF_AELevel3_17                       (MCPARAMID)( 9340 << 14)
+#define MC_COF_AELevel4_17                       (MCPARAMID)( 9341 << 14)
+#define MC_COF_AELevel5_17                       (MCPARAMID)( 9342 << 14)
+#define MC_COF_AELevel6_17                       (MCPARAMID)( 9343 << 14)
+#define MC_COF_AELevel7_17                       (MCPARAMID)( 9344 << 14)
+#define MC_COF_AELevel8_17                       (MCPARAMID)( 9345 << 14)
+#define MC_COF_AELevel1_18                       (MCPARAMID)( 9346 << 14)
+#define MC_COF_AELevel2_18                       (MCPARAMID)( 9347 << 14)
+#define MC_COF_AELevel3_18                       (MCPARAMID)( 9348 << 14)
+#define MC_COF_AELevel4_18                       (MCPARAMID)( 9349 << 14)
+#define MC_COF_AELevel5_18                       (MCPARAMID)( 9350 << 14)
+#define MC_COF_AELevel6_18                       (MCPARAMID)( 9351 << 14)
+#define MC_COF_AELevel7_18                       (MCPARAMID)( 9352 << 14)
+#define MC_COF_AELevel8_18                       (MCPARAMID)( 9353 << 14)
+#define MC_COF_AELevel1_19                       (MCPARAMID)( 9354 << 14)
+#define MC_COF_AELevel2_19                       (MCPARAMID)( 9355 << 14)
+#define MC_COF_AELevel3_19                       (MCPARAMID)( 9356 << 14)
+#define MC_COF_AELevel4_19                       (MCPARAMID)( 9357 << 14)
+#define MC_COF_AELevel5_19                       (MCPARAMID)( 9358 << 14)
+#define MC_COF_AELevel6_19                       (MCPARAMID)( 9359 << 14)
+#define MC_COF_AELevel7_19                       (MCPARAMID)( 9360 << 14)
+#define MC_COF_AELevel8_19                       (MCPARAMID)( 9361 << 14)
+#define MC_COF_AELevel1_20                       (MCPARAMID)( 9362 << 14)
+#define MC_COF_AELevel2_20                       (MCPARAMID)( 9363 << 14)
+#define MC_COF_AELevel3_20                       (MCPARAMID)( 9364 << 14)
+#define MC_COF_AELevel4_20                       (MCPARAMID)( 9365 << 14)
+#define MC_COF_AELevel5_20                       (MCPARAMID)( 9366 << 14)
+#define MC_COF_AELevel6_20                       (MCPARAMID)( 9367 << 14)
+#define MC_COF_AELevel7_20                       (MCPARAMID)( 9368 << 14)
+#define MC_COF_AELevel8_20                       (MCPARAMID)( 9369 << 14)
+#define MC_COF_AELevel1_21                       (MCPARAMID)( 9370 << 14)
+#define MC_COF_AELevel2_21                       (MCPARAMID)( 9371 << 14)
+#define MC_COF_AELevel3_21                       (MCPARAMID)( 9372 << 14)
+#define MC_COF_AELevel4_21                       (MCPARAMID)( 9373 << 14)
+#define MC_COF_AELevel5_21                       (MCPARAMID)( 9374 << 14)
+#define MC_COF_AELevel6_21                       (MCPARAMID)( 9375 << 14)
+#define MC_COF_AELevel7_21                       (MCPARAMID)( 9376 << 14)
+#define MC_COF_AELevel8_21                       (MCPARAMID)( 9377 << 14)
+#define MC_COF_AELevel1_22                       (MCPARAMID)( 9378 << 14)
+#define MC_COF_AELevel2_22                       (MCPARAMID)( 9379 << 14)
+#define MC_COF_AELevel3_22                       (MCPARAMID)( 9380 << 14)
+#define MC_COF_AELevel4_22                       (MCPARAMID)( 9381 << 14)
+#define MC_COF_AELevel5_22                       (MCPARAMID)( 9382 << 14)
+#define MC_COF_AELevel6_22                       (MCPARAMID)( 9383 << 14)
+#define MC_COF_AELevel7_22                       (MCPARAMID)( 9384 << 14)
+#define MC_COF_AELevel8_22                       (MCPARAMID)( 9385 << 14)
+#define MC_COF_AELevel1_23                       (MCPARAMID)( 9386 << 14)
+#define MC_COF_AELevel2_23                       (MCPARAMID)( 9387 << 14)
+#define MC_COF_AELevel3_23                       (MCPARAMID)( 9388 << 14)
+#define MC_COF_AELevel4_23                       (MCPARAMID)( 9389 << 14)
+#define MC_COF_AELevel5_23                       (MCPARAMID)( 9390 << 14)
+#define MC_COF_AELevel6_23                       (MCPARAMID)( 9391 << 14)
+#define MC_COF_AELevel7_23                       (MCPARAMID)( 9392 << 14)
+#define MC_COF_AELevel8_23                       (MCPARAMID)( 9393 << 14)
+#define MC_COF_AELevel1_24                       (MCPARAMID)( 9394 << 14)
+#define MC_COF_AELevel2_24                       (MCPARAMID)( 9395 << 14)
+#define MC_COF_AELevel3_24                       (MCPARAMID)( 9396 << 14)
+#define MC_COF_AELevel4_24                       (MCPARAMID)( 9397 << 14)
+#define MC_COF_AELevel5_24                       (MCPARAMID)( 9398 << 14)
+#define MC_COF_AELevel6_24                       (MCPARAMID)( 9399 << 14)
+#define MC_COF_AELevel7_24                       (MCPARAMID)( 9400 << 14)
+#define MC_COF_AELevel8_24                       (MCPARAMID)( 9401 << 14)
+#define MC_COF_AELevel1_25                       (MCPARAMID)( 9402 << 14)
+#define MC_COF_AELevel2_25                       (MCPARAMID)( 9403 << 14)
+#define MC_COF_AELevel3_25                       (MCPARAMID)( 9404 << 14)
+#define MC_COF_AELevel4_25                       (MCPARAMID)( 9405 << 14)
+#define MC_COF_AELevel5_25                       (MCPARAMID)( 9406 << 14)
+#define MC_COF_AELevel6_25                       (MCPARAMID)( 9407 << 14)
+#define MC_COF_AELevel7_25                       (MCPARAMID)( 9408 << 14)
+#define MC_COF_AELevel8_25                       (MCPARAMID)( 9409 << 14)
+#define MC_COF_AELevel1_26                       (MCPARAMID)( 9410 << 14)
+#define MC_COF_AELevel2_26                       (MCPARAMID)( 9411 << 14)
+#define MC_COF_AELevel3_26                       (MCPARAMID)( 9412 << 14)
+#define MC_COF_AELevel4_26                       (MCPARAMID)( 9413 << 14)
+#define MC_COF_AELevel5_26                       (MCPARAMID)( 9414 << 14)
+#define MC_COF_AELevel6_26                       (MCPARAMID)( 9415 << 14)
+#define MC_COF_AELevel7_26                       (MCPARAMID)( 9416 << 14)
+#define MC_COF_AELevel8_26                       (MCPARAMID)( 9417 << 14)
+#define MC_COF_AELevel1_27                       (MCPARAMID)( 9418 << 14)
+#define MC_COF_AELevel2_27                       (MCPARAMID)( 9419 << 14)
+#define MC_COF_AELevel3_27                       (MCPARAMID)( 9420 << 14)
+#define MC_COF_AELevel4_27                       (MCPARAMID)( 9421 << 14)
+#define MC_COF_AELevel5_27                       (MCPARAMID)( 9422 << 14)
+#define MC_COF_AELevel6_27                       (MCPARAMID)( 9423 << 14)
+#define MC_COF_AELevel7_27                       (MCPARAMID)( 9424 << 14)
+#define MC_COF_AELevel8_27                       (MCPARAMID)( 9425 << 14)
+#define MC_COF_AELevel1_28                       (MCPARAMID)( 9426 << 14)
+#define MC_COF_AELevel2_28                       (MCPARAMID)( 9427 << 14)
+#define MC_COF_AELevel3_28                       (MCPARAMID)( 9428 << 14)
+#define MC_COF_AELevel4_28                       (MCPARAMID)( 9429 << 14)
+#define MC_COF_AELevel5_28                       (MCPARAMID)( 9430 << 14)
+#define MC_COF_AELevel6_28                       (MCPARAMID)( 9431 << 14)
+#define MC_COF_AELevel7_28                       (MCPARAMID)( 9432 << 14)
+#define MC_COF_AELevel8_28                       (MCPARAMID)( 9433 << 14)
+#define MC_COF_AELevel1_29                       (MCPARAMID)( 9434 << 14)
+#define MC_COF_AELevel2_29                       (MCPARAMID)( 9435 << 14)
+#define MC_COF_AELevel3_29                       (MCPARAMID)( 9436 << 14)
+#define MC_COF_AELevel4_29                       (MCPARAMID)( 9437 << 14)
+#define MC_COF_AELevel5_29                       (MCPARAMID)( 9438 << 14)
+#define MC_COF_AELevel6_29                       (MCPARAMID)( 9439 << 14)
+#define MC_COF_AELevel7_29                       (MCPARAMID)( 9440 << 14)
+#define MC_COF_AELevel8_29                       (MCPARAMID)( 9441 << 14)
+#define MC_COF_AELevel1_30                       (MCPARAMID)( 9442 << 14)
+#define MC_COF_AELevel2_30                       (MCPARAMID)( 9443 << 14)
+#define MC_COF_AELevel3_30                       (MCPARAMID)( 9444 << 14)
+#define MC_COF_AELevel4_30                       (MCPARAMID)( 9445 << 14)
+#define MC_COF_AELevel5_30                       (MCPARAMID)( 9446 << 14)
+#define MC_COF_AELevel6_30                       (MCPARAMID)( 9447 << 14)
+#define MC_COF_AELevel7_30                       (MCPARAMID)( 9448 << 14)
+#define MC_COF_AELevel8_30                       (MCPARAMID)( 9449 << 14)
+#define MC_COF_AELevel1_31                       (MCPARAMID)( 9450 << 14)
+#define MC_COF_AELevel2_31                       (MCPARAMID)( 9451 << 14)
+#define MC_COF_AELevel3_31                       (MCPARAMID)( 9452 << 14)
+#define MC_COF_AELevel4_31                       (MCPARAMID)( 9453 << 14)
+#define MC_COF_AELevel5_31                       (MCPARAMID)( 9454 << 14)
+#define MC_COF_AELevel6_31                       (MCPARAMID)( 9455 << 14)
+#define MC_COF_AELevel7_31                       (MCPARAMID)( 9456 << 14)
+#define MC_COF_AELevel8_31                       (MCPARAMID)( 9457 << 14)
+#define MC__PlanePitch_mw                        (MCPARAMID)( 9458 << 14)
+#define MC__PlanePitch                           (MCPARAMID)( 9459 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin32            (MCPARAMID)( 9460 << 14)
+#define MC_XF_ROI_WRF_XF_Width32                 (MCPARAMID)( 9461 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin33            (MCPARAMID)( 9462 << 14)
+#define MC_XF_ROI_WRF_XF_Width33                 (MCPARAMID)( 9463 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin34            (MCPARAMID)( 9464 << 14)
+#define MC_XF_ROI_WRF_XF_Width34                 (MCPARAMID)( 9465 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin35            (MCPARAMID)( 9466 << 14)
+#define MC_XF_ROI_WRF_XF_Width35                 (MCPARAMID)( 9467 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin36            (MCPARAMID)( 9468 << 14)
+#define MC_XF_ROI_WRF_XF_Width36                 (MCPARAMID)( 9469 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin37            (MCPARAMID)( 9470 << 14)
+#define MC_XF_ROI_WRF_XF_Width37                 (MCPARAMID)( 9471 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin38            (MCPARAMID)( 9472 << 14)
+#define MC_XF_ROI_WRF_XF_Width38                 (MCPARAMID)( 9473 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin39            (MCPARAMID)( 9474 << 14)
+#define MC_XF_ROI_WRF_XF_Width39                 (MCPARAMID)( 9475 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin40            (MCPARAMID)( 9476 << 14)
+#define MC_XF_ROI_WRF_XF_Width40                 (MCPARAMID)( 9477 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin41            (MCPARAMID)( 9478 << 14)
+#define MC_XF_ROI_WRF_XF_Width41                 (MCPARAMID)( 9479 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin42            (MCPARAMID)( 9480 << 14)
+#define MC_XF_ROI_WRF_XF_Width42                 (MCPARAMID)( 9481 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin43            (MCPARAMID)( 9482 << 14)
+#define MC_XF_ROI_WRF_XF_Width43                 (MCPARAMID)( 9483 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin44            (MCPARAMID)( 9484 << 14)
+#define MC_XF_ROI_WRF_XF_Width44                 (MCPARAMID)( 9485 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin45            (MCPARAMID)( 9486 << 14)
+#define MC_XF_ROI_WRF_XF_Width45                 (MCPARAMID)( 9487 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin46            (MCPARAMID)( 9488 << 14)
+#define MC_XF_ROI_WRF_XF_Width46                 (MCPARAMID)( 9489 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin47            (MCPARAMID)( 9490 << 14)
+#define MC_XF_ROI_WRF_XF_Width47                 (MCPARAMID)( 9491 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin48            (MCPARAMID)( 9492 << 14)
+#define MC_XF_ROI_WRF_XF_Width48                 (MCPARAMID)( 9493 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin49            (MCPARAMID)( 9494 << 14)
+#define MC_XF_ROI_WRF_XF_Width49                 (MCPARAMID)( 9495 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin50            (MCPARAMID)( 9496 << 14)
+#define MC_XF_ROI_WRF_XF_Width50                 (MCPARAMID)( 9497 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin51            (MCPARAMID)( 9498 << 14)
+#define MC_XF_ROI_WRF_XF_Width51                 (MCPARAMID)( 9499 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin52            (MCPARAMID)( 9500 << 14)
+#define MC_XF_ROI_WRF_XF_Width52                 (MCPARAMID)( 9501 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin53            (MCPARAMID)( 9502 << 14)
+#define MC_XF_ROI_WRF_XF_Width53                 (MCPARAMID)( 9503 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin54            (MCPARAMID)( 9504 << 14)
+#define MC_XF_ROI_WRF_XF_Width54                 (MCPARAMID)( 9505 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin55            (MCPARAMID)( 9506 << 14)
+#define MC_XF_ROI_WRF_XF_Width55                 (MCPARAMID)( 9507 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin56            (MCPARAMID)( 9508 << 14)
+#define MC_XF_ROI_WRF_XF_Width56                 (MCPARAMID)( 9509 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin57            (MCPARAMID)( 9510 << 14)
+#define MC_XF_ROI_WRF_XF_Width57                 (MCPARAMID)( 9511 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin58            (MCPARAMID)( 9512 << 14)
+#define MC_XF_ROI_WRF_XF_Width58                 (MCPARAMID)( 9513 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin59            (MCPARAMID)( 9514 << 14)
+#define MC_XF_ROI_WRF_XF_Width59                 (MCPARAMID)( 9515 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin60            (MCPARAMID)( 9516 << 14)
+#define MC_XF_ROI_WRF_XF_Width60                 (MCPARAMID)( 9517 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin61            (MCPARAMID)( 9518 << 14)
+#define MC_XF_ROI_WRF_XF_Width61                 (MCPARAMID)( 9519 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin62            (MCPARAMID)( 9520 << 14)
+#define MC_XF_ROI_WRF_XF_Width62                 (MCPARAMID)( 9521 << 14)
+#define MC_XF_ROI_WRF_XF_LeftMargin63            (MCPARAMID)( 9522 << 14)
+#define MC_XF_ROI_WRF_XF_Width63                 (MCPARAMID)( 9523 << 14)
+#define MC_COF_AELevel1_32                       (MCPARAMID)( 9524 << 14)
+#define MC_COF_AELevel2_32                       (MCPARAMID)( 9525 << 14)
+#define MC_COF_AELevel3_32                       (MCPARAMID)( 9526 << 14)
+#define MC_COF_AELevel4_32                       (MCPARAMID)( 9527 << 14)
+#define MC_COF_AELevel5_32                       (MCPARAMID)( 9528 << 14)
+#define MC_COF_AELevel6_32                       (MCPARAMID)( 9529 << 14)
+#define MC_COF_AELevel7_32                       (MCPARAMID)( 9530 << 14)
+#define MC_COF_AELevel8_32                       (MCPARAMID)( 9531 << 14)
+#define MC_COF_AELevel1_33                       (MCPARAMID)( 9532 << 14)
+#define MC_COF_AELevel2_33                       (MCPARAMID)( 9533 << 14)
+#define MC_COF_AELevel3_33                       (MCPARAMID)( 9534 << 14)
+#define MC_COF_AELevel4_33                       (MCPARAMID)( 9535 << 14)
+#define MC_COF_AELevel5_33                       (MCPARAMID)( 9536 << 14)
+#define MC_COF_AELevel6_33                       (MCPARAMID)( 9537 << 14)
+#define MC_COF_AELevel7_33                       (MCPARAMID)( 9538 << 14)
+#define MC_COF_AELevel8_33                       (MCPARAMID)( 9539 << 14)
+#define MC_COF_AELevel1_34                       (MCPARAMID)( 9540 << 14)
+#define MC_COF_AELevel2_34                       (MCPARAMID)( 9541 << 14)
+#define MC_COF_AELevel3_34                       (MCPARAMID)( 9542 << 14)
+#define MC_COF_AELevel4_34                       (MCPARAMID)( 9543 << 14)
+#define MC_COF_AELevel5_34                       (MCPARAMID)( 9544 << 14)
+#define MC_COF_AELevel6_34                       (MCPARAMID)( 9545 << 14)
+#define MC_COF_AELevel7_34                       (MCPARAMID)( 9546 << 14)
+#define MC_COF_AELevel8_34                       (MCPARAMID)( 9547 << 14)
+#define MC_COF_AELevel1_35                       (MCPARAMID)( 9548 << 14)
+#define MC_COF_AELevel2_35                       (MCPARAMID)( 9549 << 14)
+#define MC_COF_AELevel3_35                       (MCPARAMID)( 9550 << 14)
+#define MC_COF_AELevel4_35                       (MCPARAMID)( 9551 << 14)
+#define MC_COF_AELevel5_35                       (MCPARAMID)( 9552 << 14)
+#define MC_COF_AELevel6_35                       (MCPARAMID)( 9553 << 14)
+#define MC_COF_AELevel7_35                       (MCPARAMID)( 9554 << 14)
+#define MC_COF_AELevel8_35                       (MCPARAMID)( 9555 << 14)
+#define MC_COF_AELevel1_36                       (MCPARAMID)( 9556 << 14)
+#define MC_COF_AELevel2_36                       (MCPARAMID)( 9557 << 14)
+#define MC_COF_AELevel3_36                       (MCPARAMID)( 9558 << 14)
+#define MC_COF_AELevel4_36                       (MCPARAMID)( 9559 << 14)
+#define MC_COF_AELevel5_36                       (MCPARAMID)( 9560 << 14)
+#define MC_COF_AELevel6_36                       (MCPARAMID)( 9561 << 14)
+#define MC_COF_AELevel7_36                       (MCPARAMID)( 9562 << 14)
+#define MC_COF_AELevel8_36                       (MCPARAMID)( 9563 << 14)
+#define MC_COF_AELevel1_37                       (MCPARAMID)( 9564 << 14)
+#define MC_COF_AELevel2_37                       (MCPARAMID)( 9565 << 14)
+#define MC_COF_AELevel3_37                       (MCPARAMID)( 9566 << 14)
+#define MC_COF_AELevel4_37                       (MCPARAMID)( 9567 << 14)
+#define MC_COF_AELevel5_37                       (MCPARAMID)( 9568 << 14)
+#define MC_COF_AELevel6_37                       (MCPARAMID)( 9569 << 14)
+#define MC_COF_AELevel7_37                       (MCPARAMID)( 9570 << 14)
+#define MC_COF_AELevel8_37                       (MCPARAMID)( 9571 << 14)
+#define MC_COF_AELevel1_38                       (MCPARAMID)( 9572 << 14)
+#define MC_COF_AELevel2_38                       (MCPARAMID)( 9573 << 14)
+#define MC_COF_AELevel3_38                       (MCPARAMID)( 9574 << 14)
+#define MC_COF_AELevel4_38                       (MCPARAMID)( 9575 << 14)
+#define MC_COF_AELevel5_38                       (MCPARAMID)( 9576 << 14)
+#define MC_COF_AELevel6_38                       (MCPARAMID)( 9577 << 14)
+#define MC_COF_AELevel7_38                       (MCPARAMID)( 9578 << 14)
+#define MC_COF_AELevel8_38                       (MCPARAMID)( 9579 << 14)
+#define MC_COF_AELevel1_39                       (MCPARAMID)( 9580 << 14)
+#define MC_COF_AELevel2_39                       (MCPARAMID)( 9581 << 14)
+#define MC_COF_AELevel3_39                       (MCPARAMID)( 9582 << 14)
+#define MC_COF_AELevel4_39                       (MCPARAMID)( 9583 << 14)
+#define MC_COF_AELevel5_39                       (MCPARAMID)( 9584 << 14)
+#define MC_COF_AELevel6_39                       (MCPARAMID)( 9585 << 14)
+#define MC_COF_AELevel7_39                       (MCPARAMID)( 9586 << 14)
+#define MC_COF_AELevel8_39                       (MCPARAMID)( 9587 << 14)
+#define MC_COF_AELevel1_40                       (MCPARAMID)( 9588 << 14)
+#define MC_COF_AELevel2_40                       (MCPARAMID)( 9589 << 14)
+#define MC_COF_AELevel3_40                       (MCPARAMID)( 9590 << 14)
+#define MC_COF_AELevel4_40                       (MCPARAMID)( 9591 << 14)
+#define MC_COF_AELevel5_40                       (MCPARAMID)( 9592 << 14)
+#define MC_COF_AELevel6_40                       (MCPARAMID)( 9593 << 14)
+#define MC_COF_AELevel7_40                       (MCPARAMID)( 9594 << 14)
+#define MC_COF_AELevel8_40                       (MCPARAMID)( 9595 << 14)
+#define MC_COF_AELevel1_41                       (MCPARAMID)( 9596 << 14)
+#define MC_COF_AELevel2_41                       (MCPARAMID)( 9597 << 14)
+#define MC_COF_AELevel3_41                       (MCPARAMID)( 9598 << 14)
+#define MC_COF_AELevel4_41                       (MCPARAMID)( 9599 << 14)
+#define MC_COF_AELevel5_41                       (MCPARAMID)( 9600 << 14)
+#define MC_COF_AELevel6_41                       (MCPARAMID)( 9601 << 14)
+#define MC_COF_AELevel7_41                       (MCPARAMID)( 9602 << 14)
+#define MC_COF_AELevel8_41                       (MCPARAMID)( 9603 << 14)
+#define MC_COF_AELevel1_42                       (MCPARAMID)( 9604 << 14)
+#define MC_COF_AELevel2_42                       (MCPARAMID)( 9605 << 14)
+#define MC_COF_AELevel3_42                       (MCPARAMID)( 9606 << 14)
+#define MC_COF_AELevel4_42                       (MCPARAMID)( 9607 << 14)
+#define MC_COF_AELevel5_42                       (MCPARAMID)( 9608 << 14)
+#define MC_COF_AELevel6_42                       (MCPARAMID)( 9609 << 14)
+#define MC_COF_AELevel7_42                       (MCPARAMID)( 9610 << 14)
+#define MC_COF_AELevel8_42                       (MCPARAMID)( 9611 << 14)
+#define MC_COF_AELevel1_43                       (MCPARAMID)( 9612 << 14)
+#define MC_COF_AELevel2_43                       (MCPARAMID)( 9613 << 14)
+#define MC_COF_AELevel3_43                       (MCPARAMID)( 9614 << 14)
+#define MC_COF_AELevel4_43                       (MCPARAMID)( 9615 << 14)
+#define MC_COF_AELevel5_43                       (MCPARAMID)( 9616 << 14)
+#define MC_COF_AELevel6_43                       (MCPARAMID)( 9617 << 14)
+#define MC_COF_AELevel7_43                       (MCPARAMID)( 9618 << 14)
+#define MC_COF_AELevel8_43                       (MCPARAMID)( 9619 << 14)
+#define MC_COF_AELevel1_44                       (MCPARAMID)( 9620 << 14)
+#define MC_COF_AELevel2_44                       (MCPARAMID)( 9621 << 14)
+#define MC_COF_AELevel3_44                       (MCPARAMID)( 9622 << 14)
+#define MC_COF_AELevel4_44                       (MCPARAMID)( 9623 << 14)
+#define MC_COF_AELevel5_44                       (MCPARAMID)( 9624 << 14)
+#define MC_COF_AELevel6_44                       (MCPARAMID)( 9625 << 14)
+#define MC_COF_AELevel7_44                       (MCPARAMID)( 9626 << 14)
+#define MC_COF_AELevel8_44                       (MCPARAMID)( 9627 << 14)
+#define MC_COF_AELevel1_45                       (MCPARAMID)( 9628 << 14)
+#define MC_COF_AELevel2_45                       (MCPARAMID)( 9629 << 14)
+#define MC_COF_AELevel3_45                       (MCPARAMID)( 9630 << 14)
+#define MC_COF_AELevel4_45                       (MCPARAMID)( 9631 << 14)
+#define MC_COF_AELevel5_45                       (MCPARAMID)( 9632 << 14)
+#define MC_COF_AELevel6_45                       (MCPARAMID)( 9633 << 14)
+#define MC_COF_AELevel7_45                       (MCPARAMID)( 9634 << 14)
+#define MC_COF_AELevel8_45                       (MCPARAMID)( 9635 << 14)
+#define MC_COF_AELevel1_46                       (MCPARAMID)( 9636 << 14)
+#define MC_COF_AELevel2_46                       (MCPARAMID)( 9637 << 14)
+#define MC_COF_AELevel3_46                       (MCPARAMID)( 9638 << 14)
+#define MC_COF_AELevel4_46                       (MCPARAMID)( 9639 << 14)
+#define MC_COF_AELevel5_46                       (MCPARAMID)( 9640 << 14)
+#define MC_COF_AELevel6_46                       (MCPARAMID)( 9641 << 14)
+#define MC_COF_AELevel7_46                       (MCPARAMID)( 9642 << 14)
+#define MC_COF_AELevel8_46                       (MCPARAMID)( 9643 << 14)
+#define MC_COF_AELevel1_47                       (MCPARAMID)( 9644 << 14)
+#define MC_COF_AELevel2_47                       (MCPARAMID)( 9645 << 14)
+#define MC_COF_AELevel3_47                       (MCPARAMID)( 9646 << 14)
+#define MC_COF_AELevel4_47                       (MCPARAMID)( 9647 << 14)
+#define MC_COF_AELevel5_47                       (MCPARAMID)( 9648 << 14)
+#define MC_COF_AELevel6_47                       (MCPARAMID)( 9649 << 14)
+#define MC_COF_AELevel7_47                       (MCPARAMID)( 9650 << 14)
+#define MC_COF_AELevel8_47                       (MCPARAMID)( 9651 << 14)
+#define MC_COF_AELevel1_48                       (MCPARAMID)( 9652 << 14)
+#define MC_COF_AELevel2_48                       (MCPARAMID)( 9653 << 14)
+#define MC_COF_AELevel3_48                       (MCPARAMID)( 9654 << 14)
+#define MC_COF_AELevel4_48                       (MCPARAMID)( 9655 << 14)
+#define MC_COF_AELevel5_48                       (MCPARAMID)( 9656 << 14)
+#define MC_COF_AELevel6_48                       (MCPARAMID)( 9657 << 14)
+#define MC_COF_AELevel7_48                       (MCPARAMID)( 9658 << 14)
+#define MC_COF_AELevel8_48                       (MCPARAMID)( 9659 << 14)
+#define MC_COF_AELevel1_49                       (MCPARAMID)( 9660 << 14)
+#define MC_COF_AELevel2_49                       (MCPARAMID)( 9661 << 14)
+#define MC_COF_AELevel3_49                       (MCPARAMID)( 9662 << 14)
+#define MC_COF_AELevel4_49                       (MCPARAMID)( 9663 << 14)
+#define MC_COF_AELevel5_49                       (MCPARAMID)( 9664 << 14)
+#define MC_COF_AELevel6_49                       (MCPARAMID)( 9665 << 14)
+#define MC_COF_AELevel7_49                       (MCPARAMID)( 9666 << 14)
+#define MC_COF_AELevel8_49                       (MCPARAMID)( 9667 << 14)
+#define MC_COF_AELevel1_50                       (MCPARAMID)( 9668 << 14)
+#define MC_COF_AELevel2_50                       (MCPARAMID)( 9669 << 14)
+#define MC_COF_AELevel3_50                       (MCPARAMID)( 9670 << 14)
+#define MC_COF_AELevel4_50                       (MCPARAMID)( 9671 << 14)
+#define MC_COF_AELevel5_50                       (MCPARAMID)( 9672 << 14)
+#define MC_COF_AELevel6_50                       (MCPARAMID)( 9673 << 14)
+#define MC_COF_AELevel7_50                       (MCPARAMID)( 9674 << 14)
+#define MC_COF_AELevel8_50                       (MCPARAMID)( 9675 << 14)
+#define MC_COF_AELevel1_51                       (MCPARAMID)( 9676 << 14)
+#define MC_COF_AELevel2_51                       (MCPARAMID)( 9677 << 14)
+#define MC_COF_AELevel3_51                       (MCPARAMID)( 9678 << 14)
+#define MC_COF_AELevel4_51                       (MCPARAMID)( 9679 << 14)
+#define MC_COF_AELevel5_51                       (MCPARAMID)( 9680 << 14)
+#define MC_COF_AELevel6_51                       (MCPARAMID)( 9681 << 14)
+#define MC_COF_AELevel7_51                       (MCPARAMID)( 9682 << 14)
+#define MC_COF_AELevel8_51                       (MCPARAMID)( 9683 << 14)
+#define MC_COF_AELevel1_52                       (MCPARAMID)( 9684 << 14)
+#define MC_COF_AELevel2_52                       (MCPARAMID)( 9685 << 14)
+#define MC_COF_AELevel3_52                       (MCPARAMID)( 9686 << 14)
+#define MC_COF_AELevel4_52                       (MCPARAMID)( 9687 << 14)
+#define MC_COF_AELevel5_52                       (MCPARAMID)( 9688 << 14)
+#define MC_COF_AELevel6_52                       (MCPARAMID)( 9689 << 14)
+#define MC_COF_AELevel7_52                       (MCPARAMID)( 9690 << 14)
+#define MC_COF_AELevel8_52                       (MCPARAMID)( 9691 << 14)
+#define MC_COF_AELevel1_53                       (MCPARAMID)( 9692 << 14)
+#define MC_COF_AELevel2_53                       (MCPARAMID)( 9693 << 14)
+#define MC_COF_AELevel3_53                       (MCPARAMID)( 9694 << 14)
+#define MC_COF_AELevel4_53                       (MCPARAMID)( 9695 << 14)
+#define MC_COF_AELevel5_53                       (MCPARAMID)( 9696 << 14)
+#define MC_COF_AELevel6_53                       (MCPARAMID)( 9697 << 14)
+#define MC_COF_AELevel7_53                       (MCPARAMID)( 9698 << 14)
+#define MC_COF_AELevel8_53                       (MCPARAMID)( 9699 << 14)
+#define MC_COF_AELevel1_54                       (MCPARAMID)( 9700 << 14)
+#define MC_COF_AELevel2_54                       (MCPARAMID)( 9701 << 14)
+#define MC_COF_AELevel3_54                       (MCPARAMID)( 9702 << 14)
+#define MC_COF_AELevel4_54                       (MCPARAMID)( 9703 << 14)
+#define MC_COF_AELevel5_54                       (MCPARAMID)( 9704 << 14)
+#define MC_COF_AELevel6_54                       (MCPARAMID)( 9705 << 14)
+#define MC_COF_AELevel7_54                       (MCPARAMID)( 9706 << 14)
+#define MC_COF_AELevel8_54                       (MCPARAMID)( 9707 << 14)
+#define MC_COF_AELevel1_55                       (MCPARAMID)( 9708 << 14)
+#define MC_COF_AELevel2_55                       (MCPARAMID)( 9709 << 14)
+#define MC_COF_AELevel3_55                       (MCPARAMID)( 9710 << 14)
+#define MC_COF_AELevel4_55                       (MCPARAMID)( 9711 << 14)
+#define MC_COF_AELevel5_55                       (MCPARAMID)( 9712 << 14)
+#define MC_COF_AELevel6_55                       (MCPARAMID)( 9713 << 14)
+#define MC_COF_AELevel7_55                       (MCPARAMID)( 9714 << 14)
+#define MC_COF_AELevel8_55                       (MCPARAMID)( 9715 << 14)
+#define MC_COF_AELevel1_56                       (MCPARAMID)( 9716 << 14)
+#define MC_COF_AELevel2_56                       (MCPARAMID)( 9717 << 14)
+#define MC_COF_AELevel3_56                       (MCPARAMID)( 9718 << 14)
+#define MC_COF_AELevel4_56                       (MCPARAMID)( 9719 << 14)
+#define MC_COF_AELevel5_56                       (MCPARAMID)( 9720 << 14)
+#define MC_COF_AELevel6_56                       (MCPARAMID)( 9721 << 14)
+#define MC_COF_AELevel7_56                       (MCPARAMID)( 9722 << 14)
+#define MC_COF_AELevel8_56                       (MCPARAMID)( 9723 << 14)
+#define MC_COF_AELevel1_57                       (MCPARAMID)( 9724 << 14)
+#define MC_COF_AELevel2_57                       (MCPARAMID)( 9725 << 14)
+#define MC_COF_AELevel3_57                       (MCPARAMID)( 9726 << 14)
+#define MC_COF_AELevel4_57                       (MCPARAMID)( 9727 << 14)
+#define MC_COF_AELevel5_57                       (MCPARAMID)( 9728 << 14)
+#define MC_COF_AELevel6_57                       (MCPARAMID)( 9729 << 14)
+#define MC_COF_AELevel7_57                       (MCPARAMID)( 9730 << 14)
+#define MC_COF_AELevel8_57                       (MCPARAMID)( 9731 << 14)
+#define MC_COF_AELevel1_58                       (MCPARAMID)( 9732 << 14)
+#define MC_COF_AELevel2_58                       (MCPARAMID)( 9733 << 14)
+#define MC_COF_AELevel3_58                       (MCPARAMID)( 9734 << 14)
+#define MC_COF_AELevel4_58                       (MCPARAMID)( 9735 << 14)
+#define MC_COF_AELevel5_58                       (MCPARAMID)( 9736 << 14)
+#define MC_COF_AELevel6_58                       (MCPARAMID)( 9737 << 14)
+#define MC_COF_AELevel7_58                       (MCPARAMID)( 9738 << 14)
+#define MC_COF_AELevel8_58                       (MCPARAMID)( 9739 << 14)
+#define MC_COF_AELevel1_59                       (MCPARAMID)( 9740 << 14)
+#define MC_COF_AELevel2_59                       (MCPARAMID)( 9741 << 14)
+#define MC_COF_AELevel3_59                       (MCPARAMID)( 9742 << 14)
+#define MC_COF_AELevel4_59                       (MCPARAMID)( 9743 << 14)
+#define MC_COF_AELevel5_59                       (MCPARAMID)( 9744 << 14)
+#define MC_COF_AELevel6_59                       (MCPARAMID)( 9745 << 14)
+#define MC_COF_AELevel7_59                       (MCPARAMID)( 9746 << 14)
+#define MC_COF_AELevel8_59                       (MCPARAMID)( 9747 << 14)
+#define MC_COF_AELevel1_60                       (MCPARAMID)( 9748 << 14)
+#define MC_COF_AELevel2_60                       (MCPARAMID)( 9749 << 14)
+#define MC_COF_AELevel3_60                       (MCPARAMID)( 9750 << 14)
+#define MC_COF_AELevel4_60                       (MCPARAMID)( 9751 << 14)
+#define MC_COF_AELevel5_60                       (MCPARAMID)( 9752 << 14)
+#define MC_COF_AELevel6_60                       (MCPARAMID)( 9753 << 14)
+#define MC_COF_AELevel7_60                       (MCPARAMID)( 9754 << 14)
+#define MC_COF_AELevel8_60                       (MCPARAMID)( 9755 << 14)
+#define MC_COF_AELevel1_61                       (MCPARAMID)( 9756 << 14)
+#define MC_COF_AELevel2_61                       (MCPARAMID)( 9757 << 14)
+#define MC_COF_AELevel3_61                       (MCPARAMID)( 9758 << 14)
+#define MC_COF_AELevel4_61                       (MCPARAMID)( 9759 << 14)
+#define MC_COF_AELevel5_61                       (MCPARAMID)( 9760 << 14)
+#define MC_COF_AELevel6_61                       (MCPARAMID)( 9761 << 14)
+#define MC_COF_AELevel7_61                       (MCPARAMID)( 9762 << 14)
+#define MC_COF_AELevel8_61                       (MCPARAMID)( 9763 << 14)
+#define MC_COF_AELevel1_62                       (MCPARAMID)( 9764 << 14)
+#define MC_COF_AELevel2_62                       (MCPARAMID)( 9765 << 14)
+#define MC_COF_AELevel3_62                       (MCPARAMID)( 9766 << 14)
+#define MC_COF_AELevel4_62                       (MCPARAMID)( 9767 << 14)
+#define MC_COF_AELevel5_62                       (MCPARAMID)( 9768 << 14)
+#define MC_COF_AELevel6_62                       (MCPARAMID)( 9769 << 14)
+#define MC_COF_AELevel7_62                       (MCPARAMID)( 9770 << 14)
+#define MC_COF_AELevel8_62                       (MCPARAMID)( 9771 << 14)
+#define MC_COF_AELevel1_63                       (MCPARAMID)( 9772 << 14)
+#define MC_COF_AELevel2_63                       (MCPARAMID)( 9773 << 14)
+#define MC_COF_AELevel3_63                       (MCPARAMID)( 9774 << 14)
+#define MC_COF_AELevel4_63                       (MCPARAMID)( 9775 << 14)
+#define MC_COF_AELevel5_63                       (MCPARAMID)( 9776 << 14)
+#define MC_COF_AELevel6_63                       (MCPARAMID)( 9777 << 14)
+#define MC_COF_AELevel7_63                       (MCPARAMID)( 9778 << 14)
+#define MC_COF_AELevel8_63                       (MCPARAMID)( 9779 << 14)
+#define MC_WBO_Status_OK                           1
+#define MC_WBO_Status_NOT_OK                       2
+#define MC_GrabberError_ThresholdError           (MCPARAMID)( 9780 << 14)
+#define MC_Bidul                                 (MCPARAMID)( 9781 << 14)
+#define MC_InputStyle_TTLHiZ                      13
+#define MC_InputStyle_TTLPD                       14
+#define MC_InputStyle_RS485                       15
+#define MC_InputStyle_DTTL                        16
+#define MC_Connector_C                            37
+#define MC_Connector_D                            38
+#define MC_SYNC_Line5_Field1_Dur                 (MCPARAMID)( 9782 << 14)
+#define MC_ACQZ1_L4RPT                           (MCPARAMID)( 9783 << 14)
+#define MC__BoardType__EXPRESS                    31
+#define MC_PoCL_Mode                             (MCPARAMID)( 9784 << 14)
+#define MC_PoCL_Mode_AUTO                          1
+#define MC_PoCL_Mode_OFF                           2
+#define MC_TapGeometry_4XE                        38
+#define MC_CLCAM_Geometry_TG_4XE                  23
+#define MC_AssyConfig_c                           17
+#define MC_AssyConfig_QUADXTAPEND                 18
+#define MC_ChannelTopology_QUADXTAPEND            17
+#define MC_HactiveRef_Px                         (MCPARAMID)( 9785 << 14)
+#define MC_VactiveRef_Ln                         (MCPARAMID)( 9786 << 14)
+#define MC_CalPatYValueInit                      (MCPARAMID)( 9787 << 14)
+#define MC_CalPatYValueVGap                      (MCPARAMID)( 9788 << 14)
+#define MC_CalPatYValueHGap                      (MCPARAMID)( 9789 << 14)
+#define MC_FEC_CalPatYValueIinit                 (MCPARAMID)( 9790 << 14)
+#define MC_FEC_CalPatYValueVGap                  (MCPARAMID)( 9791 << 14)
+#define MC_FEC_CalPatYValueHGap                  (MCPARAMID)( 9792 << 14)
+#define MC_FEC_CalPatYValueInit                  (MCPARAMID)( 9793 << 14)
+#define MC_SimBayerDecoderEnabled                (MCPARAMID)( 9794 << 14)
+#define MC_SimBayerDecoderEnabled_YES              1
+#define MC_SimBayerDecoderEnabled_NO               2
+#define MC_SimLuminanceBlenderEnabled            (MCPARAMID)( 9795 << 14)
+#define MC_SimLuminanceBlenderEnabled_YES          1
+#define MC_SimLuminanceBlenderEnabled_NO           2
+#define MC_SimWoiNb                              (MCPARAMID)( 9796 << 14)
+#define MC_AutomaticHfrSwitch                    (MCPARAMID)( 9797 << 14)
+#define MC_AutomaticHfrSwitch_ENABLE               1
+#define MC_AutomaticHfrSwitch_DISABLE              2
+#define MC_SimCameraDataWidth                    (MCPARAMID)( 9798 << 14)
+#define MC_SimCameraDataWidth_8BIT                 1
+#define MC_SimCameraDataWidth_10BIT                2
+#define MC_SimCameraDataWidth_12BIT                3
+#define MC_SimCameraDataWidth_14BIT                4
+#define MC_SimCameraDataWidth_16BIT                5
+#define MC__BoardName                            (MCPARAMID)( 9799 << 14)
+#define MC__BoardName__VALUE                       1
+#define MC__BoardName__EXPERT                      2
+#define MC__BoardName__COLORSCAN                   3
+#define MC__BoardName__AVENUE                      4
+#define MC__BoardName__CFA                         5
+#define MC__BoardName__EXPRESS                     6
+#define MC_PoCL_Mode_Filter                      (MCPARAMID)( 9800 << 14)
+#define MC__DCL_RawGrabbing                      (MCPARAMID)( 9801 << 14)
+#define MC__DCL_RawGrabbing_ENABLE                 1
+#define MC__DCL_RawGrabbing_DISABLE                2
+#define MC_PoCL_GroundJumper                     (MCPARAMID)( 9802 << 14)
+#define MC_PoCL_GroundJumper_CLOSE                 1
+#define MC_PoCL_GroundJumper_OPEN                  2
+#define MC_PoCL_GroundJumper_Filter              (MCPARAMID)( 9803 << 14)
+#define MC__DRS_CACQ_FxLADN                        4
+#define MC__DRS_CACQ_FxLADG                        5
+#define MC__DRS_CACQ_FCLNDN                        6
+#define MC__DRS_CACQ_FCLNDG                        7
+#define MC__DRS_CACQ_FALADN                        8
+#define MC__DRS_CACQ_FALADG                        9
+#define MC__DRS_CACQ_FCLADN                       10
+#define MC__DRS_CACQ_FCLADG                       11
+#define MC__HDC_DCNT_PlusOne                     (MCPARAMID)( 9804 << 14)
+#define MC__FBL_Mode                             (MCPARAMID)( 9805 << 14)
+#define MC__FBL_Mode_MANUAL                        1
+#define MC__FBL_Mode_AUTO                          2
+#define MC__FBL_AFL_Value                        (MCPARAMID)( 9806 << 14)
+#define MC_FrameBuffer_AlmostFullLevel           (MCPARAMID)( 9807 << 14)
+#define MC_FrameBuffer_HalfFullLevel             (MCPARAMID)( 9808 << 14)
+#define MC__FBL_HFL_Value                        (MCPARAMID)( 9809 << 14)
+#define MC_IDP_LeadingPixelCompCnt_Win1          (MCPARAMID)( 9810 << 14)
+#define MC_IDP_LeadingPixelCompCnt_Win2          (MCPARAMID)( 9811 << 14)
+#define MC_IDP_LeadingPixelCompCnt_Win3          (MCPARAMID)( 9812 << 14)
+#define MC_IDP_LeadingPixelCompCnt_Win4          (MCPARAMID)( 9813 << 14)
+#define MC_IDP_LeadingDataCnt_Lane1              (MCPARAMID)( 9814 << 14)
+#define MC_IDP_LeadingDataCnt_Lane2              (MCPARAMID)( 9815 << 14)
+#define MC_IDP_LeadingDataCnt_Lane3              (MCPARAMID)( 9816 << 14)
+#define MC_IDP_LeadingDataCnt_Lane4              (MCPARAMID)( 9817 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic1       (MCPARAMID)( 9818 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic2       (MCPARAMID)( 9819 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic3       (MCPARAMID)( 9820 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic4       (MCPARAMID)( 9821 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic5       (MCPARAMID)( 9822 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic6       (MCPARAMID)( 9823 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic7       (MCPARAMID)( 9824 << 14)
+#define MC_WIC_StartFrameAddress_byte_Wic8       (MCPARAMID)( 9825 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic1         (MCPARAMID)( 9826 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic2         (MCPARAMID)( 9827 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic3         (MCPARAMID)( 9828 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic4         (MCPARAMID)( 9829 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic5         (MCPARAMID)( 9830 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic6         (MCPARAMID)( 9831 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic7         (MCPARAMID)( 9832 << 14)
+#define MC_WIC_StartFrameAddress_mw_Wic8         (MCPARAMID)( 9833 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic1           (MCPARAMID)( 9834 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic2           (MCPARAMID)( 9835 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic3           (MCPARAMID)( 9836 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic4           (MCPARAMID)( 9837 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic5           (MCPARAMID)( 9838 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic6           (MCPARAMID)( 9839 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic7           (MCPARAMID)( 9840 << 14)
+#define MC_WIC_NextLineAddress_mw_Wic8           (MCPARAMID)( 9841 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic1          (MCPARAMID)( 9842 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic2          (MCPARAMID)( 9843 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic3          (MCPARAMID)( 9844 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic4          (MCPARAMID)( 9845 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic5          (MCPARAMID)( 9846 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic6          (MCPARAMID)( 9847 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic7          (MCPARAMID)( 9848 << 14)
+#define MC_WIC_NextPixelAddress_mw_Wic8          (MCPARAMID)( 9849 << 14)
+#define MC__Board_Type__SYMPHONY                   9
+#define MC_CodeTarget                            (MCPARAMID)( 9850 << 14)
+#define MC__FPGA_Model_SYMPHONY_Q                  5
+#define MC_LineRateMode_EXPOSE                     5
+#define MC_Camera_VCC_G22V31CL_PoCL              220
+#define MC_Cable_CL_C05                          149
+#define MC_Cable_CL_C06                          150
+#define MC_CableName_Camera_Link_Standard_PoCL    94
+#define MC_CableName_Camera_Link_Miniature_PoCL   95
+#define MC_PinSTA_Source                         (MCPARAMID)( 9851 << 14)
+#define MC_PinSTA_Source_ON                        1
+#define MC_PinSTA_Source_OFF                       2
+#define MC_PinSTA_Source_STROBE                    3
+#define MC_PinSTA_Source_UNKNOWN                   4
+#define MC_PinSTB_Source                         (MCPARAMID)( 9852 << 14)
+#define MC_PinSTB_Source_ON                        1
+#define MC_PinSTB_Source_OFF                       2
+#define MC_PinSTB_Source_STROBE                    3
+#define MC_PinSTB_Source_UNKNOWN                   4
+#define MC_PinSTC_Source                         (MCPARAMID)( 9853 << 14)
+#define MC_PinSTC_Source_ON                        1
+#define MC_PinSTC_Source_OFF                       2
+#define MC_PinSTC_Source_STROBE                    3
+#define MC_PinSTC_Source_UNKNOWN                   4
+#define MC_PinSTD_Source                         (MCPARAMID)( 9854 << 14)
+#define MC_PinSTD_Source_ON                        1
+#define MC_PinSTD_Source_OFF                       2
+#define MC_PinSTD_Source_STROBE                    3
+#define MC_PinSTD_Source_UNKNOWN                   4
+#define MC_TrigCtl_TTLHiz                         13
+#define MC_TrigCtl_TTLPD                          14
+#define MC_TrigCtl_RS485                          15
+#define MC_TrigCtl_DTTL                           16
+#define MC__TrigLine_TRA                          32
+#define MC__TrigLine_TRB                          33
+#define MC__TrigLine_TRC                          34
+#define MC__TrigLine_TRD                          35
+#define MC__StrobeLine_STB                        17
+#define MC__StrobeLine_STC                        18
+#define MC__StrobeLine_STD                        19
+#define MC_InputPinName_TRA                       84
+#define MC_InputPinName_TRB                       85
+#define MC_InputPinName_TRC                       86
+#define MC_InputPinName_TRD                       87
+#define MC_InputPinName_FIN1                      88
+#define MC_InputPinName_FIN2                      89
+#define MC_InputPinName_FIN3                      90
+#define MC_InputPinName_FIN4                      91
+#define MC_ConnectorName_CAMA                     28
+#define MC_ConnectorName_CAMB                     29
+#define MC_ConnectorName_CAMC                     30
+#define MC_ConnectorName_CAMD                     31
+#define MC_ConnectorName_FACTORY                  32
+#define MC_OutputPinName_STB                      87
+#define MC_OutputPinName_STC                      88
+#define MC_OutputPinName_STD                      89
+#define MC_OutputPinName_FOUT1                    90
+#define MC_OutputPinName_FOUT2                    91
+#define MC_OutputPinName_FOUT3                    92
+#define MC_OutputPinName_FOUT4                    93
+#define MC_OutputPinName_FOUT5                    94
+#define MC_OutputPinName_FOUT6                    95
+#define MC_OutputPinName_FOUT7                    96
+#define MC_OutputPinName_FOUT8                    97
+#define MC_OutputPinName_FOUT9                    98
+#define MC_OutputPinName_FOUT10                   99
+#define MC_OutputPinName_FOUT11                  100
+#define MC_OutputPinName_FOUT12                  101
+#define MC_InputStyle_Filter_42                  (MCPARAMID)( 9855 << 14)
+#define MC_InputStyle_Filter_43                  (MCPARAMID)( 9856 << 14)
+#define MC_InputStyle_Filter_44                  (MCPARAMID)( 9857 << 14)
+#define MC_InputStyle_Filter_45                  (MCPARAMID)( 9858 << 14)
+#define MC_InputStyle_Filter_46                  (MCPARAMID)( 9859 << 14)
+#define MC_InputConfig_Filter_52                 (MCPARAMID)( 9860 << 14)
+#define MC_InputStyle_Filter_52                  (MCPARAMID)( 9861 << 14)
+#define MC_InputConfig_Filter_53                 (MCPARAMID)( 9862 << 14)
+#define MC_InputStyle_Filter_53                  (MCPARAMID)( 9863 << 14)
+#define MC_InputConfig_Filter_54                 (MCPARAMID)( 9864 << 14)
+#define MC_InputStyle_Filter_54                  (MCPARAMID)( 9865 << 14)
+#define MC_InputConfig_Filter_55                 (MCPARAMID)( 9866 << 14)
+#define MC_InputStyle_Filter_55                  (MCPARAMID)( 9867 << 14)
+#define MC_InputConfig_Filter_56                 (MCPARAMID)( 9868 << 14)
+#define MC_InputStyle_Filter_56                  (MCPARAMID)( 9869 << 14)
+#define MC_OutputState_20_LOOP1                    4
+#define MC_OutputState_20_LOOP2                    5
+#define MC_OutputState_42_LOOP1                    4
+#define MC_OutputState_42_LOOP2                    5
+#define MC_OutputStyle_Filter_42                 (MCPARAMID)( 9870 << 14)
+#define MC_OutputConfig_Filter_43                (MCPARAMID)( 9871 << 14)
+#define MC_OutputState_Filter_43                 (MCPARAMID)( 9872 << 14)
+#define MC_OutputState_43                        (MCPARAMID)( 9873 << 14)
+#define MC_OutputState_43_HOLD                     1
+#define MC_OutputState_43_LOW                      2
+#define MC_OutputState_43_HIGH                     3
+#define MC_OutputState_43_LOOP1                    4
+#define MC_OutputState_43_LOOP2                    5
+#define MC_OutputStyle_Filter_43                 (MCPARAMID)( 9874 << 14)
+#define MC_OutputConfig_Filter_44                (MCPARAMID)( 9875 << 14)
+#define MC_OutputState_Filter_44                 (MCPARAMID)( 9876 << 14)
+#define MC_OutputState_44                        (MCPARAMID)( 9877 << 14)
+#define MC_OutputState_44_HOLD                     1
+#define MC_OutputState_44_LOW                      2
+#define MC_OutputState_44_HIGH                     3
+#define MC_OutputState_44_LOOP1                    4
+#define MC_OutputState_44_LOOP2                    5
+#define MC_OutputStyle_Filter_44                 (MCPARAMID)( 9878 << 14)
+#define MC_OutputConfig_Filter_45                (MCPARAMID)( 9879 << 14)
+#define MC_OutputState_Filter_45                 (MCPARAMID)( 9880 << 14)
+#define MC_OutputState_45                        (MCPARAMID)( 9881 << 14)
+#define MC_OutputState_45_HOLD                     1
+#define MC_OutputState_45_LOW                      2
+#define MC_OutputState_45_HIGH                     3
+#define MC_OutputState_45_LOOP1                    4
+#define MC_OutputState_45_LOOP2                    5
+#define MC_OutputStyle_Filter_45                 (MCPARAMID)( 9882 << 14)
+#define MC_OutputConfig_Filter_46                (MCPARAMID)( 9883 << 14)
+#define MC_OutputState_Filter_46                 (MCPARAMID)( 9884 << 14)
+#define MC_OutputState_46                        (MCPARAMID)( 9885 << 14)
+#define MC_OutputState_46_HOLD                     1
+#define MC_OutputState_46_LOW                      2
+#define MC_OutputState_46_HIGH                     3
+#define MC_OutputState_46_LOOP1                    4
+#define MC_OutputState_46_LOOP2                    5
+#define MC_OutputStyle_Filter_46                 (MCPARAMID)( 9886 << 14)
+#define MC_OutputState_52_LOOP1                    4
+#define MC_OutputState_52_LOOP2                    5
+#define MC_OutputStyle_Filter_52                 (MCPARAMID)( 9887 << 14)
+#define MC_OutputState_53_LOOP1                    4
+#define MC_OutputState_53_LOOP2                    5
+#define MC_OutputStyle_Filter_53                 (MCPARAMID)( 9888 << 14)
+#define MC_OutputState_54_LOOP1                    4
+#define MC_OutputState_54_LOOP2                    5
+#define MC_OutputStyle_Filter_54                 (MCPARAMID)( 9889 << 14)
+#define MC_OutputState_55_LOOP1                    4
+#define MC_OutputState_55_LOOP2                    5
+#define MC_OutputStyle_Filter_55                 (MCPARAMID)( 9890 << 14)
+#define MC_OutputState_56_LOOP1                    4
+#define MC_OutputState_56_LOOP2                    5
+#define MC_OutputStyle_Filter_56                 (MCPARAMID)( 9891 << 14)
+#define MC_OutputConfig_Filter_61                (MCPARAMID)( 9892 << 14)
+#define MC_OutputState_Filter_61                 (MCPARAMID)( 9893 << 14)
+#define MC_OutputState_61                        (MCPARAMID)( 9894 << 14)
+#define MC_OutputState_61_HOLD                     1
+#define MC_OutputState_61_LOW                      2
+#define MC_OutputState_61_HIGH                     3
+#define MC_OutputState_61_LOOP1                    4
+#define MC_OutputState_61_LOOP2                    5
+#define MC_OutputStyle_Filter_61                 (MCPARAMID)( 9895 << 14)
+#define MC_OutputConfig_Filter_62                (MCPARAMID)( 9896 << 14)
+#define MC_OutputState_Filter_62                 (MCPARAMID)( 9897 << 14)
+#define MC_OutputState_62                        (MCPARAMID)( 9898 << 14)
+#define MC_OutputState_62_HOLD                     1
+#define MC_OutputState_62_LOW                      2
+#define MC_OutputState_62_HIGH                     3
+#define MC_OutputState_62_LOOP1                    4
+#define MC_OutputState_62_LOOP2                    5
+#define MC_OutputStyle_Filter_62                 (MCPARAMID)( 9899 << 14)
+#define MC_OutputConfig_Filter_63                (MCPARAMID)( 9900 << 14)
+#define MC_OutputState_Filter_63                 (MCPARAMID)( 9901 << 14)
+#define MC_OutputState_63                        (MCPARAMID)( 9902 << 14)
+#define MC_OutputState_63_HOLD                     1
+#define MC_OutputState_63_LOW                      2
+#define MC_OutputState_63_HIGH                     3
+#define MC_OutputState_63_LOOP1                    4
+#define MC_OutputState_63_LOOP2                    5
+#define MC_OutputStyle_Filter_63                 (MCPARAMID)( 9903 << 14)
+#define MC_OutputConfig_Filter_64                (MCPARAMID)( 9904 << 14)
+#define MC_OutputState_Filter_64                 (MCPARAMID)( 9905 << 14)
+#define MC_OutputState_64                        (MCPARAMID)( 9906 << 14)
+#define MC_OutputState_64_HOLD                     1
+#define MC_OutputState_64_LOW                      2
+#define MC_OutputState_64_HIGH                     3
+#define MC_OutputState_64_LOOP1                    4
+#define MC_OutputState_64_LOOP2                    5
+#define MC_OutputStyle_Filter_64                 (MCPARAMID)( 9907 << 14)
+#define MC_OutputConfig_Filter_65                (MCPARAMID)( 9908 << 14)
+#define MC_OutputState_Filter_65                 (MCPARAMID)( 9909 << 14)
+#define MC_OutputState_65                        (MCPARAMID)( 9910 << 14)
+#define MC_OutputState_65_HOLD                     1
+#define MC_OutputState_65_LOW                      2
+#define MC_OutputState_65_HIGH                     3
+#define MC_OutputState_65_LOOP1                    4
+#define MC_OutputState_65_LOOP2                    5
+#define MC_OutputStyle_Filter_65                 (MCPARAMID)( 9911 << 14)
+#define MC_OutputConfig_Filter_66                (MCPARAMID)( 9912 << 14)
+#define MC_OutputState_Filter_66                 (MCPARAMID)( 9913 << 14)
+#define MC_OutputState_66                        (MCPARAMID)( 9914 << 14)
+#define MC_OutputState_66_HOLD                     1
+#define MC_OutputState_66_LOW                      2
+#define MC_OutputState_66_HIGH                     3
+#define MC_OutputState_66_LOOP1                    4
+#define MC_OutputState_66_LOOP2                    5
+#define MC_OutputStyle_Filter_66                 (MCPARAMID)( 9915 << 14)
+#define MC_OutputConfig_Filter_67                (MCPARAMID)( 9916 << 14)
+#define MC_OutputState_Filter_67                 (MCPARAMID)( 9917 << 14)
+#define MC_OutputState_67                        (MCPARAMID)( 9918 << 14)
+#define MC_OutputState_67_HOLD                     1
+#define MC_OutputState_67_LOW                      2
+#define MC_OutputState_67_HIGH                     3
+#define MC_OutputState_67_LOOP1                    4
+#define MC_OutputState_67_LOOP2                    5
+#define MC_OutputStyle_Filter_67                 (MCPARAMID)( 9919 << 14)
+#define MC_OutputConfig_Filter_68                (MCPARAMID)( 9920 << 14)
+#define MC_OutputState_Filter_68                 (MCPARAMID)( 9921 << 14)
+#define MC_OutputState_68                        (MCPARAMID)( 9922 << 14)
+#define MC_OutputState_68_HOLD                     1
+#define MC_OutputState_68_LOW                      2
+#define MC_OutputState_68_HIGH                     3
+#define MC_OutputState_68_LOOP1                    4
+#define MC_OutputState_68_LOOP2                    5
+#define MC_OutputStyle_Filter_68                 (MCPARAMID)( 9923 << 14)
+#define MC_OutputConfig_Filter_69                (MCPARAMID)( 9924 << 14)
+#define MC_OutputState_Filter_69                 (MCPARAMID)( 9925 << 14)
+#define MC_OutputState_69                        (MCPARAMID)( 9926 << 14)
+#define MC_OutputState_69_HOLD                     1
+#define MC_OutputState_69_LOW                      2
+#define MC_OutputState_69_HIGH                     3
+#define MC_OutputState_69_LOOP1                    4
+#define MC_OutputState_69_LOOP2                    5
+#define MC_OutputStyle_Filter_69                 (MCPARAMID)( 9927 << 14)
+#define MC_OutputConfig_Filter_70                (MCPARAMID)( 9928 << 14)
+#define MC_OutputState_Filter_70                 (MCPARAMID)( 9929 << 14)
+#define MC_OutputState_70                        (MCPARAMID)( 9930 << 14)
+#define MC_OutputState_70_HOLD                     1
+#define MC_OutputState_70_LOW                      2
+#define MC_OutputState_70_HIGH                     3
+#define MC_OutputState_70_LOOP1                    4
+#define MC_OutputState_70_LOOP2                    5
+#define MC_OutputStyle_Filter_70                 (MCPARAMID)( 9931 << 14)
+#define MC_OutputConfig_Filter_71                (MCPARAMID)( 9932 << 14)
+#define MC_OutputState_Filter_71                 (MCPARAMID)( 9933 << 14)
+#define MC_OutputState_71                        (MCPARAMID)( 9934 << 14)
+#define MC_OutputState_71_HOLD                     1
+#define MC_OutputState_71_LOW                      2
+#define MC_OutputState_71_HIGH                     3
+#define MC_OutputState_71_LOOP1                    4
+#define MC_OutputState_71_LOOP2                    5
+#define MC_OutputStyle_Filter_71                 (MCPARAMID)( 9935 << 14)
+#define MC_OutputConfig_Filter_72                (MCPARAMID)( 9936 << 14)
+#define MC_OutputState_Filter_72                 (MCPARAMID)( 9937 << 14)
+#define MC_OutputState_72                        (MCPARAMID)( 9938 << 14)
+#define MC_OutputState_72_HOLD                     1
+#define MC_OutputState_72_LOW                      2
+#define MC_OutputState_72_HIGH                     3
+#define MC_OutputState_72_LOOP1                    4
+#define MC_OutputState_72_LOOP2                    5
+#define MC_OutputStyle_Filter_72                 (MCPARAMID)( 9939 << 14)
+#define MC_FLT_FIR3S                               3
+#define MC_FLT_FIR5S                               4
+#define MC_FLT_Filter                            (MCPARAMID)( 9940 << 14)
+#define MC_PoCL_Status                           (MCPARAMID)( 9941 << 14)
+#define MC_PoCL_Status_NO_CAMERA                   1
+#define MC_PoCL_Status_CONVENTIONAL_CAMERA         2
+#define MC_PoCL_Status_PoCL_CAMERA                 3
+#define MC_PoCL_Status_Filter                    (MCPARAMID)( 9942 << 14)
+#define MC_PoCL_PowerInput                       (MCPARAMID)( 9943 << 14)
+#define MC_PoCL_PowerInput_AUTO                    1
+#define MC_PoCL_PowerInput_OFF                     2
+#define MC_PoCL_Filter                           (MCPARAMID)( 9944 << 14)
+#define MC_FrameBuffer_AlmostFullLevel_Ln        (MCPARAMID)( 9945 << 14)
+#define MC_FrameBuffer_HalfFullLevel_Ln          (MCPARAMID)( 9946 << 14)
+#define MC_CommandBuffer_AlmostFullLevel_Ln      (MCPARAMID)( 9947 << 14)
+#define MC_CommandBuffer_HalfFullLevel_Ln        (MCPARAMID)( 9948 << 14)
+#define MC_FrameBufferSize_byte                  (MCPARAMID)( 9949 << 14)
+#define MC_WIC_WindowPitch_byte                  (MCPARAMID)( 9950 << 14)
+#define MC_FrameBufferFull                       (MCPARAMID)( 9951 << 14)
+#define MC_GrabberOverrun_FrameBuffer            (MCPARAMID)( 9952 << 14)
+#define MC_GrabberError_Vdma_Incoherency         (MCPARAMID)( 9953 << 14)
+#define MC_GrabberError_Vdma_RepairStream        (MCPARAMID)( 9954 << 14)
+#define MC_GrabberError_Vdma_StreamFifoOvrUdr    (MCPARAMID)( 9955 << 14)
+#define MC_GrabberError_IntractionDpFifoOvr      (MCPARAMID)( 9956 << 14)
+#define MC_GrabberError_AcqVsXfr_Incoherency     (MCPARAMID)( 9957 << 14)
+#define MC_GrabberError_ADRCommandFIFO_Incoherency_2 (MCPARAMID)( 9958 << 14)
+#define MC_GrabberError_ADRCommandFIFO_Incoherency_1 (MCPARAMID)( 9959 << 14)
+#define MC_GrabberOverrun_Vdma_EarlyEndOfXfr     (MCPARAMID)( 9960 << 14)
+#define MC_SurfacePlaneName_YUV                    8
+#define MC_SurfacePlaneName_U                      9
+#define MC_SurfacePlaneName_V                     10
+#define MC_GrabberError_Number_19                (MCPARAMID)( 9961 << 14)
+#define MC_GrabberError_Number_16                (MCPARAMID)( 9962 << 14)
+#define MC_GrabberError_Number_09                (MCPARAMID)( 9963 << 14)
+#define MC_GrabberError_Number_08                (MCPARAMID)( 9964 << 14)
+#define MC_GrabberError_Number_07                (MCPARAMID)( 9965 << 14)
+#define MC_GrabberError_Number_06                (MCPARAMID)( 9966 << 14)
+#define MC_GrabberError_Number_05                (MCPARAMID)( 9967 << 14)
+#define MC_GrabberError_Number_04                (MCPARAMID)( 9968 << 14)
+#define MC_GrabberError_Number_03                (MCPARAMID)( 9969 << 14)
+#define MC_GrabberError_Number_02                (MCPARAMID)( 9970 << 14)
+#define MC_GrabberError_Number_01                (MCPARAMID)( 9971 << 14)
+#define MC_GrabberOverrun_Number_09              (MCPARAMID)( 9972 << 14)
+#define MC_GrabberOverrun_Number_08              (MCPARAMID)( 9973 << 14)
+#define MC_GrabberOverrun_Number_07              (MCPARAMID)( 9974 << 14)
+#define MC_GrabberOverrun_Number_06              (MCPARAMID)( 9975 << 14)
+#define MC_GrabberOverrun_Number_05              (MCPARAMID)( 9976 << 14)
+#define MC_GrabberOverrun_Number_04              (MCPARAMID)( 9977 << 14)
+#define MC_GrabberOverrun_Number_03              (MCPARAMID)( 9978 << 14)
+#define MC_GrabberOverrun_Number_02              (MCPARAMID)( 9979 << 14)
+#define MC_GrabberOverrun_Number_01              (MCPARAMID)( 9980 << 14)
+#define MC_ColorFormat_RGB64                     107
+#define MC_OutputFormatterConfig_RGB64            47
+#define MC_NumOfAssy                             (MCPARAMID)( 9981 << 14)
+#define MC_NumOfAssy_ONE                           1
+#define MC_NumOfAssy_TWO                           2
+#define MC_NumOfAssy_THREE                         3
+#define MC_NumOfAssy_FOUR                          4
+#define MC_NumOfAssy_SIX                           5
+#define MC_NumOfAssy_EIGHT                         6
+#define MC_NumOfWindows                          (MCPARAMID)( 9982 << 14)
+#define MC_NumOfWindows_ONE                        1
+#define MC_NumOfWindows_TWO                        2
+#define MC_NumOfWindows_THREE                      3
+#define MC_NumOfWindows_FOUR                       4
+#define MC_NumOfWindows_EIGHT                      5
+#define MC_NumOfAssyPerWindow                    (MCPARAMID)( 9983 << 14)
+#define MC_GrabberError_Vdma_1                   (MCPARAMID)( 9984 << 14)
+#define MC_GrabberError_Vdma_2                   (MCPARAMID)( 9985 << 14)
+#define MC_GrabberError_Vdma_3                   (MCPARAMID)( 9986 << 14)
+#define MC_GrabberError_Intraction               (MCPARAMID)( 9987 << 14)
+#define MC_GrabberError_AcqVsXfr                 (MCPARAMID)( 9988 << 14)
+#define MC_GrabberError_AdrCmdFifo_2             (MCPARAMID)( 9989 << 14)
+#define MC_GrabberError_AdrCmdFifo_1             (MCPARAMID)( 9990 << 14)
+#define MC__CDA_REFASSYNR                        (MCPARAMID)( 9991 << 14)
+#define MC__CDA_REFASSYNR_LOWEST                   1
+#define MC__CDA_REFASSYNR_HIGHEST                  2
+#define MC_SeqLength_Ln_WEB                      (MCPARAMID)( 9992 << 14)
+#define MC_SeqLength_Ln_LONGPAGE                 (MCPARAMID)( 9993 << 14)
+#define MC_Toto_TITI                               3
+#define MC_BoardFamily                           (MCPARAMID)( 9994 << 14)
+#define MC_BoardFamily_PICOLO_VIDEOBRIDGE          1
+#define MC_BoardMajorType                        (MCPARAMID)( 9995 << 14)
+#define MC_BoardMajorType_PICOLO_DILIGENT          1
+#define MC_BoardMajorType_PICOLO_ALERT             2
+#define MC__PM_N0_Float                          (MCPARAMID)( 9996 << 14)
+#define MC_RCR_Effective                         (MCPARAMID)( 9997 << 14)
+#define MC__PM_N0_Max                            (MCPARAMID)( 9998 << 14)
+#define MC__DynamicFineShift                     (MCPARAMID)( 9999 << 14)
+#define MC__DynamicFineShift_Enable              (MCPARAMID)(10000 << 14)
+#define MC__DynamicFineShift_Enable_ON             1
+#define MC__DynamicFineShift_Enable_OFF            2
+#define MC__DynamicFineShift_Enable_Filt         (MCPARAMID)(10001 << 14)
+#define MC_InputConfig_Filter_61                 (MCPARAMID)(10002 << 14)
+#define MC_InputStyle_Filter_61                  (MCPARAMID)(10003 << 14)
+#define MC_InputConfig_Filter_62                 (MCPARAMID)(10004 << 14)
+#define MC_InputStyle_Filter_62                  (MCPARAMID)(10005 << 14)
+#define MC_InputConfig_Filter_63                 (MCPARAMID)(10006 << 14)
+#define MC_InputStyle_Filter_63                  (MCPARAMID)(10007 << 14)
+#define MC_InputConfig_Filter_64                 (MCPARAMID)(10008 << 14)
+#define MC_InputStyle_Filter_64                  (MCPARAMID)(10009 << 14)
+#define MC_InputFilter_Filter_1                  (MCPARAMID)(10010 << 14)
+#define MC_InputFilter_Filter_2                  (MCPARAMID)(10011 << 14)
+#define MC_InputFilter_Filter_3                  (MCPARAMID)(10012 << 14)
+#define MC_InputFilter_Filter_4                  (MCPARAMID)(10013 << 14)
+#define MC_InputFilter_Filter_17                 (MCPARAMID)(10014 << 14)
+#define MC_InputFilter_Filter_18                 (MCPARAMID)(10015 << 14)
+#define MC_InputFilter_Filter_19                 (MCPARAMID)(10016 << 14)
+#define MC_InputFilter_Filter_20                 (MCPARAMID)(10017 << 14)
+#define MC_InputFilter_Filter_22                 (MCPARAMID)(10018 << 14)
+#define MC_InputFilter_Filter_23                 (MCPARAMID)(10019 << 14)
+#define MC_InputFilter_Filter_24                 (MCPARAMID)(10020 << 14)
+#define MC_InputFilter_Filter_25                 (MCPARAMID)(10021 << 14)
+#define MC_InputFilter_Filter_26                 (MCPARAMID)(10022 << 14)
+#define MC_InputFilter_Filter_32                 (MCPARAMID)(10023 << 14)
+#define MC_InputFilter_Filter_33                 (MCPARAMID)(10024 << 14)
+#define MC_InputFilter_Filter_34                 (MCPARAMID)(10025 << 14)
+#define MC_InputFilter_Filter_35                 (MCPARAMID)(10026 << 14)
+#define MC_InputFilter_Filter_36                 (MCPARAMID)(10027 << 14)
+#define MC_InputFilter_Filter_42                 (MCPARAMID)(10028 << 14)
+#define MC_InputFilter_Filter_43                 (MCPARAMID)(10029 << 14)
+#define MC_InputFilter_Filter_44                 (MCPARAMID)(10030 << 14)
+#define MC_InputFilter_Filter_45                 (MCPARAMID)(10031 << 14)
+#define MC_InputFilter_Filter_46                 (MCPARAMID)(10032 << 14)
+#define MC_InputFilter_Filter_52                 (MCPARAMID)(10033 << 14)
+#define MC_InputFilter_Filter_53                 (MCPARAMID)(10034 << 14)
+#define MC_InputFilter_Filter_54                 (MCPARAMID)(10035 << 14)
+#define MC_InputFilter_Filter_55                 (MCPARAMID)(10036 << 14)
+#define MC_InputFilter_Filter_56                 (MCPARAMID)(10037 << 14)
+#define MC_SerialControlC                        (MCPARAMID)(10038 << 14)
+#define MC_SerialControlD                        (MCPARAMID)(10039 << 14)
+#define MC_PoCL_PowerInput_ON                      3
+#define MC_BoardFamily_D3Series                    2
+#define MC_BoardFamily_GrablinkSeries              3
+#define MC_BoardFamily_PicoloSeries                4
+#define MC_AbsGrabberIx                          (MCPARAMID)(10040 << 14)
+#define MC_Sim_PartialMode                       (MCPARAMID)(10041 << 14)
+#define MC_Sim_PartialMode_TRUE                    1
+#define MC_Sim_PartialMode_FALSE                   2
+#define MC_InputFilter_Filter_28                 (MCPARAMID)(10042 << 14)
+#define MC_InputFilter_Filter_29                 (MCPARAMID)(10043 << 14)
+#define MC_InputFilter_Filter_38                 (MCPARAMID)(10044 << 14)
+#define MC_InputFilter_Filter_39                 (MCPARAMID)(10045 << 14)
+#define MC_Toto_NO_VALUE_3                         4
+#define MC_Kernel_F20_L1_HIRES                    20
+#define MC_Kernel_F25_L1_NTSC                     21
+#define MC_Kernel_F30_L1_PAL                      22
+#define MC_Kernel_F33_L1_HIRES                    23
+#define MC_Kernel_F37_L1_NTSC                     24
+#define MC_Kernel_F44_L1_PAL                      25
+#define MC_Kernel_F49_L1_NTSC                     26
+#define MC_Kernel_F59_L1_PAL                      27
+#define MC_Kernel_F65_L1_HIRES                    28
+#define MC_FSS_ImageSize_byte                    (MCPARAMID)(10046 << 14)
+#define MC_FSS_FBSIZE_img                        (MCPARAMID)(10047 << 14)
+#define MC_FSS_MaxImageSize_Check                (MCPARAMID)(10048 << 14)
+#define MC_FSS_MaxImageSize_Check_PASS             1
+#define MC_FSS_MaxImageSize_Check_FAIL             2
+#define MC_MaxHactive_Px_Check                   (MCPARAMID)(10049 << 14)
+#define MC_MaxHactive_Px_Check_PASS                1
+#define MC_MaxHactive_Px_Check_FAIL                2
+#define MC_MaxVactive_Ln_Check                   (MCPARAMID)(10050 << 14)
+#define MC_MaxVactive_Ln_Check_PASS                1
+#define MC_MaxVactive_Ln_Check_FAIL                2
+#define MC_PciBridgeType                         (MCPARAMID)(10051 << 14)
+#define MC_PciBridgeType_Pci9054                   1
+#define MC_PciBridgeType_Pci9656                   2
+#define MC_PciBridgeType_Pex8311                   3
+#define MC_PciBridgeType_Epec4816                  4
+#define MC_PciBridgeType_Unknown                   5
+#define MC_LocalBusWordSize                      (MCPARAMID)(10052 << 14)
+#define MC_LocalBusWordSize_LocalBus32bit          1
+#define MC_LocalBusWordSize_LocalBus64bit          2
+#define MC_LocalBusWordSize_Unknown                3
+#define MC__BoardName__                            7
+#define MC_ResetCtl_Filter                       (MCPARAMID)(10053 << 14)
+#define MC_AuxResetCtl_Filter                    (MCPARAMID)(10054 << 14)
+#define MC_AuxResetEdge_Filter                   (MCPARAMID)(10055 << 14)
+#define MC_ExposeOverlap_Filter                  (MCPARAMID)(10056 << 14)
+#define MC_PixelClkCtl_Filter                    (MCPARAMID)(10057 << 14)
+#define MC_PixelClkEdge_Filter                   (MCPARAMID)(10058 << 14)
+#define MC_CableComp_Filter                      (MCPARAMID)(10059 << 14)
+#define MC_TrigLine_TRA                           28
+#define MC_TrigLine_TRB                           29
+#define MC_TrigLine_TRC                           30
+#define MC_TrigLine_TRD                           31
+#define MC_InputFilter_Filter_61                 (MCPARAMID)(10060 << 14)
+#define MC_InputFilter_Filter_62                 (MCPARAMID)(10061 << 14)
+#define MC_InputFilter_Filter_63                 (MCPARAMID)(10062 << 14)
+#define MC_InputFilter_Filter_64                 (MCPARAMID)(10063 << 14)
+#define MC_InputPinName_ACC1                      92
+#define MC_InputPinName_ACC2                      93
+#define MC_InputPinName_ACC3                      94
+#define MC_InputPinName_ACC4                      95
+#define MC_InputPinName_ACC5                      96
+#define MC_InputPinName_BCC1                      97
+#define MC_InputPinName_BCC2                      98
+#define MC_InputPinName_BCC3                      99
+#define MC_InputPinName_BCC4                     100
+#define MC_InputPinName_BCC5                     101
+#define MC_InputPinName_CCC1                     102
+#define MC_InputPinName_CCC2                     103
+#define MC_InputPinName_CCC3                     104
+#define MC_InputPinName_CCC4                     105
+#define MC_InputPinName_CCC5                     106
+#define MC_InputPinName_DCC1                     107
+#define MC_InputPinName_DCC2                     108
+#define MC_InputPinName_DCC3                     109
+#define MC_InputPinName_DCC4                     110
+#define MC_InputPinName_DCC5                     111
+#define MC_ConnectorName_CAMERAS                  33
+#define MC_OutputPinName_ACC1                    102
+#define MC_OutputPinName_ACC2                    103
+#define MC_OutputPinName_ACC3                    104
+#define MC_OutputPinName_ACC4                    105
+#define MC_OutputPinName_ACC5                    106
+#define MC_OutputPinName_BCC1                    107
+#define MC_OutputPinName_BCC2                    108
+#define MC_OutputPinName_BCC3                    109
+#define MC_OutputPinName_BCC4                    110
+#define MC_OutputPinName_BCC5                    111
+#define MC_OutputPinName_CCC1                    112
+#define MC_OutputPinName_CCC2                    113
+#define MC_OutputPinName_CCC3                    114
+#define MC_OutputPinName_CCC4                    115
+#define MC_OutputPinName_CCC5                    116
+#define MC_OutputPinName_DCC1                    117
+#define MC_OutputPinName_DCC2                    118
+#define MC_OutputPinName_DCC3                    119
+#define MC_OutputPinName_DCC4                    120
+#define MC_OutputPinName_DCC5                    121
+#define MC_NullSet_Filter                        (MCPARAMID)(10064 << 14)
+#define MC_FullSet_Filter                        (MCPARAMID)(10065 << 14)
+#define MC_NONE_Filter                           (MCPARAMID)(10066 << 14)
+#define MC_OFF_Filter                            (MCPARAMID)(10067 << 14)
+#define MC_AuxResetLine_Feature                  (MCPARAMID)(10068 << 14)
+#define MC_AuxResetLine_Feature_Available          1
+#define MC_AuxResetLine_Feature_NotAvailable       2
+#define MC_CamCtlElecStyle_Filter                (MCPARAMID)(10069 << 14)
+#define MC_CamFileBoardName                      (MCPARAMID)(10070 << 14)
+#define MC_CamFileBoardName_Grablink_Avenue        1
+#define MC_CamFileBoardName_Grablink_Express       2
+#define MC_CamFileBoardName_Grablink_Quickpack_CFA   3
+#define MC_CamFileBoardName_Grablink_Quickpack_CFA_PCIe   4
+#define MC_RHA_WithoutTrim                       (MCPARAMID)(10071 << 14)
+#define MC_RHA_Max                               (MCPARAMID)(10072 << 14)
+#define MC_SampleTrim_Min                        (MCPARAMID)(10073 << 14)
+#define MC_SampleTrim_Max                        (MCPARAMID)(10074 << 14)
+#define MC_PixelClk_Hz_Max                       (MCPARAMID)(10075 << 14)
+#define MC_SampleTrim_Bounded                    (MCPARAMID)(10076 << 14)
+#define MC_CamFileBoardName_Domino_Alpha_2         5
+#define MC_CamFileBoardName_Grablink_Expert_2      6
+#define MC_CamFileBoardName_Domino_Iota            7
+#define MC_CamFileBoardName_Domino_Delta           8
+#define MC_CamFileBoardName_Domino_Harmony         9
+#define MC_CamFileBoardName_Domino_Melody         10
+#define MC_CamFileBoardName_Domino_Symphony       11
+#define MC_CamFileBoardName_Domino_Symphony_PCIe  12
+#define MC_CamFileBoardName__Allowed_CamFileBoardNames_  13
+#define MC_CamFileBoardName_Grablink_Quickpack_ColorScan  14
+#define MC_CamFileBoardName_Grablink_Value        15
+#define MC_OutputState_17_LOOP                     8
+#define MC_OutputState_18_LOOP                     8
+#define MC_OutputState_19_LOOP                     8
+#define MC_OutputState_20_LOOP                     6
+#define MC_OutputState_22_LOOP                     8
+#define MC_OutputState_23_LOOP                     8
+#define MC_OutputState_24_LOOP                     8
+#define MC_OutputState_25_LOOP                     6
+#define MC_OutputState_26_LOOP                     6
+#define MC_OutputState_32_LOOP                     8
+#define MC_OutputState_33_LOOP                     8
+#define MC_OutputState_34_LOOP                     8
+#define MC_OutputState_35_LOOP                     6
+#define MC_OutputState_36_LOOP                     6
+#define MC_OutputState_42_LOOP                     6
+#define MC_OutputState_43_LOOP                     6
+#define MC_OutputState_44_LOOP                     6
+#define MC_OutputState_45_LOOP                     6
+#define MC_OutputState_46_LOOP                     6
+#define MC_OutputState_52_LOOP                     6
+#define MC_OutputState_53_LOOP                     6
+#define MC_OutputState_54_LOOP                     6
+#define MC_OutputState_55_LOOP                     6
+#define MC_OutputState_56_LOOP                     6
+#define MC_OutputState_61_LOOP                     6
+#define MC_OutputState_62_LOOP                     6
+#define MC_OutputState_63_LOOP                     6
+#define MC_OutputState_64_LOOP                     6
+#define MC_OutputState_65_LOOP                     6
+#define MC_OutputState_66_LOOP                     6
+#define MC_OutputState_67_LOOP                     6
+#define MC_OutputState_68_LOOP                     6
+#define MC_OutputState_69_LOOP                     6
+#define MC_OutputState_70_LOOP                     6
+#define MC_OutputState_71_LOOP                     6
+#define MC_OutputState_72_LOOP                     6
+#define MC_OutputState_20_LOOP3                    7
+#define MC_OutputState_20_LOOP4                    8
+#define MC_OutputState_61_LOOP3                    7
+#define MC_OutputState_61_LOOP4                    8
+#define MC_OutputState_62_LOOP3                    7
+#define MC_OutputState_62_LOOP4                    8
+#define MC_OutputState_63_LOOP3                    7
+#define MC_OutputState_63_LOOP4                    8
+#define MC_OutputState_64_LOOP3                    7
+#define MC_OutputState_64_LOOP4                    8
+#define MC_OutputState_65_LOOP3                    7
+#define MC_OutputState_65_LOOP4                    8
+#define MC_OutputState_66_LOOP3                    7
+#define MC_OutputState_66_LOOP4                    8
+#define MC_OutputState_67_LOOP3                    7
+#define MC_OutputState_67_LOOP4                    8
+#define MC_OutputState_68_LOOP3                    7
+#define MC_OutputState_68_LOOP4                    8
+#define MC_OutputState_69_LOOP3                    7
+#define MC_OutputState_69_LOOP4                    8
+#define MC_OutputState_70_LOOP3                    7
+#define MC_OutputState_70_LOOP4                    8
+#define MC_OutputState_71_LOOP3                    7
+#define MC_OutputState_71_LOOP4                    8
+#define MC_OutputState_72_LOOP3                    7
+#define MC_OutputState_72_LOOP4                    8
+#define MC_OutputState_28_LOOP1                    4
+#define MC_OutputState_28_LOOP2                    5
+#define MC_OutputState_29_LOOP1                    4
+#define MC_OutputState_29_LOOP2                    5
+#define MC_OutputState_51_LOOP1                    4
+#define MC_OutputState_51_LOOP2                    5
+#define MC_OutputState_51_LOOP3                    6
+#define MC_OutputState_51_LOOP4                    7
+#define MC_OutputStyle_Filter_51                 (MCPARAMID)(10077 << 14)
+#define MC_OutputState_52_LOOP3                    7
+#define MC_OutputState_52_LOOP4                    8
+#define MC__BoardName__CFAPCIe                     8
+#define MC_PoCL_Feature                          (MCPARAMID)(10078 << 14)
+#define MC_PoCL_Feature_YES                        1
+#define MC_PoCL_Feature_NO                         2
+#define MC_LateLockingMode                       (MCPARAMID)(10079 << 14)
+#define MC_LateLockingMode_OFF                     1
+#define MC_LateLockingMode_ON                      2
+#define MC_TrigDelay_Pls                         (MCPARAMID)(10080 << 14)
+#define MC_NextTrigDelay_Pls                     (MCPARAMID)(10081 << 14)
+#define MC___TriggerControl_Check                (MCPARAMID)(10082 << 14)
+#define MC___TriggerControl_Check_PASS             1
+#define MC___TriggerControl_Check_FAIL             2
+#define MC_TriggerDecimation_Feature             (MCPARAMID)(10083 << 14)
+#define MC_TriggerDecimation_Feature_YES           1
+#define MC_TriggerDecimation_Feature_NO            2
+#define MC_TriggerDecimation_Filter              (MCPARAMID)(10084 << 14)
+#define MC_TemporaryTrig                         (MCPARAMID)(10085 << 14)
+#define MC_TemporaryTrig2                        (MCPARAMID)(10086 << 14)
+#define MC_TemporaryTrig3                        (MCPARAMID)(10087 << 14)
+#define MC___PciDeviceID_Check                   (MCPARAMID)(10088 << 14)
+#define MC___PciDeviceID_Check_PASS                1
+#define MC___PciDeviceID_Check_FAIL                2
+#define MC_CLCAM_OPModeTrueExp                   (MCPARAMID)(10089 << 14)
+#define MC_CamFileBoardName_Grablink_Value_cPCI   16
+#define MC_CamFileBoardName_Grablink_Expert_2_cPCI  17
+#define MC_SimIDPSet                             (MCPARAMID)(10090 << 14)
+#define MC_WIC_NumOfActiveWICs                   (MCPARAMID)(10091 << 14)
+#define MC_TapGeometry_4XR                        39
+#define MC_CLCAM_Geometry_TG_4XR                  24
+#define MC_AssyConfig_QUADXTAPR                   19
+#define MC_SurfaceAllocation                     (MCPARAMID)(10092 << 14)
+#define MC_MapRegistersAvailability              (MCPARAMID)(10093 << 14)
+#define MC_MapRegistersAvailability_Enough         1
+#define MC_MapRegistersAvailability_NotEnough      2
+#define MC_CamFileBoardName_Grablink_Full         18
+#define MC__BoardName__FULL                        9
+#define MC__ASSYF11                              (MCPARAMID)(10094 << 14)
+#define MC__ASSYF12                              (MCPARAMID)(10095 << 14)
+#define MC__ASSYF13                              (MCPARAMID)(10096 << 14)
+#define MC__ASSYF14                              (MCPARAMID)(10097 << 14)
+#define MC__ASSYF15                              (MCPARAMID)(10098 << 14)
+#define MC__ASSYF16                              (MCPARAMID)(10099 << 14)
+#define MC__ASSYF17                              (MCPARAMID)(10100 << 14)
+#define MC__ASSYF18                              (MCPARAMID)(10101 << 14)
+#define MC__ASSYF21                              (MCPARAMID)(10102 << 14)
+#define MC__ASSYF22                              (MCPARAMID)(10103 << 14)
+#define MC__ASSYF23                              (MCPARAMID)(10104 << 14)
+#define MC__ASSYF24                              (MCPARAMID)(10105 << 14)
+#define MC__ASSYF25                              (MCPARAMID)(10106 << 14)
+#define MC__ASSYF26                              (MCPARAMID)(10107 << 14)
+#define MC__ASSYF27                              (MCPARAMID)(10108 << 14)
+#define MC__ASSYF28                              (MCPARAMID)(10109 << 14)
+#define MC__ASSYF31                              (MCPARAMID)(10110 << 14)
+#define MC__ASSYF32                              (MCPARAMID)(10111 << 14)
+#define MC__ASSYF33                              (MCPARAMID)(10112 << 14)
+#define MC__ASSYF34                              (MCPARAMID)(10113 << 14)
+#define MC__ASSYF35                              (MCPARAMID)(10114 << 14)
+#define MC__ASSYF36                              (MCPARAMID)(10115 << 14)
+#define MC__ASSYF37                              (MCPARAMID)(10116 << 14)
+#define MC__ASSYF38                              (MCPARAMID)(10117 << 14)
+#define MC__ASSYF41                              (MCPARAMID)(10118 << 14)
+#define MC__ASSYF42                              (MCPARAMID)(10119 << 14)
+#define MC__ASSYF43                              (MCPARAMID)(10120 << 14)
+#define MC__ASSYF44                              (MCPARAMID)(10121 << 14)
+#define MC__ASSYF45                              (MCPARAMID)(10122 << 14)
+#define MC__ASSYF46                              (MCPARAMID)(10123 << 14)
+#define MC__ASSYF47                              (MCPARAMID)(10124 << 14)
+#define MC__ASSYF48                              (MCPARAMID)(10125 << 14)
+#define MC__ASSYF51                              (MCPARAMID)(10126 << 14)
+#define MC__ASSYF52                              (MCPARAMID)(10127 << 14)
+#define MC__ASSYF53                              (MCPARAMID)(10128 << 14)
+#define MC__ASSYF54                              (MCPARAMID)(10129 << 14)
+#define MC__ASSYF55                              (MCPARAMID)(10130 << 14)
+#define MC__ASSYF56                              (MCPARAMID)(10131 << 14)
+#define MC__ASSYF57                              (MCPARAMID)(10132 << 14)
+#define MC__ASSYF58                              (MCPARAMID)(10133 << 14)
+#define MC__ASSYF61                              (MCPARAMID)(10134 << 14)
+#define MC__ASSYF62                              (MCPARAMID)(10135 << 14)
+#define MC__ASSYF63                              (MCPARAMID)(10136 << 14)
+#define MC__ASSYF64                              (MCPARAMID)(10137 << 14)
+#define MC__ASSYF65                              (MCPARAMID)(10138 << 14)
+#define MC__ASSYF66                              (MCPARAMID)(10139 << 14)
+#define MC__ASSYF67                              (MCPARAMID)(10140 << 14)
+#define MC__ASSYF68                              (MCPARAMID)(10141 << 14)
+#define MC__ASSYF71                              (MCPARAMID)(10142 << 14)
+#define MC__ASSYF72                              (MCPARAMID)(10143 << 14)
+#define MC__ASSYF73                              (MCPARAMID)(10144 << 14)
+#define MC__ASSYF74                              (MCPARAMID)(10145 << 14)
+#define MC__ASSYF75                              (MCPARAMID)(10146 << 14)
+#define MC__ASSYF76                              (MCPARAMID)(10147 << 14)
+#define MC__ASSYF77                              (MCPARAMID)(10148 << 14)
+#define MC__ASSYF78                              (MCPARAMID)(10149 << 14)
+#define MC__ASSYF81                              (MCPARAMID)(10150 << 14)
+#define MC__ASSYF82                              (MCPARAMID)(10151 << 14)
+#define MC__ASSYF83                              (MCPARAMID)(10152 << 14)
+#define MC__ASSYF84                              (MCPARAMID)(10153 << 14)
+#define MC__ASSYF85                              (MCPARAMID)(10154 << 14)
+#define MC__ASSYF86                              (MCPARAMID)(10155 << 14)
+#define MC__ASSYF87                              (MCPARAMID)(10156 << 14)
+#define MC__ASSYF88                              (MCPARAMID)(10157 << 14)
+#define MC__Lead_W5                              (MCPARAMID)(10158 << 14)
+#define MC__Lead_W6                              (MCPARAMID)(10159 << 14)
+#define MC__Lead_W7                              (MCPARAMID)(10160 << 14)
+#define MC__Lead_W8                              (MCPARAMID)(10161 << 14)
+#define MC__Lead_D5                              (MCPARAMID)(10162 << 14)
+#define MC__Lead_D6                              (MCPARAMID)(10163 << 14)
+#define MC__Lead_D7                              (MCPARAMID)(10164 << 14)
+#define MC__Lead_D8                              (MCPARAMID)(10165 << 14)
+#define MC__CDA_P5INDEX                          (MCPARAMID)(10166 << 14)
+#define MC__CDA_P6INDEX                          (MCPARAMID)(10167 << 14)
+#define MC__CDA_P7INDEX                          (MCPARAMID)(10168 << 14)
+#define MC__CDA_P8INDEX                          (MCPARAMID)(10169 << 14)
+#define MC__ASW_5                                (MCPARAMID)(10170 << 14)
+#define MC__ASW_6                                (MCPARAMID)(10171 << 14)
+#define MC__ASW_7                                (MCPARAMID)(10172 << 14)
+#define MC__ASW_8                                (MCPARAMID)(10173 << 14)
+#define MC__CDA_LEAD5                            (MCPARAMID)(10174 << 14)
+#define MC__CDA_LEAD6                            (MCPARAMID)(10175 << 14)
+#define MC__CDA_LEAD7                            (MCPARAMID)(10176 << 14)
+#define MC__CDA_LEAD8                            (MCPARAMID)(10177 << 14)
+#define MC__AllClBufMask                         (MCPARAMID)(10178 << 14)
+#define MC__UsedClBufMask                        (MCPARAMID)(10179 << 14)
+#define MC__CDA_REFASSYNR5                       (MCPARAMID)(10180 << 14)
+#define MC__CDA_REFASSYNR6                       (MCPARAMID)(10181 << 14)
+#define MC__CDA_REFASSYNR7                       (MCPARAMID)(10182 << 14)
+#define MC__CDA_REFASSYNR8                       (MCPARAMID)(10183 << 14)
+#define MC_AssyConfig_OCTALXOCTAL                 20
+#define MC_TapGeometry_4X2E                       40
+#define MC_TapGeometry_4X2E_1Y                    41
+#define MC_CLCAM_Geometry_TG_4X2E                 25
+#define MC_AssyConfig_OCTALXPAIR                  21
+#define MC_AssyConfig_OCTALXPAIREND               22
+#define MC_SurfaceAllocation_ANYWHERE              1
+#define MC_SurfaceAllocation_BELOW4G               2
+#define MC__ADR_OutputsSteps_128bit              (MCPARAMID)(10184 << 14)
+#define MC__ADR_LastSliceSize_128bit             (MCPARAMID)(10185 << 14)
+#define MC__CDC_FSLIC_ONE512                       5
+#define MC__CDC_FSLIC_TWO256                       6
+#define MC__CDC_FSLIC_FOUR128                      7
+#define MC__CDC_FSLIC_EIGHT64                      8
+#define MC__CDC_DIRX_w                           (MCPARAMID)(10186 << 14)
+#define MC_ChannelTopology_QUADXTAPR              18
+#define MC_TapGeometry_4XE_1Y                     42
+#define MC_TapGeometry_4XR_1Y                     43
+#define MC_CamFileBoardName_Grablink_FM1          19
+#define MC__BoardName__FM1                        10
+#define MC__BoardName_FM1_MOCKUP                  11
+#define MC__Category_FM1_Backend                  63
+#define MC__PA_NumBytePerLine_Mod_FBWidth        (MCPARAMID)(10187 << 14)
+#define MC__Category_G3G_Backend                  64
+#define MC__CPA_NumBytePerLine_Mod_FBWidth       (MCPARAMID)(10188 << 14)
+#define MC_OutputFormatterConfig_Y8OCTAL          48
+#define MC_OutputFormatterConfig_Y10              49
+#define MC_OutputFormatterConfig_Y12              50
+#define MC_OutputFormatterConfig_Y16              51
+#define MC_COF_BitWR                             (MCPARAMID)(10189 << 14)
+#define MC_COF_ByteWR_Mux8                       (MCPARAMID)(10190 << 14)
+#define MC_COF_ByteWR_Mux7                       (MCPARAMID)(10191 << 14)
+#define MC_COF_ByteWR_Mux6                       (MCPARAMID)(10192 << 14)
+#define MC_COF_ByteWR_Mux5                       (MCPARAMID)(10193 << 14)
+#define MC_COF_ByteWR_Mux4                       (MCPARAMID)(10194 << 14)
+#define MC_COF_ByteWR_Mux3                       (MCPARAMID)(10195 << 14)
+#define MC_COF_ByteWR_Mux2                       (MCPARAMID)(10196 << 14)
+#define MC_CPA_NumBytePerLine_Mod_FBWidth        (MCPARAMID)(10197 << 14)
+#define MC__CLF_LstFBCycLenMinusOne              (MCPARAMID)(10198 << 14)
+#define MC_PciBridgeType_Epec4832                  6
+#define MC_ActiveXStep_Byte                      (MCPARAMID)(10199 << 14)
+#define MC__CLF_NumFBCylLen                      (MCPARAMID)(10200 << 14)
+#define MC__CLF_NumFBCyl                         (MCPARAMID)(10201 << 14)
+#define MC__CPA_NumBytePerLine                   (MCPARAMID)(10202 << 14)
+#define MC__NumBytePerLine                       (MCPARAMID)(10203 << 14)
+#define MC__NumBytePerLine_Mod_FBWidth           (MCPARAMID)(10204 << 14)
+#define MC__MaxNumBytePerLinePart                (MCPARAMID)(10205 << 14)
+#define MC__NumLinePart                          (MCPARAMID)(10206 << 14)
+#define MC__LastLinePartLen_Byte                 (MCPARAMID)(10207 << 14)
+#define MC__COF_FF_AELvl_12                      (MCPARAMID)(10208 << 14)
+#define MC__COF_FF_AELvl_34                      (MCPARAMID)(10209 << 14)
+#define MC__COF_FF_AELvl_56                      (MCPARAMID)(10210 << 14)
+#define MC__COF_FF_AELvl_78                      (MCPARAMID)(10211 << 14)
+#define MC__COF_FF_AELvl_LstLnPart_12            (MCPARAMID)(10212 << 14)
+#define MC__COF_FF_AELvl_LstLnPart_34            (MCPARAMID)(10213 << 14)
+#define MC__COF_FF_AELvl_LstLnPart_56            (MCPARAMID)(10214 << 14)
+#define MC__COF_FF_AELvl_LstLnPart_78            (MCPARAMID)(10215 << 14)
+#define MC__COF_NumBytePerLine                   (MCPARAMID)(10216 << 14)
+#define MC__COF_NumBytePerLine_Mod_FBWidth       (MCPARAMID)(10217 << 14)
+#define MC__COF_MaxNumBytePerLinePart            (MCPARAMID)(10218 << 14)
+#define MC__COF_NumLinePart                      (MCPARAMID)(10219 << 14)
+#define MC__COF_LastLinePartLen_Byte             (MCPARAMID)(10220 << 14)
+#define MC__COF_NumBytePerLineModMaxNum          (MCPARAMID)(10221 << 14)
+#define MC__COF_NumBytePerLine_Mod_MaxNum        (MCPARAMID)(10222 << 14)
+#define MC__COF_LineLen_Byte                     (MCPARAMID)(10223 << 14)
+#define MC__COF_LineLen_Byte_Mod_FBWidth         (MCPARAMID)(10224 << 14)
+#define MC__COF_MaxLinePartLen_Byte              (MCPARAMID)(10225 << 14)
+#define MC__COF_LineLen_Mod_MaxNum               (MCPARAMID)(10226 << 14)
+#define MC__CPA_ColorMode                        (MCPARAMID)(10227 << 14)
+#define MC__CPA_ColorMode_MONOCHROME               1
+#define MC__CPA_ColorMode_RGB                      2
+#define MC__CPA_ColorMode_BAYER                    3
+#define MC__CPA_PixelSize                        (MCPARAMID)(10228 << 14)
+#define MC__CPA_PixelSize_ONE                      1
+#define MC__CPA_PixelSize_MANY                     2
+#define MC_CPA_ColorMode                         (MCPARAMID)(10229 << 14)
+#define MC_CPA_ColorMode_MONOCHROME                1
+#define MC_CPA_ColorMode_RGB                       2
+#define MC_CPA_ColorMode_BAYER                     3
+#define MC_CPA_PixelSize                         (MCPARAMID)(10230 << 14)
+#define MC_CPA_PixelSize_ONE                       1
+#define MC_CPA_PixelSize_MANY                      2
+#define MC_CPA_NumPixelBayerOut                  (MCPARAMID)(10231 << 14)
+#define MC_CPA_NumPixelBayerOut_ONE                1
+#define MC_CPA_NumPixelBayerOut_TWO                2
+#define MC_CPA_NumPixelPerLine                   (MCPARAMID)(10232 << 14)
+#define MC_CPA_NumByteToFlush                    (MCPARAMID)(10233 << 14)
+#define MC_CPA_LineLen_Byte                      (MCPARAMID)(10234 << 14)
+#define MC_COF_LineLen_Byte                      (MCPARAMID)(10235 << 14)
+#define MC_COF_LineLen_Byte_Mod_FBWidth          (MCPARAMID)(10236 << 14)
+#define MC_COF_MaxLinePartLen_Byte               (MCPARAMID)(10237 << 14)
+#define MC_COF_NumLinePart                       (MCPARAMID)(10238 << 14)
+#define MC_COF_LineLen_Mod_MaxNum                (MCPARAMID)(10239 << 14)
+#define MC_COF_LastLinePartLen_Byte              (MCPARAMID)(10240 << 14)
+#define MC_COF_FF_AELvl_12                       (MCPARAMID)(10241 << 14)
+#define MC_COF_FF_AELvl_34                       (MCPARAMID)(10242 << 14)
+#define MC_COF_FF_AELvl_56                       (MCPARAMID)(10243 << 14)
+#define MC_COF_FF_AELvl_78                       (MCPARAMID)(10244 << 14)
+#define MC_COF_FF_AELvl_LstLnPart_12             (MCPARAMID)(10245 << 14)
+#define MC_COF_FF_AELvl_LstLnPart_34             (MCPARAMID)(10246 << 14)
+#define MC_COF_FF_AELvl_LstLnPart_56             (MCPARAMID)(10247 << 14)
+#define MC_COF_FF_AELvl_LstLnPart_78             (MCPARAMID)(10248 << 14)
+#define MC_CLF_NumFBCyl                          (MCPARAMID)(10249 << 14)
+#define MC_CLF_LstFBCycLenMinusOne               (MCPARAMID)(10250 << 14)
+#define MC__BoardName__FM1_MOCKUP                 12
+#define MC_CLF_NumFBAccessPerLine                (MCPARAMID)(10251 << 14)
+#define MC_CLF_LstFBCycLen                       (MCPARAMID)(10252 << 14)
+#define MC_CBD_ColorRegistration                 (MCPARAMID)(10253 << 14)
+#define MC_CBD_ColorRegistration_BG                1
+#define MC_CBD_ColorRegistration_GB                2
+#define MC_CBD_ColorRegistration_RG                3
+#define MC_CBD_ColorRegistration_GR                4
+#define MC_CBD_Algo                              (MCPARAMID)(10254 << 14)
+#define MC_CBD_Algo_LEGACY                         1
+#define MC_CBD_Algo_ADVANCED                       2
+#define MC_CBD_NumPixelInput                     (MCPARAMID)(10255 << 14)
+#define MC_CBD_NumPixelInput_ONE                   1
+#define MC_CBD_NumPixelInput_TWO                   2
+#define MC__LineLen_Byte                         (MCPARAMID)(10256 << 14)
+#define MC__InBackEnd_LineLen_Byte               (MCPARAMID)(10257 << 14)
+#define MC__OutBackEnd_LineLen_Byte              (MCPARAMID)(10258 << 14)
+#define MC_COF_LineLen_Mod_MaxPartLen            (MCPARAMID)(10259 << 14)
+#define MC_OutputFormatterConfig_RGB24MONO        52
+#define MC_COF_ByteWR_WEN_Step8                  (MCPARAMID)(10260 << 14)
+#define MC_COF_ByteWR_WEN_Step7                  (MCPARAMID)(10261 << 14)
+#define MC_COF_ByteWR_WEN_Step6                  (MCPARAMID)(10262 << 14)
+#define MC_COF_ByteWR_WEN_Step5                  (MCPARAMID)(10263 << 14)
+#define MC_COF_ByteWR_WEN_Step4                  (MCPARAMID)(10264 << 14)
+#define MC_COF_ByteWR_WEN_Step3                  (MCPARAMID)(10265 << 14)
+#define MC_COF_ByteWR_WEN_Step2                  (MCPARAMID)(10266 << 14)
+#define MC_COF_ByteWR_WEN_Step1                  (MCPARAMID)(10267 << 14)
+#define MC_OutputFormatterConfig_M8OCTAL          53
+#define MC_OutputFormatterConfig_M8QUAD           54
+#define MC_OutputFormatterConfig_M10              55
+#define MC_OutputFormatterConfig_M12              56
+#define MC_OutputFormatterConfig_M16              57
+#define MC_OutputFormatterConfig_RGB24DUAL        58
+#define MC_OutputFormatterConfig_ARGB32DUAL       59
+#define MC_OutputFormatterConfig_ARGB32MONO       60
+#define MC_OutputFormatterConfig_RGB24PLDUAL      61
+#define MC_OutputFormatterConfig_RGB24PLMONO      62
+#define MC_LUT_StartAddress_Byte                 (MCPARAMID)(10268 << 14)
+#define MC_LUT_StartAddress_FB64                 (MCPARAMID)(10269 << 14)
+#define MC_LUT_Truncation                        (MCPARAMID)(10270 << 14)
+#define MC_LUT_Truncation_TRUE                     1
+#define MC_LUT_Truncation_FALSE                    2
+#define MC_LUT_Format                            (MCPARAMID)(10271 << 14)
+#define MC_LUT_Format_BYPASS                       1
+#define MC_LUT_Format_M8                           2
+#define MC_LUT_Format_M16                          3
+#define MC_LUT_Format_M16ToM8                      4
+#define MC_LUT_Format_RGB24                        5
+#define MC_LUT_Format_BY8ToRGB24                   6
+#define MC_LUT_Format_RGB48                        7
+#define MC_LUT_Format_BY16ToRGB48                  8
+#define MC_LUT_Format_RGB48ToRGB24                 9
+#define MC_LUT_Format_BY16ToRGB24                 10
+#define MC_LUT_NumLutUsed                        (MCPARAMID)(10272 << 14)
+#define MC_LUT_Format_Trunc16To8                  11
+#define MC_LUT_Config                            (MCPARAMID)(10273 << 14)
+#define MC_LUT_Config_BYPASS8                      1
+#define MC_LUT_Config_BYPASS16                     2
+#define MC_LUT_Config_LUT8                         3
+#define MC_LUT_Config_LUT16                        4
+#define MC_LUT_Config_LUT16To8                     5
+#define MC_CPA_PixolSize                         (MCPARAMID)(10274 << 14)
+#define MC_CPA_PixolSize_ONE                       1
+#define MC_CPA_PixolSize_TWO                       2
+#define MC_CPA_LineLen_Byte_Mod_FBWidth          (MCPARAMID)(10275 << 14)
+#define MC__P1IndexOffset                        (MCPARAMID)(10276 << 14)
+#define MC__P2IndexOffset                        (MCPARAMID)(10277 << 14)
+#define MC__P3IndexOffset                        (MCPARAMID)(10278 << 14)
+#define MC__P4IndexOffset                        (MCPARAMID)(10279 << 14)
+#define MC__P5IndexOffset                        (MCPARAMID)(10280 << 14)
+#define MC__P6IndexOffset                        (MCPARAMID)(10281 << 14)
+#define MC__P7IndexOffset                        (MCPARAMID)(10282 << 14)
+#define MC__P8IndexOffset                        (MCPARAMID)(10283 << 14)
+#define MC_ByteCountGranularity                  (MCPARAMID)(10284 << 14)
+#define MC__LeadWords_W1                         (MCPARAMID)(10285 << 14)
+#define MC__LeadWords_W2                         (MCPARAMID)(10286 << 14)
+#define MC__LeadWords_W3                         (MCPARAMID)(10287 << 14)
+#define MC__LeadWords_W4                         (MCPARAMID)(10288 << 14)
+#define MC__LeadWords_W5                         (MCPARAMID)(10289 << 14)
+#define MC__LeadWords_W6                         (MCPARAMID)(10290 << 14)
+#define MC__LeadWords_W7                         (MCPARAMID)(10291 << 14)
+#define MC__LeadWords_W8                         (MCPARAMID)(10292 << 14)
+#define MC__LeadWords_D1                         (MCPARAMID)(10293 << 14)
+#define MC__LeadWords_D2                         (MCPARAMID)(10294 << 14)
+#define MC__LeadWords_D3                         (MCPARAMID)(10295 << 14)
+#define MC__LeadWords_D4                         (MCPARAMID)(10296 << 14)
+#define MC__LeadWords_D5                         (MCPARAMID)(10297 << 14)
+#define MC__LeadWords_D6                         (MCPARAMID)(10298 << 14)
+#define MC__LeadWords_D7                         (MCPARAMID)(10299 << 14)
+#define MC__LeadWords_D8                         (MCPARAMID)(10300 << 14)
+#define MC__CDA_P1DefaultIndex                   (MCPARAMID)(10301 << 14)
+#define MC__CDA_P2DefaultIndex                   (MCPARAMID)(10302 << 14)
+#define MC__CDA_P3DefaultIndex                   (MCPARAMID)(10303 << 14)
+#define MC__CDA_P4DefaultIndex                   (MCPARAMID)(10304 << 14)
+#define MC__CDA_P5DefaultIndex                   (MCPARAMID)(10305 << 14)
+#define MC__CDA_P6DefaultIndex                   (MCPARAMID)(10306 << 14)
+#define MC__CDA_P7DefaultIndex                   (MCPARAMID)(10307 << 14)
+#define MC__CDA_P8DefaultIndex                   (MCPARAMID)(10308 << 14)
+#define MC_PIndexIncrementFactor                 (MCPARAMID)(10309 << 14)
+#define MC_TapGeometry_2XR                        44
+#define MC_TapGeometry_2X4                        45
+#define MC_TapGeometry_8XR                        46
+#define MC_TapGeometry_2XR_1Y                     47
+#define MC_TapGeometry_1X2_1Y2                    48
+#define MC_TapGeometry_2X_1Y2                     49
+#define MC_TapGeometry_2XE_1Y2                    50
+#define MC_TapGeometry_2XR_1Y2                    51
+#define MC_TapGeometry_2X4_1Y                     52
+#define MC_TapGeometry_8XR_1Y                     53
+#define MC_AssyConfig_DUALXTAPR                   23
+#define MC_AssyConfig_OCTALXQUAD                  24
+#define MC_AssyConfig_OCTALXTAPR                  25
+#define MC_TapGeometry_1X4_1Y2                    54
+#define MC_TapGeometry_4X_1Y2                     55
+#define MC_TapGeometry_4XE_1Y2                    56
+#define MC_TapGeometry_4XR_1Y2                    57
+#define MC_TapGeometry_2X2M_2YE                   58
+#define MC_PCIeLinkWidth                         (MCPARAMID)(10310 << 14)
+#define MC_PCIeEndpointRevisionID                (MCPARAMID)(10311 << 14)
+#define MC_LUT_Type                              (MCPARAMID)(10312 << 14)
+#define MC_LUT_Type_LUT8Monochrome                 1
+#define MC_LUT_Type_LUT8Color                      2
+#define MC_LUT_Type_LUT16Monochrome                3
+#define MC_LUT_Type_LUT16Color                     4
+#define MC_LUT_Type_LUT16To8Monochrome             5
+#define MC_LUT_Type_LUT16To8Color                  6
+#define MC_LUT_Type_LUT16To8BayerToColor           7
+#define MC_LUT_ProgModel                         (MCPARAMID)(10313 << 14)
+#define MC_LUT_ProgModel_LUT8_Monochrome           1
+#define MC_LUT_ProgModel_LUT8_Color                2
+#define MC_LUT_ProgModel_LUT16_Monochrome          3
+#define MC_LUT_ProgModel_LUT16_Color               4
+#define MC_LUT_ProgModel_LUT16To8_Monochrome       5
+#define MC_LUT_ProgModel_LUT16To8_Color            6
+#define MC_LUT_ProgModel_LUT16To8_BayerToColor     7
+#define MC_TapConfiguration_DECA_10T8             47
+#define MC_TapGeometry_1X10                       59
+#define MC_TapGeometry_1X10_1Y                    60
+#define MC_CLCAM_Geometry_TG_1X10                 26
+#define MC_AssyConfig_DECAXDECA                   26
+#define MC__CDA_P9DefaultIndex                   (MCPARAMID)(10314 << 14)
+#define MC__CDA_P10DefaultIndex                  (MCPARAMID)(10315 << 14)
+#define MC__ASSYF91                              (MCPARAMID)(10316 << 14)
+#define MC__ASSYF92                              (MCPARAMID)(10317 << 14)
+#define MC__ASSYF93                              (MCPARAMID)(10318 << 14)
+#define MC__ASSYF94                              (MCPARAMID)(10319 << 14)
+#define MC__ASSYF95                              (MCPARAMID)(10320 << 14)
+#define MC__ASSYF96                              (MCPARAMID)(10321 << 14)
+#define MC__ASSYF97                              (MCPARAMID)(10322 << 14)
+#define MC__ASSYF98                              (MCPARAMID)(10323 << 14)
+#define MC__ASSYF101                             (MCPARAMID)(10324 << 14)
+#define MC__ASSYF102                             (MCPARAMID)(10325 << 14)
+#define MC__ASSYF103                             (MCPARAMID)(10326 << 14)
+#define MC__ASSYF104                             (MCPARAMID)(10327 << 14)
+#define MC__ASSYF105                             (MCPARAMID)(10328 << 14)
+#define MC__ASSYF106                             (MCPARAMID)(10329 << 14)
+#define MC__ASSYF107                             (MCPARAMID)(10330 << 14)
+#define MC__ASSYF108                             (MCPARAMID)(10331 << 14)
+#define MC_NumOfAssy_TEN                           7
+#define MC__LeadWords_D9                         (MCPARAMID)(10332 << 14)
+#define MC__LeadWords_D10                        (MCPARAMID)(10333 << 14)
+#define MC__Lead_D9                              (MCPARAMID)(10334 << 14)
+#define MC__Lead_D10                             (MCPARAMID)(10335 << 14)
+#define MC__CDA_P9INDEX                          (MCPARAMID)(10336 << 14)
+#define MC__CDA_P10INDEX                         (MCPARAMID)(10337 << 14)
+#define MC__D9_WINDEX                            (MCPARAMID)(10338 << 14)
+#define MC__D10_WINDEX                           (MCPARAMID)(10339 << 14)
+#define MC__ASW_9                                (MCPARAMID)(10340 << 14)
+#define MC__ASW_10                               (MCPARAMID)(10341 << 14)
+#define MC__CDA_REFASSYNR9                       (MCPARAMID)(10342 << 14)
+#define MC__CDA_REFASSYNR10                      (MCPARAMID)(10343 << 14)
+#define MC__CDA_LEAD9                            (MCPARAMID)(10344 << 14)
+#define MC__CDA_LEAD10                           (MCPARAMID)(10345 << 14)
+#define MC_CL_ConfigurationClass_DECA              4
+#define MC__GCL_CLCFG_DECA                         4
+#define MC__BoardName_UnknownBoard                13
+#define MC_BoardFeature_CFADecoding              (MCPARAMID)(10346 << 14)
+#define MC_BoardFeature_CFADecoding_YES            1
+#define MC_BoardFeature_CFADecoding_NO             2
+#define MC_InputFunction_CK_PRESENT               17
+#define MC_InputFunction_POWERSTATE5V             18
+#define MC_InputFunction_POWERSTATE12V            19
+#define MC_InputStyle_ISO                         17
+#define MC_InputPinName_IIN1                     112
+#define MC_InputPinName_IIN2                     113
+#define MC_InputPinName_IIN3                     114
+#define MC_InputPinName_IIN4                     115
+#define MC_InputPinName_DIN1                     116
+#define MC_InputPinName_DIN2                     117
+#define MC_InputPinName_POWER_5V                 118
+#define MC_InputPinName_POWER_12V                119
+#define MC_InputPinName_FVAL_X                   120
+#define MC_InputPinName_LVAL_X                   121
+#define MC_InputPinName_DVAL_X                   122
+#define MC_InputPinName_SPARE_X                  123
+#define MC_InputPinName_CK_PRESENT_X             124
+#define MC_InputPinName_FVAL_Y                   125
+#define MC_InputPinName_LVAL_Y                   126
+#define MC_InputPinName_DVAL_Y                   127
+#define MC_InputPinName_SPARE_Y                  128
+#define MC_InputPinName_CK_PRESENT_Y             129
+#define MC_InputPinName_FVAL_Z                   130
+#define MC_InputPinName_LVAL_Z                   131
+#define MC_InputPinName_DVAL_Z                   132
+#define MC_InputPinName_SPARE_Z                  133
+#define MC_InputPinName_CK_PRESENT_Z             134
+#define MC_OutputPinName_IOUT1                   122
+#define MC_OutputPinName_IOUT2                   123
+#define MC_OutputPinName_IOUT3                   124
+#define MC_OutputPinName_IOUT4                   125
+#define MC_TrigCtl_ISO                            17
+#define MC_TrigLine_DIN1                          32
+#define MC_TrigLine_DIN2                          33
+#define MC_TrigLine_IIN1                          34
+#define MC_TrigLine_IIN2                          35
+#define MC_TrigLine_IIN3                          36
+#define MC_TrigLine_IIN4                          37
+#define MC_EndTrigLine_DIN1                       23
+#define MC_EndTrigLine_DIN2                       24
+#define MC_EndTrigLine_IIN1                       25
+#define MC_EndTrigLine_IIN2                       26
+#define MC_EndTrigLine_IIN3                       27
+#define MC_EndTrigLine_IIN4                       28
+#define MC_EndTrigCtl_DIFF                         9
+#define MC_EndTrigCtl_ISO                         10
+#define MC__TrigLine_DIN1                         36
+#define MC__TrigLine_DIN2                         37
+#define MC__TrigLine_IIN1                         38
+#define MC__TrigLine_IIN2                         39
+#define MC__TrigLine_IIN3                         40
+#define MC__TrigLine_IIN4                         41
+#define MC__EndTrigLine_DIN1                      21
+#define MC__EndTrigLine_DIN2                      22
+#define MC__EndTrigLine_IIN1                      23
+#define MC__EndTrigLine_IIN2                      24
+#define MC__EndTrigLine_IIN3                      25
+#define MC__EndTrigLine_IIN4                      26
+#define MC__TRG_FTSEL_FromIsoIn1                  23
+#define MC__TRG_FTSEL_FromIsoIn2                  24
+#define MC__TRG_FTSEL_FromIsoIn3                  25
+#define MC__TRG_FTSEL_FromIsoIn4                  26
+#define MC__TRG_FTSEL_FromDhsIn1                  27
+#define MC__TRG_FTSEL_FromDhsIn2                  28
+#define MC__TRG_FTSEL_None                        29
+#define MC__TRG_EFTSEL_FromIsoIn1                 17
+#define MC__TRG_EFTSEL_FromIsoIn2                 18
+#define MC__TRG_EFTSEL_FromIsoIn3                 19
+#define MC__TRG_EFTSEL_FromIsoIn4                 20
+#define MC__TRG_EFTSEL_FromDhsIn1                 21
+#define MC__TRG_EFTSEL_FromDhsIn2                 22
+#define MC__TRG_EFTSEL_None                       23
+#define MC_StrobeLine_IOUT1                       24
+#define MC__StrobeLine_IOUT1                      20
+#define MC_LineTrigCtl_DIFF                        5
+#define MC_LineTrigCtl_DIFF_PAIRED                 6
+#define MC_LineTrigCtl_ISO                         7
+#define MC_LineTrigCtl_ISO_PAIRED                  8
+#define MC_LineTrig_GlobalFilter                 (MCPARAMID)(10347 << 14)
+#define MC_LineTrigEdge_RISING_A                   3
+#define MC_LineTrigEdge_FALLING_A                  4
+#define MC_LineTrigEdge_ALL_A                      5
+#define MC_LineTrigEdge_ALL_A_B                    6
+#define MC_LineTrigEdge_Filter                   (MCPARAMID)(10348 << 14)
+#define MC_LineTrigFilter_Filter_40ns              4
+#define MC_LineTrigFilter_Filter_100ns             5
+#define MC_LineTrigFilter_Filter_200ns             6
+#define MC_LineTrigFilter_Filter_500ns             7
+#define MC_LineTrigFilter_Filter_1us               8
+#define MC_LineTrigFilter_Filter_5us               9
+#define MC_LineTrigFilter_Filter_10us             10
+#define MC_LineTrigModesEnabled                  (MCPARAMID)(10349 << 14)
+#define MC_LineTrigModesEnabled_TRUE               1
+#define MC_LineTrigModesEnabled_FALSE              2
+#define MC_ForwardDirection                      (MCPARAMID)(10350 << 14)
+#define MC_ForwardDirection_A_LEADS_B              1
+#define MC_ForwardDirection_B_LEADS_A              2
+#define MC_QuadratureEncoder_Filter              (MCPARAMID)(10351 << 14)
+#define MC_BackwardMotionCancellationMode        (MCPARAMID)(10352 << 14)
+#define MC_BackwardMotionCancellationMode_OFF      1
+#define MC_BackwardMotionCancellationMode_FILTERED   2
+#define MC_BackwardMotionCancellationMode_COMPENSATE   3
+#define MC_LineTrigLine_DIN1                      15
+#define MC_LineTrigLine_DIN2                      16
+#define MC_LineTrigLine_IIN1                      17
+#define MC_LineTrigLine_IIN2                      18
+#define MC_LineTrigLine_IIN3                      19
+#define MC_LineTrigLine_IIN4                      20
+#define MC_LineTrigLine_DIN1_DIN2                 21
+#define MC_LineTrigLine_IIN1_IIN2                 22
+#define MC_LineTrigLine_IIN3_IIN4                 23
+#define MC__LineTrigLine_DIN1                     21
+#define MC__LineTrigLine_DIN2                     22
+#define MC__LineTrigLine_IIN1                     23
+#define MC__LineTrigLine_IIN2                     24
+#define MC__LineTrigLine_IIN3                     25
+#define MC__LineTrigLine_IIN4                     26
+#define MC__LineTrigLine_DIN1_DIN2                27
+#define MC__LineTrigLine_IIN1_IIN2                28
+#define MC__LineTrigLine_IIN3_IIN4                29
+#define MC__LTRG_LTPOL                           (MCPARAMID)(10353 << 14)
+#define MC__LTRG_LTPOL_RISING_A                    1
+#define MC__LTRG_LTPOL_FALLING_A                   2
+#define MC__LTRG_LTPOL_ALL_A                       3
+#define MC__LTRG_LTPOL_ALL_A_B                     4
+#define MC__LTRG_LTPOL_NONE                        5
+#define MC__LTRG_LTFLT                           (MCPARAMID)(10354 << 14)
+#define MC__LTRG_LTFLT_40ns                        1
+#define MC__LTRG_LTFLT_100ns                       2
+#define MC__LTRG_LTFLT_200ns                       3
+#define MC__LTRG_LTFLT_500ns                       4
+#define MC__LTRG_LTFLT_1us                         5
+#define MC__LTRG_LTFLT_5us                         6
+#define MC__LTRG_LTFLT_10us                        7
+#define MC__LTRG_LTSELA                          (MCPARAMID)(10355 << 14)
+#define MC__LTRG_LTSELA_FromIsoIn1                 1
+#define MC__LTRG_LTSELA_FromIsoIn2                 2
+#define MC__LTRG_LTSELA_FromIsoIn3                 3
+#define MC__LTRG_LTSELA_FromIsoIn4                 4
+#define MC__LTRG_LTSELA_FromDhsIn1                 5
+#define MC__LTRG_LTSELA_FromDhsIn2                 6
+#define MC__LTRG_LTSELA_None                       7
+#define MC__LTRG_LTSELB                          (MCPARAMID)(10356 << 14)
+#define MC__LTRG_LTSELB_FromIsoIn1                 1
+#define MC__LTRG_LTSELB_FromIsoIn2                 2
+#define MC__LTRG_LTSELB_FromIsoIn3                 3
+#define MC__LTRG_LTSELB_FromIsoIn4                 4
+#define MC__LTRG_LTSELB_FromDhsIn1                 5
+#define MC__LTRG_LTSELB_FromDhsIn2                 6
+#define MC__LTRG_LTSELB_None                       7
+#define MC_IIN1Usage                             (MCPARAMID)(10357 << 14)
+#define MC_IIN1Usage_FREE                          1
+#define MC_IIN1Usage_TRIGGER                       2
+#define MC_IIN1Usage_LINETRIGGER                   3
+#define MC___IIN1Usage_Check                     (MCPARAMID)(10358 << 14)
+#define MC___IIN1Usage_Check_PASS                  1
+#define MC___IIN1Usage_Check_FAIL                  2
+#define MC_IIN2Usage                             (MCPARAMID)(10359 << 14)
+#define MC_IIN2Usage_FREE                          1
+#define MC_IIN2Usage_TRIGGER                       2
+#define MC_IIN2Usage_LINETRIGGER                   3
+#define MC___IIN2Usage_Check                     (MCPARAMID)(10360 << 14)
+#define MC___IIN2Usage_Check_PASS                  1
+#define MC___IIN2Usage_Check_FAIL                  2
+#define MC_IIN3Usage                             (MCPARAMID)(10361 << 14)
+#define MC_IIN3Usage_FREE                          1
+#define MC_IIN3Usage_TRIGGER                       2
+#define MC_IIN3Usage_LINETRIGGER                   3
+#define MC___IIN3Usage_Check                     (MCPARAMID)(10362 << 14)
+#define MC___IIN3Usage_Check_PASS                  1
+#define MC___IIN3Usage_Check_FAIL                  2
+#define MC_IIN4Usage                             (MCPARAMID)(10363 << 14)
+#define MC_IIN4Usage_FREE                          1
+#define MC_IIN4Usage_TRIGGER                       2
+#define MC_IIN4Usage_LINETRIGGER                   3
+#define MC___IIN4Usage_Check                     (MCPARAMID)(10364 << 14)
+#define MC___IIN4Usage_Check_PASS                  1
+#define MC___IIN4Usage_Check_FAIL                  2
+#define MC_DIN1Usage                             (MCPARAMID)(10365 << 14)
+#define MC_DIN1Usage_FREE                          1
+#define MC_DIN1Usage_TRIGGER                       2
+#define MC_DIN1Usage_LINETRIGGER                   3
+#define MC_DIN1Usage_USER                          4
+#define MC___DIN1Usage_Check                     (MCPARAMID)(10366 << 14)
+#define MC___DIN1Usage_Check_PASS                  1
+#define MC___DIN1Usage_Check_FAIL                  2
+#define MC_DIN2Usage                             (MCPARAMID)(10367 << 14)
+#define MC_DIN2Usage_FREE                          1
+#define MC_DIN2Usage_TRIGGER                       2
+#define MC_DIN2Usage_LINETRIGGER                   3
+#define MC_DIN2Usage_USER                          4
+#define MC___DIN2Usage_Check                     (MCPARAMID)(10368 << 14)
+#define MC___DIN2Usage_Check_PASS                  1
+#define MC___DIN2Usage_Check_FAIL                  2
+#define MC_IOUT1Usage                            (MCPARAMID)(10369 << 14)
+#define MC_IOUT1Usage_FREE                         1
+#define MC_IOUT1Usage_STROBE                       2
+#define MC_IOUT2Usage                            (MCPARAMID)(10370 << 14)
+#define MC_IOUT2Usage_FREE                         1
+#define MC_IOUT2Usage_STROBE                       2
+#define MC_IOUT3Usage                            (MCPARAMID)(10371 << 14)
+#define MC_IOUT3Usage_FREE                         1
+#define MC_IOUT3Usage_STROBE                       2
+#define MC_IOUT4Usage                            (MCPARAMID)(10372 << 14)
+#define MC_IOUT4Usage_FREE                         1
+#define MC_IOUT4Usage_STROBE                       2
+#define MC__StrobeSrc                            (MCPARAMID)(10373 << 14)
+#define MC__StrobeSrc_T1SIG3_X                     1
+#define MC__StrobeSrc_NO_STROBE                    2
+#define MC__StrobeSrc_STROBE_TIED_LOW              3
+#define MC_CamFileBoardName_Grablink_FM1_Mockup   20
+#define MC_InputStyle_POWERSTATE                  18
+#define MC_InputFunction_CHANNELLINK_STATE        20
+#define MC_InputPinName_CHANNELLINK_UP_X         135
+#define MC_InputPinName_CHANNELLINK_UP_Y         136
+#define MC_InputPinName_CHANNELLINK_UP_Z         137
+#define MC_CLCAM_Geometry_TG_2XR                  27
+#define MC_PhaseShift_X                          (MCPARAMID)(10374 << 14)
+#define MC_PhaseShift_Y                          (MCPARAMID)(10375 << 14)
+#define MC_PhaseShift_Z                          (MCPARAMID)(10376 << 14)
+#define MC_CLCAM_Geometry_TG_2X4                  28
+#define MC_CameraLinkFrequencyRange              (MCPARAMID)(10377 << 14)
+#define MC_CameraLinkFrequencyRange_Range20MHzTo35MHz   1
+#define MC_CameraLinkFrequencyRange_Range30MHzTo70MHz   2
+#define MC_CameraLinkFrequencyRange_Range60MHzTo85MHz   3
+#define MC_CameraLinkFrequencyRange_From20MHzTo35MHz   4
+#define MC_CameraLinkFrequencyRange_From30MHzTo70MHz   5
+#define MC_CameraLinkFrequencyRange_From60MHzTo85MHz   6
+#define MC_BoardTopology2                        (MCPARAMID)(10378 << 14)
+#define MC_BoardTopology2_MONO                     1
+#define MC_BoardTopology_MONO_From60MHzTo85MHz    36
+#define MC_BoardTopology_MONO_From30MHzTo70MHz    37
+#define MC_BoardTopology_MONO_From20MHzTo35MHz    38
+#define MC_PCIeDeviceID                          (MCPARAMID)(10379 << 14)
+#define MC_CamFileBoardName_Unknown               21
+#define MC__CDC_FSLIC_ONE_1024                     9
+#define MC__CDC_FSLIC_TWO_512                     10
+#define MC__CDC_FSLIC_FOUR_256                    11
+#define MC__CDC_FSLIC_EIGHT_128                   12
+#define MC__STM1_T1SCAL_160ns                      8
+#define MC__STM1_T1SCAL_800ns                      9
+#define MC_CLCAM_Geometry_TG_8XR                  29
+#define MC__CPHASE9                              (MCPARAMID)(10380 << 14)
+#define MC__CPHASE10                             (MCPARAMID)(10381 << 14)
+#define MC__CBA_PSHIFT9                          (MCPARAMID)(10382 << 14)
+#define MC__CBA_PSHIFT10                         (MCPARAMID)(10383 << 14)
+#define MC_CamFileBoardName_Grablink_B2           22
+#define MC_CamFileBoardName_Grablink_B1           23
+#define MC__BoardName__B2                         14
+#define MC__BoardName__B1                         15
+#define MC_GrabberType                           (MCPARAMID)(10384 << 14)
+#define MC_GrabberType_Full                        1
+#define MC_GrabberType_Base                        2
+#define MC_GrabberType_DualBase                    3
+#define MC_PciBridgeType_Epec1816                  7
+#define MC__CDC_FSLIC_ONE_512                     13
+#define MC__CDC_FSLIC_TWO_256                     14
+#define MC_GrabberError_BE_3                     (MCPARAMID)(10385 << 14)
+#define MC_GrabberError_BE_2                     (MCPARAMID)(10386 << 14)
+#define MC_GrabberError_BE_1                     (MCPARAMID)(10387 << 14)
+#define MC_GrabberError_CLCLkLoss_Z              (MCPARAMID)(10388 << 14)
+#define MC_GrabberError_CLCLkLoss_Y              (MCPARAMID)(10389 << 14)
+#define MC_GrabberError_CLCLkLoss_X              (MCPARAMID)(10390 << 14)
+#define MC_GrabberError_FB64                     (MCPARAMID)(10391 << 14)
+#define MC_GrabberError_FB128                    (MCPARAMID)(10392 << 14)
+#define MC_GrabberError_Intr_APA_Z               (MCPARAMID)(10393 << 14)
+#define MC_GrabberError_Intr_APA_Y               (MCPARAMID)(10394 << 14)
+#define MC_GrabberError_Intr_APA_X               (MCPARAMID)(10395 << 14)
+#define MC_GrabberError_Intr_MisEOL              (MCPARAMID)(10396 << 14)
+#define MC_GrabberError_Intr_QB_Ovf              (MCPARAMID)(10397 << 14)
+#define MC_GrabberError_Intr_DPFF_Ovf            (MCPARAMID)(10398 << 14)
+#define MC_AssyConfig_MEDIUM_2T24_2XE_1Y          27
+#define MC_BoardTopology_BASE_MEDIUM_FULL         39
+#define MC_BoardTopology_DECA                     40
+#define MC_GrabberError_Intr_PA_Z                (MCPARAMID)(10399 << 14)
+#define MC_GrabberError_Intr_PA_Y                (MCPARAMID)(10400 << 14)
+#define MC_GrabberError_Intr_PA_X                (MCPARAMID)(10401 << 14)
+#define MC_BoardTopologyCheck                    (MCPARAMID)(10402 << 14)
+#define MC_BoardTopologyCheck_PASS                 1
+#define MC_BoardTopologyCheck_FAIL                 2
+#define MC_BoardTopology_MONO_DECA                41
+#define MC_PCIePayloadSize                       (MCPARAMID)(10403 << 14)
+#define MC_PCIePayloadField                      (MCPARAMID)(10404 << 14)
+#define MC_CFD_Mode_Fipplter                     (MCPARAMID)(10405 << 14)
+#define MC_XDirectionForWic1                     (MCPARAMID)(10406 << 14)
+#define MC_XDirectionForWic2                     (MCPARAMID)(10407 << 14)
+#define MC_XDirectionForWic3                     (MCPARAMID)(10408 << 14)
+#define MC_XDirectionForWic4                     (MCPARAMID)(10409 << 14)
+#define MC_XDirectionForWic5                     (MCPARAMID)(10410 << 14)
+#define MC_XDirectionForWic6                     (MCPARAMID)(10411 << 14)
+#define MC_XDirectionForWic7                     (MCPARAMID)(10412 << 14)
+#define MC_XDirectionForWic8                     (MCPARAMID)(10413 << 14)
+#define MC_YDirectionForWic1                     (MCPARAMID)(10414 << 14)
+#define MC_YDirectionForWic2                     (MCPARAMID)(10415 << 14)
+#define MC_YDirectionForWic3                     (MCPARAMID)(10416 << 14)
+#define MC_YDirectionForWic4                     (MCPARAMID)(10417 << 14)
+#define MC_YDirectionForWic5                     (MCPARAMID)(10418 << 14)
+#define MC_YDirectionForWic6                     (MCPARAMID)(10419 << 14)
+#define MC_YDirectionForWic7                     (MCPARAMID)(10420 << 14)
+#define MC_YDirectionForWic8                     (MCPARAMID)(10421 << 14)
+#define MC_LinePitchInFrameStore_mw              (MCPARAMID)(10422 << 14)
+#define MC_YOffsetForWic1_mw                     (MCPARAMID)(10423 << 14)
+#define MC_YOffsetForWic2_mw                     (MCPARAMID)(10424 << 14)
+#define MC_YOffsetForWic3_mw                     (MCPARAMID)(10425 << 14)
+#define MC_YOffsetForWic4_mw                     (MCPARAMID)(10426 << 14)
+#define MC_YOffsetForWic5_mw                     (MCPARAMID)(10427 << 14)
+#define MC_YOffsetForWic6_mw                     (MCPARAMID)(10428 << 14)
+#define MC_YOffsetForWic7_mw                     (MCPARAMID)(10429 << 14)
+#define MC_YOffsetForWic8_mw                     (MCPARAMID)(10430 << 14)
+#define MC_WIC_WindowPitch_mw                    (MCPARAMID)(10431 << 14)
+#define MC_WIC_WindowOffset_byte_Wic1            (MCPARAMID)(10432 << 14)
+#define MC_WIC_WindowOffset_byte_Wic2            (MCPARAMID)(10433 << 14)
+#define MC_WIC_WindowOffset_byte_Wic3            (MCPARAMID)(10434 << 14)
+#define MC_WIC_WindowOffset_byte_Wic4            (MCPARAMID)(10435 << 14)
+#define MC_WIC_WindowOffset_byte_Wic5            (MCPARAMID)(10436 << 14)
+#define MC_WIC_WindowOffset_byte_Wic6            (MCPARAMID)(10437 << 14)
+#define MC_WIC_WindowOffset_byte_Wic7            (MCPARAMID)(10438 << 14)
+#define MC_WIC_WindowOffset_byte_Wic8            (MCPARAMID)(10439 << 14)
+#define MC_WIC_WindowOffset_mw_Wic1              (MCPARAMID)(10440 << 14)
+#define MC_WIC_WindowOffset_mw_Wic2              (MCPARAMID)(10441 << 14)
+#define MC_WIC_WindowOffset_mw_Wic3              (MCPARAMID)(10442 << 14)
+#define MC_WIC_WindowOffset_mw_Wic4              (MCPARAMID)(10443 << 14)
+#define MC_WIC_WindowOffset_mw_Wic5              (MCPARAMID)(10444 << 14)
+#define MC_WIC_WindowOffset_mw_Wic6              (MCPARAMID)(10445 << 14)
+#define MC_WIC_WindowOffset_mw_Wic7              (MCPARAMID)(10446 << 14)
+#define MC_WIC_WindowOffset_mw_Wic8              (MCPARAMID)(10447 << 14)
+#define MC__CWR_XDirection_WIC1                  (MCPARAMID)(10448 << 14)
+#define MC__CWR_XDirection_WIC2                  (MCPARAMID)(10449 << 14)
+#define MC__CWR_XDirection_WIC3                  (MCPARAMID)(10450 << 14)
+#define MC__CWR_XDirection_WIC4                  (MCPARAMID)(10451 << 14)
+#define MC__CWR_XDirection_WIC5                  (MCPARAMID)(10452 << 14)
+#define MC__CWR_XDirection_WIC6                  (MCPARAMID)(10453 << 14)
+#define MC__CWR_XDirection_WIC7                  (MCPARAMID)(10454 << 14)
+#define MC__CWR_XDirection_WIC8                  (MCPARAMID)(10455 << 14)
+#define MC_CWR_YOffsetForWic1                    (MCPARAMID)(10456 << 14)
+#define MC_CWR_YOffsetForWic2                    (MCPARAMID)(10457 << 14)
+#define MC_CWR_YOffsetForWic3                    (MCPARAMID)(10458 << 14)
+#define MC_CWR_YOffsetForWic4                    (MCPARAMID)(10459 << 14)
+#define MC_CWR_YOffsetForWic5                    (MCPARAMID)(10460 << 14)
+#define MC_CWR_YOffsetForWic6                    (MCPARAMID)(10461 << 14)
+#define MC_CWR_YOffsetForWic7                    (MCPARAMID)(10462 << 14)
+#define MC_CWR_YOffsetForWic8                    (MCPARAMID)(10463 << 14)
+#define MC_DPFifoLinePitch_mw_WIC1               (MCPARAMID)(10464 << 14)
+#define MC_DPFifoLinePitch_mw_WIC2               (MCPARAMID)(10465 << 14)
+#define MC_DPFifoLinePitch_mw_WIC3               (MCPARAMID)(10466 << 14)
+#define MC_DPFifoLinePitch_mw_WIC4               (MCPARAMID)(10467 << 14)
+#define MC_DPFifoLinePitch_mw_WIC5               (MCPARAMID)(10468 << 14)
+#define MC_DPFifoLinePitch_mw_WIC6               (MCPARAMID)(10469 << 14)
+#define MC_DPFifoLinePitch_mw_WIC7               (MCPARAMID)(10470 << 14)
+#define MC_DPFifoLinePitch_mw_WIC8               (MCPARAMID)(10471 << 14)
+#define MC__Lead_W1_byte                         (MCPARAMID)(10472 << 14)
+#define MC__Lead_W2_byte                         (MCPARAMID)(10473 << 14)
+#define MC__Lead_W3_byte                         (MCPARAMID)(10474 << 14)
+#define MC__Lead_W4_byte                         (MCPARAMID)(10475 << 14)
+#define MC__Lead_W5_byte                         (MCPARAMID)(10476 << 14)
+#define MC__Lead_W6_byte                         (MCPARAMID)(10477 << 14)
+#define MC__Lead_W7_byte                         (MCPARAMID)(10478 << 14)
+#define MC__Lead_W8_byte                         (MCPARAMID)(10479 << 14)
+#define MC_OutputFormatterConfig_M8DUAL           63
+#define MC__TapPerWindow_X                       (MCPARAMID)(10480 << 14)
+#define MC_InputPinName_CK_PRESENT               138
+#define MC_InputPinName_CHANNELLINK_UP           139
+#define MC_ConnectorName_IO_A                     34
+#define MC_ConnectorName_IO_B                     35
+#define MC_ConnectorName_TEST_CHECK123            36
+#define MC_ConnectorName_TEST_CHECK153            37
+#define MC_ConnectorName_TEST_CHECK45678          38
+#define MC_ConnectorName_CHK12345                 39
+#define MC_GrabberOverrun_FrameBuffer_A          (MCPARAMID)(10481 << 14)
+#define MC_GrabberOverrun_FrameTrigger_A         (MCPARAMID)(10482 << 14)
+#define MC_GrabberOverrun_LineTrigger_A          (MCPARAMID)(10483 << 14)
+#define MC_GrabberError_Intraction_Gloeps_B_4    (MCPARAMID)(10484 << 14)
+#define MC_GrabberError_Intraction_Gloeps_B_3    (MCPARAMID)(10485 << 14)
+#define MC_GrabberError_Intraction_Gloeps_B_2    (MCPARAMID)(10486 << 14)
+#define MC_GrabberError_Intraction_Gloeps_B_1    (MCPARAMID)(10487 << 14)
+#define MC_GrabberError_AcqCtlr_Gloeps_B_1       (MCPARAMID)(10488 << 14)
+#define MC_GrabberError_CmdFifo_Gloeps_B_2       (MCPARAMID)(10489 << 14)
+#define MC_GrabberError_CmdFifo_Gloeps_B_1       (MCPARAMID)(10490 << 14)
+#define MC_GrabberError_FB64MemCtrl_B            (MCPARAMID)(10491 << 14)
+#define MC_GrabberError_free_23                  (MCPARAMID)(10492 << 14)
+#define MC_GrabberError_free_22                  (MCPARAMID)(10493 << 14)
+#define MC_GrabberError_free_21                  (MCPARAMID)(10494 << 14)
+#define MC_GrabberError_free_20                  (MCPARAMID)(10495 << 14)
+#define MC_GrabberError_free_19                  (MCPARAMID)(10496 << 14)
+#define MC_GrabberError_Vdma_Gloeps_3            (MCPARAMID)(10497 << 14)
+#define MC_GrabberError_Vdma_Gloeps_2            (MCPARAMID)(10498 << 14)
+#define MC_GrabberError_Vdma_Gloeps_1            (MCPARAMID)(10499 << 14)
+#define MC_GrabberError_Intraction_Gloeps_A_4    (MCPARAMID)(10500 << 14)
+#define MC_GrabberError_Intraction_Gloeps_A_3    (MCPARAMID)(10501 << 14)
+#define MC_GrabberError_Intraction_Gloeps_A_2    (MCPARAMID)(10502 << 14)
+#define MC_GrabberError_Intraction_Gloeps_A_1    (MCPARAMID)(10503 << 14)
+#define MC_GrabberError_AcqCtlr_Gloeps_A_1       (MCPARAMID)(10504 << 14)
+#define MC_GrabberError_CmdFifo_Gloeps_A_2       (MCPARAMID)(10505 << 14)
+#define MC_GrabberError_CmdFifo_Gloeps_A_1       (MCPARAMID)(10506 << 14)
+#define MC_GrabberError_FB64MemCtrl_A            (MCPARAMID)(10507 << 14)
+#define MC_GrabberError_free7                    (MCPARAMID)(10508 << 14)
+#define MC_GrabberError_free6                    (MCPARAMID)(10509 << 14)
+#define MC_GrabberError_ErrorLocalStreamDescAdd  (MCPARAMID)(10510 << 14)
+#define MC_GrabberError_DescriptorParityError03  (MCPARAMID)(10511 << 14)
+#define MC_GrabberError_DescriptorParityError02  (MCPARAMID)(10512 << 14)
+#define MC_GrabberError_DescriptorParityError01  (MCPARAMID)(10513 << 14)
+#define MC_GrabberError_DescriptorParityError00  (MCPARAMID)(10514 << 14)
+#define MC_GrabberOverrun_FrameBuffer_B          (MCPARAMID)(10515 << 14)
+#define MC_GrabberOverrun_FrameTrigger_B         (MCPARAMID)(10516 << 14)
+#define MC_GrabberOverrun_LineTrigger_B          (MCPARAMID)(10517 << 14)
+#define MC_InputFunction_TESTCHECK789             21
+#define MC_TestPerforce                          (MCPARAMID)(10518 << 14)
+#define MC_PhaseLength_Pg_Filter                 (MCPARAMID)(10519 << 14)
+#define MC_PreStrobe_us_Filter                   (MCPARAMID)(10520 << 14)
+#define MC_ResetEdge_Filter                      (MCPARAMID)(10521 << 14)
+#define MC_CBD_ColorRegistrationX                (MCPARAMID)(10522 << 14)
+#define MC_CBD_ColorRegistrationY                (MCPARAMID)(10523 << 14)
+#define MC_TrueExp_filter                        (MCPARAMID)(10524 << 14)
+#define MC__Category_Diagnosis                    65
+#define MC_GrabberError_Intr_PA_B                (MCPARAMID)(10525 << 14)
+#define MC_GrabberError_Intr_MisEOL_B            (MCPARAMID)(10526 << 14)
+#define MC_GrabberError_Intr_QB_Ovf_B            (MCPARAMID)(10527 << 14)
+#define MC_GrabberError_Intr_DPFF_Ovf_B          (MCPARAMID)(10528 << 14)
+#define MC_GrabberError_AcqVsXfr_B               (MCPARAMID)(10529 << 14)
+#define MC_GrabberError_AdrCmdFifo_2_B           (MCPARAMID)(10530 << 14)
+#define MC_GrabberError_AdrCmdFifo_1_B           (MCPARAMID)(10531 << 14)
+#define MC_GrabberError_MemCtrl_B                (MCPARAMID)(10532 << 14)
+#define MC_GrabberError_Intr_PA_A                (MCPARAMID)(10533 << 14)
+#define MC_GrabberError_Intr_MisEOL_A            (MCPARAMID)(10534 << 14)
+#define MC_GrabberError_Intr_QB_Ovf_A            (MCPARAMID)(10535 << 14)
+#define MC_GrabberError_Intr_DPFF_Ovf_A          (MCPARAMID)(10536 << 14)
+#define MC_GrabberError_AcqVsXfr_A               (MCPARAMID)(10537 << 14)
+#define MC_GrabberError_AdrCmdFifo_2_A           (MCPARAMID)(10538 << 14)
+#define MC_GrabberError_AdrCmdFifo_1_A           (MCPARAMID)(10539 << 14)
+#define MC_GrabberError_MemCtrl_A                (MCPARAMID)(10540 << 14)
+#define MC_GrabberError_Intr_PA                  (MCPARAMID)(10541 << 14)
+#define MC_GrabberError_MemCtrl                  (MCPARAMID)(10542 << 14)
+#define MC_OutputFormatterConfig_M14              64
+#define MC_OutputFormatterConfig_RGB42PL          65
+#define MC_CRP_Bypass                            (MCPARAMID)(10543 << 14)
+#define MC_CRP_NumLinePartToSkip                 (MCPARAMID)(10544 << 14)
+#define MC_CRP_NumVdmaWordToSkip                 (MCPARAMID)(10545 << 14)
+#define MC_CRP_NumVdmaWordToTransfer             (MCPARAMID)(10546 << 14)
+#define MC_CRP_PlanarMode                        (MCPARAMID)(10547 << 14)
+#define MC_CRP_NumLineToSkip                     (MCPARAMID)(10548 << 14)
+#define MC_CRP_NumLineToTransfer                 (MCPARAMID)(10549 << 14)
+#define MC_CRP_NumByteToSkip                     (MCPARAMID)(10550 << 14)
+#define MC_CRP_FBAddOffset                       (MCPARAMID)(10551 << 14)
+#define MC_ResetDur_Filter                       (MCPARAMID)(10552 << 14)
+#define MC_RateDivisionFactor                    (MCPARAMID)(10553 << 14)
+#define MC_RateDivisionFactor_Filter             (MCPARAMID)(10554 << 14)
+#define MC__TRG_FTDCNT_M1                        (MCPARAMID)(10555 << 14)
+#define MC__TRG_NTDCNT_M1                        (MCPARAMID)(10556 << 14)
+#define MC__LTRG_RDFCNT_M2                       (MCPARAMID)(10557 << 14)
+#define MC_AssyConfig_QUADXENDYEND                28
+#define MC__CTD_TDCLK_SYNCLINETRIG                 7
+#define MC_LineRateMode_MASTER_CHANNEL             6
+#define MC__STM1_T1SEL_SYNCLINETRIG               11
+#define MC_SyncLinescanMode                      (MCPARAMID)(10558 << 14)
+#define MC_SyncLinescanMode_IDLE                   1
+#define MC_SyncLinescanMode_MASTER                 2
+#define MC_SyncLinescanMode_SLAVE                  3
+#define MC_SyncLinescanMode_Filter               (MCPARAMID)(10559 << 14)
+#define MC__STM1_LRSEL_SYNCLINETRIG                5
+#define MC_IOUT2Usage_SYNC_STARTACQ                3
+#define MC_IOUT3Usage_SYNC_ENDACQ                  3
+#define MC_IOUT4Usage_SYNC_LINETRIG                3
+#define MC_IIN2Usage_SYNC_STARTACQ                 4
+#define MC_IIN3Usage_SYNC_ENDACQ                   4
+#define MC_IIN4Usage_SYNC_LINETRIG                 4
+#define MC_SyncLinescanMode_NONE                   4
+#define MC__RstCLClkOnChannelStart               (MCPARAMID)(10560 << 14)
+#define MC__RstCLClkOnChannelStart_ENABLED         1
+#define MC__RstCLClkOnChannelStart_DISABLED        2
+#define MC_PageOrLongPageModeOnly_Filter         (MCPARAMID)(10561 << 14)
+#define MC_WebOrLongPageModeOnly_Filter          (MCPARAMID)(10562 << 14)
+#define MC_EndPageDelay_Ln_Filter                (MCPARAMID)(10563 << 14)
+#define MC_AsyncRst_Filter                       (MCPARAMID)(10564 << 14)
+#define MC_BoardTopology_ECCO                     42
+#define MC_BoardTopology_ECCO_DECA                43
+#define MC_BoardTopology_ECCO_OFF                 44
+#define MC_SerialLinkA                           (MCPARAMID)(10565 << 14)
+#define MC_SerialLinkA_STANDARD                    1
+#define MC_SerialLinkB                           (MCPARAMID)(10566 << 14)
+#define MC_SerialLinkB_STANDARD                    1
+#define MC_TapConfiguration_LITE_1T8              48
+#define MC_TapConfiguration_LITE_1T10             49
+#define MC_IIN3Usage_SYNC_STARTENDACQ              5
+#define MC_IOUT3Usage_SYNC_STARTENDACQ             4
+#define MC_SyncLinescanMode_INTERNAL_MASTER        5
+#define MC_SyncLinescanMode_INTERNAL_SLAVE         6
+#define MC_TrigMode_MASTER_CHANNEL                10
+#define MC__SyncLinescanMode                     (MCPARAMID)(10567 << 14)
+#define MC__SyncLinescanMode_NONE                  1
+#define MC__SyncLinescanMode_MASTER                2
+#define MC__SyncLinescanMode_SLAVE                 3
+#define MC_EndTrigMode_MASTER_CHANNEL              3
+#define MC_SerialLinkA_POCL_LITE                   2
+#define MC_SerialLinkB_POCL_LITE                   2
+#define MC_ECCO_SkewCompensation                 (MCPARAMID)(10568 << 14)
+#define MC_ECCO_SkewCompensation_ON                1
+#define MC_ECCO_SkewCompensation_OFF               2
+#define MC_ECCO_Filter                           (MCPARAMID)(10569 << 14)
+#define MC_ECCO_PLLResetControl                  (MCPARAMID)(10570 << 14)
+#define MC_ECCO_PLLResetControl_CHANNEL_ACTIVE     1
+#define MC_ECCO_PLLResetControl_AUTOMATIC          2
+#define MC_SynchronizedAcquisition               (MCPARAMID)(10571 << 14)
+#define MC_SynchronizedAcquisition_OFF             1
+#define MC_SynchronizedAcquisition_MASTER          2
+#define MC_SynchronizedAcquisition_SLAVE           3
+#define MC_SynchronizedAcquisition_INTERNAL_MASTER   4
+#define MC_SynchronizedAcquisition_INTERNAL_SLAVE   5
+#define MC_SynchronizedAcquisition_Filter        (MCPARAMID)(10572 << 14)
+#define MC__SynchronizedAcquisition              (MCPARAMID)(10573 << 14)
+#define MC__SynchronizedAcquisition_OFF            1
+#define MC__SynchronizedAcquisition_MASTER         2
+#define MC__SynchronizedAcquisition_SLAVE          3
+#define MC_PixelClkMode                          (MCPARAMID)(10574 << 14)
+#define MC_PixelClkMode_PERMANENT                  1
+#define MC_PixelClkMode_INTERMITTENT               2
+#define MC_TrigMode_SLAVE                         11
+#define MC_EndTrigMode_SLAVE                       4
+#define MC_LineRateMode_SLAVE                      7
+#define MC_NextTrigMode_SLAVE                     11
+#define MC_SynchronizedAcquisition_LOCAL_MASTER    6
+#define MC_SynchronizedAcquisition_LOCAL_SLAVE     7
+#define MC_SetSignal                             (MCPARAMID)(10575 << 14)
+#define MC_SetSignal_NONE                          1
+#define MC_SetSignal_SCA                           2
+#define MC_SetSignal_ECA                           3
+#define MC_SetSignal_SAP                           4
+#define MC_SetSignal_EAP                           5
+#define MC_SetSignal_SAS                           6
+#define MC_SetSignal_EAS                           7
+#define MC_SetSignal_FVAL_GOHIGH                   8
+#define MC_SetSignal_FVAL_GOLOW                    9
+#define MC_SetSignal_LVAL_GOHIGH                  10
+#define MC_SetSignal_LVAL_GOLOW                   11
+#define MC_SetSignal_DVAL_GOHIGH                  12
+#define MC_SetSignal_DVAL_GOLOW                   13
+#define MC_SetSignal_CC1_GOHIGH                   14
+#define MC_SetSignal_CC1_GOLOW                    15
+#define MC_SetSignal_CC2_GOHIGH                   16
+#define MC_SetSignal_CC2_GOLOW                    17
+#define MC_SetSignal_CC3_GOHIGH                   18
+#define MC_SetSignal_CC3_GOLOW                    19
+#define MC_SetSignal_CC4_GOHIGH                   20
+#define MC_SetSignal_CC4_GOLOW                    21
+#define MC_ResetSignal                           (MCPARAMID)(10576 << 14)
+#define MC_ResetSignal_NONE                        1
+#define MC_ResetSignal_SCA                         2
+#define MC_ResetSignal_ECA                         3
+#define MC_ResetSignal_SAP                         4
+#define MC_ResetSignal_EAP                         5
+#define MC_ResetSignal_SAS                         6
+#define MC_ResetSignal_EAS                         7
+#define MC_ResetSignal_FVAL_GOHIGH                 8
+#define MC_ResetSignal_FVAL_GOLOW                  9
+#define MC_ResetSignal_LVAL_GOHIGH                10
+#define MC_ResetSignal_LVAL_GOLOW                 11
+#define MC_ResetSignal_DVAL_GOHIGH                12
+#define MC_ResetSignal_DVAL_GOLOW                 13
+#define MC_ResetSignal_CC1_GOHIGH                 14
+#define MC_ResetSignal_CC1_GOLOW                  15
+#define MC_ResetSignal_CC2_GOHIGH                 16
+#define MC_ResetSignal_CC2_GOLOW                  17
+#define MC_ResetSignal_CC3_GOHIGH                 18
+#define MC_ResetSignal_CC3_GOLOW                  19
+#define MC_ResetSignal_CC4_GOHIGH                 20
+#define MC_ResetSignal_CC4_GOLOW                  21
+#define MC_SetDelay                              (MCPARAMID)(10577 << 14)
+#define MC_SetDelay_NONE                           1
+#define MC_SetDelay_10us                           2
+#define MC_SetDelay_20us                           3
+#define MC_SetDelay_50us                           4
+#define MC_SetDelay_100us                          5
+#define MC_SetDelay_200us                          6
+#define MC_SetDelay_500us                          7
+#define MC_SetDelay_1ms                            8
+#define MC_SetDelay_2ms                            9
+#define MC_SetDelay_5ms                           10
+#define MC_SetDelay_10ms                          11
+#define MC_SetDelay_20ms                          12
+#define MC_SetDelay_50ms                          13
+#define MC_SetDelay_100ms                         14
+#define MC_SetDelay_200ms                         15
+#define MC_SetDelay_500ms                         16
+#define MC_ResetDelay                            (MCPARAMID)(10578 << 14)
+#define MC_ResetDelay_NONE                         1
+#define MC_ResetDelay_10us                         2
+#define MC_ResetDelay_20us                         3
+#define MC_ResetDelay_50us                         4
+#define MC_ResetDelay_100us                        5
+#define MC_ResetDelay_200us                        6
+#define MC_ResetDelay_500us                        7
+#define MC_ResetDelay_1ms                          8
+#define MC_ResetDelay_2ms                          9
+#define MC_ResetDelay_5ms                         10
+#define MC_ResetDelay_10ms                        11
+#define MC_ResetDelay_20ms                        12
+#define MC_ResetDelay_50ms                        13
+#define MC_ResetDelay_100ms                       14
+#define MC_ResetDelay_200ms                       15
+#define MC_ResetDelay_500ms                       16
+#define MC_OutputConfig_EVENT                      3
+#define MC_OutputFunction_EVENT                   16
+#define MC_IOUT1Usage_SOFT                         3
+#define MC_IOUT1Usage_EVENT                        4
+#define MC_IOUT2Usage_SOFT                         4
+#define MC_IOUT2Usage_EVENT                        5
+#define MC_IOUT3Usage_SOFT                         5
+#define MC_IOUT3Usage_EVENT                        6
+#define MC_IOUT4Usage_SOFT                         4
+#define MC_IOUT4Usage_EVENT                        5
+#define MC_BoardTopology_MONO_SLOW                45
+#define MC_ECCO_PLLResetControl_CHANNEL_ACTIVATION   3
+#define MC_BoardTopology_DUO_SLOW                 46
+#define MC__Out1FreeForChannel                   (MCPARAMID)(10579 << 14)
+#define MC__Out1FreeForChannel_NO                  1
+#define MC__Out1FreeForChannel_YES                 2
+#define MC__Out2FreeForChannel                   (MCPARAMID)(10580 << 14)
+#define MC__Out2FreeForChannel_NO                  1
+#define MC__Out2FreeForChannel_YES                 2
+#define MC__Out3FreeForChannel                   (MCPARAMID)(10581 << 14)
+#define MC__Out3FreeForChannel_NO                  1
+#define MC__Out3FreeForChannel_YES                 2
+#define MC__Out4FreeForChannel                   (MCPARAMID)(10582 << 14)
+#define MC__Out4FreeForChannel_NO                  1
+#define MC__Out4FreeForChannel_YES                 2
+#define MC__Out12FreeForChannel                  (MCPARAMID)(10583 << 14)
+#define MC__Out12FreeForChannel_NO                 1
+#define MC__Out12FreeForChannel_YES                2
+#define MC__Out13FreeForChannel                  (MCPARAMID)(10584 << 14)
+#define MC__Out13FreeForChannel_NO                 1
+#define MC__Out13FreeForChannel_YES                2
+#define MC__Out14FreeForChannel                  (MCPARAMID)(10585 << 14)
+#define MC__Out14FreeForChannel_NO                 1
+#define MC__Out14FreeForChannel_YES                2
+#define MC__Out15FreeForChannel                  (MCPARAMID)(10586 << 14)
+#define MC__Out15FreeForChannel_NO                 1
+#define MC__Out15FreeForChannel_YES                2
+#define MC_EventDelay_Filter                     (MCPARAMID)(10587 << 14)
+#define MC_IOUT1Usage_BOARD                        5
+#define MC_IOUT2Usage_BOARD                        6
+#define MC_IOUT3Usage_BOARD                        7
+#define MC_IOUT4Usage_BOARD                        6
+#define MC_EventSignaling_xx_Filter              (MCPARAMID)(10588 << 14)
+#define MC_EventSignaling_1_Filter               (MCPARAMID)(10589 << 14)
+#define MC_EventSignaling_2_Filter               (MCPARAMID)(10590 << 14)
+#define MC_EventSignaling_3_Filter               (MCPARAMID)(10591 << 14)
+#define MC_EventSignaling_4_Filter               (MCPARAMID)(10592 << 14)
+#define MC_EventSignaling_7_Filter               (MCPARAMID)(10593 << 14)
+#define MC_EventSignaling_8_Filter               (MCPARAMID)(10594 << 14)
+#define MC_EventSignaling_9_Filter               (MCPARAMID)(10595 << 14)
+#define MC_EventSignaling_10_Filter              (MCPARAMID)(10596 << 14)
+#define MC_FVAL_PULSE_MIN                        (MCPARAMID)(10597 << 14)
+#define MC_FVAL_PULSE_MIN_1                        1
+#define MC_FVAL_PULSE_MIN_3                        2
+#define MC_LVAL_PULSE_MIN                        (MCPARAMID)(10598 << 14)
+#define MC_LVAL_PULSE_MIN_1                        1
+#define MC_LVAL_PULSE_MIN_2                        2
+#define MC_RECOVERED_ERRORS_X                    (MCPARAMID)(10599 << 14)
+#define MC_RECOVERED_ERRORS_Y                    (MCPARAMID)(10600 << 14)
+#define MC_RECOVERED_ERRORS_Z                    (MCPARAMID)(10601 << 14)
+#define MC_CLOCKING_ERRORS_X                     (MCPARAMID)(10602 << 14)
+#define MC_CLOCKING_ERRORS_Y                     (MCPARAMID)(10603 << 14)
+#define MC_CLOCKING_ERRORS_Z                     (MCPARAMID)(10604 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_X      (MCPARAMID)(10605 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_X (MCPARAMID)(10606 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_X (MCPARAMID)(10607 << 14)
+#define MC_EventSignaling_12_Filter              (MCPARAMID)(10608 << 14)
+#define MC_EventSignaling_13_Filter              (MCPARAMID)(10609 << 14)
+#define MC_EventSignaling_14_Filter              (MCPARAMID)(10610 << 14)
+#define MC_EventSignaling_15_Filter              (MCPARAMID)(10611 << 14)
+#define MC_EventSignaling_18_Filter              (MCPARAMID)(10612 << 14)
+#define MC_EventSignaling_19_Filter              (MCPARAMID)(10613 << 14)
+#define MC_EventSignaling_20_Filter              (MCPARAMID)(10614 << 14)
+#define MC_EventSignaling_21_Filter              (MCPARAMID)(10615 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_B      (MCPARAMID)(10616 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_B (MCPARAMID)(10617 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_B (MCPARAMID)(10618 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_A      (MCPARAMID)(10619 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_A (MCPARAMID)(10620 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_A (MCPARAMID)(10621 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_Z      (MCPARAMID)(10622 << 14)
+#define MC_GrabberOverrun_Clocking_Errors_Y      (MCPARAMID)(10623 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_Z (MCPARAMID)(10624 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_Z (MCPARAMID)(10625 << 14)
+#define MC_GrabberOverrun_Recovered_LVal_Errors_Y (MCPARAMID)(10626 << 14)
+#define MC_GrabberOverrun_Recovered_FVal_Errors_Y (MCPARAMID)(10627 << 14)
+#define MC_FvalMin_Tk                            (MCPARAMID)(10628 << 14)
+#define MC_FvalMin_Tk_1                            1
+#define MC_FvalMin_Tk_3                            2
+#define MC_LvalMin_Tk                            (MCPARAMID)(10629 << 14)
+#define MC_LvalMin_Tk_1                            1
+#define MC_LvalMin_Tk_2                            2
+#define MC_ChannelLinkSyncErrors_X               (MCPARAMID)(10630 << 14)
+#define MC_ChannelLinkClockErrors_X              (MCPARAMID)(10631 << 14)
+#define MC_ChannelLinkSyncErrors_Y               (MCPARAMID)(10632 << 14)
+#define MC_ChannelLinkSyncErrors_Z               (MCPARAMID)(10633 << 14)
+#define MC_ChannelLinkClockErrors_Y              (MCPARAMID)(10634 << 14)
+#define MC_ChannelLinkClockErrors_Z              (MCPARAMID)(10635 << 14)
+#define MC_ExposeReadoutRecovery_Filter          (MCPARAMID)(10636 << 14)
+#define MC_PCIeLinkInfo                          (MCPARAMID)(10637 << 14)
+#define MC_PCIeLinkRetrainingCounter             (MCPARAMID)(10638 << 14)
+#define MC_ECCOMode                              (MCPARAMID)(10639 << 14)
+#define MC_ECCOMode_YES                            1
+#define MC_ECCOMode_NO                             2
+#define MC_TapGeometry_10X                        61
+#define MC_TapGeometry_10X_1Y                     62
+#define MC_CLCAM_Geometry_TG_10X1                 30
+#define MC_AssyConfig_DECA_1X10                   29
+#define MC_AssyConfig_DECA_10X1                   30
+#define MC_XDirectionForWic9                     (MCPARAMID)(10640 << 14)
+#define MC_XDirectionForWic10                    (MCPARAMID)(10641 << 14)
+#define MC_YDirectionForWic9                     (MCPARAMID)(10642 << 14)
+#define MC_YDirectionForWic10                    (MCPARAMID)(10643 << 14)
+#define MC_NumOfWindows_TEN                        6
+#define MC__CDC_FSLIC_SIXTEEN_64                  15
+#define MC__LeadWords_W9                         (MCPARAMID)(10644 << 14)
+#define MC__LeadWords_W10                        (MCPARAMID)(10645 << 14)
+#define MC__Lead_W9                              (MCPARAMID)(10646 << 14)
+#define MC__Lead_W10                             (MCPARAMID)(10647 << 14)
+#define MC_YOffsetForWic9_mw                     (MCPARAMID)(10648 << 14)
+#define MC_YOffsetForWic10_mw                    (MCPARAMID)(10649 << 14)
+#define MC_WIC_WindowOffset_byte_Wic9            (MCPARAMID)(10650 << 14)
+#define MC_WIC_WindowOffset_byte_Wic10           (MCPARAMID)(10651 << 14)
+#define MC_WIC_WindowOffset_mw_Wic9              (MCPARAMID)(10652 << 14)
+#define MC_WIC_WindowOffset_mw_Wic10             (MCPARAMID)(10653 << 14)
+#define MC__CWR_XDirection_WIC9                  (MCPARAMID)(10654 << 14)
+#define MC__CWR_XDirection_WIC10                 (MCPARAMID)(10655 << 14)
+#define MC_CWR_YOffsetForWic9                    (MCPARAMID)(10656 << 14)
+#define MC_CWR_YOffsetForWic10                   (MCPARAMID)(10657 << 14)
+#define MC__Lead_W9_byte                         (MCPARAMID)(10658 << 14)
+#define MC__Lead_W10_byte                        (MCPARAMID)(10659 << 14)
+#define MC_DPFifoLinePitch_mw_WIC9               (MCPARAMID)(10660 << 14)
+#define MC_DPFifoLinePitch_mw_WIC10              (MCPARAMID)(10661 << 14)
+#define MC_AssyConfig_TRIPLEXPAIR                 31
+#define MC_AssyConfig_TRIPLEXTAP                  32
+#define MC__CDC_FSLIC_FOUR_128                    16
+#define MC_TrigRepeatCounter                     (MCPARAMID)(10662 << 14)
+#define MC__HardTriggerSrcIsEnabled              (MCPARAMID)(10663 << 14)
+#define MC__HardTriggerSrcIsEnabled_NO             1
+#define MC__HardTriggerSrcIsEnabled_YES            2
+#define MC_TrigRepeatCounterCheck                (MCPARAMID)(10664 << 14)
+#define MC_TrigRepeatCounterCheck_PASS             1
+#define MC_TrigRepeatCounterCheck_FAIL             2
+#define MC_TrigRepeatCountCheck                  (MCPARAMID)(10665 << 14)
+#define MC_TrigRepeatCountCheck_PASS               1
+#define MC_TrigRepeatCountCheck_FAIL               2
+#define MC_TrigRepeatCount                       (MCPARAMID)(10666 << 14)
+#define MC_EqualizationLevel                     (MCPARAMID)(10667 << 14)
+#define MC_EqualizationLevel_OFF                   1
+#define MC_EqualizationLevel_LOW                   2
+#define MC_EqualizationLevel_MEDIUM                3
+#define MC_EqualizationLevel_HIGH                  4
+#define MC_GrabberType_FullXR                      4
+#define MC_FullXR_Filter                         (MCPARAMID)(10668 << 14)
+#define MC_Equalizer_Feature                     (MCPARAMID)(10669 << 14)
+#define MC_Equalizer_Feature_YES                   1
+#define MC_Equalizer_Feature_NO                    2
+#define MC_Equalizer_Filter                      (MCPARAMID)(10670 << 14)
+#define MC_LvalDataGating                        (MCPARAMID)(10671 << 14)
+#define MC_LvalDataGating_OFF                      1
+#define MC_LvalDataGating_ON                       2
+#define MC_EndTrigEffect                         (MCPARAMID)(10672 << 14)
+#define MC_EndTrigEffect_FOLLOWINGLINE             1
+#define MC_EndTrigEffect_PREVIOUSLINE              2
+#define MC__BackwardMotionCancellation_Check     (MCPARAMID)(10673 << 14)
+#define MC__BackwardMotionCancellation_Check_PASS   1
+#define MC__BackwardMotionCancellation_Check_FAIL   2
+#define MC_EndTrigEffect_PRECEDINGLINE             3
+#define MC_EndTrigEffect_Filter                  (MCPARAMID)(10674 << 14)
+#define MC_TrigDelay_Pls_Filter                  (MCPARAMID)(10675 << 14)
+#define MC_NextTrigDelay_Pls_Filter              (MCPARAMID)(10676 << 14)
+#define MC_BackwardMotionCancellationMode_Filter (MCPARAMID)(10677 << 14)
+#define MC_ForwardDirection_Filter               (MCPARAMID)(10678 << 14)
+#define MC_AssyConfig_MEDIUM_2T24_2X_1Y           33
+#define MC_AssyConfig_MEDIUM_2T24_2XM_1Y          34
+#define MC_AssyConfig_MEDIUM_2T24_2XR_1Y          35
+#define MC_TapGeometry_1X_2Y                      63
+#define MC_CLCAM_Geometry_TG_1X_2Y                31
+#define MC_ECCO_Feature                          (MCPARAMID)(10679 << 14)
+#define MC_ECCO_Feature_YES                        1
+#define MC_ECCO_Feature_NO                         2
+#define MC__Category_White_Balance_Operator       66
+#define MC_WBO_OrgX_Internal                     (MCPARAMID)(10680 << 14)
+#define MC_WBO_OrgY_Internal                     (MCPARAMID)(10681 << 14)
+#define MC_Fld_Gain_R                            (MCPARAMID)(10682 << 14)
+#define MC_Fld_Gain_G                            (MCPARAMID)(10683 << 14)
+#define MC_Fld_Gain_B                            (MCPARAMID)(10684 << 14)
+#define MC_CPA_NumByteToPadd                     (MCPARAMID)(10685 << 14)
+#define MC_CPA_NumByteToPad                      (MCPARAMID)(10686 << 14)
+#define MC_WBO_OrgX_Min                          (MCPARAMID)(10687 << 14)
+#define MC_WBO_OrgY_Min                          (MCPARAMID)(10688 << 14)
+#define MC_WBO_Effective_Width                   (MCPARAMID)(10689 << 14)
+#define MC_WBO_Effective_Height                  (MCPARAMID)(10690 << 14)
+#define MC_WBO_Effective_OrgX                    (MCPARAMID)(10691 << 14)
+#define MC_WBO_Effective_OrgY                    (MCPARAMID)(10692 << 14)
+#define MC_WBO_OrgX_After_Flipping               (MCPARAMID)(10693 << 14)
+#define MC_WBO_Width_Min                         (MCPARAMID)(10694 << 14)
+#define MC_WBO_OrgY_After_Flipping               (MCPARAMID)(10695 << 14)
+#define MC_WBO_Height_Min                        (MCPARAMID)(10696 << 14)
+#define MC_MaxFillingBuffers                     (MCPARAMID)(10697 << 14)
+#define MC_WBO_Decimation_OffsetX                (MCPARAMID)(10698 << 14)
+#define MC_AcqTimeoutInHw_ms                     (MCPARAMID)(10699 << 14)
+#define MC_AcqTimeoutBounded_ms                  (MCPARAMID)(10700 << 14)
+#define MC_AcqTimeoutInHwMax_ms_c                (MCPARAMID)(10701 << 14)
+#define MC_AcqTimerTic_ns_c                      (MCPARAMID)(10702 << 14)
+#define MC_AcqTimerRge_tic_c                     (MCPARAMID)(10703 << 14)
+#define MC_AcqTimerTotalTics_flt                 (MCPARAMID)(10704 << 14)
+#define MC_AcqTimerTotalTics_int                 (MCPARAMID)(10705 << 14)
+#define MC_AcqTimerScaler_Fld                    (MCPARAMID)(10706 << 14)
+#define MC_AcqTimerScaler_int                    (MCPARAMID)(10707 << 14)
+#define MC_AcqTimerCounter_Fld                   (MCPARAMID)(10708 << 14)
+#define MC_AcqTimerMax_tic_c                     (MCPARAMID)(10709 << 14)
+#define MC_AcqTimeoutInHw_bounded_ms             (MCPARAMID)(10710 << 14)
+#define MC_AcqTimeOutCheck                       (MCPARAMID)(10711 << 14)
+#define MC_AcqTimeOutCheck_PASS                    1
+#define MC_AcqTimeOutCheck_FAIL                    2
+#define MC_MaxFillingSurfaces                    (MCPARAMID)(10712 << 14)
+#define MC_MaxFillingSurfaces_MINIMUM              1
+#define MC_MaxFillingSurfaces_MAXIMUM              2
+#define MC_TapGeometry_2XM_1Y2                    64
+#define MC_TapGeometry_2XR_2YE                    65
+#define MC_CLCAM_Geometry_TG_1X2_1Y2              32
+#define MC_CLCAM_Geometry_TG_2X_1Y2               33
+#define MC_CLCAM_Geometry_TG_2XE_1Y2              34
+#define MC_CLCAM_Geometry_TG_2XM_1Y2              35
+#define MC_AssyConfig_QUADXPAIRYPAIR              36
+#define MC_XRegions                              (MCPARAMID)(10713 << 14)
+#define MC_TapConfiguration_MEDIUM_6T8            50
+#define MC_TapGeometry_1X3_1Y2                    66
+#define MC_TapGeometry_2X2_1Y2                    67
+#define MC_TapGeometry_2X2E_1Y2                   68
+#define MC_TapGeometry_2X2M_1Y2                   69
+#define MC_TapGeometry_3X_1Y2                     70
+#define MC_TapGeometry_1X3_2YE                    71
+#define MC_TapGeometry_1X4_2YE                    72
+#define MC_TapGeometry_2X2_2YE                    73
+#define MC_TapGeometry_3X_2YE                     74
+#define MC_TapGeometry_4X_2YE                     75
+#define MC_TapGeometry_4XE_2YE                    76
+#define MC_TapGeometry_4XR_2YE                    77
+#define MC_TapGeometry_Y                         (MCPARAMID)(10714 << 14)
+#define MC_TapGeometry_Y_1Y                        1
+#define MC_TapGeometry_Y_1Y2                       2
+#define MC_TapGeometry_Y_2YE                       3
+#define MC_AssyConfig_1X                          37
+#define MC_AssyConfig_1X2                         38
+#define MC_AssyConfig_1X3                         39
+#define MC_AssyConfig_1X4                         40
+#define MC_AssyConfig_1X8                         41
+#define MC_AssyConfig_1X10                        42
+#define MC_AssyConfig_2X                          43
+#define MC_AssyConfig_2XE                         44
+#define MC_AssyConfig_2XM                         45
+#define MC_AssyConfig_2XR                         46
+#define MC_AssyConfig_2X2                         47
+#define MC_AssyConfig_2X2E                        48
+#define MC_AssyConfig_2X2M                        49
+#define MC_AssyConfig_2X4                         50
+#define MC_AssyConfig_3X                          51
+#define MC_AssyConfig_4X                          52
+#define MC_AssyConfig_4XE                         53
+#define MC_AssyConfig_4XR                         54
+#define MC_AssyConfig_4X2                         55
+#define MC_AssyConfig_4X2E                        56
+#define MC_AssyConfig_8X                          57
+#define MC_AssyConfig_8XR                         58
+#define MC_AssyConfig_10X                         59
+#define MC_AssyConfig_1X_2                        60
+#define MC_AssyConfig_1X2_2                       61
+#define MC_AssyConfig_1X3_2                       62
+#define MC_AssyConfig_1X4_2                       63
+#define MC_AssyConfig_2X_2                        64
+#define MC_AssyConfig_2XE_2                       65
+#define MC_AssyConfig_2XM_2                       66
+#define MC_AssyConfig_2XR_2                       67
+#define MC_AssyConfig_2X2_2                       68
+#define MC_AssyConfig_2X2E_2                      69
+#define MC_AssyConfig_2X2M_2                      70
+#define MC_AssyConfig_3X_2                        71
+#define MC_AssyConfig_4X_2                        72
+#define MC_AssyConfig_4XE_2                       73
+#define MC_AssyConfig_4XR_2                       74
+#define MC_NumOfWindows_SIX                        7
+#define MC_RegionIndex_x_Wic1                    (MCPARAMID)(10715 << 14)
+#define MC_RegionIndex_x_Wic2                    (MCPARAMID)(10716 << 14)
+#define MC_RegionIndex_x_Wic3                    (MCPARAMID)(10717 << 14)
+#define MC_RegionIndex_x_Wic4                    (MCPARAMID)(10718 << 14)
+#define MC_RegionIndex_x_Wic5                    (MCPARAMID)(10719 << 14)
+#define MC_RegionIndex_x_Wic6                    (MCPARAMID)(10720 << 14)
+#define MC_RegionIndex_x_Wic7                    (MCPARAMID)(10721 << 14)
+#define MC_RegionIndex_x_Wic8                    (MCPARAMID)(10722 << 14)
+#define MC_RegionIndex_x_Wic9                    (MCPARAMID)(10723 << 14)
+#define MC_RegionIndex_x_Wic10                   (MCPARAMID)(10724 << 14)
+#define MC_RegionIndex_y_Wic1                    (MCPARAMID)(10725 << 14)
+#define MC_RegionIndex_y_Wic2                    (MCPARAMID)(10726 << 14)
+#define MC_RegionIndex_y_Wic3                    (MCPARAMID)(10727 << 14)
+#define MC_RegionIndex_y_Wic4                    (MCPARAMID)(10728 << 14)
+#define MC_RegionIndex_y_Wic5                    (MCPARAMID)(10729 << 14)
+#define MC_RegionIndex_y_Wic6                    (MCPARAMID)(10730 << 14)
+#define MC_RegionIndex_y_Wic7                    (MCPARAMID)(10731 << 14)
+#define MC_RegionIndex_y_Wic8                    (MCPARAMID)(10732 << 14)
+#define MC_RegionIndex_y_Wic9                    (MCPARAMID)(10733 << 14)
+#define MC_RegionIndex_y_Wic10                   (MCPARAMID)(10734 << 14)
+#define MC_RegionOffset_Wic1                     (MCPARAMID)(10735 << 14)
+#define MC_RegionOffset_Wic2                     (MCPARAMID)(10736 << 14)
+#define MC_RegionOffset_Wic3                     (MCPARAMID)(10737 << 14)
+#define MC_RegionOffset_Wic4                     (MCPARAMID)(10738 << 14)
+#define MC_RegionOffset_Wic5                     (MCPARAMID)(10739 << 14)
+#define MC_RegionOffset_Wic6                     (MCPARAMID)(10740 << 14)
+#define MC_RegionOffset_Wic7                     (MCPARAMID)(10741 << 14)
+#define MC_RegionOffset_Wic8                     (MCPARAMID)(10742 << 14)
+#define MC_RegionOffset_Wic9                     (MCPARAMID)(10743 << 14)
+#define MC_RegionOffset_Wic10                    (MCPARAMID)(10744 << 14)
+#define MC_XDirectionForD1                       (MCPARAMID)(10745 << 14)
+#define MC_XDirectionForD2                       (MCPARAMID)(10746 << 14)
+#define MC_XDirectionForD3                       (MCPARAMID)(10747 << 14)
+#define MC_XDirectionForD4                       (MCPARAMID)(10748 << 14)
+#define MC_XDirectionForD5                       (MCPARAMID)(10749 << 14)
+#define MC_XDirectionForD6                       (MCPARAMID)(10750 << 14)
+#define MC_XDirectionForD7                       (MCPARAMID)(10751 << 14)
+#define MC_XDirectionForD8                       (MCPARAMID)(10752 << 14)
+#define MC_XDirectionForD9                       (MCPARAMID)(10753 << 14)
+#define MC_XDirectionForD10                      (MCPARAMID)(10754 << 14)
+#define MC_CLCAM_Geometry_TG_2XR_1Y2              36
+#define MC_CLCAM_Geometry_TG_2XR_2YE              37
+#define MC_CLCAM_Geometry_TG_1X3_1Y2              38
+#define MC_CLCAM_Geometry_TG_3X_1Y2               39
+#define MC_CLCAM_Geometry_TG_1X3_2YE              40
+#define MC_CLCAM_Geometry_TG_3X_2YE               41
+#define MC_CLCAM_Geometry_TG_1X4_1Y2              42
+#define MC_CLCAM_Geometry_TG_4X_1Y2               43
+#define MC_CLCAM_Geometry_TG_4XE_1Y2              44
+#define MC_CLCAM_Geometry_TG_4XR_1Y2              45
+#define MC_CLCAM_Geometry_TG_2X2_1Y2              46
+#define MC_CLCAM_Geometry_TG_2X2E_1Y2             47
+#define MC_CLCAM_Geometry_TG_2X2M_1Y2             48
+#define MC_CLCAM_Geometry_TG_1X4_2YE              49
+#define MC_CLCAM_Geometry_TG_4X_2YE               50
+#define MC_CLCAM_Geometry_TG_4XE_2YE              51
+#define MC_CLCAM_Geometry_TG_4XR_2YE              52
+#define MC_CLCAM_Geometry_TG_2X2_2YE              53
+#define MC_CLCAM_Geometry_TG_2X2M_2YE             54
+#define MC_CLCAM_Geometry_TG_10X                  55
+#define MC_YOffsetForAllWics_mw                  (MCPARAMID)(10755 << 14)
+#define MC_CWR_YOffsetForAllWics                 (MCPARAMID)(10756 << 14)
+#define MC_XDirectionForW1                       (MCPARAMID)(10757 << 14)
+#define MC_XDirectionForW2                       (MCPARAMID)(10758 << 14)
+#define MC_XDirectionForW3                       (MCPARAMID)(10759 << 14)
+#define MC_XDirectionForW4                       (MCPARAMID)(10760 << 14)
+#define MC_XDirectionForW5                       (MCPARAMID)(10761 << 14)
+#define MC_XDirectionForW6                       (MCPARAMID)(10762 << 14)
+#define MC_XDirectionForW7                       (MCPARAMID)(10763 << 14)
+#define MC_XDirectionForW8                       (MCPARAMID)(10764 << 14)
+#define MC_XDirectionForW9                       (MCPARAMID)(10765 << 14)
+#define MC_XDirectionForW10                      (MCPARAMID)(10766 << 14)
+#define MC__CDA_REFASSYNR_WIC1                   (MCPARAMID)(10767 << 14)
+#define MC__CDA_REFASSYNR_WIC2                   (MCPARAMID)(10768 << 14)
+#define MC__CDA_REFASSYNR_WIC3                   (MCPARAMID)(10769 << 14)
+#define MC__CDA_REFASSYNR_WIC4                   (MCPARAMID)(10770 << 14)
+#define MC__CDA_REFASSYNR_W1                     (MCPARAMID)(10771 << 14)
+#define MC__CDA_REFASSYNR_W2                     (MCPARAMID)(10772 << 14)
+#define MC__CDA_REFASSYNR_W3                     (MCPARAMID)(10773 << 14)
+#define MC__CDA_REFASSYNR_W4                     (MCPARAMID)(10774 << 14)
+#define MC__CDA_REFASSYNR_W5                     (MCPARAMID)(10775 << 14)
+#define MC__CDA_REFASSYNR_W6                     (MCPARAMID)(10776 << 14)
+#define MC__CDA_REFASSYNR_W7                     (MCPARAMID)(10777 << 14)
+#define MC__CDA_REFASSYNR_W8                     (MCPARAMID)(10778 << 14)
+#define MC__CDA_REFASSYNR_W9                     (MCPARAMID)(10779 << 14)
+#define MC__CDA_REFASSYNR_W10                    (MCPARAMID)(10780 << 14)
+#define MC__CDA_REFASSYNR_D1                     (MCPARAMID)(10781 << 14)
+#define MC__CDA_REFASSYNR_D2                     (MCPARAMID)(10782 << 14)
+#define MC__CDA_REFASSYNR_D3                     (MCPARAMID)(10783 << 14)
+#define MC__CDA_REFASSYNR_D4                     (MCPARAMID)(10784 << 14)
+#define MC__CDA_REFASSYNR_D5                     (MCPARAMID)(10785 << 14)
+#define MC__CDA_REFASSYNR_D6                     (MCPARAMID)(10786 << 14)
+#define MC__CDA_REFASSYNR_D7                     (MCPARAMID)(10787 << 14)
+#define MC__CDA_REFASSYNR_D8                     (MCPARAMID)(10788 << 14)
+#define MC__CDA_REFASSYNR_D9                     (MCPARAMID)(10789 << 14)
+#define MC__CDA_REFASSYNR_D10                    (MCPARAMID)(10790 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic1        (MCPARAMID)(10791 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic2        (MCPARAMID)(10792 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic3        (MCPARAMID)(10793 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic4        (MCPARAMID)(10794 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic5        (MCPARAMID)(10795 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic6        (MCPARAMID)(10796 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic7        (MCPARAMID)(10797 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic8        (MCPARAMID)(10798 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic9        (MCPARAMID)(10799 << 14)
+#define MC_WIC_WindowLineOffset_byte_Wic10       (MCPARAMID)(10800 << 14)
+#define MC_P1INDEX                               (MCPARAMID)(10801 << 14)
+#define MC_P2INDEX                               (MCPARAMID)(10802 << 14)
+#define MC_P3INDEX                               (MCPARAMID)(10803 << 14)
+#define MC_P4INDEX                               (MCPARAMID)(10804 << 14)
+#define MC_P5INDEX                               (MCPARAMID)(10805 << 14)
+#define MC_P6INDEX                               (MCPARAMID)(10806 << 14)
+#define MC_P7INDEX                               (MCPARAMID)(10807 << 14)
+#define MC_P8INDEX                               (MCPARAMID)(10808 << 14)
+#define MC_P9INDEX                               (MCPARAMID)(10809 << 14)
+#define MC_P10INDEX                              (MCPARAMID)(10810 << 14)
+#define MC_P1_DINDEX                             (MCPARAMID)(10811 << 14)
+#define MC_P2_DINDEX                             (MCPARAMID)(10812 << 14)
+#define MC_P3_DINDEX                             (MCPARAMID)(10813 << 14)
+#define MC_P4_DINDEX                             (MCPARAMID)(10814 << 14)
+#define MC_P5_DINDEX                             (MCPARAMID)(10815 << 14)
+#define MC_P6_DINDEX                             (MCPARAMID)(10816 << 14)
+#define MC_P7_DINDEX                             (MCPARAMID)(10817 << 14)
+#define MC_P8_DINDEX                             (MCPARAMID)(10818 << 14)
+#define MC_P9_DINDEX                             (MCPARAMID)(10819 << 14)
+#define MC_P10_DINDEX                            (MCPARAMID)(10820 << 14)
+#define MC_CDA_P1INDEX                           (MCPARAMID)(10821 << 14)
+#define MC_Default_P1_DINDEX                     (MCPARAMID)(10822 << 14)
+#define MC_Default_P2_DINDEX                     (MCPARAMID)(10823 << 14)
+#define MC_Default_P3_DINDEX                     (MCPARAMID)(10824 << 14)
+#define MC_Default_P4_DINDEX                     (MCPARAMID)(10825 << 14)
+#define MC_Default_P5_DINDEX                     (MCPARAMID)(10826 << 14)
+#define MC_Default_P6_DINDEX                     (MCPARAMID)(10827 << 14)
+#define MC_Default_P7_DINDEX                     (MCPARAMID)(10828 << 14)
+#define MC_Default_P8_DINDEX                     (MCPARAMID)(10829 << 14)
+#define MC_Default_P9_DINDEX                     (MCPARAMID)(10830 << 14)
+#define MC_Default_P10_DINDEX                    (MCPARAMID)(10831 << 14)
+#define MC__CDA_D1INDEX                          (MCPARAMID)(10832 << 14)
+#define MC__CDA_D2INDEX                          (MCPARAMID)(10833 << 14)
+#define MC__CDA_D3INDEX                          (MCPARAMID)(10834 << 14)
+#define MC__CDA_D4INDEX                          (MCPARAMID)(10835 << 14)
+#define MC__CDA_D5INDEX                          (MCPARAMID)(10836 << 14)
+#define MC__CDA_D6INDEX                          (MCPARAMID)(10837 << 14)
+#define MC__CDA_D7INDEX                          (MCPARAMID)(10838 << 14)
+#define MC__CDA_D8INDEX                          (MCPARAMID)(10839 << 14)
+#define MC__CDA_D9INDEX                          (MCPARAMID)(10840 << 14)
+#define MC__CDA_D10INDEX                         (MCPARAMID)(10841 << 14)
+#define MC_TapConfiguration_FULL_8T8C             51
+#define MC_TapConfiguration_DECA_10T8C            52
+#define MC_MetadataInsertion                     (MCPARAMID)(10842 << 14)
+#define MC_MetadataInsertion_ENABLE                1
+#define MC_MetadataInsertion_DISABLE               2
+#define MC_MetadataInsertion_Filter              (MCPARAMID)(10843 << 14)
+#define MC_MetadataFeatureCheck                  (MCPARAMID)(10844 << 14)
+#define MC_MetadataFeatureCheck_PASS               1
+#define MC_MetadataFeatureCheck_FAIL               2
+#define MC_VideoFormat                           (MCPARAMID)(10845 << 14)
+#define MC_VideoFormat_AUTO                        1
+#define MC_VideoFormat_NTSC_M                      2
+#define MC_VideoFormat_PAL_B                       3
+#define MC_VideoFormat_PAL_M                       4
+#define MC_VideoFormat_PAL_N                       5
+#define MC_VideoFormat_PAL_NC                      6
+#define MC_Metadata_XChan_MuxWidth               (MCPARAMID)(10846 << 14)
+#define MC_Metadata_XChan_MuxWidth_W_8BIT          1
+#define MC_Metadata_XChan_MuxWidth_W_12BIT         2
+#define MC_Metadata_XChan_MuxWidth_W_16BIT         3
+#define MC_Metadata_XChan_MuxWidth_W_24BIT         4
+#define MC_Metadata_BitMapping                   (MCPARAMID)(10847 << 14)
+#define MC_Metadata_BitMapping_MONO                1
+#define MC_Metadata_BitMapping_RGB_1F              2
+#define MC_Metadata_BitMapping_RGB_2F              3
+#define MC_Metadata_YChan_Mux                    (MCPARAMID)(10848 << 14)
+#define MC_Metadata_YChan_Mux_ENABLE               1
+#define MC_Metadata_YChan_Mux_DISABLE              2
+#define MC_MetadataContent                       (MCPARAMID)(10849 << 14)
+#define MC_MetadataContent_NONE                    1
+#define MC_MetadataContent_ONE_FIELD               2
+#define MC_MetadataContent_TWO_FIELD               3
+#define MC_MetadataContent_THREE_FIELD             4
+#define MC_ColorRegistrationControl              (MCPARAMID)(10850 << 14)
+#define MC_ColorRegistrationControl_NONE           1
+#define MC_ColorRegistrationControl_FVAL           2
+#define MC_ColorRegistrationControl_Filter       (MCPARAMID)(10851 << 14)
+#define MC_TrigCtl_CAMERA                         18
+#define MC_TrigLine_FVAL                          38
+#define MC_EndTrigLine_FVAL                       29
+#define MC_EndTrigCtl_CAMERA                      11
+#define MC__TrigLine_FVAL                         42
+#define MC__EndTrigLine_FVAL                      27
+#define MC_BoardTopologyType                     (MCPARAMID)(10852 << 14)
+#define MC_BoardTopologyType_SLOW                  1
+#define MC_BoardTopologyType_ECCO                  2
+#define MC__TRG_FTSEL_FromFVAL                    30
+#define MC__TRG_EFTSEL_FromFVAL                   24
+#define MC_BoardTopology_MONO_DECA_DFE            47
+#define MC_LvalLineCheck                         (MCPARAMID)(10853 << 14)
+#define MC_LvalLineCheck_ON                        1
+#define MC_LvalLineCheck_OFF                       2
+#define MC_DFE_Mode                              (MCPARAMID)(10854 << 14)
+#define MC_DFE_Mode_ON                             1
+#define MC_DFE_Mode_OFF                            2
+#define MC_ForcePLLReset                         (MCPARAMID)(10855 << 14)
+#define MC_ForcePLLReset_X                         1
+#define MC_ForcePLLReset_Y                         2
+#define MC_ForcePLLReset_Z                         3
+#define MC_ForcePLLReset_X_AND_Y                   4
+#define MC_ForcePLLReset_X_AND_Z                   5
+#define MC_ForcePLLReset_Y_AND_Z                   6
+#define MC_ForcePLLReset_X_AND_Y_AND_Z             7
+#define MC_ForcePLLReset_NONE                      8
+#define MC_DFE_Filter                            (MCPARAMID)(10856 << 14)
+#define MC_PLLRestartDelay                       (MCPARAMID)(10857 << 14)
+#define MC_PLLRestartDelay_Delay_500us             1
+#define MC_PLLRestartDelay_Delay_5ms               2
+#define MC_PLLRestartDelay_Delay_50ms              3
+#define MC_PLLRestartDelay_Delay_100ms             4
+#define MC_AcquiringLinesWhileChannelLinkNotSynced (MCPARAMID)(10858 << 14)
+#define MC_GrabberOverrun_AcqLinesWhNotSynced    (MCPARAMID)(10859 << 14)
+#define MC_ChannelLinkPLLGoingUp_X               (MCPARAMID)(10860 << 14)
+#define MC_ChannelLinkPLLGoingUp_Y               (MCPARAMID)(10861 << 14)
+#define MC_ChannelLinkPLLGoingUp_Z               (MCPARAMID)(10862 << 14)
+#define MC_ChannelLinkPLLGoingDown_X             (MCPARAMID)(10863 << 14)
+#define MC_ChannelLinkPLLGoingDown_Y             (MCPARAMID)(10864 << 14)
+#define MC_ChannelLinkPLLGoingDown_Z             (MCPARAMID)(10865 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingUp_X      (MCPARAMID)(10866 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingUp_Y      (MCPARAMID)(10867 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingUp_Z      (MCPARAMID)(10868 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingDown_X    (MCPARAMID)(10869 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingDown_Y    (MCPARAMID)(10870 << 14)
+#define MC_GrabberOverrun_CLinkPLLGoingDown_Z    (MCPARAMID)(10871 << 14)
+#define MC_Allow_DFE                             (MCPARAMID)(10872 << 14)
+#define MC_Allow_DFE_YES                           1
+#define MC_Allow_DFE_NO                            2
+#define MC_CLCAM_AreaScan                        (MCPARAMID)(10873 << 14)
+#define MC_Timer1ProgramMode                     (MCPARAMID)(10874 << 14)
+#define MC_Timer1ProgramMode_SINGLE                1
+#define MC_Timer1ProgramMode_DUAL                  2
+#define MC__PRM1_T1P1DEF_01                      (MCPARAMID)(10875 << 14)
+#define MC__PRM1_T1P1DEF_02                      (MCPARAMID)(10876 << 14)
+#define MC__PRM1_T1P1DEF_03                      (MCPARAMID)(10877 << 14)
+#define MC__PRM1_T1P1DEF_04                      (MCPARAMID)(10878 << 14)
+#define MC__PRM1_T1P1DEF_05                      (MCPARAMID)(10879 << 14)
+#define MC__PRM1_T1P1DEF_06                      (MCPARAMID)(10880 << 14)
+#define MC__PRM1_T1P1DEF_07                      (MCPARAMID)(10881 << 14)
+#define MC__PRM1_T1P1DEF_08                      (MCPARAMID)(10882 << 14)
+#define MC__PRM1_T1P1DEF_09                      (MCPARAMID)(10883 << 14)
+#define MC__PRM1_T1P1DEF_10                      (MCPARAMID)(10884 << 14)
+#define MC__PRM1_T1P1DEF_11                      (MCPARAMID)(10885 << 14)
+#define MC__PRM1_T1P1DEF_12                      (MCPARAMID)(10886 << 14)
+#define MC__PRM1_T1P1DEF_13                      (MCPARAMID)(10887 << 14)
+#define MC__PRM1_T1P1DEF_14                      (MCPARAMID)(10888 << 14)
+#define MC__PRM1_T1P1DEF_15                      (MCPARAMID)(10889 << 14)
+#define MC__PRM1_T1P1POS_01                      (MCPARAMID)(10890 << 14)
+#define MC__PRM1_T1P1POS_02                      (MCPARAMID)(10891 << 14)
+#define MC__PRM1_T1P1POS_03                      (MCPARAMID)(10892 << 14)
+#define MC__PRM1_T1P1POS_04                      (MCPARAMID)(10893 << 14)
+#define MC__PRM1_T1P1POS_05                      (MCPARAMID)(10894 << 14)
+#define MC__PRM1_T1P1POS_06                      (MCPARAMID)(10895 << 14)
+#define MC__PRM1_T1P1POS_07                      (MCPARAMID)(10896 << 14)
+#define MC__PRM1_T1P1POS_08                      (MCPARAMID)(10897 << 14)
+#define MC__PRM1_T1P1POS_09                      (MCPARAMID)(10898 << 14)
+#define MC__PRM1_T1P1POS_10                      (MCPARAMID)(10899 << 14)
+#define MC__PRM1_T1P1POS_11                      (MCPARAMID)(10900 << 14)
+#define MC__PRM1_T1P1POS_12                      (MCPARAMID)(10901 << 14)
+#define MC__PRM1_T1P1POS_13                      (MCPARAMID)(10902 << 14)
+#define MC__PRM1_T1P1POS_14                      (MCPARAMID)(10903 << 14)
+#define MC__PRM1_T1P1POS_15                      (MCPARAMID)(10904 << 14)
+#define MC__PRM1_T1P2DEF_01                      (MCPARAMID)(10905 << 14)
+#define MC__PRM1_T1P2DEF_02                      (MCPARAMID)(10906 << 14)
+#define MC__PRM1_T1P2DEF_03                      (MCPARAMID)(10907 << 14)
+#define MC__PRM1_T1P2DEF_04                      (MCPARAMID)(10908 << 14)
+#define MC__PRM1_T1P2DEF_05                      (MCPARAMID)(10909 << 14)
+#define MC__PRM1_T1P2DEF_06                      (MCPARAMID)(10910 << 14)
+#define MC__PRM1_T1P2DEF_07                      (MCPARAMID)(10911 << 14)
+#define MC__PRM1_T1P2DEF_08                      (MCPARAMID)(10912 << 14)
+#define MC__PRM1_T1P2DEF_09                      (MCPARAMID)(10913 << 14)
+#define MC__PRM1_T1P2DEF_10                      (MCPARAMID)(10914 << 14)
+#define MC__PRM1_T1P2DEF_11                      (MCPARAMID)(10915 << 14)
+#define MC__PRM1_T1P2DEF_12                      (MCPARAMID)(10916 << 14)
+#define MC__PRM1_T1P2DEF_13                      (MCPARAMID)(10917 << 14)
+#define MC__PRM1_T1P2DEF_14                      (MCPARAMID)(10918 << 14)
+#define MC__PRM1_T1P2DEF_15                      (MCPARAMID)(10919 << 14)
+#define MC__PRM1_T1P2POS_01                      (MCPARAMID)(10920 << 14)
+#define MC__PRM1_T1P2POS_02                      (MCPARAMID)(10921 << 14)
+#define MC__PRM1_T1P2POS_03                      (MCPARAMID)(10922 << 14)
+#define MC__PRM1_T1P2POS_04                      (MCPARAMID)(10923 << 14)
+#define MC__PRM1_T1P2POS_05                      (MCPARAMID)(10924 << 14)
+#define MC__PRM1_T1P2POS_06                      (MCPARAMID)(10925 << 14)
+#define MC__PRM1_T1P2POS_07                      (MCPARAMID)(10926 << 14)
+#define MC__PRM1_T1P2POS_08                      (MCPARAMID)(10927 << 14)
+#define MC__PRM1_T1P2POS_09                      (MCPARAMID)(10928 << 14)
+#define MC__PRM1_T1P2POS_10                      (MCPARAMID)(10929 << 14)
+#define MC__PRM1_T1P2POS_11                      (MCPARAMID)(10930 << 14)
+#define MC__PRM1_T1P2POS_12                      (MCPARAMID)(10931 << 14)
+#define MC__PRM1_T1P2POS_13                      (MCPARAMID)(10932 << 14)
+#define MC__PRM1_T1P2POS_14                      (MCPARAMID)(10933 << 14)
+#define MC__PRM1_T1P2POS_15                      (MCPARAMID)(10934 << 14)
+#define MC__Category_Interleaved_Acquisition      67
+#define MC___Timer1_ONEPROG_Check                (MCPARAMID)(10935 << 14)
+#define MC___Timer1_ONEPROG_Check_PASS             1
+#define MC___Timer1_ONEPROG_Check_FAIL             2
+#define MC_InterleavedAcquisition                (MCPARAMID)(10936 << 14)
+#define MC_InterleavedAcquisition_OFF              1
+#define MC_InterleavedAcquisition_ON               2
+#define MC_InterleavedAcquisition_Filter         (MCPARAMID)(10937 << 14)
+#define MC_GCE_1P_Filter                         (MCPARAMID)(10938 << 14)
+#define MC__DefaultExposureTime_us               (MCPARAMID)(10939 << 14)
+#define MC_ExposureTime_P1_us                    (MCPARAMID)(10940 << 14)
+#define MC_ExposureTime_P2_us                    (MCPARAMID)(10941 << 14)
+#define MC_GCE_2P_Filter                         (MCPARAMID)(10942 << 14)
+#define MC_Expose_P1_Effective_us                (MCPARAMID)(10943 << 14)
+#define MC_Expose_P2_Effective_us                (MCPARAMID)(10944 << 14)
+#define MC__EXPWidth_Min_T1                      (MCPARAMID)(10945 << 14)
+#define MC__EXPWidth_Max_T1                      (MCPARAMID)(10946 << 14)
+#define MC__EXPWidth_P1_T1                       (MCPARAMID)(10947 << 14)
+#define MC__EXPWidth_P2_T1                       (MCPARAMID)(10948 << 14)
+#define MC__DefaultStrobeDuration_us             (MCPARAMID)(10949 << 14)
+#define MC_StrobeDuration_P1_us                  (MCPARAMID)(10950 << 14)
+#define MC_StrobeDuration_P2_us                  (MCPARAMID)(10951 << 14)
+#define MC__DefaultStrobeDelay_us                (MCPARAMID)(10952 << 14)
+#define MC_StrobeDelay_P1_us                     (MCPARAMID)(10953 << 14)
+#define MC_StrobeDelay_P2_us                     (MCPARAMID)(10954 << 14)
+#define MC_StrobeLine_P1                         (MCPARAMID)(10955 << 14)
+#define MC_StrobeLine_P1_IOUT1                     1
+#define MC_StrobeLine_P2                         (MCPARAMID)(10956 << 14)
+#define MC_StrobeLine_P2_IOUT2                     1
+#define MC__STROBEWidth_P1_T1                    (MCPARAMID)(10957 << 14)
+#define MC__STROBEWidth_P2_T1                    (MCPARAMID)(10958 << 14)
+#define MC__EXPOn2STROBEOn_P1_T1                 (MCPARAMID)(10959 << 14)
+#define MC__EXPOn2STROBEOn_P2_T1                 (MCPARAMID)(10960 << 14)
+#define MC__STROBEAdvance_P1_T1                  (MCPARAMID)(10961 << 14)
+#define MC__STROBEAdvance_P2_T1                  (MCPARAMID)(10962 << 14)
+#define MC__STROBEOn_P1_us                       (MCPARAMID)(10963 << 14)
+#define MC__STROBEOn_P2_us                       (MCPARAMID)(10964 << 14)
+#define MC__STROBEWidth_P1_us                    (MCPARAMID)(10965 << 14)
+#define MC__STROBEWidth_P2_us                    (MCPARAMID)(10966 << 14)
+#define MC__STROBEOff_P1_us                      (MCPARAMID)(10967 << 14)
+#define MC__STROBEOff_P2_us                      (MCPARAMID)(10968 << 14)
+#define MC__Timer1_1P_RunTime_us                 (MCPARAMID)(10969 << 14)
+#define MC__Timer1_1P_MaxTriggerRate_Hz          (MCPARAMID)(10970 << 14)
+#define MC__Timer1Mode                           (MCPARAMID)(10971 << 14)
+#define MC__Timer1Mode_ONEPROG                     1
+#define MC__Timer1Mode_TWOPROG                     2
+#define MC__EXPOn_P1_T1                          (MCPARAMID)(10972 << 14)
+#define MC__EXPOff_P1_T1                         (MCPARAMID)(10973 << 14)
+#define MC__RESETOn_P1_T1                        (MCPARAMID)(10974 << 14)
+#define MC__RESETOff_P1_T1                       (MCPARAMID)(10975 << 14)
+#define MC__STROBEOn_P1_T1                       (MCPARAMID)(10976 << 14)
+#define MC__STROBEOff_P1_T1                      (MCPARAMID)(10977 << 14)
+#define MC__SQ1_P1_T1                            (MCPARAMID)(10978 << 14)
+#define MC__T1AVAIL_P1_T1                        (MCPARAMID)(10979 << 14)
+#define MC___MAXIMUM_P1_T1                       (MCPARAMID)(10980 << 14)
+#define MC__EXPOn_P2_T1                          (MCPARAMID)(10981 << 14)
+#define MC__EXPOff_P2_T1                         (MCPARAMID)(10982 << 14)
+#define MC__RESETOn_P2_T1                        (MCPARAMID)(10983 << 14)
+#define MC__RESETOff_P2_T1                       (MCPARAMID)(10984 << 14)
+#define MC__STROBEOn_P2_T1                       (MCPARAMID)(10985 << 14)
+#define MC__STROBEOff_P2_T1                      (MCPARAMID)(10986 << 14)
+#define MC__SQ1_P2_T1                            (MCPARAMID)(10987 << 14)
+#define MC__T1AVAIL_P2_T1                        (MCPARAMID)(10988 << 14)
+#define MC___MAXIMUM_P2_T1                       (MCPARAMID)(10989 << 14)
+#define MC_TWO_PROG_CalcStrategy                 (MCPARAMID)(10990 << 14)
+#define MC_TWO_PROG_CalcStrategy_SAME_EXPOff       1
+#define MC_TWO_PROG_CalcStrategy_SAME_EXPOn        2
+#define MC_TWO_PROG_CalcStrategy_MIN_EXPOn         3
+#define MC__PreEXPWidth_P1_T1                    (MCPARAMID)(10991 << 14)
+#define MC__PreEXPWidth_P2_T1                    (MCPARAMID)(10992 << 14)
+#define MC__NextPreEXPWidth_P1_T1                (MCPARAMID)(10993 << 14)
+#define MC__NextPreEXPWidth_P2_T1                (MCPARAMID)(10994 << 14)
+#define MC__NextEXPWidth_P1_T1                   (MCPARAMID)(10995 << 14)
+#define MC__NextEXPWidth_P2_T1                   (MCPARAMID)(10996 << 14)
+#define MC__PostEXPWidth_P1_T1                   (MCPARAMID)(10997 << 14)
+#define MC__PostEXPWidth_P2_T1                   (MCPARAMID)(10998 << 14)
+#define MC___Timer1_P1_Check                     (MCPARAMID)(10999 << 14)
+#define MC___Timer1_P1_Check_PASS                  1
+#define MC___Timer1_P1_Check_FAIL                  2
+#define MC___Timer1_P2_Check                     (MCPARAMID)(11000 << 14)
+#define MC___Timer1_P2_Check_PASS                  1
+#define MC___Timer1_P2_Check_FAIL                  2
+#define MC__Timer1_P1_RunTime_us                 (MCPARAMID)(11001 << 14)
+#define MC__Timer1_P2_RunTime_us                 (MCPARAMID)(11002 << 14)
+#define MC__Timer1_P1_MaxTriggerRate_Hz          (MCPARAMID)(11003 << 14)
+#define MC__Timer1_P2_MaxTriggerRate_Hz          (MCPARAMID)(11004 << 14)
+#define MC_ExposureTime_P1_Effective_us          (MCPARAMID)(11005 << 14)
+#define MC_ExposureTime_P2_Effective_us          (MCPARAMID)(11006 << 14)
+#define MC_StrobeDuration_P1_Effective_us        (MCPARAMID)(11007 << 14)
+#define MC_StrobeDuration_P2_Effective_us        (MCPARAMID)(11008 << 14)
+#define MC_StrobeDelay_P1_Effective_us           (MCPARAMID)(11009 << 14)
+#define MC_StrobeDelay_P2_Effective_us           (MCPARAMID)(11010 << 14)
+#define MC_ExposureDelay_P1_Effective_us         (MCPARAMID)(11011 << 14)
+#define MC_ExposureDelay_P2_Effective_us         (MCPARAMID)(11012 << 14)
+#define MC__Timer1_RunTime_us                    (MCPARAMID)(11013 << 14)
+#define MC__NextEXPOn_P1_T1                      (MCPARAMID)(11014 << 14)
+#define MC__NextEXPOn_P2_T1                      (MCPARAMID)(11015 << 14)
+#define MC__NextEXPOff_P1_T1                     (MCPARAMID)(11016 << 14)
+#define MC__NextEXPOff_P2_T1                     (MCPARAMID)(11017 << 14)
+#define MC__Strobe1_Src                          (MCPARAMID)(11018 << 14)
+#define MC__Strobe1_Src_T1SIG3_X                   1
+#define MC__Strobe1_Src_NO_STROBE                  2
+#define MC__Strobe1_Src_STROBE_TIED_LOW            3
+#define MC__Strobe2_Src                          (MCPARAMID)(11019 << 14)
+#define MC__Strobe2_Src_T1SIG4_X                   1
+#define MC__Strobe2_Src_NO_STROBE                  2
+#define MC__Strobe2_Src_STROBE_TIED_LOW            3
+#define MC_StrobeLine_P2_NONE                      2
+#define MC_StrobeOutput_P1                       (MCPARAMID)(11020 << 14)
+#define MC_StrobeOutput_P1_ENABLE                  1
+#define MC_StrobeOutput_P1_DISABLE                 2
+#define MC_StrobeOutput_P2                       (MCPARAMID)(11021 << 14)
+#define MC_StrobeOutput_P2_ENABLE                  1
+#define MC_StrobeOutput_P2_DISABLE                 2
+#define MC__IOUT1Source                          (MCPARAMID)(11022 << 14)
+#define MC__IOUT1Source_STROBE_T1SIG3_X            1
+#define MC__IOUT1Source_NONE                       2
+#define MC__IOUT1Source_STROBE_TIED_LOW            3
+#define MC__IOUT2Source                          (MCPARAMID)(11023 << 14)
+#define MC__IOUT2Source_STROBE_T1SIG4_X            1
+#define MC__IOUT2Source_NONE                       2
+#define MC__IOUT2Source_STROBE_TIED_LOW            3
+#define MC__StrobeAdvance_P1_us                  (MCPARAMID)(11024 << 14)
+#define MC__StrobeAdvance_P2_us                  (MCPARAMID)(11025 << 14)
+#define MC__T1Span_2P_10ns                       (MCPARAMID)(11026 << 14)
+#define MC__StrobeAdvance_P1_10ns                (MCPARAMID)(11027 << 14)
+#define MC__StrobeAdvance_P2_10ns                (MCPARAMID)(11028 << 14)
+#define MC_ExposureTime_P1_10ns                  (MCPARAMID)(11029 << 14)
+#define MC_ExposureTime_P2_10ns                  (MCPARAMID)(11030 << 14)
+#define MC_StrobeDuration_P1_10ns                (MCPARAMID)(11031 << 14)
+#define MC_StrobeDuration_P2_10ns                (MCPARAMID)(11032 << 14)
+#define MC_StrobeDelay_P1_10ns                   (MCPARAMID)(11033 << 14)
+#define MC_StrobeDelay_P2_10ns                   (MCPARAMID)(11034 << 14)
+#define MC_MinTriggerPeriod_P1_us                (MCPARAMID)(11035 << 14)
+#define MC_MinTriggerPeriod_P2_us                (MCPARAMID)(11036 << 14)
+#define MC_MaxTriggerRate_P1_Hz                  (MCPARAMID)(11037 << 14)
+#define MC_MaxTriggerRate_P2_Hz                  (MCPARAMID)(11038 << 14)
+#define MC_ExposureDelay_MAN_P1_us               (MCPARAMID)(11039 << 14)
+#define MC_ExposureDelay_MAN_P2_us               (MCPARAMID)(11040 << 14)
+#define MC_ExposureDelay_MAN_P1_10ns             (MCPARAMID)(11041 << 14)
+#define MC_ExposureDelay_MAN_P2_10ns             (MCPARAMID)(11042 << 14)
+#define MC_ExposureDelay_MAN_P1_T1               (MCPARAMID)(11043 << 14)
+#define MC_ExposureDelay_MAN_P2_T1               (MCPARAMID)(11044 << 14)
+#define MC_TWO_PROG_CalcStrategy_MANUAL            4
+#define MC_ExposureDelayControl                  (MCPARAMID)(11045 << 14)
+#define MC_ExposureDelayControl_MANUAL             1
+#define MC_ExposureDelayControl_SAME_END_EXPOSURE   2
+#define MC_ExposureDelayControl_SAME_START_EXPOSURE   3
+#define MC_RateDividerRestart                    (MCPARAMID)(11046 << 14)
+#define MC_RateDividerRestart_NEVER                1
+#define MC_RateDividerRestart_START_OF_SCAN        2
+#define MC__ExposeRecovery_IA_10ns               (MCPARAMID)(11047 << 14)
+#define MC__ExposeRecovery_IA_T1                 (MCPARAMID)(11048 << 14)
+#define MC_TwoLineSynchronization                (MCPARAMID)(11049 << 14)
+#define MC_TwoLineSynchronization_ENABLE           1
+#define MC_TwoLineSynchronization_DISABLE          2
+#define MC_TwoLineSynchronizationParity          (MCPARAMID)(11050 << 14)
+#define MC_TwoLineSynchronizationParity_EVEN       1
+#define MC_TwoLineSynchronizationParity_ODD        2
+#define MC_EndTrigFollowingLinesCount            (MCPARAMID)(11051 << 14)
+#define MC_EndTrigFollowingLinesCount_ONELINE      1
+#define MC_EndTrigFollowingLinesCount_TWOLINES     2
+#define MC_RedBlueSwap                           (MCPARAMID)(11052 << 14)
+#define MC_RedBlueSwap_ENABLE                      1
+#define MC_RedBlueSwap_DISABLE                     2
+#define MC_RedBlueSwap_Filter                    (MCPARAMID)(11053 << 14)
+#define MC_ColorComponentsOrder                  (MCPARAMID)(11054 << 14)
+#define MC_ColorComponentsOrder_RGB                1
+#define MC_ColorComponentsOrder_BGR                2
+#define MC_LineCaptureMode_TAG                     5
+#define MC_MetadataLocation                      (MCPARAMID)(11055 << 14)
+#define MC_MetadataLocation_LEFT                   1
+#define MC_MetadataLocation_SPARSE_1               2
+#define MC_MetadataLocation_Filter               (MCPARAMID)(11056 << 14)
+#define MC_Metadata_On10thTap                    (MCPARAMID)(11057 << 14)
+#define MC_Metadata_On10thTap_ENABLE               1
+#define MC_Metadata_On10thTap_DISABLE              2
+#define MC_MetadataLocation_LEFT_BOARDER           3
+#define MC_MetadataLocation_TAP10                  4
+#define MC_MetadataLocation_LVALRISE               5
+#define MC_BoardTopology_MONO_DECA_AFE            48
+#define MC_BoardTopology_MONO_DECA_AFE_SE1        49
+#define MC_CLCAM_ForcedLineBlanking              (MCPARAMID)(11058 << 14)
+#define MC_CC1Usage_DIN1                           8
+#define MC_CC1Usage_IIN1                           9
+#define MC_CC2Usage_DIN2                           8
+#define MC_CC3Usage_IIN1                           9
+#define MC__SCC_CC1_DIN1                          13
+#define MC__SCC_CC1_IIN1                          14
+#define MC__SCC_CC2_DIN2                          13
+#define MC__SCC_CC3_IIN1                          17
+#define MC_TwoLineSynchronizationParity_Filter   (MCPARAMID)(11059 << 14)
+#define MC_ExposureTime_Effective_us             (MCPARAMID)(11060 << 14)
+#define MC_StrobeLine_P1_NONE                      2
+#define MC_StrobeLine_P1_IOUT2                     3
+#define MC_StrobeLine_P2_IOUT1                     3
+#define MC_Timer1_P1_SigStrobeOn                 (MCPARAMID)(11061 << 14)
+#define MC_Timer1_P1_SigStrobeOff                (MCPARAMID)(11062 << 14)
+#define MC_Timer1_P2_SigStrobeOn                 (MCPARAMID)(11063 << 14)
+#define MC_Timer1_P2_SigStrobeOff                (MCPARAMID)(11064 << 14)
+#define MC_COF_BWR_Mux                           (MCPARAMID)(11065 << 14)
+#define MC_COF_BitWR_B2SLOW                      (MCPARAMID)(11066 << 14)
+#define MC__Category_Pipeline_Control             68
+#define MC_Pipeline_Control                      (MCPARAMID)(11067 << 14)
+#define MC_Pipeline_Control_ENABLE                 1
+#define MC_Pipeline_Control_DISABLE                2
+#define MC_Pipeline_FieldOfView_Position_tc      (MCPARAMID)(11068 << 14)
+#define MC_Pipeline_Output_Position_tc           (MCPARAMID)(11069 << 14)
+#define MC_Pipeline_Output_PulseWidth            (MCPARAMID)(11070 << 14)
+#define MC_Pipeline_Output_PulseWidth_100us        1
+#define MC_Pipeline_Output_PulseWidth_200us        2
+#define MC_Pipeline_Output_PulseWidth_500us        3
+#define MC_Pipeline_Output_PulseWidth_1ms          4
+#define MC_Pipeline_Output_PulseWidth_2ms          5
+#define MC_Pipeline_Output_PulseWidth_5ms          6
+#define MC_Pipeline_Output_Action                (MCPARAMID)(11071 << 14)
+#define MC_Pipeline_Output_Action_ACTIVE           1
+#define MC_Pipeline_Output_Action_INACTIVE         2
+#define MC_Pipeline_Output_Action_NONE             3
+#define MC_Pipeline_Output_Line                  (MCPARAMID)(11072 << 14)
+#define MC_Pipeline_Output_Line_NONE               1
+#define MC_Pipeline_Output_Line_IOUT2              2
+#define MC_Pipeline_Fifo_Overflow                (MCPARAMID)(11073 << 14)
+#define MC_Pipeline_Fifo_Underflow               (MCPARAMID)(11074 << 14)
+#define MC_GrabberOverrun_PipelineCtlr_FifoOvf_A (MCPARAMID)(11075 << 14)
+#define MC_GrabberOverrun_PipelineCtlr_FifoUdf_A (MCPARAMID)(11076 << 14)
+#define MC_Pipeline_StartOfScan_Position_tc      (MCPARAMID)(11077 << 14)
+#define MC_IOUT2Usage_PIPELINE_CTLR_OUT0           7
+#define MC_Pipeline_StartOfScan_Position         (MCPARAMID)(11078 << 14)
+#define MC_Pipeline_Output_Position              (MCPARAMID)(11079 << 14)
+#define MC__IOUT2Source_PIC_OUT0                   4
+#define MC_TapConfiguration_DECA_3T24             53
+#define MC__ASSYD0101                            (MCPARAMID)(11080 << 14)
+#define MC__ASSYD0102                            (MCPARAMID)(11081 << 14)
+#define MC__ASSYD0103                            (MCPARAMID)(11082 << 14)
+#define MC__ASSYD0104                            (MCPARAMID)(11083 << 14)
+#define MC__ASSYD0105                            (MCPARAMID)(11084 << 14)
+#define MC__ASSYD0106                            (MCPARAMID)(11085 << 14)
+#define MC__ASSYD0107                            (MCPARAMID)(11086 << 14)
+#define MC__ASSYD0108                            (MCPARAMID)(11087 << 14)
+#define MC__ASSYD0109                            (MCPARAMID)(11088 << 14)
+#define MC__ASSYD0110                            (MCPARAMID)(11089 << 14)
+#define MC__ASSYD0201                            (MCPARAMID)(11090 << 14)
+#define MC__ASSYD0202                            (MCPARAMID)(11091 << 14)
+#define MC__ASSYD0203                            (MCPARAMID)(11092 << 14)
+#define MC__ASSYD0204                            (MCPARAMID)(11093 << 14)
+#define MC__ASSYD0205                            (MCPARAMID)(11094 << 14)
+#define MC__ASSYD0206                            (MCPARAMID)(11095 << 14)
+#define MC__ASSYD0207                            (MCPARAMID)(11096 << 14)
+#define MC__ASSYD0208                            (MCPARAMID)(11097 << 14)
+#define MC__ASSYD0209                            (MCPARAMID)(11098 << 14)
+#define MC__ASSYD0210                            (MCPARAMID)(11099 << 14)
+#define MC__ASSYD0301                            (MCPARAMID)(11100 << 14)
+#define MC__ASSYD0302                            (MCPARAMID)(11101 << 14)
+#define MC__ASSYD0303                            (MCPARAMID)(11102 << 14)
+#define MC__ASSYD0304                            (MCPARAMID)(11103 << 14)
+#define MC__ASSYD0305                            (MCPARAMID)(11104 << 14)
+#define MC__ASSYD0306                            (MCPARAMID)(11105 << 14)
+#define MC__ASSYD0307                            (MCPARAMID)(11106 << 14)
+#define MC__ASSYD0308                            (MCPARAMID)(11107 << 14)
+#define MC__ASSYD0309                            (MCPARAMID)(11108 << 14)
+#define MC__ASSYD0310                            (MCPARAMID)(11109 << 14)
+#define MC__ASSYD0401                            (MCPARAMID)(11110 << 14)
+#define MC__ASSYD0402                            (MCPARAMID)(11111 << 14)
+#define MC__ASSYD0403                            (MCPARAMID)(11112 << 14)
+#define MC__ASSYD0404                            (MCPARAMID)(11113 << 14)
+#define MC__ASSYD0405                            (MCPARAMID)(11114 << 14)
+#define MC__ASSYD0406                            (MCPARAMID)(11115 << 14)
+#define MC__ASSYD0407                            (MCPARAMID)(11116 << 14)
+#define MC__ASSYD0408                            (MCPARAMID)(11117 << 14)
+#define MC__ASSYD0409                            (MCPARAMID)(11118 << 14)
+#define MC__ASSYD0410                            (MCPARAMID)(11119 << 14)
+#define MC__ASSYD0501                            (MCPARAMID)(11120 << 14)
+#define MC__ASSYD0502                            (MCPARAMID)(11121 << 14)
+#define MC__ASSYD0503                            (MCPARAMID)(11122 << 14)
+#define MC__ASSYD0504                            (MCPARAMID)(11123 << 14)
+#define MC__ASSYD0505                            (MCPARAMID)(11124 << 14)
+#define MC__ASSYD0506                            (MCPARAMID)(11125 << 14)
+#define MC__ASSYD0507                            (MCPARAMID)(11126 << 14)
+#define MC__ASSYD0508                            (MCPARAMID)(11127 << 14)
+#define MC__ASSYD0509                            (MCPARAMID)(11128 << 14)
+#define MC__ASSYD0510                            (MCPARAMID)(11129 << 14)
+#define MC__ASSYD0601                            (MCPARAMID)(11130 << 14)
+#define MC__ASSYD0602                            (MCPARAMID)(11131 << 14)
+#define MC__ASSYD0603                            (MCPARAMID)(11132 << 14)
+#define MC__ASSYD0604                            (MCPARAMID)(11133 << 14)
+#define MC__ASSYD0605                            (MCPARAMID)(11134 << 14)
+#define MC__ASSYD0606                            (MCPARAMID)(11135 << 14)
+#define MC__ASSYD0607                            (MCPARAMID)(11136 << 14)
+#define MC__ASSYD0608                            (MCPARAMID)(11137 << 14)
+#define MC__ASSYD0609                            (MCPARAMID)(11138 << 14)
+#define MC__ASSYD0610                            (MCPARAMID)(11139 << 14)
+#define MC__ASSYD0701                            (MCPARAMID)(11140 << 14)
+#define MC__ASSYD0702                            (MCPARAMID)(11141 << 14)
+#define MC__ASSYD0703                            (MCPARAMID)(11142 << 14)
+#define MC__ASSYD0704                            (MCPARAMID)(11143 << 14)
+#define MC__ASSYD0705                            (MCPARAMID)(11144 << 14)
+#define MC__ASSYD0706                            (MCPARAMID)(11145 << 14)
+#define MC__ASSYD0707                            (MCPARAMID)(11146 << 14)
+#define MC__ASSYD0708                            (MCPARAMID)(11147 << 14)
+#define MC__ASSYD0709                            (MCPARAMID)(11148 << 14)
+#define MC__ASSYD0710                            (MCPARAMID)(11149 << 14)
+#define MC__ASSYD0801                            (MCPARAMID)(11150 << 14)
+#define MC__ASSYD0802                            (MCPARAMID)(11151 << 14)
+#define MC__ASSYD0803                            (MCPARAMID)(11152 << 14)
+#define MC__ASSYD0804                            (MCPARAMID)(11153 << 14)
+#define MC__ASSYD0805                            (MCPARAMID)(11154 << 14)
+#define MC__ASSYD0806                            (MCPARAMID)(11155 << 14)
+#define MC__ASSYD0807                            (MCPARAMID)(11156 << 14)
+#define MC__ASSYD0808                            (MCPARAMID)(11157 << 14)
+#define MC__ASSYD0809                            (MCPARAMID)(11158 << 14)
+#define MC__ASSYD0810                            (MCPARAMID)(11159 << 14)
+#define MC__ASSYD0901                            (MCPARAMID)(11160 << 14)
+#define MC__ASSYD0902                            (MCPARAMID)(11161 << 14)
+#define MC__ASSYD0903                            (MCPARAMID)(11162 << 14)
+#define MC__ASSYD0904                            (MCPARAMID)(11163 << 14)
+#define MC__ASSYD0905                            (MCPARAMID)(11164 << 14)
+#define MC__ASSYD0906                            (MCPARAMID)(11165 << 14)
+#define MC__ASSYD0907                            (MCPARAMID)(11166 << 14)
+#define MC__ASSYD0908                            (MCPARAMID)(11167 << 14)
+#define MC__ASSYD0909                            (MCPARAMID)(11168 << 14)
+#define MC__ASSYD0910                            (MCPARAMID)(11169 << 14)
+#define MC__ASSYD1001                            (MCPARAMID)(11170 << 14)
+#define MC__ASSYD1002                            (MCPARAMID)(11171 << 14)
+#define MC__ASSYD1003                            (MCPARAMID)(11172 << 14)
+#define MC__ASSYD1004                            (MCPARAMID)(11173 << 14)
+#define MC__ASSYD1005                            (MCPARAMID)(11174 << 14)
+#define MC__ASSYD1006                            (MCPARAMID)(11175 << 14)
+#define MC__ASSYD1007                            (MCPARAMID)(11176 << 14)
+#define MC__ASSYD1008                            (MCPARAMID)(11177 << 14)
+#define MC__ASSYD1009                            (MCPARAMID)(11178 << 14)
+#define MC__ASSYD1010                            (MCPARAMID)(11179 << 14)
+#define MC_NumOfAssy_NINE                          8
+#define MC_GrabberOverrun_PipelineCtlr_FifoOvf_B (MCPARAMID)(11180 << 14)
+#define MC_GrabberOverrun_PipelineCtlr_FifoUdf_B (MCPARAMID)(11181 << 14)
+#define MC_ASSY_TEN_STEPS                        (MCPARAMID)(11182 << 14)
+#define MC_ASSY_TEN_STEPS_TRUE                     1
+#define MC_ASSY_TEN_STEPS_FALSE                    2
+#define MC_TapConfiguration_DECA_9T8              54
+#define MC_TapGeometry_3X_1Y3                     78
+#define MC_TapGeometry_Y_1Y3                       4
+#define MC_CLCAM_Geometry_TG_3X_1Y3               56
+#define MC_AssyConfig_3X_3                        75
+#define MC_NumOfWindows_NINE                       8
+#define MC_WIC_SwapRegionIndexXY                 (MCPARAMID)(11183 << 14)
+#define MC_WIC_SwapRegionIndexXY_true              1
+#define MC_WIC_SwapRegionIndexXY_false             2
+#define MC_BoardTopology_MONO_EF1                 50
+#define MC_BoardTopology_MONO_DECA_EF1            51
+#define MC_BoardTopology_MONO_EXT1                52
+#define MC_BoardTopology_MONO_DECA_EXT1           53
+#define MC_BoardTopology_DUO_EXT1                 54
+#define MC_BoardTopology_MONO_OPT1                55
+#define MC_BoardTopology_MONO_DECA_OPT1           56
+#define MC_SimPICACTIONSet                       (MCPARAMID)(11184 << 14)
+#define MC_BoardTopology_DUO_OPT1                 57
+#define MC_Metadata_XChan_MuxWidth_W_28BIT         5
+#define MC_Pipeline_Control_Filter               (MCPARAMID)(11185 << 14)
+#define MC_Pipeline_Control_Parameters_Filter    (MCPARAMID)(11186 << 14)
+#define MC_BMCRestart                            (MCPARAMID)(11187 << 14)
+#define MC_BMCRestart_NEVER                        1
+#define MC_BMCRestart_START_OF_SCAN                2
+#define MC__BMCRestart                           (MCPARAMID)(11188 << 14)
+#define MC__BMCRestart_NEVER                       1
+#define MC__BMCRestart_START_OF_SCAN               2
+#define MC_EncoderTickCount                      (MCPARAMID)(11189 << 14)
+#define MC_EncoderTickCountWrapUp                (MCPARAMID)(11190 << 14)
+#define MC_EncoderTickCountWrapDown              (MCPARAMID)(11191 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapDown    (MCPARAMID)(11192 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapUp      (MCPARAMID)(11193 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapDown_B  (MCPARAMID)(11194 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapUp_B    (MCPARAMID)(11195 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapDown_A  (MCPARAMID)(11196 << 14)
+#define MC_GrabberOverrun_EncPlsCountWrapUp_A    (MCPARAMID)(11197 << 14)
+#define MC_SimENCPLSCNTSet                       (MCPARAMID)(11198 << 14)
+#define MC_BMCRestart_Filter                     (MCPARAMID)(11199 << 14)
+#define MC_TapConfiguration_DECA_8T10             55
+#define MC_Deca10Tap8Bit                         (MCPARAMID)(11200 << 14)
+#define MC_Deca10Tap8Bit_ENABLE                    1
+#define MC_Deca10Tap8Bit_DISABLE                   2
+#define MC_ColorFormat_Y10P                      108
+#define MC_TapConfiguration_DECA_2T40             56
+#define MC_TapConfiguration_DECA_8T30             57
+#define MC_ColorFormat_RGB30P                    109
+#define MC_TapConfiguration_DECA_8T30B3           58
+#define MC_ColorFormat_RGBI40P                   110
+#define MC__STM1_T1SCAL_10ms                      10
+#define MC_ConnectorName_BRACKET                  40
+#define MC_OutputPinName_LED                     126
+#define MC_EventSignaling_25_Filter              (MCPARAMID)(11201 << 14)
+#define MC_OutputStyle_LVCMOS                     12
+#define MC_OutputPinName_LED_A                   127
+#define MC_OutputPinName_LED_B                   128
+#define MC_OutputState_OFF                        16
+#define MC_OutputState_ON                         17
+#define MC_OutputState_1_OFF                       9
+#define MC_OutputState_1_ON                       10
+#define MC_OutputState_2_OFF                       9
+#define MC_OutputState_2_ON                       10
+#define MC_OutputState_3_OFF                       9
+#define MC_OutputState_3_ON                       10
+#define MC_OutputState_4_OFF                       7
+#define MC_OutputState_4_ON                        8
+#define MC_OutputState_7_OFF                       9
+#define MC_OutputState_7_ON                       10
+#define MC_OutputState_8_OFF                       4
+#define MC_OutputState_8_ON                        5
+#define MC_OutputState_9_OFF                       4
+#define MC_OutputState_9_ON                        5
+#define MC_OutputState_10_OFF                      4
+#define MC_OutputState_10_ON                       5
+#define MC_OutputState_25_OFF                      7
+#define MC_OutputState_25_ON                       8
+#define MC_OutputStyle_NA                         13
+#define MC_OutputState_12_OFF                      4
+#define MC_OutputState_12_ON                       5
+#define MC_OutputState_13_OFF                      4
+#define MC_OutputState_13_ON                       5
+#define MC_OutputState_14_OFF                      4
+#define MC_OutputState_14_ON                       5
+#define MC_OutputState_15_OFF                      4
+#define MC_OutputState_15_ON                       5
+#define MC_OutputState_18_OFF                      9
+#define MC_OutputState_18_ON                      10
+#define MC_OutputState_19_OFF                      9
+#define MC_OutputState_19_ON                      10
+#define MC_OutputState_20_OFF                      9
+#define MC_OutputState_20_ON                      10
+#define MC_OutputState_21_OFF                      8
+#define MC_OutputState_21_ON                       9
+#define MC_OutputState_27_OFF                      4
+#define MC_OutputState_27_ON                       5
+#define MC_EventSignaling_27_Filter              (MCPARAMID)(11202 << 14)
+#define MC_OutputState_28_OFF                      6
+#define MC_OutputState_28_ON                       7
+#define MC_EventSignaling_28_Filter              (MCPARAMID)(11203 << 14)
+#define MC_ConnectorName_BRACKET_B                41
+#define MC_LUT_Feature                           (MCPARAMID)(11204 << 14)
+#define MC_LUT_Feature_YES                         1
+#define MC_LUT_Feature_NO                          2
+#define MC_WBO_Feature                           (MCPARAMID)(11205 << 14)
+#define MC_WBO_Feature_YES                         1
+#define MC_WBO_Feature_NO                          2
+#define MC_Image_Cropping_Feature                (MCPARAMID)(11206 << 14)
+#define MC_Image_Cropping_Feature_YES              1
+#define MC_Image_Cropping_Feature_NO               2
+#define MC_Bayer_CFA_Decoding_Feature            (MCPARAMID)(11207 << 14)
+#define MC_Bayer_CFA_Decoding_Feature_YES          1
+#define MC_Bayer_CFA_Decoding_Feature_NO           2
+#define MC_RedBlueSwap_Feature                   (MCPARAMID)(11208 << 14)
+#define MC_RedBlueSwap_Feature_YES                 1
+#define MC_RedBlueSwap_Feature_NO                  2
+#define MC_Image_Flipping_Feature                (MCPARAMID)(11209 << 14)
+#define MC_Image_Flipping_Feature_YES              1
+#define MC_Image_Flipping_Feature_NO               2
+#define MC_ImageFlipping_Filter                  (MCPARAMID)(11210 << 14)
+#define MC_BoardTopology_MONO_SE1                 58
+
+
+#endif // _McParams_
diff --git a/Lib/EuresysCam/Include/McParamsCompat1x.h b/Lib/EuresysCam/Include/McParamsCompat1x.h
new file mode 100644
index 0000000..8535669
--- /dev/null
+++ b/Lib/EuresysCam/Include/McParamsCompat1x.h
@@ -0,0 +1,14 @@
+// McParamsCompat1x.h Parameter Identifier File
+// This file defines compatibility identifiers for pre version 2.x
+// MultiCam Parameters
+// History:
+//			00/10/20	Joel Harhellier		First issue
+
+
+#define MC_ProcessorId                           (MCPARAMID)(   34 << 14)
+#define MC_Collector                             (MCPARAMID)(   36 << 14)
+#define MC_FilledCount                           (MCPARAMID)(   43 << 14)
+#define MC_SoftTrig								 (MCPARAMID)(   50 << 14)
+#define MC_Timeout                               (MCPARAMID)(   56 << 14)
+#define MC_LUTIndex                              (MCPARAMID)(   66 << 14)
+#define MC_InputLUT                              (MCPARAMID)(   67 << 14)
diff --git a/Lib/EuresysCam/Include/MultiCamCpp.h b/Lib/EuresysCam/Include/MultiCamCpp.h
new file mode 100644
index 0000000..9833a67
--- /dev/null
+++ b/Lib/EuresysCam/Include/MultiCamCpp.h
@@ -0,0 +1,13 @@
+// MultiCamCpp.H - MULTICAM C++ API
+// Do not edit this file
+
+#if !defined(__MULTICAMCPP_H__)
+#define __MULTICAMCPP_H__
+
+#include <iostream>
+#include "multicam.h"
+
+#include "MultiCamCppExternal.h"
+#include "MultiCamCppInternal.h"
+
+#endif
diff --git a/Lib/EuresysCam/Include/MultiCamCppExternal.h b/Lib/EuresysCam/Include/MultiCamCppExternal.h
new file mode 100644
index 0000000..e590cc8
--- /dev/null
+++ b/Lib/EuresysCam/Include/MultiCamCppExternal.h
@@ -0,0 +1,30 @@
+// MultiCamCppInternal.H - MULTICAM C++ API
+#if !defined(__MULTICAMCPPEXTERNAL_H__)
+#define __MULTICAMCPPEXTERNAL_H__
+
+// For wrapping
+#if defined __MULTICAM_WRAPPING__
+  #ifdef __GNUC__
+    typedef void (*FinalizeCallback)(int handle);
+  #else
+    typedef void (__stdcall *FinalizeCallback)(int handle);
+  #endif
+  #define WRAPPING_MEMBERS public: \
+    FinalizeCallback callback_; \
+    int handle_; \
+
+  #define WRAPPING_MEMBERS_INIT handle_ = 0; \
+    callback_ = 0; \
+
+#define WRAPPING_MEMBERS_UNINIT if ((handle_ != NULL) && (callback_ != NULL)) { \
+    MultiCam_LockDestructorCriticalSection(); \
+    if ((handle_ != NULL) && (callback_ != NULL)) callback_(handle_); \
+    MultiCam_UnlockDestructorCriticalSection(); }\
+
+#else
+#define WRAPPING_MEMBERS
+#define WRAPPING_MEMBERS_INIT
+#define WRAPPING_MEMBERS_UNINIT
+#endif
+
+#endif
diff --git a/Lib/EuresysCam/Include/MultiCamCppInternal.h b/Lib/EuresysCam/Include/MultiCamCppInternal.h
new file mode 100644
index 0000000..cc11102
--- /dev/null
+++ b/Lib/EuresysCam/Include/MultiCamCppInternal.h
@@ -0,0 +1,38 @@
+// MultiCamCppInternal.H - MULTICAM C++ API
+#if !defined(__MULTICAMCPPINTERNAL_H__)
+#define __MULTICAMCPPINTERNAL_H__
+
+#include "MCpp_MultiCamObject.h"
+#include "MCpp_MultiCamObjectWithSignaling.h"
+#include "MCpp_Board.h"
+#include "MCpp_BoardList.h"
+#include "MCpp_Surface.h"
+#include "MCpp_SignalInfo.h"
+#include "MCpp_Callback.h"
+#include "MCpp_Channel.h"
+#include "MCpp_Configuration.h"
+#include "MCpp_Exception.h"
+#include "MCpp_global.h"
+
+namespace Euresys
+{
+  namespace MultiCam
+  {
+    static Euresys::MultiCam::Configuration Config;
+    static Euresys::MultiCam::BoardList Boards;
+  }
+}
+
+#include "MCpp_MultiCamObjectImpl.h"
+#include "MCpp_MultiCamObjectWithSignalingImpl.h"
+#include "MCpp_BoardImpl.h"
+#include "MCpp_BoardListImpl.h"
+#include "MCpp_SurfaceImpl.h"
+#include "MCpp_SignalInfoImpl.h"
+#include "MCpp_CallbackImpl.h"
+#include "MCpp_ChannelImpl.h"
+#include "MCpp_ConfigurationImpl.h"
+#include "MCpp_ExceptionImpl.h"
+#include "MCpp_globalImpl.h"
+
+#endif
diff --git a/Lib/EuresysCam/Include/MultiCam_DataTypes.h b/Lib/EuresysCam/Include/MultiCam_DataTypes.h
new file mode 100644
index 0000000..f8170b1
--- /dev/null
+++ b/Lib/EuresysCam/Include/MultiCam_DataTypes.h
@@ -0,0 +1,45 @@
+// MultiCam_DataTypes.h
+
+#ifndef __EURESYS_DATA_TYPES_1_0__
+#define __EURESYS_DATA_TYPES_1_0__
+
+// Standard types
+typedef int BOOL;
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+typedef char CHAR, *PCHAR; 
+typedef void *PVOID; 
+
+typedef signed char         INT8, *PINT8;
+typedef signed short        INT16, *PINT16;
+typedef signed int          INT32, *PINT32;
+typedef unsigned char       UINT8, *PUINT8;
+typedef unsigned short      UINT16, *PUINT16;
+typedef unsigned int        UINT32, *PUINT32;
+
+#ifdef __GNUC__
+typedef signed long long int INT64, *PINT64;
+typedef unsigned long long int UINT64, *PUINT64;
+#else
+typedef signed __int64      INT64, *PINT64;
+typedef unsigned __int64    UINT64, *PUINT64;
+#endif
+
+// Custom types
+typedef unsigned short UNICHAR;
+typedef float FLOAT32, *PFLOAT32;
+typedef double FLOAT64, *PFLOAT64;
+typedef const char *PCCHAR; 
+
+#endif // __EURESYS_DATA_TYPES_1_0__
diff --git a/Lib/EuresysCam/Include/containers.h b/Lib/EuresysCam/Include/containers.h
new file mode 100644
index 0000000..e0b6805
--- /dev/null
+++ b/Lib/EuresysCam/Include/containers.h
@@ -0,0 +1,173 @@
+#include <cstdlib>
+
+namespace Euresys {
+namespace MultiCam {
+namespace Internal {
+
+template < class CItem, int localsize = 512 >
+class AssociativeArray : public Container < CItem >
+{
+        AssociativeArray<CItem, localsize> *next;
+        CItem items[localsize];
+        int keys[localsize];
+        int used;
+    public:
+        /** Construct an associative array.
+        **/
+        AssociativeArray() : next(0), used(0) {
+            int i;
+            for(i = 0; i < localsize; i++) {
+                items[i] = NULL;
+                keys[i] = -1;
+            }
+        }
+
+        ~AssociativeArray() {
+            if (next)
+                delete next;
+        }
+
+        void Add(int key, CItem item) {
+            int i;
+            i = Find(key);
+            if (isValidIndex(i) || (!isValidIndex(i) && used < localsize)) {
+                if (!isValidIndex(i)) {
+                    i = used;
+                    used++;
+                }
+                items[i] = item;
+                keys[i] = key;
+            } else {
+                if (!next) {
+                    next = new AssociativeArray<CItem, localsize>();
+                }
+                next->Add(key, item);
+            }
+        }
+
+        // for compatibility with the container interface
+        virtual int Add(CItem &) {
+            // NOT IMPLEMENTED !!
+            return 0;
+        }
+
+        // for compatibility with the container interface
+        virtual void Assign(int idx, CItem item) {
+            Add(idx, item);
+        }
+
+        virtual int GetCount() const {
+            int size;
+
+            size = used;
+            if (next) size  += next->GetCount();
+            return size;
+        }
+
+        int Find(int key) const {
+            int i;
+            for (i = 0; i < used && i < localsize; i++) {
+                if (keys[i] == key)
+                    return i;
+            }
+            return -1;
+        }
+
+        bool isValidIndex(int i) const {
+            return i >= 0 && i < used && i < localsize;
+        }
+
+        void Remove(int key) {
+            int i = Find(key);
+            if (isValidIndex(i)) {
+                items[i] = NULL;            
+            }
+        }
+
+        CItem Get(int key) const {
+            int i;
+            i = Find(key);
+            if (isValidIndex(i))
+                return items[i];
+            else if (next) 
+                return next->Get(key);
+            
+            return NULL;
+        }
+
+        // for compatibility with the container interface
+        CItem At(int key) const {
+            return Get(key);
+        }
+
+        void DeleteAll() {
+            int i;
+            for (i=0; i < used; i++) {
+                delete items[i];
+                items[i] = NULL;
+            }
+            if (next) {
+                next->DeleteAll();
+                delete next;
+                next = NULL;
+            }
+        }
+};
+
+      
+      
+      // ********************************************************************************************
+      // List: simple list class
+      // -----------------------
+      
+      template <class T, int N> class List : public Container<T>
+      {
+        protected:
+            int count, allocCount;
+            T *list;
+            
+        public:
+            List();
+            virtual ~List();
+            
+            T operator[](int Index) const { return At(Index); }
+            T At(int Index) const { return list[Index]; }
+            int GetCount() const { return count; }
+            int Add(T &item);
+      };
+      
+      template <class T, int N>
+          List<T, N>::List()
+      {
+          count = 0;
+          allocCount = 0;
+          list = NULL;
+      }
+      
+      template <class T, int N>
+          List<T, N>::~List()
+      {
+          if (list != NULL)
+              free(list);
+      }
+      
+      template <class T, int N>
+          int List<T, N>::Add(T &item)
+      {
+          int element = count++;
+          
+          if (count >= allocCount)
+          {
+              allocCount += N;
+              list = (T *)realloc(list, sizeof(T) * allocCount);
+          }
+          
+          list[element] = item;
+          
+          return element;
+      }
+    
+    
+}
+}
+}
diff --git a/Lib/EuresysCam/Include/multicam.h b/Lib/EuresysCam/Include/multicam.h
new file mode 100644
index 0000000..07960ef
--- /dev/null
+++ b/Lib/EuresysCam/Include/multicam.h
@@ -0,0 +1,155 @@
+// MULTICAM.H -- MULTICAM DRIVER API
+
+#ifndef _MULTICAM_
+#define _MULTICAM_
+
+#if defined(WINAPI)
+#define MCAPI WINAPI
+#elif defined(__BORLANDC__)
+#if __BORLANDC__ >= 0x0570
+#define MCAPI __stdcall
+#else
+#define MCAPI stdcall
+#endif
+#elif defined(__GNUC__)
+#define MCAPI
+#else
+#define MCAPI _stdcall
+#endif
+
+#if defined(DLL_EXPORTS) && defined(__GNUC__)
+#define DLL_API  __attribute__((visibility("default")))
+#elif defined(DLL_EXPORTS)
+#define DLL_API __declspec(dllexport) MCAPI
+#elif defined(__BORLANDC__)
+#define DLL_API _import MCAPI
+#elif defined(__GNUC__)
+#define DLL_API
+#elif defined(EURESYS_STATIC)
+#define DLL_API
+#else
+#define DLL_API __declspec(dllimport) MCAPI
+#endif
+
+// MULTICAM PARAMETERS AND DEFINITIONS
+#include "McParams.h"
+#include "McDef.h"
+#include "McIo.h"
+#if !defined(DLL_EXPORTS)
+#include "McParamsCompat1x.h"
+#endif
+
+#include "MultiCam_DataTypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef int MCSTATUS;
+typedef UINT32 MCHANDLE, *PMCHANDLE;
+typedef UINT32 MCPARAMID, *PMCPARAMID;
+typedef int MCEVENT, MCSIGNAL;
+
+
+// SIGNALING
+typedef struct _MC_CALLBACK_INFO {
+	PVOID Context;
+	MCHANDLE Instance;
+	MCSIGNAL Signal;
+	UINT32 SignalInfo;
+	UINT32 SignalContext;
+} MCSIGNALINFO, *PMCSIGNALINFO, *PMCCALLBACKINFO, MCCALLBACKINFO;
+
+typedef void (MCAPI *PMCCALLBACK)(PMCSIGNALINFO CbInfo);
+typedef void (MCAPI *PMCCALLBACKEX)(PVOID Context);
+
+// OBJECT CLASSES
+#define MC_SURFACE_CLASS		0x4
+#define MC_CHANNEL_CLASS		0x8
+#define MC_CONFIG_CLASS			0x2
+#define MC_BOARD_CLASS			0xE
+
+
+// DEFAULT INSTANCE TEMPLATES
+#define MC_DEFAULT_SURFACE_HANDLE (MCHANDLE)((MC_SURFACE_CLASS << 28) | 0x0FFFFFFF)
+
+#define MC_CONFIGURATION			(MCHANDLE)((MC_CONFIG_CLASS << 28) | 0)
+
+#define MC_BOARD					(MCHANDLE)((MC_BOARD_CLASS << 28) | 0)
+
+// CHANNEL CREATION MODELS
+#define MC_CHANNEL					(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0000FFFF)
+#define MC_CHANNEL_ALPHA_X			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0007FFFF)
+#define MC_CHANNEL_ALPHA_Y			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0008FFFF)
+#define MC_CHANNEL_ALPHA_XBIS		(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0015FFFF)
+#define MC_CHANNEL_ALPHA_YBIS		(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0016FFFF)
+#define MC_CHANNEL_ALPHA_STEREOXY	(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x001CFFFF)
+#define MC_CHANNEL_VALUE_M			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0009FFFF)
+#define MC_CHANNEL_EXPERT_M			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x000AFFFF)
+#define MC_CHANNEL_EXPERT_A			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x000BFFFF)
+#define MC_CHANNEL_EXPERT_B			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x000CFFFF)
+#define MC_CHANNEL_HARMONY			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x001EFFFF)
+#define MC_CHANNEL_MELODY			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x001FFFFF)
+#define MC_CHANNEL_AVENUE			(MCHANDLE)((MC_CHANNEL_CLASS << 28) | 0x0024FFFF)
+
+
+#if !defined(MC_DYNAMIC_BINDING)
+
+// STATIC INSTANCE OBJECTS
+// FUNCTIONS
+
+// Driver connections
+MCSTATUS DLL_API McOpenDriver(PCCHAR InstanceName);
+MCSTATUS DLL_API McCloseDriver(void);
+
+// Object creation / deletion
+MCSTATUS DLL_API McCreate(MCHANDLE ModelInstance, PMCHANDLE Instance);
+MCSTATUS DLL_API McCreateNm(PCCHAR ModelInstanceName, PMCHANDLE Instance);
+MCSTATUS DLL_API McDelete(MCHANDLE Instance);
+
+// Acquisition control
+MCSTATUS DLL_API McStartAcq(void);
+MCSTATUS DLL_API McStopAcq(void);
+
+// Parameter handling
+MCSTATUS DLL_API McSetParamInt(MCHANDLE Instance, MCPARAMID Param, INT32 ValueInt);
+MCSTATUS DLL_API McSetParamNmInt(MCHANDLE Instance, PCCHAR ParamName, INT32 ValueInt);
+MCSTATUS DLL_API McSetParamStr(MCHANDLE Instance, MCPARAMID Param, PCCHAR ValueStr);
+MCSTATUS DLL_API McSetParamNmStr(MCHANDLE Instance, PCCHAR ParamName, PCCHAR ValueStr);
+MCSTATUS DLL_API McSetParamFloat(MCHANDLE Instance, MCPARAMID Param, FLOAT64 ValueFloat);
+MCSTATUS DLL_API McSetParamNmFloat(MCHANDLE Instance, PCCHAR ParamName, FLOAT64 ValueFloat);
+MCSTATUS DLL_API McSetParamInst(MCHANDLE Instance, MCPARAMID Param, MCHANDLE ValueInst);
+MCSTATUS DLL_API McSetParamNmInst(MCHANDLE Instance, PCCHAR ParamName, MCHANDLE ValueInst);
+MCSTATUS DLL_API McSetParamPtr(MCHANDLE Instance, MCPARAMID Param, PVOID ValuePtr);
+MCSTATUS DLL_API McSetParamNmPtr(MCHANDLE Instance, PCCHAR ParamName, PVOID ValuePtr);
+MCSTATUS DLL_API McSetParamInt64(MCHANDLE Instance, MCPARAMID Param, INT64 ValueInt64);
+MCSTATUS DLL_API McSetParamNmInt64(MCHANDLE Instance, PCCHAR ParamName, INT64 ValueInt64);
+
+MCSTATUS DLL_API McGetParamInt(MCHANDLE Instance, MCPARAMID Param, PINT32 ValueInt);
+MCSTATUS DLL_API McGetParamNmInt(MCHANDLE Instance, PCCHAR ParamName, PINT32 ValueInt);
+MCSTATUS DLL_API McGetParamStr(MCHANDLE Instance, MCPARAMID Param, PCHAR ValueStr, UINT32 MaxLength);
+MCSTATUS DLL_API McGetParamNmStr(MCHANDLE Instance, PCCHAR ParamName, PCHAR ValueStr, UINT32 MaxLength);
+MCSTATUS DLL_API McGetParamFloat(MCHANDLE Instance, MCPARAMID Param, PFLOAT64 ValueFloat);
+MCSTATUS DLL_API McGetParamNmFloat(MCHANDLE Instance, PCCHAR ParamName, PFLOAT64 ValueFloat);
+MCSTATUS DLL_API McGetParamInst(MCHANDLE Instance, MCPARAMID Param, PMCHANDLE ValueInst);
+MCSTATUS DLL_API McGetParamNmInst(MCHANDLE Instance, PCCHAR ParamName, PMCHANDLE ValueInst);
+MCSTATUS DLL_API McGetParamPtr(MCHANDLE Instance, MCPARAMID Param, PVOID *ValuePtr);
+MCSTATUS DLL_API McGetParamNmPtr(MCHANDLE Instance, PCCHAR ParamName, PVOID *ValuePtr);
+MCSTATUS DLL_API McGetParamInt64(MCHANDLE Instance, MCPARAMID Param, PINT64 ValueInt64);
+MCSTATUS DLL_API McGetParamNmInt64(MCHANDLE Instance, PCCHAR ParamName, PINT64 ValueInt64);
+
+// Callback registration for an object
+MCSTATUS DLL_API McRegisterCallback(MCHANDLE Instance, PMCCALLBACK CallBackFunction, PVOID Context);
+MCSTATUS DLL_API McRegisterCallbackEx(MCHANDLE Instance, PMCCALLBACK CallBackFunction, PMCCALLBACKEX ThreadStart, PMCCALLBACKEX ThreadEnd, PVOID Context);
+
+// Event Management
+MCSTATUS DLL_API McWaitSignal(MCHANDLE Instance, MCSIGNAL Signal, UINT32 Timeout, PMCSIGNALINFO Info);
+MCSTATUS DLL_API McGetSignalInfo(MCHANDLE Instance, MCSIGNAL Signal, PMCSIGNALINFO Info);
+
+#endif	// MC_DYNAMIC_BINDING
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // _MULTICAM_
diff --git a/Lib/EuresysCam/Lib/MultiCam.def b/Lib/EuresysCam/Lib/MultiCam.def
new file mode 100644
index 0000000..8f53614
--- /dev/null
+++ b/Lib/EuresysCam/Lib/MultiCam.def
@@ -0,0 +1,35 @@
+IMPORTS
+	McOpenDriver=MULTICAM._McOpenDriver@4
+	McCloseDriver=MULTICAM._McCloseDriver@0
+	McCreate=MULTICAM._McCreate@8
+	McCreateNm=MULTICAM._McCreateNm@8
+	McDelete=MULTICAM._McDelete@4
+	McStartAcq=MULTICAM._McStartAcq@0
+	McStopAcq=MULTICAM._McStopAcq@0
+	McSetParamInt=MULTICAM._McSetParamInt@12
+	McSetParamNmInt=MULTICAM._McSetParamNmInt@12
+	McSetParamStr=MULTICAM._McSetParamStr@12
+	McSetParamNmStr=MULTICAM._McSetParamNmStr@12
+	McSetParamFloat=MULTICAM._McSetParamFloat@16
+	McSetParamNmFloat=MULTICAM._McSetParamNmFloat@16
+	McSetParamInst=MULTICAM._McSetParamInst@12
+	McSetParamNmInst=MULTICAM._McSetParamNmInst@12
+	McSetParamPtr=MULTICAM._McSetParamPtr@12
+	McSetParamNmPtr=MULTICAM._McSetParamNmPtr@12
+	McSetParamInt64=MULTICAM._McSetParamInt64@16
+	McSetParamNmInt64=MULTICAM._McSetParamNmInt64@16
+	McGetParamInt=MULTICAM._McGetParamInt@12
+	McGetParamNmInt=MULTICAM._McGetParamNmInt@12
+	McGetParamStr=MULTICAM._McGetParamStr@16
+	McGetParamNmStr=MULTICAM._McGetParamNmStr@16
+	McGetParamFloat=MULTICAM._McGetParamFloat@12
+	McGetParamNmFloat=MULTICAM._McGetParamNmFloat@12
+	McGetParamInst=MULTICAM._McGetParamInst@12
+	McGetParamNmInst=MULTICAM._McGetParamNmInst@12
+	McGetParamPtr=MULTICAM._McGetParamPtr@12
+	McGetParamNmPtr=MULTICAM._McGetParamNmPtr@12
+	McGetParamInt64=MULTICAM._McGetParamInt64@12
+	McGetParamNmInt64=MULTICAM._McGetParamNmInt64@12
+	McRegisterCallback=MULTICAM._McRegisterCallback@12
+	McWaitSignal=MULTICAM._McWaitSignal@16
+	McGetSignalInfo=MULTICAM._McGetSignalInfo@12
diff --git a/Lib/EuresysCam/Lib/MultiCam.lib b/Lib/EuresysCam/Lib/MultiCam.lib
new file mode 100644
index 0000000..c4f3d88
--- /dev/null
+++ b/Lib/EuresysCam/Lib/MultiCam.lib
Binary files differ
diff --git a/Lib/EuresysCam/Lib/amd64/MultiCam.def b/Lib/EuresysCam/Lib/amd64/MultiCam.def
new file mode 100644
index 0000000..d5353cc
--- /dev/null
+++ b/Lib/EuresysCam/Lib/amd64/MultiCam.def
@@ -0,0 +1,35 @@
+IMPORTS
+	McOpenDriver=MULTICAM.McOpenDriver
+	McCloseDriver=MULTICAM.McCloseDriver
+	McCreate=MULTICAM.McCreate
+	McCreateNm=MULTICAM.McCreateNm
+	McDelete=MULTICAM.McDelete
+	McStartAcq=MULTICAM.McStartAcq
+	McStopAcq=MULTICAM.McStopAcq
+	McSetParamInt=MULTICAM.McSetParamInt
+	McSetParamNmInt=MULTICAM.McSetParamNmInt
+	McSetParamStr=MULTICAM.McSetParamStr
+	McSetParamNmStr=MULTICAM.McSetParamNmStr
+	McSetParamFloat=MULTICAM.McSetParamFloat
+	McSetParamNmFloat=MULTICAM.McSetParamNmFloat
+	McSetParamInst=MULTICAM.McSetParamInst
+	McSetParamNmInst=MULTICAM.McSetParamNmInst
+	McSetParamPtr=MULTICAM.McSetParamPtr
+	McSetParamNmPtr=MULTICAM.McSetParamNmPtr
+	McSetParamInt64=MULTICAM.McSetParamInt64
+	McSetParamNmInt64=MULTICAM.McSetParamNmInt64
+	McGetParamInt=MULTICAM.McGetParamInt
+	McGetParamNmInt=MULTICAM.McGetParamNmInt
+	McGetParamStr=MULTICAM.McGetParamStr
+	McGetParamNmStr=MULTICAM.McGetParamNmStr
+	McGetParamFloat=MULTICAM.McGetParamFloat
+	McGetParamNmFloat=MULTICAM.McGetParamNmFloat
+	McGetParamInst=MULTICAM.McGetParamInst
+	McGetParamNmInst=MULTICAM.McGetParamNmInst
+	McGetParamPtr=MULTICAM.McGetParamPtr
+	McGetParamNmPtr=MULTICAM.McGetParamNmPtr
+	McGetParamInt64=MULTICAM.McGetParamInt64
+	McGetParamNmInt64=MULTICAM.McGetParamNmInt64
+	McRegisterCallback=MULTICAM.McRegisterCallback
+	McWaitSignal=MULTICAM.McWaitSignal
+	McGetSignalInfo=MULTICAM.McGetSignalInfo
diff --git a/Lib/EuresysCam/Lib/amd64/MultiCam.lib b/Lib/EuresysCam/Lib/amd64/MultiCam.lib
new file mode 100644
index 0000000..67899e7
--- /dev/null
+++ b/Lib/EuresysCam/Lib/amd64/MultiCam.lib
Binary files differ
diff --git a/Lib/FreeImage/lib/FreeImage.dll b/Lib/FreeImage/lib/FreeImage.dll
new file mode 100644
index 0000000..a6643ae
--- /dev/null
+++ b/Lib/FreeImage/lib/FreeImage.dll
Binary files differ
diff --git a/Lib/FreeImage/lib/FreeImage.lib b/Lib/FreeImage/lib/FreeImage.lib
new file mode 100644
index 0000000..6755193
--- /dev/null
+++ b/Lib/FreeImage/lib/FreeImage.lib
Binary files differ
diff --git a/Lib/JsoncppSDK/include/allocator.h b/Lib/JsoncppSDK/include/allocator.h
new file mode 100644
index 0000000..459c34c
--- /dev/null
+++ b/Lib/JsoncppSDK/include/allocator.h
@@ -0,0 +1,100 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_ALLOCATOR_H_INCLUDED
+#define JSON_ALLOCATOR_H_INCLUDED
+
+#include <algorithm>
+#include <cstring>
+#include <memory>
+
+#pragma pack(push)
+#pragma pack()
+
+namespace Json {
+template <typename T> class SecureAllocator {
+public:
+  // Type definitions
+  using value_type = T;
+  using pointer = T*;
+  using const_pointer = const T*;
+  using reference = T&;
+  using const_reference = const T&;
+  using size_type = std::size_t;
+  using difference_type = std::ptrdiff_t;
+
+  /**
+   * Allocate memory for N items using the standard allocator.
+   */
+  pointer allocate(size_type n) {
+    // allocate using "global operator new"
+    return static_cast<pointer>(::operator new(n * sizeof(T)));
+  }
+
+  /**
+   * Release memory which was allocated for N items at pointer P.
+   *
+   * The memory block is filled with zeroes before being released.
+   */
+  void deallocate(pointer p, size_type n) {
+    // These constructs will not be removed by the compiler during optimization,
+    // unlike memset.
+#if defined(HAVE_MEMSET_S)
+    memset_s(p, n * sizeof(T), 0, n * sizeof(T));
+#elif defined(_WIN32)
+    RtlSecureZeroMemory(p, n * sizeof(T));
+#else
+    std::fill_n(reinterpret_cast<volatile unsigned char*>(p), n, 0);
+#endif
+
+    // free using "global operator delete"
+    ::operator delete(p);
+  }
+
+  /**
+   * Construct an item in-place at pointer P.
+   */
+  template <typename... Args> void construct(pointer p, Args&&... args) {
+    // construct using "placement new" and "perfect forwarding"
+    ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
+  }
+
+  size_type max_size() const { return size_t(-1) / sizeof(T); }
+
+  pointer address(reference x) const { return std::addressof(x); }
+
+  const_pointer address(const_reference x) const { return std::addressof(x); }
+
+  /**
+   * Destroy an item in-place at pointer P.
+   */
+  void destroy(pointer p) {
+    // destroy using "explicit destructor"
+    p->~T();
+  }
+
+  // Boilerplate
+  SecureAllocator() {}
+  template <typename U> SecureAllocator(const SecureAllocator<U>&) {}
+  template <typename U> struct rebind {
+    using other = SecureAllocator<U>;
+  };
+};
+
+template <typename T, typename U>
+bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
+  return true;
+}
+
+template <typename T, typename U>
+bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
+  return false;
+}
+
+} // namespace Json
+
+#pragma pack(pop)
+
+#endif // JSON_ALLOCATOR_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/assertions.h b/Lib/JsoncppSDK/include/assertions.h
new file mode 100644
index 0000000..666fa7f
--- /dev/null
+++ b/Lib/JsoncppSDK/include/assertions.h
@@ -0,0 +1,61 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_ASSERTIONS_H_INCLUDED
+#define JSON_ASSERTIONS_H_INCLUDED
+
+#include <cstdlib>
+#include <sstream>
+
+#if !defined(JSON_IS_AMALGAMATION)
+#include "config.h"
+#endif // if !defined(JSON_IS_AMALGAMATION)
+
+/** It should not be possible for a maliciously designed file to
+ *  cause an abort() or seg-fault, so these macros are used only
+ *  for pre-condition violations and internal logic errors.
+ */
+#if JSON_USE_EXCEPTION
+
+// @todo <= add detail about condition in exception
+#define JSON_ASSERT(condition)                                                 \
+  do {                                                                         \
+    if (!(condition)) {                                                        \
+      Json::throwLogicError("assert json failed");                             \
+    }                                                                          \
+  } while (0)
+
+#define JSON_FAIL_MESSAGE(message)                                             \
+  do {                                                                         \
+    OStringStream oss;                                                         \
+    oss << message;                                                            \
+    Json::throwLogicError(oss.str());                                          \
+    abort();                                                                   \
+  } while (0)
+
+#else // JSON_USE_EXCEPTION
+
+#define JSON_ASSERT(condition) assert(condition)
+
+// The call to assert() will show the failure message in debug builds. In
+// release builds we abort, for a core-dump or debugger.
+#define JSON_FAIL_MESSAGE(message)                                             \
+  {                                                                            \
+    OStringStream oss;                                                         \
+    oss << message;                                                            \
+    assert(false && oss.str().c_str());                                        \
+    abort();                                                                   \
+  }
+
+#endif
+
+#define JSON_ASSERT_MESSAGE(condition, message)                                \
+  do {                                                                         \
+    if (!(condition)) {                                                        \
+      JSON_FAIL_MESSAGE(message);                                              \
+    }                                                                          \
+  } while (0)
+
+#endif // JSON_ASSERTIONS_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/config.h b/Lib/JsoncppSDK/include/config.h
new file mode 100644
index 0000000..7f6e243
--- /dev/null
+++ b/Lib/JsoncppSDK/include/config.h
@@ -0,0 +1,150 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_CONFIG_H_INCLUDED
+#define JSON_CONFIG_H_INCLUDED
+#include <cstddef>
+#include <cstdint>
+#include <istream>
+#include <memory>
+#include <ostream>
+#include <sstream>
+#include <string>
+#include <type_traits>
+
+// If non-zero, the library uses exceptions to report bad input instead of C
+// assertion macros. The default is to use exceptions.
+#ifndef JSON_USE_EXCEPTION
+#define JSON_USE_EXCEPTION 1
+#endif
+
+// Temporary, tracked for removal with issue #982.
+#ifndef JSON_USE_NULLREF
+#define JSON_USE_NULLREF 1
+#endif
+
+/// If defined, indicates that the source file is amalgamated
+/// to prevent private header inclusion.
+/// Remarks: it is automatically defined in the generated amalgamated header.
+// #define JSON_IS_AMALGAMATION
+
+// Export macros for DLL visibility
+#if defined(JSON_DLL_BUILD)
+#if defined(_MSC_VER) || defined(__MINGW32__)
+#define JSON_API __declspec(dllexport)
+#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
+#elif defined(__GNUC__) || defined(__clang__)
+#define JSON_API __attribute__((visibility("default")))
+#endif // if defined(_MSC_VER)
+
+#elif defined(JSON_DLL)
+#if defined(_MSC_VER) || defined(__MINGW32__)
+#define JSON_API __declspec(dllimport)
+#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
+#endif // if defined(_MSC_VER)
+#endif // ifdef JSON_DLL_BUILD
+
+#if !defined(JSON_API)
+#define JSON_API
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER < 1800
+#error                                                                         \
+    "ERROR:  Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported compiler with sufficient C++11 capabilities"
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER < 1900
+// As recommended at
+// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
+extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,
+                                              const char* format, ...);
+#define jsoncpp_snprintf msvc_pre1900_c99_snprintf
+#else
+#define jsoncpp_snprintf std::snprintf
+#endif
+
+// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
+// integer
+// Storages, and 64 bits integer support is disabled.
+// #define JSON_NO_INT64 1
+
+// JSONCPP_OVERRIDE is maintained for backwards compatibility of external tools.
+// C++11 should be used directly in JSONCPP.
+#define JSONCPP_OVERRIDE override
+
+#ifdef __clang__
+#if __has_extension(attribute_deprecated_with_message)
+#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
+#endif
+#elif defined(__GNUC__) // not clang (gcc comes later since clang emulates gcc)
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
+#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
+#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
+#endif                  // GNUC version
+#elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates
+                        // MSVC)
+#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
+#endif // __clang__ || __GNUC__ || _MSC_VER
+
+#if !defined(JSONCPP_DEPRECATED)
+#define JSONCPP_DEPRECATED(message)
+#endif // if !defined(JSONCPP_DEPRECATED)
+
+#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
+#define JSON_USE_INT64_DOUBLE_CONVERSION 1
+#endif
+
+#if !defined(JSON_IS_AMALGAMATION)
+
+#include "allocator.h"
+#include "version.h"
+
+#endif // if !defined(JSON_IS_AMALGAMATION)
+
+namespace Json {
+using Int = int;
+using UInt = unsigned int;
+#if defined(JSON_NO_INT64)
+using LargestInt = int;
+using LargestUInt = unsigned int;
+#undef JSON_HAS_INT64
+#else                 // if defined(JSON_NO_INT64)
+// For Microsoft Visual use specific types as long long is not supported
+#if defined(_MSC_VER) // Microsoft Visual Studio
+using Int64 = __int64;
+using UInt64 = unsigned __int64;
+#else                 // if defined(_MSC_VER) // Other platforms, use long long
+using Int64 = int64_t;
+using UInt64 = uint64_t;
+#endif                // if defined(_MSC_VER)
+using LargestInt = Int64;
+using LargestUInt = UInt64;
+#define JSON_HAS_INT64
+#endif // if defined(JSON_NO_INT64)
+
+template <typename T>
+using Allocator =
+    typename std::conditional<JSONCPP_USE_SECURE_MEMORY, SecureAllocator<T>,
+                              std::allocator<T>>::type;
+using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
+using IStringStream =
+    std::basic_istringstream<String::value_type, String::traits_type,
+                             String::allocator_type>;
+using OStringStream =
+    std::basic_ostringstream<String::value_type, String::traits_type,
+                             String::allocator_type>;
+using IStream = std::istream;
+using OStream = std::ostream;
+} // namespace Json
+
+// Legacy names (formerly macros).
+using JSONCPP_STRING = Json::String;
+using JSONCPP_ISTRINGSTREAM = Json::IStringStream;
+using JSONCPP_OSTRINGSTREAM = Json::OStringStream;
+using JSONCPP_ISTREAM = Json::IStream;
+using JSONCPP_OSTREAM = Json::OStream;
+
+#endif // JSON_CONFIG_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/forwards.h b/Lib/JsoncppSDK/include/forwards.h
new file mode 100644
index 0000000..affe33a
--- /dev/null
+++ b/Lib/JsoncppSDK/include/forwards.h
@@ -0,0 +1,43 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_FORWARDS_H_INCLUDED
+#define JSON_FORWARDS_H_INCLUDED
+
+#if !defined(JSON_IS_AMALGAMATION)
+#include "config.h"
+#endif // if !defined(JSON_IS_AMALGAMATION)
+
+namespace Json {
+
+// writer.h
+class StreamWriter;
+class StreamWriterBuilder;
+class Writer;
+class FastWriter;
+class StyledWriter;
+class StyledStreamWriter;
+
+// reader.h
+class Reader;
+class CharReader;
+class CharReaderBuilder;
+
+// json_features.h
+class Features;
+
+// value.h
+using ArrayIndex = unsigned int;
+class StaticString;
+class Path;
+class PathArgument;
+class Value;
+class ValueIteratorBase;
+class ValueIterator;
+class ValueConstIterator;
+
+} // namespace Json
+
+#endif // JSON_FORWARDS_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/json.h b/Lib/JsoncppSDK/include/json.h
new file mode 100644
index 0000000..5c776a1
--- /dev/null
+++ b/Lib/JsoncppSDK/include/json.h
@@ -0,0 +1,15 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_JSON_H_INCLUDED
+#define JSON_JSON_H_INCLUDED
+
+#include "config.h"
+#include "json_features.h"
+#include "reader.h"
+#include "value.h"
+#include "writer.h"
+
+#endif // JSON_JSON_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/json_features.h b/Lib/JsoncppSDK/include/json_features.h
new file mode 100644
index 0000000..e4a61d6
--- /dev/null
+++ b/Lib/JsoncppSDK/include/json_features.h
@@ -0,0 +1,62 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_FEATURES_H_INCLUDED
+#define JSON_FEATURES_H_INCLUDED
+
+#if !defined(JSON_IS_AMALGAMATION)
+#include "forwards.h"
+#endif // if !defined(JSON_IS_AMALGAMATION)
+
+#pragma pack(push)
+#pragma pack()
+
+namespace Json {
+
+/** \brief Configuration passed to reader and writer.
+ * This configuration object can be used to force the Reader or Writer
+ * to behave in a standard conforming way.
+ */
+class JSON_API Features {
+public:
+  /** \brief A configuration that allows all features and assumes all strings
+   * are UTF-8.
+   * - C & C++ comments are allowed
+   * - Root object can be any JSON value
+   * - Assumes Value strings are encoded in UTF-8
+   */
+  static Features all();
+
+  /** \brief A configuration that is strictly compatible with the JSON
+   * specification.
+   * - Comments are forbidden.
+   * - Root object must be either an array or an object value.
+   * - Assumes Value strings are encoded in UTF-8
+   */
+  static Features strictMode();
+
+  /** \brief Initialize the configuration like JsonConfig::allFeatures;
+   */
+  Features();
+
+  /// \c true if comments are allowed. Default: \c true.
+  bool allowComments_{true};
+
+  /// \c true if root must be either an array or an object value. Default: \c
+  /// false.
+  bool strictRoot_{false};
+
+  /// \c true if dropped null placeholders are allowed. Default: \c false.
+  bool allowDroppedNullPlaceholders_{false};
+
+  /// \c true if numeric object key are allowed. Default: \c false.
+  bool allowNumericKeys_{false};
+};
+
+} // namespace Json
+
+#pragma pack(pop)
+
+#endif // JSON_FEATURES_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/reader.h b/Lib/JsoncppSDK/include/reader.h
new file mode 100644
index 0000000..d745378
--- /dev/null
+++ b/Lib/JsoncppSDK/include/reader.h
@@ -0,0 +1,437 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_READER_H_INCLUDED
+#define JSON_READER_H_INCLUDED
+
+#if !defined(JSON_IS_AMALGAMATION)
+#include "json_features.h"
+#include "value.h"
+#endif // if !defined(JSON_IS_AMALGAMATION)
+#include <deque>
+#include <iosfwd>
+#include <istream>
+#include <stack>
+#include <string>
+
+// Disable warning C4251: <data member>: <type> needs to have dll-interface to
+// be used by...
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+#pragma warning(push)
+#pragma warning(disable : 4251)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+#pragma pack(push)
+#pragma pack()
+
+namespace Json {
+
+/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
+ * Value.
+ *
+ * \deprecated Use CharReader and CharReaderBuilder.
+ */
+
+class JSON_API Reader {
+public:
+  using Char = char;
+  using Location = const Char*;
+
+  /** \brief An error tagged with where in the JSON text it was encountered.
+   *
+   * The offsets give the [start, limit) range of bytes within the text. Note
+   * that this is bytes, not codepoints.
+   */
+  struct StructuredError {
+    ptrdiff_t offset_start;
+    ptrdiff_t offset_limit;
+    String message;
+  };
+
+  /** \brief Constructs a Reader allowing all features for parsing.
+   * \deprecated Use CharReader and CharReaderBuilder.
+   */
+  Reader();
+
+  /** \brief Constructs a Reader allowing the specified feature set for parsing.
+   * \deprecated Use CharReader and CharReaderBuilder.
+   */
+  Reader(const Features& features);
+
+  /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
+   * document.
+   *
+   * \param      document        UTF-8 encoded string containing the document
+   *                             to read.
+   * \param[out] root            Contains the root value of the document if it
+   *                             was successfully parsed.
+   * \param      collectComments \c true to collect comment and allow writing
+   *                             them back during serialization, \c false to
+   *                             discard comments.  This parameter is ignored
+   *                             if Features::allowComments_ is \c false.
+   * \return \c true if the document was successfully parsed, \c false if an
+   * error occurred.
+   */
+  bool parse(const std::string& document, Value& root,
+             bool collectComments = true);
+
+  /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
+   * document.
+   *
+   * \param      beginDoc        Pointer on the beginning of the UTF-8 encoded
+   *                             string of the document to read.
+   * \param      endDoc          Pointer on the end of the UTF-8 encoded string
+   *                             of the document to read.  Must be >= beginDoc.
+   * \param[out] root            Contains the root value of the document if it
+   *                             was successfully parsed.
+   * \param      collectComments \c true to collect comment and allow writing
+   *                             them back during serialization, \c false to
+   *                             discard comments.  This parameter is ignored
+   *                             if Features::allowComments_ is \c false.
+   * \return \c true if the document was successfully parsed, \c false if an
+   * error occurred.
+   */
+  bool parse(const char* beginDoc, const char* endDoc, Value& root,
+             bool collectComments = true);
+
+  /// \brief Parse from input stream.
+  /// \see Json::operator>>(std::istream&, Json::Value&).
+  bool parse(IStream& is, Value& root, bool collectComments = true);
+
+  /** \brief Returns a user friendly string that list errors in the parsed
+   * document.
+   *
+   * \return Formatted error message with the list of errors with their
+   * location in the parsed document. An empty string is returned if no error
+   * occurred during parsing.
+   * \deprecated Use getFormattedErrorMessages() instead (typo fix).
+   */
+  JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
+  String getFormatedErrorMessages() const;
+
+  /** \brief Returns a user friendly string that list errors in the parsed
+   * document.
+   *
+   * \return Formatted error message with the list of errors with their
+   * location in the parsed document. An empty string is returned if no error
+   * occurred during parsing.
+   */
+  String getFormattedErrorMessages() const;
+
+  /** \brief Returns a vector of structured errors encountered while parsing.
+   *
+   * \return A (possibly empty) vector of StructuredError objects. Currently
+   * only one error can be returned, but the caller should tolerate multiple
+   * errors.  This can occur if the parser recovers from a non-fatal parse
+   * error and then encounters additional errors.
+   */
+  std::vector<StructuredError> getStructuredErrors() const;
+
+  /** \brief Add a semantic error message.
+   *
+   * \param value   JSON Value location associated with the error
+   * \param message The error message.
+   * \return \c true if the error was successfully added, \c false if the Value
+   * offset exceeds the document size.
+   */
+  bool pushError(const Value& value, const String& message);
+
+  /** \brief Add a semantic error message with extra context.
+   *
+   * \param value   JSON Value location associated with the error
+   * \param message The error message.
+   * \param extra   Additional JSON Value location to contextualize the error
+   * \return \c true if the error was successfully added, \c false if either
+   * Value offset exceeds the document size.
+   */
+  bool pushError(const Value& value, const String& message, const Value& extra);
+
+  /** \brief Return whether there are any errors.
+   *
+   * \return \c true if there are no errors to report \c false if errors have
+   * occurred.
+   */
+  bool good() const;
+
+private:
+  enum TokenType {
+    tokenEndOfStream = 0,
+    tokenObjectBegin,
+    tokenObjectEnd,
+    tokenArrayBegin,
+    tokenArrayEnd,
+    tokenString,
+    tokenNumber,
+    tokenTrue,
+    tokenFalse,
+    tokenNull,
+    tokenArraySeparator,
+    tokenMemberSeparator,
+    tokenComment,
+    tokenError
+  };
+
+  class Token {
+  public:
+    TokenType type_;
+    Location start_;
+    Location end_;
+  };
+
+  class ErrorInfo {
+  public:
+    Token token_;
+    String message_;
+    Location extra_;
+  };
+
+  using Errors = std::deque<ErrorInfo>;
+
+  bool readToken(Token& token);
+  bool readTokenSkippingComments(Token& token);
+  void skipSpaces();
+  bool match(const Char* pattern, int patternLength);
+  bool readComment();
+  bool readCStyleComment();
+  bool readCppStyleComment();
+  bool readString();
+  void readNumber();
+  bool readValue();
+  bool readObject(Token& token);
+  bool readArray(Token& token);
+  bool decodeNumber(Token& token);
+  bool decodeNumber(Token& token, Value& decoded);
+  bool decodeString(Token& token);
+  bool decodeString(Token& token, String& decoded);
+  bool decodeDouble(Token& token);
+  bool decodeDouble(Token& token, Value& decoded);
+  bool decodeUnicodeCodePoint(Token& token, Location& current, Location end,
+                              unsigned int& unicode);
+  bool decodeUnicodeEscapeSequence(Token& token, Location& current,
+                                   Location end, unsigned int& unicode);
+  bool addError(const String& message, Token& token, Location extra = nullptr);
+  bool recoverFromError(TokenType skipUntilToken);
+  bool addErrorAndRecover(const String& message, Token& token,
+                          TokenType skipUntilToken);
+  void skipUntilSpace();
+  Value& currentValue();
+  Char getNextChar();
+  void getLocationLineAndColumn(Location location, int& line,
+                                int& column) const;
+  String getLocationLineAndColumn(Location location) const;
+  void addComment(Location begin, Location end, CommentPlacement placement);
+
+  static bool containsNewLine(Location begin, Location end);
+  static String normalizeEOL(Location begin, Location end);
+
+  using Nodes = std::stack<Value*>;
+  Nodes nodes_;
+  Errors errors_;
+  String document_;
+  Location begin_{};
+  Location end_{};
+  Location current_{};
+  Location lastValueEnd_{};
+  Value* lastValue_{};
+  String commentsBefore_;
+  Features features_;
+  bool collectComments_{};
+}; // Reader
+
+/** Interface for reading JSON from a char array.
+ */
+class JSON_API CharReader {
+public:
+  struct JSON_API StructuredError {
+    ptrdiff_t offset_start;
+    ptrdiff_t offset_limit;
+    String message;
+  };
+
+  virtual ~CharReader() = default;
+  /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
+   * document. The document must be a UTF-8 encoded string containing the
+   * document to read.
+   *
+   * \param      beginDoc Pointer on the beginning of the UTF-8 encoded string
+   *                      of the document to read.
+   * \param      endDoc   Pointer on the end of the UTF-8 encoded string of the
+   *                      document to read. Must be >= beginDoc.
+   * \param[out] root     Contains the root value of the document if it was
+   *                      successfully parsed.
+   * \param[out] errs     Formatted error messages (if not NULL) a user
+   *                      friendly string that lists errors in the parsed
+   *                      document.
+   * \return \c true if the document was successfully parsed, \c false if an
+   * error occurred.
+   */
+  virtual bool parse(char const* beginDoc, char const* endDoc, Value* root,
+                     String* errs);
+
+  /** \brief Returns a vector of structured errors encountered while parsing.
+   * Each parse call resets the stored list of errors.
+   */
+  std::vector<StructuredError> getStructuredErrors() const;
+
+  class JSON_API Factory {
+  public:
+    virtual ~Factory() = default;
+    /** \brief Allocate a CharReader via operator new().
+     * \throw std::exception if something goes wrong (e.g. invalid settings)
+     */
+    virtual CharReader* newCharReader() const = 0;
+  }; // Factory
+
+protected:
+  class Impl {
+  public:
+    virtual ~Impl() = default;
+    virtual bool parse(char const* beginDoc, char const* endDoc, Value* root,
+                       String* errs) = 0;
+    virtual std::vector<StructuredError> getStructuredErrors() const = 0;
+  };
+
+  explicit CharReader(std::unique_ptr<Impl> impl) : _impl(std::move(impl)) {}
+
+private:
+  std::unique_ptr<Impl> _impl;
+}; // CharReader
+
+/** \brief Build a CharReader implementation.
+ *
+ * Usage:
+ *   \code
+ *   using namespace Json;
+ *   CharReaderBuilder builder;
+ *   builder["collectComments"] = false;
+ *   Value value;
+ *   String errs;
+ *   bool ok = parseFromStream(builder, std::cin, &value, &errs);
+ *   \endcode
+ */
+class JSON_API CharReaderBuilder : public CharReader::Factory {
+public:
+  // Note: We use a Json::Value so that we can add data-members to this class
+  // without a major version bump.
+  /** Configuration of this builder.
+   * These are case-sensitive.
+   * Available settings (case-sensitive):
+   * - `"collectComments": false or true`
+   *   - true to collect comment and allow writing them back during
+   *     serialization, false to discard comments.  This parameter is ignored
+   *     if allowComments is false.
+   * - `"allowComments": false or true`
+   *   - true if comments are allowed.
+   * - `"allowTrailingCommas": false or true`
+   *   - true if trailing commas in objects and arrays are allowed.
+   * - `"strictRoot": false or true`
+   *   - true if root must be either an array or an object value
+   * - `"allowDroppedNullPlaceholders": false or true`
+   *   - true if dropped null placeholders are allowed. (See
+   *     StreamWriterBuilder.)
+   * - `"allowNumericKeys": false or true`
+   *   - true if numeric object keys are allowed.
+   * - `"allowSingleQuotes": false or true`
+   *   - true if '' are allowed for strings (both keys and values)
+   * - `"stackLimit": integer`
+   *   - Exceeding stackLimit (recursive depth of `readValue()`) will cause an
+   *     exception.
+   *   - This is a security issue (seg-faults caused by deeply nested JSON), so
+   *     the default is low.
+   * - `"failIfExtra": false or true`
+   *   - If true, `parse()` returns false when extra non-whitespace trails the
+   *     JSON value in the input string.
+   * - `"rejectDupKeys": false or true`
+   *   - If true, `parse()` returns false when a key is duplicated within an
+   *     object.
+   * - `"allowSpecialFloats": false or true`
+   *   - If true, special float values (NaNs and infinities) are allowed and
+   *     their values are lossfree restorable.
+   * - `"skipBom": false or true`
+   *   - If true, if the input starts with the Unicode byte order mark (BOM),
+   *     it is skipped.
+   *
+   * You can examine 'settings_` yourself to see the defaults. You can also
+   * write and read them just like any JSON Value.
+   * \sa setDefaults()
+   */
+  Json::Value settings_;
+
+  CharReaderBuilder();
+  ~CharReaderBuilder() override;
+
+  CharReader* newCharReader() const override;
+
+  /** \return true if 'settings' are legal and consistent;
+   *   otherwise, indicate bad settings via 'invalid'.
+   */
+  bool validate(Json::Value* invalid) const;
+
+  /** A simple way to update a specific setting.
+   */
+  Value& operator[](const String& key);
+
+  /** Called by ctor, but you can use this to reset settings_.
+   * \pre 'settings' != NULL (but Json::null is fine)
+   * \remark Defaults:
+   * \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults
+   */
+  static void setDefaults(Json::Value* settings);
+  /** Same as old Features::strictMode().
+   * \pre 'settings' != NULL (but Json::null is fine)
+   * \remark Defaults:
+   * \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
+   */
+  static void strictMode(Json::Value* settings);
+  /** ECMA-404 mode.
+   * \pre 'settings' != NULL (but Json::null is fine)
+   * \remark Defaults:
+   * \snippet src/lib_json/json_reader.cpp CharReaderBuilderECMA404Mode
+   */
+  static void ecma404Mode(Json::Value* settings);
+};
+
+/** Consume entire stream and use its begin/end.
+ * Someday we might have a real StreamReader, but for now this
+ * is convenient.
+ */
+bool JSON_API parseFromStream(CharReader::Factory const&, IStream&, Value* root,
+                              String* errs);
+
+/** \brief Read from 'sin' into 'root'.
+ *
+ * Always keep comments from the input JSON.
+ *
+ * This can be used to read a file into a particular sub-object.
+ * For example:
+ *   \code
+ *   Json::Value root;
+ *   cin >> root["dir"]["file"];
+ *   cout << root;
+ *   \endcode
+ * Result:
+ * \verbatim
+ * {
+ * "dir": {
+ *    "file": {
+ *    // The input stream JSON would be nested here.
+ *    }
+ * }
+ * }
+ * \endverbatim
+ * \throw std::exception on parse error.
+ * \see Json::operator<<()
+ */
+JSON_API IStream& operator>>(IStream&, Value&);
+
+} // namespace Json
+
+#pragma pack(pop)
+
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+#pragma warning(pop)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+#endif // JSON_READER_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/value.h b/Lib/JsoncppSDK/include/value.h
new file mode 100644
index 0000000..073ed30
--- /dev/null
+++ b/Lib/JsoncppSDK/include/value.h
@@ -0,0 +1,967 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_VALUE_H_INCLUDED
+#define JSON_VALUE_H_INCLUDED
+
+#if !defined(JSON_IS_AMALGAMATION)
+#include "forwards.h"
+#endif // if !defined(JSON_IS_AMALGAMATION)
+
+// Conditional NORETURN attribute on the throw functions would:
+// a) suppress false positives from static code analysis
+// b) possibly improve optimization opportunities.
+#if !defined(JSONCPP_NORETURN)
+#if defined(_MSC_VER) && _MSC_VER == 1800
+#define JSONCPP_NORETURN __declspec(noreturn)
+#else
+#define JSONCPP_NORETURN [[noreturn]]
+#endif
+#endif
+
+// Support for '= delete' with template declarations was a late addition
+// to the c++11 standard and is rejected by clang 3.8 and Apple clang 8.2
+// even though these declare themselves to be c++11 compilers.
+#if !defined(JSONCPP_TEMPLATE_DELETE)
+#if defined(__clang__) && defined(__apple_build_version__)
+#if __apple_build_version__ <= 8000042
+#define JSONCPP_TEMPLATE_DELETE
+#endif
+#elif defined(__clang__)
+#if __clang_major__ == 3 && __clang_minor__ <= 8
+#define JSONCPP_TEMPLATE_DELETE
+#endif
+#endif
+#if !defined(JSONCPP_TEMPLATE_DELETE)
+#define JSONCPP_TEMPLATE_DELETE = delete
+#endif
+#endif
+
+#include <array>
+#include <exception>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+// Disable warning C4251: <data member>: <type> needs to have dll-interface to
+// be used by...
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+#pragma warning(push)
+#pragma warning(disable : 4251 4275)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+#pragma pack(push)
+#pragma pack()
+
+/** \brief JSON (JavaScript Object Notation).
+ */
+namespace Json {
+
+#if JSON_USE_EXCEPTION
+/** Base class for all exceptions we throw.
+ *
+ * We use nothing but these internally. Of course, STL can throw others.
+ */
+class JSON_API Exception : public std::exception {
+public:
+  Exception(String msg);
+  ~Exception() noexcept override;
+  char const* what() const noexcept override;
+
+protected:
+  String msg_;
+};
+
+/** Exceptions which the user cannot easily avoid.
+ *
+ * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
+ *
+ * \remark derived from Json::Exception
+ */
+class JSON_API RuntimeError : public Exception {
+public:
+  RuntimeError(String const& msg);
+};
+
+/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
+ *
+ * These are precondition-violations (user bugs) and internal errors (our bugs).
+ *
+ * \remark derived from Json::Exception
+ */
+class JSON_API LogicError : public Exception {
+public:
+  LogicError(String const& msg);
+};
+#endif
+
+/// used internally
+JSONCPP_NORETURN void throwRuntimeError(String const& msg);
+/// used internally
+JSONCPP_NORETURN void throwLogicError(String const& msg);
+
+/** \brief Type of the value held by a Value object.
+ */
+enum ValueType {
+  nullValue = 0, ///< 'null' value
+  intValue,      ///< signed integer value
+  uintValue,     ///< unsigned integer value
+  realValue,     ///< double value
+  stringValue,   ///< UTF-8 string value
+  booleanValue,  ///< bool value
+  arrayValue,    ///< array value (ordered list)
+  objectValue    ///< object value (collection of name/value pairs).
+};
+
+enum CommentPlacement {
+  commentBefore = 0,      ///< a comment placed on the line before a value
+  commentAfterOnSameLine, ///< a comment just after a value on the same line
+  commentAfter, ///< a comment on the line after a value (only make sense for
+  /// root value)
+  numberOfCommentPlacement
+};
+
+/** \brief Type of precision for formatting of real values.
+ */
+enum PrecisionType {
+  significantDigits = 0, ///< we set max number of significant digits in string
+  decimalPlaces          ///< we set max number of digits after "." in string
+};
+
+/** \brief Lightweight wrapper to tag static string.
+ *
+ * Value constructor and objectValue member assignment takes advantage of the
+ * StaticString and avoid the cost of string duplication when storing the
+ * string or the member name.
+ *
+ * Example of usage:
+ * \code
+ * Json::Value aValue( StaticString("some text") );
+ * Json::Value object;
+ * static const StaticString code("code");
+ * object[code] = 1234;
+ * \endcode
+ */
+class JSON_API StaticString {
+public:
+  explicit StaticString(const char* czstring) : c_str_(czstring) {}
+
+  operator const char*() const { return c_str_; }
+
+  const char* c_str() const { return c_str_; }
+
+private:
+  const char* c_str_;
+};
+
+/** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
+ *
+ * This class is a discriminated union wrapper that can represents a:
+ * - signed integer [range: Value::minInt - Value::maxInt]
+ * - unsigned integer (range: 0 - Value::maxUInt)
+ * - double
+ * - UTF-8 string
+ * - boolean
+ * - 'null'
+ * - an ordered list of Value
+ * - collection of name/value pairs (javascript object)
+ *
+ * The type of the held value is represented by a #ValueType and
+ * can be obtained using type().
+ *
+ * Values of an #objectValue or #arrayValue can be accessed using operator[]()
+ * methods.
+ * Non-const methods will automatically create the a #nullValue element
+ * if it does not exist.
+ * The sequence of an #arrayValue will be automatically resized and initialized
+ * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
+ *
+ * The get() methods can be used to obtain default value in the case the
+ * required element does not exist.
+ *
+ * It is possible to iterate over the list of member keys of an object using
+ * the getMemberNames() method.
+ *
+ * \note #Value string-length fit in size_t, but keys must be < 2^30.
+ * (The reason is an implementation detail.) A #CharReader will raise an
+ * exception if a bound is exceeded to avoid security holes in your app,
+ * but the Value API does *not* check bounds. That is the responsibility
+ * of the caller.
+ */
+class JSON_API Value {
+  friend class ValueIteratorBase;
+
+public:
+  using Members = std::vector<String>;
+  using iterator = ValueIterator;
+  using const_iterator = ValueConstIterator;
+  using UInt = Json::UInt;
+  using Int = Json::Int;
+#if defined(JSON_HAS_INT64)
+  using UInt64 = Json::UInt64;
+  using Int64 = Json::Int64;
+#endif // defined(JSON_HAS_INT64)
+  using LargestInt = Json::LargestInt;
+  using LargestUInt = Json::LargestUInt;
+  using ArrayIndex = Json::ArrayIndex;
+
+  // Required for boost integration, e. g. BOOST_TEST
+  using value_type = std::string;
+
+#if JSON_USE_NULLREF
+  // Binary compatibility kludges, do not use.
+  static const Value& null;
+  static const Value& nullRef;
+#endif
+
+  // null and nullRef are deprecated, use this instead.
+  static Value const& nullSingleton();
+
+  /// Minimum signed integer value that can be stored in a Json::Value.
+  static constexpr LargestInt minLargestInt =
+      LargestInt(~(LargestUInt(-1) / 2));
+  /// Maximum signed integer value that can be stored in a Json::Value.
+  static constexpr LargestInt maxLargestInt = LargestInt(LargestUInt(-1) / 2);
+  /// Maximum unsigned integer value that can be stored in a Json::Value.
+  static constexpr LargestUInt maxLargestUInt = LargestUInt(-1);
+
+  /// Minimum signed int value that can be stored in a Json::Value.
+  static constexpr Int minInt = Int(~(UInt(-1) / 2));
+  /// Maximum signed int value that can be stored in a Json::Value.
+  static constexpr Int maxInt = Int(UInt(-1) / 2);
+  /// Maximum unsigned int value that can be stored in a Json::Value.
+  static constexpr UInt maxUInt = UInt(-1);
+
+#if defined(JSON_HAS_INT64)
+  /// Minimum signed 64 bits int value that can be stored in a Json::Value.
+  static constexpr Int64 minInt64 = Int64(~(UInt64(-1) / 2));
+  /// Maximum signed 64 bits int value that can be stored in a Json::Value.
+  static constexpr Int64 maxInt64 = Int64(UInt64(-1) / 2);
+  /// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
+  static constexpr UInt64 maxUInt64 = UInt64(-1);
+#endif // defined(JSON_HAS_INT64)
+  /// Default precision for real value for string representation.
+  static constexpr UInt defaultRealPrecision = 17;
+  // The constant is hard-coded because some compiler have trouble
+  // converting Value::maxUInt64 to a double correctly (AIX/xlC).
+  // Assumes that UInt64 is a 64 bits integer.
+  static constexpr double maxUInt64AsDouble = 18446744073709551615.0;
+// Workaround for bug in the NVIDIAs CUDA 9.1 nvcc compiler
+// when using gcc and clang backend compilers.  CZString
+// cannot be defined as private.  See issue #486
+#ifdef __NVCC__
+public:
+#else
+private:
+#endif
+#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
+  class CZString {
+  public:
+    enum DuplicationPolicy { noDuplication = 0, duplicate, duplicateOnCopy };
+    CZString(ArrayIndex index);
+    CZString(char const* str, unsigned length, DuplicationPolicy allocate);
+    CZString(CZString const& other);
+    CZString(CZString&& other) noexcept;
+    ~CZString();
+    CZString& operator=(const CZString& other);
+    CZString& operator=(CZString&& other) noexcept;
+
+    bool operator<(CZString const& other) const;
+    bool operator==(CZString const& other) const;
+    ArrayIndex index() const;
+    // const char* c_str() const; ///< \deprecated
+    char const* data() const;
+    unsigned length() const;
+    bool isStaticString() const;
+
+  private:
+    void swap(CZString& other);
+
+    struct StringStorage {
+      unsigned policy_ : 2;
+      unsigned length_ : 30; // 1GB max
+    };
+
+    char const* cstr_; // actually, a prefixed string, unless policy is noDup
+    union {
+      ArrayIndex index_;
+      StringStorage storage_;
+    };
+  };
+
+public:
+  typedef std::map<CZString, Value> ObjectValues;
+#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
+
+public:
+  /**
+   * \brief Create a default Value of the given type.
+   *
+   * This is a very useful constructor.
+   * To create an empty array, pass arrayValue.
+   * To create an empty object, pass objectValue.
+   * Another Value can then be set to this one by assignment.
+   * This is useful since clear() and resize() will not alter types.
+   *
+   * Examples:
+   *   \code
+   *   Json::Value null_value; // null
+   *   Json::Value arr_value(Json::arrayValue); // []
+   *   Json::Value obj_value(Json::objectValue); // {}
+   *   \endcode
+   */
+  Value(ValueType type = nullValue);
+  Value(Int value);
+  Value(UInt value);
+#if defined(JSON_HAS_INT64)
+  Value(Int64 value);
+  Value(UInt64 value);
+#endif // if defined(JSON_HAS_INT64)
+  Value(double value);
+  Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.)
+  Value(const char* begin, const char* end); ///< Copy all, incl zeroes.
+  /**
+   * \brief Constructs a value from a static string.
+   *
+   * Like other value string constructor but do not duplicate the string for
+   * internal storage. The given string must remain alive after the call to
+   * this constructor.
+   *
+   * \note This works only for null-terminated strings. (We cannot change the
+   * size of this class, so we have nowhere to store the length, which might be
+   * computed later for various operations.)
+   *
+   * Example of usage:
+   *   \code
+   *   static StaticString foo("some text");
+   *   Json::Value aValue(foo);
+   *   \endcode
+   */
+  Value(const StaticString& value);
+  Value(const String& value);
+  Value(bool value);
+  Value(std::nullptr_t ptr) = delete;
+  Value(const Value& other);
+  Value(Value&& other) noexcept;
+  ~Value();
+
+  /// \note Overwrite existing comments. To preserve comments, use
+  /// #swapPayload().
+  Value& operator=(const Value& other);
+  Value& operator=(Value&& other) noexcept;
+
+  /// Swap everything.
+  void swap(Value& other);
+  /// Swap values but leave comments and source offsets in place.
+  void swapPayload(Value& other);
+
+  /// copy everything.
+  void copy(const Value& other);
+  /// copy values but leave comments and source offsets in place.
+  void copyPayload(const Value& other);
+
+  ValueType type() const;
+
+  /// Compare payload only, not comments etc.
+  bool operator<(const Value& other) const;
+  bool operator<=(const Value& other) const;
+  bool operator>=(const Value& other) const;
+  bool operator>(const Value& other) const;
+  bool operator==(const Value& other) const;
+  bool operator!=(const Value& other) const;
+  int compare(const Value& other) const;
+
+  const char* asCString() const; ///< Embedded zeroes could cause you trouble!
+#if JSONCPP_USE_SECURE_MEMORY
+  unsigned getCStringLength() const; // Allows you to understand the length of
+                                     // the CString
+#endif
+  String asString() const; ///< Embedded zeroes are possible.
+  /** Get raw char* of string-value.
+   *  \return false if !string. (Seg-fault if str or end are NULL.)
+   */
+  bool getString(char const** begin, char const** end) const;
+  Int asInt() const;
+  UInt asUInt() const;
+#if defined(JSON_HAS_INT64)
+  Int64 asInt64() const;
+  UInt64 asUInt64() const;
+#endif // if defined(JSON_HAS_INT64)
+  LargestInt asLargestInt() const;
+  LargestUInt asLargestUInt() const;
+  float asFloat() const;
+  double asDouble() const;
+  bool asBool() const;
+
+  bool isNull() const;
+  bool isBool() const;
+  bool isInt() const;
+  bool isInt64() const;
+  bool isUInt() const;
+  bool isUInt64() const;
+  bool isIntegral() const;
+  bool isDouble() const;
+  bool isNumeric() const;
+  bool isString() const;
+  bool isArray() const;
+  bool isObject() const;
+
+  /// The `as<T>` and `is<T>` member function templates and specializations.
+  template <typename T> T as() const JSONCPP_TEMPLATE_DELETE;
+  template <typename T> bool is() const JSONCPP_TEMPLATE_DELETE;
+
+  bool isConvertibleTo(ValueType other) const;
+
+  /// Number of values in array or object
+  ArrayIndex size() const;
+
+  /// \brief Return true if empty array, empty object, or null;
+  /// otherwise, false.
+  bool empty() const;
+
+  /// Return !isNull()
+  explicit operator bool() const;
+
+  /// Remove all object members and array elements.
+  /// \pre type() is arrayValue, objectValue, or nullValue
+  /// \post type() is unchanged
+  void clear();
+
+  /// Resize the array to newSize elements.
+  /// New elements are initialized to null.
+  /// May only be called on nullValue or arrayValue.
+  /// \pre type() is arrayValue or nullValue
+  /// \post type() is arrayValue
+  void resize(ArrayIndex newSize);
+
+  ///@{
+  /// Access an array element (zero based index). If the array contains less
+  /// than index element, then null value are inserted in the array so that
+  /// its size is index+1.
+  /// (You may need to say 'value[0u]' to get your compiler to distinguish
+  /// this from the operator[] which takes a string.)
+  Value& operator[](ArrayIndex index);
+  Value& operator[](int index);
+  ///@}
+
+  ///@{
+  /// Access an array element (zero based index).
+  /// (You may need to say 'value[0u]' to get your compiler to distinguish
+  /// this from the operator[] which takes a string.)
+  const Value& operator[](ArrayIndex index) const;
+  const Value& operator[](int index) const;
+  ///@}
+
+  /// If the array contains at least index+1 elements, returns the element
+  /// value, otherwise returns defaultValue.
+  Value get(ArrayIndex index, const Value& defaultValue) const;
+  /// Return true if index < size().
+  bool isValidIndex(ArrayIndex index) const;
+  /// \brief Append value to array at the end.
+  ///
+  /// Equivalent to jsonvalue[jsonvalue.size()] = value;
+  Value& append(const Value& value);
+  Value& append(Value&& value);
+
+  /// \brief Insert value in array at specific index
+  bool insert(ArrayIndex index, const Value& newValue);
+  bool insert(ArrayIndex index, Value&& newValue);
+
+  /// Access an object value by name, create a null member if it does not exist.
+  /// \note Because of our implementation, keys are limited to 2^30 -1 chars.
+  /// Exceeding that will cause an exception.
+  Value& operator[](const char* key);
+  /// Access an object value by name, returns null if there is no member with
+  /// that name.
+  const Value& operator[](const char* key) const;
+  /// Access an object value by name, create a null member if it does not exist.
+  /// \param key may contain embedded nulls.
+  Value& operator[](const String& key);
+  /// Access an object value by name, returns null if there is no member with
+  /// that name.
+  /// \param key may contain embedded nulls.
+  const Value& operator[](const String& key) const;
+  /** \brief Access an object value by name, create a null member if it does not
+   * exist.
+   *
+   * If the object has no entry for that name, then the member name used to
+   * store the new entry is not duplicated.
+   * Example of use:
+   *   \code
+   *   Json::Value object;
+   *   static const StaticString code("code");
+   *   object[code] = 1234;
+   *   \endcode
+   */
+  Value& operator[](const StaticString& key);
+  /// Return the member named key if it exist, defaultValue otherwise.
+  /// \note deep copy
+  Value get(const char* key, const Value& defaultValue) const;
+  /// Return the member named key if it exist, defaultValue otherwise.
+  /// \note deep copy
+  /// \note key may contain embedded nulls.
+  Value get(const char* begin, const char* end,
+            const Value& defaultValue) const;
+  /// Return the member named key if it exist, defaultValue otherwise.
+  /// \note deep copy
+  /// \param key may contain embedded nulls.
+  Value get(const String& key, const Value& defaultValue) const;
+  /// Most general and efficient version of isMember()const, get()const,
+  /// and operator[]const
+  /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
+  Value const* find(char const* begin, char const* end) const;
+  /// Most general and efficient version of isMember()const, get()const,
+  /// and operator[]const
+  Value const* find(const String& key) const;
+  /// Most general and efficient version of object-mutators.
+  /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
+  /// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue.
+  Value* demand(char const* begin, char const* end);
+  /// \brief Remove and return the named member.
+  ///
+  /// Do nothing if it did not exist.
+  /// \pre type() is objectValue or nullValue
+  /// \post type() is unchanged
+  void removeMember(const char* key);
+  /// Same as removeMember(const char*)
+  /// \param key may contain embedded nulls.
+  void removeMember(const String& key);
+  /// Same as removeMember(const char* begin, const char* end, Value* removed),
+  /// but 'key' is null-terminated.
+  bool removeMember(const char* key, Value* removed);
+  /** \brief Remove the named map member.
+   *
+   *  Update 'removed' iff removed.
+   *  \param key may contain embedded nulls.
+   *  \return true iff removed (no exceptions)
+   */
+  bool removeMember(String const& key, Value* removed);
+  /// Same as removeMember(String const& key, Value* removed)
+  bool removeMember(const char* begin, const char* end, Value* removed);
+  /** \brief Remove the indexed array element.
+   *
+   *  O(n) expensive operations.
+   *  Update 'removed' iff removed.
+   *  \return true if removed (no exceptions)
+   */
+  bool removeIndex(ArrayIndex index, Value* removed);
+
+  /// Return true if the object has a member named key.
+  /// \note 'key' must be null-terminated.
+  bool isMember(const char* key) const;
+  /// Return true if the object has a member named key.
+  /// \param key may contain embedded nulls.
+  bool isMember(const String& key) const;
+  /// Same as isMember(String const& key)const
+  bool isMember(const char* begin, const char* end) const;
+
+  /// \brief Return a list of the member names.
+  ///
+  /// If null, return an empty list.
+  /// \pre type() is objectValue or nullValue
+  /// \post if type() was nullValue, it remains nullValue
+  Members getMemberNames() const;
+
+  /// \deprecated Always pass len.
+  JSONCPP_DEPRECATED("Use setComment(String const&) instead.")
+  void setComment(const char* comment, CommentPlacement placement) {
+    setComment(String(comment, strlen(comment)), placement);
+  }
+  /// Comments must be //... or /* ... */
+  void setComment(const char* comment, size_t len, CommentPlacement placement) {
+    setComment(String(comment, len), placement);
+  }
+  /// Comments must be //... or /* ... */
+  void setComment(String comment, CommentPlacement placement);
+  bool hasComment(CommentPlacement placement) const;
+  /// Include delimiters and embedded newlines.
+  String getComment(CommentPlacement placement) const;
+
+  String toStyledString() const;
+
+  const_iterator begin() const;
+  const_iterator end() const;
+
+  iterator begin();
+  iterator end();
+
+  /// \brief Returns a reference to the first element in the `Value`.
+  /// Requires that this value holds an array or json object, with at least one
+  /// element.
+  const Value& front() const;
+
+  /// \brief Returns a reference to the first element in the `Value`.
+  /// Requires that this value holds an array or json object, with at least one
+  /// element.
+  Value& front();
+
+  /// \brief Returns a reference to the last element in the `Value`.
+  /// Requires that value holds an array or json object, with at least one
+  /// element.
+  const Value& back() const;
+
+  /// \brief Returns a reference to the last element in the `Value`.
+  /// Requires that this value holds an array or json object, with at least one
+  /// element.
+  Value& back();
+
+  // Accessors for the [start, limit) range of bytes within the JSON text from
+  // which this value was parsed, if any.
+  void setOffsetStart(ptrdiff_t start);
+  void setOffsetLimit(ptrdiff_t limit);
+  ptrdiff_t getOffsetStart() const;
+  ptrdiff_t getOffsetLimit() const;
+
+private:
+  void setType(ValueType v) {
+    bits_.value_type_ = static_cast<unsigned char>(v);
+  }
+  bool isAllocated() const { return bits_.allocated_; }
+  void setIsAllocated(bool v) { bits_.allocated_ = v; }
+
+  void initBasic(ValueType type, bool allocated = false);
+  void dupPayload(const Value& other);
+  void releasePayload();
+  void dupMeta(const Value& other);
+
+  Value& resolveReference(const char* key);
+  Value& resolveReference(const char* key, const char* end);
+
+  // struct MemberNamesTransform
+  //{
+  //   typedef const char *result_type;
+  //   const char *operator()( const CZString &name ) const
+  //   {
+  //      return name.c_str();
+  //   }
+  //};
+
+  union ValueHolder {
+    LargestInt int_;
+    LargestUInt uint_;
+    double real_;
+    bool bool_;
+    char* string_; // if allocated_, ptr to { unsigned, char[] }.
+    ObjectValues* map_;
+  } value_;
+
+  struct {
+    // Really a ValueType, but types should agree for bitfield packing.
+    unsigned int value_type_ : 8;
+    // Unless allocated_, string_ must be null-terminated.
+    unsigned int allocated_ : 1;
+  } bits_;
+
+  class Comments {
+  public:
+    Comments() = default;
+    Comments(const Comments& that);
+    Comments(Comments&& that) noexcept;
+    Comments& operator=(const Comments& that);
+    Comments& operator=(Comments&& that) noexcept;
+    bool has(CommentPlacement slot) const;
+    String get(CommentPlacement slot) const;
+    void set(CommentPlacement slot, String comment);
+
+  private:
+    using Array = std::array<String, numberOfCommentPlacement>;
+    std::unique_ptr<Array> ptr_;
+  };
+  Comments comments_;
+
+  // [start, limit) byte offsets in the source JSON text from which this Value
+  // was extracted.
+  ptrdiff_t start_;
+  ptrdiff_t limit_;
+};
+
+template <> inline bool Value::as<bool>() const { return asBool(); }
+template <> inline bool Value::is<bool>() const { return isBool(); }
+
+template <> inline Int Value::as<Int>() const { return asInt(); }
+template <> inline bool Value::is<Int>() const { return isInt(); }
+
+template <> inline UInt Value::as<UInt>() const { return asUInt(); }
+template <> inline bool Value::is<UInt>() const { return isUInt(); }
+
+#if defined(JSON_HAS_INT64)
+template <> inline Int64 Value::as<Int64>() const { return asInt64(); }
+template <> inline bool Value::is<Int64>() const { return isInt64(); }
+
+template <> inline UInt64 Value::as<UInt64>() const { return asUInt64(); }
+template <> inline bool Value::is<UInt64>() const { return isUInt64(); }
+#endif
+
+template <> inline double Value::as<double>() const { return asDouble(); }
+template <> inline bool Value::is<double>() const { return isDouble(); }
+
+template <> inline String Value::as<String>() const { return asString(); }
+template <> inline bool Value::is<String>() const { return isString(); }
+
+/// These `as` specializations are type conversions, and do not have a
+/// corresponding `is`.
+template <> inline float Value::as<float>() const { return asFloat(); }
+template <> inline const char* Value::as<const char*>() const {
+  return asCString();
+}
+
+/** \brief Experimental and untested: represents an element of the "path" to
+ * access a node.
+ */
+class JSON_API PathArgument {
+public:
+  friend class Path;
+
+  PathArgument();
+  PathArgument(ArrayIndex index);
+  PathArgument(const char* key);
+  PathArgument(String key);
+
+private:
+  enum Kind { kindNone = 0, kindIndex, kindKey };
+  String key_;
+  ArrayIndex index_{};
+  Kind kind_{kindNone};
+};
+
+/** \brief Experimental and untested: represents a "path" to access a node.
+ *
+ * Syntax:
+ * - "." => root node
+ * - ".[n]" => elements at index 'n' of root node (an array value)
+ * - ".name" => member named 'name' of root node (an object value)
+ * - ".name1.name2.name3"
+ * - ".[0][1][2].name1[3]"
+ * - ".%" => member name is provided as parameter
+ * - ".[%]" => index is provided as parameter
+ */
+class JSON_API Path {
+public:
+  Path(const String& path, const PathArgument& a1 = PathArgument(),
+       const PathArgument& a2 = PathArgument(),
+       const PathArgument& a3 = PathArgument(),
+       const PathArgument& a4 = PathArgument(),
+       const PathArgument& a5 = PathArgument());
+
+  const Value& resolve(const Value& root) const;
+  Value resolve(const Value& root, const Value& defaultValue) const;
+  /// Creates the "path" to access the specified node and returns a reference on
+  /// the node.
+  Value& make(Value& root) const;
+
+private:
+  using InArgs = std::vector<const PathArgument*>;
+  using Args = std::vector<PathArgument>;
+
+  void makePath(const String& path, const InArgs& in);
+  void addPathInArg(const String& path, const InArgs& in,
+                    InArgs::const_iterator& itInArg, PathArgument::Kind kind);
+  static void invalidPath(const String& path, int location);
+
+  Args args_;
+};
+
+/** \brief base class for Value iterators.
+ *
+ */
+class JSON_API ValueIteratorBase {
+public:
+  using iterator_category = std::bidirectional_iterator_tag;
+  using size_t = unsigned int;
+  using difference_type = int;
+  using SelfType = ValueIteratorBase;
+
+  bool operator==(const SelfType& other) const { return isEqual(other); }
+
+  bool operator!=(const SelfType& other) const { return !isEqual(other); }
+
+  difference_type operator-(const SelfType& other) const {
+    return other.computeDistance(*this);
+  }
+
+  /// Return either the index or the member name of the referenced value as a
+  /// Value.
+  Value key() const;
+
+  /// Return the index of the referenced Value, or -1 if it is not an
+  /// arrayValue.
+  UInt index() const;
+
+  /// Return the member name of the referenced Value, or "" if it is not an
+  /// objectValue.
+  /// \note Avoid `c_str()` on result, as embedded zeroes are possible.
+  String name() const;
+
+  /// Return the member name of the referenced Value. "" if it is not an
+  /// objectValue.
+  /// \deprecated This cannot be used for UTF-8 strings, since there can be
+  /// embedded nulls.
+  JSONCPP_DEPRECATED("Use `key = name();` instead.")
+  char const* memberName() const;
+  /// Return the member name of the referenced Value, or NULL if it is not an
+  /// objectValue.
+  /// \note Better version than memberName(). Allows embedded nulls.
+  char const* memberName(char const** end) const;
+
+protected:
+  /*! Internal utility functions to assist with implementing
+   *   other iterator functions. The const and non-const versions
+   *   of the "deref" protected methods expose the protected
+   *   current_ member variable in a way that can often be
+   *   optimized away by the compiler.
+   */
+  const Value& deref() const;
+  Value& deref();
+
+  void increment();
+
+  void decrement();
+
+  difference_type computeDistance(const SelfType& other) const;
+
+  bool isEqual(const SelfType& other) const;
+
+  void copy(const SelfType& other);
+
+private:
+  Value::ObjectValues::iterator current_;
+  // Indicates that iterator is for a null value.
+  bool isNull_{true};
+
+public:
+  // For some reason, BORLAND needs these at the end, rather
+  // than earlier. No idea why.
+  ValueIteratorBase();
+  explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
+};
+
+/** \brief const iterator for object and array value.
+ *
+ */
+class JSON_API ValueConstIterator : public ValueIteratorBase {
+  friend class Value;
+
+public:
+  using value_type = const Value;
+  // typedef unsigned int size_t;
+  // typedef int difference_type;
+  using reference = const Value&;
+  using pointer = const Value*;
+  using SelfType = ValueConstIterator;
+
+  ValueConstIterator();
+  ValueConstIterator(ValueIterator const& other);
+
+private:
+  /*! \internal Use by Value to create an iterator.
+   */
+  explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
+
+public:
+  SelfType& operator=(const ValueIteratorBase& other);
+
+  SelfType operator++(int) {
+    SelfType temp(*this);
+    ++*this;
+    return temp;
+  }
+
+  SelfType operator--(int) {
+    SelfType temp(*this);
+    --*this;
+    return temp;
+  }
+
+  SelfType& operator--() {
+    decrement();
+    return *this;
+  }
+
+  SelfType& operator++() {
+    increment();
+    return *this;
+  }
+
+  reference operator*() const { return deref(); }
+
+  pointer operator->() const { return &deref(); }
+};
+
+/** \brief Iterator for object and array value.
+ */
+class JSON_API ValueIterator : public ValueIteratorBase {
+  friend class Value;
+
+public:
+  using value_type = Value;
+  using size_t = unsigned int;
+  using difference_type = int;
+  using reference = Value&;
+  using pointer = Value*;
+  using SelfType = ValueIterator;
+
+  ValueIterator();
+  explicit ValueIterator(const ValueConstIterator& other);
+  ValueIterator(const ValueIterator& other);
+
+private:
+  /*! \internal Use by Value to create an iterator.
+   */
+  explicit ValueIterator(const Value::ObjectValues::iterator& current);
+
+public:
+  SelfType& operator=(const SelfType& other);
+
+  SelfType operator++(int) {
+    SelfType temp(*this);
+    ++*this;
+    return temp;
+  }
+
+  SelfType operator--(int) {
+    SelfType temp(*this);
+    --*this;
+    return temp;
+  }
+
+  SelfType& operator--() {
+    decrement();
+    return *this;
+  }
+
+  SelfType& operator++() {
+    increment();
+    return *this;
+  }
+
+  /*! The return value of non-const iterators can be
+   *  changed, so the these functions are not const
+   *  because the returned references/pointers can be used
+   *  to change state of the base class.
+   */
+  reference operator*() const { return const_cast<reference>(deref()); }
+  pointer operator->() const { return const_cast<pointer>(&deref()); }
+};
+
+inline void swap(Value& a, Value& b) { a.swap(b); }
+
+inline const Value& Value::front() const { return *begin(); }
+
+inline Value& Value::front() { return *begin(); }
+
+inline const Value& Value::back() const { return *(--end()); }
+
+inline Value& Value::back() { return *(--end()); }
+
+} // namespace Json
+
+#pragma pack(pop)
+
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+#pragma warning(pop)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+#endif // JSON_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/version.h b/Lib/JsoncppSDK/include/version.h
new file mode 100644
index 0000000..42e8780
--- /dev/null
+++ b/Lib/JsoncppSDK/include/version.h
@@ -0,0 +1,27 @@
+#ifndef JSON_VERSION_H_INCLUDED
+#define JSON_VERSION_H_INCLUDED
+
+// Note: version must be updated in three places when doing a release. This
+// annoying process ensures that amalgamate, CMake, and meson all report the
+// correct version.
+// 1. /meson.build
+// 2. /include/json/version.h
+// 3. /CMakeLists.txt
+// IMPORTANT: also update the SOVERSION!!
+
+#define JSONCPP_VERSION_STRING "1.9.7"
+#define JSONCPP_VERSION_MAJOR 1
+#define JSONCPP_VERSION_MINOR 9
+#define JSONCPP_VERSION_PATCH 7
+#define JSONCPP_VERSION_QUALIFIER
+#define JSONCPP_VERSION_HEXA                                                   \
+  ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) |             \
+   (JSONCPP_VERSION_PATCH << 8))
+
+#if !defined(JSONCPP_USE_SECURE_MEMORY)
+#define JSONCPP_USE_SECURE_MEMORY 0
+#endif
+// If non-zero, the library zeroes any memory that it has allocated before
+// it frees its memory.
+
+#endif // JSON_VERSION_H_INCLUDED
diff --git a/Lib/JsoncppSDK/include/writer.h b/Lib/JsoncppSDK/include/writer.h
new file mode 100644
index 0000000..7c56a21
--- /dev/null
+++ b/Lib/JsoncppSDK/include/writer.h
@@ -0,0 +1,368 @@
+// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
+// Distributed under MIT license, or public domain if desired and
+// recognized in your jurisdiction.
+// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+
+#ifndef JSON_WRITER_H_INCLUDED
+#define JSON_WRITER_H_INCLUDED
+
+#if !defined(JSON_IS_AMALGAMATION)
+#include "value.h"
+#endif // if !defined(JSON_IS_AMALGAMATION)
+#include <ostream>
+#include <string>
+#include <vector>
+
+// Disable warning C4251: <data member>: <type> needs to have dll-interface to
+// be used by...
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) && defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4251)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+#pragma pack(push)
+#pragma pack()
+
+namespace Json {
+
+class Value;
+
+/**
+ *
+ * Usage:
+ *  \code
+ *  using namespace Json;
+ *  void writeToStdout(StreamWriter::Factory const& factory, Value const& value)
+ * { std::unique_ptr<StreamWriter> const writer( factory.newStreamWriter());
+ *    writer->write(value, &std::cout);
+ *    std::cout << std::endl;  // add lf and flush
+ *  }
+ *  \endcode
+ */
+class JSON_API StreamWriter {
+protected:
+  OStream* sout_; // not owned; will not delete
+public:
+  StreamWriter();
+  virtual ~StreamWriter();
+  /** Write Value into document as configured in sub-class.
+   *   Do not take ownership of sout, but maintain a reference during function.
+   *   \pre sout != NULL
+   *   \return zero on success (For now, we always return zero, so check the
+   *   stream instead.) \throw std::exception possibly, depending on
+   * configuration
+   */
+  virtual int write(Value const& root, OStream* sout) = 0;
+
+  /** \brief A simple abstract factory.
+   */
+  class JSON_API Factory {
+  public:
+    virtual ~Factory();
+    /** \brief Allocate a CharReader via operator new().
+     * \throw std::exception if something goes wrong (e.g. invalid settings)
+     */
+    virtual StreamWriter* newStreamWriter() const = 0;
+  }; // Factory
+}; // StreamWriter
+
+/** \brief Write into stringstream, then return string, for convenience.
+ * A StreamWriter will be created from the factory, used, and then deleted.
+ */
+String JSON_API writeString(StreamWriter::Factory const& factory,
+                            Value const& root);
+
+/** \brief Build a StreamWriter implementation.
+
+* Usage:
+*   \code
+*   using namespace Json;
+*   Value value = ...;
+*   StreamWriterBuilder builder;
+*   builder["commentStyle"] = "None";
+*   builder["indentation"] = "   ";  // or whatever you like
+*   std::unique_ptr<Json::StreamWriter> writer(
+*      builder.newStreamWriter());
+*   writer->write(value, &std::cout);
+*   std::cout << std::endl;  // add lf and flush
+*   \endcode
+*/
+class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
+public:
+  // Note: We use a Json::Value so that we can add data-members to this class
+  // without a major version bump.
+  /** Configuration of this builder.
+   *  Available settings (case-sensitive):
+   *  - "commentStyle": "None" or "All"
+   *  - "indentation":  "<anything>".
+   *  - Setting this to an empty string also omits newline characters.
+   *  - "enableYAMLCompatibility": false or true
+   *  - slightly change the whitespace around colons
+   *  - "dropNullPlaceholders": false or true
+   *  - Drop the "null" string from the writer's output for nullValues.
+   *    Strictly speaking, this is not valid JSON. But when the output is being
+   *    fed to a browser's JavaScript, it makes for smaller output and the
+   *    browser can handle the output just fine.
+   *  - "useSpecialFloats": false or true
+   *  - If true, outputs non-finite floating point values in the following way:
+   *    NaN values as "NaN", positive infinity as "Infinity", and negative
+   *  infinity as "-Infinity".
+   *  - "precision": int
+   *  - Number of precision digits for formatting of real values.
+   *  - "precisionType": "significant"(default) or "decimal"
+   *  - Type of precision for formatting of real values.
+   *  - "emitUTF8": false or true
+   *  - If true, outputs raw UTF8 strings instead of escaping them.
+
+   *  You can examine 'settings_` yourself
+   *  to see the defaults. You can also write and read them just like any
+   *  JSON Value.
+   *  \sa setDefaults()
+   */
+  Json::Value settings_;
+
+  StreamWriterBuilder();
+  ~StreamWriterBuilder() override;
+
+  /**
+   * \throw std::exception if something goes wrong (e.g. invalid settings)
+   */
+  StreamWriter* newStreamWriter() const override;
+
+  /** \return true if 'settings' are legal and consistent;
+   *   otherwise, indicate bad settings via 'invalid'.
+   */
+  bool validate(Json::Value* invalid) const;
+  /** A simple way to update a specific setting.
+   */
+  Value& operator[](const String& key);
+
+  /** Called by ctor, but you can use this to reset settings_.
+   * \pre 'settings' != NULL (but Json::null is fine)
+   * \remark Defaults:
+   * \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults
+   */
+  static void setDefaults(Json::Value* settings);
+};
+
+/** \brief Abstract class for writers.
+ * \deprecated Use StreamWriter. (And really, this is an implementation detail.)
+ */
+class JSON_API Writer {
+public:
+  virtual ~Writer();
+
+  virtual String write(const Value& root) = 0;
+};
+
+/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
+ *without formatting (not human friendly).
+ *
+ * The JSON document is written in a single line. It is not intended for 'human'
+ *consumption,
+ * but may be useful to support feature such as RPC where bandwidth is limited.
+ * \sa Reader, Value
+ * \deprecated Use StreamWriterBuilder.
+ */
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4996) // Deriving from deprecated class
+#endif
+class JSON_API FastWriter : public Writer {
+public:
+  FastWriter();
+  ~FastWriter() override = default;
+
+  void enableYAMLCompatibility();
+
+  /** \brief Drop the "null" string from the writer's output for nullValues.
+   * Strictly speaking, this is not valid JSON. But when the output is being
+   * fed to a browser's JavaScript, it makes for smaller output and the
+   * browser can handle the output just fine.
+   */
+  void dropNullPlaceholders();
+
+  void omitEndingLineFeed();
+
+public: // overridden from Writer
+  String write(const Value& root) override;
+
+private:
+  void writeValue(const Value& value);
+
+  String document_;
+  bool yamlCompatibilityEnabled_{false};
+  bool dropNullPlaceholders_{false};
+  bool omitEndingLineFeed_{false};
+};
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
+ *human friendly way.
+ *
+ * The rules for line break and indent are as follow:
+ * - Object value:
+ *     - if empty then print {} without indent and line break
+ *     - if not empty the print '{', line break & indent, print one value per
+ *line
+ *       and then unindent and line break and print '}'.
+ * - Array value:
+ *     - if empty then print [] without indent and line break
+ *     - if the array contains no object value, empty array or some other value
+ *types,
+ *       and all the values fit on one lines, then print the array on a single
+ *line.
+ *     - otherwise, it the values do not fit on one line, or the array contains
+ *       object or non empty array, then print one value per line.
+ *
+ * If the Value have comments then they are outputted according to their
+ *#CommentPlacement.
+ *
+ * \sa Reader, Value, Value::setComment()
+ * \deprecated Use StreamWriterBuilder.
+ */
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4996) // Deriving from deprecated class
+#endif
+class JSON_API StyledWriter : public Writer {
+public:
+  StyledWriter();
+  ~StyledWriter() override = default;
+
+public: // overridden from Writer
+  /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
+   * \param root Value to serialize.
+   * \return String containing the JSON document that represents the root value.
+   */
+  String write(const Value& root) override;
+
+private:
+  void writeValue(const Value& value);
+  void writeArrayValue(const Value& value);
+  bool isMultilineArray(const Value& value);
+  void pushValue(const String& value);
+  void writeIndent();
+  void writeWithIndent(const String& value);
+  void indent();
+  void unindent();
+  void writeCommentBeforeValue(const Value& root);
+  void writeCommentAfterValueOnSameLine(const Value& root);
+  static bool hasCommentForValue(const Value& value);
+  static String normalizeEOL(const String& text);
+
+  using ChildValues = std::vector<String>;
+
+  ChildValues childValues_;
+  String document_;
+  String indentString_;
+  unsigned int rightMargin_{74};
+  unsigned int indentSize_{3};
+  bool addChildValues_{false};
+};
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
+ human friendly way,
+     to a stream rather than to a string.
+ *
+ * The rules for line break and indent are as follow:
+ * - Object value:
+ *     - if empty then print {} without indent and line break
+ *     - if not empty the print '{', line break & indent, print one value per
+ line
+ *       and then unindent and line break and print '}'.
+ * - Array value:
+ *     - if empty then print [] without indent and line break
+ *     - if the array contains no object value, empty array or some other value
+ types,
+ *       and all the values fit on one lines, then print the array on a single
+ line.
+ *     - otherwise, it the values do not fit on one line, or the array contains
+ *       object or non empty array, then print one value per line.
+ *
+ * If the Value have comments then they are outputted according to their
+ #CommentPlacement.
+ *
+ * \sa Reader, Value, Value::setComment()
+ * \deprecated Use StreamWriterBuilder.
+ */
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4996) // Deriving from deprecated class
+#endif
+class JSON_API StyledStreamWriter {
+public:
+  /**
+   * \param indentation Each level will be indented by this amount extra.
+   */
+  StyledStreamWriter(String indentation = "\t");
+  ~StyledStreamWriter() = default;
+
+public:
+  /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
+   * \param out Stream to write to. (Can be ostringstream, e.g.)
+   * \param root Value to serialize.
+   * \note There is no point in deriving from Writer, since write() should not
+   * return a value.
+   */
+  void write(OStream& out, const Value& root);
+
+private:
+  void writeValue(const Value& value);
+  void writeArrayValue(const Value& value);
+  bool isMultilineArray(const Value& value);
+  void pushValue(const String& value);
+  void writeIndent();
+  void writeWithIndent(const String& value);
+  void indent();
+  void unindent();
+  void writeCommentBeforeValue(const Value& root);
+  void writeCommentAfterValueOnSameLine(const Value& root);
+  static bool hasCommentForValue(const Value& value);
+  static String normalizeEOL(const String& text);
+
+  using ChildValues = std::vector<String>;
+
+  ChildValues childValues_;
+  OStream* document_;
+  String indentString_;
+  unsigned int rightMargin_{74};
+  String indentation_;
+  bool addChildValues_ : 1;
+  bool indented_ : 1;
+};
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+#if defined(JSON_HAS_INT64)
+String JSON_API valueToString(Int value);
+String JSON_API valueToString(UInt value);
+#endif // if defined(JSON_HAS_INT64)
+String JSON_API valueToString(LargestInt value);
+String JSON_API valueToString(LargestUInt value);
+String JSON_API valueToString(
+    double value, unsigned int precision = Value::defaultRealPrecision,
+    PrecisionType precisionType = PrecisionType::significantDigits);
+String JSON_API valueToString(bool value);
+String JSON_API valueToQuotedString(const char* value);
+String JSON_API valueToQuotedString(const char* value, size_t length);
+
+/// \brief Output using the StyledStreamWriter.
+/// \see Json::operator>>()
+JSON_API OStream& operator<<(OStream&, const Value& root);
+
+} // namespace Json
+
+#pragma pack(pop)
+
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+#pragma warning(pop)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+#endif // JSON_WRITER_H_INCLUDED
diff --git a/Lib/LogSDK/include/IDayLog.h b/Lib/LogSDK/include/IDayLog.h
new file mode 100644
index 0000000..e57188e
--- /dev/null
+++ b/Lib/LogSDK/include/IDayLog.h
@@ -0,0 +1,47 @@
+/**************************************************************************************************
+		Copyright 2020-2022 XXX XXX XXX
+		All rights reserved.
+
+		Author: zhenbin,jiang
+		Date: 2023-12-12
+		Version: V1.0.0
+
+		Description:
+				本模块输出日常运行日志
+***************************************************************************************************/
+#ifndef I_DAY_LOG_H
+#define I_DAY_LOG_H
+
+#include <afxwin.h>
+
+//打印日志信息
+typedef enum LOG_TYPE {
+	LOG_EOR = -1,
+	LOG_WARN,
+	LOG_SYSTEM,
+	LOG_CHAMBER,
+	LOG_RF,
+	LOG_GASBOX,
+	LOG_ESC,
+	LOG_SESC
+}LOG_TYPE;
+
+class IDayLog
+{
+public:
+	virtual ~IDayLog() {};
+
+	//1. 设置目录
+	virtual void setDir(const char *pszDir) = 0;
+
+	//2. 创建日志
+	virtual int createLogFile(void) = 0;
+
+	//3. 打印数据 
+	virtual void log(LOG_TYPE code, const char* pszText, const char* pszSuffix) = 0;
+
+	//4. 设置打印日志控件
+	virtual void setWnd(CWnd *pWnd) = 0;
+};
+
+#endif
diff --git a/Lib/LogSDK/include/ILogger.h b/Lib/LogSDK/include/ILogger.h
new file mode 100644
index 0000000..13515f8
--- /dev/null
+++ b/Lib/LogSDK/include/ILogger.h
@@ -0,0 +1,45 @@
+/**************************************************************************************************
+		Copyright 2020-2022 XXX XXX XXX
+		All rights reserved.
+
+		Author: zhenbin,jiang
+		Date: 2020-06-20
+		Version: V1.0.0
+
+		Description:
+				本模块主要是日志模块
+***************************************************************************************************/
+#ifndef I_LOGGER_H
+#define I_LOGGER_H
+
+#include <string>
+
+//日志级别枚举
+typedef enum EnumLogLevel
+{
+	LogLevel_Stop = 0,	//什么都不记录
+	LogLevel_Fatal,		//只记录严重错误
+	LogLevel_Error,		//记录严重错误,普通错误
+	LogLevel_Warning,	//记录严重错误,普通错误,警告
+	LogLevel_Info		//记录严重错误,普通错误,警告,提示信息(也就是全部记录)
+}EnumLogLevel;
+
+//日志模块的头文件
+class ILogger
+{
+public:
+	//1. 写严重错误信息
+	virtual void TraceFatal(const char *lpcszFormat, ...) = 0;
+	//2. 写错误信息
+	virtual void TraceError(const char *lpcszFormat, ...) = 0;
+	//3. 写警告信息
+	virtual void TraceWarning(const char *lpcszFormat, ...) = 0;
+	//4. 写提示信息
+	virtual void TraceInfo(const char *lpcszFormat, ...) = 0;
+	//5. 改变写日志级别
+	virtual void ChangeLogLevel(EnumLogLevel nLevel) = 0;
+	//6. 写日常信息
+	virtual std::string Log(const char* pszHeader, const char *pszSuffix, const char* pszText) = 0;
+};
+
+#endif
diff --git a/Lib/LogSDK/include/LogLib.h b/Lib/LogSDK/include/LogLib.h
new file mode 100644
index 0000000..8de4f61
--- /dev/null
+++ b/Lib/LogSDK/include/LogLib.h
@@ -0,0 +1,39 @@
+/**************************************************************************************************
+		Copyright 2020-2022 XXX XXX XXX
+		All rights reserved.
+
+		Author: zhenbin,jiang
+		Date: 2020-06-20
+		Version: V1.0.0
+
+		Description:
+			本模块输出日志模块的接口函数
+***************************************************************************************************/
+#ifndef LOG_LIB_H
+#define LOG_LIB_H
+
+#include "ILogger.h"
+#include "IDayLog.h"
+
+#ifdef EXPORT_DLL_LOG
+#define EXPORTED_LOG _declspec(dllexport)
+#else
+#define EXPORTED_LOG _declspec(dllimport)
+#endif
+
+//0. 获取当前的版本
+extern "C" EXPORTED_LOG int Log_GetVersion(char* pszBuffer, const int nBufferSize);
+//1. 创建日志
+extern "C" EXPORTED_LOG ILogger* Log_Create(EnumLogLevel nLogLevel, const char* szPath, const char* szName);
+//2. 释放日志
+extern "C" EXPORTED_LOG void Log_Free(ILogger *pLogger);
+//3. 获取错误日志
+extern "C" EXPORTED_LOG ILogger* Log_GetError(void);
+//4. 获取调试日志
+extern "C" EXPORTED_LOG ILogger* Log_GetDebug(void);
+//5. 输出日志文件
+extern "C" EXPORTED_LOG int Log_Dmp(int code);
+//6. 获取daylog
+extern "C" EXPORTED_LOG IDayLog* Log_GetDayLog(void);
+
+#endif
diff --git a/Lib/Matrox/Include/MILDyn/PFNC.h b/Lib/Matrox/Include/MILDyn/PFNC.h
new file mode 100644
index 0000000..1960d34
--- /dev/null
+++ b/Lib/Matrox/Include/MILDyn/PFNC.h
@@ -0,0 +1,1183 @@
+锘�/**************************************************************************************************************
+ * This file was automatically generated by tools designed and maintained by Leutron Vision, Matrox, Groget, MVTec Software.
+ * Copyright (C) 2007-2018 Leutron Vision, Matrox, Groget, MVTec Software.
+ * You can freely use and modify the file without restrictions.
+ * The file is provided as is, without any warranty. Bug reports and other feedback is appreciated.
+ **************************************************************************************************************
+ *
+ * Revision     :  10.41.2936
+ *
+ **************************************************************************************************************
+ * Version and date information:
+ * PFNC value list release date: 2019-02-19
+ * Header generator version: 3.5
+ * Header generation date: 2019-11-07
+ **************************************************************************************************************/
+
+ // ===> Note: unofficial and using a new PFNC_PIXEL_SIZE(X) macro to compensate for bad PFNC R10, G10, B10, R12, G12, B12 values.
+
+#ifndef PFNC_H
+#define PFNC_H
+
+#define PFNC_Mono1p                              0x01010037 /* Monochrome 1-bit packed */
+#define PFNC_Mono2p                              0x01020038 /* Monochrome 2-bit packed */
+#define PFNC_Mono4p                              0x01040039 /* Monochrome 4-bit packed */
+#define PFNC_Mono8                               0x01080001 /* Monochrome 8-bit */
+#define PFNC_Mono8s                              0x01080002 /* Monochrome 8-bit signed */
+#define PFNC_Mono10                              0x01100003 /* Monochrome 10-bit unpacked */
+#define PFNC_Mono10p                             0x010A0046 /* Monochrome 10-bit packed */
+#define PFNC_Mono12                              0x01100005 /* Monochrome 12-bit unpacked */
+#define PFNC_Mono12p                             0x010C0047 /* Monochrome 12-bit packed */
+#define PFNC_Mono14                              0x01100025 /* Monochrome 14-bit unpacked */
+#define PFNC_Mono14p                             0x010E0104 /* Monochrome 14-bit packed */
+#define PFNC_Mono16                              0x01100007 /* Monochrome 16-bit */
+#define PFNC_Mono32                              0x01200111 /* Monochrome 32-bit */
+#define PFNC_BayerBG4p                           0x01040110 /* Bayer Blue-Green 4-bit packed */
+#define PFNC_BayerBG8                            0x0108000B /* Bayer Blue-Green 8-bit */
+#define PFNC_BayerBG10                           0x0110000F /* Bayer Blue-Green 10-bit unpacked */
+#define PFNC_BayerBG10p                          0x010A0052 /* Bayer Blue-Green 10-bit packed */
+#define PFNC_BayerBG12                           0x01100013 /* Bayer Blue-Green 12-bit unpacked */
+#define PFNC_BayerBG12p                          0x010C0053 /* Bayer Blue-Green 12-bit packed */
+#define PFNC_BayerBG14                           0x0110010C /* Bayer Blue-Green 14-bit */
+#define PFNC_BayerBG14p                          0x010E0108 /* Bayer Blue-Green 14-bit packed */
+#define PFNC_BayerBG16                           0x01100031 /* Bayer Blue-Green 16-bit */
+#define PFNC_BayerGB4p                           0x0104010F /* Bayer Green-Blue 4-bit packed */
+#define PFNC_BayerGB8                            0x0108000A /* Bayer Green-Blue 8-bit */
+#define PFNC_BayerGB10                           0x0110000E /* Bayer Green-Blue 10-bit unpacked */
+#define PFNC_BayerGB10p                          0x010A0054 /* Bayer Green-Blue 10-bit packed */
+#define PFNC_BayerGB12                           0x01100012 /* Bayer Green-Blue 12-bit unpacked */
+#define PFNC_BayerGB12p                          0x010C0055 /* Bayer Green-Blue 12-bit packed */
+#define PFNC_BayerGB14                           0x0110010B /* Bayer Green-Blue 14-bit */
+#define PFNC_BayerGB14p                          0x010E0107 /* Bayer Green-Blue 14-bit packed */
+#define PFNC_BayerGB16                           0x01100030 /* Bayer Green-Blue 16-bit */
+#define PFNC_BayerGR4p                           0x0104010D /* Bayer Green-Red 4-bit packed */
+#define PFNC_BayerGR8                            0x01080008 /* Bayer Green-Red 8-bit */
+#define PFNC_BayerGR10                           0x0110000C /* Bayer Green-Red 10-bit unpacked */
+#define PFNC_BayerGR10p                          0x010A0056 /* Bayer Green-Red 10-bit packed */
+#define PFNC_BayerGR12                           0x01100010 /* Bayer Green-Red 12-bit unpacked */
+#define PFNC_BayerGR12p                          0x010C0057 /* Bayer Green-Red 12-bit packed */
+#define PFNC_BayerGR14                           0x01100109 /* Bayer Green-Red 14-bit */
+#define PFNC_BayerGR14p                          0x010E0105 /* Bayer Green-Red 14-bit packed */
+#define PFNC_BayerGR16                           0x0110002E /* Bayer Green-Red 16-bit */
+#define PFNC_BayerRG4p                           0x0104010E /* Bayer Red-Green 4-bit packed */
+#define PFNC_BayerRG8                            0x01080009 /* Bayer Red-Green 8-bit */
+#define PFNC_BayerRG10                           0x0110000D /* Bayer Red-Green 10-bit unpacked */
+#define PFNC_BayerRG10p                          0x010A0058 /* Bayer Red-Green 10-bit packed */
+#define PFNC_BayerRG12                           0x01100011 /* Bayer Red-Green 12-bit unpacked */
+#define PFNC_BayerRG12p                          0x010C0059 /* Bayer Red-Green 12-bit packed */
+#define PFNC_BayerRG14                           0x0110010A /* Bayer Red-Green 14-bit */
+#define PFNC_BayerRG14p                          0x010E0106 /* Bayer Red-Green 14-bit packed */
+#define PFNC_BayerRG16                           0x0110002F /* Bayer Red-Green 16-bit */
+#define PFNC_RGBa8                               0x02200016 /* Red-Green-Blue-alpha 8-bit */
+#define PFNC_RGBa10                              0x0240005F /* Red-Green-Blue-alpha 10-bit unpacked */
+#define PFNC_RGBa10p                             0x02280060 /* Red-Green-Blue-alpha 10-bit packed */
+#define PFNC_RGBa12                              0x02400061 /* Red-Green-Blue-alpha 12-bit unpacked */
+#define PFNC_RGBa12p                             0x02300062 /* Red-Green-Blue-alpha 12-bit packed */
+#define PFNC_RGBa14                              0x02400063 /* Red-Green-Blue-alpha 14-bit unpacked */
+#define PFNC_RGBa16                              0x02400064 /* Red-Green-Blue-alpha 16-bit */
+#define PFNC_RGB8                                0x02180014 /* Red-Green-Blue 8-bit */
+#define PFNC_RGB8_Planar                         0x02180021 /* Red-Green-Blue 8-bit planar */
+#define PFNC_RGB10                               0x02300018 /* Red-Green-Blue 10-bit unpacked */
+#define PFNC_RGB10_Planar                        0x02300022 /* Red-Green-Blue 10-bit unpacked planar */
+#define PFNC_RGB10p                              0x021E005C /* Red-Green-Blue 10-bit packed */
+#define PFNC_RGB10p32                            0x0220001D /* Red-Green-Blue 10-bit packed into 32-bit */
+#define PFNC_RGB12                               0x0230001A /* Red-Green-Blue 12-bit unpacked */
+#define PFNC_RGB12_Planar                        0x02300023 /* Red-Green-Blue 12-bit unpacked planar */
+#define PFNC_RGB12p                              0x0224005D /* Red-Green-Blue 12-bit packed */
+#define PFNC_RGB14                               0x0230005E /* Red-Green-Blue 14-bit unpacked */
+#define PFNC_RGB16                               0x02300033 /* Red-Green-Blue 16-bit */
+#define PFNC_RGB16_Planar                        0x02300024 /* Red-Green-Blue 16-bit planar */
+#define PFNC_RGB565p                             0x02100035 /* Red-Green-Blue 5/6/5-bit packed */
+#define PFNC_BGRa8                               0x02200017 /* Blue-Green-Red-alpha 8-bit */
+#define PFNC_BGRa10                              0x0240004C /* Blue-Green-Red-alpha 10-bit unpacked */
+#define PFNC_BGRa10p                             0x0228004D /* Blue-Green-Red-alpha 10-bit packed */
+#define PFNC_BGRa12                              0x0240004E /* Blue-Green-Red-alpha 12-bit unpacked */
+#define PFNC_BGRa12p                             0x0230004F /* Blue-Green-Red-alpha 12-bit packed */
+#define PFNC_BGRa14                              0x02400050 /* Blue-Green-Red-alpha 14-bit unpacked */
+#define PFNC_BGRa16                              0x02400051 /* Blue-Green-Red-alpha 16-bit */
+#define PFNC_BGR8                                0x02180015 /* Blue-Green-Red 8-bit */
+#define PFNC_BGR10                               0x02300019 /* Blue-Green-Red 10-bit unpacked */
+#define PFNC_BGR10p                              0x021E0048 /* Blue-Green-Red 10-bit packed */
+#define PFNC_BGR12                               0x0230001B /* Blue-Green-Red 12-bit unpacked */
+#define PFNC_BGR12p                              0x02240049 /* Blue-Green-Red 12-bit packed */
+#define PFNC_BGR14                               0x0230004A /* Blue-Green-Red 14-bit unpacked */
+#define PFNC_BGR16                               0x0230004B /* Blue-Green-Red 16-bit */
+#define PFNC_BGR565p                             0x02100036 /* Blue-Green-Red 5/6/5-bit packed */
+#define PFNC_R8                                  0x010800C9 /* Red 8-bit */
+#define PFNC_R10                                 0x010A00CA /* Red 10-bit */
+#define PFNC_R12                                 0x010C00CB /* Red 12-bit */
+#define PFNC_R16                                 0x011000CC /* Red 16-bit */
+#define PFNC_G8                                  0x010800CD /* Green 8-bit */
+#define PFNC_G10                                 0x010A00CE /* Green 10-bit */
+#define PFNC_G12                                 0x010C00CF /* Green 12-bit */
+#define PFNC_G16                                 0x011000D0 /* Green 16-bit */
+#define PFNC_B8                                  0x010800D1 /* Blue 8-bit */
+#define PFNC_B10                                 0x010A00D2 /* Blue 10-bit */
+#define PFNC_B12                                 0x010C00D3 /* Blue 12-bit */
+#define PFNC_B16                                 0x011000D4 /* Blue 16-bit */
+#define PFNC_Coord3D_ABC8                        0x021800B2 /* 3D coordinate A-B-C 8-bit */
+#define PFNC_Coord3D_ABC8_Planar                 0x021800B3 /* 3D coordinate A-B-C 8-bit planar */
+#define PFNC_Coord3D_ABC10p                      0x021E00DB /* 3D coordinate A-B-C 10-bit packed */
+#define PFNC_Coord3D_ABC10p_Planar               0x021E00DC /* 3D coordinate A-B-C 10-bit packed planar */
+#define PFNC_Coord3D_ABC12p                      0x022400DE /* 3D coordinate A-B-C 12-bit packed */
+#define PFNC_Coord3D_ABC12p_Planar               0x022400DF /* 3D coordinate A-B-C 12-bit packed planar */
+#define PFNC_Coord3D_ABC16                       0x023000B9 /* 3D coordinate A-B-C 16-bit */
+#define PFNC_Coord3D_ABC16_Planar                0x023000BA /* 3D coordinate A-B-C 16-bit planar */
+#define PFNC_Coord3D_ABC32f                      0x026000C0 /* 3D coordinate A-B-C 32-bit floating point */
+#define PFNC_Coord3D_ABC32f_Planar               0x026000C1 /* 3D coordinate A-B-C 32-bit floating point planar */
+#define PFNC_Coord3D_AC8                         0x021000B4 /* 3D coordinate A-C 8-bit */
+#define PFNC_Coord3D_AC8_Planar                  0x021000B5 /* 3D coordinate A-C 8-bit planar */
+#define PFNC_Coord3D_AC10p                       0x021400F0 /* 3D coordinate A-C 10-bit packed */
+#define PFNC_Coord3D_AC10p_Planar                0x021400F1 /* 3D coordinate A-C 10-bit packed planar */
+#define PFNC_Coord3D_AC12p                       0x021800F2 /* 3D coordinate A-C 12-bit packed */
+#define PFNC_Coord3D_AC12p_Planar                0x021800F3 /* 3D coordinate A-C 12-bit packed planar */
+#define PFNC_Coord3D_AC16                        0x022000BB /* 3D coordinate A-C 16-bit */
+#define PFNC_Coord3D_AC16_Planar                 0x022000BC /* 3D coordinate A-C 16-bit planar */
+#define PFNC_Coord3D_AC32f                       0x024000C2 /* 3D coordinate A-C 32-bit floating point */
+#define PFNC_Coord3D_AC32f_Planar                0x024000C3 /* 3D coordinate A-C 32-bit floating point planar */
+#define PFNC_Coord3D_A8                          0x010800AF /* 3D coordinate A 8-bit */
+#define PFNC_Coord3D_A10p                        0x010A00D5 /* 3D coordinate A 10-bit packed */
+#define PFNC_Coord3D_A12p                        0x010C00D8 /* 3D coordinate A 12-bit packed */
+#define PFNC_Coord3D_A16                         0x011000B6 /* 3D coordinate A 16-bit */
+#define PFNC_Coord3D_A32f                        0x012000BD /* 3D coordinate A 32-bit floating point */
+#define PFNC_Coord3D_B8                          0x010800B0 /* 3D coordinate B 8-bit */
+#define PFNC_Coord3D_B10p                        0x010A00D6 /* 3D coordinate B 10-bit packed */
+#define PFNC_Coord3D_B12p                        0x010C00D9 /* 3D coordinate B 12-bit packed */
+#define PFNC_Coord3D_B16                         0x011000B7 /* 3D coordinate B 16-bit */
+#define PFNC_Coord3D_B32f                        0x012000BE /* 3D coordinate B 32-bit floating point */
+#define PFNC_Coord3D_C8                          0x010800B1 /* 3D coordinate C 8-bit */
+#define PFNC_Coord3D_C10p                        0x010A00D7 /* 3D coordinate C 10-bit packed */
+#define PFNC_Coord3D_C12p                        0x010C00DA /* 3D coordinate C 12-bit packed */
+#define PFNC_Coord3D_C16                         0x011000B8 /* 3D coordinate C 16-bit */
+#define PFNC_Coord3D_C32f                        0x012000BF /* 3D coordinate C 32-bit floating point */
+#define PFNC_Confidence1                         0x010800C4 /* Confidence 1-bit unpacked */
+#define PFNC_Confidence1p                        0x010100C5 /* Confidence 1-bit packed */
+#define PFNC_Confidence8                         0x010800C6 /* Confidence 8-bit */
+#define PFNC_Confidence16                        0x011000C7 /* Confidence 16-bit */
+#define PFNC_Confidence32f                       0x012000C8 /* Confidence 32-bit floating point */
+#define PFNC_BiColorBGRG8                        0x021000A6 /* Bi-color Blue/Green - Red/Green 8-bit */
+#define PFNC_BiColorBGRG10                       0x022000A9 /* Bi-color Blue/Green - Red/Green 10-bit unpacked */
+#define PFNC_BiColorBGRG10p                      0x021400AA /* Bi-color Blue/Green - Red/Green 10-bit packed */
+#define PFNC_BiColorBGRG12                       0x022000AD /* Bi-color Blue/Green - Red/Green 12-bit unpacked */
+#define PFNC_BiColorBGRG12p                      0x021800AE /* Bi-color Blue/Green - Red/Green 12-bit packed */
+#define PFNC_BiColorRGBG8                        0x021000A5 /* Bi-color Red/Green - Blue/Green 8-bit */
+#define PFNC_BiColorRGBG10                       0x022000A7 /* Bi-color Red/Green - Blue/Green 10-bit unpacked */
+#define PFNC_BiColorRGBG10p                      0x021400A8 /* Bi-color Red/Green - Blue/Green 10-bit packed */
+#define PFNC_BiColorRGBG12                       0x022000AB /* Bi-color Red/Green - Blue/Green 12-bit unpacked */
+#define PFNC_BiColorRGBG12p                      0x021800AC /* Bi-color Red/Green - Blue/Green 12-bit packed */
+#define PFNC_Data8                               0x01080116 /* Data 8-bit */
+#define PFNC_Data8s                              0x01080117 /* Data 8-bit signed */
+#define PFNC_Data16                              0x01100118 /* Data 16-bit */
+#define PFNC_Data16s                             0x01100119 /* Data 16-bit signed */
+#define PFNC_Data32                              0x0120011A /* Data 32-bit */
+#define PFNC_Data32f                             0x0120011C /* Data 32-bit floating point */
+#define PFNC_Data32s                             0x0120011B /* Data 32-bit signed */
+#define PFNC_Data64                              0x0140011D /* Data 64-bit */
+#define PFNC_Data64f                             0x0140011F /* Data 64-bit floating point */
+#define PFNC_Data64s                             0x0140011E /* Data 64-bit signed */
+#define PFNC_SCF1WBWG8                           0x01080067 /* Sparse Color Filter #1 White-Blue-White-Green 8-bit */
+#define PFNC_SCF1WBWG10                          0x01100068 /* Sparse Color Filter #1 White-Blue-White-Green 10-bit unpacked */
+#define PFNC_SCF1WBWG10p                         0x010A0069 /* Sparse Color Filter #1 White-Blue-White-Green 10-bit packed */
+#define PFNC_SCF1WBWG12                          0x0110006A /* Sparse Color Filter #1 White-Blue-White-Green 12-bit unpacked */
+#define PFNC_SCF1WBWG12p                         0x010C006B /* Sparse Color Filter #1 White-Blue-White-Green 12-bit packed */
+#define PFNC_SCF1WBWG14                          0x0110006C /* Sparse Color Filter #1 White-Blue-White-Green 14-bit unpacked */
+#define PFNC_SCF1WBWG16                          0x0110006D /* Sparse Color Filter #1 White-Blue-White-Green 16-bit unpacked */
+#define PFNC_SCF1WGWB8                           0x0108006E /* Sparse Color Filter #1 White-Green-White-Blue 8-bit */
+#define PFNC_SCF1WGWB10                          0x0110006F /* Sparse Color Filter #1 White-Green-White-Blue 10-bit unpacked */
+#define PFNC_SCF1WGWB10p                         0x010A0070 /* Sparse Color Filter #1 White-Green-White-Blue 10-bit packed */
+#define PFNC_SCF1WGWB12                          0x01100071 /* Sparse Color Filter #1 White-Green-White-Blue 12-bit unpacked */
+#define PFNC_SCF1WGWB12p                         0x010C0072 /* Sparse Color Filter #1 White-Green-White-Blue 12-bit packed */
+#define PFNC_SCF1WGWB14                          0x01100073 /* Sparse Color Filter #1 White-Green-White-Blue 14-bit unpacked */
+#define PFNC_SCF1WGWB16                          0x01100074 /* Sparse Color Filter #1 White-Green-White-Blue 16-bit */
+#define PFNC_SCF1WGWR8                           0x01080075 /* Sparse Color Filter #1 White-Green-White-Red 8-bit */
+#define PFNC_SCF1WGWR10                          0x01100076 /* Sparse Color Filter #1 White-Green-White-Red 10-bit unpacked */
+#define PFNC_SCF1WGWR10p                         0x010A0077 /* Sparse Color Filter #1 White-Green-White-Red 10-bit packed */
+#define PFNC_SCF1WGWR12                          0x01100078 /* Sparse Color Filter #1 White-Green-White-Red 12-bit unpacked */
+#define PFNC_SCF1WGWR12p                         0x010C0079 /* Sparse Color Filter #1 White-Green-White-Red 12-bit packed */
+#define PFNC_SCF1WGWR14                          0x0110007A /* Sparse Color Filter #1 White-Green-White-Red 14-bit unpacked */
+#define PFNC_SCF1WGWR16                          0x0110007B /* Sparse Color Filter #1 White-Green-White-Red 16-bit */
+#define PFNC_SCF1WRWG8                           0x0108007C /* Sparse Color Filter #1 White-Red-White-Green 8-bit */
+#define PFNC_SCF1WRWG10                          0x0110007D /* Sparse Color Filter #1 White-Red-White-Green 10-bit unpacked */
+#define PFNC_SCF1WRWG10p                         0x010A007E /* Sparse Color Filter #1 White-Red-White-Green 10-bit packed */
+#define PFNC_SCF1WRWG12                          0x0110007F /* Sparse Color Filter #1 White-Red-White-Green 12-bit unpacked */
+#define PFNC_SCF1WRWG12p                         0x010C0080 /* Sparse Color Filter #1 White-Red-White-Green 12-bit packed */
+#define PFNC_SCF1WRWG14                          0x01100081 /* Sparse Color Filter #1 White-Red-White-Green 14-bit unpacked */
+#define PFNC_SCF1WRWG16                          0x01100082 /* Sparse Color Filter #1 White-Red-White-Green 16-bit */
+#define PFNC_YCbCr8                              0x0218005B /* YCbCr 4:4:4 8-bit */
+#define PFNC_YCbCr8_CbYCr                        0x0218003A /* YCbCr 4:4:4 8-bit */
+#define PFNC_YCbCr10_CbYCr                       0x02300083 /* YCbCr 4:4:4 10-bit unpacked */
+#define PFNC_YCbCr10p_CbYCr                      0x021E0084 /* YCbCr 4:4:4 10-bit packed */
+#define PFNC_YCbCr12_CbYCr                       0x02300085 /* YCbCr 4:4:4 12-bit unpacked */
+#define PFNC_YCbCr12p_CbYCr                      0x02240086 /* YCbCr 4:4:4 12-bit packed */
+#define PFNC_YCbCr411_8                          0x020C005A /* YCbCr 4:1:1 8-bit */
+#define PFNC_YCbCr411_8_CbYYCrYY                 0x020C003C /* YCbCr 4:1:1 8-bit */
+#define PFNC_YCbCr420_8_YY_CbCr_Semiplanar       0x020C0112 /* YCbCr 4:2:0 8-bit YY/CbCr Semiplanar */
+#define PFNC_YCbCr420_8_YY_CrCb_Semiplanar       0x020C0114 /* YCbCr 4:2:0 8-bit YY/CrCb Semiplanar */
+#define PFNC_YCbCr422_8                          0x0210003B /* YCbCr 4:2:2 8-bit */
+#define PFNC_YCbCr422_8_CbYCrY                   0x02100043 /* YCbCr 4:2:2 8-bit */
+#define PFNC_YCbCr422_8_YY_CbCr_Semiplanar       0x02100113 /* YCbCr 4:2:2 8-bit YY/CbCr Semiplanar */
+#define PFNC_YCbCr422_8_YY_CrCb_Semiplanar       0x02100115 /* YCbCr 4:2:2 8-bit YY/CrCb Semiplanar */
+#define PFNC_YCbCr422_10                         0x02200065 /* YCbCr 4:2:2 10-bit unpacked */
+#define PFNC_YCbCr422_10_CbYCrY                  0x02200099 /* YCbCr 4:2:2 10-bit unpacked */
+#define PFNC_YCbCr422_10p                        0x02140087 /* YCbCr 4:2:2 10-bit packed */
+#define PFNC_YCbCr422_10p_CbYCrY                 0x0214009A /* YCbCr 4:2:2 10-bit packed */
+#define PFNC_YCbCr422_12                         0x02200066 /* YCbCr 4:2:2 12-bit unpacked */
+#define PFNC_YCbCr422_12_CbYCrY                  0x0220009B /* YCbCr 4:2:2 12-bit unpacked */
+#define PFNC_YCbCr422_12p                        0x02180088 /* YCbCr 4:2:2 12-bit packed */
+#define PFNC_YCbCr422_12p_CbYCrY                 0x0218009C /* YCbCr 4:2:2 12-bit packed */
+#define PFNC_YCbCr601_8_CbYCr                    0x0218003D /* YCbCr 4:4:4 8-bit BT.601 */
+#define PFNC_YCbCr601_10_CbYCr                   0x02300089 /* YCbCr 4:4:4 10-bit unpacked BT.601 */
+#define PFNC_YCbCr601_10p_CbYCr                  0x021E008A /* YCbCr 4:4:4 10-bit packed BT.601 */
+#define PFNC_YCbCr601_12_CbYCr                   0x0230008B /* YCbCr 4:4:4 12-bit unpacked BT.601 */
+#define PFNC_YCbCr601_12p_CbYCr                  0x0224008C /* YCbCr 4:4:4 12-bit packed BT.601 */
+#define PFNC_YCbCr601_411_8_CbYYCrYY             0x020C003F /* YCbCr 4:1:1 8-bit BT.601 */
+#define PFNC_YCbCr601_422_8                      0x0210003E /* YCbCr 4:2:2 8-bit BT.601 */
+#define PFNC_YCbCr601_422_8_CbYCrY               0x02100044 /* YCbCr 4:2:2 8-bit BT.601 */
+#define PFNC_YCbCr601_422_10                     0x0220008D /* YCbCr 4:2:2 10-bit unpacked BT.601 */
+#define PFNC_YCbCr601_422_10_CbYCrY              0x0220009D /* YCbCr 4:2:2 10-bit unpacked BT.601 */
+#define PFNC_YCbCr601_422_10p                    0x0214008E /* YCbCr 4:2:2 10-bit packed BT.601 */
+#define PFNC_YCbCr601_422_10p_CbYCrY             0x0214009E /* YCbCr 4:2:2 10-bit packed BT.601 */
+#define PFNC_YCbCr601_422_12                     0x0220008F /* YCbCr 4:2:2 12-bit unpacked BT.601 */
+#define PFNC_YCbCr601_422_12_CbYCrY              0x0220009F /* YCbCr 4:2:2 12-bit unpacked BT.601 */
+#define PFNC_YCbCr601_422_12p                    0x02180090 /* YCbCr 4:2:2 12-bit packed BT.601 */
+#define PFNC_YCbCr601_422_12p_CbYCrY             0x021800A0 /* YCbCr 4:2:2 12-bit packed BT.601 */
+#define PFNC_YCbCr709_8_CbYCr                    0x02180040 /* YCbCr 4:4:4 8-bit BT.709 */
+#define PFNC_YCbCr709_10_CbYCr                   0x02300091 /* YCbCr 4:4:4 10-bit unpacked BT.709 */
+#define PFNC_YCbCr709_10p_CbYCr                  0x021E0092 /* YCbCr 4:4:4 10-bit packed BT.709 */
+#define PFNC_YCbCr709_12_CbYCr                   0x02300093 /* YCbCr 4:4:4 12-bit unpacked BT.709 */
+#define PFNC_YCbCr709_12p_CbYCr                  0x02240094 /* YCbCr 4:4:4 12-bit packed BT.709 */
+#define PFNC_YCbCr709_411_8_CbYYCrYY             0x020C0042 /* YCbCr 4:1:1 8-bit BT.709 */
+#define PFNC_YCbCr709_422_8                      0x02100041 /* YCbCr 4:2:2 8-bit BT.709 */
+#define PFNC_YCbCr709_422_8_CbYCrY               0x02100045 /* YCbCr 4:2:2 8-bit BT.709 */
+#define PFNC_YCbCr709_422_10                     0x02200095 /* YCbCr 4:2:2 10-bit unpacked BT.709 */
+#define PFNC_YCbCr709_422_10_CbYCrY              0x022000A1 /* YCbCr 4:2:2 10-bit unpacked BT.709 */
+#define PFNC_YCbCr709_422_10p                    0x02140096 /* YCbCr 4:2:2 10-bit packed BT.709 */
+#define PFNC_YCbCr709_422_10p_CbYCrY             0x021400A2 /* YCbCr 4:2:2 10-bit packed BT.709 */
+#define PFNC_YCbCr709_422_12                     0x02200097 /* YCbCr 4:2:2 12-bit unpacked BT.709 */
+#define PFNC_YCbCr709_422_12_CbYCrY              0x022000A3 /* YCbCr 4:2:2 12-bit unpacked BT.709 */
+#define PFNC_YCbCr709_422_12p                    0x02180098 /* YCbCr 4:2:2 12-bit packed BT.709 */
+#define PFNC_YCbCr709_422_12p_CbYCrY             0x021800A4 /* YCbCr 4:2:2 12-bit packed BT.709 */
+#define PFNC_YCbCr2020_8_CbYCr                   0x021800F4 /* YCbCr 4:4:4 8-bit BT.2020 */
+#define PFNC_YCbCr2020_10_CbYCr                  0x023000F5 /* YCbCr 4:4:4 10-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_10p_CbYCr                 0x021E00F6 /* YCbCr 4:4:4 10-bit packed BT.2020 */
+#define PFNC_YCbCr2020_12_CbYCr                  0x023000F7 /* YCbCr 4:4:4 12-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_12p_CbYCr                 0x022400F8 /* YCbCr 4:4:4 12-bit packed BT.2020 */
+#define PFNC_YCbCr2020_411_8_CbYYCrYY            0x020C00F9 /* YCbCr 4:1:1 8-bit BT.2020 */
+#define PFNC_YCbCr2020_422_8                     0x021000FA /* YCbCr 4:2:2 8-bit BT.2020 */
+#define PFNC_YCbCr2020_422_8_CbYCrY              0x021000FB /* YCbCr 4:2:2 8-bit BT.2020 */
+#define PFNC_YCbCr2020_422_10                    0x022000FC /* YCbCr 4:2:2 10-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_422_10_CbYCrY             0x022000FD /* YCbCr 4:2:2 10-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_422_10p                   0x021400FE /* YCbCr 4:2:2 10-bit packed BT.2020 */
+#define PFNC_YCbCr2020_422_10p_CbYCrY            0x021400FF /* YCbCr 4:2:2 10-bit packed BT.2020 */
+#define PFNC_YCbCr2020_422_12                    0x02200100 /* YCbCr 4:2:2 12-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_422_12_CbYCrY             0x02200101 /* YCbCr 4:2:2 12-bit unpacked BT.2020 */
+#define PFNC_YCbCr2020_422_12p                   0x02180102 /* YCbCr 4:2:2 12-bit packed BT.2020 */
+#define PFNC_YCbCr2020_422_12p_CbYCrY            0x02180103 /* YCbCr 4:2:2 12-bit packed BT.2020 */
+#define PFNC_YUV8_UYV                            0x02180020 /* YUV 4:4:4 8-bit */
+#define PFNC_YUV411_8_UYYVYY                     0x020C001E /* YUV 4:1:1 8-bit */
+#define PFNC_YUV422_8                            0x02100032 /* YUV 4:2:2 8-bit */
+#define PFNC_YUV422_8_UYVY                       0x0210001F /* YUV 4:2:2 8-bit */
+
+/* Following formats are not PFNC compliant, but are still kept in the list for legacy purposes. */
+
+#define GVSP_Mono10Packed                        0x010C0004 /* GigE Vision specific format, Monochrome 10-bit packed */
+#define GVSP_Mono12Packed                        0x010C0006 /* GigE Vision specific format, Monochrome 12-bit packed */
+#define GVSP_BayerBG10Packed                     0x010C0029 /* GigE Vision specific format, Bayer Blue-Green 10-bit packed */
+#define GVSP_BayerBG12Packed                     0x010C002D /* GigE Vision specific format, Bayer Blue-Green 12-bit packed */
+#define GVSP_BayerGB10Packed                     0x010C0028 /* GigE Vision specific format, Bayer Green-Blue 10-bit packed */
+#define GVSP_BayerGB12Packed                     0x010C002C /* GigE Vision specific format, Bayer Green-Blue 12-bit packed */
+#define GVSP_BayerGR10Packed                     0x010C0026 /* GigE Vision specific format, Bayer Green-Red 10-bit packed */
+#define GVSP_BayerGR12Packed                     0x010C002A /* GigE Vision specific format, Bayer Green-Red 12-bit packed */
+#define GVSP_BayerRG10Packed                     0x010C0027 /* GigE Vision specific format, Bayer Red-Green 10-bit packed */
+#define GVSP_BayerRG12Packed                     0x010C002B /* GigE Vision specific format, Bayer Red-Green 12-bit packed */
+#define GVSP_RGB10V1Packed                       0x0220001C /* GigE Vision specific format, Red-Green-Blue 10-bit packed - variant 1 */
+#define GVSP_RGB12V1Packed                       0x02240034 /* GigE Vision specific format, Red-Green-Blue 12-bit packed - variant 1 */
+
+
+/* Identical set of formats in the form of an enum */
+
+typedef enum PfncFormat_
+{
+  Mono1p                                   = 0x01010037, /* Monochrome 1-bit packed */
+  Mono2p                                   = 0x01020038, /* Monochrome 2-bit packed */
+  Mono4p                                   = 0x01040039, /* Monochrome 4-bit packed */
+  Mono8                                    = 0x01080001, /* Monochrome 8-bit */
+  Mono8s                                   = 0x01080002, /* Monochrome 8-bit signed */
+  Mono10                                   = 0x01100003, /* Monochrome 10-bit unpacked */
+  Mono10p                                  = 0x010A0046, /* Monochrome 10-bit packed */
+  Mono12                                   = 0x01100005, /* Monochrome 12-bit unpacked */
+  Mono12p                                  = 0x010C0047, /* Monochrome 12-bit packed */
+  Mono14                                   = 0x01100025, /* Monochrome 14-bit unpacked */
+  Mono14p                                  = 0x010E0104, /* Monochrome 14-bit packed */
+  Mono16                                   = 0x01100007, /* Monochrome 16-bit */
+  Mono32                                   = 0x01200111, /* Monochrome 32-bit */
+  BayerBG4p                                = 0x01040110, /* Bayer Blue-Green 4-bit packed */
+  BayerBG8                                 = 0x0108000B, /* Bayer Blue-Green 8-bit */
+  BayerBG10                                = 0x0110000F, /* Bayer Blue-Green 10-bit unpacked */
+  BayerBG10p                               = 0x010A0052, /* Bayer Blue-Green 10-bit packed */
+  BayerBG12                                = 0x01100013, /* Bayer Blue-Green 12-bit unpacked */
+  BayerBG12p                               = 0x010C0053, /* Bayer Blue-Green 12-bit packed */
+  BayerBG14                                = 0x0110010C, /* Bayer Blue-Green 14-bit */
+  BayerBG14p                               = 0x010E0108, /* Bayer Blue-Green 14-bit packed */
+  BayerBG16                                = 0x01100031, /* Bayer Blue-Green 16-bit */
+  BayerGB4p                                = 0x0104010F, /* Bayer Green-Blue 4-bit packed */
+  BayerGB8                                 = 0x0108000A, /* Bayer Green-Blue 8-bit */
+  BayerGB10                                = 0x0110000E, /* Bayer Green-Blue 10-bit unpacked */
+  BayerGB10p                               = 0x010A0054, /* Bayer Green-Blue 10-bit packed */
+  BayerGB12                                = 0x01100012, /* Bayer Green-Blue 12-bit unpacked */
+  BayerGB12p                               = 0x010C0055, /* Bayer Green-Blue 12-bit packed */
+  BayerGB14                                = 0x0110010B, /* Bayer Green-Blue 14-bit */
+  BayerGB14p                               = 0x010E0107, /* Bayer Green-Blue 14-bit packed */
+  BayerGB16                                = 0x01100030, /* Bayer Green-Blue 16-bit */
+  BayerGR4p                                = 0x0104010D, /* Bayer Green-Red 4-bit packed */
+  BayerGR8                                 = 0x01080008, /* Bayer Green-Red 8-bit */
+  BayerGR10                                = 0x0110000C, /* Bayer Green-Red 10-bit unpacked */
+  BayerGR10p                               = 0x010A0056, /* Bayer Green-Red 10-bit packed */
+  BayerGR12                                = 0x01100010, /* Bayer Green-Red 12-bit unpacked */
+  BayerGR12p                               = 0x010C0057, /* Bayer Green-Red 12-bit packed */
+  BayerGR14                                = 0x01100109, /* Bayer Green-Red 14-bit */
+  BayerGR14p                               = 0x010E0105, /* Bayer Green-Red 14-bit packed */
+  BayerGR16                                = 0x0110002E, /* Bayer Green-Red 16-bit */
+  BayerRG4p                                = 0x0104010E, /* Bayer Red-Green 4-bit packed */
+  BayerRG8                                 = 0x01080009, /* Bayer Red-Green 8-bit */
+  BayerRG10                                = 0x0110000D, /* Bayer Red-Green 10-bit unpacked */
+  BayerRG10p                               = 0x010A0058, /* Bayer Red-Green 10-bit packed */
+  BayerRG12                                = 0x01100011, /* Bayer Red-Green 12-bit unpacked */
+  BayerRG12p                               = 0x010C0059, /* Bayer Red-Green 12-bit packed */
+  BayerRG14                                = 0x0110010A, /* Bayer Red-Green 14-bit */
+  BayerRG14p                               = 0x010E0106, /* Bayer Red-Green 14-bit packed */
+  BayerRG16                                = 0x0110002F, /* Bayer Red-Green 16-bit */
+  RGBa8                                    = 0x02200016, /* Red-Green-Blue-alpha 8-bit */
+  RGBa10                                   = 0x0240005F, /* Red-Green-Blue-alpha 10-bit unpacked */
+  RGBa10p                                  = 0x02280060, /* Red-Green-Blue-alpha 10-bit packed */
+  RGBa12                                   = 0x02400061, /* Red-Green-Blue-alpha 12-bit unpacked */
+  RGBa12p                                  = 0x02300062, /* Red-Green-Blue-alpha 12-bit packed */
+  RGBa14                                   = 0x02400063, /* Red-Green-Blue-alpha 14-bit unpacked */
+  RGBa16                                   = 0x02400064, /* Red-Green-Blue-alpha 16-bit */
+  RGB8                                     = 0x02180014, /* Red-Green-Blue 8-bit */
+  RGB8_Planar                              = 0x02180021, /* Red-Green-Blue 8-bit planar */
+  RGB10                                    = 0x02300018, /* Red-Green-Blue 10-bit unpacked */
+  RGB10_Planar                             = 0x02300022, /* Red-Green-Blue 10-bit unpacked planar */
+  RGB10p                                   = 0x021E005C, /* Red-Green-Blue 10-bit packed */
+  RGB10p32                                 = 0x0220001D, /* Red-Green-Blue 10-bit packed into 32-bit */
+  RGB12                                    = 0x0230001A, /* Red-Green-Blue 12-bit unpacked */
+  RGB12_Planar                             = 0x02300023, /* Red-Green-Blue 12-bit unpacked planar */
+  RGB12p                                   = 0x0224005D, /* Red-Green-Blue 12-bit packed */
+  RGB14                                    = 0x0230005E, /* Red-Green-Blue 14-bit unpacked */
+  RGB16                                    = 0x02300033, /* Red-Green-Blue 16-bit */
+  RGB16_Planar                             = 0x02300024, /* Red-Green-Blue 16-bit planar */
+  RGB565p                                  = 0x02100035, /* Red-Green-Blue 5/6/5-bit packed */
+  BGRa8                                    = 0x02200017, /* Blue-Green-Red-alpha 8-bit */
+  BGRa10                                   = 0x0240004C, /* Blue-Green-Red-alpha 10-bit unpacked */
+  BGRa10p                                  = 0x0228004D, /* Blue-Green-Red-alpha 10-bit packed */
+  BGRa12                                   = 0x0240004E, /* Blue-Green-Red-alpha 12-bit unpacked */
+  BGRa12p                                  = 0x0230004F, /* Blue-Green-Red-alpha 12-bit packed */
+  BGRa14                                   = 0x02400050, /* Blue-Green-Red-alpha 14-bit unpacked */
+  BGRa16                                   = 0x02400051, /* Blue-Green-Red-alpha 16-bit */
+  BGR8                                     = 0x02180015, /* Blue-Green-Red 8-bit */
+  BGR10                                    = 0x02300019, /* Blue-Green-Red 10-bit unpacked */
+  BGR10p                                   = 0x021E0048, /* Blue-Green-Red 10-bit packed */
+  BGR12                                    = 0x0230001B, /* Blue-Green-Red 12-bit unpacked */
+  BGR12p                                   = 0x02240049, /* Blue-Green-Red 12-bit packed */
+  BGR14                                    = 0x0230004A, /* Blue-Green-Red 14-bit unpacked */
+  BGR16                                    = 0x0230004B, /* Blue-Green-Red 16-bit */
+  BGR565p                                  = 0x02100036, /* Blue-Green-Red 5/6/5-bit packed */
+  R8                                       = 0x010800C9, /* Red 8-bit */
+  R10                                      = 0x010A00CA, /* Red 10-bit */
+  R12                                      = 0x010C00CB, /* Red 12-bit */
+  R16                                      = 0x011000CC, /* Red 16-bit */
+  G8                                       = 0x010800CD, /* Green 8-bit */
+  G10                                      = 0x010A00CE, /* Green 10-bit */
+  G12                                      = 0x010C00CF, /* Green 12-bit */
+  G16                                      = 0x011000D0, /* Green 16-bit */
+  B8                                       = 0x010800D1, /* Blue 8-bit */
+  B10                                      = 0x010A00D2, /* Blue 10-bit */
+  B12                                      = 0x010C00D3, /* Blue 12-bit */
+  B16                                      = 0x011000D4, /* Blue 16-bit */
+  Coord3D_ABC8                             = 0x021800B2, /* 3D coordinate A-B-C 8-bit */
+  Coord3D_ABC8_Planar                      = 0x021800B3, /* 3D coordinate A-B-C 8-bit planar */
+  Coord3D_ABC10p                           = 0x021E00DB, /* 3D coordinate A-B-C 10-bit packed */
+  Coord3D_ABC10p_Planar                    = 0x021E00DC, /* 3D coordinate A-B-C 10-bit packed planar */
+  Coord3D_ABC12p                           = 0x022400DE, /* 3D coordinate A-B-C 12-bit packed */
+  Coord3D_ABC12p_Planar                    = 0x022400DF, /* 3D coordinate A-B-C 12-bit packed planar */
+  Coord3D_ABC16                            = 0x023000B9, /* 3D coordinate A-B-C 16-bit */
+  Coord3D_ABC16_Planar                     = 0x023000BA, /* 3D coordinate A-B-C 16-bit planar */
+  Coord3D_ABC32f                           = 0x026000C0, /* 3D coordinate A-B-C 32-bit floating point */
+  Coord3D_ABC32f_Planar                    = 0x026000C1, /* 3D coordinate A-B-C 32-bit floating point planar */
+  Coord3D_AC8                              = 0x021000B4, /* 3D coordinate A-C 8-bit */
+  Coord3D_AC8_Planar                       = 0x021000B5, /* 3D coordinate A-C 8-bit planar */
+  Coord3D_AC10p                            = 0x021400F0, /* 3D coordinate A-C 10-bit packed */
+  Coord3D_AC10p_Planar                     = 0x021400F1, /* 3D coordinate A-C 10-bit packed planar */
+  Coord3D_AC12p                            = 0x021800F2, /* 3D coordinate A-C 12-bit packed */
+  Coord3D_AC12p_Planar                     = 0x021800F3, /* 3D coordinate A-C 12-bit packed planar */
+  Coord3D_AC16                             = 0x022000BB, /* 3D coordinate A-C 16-bit */
+  Coord3D_AC16_Planar                      = 0x022000BC, /* 3D coordinate A-C 16-bit planar */
+  Coord3D_AC32f                            = 0x024000C2, /* 3D coordinate A-C 32-bit floating point */
+  Coord3D_AC32f_Planar                     = 0x024000C3, /* 3D coordinate A-C 32-bit floating point planar */
+  Coord3D_A8                               = 0x010800AF, /* 3D coordinate A 8-bit */
+  Coord3D_A10p                             = 0x010A00D5, /* 3D coordinate A 10-bit packed */
+  Coord3D_A12p                             = 0x010C00D8, /* 3D coordinate A 12-bit packed */
+  Coord3D_A16                              = 0x011000B6, /* 3D coordinate A 16-bit */
+  Coord3D_A32f                             = 0x012000BD, /* 3D coordinate A 32-bit floating point */
+  Coord3D_B8                               = 0x010800B0, /* 3D coordinate B 8-bit */
+  Coord3D_B10p                             = 0x010A00D6, /* 3D coordinate B 10-bit packed */
+  Coord3D_B12p                             = 0x010C00D9, /* 3D coordinate B 12-bit packed */
+  Coord3D_B16                              = 0x011000B7, /* 3D coordinate B 16-bit */
+  Coord3D_B32f                             = 0x012000BE, /* 3D coordinate B 32-bit floating point */
+  Coord3D_C8                               = 0x010800B1, /* 3D coordinate C 8-bit */
+  Coord3D_C10p                             = 0x010A00D7, /* 3D coordinate C 10-bit packed */
+  Coord3D_C12p                             = 0x010C00DA, /* 3D coordinate C 12-bit packed */
+  Coord3D_C16                              = 0x011000B8, /* 3D coordinate C 16-bit */
+  Coord3D_C32f                             = 0x012000BF, /* 3D coordinate C 32-bit floating point */
+  Confidence1                              = 0x010800C4, /* Confidence 1-bit unpacked */
+  Confidence1p                             = 0x010100C5, /* Confidence 1-bit packed */
+  Confidence8                              = 0x010800C6, /* Confidence 8-bit */
+  Confidence16                             = 0x011000C7, /* Confidence 16-bit */
+  Confidence32f                            = 0x012000C8, /* Confidence 32-bit floating point */
+  BiColorBGRG8                             = 0x021000A6, /* Bi-color Blue/Green - Red/Green 8-bit */
+  BiColorBGRG10                            = 0x022000A9, /* Bi-color Blue/Green - Red/Green 10-bit unpacked */
+  BiColorBGRG10p                           = 0x021400AA, /* Bi-color Blue/Green - Red/Green 10-bit packed */
+  BiColorBGRG12                            = 0x022000AD, /* Bi-color Blue/Green - Red/Green 12-bit unpacked */
+  BiColorBGRG12p                           = 0x021800AE, /* Bi-color Blue/Green - Red/Green 12-bit packed */
+  BiColorRGBG8                             = 0x021000A5, /* Bi-color Red/Green - Blue/Green 8-bit */
+  BiColorRGBG10                            = 0x022000A7, /* Bi-color Red/Green - Blue/Green 10-bit unpacked */
+  BiColorRGBG10p                           = 0x021400A8, /* Bi-color Red/Green - Blue/Green 10-bit packed */
+  BiColorRGBG12                            = 0x022000AB, /* Bi-color Red/Green - Blue/Green 12-bit unpacked */
+  BiColorRGBG12p                           = 0x021800AC, /* Bi-color Red/Green - Blue/Green 12-bit packed */
+  Data8                                    = 0x01080116, /* Data 8-bit */
+  Data8s                                   = 0x01080117, /* Data 8-bit signed */
+  Data16                                   = 0x01100118, /* Data 16-bit */
+  Data16s                                  = 0x01100119, /* Data 16-bit signed */
+  Data32                                   = 0x0120011A, /* Data 32-bit */
+  Data32f                                  = 0x0120011C, /* Data 32-bit floating point */
+  Data32s                                  = 0x0120011B, /* Data 32-bit signed */
+  Data64                                   = 0x0140011D, /* Data 64-bit */
+  Data64f                                  = 0x0140011F, /* Data 64-bit floating point */
+  Data64s                                  = 0x0140011E, /* Data 64-bit signed */
+  SCF1WBWG8                                = 0x01080067, /* Sparse Color Filter #1 White-Blue-White-Green 8-bit */
+  SCF1WBWG10                               = 0x01100068, /* Sparse Color Filter #1 White-Blue-White-Green 10-bit unpacked */
+  SCF1WBWG10p                              = 0x010A0069, /* Sparse Color Filter #1 White-Blue-White-Green 10-bit packed */
+  SCF1WBWG12                               = 0x0110006A, /* Sparse Color Filter #1 White-Blue-White-Green 12-bit unpacked */
+  SCF1WBWG12p                              = 0x010C006B, /* Sparse Color Filter #1 White-Blue-White-Green 12-bit packed */
+  SCF1WBWG14                               = 0x0110006C, /* Sparse Color Filter #1 White-Blue-White-Green 14-bit unpacked */
+  SCF1WBWG16                               = 0x0110006D, /* Sparse Color Filter #1 White-Blue-White-Green 16-bit unpacked */
+  SCF1WGWB8                                = 0x0108006E, /* Sparse Color Filter #1 White-Green-White-Blue 8-bit */
+  SCF1WGWB10                               = 0x0110006F, /* Sparse Color Filter #1 White-Green-White-Blue 10-bit unpacked */
+  SCF1WGWB10p                              = 0x010A0070, /* Sparse Color Filter #1 White-Green-White-Blue 10-bit packed */
+  SCF1WGWB12                               = 0x01100071, /* Sparse Color Filter #1 White-Green-White-Blue 12-bit unpacked */
+  SCF1WGWB12p                              = 0x010C0072, /* Sparse Color Filter #1 White-Green-White-Blue 12-bit packed */
+  SCF1WGWB14                               = 0x01100073, /* Sparse Color Filter #1 White-Green-White-Blue 14-bit unpacked */
+  SCF1WGWB16                               = 0x01100074, /* Sparse Color Filter #1 White-Green-White-Blue 16-bit */
+  SCF1WGWR8                                = 0x01080075, /* Sparse Color Filter #1 White-Green-White-Red 8-bit */
+  SCF1WGWR10                               = 0x01100076, /* Sparse Color Filter #1 White-Green-White-Red 10-bit unpacked */
+  SCF1WGWR10p                              = 0x010A0077, /* Sparse Color Filter #1 White-Green-White-Red 10-bit packed */
+  SCF1WGWR12                               = 0x01100078, /* Sparse Color Filter #1 White-Green-White-Red 12-bit unpacked */
+  SCF1WGWR12p                              = 0x010C0079, /* Sparse Color Filter #1 White-Green-White-Red 12-bit packed */
+  SCF1WGWR14                               = 0x0110007A, /* Sparse Color Filter #1 White-Green-White-Red 14-bit unpacked */
+  SCF1WGWR16                               = 0x0110007B, /* Sparse Color Filter #1 White-Green-White-Red 16-bit */
+  SCF1WRWG8                                = 0x0108007C, /* Sparse Color Filter #1 White-Red-White-Green 8-bit */
+  SCF1WRWG10                               = 0x0110007D, /* Sparse Color Filter #1 White-Red-White-Green 10-bit unpacked */
+  SCF1WRWG10p                              = 0x010A007E, /* Sparse Color Filter #1 White-Red-White-Green 10-bit packed */
+  SCF1WRWG12                               = 0x0110007F, /* Sparse Color Filter #1 White-Red-White-Green 12-bit unpacked */
+  SCF1WRWG12p                              = 0x010C0080, /* Sparse Color Filter #1 White-Red-White-Green 12-bit packed */
+  SCF1WRWG14                               = 0x01100081, /* Sparse Color Filter #1 White-Red-White-Green 14-bit unpacked */
+  SCF1WRWG16                               = 0x01100082, /* Sparse Color Filter #1 White-Red-White-Green 16-bit */
+  YCbCr8                                   = 0x0218005B, /* YCbCr 4:4:4 8-bit */
+  YCbCr8_CbYCr                             = 0x0218003A, /* YCbCr 4:4:4 8-bit */
+  YCbCr10_CbYCr                            = 0x02300083, /* YCbCr 4:4:4 10-bit unpacked */
+  YCbCr10p_CbYCr                           = 0x021E0084, /* YCbCr 4:4:4 10-bit packed */
+  YCbCr12_CbYCr                            = 0x02300085, /* YCbCr 4:4:4 12-bit unpacked */
+  YCbCr12p_CbYCr                           = 0x02240086, /* YCbCr 4:4:4 12-bit packed */
+  YCbCr411_8                               = 0x020C005A, /* YCbCr 4:1:1 8-bit */
+  YCbCr411_8_CbYYCrYY                      = 0x020C003C, /* YCbCr 4:1:1 8-bit */
+  YCbCr420_8_YY_CbCr_Semiplanar            = 0x020C0112, /* YCbCr 4:2:0 8-bit YY/CbCr Semiplanar */
+  YCbCr420_8_YY_CrCb_Semiplanar            = 0x020C0114, /* YCbCr 4:2:0 8-bit YY/CrCb Semiplanar */
+  YCbCr422_8                               = 0x0210003B, /* YCbCr 4:2:2 8-bit */
+  YCbCr422_8_CbYCrY                        = 0x02100043, /* YCbCr 4:2:2 8-bit */
+  YCbCr422_8_YY_CbCr_Semiplanar            = 0x02100113, /* YCbCr 4:2:2 8-bit YY/CbCr Semiplanar */
+  YCbCr422_8_YY_CrCb_Semiplanar            = 0x02100115, /* YCbCr 4:2:2 8-bit YY/CrCb Semiplanar */
+  YCbCr422_10                              = 0x02200065, /* YCbCr 4:2:2 10-bit unpacked */
+  YCbCr422_10_CbYCrY                       = 0x02200099, /* YCbCr 4:2:2 10-bit unpacked */
+  YCbCr422_10p                             = 0x02140087, /* YCbCr 4:2:2 10-bit packed */
+  YCbCr422_10p_CbYCrY                      = 0x0214009A, /* YCbCr 4:2:2 10-bit packed */
+  YCbCr422_12                              = 0x02200066, /* YCbCr 4:2:2 12-bit unpacked */
+  YCbCr422_12_CbYCrY                       = 0x0220009B, /* YCbCr 4:2:2 12-bit unpacked */
+  YCbCr422_12p                             = 0x02180088, /* YCbCr 4:2:2 12-bit packed */
+  YCbCr422_12p_CbYCrY                      = 0x0218009C, /* YCbCr 4:2:2 12-bit packed */
+  YCbCr601_8_CbYCr                         = 0x0218003D, /* YCbCr 4:4:4 8-bit BT.601 */
+  YCbCr601_10_CbYCr                        = 0x02300089, /* YCbCr 4:4:4 10-bit unpacked BT.601 */
+  YCbCr601_10p_CbYCr                       = 0x021E008A, /* YCbCr 4:4:4 10-bit packed BT.601 */
+  YCbCr601_12_CbYCr                        = 0x0230008B, /* YCbCr 4:4:4 12-bit unpacked BT.601 */
+  YCbCr601_12p_CbYCr                       = 0x0224008C, /* YCbCr 4:4:4 12-bit packed BT.601 */
+  YCbCr601_411_8_CbYYCrYY                  = 0x020C003F, /* YCbCr 4:1:1 8-bit BT.601 */
+  YCbCr601_422_8                           = 0x0210003E, /* YCbCr 4:2:2 8-bit BT.601 */
+  YCbCr601_422_8_CbYCrY                    = 0x02100044, /* YCbCr 4:2:2 8-bit BT.601 */
+  YCbCr601_422_10                          = 0x0220008D, /* YCbCr 4:2:2 10-bit unpacked BT.601 */
+  YCbCr601_422_10_CbYCrY                   = 0x0220009D, /* YCbCr 4:2:2 10-bit unpacked BT.601 */
+  YCbCr601_422_10p                         = 0x0214008E, /* YCbCr 4:2:2 10-bit packed BT.601 */
+  YCbCr601_422_10p_CbYCrY                  = 0x0214009E, /* YCbCr 4:2:2 10-bit packed BT.601 */
+  YCbCr601_422_12                          = 0x0220008F, /* YCbCr 4:2:2 12-bit unpacked BT.601 */
+  YCbCr601_422_12_CbYCrY                   = 0x0220009F, /* YCbCr 4:2:2 12-bit unpacked BT.601 */
+  YCbCr601_422_12p                         = 0x02180090, /* YCbCr 4:2:2 12-bit packed BT.601 */
+  YCbCr601_422_12p_CbYCrY                  = 0x021800A0, /* YCbCr 4:2:2 12-bit packed BT.601 */
+  YCbCr709_8_CbYCr                         = 0x02180040, /* YCbCr 4:4:4 8-bit BT.709 */
+  YCbCr709_10_CbYCr                        = 0x02300091, /* YCbCr 4:4:4 10-bit unpacked BT.709 */
+  YCbCr709_10p_CbYCr                       = 0x021E0092, /* YCbCr 4:4:4 10-bit packed BT.709 */
+  YCbCr709_12_CbYCr                        = 0x02300093, /* YCbCr 4:4:4 12-bit unpacked BT.709 */
+  YCbCr709_12p_CbYCr                       = 0x02240094, /* YCbCr 4:4:4 12-bit packed BT.709 */
+  YCbCr709_411_8_CbYYCrYY                  = 0x020C0042, /* YCbCr 4:1:1 8-bit BT.709 */
+  YCbCr709_422_8                           = 0x02100041, /* YCbCr 4:2:2 8-bit BT.709 */
+  YCbCr709_422_8_CbYCrY                    = 0x02100045, /* YCbCr 4:2:2 8-bit BT.709 */
+  YCbCr709_422_10                          = 0x02200095, /* YCbCr 4:2:2 10-bit unpacked BT.709 */
+  YCbCr709_422_10_CbYCrY                   = 0x022000A1, /* YCbCr 4:2:2 10-bit unpacked BT.709 */
+  YCbCr709_422_10p                         = 0x02140096, /* YCbCr 4:2:2 10-bit packed BT.709 */
+  YCbCr709_422_10p_CbYCrY                  = 0x021400A2, /* YCbCr 4:2:2 10-bit packed BT.709 */
+  YCbCr709_422_12                          = 0x02200097, /* YCbCr 4:2:2 12-bit unpacked BT.709 */
+  YCbCr709_422_12_CbYCrY                   = 0x022000A3, /* YCbCr 4:2:2 12-bit unpacked BT.709 */
+  YCbCr709_422_12p                         = 0x02180098, /* YCbCr 4:2:2 12-bit packed BT.709 */
+  YCbCr709_422_12p_CbYCrY                  = 0x021800A4, /* YCbCr 4:2:2 12-bit packed BT.709 */
+  YCbCr2020_8_CbYCr                        = 0x021800F4, /* YCbCr 4:4:4 8-bit BT.2020 */
+  YCbCr2020_10_CbYCr                       = 0x023000F5, /* YCbCr 4:4:4 10-bit unpacked BT.2020 */
+  YCbCr2020_10p_CbYCr                      = 0x021E00F6, /* YCbCr 4:4:4 10-bit packed BT.2020 */
+  YCbCr2020_12_CbYCr                       = 0x023000F7, /* YCbCr 4:4:4 12-bit unpacked BT.2020 */
+  YCbCr2020_12p_CbYCr                      = 0x022400F8, /* YCbCr 4:4:4 12-bit packed BT.2020 */
+  YCbCr2020_411_8_CbYYCrYY                 = 0x020C00F9, /* YCbCr 4:1:1 8-bit BT.2020 */
+  YCbCr2020_422_8                          = 0x021000FA, /* YCbCr 4:2:2 8-bit BT.2020 */
+  YCbCr2020_422_8_CbYCrY                   = 0x021000FB, /* YCbCr 4:2:2 8-bit BT.2020 */
+  YCbCr2020_422_10                         = 0x022000FC, /* YCbCr 4:2:2 10-bit unpacked BT.2020 */
+  YCbCr2020_422_10_CbYCrY                  = 0x022000FD, /* YCbCr 4:2:2 10-bit unpacked BT.2020 */
+  YCbCr2020_422_10p                        = 0x021400FE, /* YCbCr 4:2:2 10-bit packed BT.2020 */
+  YCbCr2020_422_10p_CbYCrY                 = 0x021400FF, /* YCbCr 4:2:2 10-bit packed BT.2020 */
+  YCbCr2020_422_12                         = 0x02200100, /* YCbCr 4:2:2 12-bit unpacked BT.2020 */
+  YCbCr2020_422_12_CbYCrY                  = 0x02200101, /* YCbCr 4:2:2 12-bit unpacked BT.2020 */
+  YCbCr2020_422_12p                        = 0x02180102, /* YCbCr 4:2:2 12-bit packed BT.2020 */
+  YCbCr2020_422_12p_CbYCrY                 = 0x02180103, /* YCbCr 4:2:2 12-bit packed BT.2020 */
+  YUV8_UYV                                 = 0x02180020, /* YUV 4:4:4 8-bit */
+  YUV411_8_UYYVYY                          = 0x020C001E, /* YUV 4:1:1 8-bit */
+  YUV422_8                                 = 0x02100032, /* YUV 4:2:2 8-bit */
+  YUV422_8_UYVY                            = 0x0210001F, /* YUV 4:2:2 8-bit */
+  Mono10Packed                             = 0x010C0004, /* GigE Vision specific format, Monochrome 10-bit packed */
+  Mono12Packed                             = 0x010C0006, /* GigE Vision specific format, Monochrome 12-bit packed */
+  BayerBG10Packed                          = 0x010C0029, /* GigE Vision specific format, Bayer Blue-Green 10-bit packed */
+  BayerBG12Packed                          = 0x010C002D, /* GigE Vision specific format, Bayer Blue-Green 12-bit packed */
+  BayerGB10Packed                          = 0x010C0028, /* GigE Vision specific format, Bayer Green-Blue 10-bit packed */
+  BayerGB12Packed                          = 0x010C002C, /* GigE Vision specific format, Bayer Green-Blue 12-bit packed */
+  BayerGR10Packed                          = 0x010C0026, /* GigE Vision specific format, Bayer Green-Red 10-bit packed */
+  BayerGR12Packed                          = 0x010C002A, /* GigE Vision specific format, Bayer Green-Red 12-bit packed */
+  BayerRG10Packed                          = 0x010C0027, /* GigE Vision specific format, Bayer Red-Green 10-bit packed */
+  BayerRG12Packed                          = 0x010C002B, /* GigE Vision specific format, Bayer Red-Green 12-bit packed */
+  RGB10V1Packed                            = 0x0220001C, /* GigE Vision specific format, Red-Green-Blue 10-bit packed - variant 1 */
+  RGB12V1Packed                            = 0x02240034, /* GigE Vision specific format, Red-Green-Blue 12-bit packed - variant 1 */
+  InvalidPixelFormat                       = 0
+} PfncFormat;
+
+/* 32-bit value layout */
+/* |31            24|23            16|15            08|07            00| */
+/* | C| Comp. Layout| Effective Size |            Pixel ID             | */
+
+/* Custom flag */
+#define PFNC_CUSTOM                              0x80000000
+/* Component layout */
+#define PFNC_SINGLE_COMPONENT                    0x01000000
+#define PFNC_MULTIPLE_COMPONENT                  0x02000000
+#define PFNC_COMPONENT_MASK                      0x7F000000
+/* Effective size */
+#define PFNC_OCCUPY1BIT                          0x00010000
+#define PFNC_OCCUPY2BIT                          0x00020000
+#define PFNC_OCCUPY4BIT                          0x00040000
+#define PFNC_OCCUPY8BIT                          0x00080000
+#define PFNC_OCCUPY10BIT                         0x000A0000
+#define PFNC_OCCUPY12BIT                         0x000C0000
+#define PFNC_OCCUPY16BIT                         0x00100000
+#define PFNC_OCCUPY24BIT                         0x00180000
+#define PFNC_OCCUPY30BIT                         0x001E0000
+#define PFNC_OCCUPY32BIT                         0x00200000
+#define PFNC_OCCUPY36BIT                         0x00240000
+#define PFNC_OCCUPY40BIT                         0x00280000
+#define PFNC_OCCUPY48BIT                         0x00300000
+#define PFNC_OCCUPY64BIT                         0x00400000
+#define PFNC_PIXEL_SIZE_MASK                     0x00FF0000
+#define PFNC_PIXEL_SIZE_SHIFT                    16
+/* Pixel ID */
+#define PFNC_PIXEL_ID_MASK                       0x0000FFFF
+
+/* Pixel format value dissection helpers */
+#define PFNC_PIXEL_SIZE(X) (((X == 0x010A00CA) || (X == 0x010A00CE) || (X == 0x010A00D2) || (X == 0x010C00CB) || (X == 0x010C00CF) || (X == 0x010C00D3)) ? 16 : ((X & PFNC_PIXEL_SIZE_MASK) >> PFNC_PIXEL_SIZE_SHIFT))
+// #define PFNC_PIXEL_SIZE(X) ((X & PFNC_PIXEL_SIZE_MASK) >> PFNC_PIXEL_SIZE_SHIFT)
+#define PFNC_IS_PIXEL_SINGLE_COMPONENT(X)        ((X & PFNC_COMPONENT_MASK) == PFNC_SINGLE_COMPONENT)
+#define PFNC_IS_PIXEL_MULTIPLE_COMPONENT(X)      ((X & PFNC_COMPONENT_MASK) == PFNC_MULTIPLE_COMPONENT)
+#define PFNC_IS_PIXEL_CUSTOM(X)                  ((X & PFNC_CUSTOM) == PFNC_CUSTOM)
+#define PFNC_PIXEL_ID(X)                         (X & PFNC_PIXEL_ID_MASK)
+
+
+/* Additional helpers */
+#ifdef PFNC_INCLUDE_HELPERS
+#ifdef _MSC_VER
+#  define PFNC_INLINE __inline
+#else
+#  define PFNC_INLINE inline
+#endif
+static PFNC_INLINE const char* GetPixelFormatName (PfncFormat format)
+{
+  switch (format)
+  {
+    case Mono1p:                                  return "Mono1p";
+    case Mono2p:                                  return "Mono2p";
+    case Mono4p:                                  return "Mono4p";
+    case Mono8:                                   return "Mono8";
+    case Mono8s:                                  return "Mono8s";
+    case Mono10:                                  return "Mono10";
+    case Mono10p:                                 return "Mono10p";
+    case Mono12:                                  return "Mono12";
+    case Mono12p:                                 return "Mono12p";
+    case Mono14:                                  return "Mono14";
+    case Mono14p:                                 return "Mono14p";
+    case Mono16:                                  return "Mono16";
+    case Mono32:                                  return "Mono32";
+    case BayerBG4p:                               return "BayerBG4p";
+    case BayerBG8:                                return "BayerBG8";
+    case BayerBG10:                               return "BayerBG10";
+    case BayerBG10p:                              return "BayerBG10p";
+    case BayerBG12:                               return "BayerBG12";
+    case BayerBG12p:                              return "BayerBG12p";
+    case BayerBG14:                               return "BayerBG14";
+    case BayerBG14p:                              return "BayerBG14p";
+    case BayerBG16:                               return "BayerBG16";
+    case BayerGB4p:                               return "BayerGB4p";
+    case BayerGB8:                                return "BayerGB8";
+    case BayerGB10:                               return "BayerGB10";
+    case BayerGB10p:                              return "BayerGB10p";
+    case BayerGB12:                               return "BayerGB12";
+    case BayerGB12p:                              return "BayerGB12p";
+    case BayerGB14:                               return "BayerGB14";
+    case BayerGB14p:                              return "BayerGB14p";
+    case BayerGB16:                               return "BayerGB16";
+    case BayerGR4p:                               return "BayerGR4p";
+    case BayerGR8:                                return "BayerGR8";
+    case BayerGR10:                               return "BayerGR10";
+    case BayerGR10p:                              return "BayerGR10p";
+    case BayerGR12:                               return "BayerGR12";
+    case BayerGR12p:                              return "BayerGR12p";
+    case BayerGR14:                               return "BayerGR14";
+    case BayerGR14p:                              return "BayerGR14p";
+    case BayerGR16:                               return "BayerGR16";
+    case BayerRG4p:                               return "BayerRG4p";
+    case BayerRG8:                                return "BayerRG8";
+    case BayerRG10:                               return "BayerRG10";
+    case BayerRG10p:                              return "BayerRG10p";
+    case BayerRG12:                               return "BayerRG12";
+    case BayerRG12p:                              return "BayerRG12p";
+    case BayerRG14:                               return "BayerRG14";
+    case BayerRG14p:                              return "BayerRG14p";
+    case BayerRG16:                               return "BayerRG16";
+    case RGBa8:                                   return "RGBa8";
+    case RGBa10:                                  return "RGBa10";
+    case RGBa10p:                                 return "RGBa10p";
+    case RGBa12:                                  return "RGBa12";
+    case RGBa12p:                                 return "RGBa12p";
+    case RGBa14:                                  return "RGBa14";
+    case RGBa16:                                  return "RGBa16";
+    case RGB8:                                    return "RGB8";
+    case RGB8_Planar:                             return "RGB8_Planar";
+    case RGB10:                                   return "RGB10";
+    case RGB10_Planar:                            return "RGB10_Planar";
+    case RGB10p:                                  return "RGB10p";
+    case RGB10p32:                                return "RGB10p32";
+    case RGB12:                                   return "RGB12";
+    case RGB12_Planar:                            return "RGB12_Planar";
+    case RGB12p:                                  return "RGB12p";
+    case RGB14:                                   return "RGB14";
+    case RGB16:                                   return "RGB16";
+    case RGB16_Planar:                            return "RGB16_Planar";
+    case RGB565p:                                 return "RGB565p";
+    case BGRa8:                                   return "BGRa8";
+    case BGRa10:                                  return "BGRa10";
+    case BGRa10p:                                 return "BGRa10p";
+    case BGRa12:                                  return "BGRa12";
+    case BGRa12p:                                 return "BGRa12p";
+    case BGRa14:                                  return "BGRa14";
+    case BGRa16:                                  return "BGRa16";
+    case BGR8:                                    return "BGR8";
+    case BGR10:                                   return "BGR10";
+    case BGR10p:                                  return "BGR10p";
+    case BGR12:                                   return "BGR12";
+    case BGR12p:                                  return "BGR12p";
+    case BGR14:                                   return "BGR14";
+    case BGR16:                                   return "BGR16";
+    case BGR565p:                                 return "BGR565p";
+    case R8:                                      return "R8";
+    case R10:                                     return "R10";
+    case R12:                                     return "R12";
+    case R16:                                     return "R16";
+    case G8:                                      return "G8";
+    case G10:                                     return "G10";
+    case G12:                                     return "G12";
+    case G16:                                     return "G16";
+    case B8:                                      return "B8";
+    case B10:                                     return "B10";
+    case B12:                                     return "B12";
+    case B16:                                     return "B16";
+    case Coord3D_ABC8:                            return "Coord3D_ABC8";
+    case Coord3D_ABC8_Planar:                     return "Coord3D_ABC8_Planar";
+    case Coord3D_ABC10p:                          return "Coord3D_ABC10p";
+    case Coord3D_ABC10p_Planar:                   return "Coord3D_ABC10p_Planar";
+    case Coord3D_ABC12p:                          return "Coord3D_ABC12p";
+    case Coord3D_ABC12p_Planar:                   return "Coord3D_ABC12p_Planar";
+    case Coord3D_ABC16:                           return "Coord3D_ABC16";
+    case Coord3D_ABC16_Planar:                    return "Coord3D_ABC16_Planar";
+    case Coord3D_ABC32f:                          return "Coord3D_ABC32f";
+    case Coord3D_ABC32f_Planar:                   return "Coord3D_ABC32f_Planar";
+    case Coord3D_AC8:                             return "Coord3D_AC8";
+    case Coord3D_AC8_Planar:                      return "Coord3D_AC8_Planar";
+    case Coord3D_AC10p:                           return "Coord3D_AC10p";
+    case Coord3D_AC10p_Planar:                    return "Coord3D_AC10p_Planar";
+    case Coord3D_AC12p:                           return "Coord3D_AC12p";
+    case Coord3D_AC12p_Planar:                    return "Coord3D_AC12p_Planar";
+    case Coord3D_AC16:                            return "Coord3D_AC16";
+    case Coord3D_AC16_Planar:                     return "Coord3D_AC16_Planar";
+    case Coord3D_AC32f:                           return "Coord3D_AC32f";
+    case Coord3D_AC32f_Planar:                    return "Coord3D_AC32f_Planar";
+    case Coord3D_A8:                              return "Coord3D_A8";
+    case Coord3D_A10p:                            return "Coord3D_A10p";
+    case Coord3D_A12p:                            return "Coord3D_A12p";
+    case Coord3D_A16:                             return "Coord3D_A16";
+    case Coord3D_A32f:                            return "Coord3D_A32f";
+    case Coord3D_B8:                              return "Coord3D_B8";
+    case Coord3D_B10p:                            return "Coord3D_B10p";
+    case Coord3D_B12p:                            return "Coord3D_B12p";
+    case Coord3D_B16:                             return "Coord3D_B16";
+    case Coord3D_B32f:                            return "Coord3D_B32f";
+    case Coord3D_C8:                              return "Coord3D_C8";
+    case Coord3D_C10p:                            return "Coord3D_C10p";
+    case Coord3D_C12p:                            return "Coord3D_C12p";
+    case Coord3D_C16:                             return "Coord3D_C16";
+    case Coord3D_C32f:                            return "Coord3D_C32f";
+    case Confidence1:                             return "Confidence1";
+    case Confidence1p:                            return "Confidence1p";
+    case Confidence8:                             return "Confidence8";
+    case Confidence16:                            return "Confidence16";
+    case Confidence32f:                           return "Confidence32f";
+    case BiColorBGRG8:                            return "BiColorBGRG8";
+    case BiColorBGRG10:                           return "BiColorBGRG10";
+    case BiColorBGRG10p:                          return "BiColorBGRG10p";
+    case BiColorBGRG12:                           return "BiColorBGRG12";
+    case BiColorBGRG12p:                          return "BiColorBGRG12p";
+    case BiColorRGBG8:                            return "BiColorRGBG8";
+    case BiColorRGBG10:                           return "BiColorRGBG10";
+    case BiColorRGBG10p:                          return "BiColorRGBG10p";
+    case BiColorRGBG12:                           return "BiColorRGBG12";
+    case BiColorRGBG12p:                          return "BiColorRGBG12p";
+    case Data8:                                   return "Data8";
+    case Data8s:                                  return "Data8s";
+    case Data16:                                  return "Data16";
+    case Data16s:                                 return "Data16s";
+    case Data32:                                  return "Data32";
+    case Data32f:                                 return "Data32f";
+    case Data32s:                                 return "Data32s";
+    case Data64:                                  return "Data64";
+    case Data64f:                                 return "Data64f";
+    case Data64s:                                 return "Data64s";
+    case SCF1WBWG8:                               return "SCF1WBWG8";
+    case SCF1WBWG10:                              return "SCF1WBWG10";
+    case SCF1WBWG10p:                             return "SCF1WBWG10p";
+    case SCF1WBWG12:                              return "SCF1WBWG12";
+    case SCF1WBWG12p:                             return "SCF1WBWG12p";
+    case SCF1WBWG14:                              return "SCF1WBWG14";
+    case SCF1WBWG16:                              return "SCF1WBWG16";
+    case SCF1WGWB8:                               return "SCF1WGWB8";
+    case SCF1WGWB10:                              return "SCF1WGWB10";
+    case SCF1WGWB10p:                             return "SCF1WGWB10p";
+    case SCF1WGWB12:                              return "SCF1WGWB12";
+    case SCF1WGWB12p:                             return "SCF1WGWB12p";
+    case SCF1WGWB14:                              return "SCF1WGWB14";
+    case SCF1WGWB16:                              return "SCF1WGWB16";
+    case SCF1WGWR8:                               return "SCF1WGWR8";
+    case SCF1WGWR10:                              return "SCF1WGWR10";
+    case SCF1WGWR10p:                             return "SCF1WGWR10p";
+    case SCF1WGWR12:                              return "SCF1WGWR12";
+    case SCF1WGWR12p:                             return "SCF1WGWR12p";
+    case SCF1WGWR14:                              return "SCF1WGWR14";
+    case SCF1WGWR16:                              return "SCF1WGWR16";
+    case SCF1WRWG8:                               return "SCF1WRWG8";
+    case SCF1WRWG10:                              return "SCF1WRWG10";
+    case SCF1WRWG10p:                             return "SCF1WRWG10p";
+    case SCF1WRWG12:                              return "SCF1WRWG12";
+    case SCF1WRWG12p:                             return "SCF1WRWG12p";
+    case SCF1WRWG14:                              return "SCF1WRWG14";
+    case SCF1WRWG16:                              return "SCF1WRWG16";
+    case YCbCr8:                                  return "YCbCr8";
+    case YCbCr8_CbYCr:                            return "YCbCr8_CbYCr";
+    case YCbCr10_CbYCr:                           return "YCbCr10_CbYCr";
+    case YCbCr10p_CbYCr:                          return "YCbCr10p_CbYCr";
+    case YCbCr12_CbYCr:                           return "YCbCr12_CbYCr";
+    case YCbCr12p_CbYCr:                          return "YCbCr12p_CbYCr";
+    case YCbCr411_8:                              return "YCbCr411_8";
+    case YCbCr411_8_CbYYCrYY:                     return "YCbCr411_8_CbYYCrYY";
+    case YCbCr420_8_YY_CbCr_Semiplanar:           return "YCbCr420_8_YY_CbCr_Semiplanar";
+    case YCbCr420_8_YY_CrCb_Semiplanar:           return "YCbCr420_8_YY_CrCb_Semiplanar";
+    case YCbCr422_8:                              return "YCbCr422_8";
+    case YCbCr422_8_CbYCrY:                       return "YCbCr422_8_CbYCrY";
+    case YCbCr422_8_YY_CbCr_Semiplanar:           return "YCbCr422_8_YY_CbCr_Semiplanar";
+    case YCbCr422_8_YY_CrCb_Semiplanar:           return "YCbCr422_8_YY_CrCb_Semiplanar";
+    case YCbCr422_10:                             return "YCbCr422_10";
+    case YCbCr422_10_CbYCrY:                      return "YCbCr422_10_CbYCrY";
+    case YCbCr422_10p:                            return "YCbCr422_10p";
+    case YCbCr422_10p_CbYCrY:                     return "YCbCr422_10p_CbYCrY";
+    case YCbCr422_12:                             return "YCbCr422_12";
+    case YCbCr422_12_CbYCrY:                      return "YCbCr422_12_CbYCrY";
+    case YCbCr422_12p:                            return "YCbCr422_12p";
+    case YCbCr422_12p_CbYCrY:                     return "YCbCr422_12p_CbYCrY";
+    case YCbCr601_8_CbYCr:                        return "YCbCr601_8_CbYCr";
+    case YCbCr601_10_CbYCr:                       return "YCbCr601_10_CbYCr";
+    case YCbCr601_10p_CbYCr:                      return "YCbCr601_10p_CbYCr";
+    case YCbCr601_12_CbYCr:                       return "YCbCr601_12_CbYCr";
+    case YCbCr601_12p_CbYCr:                      return "YCbCr601_12p_CbYCr";
+    case YCbCr601_411_8_CbYYCrYY:                 return "YCbCr601_411_8_CbYYCrYY";
+    case YCbCr601_422_8:                          return "YCbCr601_422_8";
+    case YCbCr601_422_8_CbYCrY:                   return "YCbCr601_422_8_CbYCrY";
+    case YCbCr601_422_10:                         return "YCbCr601_422_10";
+    case YCbCr601_422_10_CbYCrY:                  return "YCbCr601_422_10_CbYCrY";
+    case YCbCr601_422_10p:                        return "YCbCr601_422_10p";
+    case YCbCr601_422_10p_CbYCrY:                 return "YCbCr601_422_10p_CbYCrY";
+    case YCbCr601_422_12:                         return "YCbCr601_422_12";
+    case YCbCr601_422_12_CbYCrY:                  return "YCbCr601_422_12_CbYCrY";
+    case YCbCr601_422_12p:                        return "YCbCr601_422_12p";
+    case YCbCr601_422_12p_CbYCrY:                 return "YCbCr601_422_12p_CbYCrY";
+    case YCbCr709_8_CbYCr:                        return "YCbCr709_8_CbYCr";
+    case YCbCr709_10_CbYCr:                       return "YCbCr709_10_CbYCr";
+    case YCbCr709_10p_CbYCr:                      return "YCbCr709_10p_CbYCr";
+    case YCbCr709_12_CbYCr:                       return "YCbCr709_12_CbYCr";
+    case YCbCr709_12p_CbYCr:                      return "YCbCr709_12p_CbYCr";
+    case YCbCr709_411_8_CbYYCrYY:                 return "YCbCr709_411_8_CbYYCrYY";
+    case YCbCr709_422_8:                          return "YCbCr709_422_8";
+    case YCbCr709_422_8_CbYCrY:                   return "YCbCr709_422_8_CbYCrY";
+    case YCbCr709_422_10:                         return "YCbCr709_422_10";
+    case YCbCr709_422_10_CbYCrY:                  return "YCbCr709_422_10_CbYCrY";
+    case YCbCr709_422_10p:                        return "YCbCr709_422_10p";
+    case YCbCr709_422_10p_CbYCrY:                 return "YCbCr709_422_10p_CbYCrY";
+    case YCbCr709_422_12:                         return "YCbCr709_422_12";
+    case YCbCr709_422_12_CbYCrY:                  return "YCbCr709_422_12_CbYCrY";
+    case YCbCr709_422_12p:                        return "YCbCr709_422_12p";
+    case YCbCr709_422_12p_CbYCrY:                 return "YCbCr709_422_12p_CbYCrY";
+    case YCbCr2020_8_CbYCr:                       return "YCbCr2020_8_CbYCr";
+    case YCbCr2020_10_CbYCr:                      return "YCbCr2020_10_CbYCr";
+    case YCbCr2020_10p_CbYCr:                     return "YCbCr2020_10p_CbYCr";
+    case YCbCr2020_12_CbYCr:                      return "YCbCr2020_12_CbYCr";
+    case YCbCr2020_12p_CbYCr:                     return "YCbCr2020_12p_CbYCr";
+    case YCbCr2020_411_8_CbYYCrYY:                return "YCbCr2020_411_8_CbYYCrYY";
+    case YCbCr2020_422_8:                         return "YCbCr2020_422_8";
+    case YCbCr2020_422_8_CbYCrY:                  return "YCbCr2020_422_8_CbYCrY";
+    case YCbCr2020_422_10:                        return "YCbCr2020_422_10";
+    case YCbCr2020_422_10_CbYCrY:                 return "YCbCr2020_422_10_CbYCrY";
+    case YCbCr2020_422_10p:                       return "YCbCr2020_422_10p";
+    case YCbCr2020_422_10p_CbYCrY:                return "YCbCr2020_422_10p_CbYCrY";
+    case YCbCr2020_422_12:                        return "YCbCr2020_422_12";
+    case YCbCr2020_422_12_CbYCrY:                 return "YCbCr2020_422_12_CbYCrY";
+    case YCbCr2020_422_12p:                       return "YCbCr2020_422_12p";
+    case YCbCr2020_422_12p_CbYCrY:                return "YCbCr2020_422_12p_CbYCrY";
+    case YUV8_UYV:                                return "YUV8_UYV";
+    case YUV411_8_UYYVYY:                         return "YUV411_8_UYYVYY";
+    case YUV422_8:                                return "YUV422_8";
+    case YUV422_8_UYVY:                           return "YUV422_8_UYVY";
+    case Mono10Packed:                            return "Mono10Packed";
+    case Mono12Packed:                            return "Mono12Packed";
+    case BayerBG10Packed:                         return "BayerBG10Packed";
+    case BayerBG12Packed:                         return "BayerBG12Packed";
+    case BayerGB10Packed:                         return "BayerGB10Packed";
+    case BayerGB12Packed:                         return "BayerGB12Packed";
+    case BayerGR10Packed:                         return "BayerGR10Packed";
+    case BayerGR12Packed:                         return "BayerGR12Packed";
+    case BayerRG10Packed:                         return "BayerRG10Packed";
+    case BayerRG12Packed:                         return "BayerRG12Packed";
+    case RGB10V1Packed:                           return "RGB10V1Packed";
+    case RGB12V1Packed:                           return "RGB12V1Packed";
+
+    case InvalidPixelFormat: return "InvalidPixelFormat";
+
+    default: return "UnknownPixelFormat";
+  }
+}
+static PFNC_INLINE const char* GetPixelFormatDescription (PfncFormat format)
+{
+  switch (format)
+  {
+    case Mono1p:                                  return "Monochrome 1-bit packed";
+    case Mono2p:                                  return "Monochrome 2-bit packed";
+    case Mono4p:                                  return "Monochrome 4-bit packed";
+    case Mono8:                                   return "Monochrome 8-bit";
+    case Mono8s:                                  return "Monochrome 8-bit signed";
+    case Mono10:                                  return "Monochrome 10-bit unpacked";
+    case Mono10p:                                 return "Monochrome 10-bit packed";
+    case Mono12:                                  return "Monochrome 12-bit unpacked";
+    case Mono12p:                                 return "Monochrome 12-bit packed";
+    case Mono14:                                  return "Monochrome 14-bit unpacked";
+    case Mono14p:                                 return "Monochrome 14-bit packed";
+    case Mono16:                                  return "Monochrome 16-bit";
+    case Mono32:                                  return "Monochrome 32-bit";
+    case BayerBG4p:                               return "Bayer Blue-Green 4-bit packed";
+    case BayerBG8:                                return "Bayer Blue-Green 8-bit";
+    case BayerBG10:                               return "Bayer Blue-Green 10-bit unpacked";
+    case BayerBG10p:                              return "Bayer Blue-Green 10-bit packed";
+    case BayerBG12:                               return "Bayer Blue-Green 12-bit unpacked";
+    case BayerBG12p:                              return "Bayer Blue-Green 12-bit packed";
+    case BayerBG14:                               return "Bayer Blue-Green 14-bit";
+    case BayerBG14p:                              return "Bayer Blue-Green 14-bit packed";
+    case BayerBG16:                               return "Bayer Blue-Green 16-bit";
+    case BayerGB4p:                               return "Bayer Green-Blue 4-bit packed";
+    case BayerGB8:                                return "Bayer Green-Blue 8-bit";
+    case BayerGB10:                               return "Bayer Green-Blue 10-bit unpacked";
+    case BayerGB10p:                              return "Bayer Green-Blue 10-bit packed";
+    case BayerGB12:                               return "Bayer Green-Blue 12-bit unpacked";
+    case BayerGB12p:                              return "Bayer Green-Blue 12-bit packed";
+    case BayerGB14:                               return "Bayer Green-Blue 14-bit";
+    case BayerGB14p:                              return "Bayer Green-Blue 14-bit packed";
+    case BayerGB16:                               return "Bayer Green-Blue 16-bit";
+    case BayerGR4p:                               return "Bayer Green-Red 4-bit packed";
+    case BayerGR8:                                return "Bayer Green-Red 8-bit";
+    case BayerGR10:                               return "Bayer Green-Red 10-bit unpacked";
+    case BayerGR10p:                              return "Bayer Green-Red 10-bit packed";
+    case BayerGR12:                               return "Bayer Green-Red 12-bit unpacked";
+    case BayerGR12p:                              return "Bayer Green-Red 12-bit packed";
+    case BayerGR14:                               return "Bayer Green-Red 14-bit";
+    case BayerGR14p:                              return "Bayer Green-Red 14-bit packed";
+    case BayerGR16:                               return "Bayer Green-Red 16-bit";
+    case BayerRG4p:                               return "Bayer Red-Green 4-bit packed";
+    case BayerRG8:                                return "Bayer Red-Green 8-bit";
+    case BayerRG10:                               return "Bayer Red-Green 10-bit unpacked";
+    case BayerRG10p:                              return "Bayer Red-Green 10-bit packed";
+    case BayerRG12:                               return "Bayer Red-Green 12-bit unpacked";
+    case BayerRG12p:                              return "Bayer Red-Green 12-bit packed";
+    case BayerRG14:                               return "Bayer Red-Green 14-bit";
+    case BayerRG14p:                              return "Bayer Red-Green 14-bit packed";
+    case BayerRG16:                               return "Bayer Red-Green 16-bit";
+    case RGBa8:                                   return "Red-Green-Blue-alpha 8-bit";
+    case RGBa10:                                  return "Red-Green-Blue-alpha 10-bit unpacked";
+    case RGBa10p:                                 return "Red-Green-Blue-alpha 10-bit packed";
+    case RGBa12:                                  return "Red-Green-Blue-alpha 12-bit unpacked";
+    case RGBa12p:                                 return "Red-Green-Blue-alpha 12-bit packed";
+    case RGBa14:                                  return "Red-Green-Blue-alpha 14-bit unpacked";
+    case RGBa16:                                  return "Red-Green-Blue-alpha 16-bit";
+    case RGB8:                                    return "Red-Green-Blue 8-bit";
+    case RGB8_Planar:                             return "Red-Green-Blue 8-bit planar";
+    case RGB10:                                   return "Red-Green-Blue 10-bit unpacked";
+    case RGB10_Planar:                            return "Red-Green-Blue 10-bit unpacked planar";
+    case RGB10p:                                  return "Red-Green-Blue 10-bit packed";
+    case RGB10p32:                                return "Red-Green-Blue 10-bit packed into 32-bit";
+    case RGB12:                                   return "Red-Green-Blue 12-bit unpacked";
+    case RGB12_Planar:                            return "Red-Green-Blue 12-bit unpacked planar";
+    case RGB12p:                                  return "Red-Green-Blue 12-bit packed";
+    case RGB14:                                   return "Red-Green-Blue 14-bit unpacked";
+    case RGB16:                                   return "Red-Green-Blue 16-bit";
+    case RGB16_Planar:                            return "Red-Green-Blue 16-bit planar";
+    case RGB565p:                                 return "Red-Green-Blue 5/6/5-bit packed";
+    case BGRa8:                                   return "Blue-Green-Red-alpha 8-bit";
+    case BGRa10:                                  return "Blue-Green-Red-alpha 10-bit unpacked";
+    case BGRa10p:                                 return "Blue-Green-Red-alpha 10-bit packed";
+    case BGRa12:                                  return "Blue-Green-Red-alpha 12-bit unpacked";
+    case BGRa12p:                                 return "Blue-Green-Red-alpha 12-bit packed";
+    case BGRa14:                                  return "Blue-Green-Red-alpha 14-bit unpacked";
+    case BGRa16:                                  return "Blue-Green-Red-alpha 16-bit";
+    case BGR8:                                    return "Blue-Green-Red 8-bit";
+    case BGR10:                                   return "Blue-Green-Red 10-bit unpacked";
+    case BGR10p:                                  return "Blue-Green-Red 10-bit packed";
+    case BGR12:                                   return "Blue-Green-Red 12-bit unpacked";
+    case BGR12p:                                  return "Blue-Green-Red 12-bit packed";
+    case BGR14:                                   return "Blue-Green-Red 14-bit unpacked";
+    case BGR16:                                   return "Blue-Green-Red 16-bit";
+    case BGR565p:                                 return "Blue-Green-Red 5/6/5-bit packed";
+    case R8:                                      return "Red 8-bit";
+    case R10:                                     return "Red 10-bit";
+    case R12:                                     return "Red 12-bit";
+    case R16:                                     return "Red 16-bit";
+    case G8:                                      return "Green 8-bit";
+    case G10:                                     return "Green 10-bit";
+    case G12:                                     return "Green 12-bit";
+    case G16:                                     return "Green 16-bit";
+    case B8:                                      return "Blue 8-bit";
+    case B10:                                     return "Blue 10-bit";
+    case B12:                                     return "Blue 12-bit";
+    case B16:                                     return "Blue 16-bit";
+    case Coord3D_ABC8:                            return "3D coordinate A-B-C 8-bit";
+    case Coord3D_ABC8_Planar:                     return "3D coordinate A-B-C 8-bit planar";
+    case Coord3D_ABC10p:                          return "3D coordinate A-B-C 10-bit packed";
+    case Coord3D_ABC10p_Planar:                   return "3D coordinate A-B-C 10-bit packed planar";
+    case Coord3D_ABC12p:                          return "3D coordinate A-B-C 12-bit packed";
+    case Coord3D_ABC12p_Planar:                   return "3D coordinate A-B-C 12-bit packed planar";
+    case Coord3D_ABC16:                           return "3D coordinate A-B-C 16-bit";
+    case Coord3D_ABC16_Planar:                    return "3D coordinate A-B-C 16-bit planar";
+    case Coord3D_ABC32f:                          return "3D coordinate A-B-C 32-bit floating point";
+    case Coord3D_ABC32f_Planar:                   return "3D coordinate A-B-C 32-bit floating point planar";
+    case Coord3D_AC8:                             return "3D coordinate A-C 8-bit";
+    case Coord3D_AC8_Planar:                      return "3D coordinate A-C 8-bit planar";
+    case Coord3D_AC10p:                           return "3D coordinate A-C 10-bit packed";
+    case Coord3D_AC10p_Planar:                    return "3D coordinate A-C 10-bit packed planar";
+    case Coord3D_AC12p:                           return "3D coordinate A-C 12-bit packed";
+    case Coord3D_AC12p_Planar:                    return "3D coordinate A-C 12-bit packed planar";
+    case Coord3D_AC16:                            return "3D coordinate A-C 16-bit";
+    case Coord3D_AC16_Planar:                     return "3D coordinate A-C 16-bit planar";
+    case Coord3D_AC32f:                           return "3D coordinate A-C 32-bit floating point";
+    case Coord3D_AC32f_Planar:                    return "3D coordinate A-C 32-bit floating point planar";
+    case Coord3D_A8:                              return "3D coordinate A 8-bit";
+    case Coord3D_A10p:                            return "3D coordinate A 10-bit packed";
+    case Coord3D_A12p:                            return "3D coordinate A 12-bit packed";
+    case Coord3D_A16:                             return "3D coordinate A 16-bit";
+    case Coord3D_A32f:                            return "3D coordinate A 32-bit floating point";
+    case Coord3D_B8:                              return "3D coordinate B 8-bit";
+    case Coord3D_B10p:                            return "3D coordinate B 10-bit packed";
+    case Coord3D_B12p:                            return "3D coordinate B 12-bit packed";
+    case Coord3D_B16:                             return "3D coordinate B 16-bit";
+    case Coord3D_B32f:                            return "3D coordinate B 32-bit floating point";
+    case Coord3D_C8:                              return "3D coordinate C 8-bit";
+    case Coord3D_C10p:                            return "3D coordinate C 10-bit packed";
+    case Coord3D_C12p:                            return "3D coordinate C 12-bit packed";
+    case Coord3D_C16:                             return "3D coordinate C 16-bit";
+    case Coord3D_C32f:                            return "3D coordinate C 32-bit floating point";
+    case Confidence1:                             return "Confidence 1-bit unpacked";
+    case Confidence1p:                            return "Confidence 1-bit packed";
+    case Confidence8:                             return "Confidence 8-bit";
+    case Confidence16:                            return "Confidence 16-bit";
+    case Confidence32f:                           return "Confidence 32-bit floating point";
+    case BiColorBGRG8:                            return "Bi-color Blue/Green - Red/Green 8-bit";
+    case BiColorBGRG10:                           return "Bi-color Blue/Green - Red/Green 10-bit unpacked";
+    case BiColorBGRG10p:                          return "Bi-color Blue/Green - Red/Green 10-bit packed";
+    case BiColorBGRG12:                           return "Bi-color Blue/Green - Red/Green 12-bit unpacked";
+    case BiColorBGRG12p:                          return "Bi-color Blue/Green - Red/Green 12-bit packed";
+    case BiColorRGBG8:                            return "Bi-color Red/Green - Blue/Green 8-bit";
+    case BiColorRGBG10:                           return "Bi-color Red/Green - Blue/Green 10-bit unpacked";
+    case BiColorRGBG10p:                          return "Bi-color Red/Green - Blue/Green 10-bit packed";
+    case BiColorRGBG12:                           return "Bi-color Red/Green - Blue/Green 12-bit unpacked";
+    case BiColorRGBG12p:                          return "Bi-color Red/Green - Blue/Green 12-bit packed";
+    case Data8:                                   return "Data 8-bit";
+    case Data8s:                                  return "Data 8-bit signed";
+    case Data16:                                  return "Data 16-bit";
+    case Data16s:                                 return "Data 16-bit signed";
+    case Data32:                                  return "Data 32-bit";
+    case Data32f:                                 return "Data 32-bit floating point";
+    case Data32s:                                 return "Data 32-bit signed";
+    case Data64:                                  return "Data 64-bit";
+    case Data64f:                                 return "Data 64-bit floating point";
+    case Data64s:                                 return "Data 64-bit signed";
+    case SCF1WBWG8:                               return "Sparse Color Filter #1 White-Blue-White-Green 8-bit";
+    case SCF1WBWG10:                              return "Sparse Color Filter #1 White-Blue-White-Green 10-bit unpacked";
+    case SCF1WBWG10p:                             return "Sparse Color Filter #1 White-Blue-White-Green 10-bit packed";
+    case SCF1WBWG12:                              return "Sparse Color Filter #1 White-Blue-White-Green 12-bit unpacked";
+    case SCF1WBWG12p:                             return "Sparse Color Filter #1 White-Blue-White-Green 12-bit packed";
+    case SCF1WBWG14:                              return "Sparse Color Filter #1 White-Blue-White-Green 14-bit unpacked";
+    case SCF1WBWG16:                              return "Sparse Color Filter #1 White-Blue-White-Green 16-bit unpacked";
+    case SCF1WGWB8:                               return "Sparse Color Filter #1 White-Green-White-Blue 8-bit";
+    case SCF1WGWB10:                              return "Sparse Color Filter #1 White-Green-White-Blue 10-bit unpacked";
+    case SCF1WGWB10p:                             return "Sparse Color Filter #1 White-Green-White-Blue 10-bit packed";
+    case SCF1WGWB12:                              return "Sparse Color Filter #1 White-Green-White-Blue 12-bit unpacked";
+    case SCF1WGWB12p:                             return "Sparse Color Filter #1 White-Green-White-Blue 12-bit packed";
+    case SCF1WGWB14:                              return "Sparse Color Filter #1 White-Green-White-Blue 14-bit unpacked";
+    case SCF1WGWB16:                              return "Sparse Color Filter #1 White-Green-White-Blue 16-bit";
+    case SCF1WGWR8:                               return "Sparse Color Filter #1 White-Green-White-Red 8-bit";
+    case SCF1WGWR10:                              return "Sparse Color Filter #1 White-Green-White-Red 10-bit unpacked";
+    case SCF1WGWR10p:                             return "Sparse Color Filter #1 White-Green-White-Red 10-bit packed";
+    case SCF1WGWR12:                              return "Sparse Color Filter #1 White-Green-White-Red 12-bit unpacked";
+    case SCF1WGWR12p:                             return "Sparse Color Filter #1 White-Green-White-Red 12-bit packed";
+    case SCF1WGWR14:                              return "Sparse Color Filter #1 White-Green-White-Red 14-bit unpacked";
+    case SCF1WGWR16:                              return "Sparse Color Filter #1 White-Green-White-Red 16-bit";
+    case SCF1WRWG8:                               return "Sparse Color Filter #1 White-Red-White-Green 8-bit";
+    case SCF1WRWG10:                              return "Sparse Color Filter #1 White-Red-White-Green 10-bit unpacked";
+    case SCF1WRWG10p:                             return "Sparse Color Filter #1 White-Red-White-Green 10-bit packed";
+    case SCF1WRWG12:                              return "Sparse Color Filter #1 White-Red-White-Green 12-bit unpacked";
+    case SCF1WRWG12p:                             return "Sparse Color Filter #1 White-Red-White-Green 12-bit packed";
+    case SCF1WRWG14:                              return "Sparse Color Filter #1 White-Red-White-Green 14-bit unpacked";
+    case SCF1WRWG16:                              return "Sparse Color Filter #1 White-Red-White-Green 16-bit";
+    case YCbCr8:                                  return "YCbCr 4:4:4 8-bit";
+    case YCbCr8_CbYCr:                            return "YCbCr 4:4:4 8-bit";
+    case YCbCr10_CbYCr:                           return "YCbCr 4:4:4 10-bit unpacked";
+    case YCbCr10p_CbYCr:                          return "YCbCr 4:4:4 10-bit packed";
+    case YCbCr12_CbYCr:                           return "YCbCr 4:4:4 12-bit unpacked";
+    case YCbCr12p_CbYCr:                          return "YCbCr 4:4:4 12-bit packed";
+    case YCbCr411_8:                              return "YCbCr 4:1:1 8-bit";
+    case YCbCr411_8_CbYYCrYY:                     return "YCbCr 4:1:1 8-bit";
+    case YCbCr420_8_YY_CbCr_Semiplanar:           return "YCbCr 4:2:0 8-bit YY/CbCr Semiplanar";
+    case YCbCr420_8_YY_CrCb_Semiplanar:           return "YCbCr 4:2:0 8-bit YY/CrCb Semiplanar";
+    case YCbCr422_8:                              return "YCbCr 4:2:2 8-bit";
+    case YCbCr422_8_CbYCrY:                       return "YCbCr 4:2:2 8-bit";
+    case YCbCr422_8_YY_CbCr_Semiplanar:           return "YCbCr 4:2:2 8-bit YY/CbCr Semiplanar";
+    case YCbCr422_8_YY_CrCb_Semiplanar:           return "YCbCr 4:2:2 8-bit YY/CrCb Semiplanar";
+    case YCbCr422_10:                             return "YCbCr 4:2:2 10-bit unpacked";
+    case YCbCr422_10_CbYCrY:                      return "YCbCr 4:2:2 10-bit unpacked";
+    case YCbCr422_10p:                            return "YCbCr 4:2:2 10-bit packed";
+    case YCbCr422_10p_CbYCrY:                     return "YCbCr 4:2:2 10-bit packed";
+    case YCbCr422_12:                             return "YCbCr 4:2:2 12-bit unpacked";
+    case YCbCr422_12_CbYCrY:                      return "YCbCr 4:2:2 12-bit unpacked";
+    case YCbCr422_12p:                            return "YCbCr 4:2:2 12-bit packed";
+    case YCbCr422_12p_CbYCrY:                     return "YCbCr 4:2:2 12-bit packed";
+    case YCbCr601_8_CbYCr:                        return "YCbCr 4:4:4 8-bit BT.601";
+    case YCbCr601_10_CbYCr:                       return "YCbCr 4:4:4 10-bit unpacked BT.601";
+    case YCbCr601_10p_CbYCr:                      return "YCbCr 4:4:4 10-bit packed BT.601";
+    case YCbCr601_12_CbYCr:                       return "YCbCr 4:4:4 12-bit unpacked BT.601";
+    case YCbCr601_12p_CbYCr:                      return "YCbCr 4:4:4 12-bit packed BT.601";
+    case YCbCr601_411_8_CbYYCrYY:                 return "YCbCr 4:1:1 8-bit BT.601";
+    case YCbCr601_422_8:                          return "YCbCr 4:2:2 8-bit BT.601";
+    case YCbCr601_422_8_CbYCrY:                   return "YCbCr 4:2:2 8-bit BT.601";
+    case YCbCr601_422_10:                         return "YCbCr 4:2:2 10-bit unpacked BT.601";
+    case YCbCr601_422_10_CbYCrY:                  return "YCbCr 4:2:2 10-bit unpacked BT.601";
+    case YCbCr601_422_10p:                        return "YCbCr 4:2:2 10-bit packed BT.601";
+    case YCbCr601_422_10p_CbYCrY:                 return "YCbCr 4:2:2 10-bit packed BT.601";
+    case YCbCr601_422_12:                         return "YCbCr 4:2:2 12-bit unpacked BT.601";
+    case YCbCr601_422_12_CbYCrY:                  return "YCbCr 4:2:2 12-bit unpacked BT.601";
+    case YCbCr601_422_12p:                        return "YCbCr 4:2:2 12-bit packed BT.601";
+    case YCbCr601_422_12p_CbYCrY:                 return "YCbCr 4:2:2 12-bit packed BT.601";
+    case YCbCr709_8_CbYCr:                        return "YCbCr 4:4:4 8-bit BT.709";
+    case YCbCr709_10_CbYCr:                       return "YCbCr 4:4:4 10-bit unpacked BT.709";
+    case YCbCr709_10p_CbYCr:                      return "YCbCr 4:4:4 10-bit packed BT.709";
+    case YCbCr709_12_CbYCr:                       return "YCbCr 4:4:4 12-bit unpacked BT.709";
+    case YCbCr709_12p_CbYCr:                      return "YCbCr 4:4:4 12-bit packed BT.709";
+    case YCbCr709_411_8_CbYYCrYY:                 return "YCbCr 4:1:1 8-bit BT.709";
+    case YCbCr709_422_8:                          return "YCbCr 4:2:2 8-bit BT.709";
+    case YCbCr709_422_8_CbYCrY:                   return "YCbCr 4:2:2 8-bit BT.709";
+    case YCbCr709_422_10:                         return "YCbCr 4:2:2 10-bit unpacked BT.709";
+    case YCbCr709_422_10_CbYCrY:                  return "YCbCr 4:2:2 10-bit unpacked BT.709";
+    case YCbCr709_422_10p:                        return "YCbCr 4:2:2 10-bit packed BT.709";
+    case YCbCr709_422_10p_CbYCrY:                 return "YCbCr 4:2:2 10-bit packed BT.709";
+    case YCbCr709_422_12:                         return "YCbCr 4:2:2 12-bit unpacked BT.709";
+    case YCbCr709_422_12_CbYCrY:                  return "YCbCr 4:2:2 12-bit unpacked BT.709";
+    case YCbCr709_422_12p:                        return "YCbCr 4:2:2 12-bit packed BT.709";
+    case YCbCr709_422_12p_CbYCrY:                 return "YCbCr 4:2:2 12-bit packed BT.709";
+    case YCbCr2020_8_CbYCr:                       return "YCbCr 4:4:4 8-bit BT.2020";
+    case YCbCr2020_10_CbYCr:                      return "YCbCr 4:4:4 10-bit unpacked BT.2020";
+    case YCbCr2020_10p_CbYCr:                     return "YCbCr 4:4:4 10-bit packed BT.2020";
+    case YCbCr2020_12_CbYCr:                      return "YCbCr 4:4:4 12-bit unpacked BT.2020";
+    case YCbCr2020_12p_CbYCr:                     return "YCbCr 4:4:4 12-bit packed BT.2020";
+    case YCbCr2020_411_8_CbYYCrYY:                return "YCbCr 4:1:1 8-bit BT.2020";
+    case YCbCr2020_422_8:                         return "YCbCr 4:2:2 8-bit BT.2020";
+    case YCbCr2020_422_8_CbYCrY:                  return "YCbCr 4:2:2 8-bit BT.2020";
+    case YCbCr2020_422_10:                        return "YCbCr 4:2:2 10-bit unpacked BT.2020";
+    case YCbCr2020_422_10_CbYCrY:                 return "YCbCr 4:2:2 10-bit unpacked BT.2020";
+    case YCbCr2020_422_10p:                       return "YCbCr 4:2:2 10-bit packed BT.2020";
+    case YCbCr2020_422_10p_CbYCrY:                return "YCbCr 4:2:2 10-bit packed BT.2020";
+    case YCbCr2020_422_12:                        return "YCbCr 4:2:2 12-bit unpacked BT.2020";
+    case YCbCr2020_422_12_CbYCrY:                 return "YCbCr 4:2:2 12-bit unpacked BT.2020";
+    case YCbCr2020_422_12p:                       return "YCbCr 4:2:2 12-bit packed BT.2020";
+    case YCbCr2020_422_12p_CbYCrY:                return "YCbCr 4:2:2 12-bit packed BT.2020";
+    case YUV8_UYV:                                return "YUV 4:4:4 8-bit";
+    case YUV411_8_UYYVYY:                         return "YUV 4:1:1 8-bit";
+    case YUV422_8:                                return "YUV 4:2:2 8-bit";
+    case YUV422_8_UYVY:                           return "YUV 4:2:2 8-bit";
+    case Mono10Packed:                            return "Monochrome 10-bit packed";
+    case Mono12Packed:                            return "Monochrome 12-bit packed";
+    case BayerBG10Packed:                         return "Bayer Blue-Green 10-bit packed";
+    case BayerBG12Packed:                         return "Bayer Blue-Green 12-bit packed";
+    case BayerGB10Packed:                         return "Bayer Green-Blue 10-bit packed";
+    case BayerGB12Packed:                         return "Bayer Green-Blue 12-bit packed";
+    case BayerGR10Packed:                         return "Bayer Green-Red 10-bit packed";
+    case BayerGR12Packed:                         return "Bayer Green-Red 12-bit packed";
+    case BayerRG10Packed:                         return "Bayer Red-Green 10-bit packed";
+    case BayerRG12Packed:                         return "Bayer Red-Green 12-bit packed";
+    case RGB10V1Packed:                           return "Red-Green-Blue 10-bit packed - variant 1";
+    case RGB12V1Packed:                           return "Red-Green-Blue 12-bit packed - variant 1";
+
+    case InvalidPixelFormat: return "Invalid pixel format value";
+
+    default: return "Unknown pixel format value";
+  }
+}
+#endif /* PFNC_INCLUDE_HELPERS */
+
+
+#endif /* PFNC_H */
diff --git a/Lib/Matrox/Include/MILDyn/mil3ddisp.h b/Lib/Matrox/Include/MILDyn/mil3ddisp.h
new file mode 100644
index 0000000..bd8cfd7
--- /dev/null
+++ b/Lib/Matrox/Include/MILDyn/mil3ddisp.h
@@ -0,0 +1,524 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MIL3DDISP.H
+// Content           :  Define for the MIL 3DDISP module
+// Revision          :  10.40.0640
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+
+#ifndef __MIL3DDISP_H__
+#define __MIL3DDISP_H__
+
+// None of this should clash with disp (2d) controls so that if we want to forward them to the
+// 2d display it will be trivial. Should also reuse creation types from 2d.
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+   extern "C"
+      {
+#endif
+
+typedef MIL_INT(MFTYPE *MIL_3DDISP_HOOK_FUNCTION_PTR)(MIL_INT HookType,
+                                                     MIL_ID  EventId,
+                                                     void    *UserDataPtr);
+
+#define M_VTK_TRACKBALL                                        0x00000002L                                         
+#define M_VTK_TERRAIN                                          0x00000003L 
+#define M_TEST_OPENGL                                          0x00000004L 
+#define M_VTK_WINDOW                                           0x00000020L // Reserved in mildisplay.h
+
+// M3ddispSelect  
+#define M_OPEN                                                 0x00000010L // Already defined from mil.h
+#define M_CLOSE                                                0x00000020L // Already defined from mil.h
+#define M_ADD                                                  0x0000L     // Already defined in milocr.h, milim.h
+#define M_REMOVE                                               0x00000004L // Already defined in milim.h
+#define M_SELECT                                               3977L
+
+// These should not clash with disp2d
+// M3ddispAlloc
+//#define M_WINDOWED_DISPLAY                                     0L
+#define M_MIL_BUFFER_WINDOW                                    2L
+#define M_WEB                                                  0x00800000L // Already defined in mil.h, mildisplay.h
+
+// M3ddispControl types
+#define M_3D_GRAPHIC_LIST_ID                                    4111
+#define M_ROTATION_INDICATOR                                    4627
+#define M_BACKGROUND_IMAGE                                      4628
+#define M_BACKGROUND_IMAGE_SIZE_X                               4629
+#define M_BACKGROUND_IMAGE_SIZE_Y                               4630
+#define M_BACKGROUND_IMAGE_SIZE_BAND                            4631
+#define M_AUTO_ROTATE                                           4633
+#define M_ROTATION_SPEED                                        4634
+#define M_ROTATION_AXIS                                         4636
+
+#define M_ACTION_KEY_TRANSLATE_FORWARD                          4638
+#define M_ACTION_KEY_TRANSLATE_BACKWARD                         4639
+#define M_ACTION_KEY_TRANSLATE_DOWN                             2755L
+#define M_ACTION_KEY_TRANSLATE_LEFT                             2756L
+#define M_ACTION_KEY_TRANSLATE_RIGHT                            2757L
+#define M_ACTION_KEY_TRANSLATE_UP                               2758L
+#define M_ACTION_KEY_ROLL_LEFT                                  4640
+#define M_ACTION_KEY_ROLL_RIGHT                                 4641
+#define M_ACTION_KEY_ORBIT_LEFT                                 4642
+#define M_ACTION_KEY_ORBIT_RIGHT                                4643
+#define M_ACTION_KEY_ORBIT_UP                                   4644
+#define M_ACTION_KEY_ORBIT_DOWN                                 4645
+#define M_ACTION_KEY_TURN_LEFT                                  4646
+#define M_ACTION_KEY_TURN_RIGHT                                 4647
+#define M_ACTION_KEY_TURN_UP                                    4648
+#define M_ACTION_KEY_TURN_DOWN                                  4649
+#define M_ACTION_KEY_ZOOM_IN                                    4650
+#define M_ACTION_KEY_ZOOM_OUT                                   4651
+#define M_ACTION_KEY_RESET                                      4652
+#define M_ALTERNATE_SPEED_FACTOR                                4653
+#define M_BACKGROUND_COLOR_GRADIENT                             4654
+#define M_ACTION_KEY_AUTO_ROTATE                                4658
+#define M_ACTION_KEY_ORIENTATION_TOP_VIEW                       4659
+#define M_ACTION_KEY_ORIENTATION_BOTTOM_VIEW                    4660
+#define M_ACTION_KEY_ORIENTATION_FRONT_VIEW                     4661
+#define M_ACTION_KEY_ORIENTATION_REAR_VIEW                      4662
+#define M_ACTION_KEY_ORIENTATION_LEFT_VIEW                      4663
+#define M_ACTION_KEY_ORIENTATION_RIGHT_VIEW                     4664
+#define M_ACTION_KEY_ORIENTATION_TOP_TILTED                     4665
+#define M_ACTION_KEY_ORIENTATION_BOTTOM_TILTED                  4666
+
+#define M_ACTION_MODIFIER_SPEED                       		    2759L
+
+#define M_DISP_CONTROL_START                                    10000L                              // Already defined in mildisplay.h (10000L)
+#define M_BACKGROUND_COLOR                                      (M_DISP_CONTROL_START+66L)          // Already defined in mildisplay.h (10066) M_LOCAL_DISPLAY_CONTROL
+#define M_TITLE                                                 (7702L|M_CLIENT_ENCODING)           // Already defined in mildisplay.h M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SYNC                                          (M_DISP_CONTROL_START+47L)          // Already defined in mildisplay.h (10047) M_LOCAL_DISPLAY_CONTROL
+#define M_QT_MODE                                               (M_DISP_CONTROL_START+151L)         // already defined in mildisplay.h (10151) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURSOR                                         (M_DISP_CONTROL_START+199L)         // already defined in mildisplay.h (10199) M_LOCAL_DISPLAY_CONTROL
+#define M_SELECTED                                              1103L //M_REMOTE_DISPLAY_CONTROL   // Already defined in mildisplay.h
+#define M_DISPLAY_SURFACE                                       1121L                              // Already defined in mildisplay.h M_LOCAL_DISPLAY_CONTROL          
+#define M_WPF_DISPLAY_BUFFER_ID                                 M_DISPLAY_SURFACE                  // Already defined in mildisplay.h           
+#define M_WINDOW_INITIAL_POSITION_X                             3088L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_WINDOW_INITIAL_POSITION_Y                             3089L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_WINDOW_HANDLE                                         3110L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_MOUSE_USE                                             3219L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_KEYBOARD_USE                                          3155L //M_LOCAL_DISPLAY_CONTROL    // Already defined in mildisplay.h
+#define M_SAVE_INTERNAL_BUFFERS                                (M_DISP_CONTROL_START+26L) //(10026) M_LOCAL_DISPLAY_CONTROL Already defined in mildisplay.h
+
+#define M_BACKGROUND_MODE                                       12L //already defined
+#define M_SINGLE_COLOR                                          3969 
+#define M_GRADIENT_VERTICAL                                     3970
+#define M_STRING_SIZE                                    MAKE_INT64(0x0000050000000000)
+#define M_UPDATE                                                3199L                     //M_REMOTE_DISPLAY_CONTROL defined in mildisplay.h
+#define M_SIZE_X                                                1536L       // Already defined in    milcode.h, mil.h
+#define M_SIZE_Y                                                1537L       // Already defined in    milcode.h, mil.h
+#define M_ENABLE_ON_MOUSE_CLICK                                 3973L
+                                                                                                              
+// M3ddispControl
+// MIL_DOUBLE
+#define M_FOV_HORIZONTAL_ANGLE                                  4667
+#define M_FOV_VERTICAL_ANGLE                                    4668
+
+// List of 2d values that are whitelisted
+#ifdef __cplusplus       
+      inline bool In2dDisplayControlsWhiteList(MIL_INT64 ControlType)
+         {
+         switch(ControlType)
+            {
+            case M_QT_MODE:
+            case M_WPF_DISPLAY_BUFFER_ID:
+            case M_DISPLAY_SYNC:
+            case M_WINDOW_CURSOR:
+            case M_WINDOW_HANDLE:
+            case M_SELECTED:
+            case M_SAVE_INTERNAL_BUFFERS:
+               return true;
+            default:
+               return false;
+
+            }
+         }
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+//Dispcontrol values
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define M_RED                                                            0x08L
+#define M_GREEN                                                          0x10L
+#define M_BLUE                                                           0x20L
+
+#define M_ENABLE                                                        -9997L                              // Already defined in    milblob.h, milcal.h, milmeas.h, mil.h, miledge.h
+#define M_DISABLE                                                       -9999L                              // Already defined in    milblob.h, milcal.h, milmeas.h, mil.h, miledge.h
+
+#define M_NOW                                                              29L
+#define M_ALLOCATION_FAILURE_REAL_TEST_FLAG                               971L // Also in milblob.h
+////////////////////////////////////////////////////////////////////////////////
+
+// M3ddispSet/GetViewpoint
+#define M_VIEW_MATRIX                                                    4161L
+#define M_TRAVEL                                                         4162L
+#define M_VIEWPOINT                                                      4163L
+#define M_INTEREST_POINT                                                 4164L
+#define M_UP_VECTOR                                                      4165L
+#define M_VIEW_BOX                                                       4166L
+#define M_NO_REFRESH                                                     4167L
+#define M_TOP_VIEW                                                       4168L
+#define M_BOTTOM_VIEW                                                    4169L
+#define M_LEFT_VIEW                                                      4170L
+#define M_RIGHT_VIEW                                                     4171L
+#define M_FRONT_VIEW                                                     4172L
+#define M_REAR_VIEW                                                      4173L
+#define M_TOP_TILTED                                                     4174L
+#define M_BOTTOM_TILTED                                                  4175L
+#define M_ORBIT_HORIZONTAL                                               4177L
+#define M_ORBIT_VERTICAL                                                 4178L
+#define M_AZIM_ELEV_ROLL                                                    4L  // already defined in milreg.h
+#define M_TRANSLATE                                                         5L  // already defined in mil.h
+#define M_DISTANCE                                                 0x00080000L  // already defined in milim.h
+#define M_FLIP                                                     0x00010000L  // already defined in milim.h
+#define M_ELEVATION                                                        49L  // already defined in milreg.h
+#define M_AZIMUTH                                                          50L  // already defined in milreg.h
+#define M_ROLL                                                             51L  // already defined in milreg.h
+#define M_VIEW_ORIENTATION                                         0x00200000L
+#define M_TRANSFORM_TYPES_SHIFT                                             8L  // =utilities=   (also defined in milcal.h)
+#define M_MOVE_INTEREST_POINT                     (128 << M_TRANSFORM_TYPES_SHIFT)
+////////////////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+// Hook values
+////////////////////////////////////////////////////////////////////////////////////////////////
+#define M_OBJ_HOOK_MODULE_RANGE_START                 0x00000FE00L    // Already defined in mil.h
+#define M_OBJ_HOOK_MODULE_RANGE_END                   0x00000FFFFL    // Already defined in mil.h
+
+// 3ddisplay hook
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+   // M3ddisp calls
+   void      MFTYPE M3ddispControlInt64(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_INT64 ControlValue);
+   void      MFTYPE M3ddispControlDouble(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue);
+   void      MFTYPE M3ddispFree(MIL_ID Disp3dId);
+   MIL_INT64 MFTYPE M3ddispInquire(MIL_ID Disp3dId, MIL_INT64 InquireType, void *UserVarPtr);
+   MIL_INT64 MFTYPE M3ddispSelect(MIL_ID Disp3dId, MIL_ID ContainerOrImageBufId, MIL_INT64 Option, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3ddispSelectWindow(MIL_ID Disp3dId, MIL_ID ContainerOrImageBufId, MIL_INT64 Option, MIL_INT64 ControlFlag, MIL_WINDOW_HANDLE ClientWindowHandle);
+   void      MFTYPE M3ddispSetViewDouble(MIL_ID Disp3dId, MIL_INT64 Mode, const MIL_DOUBLE Param1, const MIL_DOUBLE Param2, const MIL_DOUBLE Param3, MIL_INT64   ControlFlag);
+   void      MFTYPE M3ddispGetView(MIL_ID Disp3dId, MIL_INT64 Mode, MIL_DOUBLE* Param1Ptr, MIL_DOUBLE* Param2Ptr, MIL_DOUBLE* Param3Ptr, MIL_INT64   ControlFlag);
+   void      MFTYPE M3ddispCopy(MIL_ID SrcMilObjectId, MIL_ID DstMilObjectId, MIL_INT64 CopyType, MIL_INT64 ControlFlag);
+   void      MFTYPE M3ddispMessage(MIL_ID Disp3dId, MIL_INT64 EventType, MIL_INT64 MousePositionX, MIL_INT64 MousePositionY, MIL_INT64 EventValue, MIL_INT64 CombinationKeys, MIL_INT64 UserValue);
+   void      MFTYPE M3ddispHookFunction(MIL_ID Disp3dId, MIL_INT HookType, MIL_3DDISP_HOOK_FUNCTION_PTR HookHandlerPtr, void* UserDataPtr);
+   MIL_INT64 MFTYPE M3ddispGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+
+   // For CAPI calls with strings
+#if M_MIL_USE_UNICODE
+   MIL_ID    MFTYPE M3ddispAllocA(MIL_ID SysId, MIL_INT64 DispNum, MIL_CONST_TEXTA_PTR DispFormat, MIL_INT64 InitFlag, MIL_ID *Disp3dIdPtr);
+   MIL_ID    MFTYPE M3ddispAllocW(MIL_ID SysId, MIL_INT64 DispNum, MIL_CONST_TEXTW_PTR DispFormat, MIL_INT64 InitFlag, MIL_ID *Disp3dIdPtr);
+
+   // create default calls
+#if M_MIL_UNICODE_API
+#define M3ddispAlloc M3ddispAllocW
+#else
+#define M3ddispAlloc M3ddispAllocA
+#endif
+
+#else
+   MIL_ID    MFTYPE M3ddispAlloc(MIL_ID SysId, MIL_INT64 DispNum, MIL_CONST_TEXT_PTR DispFormat, MIL_INT64 InitFlag, MIL_ID *Display3dIdPtr);
+#endif
+
+#ifdef __cplusplus
+   inline bool In3ddispInquireDoubleRange(MIL_INT64 InquireType)
+      {
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         {
+         return false;
+         }
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_ALLOCATION_FAILURE_REAL_TEST_FLAG:
+         case M_FOV_HORIZONTAL_ANGLE:
+         case M_FOV_VERTICAL_ANGLE:
+         case M_ALTERNATE_SPEED_FACTOR:
+         case M_ROTATION_SPEED:
+         {
+         return true;
+         }
+
+         default:
+         {
+         break;
+         }
+         }
+
+      return false;
+      }
+   inline bool In3ddispInquireIdRange(MIL_INT64 InquireType)
+      {
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_3D_GRAPHIC_LIST_ID:
+            return true;
+
+         default:
+            break;
+         }
+      return false;
+      }
+   inline bool In3ddispInquireStringRange(MIL_INT64 InquireType)
+      {
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         {
+         return false;
+         }
+
+      switch(M_STRIP_CLIENT_TEXT_ENCODING(M_STRIP_INQ_COMBOFLAGS(InquireType)))
+         {
+         case M_STRIP_CLIENT_TEXT_ENCODING(M_TITLE):
+         {
+         return true;
+         }
+
+         default:
+         {
+         break;
+         }
+         }
+
+      return false;
+      }
+   inline bool In3ddispInquireInt64Range(MIL_INT64 InquireType)
+      {
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_BACKGROUND_COLOR:
+            return true;
+
+         default:
+            break;
+         }
+
+      return false;
+      }
+   inline bool M3ddispInquireMustHaveUserPtr(MIL_INT64 InquireType)
+      {
+      const MIL_INT64 ForcedDataType = MinquireOverrides(M_STRIP_HLVLDATATYPE(InquireType), M_TYPE_MIL_INT);
+      if(ForcedDataType != 0)
+         {
+         return false;
+         }
+      return In3ddispInquireStringRange(InquireType) || In3ddispInquireDoubleRange(InquireType);
+      }
+   #endif // __cplusplus
+   /* C++ directive if needed */
+#ifdef __cplusplus
+   }
+#endif
+
+#ifdef __cplusplus
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
+   {
+   M3ddispControlDouble(Disp3dId, ControlType, ControlValue);
+   }
+
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_INT64 ControlValue)
+   {
+   M3ddispControlInt64(Disp3dId, ControlType, ControlValue);
+   }
+
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   M3ddispControlInt64(Disp3dId, ControlType, ControlValue);
+   }
+
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, int ControlValue)
+   {
+   M3ddispControlInt64(Disp3dId, ControlType, ControlValue);
+   }
+#endif
+
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   M3ddispControl(Disp3dId, ControlType, (MIL_INT)ControlValue);
+   }
+#else
+#define M3ddispControl      M3ddispControlDouble
+#endif
+
+#ifdef __cplusplus
+inline MIL_INT64 M3ddispInquireDataType(MIL_INT64 InquireType)
+   {
+   const MIL_INT64 ForcedDataType = MinquireOverrides(InquireType, M_TYPE_MIL_INT);
+   if(ForcedDataType != 0)
+      return ForcedDataType;
+  
+   if(In3ddispInquireIdRange(InquireType))
+      {
+      return M_TYPE_MIL_ID;
+      }
+   if(In3ddispInquireStringRange(InquireType))
+      {
+      return M_TYPE_TEXT_CHAR;
+      }
+   if(In3ddispInquireInt64Range(InquireType))
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   if(In3ddispInquireDoubleRange(InquireType))
+      {
+      return M_TYPE_MIL_DOUBLE;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+#if M_MIL_USE_SAFE_TYPE
+// ----------------------------------------------------------
+// M3ddispInquire
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   bool MustHaveUserPointer = M3ddispInquireMustHaveUserPtr(InquireType);
+
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("M3ddispInquire"));
+
+   if(!UserVarPtr && MustHaveUserPointer)
+      SafeTypeError(MIL_TEXT("M3ddispInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+   return M3ddispInquire(Disp3dId, InquireType, NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   bool MustHaveUserPointer = M3ddispInquireMustHaveUserPtr(InquireType);
+
+   if(MustHaveUserPointer)
+      SafeTypeError(MIL_TEXT("M3ddispInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+   return M3ddispInquire(Disp3dId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT64 MFTYPE M3ddispInquireSafeTypeExecute(MIL_ID Disp3dId, MIL_INT64  InquireType, void  *UserVarPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64 RequiredType = M_NULL;
+   // Looking for M_TYPE flags
+   RequiredType = M3ddispInquireDataType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if(RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("M3ddispInquire"));
+      }
+
+   return M3ddispInquire(Disp3dId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT64 MFTYPE M3ddispInquireUnsafe(MIL_ID Disp3dId, MIL_INT64  InquireType, void        *UserVarPtr) { return M3ddispInquire(Disp3dId, InquireType, UserVarPtr); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_INT8*   UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_CHAR); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_INT16*  UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_INT32   *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_INT64   *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_FLOAT   *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_FLOAT); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_DOUBLE  *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_DOUBLE); }
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_UINT8*   UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_CHAR); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_UINT16*  UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_UINT32  *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_UINT64  *UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T                                                      
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, wchar_t*    UserVarPtr) { return M3ddispInquireSafeTypeExecute(Disp3dId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR); }
+#endif
+
+#define M3ddispInquire          M3ddispInquireSafeType
+#else // #if M_MIL_USE_SAFE_TYPE
+
+#define M3ddispInquireUnsafe    M3ddispInquire 
+
+#endif // #if M_MIL_USE_SAFE_TYPE
+
+#endif //__cplusplus
+
+#if M_MIL_USE_STRING
+inline MIL_ID    MFTYPE M3ddispAlloc(MIL_ID SysId, MIL_INT64 DispNum, const MIL_STRING& ControlFlag, MIL_INT64 InitFlag, MIL_ID *Display3dIdPtr)
+   {
+   return M3ddispAlloc(SysId, DispNum, ControlFlag.c_str(), InitFlag, Display3dIdPtr);
+   }
+#if M_MIL_USE_SAFE_TYPE
+
+inline MIL_INT64 MFTYPE M3ddispInquireSafeType(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_STRING& UserVarPtr)
+   {
+   MIL_INT64 RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   if(!In3ddispInquireStringRange(InquireType))
+      {
+      SafeTypeError(MIL_TEXT("M3ddispInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+
+   M3ddispInquire(Disp3dId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = M3ddispInquire(Disp3dId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+
+      }
+
+   return RetValue;
+   }
+#else
+inline MIL_INT64 MFTYPE M3ddispInquire(MIL_ID Disp3dId, MIL_INT64  InquireType, MIL_STRING& UserVarPtr)
+   {
+   MIL_INT64 RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   M3ddispInquire(Disp3dId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = M3ddispInquire(Disp3dId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif // #if M_MIL_USE_SAFE_TYPE
+inline void M3ddispControl(MIL_ID Disp3dId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+   M3ddispControl(Disp3dId, ControlType, M_PTR_TO_MIL_INT(ControlValue.c_str()));
+   }
+
+#endif /* M_MIL_USE_STRING */
+// Automatic double casting
+#define M3ddispSetView(Disp3dId, Mode, Param1, Param2, Param3, ControlFlag) \
+        M3ddispSetViewDouble(Disp3dId, Mode, M_MILID_TO_DOUBLE(Param1), M_MILID_TO_DOUBLE(Param2), M_MILID_TO_DOUBLE(Param3), ControlFlag)
+////////////////////////////////////////////////////////////////////////////////
+//  MIL_UNIQUE_ID  support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+#if M_MIL_USE_SAFE_TYPE
+template <> inline bool MilIsCorrectObjectType<&M3ddispFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_3D_DISPLAY;;
+   }
+#endif
+typedef MIL_UNIQUE_ID<&M3ddispFree> MIL_UNIQUE_3DDISP_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+//3DDISP
+inline MIL_UNIQUE_3DDISP_ID M3ddispAlloc(MIL_ID SysId, MIL_INT DispNum, MIL_CONST_TEXT_PTR ControlFlag, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_3DDISP_ID(M3ddispAlloc(SysId, DispNum, ControlFlag, InitFlag, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void M3ddispFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+// End of MIL_UNIQUE_ID support
+
+#endif // __MIL3DDISP_H__
diff --git a/Lib/Matrox/Include/MILDyn/mil3dgeo.h b/Lib/Matrox/Include/MILDyn/mil3dgeo.h
new file mode 100644
index 0000000..cb27025
--- /dev/null
+++ b/Lib/Matrox/Include/MILDyn/mil3dgeo.h
@@ -0,0 +1,740 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MIL3DGEO.H
+// Content           :  Define for the MIL 3D module
+// Revision          :  10.40.0640
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+
+#ifndef __MIL3DGEO_H__
+#define __MIL3DGEO_H__
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+// M3DGEO
+////////////////////////////////////////////////////////////////////////////////////////////////
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+   {
+#endif
+#define M_GEOMETRY_TYPE                                     1321L 
+#define M_GEOMETRY                                          1306L // Already defined
+#define M_PLANE                                             1353L // Already defined in 3dmap
+#define M_SPHERE                                            2931L
+#define M_CYLINDER                                          3656
+#define M_BOX                                               0x101L      // Already defined in    milblob.h
+#define M_LINE                                         0x00000080L   // Already defined
+#define M_UNCHANGED                                    0x40000005L // Already defined
+//BoX
+#define M_SIZE_X                                            1536L    //Already defined elsewhere
+#define M_SIZE_Y                                            1537L    //Already defined elsewhere
+#define M_SIZE_Z                                            1538L // also in mil.h
+#define M_AXIS_ALIGNED                                 0x00040000 // Already defined in mil.h
+#define M_BOX_ORIENTATION                                    3814
+#define M_CORNER_X(N)                                     (1221L + (N)+ ((N) > 3 ? 2595 : 0))
+#define M_CORNER_Y(N)                                     (1225L + (N)+ ((N) > 3 ? 2595 : 0))
+#define M_CORNER_Z(N)                                     (3828+(N))
+#define M_CORNER_X_ALL                                     3847                     
+#define M_CORNER_Y_ALL                                     3848
+#define M_CORNER_Z_ALL                                     3849
+#define M_UNROTATED_MIN_X                                  3850
+#define M_UNROTATED_MIN_Y                                  3851
+#define M_UNROTATED_MIN_Z                                  3852
+#define M_UNROTATED_MAX_X                                  3853
+#define M_UNROTATED_MAX_Y                                  3854
+#define M_UNROTATED_MAX_Z                                  3855
+#define M_ORIENTATION_UNCHANGED                            0x8000L
+//Plane type
+#define M_COEFFICIENTS                                       3388
+#define M_POINT_AND_NORMAL                                   3389
+#define M_THREE_POINTS                                       3390
+#define M_POINT_AND_TWO_VECTORS                              3391
+//Sphere
+#define M_CENTER_Z                                           3400
+#define M_RADIUS                                       0x00000040L       // Already defined in MilMod.h
+//Plane
+#define M_COEFFICIENT_A                                     3401
+#define M_COEFFICIENT_B                                     3402
+#define M_COEFFICIENT_C                                     3403
+#define M_COEFFICIENT_D                                     3404
+#define M_NORMAL_X                                          3537
+#define M_NORMAL_Y                                          3538
+#define M_NORMAL_Z                                          3539
+#define M_CLOSEST_TO_ORIGIN_X                               3540
+#define M_CLOSEST_TO_ORIGIN_Y                               3541
+#define M_CLOSEST_TO_ORIGIN_Z                               3542
+//Cylinder
+#define M_TWO_POINTS                                        3657
+#define M_START_POINT_X                                     3658
+#define M_START_POINT_Y                                     3659                               
+#define M_START_POINT_Z                                     3660
+#define M_END_POINT_X                                       3661
+#define M_END_POINT_Y                                       3662
+#define M_END_POINT_Z                                       3663
+#define M_AXIS_X                                            3664
+#define M_AXIS_Y                                            3665
+#define M_AXIS_Z                                            3666
+#define M_INFINITE                                            -1L // Also defined in Mil.h
+#define M_POINT_AND_VECTOR                                  4670
+//SetMatrix
+#define M_TRANSFORMATION_MATRIX                               72L  // Already defined in milreg.h
+#define M_TRANSFORM_TYPES_SHIFT                   8L  // =utilities=   (also defined in milcal.h)
+#define M_ASSIGN                                (1 << M_TRANSFORM_TYPES_SHIFT)      /* (also defined in milcal.h) */
+#define M_COMPOSE_WITH_CURRENT                  (2 << M_TRANSFORM_TYPES_SHIFT)      /* (also defined in milcal.h) */
+
+
+#define M_TRANSFORMATION_TYPE                                      3L    // Already defined in Milreg.h
+#define M_INVERSE                                             0x00100
+#define M_IDENTITY                                           6L // already defined in milcal.h
+#define M_TRANSLATION                                        1L // already defined in milcal.h 
+#define M_ROTATION                                           3410
+#define M_RIGID                                              3411 
+#define M_SCALE_UNIFORM                                      3413   
+#define M_SIMILARITY                                         3415
+#define M_AFFINE                                             3416
+#define M_PROJECTION                                         3417
+#define M_COMPOSE_TWO_MATRICES                               3766
+#define M_ROTATION_AXIS_ANGLE                                  2L // already defined in milcal.h
+#define M_ROTATION_QUATERNION                                  3L // already defined in milcal.h
+#define M_ROTATION_X                                           7L // already defined in milcal.h
+#define M_ROTATION_Y                                           8L // already defined in milcal.h
+#define M_ROTATION_Z                                           9L // already defined in milcal.h
+#define M_ROTATION_YXZ                                         4L // already defined in milcal.h
+#define M_ROTATION_XYZ                                        10L // already defined in milcal.h
+#define M_ROTATION_XZY                                        11L // already defined in milcal.h
+#define M_ROTATION_YZX                                        12L // already defined in milcal.h
+#define M_ROTATION_ZXY                                        13L // already defined in milcal.h
+#define M_ROTATION_ZYX                                        14L // already defined in milcal.h
+#define M_ROTATION_AXIS_X                                     17L // already defined in milcal.h
+#define M_ROTATION_AXIS_Y                                     18L // already defined in milcal.h
+#define M_ROTATION_AXIS_Z                                     19L // already defined in milcal.h
+#define M_FIXTURE_TO_PLANE                                    20L // already defined in milcal.h
+#define M_FIXTURE_TO_GEOMETRY                                 21L // already defined in milcal.h
+//MatrixDefine
+#define M_XY_AXES                                           3926L
+#define M_XZ_AXES                                           3927L
+#define M_YX_AXES                                           3928L
+#define M_YZ_AXES                                           3929L
+#define M_ZX_AXES                                           3930L
+#define M_ZY_AXES                                           3931L
+#define M_FORWARD_TRANSFORMATION                      0x00001000L
+#define M_BACKWARD_TRANSFORMATION                     0x00002000L
+//Draw3d
+#define M_ROOT_NODE                                            0
+//Copy
+#define M_ROTATION_AND_SCALE                                 3993
+
+   // CAPI function prototypes
+   MIL_ID  MFTYPE M3dgeoAlloc(MIL_ID     SysId,
+                              MIL_INT64  ObjectType,
+                              MIL_INT64  ControlFlag,
+                              MIL_ID*    GeometryOrMatrix3dgeoIdPtr);
+
+   MIL_DOUBLE MFTYPE M3dgeoInquire(MIL_ID     GeometryOrMatrix3dgeoId,
+                                   MIL_INT64  InquireType,
+                                   void*      UserVarPtr);
+
+   void MFTYPE M3dgeoFree(MIL_ID GeometryOrMatrix3dgeoId);
+
+   void MFTYPE M3dgeoBox(MIL_ID     Geometry3dgeoId,
+                         MIL_INT64  CreationMode,
+                         MIL_DOUBLE XPos1,
+                         MIL_DOUBLE YPos1,
+                         MIL_DOUBLE ZPos1,
+                         MIL_DOUBLE XPos2OrLength,
+                         MIL_DOUBLE YPos2OrLength,
+                         MIL_DOUBLE ZPos2OrLength,
+                         MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoSphere(MIL_ID     Geometry3dgeoId,
+                            MIL_DOUBLE CenterX,
+                            MIL_DOUBLE CenterY,
+                            MIL_DOUBLE CenterZ,
+                            MIL_DOUBLE Radius,
+                            MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoPlane(MIL_ID     Geometry3dgeoId,
+                           MIL_INT64  CreationMode,
+                           MIL_DOUBLE X1,
+                           MIL_DOUBLE Y1,
+                           MIL_DOUBLE Z1,
+                           MIL_DOUBLE X2OrD,
+                           MIL_DOUBLE Y2,
+                           MIL_DOUBLE Z2,
+                           MIL_DOUBLE X3,
+                           MIL_DOUBLE Y3,
+                           MIL_DOUBLE Z3,
+                           MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoCopy(MIL_ID     SrcMilObjectId,
+                          MIL_ID     DstMilObjectId,
+                          MIL_INT64  CopyType,
+                          MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoMatrixSetTransformDouble(MIL_ID     Matrix3dgeoId,
+                                              MIL_INT64  TransformType,
+                                              MIL_DOUBLE Param1,
+                                              MIL_DOUBLE Param2,
+                                              MIL_DOUBLE Param3,
+                                              MIL_DOUBLE Param4,
+                                              MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoMatrixPutDouble(MIL_ID            Matrix3dgeoId,
+                                     MIL_INT64         PutType,
+                                     const MIL_DOUBLE* UserArrayPtr);
+   void MFTYPE M3dgeoMatrixPutFloat(MIL_ID           Matrix3dgeoId,
+                                    MIL_INT64        PutType,
+                                    const MIL_FLOAT* UserArrayPtr);
+
+   void MFTYPE M3dgeoMatrixGetDouble(MIL_ID      Matrix3dgeoId,
+                                     MIL_INT64   GetType,
+                                     MIL_DOUBLE* UserArrayPtr);
+   void MFTYPE M3dgeoMatrixGetFloat(MIL_ID      Matrix3dgeoId,
+                                    MIL_INT64   GetType,
+                                    MIL_FLOAT*  UserArrayPtr);
+
+   void  MFTYPE M3dgeoMatrixGetTransform(MIL_ID     Matrix3dgeoId,
+                                         MIL_INT64  InquireType,
+                                         MIL_DOUBLE *Param1Ptr,
+                                         MIL_DOUBLE *Param2Ptr,
+                                         MIL_DOUBLE *Param3Ptr,
+                                         MIL_DOUBLE *Param4Ptr,
+                                         MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoCylinder(MIL_ID     Geometry3dgeoId,
+                              MIL_INT64  CreationMode,
+                              MIL_DOUBLE XPos1,
+                              MIL_DOUBLE YPos1,
+                              MIL_DOUBLE ZPos1,
+                              MIL_DOUBLE XPos2OrVector,
+                              MIL_DOUBLE YPos2OrVector,
+                              MIL_DOUBLE ZPos2OrVector,
+                              MIL_DOUBLE Radius,
+                              MIL_DOUBLE Length,
+                              MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgeoDraw3d(MIL_ID     OperationDraw3dContext3dgeoId,
+                                 MIL_ID     SrcGeometry3dgeoId,
+                                 MIL_ID     DstList3dgraId,
+                                 MIL_INT64  DstParentLabel,
+                                 MIL_INT64  ControlFlag);
+
+
+   void MFTYPE M3dgeoLine(MIL_ID     Geometry3dgeoId,
+                          MIL_INT64  CreationMode,
+                          MIL_DOUBLE XPos1,
+                          MIL_DOUBLE YPos1,
+                          MIL_DOUBLE ZPos1,
+                          MIL_DOUBLE XPos2OrVector,
+                          MIL_DOUBLE YPos2OrVector,
+                          MIL_DOUBLE ZPos2OrVector,
+                          MIL_DOUBLE Length,
+                          MIL_INT64  ControlFlag);
+
+   void MFTYPE M3dgeoMatrixSetWithAxes(MIL_ID     Matrix3dgeoId,
+                                       MIL_INT64  Mode,
+                                       MIL_DOUBLE OriginX,
+                                       MIL_DOUBLE OriginY,
+                                       MIL_DOUBLE OriginZ,
+                                       MIL_DOUBLE Axis1VectorX,
+                                       MIL_DOUBLE Axis1VectorY,
+                                       MIL_DOUBLE Axis1VectorZ,
+                                       MIL_DOUBLE Axis2VectorX,
+                                       MIL_DOUBLE Axis2VectorY,
+                                       MIL_DOUBLE Axis2VectorZ,
+                                       MIL_INT64  ControlFlag);
+
+   //M3dgeo Control  
+
+
+
+#if M_MIL_USE_UNICODE
+   void MFTYPE M3dgeoSaveA(MIL_CONST_TEXTA_PTR FileName,
+                           MIL_ID              GeometryOrMatrix3dgeoId,
+                           MIL_INT64           ControlFlag);
+
+   MIL_ID MFTYPE M3dgeoRestoreA(MIL_CONST_TEXTA_PTR FileName,
+                                MIL_ID              SysId,
+                                MIL_INT64           ControlFlag,
+                                MIL_ID*             GeometryOrMatrix3dgeoIdPtr);
+
+   void MFTYPE M3dgeoStreamA(MIL_TEXTA_PTR MemPtrOrFileName,
+                             MIL_ID        SysId,
+                             MIL_INT64     Operation,
+                             MIL_INT64     StreamType,
+                             MIL_DOUBLE    Version,
+                             MIL_INT64     ControlFlag,
+                             MIL_ID*       GeometryOrMatrix3dgeoIdPtr,
+                             MIL_INT*      SizeByteVarPtr);
+
+   void MFTYPE M3dgeoSaveW(MIL_CONST_TEXTW_PTR FileName,
+                           MIL_ID              GeometryOrMatrix3dgeoId,
+                           MIL_INT64           ControlFlag);
+
+   MIL_ID MFTYPE M3dgeoRestoreW(MIL_CONST_TEXTW_PTR FileName,
+                                MIL_ID              SysId,
+                                MIL_INT64           ControlFlag,
+                                MIL_ID*             GeometryOrMatrix3dgeoIdPtr);
+
+   void MFTYPE M3dgeoStreamW(MIL_TEXTW_PTR MemPtrOrFileName,
+                             MIL_ID        SysId,
+                             MIL_INT64     Operation,
+                             MIL_INT64     StreamType,
+                             MIL_DOUBLE    Version,
+                             MIL_INT64     ControlFlag,
+                             MIL_ID*       GeometryOrMatrix3dgeoIdPtr,
+                             MIL_INT*      SizeByteVarPtr);
+
+
+
+#if M_MIL_UNICODE_API
+#define M3dgeoSave               M3dgeoSaveW
+#define M3dgeoRestore            M3dgeoRestoreW
+#define M3dgeoStream             M3dgeoStreamW
+//#define M3dgeoImport             M3dgeoImportW
+#else
+#define M3dgeoSave               M3dgeoSaveA
+#define M3dgeoRestore            M3dgeoRestoreA
+#define M3dgeoStream             M3dgeoStreamA
+//#define M3dgeoImport             M3dgeoImportA
+#endif
+
+#else
+
+   void MFTYPE   M3dgeoSave(MIL_CONST_TEXT_PTR FileName,
+                            MIL_ID             GeometryOrMatrix3dgeoId,
+                            MIL_INT64          ControlFlag);
+
+   MIL_ID MFTYPE   M3dgeoRestore(MIL_CONST_TEXT_PTR FileName,
+                                 MIL_ID             SysId,
+                                 MIL_INT64          ControlFlag,
+                                 MIL_ID*            GeometryOrMatrix3dgeoIdPtr);
+
+   void MFTYPE   M3dgeoStream(MIL_TEXT_PTR MemPtrOrFileName,
+                              MIL_ID       SysId,
+                              MIL_INT64    Operation,
+                              MIL_INT64    StreamType,
+                              MIL_DOUBLE   Version,
+                              MIL_INT64    ControlFlag,
+                              MIL_ID*      GeometryOrMatrix3dgeoIdPtr,
+                              MIL_INT*     SizeByteVarPtr);
+
+#endif  // M_MIL_USE_UNICODE
+
+#ifdef __cplusplus
+
+ inline bool In3dgeoInquireDoubleRange( MIL_INT64 InquireType)
+      {
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         {
+         return false;
+         }
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         //case M_ALLOCATION_FAILURE_REAL_TEST_FLAG:
+         case M_CENTER_X:
+         case M_CENTER_Y:
+         case M_CENTER_Z:
+         case M_RADIUS:
+         case M_UNROTATED_MIN_X:
+         case M_UNROTATED_MIN_Y:
+         case M_UNROTATED_MIN_Z:
+         case M_UNROTATED_MAX_X:
+         case M_UNROTATED_MAX_Y:
+         case M_UNROTATED_MAX_Z:
+         case M_SIZE_X:
+         case M_SIZE_Y:
+         case M_SIZE_Z:
+         case M_COEFFICIENT_A:
+         case M_COEFFICIENT_B:
+         case M_COEFFICIENT_C:
+         case M_COEFFICIENT_D:
+         case M_NORMAL_X:
+         case M_NORMAL_Y:
+         case M_NORMAL_Z:
+         case M_CLOSEST_TO_ORIGIN_X:
+         case M_CLOSEST_TO_ORIGIN_Y:
+         case M_CLOSEST_TO_ORIGIN_Z:
+         case M_START_POINT_X:
+         case M_START_POINT_Y:
+         case M_START_POINT_Z:
+         case M_END_POINT_X:
+         case M_END_POINT_Y:
+         case M_END_POINT_Z:
+         case M_AXIS_X:
+         case M_AXIS_Y:
+         case M_AXIS_Z:
+         case M_LENGTH:
+         case M_CORNER_X_ALL:
+         case M_CORNER_Y_ALL:
+         case M_CORNER_Z_ALL:
+         case M_CORNER_X(0):
+         case M_CORNER_X(1):
+         case M_CORNER_X(2):
+         case M_CORNER_X(3):
+         case M_CORNER_X(4):
+         case M_CORNER_X(5):
+         case M_CORNER_X(6):
+         case M_CORNER_X(7):
+         case M_CORNER_Y(0):
+         case M_CORNER_Y(1):
+         case M_CORNER_Y(2):
+         case M_CORNER_Y(3):
+         case M_CORNER_Y(4):
+         case M_CORNER_Y(5):
+         case M_CORNER_Y(6):
+         case M_CORNER_Y(7):
+         case M_CORNER_Z(0):
+         case M_CORNER_Z(1):
+         case M_CORNER_Z(2):
+         case M_CORNER_Z(3):
+         case M_CORNER_Z(4):
+         case M_CORNER_Z(5):
+         case M_CORNER_Z(6):
+         case M_CORNER_Z(7):
+         {
+         return true;
+         }
+
+         default:
+         {
+         break;
+         }
+         }
+
+      return false;
+      }
+
+   inline bool In3dgeoInquireInt64Range( MIL_INT64 )
+      {
+      return false;
+      }
+   inline bool M3dgeoInquireMustHaveUserPtr( MIL_INT64 InquireType)
+      {
+      const MIL_INT64 ForcedDataType = MinquireOverrides(M_STRIP_HLVLDATATYPE(InquireType), M_TYPE_MIL_INT);
+      if(ForcedDataType != 0)
+         {
+         return false;// ForcedDataType == M_TYPE_MIL_INT64;
+         }
+
+      return In3dgeoInquireInt64Range(InquireType);
+      }
+#endif // __cplusplus
+
+   /* C++ directive if needed */
+#ifdef __cplusplus
+   }
+#endif
+#ifdef __cplusplus
+   inline void MFTYPE M3dgeoStreamCpp(MilStreamParam MemPtrOrFileName,
+                                      MIL_ID         SysId,
+                                      MIL_INT64      Operation,
+                                      MIL_INT64      StreamType,
+                                      MIL_DOUBLE     Version,
+                                      MIL_INT64      ControlFlag,
+                                      MIL_ID*        GeometryOrMatrix3dgeoIdPtr,
+                                      MIL_INT*       SizeByteVarPtr)
+      {
+      M3dgeoStream(MemPtrOrFileName.m_Param, SysId, Operation, StreamType, Version, ControlFlag, GeometryOrMatrix3dgeoIdPtr, SizeByteVarPtr);
+      }
+
+#undef  M3dgeoStream
+#define M3dgeoStream M3dgeoStreamCpp
+
+#endif // __cplusplus
+#ifdef __cplusplus
+   inline void M3dgeoMatrixGet(MIL_ID      Matrix3dgeoId,
+                               MIL_INT64   GetType,
+                               MIL_DOUBLE* UserArrayPtr)
+      {
+      return M3dgeoMatrixGetDouble(Matrix3dgeoId, GetType, UserArrayPtr);
+      }
+   inline void M3dgeoMatrixGet(MIL_ID      Matrix3dgeoId,
+                               MIL_INT64   GetType,
+                               MIL_FLOAT*  UserArrayPtr)
+      {
+      return M3dgeoMatrixGetFloat(Matrix3dgeoId, GetType, UserArrayPtr);
+      }
+   inline void M3dgeoMatrixPut(MIL_ID            Matrix3dgeoId,
+                               MIL_INT64         PutType,
+                               const MIL_DOUBLE* UserArrayPtr)
+      {
+      return M3dgeoMatrixPutDouble(Matrix3dgeoId, PutType, UserArrayPtr);
+      }
+   inline void M3dgeoMatrixPut(MIL_ID            Matrix3dgeoId,
+                               MIL_INT64         PutType,
+                               const MIL_FLOAT*  UserArrayPtr)
+      {
+      return M3dgeoMatrixPutFloat(Matrix3dgeoId, PutType, UserArrayPtr);
+      }
+
+#else
+#define M3dgeoMatrixGet M3dgeoMatrixGetDouble
+#define M3dgeoMatrixPut M3dgeoMatrixPutDouble
+#endif
+
+#ifdef __cplusplus
+   inline MIL_INT64 M3dgeoInquireDataType(MIL_INT64 InquireType)
+      {
+      const MIL_INT64 ForcedDataType = MinquireOverrides(InquireType, M_TYPE_MIL_INT);
+      if(ForcedDataType != 0)
+         return ForcedDataType;
+
+      if(In3dgeoInquireDoubleRange(InquireType))
+         return M_TYPE_DOUBLE;
+
+      if(In3dgeoInquireInt64Range(InquireType))
+         return M_TYPE_MIL_INT64;
+
+      return M_TYPE_MIL_INT;
+      }
+#if M_MIL_USE_SAFE_TYPE
+   // ----------------------------------------------------------
+// ----------------------------------------------------------
+// M3dgeoInquire
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, int UserVarPtr)
+      {
+      bool MustHaveUserPointer = M3dgeoInquireMustHaveUserPtr(InquireType);
+
+      if(UserVarPtr)
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"));
+
+      if(!UserVarPtr && MustHaveUserPointer)
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+      return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, NULL);
+      }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, std::nullptr_t)
+      {
+      bool MustHaveUserPointer = M3dgeoInquireMustHaveUserPtr(InquireType);
+
+      if(MustHaveUserPointer)
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"),MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+      return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, NULL);
+      }
+#endif
+
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeTypeExecute(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, void  *UserVarPtr, MIL_INT64  GivenType)
+      {
+      MIL_INT64  RequiredType = M3dgeoInquireDataType(InquireType);
+      ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+      if(RequiredType != GivenType)
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"));
+
+      return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr);
+      }
+
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireUnsafe(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, void        *UserVarPtr) { return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_INT8*   UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_CHAR); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_INT16*  UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_INT32   *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_INT64   *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_FLOAT   *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_FLOAT); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_DOUBLE  *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_DOUBLE); }
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_UINT8*   UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_CHAR); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_UINT16*  UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_UINT32  *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, MIL_UINT64  *UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T                                                      
+   inline MIL_DOUBLE MFTYPE M3dgeoInquireSafeType(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, wchar_t*    UserVarPtr) { return M3dgeoInquireSafeTypeExecute(GeometryOrMatrix3dgeoId, InquireType, UserVarPtr, M_TYPE_SHORT); }
+#endif
+
+#define M3dgeoInquire           M3dgeoInquireSafeType
+
+
+#else // #if M_MIL_USE_SAFE_TYPE
+#define M3dgeoInquireUnsafe     M3dgeoInquire
+
+#endif // #if M_MIL_USE_SAFE_TYPE
+
+#endif
+#if M_MIL_USE_STRING
+   inline void MFTYPE M3dgeoSave(const MIL_STRING& FileName, MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64 ControlFlag)
+      {
+      return M3dgeoSave(FileName.c_str(), GeometryOrMatrix3dgeoId, ControlFlag);
+      }
+
+   inline MIL_ID MFTYPE M3dgeoRestore(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_ID* GeometryOrMatrix3dgeoIdPtr)
+      {
+      return M3dgeoRestore(FileName.c_str(), SysId, ControlFlag, GeometryOrMatrix3dgeoIdPtr);
+      }
+#endif /* M_MIL_USE_STRING */
+   // ----------------------------------------------------------
+// Overload for std::vector.
+#if defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+// ----------------------------------------------------------
+// Overloads for std::vector in  M3dgeoInquire.
+   template <typename UserType>
+   inline MIL_DOUBLE MFTYPE M3dgeoInquire(MIL_ID GeometryOrMatrix3dgeoId, MIL_INT64  InquireType, std::vector<UserType> &UserVarPtr)
+      {
+      // If the given MIL data type is not the same as the SrcType, change it to the correct one
+      // and give a warning.
+      MIL_INT64 InternalTrueDataTypeForStdVector = MilTraits<UserType>::TypeFlag;
+
+#if M_MIL_USE_SAFE_TYPE
+      if(M_GET_HLVLDATATYPE(InquireType) != 0)
+         {
+         SafeTypeError(MIL_TEXT("M3dgeoInquire"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+         }
+#endif
+
+      InquireType = M_STRIP_HLVLDATATYPE(InquireType) + InternalTrueDataTypeForStdVector;
+
+      MIL_INT InternalNumberOfElementsForStdVector = 0;
+      M3dgeoInquire(GeometryOrMatrix3dgeoId, M_STRIP_HLVLDATATYPE(InquireType) + M_NB_ELEMENTS + M_TYPE_MIL_INT, &InternalNumberOfElementsForStdVector);
+
+      UserVarPtr.resize(InternalNumberOfElementsForStdVector);
+
+      if(InternalNumberOfElementsForStdVector > 0)
+         {
+         return M3dgeoInquire(GeometryOrMatrix3dgeoId, InquireType, &UserVarPtr[0]);
+         }
+      return 0;
+      }
+   // ----------------------------------------------------------
+   // Overloads for std::vector in  M3dgeoMatrixPut.
+   template <typename T>
+   inline void MFTYPE  M3dgeoMatrixPut(MIL_ID                Matrix3dgeoId,
+                                       MIL_INT64             PutType,
+                                       const std::vector<T>& ArrayPtr)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      if(ArrayPtr.empty())
+         {
+         SafeTypeError(MIL_TEXT("M3dgeoMatrixPut"), MIL_TEXT("The input vector cannot be empty."));
+         }
+
+      if(ArrayPtr.size() != 16)
+         {
+         SafeTypeError(MIL_TEXT("M3dgeoMatrixPut"), MIL_TEXT("The size of the input vector must be 16."));
+         }
+#endif
+      M3dgeoMatrixPut(Matrix3dgeoId,
+                      PutType,
+                      &ArrayPtr[0]);
+      }
+   // Overloads for std::vector in M3dgeoMatrixGet.
+   template <typename T>
+   inline void M3dgeoMatrixGet(MIL_ID          Matrix3dgeoId,
+                               MIL_INT64       GetType,
+                               std::vector<T>& ArrayPtr)
+      {
+      ArrayPtr.resize(16);//InternalNbElementRequired
+      M3dgeoMatrixGet(Matrix3dgeoId,
+                      GetType,
+                      &ArrayPtr[0]);
+      }
+   // ----------------------------------------------------------
+// Overloads for std::vector in M3dgeoStream.
+   inline void MFTYPE M3dgeoStream(std::vector<MIL_UINT8> &MemPtrOrFileName,
+                                   MIL_ID                 SysId,
+                                   MIL_INT64              Operation,
+                                   MIL_INT64              StreamType,
+                                   MIL_DOUBLE             Version,
+                                   MIL_INT64              ControlFlag,
+                                   MIL_ID*                GeometryOrMatrix3dgeoIdPtr,
+                                   MIL_INT*               SizeByteVarPtr)
+      {
+      MxxxStreamForStdVector(MemPtrOrFileName,
+                             SysId,
+                             Operation,
+                             StreamType,
+                             Version,
+                             ControlFlag,
+                             GeometryOrMatrix3dgeoIdPtr,
+                             SizeByteVarPtr,
+                             M3dgeoStream);
+      }
+#endif // defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+ // Automatic double casting
+#define M3dgeoMatrixSetTransform(Matrix3dgeoId, TransformType, Param1, Param2, Param3, Param4, ControlFlag) \
+        M3dgeoMatrixSetTransformDouble(Matrix3dgeoId, TransformType, M_MILID_TO_DOUBLE(Param1), M_MILID_TO_DOUBLE(Param2), M_MILID_TO_DOUBLE(Param3), M_MILID_TO_DOUBLE(Param4), ControlFlag)
+////////////////////////////////////////////////////////////////////////////////
+// MIL_UNIQUE_ID support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+#if M_MIL_USE_SAFE_TYPE
+   template <> inline bool MilIsCorrectObjectType<&M3dgeoFree>(MIL_INT64 ObjectType)
+      {
+      return (ObjectType == M_3DGEO_GEOMETRY || ObjectType == M_3DGEO_TRANSFORMATION_MATRIX);
+      }
+#endif
+
+   typedef MIL_UNIQUE_ID<&M3dgeoFree > MIL_UNIQUE_3DGEO_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+
+   //3DGEO
+   inline  MIL_UNIQUE_3DGEO_ID M3dgeoAlloc(MIL_ID SysId, MIL_INT64 ObjectType, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+      {
+      return MIL_UNIQUE_3DGEO_ID(M3dgeoAlloc(SysId, ObjectType, InitFlag, M_NULL));
+      }
+   inline MIL_UNIQUE_3DGEO_ID M3dgeoRestore(MIL_CONST_TEXT_PTR FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+      {
+      return MIL_UNIQUE_3DGEO_ID(M3dgeoRestore(FileName, SysId, ControlFlag, M_NULL));
+      }
+#if M_MIL_USE_STRING
+   inline MIL_UNIQUE_3DGEO_ID M3dgeoRestore(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+      {
+      return MIL_UNIQUE_3DGEO_ID(M3dgeoRestore(FileName.c_str(), SysId, ControlFlag, M_NULL));
+      }
+#endif // M_MIL_USE_STRING
+   template <MilFreeFuncType FreeFunc> inline void M3dgeoFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+   inline void M3dgeoStream(MilStreamParam       MemPtrOrFileName,
+                            MIL_ID               SysId,
+                            MIL_INT64            Operation,
+                            MIL_INT64            StreamType,
+                            MIL_DOUBLE           Version,
+                            MIL_INT64            ControlFlag,
+                            MIL_UNIQUE_3DGEO_ID* Context3dgeoIdPtr,
+                            MIL_INT*             SizeByteVarPtr)
+      {
+      MxxxStreamForMilUniqueId(MemPtrOrFileName, SysId, Operation, StreamType, Version, ControlFlag, Context3dgeoIdPtr, SizeByteVarPtr, M3dgeoStream);
+      }
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+
+// End of MIL_UNIQUE_ID support
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+   /* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+   {
+#endif
+   // MbufConvert3d
+#define M_COMPENSATE                   3713
+#define M_REMOVE_NON_FINITE            0x00000001L
+
+
+   void MFTYPE MbufConvert3d(MIL_ID    SrcContainerOrImageBufId,
+                             MIL_ID    DstContainerOrImageBufId,
+                             MIL_ID    ExternalYArrayBufId,
+                             MIL_INT64 DstOptions,
+                             MIL_INT64 ControlFlag);
+
+
+
+   /* C++ directive if needed */
+#ifdef __cplusplus
+   }
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+#endif // __MIL3D_H__
diff --git a/Lib/Matrox/Include/MILDyn/mil3dgra.h b/Lib/Matrox/Include/MILDyn/mil3dgra.h
new file mode 100644
index 0000000..7eff7ad
--- /dev/null
+++ b/Lib/Matrox/Include/MILDyn/mil3dgra.h
@@ -0,0 +1,908 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MIL3DGRA.H
+// Content           :  Define for the MIL 3DGRA module
+// Revision          :  10.40.0640
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+
+#ifndef __MIL3DGRA_H__
+#define __MIL3DGRA_H__
+
+#if !defined(__MIL3DGEO_H__)
+#include <mildyn/mil3dgeo.h>
+#endif
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+   {
+#endif
+// Control values
+#define M_ROOT_NODE                                                          0
+#define M_NO_LABEL                                                  0x20000000L  // Also defined in milreg.h
+#define M_LIST                                                      0x08000000L  /* already defined in mil.h */
+#define M_DEFAULT_SETTINGS                                          0x04000000L
+
+// M3dgraAlloc
+// 1000-2000
+
+#define M_GRAPHIC_TYPE_ARC                                               1505L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_DOTS                                              1507L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_LINE                                              1508L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_POLYGON                                           1510L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_TEXT                                              1513L   // already defined in mil.h
+#define M_GRAPHIC_TYPE_AXIS                                              3881L
+#define M_GRAPHIC_TYPE_BOX                                               3882L
+#define M_GRAPHIC_TYPE_POINT_CLOUD                                       3883L
+#define M_GRAPHIC_TYPE_CYLINDER                                          3884L
+#define M_GRAPHIC_TYPE_GRID                                              3885L
+#define M_GRAPHIC_TYPE_PLANE                                             3886L
+#define M_GRAPHIC_TYPE_QUAD                                              3887L
+#define M_GRAPHIC_TYPE_SPHERE                                            3888L
+#define M_GRAPHIC_TYPE_NODE                                              3889L
+
+// M3dgraCopy
+#define M_CLIPPING_BOX                                                   3868L
+#define M_GRAPHIC                                                        3879L
+#define M_COLOR_LUT                                                      3945L
+#define M_RECURSIVE                                                0x00040000 // already defined in milmod.h
+#define M_CHILDREN_ONLY                                            0x00080000
+#define M_BOUNDING_BOX                                             0x00000003L  // already defined
+#define M_GEOMETRY                                                       1306L // Already defined
+
+// Gralist controls
+#define M_BOTH_CORNERS                                             0x00000004L  // Already defined in mil.h
+#define M_CENTER_AND_DIMENSION                                     0x00000002L  // Already defined in 
+#define M_POINT_AND_VECTOR                                               4670
+#define M_VISIBLE                                                        1533L // Already defined in mil.h
+#define M_LABEL_EXISTS                                                   4671
+#define M_POSITION_X                                               0x00003400L // Already defined in milim.h
+#define M_POSITION_Y                                               0x00004400L // Already defined in milim.h
+#define M_POSITION_Z                                                     3960L
+
+// Container
+#define M_TRANSFORMATION_MATRIX                                            72L  // Already defined in milreg.h
+#define M_BUFFER_LIMITS                                                  4672
+#define M_DATA_EXTREMES_GLOBAL                                           4673
+#define M_DATA_EXTREMES_PER_BAND                                         4674
+#define M_USER_DEFINED                                                     21L // Already defined in alot of places
+#define M_AUTO_COLOR                                               0x00100000L
+#define M_CONTAINER_ID                                                   4675
+#define M_GRAPHIC_RESOLUTION                                             4676
+
+// Dots
+#define M_PER_POINT                                                      3873L
+
+// Axis
+#define M_PER_AXIS                                                       3956L
+
+//Plane
+#define M_THREE_POINTS                                                   3390 // Already defined in mil3dgeo.h
+#define M_COEFFICIENTS                                                   3388
+#define M_POINT_AND_NORMAL                                               3389
+#define M_POINT_AND_TWO_VECTORS                                          3391
+// Text
+#define M_GRAPHIC_TEXT                             (3869L | M_CLIENT_ENCODING)
+#define M_FONT                                        (7L | M_CLIENT_ENCODING) // Already defined in mil.h
+#define M_TEXT_ALIGN_HORIZONTAL                                            58L // Already defined in Mil.h
+#define M_TEXT_ALIGN_VERTICAL                                              71L // Already defined in Mil.h
+#define M_TEXT_BORDER                                                    1785L // Already defined in Mil.h
+#define M_TEXT_DIRECTION                                           0x01000061L // Already defined in Mil.h
+#define M_TEXT_SHADING                                                   4747L
+#define M_BACKGROUND_MODE                                                  12L // Already defined in Mil.h
+//Cylinder
+#define M_TWO_POINTS                                                     3657
+// Arc
+#define M_CENTER_AND_TWO_POINTS                                          3875L  
+#define M_CENTER_AND_TWO_VECTORS                                         3876L
+#define M_NORMAL_AND_ANGLE                                               3877L
+
+// Grid
+#define M_SIZE_AND_SPACING                                               3932L  
+#define M_TILES_AND_SPACING                                              3933L
+
+////////////////////////////////////////////////////////////////////////////////
+// M3dgraControl
+////////////////////////////////////////////////////////////////////////////////
+// MIL_INT64 CONTROLS
+#define M_COLOR_COMPONENT                                                4678
+#define M_APPEARANCE                                                     4679
+#define M_COLOR_LIMITS                                                   4680
+#define M_COLOR_LUT_SIZE                                                 4681
+#define M_COLOR_LUT_SIZE_BAND                                            4682
+#define M_COLOR_COMPONENT_BAND                                           4683
+#define M_COLOR_USE_LUT                                                  4684  
+#define M_CHILDREN                                                       4685    
+#define M_NUMBER_OF_CHILDREN                                             4686   
+#define M_PARENT                                                         4687   
+#define M_CYLINDER_BASES                                                 4688   
+#define M_COLOR_AXIS_X                                                   4689
+#define M_COLOR_AXIS_Y                                                   4690
+#define M_COLOR_AXIS_Z                                                   4691
+#define M_SAME_AS_COLOR                                                  4692
+#define M_COLOR_USE_TEXTURE                                              4693
+#define M_COLOR_TEXTURE_SIZE_X                                           4694
+#define M_COLOR_TEXTURE_SIZE_Y                                           4695
+#define M_COLOR_TEXTURE_SIZE_BAND                                        4696
+#define M_COLOR_TEXTURE                                                  4697
+#define M_SHADING                                                        4698
+#define M_FLAT                                                           4699
+#define M_GOURAUD                                                        4700
+#define M_PHONG                                                          4726
+#define M_KEYING_COLOR                                                   4727
+#define M_GRAPHIC_TYPE                                                   1518L // Already defined in mil.h
+#define M_FILL_COLOR                                    (M_DISP_CONTROL_START+193L) // already defined in mildisplay.h
+
+#define M_POINTS                                                   0x00000010L
+#define M_WIREFRAME                                                0x00000020L
+#define M_SOLID                                                    0x00000040L
+#define M_SOLID_WITH_WIREFRAME                          (M_SOLID + M_WIREFRAME)
+
+// MIL_DOUBLE CONTROLS
+#define M_OPACITY                                                        4728
+#define M_COLOR_LIMITS_MIN                                               4729
+#define M_COLOR_LIMITS_MAX                                               4730
+#define M_POINTS_X                                                       4733
+#define M_POINTS_Y                                                       4734
+#define M_POINTS_Z                                                       4735
+#define M_SPACING_X                                                      4736
+#define M_SPACING_Y                                                      4737
+#define M_FONT_SIZE                                                0x01000060L  // already defined in Mil.h
+#define M_THICKNESS                                                         3L  // also used in MgraLines
+#define M_TRANSFORM_TYPES_SHIFT                                             8L  // =utilities=   (also defined in milcal.h)
+#define M_RELATIVE_TO_ROOT                            (256 << M_TRANSFORM_TYPES_SHIFT)
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+// M3dgra calls
+   MIL_INT64 MFTYPE M3dgraAdd(MIL_ID    List3dgraId,
+                              MIL_INT64 ParentLabel,
+                              MIL_ID    ContainerOrImageBufId,
+                              MIL_INT64 ControlFlag);
+
+   MIL_ID    MFTYPE M3dgraAlloc(MIL_ID    SysId,
+                                MIL_INT64 ControlFlag,
+                                MIL_ID*   List3dgraIdPtr);
+
+   void      MFTYPE M3dgraControlDouble(MIL_ID     List3dgraId,
+                                        MIL_INT64  Label,
+                                        MIL_INT64  ControlType,
+                                        MIL_DOUBLE ControlValue);
+
+   void      MFTYPE M3dgraControlInt64 (MIL_ID    List3dgraId,
+                                        MIL_INT64 Label,
+                                        MIL_INT64 ControlType,
+                                        MIL_INT64 ControlValue);
+
+   void      MFTYPE M3dgraFree(MIL_ID List3dgraId);
+
+   MIL_INT64 MFTYPE M3dgraInquire(MIL_ID    List3dgraId,
+                                  MIL_INT64 Label,
+                                  MIL_INT64 InquireType,
+                                  void*     UserVarPtr);
+
+   void      MFTYPE M3dgraRemove(MIL_ID    List3dgraId,
+                                 MIL_INT64 Label,
+                                 MIL_INT64 ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraBox(MIL_ID     List3dgraId,
+                              MIL_INT64  ParentLabel,
+                              MIL_INT64  CreationMode,
+                              MIL_DOUBLE XPos1,
+                              MIL_DOUBLE YPos1,
+                              MIL_DOUBLE ZPos1,
+                              MIL_DOUBLE XPos2OrLength,
+                              MIL_DOUBLE YPos2OrLength,
+                              MIL_DOUBLE ZPos2OrLength,
+                              MIL_ID     Matrix3dgeoId,
+                              MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraSphere(MIL_ID     List3dgraId,
+                                 MIL_INT64  ParentLabel,
+                                 MIL_DOUBLE CenterX,
+                                 MIL_DOUBLE CenterY,
+                                 MIL_DOUBLE CenterZ,
+                                 MIL_DOUBLE Radius,
+                                 MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraCylinder(MIL_ID     List3dgraId,
+                                   MIL_INT64  ParentLabel,
+                                   MIL_INT64  CreationMode,
+                                   MIL_DOUBLE XPos1,
+                                   MIL_DOUBLE YPos1,
+                                   MIL_DOUBLE ZPos1,
+                                   MIL_DOUBLE XPos2OrVector,
+                                   MIL_DOUBLE YPos2OrVector,
+                                   MIL_DOUBLE ZPos2OrVector,
+                                   MIL_DOUBLE Radius,
+                                   MIL_DOUBLE Length,
+                                   MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraGrid(MIL_ID     List3dgraId,
+                               MIL_INT64  ParentLabel,
+                               MIL_INT64  CreationMode,
+                               MIL_ID     Matrix3dgeoId,
+                               MIL_DOUBLE Param1,
+                               MIL_DOUBLE Param2,
+                               MIL_DOUBLE Param3,
+                               MIL_DOUBLE Param4,
+                               MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraLine(MIL_ID     List3dgraId,
+                               MIL_INT64  ParentLabel,
+                               MIL_INT64  CreationMode,
+                               MIL_INT64  Symbol,
+                               MIL_DOUBLE PointX,
+                               MIL_DOUBLE PointY,
+                               MIL_DOUBLE PointZ,
+                               MIL_DOUBLE PointOrVectorX,
+                               MIL_DOUBLE PointOrVectorY,
+                               MIL_DOUBLE PointOrVectorZ,
+                               MIL_DOUBLE Length,
+                               MIL_INT64  ControlFlag);
+   
+   MIL_INT64 MFTYPE M3dgraNode(MIL_ID     List3dgraId,
+                               MIL_INT64  ParentLabel,
+                               MIL_ID     Matrix3dgeoId,
+                               MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraPlane(MIL_ID     List3dgraId,
+                                MIL_INT64  ParentLabel,
+                                MIL_INT64  CreationMode,
+                                MIL_DOUBLE X1,
+                                MIL_DOUBLE Y1,
+                                MIL_DOUBLE Z1,
+                                MIL_DOUBLE X2OrD,
+                                MIL_DOUBLE Y2,
+                                MIL_DOUBLE Z2,
+                                MIL_DOUBLE X3,
+                                MIL_DOUBLE Y3,
+                                MIL_DOUBLE Z3,
+                                MIL_DOUBLE Size,
+                                MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraArc(MIL_ID     List3dgraId,
+                              MIL_INT64  ParentLabel,
+                              MIL_INT64  CreationMode,
+                              MIL_INT64  Symbol,
+                              MIL_DOUBLE X1,
+                              MIL_DOUBLE Y1,
+                              MIL_DOUBLE Z1,
+                              MIL_DOUBLE X2,
+                              MIL_DOUBLE Y2,
+                              MIL_DOUBLE Z2,
+                              MIL_DOUBLE X3,
+                              MIL_DOUBLE Y3,
+                              MIL_DOUBLE Z3,
+                              MIL_DOUBLE Angle,
+                              MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraDotsDouble(MIL_ID            List3dgraId,
+                                     MIL_INT64         ParentLabel,
+                                     MIL_INT           NumPoints,
+                                     const MIL_DOUBLE* CoordXArrayPtr,
+                                     const MIL_DOUBLE* CoordYArrayPtr,
+                                     const MIL_DOUBLE* CoordZArrayPtr,
+                                     const MIL_UINT8*  PointsRArrayPtr,
+                                     const MIL_UINT8*  PointsGArrayPtr,
+                                     const MIL_UINT8*  PointsBArrayPtr,
+                                     MIL_INT64         ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraDotsFloat(MIL_ID           List3dgraId,
+                                    MIL_INT64        ParentLabel,
+                                    MIL_INT          NumPoints,
+                                    const MIL_FLOAT* CoordXArrayPtr,
+                                    const MIL_FLOAT* CoordYArrayPtr,
+                                    const MIL_FLOAT* CoordZArrayPtr,
+                                    const MIL_UINT8* PointsRArrayPtr,
+                                    const MIL_UINT8* PointsGArrayPtr,
+                                    const MIL_UINT8* PointsBArrayPtr,
+                                    MIL_INT64        ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraCopy(MIL_ID     SrcMilObjectId,
+                               MIL_INT64  SrcLabel,
+                               MIL_ID     DstMilObjectId,
+                               MIL_INT64  DstLabel,
+                               MIL_INT64  CopyType,
+                               MIL_INT64  ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraPolygonDouble(MIL_ID            List3dgraId,
+                                        MIL_INT64         ParentLabel,
+                                        MIL_INT64         CreationMode,
+                                        MIL_INT           NumPoints,
+                                        const MIL_DOUBLE* CoordXArrayPtr,
+                                        const MIL_DOUBLE* CoordYArrayPtr,
+                                        const MIL_DOUBLE* CoordZArrayPtr,
+                                        const MIL_DOUBLE* TextureXArrayPtr,
+                                        const MIL_DOUBLE* TextureYArrayPtr,
+                                        MIL_ID            TextureBufId,
+                                        MIL_INT64         ControlFlag);
+
+   MIL_INT64 MFTYPE M3dgraPolygonFloat(MIL_ID           List3dgraId,
+                                       MIL_INT64        ParentLabel,
+                                       MIL_INT64        CreationMode,
+                                       MIL_INT          NumPoints,
+                                       const MIL_FLOAT* CoordXArrayPtr,
+                                       const MIL_FLOAT* CoordYArrayPtr,
+                                       const MIL_FLOAT* CoordZArrayPtr,
+                                       const MIL_FLOAT* TextureXArrayPtr,
+                                       const MIL_FLOAT* TextureYArrayPtr,
+                                       MIL_ID           TextureBufId,
+                                       MIL_INT64        ControlFlag);
+
+// For CAPI calls with strings
+#if M_MIL_USE_UNICODE
+   MIL_INT64 MFTYPE M3dgraTextA(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_CONST_TEXTA_PTR Text, MIL_ID Matrix3dgeoId, MIL_INT64 Options, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3dgraTextW(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_CONST_TEXTW_PTR Text, MIL_ID Matrix3dgeoId, MIL_INT64 Options, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3dgraAxisA(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_ID Matrix3dgeoId, MIL_DOUBLE AxisLength, MIL_CONST_TEXTA_PTR Name, MIL_INT64 Options, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3dgraAxisW(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_ID Matrix3dgeoId, MIL_DOUBLE AxisLength, MIL_CONST_TEXTW_PTR Name, MIL_INT64 Options, MIL_INT64 ControlFlag);
+     
+
+// create default calls
+#if M_MIL_UNICODE_API
+#define M3dgraText   M3dgraTextW
+#define M3dgraAxis   M3dgraAxisW
+
+#else
+#define M3dgraText   M3dgraTextA
+#define M3dgraAxis   M3dgraAxisA
+#endif
+
+#else
+   MIL_INT64 MFTYPE M3dgraText(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_CONST_TEXT_PTR Text, MIL_ID Matrix3dgeoId, MIL_INT64 Options, MIL_INT64 ControlFlag);
+   MIL_INT64 MFTYPE M3dgraAxis(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_ID Matrix3dgeoId, MIL_DOUBLE AxisLength, MIL_CONST_TEXT_PTR Name, MIL_INT64 Options, MIL_INT64 ControlFlag);
+ #endif
+
+#ifdef __cplusplus
+
+   inline bool In3dgraInquireDoubleRange(MIL_INT64 InquireType)
+      {
+      InquireType &= ~(M_RELATIVE_TO_ROOT | M_RECURSIVE);  // Remove custom combo flags
+
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         return false;
+
+      if(In3dgeoInquireDoubleRange(InquireType))
+         return true;
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_ANGLE:
+         case M_OPACITY:
+         case M_COLOR_LIMITS_MIN:
+         case M_COLOR_LIMITS_MAX:
+         case M_POINTS_X:
+         case M_POINTS_Y:
+         case M_POINTS_Z:
+         case M_SPACING_X:
+         case M_SPACING_Y:
+         case M_FONT_SIZE:
+         case M_THICKNESS:
+         case M_POSITION_X:
+         case M_POSITION_Y:
+         case M_POSITION_Z:
+            return true;
+
+         default:
+            break;
+         }
+
+      return false;
+      }
+
+   inline bool In3dgraInquireInt64Range(MIL_INT64 InquireType)
+      {
+      InquireType &= ~(M_RELATIVE_TO_ROOT | M_RECURSIVE);  // Remove custom combo flags
+
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         return false;
+
+      switch(M_STRIP_INQ_COMBOFLAGS(InquireType))
+         {
+         case M_COLOR_COMPONENT:
+         case M_COLOR:
+         case M_BACKGROUND_COLOR:
+         case M_KEYING_COLOR:
+         case M_COLOR_AXIS_X:
+         case M_COLOR_AXIS_Y:
+         case M_COLOR_AXIS_Z:
+         case M_FILL_COLOR:
+         case M_PARENT:
+         case M_CHILDREN:
+            return true;
+
+         default:
+            break;
+         }
+
+      return false;
+      }
+
+   inline bool In3dgraInquireStringRange(MIL_INT64 InquireType)
+      {
+      if(M_NB_ELEMENTS_BIT_SET(InquireType))
+         return false;
+
+      switch(M_STRIP_CLIENT_TEXT_ENCODING(M_STRIP_INQ_COMBOFLAGS(InquireType)))
+         {
+         case M_STRIP_CLIENT_TEXT_ENCODING(M_GRAPHIC_TEXT):
+         case M_STRIP_CLIENT_TEXT_ENCODING(M_FONT):
+            return true;
+
+         default:
+            break;
+         }
+
+      return false;
+      }
+   inline bool M3dgraInquireMustHaveUserPtr(MIL_INT64 InquireType)
+      {
+      const MIL_INT64 ForcedDataType = MinquireOverrides(M_STRIP_HLVLDATATYPE(InquireType), M_TYPE_MIL_INT);
+      if(ForcedDataType != 0)
+         {
+         return false;
+         }
+      return In3dgraInquireDoubleRange(InquireType) || In3dgraInquireStringRange(InquireType);
+      }
+
+#endif // __cplusplus
+
+   /* C++ directive if needed */
+#ifdef __cplusplus
+   }
+#endif
+
+
+
+
+// M3dgradots/polygon c++ overloads
+#ifdef __cplusplus
+   inline MIL_INT64 M3dgraDots(MIL_ID List3dgraId,
+                               MIL_INT64 ParentLabel,
+                               MIL_INT NumPoints,
+                               const MIL_DOUBLE* CoordXArrayPtr,
+                               const MIL_DOUBLE* CoordYArrayPtr,
+                               const MIL_DOUBLE* CoordZArrayPtr,
+                               const MIL_UINT8* PointsRArrayPtr,
+                               const MIL_UINT8* PointsGArrayPtr,
+                               const MIL_UINT8* PointsBArrayPtr,
+                               MIL_INT64 ControlFlag)
+      {
+      return M3dgraDotsDouble(List3dgraId, ParentLabel, NumPoints, CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, PointsRArrayPtr, PointsGArrayPtr, PointsBArrayPtr, ControlFlag);
+      }
+
+   inline MIL_INT64 M3dgraDots(MIL_ID List3dgraId,
+                               MIL_INT64 ParentLabel,
+                               MIL_INT NumPoints,
+                               const MIL_FLOAT* CoordXArrayPtr,
+                               const MIL_FLOAT* CoordYArrayPtr,
+                               const MIL_FLOAT* CoordZArrayPtr,
+                               const MIL_UINT8* PointsRArrayPtr,
+                               const MIL_UINT8* PointsGArrayPtr,
+                               const MIL_UINT8* PointsBArrayPtr,
+                               MIL_INT64 ControlFlag)
+      {
+      return M3dgraDotsFloat(List3dgraId, ParentLabel, NumPoints, CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, PointsRArrayPtr, PointsGArrayPtr, PointsBArrayPtr, ControlFlag);
+      }
+
+   inline MIL_INT64 M3dgraPolygon(MIL_ID List3dgraId,
+                                  MIL_INT64 ParentLabel,
+                                  MIL_INT64 CreationMode,
+                                  MIL_INT    NumPoints,
+                                  const MIL_DOUBLE* CoordXArrayPtr,
+                                  const MIL_DOUBLE* CoordYArrayPtr,
+                                  const MIL_DOUBLE* CoordZArrayPtr,
+                                  const MIL_DOUBLE* TextureXArrayPtr,
+                                  const MIL_DOUBLE* TextureYArrayPtr,
+                                  MIL_ID TextureBufId,
+                                  MIL_INT64 ControlFlag)
+      {
+      return M3dgraPolygonDouble(List3dgraId, ParentLabel, CreationMode, NumPoints, CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, TextureXArrayPtr, TextureYArrayPtr, TextureBufId, ControlFlag);
+      }
+
+   inline MIL_INT64 M3dgraPolygon(MIL_ID List3dgraId,
+                                  MIL_INT64 ParentLabel,
+                                  MIL_INT64 CreationMode,
+                                  MIL_INT    NumPoints,
+                                  const MIL_FLOAT* CoordXArrayPtr,
+                                  const MIL_FLOAT* CoordYArrayPtr,
+                                  const MIL_FLOAT* CoordZArrayPtr,
+                                  const MIL_FLOAT* TextureXArrayPtr,
+                                  const MIL_FLOAT* TextureYArrayPtr,
+                                  MIL_ID TextureBufId,
+                                  MIL_INT64 ControlFlag)
+      {
+      return M3dgraPolygonFloat(List3dgraId, ParentLabel, CreationMode, NumPoints, CoordXArrayPtr, CoordYArrayPtr, CoordZArrayPtr, TextureXArrayPtr, TextureYArrayPtr, TextureBufId, ControlFlag);
+      }
+#endif
+
+
+
+#ifdef __cplusplus
+
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
+   {
+   M3dgraControlDouble(List3dgraId, Label, ControlType, ControlValue);
+   }
+
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, MIL_INT64 ControlValue)
+   {
+   M3dgraControlInt64(List3dgraId, Label, ControlType, ControlValue);
+   }
+
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   M3dgraControlInt64(List3dgraId, Label, ControlType, ControlValue);
+   }
+
+#if M_MIL_USE_STRING
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+   M3dgraControl(List3dgraId, Label, ControlType, M_PTR_TO_MIL_INT(ControlValue.c_str()));
+   }
+#endif
+
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValuePtr)
+   {
+   M3dgraControl(List3dgraId, Label, ControlType, (MIL_INT)ControlValuePtr);
+   }
+
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void M3dgraControl(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 ControlType, int ControlValue)
+   {
+   M3dgraControlInt64(List3dgraId, Label, ControlType, ControlValue);
+   }
+#endif
+
+
+
+#else
+
+#define M3dgraControl       M3dgraControlDouble
+#endif
+
+#ifdef __cplusplus
+inline MIL_INT64 M3dgraInquireDataType(MIL_INT64 InquireType)
+   {
+   const MIL_INT64 ForcedDataType = MinquireOverrides(InquireType, M_TYPE_MIL_INT);
+   if(ForcedDataType != 0)
+      return ForcedDataType;
+
+   if(In3dgraInquireDoubleRange(InquireType))
+      return M_TYPE_DOUBLE;
+
+   if(In3dgraInquireInt64Range(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if(In3dgraInquireStringRange(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   return M_TYPE_MIL_INT;
+   }
+
+#if M_MIL_USE_SAFE_TYPE
+// ----------------------------------------------------------
+// M3dgraInquire
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, int UserVarPtr)
+      {
+      bool MustHaveUserPointer = M3dgraInquireMustHaveUserPtr(InquireType);
+         
+      if(UserVarPtr)
+         SafeTypeError(MIL_TEXT("M3dgraInquire"));
+
+      if(!UserVarPtr && MustHaveUserPointer)
+         SafeTypeError(MIL_TEXT("M3dgraInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+      return M3dgraInquire(List3dgraId, Label, InquireType, NULL);
+      }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, std::nullptr_t)
+      {
+      bool MustHaveUserPointer = M3dgraInquireMustHaveUserPtr(InquireType);
+
+      if(MustHaveUserPointer)
+         SafeTypeError(MIL_TEXT("M3dgraInquire"), MIL_TEXT("The specified InquireType requires a non-null output pointer."));
+
+      return M3dgraInquire(List3dgraId, Label, InquireType, NULL);
+      }
+#endif
+
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeTypeExecute(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64  InquireType, void  *UserVarPtr, MIL_INT64  GivenType)
+      {
+      MIL_INT64  RequiredType = M3dgraInquireDataType(InquireType);
+      ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+      if(RequiredType != GivenType)
+         SafeTypeError(MIL_TEXT("M3dgraInquire"));
+
+      return M3dgraInquire(List3dgraId, Label, InquireType, UserVarPtr);
+      }
+
+   inline MIL_INT64 MFTYPE M3dgraInquireUnsafe(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, void         *UserVarPtr) { return M3dgraInquire(List3dgraId, Label, InquireType, UserVarPtr); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_INT8*   UserVarPtr) { return  M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_CHAR); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_INT16*  UserVarPtr) { return  M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_SHORT); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_INT32   *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_INT64   *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_FLOAT   *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_FLOAT); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_DOUBLE); }
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_UINT8*   UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_CHAR); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_UINT16*  UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_SHORT); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_UINT32  *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, MIL_UINT64  *UserVarPtr) { return M3dgraInquireSafeTypeExecute(List3dgraId, Label, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T                                                      
+   inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID Display3dId, MIL_INT64 Label, MIL_INT64  InquireType, wchar_t*    UserVarPtr) { return M3dgraInquireSafeTypeExecute(Display3dId, Label, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR); }
+#endif
+
+#define M3dgraInquire           M3dgraInquireSafeType
+
+#else // #if M_MIL_USE_SAFE_TYPE
+#define M3dgraInquireUnsafe     M3dgraInquire
+#endif // #if M_MIL_USE_SAFE_TYPE
+
+#endif //__cplusplus
+#if M_MIL_USE_STRING
+
+#if M_MIL_USE_SAFE_TYPE
+inline MIL_INT64 MFTYPE M3dgraInquireSafeType(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64  InquireType, MIL_STRING&    UserVarPtr)
+   {
+   MIL_INT64 RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("M3dgraInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+
+   M3dgraInquire(List3dgraId, Label, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = M3dgraInquire(List3dgraId, Label, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+
+      }
+
+   return RetValue;
+   }
+
+#else
+inline MIL_INT64 MFTYPE M3dgraInquire(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64  InquireType, MIL_STRING&    UserVarPtr)
+   {
+   MIL_INT64 RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   M3dgraInquire(List3dgraId, Label, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = M3dgraInquire(List3dgraId, Label, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif
+
+inline MIL_INT64 MFTYPE M3dgraText(MIL_ID List3dgraId, MIL_INT64 ParentLabel, const MIL_STRING& Text, MIL_ID Matrix3dgeoId, MIL_INT64 Options, MIL_INT64 ControlFlag)
+   {
+   return M3dgraText(List3dgraId, ParentLabel, Text.c_str(), Matrix3dgeoId, Options, ControlFlag);
+   }
+
+
+inline MIL_INT64 M3dgraAxis(MIL_ID List3dgraId, MIL_INT64 ParentLabel, MIL_ID Matrix3dgeoId, MIL_DOUBLE AxisLength, const MIL_STRING& Name, MIL_INT64 Options, MIL_INT64 ControlFlag)
+   {
+   return M3dgraAxis(List3dgraId, ParentLabel, Matrix3dgeoId, AxisLength, Name.c_str(), Options, ControlFlag);
+   }
+#endif /* M_MIL_USE_STRING */
+
+// ----------------------------------------------------------
+// Overload for std::vector.
+#if defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+// ----------------------------------------------------------
+// Overloads for std::vector in  M3dgraInquire.
+   template <typename UserType>
+   inline MIL_INT64 MFTYPE M3dgraInquire(MIL_ID List3dgraId, MIL_INT64 Label, MIL_INT64 InquireType, std::vector<UserType> &UserVarPtr)
+      {
+      // If the given MIL data type is not the same as the SrcType, change it to the correct one
+      // and give a warning.
+      MIL_INT64 InternalTrueDataTypeForStdVector = MilTraits<UserType>::TypeFlag;
+
+#if M_MIL_USE_SAFE_TYPE
+      if(M_GET_HLVLDATATYPE(InquireType) != 0)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraInquire"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+         }
+#endif
+
+      InquireType = M_STRIP_HLVLDATATYPE(InquireType) + InternalTrueDataTypeForStdVector;
+
+      MIL_INT InternalNumberOfElementsForStdVector = 0;
+      M3dgraInquire(List3dgraId, Label, M_STRIP_HLVLDATATYPE(InquireType) + M_NB_ELEMENTS + M_TYPE_MIL_INT, &InternalNumberOfElementsForStdVector);
+
+      UserVarPtr.resize(InternalNumberOfElementsForStdVector);
+
+      if(InternalNumberOfElementsForStdVector > 0)
+         {
+         return M3dgraInquire(List3dgraId, Label, InquireType, &UserVarPtr[0]);
+         }
+      return 0;
+      }
+
+   // ----------------------------------------------------------
+   // Overloads for std::vector in M3dgraDots.
+   template <typename UserType>
+   inline MIL_INT64 MFTYPE M3dgraDots(MIL_ID List3dgraId,
+                                      MIL_INT64 ParentLabel,
+                                      MIL_INT NumPoints,
+                                      const std::vector<UserType>& CoordXArrayPtr,
+                                      const std::vector<UserType>& CoordYArrayPtr,
+                                      const std::vector<UserType>& CoordZArrayPtr,
+                                      CMilArrayParamIn PointsRArrayPtr,
+                                      CMilArrayParamIn PointsGArrayPtr,
+                                      CMilArrayParamIn PointsBArrayPtr,
+                                      MIL_INT64 ControlFlag)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      if(!PointsRArrayPtr.IsValidParam() ||
+         !PointsGArrayPtr.IsValidParam() ||
+         !PointsBArrayPtr.IsValidParam())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The input arrays cannot be a non-zero integer."));
+         }
+      if((!PointsRArrayPtr.IsNullPtr() && PointsRArrayPtr.GetMilDataType() != MilTraits<MIL_UINT8>::TypeFlag) ||
+         (!PointsGArrayPtr.IsNullPtr() && PointsGArrayPtr.GetMilDataType() != MilTraits<MIL_UINT8>::TypeFlag) ||
+         (!PointsBArrayPtr.IsNullPtr() && PointsBArrayPtr.GetMilDataType() != MilTraits<MIL_UINT8>::TypeFlag))
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The data type of the color vectors must be MIL_UINT8."));
+         }
+      if(CoordXArrayPtr.size() != CoordYArrayPtr.size() || CoordXArrayPtr.size() != CoordZArrayPtr.size())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The coordinate vectors must have the same size."));
+         }
+      if(CoordXArrayPtr.empty())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The coordinate vectors cannot be empty."));
+         }
+      if((PointsRArrayPtr.IsNullPtr() != PointsGArrayPtr.IsNullPtr()) ||
+         (PointsRArrayPtr.IsNullPtr() != PointsBArrayPtr.IsNullPtr()) ||
+         (!PointsRArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != PointsRArrayPtr.Size<MIL_UINT8>()) ||
+         (!PointsGArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != PointsGArrayPtr.Size<MIL_UINT8>()) ||
+         (!PointsBArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != PointsBArrayPtr.Size<MIL_UINT8>()))
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("The color vectors must either all be empty or have the same size as the coordinate vectors."));
+         }
+      if(NumPoints <= 0)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("NumPoints parameter must be greater than zero."));
+         }
+      if(NumPoints > (MIL_INT)CoordXArrayPtr.size() && NumPoints != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraDots"), MIL_TEXT("NumPoints parameter must be smaller or equal (M_DEFAULT) to the size of the coordinate vectors."));
+         }
+#endif
+      if(NumPoints == M_DEFAULT || NumPoints > (MIL_INT)CoordXArrayPtr.size())
+         {
+         NumPoints = (MIL_INT)CoordXArrayPtr.size();
+         }
+
+      return M3dgraDots(List3dgraId,
+                        ParentLabel,
+                        NumPoints,
+                        &CoordXArrayPtr[0],
+                        &CoordYArrayPtr[0],
+                        &CoordZArrayPtr[0],
+                        PointsRArrayPtr.GetData<MIL_UINT8>(),
+                        PointsGArrayPtr.GetData<MIL_UINT8>(),
+                        PointsBArrayPtr.GetData<MIL_UINT8>(),
+                        ControlFlag);
+      }
+   // ----------------------------------------------------------
+   // Overloads for std::vector in M3dgraPolygon.
+   template <typename UserType>
+   inline MIL_INT64 MFTYPE M3dgraPolygon(MIL_ID List3dgraId,
+                                         MIL_INT64 ParentLabel,
+                                         MIL_INT64 CreationMode,
+                                         MIL_INT NumPoints,
+                                         const std::vector<UserType>& CoordXArrayPtr,
+                                         const std::vector<UserType>& CoordYArrayPtr,
+                                         const std::vector<UserType>& CoordZArrayPtr,
+                                         CMilArrayParamIn TextureXArrayPtr,
+                                         CMilArrayParamIn TextureYArrayPtr,
+                                         MIL_ID TextureBufId,
+                                         MIL_INT64 ControlFlag)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      if(!TextureXArrayPtr.IsValidParam() ||
+         !TextureYArrayPtr.IsValidParam())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The input arrays cannot be a non-zero integer."));
+         }
+      if((!TextureXArrayPtr.IsNullPtr() && TextureXArrayPtr.GetMilDataType() != MilTraits<UserType>::TypeFlag) ||
+         (!TextureYArrayPtr.IsNullPtr() && TextureYArrayPtr.GetMilDataType() != MilTraits<UserType>::TypeFlag))
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The coordinate and texture vectors must all have the same data type."));
+         }
+      if(CoordXArrayPtr.size() != CoordYArrayPtr.size() || CoordXArrayPtr.size() != CoordZArrayPtr.size())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The coordinate vectors must have the same size."));
+         }
+      if(CoordXArrayPtr.empty())
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The vectors cannot be empty."));
+         }
+      if((TextureXArrayPtr.IsNullPtr() != TextureYArrayPtr.IsNullPtr()) ||
+         (!TextureXArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != TextureXArrayPtr.Size<UserType>()) ||
+         (!TextureYArrayPtr.IsNullPtr() && (MIL_INT)CoordXArrayPtr.size() != TextureYArrayPtr.Size<UserType>()))
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("The texture vectors must either both be null or have the same size as the coordinate vectors."));
+         }
+      if(NumPoints <= 0)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("NumPoints parameter must be greater than zero."));
+         }
+      if(NumPoints > (MIL_INT)CoordXArrayPtr.size() && NumPoints != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("M3dgraPolygon"), MIL_TEXT("NumPoints parameter must be smaller or equal (M_DEFAULT) to the size of the coordinate vectors."));
+         }
+#endif
+      if(NumPoints == M_DEFAULT || NumPoints > (MIL_INT)CoordXArrayPtr.size())
+         {
+         NumPoints = (MIL_INT)CoordXArrayPtr.size();
+         }
+
+      return M3dgraPolygon(List3dgraId,
+                           ParentLabel,
+                           CreationMode,
+                           NumPoints,
+                           &CoordXArrayPtr[0],
+                           &CoordYArrayPtr[0],
+                           &CoordZArrayPtr[0],
+                           TextureXArrayPtr.GetData<UserType>(),
+                           TextureYArrayPtr.GetData<UserType>(),
+                           TextureBufId,
+                           ControlFlag);
+      }
+#endif // defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+
+
+////////////////////////////////////////////////////////////////////////////////
+// MIL_UNIQUE_ID support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+#if M_MIL_USE_SAFE_TYPE
+template <> inline bool MilIsCorrectObjectType<&M3dgraFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_3D_GRAPHIC_LIST;
+   }
+#endif
+typedef MIL_UNIQUE_ID<&M3dgraFree > MIL_UNIQUE_3DGRA_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+//3DGRA
+inline MIL_UNIQUE_3DGRA_ID M3dgraAlloc(MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_3DGRA_ID(M3dgraAlloc(SysId, ControlFlag, M_NULL));
+   }
+
+template <MilFreeFuncType FreeFunc> inline void M3dgraFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+
+
+// End of MIL_UNIQUE_ID support
+////////////////////////////////////////////////////////////////////////////////
+#endif // __MIL3DGRA_H__
diff --git a/Lib/Matrox/Include/MILDyn/milcom.h b/Lib/Matrox/Include/MILDyn/milcom.h
new file mode 100644
index 0000000..0765387
--- /dev/null
+++ b/Lib/Matrox/Include/MILDyn/milcom.h
@@ -0,0 +1,326 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MILCOM.H
+// Content           :  Define for the Mcom module
+// Revision          :  10.35.1105
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2019.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+#ifndef __MILCOM_H__
+#define __MILCOM_H__
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* General milcom defines */
+#define M_COM_SUCCESS                  0
+#define M_COM_ERROR                    1
+
+// Allocation control flags
+#define M_NO_RXYZ_SWAP                      0x00000001
+#define M_COM_NO_CONNECT                    0x00000002
+#define M_COM_NO_CONNECT_NO_RXYZ_SWAP       0x00000004
+#define M_COM_EMULATION                     0x00000008
+
+/**************************************************************************/
+/* McomAlloc TypeofProtocol                                               */
+/**************************************************************************/
+#define M_COM_PROTOCOL_PROFINET     1
+#define M_COM_PROTOCOL_ETHERNETIP   2
+#define M_COM_PROTOCOL_MODBUS       3
+#define M_COM_PROTOCOL_EPSON        4
+#define M_COM_PROTOCOL_ABB          5
+#define M_COM_PROTOCOL_FANUC        6
+#define M_COM_PROTOCOL_KUKA         7
+#define M_COM_PROTOCOL_MOTOMAN      8
+#define M_COM_PROTOCOL_DENSO        9
+#define M_COM_PROTOCOL_STAUBLI      10
+#define M_COM_PROTOCOL_GENERIC      11
+#define M_COM_PROTOCOL_CCLINK       12
+#define M_COM_PROTOCOL_OPCUA        13
+
+/**************************************************************************/
+/* McomRead/McomWrite description                                         */
+/**************************************************************************/
+#define M_DISCRETE_INPUT     MIL_TEXT("M_DISCRETE_INPUT")
+#define M_COILS              MIL_TEXT("M_COILS")
+#define M_HOLDING_REGISTER   MIL_TEXT("M_HOLDING_REGISTER")
+#define M_INPUT_REGISTER     MIL_TEXT("M_INPUT_REGISTER")
+
+#define M_COM_ETHERNETIP_PRODUCER_ID  110
+#define M_COM_ETHERNETIP_PRODUCER     MIL_TEXT("110")
+#define M_COM_ETHERNETIP_CONSUMER_ID  111
+#define M_COM_ETHERNETIP_CONSUMER     MIL_TEXT("111")
+#define M_COM_ETHERNETIP_CONFIG_ID    112
+#define M_COM_ETHERNETIP_CONFIG       MIL_TEXT("112")
+
+#define M_COM_MODBUS_PATH(id,table) MIL_TEXT(#id) MIL_TEXT("/") table
+#define M_COM_MODBUS_TCP_PATH(slave,id,table) MIL_TEXT(#id) MIL_TEXT("@") MIL_TEXT(slave) MIL_TEXT("/") table
+#define M_COM_ETHERNETIP_PATH(assembly) MIL_TEXT("/") MIL_TEXT(#assembly)
+#define M_COM_ETHERNETIP_REMOTE_PATH(assembly, remote) MIL_TEXT(slave) MIL_TEXT("/") MIL_TEXT(#assembly)
+#define M_COM_PROFINET_PATH(module) MIL_TEXT("/") MIL_TEXT(#module)
+
+// CClink Device
+#define M_COM_CCLINK_RAW                                 MIL_TEXT("RAW")
+#define M_COM_CCLINK_INPUT_FLAG                          MIL_TEXT("RX")
+#define M_COM_CCLINK_OUTPUT_FLAG                         MIL_TEXT("RY")
+#define M_COM_CCLINK_INPUT_REGISTER                      MIL_TEXT("RWR")
+#define M_COM_CCLINK_OUTPUT_REGISTER                     MIL_TEXT("RWW")
+
+// CClink Raw mode Offset
+#define M_COM_CCLINK_FORCE_READ_INPUT                    (1UL << 0)
+
+#define M_COM_CCLINK_FLAGS_MEMORY_BANK                   (1UL << 1)
+#define M_COM_CCLINK_INPUT_FLAGS_MEMORY_BANK             (M_COM_CCLINK_FLAGS_MEMORY_BANK | M_COM_CCLINK_FORCE_READ_INPUT)
+#define M_COM_CCLINK_OUTPUT_FLAGS_MEMORY_BANK            (M_COM_CCLINK_FLAGS_MEMORY_BANK)
+
+#define M_COM_CCLINK_REGISTERS_MEMORY_BANK               (1UL << 2)
+#define M_COM_CCLINK_INPUT_REGISTERS_MEMORY_BANK         (M_COM_CCLINK_REGISTERS_MEMORY_BANK | M_COM_CCLINK_FORCE_READ_INPUT)
+#define M_COM_CCLINK_OUTPUT_REGISTERS_MEMORY_BANK        (M_COM_CCLINK_REGISTERS_MEMORY_BANK)
+
+/**************************************************************************/
+/* Mcom control/Inquire settings                                          */
+/**************************************************************************/
+//General
+#define M_COM_REMOTE_ADDRESS                 (2|M_CLIENT_ENCODING)
+#define M_COM_REMOTE_ADDRESS_SIZE            (M_STRING_SIZE + M_COM_REMOTE_ADDRESS)
+#define M_COM_REMOTE_PORT                    3
+
+#define M_COM_PROFINET_DEVICEID              7
+#define M_COM_PROFINET_GET_MODULES           8
+#define M_COM_HOOK_ID                        9
+#define M_COM_START                          10
+#define M_COM_TIMEOUT                        11
+#define M_COM_ABORT                          12
+#define M_COM_PROFINET_GET_PLC_STATE         13
+#define M_COM_GET_CONNECTION_STATE           14
+#define M_COM_IS_HARDWARE                    15
+#define M_COM_PROTOCOL_TYPE                  16
+#define M_COM_DEVICE_DESCRIPTION             (17|M_CLIENT_ENCODING)
+#define M_COM_DEVICE_DESCRIPTION_SIZE        (M_STRING_SIZE + M_COM_DEVICE_DESCRIPTION)
+#define M_COM_INIT_VALUE                     19
+#define M_COM_EMULATION_MODE                 20
+#define M_COM_EMULATOR_SYNC                  21
+#define M_COM_INSTANCE_NAME                  (22|M_CLIENT_ENCODING)
+#define M_COM_PROTOCOL_VERSION               23
+#define M_COM_INSTANCE_NAME_SIZE             (M_STRING_SIZE + M_COM_INSTANCE_NAME)
+
+//Robot
+#define M_COM_ROBOT_CONNECT                 106
+#define M_COM_ROBOT_TIMEOUT                 107
+#define M_COM_ROBOT_ISCONNECTED             108
+#define M_COM_ROBOT_COMMAND_ABORT           109
+#define M_COM_ROBOT_COMMAND_TIMEOUT         110
+#define M_COM_ROBOT_DISCONNECT              111
+#define M_COM_ROBOT_CONNECT_RETRY           112
+#define M_COM_ROBOT_CONNECT_RETRY_WAIT      113
+
+//Cclink
+#define M_COM_CCLINK_START                   1000
+#define M_COM_CCLINK_TOTAL_OCCUPIED_STATION  M_COM_CCLINK_START + 1
+
+//Opcua - Open Platform Communications Unified Architecture
+#define M_COM_OPCUA_START                   2000
+#define M_COM_OPCUA_NODESET_LIST            M_COM_OPCUA_START + 1
+
+//Ethernet/IP
+#define M_COM_ETHERNETIP_START              20000
+#define M_COM_ETHERNETIP_CONSUMER_SIZE      M_COM_ETHERNETIP_START + 1
+#define M_COM_ETHERNETIP_PRODUCER_SIZE      M_COM_ETHERNETIP_START + 2
+#define M_COM_ETHERNETIP_CONFIG_SIZE        M_COM_ETHERNETIP_START + 3
+#define M_COM_ETHERNETIP_ASSEMBLY_LIST      M_COM_ETHERNETIP_START + 4
+
+//Profinet Array
+#define M_COM_PROFINET_GET_MODULE_ID             10000
+#define M_COM_PROFINET_GET_MODULE_ID_RANGE       500
+   //We reserve 500 ID for modules ID
+
+#define M_COM_PROFINET_GET_SUBMODULE_ID          (M_COM_PROFINET_GET_MODULE_ID + M_COM_PROFINET_GET_MODULE_ID_RANGE)
+#define M_COM_PROFINET_GET_SUBMODULE_ID_RANGE    500
+   //We reserve 500 ID for modules ID
+
+#define M_COM_PROFINET_GET_MODULE_INSIZE         (M_COM_PROFINET_GET_SUBMODULE_ID + M_COM_PROFINET_GET_SUBMODULE_ID_RANGE)
+#define M_COM_PROFINET_GET_MODULE_INSIZE_RANGE   500
+   //We reserve 500 ID for module IN size
+
+#define M_COM_PROFINET_GET_MODULE_OUTSIZE        (M_COM_PROFINET_GET_MODULE_INSIZE + M_COM_PROFINET_GET_MODULE_INSIZE_RANGE)
+#define M_COM_PROFINET_GET_MODULE_OUTSIZE_RANGE  500
+#define M_COM_PROFINET_START                     (M_COM_PROFINET_GET_MODULE_OUTSIZE + M_COM_PROFINET_GET_MODULE_OUTSIZE_RANGE) 
+#define M_COM_PROFINET_INPUT_SIZE                M_COM_PROFINET_START + 1
+#define M_COM_PROFINET_OUTPUT_SIZE               M_COM_PROFINET_START + 2
+   //We reserve 500 ID for module OUT size
+
+/**************************************************************************/
+/* McomControl Parameter                                                  */
+/**************************************************************************/
+
+/**************************************************************************/
+/* McomInquire Parameter                                                  */
+/**************************************************************************/
+
+//Values for M_COM_PROFINET_GET_PLC_STATE
+#define M_COM_PROFINET_STATUS_STOP            0x0001
+#define M_COM_PROFINET_STATUS_RUN             0x0002
+#define M_COM_PROFINET_STATUS_PRIMARY         0x0010
+#define M_COM_PROFINET_STATUS_BACKUP          0x0020
+#define M_COM_PROFINET_STATUS_STATION_OK      0x0040
+/**************************************************************************/
+/* McomHookFunction HookType                                              */
+/**************************************************************************/
+#define M_COM_ERROR_TRIGGER     4
+#define M_COM_DATA_CHANGE       5
+
+#define M_COM_GET_HOOK_INFO_SIZE   0x8000000000000000
+/**************************************************************************/
+/* McomGetHookInfo(), Info type                                           */
+/**************************************************************************/
+#define M_COM_ID                             99
+
+#define M_COM_ERROR_NUMBER                   56
+#define M_COM_PROFINET_SLOT_CHANGED_COUNT    57
+#define M_COM_PROFINET_SLOT_CHANGED_LIST     58
+#define M_COM_EVENT_ID                       59
+
+#define M_COM_ERR_OFFSET                     47000L
+
+/**************************************************************************/
+/* McomQueryProtocols                                                     */
+/**************************************************************************/
+#define M_COM_PROTOCOL_NAME_SIZE       50
+#define M_COM_PROTOCOL_TYPE_ALL        0
+#define M_COM_PROTOCOL_TYPE_PLC        1
+#define M_COM_PROTOCOL_TYPE_ROBOT      2
+
+/**************************************************************************/
+/* McomSendPositionXXX                                                    */
+/**************************************************************************/
+#define M_COM_FIND_POSITION_REQUEST          1
+#define M_COM_ROBOT_FIND_POSITION_RESULT     2
+#define M_COM_USER_OPCODE                    1000
+/**************************************************************************/
+/* Function prototypes                                                    */
+/**************************************************************************/
+
+typedef MIL_HOOK_FUNCTION_PTR MIL_COM_HOOK_FUNCTION_PTR;
+
+#if M_MIL_USE_UNICODE
+MIL_ID MFTYPE McomAllocW(MIL_ID SysId, MIL_INT64 ProtocolType, MIL_CONST_TEXTW_PTR DeviceDescription, MIL_INT64 InitFlag, MIL_INT64 InitValue, MIL_ID* ComIdPtr);
+MIL_ID MFTYPE McomAllocA(MIL_ID SysId, MIL_INT64 ProtocolType, MIL_CONST_TEXTA_PTR DeviceDescription, MIL_INT64 InitFlag, MIL_INT64 InitValue, MIL_ID* ComIdPtr);
+void MFTYPE McomReadW(MIL_ID ComId, MIL_CONST_TEXTW_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, void* UserArrayPtr);
+void MFTYPE McomReadA(MIL_ID ComId, MIL_CONST_TEXTA_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, void* UserArrayPtr);
+void MFTYPE McomWriteW(MIL_ID ComId, MIL_CONST_TEXTW_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, const void* UserArrayPtr);
+void MFTYPE McomWriteA(MIL_ID ComId, MIL_CONST_TEXTA_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, const void* UserArrayPtr);
+MIL_INT MFTYPE McomQueryProtocolsW(MIL_ID SystemId, MIL_INT Type, MIL_INT Version, MIL_INT Index, MIL_TEXTW_PTR Name, MIL_INT64* Id);
+MIL_INT MFTYPE McomQueryProtocolsA(MIL_ID SystemId, MIL_INT Type, MIL_INT Version, MIL_INT Index, MIL_TEXTA_PTR Name, MIL_INT64* Id);
+void MFTYPE McomControlText(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue);
+void MFTYPE McomControlTextW(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR ControlValue);
+void MFTYPE McomControlTextA(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR ControlValue);
+#else
+MIL_ID MFTYPE McomAlloc(MIL_ID SysId, MIL_INT64 ProtocolType, MIL_CONST_TEXT_PTR DeviceDescription, MIL_INT64 InitFlag, MIL_INT64 InitValue, MIL_ID* ComIdPtr);
+void MFTYPE McomRead(MIL_ID ComId, MIL_CONST_TEXT_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, void* UserArrayPtr);
+void MFTYPE McomWrite(MIL_ID ComId, MIL_CONST_TEXT_PTR DataObjectEntryName, MIL_INT Offset, MIL_INT Size, const void* UserArrayPtr);
+MIL_INT MFTYPE McomQueryProtocols(MIL_ID SystemId, MIL_INT Type, MIL_INT Version, MIL_INT Index, MIL_TEXT_PTR Name, MIL_INT64* Id);
+void MFTYPE McomControlText(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue);
+#endif
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+void MFTYPE McomControlInt64(MIL_ID ComId,
+                             MIL_INT64 ControlType,
+                             MIL_INT64 ControlValue);
+void MFTYPE McomControlDouble(MIL_ID ComId,
+                              MIL_INT64 ControlType,
+                              MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+#define McomControlInt64  McomControl
+#define McomControlDouble McomControl
+void MFTYPE McomControl(MIL_ID ComId,
+                        MIL_INT64 ControlType,
+                        MIL_DOUBLE ControlValue);
+#endif
+
+MIL_INT MFTYPE McomInquire(MIL_ID     ComId,
+                           MIL_INT64  InquireType,
+                           void*      UserVarPtr);
+
+MIL_INT MFTYPE McomHookFunction(MIL_ID ComId, MIL_INT HookType, MIL_COM_HOOK_FUNCTION_PTR HookHandlerPtr, void *UserDataPtr);
+
+MIL_INT MFTYPE McomGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+
+void MFTYPE McomSendPosition(MIL_ID ComId, MIL_INT64 OperationCode, MIL_INT64 Status, MIL_INT64 ObjectSpecifier, MIL_DOUBLE PositionX, MIL_DOUBLE PositionY, MIL_DOUBLE PositionZ, MIL_DOUBLE RotationX, MIL_DOUBLE RotationY, MIL_DOUBLE RotationZ, MIL_INT64 ControlFlag, MIL_DOUBLE ControlValue);
+void MFTYPE McomWaitPositionRequest(MIL_ID ComId, MIL_INT64 *OperationCodePtr, MIL_INT64 *StatusPtr, MIL_INT64 *ObjectSpecifierPtr, MIL_DOUBLE *PositionXPtr, MIL_DOUBLE *PositionYPtr, MIL_DOUBLE *PositionZPtr, MIL_DOUBLE *RotationXPtr, MIL_DOUBLE *RotationYPtr, MIL_DOUBLE *RotationZPtr, MIL_INT64 ControlFlag, MIL_DOUBLE ControlValue);
+void MFTYPE McomSendCommand(MIL_ID ComId, MIL_INT64 OperationCode, MIL_INT64 Status, MIL_INT64 DataSize, void* DataPtr, MIL_INT64 ControlFlag, MIL_DOUBLE ControlValue);
+void MFTYPE McomReceiveCommand(MIL_ID ComId, MIL_INT64 *OperationCodePtr, MIL_INT64 *StatusPtr, MIL_INT64 ArraySize, void* ArrayPtr, MIL_INT64 *ReceivedDataSizePtr, MIL_INT64 ControlFlag, MIL_DOUBLE ControlValue);
+
+void MFTYPE McomFree(MIL_ID ComId);
+
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+#define McomRead         McomReadW
+#define McomWrite        McomWriteW
+#define McomAlloc        McomAllocW
+#define McomQueryProtocols McomQueryProtocolsW
+#else
+#define McomRead         McomReadA
+#define McomWrite        McomWriteA
+#define McomAlloc        McomAllocA
+#define McomQueryProtocols McomQueryProtocolsA
+#undef McomControlText
+#define McomControlText McomControlTextA
+#endif
+#endif
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+}
+#endif
+
+#if M_MIL_USE_64BIT
+#ifdef __cplusplus
+//////////////////////////////////////////////////////////////
+// McomControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, int ControlValue)
+   {
+   McomControlInt64(ComId, ControlType, ControlValue);
+   };
+#endif
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   McomControlInt64(ComId, ControlType, ControlValue);
+   };
+
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, MIL_INT64 ControlValue)
+   {
+   McomControlInt64(ComId, ControlType, ControlValue);
+   };
+
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
+   {
+   McomControlDouble(ComId, ControlType, ControlValue);
+   };
+
+inline void McomControl(MIL_ID ComId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   McomControlText(ComId, ControlType, ControlValue);
+   };
+#else
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. Int64 one
+//////////////////////////////////////////////////////////////
+#define McomControl  McomControlDouble
+
+
+#endif // __cplusplus
+#endif // M_MIL_USE_64BIT
+
+
+#endif /* __MILCOM_H__ */
diff --git a/Lib/Matrox/Include/MILDyn/mildisplay.h b/Lib/Matrox/Include/MILDyn/mildisplay.h
new file mode 100644
index 0000000..03444eb
--- /dev/null
+++ b/Lib/Matrox/Include/MILDyn/mildisplay.h
@@ -0,0 +1,2036 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MILDISPLAY.H
+* Revision     :  10.40.0640
+* Content      :  This file contains the defines necessary to use the
+*                 Matrox Imaging Library display module
+* Comments     :  
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+#ifndef __MIL_DISPLAY_H__
+#define __MIL_DISPLAY_H__
+
+/************************************************************************/
+/* MdispAlloc() for Windowed system                                     */
+/************************************************************************/
+#define M_MIL_DISPLAY_WND_CLASS_NAME MIL_TEXT("MIL Default Window")
+
+// Maximum number of display that can be managed
+#define M_MAX_VIDEO_DEVICE                            64L
+
+/* DispNum */
+#define M_DEV0                                        0L
+#define M_DEV1                                        1L
+#define M_DEV2                                        2L
+#define M_DEV3                                        3L
+#define M_DEV4                                        4L
+#define M_DEV5                                        5L
+#define M_DEV6                                        6L
+#define M_DEV7                                        7L
+#define M_DEV8                                        8L
+#define M_DEV9                                        9L
+#define M_DEV10                                       10L
+#define M_DEV11                                       11L
+#define M_DEV12                                       12L
+#define M_DEV13                                       13L
+#define M_DEV14                                       14L
+#define M_DEV15                                       15L
+#define M_DEV16                                       16L
+#define M_DEV17                                       17L
+#define M_DEV18                                       18L
+#define M_DEV19                                       19L
+#define M_DEV20                                       20L
+#define M_DEV21                                       21L
+#define M_DEV22                                       22L
+#define M_DEV23                                       23L
+#define M_DEV24                                       24L
+#define M_DEV25                                       25L
+#define M_DEV26                                       26L
+#define M_DEV27                                       27L
+#define M_DEV28                                       28L
+#define M_DEV29                                       29L
+#define M_DEV30                                       30L
+#define M_DEV31                                       31L
+#define M_DEV32                                       32L
+#define M_DEV33                                       33L
+#define M_DEV34                                       34L
+#define M_DEV35                                       35L
+#define M_DEV36                                       36L
+#define M_DEV37                                       37L
+#define M_DEV38                                       38L
+#define M_DEV39                                       39L
+#define M_DEV40                                       40L
+#define M_DEV41                                       41L
+#define M_DEV42                                       42L
+#define M_DEV43                                       43L
+#define M_DEV44                                       44L
+#define M_DEV45                                       45L
+#define M_DEV46                                       46L
+#define M_DEV47                                       47L
+#define M_DEV48                                       48L
+#define M_DEV49                                       49L
+#define M_DEV50                                       50L
+#define M_DEV51                                       51L
+#define M_DEV52                                       52L
+#define M_DEV53                                       53L
+#define M_DEV54                                       54L
+#define M_DEV55                                       55L
+#define M_DEV56                                       56L
+#define M_DEV57                                       57L
+#define M_DEV58                                       58L
+#define M_DEV59                                       59L
+#define M_DEV60                                       60L
+#define M_DEV61                                       61L
+#define M_DEV62                                       62L
+#define M_DEV63                                       63L
+#define M_CRTC0                                       0x00010000L
+#define M_CRTC1                                       0x00020000L
+#define M_CRTC2                                       0x00030000L
+#define M_CRTC3                                       0x00040000L
+#define M_CRTC4                                       0x00050000L
+#define M_CRTC5                                       0x00060000L
+#define M_CRTC6                                       0x00070000L
+#define M_CRTC_MASK                                   0x00070000L
+#define M_CRTC_OFFSET                                 (16)
+#define M_CRTC_INDEX(a)                               (((a&M_CRTC_MASK)>>M_CRTC_OFFSET)-1)
+#define M_DEVICE_NUMBER_MASK                          0x000003F
+#define M_DEVICE_NUMBER(a)                            (a&M_DEVICE_NUMBER_MASK)
+#define M_ALL_VALID_DISP_DEV_BITS                     (M_DEVICE_NUMBER_MASK | M_CRTC_MASK | M_MONITOR_BITS)
+#define M_DISPLAY_NUMBER(devindex,crtcindex)          (devindex|((crtcindex+1)<<M_CRTC_OFFSET))
+#define M_CENTER                                      0x00000080L
+/* display positions values */
+#define M_LEFT                                        0x00000100L
+#define M_RIGHT                                       0x00000200L
+#define M_TOP                                         0x00000400L
+#define M_BOTTOM                                      0x00000800L
+#define M_MONITOR_BITS                                0x00000F80
+#define M_MONITOR_POSITION(p)                         ((M_NULL == (p&(~M_MONITOR_BITS)))? (p&M_MONITOR_BITS): M_NULL)
+#define M_MOUSE_RESTRICTED                            0x00000001L
+
+/* Init Flag */
+#define M_REMOTE_DISPLAY                              0x00000001L
+#define M_ASYNC_CUSTOM                                0x00000002L
+#define M_DISPLAY_PROGRESSIVE                         0x00000004L
+#define M_DISPLAY_INTERLACED                          0x00000008L
+#define M_LOCAL_DISPLAY                               0x00000010L
+//#define  AVAILABLE                                  0x00000020L Reserved for 3ddisp
+//#define  AVAILABLE                                  0x00000040L
+//#define  AVAILABLE                                  0x00000080L
+//#define  AVAILABLE                                  0x00000100L
+#define M_NETWORK                                     0x00000200L
+#define M_EXCLUSIVE                                   0x00000400L
+//#define  AVAILABLE                                  0x00000800L
+#define M_XDUAL_SCREEN                                0x00001000L
+#define M_VIDEO_HD                                    0x00002000L
+#define M_DUAL_SCREEN                                 0x00004000L
+#define M_VIDEO_ENCODER                               0x00008000L
+#define M_AUXILIARY                                   0x00010000L
+//#define  AVAILABLE                                  0x00020000L
+#define M_EXTERNAL                                    0x00040000L
+#define M_VIDEO_HARDWARE_DEVICE                       0x00080000L
+#define M_WPF                                         0x00100000L
+#define M_IN_BUFFER_DISPLAY                           0x00200000L
+#define M_RENDER_TO_BUFFER                            0x00400000L
+#define M_WEB                                         0x00800000L
+#define M_WINDOWED                                    0x01000000L
+//#define  AVAILABLE                                  0x02000000L
+//#define  AVAILABLE                                  0x04000000L
+#define M_MIL_WINDOW                                  0x08000000L
+#define M_USER_WINDOW                                 0x10000000L
+#define M_GDI_OVERLAY                                 0x20000000L
+#define  M_FULL_SCREEN                                0x40000000L //M_LOCAL_DISPLAY_CONTROL
+//NOT available (sign bit)                            0x80000000L
+#define M_ALL_INIT_FLAGS                              0x41F5F62FL //for basic-display
+#define M_DOCUMENTED_INIT_FLAGS                       (M_WINDOWED|M_AUXILIARY|M_DUAL_SCREEN|M_VIDEO_ENCODER|M_EXCLUSIVE)
+#define M_DISPLAY_LOCATION                            (M_LOCAL_DISPLAY|M_REMOTE_DISPLAY)
+#define M_IS_EXCLUSIVE(InitFlag)                      (InitFlag&M_EXCLUSIVE)
+
+/************************************************************************/
+/* MdispInquire() / MdispControl() Types                                */
+/************************************************************************/
+#define M_LOCAL_DISPLAY_CONTROL                       0X40000000L
+#define M_REMOTE_DISPLAY_CONTROL                      0X20000000L
+#define M_FORCED_LOCAL_DISPLAY_CONTROL                0x10000000L
+#define M_FORCED_REMOTE_DISPLAY_CONTROL               0x08000000L
+#define M_POST_CONTROL                                0x04000000L
+
+#define M_IS_POST_CONTROL(X)                          ((X)&M_POST_CONTROL)
+#define M_ORIGINAL_DISPLAY_CONTROL(X)                 ((X)&~(M_FORCED_LOCAL_DISPLAY_CONTROL|M_FORCED_REMOTE_DISPLAY_CONTROL))
+#define M_FORCE_ON_LOCAL_DISPLAY(X)                   ((X) | M_FORCED_LOCAL_DISPLAY_CONTROL)
+#define M_FORCE_ON_REMOTE_DISPLAY(X)                  ((X) | M_FORCED_REMOTE_DISPLAY_CONTROL)
+#define M_IS_FORCED_ON_LOCAL_DISPLAY(X)               (((X) & M_FORCED_LOCAL_DISPLAY_CONTROL))
+#define M_IS_FORCED_ON_REMOTE_DISPLAY(X)              (((X) & M_FORCED_REMOTE_DISPLAY_CONTROL))
+
+// Shared controls/inquires with other modules (not all listed)
+#define M_SIZE_X                                      1536L //M_LOCAL_DISPLAY_CONTROL // 0x600
+#define M_SIZE_Y                                      1537L //M_LOCAL_DISPLAY_CONTROL // 0x601
+#define M_SIZE_Z                                      1538L //M_LOCAL_DISPLAY_CONTROL // 0x602
+#define M_SIZE_BAND                                   1005L //M_LOCAL_DISPLAY_CONTROL
+#define M_SIZE_BAND_LUT                               1006L //M_REMOTE_DISPLAY_CONTROL
+#define M_SIZE_BIT                                    1007L //M_REMOTE_DISPLAY_CONTROL
+#define M_TYPE                                        1008L //M_REMOTE_DISPLAY_CONTROL
+#define M_NUMBER                                      1009L //M_LOCAL_DISPLAY_CONTROL
+#define M_INIT_FLAG                                   1012L //M_LOCAL_DISPLAY_CONTROL
+#define M_ATTRIBUTE                                   1013L //M_REMOTE_DISPLAY_CONTROL
+#define M_SIGN                                        1014L //M_REMOTE_DISPLAY_CONTROL
+#define M_THREAD_PRIORITY                             1019L //M_LOCAL_DISPLAY_CONTROL // Already defined in mil.h
+#define M_NEED_UPDATE                                 1020L //M_REMOTE_DISPLAY_CONTROL
+#define M_ENCODER_START                               1025L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER                                     M_ENCODER_START
+#define M_ENCODER_MODE                                1026L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_TYPE                                1027L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_SYNC_SOURCE                         1028L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_SYNC                                M_ENCODER_SYNC_SOURCE
+#define M_ENCODER_PEDESTAL                            1029L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_FILTER                              1030L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_RGB_SYNC                            1031L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_INFO_MODE                           1032L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_RESET                               1033L //M_LOCAL_DISPLAY_CONTROL   //1034 reseved
+#define M_ENCODER_SELECT_FIELD_ODD                    1037L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_SELECT_FIELD_EVEN                   1038L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_CONTRAST                            1039L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_BRIGHTNESS                          1040L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_SATURATION                          1041L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_HUE                                 1042L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_OVR_SHOW                            1043L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_OVR_LUT                             1044L //M_LOCAL_DISPLAY_CONTROL
+#define M_ENCODER_OVR_BUF_ID                          1045L //M_LOCAL_DISPLAY_CONTROL
+
+#define M_ENCODER_STATE                               M_ENCODER
+#define M_SYNC_TYPE                                   M_ENCODER_RGB_SYNC
+#define M_ENCODER_SYNC_LOCK                           M_ENCODER_SYNC_SOURCE
+#define M_ENCODER_SYNC_FIELDS                         1047L //M_REMOTE_DISPLAY_CONTROL
+#define M_ENCODER_CLOCK                               1048L //M_REMOTE_DISPLAY_CONTROL
+#define M_ENCODER_END                                 M_ENCODER_CLOCK
+#define M_Q_FACTOR                                    2564L //M_REMOTE_DISPLAY_CONTROL    // Already defined in mil.h
+#define M_MODIFICATION_COUNT                          5010L //M_REMOTE_DISPLAY_CONTROL    // Already defined in mil.h
+
+/************************************************************************/
+/* MdispInquire() Types MIL_ID range start                              */
+/************************************************************************/
+#define M_DISP_INQUIRE_MIL_ID_START                   1100L
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_OWNER_SYSTEM                                1101L //M_REMOTE_DISPLAY_CONTROL // Already define in mil.h
+#define M_LUT_ID                                      1102L //M_REMOTE_DISPLAY_CONTROL // Already define in mil.h
+#define M_SELECTED                                    1103L //M_REMOTE_DISPLAY_CONTROL
+#define M_OVERLAY_LUT                                 1104L //M_REMOTE_DISPLAY_CONTROL
+#define M_WINDOW_BUF_ID                               1105L //M_REMOTE_DISPLAY_CONTROL
+#define M_OVERLAY_ID                                  1106L //M_REMOTE_DISPLAY_CONTROL
+#define M_ASSOCIATED_LUT                              1110L //M_REMOTE_DISPLAY_CONTROL
+#define M_AUXILIARY_BUF_ID                            1115L //M_LOCAL_DISPLAY_CONTROL
+#define M_UNDERLAY_ID                                 1120L //M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SURFACE                             1121L //M_LOCAL_DISPLAY_CONTROL
+#define M_PRIMARY_SURFACE_ID                          1122L //M_REMOTE_DISPLAY_CONTROL
+#define M_USER_OVERLAY_ID                             1123L //M_REMOTE_DISPLAY_CONTROL
+#define M_COMPRESSED_DISPLAY_SURFACE                  1125L //M_REMOTE_DISPLAY_CONTROL
+#define M_ASYNCHRONOUS_DISPLAY_SURFACE                1126L //M_REMOTE_DISPLAY_CONTROL
+#define M_CURRENT_OVERLAY_ID                          1127L //M_REMOTE_DISPLAY_CONTROL
+#define M_DISP_INQUIRE_MIL_ID_END                     1199L
+/************************************************************************/
+/* MdispInquire() Types MIL_ID range end                                */
+/************************************************************************/
+
+
+#define M_PAN_X                                       3000L //M_LOCAL_DISPLAY_CONTROL
+#define M_PAN_Y                                       3001L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_X                                      3002L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_Y                                      3003L //M_LOCAL_DISPLAY_CONTROL
+#define M_HARDWARE_PAN                                3004L //M_LOCAL_DISPLAY_CONTROL
+#define M_HARDWARE_ZOOM                               3005L //M_LOCAL_DISPLAY_CONTROL
+#define M_KEY_MODE                                    3007L //M_REMOTE_DISPLAY_CONTROL
+#define M_KEY_CONDITION                               3008L //M_REMOTE_DISPLAY_CONTROL
+#define M_KEY_MASK                                    3009L //M_REMOTE_DISPLAY_CONTROL
+#define M_KEY_SUPPORTED                               3011L //M_REMOTE_DISPLAY_CONTROL
+#define M_TRANSPARENT_COLOR                           0x01000060L //M_LOCAL_DISPLAY_CONTROL
+#define M_OVERLAY                                     M_OVR //(0x00000080) M_REMOTE_DISPLAY_CONTROL
+#define M_INTERPOLATION_MODE                          3018L //M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_OFFSET                                 3019L
+#define M_FRAME_START_HANDLER_PTR                     3020L//needed for mil.dll? -applicationinfo
+#define M_FRAME_START_HANDLER_USER_PTR                3021L//needed for mil.dll? -applicationinfo
+#define M_OVERLAY_SHOW                                3023L //M_REMOTE_DISPLAY_CONTROL
+#define M_DISPLAY_MODE                                3029L //M_LOCAL_DISPLAY_CONTROL
+#define M_PIXEL_FORMAT                                3032L //M_LOCAL_DISPLAY_CONTROL
+#define M_LUT_SUPPORTED                               3033L //M_REMOTE_DISPLAY_CONTROL
+#define M_WINDOW_ZOOM                                 3051L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_RESIZE                               3052L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_OVERLAP                              3053L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SCROLLBAR                            3054L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PROTECT_AREA                         3056L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_TITLE_BAR                            3057L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MENU_BAR                             3058L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_TITLE_BAR_CHANGE                     3059L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MENU_BAR_CHANGE                      3060L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MOVE                                 3061L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SYSBUTTON                            3062L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MINBUTTON                            3063L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MAXBUTTON                            3064L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PALETTE_NOCOLLAPSE                   3069L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_RANGE                                3072L //M_LOCAL_DISPLAY_CONTROL // Already defined in mil.h
+#define M_WINDOW_UPDATE_ON_PAINT                      3081L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PAINT                                3083L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_INITIAL_POSITION_X                   3088L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_INITIAL_POSITION_Y                   3089L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_HANDLE                               3110L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_OFFSET_X                             3111L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_OFFSET_Y                             3112L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SIZE_X                               3113L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SIZE_Y                               3114L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PAN_X                                3115L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PAN_Y                                3116L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ZOOM_X                               3117L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ZOOM_Y                               3118L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE_OFFSET_X                     3141L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE_OFFSET_Y                     3142L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE_SIZE_X                       3145L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE_SIZE_Y                       3146L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ACTIVE                               3149L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ENABLE                               3150L //M_LOCAL_DISPLAY_CONTROL
+#define M_PALETTE_HANDLE                              3151L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_THREAD_HANDLE                        3152L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_THREAD_ID                            3153L //M_LOCAL_DISPLAY_CONTROL
+#define M_KEYBOARD_USE                                3155L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SYNC_UPDATE                          3165L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_PAINT_MESSAGES                       3172L //M_LOCAL_DISPLAY_CONTROL
+#define M_VIEW_MODE                                   3182L //M_REMOTE_DISPLAY_CONTROL
+#define M_VIEW_BIT_SHIFT                              3183L //M_REMOTE_DISPLAY_CONTROL
+#define M_UPDATE_WEB                                  3187L //M_LOCAL_DISPLAY_CONTROL
+#define M_NO_TEARING                                  3188L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_MAX_X                                  3190L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_MIN_X                                  3191L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_MAX_Y                                  3192L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_MIN_Y                                  3193L //M_LOCAL_DISPLAY_CONTROL
+#define M_DUAL_ZOOM                                   3197L //M_LOCAL_DISPLAY_CONTROL
+#define M_DUAL_ZOOM_SUPPORTED                         3198L //M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE                                      3199L //M_REMOTE_DISPLAY_CONTROL
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+//      M_UPDATE+M_SYNCHRONOUS                        3200L //M_REMOTE_DISPLAY_CONTROL
+//      M_UPDATE+M_ASYNCHRONOUS                       3201L //M_REMOTE_DISPLAY_CONTROL
+#define M_WINDOW_VISIBLE                              3202L //M_LOCAL_DISPLAY_CONTROL
+#define M_AUXILIARY_KEEP_DISPLAY_ALIVE                3207L //M_LOCAL_DISPLAY_CONTROL
+#define M_USE_MOUSE_PAN                               3208L //M_LOCAL_DISPLAY_CONTROL
+#define M_USE_MOUSE_ZOOM                              3209L //M_LOCAL_DISPLAY_CONTROL
+#define M_SELECT_VIDEO_SOURCE                         3210L //M_LOCAL_DISPLAY_CONTROL
+#define M_AUXILIARY_KEEP_UNDERLAY_ALIVE               3211L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_TRANSPARENCY                         3212L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_TRANSPARENT_COLOR                    3213L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ALPHA_BLENDING                       3214L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ALPHA_VALUE                          3215L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_LAYERED                              3216L //M_LOCAL_DISPLAY_CONTROL
+#define M_RESTRICTED_MOUSE_ACTIVATED                  3217L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_MODE                            3218L //M_LOCAL_DISPLAY_CONTROL
+#define M_MOUSE_USE                                   3219L //M_LOCAL_DISPLAY_CONTROL
+#define M_SOMEONE_HOOKED_TO_ANNOTATIONS_DRAW          3220L //M_LOCAL_DISPLAY_CONTROL
+#define M_REGION_OUTSIDE_SHOW                         3221L //M_LOCAL_DISPLAY_CONTROL
+#define M_REGION_INSIDE_SHOW                          3222L //M_LOCAL_DISPLAY_CONTROL
+#define M_REGION_OUTSIDE_COLOR                        3223L //M_LOCAL_DISPLAY_CONTROL
+#define M_REGION_INSIDE_COLOR                         3224L //M_LOCAL_DISPLAY_CONTROL
+#define M_UNIFIED_ZOOM                                3225L //M_LOCAL_DISPLAY_CONTROL
+#define M_ACTUAL_SIZE                                 3226L //M_LOCAL_DISPLAY_CONTROL
+#define M_HANDLE_MESSAGES                             3227L //M_LOCAL_DISPLAY_CONTROL
+#define M_MOUSE_CURSOR_CHANGE                         3229L //M_LOCAL_DISPLAY_CONTROL
+#define M_HANDLE_SET_CURSOR_MESSAGE                   M_MOUSE_CURSOR_CHANGE
+#define M_FORWARD_DISP_MESSAGES_TO_CLIENT             3233L //M_LOCAL_DISPLAY_CONTROL
+
+/******************************************************************************/
+
+#if OldDefinesSupport
+#define M_KEY_COLOR                                   M_TRANSPARENT_COLOR
+MIL_DEPRECATED(M_KEY_COLOR, 1000)
+#define M_WINDOW_OVR_WRITE                            M_OVERLAY
+MIL_DEPRECATED(M_WINDOW_OVR_WRITE, 1000)
+#define M_WINDOW_OVR_BUF_ID                           M_OVERLAY_ID
+MIL_DEPRECATED(M_WINDOW_OVR_BUF_ID, 1000)
+#define M_WINDOW_OVR_SHOW                             M_OVERLAY_SHOW
+MIL_DEPRECATED(M_WINDOW_OVR_SHOW, 1000)
+#define M_WINDOW_OVR_LUT                              M_OVERLAY_LUT
+MIL_DEPRECATED(M_WINDOW_OVR_LUT, 1000)
+#define M_WINDOW_UPDATE                               M_UPDATE
+MIL_DEPRECATED(M_WINDOW_UPDATE, 1000)
+#define M_DISP_NUMBER                                 M_NUMBER
+MIL_DEPRECATED(M_DISP_NUMBER, 1000)
+#define M_DISP_FORMAT                                 M_FORMAT
+MIL_DEPRECATED(M_DISP_FORMAT, 1000)
+#define M_DISP_INIT_FLAG                              M_INIT_FLAG
+MIL_DEPRECATED(M_DISP_INIT_FLAG, 1000)
+#define M_DISP_PAN_X                                  M_PAN_X
+MIL_DEPRECATED(M_DISP_PAN_X, 1000)
+#define M_DISP_PAN_Y                                  M_PAN_Y
+MIL_DEPRECATED(M_DISP_PAN_Y, 1000)
+#define M_DISP_ZOOM_X                                 M_ZOOM_X
+MIL_DEPRECATED(M_DISP_ZOOM_X, 1000)
+#define M_DISP_ZOOM_Y                                 M_ZOOM_Y
+MIL_DEPRECATED(M_DISP_ZOOM_Y, 1000)
+#define M_DISP_HARDWARE_PAN                           M_HARDWARE_PAN
+MIL_DEPRECATED(M_DISP_HARDWARE_PAN, 1000)
+#define M_DISP_HARDWARE_ZOOM                          M_HARDWARE_ZOOM
+MIL_DEPRECATED(M_DISP_HARDWARE_ZOOM, 1000)
+#define M_DISP_KEY_MODE                               M_KEY_MODE
+MIL_DEPRECATED(M_DISP_KEY_MODE, 1000)
+#define M_DISP_KEY_CONDITION                          M_KEY_CONDITION
+MIL_DEPRECATED(M_DISP_KEY_CONDITION, 1000)
+#define M_DISP_KEY_MASK                               M_KEY_MASK
+MIL_DEPRECATED(M_DISP_KEY_MASK, 1000)
+#define M_DISP_KEY_COLOR                              M_TRANSPARENT_COLOR
+MIL_DEPRECATED(M_DISP_KEY_COLOR, 1000)
+#define M_DISP_MODE                                   M_DISPLAY_MODE
+MIL_DEPRECATED(M_DISP_MODE, 1000)
+#define M_DISP_THREAD_PRIORITY                        M_THREAD_PRIORITY
+MIL_DEPRECATED(M_DISP_THREAD_PRIORITY, 1000)
+#define M_DISP_INTERPOLATION_MODE                     M_INTERPOLATION_MODE
+MIL_DEPRECATED(M_DISP_INTERPOLATION_MODE, 1000)
+#define M_DISP_HOOK_OFFSET                            M_HOOK_OFFSET
+MIL_DEPRECATED(M_DISP_HOOK_OFFSET, 1000)
+#define M_DISP_KEY_SUPPORTED                          M_KEY_SUPPORTED
+MIL_DEPRECATED(M_DISP_KEY_SUPPORTED, 1000)
+#define M_DISP_WINDOW_ZOOM                            M_WINDOW_ZOOM
+MIL_DEPRECATED(M_DISP_WINDOW_ZOOM, 1000)
+#define M_DISP_WINDOW_RESIZE                          M_WINDOW_RESIZE
+MIL_DEPRECATED(M_DISP_WINDOW_RESIZE, 1000)
+#define M_DISP_WINDOW_OVERLAP                         M_WINDOW_OVERLAP
+MIL_DEPRECATED(M_DISP_WINDOW_OVERLAP, 1000)
+#define M_DISP_WINDOW_SCROLLBAR                       M_WINDOW_SCROLLBAR
+MIL_DEPRECATED(M_DISP_WINDOW_SCROLLBAR, 1000)
+#define M_DISP_WINDOW_UPDATE                          M_UPDATE
+MIL_DEPRECATED(M_DISP_WINDOW_UPDATE, 1000)
+#define M_DISP_WINDOW_PROTECT_AREA                    M_WINDOW_PROTECT_AREA
+MIL_DEPRECATED(M_DISP_WINDOW_PROTECT_AREA, 1000)
+#define M_DISP_WINDOW_TITLE_BAR                       M_WINDOW_TITLE_BAR
+MIL_DEPRECATED(M_DISP_WINDOW_TITLE_BAR, 1000)
+#define M_DISP_WINDOW_MENU_BAR                        M_WINDOW_MENU_BAR
+MIL_DEPRECATED(M_DISP_WINDOW_MENU_BAR, 1000)
+#define M_DISP_WINDOW_TITLE_BAR_CHANGE                M_WINDOW_TITLE_BAR_CHANGE
+MIL_DEPRECATED(M_DISP_WINDOW_TITLE_BAR_CHANGE, 1000)
+#define M_DISP_WINDOW_MENU_BAR_CHANGE                 M_WINDOW_MENU_BAR_CHANGE
+MIL_DEPRECATED(M_DISP_WINDOW_MENU_BAR_CHANGE, 1000)
+#define M_DISP_WINDOW_MOVE                            M_WINDOW_MOVE
+MIL_DEPRECATED(M_DISP_WINDOW_MOVE, 1000)
+#define M_DISP_WINDOW_SYSBUTTON                       M_WINDOW_SYSBUTTON
+MIL_DEPRECATED(M_DISP_WINDOW_SYSBUTTON, 1000)
+#define M_DISP_WINDOW_MINBUTTON                       M_WINDOW_MINBUTTON
+MIL_DEPRECATED(M_DISP_WINDOW_MINBUTTON, 1000)
+#define M_DISP_WINDOW_MAXBUTTON                       M_WINDOW_MAXBUTTON
+MIL_DEPRECATED(M_DISP_WINDOW_MAXBUTTON, 1000)
+#define M_DISP_WINDOW_PALETTE_NOCOLLAPSE              M_WINDOW_PALETTE_NOCOLLAPSE
+MIL_DEPRECATED(M_DISP_WINDOW_PALETTE_NOCOLLAPSE, 1000)
+#define M_DISP_WINDOW_UPDATE_WITH_MESSAGE             M_WINDOW_UPDATE_WITH_SEND_MESSAGE
+MIL_DEPRECATED(M_DISP_WINDOW_UPDATE_WITH_MESSAGE, 1000)
+#define M_DISP_WINDOW_PAINT                           M_WINDOW_PAINT
+MIL_DEPRECATED(M_DISP_WINDOW_PAINT, 1000)
+#define M_DISP_WINDOW_RANGE                           M_WINDOW_RANGE
+MIL_DEPRECATED(M_DISP_WINDOW_RANGE, 1000)
+#define M_DISP_WINDOW_HANDLE                          M_WINDOW_HANDLE
+MIL_DEPRECATED(M_DISP_WINDOW_HANDLE, 1000)
+#define M_DISP_WINDOW_OFFSET_X                        M_WINDOW_OFFSET_X
+MIL_DEPRECATED(M_DISP_WINDOW_OFFSET_X, 1000)
+#define M_DISP_WINDOW_OFFSET_Y                        M_WINDOW_OFFSET_Y
+MIL_DEPRECATED(M_DISP_WINDOW_OFFSET_Y, 1000)
+#define M_DISP_WINDOW_SIZE_X                          M_WINDOW_SIZE_X
+MIL_DEPRECATED(M_DISP_WINDOW_SIZE_X, 1000)
+#define M_DISP_WINDOW_SIZE_Y                          M_WINDOW_SIZE_Y
+MIL_DEPRECATED(M_DISP_WINDOW_SIZE_Y, 1000)
+#define M_DISP_WINDOW_PAN_X                           M_WINDOW_PAN_X
+MIL_DEPRECATED(M_DISP_WINDOW_PAN_X, 1000)
+#define M_DISP_WINDOW_PAN_Y                           M_WINDOW_PAN_Y
+MIL_DEPRECATED(M_DISP_WINDOW_PAN_Y, 1000)
+#define M_DISP_WINDOW_ZOOM_X                          M_WINDOW_ZOOM_X
+MIL_DEPRECATED(M_DISP_WINDOW_ZOOM_X, 1000)
+#define M_DISP_WINDOW_ZOOM_Y                          M_WINDOW_ZOOM_Y
+MIL_DEPRECATED(M_DISP_WINDOW_ZOOM_Y, 1000)
+#define M_DISP_WINDOW_TITLE_NAME                      M_WINDOW_TITLE_NAME
+MIL_DEPRECATED(M_DISP_WINDOW_TITLE_NAME, 1000)
+#define M_DISP_VISIBLE_OFFSET_X                       M_WINDOW_VISIBLE_OFFSET_X
+MIL_DEPRECATED(M_DISP_VISIBLE_OFFSET_X, 1000)
+#define M_DISP_VISIBLE_OFFSET_Y                       M_WINDOW_VISIBLE_OFFSET_Y
+MIL_DEPRECATED(M_DISP_VISIBLE_OFFSET_Y, 1000)
+#define M_DISP_VISIBLE_SIZE_X                         M_WINDOW_VISIBLE_SIZE_X
+MIL_DEPRECATED(M_DISP_VISIBLE_SIZE_X, 1000)
+#define M_DISP_VISIBLE_SIZE_Y                         M_WINDOW_VISIBLE_SIZE_Y
+MIL_DEPRECATED(M_DISP_VISIBLE_SIZE_Y, 1000)
+#define M_VISIBLE_OFFSET_X                            M_WINDOW_VISIBLE_OFFSET_X
+MIL_DEPRECATED(M_VISIBLE_OFFSET_X, 1000)
+#define M_VISIBLE_OFFSET_Y                            M_WINDOW_VISIBLE_OFFSET_Y
+MIL_DEPRECATED(M_VISIBLE_OFFSET_Y, 1000)
+#define M_VISIBLE_SIZE_X                              M_WINDOW_VISIBLE_SIZE_X
+MIL_DEPRECATED(M_VISIBLE_SIZE_X, 1000)
+#define M_VISIBLE_SIZE_Y                              M_WINDOW_VISIBLE_SIZE_Y
+MIL_DEPRECATED(M_VISIBLE_SIZE_Y, 1000)
+#define M_DISP_WINDOW_ACTIVE                          M_WINDOW_ACTIVE
+MIL_DEPRECATED(M_DISP_WINDOW_ACTIVE, 1000)
+#define M_DISP_WINDOW_ENABLE                          M_WINDOW_ENABLE
+MIL_DEPRECATED(M_DISP_WINDOW_ENABLE, 1000)
+#define M_DISP_PALETTE_HANDLE                         M_PALETTE_HANDLE
+MIL_DEPRECATED(M_DISP_PALETTE_HANDLE, 1000)
+#define M_DISP_WINDOW_THREAD_HANDLE                   M_WINDOW_THREAD_HANDLE
+MIL_DEPRECATED(M_DISP_WINDOW_THREAD_HANDLE, 1000)
+#define M_DISP_WINDOW_THREAD_ID                       M_WINDOW_THREAD_ID
+MIL_DEPRECATED(M_DISP_WINDOW_THREAD_ID, 1000)
+#define M_WINDOW_DIB_HEADER                           M_BITMAPINFO
+MIL_DEPRECATED(M_WINDOW_DIB_HEADER, 1000)
+#define M_WINDOW_UPDATE_WITH_SEND_MESSAGE             M_UPDATE_WITH_PAINT_MESSAGE
+MIL_DEPRECATED(M_WINDOW_UPDATE_WITH_SEND_MESSAGE, 1000)
+#define M_DDRAW_UNDERLAY_ID                           M_UNDERLAY_ID
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_ID, 1000)
+#define M_DDRAW_UNDERLAY_SHOW                         M_UNDERLAY_SHOW
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_SHOW, 1000)
+#define M_MAX_VGA_DEVICE                              M_MAX_VIDEO_DEVICE
+MIL_DEPRECATED(M_MAX_VGA_DEVICE, 1000)
+#define M_WINDOW_KEYBOARD_USE                         M_KEYBOARD_USE
+MIL_DEPRECATED(M_WINDOW_KEYBOARD_USE, 1000)
+#endif //OldDefinesSupport
+
+// Display reserved area for Sys or Dev Inquire/Control
+#define M_SYS_DISPLAY_START                           4501L
+#define M_IS_IN_DISPLAY_SYS_RANGE(X)     (((M_STRIP_INTERMOD_BITS(X) >= M_SYS_DISPLAY_START) && ( M_STRIP_INTERMOD_BITS(X) <= M_SYS_DISPLAY_END)) || \
+                                          ((M_STRIP_INTERMOD_BITS(X) >= M_SYS_DISPLAY_RANGE2_START) && (M_STRIP_INTERMOD_BITS(X) <= M_SYS_DISPLAY_RANGE2_END)))
+
+#define M_MAIN_DDRAW_OBJECT                           M_SYS_DISPLAY_START+0L     //4501
+#define M_DDRAW_AVAILABLE                             M_SYS_DISPLAY_START+2L     //4503
+#define M_PRIMARY_SURFACE_FORMAT                      M_SYS_DISPLAY_START+9L     //4510
+#define M_PRIMARY_SURFACE_SIZE_BITS                   M_SYS_DISPLAY_START+10L    //4511
+#define M_PRIMARY_SURFACE_SIZE_X                      M_SYS_DISPLAY_START+11L    //4512
+#define M_PRIMARY_SURFACE_SIZE_Y                      M_SYS_DISPLAY_START+12L    //4513
+#define M_PRIMARY_SURFACE_PITCH_BYTE                  M_SYS_DISPLAY_START+13L    //4514
+#define M_WINDOWED_DISPLAY_AVAILABLE                  M_SYS_DISPLAY_START+19L    //4520
+#define M_UNDERLAY_LIVE_FORMAT_SUPPORTED              M_SYS_DISPLAY_START+26L    //4527
+#define M_UNDERLAY_FORMAT_SUPPORTED                   M_SYS_DISPLAY_START+28L    //4529
+#define M_UNDERLAY_SUPPORTED                          M_SYS_DISPLAY_START+29L    //4530
+#define M_UNDERLAY_ZOOM_MAX                           M_SYS_DISPLAY_START+30L    //4531
+#define M_UNDERLAY_ZOOM_MIN                           M_SYS_DISPLAY_START+31L    //4532
+
+#define M_UNDERLAY_DOUBLE_RANGE_START                 M_SYS_DISPLAY_START+33L    //4534
+#define M_UNDERLAY_DOUBLE_RANGE_END                   M_SYS_DISPLAY_START+40L    //4541
+
+#define M_VENDOR_ID                                   M_SYS_DISPLAY_START+48L    //4549
+#define M_DEVICE_ID                                   M_SYS_DISPLAY_START+49L    //4550
+#define M_DIRECTX_USED_FOR_AUXILIARY                  M_SYS_DISPLAY_START+50L    //4551
+#define M_SUPPORTED_DISPLAY_TYPE_STRING               ((M_SYS_DISPLAY_START+52L) | M_CLIENT_ENCODING)    //4553
+#define M_NEED_LOCK_UNLOCK                            M_SYS_DISPLAY_START+54L    //4555
+#define M_CAN_ALLOCATE_VIDEO_MEMORY                   M_SYS_DISPLAY_START+56L    //4557
+#define M_SCAN_LINE_ORDERING_MODE                     M_SYS_DISPLAY_START+58L    //4559
+#define M_REFRESH_RATE                                M_SYS_DISPLAY_START+59L    //4560
+#define M_VIDEO_DEVICE_DESCRIPTION_STRING             ((M_SYS_DISPLAY_START+64L) | M_CLIENT_ENCODING)    //4565
+#define M_SUB_SYSTEM_ID                               M_SYS_DISPLAY_START+66L    //4567
+#define M_CAN_ALLOCATE_MONO8_IN_VIDEO_MEMORY          M_SYS_DISPLAY_START+75L    //4576
+#define M_D3D_AVAILABLE                               M_SYS_DISPLAY_START+77L    //4578
+#define M_MAIN_D3D9_OBJECT                            M_SYS_DISPLAY_START+78L    //4579
+#define M_PART_OF_DESKTOP                             M_SYS_DISPLAY_START+79L    //4580
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#endif
+#define M_DISPLAY_TYPE_SUPPORTED                      M_SYS_DISPLAY_START+88L    //4589
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#endif
+#define M_CAN_ALLOCATE_CONTIGUOUS_VIDEO_MEMORY        M_SYS_DISPLAY_START+94L    //4595
+#define M_REVISION                                    M_SYS_DISPLAY_START+95L    //4596
+
+#define M_SYS_BUFFER_HANDLER_START                    M_SYS_DISPLAY_START+96L       // 4597
+#define M_REGISTER_EXTERN_BUFFER_API_MODULE           M_SYS_BUFFER_HANDLER_START+0L // 4598
+#define M_UNREGISTER_EXTERN_BUFFER_API_MODULE         M_SYS_BUFFER_HANDLER_START+1L // 4599
+#define M_SYS_BUFFER_HANDLER_END                      M_SYS_DISPLAY_START+99L       // 4600
+#define M_IS_IN_BUFFER_HANDLER_SYS_RANGE(X)           ((M_STRIP_INTERMOD_BITS(X) >= M_SYS_BUFFER_HANDLER_START) && (M_STRIP_INTERMOD_BITS(X) <= M_SYS_BUFFER_HANDLER_END))
+#define M_SYS_DISPLAY_END                             4600L
+
+#define M_COMPRESSION_TYPE                            5045L //M_REMOTE_DISPLAY_CONTROL // already defined in mil.h
+#define M_GRAB_BUFFERS                                5095L // internal use only
+#define M_GRAB_BUFFERS_NO_LOCK                        5096L // internal use only
+#define M_NUMBER_OF_GRAB_IN_PROGRESS                  5097L
+
+#define M_APP_DIRECTX_RANGE_START                    (M_APP_INQUIRE_SYS_START+300L)
+
+// Value reserved for AppInquire/AppControl to the hardware manager (300 to 374)
+#define M_SYSTEM_ASSOCIATED_TO_DX_OBJECT             (M_APP_DIRECTX_RANGE_START+2L)      // 302
+#define M_DIRECTX_VERSION                            (M_APP_DIRECTX_RANGE_START+3L)      // 303
+#define M_IS_GPU_AVAILABLE                           (M_APP_DIRECTX_RANGE_START+7L)      // 307
+#define M_DUAL_HEAD                                  (M_APP_DIRECTX_RANGE_START+20L)     // 320
+#define M_XORG_ACCELERATION                          (M_APP_DIRECTX_RANGE_START+21L)     // 321
+#define M_NB_OF_VIDEO_DEVICE                         (M_APP_DIRECTX_RANGE_START+22L)     // 322
+#define M_NB_OF_VGA_DEVICE                           M_NB_OF_VIDEO_DEVICE
+#define M_VGA_SYSTEM_FROM_PHYSICAL_ADDRESS           (M_APP_DIRECTX_RANGE_START+23L)     // 323
+#define M_USE_UNDERLAY_IN_ALL_DISPLAY                (M_APP_DIRECTX_RANGE_START+24L)     // 324
+#define M_USE_DDRAW_UNDERLAY                         M_USE_UNDERLAY_IN_ALL_DISPLAY
+#define M_USE_UNDERLAY                               (M_APP_DIRECTX_RANGE_START+25L)     // 325 //This define is used as an AppControl/Inquire *AND* a DispControl/Inquire //M_LOCAL_DISPLAY_CONTROL
+#define M_USE_DDRAW_UNDERLAY_SURFACE                 M_USE_UNDERLAY                      // This control is used in both directX and display dll (but use internally only for display DLL)
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#endif
+#define M_NB_OF_DESKTOP_VGA_DEVICE                   (M_APP_DIRECTX_RANGE_START+29L)     // 329
+#define M_CURRENT_DIRECTX_VERSION                    (M_APP_DIRECTX_RANGE_START+31L)     // 331
+#define M_NB_OF_GRAPHIC_ADAPTER                      (M_APP_DIRECTX_RANGE_START+32L)     // 332
+#define M_GPU_NO_TEARING_AVAILABLE                   (M_APP_DIRECTX_RANGE_START+34L)     // 334
+#define M_NB_OF_PCI_VIDEO_DEVICE                     (M_APP_DIRECTX_RANGE_START+38L)     // 338
+#define M_FIRST_VIDEO_DEVICE_ON_DESKTOP              (M_APP_DIRECTX_RANGE_START+40L)     // 340
+#define M_CONFIG_CHANGE_THREAD_PRIORITY              (M_APP_DIRECTX_RANGE_START+41L)     // 341
+#define M_GPU_BILINEAR_SUPPORTED                     (M_APP_DIRECTX_RANGE_START+42L)     // 342
+#define M_ENUM_PCI_VIDDEV_MEMORY_RANGE               (M_APP_DIRECTX_RANGE_START+43L)     // 343 
+#define M_GENERATE_CAPS_FILE                         (M_APP_DIRECTX_RANGE_START+45L)     // 345
+#define M_CAN_ALLOC_NON_PAGED_IN_VIDEO_MEMORY        (M_APP_DIRECTX_RANGE_START+46L)     // 346
+//#define                                            (M_APP_DIRECTX_RANGE_START+48L)     // 348
+#define M_DESKTOP_FORMAT                             (M_APP_DIRECTX_RANGE_START+49L)     // 349
+#define M_DESKTOP_SIZE_BIT                           (M_APP_DIRECTX_RANGE_START+50L)     // 350
+#define M_IS_ONE_DISPLAY_8_BITS                      (M_APP_DIRECTX_RANGE_START+51L)     // 351
+#define M_IS_ONE_DISPLAY_15_BITS                     (M_APP_DIRECTX_RANGE_START+52L)     // 352
+#define M_IS_ONE_DISPLAY_16_BITS                     (M_APP_DIRECTX_RANGE_START+53L)     // 353
+#define M_IS_ONE_DISPLAY_24_BITS                     (M_APP_DIRECTX_RANGE_START+54L)     // 354
+#define M_IS_ONE_DISPLAY_32_BITS                     (M_APP_DIRECTX_RANGE_START+55L)     // 355
+#define M_APP_DIRECTX_RANGE_END                      (M_APP_DIRECTX_RANGE_START+74L)
+
+// Display reserved area for AppInquire/Control
+/*Reserve values between M_APP_DISPLAY_START and M_APP_DISPLAY_END*/
+#define M_APP_DISPLAY_START                          (M_APP_INQUIRE_SYS_START+375L)
+// General purpose AppInquire/AppControl for MilDisplay (375 to 450)
+#define M_APP_GENERAL_DISPLAY_START                  (M_APP_DISPLAY_START)             // 375
+#define M_CAN_ALLOC_MTX0                             (M_APP_GENERAL_DISPLAY_START+0L)  // 375
+#define M_DISPLAY_NUMBER_ALLOCATED                   (M_APP_GENERAL_DISPLAY_START+3L)  // 378
+#define M_DEFAULT_3BITS_3BANDS_DISP_BUFFER_FORMAT    (M_APP_GENERAL_DISPLAY_START+4L)  // 379
+
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL)) //Within ASCII client apps
+   #define M_TRACE_INFORMATION                        M_TRACE_ASCII_INFORMATION
+#else //Inside MIL and in Backward
+   #define M_TRACE_INFORMATION                       (M_APP_GENERAL_DISPLAY_START+6L)  // 381
+#endif
+
+#define M_SHOW_COUNTER_IN_TITLE                      (M_APP_GENERAL_DISPLAY_START+8L)  // 383
+#define M_KILL_SCHEME                                (M_APP_GENERAL_DISPLAY_START+10L) // 385
+#define M_DISP_BUFFER_NUMBER_ALLOCATED               (M_APP_GENERAL_DISPLAY_START+11L) // 386
+#define M_READY_TO_BE_FREED                          (M_APP_GENERAL_DISPLAY_START+12L) // 387
+#define M_USER_TRACE_TEXT                            (M_APP_GENERAL_DISPLAY_START+15L) // 390
+#define M_USER_TRACE_VALUE                           (M_APP_GENERAL_DISPLAY_START+16L) // 391
+#define M_RESUSCITATE_SCHEME                         (M_APP_GENERAL_DISPLAY_START+17L) // 392
+#define M_NB_EXTERN_BUFFER_API_MODULE                (M_APP_GENERAL_DISPLAY_START+18L) // 393
+#define M_WANT_TO_HANDLE_AUXILIARY_UPDATE            (M_APP_GENERAL_DISPLAY_START+19L) // 394
+#define M_TRACE_ASCII_INFORMATION                    (M_APP_GENERAL_DISPLAY_START+22L) // 397
+#define M_DESKTOP_COMPOSITION                        (M_APP_GENERAL_DISPLAY_START+24L) // 399
+#define M_EXCLUSIVE_ON_LAST_MONITOR                  (M_APP_GENERAL_DISPLAY_START+27L) // 402
+#define M_MILDISPLAY_DLL_IN_DEBUG_MODE               (M_APP_GENERAL_DISPLAY_START+28L) // 403
+
+// End of reserved value for display
+#define M_APP_DISPLAY_END                            (M_APP_INQUIRE_SYS_START+450L)
+
+#define M_IS_IN_DIRECTX_APP_RANGE(X)                 (((M_STRIP_INTERMOD_BITS(X) >= M_APP_DIRECTX_RANGE_START) && (M_STRIP_INTERMOD_BITS(X) <= M_APP_DIRECTX_RANGE_END))   || \
+                                                      M_IS_IN_DIRECTX_APP_DX_HANDLER_RANGE(X) || \
+                                                      M_IS_IN_VGA_DEVICE_SYSTEM_RANGE(X))
+
+#define M_IS_IN_DISPLAY_APP_RANGE(X)                 (((M_STRIP_INTERMOD_BITS(X) >= M_APP_DISPLAY_START) && (M_STRIP_INTERMOD_BITS(X) <= M_APP_DISPLAY_END))         || \
+                                                      M_IS_IN_APP_SCREEN_MANAGER_RANGE(X))
+
+#define M_DISP_INQUIRE_SIZEOF_DOUBLE_START            6600L
+// Inquire value with a size of double, must be in that range : 6600-6699
+//#define                                             (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+0L)  // 6600L //M_LOCAL_DISPLAY_CONTROL
+#define M_SCALE_X                                     (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+1L)  // 6601L //M_LOCAL_DISPLAY_CONTROL
+#define M_SCALE_Y                                     (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+2L)  // 6602L //M_LOCAL_DISPLAY_CONTROL
+#define M_PAN_OFFSET_X                                (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+3L)  // 6603L //M_LOCAL_DISPLAY_CONTROL
+#define M_PAN_OFFSET_Y                                (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+4L)  // 6604L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_FACTOR_X                               (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+5L)  // 6605L //M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_FACTOR_Y                               (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+6L)  // 6606L //M_LOCAL_DISPLAY_CONTROL
+#define M_REAL_ZOOM_FACTOR_X                          (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+7L)  // 6607L //M_LOCAL_DISPLAY_CONTROL
+#define M_REAL_ZOOM_FACTOR_Y                          (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+8L)  // 6608L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_MAXIMUM_ZOOM_FACTOR                  (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+9L)  // 6609L //M_LOCAL_DISPLAY_CONTROL // obsolete
+#define M_WINDOW_MINIMUM_ZOOM_FACTOR                  (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+10L) // 6610L //M_LOCAL_DISPLAY_CONTROL // obsolete
+#define M_WINDOW_ZOOM_FACTOR_X                        (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+11L) // 6611L //M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ZOOM_FACTOR_Y                        (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+12L) // 6612L //M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_RATE                                 (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+13L) // 6613L //M_LOCAL_DISPLAY_CONTROL
+#define M_REAL_OFFSET_X                               (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+14L) // 6614L //M_LOCAL_DISPLAY_CONTROL
+#define M_REAL_OFFSET_Y                               (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+15L) // 6615L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_ZOOM_MAX                        (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+16L) // 6616L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_ZOOM_MIN                        (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+17L) // 6617L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_ZOOM_INCREMENT                  (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+18L) // 6618L //M_LOCAL_DISPLAY_CONTROL
+#define M_INTERACTIVE_ZOOM                            (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+19L) // 6619L //M_LOCAL_DISPLAY_CONTROL
+#define M_DISP_INQUIRE_SIZEOF_DOUBLE_END              (M_DISP_INQUIRE_SIZEOF_DOUBLE_START+99L) // 6699L
+
+
+#define M_DISP_INQUIRE_SIZEOF_INT64_START             6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+#define M_EXTENDED_DISPLAY_SCHEME                     (M_DISP_INQUIRE_SIZEOF_INT64_START+0L) //(6700) M_LOCAL_DISPLAY_CONTROL
+
+#define M_EXTENDED_INIT_FLAG                          6705L //M_LOCAL_DISPLAY_CONTROL
+#define M_DISP_INQUIRE_SIZEOF_INT64_END               6799L
+
+#define M_DISP_INQUIRE_UNKNOWN_SIZEOF_START           6800L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 6800-6899
+#define M_DISP_INQUIRE_UNKNOWN_SIZEOF_END             6899L
+
+
+#define M_DISP_INQUIRE_STRING_START                   7700L
+   #define M_FORMAT                                (7701L|M_CLIENT_ENCODING) //M_LOCAL_DISPLAY_CONTROL  // Already defined in mil.h, considered as a shared control
+   #define M_TITLE                                 (7702L|M_CLIENT_ENCODING) //M_LOCAL_DISPLAY_CONTROL
+
+//      M_FORMAT+M_STRING_SIZE                       (M_STRING_SIZE + M_FORMAT)  //M_LOCAL_DISPLAY_CONTROL
+//      M_TITLE+M_STRING_SIZE                        (M_STRING_SIZE + M_TITLE)  //M_LOCAL_DISPLAY_CONTROL
+
+#if OldDefinesSupport
+   #define M_FORMAT_SIZE                              (M_STRING_SIZE + M_FORMAT) // Already defined in mil.h, considered as a shared control
+   #define M_TITLE_SIZE                               (M_STRING_SIZE + M_TITLE)  
+   #define M_WINDOW_TITLE_NAME_SIZE                   M_TITLE_SIZE
+   #define M_WINDOW_TITLE_NAME                     M_TITLE
+// MIL_DEPRECATED(M_FORMAT_SIZE, 1040)
+// MIL_DEPRECATED(M_TITLE_SIZE, 1040)
+MIL_DEPRECATED(M_WINDOW_TITLE_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_WINDOW_TITLE_NAME, 1040)
+#endif
+
+#define M_DISP_INQUIRE_STRING_END                     7799L
+
+
+
+
+// MdispControl(M_REMAP_TYPE)
+#define M_MULTI_BYTES                                    1L
+#define M_AUTO_SCALE                                     2L
+#define M_BIT_SHIFT                                      3L
+#define M_LOGARITHMIC                                    4L
+#define M_PIXEL_VALUES                                   5L
+#define M_OPAQUE                                         0x01000058L
+#define M_TRANSPARENT                                    0x01000059L
+
+// MdispControl(M_WINDOW_SHOW)
+#define M_FORCE_DISABLE                                  2L
+
+// Mouse cursor types
+//
+// MdispControl(Id, M_SET_USER_CURSOR+[M_CURSOR_XYZ], (MIL_INT)hCursor)
+//
+#define M_CURSOR_NULL                  0L    // To hide the cursor
+#define M_CURSOR_DEFAULT               1L    // Standard arrow
+#define M_OS_CURSOR_ARROW              2L    // Standard arrow
+#define M_OS_CURSOR_IBEAM              3L    // I-beam
+#define M_OS_CURSOR_WAIT               4L    // Hourglass
+#define M_OS_CURSOR_CROSS              5L    // Crosshair
+#define M_OS_CURSOR_UPARROW            6L    // Vertical arrow
+#define M_OS_CURSOR_SIZENWSE           7L    // Double-pointed arrow pointing northwest and southeast
+#define M_OS_CURSOR_SIZENESW           8L    // Double-pointed arrow pointing northeast and southwest
+#define M_OS_CURSOR_SIZEWE             9L    // Double-pointed arrow pointing west and east
+#define M_OS_CURSOR_SIZENS             10L   // Double-pointed arrow pointing north and south
+#define M_OS_CURSOR_SIZEALL            11L   // Four-pointed arrow pointing north, south, east, and west
+#define M_OS_CURSOR_NO                 12L   // Slashed circle
+#define M_OS_CURSOR_HAND               13L   // Pointing Hand
+#define M_OS_CURSOR_APPSTARTING        14L   // Standard arrow and small hourglass
+#define M_OS_CURSOR_HELP               15L   // Arrow and question mark
+#define M_CURSOR_HAND_OPEN             16L   // Open hand
+#define M_CURSOR_HAND_CLOSED           17L   // Closed hand
+#define M_GRA_CURSOR_SIZENWSE          18L   // Double-pointed arrow pointing northwest and southeast 
+#define M_GRA_CURSOR_SIZENESW          19L   // Double-pointed arrow pointing northeast and southwest
+#define M_GRA_CURSOR_SIZEWE            20L   // Double-pointed arrow pointing west and east
+#define M_GRA_CURSOR_SIZENS            21L   // Double-pointed arrow pointing north and south
+#define M_GRA_CURSOR_SIZEALL           22L   // Four-pointed arrow pointing north, south, east, and west
+#define M_GRA_CURSOR_SIZEALL_POINTER   23L   // Arrow and four-pointed arrow pointing north, south, east, and west
+#define M_GRA_CURSOR_NO                24L   // Slashed circle
+#define M_GRA_CURSOR_ROTATE            25L   // Circular arrow
+#define M_GRA_CURSOR_IN_ROTATION       26L   // Quadruple circular arrows
+#define M_GRA_CURSOR_HAND              27L   // Pointing Hand
+#define M_CURSOR_COLOR_PICKER          28L   // Pointing Hand
+// =======================================
+#define M_NUMBER_OF_CURSORS            29L// *** Must be updated when adding new cursor ***
+#define M_MAX_CURSOR                   63L
+#define M_CURSOR_TYPE_MASK             0x0000003F
+
+// 7872 to 7935
+#define M_SET_USER_CURSOR                             7872L //(0x00001EC0) M_LOCAL_DISPLAY_CONTROL
+/*Reserve next values      from                       (M_SET_USER_CURSOR+M_CURSOR_NULL)      //7872L */ //M_LOCAL_DISPLAY_CONTROL
+/*                         to                         (M_SET_USER_CURSOR+M_MAX_CURSOR)       //7935L */ //M_LOCAL_DISPLAY_CONTROL
+
+//Pseudo-ID to apply a control on all displays
+#define M_ALL_DISPLAYS                                (M_PSEUDO_ID+3)
+
+// Value to represent all scheme id. Used with M_RESUSCITATE_SCHEME control
+#define M_ALL_DISPLAY_SCHEMES                         (0x80000000)
+
+//Second range that is reserved for Display Sys or Dev Inquire/Control
+/* Reserve next values     from    M_SYS_DISPLAY_RANGE2_START    8500L 
+                           to      M_SYS_DISPLAY_RANGE2_END      8699L */
+#define M_SYS_DISPLAY_RANGE2_START                    8500L 
+#define M_D3D_SUPPORTED_NO_TEARING_MODE               (M_SYS_DISPLAY_RANGE2_START+1L)    //8501L
+#define M_NO_TEARING_DEVICE                           (M_SYS_DISPLAY_RANGE2_START+5L)    //8505L
+#define M_NO_TEARING_ACTIVE_DEVICE                    (M_SYS_DISPLAY_RANGE2_START+6L)    //8506L
+#define M_VGA_INFO_DISPLAY_RECT                       (M_SYS_DISPLAY_RANGE2_START+7L)    //8507L    // 
+#define M_VGA_INFO_DISPLAY_DEVICE_NAME                (M_SYS_DISPLAY_RANGE2_START+10L)   //8510L    // 
+#define M_CURRENT_MONITOR_RECT                        (M_SYS_DISPLAY_RANGE2_START+12L)   //8512L
+#define M_CURRENT_MONITOR_WORK_RECT                   (M_SYS_DISPLAY_RANGE2_START+13L)   //8513L
+#define M_VIDEO_DEVICE_SYNC                           (M_SYS_DISPLAY_RANGE2_START+14L)   //8514L
+#define M_MAIN_D3D10_OBJECT                           (M_SYS_DISPLAY_RANGE2_START+19L)   //8519L
+#define M_IS_VIRTUAL_DEVICE                           (M_SYS_DISPLAY_RANGE2_START+37L)   //8537L
+#define M_MAIN_D3D11_OBJECT                           (M_SYS_DISPLAY_RANGE2_START+39L)   //8539L
+#define M_D3D_NO_TEARING                              (M_SYS_DISPLAY_RANGE2_START+43L)   //8543L
+#define M_ALLOW_NONPAGED_BUFFERS_IN_VIDEO_MEMORY      (M_SYS_DISPLAY_RANGE2_START+48L)   //8548L
+#define M_IS_VIDEO_DEVICE_ALIVE                       (M_SYS_DISPLAY_RANGE2_START+51L)   //8551L
+#define M_VGA_DEVICE_SYSTEM_START                     (M_SYS_DISPLAY_RANGE2_START+100L)  //8600L
+#define M_VGA_DEVICE_SYSTEM                           (M_VGA_DEVICE_SYSTEM_START+0L)     //8600L
+//8600L to 8663L reserved for M_VGA_DEVICE_SYSTEM
+#define M_VGA_DEVICE_SYSTEM_END                       (M_VGA_DEVICE_SYSTEM_START+M_MAX_VIDEO_DEVICE-1) //8663L
+#define M_SYS_DISPLAY_RANGE2_END                      (M_SYS_DISPLAY_RANGE2_START+199L)  //8699L
+
+// This range is an App inquire range not a DEV range
+#define M_IS_IN_VGA_DEVICE_SYSTEM_RANGE(X)            ((M_STRIP_INTERMOD_BITS(X)>=M_VGA_DEVICE_SYSTEM_START) && \
+                                                       (M_STRIP_INTERMOD_BITS(X)<=M_VGA_DEVICE_SYSTEM_END)     )  // 8600 to 8663
+
+
+#define M_DIB_HANDLE                                  (M_BUF_DISPLAY_START+31L) // 9031
+
+//Reserved values for Screen Manager 9200 - 9399
+#define M_SCREEN_MANAGER_START                        9200L
+//Reserved APP control/inquire values for Screen Manager 9200 - 9249
+#define M_APP_SCREEN_MANAGER_START                    (M_SCREEN_MANAGER_START+0L)      // 9200L
+#define M_PHYS_SHOW_TASKBAR                           (M_APP_SCREEN_MANAGER_START+0L)  // 9200L
+#define M_BEST_DESKTOP_MONITOR                        (M_APP_SCREEN_MANAGER_START+1L)  // 9201L
+#define M_BEST_DESKTOP_RECT                           (M_APP_SCREEN_MANAGER_START+2L)  // 9202L
+#define M_BEST_EXCLUSIVE_MONITOR                      (M_APP_SCREEN_MANAGER_START+3L)  // 9203L
+#define M_MULTI_MONITOR                               (M_APP_SCREEN_MANAGER_START+4L)  // 9204L
+#define M_MONITORS_RECTS_LIST                         (M_APP_SCREEN_MANAGER_START+5L)  // 9205L
+#define M_NEW_EXTERNAL_DISPLAY_ID                     (M_APP_SCREEN_MANAGER_START+6L)  // 9206L
+#define M_DELETE_EXTERNAL_DISPLAY_ID                  (M_APP_SCREEN_MANAGER_START+7L)  // 9207L
+#define M_SCREEN_ID_FROM_SYSTEM_ID                    (M_APP_SCREEN_MANAGER_START+8L)  // 9208L
+#define M_SCREEN_MANAGER_SYSTEM_ID                    (M_APP_SCREEN_MANAGER_START+9L)  // 9209L
+#define M_EXTERNAL_DISPLAY_NUMBER                     (M_APP_SCREEN_MANAGER_START+10L) // 9210L
+#define M_NB_MONITORS_AVAILABLE                       (M_APP_SCREEN_MANAGER_START+13L) // 9213L
+#define M_APP_SCREEN_MANAGER_END                      (M_APP_SCREEN_MANAGER_START+49L) // 9249L
+
+//Reserved DEV control/inquire values for dev Screen Manager 9250 - 9299
+#define M_DEV_SCREEN_MANAGER_START                    (M_APP_SCREEN_MANAGER_END+1L)    // 9250L
+#define M_DESKTOP_RESOLUTION                          (M_DEV_SCREEN_MANAGER_START+0L)  // 9250L
+#define M_TEST_DESKTOP_RESOLUTION                     (M_DEV_SCREEN_MANAGER_START+1L)  // 9251L
+#define M_DESKTOP_DEVICE_NAME                         (M_DEV_SCREEN_MANAGER_START+2L)  // 9252L
+//#define M_DESKTOP_DEVICE_NAME_SIZE                    (M_STRING_SIZE + M_DESKTOP_DEVICE_NAME)
+#define M_EXCLUSIVE_MONITOR_RANK                      (M_DEV_SCREEN_MANAGER_START+4L)  // 9254L
+#define M_IS_EXCLUSIVE_MONITOR_AVAILABLE              (M_DEV_SCREEN_MANAGER_START+5L)  // 9255L
+#define M_EXTERN_DISPLAY_AVAILABLE                    (M_DEV_SCREEN_MANAGER_START+6L)  // 9256L
+#define M_EXTERN_DISPLAY_SUPPORTED_FORMAT             (M_DEV_SCREEN_MANAGER_START+9L)  // 9259L
+#define M_EXTERN_UNDERLAY_AVAILABLE                   (M_DEV_SCREEN_MANAGER_START+10L) // 9260L
+#define M_IS_EXTERNAL_DISPLAY                         (M_DEV_SCREEN_MANAGER_START+14L) // 9264L
+#define M_CURRENT_SCREEN_RECT                         (M_DEV_SCREEN_MANAGER_START+15L) // 9265L (M_CURRENT_MONITOR_RECT)
+#define M_CURRENT_SCREEN_WORK_RECT                    (M_DEV_SCREEN_MANAGER_START+16L) // 9266L (M_CURRENT_MONITOR_WORK_RECT)
+#define M_IS_SCREEN_FORBIDDEN                         (M_DEV_SCREEN_MANAGER_START+18L) // 9268L
+#define M_IS_SCREEN_RECT_USABLE                       (M_DEV_SCREEN_MANAGER_START+19L) // 9269L
+#define M_DEV_SCREEN_MANAGER_END                      (M_DEV_SCREEN_MANAGER_START+49L) // 9299L
+//Reserved but unused values for Screen Manager 9300 - 9374
+#define M_SCREEN_MANAGER_END                          9374L
+
+#define M_IS_IN_SCREEN_MANAGER_RANGE(X)               (((M_STRIP_INTERMOD_BITS(X)>=M_SCREEN_MANAGER_START) && (M_STRIP_INTERMOD_BITS(X)<=M_SCREEN_MANAGER_END)))                     // 9200 - 9399
+#define M_IS_IN_APP_SCREEN_MANAGER_RANGE(X)           (((M_STRIP_INTERMOD_BITS(X)>=M_APP_SCREEN_MANAGER_START) && (M_STRIP_INTERMOD_BITS(X)<=M_APP_SCREEN_MANAGER_END)))             // 9200 - 9249
+#define M_IS_IN_DEV_SCREEN_MANAGER_RANGE(X)           (((M_STRIP_INTERMOD_BITS(X)>=M_DEV_SCREEN_MANAGER_START) && (M_STRIP_INTERMOD_BITS(X)<=M_DEV_SCREEN_MANAGER_END)))             // 9250 - 9299
+
+//Reserved APP control/inquire values for Directx and Display 9400 - 9499
+#define M_DUAL_DISP_DX_APP_RANGE_START                9400L
+#define M_RESET_CRTC                                  (M_DUAL_DISP_DX_APP_RANGE_START+0L)  // 9400L
+#define M_NEW_VIDEO_DEVICE_ADDED                      (M_DUAL_DISP_DX_APP_RANGE_START+6L)  // 9406L
+#define M_VIDEO_DEVICE_REMOVED                        (M_DUAL_DISP_DX_APP_RANGE_START+7L)  // 9407L
+#define M_DUAL_DISP_DX_APP_RANGE_END                  (M_DUAL_DISP_DX_APP_RANGE_START+99L) // 9499L
+#define M_IS_IN_DUAL_DISP_DX_APP_RANGE(X)             (((M_STRIP_INTERMOD_BITS(X) >= M_DUAL_DISP_DX_APP_RANGE_START) && (M_STRIP_INTERMOD_BITS(X) <= M_DUAL_DISP_DX_APP_RANGE_END)))     // 9400 - 9499
+
+#define M_DIRECTX_APP_DX_HANDLER_START                9500L
+#define M_DIRECTX_CAN_CREATE_OVER_HOST_MEMORY         (M_DIRECTX_APP_DX_HANDLER_START+0L)  // 9500L
+#define M_MTX0_SERVICE                                (M_DIRECTX_APP_DX_HANDLER_START+1L)  // 9501L
+#define M_DIRECTX_VIDEO_BUFFER_MAPPABLE               (M_DIRECTX_APP_DX_HANDLER_START+2L)  // 9502L
+#define M_KEEP_POLLING_ON_MODE_CHANGED                (M_DIRECTX_APP_DX_HANDLER_START+3L)  // 9503L
+#define M_DIRECTX_APP_DX_HANDLER_END                  (M_DIRECTX_APP_DX_HANDLER_START+49L) // 9549L
+#define M_IS_IN_DIRECTX_APP_DX_HANDLER_RANGE(X)       ((M_STRIP_INTERMOD_BITS(X) >= M_DIRECTX_APP_DX_HANDLER_START) && (M_STRIP_INTERMOD_BITS(X) <= M_DIRECTX_APP_DX_HANDLER_END))       // 9500 - 9549
+
+//Reserved values for DispControl
+#define M_DISP_CONTROL_START                          10000L
+#define M_NO_TEARING_SKIP_MODE                        (M_DISP_CONTROL_START+1L) //(10001) M_LOCAL_DISPLAY_CONTROL
+#define M_NO_SKIP                                     (M_DISP_CONTROL_START+2L) //(10002) M_LOCAL_DISPLAY_CONTROL
+#define M_SKIP_OLDEST                                 (M_DISP_CONTROL_START+3L) //(10003) M_LOCAL_DISPLAY_CONTROL
+#define M_SKIP_NEWEST                                 (M_DISP_CONTROL_START+4L) //(10004) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SCHEME                              (M_DISP_CONTROL_START+5L) //(10005) M_LOCAL_DISPLAY_CONTROL
+#define M_OVERLAY_CLEAR                               (M_DISP_CONTROL_START+6L) //(10006) M_REMOTE_DISPLAY_CONTROL
+#define M_FORCE_MONO_OVR                              (M_DISP_CONTROL_START+7L) //(10007) M_REMOTE_DISPLAY_CONTROL
+#define M_D3D_VSYNC_INTERVAL_ONE                      (M_DISP_CONTROL_START+8L) //(10008) M_LOCAL_DISPLAY_CONTROL
+#define M_D3D_VSYNC_INTERVAL_TWO                      (M_DISP_CONTROL_START+9L) //(10009) M_LOCAL_DISPLAY_CONTROL
+#define M_D3D_VSYNC_INTERVAL_THREE                    (M_DISP_CONTROL_START+10L) //(10010) M_LOCAL_DISPLAY_CONTROL
+#define M_D3D_VSYNC_INTERVAL_FOUR                     (M_DISP_CONTROL_START+11L) //(10011) M_LOCAL_DISPLAY_CONTROL
+#define M_DIRECTX_VIDEO_DEVICE_ID                     (M_DISP_CONTROL_START+12L) //(10012) M_LOCAL_DISPLAY_CONTROL
+#define M_VGA_INDEX                                   M_DIRECTX_VIDEO_DEVICE_ID
+#define M_GDI_COMPATIBLE_OVERLAY                      (M_DISP_CONTROL_START+13L) //(10013) M_REMOTE_DISPLAY_CONTROL
+#define M_HSCROLL_VISIBLE                             (M_DISP_CONTROL_START+14L) //(10014) M_LOCAL_DISPLAY_CONTROL
+#define M_VSCROLL_VISIBLE                             (M_DISP_CONTROL_START+15L) //(10015) M_LOCAL_DISPLAY_CONTROL
+#define M_SRC_UPDATE_REGION_OFFSET_X                  (M_DISP_CONTROL_START+16L) //(10016) M_LOCAL_DISPLAY_CONTROL
+#define M_SRC_UPDATE_REGION_OFFSET_Y                  (M_DISP_CONTROL_START+17L) //(10017) M_LOCAL_DISPLAY_CONTROL
+#define M_NEAREST_COLOR                               (M_DISP_CONTROL_START+18L) //(10018) M_LOCAL_DISPLAY_CONTROL
+#define M_CENTER_DISPLAY                              (M_DISP_CONTROL_START+19L) //(10019) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_RESERVED_COLOR                          (M_DISP_CONTROL_START+20L) //(10020) M_LOCAL_DISPLAY_CONTROL
+#define M_LOWER_RESERVED_COLOR_START                  (M_DISP_CONTROL_START+21L) //(10021) M_LOCAL_DISPLAY_CONTROL
+#define M_LOWER_RESERVED_COLOR_END                    (M_DISP_CONTROL_START+22L) //(10022) M_LOCAL_DISPLAY_CONTROL
+#define M_HIGHER_RESERVED_COLOR_START                 (M_DISP_CONTROL_START+23L) //(10023) M_LOCAL_DISPLAY_CONTROL
+#define M_HIGHER_RESERVED_COLOR_END                   (M_DISP_CONTROL_START+24L) //(10024) M_LOCAL_DISPLAY_CONTROL
+#define M_PREFERED_DISPLAY_FORMAT                     (M_DISP_CONTROL_START+25L) //(10025) M_LOCAL_DISPLAY_CONTROL
+#define M_SAVE_INTERNAL_BUFFERS                       (M_DISP_CONTROL_START+26L) //(10026) M_LOCAL_DISPLAY_CONTROL
+#define M_HARDWARE_LUT_AVAILABLE                      (M_DISP_CONTROL_START+27L) //(10027) M_LOCAL_DISPLAY_CONTROL
+#define M_IS_IN_MEGA_BUFFER_MODE                      (M_DISP_CONTROL_START+28L) //(10028) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_THREAD_PRIORITY                      (M_DISP_CONTROL_START+29L) //(10029) M_LOCAL_DISPLAY_CONTROL
+#define M_VISIBLE_BUFFER_RECT_SIZE_X                  (M_DISP_CONTROL_START+30L) //(10030) M_LOCAL_DISPLAY_CONTROL
+#define M_VISIBLE_BUFFER_RECT_SIZE_Y                  (M_DISP_CONTROL_START+31L) //(10031) M_LOCAL_DISPLAY_CONTROL
+#define M_NO_TEARING_ACTIVE                           (M_DISP_CONTROL_START+32L) //(10032) M_LOCAL_DISPLAY_CONTROL
+#define M_FORCE_DISPLAY_RESOLUTION                    (M_DISP_CONTROL_START+33L) //(10033) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_INTERNAL_BUFFER_FOR_GRAB_CONTINUOUS     (M_DISP_CONTROL_START+34L) //(10034) M_REMOTE_DISPLAY_CONTROL
+#define M_NO_TEARING_MODE                             (M_DISP_CONTROL_START+35L) //(10035) M_REMOTE_DISPLAY_CONTROL
+#define M_UNDERLAY_UPDATE_STATE                       (M_DISP_CONTROL_START+36L) //(10036) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_PRIMARY_SURFACE                         (M_DISP_CONTROL_START+37L) //(10037) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_RATE_DIVIDER                         (M_DISP_CONTROL_START+38L) //(10038) M_REMOTE_DISPLAY_CONTROL
+#define M_STOP_UPDATE                                 (M_DISP_CONTROL_START+39L) //(10039) M_REMOTE_DISPLAY_CONTROL
+#define M_CAN_DO_HARDWARE_COMPOSITION                 (M_DISP_CONTROL_START+40L) //(10040) M_REMOTE_DISPLAY_CONTROL
+#define M_MIN_MAX_OF_SELECTED_BUFFER_CHANGED          (M_DISP_CONTROL_START+41L) //(10041) M_REMOTE_DISPLAY_CONTROL
+#define M_UPDATE_MEGA_BUFFER_CHILD_POSITION           (M_DISP_CONTROL_START+42L) //(10042) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_DX_VERSION_ON_TITLEBAR               (M_DISP_CONTROL_START+43L) //(10043) M_LOCAL_DISPLAY_CONTROL
+#define M_DEBUG_COLOR                                 (M_DISP_CONTROL_START+44L) //(10044) M_LOCAL_DISPLAY_CONTROL
+#define M_LOSING_VIDEO_MEMORY                         (M_DISP_CONTROL_START+45L) //(10045) M_LOCAL_DISPLAY_CONTROL
+#define M_VIDEO_MEMORY_RESTORED                       (M_DISP_CONTROL_START+46L) //(10046) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SYNC                                (M_DISP_CONTROL_START+47L) //(10047) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_USAGE                               (M_DISP_CONTROL_START+48L) //(10048) M_REMOTE_DISPLAY_CONTROL
+#define M_GENERATE_PENDING_HOOKS                      (M_DISP_CONTROL_START+49L) //(10049) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_GRAB_TYPE                            (M_DISP_CONTROL_START+50L) //(10050) M_REMOTE_DISPLAY_CONTROL
+#define M_GRAB_TYPE_ON_TITLE_BAR                      (M_DISP_CONTROL_START+51L) //(10051) M_LOCAL_DISPLAY_CONTROL
+#define M_VIDEO_DEVICE_WAS_MODIFIED                   (M_DISP_CONTROL_START+52L) //(10052) M_LOCAL_DISPLAY_CONTROL
+#define M_PAR_ENCODER_WAIT_FIELD                      (M_DISP_CONTROL_START+53L) //(10053) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_YCBCR_RANGE                             (M_DISP_CONTROL_START+54L) //(10054) M_REMOTE_DISPLAY_CONTROL
+#define M_RESTRICT_CURSOR                             (M_DISP_CONTROL_START+55L) //(10055) M_LOCAL_DISPLAY_CONTROL
+#define M_RESTRICT_FOCUS                              (M_DISP_CONTROL_START+56L) //(10056) M_LOCAL_DISPLAY_CONTROL
+#define M_SHOW_TASKBAR                                (M_DISP_CONTROL_START+57L) //(10057) M_LOCAL_DISPLAY_CONTROL
+#define M_EXCLUSIVE_MODE                              (M_DISP_CONTROL_START+58L) //(10058) M_LOCAL_DISPLAY_CONTROL
+#define M_PRE_DISPSELECT_OPERATIONS                   (M_DISP_CONTROL_START+59L) //(10059) M_LOCAL_DISPLAY_CONTROL
+#define M_POST_DISPSELECT_OPERATIONS                  (M_DISP_CONTROL_START+60L) //(10060) M_LOCAL_DISPLAY_CONTROL
+#define M_PRE_DISPDESELECT_OPERATIONS                 (M_DISP_CONTROL_START+61L) //(10061) M_LOCAL_DISPLAY_CONTROL
+#define M_POST_DISPDESELECT_OPERATIONS                (M_DISP_CONTROL_START+62L) //(10062) M_LOCAL_DISPLAY_CONTROL
+#define M_PROPAGATE_CALIBRATION_TO_OVERLAY            (M_DISP_CONTROL_START+63L) //(10063) M_REMOTE_DISPLAY_CONTROL
+#define M_SAVE_BASIC_SELECTED_BUFFER                  (M_DISP_CONTROL_START+64L) //(10064) M_LOCAL_DISPLAY_CONTROL
+#define M_ACQUIRE_WINDOW_FOCUS                        (M_DISP_CONTROL_START+65L) //(10065) M_LOCAL_DISPLAY_CONTROL
+#define M_BACKGROUND_COLOR                            (M_DISP_CONTROL_START+66L) //(10066) M_LOCAL_DISPLAY_CONTROL
+#define M_BASIC_DISPLAY_SYSTEM_ID                     (M_DISP_CONTROL_START+67L) //(10067) M_LOCAL_DISPLAY_CONTROL
+#define M_VGA_DEVICE_SYSTEM_ID                        (M_DISP_CONTROL_START+100L) //(10100) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_RESOLUTION                          (M_DISP_CONTROL_START+107L) //(10107) M_LOCAL_DISPLAY_CONTROL
+#define M_DEFAULT_DISPLAY_RESOLUTION                  (M_DISP_CONTROL_START+108L) //(10108) M_LOCAL_DISPLAY_CONTROL
+#define M_SAFE_MODE                                   (M_DISP_CONTROL_START+109L) //(10109) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_VIDEO_MEMORY_BUFFER                     (M_DISP_CONTROL_START+110L) //(10110) M_LOCAL_DISPLAY_CONTROL
+#define M_SELECT_USER_BUFFER_DIRECTLY_ON_DISPLAY      (M_DISP_CONTROL_START+111L) //(10111) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_FORMAT                              (M_DISP_CONTROL_START+112L) //(10112) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_FORMAT_SUPPORTED                    (M_DISP_CONTROL_START+113L) //(10113) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_TYPE                                (M_DISP_CONTROL_START+114L) //(10114) M_LOCAL_DISPLAY_CONTROL
+#define M_EXTENDED_DISPLAY_TYPE                       (M_DISP_CONTROL_START+115L) //(10115) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_UNDERLAY_IN_DUALHEAD                    (M_DISP_CONTROL_START+116L) //(10116) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_SCHEME_ON_TITLEBAR                  (M_DISP_CONTROL_START+117L) //(10117) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_SYNCHRONIZATION                      (M_DISP_CONTROL_START+118L) //(10118) M_LOCAL_DISPLAY_CONTROL
+#define M_UNDERLAY_ALWAYS_ON_TOP                      (M_DISP_CONTROL_START+119L) //(10119) M_LOCAL_DISPLAY_CONTROL
+#define M_ALLOW_GRA_MESSAGE_WITH_NO_UPDATE            (M_DISP_CONTROL_START+120L) //(10120) M_LOCAL_DISPLAY_CONTROL
+#define M_USER_WINDOW_HANDLE                          (M_DISP_CONTROL_START+121L) //(10121) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_HOST_OVERLAY                            (M_DISP_CONTROL_START+122L) //(10122) M_REMOTE_DISPLAY_CONTROL
+#define M_SELECTED_LINK_COPY                          (M_DISP_CONTROL_START+123L) //(10123) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_ERROR                               (M_DISP_CONTROL_START+124L) //(10124) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_LIVE_UNDERLAY                           (M_DISP_CONTROL_START+125L) //(10125) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_WITH_PAINT_MESSAGE                   (M_DISP_CONTROL_START+126L) //(10126) M_LOCAL_DISPLAY_CONTROL
+
+#define M_DISPLAY_SCHEME_COUNT                        (M_DISP_CONTROL_START+131L) //(10131) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_DOUBLE_BUFFERING_SCHEME                 (M_DISP_CONTROL_START+132L) //(10132) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_STATE                                (M_DISP_CONTROL_START+133L) //(10133) M_LOCAL_DISPLAY_CONTROL
+#define M_FORCE_DISPLAY_SCHEME_CHANGE                 (M_DISP_CONTROL_START+134L) //(10134) M_LOCAL_DISPLAY_CONTROL
+#define M_UNDERLAY_SHOW                               (M_DISP_CONTROL_START+137L) //(10137) M_LOCAL_DISPLAY_CONTROL
+#define M_MINIMUM_DISPLAY_SIZE_X                      (M_DISP_CONTROL_START+138L) //(10138) M_LOCAL_DISPLAY_CONTROL
+#define M_MINIMUM_DISPLAY_SIZE_Y                      (M_DISP_CONTROL_START+139L) //(10139) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_SHOW                                 (M_DISP_CONTROL_START+140L) //(10140) M_LOCAL_DISPLAY_CONTROL
+#define M_BUFFER_FORMAT_TO_SELECT_DIRECTLY            (M_DISP_CONTROL_START+141L) //(10141) M_LOCAL_DISPLAY_CONTROL
+
+#define M_USE_USER_BUFFER_FOR_UNDERLAY                (M_DISP_CONTROL_START+144L) //(10144) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_CREATE_OVER_USER_BUFFER                 (M_DISP_CONTROL_START+145L) //(10145) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_FLICKER_FREE_BUFFER                     (M_DISP_CONTROL_START+146L) //(10146) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_CONVERT_TO_COLOR_DIB                    (M_DISP_CONTROL_START+147L) //(10147) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_SOFTWARE_COMPOSITION                    (M_DISP_CONTROL_START+148L) //(10148) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_HOST_ENTRY_BUFFER                       (M_DISP_CONTROL_START+149L) //(10149) M_REMOTE_DISPLAY_CONTROL
+#define M_DISPLAY_SCHEME_BASE                         (M_DISP_CONTROL_START+150L) //(10150) M_REMOTE_DISPLAY_CONTROL
+
+#define M_QT_MODE                                     (M_DISP_CONTROL_START+151L) //(10151) M_LOCAL_DISPLAY_CONTROL
+#define M_GTK_MODE                                    (M_DISP_CONTROL_START+152L) //(10152) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_DISPLAY_SIZE_BUFFER                     (M_DISP_CONTROL_START+153L) //(10153) M_LOCAL_DISPLAY_CONTROL
+
+#define M_USE_MEGA_BUFFER                             (M_DISP_CONTROL_START+154L) //(10154) M_REMOTE_DISPLAY_CONTROL
+#define M_UPDATE_TRANSFER_TYPE                        (M_DISP_CONTROL_START+155L) //(10155) M_REMOTE_DISPLAY_CONTROL
+
+#define M_DEFAULT_MEGA_DISPLAY_SIZE_X                 (M_DISP_CONTROL_START+158L) //(10158) M_LOCAL_DISPLAY_CONTROL
+#define M_DEFAULT_MEGA_DISPLAY_SIZE_Y                 (M_DISP_CONTROL_START+159L) //(10159) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_INITIAL_SIZE_X                       (M_DISP_CONTROL_START+160L) //(10160) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_INITIAL_SIZE_Y                       (M_DISP_CONTROL_START+161L) //(10161) M_LOCAL_DISPLAY_CONTROL
+#define M_PREFER_COLOR_DISPLAY_RESOLUTION             (M_DISP_CONTROL_START+162L) //(10162) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_ON_OVERLAY_MODIFIED_INTERNAL         (M_DISP_CONTROL_START+164L) //(10164) M_REMOTE_DISPLAY_CONTROL
+#define M_USE_GIGACOLOR_SCHEME                        (M_DISP_CONTROL_START+165L) //(10165) M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOMED_DESTINATION_OUT_DESKTOP              (M_DISP_CONTROL_START+168L) //(10168) M_LOCAL_DISPLAY_CONTROL
+#define M_VALIDATE_DISPLAY                            (M_DISP_CONTROL_START+169L) //(10169) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOKS                                       (M_DISP_CONTROL_START+170L) //(10170) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_OUT_OF_MONITOR                      (M_DISP_CONTROL_START+171L) //(10171) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_ZOOM_CHANGE                         (M_DISP_CONTROL_START+172L) //(10172) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_MB_CHILD_RESIZE                     (M_DISP_CONTROL_START+173L) //(10173) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLACE_WINDOWS                            (M_DISP_CONTROL_START+174L) //(10174) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_TITLE                                (M_DISP_CONTROL_START+175L) //(10175) M_LOCAL_DISPLAY_CONTROL
+#define M_RESET_WINDOW_SIZE                           (M_DISP_CONTROL_START+176L) //(10176) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURRENTLY_MAXIMIZED                  (M_DISP_CONTROL_START+177L) //(10177) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURRENTLY_MINIMIZED                  (M_DISP_CONTROL_START+178L) //(10178) M_LOCAL_DISPLAY_CONTROL
+#define M_MEGA_BUFFER_LOW_LIMIT                       (M_DISP_CONTROL_START+179L) //(10179) M_LOCAL_DISPLAY_CONTROL
+#define M_MAXIMUM_VISIBLE_DEST_SIZE_X                 (M_DISP_CONTROL_START+180L) //(10180) M_LOCAL_DISPLAY_CONTROL
+#define M_MAXIMUM_VISIBLE_DEST_SIZE_Y                 (M_DISP_CONTROL_START+181L) //(10181) M_LOCAL_DISPLAY_CONTROL
+#define M_DO_SELECT                                   (M_DISP_CONTROL_START+182L) //(10182) M_LOCAL_DISPLAY_CONTROL
+#define M_RESTRICT_WINDOWS                            (M_DISP_CONTROL_START+183L) //(10183) M_LOCAL_DISPLAY_CONTROL
+#define M_NUMBER_OF_BASIC_IMPLEMENTATIONS             (M_DISP_CONTROL_START+185L) //(10185) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURRENTLY_VISIBLE                    (M_DISP_CONTROL_START+187L) //(10187) M_LOCAL_DISPLAY_CONTROL
+#define M_VIRTUAL_GRAB                                (M_DISP_CONTROL_START+188L) //(10188) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_RESIZE_ON_ZOOM                       (M_DISP_CONTROL_START+189L) //(10189) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_NO_VIDEO_OVERLAY_BUFFER                 (M_DISP_CONTROL_START+191L) //(10191) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_YUV16_UYVY_SCHEME                       (M_DISP_CONTROL_START+192L) //(10192_
+#define M_FILL_COLOR                                  (M_DISP_CONTROL_START+193L) //(10193) M_LOCAL_DISPLAY_CONTROL
+#define M_CURRENTLY_CENTERED_X                        (M_DISP_CONTROL_START+194L) //(10194) M_LOCAL_DISPLAY_CONTROL
+#define M_XDISPLAY                                    (M_DISP_CONTROL_START+195L) //(10195)
+#define M_WINDOW_TASKBAR                              (M_DISP_CONTROL_START+196L) //(10196) M_LOCAL_DISPLAY_CONTROL
+#define M_SHOW_WINDOW_IN_TASKBAR                      M_WINDOW_TASKBAR
+#define M_WINDOW_TASKBAR_ON_FULLSCREEN                (M_DISP_CONTROL_START+197L) //(10197) M_LOCAL_DISPLAY_CONTROL
+#define M_CURRENTLY_CENTERED_Y                        (M_DISP_CONTROL_START+198L) //(10198) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_CURSOR                               (M_DISP_CONTROL_START+199L) //(10199) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ROI_BUTTONS                          (M_DISP_CONTROL_START+200L) //(10200) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_AUTO_RESET                              (M_DISP_CONTROL_START+201L) //(10201) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_TO_CLIPBOARD                           (M_DISP_CONTROL_START+202L) //(10202) M_LOCAL_DISPLAY_CONTROL
+#define M_SAVE_TO_FILE                                ((M_DISP_CONTROL_START+203L)|M_CLIENT_ENCODING)  // M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_DISPLAY_TO_ID                          (M_DISP_CONTROL_START+204L) //(10204) M_LOCAL_DISPLAY_CONTROL
+#define M_SAVE_TO_BUFFER                              M_COPY_DISPLAY_TO_ID
+#define M_COPY_TO_BUFFER                              M_COPY_DISPLAY_TO_ID
+#define M_UPDATE_RATE_MAX                             (M_DISP_CONTROL_START+205L) //(10205) M_REMOTE_DISPLAY_CONTROL
+#define M_ASYNC_UPDATE                                (M_DISP_CONTROL_START+206L) //(10206) M_REMOTE_DISPLAY_CONTROL
+#define M_MEGA_BUFFER_LOW_LIMIT_X                     (M_DISP_CONTROL_START+207L) //(10207) M_LOCAL_DISPLAY_CONTROL
+#define M_COMMON_DIRECTX_VIDEO_DEVICE_ID              (M_DISP_CONTROL_START+208L) //(10208) M_LOCAL_DISPLAY_CONTROL
+#define M_COMMON_VGA_INDEX                            M_COMMON_DIRECTX_VIDEO_DEVICE_ID
+#define M_FAST_SELECT                                 (M_DISP_CONTROL_START+209L) //(10209) M_REMOTE_DISPLAY_CONTROL
+#define M_FAST_UNDERLAY_MODE                          (M_DISP_CONTROL_START+210L) //(10210) M_LOCAL_DISPLAY_CONTROL
+#define M_CUSTOM_SCHEME_CHANGING                      (M_DISP_CONTROL_START+211L) //(10211) M_REMOTE_DISPLAY_CONTROL
+#define M_DISPLAY_FRAME_RATE_ON_TITLEBAR              (M_DISP_CONTROL_START+212L) //(10212) M_LOCAL_DISPLAY_CONTROL
+#define M_SCREEN_RECT                                 (M_DISP_CONTROL_START+213L) //(10213) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_ZOOM_FACTOR_ON_TITLEBAR             (M_DISP_CONTROL_START+214L) //(10214) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_BUFFER_LAYER_TO_CLIPBOARD              (M_DISP_CONTROL_START+215L) //(10215) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_BUFFER_LAYER_TO_ID                     (M_DISP_CONTROL_START+216L) //(10216) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_ANNOTATIONS_LAYER_TO_CLIPBOARD         (M_DISP_CONTROL_START+217L) //(10217) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_ANNOTATIONS_LAYER_TO_ID                (M_DISP_CONTROL_START+218L) //(10218) M_LOCAL_DISPLAY_CONTROL
+#define M_COPY_TO_BUFFER_WITH_SCALE                   (M_DISP_CONTROL_START+219L) //(10219) M_LOCAL_DISPLAY_CONTROL
+
+#define M_ROI_DISPCONTROL_START                       (M_DISP_CONTROL_START+500L) // 10500
+#define M_ROI_DEFINE                                  (M_DISP_CONTROL_START+500L) //(10500) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_SHOW                                    (M_DISP_CONTROL_START+501L) //(10501) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_SUPPORT                                 (M_DISP_CONTROL_START+502L) //(10502) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_LINE_COLOR                              (M_DISP_CONTROL_START+503L) //(10503) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_RESET                                   (M_DISP_CONTROL_START+504L) //(10504) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_RECT_DISPLAY                            (M_DISP_CONTROL_START+505L) //(10505) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_RECT_BUFFER                             (M_DISP_CONTROL_START+506L) //(10506) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_SET_POINT                               (M_DISP_CONTROL_START+507L) //(10507) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_LINE_WIDTH                              (M_DISP_CONTROL_START+508L) //(10508) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_HANDLE_COLOR                            (M_DISP_CONTROL_START+509L) //(10509) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_HANDLE_SIZE                             (M_DISP_CONTROL_START+510L) //(10510) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPLAY_OFFSET_X                        (M_DISP_CONTROL_START+511L) //(10511) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPLAY_OFFSET_Y                        (M_DISP_CONTROL_START+512L) //(10512) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPLAY_SIZE_X                          (M_DISP_CONTROL_START+513L) //(10513) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPLAY_SIZE_Y                          (M_DISP_CONTROL_START+514L) //(10514) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_BUFFER_OFFSET_X                         (M_DISP_CONTROL_START+515L) //(10515) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_BUFFER_OFFSET_Y                         (M_DISP_CONTROL_START+516L) //(10516) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_BUFFER_SIZE_X                           (M_DISP_CONTROL_START+517L) //(10517) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_BUFFER_SIZE_Y                           (M_DISP_CONTROL_START+518L) //(10518) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_SHAPE                                   (M_DISP_CONTROL_START+519L) //(10519) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_MINIMUM_SIZE                            (M_DISP_CONTROL_START+520L) //(10521) M_LOCAL_DISPLAY_CONTROL
+#define M_ROI_DISPCONTROL_END                         (M_DISP_CONTROL_START+550L) // 10550
+#define M_IS_IN_ROI_DISPLAY_RANGE(X)                  ((M_ORIGINAL_DISPLAY_CONTROL(M_STRIP_INTERMOD_BITS(X))>=M_ROI_DISPCONTROL_START) && (M_ORIGINAL_DISPLAY_CONTROL(M_STRIP_INTERMOD_BITS(X))<=M_ROI_DISPCONTROL_END))
+#define M_CONTEXTUAL_MENU                             (M_DISP_CONTROL_START+551L) //(10551) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_IS_INTERNALLY_ALLOCATED             (M_DISP_CONTROL_START+553L) //(10553) M_LOCAL_DISPLAY_CONTROL
+#define M_HOOK_ON_DEVICE_LOSING                       (M_DISP_CONTROL_START+554L) //(10554) 
+#define M_WINDOW_ANNOTATIONS                          (M_DISP_CONTROL_START+556L) //(10556) M_LOCAL_DISPLAY_CONTROL  
+#define M_SCALE_DISPLAY                               (M_DISP_CONTROL_START+557L) //(10557) M_LOCAL_DISPLAY_CONTROL
+#define M_WINDOW_ANNOTATIONS_STATE                    (M_DISP_CONTROL_START+558L) //(10558) M_LOCAL_DISPLAY_CONTROL
+#define M_NO_TEARING_ALLOWED                          (M_DISP_CONTROL_START+559L) //(10559) M_LOCAL_DISPLAY_CONTROL
+#define M_ZOOM_ACCURACY                               (M_DISP_CONTROL_START+560L) //(10560) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_EXTERNAL_NO_TEARING                     (M_DISP_CONTROL_START+561L) //(10561) M_LOCAL_DISPLAY_CONTROL
+#define M_ASSOCIATED_GRAPHIC_LIST_ID                  (M_DISP_CONTROL_START+562L) //(10562) M_LOCAL_DISPLAY_CONTROL
+#define M_DISPLAY_GRAPHIC_LIST                        M_ASSOCIATED_GRAPHIC_LIST_ID
+#define M_ZOOM_PAN_HANDLED_BY_SCHEME                  (M_DISP_CONTROL_START+563L) //(10563) M_LOCAL_DISPLAY_CONTROL
+#define M_UPDATE_GRAPHIC_LIST                         (M_DISP_CONTROL_START+564L) //(10564) M_LOCAL_DISPLAY_CONTROL
+#define M_MEGA_BUFFER_SIZE_X_TO_USE                   (M_DISP_CONTROL_START+565L) //(10565) M_LOCAL_DISPLAY_CONTROL
+#define M_MEGA_BUFFER_SIZE_Y_TO_USE                   (M_DISP_CONTROL_START+566L) //(10566) M_LOCAL_DISPLAY_CONTROL
+#define M_GRAPHIC_LIST_INTERACTIVE                    (M_DISP_CONTROL_START+567L) //(10567) M_LOCAL_DISPLAY_CONTROL
+#define M_USE_GDI_TO_APPLY_LUT                        (M_DISP_CONTROL_START+568L) //(10568) M_LOCAL_DISPLAY_CONTROL //available for customers
+#define M_GRAPHIC_LIST_BOUNDING_RECT                  (M_DISP_CONTROL_START+570L) //(10570) M_LOCAL_DISPLAY_CONTROL
+#define M_DMIL_REALLOC_SURFACE                        (M_DISP_CONTROL_START+571L) //(10571) M_REMOTE_DISPLAY_CONTROL
+#define M_ASSOCIATED_REMOTE_DISPLAY_ID                (M_DISP_CONTROL_START+572L) //(10572) M_LOCAL_DISPLAY_CONTROL
+#define M_FILL_DISPLAY                                (M_DISP_CONTROL_START+574L) //(10574) M_LOCAL_DISPLAY_CONTROL
+#define M_GRAPHIC_LIST_LIMITED_TO_BUFFER_AREA         (M_DISP_CONTROL_START+575L) //(10575) M_LOCAL_DISPLAY_CONTROL
+#define M_GRAPHIC_LIST_RELATIVE_TO_ANCESTOR           (M_DISP_CONTROL_START+576L) //(10576) M_LOCAL_DISPLAY_CONTROL
+
+
+#define M_DISP_CONTROL_DIRECT_STOP                    11000L
+
+#define M_APP_BH_DISPLAY_START                        12000L
+#define M_DESCRIPTOR_LOCK                             (M_APP_BH_DISPLAY_START+00L)     // 12000
+#define M_APP_BH_DISPLAY_END                          12099L
+#define M_IS_IN_DISPLAY_APP_BH_RANGE(X)               ((M_STRIP_INTERMOD_BITS(X) >= M_APP_BH_DISPLAY_START) && (M_STRIP_INTERMOD_BITS(X) <= M_APP_BH_DISPLAY_END))
+
+
+#define M_SCALE                                       0x00008010L
+#define M_CUSTOM_DISPLAY                              M_IN_BUFFER_DISPLAY
+#define M_CUSTOM_DISPLAY_BUFFER                       M_DISPLAY_SURFACE
+#define M_RENDER_BUFFER_ID                            M_DISPLAY_SURFACE
+#define M_WPF_DISPLAY_BUFFER_ID                       M_DISPLAY_SURFACE
+
+/************************************************************************/
+/* MdispControl() / MdispInquire() Values                               */
+/************************************************************************/
+
+#define M_FULL_SIZE                      0L
+#define M_NORMAL_SIZE                    1L
+
+#define M_BENCHMARK_IN_DEBUG_ON          0x00000001L
+#define M_BENCHMARK_IN_DEBUG_OFF         0
+#define M_BENCHMARK_IN_DEBUG_TRACE       0x00000002L
+#define M_BENCHMARK_IN_DEBUG_NOTRACE     0
+#define M_BENCHMARK_IN_DEBUG_ALLSIZE     0x00000004L
+#define M_BENCHMARK_IN_DEBUG_CSTSIZE     0
+
+#define M_DISPLAY_SCAN_LINE_START        0x00000000L
+#define M_DISPLAY_SCAN_LINE_END                   -1
+
+#define M_SLAVE                          0L
+#define M_MASTER                         1L
+
+#define M_TRANSPARENT_COLOR              0x01000060L //M_LOCAL_DISPLAY_CONTROL
+#define M_TEST_UPDATE_IF_ASYNCHRONOUS    0x00000010L
+
+//For M_NO_TEARING dispControl
+#define M_ENABLE                                      -9997L
+#define M_FULL_UPDATE                                 -9998L
+#define M_DISABLE                                     -9999L
+#define M_DEFAULT                                     0x10000000L
+#define M_GRAB_CONTINUOUS_ONLY                        0x00100000L
+#define M_BASIC                                       0x00200000L
+#define M_ADVANCED                                    0x00400000L
+#define M_NO_SKIP                                     (M_DISP_CONTROL_START+2L) //(10002) M_LOCAL_DISPLAY_CONTROL
+#define M_SKIP_OLDEST                                 (M_DISP_CONTROL_START+3L) //(10003) M_LOCAL_DISPLAY_CONTROL
+#define M_SKIP_NEWEST                                 (M_DISP_CONTROL_START+4L) //(10004) 
+#define M_NO_TEARING_SKIP_MODE_MASK                   0x000FFFFFL //M_LOCAL_DISPLAY_CONTROL
+#define M_NO_TEARING_MODE_MASK                        0x00F00000L
+#define M_CURRENT_RESOLUTION                          MIL_TEXT("M_CURRENT_RESOLUTION")
+#define M_RESET_RESOLUTION                            MIL_TEXT("M_RESET_RESOLUTION")
+#define M_RESTORE_RESOLUTION                          MIL_TEXT("M_RESTORE_RESOLUTION")
+
+#define BIN_TO_MIL(b)                                 ( ((M_DEFAULT==b)||(M_ENABLE==b)||(M_DISABLE==b)||(M_FULL_UPDATE==b))?(b):(b?M_ENABLE:M_DISABLE) )
+
+#define M_ON_SELECT                      1L
+#define M_ON_DESELECT                    2L
+
+// For the control M_GRAB_BUFFERS
+#define M_DRIVER_ERROR_PENDING                        0x40000000L
+
+// For the M_STOP_UPDATE control/inquire
+#define M_WHEN_MINIMIZED                              0x00000001L
+#define M_WHEN_NOT_VISIBLE                            0x00000002L
+
+// For M_VIDEO_DEVICE_LOST control/inquire
+#define M_SIGNAL_OFF                                  0x00000000L
+#define M_CLEAR                                       0x00000001L
+#define M_NO_CLEAR                                    0x00000002L
+
+// For M_ROI_DEFINE control
+#define M_START                                       0x00000002L
+#define M_STOP                                        0x00000004L
+#define M_RESET                                       9L
+#define M_RECTANGULAR                                 0x00000010L
+
+
+// For M_VGA_INDEX inquire
+#define M_INVALID_VGA_INDEX                           M_INVALID
+
+// Used for DispMessage when comming from HTML Client
+#define M_HTML5_MESSAGE                               0x01000000L
+
+// For M_CAN_ALLOCATE_CONTIGUOUS_VIDEO_MEMORY inquire
+#define M_CONTIGUOUS                    0x00000001L
+#define M_START_IN_VIDEO_MEMORY         0x00000010L
+#define M_END_IN_VIDEO_MEMORY           0x00000020L
+#define M_START_IN_HOST_MEMORY          0x00000040L
+#define M_END_IN_HOST_MEMORY            0x00000080L
+#define M_NO_PHYSICAL_ADDRESS           0x00000100L
+#define M_IN_VIDEO_MEMORY(x)               ((x&M_START_IN_VIDEO_MEMORY) && (x&M_END_IN_VIDEO_MEMORY))
+#define M_IN_HOST_MEMORY(x)                ((x&M_START_IN_HOST_MEMORY) && (x&M_END_IN_HOST_MEMORY))
+#define M_CONTIGUOUS_AND_IN_VIDEO_MEMORY(x)((x&M_CONTIGUOUS) && M_IN_VIDEO_MEMORY(x))
+
+// For M_ZOOM_ACCURACY
+#define M_MEDIUM                                2L
+#define M_HIGH                                  3L
+
+
+// For M_INTERACTIVE_MODE
+//M_LEGACY
+#define M_MOUSE_DRIVEN                          0x00000002L
+
+// For M_UPDATE_RATE_MAX
+#define M_SCREEN_REFRESH_RATE                   0x01000000L
+#define M_MAX_REFRESH_RATE                      0x02000000L
+
+
+/************************************************************************/
+/* MdispLut()                                                           */
+#define M_PSEUDO                                       M_PSEUDO_LUT //(M_PSEUDO_ID+2)
+
+
+/************************************************************************/
+/* MdispHook()                                                          */
+/************************************************************************/
+#define M_ASYNC_HOOK                  0x08000000L
+
+/* Defines for hook to modification to bitmap and window */
+#define M_NOT_MODIFIED                0 /* No changed at all              */
+#define M_MODIFIED_LUT                1 /* Disp lut is changed            */
+#define M_MODIFIED_DIB                2 /* Disp buffer data is changed    */
+#define M_MODIFIED_ZOOM               3 /* Disp is zoomed                 */
+#define M_MODIFIED_PAN                4 /* Disp is panned                 */
+#define M_MODIFIED_DIB_CREATION       5 /* Disp receives a new buffer ID  */
+#define M_MODIFIED_DIB_DESTRUCTION    6 /* Disp receives a buffer ID 0    */
+#define M_MODIFIED_WINDOW_CREATION    7 /* Wnd is created                 */
+#define M_MODIFIED_WINDOW_DESTRUCTION 8 /* Wnd is destroyed               */
+#define M_MODIFIED_WINDOW_LOCATION    9 /* Wnd size is changed            */
+#define M_MODIFIED_WINDOW_OVERLAP    11 /* Wnd overlap is changed         */
+#define M_MODIFIED_WINDOW_ICONIZED   12 /* Wnd is changed to iconic state */
+#define M_MODIFIED_WINDOW_ZOOM       13 /* Wnd is zoomed                  */
+#define M_MODIFIED_WINDOW_PAN        14 /* Wnd is panned                  */
+#define M_MODIFIED_WINDOW_MENU       15 /* Wnd menu pulled-down           */
+#define M_MODIFIED_WINDOW_PAINT      16 /* Wnd is painted with image      */
+#define M_MODIFIED_WINDOW_ACTIVE     17 /* Wnd activation state changed   */
+#define M_MODIFIED_WINDOW_ENABLE     18 /* Wnd enable state changed       */
+#define M_MODIFIED_WINDOW_CLIP_LIST  19 /* Wnd clip list changed          */
+
+/* M_MODIFIED_WINDOW_MENU modification hook defines */
+#define M_MODIFIED_SYS_MENU            0x00100L
+#define M_MODIFIED_APP_MENU            0x00200L
+#define M_MODIFIED_USER_APP_MENU       0x10000L
+#define M_MODIFIED_RESTORE_MENUITEM    0x00001L
+#define M_MODIFIED_MOVE_MENUITEM       0x00002L
+#define M_MODIFIED_SIZE_MENUITEM       0x00003L
+#define M_MODIFIED_MINIMIZE_MENUITEM   0x00004L
+#define M_MODIFIED_MAXIMIZE_MENUITEM   0x00005L
+#define M_MODIFIED_CLOSE_MENUITEM      0x00006L
+#define M_MODIFIED_TASKLIST_MENUITEM   0x00007L
+#define M_MODIFIED_MENUBAR_MENUITEM    0x00008L
+#define M_MODIFIED_TITLEOFF_MENUITEM   0x00009L
+#define M_MODIFIED_ZOOMIN_MENUITEM     0x0000AL
+#define M_MODIFIED_ZOOMOUT_MENUITEM    0x0000BL
+#define M_MODIFIED_NOZOOM_MENUITEM     0x0000CL
+
+/* M_MODIFIED_WINDOW_ACTIVE modification hook defines */
+/* M_MODIFIED_WINDOW_ENABLE modification hook defines */
+#define M_MODIFIED_STATE_FROM_WINDOW   0
+#define M_MODIFIED_STATE_FROM_PARENT   0x00000010L
+#define M_MODIFIED_OFF                 0
+#define M_MODIFIED_ON                  0x00000001L
+
+/* M_MODIFIED_WINDOW_CLIP_LIST modification hook defines */
+/* M_MODIFIED_WINDOW_CLIP_LIST modification hook defines */
+#define M_MODIFIED_ACCESS_RECTANGULAR_OFF 0
+#define M_MODIFIED_ACCESS_RECTANGULAR_ON  0x00000001L
+#define M_MODIFIED_ACCESS_OFF             0
+#define M_MODIFIED_ACCESS_ON              0x00000002L
+#define M_MODIFIED_ACCESS_COMMAND_PROMPT  0x00000004L
+
+/* Type of event to hook for a display */
+#define M_HOOK_AFTER                0x10000000L          /* For hook after modification      */
+#define M_HOOK_BEFORE               0x20000000L          /* For hook before modification     */
+#define M_LOCAL_HOOK_RANGE1_START   M_HOOK_MODIFIED_DIB  /* Start of first range of local hooks */
+#define M_HOOK_MODIFIED_DIB         1L                                                 /* For buffer bitmap modification   */
+#define M_HOOK_MODIFIED_WINDOW      2L                                                 /* For disp window modification     */
+#define M_HOOK_MESSAGE_LOOP         4L                                                 /* For disp window modification     */
+#define M_LOCAL_HOOK_RANGE1_END     M_HOOK_MESSAGE_LOOP  /* End of first range of local hooks */
+#define M_FRAME_START               9L                   /* For disp frame start             */
+#define M_PRE_GRAB_BUFFER_CHANGE    10L                  /* For hook before the display scheme change when it imply the change of the grab buffers */
+#define M_POST_GRAB_BUFFER_CHANGE   11L                  /* For hook after the display scheme change when it imply the change of the grab buffers  */
+#define M_PRE_SCHEME_CHANGE         M_PRE_GRAB_BUFFER_CHANGE   /* Old Name */
+#define M_POST_SCHEME_CHANGE        M_POST_GRAB_BUFFER_CHANGE  /* Old Name */
+#define M_LOCAL_HOOK_RANGE2_START   (M_BASIC_DISPLAY_EVENT & ~M_ASYNC_HOOK)   /* Start of second range of local hooks */
+#define M_BASIC_DISPLAY_EVENT       (12L | M_ASYNC_HOOK)                               /* For hook when disp window is displayed in another VGA,or between, or unsupported zoom or more (new MIL8) */
+#define M_SURFACE_LOST              (14L | M_ASYNC_HOOK)                               /* For hook when DirectX surface is lost (new event for MIL8.0)     */
+#define M_LOCAL_HOOK_RANGE2_END     (M_SURFACE_LOST & ~M_ASYNC_HOOK) /* End of second range of local hooks */
+#define M_INVALIDATE_DISPLAY        (16L | M_ASYNC_HOOK) /* For hook when a full internal update is needed (new event for MIL8.0)     */
+#define M_LOCAL_HOOK_RANGE3_START   M_WINDOW_CLOSE_BEFORE   /* Start of third range of local hooks */
+#define M_WINDOW_CLOSE_BEFORE       17L
+#define M_WINDOW_CLOSE_AFTER        18L
+#define M_WINDOW_MINIMIZE_BEFORE    19L
+#define M_WINDOW_MINIMIZE_AFTER     20L
+#define M_WINDOW_MAXIMIZE_BEFORE    21L
+#define M_WINDOW_MAXIMIZE_AFTER     22L
+#define M_WINDOW_RESTORE_BEFORE     23L
+#define M_WINDOW_RESTORE_AFTER      24L
+#define M_WINDOW_POSCHANGE_BEFORE   25L
+#define M_WINDOW_POSCHANGE_AFTER    26L
+#define M_WINDOW_ZOOM_BEFORE        27L
+#define M_WINDOW_ZOOM_AFTER         28L
+#define M_WINDOW_SCROLL_BEFORE      29L
+#define M_WINDOW_SCROLL_AFTER       30L
+#define M_WINDOW_PAINT_BEFORE       31L
+#define M_WINDOW_PAINT_AFTER        32L
+#define M_WINDOW_ACTIVE_BEFORE      33L
+#define M_WINDOW_ACTIVE_AFTER       34L
+#define M_WINDOW_ENABLE_BEFORE      35L
+#define M_WINDOW_ENABLE_AFTER       36L
+#define M_WINDOW_SHOW_BEFORE        37L
+#define M_WINDOW_SHOW_AFTER         38L
+#define M_MODIFIED_DISPLAY          39L
+#define M_LOCAL_HOOK_RANGE3_END     M_MODIFIED_DISPLAY   /* End of third range of local hooks */
+#define M_DISPLAY_SCHEME_CHANGED    40L
+#define M_PRE_OVERLAY_ID_CHANGE     41L
+#define M_POST_OVERLAY_ID_CHANGE    42L
+#define M_LOCAL_HOOK_RANGE4_START   M_WINDOW_VISIBLE_CHANGE /* Start of fourth range of local hooks */
+#define M_WINDOW_VISIBLE_CHANGE     43L
+#define M_LOCAL_HOOK_RANGE4_END     M_WINDOW_VISIBLE_CHANGE /* End of fourth range of local hooks */
+#define M_PRIMARY_SURFACE_ID_CHANGED 44L
+#define M_LOCAL_HOOK_RANGE5_START   M_DEVICE_LOSING   /* Start of fifth range of local hooks */
+#define M_DEVICE_LOSING             45L
+#define M_DEVICE_LOST               46L
+#define M_DEVICE_RESTORING          47L
+#define M_DEVICE_RESTORED           48L
+#define M_ROI_CHANGE                49L
+#define M_ROI_CHANGE_END            50L
+#define M_ROI_HANDLE_RELEASE        51L
+#define M_VIDEO_DEVICE_MODIFIED_BEFORE 52L
+#define M_VIDEO_DEVICE_MODIFIED_AFTER  53L
+#define M_DEVICE_LEAVEVT            54L
+#define M_DEVICE_ENTERVT            55L
+#define M_MOUSE_LEFT_BUTTON_DOWN    56L
+#define M_MOUSE_RIGHT_BUTTON_DOWN   57L
+#define M_MOUSE_LEFT_BUTTON_UP      58L
+#define M_MOUSE_RIGHT_BUTTON_UP     59L
+#define M_ANNOTATIONS_DRAW          60L
+#define M_LOCAL_HOOK_RANGE5_END     M_ANNOTATIONS_DRAW   /* End of fifth of local hooks */
+#define M_WINDOW_ACTION             61L
+#define M_WINDOW_RESIZED            62L
+#define M_LOCAL_HOOK_RANGE6_START   M_MOUSE_MOVE /* Start of sixth range of local hooks */
+#define M_MOUSE_MOVE                64L
+#define M_MOUSE_WHEEL               65L
+#define M_MOUSE_MIDDLE_BUTTON_DOWN  66L
+#define M_MOUSE_MIDDLE_BUTTON_UP    67L
+#define M_KEY_DOWN                  68L
+#define M_KEY_UP                    69L
+#define M_DISP_MESSAGE_ANY          70L
+#define M_MOUSE_LEFT_DOUBLE_CLICK   71L
+#define M_KEY_CHAR                  72L
+#define M_SET_CURSOR                73L
+#define M_WINDOW_SIZING             74L
+#define M_CUSTOM_MESSAGE_SERVER     75L
+#define M_CUSTOM_MESSAGE_CLIENT     76L
+#define M_GRA_INTERACTIVE_ENABLED   77L
+#define M_GRA_INTERACTIVE_DISABLED  78L
+#define M_DISP_DESELECT_BEFORE      79L
+#define M_DISP_DESELECT_AFTER       80L
+#define M_DISP_SELECT_AFTER         81L
+#define M_DISP_PAN_BEFORE           82L
+#define M_DISP_PAN_AFTER            83L
+#define M_UPDATE_INTERACTIVE_STATE  84L
+#define M_MOUSE_LEAVE               85L
+#define M_DISP_SELECT_BEFORE        86L
+#define M_LOCAL_HOOK_RANGE6_END     M_SET_CURSOR   /* End of sixth of local hooks */
+
+#define M_IS_LOCAL_HOOK(HookType)   (((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE1_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE1_END)) ||   \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE2_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE2_END)) ||   \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE3_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE3_END)) ||   \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE4_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE4_END)) ||   \
+                                      ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE5_START) &&  \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE5_END)) ||   \
+                                     ((((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) >= M_LOCAL_HOOK_RANGE6_START) &&  \
+                                      (((HookType) & ~(M_HOOK_AFTER | M_HOOK_BEFORE)) <= M_LOCAL_HOOK_RANGE6_END))))
+
+//Old names
+#define M_WINDOW_LBUTTONDOWN        M_MOUSE_LEFT_BUTTON_DOWN
+#define M_WINDOW_RBUTTONDOWN        M_MOUSE_RIGHT_BUTTON_DOWN
+#define M_WINDOW_LBUTTONUP          M_MOUSE_LEFT_BUTTON_UP
+#define M_WINDOW_RBUTTONUP          M_MOUSE_RIGHT_BUTTON_UP
+#define M_PRE_SCHEME_CHANGE         M_PRE_GRAB_BUFFER_CHANGE 
+#define M_POST_SCHEME_CHANGE        M_POST_GRAB_BUFFER_CHANGE
+
+#if OldDefinesSupport
+#define M_ROI_ANCHOR_COLOR    M_ROI_HANDLE_COLOR
+MIL_DEPRECATED(M_ROI_ANCHOR_COLOR, 1000)
+#define M_ROI_ANCHOR_SIZE     M_ROI_HANDLE_SIZE
+MIL_DEPRECATED(M_ROI_ANCHOR_SIZE, 1000)
+#define M_ROI_ANCHOR_RELEASE  M_ROI_HANDLE_RELEASE
+MIL_DEPRECATED(M_ROI_ANCHOR_RELEASE, 1000)
+#define M_WINDOW_ROI          M_WINDOW_ROI_BUTTONS
+MIL_DEPRECATED(M_WINDOW_ROI, 1000)
+#endif
+
+
+// Flag passed via the EventId of the hook
+#define M_INVALIDATE_OVERLAY     (0x00000001)
+#define M_INVALIDATE_UNDERLAY    (0x00000002)
+#define M_INVALIDATE_ALL_DISPLAY (M_INVALIDATE_OVERLAY|M_INVALIDATE_UNDERLAY)
+
+/************************************************************************/
+/* MdispGetHookInfo() Info types                                        */
+/************************************************************************/
+#define M_DISPLAY                0x00200000L
+#define M_MOUSE_POSITION_X       1L
+#define M_MOUSE_POSITION_Y       2L
+#define M_ANNOTATIONS_DC         3L
+#define M_ANNOTATIONS_PIXMAP     M_ANNOTATIONS_DC // Pixmap for Linux 
+#define M_MOUSE_POSITION_BUFFER_X  4L
+#define M_MOUSE_POSITION_BUFFER_Y  5L
+#define M_USER_FLAG                6L
+#define M_COMBINATION_KEYS         7L
+#define M_EVENT_VALUE              8L
+#define M_MIL_KEY_VALUE            9L // OS-independent Key Code
+
+// documented aliases for M_EVENT_VALUE
+#define M_MOUSE_WHEEL_VALUE   M_EVENT_VALUE
+#define M_KEY_VALUE           M_EVENT_VALUE  // OS-dependent Key Code
+
+// aliases for some infos, for easier documentation of M_CUSTOM_MESSAGE_CLIENT/SERVER
+#define M_EVENT_VALUE_1          M_MOUSE_POSITION_X
+#define M_EVENT_VALUE_2          M_MOUSE_POSITION_Y
+#define M_EVENT_VALUE_3          M_EVENT_VALUE
+#define M_EVENT_VALUE_4          M_COMBINATION_KEYS
+
+/************************************************************************/
+/* MdispMessage flags                                                   */
+/************************************************************************/
+
+#define M_KEY_SHIFT              0x00010000
+#define M_KEY_CTRL               0x00020000
+#define M_KEY_ALT                0x00040000
+#define M_MOUSE_LEFT_BUTTON      0x00080000
+#define M_MOUSE_MIDDLE_BUTTON    0x00100000
+#define M_MOUSE_RIGHT_BUTTON     0x00200000
+#define M_KEY_WIN                0x00400000
+
+#if M_MIL_USE_WINDOWS
+
+#define M_COMBINATION_KEYS_FROM_KEY_STATE()  (((GetKeyState(VK_SHIFT)&0x8000)    ?  M_KEY_SHIFT : M_NULL)   | \
+                                              ((GetKeyState(VK_CONTROL)&0x8000)  ?  M_KEY_CTRL  : M_NULL)   | \
+                                              ((GetKeyState(VK_MENU)&0x8000)     ?  M_KEY_ALT   : M_NULL)   | \
+                                              ((GetKeyState(VK_LWIN) & 0x8000)   ?  M_KEY_WIN   : M_NULL)   | \
+                                              ((GetKeyState(VK_RWIN) & 0x8000)   ?  M_KEY_WIN   : M_NULL))
+
+#define M_COMBINATION_KEYS_FROM_WPARAM(X) ( M_COMBINATION_KEYS_FROM_KEY_STATE() | \
+                                           ((X&MK_LBUTTON) ? M_MOUSE_LEFT_BUTTON : M_NULL) | \
+                                           ((X&MK_MBUTTON) ? M_MOUSE_MIDDLE_BUTTON : M_NULL) | \
+                                           ((X&MK_RBUTTON) ? M_MOUSE_RIGHT_BUTTON : M_NULL))
+
+#else
+#define M_COMBINATION_KEYS_FROM_STATE(X)(((X&ShiftMask)    ?  M_KEY_SHIFT           : M_NULL)   | \
+                                         ((X&ControlMask)  ?  M_KEY_CTRL            : M_NULL)   | \
+                                         ((X&Mod1Mask)     ?  M_KEY_ALT             : M_NULL)   | \
+                                         ((X&Mod4Mask)     ?  M_KEY_WIN             : M_NULL)   | \
+                                         ((X&Button1Mask)  ?  M_MOUSE_LEFT_BUTTON   : M_NULL)   | \
+                                         ((X&Button2Mask)  ?  M_MOUSE_MIDDLE_BUTTON : M_NULL)   | \
+                                         ((X&Button3Mask)  ?  M_MOUSE_RIGHT_BUTTON  : M_NULL))
+
+#define M_COMBINATION_KEYS_FROM_BUTTON(X) (((X==Button1) ? M_MOUSE_LEFT_BUTTON : M_NULL) | \
+                                           ((X==Button2) ? M_MOUSE_MIDDLE_BUTTON : M_NULL) | \
+                                           ((X==Button3) ? M_MOUSE_RIGHT_BUTTON : M_NULL))
+
+#endif
+
+// OS-Independent Key Codes (mapped to the windows virtual key codes)
+#define M_KEY_BACK               0x08 // VK_BACK      (Backspace key)
+#define M_KEY_TAB                0x09 // VK_TAB       (Tab key)
+
+#define M_KEY_CLEAR              0x0C // VK_CLEAR     (Clear key)
+#define M_KEY_RETURN             0x0D // VK_RETURN    (Enter key)
+
+#define M_KEY_PAUSE              0x13 // VK_PAUSE     (Pause key)
+#define M_KEY_CAPS_LOCK          0x14 // VK_CAPITAL   (Caps lock key)
+
+#define M_KEY_ESC                0x1B // VK_ESCAPE    (Esc key)
+
+#define M_KEY_SPACE              0x20 // VK_SPACE     (Spacebar)
+#define M_KEY_PAGEUP             0x21 // VK_PRIOR     (Page Up key)
+#define M_KEY_PAGEDOWN           0x22 // VK_NEXT      (Page Down key)
+#define M_KEY_END                0x23 // VK_END       (End key)
+#define M_KEY_HOME               0x24 // VK_HOME      (Home key)
+#define M_KEY_ARROW_LEFT         0x25 // VK_LEFT      (Left Arrow key)
+#define M_KEY_ARROW_UP           0x26 // VK_UP        (Up Arrow key)
+#define M_KEY_ARROW_RIGHT        0x27 // VK_RIGHT     (Right Arrow key)
+#define M_KEY_ARROW_DOWN         0x28 // VK_DOWN      (Down Arrow key)
+
+#define M_KEY_SELECT             0x29 // VK_SELECT    (Select key)
+#define M_KEY_PRINT              0x2A // VK_PRINT     (Print key)
+#define M_KEY_EXECUTE            0x2B // VK_EXECUTE   (Execute key)
+#define M_KEY_INSERT             0x2D // VK_INSERT    (Ins key)
+#define M_KEY_DELETE             0x2E // VK_DELETE    (Del key)
+#define M_KEY_HELP               0x2F // VK_HELP      (Help key)
+
+#define M_KEY_0                  0x30 // 0 key
+#define M_KEY_1                  0x31 // 1 key
+#define M_KEY_2                  0x32 // 2 key
+#define M_KEY_3                  0x33 // 3 key
+#define M_KEY_4                  0x34 // 4 key
+#define M_KEY_5                  0x35 // 5 key
+#define M_KEY_6                  0x36 // 6 key
+#define M_KEY_7                  0x37 // 7 key
+#define M_KEY_8                  0x38 // 8 key
+#define M_KEY_9                  0x39 // 9 key
+#define M_KEY_A                  0x41 // A key
+#define M_KEY_B                  0x42 // B key
+#define M_KEY_C                  0x43 // C key
+#define M_KEY_D                  0x44 // D key
+#define M_KEY_E                  0x45 // E key
+#define M_KEY_F                  0x46 // F key
+#define M_KEY_G                  0x47 // G key
+#define M_KEY_H                  0x48 // H key
+#define M_KEY_I                  0x49 // I key
+#define M_KEY_J                  0x4A // J key
+#define M_KEY_K                  0x4B // K key
+#define M_KEY_L                  0x4C // L key
+#define M_KEY_M                  0x4D // M key
+#define M_KEY_N                  0x4E // N key
+#define M_KEY_O                  0x4F // O key
+#define M_KEY_P                  0x50 // P key
+#define M_KEY_Q                  0x51 // Q key
+#define M_KEY_R                  0x52 // R key
+#define M_KEY_S                  0x53 // S key
+#define M_KEY_T                  0x54 // T key
+#define M_KEY_U                  0x55 // U key
+#define M_KEY_V                  0x56 // V key
+#define M_KEY_W                  0x57 // W key
+#define M_KEY_X                  0x58 // X key
+#define M_KEY_Y                  0x59 // Y key
+#define M_KEY_Z                  0x5A // Z key
+
+#define M_KEY_NUMPAD0            0x60 // VK_NUMPAD0   (Numeric keypad 0 key)
+#define M_KEY_NUMPAD1            0x61 // VK_NUMPAD1   (Numeric keypad 1 key)
+#define M_KEY_NUMPAD2            0x62 // VK_NUMPAD2   (Numeric keypad 2 key)
+#define M_KEY_NUMPAD3            0x63 // VK_NUMPAD3   (Numeric keypad 3 key)
+#define M_KEY_NUMPAD4            0x64 // VK_NUMPAD4   (Numeric keypad 4 key)
+#define M_KEY_NUMPAD5            0x65 // VK_NUMPAD5   (Numeric keypad 5 key)
+#define M_KEY_NUMPAD6            0x66 // VK_NUMPAD6   (Numeric keypad 6 key)
+#define M_KEY_NUMPAD7            0x67 // VK_NUMPAD7   (Numeric keypad 7 key)
+#define M_KEY_NUMPAD8            0x68 // VK_NUMPAD8   (Numeric keypad 8 key)
+#define M_KEY_NUMPAD9            0x69 // VK_NUMPAD9   (Numeric keypad 9 key)
+#define M_KEY_MULTIPLY           0x6A // VK_MULTIPLY  (Multiply key)
+#define M_KEY_ADD                0x6B // VK_ADD       (Add key)
+#define M_KEY_SEPARATOR          0x6C // VK_SEPARATOR (Separator key)
+#define M_KEY_SUBTRACT           0x6D // VK_SUBTRACT  (Subtract key)
+#define M_KEY_DECIMAL            0x6E // VK_DECIMAL   (Decimal key)
+#define M_KEY_DIVIDE             0x6F // VK_DIVIDE    (Divide key)
+#define M_KEY_F1                 0x70 // VK_F1        (F1 key)
+#define M_KEY_F2                 0x71 // VK_F2        (F2 key)
+#define M_KEY_F3                 0x72 // VK_F3        (F3 key)
+#define M_KEY_F4                 0x73 // VK_F4        (F4 key)
+#define M_KEY_F5                 0x74 // VK_F5        (F5 key)
+#define M_KEY_F6                 0x75 // VK_F6        (F6 key)
+#define M_KEY_F7                 0x76 // VK_F7        (F7 key)
+#define M_KEY_F8                 0x77 // VK_F8        (F8 key)
+#define M_KEY_F9                 0x78 // VK_F9        (F9 key)
+#define M_KEY_F10                0x79 // VK_F10       (F10 key)
+#define M_KEY_F11                0x7A // VK_F11       (F11 key)
+#define M_KEY_F12                0x7B // VK_F12       (F12 key)
+#define M_KEY_F13                0x7C // VK_F13       (F13 key)
+#define M_KEY_F14                0x7D // VK_F14       (F14 key)
+#define M_KEY_F15                0x7E // VK_F15       (F15 key)
+#define M_KEY_F16                0x7F // VK_F16       (F16 key)
+#define M_KEY_F17                0x80 // VK_F17       (F17 key)
+#define M_KEY_F18                0x81 // VK_F18       (F18 key)
+#define M_KEY_F19                0x82 // VK_F19       (F19 key)
+#define M_KEY_F20                0x83 // VK_F20       (F20 key)
+#define M_KEY_F21                0x84 // VK_F21       (F21 key)
+#define M_KEY_F22                0x85 // VK_F22       (F22 key)
+#define M_KEY_F23                0x86 // VK_F23       (F23 key)
+#define M_KEY_F24                0x87 // VK_F24       (F24 key)
+
+#define M_KEY_NUM_LOCK           0x90   // VK_NUMLOCK (Num Lock key)
+#define M_KEY_SCROLL_LOCK        0x91   // VK_SCROLL (Scroll Lock key)
+
+#define M_KEY_OEM_PLUS           0xBB  // VK_OEM_PLUS '+' any country	//  (For any country / region, the '+' key)
+#define M_KEY_OEM_COMMA          0xBC  // VK_OEM_COMMA ',' any country	//  (For any country / region, the ',' key)
+#define M_KEY_OEM_MINUS          0xBD  // VK_OEM_MINUS '-' any country	//  (For any country / region, the '-' key)
+#define M_KEY_OEM_PERIOD         0xBE  // VK_OEM_PERIOD '.' any country	//  (For any country / region, the '.' key)
+
+// Deprecated names, kept for code backward compatibility
+#if OldDefinesSupport
+#define M_KEY_SUBSTRACT    M_KEY_SUBTRACT
+MIL_DEPRECATED(M_KEY_SUBSTRACT, 1030)
+#endif
+
+
+#if M_MIL_USE_WINDOWS
+#define M_WHEEL_DELTA            WHEEL_DELTA
+#define M_MOUSE_WHEEL_DELTA_FROM_WPARAM(X)  (GET_WHEEL_DELTA_WPARAM(X)/M_WHEEL_DELTA)
+#else
+#define M_WHEEL_DELTA            120 
+#define M_MOUSE_WHEEL_DELTA_FROM_WPARAM(X)   ((X<0)?-1:1)
+#endif
+
+
+/************************************************************************/
+/* MdispOverlayKey()                                                    */
+/************************************************************************/
+#define M_KEY_ON_COLOR                                1L
+#define M_KEY_OFF                                     2L
+#define M_KEY_ALWAYS                                  3L
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* FUNCTION PROTOTYPES */
+
+      /* -------------------------------------------------------------- */
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+   {
+#endif
+
+typedef MIL_HOOK_FUNCTION_PTR MDISPHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_DISP_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void MFTYPE    MdispHookFunction    (MIL_ID DisplayId,
+                                     MIL_INT HookType,
+                                     MIL_DISP_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                     void *UserDataPtr);
+
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC MIL_ID MFTYPE  MdispAllocA          (MIL_ID SystemId,
+                                     MIL_INT DispNum,
+                                     MIL_CONST_TEXTA_PTR DispFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID *DisplayIdPtr);
+MIL_DLLFUNC MIL_ID MFTYPE  MdispAllocW          (MIL_ID SystemId,
+                                     MIL_INT DispNum,
+                                     MIL_CONST_TEXTW_PTR DispFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID *DisplayIdPtr);
+#if M_MIL_UNICODE_API
+#define MdispAlloc MdispAllocW
+#else
+#define MdispAlloc MdispAllocA
+#endif
+#else
+
+MIL_DLLFUNC MIL_ID MFTYPE  MdispAlloc           (MIL_ID SystemId,
+                                     MIL_INT DispNum,
+                                     MIL_CONST_TEXT_PTR DispFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID *DisplayIdPtr);
+
+#endif
+
+
+MIL_DLLFUNC void MFTYPE    MdispFree            (MIL_ID DisplayId);
+
+MIL_DLLFUNC void MFTYPE    MdispSelect          (MIL_ID DisplayId,
+                                     MIL_ID ImageBufId);
+
+#define MdispDeselect(DisplayId, ImageId) MdispSelect(DisplayId, M_NULL)
+
+MIL_DLLFUNC MIL_INT MFTYPE MdispInquire         (MIL_ID DisplayId,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MdispPan             (MIL_ID DisplayId,
+                                     MIL_DOUBLE XOffset,
+                                     MIL_DOUBLE YOffset);
+MIL_DLLFUNC void MFTYPE    MdispZoom            (MIL_ID DisplayId,
+                                     MIL_DOUBLE XFactor,
+                                     MIL_DOUBLE YFactor);
+
+MIL_DLLFUNC void MFTYPE    MdispLut             (MIL_ID DisplayId,
+                                     MIL_ID LutBufId);
+
+MIL_DLLFUNC void MFTYPE    MdispMessage(         MIL_ID  DisplayId, 
+                                     MIL_INT EventType, 
+                                     MIL_INT MousePositionX, 
+                                     MIL_INT MousePositionY, 
+                                     MIL_INT EventValue, 
+                                     MIL_INT CombinationKeys,
+                                     MIL_INT UserValue);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MdispControlInt64        (MIL_ID DisplayId,
+                                         MIL_INT64 ControlType,
+                                         MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MdispControlDouble       (MIL_ID DisplayId,
+                                         MIL_INT64 ControlType,
+                                         MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MdispControlDouble MdispControl
+#define MdispControlInt64  MdispControl
+MIL_DLLFUNC void MFTYPE       MdispControl         (MIL_ID DisplayId,
+                                        MIL_INT64 ControlType,
+                                        MIL_DOUBLE ControlValue);
+#endif
+
+
+MIL_DLLFUNC void MFTYPE    MdispUpdate         (MIL_ID DisplayId,
+                                    MIL_INT OffsetX,
+                                    MIL_INT OffsetY,
+                                    MIL_INT SizeX,
+                                    MIL_INT SizeY,
+                                    MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MdispGetHookInfo    (MIL_ID EventId,
+                                       MIL_INT64 InfoType,
+                                       void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MdispSelectWindow    (MIL_ID DisplayId,
+                                     MIL_ID ImageBufId,
+                                     MIL_WINDOW_HANDLE ClientWindowHandle);
+
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+#if M_MIL_USE_64BIT
+
+//////////////////////////////////////////////////////////////
+// MdispControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         int ControlValue)
+   {
+   MdispControlInt64(DisplayId, ControlType, ControlValue);
+   };
+#endif
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         MIL_INT32 ControlValue)
+   {
+   MdispControlInt64(DisplayId, ControlType, ControlValue);
+   }
+
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         MIL_INT64 ControlValue)
+   {
+   MdispControlInt64(DisplayId, ControlType, ControlValue);
+   }
+
+inline void MdispControl(MIL_ID DisplayId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue)
+   {
+   MdispControlDouble(DisplayId, ControlType, ControlValue);
+   }
+
+inline void MdispControl(MIL_ID DisplayId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+#else // M_MIL_USE_64BIT
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         int ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, (double)ControlValue);
+   };
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         MIL_INT32 ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, (double)ControlValue);
+   };
+
+inline void MdispControl(MIL_ID DisplayId,
+                         MIL_INT64 ControlType,
+                         MIL_INT64 ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, (double)ControlValue);
+   };
+
+inline void MdispControl(MIL_ID DisplayId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MdispControl(DisplayId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   };
+#endif // M_MIL_USE_64BIT
+#else // __cplusplus
+
+#define MdispControl MdispControlInt64
+#endif // __cplusplus
+
+//////////////////////////////////////////////////////////////
+// SafeType functions.
+//////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////
+// See milos.h for explanation about these functions.
+//////////////////////////////////////////////////////////////
+
+// M_MIL_USE_SAFE_TYPE defined in milos.h.
+#if M_MIL_USE_SAFE_TYPE
+
+// ----------------------------------------------------------
+// MdispInquire
+
+inline MIL_INT MFTYPE MdispInquireUnsafe  (MIL_ID DisplayId, MIL_INT64 InquireType, void*                 ResultPtr);
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, int                   ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_TEXT_CHAR*        ResultPtr);
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_INT*              ResultPtr);
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_DOUBLE*           ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_UINT*             ResultPtr);
+#endif
+#if   M_MIL_USE_WINDOWS
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_WINDOW_HANDLE*    ResultPtr);
+#endif
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_INT64*            ResultPtr);
+#endif
+
+inline MIL_INT64 MdispInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_DISP_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_DISP_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_DOUBLE;
+
+   if (M_IN_DISP_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_DISP_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr || M_DISP_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MdispInquire"));
+
+   return MdispInquire(DisplayId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_DISP_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MdispInquire"));
+
+   return MdispInquire(DisplayId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MdispInquireExecute (MIL_ID DisplayId, MIL_INT64 InquireType, void* ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MdispInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdispInquire"));
+
+   return MdispInquire(DisplayId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MdispInquireUnsafe  (MIL_ID DisplayId, MIL_INT64 InquireType, void*          UserVarPtr) {return MdispInquire       (DisplayId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_TEXT_CHAR* UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_INT*       UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_DOUBLE*    UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_UINT*      UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_INT64*     UserVarPtr) {return MdispInquireExecute(DisplayId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#if   M_MIL_USE_WINDOWS
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DisplayId, MIL_INT64 InquireType, MIL_WINDOW_HANDLE* ResultPtr)
+   {
+   if (InquireType != M_WINDOW_HANDLE)
+      SafeTypeError(MIL_TEXT("MdispInquire"));
+
+   return MdispInquire(DisplayId, InquireType, ResultPtr);
+   }
+#endif
+// ----------------------------------------------------------
+// MdispGetHookInfo
+
+inline MIL_INT MFTYPE MdispGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int             *UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *UserVarPtr);
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DC_HANDLE   *UserVarPtr);
+
+//safe type checking 
+inline MIL_INT64 MdispGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   //check if InfoType requires a double
+   if ((M_MOUSE_POSITION_BUFFER_X == InfoType) || (M_MOUSE_POSITION_BUFFER_Y == InfoType))
+      {
+      return M_TYPE_MIL_DOUBLE;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MdispGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MdispGetHookInfoRequiredType(InfoType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdispGetHookInfo"));
+
+   return MdispGetHookInfo(EventId, InfoType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdispGetHookInfo"));
+
+   return MdispGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MdispGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MdispGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *UserVarPtr) {return MdispGetHookInfo               (EventId, InfoType, UserVarPtr)                  ;}
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *UserVarPtr) {return MdispGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *UserVarPtr) {return MdispGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_DOUBLE   );}
+
+#if !M_MIL_USE_LINUX
+inline MIL_INT MFTYPE MdispGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DC_HANDLE   *UserVarPtr)
+      {
+      if (InfoType != M_ANNOTATIONS_DC)
+         SafeTypeError(MIL_TEXT("MdispHookFunction"));
+
+      return MdispGetHookInfo(EventId, InfoType, UserVarPtr);
+      }
+#endif
+
+#define MdispInquire         MdispInquireSafeType
+#define MdispGetHookInfo     MdispGetHookInfoSafeType
+
+#else // #if M_MIL_USE_SAFE_TYPE
+
+#define MdispGetHookInfoUnsafe     MdispGetHookInfo
+#define MdispInquireUnsafe         MdispInquire
+
+#endif
+#if M_MIL_USE_STRING
+///***************************************************************************/
+///* DISP MODULE                                                             */
+///***************************************************************************/
+inline void MdispControl(MIL_ID DisplayId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+   if(M_IN_DISP_INQUIRE_STRING_RANGE(ControlType))
+      {
+      MdispControl(DisplayId, ControlType, ControlValue.c_str());
+      }
+   else
+      {
+#if M_MIL_USE_SAFE_TYPE
+      SafeTypeError(MIL_TEXT("MdispControl: ControlType does not support string argument."));
+#endif
+      }
+   }
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+inline MIL_ID MFTYPE  MdispAllocW(MIL_ID SystemId, MIL_INT DispNum, const MIL_STRING& DispFormat, MIL_INT64 InitFlag, MIL_ID *DisplayIdPtr)
+   {
+   return MdispAllocW(SystemId, DispNum, DispFormat.c_str(), InitFlag, DisplayIdPtr);
+   }
+#else
+inline MIL_ID MFTYPE  MdispAllocA(MIL_ID SystemId, MIL_INT DispNum, const MIL_STRING& DispFormat, MIL_INT64 InitFlag, MIL_ID *DisplayIdPtr)
+   {
+   return MdispAllocA(SystemId, DispNum, DispFormat.c_str(), InitFlag, DisplayIdPtr);
+   }
+#endif /* M_MIL_USE_UNICODE */
+#else
+inline MIL_ID MFTYPE  MdispAlloc(MIL_ID SystemId, MIL_INT DispNum, const MIL_STRING& DispFormat, MIL_INT64 InitFlag, MIL_ID *DisplayIdPtr)
+   {
+   return MdispAlloc(SystemId, DispNum, DispFormat.c_str(), InitFlag, DisplayIdPtr);
+   }
+#endif /* M_MIL_UNICODE_API */
+
+#if !M_MIL_USE_SAFE_TYPE
+inline MIL_INT MFTYPE MdispInquire(MIL_ID DispId, MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   MdispInquire(DispId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdispInquire(DispId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#else
+inline MIL_INT MFTYPE MdispInquireSafeType(MIL_ID DispId, MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   MdispInquire(DispId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdispInquire(DispId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif /* M_MIL_UNICODE */
+#endif /* M_MIL_USE_STRING*/
+
+////////////////////////////////////////////////////////////////////////////////
+// MIL_UNIQUE_ID support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+#if M_MIL_USE_SAFE_TYPE
+template <> inline bool MilIsCorrectObjectType<&MdispFree>(MIL_INT64 ObjectType)
+   {
+   return M_IS_DISPLAY_TYPE(ObjectType);
+   }
+#endif
+
+typedef MIL_UNIQUE_ID<&MdispFree> MIL_UNIQUE_DISP_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+
+inline MIL_UNIQUE_DISP_ID MdispAlloc(MIL_ID SystemId, MIL_INT DispNum, MIL_CONST_TEXT_PTR DispFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_DISP_ID(MdispAlloc(SystemId, DispNum, DispFormat, InitFlag, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_DISP_ID MdispAlloc(MIL_ID SystemId, MIL_INT DispNum, const MIL_STRING& DispFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_DISP_ID(MdispAlloc(SystemId, DispNum, DispFormat, InitFlag, M_NULL));
+   }
+#endif // M_MIL_USE_STRING
+template <MilFreeFuncType FreeFunc> inline void MdispFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+
+// End of MIL_UNIQUE_ID support
+////////////////////////////////////////////////////////////////////////////////
+
+#endif //__MIL_DISPLAY_H__
diff --git a/Lib/Matrox/Include/MILDyn/milim.h b/Lib/Matrox/Include/MILDyn/milim.h
new file mode 100644
index 0000000..95fe13b
--- /dev/null
+++ b/Lib/Matrox/Include/MILDyn/milim.h
@@ -0,0 +1,3389 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  MILIM.H
+// Revision          :  10.40.0640
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+
+#ifndef __MILIM_H__
+#define __MILIM_H__
+
+/************************************************************************/
+/* MimAlloc()                                                           */
+/************************************************************************/
+#define M_DEINTERLACE_CONTEXT                         1L
+
+#define M_FLAT_FIELD_CONTEXT                          3L
+#define M_DEAD_PIXEL_CONTEXT                          4L
+#define M_REARRANGE_CONTEXT                           5L
+#define M_STAT_MULTIPLE_CONTEXT                       6L
+#define M_MATCH_CONTEXT                               7L
+#define M_PROJECT_SHAPE_CONTEXT                       8L
+#define M_WAVELET_TRANSFORM_CONTEXT                   9L
+#define M_WAVELET_TRANSFORM_CUSTOM_CONTEXT            10L
+#define M_FIND_ORIENTATION_CONTEXT                    11L
+#define M_LOCATE_PEAK_1D_CONTEXT                      12L
+#define M_HISTOGRAM_EQUALIZE_ADAPTIVE_CONTEXT         13L
+#define M_BINARIZE_ADAPTIVE_CONTEXT                   14L
+#define M_BINARIZE_ADAPTIVE_FROM_SEED_CONTEXT         15L
+#define M_STATISTICS_CONTEXT                          16L
+#define M_STATISTICS_CUMULATIVE_CONTEXT               17L
+#define M_AUGMENTATION_CONTEXT                        18L
+#define M_LINEAR_FILTER_IIR_CONTEXT                   19L
+
+
+/************************************************************************/
+/* MimGetResult()                                                       */
+/************************************************************************/
+#define M_VALUE                                       0L
+#define M_POSITION_X                                  0x00003400L
+#define M_POSITION_Y                                  0x00004400L
+#define M_NB_EVENT                                    5L
+#define M_NUMBER                                      1009L    // Already defined elsewhere
+#define M_TOTAL_NUMBER                                1010L    // Already defined elsewhere
+#define M_NUMBER_OF_LEVELS                            1797L
+#define M_WAVELET_TYPE                                1802L    // Already defined elsewhere
+#define M_TRANSFORMATION_MODE                         1824L    // Already defined elsewhere
+#define M_WAVELET_SIZE                                1856L
+#define M_WAVELET_DRAW_SIZE_X_WITH_PADDING            1857L
+#define M_WAVELET_DRAW_SIZE_Y_WITH_PADDING            1858L
+#define M_REAL_PART                                   0x1000L
+#define M_IMAGINARY_PART                              0x2000L
+#define M_TRANSFORMATION_DOMAIN                       1864L
+#define M_ORIGINAL_IMAGE_SIZE_X                       1869L
+#define M_ORIGINAL_IMAGE_SIZE_Y                       1870L
+#define M_WAVELET_DRAW_SIZE_X                         1871L
+#define M_WAVELET_DRAW_SIZE_Y                         1872L
+#define M_ALLOCATED_TYPE                              2183L
+
+/************************************************************************/
+/* MimGetResult/MimHistogram()                                          */
+/************************************************************************/
+#define M_CUMULATIVE_VALUE                            1L
+#define M_PERCENTAGE                                  2L    // to be used as a complement to M_VALUE and M_CUMULATIVE_VALUE
+#define M_PERCENTILE_VALUE                            0x10L // can also be used as a complement to M_GREATER/... with MimBinarize
+#define M_PERCENTILE_VALUE_RESULT_SIZE                101L  // 0 to 100%
+#define M_HIST_REAL_SIZE                              102L  // Real size of histogram obtain from automatic bin size.
+#define M_HIST_VALUE_OFFSET                           103L  // Source value of the first bin.
+#define M_HIST_VALUE_RANGE                            104L  // Source value range.
+
+/************************************************************************/
+/* MimGetResult/MimAugment()                                          */
+/************************************************************************/
+#define M_AUG_ROTATION_ANGLE                              3265L
+#define M_AUG_TRANSLATION_X                               3266L
+#define M_AUG_TRANSLATION_Y                               3267L
+#define M_AUG_SCALE_FACTOR                                3268L
+#define M_AUG_ASPECT_RATIO                                3269L
+#define M_AUG_ASPECT_RATIO_MODE                           3373L
+#define M_AUG_FLIP_DIRECTION                              3374L
+#define M_AUG_SHEAR_X                                     3270L
+#define M_AUG_SHEAR_Y                                     3271L
+#define M_AUG_DILATION_NB_ITERATIONS                      3272L
+#define M_AUG_EROSION_NB_ITERATIONS                       3273L
+#define M_AUG_DILATION_ASYM_NB_ITERATIONS                 3274L
+#define M_AUG_DILATION_ASYM_SUBAREA                       3275L
+#define M_AUG_EROSION_ASYM_NB_ITERATIONS                  3276L
+#define M_AUG_EROSION_ASYM_SUBAREA                        3277L
+#define M_AUG_LIGHTING_DIRECTIONAL_ANGLE                  3278L
+#define M_AUG_SATURATION_GAIN                             3279L
+#define M_AUG_HSV_VALUE_GAIN                              3280L
+#define M_AUG_HUE_OFFSET                                  3281L
+#define M_AUG_SMOOTH_DERICHE_VALUE                        3282L
+#define M_AUG_BLUR_MOTION_SIZE                            3283L
+#define M_AUG_BLUR_MOTION_ANGLE                           3284L
+#define M_AUG_SHARPEN_DERICHE_VALUE                       3285L
+#define M_AUG_SMOOTH_GAUSSIAN_STDDEV                      3286L
+#define M_AUG_CROP_TOP_LEFT_X                             3287L
+#define M_AUG_CROP_TOP_LEFT_Y                             3288L
+#define M_AUG_CROP_BOTTOM_RIGHT_X                         3289L
+#define M_AUG_CROP_BOTTOM_RIGHT_Y                         3290L
+#define M_AUG_NOISE_SALT_PEPPER_DENSITY                   3375L
+#define M_AUG_NOISE_MULTIPLICATIVE_STDDEV                 3376L
+#define M_AUG_NOISE_GAUSSIAN_ADDITIVE_STDDEV              3377L
+#define M_AUG_INTENSITY_MULTIPLY_VALUE                    3365L
+#define M_AUG_INTENSITY_ADD_VALUE                         3366L
+#define M_AUG_GAMMA_VALUE_BAND_0                          3367L
+#define M_AUG_GAMMA_VALUE_BAND_1                          3369L
+#define M_AUG_GAMMA_VALUE_BAND_2                          3371L
+
+#define M_AUG_SEED_USED                                   3423L 
+
+
+/* Result vectors */
+#define M_AUG_OPERATIONS_ENABLED                          3291L
+#define M_AUG_OPERATIONS_APPLIED                          3292L
+#define M_AUG_OPERATION_RESULT_TYPES                      3293L
+#define M_AUG_OPERATION_RESULT_VALUES                     3294L
+#define M_AUG_OPERATION_ASSOCIATED_WITH_RESULT_TYPES      3295L
+#define M_AUG_REVERSE_TRANSFORMATION_MATRIX               3399L 
+
+
+
+/************************************************************************/
+/* MimGetResultSingle()                                                 */
+/************************************************************************/
+#define M_WAVELET_COEFFICIENTS_IMAGE_ID               1850L
+#define M_WAVELET_LEVEL_SIZE_X                        1798L
+#define M_WAVELET_LEVEL_SIZE_Y                        1799L
+#define M_WAVELET_LEVEL_PADDING_OFFSET_X              1866L
+#define M_WAVELET_LEVEL_PADDING_OFFSET_Y              1867L
+#define M_PREDEFINED                                  1967L
+#define M_COMPLEX                                     1968L
+
+#define M_HORIZONTAL_LEVEL_TAG                        0x01000000L
+#define M_HORIZONTAL_LEVEL(a)                         (M_HORIZONTAL_LEVEL_TAG + (a))
+#define M_VERTICAL_LEVEL_TAG                          0x02000000L
+#define M_VERTICAL_LEVEL(a)                           (M_VERTICAL_LEVEL_TAG + (a))
+#define M_DIAGONAL_LEVEL_TAG                          0x04000000L
+#define M_DIAGONAL_LEVEL(a)                           (M_DIAGONAL_LEVEL_TAG + (a))
+#define M_APPROXIMATION                               0x08000000L
+
+/************************************************************************/
+/* MimGetResult2d()/MimStatMultiple                                     */
+/************************************************************************/
+#define M_MAX                                         0x04000000L    //Already defined elsewhere
+#define M_MAX_ABS                                     0x00800000L    //Already defined elsewhere
+#define M_MEAN                                        0x08000000L    //Already defined elsewhere
+#define M_MIN                                         0x02000000L    //Already defined elsewhere
+#define M_MIN_ABS                                     0x00200000L    //Already defined elsewhere
+#define M_STANDARD_DEVIATION                          0x10000000L    //Already defined elsewhere
+#define M_SUM                                         0x00004000L    //Already defined elsewhere
+#define M_SUM_ABS                                     0x00000008L    //Already defined elsewhere
+#define M_SUM_OF_SQUARES                              0x00000400L    //Already defined elsewhere
+
+/************************************************************************/
+/* MimControl()/MimInquire()                                            */
+/************************************************************************/
+#define M_IN_IM_CONTROL_MIL_ID_RANGE(X)               ((X) == M_DARK_IMAGE || \
+                                                       (X) == M_OFFSET_IMAGE || \
+                                                       (X) == M_FLAT_IMAGE || \
+                                                       (X) == M_DEAD_PIXELS || \
+                                                       (X) == M_MODEL_IMAGE || \
+                                                       (X) == M_MASK_IMAGE)
+
+
+// To avoid eventual clashes with M_TYPE_XXX, we must use the mask before checking the value itself.
+#define M_MASK_MIM_INQUIRE_TYPE                       0x0001FFFF
+#define M_RESULT_SIZE                                 0L
+#define M_RESULT_TYPE                                 1L
+#define M_DEINTERLACE_TYPE                            2L
+#define M_DISCARD_FIELD                               3L
+#define M_FIRST_FIELD                                 4L
+#define M_MOTION_DETECT_NUM_FRAMES                    5L
+#define M_MOTION_DETECT_THRESHOLD                     6L
+#define M_MOTION_DETECT_REFERENCE_FRAME               7L
+#define M_MOTION_DETECT_OUTPUT                        8L
+#define M_SOURCE_FIRST_IMAGE                          9L
+#define M_SOURCE_START_IMAGE                          M_SOURCE_FIRST_IMAGE
+#if OldDefinesSupport
+#define M_EXTENDED_CONTEXT_TYPE                       10L
+MIL_DEPRECATED(M_EXTENDED_CONTEXT_TYPE, 1010)
+#endif
+#define M_EXTENDED_CONTEXT_TYPE_DEPRECATED            10L
+#define M_EXTENDED_RESULT_TYPE                        11L
+#define M_INTERNAL_CONTEXT_TYPE                       2906L
+#define M_ASSOCIATED_CONTEXT_TYPE                     2968L
+
+// Inquire and control types for M_FLAT_FIELD_CONTEXT.
+#define M_DARK_IMAGE                                  200L
+#define M_OFFSET_IMAGE                                201L
+#define M_FLAT_IMAGE                                  202L
+
+#define M_DARK_CONST                                  203L
+#define M_OFFSET_CONST                                204L
+#define M_FLAT_CONST                                  205L
+#define M_GAIN_CONST                                  206L
+
+#define M_DARK_IMAGE_NB_BANDS                         207L
+#define M_DARK_IMAGE_WIDTH                            208L
+#define M_DARK_IMAGE_HEIGHT                           209L
+#define M_DARK_IMAGE_TYPE                             210L
+
+#define M_OFFSET_IMAGE_NB_BANDS                       212L
+#define M_OFFSET_IMAGE_WIDTH                          213L
+#define M_OFFSET_IMAGE_HEIGHT                         214L
+#define M_OFFSET_IMAGE_TYPE                           215L
+
+#define M_FLAT_IMAGE_NB_BANDS                         217L
+#define M_FLAT_IMAGE_WIDTH                            218L
+#define M_FLAT_IMAGE_HEIGHT                           219L
+#define M_FLAT_IMAGE_TYPE                             220L
+
+#define M_EFFECTIVE_GAIN_CONST                        221L
+
+#define M_INVALID_CONST                               0x40000000L
+
+// Inquire and control types for M_REARRANGE_CONTEXT.
+#define M_X_SOURCE                                    300L
+#define M_Y_SOURCE                                    301L
+#define M_XY_SOURCE                                   302L
+#define M_X_DESTINATION                               303L
+#define M_Y_DESTINATION                               304L
+#define M_XY_DESTINATION                              305L
+#define M_X_SIZE                                      306L
+#define M_Y_SIZE                                      307L
+#define M_XY_SIZE                                     308L
+
+#define M_X_SOURCE_ARRAY_SIZE                         309L
+#define M_Y_SOURCE_ARRAY_SIZE                         310L
+#define M_XY_SOURCE_ARRAY_SIZE                        311L
+#define M_X_DESTINATION_ARRAY_SIZE                    312L
+#define M_Y_DESTINATION_ARRAY_SIZE                    313L
+#define M_XY_DESTINATION_ARRAY_SIZE                   314L
+#define M_X_SIZE_ARRAY_SIZE                           315L
+#define M_Y_SIZE_ARRAY_SIZE                           316L
+#define M_XY_SIZE_ARRAY_SIZE                          317L
+
+// Inquire and control types for M_DEAD_PIXEL_CONTEXT.
+#define M_DEAD_PIXELS                                 80L
+#define M_X_DEAD_PIXELS                               81L
+#define M_Y_DEAD_PIXELS                               82L
+#define M_XY_DEAD_PIXELS                              83L
+
+#define M_X_DEAD_PIXELS_ARRAY_SIZE                    84L
+#define M_Y_DEAD_PIXELS_ARRAY_SIZE                    85L
+#define M_XY_DEAD_PIXELS_ARRAY_SIZE                   86L
+#define M_DEAD_PIXELS_IMAGE_NB_BANDS                  87L      //Inquire only
+#define M_DEAD_PIXELS_IMAGE_WIDTH                     88L      //Inquire only
+#define M_DEAD_PIXELS_IMAGE_HEIGHT                    89L      //Inquire only
+#define M_DEAD_PIXELS_IMAGE_TYPE                      91L      //Inquire only
+#define M_DEAD_PIXELS_IMAGE_ATTRIBUTE                 92L      //Inquire only
+
+
+// Inquire and control types for M_STAT_MULTIPLE_CONTEXT.
+#define M_TYPE                                        1008L    //Already defined elsewhere
+#define M_SIZE_X                                      1536L    //Already defined elsewhere
+#define M_SIZE_Y                                      1537L    //Already defined elsewhere
+#define M_2D                                          90L
+//See MimStat for M_TYPE possible values.
+
+// Inquire and control types for M_MATCH_CONTEXT.
+#define M_MODEL_IMAGE                                 1019L
+#define M_MASK_IMAGE                                  1020L       //Already defined in milreg.h
+#define M_MAX_SCORE                                   100L
+#define M_SCORE_TYPE                                  37L         //Already defined elsewhere
+#define M_MODEL_STEP                                  33L         //Already defined elsewhere
+#define M_MODE                                        103L        //Already defined elsewhere
+#define M_CORRELATE_NORMALIZED                        1L          //Mode value.
+#define M_CORRELATE                                   2L          //Mode value.
+#define M_ABS_SUM_OF_DIFFERENCES                      3L          //Mode value.
+#define M_MAX_DEPTH                                   MIL_MAKE_CONST(0xFFFFFFFF, 0x00000000FFFFFFFF)  //M_MAX_SCORE value.
+#define M_NORM                                        4000L       //Already defined elsewhere, ScoreType value.
+#define M_SQR_NORM                                    4001L       //Already defined elsewhere, ScoreType value.
+#define M_NORM_CLIP                                   4002L       //ScoreType value.
+#define M_NORM_CLIP_SQR                               4003L       //ScoreType value.
+
+#define M_MODEL_IMAGE_NB_BANDS                        105L        //Inquire only
+#define M_MODEL_IMAGE_WIDTH                           106L        //Inquire only
+#define M_MODEL_IMAGE_HEIGHT                          107L        //Inquire only
+#define M_MODEL_IMAGE_TYPE                            108L        //Inquire only
+#define M_MODEL_IMAGE_ATTRIBUTE                       109L        //Inquire only
+
+#define M_MASK_IMAGE_NB_BANDS                         110L        //Inquire only
+#define M_MASK_IMAGE_WIDTH                            111L        //Inquire only
+#define M_MASK_IMAGE_HEIGHT                           112L        //Inquire only
+#define M_MASK_IMAGE_TYPE                             113L        //Inquire only
+#define M_MASK_IMAGE_ATTRIBUTE                        114L        //Inquire only
+
+
+// Inquire and control types for M_WAVELET_TRANSFORM_CONTEXT.
+#define M_WAVELET_TYPE                                1802L
+#define M_CUSTOM                                      2           //WaveletType value
+#define M_DAUBECHIES_1                                3L          //WaveletType value
+#define M_DAUBECHIES_2                                4L          //WaveletType value
+#define M_DAUBECHIES_3                                5L          //WaveletType value
+#define M_DAUBECHIES_4                                6L          //WaveletType value
+#define M_DAUBECHIES_5                                7L          //WaveletType value
+#define M_DAUBECHIES_6                                8L          //WaveletType value
+#define M_DAUBECHIES_7                                9L          //WaveletType value
+#define M_DAUBECHIES_8                                10L         //WaveletType value
+#define M_DAUBECHIES_3_COMPLEX                        11L         //WaveletType value
+#define M_DAUBECHIES_5_COMPLEX                        12L         //WaveletType value
+#define M_DAUBECHIES_7_COMPLEX                        13L         //WaveletType value
+#define M_SYMLET_1                                    14L         //WaveletType value
+#define M_SYMLET_2                                    15L         //WaveletType value
+#define M_SYMLET_3                                    16L         //WaveletType value
+#define M_SYMLET_4                                    17L         //WaveletType value
+#define M_SYMLET_5                                    18L         //WaveletType value
+#define M_SYMLET_6                                    19L         //WaveletType value
+#define M_SYMLET_7                                    20L         //WaveletType value
+#define M_SYMLET_8                                    21L         //WaveletType value
+#define M_HAAR                                        1L          //WaveletType value
+#define M_TRANSFORMATION_MODE                         1824L
+#define M_DYADIC                                      1825L       //DecompositionMode value
+#define M_UNDECIMATED                                 1826L       //DecompositionMode value
+#define M_FILTER_FORWARD_LOW_PASS_ID                  1820L       // MimWaveletSetFilter
+#define M_FILTER_REVERSE_LOW_PASS_ID                  1821L       // MimWaveletSetFilter
+#define M_FILTER_FORWARD_HIGH_PASS_ID                 1822L       // MimWaveletSetFilter
+#define M_FILTER_REVERSE_HIGH_PASS_ID                 1823L       // MimWaveletSetFilter
+#define M_WAVELET_VALIDITY                            1827L       // MimInquire
+#define M_WAVELET_CONTEXT_TYPE                        1828L       // MimInquire
+#define M_REAL_PART                                   0x1000L     // MimInquire
+#define M_IMAGINARY_PART                              0x2000L     // MimInquire
+
+// Inquire and control types for M_FIND_ORIENTATION_CONTEXT.
+#define M_INTERPOLATION_MODE                          3018L       //Defined in mildisplay.h
+#define M_FREQUENCY_CUTOFF_RATIO_LOW                  1830L        //Low frequency cut off
+#define M_FREQUENCY_CUTOFF_RATIO_HIGH                 1831L        //High frequency cut off
+#define M_CLIP_CENTER                                 106L        //Mode value
+#define M_RESIZE_DOWN                                 107L        //Mode value
+#define M_RESIZE_UP                                   108L        //Mode value
+#define M_CENTERED_WINDOW                             (M_PSEUDO_ID | 0x40)
+#define M_SCORE                                       0x00001400L  //Defined in milgab.h
+#define M_BORDER_ATTENUATION                          109L
+
+// Inquire and control types for M_HISTOGRAM_EQUALIZE_ADAPTIVE_CONTEXT.
+#define M_NUMBER_OF_TILES_X                           250L        // Number of tiles in X
+#define M_NUMBER_OF_TILES_Y                           251L        // Number of tiles in Y
+#define M_CLIP_LIMIT                                  252L        // Mormalized clip limit.
+#define M_HIST_SIZE                                   253L        // Number of histogram bins.
+#define M_ACCORDING_TO_SOURCE                         -1L         // Number of bin determine from source range.
+#define M_OPERATION                                   M_METHOD    // Already defined elsewhere. Histogram equalization distrition.
+#define M_UNIFORM                                     1           // Already defined elsewhere
+#define M_EXPONENTIAL                                 2           // Already defined elsewhere
+#define M_RAYLEIGH                                    3           // Already defined elsewhere
+#define M_HYPER_CUBE_ROOT                             4           // Already defined elsewhere
+#define M_HYPER_LOG                                   5           // Already defined elsewhere
+#define M_ALPHA_VALUE                                 5278L       // Already defined elsewhere
+
+
+// Inquire and control types for M_LOCATE_PEAK_1D_CONTEXT.
+#define M_SCAN_LANE_DIRECTION                         1
+#define M_PEAK_VALUE_MODE                             2
+#define M_PEAK_INTENSITY_MODE                         3
+#define M_NUMBER_OF_PEAKS                             4
+#define M_SORT_CRITERION                              5
+#define M_PEAK_WIDTH_NOMINAL                          6
+#define M_PEAK_WIDTH_DELTA                            7
+#define M_FRAME_SIZE                                  8
+#define M_FULL_SIZE                                   0L          // Already defined in mildisplay.h
+#define M_SELECT_PEAK(a,b)  ((MIL_INT64)((MIL_UINT64)(a) << 32 | (MIL_UINT64)(b)))
+
+//Common to many objects.
+#define M_MODE                                        103L
+
+// Already defined in another header file.
+#define M_LINES                                       0x00000080L
+
+#define M_RECTS                                       0x00000100L
+
+#define M_AVERAGE                                     0x00000020L
+#define M_DISCARD                                     0x00000021L
+#define M_BOB                                         0x00000022L
+#define M_ADAPTIVE_AVERAGE                            0x00000023L
+#define M_ADAPTIVE_DISCARD                            0x00000024L
+#define M_ADAPTIVE_BOB                                0x00000025L
+#define M_ADAPTATIVE_AVERAGE                          M_ADAPTIVE_AVERAGE
+#define M_ADAPTATIVE_DISCARD                          M_ADAPTIVE_DISCARD
+#define M_ADAPTATIVE_BOB                              M_ADAPTIVE_BOB
+#define M_ODD_FIELD                                   1L
+#define M_EVEN_FIELD                                  2L
+#define M_FIRST_FRAME                                 0x40000001L
+#define M_CENTER_FRAME                                0x40000002L
+#define M_LAST_FRAME                                  0x40000003L
+#define M_RESULT_OUTPUT_UNITS 	                     1300L
+#define M_NUMBER_OF_FRAMES                            1080L
+
+// Control values for M_RESULT_OUTPUT_UNITS
+#define M_PIXEL                              0x1000L
+#define M_WORLD                              0x2000L
+#define M_ACCORDING_TO_CALIBRATION             1301L
+
+// Control for M_HIST_LIST
+#define  M_HIST_BIN_SIZE_MODE                            400L        // ControlType to specify binning mode.
+#define  M_REGULAR                                       0x00020000L // Define elsewhere. Default mode used before, with no binning and
+// just ignore values that don't fit in the size of the result.
+#define  M_FIT_SRC_RANGE                                 0x01        // Use the size as the number of bin and a simple algo for indexing.
+#define  M_FIT_SRC_DATA                                  0x02        // Use the size as the number of bin and a simple algo for indexing.
+#define  M_FREEDMAN                                      0x03        // MIL automaticly determine optimal bin size/number of bin using Freedman algorithm.
+#define  M_HIST_SMOOTHING_ITERATIONS                     401L        // Number of smoothing pass to do as post processing.
+
+// Inquire and control types for M_LINEAR_FILTER_IIR_CONTEXT.
+#define M_FILTER_TYPE                           1046L                               // Already defined in miledge.h, milmeas.h
+#define M_SHEN                                  0x802L                              // FilterType value.
+#define M_DERICHE                               M_ID_OFFSET_OF_DEFAULT_KERNEL + 10L // FilterType value. Already defined in miledge.h
+#define M_VLIET                                 0x803L                              // FilterType value.
+
+#define M_SMOOTHNESS                            108L                                // Already defined in    milmod.h, milmeas.h
+#define M_FILTER_SMOOTHNESS                     M_SMOOTHNESS                        // Already defined in    milmeas.h
+
+#define M_FILTER_SMOOTHNESS_TYPE                2842L
+#define M_NORMALIZED                            0x00000002L                         // Smoothness type value.
+#define M_NATIVE                                0x00000003L                         // Smoothness type value.
+
+#define M_FILTER_RESPONSE_TYPE                  2843L
+#define M_SLOPE                                 2844L                               // Response type value.
+#define M_STEP                                  2845L                               // Response type value.
+
+#define M_FILTER_ASPECT_RATIO                   2846L
+
+#define M_FILTER_DEFAULT_SHARPEN_PARAM          4056L
+
+
+/************************************************************************/
+/* MimFindExtreme()                                                     */
+/************************************************************************/
+#define M_MIN_VALUE                                   MAKE_INT64(0x0000010000000000)
+#define M_MAX_VALUE                                   MAKE_INT64(0x0000020000000000)
+#define M_MIN_ABS_VALUE                               4L
+#define M_MAX_ABS_VALUE                               8L
+
+/************************************************************************/
+/* MimStat()                                                            */
+/************************************************************************/
+#define M_MIN_ABS                                     0x00200000L    //Already defined elsewhere
+#define M_MAX_ABS                                     0x00800000L    //Already defined elsewhere
+#define M_SUM_ABS                                     0x00000008L    //Already defined elsewhere
+#define M_SUM_OF_SQUARES                              0x00000400L    //Already defined elsewhere
+#define M_SUM                                         0x00004000L    //Already defined in milocr.h
+#define M_MEAN                                        0x08000000L    //Already defined in milmeas.h
+#define M_STANDARD_DEVIATION                          0x10000000L    //Already defined in milmeas.h
+#define M_NUMBER                                      1009L          // Already defined elsewhere 0x000003F1
+#define M_ANGULAR_DATA_MEAN                           0x00000004L
+#define M_ANGULAR_DATA_COHERENCE                      0x00000800L
+#define M_ORIENTATION_DATA_MEAN                       0x00001000L
+#define M_ORIENTATION_DATA_COHERENCE                  0x00002000L
+
+/************************************************************************/
+/* MimStatCalculate()                                                            */
+/************************************************************************/
+#define M_STAT_TYPE                                   2149
+#define M_GLCM_STAT_TYPE                              2150
+#define M_GLCM_PAIR_OFFSET_X                          2151
+#define M_GLCM_PAIR_OFFSET_Y                          2152
+#define M_STEP_SIZE_X                                 2153
+#define M_STEP_SIZE_Y                                 2160
+#define M_GLCM_QUANTIFICATION                         2161
+#define M_STAT_GLCM_DISSIMILARITY                     2162
+#define M_STAT_GLCM_ENERGY                            2163
+#define M_STAT_GLCM_ENTROPY                           2164
+#define M_STAT_GLCM_HOMOGENEITY                       2165
+#define M_CONDITION                                   2167
+#define M_COND_LOW                                    2168
+#define M_COND_HIGH                                   2172
+#define M_STAT_GLCM_CORRELATION                       2173
+#define M_STAT_GLCM_CONTRAST                          2174
+
+/* These defines preserve the values of their non-prefixed counterpart where possible. */
+#define M_STAT_MIN                                         2502
+#define M_STAT_MAX                                         2503
+#define M_STAT_MIN_ABS                                     2504
+#define M_STAT_MAX_ABS                                     2505
+#define M_STAT_SUM_ABS                                     2506
+#define M_STAT_SUM_OF_SQUARES                              2507
+#define M_STAT_SUM                                         2508
+#define M_STAT_MEAN                                        2509
+#define M_STAT_STANDARD_DEVIATION                          2510
+#define M_STAT_NUMBER                                      1009L       // Same as M_NUMBER
+#define M_STAT_ANGULAR_DATA_MEAN                           2511
+#define M_STAT_ANGULAR_DATA_COHERENCE                      2512
+#define M_STAT_ORIENTATION_DATA_MEAN                       2513
+#define M_STAT_ORIENTATION_DATA_COHERENCE                  2514
+
+/************************************************************************/
+/* MimArith()                                                           */
+/************************************************************************/
+#define M_CONSTANT                                    0x8000L
+#define M_FIXED_POINT                                 0x00004000L
+#define M_FLOAT_PROC                                  0x40000000L
+#define M_LOGICAL                                     0x08000000L
+#define M_SOURCE_VALUE                                0x00010000L
+#define M_ADD                                         0x0000L
+#define M_ADD_CONST                                   (M_ADD | M_CONSTANT)
+#define M_SUB                                         0x0001L
+#define M_SUB_CONST                                   (M_SUB | M_CONSTANT)
+#define M_NEG_SUB                                     0x000AL
+#define M_CONST_SUB                                   (M_NEG_SUB | M_CONSTANT)
+#define M_SUB_ABS                                     0x0011L
+#define M_SUB_CONST_ABS                               (M_SUB_ABS | M_CONSTANT)
+#define M_MIN                                         0x02000000L
+#define M_MIN_CONST                                   (M_MIN | M_CONSTANT)
+#define M_MAX                                         0x04000000L
+#define M_MAX_CONST                                   (M_MAX | M_CONSTANT)
+#define M_OR                                          0x0016L
+#define M_OR_CONST                                    (M_OR  | M_CONSTANT)
+#define M_AND                                         0x0017L
+#define M_AND_CONST                                   (M_AND | M_CONSTANT)
+#define M_XOR                                         0x0018L
+#define M_XOR_CONST                                   (M_XOR | M_CONSTANT)
+#define M_NOR                                         0x0019L
+#define M_NOR_CONST                                   (M_NOR | M_CONSTANT)
+#define M_NAND                                        0x001AL
+#define M_NAND_CONST                                  (M_NAND | M_CONSTANT)
+#define M_XNOR                                        0x001BL
+#define M_XNOR_CONST                                  (M_XNOR | M_CONSTANT)
+#define M_NOT                                         0x0014L
+#define M_NEG                                         0x0023L
+#define M_ABS                                         0x000CL
+#define M_PASS                                        0x0002L
+#define M_CONST_PASS                                  (M_PASS | M_CONSTANT)
+#define M_MULT                                        0x0100L
+#define M_MULT_CONST                                  (M_MULT | M_CONSTANT)
+#define M_DIV                                         0x0101L
+#define M_DIV_CONST                                   (M_DIV | M_CONSTANT)
+#define M_INV_DIV                                     0x0102L
+#define M_CONST_DIV                                   (M_INV_DIV | M_CONSTANT)
+#define M_SQRT                                        0x0103L
+#define M_SQUARE_ROOT                                 M_SQRT
+#define M_SQUARE                                      0x00000020L // Already defined in milmod.h
+#define M_CUBE                                        0x0104L
+#define M_LN                                          0x0105L
+#define M_LOG10                                       0x0106L
+#define M_LOG2                                        0x0107L
+#define M_EXP_CONST                                   0x0108L
+#define M_CONST_EXP                                   0x0109L
+#define M_EXP                                         0x010AL     // Also defined in mil.h for MgenLutFunction
+#define M_LOG_CONST                                   0x010BL
+#define M_CONST_LOG                                   0x010CL
+#define M_LOG                                         0x010DL     // Also defined in mil.h for MgenLutFunction
+#define M_ATAN2                                       0x010EL
+#define M_INTEGRAL                                    0x010FL
+#define M_AVG                                         0x0110L
+#define M_ABS_SUB                                     0x0111L
+#define M_MIN_ABS                                     0x00200000L // Already defined elsewhere
+#define M_MAX_ABS                                     0x00800000L // Already defined elsewhere
+
+// Note that those are valid only with M_LOGICAL, avoiding conflict with other flags.
+#define M_EQUAL                                       3L
+#define M_NOT_EQUAL                                   4L
+#define M_GREATER                                     5L
+#define M_LESS                                        6L
+#define M_GREATER_OR_EQUAL                            7L
+#define M_LESS_OR_EQUAL                               8L
+
+#define M_EQUAL_CONST                                 (M_EQUAL | M_CONSTANT)
+#define M_NOT_EQUAL_CONST                             (M_NOT_EQUAL | M_CONSTANT)
+#define M_GREATER_CONST                               (M_GREATER | M_CONSTANT)
+#define M_LESS_CONST                                  (M_LESS | M_CONSTANT)
+#define M_GREATER_OR_EQUAL_CONST                      (M_GREATER_OR_EQUAL | M_CONSTANT)
+#define M_LESS_OR_EQUAL_CONST                         (M_LESS_OR_EQUAL | M_CONSTANT)
+
+/************************************************************************/
+/* MimArithMultiple()                                                   */
+/************************************************************************/
+#define M_OFFSET_GAIN                                 0x0000L
+#define M_WEIGHTED_AVERAGE                            0x0001L
+#define M_MULTIPLY_ACCUMULATE_1                       0x0002L
+#define M_MULTIPLY_ACCUMULATE_2                       0x0004L
+
+/************************************************************************/
+/* MimFlip()                                                            */
+/************************************************************************/
+#define M_FLIP_VERTICAL                               1L
+#define M_FLIP_HORIZONTAL                             2L
+
+/************************************************************************/
+/* MimBinarize(), MimClip(), MimLocateEvent(), MimStat()                */
+/* Some of these defines are also define in milutil.h                   */
+/************************************************************************/
+#define M_IN_RANGE                                    1L
+#define M_OUT_RANGE                                   2L
+#define M_EQUAL                                       3L
+#define M_NOT_EQUAL                                   4L
+#define M_GREATER                                     5L
+#define M_LESS                                        6L
+#define M_GREATER_OR_EQUAL                            7L
+#define M_LESS_OR_EQUAL                               8L
+#define M_MASK                                        0x00001000L
+#define M_ALL                                         0x40000000L
+
+/************************************************************************/
+/* These flags are specific to MimLocateEvent()                         */
+/************************************************************************/
+
+//The encoding for extremum mode is done on 11 bits, with the 8 lower bits
+//indicating we use > or >= (0 or 1) for a specific neighbor, the bit 8 is used
+//to select minimum or maximum (0 or 1) and bit 9 for the special case strickly
+//greater than any one and greater or equal to all others. Bit 10 is indicating
+//that one mode is selected. Note that for the neighbor position, we use the
+//same convention than MimConnectMap.
+// n3 n2 n1
+// n4 X  n0
+// n5 n6 n7
+#define M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT      17L                                             // =utilities=
+#define M_LOCAL_MAX_NOT_STRICT                  (0x05FFL << M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT) //Greater or equal to all
+#define M_LOCAL_MAX_STRICT_MEDIUM               (0x0587L << M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT) //Greater right
+#define M_LOCAL_MIN_NOT_STRICT                  (0x04FFL << M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT) //Less or equal to all
+#define M_LOCAL_MIN_STRICT_MEDIUM               (0x0487L << M_LOCATE_EVENT_EXTREMUM_MODE_SHIFT) //Less right
+
+/************************************************************************/
+/* MimBinarize()                                                        */
+/************************************************************************/
+// reserve bits 4-7 to the binarization method
+#define M_BINARIZATION_METHOD_MASK                    0x0F0L
+//#define M_PERCENTILE_VALUE                            0x10L // already defined at the beginning of the file
+#define M_TRIANGLE_BISECTION_DARK                     0x20L
+#define M_TRIANGLE_BISECTION_BRIGHT                   0x30L
+#define M_BIMODAL                                     0x40L
+#define M_FIXED                                       0x50L
+#define M_DISCRETE_RANGE                              0x1000L
+#define M_RETURN_VALUE_AS_FLOAT_IN_INT                0x2000L
+
+/************************************************************************/
+/* MimConvolve()                                                        */
+/************************************************************************/
+#define M_ID_OFFSET_OF_DEFAULT_KERNEL                 (0x00100000L|M_PSEUDO_ID)
+#define M_ID_OFFSET_OF_EDGE_DETECTVAR                 (0x00100100L|M_PSEUDO_ID)
+
+#define M_SMOOTH                                      (M_ID_OFFSET_OF_DEFAULT_KERNEL +  0L)
+#define M_LAPLACIAN_EDGE                              (M_ID_OFFSET_OF_DEFAULT_KERNEL +  1L)
+#define M_LAPLACIAN_EDGE2                             (M_ID_OFFSET_OF_DEFAULT_KERNEL +  2L)
+#define M_SHARPEN                                     (M_ID_OFFSET_OF_DEFAULT_KERNEL +  3L)
+#define M_SHARPEN2                                    (M_ID_OFFSET_OF_DEFAULT_KERNEL +  4L)
+#define M_HORIZ_EDGE                                  (M_ID_OFFSET_OF_DEFAULT_KERNEL +  5L)
+#define M_VERT_EDGE                                   (M_ID_OFFSET_OF_DEFAULT_KERNEL +  6L)
+#define M_EDGE_DETECT                                 (M_ID_OFFSET_OF_DEFAULT_KERNEL +  7L)
+#define M_EDGE_DETECT2                                (M_ID_OFFSET_OF_DEFAULT_KERNEL +  8L)
+#define M_EDGE_DETECT_SQR                             (M_ID_OFFSET_OF_DEFAULT_KERNEL +  9L)
+#define M_FIRST_DERIVATIVE_X                          (M_ID_OFFSET_OF_DEFAULT_KERNEL + 10L)
+#define M_FIRST_DERIVATIVE_Y                          (M_ID_OFFSET_OF_DEFAULT_KERNEL + 11L)
+#define M_SECOND_DERIVATIVE_X                         (M_ID_OFFSET_OF_DEFAULT_KERNEL + 12L)
+#define M_SECOND_DERIVATIVE_Y                         (M_ID_OFFSET_OF_DEFAULT_KERNEL + 13L)
+#define M_SECOND_DERIVATIVE_XY                        (M_ID_OFFSET_OF_DEFAULT_KERNEL + 14L)
+#define M_HORIZONTAL_EDGE_SOBEL                       (M_ID_OFFSET_OF_DEFAULT_KERNEL + 15L)
+#define M_VERTICAL_EDGE_SOBEL                         (M_ID_OFFSET_OF_DEFAULT_KERNEL + 16L)
+#define M_HORIZONTAL_EDGE_PREWITT                     (M_ID_OFFSET_OF_DEFAULT_KERNEL + 17L)
+#define M_VERTICAL_EDGE_PREWITT                       (M_ID_OFFSET_OF_DEFAULT_KERNEL + 18L)
+#define M_SOBEL_X                                     (M_ID_OFFSET_OF_DEFAULT_KERNEL + 19L)
+#define M_SOBEL_Y                                     (M_ID_OFFSET_OF_DEFAULT_KERNEL + 20L)
+#define M_PREWITT_X                                   (M_ID_OFFSET_OF_DEFAULT_KERNEL + 21L)
+#define M_PREWITT_Y                                   (M_ID_OFFSET_OF_DEFAULT_KERNEL + 22L)
+#define M_LAPLACIAN_ISO_8                             (M_ID_OFFSET_OF_DEFAULT_KERNEL + 23L)
+#define M_EDGE_DETECTVAR(Val)                         (M_ID_OFFSET_OF_EDGE_DETECTVAR + Val)
+
+#define M_EDGE_DETECT_SOBEL_FAST                      M_EDGE_DETECT
+#define M_EDGE_DETECT_PREWITT_FAST                    M_EDGE_DETECT2
+#define M_LAPLACIAN_4                                 M_LAPLACIAN_EDGE
+#define M_LAPLACIAN_8                                 M_LAPLACIAN_EDGE2
+#define M_SHARPEN_4                                   M_SHARPEN2
+#define M_SHARPEN_8                                   M_SHARPEN
+
+#define M_OVERSCAN_ENABLE                             0x00008000L
+#define M_OVERSCAN_DISABLE                            0x00080000L
+#define M_OVERSCAN_FAST                               0x00040000L
+
+#if OldDefinesSupport
+
+#define M_SHEN_PREDEFINED_KERNEL                      (0x10000000L|M_ID_OFFSET_OF_DEFAULT_KERNEL)                                   
+#define M_DERICHE_PREDEFINED_KERNEL                   (0x20000000L|M_ID_OFFSET_OF_DEFAULT_KERNEL)                                   
+#define M_SHEN_PREDEFINED_KERNEL_INVALID_TYPE         (0x01000000L|M_SHEN_PREDEFINED_KERNEL)                                        
+#define M_SHEN_PREDEFINED_KERNEL_INVALID_FACTOR       (0x02000000L|M_SHEN_PREDEFINED_KERNEL)                                        
+#define M_DERICHE_PREDEFINED_KERNEL_INVALID_TYPE      (0x01000000L|M_DERICHE_PREDEFINED_KERNEL)                                     
+#define M_DERICHE_PREDEFINED_KERNEL_INVALID_FACTOR    (0x02000000L|M_DERICHE_PREDEFINED_KERNEL)                                     
+#define M_IS_SHEN_PREDEFINED_KERNEL(KernelId)         (((KernelId) & M_SHEN_PREDEFINED_KERNEL) == M_SHEN_PREDEFINED_KERNEL)         
+#define M_IS_DERICHE_PREDEFINED_KERNEL(KernelId)      (((KernelId) & M_DERICHE_PREDEFINED_KERNEL) == M_DERICHE_PREDEFINED_KERNEL)
+
+#define M_SHEN_FILTER(FilterOperation, FilterSmoothness)  (((((FilterOperation) & M_ID_OFFSET_OF_DEFAULT_KERNEL) != M_ID_OFFSET_OF_DEFAULT_KERNEL) && (FilterOperation!=M_DEFAULT))   ? M_SHEN_PREDEFINED_KERNEL_INVALID_TYPE :   \
+   ((((FilterOperation) & (~(M_ID_OFFSET_OF_DEFAULT_KERNEL | 0xFF))) != 0) && (FilterOperation!=M_DEFAULT))                    ? M_SHEN_PREDEFINED_KERNEL_INVALID_TYPE :   \
+   (((((FilterSmoothness) < 0) || ((FilterSmoothness) > 100))) && (FilterSmoothness!=M_DEFAULT))                               ? M_SHEN_PREDEFINED_KERNEL_INVALID_FACTOR : \
+   M_SHEN_PREDEFINED_KERNEL | ((FilterOperation==M_DEFAULT) ? 0x80 : FilterOperation) | ((FilterSmoothness==M_DEFAULT)?(0xFF00):(((long) FilterSmoothness) << 8))          )
+MIL_DEPRECATED(M_SHEN_FILTER, 1040)       // Use new M_LINEAR_FILTER_IIR_CONTEXT with MimConvolve or MimDerivative instead.
+
+#define M_DERICHE_FILTER(FilterOperation, FilterSmoothness) (((((FilterOperation) & M_ID_OFFSET_OF_DEFAULT_KERNEL) != M_ID_OFFSET_OF_DEFAULT_KERNEL) && (FilterOperation!=M_DEFAULT)) ? M_DERICHE_PREDEFINED_KERNEL_INVALID_TYPE :   \
+   ((((FilterOperation) & (~(M_ID_OFFSET_OF_DEFAULT_KERNEL | 0xFF))) != 0) && (FilterOperation!=M_DEFAULT))                  ? M_DERICHE_PREDEFINED_KERNEL_INVALID_TYPE :   \
+   (((((FilterSmoothness) < 0) || ((FilterSmoothness) > 100))) && (FilterSmoothness!=M_DEFAULT))                             ? M_DERICHE_PREDEFINED_KERNEL_INVALID_FACTOR : \
+   M_DERICHE_PREDEFINED_KERNEL | ((FilterOperation==M_DEFAULT) ? 0x80 : FilterOperation) | ((FilterSmoothness==M_DEFAULT)?(0xFF00):(((long) FilterSmoothness) << 8))        )
+MIL_DEPRECATED(M_DERICHE_FILTER, 1040)    // Use new M_LINEAR_FILTER_IIR_CONTEXT with MimConvolve or MimDerivative instead.
+#endif
+
+/************************************************************************/
+/* MimDifferential()                                                    */
+/************************************************************************/
+#define  M_GAUSSIAN_CURVATURE                         2691L             // Already defined.
+#define  M_GRADIENT                                   3306L
+#define  M_GRADIENT_SQR                               3307L
+#define  M_HESSIAN                                    3308L
+#define  M_JACOBIAN                                   3309L
+#define  M_LAPLACIAN                                  3310L
+#define  M_MEAN_CURVATURE                             2692L             // Already defined.
+#define  M_SHARPEN                                    (M_ID_OFFSET_OF_DEFAULT_KERNEL +  3L)  // Already defined for MimConvolve.
+
+
+/************************************************************************/
+/* MimEdgeDetect()                                                      */
+/************************************************************************/
+#if M_MIL_LITE || MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION
+#define M_SOBEL                                       M_EDGE_DETECT_SOBEL_FAST
+#endif
+#define M_NOT_WRITE_ANGLE                             1L
+#define M_NOT_WRITE_INT                               2L
+#define M_FAST_ANGLE                                  4L
+#define M_FAST_GRADIENT                               8L
+#define M_FAST_EDGE_DETECT                            (M_FAST_ANGLE + M_FAST_GRADIENT)
+#define M_REGULAR_ANGLE                               16L
+#define M_REGULAR_GRADIENT                            64L
+#define M_REGULAR_EDGE_DETECT                         (M_REGULAR_ANGLE + M_REGULAR_GRADIENT)
+#define M_USE_RESERVED_ANGLE_VALUE                    128L
+
+/************************************************************************/
+/* MimRank()                                                            */
+/************************************************************************/
+#define M_MEDIAN                                      0x10000L
+#define M_3X3_RECT                                    (M_ID_OFFSET_OF_DEFAULT_KERNEL + 20L)
+#define M_3X3_CROSS                                   (M_ID_OFFSET_OF_DEFAULT_KERNEL + 21L)
+#define M_5X5_RECT                                    (M_ID_OFFSET_OF_DEFAULT_KERNEL + 30L)
+
+/************************************************************************/
+/* MimMorphic(), ...                                                    */
+/************************************************************************/
+#define M_ERODE                                       1L
+#define M_DILATE                                      2L
+#define M_THIN                                        3L
+#define M_THICK                                       4L
+#define M_HIT_OR_MISS                                 5L
+#define M_MATCH                                       6L
+#define M_AREA_OPEN                                   7L
+#define M_AREA_CLOSE                                  8L
+#define M_TOP_HAT                                     9L
+#define M_BOTTOM_HAT                                 10L
+#define M_LEVEL                                      11L
+
+// These flags are already defined elsewhere. We use the same values here.
+#define M_OPEN                                       0x00000010L
+#define M_CLOSE                                      0x00000020L
+
+/************************************************************************/
+/* MimErode()                                                           */
+/************************************************************************/
+#define M_BINARY_ULTIMATE                             1L
+#define M_BINARY_ULTIMATE_ACCUMULATE                  2460L
+
+/************************************************************************/
+/* MimThin()                                                            */
+/************************************************************************/
+#define M_TO_SKELETON                                -1L
+#define M_BINARY2                                     1L
+#define M_BINARY3                                     2L
+#define M_OVERSCAN_REPLACE_MAX                        0x10
+#define M_OVERSCAN_REPLACE_MIN                        0x20
+
+/************************************************************************/
+/* MimThick()                                                           */
+/************************************************************************/
+#define M_TO_IDEMPOTENCE                              M_TO_SKELETON
+
+/************************************************************************/
+/* MimDistance()                                                        */
+/************************************************************************/
+#define M_CHAMFER_3_4                                 0x01
+#define M_CITY_BLOCK                                  0x02
+#define M_CHESSBOARD                                  0x04
+#define M_FORWARD                                     0x01
+#define M_BACKWARD                                    0x02
+#define M_OVERSCAN_TO_DO                              0x04
+#define M_BOTH                                        0x07
+
+/************************************************************************/
+/* MimWatershed()                                                        */
+/************************************************************************/
+#define M_WATERSHED                                   0x0001
+#define M_BASIN                                       0x0002
+#define M_MINIMA_FILL                                 0x0004
+#define M_MAXIMA_FILL                                 0x0008
+
+#define M_4_CONNECTED                                 0x00000010L
+#define M_8_CONNECTED                                 0x00000020L
+#define M_REGULAR                                     0x00020000L
+#define M_STRAIGHT_WATERSHED                          0x0080
+#define M_SKIP_LAST_LEVEL                             0x0100
+#define M_FILL_SOURCE                                 0x0200
+#define M_LABELLED_MARKER                             0x0400
+#define M_LABELED_MARKER                              M_LABELLED_MARKER
+
+#define M_METHOD_1                                    0x1000
+#define M_METHOD_2                                    0x2000
+
+#define M_BASIN_4_CONNECTED                           0x4000
+#define M_BASIN_8_CONNECTED                           0x8000
+
+/************************************************************************/
+/* MimProject()                                                         */
+/************************************************************************/
+#define M_0_DEGREE                                      0.0
+#define M_90_DEGREE                                    90.0
+#define M_180_DEGREE                                  180.0
+#define M_270_DEGREE                                  270.0
+
+/************************************************************************/
+/* MimResize(), MimTranslate() and MimRotate()                          */
+/************************************************************************/
+#define M_OVERSCAN_DISABLE                            0x00080000L
+#define M_OVERSCAN_ENABLE                             0x00008000L
+#define M_OVERSCAN_FAST                               0x00040000L
+#define M_INTERPOLATE                                 0x00000004L
+#define M_BILINEAR                                    0x00000008L
+#define M_BICUBIC                                     0x00000010L
+#define M_AVERAGE                                     0x00000020L
+#define M_NEAREST_NEIGHBOR                            0x00000040L
+#define M_OVERSCAN_CLEAR                              0x00000080L
+#define M_FIT_ALL_ANGLE                               0x00000100L
+#define M_BINARY                                      0x00001000L
+#define M_FAST                                        0x00002000L
+#define M_REGULAR                                     0x00020000L
+
+/************************************************************************/
+/* MimResize                                                            */
+/************************************************************************/
+#define M_FILL_DESTINATION                            -1 // DO NOT MODIFY, WITHOUT CODE MODIFICATION
+
+/************************************************************************/
+/* MimHistogramEqualize()                                               */
+/************************************************************************/
+#define M_UNIFORM                                     1
+#define M_EXPONENTIAL                                 2
+#define M_RAYLEIGH                                    3
+#define M_HYPER_CUBE_ROOT                             4
+#define M_HYPER_LOG                                   5
+
+/************************************************************************/
+/* MimConvert()                                                         */
+/************************************************************************/
+#define M_REGULAR                                     0x00020000L
+#define M_FAST                                        0x00002000L
+#define M_MASK                                        0x00001000L
+
+#define M_ID_OFFSET_OF_DEFAULT_CONVERT                (0x00200000L|M_PSEUDO_ID)
+
+#define M_RGB_TO_HSL                                  (M_ID_OFFSET_OF_DEFAULT_CONVERT + 1L)     // Same as Mil.h
+#define M_RGB_TO_HLS                                  M_RGB_TO_HSL                              // Obsolete
+#define M_RGB_TO_L                                    (M_ID_OFFSET_OF_DEFAULT_CONVERT + 2L)     // Same as Mil.h
+#define M_HSL_TO_RGB                                  (M_ID_OFFSET_OF_DEFAULT_CONVERT + 3L)     // Same as Mil.h
+#define M_HLS_TO_RGB                                  M_HSL_TO_RGB                              // Obsolete
+#define M_L_TO_RGB                                    (M_ID_OFFSET_OF_DEFAULT_CONVERT + 4L)     // Same as Mil.h
+#define M_RGB_TO_Y                                    (M_ID_OFFSET_OF_DEFAULT_CONVERT + 5L)     // Same as Mil.h
+#define M_RGB_TO_H                                    (M_ID_OFFSET_OF_DEFAULT_CONVERT + 6L)     // Same as Mil.h
+
+#define M_RGB_TO_YUV16                                (M_ID_OFFSET_OF_DEFAULT_CONVERT + 101L)   // Same as Mil.h
+#define M_YUV16_TO_RGB                                (M_ID_OFFSET_OF_DEFAULT_CONVERT + 301L)   // Same as Mil.h
+#define M_RGB_NORMALIZE                               (M_ID_OFFSET_OF_DEFAULT_CONVERT + 10L)
+#define M_RGB_TO_HSV                                  (M_ID_OFFSET_OF_DEFAULT_CONVERT + 11L)    // Same as Mildev.h
+#define M_HSV_TO_RGB                                  (M_ID_OFFSET_OF_DEFAULT_CONVERT + 12L)    // Same as Mildev.h
+
+#define M_SRGB_LINEAR_TO_LAB                          (M_ID_OFFSET_OF_DEFAULT_CONVERT + 500L)
+#define M_SRGB_TO_LAB                                 (M_ID_OFFSET_OF_DEFAULT_CONVERT + 501L)
+#define M_LAB_TO_SRGB_LINEAR                          (M_ID_OFFSET_OF_DEFAULT_CONVERT + 502L)
+#define M_LAB_TO_SRGB                                 (M_ID_OFFSET_OF_DEFAULT_CONVERT + 503L)
+#define M_SRGB_LINEAR_TO_LCH                          (M_ID_OFFSET_OF_DEFAULT_CONVERT + 504L)
+#define M_SRGB_TO_LCH                                 (M_ID_OFFSET_OF_DEFAULT_CONVERT + 505L)
+#define M_LCH_TO_SRGB_LINEAR                          (M_ID_OFFSET_OF_DEFAULT_CONVERT + 506L)
+#define M_LCH_TO_SRGB                                 (M_ID_OFFSET_OF_DEFAULT_CONVERT + 507L)
+
+#define M_MATRIX_ID(x)                                (x)                                       // Obsolete from MIL 9
+
+// If the conversion type is set to M_DEFAULT, the conversion will be
+//  choosen according to the type of buffers passed to the function.
+#define M_DEFAULT                                    0x10000000L
+
+// These can be added to the conversion type to speed-up the
+//   process ( M_FAST ) or have a better precision ( M_REGULAR ).
+//   Not all conversion are affected by this flag.
+#define M_REGULAR                                     0x00020000L
+#define M_FAST                                        0x00002000L
+
+/************************************************************************/
+/* MimWarp()                                                            */
+/************************************************************************/
+/* 8 bits reserved for number of fractional bits */
+#define M_WARP_MATRIX                                 0x00100000L
+#define M_WARP_POLYNOMIAL                             0x00200000L
+#define M_WARP_LUT                                    0x00400000L
+#define M_OVERSCAN_ENABLE                             0x00008000L
+#define M_OVERSCAN_DISABLE                            0x00080000L
+#define M_OVERSCAN_FAST                               0x00040000L
+#define M_OVERSCAN_CLEAR                              0x00000080L
+#define M_FIXED_POINT                                 0x00004000L
+
+/************************************************************************/
+/* MimTransform()                                                       */
+/************************************************************************/
+#define M_FFT                                         1L
+#define M_DCT8X8                                      2L
+#define M_DCT                                         3L
+#define M_POLAR                                       5L
+
+#define M_FORWARD                                     0x01
+#define M_REVERSE                                     4L
+#define M_NORMALIZED                                  0x00000002L
+#define M_NORMALIZE                                   M_NORMALIZED
+#define M_1D_ROWS                                     0x00000010L
+#define M_1D_COLUMNS                                  0x00000020L
+#define M_REAL                                        0x00000040L
+#define M_CENTER                                      0x00000080L
+#define M_MAGNITUDE                                   0x00000100L
+#define M_PHASE                                       0x00000200L
+#define M_LOG_SCALE                                   0x00000400L
+#define M_FAST_PHASE                                  0x00000800L
+#define M_SQUARE_MAGNITUDE                            0x00001000L
+#define M_NORMALIZE_PHASE                             0x00002000L
+#define M_NORMALIZE_PHASE_255                         0x00008000L
+#define M_CLOCKWISE_PHASE                             0x00010000L
+#define M_USE_CORDIC                                  0x00020000L
+#define M_INTERNAL_FFT_NEW                            0x00000008L
+
+
+/************************************************************************/
+/* MimWaveletTransform()                                                */
+/************************************************************************/
+#define M_FORWARD                                     0x01            // Already defined elsewhere
+#define M_REVERSE                                     4L              // Already defined elsewhere
+#define M_COPY                                        0x00020000L     // Already defined elsewhere
+
+/************************************************************************/
+/* MimWaveletDenoise  ()                                                */
+/************************************************************************/
+#define M_DENOISE_PSEUDO_ID                              (0x00100100L|M_PSEUDO_ID)   // =utilities
+#define M_BAYES_SHRINK                                   (M_DENOISE_PSEUDO_ID + 2L)
+#define M_SURE_SHRINK                                    (M_DENOISE_PSEUDO_ID + 3L)
+#define M_NEIGH_SHRINK                                   (M_DENOISE_PSEUDO_ID + 4L)
+
+/************************************************************************/
+/* MimPolarTransform()                                                  */
+/************************************************************************/
+#define M_RECTANGULAR_TO_POLAR                        0x00000001L
+#define M_POLAR_TO_RECTANGULAR                        0x00000002L
+#define M_FIXED_POINT                                 0x00004000L
+#define M_RECTANGULAR_TO_POLAR_LUT                    0x00008000L
+#define M_POLAR_TO_RECTANGULAR_LUT                    0x00010000L
+
+/************************************************************************/
+/* MimDraw()                                                       */
+/************************************************************************/
+#define M_DRAW_PEAKS                                  0x01000000L
+#define M_DRAW_DARK_IMAGE                             0x02000000L
+#define M_DRAW_OFFSET_IMAGE                           0x04000000L
+#define M_DRAW_FLAT_IMAGE                             0x08000000L
+#define M_DOTS                                        0x00000040L
+#define M_LINES                                       0x00000080L
+#define M_1D_ROWS                                     0x00000010L    // Already defined elsewhere
+#define M_1D_COLUMNS                                  0x00000020L    // Already defined elsewhere
+#define M_DRAW_STAT_RESULT                            0x00000100L
+#define M_DRAW_WAVELET                                0x00010000L
+#define M_DRAW_WAVELET_WITH_PADDING                   0x00000800L
+#define M_DRAW_MODEL                                  0x00001000L
+#define M_DRAW_MASK                                   0x200000L      // Already defined elsewhere
+#define M_DRAW_PATH                                   0x00000200L
+#define M_DRAW_DEAD_PIXELS                            0x00000400L
+#define M_DRAW_IMAGE_ORIENTATION                      0x00002000L
+#define M_DRAW_DEPTH_MAP_ROW                          0x00004000L
+#define M_DRAW_INTENSITY_MAP_ROW                      0x00008000L
+#define M_DRAW_GLCM_MATRIX                            0x00100000L
+#define M_AUTO_SCALE                                           2L   // Already defined in mil.h
+#define M_SATURATION                                      0x2000L   // Already defined in mil.h
+
+#define M_DRAW_AUG_IMAGE                              0x00020000L // TOMODIFY: review this value
+
+/************************************************************************/
+/* MimStatMultiple()                                                    */
+/************************************************************************/
+#define M_CALCULATE                                   1L          // Already defined elsewhere
+#define M_PREPROCESS                                  0x00000002L // Already defined elsewhere
+#define M_REMOVE                                      0x00000004L
+#define M_RESET_EXTREMES                              0x00000008L
+
+/************************************************************************/
+/* MimFlatField(), MimDeadPixelCorrection(), MimRearrange() and         */
+/* MimStatMultiple()                                                    */
+/************************************************************************/
+#define M_PREPROCESS                                  0x00000002L
+
+/************************************************************************/
+/* MimProjectShape(), MgenLutWarp()                                     */
+/************************************************************************/
+#define M_OPTIMAL_SIZE_X                              0x1L
+#define M_OPTIMAL_SIZE_Y                              0x2L
+#define M_PATH_LIST                                   0x3L
+#define M_X_PATH_LIST                                 0x4L
+#define M_Y_PATH_LIST                                 0x5L
+#define M_XY_PATH_LIST                                0x6L
+#define M_PATH_WIDTH_LIST                             0x7L
+
+/************************************************************************/
+/* MimLocatepeak1d()                                                    */
+/************************************************************************/
+#define M_SCAN_LANE_INDEX                             0x000100000L
+#define M_RANK_INDEX                                  0x000200000L
+
+#define M_PEAK_POSITION                               0x000400000L
+#define M_PEAK_POSITION_X                             0x000800000L
+#define M_PEAK_POSITION_Y                             0x001000000L
+
+#define M_NUMBER                                      1009L         // defined in milmeas.h
+#define M_PEAK_INTENSITY_RANGE                        0x000008000L
+#define M_PEAK_INTENSITY                              0x000010000L
+#define M_FRAME_INDEX                                 0x002000000L
+
+#define M_PEAK_WIDTH                                  11L
+#define M_NUMBER_OF_SCAN_LANES                        0x000020000L
+#define M_INCLUDE_MISSING_DATA                        0x000040000L
+#define M_ONLY_MISSING_DATA                           0x000080000L
+
+#define M_STATUS                                      0x00008002L // Already defined elsewhere
+
+/************************************************************************/
+/* MimBinarizeAdaptive()                                                */
+/************************************************************************/
+#define M_THRESHOLD_MODE                                33L    // Already defined in    miledge.h
+#define M_NIBLACK                                     1880L
+#define M_BERNSEN                                     1881L
+#define M_LOCAL_MEAN                                  1882L
+#define M_PSEUDOMEDIAN                                1883L
+#define M_LOCAL_DIMENSION                             1884L
+#define M_MINIMUM_CONTRAST                            600L     // Also defined in milstr.h
+#define M_GLOBAL_MAX                                  1885L
+#define M_GLOBAL_MIN                                  1886L
+#define M_NIBLACK_BIAS                                1887L
+#define M_GLOBAL_OFFSET                               1888L
+//#define M_HYSTERESIS 31L
+#define M_NIBLACK_BIAS_SECOND_PASS                            1889L
+#define M_GLOBAL_OFFSET_SECOND_PASS                           1890L
+#define M_AVERAGE_MODE                                1891L
+//#define M_UNIFORM                                      1L
+#define M_GAUSSIAN                                    0x805L //also defined in miledge.h
+#define M_RECONSTRUCT                                 1892L
+#define M_NB_ITERATIONS                               1893L
+#define M_NB_SEED_ITERATIONS                          1894L
+#define M_TOGGLE                                      1895L
+#define M_THRESHOLD_TYPE                              3000L
+
+/************************************************************************/
+/* MimAugment()                                                     */
+/************************************************************************/
+
+#define M_SAVE_REPORT                             0x200L // already defined in milcode.h
+                                             
+#define M_PRIORITY                           0x00004000L
+#define M_PROBABILITY                        0x00008000L
+
+// STRUCTURE
+#define M_AUG_DILATION_OP                          3098L
+#define M_AUG_EROSION_OP                           3099L
+#define M_AUG_DILATION_ASYM_OP                     3100L
+#define M_AUG_EROSION_ASYM_OP                      3101L
+
+// GEOMETRIQUE
+#define M_AUG_FLIP_OP                              2870L
+#define M_AUG_CROP_OP                              3102L
+
+// AFFINE
+#define M_AUG_ROTATION_OP                          3103L
+#define M_AUG_SCALE_OP                             3104L
+#define M_AUG_TRANSLATION_X_OP                     3105L
+#define M_AUG_TRANSLATION_Y_OP                     3106L
+#define M_AUG_ASPECT_RATIO_OP                      3107L
+#define M_AUG_SHEAR_X_OP                           2892L
+#define M_AUG_SHEAR_Y_OP                           2893L
+
+// INTENSITY
+#define M_AUG_INTENSITY_MULTIPLY_OP                2940L
+#define M_AUG_INTENSITY_ADD_OP                     2887L
+#define M_AUG_GAMMA_OP                             2962L
+#define M_AUG_LIGHTING_DIRECTIONAL_OP              3108L
+#define M_AUG_SATURATION_GAIN_OP                   2910L
+#define M_AUG_HUE_OFFSET_OP                        2917L
+#define M_AUG_HSV_VALUE_GAIN_OP                    2914L
+
+// FILTER
+#define M_AUG_SMOOTH_DERICHE_OP                    2920L
+#define M_AUG_SMOOTH_GAUSSIAN_OP                   2932L
+#define M_AUG_BLUR_MOTION_OP                       2923L
+#define M_AUG_SHARPEN_DERICHE_OP                   2928L
+
+// NOISE
+#define M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP           2955L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP              2950L
+#define M_AUG_NOISE_SALT_PEPPER_OP                 2947L
+
+
+// Augmentation Control parameters
+#define M_AUG_DILATION_OP_NB_ITERATIONS_MAX           2873L
+#define M_AUG_EROSION_OP_NB_ITERATIONS_MAX            2875L
+#define M_AUG_DILATION_ASYM_OP_NB_ITERATIONS_MAX      2881L
+#define M_AUG_EROSION_ASYM_OP_NB_ITERATIONS_MAX       2882L
+
+#define M_AUG_FLIP_OP_DIRECTION                       3120L
+#define M_AUG_CROP_OP_FACTOR_X                        2884L
+#define M_AUG_CROP_OP_FACTOR_Y                        2885L
+#define M_AUG_CROP_OP_RESIZE                          2886L
+
+#define M_AUG_SCALE_OP_FACTOR_MAX                     2876L
+#define M_AUG_SCALE_OP_FACTOR_MIN                     2877L
+#define M_AUG_ROTATION_OP_ANGLE_MAX                   2805L
+#define M_AUG_ROTATION_OP_ANGLE_REF                   3348L 
+#define M_AUG_ROTATION_OP_ANGLE_DELTA                 3349L
+#define M_AUG_ROTATION_OP_ANGLE_STEP                  3350L
+#define M_AUG_ROTATION_OP_ANGLE_MIN                   3351L
+#define M_AUG_TRANSLATION_X_OP_MAX                    2868L
+#define M_AUG_TRANSLATION_Y_OP_MAX                    2869L
+#define M_AUG_ASPECT_RATIO_OP_MIN                     2878L
+#define M_AUG_ASPECT_RATIO_OP_MAX                     2879L
+#define M_AUG_ASPECT_RATIO_OP_MODE                    2880L
+#define M_AUG_SHEAR_X_OP_MIN                          2888L
+#define M_AUG_SHEAR_X_OP_MAX                          2889L
+#define M_AUG_SHEAR_Y_OP_MIN                          2890L
+#define M_AUG_SHEAR_Y_OP_MAX                          2891L
+
+#define M_AUG_LIGHTING_DIRECTIONAL_OP_ANGLE_MAX       2894L
+#define M_AUG_LIGHTING_DIRECTIONAL_OP_INTENSITY_MIN   2895L
+#define M_AUG_LIGHTING_DIRECTIONAL_OP_INTENSITY_MAX   2896L
+#define M_AUG_SATURATION_GAIN_OP_MIN                  2911L
+#define M_AUG_SATURATION_GAIN_OP_MAX                  2912L
+#define M_AUG_HUE_OFFSET_OP_MIN                       2915L
+#define M_AUG_HUE_OFFSET_OP_MAX                       2916L
+#define M_AUG_HSV_VALUE_GAIN_OP_MIN                   2918L
+#define M_AUG_HSV_VALUE_GAIN_OP_MAX                   2919L
+
+#define M_GAIN_CONST                                  206L  // Already defined for M_FLAT_FIELD_CONTEXT
+#define M_AUG_INTENSITY_MULTIPLY_OP_VALUE             M_GAIN_CONST
+#define M_AUG_INTENSITY_MULTIPLY_OP_DELTA             2941L
+#define M_AUG_INTENSITY_MULTIPLY_OP_MODE              2959L
+#define M_OFFSET_CONST                                204L  // Already defined for M_FLAT_FIELD_CONTEXT
+#define M_AUG_INTENSITY_ADD_OP_VALUE                  M_OFFSET_CONST
+#define M_AUG_INTENSITY_ADD_OP_DELTA                  2958L
+#define M_AUG_INTENSITY_ADD_OP_MODE                   2883L 
+#define M_GAMMA                                       6672L // Already defined mil.h
+#define M_AUG_GAMMA_OP_VALUE                          M_GAMMA
+#define M_AUG_GAMMA_OP_DELTA                          2963L
+#define M_AUG_GAMMA_OP_MODE                           2942L
+
+#define M_AUG_SMOOTH_DERICHE_OP_FACTOR_MIN             2921L
+#define M_AUG_SMOOTH_DERICHE_OP_FACTOR_MAX             2922L
+#define M_AUG_SMOOTH_GAUSSIAN_OP_STDDEV_MIN            2933L
+#define M_AUG_SMOOTH_GAUSSIAN_OP_STDDEV_MAX            2934L
+#define M_AUG_BLUR_MOTION_OP_SIZE_MIN                  2924L
+#define M_AUG_BLUR_MOTION_OP_SIZE_MAX                  2925L
+#define M_AUG_BLUR_MOTION_OP_ANGLE_MIN                 2926L
+#define M_AUG_BLUR_MOTION_OP_ANGLE_MAX                 2927L
+#define M_AUG_SHARPEN_DERICHE_OP_FACTOR_MIN            2929L
+#define M_AUG_SHARPEN_DERICHE_OP_FACTOR_MAX            2930L
+
+#define M_AUG_NOISE_SALT_PEPPER_OP_DENSITY             2948L
+#define M_AUG_NOISE_SALT_PEPPER_OP_DENSITY_DELTA       2949L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP_STDDEV           2951L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP_STDDEV_DELTA     2952L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP_INTENSITY_MIN    2953L
+#define M_AUG_NOISE_MULTIPLICATIVE_OP_DISTRIBUTION     2954L
+#define M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP_STDDEV        2956L
+#define M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP_STDDEV_DELTA  2957L
+
+#define M_AUG_RNG_INIT_VALUE                           2867L
+#define M_AUG_SEED_MODE                                3421L
+//#define M_AUG_CONTEXT_SEED                             3422L 
+#define M_AUG_OPTIMAL_SIZE_X                           3419L 
+#define M_AUG_OPTIMAL_SIZE_Y                           3420L 
+
+/* Parameter value */
+#define M_ALL_BANDS                                    M_ALL_BAND // Already defined mil.h
+#define M_PER_BAND                                     2966L
+#define M_UNIFORM                                      1      // Already defined MimHistogramEqualize()
+#define M_GAUSSIAN                                     0x805L // Already defined in miledge.h
+#define M_RGB                                          8L     // Already defined in mil.h
+#define M_LEFT_HALF                                    M_LEFT
+#define M_RIGHT_HALF                                   M_RIGHT
+#define M_UPPER_HALF                                   M_TOP
+#define M_LOWER_HALF                                   M_BOTTOM
+#define M_NORMAL                                       8L // Already defined in mil.h
+#define M_INVERT                                       2L // Arleady defined in milocr.h    
+
+#define M_RNG_AUTO                                     3422L
+#define M_RNG_INIT_VALUE                               3464L
+#define M_USER_DEFINED_SEED                            3465L
+
+#define M_AUTO_VALUE                                   MAKE_INT64(0x0000000100000000) 
+/************************************************************************/
+/* MimStatCalculate()                                                   */
+/************************************************************************/
+
+/************************************************************************/
+/* MimFilterAdaptive()                                                   */
+/************************************************************************/
+#define M_BILATERAL                                   (M_PSEUDO_ID | 0x400)
+
+#if OldDefinesSupport
+   #define M_NOPEL                                    (M_PSEUDO_ID | 0x401)
+   MIL_DEPRECATED(M_NOPEL, 1040) // Use M_NOISE_PEAK_REMOVAL instead.
+#endif
+#define M_NOISE_PEAK_REMOVAL                          (M_PSEUDO_ID | 0x402)
+#define M_MEDIAN                                      0x10000L       // Already defined elsewhere.
+#define M_MEAN                                        0x08000000L    // Already defined elsewhere.
+#define M_EXTREME                                     3393L
+
+/************************************************************************/
+/* MimRemap()                                                           */
+/************************************************************************/
+
+// Control for M_HIST_LIST
+#define  M_FIT_SRC_RANGE                                 0x01        // Already defined as control for M_HIST_LIST.
+#define  M_FIT_SRC_DATA                                  0x02        // Already defined as control for M_HIST_LIST.
+#define  M_CENTERED                                      0x00010000
+
+#ifdef __cplusplus
+
+inline MIL_INT64 ExtractTypeFromValue(MIL_INT64 Value,
+                                      MIL_INT64 Type1,
+                                      MIL_INT64 Type2 = 0,
+                                      MIL_INT64 Type3 = 0,
+                                      MIL_INT64 Type4 = 0,
+                                      MIL_INT64 Type5 = 0,
+                                      MIL_INT64 Type6 = 0,
+                                      MIL_INT64 Type7 = 0,
+                                      MIL_INT64 Type8 = 0)
+   {
+   MIL_INT64 Type = (Value & M_HLVLDATATYPE_MASK);
+   if (Type) // type specified.
+      {
+      // If the extracted type doesn't match one of the allowed types, set it to 0.
+      if (Type != Type1 &&
+          Type != Type2 &&
+          Type != Type3 &&
+          Type != Type4 &&
+          Type != Type5 &&
+          Type != Type6 &&
+          Type != Type7 &&
+          Type != Type8)
+         {
+         Type = 0;
+         }
+      }
+
+   return Type;
+   }
+
+#endif
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* POINT TO POINT : */
+
+      /* -------------------------------------------------------------- */
+
+#if M_MIL_USE_64BIT
+   #define MimArith(Src1, Src2, Dest, Op) MimArithDouble(M_MILID_TO_DOUBLE(Src1), M_MILID_TO_DOUBLE(Src2), Dest, Op)
+#else
+   #define MimArithDouble MimArith
+#endif
+MIL_DLLFUNC void MFTYPE    MimArithDouble       (MIL_DOUBLE Src1ImageBufIdOrConst,
+                                     MIL_DOUBLE Src2ImageBufIdOrConst,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 Operation);
+
+#if M_MIL_USE_64BIT
+   #define MimArithMultiple(Src1, Src2, Src3, Src4, Src5, Dest, Op, OpFlag) MimArithMultipleDouble(M_MILID_TO_DOUBLE(Src1), M_MILID_TO_DOUBLE(Src2), M_MILID_TO_DOUBLE(Src3), Src4, Src5, Dest, Op, OpFlag)
+#else
+   #define MimArithMultipleDouble MimArithMultiple
+#endif
+MIL_DLLFUNC void MFTYPE    MimArithMultipleDouble(MIL_DOUBLE Src1ImageBufId,
+                                      MIL_DOUBLE Src2ImageBufIdOrConst,
+                                      MIL_DOUBLE Src3ImageBufIdOrConst,
+                                      MIL_DOUBLE Src4Const,
+                                      MIL_DOUBLE Src5Const,
+                                      MIL_ID DstImageBufId,
+                                      MIL_INT64  Operation,
+                                      MIL_INT64  OperationFlag);
+
+MIL_DLLFUNC void MFTYPE    MimLutMap            (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID LutBufId);
+
+MIL_DLLFUNC void MFTYPE    MimShift             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbBitsToShift);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MimBinarizeDouble    (MIL_ID     SrcImageBufId,
+                                        MIL_ID     DstImageBufId,
+                                        MIL_INT64  ConditionAndThreshMode,
+                                        MIL_DOUBLE LowParam,
+                                        MIL_DOUBLE HighParam);
+
+MIL_DLLFUNC void MFTYPE    MimClipDouble        (MIL_ID     SrcImageBufId,
+                                     MIL_ID     DstImageBufId,
+                                     MIL_INT64  Condition,
+                                     MIL_DOUBLE CondLow,
+                                     MIL_DOUBLE CondHigh,
+                                     MIL_DOUBLE WriteLow,
+                                     MIL_DOUBLE WriteHigh);
+
+MIL_DLLFUNC void MFTYPE    MimFlatField         (MIL_ID FlatFieldContextImId,
+                                     MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* NEIGHBOURHOOD : */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimDeinterlace       (MIL_ID DeinterlaceContextImId,
+                                     const MIL_ID *SrcImageArrayPtr,
+                                     const MIL_ID *DstImageArrayPtr,
+                                     MIL_INT SrcImageCount,
+                                     MIL_INT DstImageCount,
+                                     MIL_INT64 ControlFlag);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* GEOMETRICAL: */
+
+   /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimResize             (MIL_ID     SrcImageBufId,
+                                      MIL_ID     DstImageOrArrayBufId,
+                                      MIL_DOUBLE ScaleFactorX,
+                                      MIL_DOUBLE ScaleFactorY,
+                                      MIL_INT64  InterpolationMode);
+
+MIL_DLLFUNC void MFTYPE    MimRotate             (MIL_ID     SrcImageBufId,
+                                      MIL_ID     DstImageOrArrayBufId,
+                                      MIL_DOUBLE Angle,
+                                      MIL_DOUBLE SrcCenX,
+                                      MIL_DOUBLE SrcCenY,
+                                      MIL_DOUBLE DstCenX,
+                                      MIL_DOUBLE DstCenY,
+                                      MIL_INT64  InterpolationMode);
+
+MIL_DLLFUNC void MFTYPE    MimFlip               (MIL_ID SrcImageBufId,
+                                      MIL_ID DstImageBufId,
+                                      MIL_INT64 Operation,
+                                      MIL_INT64 OpFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* STATISTICAL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimHistogram         (MIL_ID SrcImageBufId,
+                                     MIL_ID HistResultImId);
+
+MIL_DLLFUNC void MFTYPE    MimHistogramEqualizeDouble(MIL_ID     SrcImageBufId,
+                                          MIL_ID     DstImageBufId,
+                                          MIL_INT64  Operation,
+                                          MIL_DOUBLE Alpha,
+                                          MIL_DOUBLE Min,
+                                          MIL_DOUBLE Max);
+
+MIL_DLLFUNC void MFTYPE    MimFindExtreme       (MIL_ID SrcImageBufId,
+                                     MIL_ID ExtremeResultImId,
+                                     MIL_INT64 ExtremeType);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MimAllocResult       (MIL_ID SysId,
+                                     MIL_INT NbEntries,
+                                     MIL_INT64 ResultType,
+                                     MIL_ID* ResultImIdPtr);
+
+MIL_DLLFUNC void MFTYPE    MimFree              (MIL_ID ContextOrResultImId);
+
+MIL_DLLFUNC MIL_INT MFTYPE MimInquire           (MIL_ID ContextOrResultImId,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MimGetResult2d       (MIL_ID ResultImId,
+                                     MIL_INT OffsetX,
+                                     MIL_INT OffsetY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT64  ResultType,
+                                     MIL_INT64  ControlFlag,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MimGetResult1d       (MIL_ID ResultImId,
+                                     MIL_INT OffEntry,
+                                     MIL_INT NbEntries,
+                                     MIL_INT64 ResultType,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MimGetResult         (MIL_ID ResultImId,
+                                     MIL_INT64 ResultType,
+                                     void* UserArrayPtr);
+
+/*
+                                     */
+MIL_DLLFUNC void MFTYPE    MimGetResultSingleInt64   (MIL_ID ResultImId,
+                                     MIL_INT64 Index1,
+                                     MIL_INT64 Index2,
+                                     MIL_INT64 ResultType,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MimAlloc             (MIL_ID SysId,
+                                     MIL_INT64 ContextType,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID* ContextImIdPtr);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MimControlInt64      (MIL_ID ContextOrResultImId,
+                                     MIL_INT64 ControlType,
+                                     MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MimControlDouble     (MIL_ID ContextOrResultImId,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MimControlDouble   MimControl
+#define MimControlInt64    MimControl
+MIL_DLLFUNC void MFTYPE    MimControl           (MIL_ID     ContextOrResultImId,
+                                     MIL_INT64  ControlType,
+                                     MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC MIL_INT MFTYPE MimGet               (MIL_ID     ContextImId,
+                                     MIL_INT64  GetType,
+                                     MIL_INT    ArraySize,
+                                     void *     Param1Ptr,
+                                     void *     Param2Ptr,
+                                     MIL_INT64  ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimPut               (MIL_ID      ContextImId,
+                                     MIL_INT64   PutType,
+                                     MIL_INT     ArraySize,
+                                     const void *Param1Ptr,
+                                     const void *Param2Ptr,
+                                     MIL_INT64   ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CONVERSION: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimConvert           (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID ArrayBufIdOrConversionType);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* BUF: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimRearrange         (MIL_ID RearrangeContextImId,
+                                     MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 ControlFlag);
+
+#if M_MIL_USE_UNICODE
+
+MIL_DLLFUNC MIL_ID MFTYPE MimRestoreA           (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID      SysId,
+                                     MIL_INT64   ControlFlag,
+                                     MIL_ID*     ContextImIdPtr);
+MIL_DLLFUNC void MFTYPE MimSaveA                (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID      ContextImId,
+                                     MIL_INT64   ControlFlag);
+MIL_DLLFUNC void MFTYPE MimStreamA              (MIL_TEXTA_PTR      MemPtrOrFileName,
+                                     MIL_ID     SysId,
+                                     MIL_INT64  Operation,
+                                     MIL_INT64  StreamType,
+                                     MIL_DOUBLE Version,
+                                     MIL_INT64  ControlFlag,
+                                     MIL_ID*    ContextImIdPtr,
+                                     MIL_INT*   SizeByteVarPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE MimRestoreW  (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID SysId,
+                                     MIL_INT64  ControlFlag,
+                                     MIL_ID *ContextImIdPtr);
+MIL_DLLFUNC void MFTYPE MimSaveW                (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID ContextImId,
+                                     MIL_INT64  ControlFlag);
+MIL_DLLFUNC void MFTYPE MimStreamW              (MIL_TEXTW_PTR MemPtrOrFileName,
+                                     MIL_ID       SysId,
+                                     MIL_INT64    Operation,
+                                     MIL_INT64    StreamType,
+                                     MIL_DOUBLE   Version,
+                                     MIL_INT64    ControlFlag,
+                                     MIL_ID*      ContextImIdPtr,
+                                     MIL_INT*     SizeByteVarPtr);
+
+#if M_MIL_UNICODE_API
+#define MimRestore   MimRestoreW
+#define MimSave      MimSaveW
+#define MimStream    MimStreamW
+#else
+#define MimRestore   MimRestoreA
+#define MimSave      MimSaveA
+#define MimStream    MimStreamA
+#endif
+
+#else
+
+MIL_DLLFUNC MIL_ID MFTYPE MimRestore            (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID SysId,
+                                     MIL_INT64  ControlFlag,
+                                     MIL_ID *ContextImIdPtr);
+
+MIL_DLLFUNC void MFTYPE MimSave                 (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID ContextImId,
+                                     MIL_INT64  ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MimStream               (MIL_TEXT_PTR  MemPtrOrFileName,
+                                     MIL_ID        SysId,
+                                     MIL_INT64     Operation,
+                                     MIL_INT64     StreamType,
+                                     MIL_DOUBLE    Version,
+                                     MIL_INT64     ControlFlag,
+                                     MIL_ID*       ContextImIdPtr,
+                                     MIL_INT*      SizeByteVarPtr);
+#endif   //#if M_MIL_USE_UNICODE
+
+#if (!M_MIL_LITE)
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* NEIGHBOURHOOD : */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimConvolve          (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID FilterContextImOrKernelBufId);
+
+
+MIL_DLLFUNC void MFTYPE    MimRank              (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID StructElemBufId,
+                                     MIL_INT Rank,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimEdgeDetectMIL_INT (MIL_ID SrcImageBufId,
+                                     MIL_ID DstIntensityImageBufId,
+                                     MIL_ID DstAngleImageBufId,
+                                     MIL_ID KernelId,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_INT Threshold);
+
+MIL_DLLFUNC void MFTYPE    MimMatch             (MIL_ID MatchContextImId,
+                                     MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MimBinarizeAdaptive (  MIL_ID AdaptiveBinarizeContextImId,
+                                               MIL_ID SrcImageBufId,
+                                               MIL_ID SeedImage1BufId,
+                                               MIL_ID SeedImage2BufId,
+                                               MIL_ID BinarizedImageBufId,
+                                               MIL_ID ThresholdImageBufId,
+                                               MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MimAugment(MIL_ID    AugmentationContextImId,
+                                   MIL_ID    SrcImageBufId,
+                                   MIL_ID    DstImageBufOrAugmentationResultImId,
+                                   MIL_INT64 SeedValue,
+                                   MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MimFilterAdaptive(MIL_ID      AdaptiveFilterContextImId,
+                                          MIL_ID      SrcImageBufId,
+                                          MIL_ID      DstImageBufId,
+                                          MIL_DOUBLE  Param1,
+                                          MIL_DOUBLE  Param2,
+                                          MIL_DOUBLE  Param3,
+                                          MIL_INT64   ControlFlag
+                                          );
+
+
+
+MIL_DLLFUNC void MFTYPE MimDifferential(MIL_ID     Drv1ImageBufIdOrFilterContextImId, 
+                                        MIL_ID     SrcOrDrv2ImageBufId, 
+                                        MIL_ID     SrcOrDrv3ImageBufId, 
+                                        MIL_ID     Drv4ImageBufId, 
+                                        MIL_ID     Drv5ImageBufId, 
+                                        MIL_ID     Dst1ImageBufId, 
+                                        MIL_ID     Dst2ImageBufId,
+                                        MIL_DOUBLE Param,
+                                        MIL_INT64  Operation,
+                                        MIL_INT64  ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* MORPHOLOGICAL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimLabel             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimConnectMap        (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID LutBufId);
+
+MIL_DLLFUNC void MFTYPE    MimDilate            (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimErode             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimClose             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimOpen              (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimMorphic           (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_ID StructElemBufId,
+                                     MIL_INT64 Operation,
+                                     MIL_INT NbIterationOrArea,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimThin              (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimThick             (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT NbIteration,
+                                     MIL_INT64 ProcMode);
+
+MIL_DLLFUNC void MFTYPE    MimDistance          (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 DistanceTransform);
+
+MIL_DLLFUNC void MFTYPE    MimWatershed         (MIL_ID SrcImageBufId,
+                                     MIL_ID MarkerImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT MinVariation,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimZoneOfInfluence   (MIL_ID SrcImageBufId,
+                                     MIL_ID DstImageBufId,
+                                     MIL_INT64 OperationFlag);
+
+MIL_DLLFUNC void MFTYPE    MimDeadPixelCorrection(MIL_ID DeadPixelContextImId,
+                                      MIL_ID SrcImageBufId,
+                                      MIL_ID DstImageBufId,
+                                      MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* GEOMETRICAL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimTranslate          (MIL_ID     SrcImageBufId,
+                                      MIL_ID     DstImageOrArrayBufId,
+                                      MIL_DOUBLE DisplacementX,
+                                      MIL_DOUBLE DisplacementY,
+                                      MIL_INT64  InterpolationMode);
+
+MIL_DLLFUNC void MFTYPE    MimWarp               (MIL_ID SrcImageBufId,
+                                      MIL_ID DstImageBufId,
+                                      MIL_ID WarpParam1BufId,
+                                      MIL_ID WarpParam2BufId,
+                                      MIL_INT64 OperationMode,
+                                      MIL_INT64 InterpolationMode);
+
+MIL_DLLFUNC void MFTYPE    MimWarpList(MIL_ID WarpParamBufId,
+                                       MIL_INT64 TransformType,
+                                       MIL_INT NumPoints,
+                                       const MIL_DOUBLE* SrcCoordXArrayPtr,
+                                       const MIL_DOUBLE* SrcCoordYArrayPtr,
+                                       MIL_DOUBLE* DstCoordXArrayPtr,
+                                       MIL_DOUBLE* DstCoordYArrayPtr,
+                                       MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimPolarTransform (MIL_ID      SrcImageOrDstXLutBufId,
+                                  MIL_ID      DstImageOrYLutBufId,
+                                  MIL_DOUBLE  CenterPosX,
+                                  MIL_DOUBLE  CenterPosY,
+                                  MIL_DOUBLE  StartRadius,
+                                  MIL_DOUBLE  EndRadius,
+                                  MIL_DOUBLE  StartAngle,
+                                  MIL_DOUBLE  EndAngle,
+                                  MIL_INT64   OperationMode,
+                                  MIL_INT64   InterpolationMode,
+                                  MIL_DOUBLE *DstSizeXPtr,
+                                  MIL_DOUBLE *DstSizeYPtr);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* STATISTICAL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MimBoundingBox(MIL_ID SrcImageBufId,
+                                          MIL_INT64 Condition,
+                                          MIL_DOUBLE CondLow,
+                                          MIL_DOUBLE CondHigh,
+                                          MIL_INT64 BoxDefinitionType,
+                                          MIL_INT* TopLeftX,
+                                          MIL_INT* TopLeftY,
+                                          MIL_INT* BottomRightX,
+                                          MIL_INT* BottomRightY,
+                                          MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimProject           (MIL_ID SrcImageBufId,
+                                                 MIL_ID ProjResultImId,
+                                                 MIL_DOUBLE ProjectionAngle);
+
+#if M_MILIM_FUNCTION_DEPRECATION_WARNING
+MIL_DEPRECATED(MimProject, 1060) // Use MimProjection instead.
+#endif
+
+MIL_DLLFUNC void MFTYPE MimProjection(MIL_ID       SrcImageBufId,
+                                      MIL_ID       DstImageBufOrResultImId,
+                                      MIL_DOUBLE   ProjectionAxisAngle,
+                                      MIL_INT64    Operation,
+                                      MIL_DOUBLE   OperationValue);
+
+#if M_MIL_USE_64BIT
+   #define MimStat(Src, Result, Type, Condition, CondLow, CondHigh) MimStatDouble(Src, Result, Type, Condition, M_MILID_TO_DOUBLE(CondLow), CondHigh)
+#else
+   #define MimStatDouble MimStat
+#endif
+MIL_DLLFUNC void MFTYPE    MimStatDouble        (MIL_ID SrcImageBufId,
+                                     MIL_ID StatResultImId,
+                                     MIL_INT64 StatType,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondLow,
+                                     MIL_DOUBLE CondHigh);
+
+#if M_MILIM_FUNCTION_DEPRECATION_WARNING
+MIL_DEPRECATED(MimStat, 1060) // Use MimStatCalculate instead.
+#endif
+
+MIL_DLLFUNC void MFTYPE    MimStatMultiple      (MIL_ID StatMultipleContextImId,
+                                     MIL_ID SrcImageBufId,
+                                     MIL_ID StatMultipleResultImId,
+                                     MIL_INT64 ControlFlag);
+#if M_MILIM_FUNCTION_DEPRECATION_WARNING
+MIL_DEPRECATED(MimStatMultiple, 1060) // Use MimStatCalculate instead.
+#endif
+
+MIL_DLLFUNC MIL_INT MFTYPE MimLocateEventDouble (MIL_ID     SrcImageBufId,
+                                     MIL_ID     EventResultImId,
+                                     MIL_INT64  Condition,
+                                     MIL_DOUBLE CondLow,
+                                     MIL_DOUBLE CondHigh);
+
+MIL_DLLFUNC void MFTYPE    MimLocatePeak1dDouble(MIL_ID ContextId,
+                                                 MIL_ID SrcImageBufId,
+                                                 MIL_ID ResultId,
+                                                 MIL_INT PeakWidthNominal,
+                                                 MIL_INT PeakWidthDelta,
+                                                 MIL_DOUBLE MinContrast,
+                                                 MIL_INT64 ControlFlag,
+                                                 MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC MIL_INT MFTYPE MimCountDifference   (MIL_ID Src1ImageBufId,
+                                     MIL_ID Src2ImageBufId,
+                                     MIL_ID CountResultImId);
+
+MIL_DLLFUNC void MFTYPE    MimHistogramEqualizeAdaptive(MIL_ID AdaptiveEqualizeContextImId,
+                                               MIL_ID SrcImageBufId,
+                                               MIL_ID DstImageBufId,
+                                               MIL_INT64 ControlFlag);
+
+
+MIL_DLLFUNC void MFTYPE MimFindOrientation(MIL_ID OrientationContextImId,
+                                       MIL_ID SrcImageBufId,
+                                       MIL_ID OrientationResultImId,
+                                       MIL_INT64  ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MimStatCalculate(MIL_ID StatContextImId,
+                                            MIL_ID SrcImageBufId,
+                                            MIL_ID StatResultImId,
+                                            MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* REMAPPING: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimRemap(MIL_ID RemapContextImId,
+                                 MIL_ID SrcImageBufId,
+                                 MIL_ID DstImageBufId,
+                                 MIL_INT64 ControlFlag);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* TRANSFORM: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimTransform            (MIL_ID SrcImageRBufId,
+                                     MIL_ID SrcImageIBufId,
+                                     MIL_ID DstImageRBufId,
+                                     MIL_ID DstImageIBufId,
+                                     MIL_INT64 TransformType,
+                                     MIL_INT64 ControlFlag);
+
+
+/* -------------------------------------------------------------- */
+/* -------------------------------------------------------------- */
+
+/* WAVELET TRANSFORM: */
+
+/* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimWaveletTransform     (MIL_ID WaveletContextImId,
+                                     MIL_ID SrcImageBufOrWaveletResultImId,
+                                     MIL_ID DstImageBufOrWaveletResultImId,
+                                     MIL_INT64 TransformType,
+                                     MIL_INT Level,
+                                     MIL_INT64 ControlFlag);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* WAVELET DENOISE: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimWaveletDenoise (MIL_ID WaveletContextImId,
+                                     MIL_ID SrcImageBufOrWaveletResultImId,
+                                     MIL_ID DstImageBufOrWaveletResultImId,
+                                     MIL_INT Level,
+                                     MIL_ID DenoisingType,
+                                     MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* SET FILTER FOR WAVELET TRANSFORM: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimWaveletSetFilter     (MIL_ID    WaveletContextImId,
+                                     MIL_ID    LowForwardRealFilterId,
+                                     MIL_ID    HighForwardRealFilterId,
+                                     MIL_ID    LowReverseRealFilterId,
+                                     MIL_ID    HighReverseRealFilterId,
+                                     MIL_ID    LowForwardImaginaryFilterId,
+                                     MIL_ID    HighForwardImaginaryFilterId,
+                                     MIL_ID    LowReverseImaginaryFilterId,
+                                     MIL_ID    HighReverseImaginaryFilterId,
+                                     MIL_INT64 ControlFlag);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* DRAW: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MimDrawDouble           (MIL_ID     ContextGraId,
+                                     MIL_ID     Src1MilId,
+                                     MIL_ID     Src2MilId,
+                                     MIL_ID     DstImageBufOrListGraId,
+                                     MIL_INT64  Operation,
+                                     MIL_DOUBLE Param1,
+                                     MIL_DOUBLE Param2,
+                                     MIL_INT64  ControlFlag);
+
+#endif // (!MIL_LITE)
+
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#ifdef __cplusplus
+
+inline void MFTYPE MimStreamCpp(MilStreamParam MemPtrOrFileName,
+                                MIL_ID         SysId,
+                                MIL_INT64      Operation,
+                                MIL_INT64      StreamType,
+                                MIL_DOUBLE     Version,
+                                MIL_INT64      ControlFlag,
+                                MIL_ID*        ContextImIdPtr,
+                                MIL_INT*       SizeByteVarPtr)
+   {
+   MimStream(MemPtrOrFileName.m_Param, SysId, Operation, StreamType, Version, ControlFlag, ContextImIdPtr, SizeByteVarPtr);
+   }
+
+#undef  MimStream
+#define MimStream MimStreamCpp
+
+#endif // __cplusplus
+
+#ifdef __cplusplus
+
+inline bool M_IN_IM_INQUIRE_DOUBLE_RANGE(MIL_ID ContextOrResultId, MIL_INT64 InquireType)
+   {
+   if(M_NB_ELEMENTS_BIT_SET(InquireType))
+      {
+      return false;
+      }
+
+   switch (InquireType & M_MASK_MIM_INQUIRE_TYPE)
+      {
+      case M_FILTER_SMOOTHNESS: // case M_MODEL_IMAGE_TYPE:
+         {
+         MIL_INT ContextType = MimInquire(ContextOrResultId, M_INTERNAL_CONTEXT_TYPE, M_NULL);
+
+         if (ContextType == M_LINEAR_FILTER_IIR_CONTEXT)
+            {
+            return true;
+            }
+
+         return false; // if (ContextType == M_MATCH_CONTEXT)
+         }
+
+      case M_DARK_CONST:
+      case M_OFFSET_CONST:
+      case M_FLAT_CONST:
+      case M_GAIN_CONST:
+      case M_EFFECTIVE_GAIN_CONST:
+      case M_MAX_SCORE:
+      case M_CLIP_LIMIT:
+      case M_ALPHA_VALUE:
+      case M_FREQUENCY_CUTOFF_RATIO_HIGH:
+      case M_FREQUENCY_CUTOFF_RATIO_LOW:
+      case M_MINIMUM_CONTRAST:
+      case M_GLOBAL_MAX:
+      case M_GLOBAL_MIN:
+      case M_NIBLACK_BIAS:
+      case M_GLOBAL_OFFSET:
+      case M_NIBLACK_BIAS_SECOND_PASS:
+      case M_GLOBAL_OFFSET_SECOND_PASS:
+      case M_COND_HIGH:
+      case M_COND_LOW:
+      case M_FILTER_ASPECT_RATIO:
+      case M_FILTER_DEFAULT_SHARPEN_PARAM:
+      case M_AUG_ROTATION_OP_ANGLE_MAX:
+      case M_AUG_ROTATION_OP_ANGLE_REF:
+      case M_AUG_ROTATION_OP_ANGLE_DELTA:
+      case M_AUG_ROTATION_OP_ANGLE_STEP:
+      case M_AUG_TRANSLATION_X_OP_MAX:
+      case M_AUG_TRANSLATION_Y_OP_MAX:
+      case M_AUG_SCALE_OP_FACTOR_MIN:
+      case M_AUG_SCALE_OP_FACTOR_MAX:
+      case M_AUG_ASPECT_RATIO_OP_MIN:
+      case M_AUG_ASPECT_RATIO_OP_MAX:
+      case M_AUG_CROP_OP_FACTOR_X:
+      case M_AUG_CROP_OP_FACTOR_Y:
+      case M_AUG_SHEAR_X_OP_MIN:
+      case M_AUG_SHEAR_X_OP_MAX:
+      case M_AUG_SHEAR_Y_OP_MIN:
+      case M_AUG_SHEAR_Y_OP_MAX:
+      case M_AUG_LIGHTING_DIRECTIONAL_OP_INTENSITY_MAX:
+      case M_AUG_LIGHTING_DIRECTIONAL_OP_INTENSITY_MIN:
+      case M_AUG_LIGHTING_DIRECTIONAL_OP_ANGLE_MAX:
+      case M_AUG_SATURATION_GAIN_OP_MIN:
+      case M_AUG_SATURATION_GAIN_OP_MAX:
+      case M_AUG_HSV_VALUE_GAIN_OP_MIN:
+      case M_AUG_HSV_VALUE_GAIN_OP_MAX:
+      case M_AUG_HUE_OFFSET_OP_MIN:
+      case M_AUG_HUE_OFFSET_OP_MAX:
+      case M_AUG_SMOOTH_DERICHE_OP_FACTOR_MIN:
+      case M_AUG_SMOOTH_DERICHE_OP_FACTOR_MAX:
+      case M_AUG_BLUR_MOTION_OP_ANGLE_MIN:
+      case M_AUG_BLUR_MOTION_OP_ANGLE_MAX:
+      case M_AUG_SHARPEN_DERICHE_OP_FACTOR_MIN:
+      case M_AUG_SHARPEN_DERICHE_OP_FACTOR_MAX:
+      case M_AUG_SMOOTH_GAUSSIAN_OP_STDDEV_MAX:
+      case M_AUG_SMOOTH_GAUSSIAN_OP_STDDEV_MIN:
+      case M_AUG_NOISE_SALT_PEPPER_OP_DENSITY:
+      case M_AUG_NOISE_SALT_PEPPER_OP_DENSITY_DELTA:
+      case M_AUG_NOISE_MULTIPLICATIVE_OP_STDDEV:
+      case M_AUG_NOISE_MULTIPLICATIVE_OP_STDDEV_DELTA:
+      case M_AUG_NOISE_MULTIPLICATIVE_OP_INTENSITY_MIN:
+      case M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP_STDDEV:
+      case M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP_STDDEV_DELTA:
+      case M_AUG_INTENSITY_MULTIPLY_OP_DELTA:
+      case M_AUG_INTENSITY_ADD_OP_DELTA:
+      case M_GAMMA:
+      case M_AUG_GAMMA_OP_DELTA:
+      case M_AUG_DILATION_OP + M_PROBABILITY:
+      case M_AUG_EROSION_OP + M_PROBABILITY:
+      case M_AUG_DILATION_ASYM_OP + M_PROBABILITY:
+      case M_AUG_EROSION_ASYM_OP + M_PROBABILITY:
+      case M_AUG_FLIP_OP + M_PROBABILITY:
+      case M_AUG_CROP_OP + M_PROBABILITY:
+      case M_AUG_ROTATION_OP + M_PROBABILITY:
+      case M_AUG_SCALE_OP + M_PROBABILITY:
+      case M_AUG_TRANSLATION_X_OP + M_PROBABILITY:
+      case M_AUG_TRANSLATION_Y_OP + M_PROBABILITY:
+      case M_AUG_ASPECT_RATIO_OP + M_PROBABILITY:
+      case M_AUG_SHEAR_X_OP + M_PROBABILITY:
+      case M_AUG_SHEAR_Y_OP + M_PROBABILITY:
+      case M_AUG_INTENSITY_MULTIPLY_OP + M_PROBABILITY:
+      case M_AUG_INTENSITY_ADD_OP + M_PROBABILITY:
+      case M_AUG_GAMMA_OP + M_PROBABILITY:
+      case M_AUG_LIGHTING_DIRECTIONAL_OP + M_PROBABILITY:
+      case M_AUG_SATURATION_GAIN_OP + M_PROBABILITY:
+      case M_AUG_HUE_OFFSET_OP + M_PROBABILITY:
+      case M_AUG_HSV_VALUE_GAIN_OP + M_PROBABILITY:
+      case M_AUG_SMOOTH_DERICHE_OP + M_PROBABILITY:
+      case M_AUG_SMOOTH_GAUSSIAN_OP + M_PROBABILITY:
+      case M_AUG_BLUR_MOTION_OP + M_PROBABILITY:
+      case M_AUG_SHARPEN_DERICHE_OP + M_PROBABILITY:
+      case M_AUG_NOISE_GAUSSIAN_ADDITIVE_OP + M_PROBABILITY:
+      case M_AUG_NOISE_MULTIPLICATIVE_OP + M_PROBABILITY:
+      case M_AUG_NOISE_SALT_PEPPER_OP + M_PROBABILITY:
+         {
+         return true;
+         }
+
+      default:
+         {
+         break;
+         }
+      }
+
+   return false;
+   }
+
+inline bool M_IN_IM_INQUIRE_MIL_INT64_RANGE(MIL_ID ContextOrResultId, MIL_INT64 InquireType)
+   {
+   UNREFERENCED_PARAMETER(ContextOrResultId);
+
+   if(M_NB_ELEMENTS_BIT_SET(InquireType))
+      {
+      return false;
+      }
+
+   switch (InquireType & M_MASK_MIM_INQUIRE_TYPE)
+      {
+      case M_EXTENDED_CONTEXT_TYPE_DEPRECATED:
+      case M_EXTENDED_RESULT_TYPE:
+      case M_DEAD_PIXELS_IMAGE_ATTRIBUTE:
+      case M_MODEL_IMAGE_ATTRIBUTE:
+      case M_MASK_IMAGE_ATTRIBUTE:
+      case M_ALLOCATED_TYPE:
+         {
+         return true;
+         }
+
+      default:
+         {
+         break;
+         }
+      }
+
+   return false;
+   }
+
+inline bool M_IM_INQUIRE_MUST_HAVE_USER_PTR(MIL_ID ContextOrResultId, MIL_INT64 InquireType)
+   {
+   #if M_MIL_USE_64BIT
+
+   return M_IN_IM_INQUIRE_DOUBLE_RANGE(ContextOrResultId, InquireType);
+
+   #else
+
+   return (M_IN_IM_INQUIRE_DOUBLE_RANGE(ContextOrResultId, InquireType) || M_IN_IM_INQUIRE_MIL_INT64_RANGE(ContextOrResultId, InquireType));
+
+   #endif
+   }
+
+#endif
+
+#if M_MIL_USE_64BIT
+#ifdef __cplusplus
+//////////////////////////////////////////////////////////////
+// MbufControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MimControl(MIL_ID ContextOrResultImId,
+                       MIL_INT64 ControlType,
+                       int ControlValue)
+   {
+   MimControlInt64(ContextOrResultImId, ControlType, ControlValue);
+   };
+#endif
+
+inline void MimControl(MIL_ID ContextOrResultImId,
+                       MIL_INT64 ControlType,
+                       MIL_INT32 ControlValue)
+   {
+   MimControlInt64(ContextOrResultImId, ControlType, ControlValue);
+   }
+
+inline void MimControl(MIL_ID ContextOrResultImId,
+                       MIL_INT64 ControlType,
+                       MIL_INT64 ControlValue)
+   {
+   MimControlInt64(ContextOrResultImId, ControlType, ControlValue);
+   }
+
+inline void MimControl(MIL_ID ContextOrResultImId,
+                       MIL_INT64 ControlType,
+                       MIL_DOUBLE ControlValue)
+   {
+   MimControlDouble(ContextOrResultImId, ControlType, ControlValue);
+   }
+
+#else
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. Int64 one
+//////////////////////////////////////////////////////////////
+#define MimControl  MimControlInt64
+
+#endif // __cplusplus
+#endif // M_MIL_USE_64BIT
+
+#if(defined(__cplusplus))
+
+//////////////////////////////////////////////////////////////
+// MbufBinarize function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline MIL_INT MFTYPE MimBinarize(MIL_ID     SrcImageBufId,
+                                  MIL_ID     DstImageBufId,
+                                  MIL_INT64  ConditionAndThreshMode,
+                                  MIL_DOUBLE LowParam,
+                                  MIL_DOUBLE HighParam)
+   {
+   return   MimBinarizeDouble(SrcImageBufId, DstImageBufId, ConditionAndThreshMode, LowParam, HighParam);
+   }
+
+inline void MFTYPE MimClip(MIL_ID     SrcImageBufId,
+                           MIL_ID     DstImageBufId,
+                           MIL_INT64  Condition,
+                           MIL_DOUBLE CondLow,
+                           MIL_DOUBLE CondHigh,
+                           MIL_DOUBLE WriteLow,
+                           MIL_DOUBLE WriteHigh)
+   {
+   MimClipDouble(SrcImageBufId, DstImageBufId, Condition, CondLow, CondHigh, WriteLow, WriteHigh);
+   }
+
+inline void MFTYPE MimHistogramEqualize(MIL_ID      SrcImageBufId,
+                                        MIL_ID      DstImageBufId,
+                                        MIL_INT64   EqualizationType,
+                                        MIL_DOUBLE  Alpha,
+                                        MIL_DOUBLE  Min,
+                                        MIL_DOUBLE  Max)
+   {
+   MimHistogramEqualizeDouble(SrcImageBufId, DstImageBufId, EqualizationType, Alpha, Min, Max);
+   }
+
+#if (!M_MIL_LITE)
+
+inline void MFTYPE MimDraw(MIL_ID     ContextGraId,
+                           MIL_ID     Src1MilId,
+                           MIL_ID     Src2MilId,
+                           MIL_ID     DstImageBufOrListGraId,
+                           MIL_INT64  Operation,
+                           MIL_DOUBLE Param1,
+                           MIL_DOUBLE Param2,
+                           MIL_INT64  ControlFlag)
+   {
+   MimDrawDouble(ContextGraId, Src1MilId, Src2MilId, DstImageBufOrListGraId, Operation, Param1, Param2, ControlFlag);
+   }
+
+inline void MFTYPE MimEdgeDetect(MIL_ID SrcImageBufId,
+                                 MIL_ID DstIntensityImageBufId,
+                                 MIL_ID DstAngleImageBufId,
+                                 MIL_ID KernelId,
+                                 MIL_INT64 ControlFlag,
+                                 MIL_INT Threshold)
+   {
+   MimEdgeDetectMIL_INT(SrcImageBufId, DstIntensityImageBufId, DstAngleImageBufId, KernelId, ControlFlag, Threshold);
+   }
+
+inline MIL_INT MFTYPE MimLocateEvent(MIL_ID     SrcImageBufId,
+                                     MIL_ID     EventResultImId,
+                                     MIL_INT64  Condition,
+                                     MIL_DOUBLE CondLow,
+                                     MIL_DOUBLE CondHigh)
+   {
+   return MimLocateEventDouble(SrcImageBufId, EventResultImId, Condition, CondLow, CondHigh);
+   }
+
+inline void MFTYPE MimLocatePeak1d(MIL_ID ContextId,
+                                   MIL_ID SrcImageBufId,
+                                   MIL_ID ResultId,
+                                   MIL_INT PeakWidthNominal,
+                                   MIL_INT PeakWidthDelta,
+                                   MIL_DOUBLE MinContrast,
+                                   MIL_INT64 ControlFlag,
+                                   MIL_DOUBLE ControlValue)
+   {
+   MimLocatePeak1dDouble(ContextId, SrcImageBufId, ResultId, PeakWidthNominal, PeakWidthDelta, MinContrast, ControlFlag, ControlValue);
+   }
+
+
+#endif
+
+#else //#if(!defined(__cplusplus))
+
+#define  MimBinarize                   MimBinarizeDouble
+#define  MimClip                       MimClipDouble
+#define  MimHistogramEqualize          MimHistogramEqualizeDouble
+
+#if (!M_MIL_LITE)
+
+#define  MimDraw                       MimDrawDouble
+#define  MimEdgeDetect                 MimEdgeDetectMIL_INT
+#define  MimLocateEvent                MimLocateEventDouble
+#define  MimLocatePeak1d               MimLocatePeak1dDouble
+#endif
+
+#endif   //#if(defined(__cplusplus))
+
+#define  MimGetResultSingle            MimGetResultSingleInt64
+
+#if M_MIL_USE_SAFE_TYPE
+
+//////////////////////////////////////////////////////////////
+// See milos.h for explanation about these functions.
+//////////////////////////////////////////////////////////////
+
+//-------------------------------------------------------------------------------------
+// MimGetResult
+
+inline void MFTYPE MimGetResultUnsafe  (MIL_ID ResultImId, MIL_INT64  ResultType, void           *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, int             UserArrayPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, std::nullptr_t              );
+#endif
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_INT32      *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_INT64      *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, float          *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_DOUBLE     *UserArrayPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_UINT32     *UserArrayPtr);
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_UINT64     *UserArrayPtr);
+#endif
+
+//-------------------------------------------------------------------------------------
+// MimGetResult1d
+
+inline void MFTYPE MimGetResult1dUnsafe  (MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, void           *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, int             UserArrayPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, std::nullptr_t              );
+#endif
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_INT32      *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_INT64      *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, float          *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_DOUBLE     *UserArrayPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_UINT32     *UserArrayPtr);
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_UINT64     *UserArrayPtr);
+#endif
+
+//-------------------------------------------------------------------------------------
+// MimGetResult2d
+
+inline void MFTYPE MimGetResult2dUnsafe  (MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, void           *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, int             UserArrayPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, std::nullptr_t              );
+#endif
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_INT32      *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_INT64      *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, float          *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_DOUBLE     *UserArrayPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_UINT32     *UserArrayPtr);
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_UINT64     *UserArrayPtr);
+#endif
+
+//-------------------------------------------------------------------------------------
+// MimGetResultSingle
+
+inline void MFTYPE MimGetResultSingleUnsafe  (MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, void           *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, int             UserArrayPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, std::nullptr_t              );
+#endif
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_INT32      *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_INT64      *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, float          *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_DOUBLE     *UserArrayPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_UINT32     *UserArrayPtr);
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_UINT64     *UserArrayPtr);
+#endif   //#if(defined(__cplusplus))
+//-------------------------------------------------------------------------------------
+// MimGet
+
+inline MIL_INT MFTYPE MimGetUnsafe  (MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, void        *Param1Ptr, void        *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, int         *Param1Ptr, int         *Param2Ptr, MIL_INT64 ControlFlag);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, std::nullptr_t        , std::nullptr_t        , MIL_INT64 ControlFlag);
+#endif
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_INT32   *Param1Ptr, MIL_INT32   *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_INT64   *Param1Ptr, MIL_INT64   *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, float       *Param1Ptr, float       *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_DOUBLE  *Param1Ptr, MIL_DOUBLE  *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, char        *Param1Ptr, char        *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, short       *Param1Ptr, short       *Param2Ptr, MIL_INT64 ControlFlag);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT32  *Param1Ptr, MIL_UINT32  *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT64  *Param1Ptr, MIL_UINT64  *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT8   *Param1Ptr, MIL_UINT8   *Param2Ptr, MIL_INT64 ControlFlag);
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT16  *Param1Ptr, MIL_UINT16  *Param2Ptr, MIL_INT64 ControlFlag);
+#endif
+
+// ----------------------------------------------------------
+// MimInquire
+
+inline MIL_INT MFTYPE MimInquireUnsafe  (MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, void        * ValuePtr);
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, int           ValuePtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, std::nullptr_t        );
+#endif
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_INT32   * ValuePtr);
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_INT64   * ValuePtr);
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_DOUBLE  * ValuePtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_UINT32  * ValuePtr);
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultImId, MIL_INT64  ParamToInquire, MIL_UINT64  * ValuePtr);
+#endif
+
+// -------------------------------------------------------------------------
+// MimGetResult
+
+inline MIL_INT64 RequiredTypeFromBufType(MIL_ID ResultImId)
+   {
+   MIL_INT Type = MbufInquire(ResultImId, M_TYPE, M_NULL);
+
+   if (Type == 32+M_FLOAT)
+      {
+      return M_TYPE_FLOAT;
+      }
+   else if (Type == 64+M_FLOAT)
+      {
+      return M_TYPE_DOUBLE;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline bool IsAugmentResult(MIL_INT64 ResultType, MIL_INT64* ResultDataType)
+   {
+   bool bAskAvailable = (ResultType & M_AVAILABLE) == M_AVAILABLE;
+   MIL_INT64 ResultTypeStripped = ResultType & ~M_AVAILABLE;
+   bool bIsAugmentResultType = false;
+   switch(ResultTypeStripped)
+      {
+      case M_AUG_DILATION_NB_ITERATIONS:
+      case M_AUG_EROSION_NB_ITERATIONS:
+      case M_AUG_DILATION_ASYM_NB_ITERATIONS:
+      case M_AUG_DILATION_ASYM_SUBAREA:
+      case M_AUG_EROSION_ASYM_NB_ITERATIONS:
+      case M_AUG_EROSION_ASYM_SUBAREA:
+      case M_AUG_FLIP_DIRECTION:
+      case M_AUG_CROP_TOP_LEFT_X:
+      case M_AUG_CROP_TOP_LEFT_Y:
+      case M_AUG_CROP_BOTTOM_RIGHT_X:
+      case M_AUG_CROP_BOTTOM_RIGHT_Y:
+      case M_AUG_ROTATION_ANGLE:
+      case M_AUG_SCALE_FACTOR:
+      case M_AUG_TRANSLATION_X:
+      case M_AUG_TRANSLATION_Y:
+      case M_AUG_ASPECT_RATIO:
+      case M_AUG_ASPECT_RATIO_MODE:
+      case M_AUG_SHEAR_X:
+      case M_AUG_SHEAR_Y:
+      case M_AUG_INTENSITY_MULTIPLY_VALUE:
+      case M_AUG_INTENSITY_ADD_VALUE:
+      case M_AUG_GAMMA_VALUE_BAND_0:
+      case M_AUG_GAMMA_VALUE_BAND_1:
+      case M_AUG_GAMMA_VALUE_BAND_2:
+      case M_AUG_LIGHTING_DIRECTIONAL_ANGLE:
+      case M_AUG_SATURATION_GAIN:
+      case M_AUG_HUE_OFFSET:
+      case M_AUG_HSV_VALUE_GAIN:
+      case M_AUG_SMOOTH_DERICHE_VALUE:
+      case M_AUG_SMOOTH_GAUSSIAN_STDDEV:
+      case M_AUG_BLUR_MOTION_SIZE:
+      case M_AUG_BLUR_MOTION_ANGLE:
+      case M_AUG_SHARPEN_DERICHE_VALUE:
+      case M_AUG_NOISE_GAUSSIAN_ADDITIVE_STDDEV:
+      case M_AUG_NOISE_MULTIPLICATIVE_STDDEV:
+      case M_AUG_NOISE_SALT_PEPPER_DENSITY:
+      case M_AUG_OPTIMAL_SIZE_X:
+      case M_AUG_OPTIMAL_SIZE_Y:
+      case M_AUG_SEED_USED:
+      case M_AUG_REVERSE_TRANSFORMATION_MATRIX:
+      case M_AUG_OPERATIONS_ENABLED:
+      case M_AUG_OPERATIONS_APPLIED:
+      case M_AUG_OPERATION_RESULT_TYPES:
+      case M_AUG_OPERATION_ASSOCIATED_WITH_RESULT_TYPES:
+         *ResultDataType = M_TYPE_MIL_DOUBLE;
+         bIsAugmentResultType = true;
+         break;
+
+      default:
+         bIsAugmentResultType = false;
+         break;
+      }
+   if(bIsAugmentResultType)
+      {
+      if(bAskAvailable)
+         *ResultDataType = M_TYPE_MIL_INT;
+      return true;
+      }
+   else
+      return false;
+
+   }
+
+inline MIL_INT64  MimGetResultRequiredType(MIL_ID ResultImId, MIL_INT64  ResultType)
+   {
+   /* MimAugment Result specific (include M_AVAILABLE) which is not available for other M_IM_RESULT */
+   MIL_INT64 AugmentResultDataType;
+   if(IsAugmentResult(ResultType, &AugmentResultDataType))
+      return AugmentResultDataType;
+
+   /* Other M_IM_RESULT*/
+   switch (ResultType)
+      {
+      case M_NB_EVENT:
+      case M_POSITION_X:
+      case M_POSITION_Y:
+      {
+      // For these results, the doc specifies that MIL_INT is returned
+      // except when allocated with 32+M_FLOAT, where a float is returned.
+      return RequiredTypeFromBufType(ResultImId);
+      }
+      break;
+   case M_VALUE:
+      {
+      // For M_VALUE, the doc specifies that MIL_INT is returned
+      // except for M_PROJ_LIST, M_EXTREME_LIST, M_EVENT_LIST
+      // allocated with 32+M_FLOAT, where a float is returned.
+      MIL_INT64 IdResultType = 0;
+      MimInquire(ResultImId, M_EXTENDED_RESULT_TYPE, &IdResultType);
+      switch (IdResultType)
+         {
+      case M_PROJ_LIST:
+      case M_EXTREME_LIST:
+      case M_EVENT_LIST:
+         {
+         return RequiredTypeFromBufType(ResultImId);
+         }
+         break;
+      default:
+         return M_TYPE_MIL_INT;
+         break;
+         }
+      }
+      break;
+   case M_ANGLE:
+   case M_SCORE:
+      {
+      MIL_INT64 IdResultType = 0;
+      MimInquire(ResultImId, M_EXTENDED_RESULT_TYPE, &IdResultType);
+      switch (IdResultType)
+         {
+      case M_FIND_ORIENTATION_LIST:
+         {
+         return RequiredTypeFromBufType(ResultImId);
+         }
+         break;
+      default:
+         return M_TYPE_MIL_INT;
+         break;
+         }
+      }
+      break;
+
+   case M_VALUE+M_PERCENTAGE:
+   case M_CUMULATIVE_VALUE+M_PERCENTAGE:
+   case M_PERCENTILE_VALUE:
+   case M_NUMBER_OF_LEVELS:
+   case M_TRANSFORMATION_MODE:
+   case M_WAVELET_TYPE:
+   case M_WAVELET_SIZE:
+   case M_WAVELET_DRAW_SIZE_X:
+   case M_WAVELET_DRAW_SIZE_Y:
+   case M_WAVELET_DRAW_SIZE_X_WITH_PADDING:
+   case M_WAVELET_DRAW_SIZE_Y_WITH_PADDING:
+   case M_TRANSFORMATION_DOMAIN:
+   case M_HIST_VALUE_OFFSET:
+   case M_HIST_VALUE_RANGE:
+   case M_HIST_REAL_SIZE:
+   case M_ORIGINAL_IMAGE_SIZE_X:
+   case M_ORIGINAL_IMAGE_SIZE_Y:
+      return M_TYPE_MIL_INT;
+      break;
+
+   case M_CUMULATIVE_VALUE: /* case M_VALID: */
+      {
+      MIL_INT64 IdResultType = 0;
+
+      MimInquire(ResultImId, M_EXTENDED_RESULT_TYPE, &IdResultType);
+
+      switch (IdResultType)
+         {
+         case M_PROJ_LIST:
+            {
+            return RequiredTypeFromBufType(ResultImId);
+
+            break;
+            }
+
+         default:
+            {
+            return M_TYPE_MIL_INT;
+
+            break;
+            }
+         }
+
+      break;
+      }
+
+   case M_WAVELET_COEFFICIENTS_IMAGE_ID:
+   case M_WAVELET_COEFFICIENTS_IMAGE_ID + M_REAL_PART:
+   case M_WAVELET_COEFFICIENTS_IMAGE_ID + M_IMAGINARY_PART:
+      return M_TYPE_MIL_ID;
+      break;
+
+   case M_WAVELET_LEVEL_SIZE_X:
+   case M_WAVELET_LEVEL_SIZE_Y:
+   case M_WAVELET_LEVEL_PADDING_OFFSET_X:
+   case M_WAVELET_LEVEL_PADDING_OFFSET_Y:
+      return M_TYPE_DOUBLE;
+      break;
+
+   case M_ASSOCIATED_CONTEXT_TYPE:
+      return M_TYPE_MIL_INT;
+      break;
+
+   default:
+      {
+      MIL_INT64 IdResultType = 0;
+      MimInquire(ResultImId, M_EXTENDED_RESULT_TYPE, &IdResultType);
+      if (M_LOCATE_PEAK_1D_RESULT == IdResultType)
+         return M_TYPE_MIL_INT;
+      }
+      return M_TYPE_DOUBLE;
+      break;
+      }
+   }
+
+
+inline MIL_INT64 MimGetRequiredType(MIL_INT64 ResultType)
+   {
+   UNREFERENCED_PARAMETER(ResultType);
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64 ResultType, int UserArrayPtr)
+   {
+   if (UserArrayPtr)
+      SafeTypeError(MIL_TEXT("MimGetResult"));
+
+   MimGetResult(ResultImId, ResultType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64 ResultType, std::nullptr_t)
+   {
+   MimGetResult(ResultImId, ResultType, NULL);
+   }
+#endif
+
+inline void MimGetResultSafeTypeExecute (MIL_ID ResultImId, MIL_INT64 ResultType, void *UserArrayPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(ResultType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT);
+   if (RequiredType == 0)
+      RequiredType = MimGetResultRequiredType(ResultImId, ResultType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGetResult"));
+
+   MimGetResult(ResultImId, ResultType, UserArrayPtr);
+   }
+
+
+inline void MFTYPE MimGetResultUnsafe  (MIL_ID ResultImId, MIL_INT64  ResultType, void        *UserArrayPtr) {MimGetResult               (ResultImId, ResultType, UserArrayPtr);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_INT32   *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_INT64   *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, float       *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_FLOAT);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_DOUBLE  *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_UINT32  *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResultSafeType(MIL_ID ResultImId, MIL_INT64  ResultType, MIL_UINT64  *UserArrayPtr) {MimGetResultSafeTypeExecute(ResultImId, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// -------------------------------------------------------------------------
+// MimGetResult1d
+
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, int UserArrayPtr)
+   {
+   if (UserArrayPtr)
+      SafeTypeError(MIL_TEXT("MimGetResult1d"));
+
+   MimGetResult1d(ResultImId, OffEntry, NbEntries, ResultType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, std::nullptr_t)
+   {
+   MimGetResult1d(ResultImId, OffEntry, NbEntries, ResultType, NULL);
+   }
+#endif
+
+inline void MimGetResult1dSafeTypeExecute (MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, void *UserArrayPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(ResultType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT);
+   if (RequiredType == 0)
+      RequiredType = MimGetResultRequiredType(ResultImId, ResultType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGetResult1d"));
+
+   MimGetResult1d(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr);
+   }
+
+inline void MFTYPE MimGetResult1dUnsafe  (MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, void        *UserArrayPtr){MimGetResult1d               (ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_INT32   *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_INT64   *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, float       *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_FLOAT);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_DOUBLE  *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_UINT32  *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResult1dSafeType(MIL_ID ResultImId, MIL_INT OffEntry, MIL_INT NbEntries, MIL_INT64  ResultType, MIL_UINT64  *UserArrayPtr){MimGetResult1dSafeTypeExecute(ResultImId, OffEntry, NbEntries, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// -------------------------------------------------------------------------
+// MimGetResult2d
+
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, int UserArrayPtr)
+   {
+   if(UserArrayPtr)
+      SafeTypeError(MIL_TEXT("MimGetResult2d"));
+
+   MimGetResult2d(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, std::nullptr_t)
+   {
+   MimGetResult2d(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, NULL);
+   }
+#endif
+
+inline void MimGetResult2dSafeTypeExecute (MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, void *UserArrayPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(ResultType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT);
+   if (RequiredType == 0)
+      RequiredType = MimGetResultRequiredType(ResultImId, ResultType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGetResult2d"));
+
+   MimGetResult2d(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr);
+   }
+
+inline void MFTYPE MimGetResult2dUnsafe  (MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, void        *UserArrayPtr){MimGetResult2d               (ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_INT32   *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_INT64   *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_MIL_INT64);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, float       *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_FLOAT);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_DOUBLE  *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_UINT32  *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResult2dSafeType(MIL_ID ResultImId, MIL_INT OffsetX, MIL_INT OffsetY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT64  ResultType, MIL_INT64  ControlFlag, MIL_UINT64  *UserArrayPtr){MimGetResult2dSafeTypeExecute(ResultImId, OffsetX, OffsetY, SizeX, SizeY, ResultType, ControlFlag, UserArrayPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// -------------------------------------------------------------------------
+// MimGetResultSingle
+
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, int UserArrayPtr)
+   {
+   if(UserArrayPtr)
+      SafeTypeError(MIL_TEXT("MimGetResultSingle"));
+
+   MimGetResultSingleInt64(ResultImId, Index1, Index2,ResultType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, std::nullptr_t)
+   {
+   MimGetResultSingleInt64(ResultImId, Index1, Index2, ResultType, NULL);
+   }
+#endif
+
+inline void MFTYPE MimGetResultSingleSafeTypeExecute (MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, void *UserArrayPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(ResultType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT, M_TYPE_MIL_ID);
+   if (RequiredType == 0)
+      RequiredType = MimGetResultRequiredType(ResultImId, ResultType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGetResultSingle"));
+
+   MimGetResultSingleInt64(ResultImId, Index1, Index2, ResultType, UserArrayPtr);
+   }
+
+inline void MFTYPE MimGetResultSingleUnsafe  (MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, void        *UserArrayPtr){MimGetResultSingleInt64          (ResultImId, Index1, Index2, ResultType, UserArrayPtr);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_INT32   *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_INT64   *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, float       *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_FLOAT);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_DOUBLE  *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_UINT32  *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_MIL_INT32);}
+inline void MFTYPE MimGetResultSingleSafeType(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64 ResultType, MIL_UINT64  *UserArrayPtr){MimGetResultSingleSafeTypeExecute(ResultImId, Index1, Index2, ResultType, UserArrayPtr, M_TYPE_MIL_INT64);}
+#endif
+
+
+// -------------------------------------------------------------------------
+// MimGet
+
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, int Param1Ptr, int ParamPtr2, MIL_INT64 ControlFlag)
+   {
+   if(Param1Ptr)
+      SafeTypeError(MIL_TEXT("MimGet"));
+
+   if(ParamPtr2)
+      SafeTypeError(MIL_TEXT("MimGet"));
+
+   return MimGet(ContextImId, GetType, ArraySize, NULL, NULL, ControlFlag);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, std::nullptr_t, std::nullptr_t, MIL_INT64 ControlFlag)
+   {
+   return MimGet(ContextImId, GetType, ArraySize, NULL, NULL, ControlFlag);
+   }
+#endif
+
+inline MIL_INT MimGetSafeTypeExecute (MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, void *Param1Ptr, void *ParamPtr2, MIL_INT64 ControlFlag, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = ExtractTypeFromValue(GetType, M_TYPE_DOUBLE, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64, M_TYPE_FLOAT, M_TYPE_MIL_ID, M_TYPE_CHAR, M_TYPE_SHORT);
+   if (RequiredType == 0)
+      RequiredType = MimGetRequiredType(GetType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimGet"));
+
+   return MimGet(ContextImId, GetType, ArraySize, Param1Ptr, ParamPtr2, ControlFlag);
+   }
+
+inline MIL_INT MFTYPE MimGetUnsafe  (MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, void        *Param1Ptr, void        *Param2Ptr, MIL_INT64 ControlFlag){return MimGet               (ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_INT32   *Param1Ptr, MIL_INT32   *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_INT64   *Param1Ptr, MIL_INT64   *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, float       *Param1Ptr, float       *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_FLOAT);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_DOUBLE  *Param1Ptr, MIL_DOUBLE  *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_DOUBLE);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, char        *Param1Ptr, char        *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_CHAR);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, short       *Param1Ptr, short       *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_SHORT);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT32  *Param1Ptr, MIL_UINT32  *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT64  *Param1Ptr, MIL_UINT64  *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT8   *Param1Ptr, MIL_UINT8   *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_CHAR);}
+inline MIL_INT MFTYPE MimGetSafeType(MIL_ID ContextImId, MIL_INT64 GetType, MIL_INT ArraySize, MIL_UINT16  *Param1Ptr, MIL_UINT16  *Param2Ptr, MIL_INT64 ControlFlag){return MimGetSafeTypeExecute(ContextImId, GetType, ArraySize, Param1Ptr, Param2Ptr, ControlFlag, M_TYPE_SHORT);}
+#endif
+// ----------------------------------------------------------
+// MimInquire
+
+inline MIL_INT64 MimInquireRequiredType(MIL_ID ContextOrResultId, MIL_INT64 InquireType)
+   {
+   MIL_INT64  DataType = ExtractTypeFromValue(InquireType, M_TYPE_DOUBLE, M_TYPE_MIL_ID, M_TYPE_MIL_INT32, M_TYPE_MIL_INT64);
+
+   if (DataType)
+      return DataType;
+
+   if (M_IN_IM_INQUIRE_DOUBLE_RANGE(ContextOrResultId, InquireType))
+      return M_TYPE_DOUBLE;
+
+   if (M_IN_IM_INQUIRE_MIL_INT64_RANGE(ContextOrResultId, InquireType))
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, int UserVarPtr)
+   {
+   bool MustHaveUserPointer = M_IM_INQUIRE_MUST_HAVE_USER_PTR(ContextOrResultId, InquireType);
+
+   if (UserVarPtr || MustHaveUserPointer)
+      SafeTypeError(MIL_TEXT("MimInquire"));
+
+   return MimInquire(ContextOrResultId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, std::nullptr_t)
+   {
+   bool MustHaveUserPointer = M_IM_INQUIRE_MUST_HAVE_USER_PTR(ContextOrResultId, InquireType);
+
+   if(MustHaveUserPointer)
+      SafeTypeError(MIL_TEXT("MimInquire"));
+
+   return MimInquire(ContextOrResultId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MimInquireSafeTypeExecute (MIL_ID ContextOrResultId, MIL_INT64  InquireType, void  *UserVarPtr, MIL_INT64  GivenType)
+   {
+   MIL_INT64  RequiredType = MimInquireRequiredType(ContextOrResultId, InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MimInquire"));
+
+   return MimInquire(ContextOrResultId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MimInquireUnsafe  (MIL_ID ContextOrResultId, MIL_INT64  InquireType, void        *UserVarPtr) {return MimInquire               (ContextOrResultId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_INT32   *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_INT64   *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_DOUBLE  *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_UINT32  *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MimInquireSafeType(MIL_ID ContextOrResultId, MIL_INT64  InquireType, MIL_UINT64  *UserVarPtr) {return MimInquireSafeTypeExecute(ContextOrResultId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#define MimGet               MimGetSafeType
+#define MimGetResult         MimGetResultSafeType
+#define MimGetResult1d       MimGetResult1dSafeType
+#define MimGetResult2d       MimGetResult2dSafeType
+#if (defined(MimGetResultSingle))
+#undef MimGetResultSingle
+#endif
+#define MimGetResultSingle   MimGetResultSingleSafeType
+#define MimInquire           MimInquireSafeType
+
+#else // #if M_MIL_USE_SAFE_TYPE
+
+#define MimGetUnsafe               MimGet
+#define MimGetResultUnsafe         MimGetResult
+#define MimGetResult1dUnsafe       MimGetResult1d
+#define MimGetResult2dUnsafe       MimGetResult2d
+#define MimGetResultSingleUnsafe   MimGetResultSingle
+#define MimInquireUnsafe           MimInquire
+
+#endif // #if M_MIL_USE_SAFE_TYPE
+
+// ----------------------------------------------------------
+// Overload for std::vector.
+#if defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+template <typename UserType>
+inline void MFTYPE MimGetResult(MIL_ID ResultImId, MIL_INT64  ResultType, std::vector<UserType> &UserArrayPtr)
+   {
+   //! If the given MIL data type is not the same as the SrcType, change it to the correct one
+   //! and give a warning.
+   MIL_INT64 InternalTrueDataTypeForStdVector = MilTraits<UserType>::TypeFlag;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(ResultType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+#endif
+
+   ResultType = M_STRIP_HLVLDATATYPE(ResultType) + InternalTrueDataTypeForStdVector;
+
+   MIL_INT InternalNumberOfElementsForStdVector = 0;
+   MimGetResult(ResultImId, M_STRIP_HLVLDATATYPE(ResultType) + M_NB_ELEMENTS + M_TYPE_MIL_INT, &InternalNumberOfElementsForStdVector);
+
+   UserArrayPtr.resize(InternalNumberOfElementsForStdVector);
+
+   if(InternalNumberOfElementsForStdVector > 0)
+      {
+      MimGetResult(ResultImId, ResultType, &UserArrayPtr[0]);
+      }
+   }
+template <typename UserType>
+inline void MFTYPE MimGetResultSingle(MIL_ID ResultImId, MIL_INT64 Index1, MIL_INT64 Index2, MIL_INT64  ResultType, std::vector<UserType> &UserArrayPtr)
+   {
+   //! If the given MIL data type is not the same as the SrcType, change it to the correct one
+   //! and give a warning.
+   MIL_INT64 InternalTrueDataTypeForStdVector = MilTraits<UserType>::TypeFlag;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(ResultType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResultSingle"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+#endif
+
+   ResultType = M_STRIP_HLVLDATATYPE(ResultType) + InternalTrueDataTypeForStdVector;
+
+   MIL_INT InternalNumberOfElementsForStdVector = 0;
+   MimGetResultSingle(ResultImId, Index1, Index2, M_STRIP_HLVLDATATYPE(ResultType) + M_NB_ELEMENTS + M_TYPE_MIL_INT, &InternalNumberOfElementsForStdVector);
+
+   UserArrayPtr.resize(InternalNumberOfElementsForStdVector);
+
+   if(InternalNumberOfElementsForStdVector > 0)
+      {
+      MimGetResultSingle(ResultImId, Index1, Index2, ResultType, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimDeinterlace.
+inline void MFTYPE MimDeinterlace(MIL_ID                     DeinterlaceContextImId,
+                                  const std::vector<MIL_ID>& SrcImageArrayPtr,
+                                  const std::vector<MIL_ID>& DstImageArrayPtr,
+                                  MIL_INT                    SrcImageCount,
+                                  MIL_INT                    DstImageCount,
+                                  MIL_INT64                  ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(SrcImageCount <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("SrcImageCount parameter must be greater than zero."));
+      }
+   if(DstImageCount <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("DstImageCount parameter must be greater than zero."));
+      }
+   if(SrcImageArrayPtr.empty() || DstImageArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(SrcImageCount > (MIL_INT)SrcImageArrayPtr.size() && SrcImageCount != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("SrcImageCount parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+   if(DstImageCount > (MIL_INT)DstImageArrayPtr.size() && DstImageCount != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MimDeinterlace"), MIL_TEXT("DstImageCount parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(SrcImageCount == M_DEFAULT || SrcImageCount > (MIL_INT)SrcImageArrayPtr.size())
+      {
+      SrcImageCount = (MIL_INT)SrcImageArrayPtr.size();
+      }
+   if(DstImageCount == M_DEFAULT || DstImageCount > (MIL_INT)DstImageArrayPtr.size())
+      {
+      DstImageCount = (MIL_INT)DstImageArrayPtr.size();
+      }
+
+   MimDeinterlace(DeinterlaceContextImId,
+                  &SrcImageArrayPtr[0],
+                  &DstImageArrayPtr[0],
+                  SrcImageCount,
+                  DstImageCount,
+                  ControlFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimGet with two output parameters
+template <typename UserType>
+inline MIL_INT MFTYPE MimGet(MIL_ID                ContextImId,
+                             MIL_INT64             GetType,
+                             MIL_INT               ArraySize,
+                             std::vector<UserType> &Param1Ptr,
+                             std::vector<UserType> &Param2Ptr,
+                             MIL_INT64             ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(GetType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGet"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+#endif
+
+   GetType = M_STRIP_HLVLDATATYPE(GetType) + MilTraits<UserType>::TypeFlag;
+
+   bool InternalArraySizeSpecified = true;
+
+   if(ArraySize == M_DEFAULT)
+      {
+      InternalArraySizeSpecified = false;
+      ArraySize = 0;
+      ArraySize = MimGet(ContextImId, M_STRIP_HLVLDATATYPE(GetType), M_NULL, M_NULL, M_NULL, ControlFlag);
+      }
+
+   if(ArraySize >= 0)
+      {
+      Param1Ptr.resize(ArraySize);
+      Param2Ptr.resize(ArraySize);
+      }
+
+   // Call the original function in case the ArraySize parameter is specified.
+   // It is to allow the MIL function to pop an MIL error if the ArraySize is invalid.
+   // But, if the ArraySize is M_DEFAULT and that M3dmapGet outputs an MIL error,
+   // the following condition will ensure to not recall the same function.
+   if(ArraySize > 0 || InternalArraySizeSpecified)
+      {
+      MIL_INT InternalNbEntriesForStdVector = MimGet(ContextImId,
+                                                  GetType,
+                                                  ArraySize,
+                                                  &Param1Ptr[0],
+                                                  &Param2Ptr[0],
+                                                  ControlFlag);
+
+      if(InternalNbEntriesForStdVector < ArraySize && ArraySize != M_DEFAULT)
+         {
+         Param1Ptr.resize(InternalNbEntriesForStdVector);
+         Param2Ptr.resize(InternalNbEntriesForStdVector);
+         }
+      return InternalNbEntriesForStdVector;
+      }
+   return 0;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimGet with only one output parameter.
+template <typename UserType>
+inline MIL_INT MFTYPE MimGet(MIL_ID                ContextImId,
+                             MIL_INT64             GetType,
+                             MIL_INT               ArraySize,
+                             std::vector<UserType> &Param1Ptr,
+                             void*                 Param2Ptr,
+                             MIL_INT64             ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(GetType) != 0)
+      SafeTypeError(MIL_TEXT("MimGet"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+#endif
+
+   GetType = M_STRIP_HLVLDATATYPE(GetType) + MilTraits<UserType>::TypeFlag;
+
+   if(ArraySize == M_DEFAULT)
+      {
+      ArraySize = 0;
+      ArraySize = MimGet(ContextImId, M_STRIP_HLVLDATATYPE(GetType), M_NULL, M_NULL, M_NULL, ControlFlag);
+      }
+   if(ArraySize >= 0)
+      Param1Ptr.resize(ArraySize);
+   if(ArraySize > 0)
+      {
+      MIL_INT InternalNbEntriesForStdVector = MimGet(ContextImId,
+                                                     GetType,
+                                                     ArraySize,
+                                                     &Param1Ptr[0],
+                                                     (UserType*)Param2Ptr,
+                                                     ControlFlag);
+      if(InternalNbEntriesForStdVector < ArraySize && ArraySize != M_DEFAULT)
+         Param1Ptr.resize(InternalNbEntriesForStdVector);
+
+      return InternalNbEntriesForStdVector;
+      }
+   return 0;
+   }
+
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimGetResult1d.
+template <typename UserType>
+inline void MFTYPE MimGetResult1d(MIL_ID                ResultImId,
+                                  MIL_INT               OffEntry,
+                                  MIL_INT               NbEntries,
+                                  MIL_INT64             ResultType,
+                                  std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(ResultType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult1d"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+   if(NbEntries <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult1d"), MIL_TEXT("NbEntries must be greater than zero."));
+      }
+#endif
+
+   ResultType = M_STRIP_HLVLDATATYPE(ResultType) + MilTraits<UserType>::TypeFlag;
+
+   UserArrayPtr.resize(NbEntries);
+
+   MimGetResult1d(ResultImId,
+                  OffEntry,
+                  NbEntries,
+                  ResultType,
+                  &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimGetResult2d.
+template <typename UserType>
+inline void MimGetResult2d(MIL_ID                ResultImId,
+                           MIL_INT               OffsetX,
+                           MIL_INT               OffsetY,
+                           MIL_INT               SizeX,
+                           MIL_INT               SizeY,
+                           MIL_INT64             ResultType,
+                           MIL_INT64             ControlFlag,
+                           std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(ResultType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult2d"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+   if(SizeX <= 0 || SizeY <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimGetResult2d"), MIL_TEXT("SizeX and SizeY must be greater than zero."));
+      }
+#endif
+
+   ResultType = M_STRIP_HLVLDATATYPE(ResultType) + MilTraits<UserType>::TypeFlag;
+
+   UserArrayPtr.resize(SizeX*SizeY);
+
+   MimGetResult2d(ResultImId,
+                  OffsetX,
+                  OffsetY,
+                  SizeX,
+                  SizeY,
+                  ResultType,
+                  ControlFlag,
+                  &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MimPut.
+template <typename UserType>
+inline void MFTYPE MimPut(MIL_ID                       ContextImId,
+                          MIL_INT64                    PutType,
+                          MIL_INT                      ArraySize,
+                          const std::vector<UserType>& Param1Ptr,
+                          const std::vector<UserType>& Param2Ptr,
+                          MIL_INT64                    ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(M_GET_HLVLDATATYPE(PutType) != 0)
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("Combination value for the required data type is not supported with std::vector overload."));
+      }
+   if(ArraySize <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("ArraySize parameter must be greater than zero."));
+      }
+   if(Param1Ptr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(Param1Ptr.size() != Param2Ptr.size())
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(ArraySize > (MIL_INT)Param1Ptr.size() && ArraySize != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MimPut"), MIL_TEXT("ArraySize parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   PutType = M_STRIP_HLVLDATATYPE(PutType) + MilTraits<UserType>::TypeFlag;
+
+   if(ArraySize == M_DEFAULT || ArraySize > (MIL_INT)Param1Ptr.size())
+      {
+      ArraySize = (MIL_INT)Param1Ptr.size();
+      }
+
+   MimPut(ContextImId,
+          PutType,
+          ArraySize,
+          &Param1Ptr[0],
+          &Param2Ptr[0],
+          ControlFlag);
+   }
+
+#if (!M_MIL_LITE)
+// ----------------------------------------------------------
+// Overloads for std::vector in MimWarpList.
+inline void MFTYPE MimWarpList(MIL_ID                         WarpParamBufId,
+                               MIL_INT64                      TransformType,
+                               MIL_INT                        NumPoints,
+                               const std::vector<MIL_DOUBLE>& SrcCoordXArrayPtr,
+                               const std::vector<MIL_DOUBLE>& SrcCoordYArrayPtr,
+                               std::vector<MIL_DOUBLE>&       DstCoordXArrayPtr,
+                               std::vector<MIL_DOUBLE>&       DstCoordYArrayPtr,
+                               MIL_INT64                      ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumPoints <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MimWarpList"), MIL_TEXT("NumPoints parameter must be greater than zero."));
+      }
+   if(SrcCoordXArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MimWarpList"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(SrcCoordXArrayPtr.size() != SrcCoordYArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MimWarpList"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumPoints > (MIL_INT)SrcCoordXArrayPtr.size() && NumPoints != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MimWarpList"), MIL_TEXT("NumPoints parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumPoints == M_DEFAULT || NumPoints > (MIL_INT)SrcCoordXArrayPtr.size())
+      {
+      NumPoints = (MIL_INT)SrcCoordXArrayPtr.size();
+      }
+
+   DstCoordXArrayPtr.resize(NumPoints);
+   DstCoordYArrayPtr.resize(NumPoints);
+
+   MimWarpList(WarpParamBufId,
+               TransformType,
+               NumPoints,
+               &SrcCoordXArrayPtr[0],
+               &SrcCoordYArrayPtr[0],
+               &DstCoordXArrayPtr[0],
+               &DstCoordYArrayPtr[0],
+               ControlFlag);
+   }
+#endif // (!MIL_LITE)
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MxxxStream.
+inline void MFTYPE MimStream(std::vector<MIL_UINT8>  &MemPtrOrFileName,
+                               MIL_ID                 SysId,
+                               MIL_INT64              Operation,
+                               MIL_INT64              StreamType,
+                               MIL_DOUBLE             Version,
+                               MIL_INT64              ControlFlag,
+                               MIL_ID*                McontextIdPtr,
+                               MIL_INT*               SizeByteVarPtr)
+   {
+   MxxxStreamForStdVector(MemPtrOrFileName,
+                          SysId,
+                          Operation,
+                          StreamType,
+                          Version,
+                          ControlFlag,
+                          McontextIdPtr,
+                          SizeByteVarPtr,
+                          MimStream);
+   }
+#endif // defined(M_MIL_USE_VECTOR) && M_MIL_USE_VECTOR
+
+#if M_MIL_USE_STRING
+/***************************************************************************/
+/* IM MODULE                                                               */
+/***************************************************************************/
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+inline void MFTYPE MimSaveW(const MIL_STRING& FileName, MIL_ID ContextImId, MIL_INT64 ControlFlag)
+   {
+   return MimSaveW(FileName.c_str(), ContextImId, ControlFlag);
+   }
+
+inline MIL_ID MFTYPE MimRestoreW(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_ID* ContextImIdPtr)
+   {
+   return MimRestoreW(FileName.c_str(), SysId, ControlFlag, ContextImIdPtr);
+   }
+#else
+inline void MFTYPE MimSaveA(const MIL_STRING& FileName, MIL_ID ContextImId, MIL_INT64 ControlFlag)
+   {
+   return MimSaveA(FileName.c_str(), ContextImId, ControlFlag);
+   }
+
+inline MIL_ID MFTYPE MimRestoreA(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_ID* ContextImIdPtr)
+   {
+   return MimRestoreA(FileName.c_str(), SysId, ControlFlag, ContextImIdPtr);
+   }
+#endif /* M_MIL_UNICODE_API */
+#else
+inline void MFTYPE MimSave(const MIL_STRING& FileName, MIL_ID ContextImId, MIL_INT64 ControlFlag)
+   {
+   return MimSave(FileName.c_str(), ContextImId, ControlFlag);
+   }
+
+inline MIL_ID MFTYPE MimRestore(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_ID* ContextImIdPtr)
+   {
+   return MimRestore(FileName.c_str(), SysId, ControlFlag, ContextImIdPtr);
+   }
+#endif /* M_MIL_USE_UNICODE */
+#endif /* M_MIL_USE_STRING */
+
+////////////////////////////////////////////////////////////////////////////////
+// MIL_UNIQUE_ID support
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+#if M_MIL_USE_SAFE_TYPE
+template <> inline bool MilIsCorrectObjectType<&MimFree>(MIL_INT64 ObjectType)
+   {
+   const MIL_INT64 AllImTypes = M_IM_ALLOC_RESULT_BUFFER_TYPES | M_IM_CONTEXT | M_IM_RESULT_OBJECT_TYPES;
+   return (ObjectType & M_USER_ATTRIBUTE) == 0 && (ObjectType & AllImTypes) != 0;
+   }
+#endif
+
+typedef MIL_UNIQUE_ID<&MimFree> MIL_UNIQUE_IM_ID;
+
+#if M_MIL_USE_MOVE_SEMANTICS
+
+inline MIL_UNIQUE_IM_ID MimAlloc(MIL_ID SysId, MIL_INT64 ContextType, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_IM_ID(MimAlloc(SysId, ContextType, ControlFlag, M_NULL));
+   }
+inline MIL_UNIQUE_IM_ID MimAllocResult(MIL_ID SysId, MIL_INT NbEntries, MIL_INT64 ResultType, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_IM_ID(MimAllocResult(SysId, NbEntries, ResultType, M_NULL));
+   }
+inline MIL_UNIQUE_IM_ID MimRestore(MIL_CONST_TEXT_PTR FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_IM_ID(MimRestore(FileName, SysId, ControlFlag, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_IM_ID MimRestore(const MIL_STRING& FileName, MIL_ID SysId, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_IM_ID(MimRestore(FileName, SysId, ControlFlag, M_NULL));
+   }
+#endif // M_MIL_USE_STRING
+template <MilFreeFuncType FreeFunc> inline void MimFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+inline void MimDeinterlace(
+      MIL_ID               DeinterlaceContextImId,
+      MilConstArrayIdParam SrcImageArrayPtr      ,
+      MilConstArrayIdParam DstImageArrayPtr      ,
+      MIL_INT              SrcImageCount         ,
+      MIL_INT              DstImageCount         ,
+      MIL_INT64            ControlFlag           )
+   {
+   MimDeinterlace(DeinterlaceContextImId, SrcImageArrayPtr.m_IdArrayPtr, DstImageArrayPtr.m_IdArrayPtr,
+                  SrcImageCount, DstImageCount, ControlFlag);
+   }
+
+inline void MimStream(MilStreamParam     MemPtrOrFileName,
+                      MIL_ID             SysId           ,
+                      MIL_INT64          Operation       ,
+                      MIL_INT64          StreamType      ,
+                      MIL_DOUBLE         Version         ,
+                      MIL_INT64          ControlFlag     ,
+                      MIL_UNIQUE_IM_ID*  ContextImIdPtr  ,
+                      MIL_INT*           SizeByteVarPtr  )
+   {
+   MxxxStreamForMilUniqueId(MemPtrOrFileName, SysId, Operation, StreamType, Version, ControlFlag, ContextImIdPtr, SizeByteVarPtr, MimStream);
+   }
+
+#endif // M_MIL_USE_MOVE_SEMANTICS
+#endif // M_MIL_USE_MIL_UNIQUE_ID
+
+// End of MIL_UNIQUE_ID support
+////////////////////////////////////////////////////////////////////////////////
+
+#endif //__MILIM_H__
diff --git a/Lib/Matrox/Include/Mil.h b/Lib/Matrox/Include/Mil.h
new file mode 100644
index 0000000..6cb8da4
--- /dev/null
+++ b/Lib/Matrox/Include/Mil.h
@@ -0,0 +1,11819 @@
+锘�
+/************************************************************************/
+/*
+*
+* Filename     :  MIL.H
+* Revision     :  10.40.0640
+* Content      :  This file contains the defines necessary to use the
+*                 Matrox Imaging Library "C" user interface.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+
+#ifndef __MIL_H
+#define __MIL_H
+
+/************************************************************************/
+/* Support for old defines name                                         */
+/************************************************************************/
+#ifndef OldDefinesSupport
+   #define OldDefinesSupport     1
+#endif
+
+/* Hide deprecated defines and functions from Intellisense. */
+#ifdef __INTELLISENSE__
+   #undef  OldDefinesSupport
+   #define OldDefinesSupport     0
+   #define M_HIDE_DEPRECATED_FROM_INTELLISENSE 1
+#else
+   #define M_HIDE_DEPRECATED_FROM_INTELLISENSE 0
+#endif
+
+/************************************************************************/
+/* DEFAULT SETUP FLAG */
+/************************************************************************/
+
+/* include set-up instructions (if not specified) */
+#include <milsetup.h>
+
+/* include mil memory allocator when needed */
+#if defined(M_MIL_USE_MEMORY_ALLOCATOR) && M_MIL_USE_MEMORY_ALLOCATOR
+#if M_MIL_USE_RT
+   #include <wince/milmem.h>
+#else
+   #include <milmem.h>
+#endif
+#endif
+
+/************************************************************************/
+/* MIL buffer identifier type                                           */
+/************************************************************************/
+#if M_MIL_USE_64BIT
+#define M_MIL_USE_INT64_ID 1
+#endif
+
+#if defined(M_USE_MBUFBLIT) && !(M_MIL_USE_LINUX)
+#include <memory.h>  // for memset()
+#include <mddraw.h>   // for lpdirectdrawsurface
+#endif
+
+/************************************************************************/
+/* MIL OS support                                                       */
+/************************************************************************/
+#include <milos.h>
+
+
+/************************************************************************/
+/* MIL HOST CURRENT VERSION  (Inquired by MappInquire)                  */
+/************************************************************************/
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_MIL_CURRENT_VERSION             10.00
+   #define M_MIL_CURRENT_INT_VERSION         0x1000
+   #define M_MIL_CURRENT_ASCII_VERSION       "10.00"
+   #define M_MIL_CURRENT_MT_VERSION          MIL_TEXT("10.00")
+
+   #define M_CURRENT_DATAGRAM_VERSION        1000
+   #define M_CURRENT_DATAGRAM_ASCII_VERSION  "10.00"
+   #define M_CURRENT_DATAGRAM_MT_VERSION     MIL_TEXT("10.00")
+#else
+   #define M_MIL_CURRENT_VERSION             10.60
+   #define M_MIL_CURRENT_INT_VERSION         0x1060
+   #define M_MIL_CURRENT_ASCII_VERSION       "10.60"
+   #define M_MIL_CURRENT_MT_VERSION          MIL_TEXT("10.60")
+
+   #define M_CURRENT_DATAGRAM_VERSION        1060
+   #define M_CURRENT_DATAGRAM_ASCII_VERSION  "10.60"
+   #define M_CURRENT_DATAGRAM_MT_VERSION     MIL_TEXT("10.60")
+#endif
+
+#define M_DMILTCP_TRANSPORT_PROTOCOL   MIL_TEXT("dmiltcp")
+#define M_DMILPCIE_TRANSPORT_PROTOCOL  MIL_TEXT("dmilpcie")
+#define M_DMILSHM_TRANSPORT_PROTOCOL   MIL_TEXT("dmilshm")
+#define M_DMILSHMRT_TRANSPORT_PROTOCOL MIL_TEXT("dmilshmrt")
+#define M_DMIL_CLUSTER_PROTOCOL        MIL_TEXT("dmilcluster")
+
+
+/************************************************************************/
+/* MIL DIRECTX SERVICE                                                  */
+/************************************************************************/
+#if M_MIL_USE_WINDOWS && !M_MIL_USE_RT
+   #define M_MIL_USE_DIRECTX_SERVICE 1
+#elif M_MIL_USE_LINUX
+   #define M_MIL_USE_DIRECTX_SERVICE 0
+#else
+   #define M_MIL_USE_DIRECTX_SERVICE 0
+#endif
+
+/************************************************************************
+ * MIL Highlevel processing pack versions
+ * Those version numbers are used only by the highlevel module and must NOT
+ * be confused with M_MIL_CURRENT_VERSION and MappInquire(...M_VERSION...)
+ * The define serves for the MxxxStream function of each highlevel module
+ ************************************************************************/
+// DO NOT CHANGE THOSE VALUES
+#define M_PROC_VERSION_75        7.5
+#define M_PROC_VERSION_75_PP1    7.51
+#define M_PROC_VERSION_80        8.0
+#define M_PROC_VERSION_80_PP1    8.1
+#define M_PROC_VERSION_80_PP2    8.2
+#define M_PROC_VERSION_80_PP3    8.3
+#define M_PROC_VERSION_80_PP4    8.4
+#define M_PROC_VERSION_90        9.0
+#define M_PROC_VERSION_90_PP1    9.1
+#define M_PROC_VERSION_90_PP2    9.2
+#define M_PROC_VERSION_100       10.0
+#define M_PROC_VERSION_100_PP1   10.10
+#define M_PROC_VERSION_100_PP2   10.20
+#define M_PROC_VERSION_100_PP3   10.30
+#define M_PROC_VERSION_100_SP4   10.40
+
+#define M_PROC_CURRENT_VERSION   M_PROC_VERSION_100_SP4
+
+#if defined(M_MIL_USE_INT64_ID) && M_MIL_USE_INT64_ID
+   typedef  MIL_INT64  MIL_ID;
+#else
+   typedef  MIL_INT32  MIL_ID;
+#endif
+
+/************************************************************************/
+/* MIL HighLevel Context File Data type                                 */
+/************************************************************************/
+#define M_MIL_USE_INT64_DATA_FILES 0
+#if M_MIL_USE_INT64_DATA_FILES
+   typedef MIL_INT64 FILE_DATA_TYPE;
+#else
+   typedef MIL_INT32 FILE_DATA_TYPE;
+#endif
+
+
+/************************************************************************/
+/* General default parameters (may be bit encoded)                      */
+/************************************************************************/
+#define M_NULL                                           0
+
+#if M_MIL_USE_LINUX && M_MIL_USE_64BIT
+   #define MAKE_INT64(I)        (I ## L)
+   #define MAKE_UINT64(I)       (I ## LU)
+#elif M_MIL_USE_LINUX || (defined(__GNUC__) && __GNUC__)
+   #define MAKE_INT64(I)        (I ## LL)
+   #define MAKE_UINT64(I)       (I ## LLU)
+#elif M_MIL_USE_WINDOWS
+   #define MAKE_INT64(I)        (I##I64)
+   #define MAKE_UINT64(I)       (I##Ui64)
+#else
+   #define MAKE_INT64(I)        (I)
+   #define MAKE_UINT64(I)       (I)
+#endif
+
+// Make constant value
+#if M_MIL_USE_64BIT
+   #define MIL_MAKE_CONST(X32, X64) (MAKE_INT64(X64))
+#else
+   #define MIL_MAKE_CONST(X32, X64) (X32)
+#endif
+
+/*Pseudo IDs*/
+#define M_PSEUDO_ID                                   0x00800000L
+#define M_DEFAULT_LUT                                 (M_PSEUDO_ID+1)
+#define M_PSEUDO_LUT                                  (M_PSEUDO_ID+2)
+#define M_ALL_DISPLAYS                                (M_PSEUDO_ID+3)
+#define M_INDIAN_PATTERN                              (M_PSEUDO_ID+4)   // Use in Indian display scheme
+#define M_TRANSIENT_PATTERN                           (M_PSEUDO_ID+5)   // Use in Transient display scheme
+#define M_DISPLAY_SERVICE                             (M_PSEUDO_ID+6)   // Used for control/inquires not specific to one display.
+#define M_DEFAULT_ERROR_CONTEXT                       (M_PSEUDO_ID+7)   // Used as a pseudo func ID for MfuncErrorReport.
+#define M_DEFAULT_UNIFORM_CALIBRATION                 (M_PSEUDO_ID+8)   // Used as a pseudo calibration object ID
+#define M_DIRECTX_SERVICE                             (M_PSEUDO_ID+9)   // Used for control/inquires related to video device of DirectX.
+#define M_DEFAULT_EXTENDED_DEPTH_OF_FIELD_CONTEXT     (M_PSEUDO_ID+10)  // Used as a pseudo registration extended depth of field with default controls.
+#define M_IDENTITY_MATRIX                             (M_PSEUDO_ID+11)  // Used as a pseudo matrix of type identity
+
+#if(MIL_COMPILE_VERSION >= 1040)
+#define M_COLORMAP_JET                                (M_PSEUDO_ID+12)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_HOT                                (M_PSEUDO_ID+13)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_HUE                                (M_PSEUDO_ID+14)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_SPECTRUM                           (M_PSEUDO_ID+15)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#endif
+#define M_MULTIPLE_IDS                                (M_PSEUDO_ID+17)  // Used by MbufInquireContainer
+
+#define M_COLORMAP_TURBO                              (M_PSEUDO_ID+16)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+
+#define M_XY_PLANE                                    (M_PSEUDO_ID+18)  //Used as a pseudo Id for plane geometry Z=0
+#define M_WHOLE_SCENE                                 (M_PSEUDO_ID+19)  //Used as a pseudo box that contains the entire 3d display scene
+
+#define M_COLORMAP_DISTINCT_256                       (M_PSEUDO_ID+20)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+
+#define M_3DIM_PSEUDO_ID                              (0x00200000L|M_PSEUDO_ID)
+#define M_ID_OFFSET_OF_DEFAULT_KERNEL                 (0x00100000L|M_PSEUDO_ID)
+/*Reserve 256 values*/
+/*#define M_ID_OFFSET_OF_DEFAULT_KERNEL                 (0x00100000L|M_PSEUDO_ID + 255)*/
+
+#define M_IS_PSEUDO_ID(X)                             (X&M_PSEUDO_ID)
+#define M_IS_VIDEO_DEVICE_INDEX(a)                    ((a>=M_DEV0) && (a<M_MAX_VIDEO_DEVICE))        
+#define M_IS_VIDEO_DEVICE_ID(a)                       ((a>=M_VIDEO_DEVICE_ID) && (a<M_VIDEO_DEVICE_ID+M_MAX_VIDEO_DEVICE))
+#define M_VIDEO_DEVICE_INDEX_FROM_ID(a)               ((M_IS_VIDEO_DEVICE_ID(a)) ? ((a) - M_VIDEO_DEVICE_ID) : M_INVALID)
+#define M_MAKE_VIDEO_DEVICE_ID(a)                     (M_IS_VIDEO_DEVICE_INDEX(a) ? (M_VIDEO_DEVICE_ID+a) : M_NULL)
+#define M_OVERSCAN_DISABLE                            0x00080000L
+
+
+//////////////////////////////////////////////////////////////////////////////
+// MIL_ID manipulation macros
+// Id use the following representation:
+// SNNN NNNN PRRR XXXX XXXX XXXX XXXX XXXX
+//
+// where
+//    S: Sign bit (can't be used)
+//    N: Cluster node
+//    P: Pseudo-id
+//    O: ONL system number
+//    B: ONL board number
+//    X: Id
+   
+#define M_CLUSTER_NODE_MASK            0x7F000000                 
+#define M_DEFAULT_CLUSTER_NODE_VALUE   0x7F000000                 
+   
+  
+#define M_CLUSTER_NODE_SHIFT     24                               
+#define M_NAKED_ID_MASK          0xFFFFF                          
+
+#define M_MAKE_ID(NakedId, ClusterNode)       ((((ClusterNode) << M_CLUSTER_NODE_SHIFT) & M_CLUSTER_NODE_MASK) | ((NakedId) & M_NAKED_ID_MASK))
+#define M_MAKE_DEFAULT_ID(NakedId)              M_MAKE_ID((NakedId), (M_DEFAULT_CLUSTER_NODE_VALUE >> M_CLUSTER_NODE_SHIFT))
+
+#define M_FALSE                                       0L
+#define M_NO                                          0L
+#define M_OFF                                         0L
+#define M_IN_PROGRESS                                 0L
+#define M_OUTSIDE                                     0L
+#define M_INSIDE                                      1L
+#define M_FINISHED                                    1L
+#define M_TRUE                                        1L
+#define M_YES                                         1L
+#define M_ON                                          1L
+#define M_WAIT                                        1L
+#define M_CREATE                                      M_YES
+#define M_FREE                                        0x00020000
+#define M_UNICODE_CLIENT                              0x01000000L
+#define M_ASCII_CLIENT                                0x04000000L
+#define M_QUIET                                       0x08000000L
+#define M_DEFAULT                                     0x10000000L
+#define M_VALID                                       0x00000001L
+#define M_INVALID                                     -1
+#define M_UNKNOWN                                     -9999L
+#define M_CLEAR                                       0x00000001L
+#define M_NO_CLEAR                                    0x00000002L
+#define M_ENABLE                                      -9997L
+#define M_DISABLE                                     -9999L
+#define M_CONFIG                                      0x20000000L
+#define M_LOCAL                                       0x01000000	// Also defined in milmeas.h
+#define M_REMOTE                                      0x00000000
+#define M_WEB                                         0x00800000L // Also defined in mildisplay.h
+#define M_CUSTOM                                      2
+#define M_OFFICIAL                                    3
+#define M_SKIP_CHECK                                  2
+#define M_OS_CONTROLLED                               -9990L
+#define M_OS_DEFAULT                                  -9991L
+#define M_WITH_COMPENSATION                           2
+#define M_FIRST                                       0x10000000
+#define M_LAST                                        0x20000000L
+
+// Offset for Web publishing
+#define M_MAX_WEBSOCKET_SERVER                          5
+#define M_DEFAULT_WEB_OFFSET                            0
+#define M_USER1_WEB_OFFSET                              1
+#define M_USER2_WEB_OFFSET                              2
+#define M_FB_WEB_OFFSET                                 3
+#define M_DA_WEB_OFFSET                                 4
+
+// Control values for M_TEST_IMAGE
+#define M_GREY_DIAGONAL_RAMP                          2
+#define M_GREY_DIAGONAL_RAMP_MOVING                   3
+ 
+
+#define M_UNINITIALIZED                               0x0badbad0
+#define M_STATUS_UNINITIALIZED                        0x0bad      // for CallStatus in Datagram
+
+#define M_KEEP_IN_QUEUE                               0x00000100L
+#define M_OVERWRITE                                   1861L       // Already defined in mil3dim.h
+#define M_QUEUE                                       0x00000400
+
+#define M_NO_TIMEOUT                                  0x00000800
+#define M_BUFFER_TOO_SMALL                            1
+#define M_SUCCESS                                     0x00000000L // Already defined in milreg.h, milcolor.h
+
+#define M_ALL                                         0x40000000L
+#define M_ANY                                         0x11000000L
+#define M_SAME                                                -1L
+#define M_INVALID_MDID                                0x40000000L
+#define M_ALWAYS                                               0L  // defined in Milblob.h
+#define M_FOREVER                                             -1   // Same as in mildrv.h
+
+// Macro used to process M_DEFAULT
+#define PROCESS_M_DEFAULT(VALUE, REPLACEMENT_VALUE) if((VALUE) == M_DEFAULT) {(VALUE) = (REPLACEMENT_VALUE);}
+
+// Macro for M_INDSIDE & M_OUTSIDE
+#define M_IS_MOUSE_OUTSIDE(v) (((M_OUTSIDE == v) || (M_ENABLE == v))? M_YES: M_NO)
+#define M_IS_MOUSE_INSIDE(v) ((M_INSIDE == v)? M_YES: M_NO)
+
+#if MIL_COMPILE_VERSION < 1010
+#define M_MAX_INSTALLED_SYSTEMS 16
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_MAX_INSTALLED_SYSTEMS 16
+#endif
+
+#define M_MAX_SYSTEMS_PER_TYPE         16
+#if MIL_COMPILE_VERSION >= 1010
+#define M_MAX_INSTALLED_SYSTEM_TYPES   64
+#else
+#define M_MAX_INSTALLED_SYSTEM_TYPES   16
+#endif
+#define M_MAX_FINGERPRINTS_PER_TYPE M_MAX_SYSTEMS_PER_TYPE
+
+/************************************************************************/
+/* MIL_UUID Data type                                                    */
+/************************************************************************/
+
+#if defined(_MSC_VER) && (_MSC_VER < 1910)
+#ifdef __cplusplus
+#define MIL_UUID_C_INLINE __forceinline
+#else
+   #define MIL_UUID_C_INLINE static __forceinline
+#endif
+#else
+#ifdef __cplusplus
+#define MIL_UUID_C_INLINE inline
+#else
+   #define MIL_UUID_C_INLINE static inline
+#endif
+#endif
+
+typedef struct
+   {
+   MIL_UINT32 Data1;
+   MIL_UINT16 Data2;
+   MIL_UINT16 Data3;
+   MIL_UINT8  Data4[8];
+   } __MIL_WGUID;
+
+typedef struct
+   {
+   union
+      {
+      MIL_UINT64  U64s[2];
+      __MIL_WGUID MilGuid;
+      MIL_UINT8   Bytes[16];
+      } Data;
+   } MIL_UUID;
+
+MIL_UUID_C_INLINE MIL_UUID MIL_MAKE_DEFAULT_UUID()
+   {
+   MIL_UUID DefaultMilUuid;
+   DefaultMilUuid.Data.U64s[0] = M_DEFAULT;
+   DefaultMilUuid.Data.U64s[1] = M_DEFAULT;
+   return DefaultMilUuid;
+   }
+
+MIL_UUID_C_INLINE MIL_UUID MIL_MAKE_NULL_UUID()
+   {
+   MIL_UUID NullKey;
+   NullKey.Data.U64s[0] = 0;
+   NullKey.Data.U64s[1] = 0;
+   return NullKey;
+   }
+
+MIL_UUID_C_INLINE int _INT_MIL_COMPARE_UUID(MIL_UUID A, MIL_UUID B)
+   { return (int) ((A.Data.U64s[0] == B.Data.U64s[0]) && (A.Data.U64s[1] == B.Data.U64s[1])); }
+
+
+#define M_DEFAULT_UUID MIL_MAKE_DEFAULT_UUID()
+#define M_NULL_UUID MIL_MAKE_NULL_UUID()
+
+#ifdef __cplusplus
+
+#define M_COMPARE_MIL_UUID(A, B) ((bool)(_INT_MIL_COMPARE_UUID((A), (B)) != 0))
+#define M_IS_DEFAULT_UUID(A) ((bool)(_INT_MIL_COMPARE_UUID((A), M_DEFAULT_UUID) != 0))
+#define M_IS_NULL_UUID(A) ((bool)(_INT_MIL_COMPARE_UUID((A), M_NULL_UUID) != 0))
+
+inline bool operator==(const MIL_UUID& A, const MIL_UUID& B) { return  M_COMPARE_MIL_UUID(A, B); }
+inline bool operator!=(const MIL_UUID& A, const MIL_UUID& B) { return !M_COMPARE_MIL_UUID(A, B); }
+inline bool operator< (const MIL_UUID& A, const MIL_UUID& B)
+   {
+   if(A.Data.U64s[0] < B.Data.U64s[0]) { return true; }
+   else if(A.Data.U64s[0] > B.Data.U64s[0]) { return false; }
+   return (A.Data.U64s[1] < B.Data.U64s[1]);
+   }
+
+#else // 'C'
+
+#define M_COMPARE_MIL_UUID(A, B)    _INT_MIL_COMPARE_UUID((A), (B))
+#define M_IS_DEFAULT_UUID(A)        _INT_MIL_COMPARE_UUID((A), M_DEFAULT_UUID)
+#define M_IS_NULL_UUID(A)           _INT_MIL_COMPARE_UUID((A), M_NULL_UUID)
+
+#endif //__cplusplus
+
+
+/************************************************************************/
+/* Board generic information.                                           */
+/************************************************************************/
+#define M_RS170                                       0x00000001L
+#define M_NTSC                                        0x00000002L
+#define M_CCIR                                        0x00000003L
+#define M_PAL                                         0x00000004L
+#define M_NTSC_RGB                                    0x00000005L
+#define M_PAL_RGB                                     0x00000006L
+#define M_SECAM_RGB                                   0x00000007L
+#define M_SECAM                                       0x00000008L
+/* Reserve next 2 values                       from   0x00000009L*/
+/*                                             to     0x0000000AL*/
+
+/************************************************************************/
+/* Iris Product select the type of lighting environment                 */
+/************************************************************************/
+
+#define M_LIGHT_INDOOR                                0x0L
+#define M_LIGHT_OUTDOOR                               0x1L
+
+/************************************************************************/
+/* PCIe Product SysInquire for M_PCIE_SPEED and M_PCIE_SPEED_MAX        */
+/************************************************************************/
+
+#define M_GEN1                                        0x1L
+#define M_GEN2                                        0x2L
+#define M_GEN3                                        0x3L
+#define M_INVALID                                     -1
+
+
+/************************************************************************/
+/* Buffer Type and SizeBit                                              */
+/************************************************************************/
+// #define M_SIZE_BIT_1                               0x00000001 
+// #define M_SIZE_BIT_8                               0x00000008 
+// #define M_SIZE_BIT_16                              0x00000010 
+// #define M_SIZE_BIT_32                              0x00000020 
+// #define M_SIZE_BIT_64                              0x00000040 
+#define M_SIZE_BIT_MASK                               0x000000FFL
+
+#define M_NO_TYPE                                     0x00100000L
+#define M_ANY_TYPE                                    0x10000000L    // Represents any type, including signed and unsigned 
+#define M_ANY_SIGN                                    0x04000000L
+#define M_TYPE_META_FLAGS                             (M_ANY_SIGN+M_ANY_TYPE+M_NO_TYPE)
+
+#define M_UNSIGNED                                    0x00000000L
+#define M_SIGNED                                      0x08000000L
+#define M_FLOAT                                      (0x40000000L | M_SIGNED)
+#define M_EXACT_IN_DOUBLE                             0x80000000L
+#define M_PFNC                                        MAKE_INT64(0x100000000)
+#define M_PFNC_COMPACT                                (0x20000000)
+
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_PFNC_TO_TYPE(X)                             (M_PFNC_COMPACT | ((X) & 0xFFFF))
+#define M_IS_PFNC_TYPE(X)                             (((((X) & M_PFNC_COMPACT) == M_PFNC_COMPACT) && (((X) & ~M_PFNC_TO_TYPE(0xFFFF)) == 0)) || (((X) & 0xFFFFFFFF00000000) == M_PFNC))
+#else
+//#define M_PFNC_TO_TYPE(X)                             (M_PFNC | (X))
+//#define M_IS_PFNC_TYPE(X)                             (((X) & M_PFNC) == M_PFNC)
+#define M_PFNC_TO_TYPE(X)                             (M_PFNC_COMPACT | ((X) & 0xFFFF))
+#define M_IS_PFNC_TYPE(X)                             (((((X) & M_PFNC_COMPACT) == M_PFNC_COMPACT) && (((X) & ~M_PFNC_TO_TYPE(0xFFFF)) == 0)) || (((X) & 0xFFFFFFFF00000000) == M_PFNC))
+#endif
+#define M_PFNC_TO_TYPE_AS_IS(X)                       ((X) | M_PFNC)
+
+
+#define M_TYPE_MASK                                   0x7FFFFF00L
+#define M_TYPE_SIGN_MASK                              (M_ANY_SIGN|M_UNSIGNED|M_SIGNED)
+#define M_COMPLETE_TYPE                               (M_TYPE_MASK|M_SIZE_BIT_MASK)
+
+/************************************************************************/
+/* MMX related                                                          */
+/************************************************************************/
+#define M_READ_PREFETCH_EXTRA_BYTES                   32
+
+// Kept for backward compatibility.
+#define M_MMX_EXTRA_BYTES                             M_READ_PREFETCH_EXTRA_BYTES
+
+// Default values for memory allocators. Can be overridden at run-
+// time by any OS-specific version of the MIL memory allocator
+#define M_MEMORY_ALLOC_PRE_PADDING_VALUE             M_READ_PREFETCH_EXTRA_BYTES
+#define M_MEMORY_ALLOC_POST_PADDING_VALUE            M_READ_PREFETCH_EXTRA_BYTES
+#define M_MEMORY_ALLOC_PITCH_BYTE_VALUE              1
+#define M_MEMORY_ALLOC_ALIGNMENT_VALUE               128
+
+/************************************************************************/
+/* Non cachable related                                                 */
+/************************************************************************/
+#define M_NO_ALIGNMENT                               -1
+#define M_4K_ALIGNMENT                                4096
+
+
+/************************************************************************/
+/* Multi thread                                                         */
+/************************************************************************/
+#define M_HOST_THREAD                                 0x00000002L
+#define M_MIL_THREAD                                  0x00000004L
+#define M_STATE                                       0x00000008L
+#define M_SIGNALED                                    0x00000010L
+#define M_NOT_SIGNALED                                0x00000020L
+#define M_THREAD_DETACH                               0x00000080L
+#define M_AUTO_RESET                                  0x00002000L
+#define M_MANUAL_RESET                                0x00004000L
+
+#define M_IDLE                                                 1L
+#define M_LOWEST                                               6L
+#define M_BELOW_NORMAL                                         7L
+#define M_NORMAL                                               8L
+#define M_ABOVE_NORMAL                                         9L
+#define M_HIGHEST                                             10L
+#define M_TIME_CRITICAL                                       15L
+
+#define M_THREAD_PRIORITY                             1019L
+#define M_EVENT_ALLOC                                 1700L
+#define M_EVENT_FREE                                  1701L
+#define M_EVENT_SEND                                  1702L
+#define M_EVENT_CONTROL                               1703L
+
+#define M_DEFAULT                                     0x10000000L
+#define M_THREAD_WAIT                                 0x01000000L
+#define M_EVENT_WAIT                                  0x20000000L
+#define M_EVENT_STATE                                 1706L
+#define M_EVENT_SET                                   1707L
+
+#define M_THREAD_ALLOC                                1800L
+#define M_THREAD_FREE                                 1801L
+#define M_THREAD_CONTROL                              1803L
+#define M_THREAD_MODE                                 1804L
+#define M_THREAD_IO_MODE                              1805L
+
+/************************************************************************/
+/* Inter-module defines                                                 */
+/************************************************************************/
+#define M_INTERMOD_MASK                               MAKE_INT64(0xFFFFFFFC00000000)
+#define M_STRIP_INTERMOD_BITS(X)                      ((X) & ~M_INTERMOD_MASK)
+#define M_GET_INTERMOD_BITS(X)                        ((X) & M_INTERMOD_MASK)
+
+#define M_HLVLDATATYPE_MASK                           MAKE_INT64(0x000000F000000000)
+#define M_TYPE_CHAR                                   MAKE_INT64(0x0000001000000000) // used in highlvl modules
+#define M_TYPE_MIL_INT16                              MAKE_INT64(0x0000002000000000) // used in highlvl modules
+#define M_TYPE_SHORT                                  M_TYPE_MIL_INT16               // used in highlvl modules
+#define M_TYPE_MIL_INT32                              MAKE_INT64(0x0000003000000000) // used in highlvl modules and mil
+#define M_TYPE_FLOAT                                  MAKE_INT64(0x0000004000000000) // used in highlvl modules
+#define M_TYPE_DOUBLE                                 MAKE_INT64(0x0000005000000000) // used in highlvl modules and mil
+#define M_TYPE_MIL_ID                                 MAKE_INT64(0x0000006000000000) // used in highlvl modules, drivers and mil
+#define M_TYPE_STRING                                 MAKE_INT64(0x0000007000000000) // used in mil, dmil, drivers, highlvl modules
+#define M_TYPE_MIL_INT64                              MAKE_INT64(0x0000008000000000) // Type switch for 32/64 bits support in highlvl modules
+#define M_TYPE_MIL_TEXT                               MAKE_INT64(0x0000009000000000) // used in highlvl modules
+#define M_TYPE_MIL_UINT8                              MAKE_INT64(0x000000A000000000) // used in highlvl modules
+#define M_TYPE_MIL_UUID                               MAKE_INT64(0x000000B000000000) // used in highlvl modules
+
+#define M_STRIP_HLVLDATATYPE(X)                       ((X) & ~M_HLVLDATATYPE_MASK)
+#define M_GET_HLVLDATATYPE(X)                         ((X) & M_HLVLDATATYPE_MASK)
+
+#define M_INTERMOD_VALUE_MASK                         MAKE_INT64(0x00000F0000000000)
+#define M_MIN_VALUE                                   MAKE_INT64(0x0000010000000000)
+#define M_MAX_VALUE                                   MAKE_INT64(0x0000020000000000)
+#define M_DEFAULT_VALUE                               MAKE_INT64(0x0000030000000000)
+#if OldDefinesSupport
+#define M_INCREMENT                                   MAKE_INT64(0x0000040000000000)   // Deprecated for MdigInquire/ControlFeature() use M_FEATURE_INCREMENT
+MIL_DEPRECATED(M_INCREMENT, 1000)                     // New Control Feature API Replaced by M_FEATURE_INCREMENT
+#endif
+
+#define M_STRING_SIZE                                 MAKE_INT64(0x0000050000000000)
+#define M_FEATURE_USER_ARRAY_SIZE_BITS                MAKE_INT64(0x0000060000000000)
+#define M_STRING_LENGTH                               M_STRING_SIZE
+#define M_NB_ELEMENTS                                 MAKE_INT64(0x0000070000000000)
+#define M_GET_INTERMOD_VALUE_BITS(X)                  ((X) &  M_INTERMOD_VALUE_MASK)
+#define M_STRIP_INTERMOD_VALUE_BITS(X)                ((X) & ~M_INTERMOD_VALUE_MASK)
+#define M_STRING_SIZE_BIT_SET(X)                      ((M_GET_INTERMOD_VALUE_BITS(X) == M_STRING_SIZE) ? M_TRUE : M_FALSE)
+#define M_NB_ELEMENTS_BIT_SET(X)                      ((M_GET_INTERMOD_VALUE_BITS(X) == M_NB_ELEMENTS) ? M_TRUE : M_FALSE)
+#define M_STRIP_STRING_SIZE_BIT(X)                    M_STRIP_INTERMOD_VALUE_BITS(X)
+#define M_STRIP_NB_ELEMENTS_BIT(X)                    M_STRIP_INTERMOD_VALUE_BITS(X)
+#define M_FEATURE_USER_ARRAY_SIZE_BIT_SET(X)          ((M_GET_INTERMOD_VALUE_BITS(X) == M_FEATURE_USER_ARRAY_SIZE_BITS) ? M_TRUE : M_FALSE)
+#define M_STRIP_FEATURE_USER_ARRAY_SIZE_BITS(X)       M_STRIP_INTERMOD_VALUE_BITS(X)
+
+#if OldDefinesSupport
+#define M_STRING_ARRAY_SIZE_BIT                       M_FEATURE_USER_ARRAY_SIZE_BITS
+#define M_STRING_ARRAY_SIZE_BIT_SET(X)                M_FEATURE_USER_ARRAY_SIZE_BIT_SET(X)
+#define M_STRIP_STRING_ARRAY_SIZE_BIT(X)              M_STRIP_FEATURE_USER_ARRAY_SIZE_BITS(X)
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_BIT, 1060)         // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_BITS
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_BIT_SET, 1060)     // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_BIT_SET
+MIL_DEPRECATED(M_STRIP_STRING_ARRAY_SIZE_BIT, 1060)   // New Control Feature API Replaced by M_STRIP_FEATURE_USER_ARRAY_SIZE_BITS
+#endif
+
+#define M_INTERMOD_STATE_MASK                         MAKE_INT64(0x0000F00000000000)
+#define M_IS_SET_TO_DEFAULT                           MAKE_INT64(0x0000100000000000)
+#define M_AVAILABLE                                   MAKE_INT64(0x0000400000000000)
+#define M_SUPPORTED                                   MAKE_INT64(0x0000800000000000)
+#define M_GET_INTERMOD_STATE_BITS(X)                  ((X) &  M_INTERMOD_STATE_MASK)
+#define M_STRIP_INTERMOD_STATE_BITS(X)                ((X) & ~M_INTERMOD_STATE_MASK)
+
+#define M_INQ_COMBOFLAGS_MASK                         (M_HLVLDATATYPE_MASK | M_INTERMOD_VALUE_MASK | M_INTERMOD_STATE_MASK | M_DEFAULT)
+#define M_GET_INQ_COMBOFLAGS(X)                       ((X) &  M_INQ_COMBOFLAGS_MASK)
+#define M_STRIP_INQ_COMBOFLAGS(X)                     ((X) & ~M_INQ_COMBOFLAGS_MASK)
+
+#define M_CLIENT_TEXT_ENCODING                        MAKE_INT64(0x0001000000000000)
+#define M_CLIENT_ASCII_ENCODING                       MAKE_INT64(0x0001000000000000)
+
+#define M_CLIENT_ASCII_ENCODING_SET(X)                ((((X) & M_CLIENT_TEXT_ENCODING) == M_CLIENT_ASCII_ENCODING) ? true : false)
+#define M_STRIP_CLIENT_TEXT_ENCODING(X)               ((X) & ~M_CLIENT_TEXT_ENCODING)
+#define M_GET_CLIENT_TEXT_ENCODING(X)                 ((X) & M_CLIENT_TEXT_ENCODING)
+
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#if M_MIL_USE_UNICODE && !M_MIL_UNICODE_API
+#define     M_CLIENT_ENCODING       M_CLIENT_ASCII_ENCODING
+#else
+#define     M_CLIENT_ENCODING       0
+#endif
+#else // MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if M_MIL_USE_LINUX
+#define     M_CLIENT_ENCODING       M_CLIENT_UTF8_ENCODING
+#else // M_MIL_USE_LINUX
+#if M_MIL_UNICODE_API
+#define     M_CLIENT_ENCODING       M_CLIENT_UTF16_ENCODING
+#else // M_MIL_UNICODE_API
+#define     M_CLIENT_ENCODING       M_CLIENT_ASCII_ENCODING
+#endif   // M_MIL_UNICODE_API
+#endif   // M_MIL_USE_LINUX
+#endif   // MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_CLIENT_ASCII_MODE   M_CLIENT_ENCODING
+#define M_STRIP_CLIENT_ASCII_MODE_BIT(X)              M_STRIP_CLIENT_TEXT_ENCODING(X)
+#define M_CLIENT_ASCII_MODE_BIT_SET(X)                ((((X) & M_CLIENT_ASCII_MODE) == M_CLIENT_ASCII_MODE) ? true : false)
+#endif
+
+/************************************************************************/
+/* MsysAlloc()                                                          */
+/************************************************************************/
+/* System type */
+#define M_DEFAULT_HOST                                M_MAKE_DEFAULT_ID(1)
+#define M_DEV                                         0L
+#define M_DEV0                                        0L
+#define M_DEV1                                        1L
+#define M_DEV2                                        2L
+#define M_DEV3                                        3L
+#define M_DEV4                                        4L
+#define M_DEV5                                        5L
+#define M_DEV6                                        6L
+#define M_DEV7                                        7L
+#define M_DEV8                                        8L
+#define M_DEV9                                        9L
+#define M_DEV10                                       10L
+#define M_DEV11                                       11L
+#define M_DEV12                                       12L
+#define M_DEV13                                       13L
+#define M_DEV14                                       14L
+#define M_DEV15                                       15L
+#define M_DEV16                                       16L
+#define M_DEV17                                       17L
+#define M_DEV18                                       18L
+#define M_DEV19                                       19L
+#define M_DEV20                                       20L
+#define M_DEV21                                       21L
+#define M_DEV22                                       22L
+#define M_DEV23                                       23L
+#define M_DEV24                                       24L
+#define M_DEV25                                       25L
+#define M_DEV26                                       26L
+#define M_DEV27                                       27L
+#define M_DEV28                                       28L
+#define M_DEV29                                       29L
+#define M_DEV30                                       30L
+#define M_DEV31                                       31L
+#define M_DEV32                                       32L
+#define M_DEV33                                       33L
+#define M_DEV34                                       34L
+#define M_DEV35                                       35L
+#define M_DEV36                                       36L
+#define M_DEV37                                       37L
+#define M_DEV38                                       38L
+#define M_DEV39                                       39L
+#define M_DEV40                                       40L
+#define M_DEV41                                       41L
+#define M_DEV42                                       42L
+#define M_DEV43                                       43L
+#define M_DEV44                                       44L
+#define M_DEV45                                       45L
+#define M_DEV46                                       46L
+#define M_DEV47                                       47L
+#define M_DEV48                                       48L
+#define M_DEV49                                       49L
+#define M_DEV50                                       50L
+#define M_DEV51                                       51L
+#define M_DEV52                                       52L
+#define M_DEV53                                       53L
+#define M_DEV54                                       54L
+#define M_DEV55                                       55L
+#define M_DEV56                                       56L
+#define M_DEV57                                       57L
+#define M_DEV58                                       58L
+#define M_DEV59                                       59L
+#define M_DEV60                                       60L
+#define M_DEV61                                       61L
+#define M_DEV62                                       62L
+#define M_DEV63                                       63L
+
+#define M_GENTL_PRODUCER_BIT                          MIL_MAKE_CONST(0x80000000, 0x0000000080000000)
+#define M_GENTL_PRODUCER_MASK                         MIL_MAKE_CONST(0x7F000000, 0x000000007F000000)
+#define M_GENTL_PRODUCER_SHIFT                        24
+#define M_GENTL_PRODUCER(N)                           (M_GENTL_PRODUCER_BIT | ((N  << M_GENTL_PRODUCER_SHIFT) & M_GENTL_PRODUCER_MASK))
+
+#define M_SYSTEM_TYPE_NONE                            0L
+#define M_SYSTEM_HOST_TYPE                            1000L //Needs to be the highest value
+#define M_SYSTEM_RADIENT_TYPE                         13L
+#define M_SYSTEM_RADIENTCXP_TYPE                      14L
+#define M_SYSTEM_RADIENTCLHS_TYPE                     15L
+#define M_SYSTEM_RADIENTPRO_TYPE                      16L
+#define M_SYSTEM_RADIENTEVCL_TYPE                     17L
+#define M_SYSTEM_RAPIXOCXP_TYPE                       18L
+#define M_SYSTEM_RAPIXOCL_TYPE                        19L
+#define M_SYSTEM_1394_TYPE                            22L
+#define M_SYSTEM_MMX_TYPE                             23L
+#define M_SYSTEM_SSE_TYPE                             24L
+/* Free for future system type                        25L*/
+#define M_SYSTEM_SSE2_TYPE                            26L
+#define M_SYSTEM_AMD_3DNOW_TYPE                       27L
+#define M_SYSTEM_AMD_MMX_EXT_TYPE                     28L
+#define M_SYSTEM_AMD_3DNOW_EXT_TYPE                   29L
+/* Free for future system type                  from  31L*/
+/*                                                to  36L*/
+#define M_SYSTEM_IRIS_TYPE                            37L
+#define M_SYSTEM_CRONOSPLUS_TYPE                      38L
+#define M_SYSTEM_MORPHIS_TYPE                         39L
+#define M_SYSTEM_IRIS_GTR_TYPE                        40L
+#define M_SYSTEM_NEXIS3_TYPE                          41L
+#define M_SYSTEM_SOLIOS_TYPE                          42L
+#define M_SYSTEM_SSE3_TYPE                            43L
+#define M_SYSTEM_VIO_TYPE                             44L
+// !!!ATTENTION!!! Value used for display             45 - 56 See Below
+#define M_SYSTEM_NEXIS_TYPE                           57L
+#define M_SYSTEM_GPU_TYPE                             58L
+#define M_SYSTEM_MORPHISQXT_TYPE                      59L
+#define M_SYSTEM_GIGE_VISION_TYPE                     60L
+#define M_SYSTEM_SSE4_TYPE                            62L
+#define M_SYSTEM_USB3_VISION_TYPE                     63L
+#define M_SYSTEM_MP_TYPE                              64L
+#define M_SYSTEM_GENTL_TYPE                           65L
+#define M_SYSTEM_CONCORD_1394_TYPE                    M_SYSTEM_1394_TYPE
+#define M_SYSTEM_ORION_UHD_TYPE                       66L
+#define M_SYSTEM_CLARITY_UHD_TYPE                     66L
+#define M_SYSTEM_IRIS_GT_TYPE                         67L
+#define M_SYSTEM_ORION_HD_TYPE                        68L
+#define M_SYSTEM_NEXIS2_TYPE                          69L
+#define M_SYSTEM_HDDVR_TYPE                           71L
+#define M_SYSTEM_MATROXCOMPRESS_TYPE                  72L
+#define M_SYSTEM_AVX_TYPE                             73L
+#define M_SYSTEM_AVX2_TYPE                            74L
+#define M_SYSTEM_INDIO_TYPE                           75L
+#define M_SYSTEM_CONCORD_POE_TYPE                     76L
+#define M_SYSTEM_AVX512_TYPE                          77L
+
+
+//System Type Value used for display
+#define M_SYSTEM_DIRECTX_TYPE                         45L
+#define M_SYSTEM_MTX0_TYPE                            46L
+// Reserve dib section (10 values)
+#define M_SYSTEM_DIB_TYPE_START                       47L
+#define M_SYSTEM_DRAWDIB_TYPE                         M_SYSTEM_DIB_TYPE_START+0L    // 47
+#define M_SYSTEM_BITBLT_TYPE                          M_SYSTEM_DIB_TYPE_START+1L    // 48
+#define M_SYSTEM_STRETCHBLT_TYPE                      M_SYSTEM_DIB_TYPE_START+2L    // 49
+#define M_SYSTEM_DIBTODEV_TYPE                        M_SYSTEM_DIB_TYPE_START+3L    // 50
+#define M_SYSTEM_STRETCHDIB_TYPE                      M_SYSTEM_DIB_TYPE_START+4L    // 51
+#define M_SYSTEM_DIB_TYPE_END                         56L
+#define M_IS_SYSTEM_DIB_TYPE(t)     ((t)>=M_SYSTEM_DIB_TYPE_START && (t)<=M_SYSTEM_DIB_TYPE_END)
+
+// System type information flags
+#define M_SYSTEM_DISTRIBUTED_FLAG                     0x40000000
+#define M_SYSTEM_INFORMATION_FLAGS                    0x40000000
+#define M_IS_SYSTEM_DISTRIBUTED(t)                    (((t) & M_SYSTEM_DISTRIBUTED_FLAG) == M_SYSTEM_DISTRIBUTED_FLAG)
+#define M_REAL_SYSTEM_TYPE(t)                         ((t) & ~M_SYSTEM_INFORMATION_FLAGS)
+
+
+
+/* MsysAlloc() flags  */
+#define M_APP_ALLOC_INIT_FLAGS                        0x0FF00000L
+#define M_SYS_ALLOC_INIT_FLAGS                        0x20000FFFL
+
+#define M_COMPLETE                                    0x00000000L
+#define M_PARTIAL                                     0x00000001L
+#define M_DISPLAY_INTERNAL_USE                        0x00000002L // mil.dll
+#define M_INTERNAL_USE                                0x00000004L // mil.dll
+#define M_CREATE_SYSTEM                               0x00000008L // mil.dll
+#define M_NO_INTERRUPT                                0x00000010L
+#define M_NO_FORCE_IP                                 M_NO_INTERRUPT //For GigEVision
+#define M_UPDATE_FIRMWARES                            M_NO_INTERRUPT
+#define M_ACCELERATOR_DISABLE                         0x00000020L // For GPU
+#define M_REGISTER_EDITOR                             0x00000040L
+#define M_DEVICE_NAME                                (MAKE_INT64(0x0000001000000000) | M_CLIENT_ENCODING)
+#define M_NO_FPGA_UPGRADE                             0x20000000L
+
+//do not add defines here
+
+// Board-specific flags
+#define M_REGISTER                                    0x00000100L // For MorphisEvo
+#define M_SCAN                                        0x00000100L // For GigE
+#define M_NO_SCAN                                     0x00000200L // For GigE
+#define M_SERVICE                                     0x00000400L // For GigE
+#define M_TOLERATE_INVALID_FPGA                       0x00000800L // For Solios and Radient
+#define M_SILENT                                      0x00000100L // For GPU
+#define M_GEV                                         0x00000100L // For GenTL
+#define M_CXP                                         0x00000200L // For GenTL
+#define M_U3V                                         0x00000300L // For GenTL
+#define M_CLHS                                        0x00000400L // For GenTL
+#define M_MIXED                                       0x00000500L // For GenTL
+#define M_XCL                                         0x00000800L // For GenTL
+#define M_CL                                          M_XCL       // For GenTL
+#define M_CUSTOM_TL                                   0x00000600L // For GenTL
+#define M_FROM_ACQUISITION_DRIVER                     0x00001000L // DO NOT REUSE
+#define M_FROM_HOST_AUX_SERVICE                       0x00002000L // DO NOT REUSE
+
+#define M_DEFAULT                                     0x10000000L
+
+
+/************************************************************************/
+/* MsysInquire() / MsysControl() Types                                  */
+/************************************************************************/
+#define M_EXECUTE_BUFFER_HOOKS                        1002L
+#define M_TYPE                                        1008L
+#define M_NUMBER                                      1009L
+#define M_INIT_FLAG                                   1012L
+#define M_ATTRIBUTE                                   1013L
+#define M_NATIVE_ID                                   1016L
+#define M_THREAD_PRIORITY                             1019L
+#define M_DETECT_HOOK_THREAD                          1020L
+#define M_MAP_VIDEO_RANGE_A_LA_PIECE                  1021L
+#define M_GPU_UPDATE_EFFECTS                          1022L
+#define M_MAP_VIDEO_MEMORY                            1023L
+#define M_LOCATION                                    1048L
+#define M_MIL_ID_INTERNAL                             1049L
+#define M_UPDATE_PERFORMANCE_COUNTERS                 1050L
+#define M_DEBUG_LOG_INFO                              1051L
+#define M_LED_USER                                    1053L
+#define M_DISTRIBUTED_MIL_TYPE                        1054L
+#define M_DISTRIBUTED_MIL_PROTOCOL                    1055L
+#define M_DEVICE_NAME_MAX_SIZE                        1056L
+#define M_GENICAM_AVAILABLE                           1079L
+#define M_GC_NIC_PORT_COUNT                           1080L
+#define M_DISCOVER_DEVICE                             1081L
+#define M_DISCOVER_DEVICE_COUNT                       1082L
+#define M_DISCOVER_DEVICE_MAX_COUNT                   256L
+
+/***************************************************************/
+/* MsysInquire() Types MIL_ID range start                      */
+/***************************************************************/
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_SYS_INQUIRE_MIL_ID_START                    1100L
+#define M_OWNER_APPLICATION                           1100L
+#define M_CURRENT_THREAD_ID                           1103L
+#define M_OWNER_NODE_ID                               1104L
+#define M_SHADING_CORRECTION_OFFSET_ID                1190L
+#define M_SHADING_CORRECTION_GAIN_ID                  1191L
+#define M_ADD_DESTINATION                             1192L
+#define M_REMOVE_DESTINATION                          1193L
+#define M_SYS_INQUIRE_MIL_ID_END                      1199L
+/***************************************************************/
+/* MsysInquire() Types MIL_ID range end                        */
+/***************************************************************/
+
+#define M_DISCOVER_DEVICE_DIGITIZER_NUMBER            1200L
+/* Reserve 256 values. 1200 - 1455 */
+#define M_DISCOVER_DEVICE_INTERFACE_TYPE              1456L
+/* Reserve 256 values. 1456 - 1711*/
+#define M_DISCOVER_DEVICE_ALLOCATION_STATUS           1712L
+/* Reserve 256 values. 1712 - 1967*/
+
+/************************************************************************/
+/* Camera allocation status                                             */
+/************************************************************************/
+#define M_DEVICE_ALLOCATED                            1
+#define M_DEVICE_FREE                                 2
+
+/************************************************************************/
+/* Interface types                                                      */
+/************************************************************************/
+#define M_GIGE_VISION                                180L
+#define M_USB3_VISION                                200L
+#define M_CL                                         M_XCL       // 0x00000800L
+#define M_CXP                                        0x00000200L
+#define M_CLHS                                       0x00000400L
+#define M_HDMI                                       0x2000
+#define M_SDI                                        0x00001000L
+
+#define M_THREAD_MODE                                 1804L
+
+#define M_SYSTEM_TYPE                                 2000L
+#define M_DISPLAY_OUTPUT_NUM                          2001L//2001L was use by M_SYSTEM_TYPE_PTR that is no longer supported.
+#define M_INTERNAL_SYSTEM_TYPE                        2002L
+//2003L was use by M_DISPLAY_TYPE, that is now in the Display reserved area.
+#define M_DIGITIZER_NUM                               2004L
+#define M_DIGITIZER_TYPE_NUMBER                       2400L
+#define M_DIGITIZER_TYPE                              M_DIGITIZER_TYPE_NUMBER
+#define M_PROCESSOR_NUM                               2006L
+//2007L was use by M_PROCESSOR_TYPE, that is now in the processor specific section.
+#define M_TIMER_NUM                                   2008L
+#define M_PROCESSING_SYSTEM_TYPE                      2009L
+#define M_TUNER_NUM                                   2010L
+#define M_TUNER_TYPE                                  2011L
+#define M_RGB_MODULE_NUM                              2012L
+#define M_RGB_MODULE_TYPE                             2013L
+#define M_BOARD_TYPE                                  2014L
+#define M_BOARD_REVISION                              2015L
+#define M_WIN_MODE                                    2017L
+//2018L was use by M_DUAL_SCREEN_MODE, that is now in the Display reserved area.
+//2019L was use by M_UNDERLAY_SURFACE_AVAILABLE, that is now in the Display reserved area.
+#define M_LOW_LEVEL_SYSTEM_ID                         2024L
+#define M_PHYSICAL_ADDRESS_UNDERLAY                   2029L
+
+//2030L was use by M_PHYSICAL_ADDRESS_VGA, that is now in the Display reserved area.
+//2031 was used by M_PSEUDO_LIVE_GRAB_ON_MGA, that is no longer supported.
+//2032 was used by M_PSEUDO_LIVE_GRAB, that is no longer supported.
+//2033 was used by M_FORCE_PSEUDO_IN_NON_UNDERLAY_DISPLAYS, that is no longer supported
+#define M_LIVE_GRAB                                   2034L
+#define M_LIVE_GRAB_WHEN_DISPLAY_DOES_NOT_MATCH       2035L
+#define M_ADD_BUFFER_INFO                             2036L
+// free for reuse                                     2037L
+#define M_GRAB_CONTINUOUS_END_TRIGGER                 2038L
+//2038 M_LIVE_GRAB_END_TRIGGER is now in OldDefines
+//2040 was used by M_STOP_LIVE_GRAB_WHEN_MENU, that is no longer supported
+//2041 was used by M_STOP_LIVE_GRAB_WHEN_INACTIVE, that is no longer supported
+//2042 was used by M_STOP_LIVE_GRAB_WHEN_DISABLED, that is no longer supported
+#define M_GRAB_BY_DISPLAY_CAPTURE                     2043L
+#define M_ALLOC_BUF_RGB888_AS_RGB555                  2044L
+#define M_RGB555_BUFFER_ALLOCATION                    2045L
+//2046 was used by M_LAST_GRAB_IN_TRUE_BUFFER, that is now in the Digitizer reserved area.
+#define M_NO_GRAB_WHEN_NO_INPUT_SIGNAL                2047L
+#define M_PCI_LATENCY                                 2048L
+//2049 was used by M_FAST_PCI_TO_MEM, that is no longer supported.
+#define M_DCF_SUPPORTED                               2050L
+#define M_DMA_ENABLE                                  2051L
+#define M_DMA_DISABLE                                 2052L
+#define M_DIB_ONLY                                    2053L
+#define M_DIB_OR_DDRAW                                2054L
+#define M_FLIP_ONLY                                   2055L
+//2057L was use by M_PRIMARY_DDRAW_SURFACE_MEM_PTR, that is now in the Display reserved area.
+//2058L was use by M_PRIMARY_DDRAW_SURFACE_PITCH_BYTE, that is now in the Display reserved area.
+//2059L was use by M_PRIMARY_DDRAW_SURFACE_SIZE_X, that is now in the Display reserved area.
+//2060L was use by M_PRIMARY_DDRAW_SURFACE_SIZE_Y, that is now in the Display reserved area.
+//2061L was use by M_PRIMARY_DDRAW_SURFACE_SIZE_BITS, that is now in the Display reserved area.
+#define M_INTERNAL_FORMAT_SIZE                        2062L
+#define M_INTERNAL_FORMAT_ENUMERATION                 2063L
+#define M_INTERNAL_FORMAT_CHECK                       2064L
+//2065L was use by M_DDRAW_AVAILABLE, that is now in the Display reserved area.
+#define M_BOARD_CODE                                  2066L
+#define M_LIVE_GRAB_DDRAW                             2067L
+#define M_THREAD_CONTEXT_PTR                          2068L
+#define M_PSEUDO_LIVE_GRAB_NB_FRAMES                  2069L
+#define M_PSEUDO_LIVE_GRAB_NB_FIELDS                  2070L
+//2071L was use by M_DISPLAY_DOUBLE_BUFFERING, that is now in the Display reserved area.
+#define M_PSEUDO_LIVE_GRAB_TIME                       2072L
+#define M_PCI_BRIDGE_LATENCY                          2073L
+#define M_PSEUDO_LIVE_GRAB_WITH_DDRAW                 2074L
+#define M_MULTI_DISP_IN_UNDERLAY                      2075L
+#define M_MULTI_DISP_FOR_GRAB                         2076L
+#define M_TIMEOUT                                     2077L
+#define M_AUTO_FLIP_FOR_TRUE_COLOR                    2078L
+#define M_PCI_BRIDGE_HOST_WRITE_POSTING               2079L
+#define M_FAST_MEM_TO_VGA                             2080L
+#define M_ERROR_ASYNCHRONOUS_LOG                      2081L
+#define M_LIVE_GRAB_WHEN_NOT_VISIBLE                  2082L
+//2086 was used by M_PHYSICAL_ADDRESS_VIA, that is no longer supported.
+#define M_PCI_MGA_ID                                  2087L
+#define M_PCI_VIA_ID                                  2088L
+#define M_PCI_BRIDGE_ID                               2089L
+#define M_NATIVE_SYSTEM_NUMBER                        2090L
+#define M_NATIVE_NODE_NUMBER                          2091L
+#define M_JTAG_CHAIN                                  2092L
+
+#define M_CUSTOMER_PRODUCT_ID                         2093L
+#define M_UNDERLAY_MEM_SIZE                           2094L
+#define M_OVERLAY_MEM_SIZE                            2095L
+#define M_VIA_MEM_SIZE                                2096L
+#define M_ERROR_CLEAR                                 2099L
+#define M_DEBUG_BUFFER_CLEAR                          2100L  // Was M_SYS_DEBUG_BUFFER_SIZE. Used for remote debugging at clients' sites. Please keep undocumented.
+#define M_DEBUG_BUFFER_TO_FILE                        2101L  // Was M_SYS_DEBUG_BUFFER_ID. Used for remote debugging at clients' sites. Please keep undocumented.
+#define M_USE_NOA                                     2102L
+#define M_USE_ACCELERATOR                             M_USE_NOA
+#define M_COMPRESSION_MODULE_PRESENT                  2104L
+#define M_DIGITAL_MODULE_PRESENT                      2105L
+#define M_INTERRUPT_NEW_TECHNIQUE                     2106L
+#define M_INTERRUPT_NEW_TECHNIQUE_STAT                2107L
+#define M_INTERRUPT_NEW_TECHNIQUE_QUEUE               2108L
+#define M_INTERRUPT_MASTER_SWITCH                     2109L
+#define M_BUS_MASTER_COPY_TO_HOST                     2110L
+#define M_BUS_MASTER_COPY_FROM_HOST                   2111L
+#define M_MEMORY_OFF_SCREEN_AVAILABLE                 2112L
+#define M_BUFCOPY_SUPPORTED                           2113L
+#define M_COMPRESSION_SUPPORTED                       2114L
+#define M_COMPRESSION_BOARD_TYPE                      2121L
+#define M_COMPRESSION_BOARD_RESET                     2122L
+#define M_COMPACT_PCI_PRESENT                         2123L
+#define M_HARDWARE_COMPRESSION                        2130L
+#define M_HARDWARE_DECOMPRESSION                      2131L
+#define M_UART_PRESENT                                2132L
+#define M_PC104_PRESENT                               2133L
+#define M_HARDWARE_COMPRESSION_TYPE                   2134L
+#define M_DDRAW_UNDERLAY_FORMAT                       2137L
+#define M_ENCODER_PRESENT                             2138L
+#define M_COMPRESSION_INTERNAL_BUFFER_SIZE            2139L
+#define M_BIOS_REVISION                               2154L
+#define M_FPGA_REVISION                               2155L
+#define M_FIRMWARE_REVISION                           M_FPGA_REVISION
+#define M_INTERNAL_CAMERA_STRUCT_PTR                  2156L
+#define M_INTERNAL_CAMERA_STRUCT_SIZE                 2157L
+#define M_SUPPORTED_INTERFACE                         2159L
+
+#define M_BOARD_REVISION_SENSOR                       2160L
+#define M_BOARD_REVISION_DAUGHTER                     2161L
+
+#define M_SYSTEM_NUM                                  2169L
+#define M_ASSOCIATED_VGA_DEVICE                       2171L
+#define M_GPU_IS_NON_POWER_OF_2_FULLY_SUPPORTED       2177L
+#define M_GPU_IS_TEXTURE_BORDER_SUPPORTED             2178L
+#define M_GPU_IS_16_BIT_PRECISE                       2179L
+#define M_GPU_SERIES                                  2180L
+#define M_GENTL_INTERFACE_COUNT                       2181L
+#define M_GENTL_DEVICE_COUNT                          2182L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_SUPPORT_SYSTEM_NOTIFICATION                 2183L
+#endif
+#define M_SUPPORT_DEVICE_NAME                         2184L
+
+#define M_BOARD_SUB_REVISION                          2200L
+#define M_USER_BIT_CHANGE                             2244L
+
+#define M_USER_BIT_CHANGE_HANDLER_PTR                 2245L
+/* Reserve next 18 values                       from  2246L*/
+/*                                             to     2264L*/
+#define M_USER_BIT_CHANGE_HANDLER_USER_PTR            2266L
+/* Reserve next 19 values                       from  2267L*/
+/*                                             to     2285L*/
+#define M_CURRENTLY_USED_CAMERA                       2289L
+#define M_DIGITIZER_MODE                              2290L
+#define M_MSG_BUFFER_SIZE                             2291L
+#define M_MSG_BUFFER_PHYSICAL_ADDRESS                 2292L
+#define M_DEFAULT_PITCH_BYTE_MULTIPLE                 2294L
+#if OldDefinesSupport
+#define M_DEFAULT_PITCH_BYTE                          M_DEFAULT_PITCH_BYTE_MULTIPLE
+MIL_DEPRECATED(M_DEFAULT_PITCH_BYTE, 1010)
+#endif
+#define M_SYS_USE_WINDOWED_CLASS                      2295L
+#define M_SUBSYSTEM_ID                                2299L
+#define M_USE_DDRAW                                   2300L
+#define M_PREFERRED_DISPLAY_SYSTEM                    2301L
+#define M_USAGE_METER                                 2302L
+#define M_GRAB_USAGE                                  2303L
+#define M_ACCELERATOR_USAGE                           2304L
+#define M_DMA_USAGE                                   2305L
+#define M_DMA_WRITE_USAGE                             M_DMA_USAGE
+#define M_UTILITY_USAGE                               2306L
+#define M_MAX_UNIT_IDLE_TIME                          2307L
+#define M_JPEG2000_USAGE                              2308L
+#define M_DMA_READ_USAGE                              2309L
+
+#define M_BUFFER_DEFAULT_LOCATION                     2310L
+#define M_ON_BOARD_NATIVE_THREAD_ID                   2314L
+#define M_COPY_BY_DRIVER                              2315L
+#define M_ASSOCIATED_VIDEO_DEVICE_INDEX               2316L
+#define M_ASSOCIATED_EXT_VIDEO_DEVICE_ID              2317L
+
+#define M_NATIVE_CLUSTER_NUMBER                       M_NATIVE_SYSTEM_NUMBER
+#define M_CPU_SPEED                                   2320L
+#define M_ACCELERATOR_SPEED                           2321L
+#define M_ACCELERATOR_PRESENT                         2322L
+#define M_MEMORY_SIZE                                 2323L
+#define M_MEMORY_FREE                                 2324L
+#define M_FAST_MEMORY_FREE                            2325L
+#define M_SHARED_MEMORY_FREE                          2326L
+#define M_HEAP_SIZE                                   2327L
+#define M_HEAP_FREE                                   2328L
+#define M_SIZE_X_CREATE_RESTRICTION                   2329L
+#define M_SHARED_MEMORY_SIZE                          2330L
+#define M_DIGITIZER_NUM_ALLOCATED                     2331L
+/* Reserve next 4 values                       from   2232L*/
+/*                                             to     2235L*/
+/* Next 4 values are used to specify device number of the digitizer.*/
+#define M_SERIAL_DEVICE_PORT_NUMBERS                  2336L
+#define M_FIRMWARE_UPDATE                             2340L
+#define M_CURRENTLY_IN_HOOK                           2341L
+#define M_FIRMWARE_REVISION_GRAB                      2342L
+#define M_FIRMWARE_REVISION_IO                        2343L
+#define M_FIRMWARE_REVISION_PROCESSING                2344L
+#define M_FIRMWARE_REVISION_JPEG2000                  M_FIRMWARE_REVISION_PROCESSING
+#define M_FIRMWARE_BUILDDATE                          2345L
+#define M_FIRMWARE_BUILDDATE_GRAB                     2346L
+#define M_FIRMWARE_BUILDDATE_IO                       2347L
+#define M_FIRMWARE_BUILDDATE_PROCESSING               2348L
+#define M_FIRMWARE_BUILDDATE_JPEG2000                 M_FIRMWARE_BUILDDATE_PROCESSING
+#define M_MPEG4_USAGE                                 2349L
+
+#define M_MEMORY_SIZE_BANK_0                          2350L
+#define M_MEMORY_SIZE_BANK_1                          2351L
+#define M_MEMORY_SIZE_BANK_2                          2352L
+#define M_MEMORY_SIZE_BANK_3                          2353L
+
+#define M_MEMORY_FREE_BANK_0                          2354L
+#define M_MEMORY_FREE_BANK_1                          2355L
+#define M_MEMORY_FREE_BANK_2                          2356L
+#define M_MEMORY_FREE_BANK_3                          2357L
+
+#define M_SYSTEM_NUM_ALLOCATED                        2360L
+#define M_COM_PORT_PCI_BUS_NB                         2361L
+#define M_JPEG2000_COMPATIBILITY_CHECKING             2362L
+#define M_SET_BACK_TO_ZERO                            2363L
+#define M_PROCESSING_FPGA_FAN_RPM                     2364L
+#define M_GRAB_FPGA_FAN_RPM                           2365L
+
+#define M_FIRMWARE_FILE_INDEX                         2367L
+
+// WATCHDOG
+#define M_WATCHDOG_MODE                               2370
+#define M_WATCHDOG_TIMEOUT                            2371
+#define M_WATCHDOG_WARNING                            2372
+#define M_WATCHDOG_REBOOT_TIMEOUT                     2373
+#define M_WATCHDOG_RESET                              2374
+#define M_WATCHDOG_RESET_COUNTER                      2375
+#define M_WATCHDOG_WARNING_TIME                       2376
+#define M_WATCHDOG_PRESENT                            2378
+#define M_OK_TO_FREE                                  2379
+// CRYPTOGRAPHY
+#define M_CRYPTOGRAPHY_MODE                           2380L
+#define M_CRYPTOGRAPHY_P_KEY                          2381L
+#define M_CRYPTOGRAPHY_Q_KEY                          2382L
+#define M_CRYPTOGRAPHY_PUBLIC_KEY                     2383L
+#define M_CRYPTOGRAPHY_PRIVATE_KEY                    2384L
+#define M_CRYPTOGRAPHY_RSA                            2385L
+#define M_CRYPTOGRAPHY_HMAC_KEY                       2386L
+// CRYPTOGRAPHY support old defines
+#define M_CRYPTO_MODE                                 M_CRYPTOGRAPHY_MODE
+#define M_CRYPTO_P_KEY                                M_CRYPTOGRAPHY_P_KEY
+#define M_CRYPTO_Q_KEY                                M_CRYPTOGRAPHY_Q_KEY
+#define M_CRYPTO_PUBLIC_KEY                           M_CRYPTOGRAPHY_PUBLIC_KEY
+#define M_CRYPTO_PRIVATE_KEY                          M_CRYPTOGRAPHY_PRIVATE_KEY
+#define M_CRYPTO_RSA                                  M_CRYPTOGRAPHY_RSA
+
+#define M_DIGITIZER_TYPE_NUMBER                       2400L
+/* Reserve next 31 values                      from   2400*/
+/* for M_DIGITIZER_TYPE+M_DEVn inquire         to     2432*/
+
+
+#define M_AGP_TO_PCI_TRANSFER                         2433L
+#define M_TRANSFER_PRIORITY                           2434L
+#define M_THREAD_CANCEL                               2435L
+#define M_THREAD_HALT                                 2436L
+#define M_NUMBER_OF_GRAB_BLOCKS                       2437L
+/* Reserve next 4 values                        from  2438L*/
+/*                                              to    2441L*/
+#define M_GRAB_BLOCK_FACTOR                           2442L
+/* Reserve next 4 values                        from  2443L*/
+/*                                              to    2446L*/
+#define M_MODIFIED_BUFFER_HOOK_MODE                   2447L
+#define M_GC_CAMERA_SELECT                            2448L
+
+#define M_POWER_OVER_CABLE                            2560  /* 0xA00 */
+/* Reserve next 15 values                       from  2560L */
+/*                                              to    2576  */
+#define M_CAMERA_POWER                                M_POWER_OVER_CABLE
+#define M_POWER_OVER_CABLE_OVER_CURRENT_DETECTION_DELAY 2577L
+
+#define M_POWER_EXTERNAL_SOURCE_PRESENT               2579L
+
+#define METEOR_II_1394B_BIT_MASK_POWER                 0x7
+#define M_BUS_MASTER_PCI_LOCATION                     2580L
+/* Reserve next 8 values                       from   2580L*/
+/*                                             to     2587L*/
+#define M_PCIE_NUMBER_OF_LANES                        2588L
+#define M_PCIE_NUMBER_OF_LANES_MAX                    2589L
+#define M_BUS_MASTER_REQUESTER_ID                     2590L
+/* Reserve next 8 values                       from   2590L*/
+/*                                             to     2597L*/
+#define M_PCIE_SPEED                                  2598L
+#define M_PCIE_SPEED_MAX                              2599L
+
+#define M_PROCESSING_UNIT_START                       0L
+#define M_PROCESSING_UNIT_END                         299L
+#define M_PROCESSING_FPGA_USAGE                       2600L
+/* Reserve next 300 values                     from   2600L*/
+/*                                             to     2899L*/
+#define M_DMA_WRITE_UNIT0_USAGE                       2900L
+#define M_DMA_WRITE_UNIT1_USAGE                       2901L
+#define M_DMA_WRITE_UNIT2_USAGE                       2902L
+#define M_DMA_WRITE_UNIT3_USAGE                       2903L
+// CXP system inquire
+#define M_CONNECTION_COUNT                            3000L
+#define M_CONNECTION_STATE                            3008L
+/* Reserve next 15 values                       from  3009*/
+/*                                             to     3023*/
+#define M_CONNECTION_BIT_RATE_UP_DIRECTION            3024L
+/* Reserve next 15 values                       from  3025*/
+/*                                             to     3039*/
+#define M_CONNECTION_BIT_RATE_DOWN_DIRECTION          3040L
+/* Reserve next 15 values                       from  3041*/
+/*                                             to     3055*/
+#define M_CONNECTION_ID                               3056L
+/* Reserve next 15 values                       from  3057*/
+/*                                             to     3071*/
+
+#define M_POWER_OVER_CABLE_STATUS                     3072  /* 0xCD0 */
+/* Reserve next 15 values                       from  3073L */
+/*                                              to    3087  */
+#define M_TL_ERROR_DETECTION_MODE                     3100
+#define M_TL_ERROR_LOCK_LOSS_COUNT                    3104   
+/* Reserve next 15 values                       from  3105*/
+/*                                             to     3119*/
+#define M_TL_ERROR_CORRECTED_COUNT                    3120   
+/* Reserve next 15 values                       from  3121*/
+/*                                             to     3135*/
+#define M_TL_ERROR_UNCORRECTED_COUNT                  3136  
+/* Reserve next 15 values                       from  3137*/
+/*                                             to     3151*/
+#define M_TL_ERROR_DATA_CRC_COUNT                     3152   
+/* Reserve next 15 values                       from  3153*/
+/*                                             to     3167*/
+#define M_TL_ERROR_CTRL_CRC_COUNT                     3168   
+/* Reserve next 15 values                       from  3169*/
+/*                                             to     3183*/
+#define M_TL_ERROR_EVENT_CRC_COUNT                    3184   
+/* Reserve next 15 values                       from  3185*/
+/*                                             to     3199*/
+#define M_TL_ERROR_ENCODING_COUNT                     3200  
+/* Reserve next 15 values                       from  3201*/
+/*                                             to     3215*/
+#define M_TL_ERROR_COUNT                              3216  
+/* Reserve next 15 values                       from  3217*/
+/*                                             to     3231*/
+#define M_CONNECTION_TYPE                             3232L
+/* Reserve next 15 values                       from  3233*/
+/*                                             to     3247*/
+
+// MPEG4 ENCODER
+#define M_STREAM(value)                               ((value + 1) & 0x003f)
+#define M_STREAM_EXTRACT_STREAM(value)                ((value & 0x003f) - 1)
+#define M_STREAM_EXTRACT_TYPE(value)                  (value & ~0x003f)
+
+// NOTE: For the following defines, the 6 LSBs must be zeros
+#define M_STREAM_CONTROL                              3264L // 0x00000CC0
+#define M_STREAM_BIT_RATE_MODE                        3328L // 0x00000D00
+#define M_STREAM_BIT_RATE                             3392L // 0x00000D40
+#define M_STREAM_Q_PARAMETER                          3456L // 0x00000D80
+#define M_STREAM_QUALITY                              3520L // 0x00000DC0
+#define M_STREAM_BIT_RATE_MAX                         3584L // 0x00000E00
+#define M_STREAM_GROUP_OF_PICTURE_SIZE                3648L // 0x00000E40
+#define M_STREAM_FRAME_RATE                           3712L // 0x00000E80
+#define M_STREAM_FRAME_PERIOD                         3776L // 0x00000EC0
+#define M_STREAM_ENCODING_MODE                        3840L // 0x00000F00
+#define M_STREAM_FILE_NAME                           (3904L | M_CLIENT_ENCODING) // 0x00000F40
+#define M_STREAM_WRITE                                3968L // 0x00000F80
+#define M_STREAM_PROFILE                              4032L // 0x00000FC0
+#define M_STREAM_LEVEL                                4096L // 0x00001000
+
+
+#define M_STREAM_GROUP_OF_PICTURE_TYPE                4160L // 0x00001040
+#define M_STREAM_GROUP_OF_PICTURE_P_SIZE              4224L // 0x00001080
+#define M_STREAM_GROUP_OF_PICTURE_I_SIZE              4288L // 0x000010c0
+#define M_STREAM_LAST                                 (M_STREAM_GROUP_OF_PICTURE_I_SIZE + 63)
+// Continues at value 4864L
+
+#define M_DRIVER_COMPILATION_TYPE                     4362L
+#define M_USER_BIT_INQUIRE_START                      4363L
+#define M_USER_BIT_COUNT                              4364L
+#define M_USER_BIT_OPTOMODULE                         4365L
+#define M_USER_BIT_INQUIRE_END                        4366L
+#define M_FORCE_PITCH_BYTE_MULTIPLE                   4367L
+
+//EEPROM-related defines
+#define M_EEPROM_SIZE                                 4369L
+
+#define M_SUPPORT_START_NO                            4374L
+/*Reserve values between M_SUPPORT_START_NO
+                          and M_SUPPORT_END_NO*/
+#define M_DISPLAY_SUPPORT                             4374L
+#define M_MULTITHREAD_SUPPORT                         4375L
+#define M_ASYNCHRONOUS_CALL_SUPPORT                   4376L
+#define M_COLOR_BUFFERS_PROCESSING_SUPPORT            4377L
+#define M_64BIT_RESULT_BUFFERS_SUPPORT                4378L
+#define M_MILGRABC_VERSION                            4385L    // Also defined as a MdigInquire
+#define M_NETWORKED                                   4386L
+#define M_ALL_DEV_ARE_EQUIVALENT                      4387L
+#define M_MP_SUPPORT                                  4388L
+#define M_REMOTE_MAPPING_SUPPORT                      4389L
+#define M_SUPPORT_NEW_CONTROL_FEATURE                 4390L
+#define M_GPU_NO_TEARING_SUPPORT                      4391L
+#define M_GPU_BILINEAR_SUPPORT                        4392L
+#define M_RAW_CALL_SUPPORT                            4393L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_NAMED_BUFFER_SUPPORTED                      4394L
+#define M_SYS_CONTROL_SUPPORT_MULTI_TYPE              4395L
+#define M_OBJ_CONTROL_SUPPORT_COMPENSATE_REAL_ID      4396L
+#define M_DIG_INQUIRE_SUPPORT_COMPONENT               4398L
+#endif
+#define M_COM_SUPPORTED                               4399L
+#define M_PROFINET_HARDWARE_SUPPORTED                 4400L
+#define M_YCBCR_UHD_SUPPORTED                         4401L
+#define M_PFNC_GRAB_SUPPORTED                         4403L
+#define M_SUPPORT_END_NO                              4439L
+
+#define M_SUPPORT_START_YES                           4440L
+/*Reserve values between M_SUPPORT_START_YES and M_SUPPORT_END_YES*/
+#define M_CAN_GRAB                                    4441L
+#define M_ALLOC_WITH_FORCED_PITCH_SUPPORT             4442L
+#define M_WINDOW_ANNOTATIONS_ENABLED                  4443L
+#define M_SUPPORT_END_YES                             4500L
+
+#define M_SYS_DISPLAY_START                           4501L
+//This section is reserved for displays and defines are in mildisplay.h
+#define M_SYS_DISPLAY_END                             4600L
+#define M_PERFORMANCE_LOGS                            4601L
+#define M_INTERRUPT_LATENCY                           4602L
+// UNUSED                                             4603L
+#define M_DEV_MIN_HEAP_SIZE                           4604L
+#define M_DIGITIZER_INTERNAL_BUFFERS_NUM              4605L
+#define M_CHECK_ERROR                                 4606L
+
+#define M_GC_ACTION_DEVICE_KEY                        4610L
+#define M_GC_ACTION_GROUP_KEY                         4611L
+#define M_GC_ACTION_GROUP_MASK                        4612L
+#define M_GC_ACTION_ACKNOWLEDGE_NUMBER                4613L
+#define M_GC_ACTION_EXECUTE                           4614L
+#define M_GC_ACTION_CLEAR_DEVICES                     4615L
+
+#define M_TRIGGER_ACTIVATION                          4616L
+#define M_TRIGGER_SOURCE                              4617L
+#define M_TRIGGER_STATE                               4618L
+#define M_TRIGGER_COMMAND                             4619L
+#define M_CLEAR_DESTINATIONS                          M_GC_ACTION_CLEAR_DEVICES
+
+#define M_GC_ACTION_SHIFT                             16L
+#define M_GC_ACTION_NUMBER_MASK                       MAKE_INT64(0x0000000000FF0000)
+#define M_GC_ACTION_NUMBER(X)                         (((X) & M_GC_ACTION_NUMBER_MASK) >> M_GC_ACTION_SHIFT)
+#define M_GC_STRIP_ACTION_NUMBER(X)                   ((X) & ~M_GC_ACTION_NUMBER_MASK)
+#define M_GC_ACTION_BASE                              0x0
+#define M_GC_ACTION(X)                                ((M_GC_ACTION_BASE + (X))  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION0                                  ((M_GC_ACTION_BASE + 0)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION1                                  ((M_GC_ACTION_BASE + 1)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION2                                  ((M_GC_ACTION_BASE + 2)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION3                                  ((M_GC_ACTION_BASE + 3)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION4                                  ((M_GC_ACTION_BASE + 4)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION5                                  ((M_GC_ACTION_BASE + 5)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION6                                  ((M_GC_ACTION_BASE + 6)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION7                                  ((M_GC_ACTION_BASE + 7)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION8                                  ((M_GC_ACTION_BASE + 8)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION9                                  ((M_GC_ACTION_BASE + 9)  << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION10                                 ((M_GC_ACTION_BASE + 10) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION11                                 ((M_GC_ACTION_BASE + 11) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION12                                 ((M_GC_ACTION_BASE + 12) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION13                                 ((M_GC_ACTION_BASE + 13) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION14                                 ((M_GC_ACTION_BASE + 14) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION15                                 ((M_GC_ACTION_BASE + 15) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION16                                 ((M_GC_ACTION_BASE + 16) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION17                                 ((M_GC_ACTION_BASE + 17) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION18                                 ((M_GC_ACTION_BASE + 18) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION19                                 ((M_GC_ACTION_BASE + 19) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION20                                 ((M_GC_ACTION_BASE + 20) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION21                                 ((M_GC_ACTION_BASE + 21) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION22                                 ((M_GC_ACTION_BASE + 22) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION23                                 ((M_GC_ACTION_BASE + 23) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION24                                 ((M_GC_ACTION_BASE + 24) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION25                                 ((M_GC_ACTION_BASE + 25) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION26                                 ((M_GC_ACTION_BASE + 26) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION27                                 ((M_GC_ACTION_BASE + 27) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION28                                 ((M_GC_ACTION_BASE + 28) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION29                                 ((M_GC_ACTION_BASE + 29) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION30                                 ((M_GC_ACTION_BASE + 30) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION31                                 ((M_GC_ACTION_BASE + 31) << M_GC_ACTION_SHIFT)
+#define M_GC_ACTION_MAX                               M_GC_ACTION31
+
+#define M_GC_TRIGGER_SOFTWARE_SHIFT                   M_GC_ACTION_SHIFT
+#define M_GC_TRIGGER_SOFTWARE_NUMBER_MASK             M_GC_ACTION_NUMBER_MASK
+#define M_GC_TRIGGER_SOFTWARE_NUMBER(X)               M_GC_ACTION_NUMBER(X)
+#define M_GC_STRIP_TRIGGER_SOFTWARE_NUMBER(X)         M_GC_STRIP_ACTION_NUMBER(X)
+#define M_GC_TRIGGER_SOFTWARE_BASE                    128
+#define M_GC_TRIGGER_SOFTWARE(X)                      ((M_GC_TRIGGER_SOFTWARE_BASE + (X))  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE0                        ((M_GC_TRIGGER_SOFTWARE_BASE + 0)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE1                        ((M_GC_TRIGGER_SOFTWARE_BASE + 1)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE2                        ((M_GC_TRIGGER_SOFTWARE_BASE + 2)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE3                        ((M_GC_TRIGGER_SOFTWARE_BASE + 3)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE4                        ((M_GC_TRIGGER_SOFTWARE_BASE + 4)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE5                        ((M_GC_TRIGGER_SOFTWARE_BASE + 5)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE6                        ((M_GC_TRIGGER_SOFTWARE_BASE + 6)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE7                        ((M_GC_TRIGGER_SOFTWARE_BASE + 7)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE8                        ((M_GC_TRIGGER_SOFTWARE_BASE + 8)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE9                        ((M_GC_TRIGGER_SOFTWARE_BASE + 9)  << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE10                       ((M_GC_TRIGGER_SOFTWARE_BASE + 10) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE11                       ((M_GC_TRIGGER_SOFTWARE_BASE + 11) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE12                       ((M_GC_TRIGGER_SOFTWARE_BASE + 12) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE13                       ((M_GC_TRIGGER_SOFTWARE_BASE + 13) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE14                       ((M_GC_TRIGGER_SOFTWARE_BASE + 14) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE15                       ((M_GC_TRIGGER_SOFTWARE_BASE + 15) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE16                       ((M_GC_TRIGGER_SOFTWARE_BASE + 16) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE17                       ((M_GC_TRIGGER_SOFTWARE_BASE + 17) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE18                       ((M_GC_TRIGGER_SOFTWARE_BASE + 18) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE19                       ((M_GC_TRIGGER_SOFTWARE_BASE + 19) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE20                       ((M_GC_TRIGGER_SOFTWARE_BASE + 20) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE21                       ((M_GC_TRIGGER_SOFTWARE_BASE + 21) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE22                       ((M_GC_TRIGGER_SOFTWARE_BASE + 22) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE23                       ((M_GC_TRIGGER_SOFTWARE_BASE + 23) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE24                       ((M_GC_TRIGGER_SOFTWARE_BASE + 24) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE25                       ((M_GC_TRIGGER_SOFTWARE_BASE + 25) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE26                       ((M_GC_TRIGGER_SOFTWARE_BASE + 26) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE27                       ((M_GC_TRIGGER_SOFTWARE_BASE + 27) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE28                       ((M_GC_TRIGGER_SOFTWARE_BASE + 28) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE29                       ((M_GC_TRIGGER_SOFTWARE_BASE + 29) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE30                       ((M_GC_TRIGGER_SOFTWARE_BASE + 30) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE31                       ((M_GC_TRIGGER_SOFTWARE_BASE + 31) << M_GC_TRIGGER_SOFTWARE_SHIFT)
+#define M_GC_TRIGGER_SOFTWARE_MAX                     M_GC_TRIGGER_SOFTWARE31
+
+// Map of UART defines, used by Mdig and Msys
+#define M_UART_START                                  4701L
+#define M_UART_PARITY                                 4701L
+#define M_UART_STOP_BITS                              4702L
+#define M_UART_DATA_SIZE                              4703L
+#define M_UART_SPEED                                  4704L
+#define M_UART_WRITE_CHAR                             4705L
+#define M_UART_READ_CHAR                              4706L
+#define M_UART_DATA_PENDING                           4707L
+#define M_UART_WRITE_STRING                           4708L
+#define M_UART_WRITE_STRING_SIZE                      4709L
+#define M_UART_READ_STRING                            4710L
+#define M_UART_READ_STRING_SIZE                       4711L
+#define M_UART_READ_STRING_MAXIMUM_SIZE               4712L
+#define M_UART_STRING_DELIMITER                       4713L
+#define M_UART_TIMEOUT                                4714L
+#define M_UART_OUTPUT                                 4716L
+#define M_UART_THREAD_HANDLE                          4717L
+#define M_UART_THREAD_ID                              4718L
+#define M_UART_DATA_RECEIVED_HANDLER_PTR              4719L
+#define M_UART_DATA_RECEIVED_HANDLER_USER_PTR         4720L
+#define M_UART_INTERFACE_TYPE                         4721L
+#define M_UART_BYTES_WRITTEN                          4722L
+#define M_UART_BYTES_READ                             4723L
+#define M_COM_PORT_NUMBER                             4724L
+#define M_UART_FREE                                   4725L
+#define M_UART_END                                    4725L
+#define M_UART_SYNCHRONOUS                            0x02000000
+#define M_UART_NB_MASK_SHIFT                          16L
+#define M_MAX_UART_NB                                 0x000000ff
+#define M_UART_NB(n)                                  ((MIL_INT64)((n & M_MAX_UART_NB) << M_UART_NB_MASK_SHIFT))
+#define M_UART0                                       M_UART_NB(0)
+#define M_UART1                                       M_UART_NB(1)
+#define M_UART2                                       M_UART_NB(2)
+#define M_UART3                                       M_UART_NB(3)
+#define M_UART4                                       M_UART_NB(4)
+#define M_UART5                                       M_UART_NB(5)
+#define M_UART6                                       M_UART_NB(6)
+#define M_UART7                                       M_UART_NB(7)
+#define M_UART8                                       M_UART_NB(8)
+#define M_UART9                                       M_UART_NB(9)
+#define M_UART10                                      M_UART_NB(10)
+#define M_UART11                                      M_UART_NB(11)
+#define M_UART12                                      M_UART_NB(12)
+#define M_UART13                                      M_UART_NB(13)
+#define M_UART14                                      M_UART_NB(14)
+#define M_UART15                                      M_UART_NB(15)
+#define M_UART_CONTROL_VALUE(n)                       (n & (~( M_UART_SYNCHRONOUS | (M_MAX_UART_NB << M_UART_NB_MASK_SHIFT))))
+#define M_IS_IN_UART_RANGE(Type)                      (((M_UART_CONTROL_VALUE((Type)) >= M_UART_START) && \
+                                                        (M_UART_CONTROL_VALUE((Type)) <= M_UART_END)))
+
+#if OldDefinesSupport
+#define M_UART_DATA_LENGTH                            M_UART_DATA_SIZE
+MIL_DEPRECATED(M_UART_DATA_LENGTH, 1000)
+#define M_UART_WRITE_STRING_LENGTH                    M_UART_WRITE_STRING_SIZE
+MIL_DEPRECATED(M_UART_WRITE_STRING_LENGTH, 1000)
+#define M_UART_READ_STRING_LENGTH                     M_UART_READ_STRING_SIZE
+MIL_DEPRECATED(M_UART_READ_STRING_LENGTH, 1000)
+#define M_UART_READ_STRING_MAXIMUM_LENGTH             M_UART_READ_STRING_MAXIMUM_SIZE
+MIL_DEPRECATED(M_UART_READ_STRING_MAXIMUM_LENGTH, 1000)
+#endif
+
+
+#define M_FPGA_CONTEXT_SHARED_API                     4800L
+#define M_DRIVER_FPGA_CONTEXT_SIZE                    4801L
+#define M_PROCESSING_MODULE_COUNT                     4802L
+#define M_FPGA_RESET                                  4803L
+#define M_PROCESSING_FPGA_REGISTER_RANGE              4804L
+#define M_PF_CLOCK_FREQUENCY                          4805L
+#define M_PF_MEMORY_SIZE                              4806L
+#define M_DISTRIBUTED_SYSTEM_ON_LOCAL_HOST            4807L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_IS_DISTRIBUTED_SYSTEM_ON_LOCAL_HOST         4807L
+#endif
+#define M_NETWORK_PORT                                4808L
+
+#define M_GC_DISCOVER_DEVICES                         4810L
+#define M_NUM_CAMERA_PRESENT                          4811L
+// Reserved                                           4812L
+#define M_GC_FEATURE_EXECUTE_POLLING_MODE             4813L
+#define M_FPGA_MEMORY_ARBITER_GRANT                   4814L
+#define M_PCIE_PAYLOAD_SIZE                           4815L
+
+#define M_HFPGA_REGISTER_RANGE                        4818L
+#define M_GENTL_DISCOVERY_TIMEOUT                     4819L
+
+
+#define M_STREAM_ENCODING_IMPLEMENTATION              4864L // 0x00001300
+#define M_STREAM_TOTAL_ENCODING_TIME                  4928L // 0x00001340
+#define M_STREAM_INPUT_FRAME_NUMBER                   4992L // 0x00001380
+#define M_STREAM_ENCODED_FRAME_NUMBER                 5056L // 0x000013C0
+#define M_STREAM_ADAPTATIVE_SCALINGLIST               5120L
+/* Reserve next 448 values                     from   5184L*/
+/*                                             to     5504L*/
+#define M_STREAM_LAST_PART2                           (M_STREAM_ENCODED_FRAME_NUMBER + 63)
+
+
+
+#define M_SYS_INQUIRE_SIZEOF_INT64_START              6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+
+#define M_PROCESSING_FPGA_REGISTER_PHYSICAL_ADDRESS   6701L
+#define M_HFPGA_REGISTER_PHYSICAL_ADDRESS             6702L
+
+#define M_EXTENDED_INIT_FLAG                          6705L
+#define M_PROFINET_MAC_ADDRESS                        6706L
+
+#define M_GC_NIC_MAC_ADDRESS                          6731L
+#define M_GC_LOCAL_MAC_ADDRESS                        M_GC_NIC_MAC_ADDRESS
+/* Reserve next 7 values                       from   6732L*/
+/*                                             to     6738L*/
+#define M_GC_NIC_IP_ADDRESS                           6739L
+#define M_GC_LOCAL_IP_ADDRESS                         M_GC_NIC_IP_ADDRESS
+/* Reserve next 7 values                       from   6740L*/
+/*                                             to     6746L*/
+
+#define M_PORT(n)                                     n
+
+#define M_SYS_INQUIRE_SIZEOF_INT64_END                6799L
+
+#define M_GC_FEATURE_NODEMAP_MIL                      6951L
+
+#define M_SYS_INQUIRE_SIZEOF_DOUBLE_START             7300L
+// Inquire value with a size of double, must be in that range : 7300-7399
+
+#define M_TEMPERATURE_FPGA                            7301L
+#define M_TEMPERATURE_FPGA_MAX_MEASURED               7302L
+#define M_VOLTAGE_FGPA_VCCINT                         7303L
+#define M_VOLTAGE_FPGA_VCCINT_MIN_MEASURED            7304L
+#define M_VOLTAGE_FPGA_VCCINT_MAX_MEASURED            7305L
+#define M_VOLTAGE_FPGA_VCCAUX                         7306L
+#define M_VOLTAGE_FPGA_VCCAUX_MIN_MEASURED            7307L
+#define M_VOLTAGE_FPGA_VCCAUX_MAX_MEASURED            7308L
+#define M_TEMPERATURE_FPGA_PROCESSING                 7309L
+#define M_TEMPERATURE_FPGA_PROCESSING_MAX_MEASURED    7310L
+#define M_GC_GENICAM_VERSION                          7311L
+#define M_TEMPERATURE_CPU                             7312L
+#define M_GC_ACTION_TIME                              7313L
+#define M_VOLTAGE_FPGA_VCCBRAM                        7314L
+#define M_VOLTAGE_FPGA_VCCBRAM_MIN_MEASURED           7315L
+#define M_VOLTAGE_FPGA_VCCBRAM_MAX_MEASURED           7316L
+#define M_VOLTAGE_FPGA_VREFP                          7317L
+
+#define M_TEMPERATURE_IMAGE_SENSOR                    7320L
+/* M_TEMPERATURE_IMAGE_SENSOR + M_DEV0 ... M_DEV8   Reserved until 7328*/
+
+#define M_CLOCK_FREQUENCY_FPGA                        7330L
+/* Reserved M_CLOCK_FREQUENCY_FPGA_PROCESSING             7331L */
+#define M_SYSTEM_TIME_STAMP_VALUE                     7332L
+
+#define M_SYS_INQUIRE_SIZEOF_DOUBLE_END               7399L
+
+
+
+#define M_SYS_AUX_START                               7400L
+
+#define M_DUMMY_SYS_INQUIRE                           7401L
+#define M_USER_BIT_IN_ACTIVE_LEVEL                    7402L
+#define M_USER_BIT_PERFORMANCE_LOGS                   7403L
+
+#define M_SYS_AUX_END                                 7499L
+
+
+
+#define M_SYS_INQUIRE_UNKNOWN_SIZEOF_START            7500L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 7500-7599
+#define M_LOGICAL_TO_PHYSICAL_ADDRESS                 7501L
+/* Reserve value                                      7502L*/
+
+
+#define M_SYS_INQUIRE_UNKNOWN_SIZEOF_END              7599L
+
+#define M_SYS_DISPLAY_START                           4501L
+#define M_SYS_DISPLAY_END                             4600L
+#define M_DEV_SCREEN_MANAGER_START                    (M_APP_SCREEN_MANAGER_END+1L)    // 9250L
+#define M_DEV_SCREEN_MANAGER_END                      (M_DEV_SCREEN_MANAGER_START+49L) // 9299L
+
+// Inquire value with string type must be in that range : 7700-7799
+#define M_SYS_INQUIRE_STRING_START                    7700L
+   #define M_GPU_TYPE                              (7700L|M_CLIENT_ENCODING)
+   #define M_SYSTEM_DESCRIPTOR                     (7701L|M_CLIENT_ENCODING)
+   #define M_SYSTEM_NAME                           (7702L|M_CLIENT_ENCODING)
+   #define M_SERIAL_NUMBER                         (7703L|M_CLIENT_ENCODING)
+   #define M_DISTRIBUTED_MIL_REMOTE_COMPUTER_NAME  (7704L|M_CLIENT_ENCODING)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_NETWORK_ADDRESS                       (7704L|M_CLIENT_ENCODING)
+#endif
+   #define M_SYSTEM_TYPE_STRING                    (7705L|M_CLIENT_ENCODING)
+   #define M_TRANSPORT_PROTOCOL                    (7706L|M_CLIENT_ENCODING)
+   #define M_GC_GENICAM_UI                         (7707L|M_CLIENT_ENCODING)
+   #define M_DEBUG_BUFFER_PATH                     (7708L|M_CLIENT_ENCODING)
+   #define M_SYSTEM_PRINT_NAME                     (7709L|M_CLIENT_ENCODING)
+   #define M_PRODUCT_MODEL                         (7710L|M_CLIENT_ENCODING)
+   #define M_PRODUCT_SENSOR                        (7711L|M_CLIENT_ENCODING)
+   #define M_USER_NAME                             (7712L|M_CLIENT_ENCODING)
+   #define M_FPGA_DESCRIPTION                      (7713L|M_CLIENT_ENCODING)
+   #define M_GC_TRIGGER_SELECTOR                   (7714L|M_CLIENT_ENCODING)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_TRIGGER_SELECTOR                       M_GC_TRIGGER_SELECTOR
+#endif
+   #define M_DEVICE_NAME                           (MAKE_INT64(0x0000001000000000) | M_CLIENT_ENCODING)
+
+#if OldDefinesSupport
+   #define M_GPU_TYPE_SIZE                            (M_STRING_SIZE + M_GPU_TYPE)
+   #define M_SYSTEM_DESCRIPTOR_SIZE                   (M_STRING_SIZE + M_SYSTEM_DESCRIPTOR)
+   #define M_SERIAL_NUMBER_SIZE                       (M_STRING_SIZE + M_SERIAL_NUMBER)
+   #define M_DISTRIBUTED_MIL_REMOTE_COMPUTER_NAME_SIZE (M_STRING_SIZE + M_DISTRIBUTED_MIL_REMOTE_COMPUTER_NAME)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_NETWORK_ADDRESS_SIZE                     (M_STRING_SIZE + M_NETWORK_ADDRESS)
+#endif
+   #define M_SYSTEM_TYPE_STRING_SIZE                  (M_STRING_SIZE + M_SYSTEM_TYPE_STRING)
+   #define M_TRANSPORT_PROTOCOL_SIZE                  (M_STRING_SIZE + M_TRANSPORT_PROTOCOL)
+   #define M_GC_GENICAM_UI_SIZE                       (M_STRING_SIZE + M_GC_GENICAM_UI)
+   #define M_DEBUG_BUFFER_PATH_SIZE                   (M_STRING_SIZE + M_DEBUG_BUFFER_PATH)
+   #define M_SYSTEM_PRINT_NAME_SIZE                   (M_STRING_SIZE + M_SYSTEM_PRINT_NAME)
+   #define M_PRODUCT_MODEL_SIZE                       (M_STRING_SIZE + M_PRODUCT_MODEL)
+   #define M_PRODUCT_SENSOR_SIZE                      (M_STRING_SIZE + M_PRODUCT_SENSOR)
+   #define M_USER_NAME_SIZE                           (M_STRING_SIZE + M_USER_NAME)
+   #define M_FPGA_DESCRIPTION_SIZE                    (M_STRING_SIZE + M_FPGA_DESCRIPTION)
+   #define M_DEVICE_NAME_SIZE                         (M_STRING_SIZE + M_DEVICE_NAME)
+   #define M_GC_TRIGGER_SELECTOR_SIZE                 (M_STRING_SIZE + M_GC_TRIGGER_SELECTOR)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_TRIGGER_SELECTOR_SIZE                    M_GC_TRIGGER_SELECTOR_SIZE
+#endif
+
+MIL_DEPRECATED(M_GPU_TYPE_SIZE, 1040)
+MIL_DEPRECATED(M_SYSTEM_DESCRIPTOR_SIZE, 1040)
+MIL_DEPRECATED(M_SYSTEM_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_SERIAL_NUMBER_SIZE, 1040)
+MIL_DEPRECATED(M_DISTRIBUTED_MIL_REMOTE_COMPUTER_NAME_SIZE, 1040)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   MIL_DEPRECATED(M_NETWORK_ADDRESS_SIZE, 1040)
+#endif
+MIL_DEPRECATED(M_SYSTEM_TYPE_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_TRANSPORT_PROTOCOL_SIZE, 1040)
+MIL_DEPRECATED(M_GC_GENICAM_UI_SIZE, 1040)
+MIL_DEPRECATED(M_DEBUG_BUFFER_PATH_SIZE, 1040)
+MIL_DEPRECATED(M_SYSTEM_PRINT_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_PRODUCT_MODEL_SIZE, 1040)
+MIL_DEPRECATED(M_PRODUCT_SENSOR_SIZE, 1040)
+MIL_DEPRECATED(M_USER_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_FPGA_DESCRIPTION_SIZE, 1040)
+MIL_DEPRECATED(M_DEVICE_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_GC_TRIGGER_SELECTOR_SIZE, 1040)
+
+#endif
+
+#define M_SYS_INQUIRE_STRING_END                      7799L
+
+/* Reserve next values     from    M_SYS_DISPLAY_RANGE2_START    8500L 
+                           to      M_SYS_DISPLAY_RANGE2_END      8699L 
+  Display, reserved area in mildisplay.h 
+  (this is the second range we have to use, 4501L-4600L is also reserved for the displays)
+*/
+
+// Data Latch for Msys (Since M_DATA_LATCH for Mdig conflicts with M_SYS_DISPLAY_RANGE2)
+#define M_SYS_DATA_LATCH_PARSING_MODE                      8700L
+#define M_SYS_DATA_LATCH_CLOCK_FREQUENCY                   8701L
+#define M_SYS_DATA_LATCH_MAX_INDEX                         0x20 
+#define M_SYS_DATA_LATCH_INDEX_START                       8704L
+#define M_SYS_DATA_LATCH_STATE                             (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*0)
+#define M_SYS_DATA_LATCH_TYPE                              (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*1)
+#define M_SYS_DATA_LATCH_TRIGGER_SOURCE                    (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*2)
+#define M_SYS_DATA_LATCH_MODE                              (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*3)
+#define M_SYS_DATA_LATCH_BUFFER_TRIGGER_SOURCE             (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*4)
+#define M_SYS_DATA_LATCH_CALLBACK                          (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*5)
+#define M_SYS_DATA_LATCH_FLUSH_TRIGGER_SOURCE              (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*6)
+#define M_SYS_DATA_LATCH_TRIGGER_ACTIVATION                (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*7)
+// Used in the callback
+#define M_SYS_DATA_LATCH_VALUE_COUNT                       (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*8)
+#define M_SYS_DATA_LATCH_SIZE_BYTE                         (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*9)
+#define M_SYS_DATA_LATCH_VALUE_ALL                         (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*10)
+#define M_SYS_DATA_LATCH_VALUE                             (M_SYS_DATA_LATCH_INDEX_START + M_SYS_DATA_LATCH_MAX_INDEX*11)
+#define M_SYS_DATA_LATCH_EXTRACT_INDEX_FROM_TYPE(TYPE)     ((((TYPE)&~M_DATA_LATCH_INSTANCE_MASK) - M_SYS_DATA_LATCH_INDEX_START) % M_SYS_DATA_LATCH_MAX_INDEX)
+#define M_SYS_DATA_LATCH_EXTRACT_INSTANCE_FROM_TYPE(TYPE)  ((((TYPE) & M_DATA_LATCH_INSTANCE_MASK) >> M_DATA_LATCH_INSTANCE_BITSHIFT))
+#define M_SYS_DATA_LATCH_EXTRACT_TYPE(TYPE)                (((TYPE)&~M_DATA_LATCH_INSTANCE_MASK) - M_SYS_DATA_LATCH_EXTRACT_INDEX_FROM_TYPE(TYPE))
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+//Processor specific and optimization MsysInquire/MsysControl type.
+//The range between 0x00002800 to 0x00002FFF (10240L to 12287).
+///////////////////////////////////////////////////////////////////////////////////////////////////
+#define M_CPU_FLAG_RANGE                              0x00002800L    //10240
+#define M_CPU_FLAG_RANGE_END                          0x00002FFFL    //12287
+#define M_IS_IN_CPU_FLAG_RANGE(n)                     ((((n) & ~(M_CLIENT_TEXT_ENCODING | M_STRING_SIZE)) >= M_CPU_FLAG_RANGE) && \
+                                                       (((n) & ~(M_CLIENT_TEXT_ENCODING | M_STRING_SIZE)) <= M_CPU_FLAG_RANGE_END))
+
+#define M_PROCESSOR_TYPE                              0x00002800L
+#define M_INTEL_X86                                   0x00002801L
+#define M_INTEL_IA64                                  0x00002802L
+#define M_PPC_7400                                    0x00002803L
+#define M_AMD_64                                      0x00002804L
+#define M_ARM_CORTEX_A_SERIES                         0x00002805L
+//Reserved for future processor type                  0x00002806L
+//                                                 to 0x0000281FL
+#define M_UNKNOWN_TYPE                                0x00002820L
+
+#define M_USE_SIMD                                    0x00002821L
+
+//Intel x86 specific
+#define M_USE_MMX                                     0x00002822L
+#define M_USE_SSE_INT                                 0x00002823L
+#define M_USE_SSE                                     0x00002824L
+#define M_USE_SSE2_INT                                0x00002825L
+#define M_USE_SSE2                                    0x00002826L
+#define M_USE_SSE3                                    0x00002827L
+#define M_USE_SSE4_1                                  0x00002828L
+#define M_USE_SSE4_2                                  0x00002829L
+#define M_USE_AVX                                     0x0000282AL
+#define M_USE_AVX2                                    0x0000282BL
+#define M_USE_AVX512_BASE                             0x0000282CL
+#define M_USE_AVX512_BLOCK1                           0x0000282DL
+#define M_USE_AVX512_BLOCK2                           0x0000282EL
+//Reserved for future Intel instruction set expansion 0x0000282FL
+//                                                 to 0x00002830L
+#define M_USE_AMD_3DNOW                               0x00002831L
+#define M_USE_AMD_MMX_EXTENSION                       0x00002832L
+#define M_USE_AMD_3DNOW_EXTENSION                     0x00002833L
+//Reserved for future AMD instruction set expansion   0x00002834L
+//                                                 to 0x00002840L
+#define M_CPU_FAMILY_NUMBER                           0x00002842L
+#define M_CPU_MODEL_NUMBER                            0x00002843L
+#define M_CPU_STEPPING_NUMBER                         0x00002844L
+#define M_CPU_SERIAL_NUMBER                           0x00002845L
+#define M_CPU_SIMD_BITFIELD                           0x00002846L
+
+// Reserve for sysinquire string types
+#define M_SYS_INQUIRE_CPU_STRING_START                0x00002848L
+#define M_CPU_VENDOR_NAME                       (0x00002848L|M_CLIENT_ENCODING)
+/*Reserve next values      from                 (0x00002849L|M_CLIENT_ENCODING)*/
+/*                         to                   (0x00002883L|M_CLIENT_ENCODING)*/
+
+#if OldDefinesSupport
+#define M_CPU_VENDOR_NAME_SIZE                     (M_STRING_SIZE + M_CPU_VENDOR_NAME)
+MIL_DEPRECATED(M_CPU_VENDOR_NAME_SIZE, 1040)
+#endif
+
+#define M_SYS_INQUIRE_CPU_STRING_END                  0x00002883L
+
+
+//Reserved for future processor expansion             0x00002884L
+//                                                 to 0x00002900L
+
+#define M_CPU_SUPPORT_RDTSC                           0x00002901L
+#define M_CPU_SUPPORT_ENHANCED_REP_MOVSB_STOSB        0x00002902L
+#define M_CPU_SUPPORT_AVX512_WITH_2_FMA_UNITS         0x00002903L
+//Reserved for future processor specific flags        0x00002904L
+//                                                 to 0x00002FFFL    //12287
+
+#define M_APP_INQUIRE_SYS_START                       15000L
+/*Reserve values between 15000 and 30000 for AppInquires.
+Needed for remote systems                                 */
+#define M_APP_INQUIRE_SYS_END                         30000L
+
+/* Reserve next values     from    M_TIMER_RANGE_START           0x20000L (131072) 
+                           to      M_ROTARY_RANGE_END            0x3F800L (235520)
+
+  These are range for Rotary encoder API and Timer control API
+  (Note IO function is also a range that can be used in both MsysControl and MdigControl)
+*/
+
+#define M_ALLOCATION_OVERSCAN                         0x00008000L    //32768 //This flag is also use as MbufControl/Inquire type and as buffer attribute.
+#define M_FAST_OVERSCAN_BUFFER                        M_ALLOCATION_OVERSCAN
+#define M_ALLOCATION_OVERSCAN_SIZE                    0x00008001L   //32769
+
+#define M_SYS_INQUIRE_STRING_START_1                  33000L
+
+#define M_DISCOVER_DEVICE_MODEL_NAME                  (M_SYS_INQUIRE_STRING_START_1|M_CLIENT_ENCODING)
+/* Reserve 256 values. 12000 - 12255 */
+#define M_DISCOVER_DEVICE_MANUFACTURER_NAME           ((M_SYS_INQUIRE_STRING_START_1 + (1 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 12256 - 12511 */
+#define M_DISCOVER_DEVICE_MANUFACTURER_INFO           ((M_SYS_INQUIRE_STRING_START_1 + (2 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 12512 - 12767*/
+#define M_DISCOVER_DEVICE_USER_NAME                   ((M_SYS_INQUIRE_STRING_START_1 + (3 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 12768 - 13023*/
+#define M_DISCOVER_DEVICE_VERSION                     ((M_SYS_INQUIRE_STRING_START_1 + (4 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 13024 - 13279 */
+#define M_DISCOVER_DEVICE_SERIAL_NUMBER               ((M_SYS_INQUIRE_STRING_START_1 + (5 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 13280 - 13535 */
+#define M_DISCOVER_DEVICE_INTERFACE_NAME              ((M_SYS_INQUIRE_STRING_START_1 + (6 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 13536 - 13791 */
+#define M_DISCOVER_DEVICE_STATISTICS                  ((M_SYS_INQUIRE_STRING_START_1 + (7 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 13792 - 14047 */
+#define M_DISCOVER_DEVICE_CAPABILITIES                ((M_SYS_INQUIRE_STRING_START_1 + (8 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 14048 - 14303 */
+#define M_DISCOVER_DEVICE_ADDRESS                     ((M_SYS_INQUIRE_STRING_START_1 + (9 * 256))|M_CLIENT_ENCODING)
+/* Reserve 256 values. 14304 - 14559 */
+
+#define M_SYS_INQUIRE_STRING_END_1                    36000L
+
+
+//#define MAX_NUM_OF_SIGNAL_IN_GROUP                    0x100
+// Define to support
+// Define macros used with M_IO_SOURCE and other IO Control/Inquire to represent various signal
+
+// M_TIMERx 1 to 99
+
+#define M_GRAB_FRAME_END_SIGNAL                     120
+#define M_GRAB_FRAME_END_SIGNAL0                    M_GRAB_FRAME_END_SIGNAL
+#define M_GRAB_FRAME_END_SIGNAL1                    M_GRAB_FRAME_END_SIGNAL+1
+#define M_GRAB_FRAME_END_SIGNAL2                    M_GRAB_FRAME_END_SIGNAL+2
+#define M_GRAB_FRAME_END_SIGNAL3                    M_GRAB_FRAME_END_SIGNAL+3
+
+
+#define M_END_OF_TRANSFER_SIGNAL                      140
+#define M_END_OF_TRANSFER_SIGNAL0                     M_END_OF_TRANSFER_SIGNAL
+#define M_END_OF_TRANSFER_SIGNAL1                     M_END_OF_TRANSFER_SIGNAL+1
+#define M_END_OF_TRANSFER_SIGNAL2                     M_END_OF_TRANSFER_SIGNAL+2
+#define M_END_OF_TRANSFER_SIGNAL3                     M_END_OF_TRANSFER_SIGNAL+3
+
+
+#define M_CC_IO                                       0x100
+#define M_CC_IO1                                      M_CC_IO
+#define M_CC_IO2                                      (M_CC_IO+1)
+#define M_CC_IO3                                      (M_CC_IO+2)
+#define M_CC_IO4                                      (M_CC_IO+3)
+#define M_CC1                                         M_CC_IO1
+#define M_CC2                                         M_CC_IO2
+#define M_CC3                                         M_CC_IO3
+#define M_CC4                                         M_CC_IO4
+// Reserved value for a max of 32 CCbits
+
+#define M_LOGIC_BLOCK                               0x120
+#define M_LOGIC_BLOCK0                              M_LOGIC_BLOCK
+#define M_LOGIC_BLOCK1                              (M_LOGIC_BLOCK+1)
+#define M_LOGIC_BLOCK2                              (M_LOGIC_BLOCK+2)
+#define M_LOGIC_BLOCK3                              (M_LOGIC_BLOCK+3)
+#define M_LOGIC_BLOCK4                              (M_LOGIC_BLOCK+4)
+#define M_LOGIC_BLOCK5                              (M_LOGIC_BLOCK+5)
+#define M_LOGIC_BLOCK6                              (M_LOGIC_BLOCK+6)
+#define M_LOGIC_BLOCK7                              (M_LOGIC_BLOCK+7)
+#define M_LOGIC_BLOCK8                              (M_LOGIC_BLOCK+8)
+#define M_LOGIC_BLOCK9                              (M_LOGIC_BLOCK+9)
+#define M_LOGIC_BLOCK10                             (M_LOGIC_BLOCK+10)
+#define M_LOGIC_BLOCK11                             (M_LOGIC_BLOCK+11)
+#define M_LOGIC_BLOCK12                             (M_LOGIC_BLOCK+12)
+#define M_LOGIC_BLOCK13                             (M_LOGIC_BLOCK+13)
+#define M_LOGIC_BLOCK14                             (M_LOGIC_BLOCK+14)
+#define M_LOGIC_BLOCK15                             (M_LOGIC_BLOCK+15)
+// Reserved value up to M_TL_IO
+
+#define M_TL_IO                                     0x200
+#define M_TL_IO0                                    M_TL_IO
+#define M_TL_IO1                                    (M_TL_IO+1)
+#define M_TL_IO2                                    (M_TL_IO+2)
+#define M_TL_IO3                                    (M_TL_IO+3)
+#define M_TL_IO4                                    (M_TL_IO+4)
+#define M_TL_IO5                                    (M_TL_IO+5)
+#define M_TL_IO6                                    (M_TL_IO+6)
+#define M_TL_IO7                                    (M_TL_IO+7)
+#define M_TL_IO8                                    (M_TL_IO+8)
+#define M_TL_IO9                                    (M_TL_IO+9)
+#define M_TL_IO10                                   (M_TL_IO+10)
+#define M_TL_IO11                                   (M_TL_IO+11)
+#define M_TL_IO12                                   (M_TL_IO+12)
+#define M_TL_IO13                                   (M_TL_IO+13)
+#define M_TL_IO14                                   (M_TL_IO+14)
+#define M_TL_IO15                                   (M_TL_IO+15)
+// Reserved value up to M_TL_IO+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+#define M_TL_TRIGGER                                  0x300
+#define M_TL_TRIGGER0                                 M_TL_TRIGGER
+#define M_TL_TRIGGER1                                 (M_TL_TRIGGER+1)
+#define M_TL_TRIGGER2                                 (M_TL_TRIGGER+2)
+#define M_TL_TRIGGER3                                 (M_TL_TRIGGER+3)
+
+// Reserved value up to M_TL_TRIGGER+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+#define M_TL_EVENT                                    0x400
+#define M_TL_EVENT0                                   M_TL_EVENT
+// Reserved value up to M_TL_EVENT+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+#define M_AUX_IO                                      0x500
+#define M_AUX_IO0                                     M_AUX_IO
+#define M_AUX_IO1                                     (M_AUX_IO+1)
+#define M_AUX_IO2                                     (M_AUX_IO+2)
+#define M_AUX_IO3                                     (M_AUX_IO+3)
+#define M_AUX_IO4                                     (M_AUX_IO+4)
+#define M_AUX_IO5                                     (M_AUX_IO+5)
+#define M_AUX_IO6                                     (M_AUX_IO+6)
+#define M_AUX_IO7                                     (M_AUX_IO+7)
+#define M_AUX_IO8                                     (M_AUX_IO+8)
+#define M_AUX_IO9                                     (M_AUX_IO+9)
+#define M_AUX_IO10                                    (M_AUX_IO+10)
+#define M_AUX_IO11                                    (M_AUX_IO+11)
+#define M_AUX_IO12                                    (M_AUX_IO+12)
+#define M_AUX_IO13                                    (M_AUX_IO+13)
+#define M_AUX_IO14                                    (M_AUX_IO+14)
+#define M_AUX_IO15                                    (M_AUX_IO+15)
+#define M_AUX_IO16                                    (M_AUX_IO+16)
+#define M_AUX_IO17                                    (M_AUX_IO+17)
+#define M_AUX_IO18                                    (M_AUX_IO+18)
+#define M_AUX_IO19                                    (M_AUX_IO+19)
+#define M_AUX_IO20                                    (M_AUX_IO+20)
+#define M_AUX_IO21                                    (M_AUX_IO+21)
+#define M_AUX_IO22                                    (M_AUX_IO+22)
+#define M_AUX_IO23                                    (M_AUX_IO+23)
+#define M_AUX_IO24                                    (M_AUX_IO+24)
+#define M_AUX_IO25                                    (M_AUX_IO+25)
+#define M_AUX_IO26                                    (M_AUX_IO+26)
+#define M_AUX_IO27                                    (M_AUX_IO+27)
+#define M_AUX_IO28                                    (M_AUX_IO+28)
+#define M_AUX_IO29                                    (M_AUX_IO+29)
+#define M_AUX_IO30                                    (M_AUX_IO+30)
+#define M_AUX_IO31                                    (M_AUX_IO+31)
+#define M_AUX_IO32                                    (M_AUX_IO+32)
+#define M_AUX_IO33                                    (M_AUX_IO+33)
+#define M_AUX_IO34                                    (M_AUX_IO+34)
+#define M_AUX_IO35                                    (M_AUX_IO+35)
+#define M_AUX_IO36                                    (M_AUX_IO+36)
+#define M_AUX_IO37                                    (M_AUX_IO+37)
+#define M_AUX_IO38                                    (M_AUX_IO+38)
+#define M_AUX_IO39                                    (M_AUX_IO+39)
+#define M_AUX_IO40                                    (M_AUX_IO+40)
+#define M_AUX_IO41                                    (M_AUX_IO+41)
+#define M_AUX_IO42                                    (M_AUX_IO+42)
+#define M_AUX_IO43                                    (M_AUX_IO+43)
+#define M_AUX_IO44                                    (M_AUX_IO+44)
+#define M_AUX_IO45                                    (M_AUX_IO+45)
+#define M_AUX_IO46                                    (M_AUX_IO+46)
+#define M_AUX_IO47                                    (M_AUX_IO+47)
+#define M_AUX_IO48                                    (M_AUX_IO+48)
+#define M_AUX_IO49                                    (M_AUX_IO+49)
+#define M_AUX_IO50                                    (M_AUX_IO+50)
+#define M_AUX_IO51                                    (M_AUX_IO+51)
+#define M_AUX_IO52                                    (M_AUX_IO+52)
+#define M_AUX_IO53                                    (M_AUX_IO+53)
+#define M_AUX_IO54                                    (M_AUX_IO+54)
+#define M_AUX_IO55                                    (M_AUX_IO+55)
+#define M_AUX_IO56                                    (M_AUX_IO+56)
+#define M_AUX_IO57                                    (M_AUX_IO+57)
+#define M_AUX_IO58                                    (M_AUX_IO+58)
+#define M_AUX_IO59                                    (M_AUX_IO+59)
+#define M_AUX_IO60                                    (M_AUX_IO+60)
+#define M_AUX_IO61                                    (M_AUX_IO+61)
+#define M_AUX_IO62                                    (M_AUX_IO+62)
+#define M_AUX_IO63                                    (M_AUX_IO+63)
+// Reserved value up to M_AUX_IO+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+// The following are Rotary encoder define used as value
+#define M_ROTARY_MAX_OUTPUT                           0x10
+#define M_ROTARY_ENCODER                              0x700L
+#define M_ROTARY_ENCODER1                             (M_ROTARY_ENCODER +M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER2                             (M_ROTARY_ENCODER1+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER3                             (M_ROTARY_ENCODER2+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER4                             (M_ROTARY_ENCODER3+M_ROTARY_MAX_OUTPUT)
+// Reserved value up to M_ROTARY_ENCODER+MAX_NUM_OF_SIGNAL_IN_GROUP
+
+// The following are user bit define used as value
+#define M_USER_BIT0                                    M_USER_BIT
+#define M_USER_BIT1                                    (M_USER_BIT+1)
+#define M_USER_BIT2                                    (M_USER_BIT+2)
+#define M_USER_BIT3                                    (M_USER_BIT+3)
+#define M_USER_BIT4                                    (M_USER_BIT+4)
+#define M_USER_BIT5                                    (M_USER_BIT+5)
+#define M_USER_BIT6                                    (M_USER_BIT+6)
+#define M_USER_BIT7                                    (M_USER_BIT+7)
+#define M_USER_BIT8                                    (M_USER_BIT+8)
+#define M_USER_BIT9                                    (M_USER_BIT+9)
+#define M_USER_BIT10                                   (M_USER_BIT+10)
+#define M_USER_BIT11                                   (M_USER_BIT+11)
+#define M_USER_BIT12                                   (M_USER_BIT+12)
+#define M_USER_BIT13                                   (M_USER_BIT+13)
+#define M_USER_BIT14                                   (M_USER_BIT+14)
+#define M_USER_BIT15                                   (M_USER_BIT+15)
+#define M_USER_BIT16                                   (M_USER_BIT+16)
+#define M_USER_BIT17                                   (M_USER_BIT+17)
+#define M_USER_BIT18                                   (M_USER_BIT+18)
+#define M_USER_BIT19                                   (M_USER_BIT+19)
+#define M_USER_BIT20                                   (M_USER_BIT+20)
+#define M_USER_BIT21                                   (M_USER_BIT+21)
+#define M_USER_BIT22                                   (M_USER_BIT+22)
+#define M_USER_BIT23                                   (M_USER_BIT+23)
+#define M_USER_BIT24                                   (M_USER_BIT+24)
+#define M_USER_BIT25                                   (M_USER_BIT+25)
+#define M_USER_BIT26                                   (M_USER_BIT+26)
+#define M_USER_BIT27                                   (M_USER_BIT+27)
+#define M_USER_BIT28                                   (M_USER_BIT+28)
+#define M_USER_BIT29                                   (M_USER_BIT+29)
+#define M_USER_BIT30                                   (M_USER_BIT+30)
+#define M_USER_BIT31                                   (M_USER_BIT+31)
+#define M_USER_BIT32                                   (M_USER_BIT+32)
+#define M_USER_BIT33                                   (M_USER_BIT+33)
+#define M_USER_BIT34                                   (M_USER_BIT+34)
+#define M_USER_BIT35                                   (M_USER_BIT+35)
+#define M_USER_BIT36                                   (M_USER_BIT+36)
+#define M_USER_BIT37                                   (M_USER_BIT+37)
+#define M_USER_BIT38                                   (M_USER_BIT+38)
+#define M_USER_BIT39                                   (M_USER_BIT+39)
+#define M_USER_BIT40                                   (M_USER_BIT+40)
+#define M_USER_BIT41                                   (M_USER_BIT+41)
+#define M_USER_BIT42                                   (M_USER_BIT+42)
+#define M_USER_BIT43                                   (M_USER_BIT+43)
+#define M_USER_BIT44                                   (M_USER_BIT+44)
+#define M_USER_BIT45                                   (M_USER_BIT+45)
+#define M_USER_BIT46                                   (M_USER_BIT+46)
+#define M_USER_BIT47                                   (M_USER_BIT+47)
+#define M_USER_BIT48                                   (M_USER_BIT+48)
+#define M_USER_BIT49                                   (M_USER_BIT+49)
+#define M_USER_BIT50                                   (M_USER_BIT+50)
+#define M_USER_BIT51                                   (M_USER_BIT+51)
+#define M_USER_BIT52                                   (M_USER_BIT+52)
+#define M_USER_BIT53                                   (M_USER_BIT+53)
+#define M_USER_BIT54                                   (M_USER_BIT+54)
+#define M_USER_BIT55                                   (M_USER_BIT+55)
+#define M_USER_BIT56                                   (M_USER_BIT+56)
+#define M_USER_BIT57                                   (M_USER_BIT+57)
+#define M_USER_BIT58                                   (M_USER_BIT+58)
+#define M_USER_BIT59                                   (M_USER_BIT+59)
+#define M_USER_BIT60                                   (M_USER_BIT+60)
+#define M_USER_BIT61                                   (M_USER_BIT+61)
+#define M_USER_BIT62                                   (M_USER_BIT+62)
+#define M_USER_BIT63                                   (M_USER_BIT+63)
+
+
+#define M_USER_BIT_TL_IO                               (M_USER_BIT+M_TL_IO)
+#define M_USER_BIT_TL_IO0                              (M_USER_BIT+M_TL_IO0)
+#define M_USER_BIT_TL_IO1                              (M_USER_BIT+M_TL_IO1)
+#define M_USER_BIT_TL_IO2                              (M_USER_BIT+M_TL_IO2)
+#define M_USER_BIT_TL_IO3                              (M_USER_BIT+M_TL_IO3)
+#define M_USER_BIT_TL_IO4                              (M_USER_BIT+M_TL_IO4)
+#define M_USER_BIT_TL_IO5                              (M_USER_BIT+M_TL_IO5)
+#define M_USER_BIT_TL_IO6                              (M_USER_BIT+M_TL_IO6)
+#define M_USER_BIT_TL_IO7                              (M_USER_BIT+M_TL_IO7)
+#define M_USER_BIT_TL_IO8                              (M_USER_BIT+M_TL_IO8)
+#define M_USER_BIT_TL_IO9                              (M_USER_BIT+M_TL_IO9)
+#define M_USER_BIT_TL_IO10                             (M_USER_BIT+M_TL_IO10)
+#define M_USER_BIT_TL_IO11                             (M_USER_BIT+M_TL_IO11)
+#define M_USER_BIT_TL_IO12                             (M_USER_BIT+M_TL_IO12)
+#define M_USER_BIT_TL_IO13                             (M_USER_BIT+M_TL_IO13)
+#define M_USER_BIT_TL_IO14                             (M_USER_BIT+M_TL_IO14)
+#define M_USER_BIT_TL_IO15                             (M_USER_BIT+M_TL_IO15)
+
+#define M_USER_BIT_CC_IO                               (M_USER_BIT+M_CC_IO)
+#define M_USER_BIT_CC_IO0                              (M_USER_BIT+M_CC_IO1)
+#define M_USER_BIT_CC_IO1                              (M_USER_BIT+M_CC_IO2)
+#define M_USER_BIT_CC_IO2                              (M_USER_BIT+M_CC_IO3)
+#define M_USER_BIT_CC_IO3                              (M_USER_BIT+M_CC_IO4)
+
+#define M_USER_BIT_TL_TRIGGER                          (M_USER_BIT+M_TL_TRIGGER)
+#define M_USER_BIT_TL_TRIGGER0                         (M_USER_BIT+M_TL_TRIGGER0)
+#define M_USER_BIT_TL_TRIGGER1                         (M_USER_BIT+M_TL_TRIGGER1)
+#define M_USER_BIT_TL_TRIGGER2                         (M_USER_BIT+M_TL_TRIGGER2)
+#define M_USER_BIT_TL_TRIGGER3                         (M_USER_BIT+M_TL_TRIGGER3)
+
+// IO Command list and IO Command list (tick table)
+#define M_IO_COMMAND_LIST                              0x600
+#define M_IO_COMMAND_LIST1                             M_IO_COMMAND_LIST
+#define M_IO_COMMAND_LIST2                             (M_IO_COMMAND_LIST1+0x20) // Reserve 32 command bit per command list
+#define M_IO_COMMAND_LIST3                             (M_IO_COMMAND_LIST2+0x20) // Reserve 32 command bit per command list
+#define M_IO_COMMAND_LIST4                             (M_IO_COMMAND_LIST3+0x20) // Reserve 32 command bit per command list
+#define M_IO_COMMAND_BIT0                              0
+#define M_IO_COMMAND_BIT1                              1
+#define M_IO_COMMAND_BIT2                              2
+#define M_IO_COMMAND_BIT3                              3
+#define M_IO_COMMAND_BIT4                              4
+#define M_IO_COMMAND_BIT5                              5
+#define M_IO_COMMAND_BIT6                              6
+#define M_IO_COMMAND_BIT7                              7
+#define M_IO_COMMAND_BIT_MASK_FLAG                     0x100000000  // Leave first 32bits to I/O cmd bits.
+#define M_IO_COMMAND_BIT_MASK(Value)                   M_IO_COMMAND_BIT_MASK_FLAG | (Value)
+#define M_REFERENCE_VALUE_CURRENT                      0x4000000000000000
+
+// New IO define
+#define M_USER_BIT_STATE                              0x00080000L
+#define M_USER_BIT_STATE_ALL                          (M_USER_BIT_BIT_MASK_ENABLED|M_USER_BIT_STATE)
+#define M_IO_FORMAT                                   0x00082000L
+#define M_IO_STATUS                                   0x00081000L
+#define M_IO_STATUS_ALL                               (M_USER_BIT_BIT_MASK_ENABLED|M_IO_STATUS)
+#define M_IO_SOURCE                                   0x00083000L
+#define M_IO_MODE                                     MIL_MAKE_CONST(0x00084000L,0x0000000000084000)
+#define M_IO_INTERRUPT_ACTIVATION                     MIL_MAKE_CONST(0x00085000L,0x0000000000085000)
+#define M_IO_INTERRUPT_TRANSITION_COUNT               MIL_MAKE_CONST(0x00086000L,0x0000000000086000)
+#define M_IO_INTERRUPT_TRANSITION_COUNT_RESET         MIL_MAKE_CONST(0x00087000L,0x0000000000087000)
+#define M_IO_DEBOUNCE_TIME                            MIL_MAKE_CONST(0x00088000L,0x0000000000088000)
+#define M_IO_INTERRUPT_STATE                          MIL_MAKE_CONST(0x00089000L,0x0000000000089000)
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+#define M_IO_INTERRUPT_SOURCE                         0x0008A000L
+#define M_IO_CHANGE                                   0x0008B000L
+#define M_IO_CHANGE_HANDLER_PTR                       0x0008B001L
+/* Reserve next 0x1000 values                    from  0x0008B002L*/
+/*                                              to    0x0008BFFFL*/
+#define M_IO_CHANGE_HANDLER_USER_PTR                  0x0008C000L
+/* Reserve next 0x1000 values                    from  0x0008C000L*/
+/*                                              to    0x0008CFFFL*/
+#define M_IO_GLITCH_FILTER_STATE                      0x0008D000L
+/* Reserve next 0x1000 values                    from  0x0008D000L*/
+/*                                              to    0x0008DFFFL*/
+#define M_TL_TRIGGER_ACTIVATION                       0x0008E000L
+/* Reserve next 0x1000 values                    from  0x0008E000L*/
+/*                                              to    0x0008EFFFL*/
+#define M_IO_INVERTER                                 0x0008F000L
+/* Reserve next 0x1000 values                    from  0x0008F000L*/
+/*                                              to    0x0008FFFFL*/
+
+#define M_AUX_IO_COUNT                                4450L
+#define M_AUX_IO_COUNT_IN                             4451L
+#define M_AUX_IO_COUNT_OUT                            4452L
+#define M_CC_IO_COUNT                                 4453L
+#define M_CC_IO_COUNT_IN                              4454L
+#define M_CC_IO_COUNT_OUT                             4455L
+#define M_TL_TRIGGER_COUNT                            4456L
+#define M_TL_TRIGGER_COUNT_IN                         4457L
+#define M_TL_TRIGGER_COUNT_OUT                        4458L
+
+//Auxiliary IO defines 4Sight
+#define M_USER_BIT_MASK                               MAKE_INT64(0x00000000EE000000)
+#define M_USER_BIT_BIT_MASK_ENABLED                   0x10000000L
+#define M_USER_BIT_INVALID_BIT_MASK                   0x01FFFFFFL
+#define M_USER_BIT_ALL                                0x000FFFFFL
+#define M_AUX_IO_ALL                                  0x00000FFFL
+#define M_NEW_USER_BIT_ALL                            (M_USER_BIT|M_AUX_IO_ALL)
+
+#define M_USER_IN_FORMAT                              0x08000000L
+#define M_USER_OUT_FORMAT                             0x04000000L
+#define M_USER_BIT_FORMAT                             0x02000000L
+#if OldDefinesSupport
+MIL_DEPRECATED(M_USER_BIT_FORMAT, 1000)     // New IO API Replaced by M_IO_FORMAT
+#endif
+#define M_USER_BIT_PRESENT                            0x40000000L
+#define M_AUX_SIGNAL_SOURCE                           0x20000000L
+#define M_AUX_SIGNAL                                  0x10000000L
+#if OldDefinesSupport
+MIL_DEPRECATED(M_AUX_SIGNAL, 1000)// abc 
+#endif
+#define M_AUX_SIGNAL_MODE                             MIL_MAKE_CONST(0x80000000L,0x0000000080000000)
+#define M_USER_BIT_MODE                               MIL_MAKE_CONST(0x80000000L,0x0000000080000000)
+#if OldDefinesSupport
+MIL_DEPRECATED(M_AUX_SIGNAL_SOURCE, 1000)     // New IO API Replaced by M_IO_SOURCE
+MIL_DEPRECATED(M_AUX_SIGNAL_MODE, 1000)     // New IO API Replaced by M_IO_MODE
+MIL_DEPRECATED(M_USER_BIT_MODE, 1000)     // New IO API Replaced by M_IO_MODE
+#endif
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+
+#define M_USER_BIT_VALUE                              M_USER_BIT     
+#define M_USER_BIT_VALUE_IN                           (M_USER_BIT | M_USER_IN_FORMAT)
+#define M_USER_BIT_VALUE_OUT                          (M_USER_BIT | M_USER_OUT_FORMAT)
+#define M_USER_BIT_INTERRUPT_MODE                     MIL_MAKE_CONST(0xC0000000L,0x00000000C0000000)
+#define M_USER_BIT_INTERRUPT_COUNT                    MIL_MAKE_CONST(0xC2000000L,0x00000000C2000000)
+#define M_USER_BIT_INTERRUPT_COUNT_RESET              MIL_MAKE_CONST(0xC4000000L,0x00000000C4000000)
+#define M_AUX_SIGNAL_DEBOUNCE_TIME                    MIL_MAKE_CONST(0xD0000000L,0x00000000D0000000)
+#define M_USER_BIT_INTERRUPT_STATE                    MIL_MAKE_CONST(0xE0000000L,0x00000000E0000000)
+#if OldDefinesSupport
+MIL_DEPRECATED(M_USER_BIT_VALUE, 1000)     // New IO API Replaced by M_USER_BIT_STATE
+MIL_DEPRECATED(M_AUX_SIGNAL_DEBOUNCE_TIME, 1000)     // New IO API Replaced by M_IO_DEBOUNCE_TIME
+MIL_DEPRECATED(M_USER_BIT_INTERRUPT_MODE, 1000)     // New IO API Replaced by M_IO_INTERRUPT_ACTIVATION
+MIL_DEPRECATED(M_USER_BIT_INTERRUPT_STATE, 1000)     // New IO API Replaced by M_IO_INTERRUPT_STATE
+MIL_DEPRECATED(M_USER_BIT_INTERRUPT_COUNT, 1000)     // New IO API Replaced by M_IO_INTERRUPT_TRANSITION_COUNT
+MIL_DEPRECATED(M_USER_BIT_INTERRUPT_COUNT_RESET, 1000)     // New IO API Replaced by M_IO_INTERRUPT_TRANSITION_COUNT_RESET
+#endif
+#define M_BIT_MASK(mask)   ( ((MIL_INT32) (mask) <= M_USER_BIT_ALL) ? (M_USER_BIT_BIT_MASK_ENABLED | ((MIL_INT32) (mask))) : (M_USER_BIT_BIT_MASK_ENABLED | M_USER_BIT_INVALID_BIT_MASK) )
+#if OldDefinesSupport
+MIL_DEPRECATED(M_BIT_MASK, 1000)     // New IO API Replaced by M_USER_BIT_STATE_ALL
+#endif
+#define M_USER_BIT_COUNT_IN                           (M_USER_BIT_VALUE_IN | M_USER_BIT_COUNT)
+#define M_USER_BIT_COUNT_OUT                          (M_USER_BIT_VALUE_OUT| M_USER_BIT_COUNT)
+#if OldDefinesSupport
+MIL_DEPRECATED(M_USER_BIT_COUNT_IN, 1000)     // New IO API Replaced by 
+MIL_DEPRECATED(M_USER_BIT_COUNT_OUT, 1000)     // New IO API Replaced by 
+#endif
+
+#define M_USER_OUT                                    1L
+/* Reserve 31 values for M_USER_OUT             from   2L*/
+/*                                              to     32L*/
+
+// SysControls for modifying the coefficients used in the Vio and Radient color space converter.
+#define M_BOARD_TO_HOST_COLOR_CONVERSION_COEFFICIENTS         MAKE_INT64(0x00000000EF000000)
+#define M_BOARD_TO_HOST_COLOR_CONVERSION_COEFFICIENTS_MASK    MAKE_INT64(0x00000000FFFF0000)
+
+#define M_COLOR_CONVERSION_COEFFICIENTS           M_BOARD_TO_HOST_COLOR_CONVERSION_COEFFICIENTS
+#define M_COLOR_CONVERSION_COEFFICIENTS_MASK      M_BOARD_TO_HOST_COLOR_CONVERSION_COEFFICIENTS_MASK
+
+#define M_MONO_TO_MONO                          0x00000001L //MONO source buffer
+#define M_MONO_TO_BGR                           0x00000002L
+#define M_MONO_TO_RGB                           0x00000003L
+#define M_MONO_TO_YUV                           0x00000004L
+#define M_MONO_TO_YCBCRSD                       0x00000005L
+#define M_MONO_TO_YCRCBSD                       M_MONO_TO_YCBCRSD //Obsolete
+#define M_MONO_TO_YCBCRHD                       0x00000006L
+#define M_MONO_TO_YCRCBHD                       M_MONO_TO_YCBCRHD //Obsolete
+#define M_BGR_TO_MONO                           0x00000007L //BGR source buffer
+#define M_BGR_TO_BGR                            0x00000008L
+#define M_BGR_TO_YUV                            0x00000009L
+#define M_BGR_TO_YCBCRSD                        0x0000000AL
+#define M_BGR_TO_YCRCBSD                        M_BGR_TO_YCBCRSD  //Obsolete
+#define M_BGR_TO_YCBCRHD                        0x0000000BL
+#define M_BGR_TO_YCRCBHD                        M_BGR_TO_YCBCRHD  //Obsolete
+#define M_RGB_TO_MONO                           0x0000000CL //RGB source buffer
+#define M_RGB_TO_RGB                            0x0000000DL
+#define M_RGB_TO_YUV                            0x0000000EL
+#define M_RGB_TO_YCBCRSD                        0x0000000FL
+#define M_RGB_TO_YCRCBSD                        M_RGB_TO_YCBCRSD  //Obsolete
+#define M_RGB_TO_YCBCRHD                        0x00000010L
+#define M_RGB_TO_YCRCBHD                        M_RGB_TO_YCBCRHD  //Obsolete
+#define M_YUV_TO_MONO                           0x00000011L //YUV source buffer
+#define M_YUV_TO_BGR                            0x00000012L
+#define M_YUV_TO_RGB                            0x00000013L
+#define M_YUV_TO_YUV                            0x00000014L
+#define M_YUV_TO_YCBCRSD                        0x00000015L
+#define M_YUV_TO_YCRCBSD                        M_YUV_TO_YCBCRSD  //Obsolete
+#define M_YUV_TO_YCBCRHD                        0x00000016L
+#define M_YUV_TO_YCRCBHD                        M_YUV_TO_YCBCRHD  //Obsolete
+#define M_YCBCRSD_TO_MONO                       0x00000017L //YCrCb SDTV source buffer
+#define M_YCRCBSD_TO_MONO                       M_YCBCRSD_TO_MONO //Obsolete
+#define M_YCBCRSD_TO_BGR                        0x00000018L
+#define M_YCRCBSD_TO_BGR                        M_YCBCRSD_TO_BGR  //Obsolete
+#define M_YCBCRSD_TO_RGB                        0x00000019L
+#define M_YCRCBSD_TO_RGB                        M_YCBCRSD_TO_RGB  //Obsolete
+#define M_YCBCRSD_TO_YUV                        0x0000001AL
+#define M_YCRCBSD_TO_YUV                        M_YCBCRSD_TO_YUV  //Obsolete
+#define M_YCBCRSD_TO_YCRCBSD                    0x0000001BL
+#define M_YCRCBSD_TO_YCRCBSD                    M_YCBCRSD_TO_YCRCBSD //Obsolete
+#define M_YCBCRHD_TO_MONO                       0x0000001CL //YCrCb HDTV source buffer
+#define M_YCRCBHD_TO_MONO                       M_YCBCRHD_TO_MONO //Obsolete
+#define M_YCBCRHD_TO_BGR                        0x0000001DL
+#define M_YCRCBHD_TO_BGR                        M_YCBCRHD_TO_BGR  //Obsolete
+#define M_YCBCRHD_TO_RGB                        0x0000001EL
+#define M_YCRCBHD_TO_RGB                        M_YCBCRHD_TO_RGB  //Obsolete
+#define M_YCBCRHD_TO_YUV                        0x0000001FL
+#define M_YCRCBHD_TO_YUV                        M_YCBCRHD_TO_YUV  //Obsolete
+#define M_YCBCRHD_TO_YCBCRHD                    0x00000020L
+#define M_YCRCBHD_TO_YCRCBHD                    M_YCBCRHD_TO_YCBCRHD //Obsolete
+
+// !!! MAP FOR OLD DEFINES
+#if OldDefinesSupport
+#define M_SETUP                                       M_DEFAULT
+MIL_DEPRECATED(M_SETUP, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_FORMAT                M_PRIMARY_SURFACE_FORMAT
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_FORMAT, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_SIZE_BITS             M_PRIMARY_SURFACE_SIZE_BITS
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_SIZE_BITS, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_SIZE_X                M_PRIMARY_SURFACE_SIZE_X
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_SIZE_X, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_SIZE_Y                M_PRIMARY_SURFACE_SIZE_Y
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_SIZE_Y, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_PITCH_BYTE            M_PRIMARY_SURFACE_PITCH_BYTE
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_PITCH_BYTE, 1000)
+#define M_PRIMARY_DDRAW_SURFACE_MEM_PTR               4515
+MIL_DEPRECATED(M_PRIMARY_DDRAW_SURFACE_MEM_PTR, 1000)
+#define M_DDRAW_LIVE_VIDEO_FORMAT_SUPPORTED           M_UNDERLAY_LIVE_FORMAT_SUPPORTED
+MIL_DEPRECATED(M_DDRAW_LIVE_VIDEO_FORMAT_SUPPORTED, 1000)
+#define M_DDRAW_UNDERLAY_FORMAT_SUPPORTED             M_UNDERLAY_FORMAT_SUPPORTED
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_FORMAT_SUPPORTED, 1000)
+#define M_DDRAW_UNDERLAY_SUPPORTED                    M_UNDERLAY_SUPPORTED
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_SUPPORTED, 1000)
+#define M_DDRAW_UNDERLAY_ZOOM_MAX                     M_UNDERLAY_ZOOM_MAX
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_ZOOM_MAX, 1000)
+#define M_DDRAW_UNDERLAY_ZOOM_MIN                     M_UNDERLAY_ZOOM_MIN
+MIL_DEPRECATED(M_DDRAW_UNDERLAY_ZOOM_MIN, 1000)
+#define M_LIVE_GRAB_END_TRIGGER                       M_GRAB_CONTINUOUS_END_TRIGGER
+MIL_DEPRECATED(M_LIVE_GRAB_END_TRIGGER, 1000)
+#define M_LAST_GRAB_IN_ACTUAL_BUFFER                  M_LAST_GRAB_IN_TRUE_BUFFER
+MIL_DEPRECATED(M_LAST_GRAB_IN_ACTUAL_BUFFER, 1000)
+#define M_SYS_TYPE                                    M_SYSTEM_TYPE
+MIL_DEPRECATED(M_SYS_TYPE, 1000)
+#define M_SYS_NUMBER                                  M_NUMBER
+MIL_DEPRECATED(M_SYS_NUMBER, 1000)
+#define M_SYS_INIT_FLAG                               M_INIT_FLAG
+MIL_DEPRECATED(M_SYS_INIT_FLAG, 1000)
+#define M_SYS_DISPLAY_NUM                             4548
+MIL_DEPRECATED(M_SYS_DISPLAY_NUM, 1000)
+#define M_SYS_DISPLAY_TYPE                            M_DISPLAY_TYPE
+MIL_DEPRECATED(M_SYS_DISPLAY_TYPE, 1000)
+#define M_SYS_DIGITIZER_NUM                           M_DIGITIZER_NUM
+MIL_DEPRECATED(M_SYS_DIGITIZER_NUM, 1000)
+#define M_SYS_DIGITIZER_TYPE                          M_DIGITIZER_TYPE
+MIL_DEPRECATED(M_SYS_DIGITIZER_TYPE, 1000)
+#define M_SYS_PROCESSOR_NUM                           M_PROCESSOR_NUM
+MIL_DEPRECATED(M_SYS_PROCESSOR_NUM, 1000)
+#define M_SYS_BOARD_TYPE                              M_BOARD_TYPE
+MIL_DEPRECATED(M_SYS_BOARD_TYPE, 1000)
+#define M_SYS_BOARD_REVISION                          M_BOARD_REVISION
+MIL_DEPRECATED(M_SYS_BOARD_REVISION, 1000)
+#define M_SYS_TUNER_NUM                               M_TUNER_NUM
+MIL_DEPRECATED(M_SYS_TUNER_NUM, 1000)
+#define M_SYS_TUNER_TYPE                              M_TUNER_TYPE
+MIL_DEPRECATED(M_SYS_TUNER_TYPE, 1000)
+#define M_SYS_RGB_MODULE_NUM                          M_RGB_MODULE_NUM
+MIL_DEPRECATED(M_SYS_RGB_MODULE_NUM, 1000)
+#define M_SYS_RGB_MODULE_TYPE                         M_RGB_MODULE_TYPE
+MIL_DEPRECATED(M_SYS_RGB_MODULE_TYPE, 1000)
+#define M_SYS_DUAL_SCREEN_MODE                        4518
+MIL_DEPRECATED(M_SYS_DUAL_SCREEN_MODE, 1000)
+#define M_SYS_UNDERLAY_SURFACE_AVAILABLE              4517
+MIL_DEPRECATED(M_SYS_UNDERLAY_SURFACE_AVAILABLE, 1000)
+#define M_SYS_UNDERLAY_SURFACE_PHYSICAL_ADDRESS       M_PHYSICAL_ADDRESS_UNDERLAY
+MIL_DEPRECATED(M_SYS_UNDERLAY_SURFACE_PHYSICAL_ADDRESS, 1000)
+#define M_SYS_WIN_MODE                                M_WIN_MODE
+MIL_DEPRECATED(M_SYS_WIN_MODE, 1000)
+#define M_ON_BOARD_MEM_ADRS                           M_PHYSICAL_ADDRESS_UNDERLAY
+MIL_DEPRECATED(M_ON_BOARD_MEM_ADRS, 1000)
+#define M_ON_BOARD_VGA_ADRS                           4508
+MIL_DEPRECATED(M_ON_BOARD_VGA_ADRS, 1000)
+#define MMX_EXTRA_BYTES                               M_MMX_EXTRA_BYTES
+MIL_DEPRECATED(MMX_EXTRA_BYTES, 1000)
+#define M_LOCATION_WORK_HOST                          M_SYSTEM_HOST_TYPE
+MIL_DEPRECATED(M_LOCATION_WORK_HOST, 1000)
+#define M_DMA_POOL_FREE                               M_NON_PAGED_MEMORY_FREE
+MIL_DEPRECATED(M_DMA_POOL_FREE, 1000)
+#define M_DMA_POOL_USED                               M_NON_PAGED_MEMORY_USED
+MIL_DEPRECATED(M_DMA_POOL_USED, 1000)
+#define M_DMA_POOL_SIZE                               M_NON_PAGED_MEMORY_SIZE
+MIL_DEPRECATED(M_DMA_POOL_SIZE, 1000)
+#define M_BOTH_FIELD                                  M_BOTH_FIELDS
+MIL_DEPRECATED(M_BOTH_FIELD, 1000)
+
+#define M_FPGA_TEMPERATURE                            M_TEMPERATURE_FPGA
+MIL_DEPRECATED(M_FPGA_TEMPERATURE, 1000)
+#define M_FPGA_TEMPERATURE_MAX_MEASURED               M_TEMPERATURE_FPGA_MAX_MEASURED
+MIL_DEPRECATED(M_FPGA_TEMPERATURE_MAX_MEASURED, 1000)
+#define M_FPGA_VOLTAGE_VCCINT                         M_VOLTAGE_FGPA_VCCINT
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCINT, 1000)
+#define M_FPGA_VOLTAGE_VCCINT_MIN_MEASURED            M_VOLTAGE_FPGA_VCCINT_MIN_MEASURED
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCINT_MIN_MEASURED, 1000)
+#define M_FPGA_VOLTAGE_VCCINT_MAX_MEASURED            M_VOLTAGE_FPGA_VCCINT_MAX_MEASURED
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCINT_MAX_MEASURED, 1000)
+#define M_FPGA_VOLTAGE_VCCAUX                         M_VOLTAGE_FPGA_VCCAUX
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCAUX, 1000)
+#define M_FPGA_VOLTAGE_VCCAUX_MIN_MEASURED            M_VOLTAGE_FPGA_VCCAUX_MIN_MEASURED
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCAUX_MIN_MEASURED, 1000)
+#define M_FPGA_VOLTAGE_VCCAUX_MAX_MEASURED            M_VOLTAGE_FPGA_VCCAUX_MAX_MEASURED
+MIL_DEPRECATED(M_FPGA_VOLTAGE_VCCAUX_MAX_MEASURED, 1000)
+#define M_PROCESSING_FPGA_TEMPERATURE                 M_TEMPERATURE_FPGA_PROCESSING
+MIL_DEPRECATED(M_PROCESSING_FPGA_TEMPERATURE, 1000)
+#define M_PROCESSING_FPGA_TEMPERATURE_MAX_MEASURED    M_TEMPERATURE_FPGA_PROCESSING_MAX_MEASURED
+MIL_DEPRECATED(M_PROCESSING_FPGA_TEMPERATURE_MAX_MEASURED, 1000)
+
+#endif // !!! MAP FOR OLD DEFINES
+
+/************************************************************************/
+/* MsysInquire() / MsysControl() Values                                 */
+/************************************************************************/
+
+#define M_FORCE                                       -9998L
+#define M_L1                                              1L
+
+//Values for the M_MPEG_BIT_RATE_MODE
+#define M_CONSTANT                                    0x8000L
+#define M_VARIABLE                                    2L
+#define M_VARIABLE_MAX                                3L
+#define M_CONSTANT_QUALITY                            4L
+
+#define M_BASIC                                       0x00200000L
+#define M_ADVANCED                                    0x00400000L
+
+#define M_PROFILE_BASELINE                            102L
+#define M_PROFILE_MAIN                                103L
+#define M_PROFILE_HIGH                                104L
+#define M_PROFILE_EXTENDED                            105L
+#define M_PROFILE_HIGH10                              106L
+#define M_PROFILE_HIGH422                             107L
+#define M_PROFILE_HIGH444                             108L
+#define M_PROFILE_CAVLC                               109L
+
+#define M_FRAME_RATE_24                               110L
+#define M_FRAME_RATE_24M                              111L
+#define M_FRAME_RATE_25                               112L
+#define M_FRAME_RATE_30                               113L
+#define M_FRAME_RATE_30M                              114L
+#define M_FRAME_RATE_50                               115L
+#define M_FRAME_RATE_60                               116L
+#define M_FRAME_RATE_60M                              117L
+
+
+
+// M_MODIFIED_BUFFER_HOOK_MODE values
+#define M_MULTI_THREAD                                0x1000
+#define M_SINGLE_THREAD                               0x2000
+#define M_NO_LIMIT                                    0x4000
+
+// M_IO_SOURCE+M_AUX_IOn values
+// Reserve lower 16 bits for combinations (M_DIGITIZER_DEV0+ ...)
+#define M_DIGITIZER_DEVx_INDEX_OFFSET                 16
+#define M_DIGITIZER_DEVx_INDEX_MASK                   (0xFF << M_DIGITIZER_DEVx_INDEX_OFFSET)
+#define M_DIGITIZER_DEVx_GET_INDEX(X)                 ((((M_DIGITIZER_DEVx_INDEX_MASK & X ) >> M_DIGITIZER_DEVx_INDEX_OFFSET ) - 1))
+#define M_DIGITIZER_DEV0                              0x010000
+#define M_DIGITIZER_DEV1                              0x020000
+#define M_DIGITIZER_DEV2                              0x030000
+#define M_DIGITIZER_DEV3                              0x040000
+#define M_DIGITIZER_DEV4                              0x050000
+#define M_DIGITIZER_DEV5                              0x060000
+#define M_DIGITIZER_DEV6                              0x070000
+#define M_DIGITIZER_DEV7                              0x080000
+#define M_DIGITIZER_DEV8                              0x090000
+#define M_DIGITIZER_DEV9                              0x0A0000
+#define M_DIGITIZER_DEV10                             0x0B0000
+#define M_DIGITIZER_DEV11                             0x0C0000
+#define M_DIGITIZER_DEV12                             0x0D0000
+#define M_DIGITIZER_DEV13                             0x0E0000
+#define M_DIGITIZER_DEV14                             0x0F0000
+#define M_DIGITIZER_DEV15                             0x100000
+#define M_PWM                                         0x000200
+#define M_PHASE1                                      0x000400
+#define M_PHASE2                                      0x000800
+
+// Values for M_DISTRIBUTED_MIL inquire
+#define M_DMIL_NOT_USED                               0
+#define M_DMIL_LOCAL_HOST                             1
+#define M_DMIL_REMOTE                                 2
+#define M_DMIL_TCPIP                                  3
+#define M_DMIL_SHM                                    4
+#define M_DMIL_PCIE                                   5
+#define M_DMIL_SHMRT                                  6
+#define M_DMIL_UNKNOWN_PROTOCOL                       7
+
+
+/************************************************************************/
+/* Msys other defines                                                   */
+/************************************************************************/
+// Maximum string size for M_CPU_VENDOR_NAME inquire value
+#define M_CPU_VENDOR_NAME_MAX_SIZE                    13L
+
+// Maximum string size for M_SYSTEM_NAME inquire value
+#define M_SYSTEM_NAME_MAX_SIZE                        64L
+
+/************************************************************************/
+/* MsysHookFunction()                                                   */
+/************************************************************************/
+#define M_FEATURE_CHANGE                              26L
+#define M_GC_FIRMWARE_UPDATE_PROGRESS                 27L
+#define M_USER_BIT_CHANGE                             2244L
+
+#define M_USER_BIT_CHANGE_HANDLER_PTR                 2245L
+/* Reserve next 18 values                       from  2246L*/
+/*                                             to     2264L*/
+#define M_USER_BIT_CHANGE_HANDLER_USER_PTR             2266L
+/* Reserve next 19 values                       from  2267L*/
+/*                                             to     2285L*/
+#if OldDefinesSupport
+MIL_DEPRECATED(M_USER_BIT_CHANGE, 1000)     // New IO API Replaced by M_IO_CHANGE
+MIL_DEPRECATED(M_USER_BIT_CHANGE_HANDLER_PTR, 1000)     // New IO API Replaced by M_IO_CHANGE_HANDLER_PTR
+MIL_DEPRECATED(M_USER_BIT_CHANGE_HANDLER_USER_PTR, 1000)    // New IO API Replaced by M_IO_CHANGE_HANDLER_USER_PTR
+#endif
+
+// Values h264 encoding
+#define M_HOOK_ENCODING_END                           2304L
+/* Reserve next 62 values                       from  2305L*/
+/*                                             to     2367L*/
+#define M_WATCHDOG_BITE_WARNING                       2377
+
+#define M_IO_CHANGE                                   0x0008B000L
+#define M_IO_CHANGE_HANDLER_PTR                       0x0008B001L
+/* Reserve next 0x1000 values                    from  0x0008B002L*/
+/*                                              to    0x0008B000L*/
+#define M_IO_CHANGE_HANDLER_USER_PTR                  0x0008C000L
+/* Reserve next 0x1000 values                    from  2267L*/
+/*                                              to    2285L*/
+
+
+/************************************************************************/
+/* MsysGetHookInfo()                                                    */
+/************************************************************************/
+
+#define M_USER_BIT                              MAKE_INT64(0x00000000A0000000)
+/* Reserve next 31 values                      from   4088L*/
+/*                                             to     4118L*/
+#define M_USER_BIT_FIELD                              4181L
+#define M_IO_INTERRUPT_SOURCE                   0x0008A000L
+/* Reserve next 0x1000 values                   from  0x0008A001L*/
+/*                                              to    0x0008AFFFL*/
+
+#define M_SYSTEM_ID                             0x00020000L
+// Values h264 encoding
+#define M_HOOK_ENCODING_STREAM_PTR                      2304L
+/* Reserve next 62 values                       from  2305L*/
+/*                                             to     2367L*/
+
+/************************************************************************/
+/* MsysConfigAccess()                                                   */
+/************************************************************************/
+#define M_PCI_CONFIGURATION_SPACE                     0L
+#define M_DETECT_PCI_DEVICE                           1L
+
+
+#define M_DEFAULT                                     0x10000000L
+#define M_READ                                        1
+#define M_WRITE                                       2
+#define M_BIG_ENDIAN                                  0x00080000L
+#define M_LITTLE_ENDIAN                               0x00000200L
+
+
+#define M_PCI_VENDOR_ID                               0x00 // (16 lsb)
+#define M_PCI_DEVICE_ID                               0x00 // (16 msb)
+#define M_PCI_COMMAND                                 0x01 // (16 lsb)
+#define M_PCI_STATUS                                  0x01 // (16 msb)
+#define M_PCI_REVISION_ID                             0x02 // (byte 0)
+#define M_PCI_CLASS_CODE                              0x02 // (byte 1,2,3)
+#define M_PCI_LATENCY_TIMER                           0x03 // (byte 1)
+#define M_PCI_BASE_ADRS0                              0x04 //
+#define M_PCI_BASE_ADRS1                              0x05 //
+#define M_PCI_BASE_ADRS2                              0x06 //
+#define M_PCI_INT_LINE                                0x0F // (byte 0)
+#define M_PCI_INT_PIN                                 0x0F // (byte 1)
+
+//Auxiliary IO values
+#define M_OFF                                         0L       // Must be zero
+#define M_ON                                          1L
+#define M_INPUT                                       2L
+#define M_OUTPUT                                      3L
+#define M_EDGE_RISING                                 12L
+#define M_EDGE_FALLING                                13L
+#define M_ANY_EDGE                                    50L
+#define M_DISABLE                                     -9999L
+#define M_ENABLE                                      -9997L
+
+// POWER definition
+#define M_OFF                                         0L       // Must be zero
+#define M_ON                                          1L
+#define M_SENSE                                       10L
+#define M_UNDER_CURRENT                               14L
+#define M_OVER_CURRENT                                15L
+
+/************************************************************************/
+/* MsysIoControl/MsysIoInquire()                                        */
+/************************************************************************/
+#define M_LATCH0                                    0 // reserved, should not use
+#define M_LATCH1                                    1
+#define M_LATCH2                                    2
+#define M_LATCH3                                    3
+#define M_LATCH4                                    4
+#define M_LATCH5                                    5
+#define M_LATCH6                                    6
+#define M_LATCH7                                    7
+#define M_LATCH8                                    8
+#define M_LATCH9                                    9
+#define M_LATCH10                                   10
+#define M_LATCH11                                   11
+#define M_LATCH12                                   12
+#define M_LATCH13                                   13
+#define M_LATCH14                                   14
+#define M_LATCH15                                   15
+#define M_LATCH16                                   16
+
+// #define M_CLOCK_FREQUENCY                           5505L moved to MIL_DOUBLE range
+#define M_IO_COMMAND_COUNTER_ACTIVATION             5506L
+#define M_IO_COMMAND_CANCEL                         5507L
+
+#define M_REFERENCE_LATCH_TRIGGER_SOURCE            5510L
+// Reserve next 31 elements from 5511 to 5541
+
+#define M_REFERENCE_LATCH_ACTIVATION                5550L
+// Reserve next 31 elements from 5551 to 5581
+
+#define M_REFERENCE_LATCH_STATE                     5600L
+// Reserve next 31 elements from 5601 to 5631
+
+
+#define M_SYS_IO_INQUIRE_MIL_ID_START                 1100L
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_OWNER_SYSTEM                                1101L
+#define M_GC_ACTION_ADD_DEVICE                        1102L
+#define M_GC_ACTION_REMOVE_DEVICE                     1103L
+#define M_SYS_IO_INQUIRE_MIL_ID_END                   1199L
+
+
+#define M_SYS_IO_INQUIRE_SIZEOF_INT64_START           6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+#define M_REFERENCE_VALUE                             6700L
+#define M_IO_COMMAND_COUNTER_SOURCE                   6701L
+#define M_IO_COMMAND_LIST_NUMBER                      6702L
+#define M_IO_OBJECT_TYPE                              6703L
+
+//  Reserve next 31 element from 6702 to 6732
+#define M_SYS_IO_INQUIRE_SIZEOF_INT64_END             6799L
+
+#define M_SYS_IO_INQUIRE_SIZEOF_INT64_START2          0x40000L
+#define M_REFERENCE_LATCH_VALUE                       0x40000L
+// Reserve next 0x700 elements because we can combine in MsysGetHookInfo with M_IO_COMMAND_LISTx
+#define M_SYS_IO_INQUIRE_SIZEOF_INT64_END2            0x43000L
+
+#define M_SYS_IO_INQUIRE_SIZEOF_DOUBLE_START          7300L
+// Inquire value with a size of double, must be in that range : 7300-7399
+#define M_CLOCK_FREQUENCY                             7301L
+#define M_SYS_IO_INQUIRE_SIZEOF_DOUBLE_END            7399L
+
+
+#define M_SYS_IO_INQUIRE_UNKNOWN_SIZEOF_START         7500L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 7500-7599
+#define M_SYS_IO_INQUIRE_UNKNOWN_SIZEOF_END           7599L
+
+
+// Inquire value with string type must be in that range : 7700-7799
+#define M_SYS_IO_INQUIRE_STRING_START                 7700L
+#define M_SYS_IO_INQUIRE_STRING_END                   7799L
+
+
+/************************************************************************/
+/* MthrXxxxxx                                                           */
+/************************************************************************/
+#define M_DEFAULT                                     0x10000000L
+#define M_SIGNALED                                    0x00000010L
+#define M_NOT_SIGNALED                                0x00000020L
+#define M_AUTO_RESET                                  0x00002000L
+#define M_MANUAL_RESET                                0x00004000L
+#define M_TRACE_LOG_DISABLE                           0x00400000L
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+
+#define M_ENABLE                                      -9997L
+#define M_DISABLE                                     -9999L
+
+/************************************************************************/
+/* MthrAlloc                                                            */
+/************************************************************************/
+#define M_ALL                                         0x40000000L
+
+#define M_EVENT                                       0x00000080L
+#define M_EVENT_CREATE                                0x00000200L
+#define M_THREAD                                      M_SYSTEM_THREAD  // 0x00000100
+#define M_SELECTABLE_THREAD                           0x00001000L
+#define M_THREAD_CREATE                               0x00000800L
+#define M_THREAD_CREATE_ON_ID                         0x00002000L
+#define M_MUTEX                                       0x10000000L
+#define M_CORE_USE_BIT                                0x00001000L
+#define M_CORE_USE(X)                                 (M_CORE_USE_BIT | ((X & 0x3F) << 6))
+#define M_EXTRACT_CORE_USE(X)                         ((X >> 6) & 0x3F)
+#define M_CORE_USE_MASK                               M_CORE_USE(63)
+
+/************************************************************************/
+/* MthrControl only                                                     */
+/************************************************************************/
+#define M_THREAD_COMMANDS_ABORT                       1810L
+#define M_THREAD_SELECT                               1708L
+#define M_EVENT_SET                                   1707L
+
+#define M_LOCK                                        20480L   // 0x00005000
+#define M_UNLOCK                                      24576L   // 0x00006000
+
+#define M_THR_CONT_TYPE_MASK                          0x00FFFFFFL
+#define M_THR_CONT_TYPE(n)                            (n&M_THR_CONT_TYPE_MASK)
+
+#define M_THREAD_CURRENT                              0x01000000L
+#define M_THREAD_ALL                                  0x02000000L
+#define M_QUEUED                                      0x04000000L //To be ORed with M_THREAD_COMMANDS_ABORT
+#define M_LOW_LATENCY                                 0x00001000L // Command remove node used in ThreadCancel
+
+
+/************************************************************************/
+/* MthrControl / Inquire                                                */
+/************************************************************************/
+#define M_THREAD_MODE                                 1804L
+#define M_THREAD_TIME_SLICE                           1811L
+#define M_THREAD_PRIORITY                             1019L
+#define M_ACCELERATOR                                 1813L
+#define M_BUS_MASTER_COPY_MODE                        1815L
+#define M_NODE_SELECT                                 1816L
+#if OldDefinesSupport
+   #define M_MP_MAX_CORES                             1818L
+   MIL_DEPRECATED(M_MP_MAX_CORES, 1060)
+#endif
+#define M_PU_INSTANCE_NUMBER                          1819L
+#define M_CORE_ID                                     1820L
+
+#define M_LOCK_TRY                                    28672L   // 0x00007000
+
+#define M_IDLE                                           1L
+#define M_LOWEST                                         6L
+#define M_BELOW_NORMAL                                   7L
+#define M_NORMAL                                         8L
+#define M_ABOVE_NORMAL                                   9L
+#define M_HIGHEST                                       10L
+#define M_TIME_CRITICAL                                 15L
+
+
+/************************************************************************/
+/* MthrInquire only                                                     */
+/************************************************************************/
+#define M_NATIVE_ID                                   1016L
+#define M_EVENT_STATE                                 1706L
+#define M_EVENT_MODE                                  1709L
+#if OldDefinesSupport
+   #define M_MP_MAX_CORES_EFFECTIVE                   1710L
+   MIL_DEPRECATED(M_MP_MAX_CORES_EFFECTIVE, 1060)
+#endif
+
+
+/************************************************************************/
+/* MthrInquireMp / MthrControlMp                                        */
+/*                                                                      */
+/* The flags for these functions are the same as for                    */
+/* MappControlMp and MappInquireMp and so are not duplicated here.      */
+/************************************************************************/
+
+
+/************************************************************************/
+/* MthrWait                                                             */
+/************************************************************************/
+#define M_THREAD_END_WAIT                             0x40000000L
+#define M_EVENT_WAIT                                  0x20000000L
+#define M_EVENT_SYNCHRONIZE                           0x08000000L
+#define M_THREAD_WAIT                                 0x01000000L
+#define M_INFINITE                                    -1L
+
+#define M_MAX_TIMEOUT                                 0xFFFFFFL
+#define M_TIMEOUT_MASK                                M_MAX_TIMEOUT
+#define M_EVENT_TIMEOUT(Val)                          (((unsigned long)Val >= M_MAX_TIMEOUT) ? 0 : Val)
+#define M_THREAD_TIMEOUT(Val)                         M_EVENT_TIMEOUT(Val)
+#define M_WAIT_OPTION_WITHOUT_TIMEOUT(WaitOption)     (WaitOption&0xFF000000)
+#define M_EXTRACT_TIMEOUT(WaitOption)                 (WaitOption&M_TIMEOUT_MASK)
+
+/************************************************************************/
+/* MthrWaitMultiple                                                     */
+/************************************************************************/
+#define M_THREAD_END_WAIT                             0x40000000L
+#define M_EVENT_WAIT                                  0x20000000L
+//#define M_DEFAULT                                     0x10000000L
+#define M_EVENT_SYNCHRONIZE                           0x08000000L
+#define M_ALL_OBJECTS                                 0x04000000L
+//#define M_THREAD_WAIT                                 0x01000000L
+#define M_THREAD_END_WAIT_ALL                         M_ALL_OBJECTS+M_THREAD_END_WAIT
+#define M_EVENT_WAIT_ALL                              M_ALL_OBJECTS+M_EVENT_WAIT
+#define M_EVENT_SYNCRONIZE_ALL                        M_ALL_OBJECTS+M_EVENT_SYNCHRONIZE
+
+#define M_MAX_TIMEOUT                                 0xFFFFFFL
+#define M_TIMEOUT_MASK                                M_MAX_TIMEOUT
+#define M_EVENT_TIMEOUT(Val) (((unsigned long)Val >= M_MAX_TIMEOUT) ? 0 : Val)
+#define M_THREAD_TIMEOUT(Val) M_EVENT_TIMEOUT(Val)
+#define M_WAIT_OPTION_WITHOUT_TIMEOUT(WaitOption) (WaitOption&0xFF000000)
+#define M_WAIT_OPTION_WITHOUT_TIMEOUT_AND_ALL_OBJECTS(WaitOption) (WaitOption&0xFB000000)
+#define M_EXTRACT_TIMEOUT(WaitOption)             (WaitOption&M_TIMEOUT_MASK)
+
+#define M_MAXIMUM_WAIT_OBJECTS                        64L
+
+
+/************************************************************************/
+/* MdigAlloc() defines                                                  */
+/************************************************************************/
+#define M_GC_DEVICE_IP_ADDRESS                        1
+#define M_GC_DEVICE_NAME                              2
+#define M_DEV_NUMBER                                  3
+
+#define M_GC_DEVICE_USER_NAME                         M_GC_DEVICE_NAME
+#if OldDefinesSupport
+MIL_DEPRECATED(M_GC_DEVICE_USER_NAME, 1100)
+#endif
+//Add non-bitwise values above
+
+#define M_DIG_NON_BITWISE_MASK                        0x0000000FL
+#define M_USE_MEMORY_DCF                              0x00000010L
+#define M_DCF_REALLOC                                 0x00000020L
+#define M_SHARED_BANDWIDTH                            0x00000200L
+#define M_EMULATED                                    0x00000400L
+#define M_1394_BANDWIDTH_FLAG                         0x00000800L
+#define M_1394_BANDWIDTH(percent)   ( (((long) percent > 0) && ((long) percent <= 100)) ? (M_1394_BANDWIDTH_FLAG | ((long) percent)) : 0 )
+#define M_EXCLUSIVE_BANDWIDTH                         M_DEFAULT
+#define M_FAST                                        0x00002000L
+#define M_DEFAULT_1394                                0x00100000L
+#define M_GC_BROADCAST_MASTER                         0x00200000L
+#define M_GC_MULTICAST_MASTER                         0x00400000L
+#define M_GC_MULTICAST_SLAVE                          0x00800000L
+#define M_GC_SLAVE                                    M_GC_MULTICAST_SLAVE
+#if OldDefinesSupport
+MIL_DEPRECATED(M_GC_SLAVE, 1000)
+#endif
+#define M_GC_MULTICAST_MONITOR                        0x01000000L
+#define M_GC_XML_DOWNLOAD_SKIP                        0x00000080L
+#define M_GC_XML_FORCE_DOWNLOAD                       0x00000040L
+#define M_GC_PACKET_SIZE_NEGOTIATION_SKIP             0x00004000L
+#define M_MINIMAL                                     0x00001000L
+#define M_GC_MANIFEST_ENTRY_BIT                       0x20000000L
+#define M_GC_MANIFEST_ENTRY_SHIFT                     32
+#define M_GC_MANIFEST_ENTRY_MASK                      0xF
+#define M_GC_MANIFEST_ENTRY(N)                        (((((MIL_UINT64)N) & M_GC_MANIFEST_ENTRY_MASK) << M_GC_MANIFEST_ENTRY_SHIFT) | M_GC_MANIFEST_ENTRY_BIT)
+#define M_GC_MANIFEST_ENTRY_RESERVED_BITS             M_GC_MANIFEST_ENTRY(0xF)
+
+#define M_DIG_DEV_IS_STRING(X) (((X & M_DIG_NON_BITWISE_MASK) == M_GC_DEVICE_IP_ADDRESS) || ((X & M_DIG_NON_BITWISE_MASK) == M_GC_DEVICE_NAME))
+#define M_GC_CAMERA_ID(X) ((MIL_INT)(X))
+
+#define M_DEV0                                        0L
+#define M_DEV1                                        1L
+#define M_DEV2                                        2L
+#define M_DEV3                                        3L
+#define M_DEV4                                        4L
+#define M_DEV5                                        5L
+#define M_DEV6                                        6L
+#define M_DEV7                                        7L
+#define M_DEV8                                        8L
+#define M_DEV9                                        9L
+#define M_DEV10                                       10L
+#define M_DEV11                                       11L
+#define M_DEV12                                       12L
+#define M_DEV13                                       13L
+#define M_DEV14                                       14L
+#define M_DEV15                                       15L
+#define M_DEV16                                       16L
+#define M_DEV17                                       17L
+#define M_DEV18                                       18L
+#define M_DEV19                                       19L
+#define M_DEV20                                       20L
+#define M_DEV21                                       21L
+#define M_DEV22                                       22L
+#define M_DEV23                                       23L
+#define M_DEV24                                       24L
+#define M_DEV25                                       25L
+#define M_DEV26                                       26L
+#define M_DEV27                                       27L
+#define M_DEV28                                       28L
+#define M_DEV29                                       29L
+#define M_DEV30                                       30L
+#define M_DEV31                                       31L
+#define M_DEV32                                       32L
+#define M_DEV33                                       33L
+#define M_DEV34                                       34L
+#define M_DEV35                                       35L
+#define M_DEV36                                       36L
+#define M_DEV37                                       37L
+#define M_DEV38                                       38L
+#define M_DEV39                                       39L
+#define M_DEV40                                       40L
+#define M_DEV41                                       41L
+#define M_DEV42                                       42L
+#define M_DEV43                                       43L
+#define M_DEV44                                       44L
+#define M_DEV45                                       45L
+#define M_DEV46                                       46L
+#define M_DEV47                                       47L
+#define M_DEV48                                       48L
+#define M_DEV49                                       49L
+#define M_DEV50                                       50L
+#define M_DEV51                                       51L
+#define M_DEV52                                       52L
+#define M_DEV53                                       53L
+#define M_DEV54                                       54L
+#define M_DEV55                                       55L
+#define M_DEV56                                       56L
+#define M_DEV57                                       57L
+#define M_DEV58                                       58L
+#define M_DEV59                                       59L
+#define M_DEV60                                       60L
+#define M_DEV61                                       61L
+#define M_DEV62                                       62L
+#define M_DEV63                                       63L
+
+/************************************************************************/
+/* MdigInquire() / MdigControl() Types                                  */
+/************************************************************************/
+/************************************************************************/
+/* MdigInquire() Types MIL_INT                                          */
+/************************************************************************/
+
+//Used, as combination constants, to target board vs camera with MdigInquire/MdigControl
+#define M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK          MAKE_INT64(0x0000000300000000)
+#define M_CAMERA                                      MAKE_INT64(0x0000000100000000)
+#define M_BOARD                                       MAKE_INT64(0x0000000200000000)
+#define M_DIG_DISPATCH_IMMEDIATE                      MAKE_INT64(0x0800000000000000)
+#define M_DIG_STRIP_CAM_BIT(X)                        (X & (~M_CAMERA))
+#define M_DIG_STRIP_BRD_BIT(X)                        (X & (~M_BOARD))
+#define M_DIG_STRIP_CAM_BRD_BITS(X)                   (X & (~(M_CAMERA | M_BOARD)))
+#define M_DIG_CAM_BIT_SET(X)                          ((X & M_CAMERA) ? M_TRUE : M_FALSE)
+#define M_DIG_BRD_BIT_SET(X)                          ((X & M_BOARD) ? M_TRUE : M_FALSE)
+#define M_DIG_CAM_BRD_BITS_SET(X)                     (((X & (M_CAMERA|M_BOARD)) == (M_CAMERA|M_BOARD)) ? M_TRUE : M_FALSE)
+
+#if OldDefinesSupport
+#define M_DIG_STRING_LEN(A)                           ((A&~M_CLIENT_TEXT_ENCODING) | M_STRING_SIZE)
+MIL_DEPRECATED(M_DIG_STRING_LEN, 1000)
+#endif
+
+#define M_IRIS                                        160L
+/* Reserve next 2 value 131, 132*/
+#define M_NO_INPUT_PRESENT                            0x00000080L
+#define M_SIZE_BAND                                   1005L
+#define M_SIZE_BAND_LUT                               1006L
+#define M_SIZE_BIT                                    1007L
+#define M_TYPE                                        1008L
+#define M_NUMBER                                      1009L
+#define M_INIT_FLAG                                   1012L
+#define M_ATTRIBUTE                                   1013L
+#define M_SIGN                                        1014L
+#define M_NATIVE_ID                                   1016L
+#define M_COLOR_MODE                                  1018L
+#define M_THREAD_PRIORITY                             1019L
+#define M_OWNER_SYSTEM_TYPE                           1023L
+#define M_LOW_LEVEL_API_OBJECT                        1024L
+#define M_EFFECTIVE_SIZE_BIT                          1039L
+#define M_MIL_ID_INTERNAL                             1049L
+#define M_GENICAM_AVAILABLE                           1079L
+#define M_NUMBER_OF_FRAMES                            1080L
+#define M_SOURCE_NUMBER_OF_FRAMES                     1080L
+
+
+/************************************************************************/
+/* MdigInquire() Types MIL_ID range start                               */
+/************************************************************************/
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_DIG_INQUIRE_MIL_ID_START                    1100L
+#define M_OWNER_SYSTEM                                1101L
+#define M_LUT_ID                                      1102L
+#define M_GENTL_ANNOUNCE_BUFFER                       1103L
+#define M_GENTL_REVOKE_BUFFER                         1104L
+#define M_DRIVER_HOOK_CONTEXT_REMOTE_ID               1170L
+/* Reserve next 20 values                      from   1170L*/
+/*                                             to     1189L*/
+#define M_DRIVER_HOOK_CONTEXT_REMOTE_ID_END           1189L
+#define M_SHADING_CORRECTION_OFFSET_ID                1190L
+#define M_SHADING_CORRECTION_GAIN_ID                  1191L
+
+#define M_DIG_INQUIRE_MIL_ID_END                      1199L
+
+/************************************************************************/
+/* MdigInquire() Types MIL_INT                                          */
+/************************************************************************/
+
+#define M_SIZE_X                                      1536L // 0x600
+#define M_SIZE_Y                                      1537L // 0x601
+#define M_SIZE_Z                                      1538L // 0x602
+
+#define M_CAPTURE_RAW_DATA                            1580L
+#define M_ROTARY_ENCODER                              0x700L // 1792L
+#define M_LIVE_GRAB                                   2034L
+#define M_GRAB_CONTINUOUS_END_TRIGGER                 2038L
+#define M_LAST_GRAB_IN_TRUE_BUFFER                    2046L
+#define M_DISPLAY_DOUBLE_BUFFERING                    2071L
+#define M_SERIAL_NUMBER_0                             2099L
+#define M_SERIAL_NUMBER_1                             2100L
+#define M_TEST_IMAGE                                  2102L
+#define M_TEST_FRAME_COUNTER_DRAW                     2103L
+#define M_TEST_FRAME_COUNTER                          2104L
+
+#define M_GENTL_INTERFACE_INDEX                       2105L
+#define M_GENTL_STREAM_COUNT                          2106L
+
+#define M_CHANNEL                                     4000L  
+#define M_CHANNEL_SYNC                                M_CHANNEL + M_SYNC
+#define M_CHANNEL_SIGNAL                              M_CHANNEL + M_SIGNAL
+/* Reserve next 1 bits                         from  (4000L | 0x00800000L)*/
+#define M_CHANNEL_NUM                                 4001L
+#define M_BASE_BLACK_REF                              4002L
+
+#define M_GRAB_MODE                                   4016L
+#define M_GRAB_FRAME_NUM                              4017L
+#define M_GRAB_FIELD_NUM                              4018L
+#define M_GRAB_INPUT_GAIN                             4019L    // dependent of M_LUMINANCE and M_CHROMINANCE
+#define M_INPUT_MODE                                  4020L
+#define M_SCAN_MODE                                   4021L
+#define M_SOURCE_SIZE_X                               4022L
+#define M_SOURCE_SIZE_Y                               4023L
+#define M_SOURCE_OFFSET_X                             4024L
+#define M_SOURCE_OFFSET_Y                             4025L
+#define M_SECONDARY_SOURCE_SIZE_X                     4026L
+#define M_SECONDARY_SOURCE_SIZE_Y                     4027L
+#define M_SECONDARY_SOURCE_OFFSET_X                   4028L
+#define M_SECONDARY_SOURCE_OFFSET_Y                   4029L
+#define M_GRAB_END_HANDLER_PTR                        4030L
+#define M_SOURCE_OFFSET_Y_DYNAMIC                     4031L  //Custom define for Iris GT DUAL
+#define M_GRAB_END_HANDLER_USER_PTR                   4032L
+#define M_GRAB_START_HANDLER_PTR                      4033L
+#define M_GRAB_START_HANDLER_USER_PTR                 4035L
+#define M_GRAB_FIELD_END_HANDLER_PTR                  4036L
+#define M_GRAB_FIELD_END_HANDLER_USER_PTR             4037L
+#define M_GRAB_FIELD_END_ODD_HANDLER_PTR              4038L
+#define M_GRAB_FIELD_END_ODD_HANDLER_USER_PTR         4039L
+#define M_GRAB_FIELD_END_EVEN_HANDLER_PTR             4040L
+#define M_GRAB_FIELD_END_EVEN_HANDLER_USER_PTR        4041L
+#define M_GRAB_FRAME_END_HANDLER_PTR                  4042L
+#define M_GRAB_FRAME_END_HANDLER_USER_PTR             4043L
+#define M_GRAB_FRAME_START_HANDLER_PTR                4044L
+#define M_GRAB_FRAME_START_HANDLER_USER_PTR           4045L
+#define M_FIELD_START_HANDLER_PTR                     4046L
+#define M_FIELD_START_HANDLER_USER_PTR                4047L
+#define M_FIELD_START_ODD_HANDLER_PTR                 4048L
+#define M_FIELD_START_ODD_HANDLER_USER_PTR            4049L
+#define M_FIELD_START_EVEN_HANDLER_PTR                4050L
+#define M_FIELD_START_EVEN_HANDLER_USER_PTR           4051L
+#define M_SCALING_Y_AVAILABLE                         4052L
+#define M_GRAB_TRIGGER_SOURCE                         4053L
+#define M_GRAB_TRIGGER_ACTIVATION                     4054L
+#define M_GRAB_TRIGGER_MODE                           M_GRAB_TRIGGER_ACTIVATION
+#if OldDefinesSupport
+MIL_DEPRECATED(M_GRAB_TRIGGER_MODE, 1000)     // New IO API Replaced by M_GRAB_TRIGGER_ACTIVATION
+#endif
+#define M_SOURCE_OFFSET_BIT                           4055L
+#define M_NATIVE_CAMERA_ID                            4060L
+#define M_VCR_INPUT_TYPE                              4061L
+#define M_CLIP_SRC_SUPPORTED                          4062L
+#define M_CLIP_DST_SUPPORTED                          4063L
+#define M_HOOK_FUNCTION_SUPPORTED                     4064L
+#define M_GRAB_WINDOW_RANGE_SUPPORTED                 4065L
+#define M_GRAB_8_BITS_SUPPORTED                       4068L
+#define M_GRAB_15_BITS_SUPPORTED                      4069L
+#define M_GRAB_32_BITS_SUPPORTED                      4070L
+#define M_GRAB_EXTRA_LINE                             4071L
+#define M_GRAB_DESTRUCTIVE_IN_PROGRESS                4073L
+#define M_GRAB_START_MODE                             4074L
+#define M_GRAB_WINDOW_RANGE                           4075L
+#define M_INPUT_SIGNAL_PRESENT                        4078L
+#define M_INPUT_SIGNAL_SOURCE                         4079L
+#define M_FIELD_START_THREAD_ID                       4080L
+#define M_GRAB_FIELD_END_ODD_THREAD_ID                4081L
+#define M_GRAB_FIELD_END_EVEN_THREAD_ID               4082L
+#define M_FIELD_START_THREAD_HANDLE                   4083L
+#define M_GRAB_FIELD_END_ODD_THREAD_HANDLE            4084L
+#define M_GRAB_FIELD_END_EVEN_THREAD_HANDLE           4085L
+#define M_INPUT_TYPE                                  4086L
+
+#define M_USER_BIT_QUEUE_MODE                         4087L
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+/* Reserve next 31 values                      from   4088L*/
+/*                                             to     4118L*/
+#if MIL_COMPILE_VERSION <= 960
+#define M_USER_BIT_STATE_OLD                          4119L
+#endif
+#define M_GRAB_FAIL_CHECK                             4120L
+#define M_GRAB_FAIL_STATUS                            4121L
+#define M_GRAB_FAIL_RETRY_NUMBER                      4122L
+#define M_GRAB_ON_ONE_LINE                            4123L
+#define M_GRAB_WRITE_FORMAT                           4124L
+#define M_GRAB_LUT_PALETTE                            4125L
+#define M_GRAB_HALT_ON_NEXT_FIELD                     4126L
+#define M_GRAB_TIMEOUT                                4127L
+#define M_GRAB_IN_PROGRESS                            4128L
+#define M_FIELD_START_HOOK_WHEN_GRAB_ONLY             4129L
+#define M_GRAB_PENDING                                4130L
+#define M_PFNC_TARGET_FORMAT                          4131L
+#define M_TRANSFER_RAW_DATA                           4132L
+#define M_FORCE_RAW_DATA                              M_TRANSFER_RAW_DATA
+#if OldDefinesSupport
+MIL_DEPRECATED(M_FORCE_RAW_DATA, 1000)     // New API Replaced by M_TRANSFER_RAW_DATA
+#endif
+#define M_GC_STREAMING_MODE                           4133L
+#define M_GC_UPDATE_MULTICAST_INFO                    4134L
+#define M_3D_CONTAINER_CALIBRATION_INITIALIZATION     4135L
+#define M_EXTERNAL_CHROMINANCE                        4137L
+#define M_TUNER_FREQUENCY                             4138L
+#define M_TUNER_STANDARD                              4139L
+#define M_CLOCK_NOT_ALWAYS_VALID                      4140L
+#define M_GRAB_LINESCAN_MODE                          4141L
+#define M_GRAB_PERIOD                                 4142L
+#define M_OVERRIDE_ROUTER                             4143L
+#define M_GRAB_TRIGGER_DELAY_CLOCK_SOURCE             4144L
+#define M_GRAB_TRIGGER_DELAY_CLOCK_ACTIVATION         4145L
+#define M_GRAB_TRIGGER_DELAY_CLOCK_MODE               M_GRAB_TRIGGER_DELAY_CLOCK_ACTIVATION
+#define M_GRAB_TRIGGER_STATE                          4200L
+#define M_GRAB_TRIGGER                                M_GRAB_TRIGGER_STATE
+/* Reserve next 8 values                       from   4201L*/
+/*                                             to     4208L*/
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_TRIGGER_DELAY_CLOCK_MODE, 1000)     // New IO API Replaced by M_GRAB_TRIGGER_DELAY_CLOCK_ACTIVATION
+#endif
+
+#define M_GRAB_TRIGGER_SOFTWARE                       4209L
+#define M_DCF_REALLOC_HANDLER_PTR                     4211L
+#define M_DCF_REALLOC_HANDLER_USER_PTR                4212L
+#define M_GRAB_RESTRICTION_CHECK                      4215L
+#define M_LAST_GRAB_BUFFER                            4216L
+#define M_SYNCHRONIZE_ON_STARTED                      4218L
+#define M_GRAB_WAIT                                   4219L
+#define M_GRAB_FIELD_START_HANDLER_PTR                4220L
+#define M_GRAB_FIELD_START_HANDLER_USER_PTR           4221L
+#define M_GRAB_FIELD_START_ODD_HANDLER_PTR            4222L
+#define M_GRAB_FIELD_START_ODD_HANDLER_USER_PTR       4223L
+#define M_GRAB_FIELD_START_EVEN_HANDLER_PTR           4224L
+#define M_GRAB_FIELD_START_EVEN_HANDLER_USER_PTR      4225L
+#define M_GRAB_16_BITS_SUPPORTED                      4226L
+#define M_GRAB_24_BITS_SUPPORTED                      4227L
+#define M_INPUT_SIGNAL_HSYNC_LOCK                     4228L
+#define M_GRAB_BLOCK_SIZE                             4229L
+#define M_GRAB_DIRECTION_X                            4230L
+#define M_GRAB_DIRECTION_Y                            4231L
+#define M_GRAB_FREQ_MAX                               4232L
+#define M_GRAB_THREAD_HANDLE                          4233L
+#define M_GRAB_THREAD_ID                              4234L
+#define M_GRAB_START_THREAD_HANDLE                    4235L
+#define M_GRAB_START_THREAD_ID                        4236L
+#define M_GRAB_END_THREAD_HANDLE                      4237L
+#define M_GRAB_END_THREAD_ID                          4238L
+#define M_GRAB_PATH_OVERRIDE                          4239L
+#define M_GRAB_PATH_OVERRIDE_DCF                      4240L
+#define M_GRAB_PATH_PCI                               4241L
+#define M_GRAB_AUTOMATIC_INPUT_GAIN                   4242L
+#define M_GRAB_DISPLAY_SCALER_QUALITY                 4243L
+#define M_GRAB_VALID                                  4244L
+#define M_GRAB_FIELD_START_THREAD_HANDLE              4248L
+#define M_GRAB_FIELD_START_THREAD_ID                  4249L
+
+#define M_GRAB_FIELD_END_THREAD_HANDLE                4259L
+#define M_GRAB_FIELD_END_THREAD_ID                    4260L
+#define M_GRAB_FRAME_END_THREAD_HANDLE                4261L
+#define M_GRAB_FRAME_END_THREAD_ID                    4262L
+#define M_SET_VCOUNT                                  4263L
+#define M_JPEG_ENCODING_MODE                          4264L
+#define M_JPEG_DECODING_MODE                          4265L
+#define M_JPEG_MARKERS_ENABLE                         4266L
+#define M_JPEG_NUMBER_OF_SCAN_ENCODED                 4267L
+#define M_JPEG_INPUT_COLOR_MODE                       4268L
+#define M_JPEG_OUTPUT_COLOR_MODE                      4269L
+#define M_JPEG_IMAGE_FORMAT                           4270L
+#define M_JPEG_NAX                                    4271L
+#define M_JPEG_NAY                                    4272L
+#define M_JPEG_PAX                                    4273L
+#define M_JPEG_PAY                                    4274L
+#define M_JPEG_AUTO_START_MODE                        4275L
+#define M_JPEG_COMPRESS_MODE                          4276L
+#define M_JPEG_HW_PROG_MODE                           4277L
+#define M_HOOK_MASTER_THREAD_HANDLE                   4278L
+#define M_HOOK_MASTER_THREAD_ID                       4279L
+#define M_GRAB_PATH_RR                                4280L
+#define M_PIXCLK_JPEG_SIGNAL_PRESENT                  4281L
+#define M_GRAB_VM                                     4282L
+#define M_GARBAGE_UV_ADDRESS                          4283L
+#define M_SET_EXPOSURE_ENABLE                         4290L
+/* Reserve next 8 values                       from   4291L*/
+/*                                             to     4298L*/
+#define M_JPEG_FIRST_FIELD_SIZEBYTE                   4301L
+#define M_JPEG_SECOND_FIELD_SIZEBYTE                  4302L
+#define M_JPEG_OFFSET_X                               4303L
+#define M_JPEG_OFFSET_Y                               4304L
+#define M_CURRENT_GRAB_BUFFER_HOST_ADDRESS            4305L
+#define M_CURRENT_GRAB_BUFFER_PHYSICAL_ADDRESS        4306L
+#define M_RESET_CONTINUOUS_GRABBER                    4307L
+#define M_TIMER_INTERRUPT                             4308L
+//4309L
+#define M_TIMER_SET_INTERRUPT                         4310L
+#define M_GRAB_SAMPLING_POSITION                      4311L
+#define M_JPEG_DMA_TRANSFER                           4312L
+#define M_GRAB_FRAME_START_THREAD_HANDLE              4313L
+#define M_GRAB_FRAME_START_THREAD_ID                  4314L
+#define M_INTERNAL_GRAB_BUFFERS_NB                    4315L
+#define M_INTERNAL_GRAB_BUFFERS_FORMAT                4317L
+#define M_KS0127_REV_ID                               4318L
+#define M_DECODER_REV_ID                              M_KS0127_REV_ID
+#define M_GRAB_SCALE_MODE                             4319L
+#define M_GRAB_SCALE_MODE_X                           4320L
+#define M_GRAB_SCALE_MODE_Y                           4321L
+#define M_START_THREAD_HANDLE                         4322L
+#define M_START_THREAD_ID                             4323L
+#define M_SOURCE_COMPENSATION                         4324L
+#define M_GRAB_COLOR                                  4325L
+#define M_SYNCHRONIZE_CHANNEL                         4326L
+#define M_ODD_EVEN_CORRECTION                         4327L
+#define M_POLLING_FOR_END_OF_XFER                     4328L
+#define M_FORCE_PSEUDO_LIVE_GRAB                      4329L
+#define M_GRAB_END_HOOK                               4330L
+#define M_GRAB_START_HOOK                             4331L
+#define M_FIX_PATTERN_NOISE_CORRECTION                4332L
+#define M_EXPOSURE_MODE                               4333L
+#define M_BLACK_OFFSET                                4334L
+/* Free to use                                 from   4335*/
+/*                                             to     4339*/
+
+#define M_HOOK_FOR_PSEUDO_LIVE_GRAB                   4360L
+#define M_YIELD_FOR_END_OF_XFER                       4361L
+#define M_GRAB_SCALE_QUALITY                          4362L
+#define M_USER_BIT_INQUIRE_START                      4363L
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+/* Reserve next 31 values                      from   4088L*/
+/*                                             to     4118L*/
+#define M_USER_BIT_COUNT                              4364L
+#define M_USER_BIT_OPTOMODULE                         4365L
+#define M_USER_BIT_INQUIRE_END                        4366L
+
+#define MAX_HOST_USER_BIT_NB                                  20       // Nb of user bits available on host system
+
+#define M_GRAB_LINE_HANDLER_PTR                       4367L
+#define M_GRAB_LINE_HANDLER_USER_PTR                  4368L
+#define M_GRAB_QUEUE_SIZE                             4369L
+#define M_SECONDARY_GRAB_BUFFER                       4370L
+#define M_GRAB_FRAME_END_TIME_STAMP_BUFFER            4371L
+#define M_GRAB_BUF_MODIFIED                           4372L
+#define M_RGB_PIXEL_SWAP                              4373L
+#define M_PREFERRED_BUFFER_FORMAT                     4374L
+#define M_GRAB_IN_USER_BUFFER                         4375L
+#define M_SYNCHRONIZE_GRAB_WITH_DISPLAY_REFRESH       4376L
+#define M_LAST_GRAB_BUFFER_INDEX                      4377L
+#define M_GRAB_LINE_COUNT                             4378L
+#define M_GRAB_LINE_COUNTER                           0x0000111B //4379L
+#define M_COUPLING_MODE                               4380L
+#define M_LIGHTING_DARK_FIELD                         4381L
+#define M_LIGHT_DARK_FIELD                            M_LIGHTING_DARK_FIELD
+#define M_LIGHTING_BRIGHT_FIELD                       4382L
+#define M_LIGHT_BRIGHT_FIELD                          M_LIGHTING_BRIGHT_FIELD
+#define M_GRAB_TRIGGER_OVERLAP                        4383L
+#define M_GRAB_TRIGGER_BUFFERING                      4384L
+#define M_MILGRABC_VERSION                            4385L    // Also define as a MsysInquire
+#define M_GRAB_FRAME_BURST_COUNT                      4386L
+#define M_GRAB_FRAME_BURST_END_SOURCE                 4387L
+#define M_CURRENT_LINE_COUNT                          4388L
+#define M_GRAB_CONTROL_OFFLOAD                        4390L
+#define M_GRAB_OFFLOAD_ENGINE_PRESENT                 4391L
+/* Reserve next 4 values                       from   4392L*/
+/*                                             to     4395L*/
+
+#define M_INPUT_SIGNAL_COLOR_LOCK                     4399L
+#define M_SENSOR_RED_GAIN                             4401L
+#define M_SENSOR_GREEN_GAIN                           4402L
+#define M_SENSOR_BLUE_GAIN                            4403L
+#define M_SENSOR_GAIN                                 4404L
+
+#define M_DECODER_MODE                                  4417L
+#define M_LIGHTING_BRIGHT_FIELD_OFFSET                  4418L
+#define M_LIGHTING_BRIGHT_FIELD_HIDRIVE                 4419L
+#define M_LIGHTING_BRIGHT_FIELD_HIDRIVE_TIME            4420L
+#define M_LIGHTING_BRIGHT_FIELD_EFFECTIVE_TIME          4421L
+#define M_LIGHTING_BRIGHT_FIELD_OPTIMIZED_EXPOSURE_TIME 4422L
+#define M_LIGHTING_BRIGHT_FIELD_OPTIMIZED_INTENSITY     4423L
+#define M_LIGHTING_DARK_FIELD_EFFECTIVE_TIME            4424L
+#define M_LIGHTING_DARK_FIELD_OPTIMIZED_EXPOSURE_TIME   4425L
+#define M_LIGHTING_DARK_FIELD_OPTIMIZED_INTENSITY       4426L
+#define M_DIG_OK_TO_BE_FREED                            4427L
+#define M_GRAB_END_WAITS_FOR_HOOK_FUNCTION              4428L
+#define M_GRAB_FRAME_BURST_SIZE                         4429L
+#define M_GRAB_FRAME_BURST_START_TRIGGER_STATE          4430L
+#define M_GRAB_FRAME_BURST_START_TRIGGER_SOURCE         4431L
+#define M_GRAB_FRAME_BURST_END_TRIGGER_STATE            4432L
+#define M_GRAB_FRAME_BURST_END_TRIGGER_SOURCE           4433L
+
+#define M_AUX_IO_COUNT                                4450L
+#define M_AUX_IO_COUNT_IN                             4451L
+#define M_AUX_IO_COUNT_OUT                            4452L
+#define M_CC_IO_COUNT                                 4453L
+#define M_CC_IO_COUNT_IN                              4454L
+#define M_CC_IO_COUNT_OUT                             4455L
+#define M_TL_TRIGGER_COUNT                            4456L
+#define M_TL_TRIGGER_COUNT_IN                         4457L
+#define M_TL_TRIGGER_COUNT_OUT                        4458L
+
+#define M_EXPOSURE_OUTPUT_INVERTER                    4459L
+#define M_GRAB_TRIGGER_MISSED                         4460L
+
+#define M_TL_IO_COUNT                                 4465L
+#define M_TL_IO_COUNT_IN                              4466L
+#define M_TL_IO_COUNT_OUT                             4467L
+
+#define M_CAPTURE_LEVEL_FRAME_END                     4524L
+
+// Map of UART defines, used by Mdig and Msys
+#define M_UART_PARITY                                 4701L
+#define M_UART_STOP_BITS                              4702L
+#define M_UART_DATA_SIZE                              4703L
+#define M_UART_SPEED                                  4704L
+#define M_UART_WRITE_CHAR                             4705L
+#define M_UART_READ_CHAR                              4706L
+#define M_UART_DATA_PENDING                           4707L
+#define M_UART_WRITE_STRING                           4708L
+#define M_UART_WRITE_STRING_SIZE                      4709L
+#define M_UART_READ_STRING                            4710L
+#define M_UART_READ_STRING_SIZE                       4711L
+#define M_UART_READ_STRING_MAXIMUM_SIZE               4712L
+#define M_UART_STRING_DELIMITER                       4713L
+#define M_UART_TIMEOUT                                4714L
+#define M_UART_OUTPUT                                 4716L
+#define M_UART_THREAD_HANDLE                          4717L
+#define M_UART_THREAD_ID                              4718L
+#define M_UART_DATA_RECEIVED_HANDLER_PTR              4719L
+#define M_UART_DATA_RECEIVED_HANDLER_USER_PTR         4720L
+#define M_UART_INTERFACE_TYPE                         4721L
+#define M_UART_BYTES_WRITTEN                          4722L
+#define M_UART_BYTES_READ                             4723L
+
+#define M_NATIVE_LAST_GRAB_THREAD_ID                  4750L
+#define M_COMMAND_QUEUE_MODE                          4775L
+
+#define M_GRAB_ATTRIBUTE                              4800L
+#define M_GRAB_CONTINUOUS_ERROR                       4801L
+
+#define M_GC_CONTROL_PROTOCOL_CAPABILITY              4802L
+#define M_GC_STREAM_PROTOCOL_CAPABILITY               4803L
+#define M_GC_MESSAGE_PROTOCOL_CAPABILITY              4804L
+#define M_GC_NETWORK_INTERFACE_CAPABILITY             4805L
+#define M_GC_PHYSICAL_LINK_CONFIGURATION_CAPABILITY   4806L
+#define M_GC_STREAM_CHANNEL_CAPABILITY                4807L
+#define M_GC_NETWORK_INTERFACE_CONFIGURATION          4808L
+#define M_GC_IEEE_1588                                4809L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY                 4810L
+#define M_GC_IEEE_1588_STATUS                         4811L
+#define M_GC_EXTENDED_ID_MODE                         4812L
+
+
+#define M_LOGIC_BLOCK_FUNCTION                        4896L
+/* Reserve next 32 values                       from  4897L*/
+/*                                             to     4927L*/
+#define M_LOGIC_BLOCK_INPUT_SOURCE0                   4928L
+/* Reserve next 32 values                       from  4929L*/
+/*                                             to     4959L*/
+#define M_LOGIC_BLOCK_INPUT_SOURCE1                   4960L
+/* Reserve next 32 values                       from  4961L*/
+/*                                             to     4991L*/
+
+/* defines for 1394*/
+#define M_MIN_VALUE                                   MAKE_INT64(0x0000010000000000)
+#define M_MAX_VALUE                                   MAKE_INT64(0x0000020000000000)
+#define M_MODE_CONTROL                                0x00010000L
+#define M_ABSOLUTE_CTL_MASK                           0x00080000L
+
+#define M_BRIGHTNESS                                  5100L/* Reserve all values between 5100 and 5159*/
+#define M_EXPOSURE_AUTO                               5104L
+#define M_AUTO_EXPOSURE                               M_EXPOSURE_AUTO
+#define M_SHARPNESS                                   5108L
+#define M_WHITE_BALANCE                               5112L
+#define M_HUE                                         0x00008000L
+#define M_SATURATION                                  0x2000L
+#define M_SHUTTER                                     5120L
+#define M_GAIN                                        5124L
+#define M_FOCUS                                       5132L
+#define M_FOCUS_WAIT                                  5133L
+#define M_FOCUS_PERSISTENCE                           5134L
+#define M_FOCUS_PERSISTENT_VALUE                      5135L
+#define M_TEMPERATURE                                 5136L
+#define M_FOCUS_LENGTH                                5137L
+#define M_TRIGGER                                     5140L
+#define M_ZOOM                                        5144L
+#define M_PAN                                         5148L
+#define M_TILT                                        5152L
+#define M_OPTICAL_FILTER                              5156L
+#define M_CAPTURE_SIZE                                5160L
+#define M_CAPTURE_QUALITY                             5164L
+#define M_WHITE_BALANCE_U                             5168L
+#define M_WHITE_BALANCE_V                             5172L
+#define M_TARGET_TEMPERATURE                          5176L
+/* Reserve next 3 values                       from   5177L*/
+/*                                             to     5179L*/
+#define M_FORMAT_SUPPORTED_NUM                        5181L
+#define M_TRIGGER_SUPPORTED                           5183L
+#define M_INPUT_LOW_PASS_FILTER                       5184L
+#define M_PIXCLK_FREQ                                 5185L
+#define M_INPUT_FILTER                                5186L
+#define M_DIGITIZER_CONTROL_LOG                       5187L
+#define M_TARGET_BUFFER_UPDATE                        5188L
+#define M_DUMP_REGISTERS                              5189L
+#define M_FORMAT7_TILE_SIZE_X                         5190L
+#define M_FORMAT7_TILE_SIZE_Y                         5191L
+#define M_ADVANCED_FEATURE                            0x80000000L
+#define M_ADVANCED_FEATURE_SET_ID                     5192L
+#define M_ADVANCED_FEATURE_UNLOCK                     5193L
+#define M_CAMERA_VENDOR_ID                            5194L
+// 5195 is still free
+#define M_TRIGGER_DELAY                               5196L
+#define M_GC_PAYLOAD_SIZE                             5197L
+#define M_GC_PIXEL_FORMAT                             5198L
+
+/* defines for camera link*/
+#define M_CAMERALINK_CC1_SOURCE                       5200L
+#define M_CAMERALINK_CC2_SOURCE                       5201L
+#define M_CAMERALINK_CC3_SOURCE                       5202L
+#define M_CAMERALINK_CC4_SOURCE                       5203L
+
+#define M_WHITE_SHADING                               5204L
+#define M_SHADING_CORRECTION_GAIN                     5205L
+#define M_SHADING_CORRECTION                          5206L
+#define M_SHADING_CORRECTION_OFFSET                   5207L
+#define M_FRAME_RATE_1394                             5208L
+/* Reserve next 3 values                       from   5209L*/
+/*                                             to     5211L*/
+#define M_SHADING_BOUNDARY_BYPASS_LOW                 5215L
+#define M_SHADING_BOUNDARY_BYPASS_HIGH                5216L
+#define M_SHADING_CORRECTION_GAIN_FIXED_POINT         5217L
+#define M_SHADING_CORRECTION_GAIN_FIX_POINT           M_SHADING_CORRECTION_GAIN_FIXED_POINT
+#if OldDefinesSupport
+MIL_DEPRECATED(M_SHADING_CORRECTION_GAIN_FIX_POINT, 1100)
+#endif
+#define M_GRAB_DUAL_PHASE                             5230L
+
+#define M_SIGNAL_GAIN                                 5235L
+
+/* custom defines for IrisGT Dual */
+#define M_CUSTOM_FPGA_PROCESSING                      5240L
+#define M_CUSTOM_FPGA_PROCESSING_EROSION              5241L
+#define M_CUSTOM_FPGA_PROCESSING_MAX_SELECTOR         5242L
+
+/* defines for channel switch lock mechanism*/
+#define M_CAMERA_LOCK                                 5300L
+#define M_CAMERA_COLOR_LOCK                           5301L
+#define M_CAMERA_LOCK_SENSITIVITY                     5302L
+#define M_CAMERA_UNLOCK_SENSITIVITY                   5303L
+#define M_CAMERA_LOCKED                               5304L
+#define M_CAMERA_COLOR_LOCKED                         5305L
+#define M_CAMERA_LOCK_MODE                            5306L
+
+#define M_CAMERA_LOCK_HANDLER_PTR                     5307L
+#define M_CAMERA_LOCK_HANDLER_USER_PTR                5308L
+#define M_CAMERA_LOCK_THREAD_ID                       5309L
+#define M_CAMERA_LOCK_THREAD_HANDLE                   5310L
+
+/* defines for camera detect */
+#define M_CAMERA_PRESENT_HANDLER_PTR                  5311L
+#define M_CAMERA_PRESENT_HANDLER_USER_PTR             5312L
+#define M_CAMERA_PRESENT_THREAD_ID                    5313L
+#define M_CAMERA_PRESENT_THREAD_HANDLE                5314L
+#define M_CAMERA_PRESENT                              5315L
+#define M_CAMERA_PRESENT_SENSITIVITY                  5316L
+
+#define M_WRITE_GRAB_VALIDATION_TAG                   5317L
+
+#define M_INFO_FORMAT                                 5318L
+#define M_HV_RESET                                    5319L
+#define M_FORCE_INTERNAL_GRAB_BUFFER                  5320L
+#define M_INITIALIZATION_DELAY                        5321L
+
+#define M_BAYER_CONVERSION                            5326L
+#define M_GRAB_PROCESSING                             5327L
+#define M_BAYER_COEFFICIENTS_ID                       5328L
+#define M_ACQUISITION_PATH                            5329L
+
+#define M_GRAB_LL_SEQ_CONTEXT                         5330L
+/* Reserve next value                                 5331L*/
+
+/* Reserve next value                                 5332 */
+#define M_PROCESS_FRAME_MISSED_RESET                  5333L
+#define M_PROCESS_FRAME_MISSED                        5334L
+#define M_PROCESS_FRAME_COUNT                         5335L
+
+#define M_BUF_MODIFIED_HANDLER                        5336L
+
+#define M_DIG_PROCESS_IN_PROGRESS                     5337L
+
+#define M_GRAB_FRAME_MISSED                           5347L
+#define M_GRAB_FRAME_MISSED_COUNTER                   5348L
+#define M_GRAB_FRAME_MISSED_RESET                     5349L
+
+#define M_BAYER_DEMOSAICING                           5350L
+#define M_PROCESS_GRAB_MONITOR                        5351L
+/* Reserve next value                                 5352L */
+
+#define M_PROCESS_NUMBER_OF_FRAME                     5353L
+
+
+#define M_PROCESS_TIMEOUT                             5364L
+#define M_BAYER_PATTERN                               5365L
+
+#define M_LAST_DRIVER_HOOK_CONTEXT_ID                 5366L
+#define M_ROTARY_ENCODER_HANDLER_PTR                  5400L
+#define M_ROTARY_ENCODER_HANDLER_USER_PTR             5401L
+/* Reserve next 4  values                      from   5402*/
+/*                                             to     5405L*/
+
+#define M_MOTION_DETECT_SENSITIVITY_LEVEL             5406L
+#define M_MOTION_DETECT_SPATIAL_SENSITIVITY_LEVEL     5407L
+#define M_MOTION_DETECT_TEMPORAL_SENSITIVITY_LEVEL    5408L
+#define M_MOTION_DETECT_VELOCITY_LEVEL                5409L
+#define M_MOTION_DETECT_FIELD_SELECT                  5410L
+#define M_MOTION_DETECT_MASK_BUFFER_ID                5411L
+#define M_MOTION_DETECT_MATRICE_SIZE_X                5412L
+#define M_MOTION_DETECT_MATRICE_SIZE_Y                5413L
+#define M_MOTION_DETECT_RESULT_BUFFER_ID              5414L
+
+#define M_BLIND_DETECT_SENSITIVITY_LEVEL              5415L
+#define M_BLIND_DETECT_TEMPORAL_LEVEL                 5416L
+
+#define M_NIGHT_DETECT_SENSITIVITY_LEVEL              5417L
+#define M_NIGHT_DETECT_TEMPORAL_LEVEL                 5418L
+
+#define M_HARDWARE_DEINTERLACING                      5449L
+#define M_DIGITIZER_FILTER_TYPE                       5450L
+#if OldDefinesSupport
+#define M_DIGITIZER_SCALING_MODE                      5451L // Replaced by M_INPUT_FILTER
+MIL_DEPRECATED(M_DIGITIZER_SCALING_MODE, 1000)
+#define M_DIGITIZER_INTERPOLATION_MODE                5452L // Replaced by M_GRAB_SCALE_INTERPOLATION_MODE
+MIL_DEPRECATED(M_DIGITIZER_INTERPOLATION_MODE, 1000)
+#endif
+#define M_GRAB_SCALE_INTERPOLATION_MODE               5452L
+#define M_SYNCHRONIZE_OUTPUT                          5453L
+#define M_SYNCHRONIZE_OUTPUT_VALUE                    5454L
+
+
+#define M_CONNECTION_TEST_MODE                        5600
+/* Reserve next 16 values                      from   5601L*/
+/* To be used with M_CONNECTIONx               to     5615L*/
+
+
+/*Reserve values between M_DIG_SUPPORT_START_NO
+and M_DIG_SUPPORT_END_NO*/
+#define M_DIG_SUPPORT_START_NO                        5900L
+#define M_IS_EMULATED                                 5900L
+#define M_DIG_SUPPORT_END_NO                          5949L
+/*Reserve values between M_DIG_SUPPORT_START_YES
+and M_DIG_SUPPORT_START_YES*/
+#define M_DIG_SUPPORT_START_YES                       5950L
+#define M_DIG_SUPPORT_END_YES                         5999L
+
+
+/************************************************************************/
+/* MdigInquire() Types MIL_DOUBLE range start                           */
+/************************************************************************/
+
+#define M_DIG_INQUIRE_SIZEOF_DOUBLE_START             6000L
+// Inquire value with a size of double, must be in that range : 6000-6699
+
+#define M_GRAB_SCALE                                  6600L
+#define M_GRAB_SCALE_X                                6601L
+#define M_GRAB_SCALE_Y                                6602L
+#define M_GRAB_SUBSAMPLE                              6603L
+#define M_GRAB_SUBSAMPLE_X                            6604L
+#define M_GRAB_SUBSAMPLE_Y                            6605L
+#define M_SELECTED_FRAME_RATE                         6606L
+#define M_PROCESS_FRAME_RATE                          6607L
+#define M_GRAB_FRAME_BURST_MAX_TIME                   6608L
+#define M_GC_THEORETICAL_INTER_PACKET_DELAY           6609L
+#define M_GAIN_DIGITAL                                6610L
+#define M_SELECTED_FRAME_RATE_FOR_BUFFER              6611L
+#define M_EXPOSURE_TIME_MAX_FOR_BUFFER                6612L
+#define M_FOCUS_TEMPERATURE                           6613L
+
+#define M_GRAB_ABORT                                  6643L
+#define M_GRAB_FRAME_END_DELAY                        6644L
+#define M_GC_FRAME_TIMESTAMP                          6645L
+#define M_GRAB_TRIGGER_DELAY                          6646L
+#define M_TEMPERATURE_SENSOR                          6647L
+#define M_GRAB_SCALE_X_SUPPORTED                      6648L
+#define M_GRAB_SCALE_Y_SUPPORTED                      6649L
+#define M_BLACK_REF_DOUBLE                            6650L
+#define M_WHITE_REF_DOUBLE                            6651L
+#define M_BLACK_REF                                   M_BLACK_REF_DOUBLE
+#define M_WHITE_REF                                   M_WHITE_REF_DOUBLE
+
+#define M_EXPOSURE_TIME                               6652L
+#define M_EXPOSURE_TIME_MAX                           6653L
+#define M_EXPOSURE_DELAY                              6654L
+
+#define M_HUE_REF                                     6655L
+#define M_SATURATION_REF                              6656L
+#define M_BRIGHTNESS_REF                              6657L
+#define M_CONTRAST_REF                                6658L
+
+#define M_EXPOSURE_TIME2                              6659L
+#define M_EXPOSURE_DELAY2                             6660L
+
+#define M_GAMMA                                       6672L
+/* Reserve next 3 values                       from   6673L*/
+/*                                             to     6675L*/
+
+#define M_DIGITIZER_FILTER_SIGMA                      6689L
+
+#define M_DIG_INQUIRE_SIZEOF_DOUBLE_END               6699L
+
+/************************************************************************/
+/* MdigInquire() Types MIL_INT64 range start                            */
+/************************************************************************/
+#define M_DIG_INQUIRE_SIZEOF_INT64_START              6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+#define M_GC_MAC_ADDRESS                              6701L
+#define M_GC_REMOTE_MAC_ADDRESS                       M_GC_MAC_ADDRESS
+#define M_GC_IP_ADDRESS                               6702L
+#define M_GC_REMOTE_IP_ADDRESS                        M_GC_IP_ADDRESS
+#define M_GC_COUNTER_TICK_FREQUENCY                   6703L
+#define M_GC_TOTAL_BYTES_RECEIVED                     6704L
+
+#define M_EXTENDED_INIT_FLAG                          6705L
+#define M_SOURCE_DATA_FORMAT                          6706L
+#if OldDefinesSupport
+#define M_SOURCE_BUFFER_FORMAT                    M_SOURCE_DATA_FORMAT
+MIL_DEPRECATED(M_SOURCE_BUFFER_FORMAT, 1000)
+#endif
+
+#define M_GC_TOTAL_FRAMES_GRABBED                     6707L
+#define M_GC_TOTAL_FRAMES_CORRUPTED                   6708L
+#define M_GC_TOTAL_PACKETS_MISSED                     6709L
+#define M_GC_TOTAL_PACKETS_RECEIVED                   6710L
+#define M_GC_TOTAL_PACKETS_RESENDS_NUM                6711L
+#define M_GC_TOTAL_PACKETS_RECOVERED                  6712L
+#define M_GC_TOTAL_PACKETS_TIMEOUT                    6713L
+#define M_GC_TOTAL_PACKETS_RECEIVED_OUT_OF_ORDER      6714L
+#define M_GC_TOTAL_PACKET_CACHE_HITS                  6715L
+#define M_GC_TOTAL_FRAME_CACHE_HITS                   6716L
+#define M_GC_TOTAL_FRAMES_MISSED                      6717L
+#define M_GC_TOTAL_PACKETS_NOT_COPIED                 6718L
+
+#define M_DEFAULT_IO_DEVICE                           6730L
+#define M_GC_NIC_MAC_ADDRESS                          6731L
+#define M_GC_LOCAL_MAC_ADDRESS                        M_GC_NIC_MAC_ADDRESS
+/* Reserve next 7 values                       from   6732L*/
+/*                                             to     6738L*/
+#define M_GC_NIC_IP_ADDRESS                           6739L
+#define M_GC_LOCAL_IP_ADDRESS                         M_GC_NIC_IP_ADDRESS
+/* Reserve next 7 values                       from   6740L*/
+/*                                             to     6746L*/
+
+#define M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS         6747L
+#define M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS        6748L
+#define M_GC_FRAME_BLOCK_ID64                         6749L
+
+#define M_TARGET_BUFFER_OBJECT                        6750L
+#define M_TARGET_BUFFER_ATTRIBUTE                     6751L
+
+#define M_CONNECTION_TEST_ERROR_COUNT                 6752L
+/* Reserve next 16 values                      from   6753L*/
+/* To be used with M_CONNECTIONx               to     6767L*/
+#define M_CONNECTION_TEST_PACKET_TRANSMITTED_COUNT      6768L
+/* Reserve next 16 values                      from   6769L*/
+/* To be used with M_CONNECTIONx               to     6783L*/
+#define M_CONNECTION_TEST_PACKET_RECEIVED_COUNT       6784L
+/* Reserve next 16 values                      from   6785L*/
+/* To be used with M_CONNECTIONx               to     6799L*/
+
+#define M_DIG_INQUIRE_SIZEOF_INT64_END                6799L
+/************************************************************************/
+/* MdigInquire() Types unknown                                          */
+/************************************************************************/
+
+#define M_DIG_INQUIRE_UNKNOWN_SIZEOF_START            6800L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 6800-6899
+#define M_INTERNAL_GRAB_BUFFERS_ID                    6801L
+#define M_INTERNAL_GRAB_BUFFER_MIL_ID                 6804L
+
+#define M_DIG_INQUIRE_UNKNOWN_SIZEOF_END              6899L
+/************************************************************************/
+/* MdigInquire() Types MIL_INT                                          */
+/************************************************************************/
+
+#define M_GC_PACKET_SIZE                              6900L
+#define M_GC_HEARTBEAT_TIMEOUT                        6901L
+#define M_GC_HEARTBEAT                                M_GC_HEARTBEAT_TIMEOUT
+#define M_GC_COMMAND_TIMEOUT                          6902L
+#define M_GC_COMMAND_RETRY                            6903L
+#define M_GC_FEATURE_BROWSER                          6905L
+#define M_GC_FEATURE_NODEMAP                          6906L
+#define M_GC_INTER_PACKET_DELAY                       6907L
+#define M_GC_ACQUISITION_MODE                         6908L
+#define M_GC_ETHERNET_LINK_SPEED                      6909L
+#define M_GC_HEARTBEAT_STATE                          6910L
+
+#define M_GC_PACKET_RESEND                            6911L
+#define M_GC_STREAM_PORT                              6912L
+#define M_GC_LOCAL_STREAM_PORT                        M_GC_STREAM_PORT
+#define M_GC_READ_REGISTER                            6914L
+#define M_GC_WRITE_REGISTER                           6915L
+#define M_GC_READ_MEMORY                              6916L
+#define M_GC_WRITE_MEMORY                             6917L
+#define M_GC_PIXEL_FORMAT_SWITCHING                   6918L
+#if OldDefinesSupport
+#define M_GC_PIXELFORMAT_SWITCHING                    M_GC_PIXEL_FORMAT_SWITCHING
+MIL_DEPRECATED(M_GC_PIXELFORMAT_SWITCHING, 1000)
+#endif
+
+
+
+#define M_NIC_FILTERING                               6921L
+#define M_GC_FEATURE_BROWSER_HWND                     6922L
+#define M_CORRUPTED_FRAME                             6923L
+#define M_CORRUPTED_FRAME_ERROR                       6924L
+#define M_PROCESS_FRAME_CORRUPTED                     6925L
+#define M_PROCESS_PENDING_GRAB_NUM                    6926L
+#define M_PROCESS_TOTAL_BUFFER_NUM                    6927L
+
+#define M_GC_STREAMING_STOP                           6928L
+#define M_GC_STREAMING_STOP_CHECK_PERIOD              6929L
+#define M_GC_STREAMING_STOP_DELAY                     6930L
+#define M_GC_STREAMING_START                          6931L
+#define M_GC_NUMBER_OF_STREAM_CHANNELS                6932L
+
+
+#define M_GC_MESSAGE_PORT                             6936L
+#define M_GC_LOCAL_MESSAGE_PORT                       M_GC_MESSAGE_PORT
+
+#define M_GC_SCHEMA_MAJOR                             6937L
+#define M_GC_SCHEMA_MINOR                             6938L
+#define M_GC_XML_MAJOR                                6939L
+#define M_GC_XML_MINOR                                6940L
+#define M_GC_XML_SUBMINOR                             6941L
+#define M_GC_MULTICAST_MASTER_CONNECTED               6942L
+#define M_GC_MAX_NBR_PACKETS_OUT_OF_ORDER             6943L
+#define M_GC_FRAME_MAX_RETRIES                        6944L
+#define M_GC_PACKET_MAX_TIMEOUT                       6945L
+#define M_GC_PACKET_MAX_RETRIES                       6946L
+#define M_GC_MAX_LEADING_PACKET_MISSED                6947L
+#define M_GC_FRAME_TIMEOUT                            6948L
+#define M_GC_PACKET_TIMEOUT                           6949L
+#define M_GC_FEATURE_NODEMAP_MIL                      6951L
+#define M_GC_LOCAL_CONTROL_PORT                       6952L
+#define M_GC_REMOTE_CONTROL_PORT                      6953L
+#define M_GC_REMOTE_STREAM_PORT                       6954L
+#define M_GC_REMOTE_MESSAGE_PORT                      6955L
+
+#define M_GC_PACKET_TIMEOUT_NUM                       6956L
+#define M_GC_PACKETS_MISSED                           6957L
+#define M_GC_PACKETS_RECEIVED                         6958L
+#define M_GC_PACKETS_RESENDS_NUM                      6959L
+#define M_GC_PACKETS_RECOVERED                        6960L
+#define M_GC_FRAME_ERROR_CODE                         6961L
+#define M_GC_FRAME_LINE_COUNT                         6962L
+#define M_GC_FRAME_BLOCK_ID                           6963L
+#define M_GC_FRAME_BYTES_RECEIVED                     6964L
+
+#define M_GC_FRAME_OFFSET_X                           6965L
+#define M_GC_FRAME_OFFSET_Y                           6966L
+#define M_GC_FRAME_SIZE_X                             6967L
+#define M_GC_FRAME_SIZE_Y                             6968L
+#define M_GC_FRAME_PIXEL_TYPE                         6969L
+
+#define M_GC_STATISTICS_RESET                         6970L
+#define M_GC_FIREWALL_PRESENT                         6971L
+
+#define M_GC_FRAME_STATUS_CODE                        6972L
+
+#define M_GC_FEATURE_POLLING                          6973L
+
+#define M_GC_CLPROTOCOL                               6974L
+#define M_GC_CLPROTOCOL_DEVICE_ID_NUM                 6975L
+#define M_GC_CLPROTOCOL_DEVICE_ID_SIZE_MAX            6976L
+
+#define M_GC_LINK_RESET                               6977L
+#define M_GC_EVENT_TRANSFER_SIZE                      6978L
+#define M_GC_STREAMING_TRANSFER_SIZE                  6979L
+#define M_GC_COMMAND_IN_PACKET_SIZE                   6980L
+#define M_GC_COMMAND_OUT_PACKET_SIZE                  6981L
+
+
+
+#if OldDefinesSupport
+#define M_GC_CLPROTOCOL_DEVICEID_NUM                  M_GC_CLPROTOCOL_DEVICE_ID_NUM
+MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID_NUM, 1000)
+#define M_GC_CLPROTOCOL_DEVICEID_SIZE_MAX             M_GC_CLPROTOCOL_DEVICE_ID_SIZE_MAX
+MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID_SIZE_MAX, 1000)
+#endif
+/************************************************************************/
+/* MdigInquire() Types MIL_TEXT_PTR range start                            */
+/************************************************************************/
+
+#define M_DIG_INQUIRE_STRING_START                    7700L
+
+   #define M_FORMAT                                         (7701L|M_CLIENT_ENCODING)
+   #define M_FORMAT_SUPPORTED                               (7702L|M_CLIENT_ENCODING)
+   #define M_SERIAL_NUMBER                                  (7703L|M_CLIENT_ENCODING)
+   #define M_CAMERA_VENDOR                                  (7704L|M_CLIENT_ENCODING)
+   #define M_GC_VERSION                                     (7705L|M_CLIENT_ENCODING)
+   #define M_GC_SPECIFIC_INFO                               (7706L|M_CLIENT_ENCODING)
+   #define M_GC_USER_NAME                                   (7707L|M_CLIENT_ENCODING)
+   #define M_GC_SERIAL_NUMBER                               (7708L|M_CLIENT_ENCODING)
+   #define M_GC_FEATURE_BROWSER_NODES                       (7709L|M_CLIENT_ENCODING)
+   #define M_FORMAT_DETECTED                                (7710L|M_CLIENT_ENCODING)
+   #define M_CAMERA_MODEL                                   (7711L|M_CLIENT_ENCODING)
+   #define M_GC_GET_STREAMABLE_FEATURES                     (7712L|M_CLIENT_ENCODING)
+   #define M_GC_IP_ADDRESS_STRING                           (7713L|M_CLIENT_ENCODING)
+   #define M_GC_REMOTE_IP_ADDRESS_STRING                    M_GC_IP_ADDRESS_STRING
+   #define M_GC_MAC_ADDRESS_STRING                          (7714L|M_CLIENT_ENCODING)
+   #define M_GC_REMOTE_MAC_ADDRESS_STRING                   M_GC_MAC_ADDRESS_STRING
+   #define M_GC_UNIQUE_ID_STRING                            (M_GC_MAC_ADDRESS_STRING|M_CLIENT_ENCODING)
+   #define M_GC_NIC_IP_ADDRESS_STRING                       (7715L|M_CLIENT_ENCODING)
+   #define M_GC_LOCAL_IP_ADDRESS_STRING                     M_GC_NIC_IP_ADDRESS_STRING
+   #define M_GC_NIC_MAC_ADDRESS_STRING                      (7716L|M_CLIENT_ENCODING)
+   #define M_GC_LOCAL_MAC_ADDRESS_STRING                    M_GC_NIC_MAC_ADDRESS_STRING
+   #define M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING     (7717L|M_CLIENT_ENCODING)
+   #define M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING    (7718L|M_CLIENT_ENCODING)
+   #define M_GC_CLPROTOCOL_DEVICE_ID                        (7730L|M_CLIENT_ENCODING)
+   /* Reserve next 128 values                from           (7731L|M_CLIENT_ENCODING) */
+   /*                                        to             (7857L|M_CLIENT_ENCODING) */
+   #define M_GC_CLPROTOCOL_DEVICE_ID_DEFAULT                (7859L|M_CLIENT_ENCODING)
+   #define M_GC_INTERFACE_NAME                              (7860L|M_CLIENT_ENCODING)
+   #define M_GC_XML_PATH                                    (7861L|M_CLIENT_ENCODING)
+   #define M_GC_PIXEL_FORMAT_STRING                         (7878L|M_CLIENT_ENCODING)
+
+#define M_DIG_INQUIRE_STRING_END                               7999L
+/************************************************************************/
+/* MdigInquire() Types MIL_INT                                          */
+/************************************************************************/
+
+#if OldDefinesSupport
+   #define M_FORMAT_SIZE                                       (M_STRING_SIZE + M_FORMAT)
+   #define M_FORMAT_SUPPORTED_SIZE                             (M_STRING_SIZE + M_FORMAT_SUPPORTED)
+//   #define M_SERIAL_NUMBER_SIZE                                (M_STRING_SIZE + M_SERIAL_NUMBER)
+   #define M_CAMERA_VENDOR_SIZE                                (M_STRING_SIZE + M_CAMERA_VENDOR)
+   #define M_GC_VERSION_SIZE                                   (M_STRING_SIZE + M_GC_VERSION)
+   #define M_GC_SPECIFIC_INFO_SIZE                             (M_STRING_SIZE + M_GC_SPECIFIC_INFO)
+   #define M_GC_USER_NAME_SIZE                                 (M_STRING_SIZE + M_GC_USER_NAME)
+   #define M_GC_SERIAL_NUMBER_SIZE                             (M_STRING_SIZE + M_GC_SERIAL_NUMBER)
+   #define M_FORMAT_DETECTED_SIZE                              (M_STRING_SIZE + M_FORMAT_DETECTED)
+   #define M_CAMERA_MODEL_SIZE                                 (M_STRING_SIZE + M_CAMERA_MODEL)
+   #define M_GC_GET_STREAMABLE_FEATURES_SIZE                   (M_STRING_SIZE + M_GC_GET_STREAMABLE_FEATURES)
+   #define M_GC_IP_ADDRESS_STRING_SIZE                         (M_STRING_SIZE + M_GC_IP_ADDRESS_STRING)
+   #define M_GC_REMOTE_IP_ADDRESS_STRING_SIZE                  M_GC_IP_ADDRESS_STRING_SIZE
+   #define M_GC_MAC_ADDRESS_STRING_SIZE                        (M_STRING_SIZE + M_GC_MAC_ADDRESS_STRING)
+   #define M_GC_REMOTE_MAC_ADDRESS_STRING_SIZE                 M_GC_MAC_ADDRESS_STRING_SIZE
+   #define M_GC_UNIQUE_ID_STRING_SIZE                          (M_STRING_SIZE + M_GC_UNIQUE_ID_STRING)
+   #define M_GC_NIC_IP_ADDRESS_STRING_SIZE                     (M_STRING_SIZE + M_GC_NIC_IP_ADDRESS_STRING)
+   #define M_GC_LOCAL_IP_ADDRESS_STRING_SIZE                   M_GC_NIC_IP_ADDRESS_STRING_SIZE
+   #define M_GC_NIC_MAC_ADDRESS_STRING_SIZE                    (M_STRING_SIZE + M_GC_NIC_MAC_ADDRESS_STRING)
+   #define M_GC_LOCAL_MAC_ADDRESS_STRING_SIZE                  M_GC_NIC_MAC_ADDRESS_STRING_SIZE
+   #define M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING_SIZE   (M_STRING_SIZE + M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING)
+   #define M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING_SIZE  (M_STRING_SIZE + M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING)
+   #define M_GC_CLPROTOCOL_DEVICE_ID_SIZE                      (M_STRING_SIZE + M_GC_CLPROTOCOL_DEVICE_ID)
+   #define M_GC_INTERFACE_NAME_SIZE                            (M_STRING_SIZE + M_GC_INTERFACE_NAME)
+   #define M_GC_XML_PATH_SIZE                                  (M_STRING_SIZE + M_GC_XML_PATH)
+   #define M_GC_PIXEL_FORMAT_STRING_SIZE                       (M_STRING_SIZE + M_GC_PIXEL_FORMAT_STRING)
+
+MIL_DEPRECATED(M_FORMAT_SIZE, 1040)
+MIL_DEPRECATED(M_FORMAT_SUPPORTED_SIZE, 1040)
+MIL_DEPRECATED(M_CAMERA_VENDOR_SIZE, 1040)
+MIL_DEPRECATED(M_GC_VERSION_SIZE, 1040)
+MIL_DEPRECATED(M_GC_SPECIFIC_INFO_SIZE, 1040)
+MIL_DEPRECATED(M_GC_USER_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_GC_SERIAL_NUMBER_SIZE, 1040)
+MIL_DEPRECATED(M_FORMAT_DETECTED_SIZE, 1040)
+MIL_DEPRECATED(M_CAMERA_MODEL_SIZE, 1040)
+MIL_DEPRECATED(M_GC_GET_STREAMABLE_FEATURES_SIZE, 1040)
+MIL_DEPRECATED(M_GC_IP_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_MAC_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_UNIQUE_ID_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_NIC_IP_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_NIC_MAC_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICE_ID_SIZE, 1040)
+MIL_DEPRECATED(M_GC_INTERFACE_NAME_SIZE, 1040)
+MIL_DEPRECATED(M_GC_XML_PATH_SIZE, 1040)
+MIL_DEPRECATED(M_GC_PIXEL_FORMAT_STRING_SIZE, 1040)
+MIL_DEPRECATED(M_GC_SOFTWARE_TRIGGER_SOURCE_NAME_SIZE, 1040)
+
+#endif
+
+
+#define M_GRAB_ERROR_HALT_GRAB                        8000L
+#define M_GRAB_ERROR_CHECK_PIXEL                      8001L
+#define M_GRAB_ERROR_CHECK_SYNC                       8002L
+#define M_GRAB_ERROR_RESET                            8003L
+#define M_GRAB_ERROR_STATUS                           8004L
+#define M_GRAB_ERROR_COUNT                            8005L
+#define M_GAIN_AUTO_BALANCE                           8006L
+
+#define M_VIDEO_OUTPUT                                8007L
+#define M_VIDEO_OUTPUT_TILE                           8008L
+#define M_VIDEO_OUTPUT_CHANNELS                       8009L
+#define M_VIDEO_OUTPUT_INTERVAL                       8010L
+
+/* Reserve next 400 values                     from   8304L*/
+/*                                             to     8799L*/
+/* Reserve 16 index per type. */
+#define M_DATA_LATCH_INSTANCE_BITSHIFT                  (16)
+#define M_DATA_LATCH_INSTANCE_MASK                      (0xffff << M_DATA_LATCH_INSTANCE_BITSHIFT)
+#define M_VALUE_INDEX(Instance)                        (Instance << M_DATA_LATCH_INSTANCE_BITSHIFT)
+#define M_DATA_LATCH_PARSING_MODE                      8300L
+#define M_DATA_LATCH_CLOCK_FREQUENCY                   8301L
+#define M_DATA_LATCH_BUFFER_HOST_ADDRESS               8302L
+#define M_DATA_LATCH_MAX_INDEX                         0x20 
+#define M_DATA_LATCH_INDEX_START                       8304L
+#define M_DATA_LATCH_STATE                             (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*0)
+#define M_DATA_LATCH_TYPE                              (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*1)
+#define M_DATA_LATCH_TRIGGER_SOURCE                    (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*2)
+#define M_DATA_LATCH_MODE                              (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*3)
+#define M_DATA_LATCH_BUFFER_TRIGGER_SOURCE             (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*4)
+#define M_DATA_LATCH_CALLBACK                          (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*5)
+#define M_DATA_LATCH_FLUSH_TRIGGER_SOURCE              (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*6)
+#define M_DATA_LATCH_TRIGGER_ACTIVATION                (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*7)
+// Used in the callback
+#define M_DATA_LATCH_VALUE_COUNT                       (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*8)
+#define M_DATA_LATCH_SIZE_BYTE                         (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*9)
+#define M_DATA_LATCH_VALUE_ALL                         (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*10)
+#define M_DATA_LATCH_VALUE                             (M_DATA_LATCH_INDEX_START + M_DATA_LATCH_MAX_INDEX*11)
+#define M_DATA_LATCH_EXTRACT_INDEX_FROM_TYPE(TYPE)     ((((TYPE)&~M_DATA_LATCH_INSTANCE_MASK) - M_DATA_LATCH_INDEX_START) % M_DATA_LATCH_MAX_INDEX)
+#define M_DATA_LATCH_EXTRACT_INSTANCE_FROM_TYPE(TYPE)  ((((TYPE) & M_DATA_LATCH_INSTANCE_MASK) >> M_DATA_LATCH_INSTANCE_BITSHIFT))
+#define M_DATA_LATCH_EXTRACT_TYPE(TYPE)                (((TYPE)&~M_DATA_LATCH_INSTANCE_MASK) - M_DATA_LATCH_EXTRACT_INDEX_FROM_TYPE(TYPE))
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_TIMER_STATE                                 0x20000L
+#define M_GRAB_EXPOSURE                               M_TIMER_STATE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE, 1000)     // New IO API Replaced by M_TIMER_STATE
+#endif
+      /* Reserve next 100 values                     from   0x20001L*/
+      /*                                             to     0x20063L*/
+#define M_TIMER_TRIGGER_SOURCE                        0x20064L
+#define M_GRAB_EXPOSURE_SOURCE                        M_TIMER_TRIGGER_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_SOURCE, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_SOURCE
+#endif
+      /* Reserve next 100 values                     from   0x20065L*/
+      /*                                             to     0x200C7L*/
+#define M_TIMER_OUTPUT_INVERTER                       0x200C8L
+#define M_GRAB_EXPOSURE_MODE                          M_TIMER_OUTPUT_INVERTER
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_MODE, 1000)     // New IO API Replaced by M_TIMER_OUTPUT_INVERTER
+#endif
+      /* Reserve next 100 values                     from   0x200C9L*/
+      /*                                             to     0x2012BL*/
+#define M_TIMER_DELAY_CLOCK_ACTIVATION                0x2012CL
+#define M_GRAB_EXPOSURE_DELAY_CLOCK_MODE              M_TIMER_DELAY_CLOCK_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_DELAY_CLOCK_MODE, 1000)     // New IO API Replaced by M_TIMER_DELAY_CLOCK_ACTIVATION
+#endif
+      /* Reserve next 100 values                     from   0x2012DL*/
+      /*                                             to     0x2018FL*/
+#define M_TIMER_DELAY_CLOCK_SOURCE                    0x20190L
+#define M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE            M_TIMER_DELAY_CLOCK_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE, 1000)     // New IO API Replaced by M_TIMER_DELAY_CLOCK_SOURCE
+#endif
+      /* Reserve next 100 values                     from   0x20191L*/
+      /*                                             to     0x201F3L*/
+
+#define M_TIMER_TRIGGER_ACTIVATION                    0x201F4L
+#define M_GRAB_EXPOSURE_TRIGGER_MODE                  M_TIMER_TRIGGER_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MODE, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_ACTIVATION
+#endif
+      /* Reserve next 100 values                     from   0x201F5L*/
+      /*                                             to     0x20257L*/
+#define M_TIMER_CLOCK_SOURCE                          0x20258L
+#define M_GRAB_EXPOSURE_CLOCK_SOURCE                  M_TIMER_CLOCK_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_CLOCK_SOURCE, 1000)     // New IO API Replaced by M_TIMER_CLOCK_SOURCE
+#endif
+      /* Reserve next 100 values                     from   0x20259L*/
+      /*                                             to     0x202BBL*/
+#define M_TIMER_USAGE                                 0x202BCL
+#define M_GRAB_EXPOSURE_USAGE                         M_TIMER_USAGE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_USAGE, 1000)     // New IO API Replaced by M_TIMER_USAGE
+#endif
+      /* Reserve next 100 values                     from   0x202BDL*/
+      /*                                             to     0x2031FL*/
+#define M_TIMER_TRIGGER_MISSED                        0x20320L
+#define M_GRAB_EXPOSURE_TRIGGER_MISSED                M_TIMER_TRIGGER_MISSED
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MISSED, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_MISSED
+#endif
+      /* Reserve next 100 values                     from   0x20321L*/
+      /*                                             to     0x20383L*/
+#define M_TIMER_TRIGGER_MISSED_STATUS                 0x20384L
+#define M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS         M_TIMER_TRIGGER_MISSED_STATUS
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_MISSED_STATUS
+#endif
+      /* Reserve next 100 values                     from   0x20385L*/
+      /*                                             to     0x203E7L*/
+#define M_TIMER_TRIGGER_RATE_DIVIDER                  0x203E8L
+#define M_GRAB_EXPOSURE_TRIGGER_DIVIDER               M_TIMER_TRIGGER_RATE_DIVIDER
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_DIVIDER, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_RATE_DIVIDER
+#endif
+      /* Reserve next 100 values                     from   0x203E9L*/
+      /*                                             to     0x2044BL*/
+
+#define M_TIMER_TRIGGER_SOFTWARE                      0x2044CL
+      /* Reserve next 100 values                     from   0x2044DL*/
+      /*                                             to     0x204AFL*/
+
+#define M_TIMER_ARM                                   0x204B0L
+#define M_GRAB_EXPOSURE_ARM                           M_TIMER_ARM
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM, 1000)     // New IO API Replaced by M_TIMER_ARM
+#endif
+      /* Reserve next 100 values                     from   0x204B1L*/
+      /*                                             to     0x20513L*/
+#define M_TIMER_ARM_SOURCE                            0x20514L
+#define M_GRAB_EXPOSURE_ARM_SOURCE                    M_TIMER_ARM_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM_SOURCE, 1000)     // New IO API Replaced by M_TIMER_ARM_SOURCE
+#endif
+      /* Reserve next 100 values                     from   0x20515L*/
+      /*                                             to     0x20577L*/
+#define M_TIMER_ARM_ACTIVATION                        0x20578L
+#define M_GRAB_EXPOSURE_ARM_MODE                      M_TIMER_ARM_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM_MODE, 1000)     // New IO API Replaced by M_TIMER_ARM_ACTIVATION
+#endif
+      /* Reserve next 100 values                     from   0x20579L*/
+      /*                                             to     0x205DBL*/
+
+#define M_TIMER_ARM_SOFTWARE                          0x205DCL
+      /* Reserve next 100 values                     from   0x205DDL*/
+      /*                                             to     0x2063FL*/
+
+#define M_TIMER_CLOCK_ACTIVATION                      0x20640L
+      /* Reserve next 100 values                     from   0x20641L*/
+      /*                                             to     0x206A3L*/
+#define M_TIMER_TRIGGER_OVERLAP                       0x20708L
+      /* Reserve next 100 values                     from   0x20709L*/
+      /*                                             to     0x2076BL*/
+#define M_TIMER_RESET_SOURCE                         0x2076CL
+
+      /* Reserve next 100 values                     from   0x2076DL*/
+      /* For future M_TIMER FUNCTIONNALITY           to     0x207CFL*/
+
+/************************************************************************/
+/* MdigInquire() Types MIL_DOUBLE                                       */
+/************************************************************************/
+#define M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_START   0x207D0L
+
+#define M_TIMER_DURATION_MAX                          0x207D0L
+#define M_GRAB_EXPOSURE_TIME_MAX                      M_TIMER_DURATION_MAX
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME_MAX, 1000)     // New IO API Replaced by M_TIMER_DURATION_MAX
+#endif
+      /* Reserve next 100 values                     from   0x207D1L*/
+      /*                                             to     0x20833L*/
+#define M_TIMER_DURATION                              0x20834L
+#define M_GRAB_EXPOSURE_TIME                          M_TIMER_DURATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME, 1000)     // New IO API Replaced by M_TIMER_DURATION
+#endif
+      /* Reserve next 100 values                     from   0x20835L*/
+      /*                                             to     0x20897L*/
+#define M_TIMER_DELAY                                 0x20898L
+#define M_GRAB_EXPOSURE_TIME_DELAY                    M_TIMER_DELAY
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME_DELAY, 1000)     // New IO API Replaced by M_TIMER_DELAY
+#endif
+      /* Reserve next 100 values                     from   0x20899L*/
+      /*                                             to     0x208FBL*/
+#define M_TIMER_CLOCK_FREQUENCY                       0x208FCL
+#define M_GRAB_EXPOSURE_CLOCK_FREQUENCY               M_TIMER_CLOCK_FREQUENCY
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_CLOCK_FREQUENCY, 1000)     // New IO API Replaced by M_TIMER_CLOCK_FREQUENCY
+#endif
+      /* Reserve next 100 values                     from   0x208FDL*/
+      /*                                             to     0x2095FL*/
+#define M_TIMER_TIMEOUT                               0x20960L
+#define M_GRAB_EXPOSURE_TIMEOUT                       M_TIMER_TIMEOUT
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIMEOUT, 1000)     // New IO API Replaced by M_TIMER_TIMEOUT
+#endif
+      /* Reserve next 100 values                     from   0x20961L*/
+      /*                                             to     0x209C3L*/
+#define M_TIMER_VALUE                                 0x209C4L
+#define M_GRAB_EXPOSURE_MEASURED                      M_TIMER_VALUE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_MEASURED, 1000)     // New IO API Replaced by M_TIMER_VALUE
+#endif
+      /* Reserve next 100 values                     from   0x209C5L*/
+      /*                                             to     0x20A27L*/
+#define M_TIMER_DURATION2                              0x20A28L
+      /* Reserve next 100 values                     from   0x20A29L*/
+      /*                                             to     0x20A8BL*/
+#define M_TIMER_DELAY2                                 0x20A8CL
+      /* Reserve next 100 values                     from   0x20A8DL*/
+      /*                                             to     0x20AEFL*/
+#define M_TIMER_DELAY_CLOCK_FREQUENCY                  0x20AF0L
+      /* Reserve next 100 values                     from   0x20AF1L*/
+      /*                                             to     0x20A53L*/
+      /* Reserve next 100 values                     from   0x20B54L*/
+      /* For future M_TIMER FUNCTIONNALITY           to     0x20BB7L*/
+
+#define M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_END           0x20BB8L
+#else
+#define M_TIMER_STATE                                 0x20000L
+#define M_GRAB_EXPOSURE                               M_TIMER_STATE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE, 1000)     // New IO API Replaced by M_TIMER_STATE
+#endif
+      /* Reserve next 128 values                     from   0x20001L*/
+      /*                                             to     0x2007FL*/
+#define M_TIMER_TRIGGER_SOURCE                        0x20080L
+#define M_GRAB_EXPOSURE_SOURCE                        M_TIMER_TRIGGER_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_SOURCE, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_SOURCE
+#endif
+      /* Reserve next 128 values                     from   0x20081L*/
+      /*                                             to     0x200FFL*/
+#define M_TIMER_OUTPUT_INVERTER                       0x20100L
+#define M_GRAB_EXPOSURE_MODE                          M_TIMER_OUTPUT_INVERTER
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_MODE, 1000)     // New IO API Replaced by M_TIMER_OUTPUT_INVERTER
+#endif
+      /* Reserve next 128 values                     from   0x20101LL*/
+      /*                                             to     0x2017FLL*/
+#define M_TIMER_DELAY_CLOCK_ACTIVATION                0x20180L
+#define M_GRAB_EXPOSURE_DELAY_CLOCK_MODE              M_TIMER_DELAY_CLOCK_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_DELAY_CLOCK_MODE, 1000)     // New IO API Replaced by M_TIMER_DELAY_CLOCK_ACTIVATION
+#endif
+      /* Reserve next 128 values                     from   0x20181LL*/
+      /*                                             to     0x201FFLL*/
+#define M_TIMER_DELAY_CLOCK_SOURCE                    0x20200L
+#define M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE            M_TIMER_DELAY_CLOCK_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_DELAY_CLOCK_SOURCE, 1000)     // New IO API Replaced by M_TIMER_DELAY_CLOCK_SOURCE
+#endif
+      /* Reserve next 128 values                     from   0x20201L*/
+      /*                                             to     0x2027FL*/
+
+#define M_TIMER_TRIGGER_ACTIVATION                    0x20280L
+#define M_GRAB_EXPOSURE_TRIGGER_MODE                  M_TIMER_TRIGGER_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MODE, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_ACTIVATION
+#endif
+      /* Reserve next 128 values                     from   0x20281L*/
+      /*                                             to     0x202FFL*/
+#define M_TIMER_CLOCK_SOURCE                          0x20300L
+#define M_GRAB_EXPOSURE_CLOCK_SOURCE                  M_TIMER_CLOCK_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_CLOCK_SOURCE, 1000)     // New IO API Replaced by M_TIMER_CLOCK_SOURCE
+#endif
+      /* Reserve next 128 values                     from   0x20301L*/
+      /*                                             to     0x2037FL*/
+#define M_TIMER_USAGE                                 0x20380L
+#define M_GRAB_EXPOSURE_USAGE                         M_TIMER_USAGE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_USAGE, 1000)     // New IO API Replaced by M_TIMER_USAGE
+#endif
+      /* Reserve next 128 values                     from   0x20381L*/
+      /*                                             to     0x203FFL*/
+#define M_TIMER_TRIGGER_MISSED                        0x20400L
+#define M_GRAB_EXPOSURE_TRIGGER_MISSED                M_TIMER_TRIGGER_MISSED
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MISSED, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_MISSED
+#endif
+      /* Reserve next 128 values                     from   0x20401L*/
+      /*                                             to     0x2047FL*/
+#define M_TIMER_TRIGGER_MISSED_STATUS                 0x20480L
+#define M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS         M_TIMER_TRIGGER_MISSED_STATUS
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_MISSED_STATUS, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_MISSED_STATUS
+#endif
+      /* Reserve next 128 values                     from   0x20481L*/
+      /*                                             to     0x204FFL*/
+#define M_TIMER_TRIGGER_RATE_DIVIDER                  0x20500L
+#define M_GRAB_EXPOSURE_TRIGGER_DIVIDER               M_TIMER_TRIGGER_RATE_DIVIDER
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TRIGGER_DIVIDER, 1000)     // New IO API Replaced by M_TIMER_TRIGGER_RATE_DIVIDER
+#endif
+      /* Reserve next 128 values                     from   0x20501L*/
+      /*                                             to     0x2057FL*/
+
+#define M_TIMER_TRIGGER_SOFTWARE                      0x20580L
+      /* Reserve next 128 values                     from   0x20581L*/
+      /*                                             to     0x205FFL*/
+
+#define M_TIMER_ARM                                   0x20600L
+#define M_GRAB_EXPOSURE_ARM                           M_TIMER_ARM
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM, 1000)     // New IO API Replaced by M_TIMER_ARM
+#endif
+      /* Reserve next 128 values                     from   0x20601L*/
+      /*                                             to     0x2067FL*/
+#define M_TIMER_ARM_SOURCE                            0x20680L
+#define M_GRAB_EXPOSURE_ARM_SOURCE                    M_TIMER_ARM_SOURCE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM_SOURCE, 1000)     // New IO API Replaced by M_TIMER_ARM_SOURCE
+#endif
+      /* Reserve next 128 values                     from   0x20681L*/
+      /*                                             to     0x206FFL*/
+#define M_TIMER_ARM_ACTIVATION                        0x20700L
+#define M_GRAB_EXPOSURE_ARM_MODE                      M_TIMER_ARM_ACTIVATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_ARM_MODE, 1000)     // New IO API Replaced by M_TIMER_ARM_ACTIVATION
+#endif
+      /* Reserve next 128 values                     from   0x20701L*/
+      /*                                             to     0x2077FL*/
+
+#define M_TIMER_ARM_SOFTWARE                          0x20780L
+      /* Reserve next 128 values                     from   0x20781L*/
+      /*                                             to     0x207FFL*/
+
+#define M_TIMER_CLOCK_ACTIVATION                      0x20800L
+      /* Reserve next 128 values                     from   0x20801L*/
+      /*                                             to     0x2087FL*/
+#define M_TIMER_TRIGGER_OVERLAP                       0x20880L
+      /* Reserve next 128 values                     from   0x20881L*/
+      /*                                             to     0x208FFL*/
+#define M_TIMER_RESET_SOURCE                         0x20900L
+
+      /* Reserve next 128 values                     from   0x20901L*/
+      /* For future M_TIMER FUNCTIONNALITY           to     0x2097FL*/
+
+/************************************************************************/
+/* MdigInquire() Types MIL_DOUBLE                                       */
+/************************************************************************/
+#define M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_START   0x21500L
+
+#define M_TIMER_DURATION_MAX                          0x21500L
+#define M_GRAB_EXPOSURE_TIME_MAX                      M_TIMER_DURATION_MAX
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME_MAX, 1000)     // New IO API Replaced by M_TIMER_DURATION_MAX
+#endif
+      /* Reserve next 128 values                     from   0x21501L*/
+      /*                                             to     0x2157FL*/
+#define M_TIMER_DURATION                              0x21580L
+#define M_GRAB_EXPOSURE_TIME                          M_TIMER_DURATION
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME, 1000)     // New IO API Replaced by M_TIMER_DURATION
+#endif
+      /* Reserve next 128 values                     from   0x21581L*/
+      /*                                             to     0x215FFL*/
+#define M_TIMER_DELAY                                 0x21600L
+#define M_GRAB_EXPOSURE_TIME_DELAY                    M_TIMER_DELAY
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIME_DELAY, 1000)     // New IO API Replaced by M_TIMER_DELAY
+#endif
+      /* Reserve next 128 values                     from   0x21601L*/
+      /*                                             to     0x2167FL*/
+#define M_TIMER_CLOCK_FREQUENCY                       0x21680L
+#define M_GRAB_EXPOSURE_CLOCK_FREQUENCY               M_TIMER_CLOCK_FREQUENCY
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_CLOCK_FREQUENCY, 1000)     // New IO API Replaced by M_TIMER_CLOCK_FREQUENCY
+#endif
+      /* Reserve next 128 values                     from   0x21681L*/
+      /*                                             to     0x216FFL*/
+#define M_TIMER_TIMEOUT                               0x21700L
+#define M_GRAB_EXPOSURE_TIMEOUT                       M_TIMER_TIMEOUT
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_TIMEOUT, 1000)     // New IO API Replaced by M_TIMER_TIMEOUT
+#endif
+      /* Reserve next 128 values                     from   0x21701L*/
+      /*                                             to     0x2177FL*/
+#define M_TIMER_VALUE                                 0x21780L
+#define M_GRAB_EXPOSURE_MEASURED                      M_TIMER_VALUE
+#if OldDefinesSupport
+   MIL_DEPRECATED(M_GRAB_EXPOSURE_MEASURED, 1000)     // New IO API Replaced by M_TIMER_VALUE
+#endif
+      /* Reserve next 128 values                     from   0x21781L*/
+      /*                                             to     0x217FFL*/
+#define M_TIMER_DURATION2                              0x21800L
+      /* Reserve next 128 values                     from   0x21801L*/
+      /*                                             to     0x2187FL*/
+#define M_TIMER_DELAY2                                 0x21880L
+      /* Reserve next 128 values                     from   0x21881L*/
+      /*                                             to     0x218FFL*/
+#define M_TIMER_DELAY_CLOCK_FREQUENCY                  0x21900L
+      /* Reserve next 128 values                     from   0x21901L*/
+      /*                                             to     0x2197FL*/
+
+#define M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_END           0x22500L
+#endif
+
+#define M_GRAB_EXTENDED_DATA                                0x23000L
+      /* Reserve      0x1000 values                  from   0x23001*/
+      /*                                             to     0x23FFF*/
+
+      // Rotary encoder
+#define M_ROTARY_ENCODER_POSITION                    MIL_MAKE_CONST(0x00024000L,0x0000000000024000)
+      /* Reserve      0x100 values                   from   0x24700*/
+      /*                                             to     0x247FF*/
+#define M_ROTARY_ENCODER_POSITION_TRIGGER            MIL_MAKE_CONST(0x00025000L,0x0000000000025000)
+      /* Reserve      0x100 values                   from   0x25700*/
+      /*                                             to     0x257FF*/
+#define M_ROTARY_ENCODER_FRAME_END_POSITION          MIL_MAKE_CONST(0x00026000L,0x0000000000026000)
+      /* Reserve      0x100 values                   from   0x26700*/
+      /*                                             to     0x267FF*/
+#define M_ROTARY_ENCODER_DIRECTION                   MIL_MAKE_CONST(0x00027000L,0x0000000000027000)
+      /* Reserve      0x100 values                   from   0x27700*/
+      /*                                             to     0x277FF*/
+#define M_ROTARY_ENCODER_GRAB_LINE_READ              MIL_MAKE_CONST(0x00028000L,0x0000000000028000)
+      /* Reserve      0x100 values                   from   0x28700*/
+      /*                                             to     0x287FF*/
+#define M_ROTARY_ENCODER_ON_GRAB_LINE                M_ROTARY_ENCODER_GRAB_LINE_READ
+#define M_ROTARY_ENCODER_MULTIPLIER                  MIL_MAKE_CONST(0x00029000L,0x0000000000029000)
+      /* Reserve      0x100 values                   from   0x29700*/
+      /*                                             to     0x297FF*/
+#define M_ROTARY_ENCODER_DIVIDER                     MIL_MAKE_CONST(0x0002A000L,0x000000000002A000)
+      /* Reserve      0x100 values                   from   0x2A700*/
+      /*                                             to     0x2A7FF*/
+#define M_ROTARY_ENCODER_RESET_SOURCE                MIL_MAKE_CONST(0x0002B000L,0x000000000002B000)
+      /* Reserve      0x100 values                   from   0x2B700*/
+      /*                                             to     0x2B7FF*/
+#define M_ROTARY_ENCODER_RESET_VALUE                 MIL_MAKE_CONST(0x0002C000L,0x000000000002C000)
+      /* Reserve      0x100 values                   from   0x2C700*/
+      /*                                             to     0x2C7FF*/
+#define M_ROTARY_ENCODER_OUTPUT_MODE                 MIL_MAKE_CONST(0x0002D000L,0x000000000002D000)
+      /* Reserve      0x100 values                   from   0x2D700*/
+      /*                                             to     0x2D7FF*/
+#define M_ROTARY_ENCODER_OUTPUT1_MODE                MIL_MAKE_CONST(0x0002E000L,0x000000000002E000)
+      /* Reserve      0x100 values                   from   0x2E700*/
+      /*                                             to     0x2E7FF*/
+#define M_ROTARY_ENCODER_OUTPUT2_MODE                MIL_MAKE_CONST(0x0002F000L,0x000000000002F000)
+      /* Reserve      0x100 values                   from   0x2F700*/
+      /*                                             to     0x2F7FF*/
+#define M_ROTARY_ENCODER_STATE                       MIL_MAKE_CONST(0x00030000L,0x0000000000030000)
+      /* Reserve      0x100 values                   from   0x30700*/
+      /*                                             to     0x307FF*/
+#define M_ROTARY_ENCODER_BIT0_SOURCE                 MIL_MAKE_CONST(0x00031000L,0x0000000000031000)
+      /* Reserve      0x100 values                   from   0x31700*/
+      /*                                             to     0x317FF*/
+#define M_ROTARY_ENCODER_BIT1_SOURCE                 MIL_MAKE_CONST(0x00032000L,0x0000000000032000)
+      /* Reserve      0x100 values                   from   0x32700*/
+      /*                                             to     0x327FF*/
+#define M_ROTARY_ENCODER_FORCE_VALUE_SOURCE          MIL_MAKE_CONST(0x00033000L,0x0000000000033000)
+      /* Reserve      0x100 values                   from   0x33700*/
+      /*                                             to     0x337FF*/
+#define M_ROTARY_ENCODER_FRAME_END_READ              MIL_MAKE_CONST(0x00034000L,0x0000000000034000)
+      /* Reserve 0x100 values                        from   0x34700*/
+      /*                                             to     0x347FF*/
+#define M_ROTARY_ENCODER_RESET_ACTIVATION            MIL_MAKE_CONST(0x00035000L,0x0000000000035000)
+      /* Reserve 0x100 values                        from   0x35700*/
+      /*                                             to     0x357FF*/
+      /*                                             to     0x36000L*/
+#define M_ROTARY_ENCODER_POSITION_START_TRIGGER      MIL_MAKE_CONST(0x00036000L,0x0000000000036000)
+      /* Reserve      0x100 values                   from   0x36700*/
+      /*                                             to     0x367FF*/
+      /* Reserve next 3 ranges of values             from   0x37000L*/
+      /* For future M_ROTARY_FUNCTIONALITY           to     0x39000L*/
+
+#define M_ROTARY_RANGE_DOUBLE_START                  0x3A000L
+#define M_ROTARY_ENCODER_POSITION_TRIGGER_DOUBLE     MIL_MAKE_CONST(0x0003A000L,0x000000000003A000)
+      /* Reserve      0x100 values                   from   0x3A700*/
+      /*                                             to     0x3A7FF*/
+      /* Reserve next 5 ranges of values             from   0x3B000L*/
+      /* For future M_ROTARY_FUNCTIONALITY           to     0x3F000L*/
+
+#define M_ROTARY_RANGE_DOUBLE_END                    0x3F800L
+
+   #if OldDefinesSupport
+   #define M_FORMAT_LENGTH                         M_FORMAT_SIZE
+   #define M_FORMAT_SUPPORTED_LENGTH               M_FORMAT_SUPPORTED_SIZE
+   #define M_SERIAL_NUMBER_LENGTH                  M_SERIAL_NUMBER_SIZE
+   #define M_CAMERA_VENDOR_LENGTH                  M_CAMERA_VENDOR_SIZE
+   #define M_GC_VERSION_LENGTH                     M_GC_VERSION_SIZE
+   #define M_GC_SPECIFIC_INFO_LENGTH               M_GC_SPECIFIC_INFO_SIZE
+   #define M_GC_USER_NAME_LENGTH                   M_GC_USER_NAME_SIZE
+   #define M_GC_SERIAL_NUMBER_LENGTH               M_GC_SERIAL_NUMBER_SIZE
+   #define M_FORMAT_DETECTED_LENGTH                M_FORMAT_DETECTED_SIZE
+   #define M_CAMERA_MODEL_LENGTH                   M_CAMERA_MODEL_SIZE
+   #define M_GC_GET_STREAMABLE_FEATURES_LENGTH     M_GC_GET_STREAMABLE_FEATURES_SIZE
+   #define M_GC_CLPROTOCOL_DEVICEID_LENGTH         M_GC_CLPROTOCOL_DEVICE_ID_SIZE
+   #define M_GC_INTERFACE_NAME_LENGTH              M_GC_INTERFACE_NAME_SIZE
+   #define M_GC_XML_PATH_LENGTH                    M_GC_XML_PATH_SIZE
+   #define M_GC_CLPROTOCOL_DEVICEID                M_GC_CLPROTOCOL_DEVICE_ID
+   MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID, 1000)
+   #define M_GC_CLPROTOCOL_DEVICEID_SIZE           M_GC_CLPROTOCOL_DEVICE_ID_SIZE
+   MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID_MAX, 1000)
+   #define M_GC_CLPROTOCOL_DEVICEID_DEFAULT        M_GC_CLPROTOCOL_DEVICE_ID_DEFAULT
+   MIL_DEPRECATED(M_GC_CLPROTOCOL_DEVICEID_DEFAULT, 1000)
+   #endif
+
+
+
+#define M_HOOK_EVENT_BACKDOOR_INTERNAL                0x4444L // 17476
+#define M_HOOK_CANCEL_EVENT_BACKDOOR_INTERNAL         0x4464L // 17508
+
+
+
+
+/* Reserve 3 values for M_HUE                  from   32768*/
+/*                                             to     32771*/
+#define M_MODEL                                       0x00010000L   //65536
+
+#define M_START_REGISTER_ADDRESS                      MAKE_INT64(0x00000000F0000000)
+/*Reserve the values between 0xF000000 and 0xF0FFFFFF for 1394*/
+#define M_END_REGISTER_ADDRESS                        MAKE_INT64(0x00000000F0FFFFFF) 
+
+// !!! MAP FOR OLD DEFINES
+#if OldDefinesSupport
+#define M_DIG_TYPE                                    M_TYPE
+MIL_DEPRECATED(M_DIG_TYPE, 1000)
+#define M_DIG_NUMBER                                  M_NUMBER
+MIL_DEPRECATED(M_DIG_NUMBER, 1000)
+#define M_DIG_FORMAT                                  M_FORMAT
+MIL_DEPRECATED(M_DIG_FORMAT, 1000)
+#define M_DIG_INIT_FLAG                               M_INIT_FLAG
+MIL_DEPRECATED(M_DIG_INIT_FLAG, 1000)
+#define M_DIG_CHANNEL_NUM                             M_CHANNEL_NUM
+MIL_DEPRECATED(M_DIG_CHANNEL_NUM, 1000)
+
+#define M_DIG_REF_BLACK                               M_BLACK_REF
+MIL_DEPRECATED(M_DIG_REF_BLACK, 1000)
+#define M_DIG_REF_WHITE                               M_WHITE_REF
+MIL_DEPRECATED(M_DIG_REF_WHITE, 1000)
+#define M_DIG_REF_HUE                                 M_HUE_REF
+MIL_DEPRECATED(M_DIG_REF_HUE, 1000)
+#define M_DIG_REF_SATURATION                          M_SATURATION_REF
+MIL_DEPRECATED(M_DIG_REF_SATURATION, 1000)
+#define M_DIG_REF_BRIGHTNESS                          M_BRIGHTNESS_REF
+MIL_DEPRECATED(M_DIG_REF_BRIGHTNESS, 1000)
+#define M_DIG_REF_CONTRAST                            M_CONTRAST_REF
+MIL_DEPRECATED(M_DIG_REF_CONTRAST, 1000)
+#define M_DIG_BLACK_REF                               M_BLACK_REF
+MIL_DEPRECATED(M_DIG_BLACK_REF, 1000)
+#define M_DIG_WHITE_REF                               M_WHITE_REF
+MIL_DEPRECATED(M_DIG_WHITE_REF, 1000)
+#define M_DIG_HUE_REF                                 M_HUE_REF
+MIL_DEPRECATED(M_DIG_HUE_REF, 1000)
+#define M_DIG_SATURATION_REF                          M_SATURATION_REF
+MIL_DEPRECATED(M_DIG_SATURATION_REF, 1000)
+#define M_DIG_BRIGHTNESS_REF                          M_BRIGHTNESS_REF
+MIL_DEPRECATED(M_DIG_BRIGHTNESS_REF, 1000)
+#define M_DIG_CONTRAST_REF                            M_CONTRAST_REF
+MIL_DEPRECATED(M_DIG_CONTRAST_REF, 1000)
+#define M_DIG_INPUT_MODE                              M_INPUT_MODE
+MIL_DEPRECATED(M_DIG_INPUT_MODE, 1000)
+#define M_DIG_GRAB_SCALE                              M_GRAB_SCALE
+MIL_DEPRECATED(M_DIG_GRAB_SCALE, 1000)
+#define M_DIG_GRAB_SCALE_X                            M_GRAB_SCALE_X
+MIL_DEPRECATED(M_DIG_GRAB_SCALE_X, 1000)
+#define M_DIG_GRAB_SCALE_Y                            M_GRAB_SCALE_Y
+MIL_DEPRECATED(M_DIG_GRAB_SCALE_Y, 1000)
+#define M_DIG_GRAB_SUBSAMPLE                          M_GRAB_SUBSAMPLE
+MIL_DEPRECATED(M_DIG_GRAB_SUBSAMPLE, 1000)
+#define M_DIG_GRAB_SUBSAMPLE_X                        M_GRAB_SUBSAMPLE_X
+MIL_DEPRECATED(M_DIG_GRAB_SUBSAMPLE_X, 1000)
+#define M_DIG_GRAB_SUBSAMPLE_Y                        M_GRAB_SUBSAMPLE_Y
+MIL_DEPRECATED(M_DIG_GRAB_SUBSAMPLE_Y, 1000)
+#define M_DIG_GRAB_MODE                               M_GRAB_MODE
+MIL_DEPRECATED(M_DIG_GRAB_MODE, 1000)
+#define M_DIG_GRAB_FRAME_NUM                          M_GRAB_FRAME_NUM
+MIL_DEPRECATED(M_DIG_GRAB_FRAME_NUM, 1000)
+#define M_DIG_GRAB_FIELD_NUM                          M_GRAB_FIELD_NUM
+MIL_DEPRECATED(M_DIG_GRAB_FIELD_NUM, 1000)
+#define M_DIG_SOURCE_SIZE_X                           M_SOURCE_SIZE_X
+MIL_DEPRECATED(M_DIG_SOURCE_SIZE_X, 1000)
+#define M_DIG_SOURCE_SIZE_Y                           M_SOURCE_SIZE_Y
+MIL_DEPRECATED(M_DIG_SOURCE_SIZE_Y, 1000)
+#define M_DIG_SOURCE_OFFSET_X                         M_SOURCE_OFFSET_X
+MIL_DEPRECATED(M_DIG_SOURCE_OFFSET_X, 1000)
+#define M_DIG_SOURCE_OFFSET_Y                         M_SOURCE_OFFSET_Y
+MIL_DEPRECATED(M_DIG_SOURCE_OFFSET_Y, 1000)
+#define M_DIG_USER_BIT                                M_USER_BIT
+MIL_DEPRECATED(M_DIG_USER_BIT, 1000)
+#define M_DIG_INPUT_SIGNAL_PRESENT                    M_INPUT_SIGNAL_PRESENT
+MIL_DEPRECATED(M_DIG_INPUT_SIGNAL_PRESENT, 1000)
+#define M_DIG_INPUT_SIGNAL_SOURCE                     M_INPUT_SIGNAL_SOURCE
+MIL_DEPRECATED(M_DIG_INPUT_SIGNAL_SOURCE, 1000)
+
+#define M_DIG_CLIP_SRC_SUPPORTED                      M_CLIP_SRC_SUPPORTED
+MIL_DEPRECATED(M_DIG_CLIP_SRC_SUPPORTED, 1000)
+#define M_DIG_CLIP_DST_SUPPORTED                      M_CLIP_DST_SUPPORTED
+MIL_DEPRECATED(M_DIG_CLIP_DST_SUPPORTED, 1000)
+#define M_DIG_HOOK_FUNCTION_SUPPORTED                 M_HOOK_FUNCTION_SUPPORTED
+MIL_DEPRECATED(M_DIG_HOOK_FUNCTION_SUPPORTED, 1000)
+#define M_GRAB_INTERLACED_MODE                        M_SCAN_MODE
+MIL_DEPRECATED(M_GRAB_INTERLACED_MODE, 1000)
+#define M_GRAB_THREAD_PRIORITY                        M_THREAD_PRIORITY
+MIL_DEPRECATED(M_GRAB_THREAD_PRIORITY, 1000)
+#define M_HOOK_PRIORITY                               M_THREAD_PRIORITY
+MIL_DEPRECATED(M_HOOK_PRIORITY, 1000)
+#define M_GRAB_WINDOWS_RANGE                          M_GRAB_WINDOW_RANGE
+MIL_DEPRECATED(M_GRAB_WINDOWS_RANGE, 1000)
+#define M_GRAB_WINDOWS_RANGE_SUPPORTED                M_GRAB_WINDOW_RANGE_SUPPORTED
+MIL_DEPRECATED(M_GRAB_WINDOWS_RANGE_SUPPORTED, 1000)
+
+#define M_HW_TRIGGER                                  M_HARDWARE_PORT0
+MIL_DEPRECATED(M_HW_TRIGGER, 1000)
+#define M_SW_TRIGGER                                  M_SOFTWARE
+MIL_DEPRECATED(M_SW_TRIGGER, 1000)
+#define M_VSYNC_TRIGGER                               M_VSYNC
+MIL_DEPRECATED(M_VSYNC_TRIGGER, 1000)
+#define M_HSYNC_TRIGGER                               M_HSYNC
+MIL_DEPRECATED(M_HSYNC_TRIGGER, 1000)
+#define M_USER_BIT_SOURCE                             M_IO_SOURCE
+MIL_DEPRECATED(M_USER_BIT_SOURCE, 1000)
+
+#endif
+
+// List of defines for CLLjpegControl
+//==============================================================================
+#define M_LOSSY                                          1L
+#define M_AUTO_BIT_RATE_CONTROL                          2L
+#define M_STATISTICAL                                    3L
+#define M_BIT_RATE_CONTROL                               4L
+#define M_TABLES_ONLY                                    5L
+#define M_TABLES_PRELOAD                                 6L
+#define M_LOSSLESS                                       7L
+#define M_FAST_PREVIEW                                   8L
+
+#define M_APP                                         0x00000001L
+#define M_COM                                         0x00000002L
+#define M_DRI                                         0x00000004L
+#define M_DQT                                         0x00000008L
+#define M_DHT                                         0x00000010L
+#define M_DNL                                         0x00000020L
+#define M_DQTI                                        0x00000040L
+#define M_DHTI                                        0x00000080L
+
+#define M_NSCN_1                                         0L
+#define M_NSCN_2                                         1L
+#define M_NSCN_3                                         2L
+#define M_NSCN_4                                         3L
+#define M_NSCN_5                                         4L
+#define M_NSCN_6                                         5L
+#define M_NSCN_7                                         6L
+#define M_NSCN_8                                         7L
+
+/* Inquire Values */
+#define M_DIGITAL                                     0L
+#define M_ANALOG                                      1L
+#define M_INTERLACE                                   0L
+#define M_PROGRESSIVE                                 1L
+#define M_LINESCAN                                    2L
+#define M_DEINTERLACE                                 3L
+#define M_ACTIVATE                                    1L
+
+/* Inquire Values for the color mode */
+#define M_MONOCHROME                                  0L
+#define M_COMPOSITE                                   1L
+#define M_RGB                                         8L
+#define M_YUV                                         4L
+#define M_EXTERNAL_CHROMINANCE                        4137L
+#define M_MONO8_VIA_RGB                               M_MONO32
+#define M_SEPARATE                                    0x8000L
+
+
+/* List of define for hardware deinterlacing */
+#define M_ANTIALIASING                                0x1000
+#define M_BOB_METHOD                                  0x4
+#define M_MADI_METHOD                                 0x8
+
+// Values return by M_GRAB_FRAME_BURST_END_SOURCE
+#define M_BURST_MAX_TIME                       0x00000001
+#define M_BURST_TRIGGER                        0x00000002
+#define M_BURST_COUNT                          0x00000004
+
+// Values to control M_DATA_LATCH_TYPE
+#define M_IO_STATUS_ALL                       (M_USER_BIT_BIT_MASK_ENABLED|M_IO_STATUS)
+#define M_ROTARY_ENCODER                       0x700L
+#define M_ROTARY_ENCODER1                      (M_ROTARY_ENCODER +M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER2                      (M_ROTARY_ENCODER1+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER3                      (M_ROTARY_ENCODER2+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER4                      (M_ROTARY_ENCODER3+M_ROTARY_MAX_OUTPUT)
+#define M_TIME_STAMP                           M_GRAB_TIME_STAMP
+#define M_DATA_LATCH_CXP_HEADER_PIXEL_FORMAT    0x4
+#define M_DATA_LATCH_CXP_HEADER_X_SIZE_OFFSET   0x6
+#define M_DATA_LATCH_CXP_HEADER_Y_SIZE_OFFSET   0x5
+
+// Values to control M_DATA_LATCH_LATCH_MODE
+#define M_NORMAL                                8L
+#define M_PREFETCH                             32L
+
+/* List of define for digitizer filter type */
+#define M_DIGITIZER_FILTER_MASK                       MAKE_INT64(0x000000000000FFFF)
+#define M_KAISER                                      0x10000
+#define M_GAUSS                                       0x20000
+
+
+#define M_DVI_1                                       0x0001
+#define M_DVI_2                                       0x0020
+#define M_DVI_3                                       0x0040
+#define M_DVI_4                                       0x0080
+#define M_SDI_1                                       0x0100
+#define M_SDI_2                                       0x0200
+#define M_SDI_3                                       0x0400
+#define M_SDI_4                                       0x0800
+
+#define M_HDMI                                        0x2000
+#define M_DP                                          0x2001
+
+
+/************************************************************************/
+/* Board types                                                          */
+/************************************************************************/
+#define M_BOARD_TYPE_MASK                             0x000000FFL
+
+// Radient board type
+#define M_RADIENT                                     10L
+#define M_RADIENTPRO                                  15L
+
+// Corona board type
+#define M_CORONA                                      20L
+#define M_CORONA_LC                                   21L
+#define M_CORONA_VIA                                  22L
+#define M_CORONA_RR                                   23L
+#define M_INDIO                                       24L
+#define M_CORONA_II                                   25L
+/* Free for future board type                         27L*/
+#define M_CORONA_II_WITH_DIG_MODULE                   (M_CORONA_II|M_DIGITAL_MODULE)
+
+/* Free for future board type                         33L*/
+/* Free for future board type                         35L*/
+
+/* Free for future board type                         40L*/
+
+// 1394 board type
+#define M_IEEE_1394_IIDC                              50L
+#define M_NON_MATROX_OHCI_BOARD                       M_IEEE_1394_IIDC
+
+/* Free for future board type                         60L*/
+
+// CronosPlus board type
+#define M_CRONOSPLUS                                  70L
+
+// Free for future board type                         80L
+
+// Morphis Board type
+#define M_MORPHIS                                     90L
+
+// Host board type
+#define M_HOST                                       100L
+
+// Rapixo board type
+#define M_RAPIXOCXP                                  M_RAPIXO
+#define M_RAPIXO                                     110L
+
+// Solios board type
+#define M_SOLIOS                                     120L
+
+// Nexis board type
+#define M_NEXIS                                      130L
+
+#define M_CONCORD_POE                                140L
+
+// Vio board type
+#define M_VIO                                        150L
+
+// Iris board type
+#define M_IRIS                                       160L
+
+// MorphisQxt board type
+#define M_MORPHISQXT                                 170L
+
+// GigeVision board type
+#define M_GIGE_VISION                                180L
+
+// GPU board type
+#define M_GPU                                        190L
+
+#define M_USB3_VISION                                200L
+
+#define M_GENTL                                      210L
+
+#define M_IRIS_GTR                                   220L
+#define M_NEXIS3                                     221L
+
+// Iris Gt board type
+#define M_IRIS_GT                                    230L
+#define M_IRIS_GT_DUAL                               231L
+#define M_NEXIS2                                     232L
+
+#define M_ORION_HD                                   240L
+
+#define M_ORION_UHD                                  250L
+#define M_CLARITY_UHD                                250L
+
+/* Free for future board type                        280L*/
+
+// Corona and Genesis module type.
+#define M_DIGITAL_MODULE                              0x00000100L
+
+// Solios, Radient module type.
+#define M_XCL                                         0x00000800L
+#define M_CL                                          M_XCL
+#define M_CXP                                         0x00000200L // Coax Express 
+#define M_CLHS                                        0x00000400L // CLHS 
+#define M_XA                                          0x00001000L
+#define M_XD                                          0x00008000L
+#define M_PF                                          0x01000000L // Processing fpga installed
+#define M_DFWD                                        0x00000100L // Data Forwarding 
+
+// Camera Link, Digital and Analog 
+#define M_QBCL                                        0x04000000L // Quad Base CL
+#define M_SBCL                                        0x08000000L // Single Base CL
+#define M_QHA                                         0x00100000L // Quad High freq. Analog
+#define M_SFCL                                        0x00200000L // Single Full CL
+#define M_DBCL                                        0x00400000L // Dual Base CL
+#define M_QD                                          0x00800000L // Quad Digital
+#define M_DA                                          0x00010000L // Dual Analog
+#define M_QA                                          0x00020000L // Quad Analog
+#define M_SA                                          0x00040000L // Single Analog
+#define M_SMCL                                        0x00080000L // Single Medium CL
+#define M_DFCL                                        0x00004000L // Dual Full CL
+// CXP only
+#define M_Q3G                                         0x00010000L // Quad link 3 Gbits 
+#define M_Q6G                                         0x02000000L // Quad link 6 Gbits
+#define M_Q12G                                        0x00800000L // Quad link 6 Gbits
+#define M_D3G                                         0x10000000L // Dual link 3 Gbits
+#define M_D6G                                         0x20000000L // Dual link 6 Gbits
+#define M_D12G                                        0x00100000L // Dual link 12 Gbits
+#define M_S12G                                        0x00002000L // Single link 12 Gbits
+// CLHS only
+#define M_SC7MS3                                      0x40000000L // Single copper 7 lanes 3 Gbits
+
+// Solios only.
+#define M_FAST                                        0x00002000L
+
+// SoliosGige module type.
+#define M_SCH                                         0x00010000L
+#define M_DCH                                         0x00020000L
+#define M_TCH                                         0x00040000L
+#define M_QCH                                         0x00080000L
+#define M_PF                                          0x01000000L // Processing fpga installed
+
+// Morphis and MorphisQxT module type.
+#define M_1VD                                         0x00004000L
+#define M_2VD                                         0x00008000L
+#define M_IO                                          0x00010000L
+#define M_4VD                                         0x00020000L
+#define M_16VD                                        0x00040000L
+#define M_J2K                                         0x00000200L
+#define M_JPEG2000                                    M_J2K
+#define M_COMPRESSION                                 0x00080000L
+#define M_AUDIO_MODULE                                0x00100000L
+
+// Vio module type.
+#define M_SDI                                         0x00001000L // Serial Digital Interface
+#define M_SA                                          0x00040000L // Single Analog
+#define M_DVI                                         0x00100000L // DVI Analog
+
+// Concord TOE module type.
+#define M_TOE                                         0x00001000L // Trigger over Ethernet
+#define M_SCH                                         0x00010000L
+#define M_DCH                                         0x00020000L
+#define M_TCH                                         0x00040000L
+#define M_QCH                                         0x00080000L
+
+// 1394 and Host module type.
+/* Free for future board type                         0x00000100L*/
+#define M_4SIGHT                                      0x00000200L
+#define M_4SIGHT_II                                   0x00000400L
+#define M_PC104                                       0x00000800L
+#define M_CONCORD                                     0x00001000L
+#define M_4SIGHT_X                                    0x00002000L
+#define M_SUPERSIGHT                                  0x00004000L
+#define M_4SIGHT_M                                    0x00008000L
+#define M_4SIGHT_GP                                   0x00010000L
+#define M_4SIGHT_GP_NEXIS2                            0x00020000L
+#define M_4SIGHT_GPM                                  0x00040000L
+#define M_4SIGHT_GPM_BT                               0x00080000L
+#define M_4SIGHT_EV6                                  0x00100000L
+
+// Iris Camera type
+// Suggested format:
+// 23:21 0
+// 20    Remote 1/Non remote 0
+// 19:12 P300 03, P700 07, P1200 12
+// 11    Mini head 1/Normal head 0
+// 10    High Speed 1/Normal 0
+// 9     E model 1/P model 0/GT model 0
+// 8     Color 1/Mono 0
+// 7:0   0
+#define M_P300                                        0x003000L
+#define M_P300C                                       0x003100L
+#define M_E300                                        0x003200L
+#define M_E300C                                       0x003300L
+#define M_P300H                                       0x003400L
+#define M_E300H                                       0x003600L
+#define M_P300HM                                      0x003C00L
+#define M_E300HM                                      0x003E00L
+#define M_P300R                                       0x103000L
+#define M_P300CR                                      0x103100L
+#define M_E300R                                       0x103200L
+#define M_E300CR                                      0x103300L
+#define M_P300HR                                      0x103400L
+#define M_E300HR                                      0x103600L
+#define M_P300HMR                                     0x103C00L
+#define M_E300HMR                                     0x103E00L
+#define M_P700                                        0x007000L
+#define M_E700                                        0x007200L
+#define M_P700W                                       0x007300L
+#define M_E700W                                       0x007400L
+#define M_P700R                                       0x107000L
+#define M_E700R                                       0x107200L
+#define M_P700WR                                      0x107300L
+#define M_E700WR                                      0x107400L
+#define M_P1200                                       0x012000L
+#define M_E1200                                       0x012200L
+#define M_P1200R                                      0x112000L
+#define M_E1200R                                      0x112200L
+#define M_P1200H                                      0x013000L
+#define M_E1200H                                      0x013200L
+#define M_P1200HR                                     0x113000L
+#define M_E1200HR                                     0x113200L
+#define M_P1200HM                                     0x012C00L
+#define M_E1200HM                                     0x012E00L
+#define M_P1200HMR                                    0x112C00L
+#define M_E1200HMR                                    0x112E00L
+
+// Iris Camera type - For compatibility before define renamed
+#define P300                                          M_P300   
+#define P300C                                         M_P300C  
+#define E300                                          M_E300   
+#define E300C                                         M_E300C  
+#define P300H                                         M_P300H  
+#define E300H                                         M_E300H  
+#define P300HM                                        M_P300HM 
+#define E300HM                                        M_E300HM 
+#define P300R                                         M_P300R  
+#define P300CR                                        M_P300CR 
+#define E300R                                         M_E300R  
+#define E300CR                                        M_E300CR 
+#define P300HR                                        M_P300HR 
+#define E300HR                                        M_E300HR 
+#define P300HMR                                       M_P300HMR
+#define E300HMR                                       M_E300HMR
+#define P700                                          M_P700   
+#define E700                                          M_E700   
+#define P700W                                         M_P700W  
+#define E700W                                         M_E700W  
+#define P700R                                         M_P700R  
+#define E700R                                         M_E700R  
+#define P700WR                                        M_P700WR 
+#define E700WR                                        M_E700WR 
+#define P1200                                         M_P1200  
+#define E1200                                         M_E1200  
+#define P1200R                                        M_P1200R 
+#define E1200R                                        M_E1200R 
+#define P1200H                                        M_P1200H  
+#define E1200H                                        M_E1200H  
+#define P1200HR                                       M_P1200HR 
+#define E1200HR                                       M_E1200HR 
+#define P1200HM                                       M_P1200HM  
+#define E1200HM                                       M_E1200HM  
+#define P1200HMR                                      M_P1200HMR 
+#define E1200HMR                                      M_E1200HMR 
+
+// Nexis Camera type
+#define M_S300T                                       M_P300R
+#define M_S300CT                                      M_P300CR
+#define M_S300HT                                      M_P300HR
+#define M_S300HM                                      M_P300HMR
+#define M_S700T                                       M_P700R
+#define M_S1200T                                      M_P1200R
+#define M_S1200HT                                     M_P1200HR
+#define M_S1200HM                                     M_P1200HMR
+
+// Iris GT camera type
+#define M_GT300                                       0x00001000
+#define M_GT1200                                      0x04001000
+#define M_GT1900                                      0x08001000
+#define M_GT300C                                      0x80001000
+#define M_GT1200C                                     0x84001000
+#define M_GT1900C                                     0x88001000
+#define M_GT5000                                      0x0C001000
+
+// Nexis2 camera type
+#define M_N2S300                                      0x40001000
+#define M_N2S1200                                     0x5C001000
+
+// Iris GTR
+#define M_480                                         0x50040000
+#define M_300                                         0x50d00100
+#define M_500                                         0x50d00200
+#define M_1300                                        0x50d00000
+#define M_2000                                        0x50320100
+#define M_5000                                        0x50320000
+
+#define M_480C                                        0x51040000
+#define M_300C                                        0x51d00100
+#define M_500C                                        0x51d00200
+#define M_1300C                                       0x51d00000
+#define M_2000C                                       0x51320100
+#define M_5000C                                       0x51320000
+
+#define M_480NIR                                      0x52040000
+#define M_300NIR                                      0x52d00100
+#define M_500NIR                                      0x52d00200
+#define M_1300NIR                                     0x52d00000
+#define M_2000NIR                                     0x52320100
+#define M_5000NIR                                     0x52320000
+
+/************************************************************************/
+/* MdigControl() / MdigInquire() Values                                 */
+/************************************************************************/
+#define M_WEIGHTED                                    2L
+#define M_CONTINUOUS                                 -1L
+#define M_ONCE                                        3L
+#define M_SINGLE_FRAME                                1L
+
+#define M_TIMER0                                      0L
+#define M_TIMER1                                      1L
+#define M_TIMER2                                      2L
+#define M_TIMER3                                      3L
+#define M_TIMER4                                      4L
+#define M_TIMER5                                      5L
+#define M_TIMER6                                      6L
+#define M_TIMER7                                      7L
+#define M_TIMER8                                      8L
+#define M_TIMER9                                      9L
+#define M_TIMER10                                     10L
+#define M_TIMER11                                     11L
+#define M_TIMER12                                     12L
+#define M_TIMER13                                     13L
+#define M_TIMER14                                     14L
+#define M_TIMER15                                     15L
+#define M_TIMER16                                     16L
+#define M_TIMER60                                     60L
+#define M_TIMER99                                     99L
+
+#define M_TIMER_IO                                    M_TIMER2
+#define M_TIMER_DEFAULT                               M_TIMER99
+
+#define M_TIMER_STROBE                                M_TIMER60
+
+#define M_LOW                                         1L
+#define M_HIGH                                        3L
+
+#define M_FOLLOW_TIMER_CLOCK                         -3L
+
+#define M_ARM_CONTINUOUS                              9L
+#define M_ARM_MONOSHOT                                10L
+#define M_ARM_RESET                                   11L
+#define M_EDGE_RISING                                 12L
+#define M_EDGE_FALLING                                13L
+#define M_LEVEL_LOW                                   14L
+#define M_LEVEL_HIGH                                  15L
+#define M_HARDWARE_PORT0                              16L
+#define M_HARDWARE_PORT1                              17L
+#define M_HARDWARE_PORT_CAMERA                        18L
+#define M_START_EXPOSURE                              19L
+#define M_SOFTWARE                                    0x010000L
+#define M_SOFTWARE1                                   (M_SOFTWARE+1)
+#define M_SOFTWARE2                                   (M_SOFTWARE+2)
+#define M_SOFTWARE3                                   (M_SOFTWARE+3)
+#define M_SOFTWARE4                                   (M_SOFTWARE+4)
+#define M_USER_DEFINED                                21L
+#define M_HSYNC                                       22L
+#define M_VSYNC                                       23L
+#define M_HARDWARE_PORT2                              24L
+#define M_HARDWARE_PORT3                              25L
+#define M_SYSCLK                                      26L
+#define M_PIXCLK                                      27L
+#define M_URGENT                                      28L
+#define M_NOW                                         29L
+#define M_FRAME                                       30L
+#define M_HARDWARE_PORT4                              31L
+#define M_HARDWARE_PORT5                              32L
+#define M_HARDWARE_PORT6                              33L
+#define M_HARDWARE_PORT7                              34L
+#define M_HARDWARE_PORT8                              35L
+#define M_HARDWARE_PORT9                              36L
+#define M_HARDWARE_PORT10                             37L
+#define M_HARDWARE_PORT11                             38L
+#define M_HARDWARE_PORT12                             39L
+#define M_HARDWARE_PORT13                             40L
+#define M_HARDWARE_PORT14                             41L
+#define M_HARDWARE_PORT15                             42L
+#define M_USER_BIT_CC_A                               43L
+#define M_USER_BIT_CC_B                               44L
+#define M_CC_OUTPUT_A                                 M_USER_BIT_CC_A
+#define M_CC_OUTPUT_B                                 M_USER_BIT_CC_B
+
+#define M_ANY_EDGE                                    50L
+
+#define M_LEVEL_LOW_END_WHEN_INACTIVE                 63L
+#define M_LEVEL_HIGH_END_WHEN_INACTIVE                64L
+#define M_PULSE_GENERATION                            65L
+#define M_PULSE_MEASUREMENT                           66L
+#define M_PERIOD_MEASUREMENT                          67L
+#define M_HARDWARE_PORT16                             68L
+#define M_HARDWARE_PORT17                             69L
+#define M_HARDWARE_PORT18                             70L
+#define M_HARDWARE_PORT19                             71L
+#define M_HARDWARE_PORT20                             72L
+#define M_HARDWARE_PORT21                             73L
+#define M_HARDWARE_PORT22                             74L
+#define M_HARDWARE_PORT23                             75L
+#define M_HARDWARE_PORT24                             76L
+#define M_HARDWARE_PORT25                             77L
+#define M_HARDWARE_PORT26                             78L
+#define M_HARDWARE_PORT27                             79L
+#define M_HARDWARE_PORT28                             80L
+#define M_HARDWARE_PORT29                             81L
+#define M_HARDWARE_PORT30                             82L
+#define M_HARDWARE_PORT31                             83L
+
+#define M_INTERNAL_SYNC                               84L
+
+// Defines for MsysIoCommand functions 
+#define M_CLOCK                                       85L
+#define M_PULSE_HIGH                                  86L
+#define M_PULSE_LOW                                   87L
+#define M_IMPULSE                                     88L
+#define M_AUTO_REGISTER                               0x10000000
+#define M_AUTO_REGISTER_CANCEL                        0x20000000
+
+#define M_EXPOSURE                                    90L
+#define M_GRAB_TRIGGER_READY                          91L
+
+#define M_CONTROL                                     0x20L
+#define M_STREAMING                                   0x40L
+
+// Timer trigger activation combination values
+#define M_AND_ARM_ACTIVATION                          0x01000000
+#define M_OR_ARM_ACTIVATION                           0x02000000
+#define M_XOR_ARM_ACTIVATION                          0x03000000
+
+// M_TIMER_TRIGGER_OVERLAP or M_GRAB_TRIGGER_OVERLAP
+#define M_OFF                                           0L
+#define M_RESET                                         9L   //Also defined in mildisplay.h
+#define M_PREVIOUS_FRAME                              101L
+#define M_PREVIOUS_LINE                               102L
+#define M_READ_OUT                                    103L
+#define M_READ_OUT_NO_LATCH                           104L
+#define M_LATCH                                    0x2000L
+
+//Rotary encoder values
+#define M_POSITION_TRIGGER                            200L
+#define M_STEP_ANY                                    201L
+#define M_STEP_FORWARD                                202L
+#define M_STEP_BACKWARD                               203L
+#define M_STEP_ANY_WHILE_POSITIVE                     204L
+#define M_STEP_FORWARD_WHILE_POSITIVE                 205L
+#define M_STEP_BACKWARD_WHILE_POSITIVE                206L
+#define M_STEP_ANY_WHILE_NEGATIVE                     207L
+#define M_STEP_FORWARD_WHILE_NEGATIVE                 208L
+#define M_STEP_BACKWARD_WHILE_NEGATIVE                209L
+#define M_COUNTER_OVERFLOW                            210L
+#define M_STEP_FORWARD_NEW_POSITIVE                   211L
+#define M_POSITION_TRIGGER_MULTIPLE                   212L
+#define M_POSITION_START_TRIGGER                      213L
+
+#define M_ROTARY_ENCODER                              0x700L
+#define M_ROTARY_ENCODER1                             (M_ROTARY_ENCODER +M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER2                             (M_ROTARY_ENCODER1+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER3                             (M_ROTARY_ENCODER2+M_ROTARY_MAX_OUTPUT)
+#define M_ROTARY_ENCODER4                             (M_ROTARY_ENCODER3+M_ROTARY_MAX_OUTPUT)
+
+// Additions to M_ROTARY_ENCODERn and M_ROTARY_ENCODER_OUTPUT_MODE
+#define M_FPGA_STREAM_OUTPUT_BIT                      0x20000000
+#define M_OUTPUT0                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000000)
+#define M_OUTPUT1                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000001)
+#define M_OUTPUT2                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000002)
+#define M_OUTPUT3                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000003)
+#define M_OUTPUT4                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000004)
+#define M_OUTPUT5                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000005)
+#define M_OUTPUT6                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000006)
+#define M_OUTPUT7                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000007)
+#define M_OUTPUT8                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000008)
+#define M_OUTPUT9                                     (M_FPGA_STREAM_OUTPUT_BIT | 0x00000009)
+
+// M_GC_CONTROL_PROTOCOL_CAPABILITY  values
+#define M_GC_USER_DEFINED_NAME_SUPPORT                0x80000000L
+#define M_GC_SERIAL_NUMBER_SUPPORT                    0x40000000L
+#define M_GC_HEARTBEAT_DISABLE_SUPPORT                0x20000000L
+#define M_GC_LINK_SPEED_REGISTER_SUPPORT              0x10000000L
+#define M_GC_PORT_AND_IP_REGISTER_SUPPORT             0x08000000L
+#define M_GC_MANIFEST_TABLE_SUPPORT                   0x04000000L
+#define M_GC_TEST_DATA_SUPPORT                        0x02000000L
+#define M_GC_DISCOVERY_ACK_DELAY_SUPPORT              0x01000000L
+#define M_GC_WRITABLE_DISCOVERY_ACK_DELAY_SUPPORT     0x00800000L
+#define M_GC_EXTENDED_STATUS_CODES_1_SUPPORT          0x00400000L
+#define M_GC_PRIMARY_APP_SWITCHOVER_SUPPORT           0x00200000L
+#define M_GC_UNCONDITIONAL_ACTION_SUPPORT             0x00100000L
+#define M_GC_IEEE_1588_SUPPORT                        0x00080000L
+#define M_GC_EXTENDED_STATUS_CODES_2_SUPPORT          0x00040000L
+#define M_GC_SCHEDULED_ACTION_SUPPORT                 0x00020000L
+#define M_GC_ACTION_SUPPORT                           0x00000040L
+#define M_GC_PENDING_ACK_SUPPORT                      0x00000020L
+#define M_GC_EVENT_DATA_SUPPORT                       0x00000010L
+#define M_GC_EVENT_SUPPORT                            0x00000008L
+#define M_GC_PACKET_RESEND_SUPPORT                    0x00000004L
+#define M_GC_WRITE_MEM_SUPPORT                        0x00000002L
+#define M_GC_CONCATENATION_SUPPORT                    0x00000001L
+
+// M_GC_STREAM_PROTOCOL_CAPABILITY values
+#define M_GC_FIREWALL_TRAVERSAL_SUPPORT               0x80000000L
+#define M_GC_LEGACY_16BIT_BLOCK_SUPPORT               0x40000000L
+
+// M_GC_MESSAGE_PROTOCOL_CAPABILITY values
+#define M_GC_FIREWALL_TRAVERSAL_SUPPORT               0x80000000L
+
+// M_GC_NETWORK_INTERFACE_CONFIGURATION and
+// M_GC_NETWORK_INTERFACE_CAPABILITY values
+#define M_GC_PAUSE_RECEPTION_SUPPORT                  0x80000000L
+#define M_GC_PAUSE_GENERATION_SUPPORT                 0x40000000L
+#define M_GC_LINK_LOCAL_ADDRESS_SUPPORT               0x00000004L
+#define M_GC_DHCP_SUPPORT                             0x00000002L
+#define M_GC_PERSISTENT_IP_SUPPORT                    0x00000001L
+
+// M_GC_PHYSICAL_LINK_CONFIGURATION_CAPABILITY values
+#define M_GC_SINGLE_LINK_SUPPORT                      0x00000001L
+#define M_GC_MULTIPLE_LINK_SUPPORT                    0x00000002L
+#define M_GC_STATIC_LINK_AGGREGATION_SUPPORT          0x00000004L
+#define M_GC_DYNAMIC_LINK_AGGREGATION_SUPPORT         0x00000008L
+
+// M_GC_STREAM_CHANNEL_CAPABILITY values
+#define M_GC_BIG_AND_LITTLE_ENDIAN_SUPPORT            0x80000000L
+#define M_GC_IP_REASSEMBLY_SUPPORT                    0x40000000L
+#define M_GC_MULTI_ZONE_SUPPORT                       0x00000010L
+#define M_GC_PACKET_RESEND_OPTION_SUPPORT             0x00000008L
+#define M_GC_ALL_IN_SUPPORT                           0x00000004L
+#define M_GC_UNCONDITIONAL_STREAMING_SUPPORT          0x00000002L
+#define M_GC_EXTENDED_CHUNK_DATA_SUPPORT              0x00000001L
+
+// M_GC_IEEE_1588_STATUS values
+#define M_GC_IEEE_1588_STATUS_INITIALIZING            0L
+#define M_GC_IEEE_1588_STATUS_FAULTY                  1L
+#define M_GC_IEEE_1588_STATUS_DISABLED                2L
+#define M_GC_IEEE_1588_STATUS_LISTENING               3L
+#define M_GC_IEEE_1588_STATUS_PREMASTER               4L
+#define M_GC_IEEE_1588_STATUS_MASTER                  5L
+#define M_GC_IEEE_1588_STATUS_PASSIVE                 6L
+#define M_GC_IEEE_1588_STATUS_UNCALIBRATED            7L
+#define M_GC_IEEE_1588_STATUS_SLAVE                   8L
+
+// M_GC_IEEE_1588_CLOCK_ACCURACY values
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_25NS        0x20L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_100NS       0x21L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_250NS       0x22L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_1US         0x23L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_2_5US       0x24L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_10US        0x25L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_25US        0x26L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_100US       0x27L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_250US       0x28L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_1MS         0x29L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_2_5MS       0x2AL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_10MS        0x2BL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_25MS        0x2CL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_100MS       0x2DL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_250MS       0x2EL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_1S          0x2FL
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_WITHIN_10S         0x30L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_GREATER_10S        0x31L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_ALTERNATE_PROFILE  0x80L
+#define M_GC_IEEE_1588_CLOCK_ACCURACY_UNKNOWN            0xFEL
+
+#if OldDefinesSupport
+MIL_DEPRECATED(M_HARDWARE_PORT0, 1000)     // New IO API Replaced by M_AUX_IO0
+MIL_DEPRECATED(M_HARDWARE_PORT1, 1000)     // New IO API Replaced by M_AUX_IO1
+MIL_DEPRECATED(M_HARDWARE_PORT2, 1000)     // New IO API Replaced by M_AUX_IO2
+MIL_DEPRECATED(M_HARDWARE_PORT3, 1000)     // New IO API Replaced by M_AUX_IO3
+MIL_DEPRECATED(M_HARDWARE_PORT4, 1000)     // New IO API Replaced by M_AUX_IO4
+MIL_DEPRECATED(M_HARDWARE_PORT5, 1000)     // New IO API Replaced by M_AUX_IO5
+MIL_DEPRECATED(M_HARDWARE_PORT6, 1000)     // New IO API Replaced by M_AUX_IO6
+MIL_DEPRECATED(M_HARDWARE_PORT7, 1000)     // New IO API Replaced by M_AUX_IO7
+MIL_DEPRECATED(M_HARDWARE_PORT8, 1000)     // New IO API Replaced by M_AUX_IO8
+MIL_DEPRECATED(M_HARDWARE_PORT9, 1000)     // New IO API Replaced by M_AUX_IO9
+MIL_DEPRECATED(M_HARDWARE_PORT10, 1000)     // New IO API Replaced by M_AUX_IO10
+MIL_DEPRECATED(M_HARDWARE_PORT11, 1000)     // New IO API Replaced by M_AUX_IO11
+MIL_DEPRECATED(M_HARDWARE_PORT12, 1000)     // New IO API Replaced by M_AUX_IO12
+MIL_DEPRECATED(M_HARDWARE_PORT13, 1000)     // New IO API Replaced by M_AUX_IO13
+MIL_DEPRECATED(M_HARDWARE_PORT14, 1000)     // New IO API Replaced by M_AUX_IO14
+MIL_DEPRECATED(M_HARDWARE_PORT15, 1000)     // New IO API Replaced by M_AUX_IO15
+MIL_DEPRECATED(M_HARDWARE_PORT16, 1000)     // New IO API Replaced by M_AUX_IO16
+MIL_DEPRECATED(M_HARDWARE_PORT17, 1000)     // New IO API Replaced by M_AUX_IO17
+MIL_DEPRECATED(M_HARDWARE_PORT18, 1000)     // New IO API Replaced by M_AUX_IO18
+MIL_DEPRECATED(M_HARDWARE_PORT19, 1000)     // New IO API Replaced by M_AUX_IO19
+MIL_DEPRECATED(M_HARDWARE_PORT20, 1000)     // New IO API Replaced by M_AUX_IO20
+MIL_DEPRECATED(M_HARDWARE_PORT21, 1000)     // New IO API Replaced by M_AUX_IO21
+MIL_DEPRECATED(M_HARDWARE_PORT22, 1000)     // New IO API Replaced by M_AUX_IO22
+MIL_DEPRECATED(M_HARDWARE_PORT23, 1000)     // New IO API Replaced by M_AUX_IO23
+MIL_DEPRECATED(M_HARDWARE_PORT24, 1000)     // New IO API Replaced by M_AUX_IO24
+MIL_DEPRECATED(M_HARDWARE_PORT25, 1000)     // New IO API Replaced by M_AUX_IO25
+MIL_DEPRECATED(M_HARDWARE_PORT26, 1000)     // New IO API Replaced by M_AUX_IO26
+MIL_DEPRECATED(M_HARDWARE_PORT27, 1000)     // New IO API Replaced by M_AUX_IO27
+MIL_DEPRECATED(M_HARDWARE_PORT28, 1000)     // New IO API Replaced by M_AUX_IO28
+MIL_DEPRECATED(M_HARDWARE_PORT29, 1000)     // New IO API Replaced by M_AUX_IO29
+MIL_DEPRECATED(M_HARDWARE_PORT30, 1000)     // New IO API Replaced by M_AUX_IO30
+MIL_DEPRECATED(M_HARDWARE_PORT31, 1000)     // New IO API Replaced by M_AUX_IO31
+#endif
+
+
+#define M_LOCAL_ENGINE                                200L
+
+#define M_ABSOLUTE_MODE                               0x00000800
+#define M_RELATIVE_MODE                               0x00002000
+#define M_LEGACY_MODE                                 0x00000000
+
+#define M_FILL_DESTINATION                            -1
+
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+
+#define M_ASYNCHRONOUS_QUEUED                         3L
+
+#define M_LUT_PALETTE0                                0L
+#define M_LUT_PALETTE1                                1L
+#define M_LUT_PALETTE2                                2L
+#define M_LUT_PALETTE3                                3L
+#define M_LUT_PALETTE4                                4L
+#define M_LUT_PALETTE5                                5L
+#define M_LUT_PALETTE6                                6L
+#define M_LUT_PALETTE7                                7L
+
+#define M_GAIN0                                       0x00010000L
+#define M_GAIN1                                       (M_GAIN0 + 1)
+#define M_GAIN2                                       (M_GAIN0 + 2)
+#define M_GAIN3                                       (M_GAIN0 + 3)
+#define M_GAIN4                                       (M_GAIN0 + 4)
+#define M_GAIN5                                       (M_GAIN0 + 5)
+#define M_GAIN6                                       (M_GAIN0 + 6)
+#define M_GAIN7                                       (M_GAIN0 + 7)
+#define M_GAIN8                                       (M_GAIN0 + 8)
+#define M_GAIN9                                       (M_GAIN0 + 9)
+#define M_GAIN10                                      (M_GAIN0 + 10)
+
+#define M_OPTO                                        0L
+#define M_TTL                                         1L
+#define M_LVDS                                        2L
+#define M_TRI_STATE                                   3L
+#define M_NO_CONNECT                                  4L
+#define M_OPEN_DRAIN                                  5L
+#define M_RS422                                       6L
+#define M_CURRENT_SOURCE                              7L
+
+#define M_ENABLE                                      -9997L
+#define M_FINAL_GRAB                                  -9998L
+#define M_DISABLE                                     -9999L
+
+// M_DECODER_MODE
+#define M_ADV7183                                     1L
+#define M_ADV7184                                     2L
+
+
+// M_CAMERA_LOCK
+#define M_ENABLE                                      -9997L
+#define M_FAST                                   0x00002000L
+
+// Uart parity values
+#define M_ODD                                         1L
+#define M_EVEN                                        2L
+
+#define M_RS232                                       1L
+#define M_RS485                                       2L
+
+#define M_CALCULATE                                   1L
+
+// M_GRAB_ABORT
+#define M_IMMEDIATE                                  10L
+#define M_NEXT_FRAMES                                11L
+
+// M_GRAB_ERROR_STATUS
+#define M_PIXEL_ERROR                                 1L
+#define M_HSYNC_ERROR                                 2L
+#define M_VSYNC_ERROR                                 4L
+
+// M_AUDIO_ENCODING_FORMAT
+#define M_AUDIO_RAW_16                                1L
+#define M_AUDIO_ADPCM                                 2L
+#define M_AUDIO_MULAW                                 3L
+#define M_AUDIO_ALAW                                  4L
+
+// M_AUDIO_CHANNEL_MODE
+#define M_AUDIO_MONO                                  1L
+#define M_AUDIO_STEREO                                2L
+
+#define M_AUTOMATIC                                   0x00020000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_MANUAL                                      1L
+
+// M_INPUT_FILTER
+#define M_BYPASS                                      0L
+#define M_LOW_PASS_0                                  1L
+#define M_LOW_PASS_1                                  2L
+#define M_LOW_PASS_2                                  3L
+
+/* custom defines for IrisGT Dual */
+// M_CUSTOM_FPGA_PROCESSING_MAX_SELECTOR
+#define M_CUSTOM_FPGA_COLUMN                          1L
+#define M_CUSTOM_FPGA_ROW                             2L
+
+// Fixed Pattern Noise correction (FPN)
+#define M_SENSOR                                      1L
+#define M_PREPROCESSING                               2L
+
+// Exposure mode
+#define M_TIMED                                       0L
+#define M_TRIGGER_WIDTH                               1L
+
+// CXP test mode
+#define M_OFF                                         0L
+#define M_MODE1                                       1L
+
+// CXP Connection speed
+#define M_LOW_SPEED_21                                0x8L
+#define M_LOW_SPEED_42                                0x10L
+#define M_CXP1                                        0x28L
+#define M_CXP2                                        0x30L
+#define M_CXP3                                        0x38L
+#define M_CXP5                                        0x40L
+#define M_CXP6                                        0x48L
+#define M_CXP10                                       0x50L
+#define M_CXP12                                       0x58L
+
+#define M_DETECTED                                    0x100L
+#define M_UNDETECTED                                  0x200L
+
+/************************************************************************/
+/* MdigControl(): Used as connection selection                          */
+/************************************************************************/
+#define M_CONNECTION                               0L
+#define M_CONNECTION0                              M_CONNECTION
+#define M_CONNECTION1                              (M_CONNECTION+1)
+#define M_CONNECTION2                              (M_CONNECTION+2)
+#define M_CONNECTION3                              (M_CONNECTION+3)
+#define M_CONNECTION4                              (M_CONNECTION+4)
+#define M_CONNECTION5                              (M_CONNECTION+5)
+#define M_CONNECTION6                              (M_CONNECTION+6)
+#define M_CONNECTION7                              (M_CONNECTION+7)
+#define M_CONNECTION8                              (M_CONNECTION+8)
+#define M_CONNECTION9                              (M_CONNECTION+9)
+#define M_CONNECTION10                             (M_CONNECTION+10)
+#define M_CONNECTION11                             (M_CONNECTION+11)
+#define M_CONNECTION12                             (M_CONNECTION+12)
+#define M_CONNECTION13                             (M_CONNECTION+13)
+#define M_CONNECTION14                             (M_CONNECTION+14)
+#define M_CONNECTION15                             (M_CONNECTION+15)
+
+/************************************************************************/
+/* MdigControl(): Type of dialog for M_GENICAM_INTERACTIVE              */
+/************************************************************************/
+#define M_GENICAM_INTERACTIVE_MODAL_DIALOG           15L
+#define M_GENICAM_INTERACTIVE_MODELESS_DIALOG        16L
+
+
+/************************************************************************/
+/* MdigChannel()                                                        */
+/************************************************************************/
+#define M_DEFAULT                                     0x10000000L
+#define M_CH0                                         0x40000000L
+#define M_CH1                                         0x20000000L
+#define M_CH2                                         0x08000000L
+#define M_CH3                                         0x01000000L
+#define M_CH4                                         0x02000000L
+#define M_CH5                                         0x04000000L
+#define M_CH6                                         0x00800000L
+#define M_CH7                                         0x00400000L
+#define M_CH8                                         0x00200000L
+#define M_CH9                                         0x00100000L
+#define M_CH10                                        0x00080000L
+#define M_CH11                                        0x00040000L
+#define M_CH12                                        0x00020000L
+#define M_CH13                                        0x00010000L
+#define M_CH14                                        0x00008000L
+#define M_CH15                                        0x00004000L
+#define M_AUTOMATIC                                   0x00020000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_VOLTAGE                                     0x00010000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_SYNC                                        0x00002000L
+#define M_SIGNAL                                      0x00001000L
+#define M_AC                                          0x00000004L
+#define M_DC                                          0x00000002L
+#define M_CHANNEL_COLOR                               0x00000001L
+#define M_RGB                                         8L
+#define M_YC                                          9L
+#define M_ALL_CHANNEL                                 (M_CH0|M_CH1|M_CH2|M_CH3|M_CH4|M_CH5|M_CH6|M_CH7|M_CH8|M_CH9|M_CH10|M_CH11|M_CH12|M_CH13|M_CH14|M_CH15)
+#define M_ALL_CHANNELS                                M_ALL_CHANNEL
+
+
+/************************************************************************/
+/* MdigReference()                                                      */
+/************************************************************************/
+#define M_BLACK                                       0L
+#define M_WHITE                                       1L
+#define M_STEREO                                      0L
+#define M_MONO                                        1L
+
+/* See the Inquire for the M_CHx values */
+#define M_CH0_REF                                     M_CH0
+#define M_CH1_REF                                     M_CH1
+#define M_CH2_REF                                     M_CH2
+#define M_CH3_REF                                     M_CH3
+#define M_CH4_REF                                     M_CH4
+#define M_CH5_REF                                     M_CH5
+#define M_CH6_REF                                     M_CH6
+#define M_CH7_REF                                     M_CH7
+#define M_ALL_REF                                     (M_CH0_REF | M_CH1_REF | M_CH2_REF | M_CH3_REF | M_CH4_REF | M_CH5_REF | M_CH6_REF | M_CH7_REF)
+#define M_VOLTAGE                                     0x00010000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_AUTOMATIC                                   0x00020000L //Must be bitwise with M_CH0_REF-M_CH7_REF AND M_BLACK_REF AND M_WHITE_REF
+#define M_MIN_LEVEL                                   0L
+#define M_MAX_LEVEL                                   255L
+
+// MdigControl/MdigReference/MdigInquire with M_GRAB_INPUT_GAIN or M_BLACK_REF
+#define M_TAP1                                        M_CH0
+#define M_TAP2                                        M_CH1
+
+/************************************************************************/
+/* MdigFocus()                                                          */
+/************************************************************************/
+#define M_NO_FILTER        0x00080000L
+#define M_NO_SUBSAMPLING   0x00100000L
+#define M_SMART_SCAN       0x00200000L
+#define M_SCAN_ALL         0x00400000L
+#define M_BISECTION        0x00800000L
+#define M_REFOCUS          0x01000000L
+#define M_EVALUATE         0x02000000L
+#define M_CHANGE           0x00000063L
+#define M_ON_FOCUS         0x00000064L
+#define M_STOP_FOCUS       0x00000002L
+
+/************************************************************************/
+/* MdigGrabWait()                                                       */
+/************************************************************************/
+#define M_GRAB_NEXT_FRAME                             1L
+#define M_GRAB_NEXT_FIELD                             2L
+#define M_GRAB_END                                    3L
+#define M_GRAB_READY                                  45L
+
+
+/************************************************************************/
+/* MdigHookFunction()                                                   */
+/************************************************************************/
+#define M_BOARD_HOOK                                  0
+#define M_CAMERA_HOOK                                 0
+#define M_UNHOOK                                      0x04000000L
+#define M_GC_EVENT                                    0x00400000L
+
+#define M_GRAB_END                                    3L
+#define M_GRAB_START                                  4L
+#define M_GRAB_FRAME_END                              5L
+#define M_GRAB_FIELD_END_ODD                          6L
+#define M_GRAB_FIELD_END_EVEN                         7L
+#define M_GRAB_FIELD_END                              8L
+#define M_FRAME_START                                 9L
+#define M_FIELD_START                                 20L
+#define M_FIELD_START_ODD                             21L
+#define M_FIELD_START_EVEN                            22L
+#define M_GRAB_FRAME_START                            13L
+#define M_GRAB_FIELD_START                            14L
+#define M_GRAB_FIELD_START_ODD                        15L
+#define M_GRAB_FIELD_START_EVEN                       16L
+#define M_UART_DATA_RECEIVED                          17L
+#define M_ROTARY_ENCODER                              0x700L
+#define M_GRAB_LINE                                   0x00100000L
+#define M_GRAB_LINE_END                               0x00200000L
+#define M_DCF_REALLOC                                 0x00000020L
+#define M_CAMERA_LOCK                                 5300L
+#define M_CAMERA_PRESENT                              5315L
+#define M_FEATURE_CHANGE                              26L
+
+#define M_GRAB_EXPOSURE_START                         100L
+#define M_EXPOSURE_START                              M_GRAB_EXPOSURE_START
+/* Reserve next 100 values                     from   101L*/
+/*                                             to     199L*/
+#define M_GRAB_EXPOSURE_END                           200L
+#define M_EXPOSURE_END                                M_GRAB_EXPOSURE_END
+/* Reserve next 100 values                     from   201L*/
+/*                                             to     299L*/
+
+/************************  Values that can be added to M_GC_EVENT*/
+#define M_ACQUISITION_TRIGGER                         0x00000011L
+#define M_ACQUISITION_START                           0x00000012L
+#define M_ACQUISITION_END                             0x00000013L
+#define M_ACQUISITION_TRANSFER_START                  0x00000014L
+#define M_ACQUISITION_TRANSFER_END                    0x00000015L
+#define M_ACQUISITION_ERROR                           0x00008010L
+#define M_FRAME_TRIGGER                               0x00000002L
+//#define M_FRAME_START                               0x00000009L
+#define M_FRAME_END                                   0x0000000aL
+#define M_FRAME_TRANSFER_START                        0x00000005L
+#define M_FRAME_TRANSFER_END                          0x00000006L
+//#define M_EXPOSURE_START                            0x0000001aL //26L
+//#define M_EXPOSURE_END                              0x00000023L //35L
+
+/**  Counter/timer indices that are added should start from one!*/
+#define M_GC_NUMBERED_EVENTS_MASK                     0x000000FFL
+#define M_GC_IS_NUMBERED_EVENT(a)                     (a&(M_COUNTER_START|M_COUNTER_END|M_TIMER_START|M_TIMER_ACTIVE|M_TIMER_END|M_LINE_RISING_EDGE|M_LINE_FALLING_EDGE|M_LINE_ANY_EDGE))
+#define M_COUNTER_START                               0x00000100L
+#define M_COUNTER_END                                 0x00000200L
+#define M_TIMER_START                                 0x00000300L
+#define M_TIMER_END                                   0x00000400L
+#define M_TIMER_ACTIVE                                0x00000800L
+
+/************************************   Line numbers are 0 or 1-based*/
+#define M_LINE_RISING_EDGE                            0x00000500L
+#define M_LINE_FALLING_EDGE                           0x00000600L
+#define M_LINE_ANY_EDGE                               0x00000700L
+
+/********************************************  Error event types*/
+//#define M_ERROR                                     0x40000000L
+#define M_ERROR_NOT_IMPLEMENTED                       0x00008001L
+#define M_ERROR_INVALID_PARAMETER                     0x00008002L
+#define M_ERROR_INVALID_ADDRESS                       0x00008003L
+#define M_ERROR_WRITE_PROTECTED                       0x00008004L
+#define M_ERROR_BAD_ALIGNMENT                         0x00008005L
+#define M_ERROR_ACCESS_DENIED                         0x00008006L
+#define M_ERROR_BUSY                                  0x00008007L
+#define M_ERROR_LOCAL_PROBLEM                         0x00008008L
+#define M_ERROR_MSG_MISMATCH                          0x00008009L
+#define M_ERROR_INVALID_PROTOCOL                      0x0000800AL
+#define M_ERROR_NO_MSG                                0x0000800BL
+#define M_ERROR_PACKET_UNAVAILABLE                    0x0000800CL
+#define M_ERROR_DATA_OVERRUN                          0x0000800DL
+#define M_ERROR_INVALID_HEADER                        0x0000800EL
+#define M_ERROR_WRONG_CONFIG                          0x0000800FL
+#define M_ERROR_PACKET_NOT_YET_AVAILABLE              0x00008010L
+#define M_ERROR_PACKET_AND_PREV_REMOVED_FROM_MEMORY   0x00008011L
+#define M_ERROR_PACKET_REMOVED_FROM_MEMORY            0x00008012L
+
+#define M_ERROR_GENERIC_ERROR                         0x00008FFFL
+
+#define M_DEVICE_SPECIFIC_EVENT                       0x00009000L
+
+/************************************************************************/
+/* MdigProcess()                                                        */
+/************************************************************************/
+
+#define M_DIG_PRCSS_COUNT_SHIFT                       0x00000005L
+#define M_DIG_PRCSS_COUNT_MASK                        0xFFFFFFE0L
+
+/* Operation bitwise parameters */
+#define M_WAIT                                        1L
+#define M_START                                       0x00000002L
+#define M_STOP                                        0x00000004L
+#define M_SEQUENCE                                    0x00000008L
+#define M_COUNT(n)                                    ((MIL_UINT32)(n << M_DIG_PRCSS_COUNT_SHIFT))
+#define M_FRAMES_PER_TRIGGER(n)                       M_COUNT(n)
+
+/* OperationFlag bitwise parameters */
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+#define M_CALIBRATION_PROPAGATE_ONCE                  0x00000000L
+#define M_CALIBRATION_PROPAGATE_AT_EACH_FRAME         0x00000004L
+#define M_CALIBRATION_PROPAGATE_OFF                   0x00000008L
+#define M_TRIGGER_FOR_FIRST_GRAB                      0x00000010L
+#define M_REGION_KEEP                                 0x00000000L
+#define M_REGION_DELETE_AT_EACH_FRAME                 0x00000020L
+
+/************************************************************************/
+/* MdigGetHookInfo()                                                    */
+/************************************************************************/
+#define M_ASYNC_HOOK                                  0x08000000L
+#define M_MODIFIED_BUFFER                             0x40000000L
+
+#define M_BUFFER_ID                                   0x00160000L
+#define M_REGION_OFFSET_X                             0x00410000L
+#define M_REGION_OFFSET_Y                             0x00420000L
+#define M_REGION_SIZE_X                               0x00430000L
+#define M_REGION_SIZE_Y                               0x00480000L
+#define M_BUFFER_INDEX                                0x001B0000L
+#define M_DIGITIZER_ID                                0x001C0000L
+#define M_DRIVER_HOOK_CONTEXT_PTR                     0x001D0000L
+#define M_GRAB_LINE                                   0x00100000L
+#define M_GRAB_LINE_END                               0x00200000L
+#define M_GC_CAMERA_TIME_STAMP                        0x00400000L
+#define M_GC_EVENT_DATA                               0x00800000L
+#define M_GC_EVENT_TYPE                               0x00810000L
+#define M_GC_EVENT_DATA_SIZE                          0x00820000L
+#define M_GRAB_TIME_STAMP                             0x00000040L //64L
+#define M_TIME_STAMP                                  M_GRAB_TIME_STAMP
+#define M_SOURCE_FRAME_INDEX                          1082L 
+#define M_GRAB_LINE_COUNTER                           0x0000111B //4379L
+#define M_GRAB_FRAME_BURST_COUNT                      4386L
+#define M_GRAB_FRAME_BURST_END_SOURCE                 4387L
+#define M_USER_DATA_PTR                               0x00000001
+#define M_CORRUPT                                     0x01000000L
+#define M_COUNTER_INDEX                               0x00830000L
+#define M_TIMER_INDEX                                 0x00840000L
+#define M_LINE_INDEX                                  0x00850000L
+#define M_ROTARY_ENCODER_INDEX                        0x00860000L
+#define M_GC_FEATURE_CHANGE_NAME                      (0x00870000L|M_CLIENT_ENCODING)
+#if OldDefinesSupport
+#define M_GC_FEATURE_CHANGE_NAME_SIZE                 (M_STRING_SIZE + M_GC_FEATURE_CHANGE_NAME)
+MIL_DEPRECATED(M_GC_FEATURE_CHANGE_NAME_SIZE, 1040)
+#endif
+#define M_GC_XML_TYPE                                 0x00880000L
+#define M_IO_INTERRUPT_SOURCE                         0x0008A000L
+#define M_USER_BIT                                    MAKE_INT64(0x00000000A0000000)
+
+
+/************************************************************************/
+/* MdigInquireFeature() / MdigControlFeature ControlFlag                */
+/************************************************************************/
+#define M_DEFAULT                                                        0x10000000L
+
+// For reading feature properties
+#define M_FEATURE_INDEX_MASK                          MAKE_INT64(0x000000000000FFFF)
+#define M_FEATURE_PROPERTY_MASK                       MAKE_INT64(0x0000000000FF0000)
+#define M_FEATURE_NAME                                MAKE_INT64(0x0000000000020000)
+#define M_FEATURE_DISPLAY_NAME                        MAKE_INT64(0x0000000000030000)
+#define M_FEATURE_TYPE                                MAKE_INT64(0x0000000000040000)
+#define M_FEATURE_TOOLTIP                             MAKE_INT64(0x0000000000050000)
+#define M_FEATURE_DESCRIPTION                         MAKE_INT64(0x0000000000060000)
+#define M_FEATURE_ACCESS_MODE                         MAKE_INT64(0x0000000000070000)
+#define M_FEATURE_VISIBILITY                          MAKE_INT64(0x0000000000080000)
+#define M_FEATURE_CACHING_MODE                        MAKE_INT64(0x0000000000090000)
+#define M_FEATURE_STREAMABLE                          MAKE_INT64(0x00000000000A0000)
+#define M_FEATURE_DEPRECATED                          MAKE_INT64(0x00000000000B0000)
+#define M_FEATURE_REPRESENTATION                      MAKE_INT64(0x00000000000C0000)
+#define M_FEATURE_PRESENT                             MAKE_INT64(0x00000000000D0000)
+#define M_FEATURE_CHANGE_HOOK                         MAKE_INT64(0x00000000000E0000)
+#define M_FEATURE_POLLING_INTERVAL                    MAKE_INT64(0x00000000000F0000)
+#define M_FEATURE_UNIT                                MAKE_INT64(0x0000000000100000)
+
+// For reading/writing feature values
+#define M_FEATURE_VALUE                               MAKE_INT64(0x0000000000FA0000)
+#if OldDefinesSupport
+#define M_FEATURE_VALUE_AS_STRING                     MAKE_INT64(0x0000000000FB0000)
+#define M_FEATURE_VALUE_AS_STRING_INTERNAL            MAKE_INT64(0x0000000000FB0000)
+MIL_DEPRECATED(M_FEATURE_VALUE_AS_STRING, 1060)      // New Control Feature API Replaced by M_FEATURE_VALUE and M_TYPE_STRING as UserVarType, UserVarPtr must be an array to a MIL_TEXT_CHAR
+#endif
+#define M_FEATURE_EXECUTE                             MAKE_INT64(0x0000000000FC0000)
+#define M_FEATURE_MIN                                 MAKE_INT64(0x0000000000FD0000)
+#define M_FEATURE_MAX                                 MAKE_INT64(0x0000000000FE0000)
+#define M_FEATURE_INCREMENT                           MAKE_INT64(0x0000000000FF0000)
+#define M_FEATURE_EXECUTE_COMPLETED                   MAKE_INT64(0x0000000000FC0000)
+
+#define M_FEATURE_SIZE                               (MAKE_INT64(0x0000000100000000)|M_CLIENT_ENCODING)
+
+#define M_IGNORE_CACHE                                MAKE_INT64(0x0000000200000000)
+
+#define M_FEATURE_OP_MASK                             MAKE_INT64(0x0000000000FF0000)
+#define M_FEATURE_OP(N)                               ((N) & M_FEATURE_OP_MASK)
+
+#define M_FEATURE_ENUM_MASK                           MAKE_INT64(0x0F00000000000000)
+#define M_FEATURE_ENUM(N)                             ((N) & M_FEATURE_ENUM_MASK)
+
+// For enumerating the GenICam feature tree.
+#define M_GC_NODE_COUNT                               MAKE_INT64(0x0000000000010000)
+
+#define M_GC_NODES                                    MAKE_INT64(0x0100000000000000)
+#define M_SUBFEATURE_INDEX_MASK                       M_FEATURE_INDEX_MASK
+#define M_SUBFEATURE_INDEX(N)                         ((N) & M_SUBFEATURE_INDEX_MASK)
+#define M_SUBFEATURE_COUNT                            (M_GC_NODES + M_GC_NODE_COUNT)
+#define M_SUBFEATURE_NAME                             (M_GC_NODES + M_FEATURE_NAME)
+#define M_SUBFEATURE_TYPE                             (M_GC_NODES + M_FEATURE_TYPE)
+
+// For targeting a specific XML file
+#define M_GENTL_XML_TYPE_MASK                         MAKE_INT64(0x000000000F000000)
+#define M_GENTL_XML_STRIP_TYPE_MASK(N)                ((N) & ~M_GENTL_XML_TYPE_MASK)
+#define M_GENTL_XML_INDEX_MASK_LOWER                  MAKE_INT64(0x000000F000000000)
+#define M_GENTL_XML_INDEX_MASK_UPPER                  MAKE_INT64(0x0000100000000000)
+#define M_GENTL_XML_INDEX_MASK                        (M_GENTL_XML_INDEX_MASK_UPPER | M_GENTL_XML_INDEX_MASK_LOWER)
+#define M_GENTL_XML_INDEX_SHIFT_LOWER                 MAKE_INT64(36)
+#define M_GENTL_XML_INDEX_SHIFT_UPPER                 MAKE_INT64(40)
+#define M_GENTL_XML_INDEX(N)                          ((((N) & M_GENTL_XML_INDEX_MASK_UPPER) >> M_GENTL_XML_INDEX_SHIFT_UPPER) | (((N) & M_GENTL_XML_INDEX_MASK_LOWER) >> M_GENTL_XML_INDEX_SHIFT_LOWER))
+#define M_GENTL_XML_STRIP_INDEX(N)                    ((N) & ~M_GENTL_XML_INDEX_MASK)
+
+#define M_GENTL_SYSTEM                                MIL_MAKE_CONST(0x01000000, 0x0000000001000000)
+#define M_GENTL_INTERFACE                             MIL_MAKE_CONST(0x02000000, 0x0000000002000000)
+#define M_GENTL_DEVICE                                MIL_MAKE_CONST(0x03000000, 0x0000000003000000)
+#define M_GENTL_REMOTE_DEVICE                         MIL_MAKE_CONST(0x08000000, 0x0000000008000000)
+#define M_GENTL_STREAM                                MIL_MAKE_CONST(0x09000000, 0x0000000009000000)
+#define M_GENTL_BUFFER                                MIL_MAKE_CONST(0x0A000000, 0x000000000A000000)
+
+#define M_GENTL_INTERFACE_NUMBER(N)                  (M_GENTL_INTERFACE | ((((MIL_INT64)N) << M_GENTL_XML_INDEX_SHIFT_LOWER) & M_GENTL_XML_INDEX_MASK_LOWER) | ((((MIL_INT64)N) << M_GENTL_XML_INDEX_SHIFT_UPPER) & M_GENTL_XML_INDEX_MASK_UPPER))
+#define M_GENTL_INTERFACE0                            MAKE_INT64(0x0000000002000000)
+#define M_GENTL_INTERFACE1                            MAKE_INT64(0x0000001002000000)
+#define M_GENTL_INTERFACE2                            MAKE_INT64(0x0000002002000000)
+#define M_GENTL_INTERFACE3                            MAKE_INT64(0x0000003002000000)
+#define M_GENTL_INTERFACE4                            MAKE_INT64(0x0000004002000000)
+#define M_GENTL_INTERFACE5                            MAKE_INT64(0x0000005002000000)
+#define M_GENTL_INTERFACE6                            MAKE_INT64(0x0000006002000000)
+#define M_GENTL_INTERFACE7                            MAKE_INT64(0x0000007002000000)
+#define M_GENTL_INTERFACE8                            MAKE_INT64(0x0000008002000000)
+#define M_GENTL_INTERFACE9                            MAKE_INT64(0x0000009002000000)
+#define M_GENTL_INTERFACE10                           MAKE_INT64(0x000000A002000000)
+#define M_GENTL_INTERFACE11                           MAKE_INT64(0x000000B002000000)
+#define M_GENTL_INTERFACE12                           MAKE_INT64(0x000000C002000000)
+#define M_GENTL_INTERFACE13                           MAKE_INT64(0x000000D002000000)
+#define M_GENTL_INTERFACE14                           MAKE_INT64(0x000000E002000000)
+#define M_GENTL_INTERFACE15                           MAKE_INT64(0x000000F002000000)
+#define M_GENTL_INTERFACE16                           MAKE_INT64(0x0000100002000000)
+#define M_GENTL_INTERFACE17                           MAKE_INT64(0x0000101002000000)
+#define M_GENTL_INTERFACE18                           MAKE_INT64(0x0000102002000000)
+#define M_GENTL_INTERFACE19                           MAKE_INT64(0x0000103002000000)
+#define M_GENTL_INTERFACE20                           MAKE_INT64(0x0000104002000000)
+#define M_GENTL_INTERFACE21                           MAKE_INT64(0x0000105002000000)
+#define M_GENTL_INTERFACE22                           MAKE_INT64(0x0000106002000000)
+#define M_GENTL_INTERFACE23                           MAKE_INT64(0x0000107002000000)
+#define M_GENTL_INTERFACE24                           MAKE_INT64(0x0000108002000000)
+#define M_GENTL_INTERFACE25                           MAKE_INT64(0x0000109002000000)
+#define M_GENTL_INTERFACE26                           MAKE_INT64(0x000010A002000000)
+#define M_GENTL_INTERFACE27                           MAKE_INT64(0x000010B002000000)
+#define M_GENTL_INTERFACE28                           MAKE_INT64(0x000010C002000000)
+#define M_GENTL_INTERFACE29                           MAKE_INT64(0x000010D002000000)
+#define M_GENTL_INTERFACE30                           MAKE_INT64(0x000010E002000000)
+#define M_GENTL_INTERFACE31                           MAKE_INT64(0x000010F002000000)
+
+#define M_GENTL_STREAM_NUMBER(N)                     (M_GENTL_STREAM | ((((MIL_INT64)N) << M_GENTL_XML_INDEX_SHIFT_LOWER) & M_GENTL_XML_INDEX_MASK_LOWER) | ((((MIL_INT64)N) << M_GENTL_XML_INDEX_SHIFT_UPPER) & M_GENTL_XML_INDEX_MASK_UPPER))
+#define M_GENTL_STREAM0                               MAKE_INT64(0x0000000009000000)
+#define M_GENTL_STREAM1                               MAKE_INT64(0x0000001009000000)
+#define M_GENTL_STREAM2                               MAKE_INT64(0x0000002009000000)
+#define M_GENTL_STREAM3                               MAKE_INT64(0x0000003009000000)
+#define M_GENTL_STREAM4                               MAKE_INT64(0x0000004009000000)
+#define M_GENTL_STREAM5                               MAKE_INT64(0x0000005009000000)
+#define M_GENTL_STREAM6                               MAKE_INT64(0x0000006009000000)
+#define M_GENTL_STREAM7                               MAKE_INT64(0x0000007009000000)
+#define M_GENTL_STREAM8                               MAKE_INT64(0x0000008009000000)
+#define M_GENTL_STREAM9                               MAKE_INT64(0x0000009009000000)
+#define M_GENTL_STREAM10                              MAKE_INT64(0x000000A009000000)
+#define M_GENTL_STREAM11                              MAKE_INT64(0x000000B009000000)
+#define M_GENTL_STREAM12                              MAKE_INT64(0x000000C009000000)
+#define M_GENTL_STREAM13                              MAKE_INT64(0x000000D009000000)
+#define M_GENTL_STREAM14                              MAKE_INT64(0x000000E009000000)
+#define M_GENTL_STREAM15                              MAKE_INT64(0x000000F009000000)
+#define M_GENTL_STREAM16                              MAKE_INT64(0x0000100009000000)
+#define M_GENTL_STREAM17                              MAKE_INT64(0x0000101009000000)
+#define M_GENTL_STREAM18                              MAKE_INT64(0x0000102009000000)
+#define M_GENTL_STREAM19                              MAKE_INT64(0x0000103009000000)
+#define M_GENTL_STREAM20                              MAKE_INT64(0x0000104009000000)
+#define M_GENTL_STREAM21                              MAKE_INT64(0x0000105009000000)
+#define M_GENTL_STREAM22                              MAKE_INT64(0x0000106009000000)
+#define M_GENTL_STREAM23                              MAKE_INT64(0x0000107009000000)
+#define M_GENTL_STREAM24                              MAKE_INT64(0x0000108009000000)
+#define M_GENTL_STREAM25                              MAKE_INT64(0x0000109009000000)
+#define M_GENTL_STREAM26                              MAKE_INT64(0x000010A009000000)
+#define M_GENTL_STREAM27                              MAKE_INT64(0x000010B009000000)
+#define M_GENTL_STREAM28                              MAKE_INT64(0x000010C009000000)
+#define M_GENTL_STREAM29                              MAKE_INT64(0x000010D009000000)
+#define M_GENTL_STREAM30                              MAKE_INT64(0x000010E009000000)
+#define M_GENTL_STREAM31                              MAKE_INT64(0x000010F009000000)
+
+/* Values returned by M_FEATURE_ACCESS_MODE */
+#define M_FEATURE_NOT_IMPLEMENTED                     1
+#define M_FEATURE_NOT_AVAILABLE                       2
+#define M_FEATURE_WRITE_ONLY                          3
+#define M_FEATURE_READ_ONLY                           4
+#define M_FEATURE_READ_WRITE                          5
+#define M_FEATURE_IS_IMPLEMENTED(ACCESSMODE)          (((ACCESSMODE) != M_FEATURE_NOT_IMPLEMENTED) ? M_TRUE : M_FALSE)
+#define M_FEATURE_IS_AVAILABLE(ACCESSMODE)            ((! ( (ACCESSMODE) == M_FEATURE_NOT_AVAILABLE || (ACCESSMODE) == M_FEATURE_NOT_IMPLEMENTED )) ? M_TRUE : M_FALSE)
+#define M_FEATURE_IS_READABLE(ACCESSMODE)             ((((ACCESSMODE) == M_FEATURE_READ_ONLY)   || ((ACCESSMODE) == M_FEATURE_READ_WRITE)) ? M_TRUE : M_FALSE)
+#define M_FEATURE_IS_WRITABLE(ACCESSMODE)             ((((ACCESSMODE) == M_FEATURE_WRITE_ONLY)  || ((ACCESSMODE) == M_FEATURE_READ_WRITE)) ? M_TRUE : M_FALSE)
+
+/* Values returned by M_FEATURE_VISIBILITY */
+#define M_FEATURE_VISIBILITY_BEGINNER                 1
+#define M_FEATURE_VISIBILITY_EXPERT                   2
+#define M_FEATURE_VISIBILITY_GURU                     3
+#define M_FEATURE_VISIBILITY_INVISIBLE                4
+
+/* Values returned by M_FEATURE_CACHING_MODE */
+#define M_FEATURE_CACHING_MODE_NONE                   1
+#define M_FEATURE_CACHING_MODE_WRITE_THROUGH          2
+#define M_FEATURE_CACHING_MODE_WRITE_AROUND           3
+#define M_FEATURE_IS_CACHABLE(N)                      (((N) != M_FEATURE_CACHING_MODE_NONE) ? M_TRUE : M_FALSE)
+
+/* Values returned by M_FEATURE_REPRESENTATION */
+#define M_FEATURE_REPRESENTATION_LINEAR               1
+#define M_FEATURE_REPRESENTATION_LOGARITHMIC          2
+#define M_FEATURE_REPRESENTATION_BOOLEAN              3
+#define M_FEATURE_REPRESENTATION_PURE_NUMBER          4
+#define M_FEATURE_REPRESENTATION_HEX_NUMBER           5
+#define M_FEATURE_REPRESENTATION_IPV4_ADDRESS         6
+#define M_FEATURE_REPRESENTATION_MAC_ADDRESS          7
+
+// For enumerating enum entries in enumeration type features
+#define M_FEATURE_ENUM_ENTRY                          MAKE_INT64(0x0200000000000000)
+#define M_FEATURE_ENUM_ENTRY_INDEX_MASK               M_FEATURE_INDEX_MASK
+#define M_FEATURE_ENUM_ENTRY_INDEX(N)                 ((N) & M_FEATURE_ENUM_ENTRY_INDEX_MASK)
+#define M_FEATURE_ENUM_ENTRY_COUNT                    (M_FEATURE_ENUM_ENTRY + M_GC_NODE_COUNT)
+#define M_FEATURE_ENUM_ENTRY_NAME                     (M_FEATURE_ENUM_ENTRY + M_FEATURE_NAME)
+#define M_FEATURE_ENUM_ENTRY_DISPLAY_NAME             (M_FEATURE_ENUM_ENTRY + M_FEATURE_DISPLAY_NAME)
+#define M_FEATURE_ENUM_ENTRY_VALUE                    (M_FEATURE_ENUM_ENTRY + M_FEATURE_VALUE)
+#define M_FEATURE_ENUM_ENTRY_TOOLTIP                  (M_FEATURE_ENUM_ENTRY + M_FEATURE_TOOLTIP)
+#define M_FEATURE_ENUM_ENTRY_DESCRIPTION              (M_FEATURE_ENUM_ENTRY + M_FEATURE_DESCRIPTION)
+#define M_FEATURE_ENUM_ENTRY_ACCESS_MODE              (M_FEATURE_ENUM_ENTRY + M_FEATURE_ACCESS_MODE)
+#define M_FEATURE_ENUM_ENTRY_VISIBILITY               (M_FEATURE_ENUM_ENTRY + M_FEATURE_VISIBILITY)
+#define M_FEATURE_ENUM_ENTRY_CACHING_MODE             (M_FEATURE_ENUM_ENTRY + M_FEATURE_CACHING_MODE)
+#define M_FEATURE_ENUM_ENTRY_STREAMABLE               (M_FEATURE_ENUM_ENTRY + M_FEATURE_STREAMABLE)
+
+#define M_FEATURE_SELECTOR                            MAKE_INT64(0x0300000000000000)
+#define M_FEATURE_SELECTOR_INDEX_MASK                 M_FEATURE_INDEX_MASK
+#define M_FEATURE_SELECTOR_INDEX(N)                   ((N) & M_FEATURE_SELECTOR_INDEX_MASK)
+#define M_FEATURE_SELECTOR_COUNT                      (M_FEATURE_SELECTOR + M_GC_NODE_COUNT)
+#define M_FEATURE_SELECTOR_NAME                       (M_FEATURE_SELECTOR + M_FEATURE_NAME)
+
+#define M_FEATURE_VALID_VALUE_LIST                    MAKE_INT64(0x0400000000000000)
+#define M_FEATURE_VALID_VALUE_INDEX_MASK              M_FEATURE_INDEX_MASK
+#define M_FEATURE_VALID_VALUE_INDEX(N)                ((N) & M_FEATURE_VALID_VALUE_INDEX_MASK)
+#define M_FEATURE_VALID_VALUE_COUNT                   (M_FEATURE_VALID_VALUE_LIST + M_GC_NODE_COUNT)
+#define M_FEATURE_VALID_VALUE                         (M_FEATURE_VALID_VALUE_LIST + M_FEATURE_VALUE)
+
+#define M_MIN                                                            0x02000000L   // Deprecated for MdigInquire/ControlFeature() use M_FEATURE_MIN
+#define M_MAX                                                            0x04000000L   // Deprecated for MdigInquire/ControlFeature() use M_FEATURE_MAX
+#define M_LENGTH                                                         0x00002000L   // Deprecated for MdigInquire/ControlFeature() use M_STRING_SIZE or M_FEATURE_SIZE
+
+#if OldDefinesSupport
+#define M_ELEMENT                                     M_FEATURE_ENUM_ENTRY             // Deprecated for MdigInquire/ControlFeature() use one of M_FEATURE_ENUM_ENTRY...
+#define M_ELEMENT_COUNT                               M_GC_NODE_COUNT                  // Deprecated for MdigInquire/ControlFeature() use one of M_FEATURE_ENUM_ENTRY...
+#define M_INCREMENT                                   MAKE_INT64(0x0000040000000000)   // Deprecated for MdigInquire/ControlFeature() use M_FEATURE_INCREMENT
+MIL_DEPRECATED(M_ELEMENT, 1000)                       // New Control Feature API Replaced by M_FEATURE_ENUM_ENTRY
+MIL_DEPRECATED(M_ELEMENT_COUNT, 1000)                 // New Control Feature API Replaced by M_FEATURE_ENUM_ENTRY_COUNT
+//MIL_DEPRECATED(M_INCREMENT, 1000)                     // New Control Feature API Replaced by M_FEATURE_INCREMENT
+#endif
+
+/************************************************************************/
+/* MdigInquireFeature() / MdigControlFeature FeatureType                */
+/************************************************************************/
+#define M_FEATURE_USER_ARRAY_SIZE_MASK                MAKE_INT64(0x000000007FFFFFFF)
+#define M_FEATURE_USER_ARRAY_SIZE_SHIFT               MAKE_INT64(0x0000000000000000)
+#define M_FEATURE_USER_ARRAY_SIZE(N)                  (M_FEATURE_USER_ARRAY_SIZE_BITS | (((N) & M_FEATURE_USER_ARRAY_SIZE_MASK) << M_FEATURE_USER_ARRAY_SIZE_SHIFT))
+#define M_FEATURE_USER_ARRAY_SIZE_VALUE(N)            (M_FEATURE_USER_ARRAY_SIZE_BIT_SET(N) ? (((N) >> M_FEATURE_USER_ARRAY_SIZE_SHIFT) & M_FEATURE_USER_ARRAY_SIZE_MASK) : 0)
+#define M_STRIP_FEATURE_USER_ARRAY_SIZE_VALUE(N)      (M_FEATURE_USER_ARRAY_SIZE_BIT_SET(N) ? ((N) & (~(M_FEATURE_USER_ARRAY_SIZE_BITS | (M_FEATURE_USER_ARRAY_SIZE_MASK << M_FEATURE_USER_ARRAY_SIZE_SHIFT)))) : N)
+
+#if OldDefinesSupport
+#define M_STRING_ARRAY_SIZE_MASK                      M_FEATURE_USER_ARRAY_SIZE_MASK
+#define M_STRING_ARRAY_SIZE_SHIFT                     M_FEATURE_USER_ARRAY_SIZE_SHIFT
+#define M_STRING_ARRAY_SIZE(N)                        M_FEATURE_USER_ARRAY_SIZE(N)
+#define M_ARRAY_SIZE(N)                               M_FEATURE_USER_ARRAY_SIZE(N)
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE, 1060)             // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE
+MIL_DEPRECATED(M_ARRAY_SIZE, 1060)                    // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_MASK, 1060)        // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_MASK
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_SHIFT, 1060)       // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_SHIFT
+MIL_DEPRECATED(M_STRING_ARRAY_SIZE_VALUE, 1060)       // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE_VALUE
+MIL_DEPRECATED(M_STRIP_STRING_ARRAY_SIZE_VALUE, 1060) // New Control Feature API Replaced by M_STRIP_FEATURE_USER_ARRAY_SIZE_VALUE
+#endif
+
+
+/************************************************************************/
+/* MgenLutFunction()                                                    */
+/************************************************************************/
+#define M_LOG                                         0x010DL  //Also defined in milim.h for MimArith
+#define M_EXP                                         0x010AL  //Also defined in milim.h for MimArith
+#define M_SIN                                         0x00000002L
+#define M_COS                                         0x00000003L
+#define M_TAN                                         0x00000004L
+#define M_QUAD                                        0x00000005L
+#define M_POWER                                       0x00000006L
+#if(MIL_COMPILE_VERSION >= 1040)
+#define M_COLORMAP_JET                                (M_PSEUDO_ID+12)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_HOT                                (M_PSEUDO_ID+13)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_HUE                                (M_PSEUDO_ID+14)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#define M_COLORMAP_SPECTRUM                           (M_PSEUDO_ID+15)  // Used by MgenLutFunction and MdispLut, require a pseudo id for MdispLut.
+#else
+#define M_COLORMAP_JET                                0x00000007L
+#define M_COLORMAP_HOT                                0x00000008L
+#define M_COLORMAP_HUE                                0x00000009L
+#define M_COLORMAP_SPECTRUM                           0x0000000AL
+#endif
+#if(MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#define M_COLORMAP_JET_OLD                            0x00000007L
+#define M_COLORMAP_HOT_OLD                            0x00000008L
+#define M_COLORMAP_HUE_OLD                            0x00000009L
+#define M_COLORMAP_SPECTRUM_OLD                       0x0000000AL
+#endif
+#define M_FIRST_GRAY                                  0x00004000L //Combined with M_COLORMAP_...
+#define M_LAST_GRAY                                   0x00002000L //Combined with M_COLORMAP_...
+#define M_SIGMOID                                     0x0000000BL
+#define M_TONE_MAPPING                                0x0000000CL
+
+
+
+#define M_COLORMAP_MASK                               (0xFFFFFFFF - M_FIRST_GRAY - M_LAST_GRAY)
+#if(MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#define IS_GEN_LUT_COLORMAP_FUNCTION(func)  ((((func) & M_COLORMAP_MASK) == M_COLORMAP_HOT) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_JET) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_SPECTRUM) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_HUE) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_TURBO) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_DISTINCT_256) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_HOT_OLD) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_JET_OLD) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_SPECTRUM_OLD) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_HUE_OLD) )
+#else
+#define IS_GEN_LUT_COLORMAP_FUNCTION(func)  ((((func) & M_COLORMAP_MASK) == M_COLORMAP_HOT) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_JET) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_SPECTRUM) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_HUE) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_TURBO) || \
+                                             (((func) & M_COLORMAP_MASK) == M_COLORMAP_DISTINCT_256) )
+#endif
+
+#define IS_GEN_LUT_FUNCTION(func) ( ((func) == M_COS) || \
+                                    ((func) == M_EXP) || \
+                                    ((func) == M_LOG) || \
+                                    ((func) == M_POWER) || \
+                                    ((func) == M_QUAD) || \
+                                    ((func) == M_SIN) || \
+                                    ((func) == M_TAN) || \
+                                    ((func) == M_SIGMOID) || \
+                                    ((func) == M_TONE_MAPPING) || \
+                                    IS_GEN_LUT_COLORMAP_FUNCTION(func) )
+
+/************************************************************************/
+/* MgenWarpParameter()                                                  */
+/************************************************************************/
+/* 8 bits reserved for number of fractional bits added to M_FIXED_POINT */
+#define M_WARP_MATRIX                                 0x00100000L
+#define M_WARP_POLYNOMIAL                             0x00200000L
+#define M_WARP_LUT                                    0x00400000L
+#define M_WARP_4_CORNER                               0x00800000L
+#define M_WARP_4_CORNER_REVERSE                       0x01000000L
+/* Optional controls */
+#define M_FIXED_POINT                                 0x00004000L
+#define M_OVERSCAN_ENABLE                             0x00008000L
+/*#define M_OVERSCAN_DISABLE                          See previous definition*/
+#define M_OVERSCAN_FAST                               0x00040000L
+#define M_FAST                                        0x00002000L
+#define M_VERY_FAST                                   0x00010000L
+#define M_REGULAR                                     0x00020000L
+
+/* Transforms */
+#define M_RESIZE                                      1L
+#define M_ROTATE                                      2L
+#define M_SHEAR_X                                     3L
+#define M_SHEAR_Y                                     4L
+#define M_TRANSLATE                                   5L
+#define M_SCALE                                 0x00008010L
+
+/************************************************************************/
+/* MbufBayer() defines                                                  */
+/************************************************************************/
+#define M_BAYER_GB                                    32L
+#define M_BAYER_BG                                    64L
+#define M_BAYER_RG                                    96L
+#define M_BAYER_GR                                    128L
+#define M_WHITE_BALANCE_CALCULATE                     16L
+#define M_BAYER_NORMALIZE                             512L
+#define M_COLOR_CORRECTION                            1024L
+#define M_ADAPTIVE                                    2048L 
+#define M_AVERAGE_2X2                                 4096L
+#define M_ADAPTIVE_FAST                               8192L
+#define M_BAYER_BIT_SHIFT_MASK                        0x01F00000L
+#define M_BAYER_EXTRACT_BIT_SHIFT(ControlFlag)        (MIL_INT)((ControlFlag & M_BAYER_BIT_SHIFT_MASK) >> 20)
+#define M_BAYER_BIT_SHIFT(NbBit)                      (NbBit << 20)
+#define M_BAYER_REVERSE                               M_REVERSE
+#define M_BAYER_OVERSCAN_ENABLE                       M_OVERSCAN_ENABLE
+#define M_BAYER_OVERSCAN_DISABLE                      M_OVERSCAN_DISABLE
+#define M_CUSTOM_BRGG                                 256L
+#define M_CUSTOM_RBGG                                 288L
+#define M_CUSTOM_GGBR                                 320L
+#define M_CUSTOM_GGRB                                 352L
+
+#define M_BAYER_MASK                                 (M_BAYER_GB    | \
+                                                      M_BAYER_BG    | \
+                                                      M_BAYER_RG    | \
+                                                      M_BAYER_GR    | \
+                                                      M_CUSTOM_BRGG | \
+                                                      M_CUSTOM_RBGG | \
+                                                      M_CUSTOM_GGBR | \
+                                                      M_CUSTOM_GGRB)
+
+/************************************************************************/
+/* DContext & Datagram Param Role attributes                            */
+/************************************************************************/
+#define M_ROLE_UNUSED_1                               0x00000001
+#define M_SKIP_PFNC_CHECK                             0x00000002
+#define M_ALLOW_BUFFER_WITH_REGION_MODIFY             0x00000004L
+//#define M_GRAB                                      0x00000008L
+//#define M_PROC                                      0x00000010L
+//#define M_DISP                                      0x00000020L
+//#define M_BASIC_BUFFER_PURPOSE                      (M_GRAB|M_PROC|M_DISP)
+#define M_SKIP_PORTABLE_CHECK                         0x00000040
+#define M_NO_DMIL_COMPENSATION                        0x00000080L
+#define M_IS_RETURN_VALUE                             0x00000100L
+#define M_IN                                          0x00000200L
+#define M_OUT                                         0x00000400L
+#define M_SRC                                         M_IN
+#define M_DEST                                        M_OUT
+#define M_ALLOW_NULL_ID                               0x00000800L
+#define M_ALLOW_NULL_VALUE                            M_ALLOW_NULL_ID
+#define M_ALLOW_DEFAULT_ID                            0x00001000L
+#define M_ALLOW_PSEUDO_ID                             0x00002000
+#define M_AS_VALUE                                    0x00004000L 
+#define M_ALLOW_BUFFER_WITH_REGION                    0x00008000L
+
+#define M_PROCMAN_ATTRIBUTE_BITS                      0xFFFF0000L
+#define M_INTERNAL_PARAMETER                          0x00010000L       // Used for internal adjusted buffers
+#define M_EXCLUDE_FOR_ANY_ADJUSTMENT                  0x00040000L       // Not considered for any adjustments in the ProcManager
+#define M_EXCLUDE_FOR_INTERSECTION                    0x00080000L       // Not considered when computing the Size and #Band intersection in ProcManager
+#define M_EXCLUDE_FOR_SYSTEM_SELECTION                0x00100000L       // Not considered when selecting the system in SystemCallControl
+#define M_EXCLUDE_FOR_TYPE_ADJUSTMENT                 0x00200000L       // Not considered for type adjustment in ProcManager
+
+#define M_STRICTLY_ROLE_BITS                          (M_ROLE_UNUSED_1 | M_SKIP_PFNC_CHECK | M_ALLOW_BUFFER_WITH_REGION_MODIFY | M_SKIP_PORTABLE_CHECK | M_NO_DMIL_COMPENSATION | M_IS_RETURN_VALUE | M_ALLOW_PSEUDO_ID |M_IN|M_OUT|M_ALLOW_NULL_ID|M_ALLOW_DEFAULT_ID|M_AS_VALUE|M_ALLOW_BUFFER_WITH_REGION)
+
+// this mask is used to get the value needed in the CommandDispatcher to determine 
+// what to do with the MIL_ID
+#define M_ROLE_IO_MASK                                (M_IN | M_OUT | M_AS_VALUE)
+
+// Macro used to identify virtual id.  A virtual id is accepted in parameters accepting
+// MIL_ID but does not identify an existing resource having a valid MGObject.
+#define M_IS_DEFAULT_ID(Id)      ((Id) == M_DEFAULT)
+#define M_IS_NULL_ID(Id)         ((Id) == M_NULL)
+
+#define M_ID_IS_VIRTUAL_OR_NULL(Id)      (M_IS_DEFAULT_ID(Id) || M_IS_PSEUDO_ID(Id) || M_IS_NULL_ID(Id) )
+#define M_ID_IS_VIRTUAL(Id)              (M_IS_DEFAULT_ID(Id) || M_IS_PSEUDO_ID(Id))
+
+/************************************************************************/
+/* Buffer attributes                                                    */
+/************************************************************************/
+#define M_UNKNOWN_OBJECT_TYPE                         0x00000000L
+#define M_IMAGE                                       0x00000004L
+#define M_GRAB                                        0x00000008L
+#define M_PROC                                        0x00000010L
+#define M_DISP                                        0x00000020L
+#define M_BASIC_BUFFER_PURPOSE                        (M_GRAB|M_PROC|M_DISP)
+#define M_ARRAY                                       0x00000040L
+#define M_EVENT                                       0x00000080L
+#define M_SYSTEM_THREAD                               0x00000100L
+#define M_APPLICATION                                 0x00000200L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_THREAD_CONTEXT                              0x00000400L
+#endif
+#define M_EVENT_CONTEXT                               0x00000800L
+#define M_STAT_LIST                                   0x00001000L
+#define M_HIST_LIST                                   0x00002000L
+#define M_PROJ_LIST                                   0x00004000L
+#define M_EVENT_LIST                                  0x00008000L
+#define M_EXTREME_LIST                                0x00010000L
+#define M_COUNT_LIST                                  0x00020000L
+#define M_LUT                                         0x00040000L
+#define M_WARP_COEFFICIENT                            0x00080000L
+#define M_DIGITIZER                                   0x00100000L
+#define M_DISPLAY                                     0x00200000L
+#define M_KERNEL                                      0x00400000L
+#define M_SYSTEM                                      0x00800000L
+#define M_GRAPHIC_CONTEXT                             0x01000000L
+#define M_CALL_CONTEXT                                0x02000000L
+#define M_ERROR_CONTEXT                               0x04000000L
+#define M_STRUCT_ELEMENT                              0x08000000L
+#define M_MUTEX                                       0x10000000L
+#define M_USER_ATTRIBUTE                              0x20000000L
+#define M_IM_CONTEXT                                  0x40000000L
+#define M_CONTAINER                                   MAKE_INT64(0x0000000080000000)
+#define M_MIL_ID_PROXY_OBJECT                         MAKE_INT64(0x0000000100000000)
+#define M_GRAPHIC_LIST                                MAKE_INT64(0x0000000200000000)
+#define M_STAT_MULTIPLE_RESULT                        MAKE_INT64(0x0000004000000000)
+#define M_VIDEO_DEVICE_OBJECT                         MAKE_INT64(0x0000010000000000)
+#define M_WAVELET_TRANSFORM_RESULT                    MAKE_INT64(0x0000020000000000)
+#define M_SEQUENCE_CONTEXT                            MAKE_INT64(0x0000040000000000)
+#define M_FIND_ORIENTATION_LIST                       MAKE_INT64(0x0000080000000000)
+#define M_SYS_IO_CONTEXT                              MAKE_INT64(0x0000100000000000)
+#define M_LOCATE_PEAK_1D_RESULT                       MAKE_INT64(0x0000200000000000)
+#define M_MESSAGE_MAILBOX                             MAKE_INT64(0x0000800000000000)
+#define M_STATISTICS_RESULT                           MAKE_INT64(0x0001000000000000)
+#define M_HTTP_SERVER                                 MAKE_INT64(0x0002000000000000)
+
+#define M_AUGMENTATION_RESULT                         MAKE_INT64(0x0004000000000000)                     
+
+#define M_BUF_ALLOC_BUFFER_TYPES                     (M_IMAGE          | \
+                                                      M_LUT            | \
+                                                      M_KERNEL         | \
+                                                      M_STRUCT_ELEMENT | \
+                                                      M_ARRAY)
+
+#define M_IM_ALLOC_RESULT_BUFFER_TYPES               (M_HIST_LIST      | \
+                                                      M_PROJ_LIST      | \
+                                                      M_EVENT_LIST     | \
+                                                      M_EXTREME_LIST   | \
+                                                      M_STAT_LIST      | \
+                                                      M_COUNT_LIST     | \
+                                                      M_FIND_ORIENTATION_LIST)
+
+#define M_IM_RESULT_OBJECT_TYPES                     (M_STAT_MULTIPLE_RESULT | \
+                                                      M_WAVELET_TRANSFORM_RESULT | \
+                                                      M_AUGMENTATION_RESULT | \
+                                                      M_LOCATE_PEAK_1D_RESULT | \
+                                                      M_STATISTICS_RESULT |\
+                                                      M_AUGMENTATION_RESULT)
+
+#define M_IM_RESULT_BUFFER_MEMORY_SPECIFIERS         (M_ON_BOARD         | \
+                                                      M_OFF_BOARD        | \
+                                                      M_PAGED            | \
+                                                      M_NON_PAGED        | \
+                                                      M_HOST_MEMORY      | \
+                                                      M_VIDEO_MEMORY     | \
+                                                      M_PROC_GPU         | \
+                                                      M_FPGA_ACCESSIBLE  | \
+                                                      M_FAST_MEMORY      | \
+                                                      M_MEMORY_BANK_MASK)
+
+#define M_ALL_BUFFER_TYPES                           (M_BUF_ALLOC_BUFFER_TYPES | \
+                                                      M_IM_ALLOC_RESULT_BUFFER_TYPES)
+
+/* Use this macro to verify safely if a Mil object is a buffer. */
+#define M_IS_BUFFER_TYPE( ParIs )      ( (0                != (ParIs & M_ALL_BUFFER_TYPES)) && \
+                                         (M_USER_ATTRIBUTE != (ParIs & M_USER_ATTRIBUTE  )) )
+
+#define M_IS_ALLOC_BUFFER_TYPE( ParIs )      ( (0                != (ParIs & M_BUF_ALLOC_BUFFER_TYPES)) && \
+                                               (M_USER_ATTRIBUTE != (ParIs & M_USER_ATTRIBUTE  )) )
+
+#define M_IS_BUFFER_IMAGE(ParIs)          (((ParIs) & (M_IMAGE | M_USER_ATTRIBUTE)) == M_IMAGE)
+
+/* Use this macro to verify safely if a Mil object is a display. */
+#define M_IS_DISPLAY_TYPE( ParIs )     ( (M_DISPLAY == (ParIs & M_DISPLAY        )) && \
+                                         (0         == (ParIs & M_USER_ATTRIBUTE )) && \
+                                         (0         == (ParIs & M_ALL_BUFFER_TYPES)) )
+
+/* Use this macro to verify safely if a Mil object is a digitizer. */
+#define M_IS_DIGITIZER_TYPE( ParIs )   ( (M_DIGITIZER == (ParIs & M_DIGITIZER      )) && \
+                                         (0           == (ParIs & M_USER_ATTRIBUTE )) && \
+                                         (0           == (ParIs & M_ALL_BUFFER_TYPES)) )
+
+
+#define M_USER_OBJECT_1                               (M_USER_ATTRIBUTE       | 0x00010000L)
+#define M_USER_OBJECT_2                               (M_USER_ATTRIBUTE       | 0x00020000L)
+#define M_BLOB_OBJECT                                 (M_USER_ATTRIBUTE       | 0x00040000L)
+#define M_BLOB_FEATURE_LIST                           (M_BLOB_OBJECT          | 0x00000001L)
+#define M_BLOB_RESULT                                 (M_BLOB_OBJECT          | 0x00000002L)
+#define M_BLOB_CONTEXT                                (M_BLOB_OBJECT          | 0x00000004L)
+#define M_PAT_OBJECT                                  (M_USER_ATTRIBUTE       | 0x00080000L)
+#define M_PAT_MODEL                                   (M_PAT_OBJECT           | 0x00000001L)
+#define M_PAT_RESULT                                  (M_PAT_OBJECT           | 0x00000002L)
+#define M_PAT_CONTEXT                                 (M_PAT_OBJECT           | 0x00000004L)
+#define M_OCR_OBJECT                                  (M_USER_ATTRIBUTE       | 0x00100000L)
+#define M_OCR_FONT                                    (M_OCR_OBJECT           | 0x00000001L)
+#define M_OCR_RESULT                                  (M_OCR_OBJECT           | 0x00000002L)
+#define M_MEAS_OBJECT                                 (M_USER_ATTRIBUTE       | 0x00200000L)
+#define M_MEAS_MARKER                                 (M_MEAS_OBJECT          | 0x00000001L)
+#define M_MEAS_RESULT                                 (M_MEAS_OBJECT          | 0x00000002L)
+#define M_MEAS_CONTEXT                                (M_MEAS_OBJECT          | 0x00000004L)
+#define M_CAL_OBJECT                                  (M_USER_ATTRIBUTE       | 0x00400000L)
+#define M_CAL_CONTEXT                                 (M_CAL_OBJECT           | 0x00000001L)
+#if OldDefinesSupport
+   #define M_CAL_PARENT                                M_CAL_CONTEXT
+   MIL_DEPRECATED(M_CAL_PARENT, 1000)
+#endif
+#define M_CAL_FIXTURING_OFFSET                        (M_CAL_OBJECT           | 0x00000004L)
+#define M_CAL_DRAW_3D_CONTEXT                         (M_CAL_OBJECT           | 0x00000008L )
+#define M_CODE_OBJECT                                 (M_USER_ATTRIBUTE       | 0x00800000L)
+#define M_CODE_CONTEXT                                (M_CODE_OBJECT          | 0x00000001L)
+#if OldDefinesSupport
+#define M_CODE_RESULT                                 (M_CODE_OBJECT          | 0x00000002L)
+MIL_DEPRECATED(M_CODE_RESULT, 1040) // Use M_CODE_GRADE_RESULT instead.
+#endif
+#define M_CODE_GRADE_RESULT                           (M_CODE_OBJECT          | 0x00000002L)
+#define M_OLD_CODE_CONTEXT                            (M_CODE_OBJECT          | 0x00000003L) // DEPRECATED replaced by M_CODE_CONTEXT
+#define M_CODE_MODEL                                  (M_CODE_OBJECT          | 0x00000004L)
+#define M_CODE_TRAIN_RESULT                           (M_CODE_OBJECT          | 0x00000008L)
+#define M_CODE_DETECT_RESULT                          (M_CODE_OBJECT          | 0x00000010L)
+#define M_CODE_READ_RESULT                            (M_CODE_OBJECT          | 0x00000020L)
+#define M_CODE_WRITE_RESULT                           (M_CODE_OBJECT          | 0x00000040L)
+#define M_STR_OBJECT                                  (M_USER_ATTRIBUTE       | 0x02000000L)
+#define M_STR_CONTEXT                                 (M_STR_OBJECT           | 0x00000001L)
+#if OldDefinesSupport
+   #define M_STR_FEATURE_BASED_CONTEXT                M_STR_CONTEXT
+   MIL_DEPRECATED(M_STR_FEATURE_BASED_CONTEXT, 1010)
+#endif
+#define M_STR_RESULT                                  (M_STR_OBJECT           | 0x00000002L)
+#define M_MOD_OBJECT                                  (M_USER_ATTRIBUTE       | 0x04000000L)
+#define M_MOD_GEOMETRIC                               (M_MOD_OBJECT           | 0x00000001L)
+#define M_MOD_RESULT                                  (M_MOD_OBJECT           | 0x00000004L)
+#define M_MOD_GEOMETRIC_CONTROLLED                    (M_MOD_OBJECT           | 0x00000008L)
+#define M_MOD_SHAPE_RESULT                            (M_MOD_OBJECT           | 0x00000010L)
+#define M_MOD_SHAPE_CIRCLE_CONTEXT                    (M_MOD_OBJECT           | 0x00000020L)
+#define M_MOD_SHAPE_ELLIPSE_CONTEXT                   (M_MOD_OBJECT           | 0x00000040L)
+#define M_MOD_SHAPE_RECTANGLE_CONTEXT                 (M_MOD_OBJECT           | 0x00000080L)
+#define M_MOD_SHAPE_SEGMENT_CONTEXT                   (M_MOD_OBJECT           | 0x00000100L)
+#define M_EDGE_OBJECT                                 (M_USER_ATTRIBUTE       | 0x08000000L)
+#define M_EDGE_CONTOUR                                (M_EDGE_OBJECT          | 0x00000001L)
+#define M_EDGE_CREST                                  (M_EDGE_OBJECT          | 0x00000002L)
+#define M_EDGE_RESULT                                 (M_EDGE_OBJECT          | 0x00000004L)
+#define M_HOOK_CONTEXT_OBJECT                         (M_USER_ATTRIBUTE       | 0x40000000L)
+#define M_HOOK_CONTEXT                                (M_HOOK_CONTEXT_OBJECT  | 0x00000001L)
+#define M_DRIVER_HOOK_CONTEXT                         (M_HOOK_CONTEXT_OBJECT  | 0x00000002L)
+#define M_GRA_HOOK_CONTEXT                            (M_HOOK_CONTEXT_OBJECT  | 0x00000004L)
+#define M_SEQ_HOOK_CONTEXT                            (M_HOOK_CONTEXT_OBJECT  | 0x00000008L)
+#define M_EMULATED_HOOK_CONTEXT                       (M_HOOK_CONTEXT_OBJECT  | 0x00000010L)
+#define M_OPAQUE_HOOK_CONTEXT                         (M_HOOK_CONTEXT_OBJECT  | 0x00000020L)
+#define M_REG_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000000800000000))
+#define M_REG_STITCHING_CONTEXT                       (M_REG_OBJECT           | 0x00000001L )
+#define M_REG_EDOF_CONTEXT                            (M_REG_OBJECT           | 0x00000004L )
+#define M_REG_DFF_CONTEXT                             (M_REG_OBJECT           | 0x00000010L )
+#define M_REG_PHOTOMETRIC_STEREO_CONTEXT              (M_REG_OBJECT           | 0x00000040L )
+#define M_REG_HDR_CONTEXT                             (M_REG_OBJECT           | 0x00000100L )
+#define M_REG_STITCHING_RESULT                        (M_REG_OBJECT           | 0x00000002L )
+#define M_REG_EDOF_RESULT                             (M_REG_OBJECT           | 0x00000008L )
+#define M_REG_DFF_RESULT                              (M_REG_OBJECT           | 0x00000020L )
+#define M_REG_PHOTOMETRIC_STEREO_RESULT               (M_REG_OBJECT           | 0x00000080L )
+#define M_REG_HDR_RESULT                              (M_REG_OBJECT           | 0x00000200L )
+#define M_MET_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000000100000000))
+#define M_MET_CONTEXT                                 (M_MET_OBJECT           | 0x00000001L )
+#define M_MET_RESULT                                  (M_MET_OBJECT           | 0x00000002L )
+#define M_MET_GEOMETRY                                (M_MET_OBJECT           | 0x00000004L ) // DEPRECATED, replaced by M_MET_DERIVED_GEOMETRY_REGION
+#define M_MET_DERIVED_GEOMETRY_REGION                 (M_MET_OBJECT           | 0x00000004L )
+#define M_COL_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000000200000000))
+#define M_COL_MATCH_CONTEXT                           (M_COL_OBJECT           | 0x00000001L )
+#define M_COL_SPACE_DEF_CONTEXT                       (M_COL_OBJECT           | 0x00000002L )
+#define M_COL_PROJECT_CONTEXT                         (M_COL_OBJECT           | 0x00000004L )
+#define M_COL_MATCH_RESULT                            (M_COL_OBJECT           | 0x00000008L )
+#define M_COL_RELATIVE_CALIBRATION_CONTEXT            (M_COL_OBJECT           | 0x00000010L )
+#define M_3DMAP_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000000400000000))
+#if OldDefinesSupport
+#define M_3DPR_OBJECT                                  M_3DMAP_OBJECT
+MIL_DEPRECATED(M_3DPR_OBJECT, 1000)
+#endif
+#define M_3DMAP_LASER_CONTEXT                         (M_3DMAP_OBJECT         | 0x00000001L )
+#if OldDefinesSupport
+   #define M_3DMAP_LASER_DATA                         (M_3DMAP_OBJECT         | 0x00000002L )
+   MIL_DEPRECATED(M_3DMAP_LASER_DATA, 1010)
+#endif
+#define M_3DMAP_GEOMETRY                              (M_3DMAP_OBJECT         | 0x00000004L )
+#define M_3DMAP_STAT_RESULT                           (M_3DMAP_OBJECT         | 0x00000008L )
+#define M_3DMAP_LASER_CALIBRATION_DATA                (M_3DMAP_OBJECT         | 0x00000010L )
+#define M_3DMAP_DEPTH_CORRECTED_DATA                  (M_3DMAP_OBJECT         | 0x00000020L )
+#define M_3DMAP_POINT_CLOUD_CONTAINER                 (M_3DMAP_OBJECT         | 0x00000040L ) // deprecated name since 10.40
+#define M_3DMAP_POINT_CLOUD_RESULT                    (M_3DMAP_OBJECT         | 0x00000040L )
+#define M_3DMAP_PAIRWISE_ALIGNMENT_CONTEXT            (M_3DMAP_OBJECT         | 0x00000080L )
+#define M_3DMAP_ALIGNMENT_RESULT                      (M_3DMAP_OBJECT         | 0x00000100L )
+#define M_3DMAP_DRAW_3D_CONTEXT                       (M_3DMAP_OBJECT         | 0x00000200L )
+#define M_BEAD_OBJECT                                 (M_MEAS_OBJECT)
+#define M_BEAD_CONTEXT                                (M_BEAD_OBJECT          | 0x00000010L )
+#define M_BEAD_RESULT                                 (M_BEAD_OBJECT          | 0x00000020L )
+#define M_COM_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000001000000000))
+#define M_COM_CONTEXT                                 (M_COM_OBJECT           | 0x00000001L )
+#define M_DMR_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000002000000000))
+#define M_DMR_CONTEXT                                 (M_DMR_OBJECT           | 0x00000001L )
+#define M_DMR_RESULT                                  (M_DMR_OBJECT           | 0x00000020L )
+#define M_CLASS_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000004000000000))
+#define M_SAVABLE_OBJECT                               MAKE_INT64(0x0000000000008000)
+#define M_CLASS_OBJECT_SAVABLE                                  (M_CLASS_OBJECT         | M_SAVABLE_OBJECT)
+#define M_CLASS_CLASSIFIER_CNN_CONTEXT                          (M_CLASS_OBJECT_SAVABLE |  1L )
+#define M_CLASS_CLASSIFIER_CNN_PREDEFINED_CONTEXT               (M_CLASS_OBJECT_SAVABLE |  2L )
+#define M_CLASS_CLASSIFIER_TREE_ENSEMBLE_CONTEXT                (M_CLASS_OBJECT_SAVABLE |  3L )
+#define M_CLASS_TRAIN_CNN_CONTEXT                               (M_CLASS_OBJECT_SAVABLE |  4L )
+#define M_CLASS_TRAIN_TREE_ENSEMBLE_CONTEXT                     (M_CLASS_OBJECT_SAVABLE |  5L )
+#define M_CLASS_PREDICT_TREE_ENSEMBLE_RESULT                    (M_CLASS_OBJECT         |  6L )
+#define M_CLASS_TRAIN_TREE_ENSEMBLE_RESULT                      (M_CLASS_OBJECT         |  7L )
+#define M_CLASS_DATASET_IMAGES                                  (M_CLASS_OBJECT_SAVABLE |  8L )
+#define M_CLASS_DATASET_FEATURES                                (M_CLASS_OBJECT_SAVABLE |  9L )
+#define M_CLASS_CNN_EPOCH_HOOK_INFO                             (M_CLASS_OBJECT         | 10L )
+#define M_CLASS_CNN_MINI_BATCH_HOOK_INFO                        (M_CLASS_OBJECT         | 11L )
+#define M_CLASS_CNN_PREDICT_ENTRY_HOOK_INFO                     (M_CLASS_OBJECT         | 12L )
+#define M_CLASS_TREE_ENSEMBLE_TREE_HOOK_INFO                    (M_CLASS_OBJECT         | 13L )
+#define M_CLASS_TREE_ENSEMBLE_PREDICT_ENTRY_HOOK_INFO           (M_CLASS_OBJECT         | 14L )
+#define M_CLASS_PREDICT_CNN_RESULT                              (M_CLASS_OBJECT         | 32L )
+#define M_CLASS_TRAIN_CNN_RESULT                                (M_CLASS_OBJECT         | 64L )
+#if OldDefinesSupport
+#define M_CLASS_RESULT                                          (M_CLASS_OBJECT         | 32L )
+MIL_DEPRECATED(M_CLASS_RESULT, 1040) // Use M_CLASS_PREDICT_CNN_RESULT instead.
+#endif
+
+#define M_GAB_OBJECT                                  (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000200000000000))
+#define M_GAB_CONTEXT                                 (M_GAB_OBJECT           | 0x00000001L )
+#define M_GAB_RESULT                                  (M_GAB_OBJECT           | 0x00000002L )
+#define M_3DIM_OBJECT                                 (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000400000000000))
+#define M_3DIM_CALCULATE_MAP_SIZE_CONTEXT             (M_3DIM_OBJECT          | 0x00000001L )                   
+#define M_3DIM_SUBSAMPLE_CONTEXT                      (M_3DIM_OBJECT          | 0x00000002L )
+#define M_3DIM_MESH_CONTEXT                           (M_3DIM_OBJECT          | 0x00000004L )
+#define M_3DIM_NORMALS_CONTEXT                        (M_3DIM_OBJECT          | 0x00000008L )
+#define M_3DIM_STATISTICS_CONTEXT                     (M_3DIM_OBJECT          | 0x00000010L )
+#define M_3DIM_SURFACE_SAMPLE_CONTEXT                 (M_3DIM_OBJECT          | 0x00000020L ) 
+#define M_3DIM_STATISTICS_RESULT                      (M_3DIM_OBJECT          | 0x00000040L )
+#define M_3DIM_FILL_GAPS_CONTEXT                      (M_3DIM_OBJECT          | 0x00000080L )
+#define M_3DIM_PROFILE_RESULT                         (M_3DIM_OBJECT          | 0x00000100L )
+
+#define M_3D_DISPLAY_OBJECT                           (M_USER_ATTRIBUTE          | MAKE_INT64(0x0000008000000000))
+#define M_3D_DISPLAY                                  (M_3D_DISPLAY_OBJECT       | 0x00000001L )
+
+#define M_3D_GRAPHIC_LIST_OBJECT                      (M_USER_ATTRIBUTE          | MAKE_INT64(0x0000010000000000))
+#define M_3D_GRAPHIC_LIST                             (M_3D_GRAPHIC_LIST_OBJECT  | 0x00000001L ) 
+#define M_3D_GRAPHIC                                  (M_3D_GRAPHIC_LIST_OBJECT  | 0x00000002L ) 
+
+#define M_3DGEO_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0000800000000000))
+#define M_3DGEO_GEOMETRY                              (M_3DGEO_OBJECT         | 0x00000001L )
+#define M_3DGEO_TRANSFORMATION_MATRIX                 (M_3DGEO_OBJECT         | 0x00000002L )
+#define M_3DGEO_DRAW_3D_CONTEXT                       (M_3DGEO_OBJECT         | 0x00000004L )
+
+
+#define M_3DMET_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0002000000000000)) 
+#define M_3DMET_FIT_CONTEXT                           (M_3DMET_OBJECT         | 0x00000002L )
+#define M_3DMET_STATISTICS_CONTEXT                    (M_3DMET_OBJECT         | 0x00000004L )
+#define M_3DMET_DRAW_3D_CONTEXT                       (M_3DMAP_OBJECT         | 0x00000008L )
+#define M_3DMET_FIT_RESULT                            (M_3DMET_OBJECT         | 0x00000020L )
+#define M_3DMET_STATISTICS_RESULT                     (M_3DMET_OBJECT         | 0x00000040L )
+
+#define M_3DREG_OBJECT                                (M_USER_ATTRIBUTE       | MAKE_INT64(0x0004000000000000)) 
+#define M_3DREG_PAIRWISE_REGISTRATION_CONTEXT         (M_3DREG_OBJECT         | 0x00000001L )
+#define M_3DREG_PAIRWISE_REGISTRATION_RESULT          (M_3DREG_OBJECT         | 0x00000004L )
+
+
+#define M_VIDEO_DEVICE_OBJECT                         MAKE_INT64(0x0000010000000000)
+#define M_DIRECTX_VIDEO_DEVICE_OBJECT                 (M_VIDEO_DEVICE_OBJECT | 0x00000001L)
+#define M_EXTERNAL_VIDEO_DEVICE_OBJECT                (M_VIDEO_DEVICE_OBJECT | 0x00000002L)
+#define M_USER_DEFINE_LOW_ATTRIBUTE                   0x0000FFFFL
+
+#define M_SYSTEM_ALLOCATED                            0x00000001L
+#define M_USER_ALLOCATED                              MAKE_INT64(0x00000000FFFFFFFE)
+
+// For M_CONTAINER buffers
+#define M_GRAB                                        0x00000008L
+#define M_PROC                                        0x00000010L
+#define M_DISP                                        0x00000020L
+#if MIL_COMPILE_VERSION < 1040
+#define M_3D_SCENE                                    0x00000040L
+#define M_BUFFER_SEQUENCE                             0x00000080L
+#if OldDefinesSupport
+MIL_DEPRECATED(M_3D_SCENE, 1000)
+MIL_DEPRECATED(M_BUFFER_SEQUENCE, 1000)
+#endif
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_3D_SCENE                                    0
+#define M_BUFFER_SEQUENCE                             0
+#if OldDefinesSupport
+MIL_DEPRECATED(M_3D_SCENE, 1000)
+MIL_DEPRECATED(M_BUFFER_SEQUENCE, 1000)
+#endif
+#endif
+
+
+// For M_IMAGE buffers:
+#define M_DYNAMIC                                     0x00000002L
+#define M_IMAGE                                       0x00000004L
+#define M_GRAB                                        0x00000008L
+#define M_PROC                                        0x00000010L
+#define M_DISP                                        0x00000020L
+// 0x40 to used
+#define M_OVR                                         0x00000080L
+#define M_OFFSCREEN                                   M_OVR
+#define M_INTERNAL_FORMAT                             0x00003F00L
+#define M_COMPRESS                                    0x00004000L
+#define M_ALLOCATION_OVERSCAN                         0x00008000L              // This flag is also use as MbufControl/Inquire type and as MsysControl/Inquire type.
+#define M_FAST_OVERSCAN                               M_ALLOCATION_OVERSCAN
+#define M_FLIP                                        0x00010000L
+#define M_PACKED                                      0x00020000L
+#define M_PLANAR                                      0x00040000L
+#define M_ON_BOARD                                    0x00080000L
+#define M_OFF_BOARD                                   0x00100000L
+#define M_NON_PAGED                                   0x00200000L
+// 0x00400000 used with M_COMPRESS
+#define M_UND                                         0x00800000L // value also used with M_COMPRESS
+#define M_UNDERLAY                                    M_UND
+#define M_SINGLE                                      0x01000000L
+#define M_VIA                                         M_SINGLE
+#define M_PAGED                                       0x02000000L
+#define M_NO_FLIP                                     0x04000000L
+#define M_OVERSCAN_BUFFER                             0x08000000L // value also used with M_COMPRESS
+#define M_READ_PREFETCH_ENABLED                       0x10000000L
+//Keep only for backward compatibility.
+#define M_MMX_ENABLED                                 M_READ_PREFETCH_ENABLED
+#define M_SSE_ENABLED                                 M_READ_PREFETCH_ENABLED
+#define M_USER_ATTRIBUTE                              0x20000000L
+#define M_DDRAW                                       0x40000000L
+#define M_DIRECTX                                     M_DDRAW
+// 0x8000000 reserved
+
+#if !M_MIL_USE_LINUX
+#define M_NON_LOCAL_MEMORY                            MAKE_INT64(0x0000000800000000)
+#define M_BITMAP_HANDLE                               MAKE_INT64(0x0000008000000000)
+#endif
+// New define place in the 32 higher bits of the attribute
+#define M_GDI                                         MAKE_INT64(0x0000000100000000)
+#define M_HOST_MEMORY                                 MAKE_INT64(0x0000000200000000)
+#define M_VIDEO_MEMORY                                MAKE_INT64(0x0000000400000000)
+#define M_FAST_MEMORY                                 MAKE_INT64(0x0000001000000000)
+#define M_D3D_BUFFER                                  M_FAST_MEMORY
+#define M_SHARED                                      MAKE_INT64(0x0000002000000000)
+#define M_PRIMARY_SURFACE                             MAKE_INT64(0x0000004000000000)
+// BITS RESERVED FOR COMPLEX BUFFERS                     0x0000070000000000
+#define M_LIVE_VIDEO                                  MAKE_INT64(0x0000080000000000)
+#define M_AUDIO                                       MAKE_INT64(0x0000080000000000)
+#define M_MTX0                                        MAKE_INT64(0x0000100000000000)
+#define M_NON_CACHABLE                                MAKE_INT64(0x0000200000000000)
+// Available                                          MAKE_INT64(0x0000400000000000)
+// Available                                          MAKE_INT64(0x0000800000000000)
+
+//Linux specific buffer attribute
+#define M_LINUX_MXIMAGE                               MAKE_INT64(0x0800000000000000) // Same value as M_DIB
+
+#define M_MAPPABLE                                    MAKE_INT64(0x0001000000000000)
+//End of Linux specific buffer attribute
+#define M_AUX_VISIBLE                                 MAKE_INT64(0x0002000000000000)
+#define M_AUX                                         M_AUX_VISIBLE
+#define M_DISPLAY_AS_RGB10BIT                         MAKE_INT64(0x0004000000000000)
+#define M_DISPLAY_AS_YUV32                            MAKE_INT64(0x0080000000000000)
+#define M_NO_MEMORY                                   MAKE_INT64(0x0008000000000000)
+#define M_MEMORY_BANK_DEFAULT                         MAKE_INT64(0x0000000000000000)
+#define M_MEMORY_BANK_0                               MAKE_INT64(0x0010000000000000)
+#define M_MEMORY_BANK_1                               MAKE_INT64(0x0020000000000000)
+#define M_MEMORY_BANK_2                               MAKE_INT64(0x0030000000000000)
+#define M_MEMORY_BANK_3                               MAKE_INT64(0x0040000000000000)
+#define M_MEMORY_BANK_4                               MAKE_INT64(0x0050000000000000)
+#define M_MEMORY_BANK_5                               MAKE_INT64(0x0060000000000000)
+#define M_MEMORY_BANK_6                               MAKE_INT64(0x0070000000000000)
+#define M_MEMORY_BANK_MASK                            MAKE_INT64(0x0070000000000000)
+#define M_FPGA_ACCESSIBLE                             MAKE_INT64(0x0100000000000000)
+#define M_DYNAMIC_TEXTURE                             M_FPGA_ACCESSIBLE
+#define M_FPGA_MEMORY                                 M_FPGA_ACCESSIBLE //Obsolete, use M_FPGA_ACCESSIBLE
+#define M_OPENCL_COMPATIBLE                           MAKE_INT64(0x0200000000000000)
+#define M_D3D_OFFSCREEN_SURFACE                       MAKE_INT64(0x0400000000000000)
+#define M_DIB                                         MAKE_INT64(0x0800000000000000)
+#define M_PROC_GPU                                    MAKE_INT64(0x1000000000000000)
+#define M_DISPATTRIB_RESERVED                         MAKE_INT64(0x2000000000000000)
+#define M_DISP_EXTERNAL                               MAKE_INT64(0x4000000000000000)
+#define M_UNUSED_BITS                                 MAKE_INT64(0x8000000000000000) //Update when reusing bits for new defines
+
+
+#define M_IS_D3D_BUFFER(attrib)                       (((attrib)&(M_D3D_BUFFER|M_IMAGE|M_VIDEO_MEMORY))==(M_D3D_BUFFER|M_IMAGE|M_VIDEO_MEMORY))
+#define M_IS_FAST_MEMORY(attrib)                      ((((attrib)&M_FAST_MEMORY) != 0) && (((attrib)&M_VIDEO_MEMORY) == 0))
+
+#define M_IS_DYNAMIC_TEXTURE(attrib)                  (((attrib)&(M_DYNAMIC_TEXTURE|M_IMAGE|M_VIDEO_MEMORY))==(M_DYNAMIC_TEXTURE|M_IMAGE|M_VIDEO_MEMORY))
+#define M_IS_FPGA_ACCESSIBLE(attrib)                  ((((attrib)&M_FPGA_ACCESSIBLE) != 0) && (((attrib)&M_VIDEO_MEMORY) == 0))
+
+#define M_IS_OPENCL_COMPATIBLE(attrib)                (((attrib)&(M_OPENCL_COMPATIBLE)) == (M_OPENCL_COMPATIBLE))
+#define M_IS_D3D_OFFSCREEN_SURFACE(attrib)            (((attrib)&(M_IMAGE|M_D3D_OFFSCREEN_SURFACE)) == (M_IMAGE|M_D3D_OFFSCREEN_SURFACE))
+#define M_IS_PROC_GPU(attrib)                         (((attrib)&(M_PROC_GPU)) == (M_PROC_GPU))
+
+#if MIL_COMPILE_VERSION < 1040
+#define M_IS_3D_SCENE(attrib)                         (((attrib)&(M_3D_SCENE)) == (M_3D_SCENE))
+#define M_IS_BUFFER_SEQUENCE(attrib)                  (((attrib)&(M_BUFFER_SEQUENCE)) == (M_BUFFER_SEQUENCE))
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_IS_3D_SCENE(attrib)                         (false)
+#define M_IS_BUFFER_SEQUENCE(attrib)                  (false)
+#endif
+
+#if M_MIL_USE_WINDOWS
+// Attributes specific to one DirectX version
+#define M_IS_DDRAW7_SPECIFIC(attrib)                  (((((attrib)&(M_IMAGE|M_UNDERLAY))==(M_IMAGE|M_UNDERLAY)) && (((attrib)&M_COMPRESS) == 0))           || \
+                                                       (((attrib)&(M_LIVE_VIDEO|M_IMAGE))==(M_LIVE_VIDEO|M_IMAGE))                                         || \
+                                                       (((attrib)&(M_PRIMARY_SURFACE|M_IMAGE|M_VIDEO_MEMORY))==(M_PRIMARY_SURFACE|M_IMAGE|M_VIDEO_MEMORY)) || \
+                                                       (((attrib)&M_AUX_VISIBLE)==M_AUX_VISIBLE)                                                           || \
+                                                       (((attrib)&(M_NON_LOCAL_MEMORY|M_IMAGE))==(M_NON_LOCAL_MEMORY|M_IMAGE))                             || \
+                                                       (M_IS_DDRAW7_SPECIFIC_BITS(attrib)))
+
+#define M_IS_D3D9_SPECIFIC(attrib)                    (M_IS_DYNAMIC_TEXTURE(attrib) || M_IS_D3D_OFFSCREEN_SURFACE(attrib))
+#define M_IS_D3D10_SPECIFIC(attrib)                   (false)
+#define M_IS_D3D11_SPECIFIC(attrib)                   (M_IS_D3D_BUFFER(attrib))
+
+#define M_IS_DIRECTX_SPECIFIC(attrib)                 ((attrib&M_DIRECTX) == M_DIRECTX || M_IS_DDRAW7_SPECIFIC(attrib) || M_IS_D3D9_SPECIFIC(attrib) || M_IS_D3D10_SPECIFIC(attrib) || M_IS_D3D11_SPECIFIC(attrib))
+
+// Attributes incompatible with one DirectX version
+#define M_IS_DDRAW7_INCOMPATIBLE(attrib)              (M_IS_PROC_GPU(attrib) || M_IS_OPENCL_COMPATIBLE(attrib) || M_IS_D3D9_SPECIFIC(attrib) || M_IS_D3D10_SPECIFIC(attrib) || M_IS_D3D11_SPECIFIC(attrib))
+#define M_IS_D3D9_INCOMPATIBLE(attrib)                (M_IS_OPENCL_COMPATIBLE(attrib) || M_IS_DDRAW7_SPECIFIC(attrib) || M_IS_D3D10_SPECIFIC(attrib) || M_IS_D3D11_SPECIFIC(attrib))
+#define M_IS_D3D10_INCOMPATIBLE(attrib)               (M_IS_DDRAW7_SPECIFIC(attrib) || M_IS_D3D9_SPECIFIC(attrib)  || M_IS_D3D11_SPECIFIC(attrib))
+#define M_IS_D3D11_INCOMPATIBLE(attrib)               (M_IS_DDRAW7_SPECIFIC(attrib) || M_IS_D3D9_SPECIFIC(attrib)  || M_IS_D3D10_SPECIFIC(attrib))
+
+// Bits specific to one DirectX version
+// DDraw7 specific bits
+#define M_DDRAW7_SPECIFIC_BITS                        (M_UNDERLAY|M_LIVE_VIDEO|M_PRIMARY_SURFACE|M_AUX_VISIBLE|M_NON_LOCAL_MEMORY)
+#define M_IS_DDRAW7_SPECIFIC_BITS(attrib)             ((attrib&(M_DDRAW7_SPECIFIC_BITS)))
+#endif // M_MIL_USE_WINDOWS
+
+// Incompatible bits mask
+#define M_HOST_MEMORY_INCOMPATIBLE_BITS               (M_UNDERLAY|M_VIDEO_MEMORY|M_PRIMARY_SURFACE|M_LIVE_VIDEO|M_AUX_VISIBLE|M_PROC_GPU)
+#define M_OVR_INCOMPATIBLE_BITS                       (M_UNDERLAY|M_PRIMARY_SURFACE|M_AUX_VISIBLE)
+#define M_OFFSCREEN_INCOMPATIBLE_BITS                 M_OVR_INCOMPATIBLE_BITS
+#define M_UNDERLAY_INCOMPATIBLE_BITS                  (M_HOST_MEMORY|M_OVR|M_PROC_GPU)
+
+#define M_COMPLEX_SURFACE_OFFSET                      (40)
+#define M_COMPLEX_SURFACE_MASK                        (((MIL_INT64)0x7)<<M_COMPLEX_SURFACE_OFFSET)
+#define M_IS_COMPLEX_SURFACE(attrib)                  ((((attrib)&M_COMPLEX_SURFACE_MASK) != 0) && (((attrib)&M_COMPRESS) == 0) && (((attrib)&M_VIDEO_MEMORY) != 0))
+#define M_COMPLEX_SURFACE(_nb)                        ((((MIL_INT64)(_nb))<<M_COMPLEX_SURFACE_OFFSET)&M_COMPLEX_SURFACE_MASK)
+#define M_COMPLEX_NB_BUFFER(attrib)                   ((((attrib)&M_COMPRESS) != 0)?0:((long)(((MIL_INT64)(attrib)&M_COMPLEX_SURFACE_MASK)>>M_COMPLEX_SURFACE_OFFSET)))
+
+#define M_MEMORY_BANK_OFFSET                          52
+#define M_MEMORY_BANK_TO_USE(attrib)                  ((((attrib)&M_MEMORY_BANK_MASK)>>M_MEMORY_BANK_OFFSET)-1)
+
+#define M_COMPRESSION_FORMAT_MASK                     0x08C08000L
+
+#define M_JPEG_LOSSLESS                               0x00400000L
+#define M_JPEG_LOSSY                                  0x00800000L
+#define M_JPEG_LOSSLESS_INTERLACED                    0x00C00000L
+#define M_JPEG_LOSSY_INTERLACED                       0x08000000L
+#define M_JPEG2000_LOSSY                              0x08400000L
+#define M_JPEG2000_LOSSLESS                           0x08800000L
+#define M_MPEG4                                       0x08C00000L
+#define M_H264                                        0x00008000L
+#define M_RLE                                         0x00408000L
+#define M_RLE_LABEL                                   0x00808000L
+
+/*
+Reserved compression format                           0x00C08000L
+Reserved compression format                           0x08008000L
+Reserved compression format                           0x08408000L
+Reserved compression format                           0x08808000L
+Reserved compression format                           0x08C08000L
+*/
+
+#define M_IS_LOSSY(a)                                 (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY_INTERLACED) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG2000_LOSSY) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_MPEG4) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_H264)))
+#define M_IS_LOSSLESS(a)                              (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS_INTERLACED) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG2000_LOSSLESS) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_RLE) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_RLE_LABEL)))
+#define M_IS_JPEG(a)                                  (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS_INTERLACED) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY_INTERLACED)))
+#define M_IS_JPEG2000(a)                              (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG2000_LOSSY) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG2000_LOSSLESS)))
+#define M_IS_MPEG4(a)                                 (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_MPEG4)))
+#define M_IS_H264(a)                                  (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_H264)))
+#define M_IS_INTERLACED(a)                            (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSY_INTERLACED) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_JPEG_LOSSLESS_INTERLACED)))
+#define M_IS_RLE(a)                                   (M_IS_COMPRESSED(a) && \
+                                                       ((((a) & M_COMPRESSION_FORMAT_MASK) == M_RLE) || \
+                                                        (((a) & M_COMPRESSION_FORMAT_MASK) == M_RLE_LABEL)))
+#define M_COMPRESSION_FORMAT(a)                       (M_IS_COMPRESSED(a) ? ((a) & M_COMPRESSION_FORMAT_MASK) : 0)
+#define M_IS_COMPRESSED(a)                            ((((a) & M_IMAGE) != 0) && (((a) & M_COMPRESS) != 0))
+#define M_IS_AUDIO(a)                                 ((((a) & M_ARRAY) != 0) && (((a) & M_AUDIO) != 0))
+#define M_IS_PACKED_LUT(a)                            (((a&M_IMAGE)==0) && ((a&~(M_READ_PREFETCH_ENABLED|M_DIRECTX|M_VIDEO_MEMORY|M_HOST_MEMORY|M_PROC_GPU|M_NON_PAGED|M_PAGED)) == (M_LUT|M_PACKED|M_BGR32)))
+#define M_IS_ON_BOARD(a)                              (((a) & M_HOST_MEMORY) ? M_FALSE : (((a) & M_ON_BOARD) ? M_TRUE : (((a) & M_MEMORY_BANK_MASK) ? M_TRUE : (M_IS_FPGA_ACCESSIBLE(a) ? M_TRUE : M_FALSE))))
+#define M_IS_ON_BOARD_OR_VIDEO_MEMORY(a)              (M_IS_ON_BOARD(a) || (((a) & M_VIDEO_MEMORY) != 0))
+
+/* 6 bits reserved for buffer internal format and format definitions */
+#define M_INTERNAL_FORMAT             0x00003F00L
+#define M_INTERNAL_FORMAT_SHIFT       8L
+#define M_INTERNAL_COMPLETE_FORMAT    0x7FFFFF80L
+#define M_ANY_INTERNAL_FORMAT         (0   << M_INTERNAL_FORMAT_SHIFT)
+
+// Range for MONO formats : 1 to 5.
+#define M_MONO_RANGE_START                (1   << M_INTERNAL_FORMAT_SHIFT)
+#define M_MONO1                           (1   << M_INTERNAL_FORMAT_SHIFT)   // Force  1 bit  pixels in monochrome format
+#define M_MONO8                           (2   << M_INTERNAL_FORMAT_SHIFT)   // Force  8 bits pixels in monochrome format
+#define M_MONO16                          (3   << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in monochrome format
+#define M_MONO32                          (4   << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in monochrome format
+/* AVAILABLE                              (5) */
+#define M_MONO_RANGE_END                  (5   << M_INTERNAL_FORMAT_SHIFT)
+
+// Extended range for MONO formats : 41 to 47.
+#define M_MONO_EXTENDED_RANGE_START       (41  << M_INTERNAL_FORMAT_SHIFT)
+#define M_MONO64                          (41  << M_INTERNAL_FORMAT_SHIFT)   // Force 64 bits pixels in monochrome format
+/* AVAILABLE                              (42 to 47) */
+#define M_MONO_EXTENDED_RANGE_END         (47  << M_INTERNAL_FORMAT_SHIFT)
+
+// Range for RGB and BGR formats : 6 to 20.
+#define M_RGB_BGR_RANGE_START             (6   << M_INTERNAL_FORMAT_SHIFT)
+#define M_RGB15                           (6   << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in color XRGB  1.5.5.5  format
+#define M_RGB16                           (7   << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in color RGB   5.6.5    format
+#define M_RGB24                           (8   << M_INTERNAL_FORMAT_SHIFT)   // Force 24 bits pixels in color RGB   8.8.8    format
+#define M_RGBX32                          (9   << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color RGBX  8.8.8.8  format
+#define M_RGB32                           M_RGBX32
+#define M_XRGB32                          (10  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color XRGB  8.8.8.8  format
+#define M_RGB48                           (11  << M_INTERNAL_FORMAT_SHIFT)   // Force 48 bits pixels in color RGB  16.16.16  format
+#define M_RGB96                           (12  << M_INTERNAL_FORMAT_SHIFT)   // Force 96 bits pixels in color RGB  32.32.32  format
+#define M_RGB3                            (13  << M_INTERNAL_FORMAT_SHIFT)   // Force  3 bits pixels in color RGB   1.1.1    format
+#define M_BGR15                           (14  << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in color BGRX  5.5.5.1  format
+#define M_BGR16                           (15  << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits pixels in color BGR   5.6.5    format
+#define M_BGR24                           (16  << M_INTERNAL_FORMAT_SHIFT)   // Force 24 bits pixels in color BGR   8.8.8    format
+#define M_BGRX32                          (17  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color BGRX  8.8.8.8  format
+#define M_BGR32                           M_BGRX32
+#define M_XBGR32                          (18  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color XBGR  8.8.8.8  format
+#define M_BGR30                           (19  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color XBGR  2.10.10.10  format
+#define M_RGB192                          (20  << M_INTERNAL_FORMAT_SHIFT)   // Force 192 bits pixels in color RGB  64.64.64  format
+#define M_RGB_BGR_RANGE_END               (20  << M_INTERNAL_FORMAT_SHIFT)
+
+// Extended range for RGB and BGR formats : 48 to 55.
+#define M_RGB_BGR_EXTENDED_RANGE_START    (48  << M_INTERNAL_FORMAT_SHIFT)
+/* AVAILABLE                              (48 to 55) */
+#define M_RGB_BGR_EXTENDED_RANGE_END      (55  << M_INTERNAL_FORMAT_SHIFT)
+
+// Range for YUV formats : 21 to 40.
+#define M_YUV_RANGE_START                 (21  << M_INTERNAL_FORMAT_SHIFT)
+#define M_YUV9                            (21  << M_INTERNAL_FORMAT_SHIFT)   // Force  9 bits YUV pixels in color YUV 16:1:1 format
+#define M_YUV1611                         M_YUV9
+#define M_YUV12                           (22  << M_INTERNAL_FORMAT_SHIFT)   // Force 12 bits YUV pixels in color YUV  4:1:1 format
+#define M_YUV411                          M_YUV12
+#define M_YUV16                           (23  << M_INTERNAL_FORMAT_SHIFT)   // Force 16 bits YUV pixels in color YUV  4:2:2 format
+#define M_YUV422                          M_YUV16
+/* AVAILABLE                              (24 to 26) */
+#define M_YUV24                           (27  << M_INTERNAL_FORMAT_SHIFT)   // Force 24 bits YUV pixels in color YUV  4:4:4 format
+#define M_YUV444                          M_YUV24
+#define M_YUV16_YUYV                      (28  << M_INTERNAL_FORMAT_SHIFT)   // Force YUV16 packed buffers into a YUYV memory layout ( meteor, corona, meteor2 ) (FOURCC: YUY2).
+#define M_YUV422_YUYV                     M_YUV16_YUYV
+#define M_YUV16_UYVY                      (29  << M_INTERNAL_FORMAT_SHIFT)   // Force YUV16 packed buffers into a UYVY memory layout ( meteor ) (FOURCC: UYVY).
+#define M_YUV16_1394                      M_YUV16_UYVY
+#define M_YUV422_UYVY                     M_YUV16_UYVY
+#define M_YUV422_1394                     M_YUV16_1394
+/* AVAILABLE                              (30) */
+#define M_YUV12_1394                      (31  << M_INTERNAL_FORMAT_SHIFT)   // Force YUV12 packed buffers with the special memory layout of the 1394.
+#define M_YUV411_1394                     M_YUV12_1394
+#define M_YUV32                           (32  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits YUV pixels in color (8(X)-8(Y)-8(U)-8(V))
+/* AVAILABLE                              (33 to 40) */
+#define M_YUV_RANGE_END                   (40  << M_INTERNAL_FORMAT_SHIFT)
+
+// Extended range for YUV formats : 56 to 63.
+#define M_YUV_EXTENDED_RANGE_START        (56  << M_INTERNAL_FORMAT_SHIFT)
+/* AVAILABLE                              (56 to 63) */
+#define M_YUV_EXTENDED_RANGE_END          (63 << M_INTERNAL_FORMAT_SHIFT)
+
+#define M_SINGLE_BAND                     (255 << M_INTERNAL_FORMAT_SHIFT)   // PutColor and GetColor specification for a single band
+
+
+#define M_COMPRESSED_DATA                 1
+
+
+#define M_IS_FORMAT_MONO(f)               ((((f & M_INTERNAL_FORMAT) >= M_MONO_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_MONO_RANGE_END)) || \
+                                           (((f & M_INTERNAL_FORMAT) >= M_MONO_EXTENDED_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_MONO_EXTENDED_RANGE_END)))
+
+#define M_IS_FORMAT_RGB_BGR(f)            ((((f & M_INTERNAL_FORMAT) >= M_RGB_BGR_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_RGB_BGR_RANGE_END)) || \
+                                           (((f & M_INTERNAL_FORMAT) >= M_RGB_BGR_EXTENDED_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_RGB_BGR_EXTENDED_RANGE_END)))
+
+#define M_IS_FORMAT_YUV(f)                ((((f & M_INTERNAL_FORMAT) >= M_YUV_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_YUV_RANGE_END)) || \
+                                           (((f & M_INTERNAL_FORMAT) >= M_YUV_EXTENDED_RANGE_START) && \
+                                            ((f & M_INTERNAL_FORMAT) <= M_YUV_EXTENDED_RANGE_END)))
+
+#define M_BIT_FIELD_FORMAT(f)             (((MIL_INT) 1) << (((f & M_INTERNAL_FORMAT) >> M_INTERNAL_FORMAT_SHIFT) - 1))
+
+// The following MACRO keep only attribute used by the host.
+#define M_KEEP_HO_ATTRIBUTES(a)                                                               \
+   ((a&M_IMAGE) ?                                                                             \
+      (a&(M_INTERNAL_FORMAT|M_IMAGE|M_PACKED|M_PLANAR|M_COMPRESS|M_COMPRESSION_FORMAT_MASK|   \
+          M_FLIP|M_NO_FLIP|M_NON_PAGED|M_PAGED|M_READ_PREFETCH_ENABLED|                       \
+          M_HOST_MEMORY))                                                                     \
+   :  (a))
+
+//Attributes accepted by all non-M_IMAGE buffers on the Host
+#define MIL_MEMORY_SPECIFIERS (M_PAGED | M_NON_PAGED | M_OFF_BOARD | M_HOST_MEMORY | M_MAPPABLE | M_READ_PREFETCH_ENABLED)
+
+// The following MACRO takes a data format as input and returns the number
+// of bits per pixel that it implies as an output.
+// For an unknown data format, it returns M_INVALID.
+#define NB_OF_BITS_PER_PIXEL(DataFormat,NbOfBits)             \
+   switch( ((DataFormat) & M_INTERNAL_FORMAT) )               \
+      {                                                       \
+      case M_MONO1:        NbOfBits = 1;         break;       \
+      case M_MONO8:        NbOfBits = 8;         break;       \
+      case M_MONO16:       NbOfBits = 16;        break;       \
+      case M_MONO32:       NbOfBits = 32;        break;       \
+      case M_MONO64:       NbOfBits = 64;        break;       \
+      case M_RGB15:        NbOfBits = 16;        break;       \
+      case M_RGB16:        NbOfBits = 16;        break;       \
+      case M_RGB24:        NbOfBits = 24;        break;       \
+      case M_RGBX32:       NbOfBits = 32;        break;       \
+      case M_XRGB32:       NbOfBits = 32;        break;       \
+      case M_RGB48:        NbOfBits = 48;        break;       \
+      case M_RGB96:        NbOfBits = 96;        break;       \
+      case M_RGB192:       NbOfBits = 192;       break;       \
+      case M_RGB3:         NbOfBits = 3;         break;       \
+      case M_BGR15:        NbOfBits = 16;        break;       \
+      case M_BGR16:        NbOfBits = 16;        break;       \
+      case M_BGR24:        NbOfBits = 24;        break;       \
+      case M_BGRX32:       NbOfBits = 32;        break;       \
+      case M_XBGR32:       NbOfBits = 32;        break;       \
+      case M_BGR30:        NbOfBits = 32;        break;       \
+                                                              \
+      case M_YUV9:         NbOfBits = 9;         break;       \
+      case M_YUV12:        NbOfBits = 12;        break;       \
+      case M_YUV16:        NbOfBits = 16;        break;       \
+      case M_YUV24:        NbOfBits = 24;        break;       \
+      case M_YUV16_YUYV:   NbOfBits = 16;        break;       \
+      case M_YUV16_UYVY:   NbOfBits = 16;        break;       \
+      case M_YUV12_1394:   NbOfBits = 12;        break;       \
+      default:             NbOfBits = M_INVALID; break;       \
+      }
+
+// The following MACRO takes a data format as input and returns the number
+// of bits per pixel per plane that it implies as an output.
+// For an unknown data format, it returns M_INVALID.
+// It is better to compare the format with M_PACKED, because M_PLANAR is
+// not always present on planar buffers.
+#define M_NB_BITS_PER_PIXEL_PER_PLANE(DataFormat,NbOfBits)       \
+  switch( ((DataFormat) & M_INTERNAL_FORMAT)  )                  \
+     {                                                           \
+     /* M_PACKED is implicit */                                  \
+     case M_MONO1:        NbOfBits = 1;         break;           \
+     case M_MONO8:        NbOfBits = 8;         break;           \
+     case M_MONO16:       NbOfBits = 16;        break;           \
+     case M_MONO32:       NbOfBits = 32;        break;           \
+     case M_MONO64:       NbOfBits = 64;        break;           \
+     case M_RGB15:        NbOfBits = 16;        break;           \
+     case M_RGB16:        NbOfBits = 16;        break;           \
+     case M_RGBX32:       NbOfBits = 32;        break;           \
+     case M_XRGB32:       NbOfBits = 32;        break;           \
+     case M_BGR15:        NbOfBits = 16;        break;           \
+     case M_BGR16:        NbOfBits = 16;        break;           \
+     case M_BGR24:        NbOfBits = 24;        break;           \
+     case M_BGRX32:       NbOfBits = 32;        break;           \
+     case M_XBGR32:       NbOfBits = 32;        break;           \
+     case M_BGR30:        NbOfBits = 32;        break;           \
+     case M_YUV16_YUYV:   NbOfBits = 16;        break;           \
+     case M_YUV16_UYVY:   NbOfBits = 16;        break;           \
+     /* M_PLANAR is implicit */                                  \
+     case M_RGB3:         NbOfBits = 1;         break;           \
+     case M_RGB192:       NbOfBits = 64;        break;           \
+     /* Ambiguous internal format */                             \
+     default:                                                    \
+        if((DataFormat)&M_PACKED)                                \
+           {                                                     \
+           switch(((DataFormat) & M_INTERNAL_FORMAT))            \
+              {                                                  \
+              case M_RGB24:        NbOfBits = 24;        break;  \
+              case M_RGB48:        NbOfBits = 48;        break;  \
+              case M_RGB96:        NbOfBits = 96;        break;  \
+              case M_YUV9:         NbOfBits = 9;         break;  \
+              case M_YUV12:        NbOfBits = 12;        break;  \
+              case M_YUV16:        NbOfBits = 16;        break;  \
+              case M_YUV24:        NbOfBits = 24;        break;  \
+              case M_YUV12_1394:   NbOfBits = 12;        break;  \
+              default:             NbOfBits = M_INVALID; break;  \
+              }                                                  \
+           }                                                     \
+        /* If packed is not present, consider planar */          \
+        else                                                     \
+           {                                                     \
+           switch(((DataFormat) & M_INTERNAL_FORMAT))            \
+              {                                                  \
+              case M_RGB24:        NbOfBits = 8;         break;  \
+              case M_RGB48:        NbOfBits = 16;        break;  \
+              case M_RGB96:        NbOfBits = 32;        break;  \
+              case M_YUV9:         NbOfBits = 8;         break;  \
+              case M_YUV12:        NbOfBits = 8;         break;  \
+              case M_YUV16:        NbOfBits = 8;         break;  \
+              case M_YUV24:        NbOfBits = 8;         break;  \
+              case M_YUV12_1394:   NbOfBits = 8;         break;  \
+              default:             NbOfBits = M_INVALID; break;  \
+              }                                                  \
+           }                                                     \
+        break;                                                   \
+     }
+
+#define MONO_FORMAT_FROM_SIZEBIT(MonoFormat, NbOfBits)             \
+   switch( NbOfBits)                                               \
+      {                                                            \
+      case 1:        MonoFormat = M_MONO1;         break;          \
+      case 8:        MonoFormat = M_MONO8;         break;          \
+      case 16:       MonoFormat = M_MONO16;        break;          \
+      case 32:       MonoFormat = M_MONO32;        break;          \
+      case 64:       MonoFormat = M_MONO64;        break;          \
+      default:       MonoFormat = M_INVALID;       break;          \
+      }
+
+// The following MACRO takes a data format as input and returns 
+// the buffer type that is associated with it.
+// For an unknown data format, it returns M_INVALID.
+#define M_TYPE_FROM_FORMAT(DataFormat,Type)                 \
+   switch( ((DataFormat) & M_INTERNAL_FORMAT) )             \
+      {                                                     \
+      case M_MONO1:        Type = 1+M_UNSIGNED;     break;  \
+      case M_MONO8:        Type = 8+M_UNSIGNED;     break;  \
+      case M_MONO16:       Type = 16+M_UNSIGNED;    break;  \
+      case M_MONO32:       Type = 32+M_UNSIGNED;    break;  \
+      case M_MONO64:       Type = 64+M_UNSIGNED;    break;  \
+                                                            \
+      case M_RGB15:        Type = 8+M_UNSIGNED;     break;  \
+      case M_RGB16:        Type = 8+M_UNSIGNED;     break;  \
+      case M_RGB24:        Type = 8+M_UNSIGNED;     break;  \
+      case M_RGBX32:       Type = 8+M_UNSIGNED;     break;  \
+      case M_XRGB32:       Type = 8+M_UNSIGNED;     break;  \
+      case M_RGB48:        Type = 16+M_UNSIGNED;    break;  \
+      case M_RGB96:        Type = 32+M_UNSIGNED;    break;  \
+      case M_RGB192:       Type = 64+M_UNSIGNED;    break;  \
+      case M_RGB3:         Type = 1+M_UNSIGNED;     break;  \
+                                                            \
+      case M_BGR15:        Type = 8+M_UNSIGNED;     break;  \
+      case M_BGR16:        Type = 8+M_UNSIGNED;     break;  \
+      case M_BGR24:        Type = 8+M_UNSIGNED;     break;  \
+      case M_BGRX32:       Type = 8+M_UNSIGNED;     break;  \
+      case M_XBGR32:       Type = 8+M_UNSIGNED;     break;  \
+      case M_BGR30:        Type = 10+M_UNSIGNED;    break;  \
+                                                            \
+      case M_YUV9:         Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV12:        Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV16:        Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV24:        Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV16_YUYV:   Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV16_UYVY:   Type = 8+M_UNSIGNED;     break;  \
+      case M_YUV12_1394:   Type = 8+M_UNSIGNED;     break;  \
+      default:             Type = M_INVALID;        break;  \
+      }
+
+
+// The following MACRO compare 2 attribute and return (boolean)
+//  if the internal format are equivalent. Two internal format
+//  are equivalent if the internal format is equal. The YUV16
+//  is a special case since M_YUV16 is used to define one
+//  of the 2 YUV16 type: YUYV and UYVY
+#define M_EQUIVALENT_INTERNAL_FORMAT(a,b)                                              \
+   (  (a&M_INTERNAL_FORMAT) == (b&M_INTERNAL_FORMAT)                             ||    \
+      ((a&M_INTERNAL_FORMAT)==M_YUV16  &&  (b&M_INTERNAL_FORMAT)==M_YUV16_YUYV)  ||    \
+      ((a&M_INTERNAL_FORMAT)==M_YUV16  &&  (b&M_INTERNAL_FORMAT)==M_YUV16_UYVY)  ||    \
+      ((b&M_INTERNAL_FORMAT)==M_YUV16  &&  (a&M_INTERNAL_FORMAT)==M_YUV16_YUYV)  ||    \
+      ((b&M_INTERNAL_FORMAT)==M_YUV16  &&  (a&M_INTERNAL_FORMAT)==M_YUV16_UYVY)    )   \
+
+// !!! MAP FOR OLD DEFINES
+#if OldDefinesSupport
+#define M_CHAR                        (M_MONO8     | M_SIGNED)
+MIL_DEPRECATED(M_CHAR, 1000)
+#define M_UCHAR                       (M_MONO8)
+MIL_DEPRECATED(M_UCHAR, 1000)
+#define M_SHORT                       (M_MONO16    | M_SIGNED)
+MIL_DEPRECATED(M_SHORT, 1000)
+#define M_USHORT                      (M_MONO16)
+MIL_DEPRECATED(M_USHORT, 1000)
+#define M_LONG                        (M_MONO32    | M_SIGNED)
+MIL_DEPRECATED(M_LONG, 1000)
+#define M_ULONG                       (M_MONO32)
+MIL_DEPRECATED(M_ULONG, 1000)
+#define M_RGB555                      (M_RGB15     | M_SIGNED)
+MIL_DEPRECATED(M_RGB555, 1000)
+#define M_URGB555                     (M_RGB15)
+MIL_DEPRECATED(M_URGB555, 1000)
+#define M_URGB888                     (M_RGB24)
+MIL_DEPRECATED(M_URGB888, 1000)
+#define M_RGB161616                   (M_RGB48     | M_SIGNED)
+MIL_DEPRECATED(M_RGB161616, 1000)
+#define M_URGB161616                  (M_RGB48)
+MIL_DEPRECATED(M_URGB161616, 1000)
+#define M_RGB323232                   (M_RGB96     | M_SIGNED)
+MIL_DEPRECATED(M_RGB323232, 1000)
+#define M_URGB323232                  (M_RGB96)
+MIL_DEPRECATED(M_URGB323232, 1000)
+#define M_YUV9_PLANAR                 (M_YUV9      | M_PLANAR)
+MIL_DEPRECATED(M_YUV9_PLANAR, 1000)
+#define M_YUV12_PLANAR                (M_YUV12     | M_PLANAR)
+MIL_DEPRECATED(M_YUV12_PLANAR, 1000)
+#define M_YUV16_PLANAR                (M_YUV16     | M_PLANAR)
+MIL_DEPRECATED(M_YUV16_PLANAR, 1000)
+#define M_YUV16_PACKED                (M_YUV16     | M_PACKED)
+MIL_DEPRECATED(M_YUV16_PACKED, 1000)
+#define M_BGR15_PACKED                (M_BGR15     | M_PACKED)
+MIL_DEPRECATED(M_BGR15_PACKED, 1000)
+#define M_RGB24_PACKED                (M_RGB24     | M_PACKED)
+MIL_DEPRECATED(M_RGB24_PACKED, 1000)
+#define M_RGB32_PACKED                (M_RGB32     | M_PACKED)
+MIL_DEPRECATED(M_RGB32_PACKED, 1000)
+#define M_BGR24_PACKED                (M_BGR24     | M_PACKED)
+MIL_DEPRECATED(M_BGR24_PACKED, 1000)
+#define M_NODIBFLIP                   (M_FLIP)
+MIL_DEPRECATED(M_NODIBFLIP, 1000)
+#if !M_MIL_USE_LINUX
+#define M_DIB_BGR24_PACKED            (M_BGR24     | M_PACKED | M_FLIP | M_DIB)
+MIL_DEPRECATED(M_DIB_BGR24_PACKED, 1000)
+#else
+#define M_DIB_BGR24_PACKED            (M_BGR24     | M_PACKED | M_FLIP )
+MIL_DEPRECATED(M_DIB_BGR24_PACKED, 1000)
+#endif
+#define M_BGR32_PACKED                (M_BGR32     | M_PACKED)
+MIL_DEPRECATED(M_BGR32_PACKED, 1000)
+#endif
+
+#define M_USE                   0x00001000L    // The region (if it exists) is used normally
+#define M_IGNORE                0x00002000L    // The region is ignored in all processing
+#define M_MODIFY                       999L    // The region is ignored for processing, but is modified to fit written content
+
+/************************************************************************/
+/* MbufCreateColor() ControlFlags                                       */
+/************************************************************************/
+#define M_ALIGNMENT_RESERVED_BITS                     0x000000FFL
+#define M_VIDEO_DEVICE_MASK                           0x00000F00L
+#define M_NO_4GB_BORDERS                              0x00001000L
+#define M_NO_PARSING                                  0x00002000L
+#define M_WRITE_COMBINING                             16384L      // 0x00004000L
+#define M_64BIT_PHYSICAL_ADDRESS                      0x00008000L
+#define M_HOST_ADDRESS                                0x00010000L // Was 0x80000000L
+#define M_MIL_ID                                      0x00020000L
+#define M_FIRST_MIL_BUFFER                            0x00040000L
+#define M_HOST_ADDRESS_REMOTE                         0x00080000L
+#define M_ALLOCATION                                  0x00100000L
+#define M_NAME                                        (0x00200000L | M_CLIENT_ENCODING)
+#define M_PHYSICAL_ADDRESS_REMOTE                     0x00400000L
+#define M_DIRECTX_CREATION                            0x00800000L
+#define M_CACHABLE                                    0x01000000L
+// Free                                               0x02000000L
+#define M_NO_MAP                                      0x04000000L
+#define M_PITCH_BYTE                                  0x08000000L
+#define M_DEFAULT                                     0x10000000L
+#define M_PITCH                                       0x20000000L
+#define M_PHYSICAL_ADDRESS                            0x40000000L
+
+// MAKE_INT64(0x0000000080000000) // Reserved
+#define M_BELOW_4GB                                   MAKE_INT64(0x0000000100000000)
+#define M_ABOVE_4GB                                   MAKE_INT64(0x0000000200000000)
+// MAKE_INT64(0x0000000400000000)
+// MAKE_INT64(0x0000000800000000)
+// MAKE_INT64(0x0000001000000000)
+// MAKE_INT64(0x0000002000000000)
+// MAKE_INT64(0x0000004000000000)
+// MAKE_INT64(0x0000008000000000)
+// MAKE_INT64(0x0000010000000000)
+// MAKE_INT64(0x0000020000000000)
+// MAKE_INT64(0x0000040000000000)
+// MAKE_INT64(0x0000080000000000)
+// MAKE_INT64(0x0000100000000000)
+#define M_NON_CACHABLE                                MAKE_INT64(0x0000200000000000)
+// MAKE_INT64(0x0000400000000000)
+// MAKE_INT64(0x0000800000000000)
+// MAKE_INT64(0x0001000000000000)
+// MAKE_INT64(0x0002000000000000)
+// MAKE_INT64(0x0004000000000000)
+// MAKE_INT64(0x0008000000000000)
+// MAKE_INT64(0x0010000000000000)
+// MAKE_INT64(0x0020000000000000)
+// MAKE_INT64(0x0040000000000000)
+// MAKE_INT64(0x0080000000000000)
+// MAKE_INT64(0x0100000000000000)
+// MAKE_INT64(0x0200000000000000)
+// MAKE_INT64(0x0400000000000000)
+// MAKE_INT64(0x0800000000000000)
+// MAKE_INT64(0x1000000000000000)
+// MAKE_INT64(0x2000000000000000)
+// MAKE_INT64(0x4000000000000000)
+// MAKE_INT64(0x8000000000000000)
+
+
+#define M_ADDRESS_ALIGNMENT(n)                                (n)
+
+#define M_VIDEO_DEVICE_OFFSET                         8L
+#define M_VIDEO_DEVICE(dev)                           ((((dev)+1)<<M_VIDEO_DEVICE_OFFSET)&M_VIDEO_DEVICE_MASK)
+#define M_VIDEO_DEVICE_TO_USE(cf)                     ((((cf)&M_VIDEO_DEVICE_MASK)>>M_VIDEO_DEVICE_OFFSET)-1)
+
+#define M_INFINITE                                    -1L
+
+/************************************************************************/
+/* MbufClone() ControlFlags                                             */
+/************************************************************************/
+#if OldDefinesSupport
+#define  M_COPY_SRC_DATA      0x00000001L    //Copy source data contain.
+MIL_DEPRECATED(M_COPY_SRC_DATA, 1060)
+#endif
+#define  M_COPY_SOURCE_DATA   0x00000001L    //Copy source data contain. Replace M_COPY_SRC_DATA.
+
+/************************************************************************/
+/* MbufBlit() Values                                                    */
+/************************************************************************/
+
+// A combination of flags that determine the valid members of the MBLTDESC structure.
+#define M_BLT_REGION       0x00000001L  // Uses the lRegion member of the MBLTDESC structure to determine which region to copy.
+#define M_BLT_MODE         0x00000002L  // Uses the lMode member of the MBLTDESC structure to determine if the blit is synchronous or not.
+#define M_BLT_TYPE         0x00000004L  // Uses the lType member of the MBLTDESC structure to determine the type of the copy.
+#define M_BLT_DESTRECT     0x00000008L  // Uses the lDestRect member of the MBLTDESC structure to determine the valid destination rectangle.
+#define M_BLT_SRCRECT      0x00000010L  // Uses the lSrcRect member of the MBLTDESC structure to determine the valid source rectangle.
+
+
+
+// Indicate which region (M_BLT_REGION) to copy from the source buffer to the destination buffer (the default is M_BLT_FRAME).
+// The valid values for this member are:
+#define M_BLT_FRAME        1  // Blit all lines of the source buffer in the destination buffer. ***DEFAULT***
+#define M_BLT_ODD          2  // Blit all lines from the sources buffer to ODD lines of the destination buffer.
+#define M_BLT_EVEN         3  // Blit all lines from the sources buffer to EVEN lines of the destination buffer.
+#define M_BLT_ODD_ODD      4  // Blit ODD lines from the sources buffer to ODD lines of the destination buffer.
+#define M_BLT_EVEN_EVEN    5  // Blit EVEN lines from the sources buffer to EVEN lines of the destination buffer.
+
+// Indicate if the blit (M_BLT_MODE) is done asynchronously or synchronously (the default is synchronously). The valid value are:
+#define M_BLT_ASYNC        10  // Performs this blit asynchronously.
+#define M_BLT_SYNC         11  // Performs this blit synchronously. ***DEFAULT***
+
+// Indicate which type (M_BLT_TYPE) of copy is performed (the default is a normal blit, M_SCRCOPY). The valid values are:
+#define M_BLT_SRCCOPY               20  // Performs a normal blit. (only supported by M_BLT_FRAME) ***DEFAULT***
+#define M_BLT_SRCKEYONBLACK         21  // Performs a blit with black keying. (only supported by M_BLT_FRAME)
+#define M_BLT_SRCMIRRORLEFTRIGHT    22 // This blit mirrors the surface from left to right (y-axis).
+#define M_BLT_SRCMIRRORUPDOWN       23 // This blit mirrors the surface from top to bottom (x-axis).
+#define M_BLT_SRCMIRRORLRUPDN       24 // This blit mirrors the surface from top to bottom and from left to right.
+#define M_BLT_SCALELINEAR           25
+#define M_BLT_SCALENEAR             26
+#define M_BLT_SCALECONSTANT         27
+#define M_BLT_SCALEYUV2BGR          28
+#define M_BLT_SCALEYUV2Y            29
+#define M_BLT_SCALEYUV              30
+
+#ifdef M_USE_MBUFBLIT
+// ****************************************************************************
+//
+// Description of the MBLTDESC_VER1 structure :
+//
+//    lSize :        Size of the structure, in bytes. This member must be
+//                   initialized before the structure is used.
+//    lValidMembers: A combination of flags that determine the valid members of
+//                   the MBLTDESC structure.
+//    lRegion:       Indicate which region to copy from the source buffer to
+//                   the destiantion buffer (the default is M_BLT_FRAME).
+//    lMode:         Indicate if the blit is done asynchronously or
+//                   synchronously (the default is synchronously).
+//    lType:         Indicate which type of copy is performed (the default
+//                   is a normal blit, M_SCR_COPY).
+//    DestRect:      RECT structure that defines the upper-left and lower-right
+//                   points of the rectangle to blit to on the destination
+//                   surface. If this parameter is set to ZERO, the entire
+//                   destination surface is used.
+//    SrcRect:       RECT structure that defines the upper-left and lower-right
+//                   points of the rectangle to blit from on the source surface.
+//                   If this parameter is set to ZERO, the entire source surface
+//                   is used.
+//    lpDDDestSurface: Address of the destination direct draw surface used for
+//                   the copy. MIL will fill automatically this member is the blit
+//                   is valid. Use this member if you want to know if an
+//                   asynchronously blit is done (GetBltStatus(DDGBS_ISBLTDONE)).
+//    lSrcType:      Indicate which type of protocol to use for the source (FB, PCI or AGP)
+//    lDestType:     Indicate which type of protocol to use for the destination (FB, PCI or AGP)
+//
+// ****************************************************************************
+
+#if !(M_MIL_USE_LINUX)
+typedef struct _MBLTDESC_VER1 {
+   long        lSize;
+   long        lValidMembers;
+   long        lRegion;
+   long        lMode;
+   long        lType;
+   RECT        DestRect;
+   RECT        SrcRect;
+   LPDIRECTDRAWSURFACE lpDDDestSurface;
+   long        lSrcType;
+   long        lDestType;
+   } MBLTDESC_VER1;
+typedef MBLTDESC_VER1 *LPMBLTDESC_VER1;
+
+typedef MBLTDESC_VER1 MBLTDESC;
+
+typedef MBLTDESC *LPMBLTDESC;
+#endif // M_MIL_USE_LINUX
+
+#define M_INIT_STRUCT(x) (memset(&x,0,sizeof(x)), x.lSize=sizeof(x))
+#endif // M_USE_MBUFBLIT
+
+
+
+/************************************************************************/
+/* MbufCopyCond  conditions                                             */
+/************************************************************************/
+#define M_EQUAL                                       3L
+#define M_NOT_EQUAL                                   4L
+#define M_BGRX32_COMPOSITION                          5L
+
+/************************************************************************/
+/* MbufGet(), MbufPut(), MbufChild(), ...                               */
+/************************************************************************/
+#define M_RED                                         0x08L
+#define M_GREEN                                       0x10L
+#define M_BLUE                                        0x20L
+#define M_ALL_BAND                                    -1L
+#define M_ALL_BANDS                                   M_ALL_BAND
+#define M_HUE                                         0x00008000L
+#define M_SATURATION                                  0x2000L
+#define M_LUMINANCE                                   0x00020000L   // M_GRAB_INPUT_GAIN
+#define M_CHROMINANCE                                 0x00040000L   // M_GRAB_INPUT_GAIN
+#define M_Y                                           M_RED
+#define M_U                                           M_GREEN
+#define M_V                                           M_BLUE
+#define M_DITHERING                                   0x2000L
+#define M_CBCR                                        0x4000L
+#define M_ORANGE                                      0x30          // For M_LED_USER
+
+#define M_ALL_BITS                                    -1L
+#define M_DONT_CARE                                   0x00008000L
+#if !M_MIL_USE_LINUX
+#define M_CHILD_ALLOC_LOSABLE_ATTRIBUTE               (M_DIRECTX|M_DIB|M_GDI|M_BITMAP_HANDLE|M_MTX0)
+#else
+#define M_CHILD_ALLOC_LOSABLE_ATTRIBUTE               (M_GDI|M_MTX0|M_LINUX_MXIMAGE)
+#endif
+
+/************************************************************************/
+/* MbufChildColor2dClip(), MbufChildMove()                              */
+/************************************************************************/
+#define M_CLIPPED_OFFSET_X                            1L
+#define M_CLIPPED_OFFSET_Y                            2L
+#define M_CLIPPED_SIZE_X                              4L
+#define M_CLIPPED_SIZE_Y                              8L
+#define M_CLIP                                        0x0010L /* also defined in milcal.h */
+
+
+/************************************************************************/
+/* MbufChildContainer()                                                 */
+/************************************************************************/
+#define M_ANY_CRITERIA                                1
+#define M_ALL_CRITERIA                                2
+
+/************************************************************************/
+/* MbufTransfer()                                                       */
+/************************************************************************/
+/*Transfer function value*/
+#define M_DEFAULT                                     0x10000000L
+#define M_CLEAR                                       0x00000001L
+#define M_AUTO_SCALE                            2L  //0x00000002L
+#define M_BIT_SHIFT                             3L  //0x00000003L
+#define M_WINDOW_RANGE                       3072L  //0x00000C00L
+#define M_COMPOSITION                                 0x00001000L
+#define M_COPY_EVEN                                   0x00002000L
+#define M_COPY_ODD                                    0x00004000L
+#define M_COPY_TO_HWND                                0x00010000L
+#define M_COPY                                        0x00020000L
+#define M_REPLICATE                                   0x00040000L
+#define M_SCALE                                       0x00008010L    // Can be added to some functions like M_COPY
+#define M_BYTE_SWAP                                   0x00080000L
+#define M_BINARIZE                                    0x00100000L
+#define M_LUT_MAP                                     0x00200000L
+#define M_COLOR_MATCH                                 0x00400000L
+#define M_ALPHA_BLENDING                              0x00800000L
+/*Transfer type*/
+#define M_DEFAULT                                     0x10000000L
+#define M_MIL_METHOD                                  0x01000000L
+#define M_DRIVER_METHOD                               0x02000000L
+#define M_DIRECTX_METHOD                              0x00001000L
+#define M_MTX0_METHOD                                 0x00002000L
+#define M_DRAWDIB_METHOD                              0x00004000L
+#define M_BITBLT_METHOD                               0x00008000L
+#define M_STRETCHBLT_METHOD                           0x00010000L
+#define M_DIBTODEV_METHOD                             0x00020000L
+#define M_STRETCHDIB_METHOD                           0x00040000L
+#define M_DIB_METHOD                                  (M_DRAWDIB_METHOD|M_BITBLT_METHOD|M_STRETCHBLT_METHOD|M_DIBTODEV_METHOD|M_STRETCHDIB_METHOD)
+#define M_LINUX_METHOD                                0x00080000L
+//#define M_LINUX_DGA_METHOD                            0x00100000L (Obsolete)
+#define M_NON_DISPLAY_METHOD                          MAKE_INT64(0x00000000EF000000)
+#define M_DISPLAY_METHOD                              0x00FFF000L
+/*Double name for the documentation*/
+#define M_MIL_MODE                                    M_MIL_METHOD
+#define M_DRIVER_MODE                                 M_DRIVER_METHOD
+#define M_DIRECTX_MODE                                M_DIRECTX_METHOD
+#define M_MTX0_MODE                                   M_MTX0_METHOD
+#define M_DRAWDIB_MODE                                M_DRAWDIB_METHOD
+#define M_BITBLT_MODE                                 M_BITBLT_METHOD
+#define M_STRETCHBLT_MODE                             M_STRETCHBLT_METHOD
+#define M_DIBTODEV_MODE                               M_DIBTODEV_METHOD
+#define M_STRETCHDIB_MODE                             M_STRETCHDIB_METHOD
+#define M_DIB_MODE                                    M_DIB_METHOD   /*NOTE: DibMode is also a BufInquire (old displays)*/
+#define M_LINUX_MODE                                  M_LINUX_METHOD
+
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+
+#define M_ALLOW_LARGER_RECT                           0x00000100L
+#define M_CAN_GROW_RECT                               M_ALLOW_LARGER_RECT
+#define M_USE_RECT_LIST                               0x00000200L
+#define M_BILINEAR                                    0x00000008L
+#define M_BICUBIC                                     0x00000010L
+#define M_NEAREST_NEIGHBOR                            0x00000040L
+#define M_USE_MP_FOR_TRANSFER                         0x00000080L
+#define M_BILINEAR_RENDERING                          0x00000400L
+#define M_IGNORE_REGION                               0x00000800L
+
+/*Mask used to retrieve field in the transfer type*/
+#define M_ALL_METHOD                                  MAKE_INT64(0x00000000EFFFF000)    // M_DISPLAY_METHOD | M_NON_DISPLAY_METHOD
+#define M_NB_OF_TRANSFER_METHOD                               19L    // Must be equal to CountSetBit(M_ALL_METHOD)
+#define M_TRANSFER_METHOD                             MAKE_INT64(0x00000000FFFFF000)
+#define M_SCALING_METHOD                              (M_BILINEAR|M_BILINEAR_RENDERING|M_BICUBIC|M_NEAREST_NEIGHBOR)
+#define M_TRANSFER_TYPE_KNOWN_BITS                    (M_TRANSFER_METHOD|M_SCALING_METHOD|M_USE_RECT_LIST|M_ALLOW_LARGER_RECT|M_SYNCHRONOUS|M_ASYNCHRONOUS|M_USE_MP_FOR_TRANSFER|M_IGNORE_REGION)
+
+
+/************************************************************************/
+/* MbufImport(), MbufExport()                                           */
+/************************************************************************/
+#define M_RESTORE                                     0x10L
+
+#define M_LOAD                                        1L
+#define M_NO_COMPRESS                                 2L
+#define M_NO_GRAB                                     4L
+#define M_NO_PROC                                     8L
+#define M_NO_DISP                                     32L
+
+// TIFF compression as defined in tiff spec 6.0
+#define M_COMPRESSION_NONE                       1L
+#define M_COMPRESSION_CCITTRLE                   2L
+#define M_COMPRESSION_CCITTFAX3                  3L
+#define M_COMPRESSION_CCITTFAX4                  4L
+#define M_COMPRESSION_LZW                        5L
+#define M_COMPRESSION_OJPEG                      6L
+#define M_COMPRESSION_JPEG                       7L
+#define M_COMPRESSION_NEXT                       32766L
+#define M_COMPRESSION_CCITTRLEW                  32771L
+#define M_COMPRESSION_PACKBITS                   32773L
+#define M_COMPRESSION_THUNDERSCAN                32809L
+#define M_COMPRESSION_IT8CTPAD                   32895L
+#define M_COMPRESSION_IT8LW                      32896L
+#define M_COMPRESSION_IT8MP                      32897L
+#define M_COMPRESSION_IT8BL                      32898L
+#define M_COMPRESSION_PIXARFILM                  32908L
+#define M_COMPRESSION_PIXARLOG                   32909L
+#define M_COMPRESSION_DEFLATE                    32946L
+#define M_COMPRESSION_ADOBE_DEFLATE              8L
+#define M_COMPRESSION_DCS                        32947L
+#define M_COMPRESSION_JBIG                       34661L
+#define M_COMPRESSION_SGILOG                     34676L
+#define M_COMPRESSION_SGILOG24                   34677L
+#define M_COMPRESSION_JP2000                     34712L
+
+// Used by legacy tiff handler
+#define M_TIFF_NO_COMPRESSION                         M_COMPRESSION_NONE
+#define M_TIFF_CCITT_3                                M_COMPRESSION_CCITTRLE
+#define M_TIFF_CCITT_3_T4_ENCODING                    M_COMPRESSION_CCITTFAX3
+#define M_TIFF_CCITT_4_T6_ENCODING                    M_COMPRESSION_CCITTFAX4
+
+
+#define M_MIL                                         1L
+#define M_MIL_TIFF                                    1L
+#define M_RAW                                         2L
+#define M_TIFF_LEGACY                                 4L // Used for legacy tiff handler
+#define M_TIFF_COMPRESS                              16L // Used for legacy tiff handler
+#define M_TIFF_COMPRESS_2                            32L // Used for legacy tiff handler
+
+#define M_PLY_ASCII                                2832L
+#define M_PLY_BINARY_LITTLE_ENDIAN                 2833L
+#define M_STL_ASCII                                3303
+#define M_STL_BINARY                               3304
+#define M_PLY                                      1964L
+#define M_STL                                      2198L
+
+
+
+#define M_TIFF                                      0x1000L
+
+// TIFF Compression type
+#define M_TIFF_COMPRESSED(x)                       (M_TIFF + (x)) // Compressed TIFF type
+#define M_TIFF_COMPRESSION_TAG(x)                  (M_TIFF_IS_COMPRESSED(x)) ? ((x) - M_TIFF)  : M_INVALID // TIFF Compression tag value
+
+#define M_TIFF_IS_COMPRESSED(x)                    (((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_NONE         ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTRLE     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTFAX3    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTFAX4    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_LZW          ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_OJPEG        ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_JPEG         ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_NEXT         ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTRLEW    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_PACKBITS     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_THUNDERSCAN  ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_IT8CTPAD     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_IT8LW        ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_IT8MP        ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_IT8BL        ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_PIXARFILM    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_PIXARLOG     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_DEFLATE      ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_ADOBE_DEFLATE))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_DCS          ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_JBIG         ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_SGILOG       ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_SGILOG24     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_JP2000       ))))
+
+#define M_TIFF_IS_CCITT(x)                         (((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTRLEW    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTRLE     ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTFAX3    ))) || \
+                                                    ((x) == (M_TIFF_COMPRESSED(M_COMPRESSION_CCITTFAX4    ))))
+
+
+#define M_GENDC                                       0x100000
+#define M_MIL_NATIVE                                  21
+#define M_USE_EXTENSION                               22
+#define M_BMP                                         64L
+#define M_JPEG2K_JP2                                  8L 
+#define M_PNG                                    0x2000L
+
+#define M_JPEG_LOSSLESS                               0x00400000L
+#define M_JPEG_LOSSY                                  0x00800000L
+#define M_JPEG_LOSSLESS_INTERLACED                    0x00C00000L
+#define M_JPEG_LOSSY_INTERLACED                       0x08000000L
+#define M_JPEG2000_LOSSY                              0x08400000L
+#define M_JPEG2000_LOSSLESS                           0x08800000L
+
+// Special file formats for import and export.
+#define M_JPEG_LOSSY_RGB                              0x01000000L
+#define M_JPEG2000_LOSSY_JP2                          M_JPEG2000_LOSSY+M_JPEG2K_JP2
+#define M_JPEG2000_LOSSLESS_JP2                       M_JPEG2000_LOSSLESS+M_JPEG2K_JP2
+
+#define M_PLANAR                                      0x00040000L
+
+#define M_WITH_CALIBRATION                            0x00020000L
+#define M_NO_REGION                                   0x00010000L
+
+#define M_INTERACTIVE                                 M_NULL
+
+#define M_DEFAULT_RESOLUTION_X                        72L
+#define M_DEFAULT_RESOLUTION_Y                        72L
+
+#define M_DPM_FACTOR                                  0.0254 //1 inche/meter
+
+/************************************************************************/
+/* MbufImportSequence(), MbufExportSequence()                           */
+/************************************************************************/
+#define M_RESTORE                                     0x10L
+
+#define M_LOAD                                        1L
+
+#define M_AVI_MIL                                     128L
+#define M_AVI_DIB                                     256L // Standard Windows AVI files.
+#define M_AVI_MJPG                                    512L
+#define M_AVI_MJPEG                                   M_AVI_MJPG
+#define M_AVI_MPG4                                    1024L
+#define M_AVI_MPEG4                                   M_AVI_MPG4
+#define M_AVI_H264                                    2048L
+#define M_AVI_CODEC                                   0x4000L // Use external codecs
+#define M_DEFAULT                                     0x10000000L
+
+#define M_AVI_CODEC_UNSUPPORTED                       -2      // AVI Codec not available
+
+// Import/Export Control Flags.
+#define M_DEFAULT                                     0x10000000L         /* Create a file-Write/Read-Close           */
+#define M_APPEND                                      0x20000000L         /* Open-Append-Close                        */
+#define M_READ                                        1                   /* Read from an opened file.                */
+#define M_WRITE                                       2                   /* Write into an opened file.               */
+#define M_OPEN                                        0x00000010L         /* Open a file to Read/Write( with create ) */
+#define M_CLOSE                                       0x00000020L         /* Close an open file.                      */
+#define M_OPEN_APPEND                                 (M_OPEN + M_APPEND) /* Open an existing file to append into.    */
+
+#define M_INTERACTIVE                                 M_NULL
+
+
+/************************************************************************/
+/* MbufLoad()                                                           */
+/************************************************************************/
+#define M_INTERACTIVE                                 M_NULL
+
+
+/************************************************************************/
+/* MbufSave()                                                           */
+/************************************************************************/
+#define M_INTERACTIVE                                 M_NULL
+
+
+/************************************************************************/
+/* MbufRestore()                                                        */
+/************************************************************************/
+#define M_INTERACTIVE                                 M_NULL
+
+
+/************************************************************************/
+/* MbufControl() (formerly MbufControlNeighborhood()) / MbufInquire()   */
+/************************************************************************/
+#define M_ABSOLUTE_VALUE                              50L
+#define M_NORMALIZATION_FACTOR                        52L
+#define M_OVERSCAN                                    53L
+#define M_OVERSCAN_REPLACE_VALUE                      54L
+#define M_OFFSET_CENTER_X                             55L
+#define M_OFFSET_CENTER_Y                             56L
+#define M_SATURATION                                  0x2000L
+#define M_FILTER_MODE                                 122L     // Already defined in miledge.h
+#define M_FILTER_TYPE                                 1046L    // Already defined in miledge.h, milmeas.h
+#define M_FILTER_OPERATION                            57L
+#define M_NUMBER_OF_ELEMENT_VALUES_VALID              58L
+#define M_SMOOTHNESS                                  108L         // Already defined in    milmod.h, milmeas.h, mil.h
+#define M_FILTER_SMOOTHNESS                           M_SMOOTHNESS // Already defined in    mil.h, milmeas.h
+
+#define M_DEFAULT                                     0x10000000L
+#define M_ENABLE                                      -9997L
+#define M_DISABLE                                     -9999L
+
+// Control values for M_OVERSCAN.
+#define M_DEFAULT                                     0x10000000L
+#define M_FAST                                        0x00002000L
+#define M_TRANSPARENT                                 0x01000059L
+#define M_REPLACE                                     0x01000060L
+#define M_MIRROR                                      0x01000061L
+#define M_REPLICATE                                   0x00040000L
+#define M_DISABLE                                     -9999L
+
+// Control values for M_OVERSCAN_REPLACE_VALUE.
+#define M_DEFAULT                                     0x10000000L
+#define M_REPLACE_MAX                                 0x01000063L
+#define M_REPLACE_MIN                                 0x01000064L
+
+/************************************************************************/
+/* MbufCopyComponent() Operation                                        */
+/************************************************************************/
+#define M_MOVE_APPEND                                 0x01000070L
+#define M_MOVE_REPLACE                                0x01000080L
+
+/************************************************************************/
+/* MbufCopyComponent() Control flag                                     */
+/************************************************************************/
+#define M_NO_COPY_SOURCE_DATA                         0x00100000
+#define M_SOURCE_MUST_EXIST                           0x00200000
+#define M_IDENTICAL                                   0x00400000
+#define M_USE_DESTINATION                             0x00800000
+#define M_BASIC_ATTRIBUTE                             0x01000000
+
+/************************************************************************/
+/* MbufInquire() / MbufControl() Types                                  */
+/************************************************************************/
+#define M_SIZE_BAND                                   1005L
+#define M_SIZE_BAND_LUT                               1006L
+#define M_SIZE_BIT                                    1007L
+#define M_TYPE                                        1008L
+#define M_NUMBER                                      1009L
+#define M_INIT_FLAG                                   1012L
+#define M_ATTRIBUTE                                   1013L
+#define M_SIGN                                        1014L
+#define M_NATIVE_ID                                   1016L
+#define M_MAP                                         1018L
+#define M_DIRECTX_STRUCT_FOR_MAPPABLE_BUFFER          1019L
+#define M_MAP_REMOTE                                  1020L
+#define M_SURFACE                                     1021L
+#define M_DATA_TYPE                                   1022L
+#define M_OWNER_SYSTEM_TYPE                           1023L
+#define M_BUF_MODIFIED_HOOKED                         1030L
+#define M_MAP_HOST_ADDRESS                            1031L
+#define M_CALL_HOOKS                                  1034L
+#define M_DRIVER_ASYNC_CALL_BW                        1038L
+#define M_EFFECTIVE_SIZE_BIT                          1039L
+#define M_DIG_PROCESS_PTR                             1040L
+#define M_DATA_FORMAT                                 1041L
+#define M_SET_MODIFIED_RECT_EMPTY                     1042L
+#define M_IS_INTERNALLY_ALLOCATED                     1043L
+#if OldDefinesSupport
+#define M_SRC_INTER_SYSTEM_COPY                       1044L
+MIL_DEPRECATED(M_SRC_INTER_SYSTEM_COPY, 1060)
+#endif
+#define M_SATURATION_SIZE_BIT                         1045L
+//1046L is used by M_FILTER_TYPE, see MbufControl() (formerly MbufControlNeighborhood()).
+#define M_SATURATION_TYPE                             1047L
+#define M_LOCATION                                    1048L
+#define M_SYSTEM_LOCATION                             M_LOCATION
+#define M_MIL_ID_INTERNAL                             1049L
+#define M_REAL_FORMAT                                 1050L
+#define M_SET_LOCKED_BUFFER_HOST_ADDRESS              1051L
+#define M_SET_LOCKED_BUFFER_PHYSICAL_ADDRESS          1052L
+#define M_GPU_ACCESS_ONLY                             1053L
+#define M_DATA_STORAGE_MODE                           1054L
+#define M_REGION_STREAM_SIZE_BYTE                     1055L
+#define M_REGION_COPY                                 1056L
+#define M_VIDEO_DEVICE_INDEX                          1057L
+#define M_REGION_TYPE                                 1058L
+#define M_ALLOCATED_USING_BUF_CREATE                  1059L
+#define M_DRIVER_ASYNC_CALL                           1060L
+#define M_RESOLUTION_X                                1062L
+#define M_RESOLUTION_Y                                1063L
+#define M_BYTE_ORDER                                  1064L
+#define M_REGION_USE                                  1065L
+#define M_REGION_LINK                                 1066L
+#define M_REGION_LINK_OFFSET_X                        1067L
+#define M_REGION_LINK_OFFSET_Y                        1068L
+#define M_REGION_MODIFICATION_COUNT                   1069L
+#define M_SPPD_STATE                                  1070L 
+#define M_SPPD_DATA_SAMPLE_COUNT                      1071L 
+#define M_SPPD_PEAK_AVERAGE_WIDTH                     1072L 
+#define M_SPPD_PEAK_MODE                              1073L 
+#define M_SPPD_OUTPUT_FORMAT                          1074L 
+#define M_SPPD_PEAK_MINIMUM_WIDTH                     1075L 
+#define M_SPPD_PEAK_MAXIMUM_WIDTH                     1076L 
+#define M_SPPD_PEAK_AVERAGE_MINIMUM_CONTRAST          1077L 
+#define M_SPPD_FRAME_HEIGHT                           1078L 
+#define M_GENICAM_AVAILABLE                           1079L
+#define M_SPPD_PEAK_INTENSITY_RANGE                   1083L
+#define M_IMPULSE_C_STATE                             1085L
+#define M_REGION_ACTIVE                               1086L
+#define M_COMPONENT_INVALID                           1087L
+#define M_3D_PROCESSABLE                              1088L
+#define M_3D_DISPLAYABLE                              1089L
+#define M_3D_PROCESSABLE_MESHED                       1091L
+#define M_3D_CONVERTIBLE                              1092L
+/************************************************************************/
+/* MbufInquire() Types MIL_ID range start                               */
+/************************************************************************/
+// Inquire value with MIL_ID type must be in that range : 1100-1199
+#define M_BUF_INQUIRE_MIL_ID_START                    1100L
+#define M_OWNER_SYSTEM                                1101L
+#define M_LUT_ID                                      1102L
+#define M_PARENT_ID                                   1103L
+#define M_ANCESTOR_ID                                 1104L
+#define M_PROC_HOST_ID                                1105L
+#define M_HOST_ID                                     1106L
+#define M_DRIVER_ID                                   1107L
+#define M_ASSOCIATED_AUDIO_BUFFER_ID                  1108L/////ADDED//////
+#define M_ASSOCIATED_LUT                              1110L
+#define M_REGION_GRAPHIC_LIST_ID                      1111L
+#define M_REGION_BUFFER_ID                            1112L
+//#define unused                                      1113L
+
+#define M_HUFFMAN_DC_LUMINANCE                        1120L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_AC_LUMINANCE                        1121L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_DC_CHROMINANCE                      1122L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_AC_CHROMINANCE                      1123L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_DC                                  1124L // Buffer M_COMPRESS Jpeg
+#define M_HUFFMAN_AC                                  1125L // Buffer M_COMPRESS Jpeg
+#define M_QUANTIZATION_LUMINANCE                      1126L // Buffer M_COMPRESS Jpeg
+#define M_QUANTIZATION_CHROMINANCE                    1127L // Buffer M_COMPRESS Jpeg
+
+// M_QUANTIZATION + M_ALL_BAND                        1151L
+#define M_QUANTIZATION                                1152L
+// M_QUANTIZATION + M_RED                             1160L // 1152+0x08
+// M_QUANTIZATION + M_GREEN                           1168L // 1152+0x10
+// M_QUANTIZATION + M_BLUE                            1184L // 1152+0x20
+
+#define M_SHADING_CORRECTION_OFFSET_ID                1190L
+#define M_SHADING_CORRECTION_GAIN_ID                  1191L
+#define M_OWNER_CONTAINER_ID                          1193L
+#define M_COMPONENT_ID                                1195L
+
+#define M_BUF_INQUIRE_MIL_ID_END                      1199L
+
+/************************************************************************/
+/* MbufInquire() Types MIL_ID range end                                 */
+/************************************************************************/
+
+
+#define M_SIZE_X                                      1536L // 0x600
+#define M_SIZE_Y                                      1537L // 0x601
+#define M_SIZE_Z                                      1538L // 0x602
+
+#define M_SIZE_X_RED                                  M_SIZE_X + M_RED // 1544L or 0x608
+#define M_SIZE_Y_RED                                  M_SIZE_Y + M_RED // 1545L or 0x609
+#define M_SIZE_Z_RED                                  M_SIZE_Z + M_RED // 1546L or 0x60A
+
+#define M_SIZE_X_GREEN                                M_SIZE_X + M_GREEN // 1552L or 0x610
+#define M_SIZE_Y_GREEN                                M_SIZE_Y + M_GREEN // 1553L or 0x611
+#define M_SIZE_Z_GREEN                                M_SIZE_Z + M_GREEN // 1554L or 0x612
+
+#define M_SIZE_X_BLUE                                 M_SIZE_X + M_BLUE // 1568L or 0x620
+#define M_SIZE_Y_BLUE                                 M_SIZE_Y + M_BLUE // 1569L or 0x621
+#define M_SIZE_Z_BLUE                                 M_SIZE_Z + M_BLUE // 1570L or 0x622
+
+
+// The difference between the following defines must be >= 2. The bits
+// M_RED, M_GREEN, M_BLUE, i.e. 4, 5 and 6 (zero-based) of the flags
+// must also always be cleared.
+
+// M_NUMBER_SUBBAND + M_ALL_BAND                      2559L
+#define M_NUMBER_SUBBAND                              2560L
+// M_NUMBER_SUBBAND + M_RED                           2568L // 2560+0x08
+// M_NUMBER_SUBBAND + M_GREEN                         2576L // 2560+0x10
+// M_NUMBER_SUBBAND + M_BLUE                          2592L // 2560+0x20
+
+// M_DECOMPOSITION_LEVEL + M_ALL_BAND                 2561L
+#define M_DECOMPOSITION_LEVEL                         2562L
+// M_DECOMPOSITION_LEVEL + M_RED                      2570L // 2562+0x08
+// M_DECOMPOSITION_LEVEL + M_GREEN                    2578L // 2562+0x10
+// M_DECOMPOSITION_LEVEL + M_BLUE                     2594L // 2562+0x20
+
+// Note : also used in JPEG.
+// M_Q_FACTOR + M_ALL_BAND                            2563L
+#define M_Q_FACTOR                                    2564L
+// M_Q_FACTOR + M_RED                                 2572L // 2564+0x08
+// M_Q_FACTOR + M_GREEN                               2580L // 2564+0x10
+// M_Q_FACTOR + M_BLUE                                2596L // 2564+0x20
+
+// M_CODE_BLOCK_SIZE_X + M_ALL_BAND                   2565L
+#define M_CODE_BLOCK_SIZE_X                           2566L
+// M_CODE_BLOCK_SIZE_X + M_RED                        2574L // 2566+0x08
+// M_CODE_BLOCK_SIZE_X + M_GREEN                      2582L // 2566+0x10
+// M_CODE_BLOCK_SIZE_X + M_BLUE                       2598L // 2566+0x20
+
+// M_CODE_BLOCK_SIZE_Y + M_ALL_BAND                   2599L
+#define M_CODE_BLOCK_SIZE_Y                           2600L
+// M_CODE_BLOCK_SIZE_Y + M_RED                        2608L // 2600+0x08
+// M_CODE_BLOCK_SIZE_Y + M_GREEN                      2616L // 2600+0x10
+// M_CODE_BLOCK_SIZE_Y + M_BLUE                       2632L // 2600+0x20
+
+// M_QUANTIZATION_INTERNAL + M_ALL_BAND               2601L
+#define M_QUANTIZATION_INTERNAL                       2602L
+// M_QUANTIZATION_INTERNAL + M_RED                    2610L // 2602+0x08
+// M_QUANTIZATION_INTERNAL + M_GREEN                  2618L // 2602+0x10
+// M_QUANTIZATION_INTERNAL + M_BLUE                   2634L // 2602+0x20
+
+// M_QUANTIZATION_MODIFIED + M_ALL_BAND               2603L
+#define M_QUANTIZATION_MODIFIED                       2604L
+// M_QUANTIZATION_MODIFIED + M_RED                    2612L // 2604+0x08
+// M_QUANTIZATION_MODIFIED + M_GREEN                  2620L // 2604+0x10
+// M_QUANTIZATION_MODIFIED + M_BLUE                   2636L // 2604+0x20
+
+// M_PRECINCT_SIZE_X + M_ALL_BAND                     2605L
+#define M_PRECINCT_SIZE_X                             2606L
+// M_PRECINCT_SIZE_X + M_RED                          2614L // 2606+0x08
+// M_PRECINCT_SIZE_X + M_GREEN                        2622L // 2606+0x10
+// M_PRECINCT_SIZE_X + M_BLUE                         2638L // 2606+0x20
+
+// M_PRECINCT_SIZE_Y + M_ALL_BAND                     2639L
+#define M_PRECINCT_SIZE_Y                             2640L
+// M_PRECINCT_SIZE_Y + M_RED                          2648L // 2640+0x08
+// M_PRECINCT_SIZE_Y + M_GREEN                        2656L // 2640+0x10
+// M_PRECINCT_SIZE_Y + M_BLUE                         2672L // 2640+0x20
+
+// M_QUANTIZATION_STYLE + M_ALL_BAND                  2641L
+#define M_QUANTIZATION_STYLE                          2642L
+// M_QUANTIZATION_STYLE + M_RED                       2650L // 2642+0x08
+// M_QUANTIZATION_STYLE + M_GREEN                     2658L // 2642+0x10
+// M_QUANTIZATION_STYLE + M_BLUE                      2674L // 2642+0x20
+
+#define M_RLE_BUFFER_TYPE                             2675L
+
+#define M_SOURCE_OFFSET_X                             4024L
+#define M_SOURCE_OFFSET_Y                             4025L
+
+#define M_MODIFIED                                    4096L  //bitwise value 0x00001000
+
+#define M_PARENT_OFFSET_X                             5003L
+#define M_PARENT_OFFSET_Y                             5004L
+#define M_ANCESTOR_OFFSET_X                           5005L
+#define M_ANCESTOR_OFFSET_Y                           5006L
+#define M_PARENT_OFFSET_BAND                          5007L
+#define M_ANCESTOR_OFFSET_BAND                        5008L
+#define M_NB_CHILD                                    5009L
+#define M_MODIFICATION_COUNT                          5010L
+#define M_ANCESTOR_SIZE_X                             5012L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_BUFFER_INFO_OLD                             5028L
+#endif
+#if MIL_COMPILE_VERSION < 1040
+#define M_SOURCE_INDEX                                5029L
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_SOURCE_INDEX                                0L
+#endif
+#define M_ANCESTOR_OFFSET_BIT                         5038L
+#define M_DIB_MODE                                    M_DIB_METHOD // 0x0007C000
+#define M_FLIP_MODE                                   5040L
+#define M_COMPRESSION_TYPE                            5045L
+#define M_PREDICTOR                                   5052L // Buffer M_COMPRESS Jpeg
+#define M_Q_FACTOR_LUMINANCE                          5056L // Buffer M_COMPRESS Jpeg
+#define M_Q_FACTOR_CHROMINANCE                        5057L // Buffer M_COMPRESS Jpeg
+#define M_RESTART_INTERVAL                            5059L // Buffer M_COMPRESS Jpeg
+#define M_SIZE_BYTE                                   5061L
+#define M_INTERNAL_COMPRESSION_BUFFER_ID              5063L
+#define M_INTERNAL_BUFFER_HOST_ADDRESS                5064L
+#define M_INTERNAL_JPEG_FRAME_SIZEBYTE                5065L
+#define M_INTERNAL_COMPRESSION_BUFFER_SIZE_DIVISION_FACTOR  5066L
+#define M_SIZE_BYTE_FIRST_FIELD                       5067L
+#define M_SIZE_BYTE_SECOND_FIELD                      5068L
+#define M_JPEG_COMPRESS                               5069L // Buffer M_COMPRESS Jpeg
+#define M_JPEG_DECOMPRESS                             5070L // Buffer M_COMPRESS Jpeg
+#define M_PARSE_JPEG_DATA                             5072L
+#define M_PARSE_JPEG2000_DATA                         M_PARSE_JPEG_DATA
+#define M_PARSE_MPEG4_DATA                            M_PARSE_JPEG_DATA
+#define M_PARSE_H264_DATA                             M_PARSE_JPEG_DATA
+#define M_PARSE_COMPRESSED_DATA                       M_PARSE_JPEG_DATA
+#define M_TARGET_SIZE                                 5074L // Set internal compression buffer size in byte
+#define M_ATTACHED_BUFFER_0_ID                        5076L
+#define M_ATTACHED_BUFFER_1_ID                        5077L
+#define M_ASSOCIATED_VGA_BUFFER_ID                    5078L
+#define M_FIELD_UPDATE_MODE                           5079L
+#define M_YCRCB_RANGE                                 5080L // Obsolete, use M_YCBCR_RANGE with M_YCBCR_SD/M_YCBCR_HD/M_YCBCR_UHD instead.
+#define M_MODIFICATION_HOOK                           5082L
+#define M_FIELD_ORDER                                 5083L
+#define M_YCBCR_RANGE                                 5085L
+#define M_REVERSE_X                                   5087L
+#define M_REVERSE_Y                                   5088L
+#define M_SUBSAMPLE_X                                 5089L
+#define M_SUBSAMPLE_Y                                 5090L
+#define M_SUBSAMPLE                                   5091L
+#define M_BUFFER_DIRECTX_INFO_PTR                     5092L
+#define M_BUFFER_DISPLAY_INFO_PTR                     5093L
+#define M_NUMBER_OF_BUFFERS                           5094L // Used with complex surface
+#define M_GRAB_BUFFERS                                5095L
+#define M_USED_IN_CONTINUOUS_GRAB                     5096L
+#define M_GRAB_TYPE                                   5097L
+#define M_BUF_TRANSPARENT_COLOR                       5098L
+#define M_OFFSET_X                                    5099L
+#define M_OFFSET_Y                                    5100L
+#define M_PFNC_VALUE                                  5101L
+#define M_3D_DISTANCE_UNIT                            5102
+#define M_3D_COORDINATE_SYSTEM_TYPE                   5103
+#define M_3D_REPRESENTATION                           5104
+#define M_3D_INVALID_DATA_FLAG                        5105
+#define M_GENDC_CONTAINER_DESCRIPTOR_POINTER          5109
+#define M_3D_PROPERTIES_DEFAULT                       5110
+#define M_HAS_CUSTOM_COMPONENT_TYPE_NAME              5111
+#define M_LAYOUT_MODIFICATION_COUNT                   5112
+#define M_COMPONENT_TIME_STAMP_IS_PTP                 5113
+
+#define M_HOOK_TO_BUFFER_MODIFICATIONS                5201L
+// free for reuse                                     5202L
+// free for reuse                                     5204L
+#define M_HOST_ADDRESS_BAND                           5205L
+/* Reserve next 16 values               from          5206L*/
+/*                                      to            5221L*/
+#define M_PHYS_ADDRESS_BAND                           5222L
+/* Reserve next 16 values               from          5223L*/
+/*                                      to            5237L*/
+#define M_GRAB_BUFFERS_AFTER_SET_SCHEME               5238L
+/* Free                                               5239L*/
+#define M_NB_CHILD_SELECTED_ON_DISPLAY                5240L
+#define M_UNSUPPORTED_FORMAT                          5241L
+#define M_PREFERRED_DIGITIZER_FORMAT                  5242L
+#define M_RESET_ASSOCIATED_LUT                        5243L
+//Free                                                5244L
+/* Reserve next 16 values               from          5245L*/
+/*                                      to            5259L*/
+/*Free                                  from          5260L*/
+/*                                      to            5275L*/
+#define M_GRAB_BUFFERS_AFTER_SET_SCHEME_NO_LOCK       5276
+#define M_GRAB_BUFFERS_USED                           5277L
+#define M_ALPHA_VALUE                                 5278L
+#define M_BGRX_ALPHA_VALUE                            M_ALPHA_VALUE
+#define M_BUFFER_INFO_COPY                            5279L
+#define M_BUFFER_INFO                                 5280L
+#define M_PFNC_SIZE_BIT                               5282L
+#define M_PFNC_SUPPORT                                5283L
+#define M_STORAGE_SIZE                                5284L
+
+#define M_IS_NO_MAP                                   5300L
+#define M_CRYPTOGRAPHY                                5301L
+#define M_CRYPTO                                      M_CRYPTOGRAPHY
+#define M_COMPONENT_REGION_OFFSET_X                   5302L
+#define M_COMPONENT_REGION_OFFSET_Y                   5303L
+
+
+
+#define M_BUF_INQUIRE_SIZEOF_INT64_START              6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+
+#define M_PHYSICAL_ADDRESS_ON_BOARD                   6700L
+#define M_64BIT_PHYSICAL_ADDRESS_REMOTE               6701L
+#define M_EXTENDED_FORMAT                             6702L
+#define M_EXTENDED_ATTRIBUTE                          6703L
+//#define M_PHYSICAL_ADDRESS_ON_BOARD+M_RED             6708L
+//#define M_PHYSICAL_ADDRESS_ON_BOARD+M_BLUE            6716L
+//#define M_PHYSICAL_ADDRESS_ON_BOARD+M_GREEN           6732L
+
+#define M_64BIT_PHYSICAL_ADDRESS_BAND_REMOTE          6733L
+/* Reserve next 16 values               from          6733L*/
+/*                                      to            6749L*/
+#define M_64BIT_PHYSICAL_ADDRESS_BAND                 6750L
+/* Reserve next 16 values               from          6751L*/
+/*                                      to            6765L*/
+
+#define M_DATA_INFO_TYPE                              6766L
+#if MIL_COMPILE_VERSION < 1040
+#define M_COMPONENT_ID_VALUE                          6767L
+#endif
+#define M_COMPONENT_TYPE                              6768L
+#define M_COMPONENT_GROUP_ID                          6769L
+#define M_COMPONENT_SOURCE_ID                         6770L
+#define M_COMPONENT_REGION_ID                         6771L
+#define M_GRAB_TIME_STAMP_NS                          6772L
+#define M_CAMERA_TIME_STAMP_NS                        6773L
+#define M_COMPONENT_TIME_STAMP_NS                     6774L
+
+
+#define M_BUF_INQUIRE_SIZEOF_INT64_END                6799L
+
+/************************************************************************/
+/* Values for M_COMPONENT_TYPE                                          */
+/************************************************************************/
+#define M_COMPONENT_UNDEFINED          0
+#define M_COMPONENT_INTENSITY          1
+#define M_COMPONENT_INFRARED           2
+#define M_COMPONENT_ULTRAVIOLET        3
+#define M_COMPONENT_RANGE              4
+#define M_COMPONENT_REFLECTANCE        5
+#define M_COMPONENT_CONFIDENCE         6
+#define M_COMPONENT_SCATTER            7
+#define M_COMPONENT_DISPARITY          8
+#define M_COMPONENT_MULTISPECTRAL      9
+#define M_COMPONENT_METADATA           0x8001
+#define M_COMPONENT_CUSTOM             0xFF00
+#define M_COMPONENT_MESH_MIL           0x01000001
+#define M_COMPONENT_NORMALS_MIL        0x01000002
+#define M_COMPONENT_METADATA_DA        0x01000003
+#define M_COMPONENT_ALL                MAKE_INT64(0x0000100000000000)
+
+
+
+/************************************************************************/
+/* Values for M_3D_DISTANCE_UNIT                                        */
+/************************************************************************/
+#define M_MILLIMETER                           2450L
+#define M_INCH                                 2454L
+#define M_PIXEL                               0x1000L
+
+/************************************************************************/
+/* Values for M_3D_COORDINATE_SYSTEM_TYPE                               */
+/************************************************************************/
+#define  M_CARTESIAN                                        2717L
+#define  M_SPHERICAL                                        2716L
+#define  M_CYLINDRICAL                                      2718L
+
+/************************************************************************/
+/* Values for M_3D_REPRESENTATION                                       */
+/************************************************************************/
+#define  M_UNCALIBRATED_Z                                   50
+#define  M_CALIBRATED_XYZ                                   51
+#define  M_CALIBRATED_XYZ_UNORGANIZED                       52
+#define  M_CALIBRATED_XZ_UNIFORM_Y                          53
+#define  M_CALIBRATED_XZ_EXTERNAL_Y                         54
+#define  M_CALIBRATED_Z                                     55
+#define  M_CALIBRATED_Z_EXTERNAL_Y                          56
+#define  M_CALIBRATED_Z_UNIFORM_XY                          57
+#define  M_CALIBRATED_Z_UNIFORM_X_EXTERNAL_Y                58
+#define  M_DISPARITY                                        59
+#define  M_DISPARITY_EXTERNAL_Y                             60
+#define  M_DISPARITY_UNIFORM_Y                              61
+
+
+#define M_BUF_INQUIRE_UNKNOWN_SIZEOF_START            6800L
+// Inquire value with unknown size of,
+//            and require a user array, must be in that range : 6800-6899
+#define M_REGION_STREAM                               6801L
+#define M_BUF_INQUIRE_UNKNOWN_SIZEOF_END              6899L
+
+#define M_BUF_INQUIRE_STRING_START                    6900L
+
+#define M_EXTENDED_FORMAT_NAME                   ((M_BUF_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING)
+#define M_EXTENDED_ATTRIBUTE_NAME                ((M_BUF_INQUIRE_STRING_START+1)|M_CLIENT_ENCODING)
+#define M_COMPONENT_TYPE_NAME                    ((M_BUF_INQUIRE_STRING_START+2)|M_CLIENT_ENCODING)
+#define M_PFNC_NAME                              ((M_BUF_INQUIRE_STRING_START+3)|M_CLIENT_ENCODING)
+#define M_COMPONENT_REGION_NAME                  ((M_BUF_INQUIRE_STRING_START+4)|M_CLIENT_ENCODING)
+#define M_COMPONENT_SOURCE_NAME                  ((M_BUF_INQUIRE_STRING_START+5)|M_CLIENT_ENCODING)
+
+
+#define M_BUF_INQUIRE_STRING_END                      6999L
+
+// M_FORMAT is not a string when used with MbufInquire but the define
+// is shared with MdispInquire and MdigInquire
+#define M_FORMAT                                      (7701L|M_CLIENT_ENCODING)
+
+// Flags related to JPEG2000.
+
+/* Reserve next 9 values                from          8193L */
+/*                                      to            8201L */
+
+#define M_OPERATION_MODE                              8203L
+
+#define M_REGULAR                                     0x00020000L /* already defined elsewhere in mil.h */
+#define M_PRECISE                                     0x00040000L
+
+#define M_DEFAULT_QUANTIZATION_TABLE                  8204L
+
+#define M_LEGACY                                      1L
+#define M_STANDARD                                    2L
+
+#define M_USER_DATA_SIZE                              8205L
+
+// Note : also used in JPEG.
+#define M_ALLOCATE_MEMORY                             8206L
+#define M_SHRINK_MEMORY                               8207L
+#define M_ALLOCATED_SIZE_BYTE                         8208L
+#define M_COMPRESSED_DATA_SIZE_BYTE                   8209L
+#define M_COMPRESSION_PLATFORM                        8202L
+
+#define M_CODESTREAM_FORMAT                           8210L
+
+#define M_RAW_FORMAT                                  0L
+#define M_JP2_FORMAT                                  2L
+
+#define M_BATCH_COUNT                                 8211L
+#define M_BATCH_FLAGS                                 8212L
+#define M_BATCH_INQUIRE                               8213L
+#define M_PROGRESSION_ORDER                           8214L
+
+#define M_LAYER_RES_COMP_POS                          0L
+#define M_RES_LAYER_COMP_POS                          1L
+#define M_RES_POS_COMP_LAYER                          2L
+#define M_POS_COMP_RES_LAYER                          3L
+#define M_COMP_POS_RES_LAYER                          4L
+
+#define M_IMAGE_OFFSET_X                              8215L
+#define M_IMAGE_OFFSET_Y                              8216L
+#define M_TILE_OFFSET_X                               8217L
+#define M_TILE_OFFSET_Y                               8218L
+#define M_TILE_SIZE_X                                 8219L
+#define M_TILE_SIZE_Y                                 8220L
+#define M_SOP_MARKERS                                 8221L
+#define M_EPH_MARKERS                                 8222L
+
+#define M_CODESTREAM_OFFSET                           8223L
+#define M_CODESTREAM_SIZE                             8224L
+
+//Mpeg4 related inquire
+#define M_FRAME_TYPE                                  8225L
+#define M_ASSOCIATED_STREAM                           8226L
+
+#define M_LOCKABLE                                    8255
+
+#define M_LOCK_TYPE                                   8452
+#define M_FLAGS                                       8453
+
+#define M_IS_LOCKED                                   8454
+
+#define M_READ                                        1
+#define M_WRITE                                       2
+#define M_LOCK_ACCESS_MASK                            (M_READ|M_WRITE)
+
+// DirectX Lock Types
+#define M_RT_GPU_ACCESS                               0x00000004L
+#define M_HOST_ACCESS                                 0x00000008L
+#define M_GPU_ACCESS                                  0x00000010L
+
+#define M_DMA_ACCESS                                  0x00000020L
+/* Following bitwise values are reserved for future DirectX Lock Types
+                                                      0x00000040L
+                                                      0x00000080L
+                                                      0x00000100L
+                                                      0x00000200L
+                                                      0x00000400L
+                                                      0x00000800L */
+#define M_LOCK_TYPE_MASK                              0x00000FFCL
+
+#define M_LOCK_UNLOCK_MASK                            (M_LOCK_TYPE_MASK|M_LOCK_ACCESS_MASK)
+
+// Display reserved area
+#define M_BUF_DISPLAY_START                           9000L
+#define M_IS_IN_DISPLAY_BUF_RANGE(X)                  ((X>=M_BUF_DISPLAY_START) && (X<=M_BUF_DISPLAY_END))
+#define M_DC_ALLOC                                    (M_BUF_DISPLAY_START+0L)   // 9000
+#define M_DC_FREE                                     (M_BUF_DISPLAY_START+1L)   // 9001
+#define M_DC_HANDLE                                   (M_BUF_DISPLAY_START+2L)   // 9002
+#define M_XPIXMAP_ALLOC                               M_DC_ALLOC
+#define M_XPIXMAP_FREE                                M_DC_FREE
+#define M_XPIXMAP_HANDLE                              M_DC_HANDLE 
+#define M_ENHANCE_FORMAT                              (M_BUF_DISPLAY_START+3L)   // 9003
+// available                                          (M_BUF_DISPLAY_START+4L)   // 9004
+// available                                          (M_BUF_DISPLAY_START+5L)   // 9005
+#define M_MTX0_CAPABLE_DIRECTX_OWNER                  (M_BUF_DISPLAY_START+6L)   // 9006
+// available                                          (M_BUF_DISPLAY_START+7L)   // 9007
+#define M_ENHANCE_FROM_ID                             (M_BUF_DISPLAY_START+8L)   // 9008
+#define M_ENHANCE_MAX_DISPLAY_FORMAT                  (M_BUF_DISPLAY_START+9L)   // 9009
+#define M_VIDEO_SYSTEM_ID                             (M_BUF_DISPLAY_START+10L)  // 9010
+#define M_NEXT_FREE_BUFFER                            (M_BUF_DISPLAY_START+11L)  // 9011
+#define M_OLDEST_READY_BUFFER                         (M_BUF_DISPLAY_START+12L)  // 9012
+#define M_WAIT_ON_BUFFER_FREED                        (M_BUF_DISPLAY_START+13L)  // 9013
+#define M_ENHANCE_SYSTEM_CREATE                       (M_BUF_DISPLAY_START+14L)  // 9014
+#define M_ENHANCE_GRAB_CREATE                         (M_BUF_DISPLAY_START+15L)  // 9015
+#define M_FREE_ENHANCED_BUFFER                        (M_BUF_DISPLAY_START+16L)  // 9016
+#define M_ENHANCED_BUFFER                             (M_BUF_DISPLAY_START+17L)  // 9017
+#define M_INVALID_RECT                                (M_BUF_DISPLAY_START+18L)  // 9018
+#define M_VALID_RECT                                  (M_BUF_DISPLAY_START+19L)  // 9019
+#define M_BITMAPINFO                                  (M_BUF_DISPLAY_START+26L)  // 9026
+// available                                          (M_BUF_DISPLAY_START+28L)  // 9028
+#define M_DIB_HANDLE                                  (M_BUF_DISPLAY_START+31L)  // 9031 // Also in MdispInquire section, don't change the value
+#define M_DC_FREE_NO_MODIFIED_CHECK                   (M_BUF_DISPLAY_START+32L)  // 9032
+// available                                          (M_BUF_DISPLAY_START+34L)  // 9034
+#define M_DIRECTX_SURFACE_MAPPED                      (M_BUF_DISPLAY_START+35L)  // 9035
+#define M_DIRECTX_SURFACE_MAPPABLE                    (M_BUF_DISPLAY_START+36L)  // 9036
+// available                                          (M_BUF_DISPLAY_START+37L)  // 9037
+#define M_UNENHANCE_FORMAT                            (M_BUF_DISPLAY_START+41L)  // 9041
+// available                                          (M_BUF_DISPLAY_START+42L)  // 9042
+#define M_EXTERNAL_BUFFER_ID                          (M_BUF_DISPLAY_START+43L)  // 9043
+#define M_EXTERNAL_LL_MD_ID                           (M_BUF_DISPLAY_START+44L)  // 9044
+#define M_RESTORE_VIDEO_MEMORY                        (M_BUF_DISPLAY_START+45L)  // 9045
+#define M_XVIDEO_ADAPTOR_INDEX                        (M_BUF_DISPLAY_START+46L)  // 9046
+#define M_SET_GDI_PALETTE_FROM_LUT                    (M_BUF_DISPLAY_START+47L)  // 9047
+// available                                          (M_BUF_DISPLAY_START+48L)  // 9048
+// ...
+// available                                          (M_BUF_DISPLAY_START+193L) // 9193
+//////////////MAXIMAL VALUE///////////////////////////////////////////////+193L  // 9193
+#define M_BUF_DISPLAY_END                             (M_BUF_DISPLAY_START+193L) // 9193
+
+
+// 
+// Reserved value for M_SIZE_BYTE + M_FAST            13253L // 5061L + 0x2000
+
+
+// DirectX reserved area for BufControl/BufInquire
+#if M_MIL_USE_DIRECTX_SERVICE
+#define M_BUF_DIRECTX_START                           14000L
+#define M_IS_IN_DIRECTX_BUF_RANGE(X)                  ((X>=M_BUF_DIRECTX_START) && (X<=M_BUF_DIRECTX_END))
+
+#define M_REAL_HOST_ADDRESS                           (M_BUF_DIRECTX_START+2L)   // 14002
+// reserved 14004 to 14014 for future general DirectX BufControl/BufInquire
+
+#define M_DDRAW_SURFACE                               (M_BUF_DIRECTX_START+15L)  // 14015
+#define M_DDRAW7_HANDLE                               M_DDRAW_SURFACE
+// reserved 14018 to 14019 for future DDraw BufControl/BufInquire
+
+#define M_D3D9_HANDLE                                 (M_BUF_DIRECTX_START+20L)  // 14020
+#define M_D3D9_SURFACE                                (M_BUF_DIRECTX_START+21L)  // 14021
+#define M_D3D9_TEXTURE                                (M_BUF_DIRECTX_START+22L)  // 14022
+#define M_D3D9_SURFACE_RT                             (M_BUF_DIRECTX_START+27L)  // 14027
+#define M_D3D9_SURFACE_LK                             (M_BUF_DIRECTX_START+28L)  // 14028
+#define M_D3D9_TEXTURE_LK                             (M_BUF_DIRECTX_START+29L)  // 14029
+// reserved 14032 to 14039 for future D3D9 BufControl/BufInquire
+
+#define M_D3D10_HANDLE                                (M_BUF_DIRECTX_START+40L)  // 14040
+#define M_D3D10_TEXTURE                               (M_BUF_DIRECTX_START+41L)  // 14041
+#define M_D3D10_TEXTURE_LK                            (M_BUF_DIRECTX_START+44L)  // 14044
+// reserved 14046 to 14059 for future D3D10 BufControl/BufInquire
+
+#define M_D3D11_HANDLE                                (M_BUF_DIRECTX_START+60L)  // 14060
+#define M_D3D11_TEXTURE                               (M_BUF_DIRECTX_START+61L)  // 14061
+#define M_D3D11_TEXTURE_LK                            (M_BUF_DIRECTX_START+64L)  // 14064
+#define M_D3D11_BUFFER                                (M_BUF_DIRECTX_START+66L)  // 14066
+#define M_D3D11_BUFFER_LK                             (M_BUF_DIRECTX_START+67L)  // 14067
+// reserved 14068 to 14079 for future D3D11 BufControl/BufInquire
+
+// available
+// ...
+// available                                          (M_BUF_DIRECTX_START+999L) // 14999
+//////////////MAXIMAL VALUE///////////////////////////////////////////////+999L  // 14999
+#define M_BUF_DIRECTX_END                             (M_BUF_DIRECTX_START+999L) // 14999
+#endif
+
+// MTXDMA reserved area
+#define M_BUF_MTXDMA_START                            16384L
+#define M_WRITE_COMBINING                             16384L // Must be bitwise
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_BUFFER_AGP_CAPABLE                          16387L
+#endif
+#define M_BUFFER_KERNEL_MAP                           16388L
+// Reserved 16390 to 16434 for other MTXDMA controls
+#define M_BUF_MTXDMA_END                              16434L
+
+
+#define M_BUF_DX_LOCK_UNLOCK_START                    20480L
+#define M_LOCK                                        20480L   // 0x00005000
+/*Reserved next 0xfff (4095) for other bitwise flags*/
+#define M_UNLOCK                                      24576L   // 0x00006000
+/*Reserved next 0xfff (4095) for other bitwise flags*/
+#define M_LOCK_TRY                                    28672L   // 0x00007000
+/*Reserved next 0xfff (4095) for other bitwise flags*/
+#define M_BUF_DX_LOCK_UNLOCK_END                      32767L
+
+#define M_NO_QUANTIZATION                             0L
+#define M_SCALAR_IMPLICIT                             1L
+#define M_SCALAR_EXPLICIT                             2L
+
+#define M_HOST_ADDRESS                                0x00010000L
+#define M_HOST_ADDRESS_RED                            M_HOST_ADDRESS + M_RED    // 0x00010008L
+#define M_HOST_ADDRESS_GREEN                          M_HOST_ADDRESS + M_GREEN  // 0x00010010L
+#define M_HOST_ADDRESS_BLUE                           M_HOST_ADDRESS + M_BLUE   // 0x00010020L
+#define M_HOST_ADDRESS_REMOTE                         0x00080000L
+#define M_HOST_ADDRESS_REMOTE_RED                     M_HOST_ADDRESS_REMOTE + M_RED    // 0x00080008L
+#define M_HOST_ADDRESS_REMOTE_GREEN                   M_HOST_ADDRESS_REMOTE + M_GREEN  // 0x00080010L
+#define M_HOST_ADDRESS_REMOTE_BLUE                    M_HOST_ADDRESS_REMOTE + M_BLUE   // 0x00080020L
+#define M_PHYSICAL_ADDRESS                            0x40000000L
+#define M_PHYSICAL_ADDRESS_RED                        M_PHYSICAL_ADDRESS + M_RED    // 0x40000008L
+#define M_PHYSICAL_ADDRESS_GREEN                      M_PHYSICAL_ADDRESS + M_GREEN  // 0x40000010L
+#define M_PHYSICAL_ADDRESS_BLUE                       M_PHYSICAL_ADDRESS + M_BLUE   // 0x40000020L
+
+#define M_SIZE_X                                      1536L // 0x600
+#define M_SIZE_X_RED                                  M_SIZE_X + M_RED     // 1544L or 0x608
+#define M_SIZE_X_GREEN                                M_SIZE_X + M_GREEN   // 1552L or 0x610
+#define M_SIZE_X_BLUE                                 M_SIZE_X + M_BLUE    // 1568L or 0x620
+
+#define M_SIZE_Y                                      1537L // 0x601
+#define M_SIZE_Y_RED                                  M_SIZE_Y + M_RED     // 1545L or 0x609
+#define M_SIZE_Y_GREEN                                M_SIZE_Y + M_GREEN   // 1553L or 0x611
+#define M_SIZE_Y_BLUE                                 M_SIZE_Y + M_BLUE    // 1569L or 0x621
+
+// 0x00008000L Reserved for M_ALLOCATION_OVERSCAN that is MsysControl\Inquire type and as buffer attribute.
+#define M_ALLOCATION_OVERSCAN_SIZE                    0x00008001L
+#define M_PHYSICAL_ADDRESS                            0x40000000L
+#define M_PITCH                                       0x20000000L
+#define M_DEFAULT                                     0x10000000L
+#define M_PITCH_BYTE                                  0x08000000L
+
+// MbufControl and MbufInquire double range start
+#define M_BUF_INQUIRE_DOUBLE_RANGE_START              0x02000000L // M_MIN
+#define M_MIN                                         0x02000000L
+#define M_COMPONENT_TIME_STAMP                        0x02000001L
+#define M_3D_SCALE_X                                  0x02000002L
+#define M_3D_SCALE_Y                                  0x02000003L
+#define M_3D_SCALE_Z                                  0x02000004L
+#define M_3D_OFFSET_X                                 0x02000005L
+#define M_3D_OFFSET_Y                                 0x02000006L
+#define M_3D_OFFSET_Z                                 0x02000007L
+#define M_3D_INVALID_DATA_VALUE                       0x02000008L
+#define M_3D_DISPARITY_FOCAL_LENGTH                   0x02000009L
+#define M_3D_DISPARITY_BASELINE                       0x0200000AL
+#define M_3D_DISPARITY_PRINCIPAL_POINT_X              0x0200000BL
+#define M_3D_DISPARITY_PRINCIPAL_POINT_Y              0x0200000CL
+#define M_3D_SHEAR_X                                  0x02000011L
+#define M_3D_SHEAR_Z                                  0x02000012L
+#define M_CAMERA_TIME_STAMP                           0x02000013L
+
+#define M_MAX                                         0x04000000L
+#define M_BUF_INQUIRE_DOUBLE_RANGE_END                0x04000000L // M_MAX
+// MbufControl and MbufInquire double range end
+
+// !!! MAP FOR OLD DEFINES
+#if OldDefinesSupport
+#define M_DMA_READ_HOST_ID                            M_HOST_ID
+MIL_DEPRECATED(M_DMA_READ_HOST_ID, 1000)
+#define M_BUF_ASSOCIATED_BUFFER_ID                    5016L
+MIL_DEPRECATED(M_BUF_ASSOCIATED_BUFFER_ID, 1000)
+#if M_MIL_USE_DIRECTX_SERVICE
+#define M_WINDOW_DDRAW_SURFACE                        M_DDRAW_SURFACE
+MIL_DEPRECATED(M_WINDOW_DDRAW_SURFACE, 1000)
+#endif
+#define M_WINDOW_DC_ALLOC                             M_DC_ALLOC
+MIL_DEPRECATED(M_WINDOW_DC_ALLOC, 1000)
+#define M_WINDOW_DC_FREE                              M_DC_FREE
+MIL_DEPRECATED(M_WINDOW_DC_FREE, 1000)
+#define M_WINDOW_DC                                   M_DC_HANDLE
+MIL_DEPRECATED(M_WINDOW_DC, 1000)
+#define M_FILTER                                      M_FILTER_TYPE
+MIL_DEPRECATED(M_FILTER, 1000)
+#endif
+
+#define M_COMPONENT_ADD                               0x00040000
+#define M_COMPONENT_LIST                              0x00100000
+#define M_COMPONENT_ID_LIST                           M_COMPONENT_LIST
+#define M_COMPONENT_GROUP_ID_LIST                     0x00200000
+#define M_COMPONENT_REGION_ID_LIST                    0x00600000
+#define M_COMPONENT_TYPE_LIST                         0x00800000
+#define M_COMPONENT_SOURCE_ID_LIST                    0x00C00000
+#define M_FREE_WITH_CONTAINER                         0x00200000
+
+#define M_ARRAY_ID_MASK                               0x000FFFFF
+#define M_ARRAY_ID_SIZE(N)                            (N & M_ARRAY_ID_MASK)
+
+#define M_IS_BUINQ_CONT_ID_ARRAY(X)                   ((X) == M_COMPONENT_LIST)
+
+#if M_MIL_USE_64BIT
+#define M_IS_BUINQ_CONT_INT64_ARRAY(X)                (((X) == M_COMPONENT_LIST) || \
+                                                       ((X) == M_COMPONENT_GROUP_ID_LIST) ||  \
+                                                       ((X) == M_COMPONENT_SOURCE_ID_LIST) || \
+                                                       ((X) == M_COMPONENT_REGION_ID_LIST) || \
+                                                       ((X) == M_COMPONENT_TYPE_LIST))
+#else
+#define M_IS_BUINQ_CONT_INT64_ARRAY(X)                (((X) == M_COMPONENT_GROUP_ID_LIST)  || \
+                                                       ((X) == M_COMPONENT_SOURCE_ID_LIST) || \
+                                                       ((X) == M_COMPONENT_REGION_ID_LIST) || \
+                                                       ((X) == M_COMPONENT_TYPE_LIST))
+#endif
+
+
+
+#if MIL_COMPILE_VERSION < 1040
+#define M_COMPONENT_ID_BY_INDEX_FLAG                  0x00200000
+#define M_COMPONENT_ID_BY_INDEX(N)                    (M_COMPONENT_ID_BY_INDEX_FLAG | M_ARRAY_ID_SIZE(N))
+#endif
+
+#define M_COMPONENT_BY_MASK                          MAKE_INT64(0x7800000000000000)
+#define M_COMPONENT_BY_INDEX_FLAG                    MAKE_INT64(0x1000000000000000)
+#define M_COMPONENT_BY_ID_FLAG                       MAKE_INT64(0x2000000000000000)
+#define M_COMPONENT_BY_GROUP_ID_FLAG                 MAKE_INT64(0x3000000000000000)
+#define M_COMPONENT_BY_REGION_ID_FLAG                MAKE_INT64(0x4000000000000000)
+#define M_COMPONENT_BY_SOURCE_ID_FLAG                MAKE_INT64(0x5000000000000000)
+
+#define M_COMPONENT_BY_INDEX(N)                      (M_COMPONENT_BY_INDEX_FLAG | (N))
+#define M_COMPONENT_BY_ID(N)                         (M_COMPONENT_BY_ID_FLAG    | (N))
+#define M_COMPONENT_BY_GROUP_ID(N)                   (M_COMPONENT_BY_GROUP_ID_FLAG  | (N))
+#define M_COMPONENT_BY_REGION_ID(N)                  (M_COMPONENT_BY_REGION_ID_FLAG | (N))
+#define M_COMPONENT_BY_SOURCE_ID(N)                  (M_COMPONENT_BY_SOURCE_ID_FLAG | (N))
+
+#define M_COMPONENT_EXTRACT_VALUE(N)                  ((N) & ~M_COMPONENT_BY_MASK)
+#define M_COMPONENT_EXTRACT_FLAG(N)                   ((N) & M_COMPONENT_BY_MASK)
+
+
+
+/************************************************************************/
+/* MbufControl() MbufInquire() Values                                   */
+/************************************************************************/
+#define M_MAX_INTERNAL_BUFFERS                        8L
+#define M_MAX_NB_GRAB_BUFFERS                         8L
+
+#define M_MEGABUFFER_GRAB                    0x08000000L
+
+#define M_ODD_FIELD                                   1L
+#define M_EVEN_FIELD                                  2L
+#define M_BOTH_FIELDS                                 3L
+#define M_NO_HOOK                            0x00000004L
+#define M_GRAB_TYPE_PSEUDO                            5L
+#define M_GRAB_TYPE_LIVE                              6L
+#define M_GRAB_TYPE_PSEUDO_MULTIPLE_BUFFERS           7L
+#define M_GRAB_TYPE_NO_TEARING                        8L
+#define M_GRAB_TYPE_ENCODER                           9L
+#define M_GRAB_TYPE_PSEUDO_SINGLE_BUFFER              10L
+#define M_GRAB_FORCE_IN_USER_BUFFER                   11L
+#define M_GRAB_FORCE_WITHOUT_UNDERLAY                 12L
+#define M_UNCONDITIONAL                               0L
+
+#define M_CONDITIONAL                                 1L
+
+#define M_INVALID                                     -1
+#define M_DEFAULT                            0x10000000L
+
+#define  M_YCBCR_SD                                   1L
+#define  M_YCBCR_HD                                   2L
+#define  M_YCBCR_UHD                                  3L
+
+#define M_MPEG_P_FRAME                                0L
+#define M_MPEG_I_FRAME                                1L
+#define M_MPEG_B_FRAME                                2L
+
+#define M_ODD_EVEN                                    1L
+#define M_EVEN_ODD                                    2L
+
+#define M_INCREMENT_ASYNC                             1L
+#define M_DECREMENT_ASYNC                             2L
+#define M_INTERNAL_THREAD_CALL               0x00000004L
+
+#define M_LUT_REPLICATE_2X                            1L
+#define M_LUT_REPLICATE_4X                            2L
+#define M_LUT_ADDRESS_ZOOM_2X                         3L
+#define M_WARP_TILE                                   4L
+#define M_STREAM_COPY                                 5L
+
+#define M_NONE                               0x08000000L // Also defined in milcal.h, milcolor.h
+#define M_VECTOR                                   1411L
+#define M_RASTER                                   1416L
+#define M_VECTOR_AND_RASTER                        1417L
+
+// Used for M_SPPD_PEAK_MODE
+#define M_SPPD_STRONGEST                           0L
+#define M_SPPD_FIRST                               1L
+#define M_SPPD_SECOND                              2L
+#define M_SPPD_THIRD                               3L
+
+// M_SPPD_OUTPUT_FORMAT:
+#define M_SPPD                                     0L
+#define M_DATA_REDUCTION                           1L
+
+
+#define M_PROCESSABLE                                28L
+#define M_NOT_PROCESSABLE                            29L
+#define M_DISPLAYABLE                                30L
+#define M_DISPLAYABLE_WITH_CONVERSION                31L 
+#define M_NOT_DISPLAYABLE                            32L
+#define M_CONVERTIBLE                                33L
+#define M_CONVERTIBLE_WITH_COMPENSATION              34L 
+#define M_NOT_CONVERTIBLE                            35L
+/************************************************************************/
+/* MbufControlRegion() ControlTypes                                     */
+/************************************************************************/
+#define M_MODIFIED                                 4096L  //bitwise value 0x00001000
+
+
+#define M_GRAB_TIME_STAMP                    0x00000040L
+#define M_ALWAYS_SYNCHRONOUS                 0x40000000L
+#define M_MODIFIED_WITH_ERROR                0x20000000L
+#define M_DRIVER_ASYNC_CALL_CANCELLED        0x10000000L
+#define M_DRIVER_ASYNC_CALL_END              0x08000000L
+#define M_DRIVER_RESET_HOOK_CONTEXT_ID       0x04000000L
+#define M_MODIFIED_DIGITIZER                 0x02000000L
+#define M_MODIFIED_DIGITIZER_WITH_ERROR      0x01000000L
+#define M_MODIFIED_DIGITIZER_CORRUPT         0x00800000L
+#define M_MODIFIED_BY_DIRECTX                      5400L
+
+/************************************************************************/
+/* MbufControlRegion() ControlValues                                    */
+/************************************************************************/
+
+#define M_NO_HOOK                            0x00000004L
+#define M_NO_MODIFIED_HOOK                   0x00000008L
+
+#define M_ODD_FIELD                                   1L
+#define M_EVEN_FIELD                                  2L
+#define M_BOTH_FIELDS                                 3L
+#define M_ANY_FIELD                                   4L
+
+/************************************************************************/
+/* MbufSetRegion()                                                      */
+/************************************************************************/
+#define M_NO_RASTERIZE                                1L
+#define M_DELETE                                      3L
+#define M_RASTERIZE_AND_DISCARD_LIST               1414L
+#define M_RASTERIZE                                1415L
+#define M_LINK_TO_PARENT                           1774L
+#define M_COPY                               0x00020000L
+#define M_MERGE                              0x00000040L
+#define M_EXTRACT                            0x00040000L
+
+/* Combination flag */
+#define M_FILL_REGION                        0x00080000L
+
+/************************************************************************/
+/* MbufDiskInquire()                                                    */
+/************************************************************************/
+#define M_LUT_PRESENT                                 6000L
+#define M_ASPECT_RATIO                                6001L
+#define M_FRAME_RATE                                  6002L
+#define M_NUMBER_OF_IMAGES                            6003L
+#define M_CALIBRATION_PRESENT                         1400L
+#define M_CALIBRATION_CONTEXT_PRESENT                 1401L
+#define M_REGION_PRESENT                              1461L
+
+/* Common with other Inquire/Control */
+#define M_ABSOLUTE_VALUE                              50L
+#define M_NORMALIZATION_FACTOR                        52L
+#define M_OVERSCAN                                    53L
+#define M_OVERSCAN_REPLACE_VALUE                      54L
+#define M_OFFSET_CENTER_X                             55L
+#define M_OFFSET_CENTER_Y                             56L
+#define M_SIZE_X                                      1536L // 0x600
+#define M_SIZE_Y                                      1537L // 0x601
+#define M_SIZE_BAND                                   1005L
+#define M_SIZE_BIT                                    1007L
+#define M_TYPE                                        1008L
+#define M_ATTRIBUTE                                   1013L
+#define M_SIGN                                        1014L
+#define M_GREEN                                       0x10L
+#define M_SATURATION                                  0x2000L
+
+#define M_FILE_FORMAT                                 1015L
+#define M_IS_VIDEO_FILE_FORMAT(x) (((x) == M_AVI_MIL) || \
+                                   ((x) == M_AVI_DIB) || \
+                                   ((x) == M_AVI_MJPG) || \
+                                   ((x) == M_AVI_MPG4) || \
+                                   ((x) == M_AVI_H264) || \
+                                   ((x) == M_AVI_CODEC))
+#define M_IS_IMAGE_FILE_FORMAT(x) (((x) == M_BMP) || \
+                                   ((x) == M_JPEG_LOSSLESS) || \
+                                   ((x) == M_JPEG_LOSSY) || \
+                                   ((x) == M_JPEG_LOSSLESS_INTERLACED) || \
+                                   ((x) == M_JPEG_LOSSY_INTERLACED) || \
+                                   ((x) == M_JPEG2000_LOSSY) || \
+                                   ((x) == M_JPEG2000_LOSSLESS) || \
+                                   ((x) == M_TIFF) || \
+                                   (M_TIFF_IS_COMPRESSED(x)) || \
+                                   ((x) == M_MIL_TIFF) || \
+                                   ((x) == M_PNG))
+#define M_IS_3DMODEL_FILE_FORMAT(x) (((x) == M_PLY_ASCII) || \
+                                   ((x) == M_PLY_BINARY_LITTLE_ENDIAN) || \
+                                   ((x) == M_STL_ASCII) || \
+                                   ((x) == M_STL_BINARY))
+
+#define M_LUT                                         0x00040000L
+// Reserved M_SIZE_X+M_LUT                            0x00040600L or 263680L
+
+/************************************************************************/
+/* Lattice values                                                       */
+/************************************************************************/
+#define M_4_CONNECTED                                 0x00000010L
+#define M_8_CONNECTED                                 0x00000020L
+
+/************************************************************************/
+/* Data types for results                                               */
+/************************************************************************/
+
+#define M_TYPE_COMMAND                                0x00008000L       // used in drivers (gigevision)
+#define M_TYPE_MIL_DOUBLE                             M_TYPE_DOUBLE
+#define M_TYPE_MIL_FLOAT                              M_TYPE_FLOAT
+#define M_TYPE_INT64                                  M_TYPE_MIL_INT64
+#define M_TYPE_PTR                                    0x00200000L       // used in mil (MappGetHookInfo), in drivers and in dmil
+#define M_TYPE_STRING_PTR                             M_TYPE_STRING     // used in mil, dmil, drivers
+#define M_TYPE_BOOLEAN                                0x01000000L       // used in drivers (gigevision)
+#define M_TYPE_FILENAME                               0x08000000L       // used in mil (MappGetHookInfo)
+#define M_TYPE_ARRAY_ID_PTR                           0x10000000L       // used in mil (MappGetHookInfo)
+#define M_TYPE_ENUMERATION                            0x40000000L       // see M_TYPE_INTEGER_ENUMERATION and M_TYPE_STRING_ENUMERATION
+#define M_TYPE_UINT8                                  M_TYPE_MIL_UINT8
+#define M_TYPE_REGISTER                               MAKE_INT64(0x0000000080000000)
+#define M_TYPE_VALUE                                  0x00004000L
+#if OldDefinesSupport
+#define M_TYPE_INTEGER_ENUMERATION                    M_TYPE_ENUMERATION + M_TYPE_MIL_INT32 // used indirectly in mil, drivers (gigevision)
+#define M_TYPE_STRING_ENUMERATION                     M_TYPE_ENUMERATION + M_TYPE_STRING    // used indirectly in mil, drivers (gigevision)
+#define M_TYPE_ENUMERATION_FROM_STRING                M_TYPE_ENUMERATION + M_TYPE_STRING    // used indirectly in mil, drivers (gigevision)
+#define M_TYPE_REGISTER_FROM_STRING                   M_TYPE_REGISTER + M_TYPE_STRING
+#define M_TYPE_VALUE_FROM_STRING                      M_TYPE_VALUE + M_TYPE_STRING
+MIL_DEPRECATED(M_TYPE_INTEGER_ENUMERATION, 1000)      // New Control Feature API Replaced by M_TYPE_ENUMERATION as FeatrureType, UserVarPtr must be a pointer to a MIL_INT64
+MIL_DEPRECATED(M_TYPE_STRING_ENUMERATION, 1000)       // New Control Feature API Replaced by M_TYPE_ENUMERATION as FeatrureType and M_FEATURE_VALUE_AS_STRING as ControlType, UserVarPtr must be an array of MIL_TEXT_CHAR
+MIL_DEPRECATED(M_TYPE_ENUMERATION_FROM_STRING, 1000)  // New Control Feature API Replaced by M_TYPE_ENUMERATION as FeatrureType and M_FEATURE_VALUE_AS_STRING as ControlType, UserVarPtr must be an array of MIL_TEXT_CHAR
+MIL_DEPRECATED(M_TYPE_REGISTER_FROM_STRING, 1000)     // New Control Feature API Replaced by M_TYPE_REGISTER as FeatrureType and M_FEATURE_VALUE_AS_STRING as ControlType, UserVarPtr must be an array of MIL_TEXT_CHAR
+MIL_DEPRECATED(M_TYPE_VALUE_FROM_STRING, 1000)        // New Control Feature API Replaced by M_DEFAULT as FeatrureType and M_FEATURE_VALUE_AS_STRING as ControlType, UserVarPtr must be an array of MIL_TEXT_CHAR
+#endif
+
+#define M_TYPE_CATEGORY                               0x00002000L
+
+#define M_MAX_BYTE_COUNT                              0x00007FFCL  //Maximum payload of a M_TYPE_REGISTER.
+
+#if OldDefinesSupport
+#define M_BYTE_COUNT(n)                               (n)  //Used in combination with M_TYPE_REGISTER for GigE Vision
+MIL_DEPRECATED(M_BYTE_COUNT, 1060)        // New Control Feature API Replaced by M_FEATURE_USER_ARRAY_SIZE() as combination constant to M_TYPE_UINT8 (previously known as M_TYPE_REGISTER) or M_TYPE_STRING
+#endif
+
+#if M_MIL_USE_64BIT
+   #define M_TYPE_MIL_INT                             M_TYPE_MIL_INT64
+#else
+   #define M_TYPE_MIL_INT                             M_TYPE_MIL_INT32
+#endif
+#if M_MIL_USE_LINUX && M_MIL_USE_64BIT
+   #define M_TYPE_LONG                                M_TYPE_MIL_INT64
+#else
+   #define M_TYPE_LONG                                M_TYPE_MIL_INT32
+#endif
+
+
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL)) || M_MIL_USE_LINUX
+#define M_TYPE_TEXT_CHAR                              M_TYPE_CHAR
+#else
+#define M_TYPE_TEXT_CHAR                              M_TYPE_MIL_TEXT
+#endif
+
+/************************************************************************/
+/* Data types for inquiring parameters type                             */
+/************************************************************************/
+
+#define M_PARAM_TYPE_CONST                   0x10000000
+#define M_PARAM_TYPE_POINTER                 0x08000000
+#define M_PARAM_TYPE_FILENAME                0x04000000
+#define M_PARAM_TYPE_UNICODE                 0x02000000
+#define M_PARAM_TYPE_ASCII                   0x01000000
+
+#define M_FIRST_PARAM_TYPE                   1
+#define M_PARAM_TYPE_MIL_INT                 1
+#define M_PARAM_TYPE_MIL_UINT                2
+#define M_PARAM_TYPE_MIL_DOUBLE              3
+#define M_PARAM_TYPE_MIL_ID                  4
+#define M_PARAM_TYPE_MIL_INT32               5
+#define M_PARAM_TYPE_MIL_UINT32              6
+#define M_PARAM_TYPE_MIL_INT64               7
+#define M_PARAM_TYPE_MIL_UINT64              8
+#define M_PARAM_TYPE_VOID                    9
+#define M_PARAM_TYPE_CHAR                   10
+#define M_PARAM_TYPE_MIL_FLOAT              11
+#define M_PARAM_TYPE_MIL_INT8               12
+#define M_PARAM_TYPE_MIL_UINT8              13
+#define M_PARAM_TYPE_MIL_INT16              14
+#define M_PARAM_TYPE_MIL_UINT16             15
+#define M_PARAM_TYPE_MIL_CHAR               16  // for array of MIL_TEXT_CHAR
+#define M_PARAM_TYPE_MIL_UUID               17
+#define M_LAST_PARAM_TYPE                   17 // Always equal to the
+                                               // last parameter type value
+
+
+#define M_PARAM_TYPE_ARRAY_MIL_INT           (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT   )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT          (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT  )
+#define M_PARAM_TYPE_ARRAY_MIL_UUID          (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UUID  )
+#define M_PARAM_TYPE_ARRAY_MIL_DOUBLE        (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_DOUBLE)
+#define M_PARAM_TYPE_ARRAY_MIL_FLOAT         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_FLOAT )
+#define M_PARAM_TYPE_ARRAY_MIL_ID            (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_ID    )
+#define M_PARAM_TYPE_ARRAY_MIL_INT8          (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT8  )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT8         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT8 )
+#define M_PARAM_TYPE_ARRAY_MIL_INT16         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT16 )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT16        (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT16)
+#define M_PARAM_TYPE_ARRAY_MIL_INT32         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT32 )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT32        (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT32)
+#define M_PARAM_TYPE_ARRAY_MIL_INT64         (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_INT64 )
+#define M_PARAM_TYPE_ARRAY_MIL_UINT64        (M_PARAM_TYPE_POINTER + M_PARAM_TYPE_MIL_UINT64)
+
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT           (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT    | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT   | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UUID          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UUID   | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_DOUBLE        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_DOUBLE | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_FLOAT         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_FLOAT  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_ID            (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_ID     | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT8          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT8   | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT8         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT8  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT16         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT16  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT16        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT16 | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT32         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT32  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT32        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT32 | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_INT64         (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_INT64  | M_PARAM_TYPE_CONST)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_UINT64        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_UINT64 | M_PARAM_TYPE_CONST)
+
+#define M_PARAM_TYPE_ARRAY_MIL_CHAR                (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR)                           // only for API usage
+#define M_PARAM_TYPE_ARRAY_MIL_CHAR_ASCII          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_ASCII)
+#define M_PARAM_TYPE_ARRAY_MIL_CHAR_UNICODE        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_UNICODE)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_CHAR          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_CONST)      // only for API usage
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_CHAR_ASCII    (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_CONST | M_PARAM_TYPE_ASCII)
+#define M_PARAM_TYPE_CONST_ARRAY_MIL_CHAR_UNICODE  (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_MIL_CHAR | M_PARAM_TYPE_CONST | M_PARAM_TYPE_UNICODE)
+
+#define M_PARAM_TYPE_MIL_TEXT                (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR)                           // only for API usage
+#define M_PARAM_TYPE_DATA_PTR                (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_VOID)
+#define M_PARAM_TYPE_MIL_TEXT_UNICODE        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR  | M_PARAM_TYPE_UNICODE)
+#define M_PARAM_TYPE_MIL_TEXT_ASCII          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR  | M_PARAM_TYPE_ASCII)
+#define M_PARAM_TYPE_CONST_MIL_TEXT          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CONST | M_PARAM_TYPE_CHAR)                           // only for API usage
+#define M_PARAM_TYPE_CONST_DATA_PTR          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CONST | M_PARAM_TYPE_VOID)
+#define M_PARAM_TYPE_CONST_MIL_TEXT_UNICODE  (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CONST | M_PARAM_TYPE_CHAR | M_PARAM_TYPE_UNICODE)
+#define M_PARAM_TYPE_CONST_MIL_TEXT_ASCII    (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CONST | M_PARAM_TYPE_CHAR | M_PARAM_TYPE_ASCII)
+#define M_PARAM_TYPE_FILENAME_UNICODE        (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR  | M_PARAM_TYPE_UNICODE | M_PARAM_TYPE_FILENAME)
+#define M_PARAM_TYPE_FILENAME_ASCII          (M_PARAM_TYPE_POINTER | M_PARAM_TYPE_CHAR  | M_PARAM_TYPE_ASCII   | M_PARAM_TYPE_FILENAME)
+
+
+/* Bit encoded image types */
+#define M_GREYSCALE                                   0x0200L
+#define M_GRAYSCALE                                   M_GREYSCALE
+
+/************************************************************************/
+/* MseqAlloc()                                                          */
+/************************************************************************/
+
+#define M_FOURCC_CODE(c0)  ((MIL_UINT32)c0)
+#define M_MAKEFOURCC_CODE(c0, c1, c2, c3)  ((MIL_UINT32) (unsigned char) (c0) | \
+                                    ((MIL_UINT32) (unsigned char) (c1) << 8) | \
+                                    ((MIL_UINT32) (unsigned char) (c2) << 16) | \
+                                    ((MIL_UINT32) (unsigned char) (c3) << 24))
+
+
+// Actions for Mseq Module
+#define M_SEQ_COMPRESS              1L
+#define M_SEQ_DECOMPRESS            2L
+#define M_SEQ_ENCAPSULATION         4L    // unsupported but probably useful
+
+
+#define MSEQSYSTEMS(x)              (x<<8)
+#define MSEQSYSTEMS_MASK            MSEQSYSTEMS(0x000F)
+#define M_QSV                       MSEQSYSTEMS(1L)
+#define M_CLARITY_UHD_H264          MSEQSYSTEMS(2L)
+// 15 system types reserved MSEQSYSTEMES(1 - 15)
+
+/************************************************************************/
+/* MseqDefine()                                                         */
+/************************************************************************/
+// Seq Container types 0 reserved for invalid
+#define M_CONTEXT                0x08000000L // already defined elsewhere
+#define M_PIPE                   23L
+#define M_BUFFER_LIST            24L
+#define M_FILE                   25L         // already defined elsewhere
+#define M_USER_HOOK              26L
+#define M_USER_FEED              27L
+
+#define M_FILE_FORMAT_TYPE(X)          ((X<<5)|M_CLIENT_ENCODING)
+
+#define M_FILE_FORMAT_MASK             M_FILE_FORMAT_TYPE(0x0FFFF)
+#define M_FILE_FORMAT_AVI              M_FILE_FORMAT_TYPE(1)
+#define M_FILE_FORMAT_MP4              M_FILE_FORMAT_TYPE(3)
+#define M_FILE_FORMAT_H264             M_FILE_FORMAT_TYPE(4)
+#define M_FILE_FORMAT_MPEGTS           M_FILE_FORMAT_TYPE(5)
+#define M_FILE_FORMAT_RAW              M_FILE_FORMAT_TYPE(6)
+
+
+#define M_SEQ_CONTAINER_SOURCE         (2L << 16)
+#define M_SEQ_CONTAINER_DESTINATION    (1L << 16)
+#define M_SEQ_CONTAINER_MAX_COUNT      32L
+#define M_SEQ_CONTAINER_MASK           0x0000001F
+#define M_EXTRACT_SEQ_CONTAINER_INDEX(x)   (x & M_SEQ_CONTAINER_MASK)
+
+#define M_SEQ_CONTAINER_OUTPUT         (1L << 22)
+#define M_SEQ_CONTAINER_IO_MAX_COUNT   16L
+#define M_SEQ_CONTAINER_IO_MASK        (0x0F << 18)
+#define M_EXTRACT_SEQ_CONTAINER_IO_INDEX(x)  ((x&M_SEQ_CONTAINER_SOURCE)? (M_EXTRACT_SEQ_CONTAINER_INDEX(x)) : ((x & M_SEQ_CONTAINER_IO_MASK) >> 18))
+
+#define M_SEQ_SRC(_x_)                 (M_SEQ_CONTAINER_SOURCE | _x_)
+#define M_SEQ_DEST(_x_)                (M_SEQ_CONTAINER_DESTINATION | _x_)
+
+#define M_SEQ_INPUT(_x_)               M_SEQ_SRC(_x_)
+#define M_SEQ_OUTPUT(_x_)              (M_SEQ_CONTAINER_OUTPUT | (_x_ << 18))
+
+#define M_SEQ_FILE_MODE_MASK           (M_READ | M_WRITE)
+
+#define M_BUFFER_RELEASE                              1066L
+
+/************************************************************************/
+/* MseqInquire()                                                        */
+/************************************************************************/
+#define M_EFFECTIVE_VALUE                             0x01000000
+#define M_TYPE                                        1008L
+#define M_FILE_FORMAT                                 1015L
+#define M_STREAM_FILE_NAME                           (3904L | M_CLIENT_ENCODING) // 0x00000F40
+#if OldDefinesSupport
+#define M_STREAM_FILE_NAME_SIZE                       (M_STRING_SIZE + M_STREAM_FILE_NAME)
+MIL_DEPRECATED(M_STREAM_FILE_NAME_SIZE, 1040)
+#endif
+#define M_STREAM_FILE_MODE                            1068L
+#define M_BUFFER_COUNT                                1069L
+
+#define M_BUFFER_SAMPLE                               1070L
+
+#define M_SIZE_X                                      1536L // already defined elsewhere
+#define M_SIZE_Y                                      1537L // already defined elsewhere
+
+
+#define M_CODEC_TYPE                                  1540L
+
+#define M_SETTING_AUTO_ADJUSTMENT                     1541L
+#define M_STREAM_FRAME_RATE_MODE                      1542L
+#define M_CONTEXT_VALID                               1543L
+
+#define M_STREAM_BIT_RATE_MODE                        3328L // already defined elsewhere
+#define M_STREAM_BIT_RATE                             3392L // already defined elsewhere
+#define M_STREAM_QUALITY                              3520L // already defined elsewhere
+#define M_STREAM_BIT_RATE_MAX                         3584L // already defined elsewhere
+#define M_STREAM_GROUP_OF_PICTURE_SIZE                3648L // already defined elsewhere
+#define M_STREAM_FRAME_RATE                           3712L // already defined elsewhere
+#define M_STREAM_ENCODING_MODE                        3840L // already defined elsewhere
+#define M_STREAM_PROFILE                              4032L // already defined elsewhere
+#define M_STREAM_LEVEL                                4096L // already defined elsewhere
+#define M_STREAM_GROUP_OF_PICTURE_TYPE                4160L // already defined elsewhere
+#define M_STREAM_GROUP_OF_PICTURE_P_SIZE              4224L // already defined elsewhere
+#define M_STREAM_GROUP_OF_PICTURE_I_SIZE              4288L // already defined elsewhere
+
+#define M_SEQ_CONTAINER_INQUIRE_SIZEOF_INT64_START    6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+
+#define M_SEQ_CONTAINER_INQUIRE_SIZEOF_INT64_END      6799L
+
+
+
+// MseqInquire() / MseqControl() values
+#define M_PROFILE_BASELINE                            102L // already defined elsewhere
+#define M_PROFILE_MAIN                                103L // already defined elsewhere
+#define M_PROFILE_HIGH                                104L // already defined elsewhere
+
+#define M_LEVEL_1                                     100L
+#define M_LEVEL_1B                                    102L
+#define M_LEVEL_1_1                                   110L
+#define M_LEVEL_1_2                                   120L
+#define M_LEVEL_1_3                                   130L
+#define M_LEVEL_2                                     200L
+#define M_LEVEL_2_1                                   210L
+#define M_LEVEL_2_2                                   220L
+#define M_LEVEL_3                                     300L
+#define M_LEVEL_3_1                                   310L
+#define M_LEVEL_3_2                                   320L
+#define M_LEVEL_4                                     400L
+#define M_LEVEL_4_1                                   410L
+#define M_LEVEL_4_2                                   420L
+#define M_LEVEL_5                                     500L
+#define M_LEVEL_5_1                                   510L
+#define M_LEVEL_5_2                                   520L
+
+/************************************************************************/
+/* MseqHookFunction()                                                   */
+/************************************************************************/
+#define M_FRAME_END                                   0x0000000aL // already defined elsewhere
+#define M_SEQUENCE_END                                0x0000000bL
+
+/************************************************************************/
+/* MgraAlloc()                                                           */
+/************************************************************************/
+#define M_DEFAULT_GRAPHIC_CONTEXT                     M_MAKE_DEFAULT_ID(2)
+
+/************************************************************************/
+/* MgraAllocList()                                                      */
+/************************************************************************/
+#define M_DRAW_LIST                             1022L
+
+/************************************************************************/
+/* MgraDots()                                                           */
+/************************************************************************/
+#define M_PACKED_X_Y_ANGLE                            0x00080000L
+
+/************************************************************************/
+/* MgraLines()                                                          */
+/************************************************************************/
+#define M_LINE_LIST                                   0x00000010L
+#define M_POLYLINE                                    0x00000020L
+#define M_POLYGON                                     0x00000040L
+#define M_FILLED                                      0x00000080L
+#define M_PACKED                                      0x00020000L
+#define M_INFINITE_LINES                              0x00000100L
+#define M_INFINITE_LINES_A_B_C                        0x00000200L
+
+/************************************************************************/
+/* MgraRectAngle                                                        */
+/************************************************************************/
+#define M_CORNER_AND_DIMENSION                        0x00000001L
+#define M_CENTER_AND_DIMENSION                        0x00000002L
+#define M_BOTH_CORNERS                                0x00000004L
+#define M_FILLED                                      0x00000080L
+
+/************************************************************************/
+/* MgraArcAngle                                                         */
+/************************************************************************/
+#define M_CONTOUR                                          0x800L
+#define M_SECTOR                                      0x00000300L
+
+#define M_FILLED                                      0x00000080L
+
+/************************************************************************/
+/* MgraImage                                                            */
+/************************************************************************/
+#define M_DRAW_REGION                                 0x00000010L
+#define M_NO_ERROR_ON_MISSING_CALIBRATION             0x00000020L
+#define M_DRAW_ERROR_ON_MISSING_CALIBRATION           0x00000040L
+#define M_DRAW_FOREGROUND_ON_NON_ZERO_PIXELS          0x00000080L
+#define M_DRAW_FOREGROUND_ON_ZERO_PIXELS              0x00000100L
+
+/************************************************************************/
+/* MgraFont()                                                           */
+/************************************************************************/
+#define M_FONT_DEFAULT_SMALL                          1L
+#define M_FONT_DEFAULT_MEDIUM                         2L
+#define M_FONT_DEFAULT_LARGE                          3L
+#define M_FONT_DEFAULT                                M_FONT_DEFAULT_SMALL
+#define M_FONT_TTF                                    4L
+
+#define MIL_FONT_NAME(name)                          ((MIL_ADDR )(name))
+/* Using TrueType Font */
+#define M_FONT_DEFAULT_TTF                            MIL_TEXT("MILFont")
+#define M_TTF_FONT_DEFAULT_SIZE                       12L //12pt
+
+/************************************************************************/
+/* Used by MgraControl() / MgraInquire() / MgraControlList() / MgraInquireList() Types */
+/************************************************************************/
+
+/* Index modifiers for list */
+#define M_DEFAULT                                     0x10000000L
+#define M_LIST                                        0x08000000L
+#define M_ALL                                         0x40000000L
+
+#define M_GRAPHIC_INDEX_TAG                           0x01000000L
+#define M_GRAPHIC_INDEX(a)                            (M_GRAPHIC_INDEX_TAG + (a))
+#define M_GRAPHIC_LABEL_TAG                           0x02000000L
+#define M_GRAPHIC_LABEL(a)                            (M_GRAPHIC_LABEL_TAG + (a))
+
+#define M_NO_LABEL                                    0x20000000L   // Also defined in milmod.h
+#define M_MULTIPLE_LABELS                             0x30000000L
+
+/* ControlType, InquireType applicable to graphic contexts and graphic lists */
+
+
+#define M_COLOR                                       0x00000100L // 256L
+// Reserved values with M_COLOR
+// M_COLOR+M_RED                                      264L  // 0x00000108L
+// M_COLOR+M_GREEN                                    272L  // 0x00000110L
+// M_COLOR+M_BLUE                                     288L  // 0x00000120L
+
+#define M_BACKCOLOR                                   0x00000200L // 512L
+// Reserved values with M_BACKCOLOR
+// M_BACKCOLOR+M_RED                                  520L  // 0x00000208L
+// M_BACKCOLOR+M_GREEN                                528L  // 0x00000210L
+// M_BACKCOLOR+M_BLUE                                 544L  // 0x00000220L
+#define M_BACK_COLOR                                  M_BACKCOLOR
+
+#define M_SELECTED_COLOR                              0x00000300L // 768L
+// Reserved values with M_SELECTED_COLOR
+// M_SELECTED_COLOR+M_RED                             776L  // 0x00000308L
+// M_SELECTED_COLOR+M_GREEN                           784L  // 0x00000310L
+// M_SELECTED_COLOR+M_BLUE                            800L  // 0x00000320L
+
+#define M_INTERACTIVE_ANNOTATIONS_COLOR               0x00000400L // 1024L
+// Reserved values with M_INTERACTIVE_ANNOTATIONS_COLOR
+// M_INTERACTIVE_ANNOTATIONS_COLOR+M_RED              1032L // 0x00000408L
+// M_INTERACTIVE_ANNOTATIONS_COLOR+M_GREEN            1040L // 0x00000410L
+// M_INTERACTIVE_ANNOTATIONS_COLOR+M_BLUE             1056L // 0x00000420L
+
+#define M_FONT                                        (7L | M_CLIENT_ENCODING)
+#define M_FONT_X_SCALE                                8L
+#define M_FONT_Y_SCALE                                9L
+#define M_BACKGROUND_MODE                             12L
+#define M_RGB_COLOR_MODE                              13L
+
+
+#define M_SELECTABLE                                  50L
+#define M_RESIZABLE                                   51L
+#define M_ROTATABLE                                   52L
+#define M_TRANSLATABLE                                53L
+#define M_TEXT_ALIGN_HORIZONTAL                       58L
+#define M_TEXT_ALIGN_VERTICAL                         71L
+#define M_GRAPHIC_SELECTED                            75L
+#define M_INPUT_UNITS                                 121L        // Also defined in milcal.h, milmeas.h
+#define M_FILLED                                      0x00000080L // 128L
+#define M_OWNER_SYSTEM_TYPE                           1023L
+
+#define M_GRA_INQUIRE_MIL_ID_RANGE_START              1100L
+#define M_OWNER_SYSTEM                                1101L
+#define M_GRAPHIC_SOURCE_CALIBRATION                  1113L
+#define M_GRA_INQUIRE_MIL_ID_RANGE_END                1199L
+
+#if OldDefinesSupport
+   #define M_DRAW_RELATIVE_ORIGIN_X                    319L // deprecated : Use MgraControl(... M_DRAW_OFFSET_X...)
+   #define M_DRAW_RELATIVE_ORIGIN_Y                    320L // deprecated : Use MgraControl(... M_DRAW_OFFSET_Y...)
+   #define M_DRAW_SCALE_X                             3203L // deprecated : Use MgraControl(... M_DRAW_ZOOM_X ...)
+   #define M_DRAW_SCALE_Y                             3204L // deprecated : Use MgraControl(... M_DRAW_ZOOM_Y ...)
+   #define M_MOVABLE                                  M_TRANSLATABLE // deprecated : Use M_TRANSLATABLE
+
+   MIL_DEPRECATED(M_DRAW_RELATIVE_ORIGIN_X, 1010)           
+   MIL_DEPRECATED(M_DRAW_RELATIVE_ORIGIN_Y, 1010)           
+   MIL_DEPRECATED(M_DRAW_SCALE_X, 1010)                     
+   MIL_DEPRECATED(M_DRAW_SCALE_Y, 1010)                     
+   MIL_DEPRECATED(M_MOVABLE, 1060)
+#endif    
+
+#define M_GRA_INQUIRE_DOUBLE_RANGE_START              1200L
+#define M_DRAW_ZOOM_X                                 1203L
+#define M_DRAW_ZOOM_Y                                 1204L
+#define M_DRAW_OFFSET_X                               1205L
+#define M_DRAW_OFFSET_Y                               1206L
+#define M_RADIUS_X                                    1210L
+#define M_RADIUS_Y                                    1211L
+#define M_RECTANGLE_WIDTH                             1212L
+#define M_RECTANGLE_HEIGHT                            1213L
+#define M_SYMBOL_DIMENSION                            1214L
+#define M_INNER_RADIUS_X                              1215L
+#define M_INNER_RADIUS_Y                              1216L
+#define M_OUTER_RADIUS_X                              1217L
+#define M_OUTER_RADIUS_Y                              1218L
+#define M_INNER_TO_OUTER_RADIUS                       2793L
+#define M_OUTER_TO_INNER_RADIUS                       2794L
+#define M_RADII_DIRECTION                             2795L 
+#define M_START_RADIUS_X                              2796L
+#define M_START_RADIUS_Y                              2797L
+#define M_END_RADIUS_X                                2798L
+#define M_END_RADIUS_Y                                2799L
+#define M_SELECTION_RADIUS                            1219L
+#define M_CONSTRAIN_ASPECT_RATIO                      1220L
+#define M_CORNER_X(N)                                (1221L + (N)+ ((N) > 3 ? 2595 : 0))
+#define M_CORNER_Y(N)                                (1225L + (N)+ ((N) > 3 ? 2595 : 0))
+#define M_CORNER_TOP_LEFT_X                           M_CORNER_X(0)
+#define M_CORNER_TOP_RIGHT_X                          M_CORNER_X(1)
+#define M_CORNER_BOTTOM_RIGHT_X                       M_CORNER_X(2)
+#define M_CORNER_BOTTOM_LEFT_X                        M_CORNER_X(3)
+#define M_CORNER_TOP_LEFT_Y                           M_CORNER_Y(0)
+#define M_CORNER_TOP_RIGHT_Y                          M_CORNER_Y(1)
+#define M_CORNER_BOTTOM_RIGHT_Y                       M_CORNER_Y(2)
+#define M_CORNER_BOTTOM_LEFT_Y                        M_CORNER_Y(3)
+#define M_GRA_INQUIRE_DOUBLE_RANGE_END                1299L
+
+#define M_VISIBLE                                     1533L
+#define M_SYMBOL_TYPE                                 1629L
+#define M_SYMBOL_DIMENSION_INPUT_UNITS                1630L
+#define M_LINE_ENDS_DIMENSION_INPUT_UNITS             1639L
+#define M_LINE_ENDS_STYLE                             1640L
+#define M_LINE_ENDS_DIMENSION                         1641L
+#define M_LINE_THICKNESS                              4001L // Also used in M3dgra
+
+#define M_GRAPHIC_CONVERSION_MODE                     1721L
+#define M_ARC_STYLE                                   1722L
+#define M_INTERACTIVITY                               1724L
+#define M_INTERACTIVE_GRAPHIC_STATE                   1746L
+#define M_CALIBRATION                                 1770L
+#define M_FIXTURE                                     1771L
+#define M_EDITABLE                                    1772L
+#define M_SYMBOL_ANGLE_INPUT_UNITS                    1775L
+#define M_SPECIFIC_FEATURES_EDITABLE                  1778L
+#define M_TEXT_BORDER                                 1785L
+#define M_MULTIPLE_SELECTION                          1786L
+#define M_DRAW_DIRECTION                              2767L
+
+#define M_MODE_RESIZE                                 2684L
+#define M_MODE_ROTATE                                 2685L
+#define M_MODE_TRANSLATE                              2686L
+#define M_ANGLE_SNAPPING_VALUE                        2687L
+#define M_MODE_RESIZE_SECONDARY_DIMENSION             2732L
+
+#define M_KEY_SHIFT                             0x00010000  // already defined in mildisplay.h
+#define M_KEY_CTRL                              0x00020000  // already defined in mildisplay.h
+#define M_KEY_ALT                               0x00040000  // already defined in mildisplay.h
+#define M_MODE_RESIZE_SHIFT                           (M_MODE_RESIZE    | M_KEY_SHIFT)
+#define M_MODE_RESIZE_CTRL                            (M_MODE_RESIZE    | M_KEY_CTRL )
+#define M_MODE_RESIZE_ALT                             (M_MODE_RESIZE    | M_KEY_ALT  )
+#define M_MODE_ROTATE_SHIFT                           (M_MODE_ROTATE    | M_KEY_SHIFT)
+#define M_MODE_ROTATE_CTRL                            (M_MODE_ROTATE    | M_KEY_CTRL )
+#define M_MODE_ROTATE_ALT                             (M_MODE_ROTATE    | M_KEY_ALT  )
+#define M_MODE_TRANSLATE_SHIFT                        (M_MODE_TRANSLATE | M_KEY_SHIFT)
+#define M_MODE_TRANSLATE_CTRL                         (M_MODE_TRANSLATE | M_KEY_CTRL )
+#define M_MODE_TRANSLATE_ALT                          (M_MODE_TRANSLATE | M_KEY_ALT  )
+#define M_MODE_RESIZE_SECONDARY_DIMENSION_SHIFT       (M_MODE_RESIZE_SECONDARY_DIMENSION | M_KEY_SHIFT)
+#define M_MODE_RESIZE_SECONDARY_DIMENSION_CTRL        (M_MODE_RESIZE_SECONDARY_DIMENSION | M_KEY_CTRL )
+#define M_MODE_RESIZE_SECONDARY_DIMENSION_ALT         (M_MODE_RESIZE_SECONDARY_DIMENSION | M_KEY_ALT  )
+
+#define M_ACTION_KEYS                                 2746L
+  
+#define M_ACTION_KEY_CANCEL                           2747L
+#define M_ACTION_KEY_DELETE                           2748L
+#define M_ACTION_KEY_RESIZE_HEIGHT_DOWN               2749L
+#define M_ACTION_KEY_RESIZE_HEIGHT_UP                 2750L
+#define M_ACTION_KEY_RESIZE_WIDTH_DOWN                2751L
+#define M_ACTION_KEY_RESIZE_WIDTH_UP                  2752L
+#define M_ACTION_KEY_ROTATE_CLOCKWISE                 2753L
+#define M_ACTION_KEY_ROTATE_COUNTER_CLOCKWISE         2754L
+#define M_ACTION_KEY_TRANSLATE_DOWN                   2755L
+#define M_ACTION_KEY_TRANSLATE_LEFT                   2756L
+#define M_ACTION_KEY_TRANSLATE_RIGHT                  2757L
+#define M_ACTION_KEY_TRANSLATE_UP                     2758L
+
+#define M_ACTION_MODIFIER_SPEED                       2759L
+
+#define M_ACTION_RESIZE_INCREMENT                     2760L
+#define M_ACTION_RESIZE_INCREMENT_ALTERNATE           2761L
+#define M_ACTION_ROTATE_INCREMENT                     2762L
+#define M_ACTION_ROTATE_INCREMENT_ALTERNATE           2763L
+#define M_ACTION_TRANSLATE_INCREMENT                  2764L
+#define M_ACTION_TRANSLATE_INCREMENT_ALTERNATE        2765L
+#define M_ACTION_TRANSLATE_AXES                       2766L
+
+#define M_RESIZE_WIDTH                                2768L
+#define M_RESIZE_HEIGHT                               2769L
+#define M_MULTIPLE_SELECTION_KEY                      2770L
+#define M_EASY_SELECTION                              2771L
+
+#define M_RESHAPE_FROM_POINTS                         M_LOW
+#define M_RESHAPE_FOLLOWING_DISTORTION                M_HIGH
+#define M_PRESERVE_SHAPE_AVERAGE                      1783L
+
+/* Should be in double range, but are already defined elsewhere. */
+#define M_CENTER_X                                       4L
+#define M_CENTER_Y                                       5L
+#define M_POSITION_X                            0x00003400L          
+#define M_POSITION_Y                            0x00004400L   
+#define M_ANGLE                                 0x00000800L
+#define M_ANGLE_START                           0x00000801L
+#define M_ANGLE_END                             0x00000802L
+
+#define M_FONT_SIZE                             0x01000060L
+#define M_TEXT_DIRECTION                        0x01000061L
+#define M_FONT_FILENAME                         0x01000063L // unused
+#define M_FONT_AUTO_SELECT                      0x01000064L
+#define M_SCAN_ALL_FONTS                        0x01000065L
+#define M_FONT_DPI                              0x01000066L
+
+#define M_USE_OS_DPI                            0x01000001L
+
+/* ControlType, InquireType only applicable to list objects */
+
+/* ControlType, InquireType only applicable to attribute context or list */
+#define M_LIST_TYPE                                   201L
+             
+/* ControlType only */
+#define M_DELETE                                      3L   // 3   Also defined in Milblob.h
+
+/* Inquire Types only */
+#define M_GRAPHIC_TYPE                               1518L
+#define M_NUMBER_OF_GRAPHICS                         1519L
+#define M_LAST_LABEL                                 1520L
+#define M_INDEX                                       217L
+#define M_INDEX_VALUE                                 M_INDEX
+#define M_LABEL_VALUE                                   1L
+
+/* Graphic manipulation controls */
+#define M_TRANSLATE_X                         1521L
+#define M_TRANSLATE_Y                         1522L
+#define M_APPLY_SCALE                         1523L
+#define M_ROTATE                                 2L
+#define M_POSITION_TYPE                       1524L
+#define M_SAME_LOCATION                 0x00002000L
+#define M_NUMBER_OF_SUB_ELEMENTS              1525L
+#define M_ADD_POINT                           1745L
+
+/* Control values for M_BACKGROUND_MODE */
+#define M_OPAQUE                                      0x01000058L
+#define M_TRANSPARENT                                 0x01000059L
+
+/* Control values for M_COLOR */
+#define M_RGB_COLOR                                   0x40000000
+#if M_MIL_USE_ARM
+#define M_RGB888(r,g,b) (M_RGB_COLOR | (((MIL_INT32)(char)(r))&0x000000FF) | ((((MIL_INT32)(char)(g))<<8)&0x0000FF00) | ((((MIL_INT32)(char)(b))<<16)&0x00FF0000))
+#else
+#define M_RGB888(r,g,b)                               (M_RGB_COLOR|((MIL_INT32)(((unsigned char)(r)|((MIL_INT32)((unsigned char)(g))<<8))|(((MIL_INT32)(unsigned char)(b))<<16))))
+#endif
+#define M_RGB888_r(color)                             ((MIL_INT32)(color)&0x000000FF)
+#define M_RGB888_g(color)                             (((MIL_INT32)(color)&0x0000FF00)>>8)
+#define M_RGB888_b(color)                             (((MIL_INT32)(color)&0x00FF0000)>>16)
+#define M_IS_RGB888(color)                            (((MIL_INT32)(color)&0xFF000000) == M_RGB_COLOR)
+#if M_MIL_USE_ARM
+#define M_BGR888(b,g,r) (M_RGB_COLOR | (((MIL_INT32)(char)(b))&0x000000FF) | ((((MIL_INT32)(char)(g))<<8)&0x0000FF00) | ((((MIL_INT32)(char)(r))<<16)&0x00FF0000))
+#else
+#define M_BGR888(b,g,r)                               (M_RGB_COLOR|((MIL_INT32)(((unsigned char)(b)|((MIL_INT32)((unsigned char)(g))<<8))|(((MIL_INT32)(unsigned char)(r))<<16))))
+#endif
+#define M_BGR888_b(color)                             ((MIL_INT32)color&0x000000FF)
+#define M_BGR888_g(color)                             (((MIL_INT32)color&0x0000FF00)>>8)
+#define M_BGR888_r(color)                             (((MIL_INT32)color&0x00FF0000)>>16)
+#define M_BGR888_B(color)                              M_BGR888_b(color)
+#define M_BGR888_G(color)                              M_BGR888_g(color)
+#define M_BGR888_R(color)                              M_BGR888_r(color)
+#define M_RGB888_R(color)                              M_RGB888_r(color)
+#define M_RGB888_G(color)                              M_RGB888_g(color)
+#define M_RGB888_B(color)                              M_RGB888_b(color)
+
+/* Control values for M_INPUT_UNITS */
+#define M_DISPLAY                               0x00200000L
+#define M_PIXEL                                     0x1000L
+#define M_WORLD                                     0x2000L
+#define M_SAME_AS_INPUT_UNITS                         1776L
+
+/* Control values for M_TEXT_ALIGN_HORIZONTAL and display positions values */
+#define M_LEFT                                  0x00000100L
+#define M_RIGHT                                 0x00000200L
+
+/* Control values for M_TEXT_ALIGN_VERTICAL and display positions values  */
+#define M_TOP                                   0x00000400L
+#define M_BOTTOM                                0x00000800L
+
+/* Control values for M_SYMBOL_TYPE */
+#define M_CROSS                                 0x00002000L
+#define M_DIRECT_ARROW                              1643L
+#define M_ARROW_HEAD                                1644L
+#define M_PERPENDICULAR_LINE                        1646L
+#define M_FRAME_ORIGIN                              1648L
+#define M_FRAME_REFERENCE_AXIS                      1725L
+#define M_FRAME_AXIS                                1726L
+#define M_CIRCLE                                0x00000008L
+#define M_ANGLE_AT_POSITION                         1787L
+#define M_SQUARE                                0x00000020L
+
+/* Control values for M_LINE_ENDS_STYLE */
+#define M_LINE_ENDS_MASK                        0x0000F000L
+#define M_LINE_ENDS_PLAIN                       0x00001000L
+#define M_LINE_ENDS_H_BOTH_ENDS                 0x00002000L
+#define M_LINE_ENDS_ARROW_A_ON_END              0x00003000L
+#define M_LINE_NEGATIVE_BOX                     0x00004000L
+#define M_LINE_ENDS_CLOSING_ARROWS              0x00005000L
+#define M_LINE_ENDS_OPENING_ARROWS              0x00006000L
+#define M_LINE_ENDS_CIRCLES                     0x00007000L
+
+/* Graphic primitive type */
+#define M_GRAPHIC_TYPE_ARC                          1505L
+#define M_GRAPHIC_TYPE_DOT                          1506L
+#define M_GRAPHIC_TYPE_DOTS                         1507L
+#define M_GRAPHIC_TYPE_LINE                         1508L
+#define M_GRAPHIC_TYPE_LINES                        1509L
+#define M_GRAPHIC_TYPE_POLYGON                      1510L
+#define M_GRAPHIC_TYPE_POLYLINE                     1511L
+#define M_GRAPHIC_TYPE_RECT                         1512L
+#define M_GRAPHIC_TYPE_TEXT                         1513L
+#define M_GRAPHIC_TYPE_RING_SECTOR                  1514L
+#define M_GRAPHIC_TYPE_SYMBOLS                      1633L
+#define M_GRAPHIC_TYPE_INFINITE_LINES               1655L
+#define M_GRAPHIC_TYPE_COLLECTION                   1661L
+
+
+#define M_LEFT_TO_RIGHT                               20L
+#define M_RIGHT_TO_LEFT                               21L
+  
+#define M_PIXEL_TO_WORLD                          1L
+#define M_WORLD_TO_PIXEL                          2L
+
+#define M_Y_AXIS_COUNTER_CLOCKWISE                 0x010L
+
+/* Control values for M_INTERACTIVE_GRAPHIC_STATE, M_INTERACTIVE_GRAPHIC_PREVIOUS_STATE */
+#define M_STATE_IDLE                                1748L
+#define M_STATE_GRAPHIC_HOVERED                     1749L
+#define M_STATE_HANDLE_HOVERED                      1750L
+#define M_STATE_GRAPHIC_DRAGGED                     1751L
+#define M_STATE_HANDLE_DRAGGED                      1752L
+#define M_STATE_WAITING_FOR_CREATION                1753L
+#define M_STATE_BEING_CREATED                       1754L
+
+/* Control values for M_FIXTURE and M_CALIBRATION */
+#define M_USE_SOURCE_FIRST                          1768L
+#define M_USE_DESTINATION_FIRST                     1769L
+
+/* Control values for M_TEXT_BORDER */
+#define M_NONE                                  0x08000000L
+#define M_LEFT                                  0x00000100L
+#define M_RIGHT                                 0x00000200L
+#define M_TOP                                   0x00000400L
+#define M_BOTTOM                                0x00000800L
+
+/* Control values for M_DRAW_DIRECTION */
+#define M_PRIMARY_DIRECTION                     0x00001000L
+#define M_SECONDARY_DIRECTION                   0x00002000L
+#define M_NONE                                  0x08000000L /* also in milstr.h, milcolor.h */
+
+/* Control values for M_MODE_RESIZE* */
+#define M_DISABLE                                  -9999L
+#define M_FIXED_CENTER                              2689L
+#define M_FIXED_CORNER                              2690L
+#define M_FIXED_ASPECT_RATIO                    0x00010000L
+#define M_SQUARE_ASPECT_RATIO                   0x00000008L
+#define M_NO_CONSTRAINT                         0x00020000L
+
+/* Control values for M_MODE_ROTATE* */
+#define M_ANGLE_SNAPPING                            2688L
+#define M_DISABLE                                  -9999L
+#define M_NO_CONSTRAINT                         0x00020000L
+
+/* Control values for M_MODE_TRANSLATE* */
+#define M_AXIS_ALIGNED                          0x00040000
+#define M_DISABLE                                  -9999L
+#define M_NO_CONSTRAINT                         0x00020000L
+
+/* Control values for M_MODE_RESIZE_SECONDARY_DIMENSION* */
+#define M_DISABLE                                  -9999L
+#define M_ONE_SIDED                                 2733L
+#define M_SYMMETRIC                                 2734L
+
+/**************************************************************************/
+/* Used by MgraDraw()                                                     */
+/**************************************************************************/
+#define M_DRAW_IN_CACHE                         600L
+#define M_NO_ERROR_ON_MISSING_CALIBRATION       0x00000020L
+#define M_DRAW_ERROR_ON_MISSING_CALIBRATION     0x00000040L
+#define M_NO_INTERACTIVE_ANNOTATION             0x00001000L
+
+/************************************************************************/
+/* Used by MgraHookFunction                                             */
+/************************************************************************/
+
+#define M_GRAPHIC_SELECTION_MODIFIED            1526L
+#define M_GRAPHIC_MODIFIED                      1527L
+#define M_INTERACTIVE_GRAPHIC_STATE_MODIFIED    1528L
+#define M_GRAPHIC_LIST_MODIFIED                 1529L
+#define M_GRAPHIC_LIST_MODIFIED_INTERNAL        1530L
+
+#define M_UNHOOK                                0x04000000L
+
+/**************************************************************************/
+/* Used by MgraGetBoundingBox()                                           */
+/**************************************************************************/
+#define M_NO_ERROR_ON_MISSING_CALIBRATION       0x00000020L
+#define M_NO_ERROR_ON_EMPTY_LIST                0x00000080L
+#define M_INTEGER_BOUNDING_BOX                  0x00000100L
+
+/**************************************************************************/
+/* Used by MgraProcess()                                                  */
+/**************************************************************************/
+#define M_CONVERT_TO_PIXEL                      1500L
+#define M_CONVERT_TO_WORLD                      1501L
+
+/**************************************************************************/
+/* Used by MgraMessage()                                                  */
+/**************************************************************************/
+#define M_MESSAGE_PROCESSED                     1657L
+#define M_MESSAGE_NOT_PROCESSED                 1658L
+
+/**************************************************************************/
+/* Used by MgraInteractive()                                              */
+/**************************************************************************/
+#define M_GRAPHIC_TYPE_ARC                          1505L
+#define M_GRAPHIC_TYPE_DOT                          1506L
+#define M_GRAPHIC_TYPE_LINE                         1508L
+#define M_GRAPHIC_TYPE_POLYGON                      1510L
+#define M_GRAPHIC_TYPE_POLYLINE                     1511L
+#define M_GRAPHIC_TYPE_RECT                         1512L
+#define M_GRAPHIC_TYPE_RING_SECTOR                  1514L
+#define M_GRAPHIC_TYPE_SYMBOLS                      1633L
+#define M_CANCEL                                    1767L
+#define M_STOP                                0x00000004L
+
+// InitFlag parameter.
+#define M_SQUARE_ASPECT_RATIO                 0x00000008L
+#if OldDefinesSupport
+   #define M_FORCE_ASPECT_RATIO_1                   M_SQUARE_ASPECT_RATIO
+   MIL_DEPRECATED(M_FORCE_ASPECT_RATIO_1, 1060)
+#endif
+#define M_FILLED                              0x00000080L
+#define M_SECTOR                              0x00000300L
+#define M_ROTATE_AROUND_CORNER                0x00000400L
+
+// CreationMode parameter
+#define M_LEGACY_RECT               2725L
+#define M_LEGACY_ELLIPSE            2726L
+#define M_AXIS_ALIGNED_ELLIPSE      2727L
+#define M_ARC_THREE_POINTS          2728L
+#define M_CIRCLE                    0x00000008L
+#define M_AXIS_ALIGNED_RECT         2730L
+#define M_ORIENTED_RECT             2735L
+
+// Defines documented for MdispHookFunction
+#define M_MOUSE_LEFT_BUTTON_DOWN    56L      // also used in mildisplay.h
+#define M_MOUSE_RIGHT_BUTTON_DOWN   57L      // also used in mildisplay.h
+#define M_MOUSE_LEFT_BUTTON_UP      58L      // also used in mildisplay.h
+#define M_MOUSE_RIGHT_BUTTON_UP     59L      // also used in mildisplay.h
+#define M_MOUSE_MOVE                64L      // also used in mildisplay.h
+
+/**************************************************************************/
+/* Used by MgraGetNeighbors()                                             */
+/**************************************************************************/
+
+// LabelOrIndex parameter
+#define M_GRAPHIC_INDEX_TAG                     0x01000000L
+#define M_GRAPHIC_INDEX(a)                      (M_GRAPHIC_INDEX_TAG + (a))
+#define M_GRAPHIC_LABEL_TAG                     0x02000000L
+#define M_GRAPHIC_LABEL(a)                      (M_GRAPHIC_LABEL_TAG + (a))
+#define M_ALL_SELECTED                          0x04000000L
+#define M_ALL                                   0x40000000L
+
+// Units parameter
+#define M_DISPLAY                               0x00200000L
+#define M_PIXEL                                     0x1000L
+#define M_WORLD                                     0x2000L
+
+// Operation parameter
+#define M_POINT_AND_DISTANCE                          1743L
+#define M_RECTANGLE_SELECTION                         1744L
+
+// Combination constants for returned graphic objects identifiers
+#define M_RETURN_INDEX                          0x00004000L
+#define M_RETURN_LABEL                          0x00008000L
+
+// Combination constants for sorting
+#define M_SORT_BY_ASCENDING_DISTANCE            0x00020000L
+#define M_SORT_BY_ASCENDING_INDEX               0x00040000L
+#define M_SORT_BY_DESCENDING_INDEX              0x00060000L
+
+// Combination constants for returned coordinates
+#define M_RETURN_DISTANCE                       0x00100000L
+#define M_RETURN_X                              0x00200000L
+
+/**************************************************************************/
+/* Used by MgraGetGetHookInfo()                                           */
+/**************************************************************************/
+#define M_INTERACTIVE_GRAPHIC_STATE                   1746L
+#define M_GRAPHIC_LIST_ID                             1755L
+#define M_INTERACTIVE_GRAPHIC_PREVIOUS_STATE          1756L
+#define M_GRAPHIC_LABEL_VALUE                         1758L
+#define M_GRAPHIC_LABEL_VALUE_DESELECTED              1759L
+#define M_GRAPHIC_SUB_INDEX                           1760L
+#define M_GRAPHIC_CONTROL_TYPE                        1761L
+
+// Possible return values for M_GRAPHIC_CONTROL_TYPE (other than what is given to MgraControlList)
+#define M_GRAPHIC_LOAD                                1762L
+#define M_GRAPHIC_CREATE                              1763L
+#define M_GRAPHIC_INTERACTIVE                         1764L
+
+/**************************************************************************/
+/* Used by MgraCopy()                                                     */
+/**************************************************************************/
+
+// Operation
+#define M_MOVE                                  0x00010000L     // also in milblob.h
+#define M_COPY                                  0x00020000L     // already defined many times
+
+// Operation's combination flag
+#define M_INDEX_VALUE                               M_INDEX     //217L
+#define M_LABEL_VALUE                                    1L
+
+// InsertLocation
+#define M_GRAPHIC_INDEX_TAG                     0x01000000L
+#define M_GRAPHIC_INDEX(a)                      (M_GRAPHIC_INDEX_TAG + (a))
+#define M_GRAPHIC_LABEL_TAG                     0x02000000L
+#define M_GRAPHIC_LABEL(a)                      (M_GRAPHIC_LABEL_TAG + (a))
+#define M_END_OF_LIST                           0x04000000L
+
+// NumberOfGraObjects
+#define M_ALL                                   0x40000000L
+
+/************************************************************************/
+/* MgraVectors()/MgraVectorsGrid()                                      */
+/************************************************************************/
+#define M_SKIP_NULL_VECTORS                           0x00000001L
+#define M_DRAW_NULL_VECTORS                           0x00000002L
+#define M_FIXED_LENGTH_ARROWHEADS                     0x00000004L
+#define M_PROPORTIONAL_ARROWHEADS                     0x00000008L
+#define M_ABSOLUTE                                             1L // already defined elsewhere
+#define M_AUTO                                               444L // already defined elsewhere
+
+/********************************************************************/
+/* Predefined colors                                                */
+/********************************************************************/
+#define M_COLOR_BLACK                                 M_RGB888(0,0,0)
+#define M_COLOR_RED                                   M_RGB888(255,0,0)
+#define M_COLOR_GREEN                                 M_RGB888(0,255,0)
+#define M_COLOR_BLUE                                  M_RGB888(0,0,255)
+#define M_COLOR_YELLOW                                M_RGB888(255,255,0)
+#define M_COLOR_MAGENTA                               M_RGB888(255,0,255)
+#define M_COLOR_CYAN                                  M_RGB888(0,255,255)
+#define M_COLOR_WHITE                                 M_RGB888(255,255,255)
+#define M_COLOR_GRAY                                  M_RGB888(128,128,128)
+#define M_COLOR_BRIGHT_GRAY                           M_RGB888(192,192,192)
+#define M_COLOR_LIGHT_GRAY                            M_RGB888(160,160,164)
+#define M_COLOR_LIGHT_GREEN                           M_RGB888(192,220,192)
+#define M_COLOR_LIGHT_BLUE                            M_RGB888(166,202,240)
+#define M_COLOR_LIGHT_WHITE                           M_RGB888(255,251,240)
+#define M_COLOR_DARK_RED                              M_RGB888(128,0,0)
+#define M_COLOR_DARK_GREEN                            M_RGB888(0,128,0)
+#define M_COLOR_DARK_BLUE                             M_RGB888(0,0,128)
+#define M_COLOR_DARK_YELLOW                           M_RGB888(128,128,0)
+#define M_COLOR_DARK_MAGENTA                          M_RGB888(128,0,128)
+#define M_COLOR_DARK_CYAN                             M_RGB888(0,128,128)
+
+/* McalTransformCoordinates() related flags */
+#define M_INVALID_POINT                  1.7976931348623158e+308
+#define M_NO_POINTS_BEHIND_CAMERA        0x00040000L
+
+/* McalSet|GetCoordinateSystem(), McalInquire() related flags */
+#define M_RELATIVE_ORIGIN_X                     112L  /* (also defined in milcal.h) */
+#define M_RELATIVE_ORIGIN_Y                     113L  /* (also defined in milcal.h) */
+#define M_RELATIVE_ORIGIN_Z                     114L  /* (also defined in milcal.h) */
+#define M_RELATIVE_ORIGIN_ANGLE                 115L  /* (also defined in milcal.h) */
+#define M_CALIBRATION_STATUS                    159L  /* (also defined in milcal.h) */
+
+#define M_HOMOGENEOUS_MATRIX                      0L  /* (also defined in mil.h) */
+
+#define M_ABSOLUTE_COORDINATE_SYSTEM     0x01000000L  /* (also defined in milcal.h) */
+#define M_RELATIVE_COORDINATE_SYSTEM              0L  /* (also defined in milcal.h) */
+
+
+#define M_TRANSFORM_TYPES_SHIFT                   8L  // =utilities=   (also defined in milcal.h)
+#define M_ASSIGN                                (1 << M_TRANSFORM_TYPES_SHIFT)      /* (also defined in milcal.h) */
+#define M_COMPOSE_WITH_CURRENT                  (2 << M_TRANSFORM_TYPES_SHIFT)      /* (also defined in milcal.h) */
+
+#define M_2D_CALIBRATION                          1L  /* also defined in milcal.h */
+#define M_3D_CALIBRATION                          2L  /* also defined in milcal.h */
+
+#define M_CALIBRATION_CATEGORY                  214L  /* also defined in milcal.h */
+
+/* M_CALIBRATION_STATUS control values */
+#define M_CALIBRATED                      0x0000300L /* also defined in milcal.h, milmod.h */
+
+/* McalFixture() related flags */
+#define M_MOVE_RELATIVE                  0x00010000L /* also defined in milcal.h */
+#define M_SAME_AS_SOURCE                 0x00000070L /* also defined in milcal.h */
+
+/* McalTransformResult() related flags */
+#define M_LENGTH_X                              0x3L /* also defined in milcal.h */
+#define M_LENGTH_Y                              0x4L /* also defined in milcal.h */
+
+/************************************************************************/
+/* MappGetError()                                                       */
+/************************************************************************/
+#define M_NULL_ERROR                                  0L
+#define M_NO_ERROR                                    0L
+
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_CURRENT                                     0x00000002L
+#define M_CURRENT_FCT                                 0x00030000L
+#define M_CURRENT_FCT_FULL                            0x00040000L
+#define M_CURRENT_SUB_NB                              0x00000004L
+#define M_CURRENT_SUB                                 0x00050000L
+#define M_CURRENT_SUB_1                               0x00050000L
+#define M_CURRENT_SUB_2                               0x00060000L
+#define M_CURRENT_SUB_3                               0x00070000L
+#define M_GLOBAL                                      0x00000008L // Also defined in milmeas.h
+#define M_GLOBAL_FCT                                  0x00090000L
+#define M_GLOBAL_SUB_NB                               0x000A0000L
+#define M_GLOBAL_SUB                                  0x000B0000L
+#define M_GLOBAL_SUB_1                                0x000B0000L
+#define M_GLOBAL_SUB_2                                0x000C0000L
+#define M_GLOBAL_SUB_3                                0x000D0000L
+#define M_ERROR_REMOTE                                0x00000010L
+
+
+#define M_INTERNAL                                    0x000E0000L
+#define M_INTERNAL_FCT                                0x000F0000L
+#define M_INTERNAL_SUB_NB                             0x00100000L
+#define M_INTERNAL_SUB                                0x00110000L
+#define M_INTERNAL_SUB_1                              0x00110000L
+#define M_INTERNAL_SUB_2                              0x00120000L
+#define M_INTERNAL_SUB_3                              0x00130000L
+#define M_PARAM_NB                                    0x00140000L
+#define M_FATAL                                       0x00150000L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_CLIENT_ERROR_ASCII_MODE                     0x00000100L
+#endif
+#define M_ERROR_UNUSED_BITS                           0x0AE0FEF0L
+#define M_UNHOOK                                      0x04000000L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL))
+#define M_MESSAGE                                     (0x20000000L|M_CLIENT_ERROR_ASCII_MODE)
+#else
+#define M_MESSAGE                                     0x20000000L
+#endif
+#else
+#define M_MESSAGE                                    (0x20000000L | M_CLIENT_ENCODING)
+#endif
+#define M_ERROR                                       0x40000000L
+#define M_USER                                        0x00000001L
+#define M_NO_REPORT                                   0x00000008L
+
+                                                                  /* Bit field exclusive to M_TRACE  to M_PROCESSING      (3L to 6L) */
+#define M_THREAD_CURRENT                              0x01000000L /*                        M_TRACE_START                       (1L) */
+                                                                  /*                        M_TRACE_END                         (2L) */
+                                                                  /*                        M_ERROR                     (0x40000000) */
+                                                                  /*                        M_MESSAGE                   (0x20000000) */
+                                                                  /*                        M_CURRENT to M_REGION_SIZE_Y (1L to 44L) */
+                                                                  /*                        M_UNHOOK                    (0x04000000) */
+#define M_ERROR_CURRENT                               (M_ERROR|M_CURRENT)
+#define M_ERROR_GLOBAL                                (M_ERROR|M_GLOBAL)
+#define M_ERROR_FATAL                                 (M_ERROR|M_FATAL)
+#define M_ERROR_REMOTE_CURRENT                        (M_ERROR_CURRENT | M_ERROR_REMOTE)
+
+
+/************************************************************************/
+/* MbufLink() Values (Option)                                           */
+/************************************************************************/
+#define M_LINK                                        0x00000001L
+#define M_UNLINK                                      0x00000002L
+#define M_MODIFIED_REGION                                     25L
+#define M_DO_INITIAL_COPY                                     36L
+
+/************************************************************************/
+/* MbufGetHookInfo()  //MbufHookFunction()                              */
+/************************************************************************/
+#define M_BUFFER_ID                                   0x00160000L
+#define M_REGION_OFFSET_X                             0x00410000L
+#define M_REGION_OFFSET_Y                             0x00420000L
+#define M_REGION_SIZE_X                               0x00430000L
+#define M_REGION_SIZE_Y                               0x00480000L
+#define M_OBJECT_ID                                   0x001B0000L
+#define M_FIELD                                       0x001C0000L
+#define M_BAND                                        0x001D0000L
+#define M_DONE_BY_DIRECTX                             0x001E0000L
+#define M_MOVED                                       0x001F0000L
+#define M_USER_DATA_PTR                               0x00000001
+#define M_RESIZED                                     0x00000002L
+
+// Reserve next value for M_BUFFER_INDEX
+// used by MdigGetHookInfo                                    49L
+#define M_GRAB_TIME_STAMP                             0x00000040L //64L
+#define M_EVENT_TYPE                            M_REGION_OFFSET_X
+#define M_PARAM1                                M_REGION_OFFSET_Y
+#define M_PARAM2                                  M_REGION_SIZE_X
+#define M_PARAM3                                  M_REGION_SIZE_Y
+
+
+#define M_TRACE_START                                 1L       // app hook
+#define M_TRACE_END                                   2L       // app hook
+#define M_DMIL_CLIENT_CONNECTED                       4L       // app hook
+#define M_DMIL_CLIENT_DISCONNECTED                    5L       // app hook
+#define M_DMIL_CONNECTION_LOST                        (6L + M_ASYNC_HOOK)       // app hook
+#define M_SLAVE_ERROR_CURRENT                         7L       // app hook
+#define M_SLAVE_ERROR_GLOBAL                          8L       // app hook
+#define M_PRE_GRAB_BUFFER_CHANGE                              10L
+#define M_POST_GRAB_BUFFER_CHANGE                             11L
+#define M_MODIFIED_BUFFER_INTERNAL                            12L
+#define M_LICENSE_SERVER_EVENT                        (14|M_ASYNC_HOOK)       // app hook
+#define M_STATE_MACHINE_PRE_BUFFER_MODIFIED                   15L
+#define M_STATE_MACHINE_POST_BUFFER_MODIFIED                  16L
+#define M_REMOTE_BUFFER_EVENT                                 18L //TBR
+#define M_MODIFIED_BUFFER_ERROR                               19L
+#define M_DX_SURFACE_RESTORED                                 20L
+#define M_MODIFIED_BUFFER_DIGITIZER                           21L
+#define M_MODIFIED_BUFFER_DIGITIZER_ERROR                     22L
+#define M_MODIFIED_BUFFER_DIGITIZER_CORRUPT                   23L
+#define M_MODIFIED_REGION                                     25L
+#define M_FEATURE_CHANGE                                      26L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_CLIENT_CONNECTED                            27L       // app hook
+#define M_OLD_WEB_CLIENT_DISCONNECTED                         28L       // app hook
+#define M_OLD_WEB_CONNECTION_LOST                             29L       // app hook
+#endif
+#define M_OBJECT_PUBLISH_DMIL                                 30L       // app hook
+#define M_PRE_APP_FREE                                        31L       // app hook
+#define M_GET_END                                             32L
+#define M_GET_COLOR_2D_END                                    33L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_OBJECT_PUBLISH_WEB                              34L
+#endif
+#define M_SLAVE_ERROR_REMOTE_CURRENT                          35L       // app hook
+#define M_DO_INITIAL_COPY                                     36L
+#define M_DYNAMIC_BUFFER_CHANGED                              37L
+#define M_OBJECT_PUBLISH_WEB                                  38L
+// Reserve User M_OBJECT_PUBLISH_WEB + 1                      39L
+// Reserve User M_OBJECT_PUBLISH_WEB + 2                      40L
+// Reserve FB   M_OBJECT_PUBLISH_WEB + 3                      41L
+// Reserve DA   M_OBJECT_PUBLISH_WEB + 4                      42L
+
+#define M_WEB_CLIENT_CONNECTED                                43L       // app hook
+// Reserve User M_WEB_CLIENT_CONNECTED +1                     44L
+// Reserve User M_WEB_CLIENT_CONNECTED +2                     45L
+// Reserve FB   M_WEB_CLIENT_CONNECTED +3                     46L
+// Reserve DA   M_WEB_CLIENT_CONNECTED +4                     48L
+#define M_WEB_CLIENT_DISCONNECTED                             49L       // app hook
+// Reserve User M_WEB_CLIENT_DISCONNECTED +1                  50L       // app hook
+// Reserve User M_WEB_CLIENT_DISCONNECTED +2                  51L       // app hook
+// Reserve FB   M_WEB_CLIENT_DISCONNECTED +3                  52L       // app hook
+// Reserve DA   M_WEB_CLIENT_DISCONNECTED +4                  53L       // app hook
+#define M_MODIFIED_BUFFER_DISPLAYABLE_CHANGE                  54L       // buf hook
+#define M_LAYOUT_MODIFIED                                     55L       // buf hook
+
+#define M_OBJ_HOOK_RANGE_START                        0x000000800L
+#define M_OBJ_HOOK_RANGE_END                          0x0000008FFL
+#define M_OBJ_HOOK_USER_RANGE_START                   0x00000FD00L
+#define M_OBJ_HOOK_USER_RANGE_END                     0x00000FDFFL
+#define M_OBJ_HOOK_MODULE_RANGE_START                 0x00000FE00L
+#define M_OBJ_HOOK_MODULE_RANGE_END                   0x00000FFFFL
+#define M_MODIFIED_BUFFER                             0x40000000L
+#define M_UNHOOK                                      0x04000000L
+#define M_ASYNC_HOOK                                  0x08000000L
+#define M_GRAB_LINE                                   0x00100000L
+#define M_GRAB_LINE_END                               0x00200000L
+#define M_CHILD_BUFFER_MOVED                          0x00400000L
+#define M_DISP_BUF_HOOK                               0x00800000L // Hook redirected to the displays (use the M_DISP_BUF_HOOK flag)
+#define M_PRE_FLIP_COMPLEX_BUFFER                    (M_DISP_BUF_HOOK + 01L)
+#define M_POST_FLIP_COMPLEX_BUFFER                   (M_DISP_BUF_HOOK + 02L)
+#define M_ON_COMPONENT                                0x02000000L
+
+// info type for MobjGetHookInfo
+#define M_MESSAGE_STATUS                              100
+#define M_MESSAGE_PTR                                 101
+#define M_MESSAGE_SIZE_IN                             102
+#define M_MESSAGE_SIZE_OUT                            103
+#define M_MESSAGE_TAG                                 104
+
+/************************************************************************/
+/* MappAlloc                                                            */
+/* Bits used here are shared with MsysAlloc thru MappAllocDefault       */
+/************************************************************************/
+#define M_APP_ALLOC_INIT_FLAGS                        0x0FF00000L     
+#define M_SYS_ALLOC_INIT_FLAGS                        0x20000FFFL     
+
+// Linux support only 1 or 0
+#define M_X11_ACCELERATION(X)                         (M_DX_VERSION(X))
+
+// Useful
+#define M_DX_VERSION(X)                               ((X == M_DEFAULT)?(M_DIRECTX_VERSION_FLAG + (1 << M_DIRECTX_VERSION_OFFSET)):\
+                                                      (M_DIRECTX_VERSION_FLAG + (X<<M_DIRECTX_VERSION_OFFSET)))
+#define M_DX_VERSION_NUMBER(X)                        ((M_INTERNAL_GET_DX_VERSION_NUMBER(X) == 1)? M_DEFAULT: M_INTERNAL_GET_DX_VERSION_NUMBER(X))
+
+#define M_X11_ACC(X)                                 ((M_INTERNAL_GET_DX_VERSION_NUMBER(X) == M_X11_ACC_NONE)? M_X11_ACC_NONE: M_X11_ACC_DEFAULT)
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_IS_DIRECTX_VERSION_VALID(X)                 ((X == M_DIRECTX_DDRAW7) || (X == M_DIRECTX_D3D9) || (X == M_DIRECTX_D3D10) || (X == M_DIRECTX_D3D11) || (X == M_DIRECTX_NONE))
+#else
+#define M_IS_DIRECTX_VERSION_VALID(X)                 ((X == M_DIRECTX_D3D9) || (X == M_DIRECTX_D3D10) || (X == M_DIRECTX_D3D11) || (X == M_DIRECTX_NONE))
+#endif
+
+#define M_IS_XORG_ACC_VALID(X)                        ((X == M_X11_ACC_DEFAULT) || (X == M_X11_ACC_NONE)) 
+
+
+// Internal
+// Note that M_DEFAULT is also possible but not considered valid. mildisplay.dll should replace M_DEFAULT depending on context.
+#define M_DIRECTX_VERSION_MASK                        0X000F0000L
+#define M_DIRECTX_VERSION_OFFSET                      16L
+#define M_INTERNAL_GET_DX_VERSION_NUMBER(X)           (MIL_INT)((X&M_DIRECTX_VERSION_FLAG)?(((X)&M_DIRECTX_VERSION_MASK)>>M_DIRECTX_VERSION_OFFSET):M_INVALID)
+
+#define M_NEW_DISPLAYS                                0L
+
+#define M_TRACE_LOG_DISABLE                           0x00400000L
+#define M_DIRECTX_VERSION_FLAG                        0x00800000L
+#define M_UNICODE_CLIENT                              0x01000000L
+#define M_ASCII_CLIENT                                0x04000000L
+#define M_QUIET                                       0x08000000L
+#define M_DEFAULT                                     0x10000000L
+
+#define M_SET_CLUSTER_NODE_MASK                       MAKE_INT64(0X0000007F00000000)
+#define M_SET_CLUSTER_NODE_OFFSET                     32L
+#define M_INTERNAL_GET_SET_CLUSTER_NODE(X)           (((X)&M_SET_CLUSTER_NODE_MASK)>>M_SET_CLUSTER_NODE_OFFSET)
+#define M_CLUSTER_NODE(X)                             ((((MIL_INT64)X)<<M_SET_CLUSTER_NODE_OFFSET)&M_SET_CLUSTER_NODE_MASK)
+
+#define M_ERROR_FUNCTION_NAME_SIZE                    32L
+#define M_ERROR_MESSAGE_SIZE                          320L
+
+#define M_NBFCTNAMEMAX                                445 /* max number of function codes     */
+#define M_NBERRMSGMAX_ORIG                            200 /* max number of error messages     */
+#define M_NBSUBERRMSGMAX                              10  /* max number of sub error messages */
+
+#define M_ASYNC_ERROR                                 0x40000000
+
+#define M_CORE_ORIG_ERROR_START                           0
+#define M_CORE_ORIG_ERROR_END                           199
+
+#define M_SYSTEMS_ERROR_START                           200
+#define M_SYSTEMS_ERROR_END                           19999  
+#define M_HIGHLVL_ERR_OFFSET                          20000L
+#define M_HIGHLVL_ERR_OFFSET_MAX                      M_HIGHLVL_ERR_OFFSET + 28999L //48999
+#define M_FUNC_ERROR                                  49000      //User error numbers
+#define M_SCRIPT_ERROR_START                          49500
+#define M_SCRIPT_ERROR_END                            49600
+#define M_DISPLAY_DLL_ERROR_START                     50000
+#define M_DISPLAY_DLL_ERROR_END                       51999
+#define M_CODEC_ENGINE_ERROR_START                    52000
+#define M_CODEC_ENGINE_ERROR_END                      52999
+#define M_URL_ERROR_START                             53000
+#define M_URL_ERROR_END                               53999
+#define M_HTTP_ERROR_START                            54000
+#define M_HTTP_ERROR_END                              54999
+#define M_WEB_ERROR_START                             55000
+#define M_WEB_ERROR_END                               55999
+#define M_CORE_ERROR_START                            56000
+#define M_CORE_ERROR_END                              56999
+#define M_MISC_ERROR_START                            57000
+#define M_MISC_ERROR_END                              57050
+
+#define M_IS_CORE_ERROR(ERR)                          (((ERR >= M_CORE_ORIG_ERROR_START) && (ERR <= M_CORE_ORIG_ERROR_END)) || ((ERR >= M_CORE_ERROR_START) && (ERR <= M_CORE_ERROR_END)))
+
+#define M_DIRECTX_NONE                                    M_NULL
+#define M_DIRECTX_UNDETERMINED                            -1L
+#define M_DIRECTX_DDRAW7                                  7L
+#define M_DIRECTX_D3D9                                    9L
+#define M_DIRECTX_D3D10                                   10L
+#define M_DIRECTX_D3D11                                   11L
+
+#define M_X11_ACC_NONE                                    M_NULL
+#define M_X11_ACC_DEFAULT                                 1L
+
+/************************************************************************/
+/* MappTrace()                                                          */
+/************************************************************************/
+#define M_TRACE_MARKER                                0x0000000000000000
+#define M_TRACE_SECTION_START                         0x1000000000000000
+#define M_TRACE_SECTION_END                           0x2000000000000000
+#define M_TRACE_SET_TAG_INFORMATION                   0x8000000000000000
+#define M_TRACE_LOG_DISABLE                           0x00400000L
+
+/************************************************************************/
+/* MappHookFunction()                                                   */
+/************************************************************************/
+
+//License server event types
+#define M_LICENSE_SERVER_CONTACT_LOST                 1
+#define M_LICENSE_SERVER_KEY_DISCONNECTED             2
+#define M_LICENSE_LOCAL_CLIENT_CONTACT_LOST           3
+#define M_LICENSE_SERVER_OK                           4
+#define M_LICENSE_SERVER_SWITCH                       5
+#define M_LICENSE_PERMISSIONS_CHANGED                 6
+#define M_LICENSE_SERVER_RECONNECT                    7
+
+
+/************************************************************************/
+#define M_TRACE_START                                 1L
+#define M_TRACE_END                                   2L
+#define M_DMIL_CLIENT_CONNECTED                       4L
+#define M_DMIL_CLIENT_DISCONNECTED                    5L
+#define M_DMIL_CONNECTION_LOST                        (6L + M_ASYNC_HOOK)
+#define M_SLAVE_ERROR_CURRENT                         7L
+#define M_SLAVE_ERROR_GLOBAL                          8L
+#define M_LICENSE_SERVER_EVENT                        (14|M_ASYNC_HOOK)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_CLIENT_CONNECTED                   27L
+#define M_OLD_WEB_CLIENT_DISCONNECTED                28L
+#define M_OLD_WEB_CONNECTION_LOST                    29L
+#endif
+#define M_OBJECT_PUBLISH_DMIL                        30L
+#define M_APP_LAST_FREE                              31L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_OBJECT_PUBLISH_WEB                     34L
+#endif
+#define M_SLAVE_ERROR_REMOTE_CURRENT                 35L
+#define M_OBJECT_PUBLISH_WEB                         38L
+// Reserve User M_OBJECT_PUBLISH_WEB + 1             39L
+// Reserve User M_OBJECT_PUBLISH_WEB + 2             40L
+// Reserve FB   M_OBJECT_PUBLISH_WEB + 3             41L
+// Reserve DA   M_OBJECT_PUBLISH_WEB + 4             42L
+
+#define M_WEB_CLIENT_CONNECTED                                43L       // app hook
+// Reserve User M_WEB_CLIENT_CONNECTED +1                     44L
+// Reserve User M_WEB_CLIENT_CONNECTED +2                     45L
+// Reserve FB   M_WEB_CLIENT_CONNECTED +3                     46L
+// Reserve DA   M_WEB_CLIENT_CONNECTED +4                     48L
+#define M_WEB_CLIENT_DISCONNECTED                             49L       // app hook
+// Reserve User M_WEB_CLIENT_DISCONNECTED +1                  50L       // app hook
+// Reserve User M_WEB_CLIENT_DISCONNECTED +2                  51L       // app hook
+// Reserve FB   M_WEB_CLIENT_DISCONNECTED +3                  52L       // app hook
+// Reserve DA   M_WEB_CLIENT_DISCONNECTED +4                  53L       // app hook
+
+#define M_ERROR_FATAL                                 (M_ERROR|M_FATAL)
+#define M_UNHOOK                                      0x04000000L
+                                                                  /* Bit field exclusive to M_TRACE  to M_PROCESSING      (3L to 6L) */
+#define M_THREAD_CURRENT                              0x01000000L /*                        M_TRACE_START                       (1L) */
+#if OldDefinesSupport
+#define M_INTERNAL_ALLOC                              0x00200000L /*                        M_TRACE_END                         (2L) */
+MIL_DEPRECATED(M_INTERNAL_ALLOC, 1000)
+#define M_INTERNAL_FREE                               0x00400000L /*                        M_ERROR                     (0x40000000) */
+MIL_DEPRECATED(M_INTERNAL_FREE, 1000)
+#endif
+#define M_OBJECT_FREE                                 0x00010000L /*                        M_MESSAGE                   (0x20000000) */
+#define M_OBJECT_FREE_REMOTE                          0x00010001L /*                        M_CURRENT to M_REGION_SIZE_Y (1L to 44L) */
+                                                                  /*                        M_UNHOOK                    (0x04000000) */
+#define M_VSYNC_SIGNAL                                0x00000100L /* For hook when a vsync occurred on a host                         */
+                                                                  /*  Range use: 0x00000100 to 0x0000010F                            */
+                                                                  /*  The host system to use (device number) must be added to        */
+                                                                  /*  M_VSYNC.  Exemple: to hook on the vsync of the 3rd host        */
+
+                                                                  /*                system, use the hook type M_VSYNC_SIGNAL+M_DEV2  */
+
+#define M_LICENSE_FATAL_ERROR                        (0x00000110|M_ASYNC_HOOK)
+#define M_VSYNC_HOOK_SYSTEM_NUM(hooktype)             (hooktype&0x0000000F)   /* IMPORTANT these macros are base on the value of M_MAX_VIDEO_DEVICE */
+#define M_IS_VSYNC_HOOK(hooktype)                     ((hooktype&(~(M_UNHOOK|0x0000000F)))==M_VSYNC_SIGNAL)
+#define M_MIL_DISPLAY_DLL_LOAD                        0x000000200L
+#define M_MIL_DIRECTX_DLL_LOAD                        0x000000400L
+#define M_IS_DMIL_HOOK(hooktype)                      ((hooktype==M_DMIL_CLIENT_CONNECTED) || (hooktype==M_DMIL_CLIENT_DISCONNECTED) || (hooktype==M_DMIL_CONNECTION_LOST))
+
+//License server event types
+#define M_LICENSE_SERVER_CONTACT_LOST                 1
+#define M_LICENSE_SERVER_KEY_DISCONNECTED             2
+#define M_LICENSE_LOCAL_CLIENT_CONTACT_LOST           3
+#define M_LICENSE_SERVER_OK                           4
+#define M_LICENSE_SERVER_SWITCH                       5
+#define M_LICENSE_PERMISSIONS_CHANGED                 6
+
+/************************************************************************/
+/* MappGetHookInfo()                                                    */
+/************************************************************************/
+#define M_NULL_ERROR                                  0L
+#define M_NO_ERROR                                    0L
+
+#define M_CURRENT                                     0x00000002L
+#define M_CURRENT_FCT                                 0x00030000L
+#define M_CURRENT_SUB_NB                              0x00000004L
+#define M_CURRENT_SUB                                 0x00050000L
+#define M_CURRENT_SUB_1                               0x00050000L
+#define M_CURRENT_SUB_2                               0x00060000L
+#define M_CURRENT_SUB_3                               0x00070000L
+#define M_GLOBAL                                      0x00000008L
+#define M_GLOBAL_FCT                                  0x00090000L
+#define M_GLOBAL_SUB_NB                               0x000A0000L
+#define M_GLOBAL_SUB                                  0x000B0000L
+#define M_GLOBAL_SUB_1                                0x000B0000L
+#define M_GLOBAL_SUB_2                                0x000C0000L
+#define M_GLOBAL_SUB_3                                0x000D0000L
+#define M_PARAM_NB                                    0x00140000L
+#define M_BUFFER_ID                                   0x00160000L
+#define M_REGION_OFFSET_X                             0x00410000L
+#define M_REGION_OFFSET_Y                             0x00420000L
+#define M_REGION_SIZE_X                               0x00430000L
+#define M_REGION_SIZE_Y                               0x00480000L
+#define M_OBJECT_ID                                   0x001B0000L
+#define M_PARAM_VALUE                                 0x08000000L
+#define M_EXTENDED_PARAM_TYPE                         0x10000000L
+#define M_PARAM_ATTRIBUTES                            0x04000000L
+#define M_PARAM_SIZE                                  0x01000000L
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL))
+#define M_MESSAGE                                     (0x20000000L|M_CLIENT_ERROR_ASCII_MODE)
+#else
+#define M_MESSAGE                                     0x20000000L
+#endif
+#else
+#define M_MESSAGE                                    (0x20000000L | M_CLIENT_ENCODING)
+#endif
+
+#define M_PARAM_TYPE_INFO                             (0x02000000L | M_CLIENT_ENCODING)
+
+
+
+/************************************************************************/
+/* MappInquire() / MappControl() Types                                  */
+/* NB: All values in this range must be included between
+                       M_APP_INQUIRE_SYS_START and M_APP_INQUIRE_SYS_END*/
+/************************************************************************/
+#define M_LOCATION                                    1048L
+
+
+#define M_APP_INQUIRE_SIZEOF_INT64_START              6700L
+// Inquire value with a size of 64 bit, must be in that range : 6700-6799
+#define M_EXTENDED_INIT_FLAG                          6705L
+#define M_APP_INQUIRE_SIZEOF_INT64_END                6799L
+
+
+#define M_APP_INQUIRE_SYS_START                       15000L
+/*Reserve values between 15000L and 20000L for AppInquires.
+Needed for remote systems                                 */
+
+#define M_VERSION                                     (M_APP_INQUIRE_SYS_START+1L)
+#define M_TRACE_HOOKS                                 (M_APP_INQUIRE_SYS_START+2L)
+#define M_CLEAR_ERROR                                 (M_APP_INQUIRE_SYS_START+3L)
+#define M_PARAMETER                                   (M_APP_INQUIRE_SYS_START+4L)
+#define M_REBOOT_NEEDED                               (M_APP_INQUIRE_SYS_START+5L)
+#define M_PROCESSING                                  (M_APP_INQUIRE_SYS_START+6L)
+#if OldDefinesSupport
+   #define M_LAST_PLATFORM_USE                        (M_APP_INQUIRE_SYS_START+7L)
+   MIL_DEPRECATED(M_LAST_PLATFORM_USE, 1060)
+#endif
+#define M_LAST_PLATFORM_USED                          (M_APP_INQUIRE_SYS_START+7L)
+#define M_CURRENT_ERROR_HANDLER_PTR                   (M_APP_INQUIRE_SYS_START+8L)
+#define M_CURRENT_ERROR_HANDLER_USER_PTR              (M_APP_INQUIRE_SYS_START+9L)
+#define M_GLOBAL_ERROR_HANDLER_PTR                    (M_APP_INQUIRE_SYS_START+10L)
+#define M_GLOBAL_ERROR_HANDLER_USER_PTR               (M_APP_INQUIRE_SYS_START+11L)
+#define M_FATAL_ERROR_HANDLER_PTR                     (M_APP_INQUIRE_SYS_START+12L)
+#define M_FATAL_ERROR_HANDLER_USER_PTR                (M_APP_INQUIRE_SYS_START+13L)
+#define M_TRACE_START_HANDLER_PTR                     (M_APP_INQUIRE_SYS_START+14L)
+#define M_TRACE_START_HANDLER_USER_PTR                (M_APP_INQUIRE_SYS_START+15L)
+#define M_TRACE_END_HANDLER_PTR                       (M_APP_INQUIRE_SYS_START+16L)
+#define M_TRACE_END_HANDLER_USER_PTR                  (M_APP_INQUIRE_SYS_START+17L)
+#define M_IRQ_CONTROL                                 (M_APP_INQUIRE_SYS_START+18L)
+#define M_ERROR_HANDLER_PTR                           (M_APP_INQUIRE_SYS_START+19L)
+#define M_ERROR_HANDLER_USER_PTR                      (M_APP_INQUIRE_SYS_START+20L)
+#define M_CURRENT_APPLICATION                         (M_APP_INQUIRE_SYS_START+21L)
+#define M_ERROR_HOOKS                                 (M_APP_INQUIRE_SYS_START+22L)
+#define M_MIL_UNIQUE_NUMBER                           (M_APP_INQUIRE_SYS_START+23L)
+#define M_MIL_TRACE_FILENAME                          (M_APP_INQUIRE_SYS_START+24L)
+#define M_FREE_ALL_DEFAULT                            (M_APP_INQUIRE_SYS_START+25L)
+#define M_LICENSE_VALID_MODULES                       (M_APP_INQUIRE_SYS_START+26L)
+#define M_LICENSE_UNLOCKED_MODULES                    M_LICENSE_VALID_MODULES
+#define M_LICENSE_TEMP_UNLOCKED_MODULES               (M_APP_INQUIRE_SYS_START+29L)
+#define M_ERROR_CODE_PTR                              (M_APP_INQUIRE_SYS_START+38L)
+#define M_MILCE_ALLOC_IN_DMA_SIZE                     (M_APP_INQUIRE_SYS_START+40L)
+#define M_MILCE_ALLOC_IN_MMF_SIZE                     (M_APP_INQUIRE_SYS_START+41L)
+#define M_MILCE_ALLOC_IN_MMF_AUTO_COMMIT              (M_APP_INQUIRE_SYS_START+42L)
+#define M_X86_FPU_FLAGS                               (M_APP_INQUIRE_SYS_START+43L)
+#define M_REAL_TRACE_LEVEL                            (M_APP_INQUIRE_SYS_START+44L)
+
+#define M_FORCE_THREAD_DETACH                         (M_APP_INQUIRE_SYS_START+46L)
+#define M_BUFTRANSFER_METHOD                          (M_APP_INQUIRE_SYS_START+47L)
+#define M_DISABLE_BUFTRANSFER_METHOD                  (M_APP_INQUIRE_SYS_START+48L)
+#define M_RESET_DEFAULTS                              (M_APP_INQUIRE_SYS_START+49L)
+#define M_USE_WINDOWED_CLASS                          (M_APP_INQUIRE_SYS_START+50L)
+
+#define M_IN_HIGHLEVEL_MODULE                         (M_APP_INQUIRE_SYS_START+52L)
+#define M_USING_OLD_DISP                              (M_APP_INQUIRE_SYS_START+53L)
+#define M_LICENSE_NON_TEMP_MODULES                    (M_APP_INQUIRE_SYS_START+55L)
+#define M_TEMP_LICENSE_DAYS_LEFT                      (M_APP_INQUIRE_SYS_START+57L)
+#define M_DRIVER_IS_CALLED_INTERNALLY                 (M_APP_INQUIRE_SYS_START+59L)
+#define M_MAX_PLATFORM_USED                           (M_APP_INQUIRE_SYS_START+60L)
+#define M_CREATE_REGCONTROL                           (M_APP_INQUIRE_SYS_START+61L)
+#define M_ERROR_POP                                   (M_APP_INQUIRE_SYS_START+62L)
+#if MIL_COMPILE_VERSION < 1010
+#define M_INSTALLED_SYSTEM_COUNT                      (M_APP_INQUIRE_SYS_START+63L)
+#else
+#define M_INSTALLED_SYSTEM_COUNT_OLD                  (M_APP_INQUIRE_SYS_START+63L)
+#endif
+#define M_GENTL_PRODUCER_COUNT                        (M_APP_INQUIRE_SYS_START+64L)
+#if OldDefinesSupport
+#define M_NUMBER_OF_BOARD_TYPES                       M_INSTALLED_SYSTEM_COUNT
+MIL_DEPRECATED(M_NUMBER_OF_BOARD_TYPES, 1000)
+#endif
+#define M_SAFE_FLOATING_POINT_CONTROL                 (M_APP_INQUIRE_SYS_START+65L)
+#define M_RESET_SYSDETECT                             (M_APP_INQUIRE_SYS_START+66L)
+/* Reserve next 31 values               from          (M_APP_INQUIRE_SYS_START+67L)*/
+/*                                      to            (M_APP_INQUIRE_SYS_START+95)*/
+#define M_SUPERSIGHT_DRIVER_VERSION                   (M_APP_INQUIRE_SYS_START+118L)
+#define M_EXECUTING_ON_SUPERSIGHT_MASTER              (M_APP_INQUIRE_SYS_START+119L)
+#define M_MEMORY                                      (M_APP_INQUIRE_SYS_START+120L) /*5120*/ //Only 2 bits set. Used in bitwise operations
+#if MIL_COMPILE_VERSION >= 1010
+#define M_INSTALLED_SYSTEM_COUNT                      (M_APP_INQUIRE_SYS_START+121L)
+#endif
+#define M_APPLICATION_ALLOCATED                       (M_APP_INQUIRE_SYS_START+122L)
+#define M_DIRECTX_SERVICE_IS_VALID                    (M_APP_INQUIRE_SYS_START+126L)
+#if OldDefinesSupport
+   #define M_MP_ACTIVE_THREAD                         (M_APP_INQUIRE_SYS_START+127L)
+   MIL_DEPRECATED(M_MP_ACTIVE_THREAD, 1060)
+#endif
+#define M_MP_USE                                      (M_APP_INQUIRE_SYS_START+128L)
+#if (MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION)
+#endif
+#if OldDefinesSupport
+   #define M_MP_MAX_CORES_PER_THREAD                  (M_APP_INQUIRE_SYS_START+130L)
+   MIL_DEPRECATED(M_MP_MAX_CORES_PER_THREAD, 1060)
+   #define M_MP_PRE_PROCESS                           (M_APP_INQUIRE_SYS_START+131L)
+   MIL_DEPRECATED(M_MP_PRE_PROCESS, 1060)
+   #define M_MP_CORES_NUM                             (M_APP_INQUIRE_SYS_START+133L)
+   MIL_DEPRECATED(M_MP_CORES_NUM, 1060)
+   #define M_MP_PHYSICAL_CORES_NUM                    (M_APP_INQUIRE_SYS_START+134L)
+   MIL_DEPRECATED(M_MP_PHYSICAL_CORES_NUM, 1060)
+#endif
+#define M_SUPERSIGHT_DESC                             (M_APP_INQUIRE_SYS_START+136L)
+#define M_USE_LIB_TIFF_HANDLER                        (M_APP_INQUIRE_SYS_START+137L)
+#define M_PNG_ALPHA_CHANNEL                           (M_APP_INQUIRE_SYS_START+138L)
+#define M_FLIP_BUFFERS_SUPPORT                        (M_APP_INQUIRE_SYS_START+139L)
+#define M_USE_LEGACY_RAW_FORMAT                       (M_APP_INQUIRE_SYS_START+141L)
+#define M_GENERATE_BEEP                               (M_APP_INQUIRE_SYS_START+142L)
+#define M_LEGACY_COMPENSATION                         (M_APP_INQUIRE_SYS_START+143L)
+#define M_SELECTABLE_SYSTEM_COUNT                     (M_APP_INQUIRE_SYS_START+144L)
+#define M_IMPORT_JPEG_WITH_VALIDATION                 (M_APP_INQUIRE_SYS_START+145L)
+
+#define M_DEFAULT_HOST_FROM_ID                        (M_APP_INQUIRE_SYS_START+290L)
+/* Reserve for error to prevent previous inquire + n  (M_APP_INQUIRE_SYS_START+293L)*/
+/* Reserve for error to prevent previous inquire + n  (M_APP_INQUIRE_SYS_START+295L)*/
+// Unused                                             (M_APP_INQUIRE_SYS_START+297L)
+
+
+#define M_NON_PAGED_MEMORY_FREE                       (M_APP_INQUIRE_SYS_START+500L)
+#define M_NON_PAGED_MEMORY_USED                       (M_APP_INQUIRE_SYS_START+501L)
+#define M_NON_PAGED_MEMORY_SIZE                       (M_APP_INQUIRE_SYS_START+502L)
+#define M_NON_PAGED_MEMORY_LARGEST_FREE               (M_APP_INQUIRE_SYS_START+503L)
+#define M_ANCESTOR_APPLICATION                        (M_APP_INQUIRE_SYS_START+505L)
+
+#define M_USE_NEW_DISPLAYS                            (M_APP_INQUIRE_SYS_START+0x00000200L) /*512L*/
+#define M_MEMORY_ALLOC_PRE_PADDING                    (M_APP_INQUIRE_SYS_START+513L)
+#define M_MEMORY_ALLOC_POST_PADDING                   (M_APP_INQUIRE_SYS_START+514L)
+#define M_MEMORY_ALLOC_PITCH_BYTE                     (M_APP_INQUIRE_SYS_START+515L)
+#define M_MEMORY_ALLOC_ALIGNMENT                      (M_APP_INQUIRE_SYS_START+516L)
+#define M_DMIL_CONNECTION_PORT                        (M_APP_INQUIRE_SYS_START+517L)
+#define M_DMIL_CONNECTION                             (M_APP_INQUIRE_SYS_START+518L)
+#define M_DMIL_AUTO_PUBLISH_ALL                       (M_APP_INQUIRE_SYS_START+519L)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_CONNECTION                          (M_APP_INQUIRE_SYS_START+521L)
+#define M_OLD_WEB_CONNECTION_PORT                     (M_APP_INQUIRE_SYS_START+522L)
+#endif
+#define M_WEB_CONNECTION                              (M_APP_INQUIRE_SYS_START+523L)
+// Reserve User M_WEB_CONNECTION + 1                  (M_APP_INQUIRE_SYS_START+524L)
+// Reserve User M_WEB_CONNECTION + 2                  (M_APP_INQUIRE_SYS_START+525L)
+// Reserve FB M_WEB_CONNECTION   + 3                  (M_APP_INQUIRE_SYS_START+526L)
+// Reserve DA M_WEB_CONNECTION   + 4                  (M_APP_INQUIRE_SYS_START+527L)
+#define M_WEB_CONNECTION_PORT                         (M_APP_INQUIRE_SYS_START+528L)
+// Reserve User M_WEB_CONNECTION_PORT + 1             (M_APP_INQUIRE_SYS_START+529L)
+// Reserve User M_WEB_CONNECTION_PORT + 2             (M_APP_INQUIRE_SYS_START+530L)
+// Reserve FB   M_WEB_CONNECTION_PORT + 3             (M_APP_INQUIRE_SYS_START+531L)
+// Reserve DA   M_WEB_CONNECTION_PORT + 4             (M_APP_INQUIRE_SYS_START+532L)
+#define M_COMP_DISP_RESELECT                          (M_APP_INQUIRE_SYS_START+533L)
+
+#define M_MTX_MEM_MANAGER_INFO_START                  (M_APP_INQUIRE_SYS_START+600L)
+   #define M_MTX_MEM_MANAGER_ADDRESS                  (M_MTX_MEM_MANAGER_INFO_START)
+   #define M_MTX_MEM_MANAGER_MEM_SIZE                 (M_MTX_MEM_MANAGER_INFO_START+1L)
+   #define M_MTX_MEM_MANAGER_FREE_MEM_SIZE            (M_MTX_MEM_MANAGER_INFO_START+2L)
+   #define M_MTX_MEM_MANAGER_USED_MEM_SIZE            (M_MTX_MEM_MANAGER_INFO_START+3L)
+   #define M_MTX_MEM_MANAGER_VERSION                  (M_MTX_MEM_MANAGER_INFO_START+4L)
+   #define M_MTX_MEM_MANAGER_NUM_OF_BANK              (M_MTX_MEM_MANAGER_INFO_START+5L)
+   #define M_MTX_MEM_MANAGER_BANK_FLAGS               (M_MTX_MEM_MANAGER_INFO_START+6L)
+   #define M_MTX_MEM_MANAGER_NON_PAGED_FLAGS          (M_MTX_MEM_MANAGER_INFO_START+7L)
+   #define M_MTX_MEM_MANAGER_KERNEL_ADDRESS           (M_MTX_MEM_MANAGER_INFO_START+8L)
+   #define M_MTX_MEM_MANAGER_STARTUP_NONPAGED_MODE    (M_MTX_MEM_MANAGER_INFO_START+9L)
+   #define M_MTX_MEM_MANAGER_STARTUP_NONPAGED_SIZE    (M_MTX_MEM_MANAGER_INFO_START+10L)
+   #define M_MTX_MEM_MANAGER_STARTUP_CHUNK_SIZE       (M_MTX_MEM_MANAGER_INFO_START+11L)
+   #define M_MTX_MEM_MANAGER_OS_MEMORY_SIZE           (M_MTX_MEM_MANAGER_INFO_START+12L)
+   #define M_MTX_MEM_MANAGER_BOOT_FLAGS               (M_MTX_MEM_MANAGER_INFO_START+13L)
+   #define M_MTX_MEM_MANAGER_THRESHOLD                (M_MTX_MEM_MANAGER_INFO_START+14L)
+   #define M_MTX_MEM_MANAGER_REG_NONPAGED_MODE        (M_MTX_MEM_MANAGER_INFO_START+15L)
+   #define M_MTX_MEM_MANAGER_REG_CHUNK_SIZE           (M_MTX_MEM_MANAGER_INFO_START+16L)
+   #define M_MTX_MEM_MANAGER_REG_NONPAGED_SIZE        (M_MTX_MEM_MANAGER_INFO_START+17L)
+
+   #define M_MTX_MEM_DRIVER_INFORMATION_STRUCT        (M_MTX_MEM_MANAGER_INFO_START+18L)
+   #define M_MTX_MEM_MANAGER_STRUCT_VERSION           (M_MTX_MEM_MANAGER_INFO_START+19L)
+   #define M_MTX_MEM_MANAGER_STRUCT_SIZE              (M_MTX_MEM_MANAGER_INFO_START+20L)
+   #define M_MTX_MEM_MANAGER_BASE_ADDRESS             (M_MTX_MEM_MANAGER_ADDRESS)
+   #define M_MTX_MEM_MANAGER_SIZE_IN_BYTE             (M_MTX_MEM_MANAGER_MEM_SIZE)
+   #define M_MTX_MEM_MANAGER_FREE_MEM_SIZE_IN_BYTE    (M_MTX_MEM_MANAGER_FREE_MEM_SIZE)
+   #define M_MTX_MEM_MANAGER_USED_MEM_SIZE_IN_BYTE    (M_MTX_MEM_MANAGER_USED_MEM_SIZE)
+   #define M_MTX_MEM_MANAGER_NONPAGED_MODE            (M_MTX_MEM_MANAGER_INFO_START+21L)
+   #define M_MTX_MEM_MANAGER_CHUNK_SIZE               (M_MTX_MEM_MANAGER_INFO_START+22L)
+   #define M_MTX_MEM_MANAGER_NUM_USER_BANKS           (M_MTX_MEM_MANAGER_INFO_START+23L)
+   #define M_MTX_MEM_MANAGER_BIGGEST_BANK             (M_MTX_MEM_MANAGER_INFO_START+24L)
+   #define M_MTX_MEM_MANAGER_SMALLEST_BANK            (M_MTX_MEM_MANAGER_INFO_START+25L)
+   #define M_MTX_MEM_MANAGER_MIN_CHUNK_SIZE           (M_MTX_MEM_MANAGER_INFO_START+26L)
+   #define M_MTX_MEM_MANAGER_MAX_NON_PAGED            (M_MTX_MEM_MANAGER_INFO_START+27L)
+   #define M_MTX_MEM_MANAGER_SPECIAL_MODE             (M_MTX_MEM_MANAGER_INFO_START+28L)
+   #define M_MTX_MEM_MANAGER_RAM_INSTALLED            (M_MTX_MEM_MANAGER_INFO_START+29L)
+
+   /* Reserve next values                  from       (M_APP_INQUIRE_SYS_START+600L)*/
+   /*                                      to         (M_APP_INQUIRE_SYS_START+639L)*/
+#define M_MTX_MEM_MANAGER_INFO_END                    (M_APP_INQUIRE_SYS_START+639L)
+
+#define M_IN_MTX_MEM_MANAGER_INFO_RANGE(X)            ((M_STRIP_INTERMOD_BITS(X) >= M_MTX_MEM_MANAGER_INFO_START) && \
+                                                       (M_STRIP_INTERMOD_BITS(X) <= M_MTX_MEM_MANAGER_INFO_END  )  )
+
+
+/* Reserve next values                  from          (M_APP_INQUIRE_SYS_START+640L)*/
+/*                                      to            (M_APP_INQUIRE_SYS_START+704L)*/
+
+#define M_BH_BASE_BUFFER_TYPE                         (M_APP_INQUIRE_SYS_START+705L)
+#define M_BH_NEEDED_BUFFER_ATTRIBUTE                  (M_APP_INQUIRE_SYS_START+706L)
+#define M_BH_INCOMPATIBLE_BUFFER_ATTRIBUTE            (M_APP_INQUIRE_SYS_START+707L)
+#define M_BH_TRANSFER_METHOD                          (M_APP_INQUIRE_SYS_START+708L)
+#define M_BH_TRANSFER_FUNCTION_SUPPORTED              (M_APP_INQUIRE_SYS_START+709L)
+#define M_BH_IS_ALLOCATOR                             (M_APP_INQUIRE_SYS_START+710L)
+#define M_BH_IS_CREATOR                               (M_APP_INQUIRE_SYS_START+711L)
+#define M_BH_KNOWN_DISPLAY_ATTRIBUTE                  (M_APP_INQUIRE_SYS_START+712L)
+/* Reserve next values                  from          (M_APP_INQUIRE_SYS_START+713L)*/
+/*                                      to            (M_APP_INQUIRE_SYS_START+719L)*/
+#define M_DMA_MANAGER_TYPE                            (M_APP_INQUIRE_SYS_START+720L)
+#define M_FREE_EMPTY_WORKSPACE                        (M_APP_INQUIRE_SYS_START+721L)
+#define M_RESERVE_CLUSTER_NODE                        (M_APP_INQUIRE_SYS_START+722L)
+#define M_FREE_CLUSTER_NODE                           (M_APP_INQUIRE_SYS_START+723L)
+#define M_DEFAULT_CLUSTER_NODE                        (M_APP_INQUIRE_SYS_START+724L)
+#define M_FREE_EMPTY_CLUSTER_NODE                     (M_APP_INQUIRE_SYS_START+725L)
+#define M_CLUSTER_NODE_FROM_ID                        (M_APP_INQUIRE_SYS_START+726L)
+#define M_EXPIRATION_DATE                             (M_APP_INQUIRE_SYS_START+727L)
+#define M_FREE_DEFAULT_SHADOWS                        (M_APP_INQUIRE_SYS_START+728L)
+#define M_FREE_REMAINING_TUBES                        (M_APP_INQUIRE_SYS_START+729L)
+#if MIL_COMPILE_VERSION < 1010
+#define M_INSTALLED_SYSTEM_TYPE                       (M_APP_INQUIRE_SYS_START+728L)
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_INSTALLED_SYSTEM_TYPE_OLD                   (M_APP_INQUIRE_SYS_START+728L)
+/* Reserved the 15 next values               from     (M_APP_INQUIRE_SYS_START+729L)*/
+/*                                        to          (M_APP_INQUIRE_SYS_START+744L)*/
+#endif
+#define M_IGNORED_EXP_DATE                            (M_APP_INQUIRE_SYS_START+745L)
+#define M_FREE_ALL_SHADOWS                            (M_APP_INQUIRE_SYS_START+746L)
+
+#if MIL_COMPILE_VERSION < 1010
+#define M_INSTALLED_SYSTEM_CAN_GRAB                   (M_APP_INQUIRE_SYS_START+800L)
+#define M_IS_DISTRIBUTED_BOARD                        (M_APP_INQUIRE_SYS_START+816L)
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_INSTALLED_SYSTEM_CAN_GRAB_OLD               (M_APP_INQUIRE_SYS_START+800L)
+/* Reserved the next values               from        (M_APP_INQUIRE_SYS_START+801L)*/
+/*                                        to          (M_APP_INQUIRE_SYS_START+815L)*/
+#define M_IS_DISTRIBUTED_BOARD_OLD                    (M_APP_INQUIRE_SYS_START+816L)
+/* Reserve next 15 values                from         (M_APP_INQUIRE_SYS_START+817L)*/
+/*                                       to           (M_APP_INQUIRE_SYS_START+831L)*/
+#endif
+
+#define M_DIRECT_ACCESS_START                         (M_APP_INQUIRE_SYS_START+832L)
+   #define M_PROCESSING_PACK_REVISION                 (M_APP_INQUIRE_SYS_START+833L)
+   /* The next values are available          from     (M_APP_INQUIRE_SYS_START+834L)*/
+   /*                                        to       (M_APP_INQUIRE_SYS_START+889L)*/
+
+
+   #define M_APP_INQUIRE_DIRECT_ACCESS_STRING_START   (M_APP_INQUIRE_SYS_START+890L)
+
+
+   #define M_APP_INQUIRE_DIRECT_ACCESS_STRING_END     (M_APP_INQUIRE_SYS_START+949)
+
+   #define M_DUMP_ID_TABLE                           ((M_APP_INQUIRE_SYS_START+951L)|M_CLIENT_ENCODING)
+   #define M_DEFAULT_SYSTEM_ID                        (M_APP_INQUIRE_SYS_START+952L)
+   #define M_DUMP_ALL_ID_INFO                         (M_APP_INQUIRE_SYS_START+954L)
+   #define M_MIL_DLL_COMPILATION_TYPE                 (M_APP_INQUIRE_SYS_START+956L)
+   #define M_MILUTIL_COMPILATION_TYPE                 (M_APP_INQUIRE_SYS_START+957L)
+   #define M_IS_DISTRIBUTED_MIL_INSTALLED             (M_APP_INQUIRE_SYS_START+958L)
+   #define M_IS_DISTRIBUTED_MIL_SERVER_INSTALLED      (M_APP_INQUIRE_SYS_START+959L)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_SUPPORT_ERROR_REMOTE_CURRENT             (M_APP_INQUIRE_SYS_START+962L)
+#endif
+   #define M_IS_MIL_WEB_INSTALLED                     (M_APP_INQUIRE_SYS_START+963L)
+   #define M_IS_MIL_HTTP_SERVER_INSTALLED             (M_APP_INQUIRE_SYS_START+964L)
+   /* The next values are available from              (M_APP_INQUIRE_SYS_START+965L)*/
+   /*                               to                (M_APP_INQUIRE_SYS_START+975L)*/
+
+
+   #define M_REG_DEF_START                            (M_APP_INQUIRE_SYS_START+976L)                                      
+      #define M_APP_INQUIRE_REG_DEF_STRING_START      (M_APP_INQUIRE_SYS_START+977L)                                      
+      #define M_APP_INQUIRE_REG_DEF_STRING_END        (M_APP_INQUIRE_SYS_START+1296L)                                     
+   #define M_REG_DEF_END                              (M_APP_INQUIRE_SYS_START+1521L)                                     
+
+
+#define M_DIRECT_ACCESS_END                           (M_APP_INQUIRE_SYS_START+1522L)
+
+
+
+#define M_INSTALLATION_TYPE                           (M_APP_INQUIRE_SYS_START+1523L)
+#define M_NEED_NETWORK_TUBE_DECODER                   (M_APP_INQUIRE_SYS_START+1524L)
+#define M_SUPPORT_INTERSYSTEM_CALL                    (M_APP_INQUIRE_SYS_START+1525L)
+#define M_SUPPORT_MIXED_CLUSTER                       (M_APP_INQUIRE_SYS_START+1526L)
+#define M_NEED_DEFAULT_COMPENSATION                   (M_APP_INQUIRE_SYS_START+1527L)
+#define M_CLUSTER_MASK                                (M_APP_INQUIRE_SYS_START+1528L)
+#define M_INTRA_CLUSTER_NODE_MASK                     (M_APP_INQUIRE_SYS_START+1529L)
+#define M_IDEMPOTENT_FOR_WORKSPACE                    (M_APP_INQUIRE_SYS_START+1530L)
+
+#define M_SYSTEM_OFFSET                               (M_APP_INQUIRE_SYS_START+1531L)   // Undocumented inquire type
+/* Reserve values from                                (M_APP_INQUIRE_SYS_START+1532L)*/
+/*                to                                  (M_APP_INQUIRE_SYS_START+1546L)*/ 
+// This inquire type initializes a BoardInfo struct with the defaults values of the specified system
+// A pointer to this struct is then returned. To select a specified system, inquire its offset using M_SYSTEM_OFFSET
+// and then simply added it to M_SET_SYSTEM_DEFAULTS.
+#if MIL_COMPILE_VERSION < 1010
+#define M_BOARD_DEFAULTS_PTR                          (M_APP_INQUIRE_SYS_START+1548L)   // Undocumented inquire type 
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_BOARD_DEFAULTS_PTR_OLD                      (M_APP_INQUIRE_SYS_START+1548L)   // Undocumented inquire type 
+/* Reserve values from                                (M_APP_INQUIRE_SYS_START+1549L)*/
+/*                to                                  (M_APP_INQUIRE_SYS_START+1563L)*/ 
+#endif
+#define M_ID_TABLE_SIZE                               (M_APP_INQUIRE_SYS_START+1581L)
+#define M_ID_LIST_FREE_ENTRIES                        (M_APP_INQUIRE_SYS_START+1582L)
+#define M_ID_TABLE_LEGACY_MODE                        (M_APP_INQUIRE_SYS_START+1583L)
+#define M_PLATFORM_BITNESS                            (M_APP_INQUIRE_SYS_START+1584L)
+#define M_PLATFORM_OS_TYPE                            (M_APP_INQUIRE_SYS_START+1585L)
+#define M_LICENSE_KEY_WAIT_TIME                       (M_APP_INQUIRE_SYS_START+1586L)
+#define M_IS_EA_EXPIRED                               (M_APP_INQUIRE_SYS_START+1587L)
+
+#define M_TRACE                                       0x00004100L // = (M_APP_INQUIRE_SYS_START+1640L)  Use in MappTimer
+#define M_TRACE_ACTIVE                                (M_APP_INQUIRE_SYS_START+1641L)
+#if OldDefinesSupport
+   #define M_TRACE_ENABLED                            M_TRACE_ACTIVE
+   MIL_DEPRECATED(M_TRACE_ENABLED, 1010)
+#endif
+
+// Common App and Sys string types, next 200 values
+#define M_SYS_APP_INQUIRE_STRING_START                (M_APP_INQUIRE_SYS_START+1800L)
+
+#if MIL_COMPILE_VERSION < 1010
+#define M_INSTALLED_SYSTEM_DESCRIPTOR       ((M_APP_INQUIRE_SYS_START+1800L)|M_CLIENT_ENCODING)
+#define M_INSTALLED_SYSTEM_PRINT_NAME       ((M_APP_INQUIRE_SYS_START+1816L)|M_CLIENT_ENCODING)
+#define M_INSTALLED_SYSTEM_REG_KEY_NAME     ((M_APP_INQUIRE_SYS_START+1832L)|M_CLIENT_ENCODING)
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+      #define M_INSTALLED_SYSTEM_DESCRIPTOR_OLD       ((M_APP_INQUIRE_SYS_START+1800L)|M_CLIENT_ENCODING)
+      /* Reserve next 15 values               from    ((M_APP_INQUIRE_SYS_START+1801L)|M_CLIENT_ENCODING)*/
+      /*                                      to      ((M_APP_INQUIRE_SYS_START+1815L)|M_CLIENT_ENCODING)*/
+      #define M_INSTALLED_SYSTEM_PRINT_NAME_OLD       ((M_APP_INQUIRE_SYS_START+1816L)|M_CLIENT_ENCODING)
+      /* Reserve next 15 values               from    ((M_APP_INQUIRE_SYS_START+1817L)|M_CLIENT_ENCODING)*/
+      /*                                      to      ((M_APP_INQUIRE_SYS_START+1831L)|M_CLIENT_ENCODING)*/
+      #define M_INSTALLED_SYSTEM_REG_KEY_NAME_OLD     ((M_APP_INQUIRE_SYS_START+1832L)|M_CLIENT_ENCODING)
+      /* Reserve next 15 values               from    ((M_APP_INQUIRE_SYS_START+1833L)|M_CLIENT_ENCODING)*/
+      /*                                      to      ((M_APP_INQUIRE_SYS_START+1847L)|M_CLIENT_ENCODING)*/
+#endif
+      #define M_CLUSTER_SERVER_NAME                   ((M_APP_INQUIRE_SYS_START+1848L)|M_CLIENT_ENCODING)
+      #define M_TRACER_NAME                           ((M_APP_INQUIRE_SYS_START+1849L)|M_CLIENT_ENCODING)
+      #define M_TRACE_SAVE_TO_FILE                    ((M_APP_INQUIRE_SYS_START+1850L)|M_CLIENT_ENCODING)
+      #define M_MIL_DIRECTORY_INSTALL                 ((M_APP_INQUIRE_SYS_START+1851L)|M_CLIENT_ENCODING)
+      #define M_MIL_DIRECTORY_EXAMPLES                ((M_APP_INQUIRE_SYS_START+1852L)|M_CLIENT_ENCODING)
+      #define M_MIL_DIRECTORY_IMAGES                  ((M_APP_INQUIRE_SYS_START+1853L)|M_CLIENT_ENCODING)
+      #define M_MIL_DIRECTORY_CONTEXTS                ((M_APP_INQUIRE_SYS_START+1854L)|M_CLIENT_ENCODING)
+
+#if MIL_COMPILE_VERSION < 1010
+#if OldDefinesSupport
+#define M_NAME_OF_BOARD_TYPE                    M_INSTALLED_SYSTEM_DESCRIPTOR
+      MIL_DEPRECATED(M_NAME_OF_BOARD_TYPE, 1000)
+#define M_DISPLAY_NAME_OF_BOARD_TYPE            M_INSTALLED_SYSTEM_PRINT_NAME
+      MIL_DEPRECATED(M_DISPLAY_NAME_OF_BOARD_TYPE, 1000)
+#define M_REG_KEY_NAME_OF_BOARD_TYPE            M_INSTALLED_SYSTEM_REG_KEY_NAME
+      MIL_DEPRECATED(M_REG_KEY_NAME_OF_BOARD_TYPE, 1000)
+#define M_IMAGING_BOARD_TYPE                    M_INSTALLED_SYSTEM_REG_KEY_NAME
+      MIL_DEPRECATED(M_IMAGING_BOARD_TYPE, 1000)
+#endif
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #if OldDefinesSupport
+      #define M_NAME_OF_BOARD_TYPE                    M_INSTALLED_SYSTEM_DESCRIPTOR_OLD
+      MIL_DEPRECATED(M_NAME_OF_BOARD_TYPE, 1000)
+      #define M_DISPLAY_NAME_OF_BOARD_TYPE            M_INSTALLED_SYSTEM_PRINT_NAME_OLD
+      MIL_DEPRECATED(M_DISPLAY_NAME_OF_BOARD_TYPE, 1000)
+      #define M_REG_KEY_NAME_OF_BOARD_TYPE            M_INSTALLED_SYSTEM_REG_KEY_NAME_OLD
+      MIL_DEPRECATED(M_REG_KEY_NAME_OF_BOARD_TYPE, 1000)
+      #define M_IMAGING_BOARD_TYPE                    M_INSTALLED_SYSTEM_REG_KEY_NAME_OLD
+      MIL_DEPRECATED(M_IMAGING_BOARD_TYPE, 1000)
+   #endif
+#endif
+
+#if MIL_COMPILE_VERSION < 1010
+   #define M_INSTALLED_SYSTEM_DESCRIPTOR_SIZE     (M_STRING_SIZE + M_INSTALLED_SYSTEM_DESCRIPTOR)
+   #define M_INSTALLED_SYSTEM_PRINT_NAME_SIZE     (M_STRING_SIZE + M_INSTALLED_SYSTEM_PRINT_NAME)
+   #define M_INSTALLED_SYSTEM_REG_KEY_NAME_SIZE   (M_STRING_SIZE + M_INSTALLED_SYSTEM_REG_KEY_NAME)
+#elif MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define M_INSTALLED_SYSTEM_DESCRIPTOR_SIZE_OLD     (M_STRING_SIZE + M_INSTALLED_SYSTEM_DESCRIPTOR_OLD)
+   #define M_INSTALLED_SYSTEM_PRINT_NAME_SIZE_OLD     (M_STRING_SIZE + M_INSTALLED_SYSTEM_PRINT_NAME_OLD)
+   #define M_INSTALLED_SYSTEM_REG_KEY_NAME_SIZE_OLD   (M_STRING_SIZE + M_INSTALLED_SYSTEM_REG_KEY_NAME_OLD)
+#endif
+
+#if OldDefinesSupport
+#define M_CLUSTER_SERVER_NAME_SIZE                 (M_STRING_SIZE + M_CLUSTER_SERVER_NAME)
+      MIL_DEPRECATED(M_CLUSTER_SERVER_NAME_SIZE, 1040)
+#endif
+#define M_SYS_APP_INQUIRE_STRING_END               (M_APP_INQUIRE_SYS_START+1999L)
+
+
+#define M_LICENSE_MODULES                             (M_APP_INQUIRE_SYS_START+2002L)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#endif
+#define M_KEY_CUSTOM_VALUE                            (M_APP_INQUIRE_SYS_START+2029L)
+
+
+
+#define M_LICENSE_FINGERPRINT                         (M_APP_INQUIRE_SYS_START+5480L)
+#define M_NUMBER_OF_KEYS                              (M_APP_INQUIRE_SYS_START+6506L)
+
+
+
+// Common App and Sys string types, next 200 values
+#define M_SYS_APP_INQUIRE_STRING_2_START              (M_APP_INQUIRE_SYS_START+7000)
+
+#if MIL_COMPILE_VERSION >= 1010
+#define M_INSTALLED_SYSTEM_DESCRIPTOR           ((M_APP_INQUIRE_SYS_START+7000L)|M_CLIENT_ENCODING)
+/* Reserve next 63 values               from    ((M_APP_INQUIRE_SYS_START+7001L)|M_CLIENT_ENCODING)*/
+/*                                      to      ((M_APP_INQUIRE_SYS_START+7063L)|M_CLIENT_ENCODING)*/
+#define M_INSTALLED_SYSTEM_PRINT_NAME           ((M_APP_INQUIRE_SYS_START+7064L)|M_CLIENT_ENCODING)
+/* Reserve next 63 values               from    ((M_APP_INQUIRE_SYS_START+7065L)|M_CLIENT_ENCODING)*/
+/*                                      to      ((M_APP_INQUIRE_SYS_START+7127L)|M_CLIENT_ENCODING)*/
+#define M_INSTALLED_SYSTEM_REG_KEY_NAME         ((M_APP_INQUIRE_SYS_START+7128L)|M_CLIENT_ENCODING)
+/* Reserve next 63 values               from    ((M_APP_INQUIRE_SYS_START+7129L)|M_CLIENT_ENCODING)*/
+/*                                      to      ((M_APP_INQUIRE_SYS_START+7191L)|M_CLIENT_ENCODING)*/
+
+#if OldDefinesSupport
+#define M_INSTALLED_SYSTEM_DESCRIPTOR_SIZE         (M_STRING_SIZE + M_INSTALLED_SYSTEM_DESCRIPTOR)
+#define M_INSTALLED_SYSTEM_PRINT_NAME_SIZE         (M_STRING_SIZE + M_INSTALLED_SYSTEM_PRINT_NAME)
+#define M_INSTALLED_SYSTEM_REG_KEY_NAME_SIZE       (M_STRING_SIZE + M_INSTALLED_SYSTEM_REG_KEY_NAME)
+
+MIL_DEPRECATED(M_INSTALLED_SYSTEM_DESCRIPTOR_SIZE   , 1040)
+MIL_DEPRECATED(M_INSTALLED_SYSTEM_PRINT_NAME_SIZE   , 1040)
+MIL_DEPRECATED(M_INSTALLED_SYSTEM_REG_KEY_NAME_SIZE , 1040)
+#endif
+#endif
+
+
+#define M_GENTL_PRODUCER_DESCRIPTOR             ((M_APP_INQUIRE_SYS_START+7192L)|M_CLIENT_ENCODING)
+#define M_GENTL_PRODUCER_DESCRIPTION            M_GENTL_PRODUCER_DESCRIPTOR
+/* Reserve next 63 values               from    ((M_APP_INQUIRE_SYS_START+7193L)|M_CLIENT_ENCODING)*/
+/*                                      to      ((M_APP_INQUIRE_SYS_START+7255L)|M_CLIENT_ENCODING)*/
+
+#if OldDefinesSupport
+#define M_GENTL_PRODUCER_DESCRIPTOR_SIZE           (M_STRING_SIZE + M_GENTL_PRODUCER_DESCRIPTOR)
+#define M_GENTL_PRODUCER_DESCRIPTION_SIZE          M_GENTL_PRODUCER_DESCRIPTOR_SIZE
+MIL_DEPRECATED(M_GENTL_PRODUCER_DESCRIPTOR_SIZE , 1040)
+#endif
+
+#define M_KEY_SERIAL_NUMBER                     ((M_APP_INQUIRE_SYS_START+7264L)|M_CLIENT_ENCODING)
+
+
+
+#define M_SYS_APP_INQUIRE_STRING_2_END             (M_APP_INQUIRE_SYS_START+7399L)
+
+
+/*Reserve values between M_REG_DEF_START and M_REG_DEF_END*/
+/*Reserve values between M_REG_DEF_START and M_REG_DEF_END*/
+#define M_DIRECT_ACCESS_2_START                 (M_APP_INQUIRE_SYS_START+8000L)
+
+#define M_REG_DEF_2_START                       (M_APP_INQUIRE_SYS_START+8000L)                               
+#define M_APP_INQUIRE_REG_DEF_STRING_2_START      (M_APP_INQUIRE_SYS_START+8000L)                             
+#define M_APP_INQUIRE_REG_DEF_STRING_2_END        (M_APP_INQUIRE_SYS_START+8959L)                             
+#define M_REG_DEF_2_END                         (M_APP_INQUIRE_SYS_START+9791L)
+#define M_DIRECT_ACCESS_2_END                   (M_APP_INQUIRE_SYS_START+9791L)
+
+
+#if MIL_COMPILE_VERSION >= 1010
+#define M_BOARD_DEFAULTS_PTR                     (M_APP_INQUIRE_SYS_START+9792L)
+/* reserve value up to                           (M_APP_INQUIRE_SYS_START+9855L) */
+
+#define M_INSTALLED_SYSTEM_CAN_GRAB              (M_APP_INQUIRE_SYS_START+9856L)
+/* Reserved the next values               from   (M_APP_INQUIRE_SYS_START+9857L)*/
+/*                                        to     (M_APP_INQUIRE_SYS_START+9919L)*/
+
+#define M_INSTALLED_SYSTEM_TYPE                   (M_APP_INQUIRE_SYS_START+9920L)
+/* Reserved the 63 next values            from    (M_APP_INQUIRE_SYS_START+9921L)*/
+/*                                        to      (M_APP_INQUIRE_SYS_START+9983L)*/
+#define M_IS_DISTRIBUTED_BOARD                    (M_APP_INQUIRE_SYS_START+9984L)
+/* Reserve next 63 values                from     (M_APP_INQUIRE_SYS_START+9985L)*/
+/*                                       to       (M_APP_INQUIRE_SYS_START+10048L)*/
+#endif
+
+
+#define M_DIRECT_ACCESS_3_START                 (M_APP_INQUIRE_SYS_START+10050L)
+#define M_REG_DEF_3_START                       (M_APP_INQUIRE_SYS_START+10050L)
+
+
+
+
+#define M_REG_DEF_3_END                          (M_APP_INQUIRE_SYS_START+10369L)
+
+
+#define M_DIRECT_ACCESS_3_END                    (M_APP_INQUIRE_SYS_START+10369L)
+
+#define M_INSTALLED_SYSTEM_DEVICE_COUNT         (M_APP_INQUIRE_SYS_START+10500L)
+/* Reserve values from                          (M_APP_INQUIRE_SYS_START+10501L)*/
+/*                to                            (M_APP_INQUIRE_SYS_START+10563L)*/
+
+
+#define M_IN_DIRECT_ACCESS_RANGE(X)             ( ((M_STRIP_INTERMOD_BITS(X) >= M_DIRECT_ACCESS_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_DIRECT_ACCESS_END  ) ) || \
+                                                  ((M_STRIP_INTERMOD_BITS(X) >= M_DIRECT_ACCESS_2_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_DIRECT_ACCESS_2_END  ) ) || \
+                                                  ((M_STRIP_INTERMOD_BITS(X) >= M_DIRECT_ACCESS_3_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_DIRECT_ACCESS_3_END  ) ) || \
+                                                   (X == M_REBOOT_NEEDED))
+
+#define M_IN_REG_DEF_RANGE(X)                   ( ((M_STRIP_INTERMOD_BITS(X) >= M_REG_DEF_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_REG_DEF_END  ) ) || \
+                                                  ((M_STRIP_INTERMOD_BITS(X) >= M_REG_DEF_2_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_REG_DEF_2_END  ) ) || \
+                                                  ((M_STRIP_INTERMOD_BITS(X) >= M_REG_DEF_3_START) && \
+                                                   (M_STRIP_INTERMOD_BITS(X) <= M_REG_DEF_3_END  ) ) )
+
+
+#define M_APP_INQUIRE_SYS_END                         30000L
+
+/************************************************************************/
+/* MappInquireMp() / MappControlMp() Types                              */
+/* MthrInquireMp() / MthrControlMp() Types                              */
+/************************************************************************/
+#define M_CORE_MAX_FOR_COPY                           1586L
+#define M_CORE_MAX                                    1587L
+#define M_MP_USER_THREAD                              1588L
+#define M_MP_PRIORITY                                 1589L
+#define M_CORE_AFFINITY_MASK                          1590L
+#define M_CORE_SHARING                                1591L
+#define M_MP_USE                                      (M_APP_INQUIRE_SYS_START+128L) // 15128
+
+#define M_FOLLOW_CORE_MAX                             0x00040000L
+
+// MappXXXMp only
+#define M_CORE_PARKING_STATE                          1789L
+#define M_CORE_THROTTLING_STATE                       1790L
+
+// MappInquireMp only
+#define M_CORE_NUM_PROCESS                            1592L
+#define M_MP_FORCED_DISABLE                           1593L
+#define M_CORE_NUM_HARDWARE                           1594L
+#define M_MEMORY_BANK_NUM                             1595L
+#define M_MEMORY_BANK_AFFINITY_MASK                   1596L
+#define M_MEMORY_BANK_CORE_AFFINITY_MASK              1597L
+#define M_CORE_MEMORY_BANK                            1598L
+#define M_CORE_MEMORY_BANK_AFFINITY_MASK              1599L
+//#define unused                                      1600L
+#define M_CORE_AFFINITY_MASK_ARRAY_SIZE               1601L
+#define M_MEMORY_BANK_AFFINITY_MASK_ARRAY_SIZE        1602L
+#define M_CORE_AFFINITY_MASK_PROCESS                  1642L
+#define M_CORE_AFFINITY_MASK_HARDWARE                 1647L
+//#define unused                                      1650L
+#define M_CORE_NUM_OS                                 1651L
+
+
+// MappControlMp only
+#define M_CORE_FORCE_NB                               1603L
+#define M_MP_POOL_SIZE                                1604L
+#define M_MP_SPIN_LOOP_COUNT                          1605L
+#define M_CORE_FORCE_ONE                              1606L
+#define M_MP_USE_INTERNAL_FORCED                      1608L
+#define M_MP_THRESHOLD_RESTRICTION                    (1609L | M_CLIENT_ENCODING)
+
+// MthrInquireMp only
+//#define unused                                      1652L
+#define M_CORE_NUM_EFFECTIVE                          M_CORE_NUM_PROCESS
+
+
+
+#if OldDefinesSupport
+#define M_CORE_NUM                                    M_CORE_NUM_PROCESS            // To support Mil9PP2 EA users
+MIL_DEPRECATED(M_CORE_NUM, 1000)
+#define M_MP_FORCE_DISABLE                            M_MP_FORCED_DISABLE           // To support Mil9PP2 EA users
+MIL_DEPRECATED(M_MP_FORCE_DISABLE, 1000)
+#define M_APPLICATION_CORE_AFFINITY_MASK              M_CORE_AFFINITY_MASK_PROCESS  // To support Mil9PP2 EA users
+MIL_DEPRECATED(M_APPLICATION_CORE_AFFINITY_MASK, 1000)
+#endif
+
+
+/************************************************************************/
+/* Licensing: Module information                                        */
+/************************************************************************/
+#define M_LICENSE_LITE               0x00000001L //0L
+#define M_LICENSE_DEBUG              0x00000002L //1L
+#define M_LICENSE_IM                 0x00000004L //2L
+#define M_LICENSE_CODE               0x00000008L //3L
+#define M_LICENSE_MEAS               0x00000010L //4L
+#define M_LICENSE_BEAD               M_LICENSE_MEAS
+#define M_LICENSE_PAT                0x00000020L //5L
+#define M_LICENSE_MOD                0x00000040L //6L
+#define M_LICENSE_JPEG2000           0x00000080L //7L
+#define M_LICENSE_BGA                0x00000100L //8L
+#define M_LICENSE_BLOB               0x00000200L //9L
+#define M_LICENSE_CAL                0x00000400L //10L
+#define M_LICENSE_OCR                0x00000800L //11L
+#define M_LICENSE_JPEGSTD            0x00001000L //12L
+#define M_LICENSE_STR                0x00002000L //13L
+#define M_LICENSE_DMR                M_LICENSE_STR
+#define M_LICENSE_MET                0x00004000L //14L
+#define M_LICENSE_COL                0x00008000L //15L
+#define M_LICENSE_3DSUP              0x00010000L //16L
+#define M_LICENSE_CLASS              0x00020000L //17L
+#if OldDefinesSupport
+   #define M_LICENSE_3DMAP           M_LICENSE_3DSUP
+   #define M_LICENSE_3DPR            M_LICENSE_3DMAP
+   MIL_DEPRECATED(M_LICENSE_3DPR, 1000)
+   MIL_DEPRECATED(M_LICENSE_3DMAP, 1050)
+#endif
+#define M_LICENSE_REG                0x00040000L //18L
+#define M_LICENSE_DMILC              0x00200000L //21L
+#define M_LICENSE_INSPECTOR          0x00400000L //22L
+#if OldDefinesSupport
+#define M_LICENSE_INSP40            M_LICENSE_INSPECTOR
+   MIL_DEPRECATED(M_LICENSE_INSP40, 1000)
+#endif
+#define M_LICENSE_SER                0x00800000L //23L
+#define M_LICENSE_INTERFACE          M_LICENSE_SER
+#define M_LICENSE_EDGE               0x01000000L //24L
+#define M_LICENSE_DMIL               0x04000000L //26L
+#define M_LICENSE_3DCA               0x08000000L //27L
+#define M_LICENSE_COM                0x10000000L //28L
+#define M_LICENSE_GPU                0x20000000L //29L
+#define M_LICENSE_DA0                MAKE_INT64(0x0000000100000000) //32L
+#define M_LICENSE_DA1                MAKE_INT64(0x0000000200000000) //33L
+
+#define M_LIC_FINGERPRINT_TYPE(N)                     (M_LICENSE_FINGERPRINT+(N * M_MAX_FINGERPRINTS_PER_TYPE))
+#define M_MORPHISQXT_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(16)
+#define M_NEXIS_FINGERPRINT                           M_LIC_FINGERPRINT_TYPE(17)
+#define M_VIO_FINGERPRINT                             M_LIC_FINGERPRINT_TYPE(18)
+#define M_4SIGHTM_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(19)
+#define M_SOLIOS_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(20)
+#define M_1394_FINGERPRINT                            M_LIC_FINGERPRINT_TYPE(21)
+#define M_CONCORD_1394_FINGERPRINT                    M_1394_FINGERPRINT
+#define M_IRISGTR_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(22)
+#define M_INDIO_FINGERPRINT                           M_LIC_FINGERPRINT_TYPE(23)
+#define M_RAPIXOCXP_FINGERPRINT                       M_LIC_FINGERPRINT_TYPE(24)
+#define M_SUPERSIGHT_ARBOR_FINGERPRINT                M_LIC_FINGERPRINT_TYPE(25)
+#define M_NEXIS3_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(26)
+#define M_CRONOSPLUS_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(27)
+#define M_RAPIXOCL_FINGERPRINT                        M_LIC_FINGERPRINT_TYPE(28)
+#define M_MORPHIS_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(29)
+#define M_IRIS_FINGERPRINT                            M_LIC_FINGERPRINT_TYPE(30)
+#define M_ORIONHD_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(32)
+#define M_CONCORD_GIGE_FINGERPRINT                    M_LIC_FINGERPRINT_TYPE(33)
+#define M_RADIENTEVCL_FINGERPRINT                     M_LIC_FINGERPRINT_TYPE(34)
+#define M_4SIGHTX_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(35)
+#define M_4SIGHTGPM_FINGERPRINT                       M_LIC_FINGERPRINT_TYPE(36)
+#define M_IRISGT_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(37)
+#define M_RADIENT_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(38)
+#define M_SUPERSIGHT_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(39)
+#define M_NEXIS2_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(40)
+#define M_RADIENTPRO_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(41)
+#define M_RADIENTCXP_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(42)
+#define M_RADIENTCLHS_FINGERPRINT                     M_LIC_FINGERPRINT_TYPE(43)
+#define M_4SIGHTGP_FINGERPRINT                        M_LIC_FINGERPRINT_TYPE(44)
+#define M_USB3_FINGERPRINT                            M_LIC_FINGERPRINT_TYPE(45)
+#define M_CONCORDPOE_FINGERPRINT                      M_LIC_FINGERPRINT_TYPE(46)
+#define M_CUSTOM_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(49)
+#define M_MSERIES_FINGERPRINT                         M_LIC_FINGERPRINT_TYPE(53)
+#define M_ID_KEY_FINGERPRINT                          M_LIC_FINGERPRINT_TYPE(55)
+#define M_MATROX_BOARD_FINGERPRINT                    M_LIC_FINGERPRINT_TYPE(62)
+#define M_ANY_FINGERPRINT                             M_MATROX_BOARD_FINGERPRINT
+
+/************************************************************************/
+/* MWrite() / MpatRead() Types                                          */
+/************************************************************************/
+#define M_FILE                                        25L
+
+#define M_DRAW_DONT_CARE                              0x00000008L   // Also define in MilPat.h and MilMod.h
+#if OldDefinesSupport
+   #define M_DRAW_DONT_CARES                          M_DRAW_DONT_CARE 
+   MIL_DEPRECATED(M_DRAW_DONT_CARES, 1010)
+#endif
+
+/************************************************************************/
+/* MmodControl() / MedgeControl() / MmetControl ControlTypes            */
+/************************************************************************/
+#if OldDefinesSupport
+   #define M_KERNEL_DEPTH                    368L 
+   #define M_KERNEL_WIDTH                    109L 
+   MIL_DEPRECATED(M_KERNEL_DEPTH, 1010)
+   MIL_DEPRECATED(M_KERNEL_WIDTH, 1010)
+#endif
+
+/************************************************************************/
+/* MappInquire() / MappControl() Values                                 */
+/************************************************************************/
+#define M_PARAMETER_CHECK                    0x00000001L
+#define M_PRINT_DISABLE                               0L
+#define M_PRINT_ENABLE                                1L
+#define M_CHECK_DISABLE                               2L
+#define M_CHECK_ENABLE                                3L
+#define M_COMPENSATION_DISABLE                        4L
+#define M_COMPENSATION_ENABLE                         5L
+#define M_HOOK_CONTEXT_SIZE                           6L
+#define M_ENABLE_FOR_ALL_FUNCTIONS                    7L
+#define M_DISABLE_FOR_ALL_FUNCTIONS                   8L
+#define M_DISP_HOOK_CONTEXT_SIZE                     10L
+#define M_THROW_EXCEPTION                            11L          /* Value to enable exceptions in the MIL .NET wrapper (.NET only)  */
+#define M_COMPONENT_RESELECT_DISABLE                 12L
+#define M_COMPONENT_RESELECT_ENABLE                  13L
+#define M_DMIL_CONTROL                                1L
+#define M_DMIL_MONITOR                                2L
+#define M_MIL_SETUP                                   2L
+
+#define M_INTERNAL_USE                       0x00000004L
+#define M_READ_WRITE                         0x00000010L
+#define M_READ_ONLY                          0x00000020L
+
+                                                                  /* Bit field exclusive to M_TRACE  to M_PROCESSING      (3L to 6L) */
+#define M_THREAD_CURRENT                              0x01000000L /*                        M_TRACE_START                       (1L) */
+                                                                  /*                        M_TRACE_END                         (2L) */
+                                                                  /*                        M_ERROR                     (0x40000000) */
+                                                                  /*                        M_MESSAGE                   (0x20000000) */
+                                                                  /*                        M_CURRENT to M_REGION_SIZE_Y (1L to 44L) */
+                                                                  /*                        M_UNHOOK                    (0x04000000) */
+
+// Possible value for the M_PANEL control
+#define M_ENABLE                                      -9997L
+#define M_DISABLE                                     -9999L
+#define M_UPDATE_PANEL                                   1L
+#define M_CLOSE_FROM_DLL                                 64L
+
+// Values returned by MappInquire(M_DMA_MANAGER_TYPE)
+#define DMA_MANAGER_TYPE_MTXDMA                                1
+#define DMA_MANAGER_TYPE_MEMMAN                                2
+#define DMA_MANAGER_TYPE_SERVMAN                               4
+
+// values returned by MappInquire/MsysInquire(M_PLATFORM_OS_TYPE)
+#define M_OS_WINDOWS                                           1
+#define M_OS_WINDOWS_CE                                        2
+#define M_OS_LINUX                                             3
+#define M_OS_RTX                                               5
+
+// M_TRACE value.
+#define M_LOG_DISABLE                                 M_PRINT_DISABLE
+#define M_LOG_ENABLE                                  M_PRINT_ENABLE
+#define M_TRACER_BIN_FILE                             0x00000002
+#define M_TRACER_TXT_FILE                             0x00000004
+#define M_TRACER_CONSOLE                              0x00000008
+#define M_TRACER_MEM                                  0x00000040
+
+
+
+#define M_BEEP_DEF(FREQ, DURATION)                    ((MIL_INT)((((FREQ) & 0xFFFF) << 16) | ((DURATION) & 0xFFFF)))
+#define M_EXTRACT_BEEP_FREQ(CODE)                     (MIL_UINT32)(((CODE) >> 16) & 0xFFFF)
+#define M_EXTRACT_BEEP_DURATION(CODE)                 (MIL_UINT32)((CODE) & 0xFFFF)
+
+
+/************************************************************************/
+/* MappInquireConnection()                                              */
+/************************************************************************/
+#define M_DMIL_PUBLISHED_LIST                   1
+#define M_DMIL_PUBLISHED_LIST_SIZE              2
+
+#define M_DMIL_PUBLISHED_NAME                   (3 | M_CLIENT_ENCODING)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_PUBLISHED_NAME                    (6 | M_CLIENT_ENCODING)
+#define M_OLD_WEB_PUBLISHED_LIST                    4
+#define M_OLD_WEB_PUBLISHED_LIST_SIZE               5
+#endif
+#define M_WEB_PUBLISHED_NAME                       (7 | M_CLIENT_ENCODING)
+// Reserve User M_WEB_PUBLISHED_NAME +1            (8 | M_CLIENT_ENCODING)
+// Reserve User M_WEB_PUBLISHED_NAME +2            (9 | M_CLIENT_ENCODING)
+// Reserve FB   M_WEB_PUBLISHED_NAME +3            (10 | M_CLIENT_ENCODING)
+// Reserve DA   M_WEB_PUBLISHED_NAME +4            (11 | M_CLIENT_ENCODING)
+#define M_WEB_PUBLISHED_LIST                       12
+// Reserve User M_WEB_PUBLISHED_LIST + 1           13
+// Reserve User M_WEB_PUBLISHED_LIST + 2           14
+// Reserve FB   M_WEB_PUBLISHED_LIST + 3           15
+// Reserve DA   M_WEB_PUBLISHED_LIST + 4           16
+#define M_WEB_PUBLISHED_LIST_SIZE                  17
+// Reserve User M_WEB_PUBLISHED_LIST_SIZE + 1      18
+// Reserve User M_WEB_PUBLISHED_LIST_SIZE + 2      19
+// Reserve FB   M_WEB_PUBLISHED_LIST_SIZE + 3      20
+// Reserve DA   M_WEB_PUBLISHED_LIST_SIZE + 4      21
+
+/************************************************************************/
+/* MappTimer()                                                          */
+/************************************************************************/
+#define M_TIMER_MODE_MASK                             0x000F0000L
+#define M_FIRST_TIMER_MODE                            0x00010000L
+#define M_TIMER_RESOLUTION                            0x00010000L
+#define M_TIMER_RESET                                 0x00020000L
+#define M_TIMER_READ                                  0x00030000L
+#define M_TIMER_WAIT                                  0x00040000L
+#define M_TIMER_COMPENSATION                          0x00050000L
+#define M_TIMER_WAIT_EXACT                            0x00060000L
+#define M_TIMER_LOCK_TO_CPU                           0x00070000L
+#define M_TIMER_UNLOCK_FROM_CPU                       0x00080000L
+#define M_TIMER_USE_CPU                               0x00090000L
+#define M_TIMER_USE_OS                                0x000A0000L
+#define M_LAST_TIMER_MODE                             M_TIMER_USE_OS // Update this define if other modes are added.
+
+// Following defines are bitwise
+#define M_SYNCHRONOUS                                 0x00000001L
+
+#define M_GLOBAL                                      0x00000008L
+#define M_TRACE                                       0x00004100L  // Also used in M_APP_INQUIRE_SYS range.
+#define M_TIMER_FLAG_MASK                             (M_TRACE|M_GLOBAL)
+
+
+// Utility macro
+#define M_TIMER_MODE_IS_VALID(m)                      ( ((m&(~M_TIMER_MODE_MASK)) == 0) &&                  \
+                                                        ((m&M_TIMER_MODE_MASK) >= M_FIRST_TIMER_MODE) &&    \
+                                                        ((m&M_TIMER_MODE_MASK) <= M_LAST_TIMER_MODE) )
+
+/************************************************************************/
+/* MappFileOperation()                                                  */
+/************************************************************************/
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_FILE_EXECUTE                                      (0x100 + M_SYNCHRONOUS)
+#else
+#define M_FILE_EXECUTE                                      0x100
+#endif
+#define M_FILE_DELETE                                       0x200
+#define M_FILE_COPY                                         0x300
+#define M_FILE_COPY_MIL_DLL                                 0x400
+#define M_FILE_MAKE_DIR                                     0x500
+#define M_FILE_DELETE_DIR                                   0x600
+#define M_FILE_DISPATCH                                     0x700
+#define M_FILE_EXISTS                                       0x800
+#define M_FILE_EXISTS_MIL_DLL                               0x900
+#define M_FILE_COPY_MIL_USER_DLL                            0xA00
+#define M_FILE_EXISTS_MIL_USER_DLL                          0xB00
+#define M_FILE_MOVE                                         0xC00
+#define M_FILE_NAME_FIND_COUNT                              0xD00
+#define M_FILE_NAME_FIND                                    (0xE00 + M_CLIENT_ENCODING)
+#define M_SYNCHRONOUS                                 0x00000001L
+#define M_ASYNCHRONOUS                                0x00000002L
+
+/************************************************************************/
+/* Binary functions in BLOB module.                                     */
+/************************************************************************/
+#define M_LENGTH                                      0x00002000L
+
+/************************************************************************/
+/* MmeasCalculate(), MmeasGetResult(), MpatGetResult() */
+/************************************************************************/
+#define M_ANGLE                                       0x00000800L
+#define M_ORIENTATION                                 0x00002400L
+#if OldDefinesSupport
+   #define M_ALL_OLD                                           0L 
+   MIL_DEPRECATED(M_ALL_OLD, 1010)
+#endif
+
+/************************************************************************/
+/* MblobControl() and/or MblobInquire() values and MmeasControl()       */
+/************************************************************************/
+#define M_PIXEL_ASPECT_RATIO                          5L
+
+/************************************************************************/
+/* McolDistance()                                                       */
+/************************************************************************/
+#define M_MAHALANOBIS_SAMPLE                       5L          // value for M_DISTANCE_TYPE
+#define M_MAHALANOBIS                              M_MAHALANOBIS_SAMPLE
+
+/***********************************************************************/
+/* MfuncParam... defines                                               */
+/***********************************************************************/
+#define M_FILE_READ                                   M_IN
+#define M_FILE_WRITE                                  M_OUT
+#define M_FPGA_FUNC_MAX_NB_PARAM                      M_NB_MAX_PARAMETER
+
+/***********************************************************************/
+/* MfuncDriverCall... defines                                          */
+/***********************************************************************/
+#define M_DONT_CONVERT_ID                             1L
+
+/************************************************************************/
+/* MfuncPrintMessage() defines                                          */
+/************************************************************************/
+// Return Value
+#define M_RESP_YES                                    1L
+#define M_RESP_NO                                     2L
+#define M_RESP_CANCEL                                 4L
+#define M_RESP_OK                                     8L
+
+// Mode
+#define M_RESP_OK                                     8L
+#define M_RESP_YES_NO                                 (M_RESP_YES|M_RESP_NO)
+#define M_RESP_YES_NO_CANCEL                          (M_RESP_YES|M_RESP_NO|M_RESP_CANCEL)
+#define M_RESP_BUTTONS_MASK                         0xFL
+// Additional Mode
+#define M_ICON_STOP                          0x00000010L
+#define M_ICON_EXCLAMATION                   0x00000030L
+#define M_ICON_MASK                          0x000000F0L
+#define M_ERROR_TITLE                        0x00000100L
+#define M_ST_ERROR_TITLE                     0x00000200L
+
+/************************************************************************/
+/* MfuncCalibrationInfo() defines                                       */
+/************************************************************************/
+
+
+#define M_CALIBRATION_STREAM_SIZE            0L    // already defined in mcalinfo.h
+#define M_GET_CALIBRATION_INFO               1L    // already defined in mcalinfo.h
+#define M_SET_CALIBRATION_INFO               2L    // already defined in mcalinfo.h
+#define M_COPY_CALIBRATION_INFO              3L    // already defined in mcalinfo.h
+#define M_GET_CALIBRATION_ID                 4L    // already defined in mcalinfo.h
+#define M_SET_CALIBRATION_ID                 5L    // already defined in mcalinfo.h
+#define M_CHANGE_ID_IN_CAL_STREAM            6L    // already defined in mcalinfo.h
+
+#define M_ADD_CALIBRATION_USE                17L   // already defined in mcalinfo.h
+#define M_REMOVE_CALIBRATION_USE             18L   // already defined in mcalinfo.h
+#define M_USE_CALIBRATION                    19L   // already defined in mcalinfo.h
+// other defines in mcalinfo.h
+
+#define M_WORLD                         0x2000L
+#if OldDefinesSupport
+   #define M_OUTPUT_COORDINATE_SYSTEM         M_OUTPUT_UNITS
+   MIL_DEPRECATED(M_OUTPUT_COORDINATE_SYSTEM, 1010)
+   #define M_OUTPUT_UNITS                     122L // deprecated: use M_RESULT_OUTPUT_UNITS
+   MIL_DEPRECATED(M_OUTPUT_UNITS, 1060)
+#endif
+#define M_SAVE                           0x100L
+#define M_ACCORDING_TO_CALIBRATION        1301L
+
+/************************************************************************/
+/* MfuncAlloc/MfuncAllocScript defines                                  */
+/************************************************************************/
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_USER_FUNCTION                     0x4000E000
+#define M_USER_MODULE_1                     0x4000E200
+#define M_USER_MODULE_2                     0x4000E400
+#define M_USER_MODULE_3                     0x4000E600
+#define M_USER_MODULE_4                     0x4000E800
+#define M_USER_MODULE_5                     0x4000EA00
+#define M_USER_MODULE_6                     0x4000EC00
+#define M_USER_MODULE_7                     0x4000EE00
+#define M_SCRIPT_FUNCTION                   0x4000F000
+#define M_SCRIPT_MODULE_1                   0x4000F200
+#define M_SCRIPT_MODULE_2                   0x4000F400
+#define M_USER_MODULE_FPGA                  0x4000FC00
+#else
+#define M_USER_FUNCTION                     0x40007000
+#define M_USER_MODULE_1                     0x40007100
+#define M_USER_MODULE_2                     0x40007200
+#define M_USER_MODULE_3                     0x40007300
+#define M_USER_MODULE_4                     0x40007400
+#define M_USER_MODULE_5                     0x40007500
+#define M_USER_MODULE_6                     0x40007600
+#define M_USER_MODULE_7                     0x40007700
+#define M_SCRIPT_FUNCTION                   0x40007800
+#define M_SCRIPT_MODULE_1                   0x40007900
+#define M_SCRIPT_MODULE_2                   0x40007A00
+#define M_USER_MODULE_FPGA                  0x40007E00
+#endif
+#define M_USER_FPGA_FUNCTION                M_USER_MODULE_FPGA
+
+// InitFlag values
+#define M_ALLOC                             0x00010000   // Update opcodes.h accordingly
+#define M_FREE                              0x00020000   // Update opcodes.h accordingly
+#define M_SYNCHRONOUS_FUNCTION              0x00080000   // Update opcodes.h accordingly
+#define M_ASYNCHRONOUS_FUNCTION             0x00000000
+#define M_LOCAL                             0x01000000   // Update opcodes.h accordingly
+#define M_REMOTE                            0x00000000
+#define M_REGISTER_FUNCTION                 MAKE_INT64(0x100000000)
+
+// Reserved: 0x00000001
+#define M_DONT_ADD_ALWAYS_LOCAL             0x00000040L  // Update decstatus.h accordingly
+#if MIL_COMPILE_VERSION < 1010
+#define M_INTERNAL_CALL                     0x00000004L  // Update decstatus.h accordingly
+#else
+#define M_INTERNAL_CALL                     0x00000100L  // Update decstatus.h accordingly
+#endif
+#define M_NON_PORTABLE_CALL                 0x00000008L  // Update decstatus.h accordingly
+#if MIL_COMPILE_VERSION < 1010
+#define M_STATUS_MASK                       0x0000004CL
+#else
+#define M_STATUS_MASK                       0x00000148L
+#endif
+#define M_STACK_BASED_FUNCTION              0x02000000L
+
+#define M_NB_MAX_PARAMETER                  16L
+#define M_NUMBER_OF_USER_MODULES            16L
+
+#define M_NON_PAGED                         0x00200000L
+#define M_PAGED                             0x02000000L
+#define M_DEFAULT                           0x10000000L
+
+/************************************************************************/
+/* MfuncAllocScript defines                                             */
+/************************************************************************/
+
+#define M_INTERPRETER_CSHARP              MIL_TEXT("MilInterpCSharp.dll")
+#define M_INTERPRETER_VB_DOT_NET          MIL_TEXT("MilInterpVBNet.dll")
+#define M_INTERPRETER_C_PYTHON38          MIL_TEXT("MilInterpPython38.dll")
+#define M_INTERPRETER_C_PYTHON37          MIL_TEXT("MilInterpPython37.dll")
+#define M_INTERPRETER_C_PYTHON36          MIL_TEXT("MilInterpPython36.dll")
+#define M_INTERPRETER_C_PYTHON27          MIL_TEXT("MilInterpPython27.dll")
+#define M_INTERPRETER_CUSTOM(dllpath)     dllpath
+
+/************************************************************************/
+/* Custom Scripting Interpreter defines                                 */
+/************************************************************************/
+
+
+/************************************************************************/
+/* MfuncControl/MfuncInquire() defines                                  */
+/************************************************************************/
+#define M_USER_DATA_PTR            0x00000001
+#define M_DRIVER_INFO_PTR                   2
+#if MIL_COMPILE_VERSION < 1010
+#else
+#endif
+
+
+#define M_OBJECT_PTR                       10
+#define M_SLAVE_FUNCTION_PTR               13
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#endif
+#define M_SLAVE_FUNCTION_OPCODE            18
+#define M_PARAM_NUMBER                     20
+#define M_OBJECT_LOCK                      22
+#define M_DRIVER_HOOK_CONTEXT_ID           25
+#define M_OBJECT_TYPE_EXTENDED             29
+#define M_IS_NOT_INTERNAL_OBJECT           31
+#define M_ACTIVE_ERROR                     32
+#define M_TRACE_LEVEL                      34
+#define M_MIL_DLL_IN_DEBUG_MODE            38
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#define M_IS_CLIENT_UNICODE                41
+#endif
+/***********************************************************************
+ * FuncInquire string types
+ ***********************************************************************/
+#define M_FUNC_INQUIRE_STRING_START                   47
+
+#define M_OBJECT_NAME                           ((M_FUNC_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING)
+#define M_FUNCTION_NAME_FROM_OPCODE             ((M_FUNC_INQUIRE_STRING_START+1)|M_CLIENT_ENCODING)
+#define M_FUNCTION_NAME                         ((M_FUNC_INQUIRE_STRING_START+2)|M_CLIENT_ENCODING)
+#define M_SLAVE_DLL_NAME                        ((M_FUNC_INQUIRE_STRING_START+3)|M_CLIENT_ENCODING)
+#define M_SLAVE_FUNCTION_NAME                   ((M_FUNC_INQUIRE_STRING_START+4)|M_CLIENT_ENCODING)
+#define M_SCRIPT_FUNCTION_NAME                  ((M_FUNC_INQUIRE_STRING_START+5)|M_CLIENT_ENCODING)
+#define M_INTERPRETER_PATH                      M_SLAVE_DLL_NAME
+#define M_SCRIPT_PATH                           ((M_FUNC_INQUIRE_STRING_START+6)|M_CLIENT_ENCODING)
+#define M_DEBUG_INFORMATION_PATH                ((M_FUNC_INQUIRE_STRING_START+7)|M_CLIENT_ENCODING)
+#define M_ADD_SCRIPT_REFERENCE                  ((M_FUNC_INQUIRE_STRING_START+8)|M_CLIENT_ENCODING)
+/* Reserve next values  from                    ((M_FUNC_INQUIRE_STRING_START+9)|M_CLIENT_ENCODING)
+                        to                      ((M_FUNC_INQUIRE_STRING_START+58)|M_CLIENT_ENCODING)*/
+
+
+#if OldDefinesSupport
+   #define M_OBJECT_NAME_SIZE                         (M_STRING_SIZE + M_OBJECT_NAME)
+   #define M_FUNCTION_NAME_FROM_OPCODE_SIZE           (M_STRING_SIZE + M_FUNCTION_NAME_FROM_OPCODE)
+   #define M_FUNCTION_NAME_SIZE                       (M_STRING_SIZE + M_FUNCTION_NAME)
+   #define M_SLAVE_DLL_NAME_SIZE                      (M_STRING_SIZE + M_SLAVE_DLL_NAME)
+   #define M_SLAVE_FUNCTION_NAME_SIZE                 (M_STRING_SIZE + M_SLAVE_FUNCTION_NAME)
+   #define M_SCRIPT_FUNCTION_NAME_SIZE                (M_STRING_SIZE + M_SCRIPT_FUNCTION_NAME)
+   #define M_INTERPRETER_PATH_SIZE                    M_SLAVE_DLL_NAME_SIZE
+   #define M_SCRIPT_PATH_SIZE                         (M_STRING_SIZE + M_SCRIPT_PATH)
+   #define M_DEBUG_INFORMATION_PATH_SIZE              (M_STRING_SIZE + M_DEBUG_INFORMATION_PATH)
+
+MIL_DEPRECATED(M_OBJECT_NAME_SIZE              , 1040)
+MIL_DEPRECATED(M_FUNCTION_NAME_FROM_OPCODE_SIZE, 1040)
+MIL_DEPRECATED(M_FUNCTION_NAME_SIZE            , 1040)
+MIL_DEPRECATED(M_SLAVE_DLL_NAME_SIZE           , 1040)
+MIL_DEPRECATED(M_SLAVE_FUNCTION_NAME_SIZE      , 1040)
+MIL_DEPRECATED(M_SCRIPT_FUNCTION_NAME_SIZE     , 1040)
+MIL_DEPRECATED(M_SCRIPT_PATH_SIZE              , 1040)
+MIL_DEPRECATED(M_DEBUG_INFORMATION_PATH_SIZE   , 1040)
+
+#endif
+
+#define M_FUNC_INQUIRE_STRING_END                     (M_FUNC_INQUIRE_STRING_START+58)
+
+#if OldDefinesSupport
+#define M_BEAD_GETNEIGHBORS                           0x0000A80E // use M_BEAD_GET_NEIGHBORS instead
+MIL_DEPRECATED(M_BEAD_GETNEIGHBORS, 1010)
+
+#define M_ASSOCIATED_NAME                   M_OBJECT_NAME
+MIL_DEPRECATED(M_ASSOCIATED_NAME, 1060)
+
+#define M_ASSOCIATED_NAME_SIZE                   M_OBJECT_NAME_SIZE
+
+#endif
+
+#define M_SYSTEM_CODE                      107
+
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#endif
+#define M_MIL_NET_INFO_PTR                 133
+#define M_OBJECT_TYPE                      136
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#define M_OBJECT_TYPE_OLD                  162
+#endif
+#define M_CALLER_BITNESS                   165
+// some free space for future values
+// reserve 168-187 for  M_ALLOCATE_OUTPUT_POINTER +1 ... +16 and a little extra space
+// put a little free space here
+// reserve next 20 for +1 to +16 and extra space
+// next one should be 210
+#define M_CALLER_WORKSPACE                 210
+
+
+#if MIL_COMPILE_VERSION >= 1010
+#endif
+
+// reserve next 20 for +1 to +16 and extra space
+// next one should be 244
+#define M_WEB_PUBLISH                      244
+// Reserve User M_WEB_PUBLISH + 1          245
+// Reserve User M_WEB_PUBLISH + 2          246
+// Reserve FB   M_WEB_PUBLISH + 3          247
+// Reserve DA   M_WEB_PUBLISH + 4          248
+
+//Free space here                          249 to 249
+
+//For Scripting
+#define M_COMPILE                          250
+#define M_DEBUG_INFORMATION                251
+#define M_NUMBER_OF_SCRIPT_REFERENCES      252
+
+//Scripting Specific Error
+#define M_SCRIPT_ERROR_NO_FILE_ACCESS     M_SCRIPT_ERROR_START + 1
+#define M_SCRIPT_ERROR_COMPILATION_ERROR  M_SCRIPT_ERROR_START + 2
+#define M_SCRIPT_ERROR_OTHER              M_SCRIPT_ERROR_START + 3
+#define M_SCRIPT_ERROR_FUNCTION_NOT_FOUND M_SCRIPT_ERROR_START + 4
+#define M_SCRIPT_ERROR_INCORRECT_PROTO    M_SCRIPT_ERROR_START + 5
+#define M_SCRIPT_ERROR_CLASS_MISSING      M_SCRIPT_ERROR_START + 6
+#define M_SCRIPT_ERROR_INVALID_CONTROL    M_SCRIPT_ERROR_START + 7
+#define M_SCRIPT_ERROR_WRAPPER_NOT_FOUND  M_SCRIPT_ERROR_START + 8
+#define M_SCRIPT_ERROR_REF_NOT_FOUND      M_SCRIPT_ERROR_START + 9
+#define M_SCRIPT_ERROR_PYTHON_ERROR       M_SCRIPT_ERROR_START + 10
+
+#define M_FREE_CUR_APPLICATION             317
+#define M_ID_IS_ON_LOCAL_CLUSTER           318
+
+//Values 512 to 768 reserved for references
+#define M_NB_MAX_SCRIPT_REFERENCE                256
+#define M_SCRIPT_REFERENCE_START                 512L
+#define M_SCRIPT_REFERENCE_END                   M_SCRIPT_REFERENCE_START + M_NB_MAX_SCRIPT_REFERENCE
+
+#define M_SCRIPT_REFERENCE                   (M_SCRIPT_REFERENCE_START|M_CLIENT_ENCODING)
+#if OldDefinesSupport
+#define M_SCRIPT_REFERENCE_SIZE                 (M_STRING_SIZE + M_SCRIPT_REFERENCE)
+MIL_DEPRECATED(M_SCRIPT_REFERENCE_SIZE, 1040)
+#endif
+
+#define M_OBJECT_VALID                   1038L
+#define M_IS_INTERNALLY_ALLOCATED        1043L 
+#define M_LOCATION                       1048L
+
+
+
+#define M_BUFFER_INFO                     5280L
+
+
+#define M_IS_A_LICENSE_SERVER_CMD(X)  ((((X&~M_STRING_SIZE)>=M_LICENSE_SERVER_CMD_START) && ((X&~M_STRING_SIZE)<M_LICENSE_SERVER_CMD_END)) ||\
+
+//operation
+//Information
+
+
+
+
+
+
+#define M_EXTENDED_PARAM_TYPE      0x10000000L
+/* Reserve next 16 (M_NB_MAX_PARAMETER) values   from   0x10000001L*/
+/*                                               to     0x10000010L*/
+#define M_PARAM_ATTRIBUTES         0x04000000L
+/* Reserve next 16 (M_NB_MAX_PARAMETER) values   from   0x04000001L*/
+/*                                               to     0x04000010L*/
+#define M_PARAM_TYPE_INFO         (0x02000000L | M_CLIENT_ENCODING)
+/* Reserve next 16 (M_NB_MAX_PARAMETER) values   from   0x02000001L*/
+/*                                               to     0x02000010L*/
+#define M_PARAM_SIZE               0x01000000L
+/* Reserve next 16 (M_NB_MAX_PARAMETER) values   from   0x01000001L*/
+/*                                               to     0x01000010L*/
+
+#define M_TRACE_HOOKS                                 (M_APP_INQUIRE_SYS_START+2L)  //15002L
+
+
+
+/* Return Value */
+#define M_NOT_ENOUGH_MEMORY   4L // already defined in mil3dmap.h
+
+/* Scripting related values */
+#define M_AUTO                444L    //already defined in mil.h, ...
+#define M_YES                 1L      //already defined in milmeas.h
+#define M_NO                  0L      //already defined in mil.h
+#define M_ONCE                3L      //already defined in mil.h
+#define M_MODIFIED            4096L   //already defined in mil.h
+
+#if MIL_COMPILE_VERSION >= 1010
+#endif
+
+/************************************************************************/
+/* MappInquireObject()/MappControlObject() defines                      */
+/************************************************************************/
+#define M_DMIL_PUBLISH                                12L
+#define M_OBJECT_TYPE_EXTENDED                        29
+
+#define M_APP_INQUIRE_OBJ_STRING_START                M_FUNC_INQUIRE_STRING_START // 47
+
+#define M_OBJECT_NAME                            ((M_FUNC_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING) //47
+#define M_OBJECT_FILE_PATH                       ((M_FUNC_INQUIRE_STRING_START+1)|M_CLIENT_ENCODING) //48
+#define M_OBJECT_FILENAME M_OBJECT_FILE_PATH
+#define M_OBJECT_FILE_NAME_NO_EXTENSION          ((M_FUNC_INQUIRE_STRING_START+4)|M_CLIENT_ENCODING) //51
+#define M_OBJECT_FILE_EXTENSION                  ((M_FUNC_INQUIRE_STRING_START+5)|M_CLIENT_ENCODING) //52
+#define M_OBJECT_FILE_FOLDER                     ((M_FUNC_INQUIRE_STRING_START+6)|M_CLIENT_ENCODING) //53
+#define M_OBJECT_FILE_NAME                       ((M_FUNC_INQUIRE_STRING_START+7)|M_CLIENT_ENCODING) //54
+
+#define M_APP_INQUIRE_OBJ_STRING_END                  M_FUNC_INQUIRE_STRING_END
+
+#define M_OBJECT_TYPE                                 136
+
+
+#define M_APP_INQUIRE_OBJ_DOUBLE_RANGE_START    10000
+#define M_APP_INQUIRE_OBJ_DOUBLE_RANGE_END      20000
+
+#define M_APP_INQUIRE_OBJ_INT64_RANGE_START    20001
+#define M_APP_INQUIRE_OBJ_INT64_RANGE_END      21000
+
+
+/************************************************************************/
+/* MilGPU                                                               */
+/************************************************************************/
+  /* Vertex processing type */
+#define M_SOFTWARE                                    0x010000L
+#define M_HARDWARE                                    0x020000L
+#define M_MIXED_VERTEXPROCESSING                      0x040000L
+
+  /* GPU specific errors */
+#define M_GPU_ERROR_START                             0x710
+#define M_GPU_ERROR_DIRECTX_NOTSUPPORTED              (M_GPU_ERROR_START+1)
+#define M_GPU_ERROR_INVALID_DECODER                   (M_GPU_ERROR_START+2)
+#define M_GPU_ERROR_D3D9_NOTLOADED                    (M_GPU_ERROR_START+3)
+#define M_GPU_ERROR_D3D10_NOTLOADED                   (M_GPU_ERROR_START+4)
+#define M_GPU_ERROR_D3D11_NOTLOADED                   (M_GPU_ERROR_START+5)
+#define M_GPU_ERROR_WINDOWS_SERVICE                   (M_GPU_ERROR_START+6)
+/* Reserve next 3 values                       from   (M_GPU_ERROR_START+7)*/
+/*                                             to     (M_GPU_ERROR_START+9)*/
+#define M_GPU_ERROR_END                               (M_GPU_ERROR_START+10)
+
+#define M_IS_GPU_SPECIFIC_ERROR(x)                    ((x > M_GPU_ERROR_START) && (x < M_GPU_ERROR_END))
+#define M_GPU_ERROR_GET_CODE(x)                       (x >> 4)
+#define M_GPU_ERROR_GET_SUBMSG(x)                     (x - M_GPU_ERROR_START)
+
+//Hook types
+#define M_SUB_OBJECT_LIST_MODIFIED                    M_OBJ_HOOK_RANGE_START+1L
+#define M_OBJECT_PROPERTIES_MODIFIED                  M_OBJ_HOOK_RANGE_START+2L
+#define M_OBJECT_RESULTS_MODIFIED                     M_OBJ_HOOK_RANGE_START+3L
+#define M_MASK_MODIFIED                               M_OBJ_HOOK_RANGE_START+4L
+#define M_MESSAGE_RECEIVED                            M_OBJ_HOOK_RANGE_START+5L
+#define M_READ_TIMEOUT                                M_OBJ_HOOK_RANGE_START+6L
+#define M_UPDATE_START                                M_OBJ_HOOK_RANGE_START+7L
+#define M_UPDATE_END                                  M_OBJ_HOOK_RANGE_START+8L
+#define M_COMPONENT_REMOVE                            M_OBJ_HOOK_RANGE_START+10L
+#define M_WRITE_TIMEOUT                               M_OBJ_HOOK_RANGE_START+11L
+#define M_CALIBRATION_STATUS_MODIFIED                 M_OBJ_HOOK_RANGE_START+12L
+#define M_MESSAGE_READ_ASYNC                          M_OBJ_HOOK_RANGE_START+13L
+
+
+//Operations
+#define M_CLEAR                              0x00000001L
+#define M_NEW_RESULTS                                 2L
+#define M_DELETE                                      3L
+#define M_ALL_PROPERTIES                              4L
+#define M_INSERT                                      5L
+#define M_MODIFIED                                 4096L
+#define M_NEW_LIST                                 2147L
+#define M_APPEND                             0x20000000L
+
+#define M_METHOD                                     103L
+#define M_OPERATION                               M_METHOD
+#define M_INDEX                                      217L
+#define M_TARGET_ID                                  218L
+#define M_TYPE                                      1008L
+#define M_WEB_CLIENT_INDEX                           219L
+#define M_WEB_CLIENT_TYPE                            220L
+#define M_CALIBRATION_ID                               4L
+#define M_SUB_INDEX_1                                2488
+#define M_SUB_INDEX_2                                2489
+#define M_CALIBRATION_STATUS                         159L  /* (also defined in milcal.h) */
+
+// MIL Web application Type
+#define M_WEB_APPLICATION                              1L
+#define M_STANDALONE_APPLICATION                       2L
+
+/************************************************************************/
+/* MobjControl()/MobjInquire() defines                                  */
+/************************************************************************/
+/*Free for reuse                                       1L*/
+#define M_INIT_HOOK_CONTEXT                            2L
+#define M_COPY_CALIBRATION_INFO                        3L   // already defined in mcalinfo.h
+#define M_CALIBRATION_ID                               4L
+#define M_CORRECTED_SCALES                             5L
+#define M_CALIBRATION_TRANSLATIONS                     6L
+#define M_COMPARE_CALIBRATION_INFO                     7L   // already defined in mcalinfo.h
+#define M_COMPARE_CALIBRATION_INFO_NO_OFFSET           8L   // already defined in mcalinfo.h
+#define M_REAL_OWNER_SYSTEM                            9L
+#define M_COPY_DISP_HOOK_CONTEXT                      10L
+#define M_CAL_PARENT_OFFSETS                          11L
+#define M_DMIL_PUBLISH                                12L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_PUBLISH                             14L
+#endif
+#define M_MESSAGE_COUNT                               15L
+#define M_MESSAGE_LENGTH                              16L
+#define M_COMPONENT_COUNT                             17L
+#define M_GROUP_ID                                    18L
+#define M_QUEUE_SIZE                                  19L
+#define M_QUEUE_FULL_MODE                             20L
+#define M_COMPENSATED_REAL_ID                         22L
+#define M_HOOK_PARAM                                  30L
+// reserve 10 entries                                 39L
+#define M_HOOK_TYPE                                   50L
+#define M_ASSOCIATED_CALIBRATION                     125L   // already defined in milcal.h
+#define M_COPY_HOOK_CONTEXT                          103L
+#define M_COPY_NEIGHBORHOOD_INFO                     104L
+#define M_NEIGHBORHOOD_INFO_SIZE                     105L
+#define M_COPY_HISTOGRAM_INFO                        106L
+#define M_HTTP_PORT                                  107L
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION
+#define M_HTTP_ROOT_DIRECTORY                        (108L|M_CLIENT_ENCODING)
+#define M_HTTP_ADDRESS                               (109L|M_CLIENT_ENCODING)
+#else
+#define M_HTTP_ROOT_DIRECTORY                        108L
+#define M_HTTP_ADDRESS                               109L
+#endif
+#define M_HTTP_START                                 110L
+#define M_HTTP_STOP                                  112L
+#define M_HTTP_MODE                                  113L
+#define M_HTTP_STATE                                 114L
+#define M_WEB_PUBLISH_MODE                           115L
+// Reserve User M_WEB_PUBLISH_MODE + 1               116L
+// Reserve User M_WEB_PUBLISH_MODE + 2               117L
+// Reserve FB   M_WEB_PUBLISH_MODE + 3               118L
+// Reserve DA   M_WEB_PUBLISH_MODE + 4               119L
+
+#define M_OBJECT_USER_DATA_PTR                       150L
+#define M_EMPTY                                      236L   // already defined in milmod.h
+
+// Http Server Mode
+#if OldDefinesSupport
+#define M_HTTP_ADDRESS_SIZE                          (M_STRING_SIZE + M_HTTP_ADDRESS)
+#define M_HTTP_ROOT_DIRECTORY_SIZE                   (M_STRING_SIZE + M_HTTP_ROOT_DIRECTORY)
+MIL_DEPRECATED(M_HTTP_ADDRESS_SIZE          , 1040)
+MIL_DEPRECATED(M_HTTP_ROOT_DIRECTORY_SIZE   , 1040)
+#endif
+#define M_FILE_SERVER                                  1L
+#define M_REST_SERVER                                  2L
+#define M_HTTP_LISTENING_PORT                          8080L
+#define M_HTTP_LISTENING_ADDRESS                       MT("localhost")
+
+
+#define M_CALIBRATION_STREAM_SIZE_WITH_CONTEXT      1405L
+#define M_CALIBRATION_STREAM_WITH_CONTEXT           1406L
+
+#define M_OBJ_INQUIRE_DOUBLE_RANGE_START            1407L
+#define M_OBJ_INQUIRE_DOUBLE_RANGE_END              1407L
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if OldDefinesSupport
+#define M_MEMBER_LIST                              10199L
+// reserve the next 1000 entries                   10200L
+// end reserve                                     11199L
+
+// macro for M_MEMBER_LIST
+#define M_LIST_SIZE(n)                             ((n >= 0 ) ? ((n <= 1000) ? n : 1000) : 0)
+
+MIL_DEPRECATED(M_MEMBER_LIST, 1000)
+MIL_DEPRECATED(M_LIST_SIZE, 1000)
+#endif
+
+#endif
+
+// Used in MfuncControl/MfuncInquire
+#define M_OBJECT_TYPE                                136
+
+#define M_OBJECT_TYPE_EXTENDED                        29  // Used in MfuncControl/MfuncInquire
+#define M_OWNER_SYSTEM                              1101L // Used in many places
+#define M_IS_INTERNALLY_ALLOCATED                   1043L // Used by MbufControl/MbufInquire but kept in MGObject
+#define M_OBJECT_ID                           0x001B0000L // MbufGetHookInfo, MbufHookFunction
+#define M_GRAB_LINE                           0x00100000L // MdigHookFunction
+#define M_GRAB_LINE_END                       0x00200000L // MdigHookFunction
+
+/************************************************************************/
+/* Special defines required to pass a pointer to a function that needs  */
+/* a double. (use in McalControl to set a user string in the context)   */
+/************************************************************************/
+#if !M_MIL_USE_64BIT
+#define M_PTR_TO_DOUBLE(ptr)            ((double) MPtrToInt((void*)(ptr)))
+#else
+#define M_PTR_TO_DOUBLE(ptr)            (MIL_INT64)(ptr)
+#endif //!M_MIL_USE_64BIT
+
+#if OldDefinesSupport
+#define M_STRING_TO_DOUBLE(ptr)         M_PTR_TO_DOUBLE(ptr)
+MIL_DEPRECATED(M_STRING_TO_DOUBLE, 1040)
+#endif
+
+#define M_DOUBLE_TO_PTR(val)            ((void *)((MIL_UINT)val))
+#if !M_MIL_USE_64BIT
+#define M_PTR_TO_MIL_INT(val)           ((MIL_INT)MPtrToInt((void*)(val)))
+#else
+#define M_PTR_TO_MIL_INT(val)           ((MIL_INT)((MIL_UINT)val))
+#endif
+#define M_PARAM_TO_PTR(val)            ((void *)((MIL_UINT)val))
+
+/************************************************************************/
+/* Reserved MIL_IDs                                                     */
+/************************************************************************/
+#define M_DEFAULT_HOST                                M_MAKE_DEFAULT_ID(1)
+#define M_DEFAULT_GRAPHIC_CONTEXT                     M_MAKE_DEFAULT_ID(2)
+#define M_CONST_DEFAULT_HOST                       M_MAKE_DEFAULT_ID(3)
+#define M_VIDEO_DEVICE_ID                             M_MAKE_DEFAULT_ID(4)
+//Reserve next M_MAX_VIDEO_DEVICE IDs (reserved 64)   -> 68
+#define M_RESERVED_ID_END                             M_MAKE_DEFAULT_ID(4 + M_MAX_VIDEO_DEVICE)
+#define M_IS_RESERVED_ID(X)                           ((M_NAKED_ID(X) > 0) && (M_NAKED_ID(X) <= M_NAKED_ID(M_RESERVED_ID_END)))
+
+
+
+
+
+
+
+/************************************************************************/
+/* MIL OPTIONAL COMPILE DEFINES prefixes */
+/************************************************************************/
+
+#if M_MIL_USE_WINDOWS
+   #define MFTYPE        _stdcall         // Exported Function type
+#elif M_MIL_USE_LINUX
+   #define MFTYPE                         // Exported Function type
+#else
+   #error Operating system not supported in Mil.h!
+#endif
+
+#if OldDefinesSupport
+   #define  MFTYPE32                      // Exported Function type (32 bits)
+   MIL_DEPRECATED(MFTYPE32, 1000)
+   #define MPTYPE                         // Pointer and Reference type
+   MIL_DEPRECATED(MPTYPE, 1000)
+#endif
+
+/************************************************************************/
+/* M_MISC_DATA_TRANSFER related defines */
+#define M_REGISTER_HOOK_THREAD                        1L
+#define M_INTERNAL_THREAD_ERROR_TOOLS                 2L
+
+#define M_HAS_BUFTRANSFER_FORMAT1(X) ( (M_DIRECTX|M_MTX0) & (X) )
+#define M_HAS_BUFTRANSFER_FORMAT(X,Y) ((M_HAS_BUFTRANSFER_FORMAT1(X) & M_HAS_BUFTRANSFER_FORMAT1(Y)) != 0)
+
+
+//////////////////////////////////////////////////////////////////////////
+// MappInquire (InquireType range values)
+//////////////////////////////////////////////////////////////////////////
+#define M_IN_SYS_APP_INQUIRE_STRING_RANGE(X)             ( (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_APP_INQUIRE_STRING_START) && \
+                                                            ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_APP_INQUIRE_STRING_END  ) ) || \
+                                                           (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_APP_INQUIRE_STRING_2_START) && \
+                                                            ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_APP_INQUIRE_STRING_2_END  )  ) || \
+                                                            ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_DEVICE_NAME)  )  )
+
+#define M_IN_APP_INQUIRE_REG_DEF_STRING_RANGE(X)         ( (((X&~M_CLIENT_TEXT_ENCODING) >= M_APP_INQUIRE_REG_DEF_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_APP_INQUIRE_REG_DEF_STRING_END  )   ) || \
+                                                          (((X&~M_CLIENT_TEXT_ENCODING) >= M_APP_INQUIRE_REG_DEF_STRING_2_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_APP_INQUIRE_REG_DEF_STRING_2_END  )   ))
+
+#define M_IN_APP_INQUIRE_DIRECT_ACCESS_STRING_RANGE(X)   (((X&~M_CLIENT_TEXT_ENCODING) >= M_APP_INQUIRE_DIRECT_ACCESS_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_APP_INQUIRE_DIRECT_ACCESS_STRING_END  )   )
+
+#define M_IN_APP_INQUIRE_STRING_RANGE(X)                 (M_IN_SYS_APP_INQUIRE_STRING_RANGE(X)           || \
+                                                          M_IN_APP_INQUIRE_REG_DEF_STRING_RANGE(X)       || \
+                                                          M_IN_APP_INQUIRE_DIRECT_ACCESS_STRING_RANGE(X)   )
+
+#define M_IN_APP_INQUIRE_DOUBLE_RANGE(X)                 ((X&~M_INTERMOD_VALUE_MASK) == M_VERSION)
+
+#define M_IN_APP_INQUIRE_MIL_ID_RANGE(X)                 (X == M_CURRENT_APPLICATION)
+
+#define M_IN_APP_INQUIRE_MIL_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_APP_INQUIRE_SIZEOF_INT64_START) &&     \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_APP_INQUIRE_SIZEOF_INT64_END  )   ) || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_INIT_FLAG                         )  )
+
+
+//////////////////////////////////////////////////////////////////////////
+// MfuncInquire (InquireType range values)
+//////////////////////////////////////////////////////////////////////////
+#define M_IN_FUNC_INQUIRE_STRING_RANGE(X)                ((((X&~M_CLIENT_TEXT_ENCODING) >= M_FUNC_INQUIRE_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_FUNC_INQUIRE_STRING_END  )) || \
+                                                          (((X&~M_CLIENT_TEXT_ENCODING) >= M_SCRIPT_REFERENCE_START) &&   \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_SCRIPT_REFERENCE_END)))
+
+
+//////////////////////////////////////////////////////////////////////////
+// MappInquireObject (InquireType range values)
+#define M_IN_APP_INQUIRE_OBJ_DOUBLE_RANGE(X)             (((X&~M_INTERMOD_VALUE_MASK) >= M_APP_INQUIRE_OBJ_DOUBLE_RANGE_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_APP_INQUIRE_OBJ_DOUBLE_RANGE_END  )   )
+
+#define M_IN_APP_INQUIRE_OBJ_STRING_RANGE(X)             (((X&~M_CLIENT_TEXT_ENCODING) >= M_APP_INQUIRE_OBJ_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_APP_INQUIRE_OBJ_STRING_END  )   )
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#define M_IN_APP_INQUIRE_OBJ_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_APP_INQUIRE_OBJ_INT64_RANGE_START) &&     \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_APP_INQUIRE_OBJ_INT64_RANGE_END  )   ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE                           ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE_OLD                       ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE_EXTENDED                  )   )
+#else
+#define M_IN_APP_INQUIRE_OBJ_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_APP_INQUIRE_OBJ_INT64_RANGE_START) &&     \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_APP_INQUIRE_OBJ_INT64_RANGE_END  )   ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE                           ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_OBJECT_TYPE_EXTENDED                  )   )
+#endif
+
+#if M_MIL_USE_64BIT
+#define M_APP_INQUIRE_OBJ_MUST_HAVE_USER_PTR(X)          (M_IN_APP_INQUIRE_OBJ_STRING_RANGE(X))
+#else
+#define M_APP_INQUIRE_OBJ_MUST_HAVE_USER_PTR(X)          (M_IN_APP_INQUIRE_OBJ_STRING_RANGE(X) || M_IN_APP_INQUIRE_OBJ_INT64_RANGE(X))
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MbufInquire (InquireType range values)
+#define M_IN_BUF_INQUIRE_DOUBLE_RANGE(X)                 ((((X&~M_INTERMOD_VALUE_MASK) >= M_BUF_INQUIRE_DOUBLE_RANGE_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_BUF_INQUIRE_DOUBLE_RANGE_END  )   ) || \
+                                                          (X == M_GRAB_TIME_STAMP) )
+
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION
+#define M_IN_BUF_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)        (((X >= M_BUF_INQUIRE_UNKNOWN_SIZEOF_START) && \
+                                                          (X <= M_BUF_INQUIRE_UNKNOWN_SIZEOF_END  )   ) || \
+                                                          (X == M_BUFFER_INFO_COPY) || \
+                                                          (X == M_GRAB_BUFFERS) || \
+                                                          (X == M_GRAB_BUFFERS_AFTER_SET_SCHEME) || \
+                                                          (X == M_GRAB_BUFFERS_USED) || \
+                                                          (X == M_BATCH_FLAGS) || \
+                                                          (X == M_BATCH_INQUIRE) )
+#else
+#define M_IN_BUF_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)        (((X >= M_BUF_INQUIRE_UNKNOWN_SIZEOF_START) && \
+                                                          (X <= M_BUF_INQUIRE_UNKNOWN_SIZEOF_END  )   ) || \
+                                                          (X == M_BUFFER_INFO_COPY) || \
+                                                          (X == M_GRAB_BUFFERS) || \
+                                                          (X == M_GRAB_BUFFERS_AFTER_SET_SCHEME) || \
+                                                          (X == M_GRAB_BUFFERS_USED) || \
+                                                          (X == M_BUFFER_INFO_OLD) || \
+                                                          (X == M_BATCH_FLAGS) || \
+                                                          (X == M_BATCH_INQUIRE) )
+#endif
+
+#define M_IN_BUF_INQUIRE_MIL_ID_RANGE(X)                 (((X >= M_BUF_INQUIRE_MIL_ID_START) &&     \
+                                                           (X <= M_BUF_INQUIRE_MIL_ID_END  )   ) || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_LIST )   || \
+                                                          (X == M_MIL_ID_INTERNAL              )   )
+
+#define M_IN_BUF_INQUIRE_MIL_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_BUF_INQUIRE_SIZEOF_INT64_START) &&     \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_BUF_INQUIRE_SIZEOF_INT64_END  )   ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_FLAGS                              ) || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_GROUP_ID_LIST )   || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_REGION_ID_LIST )  || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_SOURCE_ID_LIST )  || \
+                                                          ((X & ~M_ARRAY_ID_MASK) == M_COMPONENT_TYPE_LIST )       || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_64BIT_PHYSICAL_ADDRESS             )   )
+
+// M_HOST_ADDRESS_REMOTE has the same value as M_COMPONENT_ID_FLAG.
+// M_CONFIDENCE sets all 3 bits from M_RED M_GREEN M_BLUE so we mistakingly assume that M_COMPONENT_ID(M_CONFIDENCE)
+// is really M_HOST_ADDRESS_REMOTE. So we must split it
+#define M_IN_BUF_INQUIRE_PTR_RANGE(X)                    (  (X &~ (M_RED | M_GREEN | M_BLUE | M_Y | M_U | M_V)) == M_HOST_ADDRESS            || \
+                                                            (X == M_HOST_ADDRESS_REMOTE) || \
+                                                            (X == (M_HOST_ADDRESS_REMOTE | M_RED)) || \
+                                                            (X == (M_HOST_ADDRESS_REMOTE | M_GREEN)) || \
+                                                            (X == (M_HOST_ADDRESS_REMOTE | M_BLUE)) || \
+                                                            (X &~ (M_RED | M_GREEN | M_BLUE | M_Y | M_U | M_V)) == M_PHYSICAL_ADDRESS        || \
+                                                            (X &~ (M_RED | M_GREEN | M_BLUE | M_Y | M_U | M_V)) == M_PHYSICAL_ADDRESS_REMOTE || \
+                                                            (X == M_DC_HANDLE) || \
+                                                            (X == M_DIB_HANDLE) )
+
+#define M_IN_BUF_INQUIRE_STRING_RANGE(X)                 (((X&~(M_CLIENT_TEXT_ENCODING)) >= M_BUF_INQUIRE_STRING_START) && \
+                                                          ((X&~(M_CLIENT_TEXT_ENCODING)) <= M_BUF_INQUIRE_STRING_END))
+
+#if M_MIL_USE_64BIT
+#define M_BUF_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_BUF_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)  )
+#else
+#define M_BUF_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_BUF_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_BUF_INQUIRE_MIL_INT64_RANGE(X)        )
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MdigInquire (InquireType range values)
+#define M_IN_DIG_INQUIRE_STRING_RANGE(X)                 (((X&~(M_CLIENT_TEXT_ENCODING|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_INQUIRE_STRING_START  ) && \
+                                                          ((X&~(M_CLIENT_TEXT_ENCODING|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_INQUIRE_STRING_END    )   )
+
+#define M_IN_DIG_INQUIRE_MIL_ID_RANGE(X)                 ((((X&~(M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_INQUIRE_MIL_ID_START  )  && \
+                                                           ((X&~(M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_INQUIRE_MIL_ID_END    )) || \
+                                                           ((X&~(M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_MIL_ID_INTERNAL           )  || \
+                                                           ((X&~(M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_BAYER_COEFFICIENTS_ID     ) )
+
+#define M_IN_DIG_INQUIRE_DOUBLE_RANGE(X)                 ((((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_INQUIRE_SIZEOF_DOUBLE_START) &&          \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_INQUIRE_SIZEOF_DOUBLE_END  )        ) || \
+                                                          (((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_START) &&    \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_END  )   )|| \
+                                                           (((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_ROTARY_RANGE_DOUBLE_START) &&               \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_ROTARY_RANGE_DOUBLE_END  )   )||             \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK|M_ALL_REF|M_VOLTAGE|M_AUTOMATIC)) == M_BLACK_REF) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK|M_ALL_REF|M_VOLTAGE|M_AUTOMATIC)) == M_WHITE_REF) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK|M_MODE_CONTROL|M_ABSOLUTE_CTL_MASK)) == M_GAMMA ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_GC_CAMERA_TIME_STAMP ))
+
+#define M_IN_DIG_INQUIRE_MIL_INT64_RANGE(X)              ((((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) >= M_DIG_INQUIRE_SIZEOF_INT64_START ) &&      \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) <= M_DIG_INQUIRE_SIZEOF_INT64_END   )   )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK|M_SIGNAL|M_SYNC)) == M_CHANNEL             )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_IO_STATUS_ALL                       )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_IO_STATUS_ALL+M_AUX_IO              )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_IO_STATUS_ALL+M_CC_IO               )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_USER_BIT_STATE_ALL                  )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_USER_BIT_STATE_ALL+M_USER_BIT       )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_USER_BIT_STATE_ALL+M_USER_BIT_CC_IO )  || \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK|M_DIG_CONTROL_TYPE_RESERVED_BIT_MASK)) == M_USER_BIT_STATE_ALL+M_USER_BIT_TL_TRIGGER ))
+
+
+#define M_IN_DIG_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)        (((X >= M_DIG_INQUIRE_UNKNOWN_SIZEOF_START) &&  \
+                                                           (X <= M_DIG_INQUIRE_UNKNOWN_SIZEOF_END  )  )  )
+
+#if !M_MIL_USE_64BIT
+#define M_DIG_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_DIG_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_DIG_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_DIG_INQUIRE_MIL_INT64_RANGE(X)        )
+#else
+#define M_DIG_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_DIG_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_DIG_INQUIRE_STRING_RANGE(X)           )
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MdispInquire (InquireType range values)
+#define M_IN_DISP_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)       (((M_ORIGINAL_DISPLAY_CONTROL(X) >= M_DISP_INQUIRE_UNKNOWN_SIZEOF_START) &&     \
+                                                           (M_ORIGINAL_DISPLAY_CONTROL(X) <= M_DISP_INQUIRE_UNKNOWN_SIZEOF_END  )   ) || \
+                                                          (X == M_GRAB_BUFFERS                                                      ) || \
+                                                          (X == M_ROI_RECT_BUFFER                                                   ) || \
+                                                          (X == M_ROI_RECT_DISPLAY                                                  ) || \
+                                                          (X == M_NEAREST_COLOR                                                     ) || \
+                                                          (X == M_CURRENT_SCREEN_RECT                                               ) || \
+                                                          (X == M_CURRENT_SCREEN_WORK_RECT                                          ) || \
+                                                          (X == M_CURRENT_MONITOR_RECT                                              ) || \
+                                                          (X == M_CURRENT_MONITOR_WORK_RECT                                         ) || \
+                                                          (X == M_VGA_INFO_DISPLAY_RECT                                             )   )
+
+#define M_IN_DISP_INQUIRE_STRING_RANGE(X)                (((M_ORIGINAL_DISPLAY_CONTROL((X&~M_CLIENT_TEXT_ENCODING)) >= M_DISP_INQUIRE_STRING_START) &&     \
+                                                           (M_ORIGINAL_DISPLAY_CONTROL((X&~M_CLIENT_TEXT_ENCODING)) <= M_DISP_INQUIRE_STRING_END  )   ) || \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_VIDEO_DEVICE_DESCRIPTION_STRING)                           ) || \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_VGA_INFO_DISPLAY_DEVICE_NAME)                              ) || \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_DESKTOP_DEVICE_NAME)                                       ) || \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) == M_STRIP_CLIENT_TEXT_ENCODING(M_SUPPORTED_DISPLAY_TYPE_STRING)                             )   )
+
+#define M_IN_DISP_INQUIRE_MIL_ID_RANGE(X)                (((M_ORIGINAL_DISPLAY_CONTROL(X) >= M_DISP_INQUIRE_MIL_ID_START ) &&     \
+                                                           (M_ORIGINAL_DISPLAY_CONTROL(X) <= M_DISP_INQUIRE_MIL_ID_END   )   ) || \
+                                                          (M_IS_IN_VGA_DEVICE_SYSTEM_RANGE(M_ORIGINAL_DISPLAY_CONTROL(X))    ) || \
+                                                          (X == M_SYSTEM_ASSOCIATED_TO_DX_OBJECT                             ) || \
+                                                          (X == M_VGA_SYSTEM_FROM_PHYSICAL_ADDRESS                           ) || \
+                                                          (X == M_SELECT_VIDEO_SOURCE                                        ) || \
+                                                          (X == M_MIL_ID_INTERNAL                                            ) || \
+                                                          (X == M_ENCODER_OVR_BUF_ID                                         )   )
+
+#define M_IN_DISP_INQUIRE_DOUBLE_UNDERLAY_RANGE(X)       ((M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) >= M_UNDERLAY_DOUBLE_RANGE_START     ) && \
+                                                          (M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) <= M_UNDERLAY_DOUBLE_RANGE_END       )   )
+
+#define M_IN_DISP_INQUIRE_DOUBLE_RANGE(X)                (((M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) >= M_DISP_INQUIRE_SIZEOF_DOUBLE_START) &&     \
+                                                           (M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) <= M_DISP_INQUIRE_SIZEOF_DOUBLE_END  )   ) || \
+                                                          M_IN_DISP_INQUIRE_DOUBLE_UNDERLAY_RANGE(X)                                                          )
+
+#define M_IN_DISP_INQUIRE_MIL_INT64_RANGE(X)             ((M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) >= M_DISP_INQUIRE_SIZEOF_INT64_START) && \
+                                                          (M_ORIGINAL_DISPLAY_CONTROL(X&~M_INTERMOD_VALUE_MASK) <= M_DISP_INQUIRE_SIZEOF_INT64_END  )   )
+
+#if M_MIL_USE_64BIT
+#define M_DISP_INQUIRE_MUST_HAVE_USER_PTR(X)             (M_IN_DISP_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_DISP_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)   )
+#else
+#define M_DISP_INQUIRE_MUST_HAVE_USER_PTR(X)             (M_IN_DISP_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_DISP_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_DISP_INQUIRE_MIL_INT64_RANGE(X)         )
+#endif
+
+
+#define M_IN_DISP_INQUIRE_MIL_INT_RANGE(X)               (!M_IN_DISP_INQUIRE_DOUBLE_RANGE(X)    && \
+                                                          !M_IN_DISP_INQUIRE_MIL_ID_RANGE(X)    && \
+                                                          !M_DISP_INQUIRE_MUST_HAVE_USER_PTR(X)   )
+
+#define M_IN_DISP_CONTROL_DOUBLE_RANGE(X)                M_IN_DISP_INQUIRE_DOUBLE_RANGE(X)
+#define M_IN_DISP_CONTROL_STRING_RANGE(X)                M_IN_DISP_INQUIRE_STRING_RANGE(X)
+#define M_IN_DISP_CONTROL_MIL_ID_RANGE(X)                M_IN_DISP_INQUIRE_MIL_ID_RANGE(X)
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// MsysInquire (InquireType range values)
+
+#define M_IN_SYS_INQUIRE_CPU_STRING_RANGE(X)             (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_INQUIRE_CPU_STRING_START ) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_INQUIRE_CPU_STRING_END   )   )
+
+#define M_IN_SYS_INQUIRE_STRING_RANGE(X)                 ((((X&~M_CLIENT_TEXT_ENCODING &~M_DIGITIZER_DEVx_INDEX_MASK) >= M_SYS_INQUIRE_STRING_START) &&     \
+                                                           ((X&~M_CLIENT_TEXT_ENCODING &~M_DIGITIZER_DEVx_INDEX_MASK) <= M_SYS_INQUIRE_STRING_END  )   ) || \
+                                                           (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_INQUIRE_STRING_START_1) &&     \
+                                                           ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_INQUIRE_STRING_END_1  )   ) || \
+                                                          M_IN_SYS_INQUIRE_CPU_STRING_RANGE(X)                             || \
+                                                          M_IN_SYS_APP_INQUIRE_STRING_RANGE(X)                             || \
+                                                          (((M_GC_STRIP_TRIGGER_SOFTWARE_NUMBER(X)&~M_CLIENT_TEXT_ENCODING) >= M_SYS_INQUIRE_STRING_START) &&     \
+                                                           ((M_GC_STRIP_TRIGGER_SOFTWARE_NUMBER(X)&~M_CLIENT_TEXT_ENCODING) <= M_SYS_INQUIRE_STRING_END  )))
+
+#define M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)        ((X >= M_SYS_INQUIRE_UNKNOWN_SIZEOF_START) && \
+                                                          (X <= M_SYS_INQUIRE_UNKNOWN_SIZEOF_END  )   )
+
+#define M_IN_SYS_INQUIRE_MIL_ID_RANGE(X)                 (((X >= M_SYS_INQUIRE_MIL_ID_START) &&     \
+                                                           (X <= M_SYS_INQUIRE_MIL_ID_END  )   ) || \
+                                                          (X == M_MIL_ID_INTERNAL              )   )
+
+#define M_IN_SYS_INQUIRE_DOUBLE_RANGE(X)                 ((((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_INQUIRE_SIZEOF_DOUBLE_START) &&              \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_INQUIRE_SIZEOF_DOUBLE_END  )   ) ||          \
+                                                          (((X&~M_INTERMOD_VALUE_MASK) >= M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_START) &&    \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_DIG_SYS_TIMER_INQUIRE_SIZEOF_DOUBLE_END  )   )|| \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_TEMPERATURE                         )   )
+
+#define M_IN_SYS_INQUIRE_MIL_INT64_RANGE(X)              ((((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_INQUIRE_SIZEOF_INT64_START) &&      \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_INQUIRE_SIZEOF_INT64_END  )   )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_GC_TOTAL_BYTES_RECEIVED           )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_IO_STATUS_ALL                     )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_IO_STATUS_ALL+M_AUX_IO            )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_USER_BIT_STATE_ALL                )  || \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) == M_USER_BIT_STATE_ALL+M_USER_BIT ))
+
+
+#if M_MIL_USE_64BIT
+#define M_IN_SYS_INQUIRE_MIL_INT_RANGE(X)                ((!M_IN_SYS_INQUIRE_MIL_ID_RANGE(X)          &&     \
+                                                           !M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) &&     \
+                                                           !M_IN_SYS_INQUIRE_DOUBLE_RANGE(X) &&     \
+                                                           !M_IN_SYS_INQUIRE_STRING_RANGE(X)            ) || \
+                                                          M_IN_SYS_INQUIRE_MIL_INT64_RANGE(X)               )
+#else
+#define M_IN_SYS_INQUIRE_MIL_INT_RANGE(X)                ((!M_IN_SYS_INQUIRE_MIL_ID_RANGE(X)          && \
+                                                           !M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) && \
+                                                           !M_IN_SYS_INQUIRE_DOUBLE_RANGE(X) && \
+                                                           !M_IN_SYS_INQUIRE_STRING_RANGE(X)            ) )
+#endif
+
+#if !M_MIL_USE_64BIT
+#define M_SYS_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_SYS_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_SYS_INQUIRE_MIL_INT64_RANGE(X)         )
+#else
+#define M_SYS_INQUIRE_MUST_HAVE_USER_PTR(X)              (M_IN_SYS_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_SYS_INQUIRE_STRING_RANGE(X)            )
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MSysGetHookInfo (InquireType range values)
+#define M_IN_SYS_GET_HOOK_INFO_INT64_RANGE(X)           (((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GC_MAC_ADDRESS             ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GC_IP_ADDRESS             ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST1+M_LATCH1  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST1+M_LATCH2  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST1+M_LATCH3  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST1+M_LATCH4  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST2+M_LATCH1  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST2+M_LATCH2  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST2+M_LATCH3  ) || \
+    ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_REFERENCE_LATCH_VALUE+M_IO_COMMAND_LIST2+M_LATCH4  ) || \
+    (((X&~M_DATA_LATCH_INSTANCE_MASK) >= M_SYS_DATA_LATCH_VALUE) && ((X&~M_DATA_LATCH_INSTANCE_MASK) < (M_SYS_DATA_LATCH_VALUE+M_SYS_DATA_LATCH_MAX_INDEX))) )
+
+#define M_IN_SYS_GET_HOOK_INFO_STRING_RANGE(X)          M_IN_SYS_INQUIRE_STRING_RANGE(X)
+
+#define M_IN_SYS_GET_HOOK_INFO_DOUBLE_RANGE(X)           (((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIME_STAMP ) || \
+                                                          (((X&~(M_INTERMOD_VALUE_MASK | M_MODIFIED_BUFFER)) >= M_TIMER_VALUE) && \
+                                                           ((X&~(M_INTERMOD_VALUE_MASK | M_MODIFIED_BUFFER)) <= M_TIMER_VALUE+M_TIMER99)) )
+
+//////////////////////////////////////////////////////////////////////////
+// MsysIoInquire (InquireType range values)
+
+#define M_IN_SYS_IO_INQUIRE_STRING_RANGE(X)              (((X&~M_CLIENT_TEXT_ENCODING) >= M_SYS_IO_INQUIRE_STRING_START) && \
+                                                          ((X&~M_CLIENT_TEXT_ENCODING) <= M_SYS_IO_INQUIRE_STRING_END  )   )
+
+#define M_IN_SYS_IO_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)     ((X >= M_SYS_IO_INQUIRE_UNKNOWN_SIZEOF_START) && \
+                                                          (X <= M_SYS_IO_INQUIRE_UNKNOWN_SIZEOF_END  )   )
+
+#define M_IN_SYS_IO_INQUIRE_MIL_ID_RANGE(X)              ((X >= M_SYS_IO_INQUIRE_MIL_ID_START) && \
+                                                          (X <= M_SYS_IO_INQUIRE_MIL_ID_END  )   )
+
+#define M_IN_SYS_IO_INQUIRE_DOUBLE_RANGE(X)              (((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_IO_INQUIRE_SIZEOF_DOUBLE_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_IO_INQUIRE_SIZEOF_DOUBLE_END  )   )
+
+#define M_IN_SYS_IO_INQUIRE_MIL_INT64_RANGE(X)           ((((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_IO_INQUIRE_SIZEOF_INT64_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_IO_INQUIRE_SIZEOF_INT64_END  )) || \
+                                                          (((X&~M_INTERMOD_VALUE_MASK) >= M_SYS_IO_INQUIRE_SIZEOF_INT64_START2) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_SYS_IO_INQUIRE_SIZEOF_INT64_END2  )))
+
+#if !M_MIL_USE_64BIT
+#define M_SYS_IO_INQUIRE_MUST_HAVE_USER_PTR(X)           (M_IN_SYS_IO_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_SYS_IO_INQUIRE_STRING_RANGE(X)          || \
+                                                          M_IN_SYS_IO_INQUIRE_MIL_INT64_RANGE(X)         )
+#else
+#define M_SYS_IO_INQUIRE_MUST_HAVE_USER_PTR(X)           (M_IN_SYS_IO_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) || \
+                                                          M_IN_SYS_IO_INQUIRE_STRING_RANGE(X)            )
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// MSeqInquire
+#define M_IN_SEQ_CONTAINER_INQUIRE_DOUBLE_RANGE(X)       (((X&~M_INTERMOD_VALUE_MASK) == M_STREAM_FRAME_RATE              ) )
+
+#define M_IN_SEQ_CONTAINER_INQUIRE_MIL_INT64_RANGE(X)    (((X&~M_INTERMOD_VALUE_MASK) >= M_SEQ_CONTAINER_INQUIRE_SIZEOF_INT64_START) && \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) <= M_SEQ_CONTAINER_INQUIRE_SIZEOF_INT64_END  ) )
+
+#define M_IN_SEQ_CONTAINER_INQUIRE_STRING_RANGE(X)       ((X&~M_CLIENT_TEXT_ENCODING) == (M_STREAM_FILE_NAME&~M_CLIENT_TEXT_ENCODING))
+
+#define M_IN_SEQ_CONTAINER_INQUIRE_MUST_HAVE_PTR(X)      (M_IN_SEQ_CONTAINER_INQUIRE_STRING_RANGE(X))
+
+#define M_IN_SEQ_DEFINE_CONTAINER_TYPE(X)                ((X == M_PIPE       ) || \
+                                                          (X == M_FILE       ) || \
+                                                          (X == M_BUFFER_LIST) || \
+                                                          (X == M_USER_HOOK  ) || \
+                                                          (X == M_USER_FEED  ) )
+
+//////////////////////////////////////////////////////////////////////////
+// MSeqInquire (InquireType range values)
+#define M_SEQ_INTERMOD_VALUE_MASK (M_INTERMOD_VALUE_MASK | M_EFFECTIVE_VALUE)
+#define M_IN_SEQ_INQUIRE_MIL_INT64_RANGE(X)              (M_IN_SEQ_CONTAINER_INQUIRE_MIL_INT64_RANGE(X)  )
+
+#define M_IN_SEQ_INQUIRE_MIL_DOUBLE_RANGE(X)             (((X&~M_SEQ_INTERMOD_VALUE_MASK) == M_PROCESS_FRAME_RATE ) || \
+                                                          ((X&~M_SEQ_INTERMOD_VALUE_MASK) == M_STREAM_FRAME_RATE  ) || \
+                                                          M_IN_SEQ_CONTAINER_INQUIRE_DOUBLE_RANGE(X)              )
+
+#define M_IN_SEQ_INQUIRE_STRING_RANGE(X)                 (M_IN_SEQ_CONTAINER_INQUIRE_STRING_RANGE(X))
+
+#define M_IN_SEQ_INQUIRE_MIL_ID_RANGE(X)                 (!(X == X)) //Return false for now
+
+#define M_IN_SEQ_INQUIRE_MUST_HAVE_PTR(X)                (M_IN_SEQ_INQUIRE_STRING_RANGE(X))
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// MgraInquire / MgraInquireList (InquireType range values)
+#define M_IN_GRA_INQUIRE_DOUBLE_RANGE(X)                 ((((X&~M_INTERMOD_VALUE_MASK) >= M_GRA_INQUIRE_DOUBLE_RANGE_START) &&            \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_GRA_INQUIRE_DOUBLE_RANGE_END  )          ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_RED|M_GREEN|M_BLUE)) == M_COLOR              ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_RED|M_GREEN|M_BLUE)) == M_BACKCOLOR          ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_RED|M_GREEN|M_BLUE)) == M_SELECTED_COLOR     ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_FONT_X_SCALE                              ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_FONT_Y_SCALE                              ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_POSITION_X                                ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_POSITION_Y                                ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_CENTER_X                                ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_CENTER_Y                                ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_ANGLE                                     ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_ANGLE_START                               ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_ANGLE_END                                 ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_LINE_THICKNESS                            ) || \
+                                                          ((X&~M_INTERMOD_VALUE_MASK) == M_LINE_ENDS_DIMENSION                       )   )
+
+#define M_IN_GRA_INQUIRE_MIL_ID_RANGE(X)                 ((X >= M_GRA_INQUIRE_MIL_ID_RANGE_START) && \
+                                                          (X <= M_GRA_INQUIRE_MIL_ID_RANGE_END  )   )
+
+
+//////////////////////////////////////////////////////////////////////////
+// MDigGetHookInfo (InquireType range values)
+#define M_IN_DIG_GET_HOOK_INFO_DOUBLE_RANGE(X)           (((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GRAB_TIME_STAMP             ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GRAB_TIME_STAMP+M_TIMER_IO  ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE                 ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER1        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER2        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER3        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER4        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER5        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER6        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER7        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIMER_VALUE+M_TIMER8        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GC_CAMERA_TIME_STAMP        ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_TIME_STAMP                  ) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK|M_MODIFIED_BUFFER)) == M_GC_FRAME_TIMESTAMP          )   )
+
+
+//////////////////////////////////////////////////////////////////////////
+// MDigGetHookInfo (InquireType range values)
+#define M_IN_DIG_GET_HOOK_INFO_STRING_RANGE(X)           (((X&(~M_CLIENT_TEXT_ENCODING)) == (M_GC_FEATURE_CHANGE_NAME&(~M_CLIENT_TEXT_ENCODING)) ) || \
+                                                           ((X&(~M_CLIENT_TEXT_ENCODING)) == (M_CAMERA_MODEL&(~M_CLIENT_TEXT_ENCODING)) ) )
+
+//////////////////////////////////////////////////////////////////////////
+// MDigGetHookInfo (InfoType range values)
+#define M_IN_DIG_GET_HOOK_INFO_INT64_RANGE(X)            ((((X&~M_DATA_LATCH_INSTANCE_MASK) >= M_DATA_LATCH_VALUE) && ((X&~M_DATA_LATCH_INSTANCE_MASK) < (M_DATA_LATCH_VALUE+M_DATA_LATCH_MAX_INDEX))) || \
+                                                          ((X&~(M_INTERMOD_VALUE_MASK | M_MODIFIED_BUFFER)) == M_GC_FRAME_BLOCK_ID64) )
+
+//////////////////////////////////////////////////////////////////////////
+// MDigGetHookInfo (InfoType range values)
+#define M_IN_DIG_GET_HOOK_INFO_PTR_RANGE(X)               ((X == M_DRIVER_HOOK_CONTEXT_PTR) || \
+                                                          ((X >= M_DATA_LATCH_VALUE_ALL ) && (X < (M_DATA_LATCH_VALUE_ALL + M_DATA_LATCH_MAX_INDEX))))
+
+//////////////////////////////////////////////////////////////////////////
+// MobjInquire (Inquire range values)
+#define M_IN_OBJ_INQUIRE_DOUBLE_RANGE(X)                  (((X&~M_INTERMOD_VALUE_MASK) >= M_OBJ_INQUIRE_DOUBLE_RANGE_START) &&            \
+                                                           ((X&~M_INTERMOD_VALUE_MASK) <= M_OBJ_INQUIRE_DOUBLE_RANGE_END  )          )
+
+#ifdef __cplusplus
+
+// General function handling combination flags in Inquire and GetResult functions,
+// used to determine the output pointer type.
+inline MIL_INT64 MinquireOverrides(MIL_INT64 InquireType, MIL_INT64 ComboFlagDefaultType)
+   {
+   const MIL_INT64 RequiredType = M_GET_HLVLDATATYPE(InquireType);
+   if (RequiredType != 0)
+      return RequiredType;
+
+   const MIL_INT64 StateBits = M_GET_INTERMOD_STATE_BITS(InquireType);
+   const MIL_INT64 ValueBits = M_GET_INTERMOD_VALUE_BITS(InquireType);
+   if (StateBits & (M_AVAILABLE | M_SUPPORTED | M_IS_SET_TO_DEFAULT) || ValueBits == M_STRING_SIZE || ValueBits == M_NB_ELEMENTS)
+      return ComboFlagDefaultType;
+
+   return 0;
+   }
+
+#endif
+
+/************************************************************************/
+/* Miltracer defines                                                   */
+/************************************************************************/
+#define M_TRACE_STRING_LENGTH                         2048
+
+/************************************************************************/
+/* MIL command decoder functions */
+#include <mildec.h>
+
+/************************************************************************/
+/* MIL library prototypes */
+#include <milproto.h>
+
+/************************************************************************/
+/* MIL_UNIQUE_ID class definition and overloads */
+#include <miluniqueid.h>
+
+/************************************************************************/
+/* MIL custom-made header file*/
+#include <mildyn.h>
+
+#if !defined(MappAllocDefault) && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL) && defined(M_SYSTEM_DEFAULT)
+
+#define M_MIL_USE_APP_ALLOC_DEFAULT 1
+
+#ifdef __cplusplus
+#define INL_FUNC_PREFIX   inline
+#else
+#define INL_FUNC_PREFIX   static
+#endif
+
+/***************************************************************************/
+/* LocalBufferAllocDefault - Local macro to allocate a default MIL buffer: */
+/*                                                                         */
+/* MIL_ID *SystemIdVarPtr;                                                 */
+/* MIL_ID *DisplayIdVarPtr;                                                */
+/* MIL_ID *ImageIdVarPtr;                                                  */
+/*                                                                         */
+/***************************************************************************/
+INL_FUNC_PREFIX void LocalBufferAllocDefault(MIL_ID* SystemIdVarPtr, MIL_ID* DisplayIdVarPtr, MIL_ID* DigitizerIdVarPtr, MIL_ID* ImageIdVarPtr)
+   {
+   /* local variables */
+   MIL_INT   m_def_image_numbands = 1;
+   MIL_INT   m_def_image_size_x = 640;
+   MIL_INT   m_def_image_size_y = 480;
+   MIL_INT   m_def_image_type = 8 + M_UNSIGNED;
+   MIL_INT64 m_def_image_attribute = M_IMAGE + M_PROC;
+
+   /* determines the needed size band, x, y and attribute */
+   if ((DigitizerIdVarPtr != M_NULL) && (*DigitizerIdVarPtr != M_NULL))
+      {
+      m_def_image_size_x = MdigInquire(*((MIL_ID *)(DigitizerIdVarPtr)), M_SIZE_X, M_NULL);
+      m_def_image_size_y = MdigInquire(*((MIL_ID *)(DigitizerIdVarPtr)), M_SIZE_Y, M_NULL);
+      m_def_image_attribute |= M_GRAB;
+      m_def_image_numbands = MdigInquire(*(MIL_ID *)DigitizerIdVarPtr, M_SIZE_BAND, M_NULL);
+      }
+
+
+   /* determines the needed attribute */
+   if ((DisplayIdVarPtr != M_NULL) && (*DisplayIdVarPtr != M_NULL))
+      {
+      m_def_image_attribute |= M_DISP;
+      }
+
+   /* allocates a monochromatic or color image buffer */
+   MbufAllocColor(*SystemIdVarPtr,
+      m_def_image_numbands,
+      m_def_image_size_x,
+      m_def_image_size_y,
+      m_def_image_type,
+      m_def_image_attribute,
+      ImageIdVarPtr);
+
+   /* clear and display the image buffer */
+   if ((DisplayIdVarPtr != M_NULL) &&
+      (*DisplayIdVarPtr != M_NULL) &&
+      (*ImageIdVarPtr != M_NULL))
+      {
+      MbufClear(*ImageIdVarPtr, 0);
+      MdispSelect(*DisplayIdVarPtr, *ImageIdVarPtr);
+      }
+   }
+
+/**************************************************************************/
+/* MappAllocDefault - macro to allocate default MIL objects:              */
+/*                                                                        */
+/* MIL_UINT64 InitFlag;                                                   */
+/* MIL_ID*    ContextAppIdPtr;                                            */
+/* MIL_ID*    SystemIdVarPtr;                                             */
+/* MIL_ID*    DisplayIdVarPtr;                                            */
+/* MIL_ID*    DigitizerIdVarPtr;                                          */
+/* MIL_ID*    ImageIdVarPtr;                                              */
+/*                                                                        */
+/* Note:                                                                  */
+/*       An application must be allocated before a system.                */
+/*       An system must be allocated before a display, digitizer or image.*/
+/*                                                                        */
+/**************************************************************************/
+INL_FUNC_PREFIX void MappAllocDefault(MIL_INT64 InitFlag, MIL_ID* ContextAppIdPtr, MIL_ID* SystemIdVarPtr, MIL_ID* DisplayIdVarPtr, MIL_ID* DigitizerIdVarPtr, MIL_ID* ImageIdVarPtr)
+   {
+   /* local variables */
+   MIL_INT DefAutoPublish = M_DEF_AUTO_PUBLISH;
+
+   /*Make sure variables are initialized to M_NULL if a call fails*/
+   if (ContextAppIdPtr != M_NULL)
+      *ContextAppIdPtr = M_NULL;
+   if (SystemIdVarPtr != M_NULL)
+      *SystemIdVarPtr = M_NULL;
+   if (DisplayIdVarPtr != M_NULL)
+      *DisplayIdVarPtr = M_NULL;
+   if (DigitizerIdVarPtr != M_NULL)
+      *DigitizerIdVarPtr = M_NULL;
+   if (ImageIdVarPtr != M_NULL)
+      *ImageIdVarPtr = M_NULL;
+   /* allocate a MIL application. */
+
+   if (ContextAppIdPtr == M_NULL)
+      {
+      // we have nothing to allocate
+      return;
+      }
+
+
+   MappAlloc(MIL_TEXT("M_DEFAULT"), InitFlag, ContextAppIdPtr);
+
+   /* Enables DMIL monitoring mode */
+   if (DefAutoPublish != 0)
+      {
+      MappControl(M_DEFAULT, M_DMIL_CONNECTION, M_DMIL_MONITOR);
+      MappControl(M_DEFAULT, M_DMIL_AUTO_PUBLISH_ALL, M_ENABLE);
+      }
+
+   /* allocate a system */
+   if ((*ContextAppIdPtr == M_NULL) || (SystemIdVarPtr == M_NULL))
+      {
+      // Application failed to allocate or no requested system
+      return;
+      }
+
+   //MIL_CONST_TEXT_PTR SysName = M_SYSTEM_DEFAULT;
+   MsysAlloc(M_DEFAULT, M_SYSTEM_DEFAULT, M_DEFAULT, InitFlag, SystemIdVarPtr);
+   //MsysAlloc(M_DEFAULT, SysName, M_DEFAULT, InitFlag, SystemIdVarPtr);
+
+
+   if (*SystemIdVarPtr == M_NULL)
+      {
+      // System failed to allocate
+      return;
+      }
+
+
+   /* allocate a display */
+   if (DisplayIdVarPtr != M_NULL)
+      MdispAlloc(*SystemIdVarPtr,
+         M_DEFAULT,
+         MIL_TEXT("M_DEFAULT"),
+         M_DEFAULT,
+         DisplayIdVarPtr);
+
+   /* allocate a digitizer */
+   if (DigitizerIdVarPtr != M_NULL)
+      MdigAlloc(*SystemIdVarPtr,
+         M_DEFAULT,
+         MIL_TEXT("M_DEFAULT"),
+         M_DEFAULT,
+         DigitizerIdVarPtr);
+
+
+   /* allocate an image buffer */
+   if (ImageIdVarPtr != M_NULL)
+      LocalBufferAllocDefault(SystemIdVarPtr,
+         DisplayIdVarPtr,
+         DigitizerIdVarPtr,
+         ImageIdVarPtr);
+
+   }
+
+
+/************************************************************************/
+/* MappFreeDefault - macro to free default MIL objects:                 */
+/*                                                                      */
+/* MIL_ID ContextAppId;                                                 */
+/* MIL_ID SystemId;                                                     */
+/* MIL_ID DisplayId;                                                    */
+/* MIL_ID DigitizerId;                                                  */
+/* MIL_ID ImageId;                                                      */
+/*                                                                      */
+/************************************************************************/
+INL_FUNC_PREFIX void MappFreeDefault(MIL_ID ContextAppId, MIL_ID SystemId, MIL_ID DisplayId, MIL_ID DigitizerId, MIL_ID BufferId)
+   {
+
+   /* free the image buffer */
+   if (BufferId != M_NULL)
+      {
+      MbufFree(BufferId);
+      }
+
+   /* free digitizer */
+   if (DigitizerId != M_NULL)
+      {
+      MdigFree(DigitizerId);
+      }
+
+   /* free the display */
+   if (DisplayId != M_NULL)
+      {
+      MdispFree(DisplayId);
+      }
+
+   /* free the system */
+   if (SystemId != M_NULL)
+      {
+      MsysFree((SystemId));
+      }
+
+   /* free the application */
+   if (ContextAppId != M_NULL)
+      {
+      MappFree(ContextAppId);
+      }
+   }
+
+#if M_MIL_USE_MIL_UNIQUE_ID && M_MIL_USE_MOVE_SEMANTICS
+
+inline void MappAllocDefault(MIL_INT64           InitFlag       ,
+                             MIL_UNIQUE_APP_ID*  ContextAppIdPtr,
+                             MIL_UNIQUE_SYS_ID*  SysIdPtr       ,
+                             MIL_UNIQUE_DISP_ID* DispIdPtr      ,
+                             MIL_UNIQUE_DIG_ID*  DigIdPtr       ,
+                             MIL_UNIQUE_BUF_ID*  ImageBufIdPtr  )
+   {
+   MIL_ID ContextAppId = M_NULL;
+   MIL_ID SysId        = M_NULL;
+   MIL_ID DispId       = M_NULL;
+   MIL_ID DigId        = M_NULL;
+   MIL_ID ImageBufId   = M_NULL;
+   MappAllocDefault(InitFlag,
+                    ContextAppIdPtr ? &ContextAppId : M_NULL,
+                    SysIdPtr        ? &SysId        : M_NULL,
+                    DispIdPtr       ? &DispId       : M_NULL,
+                    DigIdPtr        ? &DigId        : M_NULL,
+                    ImageBufIdPtr   ? &ImageBufId   : M_NULL);
+   if (ContextAppIdPtr) ContextAppIdPtr->reset(ContextAppId);
+   if (SysIdPtr       ) SysIdPtr       ->reset(SysId       );
+   if (DispIdPtr      ) DispIdPtr      ->reset(DispId      );
+   if (DigIdPtr       ) DigIdPtr       ->reset(DigId       );
+   if (ImageBufIdPtr  ) ImageBufIdPtr  ->reset(ImageBufId  );
+   }
+
+#endif // M_MIL_USE_MIL_UNIQUE_ID && M_MIL_USE_MOVE_SEMANTICS
+
+#undef INL_FUNC_PREFIX
+#else
+#define M_MIL_USE_APP_ALLOC_DEFAULT 0
+#endif
+
+#ifndef M_GROUP
+#define M_GROUP                                       MAKE_INT64(0x0000400000000000)
+#endif
+
+/************************************************************************/
+/* MIL low-level DTK prototypes */
+#include <milfuncll.h>
+
+
+
+
+
+//Add deleted PNFC constants
+#if MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+#ifdef PFNC_H
+#ifndef PFNC_MONO
+
+#define PFNC_MONO                                  0x01000000
+#define PFNC_RGB                                   0x02000000
+#define PFNC16_YUV                                 0x0600
+#define PFNC16_422                                 0x0020
+
+#define PFNC16_8_BITS                              0x0001
+
+#define PFNC_OCCUPY8BIT                            0x00080000
+#define PFNC_OCCUPY10BIT                           0x000A0000
+#define PFNC_OCCUPY12BIT                           0x000C0000
+#define PFNC_OCCUPY16BIT                           0x00100000
+#define PFNC_OCCUPY24BIT                           0x00180000
+
+#define PFNC_MONO8_ID                              (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x0001)
+#define GEV_MONO10_PACKED_ID                       (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0004)
+#define GEV_MONO12_PACKED_ID                       (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0006)
+#define PFNC_MONO10_ID                             (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0003)
+#define PFNC_MONO12_ID                             (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0005)
+#define PFNC_MONO14_ID                             (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0025)
+#define PFNC_MONO16_ID                             (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0007)
+#define PFNC_RGB8_ID                               (PFNC_RGB  | PFNC_OCCUPY24BIT  | 0x0014)
+#define PFNC_BGR8_ID                               (PFNC_RGB  | PFNC_OCCUPY24BIT  | 0x0015)
+#define PFNC_BAYERGR8_ID                           (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x0008)
+#define PFNC_BAYERRG8_ID                           (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x0009)
+#define PFNC_BAYERGB8_ID                           (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x000A)
+#define PFNC_BAYERBG8_ID                           (PFNC_MONO | PFNC_OCCUPY8BIT   | 0x000B)
+#define PFNC_BGRa8_ID                              (PFNC_RGB  | PFNC_OCCUPY32BIT  | 0x0017)
+#define PFNC_BAYERGR10_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x000C)
+#define PFNC_BAYERRG10_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x000D)
+#define PFNC_BAYERGB10_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x000E)
+#define PFNC_BAYERBG10_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x000F)
+#define PFNC_BAYERGR12_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0010)
+#define PFNC_BAYERRG12_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0011)
+#define PFNC_BAYERGB12_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0012)
+#define PFNC_BAYERBG12_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0013)
+#define PFNC_BAYERGR16_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x002E)
+#define PFNC_BAYERRG16_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x002F)
+#define PFNC_BAYERGB16_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0030)
+#define PFNC_BAYERBG16_ID                          (PFNC_MONO | PFNC_OCCUPY16BIT  | 0x0031)
+#define GEV_BAYGR10_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0026)
+#define GEV_BAYRG10_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0027)
+#define GEV_BAYGB10_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0028)
+#define GEV_BAYBG10_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x0029)
+#define GEV_BAYGR12_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x002A)
+#define GEV_BAYRG12_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x002B)
+#define GEV_BAYGB12_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x002C)
+#define GEV_BAYBG12_PACKED_ID                      (PFNC_MONO | PFNC_OCCUPY12BIT  | 0x002D)
+#define PFNC_RGB10_ID                              (PFNC_RGB  | PFNC_OCCUPY48BIT  | 0x0018)
+#define PFNC_RGB12_ID                              (PFNC_RGB  | PFNC_OCCUPY48BIT  | 0x001A)
+#define PFNC_BGR10_ID                              (PFNC_RGB  | PFNC_OCCUPY48BIT  | 0x0019)
+#define PFNC_BGR12_ID                              (PFNC_RGB  | PFNC_OCCUPY48BIT  | 0x001B)
+#define PFNC_YUV422_8_UYVY_ID                      (PFNC_RGB  | PFNC_OCCUPY16BIT  | 0x001F)
+#define PFNC_YUV422_8_ID16                         (PFNC16_YUV       | PFNC16_422      | PFNC16_8_BITS)
+#define PFNC_YUV422_8_ID                           (PFNC_RGB  | PFNC_OCCUPY16BIT  | 0x0032)
+
+#endif // PFNC_MONO
+#endif //PFNC_H
+#endif //MIL_COMPILE_VERSION < MIL_COMPILE_NEXT_MAJOR_VERSION
+
+#endif
diff --git a/Lib/Matrox/Include/MilDSFCapture.h b/Lib/Matrox/Include/MilDSFCapture.h
new file mode 100644
index 0000000..b600106
--- /dev/null
+++ b/Lib/Matrox/Include/MilDSFCapture.h
@@ -0,0 +1,618 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MilCaptureBase.H
+* Revision     :  10.30.0643
+* Content      :  This file contains the interface structure required for 
+*                 MIL Capture DirectShow Filter.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+
+#pragma once
+#pragma warning(disable:4995)
+
+#include <initguid.h>
+#include "MilDSFCaptureGUID.h"
+
+#include <mil.h>
+
+#define MEDIASUBTYPE_INVERTED 0x10000000L
+enum MEDIASUBTYPE_FORMAT
+{
+   MF_UNKNOWN     = -1,
+   MF_RGB32       = 0,
+   MF_YUV16       = 1,
+   MF_NV12        = 2,
+   MF_RGB24       = 3,
+   MF_ARGB32      = 4,
+   MF_RGB32_INV   = MEDIASUBTYPE_INVERTED|MF_RGB32,
+   MF_RGB24_INV   = MEDIASUBTYPE_INVERTED|MF_RGB24,
+   MF_ARGB32_INV  = MEDIASUBTYPE_INVERTED|MF_ARGB32,
+};
+
+enum CAPTURE_BUFFER_FORMAT
+{
+   CBF_UNKNOWN    = -1,
+   CBF_BGR32      = 0,
+   CBF_YUV16_YUYV = 1,
+   CBF_MONO8      = 2,
+};
+
+enum PinDbgParam
+   {
+   PRINT_PIN_FRAME_COUNTER,
+   PRINT_PIN_TIMESTAMP,
+   };
+
+/////////////////////////////////////////////////////////////////
+//
+// Interface         : IMilCapture
+//
+// Synopsis          : Access the system
+//
+// Comments          : for the functions begining with "sys" they are
+//                      equivalent to Msys from Mil but you do not
+//                      need to place the MIL_ID of the system
+//
+/////////////////////////////////////////////////////////////////
+DECLARE_INTERFACE_(IMilCapture, IBaseFilter)
+   {
+   // USE THIS METHOD BEFORE ADDING THE FILTER
+#if UNICODE
+#define setSystemInfo setSystemInfoW
+#else
+#define setSystemInfo setSystemInfoA
+#endif
+
+   STDMETHOD(setSystemInfoA)
+      ( THIS_
+      const char* systemName, // [in] system descriptor string
+      MIL_INT devNum // [in] system Number
+      )  PURE;
+
+   STDMETHOD(setSystemInfoW)
+      ( THIS_
+      const wchar_t* systemName, // [in] system descriptor string
+      MIL_INT devNum // [in] system Number
+      )  PURE;
+
+   STDMETHOD(getAppID)
+      ( THIS_
+      MIL_ID* appID  // [out] adress to contain the returning application MIL_ID
+      )  PURE;
+
+   // -------------------------------------------------------------------------
+   // Mil System exposed function
+   // -------------------------------------------------------------------------
+   // Same Call as Mil MsysControl without SystemId
+   STDMETHOD(sysControl)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT ControlValue
+      )  PURE;
+
+   // Same Call as Mil MsysGetHookInfo without SystemId
+   STDMETHOD(sysGetHookInfo)
+      ( THIS_
+      MIL_ID EventId,
+      MIL_INT64 InquireType,
+      MIL_INT* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MsysHookFunction without SystemId
+   STDMETHOD(sysHookFunction)
+      ( THIS_
+      MIL_INT HookType,
+      MIL_SYS_HOOK_FUNCTION_PTR HookHandlerPtr,
+      void* UserDataPtr
+      )  PURE;
+
+   // *************************************************************************
+   // Multiple definition for sysInquire to support all output format
+   // *************************************************************************
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT32* UserVarPtr 
+      )  PURE;
+
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT64* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_TEXT_CHAR* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT32* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MsysInquire without SystemId
+   STDMETHOD(sysInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT64* UserVarPtr
+      )  PURE;
+#endif // M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+   };
+
+
+/////////////////////////////////////////////////////////////////
+//
+// Interface         : IMilCapturePin
+//
+// Synopsis          : Access the digitizer
+//
+// Comments          : for the functions begining with "dig" they are
+//                      equivalent to Mdig call from Mil but you do not
+//                      need to place the MIL_ID of the Digitizer
+//
+/////////////////////////////////////////////////////////////////
+DECLARE_INTERFACE_(IMilCapturePin, IPin)
+   {
+#if UNICODE
+#define set_DigitizerInfo set_DigitizerInfoW
+#else
+#define set_DigitizerInfo set_DigitizerInfoA
+#endif
+
+   STDMETHOD(DigAlloc)
+      (THIS_
+         bool bRealloc = false
+         )  PURE;
+
+   STDMETHOD(DigFree)
+      (THIS_
+         )  PURE;
+
+   STDMETHOD(set_DigitizerInfoW)
+      ( THIS_
+      MIL_INT DevNum,   // [in] Digitizer Number.
+      MIL_INT64 ChNum,  // [in] Digitizer channel Number.
+      const wchar_t* DCFPath    // [in] complete string to represent the DCF.
+      )  PURE;
+
+   STDMETHOD(set_DigitizerInfoA)
+      ( THIS_
+      MIL_INT DevNum,   // [in] Digitizer Number.
+      MIL_INT64 ChNum,  // [in] Digitizer channel Number.
+      const char* DCFPath    // [in] complete string to represent the DCF.
+      )  PURE;
+
+   STDMETHOD(get_FIFOSize)
+      ( THIS_
+      MIL_INT* FIFOSize // [out] Number of buffer to allocate for MdigProcess.
+      )  PURE;
+
+   STDMETHOD(set_FIFOSize)
+      ( THIS_
+      MIL_INT FIFOSize // [in] Number of buffer to allocate for MdigProcess.
+      )  PURE;
+
+   STDMETHOD(is_DigAllocated)
+      ( THIS_
+      )  PURE;
+
+   STDMETHOD(set_DebugParam)
+      ( THIS_
+      PinDbgParam DebugOptionType, // [in] Debug parameter ID.
+      MIL_INT DebugOptionValue // [in] Value to set.
+      )  PURE;
+
+   STDMETHOD(get_DebugParam)
+      ( THIS_
+      PinDbgParam DebugOptionType, // [in] Debug parameter ID.
+      MIL_INT* DebugOptionValue // [out] Value of the parameter.
+      )  PURE;
+
+   // Function moves specified MediaSubType Format to desired rank
+   STDMETHOD(Set_PinMediaSubTypePriority)
+      ( THIS_
+      MEDIASUBTYPE_FORMAT mfID,  // [in] Pin MediaSubtype format to move.
+      MIL_INT priorityIdx        // [in] position indexed at 0 of the rank in priority.
+      )  PURE;
+
+   STDMETHOD(Get_PinMediaSubTypeAtPriority)
+      ( THIS_
+      MIL_INT priorityIdx,       // [in] position indexed at 0 of the rank in priority.
+      MEDIASUBTYPE_FORMAT* mfID  // [out] Pin MediaSubtype format pointer.
+      )  PURE;
+
+   // Function moves specified Capture Buffer Format to desired rank
+   STDMETHOD(Set_CaptureBufferFormatPriority)
+      ( THIS_
+      CAPTURE_BUFFER_FORMAT cbfID,  // [in] Capture Buffer Format to move.
+      MIL_INT priorityIdx           // [in] position indexed at 0 of the rank in priority.
+      )  PURE;
+
+   STDMETHOD(Get_CaptureBufferFormatAtPriority)
+      ( THIS_
+      MIL_INT priorityIdx,          // [in] position indexed at 0 of the rank in priority.
+      CAPTURE_BUFFER_FORMAT* cbfID  // [out] Capture Buffer Format pointer.
+      )  PURE;
+
+   STDMETHOD_(void, Set_SyncFrameRate)
+      ( THIS_
+      BOOL bForce,                  // [in] force to use the custom value.
+      MIL_DOUBLE fSyncFrameRate     // [in] specifies the frame rate used for synchronization.
+      )  PURE;
+
+   // Return if the value was forced to a custom value.
+   // true means the value is set to a custom value
+   // false means it uses the digitizer internal value
+   STDMETHOD_(BOOL, IsForcedSyncFrameRate)
+      ( THIS_
+      MIL_DOUBLE* pfSyncFrameRate
+      )  PURE;
+
+
+   // -------------------------------------------------------------------------
+   // Mil Digitizer exposed function
+   // -------------------------------------------------------------------------
+   // Same Call as Mil MdigChannel without DigId
+   __declspec(deprecated) STDMETHOD(digChannel)
+      ( THIS_
+      MIL_INT64 channel
+      )  PURE;
+
+   // Same Call as Mil MdigControl without DigId
+   STDMETHOD(digControl)
+      ( THIS_
+      MIL_INT64  ControlType,
+      MIL_DOUBLE ControlValue
+      )  PURE;
+
+   // Same Call as Mil MdigControl without DigId
+   STDMETHOD(digControl)
+      ( THIS_
+      MIL_INT64  ControlType,
+      MIL_INT32 ControlValue
+      )  PURE;
+
+   // Same Call as Mil MdigControl without DigId
+   STDMETHOD(digControl)
+      ( THIS_
+      MIL_INT64  ControlType,
+      MIL_INT64 ControlValue
+      )  PURE;
+
+   // Same Call as Mil MdigControl without DigId
+   STDMETHOD(digControl)
+      (THIS_
+         MIL_INT64  ControlType,
+         MIL_CONST_TEXT_PTR ControlValue
+         )  PURE;
+
+#if UNICODE
+#define digControlFeature digControlFeatureW
+#else
+#define digControlFeature digControlFeatureA
+#endif
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      char* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT64* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_DOUBLE* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT32* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_UINT8* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureA)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      int FeatureValue
+      )  PURE;
+
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_TEXT_CHAR* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT64* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_DOUBLE* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT32* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_UINT8* FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigControlFeature without DigitizerId
+   STDMETHOD(digControlFeatureW)
+      ( THIS_
+      MIL_INT64 ControlFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      int FeatureValue
+      )  PURE;
+
+   // *************************************************************************
+   // Multiple definition for digGetHookInfo to support all output format
+   // *************************************************************************
+   // Same Call as Mil MdigGetHookInfo without DigId
+   STDMETHOD(digGetHookInfo)
+      ( THIS_
+      MIL_ID EventId,
+      MIL_INT64 InfoType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigGetHookInfo
+   STDMETHOD(digGetHookInfo)
+      ( THIS_
+      MIL_ID EventId,
+      MIL_INT64 InfoType,
+      MIL_INT* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigHokfunction without DigId
+   STDMETHOD(digHookFunction)
+      ( THIS_
+      MIL_INT HookType,
+      MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr,
+      void* UserDataPtr
+      )  PURE;
+
+   // *************************************************************************
+   // Multiple definition for digInquire to support all output format
+   // *************************************************************************
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT32* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT64* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_TEXT_CHAR* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT32* UserVarPtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquire without DigId
+   STDMETHOD(digInquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT64* UserVarPtr
+      )  PURE;
+#endif // M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+#if UNICODE
+#define digInquireFeature digInquireFeatureW
+#else
+#define digInquireFeature digInquireFeatureA
+#endif
+
+   // Same Call as Mil MdigInquireFeature without DigitizerId
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      char* FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT64 *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_DOUBLE *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT32 *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureA)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const char* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_UINT8 *FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigInquireFeature without DigitizerId
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_TEXT_CHAR* FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT64 *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_DOUBLE *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_INT32 *FeatureValuePtr
+      )  PURE;
+
+   STDMETHOD(digInquireFeatureW)
+      ( THIS_
+      MIL_INT64 InquireFlag,
+      const wchar_t* FeatureName,
+      MIL_INT64 FeatureDataType,
+      MIL_UINT8 *FeatureValuePtr
+      )  PURE;
+
+   // Same Call as Mil MdigReference without DigId
+   __declspec(deprecated) STDMETHOD(digReference)
+      ( THIS_
+      MIL_INT64  ReferenceType,
+      MIL_DOUBLE ReferenceLevel
+      )  PURE;
+   };
+
+// callback definition
+typedef void (*MANAGEDCALLBACKPROC)(MIL_ID bufID, AM_MEDIA_TYPE *pmt, void* userCallbackData);
+
+/////////////////////////////////////////////////////////////////
+//
+// Interface         : IMilSampleGrabber
+//
+// Synopsis          : Receive hook on each Media Sample
+//
+// Comments          : 
+//
+/////////////////////////////////////////////////////////////////
+DECLARE_INTERFACE_(IMilSampleGrabber, IUnknown)
+   {
+   STDMETHOD(RegisterCallback)
+      ( THIS_
+      MANAGEDCALLBACKPROC callback,
+      void* UserCallbackData=NULL
+      )  PURE;
+
+   STDMETHOD(SetMediaType)
+      ( THIS_
+      const AM_MEDIA_TYPE *pType
+      )  PURE;
+   };
diff --git a/Lib/Matrox/Include/MilDSFCaptureGUID.h b/Lib/Matrox/Include/MilDSFCaptureGUID.h
new file mode 100644
index 0000000..12023dc
--- /dev/null
+++ b/Lib/Matrox/Include/MilDSFCaptureGUID.h
@@ -0,0 +1,44 @@
+锘�
+/************************************************************************/
+/*
+*
+* Filename     :  MilCaptureFilterUids.H
+* Revision     :  10.30.0643
+* Content      :  This file contains the GUIDs relative to the  
+*                 MIL Capture DirectShow Filter.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+
+#pragma once
+
+
+// {F39B53A0-9881-468A-B256-2AFCDC070A18}
+DEFINE_GUID(CLSID_MilSampleGrabber, 
+   0xf39b53a0, 0x9881, 0x468a, 0xb2, 0x56, 0x2a, 0xfc, 0xdc, 0x7, 0xa, 0x18);
+
+// {54CEB8AD-D0DB-474D-B3A8-2282F7249192}
+DEFINE_GUID(CLSID_MilCapture,
+   0x54ceb8ad, 0xd0db, 0x474d, 0xb3, 0xa8, 0x22, 0x82, 0xf7, 0x24, 0x91, 0x92);
+
+//
+// IMilCapture's GUID
+//
+// {39450A9A-2ACC-42A2-8D40-0FC3DA005767}
+DEFINE_GUID(IID_IMilCapture, 
+   0x39450a9a, 0x2acc, 0x42a2, 0x8d, 0x40, 0xf, 0xc3, 0xda, 0x0, 0x57, 0x67);
+
+// {88D68975-9802-444F-9B37-1EC5E978C14A}
+DEFINE_GUID(IID_IMilCapturePin, 
+   0x88d68975, 0x9802, 0x444f, 0x9b, 0x37, 0x1e, 0xc5, 0xe9, 0x78, 0xc1, 0x4a);
+
+//
+// IMilSampleGraber's GUID
+//
+// {9491EF84-DC84-4793-9272-0CFAE6B50502}
+DEFINE_GUID(IID_IMilSampleGrabber, 
+   0x9491ef84, 0xdc84, 0x4793, 0x92, 0x72, 0xc, 0xfa, 0xe6, 0xb5, 0x5, 0x2);
diff --git a/Lib/Matrox/Include/MilDSFSequence.h b/Lib/Matrox/Include/MilDSFSequence.h
new file mode 100644
index 0000000..70f2d64
--- /dev/null
+++ b/Lib/Matrox/Include/MilDSFSequence.h
@@ -0,0 +1,168 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MilDSFSequence.H
+* Revision     :  10.30.0643
+* Content      :  This file contains the interface structure required for 
+*                 Matrox Image Compression Filter.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+
+#pragma once
+#pragma warning(disable:4995)
+
+#include <initguid.h>
+#include "MilDSFSequenceGUID.h"
+
+#include <mil.h>
+
+/////////////////////////////////////////////////////////////////
+//
+// Interface         : IMilSequenceEncode
+//
+// Synopsis          : Access the encoding context
+//
+// Comments          : Control and Inquire functions are equivalent to
+//                     MseqControl and MseqInquire except you do not have to
+//                     specify a MIL_ID for the sequence context.
+//
+/////////////////////////////////////////////////////////////////
+DECLARE_INTERFACE_(IMilSequenceEncode, IBaseFilter)
+   {
+   STDMETHOD_(MIL_ID, GetMilSystemId)
+      (THIS_)PURE;
+
+   STDMETHOD_(void, Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_DOUBLE ControlValue
+      )  PURE;
+
+   STDMETHOD_(void, Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT32 ControlValue
+      )  PURE;
+
+   STDMETHOD_(void, Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT64 ControlValue
+      )  PURE;
+
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT32* UserVarPtr
+      )  PURE;
+
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT64* UserVarPtr
+      )  PURE;
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT32* UserVarPtr
+      )  PURE;
+
+   STDMETHOD_(MIL_INT, Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT64* UserVarPtr
+      )  PURE;
+#endif // M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+   STDMETHOD (InitParam)
+      ( THIS_
+      MIL_UINT32 OutputFormat,
+      MIL_INT64 InitFlag
+      )  PURE;
+
+   STDMETHOD(GetInitFlag)
+      ( THIS_
+      MIL_INT64* pInitFlag
+      )  PURE;
+   };
+
+
+DECLARE_INTERFACE_(IMilSequenceDecode, IBaseFilter)
+   {
+   STDMETHOD_(MIL_ID, GetMilSystemId)
+      (THIS_)PURE;
+
+   STDMETHOD(Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_DOUBLE ControlValue
+      )  PURE;
+
+   STDMETHOD(Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT32 ControlValue
+      )  PURE;
+
+   STDMETHOD(Control)
+      ( THIS_
+      MIL_INT64 ControlType,
+      MIL_INT64 ControlValue
+      )  PURE;
+
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_DOUBLE* UserVarPtr
+      )  PURE;
+
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT32* UserVarPtr
+      )  PURE;
+
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_INT64* UserVarPtr
+      )  PURE;
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT32* UserVarPtr
+      )  PURE;
+
+   STDMETHOD(Inquire)
+      ( THIS_
+      MIL_INT64 InquireType,
+      MIL_UINT64* UserVarPtr
+      )  PURE;
+#endif // M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+   STDMETHOD (InitParam)
+      ( THIS_
+      MIL_UINT32 OutputFormat,
+      MIL_INT64 InitFlag
+      )  PURE;
+
+   STDMETHOD(GetInitFlag)
+      (THIS_
+      MIL_INT64* pInitFlag
+      )  PURE;
+   };
diff --git a/Lib/Matrox/Include/MilDSFSequenceGUID.h b/Lib/Matrox/Include/MilDSFSequenceGUID.h
new file mode 100644
index 0000000..60ac898
--- /dev/null
+++ b/Lib/Matrox/Include/MilDSFSequenceGUID.h
@@ -0,0 +1,33 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MilDSFSequenceGUID.H
+* Revision     :  10.30.0643
+* Content      :  This file contains the GUIDs relative to the  
+*                 Matrox Image Compression Filter.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+
+#pragma once
+
+// {B218240E-DC4B-477B-83A7-57611302555D}
+DEFINE_GUID(CLSID_MilSequenceEncode, 
+            0xb218240e, 0xdc4b, 0x477b, 0x83, 0xa7, 0x57, 0x61, 0x13, 0x2, 0x55, 0x5d);
+
+// {80B8662C-1FD1-438D-BE7B-FA580B30F31C}
+DEFINE_GUID(CLSID_MilSequenceDecode, 
+            0x80b8662c, 0x1fd1, 0x438d, 0xbe, 0x7b, 0xfa, 0x58, 0xb, 0x30, 0xf3, 0x1c);
+
+
+// {D83CE998-4E95-42F0-9BE0-9C32A2954C1A}
+DEFINE_GUID(IID_IMilSequenceEncode, 
+            0xd83ce998, 0x4e95, 0x42f0, 0x9b, 0xe0, 0x9c, 0x32, 0xa2, 0x95, 0x4c, 0x1a);
+
+// {570480A1-1D35-4822-997D-01C683A0C5F3}
+DEFINE_GUID(IID_IMilSequenceDecode, 
+            0x570480a1, 0x1d35, 0x4822, 0x99, 0x7d, 0x1, 0xc6, 0x83, 0xa0, 0xc5, 0xf3);
diff --git a/Lib/Matrox/Include/MilDyn.h b/Lib/Matrox/Include/MilDyn.h
new file mode 100644
index 0000000..40dd255
--- /dev/null
+++ b/Lib/Matrox/Include/MilDyn.h
@@ -0,0 +1,20 @@
+锘�//==============================================================================
+// Filename:  MILDYN.H
+// Created by: M10U107.
+// Content:  This file was dynamically created by the Mil installation program.
+// COPYRIGHT (c) Matrox Electronic Systems Ltd.
+// All Rights Reserved
+//==============================================================================
+
+#define M_MIL_LITE 1
+#if !M_MIL_USE_64BIT
+#error "Win64 installation: Please select the x64 configuration."
+#endif
+
+#include "MilDyn\mil3ddisp.h"
+#include "MilDyn\mil3dgeo.h"
+#include "MilDyn\mil3dgra.h"
+#include "MilDyn\milcom.h"
+#include "MilDyn\mildisplay.h"
+#include "MilDyn\milim.h"
+#include "MilDyn\PFNC.h"
diff --git a/Lib/Matrox/Include/MilFunc.h b/Lib/Matrox/Include/MilFunc.h
new file mode 100644
index 0000000..89cc971
--- /dev/null
+++ b/Lib/Matrox/Include/MilFunc.h
@@ -0,0 +1,455 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILFUNC.H
+    Revision:  10.40.0640
+    Content :  This file contains the prototypes for the Matrox
+               Imaging Library (MIL) Mfunc user's functions.
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef __MILFUNC_H
+#define __MILFUNC_H
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/***************************************************************************/
+/* TOOLKIT FOR PSEUDO MIL FUNCTIONS DEVELOPMENT                            */
+/***************************************************************************/
+typedef void (MFTYPE *MIL_FUNC_FUNCTION_PTR)(MIL_ID FunctionId);
+typedef MIL_FUNC_FUNCTION_PTR MFUNCSLAVEFCTPTR;
+typedef MIL_FUNC_FUNCTION_PTR MFUNCFCTPTR;
+typedef MIL_FUNC_FUNCTION_PTR MFUNCSLAVEPAFCTPTR;
+
+// we need the ASCII version even on non-Unicode version
+// this is needed for transferring ASCII strings in DMIL 
+MIL_DLLFUNC void MFTYPE MfuncParamMilTextA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXTA_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstMilTextA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTA_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamFilenameA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTA_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+#if M_MIL_USE_UNICODE
+   MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocW(MIL_CONST_TEXTW_PTR FunctionName,
+                             MIL_INT ParameterNum,
+                             MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr,
+                             MIL_CONST_TEXTW_PTR SlaveFunctionDLLName,
+                             MIL_CONST_TEXTW_PTR SlaveFunctionName,
+                             MIL_INT SlaveFunctionOpcode,
+                             MIL_INT64 InitFlag,
+                             MIL_ID *CBasedContextFuncIdPtr);
+   MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocA(MIL_CONST_TEXTA_PTR FunctionName,
+                             MIL_INT ParameterNum,
+                             MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr,
+                             MIL_CONST_TEXTA_PTR SlaveFunctionDLLName,
+                             MIL_CONST_TEXTA_PTR SlaveFunctionName,
+                             MIL_INT SlaveFunctionOpcode,
+                             MIL_INT64 InitFlag,
+                             MIL_ID *CBasedContextFuncIdPtr);
+
+   MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocScriptW(MIL_CONST_TEXTW_PTR FunctionName,
+                             MIL_INT ParameterNum,
+                             MIL_CONST_TEXTW_PTR InterpreterLanguage,
+                             MIL_CONST_TEXTW_PTR ScriptFileName,
+                             MIL_CONST_TEXTW_PTR ScriptFunctionName,
+                             MIL_INT ScriptFunctionOpcode,
+                             MIL_INT64 InitFlag,
+                             MIL_ID *ScriptBasedContextFuncIdPtr);
+   MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocScriptA(MIL_CONST_TEXTA_PTR FunctionName,
+                             MIL_INT ParameterNum,
+                             MIL_CONST_TEXTA_PTR InterpreterLanguage,
+                             MIL_CONST_TEXTA_PTR ScriptFileName,
+                             MIL_CONST_TEXTA_PTR ScriptFunctionName,
+                             MIL_INT ScriptFunctionOpcode,
+                             MIL_INT64 InitFlag,
+                             MIL_ID *ScriptBasedContextFuncIdPtr);
+
+   MIL_DLLFUNC MIL_INT MFTYPE MfuncErrorReportW(MIL_ID ContextFuncId,
+                                    MIL_INT ErrorCode,
+                                    MIL_CONST_TEXTW_PTR ErrorMessage,
+                                    MIL_CONST_TEXTW_PTR ErrorSubMessage1,
+                                    MIL_CONST_TEXTW_PTR ErrorSubMessage2,
+                                    MIL_CONST_TEXTW_PTR ErrorSubMessage3);
+   MIL_DLLFUNC MIL_INT MFTYPE MfuncErrorReportA(MIL_ID ContextFuncId,
+                                    MIL_INT ErrorCode,
+                                    MIL_CONST_TEXTA_PTR ErrorMessage,
+                                    MIL_CONST_TEXTA_PTR ErrorSubMessage1,
+                                    MIL_CONST_TEXTA_PTR ErrorSubMessage2,
+                                    MIL_CONST_TEXTA_PTR ErrorSubMessage3);
+
+   MIL_DLLFUNC void MFTYPE MfuncParamMilTextW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXTW_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+   MIL_DLLFUNC void MFTYPE MfuncParamConstMilTextW(MIL_ID ContextFuncId, MIL_INT ParamIndex,MIL_CONST_TEXTW_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+   MIL_DLLFUNC void MFTYPE MfuncParamFilenameW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTW_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+   MIL_DLLFUNC MIL_INT MFTYPE MfuncPrintMessageW(MIL_INT Mode,
+                                     MIL_CONST_TEXTW_PTR Str1,
+                                     MIL_CONST_TEXTW_PTR Str2,
+                                     MIL_CONST_TEXTW_PTR Str3,
+                                     MIL_CONST_TEXTW_PTR Str4,
+                                     MIL_CONST_TEXTW_PTR Str5);
+   MIL_DLLFUNC MIL_INT MFTYPE MfuncPrintMessageA(MIL_INT Mode,
+                                     MIL_CONST_TEXTA_PTR Str1,
+                                     MIL_CONST_TEXTA_PTR Str2,
+                                     MIL_CONST_TEXTA_PTR Str3,
+                                     MIL_CONST_TEXTA_PTR Str4,
+                                     MIL_CONST_TEXTA_PTR Str5);
+   MIL_DLLFUNC void MFTYPE MfuncParamA(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void* ParamValuePtr, MIL_UINT ParamType, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+   MIL_DLLFUNC void MFTYPE MfuncParamW(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void* ParamValuePtr, MIL_UINT ParamType, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+
+   #if M_MIL_UNICODE_API
+      #define MfuncAlloc                     MfuncAllocW
+      #define MfuncAllocScript               MfuncAllocScriptW
+      #define MfuncErrorReport               MfuncErrorReportW
+      #define MfuncParamMilText              MfuncParamMilTextW
+      #define MfuncParamConstMilText         MfuncParamConstMilTextW
+      #define MfuncParamFilename             MfuncParamFilenameW
+      #define MfuncPrintMessage              MfuncPrintMessageW
+      #define MfuncParam                     MfuncParamW
+   #else
+      #define MfuncAlloc                     MfuncAllocA
+      #define MfuncAllocScript               MfuncAllocScriptA
+      #define MfuncErrorReport               MfuncErrorReportA
+      #define MfuncParamMilText              MfuncParamMilTextA
+      #define MfuncParamConstMilText         MfuncParamConstMilTextA
+      #define MfuncParamFilename             MfuncParamFilenameA
+      #define MfuncPrintMessage              MfuncPrintMessageA
+      #define MfuncParam                     MfuncParamA
+   #endif
+   #else
+      MIL_DLLFUNC MIL_ID MFTYPE MfuncAlloc(MIL_CONST_TEXT_PTR FunctionName,
+                              MIL_INT ParameterNum,
+                              MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr,
+                              MIL_CONST_TEXT_PTR SlaveFunctionDLLName,
+                              MIL_CONST_TEXT_PTR SlaveFunctionName,
+                              MIL_INT SlaveFunctionOpcode,
+                              MIL_INT64 InitFlag,
+                              MIL_ID *CBasedContextFuncIdPtr);
+
+      MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocScript(MIL_CONST_TEXT_PTR FunctionName,
+                              MIL_INT ParameterNum,
+                              MIL_CONST_TEXT_PTR InterpreterLanguage,
+                              MIL_CONST_TEXT_PTR ScriptFileName,
+                              MIL_CONST_TEXT_PTR ScriptFunctionName,
+                              MIL_INT ScriptFunctionOpcode,
+                              MIL_INT64 InitFlag,
+                              MIL_ID *ScriptBasedContextFuncIdPtr);
+
+      MIL_DLLFUNC MIL_INT MFTYPE MfuncErrorReport( MIL_ID ContextFuncId,
+                                       MIL_INT ErrorCode,
+                                       MIL_CONST_TEXT_PTR ErrorMessage,
+                                       MIL_CONST_TEXT_PTR ErrorSubMessage1,
+                                       MIL_CONST_TEXT_PTR ErrorSubMessage2,
+                                       MIL_CONST_TEXT_PTR ErrorSubMessage3);
+
+      MIL_DLLFUNC void MFTYPE MfuncParamMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXT_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+      MIL_DLLFUNC void MFTYPE MfuncParamConstMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex,MIL_CONST_TEXT_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+
+      MIL_DLLFUNC void MFTYPE MfuncParamFilename(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXT_PTR ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+
+      MIL_DLLFUNC MIL_INT MFTYPE MfuncPrintMessage(MIL_INT Mode, MIL_CONST_TEXT_PTR Str1,
+                                       MIL_CONST_TEXT_PTR Str2,
+                                       MIL_CONST_TEXT_PTR Str3,
+                                       MIL_CONST_TEXT_PTR Str4,
+                                       MIL_CONST_TEXT_PTR Str5);
+      MIL_DLLFUNC void MFTYPE MfuncParam(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void* ParamValuePtr, MIL_UINT ParamType, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+#endif
+// compatibility function
+#if OldDefinesSupport
+#define MfuncParamString   MfuncParamMilText
+MIL_DEPRECATED(MfuncParamString, 1000)
+#endif
+
+
+MIL_DLLFUNC MIL_ID MFTYPE MfuncAllocId(MIL_ID ContextFuncId, MIL_INT64 MilObjectType, void *UserObjectPtr);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncParamCheck(MIL_ID ContextFuncId);
+MIL_DLLFUNC void MFTYPE MfuncParamMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID ParamValue, MIL_INT64 MilObjectType, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamId MfuncParamMilId // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamId, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamLong (MIL_ID ContextFuncId, MIL_INT ParamIndex, long ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT32 ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT64 ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT32 ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT64 ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_DOUBLE ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UUID ParamValue);
+MIL_DLLFUNC void MFTYPE MfuncParamDataPointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, void *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamDouble MfuncParamMilDouble // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamDouble, 1000)
+#define MfuncParamPointer MfuncParamDataPointer
+MIL_DEPRECATED(MfuncParamPointer, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamIdPointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID *ParamValuePtr, MIL_INT64 MilObjectType, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamValue(MIL_ID ContextFuncId, MIL_INT ParamIndex, void *ParamValuePtr);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncGetError(MIL_ID FunctId, MIL_INT ErrorType,void* ErrorVarPtr);
+MIL_DLLFUNC void MFTYPE MfuncFreeId(MIL_ID ContextFuncId, MIL_ID UserObjectFuncId);
+MIL_DLLFUNC void MFTYPE MfuncFree(MIL_ID ContextFuncId);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncCall(MIL_ID ContextFuncId);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncInquire(MIL_ID MilObjectId, MIL_INT64 InquireType, void* UserVarPtr);
+MIL_DLLFUNC MIL_INT MFTYPE MfuncExit();
+MIL_DLLFUNC void* MFTYPE MfuncMemory(MIL_INT64 Operation, MIL_INT OperationValue, MIL_INT64 OperationFlag, void *DataPointer);
+MIL_DLLFUNC MIL_ID MFTYPE MfuncGetNextId(MIL_ID CurrentId);
+MIL_DLLFUNC void MFTYPE MfuncMDTrace(void** FileHandle, MIL_INT64 Action, void* DataPointer);
+MIL_DLLFUNC void MFTYPE MfuncTraceTimerRead(MIL_DOUBLE* pCurrentTime);
+
+
+/* The following MfuncParamValue are for getting the value by type */
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT32 *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT64 *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT32 *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT64 *ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_DOUBLE *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UUID *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID *ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_DOUBLE **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_DOUBLE **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UUID **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UUID **ParamValuePtr);
+
+#if OldDefinesSupport
+#define MfuncParamValueDouble MfuncParamValueMilDouble                     // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueDouble, 1000)
+#define MfuncParamValueId MfuncParamValueMilId                             // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueId, 1000)
+#define MfuncParamValueArrayDouble MfuncParamValueArrayMilDouble           // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueArrayDouble, 1000)
+#define MfuncParamValueConstArrayDouble MfuncParamValueConstArrayMilDouble // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueConstArrayDouble, 1000)
+#endif
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilTextA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXTA_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstMilTextA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTA_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueFilenameA(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTA_PTR *ParamValuePtr);
+
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+#define MfuncParamValueMilText            MfuncParamValueMilTextW
+#define MfuncParamValueConstMilText       MfuncParamValueConstMilTextW
+#define MfuncParamValueFilename           MfuncParamValueFilenameW
+#else
+#define MfuncParamValueMilText            MfuncParamValueMilTextA
+#define MfuncParamValueConstMilText       MfuncParamValueConstMilTextA
+#define MfuncParamValueFilename           MfuncParamValueFilenameA
+#endif
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilTextW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXTW_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstMilTextW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTW_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueFilenameW(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXTW_PTR *ParamValuePtr);
+
+#else
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_TEXT_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXT_PTR *ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueFilename(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_CONST_TEXT_PTR *ParamValuePtr);
+
+#endif
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT **ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT32 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT32 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT64 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT64 **ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT32 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT32 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT64 **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT64 **ParamValuePtr);
+
+MIL_DLLFUNC void MFTYPE MfuncParamValueArrayMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID **ParamValuePtr);
+#if OldDefinesSupport
+#define MfuncParamValueArrayId MfuncParamValueArrayMilId                          // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueArrayId, 1000)
+#endif
+
+MIL_DLLFUNC void MFTYPE MfuncParamValuePointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, void ** ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstDataPointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void ** ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex,const MIL_ID **ParamValuePtr);
+#if OldDefinesSupport
+#define MfuncParamValueConstArrayId MfuncParamValueConstArrayMilId                // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamValueConstArrayId, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT **ParamValuePtr);
+MIL_DLLFUNC void MFTYPE MfuncParamValueConstArrayMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT **ParamValuePtr);
+
+
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_DOUBLE *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UUID *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamArrayDouble MfuncParamArrayMilDouble   // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamArrayDouble, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_ID *ParamValuePtr, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamArrayId MfuncParamArrayMilId           // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamArrayId, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT32 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_INT64 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT32 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamArrayMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_UINT64 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilDouble(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_DOUBLE *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilUUID(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UUID *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamConstArrayDouble MfuncParamConstArrayMilDouble // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamConstArrayDouble, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilInt32(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT32 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilInt64(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT64 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilUint32(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT32 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilUint64(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT64 *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilId(MIL_ID ContextFuncId, MIL_INT ParamIndex,const MIL_ID *ParamValuePtr, MIL_INT NumOfItems, MIL_INT64 MilObjectType, MIL_INT Attribute);
+#if OldDefinesSupport
+#define MfuncParamConstArrayId MfuncParamConstArrayMilId // it was documented in MIL 9, so keep it
+MIL_DEPRECATED(MfuncParamConstArrayId, 1000)
+#endif
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilInt(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_INT *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+MIL_DLLFUNC void MFTYPE MfuncParamConstArrayMilUint(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_UINT *ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+MIL_DLLFUNC void MFTYPE MfuncParamConstDataPointer(MIL_ID ContextFuncId, MIL_INT ParamIndex, const void * ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute);
+
+typedef struct 
+   {
+   MIL_INT32 StructSize;
+   MIL_INT32 ScriptPathSize;
+   MIL_INT32 ScriptPathOffset;
+   MIL_INT32 ScriptFunctionNameSize;
+   MIL_INT32 ScriptFunctionNameOffset;
+   MIL_INT32 DebugPathSize;
+   MIL_INT32 DebugPathOffset;
+   MIL_INT32 ReferenceListSize;
+   MIL_INT32 ReferenceListOffset;
+   MIL_INT64 Compile;
+   MIL_INT64 DebugInfo;
+   } M_FUNCSCRIPT_CALL_DATA;
+
+/*The following Mfunc functions are obsolete*/
+MIL_DLLFUNC MIL_INT MFTYPE MfuncStart(MIL_ID ContextFuncId);          /*Replaced by MfuncCall*/
+MIL_DLLFUNC void    MFTYPE MfuncFreeAndEnd(MIL_ID ContextFuncId);     /*Replaced by MfuncCall*/
+MIL_DLLFUNC MIL_INT MFTYPE MfuncModified(MIL_ID ImageId);      /*Replaced by MbufControl(M_MODIFIED)*/
+MIL_DLLFUNC MIL_INT MFTYPE MfuncParamRegister(MIL_ID ContextFuncId);  /*Parameters must always be registered*/
+MIL_DLLFUNC MIL_INT MFTYPE MfuncIdGetObjectType(MIL_ID FunctionId, MIL_ID ObjectId);               /*Replaced by MfuncInquire*/
+MIL_DLLFUNC void    MFTYPE MfuncIdSetUserPtr(MIL_ID FunctionId, MIL_ID ObjectId, void *UserPtr);   /*Replaced by MfuncControl*/
+MIL_DLLFUNC void*   MFTYPE MfuncIdGetUserPtr(MIL_ID FunctionId, MIL_ID ObjectId);                  /*Replaced by MfuncInquire*/
+
+#if MIL_COMPILE_VERSION >= 1040 || M_MIL_USE_64BIT
+MIL_DLLFUNC void   MFTYPE MfuncControlInt64(MIL_ID ContextFuncId, MIL_INT64 ControlType, MIL_INT64 ControlValue);
+MIL_DLLFUNC void   MFTYPE MfuncControlDouble(MIL_ID ContextFuncId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue);
+#else
+#define MfuncControlDouble MfuncControl
+#define MfuncControlInt64 MfuncControl
+#endif
+
+#if !M_MIL_USE_64BIT
+MIL_DLLFUNC void   MFTYPE MfuncControl(MIL_ID ContextFuncId, MIL_INT64 ControlType, MIL_DOUBLE ControlValue);
+#endif   //M_MIL_USE_64BIT
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+}
+#endif
+
+#if M_MIL_USE_64BIT
+
+#ifdef __cplusplus
+//////////////////////////////////////////////////////////////
+// MfuncControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+
+inline void MfuncControl(  MIL_ID ContextFuncId,
+                           MIL_INT64 ControlType,
+                           MIL_DOUBLE ControlValue)
+   {
+   MfuncControlDouble(ContextFuncId, ControlType, ControlValue);
+   }
+
+#else
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. Int64 one
+//////////////////////////////////////////////////////////////
+#define MfuncControl MfuncControlInt64
+#endif // __cplusplus
+
+#endif   //M_MIL_USE_64BIT
+
+//////////////////////////////////////////////////////////////
+// MfuncControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#ifdef __cplusplus
+
+#if MIL_COMPILE_VERSION >= 1040 || M_MIL_USE_64BIT
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue)
+   {
+   MfuncControlInt64(ContextFuncId, ControlType, ControlValue);
+   }
+#endif
+
+#if !(M_MIL_USE_LINUX  && M_MIL_USE_64BIT)
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= 1040
+   MfuncControlInt64(ContextFuncId, ControlType, ControlValue);
+#else
+   MfuncControl(ContextFuncId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+#endif
+
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   MIL_INT32 ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= 1040
+   MfuncControlInt64(ContextFuncId, ControlType, ControlValue);
+#else
+   MfuncControl(ContextFuncId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+
+
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MfuncControl(ContextFuncId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+inline void MfuncControl(MIL_ID ContextFuncId,
+   MIL_INT64 ControlType,
+   void* ControlValue)
+   {
+   MfuncControl(ContextFuncId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+#endif
+
+
+#endif
diff --git a/Lib/Matrox/Include/MilFunctionCode.h b/Lib/Matrox/Include/MilFunctionCode.h
new file mode 100644
index 0000000..f1535c0
--- /dev/null
+++ b/Lib/Matrox/Include/MilFunctionCode.h
@@ -0,0 +1,737 @@
+锘�//////////////////////////////////////////////////////////////////////////////
+//
+// Filename          : MilFunctionCode.h
+// Content           : Functions opcodes :
+// Revision          : 10.40.0640
+//                     Values returned by MappGetHookInfo (M_CURRENT_FCT)
+//
+//
+// Copyright (c) Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+//////////////////////////////////////////////////////////////////////////////
+#ifndef __FUNCTIONCODES_H__
+#define __FUNCTIONCODES_H__
+
+#define M_NO_FUNCTION                               0x00000000
+
+#define M_SYS_ALLOC                                 0x00000001  // MsysAlloc
+#define M_SYS_FREE                                  0x00000002  // MsysFree
+#define M_SYS_INQUIRE                               0x00000003  // MsysInquire
+#define M_SYS_CONTROL                               0x00000004  // MsysControl
+#define M_SYS_HOOK_FUNCTION                         0x00000007  // MsysHookFunction
+#define M_SYS_GET_HOOK_INFO                         0x00000008  // MsysGetHookInfo
+#define M_SYS_IO_ALLOC                              0x00000009  // MsysIoAlloc
+#define M_SYS_IO_FREE                               0x0000000A  // MsysIoFree
+#define M_SYS_IO_CONTROL                            0x0000000B  // MsysIoControl
+#define M_SYS_IO_INQUIRE                            0x0000000C  // MsysIoInquire
+#define M_SYS_IO_COMMAND_REGISTER                   0x0000000D  // MsysIoCommandRegister
+#define M_SYS_CONTROL_FEATURE                       0x0000000E  // MsysControlFeature
+#define M_SYS_INQUIRE_FEATURE                       0x0000000F  // MsysInquireFeature
+
+#define M_BUF_ALLOC_2D                              0x00000201  // MbufAlloc2d
+#define M_BUF_CHILD_2D                              0x00000202  // MbufChild2d
+#define M_BUF_FREE                                  0x00000203  // MbufFree
+#define M_BUF_GET_2D                                0x00000204  // MbufGet2d
+#define M_BUF_PUT_2D                                0x00000205  // MbufPut2d
+#define M_BUF_COPY                                  0x00000206  // MbufCopy
+#define M_BUF_COPY_COLOR                            0x00000207  // MbufCopyColor
+#define M_BUF_GET_COLOR_2D                          0x00000208  // MbufGetColor2d
+#define M_BUF_PUT_COLOR_2D                          0x00000209  // MbufPutColor2d
+#define M_BUF_INQUIRE                               0x0000020A  // MbufInquire
+#define M_BUF_CHILD_COLOR_2D                        0x0000020B  // MbufChildColor2d
+#define M_BUF_CLEAR                                 0x0000020C  // MbufClear
+#define M_BUF_COPY_MASK                             0x0000020D  // MbufCopyMask
+#define M_BUF_COPY_COND                             0x0000020E  // MbufCopyCond
+#define M_BUF_CONTROL                               0x00000210  // MbufControl
+#define M_BUF_GET_LINE                              0x00000211  // MbufGetLine
+#define M_BUF_PUT_LINE                              0x00000212  // MbufPutLine
+#define M_BUF_CREATE_COLOR                          0x00000213  // MbufCreateColor
+#define M_BUF_COPY_COLOR_2D                         0x00000215  // MbufCopyColor2d
+#define M_BUF_HOOK_FUNCTION                         0x0000021C  // MbufHookFunction
+#define M_BUF_ALLOC_1D                              0x0000021D  // MbufAlloc1d
+#define M_BUF_ALLOC_COLOR                           0x0000021E  // MbufAllocColor
+#define M_BUF_BAYER                                 0x0000021F  // MbufBayer
+#define M_BUF_CHILD_1D                              0x00000220  // MbufChild1d
+#define M_BUF_CHILD_COLOR                           0x00000221  // MbufChildColor
+#define M_BUF_COPY_CLIP                             0x00000222  // MbufCopyClip
+#define M_BUF_CREATE_2D                             0x00000223  // MbufCreate2d
+#define M_BUF_DISK_INQUIRE                          0x00000224  // MbufDiskInquire
+#define M_BUF_EXPORT                                0x00000225  // MbufExport
+#define M_BUF_EXPORT_SEQUENCE                       0x00000226  // MbufExportSequence
+#define M_BUF_GET                                   0x00000227  // MbufGet
+#define M_BUF_GET_1D                                0x00000228  // MbufGet1d
+#define M_BUF_GET_COLOR                             0x00000229  // MbufGetColor
+#define M_BUF_IMPORT                                0x0000022A  // MbufImport
+#define M_BUF_IMPORT_SEQUENCE                       0x0000022B  // MbufImportSequence
+#define M_BUF_LOAD                                  0x0000022C  // MbufLoad
+#define M_BUF_CONTROL_AREA                          0x0000022D  // MbufControlArea
+#define M_BUF_PUT                                   0x0000022E  // MbufPut
+#define M_BUF_PUT_1D                                0x0000022F  // MbufPut1d
+#define M_BUF_PUT_COLOR                             0x00000230  // MbufPutColor
+#define M_BUF_RESTORE                               0x00000231  // MbufRestore
+#define M_BUF_SAVE                                  0x00000232  // MbufSave
+#define M_BUF_TRANSFER                              0x00000233  // MbufTransfer
+#define M_BUF_GET_HOOK_INFO                         0x00000234  // MbufGetHookInfo
+#define M_BUF_GET_ARC                               0x00000235  // MbufGetArc
+#define M_BUF_CHILD_MOVE                            0x00000237  // MbufChildMove
+#define M_BUF_SET_REGION                            0x00000238  // MbufSetRegion
+#define M_BUF_CLEAR_COND                            0x00000239  // MbufClearCond
+#define M_BUF_LINK                                  0x00000240  // MbufLink
+#define M_BUF_CLONE                                 0x00000241  // MbufClone
+#define M_BUF_CHILD_COLOR_2D_CLIP                   0x00000243  // MbufChildColor2dClip
+#define M_BUF_CONTROL_FEATURE                       0x00000244  // MbufControlFeature
+#define M_BUF_INQUIRE_FEATURE                       0x00000245  // MbufInquireFeature
+#define M_BUF_GET_LIST                              0x00000246  // MbufGetList
+#define M_BUF_PUT_LIST                              0x00000247  // MbufPutList
+#define M_BUF_ALLOC_DEFAULT                         0x0000024A  // MbufAllocDefault
+#define M_BUF_ALLOC_COLOR_NAMED                     0x0000024B  // MbufAllocColorNamed
+#define M_BUF_SET_DYNAMIC_PARAMETERS                0x0000024E  // MbufSetDynamicParameters
+#define M_BUF_STREAM                                0x0000024F  // MbufStream
+#define M_BUF_ALLOC_CONTAINER                       0x00000250  // MbufAllocContainer
+#define M_BUF_ALLOC_COMPONENT                       0x00000251  // MbufAllocComponent
+#define M_BUF_COPY_COMPONENT                        0x00000252  // MbufCopyComponent
+#define M_BUF_FREE_COMPONENT                        0x00000253  // MbufFreeComponent
+#define M_BUF_INQUIRE_CONTAINER                     0x00000254  // MbufInquireContainer
+#define M_BUF_CONTROL_CONTAINER                     0x00000255  // MbufControlContainer
+#define M_BUF_CHILD_CONTAINER                       0x00000256  // MbufChildContainer
+#define M_BUF_CREATE_COMPONENT                      0x00000257  // MbufCreateComponent
+
+#define M_DISP_ALLOC                                0x00000401  // MdispAlloc
+#define M_DISP_FREE                                 0x00000402  // MdispFree
+#define M_DISP_ZOOM                                 0x00000403  // MdispZoom
+#define M_DISP_PAN                                  0x00000404  // MdispPan
+#define M_DISP_SELECT                               0x00000405  // MdispSelect
+#define M_DISP_LUT                                  0x00000406  // MdispLut
+#define M_DISP_INQUIRE                              0x00000407  // MdispInquire
+#define M_DISP_CONTROL                              0x0000040A  // MdispControl
+#define M_DISP_HOOK_FUNCTION                        0x0000040B  // MdispHookFunction
+#define M_DISP_SELECT_WINDOW                        0x0000040C  // MdispSelectWindow
+#define M_DISP_GET_HOOK_INFO                        0x0000040F  // MdispGetHookInfo
+
+#define M_DIG_ALLOC                                 0x00000601  // MdigAlloc
+#define M_DIG_FREE                                  0x00000602  // MdigFree
+#define M_DIG_GRAB                                  0x00000603  // MdigGrab
+#define M_DIG_HALT                                  0x00000605  // MdigHalt
+#define M_DIG_INQUIRE                               0x00000607  // MdigInquire
+#define M_DIG_CONTROL                               0x00000609  // MdigControl
+#define M_DIG_GRAB_WAIT                             0x0000060A  // MdigGrabWait
+#define M_DIG_HOOK_FUNCTION                         0x0000060C  // MdigHookFunction
+#define M_DIG_FOCUS                                 0x0000060D  // MdigFocus
+#define M_DIG_GRAB_CONTINUOUS                       0x0000060E  // MdigGrabContinuous
+#define M_DIG_PROCESS                               0x00000610  // MdigProcess
+#define M_DIG_GET_HOOK_INFO                         0x00000611  // MdigGetHookInfo
+#define M_DIG_CONTROL_FEATURE                       0x00000612  // MdigControlFeature
+#define M_DIG_INQUIRE_FEATURE                       0x00000613  // MdigInquireFeature
+
+#define M_IM_EDGE_DETECT                            0x00000801  // MimEdgeDetect
+#define M_IM_RANK                                   0x00000802  // MimRank
+#define M_IM_CONVOLVE                               0x00000803  // MimConvolve
+#define M_IM_DILATE                                 0x00000804  // MimDilate
+#define M_IM_ERODE                                  0x00000805  // MimErode
+#define M_IM_CLOSE                                  0x00000806  // MimClose
+#define M_IM_OPEN                                   0x00000807  // MimOpen
+#define M_IM_LABEL                                  0x00000808  // MimLabel
+#define M_IM_CONNECT_MAP                            0x00000809  // MimConnectMap
+#define M_IM_THIN                                   0x0000080A  // MimThin
+#define M_IM_THICK                                  0x0000080B  // MimThick
+#define M_IM_DISTANCE                               0x0000080C  // MimDistance
+#define M_IM_WATERSHED                              0x0000080D  // MimWatershed
+#define M_IM_ZONE_OF_INFLUENCE                      0x0000080E  // MimZoneOfInfluence
+#define M_IM_MORPHIC                                0x0000080F  // MimMorphic
+#define M_IM_LOCATE_EVENT                           0x00000812  // MimLocateEvent
+#define M_IM_COUNT_DIFFERENCE                       0x00000813  // MimCountDifference
+#define M_IM_LOCATE_PEAK_1D                         0x00000815  // MimLocatePeak1d
+#define M_IM_TRANSLATE                              0x00000816  // MimTranslate
+#define M_IM_ROTATE                                 0x00000817  // MimRotate
+#define M_IM_WARP                                   0x00000818  // MimWarp
+#define M_IM_POLAR_TRANSFORM                        0x00000819  // MimPolarTransform
+#define M_IM_TRANSFORM                              0x0000081A  // MimTransform
+#define M_IM_DRAW                                   0x0000081B  // MimDraw
+#define M_IM_DEAD_PIXEL_CORRECTION                  0x0000081C  // MimDeadPixelCorrection
+#define M_IM_MATCH                                  0x00000838  // MimMatch
+#define M_IM_WAVELET_TRANSFORM                      0x0000083B  // MimWaveletTransform
+#define M_IM_WAVELET_SET_FILTER                     0x0000083C  // MimWaveletSetFilter
+#define M_IM_HISTOGRAM_EQUALIZE_ADAPTIVE            0x0000083D  // MimHistogramEqualizeAdaptive
+#define M_IM_FIND_ORIENTATION                       0x0000083E  // MimFindOrientation
+#define M_IM_WAVELET_DENOISE                        0x0000083F  // MimWaveletDenoise
+#define M_IM_ADAPTATIVE_LOCATE_PEAK_1D              0x00000840  // MimLocatePeak1d
+#define M_IM_BINARIZE_ADAPTIVE                      0x00000841  // MimBinarizeAdaptive
+#define M_IM_WARP_LIST                              0x00000846  // MimWarpList
+#define M_IM_STAT_CALCULATE                         0x00000847  // MimStatCalculate
+#define M_IM_PROJECTION                             0x00000848  // MimProjection
+#define M_IM_FILTER_ADAPTIVE                        0x0000084E  // MimFilterAdaptive
+#define M_IM_REMAP                                  0x0000084F  // MimRemap
+#define M_IM_AUGMENT                                0x00000851  // MimAugment
+#define M_IM_DIFFERENTIAL                           0x00000853  // MimDifferential
+#define M_IM_BOUNDING_BOX                           0x00000854  // MimBoundingBox
+
+#define M_IM_ARITH                                  0x00000A01  // MimArith
+#define M_IM_ARITH_MULTIPLE                         0x00000A02  // MimArithMultiple
+#define M_IM_SHIFT                                  0x00000A03  // MimShift
+#define M_IM_BINARIZE                               0x00000A04  // MimBinarize
+#define M_IM_CLIP                                   0x00000A05  // MimClip
+#define M_IM_CONVERT                                0x00000A06  // MimConvert
+#define M_IM_FLIP                                   0x00000A07  // MimFlip
+#define M_IM_HISTOGRAM                              0x00000A08  // MimHistogram
+#define M_IM_HISTOGRAM_EQUALIZE                     0x00000A09  // MimHistogramEqualize
+#define M_IM_LUT_MAP                                0x00000A0A  // MimLutMap
+#define M_IM_RESIZE                                 0x00000A0B  // MimResize
+#define M_IM_FIND_EXTREME                           0x00000A0C  // MimFindExtreme
+#define M_IM_DEINTERLACE                            0x00000A0D  // MimDeinterlace
+#define M_IM_ALLOC                                  0x00000A0E  // MimAlloc
+#define M_IM_CONTROL                                0x00000A0F  // MimControl
+#define M_IM_ALLOC_RESULT                           0x00000A10  // MimAllocResult
+#define M_IM_FREE                                   0x00000A11  // MimFree
+#define M_IM_INQUIRE                                0x00000A12  // MimInquire
+#define M_IM_GET_RESULT_1D                          0x00000A13  // MimGetResult1d
+#define M_IM_GET_RESULT                             0x00000A14  // MimGetResult
+#define M_IM_FLAT_FIELD                             0x00000A41  // MimFlatField
+#define M_IM_REARRANGE                              0x00000A43  // MimRearrange
+#define M_IM_GET_RESULT_2D                          0x00000A44  // MimGetResult2d
+#define M_IM_PUT                                    0x00000A45  // MimPut
+#define M_IM_GET                                    0x00000A46  // MimGet
+#define M_IM_ALLOC_RESULT_OBJECT                    0x00000A67  // MimAllocResult
+#define M_IM_GET_RESULT_SINGLE                      0x00000A68  // MimGetResultSingle
+#define M_IM_RESTORE                                0x00000A69  // MimRestore
+#define M_IM_SAVE                                   0x00000A6A  // MimSave
+#define M_IM_STREAM                                 0x00000A6B  // MimStream
+#define M_IM_ROTATE_MULT90                          0x00000A6D  // MimRotate
+
+#define M_SEQ_ALLOC                                 0x00001601  // MseqAlloc
+#define M_SEQ_FREE                                  0x00001602  // MseqFree
+#define M_SEQ_DEFINE                                0x00001603  // MseqDefine
+#define M_SEQ_CONTROL                               0x00001604  // MseqControl
+#define M_SEQ_INQUIRE                               0x00001605  // MseqInquire
+#define M_SEQ_HOOK_FUNCTION                         0x00001606  // MseqHookFunction
+#define M_SEQ_GET_HOOK_INFO                         0x00001607  // MseqGetHookInfo
+#define M_SEQ_FEED                                  0x00001608  // MseqFeed
+#define M_SEQ_PROCESS                               0x00001609  // MseqProcess
+
+#define M_GRA_CLEAR                                 0x00001A01  // MgraClear
+#define M_GRA_DOT                                   0x00001A02  // MgraDot
+#define M_GRA_LINE                                  0x00001A03  // MgraLine
+#define M_GRA_RECT                                  0x00001A04  // MgraRect
+#define M_GRA_RECT_FILL                             0x00001A05  // MgraRectFill
+#define M_GRA_ARC                                   0x00001A06  // MgraArc
+#define M_GRA_ARC_FILL                              0x00001A07  // MgraArcFill
+#define M_GRA_FILL                                  0x00001A08  // MgraFill
+#define M_GRA_TEXT                                  0x00001A09  // MgraText
+#define M_GRA_BACK_COLOR                            0x00001A0A  // MgraBackColor
+#define M_GRA_COLOR                                 0x00001A0B  // MgraColor
+#define M_GRA_DOTS                                  0x00001A0C  // MgraDots
+#define M_GRA_LINES                                 0x00001A0D  // MgraLines
+#define M_GRA_ALLOC                                 0x00001A0E  // MgraAlloc
+#define M_GRA_FREE                                  0x00001A0F  // MgraFree
+#define M_GRA_CONTROL                               0x00001A10  // MgraControl
+#define M_GRA_FONT                                  0x00001A11  // MgraFont
+#define M_GRA_FONT_SCALE                            0x00001A12  // MgraFontScale
+#define M_GRA_INQUIRE                               0x00001A13  // MgraInquire
+#define M_GRA_ALLOC_LIST                            0x00001A14  // MgraAllocList
+#define M_GRA_CONTROL_LIST                          0x00001A15  // MgraControlList
+#define M_GRA_DRAW                                  0x00001A16  // MgraDraw
+#define M_GRA_GET_HOOK_INFO                         0x00001A1A  // MgraGetHookInfo
+#define M_GRA_HOOK_FUNCTION                         0x00001A1B  // MgraHookFunction
+#define M_GRA_INQUIRE_LIST                          0x00001A1C  // MgraInquireList
+#define M_GRA_RECT_ANGLE                            0x00001A1E  // MgraRectAngle
+#define M_GRA_ARC_ANGLE                             0x00001A1F  // MgraArcAngle
+#define M_GRA_INTERACTIVE                           0x00001A2A  // MgraInteractive
+#define M_GRA_COPY                                  0x00001A2C  // MgraCopy
+#define M_GRA_VECTORS                               0x00001A2E  // MgraVectors
+#define M_GRA_VECTORS_GRID                          0x00001A2F  // MgraVectorsGrid
+
+#define M_GEN_LUT_RAMP                              0x00001C01  // MgenLutRamp
+#define M_GEN_LUT_FUNCTION                          0x00001C02  // MgenLutFunction
+#define M_GEN_WARP_PARAMETER                        0x00001C03  // MgenWarpParameter
+#define M_GEN_RAMP                                  0x00001C04  // MgenRamp
+
+#define M_APP_ALLOC                                 0x00002801  // MappAlloc
+#define M_APP_CONTROL                               0x00002803  // MappControl
+#define M_APP_FREE                                  0x00002805  // MappFree
+#define M_APP_GET_ERROR                             0x00002806  // MappGetError
+#define M_APP_GET_HOOK_INFO                         0x00002807  // MappGetHookInfo
+#define M_APP_HOOK_FUNCTION                         0x00002808  // MappHookFunction
+#define M_APP_INQUIRE                               0x00002809  // MappInquire
+#define M_APP_TIMER                                 0x0000280B  // MappTimer
+#define M_APP_FILE_OPERATION                        0x00002811  // MappFileOperation
+#define M_APP_INQUIRE_MP                            0x00002812  // MappInquireMp
+#define M_APP_CONTROL_MP                            0x00002813  // MappControlMp
+#define M_APP_INQUIRE_CONNECTION                    0x00002814  // MappInquireConnection
+#define M_APP_OPEN_CONNECTION                       0x00002815  // MappOpenConnection
+#define M_APP_INQUIRE_OBJECT                        0x00002816  // MappInquireObject
+#define M_APP_CONTROL_OBJECT                        0x00002817  // MappControlObject
+#define M_APP_CLOSE_CONNECTION                      0x00002818  // MappCloseConnection
+#define M_APP_TRACE                                 0x00002819  // MappTrace
+
+#define M_OBJ_CONTROL                               0x00002C01  // MobjControl
+#define M_OBJ_INQUIRE                               0x00002C02  // MobjInquire
+#define M_OBJ_HOOK_FUNCTION                         0x00002C03  // MobjHookFunction
+#define M_OBJ_ALLOC                                 0x00002C04  // MobjAlloc
+#define M_OBJ_FREE                                  0x00002C05  // MobjFree
+#define M_OBJ_GET_HOOK_INFO                         0x00002C06  // MobjGetHookInfo
+#define M_OBJ_MESSAGE_WRITE                         0x00002C08  // MobjMessageWrite
+#define M_OBJ_MESSAGE_READ                          0x00002C09  // MobjMessageRead
+
+#define M_THR_ALLOC                                 0x00002E01  // MthrAlloc
+#define M_THR_CONTROL                               0x00002E02  // MthrControl
+#define M_THR_FREE                                  0x00002E03  // MthrFree
+#define M_THR_INQUIRE                               0x00002E04  // MthrInquire
+#define M_THR_WAIT                                  0x00002E05  // MthrWait
+#define M_THR_WAIT_MULTIPLE                         0x00002E06  // MthrWaitMultiple
+#define M_THR_INQUIRE_MP                            0x00002E07  // MthrInquireMp
+#define M_THR_CONTROL_MP                            0x00002E08  // MthrControlMp
+
+#define M_MISC_DLL_MAIN                             0x0000301A  // DllMain
+
+#define M_BLOB_ALLOC_RESULT_OLD                     0x00008002  // MblobAllocResult
+#define M_BLOB_CALCULATE                            0x00008003  // MblobCalculate
+#define M_BLOB_CONTROL                              0x00008004  // MblobControl
+#define M_BLOB_FREE                                 0x00008006  // MblobFree
+#define M_BLOB_GET_LABEL                            0x00008007  // MblobGetLabel
+#define M_BLOB_GET_RESULT_OLD                       0x00008009  // MblobGetResult
+#define M_BLOB_INQUIRE                              0x0000800C  // MblobInquire
+#define M_BLOB_LABEL_FUNC                           0x0000800D  // MblobLabel
+#define M_BLOB_RECONSTRUCT                          0x0000800E  // MblobReconstruct
+#define M_BLOB_SELECT                               0x0000800F  // MblobSelect
+#define M_BLOB_DRAW                                 0x00008013  // MblobDraw
+#define M_BLOB_MERGE                                0x00008014  // MblobMerge
+#define M_BLOB_ALLOC                                0x00008015  // MblobAlloc
+#define M_BLOB_SAVE                                 0x00008016  // MblobSave
+#define M_BLOB_RESTORE                              0x00008017  // MblobRestore
+#define M_BLOB_STREAM                               0x00008018  // MblobStream
+#define M_BLOB_ALLOC_RESULT                         0x00008019  // MblobAllocResult
+#define M_BLOB_GET_RESULT                           0x0000801A  // MblobGetResult
+#define M_BLOB_TRANSFORM                            0x0000801B  // MblobTransform
+
+#define M_MEAS_ALLOC_MARKER                         0x00008201  // MmeasAllocMarker
+#define M_MEAS_SET_MARKER                           0x00008202  // MmeasSetMarker
+#define M_MEAS_FIND_MARKER                          0x00008203  // MmeasFindMarker
+#define M_MEAS_GET_RESULT                           0x00008204  // MmeasGetResult
+#define M_MEAS_GET_RESULT_SINGLE                    0x00008205  // MmeasGetResultSingle
+#define M_MEAS_INQUIRE                              0x00008206  // MmeasInquire
+#define M_MEAS_SAVE_MARKER                          0x00008207  // MmeasSaveMarker
+#define M_MEAS_CALCULATE                            0x00008208  // MmeasCalculate
+#define M_MEAS_FREE                                 0x00008209  // MmeasFree
+#define M_MEAS_ALLOC_RESULT                         0x0000820A  // MmeasAllocResult
+#define M_MEAS_ALLOC_CONTEXT                        0x0000820B  // MmeasAllocContext
+#define M_MEAS_CONTROL                              0x0000820C  // MmeasControl
+#define M_MEAS_RESTORE_MARKER                       0x0000820D  // MmeasRestoreMarker
+#define M_MEAS_DRAW                                 0x0000820E  // MmeasDraw
+#define M_MEAS_STREAM                               0x0000820F  // MmeasStream
+#define M_MEAS_SET_SCORE                            0x00008210  // MmeasSetScore
+#define M_MEAS_GET_SCORE                            0x00008211  // MmeasGetScore
+
+#define M_CAL_ALLOC                                 0x00008401  // McalAlloc
+#define M_CAL_GRID                                  0x00008402  // McalGrid
+#define M_CAL_TRANSFORM_IMAGE                       0x00008403  // McalTransformImage
+#define M_CAL_CONTROL                               0x00008404  // McalControl
+#define M_CAL_FREE                                  0x00008405  // McalFree
+#define M_CAL_INQUIRE                               0x00008406  // McalInquire
+#define M_CAL_LIST                                  0x00008407  // McalList
+#define M_CAL_SAVE                                  0x00008408  // McalSave
+#define M_CAL_RESTORE                               0x00008409  // McalRestore
+#define M_CAL_RELATIVE_ORIGIN                       0x0000840A  // McalRelativeOrigin
+#define M_CAL_TRANSFORM_COORDINATE                  0x0000840B  // McalTransformCoordinate
+#define M_CAL_TRANSFORM_COORDINATE_LIST             0x0000840C  // McalTransformCoordinateList
+#define M_CAL_TRANSFORM_RESULT                      0x0000840D  // McalTransformResult
+#define M_CAL_STREAM                                0x00008410  // McalStream
+#define M_CAL_ASSOCIATE                             0x00008411  // McalAssociate
+#define M_CAL_GET_COORDINATE_SYSTEM                 0x00008412  // McalGetCoordinateSystem
+#define M_CAL_SET_COORDINATE_SYSTEM                 0x00008413  // McalSetCoordinateSystem
+#define M_CAL_DRAW                                  0x00008414  // McalDraw
+#define M_CAL_TRANSFORM_COORDINATE_3D_LIST          0x00008415  // McalTransformCoordinate3dList
+#define M_CAL_INQUIRE_SINGLE                        0x00008416  // McalInquireSingle
+#define M_CAL_FIXTURE                               0x00008417  // McalFixture
+#define M_CAL_TRANSFORM_RESULT_AT_POSITION          0x00008418  // McalTransformResultAtPosition
+#define M_CAL_UNIFORM                               0x00008419  // McalUniform
+#define M_CAL_WARP                                  0x0000841A  // McalWarp
+#define M_CAL_DRAW_3D                               0x0000841B  // McalDraw3d
+
+#define M_CODE_ALLOC                                0x00008601  // McodeAlloc
+#define M_CODE_CONTROL                              0x00008602  // McodeControl
+#define M_CODE_FREE                                 0x00008603  // McodeFree
+#define M_CODE_GET_RESULT_OLD                       0x00008604  // McodeGetResultOld
+#define M_CODE_INQUIRE                              0x00008605  // McodeInquire
+#define M_CODE_READ                                 0x00008606  // McodeRead
+#define M_CODE_WRITE_OLD                            0x00008607  // McodeWriteOld
+#define M_CODE_SAVE                                 0x00008608  // McodeSave
+#define M_CODE_RESTORE                              0x00008609  // McodeRestore
+#define M_CODE_STREAM                               0x0000860B  // McodeStream
+#define M_CODE_DRAW_OLD                             0x0000860C  // McodeDrawOld
+#define M_CODE_ALLOC_RESULT                         0x0000860D  // McodeAllocResult
+#define M_CODE_MODEL_FUNC                           0x0000860E  // McodeModel
+#define M_CODE_GET_RESULT_SINGLE                    0x0000860F  // McodeGetResultSingle
+#define M_CODE_GRADE                                0x00008610  // McodeGrade
+#define M_CODE_TRAIN                                0x00008611  // McodeTrain
+#define M_CODE_DETECT                               0x00008612  // McodeDetect
+#define M_CODE_GET_RESULT                           0x00008613  // McodeGetResult
+#define M_CODE_DRAW                                 0x00008614  // McodeDraw
+#define M_CODE_WRITE                                0x00008615  // McodeWrite
+
+#define M_OCR_ALLOC_FONT                            0x00008801  // MocrAllocFont
+#define M_OCR_ALLOC_RESULT                          0x00008802  // MocrAllocResult
+#define M_OCR_CALIBRATE_FONT                        0x00008803  // MocrCalibrateFont
+#define M_OCR_CONTROL                               0x00008804  // MocrControl
+#define M_OCR_COPY_FONT                             0x00008805  // MocrCopyFont
+#define M_OCR_FREE                                  0x00008806  // MocrFree
+#define M_OCR_GET_RESULT                            0x00008807  // MocrGetResult
+#define M_OCR_HOOK_FUNCTION                         0x00008808  // MocrHookFunction
+#define M_OCR_IMPORT_FONT                           0x00008809  // MocrImportFont
+#define M_OCR_INQUIRE                               0x0000880A  // MocrInquire
+#define M_OCR_MODIFY_FONT                           0x0000880B  // MocrModifyFont
+#define M_OCR_READ_STRING                           0x0000880C  // MocrReadString
+#define M_OCR_RESTORE_FONT                          0x0000880D  // MocrRestoreFont
+#define M_OCR_SAVE_FONT                             0x0000880E  // MocrSaveFont
+#define M_OCR_SET_CONSTRAINT                        0x0000880F  // MocrSetConstraint
+#define M_OCR_VERIFY_STRING                         0x00008811  // MocrVerifyString
+#define M_OCR_PREPROCESS                            0x00008813  // MocrPreprocess
+#define M_OCR_STREAM                                0x00008816  // MocrStream
+#define M_OCR_DRAW                                  0x00008817  // MocrDraw
+
+#define M_PAT_ALLOC_RESULT_OLD                      0x00008C03  // MpatAllocResult
+#define M_PAT_DRAW                                  0x00008C06  // MpatDraw
+#define M_PAT_FREE                                  0x00008C0A  // MpatFree
+#define M_PAT_GET_RESULT_OLD                        0x00008C0C  // MpatGetResult
+#define M_PAT_INQUIRE_OLD                           0x00008C0D  // MpatInquire
+#define M_PAT_RESTORE_OLD                           0x00008C11  // MpatRestore
+#define M_PAT_SAVE_OLD                              0x00008C12  // MpatSave
+#define M_PAT_STREAM                                0x00008C22  // MpatStream
+#define M_PAT_PREPROCESS                            0x00008C23  // MpatPreprocess
+#define M_PAT_ALLOC_RESULT                          0x00008C24  // MpatAllocResult
+#define M_PAT_GET_RESULT                            0x00008C25  // MpatGetResult
+#define M_PAT_INQUIRE                               0x00008C26  // MpatInquire
+#define M_PAT_RESTORE                               0x00008C27  // MpatRestore
+#define M_PAT_SAVE                                  0x00008C28  // MpatSave
+#define M_PAT_ALLOC                                 0x00008C29  // MpatAlloc
+#define M_PAT_CONTROL                               0x00008C2A  // MpatControl
+#define M_PAT_DEFINE                                0x00008C2B  // MpatDefine
+#define M_PAT_FIND                                  0x00008C2C  // MpatFind
+#define M_PAT_MASK                                  0x00008C2D  // MpatMask
+
+#define M_MOD_ALLOC                                 0x00008E01  // MmodAlloc
+#define M_MOD_ALLOC_RESULT                          0x00008E02  // MmodAllocResult
+#define M_MOD_DEFINE                                0x00008E03  // MmodDefine
+#define M_MOD_CONTROL                               0x00008E04  // MmodControl
+#define M_MOD_PREPROCESS                            0x00008E05  // MmodPreprocess
+#define M_MOD_DRAW                                  0x00008E06  // MmodDraw
+#define M_MOD_FIND                                  0x00008E07  // MmodFind
+#define M_MOD_GET_RESULT                            0x00008E08  // MmodGetResult
+#define M_MOD_FREE                                  0x00008E09  // MmodFree
+#define M_MOD_INQUIRE                               0x00008E0A  // MmodInquire
+#define M_MOD_SAVE                                  0x00008E0B  // MmodSave
+#define M_MOD_RESTORE                               0x00008E0C  // MmodRestore
+#define M_MOD_MASK                                  0x00008E0D  // MmodMask
+#define M_MOD_DEFINE_FROM_FILE                      0x00008E0E  // MmodDefineFromFile
+#define M_MOD_STREAM                                0x00008E0F  // MmodStream
+
+#define M_EDGE_ALLOC                                0x00009401  // MedgeAlloc
+#define M_EDGE_ALLOC_RESULT                         0x00009402  // MedgeAllocResult
+#define M_EDGE_INQUIRE                              0x00009403  // MedgeInquire
+#define M_EDGE_CONTROL                              0x00009404  // MedgeControl
+#define M_EDGE_CALCULATE                            0x00009405  // MedgeCalculate
+#define M_EDGE_DRAW                                 0x00009406  // MedgeDraw
+#define M_EDGE_GET_RESULT                           0x00009407  // MedgeGetResult
+#define M_EDGE_FREE                                 0x00009408  // MedgeFree
+#define M_EDGE_SAVE                                 0x00009409  // MedgeSave
+#define M_EDGE_RESTORE                              0x0000940A  // MedgeRestore
+#define M_EDGE_MASK                                 0x0000940B  // MedgeMask
+#define M_EDGE_SELECT                               0x0000940C  // MedgeSelect
+#define M_EDGE_GET_NEIGHBORS                        0x0000940D  // MedgeGetNeighbors
+#define M_EDGE_PUT                                  0x0000940E  // MedgePut
+#define M_EDGE_STREAM                               0x0000940F  // MedgeStream
+
+#define M_STR_ALLOC                                 0x00009601  // MstrAlloc
+#define M_STR_ALLOC_RESULT                          0x00009602  // MstrAllocResult
+#define M_STR_FREE                                  0x00009603  // MstrFree
+#define M_STR_CONTROL                               0x00009604  // MstrControl
+#define M_STR_INQUIRE                               0x00009605  // MstrInquire
+#define M_STR_EDIT_FONT                             0x00009606  // MstrEditFont
+#define M_STR_SET_CONSTRAINT                        0x00009607  // MstrSetConstraint
+#define M_STR_PREPROCESS                            0x00009608  // MstrPreprocess
+#define M_STR_READ                                  0x00009609  // MstrRead
+#define M_STR_GET_RESULT                            0x0000960A  // MstrGetResult
+#define M_STR_DRAW                                  0x0000960B  // MstrDraw
+#define M_STR_SAVE                                  0x0000960C  // MstrSave
+#define M_STR_RESTORE                               0x0000960D  // MstrRestore
+#define M_STR_STREAM                                0x0000960E  // MstrStream
+#define M_STR_EXPERT                                0x0000960F  // MstrExpert
+
+#define M_MET_ALLOC                                 0x00009A01  // MmetAlloc
+#define M_MET_ALLOC_RESULT                          0x00009A02  // MmetAllocResult
+#define M_MET_CONTROL                               0x00009A03  // MmetControl
+#define M_MET_INQUIRE                               0x00009A04  // MmetInquire
+#define M_MET_ADD_FEATURE                           0x00009A05  // MmetAddFeature
+#define M_MET_ADD_TOLERANCE                         0x00009A06  // MmetAddTolerance
+#define M_MET_SET_POSITION                          0x00009A07  // MmetSetPosition
+#define M_MET_SET_REGION                            0x00009A08  // MmetSetRegion
+#define M_MET_CALCULATE                             0x00009A09  // MmetCalculate
+#define M_MET_GET_RESULT                            0x00009A0A  // MmetGetResult
+#define M_MET_DRAW                                  0x00009A0B  // MmetDraw
+#define M_MET_SAVE                                  0x00009A0C  // MmetSave
+#define M_MET_RESTORE                               0x00009A0D  // MmetRestore
+#define M_MET_STREAM                                0x00009A0E  // MmetStream
+#define M_MET_FREE                                  0x00009A0F  // MmetFree
+#define M_MET_NAME                                  0x00009A10  // MmetName
+#define M_MET_PUT                                   0x00009A11  // MmetPut
+
+#define M_COL_ALLOC                                 0x00009C01  // McolAlloc
+#define M_COL_ALLOC_RESULT                          0x00009C02  // McolAllocResult
+#define M_COL_DEFINE                                0x00009C03  // McolDefine
+#define M_COL_MATCH                                 0x00009C04  // McolMatch
+#define M_COL_FREE                                  0x00009C05  // McolFree
+#define M_COL_CONTROL                               0x00009C06  // McolControl
+#define M_COL_INQUIRE                               0x00009C07  // McolInquire
+#define M_COL_PREPROCESS                            0x00009C08  // McolPreprocess
+#define M_COL_GET_RESULT                            0x00009C09  // McolGetResult
+#define M_COL_DISTANCE                              0x00009C0A  // McolDistance
+#define M_COL_DRAW                                  0x00009C0B  // McolDraw
+#define M_COL_STREAM                                0x00009C0C  // McolStream
+#define M_COL_SAVE                                  0x00009C0D  // McolSave
+#define M_COL_RESTORE                               0x00009C0E  // McolRestore
+#define M_COL_MASK                                  0x00009C0F  // McolMask
+#define M_COL_SET_METHOD                            0x00009C10  // McolSetMethod
+#define M_COL_PROJECT                               0x00009C11  // McolProject
+#define M_COL_TRANSFORM                             0x00009C12  // McolTransform
+
+#define M_3DMAP_ALLOC                               0x00009E01  // M3dmapAlloc
+#define M_3DMAP_ALLOC_RESULT                        0x00009E02  // M3dmapAllocResult
+#define M_3DMAP_INQUIRE                             0x00009E03  // M3dmapInquire
+#define M_3DMAP_CONTROL                             0x00009E04  // M3dmapControl
+#define M_3DMAP_GET_RESULT                          0x00009E05  // M3dmapGetResult
+#define M_3DMAP_FREE                                0x00009E06  // M3dmapFree
+#define M_3DMAP_SAVE                                0x00009E07  // M3dmapSave
+#define M_3DMAP_RESTORE                             0x00009E08  // M3dmapRestore
+#define M_3DMAP_STREAM                              0x00009E09  // M3dmapStream
+#define M_3DMAP_ADD_SCAN                            0x00009E0A  // M3dmapAddScan
+#define M_3DMAP_CALIBRATE                           0x00009E0B  // M3dmapCalibrate
+#define M_3DMAP_EXTRACT                             0x00009E0C  // M3dmapExtract
+#define M_3DMAP_TRIANGULATE                         0x00009E0D  // M3dmapTriangulate
+#define M_3DMAP_SET_GEOMETRY                        0x00009E0E  // M3dmapSetGeometry
+#define M_3DMAP_DRAW                                0x00009E0F  // M3dmapDraw
+#define M_3DMAP_STAT                                0x00009E10  // M3dmapStat
+#define M_3DMAP_ARITH                               0x00009E11  // M3dmapArith
+#define M_3DMAP_PUT                                 0x00009E12  // M3dmapPut
+#define M_3DMAP_PUT_ORGANIZED                       0x00009E13  // M3dmapPutOrganized
+#define M_3DMAP_CALIBRATE_MULTIPLE                  0x00009E14  // M3dmapCalibrateMultiple
+#define M_3DMAP_CLEAR                               0x00009E15  // M3dmapClear
+#define M_3DMAP_ALIGN                               0x00009E16  // M3dmapAlign
+#define M_3DMAP_GET                                 0x00009E17  // M3dmapGet
+#define M_3DMAP_IMPORT                              0x00009E18  // M3dmapImport
+#define M_3DMAP_SET_BOX                             0x00009E19  // M3dmapSetBox
+#define M_3DMAP_EXPORT                              0x00009E1A  // M3dmapExport
+#define M_3DMAP_COPY                                0x00009E1B  // M3dmapCopy
+#define M_3DMAP_COPY_COND                           0x00009E1C  // M3dmapCopyCond
+#define M_3DMAP_PT_CLD_CALCULATE                    0x00009E1D  // M3dmapPtCldCalculate
+#define M_3DMAP_COPY_RESULT                         0x00009E1E  // M3dmapCopyResult
+#define M_3DMAP_DRAW_3D                             0x00009E1F  // M3dmapDraw3d
+
+#define M_REG_ALLOC                                 0x0000A001  // MregAlloc
+#define M_REG_ALLOC_RESULT                          0x0000A002  // MregAllocResult
+#define M_REG_INQUIRE                               0x0000A003  // MregInquire
+#define M_REG_CONTROL                               0x0000A004  // MregControl
+#define M_REG_CALCULATE                             0x0000A005  // MregCalculate
+#define M_REG_DRAW                                  0x0000A006  // MregDraw
+#define M_REG_GET_RESULT                            0x0000A008  // MregGetResult
+#define M_REG_FREE                                  0x0000A009  // MregFree
+#define M_REG_SAVE                                  0x0000A00B  // MregSave
+#define M_REG_RESTORE                               0x0000A00C  // MregRestore
+#define M_REG_STREAM                                0x0000A00F  // MregStream
+#define M_REG_SET_LOCATION                          0x0000A010  // MregSetLocation
+#define M_REG_TRANSFORM_IMAGE                       0x0000A011  // MregTransformImage
+#define M_REG_TRANSFORM_COORDINATE                  0x0000A012  // MregTransformCoordinate
+#define M_REG_TRANSFORM_COORDINATE_LIST             0x0000A013  // MregTransformCoordinateList
+
+#define M_DMR_ALLOC                                 0x0000A201  // MdmrAlloc
+#define M_DMR_ALLOC_RESULT                          0x0000A202  // MdmrAllocResult
+#define M_DMR_INQUIRE                               0x0000A203  // MdmrInquire
+#define M_DMR_CONTROL                               0x0000A204  // MdmrControl
+#define M_DMR_PREPROCESS                            0x0000A205  // MdmrPreprocess
+#define M_DMR_READ                                  0x0000A206  // MdmrRead
+#define M_DMR_GET_RESULT                            0x0000A207  // MdmrGetResult
+#define M_DMR_FREE                                  0x0000A208  // MdmrFree
+#define M_DMR_SAVE                                  0x0000A209  // MdmrSave
+#define M_DMR_RESTORE                               0x0000A20A  // MdmrRestore
+#define M_DMR_STREAM                                0x0000A20B  // MdmrStream
+#define M_DMR_CONTROL_FONT                          0x0000A20C  // MdmrControlFont
+#define M_DMR_INQUIRE_FONT                          0x0000A20D  // MdmrInquireFont
+#define M_DMR_CONTROL_STRING_MODEL                  0x0000A20E  // MdmrControlStringModel
+#define M_DMR_INQUIRE_STRING_MODEL                  0x0000A20F  // MdmrInquireStringModel
+#define M_DMR_DRAW                                  0x0000A210  // MdmrDraw
+#define M_DMR_IMPORT_FONT                           0x0000A211  // MdmrImportFont
+#define M_DMR_EXPORT_FONT                           0x0000A212  // MdmrExportFont
+#define M_DMR_NAME                                  0x0000A213  // MdmrName
+
+#define M_COM_ALLOC                                 0x0000A601  // McomAlloc
+#define M_COM_CONTROL                               0x0000A602  // McomControl
+#define M_COM_INQUIRE                               0x0000A603  // McomInquire
+#define M_COM_HOOK_FUNCTION                         0x0000A604  // McomHookFunction
+#define M_COM_GET_HOOK_INFO                         0x0000A605  // McomGetHookInfo
+#define M_COM_READ                                  0x0000A606  // McomRead
+#define M_COM_WRITE                                 0x0000A607  // McomWrite
+#define M_COM_FREE                                  0x0000A608  // McomFree
+#define M_COM_RECEIVE_POSITION_COMMAND              0x0000A609  // McomReceivePositionCommand
+#define M_COM_SEND_POSITION_COMMAND                 0x0000A60A  // McomSendPositionCommand
+#define M_COM_SEND_COMMAND                          0x0000A60B  // McomSendCommand
+#define M_COM_RECEIVE_COMMAND                       0x0000A60C  // McomReceiveCommand
+
+#define M_BEAD_ALLOC                                0x0000A801  // MbeadAlloc
+#define M_BEAD_ALLOC_RESULT                         0x0000A802  // MbeadAllocResult
+#define M_BEAD_FREE                                 0x0000A803  // MbeadFree
+#define M_BEAD_CONTROL                              0x0000A804  // MbeadControl
+#define M_BEAD_INQUIRE                              0x0000A805  // MbeadInquire
+#define M_BEAD_TRAIN                                0x0000A806  // MbeadTrain
+#define M_BEAD_TEMPLATE                             0x0000A807  // MbeadTemplate
+#define M_BEAD_VERIFY                               0x0000A808  // MbeadVerify
+#define M_BEAD_GET_RESULT                           0x0000A809  // MbeadGetResult
+#define M_BEAD_DRAW                                 0x0000A80A  // MbeadDraw
+#define M_BEAD_SAVE                                 0x0000A80B  // MbeadSave
+#define M_BEAD_RESTORE                              0x0000A80C  // MbeadRestore
+#define M_BEAD_STREAM                               0x0000A80D  // MbeadStream
+#define M_BEAD_GET_NEIGHBORS                        0x0000A80E  // MbeadGetNeighbors
+
+#define M_CLASS_ALLOC                               0x0000AC01  // MclassAlloc
+#define M_CLASS_ALLOC_RESULT                        0x0000AC02  // MclassAllocResult
+#define M_CLASS_INQUIRE                             0x0000AC03  // MclassInquire
+#define M_CLASS_CONTROL                             0x0000AC04  // MclassControl
+#define M_CLASS_IMPORT                              0x0000AC08  // MclassImport
+#define M_CLASS_PREPROCESS                          0x0000AC09  // MclassPreprocess
+#define M_CLASS_PREDICT                             0x0000AC0A  // MclassPredict
+#define M_CLASS_GET_RESULT                          0x0000AC0B  // MclassGetResult
+#define M_CLASS_FREE                                0x0000AC0C  // MclassFree
+#define M_CLASS_SAVE                                0x0000AC0D  // MclassSave
+#define M_CLASS_RESTORE                             0x0000AC0E  // MclassRestore
+#define M_CLASS_STREAM                              0x0000AC0F  // MclassStream
+#define M_CLASS_DRAW                                0x0000AC10  // MclassDraw
+#define M_CLASS_PREDICT_MULTIBAND                   0x0000AC13  // MclassPredictMultiband
+#define M_CLASS_CONTROL_ENTRY                       0x0000AC14  // MclassControlEntry
+#define M_CLASS_TRAIN                               0x0000AC15  // MclassTrain
+#define M_CLASS_INQUIRE_ENTRY                       0x0000AC16  // MclassInquireEntry
+#define M_CLASS_EXPORT                              0x0000AC17  // MclassExport
+#define M_CLASS_COPY_RESULT                         0x0000AC18  // MclassCopyResult
+#define M_CLASS_HOOK_FUNCTION                       0x0000AC19  // MclassHookFunction
+#define M_CLASS_GET_HOOK_INFO                       0x0000AC1A  // MclassGetHookInfo
+#define M_CLASS_COPY                                0x0000AC1B  // MclassCopy
+#define M_CLASS_SPLIT_DATASET                       0x0000AC1D  // MclassSplitDataset
+
+
+#define M_3DGRA_ALLOC                               0x00000101  // M3dgraAlloc
+#define M_3DGRA_ADD                                 0x00000102  // M3dgraAdd
+#define M_3DGRA_CONTROL                             0x00000103  // M3dgraControl
+#define M_3DGRA_COPY                                0x00000104  // M3dgraCopy
+#define M_3DGRA_FREE                                0x00000105  // M3dgraFree
+#define M_3DGRA_INQUIRE                             0x00000106  // M3dgraInquire
+#define M_3DGRA_REMOVE                              0x00000107  // M3dgraRemove
+#define M_3DGRA_BOX                                 0x00000108  // M3dgraBox
+#define M_3DGRA_SPHERE                              0x00000109  // M3dgraSphere
+#define M_3DGRA_CYLINDER                            0x0000010A  // M3dgraCylinder
+#define M_3DGRA_GRID                                0x0000010B  // M3dgraGrid
+#define M_3DGRA_LINE                                0x0000010C  // M3dgraLine
+#define M_3DGRA_TEXT                                0x0000010D  // M3dgraText
+#define M_3DGRA_AXIS                                0x0000010E  // M3dgraAxis
+#define M_3DGRA_PLANE                               0x0000010F  // M3dgraPlane
+#define M_3DGRA_DOTS                                0x00000110  // M3dgraDots
+#define M_3DGRA_POLYGON                             0x00000111  // M3dgraPolygon
+#define M_3DGRA_ARC                                 0x00000112  // M3dgraArc
+#define M_3DGRA_NODE                                0x00000113  // M3dgraNode
+
+#define M_3DDISP_ALLOC                              0x00000301  // M3ddispAlloc
+#define M_3DDISP_CONTROL                            0x00000302  // M3ddispControl
+#define M_3DDISP_FREE                               0x00000303  // M3ddispFree
+#define M_3DDISP_INQUIRE                            0x00000304  // M3ddispInquire
+#define M_3DDISP_SELECT                             0x00000305  // M3ddispSelect
+#define M_3DDISP_SELECT_WINDOW                      0x00000306  // M3ddispSelectWindow
+#define M_3DDISP_SET_VIEW                           0x00000307  // M3ddispSetView
+#define M_3DDISP_GET_VIEW                           0x00000308  // M3ddispGetView
+#define M_3DDISP_COPY                               0x00000309  // M3ddispCopy
+#define M_3DDISP_HOOK_FUNCTION                      0x0000030B  // M3ddispHookFunction
+#define M_3DDISP_GET_HOOK_INFO                      0x0000030C  // M3ddispGetHookInfo
+
+#define M_3DGEO_ALLOC                               0x00000501  // M3dgeoAlloc
+#define M_3DGEO_INQUIRE                             0x00000502  // M3dgeoInquire
+#define M_3DGEO_FREE                                0x00000503  // M3dgeoFree
+#define M_3DGEO_SAVE                                0x00000504  // M3dgeoSave
+#define M_3DGEO_RESTORE                             0x00000505  // M3dgeoRestore
+#define M_3DGEO_STREAM                              0x00000506  // M3dgeoStream
+#define M_3DGEO_BOX                                 0x00000507  // M3dgeoBox
+#define M_3DGEO_SPHERE                              0x00000508  // M3dgeoSphere
+#define M_3DGEO_PLANE                               0x00000509  // M3dgeoPlane
+#define M_3DGEO_COPY                                0x0000050A  // M3dgeoCopy
+#define M_3DGEO_MATRIX_SET_TRANSFORM                0x0000050B  // M3dgeoMatrixSetTransform
+#define M_3DGEO_MATRIX_PUT                          0x0000050C  // M3dgeoMatrixPut
+#define M_3DGEO_MATRIX_GET                          0x0000050D  // M3dgeoMatrixGet
+#define M_3DGEO_MATRIX_GET_TRANSFORM                0x0000050E  // M3dgeoMatrixGetTransform
+#define M_3DGEO_CYLINDER                            0x0000050F  // M3dgeoCylinder
+#define M_3DGEO_DRAW_3D                             0x00000510  // M3dgeoDraw3d
+#define M_3DGEO_UNDEFINED                           0x00000511  // M3dgeoUndefined
+#define M_3DGEO_LINE                                0x00000512  // M3dgeoLine
+#define M_3DGEO_MATRIX_SET_WITH_AXES                0x00000513  // M3dgeoMatrixSetWithAxes
+
+#define M_3DBUF_IMPORT                              0x00000901  // M3dbufImport
+#define M_3DBUF_EXPORT                              0x00000902  // M3dbufExport
+#define M_3DBUF_CONVERT                             0x00000903  // MbufConvert3d
+
+#define M_3DIM_ALLOC                                0x00002101  // M3dimAlloc
+#define M_3DIM_ALLOC_RESULT                         0x00002102  // M3dimAllocResult
+#define M_3DIM_INQUIRE                              0x00002103  // M3dimInquire
+#define M_3DIM_CONTROL                              0x00002104  // M3dimControl
+#define M_3DIM_GET_RESULT                           0x00002105  // M3dimGetResult
+#define M_3DIM_FREE                                 0x00002106  // M3dimFree
+#define M_3DIM_SAVE                                 0x00002107  // M3dimSave
+#define M_3DIM_RESTORE                              0x00002108  // M3dimRestore
+#define M_3DIM_STREAM                               0x00002109  // M3dimStream
+#define M_3DIM_TRANSLATE                            0x0000210A  // M3dimTranslate
+#define M_3DIM_SCALE                                0x0000210B  // M3dimScale
+#define M_3DIM_ROTATE                               0x0000210C  // M3dimRotate
+#define M_3DIM_MATRIX_TRANSFORM                     0x0000210D  // M3dimMatrixTransform
+#define M_3DIM_CROP                                 0x0000210E  // M3dimCrop
+#define M_3DIM_MERGE                                0x0000210F  // M3dimMerge
+#define M_3DIM_SAMPLE                               0x00002110  // M3dimSample
+#define M_3DIM_NORMALS                              0x00002111  // M3dimNormals
+#define M_3DIM_MESH                                 0x00002112  // M3dimMesh
+#define M_3DIM_STAT                                 0x00002113  // M3dimStat
+#define M_3DIM_COPY_RESULT                          0x00002114  // M3dimCopyResult
+#define M_3DIM_PROJECT                              0x00002115  // M3dimProject
+#define M_3DIM_COPY                                 0x00002116  // M3dimCopy
+#define M_3DIM_CALIBRATE_DEPTH_MAP                  0x00002117  // M3dimCalibrateDepthMap
+#define M_3DIM_MATRIX_TRANSFORM_LIST                0x00002118  // M3dimMatrixTransformList
+#define M_3DIM_CALCULATE_MAP_SIZE                   0x00002119  // M3dimCalculateMapSize
+#define M_3DIM_REMOVE_POINTS                        0x0000211A  // M3dimRemovePoints
+#define M_3DIM_ARITH                                0x0000211B  // M3dimArith
+#define M_3DIM_FILL_GAP                             0x0000211C  // M3dimFillGap
+#define M_3DIM_FIX                                  0x0000211D  // M3dimFix
+#define M_3DIM_PROFILE                              0x0000211E  // M3dimProfile
+
+#define M_3DMET_ALLOC                               0x00002301  // M3dmetAlloc
+#define M_3DMET_ALLOC_RESULT                        0x00002302  // M3dmetAllocResult
+#define M_3DMET_INQUIRE                             0x00002303  // M3dmetInquire
+#define M_3DMET_CONTROL                             0x00002304  // M3dmetControl
+#define M_3DMET_GET_RESULT                          0x00002305  // M3dmetGetResult
+#define M_3DMET_FREE                                0x00002306  // M3dmetFree
+#define M_3DMET_SAVE                                0x00002307  // M3dmetSave
+#define M_3DMET_RESTORE                             0x00002308  // M3dmetRestore
+#define M_3DMET_STREAM                              0x00002309  // M3dmetStream
+#define M_3DMET_DISTANCE                            0x0000230A  // M3dmetDistance
+#define M_3DMET_FIT                                 0x0000230B  // M3dmetFit
+#define M_3DMET_COPY_RESULT                         0x0000230C  // M3dmetCopyResult
+#define M_3DMET_STAT                                0x0000230D  // M3dmetStat
+#define M_3DMET_COPY                                0x0000230E  // M3dmetCopy
+#define M_3DMET_VOLUME                              0x0000230F  // M3dmetVolume
+#define M_3DMET_DRAW_3D                             0x00002310  // M3dmetDraw3d
+
+#define M_3DREG_ALLOC                               0x00002501  // M3dregAlloc
+#define M_3DREG_ALLOC_RESULT                        0x00002502  // M3dregAllocResult
+#define M_3DREG_INQUIRE                             0x00002503  // M3dregInquire
+#define M_3DREG_CONTROL                             0x00002504  // M3dregControl
+#define M_3DREG_GET_RESULT                          0x00002505  // M3dregGetResult
+#define M_3DREG_FREE                                0x00002506  // M3dregFree
+#define M_3DREG_SAVE                                0x00002507  // M3dregSave
+#define M_3DREG_RESTORE                             0x00002508  // M3dregRestore
+#define M_3DREG_STREAM                              0x00002509  // M3dregStream
+#define M_3DREG_COPY_RESULT                         0x0000250A  // M3dregCopyResult
+#define M_3DREG_CALCULATE                           0x0000250B  // M3dregCalculate
+#define M_3DREG_COPY                                0x0000250C  // M3dregCopy
+#define M_3DREG_SET_LOCATION                        0x0000250D  // M3dregSetLocation
+#define M_3DREG_MERGE                               0x0000250E  // M3dregMerge
+
+
+#endif //__FUNCTIONCODES_H__
\ No newline at end of file
diff --git a/Lib/Matrox/Include/Mildec.h b/Lib/Matrox/Include/Mildec.h
new file mode 100644
index 0000000..7e16410
--- /dev/null
+++ b/Lib/Matrox/Include/Mildec.h
@@ -0,0 +1,53 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILDEC.H
+    Revision:  10.40.0640
+    Content :  This file contains the defines that are used by the
+               mil functions to specify which type of command decoder
+               will be used by the allocated system (MsysAlloc()).
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef __MILDEC_H
+#define __MILDEC_H
+
+    #define M_SYSTEM_DEFAULT        MIL_TEXT("M_DEFAULT")
+    #define M_SYSTEM_HOST           MIL_TEXT("M_SYSTEM_HOST")
+    #define M_SYSTEM_VGA            M_SYSTEM_HOST
+    #define M_SYSTEM_1394           MIL_TEXT("M_SYSTEM_1394")
+    #define M_SYSTEM_IRIS           MIL_TEXT("M_SYSTEM_IRIS")
+    #define M_SYSTEM_CRONOSPLUS     MIL_TEXT("M_SYSTEM_CRONOSPLUS")
+    #define M_SYSTEM_MORPHIS        MIL_TEXT("M_SYSTEM_MORPHIS")
+    #define M_SYSTEM_SOLIOS         MIL_TEXT("M_SYSTEM_SOLIOS")
+    #define M_SYSTEM_MTXAUXILIARY   MIL_TEXT("M_SYSTEM_MTXAUXILIARY")
+    #define M_SYSTEM_VIO            MIL_TEXT("M_SYSTEM_VIO")
+    #define M_SYSTEM_NEXIS          MIL_TEXT("M_SYSTEM_NEXIS")
+    #define M_SYSTEM_GPU            MIL_TEXT("M_SYSTEM_GPU")
+    #define M_SYSTEM_GIGE_VISION    MIL_TEXT("M_SYSTEM_GIGE_VISION")
+    #define M_SYSTEM_MORPHISQXT     MIL_TEXT("M_SYSTEM_MORPHISQXT")
+    #define M_SYSTEM_IRIS_GT        MIL_TEXT("M_SYSTEM_IRIS_GT")
+    #define M_SYSTEM_RADIENT        MIL_TEXT("M_SYSTEM_RADIENT")
+    #define M_SYSTEM_ORION_HD       MIL_TEXT("M_SYSTEM_ORION_HD")
+    #define M_SYSTEM_NEXIS2         MIL_TEXT("M_SYSTEM_NEXIS2")
+    #define M_SYSTEM_HDDVR          MIL_TEXT("M_SYSTEM_HDDVR")
+    #define M_SYSTEM_RADIENTCXP     MIL_TEXT("M_SYSTEM_RADIENTCXP")
+    #define M_SYSTEM_RAPIXOCXP      MIL_TEXT("M_SYSTEM_RAPIXOCXP")
+    #define M_SYSTEM_RAPIXOCL       MIL_TEXT("M_SYSTEM_RAPIXOCL")
+    #define M_SYSTEM_RADIENTCLHS    MIL_TEXT("M_SYSTEM_RADIENTCLHS")
+    #define M_SYSTEM_RADIENTPRO     MIL_TEXT("M_SYSTEM_RADIENTPRO")
+    #define M_SYSTEM_RADIENTEVCL    MIL_TEXT("M_SYSTEM_RADIENTEVCL")
+    #define M_SYSTEM_MATROXCOMPRESS MIL_TEXT("M_SYSTEM_MATROXCOMPRESS")
+    #define M_SYSTEM_USB3_VISION    MIL_TEXT("M_SYSTEM_USB3_VISION")
+    #define M_SYSTEM_GENTL          MIL_TEXT("M_SYSTEM_GENTL")
+    #define M_SYSTEM_IRIS_GTR       MIL_TEXT("M_SYSTEM_IRIS_GTR")
+    #define M_SYSTEM_NEXIS3         MIL_TEXT("M_SYSTEM_NEXIS3")
+    #define M_SYSTEM_ORION_UHD      MIL_TEXT("M_SYSTEM_ORION_UHD")
+    #define M_SYSTEM_CLARITY_UHD    MIL_TEXT("M_SYSTEM_CLARITY_UHD")
+    #define M_SYSTEM_INDIO          MIL_TEXT("M_SYSTEM_INDIO")
+    #define M_SYSTEM_CONCORD_POE    MIL_TEXT("M_SYSTEM_CONCORD_POE")
+#endif
diff --git a/Lib/Matrox/Include/Milerr.h b/Lib/Matrox/Include/Milerr.h
new file mode 100644
index 0000000..932f76c
--- /dev/null
+++ b/Lib/Matrox/Include/Milerr.h
@@ -0,0 +1,2784 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILERR.H
+    Owner   :  Matrox Imaging
+    Revision:  10.35.1105
+    Content :  This file contains the defines that are used by the
+               mil functions to generate error codes and messages that
+               will be used by the MIL Application Error Logging and
+               other error related functions.
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2019.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef  __MILERR_H
+#define  __MILERR_H
+
+/*
+First line is the error code.
+Second line is the error message for this code.
+Other 9 lines are optional sub-messages with more detailed information.
+
+------------------------------------------------------------------------
+-                                                                      -
+-  WARNING: Strings (including the NULL character at the end) should   -
+-           never be longer than M_ERROR_MESSAGE_SIZE (128L).          -
+-           No checking is done anywhere in the code to ensure this.   -
+-                                                                      -
+------------------------------------------------------------------------
+*/
+
+
+#define NO_MSG                   MIL_TEXT("")  /* empty error message          */
+#define NO_SUBMSG                MIL_TEXT("")  /* empty sub-error message      */
+#define NO_FCTNAME               MIL_TEXT("")  /* empty function name          */
+
+// The following define must be set to a value higher
+// than the error subcode range. For now, error subcode
+// range is 1-9. M_NBSUBERRMSGMAX is 10.
+#define M_SYSTEM_STRING_CODE     M_NBSUBERRMSGMAX
+
+/* LIST OF ERROR CODES AND MESSAGES */
+
+#define M_NULL_ERROR             0L
+#define M_ERR_0_MSG              MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_1         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_2         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_3         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_4         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_5         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_6         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_7         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_8         MIL_TEXT("Null.")
+#define M_ERR_0_SUBMSG_9         MIL_TEXT("Null.")
+
+#define M_SIMD_ERROR_1           1L
+#define M_ERR_1_MSG              MIL_TEXT("SIMD Error.")
+#define M_ERR_1_SUBMSG_1         MIL_TEXT("Cannot force MMX on a non-MMX CPU.")
+#define M_ERR_1_SUBMSG_2         MIL_TEXT("Cannot force SSE on a non-SSE CPU or the OS does not support SSE.")
+#define M_ERR_1_SUBMSG_3         MIL_TEXT("Cannot force SSE2 on a non-SSE2 CPU or the OS does not support SSE2.")
+#define M_ERR_1_SUBMSG_4         MIL_TEXT("Cannot force 3DNow on a non-3DNow CPU.")
+#define M_ERR_1_SUBMSG_5         MIL_TEXT("Cannot force MMX Extension on a non-MMX Extension CPU.")
+#define M_ERR_1_SUBMSG_6         MIL_TEXT("Cannot force 3DNow Extension on a non-3DNow Extension CPU.")
+#define M_ERR_1_SUBMSG_7         MIL_TEXT("Cannot force SSE3 on a non-SSE3 CPU or the OS does not support SSE3.")
+#define M_ERR_1_SUBMSG_8         MIL_TEXT("Cannot force SSE4 on a non-SSE4 CPU or the OS does not support SSE4.")
+#define M_ERR_1_SUBMSG_9         MIL_TEXT("Cannot force AVX on a non-AVX CPU or the OS does not support AVX.")
+
+#define M_SIMD_ERROR_2           2L
+#define M_ERR_2_MSG              MIL_TEXT("SIMD Error.")
+#define M_ERR_2_SUBMSG_1         MIL_TEXT("Cannot force AVX2 on a non-AVX2 CPU or the OS does not support AVX2.")
+#define M_ERR_2_SUBMSG_2         NO_SUBMSG
+#define M_ERR_2_SUBMSG_3         NO_SUBMSG
+#define M_ERR_2_SUBMSG_4         NO_SUBMSG
+#define M_ERR_2_SUBMSG_5         NO_SUBMSG
+#define M_ERR_2_SUBMSG_6         NO_SUBMSG
+#define M_ERR_2_SUBMSG_7         NO_SUBMSG
+#define M_ERR_2_SUBMSG_8         NO_SUBMSG
+#define M_ERR_2_SUBMSG_9         NO_SUBMSG
+
+#define M_FUNC_FCT_ERROR         3L
+#define M_ERR_3_MSG              MIL_TEXT("Function call error.")
+#define M_ERR_3_SUBMSG_1         MIL_TEXT("MappGetError cannot be called from inside a MIL function. Use MfuncGetError instead.")
+#define M_ERR_3_SUBMSG_2         MIL_TEXT("Unable to obtain information about the slave function.")
+#define M_ERR_3_SUBMSG_3         MIL_TEXT("Node selected is not a valid node.")
+#define M_ERR_3_SUBMSG_4         MIL_TEXT("Cannot execute because an object resides in another workspace than the system selected to perform the call.")
+#define M_ERR_3_SUBMSG_5         MIL_TEXT("Propagating calibration informations between two MIL objects that reside on two different remote systems is not supported.")
+#define M_ERR_3_SUBMSG_6         NO_SUBMSG
+#define M_ERR_3_SUBMSG_7         NO_SUBMSG
+#define M_ERR_3_SUBMSG_8         NO_SUBMSG
+#define M_ERR_3_SUBMSG_9         NO_SUBMSG
+
+#define M_OPERATION_ERROR_5      4L
+#define M_ERR_4_MSG              MIL_TEXT("Operation error.")
+#define M_ERR_4_SUBMSG_1         MIL_TEXT("Buffer(s) must be unlocked before calling processing functions.")
+#define M_ERR_4_SUBMSG_2         MIL_TEXT("Cannot retrieve the system decoder for shadow allocation.")
+#define M_ERR_4_SUBMSG_3         MIL_TEXT("This lock type is not allowed on a buffer with GPU access only.")
+#define M_ERR_4_SUBMSG_4         MIL_TEXT("The buffer must be unlocked before calling MbufControl.")
+#define M_ERR_4_SUBMSG_5         MIL_TEXT("This operation cannot be forced to be executed from a specific node.")
+#define M_ERR_4_SUBMSG_6         MIL_TEXT("Node selected is not a valid node.")
+#define M_ERR_4_SUBMSG_7         MIL_TEXT("The graphic edition is not supported for this graphic element.")
+#define M_ERR_4_SUBMSG_8         MIL_TEXT("No bounding box could be found.")
+#define M_ERR_4_SUBMSG_9         MIL_TEXT("No neighbor could be found.")
+
+#define M_OPERATION_ERROR_4      5L
+#define M_ERR_5_MSG              MIL_TEXT("Operation error.")
+#define M_ERR_5_SUBMSG_1         MIL_TEXT("Cannot unlock an unlocked mutex.")
+#define M_ERR_5_SUBMSG_2         MIL_TEXT("Cannot free a mutex that still locked.")
+#define M_ERR_5_SUBMSG_3         MIL_TEXT("Error while locking the mutex.")
+#define M_ERR_5_SUBMSG_4         MIL_TEXT("Error while unlocking the mutex.")
+#define M_ERR_5_SUBMSG_5         MIL_TEXT("Error while freeing the mutex.")
+#define M_ERR_5_SUBMSG_6         MIL_TEXT("Deinterlacing is not supported on Odyssey systems.")
+#define M_ERR_5_SUBMSG_7         MIL_TEXT("MimLocatePeak1d is not supported on Odyssey systems.")
+#define M_ERR_5_SUBMSG_8         MIL_TEXT("MimDraw is not supported on Odyssey systems.")
+#define M_ERR_5_SUBMSG_9         MIL_TEXT("No file selected by user.")
+
+#define M_INVALID_PARAM_ERROR    6L
+#define M_ERR_6_MSG              MIL_TEXT("Invalid parameter.")
+#define M_ERR_6_SUBMSG_1         MIL_TEXT("Bad parameter value.")
+#define M_ERR_6_SUBMSG_2         MIL_TEXT("One of the parameters does not reside within the buffer's limits.")
+#define M_ERR_6_SUBMSG_3         MIL_TEXT("The pointer should not be null.")
+/* WARNING: Obsolete sub errors (4,5);*/
+#define M_ERR_6_SUBMSG_4         MIL_TEXT("Parameter 1 not supported.")
+#define M_ERR_6_SUBMSG_5         MIL_TEXT("Parameter 2 not supported.")
+#define M_ERR_6_SUBMSG_6         MIL_TEXT("No graphic text font selected.")
+#define M_ERR_6_SUBMSG_7         MIL_TEXT("The member StructSize from the MILBUFFERINFOOLD structure which was given as an argument is invalid.")
+#define M_ERR_6_SUBMSG_8         MIL_TEXT("The result buffer is too small to hold the result.")
+#define M_ERR_6_SUBMSG_9         MIL_TEXT("The scale factors is out of the supported range.")
+       
+
+#define M_OVERSCAN_ERROR         7L
+#define M_ERR_7_MSG              MIL_TEXT("Overscan processing error.")
+#define M_ERR_7_SUBMSG_1         MIL_TEXT("Cannot allocate temporary buffers in memory.")
+#define M_ERR_7_SUBMSG_2         MIL_TEXT("The buffer is too small to perform the selected overscan.")
+#define M_ERR_7_SUBMSG_3         NO_SUBMSG
+#define M_ERR_7_SUBMSG_4         NO_SUBMSG
+#define M_ERR_7_SUBMSG_5         NO_SUBMSG
+#define M_ERR_7_SUBMSG_6         NO_SUBMSG
+#define M_ERR_7_SUBMSG_7         NO_SUBMSG
+#define M_ERR_7_SUBMSG_8         NO_SUBMSG
+#define M_ERR_7_SUBMSG_9         NO_SUBMSG
+
+#define M_ALLOC_ERROR            8L
+#define M_ERR_8_MSG              MIL_TEXT("Allocation error.")
+#define M_ERR_8_SUBMSG_1         MIL_TEXT("Not enough memory to allocate the application.")
+#define M_ERR_8_SUBMSG_2         MIL_TEXT("Only one application can be allocated by the host thread.")
+#define M_ERR_8_SUBMSG_3         MIL_TEXT("Cannot allocate temporary buffers in memory.")
+#define M_ERR_8_SUBMSG_4         MIL_TEXT("Not enough memory to allocate the buffer.")
+#define M_ERR_8_SUBMSG_5         MIL_TEXT("Cannot allocate system.")
+#define M_ERR_8_SUBMSG_6         MIL_TEXT("Cannot allocate digitizer.")
+#define M_ERR_8_SUBMSG_7         MIL_TEXT("Cannot allocate display.")
+#define M_ERR_8_SUBMSG_8         MIL_TEXT("Not enough host memory to allocate buffer.")
+#define M_ERR_8_SUBMSG_9         MIL_TEXT("Buffer type not supported.")
+
+#define M_CHILD_ERROR            9L
+#define M_ERR_9_MSG              MIL_TEXT("Child allocation error.")
+#define M_ERR_9_SUBMSG_1         MIL_TEXT("Only one application can be allocated by the host thread.")
+#define M_ERR_9_SUBMSG_2         MIL_TEXT("Not enough memory to allocate a child application.")
+#define M_ERR_9_SUBMSG_3         MIL_TEXT("Not enough memory to allocate a child buffer.")
+#define M_ERR_9_SUBMSG_4         MIL_TEXT("Cannot allocate a temporary child buffer in memory.")
+#define M_ERR_9_SUBMSG_5         MIL_TEXT("It is impossible to make a band child from a compressed buffer.")
+#define M_ERR_9_SUBMSG_6         MIL_TEXT("Impossible to make a band child. The parent does not have enough bands.")
+#define M_ERR_9_SUBMSG_7         MIL_TEXT("It is impossible to make a child from a MPEG4 buffer.")
+#define M_ERR_9_SUBMSG_8         MIL_TEXT("It is impossible to make a child from a H264 buffer.")
+#define M_ERR_9_SUBMSG_9         MIL_TEXT("Cannot allocate a child that is completely outside its parent's limits.")
+
+#define M_ACCESS_ERROR           10L
+#define M_ERR_10_MSG             MIL_TEXT("Buffer access error.")
+#define M_ERR_10_SUBMSG_1        MIL_TEXT("Cannot M_RESTORE a M_RAW file format buffer.")
+#define M_ERR_10_SUBMSG_2        MIL_TEXT("Cannot export the buffer.")
+#define M_ERR_10_SUBMSG_3        MIL_TEXT("Source buffer must be an M_IMAGE buffer to export it.")
+#define M_ERR_10_SUBMSG_4        MIL_TEXT("Cannot import buffer.")
+#define M_ERR_10_SUBMSG_5        MIL_TEXT("File format is not supported.")
+#define M_ERR_10_SUBMSG_6        MIL_TEXT("Cannot export child buffers in M_PLANAR format.")
+#define M_ERR_10_SUBMSG_7        MIL_TEXT("Cannot load the object.")
+#define M_ERR_10_SUBMSG_8        MIL_TEXT("Cannot restore the object.")
+#define M_ERR_10_SUBMSG_9        MIL_TEXT("Cannot save the object.")
+
+#define M_DISPLAY_ERROR          11L
+#define M_ERR_11_MSG             MIL_TEXT("Display error.")
+#define M_ERR_11_SUBMSG_1        MIL_TEXT("The display and the buffer must be allocated on the same system.")
+#define M_ERR_11_SUBMSG_2        MIL_TEXT("Display Lut dimensions are not compatible with the user Lut.")
+#define M_ERR_11_SUBMSG_3        MIL_TEXT("Cannot associate a M_PSEUDO Lut with a monochrome display.")
+#define M_ERR_11_SUBMSG_4        MIL_TEXT("The zoom factor is out of the zoom limit or equal to zero.")
+#define M_ERR_11_SUBMSG_5        MIL_TEXT("Buffer not currently selected on the display.")
+#define M_ERR_11_SUBMSG_6        MIL_TEXT("Incompatible display type.")
+#define M_ERR_11_SUBMSG_7        MIL_TEXT("Display must be allocated with the M_WINDOWED init flag.")
+#define M_ERR_11_SUBMSG_8        MIL_TEXT("Invalid window handle.")
+#define M_ERR_11_SUBMSG_9        MIL_TEXT("Cannot allocate compensation buffer. Display and buffer should belong to the same system.")
+
+#define M_OPERATION_ERROR        12L
+#define M_ERR_12_MSG             MIL_TEXT("Operation error.")
+#define M_ERR_12_SUBMSG_1        MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_12_SUBMSG_2        MIL_TEXT("Not enough host memory to allocate a buffer.")
+#define M_ERR_12_SUBMSG_3        MIL_TEXT("The application still has MIL objects associated with it.")
+#define M_ERR_12_SUBMSG_4        MIL_TEXT("Only logical addresses are supported on host systems.")
+#define M_ERR_12_SUBMSG_5        MIL_TEXT("The pitch must be a multiple of 4 bytes with binary buffers.")
+#define M_ERR_12_SUBMSG_6        MIL_TEXT("Requested operation not supported.") 
+#define M_ERR_12_SUBMSG_7        MIL_TEXT("Pitch must be a multiple of 2 pixels.")
+#define M_ERR_12_SUBMSG_8        MIL_TEXT("Can only create on a physical address with non paged buffers.")
+#define M_ERR_12_SUBMSG_9        MIL_TEXT("The polar band to put must fit in the destination.")
+
+#define M_DIGITIZER_ERROR        13L
+#define M_ERR_13_MSG             MIL_TEXT("Digitizer error.")
+#define M_ERR_13_SUBMSG_1        MIL_TEXT("Digitizer and buffer must belong to same system.")
+#define M_ERR_13_SUBMSG_2        MIL_TEXT("Cannot free digitizer. Continuous grab in progress.")
+#define M_ERR_13_SUBMSG_3        MIL_TEXT("Cannot grab. Digitizer is already being used for a continuous grab.")
+#define M_ERR_13_SUBMSG_4        MIL_TEXT("Operation already in progress.")
+#define M_ERR_13_SUBMSG_5        MIL_TEXT("Digitizer has denied the request to be freed.")
+#define M_ERR_13_SUBMSG_6        MIL_TEXT("A buffer in the list is already being used by MdigGrab or MdigProcess.")
+#define M_ERR_13_SUBMSG_7        MIL_TEXT("Unable to load DigitizerController.dll.")
+#define M_ERR_13_SUBMSG_8        MIL_TEXT("Unable to find entry point in DigitizerController.dll.")
+#define M_ERR_13_SUBMSG_9        MIL_TEXT("Cannot free digitizer. MdigProcess is in progress.")
+
+#define M_HOOK_ERROR             14L
+#define M_ERR_14_MSG             MIL_TEXT("Hook function error.")
+#define M_ERR_14_SUBMSG_1        MIL_TEXT("Function and/or user data not found.")
+#define M_ERR_14_SUBMSG_2        MIL_TEXT("A hook function must be provided.")
+#define M_ERR_14_SUBMSG_3        MIL_TEXT("Object not hooked to an event.")
+#define M_ERR_14_SUBMSG_4        MIL_TEXT("Invalid hook type.")
+#define M_ERR_14_SUBMSG_5        MIL_TEXT("Required hardware not present.")
+#define M_ERR_14_SUBMSG_6        MIL_TEXT("Address of hooked function is not accessible from current process.")
+#define M_ERR_14_SUBMSG_7        MIL_TEXT("MIL has detected a stack corruption in user hook function.")
+#define M_ERR_14_SUBMSG_8        MIL_TEXT("A C++ exception occurred in the user hook function.")
+#define M_ERR_14_SUBMSG_9        MIL_TEXT("Unspecfied error occurred in driver.")
+
+#define M_JPEG_COMPRESS_ERROR    15L
+#define M_ERR_15_MSG             MIL_TEXT("JPEG compression error.")
+#define M_ERR_15_SUBMSG_1        MIL_TEXT("Unable to allocate memory.")
+#define M_ERR_15_SUBMSG_2        MIL_TEXT("Invalid image depth for JPEG compression.")
+#define M_ERR_15_SUBMSG_3        MIL_TEXT("Invalid compression parameter.")
+#define M_ERR_15_SUBMSG_4        MIL_TEXT("Invalid Huffman table.")
+#define M_ERR_15_SUBMSG_5        MIL_TEXT("Invalid predictor.")
+#define M_ERR_15_SUBMSG_6        MIL_TEXT("Invalid Q Factor.")
+#define M_ERR_15_SUBMSG_7        MIL_TEXT("Invalid quantization table.")
+#define M_ERR_15_SUBMSG_8        MIL_TEXT("Invalid restart interval.")
+#define M_ERR_15_SUBMSG_9        MIL_TEXT("Invalid source or destination format.")
+
+#define M_COMPRESS_ERROR         16L
+#define M_ERR_16_MSG             MIL_TEXT("Compression error.")
+#define M_ERR_16_SUBMSG_1        MIL_TEXT("Invalid compression type.")
+#define M_ERR_16_SUBMSG_2        MIL_TEXT("Corrupted data.")
+#define M_ERR_16_SUBMSG_3        MIL_TEXT("Invalid image depth for required compression type.")
+#define M_ERR_16_SUBMSG_4        MIL_TEXT("Buffer allocated with MbufCreate cannot be the destination of a compression operation.")
+#define M_ERR_16_SUBMSG_5        MIL_TEXT("Buffer allocated with MbufCreate cannot be the destination of a MbufPut operation.")
+#define M_ERR_16_SUBMSG_6        MIL_TEXT("Buffer too small to contain the compressed data.")
+#define M_ERR_16_SUBMSG_7        MIL_TEXT("Cannot modify the pointer of a buffer allocated with MbufCreate.")
+#define M_ERR_16_SUBMSG_8        NO_SUBMSG
+#define M_ERR_16_SUBMSG_9        NO_SUBMSG
+
+#define M_JPEG_COMPRESS_ERROR_2  17L
+#define M_ERR_17_MSG             MIL_TEXT("JPEG compression error.")
+#define M_ERR_17_SUBMSG_1        MIL_TEXT("Chrominance tables are allowed only with 3 band YUV buffers.")
+#define M_ERR_17_SUBMSG_2        MIL_TEXT("Luminance tables are allowed only with 3 band YUV buffers.")
+#define M_ERR_17_SUBMSG_3        MIL_TEXT("The predictor value is only available for 1 band buffers or child band buffers.")
+#define M_ERR_17_SUBMSG_4        MIL_TEXT("The Q factor is only available for 1 band buffers or band child band buffers.")
+#define M_ERR_17_SUBMSG_5        MIL_TEXT("The restart interval is only available for 1 band buffers or child band buffers.")
+#define M_ERR_17_SUBMSG_6        MIL_TEXT("The source image must be a multiple of 16 in X and a multiple of 8 in Y.")
+#define M_ERR_17_SUBMSG_7        MIL_TEXT("The destination image must be a multiple of 16 in X and a multiple of 8 in Y.")
+#define M_ERR_17_SUBMSG_8        MIL_TEXT("The source image must be a multiple of 16 in X and a multiple of 16 in Y.")
+#define M_ERR_17_SUBMSG_9        MIL_TEXT("The destination image must be a multiple of 16 in X and a multiple of 16 in Y.")
+
+
+#define M_BMP_ERROR              18L
+#define M_ERR_18_MSG             MIL_TEXT("BMP handler file access error.")
+#define M_ERR_18_SUBMSG_1        MIL_TEXT("Not a bitmap file.")
+#define M_ERR_18_SUBMSG_2        MIL_TEXT("Error closing bitmap file.")
+#define M_ERR_18_SUBMSG_3        MIL_TEXT("Cannot open file in read mode.")
+#define M_ERR_18_SUBMSG_4        MIL_TEXT("Error reading file.")
+#define M_ERR_18_SUBMSG_5        MIL_TEXT("Unable to position file pointer.")
+#define M_ERR_18_SUBMSG_6        MIL_TEXT("Cannot create or open file in write mode.")
+#define M_ERR_18_SUBMSG_7        MIL_TEXT("No bitmap file opened in read mode.")
+#define M_ERR_18_SUBMSG_8        MIL_TEXT("No bitmap file opened in write mode.")
+#define M_ERR_18_SUBMSG_9        MIL_TEXT("Error writing file.")
+
+#define M_BMP_ERROR_2            19L
+#define M_ERR_19_MSG             MIL_TEXT("BMP handler general error.")
+#define M_ERR_19_SUBMSG_1        MIL_TEXT("Unable to allocate sufficient memory.")
+#define M_ERR_19_SUBMSG_2        MIL_TEXT("Color format not supported.")
+#define M_ERR_19_SUBMSG_3        MIL_TEXT("Invalid write color format specified.")
+#define M_ERR_19_SUBMSG_4        MIL_TEXT("Invalid write compression type specified.")
+#define M_ERR_19_SUBMSG_5        MIL_TEXT("Conversion not supported.")
+#define M_ERR_19_SUBMSG_6        MIL_TEXT("Invalid array format specified.")
+#define M_ERR_19_SUBMSG_7        MIL_TEXT("Invalid length of palette arrays specified.")
+#define M_ERR_19_SUBMSG_8        MIL_TEXT("No palette to read.")
+#define M_ERR_19_SUBMSG_9        MIL_TEXT("Palette not needed for current write format.")
+
+
+#define M_TIFF_ERROR             20L
+#define M_ERR_20_MSG             MIL_TEXT("TIFF file access error.")
+#define M_ERR_20_SUBMSG_1        MIL_TEXT("Cannot open file.")
+#define M_ERR_20_SUBMSG_2        MIL_TEXT("Cannot close file.")
+#define M_ERR_20_SUBMSG_3        MIL_TEXT("Cannot read file.")
+#define M_ERR_20_SUBMSG_4        MIL_TEXT("Cannot read file.")
+#define M_ERR_20_SUBMSG_5        MIL_TEXT("Cannot write to file.")
+#define M_ERR_20_SUBMSG_6        MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_20_SUBMSG_7        MIL_TEXT("The image file does not conform to the TIFF 6.0 specification.")
+#define M_ERR_20_SUBMSG_8        MIL_TEXT("Wrong Byte Order, Only INTEL Byte Ordering supported.")
+#define M_ERR_20_SUBMSG_9        MIL_TEXT("Not a TIFF file.")
+
+#define M_MIL_FILE_ERROR         21L
+#define M_ERR_21_MSG             MIL_TEXT("MIL file access error.")
+#define M_ERR_21_SUBMSG_1        MIL_TEXT("Cannot open file.")
+#define M_ERR_21_SUBMSG_2        MIL_TEXT("Cannot close file.")
+#define M_ERR_21_SUBMSG_3        MIL_TEXT("Cannot read file.")
+#define M_ERR_21_SUBMSG_4        MIL_TEXT("Cannot read file.")
+#define M_ERR_21_SUBMSG_5        MIL_TEXT("Cannot write to file.")
+#define M_ERR_21_SUBMSG_6        MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_21_SUBMSG_7        MIL_TEXT("The image file does not conform to the TIFF 6.0 specification.")
+#define M_ERR_21_SUBMSG_8        MIL_TEXT("Wrong Byte Order, Only INTEL Byte Ordering supported.")
+#define M_ERR_21_SUBMSG_9        MIL_TEXT("Not a MIL file.")
+
+#define M_MIL_FILE_ERROR_2       22L
+#define M_ERR_22_MSG             MIL_TEXT("MIL file access error.")
+#define M_ERR_22_SUBMSG_1        MIL_TEXT("Only 8, 16 or 32 BitsPerSample supported.")
+#define M_ERR_22_SUBMSG_2        MIL_TEXT("Lempel-Ziv & Welch (LZW) compression not supported.")
+#define M_ERR_22_SUBMSG_3        MIL_TEXT("PhotometricInterp incompatible with SamplePerPixel.")
+#define M_ERR_22_SUBMSG_4        MIL_TEXT("Only PlanarConfiguration 2 supported for multi-band images.")
+#define M_ERR_22_SUBMSG_5        MIL_TEXT("Up to 8 Samples Per Pixel supported.")
+#define M_ERR_22_SUBMSG_6        MIL_TEXT("Only identical BitsPerSample for every sample supported.")
+#define M_ERR_22_SUBMSG_7        MIL_TEXT("Cannot seek in file.")
+#define M_ERR_22_SUBMSG_8        MIL_TEXT("Bad file format detected.")
+#define M_ERR_22_SUBMSG_9        MIL_TEXT("Invalid info requested.")
+
+#define M_MIL_FILE_ERROR_3       23L
+#define M_ERR_23_MSG             MIL_TEXT("MIL file access error.")
+#define M_ERR_23_SUBMSG_1        MIL_TEXT("Invalid parameter detected.")
+#define M_ERR_23_SUBMSG_2        MIL_TEXT("Missing information in file.")
+#define M_ERR_23_SUBMSG_3        MIL_TEXT("Invalid size information detected in file.")
+#define M_ERR_23_SUBMSG_4        MIL_TEXT("Invalid identification information detected in file.")
+#define M_ERR_23_SUBMSG_5        MIL_TEXT("Invalid data information detected in file.")
+#define M_ERR_23_SUBMSG_6        MIL_TEXT("Unexpected internal error.")
+#define M_ERR_23_SUBMSG_7        MIL_TEXT("Cannot open file: Invalid file name.")
+#define M_ERR_23_SUBMSG_8        MIL_TEXT("Unable to open or access file, or file contains an invalid stream.")
+#define M_ERR_23_SUBMSG_9        MIL_TEXT("Invalid stream.")
+
+#define M_MULTI_THREAD_ERROR     24L
+#define M_ERR_24_MSG             MIL_TEXT("Multi thread error.")
+#define M_ERR_24_SUBMSG_1        NO_SUBMSG
+#define M_ERR_24_SUBMSG_2        MIL_TEXT("Invalid MIL_ID, MIL thread or event was not allocated in current HOST thread.")
+#define M_ERR_24_SUBMSG_3        MIL_TEXT("Application must be freed before exiting a thread.")
+#define M_ERR_24_SUBMSG_4        MIL_TEXT("Operation not supported on this system.")
+#define M_ERR_24_SUBMSG_5        MIL_TEXT("Cannot allocate thread.")
+#define M_ERR_24_SUBMSG_6        MIL_TEXT("Cannot select this thread in the current host thread.")
+#define M_ERR_24_SUBMSG_7        MIL_TEXT("The thread belongs to a system that does not support this operation.")
+#define M_ERR_24_SUBMSG_8        MIL_TEXT("Operation not supported.")
+#define M_ERR_24_SUBMSG_9        MIL_TEXT("Cannot wait for the completion of a thread allocated in another host thread.")
+
+#define M_JPEG_ERROR             25L
+#define M_ERR_25_MSG             MIL_TEXT("JPEG handler general error.")
+#define M_ERR_25_SUBMSG_1        MIL_TEXT("Color format not supported.")
+#define M_ERR_25_SUBMSG_2        MIL_TEXT("Error closing JPEG file.")
+#define M_ERR_25_SUBMSG_3        MIL_TEXT("Error opening JPEG file.")
+#define M_ERR_25_SUBMSG_4        MIL_TEXT("Unable to allocate sufficient memory.")
+#define M_ERR_25_SUBMSG_5        MIL_TEXT("Image too large to save.")
+#define M_ERR_25_SUBMSG_6        MIL_TEXT("Invalid JPEG marker.")
+#define M_ERR_25_SUBMSG_7        MIL_TEXT("Bad identification information detected in file.")
+#define M_ERR_25_SUBMSG_8        MIL_TEXT("Buffer to receive data does not fit with data.")
+#define M_ERR_25_SUBMSG_9        MIL_TEXT("Error reading JPEG file.")
+
+#define M_BUFFER_FREE_ERROR      26L
+#define M_ERR_26_MSG             MIL_TEXT("Buffer free operation error.")
+#define M_ERR_26_SUBMSG_1        MIL_TEXT("Buffer still has child(ren) associated with it.")
+#define M_ERR_26_SUBMSG_2        MIL_TEXT("This buffer is currently being used.")
+#define M_ERR_26_SUBMSG_3        MIL_TEXT("User attempting to free a system allocated buffer.")
+#define M_ERR_26_SUBMSG_4        MIL_TEXT("Internal error, internal function attempting to free a user allocated buffer.")
+#define M_ERR_26_SUBMSG_5        MIL_TEXT("This buffer is currently being used by a digitizer for a continuous grab.")
+#define M_ERR_26_SUBMSG_6        MIL_TEXT("Memory corruption detected: the guard value has been overwritten.")
+#define M_ERR_26_SUBMSG_7        MIL_TEXT("This buffer is still remotely mapped.")
+#define M_ERR_26_SUBMSG_8        MIL_TEXT("Error while freeing non-paged buffer.")
+#define M_ERR_26_SUBMSG_9        MIL_TEXT("Error while freeing paged buffer.")
+
+#define M_SYSTEM_FREE_ERROR      27L
+#define M_ERR_27_MSG             MIL_TEXT("System free error.")
+#define M_ERR_27_SUBMSG_1        MIL_TEXT("System still has buffer(s) associated with it.")
+#define M_ERR_27_SUBMSG_2        MIL_TEXT("System still has display(s) associated with it.")
+#define M_ERR_27_SUBMSG_3        MIL_TEXT("System still has digitizer(s) associated with it.")
+#define M_ERR_27_SUBMSG_4        MIL_TEXT("Cannot free M_DEFAULT_HOST.")
+#define M_ERR_27_SUBMSG_5        MIL_TEXT("System still has object(s) associated with it.")
+#define M_ERR_27_SUBMSG_6        MIL_TEXT("System still has processing object(s) associated with it.")
+#define M_ERR_27_SUBMSG_7        MIL_TEXT("System is still selected in at least one thread.")
+#define M_ERR_27_SUBMSG_8        NO_SUBMSG
+#define M_ERR_27_SUBMSG_9        NO_SUBMSG
+
+#define M_FUNCTION_START_ERROR   28L
+#define M_ERR_28_MSG             MIL_TEXT("Function start error.")
+#define M_ERR_28_SUBMSG_1        MIL_TEXT("No application allocated.")
+#define M_ERR_28_SUBMSG_2        NO_SUBMSG
+#define M_ERR_28_SUBMSG_3        NO_SUBMSG
+#define M_ERR_28_SUBMSG_4        NO_SUBMSG
+#define M_ERR_28_SUBMSG_5        NO_SUBMSG
+#define M_ERR_28_SUBMSG_6        NO_SUBMSG
+#define M_ERR_28_SUBMSG_7        NO_SUBMSG
+#define M_ERR_28_SUBMSG_8        NO_SUBMSG
+#define M_ERR_28_SUBMSG_9        NO_SUBMSG
+
+#define M_COMMAND_DECODER_ERROR  29L
+#define M_ERR_29_MSG             MIL_TEXT("System command error.")
+#define M_ERR_29_SUBMSG_1        MIL_TEXT("Requested operation not supported.")
+#define M_ERR_29_SUBMSG_2        MIL_TEXT("Operation execution failed.")
+#define M_ERR_29_SUBMSG_3        MIL_TEXT("Requested Raw Call is not supported.")
+#define M_ERR_29_SUBMSG_4        NO_SUBMSG 
+#define M_ERR_29_SUBMSG_5        NO_SUBMSG
+#define M_ERR_29_SUBMSG_6        NO_SUBMSG
+#define M_ERR_29_SUBMSG_7        NO_SUBMSG
+#define M_ERR_29_SUBMSG_8        NO_SUBMSG
+#define M_ERR_29_SUBMSG_9        NO_SUBMSG
+
+#define M_LABELLING_ERROR        30L
+#define M_ERR_30_MSG             MIL_TEXT("Labeling error.")
+#define M_ERR_30_SUBMSG_1        MIL_TEXT("Maximum number of labels reached.")
+#define M_ERR_30_SUBMSG_2        MIL_TEXT("Should use a buffer of greater bit depth.")
+#define M_ERR_30_SUBMSG_3        MIL_TEXT("Maximum number of labels reached.\nShould use a buffer of greater bit depth.")
+#define M_ERR_30_SUBMSG_4        NO_SUBMSG
+#define M_ERR_30_SUBMSG_5        NO_SUBMSG
+#define M_ERR_30_SUBMSG_6        NO_SUBMSG
+#define M_ERR_30_SUBMSG_7        NO_SUBMSG
+#define M_ERR_30_SUBMSG_8        NO_SUBMSG
+#define M_ERR_30_SUBMSG_9        NO_SUBMSG
+
+#define M_FILE_ERROR             31L
+#define M_ERR_31_MSG             MIL_TEXT("File access error.")
+#define M_ERR_31_SUBMSG_1        MIL_TEXT("Cannot open output file.")
+#define M_ERR_31_SUBMSG_2        MIL_TEXT("Cannot write to file.")
+#define M_ERR_31_SUBMSG_3        MIL_TEXT("Cannot open input file.")
+#define M_ERR_31_SUBMSG_4        MIL_TEXT("Cannot read file.")
+#define M_ERR_31_SUBMSG_5        MIL_TEXT("Cannot close output file.")
+#define M_ERR_31_SUBMSG_6        MIL_TEXT("Cannot close input file.")
+#define M_ERR_31_SUBMSG_7        MIL_TEXT("The FileFormat parameter does not represent the actual file format.")
+#define M_ERR_31_SUBMSG_8        MIL_TEXT("This OS does not support file access.")
+#define M_ERR_31_SUBMSG_9        MIL_TEXT("Not a MIL file.")
+
+#define M_APP_FREE_ERROR         32L
+#define M_ERR_32_MSG             MIL_TEXT("Application free operation error.")
+#define M_ERR_32_SUBMSG_1        MIL_TEXT("Application still has system(s) associated with it.")
+#define M_ERR_32_SUBMSG_2        MIL_TEXT("Default host system still has buffer(s) associated with it.")
+#define M_ERR_32_SUBMSG_3        MIL_TEXT("Application still has child(ren) associated with it.")
+#define M_ERR_32_SUBMSG_4        MIL_TEXT("Application was not freed.")
+#define M_ERR_32_SUBMSG_5        MIL_TEXT("Application still has object(s) associated with it.")
+#define M_ERR_32_SUBMSG_6        MIL_TEXT("Application must be freed in the thread in which it was allocated.")
+#define M_ERR_32_SUBMSG_7        MIL_TEXT("Some display related object(s) were not freed.")
+#define M_ERR_32_SUBMSG_8        MIL_TEXT("Could not free the Auxiliary IO service.")
+#define M_ERR_32_SUBMSG_9        MIL_TEXT("Application is still processing.")
+
+#define M_TIFF_ERROR_2           33L
+#define M_ERR_33_MSG             MIL_TEXT("TIFF File access error.")
+#define M_ERR_33_SUBMSG_1        MIL_TEXT("Only 1, 8, 16 or 32 BitsPerSample supported.")
+#define M_ERR_33_SUBMSG_2        MIL_TEXT("Cannot read compressed image file.")
+#define M_ERR_33_SUBMSG_3        MIL_TEXT("PhotometricInterp incompatible with SamplePerPixel.")
+#define M_ERR_33_SUBMSG_4        MIL_TEXT("Only PlanarConfiguration 2 supported for multi-band images.")
+#define M_ERR_33_SUBMSG_5        MIL_TEXT("Up to 8 Samples Per Pixel supported.")
+#define M_ERR_33_SUBMSG_6        MIL_TEXT("Only identical BitsPerSample for every sample supported.")
+#define M_ERR_33_SUBMSG_7        MIL_TEXT("Cannot seek in file.")
+#define M_ERR_33_SUBMSG_8        MIL_TEXT("Bad file format detected.")
+#define M_ERR_33_SUBMSG_9        MIL_TEXT("Invalid info requested.")
+
+#define M_PROCESSING_ERROR       34L
+#define M_ERR_34_MSG             MIL_TEXT("Processing error.")
+#define M_ERR_34_SUBMSG_1        MIL_TEXT("All buffers do not have the same working system.")
+#define M_ERR_34_SUBMSG_2        MIL_TEXT("Cannot find any working system between buffers.")
+#define M_ERR_34_SUBMSG_3        MIL_TEXT("Cannot process a HOST buffer as a whole and a temporary buffer.")
+#define M_ERR_34_SUBMSG_4        MIL_TEXT("Source buffers cannot overlap with destination buffers.")
+#define M_ERR_34_SUBMSG_5        MIL_TEXT("No processor on target processing system.")
+#define M_ERR_34_SUBMSG_6        MIL_TEXT("Pixel values out of supported range.")
+#define M_ERR_34_SUBMSG_7        NO_SUBMSG
+#define M_ERR_34_SUBMSG_8        NO_SUBMSG
+#define M_ERR_34_SUBMSG_9        MIL_TEXT("Not enough memory or system limitation, cannot process buffer.")
+
+#define M_INVALID_ID             35L
+#define M_ERR_35_MSG             MIL_TEXT("Invalid MIL ID.")
+#define M_ERR_35_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_35_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_35_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_35_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_35_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_35_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_35_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_35_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_35_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_INVALID_NATURE         36L
+#define M_ERR_36_MSG             MIL_TEXT("Inappropriate MIL ID.")
+#define M_ERR_36_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_36_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_36_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_36_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_36_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_36_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_36_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_36_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_36_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_INVALID_PARAM_ERROR_2  37L
+#define M_ERR_37_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_37_SUBMSG_1        MIL_TEXT("For this operation, you should supply a LUT buffer with at least 512 entries.")
+#define M_ERR_37_SUBMSG_2        MIL_TEXT("For this operation the grab mode must be asynchronous.")
+#define M_ERR_37_SUBMSG_3        MIL_TEXT("This type of conversion requires two 3 band buffers.")
+#define M_ERR_37_SUBMSG_4        MIL_TEXT("This type of conversion requires a 3 band source buffer.")
+#define M_ERR_37_SUBMSG_5        MIL_TEXT("This type of conversion requires a 3 band destination buffer.")
+#define M_ERR_37_SUBMSG_6        MIL_TEXT("Invalid interpolation type specified.")
+#define M_ERR_37_SUBMSG_7        MIL_TEXT("Specified center is outside buffer.")
+#define M_ERR_37_SUBMSG_8        MIL_TEXT("A 8 or 16 bit monochrome uncompressed image buffer is required for this operation.")
+#define M_ERR_37_SUBMSG_9        MIL_TEXT("LUTs must be 1 or 3 bands, 8 or 16 bit.")
+
+#define M_INVALID_ATTRIBUTE      38L
+#define M_ERR_38_MSG             MIL_TEXT("Invalid attributes.")
+#define M_ERR_38_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_38_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_38_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_38_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_38_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_38_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_38_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_38_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_38_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_CALL_CONTEXT_ERROR     39L
+#define M_ERR_39_MSG             MIL_TEXT("Call context error.")
+#define M_ERR_39_SUBMSG_1        MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_39_SUBMSG_2        NO_SUBMSG
+#define M_ERR_39_SUBMSG_3        NO_SUBMSG
+#define M_ERR_39_SUBMSG_4        NO_SUBMSG
+#define M_ERR_39_SUBMSG_5        NO_SUBMSG
+#define M_ERR_39_SUBMSG_6        NO_SUBMSG
+#define M_ERR_39_SUBMSG_7        NO_SUBMSG
+#define M_ERR_39_SUBMSG_8        NO_SUBMSG
+#define M_ERR_39_SUBMSG_9        NO_SUBMSG
+
+#define M_DRIVER_OBSOLETE        40L
+#define M_ERR_40_MSG             MIL_TEXT("MIL driver version.")
+#define M_ERR_40_SUBMSG_1        MIL_TEXT("Driver version is invalid.")
+#define M_ERR_40_SUBMSG_2        NO_SUBMSG
+#define M_ERR_40_SUBMSG_3        NO_SUBMSG
+#define M_ERR_40_SUBMSG_4        NO_SUBMSG
+#define M_ERR_40_SUBMSG_5        NO_SUBMSG
+#define M_ERR_40_SUBMSG_6        NO_SUBMSG
+#define M_ERR_40_SUBMSG_7        NO_SUBMSG
+#define M_ERR_40_SUBMSG_8        NO_SUBMSG
+#define M_ERR_40_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_3  41L
+#define M_ERR_41_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_41_SUBMSG_1        MIL_TEXT("Parameter 1 not in supported list.")
+#define M_ERR_41_SUBMSG_2        MIL_TEXT("Parameter 2 not in supported list.")
+#define M_ERR_41_SUBMSG_3        MIL_TEXT("Parameter 3 not in supported list.")
+#define M_ERR_41_SUBMSG_4        MIL_TEXT("Parameter 4 not in supported list.")
+#define M_ERR_41_SUBMSG_5        MIL_TEXT("Parameter 5 not in supported list.")
+#define M_ERR_41_SUBMSG_6        MIL_TEXT("Parameter 6 not in supported list.")
+#define M_ERR_41_SUBMSG_7        MIL_TEXT("Parameter 7 not in supported list.")
+#define M_ERR_41_SUBMSG_8        MIL_TEXT("Parameter 8 not in supported list.")
+#define M_ERR_41_SUBMSG_9        MIL_TEXT("Parameter 9 not in supported list.")
+
+#define M_ALLOC_ERROR_2          42L
+#define M_ERR_42_MSG             MIL_TEXT("Allocation error.")
+#define M_ERR_42_SUBMSG_1        MIL_TEXT("Not enough host memory to do the operation.")
+#define M_ERR_42_SUBMSG_2        MIL_TEXT("Invalid attribute, M_GRAB not supported on host.")
+#define M_ERR_42_SUBMSG_3        MIL_TEXT("Incompatible buffer dimensions, SizeBand, SizeY and (SizeX x SizeBit) must be identical.")
+#define M_ERR_42_SUBMSG_4        MIL_TEXT("Unable to communicate with MIL Memory manager.")
+#define M_ERR_42_SUBMSG_5        MIL_TEXT("The requested memory size is invalid.")
+#define M_ERR_42_SUBMSG_6        MIL_TEXT("Impossible to make a band child of a compressed buffer.")
+#define M_ERR_42_SUBMSG_7        MIL_TEXT("You require a fast overscan buffer, but the M_ALLOCATION_OVERSCAN_SIZE is 0.")
+#define M_ERR_42_SUBMSG_8        MIL_TEXT("Memory already allocated.")
+#define M_ERR_42_SUBMSG_9        MIL_TEXT("The MIL_ID table is full. Make sure you do not have a resource leak.")
+
+#define M_TIMER_ERROR            43L
+#define M_ERR_43_MSG             MIL_TEXT("Timer error.")
+#define M_ERR_43_SUBMSG_1        MIL_TEXT("Invalid ControlType specified.")
+#define M_ERR_43_SUBMSG_2        MIL_TEXT("TimePtr parameter cannot be null.")
+#define M_ERR_43_SUBMSG_3        MIL_TEXT("Installed hardware does not support a high-resolution performance counter.")
+#define M_ERR_43_SUBMSG_4        MIL_TEXT("Timer must be reset prior to a read.")
+#define M_ERR_43_SUBMSG_5        MIL_TEXT("Does not support remote application.")
+#define M_ERR_43_SUBMSG_6        MIL_TEXT("M_TRACE timer cannot be reset.")
+#define M_ERR_43_SUBMSG_7        NO_SUBMSG
+#define M_ERR_43_SUBMSG_8        NO_SUBMSG
+#define M_ERR_43_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_4  44L
+#define M_ERR_44_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_44_SUBMSG_1        MIL_TEXT("The valid data formats for binary buffers are M_SINGLE_BAND and M_PLANAR.")
+#define M_ERR_44_SUBMSG_2        MIL_TEXT("Operation not supported on float buffers.")
+#define M_ERR_44_SUBMSG_3        MIL_TEXT("Destination buffer is binary, MaskValue must be equal to 0 or 1.")
+#define M_ERR_44_SUBMSG_4        MIL_TEXT("Image buffer must be monochrome for this operation.")
+#define M_ERR_44_SUBMSG_5        MIL_TEXT("Source buffers must be of the same type.")
+#define M_ERR_44_SUBMSG_6        MIL_TEXT("Integer source buffers must be unsigned.")
+#define M_ERR_44_SUBMSG_7        MIL_TEXT("Operation not supported with binary buffers.")
+#define M_ERR_44_SUBMSG_8        MIL_TEXT("Source buffers must be of the same pixel depth.")
+#define M_ERR_44_SUBMSG_9        MIL_TEXT("The width and height of the source and destination buffers must be a power of 2.")
+
+#define M_INVALID_PARAM_ERROR_5  45L
+#define M_ERR_45_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_45_SUBMSG_1        MIL_TEXT("The number of bands is not valid.")
+#define M_ERR_45_SUBMSG_2        MIL_TEXT("The X dimension is not valid.")
+#define M_ERR_45_SUBMSG_3        MIL_TEXT("The Y dimension is not valid.")
+#define M_ERR_45_SUBMSG_4        MIL_TEXT("The pixel depth is not valid.")
+#define M_ERR_45_SUBMSG_5        MIL_TEXT("The buffer attributes are not valid.")
+#define M_ERR_45_SUBMSG_6        MIL_TEXT("The data type is not valid.")
+#define M_ERR_45_SUBMSG_7        MIL_TEXT("Invalid FFT type specified.")
+#define M_ERR_45_SUBMSG_8        MIL_TEXT("Invalid operation mode specified.")
+#define M_ERR_45_SUBMSG_9        MIL_TEXT("Invalid transform specified.")
+
+#define M_INVALID_PARAM_ERROR_6  46L
+#define M_ERR_46_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_46_SUBMSG_1        MIL_TEXT("Operation not supported on 32-bit buffers.")
+#define M_ERR_46_SUBMSG_2        MIL_TEXT("Invalid minimal variation specified.")
+#define M_ERR_46_SUBMSG_3        MIL_TEXT("Invalid combination of control flag constants.")
+#define M_ERR_46_SUBMSG_4        MIL_TEXT("A marker image or a minimal variation must be supplied.")
+#define M_ERR_46_SUBMSG_5        MIL_TEXT("Value out of range.")
+#define M_ERR_46_SUBMSG_6        MIL_TEXT("Invalid mode specified.")
+#define M_ERR_46_SUBMSG_7        MIL_TEXT("The pointer should not be null.")
+#define M_ERR_46_SUBMSG_8        MIL_TEXT("The buffer must be a M_IMAGE + M_COMPRESS buffer.")
+#define M_ERR_46_SUBMSG_9        MIL_TEXT("Invalid compression type.")
+
+#define M_INVALID_PARAM_ERROR_7  47L
+#define M_ERR_47_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_47_SUBMSG_1        MIL_TEXT("Cannot change the compression type of a single band.")
+#define M_ERR_47_SUBMSG_2        MIL_TEXT("Invalid ControlFlag value.")
+#define M_ERR_47_SUBMSG_3        MIL_TEXT("The MIL_INT64 pointer cannot be null.")
+#define M_ERR_47_SUBMSG_4        MIL_TEXT("Invalid source buffers.")
+#define M_ERR_47_SUBMSG_5        MIL_TEXT("Invalid Q factor value.")
+#define M_ERR_47_SUBMSG_6        MIL_TEXT("Invalid destination buffers.")
+#define M_ERR_47_SUBMSG_7        MIL_TEXT("The second LUT must be M_NULL for M_WARP_POLYNOMIAL operation mode.")
+#define M_ERR_47_SUBMSG_8        MIL_TEXT("The angle range must be less than 360 degrees.")
+#define M_ERR_47_SUBMSG_9        MIL_TEXT("Invalid WarpParam1Id Size or Type.")
+
+#define M_INVALID_PARAM_ERROR_8  48L
+#define M_ERR_48_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_48_SUBMSG_1        MIL_TEXT("Source buffers must be of the same type and pixel depth.")
+#define M_ERR_48_SUBMSG_2        MIL_TEXT("Destination buffers must be of the same type and pixel depth.")
+#define M_ERR_48_SUBMSG_3        MIL_TEXT("Angle value must be between -360 and 360.")
+#define M_ERR_48_SUBMSG_4        MIL_TEXT("Polar conversion only supported on float buffers.")
+#define M_ERR_48_SUBMSG_5        MIL_TEXT("This type of conversion requires a 1 band destination buffer.")
+#define M_ERR_48_SUBMSG_6        MIL_TEXT("Invalid transform type.")
+#define M_ERR_48_SUBMSG_7        MIL_TEXT("The M_NORMALIZE flag must be used with this transform.")
+#define M_ERR_48_SUBMSG_8        MIL_TEXT("This type of conversion requires a 1 band source buffer.")
+#define M_ERR_48_SUBMSG_9        MIL_TEXT("Invalid number of bytes. Use zero or a positive value.")
+
+#define M_JPEG_ERROR_2           49L
+#define M_ERR_49_MSG             MIL_TEXT("JPEG handler general error.")
+#define M_ERR_49_SUBMSG_1        MIL_TEXT("Vertical sampling factor of more than 4 not supported.")
+#define M_ERR_49_SUBMSG_2        MIL_TEXT("MIL supports only 1-band and 3-band buffers.")
+#define M_ERR_49_SUBMSG_3        MIL_TEXT("MIL only supports sequential baseline DCT JPEG and lossless JPEG files.")
+#define M_ERR_49_SUBMSG_4        MIL_TEXT("Point transform not supported.")
+#define M_ERR_49_SUBMSG_5        MIL_TEXT("Reading beyond the available data.")
+#define M_ERR_49_SUBMSG_6        MIL_TEXT("The EOI marker is before the end of the file.")
+#define M_ERR_49_SUBMSG_7        MIL_TEXT("16-bit quantization table not supported.")
+#define M_ERR_49_SUBMSG_8        MIL_TEXT("Horizontal sampling factor of more than 4 not supported.")
+#define M_ERR_49_SUBMSG_9        MIL_TEXT("Sampling factors do not correspond to any supported format.")
+
+#define M_INVALID_PARAM_ERROR_9  50L
+#define M_ERR_50_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_50_SUBMSG_1        MIL_TEXT("Inquire type not supported.")
+#define M_ERR_50_SUBMSG_2        MIL_TEXT("The look up table must have a Y size of 1.")
+#define M_ERR_50_SUBMSG_3        MIL_TEXT("The size of the buffer is too large.")
+#define M_ERR_50_SUBMSG_4        MIL_TEXT("The destination buffer cannot be 1-bit.")
+#define M_ERR_50_SUBMSG_5        MIL_TEXT("SaturationSizeBit must be 1, 8, 16 or 32.")
+#define M_ERR_50_SUBMSG_6        MIL_TEXT("SaturationType must be M_SIGNED, M_UNSIGNED or M_FLOAT.")
+#define M_ERR_50_SUBMSG_7        MIL_TEXT("Invalid combination of SaturationType and SizeBit.")
+#define M_ERR_50_SUBMSG_8        MIL_TEXT("YUV buffers must be M_UNSIGNED.")
+#define M_ERR_50_SUBMSG_9        MIL_TEXT("The file name length must be greater than 0.")
+
+#define M_AVI_FILE_ERROR         51L
+#define M_ERR_51_MSG             MIL_TEXT("AVI file error.")
+#define M_ERR_51_SUBMSG_1        MIL_TEXT("The frame to write contains no data.")
+#define M_ERR_51_SUBMSG_2        MIL_TEXT("Error writing into the AVI file.")
+#define M_ERR_51_SUBMSG_3        MIL_TEXT("File format not supported.")
+#define M_ERR_51_SUBMSG_4        MIL_TEXT("The file format and image format are incompatible.")
+#define M_ERR_51_SUBMSG_5        MIL_TEXT("Error opening the AVI file.")
+#define M_ERR_51_SUBMSG_6        MIL_TEXT("Invalid file format.")
+#define M_ERR_51_SUBMSG_7        MIL_TEXT("Cannot write the frame. The index is full.")
+#define M_ERR_51_SUBMSG_8        MIL_TEXT("File format not supported. Cannot import MPEG4 sequences.")
+#define M_ERR_51_SUBMSG_9        MIL_TEXT("File format not supported. Cannot import H264 sequences.")
+
+#define M_DMA_ERROR              52L
+#define M_ERR_52_MSG             MIL_TEXT("Error using Matrox Dma service.")
+#define M_ERR_52_SUBMSG_1        MIL_TEXT("Cannot open the Matrox Dma manager.")
+#define M_ERR_52_SUBMSG_2        MIL_TEXT("Cannot access PCI data.")
+#define M_ERR_52_SUBMSG_3        MIL_TEXT("Unsupported control/inquire")
+#define M_ERR_52_SUBMSG_4        MIL_TEXT("Cannot communicate with Memory manager. Check if it is installed and started.")
+#define M_ERR_52_SUBMSG_5        MIL_TEXT("Cannot access hook information.")
+#define M_ERR_52_SUBMSG_6        MIL_TEXT("Can only perform this operation on the Default Host.")
+#define M_ERR_52_SUBMSG_7        MIL_TEXT("Unable to recover info from Dma pool.")
+#define M_ERR_52_SUBMSG_8        MIL_TEXT("Unsupported control flag.") // Error logged when using M_LOW_4GB_MEMORY or M_HIGH_4GB_MEMORY
+#define M_ERR_52_SUBMSG_9        MIL_TEXT("Could not enable or disable the Write-combining feature.")
+
+#define M_BMP_ERROR_3            53L
+#define M_ERR_53_MSG             MIL_TEXT("BMP handler general error.")
+#define M_ERR_53_SUBMSG_1        MIL_TEXT("MIL does not support a bit count of zero with BMP files.")
+#define M_ERR_53_SUBMSG_2        MIL_TEXT("MIL does not support 1-bit BMP files.")
+#define M_ERR_53_SUBMSG_3        MIL_TEXT("MIL does not support 4-bit BMP files.")
+#define M_ERR_53_SUBMSG_4        MIL_TEXT("Run Length Encoding ( RLE ) compression not supported.")
+#define M_ERR_53_SUBMSG_5        NO_SUBMSG
+#define M_ERR_53_SUBMSG_6        NO_SUBMSG
+#define M_ERR_53_SUBMSG_7        NO_SUBMSG
+#define M_ERR_53_SUBMSG_8        NO_SUBMSG
+#define M_ERR_53_SUBMSG_9        NO_SUBMSG
+
+#define M_JPEG_ERROR_3           54L
+#define M_ERR_54_MSG             MIL_TEXT("JPEG handler general error.")
+#define M_ERR_54_SUBMSG_1        MIL_TEXT("Invalid JPEG data.")
+#define M_ERR_54_SUBMSG_2        MIL_TEXT("Invalid data for a MTRX specific marker.")
+#define M_ERR_54_SUBMSG_3        MIL_TEXT("Extended sequential DCT not supported in MIL.")
+#define M_ERR_54_SUBMSG_4        MIL_TEXT("Progressive DCT not supported in MIL.")
+#define M_ERR_54_SUBMSG_5        MIL_TEXT("YUV9 packed images not supported.")
+#define M_ERR_54_SUBMSG_6        MIL_TEXT("YUV12 packed images not supported.")
+#define M_ERR_54_SUBMSG_7        MIL_TEXT("YUV24 packed images not supported.")
+#define M_ERR_54_SUBMSG_8        MIL_TEXT("Invalid data. EOI marker not found.")
+#define M_ERR_54_SUBMSG_9        MIL_TEXT("Cannot create or open file in write mode.")
+  
+#define M_ALLOC_ERROR_3          55L
+#define M_ERR_55_MSG             MIL_TEXT("Allocation error.")
+#define M_ERR_55_SUBMSG_1        MIL_TEXT("No pitch control flag used in create.")
+#define M_ERR_55_SUBMSG_2        MIL_TEXT("Cannot create a buffer with a physical address.")
+#define M_ERR_55_SUBMSG_3        MIL_TEXT("Cannot allocate a M_COMPRESS buffer with the M_DISP attribute.")
+#define M_ERR_55_SUBMSG_4        MIL_TEXT("Cannot allocate a M_COMPRESS buffer with the M_SIGNED or M_FLOAT type.")
+#define M_ERR_55_SUBMSG_5        MIL_TEXT("Interlaced buffers should have a height of at least 2.")
+#define M_ERR_55_SUBMSG_6        MIL_TEXT("Requested system DLL cannot be loaded.")
+#define M_ERR_55_SUBMSG_7        MIL_TEXT("MIL DLLs not found.")
+#define M_ERR_55_SUBMSG_8        MIL_TEXT("Not enough non-paged memory to allocate the buffer.")
+#define M_ERR_55_SUBMSG_9        MIL_TEXT("Not enough non-paged memory for a MIL CE allocation.\nContinuing the application may cause abnormal behavior!")
+
+#define M_LIMITATION_ERROR       56L
+#define M_ERR_56_MSG             MIL_TEXT("Limitation error.")
+#define M_ERR_56_SUBMSG_1        MIL_TEXT("This operation cannot be performed on a section of a compressed buffer.")
+#define M_ERR_56_SUBMSG_2        MIL_TEXT("This operation cannot be performed on a child of a compressed buffer.")
+#define M_ERR_56_SUBMSG_3        MIL_TEXT("This operation cannot be performed on a section of a YUV buffer.")
+#define M_ERR_56_SUBMSG_4        MIL_TEXT("This operation cannot be performed on a child of a YUV buffer.")
+#define M_ERR_56_SUBMSG_5        MIL_TEXT("This operation cannot be performed on a section of an M_PACKED buffer.")
+#define M_ERR_56_SUBMSG_6        MIL_TEXT("This operation cannot be performed on a child of an M_PACKED buffer.")
+#define M_ERR_56_SUBMSG_7        MIL_TEXT("This operation cannot be performed on a section of a M_PLANAR buffer.")
+#define M_ERR_56_SUBMSG_8        MIL_TEXT("This operation cannot be performed on a child of a M_PLANAR buffer.")
+#define M_ERR_56_SUBMSG_9        MIL_TEXT("This operation can only be performed on a compressed buffer.")
+
+#define M_OPERATION_ERROR_2      57L
+#define M_ERR_57_MSG             MIL_TEXT("Operation error.")
+#define M_ERR_57_SUBMSG_1        MIL_TEXT("Pitch must be a multiple of 4 pixels.")
+#define M_ERR_57_SUBMSG_2        MIL_TEXT("The default pitch byte value is incompatible with this type of buffer.")
+#define M_ERR_57_SUBMSG_3        MIL_TEXT("Operation not supported on remote systems.")
+#define M_ERR_57_SUBMSG_4        MIL_TEXT("Not enough non-paged memory to perform the operation on a remote system.")
+#define M_ERR_57_SUBMSG_5        MIL_TEXT("Not enough remote memory to perform the operation on a remote system.")
+#define M_ERR_57_SUBMSG_6        MIL_TEXT("Operation not supported on this system.")
+#define M_ERR_57_SUBMSG_7        MIL_TEXT("Cannot allocate event.")
+#define M_ERR_57_SUBMSG_8        MIL_TEXT("Cannot create event.")
+#define M_ERR_57_SUBMSG_9        MIL_TEXT("Buffer low level handle is invalid.")
+
+#define M_LICENSING_ERROR        58L
+#define M_ERR_58_MSG             MIL_TEXT("Licensing error.")
+#define M_ERR_58_SUBMSG_1        MIL_TEXT("A processing function was used with MIL-Lite.")
+#define M_ERR_58_SUBMSG_2        MIL_TEXT("License watchdog timed out.")
+#define M_ERR_58_SUBMSG_3        MIL_TEXT("A module was used without a valid license.")
+#define M_ERR_58_SUBMSG_4        MIL_TEXT("Debugging is not allowed with a run-time license. You must have a development license.")
+#define M_ERR_58_SUBMSG_5        MIL_TEXT("Your license does not allow the allocation of JPEG buffers.")
+#define M_ERR_58_SUBMSG_6        MIL_TEXT("Your license does not allow the allocation of JPEG2000 buffers.")
+#define M_ERR_58_SUBMSG_7        MIL_TEXT("A module not permitted by MappControl(M_LICENSE_PERMIT_MODULES) was used.")
+#define M_ERR_58_SUBMSG_8        MIL_TEXT("This Early Access version of MIL has expired. Please contact your Matrox representative to obtain an updated version.")
+#define M_ERR_58_SUBMSG_9        MIL_TEXT("The validity period of your MIL license is over. Please contact your Matrox representative to obtain a new license.")
+
+#define M_AVI_FILE_ERROR_2       59L
+#define M_ERR_59_MSG             MIL_TEXT("AVI file error.")
+#define M_ERR_59_SUBMSG_1        NO_SUBMSG
+#define M_ERR_59_SUBMSG_2        NO_SUBMSG
+#define M_ERR_59_SUBMSG_3        MIL_TEXT("The file is still used by MbufExportSequence.")
+#define M_ERR_59_SUBMSG_4        MIL_TEXT("The file is still used by MbufImportSequence.")
+#define M_ERR_59_SUBMSG_5        MIL_TEXT("Cannot write frame. The AVI file size limit has been reached.")
+#define M_ERR_59_SUBMSG_6        MIL_TEXT("Impossible to write into a closed file.")
+#define M_ERR_59_SUBMSG_7        MIL_TEXT("Error creating AVI stream.")
+#define M_ERR_59_SUBMSG_8        MIL_TEXT("The file is already open.")
+#define M_ERR_59_SUBMSG_9        MIL_TEXT("Impossible to read from a closed file.")
+
+#define M_JPEG_COMPRESS_ERROR_3  60L
+#define M_ERR_60_MSG             MIL_TEXT("JPEG compression error.")
+#define M_ERR_60_SUBMSG_1        MIL_TEXT("Cannot allocate 3-band M_JPEG_LOSSLESS_INTERLACED buffers.")
+#define M_ERR_60_SUBMSG_2        MIL_TEXT("In lossless, the RestartInterval multiplied by the number of \ncolumns in the buffer must fit in 16 bits (smaller than 65536).")
+#define M_ERR_60_SUBMSG_3        MIL_TEXT("The restart interval must fit in 16 bits (smaller than 65536).")
+#define M_ERR_60_SUBMSG_4        MIL_TEXT("Only JPEG lossless buffers can have predictors.")
+#define M_ERR_60_SUBMSG_5        MIL_TEXT("Luminance parameters are only allowed for YUV buffers.")
+#define M_ERR_60_SUBMSG_6        MIL_TEXT("Chrominance parameters are only allowed for YUV buffers.")
+#define M_ERR_60_SUBMSG_7        MIL_TEXT("AC tables and quantization parameters are only allowed \nfor JPEG lossy buffers.")
+#define M_ERR_60_SUBMSG_8        MIL_TEXT("For YUV buffers, specific luminance or chrominance \nflags must be used.")
+#define M_ERR_60_SUBMSG_9        MIL_TEXT("Field size is only applicable to interlaced buffers.")
+
+#define M_AVI_FILE_ERROR_3       61L
+#define M_ERR_61_MSG             MIL_TEXT("AVI file error.")
+#define M_ERR_61_SUBMSG_1        MIL_TEXT("Error reading from the AVI file.")
+#define M_ERR_61_SUBMSG_2        MIL_TEXT("Cannot read after the last frame.")
+#define M_ERR_61_SUBMSG_3        NO_SUBMSG
+#define M_ERR_61_SUBMSG_4        MIL_TEXT("Images must have a width greater than or equal to 16.")
+#define M_ERR_61_SUBMSG_5        MIL_TEXT("Images must have a height greater than or equal to 8.")
+#define M_ERR_61_SUBMSG_6        NO_SUBMSG
+#define M_ERR_61_SUBMSG_7        MIL_TEXT("The frame rate has not been set.")
+#define M_ERR_61_SUBMSG_8        NO_SUBMSG
+#define M_ERR_61_SUBMSG_9        MIL_TEXT("The AVI file size exceeds the supported limit.")
+
+#define M_USER_BIT_CONFIG_ERROR  62L         // These 2 following message are use for user bits of 4sightII
+#define M_ERR_62_MSG             NO_MSG      // Now the error message are move the the milmtxapi.dll
+#define M_ERR_62_SUBMSG_1        NO_SUBMSG
+#define M_ERR_62_SUBMSG_2        NO_SUBMSG
+#define M_ERR_62_SUBMSG_3        NO_SUBMSG
+#define M_ERR_62_SUBMSG_4        NO_SUBMSG
+#define M_ERR_62_SUBMSG_5        NO_SUBMSG
+#define M_ERR_62_SUBMSG_6        NO_SUBMSG
+#define M_ERR_62_SUBMSG_7        NO_SUBMSG
+#define M_ERR_62_SUBMSG_8        NO_SUBMSG
+#define M_ERR_62_SUBMSG_9        NO_SUBMSG
+
+#define M_USER_BIT_ERROR         63L
+#define M_ERR_63_MSG             NO_MSG
+#define M_ERR_63_SUBMSG_1        NO_SUBMSG
+#define M_ERR_63_SUBMSG_2        NO_SUBMSG
+#define M_ERR_63_SUBMSG_3        NO_SUBMSG
+#define M_ERR_63_SUBMSG_4        NO_SUBMSG
+#define M_ERR_63_SUBMSG_5        NO_SUBMSG
+#define M_ERR_63_SUBMSG_6        NO_SUBMSG
+#define M_ERR_63_SUBMSG_7        NO_SUBMSG
+#define M_ERR_63_SUBMSG_8        NO_SUBMSG
+#define M_ERR_63_SUBMSG_9        NO_SUBMSG
+
+#define M_TIFF_ERROR_3           64L
+#define M_ERR_64_MSG             MIL_TEXT("TIFF File access error.")
+#define M_ERR_64_SUBMSG_1        MIL_TEXT("Error recording tag.")
+#define M_ERR_64_SUBMSG_2        MIL_TEXT("LZW compression not supported in multi strip TIFF files.")
+#define M_ERR_64_SUBMSG_3        MIL_TEXT("Maximum TIFF file size exceeded")
+#define M_ERR_64_SUBMSG_4        MIL_TEXT("BitsPerSample image must be 1 for CCITT 3/4 compression.")
+#define M_ERR_64_SUBMSG_5        MIL_TEXT("Compression type not supported.")
+#define M_ERR_64_SUBMSG_6        MIL_TEXT("Image Format not supported.")
+#define M_ERR_64_SUBMSG_7        MIL_TEXT("Cannot read tile data.")
+#define M_ERR_64_SUBMSG_8        MIL_TEXT("Cannot read strip data.")
+#define M_ERR_64_SUBMSG_9        MIL_TEXT("Cannot write strip data.")
+
+#define M_MIL_FILE_ERROR_4       65L
+#define M_ERR_65_MSG             MIL_TEXT("MIL File access error.")
+#define M_ERR_65_SUBMSG_1        MIL_TEXT("Error recording tag.")
+#define M_ERR_65_SUBMSG_2        MIL_TEXT("LZW compression not supported in multi strip MIL files.")
+#define M_ERR_65_SUBMSG_3        MIL_TEXT("Error when closing file. Check disk space.")
+#define M_ERR_65_SUBMSG_4        MIL_TEXT("Unable to save: object is too big.")
+#define M_ERR_65_SUBMSG_5        MIL_TEXT("Stream is corrupt or has been generated with a newer version of MIL.")
+#define M_ERR_65_SUBMSG_6        MIL_TEXT("The specified version is too old to support compression.")
+#define M_ERR_65_SUBMSG_7        NO_SUBMSG
+#define M_ERR_65_SUBMSG_8        NO_SUBMSG
+#define M_ERR_65_SUBMSG_9        NO_SUBMSG
+
+#define M_JPEG_ERROR_4           66L
+#define M_ERR_66_MSG             MIL_TEXT("JPEG handler general error.")
+#define M_ERR_66_SUBMSG_1        MIL_TEXT("Second field of interlaced image not found.")
+#define M_ERR_66_SUBMSG_2        MIL_TEXT("Buffer width is greater than the maximum supported.")
+#define M_ERR_66_SUBMSG_3        MIL_TEXT("Buffer height is greater than the maximum supported.")
+#define M_ERR_66_SUBMSG_4        MIL_TEXT("Error writing JPEG file.")
+#define M_ERR_66_SUBMSG_5        NO_SUBMSG
+#define M_ERR_66_SUBMSG_6        NO_SUBMSG
+#define M_ERR_66_SUBMSG_7        NO_SUBMSG
+#define M_ERR_66_SUBMSG_8        NO_SUBMSG
+#define M_ERR_66_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_10 67L
+#define M_ERR_67_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_67_SUBMSG_1        MIL_TEXT("The width and height of the source and destination buffers must be a multiple of 8.")
+#define M_ERR_67_SUBMSG_2        MIL_TEXT("Operation not supported on 16 bits buffer.")
+#define M_ERR_67_SUBMSG_3        MIL_TEXT("Size of image buffers must be greater than or equal to the size of the kernel.")
+#define M_ERR_67_SUBMSG_4        MIL_TEXT("Invalid data formats.")
+#define M_ERR_67_SUBMSG_5        MIL_TEXT("Operation not supported on 3 bands planar buffers.")
+#define M_ERR_67_SUBMSG_6        MIL_TEXT("Float addresses must be a multiple of 4.")
+#define M_ERR_67_SUBMSG_7        MIL_TEXT("This operation is only supported on the host.")
+#define M_ERR_67_SUBMSG_8        MIL_TEXT("Cannot create an M_NO_MAP buffer with null pointers.")
+#define M_ERR_67_SUBMSG_9        MIL_TEXT("Can only create a M_NO_MAP buffer with a physical address.")
+
+#define M_J2K_ERROR_1            68L
+#define M_ERR_68_MSG             MIL_TEXT("JPEG2000 handler general error.")
+#define M_ERR_68_SUBMSG_1        MIL_TEXT("Error closing JPEG2000 file.")
+#define M_ERR_68_SUBMSG_2        MIL_TEXT("Unable to allocate sufficient memory.")
+#define M_ERR_68_SUBMSG_3        MIL_TEXT("Cannot create or open file in write mode.")
+#define M_ERR_68_SUBMSG_4        MIL_TEXT("Error opening JPEG2000 file.")
+#define M_ERR_68_SUBMSG_5        MIL_TEXT("Error writing JPEG2000 file.")
+#define M_ERR_68_SUBMSG_6        NO_SUBMSG
+#define M_ERR_68_SUBMSG_7        NO_SUBMSG
+#define M_ERR_68_SUBMSG_8        NO_SUBMSG
+#define M_ERR_68_SUBMSG_9        NO_SUBMSG
+
+#define M_J2K_ERROR_2            69L
+#define M_ERR_69_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_69_SUBMSG_1        MIL_TEXT("Invalid JPEG2000 data.")
+#define M_ERR_69_SUBMSG_2        MIL_TEXT("Unexpected marker in the JPEG2000 image.")
+#define M_ERR_69_SUBMSG_3        MIL_TEXT("Component index out of range.")
+#define M_ERR_69_SUBMSG_4        MIL_TEXT("MIL supports only 1-band and 3-band buffers.")
+#define M_ERR_69_SUBMSG_5        MIL_TEXT("All components must have the same bit depth.")
+#define M_ERR_69_SUBMSG_6        MIL_TEXT("Unsupported bit depth.")
+#define M_ERR_69_SUBMSG_7        MIL_TEXT("Invalid subsampling factors.")
+#define M_ERR_69_SUBMSG_8        MIL_TEXT("Scalar implicit quantization not supported.")
+#define M_ERR_69_SUBMSG_9        MIL_TEXT("Unsupported coding style.")
+
+#define M_LICENSE_ERROR_2        70L
+#define M_ERR_70_MSG             MIL_TEXT("License error.")
+#define M_ERR_70_SUBMSG_1        MIL_TEXT("No valid license found (1)")
+#define M_ERR_70_SUBMSG_2        MIL_TEXT("No valid license found (2)")
+#define M_ERR_70_SUBMSG_3        MIL_TEXT("No valid license found (3)")
+#define M_ERR_70_SUBMSG_4        MIL_TEXT("PC clock has been altered")
+#define M_ERR_70_SUBMSG_5        NO_SUBMSG
+#define M_ERR_70_SUBMSG_6        MIL_TEXT("No valid license found (6)")
+#define M_ERR_70_SUBMSG_7        NO_SUBMSG
+#define M_ERR_70_SUBMSG_8        NO_SUBMSG
+#define M_ERR_70_SUBMSG_9        NO_SUBMSG
+
+#define M_J2K_ERROR_3            71L
+#define M_ERR_71_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_71_SUBMSG_1        MIL_TEXT("Unsupported progression order.")
+#define M_ERR_71_SUBMSG_2        MIL_TEXT("Multi-layer images are not supported.")
+#define M_ERR_71_SUBMSG_3        MIL_TEXT("Unsupported compression setting.")
+#define M_ERR_71_SUBMSG_4        MIL_TEXT("This marker is not supported by MIL yet.")
+#define M_ERR_71_SUBMSG_5        MIL_TEXT("Wavelet type cannot be changed.")
+#define M_ERR_71_SUBMSG_6        MIL_TEXT("Mismatched field settings.")
+#define M_ERR_71_SUBMSG_7        MIL_TEXT("Not enough user memory to do the operation.")
+#define M_ERR_71_SUBMSG_8        MIL_TEXT("Invalid number of decomposition levels.")
+#define M_ERR_71_SUBMSG_9        MIL_TEXT("Invalid number of wavelet sub-bands.")
+
+#define M_J2K_ERROR_4            72L
+#define M_ERR_72_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_72_SUBMSG_1        MIL_TEXT("The target size must be a positive number of bytes.")
+#define M_ERR_72_SUBMSG_2        MIL_TEXT("Target size is only allowed in lossy modes.")
+#define M_ERR_72_SUBMSG_3        MIL_TEXT("Quantization tables are applicable to lossy buffers only.")
+#define M_ERR_72_SUBMSG_4        MIL_TEXT("The Q factor is only valid with lossy buffers.")
+#define M_ERR_72_SUBMSG_5        MIL_TEXT("Wrong number of entries in the quantization table.")
+#define M_ERR_72_SUBMSG_6        MIL_TEXT("Invalid MIL_ID for the quantization table.")
+#define M_ERR_72_SUBMSG_7        MIL_TEXT("The quantization table must be one-band, 32-bit floating-point, one-dimensional, and M_ARRAY.")
+#define M_ERR_72_SUBMSG_8        MIL_TEXT("Valid Q factor values are between 1 and 99 (both inclusive).")
+#define M_ERR_72_SUBMSG_9        MIL_TEXT("Unexpected number of tile-parts.")
+
+#define M_J2K_ERROR_5            73L
+#define M_ERR_73_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_73_SUBMSG_1        MIL_TEXT("Corrupted JPEG2000 data.")
+#define M_ERR_73_SUBMSG_2        MIL_TEXT("Quantization coefficient out of range.")
+#define M_ERR_73_SUBMSG_3        MIL_TEXT("Luminance and chrominance parameters are only allowed for YUV buffers.")
+#define M_ERR_73_SUBMSG_4        MIL_TEXT("The number of reserved bytes must be greater than or equal to 0.")
+#define M_ERR_73_SUBMSG_5        MIL_TEXT("Tile offsets are out of range.")
+#define M_ERR_73_SUBMSG_6        MIL_TEXT("Image offsets are out of range.")
+#define M_ERR_73_SUBMSG_7        MIL_TEXT("Only one COC marker by band is allowed.")
+#define M_ERR_73_SUBMSG_8        MIL_TEXT("Only one QCC marker by band is allowed.")
+#define M_ERR_73_SUBMSG_9        MIL_TEXT("Invalid size bit.")
+
+#define M_FUNC_CALL_ERROR        74L
+#define M_ERR_74_MSG             MIL_TEXT("Function call error.")
+#define M_ERR_74_SUBMSG_1        MIL_TEXT("Calibration not supported on remote systems.")
+#define M_ERR_74_SUBMSG_2        MIL_TEXT("Unable to load the User Slave DLL. Please make sure it is in the path.")
+#define M_ERR_74_SUBMSG_3        MIL_TEXT("Slave function not found in the DLL.")
+#define M_ERR_74_SUBMSG_4        MIL_TEXT("Cannot execute because two MIL objects reside in two different workspaces/platforms and compensation cannot be done.") //TBM MIL 8
+#define M_ERR_74_SUBMSG_5        MIL_TEXT("Slave module is not in the user module table.")
+#define M_ERR_74_SUBMSG_6        MIL_TEXT("Slave function is not in the user function table.")
+#define M_ERR_74_SUBMSG_7        MIL_TEXT("No slave function pointer specified.")
+#define M_ERR_74_SUBMSG_8        MIL_TEXT("No slave function in the internal function table.")
+#define M_ERR_74_SUBMSG_9        MIL_TEXT("The function table already contains a function pointer.\nCheck that you have not given the same opcode to 2 different functions.")
+
+#define M_OPERATION_ERROR_3      75L
+#define M_ERR_75_MSG             MIL_TEXT("Operation error.")
+#define M_ERR_75_SUBMSG_1        MIL_TEXT("Cannot free internally allocated objects.")
+#define M_ERR_75_SUBMSG_2        MIL_TEXT("SystemId and ObjectType are incompatible.") // MthrAlloc
+#define M_ERR_75_SUBMSG_3        MIL_TEXT("Thread or event id is not compatible with the control flag specified.") // MthrControl
+#define M_ERR_75_SUBMSG_4        MIL_TEXT("Cannot perform operation with this thread or event id.")
+#define M_ERR_75_SUBMSG_5        MIL_TEXT("Cannot perform operation on unmapped buffer(s).")
+#define M_ERR_75_SUBMSG_6        MIL_TEXT("Cannot map buffers.")
+#define M_ERR_75_SUBMSG_7        MIL_TEXT("Buffer must have M_DIRECTX in its format.")
+#define M_ERR_75_SUBMSG_8        MIL_TEXT("Cannot map 2 buffers of the same family at the same time.")
+#define M_ERR_75_SUBMSG_9        MIL_TEXT("Buffer cannot have child buffers.")
+
+#define M_BUF_TRANSFER_ERROR     76L
+#define M_ERR_76_MSG             MIL_TEXT("Transfer Error.")
+#define M_ERR_76_SUBMSG_1        MIL_TEXT("Unknown transfer function.")
+#define M_ERR_76_SUBMSG_2        MIL_TEXT("Transfer method not supported for this transfer function.")
+#define M_ERR_76_SUBMSG_3        MIL_TEXT("Transfer cannot be done asynchronously.")
+#define M_ERR_76_SUBMSG_4        MIL_TEXT("Scaling not supported by this transfer function.")
+#define M_ERR_76_SUBMSG_5        MIL_TEXT("No transfer made.")
+#define M_ERR_76_SUBMSG_6        MIL_TEXT("MTX0 transfer only supported on MTX0 buffers.")
+#define M_ERR_76_SUBMSG_7        MIL_TEXT("MTX0 not supported in this environment.")
+#define M_ERR_76_SUBMSG_8        MIL_TEXT("Illegal null MIL_ID passed to MbufTransfer.")
+#define M_ERR_76_SUBMSG_9        MIL_TEXT("Invalid Transfer type.")
+
+#define M_DISP_SERVICE_ERROR     77L
+#define M_ERR_77_MSG             MIL_TEXT("Display service error.")
+#define M_ERR_77_SUBMSG_1        MIL_TEXT("Cannot load MilDisplay DLL.")
+#define M_ERR_77_SUBMSG_2        MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_77_SUBMSG_3        MIL_TEXT("Cannot find AppAlloc function in MilDisplay.")
+#define M_ERR_77_SUBMSG_4        MIL_TEXT("Cannot find AppFree function in MilDisplay.")
+#define M_ERR_77_SUBMSG_5        NO_SUBMSG
+#define M_ERR_77_SUBMSG_6        NO_SUBMSG
+#define M_ERR_77_SUBMSG_7        NO_SUBMSG
+#define M_ERR_77_SUBMSG_8        NO_SUBMSG
+#define M_ERR_77_SUBMSG_9        NO_SUBMSG
+
+#define M_ALLOC_ERROR_4          78L
+#define M_ERR_78_MSG             MIL_TEXT("Allocation error.")
+#define M_ERR_78_SUBMSG_1        MIL_TEXT("M_BGR15 and M_BGR16 buffers are not supported.")
+#define M_ERR_78_SUBMSG_2        MIL_TEXT("The requested system is not (correctly) installed.")
+#define M_ERR_78_SUBMSG_3        MIL_TEXT("Not enough logical address space to map the buffer.")
+#define M_ERR_78_SUBMSG_4        MIL_TEXT("Cannot open the DCF.")
+#define M_ERR_78_SUBMSG_5        MIL_TEXT("Cannot create a buffer at address 0.")
+#define M_ERR_78_SUBMSG_6        MIL_TEXT("Cannot allocate a M_MAPPABLE buffer with the M_DISP attribute.")
+#define M_ERR_78_SUBMSG_7        MIL_TEXT("The driver DLL has an invalid format and cannot be loaded.")
+#define M_ERR_78_SUBMSG_8        MIL_TEXT("Invalid bits set in the attribute.")
+#define M_ERR_78_SUBMSG_9        MIL_TEXT("The M_NO_PARSING control flag is only available to M_COMPRESS buffers.")
+
+#define M_SYS_CTRL_INQ_ERROR     79L
+#define M_ERR_79_MSG             MIL_TEXT("System Control/Inquire error.")
+#define M_ERR_79_SUBMSG_1        MIL_TEXT("Control/Inquire type supported only on the Host system.")
+#define M_ERR_79_SUBMSG_2        MIL_TEXT("Default pitch byte must be a power of 2.")
+#define M_ERR_79_SUBMSG_3        MIL_TEXT("This Control/Inquire is not supported any more.")
+#define M_ERR_79_SUBMSG_4        MIL_TEXT("This Control/Inquire is now a Digitizer Control/Inquire.")
+#define M_ERR_79_SUBMSG_5        MIL_TEXT("This Control/Inquire is now a Display Control/Inquire.")
+#define M_ERR_79_SUBMSG_6        MIL_TEXT("Controls are not allowed on this system.")
+#define M_ERR_79_SUBMSG_7        MIL_TEXT("Cannot call MsysControl with MIL_INT.")
+#define M_ERR_79_SUBMSG_8        NO_SUBMSG
+#define M_ERR_79_SUBMSG_9        NO_SUBMSG
+
+#define M_APP_MODIF_ERROR        80L
+#define M_ERR_80_MSG             MIL_TEXT("Swap ID error.")
+#define M_ERR_80_SUBMSG_1        MIL_TEXT("This function does not support remote objects.")
+#define M_ERR_80_SUBMSG_2        NO_SUBMSG
+#define M_ERR_80_SUBMSG_3        NO_SUBMSG
+#define M_ERR_80_SUBMSG_4        NO_SUBMSG
+#define M_ERR_80_SUBMSG_5        NO_SUBMSG
+#define M_ERR_80_SUBMSG_6        NO_SUBMSG
+#define M_ERR_80_SUBMSG_7        NO_SUBMSG
+#define M_ERR_80_SUBMSG_8        NO_SUBMSG
+#define M_ERR_80_SUBMSG_9        NO_SUBMSG
+
+#define M_INSTALLATION_ERROR     81L
+#define M_ERR_81_MSG             MIL_TEXT("Installation error.")
+#define M_ERR_81_SUBMSG_1        MIL_TEXT("Could not find the installation path in the registry.")
+#define M_ERR_81_SUBMSG_2        MIL_TEXT("The list of installed boards is corrupted in the registry. Please re-install MIL.")
+#define M_ERR_81_SUBMSG_3        NO_SUBMSG
+#define M_ERR_81_SUBMSG_4        NO_SUBMSG
+#define M_ERR_81_SUBMSG_5        NO_SUBMSG
+#define M_ERR_81_SUBMSG_6        NO_SUBMSG
+#define M_ERR_81_SUBMSG_7        NO_SUBMSG
+#define M_ERR_81_SUBMSG_8        NO_SUBMSG
+#define M_ERR_81_SUBMSG_9        NO_SUBMSG
+
+#define M_BUF_CTRL_INQ_ERROR     82L
+#define M_ERR_82_MSG             MIL_TEXT("Buffer Control/Inquire error.")
+#define M_ERR_82_SUBMSG_1        MIL_TEXT("Invalid index of bands.")
+#define M_ERR_82_SUBMSG_2        NO_SUBMSG
+#define M_ERR_82_SUBMSG_3        NO_SUBMSG
+#define M_ERR_82_SUBMSG_4        NO_SUBMSG
+#define M_ERR_82_SUBMSG_5        NO_SUBMSG
+#define M_ERR_82_SUBMSG_6        NO_SUBMSG
+#define M_ERR_82_SUBMSG_7        NO_SUBMSG
+#define M_ERR_82_SUBMSG_8        NO_SUBMSG
+#define M_ERR_82_SUBMSG_9        NO_SUBMSG
+
+#define M_CALL_FPGA_PARAM_ERROR    83L
+#define M_ERR_83_MSG             MIL_TEXT("Invalid parameter in user function call.")
+#define M_ERR_83_SUBMSG_1        MIL_TEXT("All the MIL IDs need to be allocated on the same system.")
+#define M_ERR_83_SUBMSG_2        MIL_TEXT("Only buffer IDs are supported.")
+#define M_ERR_83_SUBMSG_3        MIL_TEXT("At least one parameter must be an ID.")
+#define M_ERR_83_SUBMSG_4        MIL_TEXT("Cannot execute user functions on the Host system.")
+#define M_ERR_83_SUBMSG_5        MIL_TEXT("Too many parameters.")
+#define M_ERR_83_SUBMSG_6        NO_SUBMSG
+#define M_ERR_83_SUBMSG_7        NO_SUBMSG
+#define M_ERR_83_SUBMSG_8        NO_SUBMSG
+#define M_ERR_83_SUBMSG_9        NO_SUBMSG
+
+#define M_DISP_CTRL_INQ_ERROR    84L
+#define M_ERR_84_MSG             MIL_TEXT("Display Control/Inquire error.")
+#define M_ERR_84_SUBMSG_1        MIL_TEXT("This Control/Inquire is no longer supported.")
+#define M_ERR_84_SUBMSG_2        NO_SUBMSG
+#define M_ERR_84_SUBMSG_3        NO_SUBMSG
+#define M_ERR_84_SUBMSG_4        NO_SUBMSG
+#define M_ERR_84_SUBMSG_5        NO_SUBMSG
+#define M_ERR_84_SUBMSG_6        NO_SUBMSG
+#define M_ERR_84_SUBMSG_7        NO_SUBMSG
+#define M_ERR_84_SUBMSG_8        NO_SUBMSG
+#define M_ERR_84_SUBMSG_9        NO_SUBMSG
+
+#define M_J2K_ERROR_6            85L
+#define M_ERR_85_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_85_SUBMSG_1        MIL_TEXT("Too many tiles.")
+#define M_ERR_85_SUBMSG_2        MIL_TEXT("Invalid code block size.")
+#define M_ERR_85_SUBMSG_3        MIL_TEXT("Unexpected field delimiter.")
+#define M_ERR_85_SUBMSG_4        MIL_TEXT("Video standard not supported.")
+#define M_ERR_85_SUBMSG_5        MIL_TEXT("Unknown wavelet and quantization settings.")
+#define M_ERR_85_SUBMSG_6        MIL_TEXT("Unknown entropy coder parameters.")
+#define M_ERR_85_SUBMSG_7        MIL_TEXT("Code block attributes are truncated.")
+#define M_ERR_85_SUBMSG_8        MIL_TEXT("The field is truncated.")
+#define M_ERR_85_SUBMSG_9        MIL_TEXT("Invalid JP2 format.")
+
+#define M_INVALID_PARAM_ERROR_11 86L
+#define M_ERR_86_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_86_SUBMSG_1        MIL_TEXT("Mask buffer must be the same size as the source buffer.")
+#define M_ERR_86_SUBMSG_2        MIL_TEXT("Invalid frame rate value.")
+#define M_ERR_86_SUBMSG_3        MIL_TEXT("Invalid number of frames.")
+#define M_ERR_86_SUBMSG_4        MIL_TEXT("Invalid file format flag.")
+#define M_ERR_86_SUBMSG_5        MIL_TEXT("The file name pointer must not be null.")
+#define M_ERR_86_SUBMSG_6        MIL_TEXT("The pointer to the array of frames must be null.")
+#define M_ERR_86_SUBMSG_7        MIL_TEXT("The pointer to the array of frames must not be null.")
+#define M_ERR_86_SUBMSG_8        MIL_TEXT("The number of frames must be 0.")
+#define M_ERR_86_SUBMSG_9        MIL_TEXT("Invalid control flag.")
+
+#define M_INVALID_PARAM_ERROR_12 87L
+#define M_ERR_87_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_87_SUBMSG_1        MIL_TEXT("The start image value must be 0.")
+#define M_ERR_87_SUBMSG_2        MIL_TEXT("Invalid start image value.")
+#define M_ERR_87_SUBMSG_3        MIL_TEXT("The operation flag must be M_NULL.")
+#define M_ERR_87_SUBMSG_4        MIL_TEXT("Invalid operation flag.")
+#define M_ERR_87_SUBMSG_5        MIL_TEXT("The system identifier must be M_NULL.")
+#define M_ERR_87_SUBMSG_6        MIL_TEXT("Invalid system identifier.")
+#define M_ERR_87_SUBMSG_7        MIL_TEXT("Invalid shen filter type.")
+#define M_ERR_87_SUBMSG_8        MIL_TEXT("Invalid shen smooth factor range.")
+#define M_ERR_87_SUBMSG_9        MIL_TEXT("Invalid deriche filter type.")
+
+#define M_INVALID_PARAM_ERROR_13 88L
+#define M_ERR_88_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_88_SUBMSG_1        MIL_TEXT("Invalid deriche smooth factor range.")
+#define M_ERR_88_SUBMSG_2        MIL_TEXT("Difference between angles must be in the range of 0 - 360 degrees.")
+#define M_ERR_88_SUBMSG_3        MIL_TEXT("Invalid array format.")
+#define M_ERR_88_SUBMSG_4        MIL_TEXT("This operation requires a child buffer.")
+#define M_ERR_88_SUBMSG_5        MIL_TEXT("Cannot move the buffer because it has a child.")
+#define M_ERR_88_SUBMSG_6        MIL_TEXT("Cannot resize the buffer because it is selected on a display.")
+#define M_ERR_88_SUBMSG_7        MIL_TEXT("Cannot move a compressed buffer.")
+#define M_ERR_88_SUBMSG_8        MIL_TEXT("Type and attribute depths do not match.")
+#define M_ERR_88_SUBMSG_9        MIL_TEXT("Invalid internal format.")
+
+#define M_BUF_TRANSFER_ERROR_2   89L
+#define M_ERR_89_MSG             MIL_TEXT("Transfer Error.")
+#define M_ERR_89_SUBMSG_1        MIL_TEXT("Source and Destination buffers must belong to the same system.")
+#define M_ERR_89_SUBMSG_2        MIL_TEXT("M_DRIVER_METHOD cannot be specified with other methods.")
+#define M_ERR_89_SUBMSG_3        MIL_TEXT("Invalid composition source: planar buffer not supported.") 
+#define M_ERR_89_SUBMSG_4        MIL_TEXT("Composition only supported on all bands (in source and destination).")
+#define M_ERR_89_SUBMSG_5        MIL_TEXT("Composition is only supported with Mono8, Mono16, RGB16, BGR24 and BGR32 buffers.")
+#define M_ERR_89_SUBMSG_6        MIL_TEXT("Destination buffer of composition must have the same format as the source buffer.")
+#define M_ERR_89_SUBMSG_7        MIL_TEXT("Invalid composition source: yuv buffer not supported.")
+#define M_ERR_89_SUBMSG_8        MIL_TEXT("Invalid offset and/or size specified.")
+#define M_ERR_89_SUBMSG_9        MIL_TEXT("Float buffer not supported.")
+
+#define M_J2K_ERROR_7            90L
+#define M_ERR_90_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_90_SUBMSG_1        MIL_TEXT("Precinct size must be a power of two.")
+#define M_ERR_90_SUBMSG_2        MIL_TEXT("Only the first resolution can have a precinct size of 1.")
+#define M_ERR_90_SUBMSG_3        MIL_TEXT("Precinct size must not exceed 32768.")
+#define M_ERR_90_SUBMSG_4        MIL_TEXT("Code block size must be a power of 2.")
+#define M_ERR_90_SUBMSG_5        MIL_TEXT("The quantization table must be a one-band, 16 bits unsigned, one-dimensional M_ARRAY.")
+#define M_ERR_90_SUBMSG_6        MIL_TEXT("Invalid MIL_ID for the precincts size table.")
+#define M_ERR_90_SUBMSG_7        MIL_TEXT("The precincts size table must be a one-band, 16 bits unsigned, one-dimensional M_ARRAY.")
+#define M_ERR_90_SUBMSG_8        MIL_TEXT("Expected marker not found.")
+#define M_ERR_90_SUBMSG_9        MIL_TEXT("The buffer contains invalid data.")
+
+#define M_AUX_SERVICE_ERROR      91L
+#define M_ERR_91_MSG             MIL_TEXT("Auxiliary service error.")
+#define M_ERR_91_SUBMSG_1        MIL_TEXT("Cannot load MilAux DLL.")
+#define M_ERR_91_SUBMSG_2        NO_SUBMSG
+#define M_ERR_91_SUBMSG_3        MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_91_SUBMSG_4        MIL_TEXT("Hardware not supported by Auxiliary Service.")
+#define M_ERR_91_SUBMSG_5        MIL_TEXT("System not allocated.")
+#define M_ERR_91_SUBMSG_6        MIL_TEXT("The computer needs to be rebooted.")
+#define M_ERR_91_SUBMSG_7        NO_SUBMSG
+#define M_ERR_91_SUBMSG_8        NO_SUBMSG
+#define M_ERR_91_SUBMSG_9        NO_SUBMSG
+
+#define M_ALLOC_ERROR_5          92L
+#define M_ERR_92_MSG             MIL_TEXT("Allocation error.")
+#define M_ERR_92_SUBMSG_1        MIL_TEXT("Cannot create a buffer on this MIL_ID, the source buffer does not have a valid host address.")
+#define M_ERR_92_SUBMSG_2        MIL_TEXT("Cannot create a buffer on this MIL_ID, the source buffer does not have a valid physical address.")
+#define M_ERR_92_SUBMSG_3        MIL_TEXT("Invalid pitch value.")
+#define M_ERR_92_SUBMSG_4        MIL_TEXT("Cannot allocate an on-board buffer with the M_MAPPABLE attribute.")
+#define M_ERR_92_SUBMSG_5        MIL_TEXT("This system does not support allocations with a non-default pitch.")
+#define M_ERR_92_SUBMSG_6        MIL_TEXT("Unable to map the non-paged buffer to a logical address.")
+#define M_ERR_92_SUBMSG_7        MIL_TEXT("Unable to allocate digitizer using a non-ansi DCF file name.")
+#define M_ERR_92_SUBMSG_8        MIL_TEXT("DirectX version not supported.")
+#define M_ERR_92_SUBMSG_9        MIL_TEXT("Unable to allocate shadow for inter-system calls.")
+
+#define M_DGPRCSS_WATCHOG_ERROR 302 //This define was given to the user. It is now only available internally.
+#define M_RUNTIME_ERROR_1        93L
+#define M_ERR_93_MSG             MIL_TEXT("Runtime error.")
+#define M_ERR_93_SUBMSG_1        MIL_TEXT("The specified feature is not implemented.")
+#define M_ERR_93_SUBMSG_2        NO_SUBMSG
+#define M_ERR_93_SUBMSG_3        NO_SUBMSG
+#define M_ERR_93_SUBMSG_4        NO_SUBMSG
+#define M_ERR_93_SUBMSG_5        NO_SUBMSG
+#define M_ERR_93_SUBMSG_6        NO_SUBMSG
+#define M_ERR_93_SUBMSG_7        NO_SUBMSG
+#define M_ERR_93_SUBMSG_8        NO_SUBMSG
+#define M_ERR_93_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_14 94L
+#define M_ERR_94_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_94_SUBMSG_1        MIL_TEXT("If using float buffers, all source and destination buffers must be float.")
+#define M_ERR_94_SUBMSG_2        MIL_TEXT("A format must be specified for 3-band 8-bit images.")
+#define M_ERR_94_SUBMSG_3        MIL_TEXT("All buffers must have the same SizeX and SizeY.")
+#define M_ERR_94_SUBMSG_4        MIL_TEXT("All sources must have the same internal format.")
+#define M_ERR_94_SUBMSG_5        MIL_TEXT("All destinations must have the same internal format.")
+#define M_ERR_94_SUBMSG_6        MIL_TEXT("All sources must be allocated on the same system.")
+#define M_ERR_94_SUBMSG_7        MIL_TEXT("All destinations must be allocated on the same system.")
+#define M_ERR_94_SUBMSG_8        MIL_TEXT("Buffers must have at least 2 lines.")
+#define M_ERR_94_SUBMSG_9        MIL_TEXT("SrcStartImage must between 0 and SrcImageCount-1.")
+
+#define M_BUF_TRANSFER_ERROR_3   95L
+#define M_ERR_95_MSG             MIL_TEXT("Transfer Error.")
+#define M_ERR_95_SUBMSG_1        MIL_TEXT("Keying color does not correspond to the source data.")
+#define M_ERR_95_SUBMSG_2        MIL_TEXT("Invalid band.")
+#define M_ERR_95_SUBMSG_3        MIL_TEXT("Functionality is not implemented.")
+#define M_ERR_95_SUBMSG_4        MIL_TEXT("Unknown transfer function.")
+#define M_ERR_95_SUBMSG_5        MIL_TEXT("Unknown transfer mode.")
+#define M_ERR_95_SUBMSG_6        MIL_TEXT("A parameter is invalid.")
+#define M_ERR_95_SUBMSG_7        MIL_TEXT("Transfer not supported with the current license.")
+#define M_ERR_95_SUBMSG_8        MIL_TEXT("Unable to map a DirectX buffer.")
+#define M_ERR_95_SUBMSG_9        MIL_TEXT("All source parameter should be null.")
+
+#define M_J2K_ERROR_8            96L
+#define M_ERR_96_MSG             MIL_TEXT("JPEG2000 compression error.")
+#define M_ERR_96_SUBMSG_1        MIL_TEXT("Unable to allocate memory.")
+#define M_ERR_96_SUBMSG_2        MIL_TEXT("The quantization style is only applicable to lossy buffers.")
+#define M_ERR_96_SUBMSG_3        MIL_TEXT("EOC marker found in a packet body.")
+#define M_ERR_96_SUBMSG_4        MIL_TEXT("The default quantization table identifier is invalid.")
+#define M_ERR_96_SUBMSG_5        MIL_TEXT("Invalid operation mode.")
+#define M_ERR_96_SUBMSG_6        NO_SUBMSG
+#define M_ERR_96_SUBMSG_7        NO_SUBMSG
+#define M_ERR_96_SUBMSG_8        NO_SUBMSG
+#define M_ERR_96_SUBMSG_9        NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_15 97L
+#define M_ERR_97_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_97_SUBMSG_1        MIL_TEXT("Only 8 and 16-bit source buffers are supported.")
+#define M_ERR_97_SUBMSG_2        MIL_TEXT("Only 8 and 16-bit destination buffers are supported.")
+#define M_ERR_97_SUBMSG_3        MIL_TEXT("All source buffers must be M_FLIP or M_NO_FLIP.")
+#define M_ERR_97_SUBMSG_4        MIL_TEXT("All destination buffers must be M_FLIP or M_NO_FLIP.")
+#define M_ERR_97_SUBMSG_5        MIL_TEXT("Invalid number of source buffers.")
+#define M_ERR_97_SUBMSG_6        MIL_TEXT("Invalid number of destination buffers.")
+#define M_ERR_97_SUBMSG_7        MIL_TEXT("M_MOTION_DETECT_REFERENCE_FRAME must be between 0 and M_MOTION_DETECT_NUM_FRAMES - 1 or set to one of the predefined values.")
+#define M_ERR_97_SUBMSG_8        MIL_TEXT("ControlFlag cannot be zero.")
+#define M_ERR_97_SUBMSG_9        MIL_TEXT("Invalid ControlFlag. Only one type of create is supported.")
+
+#define M_INVALID_PARAM_ERROR_16 98L
+#define M_ERR_98_MSG             MIL_TEXT("Invalid parameter.")
+#define M_ERR_98_SUBMSG_1        MIL_TEXT("Invalid pitch specified.")
+#define M_ERR_98_SUBMSG_2        MIL_TEXT("One of the IDs in the list is not a valid event.")
+#define M_ERR_98_SUBMSG_3        MIL_TEXT("All events do not belong to the same system type.")
+#define M_ERR_98_SUBMSG_4        MIL_TEXT("M_VIDEO_DEVICE_OBJECT cannot be used with something else.")
+#define M_ERR_98_SUBMSG_5        MIL_TEXT("Invalid warp parameters.")
+#define M_ERR_98_SUBMSG_6        MIL_TEXT("Invalid matrix size. Allowed values are 3 or 4 for SizeX, and 1 or 3 for SizeY.")
+#define M_ERR_98_SUBMSG_7        MIL_TEXT("BayerBitShift must be lower than source SizeBit.")
+#define M_ERR_98_SUBMSG_8        MIL_TEXT("Workspace already reserved.")
+#define M_ERR_98_SUBMSG_9        MIL_TEXT("Invalid version.")
+
+#define M_BUF_TRANSFER_ERROR_4   99L
+#define M_ERR_99_MSG             MIL_TEXT("Transfer Error.")
+#define M_ERR_99_SUBMSG_1        MIL_TEXT("Destination buffer id should be null.")
+#define M_ERR_99_SUBMSG_2        MIL_TEXT("The scaling method (type of interpolation) is unknown.")
+#define M_ERR_99_SUBMSG_3        MIL_TEXT("The scaling method (type of interpolation) is not supported.")
+#define M_ERR_99_SUBMSG_4        MIL_TEXT("M_ALLOW_LARGER_RECT is not compatible with the scaling function.")
+#define M_ERR_99_SUBMSG_5        MIL_TEXT("Autoscale is only supported on 32-bit buffers when the buffer is an image.")
+#define M_ERR_99_SUBMSG_6        MIL_TEXT("Transfer type is invalid.")
+#define M_ERR_99_SUBMSG_7        MIL_TEXT("The source of the autoscale function must be an image.")
+#define M_ERR_99_SUBMSG_8        MIL_TEXT("DirectX transfer only supported on DirectX buffers.")
+#define M_ERR_99_SUBMSG_9        MIL_TEXT("The DirectX transfer method is not supported in this environment.")
+
+#define M_COMPOSITION_ERROR      100L
+#define M_ERR_100_MSG            MIL_TEXT("Composition Error.")
+#define M_ERR_100_SUBMSG_1       MIL_TEXT("M_BGRX32_COMPOSITION requires 1-band buffers.")
+#define M_ERR_100_SUBMSG_2       MIL_TEXT("M_BGRX32_COMPOSITION requires 32-bit buffers.")
+#define M_ERR_100_SUBMSG_3       MIL_TEXT("M_BGRX32_COMPOSITION does not accept M_FLOAT buffers.")
+#define M_ERR_100_SUBMSG_4       NO_SUBMSG
+#define M_ERR_100_SUBMSG_5       NO_SUBMSG
+#define M_ERR_100_SUBMSG_6       NO_SUBMSG
+#define M_ERR_100_SUBMSG_7       NO_SUBMSG
+#define M_ERR_100_SUBMSG_8       NO_SUBMSG
+#define M_ERR_100_SUBMSG_9       NO_SUBMSG
+
+#define M_JPEG_COMPRESS_ERROR_4  101L
+#define M_ERR_101_MSG            MIL_TEXT("JPEG compression error.")
+#define M_ERR_101_SUBMSG_1       MIL_TEXT("Field order is only applicable to interlaced buffers.")
+#define M_ERR_101_SUBMSG_2       MIL_TEXT("Invalid field order.")
+#define M_ERR_101_SUBMSG_3       NO_SUBMSG
+#define M_ERR_101_SUBMSG_4       NO_SUBMSG
+#define M_ERR_101_SUBMSG_5       NO_SUBMSG
+#define M_ERR_101_SUBMSG_6       NO_SUBMSG
+#define M_ERR_101_SUBMSG_7       NO_SUBMSG
+#define M_ERR_101_SUBMSG_8       NO_SUBMSG
+#define M_ERR_101_SUBMSG_9       NO_SUBMSG
+
+#define M_OPERATION_ERROR_6      102L
+#define M_ERR_102_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_102_SUBMSG_1       MIL_TEXT("In place operations are not supported.")
+#define M_ERR_102_SUBMSG_2       MIL_TEXT("Cannot free a thread from within the same thread.")
+#define M_ERR_102_SUBMSG_3       MIL_TEXT("All parameters must be set in the context before calling the function.")
+#define M_ERR_102_SUBMSG_4       MIL_TEXT("The buffer to draw has not been set in the context.")
+#define M_ERR_102_SUBMSG_5       MIL_TEXT("MappFileOperation is not supported on Odyssey systems.")
+#define M_ERR_102_SUBMSG_6       MIL_TEXT("Buffer is already unmapped.")
+#define M_ERR_102_SUBMSG_7       MIL_TEXT("The size array must not be set in this mode.")
+#define M_ERR_102_SUBMSG_8       MIL_TEXT("Operation does not support buffers with region.")
+#define M_ERR_102_SUBMSG_9       MIL_TEXT("MappFileOperation is not supported on this operating system.")
+
+#define M_INVALID_PARAM_ERROR_17 103L
+#define M_ERR_103_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_103_SUBMSG_1       MIL_TEXT("Invalid file format flag. Cannot import MPEG4 sequences.")
+#define M_ERR_103_SUBMSG_2       MIL_TEXT("Array of ids parameter contains both local and remote ids.")
+#define M_ERR_103_SUBMSG_3       MIL_TEXT("InWarpParameter contain invalid coordinates.")
+#define M_ERR_103_SUBMSG_4       MIL_TEXT("Cannot convert an internal data structure to 32-bit values.")
+#define M_ERR_103_SUBMSG_5       MIL_TEXT("This control cannot be executed on a child buffer.")
+#define M_ERR_103_SUBMSG_6       MIL_TEXT("A buffer id must be specified in order to determine the target host.")
+#define M_ERR_103_SUBMSG_7       MIL_TEXT("A system id must be specified in order to determine the target host.")
+#define M_ERR_103_SUBMSG_8       MIL_TEXT("Objects in array must have the same owner system.")
+#define M_ERR_103_SUBMSG_9       MIL_TEXT("Invalid file format flag. Cannot import H264 sequences.")
+
+#define M_LICENSING_ERROR_2      104L
+#define M_ERR_104_MSG            MIL_TEXT("Licensing error.")
+#define M_ERR_104_SUBMSG_1       MIL_TEXT("MIL Lite requires a Matrox Imaging board or a valid license.\nIf a Matrox Imaging board is present, make sure it is correctly installed.")
+#define M_ERR_104_SUBMSG_2       MIL_TEXT("If a Matrox Imaging board is present, make sure it is correctly installed.")
+#define M_ERR_104_SUBMSG_3       MIL_TEXT("This system requires a license.")
+#define M_ERR_104_SUBMSG_4       MIL_TEXT("Your license does not allow JPEG compression.")
+#define M_ERR_104_SUBMSG_5       MIL_TEXT("Your license does not allow JPEG2000 compression.")
+#define M_ERR_104_SUBMSG_6       MIL_TEXT("Your license does not allow the use of JPEG-compressed sequences.")
+#define M_ERR_104_SUBMSG_7       MIL_TEXT("Your license has reached its time limit.")
+#define M_ERR_104_SUBMSG_8       MIL_TEXT("Your license does not allow the use of JPEG2000-compressed sequences.")
+#define M_ERR_104_SUBMSG_9       MIL_TEXT("Your license does not allow the allocation of this type of object.")
+
+#define M_ALLOC_ERROR_6          105L
+#define M_ERR_105_MSG            MIL_TEXT("Allocation error.")
+#define M_ERR_105_SUBMSG_1       MIL_TEXT("Unable to allocate memory.")
+#define M_ERR_105_SUBMSG_2       MIL_TEXT("Cannot allocate temporary buffer.")
+#define M_ERR_105_SUBMSG_3       MIL_TEXT("This system is not registered. Make sure the driver is started.")
+#define M_ERR_105_SUBMSG_4       MIL_TEXT("Not enough memory for a MIL CE allocation.\nContinuing the application may cause abnormal behavior!")
+#define M_ERR_105_SUBMSG_5       MIL_TEXT("Unable to allocate object because it is not of the expected type.")
+#if MIL_COMPILE_VERSION < 1060
+#define M_ERR_105_SUBMSG_6       MIL_TEXT("The computer has not been rebooted since the last setup ran.")
+#else
+#define M_ERR_105_SUBMSG_6       MIL_TEXT("The computer needs to be rebooted.")
+#endif
+#define M_ERR_105_SUBMSG_7       MIL_TEXT("The M_FLIP buffer attribute is no longer supported.")
+#define M_ERR_105_SUBMSG_8       MIL_TEXT("Cluster Manager Server not found. Verify settings in MILConfig or in the MappAlloc parameters")
+#define M_ERR_105_SUBMSG_9       MIL_TEXT("Error with the Cluster Manager Server handshake.")
+
+#define M_FONT_ERROR             106L
+#define M_ERR_106_MSG            MIL_TEXT("Font error.")
+#define M_ERR_106_SUBMSG_1       MIL_TEXT("Invalid font or font not installed.") 
+#define M_ERR_106_SUBMSG_2       MIL_TEXT("Invalid font name.")
+#define M_ERR_106_SUBMSG_3       MIL_TEXT("The default fonts do not support all character codes of the text. Please use another font.") 
+#define M_ERR_106_SUBMSG_4       MIL_TEXT("The specified fonts do not support all characters of the text. Please use another font.")
+#define M_ERR_106_SUBMSG_5       MIL_TEXT("Unable to find a system font that supports all character codes of the text. Please install a suitable font.")
+#define M_ERR_106_SUBMSG_6       MIL_TEXT("Your locale environment is not in UTF8.")
+#define M_ERR_106_SUBMSG_7       MIL_TEXT("Invalid font size.")
+#define M_ERR_106_SUBMSG_8       MIL_TEXT("Invalid font file.")
+#define M_ERR_106_SUBMSG_9       MIL_TEXT("Invalid text encoding.")
+
+#define M_FORMAT_ERROR           107L
+#define M_ERR_107_MSG            MIL_TEXT("Format error.")
+#define M_ERR_107_SUBMSG_1       MIL_TEXT("The specified YUV format is only supported for all bands and with a compatible YUV buffer.")
+#define M_ERR_107_SUBMSG_2       MIL_TEXT("The specified format is only supported for all bands.")
+#define M_ERR_107_SUBMSG_3       NO_SUBMSG
+#define M_ERR_107_SUBMSG_4       NO_SUBMSG
+#define M_ERR_107_SUBMSG_5       NO_SUBMSG
+#define M_ERR_107_SUBMSG_6       NO_SUBMSG
+#define M_ERR_107_SUBMSG_7       NO_SUBMSG
+#define M_ERR_107_SUBMSG_8       NO_SUBMSG
+#define M_ERR_107_SUBMSG_9       NO_SUBMSG
+
+#define M_APP_CTRL_INQ_ERROR     108L
+#define M_ERR_108_MSG            MIL_TEXT("Application Control/Inquire error.")
+#define M_ERR_108_SUBMSG_1       MIL_TEXT("Some display related object(s) were not freed.")
+#define M_ERR_108_SUBMSG_2       MIL_TEXT("This control cannot be executed if the video memory usage is disabled.")
+#define M_ERR_108_SUBMSG_3       NO_SUBMSG
+#define M_ERR_108_SUBMSG_4       NO_SUBMSG
+#define M_ERR_108_SUBMSG_5       NO_SUBMSG
+#define M_ERR_108_SUBMSG_6       NO_SUBMSG
+#define M_ERR_108_SUBMSG_7       NO_SUBMSG
+#define M_ERR_108_SUBMSG_8       NO_SUBMSG
+#define M_ERR_108_SUBMSG_9       NO_SUBMSG
+
+#define M_GRA_OPERATION_ERROR    109L
+#define M_ERR_109_MSG            MIL_TEXT("Drawing operation error.")
+#define M_ERR_109_SUBMSG_1       MIL_TEXT("Cannot draw in world units in an uncalibrated image.")
+#define M_ERR_109_SUBMSG_2       NO_SUBMSG
+#define M_ERR_109_SUBMSG_3       MIL_TEXT("Cannot perform this draw operation from an uncalibrated source object.")
+#define M_ERR_109_SUBMSG_4       MIL_TEXT("No calibration found to perform this operation.")
+#define M_ERR_109_SUBMSG_5       MIL_TEXT("M_GRAPHIC_CONVERSION_MODE set to M_PRESERVE_SHAPE_AVERAGE is not supported for this operation.")
+#define M_ERR_109_SUBMSG_6       MIL_TEXT("M_GRAPHIC_CONVERSION_MODE set to M_RESHAPE_FROM_POINTS is not supported for this operation.")
+#define M_ERR_109_SUBMSG_7       MIL_TEXT("M_GRAPHIC_CONVERSION_MODE set to M_RESHAPE_FOLLOWING_DISTORTION is not supported for this operation.")
+#define M_ERR_109_SUBMSG_8       MIL_TEXT("This operation can only be performed when drawing to a graphic list.")
+#define M_ERR_109_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_18 110L
+#define M_ERR_110_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_110_SUBMSG_1       MIL_TEXT("Invalid inquire type for this graphic.")
+#define M_ERR_110_SUBMSG_2       MIL_TEXT("Invalid LabelOrIndex.")
+#define M_ERR_110_SUBMSG_3       MIL_TEXT("Invalid list type.")
+#define M_ERR_110_SUBMSG_4       MIL_TEXT("This value cannot be modified.")
+#define M_ERR_110_SUBMSG_5       MIL_TEXT("This value cannot be read.")
+#define M_ERR_110_SUBMSG_6       MIL_TEXT("Invalid units.")
+#define M_ERR_110_SUBMSG_7       MIL_TEXT("Invalid SubIndex.")
+#define M_ERR_110_SUBMSG_8       MIL_TEXT("Invalid Number.")
+#define M_ERR_110_SUBMSG_9       MIL_TEXT("X2Ptr and Y2Ptr should be M_NULL for M_POLYLINE or M_POLYGON.")
+
+#define M_MEM_MAN_INQ_ERROR      111L
+#define M_ERR_111_MSG            MIL_TEXT("Memory manager Inquire error.")
+#define M_ERR_111_SUBMSG_1       MIL_TEXT("MIL is not using Mtx Memory Manager driver.")
+#define M_ERR_111_SUBMSG_2       MIL_TEXT("Cannot get memory manager handle.")
+#define M_ERR_111_SUBMSG_3       MIL_TEXT("Cannot get memory manager driver information.")
+#define M_ERR_111_SUBMSG_4       NO_SUBMSG
+#define M_ERR_111_SUBMSG_5       NO_SUBMSG
+#define M_ERR_111_SUBMSG_6       NO_SUBMSG
+#define M_ERR_111_SUBMSG_7       NO_SUBMSG
+#define M_ERR_111_SUBMSG_8       NO_SUBMSG
+#define M_ERR_111_SUBMSG_9       NO_SUBMSG
+
+#define M_NO_MEM_ERROR           112L
+#define M_ERR_112_MSG            MIL_TEXT("Memory error.")
+#define M_ERR_112_SUBMSG_1       MIL_TEXT("Not enough heap memory to continue.")
+#define M_ERR_112_SUBMSG_2       NO_SUBMSG
+#define M_ERR_112_SUBMSG_3       NO_SUBMSG
+#define M_ERR_112_SUBMSG_4       NO_SUBMSG
+#define M_ERR_112_SUBMSG_5       NO_SUBMSG
+#define M_ERR_112_SUBMSG_6       NO_SUBMSG
+#define M_ERR_112_SUBMSG_7       NO_SUBMSG
+#define M_ERR_112_SUBMSG_8       NO_SUBMSG
+#define M_ERR_112_SUBMSG_9       NO_SUBMSG
+
+#define M_GPU_ERROR              113L
+#define M_ERR_113_MSG            MIL_TEXT("GPU driver error.")
+#define M_ERR_113_SUBMSG_1       MIL_TEXT("DirectX version not supported.")
+#define M_ERR_113_SUBMSG_2       MIL_TEXT("Invalid command decoder.")
+#define M_ERR_113_SUBMSG_3       MIL_TEXT("MilGPUd3d9.dll DLL cannot be loaded.")
+#define M_ERR_113_SUBMSG_4       MIL_TEXT("MilGPUd3d10.dll DLL cannot be loaded.")
+#define M_ERR_113_SUBMSG_5       MIL_TEXT("MilGPUd3d11.dll DLL cannot be loaded.")
+#define M_ERR_113_SUBMSG_6       MIL_TEXT("GPU system cannot be used in a Windows Service.")
+#define M_ERR_113_SUBMSG_7       NO_SUBMSG
+#define M_ERR_113_SUBMSG_8       NO_SUBMSG
+#define M_ERR_113_SUBMSG_9       NO_SUBMSG
+
+#define M_FILE_OPERATION_ERROR   114L
+#define M_ERR_114_MSG            MIL_TEXT("File operation error.")
+#define M_ERR_114_SUBMSG_1       MIL_TEXT("Source file must be specified.")
+#define M_ERR_114_SUBMSG_2       MIL_TEXT("Folder already exists.")
+#define M_ERR_114_SUBMSG_3       MIL_TEXT("File does not exist.")
+#define M_ERR_114_SUBMSG_4       MIL_TEXT("Could not create folder.")
+#define M_ERR_114_SUBMSG_5       MIL_TEXT("Could not delete folder.")
+#define M_ERR_114_SUBMSG_6       MIL_TEXT("Folder is not empty.")
+#define M_ERR_114_SUBMSG_7       MIL_TEXT("Error executing command.")
+#define M_ERR_114_SUBMSG_8       MIL_TEXT("File not found.")
+#define M_ERR_114_SUBMSG_9       MIL_TEXT("Permission denied.")
+
+#define M_FILE_OPERATION_ERROR_2 115L
+#define M_ERR_115_MSG            MIL_TEXT("File operation error.")
+#define M_ERR_115_SUBMSG_1       MIL_TEXT("Could not copy file.")
+#define M_ERR_115_SUBMSG_2       MIL_TEXT("The command is not a valid executable.")
+#define M_ERR_115_SUBMSG_3       MIL_TEXT("The executable must be specified.")
+#define M_ERR_115_SUBMSG_4       MIL_TEXT("Destination file must be specified.")
+#define M_ERR_115_SUBMSG_5       MIL_TEXT("Source and Destination files must be different.")
+#define M_ERR_115_SUBMSG_6       MIL_TEXT("Sharing violation.")
+#define M_ERR_115_SUBMSG_7       MIL_TEXT("Name is invalid.")
+#define M_ERR_115_SUBMSG_8       MIL_TEXT("No file specified.")
+#define M_ERR_115_SUBMSG_9       MIL_TEXT("OperationDataPtr cannot be NULL.")
+
+#define M_INVALID_PARAM_ERROR_19 116L
+#define M_ERR_116_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_116_SUBMSG_1       MIL_TEXT("The ID of the source buffer can only be M_NULL when preprocessing the context.")
+#define M_ERR_116_SUBMSG_2       MIL_TEXT("The ID of the destination buffer can only be M_NULL when preprocessing the context.")
+#define M_ERR_116_SUBMSG_3       MIL_TEXT("Inquire type not supported.")
+#define M_ERR_116_SUBMSG_4       MIL_TEXT("Control type not supported.")
+#define M_ERR_116_SUBMSG_5       MIL_TEXT("Invalid control value.")
+#define M_ERR_116_SUBMSG_6       MIL_TEXT("Invalid mode.")
+#define M_ERR_116_SUBMSG_7       MIL_TEXT("DeadPixels buffer must be specified.")
+#define M_ERR_116_SUBMSG_8       MIL_TEXT("DeadPixels array contain invalid coordinates.")
+#define M_ERR_116_SUBMSG_9       MIL_TEXT("Matrix array must be 1 band.")
+
+#define M_INVALID_PARAM_ERROR_20 117L
+#define M_ERR_117_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_117_SUBMSG_1       MIL_TEXT("All arrays must have the same number of elements.")
+#define M_ERR_117_SUBMSG_2       MIL_TEXT("Buffer must be 1 band.")
+#define M_ERR_117_SUBMSG_3       MIL_TEXT("Buffer SizeY must be 1.")
+#define M_ERR_117_SUBMSG_4       MIL_TEXT("Buffer SizeX must be multiple of 2.")
+#define M_ERR_117_SUBMSG_5       MIL_TEXT("Src image size must be greater or equal to DeadPixels size.")
+#define M_ERR_117_SUBMSG_6       MIL_TEXT("Dst image size must be greater or equal to DeadPixels size.")
+#define M_ERR_117_SUBMSG_7       MIL_TEXT("DeadPixels could not be filled with all non-zero values.")
+#define M_ERR_117_SUBMSG_8       MIL_TEXT("Invalid statistic type.")
+#define M_ERR_117_SUBMSG_9       MIL_TEXT("SizeX and SizeY must be specified in the context or a source buffer must be passed at the preprocess.")
+
+#define M_NULL_PARAMETER          118L
+#define M_ERR_118_MSG             MIL_TEXT("Parameter cannot be NULL.")
+#define M_ERR_118_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_118_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_118_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_118_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_118_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_118_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_118_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_118_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_118_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_INVALID_PARAM_ERROR_21 119L
+#define M_ERR_119_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_119_SUBMSG_1       MIL_TEXT("The affinity mask array pointer cannot be NULL.")
+#define M_ERR_119_SUBMSG_2       MIL_TEXT("The affinity mask array must contain at least one valid bit.")
+#define M_ERR_119_SUBMSG_3       MIL_TEXT("The value pointer is not used and should be NULL.")
+#define M_ERR_119_SUBMSG_4       MIL_TEXT("Context and result must be on the same system.")
+#define M_ERR_119_SUBMSG_5       MIL_TEXT("Model must be specified.")
+#define M_ERR_119_SUBMSG_6       MIL_TEXT("Mask must be specified.")
+#define M_ERR_119_SUBMSG_7       MIL_TEXT("Invalid score type.")
+#define M_ERR_119_SUBMSG_8       MIL_TEXT("Model step must be 1 or 2.")
+#define M_ERR_119_SUBMSG_9       MIL_TEXT("Invalid max score.")
+
+#define M_INVALID_PARAM_ERROR_22 120L
+#define M_ERR_120_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_120_SUBMSG_1       MIL_TEXT("Invalid source buffer type.")
+#define M_ERR_120_SUBMSG_2       MIL_TEXT("Invalid destination buffer type.")
+#define M_ERR_120_SUBMSG_3       MIL_TEXT("Model must be a monochrome image.")
+#define M_ERR_120_SUBMSG_4       MIL_TEXT("Invalid model buffer type.")
+#define M_ERR_120_SUBMSG_5       MIL_TEXT("Invalid model size.")
+#define M_ERR_120_SUBMSG_6       MIL_TEXT("Mask must be a monochrome image.")
+#define M_ERR_120_SUBMSG_7       MIL_TEXT("Invalid mask buffer type.")
+#define M_ERR_120_SUBMSG_8       MIL_TEXT("Invalid mask size.")
+#define M_ERR_120_SUBMSG_9       MIL_TEXT("Invalid center structural element value.")
+
+#define M_THRESHOLDS_ERROR       121L
+#define M_ERR_121_MSG            MIL_TEXT("External MP thresholds error.")
+#define M_ERR_121_SUBMSG_1       MIL_TEXT("Invalid file name.")
+#define M_ERR_121_SUBMSG_2       MIL_TEXT("Cannot open file.")
+#define M_ERR_121_SUBMSG_3       MIL_TEXT("Bad file format.")
+#define M_ERR_121_SUBMSG_4       MIL_TEXT("Invalid threshold identifier.")
+#define M_ERR_121_SUBMSG_5       MIL_TEXT("Invalid parameter value.")
+#define M_ERR_121_SUBMSG_6       MIL_TEXT("This Control Value is not supported in this version of MIL.")
+#define M_ERR_121_SUBMSG_7       MIL_TEXT("Cannot close file.")
+#define M_ERR_121_SUBMSG_8       NO_SUBMSG
+#define M_ERR_121_SUBMSG_9       NO_SUBMSG
+
+#define M_SYS_CONFIG_ERROR       122L
+#define M_ERR_122_MSG            MIL_TEXT("Config access error.")
+#define M_ERR_122_SUBMSG_1       MIL_TEXT("Could not write to eeprom.")
+#define M_ERR_122_SUBMSG_2       MIL_TEXT("Could not read from eeprom.")
+#define M_ERR_122_SUBMSG_3       NO_SUBMSG
+#define M_ERR_122_SUBMSG_4       NO_SUBMSG
+#define M_ERR_122_SUBMSG_5       NO_SUBMSG
+#define M_ERR_122_SUBMSG_6       NO_SUBMSG
+#define M_ERR_122_SUBMSG_7       NO_SUBMSG
+#define M_ERR_122_SUBMSG_8       NO_SUBMSG
+#define M_ERR_122_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_23 123L
+#define M_ERR_123_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_123_SUBMSG_1       MIL_TEXT("Invalid number of elements. The number of elements should greater or equal to zero.")
+#define M_ERR_123_SUBMSG_2       MIL_TEXT("Parameter 2 must be set to M_NULL with this operation.")
+#define M_ERR_123_SUBMSG_3       MIL_TEXT("Parameter 2 cannot be M_NULL for this operation as the image buffer does not have any region information.")
+#define M_ERR_123_SUBMSG_4       MIL_TEXT("Invalid Application ID.")
+#define M_ERR_123_SUBMSG_5       MIL_TEXT("ObjectIdPtr cannot be M_NULL.")
+#define M_ERR_123_SUBMSG_6       MIL_TEXT("StreamType must either be M_FILE or M_MEMORY.")
+#define M_ERR_123_SUBMSG_7       MIL_TEXT("MemPtrOrFileName must be M_NULL for M_INQUIRE_SIZE_BYTE operation, and must not be M_NULL otherwise.")
+#define M_ERR_123_SUBMSG_8       MIL_TEXT("For a M_LOAD or M_RESTORE Operation, Version must be set to M_DEFAULT.")
+#define M_ERR_123_SUBMSG_9       MIL_TEXT("This ResultType is not available for this object type.")
+
+#define M_SET_REGION_ERROR       124L
+#define M_ERR_124_MSG            MIL_TEXT("Region error.")
+#define M_ERR_124_SUBMSG_1       MIL_TEXT("Cannot rasterize a graphic list with world input units in an uncalibrated image.")
+#define M_ERR_124_SUBMSG_2       MIL_TEXT("Unsupported operation value when using a graphic list as the second parameter.")
+#define M_ERR_124_SUBMSG_3       MIL_TEXT("Unsupported operation value when using an image buffer as the second parameter.")
+#define M_ERR_124_SUBMSG_4       MIL_TEXT("Unsupported buffer format used as the second parameter.")
+#define M_ERR_124_SUBMSG_5       MIL_TEXT("The region buffer must have the same sizes as its owner buffer.")
+#define M_ERR_124_SUBMSG_6       MIL_TEXT("Incompatible destination for the buffer region type.")
+#define M_ERR_124_SUBMSG_7       MIL_TEXT("Incompatible source and destination regions.")
+#define M_ERR_124_SUBMSG_8       MIL_TEXT("Cannot rasterize because a linked region exists in a child with a different calibration.")
+#define M_ERR_124_SUBMSG_9       MIL_TEXT("Unsupported region type for this operation.")
+
+#define M_OPERATION_ERROR_7      125L
+#define M_ERR_125_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_125_SUBMSG_1       MIL_TEXT("Error while converting this graphic.")
+#define M_ERR_125_SUBMSG_2       MIL_TEXT("Stream does not contain an object of the expected type.")
+#define M_ERR_125_SUBMSG_3       MIL_TEXT("Stream is corrupt.")
+#define M_ERR_125_SUBMSG_4       MIL_TEXT("Unable to control this object type.")
+#define M_ERR_125_SUBMSG_5       MIL_TEXT("Unable to inquire this object type.")
+#define M_ERR_125_SUBMSG_6       MIL_TEXT("Unable to get result for this object type.")
+#define M_ERR_125_SUBMSG_7       MIL_TEXT("Unable to call MimGet() on this object type.")
+#define M_ERR_125_SUBMSG_8       MIL_TEXT("Unable to call MimPut() on this object type.")
+#define M_ERR_125_SUBMSG_9       MIL_TEXT("The ControlType is not supported at this time.")
+
+#define M_DMIL_MONITOR_ERROR     126L
+#define M_ERR_126_MSG            MIL_TEXT("DMILMonitor error.")
+#define M_ERR_126_SUBMSG_1       MIL_TEXT("Cannot load DMILMonitor DLL.")
+#define M_ERR_126_SUBMSG_2       MIL_TEXT("A non-null cluster node must be specified during MappAlloc to activate the monitoring mode.")
+#define M_ERR_126_SUBMSG_3       MIL_TEXT("The port must be set before enabling the connection")
+#define M_ERR_126_SUBMSG_4       MIL_TEXT("Cluster Manager Server not found. Verify settings in MILConfig or in the MappAlloc parameters")
+#define M_ERR_126_SUBMSG_5       MIL_TEXT("Error with the Cluster Manager Server handshake.")
+#define M_ERR_126_SUBMSG_6       MIL_TEXT("Invalid Cluster Manager Server name passed as an argument to MappAlloc.")
+#define M_ERR_126_SUBMSG_7       MIL_TEXT("Internal Cluster Manager Server connection error.")
+#define M_ERR_126_SUBMSG_8       NO_SUBMSG
+#define M_ERR_126_SUBMSG_9       NO_SUBMSG
+
+#define M_MP_ERROR               127L
+#define M_ERR_127_MSG            MIL_TEXT("MP subsystem error.")
+#define M_ERR_127_SUBMSG_1       MIL_TEXT("Unrecognized host hardware configuration.  MP will be disabled.")
+#define M_ERR_127_SUBMSG_2       NO_SUBMSG
+#define M_ERR_127_SUBMSG_3       NO_SUBMSG
+#define M_ERR_127_SUBMSG_4       NO_SUBMSG
+#define M_ERR_127_SUBMSG_5       NO_SUBMSG
+#define M_ERR_127_SUBMSG_6       NO_SUBMSG
+#define M_ERR_127_SUBMSG_7       NO_SUBMSG
+#define M_ERR_127_SUBMSG_8       NO_SUBMSG
+#define M_ERR_127_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_24 128L
+#define M_ERR_128_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_128_SUBMSG_1       MIL_TEXT("This GetType is not supported for this object type.")
+#define M_ERR_128_SUBMSG_2       MIL_TEXT("This PutType is not supported for this object type.")
+#define M_ERR_128_SUBMSG_3       MIL_TEXT("Cannot use both +M_AVAILABLE and +M_SUPPORTED at the same time.")
+#define M_ERR_128_SUBMSG_4       MIL_TEXT("Cannot use both +M_AVAILABLE and +M_DEFAULT at the same time.")
+#define M_ERR_128_SUBMSG_5       MIL_TEXT("Only one +M_TYPE_[] flag can be used at a time.")
+#define M_ERR_128_SUBMSG_6       MIL_TEXT("+M_SUPPORTED, +M_AVAILABLE or +M_DEFAULT cannot be used with this operation.")
+#define M_ERR_128_SUBMSG_7       MIL_TEXT("+M_TYPE_[] flags cannot be used with this operation.")
+#define M_ERR_128_SUBMSG_8       MIL_TEXT("Empty arrays are not supported by this PutType.")
+#define M_ERR_128_SUBMSG_9       MIL_TEXT("The MIL_ID given as control value cannot be M_NULL.")
+
+#define M_OPERATION_ERROR_8      129L
+#define M_ERR_129_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_129_SUBMSG_1       MIL_TEXT("The InquireType is not supported at this time.")
+#define M_ERR_129_SUBMSG_2       MIL_TEXT("The ResultType is not available at this time.")
+#define M_ERR_129_SUBMSG_3       MIL_TEXT("The PutType is not supported at this time.")
+#define M_ERR_129_SUBMSG_4       MIL_TEXT("The GetType is not supported at this time.")
+#define M_ERR_129_SUBMSG_5       MIL_TEXT("Required data is not initialized.")
+#define M_ERR_129_SUBMSG_6       MIL_TEXT("Cannot move a child completely outside its parent's limits.")
+#define M_ERR_129_SUBMSG_7       MIL_TEXT("A streaming operation failed.")
+#define M_ERR_129_SUBMSG_8       MIL_TEXT("No default value is available.")
+#define M_ERR_129_SUBMSG_9       MIL_TEXT("When inquiring an array, the output pointer must not be M_NULL.")
+
+#define M_OPERATION_ERROR_9      130L
+#define M_ERR_130_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_130_SUBMSG_1       MIL_TEXT("The value of M_MAX_DISTANCE must be greater or equal to the value of M_MIN_DISTANCE.")
+#define M_ERR_130_SUBMSG_2       MIL_TEXT("Dead pixels must have been specified prior to this function call.")
+#define M_ERR_130_SUBMSG_3       MIL_TEXT("Unsupported buffer format.")
+#define M_ERR_130_SUBMSG_4       MIL_TEXT("Event synchronize timeout occurred.")
+#define M_ERR_130_SUBMSG_5       MIL_TEXT("Unexpected internal error.")
+#define M_ERR_130_SUBMSG_6       MIL_TEXT("Timeout is not supported.")
+#define M_ERR_130_SUBMSG_7       MIL_TEXT("When using M_LOAD, the stream's object type must be the same as the current object type.")
+#define M_ERR_130_SUBMSG_8       MIL_TEXT("Unsupported operation on internally allocated objects.")
+#define M_ERR_130_SUBMSG_9       MIL_TEXT("Cannot add object to group.")
+
+#define M_INVALID_PARAM_ERROR_25 131L
+#define M_ERR_131_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_131_SUBMSG_1       MIL_TEXT("Only M_DRAW_LIST objects are accepted.")
+#define M_ERR_131_SUBMSG_2       MIL_TEXT("Only lists containing 1 polyline are accepted.")
+#define M_ERR_131_SUBMSG_3       MIL_TEXT("The MIL_ID given as control value must be an M_IMAGE.")
+#define M_ERR_131_SUBMSG_4       MIL_TEXT("The image buffer given as control value must have the M_PROC attribute.")
+#define M_ERR_131_SUBMSG_5       MIL_TEXT("The image buffer given as control value must be 8-bit or 16-bit unsigned.")
+#define M_ERR_131_SUBMSG_6       MIL_TEXT("Saturation is not supported with 64-bit integer buffers.")
+#define M_ERR_131_SUBMSG_7       MIL_TEXT("Invalid min/max values specified on source buffer.")
+#define M_ERR_131_SUBMSG_8       MIL_TEXT("Cannot inquire M_INTERNAL error.")
+#define M_ERR_131_SUBMSG_9       MIL_TEXT("InWarpParameter and OutXLutOrCoefId must be of the same type.")
+
+#define M_CONNECTION_ERROR       132L
+#define M_ERR_132_MSG            MIL_TEXT("Connection error.")
+#define M_ERR_132_SUBMSG_1       MIL_TEXT("Cannot open connection.")
+#define M_ERR_132_SUBMSG_2       MIL_TEXT("Cannot open connection, already established.")
+#define M_ERR_132_SUBMSG_3       MIL_TEXT("Invalid parameter 1. This function requires a remote Application.")
+#define M_ERR_132_SUBMSG_4       NO_SUBMSG
+#define M_ERR_132_SUBMSG_5       NO_SUBMSG
+#define M_ERR_132_SUBMSG_6       NO_SUBMSG
+#define M_ERR_132_SUBMSG_7       NO_SUBMSG
+#define M_ERR_132_SUBMSG_8       NO_SUBMSG
+#define M_ERR_132_SUBMSG_9       NO_SUBMSG
+
+#define M_PUBLICATION_ERROR      133L
+#define M_ERR_133_MSG            MIL_TEXT("Publication error.")
+#define M_ERR_133_SUBMSG_1       MIL_TEXT("This type of object cannot be published.")
+#define M_ERR_133_SUBMSG_2       NO_SUBMSG
+#define M_ERR_133_SUBMSG_3       NO_SUBMSG
+#define M_ERR_133_SUBMSG_4       NO_SUBMSG
+#define M_ERR_133_SUBMSG_5       NO_SUBMSG
+#define M_ERR_133_SUBMSG_6       NO_SUBMSG
+#define M_ERR_133_SUBMSG_7       NO_SUBMSG
+#define M_ERR_133_SUBMSG_8       NO_SUBMSG
+#define M_ERR_133_SUBMSG_9       NO_SUBMSG
+
+#define M_APP_FREE_ERROR_2       134L
+#define M_ERR_134_MSG            MIL_TEXT("Application free operation error.")
+#define M_ERR_134_SUBMSG_1       MIL_TEXT("Some remote connections have not been closed.")
+#define M_ERR_134_SUBMSG_2       MIL_TEXT("Could not free the software grab simulator service.")
+#define M_ERR_134_SUBMSG_3       MIL_TEXT("Invalid flag when freeing current application.")
+#define M_ERR_134_SUBMSG_4       NO_SUBMSG
+#define M_ERR_134_SUBMSG_5       NO_SUBMSG
+#define M_ERR_134_SUBMSG_6       NO_SUBMSG
+#define M_ERR_134_SUBMSG_7       NO_SUBMSG
+#define M_ERR_134_SUBMSG_8       NO_SUBMSG
+#define M_ERR_134_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_26 135L
+#define M_ERR_135_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_135_SUBMSG_1       MIL_TEXT("When using a graphic list as the draw destination, Param2 must be set to 1.0.")
+#define M_ERR_135_SUBMSG_2       MIL_TEXT("A source intensity buffer is not supported when drawing in a graphic list.")
+#define M_ERR_135_SUBMSG_3       MIL_TEXT("A graphic context with a zoom or offset is not supported when drawing in an image buffer.")
+#define M_ERR_135_SUBMSG_4       MIL_TEXT("Context type is not in supported list.")
+#define M_ERR_135_SUBMSG_5       MIL_TEXT("Invalid matrix buffer type.")
+#define M_ERR_135_SUBMSG_6       MIL_TEXT("Operation is not supported on subsampled band.")
+#define M_ERR_135_SUBMSG_7       MIL_TEXT("The outer radius must be greater than the inner radius.")
+#define M_ERR_135_SUBMSG_8       MIL_TEXT("A radius cannot be negative.")
+#define M_ERR_135_SUBMSG_9       MIL_TEXT("MaxNumNeighbors must be greater than or equal to 0.")
+
+#define M_COMPENSATION_ERROR     136L
+#define M_ERR_136_MSG            MIL_TEXT("Compensation error.")
+#define M_ERR_136_SUBMSG_1       MIL_TEXT("Parameters not supported by the board.")
+#define M_ERR_136_SUBMSG_2       MIL_TEXT("Legacy board is not supported.")
+#define M_ERR_136_SUBMSG_3       MIL_TEXT("The selected system does not support regions.")
+#define M_ERR_136_SUBMSG_4       NO_SUBMSG
+#define M_ERR_136_SUBMSG_5       NO_SUBMSG
+#define M_ERR_136_SUBMSG_6       NO_SUBMSG
+#define M_ERR_136_SUBMSG_7       NO_SUBMSG
+#define M_ERR_136_SUBMSG_8       NO_SUBMSG
+#define M_ERR_136_SUBMSG_9       NO_SUBMSG
+
+#define M_PNG_ERROR              137L
+#define M_ERR_137_MSG            MIL_TEXT("PNG error.")
+#define M_ERR_137_SUBMSG_1       MIL_TEXT("Cannot open file.")
+#define M_ERR_137_SUBMSG_2       MIL_TEXT("Cannot read file.")
+#define M_ERR_137_SUBMSG_3       MIL_TEXT("Cannot write file.")
+#define M_ERR_137_SUBMSG_4       MIL_TEXT("Cannot allocate temporary buffer in memory.")
+#define M_ERR_137_SUBMSG_5       MIL_TEXT("Invalid PNG file.")
+#define M_ERR_137_SUBMSG_6       NO_SUBMSG
+#define M_ERR_137_SUBMSG_7       MIL_TEXT("Only 8, 16 BitsPerSample is supported with RGB or RGBA files.")
+#define M_ERR_137_SUBMSG_8       MIL_TEXT("Only 1, 8, 16 BitsPerSample supported.")
+#define M_ERR_137_SUBMSG_9       MIL_TEXT("Only 1 or 3 SizeBand supported.")
+
+#define M_AVI_FILE_ERROR_4       138L
+#define M_ERR_138_MSG            MIL_TEXT("AVI file error.")
+#define M_ERR_138_SUBMSG_1       MIL_TEXT("No suitable codec found.")
+#define M_ERR_138_SUBMSG_2       MIL_TEXT("Cannot load FFmpeg library. Make sure FFmpeg is correctly installed.")
+#define M_ERR_138_SUBMSG_3       MIL_TEXT("Unable to load FFmpeg library. Make sure FFmpeg is correctly installed.")
+#define M_ERR_138_SUBMSG_4       MIL_TEXT("Cannot decompress frame image.")
+#define M_ERR_138_SUBMSG_5       MIL_TEXT("No Video stream found")
+#define M_ERR_138_SUBMSG_6       MIL_TEXT("Invalid pixel format.")
+#define M_ERR_138_SUBMSG_7       MIL_TEXT("FFmpeg version mismatch. Please install FFmpeg Version 0.8")
+#define M_ERR_138_SUBMSG_8       NO_SUBMSG
+#define M_ERR_138_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_27 139L
+#define M_ERR_139_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_139_SUBMSG_1       MIL_TEXT("Not enough parameters packed for the function.")
+#define M_ERR_139_SUBMSG_2       MIL_TEXT("Too many parameters packed for the function.")
+#define M_ERR_139_SUBMSG_3       MIL_TEXT("If MaxNumNeighbors is set to 0, ObjectLabelOrIndexArray, ObjectPosXOrDistArray and ObjectPosYArray must be M_NULL.")
+#define M_ERR_139_SUBMSG_4       MIL_TEXT("When using M_POINT_AND_DISTANCE, Param1 must be strictly positive.")
+#define M_ERR_139_SUBMSG_5       MIL_TEXT("When using M_POINT_AND_DISTANCE, Param2 must be set to M_NULL.")
+#define M_ERR_139_SUBMSG_6       MIL_TEXT("When using M_RECTANGLE_SELECTION, ObjectPosXOrDistArray and ObjectPosYArray must be set to M_NULL.")
+#define M_ERR_139_SUBMSG_7       MIL_TEXT("When Operation is set to M_RECTANGLE_SELECTION, M_SORT_BY_ASCENDING_DISTANCE cannot be used.")
+#define M_ERR_139_SUBMSG_8       MIL_TEXT("When Operation is set to M_RECTANGLE_SELECTION, M_RETURN_DISTANCE and M_RETURN_X cannot be used.")
+#define M_ERR_139_SUBMSG_9       MIL_TEXT("ResultOutputUnits cannot be set to M_WORLD because no calibration context is available.")
+
+#define M_INVALID_PARAM_ERROR_28 140L
+#define M_ERR_140_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_140_SUBMSG_1       MIL_TEXT("ResultOutputUnits cannot be set to M_WORLD because the calibration context is not calibrated.")
+#define M_ERR_140_SUBMSG_2       MIL_TEXT("A calibration context is needed because some graphic objects use world units.")
+#define M_ERR_140_SUBMSG_3       MIL_TEXT("The given calibration context is not calibrated and is needed for some graphic objects.")
+#define M_ERR_140_SUBMSG_4       MIL_TEXT("CondHigh must be greater or equal to CondLow.")
+#define M_ERR_140_SUBMSG_5       MIL_TEXT("Invalid LUT size.")
+#define M_ERR_140_SUBMSG_6       MIL_TEXT("MgraSymbols() only supports positions as MIL_DOUBLE in this version. Do you have a system with mixed versions?")
+#define M_ERR_140_SUBMSG_7       MIL_TEXT("Invalid type of graphic object.")
+#define M_ERR_140_SUBMSG_8       MIL_TEXT("Queued results are deprecated. Result pointer cannot be NULL.")
+#define M_ERR_140_SUBMSG_9       MIL_TEXT("This graphic object type does not support the ControlType.")
+
+#define M_INVALID_PARAM_ERROR_29 141L
+#define M_ERR_141_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_141_SUBMSG_1       MIL_TEXT("Parameter 1 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_2       MIL_TEXT("Parameter 2 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_3       MIL_TEXT("Parameter 3 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_4       MIL_TEXT("Parameter 4 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_5       MIL_TEXT("Parameter 5 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_6       MIL_TEXT("Parameter 6 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_7       MIL_TEXT("Parameter 7 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_8       MIL_TEXT("Parameter 8 must be set to M_NULL.")
+#define M_ERR_141_SUBMSG_9       MIL_TEXT("Parameter 9 must be set to M_NULL.")
+
+#define M_DIRECTX_SERVICE_ERROR  142L
+#define M_ERR_142_MSG            MIL_TEXT("DirectX service error.")
+#define M_ERR_142_SUBMSG_1       MIL_TEXT("Cannot load MilDirectX DLL.")
+#define M_ERR_142_SUBMSG_2       MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_142_SUBMSG_3       MIL_TEXT("Cannot find AppAlloc function in MilDirectX.")
+#define M_ERR_142_SUBMSG_4       MIL_TEXT("Cannot find AppFree function in MilDirectX.")
+#define M_ERR_142_SUBMSG_5       MIL_TEXT("DirectX is needed, but the DirectX-based Display Service is not installed.")
+#define M_ERR_142_SUBMSG_6       NO_SUBMSG
+#define M_ERR_142_SUBMSG_7       NO_SUBMSG
+#define M_ERR_142_SUBMSG_8       NO_SUBMSG
+#define M_ERR_142_SUBMSG_9       NO_SUBMSG
+
+#define M_CODEC_ENGINE_SERVICE_ERROR 143L
+#define M_ERR_143_MSG            MIL_TEXT("Sequence context error.")
+#define M_ERR_143_SUBMSG_1       MIL_TEXT("Cannot load codec engine DLL.")
+#define M_ERR_143_SUBMSG_2       MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_143_SUBMSG_3       MIL_TEXT("Cannot initialize requested codec implementation.")
+#define M_ERR_143_SUBMSG_4       MIL_TEXT("Failed allocating requested container.")
+#define M_ERR_143_SUBMSG_5       MIL_TEXT("Cannot feed buffer, because process is not started.")
+#define M_ERR_143_SUBMSG_6       MIL_TEXT("Warning!: Some encoding settings are incompatible. The problematic settings have been modified internally.")
+#define M_ERR_143_SUBMSG_7       MIL_TEXT("Invalid context parameters.")
+#define M_ERR_143_SUBMSG_8       MIL_TEXT("Failed allocating internal memory.")
+#define M_ERR_143_SUBMSG_9       NO_SUBMSG
+
+#define M_MISSING_M_DISP_ERROR    144L
+#define M_ERR_144_MSG             MIL_TEXT("This function requires the image to have the M_DISP attribute")
+#define M_ERR_144_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_144_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_144_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_144_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_144_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_144_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_144_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_144_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_144_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_MISSING_M_PROC_ERROR    145L
+#define M_ERR_145_MSG             MIL_TEXT("This function requires the image to have the M_PROC attribute")
+#define M_ERR_145_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_145_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_145_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_145_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_145_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_145_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_145_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_145_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_145_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_MISSING_M_GRAB_ERROR    146L
+#define M_ERR_146_MSG             MIL_TEXT("This function requires the image to have the M_GRAB attribute")
+#define M_ERR_146_SUBMSG_1        MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_146_SUBMSG_2        MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_146_SUBMSG_3        MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_146_SUBMSG_4        MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_146_SUBMSG_5        MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_146_SUBMSG_6        MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_146_SUBMSG_7        MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_146_SUBMSG_8        MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_146_SUBMSG_9        MIL_TEXT("Invalid parameter 9.")
+
+#define M_INVALID_PARAM_ERROR_30 147L
+#define M_ERR_147_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_147_SUBMSG_1       MIL_TEXT("Y2Ptr parameter must be null when using M_INFINITE_LINES_A_B_C.")
+#define M_ERR_147_SUBMSG_2       MIL_TEXT("X1Ptr and Y1Ptr cannot be null if the number of line is greater than zero.")
+#define M_ERR_147_SUBMSG_3       MIL_TEXT("X2Ptr and Y2Ptr cannot be null drawing this type of lines.")
+#define M_ERR_147_SUBMSG_4       MIL_TEXT("Cannot pass a M_NULL graphic context except for M_CANCEL.")
+#define M_ERR_147_SUBMSG_5       MIL_TEXT("A graphic context with M_INPUT_UNITS set to M_WORLD is not supported for this function.")
+#define M_ERR_147_SUBMSG_6       MIL_TEXT("An intensity and/or angle buffer(s) must be specified.")
+#define M_ERR_147_SUBMSG_7       MIL_TEXT("Parameter 2 cannot be set to M_NULL for this operation.")
+#define M_ERR_147_SUBMSG_8       MIL_TEXT("InsertLocation is not a valid index or label in the destination graphics list.")
+#define M_ERR_147_SUBMSG_9       MIL_TEXT("NumberOfGraObjects must not be negative.")
+
+#define M_ALLOC_ERROR_7          148L
+#define M_ERR_148_MSG            MIL_TEXT("Allocation error.")
+#define M_ERR_148_SUBMSG_1       MIL_TEXT("Invalid Cluster Manager Server name passed as an argument to MappAlloc.")
+#define M_ERR_148_SUBMSG_2       MIL_TEXT("Internal Cluster Manager Server connection error.")
+#define M_ERR_148_SUBMSG_3       MIL_TEXT("Distributed MIL DLL cannot be loaded.")
+#define M_ERR_148_SUBMSG_4       MIL_TEXT("Not enough host memory to allocate buffer.\nCannot allocate temporary buffers in memory.")
+#define M_ERR_148_SUBMSG_5       MIL_TEXT("Cannot allocate digitizer.\nCannot allocate temporary buffers in memory.")
+#define M_ERR_148_SUBMSG_6       MIL_TEXT("Unable to create the compressed buffer using the given data.")
+#define M_ERR_148_SUBMSG_7       MIL_TEXT("Invalid reference ID.")
+#define M_ERR_148_SUBMSG_8       MIL_TEXT("Cannot allocate object.")
+#define M_ERR_148_SUBMSG_9       MIL_TEXT("Digitizer is not compatible with M_3D_SCENE.")
+
+#define M_DIG_SERVICE_ERROR      149L
+#define M_ERR_149_MSG            MIL_TEXT("Digitizer service error.")
+#define M_ERR_149_SUBMSG_1       MIL_TEXT("Cannot load MilDig DLL.")
+#define M_ERR_149_SUBMSG_2       MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_149_SUBMSG_3       MIL_TEXT("Cannot find AppAlloc function in MilDig.")
+#define M_ERR_149_SUBMSG_4       MIL_TEXT("Cannot find AppFree function in MilDig.")
+#define M_ERR_149_SUBMSG_5       NO_SUBMSG
+#define M_ERR_149_SUBMSG_6       NO_SUBMSG
+#define M_ERR_149_SUBMSG_7       NO_SUBMSG
+#define M_ERR_149_SUBMSG_8       NO_SUBMSG
+#define M_ERR_149_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_31 150L
+#define M_ERR_150_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_150_SUBMSG_1       MIL_TEXT("When NumberOfGraObjects is set to M_ALL, SrcIndexOrLabelArrayPtr must be set to M_NULL.")
+#define M_ERR_150_SUBMSG_2       MIL_TEXT("SrcIndexOrLabelArrayPtr must not be set to M_NULL.")
+#define M_ERR_150_SUBMSG_3       MIL_TEXT("Invalid index of label in the array SrcIndexOrLabelArrayPtr.")
+#define M_ERR_150_SUBMSG_4       MIL_TEXT("When Operation is set to M_MOVE, the same label or index must not appear more than once in the array SrcIndexOrLabelArrayPtr.")
+#define M_ERR_150_SUBMSG_5       MIL_TEXT("For inplace move operations, the InsertLocation must not appear in the array SrcIndexOrLabelArrayPtr.")
+#define M_ERR_150_SUBMSG_6       MIL_TEXT("Inquire to M_INIT_FLAG is deprecated, please use M_EXTENDED_INIT_FLAG.")
+#define M_ERR_150_SUBMSG_7       MIL_TEXT("Invalid ExtremeType. Are you using M_MIN/M_MAX instead of M_MIN_VALUE/M_MAX_VALUE?")
+#define M_ERR_150_SUBMSG_8       MIL_TEXT("Invalid InitFlag.")
+#define M_ERR_150_SUBMSG_9       MIL_TEXT("Region are not allowed on LUT destination.")
+
+#define M_LICENSING_ERROR_3      151L
+#define M_ERR_151_MSG            MIL_TEXT("Licensing error.")
+#define M_ERR_151_SUBMSG_1       MIL_TEXT("MIL requires a Matrox Imaging board or a valid license.")
+#define M_ERR_151_SUBMSG_2       MIL_TEXT("An expired context file is being used. This file is no longer usable.")
+#define M_ERR_151_SUBMSG_3       NO_SUBMSG
+#define M_ERR_151_SUBMSG_4       NO_SUBMSG
+#define M_ERR_151_SUBMSG_5       NO_SUBMSG
+#define M_ERR_151_SUBMSG_6       NO_SUBMSG
+#define M_ERR_151_SUBMSG_7       NO_SUBMSG
+#define M_ERR_151_SUBMSG_8       NO_SUBMSG
+#define M_ERR_151_SUBMSG_9       NO_SUBMSG
+
+#define M_APP_TRACE_ERROR_1      152L
+#define M_ERR_152_MSG            MIL_TEXT("MappTrace error.")
+#define M_ERR_152_SUBMSG_1       MIL_TEXT("TraceTag value must be between 0 and 255.")
+#define M_ERR_152_SUBMSG_2       MIL_TEXT("Call with M_TRACE_SECTION_END TraceType for this TraceTag doesn't match the last section start.")
+#define M_ERR_152_SUBMSG_3       MIL_TEXT("Call with M_TRACE_SECTION_END TraceType must be preceded by a call with M_TRACE_SECTION_START.")
+#define M_ERR_152_SUBMSG_4       MIL_TEXT("TraceValue must be M_DEFAULT or a color defined using M_RGB888().")
+#define M_ERR_152_SUBMSG_5       NO_SUBMSG
+#define M_ERR_152_SUBMSG_6       NO_SUBMSG
+#define M_ERR_152_SUBMSG_7       NO_SUBMSG
+#define M_ERR_152_SUBMSG_8       NO_SUBMSG
+#define M_ERR_152_SUBMSG_9       NO_SUBMSG
+
+#define M_SET_REGION_ERROR_2     153L
+#define M_ERR_153_MSG            MIL_TEXT("Region error.")
+#define M_ERR_153_SUBMSG_1       MIL_TEXT("Cannot change a parent's region from a linked child.")
+#define M_ERR_153_SUBMSG_2       MIL_TEXT("The image buffer does not have a parent to link to.")
+#define M_ERR_153_SUBMSG_3       MIL_TEXT("Region cannot be set on a YUV buffer with subsampled bands.")
+#define M_ERR_153_SUBMSG_4       NO_SUBMSG
+#define M_ERR_153_SUBMSG_5       NO_SUBMSG
+#define M_ERR_153_SUBMSG_6       NO_SUBMSG
+#define M_ERR_153_SUBMSG_7       NO_SUBMSG
+#define M_ERR_153_SUBMSG_8       NO_SUBMSG
+#define M_ERR_153_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_32 154L
+#define M_ERR_154_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_154_SUBMSG_1       MIL_TEXT("Invalid ControlType.")
+#define M_ERR_154_SUBMSG_2       MIL_TEXT("Invalid InquireType.")
+#define M_ERR_154_SUBMSG_3       MIL_TEXT("Invalid ErrorType.")
+#define M_ERR_154_SUBMSG_4       MIL_TEXT("Invalid SystemDescriptor format.")
+#define M_ERR_154_SUBMSG_5       MIL_TEXT("Invalid ConnectionDescriptor format.")
+#define M_ERR_154_SUBMSG_6       MIL_TEXT("Invalid SequenceType.")
+#define M_ERR_154_SUBMSG_7       MIL_TEXT("Invalid SequenceIndex.")
+#define M_ERR_154_SUBMSG_8       MIL_TEXT("Invalid ID.")
+#define M_ERR_154_SUBMSG_9       MIL_TEXT("The non-paged memory manager is not installed.")
+
+#define M_FUNC_CALL_ERROR_2      155L
+#define M_ERR_155_MSG            MIL_TEXT("Function call error.")
+#define M_ERR_155_SUBMSG_1       MIL_TEXT("Cannot load DLL implementing this function.")
+#define M_ERR_155_SUBMSG_2       MIL_TEXT("No module name passed")
+#define M_ERR_155_SUBMSG_3       MIL_TEXT("No function name passed")
+#define M_ERR_155_SUBMSG_4       MIL_TEXT("Opcode not found in the function table.")
+#define M_ERR_155_SUBMSG_5       NO_SUBMSG
+#define M_ERR_155_SUBMSG_6       NO_SUBMSG
+#define M_ERR_155_SUBMSG_7       NO_SUBMSG
+#define M_ERR_155_SUBMSG_8       NO_SUBMSG
+#define M_ERR_155_SUBMSG_9       NO_SUBMSG
+
+#define M_DIG_ALLOC_ERROR        156L
+#define M_ERR_156_MSG            MIL_TEXT("Cannot allocate digitizer.")
+#define M_ERR_156_SUBMSG_1       MIL_TEXT("Software emulated grab is not supported on this system.")
+#define M_ERR_156_SUBMSG_2       NO_SUBMSG
+#define M_ERR_156_SUBMSG_3       NO_SUBMSG
+#define M_ERR_156_SUBMSG_4       NO_SUBMSG
+#define M_ERR_156_SUBMSG_5       NO_SUBMSG
+#define M_ERR_156_SUBMSG_6       NO_SUBMSG
+#define M_ERR_156_SUBMSG_7       NO_SUBMSG
+#define M_ERR_156_SUBMSG_8       NO_SUBMSG
+#define M_ERR_156_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_33 157L
+#define M_ERR_157_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_157_SUBMSG_1       MIL_TEXT("Invalid image processing context. Its context type must be an M_WAVELET_TRANSFORM_CUSTOM_CONTEXT.")
+#define M_ERR_157_SUBMSG_2       MIL_TEXT("Invalid control flag. Must be set to M_DEFAULT.")
+#define M_ERR_157_SUBMSG_3       MIL_TEXT("Invalid filters buffers MIL_ID : they can't all be null.")
+#define M_ERR_157_SUBMSG_4       MIL_TEXT("Invalid filters buffers attributes : they all must be M_KERNEL.")
+#define M_ERR_157_SUBMSG_5       MIL_TEXT("All the filters buffers types must be 32 + M_FLOAT.")
+#define M_ERR_157_SUBMSG_6       MIL_TEXT("All the filters buffers sizes must be the same.")
+#define M_ERR_157_SUBMSG_7       MIL_TEXT("The band parameter is invalid.")
+#define M_ERR_157_SUBMSG_8       MIL_TEXT("All the filters kernels must have SizeY set to 1.")
+#define M_ERR_157_SUBMSG_9       MIL_TEXT("Source and destination buffers must be of the same type and pixel depth.")
+
+#define M_WAV_VALIDATION_ERROR   158L
+#define M_ERR_158_MSG            MIL_TEXT("Invalid Custom Wavelet.")
+#define M_ERR_158_SUBMSG_1       MIL_TEXT("All the custom filters must have the same size.")
+#define M_ERR_158_SUBMSG_2       MIL_TEXT("The perfect reconstruction condition is not verified with the used custom wavelet.")
+#define M_ERR_158_SUBMSG_3       NO_SUBMSG
+#define M_ERR_158_SUBMSG_4       NO_SUBMSG
+#define M_ERR_158_SUBMSG_5       NO_SUBMSG
+#define M_ERR_158_SUBMSG_6       NO_SUBMSG
+#define M_ERR_158_SUBMSG_7       NO_SUBMSG
+#define M_ERR_158_SUBMSG_8       NO_SUBMSG
+#define M_ERR_158_SUBMSG_9       NO_SUBMSG
+
+#define M_WAV_DENOISE_ERROR      159L
+#define M_ERR_159_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_159_SUBMSG_1       MIL_TEXT("Invalid wavelet context.")
+#define M_ERR_159_SUBMSG_2       MIL_TEXT("Invalid denoising type.")
+#define M_ERR_159_SUBMSG_3       MIL_TEXT("NbLevels must be positive.")
+#define M_ERR_159_SUBMSG_4       MIL_TEXT("Invalid control flag. Must be set to M_DEFAULT.")
+#define M_ERR_159_SUBMSG_5       MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_159_SUBMSG_6       MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_159_SUBMSG_7       NO_SUBMSG
+#define M_ERR_159_SUBMSG_8       NO_SUBMSG
+#define M_ERR_159_SUBMSG_9       NO_SUBMSG
+
+#define M_WAVE_TRANSFORM_ERROR   160L
+#define M_ERR_160_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_160_SUBMSG_1       MIL_TEXT("Invalid wavelet context.")
+#define M_ERR_160_SUBMSG_2       MIL_TEXT("Invalid transformation type.")
+#define M_ERR_160_SUBMSG_3       MIL_TEXT("NbLevels must be positive.")
+#define M_ERR_160_SUBMSG_4       MIL_TEXT("Invalid control flag. Must be set to M_DEFAULT.")
+#define M_ERR_160_SUBMSG_5       MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_160_SUBMSG_6       MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_160_SUBMSG_7       MIL_TEXT("Context and result must be on the same system.")
+#define M_ERR_160_SUBMSG_8       MIL_TEXT("The context must be set to M_NULL for the copy operation.")
+#define M_ERR_160_SUBMSG_9       MIL_TEXT("The filters of the custom wavelet are not defined. Use MimWaveletSetFilter.")
+
+#define M_WAVE_TRANSFORM_COMB    161L
+#define M_ERR_161_MSG            MIL_TEXT("Invalid parameter combination.")
+#define M_ERR_161_SUBMSG_1       MIL_TEXT("Source and destination can't be both images.")
+#define M_ERR_161_SUBMSG_2       MIL_TEXT("NbLevels must be > 0.")
+#define M_ERR_161_SUBMSG_3       MIL_TEXT("Invalid transformation type.")
+#define M_ERR_161_SUBMSG_4       MIL_TEXT("NbLevels must be 0 or M_DEFAULT.")
+#define M_ERR_161_SUBMSG_5       MIL_TEXT("Image size is not compatible with the decomposition level.")
+#define M_ERR_161_SUBMSG_6       MIL_TEXT("For the copy of a wavelet result, NbLevels and the number of level in the source wavelet result should be the same.")
+#define M_ERR_161_SUBMSG_7       MIL_TEXT("The decomposition level of the source and the destination are not compatible with the transformation type.")
+#define M_ERR_161_SUBMSG_8       MIL_TEXT("The wavelet context and the source wavelet result don't match.")
+#define M_ERR_161_SUBMSG_9       MIL_TEXT("The source wavelet result is empty.")
+
+#define M_MIM_GET_RES_SINGLE     162L
+#define M_ERR_162_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_162_SUBMSG_1       MIL_TEXT("This Wavelet result has no quadrants (Nblevels = 0).")
+#define M_ERR_162_SUBMSG_2       MIL_TEXT("This Wavelet result doesn't not contain the quadrant you are asking for.")
+#define M_ERR_162_SUBMSG_3       MIL_TEXT("This Wavelet has no imaginary decomposition.")
+#define M_ERR_162_SUBMSG_4       NO_SUBMSG
+#define M_ERR_162_SUBMSG_5       NO_SUBMSG
+#define M_ERR_162_SUBMSG_6       NO_SUBMSG
+#define M_ERR_162_SUBMSG_7       NO_SUBMSG
+#define M_ERR_162_SUBMSG_8       NO_SUBMSG
+#define M_ERR_162_SUBMSG_9       NO_SUBMSG
+
+#define M_MIM_DRAW_WAVELET       163L
+#define M_ERR_163_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_163_SUBMSG_1       MIL_TEXT("This Wavelet has no imaginary decomposition.")
+#define M_ERR_163_SUBMSG_2       MIL_TEXT("The drawn image must have the same number of band that the source image used to compute the wavelet result have.")
+#define M_ERR_163_SUBMSG_3       MIL_TEXT("The wavelet result is empty.")
+#define M_ERR_163_SUBMSG_4       NO_SUBMSG
+#define M_ERR_163_SUBMSG_5       NO_SUBMSG
+#define M_ERR_163_SUBMSG_6       NO_SUBMSG
+#define M_ERR_163_SUBMSG_7       NO_SUBMSG
+#define M_ERR_163_SUBMSG_8       NO_SUBMSG
+#define M_ERR_163_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_34 164L
+#define M_ERR_164_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_164_SUBMSG_1       MIL_TEXT("Cannot create an M_NON_PAGED buffer with null pointers.")
+#define M_ERR_164_SUBMSG_2       MIL_TEXT("Can only create a M_NON_PAGED buffer with a physical address.")
+#define M_ERR_164_SUBMSG_3       MIL_TEXT("Invalid Command.")
+#define M_ERR_164_SUBMSG_4       MIL_TEXT("Invalid CommandFlag.")
+#define M_ERR_164_SUBMSG_5       MIL_TEXT("Number of tiles cannot exceed buffer size.")
+#define M_ERR_164_SUBMSG_6       MIL_TEXT("Angle value must be between -360 and 720.")
+#define M_ERR_164_SUBMSG_7       MIL_TEXT("Invalid path.")
+#define M_ERR_164_SUBMSG_8       MIL_TEXT("Operation not supported on 32-bit integral buffers.")
+#define M_ERR_164_SUBMSG_9       MIL_TEXT("Calibration not supported on source buffer, consider using a child buffer.")
+
+#define M_WAV_DENOISE_COMB       165L
+#define M_ERR_165_MSG            MIL_TEXT("Invalid parameter combination.")
+#define M_ERR_165_SUBMSG_1       MIL_TEXT("Source and destination must be both images or wavelet results.")
+#define M_ERR_165_SUBMSG_2       MIL_TEXT("Wavelet context can't be NULL.")
+#define M_ERR_165_SUBMSG_3       MIL_TEXT("NbLevels must be > 0.")
+#define M_ERR_165_SUBMSG_4       MIL_TEXT("Image size is not compatible with the decomposition level.")
+#define M_ERR_165_SUBMSG_5       MIL_TEXT("Wavelet context must be NULL.")
+#define M_ERR_165_SUBMSG_6       MIL_TEXT("NbLevels must be M_DEFAULT.")
+#define M_ERR_165_SUBMSG_7       MIL_TEXT("Context and result must be on the same system.")
+#define M_ERR_165_SUBMSG_8       MIL_TEXT("The wavelet used for decomposition can't be complex.")
+#define M_ERR_165_SUBMSG_9       MIL_TEXT("The source result is empty.")
+
+#define M_WAV_DENOISE_COMB2      166L
+#define M_ERR_166_MSG            MIL_TEXT("Invalid parameter combination.")
+#define M_ERR_166_SUBMSG_1       MIL_TEXT("The wavelet used and the denoising method don't match.")
+#define M_ERR_166_SUBMSG_2       NO_SUBMSG
+#define M_ERR_166_SUBMSG_3       NO_SUBMSG
+#define M_ERR_166_SUBMSG_4       NO_SUBMSG
+#define M_ERR_166_SUBMSG_5       NO_SUBMSG
+#define M_ERR_166_SUBMSG_6       NO_SUBMSG
+#define M_ERR_166_SUBMSG_7       NO_SUBMSG
+#define M_ERR_166_SUBMSG_8       NO_SUBMSG
+#define M_ERR_166_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_COMB_1       167L
+#define M_ERR_167_MSG            MIL_TEXT("Invalid parameter combination.")
+#define M_ERR_167_SUBMSG_1       MIL_TEXT("Maximum cannot be inferior to minimum.")
+#define M_ERR_167_SUBMSG_2       MIL_TEXT("Second pass parameters and their counterpart cannot have the same values.")
+#define M_ERR_167_SUBMSG_3       MIL_TEXT("Source and threshold destination must have the same type.")
+#define M_ERR_167_SUBMSG_4       NO_SUBMSG
+#define M_ERR_167_SUBMSG_5       NO_SUBMSG
+#define M_ERR_167_SUBMSG_6       NO_SUBMSG
+#define M_ERR_167_SUBMSG_7       NO_SUBMSG
+#define M_ERR_167_SUBMSG_8       NO_SUBMSG
+#define M_ERR_167_SUBMSG_9       NO_SUBMSG
+
+#define M_SEQUENCE_CONTEXT_WARNING   168L
+#define M_ERR_168_MSG            MIL_TEXT("Sequence context warning.")
+#define M_ERR_168_SUBMSG_1       MIL_TEXT("Some encoding settings are incompatible. The problematic settings have been modified internally.")
+#define M_ERR_168_SUBMSG_2       NO_SUBMSG
+#define M_ERR_168_SUBMSG_3       NO_SUBMSG
+#define M_ERR_168_SUBMSG_4       NO_SUBMSG
+#define M_ERR_168_SUBMSG_5       NO_SUBMSG
+#define M_ERR_168_SUBMSG_6       NO_SUBMSG
+#define M_ERR_168_SUBMSG_7       NO_SUBMSG
+#define M_ERR_168_SUBMSG_8       NO_SUBMSG
+#define M_ERR_168_SUBMSG_9       NO_SUBMSG
+
+#define M_RUNTIME_ERROR          169L
+#define M_ERR_169_MSG            MIL_TEXT("Undefined error")
+#define M_ERR_169_SUBMSG_1       MIL_TEXT("Default CAPI error")
+#define M_ERR_169_SUBMSG_2       NO_SUBMSG
+#define M_ERR_169_SUBMSG_3       NO_SUBMSG
+#define M_ERR_169_SUBMSG_4       NO_SUBMSG
+#define M_ERR_169_SUBMSG_5       NO_SUBMSG
+#define M_ERR_169_SUBMSG_6       NO_SUBMSG
+#define M_ERR_169_SUBMSG_7       NO_SUBMSG
+#define M_ERR_169_SUBMSG_8       NO_SUBMSG
+#define M_ERR_169_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_35 170L
+#define M_ERR_170_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_170_SUBMSG_1       MIL_TEXT("Invalid result type.")
+#define M_ERR_170_SUBMSG_2       MIL_TEXT("The LUT buffer must have 3 bands.")
+#define M_ERR_170_SUBMSG_3       MIL_TEXT("The LUT buffer must be M_UNSIGNED or M_FLOAT.")
+#if MIL_COMPILE_VERSION < 1040
+#define M_ERR_170_SUBMSG_4       MIL_TEXT("Parameters 3 to 8 must be set to M_DEFAULT.") // moved to M_INVALID_PARAM_ERROR_43 Can reuse after PP4 release
+#else
+#define M_ERR_170_SUBMSG_4       NO_SUBMSG
+#endif
+#define M_ERR_170_SUBMSG_5       MIL_TEXT("For compressed buffers, the min value must be 0.")
+#define M_ERR_170_SUBMSG_6       MIL_TEXT("For 8-bit JPEG buffers, the max value must be 255.")
+#define M_ERR_170_SUBMSG_7       MIL_TEXT("For 16-bit JPEG buffers, the max value must be 65535.")
+#define M_ERR_170_SUBMSG_8       MIL_TEXT("For MPEG4 buffers, the max value must be 255.")
+#define M_ERR_170_SUBMSG_9       MIL_TEXT("For H264 buffers, the max value must be 255.")
+
+#define M_FILE_OPERATION_ERROR_3 171L
+#define M_ERR_171_MSG            MIL_TEXT("File operation error.")
+#define M_ERR_171_SUBMSG_1       MIL_TEXT("Unsupported operation on this platform.")
+#define M_ERR_171_SUBMSG_2       MIL_TEXT("User DLL path is not available.")
+#define M_ERR_171_SUBMSG_3       NO_SUBMSG
+#define M_ERR_171_SUBMSG_4       NO_SUBMSG
+#define M_ERR_171_SUBMSG_5       NO_SUBMSG
+#define M_ERR_171_SUBMSG_6       NO_SUBMSG
+#define M_ERR_171_SUBMSG_7       NO_SUBMSG
+#define M_ERR_171_SUBMSG_8       NO_SUBMSG
+#define M_ERR_171_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_INQUIRE        172L
+#define M_ERR_172_MSG            MIL_TEXT("Invalid inquire.")
+#define M_ERR_172_SUBMSG_1       MIL_TEXT("The pitch is not a multiple of the pixel size. Only M_PITCH_BYTE can be safely used.")
+#define M_ERR_172_SUBMSG_2       MIL_TEXT("Unsupported under this OS")
+#define M_ERR_172_SUBMSG_3       NO_SUBMSG
+#define M_ERR_172_SUBMSG_4       NO_SUBMSG
+#define M_ERR_172_SUBMSG_5       NO_SUBMSG
+#define M_ERR_172_SUBMSG_6       NO_SUBMSG
+#define M_ERR_172_SUBMSG_7       NO_SUBMSG
+#define M_ERR_172_SUBMSG_8       NO_SUBMSG
+#define M_ERR_172_SUBMSG_9       NO_SUBMSG
+
+#define M_MONITORING_ERROR       173L
+#define M_ERR_173_MSG            MIL_TEXT("DMIL Monitoring error.")
+#define M_ERR_173_SUBMSG_1       MIL_TEXT("Cannot load Milnetworkserver DLL.")
+#define M_ERR_173_SUBMSG_2       MIL_TEXT("Function not exported.")
+#define M_ERR_173_SUBMSG_3       NO_SUBMSG
+#define M_ERR_173_SUBMSG_4       NO_SUBMSG
+#define M_ERR_173_SUBMSG_5       NO_SUBMSG
+#define M_ERR_173_SUBMSG_6       NO_SUBMSG
+#define M_ERR_173_SUBMSG_7       NO_SUBMSG
+#define M_ERR_173_SUBMSG_8       NO_SUBMSG
+#define M_ERR_173_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_36 174L
+#define M_ERR_174_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_174_SUBMSG_1       MIL_TEXT("For 8-bit JPEG2000 buffers, the max value must be 255.")
+#define M_ERR_174_SUBMSG_2       MIL_TEXT("For 16-bit JPEG2000 buffers, the max value can only be 511, 1023, 2047, 4095, 8191, 16383, 32767 or 65535.")
+#define M_ERR_174_SUBMSG_3       MIL_TEXT("For 8-bit JPEG buffers, the effective size bit must be 8.")
+#define M_ERR_174_SUBMSG_4       MIL_TEXT("For 16-bit JPEG buffers, the effective size bit must be 16.")
+#define M_ERR_174_SUBMSG_5       MIL_TEXT("For MPEG4 buffers, the effective size bit must be 8.")
+#define M_ERR_174_SUBMSG_6       MIL_TEXT("For H264 buffers, the effective size bit must be 8.")
+#define M_ERR_174_SUBMSG_7       MIL_TEXT("For 8-bit JPEG2000 buffers, the effective size bit must be 8.")
+#define M_ERR_174_SUBMSG_8       MIL_TEXT("For 16-bit JPEG2000 buffers, the effective size bit cannot be less than 9 or greater than 16.")
+#define M_ERR_174_SUBMSG_9       MIL_TEXT("Center position at M_DEFAULT are not supported when generating a warp matrix.")
+
+#define M_DISPLAY_ERROR2         175L
+#define M_ERR_175_MSG            MIL_TEXT("Display error.")
+#define M_ERR_175_SUBMSG_1       MIL_TEXT("The display and the LUT must be allocated on the same system.")
+#define M_ERR_175_SUBMSG_2       NO_SUBMSG
+#define M_ERR_175_SUBMSG_3       NO_SUBMSG
+#define M_ERR_175_SUBMSG_4       NO_SUBMSG
+#define M_ERR_175_SUBMSG_5       NO_SUBMSG
+#define M_ERR_175_SUBMSG_6       NO_SUBMSG
+#define M_ERR_175_SUBMSG_7       NO_SUBMSG
+#define M_ERR_175_SUBMSG_8       NO_SUBMSG
+#define M_ERR_175_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_37 176L
+#define M_ERR_176_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_176_SUBMSG_1       MIL_TEXT("Invalid destination Size or Type.")
+#define M_ERR_176_SUBMSG_2       MIL_TEXT("M_FILL_DESTINATION is not supported when generating a warp matrix.")
+#define M_ERR_176_SUBMSG_3       MIL_TEXT("Destination image must be 32-bit with the same type as the source.")
+#define M_ERR_176_SUBMSG_4       MIL_TEXT("Invalid matrix specified.")
+#define M_ERR_176_SUBMSG_5       MIL_TEXT("The number of pixels must be greater than 0.")
+#define M_ERR_176_SUBMSG_6       MIL_TEXT("Invalid Reference Id")
+#define M_ERR_176_SUBMSG_7       MIL_TEXT("Invalid interpolation mode specified.")
+#define M_ERR_176_SUBMSG_8       MIL_TEXT("Invalid ObjectType.")
+#define M_ERR_176_SUBMSG_9       MIL_TEXT("Unsupported operation flag.")
+
+#define M_OPERATION_ERROR_10     177L
+#define M_ERR_177_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_177_SUBMSG_1       MIL_TEXT("Cannot remove object from group.")
+#define M_ERR_177_SUBMSG_2       MIL_TEXT("Message queue is full.")
+#define M_ERR_177_SUBMSG_3       MIL_TEXT("Message write failed.")
+#define M_ERR_177_SUBMSG_4       MIL_TEXT("Message write timeout.")
+#define M_ERR_177_SUBMSG_5       MIL_TEXT("Cannot end update without a previous start.")
+#define M_ERR_177_SUBMSG_6       MIL_TEXT("More messages present than the queue size requested.")
+#define M_ERR_177_SUBMSG_7       MIL_TEXT("Must specify an user array size.")
+#define M_ERR_177_SUBMSG_8       MIL_TEXT("Component ID invalid.")
+#define M_ERR_177_SUBMSG_9       MIL_TEXT("Buffer already in another container.")
+
+#define M_WEB_ERROR              178L
+#define M_ERR_178_MSG            MIL_TEXT("MILWeb Error.")
+#define M_ERR_178_SUBMSG_1       MIL_TEXT("Cannot load milwebserver DLL.")
+#define M_ERR_178_SUBMSG_2       MIL_TEXT("Function not exported.")
+#define M_ERR_178_SUBMSG_3       MIL_TEXT("The port must be set before enabling the connection")
+#define M_ERR_178_SUBMSG_4       MIL_TEXT("The connection mode must be set before enabling the connection")
+#define M_ERR_178_SUBMSG_5       MIL_TEXT("Object must be published before setting publish mode.")
+#define M_ERR_178_SUBMSG_6       MIL_TEXT("Cannot start the websocket server, Listenning port in use.")
+#define M_ERR_178_SUBMSG_7       MIL_TEXT("Cannot start the websocket server,")
+#define M_ERR_178_SUBMSG_8       MIL_TEXT("Server not started")
+#define M_ERR_178_SUBMSG_9       MIL_TEXT("Cannot stop the websocket server,")
+
+#define M_INVALID_PARAM_ERROR_38 179L
+#define M_ERR_179_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_179_SUBMSG_1       MIL_TEXT("Message size must be positive.")
+#define M_ERR_179_SUBMSG_2       MIL_TEXT("Timeout must be positive.")
+#define M_ERR_179_SUBMSG_3       MIL_TEXT("Queue size must be greater than 0.")
+#define M_ERR_179_SUBMSG_4       MIL_TEXT("Queue full behaviour unsupported.")
+#define M_ERR_179_SUBMSG_5       MIL_TEXT("In overwrite mode, queue size must be 1.")
+#define M_ERR_179_SUBMSG_6       MIL_TEXT("Control value must be a hook context.")
+#define M_ERR_179_SUBMSG_7       MIL_TEXT("Unsupported hook information type.")
+#define M_ERR_179_SUBMSG_8       MIL_TEXT("Condition not supported.")
+#define M_ERR_179_SUBMSG_9       MIL_TEXT("M_TYPE_STRING is not supported in this case.")
+
+#define M_INVALID_PROCESS_ERROR  180L
+#define M_ERR_180_MSG            MIL_TEXT("Invalid process")
+#define M_ERR_180_SUBMSG_1       MIL_TEXT("Using MIL in a child process after allocating an application in the parent process is unsupported.")
+#define M_ERR_180_SUBMSG_2       NO_SUBMSG
+#define M_ERR_180_SUBMSG_3       NO_SUBMSG
+#define M_ERR_180_SUBMSG_4       NO_SUBMSG
+#define M_ERR_180_SUBMSG_5       NO_SUBMSG
+#define M_ERR_180_SUBMSG_6       NO_SUBMSG
+#define M_ERR_180_SUBMSG_7       NO_SUBMSG
+#define M_ERR_180_SUBMSG_8       NO_SUBMSG
+#define M_ERR_180_SUBMSG_9       NO_SUBMSG
+
+#define M_BUF_TRANSFER_ERROR_5   181L
+#define M_ERR_181_MSG            MIL_TEXT("Transfer Error.")
+#define M_ERR_181_SUBMSG_1       MIL_TEXT("Cannot clear a specific band in a M_COMPRESS buffer. Must use M_DEFAULT for the DestinationBand parameter.")
+#define M_ERR_181_SUBMSG_2       NO_SUBMSG
+#define M_ERR_181_SUBMSG_3       NO_SUBMSG
+#define M_ERR_181_SUBMSG_4       NO_SUBMSG
+#define M_ERR_181_SUBMSG_5       NO_SUBMSG
+#define M_ERR_181_SUBMSG_6       NO_SUBMSG
+#define M_ERR_181_SUBMSG_7       NO_SUBMSG
+#define M_ERR_181_SUBMSG_8       NO_SUBMSG
+#define M_ERR_181_SUBMSG_9       NO_SUBMSG
+
+#define M_ALLOC_ERROR_8          182L
+#define M_ERR_182_MSG            MIL_TEXT("Allocation error.")
+#define M_ERR_182_SUBMSG_1       MIL_TEXT("Incompatible Reference ID.")
+#define M_ERR_182_SUBMSG_2       MIL_TEXT("Named buffer unsupported.")
+#define M_ERR_182_SUBMSG_3       MIL_TEXT("Error while allocating non-paged buffer.")
+#define M_ERR_182_SUBMSG_4       MIL_TEXT("Error while creating non-paged buffer.")
+#define M_ERR_182_SUBMSG_5       MIL_TEXT("Error while opening a named non-paged buffer.")
+#define M_ERR_182_SUBMSG_6       MIL_TEXT("Error while freeing non-paged buffer.")
+#define M_ERR_182_SUBMSG_7       MIL_TEXT("Buffer dimension is too large.")
+#define M_ERR_182_SUBMSG_8       MIL_TEXT("RLE buffer must be binary.")
+#define M_ERR_182_SUBMSG_9       MIL_TEXT("Grab to PFNC buffer unsupported.")
+
+#define M_OPERATION_ERROR_11     183L
+#define M_ERR_183_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_183_SUBMSG_1       MIL_TEXT("Buffer must reside on same system.")
+#define M_ERR_183_SUBMSG_2       MIL_TEXT("Buffer has unsupported PFNC value.")
+#define M_ERR_183_SUBMSG_3       MIL_TEXT("Added component does not have the correct buffer purpose.")
+#define M_ERR_183_SUBMSG_4       MIL_TEXT("Buffer PFNC value unsupported as a destination.")
+#define M_ERR_183_SUBMSG_5       MIL_TEXT("Fail to unmap buffer.")
+#define M_ERR_183_SUBMSG_6       MIL_TEXT("Not in a hook function.")
+#define M_ERR_183_SUBMSG_7       MIL_TEXT("Internal objects are still allocated.")
+#define M_ERR_183_SUBMSG_8       MIL_TEXT("Internal buffers are still allocated.")
+#define M_ERR_183_SUBMSG_9       MIL_TEXT("Cannot change the label when using M_ALL, it would created non-unique labels.")
+
+#define M_CONTAINER_ERROR_1      184L
+#define M_ERR_184_MSG            MIL_TEXT("Container error.")
+#define M_ERR_184_SUBMSG_1       MIL_TEXT("This system does not support the M_CONTAINER buffer object type.")
+#define M_ERR_184_SUBMSG_2       MIL_TEXT("Invalid buffer container type.")
+#define M_ERR_184_SUBMSG_3       MIL_TEXT("Software emulated grab does not support container buffer types.")
+#define M_ERR_184_SUBMSG_4       MIL_TEXT("Invalid destination image list size. Use M_DEFAULT with container objects.")
+#define M_ERR_184_SUBMSG_5       MIL_TEXT("Error copying component(s).")
+#define M_ERR_184_SUBMSG_6       MIL_TEXT("Cannot add new component.")
+#define M_ERR_184_SUBMSG_7       MIL_TEXT("Component not found.")
+#define M_ERR_184_SUBMSG_8       MIL_TEXT("More than one component found.")
+#define M_ERR_184_SUBMSG_9       MIL_TEXT("Cannot free a user added component.")
+
+#define M_INVALID_PARAM_ERROR_39 185L
+#define M_ERR_185_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_185_SUBMSG_1       MIL_TEXT("No buffer found with the provided name.")
+#define M_ERR_185_SUBMSG_2       MIL_TEXT("M_DISP not supported on container.")
+#define M_ERR_185_SUBMSG_3       MIL_TEXT("Index out of bounds.")
+#define M_ERR_185_SUBMSG_4       MIL_TEXT("M_CENTER_X and M_CENTER_Y are not supported for text.")
+#define M_ERR_185_SUBMSG_5       MIL_TEXT("Invalid number of images.")
+#define M_ERR_185_SUBMSG_6       MIL_TEXT("The value must be a positive divisor of 180.")
+#define M_ERR_185_SUBMSG_7       MIL_TEXT("For RLE buffers, the effective size bit must be 1.")
+#define M_ERR_185_SUBMSG_8       MIL_TEXT("M_SQUARE_ASPECT_RATIO is not supported for this GraphicType.")
+#define M_ERR_185_SUBMSG_9       MIL_TEXT("M_SQUARE_ASPECT_RATIO is not supported for this CreationMode.")
+
+#define M_MIL_HOOK_ERROR         186L
+#define M_ERR_186_MSG            MIL_TEXT("Hook function error.")
+#define M_ERR_186_SUBMSG_1       MIL_TEXT("Invalid object type for EventId")
+#define M_ERR_186_SUBMSG_2       NO_SUBMSG
+#define M_ERR_186_SUBMSG_3       NO_SUBMSG
+#define M_ERR_186_SUBMSG_4       NO_SUBMSG
+#define M_ERR_186_SUBMSG_5       NO_SUBMSG
+#define M_ERR_186_SUBMSG_6       NO_SUBMSG
+#define M_ERR_186_SUBMSG_7       NO_SUBMSG
+#define M_ERR_186_SUBMSG_8       NO_SUBMSG
+#define M_ERR_186_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_40 187L
+#define M_ERR_187_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_187_SUBMSG_1       MIL_TEXT("M_SECTOR is not supported for this GraphicType.")
+#define M_ERR_187_SUBMSG_2       MIL_TEXT("M_FILLED is not supported for this GraphicType.")
+#define M_ERR_187_SUBMSG_3       MIL_TEXT("M_ROTATE_AROUND_CORNER is not supported for this GraphicType.")
+#define M_ERR_187_SUBMSG_4       MIL_TEXT("M_ROTATE_AROUND_CORNER is not supported for this CreationMode.")
+#define M_ERR_187_SUBMSG_5       MIL_TEXT("Invalid CreationMode.")
+#define M_ERR_187_SUBMSG_6       MIL_TEXT("The number of vectors must be greater than 0.")
+#define M_ERR_187_SUBMSG_7       MIL_TEXT("The stride must be greater than 0.")
+#define M_ERR_187_SUBMSG_8       MIL_TEXT("The U/V buffers must be monochrome.")
+#define M_ERR_187_SUBMSG_9       MIL_TEXT("Format must be set to M_DEFAULT.")
+
+#define M_HTTP_SERVICE_ERROR     188L
+#define M_ERR_188_MSG            MIL_TEXT("Http Service Error.")
+#define M_ERR_188_SUBMSG_1       MIL_TEXT("Cannot load milhttpserver DLL.")
+#define M_ERR_188_SUBMSG_2       MIL_TEXT("Function not exported.")
+#define M_ERR_188_SUBMSG_3       NO_SUBMSG
+#define M_ERR_188_SUBMSG_4       NO_SUBMSG
+#define M_ERR_188_SUBMSG_5       NO_SUBMSG
+#define M_ERR_188_SUBMSG_6       NO_SUBMSG
+#define M_ERR_188_SUBMSG_7       NO_SUBMSG
+#define M_ERR_188_SUBMSG_8       NO_SUBMSG
+#define M_ERR_188_SUBMSG_9       NO_SUBMSG
+
+#define M_BUFFER_TYPE_ERROR      189L
+#define M_ERR_189_MSG            MIL_TEXT("Buffer type not supported.")
+#define M_ERR_189_SUBMSG_1       MIL_TEXT("Invalid parameter 1.")
+#define M_ERR_189_SUBMSG_2       MIL_TEXT("Invalid parameter 2.")
+#define M_ERR_189_SUBMSG_3       MIL_TEXT("Invalid parameter 3.")
+#define M_ERR_189_SUBMSG_4       MIL_TEXT("Invalid parameter 4.")
+#define M_ERR_189_SUBMSG_5       MIL_TEXT("Invalid parameter 5.")
+#define M_ERR_189_SUBMSG_6       MIL_TEXT("Invalid parameter 6.")
+#define M_ERR_189_SUBMSG_7       MIL_TEXT("Invalid parameter 7.")
+#define M_ERR_189_SUBMSG_8       MIL_TEXT("Invalid parameter 8.")
+#define M_ERR_189_SUBMSG_9       MIL_TEXT("Invalid parameter 9.")
+
+#define M_GRA_OPERATION_ERROR_2  190L
+#define M_ERR_190_MSG            MIL_TEXT("Drawing operation error.")
+#define M_ERR_190_SUBMSG_1       MIL_TEXT("The U/V buffers must be calibrated because this operation uses world units.")
+#define M_ERR_190_SUBMSG_2       MIL_TEXT("The U/V buffers must have the same calibration.")
+#define M_ERR_190_SUBMSG_3       NO_SUBMSG
+#define M_ERR_190_SUBMSG_4       NO_SUBMSG
+#define M_ERR_190_SUBMSG_5       NO_SUBMSG
+#define M_ERR_190_SUBMSG_6       NO_SUBMSG
+#define M_ERR_190_SUBMSG_7       NO_SUBMSG
+#define M_ERR_190_SUBMSG_8       NO_SUBMSG
+#define M_ERR_190_SUBMSG_9       NO_SUBMSG
+
+#define M_HOOK_ERROR_SPECIFIC     191L
+#define M_ERR_191_MSG             MIL_TEXT("Hook function error.")
+#define M_ERR_191_SUBMSG_1        MIL_TEXT("No driver information in hook context.")
+#define M_ERR_191_SUBMSG_2        MIL_TEXT("Unsupported buffer MIL_ID used.")
+#define M_ERR_191_SUBMSG_3        NO_SUBMSG
+#define M_ERR_191_SUBMSG_4        NO_SUBMSG
+#define M_ERR_191_SUBMSG_5        NO_SUBMSG
+#define M_ERR_191_SUBMSG_6        NO_SUBMSG
+#define M_ERR_191_SUBMSG_7        NO_SUBMSG
+#define M_ERR_191_SUBMSG_8        NO_SUBMSG
+#define M_ERR_191_SUBMSG_9        NO_SUBMSG
+
+
+#define M_WEB_ERROR_2            192L
+#define M_ERR_192_MSG            MIL_TEXT("MILWeb Error.")
+#define M_ERR_192_SUBMSG_1       MIL_TEXT("Cannot share instance of websocket server with different port or diffent publish mode.")
+#define M_ERR_192_SUBMSG_2       NO_SUBMSG
+#define M_ERR_192_SUBMSG_3       NO_SUBMSG
+#define M_ERR_192_SUBMSG_4       NO_SUBMSG
+#define M_ERR_192_SUBMSG_5       NO_SUBMSG
+#define M_ERR_192_SUBMSG_6       NO_SUBMSG
+#define M_ERR_192_SUBMSG_7       NO_SUBMSG
+#define M_ERR_192_SUBMSG_8       NO_SUBMSG
+#define M_ERR_192_SUBMSG_9       NO_SUBMSG
+
+#define M_FEATURE_BROWSER_ERROR  193L
+#define M_ERR_193_MSG            MIL_TEXT("Feature Browser Error.")
+#define M_ERR_193_SUBMSG_1       MIL_TEXT("Could not start the feature browser process. Make sure it is located in the MIL tools folder.")
+#define M_ERR_193_SUBMSG_2       NO_SUBMSG
+#define M_ERR_193_SUBMSG_3       NO_SUBMSG
+#define M_ERR_193_SUBMSG_4       NO_SUBMSG
+#define M_ERR_193_SUBMSG_5       NO_SUBMSG
+#define M_ERR_193_SUBMSG_6       NO_SUBMSG
+#define M_ERR_193_SUBMSG_7       NO_SUBMSG
+#define M_ERR_193_SUBMSG_8       NO_SUBMSG
+#define M_ERR_193_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_41 194L
+#define M_ERR_194_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_194_SUBMSG_1       MIL_TEXT("Invalid inquire type. Cannot combine M_NB_ELEMENTS with M_DEFAULT or M_SUPPORTED.")
+#define M_ERR_194_SUBMSG_2       MIL_TEXT("Invalid inquire type: M_NB_ELEMENTS cannot be used with any string inquire type.")
+#define M_ERR_194_SUBMSG_3       MIL_TEXT("Invalid result type. Cannot combine M_NB_ELEMENTS with M_DEFAULT or M_AVAILABLE.")
+#define M_ERR_194_SUBMSG_4       MIL_TEXT("Invalid result type: M_NB_ELEMENTS cannot be used with any string result type.")
+#define M_ERR_194_SUBMSG_5       MIL_TEXT("Invalid SystemNum.") 
+#define M_ERR_194_SUBMSG_6       MIL_TEXT("Driver does not support M_DEVICE_NAME.")
+#define M_ERR_194_SUBMSG_7       MIL_TEXT("Number of bands must be M_DEFAULT.") 
+#define M_ERR_194_SUBMSG_8       MIL_TEXT("Buffer must be dynamic.")
+#define M_ERR_194_SUBMSG_9       MIL_TEXT("Invalid number of band offset.")
+
+#define M_DATA_AUGMENT_ERROR     195L
+#define M_ERR_195_MSG            MIL_TEXT("Data augment error.")
+#define M_ERR_195_SUBMSG_1       MIL_TEXT("Invalid minimum and maximum values for range parameters. Minimum is not less than maximum value.")
+#define M_ERR_195_SUBMSG_2       MIL_TEXT("Invalid buffer type. Hue|Saturation|Value augmentation operates on color buffers only.")
+#define M_ERR_195_SUBMSG_3       MIL_TEXT("Invalid crop mode. Control not available with current crop mode.")
+#define M_ERR_195_SUBMSG_4       MIL_TEXT("Cannot inquire M_AUG_RNG_INIT_VALUE before preprocessing the context.")
+#define M_ERR_195_SUBMSG_5       MIL_TEXT("Dispatch internal error.")
+#define M_ERR_195_SUBMSG_6       MIL_TEXT("Invalid buffer type. Gamma Mode per band operates on color buffers only.")
+#define M_ERR_195_SUBMSG_7       MIL_TEXT("Unavailable result. Make sure the associated augmentation has been enabled.")
+#define M_ERR_195_SUBMSG_8       MIL_TEXT("Unavailable result image. Make sure you called MimAugment.")
+#define M_ERR_195_SUBMSG_9       MIL_TEXT("Invalid Destination ID, should be M_IMAGE or M_AUGMENTATION_RESULT")   
+
+#define M_INVALID_PARAM_ERROR_42 196L
+#define M_ERR_196_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_196_SUBMSG_1       MIL_TEXT("SystemNum default must be a name.")
+#define M_ERR_196_SUBMSG_2       MIL_TEXT("SystemNum default cannot be a name.")
+#define M_ERR_196_SUBMSG_3       MIL_TEXT("DigNum default must be a name.")
+#define M_ERR_196_SUBMSG_4       MIL_TEXT("DigNum default cannot be a name.")
+#define M_ERR_196_SUBMSG_5       MIL_TEXT("Cannot use remote file on local system.")
+#define M_ERR_196_SUBMSG_6       MIL_TEXT("Min must be lower or equal to Max.")
+#define M_ERR_196_SUBMSG_7       MIL_TEXT("Impossible to go from Min to Max with a k equal to 0.")
+#define M_ERR_196_SUBMSG_8       MIL_TEXT("At least one destination must be specified.")
+#define M_ERR_196_SUBMSG_9       MIL_TEXT("Destination buffers must have the same number of bands.")
+
+#define M_ALLOC_ERROR_9          197L
+#define M_ERR_197_MSG            MIL_TEXT("Allocation error.")
+#define M_ERR_197_SUBMSG_1       MIL_TEXT("M_PROC or M_DISP not supported for this PFNC value.")
+#define M_ERR_197_SUBMSG_2       MIL_TEXT("Incompatible parameters when using M_DYNAMIC.")
+#define M_ERR_197_SUBMSG_3       MIL_TEXT("Can only set PFNC for M_IMAGE.")
+#define M_ERR_197_SUBMSG_4       NO_SUBMSG
+#define M_ERR_197_SUBMSG_5       NO_SUBMSG
+#define M_ERR_197_SUBMSG_6       NO_SUBMSG
+#define M_ERR_197_SUBMSG_7       NO_SUBMSG
+#define M_ERR_197_SUBMSG_8       NO_SUBMSG
+#define M_ERR_197_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_43 198L
+#define M_ERR_198_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_198_SUBMSG_1       MIL_TEXT("Parameters 3 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_2       MIL_TEXT("Parameters 3, 5 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_3       MIL_TEXT("Parameters 4 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_4       MIL_TEXT("Parameters 5 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_5       MIL_TEXT("Parameter B must be compatible with provided buffer.")
+#define M_ERR_198_SUBMSG_6       MIL_TEXT("Parameter A must be compatible with provided buffer.")
+#define M_ERR_198_SUBMSG_7       MIL_TEXT("Parameter 10 not in supported list.")
+#define M_ERR_198_SUBMSG_8       MIL_TEXT("Parameters 6 to 8 must be set to M_DEFAULT.")
+#define M_ERR_198_SUBMSG_9       MIL_TEXT("Parameter 3 must be smaller than parameter 4.")
+
+#define M_INVALID_PARAM_ERROR_44 199L
+#define M_ERR_199_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_199_SUBMSG_1       MIL_TEXT("Parameter 6 cannot be set to M_DEFAULT.")
+#define M_ERR_199_SUBMSG_2       MIL_TEXT("Invalid component type.")
+#define M_ERR_199_SUBMSG_3       MIL_TEXT("Invalid number of components.")
+#define M_ERR_199_SUBMSG_4       MIL_TEXT("No pitch control flag used.")
+#define M_ERR_199_SUBMSG_5       NO_SUBMSG
+#define M_ERR_199_SUBMSG_6       NO_SUBMSG
+#define M_ERR_199_SUBMSG_7       NO_SUBMSG
+#define M_ERR_199_SUBMSG_8       NO_SUBMSG
+#define M_ERR_199_SUBMSG_9       NO_SUBMSG
+
+#define M_OPERATION_ERROR_12     56200L
+#define M_ERR_200_MSG            MIL_TEXT("Operation error.")
+#define M_ERR_200_SUBMSG_1       MIL_TEXT("Operation does not support buffers with M_MODIFY region.")
+#define M_ERR_200_SUBMSG_2       NO_SUBMSG
+#define M_ERR_200_SUBMSG_3       NO_SUBMSG
+#define M_ERR_200_SUBMSG_4       NO_SUBMSG
+#define M_ERR_200_SUBMSG_5       NO_SUBMSG
+#define M_ERR_200_SUBMSG_6       NO_SUBMSG
+#define M_ERR_200_SUBMSG_7       NO_SUBMSG
+#define M_ERR_200_SUBMSG_8       NO_SUBMSG
+#define M_ERR_200_SUBMSG_9       NO_SUBMSG
+
+
+#define M_INVALID_PARAM_ERROR_45 56201L
+#define M_ERR_201_MSG            MIL_TEXT("Invalid parameter.")
+#define M_ERR_201_SUBMSG_1       MIL_TEXT("Control value must be in [0.5 : 1.0].")
+#define M_ERR_201_SUBMSG_2       MIL_TEXT("Control value must be in [0.0 : 1.0].")
+#define M_ERR_201_SUBMSG_3       MIL_TEXT("Control value must be in [5 : 15].")
+#define M_ERR_201_SUBMSG_4       MIL_TEXT("Control value must be in [0.0 : 16.0].")
+#define M_ERR_201_SUBMSG_5       MIL_TEXT("Control value must be in [-MIL_DOUBLE_MAX/2 : MIL_DOUBLE_MAX/2].")
+#define M_ERR_201_SUBMSG_6       MIL_TEXT("Control value must be in [0.0 : MIL_DOUBLE_MAX/2].")
+#define M_ERR_201_SUBMSG_7       MIL_TEXT("Control value must be >= 0.")
+#define M_ERR_201_SUBMSG_8       MIL_TEXT("Control value must be in [0.0 : 100.0].")
+#define M_ERR_201_SUBMSG_9       MIL_TEXT("Control value must be in [0 : MIL_INT32_MAX].")
+
+
+#define M_SERVICE_3D_ERROR       56202L
+#define M_ERR_202_MSG            MIL_TEXT("3D service error.")
+#define M_ERR_202_SUBMSG_1       MIL_TEXT("Cannot load Mil3D DLL.")
+#define M_ERR_202_SUBMSG_2       MIL_TEXT("Cannot find address of requested function.")
+#define M_ERR_202_SUBMSG_3       NO_SUBMSG
+#define M_ERR_202_SUBMSG_4       NO_SUBMSG
+#define M_ERR_202_SUBMSG_5       NO_SUBMSG
+#define M_ERR_202_SUBMSG_6       NO_SUBMSG
+#define M_ERR_202_SUBMSG_7       NO_SUBMSG
+#define M_ERR_202_SUBMSG_8       NO_SUBMSG
+#define M_ERR_202_SUBMSG_9       NO_SUBMSG
+
+
+
+#define M_CONTAINER_ERROR_2      56203L
+#define M_ERR_203_MSG            MIL_TEXT("Container error.")
+#define M_ERR_203_SUBMSG_1       MIL_TEXT("The buffer is already in a container.")
+#define M_ERR_203_SUBMSG_2       NO_SUBMSG
+#define M_ERR_203_SUBMSG_3       NO_SUBMSG
+#define M_ERR_203_SUBMSG_4       NO_SUBMSG
+#define M_ERR_203_SUBMSG_5       NO_SUBMSG
+#define M_ERR_203_SUBMSG_6       NO_SUBMSG
+#define M_ERR_203_SUBMSG_7       NO_SUBMSG
+#define M_ERR_203_SUBMSG_8       NO_SUBMSG
+#define M_ERR_203_SUBMSG_9       NO_SUBMSG
+
+#define M_CHILD_ERROR_2          56204L
+#define M_ERR_204_MSG            MIL_TEXT("Child allocation error.")
+#define M_ERR_204_SUBMSG_1       MIL_TEXT("Cannot allocate a child on a dynamic buffer.")
+#define M_ERR_204_SUBMSG_2       NO_SUBMSG
+#define M_ERR_204_SUBMSG_3       NO_SUBMSG
+#define M_ERR_204_SUBMSG_4       NO_SUBMSG
+#define M_ERR_204_SUBMSG_5       NO_SUBMSG
+#define M_ERR_204_SUBMSG_6       NO_SUBMSG
+#define M_ERR_204_SUBMSG_7       NO_SUBMSG
+#define M_ERR_204_SUBMSG_8       NO_SUBMSG
+#define M_ERR_204_SUBMSG_9       NO_SUBMSG
+
+#define M_INVALID_PARAM_ERROR_46 56205L
+#define M_ERR_205_MSG            NO_SUBMSG
+#define M_ERR_205_SUBMSG_1       NO_SUBMSG
+#define M_ERR_205_SUBMSG_2       NO_SUBMSG
+#define M_ERR_205_SUBMSG_3       MIL_TEXT("Control value must be in [0.0 : 10.0].")
+#define M_ERR_205_SUBMSG_4       NO_SUBMSG
+#define M_ERR_205_SUBMSG_5       NO_SUBMSG
+#define M_ERR_205_SUBMSG_6       NO_SUBMSG
+#define M_ERR_205_SUBMSG_7       NO_SUBMSG
+#define M_ERR_205_SUBMSG_8       NO_SUBMSG
+#define M_ERR_205_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_206       56206L
+#define M_ERR_206_MSG            NO_SUBMSG
+#define M_ERR_206_SUBMSG_1       NO_SUBMSG
+#define M_ERR_206_SUBMSG_2       NO_SUBMSG
+#define M_ERR_206_SUBMSG_3       NO_SUBMSG
+#define M_ERR_206_SUBMSG_4       NO_SUBMSG
+#define M_ERR_206_SUBMSG_5       NO_SUBMSG
+#define M_ERR_206_SUBMSG_6       NO_SUBMSG
+#define M_ERR_206_SUBMSG_7       NO_SUBMSG
+#define M_ERR_206_SUBMSG_8       NO_SUBMSG
+#define M_ERR_206_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_207       56207L
+#define M_ERR_207_MSG            NO_SUBMSG
+#define M_ERR_207_SUBMSG_1       NO_SUBMSG
+#define M_ERR_207_SUBMSG_2       NO_SUBMSG
+#define M_ERR_207_SUBMSG_3       NO_SUBMSG
+#define M_ERR_207_SUBMSG_4       NO_SUBMSG
+#define M_ERR_207_SUBMSG_5       NO_SUBMSG
+#define M_ERR_207_SUBMSG_6       NO_SUBMSG
+#define M_ERR_207_SUBMSG_7       NO_SUBMSG
+#define M_ERR_207_SUBMSG_8       NO_SUBMSG
+#define M_ERR_207_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_208       56208L
+#define M_ERR_208_MSG            NO_SUBMSG
+#define M_ERR_208_SUBMSG_1       NO_SUBMSG
+#define M_ERR_208_SUBMSG_2       NO_SUBMSG
+#define M_ERR_208_SUBMSG_3       NO_SUBMSG
+#define M_ERR_208_SUBMSG_4       NO_SUBMSG
+#define M_ERR_208_SUBMSG_5       NO_SUBMSG
+#define M_ERR_208_SUBMSG_6       NO_SUBMSG
+#define M_ERR_208_SUBMSG_7       NO_SUBMSG
+#define M_ERR_208_SUBMSG_8       NO_SUBMSG
+#define M_ERR_208_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_209       56209L
+#define M_ERR_209_MSG            NO_SUBMSG
+#define M_ERR_209_SUBMSG_1       NO_SUBMSG
+#define M_ERR_209_SUBMSG_2       NO_SUBMSG
+#define M_ERR_209_SUBMSG_3       NO_SUBMSG
+#define M_ERR_209_SUBMSG_4       NO_SUBMSG
+#define M_ERR_209_SUBMSG_5       NO_SUBMSG
+#define M_ERR_209_SUBMSG_6       NO_SUBMSG
+#define M_ERR_209_SUBMSG_7       NO_SUBMSG
+#define M_ERR_209_SUBMSG_8       NO_SUBMSG
+#define M_ERR_209_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_210       56210L
+#define M_ERR_210_MSG            NO_SUBMSG
+#define M_ERR_210_SUBMSG_1       NO_SUBMSG
+#define M_ERR_210_SUBMSG_2       NO_SUBMSG
+#define M_ERR_210_SUBMSG_3       NO_SUBMSG
+#define M_ERR_210_SUBMSG_4       NO_SUBMSG
+#define M_ERR_210_SUBMSG_5       NO_SUBMSG
+#define M_ERR_210_SUBMSG_6       NO_SUBMSG
+#define M_ERR_210_SUBMSG_7       NO_SUBMSG
+#define M_ERR_210_SUBMSG_8       NO_SUBMSG
+#define M_ERR_210_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_211       56211L
+#define M_ERR_211_MSG            NO_SUBMSG
+#define M_ERR_211_SUBMSG_1       NO_SUBMSG
+#define M_ERR_211_SUBMSG_2       NO_SUBMSG
+#define M_ERR_211_SUBMSG_3       NO_SUBMSG
+#define M_ERR_211_SUBMSG_4       NO_SUBMSG
+#define M_ERR_211_SUBMSG_5       NO_SUBMSG
+#define M_ERR_211_SUBMSG_6       NO_SUBMSG
+#define M_ERR_211_SUBMSG_7       NO_SUBMSG
+#define M_ERR_211_SUBMSG_8       NO_SUBMSG
+#define M_ERR_211_SUBMSG_9       NO_SUBMSG
+
+
+#define M_UNUSED_ERROR_212       56212L
+#define M_ERR_212_MSG            NO_SUBMSG
+#define M_ERR_212_SUBMSG_1       NO_SUBMSG
+#define M_ERR_212_SUBMSG_2       NO_SUBMSG
+#define M_ERR_212_SUBMSG_3       NO_SUBMSG
+#define M_ERR_212_SUBMSG_4       NO_SUBMSG
+#define M_ERR_212_SUBMSG_5       NO_SUBMSG
+#define M_ERR_212_SUBMSG_6       NO_SUBMSG
+#define M_ERR_212_SUBMSG_7       NO_SUBMSG
+#define M_ERR_212_SUBMSG_8       NO_SUBMSG
+#define M_ERR_212_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_213       56213L
+#define M_ERR_213_MSG            NO_SUBMSG
+#define M_ERR_213_SUBMSG_1       NO_SUBMSG
+#define M_ERR_213_SUBMSG_2       NO_SUBMSG
+#define M_ERR_213_SUBMSG_3       NO_SUBMSG
+#define M_ERR_213_SUBMSG_4       NO_SUBMSG
+#define M_ERR_213_SUBMSG_5       NO_SUBMSG
+#define M_ERR_213_SUBMSG_6       NO_SUBMSG
+#define M_ERR_213_SUBMSG_7       NO_SUBMSG
+#define M_ERR_213_SUBMSG_8       NO_SUBMSG
+#define M_ERR_213_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_214       56214L
+#define M_ERR_214_MSG            NO_SUBMSG
+#define M_ERR_214_SUBMSG_1       NO_SUBMSG
+#define M_ERR_214_SUBMSG_2       NO_SUBMSG
+#define M_ERR_214_SUBMSG_3       NO_SUBMSG
+#define M_ERR_214_SUBMSG_4       NO_SUBMSG
+#define M_ERR_214_SUBMSG_5       NO_SUBMSG
+#define M_ERR_214_SUBMSG_6       NO_SUBMSG
+#define M_ERR_214_SUBMSG_7       NO_SUBMSG
+#define M_ERR_214_SUBMSG_8       NO_SUBMSG
+#define M_ERR_214_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_215       56215L
+#define M_ERR_215_MSG            NO_SUBMSG
+#define M_ERR_215_SUBMSG_1       NO_SUBMSG
+#define M_ERR_215_SUBMSG_2       NO_SUBMSG
+#define M_ERR_215_SUBMSG_3       NO_SUBMSG
+#define M_ERR_215_SUBMSG_4       NO_SUBMSG
+#define M_ERR_215_SUBMSG_5       NO_SUBMSG
+#define M_ERR_215_SUBMSG_6       NO_SUBMSG
+#define M_ERR_215_SUBMSG_7       NO_SUBMSG
+#define M_ERR_215_SUBMSG_8       NO_SUBMSG
+#define M_ERR_215_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_216       56216L
+#define M_ERR_216_MSG            NO_SUBMSG
+#define M_ERR_216_SUBMSG_1       NO_SUBMSG
+#define M_ERR_216_SUBMSG_2       NO_SUBMSG
+#define M_ERR_216_SUBMSG_3       NO_SUBMSG
+#define M_ERR_216_SUBMSG_4       NO_SUBMSG
+#define M_ERR_216_SUBMSG_5       NO_SUBMSG
+#define M_ERR_216_SUBMSG_6       NO_SUBMSG
+#define M_ERR_216_SUBMSG_7       NO_SUBMSG
+#define M_ERR_216_SUBMSG_8       NO_SUBMSG
+#define M_ERR_216_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_217       56217L
+#define M_ERR_217_MSG            NO_SUBMSG
+#define M_ERR_217_SUBMSG_1       NO_SUBMSG
+#define M_ERR_217_SUBMSG_2       NO_SUBMSG
+#define M_ERR_217_SUBMSG_3       NO_SUBMSG
+#define M_ERR_217_SUBMSG_4       NO_SUBMSG
+#define M_ERR_217_SUBMSG_5       NO_SUBMSG
+#define M_ERR_217_SUBMSG_6       NO_SUBMSG
+#define M_ERR_217_SUBMSG_7       NO_SUBMSG
+#define M_ERR_217_SUBMSG_8       NO_SUBMSG
+#define M_ERR_217_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_218       56218L
+#define M_ERR_218_MSG            NO_SUBMSG
+#define M_ERR_218_SUBMSG_1       NO_SUBMSG
+#define M_ERR_218_SUBMSG_2       NO_SUBMSG
+#define M_ERR_218_SUBMSG_3       NO_SUBMSG
+#define M_ERR_218_SUBMSG_4       NO_SUBMSG
+#define M_ERR_218_SUBMSG_5       NO_SUBMSG
+#define M_ERR_218_SUBMSG_6       NO_SUBMSG
+#define M_ERR_218_SUBMSG_7       NO_SUBMSG
+#define M_ERR_218_SUBMSG_8       NO_SUBMSG
+#define M_ERR_218_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_219       56219L
+#define M_ERR_219_MSG            NO_SUBMSG
+#define M_ERR_219_SUBMSG_1       NO_SUBMSG
+#define M_ERR_219_SUBMSG_2       NO_SUBMSG
+#define M_ERR_219_SUBMSG_3       NO_SUBMSG
+#define M_ERR_219_SUBMSG_4       NO_SUBMSG
+#define M_ERR_219_SUBMSG_5       NO_SUBMSG
+#define M_ERR_219_SUBMSG_6       NO_SUBMSG
+#define M_ERR_219_SUBMSG_7       NO_SUBMSG
+#define M_ERR_219_SUBMSG_8       NO_SUBMSG
+#define M_ERR_219_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_220       56220L
+#define M_ERR_220_MSG            NO_SUBMSG
+#define M_ERR_220_SUBMSG_1       NO_SUBMSG
+#define M_ERR_220_SUBMSG_2       NO_SUBMSG
+#define M_ERR_220_SUBMSG_3       NO_SUBMSG
+#define M_ERR_220_SUBMSG_4       NO_SUBMSG
+#define M_ERR_220_SUBMSG_5       NO_SUBMSG
+#define M_ERR_220_SUBMSG_6       NO_SUBMSG
+#define M_ERR_220_SUBMSG_7       NO_SUBMSG
+#define M_ERR_220_SUBMSG_8       NO_SUBMSG
+#define M_ERR_220_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_221       56221L
+#define M_ERR_221_MSG            NO_SUBMSG
+#define M_ERR_221_SUBMSG_1       NO_SUBMSG
+#define M_ERR_221_SUBMSG_2       NO_SUBMSG
+#define M_ERR_221_SUBMSG_3       NO_SUBMSG
+#define M_ERR_221_SUBMSG_4       NO_SUBMSG
+#define M_ERR_221_SUBMSG_5       NO_SUBMSG
+#define M_ERR_221_SUBMSG_6       NO_SUBMSG
+#define M_ERR_221_SUBMSG_7       NO_SUBMSG
+#define M_ERR_221_SUBMSG_8       NO_SUBMSG
+#define M_ERR_221_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_222       56222L
+#define M_ERR_222_MSG            NO_SUBMSG
+#define M_ERR_222_SUBMSG_1       NO_SUBMSG
+#define M_ERR_222_SUBMSG_2       NO_SUBMSG
+#define M_ERR_222_SUBMSG_3       NO_SUBMSG
+#define M_ERR_222_SUBMSG_4       NO_SUBMSG
+#define M_ERR_222_SUBMSG_5       NO_SUBMSG
+#define M_ERR_222_SUBMSG_6       NO_SUBMSG
+#define M_ERR_222_SUBMSG_7       NO_SUBMSG
+#define M_ERR_222_SUBMSG_8       NO_SUBMSG
+#define M_ERR_222_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_223       56223L
+#define M_ERR_223_MSG            NO_SUBMSG
+#define M_ERR_223_SUBMSG_1       NO_SUBMSG
+#define M_ERR_223_SUBMSG_2       NO_SUBMSG
+#define M_ERR_223_SUBMSG_3       NO_SUBMSG
+#define M_ERR_223_SUBMSG_4       NO_SUBMSG
+#define M_ERR_223_SUBMSG_5       NO_SUBMSG
+#define M_ERR_223_SUBMSG_6       NO_SUBMSG
+#define M_ERR_223_SUBMSG_7       NO_SUBMSG
+#define M_ERR_223_SUBMSG_8       NO_SUBMSG
+#define M_ERR_223_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_224       56224L
+#define M_ERR_224_MSG            NO_SUBMSG
+#define M_ERR_224_SUBMSG_1       NO_SUBMSG
+#define M_ERR_224_SUBMSG_2       NO_SUBMSG
+#define M_ERR_224_SUBMSG_3       NO_SUBMSG
+#define M_ERR_224_SUBMSG_4       NO_SUBMSG
+#define M_ERR_224_SUBMSG_5       NO_SUBMSG
+#define M_ERR_224_SUBMSG_6       NO_SUBMSG
+#define M_ERR_224_SUBMSG_7       NO_SUBMSG
+#define M_ERR_224_SUBMSG_8       NO_SUBMSG
+#define M_ERR_224_SUBMSG_9       NO_SUBMSG
+
+#define M_UNUSED_ERROR_225       56225L
+#define M_ERR_225_MSG            NO_SUBMSG
+#define M_ERR_225_SUBMSG_1       NO_SUBMSG
+#define M_ERR_225_SUBMSG_2       NO_SUBMSG
+#define M_ERR_225_SUBMSG_3       NO_SUBMSG
+#define M_ERR_225_SUBMSG_4       NO_SUBMSG
+#define M_ERR_225_SUBMSG_5       NO_SUBMSG
+#define M_ERR_225_SUBMSG_6       NO_SUBMSG
+#define M_ERR_225_SUBMSG_7       NO_SUBMSG
+#define M_ERR_225_SUBMSG_8       NO_SUBMSG
+#define M_ERR_225_SUBMSG_9       NO_SUBMSG
+
+
+#define M_LAST_CORE_ERROR        M_UNUSED_ERROR_225
+// TO DO when adding a new error message
+// Update M_NBERRMSGMAX in mil.h when adding a new error message
+// Update osglob.cpp as well
+
+#endif
diff --git a/Lib/Matrox/Include/Milos.h b/Lib/Matrox/Include/Milos.h
new file mode 100644
index 0000000..9205bec
--- /dev/null
+++ b/Lib/Matrox/Include/Milos.h
@@ -0,0 +1,1423 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MILOS.H
+* Revision     :  10.40.0640
+* Content      :  This file contains the defines necessary to use the
+*                 Matrox Imaging Library under different operating systems
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+
+#ifndef __MILOS_H
+#define __MILOS_H
+
+#ifndef M_MIL_USE_OS
+#define M_MIL_USE_WINDOWS       1
+#endif
+
+#define        M_SEEK_SET  0
+#define        M_SEEK_CUR  1
+#define        M_SEEK_END  2
+
+/************************************************************************/
+/* Include float.h                                                      */
+/************************************************************************/
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+#include <float.h>
+#endif
+
+/************************************************************************/
+/* MIL TYPE DEFINITIONS                                                 */
+/************************************************************************/
+/* GENERAL RELATED DEFINES */
+/***************************/
+#if M_MIL_USE_WINDOWS
+
+      #if M_MIL_USE_64BIT
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+         typedef  __int64              MIL_INT;
+         typedef  unsigned __int64     MIL_UINT;
+#else
+         typedef  long long            MIL_INT;
+         typedef  unsigned long long   MIL_UINT;
+#endif
+
+         #define  MIL_UINT_MIN      0ULL
+         #define  MIL_UINT_MAX      18446744073709551615ULL
+         #define  MIL_INT_MIN       (-9223372036854775807LL - 1)
+         #define  MIL_INT_MAX       9223372036854775807LL
+      #else
+         #if (_MSC_VER < 1400) // Visual Studio 2003
+            typedef  long           MIL_INT;
+            typedef  unsigned long  MIL_UINT;
+         #else                 // Visual Studio 2005
+            // _W64 Lets you mark variables, such that when you compile
+            // with /Wp64 the compiler will report any warnings that would
+            // be reported if you were compiling with a 64-bit compiler.
+            typedef _W64          long MIL_INT;
+            typedef _W64 unsigned long MIL_UINT;
+         #endif
+         #define  MIL_UINT_MIN   0UL
+         #define  MIL_UINT_MAX   4294967295UL
+         #define  MIL_INT_MIN    (-2147483647L-1L)
+         #define  MIL_INT_MAX    2147483647L
+      #endif
+   
+   typedef                long         MIL_INT32;
+   typedef const          long         MIL_CINT32;
+   typedef       unsigned long         MIL_UINT32;
+   typedef const unsigned long         MIL_CUINT32;
+   #define  MIL_UINT32_MIN             0UL
+   #define  MIL_UINT32_MAX             4294967295UL
+   #define  MIL_INT32_MIN              (-2147483647L-1L)
+   #define  MIL_INT32_MAX              2147483647L
+   #define  MIL_UINT32_MIN_FLT         0UL               //Min precise value in 32-bit floating point.
+   #define  MIL_UINT32_MAX_FLT         0xFFFFFF00UL      //Max precise value in 32-bit floating point.
+   #define  MIL_INT32_MIN_FLT          (-2147483647L-1L) //Min precise value in 32-bit floating point.
+   #define  MIL_INT32_MAX_FLT          0x7FFFFF80L       //Max precise value in 32-bit floating point.
+
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+   typedef                __int64      MIL_INT64;
+   typedef const          __int64      MIL_CINT64;
+   typedef       unsigned __int64      MIL_UINT64;
+   typedef const unsigned __int64      MIL_CUINT64;
+#else
+   typedef                long long    MIL_INT64;
+   typedef const          long long    MIL_CINT64;
+   typedef       unsigned long long    MIL_UINT64;
+   typedef const unsigned long long    MIL_CUINT64;
+#endif
+   #define  MIL_UINT64_MIN             0ULL
+   #define  MIL_UINT64_MAX             18446744073709551615ULL
+   #define  MIL_INT64_MIN              (-9223372036854775807LL - 1)
+   #define  MIL_INT64_MAX              9223372036854775807LL
+   #define  MIL_UINT64_MIN_DBL         0ULL                    //Min precise value in 64-bit floating point.
+   #define  MIL_UINT64_MAX_DBL         0xFFFFFFFFFFFFF800ULL   //Max precise value in 64-bit floating point.
+   #define  MIL_INT64_MIN_DBL          (-9223372036854775807LL - 1LL)  //Min precise value in 64-bit floating point.
+   #define  MIL_INT64_MAX_DBL          0x7FFFFFFFFFFFFC00LL    //Max precise value in 64-bit floating point.
+   #define  MIL_UINT64_MIN_EXACT_DBL   0x0ULL                        //Min precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_UINT64_MAX_EXACT_DBL   0x001FFFFFFFFFFFFFULL         //Max precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_INT64_MIN_EXACT_DBL    (-0x001FFFFFFFFFFFFFLL - 1LL) //Min precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_INT64_MAX_EXACT_DBL    0x001FFFFFFFFFFFFFLL          //Max precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+
+   typedef                double       MIL_DOUBLE;
+   typedef                float        MIL_FLOAT;
+   typedef                char         MIL_INT8;
+   typedef const          char         MIL_CINT8;
+   typedef       unsigned char         MIL_UINT8;
+   typedef const unsigned char         MIL_CUINT8;
+   typedef                short        MIL_INT16;
+   typedef const          short        MIL_CINT16;
+   typedef       unsigned short        MIL_UINT16;
+   typedef const unsigned short        MIL_CUINT16;
+   typedef MIL_INT32                   MIL_BOOL;
+   typedef const MIL_INT32             MIL_CBOOL;
+
+   #define  MIL_UINT8_MIN              0UL
+   #define  MIL_UINT8_MAX              255UL
+   #define  MIL_INT8_MIN               -128L
+   #define  MIL_INT8_MAX               127L
+   #define  MIL_UINT16_MIN             0UL
+   #define  MIL_UINT16_MAX             65535UL
+   #define  MIL_INT16_MIN              -32768L
+   #define  MIL_INT16_MAX              32767L
+   #define  MIL_DOUBLE_MIN             DBL_MIN
+   #define  MIL_DOUBLE_MAX             DBL_MAX
+   #define  MIL_FLOAT_MIN              FLT_MIN
+   #define  MIL_FLOAT_MAX              FLT_MAX
+   #define  MIL_BOOL_MIN               0UL
+   #define  MIL_BOOL_MAX               1UL
+
+#if M_MIL_UNICODE_API
+   typedef       wchar_t               MIL_WCHAR;
+#else
+   typedef       unsigned short        MIL_WCHAR;
+#endif
+
+#elif M_MIL_USE_LINUX
+   typedef               long          MIL_INT;
+   typedef      unsigned long          MIL_UINT;
+
+   #if M_MIL_USE_64BIT
+   typedef                int          MIL_INT32;
+   typedef const          int          MIL_CINT32;
+   typedef       unsigned int          MIL_UINT32;
+   typedef const unsigned int          MIL_CUINT32;
+
+   #define  MIL_UINT_MIN               MIL_UINT64_MIN
+   #define  MIL_UINT_MAX               MIL_UINT64_MAX
+   #define  MIL_INT_MIN                MIL_INT64_MIN
+   #define  MIL_INT_MAX                MIL_INT64_MAX
+   #else // M_MIL_USE_64BIT
+   typedef                long         MIL_INT32;
+   typedef const          long         MIL_CINT32;
+   typedef       unsigned long         MIL_UINT32;
+   typedef const unsigned long         MIL_CUINT32;
+
+   #define  MIL_UINT_MIN               MIL_UINT32_MIN
+   #define  MIL_UINT_MAX               MIL_UINT32_MAX
+   #define  MIL_INT_MIN                MIL_INT32_MIN
+   #define  MIL_INT_MAX                MIL_INT32_MAX
+   #endif
+
+   #define  MIL_UINT32_MIN             0
+   #define  MIL_UINT32_MAX             4294967295U
+   #define  MIL_INT32_MIN              (-MIL_INT32_MAX - 1) // -2147483648L does not yield the right value
+   #define  MIL_INT32_MAX              2147483647
+   #define  MIL_UINT32_MIN_FLT         0U                //Min precise value in 32-bit floating point.
+   #define  MIL_UINT32_MAX_FLT         0xFFFFFF00U       //Max precise value in 32-bit floating point.
+   #define  MIL_INT32_MIN_FLT          (-2147483647-1)   //Min precise value in 32-bit floating point.
+   #define  MIL_INT32_MAX_FLT          0x7FFFFF80       //Max precise value in 32-bit floating point.
+
+   #if M_MIL_USE_64BIT
+      typedef                long       MIL_INT64;
+      typedef const          long       MIL_CINT64;
+      typedef       unsigned long       MIL_UINT64;
+      typedef const unsigned long       MIL_CUINT64;
+   #else
+      typedef                long long MIL_INT64;
+      typedef const          long long MIL_CINT64;
+      typedef       unsigned long long MIL_UINT64;
+      typedef const unsigned long long MIL_CUINT64;
+   #endif
+   #define  MIL_UINT64_MIN             0ULL
+   #define  MIL_UINT64_MAX             18446744073709551615ULL
+   #define  MIL_INT64_MAX              9223372036854775807LL
+   #define  MIL_INT64_MIN              (-MIL_INT64_MAX - 1LL) // Using -9223372036854775808LL directly causes weird warnings.
+   #define  MIL_UINT64_MIN_DBL         0ULL                    //Min precise value in 64-bit floating point.
+   #define  MIL_UINT64_MAX_DBL         0xFFFFFFFFFFFFF800ULL   //Max precise value in 64-bit floating point.
+   #define  MIL_INT64_MIN_DBL          (-9223372036854775807LL - 1LL)  //Min precise value in 64-bit floating point.
+   #define  MIL_INT64_MAX_DBL          0x7FFFFFFFFFFFFC00LL    //Max precise value in 64-bit floating point.
+   #define  MIL_UINT64_MIN_EXACT_DBL   0x0ULL                        //Min precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_UINT64_MAX_EXACT_DBL   0x001FFFFFFFFFFFFFULL         //Max precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_INT64_MIN_EXACT_DBL    (-0x001FFFFFFFFFFFFFLL - 1LL) //Min precise value in 64-bit floating point that garantees the precision of every value in the range.                    
+   #define  MIL_INT64_MAX_EXACT_DBL    0x001FFFFFFFFFFFFFLL          //Max precise value in 64-bit floating point that garantees the precision of every value in the range.   
+
+   typedef                double       MIL_DOUBLE;
+   typedef                float        MIL_FLOAT;
+   typedef                char         MIL_INT8;
+   typedef const          char         MIL_CINT8;
+   typedef       unsigned char         MIL_UINT8;
+   typedef const unsigned char         MIL_CUINT8;
+   typedef                short        MIL_INT16;
+   typedef const          short        MIL_CINT16;
+   typedef       unsigned short        MIL_UINT16;
+   typedef const unsigned short        MIL_CUINT16;
+   typedef MIL_INT32                   MIL_BOOL;
+   typedef const MIL_INT32             MIL_CBOOL;
+
+   #define  MIL_UINT8_MIN              0UL
+   #define  MIL_UINT8_MAX              255UL
+   #define  MIL_INT8_MIN               -128L
+   #define  MIL_INT8_MAX               127L
+   #define  MIL_UINT16_MIN             0UL
+   #define  MIL_UINT16_MAX             65535UL
+   #define  MIL_INT16_MIN              -32768L
+   #define  MIL_INT16_MAX              32767L
+   #define  MIL_DOUBLE_MIN             DBL_MIN
+   #define  MIL_DOUBLE_MAX             DBL_MAX
+   #define  MIL_FLOAT_MIN              FLT_MIN
+   #define  MIL_FLOAT_MAX              FLT_MAX
+   #define  MIL_BOOL_MIN               0UL
+   #define  MIL_BOOL_MAX               1UL
+
+   typedef       unsigned short        MIL_WCHAR;
+
+#else
+   #error Operating system not supported in Milos.h!
+#endif
+
+typedef MIL_UINT64               MIL_DATA_PTR;
+
+typedef MIL_DATA_PTR             MIL_PHYS_DATA_PTR;
+typedef void*                    MIL_HOST_DATA_PTR;
+typedef const void*              MIL_CONST_HOST_DATA_PTR;
+
+typedef MIL_UINT                 MIL_ADDR;   // this type is used to cast a pointer to an integer type for arithmetic conversion
+                                             // for example void *NewPtr = (void*)((MIL_ADDR)OldPtr + Offset);
+
+typedef unsigned char            MIL_BYTE;
+
+
+///////////////////////////////////////////////////////////////////////////
+// Data pointer macro definitions                                        //
+///////////////////////////////////////////////////////////////////////////
+#define M_INT_DATA_PTR_SIZE   MIL_UINT64
+
+#if M_MIL_USE_64BIT
+#define M_CAST_MIL_HOST_PTR_TO_MIL_DATA_PTR(PTR)   ((MIL_DATA_PTR)(PTR))
+#define M_CAST_MIL_DATA_PTR_TO_MIL_HOST_PTR(PTR)   ((MIL_HOST_DATA_PTR)(PTR))
+
+#define M_CAST_MIL_HOST_PTR_TO_MIL_DATA_PTR_CONST(PTR) ((MIL_CONST_DATA_PTR)(PTR))
+#define M_CAST_MIL_DATA_PTR_TO_MIL_HOST_PTR_CONST(PTR) ((MIL_CONST_HOST_DATA_PTR)(PTR))
+
+#else
+#define M_CAST_MIL_HOST_PTR_TO_MIL_DATA_PTR(PTR)     ((MIL_ADDR)(PTR))
+#define M_CAST_MIL_DATA_PTR_TO_MIL_HOST_PTR(PTR)     ((MIL_HOST_DATA_PTR)((MIL_ADDR)(PTR)))
+
+#define M_CAST_MIL_HOST_PTR_TO_MIL_DATA_PTR_CONST(PTR)     ((MIL_CONST_DATA_PTR)(PTR))
+#define M_CAST_MIL_DATA_PTR_TO_MIL_HOST_PTR_CONST(PTR)     ((MIL_CONST_HOST_DATA_PTR)((MIL_ADDR)(PTR)))
+#endif
+
+#define M_CAST_MIL_PHYS_PTR_TO_MIL_DATA_PTR(PTR)  (PTR)
+#define M_CAST_MIL_DATA_PTR_TO_MIL_PHYS_PTR(PTR)  (PTR)
+
+#define M_IS_PTR_OK_FOR_PLATFORM(X) ((sizeof(X) == 4) || (sizeof(X) == sizeof(void*)) || ((((MIL_INT64)X)&MAKE_INT64(0xFFFFFFFF00000000))==0))
+
+typedef    MIL_UINT64 MIL_ADDRESS64;
+
+#if defined(M_MIL_USE_INT64_ID) && M_MIL_USE_INT64_ID
+   #define M_MILID_TO_DOUBLE(X) (MIL_DOUBLE)(X)
+   #define M_MDID_TO_DOUBLE(X)  (MIL_DOUBLE)(X)
+#else
+   #define M_MILID_TO_DOUBLE(X) X
+   #define M_MDID_TO_DOUBLE(X)  X
+#endif
+
+
+/***************************/
+/* STRING RELATED DEFINES  */
+/***************************/
+#if M_MIL_UNICODE_API
+   #define MIL_TEXT(quote)        L##quote
+   typedef wchar_t                MIL_TEXT_CHAR;
+   #define  MIL_TEXT_CHAR_MIN     MIL_UINT16_MIN;
+   #define  MIL_TEXT_CHAR_MAX     MIL_UINT16_MAX;
+#elif M_MIL_USE_WINDOWS || M_MIL_USE_LINUX
+   #define MIL_TEXT(quote)        quote
+   typedef char                   MIL_TEXT_CHAR;
+   #define  MIL_TEXT_CHAR_MIN     MIL_UINT8_MIN;
+   #define  MIL_TEXT_CHAR_MAX     MIL_UINT8_MAX;
+#else
+   #error Operating system not supported in Milos.h!
+#endif
+
+#define MT                          MIL_TEXT
+#if defined(OldDefinesSupport) && OldDefinesSupport 
+   MIL_DEPRECATED(MT, 1000)      //Please use MIL_TEXT()
+#endif
+   
+#define MIL_FUNC_NAME(Func)    Func
+typedef const char*            MIL_FUNC_NAME_PTR;  // In Windows (not CE), the GetProcAddress function is not Unicode compliant
+
+typedef MIL_TEXT_CHAR*         MIL_TEXT_PTR;
+typedef const MIL_TEXT_CHAR*   MIL_CONST_TEXT_PTR;
+
+typedef char*                  MIL_TEXTA_PTR;
+typedef const char*            MIL_CONST_TEXTA_PTR;
+#if M_MIL_USE_UNICODE
+typedef wchar_t*               MIL_TEXTW_PTR;
+typedef const wchar_t*         MIL_CONST_TEXTW_PTR;
+#endif
+
+
+
+/***************************************/
+/* OLD DEFINES THAT SHOULD NOT BE USED */
+/***************************************/
+#if defined(OldDefinesSupport) && OldDefinesSupport
+
+#define MIL_INTADDR  MIL_UINT             // Please, use MIL_UINT
+MIL_DEPRECATED(MIL_INTADDR, 1000)
+#define MIL_UINTADDR MIL_UINT             // Please, use MIL_UINT
+MIL_DEPRECATED(MIL_UINTADDR, 1000)
+#define MILTCHAR     MIL_TEXT_CHAR        // Please, use MIL_TEXT_CHAR
+MIL_DEPRECATED(MILTCHAR, 1000)
+#define LPMILSTR     MIL_TEXT_PTR         // Please, use MIL_TEXT_PTR
+//MIL_DEPRECATED(LPMILSTR)
+#define LPCMILSTR    MIL_CONST_TEXT_PTR   // Please, use MIL_CONST_TEXT_PTR
+//MIL_DEPRECATED(LPCMILSTR)
+#define BUFATTRTYPE  MIL_INT64            // Please, use MIL_INT64
+MIL_DEPRECATED(BUFATTRTYPE, 1000)
+
+#endif   // defined(OldDefinesSupport) && OldDefinesSupport
+
+
+/************************************************************************/
+/* Define UNREFERENCED_PARAMETER                                        */
+/************************************************************************/
+#ifndef UNREFERENCED_PARAMETER
+#if M_MIL_USE_LINUX
+#define UNREFERENCED_PARAMETER(P) (void)(P)
+#else
+#define UNREFERENCED_PARAMETER(P) (P)
+#endif
+#endif
+
+#if (defined(M_MIL_DEBUG) && M_MIL_DEBUG) || defined(_DEBUG)
+#define PARAM_DEBUG_ONLY(X)
+#else
+#define PARAM_DEBUG_ONLY   UNREFERENCED_PARAMETER
+#endif
+
+/************************************************************************/
+/* HANDLES RELATED DEFINITIONS                                          */
+/************************************************************************/
+#if   M_MIL_USE_WINDOWS
+#if (defined(_INC_WINDOWS) || defined(_WINDOWS_) || defined(__WINDOWS_H) || defined(__WINDOWS__))
+typedef HWND                   MIL_WINDOW_HANDLE;
+typedef HDC                    MIL_DC_HANDLE;
+#else
+typedef void*                   MIL_WINDOW_HANDLE;
+typedef void*                   MIL_DC_HANDLE;
+#endif
+#else
+// Window is typedef-ed to XID, which is typedef-ed to
+// unsigned long
+typedef unsigned long          MIL_WINDOW_HANDLE;
+typedef MIL_INT                MIL_DC_HANDLE;
+#endif
+
+
+/*************************************************************************/
+/** Include string.h                                                     */
+/*************************************************************************/
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+#include <string.h>
+#endif
+
+// Regular string functions' definition
+#if M_MIL_UNICODE_API
+#if (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE) 
+   #define     MOs_ltoa          _ltow
+   #define     MOs_itoa          _itow
+   #define     MOs_ultoa         _ultow
+   #define     MOs_atoi          _wtoi
+   #define     MOs_atol          _wtol
+   #define     MOs_ANSIatol      atol
+   #define     MOs_atof          _wtof
+   #define     MOs_strtol        wcstol
+   #define     MOs_strtoul       wcstoul
+   #define     MOs_ANSIstrtoul   strtoul
+   #define     MOs_strtoui64     _wcstoui64
+   #define     MOs_strcpy        wcscpy
+   #define     MOs_ANSIstrcpy    strcpy
+   #define     MOs_strncpy       wcsncpy
+   #define     MOs_ANSIstrncpy   strncpy
+   #define     MOs_strcmp        wcscmp
+   #define     MOs_ANSIstrcmp    strcmp
+   #define     MOs_stricmp       _wcsicmp
+   #define     MOs_ANSIstricmp   _stricmp
+   #define     MOs_strncmp       wcsncmp
+   #define     MOs_ANSIstrncmp   strncmp
+   #define     MOs_ANSIstrnicmp  _strnicmp
+   #define     MOs_strcat        wcscat
+   #define     MOs_ANSIstrcat    strcat
+   #define     MOs_strncat       wcsncat
+   #define     MOs_strchr        wcschr
+   #define     MOs_strrchr       wcsrchr
+   #define     MOs_ANSIstrchr    strchr
+   #define     MOs_isprint       iswprint
+   #define     MOs_ANSIisprint   isprint
+   #define     MOs_isspace       iswspace
+   #define     MOs_ANSIisspace   isspace
+   #define     MOs_strlen        wcslen
+   #define     MOs_strnlen       wcsnlen
+   #define     MOs_ANSIstrlen    strlen
+   #define     MOs_ANSIstrnlen   strnlen
+   #define     MOs_sprintf       swprintf
+   #define     MOs_ANSIsprintf   sprintf
+   #define     MOs_vsprintf      vswprintf
+   #define     MOs_sscanf        swscanf
+   #define     MOs_ANSIsscanf    sscanf
+   #define     MOs_fscanf        fwscanf
+   #define     MOs_fprintf       fwprintf
+   #define     MOs_ANSIfprintf   fprintf
+   #define     MOs_ANSIvfprintf  vfprintf
+   #define     MOs_ANSIvprintf   vprintf
+   #define     MOs_vfprintf      vfwprintf
+   #define     MOs_strtod        wcstod
+   #define     MOs_strupr        _wcsupr
+   #define     MOs_getchar       getwchar
+   #define     MOs_ctime         _wctime
+   #define     MOs_ftime         _ftime_s
+   #define     MOs_localtime     localtime
+   #define     MOs_strlwr        _wcslwr
+   #define     MOs_system        _wsystem
+#if M_MIL_USE_RT
+   #define     MOs_printf        RTXMonitor::GetInstance()->PrintMessage
+#else
+   #define     MOs_printf        wprintf
+#endif
+   #define     MOs_scprintf      _scwprintf
+   #define     MOs_vprintf       vwprintf
+// #define     MOs_vscanf        vwscanf  NOT SUPPORTED ON ALL PLATFORMS
+   #define     MOs_fputs         fputws
+   #define     MOs_ANSIfputs     fputs
+   #define     MOs_fputc         fputc
+   #define     MOs_strtok        wcstok
+   #define     MOs_ANSIstrtok    strtok
+   #define     MOs_ungetc        ungetwc
+   #define     MOs_tolower       towlower
+   #define     MOs_ANSItolower   tolower
+   #define     MOs_toupper       towupper
+   #define     MOs_strspn        wcsspn
+   #define     MOs_strcspn       wcscspn
+   #define     MOs_ANSIstrcspn   strcspn
+   #define     MOs_asctime       _wasctime
+   #define     MOs_ANSIasctime   asctime
+   #define     MOs_strstr        wcsstr
+   #define     MOs_ANSIstrstr    strstr
+   #define     MOs_splitpath     _wsplitpath
+   #define     MOs_makepath      _wmakepath
+   #define     MOs_strnset       _wcsnset
+   #define     MOs_strpbrk       wcspbrk
+
+#if M_MIL_USING_SAFE_CRT
+   #define     MOs_sprintf_s              swprintf_s
+
+   #define     MOs_ANSIsprintf_s          sprintf_s
+
+   #define     MOs_printf_s               wprintf_s
+   #define     MOs_scanf_s                wscanf_s
+   #define     MOs_sscanf_s               swscanf_s
+   #define     MOs_ANSIsscanf_s           sscanf_s
+   #define     MOs_fscanf_s               fwscanf_s
+   #define     MOs_strncpy_s              wcsncpy_s
+   #define     MOs_ANSIstrncpy_s          strncpy_s
+#if !M_MIL_USE_RT
+   #define     MOs_asctime_s              _wasctime_s
+   #define     MOs_ANSIasctime_s          asctime_s
+#endif
+   #define     MOs_strcpy_s               wcscpy_s
+   #define     MOs_ANSIstrcpy_s           strcpy_s
+#if M_MIL_USE_RT
+// there is no environment variable under RTX, so let's return NULL. Also _wgetenv does not exist
+#ifdef __cplusplus
+   inline void* MOs_getenv_s(size_t * /*pReturnValue*/, MIL_TEXT_PTR /*buffer*/, size_t /*numberOfElements*/, MIL_CONST_TEXT_PTR /*varname*/ )
+      {
+      return NULL;
+      }
+#else
+#define  MOs_getenv_s(A, B, C, D)      NULL
+#endif
+
+#else
+#define     MOs_getenv_s               _wgetenv_s
+#endif
+   #define     MOs_ANSIgetenv_s           getenv_s
+   #define     MOs_strcat_s               wcscat_s
+   #define     MOs_ANSIstrcat_s           strcat_s
+   
+   #include <share.h>
+   #define     MOs_fopen_s         _wfopen_s
+   #define     MOs_ANSIfopen_s     fopen_s
+   #define     MOs_strncat_s              wcsncat_s
+   #define     MOs_fcvt_s                 _fcvt_s
+   #define     MOs_strtok_s               wcstok_s
+   #define     MOs_ANSIstrtok_s           strtok_s
+   #define     MOs_vsprintf_s             vswprintf_s
+   #define     MOs_ANSIvsprintf_s         vsprintf_s
+   #define     MOs_splitpath_s            _wsplitpath_s
+   #define     MOs_makepath_s             _wmakepath_s
+   #define     MOs_strnset_s              _wcsnset_s
+   #define     MOs_strlwr_s               _wcslwr_s
+   #define     MOs_strupr_s               _wcsupr_s
+   #define     MOs_strnicmp               _wcsnicmp
+   #define     MOs_ctime_s                _wctime_s
+   #define     MOs_ftime_s                _ftime_s
+   #define     MOs_localtime_s            localtime_s
+   #define     MOs_mbstowcs_s             mbstowcs_s
+   #define     MOs_wcstombs_s             wcstombs_s
+#else    // Safe version of CRT map to unsafe version
+   #define     MOs_sprintf_s              _snwprintf
+   
+   #define     MOs_ANSIsprintf_s          _snprintf
+
+   #define     MOs_printf_s                        wprintf
+   #define     MOs_sscanf_s                        swscanf
+   #define     MOs_ANSIsscanf_s                    sscanf
+   #define     MOs_fscanf_s                        fwscanf
+   #define     MOs_strncpy_s(A, B, C, D)           wcsncpy(A, C, D)
+   #define     MOs_ANSIstrncpy_s(A, B, C, D)       strncpy(A, C, D)
+   #define     MOs_asctime_s                       _wasctime
+   #define     MOs_ANSIasctime_s                   asctime
+   #define     MOs_strcpy_s(A, B, C)               wcscpy(A, C)
+   #define     MOs_ANSIstrcpy_s(A, B, C)           strcpy(A, C)
+   #define     MOs_getenv_s(A, B, C, D)            (MOs_getenv(D)) ? wcscpy(B, MOs_getenv(D)) : wcscpy(B, MT("\0"))
+   #define     MOs_ANSIgetenv_s(A, B, C, D)        (MOs_ANSIgetenv(D)) ? strcpy(B, MOs_ANSIgetenv(D)) : strcpy(B, "\0")
+   #define     MOs_strcat_s(A, B, C)               wcscat(A, C)
+   #define     MOs_ANSIstrcat_s(A, B, C)           strcat(A, C)
+   #define     MOs_fopen_s(A,B,C)               (((*(A) =_wfsopen(B,C,_SH_DENYRW)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A,B,C)           (((*(A) =_fsopen(B,C,_SH_DENYRW)) != NULL) ? (0) : (1))
+   #define     MOs_strncat_s(A, B, C, D)           wcsncat(A, C, D)
+   #define     MOs_strtok_s(A, B, C)               wcstok(A, (C, B))
+   #define     MOs_ANSIstrtok_s(A, B, C)           strtok(A, (C, B))
+   #define     MOs_vsprintf_s(A, B, C, D)          vswprintf(A, C, D)
+   #define     MOs_ANSIvsprintf_s(A, B, C, D)      vsprintf(A, C, D)
+   #define     MOs_splitpath_s(A,B,C,D,E,F,G,H,I)  _wsplitpath(A,B,D,F,H)
+   #define     MOs_makepath_s(A,B,C,D,E,F)         _wmakepath(A,C,D,E,F)
+   #define     MOs_strnset_s(A,B,C,D)              _wcsnset(A,C,D)
+   #define     MOs_strupr_s(A,B)                   _wcsupr(A)
+   #define     MOs_strnicmp                        wcsnicmp
+   #define     MOs_ctime_s(A,B,C)                  wcscpy(A, _wctime(C))
+   #define     MOs_ftime_s                         _ftime
+   #define     MOs_localtime_s(A, B)               A = localtime(B)
+   #if M_MIL_USE_WINDOWS
+      #define     MOs_strlwr_s(A, B)                  _wcslwr(A)
+      #define     MOs_strupr_s(A, B)                  _wcsupr(A)
+   #endif
+   #define     MOs_mbstowcs_s(A,B,C,D,E)              (((*(A) =mbstowcs(B,D,E)) != NULL) ? (0) : (1))
+   #define     MOs_wcstombs_s(A,B,C,D,E)              (((*(A) =wcstombs(B,D,E)) != NULL) ? (0) : (1))
+#endif
+
+   #define MOs_strdup _wcsdup
+
+   #if (M_MIL_USE_UNICODE)
+      #if (M_MIL_USING_SAFE_CRT)
+         // Functions used by the Mosxxx functions (which are visible by MIL clients) must support both charset API's
+         #define     MOs_strcpy_sA              strcpy_s
+         #define     MOs_vsprintf_sA            vsprintf_s
+         #define     MOs_strcat_sA              strcat_s
+         #define     MOs_strlwr_sA              _strlwr_s
+         #define     MOs_strupr_sA              _strupr_s
+         #define     MOs_unlink                 _wunlink
+
+      #else
+         #define     MOs_strlwr_sA           strlwr
+         #define     MOs_strupr_sA           strupr
+         #define     MOs_strcpy_sA(A, B, C)      strcpy(A, C)
+         #define     MOs_vsprintf_sA(A, B, C, D) vsprintf(A, C, D)
+         #define     MOs_strcat_sA(A, B, C)      strcat(A, C)
+         #define     MOs_strlwrA                strlwr
+         #define     MOs_struprA                strupr
+         #define     MOs_strcpyA                strcpy
+         #define     MOs_vsprintfA              vsprintf
+         #define     MOs_strcatA                strcat
+         #define     MOs_strlwrA                strlwr
+         #define     MOs_struprA                strupr
+         #define     MOs_unlink                 wunlink
+      #endif
+         #define     MOs_vprintfA               vprintf
+         #define     MOs_strcmpA                strcmp
+   #endif
+
+#endif // !M_WINDOWS_NT_KERNEL_MODE
+#elif (M_MIL_USE_WINDOWS)
+#if !(defined(M_WINDOWS_NT_KERNEL_MODE) && M_WINDOWS_NT_KERNEL_MODE)
+   #define     MOs_strcat        strcat
+   #define     MOs_ANSIstrcat    strcat
+   #define     MOs_atoi          atoi
+   #define     MOs_atol          atol
+   #define     MOs_ANSIatol      atol
+   #define     MOs_atof          atof
+   #define     MOs_strtol        strtol
+   #define     MOs_strtoul       strtoul
+   #define     MOs_ANSIstrtoul   strtoul
+   #define     MOs_strtoui64     _strtoui64
+   #define     MOs_strcpy        strcpy
+   #define     MOs_ANSIstrcpy    strcpy
+   #define     MOs_strncpy       strncpy
+   #define     MOs_ANSIstrncpy   strncpy
+   #define     MOs_strcmp        strcmp
+   #define     MOs_ANSIstrcmp    strcmp
+   #define     MOs_strncmp       strncmp
+   #define     MOs_ANSIstrncmp   strncmp
+   #define     MOs_ANSIstrnicmp  _strnicmp
+   #define     MOs_strncat       strncat
+   #define     MOs_strchr        strchr
+   #define     MOs_strrchr       strrchr
+   #define     MOs_ANSIstrchr    strchr
+   #define     MOs_sprintf       sprintf
+   #define     MOs_ANSIsprintf   sprintf
+   #define     MOs_vsprintf      vsprintf
+   #define     MOs_strstr        strstr
+   #define     MOs_ANSIstrstr    strstr
+   #define     MOs_sscanf        sscanf
+   #define     MOs_ANSIsscanf    sscanf
+   #define     MOs_fscanf        fscanf
+   #define     MOs_strtod        strtod
+   #define     MOs_strlwr        strlwr
+   #define     MOs_system        system
+   #define     MOs_strtok        strtok
+   #define     MOs_ANSIstrtok    strtok
+   #define     MOs_ungetc        ungetc
+   #define     MOs_tolower       tolower
+   #define     MOs_ANSItolower   tolower
+   #define     MOs_tcscpy        _tcscpy
+   #define     MOs_tcslen        _tcslen
+   #define     MOs_tcsncpy       _tcsncpy
+   #define     MOs_toupper       toupper
+   #define     MOs_strspn        strspn
+   #define     MOs_strcspn       strcspn
+   #define     MOs_ANSIstrcspn   strcspn
+   #define     MOs_asctime       asctime
+   #define     MOs_ANSIasctime   asctime
+   #define     MOs_getchar       getchar
+   #define     MOs_ctime         ctime
+   #define     MOs_ftime         _ftime
+   #define     MOs_localtime     localtime
+   #define     MOs_splitpath     _splitpath
+   #define     MOs_makepath      _makepath
+   #define     MOs_strnset       _strnset
+   #define     MOs_strpbrk       strpbrk
+   #define     MOs_isprint       isprint
+   #define     MOs_ANSIisprint   isprint
+   #define     MOs_isspace       isspace
+   #define     MOs_ANSIisspace   isspace
+
+#if M_MIL_USING_SAFE_CRT
+   #define     MOs_sprintf_s              sprintf_s
+   
+   #define     MOs_ANSIsprintf_s          sprintf_s
+
+   #define     MOs_printf_s               printf_s
+   #define     MOs_scanf_s                scanf_s
+   #define     MOs_sscanf_s               sscanf_s
+   #define     MOs_ANSIsscanf_s           sscanf_s
+   #define     MOs_fscanf_s               fscanf_s
+   #define     MOs_strncpy_s              strncpy_s
+   #define     MOs_ANSIstrncpy_s          strncpy_s
+   #define     MOs_asctime_s              asctime_s
+   #define     MOs_ANSIasctime_s          asctime_s
+   #define     MOs_ctime_s                ctime_s
+   #define     MOs_ftime_s                _ftime_s
+   #define     MOs_strcpy_s               strcpy_s
+   #define     MOs_ANSIstrcpy_s           strcpy_s
+   #define     MOs_getenv_s               getenv_s
+   #define     MOs_ANSIgetenv_s           getenv_s
+   #define     MOs_strcat_s               strcat_s
+   #define     MOs_ANSIstrcat_s           strcat_s
+   #define     MOs_fopen_s(A,B,C)         (((*(A) = _fsopen(B,C,_SH_DENYNO)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A,B,C)     (((*(A) = _fsopen(B,C,_SH_DENYNO)) != NULL) ? (0) : (1))
+   #define     MOs_strncat_s              strncat_s
+   #define     MOs_fcvt_s                 _fcvt_s
+   #define     MOs_strtok_s               strtok_s
+   #define     MOs_ANSIstrtok_s           strtok_s
+   #define     MOs_vsprintf_s             vsprintf_s
+   #define     MOs_ANSIvsprintf_s         vsprintf_s
+   #define     MOs_splitpath_s            _splitpath_s
+   #define     MOs_makepath_s             _makepath_s
+   #define     MOs_strnset_s              _strnset_s
+   #define     MOs_strlwr_s               _strlwr_s
+   #define     MOs_strupr_s               _strupr_s
+   #define     MOs_stricmp                _stricmp
+   #define     MOs_ANSIstricmp            _stricmp
+   #define     MOs_strnicmp               _strnicmp
+   #define     MOs_unlink                 _unlink
+   #define     MOs_localtime_s            localtime_s
+   #define     MOs_mbstowcs_s             mbstowcs_s
+   #define     MOs_wcstombs_s             wcstombs_s
+#else
+   #define     MOs_sprintf_s              _snprintf
+   
+   #define     MOs_ANSIsprintf_s          _snprintf
+
+   #define     MOs_printf_s                        printf
+   #define     MOs_sscanf_s                        sscanf
+   #define     MOs_ANSIsscanf_s                    sscanf
+   #define     MOs_fscanf_s                        fscanf
+   #define     MOs_strncpy_s(A, B, C, D)           strncpy(A, C, D)
+   #define     MOs_ANSIstrncpy_s(A, B, C, D)       strncpy(A, C, D)
+   #define     MOs_asctime_s                       asctime_s
+   #define     MOs_ANSIasctime_s                   asctime_s
+   #define     MOs_ctime_s(A,B,C)                  strcpy((A), ctime(C))
+   #define     MOs_ftime_s                         _ftime
+   #define     MOs_strcpy_s(A, B, C)               strcpy(A, C)
+   #define     MOs_ANSIstrcpy_s(A, B, C)           strcpy(A, C)
+   #define     MOs_getenv_s(A, B, C, D)           (getenv(D)) ? strcpy(B, getenv(D)) : strcpy(B, "\0")
+   #define     MOs_ANSIgetenv_s(A, B, C, D)       (getenv(D)) ? strcpy(B, getenv(D)) : strcpy(B, "\0")
+   #define     MOs_strcat_s(A, B, C)               strcat(A, C)
+   #define     MOs_ANSIstrcat_s(A, B, C)           strcat(A, C)
+   #define     MOs_fopen_s(A, B, C)                (((*(A)=fopen(B, C)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A, B, C)            (((*(A)=fopen(B, C)) != NULL) ? (0) : (1))
+   #define     MOs_strncat_s(A, B, C, D)           strncat(A, C, D)
+   #define     MOs_fcvt_s                          _fcvt
+   #define     MOs_strtok_s(A, B, C)               strtok(A, (C, B))
+   #define     MOs_ANSIstrtok_s(A, B, C)           strtok(A, (C, B))
+   #define     MOs_vsprintf_s(A, B, C, D)          vsprintf(A, C, D)
+   #define     MOs_ANSIvsprintf_s(A, B, C, D)      vsprintf(A, C, D)
+   #define     MOs_splitpath_s(A,B,C,D,E,F,G,H,I)  _splitpath(A,B,D,F,H)
+   #define     MOs_makepath_s(A,B,C,D,E,F)         _makepath(A,C,D,E,F)
+   #define     MOs_strnset_s(A,B,C,D)              _strnset(A,C,D)
+   #define     MOs_stricmp                         stricmp
+   #define     MOs_ANSIstricmp                     stricmp
+   #define     MOs_unlink                          unlink
+   #define     MOs_localtime_s(A, B)               A = localtime(B)
+
+   #define     MOs_strnicmp                        strnicmp
+
+   #if M_MIL_USE_WINDOWS
+      #define     MOs_strlwr_s(A, B)                  _strlwr(A)
+      #define     MOs_strupr_s(A, B)                  _strupr(A)
+   #endif
+   #define     MOs_mbstowcs_s(A,B,C,D,E)              (((*(A) =mbstowcs(B,D,E)) != NULL) ? (0) : (1))
+   #define     MOs_wcstombs_s(A,B,C,D,E)              (((*(A) =wcstombs(B,D,E)) != NULL) ? (0) : (1))
+#endif
+
+   #define     MOs_strlen   strlen
+   #define     MOs_ANSIstrlen    strlen //size_t is an __int64 under Win64,
+   #define     MOs_ltoa          _ltoa
+   #define     MOs_itoa          _itoa
+   #define     MOs_ultoa         _ultoa
+   #define     MOs_fprintf       fprintf
+   #define     MOs_ANSIfprintf   fprintf
+   #define     MOs_ANSIvfprintf  vfprintf
+   #define     MOs_vfprintf      vfprintf
+   #define     MOs_printf        printf
+   #define     MOs_scprintf      _scprintf
+   #define     MOs_vprintf       vprintf
+   #define     MOs_ANSIvprintf   vprintf
+//      #define     MOs_vscanf      vscanf NOT SUPPORTED ON ALL PLATFORMS
+   #if M_MIL_USING_SAFE_CRT
+      #define     MOs_printf_s                        printf_s
+   #else
+      #define     MOs_printf_s                        printf
+   #endif
+   #if M_MIL_USE_WINDOWS
+      #define     MOs_strdup   _strdup
+      #define     MOs_strupr   strupr
+   #else
+      #define     MOs_strdup   strdup
+      #define     MOs_strupr(Str) Str
+   #endif
+
+#endif // !M_WINDOWS_NT_KERNEL_MODE
+#elif M_MIL_USE_LINUX
+#if !M_LINUX_KERNEL
+   // forward declarations
+   MIL_TEXT_PTR strupr( MIL_TEXT_PTR String1 );
+   #ifdef __cplusplus
+   extern "C"
+   {
+   #endif
+   MIL_TEXT_PTR MilLinstrlwr(MIL_TEXT_PTR String1);
+   #ifdef __cplusplus
+   }
+   #endif
+
+//   #define     MOs_ltoa        Not implemented under Linux
+//   #define     MOs_itoa        Not implemented under Linux
+//   #define     MOs_ultoa       Not implemented under Linux
+   #define     MOs_atoi          atoi
+   #define     MOs_atol          atol
+   #define     MOs_ANSIatol      atol
+   #define     MOs_atof          atof
+   #define     MOs_strtol        strtol
+   #define     MOs_strtoul       strtoul
+   #define     MOs_ANSIstrtoul   strtoul
+   #define     MOs_strtoui64     strtoull
+   #define     MOs_strcpy        strcpy
+   #define     MOs_ANSIstrcpy    strcpy
+   #define     MOs_strncpy       strncpy
+   #define     MOs_ANSIstrncpy   strncpy
+   #define     MOs_strcmp        strcmp
+   #define     MOs_ANSIstrcmp    strcmp
+   #define     MOs_stricmp       strcasecmp
+   #define     MOs_ANSIstricmp   strcasecmp
+   #define     MOs_strncmp       strncmp
+   #define     MOs_ANSIstrncmp   strncmp
+   #define     MOs_strnicmp      strncasecmp
+   #define     MOs_ANSIstrnicmp  strncasecmp
+   #define     MOs_strcat        strcat
+   #define     MOs_ANSIstrcat    strcat
+   #define     MOs_strncat       strncat
+   #define     MOs_strchr        strchr
+   #define     MOs_strrchr       strrchr
+   #define     MOs_ANSIstrchr    strchr
+   #define     MOs_isprint       isprint
+   #define     MOs_ANSIisprint   isprint
+   #define     MOs_isspace       isspace
+   #define     MOs_ANSIisspace   isspace
+   #define     MOs_strlen        strlen
+   #define     MOs_ANSIstrlen    strlen
+   #define     MOs_strnlen        strnlen
+   #define     MOs_ANSIstrnlen    strnlen
+   #define     MOs_fprintf       fprintf
+   #define     MOs_ANSIfprintf   fprintf
+   #define     MOs_ANSIvfprintf  vfprintf
+   #define     MOs_vfprintf      vfprintf
+   #define     MOs_printf        printf
+   #define     MOs_printf_s      printf
+   #define     MOs_vprintf       vprintf
+   #define     MOs_ANSIvprintf   vprintf
+//   #define     MOs_vscanf  vscanf NOT SUPPORTED ON ALL PLATFORMS
+   #define     MOs_sprintf       sprintf
+   #define     MOs_ANSIsprintf   sprintf
+   #define     MOs_vsprintf      vsprintf
+   #define     MOs_strstr        strstr
+   #define     MOs_ANSIstrstr    strstr
+   #define     MOs_sscanf        sscanf
+   #define     MOs_scanf_s       scanf
+   #define     MOs_ANSIsscanf    sscanf
+   #define     MOs_fscanf        fscanf
+   #define     MOs_strtod        strtod
+   #define     MOs_strupr        strupr
+   #define     MOs_strupr_s(A,B) strupr(A)
+   #define     MOs_strdup        strdup
+   #define     MOs_strlwr        MilLinstrlwr
+   #define     MOs_system        system
+   #define     MOs_strlwr_s(A,B) MilLinstrlwr(A)
+   #define     MOs_strtok        strtok
+   #define     MOs_ANSIstrtok    strtok
+   #define     MOs_ungetc        ungetc
+   #define     MOs_tolower       tolower
+   #define     MOs_ANSItolower   tolower
+   #define     MOs_tcscpy
+   #define     MOs_tcslen
+   #define     MOs_tcsncpy
+   #define     MOs_toupper       toupper
+   #define     MOs_strspn        strspn
+   #define     MOs_strcspn       strcspn
+   #define     MOs_ANSIstrcspn   strcspn
+   #define     MOs_asctime       asctime
+   #define     MOs_asctime_s(A,B,C) strcpy((A), asctime(C))
+   #define     MOs_ANSIasctime   asctime
+   #define     MOs_getchar       getchar
+   #define     MOs_ctime         ctime
+   #define     MOs_ftime         ftime
+   #define     MOs_ctime_s(A,B,C) strcpy((A), ctime(C))
+   #define     MOs_localtime     localtime
+   #define     MOs_localtime_s(A,B) localtime_r(B, A)
+//   #define     MOs_sscanf_s      Not implemented under Linux
+//   #define     MOs_ANSIsscanf_s  Not implemented under Linux
+//   #define     MOs_fscanf_s      Not implemented under Linux
+//   #define     MOs_splitpath     Not implemented under Linux
+//   #define     MOs_makepath      Not implemented under Linux
+//   #define     MOs_strnset       Not implemented under Linux
+   #define     MOs_strpbrk       strpbrk
+   #define     MOs_sprintf_s                       snprintf
+   
+   #define     MOs_ANSIsprintf_s                   snprintf
+  #if defined(_LARGE_FILES) || defined(_LARGEFILE64_SOURCE)
+   #define     MOs_fopen_s(A, B, C)                (((*(A)=fopen64(B, C)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A, B, C)            (((*(A)=fopen64(B, C)) != NULL) ? (0) : (1))
+  #else
+   #define     MOs_fopen_s(A, B, C)                (((*(A)=fopen(B, C)) != NULL) ? (0) : (1))
+   #define     MOs_ANSIfopen_s(A, B, C)            (((*(A)=fopen(B, C)) != NULL) ? (0) : (1))
+  #endif
+   #define     MOs_strcpy_s(A, B, C)               strncpy(A, C, B)
+   #define     MOs_ANSIstrcpy_s(A, B, C)           strncpy(A, C, B)
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   #define     MOs_getenv_s(A, B, C, D)                \
+                  do {                                 \
+                     char *tmp = getenv(D);            \
+                     *(A) = (tmp) ? strlen(tmp)+1 : 0; \
+                     if (B && tmp && (*(A) <= C))      \
+                        strcpy(B, tmp);                \
+                  } while(0)
+
+   #define     MOs_ANSIgetenv_s(A, B, C, D)            \
+                  do {                                 \
+                     char *tmp = getenv(D);            \
+                     *(A) = (tmp) ? strlen(tmp)+1 : 0; \
+                     if (B && tmp && (*(A) <= C))      \
+                        strcpy(B, tmp);                \
+                  } while(0)
+
+   #define     MOs_strcat_s(A, B, C)               strncat(A, C, B)
+   #define     MOs_ANSIstrcat_s(A, B, C)           strncat(A, C, B)
+#endif
+   #define     MOs_vsprintf_s(A, B, C, D)          vsnprintf(A, B, C, D)
+   #define     MOs_ANSIvsprintf_s(A, B, C, D)      vsnprintf(A, B, C, D)
+   #define     MOs_strtok_s(A, B, C)               strtok_r(A, B, C)
+   #define     MOs_ANSIstrtok_s(A, B, C)           strtok_r(A, B, C)
+   #define     MOs_unlink                          unlink
+#endif // !M_LINUX_KERNEL
+
+#else
+   #error Operating system not supported in Milos.h!
+#endif
+
+
+/************************************************************************/
+/* FILES RELATED DEFINITIONS                                            */
+/************************************************************************/
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+#include <stdio.h>   /* required for definition of file */
+
+typedef FILE* MIL_FILE;
+#define MIL_EOF      EOF
+#define MIL_STDOUT   ((MIL_FILE)1)
+
+
+#if M_MIL_UNICODE_API
+   #define     MOs_hypot   _hypot
+#if M_MIL_USE_RT
+// there is no environment variable under RTX, so let's return NULL. Also _wgetenv does not exist
+#ifdef __cplusplus
+   inline void* MOs_getenv(MIL_CONST_TEXT_PTR /*Data*/)
+      {
+      return NULL;
+      }
+#else
+#define MOs_getenv(A)      NULL
+#endif
+#else
+
+   #define     MOs_getenv       _wgetenv
+#endif
+   #define     MOs_ANSIgetenv   getenv
+   #define     MOs_chmod     _wchmod
+   #define     MOs_fopen     _wfopen
+   #define     MOs_ANSIfopen fopen
+   #define     MOs_fclose    fclose
+   #define     MOs_fwrite    fwrite
+   #define     MOs_fread     fread
+#if M_MIL_USE_64BIT
+   #define     MOs_fseek    _fseeki64
+#else
+   #define     MOs_fseek    fseek
+#endif
+   #define     MOs_fseek64     _fseeki64
+   #define     MOs_ftell64     _ftelli64
+   #define     MOs_ftell       ftell
+   #define     MOs_feof        feof
+   #define     MOs_ferror      ferror
+   #define     MOs_fflush      fflush
+   #define     MOs_fgetc       fgetc
+   #define     MOs_fgets       fgetws
+   #define     MOs_ANSIfgets   fgets
+   #define     MOs_clearerr    clearerr
+   #define     MOs_remove(n)   (DeleteFile(n) ? 0 : -1)
+   #define     MOs_rename(n,m) (MoveFile(n,m) ? 0 : -1)
+   #define     MOs_copyfile(n,m,b) CopyFile(n,m,b)
+#elif ((M_MIL_USE_WINDOWS) || (!M_MIL_USE_TIFF_OPTIMISATION)) && !M_MIL_USE_LINUX
+#if defined(_MSC_VER)
+   #include <direct.h>         //for _rmdir and _mkdir
+   #include <io.h>             //for _chmod
+#endif
+
+   #define     MOs_chmod       _chmod
+   #define     MOs_fopen       fopen
+   #define     MOs_ANSIfopen   fopen
+   #define     MOs_fclose      fclose
+   #define     MOs_fwrite      fwrite
+   #define     MOs_fread       fread
+#if M_MIL_USE_64BIT
+   #define     MOs_fseek    _fseeki64
+#else
+   #define     MOs_fseek    fseek
+#endif
+   #define     MOs_fseek64     _fseeki64
+   #define     MOs_ftell64     _ftelli64
+   #define     MOs_ftell     ftell
+   #define     MOs_feof      feof
+   #define     MOs_ferror    ferror
+   #define     MOs_fflush    fflush
+   #define     MOs_fgetc     fgetc
+   #define     MOs_fgets     fgets
+   #define     MOs_ANSIfgets fgets
+   #define     MOs_clearerr  clearerr
+   #define     MOs_remove    remove
+   #define     MOs_rename    rename
+   #define     MOs_copyfile  CopyFile
+#if _MSC_VER >= 1400
+   #define     MOs_hypot   _hypot
+#else
+   #define     MOs_hypot   hypot
+#endif
+   #define     MOs_getenv      getenv
+   #define     MOs_ANSIgetenv  getenv
+   #define     MOs_putenv      putenv
+   #define     MOs_fputs       fputs
+   #define     MOs_fputc       fputc
+#elif M_MIL_USE_LINUX
+  #if defined(_LARGE_FILES) || defined(_LARGEFILE64_SOURCE)
+   #define     MOs_fopen        fopen64
+   #define     MOs_ANSIfopen    fopen64
+   #define     MOs_fseek        fseeko64
+   #define     MOs_ftell        ftello64
+  #else
+   #define     MOs_fopen        fopen
+   #define     MOs_ANSIfopen    fopen
+   #define     MOs_fseek        fseek
+   #define     MOs_ftell        ftell
+  #endif
+   #define     MOs_fseek64      fseeko64
+   #define     MOs_ftell64      ftello64
+   #define     MOs_chmod        chmod
+   #define     MOs_fclose       fclose
+   #define     MOs_fwrite       fwrite
+   #define     MOs_fread        fread
+   #define     MOs_feof         feof
+   #define     MOs_ferror       ferror
+   #define     MOs_fflush       fflush
+   #define     MOs_fgetc        fgetc
+   #define     MOs_fgets        fgets
+   #define     MOs_ANSIfgets    fgets
+   #define     MOs_ANSIfputs    fputs
+   #define     MOs_fputs        fputs
+   #define     MOs_clearerr     clearerr
+   #define     MOs_remove       remove
+   #define     MOs_rename       rename
+   #define     MOs_copyfile     LinCopyFile
+   #define     MOs_hypot        hypot
+   #define     MOs_getenv       getenv
+   #define     MOs_ANSIgetenv   getenv
+   #define     MOs_putenv       putenv
+   #define     MOs_fputs        fputs
+   #define     MOs_fputc        fputc
+
+#else
+   #error Operating system not supported in Milos.h!
+#endif
+
+#endif // M_LINUX_KERNEL
+
+
+/************************************************************************/
+/* C++ EXCEPTIONS SUPPORT                                               */
+/************************************************************************/
+   #define MOs_try                        try
+   #define MOs_catch(x)                   catch(x)
+   #define MOs_throw                      throw
+
+// Macro usage are deprecated, please use MosXXX() functions if equivalent exist.
+#if defined(M_MIL_WARN_ON_DEPRECATED_MOS) && M_MIL_WARN_ON_DEPRECATED_MOS
+   MIL_DEPRECATED(MOs_ltoa, 1000)
+   MIL_DEPRECATED(MOs_itoa, 1000)
+   MIL_DEPRECATED(MOs_ultoa, 1000)
+   MIL_DEPRECATED(MOs_atoi, 1000)
+   MIL_DEPRECATED(MOs_atol, 1000)
+   MIL_DEPRECATED(MOs_ANSIatol, 1000)
+   MIL_DEPRECATED(MOs_atof, 1000)
+   MIL_DEPRECATED(MOs_strtol, 1000)
+   MIL_DEPRECATED(MOs_strtoul, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrtoul, 1000)
+   MIL_DEPRECATED(MOs_strtoui64, 1000)
+   MIL_DEPRECATED(MOs_strcpy, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcpy, 1000)
+   MIL_DEPRECATED(MOs_strncpy, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrncpy, 1000)
+   MIL_DEPRECATED(MOs_strcmp, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcmp, 1000)
+   MIL_DEPRECATED(MOs_stricmp, 1000)
+   MIL_DEPRECATED(MOs_ANSIstricmp, 1000)
+   MIL_DEPRECATED(MOs_strncmp, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrncmp, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrnicmp, 1000)
+   MIL_DEPRECATED(MOs_strcat, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcat, 1000)
+   MIL_DEPRECATED(MOs_strncat, 1000)
+   MIL_DEPRECATED(MOs_strchr, 1000)
+   MIL_DEPRECATED(MOs_strrchr, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrchr, 1000)
+   MIL_DEPRECATED(MOs_strlen, 1000)
+   MIL_DEPRECATED(MOs_strnlen, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrlen, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrnlen, 1000)
+   MIL_DEPRECATED(MOs_sprintf, 1000)
+   MIL_DEPRECATED(MOs_ANSIsprintf, 1000)
+   MIL_DEPRECATED(MOs_vsprintf, 1000)
+   MIL_DEPRECATED(MOs_sscanf, 1000)
+   MIL_DEPRECATED(MOs_ANSIsscanf, 1000)
+   MIL_DEPRECATED(MOs_fscanf, 1000)
+   MIL_DEPRECATED(MOs_fprintf, 1000)
+   MIL_DEPRECATED(MOs_ANSIfprintf, 1000)
+   MIL_DEPRECATED(MOs_ANSIvfprintf, 1000)
+   MIL_DEPRECATED(MOs_vfprintf, 1000)
+   MIL_DEPRECATED(MOs_strtod, 1000)
+   MIL_DEPRECATED(MOs_strupr, 1000)
+   MIL_DEPRECATED(MOs_getchar, 1000)
+   MIL_DEPRECATED(MOs_ctime, 1000)
+   MIL_DEPRECATED(MOs_ftime, 1000)
+   MIL_DEPRECATED(MOs_localtime, 1000)
+   MIL_DEPRECATED(MOs_strlwr, 1000)
+   MIL_DEPRECATED(MOs_system, 1000)
+   MIL_DEPRECATED(MOs_printf, 1000)
+   MIL_DEPRECATED(MOs_vprintf, 1000)
+   MIL_DEPRECATED(MOs_fputs, 1000)
+   MIL_DEPRECATED(MOs_ANSIfputs, 1000)
+   MIL_DEPRECATED(MOs_fputc, 1000)
+   MIL_DEPRECATED(MOs_strtok, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrtok, 1000)
+   MIL_DEPRECATED(MOs_ungetc, 1000)
+   MIL_DEPRECATED(MOs_tolower, 1000)
+   MIL_DEPRECATED(MOs_ANSItolower, 1000)
+   MIL_DEPRECATED(MOs_toupper, 1000)
+   MIL_DEPRECATED(MOs_strspn, 1000)
+   MIL_DEPRECATED(MOs_strcspn, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcspn, 1000)
+   MIL_DEPRECATED(MOs_asctime, 1000)
+   MIL_DEPRECATED(MOs_ANSIasctime, 1000)
+   MIL_DEPRECATED(MOs_strstr, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrstr, 1000)
+   MIL_DEPRECATED(MOs_splitpath, 1000)
+   MIL_DEPRECATED(MOs_makepath, 1000)
+   MIL_DEPRECATED(MOs_strnset, 1000)
+   MIL_DEPRECATED(MOs_strpbrk, 1000)
+   MIL_DEPRECATED(MOs_sprintf_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIsprintf_s, 1000)
+   MIL_DEPRECATED(MOs_printf_s, 1000)
+   MIL_DEPRECATED(MOs_sscanf_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIsscanf_s, 1000)
+   MIL_DEPRECATED(MOs_fscanf_s, 1000)
+   MIL_DEPRECATED(MOs_strncpy_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrncpy_s, 1000)
+   MIL_DEPRECATED(MOs_asctime_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIasctime_s, 1000)
+   MIL_DEPRECATED(MOs_strcpy_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcpy_s, 1000)
+   MIL_DEPRECATED(MOs_getenv_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIgetenv_s, 1000)
+   MIL_DEPRECATED(MOs_strcat_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrcat_s, 1000)
+   MIL_DEPRECATED(MOs_fopen_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIfopen_s, 1000)
+   MIL_DEPRECATED(MOs_strncat_s, 1000)
+   MIL_DEPRECATED(MOs_fcvt_s, 1000)
+   MIL_DEPRECATED(MOs_strtok_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIstrtok_s, 1000)
+   MIL_DEPRECATED(MOs_vsprintf_s, 1000)
+   MIL_DEPRECATED(MOs_ANSIvsprintf_s, 1000)
+   MIL_DEPRECATED(MOs_splitpath_s, 1000)
+   MIL_DEPRECATED(MOs_makepath_s, 1000)
+   MIL_DEPRECATED(MOs_strnset_s, 1000)
+   MIL_DEPRECATED(MOs_strlwr_s, 1000)
+   MIL_DEPRECATED(MOs_strupr_s, 1000)
+   MIL_DEPRECATED(MOs_strnicmp, 1000)
+   MIL_DEPRECATED(MOs_ctime_s, 1000)
+   MIL_DEPRECATED(MOs_ftime_s, 1000)
+   MIL_DEPRECATED(MOs_localtime_s, 1000)
+   MIL_DEPRECATED(MOs_mbstowcs_s, 1000)
+   MIL_DEPRECATED(MOs_wcstombs_s, 1000)
+   MIL_DEPRECATED(MOs_strdup, 1000)
+   MIL_DEPRECATED(MOs_strlwr_sA, 1000)
+   MIL_DEPRECATED(MOs_strupr_sA, 1000)
+   MIL_DEPRECATED(MOs_strcpy_sA, 1000)
+   MIL_DEPRECATED(MOs_vsprintf_sA, 1000)
+   MIL_DEPRECATED(MOs_strcat_sA, 1000)
+   MIL_DEPRECATED(MOs_strlwrA, 1000)
+   MIL_DEPRECATED(MOs_struprA, 1000)
+   MIL_DEPRECATED(MOs_strcpyA, 1000)
+   MIL_DEPRECATED(MOs_vsprintfA, 1000)
+   MIL_DEPRECATED(MOs_strcatA, 1000)
+   MIL_DEPRECATED(MOs_strlwrA, 1000)
+   MIL_DEPRECATED(MOs_struprA, 1000)
+   MIL_DEPRECATED(MOs_unlink, 1000)
+   MIL_DEPRECATED(MOs_vprintfA, 1000)
+   MIL_DEPRECATED(MOs_strcmpA, 1000)
+   MIL_DEPRECATED(MOs_hypot, 1000)
+   MIL_DEPRECATED(MOs_getenv, 1000)
+   MIL_DEPRECATED(MOs_ANSIgetenv, 1000)
+   MIL_DEPRECATED(MOs_mkdir, 1000)
+   MIL_DEPRECATED(MOs_rmdir, 1000)
+   MIL_DEPRECATED(MOs_chmod, 1000)
+   MIL_DEPRECATED(MOs_fopen, 1000)
+   MIL_DEPRECATED(MOs_ANSIfopen, 1000)
+   MIL_DEPRECATED(MOs_fclose, 1000)
+   MIL_DEPRECATED(MOs_fwrite, 1000)
+   MIL_DEPRECATED(MOs_fread, 1000)
+   MIL_DEPRECATED(MOs_fseek, 1000)
+   MIL_DEPRECATED(MOs_fseek64, 1000)
+   MIL_DEPRECATED(MOs_ftell, 1000)
+   MIL_DEPRECATED(MOs_ftell64, 1000)
+   MIL_DEPRECATED(MOs_feof, 1000)
+   MIL_DEPRECATED(MOs_ferror, 1000)
+   MIL_DEPRECATED(MOs_fflush, 1000)
+   MIL_DEPRECATED(MOs_fgetc, 1000)
+   MIL_DEPRECATED(MOs_fgets, 1000)
+   MIL_DEPRECATED(MOs_ANSIfgets, 1000)
+   MIL_DEPRECATED(MOs_clearerr, 1000)
+   MIL_DEPRECATED(MOs_remove, 1000)
+   MIL_DEPRECATED(MOs_rename, 1000)
+   MIL_DEPRECATED(MOs_copyfile, 1000)
+   MIL_DEPRECATED(MOs_putenv, 1000)
+   MIL_DEPRECATED(MOs_try, 1000)
+   MIL_DEPRECATED(MOs_catch, 1000)
+   MIL_DEPRECATED(MOs_throw, 1000)
+#endif
+
+/************************************************************************/
+/* SUPPORT FOR nullptr                                                  */
+/************************************************************************/
+
+#ifndef M_MIL_USE_NULLPTR
+   #ifdef __cplusplus
+      #if defined(_MSC_VER) && (_MSC_VER >= 1600) // On Windows
+         #define M_MIL_USE_NULLPTR 1
+      #elif (!M_LINUX_KERNEL) && (__cplusplus >= 201103L) // On Linux (and potentially others)
+         #define M_MIL_USE_NULLPTR 1
+      #endif
+   #endif
+#endif
+
+#ifndef M_MIL_USE_NULLPTR
+   #define M_MIL_USE_NULLPTR 0
+#endif
+
+/************************************************************************/
+/* SUPPORT FOR noexcept                                                 */
+/************************************************************************/
+
+#ifndef MIL_NOEXCEPT
+   #ifdef __cplusplus
+      #if defined(_MSC_VER) && (_MSC_VER >= 1900) // On Windows
+         #define MIL_NOEXCEPT noexcept
+      #elif (!M_LINUX_KERNEL) && (__cplusplus >= 201103L) // On Linux (and potentially others)
+         #define MIL_NOEXCEPT noexcept
+      #endif
+   #endif
+#endif
+
+#ifndef MIL_NOEXCEPT
+   #define MIL_NOEXCEPT
+#endif
+
+/************************************************************************/
+/* SUPPORT FOR MOVE SEMANTICS                                           */
+/************************************************************************/
+
+#ifndef M_MIL_USE_MOVE_SEMANTICS
+   #ifdef __cplusplus
+      #if defined(_MSC_VER) && (_MSC_VER >= 1700) // On Windows
+         #define M_MIL_USE_MOVE_SEMANTICS 1
+      #elif (!M_LINUX_KERNEL) && (__cplusplus >= 201103L) // On Linux (and potentially others)
+         #define M_MIL_USE_MOVE_SEMANTICS 1
+      #endif
+   #endif
+#endif
+
+#ifndef M_MIL_USE_MOVE_SEMANTICS
+   #define M_MIL_USE_MOVE_SEMANTICS 0
+#endif
+
+#ifndef M_MIL_USE_REF_QUALIFIERS
+   #ifdef __cplusplus
+      #if defined(_MSC_VER) && (_MSC_VER >= 1900) // On Windows
+         #define M_MIL_USE_REF_QUALIFIERS 1
+      #elif (!M_LINUX_KERNEL) && (__cplusplus >= 201103L) // On Linux (and potentially others)
+         #define M_MIL_USE_REF_QUALIFIERS 1
+      #endif
+   #endif
+#endif
+
+#ifndef M_MIL_USE_REF_QUALIFIERS
+   #define M_MIL_USE_REF_QUALIFIERS 0
+#endif
+
+/************************************************************************/
+/* SAFETYPE FUNCTIONS ON/OFF                                            */
+/************************************************************************/
+
+/* 
+The SafeType functions overload the C functions that receive a void*
+argument.
+
+A C++ overload is defined for each possible type of pointer that can be
+received. The type of data received is compared with the expected data
+type according to MIL documentation.
+
+Two types of FALSE POSITIVE errors can occur:
+1. Compile time error 
+
+   If a wrapper has been build around a MIL function and the MIL
+   function is called via a void*, for ex:
+      void MyBufInquire(MIL_ID Id, MIL_INT64 InquireType, void *Ptr) 
+         {
+         MbufInquire(Id, InquireType, Ptr);
+         }
+
+   If the following syntax is used to access an array on the stack:
+      {
+      double AllScores[MAX_NUM_OCCURENCES];
+      MmodGetResult(ResultId, M_ALL, M_SCORE+M_TYPE_DOUBLE, &AllScores) ;
+      }
+   The only thing to do is to remove the " & ".
+
+   In these situations, the error will be
+   "none of the ?? overloads could convert all the argument types"
+
+2. Run time error: the inline function SafeTypeError is called.
+
+   If the application voluntarily passes a pointer of the wrong 
+   type of data, for example:
+      {
+      char *Ptr = new char[sizeof(double)];
+      MmodGetResult(ResultId, 0, M_SCORE+M_TYPE_DOUBLE, Ptr);
+      double Score = (double*)Ptr;
+      }
+   It is possible to remove this error by casting Ptr to the correct
+   type if available.
+
+TO DEACTIVATE THE SAFE TYPE OVERLOADS AND GET RID OF COMPILE-TIME
+OR RUN-TIME ERRORS:
+
+1. Deactivate globally by using
+   #define M_MIL_USE_SAFE_TYPE 0
+   before including mil.h
+
+OR
+
+2. Deactivate locally by adding "Unsafe" as a suffix to the 
+   function name.
+
+*/
+
+/* Safe type is activated by default in C++ and in Debug.
+   It is deactivated in Release or in C. */
+#ifndef M_MIL_USE_SAFE_TYPE
+   #if !defined(__cplusplus)
+      #define M_MIL_USE_SAFE_TYPE 0 /* In C, there is no multiple overload of a function. */
+   #elif defined(NDEBUG) || defined(__OPTIMIZE__)
+      #define M_MIL_USE_SAFE_TYPE 0 /* Disable SafeType in Release to avoid added overhead. */
+   #elif M_MIL_USE_LINUX
+      #if M_LINUX_KERNEL
+         #define M_MIL_USE_SAFE_TYPE 0
+      #else
+         #define M_MIL_USE_SAFE_TYPE 1
+      #endif
+   #elif (defined(M_WINDOWS_NT_KERNEL_MODE) && M_WINDOWS_NT_KERNEL_MODE)
+      #define M_MIL_USE_SAFE_TYPE 0 /* Driver compilation defines double to MIL_INT64, causing ambiguous calls. */
+   #else
+      #define M_MIL_USE_SAFE_TYPE 1 /* Enable SafeType in Debug. */
+   #endif
+#endif
+
+#define M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS (M_MIL_USE_SAFE_TYPE && M_MIL_USE_NULLPTR)
+
+#if M_MIL_USE_NULLPTR
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4668)
+#endif
+
+#include <cstddef> // for std::nullptr_t
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+
+#endif
+
+#if M_MIL_USE_SAFE_TYPE && !__cplusplus
+#error M_MIL_USE_SAFE_TYPE can only be activated with C++ compilation.
+#endif
+
+// Even if the MIL documentation does not officially support pointers to "unsigned"
+// integers, many applications do it anyway without problems. We support it here to
+// avoid too many false errors.
+#ifndef M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+#define M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED 1
+#endif
+
+// It would be safer to ensure that when asking for pointers we only fill 
+// double pointers (ex: void**), but too much code exists that probably fills a 
+// pointer into an integer of the correct type.
+#ifndef M_MIL_SAFE_TYPE_STRONG_POINTER_CHECK
+#define M_MIL_SAFE_TYPE_STRONG_POINTER_CHECK 0
+#endif
+
+#if M_MIL_SAFE_TYPE_STRONG_POINTER_CHECK
+   // An integer will not be accepted to hold pointers.
+   #define M_SAFE_TYPE_CHECK_PTR   M_TYPE_PTR
+#else
+   // An integer of the correct size will be accepted to hold pointers.
+   #if M_MIL_USE_64BIT
+      #define M_SAFE_TYPE_CHECK_PTR   M_TYPE_MIL_INT64
+   #else
+      #define M_SAFE_TYPE_CHECK_PTR   M_TYPE_MIL_INT32
+   #endif
+#endif
+
+// With VisualStudio compilers, we may have to add the definition of pointers to 
+// wchar_t since it is different from unsigned short
+#if (M_MIL_USE_UNICODE ) && (defined(_NATIVE_WCHAR_T_DEFINED) || defined(__MINGW32__))
+#define M_MIL_SAFE_TYPE_ADD_WCHAR_T 1
+#endif
+
+#endif /* #ifndef __MILOS_H */
diff --git a/Lib/Matrox/Include/Milproto.h b/Lib/Matrox/Include/Milproto.h
new file mode 100644
index 0000000..906b9d8
--- /dev/null
+++ b/Lib/Matrox/Include/Milproto.h
@@ -0,0 +1,9696 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILPROTO.H
+    Owner   :  Matrox Imaging
+    Revision:  10.40.0640
+    Content :  This file contains the prototypes for the Matrox
+               Imaging Library (MIL) C user's functions.
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef __MILPROTO_H
+#define __MILPROTO_H
+
+#include <stdarg.h>
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/***************************************************************************/
+/* HOOK HANDLER PROTOTYPE                                                  */
+/***************************************************************************/
+typedef MIL_INT (MFTYPE* MIL_HOOK_FUNCTION_PTR)(MIL_INT HookType,
+                                                MIL_ID EventId,
+                                                void* UserData);
+
+
+/***************************************************************************/
+/* GRAPHIC MODULE:                                                         */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CONTROL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC MIL_ID MFTYPE  MgraAlloc            (MIL_ID SysId,
+                                     MIL_ID* ContextGraIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MgraAllocList        (MIL_ID SysId,
+                                     MIL_INT64 ListGraType,
+                                     MIL_ID *ListGraIdPtr);
+
+MIL_DLLFUNC void MFTYPE    MgraFree             (MIL_ID ObjectId);
+
+MIL_DLLFUNC void MFTYPE    MgraColorDouble      (MIL_ID ContextGraId,
+                                     MIL_DOUBLE ForegroundColor);
+
+MIL_DLLFUNC void MFTYPE    MgraBackColorDouble  (MIL_ID ContextGraId,
+                                     MIL_DOUBLE BackgroundColor);
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC void MFTYPE    MgraFontW            (MIL_ID ContextGraId,
+                                     MIL_INT64  FontName);
+MIL_DLLFUNC void MFTYPE    MgraFontA            (MIL_ID ContextGraId,
+                                     MIL_INT64  FontName);
+#if M_MIL_UNICODE_API
+#define MgraFont           MgraFontW
+#else
+#define MgraFont           MgraFontA
+#endif
+
+#else
+MIL_DLLFUNC void MFTYPE    MgraFont             (MIL_ID     ContextGraId,
+                                     MIL_INT64  FontName);
+#endif
+
+MIL_DLLFUNC void* MFTYPE MgraFontGetLarge(void);
+MIL_DLLFUNC void* MFTYPE MgraFontGetSmall(void);
+MIL_DLLFUNC void* MFTYPE MgraFontGetMedium(void);
+
+MIL_DLLFUNC void MFTYPE    MgraFontScale        (MIL_ID ContextGraId,
+                                     MIL_DOUBLE XFontScale,
+                                     MIL_DOUBLE YFontScale);
+
+MIL_DLLFUNC MIL_INT    MFTYPE    MgraInquire    (MIL_ID ContextGraId,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MgraControlListInt64 (MIL_ID GraListId,
+                                     MIL_INT LabelOrIndex,
+                                     MIL_INT SubIndex,
+                                     MIL_INT64 ControlType,
+                                     MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MgraControlListDouble(MIL_ID GraListId,
+                                     MIL_INT LabelOrIndex,
+                                     MIL_INT SubIndex,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MgraControlInt64 (MIL_ID ContextGraId,
+                                 MIL_INT64 ControlType,
+                                 MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MgraControlDouble(MIL_ID ContextGraId,
+                                 MIL_INT64 ControlType,
+                                 MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MgraControlListDouble MgraControlList
+#define MgraControlListInt64  MgraControlList
+MIL_DLLFUNC void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                     MIL_INT LabelOrIndex,
+                                     MIL_INT SubIndex,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue);
+
+#define MgraControlDouble MgraControl
+#define MgraControlInt64  MgraControl
+MIL_DLLFUNC void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                            MIL_INT64 ControlType,
+                            MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC MIL_INT MFTYPE MgraInquireList      (MIL_ID GraListId,
+                                     MIL_INT LabelOrIndex,
+                                     MIL_INT SubIndex,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MgraGetNeighbors        (MIL_ID        GraphListId            ,
+                                     MIL_ID        DisplayId              ,
+                                     MIL_ID        CalOrImageId           ,
+                                     MIL_INT       LabelOrIndex           ,
+                                     MIL_INT64     Operation              ,
+                                     MIL_DOUBLE    PosX                   ,
+                                     MIL_DOUBLE    PosY                   ,
+                                     MIL_DOUBLE    Param1                 ,
+                                     MIL_DOUBLE    Param2                 ,
+                                     MIL_INT64     ResultOutputUnits      ,
+                                     MIL_INT       MaxNumNeighbors        ,
+                                     MIL_INT*      NumNeighborsFoundPtr   ,
+                                     MIL_INT*      ObjectLabelOrIndexArray,
+                                     MIL_DOUBLE*   ObjectPosXArray        ,
+                                     MIL_DOUBLE*   ObjectPosYArray        ,
+                                     MIL_INT64     ControlFlag            );
+
+MIL_DLLFUNC void MFTYPE MgraGetBoundingBox      (MIL_ID        GraphListId,
+                                     MIL_ID        CalOrImageId,
+                                     MIL_INT64     LabelOrIndex,
+                                     MIL_INT64     Units,
+                                     MIL_DOUBLE*   MinXPtr,
+                                     MIL_DOUBLE*   MinYPtr,
+                                     MIL_DOUBLE*   MaxXPtr,
+                                     MIL_DOUBLE*   MaxYPtr,
+                                     MIL_INT64     ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MgraDraw                (MIL_ID        GraListId,
+                                     MIL_ID        DestImageId,
+                                     MIL_INT64     ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MgraDrawZoom            (MIL_ID        GraphListId,
+                                     MIL_ID        ImageId,
+                                     MIL_ID        CalibrationId,
+                                     MIL_DOUBLE    ScaleX,
+                                     MIL_DOUBLE    ScaleY,
+                                     MIL_DOUBLE    OffsetX,
+                                     MIL_DOUBLE    OffsetY,
+                                     MIL_INT       SizeX,
+                                     MIL_INT       SizeY,
+                                     MIL_INT64     ControlFlag);
+
+typedef MIL_HOOK_FUNCTION_PTR MIL_GRA_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void MFTYPE MgraHookFunction        (MIL_ID GraListId,
+                                     MIL_INT HookType,
+                                     MIL_GRA_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                     void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MgraGetHookInfo      (MIL_ID EventId,
+                                     MIL_INT64 InfoType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MgraMessage             (MIL_ID   GraListId,
+                                     MIL_INT  MessageType,
+                                     MIL_INT  MessageParam1,
+                                     MIL_INT  MessageParam2,
+                                     MIL_INT  MessageParam3,
+                                     MIL_INT  CombinationKeys,
+                                     MIL_ID   CalOrImageId,
+                                     MIL_DOUBLE DisplayOffX,
+                                     MIL_DOUBLE DisplayOffY,
+                                     MIL_DOUBLE DisplayScaleX,
+                                     MIL_DOUBLE DisplayScaleY,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_INT* StatusPtr);
+
+MIL_DLLFUNC void MFTYPE MgraMessageEx(MIL_ID   GraListId,
+                                      MIL_INT  MessageType,
+                                      MIL_INT  MessageParam1,
+                                      MIL_INT  MessageParam2,
+                                      MIL_INT  MessageParam3,
+                                      MIL_INT  CombinationKeys,
+                                      MIL_ID   CalOrImageId,
+                                      MIL_DOUBLE DisplayOffX,
+                                      MIL_DOUBLE DisplayOffY,
+                                      MIL_DOUBLE DisplayScaleX,
+                                      MIL_DOUBLE DisplayScaleY,
+                                      MIL_INT    Dpi,
+                                      MIL_INT64 ControlFlag,
+                                      MIL_INT* StatusPtr);
+
+MIL_DLLFUNC void MFTYPE MgraCopy                (MIL_ID         SrcListGraId           ,
+                                     MIL_ID         DstListGraId           ,
+                                     MIL_INT64      Operation              ,
+                                     MIL_INT        InsertLocation         ,
+                                     MIL_INT        NumGraphics            ,
+                                     const MIL_INT* SrcIndexOrLabelArrayPtr,
+                                     MIL_INT*       DstLabelArrayPtr       ,
+                                     MIL_INT64      ControlFlag            );
+
+MIL_DLLFUNC void MFTYPE MgraProcess             (MIL_ID SrcGraphListId,
+                                     MIL_ID DstGraphListId,
+                                     MIL_ID CalOrImageId,
+                                     MIL_INT SrcLabelOrIndex,
+                                     MIL_INT DstLabelOrIndex,
+                                     MIL_INT64 Operation,
+                                     MIL_DOUBLE Param);
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC void MFTYPE MgraSaveW(MIL_CONST_TEXTW_PTR  FileName,
+                      MIL_ID              GraphListId,
+                      MIL_INT64           ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE MgraRestoreW(MIL_CONST_TEXTW_PTR FileName,
+                           MIL_ID             SystemId,
+                           MIL_INT64          ControlFlag,
+                           MIL_ID*            GraphListIdPtr);
+
+MIL_DLLFUNC void MFTYPE MgraStreamW(MIL_TEXTW_PTR MemPtrOrFileName,
+                        MIL_ID       SystemId,
+                        MIL_INT64    Operation,
+                        MIL_INT64    StreamType,
+                        MIL_DOUBLE   Version,
+                        MIL_INT64    ControlFlag,
+                        MIL_ID*      GraphListIdPtr,
+                        MIL_INT*     SizeByteVarPtr);
+
+MIL_DLLFUNC void MFTYPE MgraSaveA(MIL_CONST_TEXTA_PTR  FileName,
+                      MIL_ID       GraphListId,
+                      MIL_INT64    ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE MgraRestoreA(MIL_CONST_TEXTA_PTR FileName,
+                           MIL_ID      SystemId,
+                           MIL_INT64   ControlFlag,
+                           MIL_ID*     GraphListIdPtr);
+
+MIL_DLLFUNC void MFTYPE MgraStreamA(MIL_TEXTA_PTR  MemPtrOrFileName,
+                        MIL_ID       SystemId,
+                        MIL_INT64    Operation,
+                        MIL_INT64    StreamType,
+                        MIL_DOUBLE   Version,
+                        MIL_INT64    ControlFlag,
+                        MIL_ID*      ObjectIdPtr,
+                        MIL_INT*     GraphListIdPtr);
+#if M_MIL_UNICODE_API
+#define MgraSave           MgraSaveW
+#define MgraRestore        MgraRestoreW
+#define MgraStream         MgraStreamW
+#else
+#define MgraSave           MgraSaveA
+#define MgraRestore        MgraRestoreA
+#define MgraStream         MgraStreamA
+#endif
+
+#else
+MIL_DLLFUNC void MFTYPE MgraSave(MIL_CONST_TEXT_PTR  FileName,
+                     MIL_ID              GraphListId,
+                     MIL_INT64           ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE MgraRestore(MIL_CONST_TEXT_PTR FileName,
+                          MIL_ID             SystemId,
+                          MIL_INT64          ControlFlag,
+                          MIL_ID*            GraphListIdPtr);
+
+MIL_DLLFUNC void MFTYPE MgraStream(MIL_TEXT_PTR MemPtrOrFileName,
+                       MIL_ID       SystemId,
+                       MIL_INT64    Operation,
+                       MIL_INT64    StreamType,
+                       MIL_DOUBLE   Version,
+                       MIL_INT64    ControlFlag,
+                       MIL_ID*      GraphListIdPtr,
+                       MIL_INT*     SizeByteVarPtr);
+
+#endif
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+       /* DRAWING : */
+
+      /* -------------------------------------------------------------- */
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraDotDouble        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos);
+
+   MIL_DLLFUNC void MFTYPE    MgraDotDoubleEx      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraDotInt64         (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XPos,
+                                        MIL_INT64 YPos);
+
+   MIL_DLLFUNC void MFTYPE    MgraDotInt64Ex       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XPos,
+                                        MIL_INT64 YPos,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+#else
+   MIL_DLLFUNC void MFTYPE    MgraDot              (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos);
+
+   MIL_DLLFUNC void MFTYPE    MgraDotEx            (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   #define MgraDotDouble MgraDot
+   #define MgraDotInt64  MgraDot
+   #define MgraDotDoubleEx MgraDotEx
+   #define MgraDotInt64Ex  MgraDotEx  
+#endif
+
+
+/* -------------------------------------------------------------- */
+MIL_DLLFUNC void MFTYPE    MgraDotsDouble       (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_DOUBLE *PosXArrayPtr,
+                                     const MIL_DOUBLE *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsInt64        (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_INT64 *PosXArrayPtr,
+                                     const MIL_INT64 *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsInt32        (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_INT32 *PosXArrayPtr,
+                                     const MIL_INT32 *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsDoubleEx     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_DOUBLE *PosXArrayPtr,
+                                     const MIL_DOUBLE *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsInt64Ex      (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_INT64 *PosXArrayPtr,
+                                     const MIL_INT64 *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraDotsInt32Ex      (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT  NumberOfDots,
+                                     const MIL_INT32 *PosXArrayPtr,
+                                     const MIL_INT32 *PosYArrayPtr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+/* -------------------------------------------------------------- */
+MIL_DLLFUNC void MFTYPE    MgraSymbolsDouble    (MIL_ID ContextGraId,
+                                     MIL_ID DestImageBufIdOrGraListId,
+                                     MIL_INT  NumberOfSymbols,
+                                     const MIL_DOUBLE *XPosArray,
+                                     const MIL_DOUBLE *YPosArray,
+                                     const MIL_DOUBLE *AngleArray,
+                                     MIL_DOUBLE Dimension,
+                                     MIL_INT64 SymbolType,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraSymbolsDoubleEx  (MIL_ID ContextGraId,
+                                     MIL_ID DestImageBufIdOrGraListId,
+                                     MIL_INT  NumberOfSymbols,
+                                     const MIL_DOUBLE *XPosArray,
+                                     const MIL_DOUBLE *YPosArray,
+                                     const MIL_DOUBLE *AngleArray,
+                                     MIL_DOUBLE Dimension,
+                                     MIL_INT64 SymbolType,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_INT64 AngleUnits,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraLineDouble       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraLineDoubleEx     (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraLineInt64        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraLineInt64Ex      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraLine             (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraLineEx           (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   #define MgraLineDouble MgraLine
+   #define MgraLineInt64  MgraLine
+   #define MgraLineDoubleEx MgraLineEx
+   #define MgraLineInt64Ex  MgraLineEx
+#endif
+
+/* -------------------------------------------------------------- */
+MIL_DLLFUNC void MFTYPE    MgraLinesDouble      (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_DOUBLE *XPtr,
+                                     const MIL_DOUBLE *YPtr,
+                                     const MIL_DOUBLE *X2Ptr,
+                                     const MIL_DOUBLE *Y2Ptr,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MgraLinesInt64       (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_INT64 *XPtr,
+                                     const MIL_INT64 *YPtr,
+                                     const MIL_INT64 *X2Ptr,
+                                     const MIL_INT64 *Y2Ptr,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MgraLinesInt32       (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_INT32 *XPtr,
+                                     const MIL_INT32 *YPtr,
+                                     const MIL_INT32 *X2Ptr,
+                                     const MIL_INT32 *Y2Ptr,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraLinesDoubleEx    (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_DOUBLE *XPtr,
+                                     const MIL_DOUBLE *YPtr,
+                                     const MIL_DOUBLE *X2Ptr,
+                                     const MIL_DOUBLE *Y2Ptr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraLinesInt64Ex     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_INT64 *XPtr,
+                                     const MIL_INT64 *YPtr,
+                                     const MIL_INT64 *X2Ptr,
+                                     const MIL_INT64 *Y2Ptr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraLinesInt32Ex     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumberOfLinesOrVertices,
+                                     const MIL_INT32 *XPtr,
+                                     const MIL_INT32 *YPtr,
+                                     const MIL_INT32 *X2Ptr,
+                                     const MIL_INT32 *Y2Ptr,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraArcDouble        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcDoubleEx      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcInt64         (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XCenter,
+                                        MIL_INT64 YCenter,
+                                        MIL_INT64 XRad,
+                                        MIL_INT64 YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcInt64Ex       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XCenter,
+                                        MIL_INT64 YCenter,
+                                        MIL_INT64 XRad,
+                                        MIL_INT64 YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraArc              (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcEx            (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   #define MgraArcDouble MgraArc
+   #define MgraArcInt64  MgraArc
+   #define MgraArcDoubleEx MgraArcEx
+   #define MgraArcInt64Ex  MgraArcEx
+
+
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraArcFillDouble    (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcFillDoubleEx  (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcFillInt64     (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XCenter,
+                                        MIL_INT64 YCenter,
+                                        MIL_INT64 XRad,
+                                        MIL_INT64 YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcFillInt64Ex   (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XCenter,
+                                        MIL_INT64 YCenter,
+                                        MIL_INT64 XRad,
+                                        MIL_INT64 YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraArcFill          (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle);
+
+   MIL_DLLFUNC void MFTYPE    MgraArcFillEx        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XCenter,
+                                        MIL_DOUBLE YCenter,
+                                        MIL_DOUBLE XRad,
+                                        MIL_DOUBLE YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   #define MgraArcFillDouble MgraArcFill
+   #define MgraArcFillInt64  MgraArcFill
+   #define MgraArcFillDoubleEx MgraArcFillEx
+   #define MgraArcFillInt64Ex  MgraArcFillEx
+#endif
+
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE MgraArcAngleDouble       (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_DOUBLE XCenter,
+                                         MIL_DOUBLE YCenter,
+                                         MIL_DOUBLE XRad,
+                                         MIL_DOUBLE YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraArcAngleDoubleEx     (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_DOUBLE XCenter,
+                                         MIL_DOUBLE YCenter,
+                                         MIL_DOUBLE XRad,
+                                         MIL_DOUBLE YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag,
+                                         MIL_ID NativeCalibration,
+                                         MIL_INT64 NativeUnits,
+                                         MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE MgraArcAngleInt64        (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_INT64 XCenter,
+                                         MIL_INT64 YCenter,
+                                         MIL_INT64 XRad,
+                                         MIL_INT64 YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraArcAngleInt64Ex      (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_INT64 XCenter,
+                                         MIL_INT64 YCenter,
+                                         MIL_INT64 XRad,
+                                         MIL_INT64 YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag,
+                                         MIL_ID NativeCalibration,
+                                         MIL_INT64 NativeUnits,
+                                         MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE MgraArcAngle             (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_DOUBLE XCenter,
+                                         MIL_DOUBLE YCenter,
+                                         MIL_DOUBLE XRad,
+                                         MIL_DOUBLE YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraArcAngleEx           (MIL_ID ContextGraId,
+                                         MIL_ID DstImageBufOrListGraId,
+                                         MIL_DOUBLE XCenter,
+                                         MIL_DOUBLE YCenter,
+                                         MIL_DOUBLE XRad,
+                                         MIL_DOUBLE YRad,
+                                         MIL_DOUBLE StartAngle,
+                                         MIL_DOUBLE EndAngle,
+                                         MIL_DOUBLE XAxisAngle,
+                                         MIL_INT64 ControlFlag,
+                                         MIL_ID NativeCalibration,
+                                         MIL_INT64 NativeUnits,
+                                         MIL_INT64 ConvertMode);
+   #define MgraArcAngleDouble MgraArcAngle
+   #define MgraArcAngleInt64  MgraArcAngle
+   #define MgraArcAngleDoubleEx MgraArcAngleEx
+   #define MgraArcAngleInt64Ex  MgraArcAngleEx
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE MgraRingSectorDouble     (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_DOUBLE XCenter                  ,
+                                         MIL_DOUBLE YCenter                  ,
+                                         MIL_DOUBLE XInnerRadius             ,
+                                         MIL_DOUBLE YInnerRadius             ,
+                                         MIL_DOUBLE XOuterRadius             ,
+                                         MIL_DOUBLE YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              );
+
+   MIL_DLLFUNC void MFTYPE MgraRingSectorDoubleEx   (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_DOUBLE XCenter                  ,
+                                         MIL_DOUBLE YCenter                  ,
+                                         MIL_DOUBLE XInnerRadius             ,
+                                         MIL_DOUBLE YInnerRadius             ,
+                                         MIL_DOUBLE XOuterRadius             ,
+                                         MIL_DOUBLE YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              ,
+                                         MIL_ID     NativeCalibration        ,
+                                         MIL_INT64  NativeUnits              ,
+                                         MIL_INT64  ConvertMode          );
+
+   MIL_DLLFUNC void MFTYPE MgraRingSectorInt64      (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_INT64  XCenter                  ,
+                                         MIL_INT64  YCenter                  ,
+                                         MIL_INT64  XInnerRadius             ,
+                                         MIL_INT64  YInnerRadius             ,
+                                         MIL_INT64  XOuterRadius             ,
+                                         MIL_INT64  YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              );
+
+   MIL_DLLFUNC void MFTYPE MgraRingSectorInt64Ex    (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_INT64  XCenter                  ,
+                                         MIL_INT64  YCenter                  ,
+                                         MIL_INT64  XInnerRadius             ,
+                                         MIL_INT64  YInnerRadius             ,
+                                         MIL_INT64  XOuterRadius             ,
+                                         MIL_INT64  YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              ,
+                                         MIL_ID     NativeCalibration        ,
+                                         MIL_INT64  NativeUnits              ,
+                                         MIL_INT64  ConvertMode          );
+
+#else
+   MIL_DLLFUNC void MFTYPE MgraRingSector           (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_DOUBLE XCenter                  ,
+                                         MIL_DOUBLE YCenter                  ,
+                                         MIL_DOUBLE XInnerRadius             ,
+                                         MIL_DOUBLE YInnerRadius             ,
+                                         MIL_DOUBLE XOuterRadius             ,
+                                         MIL_DOUBLE YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              );
+
+   MIL_DLLFUNC void MFTYPE MgraRingSectorEx         (MIL_ID     ContextGraId             ,
+                                         MIL_ID     DestImageBufIdOrGraListId,
+                                         MIL_DOUBLE XCenter                  ,
+                                         MIL_DOUBLE YCenter                  ,
+                                         MIL_DOUBLE XInnerRadius             ,
+                                         MIL_DOUBLE YInnerRadius             ,
+                                         MIL_DOUBLE XOuterRadius             ,
+                                         MIL_DOUBLE YOuterRadius             ,
+                                         MIL_DOUBLE StartAngle               ,
+                                         MIL_DOUBLE EndAngle                 ,
+                                         MIL_DOUBLE XAxisAngle               ,
+                                         MIL_INT64  ControlFlag              ,
+                                         MIL_ID     NativeCalibration        ,
+                                         MIL_INT64  NativeUnits              ,
+                                         MIL_INT64  ConvertMode          );
+   #define MgraRingSectorDouble   MgraRingSector
+   #define MgraRingSectorInt64    MgraRingSector
+   #define MgraRingSectorDoubleEx MgraRingSectorEx
+   #define MgraRingSectorInt64Ex  MgraRingSectorEx
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraRectDouble       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectDoubleEx     (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectInt64        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectInt64Ex      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraRect             (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectEx           (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+   #define MgraRectDouble MgraRect
+   #define MgraRectInt64  MgraRect
+   #define MgraRectDoubleEx MgraRectEx
+   #define MgraRectInt64Ex  MgraRectEx
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraRectFillDouble   (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectFillDoubleEx (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectFillInt64    (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectFillInt64Ex  (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_INT64 XEnd,
+                                        MIL_INT64 YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraRectFill         (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd);
+
+   MIL_DLLFUNC void MFTYPE    MgraRectFillEx       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufOrListGraId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_DOUBLE XEnd,
+                                        MIL_DOUBLE YEnd,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+   #define MgraRectFillDouble MgraRectFill
+   #define MgraRectFillInt64  MgraRectFill
+   #define MgraRectFillDoubleEx MgraRectFillEx
+   #define MgraRectFillInt64Ex  MgraRectFillEx
+#endif
+
+
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE MgraRectAngleDouble     (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_DOUBLE Width,
+                                        MIL_DOUBLE Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraRectAngleDoubleEx   (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_DOUBLE Width,
+                                        MIL_DOUBLE Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE MgraRectAngleInt64      (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_INT64 XPos,
+                                        MIL_INT64 YPos,
+                                        MIL_INT64 Width,
+                                        MIL_INT64 Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraRectAngleInt64Ex    (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_INT64 XPos,
+                                        MIL_INT64 YPos,
+                                        MIL_INT64 Width,
+                                        MIL_INT64 Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE MgraRectAngle           (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_DOUBLE Width,
+                                        MIL_DOUBLE Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag);
+
+   MIL_DLLFUNC void MFTYPE MgraRectAngleEx         (MIL_ID ContextGraId,
+                                        MIL_ID DestImageBufIdOrGraListId,
+                                        MIL_DOUBLE XPos,
+                                        MIL_DOUBLE YPos,
+                                        MIL_DOUBLE Width,
+                                        MIL_DOUBLE Height,
+                                        MIL_DOUBLE Angle,
+                                        MIL_INT64 ControlFlag,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+   #define MgraRectAngleDouble MgraRectAngle
+   #define MgraRectAngleInt64  MgraRectAngle
+   #define MgraRectAngleDoubleEx MgraRectAngleEx
+   #define MgraRectAngleInt64Ex  MgraRectAngleEx
+#endif
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+   MIL_DLLFUNC void MFTYPE    MgraFillDouble       (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart);
+
+   MIL_DLLFUNC void MFTYPE    MgraFillDoubleEx     (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+   MIL_DLLFUNC void MFTYPE    MgraFillInt64        (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart);
+
+   MIL_DLLFUNC void MFTYPE    MgraFillInt64Ex      (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_INT64 XStart,
+                                        MIL_INT64 YStart,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+
+#else
+   MIL_DLLFUNC void MFTYPE    MgraFill             (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart);
+
+   MIL_DLLFUNC void MFTYPE    MgraFillEx           (MIL_ID ContextGraId,
+                                        MIL_ID DstImageBufId,
+                                        MIL_DOUBLE XStart,
+                                        MIL_DOUBLE YStart,
+                                        MIL_ID NativeCalibration,
+                                        MIL_INT64 NativeUnits,
+                                        MIL_INT64 ConvertMode);
+   #define MgraFillDouble MgraFill
+   #define MgraFillInt64  MgraFill
+   #define MgraFillDoubleEx MgraFillEx
+   #define MgraFillInt64Ex  MgraFillEx
+#endif
+
+/* -------------------------------------------------------------- */
+MIL_DLLFUNC void MFTYPE    MgraClear            (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId);
+
+/* -------------------------------------------------------------- */
+#if M_MIL_USE_64BIT
+
+   #if M_MIL_USE_UNICODE
+      MIL_DLLFUNC void MFTYPE    MgraTextADouble      (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextADoubleEx    (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextAInt64       (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextAInt64Ex     (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWDouble      (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWDoubleEx    (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWInt64       (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWInt64Ex     (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+
+      // MgraTextW and MgraTextA themselves will be defined at the end of the
+      // file in C++ function (or #define in C) mapping to on of the 4 flavors
+      // of MgraText.
+      #if M_MIL_UNICODE_API
+         #define MgraTextDouble MgraTextWDouble
+         #define MgraText MgraTextW
+         #define MgraTextEx MgraTextWEx
+      #else
+         #define MgraTextDouble MgraTextADouble
+         #define MgraText MgraTextA
+         #define MgraTextEx MgraTextAEx
+      #endif
+
+   #else // #if M_MIL_USE_UNICODE
+      MIL_DLLFUNC void MFTYPE    MgraTextDouble       (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextDoubleEx     (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextInt64        (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextInt64Ex      (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_INT64 XStart,
+                                           MIL_INT64 YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      #define MgraTextA MgraText
+      #define MgraTextAEx MgraTextEx
+
+   #endif // #if M_MIL_USE_UNICODE #else
+
+#else // #if M_MIL_USE_64BIT
+
+   #if M_MIL_USE_UNICODE
+      MIL_DLLFUNC void MFTYPE    MgraTextA            (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextAEx          (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTA_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextW            (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextWEx          (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXTW_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      #define MgraTextDouble MgraText
+      #if M_MIL_UNICODE_API
+         #define MgraText MgraTextW
+         #define MgraTextEx MgraTextWEx
+      #else
+         #define MgraText MgraTextA
+         #define MgraTextEx MgraTextAEx
+      #endif
+
+   #else // #if M_MIL_USE_UNICODE
+      MIL_DLLFUNC void MFTYPE    MgraText             (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr);
+
+      MIL_DLLFUNC void MFTYPE    MgraTextEx           (MIL_ID ContextGraId,
+                                           MIL_ID DstImageBufOrListGraId,
+                                           MIL_DOUBLE XStart,
+                                           MIL_DOUBLE YStart,
+                                           MIL_CONST_TEXT_PTR StringPtr,
+                                           MIL_ID NativeCalibration,
+                                           MIL_INT64 NativeUnits,
+                                           MIL_INT64 ConvertMode);
+
+      #define MgraTextA MgraText
+      #define MgraTextAEx MgraTextEx
+   #endif // #if M_MIL_USE_UNICODE #else
+
+#endif // #if M_MIL_USE_64BIT #else
+
+MIL_DLLFUNC void MFTYPE    MgraImage            (MIL_ID ContextGraId,
+                                     MIL_ID ImageId,
+                                     MIL_ID DestImageId,
+                                     MIL_INT64 ControlFlag);
+
+
+
+#define M_NO_ERROR_TO_REPORT      0
+#define M_ERROR_ALREADY_REPORTED  1
+typedef MIL_INT (MFTYPE* MIL_GRA_CUSTOM_FUNCTION_PTR)(MIL_ID        ContextGraId,
+                                                      MIL_ID        DestImageId,
+                                                      MIL_INT64     DrawType,
+                                                      const void*   DrawData,
+                                                      const MIL_INT SizeX,
+                                                      const MIL_INT SizeY,
+                                                      MIL_ID        NativeCalibration,
+                                                      MIL_INT64     NativeConversion,
+                                                      MIL_INT64     ConvertMode,
+                                                      MIL_INT64     ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraCustom           (MIL_ID ContextGraId,
+                                     MIL_ID DestImageOrGraphicListId,
+                                     MIL_INT64 DrawType,
+                                     MIL_GRA_CUSTOM_FUNCTION_PTR CustomDrawPtr,
+                                     const void* DrawData,
+                                     MIL_INT DrawDataSizeByte,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraCustomEx         (MIL_ID ContextGraId,
+                                     MIL_ID DestImageOrGraphicListId,
+                                     MIL_INT64 DrawType,
+                                     MIL_GRA_CUSTOM_FUNCTION_PTR CustomDrawPtr,
+                                     const void* DrawData,
+                                     MIL_INT DrawDataSizeByte,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID NativeCalibration,
+                                     MIL_INT64 NativeUnits,
+                                     MIL_INT64 ConvertMode);
+
+MIL_DLLFUNC void MFTYPE    MgraInteractive      (MIL_ID ContextGraId,
+                                     MIL_ID ListGraId,
+                                     MIL_INT64 GraphicType,
+                                     MIL_INT64 InitFlag,
+                                     MIL_INT64 CreationMode);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsDouble    (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumVectors,
+                                     const MIL_DOUBLE *XArrayPtr,
+                                     const MIL_DOUBLE *YArrayPtr,
+                                     const MIL_DOUBLE *UArrayPtr,
+                                     const MIL_DOUBLE *VArrayPtr,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsFloat     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumVectors,
+                                     const MIL_FLOAT *XArrayPtr,
+                                     const MIL_FLOAT *YArrayPtr,
+                                     const MIL_FLOAT *UArrayPtr,
+                                     const MIL_FLOAT *VArrayPtr,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsInt32     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumVectors,
+                                     const MIL_INT32 *XArrayPtr,
+                                     const MIL_INT32 *YArrayPtr,
+                                     const MIL_INT32 *UArrayPtr,
+                                     const MIL_INT32 *VArrayPtr,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsInt64     (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_INT NumVectors,
+                                     const MIL_INT64 *XArrayPtr,
+                                     const MIL_INT64 *YArrayPtr,
+                                     const MIL_INT64 *UArrayPtr,
+                                     const MIL_INT64 *VArrayPtr,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MgraVectorsGrid      (MIL_ID ContextGraId,
+                                     MIL_ID DstImageBufOrListGraId,
+                                     MIL_ID UImageBufId,
+                                     MIL_ID VImageBufId,
+                                     MIL_INT Stride,
+                                     MIL_INT64 ScaleMode,
+                                     MIL_DOUBLE ScaleValue,
+                                     MIL_INT64 ControlFlag);
+
+/* -------------------------------------------------------------- */
+
+
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* SEQUENCE MODULE:                                                        */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+
+typedef MIL_HOOK_FUNCTION_PTR MIL_SEQ_HOOK_FUNCTION_PTR;
+
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT|| M_COMPILING_MILDLL
+
+MIL_DLLFUNC MIL_ID MFTYPE MseqAlloc(MIL_ID SystemId,
+                        MIL_INT64 SequenceType,
+                        MIL_INT64 Operation,
+                        MIL_UINT32 OutputFormat,
+                        MIL_INT64 InitFlag,
+                        MIL_ID* ContextSeqIdPtr);
+
+MIL_DLLFUNC void MFTYPE MseqFree(MIL_ID ContextSeqId);
+
+MIL_DLLFUNC void MFTYPE MseqDefine(MIL_ID ContextSeqId,
+                       MIL_INT SequenceIndex,
+                       MIL_INT64 SequenceType,
+                       const void *Param1Ptr,
+                       MIL_DOUBLE Param2);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE MseqControlInt64( MIL_ID ContextSeqId,
+                              MIL_INT SequenceIndex,
+                              MIL_INT64 ControlType,
+                              MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE MseqControlDouble(MIL_ID ContextSeqId,
+                              MIL_INT SequenceIndex,
+                              MIL_INT64 ControlType,
+                              MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MseqControlDouble MseqControl
+#define MseqControlInt64  MseqControl
+MIL_DLLFUNC void MFTYPE MseqControl(   MIL_ID ContextSeqId,
+                           MIL_INT SequenceIndex,
+                           MIL_INT64 ControlType,
+                           MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC MIL_INT MFTYPE MseqInquire( MIL_ID ContextSeqId,
+                              MIL_INT SequenceIndex,
+                              MIL_INT64 InquireType,
+                              void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MseqHookFunction( MIL_ID ContextSeqId,
+                              MIL_INT HookType,
+                              MIL_SEQ_HOOK_FUNCTION_PTR HookHandlerPtr,
+                              void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MseqGetHookInfo(  MIL_ID EventId,
+                              MIL_INT64 InfoType,
+                              void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MseqFeed(MIL_ID ContextSeqId,
+                     MIL_ID ImageBufId,
+                     MIL_INT64 InitFlag);
+
+MIL_DLLFUNC void MFTYPE MseqProcess(MIL_ID ContextSeqId,
+                        MIL_INT64 Command,
+                        MIL_INT64 CommandFlag);
+#endif 
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* DATA GENERATION MODULE:                                                 */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* DATA BUFFERS: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MgenLutRamp          (MIL_ID LutBufId,
+                                     MIL_INT StartIndex,
+                                     MIL_DOUBLE StartValue,
+                                     MIL_INT EndIndex,
+                                     MIL_DOUBLE EndValue);
+
+MIL_DLLFUNC void MFTYPE    MgenLutFunction      (MIL_ID LutBufId,
+                                     MIL_INT Func,
+                                     MIL_DOUBLE a,
+                                     MIL_DOUBLE b,
+                                     MIL_DOUBLE c,
+                                     MIL_INT StartIndex,
+                                     MIL_DOUBLE StartXValue,
+                                     MIL_INT EndIndex);
+
+MIL_DLLFUNC void MFTYPE    MgenWarpParameter    (MIL_ID     SrcArrayBufId,
+                                     MIL_ID     DstXLutOrArrayBufId,
+                                     MIL_ID     DstYLutBufId,
+                                     MIL_INT    OperationMode,
+                                     MIL_INT    Transform,
+                                     MIL_DOUBLE Val1,
+                                     MIL_DOUBLE Val2);
+
+MIL_DLLFUNC void MFTYPE    MgenRamp(MIL_ID      BufId,
+                                    MIL_DOUBLE  ScaleX,
+                                    MIL_DOUBLE  ScaleY,
+                                    MIL_DOUBLE  Offset,
+                                    MIL_INT64   ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* DATA BUFFERS MODULE:                                                    */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CREATION: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAlloc1d          (MIL_ID SystemId,
+                                     MIL_INT SizeX,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAlloc2d          (MIL_ID SystemId,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAllocColor       (MIL_ID SystemId,
+                                     MIL_INT SizeBand,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAllocContainer(MIL_ID SystemId,
+                                              MIL_INT64 Attribute,
+                                              MIL_INT64 ControlFlag,
+                                              MIL_ID* ContainerBufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufAllocDefault(MIL_ID SystemId,
+                                            MIL_ID ReferenceDigId,
+                                            MIL_INT64 Attribute,
+                                            MIL_INT64 ControlFlag,
+                                            MIL_INT64 ControlValue,
+                                            MIL_ID* VarContainerOrBufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChild1d          (MIL_ID ParentBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT SizeX,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChild2d          (MIL_ID  ParentBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChildColor       (MIL_ID  ParentBufId,
+                                     MIL_INT Band,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChildColor2d     (MIL_ID  ParentBufId,
+                                     MIL_INT Band,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufChildColor2dClip (MIL_ID  ParentBufId,
+                                     MIL_INT Band,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT* StatusPtr,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufChildContainer(MIL_ID ParentContainerBufId,
+   MIL_INT ComponentCriteriaSize,
+   const MIL_INT64* ComponentCriteriaArrayPtr,
+   MIL_INT64 ControlFlag,
+   MIL_ID* ContainerBufIdPtr);
+
+
+MIL_DLLFUNC void  MFTYPE  MbufChildMove         (MIL_ID  BufId,
+                                     MIL_INT OffsetX,
+                                     MIL_INT OffsetY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufCreateColor      (MIL_ID SystemId,
+                                     MIL_INT SizeBand,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_INT Pitch,
+                                     void* *ArrayOfDataPtr,
+                                     MIL_ID* BufIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE   MbufCreateComponent(MIL_ID ContainerBufId,
+                                                MIL_INT SizeBand,
+                                                MIL_INT SizeX,
+                                                MIL_INT SizeY,
+                                                MIL_INT Type,
+                                                MIL_INT64 Attribute,
+                                                MIL_INT64 ControlFlag,
+                                                MIL_INT Pitch,
+                                                void **ArrayOfDataPtr,
+                                                MIL_INT64 ComponentType,
+                                                MIL_ID*  ComponentIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufClone(MIL_ID SrcContainerOrBufId,
+                                     MIL_ID SysId,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Type,
+                                     MIL_INT64 Attribute,
+                                     MIL_INT64 ControlFlag,
+                                     MIL_ID* VarContainerOrBufIdPtr);
+
+#ifdef M_USE_MBUFBLIT
+/*void MFTYPE  MbufBlit                (MIL_ID  SrcBufId,
+                                              MIL_ID  DstBufId,
+                                              LPMBLTDESC pBltDesc);*/
+#define MbufBlit(srcID,dstID,pBltDesc)        MbufTransfer(srcID,                \
+                                                           dstID,                \
+                                                           0,                    \
+                                                           0,                    \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           0,                    \
+                                                           0,                    \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           M_DEFAULT,            \
+                                                           M_MTX0_METHOD,        \
+                                                           M_DEFAULT,            \
+                                                           pBltDesc)
+#endif
+
+
+MIL_DLLFUNC MIL_ID MFTYPE  MbufCreate2dFunc      (MIL_ID SystemId,
+                                      MIL_INT SizeX,
+                                      MIL_INT SizeY,
+                                      MIL_INT Type,
+                                      MIL_INT64 Attribute,
+                                      MIL_INT64 ControlFlag,
+                                      MIL_INT Pitch,
+                                      MIL_DATA_PTR DataPtr,
+                                      MIL_ID* BufIdPtr);
+
+#define CAST_TO_64BIT_WITHOUT_SIGN_EXTENSION(X) ((MIL_ADDR)(X))
+
+#define MbufCreate2d(SystemId, SizeX, SizeY, Type, Attribute, ControlFlag, Pitch, DataPtr, IdVarPtr) \
+        MbufCreate2dFunc(SystemId, SizeX, SizeY, Type, Attribute, ControlFlag, Pitch, CAST_TO_64BIT_WITHOUT_SIGN_EXTENSION(DataPtr), IdVarPtr)
+
+MIL_DLLFUNC void MFTYPE    MbufFree             (MIL_ID BufOrContainerBufId);
+
+/* -------------------------------------------------------------- */
+/* -------------------------------------------------------------- */
+
+/* HOOK: */
+
+/* -------------------------------------------------------------- */
+
+typedef MIL_HOOK_FUNCTION_PTR MBUFHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_BUF_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void    MFTYPE    MbufHookFunction(MIL_ID ContainerOrBufId,
+                                             MIL_INT HookType,
+                                             MIL_BUF_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                             void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MbufGetHookInfo(MIL_ID EventId,
+                                             MIL_INT64 InfoType,
+                                             void* UserVarPtr);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* ACCESS: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MbufClearDouble(MIL_ID DstContainerOrBufId,
+                                     MIL_DOUBLE Color);
+
+MIL_DLLFUNC void MFTYPE    MbufCopy             (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyColor        (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_INT Band);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyColor2d      (MIL_ID  SrcBufId,
+                                     MIL_ID  DstBufId,
+                                     MIL_INT SrcBand,
+                                     MIL_INT SrcOffX,
+                                     MIL_INT SrcOffY,
+                                     MIL_INT DstBand,
+                                     MIL_INT DstOffX,
+                                     MIL_INT DstOffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyClip         (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_INT DestOffX,
+                                     MIL_INT DestOffY);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyMask         (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_INT64 MaskValue);
+
+MIL_DLLFUNC void MFTYPE    MbufCopyCondDouble   (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_ID CondBufId,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondValue);
+
+MIL_DLLFUNC void MFTYPE    MbufClearCondDouble  (MIL_ID DstBufId,
+                                     MIL_DOUBLE RedOrMonoVal,
+                                     MIL_DOUBLE GreenVal,
+                                     MIL_DOUBLE BlueVal,
+                                     MIL_ID CondBufId,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondValue);
+
+MIL_DLLFUNC void MFTYPE    MbufGetLine          (MIL_ID ImageBufId,
+                                     MIL_INT StartX,
+                                     MIL_INT StartY,
+                                     MIL_INT EndX,
+                                     MIL_INT EndY,
+                                     MIL_INT64 Mode,
+                                     MIL_INT* NbPixelsPtr,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetListDouble    (MIL_ID SrcBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_DOUBLE *PixXArrayPtr,
+                                     const MIL_DOUBLE *PixYArrayPtr,
+                                     MIL_INT64 InterpolationMode,
+                                     void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetListInt32     (MIL_ID SrcBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_INT32 *PixXArrayPtr,
+                                     const MIL_INT32 *PixYArrayPtr,
+                                     MIL_INT64 InterpolationMode,
+                                     void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetListInt64     (MIL_ID SrcBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_INT64 *PixXArrayPtr,
+                                     const MIL_INT64 *PixYArrayPtr,
+                                     MIL_INT64 InterpolationMode,
+                                     void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE MbufLink    (MIL_ID SrcContainerOrBufId,
+                                     MIL_ID TargetContainerOrBufId,
+                                     MIL_INT64 LinkOperation,
+                                     MIL_INT ControlFlag);
+
+
+MIL_DLLFUNC void MFTYPE    MbufPut1d            (MIL_ID DestBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT SizeX,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPut2d            (MIL_ID DestBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutColor         (MIL_ID DestBufId,
+                                     MIL_INT64 DataFormat,
+                                     MIL_INT Band,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutColor2d       (MIL_ID DestBufId,
+                                     MIL_INT64 DataFormat,
+                                     MIL_INT Band,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutLine          (MIL_ID ImageBufId,
+                                     MIL_INT StartX,
+                                     MIL_INT StartY,
+                                     MIL_INT EndX,
+                                     MIL_INT EndY,
+                                     MIL_INT64 Mode,
+                                     MIL_INT* NbPixelsPtr,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutListDouble    (MIL_ID DestBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_DOUBLE *PixXArrayPtr,
+                                     const MIL_DOUBLE *PixYArrayPtr,
+                                     MIL_INT64 OverscanMode,
+                                     const void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutListInt32     (MIL_ID DestBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_INT32 *PixXArrayPtr,
+                                     const MIL_INT32 *PixYArrayPtr,
+                                     MIL_INT64 OverscanMode,
+                                     const void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPutListInt64     (MIL_ID DestBufId,
+                                     MIL_INT NumPixels,
+                                     const MIL_INT64 *PixXArrayPtr,
+                                     const MIL_INT64 *PixYArrayPtr,
+                                     MIL_INT64 OverscanMode,
+                                     const void *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufPut              (MIL_ID DestBufId,
+                                     const void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGet1d            (MIL_ID  SrcBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT SizeX,
+                                     void   *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGet2d            (MIL_ID  SrcBufId,
+                                     MIL_INT OffX,
+                                     MIL_INT OffY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     void   *UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetColor         (MIL_ID SrcBufId,
+                                     MIL_INT64 DataFormat,
+                                     MIL_INT Band,
+                                     void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGet(MIL_ID SrcBufId,
+                                   void* UserArrayPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetColor2dAsync(MIL_ID    SrcBufId,
+                                             MIL_INT64 DataFormat,
+                                             MIL_INT   Band,
+                                             MIL_INT   OffX,
+                                             MIL_INT   OffY,
+                                             MIL_INT   SizeX,
+                                             MIL_INT   SizeY,
+                                             void     *UserArrayPtr,
+                                             MIL_INT64 UserArrayInSize,
+                                             MIL_INT64 OperationFlag,
+                                             MIL_BUF_HOOK_FUNCTION_PTR CallbackFct,
+                                             void* CallbackDataPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetAsync(MIL_ID SrcBufId,
+                                       void* UserArrayPtr,
+                                       MIL_INT64 UserArrayInSize,
+                                       MIL_INT64 OperationFlag,
+                                       MIL_BUF_HOOK_FUNCTION_PTR CallbackFct,
+                                       void* CallbackDataPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufGetColor2d       (MIL_ID    SrcBufId,
+                                     MIL_INT64 DataFormat,
+                                     MIL_INT   Band,
+                                     MIL_INT   OffX,
+                                     MIL_INT   OffY,
+                                     MIL_INT   SizeX,
+                                     MIL_INT   SizeY,
+                                     void     *UserArrayPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufGetArc2 (MIL_ID     ImageBufId,
+                                        MIL_INT    XCenter,
+                                        MIL_INT    YCenter,
+                                        MIL_INT    XRad,
+                                        MIL_INT    YRad,
+                                        MIL_DOUBLE StartAngle,
+                                        MIL_DOUBLE EndAngle,
+                                        MIL_INT64  Mode,
+                                        MIL_INT*   NbPixelsPtr,
+                                        void*      ValueArrayPtr,
+                                        void*      PosXArrayPtr,
+                                        void*      PosYArrayPtr);
+
+
+#ifndef __cplusplus
+
+
+// The default in C is the use of the old API until MIL 11.
+#ifndef M_USE_OLD_MBUFGETARC_API_IN_C
+#define M_USE_OLD_MBUFGETARC_API_IN_C 1
+#endif
+
+#if M_USE_OLD_MBUFGETARC_API_IN_C
+#define MbufGetArc(ImageBufId, XCenter, YCenter, XRad, YRad, StartAngle, EndAngle, UserArrayPtr, NbPixelsPtr)     \
+        MbufGetArc2(ImageBufId, XCenter, YCenter, XRad, YRad, StartAngle, EndAngle, M_DEFAULT, NbPixelsPtr, UserArrayPtr, M_NULL, M_NULL);
+#else
+#define MbufGetArc   MbufGetArc2
+#endif
+
+
+
+#endif
+
+
+
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufInquire          (MIL_ID BufId,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufInquireContainer(MIL_ID ContainerBufId,
+                                                MIL_INT64 Component,
+                                                MIL_INT64 InquireType,
+                                                void* UserVarPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufAllocComponent(MIL_ID ContainerBufId,
+                                             MIL_INT SizeBand,
+                                             MIL_INT SizeX,
+                                             MIL_INT SizeY,
+                                             MIL_INT Type,
+                                             MIL_INT64 Attribute,
+                                             MIL_INT64 ComponentType,
+                                             MIL_ID* ComponentIdPtr);
+
+MIL_DLLFUNC void MFTYPE MbufCopyComponent(MIL_ID SrcContainerOrBufId,
+                                          MIL_ID DstContainerBufId,
+                                          MIL_INT64 SrcComponent,
+                                          MIL_INT64 Operation,
+                                          MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MbufFreeComponent(MIL_ID ContainerBufId,
+   MIL_INT64 Component,
+   MIL_INT64 ControlFlag);
+
+#if M_MIL_USE_UNICODE
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufAllocColorNamedA(MIL_ID SystemId,
+                                                MIL_INT SizeBand,
+                                                MIL_INT SizeX,
+                                                MIL_INT SizeY,
+                                                MIL_INT Type,
+                                                MIL_INT64 Attribute,
+                                                MIL_CONST_TEXTA_PTR BufferNamePtr,
+                                                MIL_ID *BufIdPtr);
+
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufDiskInquireA     (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+MIL_DLLFUNC void MFTYPE    MbufSaveA            (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID ContainerOrBufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufRestoreA         (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID SystemId,
+                                     MIL_ID* BufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufLoadA            (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_ID BufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufImportA          (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SysId,
+                                     MIL_ID* ContainerOrBufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufExportA          (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_ID SrcContainerOrBufId);
+MIL_DLLFUNC void MFTYPE    MbufExportSequenceA  (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     const MIL_ID *BufArrayPtrOrSystemIdPtr,
+                                     MIL_INT NumOfIds,
+                                     MIL_DOUBLE FrameRate,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MbufImportSequenceA  (MIL_CONST_TEXTA_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SystemId,
+                                     MIL_ID *BufArrayPtr,
+                                     MIL_INT StartImage,
+                                     MIL_INT NumberOfImages,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufAllocColorNamedW(MIL_ID SystemId,
+                                                MIL_INT SizeBand,
+                                                MIL_INT SizeX,
+                                                MIL_INT SizeY,
+                                                MIL_INT Type,
+                                                MIL_INT64 Attribute,
+                                                MIL_CONST_TEXTW_PTR BufferNamePtr,
+                                                MIL_ID *BufIdPtr);
+
+
+MIL_DLLFUNC MIL_INT MFTYPE MbufDiskInquireW     (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 InquireType,
+                                     void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufSaveW            (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID ContainerOrBufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufRestoreW         (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID SystemId,
+                                     MIL_ID* BufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufLoadW            (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_ID BufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufImportW          (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SysId,
+                                     MIL_ID* ContainerOrBufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufExportW          (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_ID SrcContainerOrBufId);
+MIL_DLLFUNC void MFTYPE    MbufExportSequenceW  (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     const MIL_ID *BufArrayPtrOrSystemIdPtr,
+                                     MIL_INT NumOfIds,
+                                     MIL_DOUBLE FrameRate,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MbufImportSequenceW  (MIL_CONST_TEXTW_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SystemId,
+                                     MIL_ID *BufArrayPtr,
+                                     MIL_INT StartImage,
+                                     MIL_INT NumberOfImages,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE MbufControlFeatureW    (MIL_ID BufId,
+                                                MIL_INT64 ControlType,
+                                                MIL_CONST_TEXTW_PTR FeatureName,
+                                                MIL_INT64 UserVarType,
+                                                const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufInquireFeatureW    (MIL_ID BufId,
+                                                MIL_INT64 InquireType,
+                                                MIL_CONST_TEXTW_PTR FeatureName,
+                                                MIL_INT64 UserVarType,
+                                                void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufControlFeatureA    (MIL_ID BufId,
+                                                MIL_INT64 ControlType,
+                                                MIL_CONST_TEXTA_PTR FeatureName,
+                                                MIL_INT64 UserVarType,
+                                                const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufInquireFeatureA(MIL_ID BufId,
+                                            MIL_INT64 InquireType,
+                                            MIL_CONST_TEXTA_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufStreamW(MIL_TEXTW_PTR MemPtrOrFileName,
+                                    MIL_ID       SystemId,
+                                    MIL_INT64       Operation,
+                                    MIL_INT64       StreamType,
+                                    MIL_DOUBLE   Version,
+                                    MIL_INT64       ControlFlag,
+                                    MIL_ID *     ContainerOrBufIdPtr,
+                                    MIL_INT *    SizeByteVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufStreamA(MIL_TEXTA_PTR MemPtrOrFileName,
+                                    MIL_ID       SystemId,
+                                    MIL_INT64       Operation,
+                                    MIL_INT64       StreamType,
+                                    MIL_DOUBLE   Version,
+                                    MIL_INT64       ControlFlag,
+                                    MIL_ID *     ContainerOrBufIdPtr,
+                                    MIL_INT *    SizeByteVarPtr);
+
+
+#if M_MIL_UNICODE_API
+#define MbufAllocColorNamed   MbufAllocColorNamedW
+#define MbufExportSequence    MbufExportSequenceW
+#define MbufImportSequence    MbufImportSequenceW
+#define MbufDiskInquire       MbufDiskInquireW
+#define MbufSave              MbufSaveW
+#define MbufStream            MbufStreamW
+#define MbufRestore           MbufRestoreW
+#define MbufLoad              MbufLoadW
+#define MbufImport            MbufImportW
+#define MbufExport            MbufExportW
+#define MbufControlFeature    MbufControlFeatureW
+#define MbufInquireFeature    MbufInquireFeatureW
+#else
+#define MbufAllocColorNamed   MbufAllocColorNamedA
+#define MbufExportSequence    MbufExportSequenceA
+#define MbufImportSequence    MbufImportSequenceA
+#define MbufDiskInquire       MbufDiskInquireA
+#define MbufSave              MbufSaveA
+#define MbufStream            MbufStreamA
+#define MbufRestore           MbufRestoreA
+#define MbufLoad              MbufLoadA
+#define MbufImport            MbufImportA
+#define MbufExport            MbufExportA
+#define MbufControlFeature    MbufControlFeatureA
+#define MbufInquireFeature    MbufInquireFeatureA
+#endif
+#else
+
+MIL_DLLFUNC MIL_ID MFTYPE MbufAllocColorNamed(MIL_ID SystemId,
+                                                MIL_INT SizeBand,
+                                                MIL_INT SizeX,
+                                                MIL_INT SizeY,
+                                                MIL_INT Type,
+                                                MIL_INT64 Attribute,
+                                                MIL_CONST_TEXT_PTR BufferNamePtr,
+                                                MIL_ID *BufIdPtr);
+
+
+MIL_DLLFUNC MIL_INT     MFTYPE    MbufDiskInquire(MIL_CONST_TEXT_PTR FileName,
+                                      MIL_INT64 InquireType,
+                                      void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufSave             (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID ContainerOrBufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufRestore          (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID SystemId,
+                                     MIL_ID* BufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufLoad             (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_ID BufId);
+MIL_DLLFUNC MIL_ID MFTYPE  MbufImport           (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SystemId,
+                                     MIL_ID* BufIdPtr);
+MIL_DLLFUNC void MFTYPE    MbufExport           (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_ID SrcContainerOrBufId);
+MIL_DLLFUNC void MFTYPE    MbufExportSequence   (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     const MIL_ID *BufArrayPtrOrSystemIdPtr,
+                                     MIL_INT NumOfIds,
+                                     MIL_DOUBLE FrameRate,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE    MbufImportSequence   (MIL_CONST_TEXT_PTR FileName,
+                                     MIL_INT64 FileFormat,
+                                     MIL_INT64 Operation,
+                                     MIL_ID SystemId,
+                                     MIL_ID *BufArrayPtr,
+                                     MIL_INT StartImage,
+                                     MIL_INT NumberOfImages,
+                                     MIL_INT64 ControlFlag);
+MIL_DLLFUNC void MFTYPE MbufControlFeature(MIL_ID BufId,
+                                           MIL_INT64 ControlType,
+                                           MIL_CONST_TEXT_PTR FeatureName,
+                                           MIL_INT64 UserVarType,
+                                           const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufInquireFeature(MIL_ID BufId,
+                                           MIL_INT64 InquireType,
+                                           MIL_CONST_TEXT_PTR FeatureName,
+                                           MIL_INT64 UserVarType,
+                                           void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MbufStream(MIL_TEXT_PTR MemPtrOrFileName,
+                                    MIL_ID       SystemId,
+                                    MIL_INT64       Operation,
+                                    MIL_INT64       StreamType,
+                                    MIL_DOUBLE   Version,
+                                    MIL_INT64       ControlFlag,
+                                    MIL_ID *     ContainerOrBufIdPtr,
+                                    MIL_INT *    SizeByteVarPtr);
+#endif
+
+MIL_DLLFUNC void MFTYPE    MbufControlAreaDouble(MIL_ID  BufId,
+                                     MIL_INT OffsetX,
+                                     MIL_INT OffsetY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Band,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue);
+#define MbufModified2d(BufId, OffsetX, OffsetY, SizeX, SizeY) \
+        MbufControlAreaDouble(BufId, OffsetX, OffsetY, SizeX, SizeY, M_ALL_BAND, M_MODIFIED, M_DEFAULT)
+
+
+MIL_DLLFUNC void MFTYPE    MbufCompression      (MIL_ID SrcImageId,
+                                     MIL_ID DestImageId,
+                                     MIL_INT ControlValue,
+                                     MIL_INT64 OperationFlag);
+
+MIL_DLLFUNC void MFTYPE    MbufBayer            (MIL_ID SrcImageBufId,
+                                     MIL_ID DestImageBufId,
+                                     MIL_ID CoefOrExpId,
+                                     MIL_INT64 ControlFlag);
+
+MIL_DLLFUNC void MFTYPE    MbufTransfer         (MIL_ID     SrcBufId,
+                                     MIL_ID     DestBufId,
+                                     MIL_INT    SrcOffX,
+                                     MIL_INT    SrcOffY,
+                                     MIL_INT    SrcSizeX,
+                                     MIL_INT    SrcSizeY,
+                                     MIL_INT    SrcBand,
+                                     MIL_INT    DestOffX,
+                                     MIL_INT    DestOffY,
+                                     MIL_INT    DestSizeX,
+                                     MIL_INT    DestSizeY,
+                                     MIL_INT    DestBand,
+                                     MIL_INT64  TransferFunction,
+                                     MIL_INT64  TransferType,
+                                     MIL_INT64  OperationFlag,
+                                     void      *ExtraParameterPtr);
+
+MIL_DLLFUNC void MFTYPE    MbufTransferDouble   (MIL_ID     SrcBufId,
+                                     MIL_ID     DestBufId,
+                                     MIL_DOUBLE SrcOffX,
+                                     MIL_DOUBLE SrcOffY,
+                                     MIL_DOUBLE SrcSizeX,
+                                     MIL_DOUBLE SrcSizeY,
+                                     MIL_INT    SrcBand,
+                                     MIL_INT    DestOffX,
+                                     MIL_INT    DestOffY,
+                                     MIL_INT    DestSizeX,
+                                     MIL_INT    DestSizeY,
+                                     MIL_INT    DestBand,
+                                     MIL_INT64  TransferFunction,
+                                     MIL_INT64  TransferType,
+                                     MIL_INT64  OperationFlag,
+                                     void      *ExtraParameterPtr);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CONTROL: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE MbufControlNeighborhoodMIL_INT(MIL_ID BufId,
+                                                       MIL_INT64 OperationControlType,
+                                                       MIL_INT OperationValue);
+
+#define MbufControlNeighborhood MbufControlNeighborhoodMIL_INT
+
+MIL_DEPRECATED(MbufControlNeighborhood, 1060) // Use MbufControl instead.
+
+#if M_MIL_USE_64BIT || (MIL_COMPILE_VERSION >= 1040)
+
+MIL_DLLFUNC void MFTYPE    MbufControlInt64(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MbufControlDouble(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+
+
+#if !M_MIL_USE_64BIT
+
+MIL_DLLFUNC void MFTYPE    MbufControl(MIL_ID BufId,
+                                        MIL_INT64 ControlType,
+                                        MIL_DOUBLE ControlValue);
+#endif
+
+#else
+// for 32 bit BW compilation
+#define MbufControlDouble MbufControl
+#define MbufControlInt64  MbufControl
+MIL_DLLFUNC void MFTYPE    MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+
+#endif
+MIL_DLLFUNC void MFTYPE MbufControlContainerInt64(MIL_ID ContainerBufId,
+                                                  MIL_INT64 Component,
+                                                  MIL_INT64 ControlType,
+                                                  MIL_INT64 ControlValue);
+MIL_DLLFUNC void MFTYPE MbufControlContainerDouble(MIL_ID ContainerBufId,
+                                                   MIL_INT64 Component,
+                                                   MIL_INT64 ControlType,
+                                                   MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MbufSetRegionDouble     (MIL_ID ImageBufId,
+                                        MIL_ID ImageOrGraphicListId,
+                                        MIL_INT64 Label,
+                                        MIL_INT64 Operation,
+                                        MIL_DOUBLE Param);
+
+MIL_DLLFUNC void  MFTYPE MbufSetDynamicParameters(MIL_ID BufferId,
+                                                  MIL_INT NbBand,
+                                                  MIL_INT SizeX,
+                                                  MIL_INT SizeY,
+                                                  MIL_INT64 Type,
+                                                  MIL_INT64 Attribute,
+                                                  MIL_INT64 ControlFlag,
+                                                  MIL_INT64 ControlValue,
+                                                  MIL_INT Pitch,
+                                                  MIL_INT NbBandOffset,
+                                                  MIL_INT *BandOffset);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* I/O DEVICES:                                                            */
+/***************************************************************************/
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CREATION: */
+
+      /* -------------------------------------------------------------- */
+
+typedef MIL_HOOK_FUNCTION_PTR MDIGHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_DIG_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void MFTYPE    MdigHookFunction     (MIL_ID DigId,
+                                     MIL_INT HookType,
+                                     MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                     void* UserDataPtr);
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC MIL_ID MFTYPE  MdigAllocA           (MIL_ID SystemId,
+                                     MIL_INT DigNum,
+                                     MIL_CONST_TEXTA_PTR DataFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID* DigIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE  MdigAllocW           (MIL_ID SystemId,
+                                     MIL_INT DigNum,
+                                     MIL_CONST_TEXTW_PTR DataFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID* DigIdPtr);
+#if M_MIL_UNICODE_API
+#define MdigAlloc MdigAllocW
+#else
+#define MdigAlloc MdigAllocA
+#endif
+#else
+MIL_DLLFUNC MIL_ID MFTYPE  MdigAlloc            (MIL_ID SystemId,
+                                     MIL_INT DigNum,
+                                     MIL_CONST_TEXT_PTR DataFormat,
+                                     MIL_INT64 InitFlag,
+                                     MIL_ID* DigIdPtr);
+#endif
+
+MIL_DLLFUNC void MFTYPE    MdigFree             (MIL_ID DigId);
+
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+      /* CONTROL: */
+
+      /* -------------------------------------------------------------- */
+
+#if !M_HIDE_DEPRECATED_FROM_INTELLISENSE
+MIL_DLLFUNC void MFTYPE    MdigChannel         (MIL_ID DigId,
+                                    MIL_INT64 Channel);
+MIL_DEPRECATED(MdigChannel, 1000)
+
+MIL_DLLFUNC void MFTYPE    MdigReference       (MIL_ID  DigId,
+                                    MIL_INT64 ReferenceType,
+                                    MIL_DOUBLE ReferenceLevel);
+MIL_DEPRECATED(MdigReference, 1000)
+
+MIL_DLLFUNC void MFTYPE    MdigLut             (MIL_ID DigId,
+                                    MIL_ID LutBufId);
+MIL_DEPRECATED(MdigLut, 1000)
+#endif
+
+MIL_DLLFUNC void MFTYPE    MdigHalt            (MIL_ID DigId);
+
+MIL_DLLFUNC MIL_INT MFTYPE MdigInquire         (MIL_ID DigId,
+                                    MIL_INT64 InquireType,
+                                    void* UserVarPtr);
+
+#if M_MIL_USE_64BIT || (MIL_COMPILE_VERSION >= 1040)
+MIL_DLLFUNC void MFTYPE    MdigControlInt64(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MdigControlDouble(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+
+#if !M_MIL_USE_64BIT
+// Prototypes for 32 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MdigControl         (MIL_ID DigId,
+                                    MIL_INT64 ControlType,
+                                    MIL_DOUBLE ControlValue);
+#endif
+
+#else
+// for 32 bit BW compilation
+
+#define MdigControlDouble MdigControl
+#define MdigControlInt64  MdigControl
+MIL_DLLFUNC void MFTYPE    MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC void MFTYPE    MdigGrabWait        (MIL_ID DigId,
+                                    MIL_INT64 ControlFlag);
+
+      /* -------------------------------------------------------------- */
+      /* -------------------------------------------------------------- */
+
+       /* ACCESS: */
+
+      /* -------------------------------------------------------------- */
+
+MIL_DLLFUNC void MFTYPE    MdigGrab            (MIL_ID DigId,
+                                    MIL_ID DstContainerOrImageBufId);
+
+MIL_DLLFUNC void MFTYPE    MdigGrabContinuous  (MIL_ID DigId,
+                                    MIL_ID DestContainerOrImageBufId);
+
+MIL_DLLFUNC void MFTYPE    MdigProcess (MIL_ID DigId,
+                                    const MIL_ID* DestContainerOrImageBufArrayPtr,
+                                    MIL_INT ImageCount,
+                                    MIL_INT64 Operation,
+                                    MIL_INT64 OperationFlag,
+                                    MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                    void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MdigGetHookInfo  (MIL_ID EventId,
+                                    MIL_INT64 InfoType,
+                                    void* UserVarPtr);
+
+typedef MIL_INT (MFTYPE *MIL_FOCUS_HOOK_FUNCTION_PTR)(MIL_INT HookType,
+                                                      MIL_INT position,
+                                                      void* UserDataPtr);
+typedef MIL_FOCUS_HOOK_FUNCTION_PTR MFOCUSHOOKFCTPTR;
+
+MIL_DLLFUNC void MFTYPE    MdigFocus           (MIL_ID DigId,
+                                    MIL_ID DestImageBufId,
+                                    MIL_ID FocusImageRegionBufId,
+                                    MIL_FOCUS_HOOK_FUNCTION_PTR FocusHookPtr,
+                                    void* UserDataPtr,
+                                    MIL_INT MinPosition,
+                                    MIL_INT StartPosition,
+                                    MIL_INT MaxPosition,
+                                    MIL_INT MaxPositionVariation,
+                                    MIL_INT64 Operation,
+                                    MIL_INT *ResultPtr);
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC void MFTYPE MdigControlFeatureW    (MIL_ID DigId,
+                                    MIL_INT64 ControlType,
+                                    MIL_CONST_TEXTW_PTR FeatureName,
+                                    MIL_INT64 UserVarType,
+                                    const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MdigInquireFeatureW    (MIL_ID DigId,
+                                    MIL_INT64 InquireType,
+                                    MIL_CONST_TEXTW_PTR FeatureName,
+                                    MIL_INT64 UserVarType,
+                                    void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MdigControlFeatureA    (MIL_ID DigId,
+                                    MIL_INT64 ControlType,
+                                    MIL_CONST_TEXTA_PTR FeatureName,
+                                    MIL_INT64 UserVarType,
+                                    const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MdigInquireFeatureA    (MIL_ID DigId,
+                                    MIL_INT64 InquireType,
+                                    MIL_CONST_TEXTA_PTR FeatureName,
+                                    MIL_INT64 UserVarType,
+                                    void* UserVarPtr);
+
+#if M_MIL_UNICODE_API
+#define MdigControlFeature MdigControlFeatureW
+#define MdigInquireFeature MdigInquireFeatureW
+#else
+#define MdigControlFeature MdigControlFeatureA
+#define MdigInquireFeature MdigInquireFeatureA
+#endif
+#else
+
+MIL_DLLFUNC void MFTYPE MdigControlFeature    (MIL_ID DigId,
+                                   MIL_INT64 ControlType,
+                                   MIL_CONST_TEXT_PTR FeatureName,
+                                   MIL_INT64 UserVarType,
+                                   const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MdigInquireFeature    (MIL_ID DigId,
+                                   MIL_INT64 InquireType,
+                                   MIL_CONST_TEXT_PTR FeatureName,
+                                   MIL_INT64 UserVarType,
+                                   void* UserVarPtr);
+#endif
+
+
+
+      /* -------------------------------------------------------------- */
+
+/***************************************************************************/
+/* SYSTEM MODULE:                                                          */
+/***************************************************************************/
+
+typedef MIL_HOOK_FUNCTION_PTR MSYSHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_SYS_HOOK_FUNCTION_PTR;
+
+MIL_DLLFUNC void MFTYPE MsysHookFunction        (MIL_ID                    SysId,
+                                     MIL_INT                   HookType,
+                                     MIL_SYS_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                     void*                     UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE  MsysGetHookInfo     (MIL_ID     SysId,
+                                     MIL_ID     EventId,
+                                     MIL_INT64  InquireType,
+                                     void*      UserVarPtr);
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC MIL_ID MFTYPE MsysAllocW            (MIL_ID             ContextAppId,
+                                     MIL_CONST_TEXTW_PTR SystemDescriptor,
+                                     MIL_INT            SystemNum,
+                                     MIL_INT64          InitFlag,
+                                     MIL_ID*            SysIdPtr);
+
+MIL_DLLFUNC MIL_ID MFTYPE MsysAllocA            (MIL_ID             ContextAppId,
+                                     MIL_CONST_TEXTA_PTR        SystemDescriptor,
+                                     MIL_INT            SystemNum,
+                                     MIL_INT64          InitFlag,
+                                     MIL_ID*            SysIdPtr);
+
+
+MIL_DLLFUNC void MFTYPE MsysControlFeatureW(MIL_ID SysId,
+                                            MIL_INT64 ControlType,
+                                            MIL_CONST_TEXTW_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MsysInquireFeatureW(MIL_ID SysId,
+                                            MIL_INT64 InquireType,
+                                            MIL_CONST_TEXTW_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MsysControlFeatureA(MIL_ID SysId,
+                                            MIL_INT64 ControlType,
+                                            MIL_CONST_TEXTA_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MsysInquireFeatureA(MIL_ID SysId,
+                                            MIL_INT64 InquireType,
+                                            MIL_CONST_TEXTA_PTR FeatureName,
+                                            MIL_INT64 UserVarType,
+                                            void* UserVarPtr);
+
+#if M_MIL_UNICODE_API
+#define MsysAlloc MsysAllocW
+#define MsysControlFeature MsysControlFeatureW
+#define MsysInquireFeature MsysInquireFeatureW
+#else
+#define MsysAlloc MsysAllocA
+#define MsysControlFeature MsysControlFeatureA
+#define MsysInquireFeature MsysInquireFeatureA
+#endif
+
+#else
+MIL_DLLFUNC MIL_ID MFTYPE MsysAlloc             (MIL_ID             ContextAppId,
+                                     MIL_CONST_TEXT_PTR SystemDescriptor,
+                                     MIL_INT            SystemNum,
+                                     MIL_INT64          InitFlag,
+                                     MIL_ID*            SysIdPtr);
+
+
+MIL_DLLFUNC void MFTYPE MsysControlFeature(MIL_ID SysId,
+                                           MIL_INT64 ControlType,
+                                           MIL_CONST_TEXT_PTR FeatureName,
+                                           MIL_INT64 UserVarType,
+                                           const void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE MsysInquireFeature(MIL_ID SysId,
+                                           MIL_INT64 InquireType,
+                                           MIL_CONST_TEXT_PTR FeatureName,
+                                           MIL_INT64 UserVarType,
+                                           void* UserVarPtr);
+#endif
+
+
+
+MIL_DLLFUNC void MFTYPE  MsysFree               (MIL_ID     SysId);
+
+MIL_DLLFUNC MIL_INT MFTYPE  MsysInquire         (MIL_ID     SysId,
+                                     MIL_INT64  InquireType,
+                                     void*      UserVarPtr);
+
+MIL_DLLFUNC void      MFTYPE  MsysControlDouble(MIL_ID     SysId,
+                                                MIL_INT64  ControlType,
+                                                MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC void      MFTYPE  MsysControlInt64(MIL_ID     SysId,
+                                               MIL_INT64  ControlType,
+                                               MIL_INT64  ControlValue);
+
+MIL_DLLFUNC void MFTYPE MsysConfigAccess        (MIL_ID     SystemId,
+                                     MIL_INT    VendorId,
+                                     MIL_INT    DeviceId,
+                                     MIL_INT    DeviceNum,
+                                     MIL_INT64  OperationFlag,
+                                     MIL_INT64  OperationType,
+                                     MIL_INT    Offset,
+                                     MIL_INT    Size,
+                                     void*      UserArrayPtr);
+
+MIL_DLLFUNC MIL_ID    MFTYPE  MsysIoAlloc(MIL_ID SysId,
+                                          MIL_INT64 IoCmdListNum,
+                                          MIL_INT64 Type,
+                                          MIL_INT64 CounterSrc,
+                                          MIL_ID* IoCmdListSysIdPtr);
+
+MIL_DLLFUNC void      MFTYPE  MsysIoFree(MIL_ID IoCmdListSysId);
+
+MIL_DLLFUNC MIL_INT   MFTYPE  MsysIoInquire(MIL_ID IoCmdListSysId,
+                                            MIL_INT64 InquireType,
+                                            void* UserVarPtr);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void      MFTYPE  MsysIoControlInt64(MIL_ID IoCmdListSysId,
+                                                 MIL_INT64 ControlType,
+                                                 MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void      MFTYPE  MsysIoControlDouble(MIL_ID IoCmdListSysId,
+                                                  MIL_INT64 ControlType,
+                                                  MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MsysIoControlDouble MsysIoControl
+#define MsysIoControlInt64  MsysIoControl
+MIL_DLLFUNC void      MFTYPE  MsysIoControl(MIL_ID IoCmdListSysId,
+                                            MIL_INT64 ControlType,
+                                            MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC MIL_INT   MFTYPE  MsysIoCommandRegister(MIL_ID IoCmdListSysId,
+                                                    MIL_INT64 Operation,
+                                                    MIL_INT64 Reference,
+                                                    MIL_DOUBLE DelayFromReference,
+                                                    MIL_DOUBLE Duration,
+                                                    MIL_INT64 BitToOperate,
+                                                    void* CommandStatusPtr);
+
+/***************************************************************************/
+/* APPLICATION MODULE:                                                     */
+/***************************************************************************/
+
+typedef MIL_HOOK_FUNCTION_PTR MAPPHOOKFCTPTR;
+typedef MIL_HOOK_FUNCTION_PTR MIL_APP_HOOK_FUNCTION_PTR;
+
+#if M_MIL_USE_UNICODE
+   MIL_DLLFUNC MIL_ID MFTYPE     MappAllocA(MIL_CONST_TEXTA_PTR ServerDescription, MIL_INT64 InitFlag, MIL_ID* ContextAppIdPtr);
+
+   MIL_DLLFUNC MIL_ID MFTYPE     MappAllocW              (MIL_CONST_TEXTW_PTR ServerDescription,
+                                              MIL_INT64 InitFlag,
+                                              MIL_ID* ContextAppIdPtr);
+   #if !defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL
+      #if M_MIL_UNICODE_API
+      #define MappAlloc MappAllocW
+      #else
+      #define MappAlloc MappAllocA
+      #endif
+   #endif
+#else
+MIL_DLLFUNC MIL_ID MFTYPE     MappAlloc               (MIL_CONST_TEXT_PTR ServerDescription,
+                                           MIL_INT64 InitFlag,
+                                           MIL_ID* ContextAppIdPtr);
+#endif
+
+
+MIL_DLLFUNC void MFTYPE       MappFree                (MIL_ID ContextAppId);
+
+
+MIL_DLLFUNC void MFTYPE       MappControl             (MIL_ID ContextAppId,
+                                           MIL_INT64 ControlType,
+                                           MIL_INT ControlValue);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappGetError            (MIL_ID ContextAppId,
+                                           MIL_INT64 ErrorType,
+                                           void* ErrorPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappGetHookInfo         (MIL_ID ContextAppId,
+                                           MIL_ID EventId,
+                                           MIL_INT64 InfoType,
+                                           void* UserVarPtr);
+
+MIL_DLLFUNC void MFTYPE       MappHookFunction        (MIL_ID ContextAppId,
+                                           MIL_INT HookType,
+                                           MIL_APP_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                           void* UserDataPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappInquire             (MIL_ID ContextAppId,
+                                           MIL_INT64 InquireType,
+                                           void* UserVarPtr);
+
+MIL_DLLFUNC MIL_DOUBLE MFTYPE MappTimer               (MIL_ID ContextAppId,
+                                           MIL_INT64 ControlType,
+                                           MIL_DOUBLE *TimePtr);
+
+MIL_DLLFUNC void MFTYPE       MappTimerVoid           (MIL_ID ContextAppId,
+                                           MIL_INT64 Mode,
+                                           MIL_DOUBLE *Time);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappInquireMp           (MIL_ID ContextAppId,
+                                           MIL_INT64 InquireType,
+                                           MIL_INT64 TypeFlag,
+                                           MIL_INT64 TypeValue,
+                                           void* UserVarPtr);
+
+MIL_DLLFUNC void    MFTYPE    MappControlMp           (MIL_ID ContextAppId,
+                                           MIL_INT64 ControlType,
+                                           MIL_INT64 TypeFlag,
+                                           MIL_INT64 TypeValue,
+                                           void* ValuePtr);
+
+
+#if M_MIL_USE_UNICODE
+MIL_DLLFUNC void MFTYPE       MappOpenConnectionA     (MIL_CONST_TEXTA_PTR ConnectionDescriptor,
+                                           MIL_INT64 InitFlag,
+                                           MIL_INT64 ControlFlag,
+                                           MIL_ID* RemoteContextAppIdPtr);
+
+MIL_DLLFUNC void MFTYPE       MappOpenConnectionW     (MIL_CONST_TEXTW_PTR ConnectionDescriptor,
+                                           MIL_INT64 InitFlag,
+                                           MIL_INT64 ControlFlag,
+                                           MIL_ID* RemoteContextAppIdPtr);
+
+MIL_DLLFUNC void   MFTYPE     MappFileOperationW      (MIL_ID Comp1ContextAppId, 
+                                           MIL_CONST_TEXTW_PTR Comp1FileName, 
+                                           MIL_ID Comp2ContextAppId, 
+                                           MIL_CONST_TEXTW_PTR Comp2FileName, 
+                                           MIL_INT64 Operation, 
+                                           MIL_INT64 OperationFlag, 
+                                           void *OperationDataPtr);
+
+MIL_DLLFUNC void   MFTYPE     MappFileOperationA      (MIL_ID Comp1ContextAppId, 
+                                           MIL_CONST_TEXTA_PTR Comp1FileName, 
+                                           MIL_ID Comp2ContextAppId, 
+                                           MIL_CONST_TEXTA_PTR Comp2FileName, 
+                                           MIL_INT64 Operation, 
+                                           MIL_INT64 OperationFlag, 
+                                           void *OperationDataPtr);
+
+MIL_DLLFUNC void   MFTYPE     MappTraceA              (MIL_ID ContextAppId,
+                                           MIL_INT64 TraceType,
+                                           MIL_INT64 TraceTag,
+                                           MIL_INT64 TraceValue,
+                                           MIL_CONST_TEXTA_PTR TraceString);
+
+MIL_DLLFUNC void   MFTYPE     MappTraceW              (MIL_ID ContextAppId,
+                                           MIL_INT64 TraceType,
+                                           MIL_INT64 TraceTag,
+                                           MIL_INT64 TraceValue,
+                                           MIL_CONST_TEXTW_PTR TraceString);
+
+#if M_MIL_UNICODE_API
+   #define MappOpenConnection MappOpenConnectionW
+   #define MappTrace MappTraceW
+   #if M_MIL_USE_SAFE_TYPE
+      #define MappFileOperation MappFileOperationSafeTypeW
+   #else
+      #define MappFileOperation MappFileOperationW
+   #endif
+#else
+   #define MappOpenConnection MappOpenConnectionA
+   #define MappTrace MappTraceA
+   #if M_MIL_USE_SAFE_TYPE
+      #define MappFileOperation MappFileOperationSafeTypeA
+   #else
+      #define MappFileOperation MappFileOperationA
+   #endif
+#endif
+#else
+MIL_DLLFUNC void MFTYPE       MappOpenConnection      (MIL_CONST_TEXT_PTR ConnectionDescriptor,
+                                           MIL_INT64 InitFlag,
+                                           MIL_INT64 ControlFlag,
+                                           MIL_ID* RemoteContextAppIdPtr);
+
+
+MIL_DLLFUNC void   MFTYPE     MappFileOperation       (MIL_ID Comp1ContextAppId, 
+                                           MIL_CONST_TEXT_PTR Comp1FileName, 
+                                           MIL_ID Comp2ContextAppId, 
+                                           MIL_CONST_TEXT_PTR Comp2FileName, 
+                                           MIL_INT64 Operation, 
+                                           MIL_INT64 OperationFlag, 
+                                           void *OperationDataPtr);
+
+MIL_DLLFUNC void   MFTYPE     MappTrace               (MIL_ID ContextAppId,
+                                           MIL_INT64 TraceType,
+                                           MIL_INT64 TraceTag,
+                                           MIL_INT64 TraceValue,
+                                           MIL_CONST_TEXT_PTR TraceString);
+#endif
+
+MIL_DLLFUNC void MFTYPE       MappCloseConnection     (MIL_ID RemoteContextAppId);
+
+MIL_DLLFUNC MIL_INT MFTYPE    MappInquireConnection   (MIL_ID ContextAppId,
+                                           MIL_INT64 InquireType,
+                                           MIL_INT64 ControlFlag,
+                                           MIL_INT64 ExtraFlag,
+                                           void* UserVarPtr);
+
+#if !M_HIDE_DEPRECATED_FROM_INTELLISENSE
+MIL_DLLFUNC MIL_INT MFTYPE    MappInquireObject       (MIL_ID ContextAppId,
+                                           MIL_ID ObjectId,
+                                           MIL_INT64 InquireType,
+                                           void* UserVarPtr);
+
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+MIL_DLLFUNC void MFTYPE       MappControlObjectDouble (MIL_ID ContextAppId,
+                                           MIL_ID ObjectId,
+                                           MIL_INT64 ControlType,
+                                           MIL_DOUBLE ControlValue);
+
+MIL_DLLFUNC void MFTYPE       MappControlObjectInt64  (MIL_ID ContextAppId,
+                                           MIL_ID ObjectId,
+                                           MIL_INT64 ControlType,
+                                           MIL_INT64 ControlValue);
+#else
+// Prototypes for 32 bits OSs
+#define MappControlObjectDouble MappControlObject
+#define MappControlObjectInt64  MappControlObject
+
+MIL_DLLFUNC void MFTYPE       MappControlObject       (MIL_ID ContextAppId,
+                                           MIL_ID ObjectId,
+                                           MIL_INT64 ControlType,
+                                           MIL_DOUBLE ControlValue);
+#endif
+#endif
+
+/***************************************************************************/
+/* OBJ MODULE:                                                              */
+/***************************************************************************/
+MIL_DLLFUNC MIL_ID MFTYPE MobjAlloc(MIL_ID SysId, MIL_INT64 ObjectType, MIL_INT64 InitFlag, MIL_ID *ObjIdPtr);
+MIL_DLLFUNC void MFTYPE MobjFree(MIL_ID ObjId);
+MIL_DLLFUNC MIL_INT MFTYPE MobjInquire(MIL_ID ObjectId, MIL_INT64 InquireType, void* UserVarPtr);
+MIL_DLLFUNC MIL_INT64 MFTYPE MobjMessageRead(MIL_ID MessageId, void* MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 *MessageOutSizePtr, MIL_INT64 *MessageTagPtr, MIL_INT64 *StatusPtr, MIL_INT64  OperationFlag);
+MIL_DLLFUNC void MFTYPE MobjMessageWrite(MIL_ID MessageId, const void* MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64  OperationFlag);
+MIL_DLLFUNC MIL_INT MFTYPE MobjGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+typedef MIL_HOOK_FUNCTION_PTR MIL_OBJ_HOOK_FUNCTION_PTR;
+MIL_DLLFUNC void MFTYPE MobjMessageReadAsync(MIL_ID MessageId, void* MessagePtr, MIL_INT64 MessageInSize, MIL_INT64  OperationFlag, MIL_OBJ_HOOK_FUNCTION_PTR  HookFunc, void* UserData);
+MIL_DLLFUNC void MFTYPE MobjHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_OBJ_HOOK_FUNCTION_PTR HookHandlerPtr, void * UserDataPtr);
+
+#if MIL_COMPILE_VERSION == 1000
+MIL_DLLFUNC void MFTYPE MobjControl(MIL_ID ObjectId, MIL_INT64 ControlType, void* ControlPtr);
+#else
+
+#if M_MIL_USE_64BIT || (MIL_COMPILE_VERSION >= 1040)
+MIL_DLLFUNC void MFTYPE    MobjControlInt64(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MobjControlDouble(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+
+
+#if !M_MIL_USE_64BIT
+// Prototypes for 32 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+#endif
+#else
+// for 32 bit BW compilation
+
+#define MobjControlDouble MobjControl
+#define MobjControlInt64  MobjControl
+MIL_DLLFUNC void MFTYPE    MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue);
+#endif
+
+#endif
+/***************************************************************************/
+/* THREAD FUNCTIONS:                                                       */
+/***************************************************************************/
+typedef MIL_UINT32 (MFTYPE *MIL_THREAD_FUNCTION_PTR)(void* UserDataPtr);
+typedef MIL_THREAD_FUNCTION_PTR MTHREADFCTPTR;
+
+MIL_DLLFUNC MIL_ID MFTYPE  MthrAlloc         (MIL_ID SystemId,
+                                  MIL_INT64 ObjectType,
+                                  MIL_INT64 ControlFlag,
+                                  MIL_THREAD_FUNCTION_PTR ThreadFctPtr,
+                                  void *UserDataPtr,
+                                  MIL_ID *ThreadEventOrMutexIdPtr);
+#if M_MIL_USE_64BIT
+// Prototypes for 64 bits OSs
+
+MIL_DLLFUNC void MFTYPE    MthrControlInt64  (MIL_ID ThreadEventOrMutexId,
+                                  MIL_INT64 ControlType,
+                                  MIL_INT64 ControlValue);
+
+MIL_DLLFUNC void MFTYPE    MthrControlDouble (MIL_ID ThreadEventOrMutexId,
+                                  MIL_INT64 ControlType,
+                                  MIL_DOUBLE ControlValue);
+#else
+// Prototypes for 32 bits OSs
+
+#define MthrControlDouble MthrControl
+#define MthrControlInt64  MthrControl
+MIL_DLLFUNC void MFTYPE    MthrControl       (MIL_ID ThreadEventOrMutexId,
+                                  MIL_INT64 ControlType,
+                                  MIL_DOUBLE ControlValue);
+#endif
+
+MIL_DLLFUNC void MFTYPE    MthrFree          (MIL_ID ThreadEventorMutexId);
+
+MIL_DLLFUNC MIL_INT MFTYPE MthrInquire       (MIL_ID ThreadEventOrMutexId,
+                                  MIL_INT64 InquireType,
+                                  void *UserVarPtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MthrWait          (MIL_ID ThreadOrEventId,
+                                  MIL_INT64 WaitOption,
+                                  MIL_INT *StatePtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MthrWaitMultiple  (const MIL_ID *EventArrayIdPtr,
+                                  MIL_INT EventArraySize,
+                                  MIL_INT64 WaitOption,
+                                  MIL_INT *StatePtr);
+
+MIL_DLLFUNC MIL_INT MFTYPE MthrInquireMp      (MIL_ID ThrId,
+                                   MIL_INT64 InquireType,
+                                   MIL_INT64 TypeFlag,
+                                   MIL_INT64 TypeValue,
+                                   void* ResultPtr);
+
+MIL_DLLFUNC void    MFTYPE MthrControlMp      (MIL_ID ThrId,
+                                   MIL_INT64 ControlType,
+                                   MIL_INT64 TypeFlag,
+                                   MIL_INT64 TypeValue,
+                                   void* ValuePtr);
+
+
+/***************************************************************************/
+/* OS MODULE:                                                              */
+/***************************************************************************/
+// Main declaration
+#if M_MIL_UNICODE_API && !M_MIL_USE_LINUX
+#define MosMain wmain
+#define MosWinMain wWinMain
+#else
+#define MosMain main
+#define MosWinMain WinMain
+#endif
+
+/**************************************/
+/*  CRITICAL SECTION RELATED DEFINES  */
+/**************************************/
+typedef void*                       MOS_CRITICAL_SECTION;
+
+MIL_DLLFUNC void MFTYPE MosInitializeCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+MIL_DLLFUNC void MFTYPE MosDeleteCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+MIL_DLLFUNC MIL_INT MFTYPE MosTryEnterCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+MIL_DLLFUNC void MFTYPE MosEnterCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+MIL_DLLFUNC void MFTYPE MosLeaveCriticalSection(MOS_CRITICAL_SECTION* lpCriticalSection);
+
+MIL_DLLFUNC MIL_INT MFTYPE MosGetch();
+MIL_DLLFUNC MIL_INT MFTYPE MosKbhit();
+MIL_DLLFUNC MIL_INT MFTYPE MosGetchar();
+MIL_DLLFUNC MIL_INT MFTYPE MosAbs(MIL_INT val);
+MIL_DLLFUNC void MFTYPE MosSleep(MIL_INT ms);
+
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+MIL_DLLFUNC MIL_INT MosFclose(MIL_FILE File);
+MIL_DLLFUNC void MFTYPE MosFflush(MIL_FILE stream);
+#endif
+
+// String manipulation
+#if M_MIL_USE_UNICODE
+   MIL_DLLFUNC MIL_FILE MosFopenA(MIL_CONST_TEXTA_PTR FileName, MIL_CONST_TEXTA_PTR Format);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrlenA(const char* str);
+   MIL_DLLFUNC char* MFTYPE MosStruprA(char* str);   
+   MIL_DLLFUNC char* MFTYPE MosStrlwrA(char* str);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrcmpA(const char* string1, const char* string2);
+   MIL_DLLFUNC char* MFTYPE MosStrcatA(char* dest, MIL_INT destsize, const char* source);
+   MIL_DLLFUNC MIL_INT MosPrintfA(const char* format, ...);
+   MIL_DLLFUNC MIL_INT MosFprintfA(MIL_FILE File, const char* format, ...);
+   MIL_DLLFUNC MIL_INT MosVprintfA(const char* format, va_list args);
+   MIL_DLLFUNC MIL_INT MosVsprintfA(char* buf, MIL_INT bufsize, const char* format, va_list args);
+   MIL_DLLFUNC MIL_INT MosSprintfA(char* buf, MIL_INT bufsize, const char* format, ...);
+   MIL_DLLFUNC char* MFTYPE MosStrcpyA(char* dest, MIL_INT destsize, const char* source);
+#endif
+
+#if M_MIL_USE_LINUX
+   #define MosFopenA MosFopen
+   #define MosStrlenA MosStrlen
+   #define MosStruprA MosStrupr   
+   #define MosStrlwrA MosStrlwr
+   #define MosStrcmpA MosStrcmp
+   #define MosStrcatA MosStrcat
+   #define MosPrintfA MosPrintf
+   #define MosVprintfA MosVprintf
+   #define MosFprintfA MosFprintf
+   #define MosSprintfA MosSprintf
+   #define MosStrcpyA MosStrcpy
+#endif
+
+#if M_MIL_USE_UNICODE
+   MIL_DLLFUNC MIL_FILE MosFopenW(MIL_CONST_TEXTW_PTR FileName, MIL_CONST_TEXTW_PTR Format);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrlenW(const wchar_t* str);
+   MIL_DLLFUNC wchar_t* MFTYPE MosStruprW(wchar_t* str);   
+   MIL_DLLFUNC wchar_t* MFTYPE MosStrlwrW(wchar_t* str);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrcmpW(const wchar_t* string1, const wchar_t* string2);
+   MIL_DLLFUNC wchar_t* MFTYPE MosStrcatW(wchar_t* dest, MIL_INT destsize, const wchar_t* source);
+   MIL_DLLFUNC MIL_INT MosPrintfW(const wchar_t* format, ...);
+   MIL_DLLFUNC MIL_INT MosFprintfW(MIL_FILE File, const wchar_t* format, ...);
+   MIL_DLLFUNC MIL_INT MosVprintfW(const wchar_t* format, va_list args);
+   MIL_DLLFUNC MIL_INT MosVsprintfW(wchar_t* buf, MIL_INT bufsize, const wchar_t* format, va_list args);
+   MIL_DLLFUNC MIL_INT MosSprintfW(wchar_t* buf, MIL_INT bufsize, const wchar_t* format, ...);
+   MIL_DLLFUNC wchar_t* MFTYPE MosStrcpyW(wchar_t* dest, MIL_INT destsize, const wchar_t* source);
+
+   #if M_MIL_UNICODE_API
+      #define MosFopen     MosFopenW
+      #define MosStrlen    MosStrlenW
+      #define MosStrupr    MosStruprW 
+      #define MosStrlwr    MosStrlwrW
+      #define MosStrcmp    MosStrcmpW
+      #define MosStrcat    MosStrcatW
+      #define MosPrintf    MosPrintfW
+      #define MosVprintf   MosVprintfW
+      #define MosFprintf   MosFprintfW
+      #define MosVsprintf  MosVsprintfW
+      #define MosSprintf   MosSprintfW
+      #define MosStrcpy    MosStrcpyW
+   #else
+      #define MosFopen     MosFopenA
+      #define MosStrlen    MosStrlenA
+      #define MosStrupr    MosStruprA
+      #define MosStrlwr    MosStrlwrA
+      #define MosStrcmp    MosStrcmpA
+      #define MosStrcat    MosStrcatA
+      #define MosPrintf    MosPrintfA
+      #define MosFprintf   MosFprintfA
+      #define MosVprintf   MosVprintfA
+      #define MosVsprintf  MosVsprintfA
+      #define MosSprintf   MosSprintfA
+      #define MosStrcpy    MosStrcpyA
+   #endif
+#else
+   
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrlen(MIL_CONST_TEXT_PTR str);
+   MIL_DLLFUNC MIL_TEXT_PTR MFTYPE MosStrupr(MIL_TEXT_PTR str);
+   MIL_DLLFUNC MIL_TEXT_PTR MFTYPE MosStrlwr(MIL_TEXT_PTR str);
+   MIL_DLLFUNC MIL_INT MFTYPE MosStrcmp(MIL_CONST_TEXT_PTR string1, MIL_CONST_TEXT_PTR string2);
+   MIL_DLLFUNC MIL_TEXT_PTR MFTYPE MosStrcat(MIL_TEXT_PTR dest, MIL_INT destsize, MIL_CONST_TEXT_PTR source);   
+   MIL_DLLFUNC MIL_TEXT_PTR MFTYPE MosStrcpy(MIL_TEXT_PTR dest, MIL_INT destsize, MIL_CONST_TEXT_PTR source);
+   MIL_DLLFUNC MIL_INT MosSprintf(MIL_TEXT_PTR buf, MIL_INT bufsize, MIL_CONST_TEXT_PTR format, ...);
+   MIL_DLLFUNC MIL_INT MosPrintf(MIL_CONST_TEXT_PTR format, ...);   
+   MIL_DLLFUNC MIL_INT MosVprintf(MIL_CONST_TEXT_PTR format, va_list args);
+   MIL_DLLFUNC MIL_INT MosVsprintf(MIL_TEXT_PTR buf, MIL_INT bufsize, MIL_CONST_TEXT_PTR format, va_list args);
+#if !M_LINUX_KERNEL
+   MIL_DLLFUNC MIL_INT MosFprintf(MIL_FILE File, const char* format, ...);
+   MIL_DLLFUNC MIL_FILE MosFopen(MIL_CONST_TEXT_PTR FileName, MIL_CONST_TEXT_PTR Format);
+#endif
+#endif
+
+/***************************************************************************/
+/* SCREEN FUNCTIONS:                                                         */
+/***************************************************************************/
+#if defined(M_MIL_USE_OS_SCREEN_FUNCTIONS) && M_MIL_USE_OS_SCREEN_FUNCTIONS
+#if M_MIL_USE_LINUX
+#include <ncurses.h>
+#define MosPrintf printw
+#define MosScreenRefresh refresh
+#define MosScreenScroll(A) scrollok(stdscr, A)
+#define MosScreenInit()        \
+   do {                        \
+      initscr();               \
+      move(0,0);               \
+      scrollok(stdscr, TRUE);  \
+      refresh();               \
+   } while(0)
+#define MosScreenRelease endwin
+#define MosScreenClear()       \
+   do {                        \
+      scrollok(stdscr, TRUE);  \
+      clear();                 \
+      refresh();               \
+   } while(0)
+#define MosScreenSetPosition(X,Y)   \
+   do {                             \
+      move(Y,X);                    \
+      refresh();                    \
+      scrollok(stdscr, FALSE);      \
+   } while(0)
+#else
+#include <windows.h>
+#define MosScreenRefresh()
+#define MosScreenScroll(A)
+#define MosScreenInit()
+#define MosScreenRelease()
+#define MosScreenClear()  \
+   do {                   \
+      std::system("cls"); \
+   } while(0)
+#define MosScreenSetPosition(A, B)                                      \
+   do {                                                                 \
+      COORD Coord;                                                      \
+      Coord.X = SHORT(A);                                               \
+      Coord.Y = SHORT(B);                                               \
+      SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Coord); \
+   } while(0)
+#endif
+#endif
+/***************************************************************************/
+/* MISC FUNCTIONS:                                                         */
+/***************************************************************************/
+MIL_DLLFUNC MIL_UINT MFTYPE  MPtrToInt           (void *pvPtr);
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+}
+#endif
+
+/***************************************************************************/
+/* TOOLKIT FOR PSEUDO MIL FUNCTIONS DEVELOPMENT                            */
+/***************************************************************************/
+#include <milfunc.h> // milfunc.h handles the extern "C" and has some C++ code for safe-type support
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if !M_MIL_USE_64BIT
+typedef struct _MILBUFFERINFO {
+    long   StructSize;      // Size of the structure, in bytes. This member must be initialized before the structure is used. 
+    long   SizeX;
+    long   SizeY;
+    long   SizeBand;
+    long   SizeBit;
+    long   Type;
+    long   Attribute;
+    long   Format;
+    long   OffsetX;
+    long   OffsetY;
+    long   OffsetBand;
+    long   AncestorOffsetX;
+    long   AncestorOffsetY;
+    long   AncestorOffsetBand;
+    long   AncestorOffsetBit;
+    long   Pitch;
+    long   PitchByte;
+    void*  HostPtr;
+    void*  BandHostPtr[3];
+    MIL_PHYS_DATA_PTR  PhysPtr;
+    MIL_ID Id;
+    MIL_ID ParentId;
+    MIL_ID AncestorId;
+    long   NativeId;
+} MILBUFFERINFOOLD,* LPMILBUFFERINFOOLD;
+#endif
+#endif
+
+
+
+
+#ifdef __cplusplus
+
+inline MIL_ID MsysAlloc(MIL_CONST_TEXT_PTR SystemDescriptor,
+                        MIL_INT SystemNum,
+                        MIL_INT64 InitFlag,
+                        MIL_ID* SysIdPtr)
+   {
+   return MsysAlloc(M_DEFAULT,
+                    SystemDescriptor,
+                    SystemNum,
+                    InitFlag,
+                    SysIdPtr);
+   }
+
+#if !defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL
+inline MIL_ID MappAlloc(MIL_INT64 InitFlag,
+                        MIL_ID* ContextAppIdPtr)
+   {
+   return MappAlloc(MIL_TEXT("M_DEFAULT"),
+                    InitFlag,
+                    ContextAppIdPtr);
+   }
+#endif
+
+inline void MappControl(MIL_INT64 ControlType,
+                        MIL_INT ControlFlag)
+   {
+   MappControl(M_DEFAULT, ControlType, ControlFlag);
+   }
+
+inline MIL_INT MappGetError(MIL_INT64 ErrorType,
+                            void* ErrorPtr)
+   {
+   return MappGetError(M_DEFAULT, ErrorType, ErrorPtr);
+   }
+
+inline MIL_INT MappGetHookInfo(MIL_ID EventId,
+                               MIL_INT64 InfoType,
+                               void* UserVarPtr)
+   {
+   return MappGetHookInfo(M_DEFAULT, EventId, InfoType, UserVarPtr);
+   }
+
+inline void MappHookFunction(MIL_INT HookType,
+                             MIL_APP_HOOK_FUNCTION_PTR HookHandlerPtr,
+                             void* UserDataPtr)
+   {
+   MappHookFunction(M_DEFAULT, HookType, HookHandlerPtr, UserDataPtr);
+   }
+
+inline MIL_INT MappInquire(MIL_INT64 InquireType,
+                           void* UserVarPtr)
+   {
+   return MappInquire(M_DEFAULT, InquireType, UserVarPtr);
+   }
+
+#if !defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL
+inline MIL_DOUBLE MappTimer(MIL_INT64 ControlType,
+                            MIL_DOUBLE* TimePtr)
+   {
+   return MappTimer(M_DEFAULT, ControlType, TimePtr);
+   }
+#endif
+
+inline void MappTimerVoid(MIL_INT64 Mode,
+                          MIL_DOUBLE* Time)
+   {
+   MappTimerVoid(M_DEFAULT, Mode, Time);
+   }
+#endif
+
+#ifdef __cplusplus
+//////////////////////////////////////////////////////////////
+// MbufControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !(M_MIL_USE_LINUX  && M_MIL_USE_64BIT)
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040)   || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, ControlValue);
+#else
+   MbufControl(BufId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, int ControlValue)
+   {
+   MbufControlContainerInt64(ContainerBufId, Component, ControlType, ControlValue);
+   }
+
+#endif
+
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_INT32 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, ControlValue);
+#else
+   MbufControl(BufId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   MbufControlContainerInt64(ContainerBufId, Component, ControlType, ControlValue);
+   }
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MbufControlContainerInt64(ContainerBufId, Component, ControlType, (MIL_ADDR)ControlValue);
+   }
+
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040)  || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, ControlValue);
+#else
+   MbufControl(BufId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040)  || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, (MIL_ADDR)ControlValue);
+#else
+   MbufControl(BufId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+#endif
+   }
+
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   void* ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040)  || M_MIL_USE_64BIT
+   MbufControlInt64(BufId, ControlType, (MIL_ADDR)ControlValue);
+#else
+   MbufControl(BufId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+#endif
+   }
+
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, MIL_INT64 ControlValue)
+   {
+   MbufControlContainerInt64(ContainerBufId, Component, ControlType, ControlValue);
+   }
+
+
+#if M_MIL_USE_64BIT
+inline void MbufControl(MIL_ID BufId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue)
+   {
+   MbufControlDouble(BufId, ControlType, ControlValue);
+   }
+#endif
+
+inline void MbufControlContainer(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 ControlType, MIL_DOUBLE ControlValue)
+   {
+   MbufControlContainerDouble(ContainerBufId, Component, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MdigControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MdigControlInt64(DigId, ControlType, ControlValue);
+#else
+   MdigControl(DigId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   };
+#endif
+
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_INT32 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MdigControlInt64(DigId, ControlType, ControlValue);
+#else
+   MdigControl(DigId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MdigControlInt64(DigId, ControlType, ControlValue);
+#else
+   MdigControl(DigId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+#if M_MIL_USE_64BIT
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue)
+   {
+   MdigControlDouble(DigId, ControlType, ControlValue);
+   }
+#endif
+
+inline void MdigControl(MIL_ID DigId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MdigControl(DigId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+
+//////////////////////////////////////////////////////////////
+// MobjControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MobjControlInt64(ObjectId, ControlType, ControlValue);
+#else
+   MobjControl(ObjectId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   };
+#endif
+
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_INT32 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MobjControlInt64(ObjectId, ControlType, ControlValue);
+#else
+   MobjControl(ObjectId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_INT64 ControlValue)
+   {
+#if   (MIL_COMPILE_VERSION >= 1040) || M_MIL_USE_64BIT
+   MobjControlInt64(ObjectId, ControlType, ControlValue);
+#else
+   MobjControl(ObjectId, ControlType, (MIL_DOUBLE)ControlValue);
+#endif
+   }
+
+#if M_MIL_USE_64BIT
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_DOUBLE ControlValue)
+   {
+   MobjControlDouble(ObjectId, ControlType, ControlValue);
+   }
+#endif
+
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MobjControl(ObjectId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+inline void MobjControl(MIL_ID ObjectId,
+   MIL_INT64 ControlType,
+   void* ControlValue)
+   {
+   MobjControl(ObjectId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+
+
+#endif
+
+
+#if M_MIL_USE_64BIT
+#ifdef __cplusplus
+#if !M_HIDE_DEPRECATED_FROM_INTELLISENSE
+inline void MappControlObject(MIL_ID ContextAppId,
+                              MIL_ID ObjectId,
+                              MIL_INT64 ControlType,
+                              MIL_INT32 ControlValue)
+   {
+   MappControlObjectInt64(ContextAppId, ObjectId, ControlType, ControlValue);
+   }
+
+inline void MappControlObject(MIL_ID ContextAppId,
+                              MIL_ID ObjectId,
+                              MIL_INT64 ControlType,
+                              MIL_INT64 ControlValue)
+   {
+   MappControlObjectInt64(ContextAppId, ObjectId, ControlType, ControlValue);
+   }
+
+inline void MappControlObject(MIL_ID ContextAppId,
+                              MIL_ID ObjectId,
+                              MIL_INT64 ControlType,
+                              MIL_DOUBLE ControlValue)
+   {
+   MappControlObjectDouble(ContextAppId, ObjectId, ControlType, ControlValue);
+   }
+#endif
+
+struct MCppParameter
+   {
+#if !M_MIL_USE_LINUX
+   MCppParameter(int          Param) { m_Param = (double)Param; }
+   MCppParameter(unsigned int Param) { m_Param = (double)Param; }
+#endif
+   MCppParameter(MIL_INT8     Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_UINT8    Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_INT16    Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_UINT16   Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_INT32    Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_UINT32   Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_INT64    Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_UINT64   Param) { m_Param = (double)Param; }
+   MCppParameter(float        Param) { m_Param = (double)Param; }
+   MCppParameter(MIL_DOUBLE   Param) { m_Param = (double)Param; }
+
+   double m_Param;
+   };
+
+//////////////////////////////////////////////////////////////
+// MgraDot function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraDot(MIL_ID ContextGraId,
+                    MIL_ID DstImageBufOrListGraId,
+                    const MCppParameter& XPos,
+                    const MCppParameter& YPos)
+   {
+   MgraDotDouble(ContextGraId, DstImageBufOrListGraId, XPos.m_Param, YPos.m_Param);
+   }
+
+inline void MgraDotEx(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      const MCppParameter& XPos,
+                      const MCppParameter& YPos,
+                      MIL_ID NativeCalibration,
+                      MIL_INT64 NativeUnits,
+                      MIL_INT64 ConvertMode)
+   {
+   MgraDotDoubleEx(ContextGraId, DstImageBufOrListGraId, XPos.m_Param, YPos.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraLine function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+
+inline void MgraLine(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     const MCppParameter& XStart,
+                     const MCppParameter& YStart,
+                     const MCppParameter& XEnd,
+                     const MCppParameter& YEnd)
+   {
+   MgraLineDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param);
+   }
+
+inline void MgraLineEx(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     const MCppParameter& XStart,
+                     const MCppParameter& YStart,
+                     const MCppParameter& XEnd,
+                     const MCppParameter& YEnd,
+                     MIL_ID NativeCalibration,
+                     MIL_INT64 NativeUnits,
+                     MIL_INT64 ConvertMode)
+   {
+   MgraLineDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraArc function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraArc(MIL_ID ContextGraId,
+                    MIL_ID DstImageBufOrListGraId,
+                    const MCppParameter& XCenter,
+                    const MCppParameter& YCenter,
+                    const MCppParameter& XRad,
+                    const MCppParameter& YRad,
+                    MIL_DOUBLE StartAngle,
+                    MIL_DOUBLE EndAngle)
+   {
+   MgraArcDouble(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle);
+   }
+
+inline void MgraArcEx(MIL_ID ContextGraId,
+                    MIL_ID DstImageBufOrListGraId,
+                    const MCppParameter& XCenter,
+                    const MCppParameter& YCenter,
+                    const MCppParameter& XRad,
+                    const MCppParameter& YRad,
+                    MIL_DOUBLE StartAngle,
+                    MIL_DOUBLE EndAngle,
+                    MIL_ID NativeCalibration,
+                    MIL_INT64 NativeUnits,
+                    MIL_INT64 ConvertMode)
+   {
+   MgraArcDoubleEx(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraArcFill function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraArcFill(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XCenter,
+                        const MCppParameter& YCenter,
+                        const MCppParameter& XRad,
+                        const MCppParameter& YRad,
+                        MIL_DOUBLE StartAngle,
+                        MIL_DOUBLE EndAngle)
+   {
+   MgraArcFillDouble(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle);
+   }
+
+inline void MgraArcFillEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XCenter,
+                        const MCppParameter& YCenter,
+                        const MCppParameter& XRad,
+                        const MCppParameter& YRad,
+                        MIL_DOUBLE StartAngle,
+                        MIL_DOUBLE EndAngle,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraArcFillDoubleEx(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraArcAngle function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraArcAngle(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XCenter,
+                        const MCppParameter& YCenter,
+                        const MCppParameter& XRad,
+                        const MCppParameter& YRad,
+                        MIL_DOUBLE StartAngle,
+                        MIL_DOUBLE EndAngle,
+                        MIL_DOUBLE XAxisAngle,
+                        MIL_INT64  ControlFlag)
+   {
+   MgraArcAngleDouble(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle, XAxisAngle, ControlFlag);
+   }
+
+inline void MgraArcAngleEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XCenter,
+                        const MCppParameter& YCenter,
+                        const MCppParameter& XRad,
+                        const MCppParameter& YRad,
+                        MIL_DOUBLE StartAngle,
+                        MIL_DOUBLE EndAngle,
+                        MIL_DOUBLE XAxisAngle,
+                        MIL_INT64 ControlFlag,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraArcAngleDoubleEx(ContextGraId, DstImageBufOrListGraId, XCenter.m_Param, YCenter.m_Param, XRad.m_Param, YRad.m_Param, StartAngle, EndAngle, XAxisAngle, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+// MgraRingSector function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE MgraRingSector(MIL_ID     ContextGraId             ,
+                                  MIL_ID     DestImageBufIdOrGraListId,
+                                  const MCppParameter&  XCenter       ,
+                                  const MCppParameter&  YCenter       ,
+                                  const MCppParameter&  XInnerRadius  ,
+                                  const MCppParameter&  YInnerRadius  ,
+                                  const MCppParameter&  XOuterRadius  ,
+                                  const MCppParameter&  YOuterRadius  ,
+                                  MIL_DOUBLE StartAngle               ,
+                                  MIL_DOUBLE EndAngle                 ,
+                                  MIL_DOUBLE XAxisAngle               ,
+                                  MIL_INT64  ControlFlag              )
+   {
+   MgraRingSectorDouble(ContextGraId, DestImageBufIdOrGraListId, XCenter.m_Param, YCenter.m_Param, XInnerRadius.m_Param, YInnerRadius.m_Param, XOuterRadius.m_Param, YOuterRadius.m_Param, StartAngle, EndAngle, XAxisAngle, ControlFlag);
+   }
+
+inline void MFTYPE MgraRingSectorEx(MIL_ID     ContextGraId             ,
+                                    MIL_ID     DestImageBufIdOrGraListId,
+                                    const MCppParameter&  XCenter       ,
+                                    const MCppParameter&  YCenter       ,
+                                    const MCppParameter&  XInnerRadius  ,
+                                    const MCppParameter&  YInnerRadius  ,
+                                    const MCppParameter&  XOuterRadius  ,
+                                    const MCppParameter&  YOuterRadius  ,
+                                    MIL_DOUBLE StartAngle               ,
+                                    MIL_DOUBLE EndAngle                 ,
+                                    MIL_DOUBLE XAxisAngle               ,
+                                    MIL_INT64  ControlFlag              ,
+                                    MIL_ID     NativeCalibration        ,
+                                    MIL_INT64  NativeUnits              ,
+                                    MIL_INT64  ConvertMode          )
+   {
+   MgraRingSectorDoubleEx(ContextGraId, DestImageBufIdOrGraListId, XCenter.m_Param, YCenter.m_Param, XInnerRadius.m_Param, YInnerRadius.m_Param, XOuterRadius.m_Param, YOuterRadius.m_Param, StartAngle, EndAngle, XAxisAngle, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+// MgraRect function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraRect(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     const MCppParameter& XStart,
+                     const MCppParameter& YStart,
+                     const MCppParameter& XEnd,
+                     const MCppParameter& YEnd)
+   {
+   MgraRectDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param);
+   }
+
+inline void MgraRectEx(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      const MCppParameter& XStart,
+                      const MCppParameter& YStart,
+                      const MCppParameter& XEnd,
+                      const MCppParameter& YEnd,
+                      MIL_ID NativeCalibration,
+                      MIL_INT64 NativeUnits,
+                      MIL_INT64 ConvertMode)
+   {
+   MgraRectDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraRectAngle function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraRectAngle(MIL_ID ContextGraId,
+                          MIL_ID DestImageBufIdOrGraListId,
+                          const MCppParameter& XPos,
+                          const MCppParameter& YPos,
+                          const MCppParameter& Width,
+                          const MCppParameter& Height,
+                          MIL_DOUBLE Angle,
+                          MIL_INT64 ControlFlag)
+   {
+   MgraRectAngleDouble(ContextGraId, DestImageBufIdOrGraListId, 
+      XPos.m_Param, YPos.m_Param, 
+      Width.m_Param, Height.m_Param, 
+      Angle, ControlFlag);
+   }
+
+inline void MgraRectAngleEx(MIL_ID ContextGraId,
+                          MIL_ID DestImageBufIdOrGraListId,
+                          const MCppParameter& XPos,
+                          const MCppParameter& YPos,
+                          const MCppParameter& Width,
+                          const MCppParameter& Height,
+                          MIL_DOUBLE Angle,
+                          MIL_INT64 ControlFlag,
+                          MIL_ID NativeCalibration,
+                          MIL_INT64 NativeUnits,
+                          MIL_INT64 ConvertMode)
+   {
+   MgraRectAngleDoubleEx(ContextGraId, DestImageBufIdOrGraListId, 
+      XPos.m_Param, YPos.m_Param, 
+      Width.m_Param, Height.m_Param, 
+      Angle, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraRectFill function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraRectFill(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         const MCppParameter& XEnd,
+                         const MCppParameter& YEnd)
+   {
+   MgraRectFillDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param);
+   }
+
+inline void MgraRectFillEx(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         const MCppParameter& XEnd,
+                         const MCppParameter& YEnd,
+                         MIL_ID NativeCalibration,
+                         MIL_INT64 NativeUnits,
+                         MIL_INT64 ConvertMode)
+   {
+   MgraRectFillDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, XEnd.m_Param, YEnd.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraFill function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraFill(MIL_ID ContextGraId,
+                     MIL_ID ImageId,
+                     const MCppParameter& XStart,
+                     const MCppParameter& YStart)
+   {
+   MgraFillDouble(ContextGraId, ImageId, XStart.m_Param, YStart.m_Param);
+   }
+
+inline void MgraFillEx(MIL_ID ContextGraId,
+                       MIL_ID ImageId,
+                       const MCppParameter& XStart,
+                       const MCppParameter& YStart,
+                       MIL_ID NativeCalibration,
+                       MIL_INT64 NativeUnits,
+                       MIL_INT64 ConvertMode)
+   {
+   MgraFillDoubleEx(ContextGraId, ImageId, XStart.m_Param, YStart.m_Param, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraTextW function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if M_MIL_USE_UNICODE
+
+   inline void MgraTextA(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         MIL_CONST_TEXTA_PTR StringPtr)
+      {
+      MgraTextADouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr);
+      }
+
+   inline void MgraTextAEx(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         MIL_CONST_TEXTA_PTR StringPtr,
+                         MIL_ID NativeCalibration,
+                         MIL_INT64 NativeUnits,
+                         MIL_INT64 ConvertMode)
+      {
+      MgraTextADoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr, NativeCalibration, NativeUnits, ConvertMode);
+      }
+
+   inline void MgraTextW(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         MIL_CONST_TEXTW_PTR StringPtr)
+      {
+      MgraTextWDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr);
+      }
+
+   inline void MgraTextWEx(MIL_ID ContextGraId,
+                         MIL_ID DstImageBufOrListGraId,
+                         const MCppParameter& XStart,
+                         const MCppParameter& YStart,
+                         MIL_CONST_TEXTW_PTR StringPtr,
+                         MIL_ID NativeCalibration,
+                         MIL_INT64 NativeUnits,
+                         MIL_INT64 ConvertMode)
+      {
+      MgraTextWDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr, NativeCalibration, NativeUnits, ConvertMode);
+      }
+
+#else // #if M_MIL_USE_UNICODE
+
+   inline void MgraText(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        const MCppParameter& XStart,
+                        const MCppParameter& YStart,
+                        MIL_CONST_TEXT_PTR StringPtr)
+      {
+      MgraTextDouble(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr);
+      }
+
+   inline void MgraTextEx(MIL_ID ContextGraId,
+                          MIL_ID DstImageBufOrListGraId,
+                          const MCppParameter& XStart,
+                          const MCppParameter& YStart,
+                          MIL_CONST_TEXT_PTR StringPtr,
+                          MIL_ID NativeCalibration,
+                          MIL_INT64 NativeUnits,
+                          MIL_INT64 ConvertMode)
+      {
+      MgraTextDoubleEx(ContextGraId, DstImageBufOrListGraId, XStart.m_Param, YStart.m_Param, StringPtr, NativeCalibration, NativeUnits, ConvertMode);
+      }
+
+#endif // #if M_MIL_USE_UNICODE #else
+
+#if  !M_MIL_USE_LINUX || M_MIL_USE_64BIT || M_COMPILING_MILDLL
+inline void MseqControl(MIL_ID ContextSeqId,
+                        MIL_INT SequenceIndex,
+                        MIL_INT64 ControlType,
+                        int ControlValue)
+      {
+      MseqControlInt64(ContextSeqId, SequenceIndex, ControlType, ControlValue);
+      }
+#if !M_MIL_USE_LINUX
+inline void MseqControl(MIL_ID ContextSeqId,
+                        MIL_INT SequenceIndex,
+                        MIL_INT64 ControlType,
+                        MIL_INT32 ControlValue)
+   {
+   MseqControlInt64(ContextSeqId, SequenceIndex, ControlType, ControlValue);
+   }
+#endif
+inline void MseqControl(MIL_ID ContextSeqId,
+                        MIL_INT SequenceIndex,
+                        MIL_INT64 ControlType,
+                        MIL_INT64 ControlValue)
+   {
+   MseqControlInt64(ContextSeqId, SequenceIndex, ControlType, ControlValue);
+   }
+
+inline void MseqControl(MIL_ID ContextSeqId,
+                        MIL_INT SequenceIndex,
+                        MIL_INT64 ControlType,
+                        MIL_DOUBLE ControlValue)
+   {
+   MseqControlDouble(ContextSeqId, SequenceIndex, ControlType, ControlValue);
+   }
+#endif 
+
+
+
+
+//////////////////////////////////////////////////////////////
+// MsysIoControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MsysIoControl(MIL_ID IoObjectId,
+                          MIL_INT64 ControlType,
+                          int ControlValue)
+   {
+   MsysIoControlInt64(IoObjectId, ControlType, ControlValue);
+   };
+#endif
+
+inline void MsysIoControl(MIL_ID IoObjectId,
+                          MIL_INT64 ControlType,
+                          MIL_INT32 ControlValue)
+   {
+   MsysIoControlInt64(IoObjectId, ControlType, ControlValue);
+   }
+
+inline void MsysIoControl(MIL_ID IoObjectId,
+                          MIL_INT64 ControlType,
+                          MIL_INT64 ControlValue)
+   {
+   MsysIoControlInt64(IoObjectId, ControlType, ControlValue);
+   }
+
+inline void MsysIoControl(MIL_ID IoObjectId,
+                          MIL_INT64 ControlType,
+                          MIL_DOUBLE ControlValue)
+   {
+   MsysIoControlDouble(IoObjectId, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MthrControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MthrControl(MIL_ID ThreadEventOrMutexId,
+                        MIL_INT64 ControlType,
+                        int ControlValue)
+   {
+   MthrControlInt64(ThreadEventOrMutexId, ControlType, ControlValue);
+   };
+#endif
+
+inline void MthrControl(MIL_ID ThreadEventOrMutexId,
+                        MIL_INT64 ControlType,
+                        MIL_INT32 ControlValue)
+   {
+   MthrControlInt64(ThreadEventOrMutexId, ControlType, ControlValue);
+   }
+
+inline void MthrControl(MIL_ID ThreadEventOrMutexId,
+                        MIL_INT64 ControlType,
+                        MIL_INT64 ControlValue)
+   {
+   MthrControlInt64(ThreadEventOrMutexId, ControlType, ControlValue);
+   }
+
+inline void MthrControl(MIL_ID ThreadEventOrMutexId,
+                        MIL_INT64 ControlType,
+                        MIL_DOUBLE ControlValue)
+   {
+   MthrControlDouble(ThreadEventOrMutexId, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraControlList function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                            MIL_INT LabelOrIndex,
+                                            MIL_INT SubIndex,
+                                            MIL_INT64 ControlType,
+                                            int ControlValue)
+   {
+   MgraControlListInt64(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+#endif
+
+inline void MFTYPE    MgraControlList(MIL_ID GraListId,
+                                      MIL_INT LabelOrIndex,
+                                      MIL_INT SubIndex,
+                                      MIL_INT64 ControlType,
+                                      MIL_ADDR ControlValue)
+   {
+   MgraControlListInt64(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+inline void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                            MIL_INT LabelOrIndex,
+                                            MIL_INT SubIndex,
+                                            MIL_INT64 ControlType,
+                                            MIL_INT32 ControlValue)
+   {
+   MgraControlListInt64(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+
+inline void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                            MIL_INT LabelOrIndex,
+                                            MIL_INT SubIndex,
+                                            MIL_INT64 ControlType,
+                                            MIL_INT64 ControlValue)
+   {
+   MgraControlListInt64(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+
+inline void MFTYPE    MgraControlList      (MIL_ID GraListId,
+                                            MIL_INT LabelOrIndex,
+                                            MIL_INT SubIndex,
+                                            MIL_INT64 ControlType,
+                                            MIL_DOUBLE ControlValue)
+   {
+   MgraControlListDouble(GraListId, LabelOrIndex, SubIndex, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !M_MIL_USE_LINUX
+inline void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                                   MIL_INT64 ControlType,
+                                   int ControlValue)
+   {
+   MgraControlInt64(ContextGraId, ControlType, ControlValue);
+   }
+#endif
+
+inline void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                                   MIL_INT64 ControlType,
+                                   MIL_INT32 ControlValue)
+   {
+   MgraControlInt64(ContextGraId, ControlType, ControlValue);
+   }
+
+inline void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                                   MIL_INT64 ControlType,
+                                   MIL_INT64 ControlValue)
+   {
+   MgraControlInt64(ContextGraId, ControlType, ControlValue);
+   }
+
+inline void MFTYPE    MgraControl (MIL_ID ContextGraId,
+                                   MIL_INT64 ControlType,
+                                   MIL_DOUBLE ControlValue)
+   {
+   MgraControlDouble(ContextGraId, ControlType, ControlValue);
+   }
+
+#else
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. Int64 one
+//////////////////////////////////////////////////////////////
+#define MgraDot         MgraDotInt64
+#define MgraDotEx       MgraDotInt64Ex
+#define MgraLine        MgraLineInt64
+#define MgraLineEx      MgraLineInt64Ex
+#define MgraArc         MgraArcInt64
+#define MgraArcEx       MgraArcInt64Ex
+#define MgraArcFill     MgraArcFillInt64
+#define MgraArcFillEx   MgraArcFillInt64Ex
+#define MgraArcAngle    MgraArcAngleInt64
+#define MgraArcAngleEx  MgraArcAngleInt64Ex
+#define MgraRingSector  MgraRingSectorInt64
+#define MgraRingSectorEx  MgraRingSectorInt64Ex
+#define MgraRect        MgraRectInt64
+#define MgraRectEx      MgraRectInt64Ex
+#define MgraRectFill    MgraRectFillInt64
+#define MgraRectFillEx  MgraRectFillInt64Ex
+#define MgraRectAngle   MgraRectAngleInt64
+#define MgraRectAngleEx MgraRectAngleInt64Ex
+#define MgraFill        MgraFillInt64
+#define MgraFillEx      MgraFillInt64Ex
+#if M_MIL_USE_UNICODE 
+#define MgraTextW       MgraTextWInt64
+#define MgraTextWEx     MgraTextWInt64Ex
+#define MgraTextA       MgraTextAInt64
+#define MgraTextAEx     MgraTextAInt64Ex
+#else
+#define MgraText        MgraTextInt64
+#define MgraTextEx      MgraTextInt64Ex
+#endif
+#define MseqControl     MseqControlInt64
+#define MobjControl     MobjControlInt64
+#define MbufControl     MbufControlInt64
+#define MdigControl     MdigControlInt64
+#define MthrControl     MthrControlInt64
+#define MgraControlList MgraControlListInt64
+#define MsysIoControl   MsysIoControlInt64
+
+#endif // __cplusplus
+#else //M_MIL_USE_64BIT
+
+#endif // M_MIL_USE_64BIT
+
+
+MIL_DEPRECATED(MappControlObject, 1060)
+MIL_DEPRECATED(MappInquireObject, 1060)
+
+
+#if(defined(__cplusplus))
+
+//////////////////////////////////////////////////////////////
+// MbufControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE   MbufClear(MIL_ID DstContainerOrBufId, MIL_DOUBLE Color)
+   {
+   MbufClearDouble(DstContainerOrBufId, Color);
+   }
+
+//////////////////////////////////////////////////////////////
+// MbufControlArea function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE   MbufControlArea(MIL_ID  BufId,
+                                     MIL_INT OffsetX,
+                                     MIL_INT OffsetY,
+                                     MIL_INT SizeX,
+                                     MIL_INT SizeY,
+                                     MIL_INT Band,
+                                     MIL_INT64 ControlType,
+                                     MIL_DOUBLE ControlValue)
+   {
+   MbufControlAreaDouble(BufId, OffsetX, OffsetY, SizeX, SizeY, Band, ControlType, ControlValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MbufClearCond function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE    MbufClearCond (MIL_ID DstBufId,
+                                     MIL_DOUBLE RedOrMonoVal,
+                                     MIL_DOUBLE GreenVal,
+                                     MIL_DOUBLE BlueVal,
+                                     MIL_ID CondBufId,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondValue)
+   {
+   MbufClearCondDouble(DstBufId, RedOrMonoVal, GreenVal, BlueVal, CondBufId, Condition, CondValue);
+   }
+
+//////////////////////////////////////////////////////////////
+// MbufCopyCond function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE    MbufCopyCond  (MIL_ID SrcBufId,
+                                     MIL_ID DestBufId,
+                                     MIL_ID CondBufId,
+                                     MIL_INT64 Condition,
+                                     MIL_DOUBLE CondValue)
+   {
+   MbufCopyCondDouble(SrcBufId, DestBufId, CondBufId, Condition, CondValue);
+   }
+
+
+
+// New API call so redirect it to the good entry point.
+#define MbufGetArc   MbufGetArc2
+
+
+inline MIL_INT MbufGetArc(MIL_ID     ImageBufId,
+                          MIL_INT    XCenter,
+                          MIL_INT    YCenter,
+                          MIL_INT    XRad,
+                          MIL_INT    YRad,
+                          MIL_DOUBLE StartAngle,
+                          MIL_DOUBLE EndAngle,
+                          void*      UserArrayPtr,
+                          MIL_INT*   NbPixelsPtr)
+   {
+   return MbufGetArc(ImageBufId, XCenter, YCenter, XRad, YRad, StartAngle, EndAngle, M_DEFAULT, NbPixelsPtr, UserArrayPtr, M_NULL, M_NULL);
+   }
+
+//////////////////////////////////////////////////////////////
+// MbufSetRegion function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE    MbufSetRegion    (MIL_ID ImageBufId,
+                                        MIL_ID ImageOrGraphicListId,
+                                        MIL_INT64 Label,
+                                        MIL_INT64 Operation,
+                                        MIL_DOUBLE Param)
+   {
+   MbufSetRegionDouble(ImageBufId, ImageOrGraphicListId, Label, Operation, Param);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraBackColor function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE    MgraBackColor (MIL_ID ContextGraId,
+                                     MIL_DOUBLE BackgroundColor)
+   {
+   MgraBackColorDouble(ContextGraId, BackgroundColor);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraColor function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MFTYPE   MgraColor      (MIL_ID ContextGraId,
+                                     MIL_DOUBLE ForegroundColor)
+   {
+   MgraColorDouble(ContextGraId, ForegroundColor);
+   }
+
+//////////////////////////////////////////////////////////////
+// MsysControl function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+#if !defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL
+#if !M_MIL_USE_LINUX || !M_MIL_USE_64BIT
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        int ControlValue)
+   {
+   MsysControlInt64(SysId, ControlType, ControlValue);
+   };
+#endif
+
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_INT32 ControlValue)
+   {
+   MsysControlInt64(SysId, ControlType, ControlValue);
+   }
+
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_INT64 ControlValue)
+   {
+   MsysControlInt64(SysId, ControlType, ControlValue);
+   }
+
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_UINT32 ControlValue)
+   {
+   MsysControlInt64(SysId, ControlType, ControlValue);
+   }
+
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_DOUBLE ControlValue)
+   {
+   MsysControlDouble(SysId, ControlType, ControlValue);
+   }
+   
+inline void MsysControl(MIL_ID SysId,
+                        MIL_INT64 ControlType,
+                        MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MsysControl(SysId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+inline void MsysControl(MIL_ID SysId,
+   MIL_INT64 ControlType,
+   void* ControlValue)
+   {
+   MsysControl(SysId, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+#endif //#if !M_COMPILING_MILDLL
+
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+inline void MseqControl(MIL_ID ContextSeqId,
+   MIL_INT SequenceIndex,
+   MIL_INT64 ControlType,
+   MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MseqControl(ContextSeqId, SequenceIndex, ControlType, M_PTR_TO_MIL_INT(ControlValue));
+   }
+
+#if !M_MIL_USE_64BIT
+inline void MseqControl(MIL_ID ContextSeqId,
+   MIL_INT SequenceIndex,
+   MIL_INT64 ControlType,
+   int ControlValue)
+   {
+   MseqControl(ContextSeqId, SequenceIndex, ControlType, (MIL_DOUBLE)(M_PTR_TO_MIL_INT(ControlValue)));
+   }
+#endif
+#endif
+
+#if M_MIL_USE_64BIT
+inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   MappControl(ContextAppId, ControlType, (MIL_INT)ControlValue);
+   }
+inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_UINT32 ControlValue)
+   {
+   MappControl(ContextAppId, ControlType, (MIL_INT)ControlValue);
+   }
+
+inline void MappControl(MIL_INT64 ControlType, MIL_INT32 ControlValue)
+   {
+   MappControl(ControlType, (MIL_INT)ControlValue);
+   }
+
+inline void MappControl(MIL_INT64 ControlType, MIL_UINT32 ControlValue)
+   {
+   MappControl(ControlType, (MIL_INT)ControlValue);
+   }
+
+#endif
+
+inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MappControl(ContextAppId, ControlType, (MIL_INT)ControlValue);
+   }
+
+inline void MappControl(MIL_INT64 ControlType, MIL_CONST_TEXT_PTR ControlValue)
+   {
+   MappControl(M_DEFAULT, ControlType, ControlValue);
+   }
+
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, int ControlValue)
+   {
+   MappControl(ContextAppId, ControlType, (MIL_INT)ControlValue);
+   }
+
+inline void MappControl(MIL_INT64 ControlType, int ControlValue)
+   {
+   MappControl(M_DEFAULT, ControlType, (MIL_INT)ControlValue);
+   }
+
+#endif
+
+#else //#if(!defined(__cplusplus))
+
+#define  MbufClear                     MbufClearDouble
+#define  MbufControlArea               MbufControlAreaDouble
+#define  MbufClearCond                 MbufClearCondDouble
+#define  MbufCopyCond                  MbufCopyCondDouble
+#define  MbufSetRegion                 MbufSetRegionDouble
+#define  MgraBackColor                 MgraBackColorDouble
+#define  MgraColor                     MgraColorDouble
+#define  MgraControl                   MgraControlDouble
+#define  MsysControl                   MsysControlDouble
+
+#endif   //#if(defined(__cplusplus))
+
+// These functions have 3 versions of Mgra API even in 32 bits.
+#if (defined __cplusplus)
+
+//////////////////////////////////////////////////////////////
+// MgraDots function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraDots(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     MIL_INT  NumberOfDots,
+                     const MIL_INT32 *PosXArrayPtr,
+                     const MIL_INT32 *PosYArrayPtr,
+                     MIL_INT64 ControlFlag)
+   {
+   MgraDotsInt32(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag);
+   }
+
+inline void MgraDotsEx(MIL_ID ContextGraId,
+                       MIL_ID DstImageBufOrListGraId,
+                       MIL_INT  NumberOfDots,
+                       const MIL_INT32 *PosXArrayPtr,
+                       const MIL_INT32 *PosYArrayPtr,
+                       MIL_INT64 ControlFlag,
+                       MIL_ID NativeCalibration,
+                       MIL_INT64 NativeUnits,
+                       MIL_INT64 ConvertMode)
+   {
+   MgraDotsInt32Ex(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+inline void MgraDots(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     MIL_INT  NumberOfDots,
+                     const MIL_INT64 *PosXArrayPtr,
+                     const MIL_INT64 *PosYArrayPtr,
+                     MIL_INT64 ControlFlag)
+   {
+   MgraDotsInt64(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag);
+   }
+
+inline void MgraDotsEx(MIL_ID ContextGraId,
+                       MIL_ID DstImageBufOrListGraId,
+                       MIL_INT  NumberOfDots,
+                       const MIL_INT64 *PosXArrayPtr,
+                       const MIL_INT64 *PosYArrayPtr,
+                       MIL_INT ControlFlag,
+                       MIL_ID NativeCalibration,
+                       MIL_INT64 NativeUnits,
+                       MIL_INT64 ConvertMode)
+   {
+   MgraDotsInt64Ex(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+inline void MgraDots(MIL_ID ContextGraId,
+                     MIL_ID DstImageBufOrListGraId,
+                     MIL_INT  NumberOfDots,
+                     const MIL_DOUBLE *PosXArrayPtr,
+                     const MIL_DOUBLE *PosYArrayPtr,
+                     MIL_INT64 ControlFlag)
+   {
+   MgraDotsDouble(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag);
+   }
+
+inline void MgraDotsEx(MIL_ID ContextGraId,
+                       MIL_ID DstImageBufOrListGraId,
+                       MIL_INT  NumberOfDots,
+                       const MIL_DOUBLE *PosXArrayPtr,
+                       const MIL_DOUBLE *PosYArrayPtr,
+                       MIL_INT ControlFlag,
+                       MIL_ID NativeCalibration,
+                       MIL_INT64 NativeUnits,
+                       MIL_INT64 ConvertMode)
+   {
+   MgraDotsDoubleEx(ContextGraId, DstImageBufOrListGraId, NumberOfDots, PosXArrayPtr, PosYArrayPtr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+//////////////////////////////////////////////////////////////
+// MgraLines function definition when compiling c++ files
+//////////////////////////////////////////////////////////////
+inline void MgraLines(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      MIL_INT NumberOfLinesOrVertices,
+                      const MIL_INT32 *XPtr,
+                      const MIL_INT32 *YPtr,
+                      const MIL_INT32 *X2Ptr,
+                      const MIL_INT32 *Y2Ptr,
+                      MIL_INT64 ControlFlag)
+   {
+   MgraLinesInt32(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag);
+   }
+
+inline void MgraLinesEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        MIL_INT NumberOfLinesOrVertices,
+                        const MIL_INT32 *XPtr,
+                        const MIL_INT32 *YPtr,
+                        const MIL_INT32 *X2Ptr,
+                        const MIL_INT32 *Y2Ptr,
+                        MIL_INT64 ControlFlag,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraLinesInt32Ex(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+inline void MgraLines(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      MIL_INT NumberOfLinesOrVertices,
+                      const MIL_INT64 *XPtr,
+                      const MIL_INT64 *YPtr,
+                      const MIL_INT64 *X2Ptr,
+                      const MIL_INT64 *Y2Ptr,
+                      MIL_INT64 ControlFlag)
+   {
+   MgraLinesInt64(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag);
+   }
+
+inline void MgraLinesEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        MIL_INT NumberOfLinesOrVertices,
+                        const MIL_INT64 *XPtr,
+                        const MIL_INT64 *YPtr,
+                        const MIL_INT64 *X2Ptr,
+                        const MIL_INT64 *Y2Ptr,
+                        MIL_INT64 ControlFlag,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraLinesInt64Ex(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+inline void MgraLines(MIL_ID ContextGraId,
+                      MIL_ID DstImageBufOrListGraId,
+                      MIL_INT NumberOfLinesOrVertices,
+                      const MIL_DOUBLE *XPtr,
+                      const MIL_DOUBLE *YPtr,
+                      const MIL_DOUBLE *X2Ptr,
+                      const MIL_DOUBLE *Y2Ptr,
+                      MIL_INT64 ControlFlag)
+   {
+   MgraLinesDouble(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag);
+   }
+
+inline void MgraLinesEx(MIL_ID ContextGraId,
+                        MIL_ID DstImageBufOrListGraId,
+                        MIL_INT NumberOfLinesOrVertices,
+                        const MIL_DOUBLE *XPtr,
+                        const MIL_DOUBLE *YPtr,
+                        const MIL_DOUBLE *X2Ptr,
+                        const MIL_DOUBLE *Y2Ptr,
+                        MIL_INT64 ControlFlag,
+                        MIL_ID NativeCalibration,
+                        MIL_INT64 NativeUnits,
+                        MIL_INT64 ConvertMode)
+   {
+   MgraLinesDoubleEx(ContextGraId, DstImageBufOrListGraId, NumberOfLinesOrVertices, XPtr, YPtr, X2Ptr, Y2Ptr, ControlFlag, NativeCalibration, NativeUnits, ConvertMode);
+   }
+
+#else //#if(defined(__cplusplus))
+
+//////////////////////////////////////////////////////////////
+// For C file, call the default function, i.e. MIL_INT one
+// for backward compatibility. For MgraSymbols, we have no
+// backward compatibility issues, prefer MgraSymbolsDouble.
+//////////////////////////////////////////////////////////////
+#if M_MIL_USE_64BIT
+   #define MgraDots     MgraDotsInt64
+   #define MgraDotsEx   MgraDotsInt64Ex
+   #define MgraLines    MgraLinesInt64
+   #define MgraLinesEx  MgraLinesInt64Ex   
+#else
+   #define MgraDots     MgraDotsInt32
+   #define MgraDotsEx   MgraDotsInt32Ex
+   #define MgraLines    MgraLinesInt32
+   #define MgraLinesEx  MgraLinesInt32Ex
+#endif
+
+#endif // #if(defined(__cplusplus)) #else
+
+/* For compatibility with possible future MgraSymbols
+   functions receiving arrays of other types. */
+#define MgraSymbols    MgraSymbolsDouble
+#define MgraSymbolsEx  MgraSymbolsDoubleEx
+
+#ifdef __cplusplus
+
+inline void MFTYPE MgraVectors(MIL_ID ContextGraId,
+                               MIL_ID DstImageBufOrListGraId,
+                               MIL_INT NumVectors,
+                               const MIL_DOUBLE *XArrayPtr,
+                               const MIL_DOUBLE *YArrayPtr,
+                               const MIL_DOUBLE *UArrayPtr,
+                               const MIL_DOUBLE *VArrayPtr,
+                               MIL_INT64 ScaleMode,
+                               MIL_DOUBLE ScaleValue,
+                               MIL_INT64 ControlFlag)
+   {
+   MgraVectorsDouble(ContextGraId,
+                     DstImageBufOrListGraId,
+                     NumVectors,
+                     XArrayPtr,
+                     YArrayPtr,
+                     UArrayPtr,
+                     VArrayPtr,
+                     ScaleMode,
+                     ScaleValue,
+                     ControlFlag);
+   }
+
+inline void MFTYPE MgraVectors(MIL_ID ContextGraId,
+                               MIL_ID DstImageBufOrListGraId,
+                               MIL_INT NumVectors,
+                               const MIL_FLOAT *XArrayPtr,
+                               const MIL_FLOAT *YArrayPtr,
+                               const MIL_FLOAT *UArrayPtr,
+                               const MIL_FLOAT *VArrayPtr,
+                               MIL_INT64 ScaleMode,
+                               MIL_DOUBLE ScaleValue,
+                               MIL_INT64 ControlFlag)
+   {
+   MgraVectorsFloat(ContextGraId,
+                    DstImageBufOrListGraId,
+                    NumVectors,
+                    XArrayPtr,
+                    YArrayPtr,
+                    UArrayPtr,
+                    VArrayPtr,
+                    ScaleMode,
+                    ScaleValue,
+                    ControlFlag);
+   }
+
+inline void MFTYPE MgraVectors(MIL_ID ContextGraId,
+                               MIL_ID DstImageBufOrListGraId,
+                               MIL_INT NumVectors,
+                               const MIL_INT32 *XArrayPtr,
+                               const MIL_INT32 *YArrayPtr,
+                               const MIL_INT32 *UArrayPtr,
+                               const MIL_INT32 *VArrayPtr,
+                               MIL_INT64 ScaleMode,
+                               MIL_DOUBLE ScaleValue,
+                               MIL_INT64 ControlFlag)
+   {
+   MgraVectorsInt32(ContextGraId,
+                    DstImageBufOrListGraId,
+                    NumVectors,
+                    XArrayPtr,
+                    YArrayPtr,
+                    UArrayPtr,
+                    VArrayPtr,
+                    ScaleMode,
+                    ScaleValue,
+                    ControlFlag);
+   }
+
+inline void MFTYPE MgraVectors(MIL_ID ContextGraId,
+                               MIL_ID DstImageBufOrListGraId,
+                               MIL_INT NumVectors,
+                               const MIL_INT64 *XArrayPtr,
+                               const MIL_INT64 *YArrayPtr,
+                               const MIL_INT64 *UArrayPtr,
+                               const MIL_INT64 *VArrayPtr,
+                               MIL_INT64 ScaleMode,
+                               MIL_DOUBLE ScaleValue,
+                               MIL_INT64 ControlFlag)
+   {
+   MgraVectorsInt64(ContextGraId,
+                    DstImageBufOrListGraId,
+                    NumVectors,
+                    XArrayPtr,
+                    YArrayPtr,
+                    UArrayPtr,
+                    VArrayPtr,
+                    ScaleMode,
+                    ScaleValue,
+                    ControlFlag);
+   }
+
+#else
+
+#define MgraVectors MgraVectorsDouble
+
+#endif
+
+#if M_MIL_USE_64BIT
+
+#define MgraVectorsInt MgraVectorsInt64
+
+#else
+
+#define MgraVectorsInt MgraVectorsInt32
+
+#endif
+
+#ifdef __cplusplus
+
+inline void MFTYPE MbufGetList(MIL_ID SrcBufId,
+                               MIL_INT NumPixels,
+                               const MIL_DOUBLE *PixXArrayPtr,
+                               const MIL_DOUBLE *PixYArrayPtr,
+                               MIL_INT64 InterpolationMode,
+                               void *UserArrayPtr)
+   {
+   MbufGetListDouble(SrcBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, InterpolationMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufGetList(MIL_ID SrcBufId,
+                               MIL_INT NumPixels,
+                               const MIL_INT32 *PixXArrayPtr,
+                               const MIL_INT32 *PixYArrayPtr,
+                               MIL_INT64 InterpolationMode,
+                               void *UserArrayPtr)
+   {
+   MbufGetListInt32(SrcBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, InterpolationMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufGetList(MIL_ID SrcBufId,
+                               MIL_INT NumPixels,
+                               const MIL_INT64 *PixXArrayPtr,
+                               const MIL_INT64 *PixYArrayPtr,
+                               MIL_INT64 InterpolationMode,
+                               void *UserArrayPtr)
+   {
+   MbufGetListInt64(SrcBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, InterpolationMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufPutList(MIL_ID DestBufId,
+                               MIL_INT NumPixels,
+                               const MIL_DOUBLE *PixXArrayPtr,
+                               const MIL_DOUBLE *PixYArrayPtr,
+                               MIL_INT64 OverscanMode,
+                               const void *UserArrayPtr)
+   {
+   MbufPutListDouble(DestBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, OverscanMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufPutList(MIL_ID DestBufId,
+                               MIL_INT NumPixels,
+                               const MIL_INT32 *PixXArrayPtr,
+                               const MIL_INT32 *PixYArrayPtr,
+                               MIL_INT64 OverscanMode,
+                               const void *UserArrayPtr)
+   {
+   MbufPutListInt32(DestBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, OverscanMode, UserArrayPtr);
+   }
+
+inline void MFTYPE MbufPutList(MIL_ID DestBufId,
+                               MIL_INT NumPixels,
+                               const MIL_INT64 *PixXArrayPtr,
+                               const MIL_INT64 *PixYArrayPtr,
+                               MIL_INT64 OverscanMode,
+                               const void *UserArrayPtr)
+   {
+   MbufPutListInt64(DestBufId, NumPixels, PixXArrayPtr, PixYArrayPtr, OverscanMode, UserArrayPtr);
+   }
+
+#else
+
+#define MbufGetList MbufGetListDouble
+#define MbufPutList MbufPutListDouble
+
+#endif
+
+#if M_MIL_USE_64BIT
+
+#define MbufGetListInt MbufGetListInt64
+#define MbufPutListInt MbufPutListInt64
+
+#else
+
+#define MbufGetListInt MbufGetListInt32
+#define MbufPutListInt MbufPutListInt32
+
+#endif
+
+//////////////////////////////////////////////////////////////
+// SafeType functions.
+//////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////
+// See milos.h for explanation about these functions.
+//////////////////////////////////////////////////////////////
+
+#if (defined __cplusplus)
+inline MIL_INT64 MgraInquireRequiredType(MIL_INT64 InquireType)
+   {
+   MIL_INT64 RequiredType = (InquireType & M_HLVLDATATYPE_MASK);
+
+   if (RequiredType != 0)
+      return RequiredType;
+
+   if ( (InquireType & (M_AVAILABLE|M_SUPPORTED)) != 0 )
+      return M_TYPE_MIL_INT;
+
+   // Here, only the +M_DEFAULT combo flag is left; remove it.
+   MIL_INT64 StrippedInquireType = ( InquireType & ~(M_HLVLDATATYPE_MASK|M_AVAILABLE|M_SUPPORTED|M_DEFAULT) );
+
+   if (M_IN_GRA_INQUIRE_MIL_ID_RANGE(StrippedInquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_GRA_INQUIRE_DOUBLE_RANGE(StrippedInquireType))
+      return M_TYPE_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+#endif //#if (defined __cplusplus)
+
+#if M_MIL_USE_SAFE_TYPE
+
+inline void SafeTypeError(MIL_CONST_TEXT_PTR FunctionName,
+                          MIL_CONST_TEXT_PTR Message = M_NULL);
+
+// Definition of the error function called at each error of bad type
+// of data passed to a void* argument.
+//
+// Application can define their own SafeTypeError function and
+// disable this one by adding #define M_MIL_SAFE_TYPE_ERROR_DEFINED 1
+// before including mil.h.
+
+#if !M_MIL_SAFE_TYPE_ERROR_DEFINED
+#define M_MIL_SAFE_TYPE_ERROR_DEFINED 1
+
+#ifndef M_MIL_USE_SAFE_TYPE_COMPILE_ERROR_ONLY
+inline void SafeTypeError(MIL_CONST_TEXT_PTR FunctionName,
+                          MIL_CONST_TEXT_PTR Message)
+   {
+   MfuncPrintMessage(
+      M_RESP_OK | M_ST_ERROR_TITLE,
+      MIL_TEXT("SafeType error in "), 
+      FunctionName,
+      MIL_TEXT(".\n"),
+      Message ? Message : MIL_TEXT("Pointer type is wrong."),
+      MIL_TEXT("\n\n\n"));
+   }
+#else
+inline void SafeTypeError(MIL_CONST_TEXT_PTR FunctionName,
+                          MIL_CONST_TEXT_PTR Message)
+   {
+   }
+#endif
+
+#endif
+
+inline void ReplaceTypeMilIdByTypeMilIntXX(MIL_INT64 *DataType)
+   {
+#if defined(M_MIL_USE_INT64_ID) && M_MIL_USE_INT64_ID
+   if(*DataType == M_TYPE_MIL_ID)
+      *DataType = M_TYPE_MIL_INT64;
+#else
+   if(*DataType == M_TYPE_MIL_ID)
+      *DataType = M_TYPE_MIL_INT32;
+#endif
+   }
+#endif //end M_MIL_USE_SAFE_TYPE
+
+
+// M_MIL_USE_SAFE_TYPE defined in milos.h.
+#if M_MIL_USE_SAFE_TYPE
+
+// ----------------------------------------------------------
+// MappGetError
+
+inline MIL_INT MFTYPE MappGetErrorUnsafe  (MIL_INT64 ErrorType, void           *ErrorPtr);
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, int             ErrorPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_TEXT_CHAR  *ErrorPtr);
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_INT        *ErrorPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_UINT       *ErrorPtr);
+#endif
+inline MIL_INT MFTYPE MappGetErrorUnsafe  (MIL_ID ContextAppId, MIL_INT64 ErrorType, void           *ErrorPtr);
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, int             ErrorPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_TEXT_CHAR  *ErrorPtr);
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_INT        *ErrorPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_UINT       *ErrorPtr);
+#endif
+
+//---------------------------------------------------------------------------------
+// MappGetHookInfo
+inline MIL_INT MFTYPE MappGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void               *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int                 ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT8           *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT16          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, void              **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, const void        **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_ID            **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, const MIL_ID      **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR       *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_CONST_TEXT_PTR *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT8          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT16         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT32         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT64         *ResultPtr);
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, wchar_t            *ResultPtr);
+#endif
+inline MIL_INT MFTYPE MappGetHookInfoUnsafe  (MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void               *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, int                 ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT8           *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT16          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void              **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, const void        **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_ID            **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, const MIL_ID      **ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR       *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_CONST_TEXT_PTR *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT8          *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT16         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT32         *ResultPtr);
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT64         *ResultPtr);
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, wchar_t            *ResultPtr);
+#endif
+
+//---------------------------------------------------------------
+// MappInquire
+inline MIL_INT MFTYPE MappInquireUnsafe  (MIL_INT64 InquireType, void           *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, int             UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_INT        *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr);
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_INT64      *UserVarPtr);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_UINT        *UserVarPtr);
+#endif
+inline MIL_INT MFTYPE MappInquireUnsafe  (MIL_ID ContextAppId, MIL_INT64 InquireType, void           *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, int             UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT        *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr);
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64      *UserVarPtr);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_UINT        *UserVarPtr);
+#endif
+
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MappFileOperationUnsafeA(    MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                void*              OperationDataPtr);
+inline void MFTYPE MappFileOperationUnsafeW(    MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                void*              OperationDataPtr);
+
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID             Comp1ContextAppId,
+                                                int                Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                MIL_INT*           OperationDataPtr);
+
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID             Comp1ContextAppId,
+                                                int                Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                MIL_INT*           OperationDataPtr);
+
+#if M_MIL_UNICODE_API
+#define MappFileOperationSafeType   MappFileOperationSafeTypeW
+#else
+#define MappFileOperationSafeType   MappFileOperationSafeTypeA
+#endif
+
+
+#else
+inline void MFTYPE MappFileOperationUnsafe(     MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                void*              OperationDataPtr);
+
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID             Comp1ContextAppId,
+                                                int                Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                int                OperationDataPtr);
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID             Comp1ContextAppId,
+                                                MIL_CONST_TEXT_PTR Comp1FileName,
+                                                MIL_ID             Comp2ContextAppId,
+                                                int                Comp2FileName,
+                                                MIL_INT64          Operation,
+                                                MIL_INT64          OperationFlag,
+                                                MIL_INT*           OperationDataPtr);
+#endif
+
+// ----------------------------------------------------------
+// MbufDiskInquire
+
+#if M_MIL_USE_UNICODE
+inline MIL_INT MFTYPE MbufDiskInquireUnsafeA  (MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, int          UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireUnsafeW  (MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, int          UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr);
+#endif
+
+#if M_MIL_UNICODE_API
+#define MbufDiskInquireSafeType MbufDiskInquireSafeTypeW
+#else
+#define MbufDiskInquireSafeType MbufDiskInquireSafeTypeA
+#endif
+
+#else
+inline MIL_INT MFTYPE MbufDiskInquireUnsafe   (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, int          UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, std::nullptr_t         ); 
+#endif
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr);
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeType (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr);
+#endif
+#endif
+
+// ----------------------------------------------------------
+// MbufGetHookInfo
+
+inline MIL_INT MFTYPE MbufGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *ResultPtr);
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int              ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t            ); 
+#endif
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *ResultPtr);
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *ResultPtr);
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64       *ResultPtr);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT        *ResultPtr);
+#endif
+
+
+// ----------------------------------------------------------
+// MbufInquireContainer
+inline MIL_INT MFTYPE MbufInquireContainerUnsafe  (MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, int              UserVarPtr);
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT8       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT32       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT64       *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MbufInquire
+
+inline MIL_INT MFTYPE MbufInquireUnsafe  (MIL_ID BufId, MIL_INT64 InquireType,       void            *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       int              ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT32       *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT64       *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_DOUBLE      *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_TEXT_CHAR   *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       char           **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const char           **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       signed char    **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const signed char    **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       unsigned char  **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const unsigned char  **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT16      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT16      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT16     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT16     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT32      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT32      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT32     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT32     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       float          **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const float          **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT64      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT64      **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT64     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT64     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_DOUBLE     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_DOUBLE     **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       void           **ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const void           **ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT32      *ResultPtr);
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT64      *ResultPtr);
+#endif
+
+#if M_MIL_USE_WINDOWS
+#if M_MIL_USE_DIRECTX_SERVICE
+struct IDirectDrawSurface;
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, IDirectDrawSurface   **ResultPtr);
+#endif // M_MIL_USE_DIRECTX_SERVICE
+struct tagBITMAPINFO;
+typedef tagBITMAPINFO BITMAPINFO;
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, BITMAPINFO           **ResultPtr);
+#endif // M_MIL_USE_WINDOWS
+
+// MbufInquireFeature
+
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MbufInquireFeatureUnsafeW  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MbufInquireFeatureUnsafeA  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+#endif
+
+
+#if M_MIL_UNICODE_API
+#define MbufInquireFeatureSafeType  MbufInquireFeatureSafeTypeW
+#else
+#define MbufInquireFeatureSafeType  MbufInquireFeatureSafeTypeA
+#endif
+
+#else
+
+inline void MFTYPE MbufInquireFeatureUnsafe  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void             *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64        *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32        *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool             *UserVarPtr);
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64       *UserVarPtr);
+#endif
+#endif
+
+// ----------------------------------------------------------
+// MbufInquireContainer
+inline MIL_INT MFTYPE MbufInquireContainerUnsafe  (MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, int              UserVarPtr);
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT8       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT32       *UserVarPtr);
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT64       *UserVarPtr);
+#endif
+
+///////
+
+// ----------------------------------------------------------
+
+// MbufControlFeature
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MbufControlFeatureUnsafeW  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MbufControlFeatureUnsafeA  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MbufControlFeatureUnsafe  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr);
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t               ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr);
+#endif
+#endif
+
+// ----------------------------------------------------------
+// MdigGetHookInfo
+
+inline MIL_INT MFTYPE MdigGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void           *ResultPtr);
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int             ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32      *ResultPtr);
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64      *ResultPtr);
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE     *ResultPtr);
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR    ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT       *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+
+// MdigInquire
+
+inline MIL_INT MFTYPE MdigInquireUnsafe  (MIL_ID DigId, MIL_INT64 InquireType, void           *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, int             ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_TEXT_CHAR  *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_INT32      *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_INT64      *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_DOUBLE     *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_ID         *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_UINT32     *ResultPtr);
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_UINT64     *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+
+// MdigInquireFeature
+
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MdigInquireFeatureUnsafeW  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTW_PTR    UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MdigInquireFeatureUnsafeA  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTA_PTR    UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MdigInquireFeatureUnsafe  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void             *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64        *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32        *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool             *UserVarPtr);
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64       *UserVarPtr);
+#endif
+
+#endif
+
+// ----------------------------------------------------------
+
+// MdigControlFeature
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MdigControlFeatureUnsafeW  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTW_PTR    UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MdigControlFeatureUnsafeA  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTA_PTR    UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MdigControlFeatureUnsafe  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr);
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr);
+#endif
+#endif
+// ----------------------------------------------------------
+// MfpgaGetHookInfo
+
+inline MIL_INT MFTYPE MfpgaGetHookInfoUnsafe  (MIL_ID  EventId, MIL_INT64 InfoType, void             *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_INT32        *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_INT64        *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_DOUBLE       *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_UINT32       *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_UINT64       *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MfpgaInquire
+
+inline MIL_INT MFTYPE MfpgaInquireUnsafe  (MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, void             *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_INT32        *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_INT64        *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_TEXT_CHAR    *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_UINT32       *UserVarPtr);
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_UINT64       *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MfuncInquire
+
+inline MIL_INT MFTYPE MfuncInquireUnsafe  (MIL_ID ObjectId, MIL_INT64 InquireType, void         *UserVarPtr);
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, int           UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_INT32    *UserVarPtr);
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_INT64    *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_UINT64   *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MgraInquire
+
+inline MIL_INT MFTYPE MgraInquireUnsafe  (MIL_ID ContextGraId, MIL_INT64 InquireType, void         *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, int           UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT8     *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT16    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT32    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT64    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, float        *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_DOUBLE   *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT8    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT16   *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT32   *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT64   *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MgraInquireList
+
+inline MIL_INT MFTYPE MgraInquireListUnsafe  (MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, void         *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, int           UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT8     *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT16    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT32    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT64    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, float        *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_DOUBLE   *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT8    *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT16   *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT32   *UserVarPtr);
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT64   *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MsysGetHookInfo
+
+inline MIL_INT MFTYPE MsysGetHookInfoUnsafe  (MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, void            *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, int              ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_INT32       *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_INT64       *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_DOUBLE      *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_TEXT_PTR     ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_UINT32      *ResultPtr);
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_UINT64      *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+// MsysInquire
+
+inline MIL_INT MFTYPE MsysInquireUnsafe  (MIL_ID SysId, MIL_INT64 InquireType, void            *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, int              ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_INT32       *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_INT64       *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_TEXT_CHAR   *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_DOUBLE      *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_UINT32      *ResultPtr);
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_UINT64      *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+// MsysInquireFeature
+
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MsysInquireFeatureUnsafeW  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MsysInquireFeatureUnsafeA  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void            *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool            *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MsysInquireFeatureUnsafe  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void             *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64        *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32        *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool             *UserVarPtr);
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64       *UserVarPtr);
+#endif
+
+#endif
+
+
+// ----------------------------------------------------------
+
+// MsysControlFeature
+#if M_MIL_USE_UNICODE
+
+inline void MFTYPE MsysControlFeatureUnsafeW  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+inline void MFTYPE MsysControlFeatureUnsafeA  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t);
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr);
+#endif
+
+#else
+
+inline void MFTYPE MsysControlFeatureUnsafe  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr);
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t              ); 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr);
+#endif
+#endif
+
+// ----------------------------------------------------------
+// MsysIoInquire
+
+inline MIL_INT MFTYPE MsysIoInquireUnsafe  (MIL_ID IoObjectId, MIL_INT64 InquireType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr);
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MsysIoCommandRegister
+inline MIL_INT MFTYPE MsysIoCommandRegisterUnsafe  (MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, void*    CommandStatusPtr);
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, int      CommandStatusPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, MIL_INT* CommandStatusPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, MIL_UINT* CommandStatusPtr);
+#endif
+
+//--------------------------------------------------------------------
+// MthrInquire
+
+inline MIL_INT MFTYPE MthrInquireUnsafe  (MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, void      *UserVarPtr);
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, int        UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, MIL_INT   *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, MIL_UINT  *UserVarPtr);
+#endif
+
+//--------------------------------------------------------------------
+// MseqGetHookInfo
+inline MIL_INT MFTYPE MseqGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int             *UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT        *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MseqInquire
+
+inline MIL_INT MFTYPE MseqInquireUnsafe  (MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, void            *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, int              UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr);
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MappInquireMp
+
+inline MIL_INT MFTYPE MappInquireMpUnsafe  (MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void       *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int         UserVarPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT32  *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64  *UserVarPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT32 *UserVarPtr);
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *UserVarPtr);
+#endif
+
+// ----------------------------------------------------------
+// MthrInquireMp
+
+inline MIL_INT MFTYPE MthrInquireMpUnsafe  (MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void       *ResultPtr);
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int         ResultPtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t);
+#endif
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT32  *ResultPtr);
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64  *ResultPtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT32 *ResultPtr);
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ResultPtr);
+#endif
+
+// ----------------------------------------------------------
+// MappControlMp
+
+inline void MFTYPE MappControlMpUnsafe  (MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void          *ValuePtr);
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int            ValuePtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t);
+#endif
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64     *ValuePtr);
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_TEXT_PTR   ValuePtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64    *ValuePtr);
+#endif
+
+// ----------------------------------------------------------
+// MthrControlMp
+
+inline void MFTYPE MthrControlMpUnsafe  (MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void       *ValuePtr);
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int         ValuePtr);
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t);
+#endif
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64  *ValuePtr);
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ValuePtr);
+#endif
+
+// -------------------------------------------------------------------------
+// MappGetError
+
+inline MIL_INT64 MappGetErrorRequiredType(MIL_INT64 ErrorType)
+   {
+   if ((ErrorType & M_STRING_SIZE) == M_STRING_SIZE)
+      return M_TYPE_MIL_INT;
+
+   if (((M_STRIP_CLIENT_TEXT_ENCODING(ErrorType)) & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE)))
+      return M_TYPE_TEXT_CHAR;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, int ErrorPtr)
+   {
+   if (ErrorPtr || (((M_STRIP_CLIENT_TEXT_ENCODING(ErrorType)) & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE))))
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ErrorType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, std::nullptr_t) 
+   { 
+   if(((M_STRIP_CLIENT_TEXT_ENCODING(ErrorType)) & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE)))
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ErrorType, NULL); 
+   }
+#endif
+
+inline MIL_INT MFTYPE MappGetErrorSafeTypeExecute (MIL_INT64 ErrorType, void *ErrorPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappGetErrorRequiredType(ErrorType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ErrorType, ErrorPtr);
+   }
+
+inline MIL_INT MFTYPE MappGetErrorUnsafe  (MIL_INT64 ErrorType, void           *ErrorPtr) {return MappGetError               (ErrorType, ErrorPtr                  );}
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_TEXT_CHAR  *ErrorPtr) {return MappGetErrorSafeTypeExecute(ErrorType, ErrorPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_INT        *ErrorPtr) {return MappGetErrorSafeTypeExecute(ErrorType, ErrorPtr, M_TYPE_MIL_INT  );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_UINT       *ErrorPtr) {return MappGetErrorSafeTypeExecute(ErrorType, ErrorPtr, M_TYPE_MIL_INT);}
+#endif
+
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, int ErrorPtr)
+   {
+   if (ErrorPtr || ((ErrorType & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE))))
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ContextAppId, ErrorType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, std::nullptr_t)
+   {
+   if((ErrorType & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE)))
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ContextAppId, ErrorType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappGetErrorSafeTypeExecute (MIL_ID ContextAppId, MIL_INT64 ErrorType, void  *ErrorPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappGetErrorRequiredType(ErrorType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappGetError"));
+
+   return MappGetError(ContextAppId, ErrorType, ErrorPtr);
+   }
+
+inline MIL_INT MFTYPE MappGetErrorUnsafe  (MIL_ID ContextAppId, MIL_INT64 ErrorType, void           *ErrorPtr) {return MappGetError               (ContextAppId, ErrorType, ErrorPtr                  );}
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_TEXT_CHAR  *ErrorPtr) {return MappGetErrorSafeTypeExecute(ContextAppId, ErrorType, ErrorPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_INT        *ErrorPtr) {return MappGetErrorSafeTypeExecute(ContextAppId, ErrorType, ErrorPtr, M_TYPE_MIL_INT  );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_UINT       *ErrorPtr) {return MappGetErrorSafeTypeExecute(ContextAppId, ErrorType, ErrorPtr, M_TYPE_MIL_INT);}
+#endif
+
+// ----------------------------------------------------------
+// MappGetHookInfo
+
+
+inline MIL_INT64 MappGetHookInfoRequiredType(MIL_ID EventId, MIL_INT64 InfoType)
+   {
+   if((InfoType & M_STRING_SIZE) == M_STRING_SIZE)
+      {
+      return M_TYPE_MIL_INT;
+      }
+
+   if (((M_STRIP_CLIENT_TEXT_ENCODING(InfoType)) & M_MESSAGE) == (M_STRIP_CLIENT_TEXT_ENCODING(M_MESSAGE)))
+      return M_TYPE_TEXT_CHAR;
+
+   if((InfoType & M_PARAM_VALUE) == M_PARAM_VALUE)
+      {
+      MIL_INT64 InquireParamType = ((InfoType & ~M_PARAM_VALUE) + M_EXTENDED_PARAM_TYPE);
+      MIL_INT64 ParamType;
+      MappGetHookInfo(EventId, InquireParamType, &ParamType);
+      if (ParamType == M_TYPE_ARRAY_ID_PTR || ParamType == M_TYPE_PTR || ParamType == M_TYPE_FILENAME || ParamType == M_TYPE_STRING )
+         ParamType = M_SAFE_TYPE_CHECK_PTR;
+      return ParamType;
+      }
+   
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappGetHookInfoRequiredType(EventId, InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"));
+
+   return MappGetHookInfo(EventId, InfoType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"));
+
+   return MappGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MappGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *ResultPtr) {return MappGetHookInfo               (EventId, InfoType, ResultPtr)                    ;}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT8        *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_CHAR       );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT16       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_SHORT      );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_DOUBLE     );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, void           **ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, const void     **ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_ID         **ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, const MIL_ID   **ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR    *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_CONST_TEXT_PTR *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT8       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_CHAR       );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT16      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_SHORT      );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT32      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT64      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64  );}
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, wchar_t         *ResultPtr) {return MappGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_TEXT   );}
+#endif
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeTypeExecute(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappGetHookInfoRequiredType(EventId, InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"));
+
+   return MappGetHookInfo(ContextAppId, EventId, InfoType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"));
+
+   return MappGetHookInfo(ContextAppId, EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MappGetHookInfo(ContextAppId, EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappGetHookInfoUnsafe  (MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void            *ResultPtr) {return MappGetHookInfo               (ContextAppId, EventId, InfoType, ResultPtr)                    ;}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT8        *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_CHAR       );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT16       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_SHORT      );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_DOUBLE     );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, void           **ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, const void     **ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_ID         **ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, const MIL_ID   **ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR    *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_CONST_TEXT_PTR *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT8       *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_CHAR       );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT16      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_SHORT      );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT32      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32  );}
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT64      *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64  );}
+#endif
+#if M_MIL_SAFE_TYPE_ADD_WCHAR_T
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, wchar_t         *ResultPtr) {return MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, ResultPtr, M_TYPE_MIL_TEXT   );}
+#endif
+
+//-----------------------------------------------------------------------------
+// MappInquire
+
+inline MIL_INT64 MappInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_APP_INQUIRE_STRING_RANGE(InquireType))
+      {
+      return M_TYPE_TEXT_CHAR;
+      }
+
+
+   if(M_IN_APP_INQUIRE_DOUBLE_RANGE(InquireType))
+      {
+      return M_TYPE_DOUBLE;
+      }
+
+   if(M_IN_APP_INQUIRE_MIL_ID_RANGE(InquireType))
+      {
+      return M_TYPE_MIL_ID;
+      }
+
+   if(M_IN_APP_INQUIRE_MIL_INT64_RANGE(InquireType))
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MappInquire"));
+
+   return MappInquire(InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, std::nullptr_t            ) {return MappInquire               (InquireType, NULL);}
+#endif
+
+inline MIL_INT MFTYPE MappInquireSafeTypeExecute (MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappInquire"));
+
+   return MappInquire(InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MappInquireUnsafe  (MIL_INT64 InquireType, void           *UserVarPtr) {return MappInquire               (InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_INT        *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_INT64      *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_UINT       *UserVarPtr) {return MappInquireSafeTypeExecute(InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MappInquire"));
+
+   return MappInquire(ContextAppId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MappInquire(ContextAppId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappInquireSafeTypeExecute(MIL_ID ContextAppId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MappInquire"));
+
+   return MappInquire(ContextAppId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MappInquireUnsafe  (MIL_ID ContextAppId, MIL_INT64 InquireType, void           *UserVarPtr) {return MappInquire               (ContextAppId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT        *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64      *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_UINT       *UserVarPtr) {return MappInquireSafeTypeExecute(ContextAppId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+
+#if M_MIL_USE_UNICODE
+// ----------------------------------------------------------
+// MappFileOperation
+inline void MFTYPE MappFileOperationUnsafeA(    MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                void*                   OperationDataPtr)
+   {
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationUnsafeW(    MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                void*                   OperationDataPtr)
+   {
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappFileOperationSafeTypeW(MIL_ID                  Comp1ContextAppId,
+                                              MIL_CONST_TEXTW_PTR     Comp1FileName,
+                                              MIL_ID                  Comp2ContextAppId,
+                                              MIL_CONST_TEXTW_PTR     Comp2FileName,
+                                              MIL_INT64               Operation,
+                                              MIL_INT64               OperationFlag,
+                                              std::nullptr_t          )
+   {
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(MIL_ID                 Comp1ContextAppId,
+                                              MIL_CONST_TEXTW_PTR    Comp1FileName,
+                                              MIL_ID                 Comp2ContextAppId,
+                                              int                    Comp2FileName,
+                                              MIL_INT64              Operation,
+                                              MIL_INT64              OperationFlag,
+                                              std::nullptr_t)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+
+#endif
+
+
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID                  Comp1ContextAppId,
+                                                int                     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTW_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp1FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, NULL, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID                 Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR    Comp1FileName,
+                                                MIL_ID                 Comp2ContextAppId,
+                                                int                    Comp2FileName,
+                                                MIL_INT64              Operation,
+                                                MIL_INT64              OperationFlag,
+                                                int                    OperationDataPtr)
+   {
+   if (Comp2FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(  MIL_ID                     Comp1ContextAppId,
+                                                MIL_CONST_TEXTW_PTR        Comp1FileName,
+                                                MIL_ID                     Comp2ContextAppId,
+                                                int                        Comp2FileName,
+                                                MIL_INT64                  Operation,
+                                                MIL_INT64                  OperationFlag,
+                                                MIL_INT*                   OperationDataPtr)
+   {
+   if(Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeTypeW(MIL_ID                     Comp1ContextAppId,
+                                              MIL_CONST_TEXTW_PTR        Comp1FileName,
+                                              MIL_ID                     Comp2ContextAppId,
+                                              int                        Comp2FileName,
+                                              MIL_INT64                  Operation,
+                                              MIL_INT64                  OperationFlag,
+                                              MIL_TEXT_PTR               OperationDataPtr)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationW(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID                  Comp1ContextAppId,
+                                                int                     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp1FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, NULL, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappFileOperationSafeTypeA(MIL_ID                  Comp1ContextAppId,
+                                              MIL_CONST_TEXTA_PTR     Comp1FileName,
+                                              MIL_ID                  Comp2ContextAppId,
+                                              MIL_CONST_TEXTA_PTR     Comp2FileName,
+                                              MIL_INT64               Operation,
+                                              MIL_INT64               OperationFlag,
+                                              std::nullptr_t          )
+   {
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeA(MIL_ID                 Comp1ContextAppId,
+                                              MIL_CONST_TEXTA_PTR    Comp1FileName,
+                                              MIL_ID                 Comp2ContextAppId,
+                                              int                    Comp2FileName,
+                                              MIL_INT64              Operation,
+                                              MIL_INT64              OperationFlag,
+                                              std::nullptr_t)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+
+#endif
+
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID                  Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                int                     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp2FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeTypeA(  MIL_ID                     Comp1ContextAppId,
+                                                MIL_CONST_TEXTA_PTR        Comp1FileName,
+                                                MIL_ID                     Comp2ContextAppId,
+                                                int                        Comp2FileName,
+                                                MIL_INT64                  Operation,
+                                                MIL_INT64                  OperationFlag,
+                                                MIL_INT*                   OperationDataPtr)
+   {
+   if(Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperationSafeTypeA(MIL_ID                     Comp1ContextAppId,
+                                              MIL_CONST_TEXTA_PTR        Comp1FileName,
+                                              MIL_ID                     Comp2ContextAppId,
+                                              int                        Comp2FileName,
+                                              MIL_INT64                  Operation,
+                                              MIL_INT64                  OperationFlag,
+                                              MIL_TEXT_PTR               OperationDataPtr)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperationA(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+
+
+#if M_MIL_UNICODE_API
+#define MappFileOperationUnsafe      MappFileOperationUnsafeW
+#else
+#define MappFileOperationUnsafe      MappFileOperationUnsafeA
+#endif
+#else
+
+inline void MFTYPE MappFileOperationUnsafe(     MIL_ID                  Comp1ContextAppId,
+                                                const char*             Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                const char*             Comp2FileName, 
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                void*                   OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID                  Comp1ContextAppId,
+                                                const char*             Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                const char*             Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                  Comp1ContextAppId,
+                                             const char*             Comp1FileName,
+                                             MIL_ID                  Comp2ContextAppId,
+                                             const char*             Comp2FileName,
+                                             MIL_INT64               Operation,
+                                             MIL_INT64               OperationFlag,
+                                             std::nullptr_t          )
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                 Comp1ContextAppId,
+                                             const char*            Comp1FileName,
+                                             MIL_ID                 Comp2ContextAppId,
+                                             int                    Comp2FileName,
+                                             MIL_INT64              Operation,
+                                             MIL_INT64              OperationFlag,
+                                             std::nullptr_t)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+
+#endif
+
+
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID                  Comp1ContextAppId,
+                                                int                     Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                const char*             Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp1FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, NULL, Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, NULL);
+   }
+inline void MFTYPE MappFileOperationSafeType(  MIL_ID                  Comp1ContextAppId,
+                                                const char*             Comp1FileName,
+                                                MIL_ID                  Comp2ContextAppId,
+                                                int                     Comp2FileName,
+                                                MIL_INT64               Operation,
+                                                MIL_INT64               OperationFlag,
+                                                int                     OperationDataPtr)
+   {
+   if (Comp2FileName || OperationDataPtr)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, NULL);
+   }
+
+inline void MFTYPE MappFileOperationSafeType(   MIL_ID                     Comp1ContextAppId,
+                                                const char*                Comp1FileName,
+                                                MIL_ID                     Comp2ContextAppId,
+                                                int                        Comp2FileName,
+                                                MIL_INT64                  Operation,
+                                                MIL_INT64                  OperationFlag,
+                                                MIL_INT*                   OperationDataPtr)
+   {
+   if(Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                     Comp1ContextAppId,
+                                             const char*                Comp1FileName,
+                                             MIL_ID                     Comp2ContextAppId,
+                                             int                        Comp2FileName,
+                                             MIL_INT64                  Operation,
+                                             MIL_INT64                  OperationFlag,
+                                             MIL_TEXT_PTR               OperationDataPtr)
+   {
+   if (Comp2FileName)
+      SafeTypeError(MIL_TEXT("MappFileOperation"));
+
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, NULL, Operation, OperationFlag, (void*)OperationDataPtr);
+   }
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MappInquireConnection
+inline MIL_INT64 MappInquireConnectionRequiredType(MIL_INT64 InquireType)
+   {
+   if ((InquireType == M_DMIL_PUBLISHED_LIST) ||
+       (InquireType == M_DMIL_PUBLISHED_NAME) ||
+       ((InquireType >= M_WEB_PUBLISHED_LIST) && (InquireType < (M_WEB_PUBLISHED_LIST + M_MAX_WEBSOCKET_SERVER))) ||
+       ((InquireType >= M_WEB_PUBLISHED_NAME) && (InquireType < (M_WEB_PUBLISHED_NAME + M_MAX_WEBSOCKET_SERVER))))
+      return M_TYPE_MIL_ID;
+   else if ((InquireType == M_DMIL_PUBLISHED_LIST_SIZE) ||
+            ((InquireType >= M_WEB_PUBLISHED_LIST_SIZE) && (InquireType < (M_WEB_PUBLISHED_LIST_SIZE + M_MAX_WEBSOCKET_SERVER))))
+      return M_TYPE_MIL_INT64;
+   else
+      {
+      SafeTypeError(MIL_TEXT("MappInquireConnectionSafeType"));
+      return M_NULL;
+      }
+   }
+
+inline MIL_INT MappInquireConnectionSafeTypeExecute(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void * UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappInquireConnectionRequiredType(InquireType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+   
+   if (RequiredType != GivenType) 
+      {
+      SafeTypeError(MIL_TEXT("MappInquireConnectionSafeType"));
+      }
+      
+   return MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr);
+   }
+
+//declare functions
+inline MIL_INT MFTYPE MappInquireConnectionUnsafe  (MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void             *UserVarPtr)  {return MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr);}
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, MIL_INT32        *UserVarPtr)  { return MappInquireConnectionSafeTypeExecute(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr, M_TYPE_MIL_INT32); }
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, MIL_INT64        *UserVarPtr)  { return MappInquireConnectionSafeTypeExecute(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr, M_TYPE_MIL_INT64); }
+#if !M_MIL_USE_LINUX
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, int              *UserVarPtr)  { return MappInquireConnectionSafeTypeExecute(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr, M_TYPE_MIL_INT32); }
+#endif
+
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MappInquireConnectionSafeType"));
+
+   return MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireConnectionSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, std::nullptr_t              ) { return MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, NULL); }
+#endif
+
+
+// ----------------------------------------------------------
+// MbufDiskInquire
+
+inline MIL_INT64 MbufDiskInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (
+      InquireType == M_ASPECT_RATIO ||
+      InquireType == M_FRAME_RATE
+      )
+      return M_TYPE_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+
+#if M_MIL_USE_UNICODE
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireA"));
+
+   return MbufDiskInquireA(FileName, InquireType, NULL);
+   }
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireW"));
+
+   return MbufDiskInquireW(FileName, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MbufDiskInquireA(FileName, InquireType, NULL);
+   }
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MbufDiskInquireW(FileName, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeAExecute(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, void     *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufDiskInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireSafeTypeA"));
+
+   return MbufDiskInquireA(FileName, InquireType, UserVarPtr);;
+   }
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeWExecute(MIL_CONST_TEXTW_PTR     FileName, MIL_INT64 InquireType, void     *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufDiskInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireSafeTypeW"));
+
+   return MbufDiskInquireW(FileName, InquireType, UserVarPtr);;
+   }
+
+inline MIL_INT MFTYPE MbufDiskInquireUnsafeA  (MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr) {return MbufDiskInquireA(FileName, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr) {return MbufDiskInquireSafeTypeAExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) {return MbufDiskInquireSafeTypeAExecute(FileName, InquireType, UserVarPtr, M_TYPE_DOUBLE );}
+
+inline MIL_INT MFTYPE MbufDiskInquireUnsafeW  (MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr) {return MbufDiskInquireW(FileName, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr) {return MbufDiskInquireSafeTypeWExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) {return MbufDiskInquireSafeTypeWExecute(FileName, InquireType, UserVarPtr, M_TYPE_DOUBLE );}
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeA(MIL_CONST_TEXTA_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr) {return MbufDiskInquireSafeTypeAExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeW(MIL_CONST_TEXTW_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr) {return MbufDiskInquireSafeTypeWExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+#endif
+
+#if M_MIL_UNICODE_API
+#define MbufDiskInquireUnsafe             MbufDiskInquireUnsafeW
+#define MbufDiskInquireSafeTypeExecute    MbufDiskInquireSafeTypeWExecute
+#define MbufDiskInquireSafeType           MbufDiskInquireSafeTypeW
+#else
+#define MbufDiskInquireUnsafe             MbufDiskInquireUnsafeA
+#define MbufDiskInquireSafeTypeExecute    MbufDiskInquireSafeTypeAExecute
+#define MbufDiskInquireSafeType           MbufDiskInquireSafeTypeA
+#endif
+
+#else
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr != M_NULL)
+      SafeTypeError(MIL_TEXT("MbufDiskInquire"));
+
+   return MbufDiskInquire(FileName, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MbufDiskInquire(FileName, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeTypeExecute(MIL_CONST_TEXT_PTR     FileName, MIL_INT64 InquireType, void     *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufDiskInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufDiskInquireSafeType"));
+
+   return MbufDiskInquire(FileName, InquireType, UserVarPtr);;
+   }
+inline MIL_INT MFTYPE MbufDiskInquireUnsafe  (MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, void        *UserVarPtr) {return MbufDiskInquire(FileName, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr) {return MbufDiskInquireSafeTypeExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) {return MbufDiskInquireSafeTypeExecute(FileName, InquireType, UserVarPtr, M_TYPE_DOUBLE );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(MIL_CONST_TEXT_PTR FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr) {return MbufDiskInquireSafeTypeExecute(FileName, InquireType, UserVarPtr, M_TYPE_MIL_INT);}
+#endif
+
+#endif
+// ----------------------------------------------------------
+// MbufGetHookInfo
+
+
+inline MIL_INT64 MbufGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   switch (InfoType)
+      {
+      case M_MODIFIED_BUFFER+M_BUFFER_ID:
+         return M_TYPE_MIL_ID;
+         break;
+
+      case M_MODIFIED_BUFFER+M_GRAB_TIME_STAMP:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER1:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER2:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER3:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER4:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER5:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER6:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER7:
+      case M_MODIFIED_BUFFER+M_TIMER_VALUE+M_TIMER8:
+
+        return M_TYPE_DOUBLE;
+        break;
+#if !M_MIL_USE_64BIT
+      case M_USER_DATA_SIZE:
+      case M_FORMAT:
+         return M_TYPE_MIL_INT64;
+         break;
+#endif
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MbufGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufGetHookInfoRequiredType(InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufGetHookInfo"));
+
+   return MbufGetHookInfo(EventId, InfoType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MbufGetHookInfo"));
+
+   return MbufGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MbufGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *ResultPtr) {return MbufGetHookInfo               (EventId, InfoType, ResultPtr)                  ;}
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *ResultPtr) {return MbufGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT  );}
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE      *ResultPtr) {return MbufGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_DOUBLE   );}
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64       *ResultPtr) { return MbufGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64); }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT        *ResultPtr) {return MbufGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT  );}
+#endif
+
+
+// ----------------------------------------------------------
+// MbufInquireContainer
+inline MIL_INT64 MbufInquireContainerRequiredType(MIL_INT64 InquireType)
+   {
+   if(M_IN_BUF_INQUIRE_PTR_RANGE(InquireType))
+      return M_SAFE_TYPE_CHECK_PTR;
+
+   if(M_IN_BUF_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if(M_IN_BUF_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if(M_IN_BUF_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_DOUBLE;
+
+   if(M_IN_BUF_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if(UserVarPtr || M_BUF_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MbufInquireContainer"));
+
+   return MbufInquireContainer(ContainerBufId, Component, InquireType, M_NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_BUF_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MbufInquireContainer"));
+
+   return MbufInquireContainer(ContainerBufId, Component, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufInquireContainerSafeTypeExecute(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, void *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufInquireContainerRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if(RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquireContainer"));
+
+   return MbufInquireContainer(ContainerBufId, Component, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MbufInquireContainerUnsafe  (MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, void *UserVarPtr)            { return MbufInquireContainer(ContainerBufId, Component, InquireType, UserVarPtr); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_TEXT_CHAR *UserVarPtr)   { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);  }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_DOUBLE); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT8       *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_UINT8); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_INT32); }
+inline MIL_INT MFTYPE MbufInquireContainerSafeType(MIL_ID ContainerBufId, MIL_INT64 Component, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr) { return MbufInquireContainerSafeTypeExecute(ContainerBufId, Component, InquireType, UserVarPtr, M_TYPE_MIL_INT64); }
+#endif
+
+// ----------------------------------------------------------
+// MbufInquire
+
+
+inline MIL_INT64 MbufInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if(M_IN_BUF_INQUIRE_PTR_RANGE(InquireType))
+      return M_SAFE_TYPE_CHECK_PTR;
+
+   if (M_IN_BUF_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_BUF_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_BUF_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_DOUBLE;
+
+   if (M_IN_BUF_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, int ResultPtr)
+   {
+   if (ResultPtr || M_BUF_INQUIRE_MUST_HAVE_USER_PTR(InquireType))  
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquire(BufId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_BUF_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquire(BufId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufInquireSafeTypeExecute (MIL_ID BufId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MbufInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquire(BufId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MbufInquireUnsafe  (MIL_ID BufId, MIL_INT64 InquireType,       void            *ResultPtr) {return MbufInquire               (BufId, InquireType, ResultPtr);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT32       *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT64       *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_DOUBLE      *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_DOUBLE   );}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_TEXT_CHAR   *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       char           **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const char           **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       signed char    **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const signed char    **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       unsigned char  **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const unsigned char  **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT16      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT16      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT16     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT16     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT32      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT32      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT32     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT32     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       float          **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const float          **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_INT64      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_INT64      **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT64     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_UINT64     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_DOUBLE     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_DOUBLE     **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       void           **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const void           **ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_SAFE_TYPE_CHECK_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT32      *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MIL_UINT64      *ResultPtr) {return MbufInquireSafeTypeExecute(BufId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#ifdef __MILBUFFERINFO_H__
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType,       MilBufferInfo **ResultPtr)
+   {
+   if (InquireType != M_BUFFER_INFO)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquireUnsafe(BufId, InquireType, ResultPtr);
+   }
+
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MilBufferInfo **ResultPtr)
+   {
+   if (InquireType != M_BUFFER_INFO)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquireUnsafe(BufId, InquireType, ResultPtr);
+   }
+#endif
+
+#if M_MIL_USE_WINDOWS
+#if M_MIL_USE_DIRECTX_SERVICE
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, IDirectDrawSurface   **ResultPtr)
+   {
+   if (InquireType != M_DDRAW_SURFACE)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquireUnsafe(BufId, InquireType, ResultPtr);
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, BITMAPINFO           **ResultPtr)
+   {
+   if (InquireType != M_BITMAPINFO)
+      SafeTypeError(MIL_TEXT("MbufInquire"));
+
+   return MbufInquireUnsafe(BufId, InquireType, ResultPtr);
+   }
+#endif
+
+inline MIL_INT64 InquireFeatureRequiredType(MIL_INT64 InquireType, MIL_INT64 UserVarType)
+   {
+   MIL_INT64 Type = 0;
+
+   if((M_GET_INTERMOD_VALUE_BITS(InquireType) == M_STRING_SIZE) || (InquireType & M_FEATURE_SIZE))
+      Type = M_TYPE_MIL_INT;
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+   else if(InquireType & M_LENGTH)
+      {
+      if(UserVarType == M_TYPE_REGISTER)
+         Type = M_TYPE_INT64;
+      else
+         Type = M_TYPE_MIL_INT;
+      }
+#endif
+   else
+      {
+      switch (M_FEATURE_OP(InquireType))
+         {
+         case M_FEATURE_PRESENT:
+         case M_FEATURE_EXECUTE_COMPLETED:
+            Type = M_TYPE_MIL_INT32;
+            break;
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION && OldDefinesSupport)
+         case M_FEATURE_VALUE_AS_STRING_INTERNAL:
+#endif
+         case M_FEATURE_NAME:
+         case M_FEATURE_DISPLAY_NAME:
+         case M_FEATURE_TOOLTIP:
+         case M_FEATURE_DESCRIPTION:
+         case M_FEATURE_UNIT:
+            Type = M_TYPE_TEXT_CHAR;
+            break;
+         case M_FEATURE_TYPE:
+         case M_FEATURE_ACCESS_MODE:
+         case M_FEATURE_VISIBILITY:
+         case M_FEATURE_CACHING_MODE:
+         case M_FEATURE_STREAMABLE:
+         case M_FEATURE_DEPRECATED:
+         case M_FEATURE_REPRESENTATION:
+         case M_FEATURE_POLLING_INTERVAL:
+            Type = M_TYPE_INT64;
+            break;
+         case M_GC_NODE_COUNT:
+         case M_FEATURE_CHANGE_HOOK:
+            Type = M_TYPE_MIL_INT;
+            break;
+         case M_FEATURE_MIN:
+         case M_FEATURE_MAX:
+         case M_FEATURE_INCREMENT:
+            {
+            if (UserVarType == M_TYPE_DOUBLE)
+               Type = M_TYPE_DOUBLE;
+            else if (UserVarType == M_TYPE_MIL_INT32)
+               Type = M_TYPE_MIL_INT32;
+            else
+               Type = M_TYPE_INT64;
+            }
+            break;
+         default:
+            {
+            if (M_FEATURE_ENUM(InquireType) == M_GC_NODES)
+               {
+               if ((InquireType & (~M_SUBFEATURE_INDEX_MASK)) == M_SUBFEATURE_COUNT)
+                  Type = M_TYPE_MIL_INT;
+               else if ((InquireType & (~M_SUBFEATURE_INDEX_MASK)) == M_SUBFEATURE_NAME)
+                  Type = M_TYPE_TEXT_CHAR;
+               else if ((InquireType & (~M_SUBFEATURE_INDEX_MASK)) == (M_SUBFEATURE_NAME + M_STRING_SIZE))
+                  Type = M_TYPE_MIL_INT;
+               else if ((InquireType & (~M_SUBFEATURE_INDEX_MASK)) == M_SUBFEATURE_TYPE)
+                  Type = M_TYPE_INT64;
+               }
+            else if (M_FEATURE_ENUM(InquireType) == M_FEATURE_ENUM_ENTRY)
+               {
+               if ((InquireType & (~M_FEATURE_ENUM_ENTRY_INDEX_MASK)) == M_FEATURE_ENUM_ENTRY_COUNT)
+                  Type = M_TYPE_MIL_INT;
+               else if ((InquireType & (~M_FEATURE_ENUM_ENTRY_INDEX_MASK)) == M_FEATURE_ENUM_ENTRY_NAME)
+                  Type = M_TYPE_TEXT_CHAR;
+               else if ((InquireType & (~M_FEATURE_ENUM_ENTRY_INDEX_MASK)) == (M_FEATURE_ENUM_ENTRY_NAME + M_STRING_SIZE))
+                  Type = M_TYPE_MIL_INT;
+               else if ((InquireType & (~M_FEATURE_ENUM_ENTRY_INDEX_MASK)) == M_FEATURE_ENUM_ENTRY_VALUE)
+                  Type = M_TYPE_INT64;
+               }
+            }
+            break;
+         }
+      }
+
+   if(Type == 0)
+      {
+      switch(UserVarType)
+         {
+         case M_TYPE_STRING:
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_ENUMERATION + M_TYPE_STRING: //M_TYPE_STRING_ENUMERATION:
+         case M_TYPE_REGISTER + M_TYPE_STRING: //M_TYPE_REGISTER_FROM_STRING:
+         case M_TYPE_VALUE + M_TYPE_STRING: //M_TYPE_VALUE_FROM_STRING:
+#endif
+            Type = M_TYPE_TEXT_CHAR;
+            break;
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_ENUMERATION:
+            Type = M_TYPE_INT64;
+            break;
+         case M_TYPE_ENUMERATION + M_TYPE_MIL_INT32: //M_TYPE_INTEGER_ENUMERATION:
+            Type = M_TYPE_INT64;
+            break;
+#endif
+         case M_TYPE_BOOLEAN:
+         case M_TYPE_MIL_INT32:
+            Type = M_TYPE_MIL_INT32;
+            break;
+         case M_TYPE_INT64:
+            Type = M_TYPE_INT64;
+            break;
+         case M_TYPE_DOUBLE:
+            Type = M_TYPE_DOUBLE;
+            break;
+         default:
+            if (M_FEATURE_USER_ARRAY_SIZE_BIT_SET(UserVarType))
+               {
+               switch (M_STRIP_FEATURE_USER_ARRAY_SIZE_VALUE(UserVarType))
+                  {
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+                  case M_TYPE_REGISTER:
+#endif
+                  case M_TYPE_UINT8:
+                     Type = M_TYPE_UINT8;
+                     break;
+                  default:
+                     Type = M_TYPE_TEXT_CHAR;
+                     break;
+                  }
+               }
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+            else if ((UserVarType & M_TYPE_REGISTER) == M_TYPE_REGISTER)
+               Type = M_TYPE_UINT8;
+#endif
+            else if ((UserVarType & M_TYPE_UINT8) == M_TYPE_UINT8)
+               Type = M_TYPE_UINT8;
+            else
+               Type = 0;
+            break;
+         }
+      }
+
+   return Type;
+   }
+
+inline MIL_INT64 ControlFeatureRequiredType(MIL_INT64 ControlType, MIL_INT64 UserVarType)
+   {
+   MIL_INT64 Type = 0;
+
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION && OldDefinesSupport)
+   if (M_FEATURE_OP(ControlType) == M_FEATURE_VALUE_AS_STRING_INTERNAL)
+      Type = M_TYPE_TEXT_CHAR;
+   else
+#endif
+   if(M_FEATURE_OP(ControlType) == M_FEATURE_CHANGE_HOOK)
+      Type = M_TYPE_MIL_INT;
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+   else if((M_FEATURE_OP(ControlType) == M_FEATURE_EXECUTE) && (UserVarType == M_DEFAULT))
+      Type = M_DEFAULT;
+#else
+   else if(M_FEATURE_OP(ControlType) == M_FEATURE_EXECUTE)
+      Type = M_DEFAULT;
+#endif
+   else if(M_FEATURE_OP(ControlType) == M_FEATURE_MAX || M_FEATURE_OP(ControlType) == M_FEATURE_MIN)
+      Type = M_DEFAULT;
+   else
+      {
+      switch(UserVarType)
+         {
+         case M_TYPE_STRING:
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_ENUMERATION + M_TYPE_STRING: //M_TYPE_STRING_ENUMERATION:
+         case M_TYPE_REGISTER + M_TYPE_STRING: //M_TYPE_REGISTER_FROM_STRING:
+         case M_TYPE_VALUE + M_TYPE_STRING: //M_TYPE_VALUE_FROM_STRING:
+#endif
+            Type = M_TYPE_TEXT_CHAR;
+            break;
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_ENUMERATION:
+            Type = M_TYPE_INT64;
+            break;
+         case M_TYPE_ENUMERATION + M_TYPE_MIL_INT32: //M_TYPE_INTEGER_ENUMERATION:
+            Type = M_TYPE_INT64;
+            break;
+#endif
+         case M_TYPE_INT64:
+            Type = M_TYPE_INT64;
+            break;
+         case M_TYPE_DOUBLE:
+            Type = M_TYPE_DOUBLE;
+            break;
+         case M_TYPE_MIL_INT32:
+         case M_TYPE_BOOLEAN:
+            Type = M_TYPE_MIL_INT32;
+            break;
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+         case M_TYPE_COMMAND:
+            Type = M_TYPE_COMMAND;
+            break;
+#endif
+         default:
+            if (M_FEATURE_USER_ARRAY_SIZE_BIT_SET(UserVarType))
+               {
+               switch (M_STRIP_FEATURE_USER_ARRAY_SIZE_VALUE(UserVarType))
+                  {
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+                  case M_TYPE_REGISTER:
+#endif
+                  case M_TYPE_UINT8:
+                     Type = M_TYPE_UINT8;
+                     break;
+                  case M_TYPE_STRING:
+                     Type = M_TYPE_STRING;
+                     break;
+                  default:
+                     Type = 0;
+                     break;
+                  }
+               }
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+            else if ((UserVarType & M_TYPE_REGISTER) == M_TYPE_REGISTER)
+               Type = M_TYPE_UINT8;
+#endif
+            else if ((UserVarType & M_TYPE_UINT8) == M_TYPE_UINT8)
+               Type = M_TYPE_UINT8;
+            else
+               Type = 0;
+            break;
+         }
+      }
+
+   return Type;
+   }
+
+// ----------------------------------------------------------
+// MbufInquireFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MbufInquireFeatureExecuteW (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufInquireFeatureExecuteA (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+#if M_MIL_UNICODE_API
+#define MbufInquireFeatureExecute  MbufInquireFeatureExecuteW
+#else
+#define MbufInquireFeatureExecute  MbufInquireFeatureExecuteA
+#endif
+
+inline void MFTYPE MbufInquireFeatureUnsafeW  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MbufInquireFeatureW(BufId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteW(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+inline void MFTYPE MbufInquireFeatureUnsafeA  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MbufInquireFeatureA(BufId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MbufInquireFeatureExecuteA(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MbufInquireFeatureUnsafe MbufInquireFeatureUnsafeW
+#else
+#define MbufInquireFeatureUnsafe MbufInquireFeatureUnsafeA
+#endif
+
+#else
+
+inline void MFTYPE MbufInquireFeatureExecute (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureUnsafe  (MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, (void*)((MIL_UINT)UserVarPtr));
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MbufInquireFeature(BufId, InquireType, FeatureName, UserVarType, (void*)NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#endif //M_MIL_USE_UNICODE
+// ----------------------------------------------------------
+// MbufControlFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MbufControlFeatureExecuteW (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufControlFeatureExecuteW (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+   else if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureW(BufId, ControlType, FeatureName, UserVarType, NULL);
+   }
+
+inline void MFTYPE MbufControlFeatureExecuteA (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufControlFeatureExecuteA (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureA(BufId, ControlType, FeatureName, UserVarType, NULL);
+   }
+
+#if M_MIL_UNICODE_API
+#define MbufControlFeatureExecute  MbufControlFeatureExecuteW
+#else
+#define MbufControlFeatureExecute  MbufControlFeatureExecuteA
+#endif
+
+inline void MFTYPE MbufControlFeatureUnsafeW  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr)
+   {
+   MbufControlFeatureW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR   *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,        std::nullptr_t            )
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeTypeW(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr)
+   {
+   MbufControlFeatureExecuteW(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+inline void MFTYPE MbufControlFeatureUnsafeA (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void                    *UserVarPtr)
+   {
+   MbufControlFeatureA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR          *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64              *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE             *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32              *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8              *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool                   *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeatureA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int                     UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t                          )
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeTypeA(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64             *UserVarPtr)
+   {
+   MbufControlFeatureExecuteA(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MbufControlFeatureUnsafe MbufControlFeatureUnsafeW
+#else
+#define MbufControlFeatureUnsafe MbufControlFeatureUnsafeA
+#endif
+
+#else
+inline void MFTYPE MbufControlFeatureExecute (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeature(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufControlFeatureExecute (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int  UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeature(BufId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MbufControlFeatureUnsafe  (MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr)
+   {
+   MbufControlFeature(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeature(BufId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t               )
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MdigGetHookInfo
+
+inline MIL_INT64 MdigGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   if((M_IN_DIG_GET_HOOK_INFO_DOUBLE_RANGE(InfoType)))
+      {
+      return M_TYPE_DOUBLE;
+      }
+   else if((M_IN_DIG_GET_HOOK_INFO_STRING_RANGE(InfoType)))
+      {
+      return M_TYPE_STRING_PTR;
+      }
+   else if((M_IN_DIG_GET_HOOK_INFO_INT64_RANGE(InfoType)))
+      {
+      return M_TYPE_MIL_INT64;
+      }
+   else if (((InfoType & ~M_MODIFIED_BUFFER) == M_BUFFER_ID) || ((InfoType & ~M_MODIFIED_BUFFER) == 0))
+      {
+      return M_TYPE_MIL_ID;
+      }
+   else if ((M_IN_DIG_GET_HOOK_INFO_PTR_RANGE(InfoType)))
+      {
+      return M_TYPE_MIL_INT64;
+      }
+   else
+      {
+      return M_TYPE_MIL_INT;   
+      }
+   }
+
+inline MIL_INT MFTYPE MdigGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MdigGetHookInfoRequiredType(InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigGetHookInfo"));
+
+   return MdigGetHookInfo(EventId, InfoType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MdigGetHookInfo"));
+
+   return MdigGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MdigGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MdigGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void           *ResultPtr) {return MdigGetHookInfo               (EventId, InfoType, ResultPtr)                  ;}
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT32      *ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT64      *ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_DOUBLE     *ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_DOUBLE   );}
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_TEXT_PTR    ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_STRING_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT       *ResultPtr) {return MdigGetHookInfoSafeTypeExecute(EventId, InfoType, ResultPtr, M_TYPE_MIL_INT  );}
+#endif
+
+// ----------------------------------------------------------
+// MdigInquireFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MdigInquireFeatureExecuteW (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeatureExecuteA (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeatureUnsafeW  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTW_PTR  UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t           )
+   {
+   MdigInquireFeatureW(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+inline void MFTYPE MdigInquireFeatureUnsafeA  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTA_PTR  UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t           )
+   {
+   MdigInquireFeatureA(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MdigInquireFeatureUnsafe MdigInquireFeatureUnsafeW
+#else
+#define MdigInquireFeatureUnsafe MdigInquireFeatureUnsafeA
+#endif
+
+#else
+
+inline void MFTYPE MdigInquireFeatureExecute (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureUnsafe  (MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MdigInquireFeature(DigId, InquireType, FeatureName, UserVarType, M_NULL);
+   } 
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MdigControlFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MdigControlFeatureExecuteW (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigControlFeatureExecuteW (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+   else if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureW(DigId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MdigControlFeatureExecuteA (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigControlFeatureExecuteA (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureA(DigId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MdigControlFeatureUnsafeW  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr)
+   {
+   MdigControlFeatureW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTW_PTR UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t                 )
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+inline void MFTYPE MdigControlFeatureUnsafeA (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void                    *UserVarPtr)
+   {
+   MdigControlFeatureA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTA_PTR   UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64              *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE             *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32              *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8              *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool                   *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int                     UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64             *UserVarPtr)
+   {
+   MdigControlFeatureExecuteA(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MdigControlFeatureUnsafe MdigControlFeatureUnsafeW
+#else
+#define MdigControlFeatureUnsafe MdigControlFeatureUnsafeA
+#endif
+
+#else
+inline void MFTYPE MdigControlFeatureExecute (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeature(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigControlFeatureExecute (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int  UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeature(DigId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MdigControlFeatureUnsafe  (MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr)
+   {
+   MdigControlFeature(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeature(DigId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t             )
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MdigInquire
+
+inline MIL_INT64 MdigInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if ( M_IN_DIG_INQUIRE_STRING_RANGE(InquireType) )
+      return M_TYPE_TEXT_CHAR;
+
+   if ( M_IN_DIG_INQUIRE_DOUBLE_RANGE(InquireType) )
+      return M_TYPE_DOUBLE;
+
+   if ( M_IN_DIG_INQUIRE_MIL_INT64_RANGE(InquireType) )
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MdigInquire"));
+
+   return MdigInquire(DigId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MdigInquire(DigId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MdigInquireExecute (MIL_ID DigId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MdigInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MdigInquire"));
+
+   return MdigInquire(DigId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MdigInquireUnsafe  (MIL_ID DigId, MIL_INT64 InquireType, void           *UserVarPtr) {return MdigInquire       (DigId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_TEXT_CHAR  *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_INT32      *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_INT64      *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_DOUBLE     *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_UINT32     *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_UINT64     *UserVarPtr) {return MdigInquireExecute(DigId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#ifdef __MILFPGA_H__
+// ----------------------------------------------------------
+// MfpgaGetHookInfo
+
+inline MIL_INT64 MfpgaGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   switch (InfoType)
+      {
+      case M_TIME_STAMP:
+         return M_TYPE_DOUBLE;
+         break;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, int UserVarPtr)
+   {
+   if (UserVarPtr != NULL)
+      SafeTypeError(MIL_TEXT("MfpgaGetHookInfo"));
+
+   return MfpgaGetHookInfo(EventId, InfoType, NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MfpgaGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeTypeExecute (MIL_ID  EventId, MIL_INT64 InfoType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MfpgaGetHookInfoRequiredType(InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MfpgaGetHookInfo"));
+
+   return MfpgaGetHookInfo(EventId, InfoType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MfpgaGetHookInfoUnsafe  (MIL_ID  EventId, MIL_INT64 InfoType, void         *UserVarPtr) {return MfpgaGetHookInfo               (EventId, InfoType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_INT32    *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_INT64    *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_DOUBLE   *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_UINT32   *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfpgaGetHookInfoSafeType(MIL_ID  EventId, MIL_INT64 InfoType, MIL_UINT64   *UserVarPtr) {return MfpgaGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MfpgaInquire
+
+inline MIL_INT64 MfpgaInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if(M_IN_FPGA_INQUIRE_STRING_RANGE(InquireType))
+      {
+      return M_TYPE_TEXT_CHAR;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr != NULL)
+      SafeTypeError(MIL_TEXT("MfpgaInquire"));
+
+   return MfpgaInquire(MilSystemId, FpgaDeviceNum, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MfpgaInquire(MilSystemId, FpgaDeviceNum, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MfpgaInquireSafeTypeExecute (MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MfpgaInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MfpgaInquire"));
+
+   return MfpgaInquire(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MfpgaInquireUnsafe  (MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, void            *UserVarPtr) {return MfpgaInquire               (MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfpgaInquireSafeType(MIL_ID  MilSystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr) {return MfpgaInquireSafeTypeExecute(MilSystemId, FpgaDeviceNum, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+#endif // #ifdef __MILFPGA_H__
+
+// ----------------------------------------------------------
+// MfuncInquire
+
+inline MIL_INT64 MfuncInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (InquireType == M_OBJECT_TYPE_EXTENDED)
+      return M_TYPE_MIL_INT64;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MfuncInquireSafeTypeExecute (MIL_ID ObjectId, MIL_INT64 InquireType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MfuncInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MfuncInquire"));
+
+   return MfuncInquire(ObjectId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MfuncInquire"));
+
+   return MfuncInquire(ObjectId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MfuncInquire(ObjectId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MfuncInquireUnsafe  (MIL_ID ObjectId, MIL_INT64 InquireType, void        *UserVarPtr) {return MfuncInquire               (ObjectId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_INT32   *UserVarPtr) {return MfuncInquireSafeTypeExecute(ObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_INT64   *UserVarPtr) {return MfuncInquireSafeTypeExecute(ObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_UINT32  *UserVarPtr) {return MfuncInquireSafeTypeExecute(ObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_UINT64  *UserVarPtr) {return MfuncInquireSafeTypeExecute(ObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MgraInquire
+
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID GraContextId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MgraInquire"));
+
+   return MgraInquire(GraContextId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID GraContextId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MgraInquire(GraContextId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MgraInquireSafeTypeExecute (MIL_ID ContextGraId, MIL_INT64 InquireType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MgraInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MgraInquire"));
+
+   return MgraInquire(ContextGraId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MgraInquireUnsafe  (MIL_ID ContextGraId, MIL_INT64 InquireType, void        *UserVarPtr) {return MgraInquire               (ContextGraId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT8    *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_CHAR     );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT16   *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_SHORT    );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT32   *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_INT64   *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, float       *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_FLOAT    );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT8   *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_CHAR     );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT16  *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_SHORT    );}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT32  *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MgraInquireSafeType(MIL_ID ContextGraId, MIL_INT64 InquireType, MIL_UINT64  *UserVarPtr) {return MgraInquireSafeTypeExecute(ContextGraId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MgraInquireList
+
+inline MIL_INT64 MgraInquireListRequiredType(MIL_INT64 InquireType)
+   {
+   return MgraInquireRequiredType(InquireType);
+   }
+
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, int                 UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MgraInquireList"));
+
+   return MgraInquireList(GraListId, Index, SubIndex, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MgraInquireList(GraListId, Index, SubIndex, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MgraInquireListSafeTypeExecute (MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, void        *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MgraInquireListRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MgraInquireList"));
+
+   return MgraInquireList(GraListId, Index, SubIndex, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MgraInquireListUnsafe  (MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, void         *UserVarPtr) {return MgraInquireList               (GraListId, Index, SubIndex, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT8     *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_CHAR     );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT16    *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_SHORT    );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT32    *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_INT64    *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, float        *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_FLOAT    );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_DOUBLE   *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_DOUBLE   );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT8    *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_CHAR     );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT16   *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_SHORT    );}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT32   *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MgraInquireListSafeType(MIL_ID GraListId, MIL_INT Index, MIL_INT SubIndex, MIL_INT64 InquireType, MIL_UINT64   *UserVarPtr) {return MgraInquireListSafeTypeExecute(GraListId, Index, SubIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MsysGetHookInfo
+
+inline MIL_INT64 MsysGetHookInfoRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_SYS_GET_HOOK_INFO_DOUBLE_RANGE(InquireType))
+      return M_TYPE_MIL_DOUBLE;
+
+   if (M_IN_SYS_GET_HOOK_INFO_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if (M_IN_SYS_GET_HOOK_INFO_STRING_RANGE(InquireType))
+      return M_TYPE_STRING_PTR;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, int ResultPtr)
+   {
+   if (ResultPtr)
+      SafeTypeError(MIL_TEXT("MsysGetHookInfo"));
+
+   return MsysGetHookInfo(SysId,EventId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MsysGetHookInfo(SysId, EventId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MsysGetHookInfoSafeTypeExecute (MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MsysGetHookInfoRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysGetHookInfo"));
+
+   return MsysGetHookInfo(SysId, EventId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MsysGetHookInfoUnsafe  (MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, void            *ResultPtr) {return MsysGetHookInfo               (SysId, EventId, InquireType, ResultPtr);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_INT32       *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_INT64       *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_DOUBLE      *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_DOUBLE);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_TEXT_PTR     ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_STRING_PTR);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_UINT32      *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_UINT64      *ResultPtr) {return MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MsysInquire
+
+
+inline MIL_INT64 MsysInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_SYS_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_SYS_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_SYS_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if (M_IN_SYS_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_MIL_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, int ResultPtr)
+   {
+   if (ResultPtr || M_SYS_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MsysInquire"));
+
+   return MsysInquire(SysId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_SYS_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MsysInquire"));
+
+   return MsysInquire(SysId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MsysInquireSafeTypeExecute (MIL_ID SysId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MsysInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysInquire"));
+
+   return MsysInquire(SysId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MsysInquireUnsafe  (MIL_ID SysId, MIL_INT64 InquireType, void            *ResultPtr) {return MsysInquire               (SysId, InquireType, ResultPtr);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_INT32       *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_INT64       *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_TEXT_CHAR   *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_DOUBLE      *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_DOUBLE);}
+
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_UINT32      *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_UINT64      *ResultPtr) {return MsysInquireSafeTypeExecute(SysId, InquireType, ResultPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MsysInquireFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MsysInquireFeatureExecuteW (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysInquireFeatureExecuteA (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysInquireFeatureUnsafeW  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTW_PTR  UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MsysInquireFeatureW(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteW(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+inline void MFTYPE MsysInquireFeatureUnsafeA  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXTA_PTR UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MsysInquireFeatureA(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MsysInquireFeatureExecuteA(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MsysInquireFeatureUnsafe MsysInquireFeatureUnsafeW
+#define MsysInquireFeatureExecute MsysInquireFeatureExecuteW
+#else
+#define MsysInquireFeatureUnsafe MsysInquireFeatureUnsafeA
+#define MsysInquireFeatureExecute MsysInquireFeatureExecuteA
+#endif
+
+#else
+
+inline void MFTYPE MsysInquireFeatureExecute (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = InquireFeatureRequiredType(InquireType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureUnsafe  (MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_TEXT_CHAR  *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t             )
+   {
+   MsysInquireFeature(SysId, InquireType, FeatureName, UserVarType, M_NULL);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MsysControlFeature
+
+#if M_MIL_USE_UNICODE
+inline void MFTYPE MsysControlFeatureExecuteW (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureExecuteW (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   else if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureW(SysId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MsysControlFeatureExecuteA (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureExecuteA (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, int UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureA(SysId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MsysControlFeatureUnsafeW  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const void            *UserVarPtr)
+   {
+   MsysControlFeatureW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTW_PTR UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType,       int              UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t                   )
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeTypeW(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTW_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr)
+   {
+   MsysControlFeatureExecuteW(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+inline void MFTYPE MsysControlFeatureUnsafeA (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const void                    *UserVarPtr)
+   {
+   MsysControlFeatureA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, MIL_CONST_TEXTA_PTR   UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64              *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE             *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32              *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8              *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const bool                   *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeatureA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType,       int                     UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, std::nullptr_t                           )
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeTypeA(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXTA_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64             *UserVarPtr)
+   {
+   MsysControlFeatureExecuteA(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#if M_MIL_UNICODE_API
+#define MsysControlFeatureUnsafe    MsysControlFeatureUnsafeW
+#define MsysControlFeatureExecute   MsysControlFeatureExecuteW
+#else
+#define MsysControlFeatureUnsafe    MsysControlFeatureUnsafeA
+#define MsysControlFeatureExecute   MsysControlFeatureExecuteA
+#endif
+
+#else
+inline void MFTYPE MsysControlFeatureExecute (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void  *UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeature(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureExecute (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, int  UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = ControlFeatureRequiredType(ControlType, UserVarType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   else if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeature(SysId, ControlType, FeatureName, UserVarType, M_NULL);
+   }
+
+inline void MFTYPE MsysControlFeatureUnsafe  (MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const void             *UserVarPtr)
+   {
+   MsysControlFeature(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_TEXT_CHAR    *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeature(SysId, ControlType, FeatureName, UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       int               UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType,       std::nullptr_t             )
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, M_NULL, UserVarType);
+   }
+#endif
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, MIL_CONST_TEXT_PTR FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName, UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+
+#endif //M_MIL_USE_UNICODE
+
+// ----------------------------------------------------------
+// MsysIoInquire
+
+
+inline MIL_INT64 MsysIoInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_SYS_IO_INQUIRE_MIL_ID_RANGE(InquireType))
+      return M_TYPE_MIL_ID;
+
+   if (M_IN_SYS_IO_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_SYS_IO_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if (M_IN_SYS_IO_INQUIRE_DOUBLE_RANGE(InquireType))
+      return M_TYPE_MIL_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr || M_SYS_IO_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MsysIoInquire"));
+
+   return MsysIoInquire(IoObjectId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_SYS_IO_INQUIRE_MUST_HAVE_USER_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MsysIoInquire"));
+
+   return MsysIoInquire(IoObjectId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MsysIoInquireSafeTypeExecute (MIL_ID IoObjectId, MIL_INT64 InquireType, void* UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MsysIoInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysIoInquire"));
+
+   return MsysIoInquire(IoObjectId, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MsysIoInquireUnsafe  (MIL_ID IoObjectId, MIL_INT64 InquireType, void            *UserVarPtr) {return MsysIoInquire               (IoObjectId, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr) {return MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+
+// ----------------------------------------------------------
+// MsysIoCommandRegister
+
+inline MIL_INT64 MsysIoCommandRegisterRequiredType(MIL_INT64 Operation)
+   {
+   UNREFERENCED_PARAMETER(Operation);
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, int CommandStatusPtr)
+   {
+   if (CommandStatusPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysIoCommandRegister"));
+
+   return MsysIoCommandRegister(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, std::nullptr_t)
+   {
+   return MsysIoCommandRegister(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MsysIoCommandRegisterExecute(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, void* CommandStatusPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MsysIoCommandRegisterRequiredType(Operation);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MsysIoCommandRegister"));
+
+   return MsysIoCommandRegister(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, CommandStatusPtr);
+   }
+
+inline MIL_INT MFTYPE MsysIoCommandRegisterUnsafe  (MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, void*    CommandStatusPtr)  {return MsysIoCommandRegister(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, CommandStatusPtr);}
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, MIL_INT* CommandStatusPtr)  {return MsysIoCommandRegisterExecute(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, CommandStatusPtr, M_TYPE_MIL_INT);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MsysIoCommandRegisterSafeType(MIL_ID IoObjectId, MIL_INT64 Operation, MIL_INT64 ReferenceStamp, MIL_DOUBLE DelayFromReferenceStamp, MIL_DOUBLE Duration, MIL_INT64 BitToOperate, MIL_UINT* CommandStatusPtr) {return MsysIoCommandRegisterExecute(IoObjectId, Operation, ReferenceStamp, DelayFromReferenceStamp, Duration, BitToOperate, CommandStatusPtr, M_TYPE_MIL_INT);}
+#endif
+
+//-------------------------------------------------------------------------------
+// MthrInquire
+
+inline MIL_INT64 MthrInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if(InquireType == M_NATIVE_ID)
+      return M_TYPE_MIL_ID;
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MthrInquire"));
+
+   return MthrInquire(ThreadEventOrMutexId, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MthrInquire(ThreadEventOrMutexId, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MthrInquireExecute (MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, void        *ValuePtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MthrInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MthrInquire"));
+
+   return MthrInquire(ThreadEventOrMutexId, InquireType, ValuePtr);
+   }
+
+inline MIL_INT MFTYPE MthrInquireUnsafe  (MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, void         *UserVarPtr) {return MthrInquire     (  ThreadEventOrMutexId, InquireType, UserVarPtr                  );}
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, MIL_INT      *UserVarPtr) {return MthrInquireExecute(ThreadEventOrMutexId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MthrInquireSafeType(MIL_ID ThreadEventOrMutexId, MIL_INT64 InquireType, MIL_UINT     *UserVarPtr) {return MthrInquireExecute(ThreadEventOrMutexId, InquireType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+
+// ----------------------------------------------------------
+// MseqGetHookInfo
+#if  !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+inline MIL_INT64 MseqGetHookInfoRequiredType(MIL_INT64 InfoType)
+   {
+   switch (InfoType)
+      {
+      case M_MODIFIED_BUFFER+M_BUFFER_ID:
+         return M_TYPE_MIL_ID;
+         break;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MseqGetHookInfoSafeTypeExecute (MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MseqGetHookInfoRequiredType(InfoType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MseqGetHookInfo"));
+
+   return MseqGetHookInfo(EventId, InfoType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      SafeTypeError(MIL_TEXT("MseqGetHookInfo"));
+
+   return MseqGetHookInfo(EventId, InfoType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, std::nullptr_t)
+   {
+   return MseqGetHookInfo(EventId, InfoType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MseqGetHookInfoUnsafe  (MIL_ID EventId, MIL_INT64 InfoType, void            *UserVarPtr) {return MseqGetHookInfo               (EventId, InfoType, UserVarPtr)                  ;}
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_INT         *UserVarPtr) {return MseqGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT  );}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MseqGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_UINT        *UserVarPtr) {return MseqGetHookInfoSafeTypeExecute(EventId, InfoType, UserVarPtr, M_TYPE_MIL_INT  );}
+#endif
+
+
+// ----------------------------------------------------------
+// MseqInquire
+
+
+inline MIL_INT64 MseqInquireRequiredType(MIL_INT64 InquireType)
+   {
+   if (M_IN_SEQ_INQUIRE_STRING_RANGE(InquireType))
+      return M_TYPE_TEXT_CHAR;
+
+   if (M_IN_SEQ_INQUIRE_MIL_INT64_RANGE(InquireType))
+      return M_TYPE_MIL_INT64;
+
+   if (M_IN_SEQ_INQUIRE_MIL_DOUBLE_RANGE(InquireType))
+      return M_TYPE_MIL_DOUBLE;
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if (UserVarPtr || M_IN_SEQ_INQUIRE_MUST_HAVE_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MseqInquire"));
+
+   return MseqInquire(ContextSeqId, SequenceIndex, InquireType, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   if(M_IN_SEQ_INQUIRE_MUST_HAVE_PTR(InquireType))
+      SafeTypeError(MIL_TEXT("MseqInquire"));
+   return MseqInquire(ContextSeqId, SequenceIndex, InquireType, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MseqInquireSafeTypeExecute(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, void* UserVarPtr, MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MseqInquireRequiredType(InquireType);
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      SafeTypeError(MIL_TEXT("MseqInquire"));
+
+   return MseqInquire(ContextSeqId, SequenceIndex, InquireType, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MseqInquireUnsafe  (MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, void            *UserVarPtr) {return MseqInquire               (ContextSeqId, SequenceIndex, InquireType, UserVarPtr);}
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_INT32       *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_INT64       *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_TEXT_CHAR   *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_TEXT_CHAR);}
+
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_DOUBLE      *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_DOUBLE);}
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_UINT32      *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT32);}
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_UINT64      *UserVarPtr) {return MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, UserVarPtr, M_TYPE_MIL_INT64);}
+#endif
+#endif // !M_MIL_USE_LINUX
+// ----------------------------------------------------------
+// MappInquireMp
+
+inline MIL_INT64 MappInquireMpRequiredType(MIL_INT64 InquireType)
+   {
+   if (InquireType == M_CORE_AFFINITY_MASK ||
+       InquireType == M_CORE_AFFINITY_MASK_PROCESS ||
+       InquireType == M_CORE_AFFINITY_MASK_HARDWARE ||
+       InquireType == M_MEMORY_BANK_CORE_AFFINITY_MASK ||
+       InquireType == M_MEMORY_BANK_AFFINITY_MASK ||
+       InquireType == M_CORE_MEMORY_BANK_AFFINITY_MASK)
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeTypeExecute(MIL_ID ContextAppId,
+                                                   MIL_INT64 InquireType,
+                                                   MIL_INT64 TypeFlag,
+                                                   MIL_INT64 TypeValue,
+                                                   void *UserVarPtr,
+                                                   MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappInquireMpRequiredType(InquireType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("MappInquireMp"));
+      }
+
+   return MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int UserVarPtr)
+   {
+   if (UserVarPtr)
+      {
+      SafeTypeError(MIL_TEXT("MappInquireMp"));
+      }
+
+   return MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t)
+   {
+   return MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MappInquireMpUnsafe(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void *UserVarPtr)
+   {
+   return MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr);
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT32 *UserVarPtr)
+   {
+   return MappInquireMpSafeTypeExecute(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64 *UserVarPtr)
+   {
+   return MappInquireMpSafeTypeExecute(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr, M_TYPE_MIL_INT64);
+   }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT32 *UserVarPtr)
+   {
+   return MappInquireMpSafeTypeExecute(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+
+inline MIL_INT MFTYPE MappInquireMpSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *UserVarPtr)
+   {
+   return MappInquireMpSafeTypeExecute(ContextAppId, InquireType, TypeFlag, TypeValue, UserVarPtr, M_TYPE_MIL_INT64);
+   }
+
+#endif
+
+// ----------------------------------------------------------
+// MthrInquireMp
+
+inline MIL_INT64 MthrInquireMpRequiredType(MIL_INT64 InquireType)
+   {
+   if (InquireType == M_CORE_AFFINITY_MASK)
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   return M_TYPE_MIL_INT;
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeTypeExecute(MIL_ID ThreadId,
+                                                   MIL_INT64 InquireType,
+                                                   MIL_INT64 TypeFlag,
+                                                   MIL_INT64 TypeValue,
+                                                   void *ResultPtr,
+                                                   MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MthrInquireMpRequiredType(InquireType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("MthrInquireMp"));
+      }
+
+   return MthrInquireMp(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr);
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int ResultPtr)
+   {
+   if (ResultPtr)
+      {
+      SafeTypeError(MIL_TEXT("MthrInquireMp"));
+      }
+
+   return MthrInquireMp(ThreadId, InquireType, TypeFlag, TypeValue, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t)
+   {
+   return MthrInquireMp(ThreadId, InquireType, TypeFlag, TypeValue, NULL);
+   }
+#endif
+
+inline MIL_INT MFTYPE MthrInquireMpUnsafe(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void *ResultPtr)
+   {
+   return MthrInquireMp(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr);
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT32 *ResultPtr)
+   {
+   return MthrInquireMpSafeTypeExecute(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr, M_TYPE_MIL_INT32);
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64 *ResultPtr)
+   {
+   return MthrInquireMpSafeTypeExecute(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr, M_TYPE_MIL_INT64);
+   }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT32 *ResultPtr)
+   {
+   return MthrInquireMpSafeTypeExecute(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr, M_TYPE_MIL_INT32);
+   }
+
+inline MIL_INT MFTYPE MthrInquireMpSafeType(MIL_ID ThreadId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ResultPtr)
+   {
+   return MthrInquireMpSafeTypeExecute(ThreadId, InquireType, TypeFlag, TypeValue, ResultPtr, M_TYPE_MIL_INT64);
+   }
+
+#endif
+
+// ----------------------------------------------------------
+// MappControlMp
+
+inline MIL_INT64 MappControlMpRequiredType(MIL_INT64 ControlType)
+   {
+   if (ControlType == M_CORE_AFFINITY_MASK)
+      {
+      return M_TYPE_MIL_INT64;
+      }
+   else if (ControlType == M_MP_THRESHOLD_RESTRICTION)
+      {
+      return M_TYPE_STRING;
+      }
+
+   return M_NULL;
+   }
+
+inline void MFTYPE MappControlMpSafeTypeExecute(MIL_ID ContextAppId,
+                                                MIL_INT64 ControlType,
+                                                MIL_INT64 TypeFlag,
+                                                MIL_INT64 TypeValue,
+                                                void *ValuePtr,
+                                                MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MappControlMpRequiredType(ControlType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("MappControlMp"));
+      }
+
+   MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr);
+   }
+
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int ValuePtr)
+   {
+   if (ValuePtr)
+      {
+      SafeTypeError(MIL_TEXT("MappControlMp"));
+      }
+
+   MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t)
+   {
+   MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, NULL);
+   }
+#endif
+
+inline void MFTYPE MappControlMpUnsafe(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void *ValuePtr)
+   {
+   MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr);
+   }
+
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64 *ValuePtr)
+   {
+   MappControlMpSafeTypeExecute(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_MIL_INT64);
+   }
+
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_TEXT_PTR ValuePtr)
+   {
+   MappControlMpSafeTypeExecute(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_STRING);
+   }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MappControlMpSafeType(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ValuePtr)
+   {
+   MappControlMpSafeTypeExecute(ContextAppId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_MIL_INT64);
+   }
+
+#endif
+
+// ----------------------------------------------------------
+// MthrControlMp
+
+inline MIL_INT64 MthrControlMpRequiredType(MIL_INT64 ControlType)
+   {
+   if (ControlType == M_CORE_AFFINITY_MASK)
+      {
+      return M_TYPE_MIL_INT64;
+      }
+
+   return M_NULL;
+   }
+
+inline void MFTYPE MthrControlMpSafeTypeExecute(MIL_ID ThreadId,
+                                                MIL_INT64 ControlType,
+                                                MIL_INT64 TypeFlag,
+                                                MIL_INT64 TypeValue,
+                                                void *ValuePtr,
+                                                MIL_INT64 GivenType)
+   {
+   MIL_INT64 RequiredType = MthrControlMpRequiredType(ControlType);
+
+   ReplaceTypeMilIdByTypeMilIntXX(&RequiredType);
+
+   if (RequiredType != GivenType)
+      {
+      SafeTypeError(MIL_TEXT("MthrControlMp"));
+      }
+
+   MthrControlMp(ThreadId, ControlType, TypeFlag, TypeValue, ValuePtr);
+   }
+
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, int ValuePtr)
+   {
+   if (ValuePtr)
+      {
+      SafeTypeError(MIL_TEXT("MthrControlMp"));
+      }
+
+   MthrControlMp(ThreadId, ControlType, TypeFlag, TypeValue, NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::nullptr_t)
+   {
+   MthrControlMp(ThreadId, ControlType, TypeFlag, TypeValue, NULL);
+   }
+#endif
+
+inline void MFTYPE MthrControlMpUnsafe(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, void *ValuePtr)
+   {
+   MthrControlMp(ThreadId, ControlType, TypeFlag, TypeValue, ValuePtr);
+   }
+
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_INT64 *ValuePtr)
+   {
+   MthrControlMpSafeTypeExecute(ThreadId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_MIL_INT64);
+   }
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MthrControlMpSafeType(MIL_ID ThreadId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, MIL_UINT64 *ValuePtr)
+   {
+   MthrControlMpSafeTypeExecute(ThreadId, ControlType, TypeFlag, TypeValue, ValuePtr, M_TYPE_MIL_INT64);
+   }
+
+#endif
+
+#define MappGetError         MappGetErrorSafeType
+#define MappGetHookInfo      MappGetHookInfoSafeType
+#define MappInquire          MappInquireSafeType
+#define MappInquireConnection MappInquireConnectionSafeType
+
+#if M_MIL_USE_UNICODE
+#define MbufDiskInquireW     MbufDiskInquireSafeTypeW
+#define MbufDiskInquireA     MbufDiskInquireSafeTypeA
+#define MbufInquireFeatureW   MbufInquireFeatureSafeTypeW
+#define MbufControlFeatureW   MbufControlFeatureSafeTypeW
+#if M_MIL_UNICODE_API
+#define MbufControlFeatureSafeType  MbufControlFeatureSafeTypeW
+#else
+#define MbufControlFeatureSafeType  MbufControlFeatureSafeTypeA
+#endif
+#define MbufInquireFeatureA   MbufInquireFeatureSafeTypeA
+#define MbufControlFeatureA   MbufControlFeatureSafeTypeA
+#else
+#define MbufDiskInquire      MbufDiskInquireSafeType
+#define MbufInquireFeature   MbufInquireFeatureSafeType
+#define MbufControlFeature   MbufControlFeatureSafeType
+#endif
+#define MbufGetHookInfo      MbufGetHookInfoSafeType
+#define MbufInquire          MbufInquireSafeType
+#define MbufInquireContainer MbufInquireContainerSafeType
+#define MdigGetHookInfo      MdigGetHookInfoSafeType
+#define MdigInquire          MdigInquireSafeType
+
+#if M_MIL_USE_UNICODE
+#define MdigInquireFeatureW   MdigInquireFeatureSafeTypeW
+#define MdigControlFeatureW   MdigControlFeatureSafeTypeW
+#define MdigInquireFeatureA   MdigInquireFeatureSafeTypeA
+#define MdigControlFeatureA   MdigControlFeatureSafeTypeA
+#else
+#define MdigInquireFeature   MdigInquireFeatureSafeType
+#define MdigControlFeature   MdigControlFeatureSafeType
+#endif
+
+//#define MfpgaGetHookInfo     MfpgaGetHookInfoSafeType
+//#define MfpgaInquire         MfpgaInquireSafeType
+
+// MfuncInquireSafeType is not activated because too many undocumented InquireTypes with various pointer types.
+//#define MfuncInquire         MfuncInquireSafeType
+
+#define MgraInquire          MgraInquireSafeType
+#define MgraInquireList      MgraInquireListSafeType
+
+#define MsysGetHookInfo      MsysGetHookInfoSafeType
+#define MsysInquire          MsysInquireSafeType
+#define MsysIoInquire        MsysIoInquireSafeType
+#define MsysIoCommandRegister MsysIoCommandRegisterSafeType
+
+#if M_MIL_USE_UNICODE
+#define MsysInquireFeatureW   MsysInquireFeatureSafeTypeW
+#define MsysControlFeatureW   MsysControlFeatureSafeTypeW
+#define MsysInquireFeatureA   MsysInquireFeatureSafeTypeA
+#define MsysControlFeatureA   MsysControlFeatureSafeTypeA
+
+#if M_MIL_UNICODE_API
+#define MsysInquireFeatureSafeType   MsysInquireFeatureSafeTypeW
+#define MsysControlFeatureSafeType   MsysControlFeatureSafeTypeW
+#else
+#define MsysInquireFeatureSafeType   MsysInquireFeatureSafeTypeA
+#define MsysControlFeatureSafeType   MsysControlFeatureSafeTypeA
+#endif
+
+
+#else
+#define MsysInquireFeature   MsysInquireFeatureSafeType
+#define MsysControlFeature   MsysControlFeatureSafeType
+#endif
+
+#define MthrInquire          MthrInquireSafeType
+
+#define MseqGetHookInfo      MseqGetHookInfoSafeType
+#define MseqInquire          MseqInquireSafeType
+#define MappInquireMp        MappInquireMpSafeType
+#define MthrInquireMp        MthrInquireMpSafeType
+#define MappControlMp        MappControlMpSafeType
+#define MthrControlMp        MthrControlMpSafeType
+
+#else // #if M_MIL_USE_SAFE_TYPE
+
+// Definitions of Unsafe functions are available even if M_MIL_USE_SAFE_TYPE
+// is deactivated in order to allow applications that have been transformed
+// to use it to compile properly.
+
+#define MappGetErrorUnsafe         MappGetError
+#define MappGetHookInfoUnsafe      MappGetHookInfo
+#define MappInquireUnsafe          MappInquire
+#define MappFileOperationUnsafe    MappFileOperation
+#define MappInquireConnectionUnsafe MappInquireConnection
+
+#define MbufCreate2dUnsafe         MbufCreate2d
+#define MbufCreateColorUnsafe      MbufCreateColor
+#if M_MIL_USE_UNICODE
+#define MbufDiskInquireUnsafeW     MbufDiskInquireW
+#define MbufDiskInquireUnsafeA     MbufDiskInquireA
+#define MbufInquireFeatureUnsafeW   MbufInquireFeatureW
+#define MbufControlFeatureUnsafeW   MbufControlFeatureW
+#define MbufInquireFeatureUnsafeA   MbufInquireFeatureA
+#define MbufControlFeatureUnsafeA   MbufControlFeatureA
+#if M_MIL_UNICODE_API
+#define MbufDiskInquireUnsafe      MbufDiskInquireW
+#define MbufInquireFeatureUnsafe   MbufInquireFeatureW
+#define MbufControlFeatureUnsafe   MbufControlFeatureW
+#else
+#define MbufDiskInquireUnsafe      MbufDiskInquireA
+#define MbufInquireFeatureUnsafe   MbufInquireFeatureA
+#define MbufControlFeatureUnsafe   MbufControlFeatureA
+#endif
+#else
+#define MbufDiskInquireUnsafe      MbufDiskInquire
+#define MbufInquireFeatureUnsafe   MbufInquireFeature
+#define MbufControlFeatureUnsafe   MbufControlFeature
+#endif
+#if M_MIL_USE_UNICODE
+#define MdigInquireFeatureUnsafeW   MdigInquireFeatureW
+#define MdigControlFeatureUnsafeW   MdigControlFeatureW
+#define MdigInquireFeatureUnsafeA   MdigInquireFeatureA
+#define MdigControlFeatureUnsafeA   MdigControlFeatureA
+#if M_MIL_UNICODE_API
+#define MdigInquireFeatureUnsafe   MdigInquireFeatureW
+#define MdigControlFeatureUnsafe   MdigControlFeatureW
+#else
+#define MdigInquireFeatureUnsafe   MdigInquireFeatureA
+#define MdigControlFeatureUnsafe   MdigControlFeatureA
+#endif
+#else
+#define MdigInquireFeatureUnsafe   MdigInquireFeature
+#define MdigControlFeatureUnsafe   MdigControlFeature
+#endif
+#define MbufGet1dUnsafe            MbufGet1d
+#define MbufGet2dUnsafe            MbufGet2d
+#define MbufGetUnsafe              MbufGet
+#define MbufGetArcUnsafe           MbufGetArc
+#define MbufGetColor2dUnsafe       MbufGetColor2d
+#define MbufGetColorUnsafe         MbufGetColor
+#define MbufGetHookInfoUnsafe      MbufGetHookInfo
+#define MbufGetLineUnsafe          MbufGetLine
+#define MbufInquireUnsafe          MbufInquire
+#define MbufInquireContainerUnsafe MbufInquireContainer
+#define MbufPut1dUnsafe            MbufPut1d
+#define MbufPut2dUnsafe            MbufPut2d
+#define MbufPutUnsafe              MbufPut
+#define MbufPutColor2dUnsafe       MbufPutColor2d
+#define MbufPutColorUnsafe         MbufPutColor
+#define MbufPutLineUnsafe          MbufPutLine
+
+#define MdigGetHookInfoUnsafe      MdigGetHookInfo
+#define MdigInquireUnsafe          MdigInquire
+
+#define MfpgaGetHookInfoUnsafe     MfpgaGetHookInfo
+#define MfpgaInquireUnsafe         MfpgaInquire
+
+#define MfuncInquireUnsafe         MfuncInquire
+
+#define MgraInquireUnsafe          MgraInquire
+#define MgraInquireListUnsafe      MgraInquireList
+
+#define MsysGetHookInfoUnsafe      MsysGetHookInfo
+#define MsysInquireUnsafe          MsysInquire
+#define MsysIoInquireUnsafe        MsysIoInquire
+#define MsysIoCommandRegisterUnsafe MsysIoCommandRegister
+
+#define MthrInquireUnsafe          MthrInquire
+
+#define MseqGetHookInfoUnsafe      MseqGetHookInfo
+#define MseqInquireUnsafe          MseqInquire
+#define MappInquireMpUnsafe        MappInquireMp
+#define MthrInquireMpUnsafe        MthrInquireMp
+#define MappControlMpUnsafe        MappControlMp
+#define MthrControlMpUnsafe        MthrControlMp
+
+#if M_MIL_USE_UNICODE
+#define MsysInquireFeatureUnsafeW   MsysInquireFeatureW
+#define MsysControlFeatureUnsafeW   MsysControlFeatureW
+#define MsysInquireFeatureUnsafeA   MsysInquireFeatureA
+#define MsysControlFeatureUnsafeA   MsysControlFeatureA
+#if M_MIL_UNICODE_API
+#define MsysInquireFeatureUnsafe   MsysInquireFeatureW
+#define MsysControlFeatureUnsafe   MsysControlFeatureW
+#else
+#define MsysInquireFeatureUnsafe   MsysInquireFeatureA
+#define MsysControlFeatureUnsafe   MsysControlFeatureA
+#endif
+#else
+#define MsysInquireFeatureUnsafe   MsysInquireFeature
+#define MsysControlFeatureUnsafe   MsysControlFeature
+#endif
+
+#endif // #if M_MIL_USE_SAFE_TYPE #else
+
+// For backward compatibility to the deprecated function name
+#define MbufControlRegion MbufControlArea
+#endif
+
+#ifdef __cplusplus
+
+inline MIL_ID MsysAlloc(MIL_ID             ContextAppId,
+   MIL_CONST_TEXT_PTR SystemDescriptor,
+   MIL_CONST_TEXT_PTR SystemNum,
+   MIL_INT64          InitFlag,
+   MIL_ID*            SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor, (MIL_INT)SystemNum, InitFlag, SysIdPtr);
+   }
+
+#if M_MIL_USE_64BIT
+inline MIL_ID MsysAlloc(MIL_ID             ContextAppId,
+   MIL_CONST_TEXT_PTR SystemDescriptor,
+   MIL_INT32          SystemNum,
+   MIL_INT64          InitFlag,
+   MIL_ID*            SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor, (MIL_INT)SystemNum, InitFlag, SysIdPtr);
+   }
+#endif
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION    
+inline MIL_ID MsysAlloc(MIL_ID             ContextAppId,
+                        MIL_CONST_TEXT_PTR SystemDescriptor,
+                        MIL_UINT           SystemNum,
+                        MIL_INT64          InitFlag,
+                        MIL_ID*            SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor, (MIL_INT)SystemNum, InitFlag, SysIdPtr);
+   }
+#endif
+
+#if !(M_MIL_USE_LINUX && M_MIL_USE_64BIT)
+inline MIL_ID MsysAlloc(MIL_ID             ContextAppId,
+   MIL_CONST_TEXT_PTR SystemDescriptor,
+   int                SystemNum,
+   MIL_INT64          InitFlag,
+   MIL_ID*            SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor, (MIL_INT)SystemNum, InitFlag, SysIdPtr);
+   }
+#endif
+
+inline MIL_ID MdigAlloc(MIL_ID SystemId,
+   MIL_CONST_TEXT_PTR DigNum,
+   MIL_CONST_TEXT_PTR DataFormat,
+   MIL_INT64 InitFlag,
+   MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, (MIL_INT)DigNum, DataFormat, InitFlag, DigIdPtr);
+   }
+
+inline MIL_ID MdigAlloc(MIL_ID SystemId,
+   int DigNum,
+   MIL_CONST_TEXT_PTR DataFormat,
+   MIL_INT64 InitFlag,
+   MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, (MIL_INT)DigNum, DataFormat, InitFlag, DigIdPtr);
+   }
+
+
+#if M_MIL_USE_64BIT && !M_MIL_USE_LINUX
+inline MIL_ID MdigAlloc(MIL_ID SystemId,
+   MIL_INT32 DigNum,
+   MIL_CONST_TEXT_PTR DataFormat,
+   MIL_INT64 InitFlag,
+   MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, (MIL_INT)DigNum, DataFormat, InitFlag, DigIdPtr);
+   }
+#endif
+
+// Include Milstring to include MIL_STRING overload to MIL functions
+#include <milstring.h>
+
+// Struct used as first parameter in C++ overloads of Stream functions.
+struct MilStreamParam
+   {
+   MIL_TEXT_PTR m_Param;
+
+   inline MilStreamParam(int): m_Param(M_NULL) {}
+   inline MilStreamParam(long) : m_Param(M_NULL) {}
+#if M_MIL_USE_NULLPTR
+   inline MilStreamParam(std::nullptr_t) : m_Param(M_NULL) {}
+#endif
+#if M_MIL_USE_STRING
+   inline MilStreamParam(const MIL_STRING&  FileName) : m_Param((MIL_TEXT_PTR)FileName.c_str()) {}
+#endif
+   inline MilStreamParam(MIL_TEXT_PTR       FileName): m_Param(FileName) {}
+   inline MilStreamParam(MIL_CONST_TEXT_PTR FileName) : m_Param((MIL_TEXT_PTR)FileName) {}
+   inline MilStreamParam(const MIL_UINT8*   InMemPtr) : m_Param((MIL_TEXT_PTR)InMemPtr) {}
+   inline MilStreamParam(MIL_UINT8*         OutMemPtr) : m_Param((MIL_TEXT_PTR)OutMemPtr) {}
+   };
+
+
+
+inline void MFTYPE MbufStreamCpp(MilStreamParam MemPtrOrFileName,
+                                 MIL_ID         SysId,
+                                 MIL_INT64      Operation,
+                                 MIL_INT64      StreamType,
+                                 MIL_DOUBLE     Version,
+                                 MIL_INT64      ControlFlag,
+                                 MIL_ID*        ContextModIdPtr,
+                                 MIL_INT*       SizeByteVarPtr)
+   {
+   MbufStream(MemPtrOrFileName.m_Param, SysId, Operation, StreamType, Version, ControlFlag, ContextModIdPtr, SizeByteVarPtr);
+   }
+
+#undef  MbufStream
+#define MbufStream MbufStreamCpp
+
+#endif
+
+
+
+// Include Milstring to include std::vector overloads to MIL functions
+#include <milvector.h>
diff --git a/Lib/Matrox/Include/Milsetup.h b/Lib/Matrox/Include/Milsetup.h
new file mode 100644
index 0000000..09ee135
--- /dev/null
+++ b/Lib/Matrox/Include/Milsetup.h
@@ -0,0 +1,303 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  MILSETUP.H
+* Revision     :  10.40.0640
+* Content      :  This file contains definitions for specifying the target
+*                 compile environment and the default state to set for
+*                 MIL (Matrox Imaging Library). It also defines the
+*                 MappAllocDefault() and MappFreeDefault() macros.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+#ifndef __MILSETUP_H__
+#define __MILSETUP_H__
+
+/************************************************************************/
+/* MIL COMPILE VERSION                                                  */
+/* These defines are for Matrox internal purpose only and are NOT meant */
+/* to be edited by the client.                                          */
+/************************************************************************/
+#if !defined(MIL_COMPILE_VERSION_HEX) || (MIL_COMPILE_VERSION_HEX== 0)
+   #ifdef MIL_COMPILE_VERSION_HEX
+      #undef MIL_COMPILE_VERSION_HEX
+   #endif
+   #define MIL_COMPILE_VERSION_HEX 0x1040
+#endif
+
+// Let's put the hex value in decimal.
+#define MIL_COMPILE_VERSION ((((MIL_COMPILE_VERSION_HEX >> 12) & 0xf) * 1000) + (((MIL_COMPILE_VERSION_HEX >> 8) & 0xf) * 100) + (((MIL_COMPILE_VERSION_HEX >> 4) & 0xf) * 10) + (((MIL_COMPILE_VERSION_HEX) & 0xf) ))
+#define MIL_COMPILE_TRUNK_VERSION         1060
+#define MIL_COMPILE_NEXT_MAJOR_VERSION    1100
+
+/************************************************************************/
+/* COMPILATION FLAG                                                     */
+/* One and only one flag must be active                                 */
+/************************************************************************/
+#ifndef M_MIL_USE_OS
+   #define M_MIL_USE_OS               1
+
+#ifndef M_MIL_USE_RT
+
+#if defined(UNDER_RTSS)
+#define M_MIL_USE_RT    1
+#else
+#define M_MIL_USE_RT    0
+#endif
+
+#endif
+
+   #if defined(__linux__)
+      #if defined(__arm__) || defined(__aarch64__)
+         #define M_MIL_USE_ARM        1
+      #else
+         #define M_MIL_USE_ARM        0
+      #endif
+      #define M_MIL_USE_WINDOWS       0
+      #define M_MIL_USE_LINUX         1
+      #define M_MIL_USE_NEW_STDHEADERS 1
+      #if defined(__x86_64__) || defined(__aarch64__)
+         #define M_MIL_USE_64BIT      1
+      #else
+         #define M_MIL_USE_64BIT      0
+      #endif
+
+      #ifndef M_LINUX_KERNEL
+         #define M_LINUX_KERNEL       0
+      #endif
+
+      #ifdef __INTEL_COMPILER
+         #define M_MIL_USE_LINTEL     1
+      #endif
+   #else
+      #define M_MIL_USE_WINDOWS       1
+      #define M_MIL_USE_LINUX         0
+      #define M_MIL_USE_ARM           0
+      #if defined(_WIN64) || defined(WIN64)
+         #define M_MIL_USE_64BIT      1
+      #else
+         #define M_MIL_USE_64BIT      0
+      #endif
+
+      #if (_MSC_VER >= 1400) && !defined(M_MIL_USING_SAFE_CRT)
+         #define M_MIL_USING_SAFE_CRT       1
+      #endif
+   #endif
+
+   #if defined(__POWERPC__)
+#error "PowerPC not supported"
+   #endif
+#endif
+
+#if !(M_MIL_USE_WINDOWS || M_MIL_USE_LINUX)
+#error "You must set at least one compilation flag."
+#endif
+
+#if ( (M_MIL_USE_WINDOWS && M_MIL_USE_LINUX) )
+#error "You must select one and only one compilation flag."
+#endif
+
+
+#if M_MIL_USE_RT
+#define MIL_DLLFUNC //__declspec(dllimport)
+#else
+#define MIL_DLLFUNC
+#endif
+/************************************************************************/
+/*This flag indicates if MIL has been compiled without UNICODE support  */
+/*If MIL supports UNICODE, user can define UNICODE to use UNICODE API   */
+/************************************************************************/
+#if !defined(M_MIL_USE_UNICODE) && !M_MIL_USE_LINUX
+   #define M_MIL_USE_UNICODE 1
+#elif !defined (M_MIL_USE_UNICODE)
+   #define M_MIL_USE_UNICODE 0
+#endif
+
+
+#if defined(UNICODE)
+   #define M_MIL_UNICODE_API 1
+#else
+   #if M_MIL_USE_RT
+      #error "The project must be compiled with Unicode character set"
+   #endif
+   #define M_MIL_UNICODE_API 0
+#endif
+
+#if M_MIL_USE_LINUX || M_MIL_UNICODE_API
+#define M_MIL_USE_TTF_UNICODE 1
+#endif
+
+/************************************************************************/
+/*This flag enable or disable deprecated defines.                       */
+/************************************************************************/
+#if !defined(M_MIL_WARN_ON_DEPRECATED)
+#if (defined(_MSC_VER) && (_MSC_VER >= 1400)) || defined(__INTEL_COMPILER)
+#define M_MIL_WARN_ON_DEPRECATED 1
+#else
+#define M_MIL_WARN_ON_DEPRECATED 0
+#endif
+#endif
+
+#if M_MIL_WARN_ON_DEPRECATED
+   // Define true (1) or false (2) depends on MIL_COMPILE_VERSION and START_VERSION.
+   #if MIL_COMPILE_VERSION >= 1000
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1000 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1000 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1010
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1010 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1010 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1020
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1020 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1020 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1030
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1030 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1030 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1040
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1040 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1040 0
+   #endif
+   #if MIL_COMPILE_VERSION >= 1050
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1050 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1050 0
+   #endif
+
+   #if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1060 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1060 0
+   #endif
+   #if MIL_COMPILE_VERSION >= MIL_COMPILE_NEXT_MAJOR_VERSION
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1100 1
+   #else
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_1100 0
+   #endif
+
+   #define PRIMITIVE_CAT(X, ...)                     X ## __VA_ARGS__
+   #define MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO(X) PRIMITIVE_CAT(MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO_, X)
+   #define IIF(X)                                    PRIMITIVE_CAT(IIF_, X)
+   #define IIF_0(X, ...)                             __VA_ARGS__
+   #define IIF_1(X, ...)                             X
+
+   #define MIL_DEPRECATED(IDENTIFIER, START_VERSION) IIF(MIL_COMPILE_VERSION_HIGHER_OR_EQUAL_TO(START_VERSION)) (__pragma(deprecated(#IDENTIFIER)), /*nothing*/)
+#else
+   #define MIL_DEPRECATED(IDENTIFIER, START_VERSION)
+#endif
+
+
+#ifndef M_MIL_WARN_ON_DEPRECATED_MOS
+   #define M_MIL_WARN_ON_DEPRECATED_MOS 1
+#endif
+
+
+#ifndef M_MILIM_FUNCTION_DEPRECATION_WARNING
+   #if defined(OldDefinesSupport) && OldDefinesSupport
+      #define M_MILIM_FUNCTION_DEPRECATION_WARNING 1
+   #else
+      #define M_MILIM_FUNCTION_DEPRECATION_WARNING 0
+   #endif
+#endif
+
+/************************************************************************/
+/* DEFAULT STATE INITIALIZATION FLAG                                    */
+/************************************************************************/
+
+//Defines for INSTALLDIR support
+#define M_INSTALL_DIR    MIL_TEXT("///INSTALLDIR///")
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define INSTALL_DIR    M_INSTALL_DIR
+#endif
+#define M_TEMP_DIR     MIL_TEXT("///MILTEMPDIRDIR///")
+#define M_USER_DLL_DIR MIL_TEXT("///MILUSERDLLDIR///")
+
+#if   M_MIL_USE_LINUX
+   #define M_IMAGE_PATH               M_INSTALL_DIR MIL_TEXT("images/")
+   #define M_CONTEXT_PATH             M_INSTALL_DIR MIL_TEXT("contexts/")
+#else
+   #define M_IMAGE_PATH               M_INSTALL_DIR MIL_TEXT("images\\")
+   #define M_CONTEXT_PATH             M_INSTALL_DIR MIL_TEXT("contexts\\")
+#endif
+
+/************************************************************************/
+/* DEFAULT SYSTEM SPECIFICATIONS                                        */
+/************************************************************************/
+
+/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
+#if OldDefinesSupport
+   #define M_DEF_SYSTEM_NUM           M_DEFAULT
+   MIL_DEPRECATED(M_DEF_SYSTEM_NUM, 1000)
+   #define M_SYSTEM_SETUP             M_DEF_SYSTEM_TYPE
+   MIL_DEPRECATED(M_SYSTEM_SETUP, 1000)
+   #define M_DEF_SYSTEM_TYPE          M_SYSTEM_DEFAULT
+   MIL_DEPRECATED(M_DEF_SYSTEM_TYPE, 1000)
+#endif
+
+/************************************************************************/
+/* DEFAULT DIGITIZER SPECIFICATIONS                                     */
+/************************************************************************/
+
+/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
+#if OldDefinesSupport
+   #define M_DEF_DIGITIZER_INIT       M_DEFAULT
+   MIL_DEPRECATED(M_DEF_DIGITIZER_INIT, 1000)
+   #define M_DEF_DIGITIZER_NUM        M_DEFAULT
+   MIL_DEPRECATED(M_DEF_DIGITIZER_NUM, 1000)
+   #define M_CAMERA_SETUP             M_DEF_DIGITIZER_FORMAT
+   MIL_DEPRECATED(M_CAMERA_SETUP, 1000)
+   #define M_DEF_DIGITIZER_FORMAT     MIL_TEXT("M_DEFAULT")
+   MIL_DEPRECATED(M_DEF_DIGITIZER_FORMAT, 1000)
+#endif
+
+/************************************************************************/
+/* DEFAULT DISPLAY SPECIFICATIONS                                       */
+/************************************************************************/
+
+/*DO NOT EDIT: you should change the default values with the Mil Configuration utility*/
+#if OldDefinesSupport
+   #define M_DEF_DISPLAY_FORMAT               MIL_TEXT("M_DEFAULT")
+   #define M_DISPLAY_SETUP                    M_DEF_DISPLAY_FORMAT
+   MIL_DEPRECATED(M_DISPLAY_SETUP, 1000)
+   MIL_DEPRECATED(M_DEF_DISPLAY_FORMAT, 1000)
+   #define M_DEF_DISPLAY_INIT                 M_DEFAULT
+   MIL_DEPRECATED(M_DEF_DISPLAY_INIT, 1000)
+   #define M_DEF_DISPLAY_NUM                  M_DEFAULT
+   MIL_DEPRECATED(M_DEF_DISPLAY_NUM, 1000)
+#endif
+
+/************************************************************************/
+/* DEFAULT IMAGE BUFFER SPECIFICATIONS                                  */
+/************************************************************************/
+#if OldDefinesSupport
+   #define M_DEF_IMAGE_NUMBANDS_MIN   1
+   MIL_DEPRECATED(M_DEF_IMAGE_NUMBANDS_MIN, 1000)
+   #define M_DEF_IMAGE_SIZE_X_MIN     50
+   MIL_DEPRECATED(M_DEF_IMAGE_SIZE_X_MIN, 1000)
+   #define M_DEF_IMAGE_SIZE_Y_MIN     50
+   MIL_DEPRECATED(M_DEF_IMAGE_SIZE_Y_MIN, 1000)
+   #define M_DEF_IMAGE_SIZE_X_MAX     4000000
+   MIL_DEPRECATED(M_DEF_IMAGE_SIZE_X_MAX, 1000)
+   #define M_DEF_IMAGE_SIZE_Y_MAX     4000000
+   MIL_DEPRECATED(M_DEF_IMAGE_SIZE_Y_MAX, 1000)
+   #define M_DEF_IMAGE_TYPE           (8+M_UNSIGNED)
+   MIL_DEPRECATED(M_DEF_IMAGE_TYPE, 1000)
+   #define M_DEF_IMAGE_ATTRIBUTE_MIN  (M_IMAGE+M_PROC)
+   MIL_DEPRECATED(M_DEF_IMAGE_ATTRIBUTE_MIN, 1000)
+#endif
+
+/************************************************************************/
+/* Enables DMIL monitoring auto-publish mode. 0 == Disabled             */
+/************************************************************************/
+#define M_DEF_AUTO_PUBLISH  0
+
+
+#endif /*__MILSETUP_H__*/
diff --git a/Lib/Matrox/Include/mbasictypes.h b/Lib/Matrox/Include/mbasictypes.h
new file mode 100644
index 0000000..e19d6c9
--- /dev/null
+++ b/Lib/Matrox/Include/mbasictypes.h
@@ -0,0 +1,35 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  mbasictypes.h
+* Revision     :  10.30.0643
+* Content      :  This file contains the definitions of basic types 
+*                 for Matrox Imaging.
+*
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2018.
+* All Rights Reserved
+*************************************************************************/
+#ifndef __MATROX_IMAGING_BASIC_TYPES__
+#define __MATROX_IMAGING_BASIC_TYPES__     1
+
+
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+   typedef       unsigned __int64   M_UINT64;
+#else
+   typedef       unsigned long long M_UINT64;
+#endif
+   typedef       unsigned int       M_UINT32;
+   typedef       unsigned short     M_UINT16;
+   typedef       unsigned char      M_UINT8;
+
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+   typedef       __int64            M_INT64;
+#else
+   typedef       long long          M_INT64;
+#endif
+   typedef       int                M_INT32;
+   typedef       short              M_INT16;
+   typedef       char               M_INT8;
+
+#endif 
diff --git a/Lib/Matrox/Include/milfpga.h b/Lib/Matrox/Include/milfpga.h
new file mode 100644
index 0000000..0900f8a
--- /dev/null
+++ b/Lib/Matrox/Include/milfpga.h
@@ -0,0 +1,518 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  milfpga.h
+* Revision     :  10.41.2936
+* Content      :  This file contains the defines necessary to use the
+*                 Matrox Imaging Library FPGA DTK "C" user interface.
+*
+* Comments     :  Some defines may be here but not yet
+*                 implemented in the library.
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2021.
+* All Rights Reserved
+*************************************************************************/
+
+#ifndef __MILFPGA_H__
+#define __MILFPGA_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/************************************************************************/
+/* MIL FPGA context identifier type                                     */
+/************************************************************************/
+typedef void* MIL_FPGA_CONTEXT;
+typedef MIL_INT (MFTYPE* MIL_FPGA_HOOK_FUNCTION_PTR)(  MIL_INT HookType,
+                                                       MIL_ID  EventId,
+                                                       void*   UserDataPtr);
+
+typedef MIL_INT (MFTYPE* MFPGAINQUIRE)(                MIL_ID  SystemId,
+                                                       MIL_INT FpgaDeviceNum,
+                                                       MIL_INT64 InquireType,
+                                                       void*   ResultPtr);
+/************************************************************************/
+/* MIL FPGA API declaration                                             */
+/************************************************************************/
+MIL_INT MFTYPE MfpgaCommandAlloc(  MIL_ID MilSysId,
+                                               MIL_INT DeviceNumber,
+                                               MIL_INT FunctionId,
+                                               MIL_INT SubFunctionId,
+                                               MIL_INT64 FunctionNumber,
+                                               MIL_INT ExecutionMode,
+                                               MIL_INT64 ControlFlag,
+                                               MIL_FPGA_CONTEXT* FpgaCommandContextPtr);
+
+MIL_INT MFTYPE MfpgaCommandFree(   MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 ControlFlag);
+
+#if M_MIL_USE_UNICODE
+
+MIL_INT MFTYPE MfpgaLoadA(         MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_CONST_TEXTA_PTR FirmwareFile,
+                                               MIL_INT64 ControlFlag);
+
+MIL_INT MFTYPE MfpgaLoadW(         MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_CONST_TEXTW_PTR FirmwareFile,
+                                               MIL_INT64 ControlFlag);
+#if M_MIL_UNICODE_API
+#define MfpgaLoad MfpgaLoadW
+#else
+#define MfpgaLoad MfpgaLoadA
+#endif
+#else
+
+MIL_INT MFTYPE MfpgaLoad(          MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_CONST_TEXT_PTR FirmwareFile,
+                                               MIL_INT64 ControlFlag);
+#define MfpgaLoadW MfpgaLoad
+#endif
+
+void MFTYPE MfpgaSetSource(        MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_BUFFER_INFO SrcBuf,
+                                               MIL_INT StreamInputNumber,
+                                               MIL_INT64 ControlFlag);
+
+MIL_INT MFTYPE MfpgaSetDestination(MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_BUFFER_INFO DstBuf,
+                                               MIL_INT StreamOutputNumber,
+                                               MIL_INT64 ControlFlag);
+
+MIL_INT MFTYPE MfpgaSetLink(       MIL_FPGA_CONTEXT SrcFpgaCommandContext,
+                                               MIL_INT SrcStreamPort,
+                                               MIL_FPGA_CONTEXT DstFpgaCommandContext,
+                                               MIL_INT DstStreamPort,
+                                               MIL_INT64 ControlFlag);
+
+void MFTYPE MfpgaCommandQueue(     MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 CompletionMode,
+                                               MIL_INT64 QueueType);
+
+void MFTYPE MfpgaGetRegister(      MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 RegisterSection,
+                                               MIL_INT Offset,
+                                               MIL_INT Length,
+                                               void *ValuePtr,
+                                               MIL_INT64 ReadAccessFlag);
+
+void MFTYPE MfpgaSetRegister(      MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 RegisterSection,
+                                               MIL_INT Offset,
+                                               MIL_INT Length,
+                                               void *ValuePtr,
+                                               MIL_INT64 WriteAccessFlag);
+
+void MFTYPE MfpgaGetAndSetRegister(MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 SrcRegisterBank,
+                                               MIL_INT SrcOffset,
+                                               MIL_INT64 DstRegisterBank,
+                                               MIL_INT DstOffset,
+                                               MIL_INT64 BitMaskRegisterBank,
+                                               MIL_INT BitMaskOffset,
+                                               MIL_INT Length,
+                                               MIL_INT64 ControlFlag);
+
+void MFTYPE MfpgaCommandControl(   MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 ControlType,
+                                               const void *ControlValuePtr);
+
+void MFTYPE MfpgaCommandInquire(   MIL_FPGA_CONTEXT FpgaCommandContext,
+                                               MIL_INT64 InquireType,
+                                               void *UserVarPtr);
+
+MIL_INT MFTYPE MfpgaInquire(       MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_INT64 InquireType,
+                                               void* UserVarPtr);
+
+MIL_INT MFTYPE MfpgaControl(       MIL_ID MilSystemId,
+                                               MIL_INT FpgaDeviceNumber,
+                                               MIL_INT64 ControlType,
+                                               const void* ControlValuePtr);
+
+void MFTYPE MfpgaHookFunction(     MIL_ID MilSystemId,
+                                               MIL_INT DeviceNumber,
+                                               MIL_INT FunctionId,
+                                               MIL_INT SubFunctionId,
+                                               MIL_INT64 FunctionNumber,
+                                               MIL_INT HookType,
+                                               MIL_FPGA_HOOK_FUNCTION_PTR HookHandlerPtr,
+                                               void *UserDataPtr);
+
+MIL_INT MFTYPE MfpgaGetHookInfo(   MIL_ID EventId,
+                                               MIL_INT64 InfoType,
+                                               void *UserVarPtr);
+
+/************************************************************************/
+/* Transfer unit Function ID  and SubFunction ID definitions            */
+/************************************************************************/
+#define FPGA_HOST_2_AVALON_FID                        0xC001
+#define FPGA_DMA_READ_2_STREAM_FID                    0xC010
+#define FPGA_STREAM_2_DMA_WRITE_FID                   0xC011
+#define FPGA_HSSI_2_AVALON_FID                        0xC012
+
+#define FPGA_HLS_FID                                  0xD000
+#define FPGA_FID                                      0x1000
+#define IS_HLS_FID(x)                                ( (x >= FPGA_HLS_FID) && (x < (FPGA_HLS_FID + 0x1000)))
+
+
+/************************************************************************/
+/* For Processing unit Function ID definitions                          */
+/* see milfunctioncode.h                                                */
+/************************************************************************/
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaSetSource, MfpgaSetDestination and MfpgaSetLink                 */
+/* stream offset defines                                                */
+/*                                                                      */
+/************************************************************************/
+#define M_FPGA_STREAM_INPUT_BIT                 0x10000000
+#define M_FPGA_STREAM_OUTPUT_BIT                0x20000000
+#define M_FPGA_STREAM_IO_MASK                   (M_FPGA_STREAM_INPUT_BIT | M_FPGA_STREAM_OUTPUT_BIT)
+#define M_FPGA_STREAM_IO_FILTER              (~ (M_FPGA_STREAM_INPUT_BIT | M_FPGA_STREAM_OUTPUT_BIT))
+
+#define M_INPUT0                                (M_FPGA_STREAM_INPUT_BIT | 0x00000000)
+#define M_INPUT1                                (M_FPGA_STREAM_INPUT_BIT | 0x00000001)
+#define M_INPUT2                                (M_FPGA_STREAM_INPUT_BIT | 0x00000002)
+#define M_INPUT3                                (M_FPGA_STREAM_INPUT_BIT | 0x00000003)
+#define M_INPUT4                                (M_FPGA_STREAM_INPUT_BIT | 0x00000004)
+#define M_INPUT5                                (M_FPGA_STREAM_INPUT_BIT | 0x00000005)
+#define M_INPUT6                                (M_FPGA_STREAM_INPUT_BIT | 0x00000006)
+#define M_INPUT7                                (M_FPGA_STREAM_INPUT_BIT | 0x00000007)
+#define M_INPUT8                                (M_FPGA_STREAM_INPUT_BIT | 0x00000008)
+#define M_INPUT9                                (M_FPGA_STREAM_INPUT_BIT | 0x00000009)
+
+#define M_OUTPUT0                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000000)
+#define M_OUTPUT1                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000001)
+#define M_OUTPUT2                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000002)
+#define M_OUTPUT3                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000003)
+#define M_OUTPUT4                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000004)
+#define M_OUTPUT5                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000005)
+#define M_OUTPUT6                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000006)
+#define M_OUTPUT7                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000007)
+#define M_OUTPUT8                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000008)
+#define M_OUTPUT9                               (M_FPGA_STREAM_OUTPUT_BIT | 0x00000009)
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaSetSource, MfpgaSetDestination and MfpgaSetLink                 */
+/* flag defines                                                         */
+/*                                                                      */
+/************************************************************************/
+//#define M_DEFAULT                             0x10000000L
+#define M_FPGA_FLAG_TYPE                        0xf0000000L
+#define M_FPGA_FLAG_TU_FLAVOR_MASK              0x70000000L
+#define M_FPGA_MULTI_CONTEXT                    0x30000000L
+#define M_FPGA_MULTI_STREAM_PORT                0x40000000L
+#define M_FPGA_DONT_INTERSECT                   0x80000000L
+#define M_FPGA_TU_NUMBER                        0xA0000000L
+
+#define M_CONTEXT0                              (M_FPGA_MULTI_CONTEXT | 0)
+#define M_CONTEXT1                              (M_FPGA_MULTI_CONTEXT | 1)
+#define M_CONTEXT2                              (M_FPGA_MULTI_CONTEXT | 2)
+#define M_CONTEXT3                              (M_FPGA_MULTI_CONTEXT | 3)
+
+#define M_FPGA_FLIP_VERTICAL                    0x01000000L
+#define M_FPGA_FLIP_HORIZONTAL                  0x02000000L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaCommandQueue completion mode defines                            */
+/*                                                                      */
+/************************************************************************/
+//#define M_DEFAULT                             0x10000000L
+#define M_PROCESSING_COMPLETED                  0x00000001L
+#define M_DESTINATION_WRITTEN                   0x00000002L
+#define M_SOURCE_READ                           0x00000003L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaCommandQueue flags                                              */
+/*                                                                      */
+/************************************************************************/
+//#define M_DEFAULT                             0x10000000L
+//#define M_WAIT                                1L
+#define M_DISPATCH                              2L
+#define M_DISPATCH_IMMEDIATE                    3L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaGetRegister/MfpgaSetRegister Register bank defines              */
+/*                                                                      */
+/************************************************************************/
+#define M_USER                                  0x00000001L
+#define M_STREAMER_BASE                         0x00000002L
+#define M_PU_BASE                               0x00000003L
+#define M_FPGA_BASE                             0x00000004L
+#define M_ABSOLUTE_BASE                         0x00000005L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaGetRegister/MfpgaSetRegister Flag defines                       */
+/*                                                                      */
+/************************************************************************/
+#define M_WHEN_DISPATCHED                       1
+#define M_WHEN_COMPLETED                        2
+#define M_AFTER_DISPATCHED                      3
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaGetError                                                        */
+/*                                                                      */
+/************************************************************************/
+#define M_FPGA_ERROR_CODE     1
+#define M_FPGA_ERROR_MESSAGE  2
+#define M_FPGA_ERROR_SYSTEM   3
+#define M_FPGA_ERROR_DELETE   0x80000000L
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaInquire / MfpgaControl                                          */
+/*                                                                      */
+/************************************************************************/
+#define M_MAX_NB_OF_PUS                      512
+#define M_MAX_NB_OF_PORTS                    255
+#define M_NUMBER_OF_PU                       0x1000
+#define M_NUMBER_OF_TU                       0x1001
+#define M_PU_LIST                            0x1002
+#define M_TU_LIST                            0x1003
+#define M_FPGA_PACKAGE_NAME                  (0x1005|M_CLIENT_ENCODING)
+#define M_FPGA_PACKAGE_NAME_LENGTH           0x1004
+#define M_FPGA_CONFIGURATION_FILENAME       (0x1007|M_CLIENT_ENCODING)
+#define M_FPGA_CONFIGURATION_FILENAME_LENGTH 0x1006
+#define M_FPGA_CONFIG                        0x1008
+#define M_FPGA_BUILD_NUMBER                  0x1009
+#define M_PU_SELECT                          0x1010
+
+#define M_PU_NAME                            (0x1100|M_CLIENT_ENCODING)
+/* Reserve next 511 values           from    (0x1100) */
+/*                                   to      (0x12ff) */
+#define M_PU_NAME_LENGTH                     (M_PU_NAME + M_STRING_SIZE)
+#define M_TU_NAME                            (0x1300|M_CLIENT_ENCODING)
+/* Reserve next 511 values           from    (0x1300) */
+/*                                   to      (0x14ff) */
+#define M_TU_NAME_LENGTH                     (M_TU_NAME + M_STRING_SIZE)
+#define M_PU_FID                             0x1500
+/* Reserve next 511 values           from    (0x1500 */
+/*                                   to      (0x16ff */
+#define M_TU_FID                             0x1700
+/* Reserve next 511 values           from    (0x1700 */
+/*                                   to      (0x18ff */
+#define M_FPGA_CONFIGURATION                 (0x1900|M_CLIENT_ENCODING)
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaCommandInquire                                                  */
+/*                                                                      */
+/************************************************************************/
+#define M_MINOR_VERSION                      0x2000
+#define M_MAJOR_VERSION                      0x2001
+#define M_FUNCTION_ID                        0x2003
+#define M_INSTANCE_ID                        0x2004
+#define M_REG_USER_SIZE                      0x2005
+#define M_REG_FULL_SIZE                      0x2006
+#define M_REG_USER_OFFSET                    0x2007
+#define M_REG_IOCTL_OFFSET                   0x2008
+#define M_NUMBER_OF_EVENTS                   0x2009
+#define M_CAPABILITY                         0x200A
+#define M_SUB_FUNCTION_ID                    0x200B
+#define M_NUMBER_OF_INPUTS                   2835L  // used in milclass.h 0xB13
+#define M_NUMBER_OF_OUTPUTS                  2836L  // used in milclass.h 0xB14
+
+// M_PORT_NAME is ored with M_FPGA_STREAM_IO_MASK (0x30000000)
+#define M_PORT_NAME                          (0x2200|M_CLIENT_ENCODING)
+/* Reserve next 255 values           from    (0x2200 */
+/*                                   to      (0x22FF */
+#define M_PORT_NAME_LENGTH                   (M_PORT_NAME + M_STRING_SIZE)
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaCommandControl                                                  */
+/*                                                                      */
+/************************************************************************/
+#define M_FPGA_CMD_CTRL_TYPE_MASK            0x0FFFF000L
+#define M_COMPLETION_MODE                    0x00003000L
+#define M_STREAM_OUTPUT_FORMAT               0x00004000L
+
+#define M_FPGA_OVERSCAN                      0x00005000L
+#define M_LEFT                               0x00000100L
+#define M_RIGHT                              0x00000200L
+#define M_TOP                                0x00000400L
+#define M_BOTTOM                             0x00000800L
+#define M_FPGA_OVERSCAN_POSITION_MASK        (M_LEFT|M_RIGHT|M_TOP|M_BOTTOM)
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaHookFunction                                                     */
+/*                                                                      */
+/************************************************************************/
+#define M_END_OF_PROCESSING                  0x0001
+#define M_INTERRUPT_OVERRUN                  0x0080
+
+/************************************************************************/
+/*                                                                      */
+/* MfpgaGetHookInfo                                                     */
+/*                                                                      */
+/************************************************************************/
+//#define M_TIME_STAMP                       0x0040
+//#define M_FUNCTION_ID                      0x2003
+//#define M_INSTANCE_ID                      0x2004
+//#define M_SUB_FUNCTION_ID                  0x200B
+#define M_FPGA_DEVICE_NUMBER                 0x2100
+
+#define M_IN_FPGA_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X) (false)
+#define M_IN_FPGA_INQUIRE_STRING_RANGE(X)          (((X&~M_CLIENT_TEXT_ENCODING) == M_FPGA_PACKAGE_NAME) || \
+                                                   (((X&~M_CLIENT_TEXT_ENCODING) >= M_PU_NAME) && ((X&~M_CLIENT_TEXT_ENCODING) < (M_PU_NAME + M_MAX_NB_OF_PUS))) ||\
+                                                   (((X&~M_CLIENT_TEXT_ENCODING) >= M_TU_NAME) && ((X&~M_CLIENT_TEXT_ENCODING) < (M_TU_NAME + M_MAX_NB_OF_PUS))))
+
+#define M_IN_FPGA_INQUIRE_DOUBLE_RANGE(X)          (false)
+#define M_IN_FPGA_INQUIRE_MIL_INT64_RANGE(X)       (false)
+#define M_FPGA_INQUIRE_MUST_HAVE_USER_PTR(X)       (M_IN_FPGA_INQUIRE_STRING_RANGE(X)          || \
+                                                    M_IN_FPGA_INQUIRE_UNKNOWN_SIZE_OF_RANGE(X)  )
+
+#ifdef __cplusplus
+   }
+#endif
+
+#if M_MIL_USE_STRING
+
+#if defined(__cplusplus) && !defined(__MIL_AVX_H__) && (!defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL) && (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE)
+inline MIL_INT MFTYPE MfpgaInquire(MIL_ID SystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, MIL_STRING &ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MfpgaInquire(SystemId, FpgaDeviceNum, InquireType + M_STRING_SIZE, &InternalStringSize);
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+   return RetValue;
+   }
+
+inline void MFTYPE MfpgaCommandInquire(MIL_FPGA_CONTEXT FpgaCommandContext,
+                                       MIL_INT64 InquireType,
+                                       MIL_STRING &UserVarPtr)
+   {
+   MIL_INT InternalStringSize = 0;
+
+   MfpgaCommandInquire(FpgaCommandContext, InquireType + M_STRING_SIZE, &InternalStringSize);
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MfpgaCommandInquire(FpgaCommandContext, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+   return;
+   }
+
+#if M_MIL_USE_VECTOR
+
+inline MIL_INT MFTYPE MfpgaInquire(MIL_ID SystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, std::vector<MIL_STRING> &ResultArrayPtr)
+   {
+   MIL_INT RetValue = 0;
+
+   if(InquireType == M_PU_NAME)
+      {
+      MIL_INT numberOfPUs = 0;
+
+      MfpgaInquire(SystemId, FpgaDeviceNum, M_NUMBER_OF_PU, &numberOfPUs);
+      ResultArrayPtr.resize(numberOfPUs);
+
+      for(MIL_INT i = 0; i < numberOfPUs; i++)
+         {
+         MIL_INT InternalStringSize = 0;
+         MfpgaInquire(SystemId, FpgaDeviceNum, M_PU_NAME + i + M_STRING_SIZE, &InternalStringSize);
+
+         if(InternalStringSize > 0)
+            {
+            ResultArrayPtr[i].assign(InternalStringSize, MIL_TEXT('\0'));
+            RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, M_PU_NAME + i, &ResultArrayPtr[i][0]);
+            ResultArrayPtr[i].resize(InternalStringSize - 1);
+
+            }
+         }
+      }
+   else
+      {
+      if(InquireType == M_TU_NAME)
+         {
+         MIL_INT numberOfTUs = 0;
+
+         MfpgaInquire(SystemId, FpgaDeviceNum, M_NUMBER_OF_TU, &numberOfTUs);
+         ResultArrayPtr.resize(numberOfTUs);
+
+         for(MIL_INT i = 0; i < numberOfTUs; i++)
+            {
+            MIL_INT InternalStringSize = 0;
+            MfpgaInquire(SystemId, FpgaDeviceNum, M_TU_NAME + i + M_STRING_SIZE, &InternalStringSize);
+
+            if(InternalStringSize > 0)
+               {
+               ResultArrayPtr[i].assign(InternalStringSize, MIL_TEXT('\0'));
+               RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, M_TU_NAME + i, &ResultArrayPtr[i][0]);
+               ResultArrayPtr[i].resize(InternalStringSize - 1);
+
+               }
+            }
+         }
+      else
+         {
+#if M_MIL_USE_SAFE_TYPE
+         SafeTypeError(MIL_TEXT("MfpgaInquire"), MIL_TEXT("Inquire type compatible with std::vector<MIL_STRING> overload."));
+#endif
+         }
+      }
+
+   return RetValue;
+   }
+#endif
+
+#endif
+
+#if M_MIL_USE_VECTOR
+inline MIL_INT MFTYPE MfpgaInquire(MIL_ID SystemId, MIL_INT FpgaDeviceNum, MIL_INT64 InquireType, std::vector<MIL_INT> &ResultArrayPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT numberOfPUs = 0;
+
+   if(InquireType == M_PU_LIST)
+      {
+      MfpgaInquire(SystemId, FpgaDeviceNum, M_NUMBER_OF_PU, &numberOfPUs);
+      if(numberOfPUs)
+         {
+         ResultArrayPtr.resize(numberOfPUs);
+         RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, InquireType, &ResultArrayPtr[0]);
+         }
+      else
+         {
+         ResultArrayPtr.resize(0);
+         }
+      }
+   else
+      {
+      ResultArrayPtr.resize(1);
+      RetValue = MfpgaInquire(SystemId, FpgaDeviceNum, InquireType, &ResultArrayPtr[0]);
+      }
+
+   return RetValue;
+   }
+#endif
+
+
+#endif // __cplusplus
+
+
+
+#endif
+
diff --git a/Lib/Matrox/Include/milfuncll.h b/Lib/Matrox/Include/milfuncll.h
new file mode 100644
index 0000000..4adc178
--- /dev/null
+++ b/Lib/Matrox/Include/milfuncll.h
@@ -0,0 +1,74 @@
+锘�//MfuncBuf DTK functions
+
+/***************************************************************************/
+/*
+
+    Filename:  MILFUNC.H
+    Revision:  10.40.0640
+
+    Content :  This file contains the prototypes for the Matrox
+               Imaging Library (MIL) MfuncBuf DTK functions.
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+
+*/
+/***************************************************************************/
+
+#ifndef __MFUNCBUF_H
+#define __MFUNCBUF_H
+
+/* C++ directive if needed */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef __MILBUFFERINFO_H__
+#if !M_MIL_USE_CPP_FUNC_BUF
+typedef void* MIL_BUFFER_INFO;
+MIL_DOUBLE MFTYPE MfuncBufMaxValue(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_DOUBLE MFTYPE MfuncBufMinValue(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_ID MFTYPE MfuncBufDriverId(MIL_BUFFER_INFO BufferInfoPtr);
+void* MFTYPE MfuncBufHostAddress(MIL_BUFFER_INFO BufferInfoHandle);
+void* MFTYPE MfuncBufHostAddressBand(MIL_BUFFER_INFO BufferInfoHandle, MIL_INT Band);
+MIL_UINT64  MFTYPE MfuncBufPhysicalAddressBand(MIL_BUFFER_INFO BufferInfoHandle, MIL_INT Band);
+MIL_UINT64 MFTYPE MfuncBufPhysicalAddress(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufSizeX(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufSizeY(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufSizeBand(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufSizeBit(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufType(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufPitch(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufPitchByte(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT64 MFTYPE MfuncBufAttribute(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT64 MFTYPE MfuncBufFormat(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT64 MFTYPE MfuncBufFlags(MIL_BUFFER_INFO BufInfoPtr);
+MIL_INT MFTYPE MfuncBufLockable(MIL_BUFFER_INFO BufInfoPtr);
+MIL_INT MFTYPE MfuncBufParentOffsetX(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufParentOffsetY(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufParentOffsetBand(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufAncestorOffsetX(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufAncestorOffsetY(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufAncestorOffsetBand(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufAncestorOffsetBit(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufNativeId(MIL_BUFFER_INFO BufInfoPtr);
+MIL_ID MFTYPE MfuncBufId(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_ID MFTYPE MfuncBufHostId(MIL_BUFFER_INFO BufInfoPtr);
+MIL_ID MFTYPE MfuncBufParentId(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_ID MFTYPE MfuncBufAncestorId(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_ID MFTYPE MfuncBufOwnerSystemId(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_INT MFTYPE MfuncBufOwnerSystemType(MIL_BUFFER_INFO BufferInfoHandle);
+#endif 
+#else
+MIL_DLLFUNC MIL_DOUBLE MFTYPE MfuncBufMaxValue(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_DLLFUNC MIL_DOUBLE MFTYPE MfuncBufMinValue(MIL_BUFFER_INFO BufferInfoHandle);
+MIL_DLLFUNC MIL_ID MFTYPE MfuncBufDriverId(MIL_BUFFER_INFO BufferInfoPtr);
+#endif 
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/Lib/Matrox/Include/milstring.h b/Lib/Matrox/Include/milstring.h
new file mode 100644
index 0000000..4b976af
--- /dev/null
+++ b/Lib/Matrox/Include/milstring.h
@@ -0,0 +1,1852 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILSTRING.H
+    Owner   :  Matrox Imaging
+    Revision:  10.40.0640
+    Content :  This file contains the MIL_STRING overload for the Matrox
+    Imaging Library (MIL)
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+    */
+/***************************************************************************/
+#ifndef __MILPROTO_H
+#error milproto.h required
+#else
+
+#ifndef __MILSTRING_H__
+#define __MILSTRING_H__
+
+/************************************************************************/
+/* SUPPORT FOR MIL_STRING                                               */
+/************************************************************************/
+#ifndef M_MIL_USE_STRING
+#if defined(__cplusplus) && !defined(__MIL_AVX_H__) && (!defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL) && (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE)
+   #define M_MIL_USE_STRING 1
+#else
+   #define M_MIL_USE_STRING 0
+#endif
+#endif
+
+#if M_MIL_USE_STRING
+
+#if M_MIL_USE_LINUX
+#include <string.h>
+#endif
+#include <string>
+#include <sstream>
+
+#define M_STATIC_STRING_SIZE 64
+
+typedef std::basic_string<MIL_TEXT_CHAR, std::char_traits<MIL_TEXT_CHAR>, std::allocator<MIL_TEXT_CHAR> >
+MIL_STRING;
+
+typedef std::basic_stringstream<MIL_TEXT_CHAR, std::char_traits<MIL_TEXT_CHAR>, std::allocator<MIL_TEXT_CHAR> >
+MIL_STRING_STREAM;
+
+#if M_MIL_UNICODE_API                    
+#define M_TO_STRING(X) std::to_wstring(X)
+#else                                     
+#define M_TO_STRING(X) std::to_string(X)
+#endif
+
+#if (MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION)
+#define milstring       MIL_STRING
+#define milstringstream MIL_STRING_STREAM
+#endif
+
+#if M_MIL_UNICODE_API
+#if (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE)
+#define     MOs_UseDeprecatedStrLength   wcslen
+#endif
+#elif (M_MIL_USE_WINDOWS)
+#if !(defined(M_WINDOWS_NT_KERNEL_MODE) && M_WINDOWS_NT_KERNEL_MODE) 
+#define     MOs_UseDeprecatedStrLength   strlen
+#endif // !M_WINDOWS_NT_KERNEL_MODE 
+#elif M_MIL_USE_LINUX
+#define     MOs_UseDeprecatedStrLength   strlen
+#endif
+
+/***************************************************************************/
+/* FUNC MODULE                                                             */
+/***************************************************************************/
+inline void MFTYPE MfuncParamValue(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_STRING &ParamValuePtr)
+   {
+   //No need to inquire text since MfuncParamMilText will return the address of the string content
+   MfuncParamValue(ContextFuncId, ParamIndex, const_cast<MIL_TEXT_PTR>(ParamValuePtr.c_str()));
+   }
+
+inline void MFTYPE MfuncParamMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, MIL_STRING &ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute)
+   {
+   //No need to inquire text since MfuncParamMilText will return the address of the string content
+   MfuncParamMilText(ContextFuncId, ParamIndex, const_cast<MIL_TEXT_PTR>(ParamValuePtr.c_str()), NumOfItems, Attribute);
+   }
+
+inline void MFTYPE MfuncParamConstMilText(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_STRING &ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute)
+   {
+   MfuncParamConstMilText(ContextFuncId, ParamIndex, ParamValuePtr.c_str(), NumOfItems, Attribute);
+   }
+
+inline void MFTYPE MfuncParamFilename(MIL_ID ContextFuncId, MIL_INT ParamIndex, const MIL_STRING& ParamValuePtr, MIL_INT NumOfItems, MIL_INT Attribute)
+   {
+   MfuncParamFilename(ContextFuncId, ParamIndex, ParamValuePtr.c_str(), NumOfItems, Attribute);
+   }
+
+inline MIL_ID MFTYPE MfuncAlloc(const MIL_STRING &FunctionName, MIL_INT ParameterNum, MIL_FUNC_FUNCTION_PTR SlaveFunctionPtr, const MIL_STRING &SlaveFunctionDLLName,
+                                const MIL_STRING &SlaveFunctionName, MIL_INT SlaveFunctionOpcode, MIL_INT64 InitFlag, MIL_ID *CBasedContextFuncIdPtr)
+   {
+   return MfuncAlloc(FunctionName.c_str(), ParameterNum, SlaveFunctionPtr, SlaveFunctionDLLName.c_str(), SlaveFunctionName.c_str(), SlaveFunctionOpcode, InitFlag, CBasedContextFuncIdPtr);
+   }
+
+inline MIL_ID MFTYPE MfuncAllocScript(const MIL_STRING &FunctionName, MIL_INT ParameterNum, const MIL_STRING &InterpreterLanguage, const MIL_STRING &ScriptFileName,
+                                      const MIL_STRING &ScriptFunctionName, MIL_INT ScriptFunctionOpcode, MIL_INT64 InitFlag, MIL_ID *ScriptBasedContextFuncIdPtr)
+   {
+   return MfuncAllocScript(FunctionName.c_str(), ParameterNum, InterpreterLanguage.c_str(), ScriptFileName.c_str(), ScriptFunctionName.c_str(),
+                           ScriptFunctionOpcode, InitFlag, ScriptBasedContextFuncIdPtr);
+   }
+
+inline MIL_ID MFTYPE MfuncAllocScript(const MIL_STRING &FunctionName, MIL_INT ParameterNum, MIL_CONST_TEXT_PTR InterpreterLanguage, const MIL_STRING &ScriptFileName,
+                                      const MIL_STRING &ScriptFunctionName, MIL_INT ScriptFunctionOpcode, MIL_INT64 InitFlag, MIL_ID *ScriptBasedContextFuncIdPtr)
+   {
+   return MfuncAllocScript(FunctionName.c_str(), ParameterNum, InterpreterLanguage, ScriptFileName.c_str(), ScriptFunctionName.c_str(),
+                           ScriptFunctionOpcode, InitFlag, ScriptBasedContextFuncIdPtr);
+   }
+
+inline MIL_INT MFTYPE MfuncErrorReport(MIL_ID ContextFuncId, MIL_INT ErrorCode, const MIL_STRING &ErrorMessage, const MIL_STRING &ErrorSubMessage1,
+                                       const MIL_STRING &ErrorSubMessage2, const MIL_STRING &ErrorSubMessage3)
+   {
+   return MfuncErrorReport(ContextFuncId, ErrorCode, ErrorMessage.c_str(), ErrorSubMessage1.c_str(), ErrorSubMessage2.c_str(), ErrorSubMessage3.c_str());
+   }
+
+inline MIL_INT MFTYPE MfuncPrintMessage(MIL_INT Mode, const MIL_STRING &Str1, const MIL_STRING &Str2, const MIL_STRING &Str3, const MIL_STRING &Str4, const MIL_STRING &Str5)
+   {
+   return MfuncPrintMessage(Mode, Str1.c_str(), Str2.c_str(), Str3.c_str(), Str4.c_str(), Str5.c_str());
+   }
+
+//// MfuncInquireSafeType is not activated because too many undocumented InquireTypes with various pointer types.
+//#if M_MIL_USE_SAFE_TYPE
+//inline MIL_INT MFTYPE MfuncInquireSafeType(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_STRING    &UserVarPtr)
+//   {
+//   MIL_INT RetValue = 0;
+//
+//   //Test if InquireType is in string range
+//   if(M_IN_FUNC_INQUIRE_STRING_RANGE(InquireType))
+//      {
+//      MIL_INT InternalStringSize = 0;
+//      MfuncInquireSafeType(ObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+//
+//      if(InternalStringSize > 0)
+//         {
+//         UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+//         RetValue = MfuncInquireSafeTypeExecute(ObjectId, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+//         UserVarPtr.resize(InternalStringSize - 1);
+//         }
+//      }
+//   else
+//      {
+//      SafeTypeError(MIL_TEXT("MfuncInquire: Inquire type not in string range"));
+//      }
+//   return RetValue;
+//   }
+//
+//#else
+inline MIL_INT MFTYPE MfuncInquire(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_STRING    &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MfuncInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT InternalStringSize = 0;
+   MfuncInquire(ObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MfuncInquire(ObjectId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+      
+      }
+
+   return RetValue;
+   }
+//#endif
+
+/***************************************************************************/
+/* GRAPHIC MODULE                                                          */
+/***************************************************************************/
+#if M_MIL_USE_64BIT
+inline void MFTYPE MgraText(MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, const MCppParameter& XStart, const MCppParameter& YStart, MIL_STRING StringPtr)
+   {
+   MgraText(ContextGraId, DstImageBufOrListGraId, XStart, YStart, (MIL_CONST_TEXT_PTR)StringPtr.c_str());
+   }
+#else //different prototype are used for 32-bit
+inline void MFTYPE MgraText(MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, MIL_DOUBLE XStart, MIL_DOUBLE YStart, MIL_STRING StringPtr)
+   {
+   MgraText(ContextGraId, DstImageBufOrListGraId, XStart, YStart, (MIL_CONST_TEXT_PTR)StringPtr.c_str());
+   }
+
+#endif //M_MIL_USE_64BIT
+
+/***************************************************************************/
+/* BUFFER MODULE                                                          */
+/***************************************************************************/
+inline void MFTYPE MbufExportSequence(const MIL_STRING& FileName, MIL_INT64 FileFormat, const MIL_ID * BufArrayPtrOrSystemIdPtr, MIL_INT NumOfIds, MIL_DOUBLE FrameRate, MIL_INT64 ControlFlag)
+   {
+   return MbufExportSequence(FileName.c_str(), FileFormat, BufArrayPtrOrSystemIdPtr, NumOfIds, FrameRate, ControlFlag);
+   }
+
+inline void MFTYPE MbufExport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_ID SrcBufId)
+   {
+   return MbufExport(FileName.c_str(), FileFormat, SrcBufId);
+   }
+
+inline void MFTYPE MbufImportSequence(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_ID *BufArrayPtr, MIL_INT StartImage, MIL_INT NumberOfImages, MIL_INT64 ControlFlag)
+   {
+   return MbufImportSequence(FileName.c_str(), FileFormat, Operation, SystemId, BufArrayPtr, StartImage, NumberOfImages, ControlFlag);
+   }
+
+inline MIL_ID MFTYPE MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_ID* BufIdPtr)
+   {
+   return MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, BufIdPtr);
+   }
+
+inline void MFTYPE MbufLoad(const MIL_STRING& FileName, MIL_ID BufId)
+   {
+   return MbufLoad(FileName.c_str(), BufId);
+   }
+
+inline MIL_ID MFTYPE MbufRestore(const MIL_STRING& FileName, MIL_ID SystemId, MIL_ID* BufIdPtr)
+   {
+   return MbufRestore(FileName.c_str(), SystemId, BufIdPtr);
+   }
+
+inline void MFTYPE MbufSave(const MIL_STRING& FileName, MIL_ID BufId)
+   {
+   return MbufSave(FileName.c_str(), BufId);
+   }
+
+#if M_MIL_USE_SAFE_TYPE
+
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, int UserVarPtr)
+   {
+   if(UserVarPtr != M_NULL)
+      SafeTypeError(MIL_TEXT("MbufDiskInquire"));
+
+   return MbufDiskInquire(FileName.c_str(), InquireType, M_NULL);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, std::nullptr_t)
+   {
+   return MbufDiskInquire(FileName.c_str(), InquireType, M_NULL);
+   }
+#endif
+inline MIL_INT MFTYPE MbufDiskInquireUnsafe(const MIL_STRING& FileName, MIL_INT64 InquireType, void        *UserVarPtr) { return MbufDiskInquireUnsafe(FileName.c_str(), InquireType, UserVarPtr); }
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, MIL_INT     *UserVarPtr) { return MbufDiskInquireSafeTypeExecute(FileName.c_str(), InquireType, UserVarPtr, M_TYPE_MIL_INT); }
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, MIL_DOUBLE  *UserVarPtr) { return MbufDiskInquireSafeTypeExecute(FileName.c_str(), InquireType, UserVarPtr, M_TYPE_DOUBLE); }
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline MIL_INT MFTYPE MbufDiskInquireSafeType(const MIL_STRING& FileName, MIL_INT64 InquireType, MIL_UINT    *UserVarPtr) { return MbufDiskInquireSafeTypeExecute(FileName.c_str(), InquireType, UserVarPtr, M_TYPE_MIL_INT); }
+#endif
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING    &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MbufInquireFeatureSafeType(BufId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+   }
+
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"));
+
+   MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t            )
+   {
+   MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING&        UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str(), M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MbufControlFeature"));
+
+   MbufControlFeature(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int               UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t                   )
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MbufControlFeatureSafeType(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MbufControlFeatureExecute(BufId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+
+inline void MFTYPE MbufInquireFeatureSafeType(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MbufInquireFeatureExecute(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+#endif // MIL_COMPILE_VERSION >= 1020
+
+#else /* MIL_SAFE_TYPE */
+inline MIL_INT MFTYPE MbufDiskInquire(const MIL_STRING& FileName, MIL_INT64 InquireType, void * UserVarPtr)
+   {
+   return MbufDiskInquire(FileName.c_str(), InquireType, UserVarPtr);
+   }
+
+#if (MIL_COMPILE_VERSION >= 1020)   
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+#if !M_MIL_USE_SAFE_TYPE
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MbufInquireFeature(BufId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MbufInquireFeature(BufId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+#endif
+
+inline void MFTYPE MbufControlFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MbufControlFeature(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MbufControlFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MbufControlFeature(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+#endif // MIL_COMPILE_VERSION >= 1020
+#endif /* M_MIL_USE_SAFETYPE */   
+
+/***************************************************************************/
+/* APP MODULE                                                              */
+/***************************************************************************/
+inline void MFTYPE MappOpenConnection(const MIL_STRING& ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr)
+   {
+   return MappOpenConnection(ConnectionDescriptor.c_str(), InitFlag, ControlFlag, RemoteContextAppIdPtr);
+   }
+
+inline MIL_ID MFTYPE MappAlloc(const MIL_STRING& ServerDescription, MIL_INT64 InitFlag, MIL_ID* ContextAppIdPtr)
+   {
+   return MappAlloc(ServerDescription.c_str(), InitFlag, ContextAppIdPtr);
+   }
+
+inline void MFTYPE MappTrace(MIL_ID ContextAppId, MIL_INT64 TraceType, MIL_INT64 TraceTag, MIL_INT64 TraceValue, const MIL_STRING &TraceString)
+   {
+   return MappTrace(ContextAppId, TraceType, TraceTag, TraceValue, TraceString.c_str());
+   }
+
+
+#if M_MIL_USE_SAFE_TYPE
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_INT64 ErrorType, MIL_STRING&      ErrorPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ErrorType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappGetError"), MIL_TEXT("Error type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT InternalStringSize = 0;
+   MIL_INT RetValue = 0;
+   MappGetErrorSafeType(ErrorType + M_STRING_SIZE, &InternalStringSize);
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetErrorSafeTypeExecute(ErrorType, &ErrorPtr[0], M_TYPE_TEXT_CHAR);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetErrorSafeType(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_STRING      &ErrorPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ErrorType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappGetError"), MIL_TEXT("Error type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MappGetErrorSafeType(ContextAppId, ErrorType + M_STRING_SIZE, &InternalStringSize);
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetErrorSafeTypeExecute(ContextAppId, ErrorType, &ErrorPtr[0], M_TYPE_TEXT_CHAR);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING       &ErrorPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InfoType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"), MIL_TEXT("Info type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   //Resize to M_ERROR_MESSAGE_SIZE first
+   MappGetHookInfoSafeType(EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetHookInfoSafeTypeExecute(EventId, InfoType, &ErrorPtr[0], M_TYPE_TEXT_CHAR);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfoSafeType(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING       &ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InfoType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappGetHookInfo"), MIL_TEXT("Info type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MappGetHookInfoSafeType(ContextAppId, EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetHookInfoSafeTypeExecute(ContextAppId, EventId, InfoType, &ResultPtr[0], M_TYPE_TEXT_CHAR);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MappInquireSafeType(InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappInquireSafeTypeExecute(InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(MOs_UseDeprecatedStrLength(UserVarPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappInquireSafeType(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_STRING&      UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MappInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MappInquireSafeType(ContextAppId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappInquireSafeTypeExecute(ContextAppId, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(MOs_UseDeprecatedStrLength(UserVarPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline void MFTYPE MappFileOperationUnsafe(MIL_ID                  Comp1ContextAppId,
+                                           const MIL_STRING&       Comp1FileName,
+                                           MIL_ID                  Comp2ContextAppId,
+                                           const MIL_STRING&       Comp2FileName,
+                                           MIL_INT64               Operation,
+                                           MIL_INT64               OperationFlag,
+                                           void*                   OperationDataPtr)
+   {
+   MappFileOperationUnsafe(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                  Comp1ContextAppId,
+                                             const MIL_STRING&       Comp1FileName,
+                                             MIL_ID                  Comp2ContextAppId,
+                                             const MIL_STRING&       Comp2FileName,
+                                             MIL_INT64               Operation,
+                                             MIL_INT64               OperationFlag,
+                                             int                     OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                  Comp1ContextAppId,
+                                             int                     Comp1FileName,
+                                             MIL_ID                  Comp2ContextAppId,
+                                             const MIL_STRING&       Comp2FileName,
+                                             MIL_INT64               Operation,
+                                             MIL_INT64               OperationFlag,
+                                             int                     OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                  Comp1ContextAppId,
+                                             const MIL_STRING&       Comp1FileName,
+                                             MIL_ID                  Comp2ContextAppId,
+                                             int                     Comp2FileName,
+                                             MIL_INT64               Operation,
+                                             MIL_INT64               OperationFlag,
+                                             int                     OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+
+
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                     Comp1ContextAppId,
+                                             const MIL_STRING&           Comp1FileName,
+                                             MIL_ID                     Comp2ContextAppId,
+                                             int                        Comp2FileName,
+                                             MIL_INT64                  Operation,
+                                             MIL_INT64                  OperationFlag,
+                                             MIL_INT*                   OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                     Comp1ContextAppId,
+                                             const MIL_STRING&           Comp1FileName,
+                                             MIL_ID                     Comp2ContextAppId,
+                                             int                        Comp2FileName,
+                                             MIL_INT64                  Operation,
+                                             MIL_INT64                  OperationFlag,
+                                             MIL_TEXT_PTR               OperationDataPtr)
+   {
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperation(MIL_ID             Comp1ContextAppId,
+                                     const MIL_STRING& Comp1FileName,
+                                     MIL_ID            Comp2ContextAppId,
+                                     const MIL_STRING& Comp2FileName,
+                                     MIL_INT64        Operation,
+                                     MIL_INT64        OperationFlag,
+                                     void*            OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperation(MIL_ID             Comp1ContextAppId,
+                                     const MIL_STRING& Comp1FileName,
+                                     MIL_ID            Comp2ContextAppId,
+                                     int Comp2FileName,
+                                     MIL_INT64        Operation,
+                                     MIL_INT64        OperationFlag,
+                                     void*            OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, (MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperation(MIL_ID                  Comp1ContextAppId,
+                                     MIL_CONST_TEXT_PTR      Comp1FileName,
+                                     MIL_ID                  Comp2ContextAppId,
+                                     int                     Comp2FileName,
+                                     MIL_INT64               Operation,
+                                     MIL_INT64               OperationFlag,
+                                     void*                   OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId,(MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperationSafeType(MIL_ID                     Comp1ContextAppId,
+                                             const MIL_STRING&           Comp1FileName,
+                                             MIL_ID                     Comp2ContextAppId,
+                                             int                        Comp2FileName,
+                                             MIL_INT64                  Operation,
+                                             MIL_INT64                  OperationFlag,
+                                             MIL_STRING&                OperationDataPtr)
+   {
+
+   MIL_INT InternalStringSize = 0;
+   MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation + M_STRING_SIZE, OperationFlag, &InternalStringSize);
+
+   if (InternalStringSize > 0)
+      {
+      OperationDataPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MappFileOperationSafeType(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName, Operation , OperationFlag, &OperationDataPtr[0]);
+      OperationDataPtr.resize(InternalStringSize - 1);
+      }
+   }
+
+#else /* !M_MIL_USE_SAFE_TYPE */
+
+inline MIL_INT MFTYPE MappGetHookInfo(MIL_ID ContextAppId, MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING       &ErrorPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   MappGetHookInfo(ContextAppId, EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetHookInfo(ContextAppId, EventId, InfoType, &ErrorPtr[0]);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING       &ErrorPtr)
+   {
+   return MappGetHookInfo(M_DEFAULT, EventId, InfoType, ErrorPtr);
+   }
+
+inline MIL_INT MFTYPE MappInquire(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_STRING&      UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+
+   MIL_INT InternalStringSize = 0;
+   MappInquire(ContextAppId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappInquire(ContextAppId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(MOs_UseDeprecatedStrLength(UserVarPtr.c_str()));
+      }
+
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappInquire(MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+   return MappInquire(M_DEFAULT, InquireType, UserVarPtr);
+   }
+inline MIL_INT MFTYPE MappGetError(MIL_ID ContextAppId, MIL_INT64 ErrorType, MIL_STRING&      ErrorPtr)
+   {
+   MIL_INT RetValue = 0;
+
+
+   MIL_INT InternalStringSize = 0;
+   MappGetError(ContextAppId, ErrorType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ErrorPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MappGetError(ContextAppId, ErrorType, &ErrorPtr[0]);
+      ErrorPtr.resize(MOs_UseDeprecatedStrLength(ErrorPtr.c_str()));
+      }
+
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MappGetError(MIL_INT64 ErrorType, MIL_STRING&      ErrorPtr)
+   {
+   return MappGetError(M_DEFAULT, ErrorType, ErrorPtr);
+   }
+
+
+inline void MFTYPE MappFileOperation(MIL_ID             Comp1ContextAppId,
+                                      const MIL_STRING& Comp1FileName,
+                                      MIL_ID            Comp2ContextAppId,
+                                      const MIL_STRING& Comp2FileName,
+                                      MIL_INT64        Operation,
+                                      MIL_INT64        OperationFlag,
+                                      void*            OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, Comp2FileName.c_str(), Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperation(MIL_ID             Comp1ContextAppId,
+                                      const MIL_STRING& Comp1FileName,
+                                      MIL_ID            Comp2ContextAppId,
+                                      int Comp2FileName,
+                                      MIL_INT64        Operation,
+                                      MIL_INT64        OperationFlag,
+                                      void*            OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName.c_str(), Comp2ContextAppId, (MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+inline void MFTYPE MappFileOperation(MIL_ID                  Comp1ContextAppId,
+                                     MIL_CONST_TEXT_PTR      Comp1FileName,
+                                     MIL_ID                  Comp2ContextAppId,
+                                     int                     Comp2FileName,
+                                     MIL_INT64               Operation,
+                                     MIL_INT64               OperationFlag,
+                                     void*                   OperationDataPtr)
+   {
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId,(MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, OperationDataPtr);
+   }
+
+inline void MFTYPE MappFileOperation(MIL_ID                  Comp1ContextAppId,
+                                     const MIL_STRING&       Comp1FileName,
+                                     MIL_ID                  Comp2ContextAppId,
+                                     int                     Comp2FileName,
+                                     MIL_INT64               Operation,
+                                     MIL_INT64               OperationFlag,
+                                     MIL_STRING&             OperationDataPtr)
+   {
+
+   MIL_INT InternalStringSize = 0;
+   MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, (MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation + M_STRING_SIZE, OperationFlag, &InternalStringSize);
+   if (InternalStringSize > 0)
+      {
+      OperationDataPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MappFileOperation(Comp1ContextAppId, Comp1FileName, Comp2ContextAppId, (MIL_CONST_TEXT_PTR)(MIL_UINT)Comp2FileName, Operation, OperationFlag, &OperationDataPtr[0]);
+      OperationDataPtr.resize(InternalStringSize - 1);
+      }
+   }
+#endif /* M_MIL_USE_SAFE_TYPE*/
+
+/***************************************************************************/
+/* SYS MODULE                                                              */
+/***************************************************************************/
+inline void MsysControl(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ControlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MsysControl"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MsysControl(SysId, ControlType, ControlValue.c_str());
+   }
+
+
+inline MIL_ID MFTYPE MsysAlloc(MIL_ID ContextAppId, const MIL_STRING &SystemDescriptor, MIL_INT SystemNum, MIL_INT64 InitFlag, MIL_ID* SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor.c_str(), SystemNum, InitFlag, SysIdPtr);
+   }
+inline MIL_ID MFTYPE MsysAlloc(MIL_ID ContextAppId, const MIL_STRING &SystemDescriptor, const MIL_STRING &SystemNum, MIL_INT64 InitFlag, MIL_ID* SysIdPtr)
+   {
+   return MsysAlloc(ContextAppId, SystemDescriptor.c_str(), SystemNum.c_str(), InitFlag, SysIdPtr);
+   }
+
+#if M_MIL_USE_SAFE_TYPE
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING      &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MsysInquireFeatureSafeType(SysId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"));
+
+   MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING       &UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str(), M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+
+   MsysControlFeature(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int               UserVarPtr)
+   {
+   if(UserVarPtr)
+      SafeTypeError(MIL_TEXT("MsysControlFeature"));
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MsysControlFeatureSafeType(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MsysControlFeatureExecute(SysId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+
+inline void MFTYPE MsysInquireFeatureSafeType(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MsysInquireFeatureExecute(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+#endif // (MIL_COMPILE_VERSION >= 1020)
+
+inline MIL_INT MFTYPE MsysIoInquireSafeType(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_STRING&       UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MsysIoInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysIoInquireSafeType(IoObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysIoInquireSafeTypeExecute(IoObjectId, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline MIL_INT MFTYPE MsysGetHookInfoSafeType(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MsysGetHookInfo"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysGetHookInfoSafeType(SysId, EventId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysGetHookInfoSafeTypeExecute(SysId, EventId, InquireType, &ResultPtr[0], M_TYPE_STRING_PTR);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+
+inline MIL_INT MFTYPE MsysInquireSafeType(MIL_ID SysId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MsysInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysInquireSafeType(SysId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysInquireSafeTypeExecute(SysId, InquireType, &ResultPtr[0], M_TYPE_TEXT_CHAR);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MbufInquireSafeType(MIL_ID BufId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MbufInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MbufInquireSafeType(BufId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MbufInquireSafeTypeExecute(BufId, InquireType, &ResultPtr[0], M_TYPE_TEXT_CHAR);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+#else /* !M_MIL_USE_SAFE_TYPE*/
+
+inline MIL_INT MFTYPE MsysIoInquire(MIL_ID IoObjectId, MIL_INT64 InquireType, MIL_STRING        UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+
+   MIL_INT InternalStringSize = 0;
+   MsysIoInquire(IoObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysIoInquire(IoObjectId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline MIL_INT MFTYPE MsysGetHookInfo(MIL_ID SysId, MIL_ID EventId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysGetHookInfo(SysId, EventId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysGetHookInfo(SysId, EventId, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020)*/    
+inline MIL_INT MFTYPE MsysInquire(MIL_ID SysId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MsysInquire(SysId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MsysInquire(SysId, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+inline MIL_INT MFTYPE MbufInquire(MIL_ID SysId, MIL_INT64 InquireType, MIL_STRING       &ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MbufInquire(SysId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MbufInquire(SysId, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(MOs_UseDeprecatedStrLength(ResultPtr.c_str()));
+      }
+
+   return RetValue;
+   }
+
+
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MsysInquireFeatureW(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeatureW(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureW(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MsysControlFeatureW(SysId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+
+inline void MFTYPE MsysControlFeatureW(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MsysControlFeatureW(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+
+inline void MFTYPE MsysInquireFeatureW(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MsysInquireFeatureW(SysId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MsysInquireFeatureW(SysId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#else
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MsysInquireFeatureA(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeatureA(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeatureA(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MsysControlFeatureA(SysId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+
+inline void MFTYPE MsysControlFeatureA(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MsysControlFeatureA(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+
+inline void MFTYPE MsysInquireFeatureA(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MsysInquireFeatureA(SysId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MsysInquireFeatureA(SysId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#endif /* M_MIL_UNICODE_API */
+#else
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MsysControlFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MsysControlFeature(SysId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+
+inline void MFTYPE MsysControlFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MsysControlFeature(BufId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MsysInquireFeature(SysId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MsysInquireFeature(SysId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+#endif /* M_MIL_USE_UNICODE*/
+
+#endif
+/***************************************************************************/
+/* OBJ MODULE                                                              */
+/***************************************************************************/
+inline MIL_INT MFTYPE MobjInquire(MIL_ID ObjectId, MIL_INT64 InquireType, MIL_STRING  &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MobjInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MobjInquire(ObjectId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MobjInquire(ObjectId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+inline void MobjControl(MIL_ID ObjectId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ControlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MobjControl"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MobjControl(ObjectId, ControlType, ControlValue.c_str());
+   }
+
+/***************************************************************************/
+/* DIG MODULE                                                              */
+/***************************************************************************/
+inline void MdigControl(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((ControlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MdigControl"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MdigControl(DigId, ControlType, ControlValue.c_str());
+   }
+
+/***************************************************************************/
+/* BUF MODULE                                                              */
+/***************************************************************************/
+inline void MFTYPE MbufInquireContainer(MIL_ID ContainerId, MIL_INT64 TargetObject, MIL_INT64 InquireType, MIL_STRING    &UserVarPtr)
+   {
+   if(M_IN_BUF_INQUIRE_STRING_RANGE(InquireType))
+      {
+      MIL_INT InternalStringSize = 0;
+      MbufInquireContainer(ContainerId, TargetObject, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+      if(InternalStringSize > 0)
+         {
+         UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+         MbufInquireContainer(ContainerId, TargetObject, InquireType, &UserVarPtr[0]);
+         UserVarPtr.resize(MOs_UseDeprecatedStrLength(UserVarPtr.c_str()));
+         }
+      }
+#if M_MIL_USE_SAFE_TYPE	  
+   else
+      {
+      SafeTypeError(MIL_TEXT("MbufInquireContainer: Inquire type not in string range"));
+      }
+#endif	  
+   }
+
+inline void MbufControl(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if ((ControlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MbufControl"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MbufControl(BufId, ControlType, ControlValue.c_str());
+   }
+
+inline void MbufControlContainer(MIL_ID ContainerId, MIL_INT64 TargetObject, MIL_INT64 CtrlType, const MIL_STRING& ControlValue)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((CtrlType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MbufControlContainer"), MIL_TEXT("Control type not supported with MIL_STRING."));
+      }
+#endif
+
+   MbufControlContainer(ContainerId, TargetObject, CtrlType, ControlValue.c_str());
+   }
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+inline MIL_ID MFTYPE MdigAllocW(MIL_ID SystemId, MIL_INT DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAllocW(SystemId, DigNum, DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+inline MIL_ID MFTYPE MdigAllocW(MIL_ID SystemId, const MIL_STRING& DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAllocW(SystemId, DigNum.c_str(), DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+#else
+inline MIL_ID MFTYPE MdigAllocA(MIL_ID SystemId, MIL_INT DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAllocA(SystemId, DigNum, DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+inline MIL_ID MFTYPE MdigAllocA(MIL_ID SystemId, const MIL_STRING& DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAllocA(SystemId, DigNum.c_str(), DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+#endif /* M_MIL_UNICODE_API */
+#else
+inline MIL_ID MFTYPE MdigAlloc(MIL_ID SystemId, MIL_INT DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, DigNum, DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+inline MIL_ID MFTYPE MdigAlloc(MIL_ID SystemId, const MIL_STRING&  DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_ID* DigIdPtr)
+   {
+   return MdigAlloc(SystemId, DigNum.c_str(), DataFormat.c_str(), InitFlag, DigIdPtr);
+   }
+#endif /* M_MIL_USE_UNICODE */
+
+#if M_MIL_USE_SAFE_TYPE
+#if (MIL_COMPILE_VERSION >= 1020)
+inline MIL_INT MFTYPE MdigGetHookInfoSafeType(MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING&     ResultPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InfoType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MdigGetHookInfo"), MIL_TEXT("Info type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MdigGetHookInfoSafeType(EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdigGetHookInfoSafeTypeExecute(EventId, InfoType, &ResultPtr[0], M_TYPE_STRING_PTR);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING&     UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MdigInquireFeatureSafeTypeW(DigId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MdigInquireFeatureExecuteW(DigId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING      &UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str(), M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE      *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8       *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool            *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeatureW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int              UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, UserVarType);
+   }
+
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+inline void MFTYPE MdigControlFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64      *UserVarPtr)
+   {
+   MdigControlFeatureExecuteW(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeTypeW(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeW(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#endif
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#else
+#if (MIL_COMPILE_VERSION >= 1020)
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING&      UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MdigInquireFeatureSafeTypeA(DigId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MdigInquireFeatureExecuteA(DigId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING&               UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str());
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64              *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE             *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32              *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8              *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool                   *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int                     UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MdigControlFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64             *UserVarPtr)
+   {
+   MdigControlFeatureSafeTypeA(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeTypeA(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureSafeTypeA(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#endif
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#endif /* M_MIL_UNICODE_API */
+#else
+
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_STRING&      UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MdigInquireFeatureSafeType(DigId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT64      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_DOUBLE     *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_INT32      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT8      *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, bool           *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeature(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int             UserVarPtr)
+   {
+   if(UserVarPtr != 0)
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"));
+
+   MdigInquireFeatureSafeType(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigInquireFeatureSafeType(DigId, InquireType, FeatureName.c_str(), UserVarType, M_NULL);
+   }
+#endif
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_STRING&       UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr.c_str(), M_TYPE_TEXT_CHAR);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT64        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_DOUBLE       *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_DOUBLE);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_INT32        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_MIL_INT32);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT8        *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_UINT8);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const bool             *UserVarPtr)
+   {
+   SafeTypeError(MIL_TEXT("MdigControlFeature"));
+
+   MdigControlFeature(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, int               UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, UserVarType);
+   }
+#if M_MIL_SAFE_TYPE_M_NULL_PTR_TYPE_EXISTS
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::nullptr_t)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, M_NULL, UserVarType);
+   }
+#endif
+
+#if M_MIL_SAFE_TYPE_SUPPORTS_UNSIGNED
+
+inline void MFTYPE MdigControlFeatureSafeType(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const MIL_UINT64       *UserVarPtr)
+   {
+   MdigControlFeatureExecute(DigId, ControlType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+
+inline void MFTYPE MdigInquireFeatureSafeType(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, MIL_UINT64     *UserVarPtr)
+   {
+   MdigInquireFeatureExecute(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr, M_TYPE_INT64);
+   }
+#endif
+#endif   /* M_MIL_USE_UNICODE */
+
+inline MIL_INT MFTYPE MdigInquireSafeType(MIL_ID DigId, MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MdigInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MdigInquireSafeType(DigId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdigInquireExecute(DigId, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#else
+inline MIL_INT MFTYPE MdigInquire(MIL_ID DigId, MIL_INT64 InquireType, MIL_STRING      &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MdigInquire(DigId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdigInquire(DigId, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, void           *UserVarPtr)
+   {
+   MdigInquireFeature(DigId, InquireType, FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, MIL_STRING &UserVarPtr)
+   {
+   UNREFERENCED_PARAMETER(UserVarType);
+   MIL_INT InternalStringSize = 0;
+   MdigInquireFeature(DigId, InquireType + M_STRING_SIZE, FeatureName.c_str(), M_TYPE_MIL_INT, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      MdigInquireFeature(DigId, InquireType, FeatureName.c_str(), M_TYPE_STRING + M_FEATURE_USER_ARRAY_SIZE(InternalStringSize), &UserVarPtr[0]);
+      MIL_INT Len = MosStrlen(&UserVarPtr[0]);
+      UserVarPtr.resize(Len);
+
+      }
+   }
+
+inline void MFTYPE MdigControlFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const void *UserVarPtr)
+   {
+   MdigControlFeature(DigId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, UserVarPtr);
+   }
+
+inline void MFTYPE MdigControlFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING &FeatureName, MIL_INT64 UserVarType, const MIL_STRING &UserVarPtr)
+   {
+   MdigControlFeature(DigId, InquireType, (MIL_CONST_TEXT_PTR)FeatureName.c_str(), UserVarType, (MIL_CONST_TEXT_PTR)UserVarPtr.c_str());
+   }
+
+#if (MIL_COMPILE_VERSION >= 1020)
+inline MIL_INT MFTYPE MdigGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, MIL_STRING&    ResultPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+   MdigGetHookInfo(EventId, InfoType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MdigGetHookInfo(EventId, InfoType, &ResultPtr[0]);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif /* (MIL_COMPILE_VERSION >= 1020) */
+#endif /* M_MIL_USE_SAFE_TYPE */
+
+/***************************************************************************/
+/* COM MODULE                                                              */
+/***************************************************************************/
+#ifdef  __MILCOM_H__
+inline MIL_INT MFTYPE McomInquire(MIL_ID ComId, MIL_INT64  InquireType, MIL_STRING &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("McomInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   McomInquire(ComId, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      ResultPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = McomInquire(ComId, InquireType, &ResultPtr[0]);
+      ResultPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+#endif
+
+/***************************************************************************/
+/* SEQ MODULE                                                              */
+/***************************************************************************/
+
+#if  !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+inline void MFTYPE MseqDefine(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 SequenceType, const MIL_STRING& Param1Ptr, MIL_DOUBLE Param2)
+   {
+   MseqDefine(ContextSeqId, SequenceIndex, SequenceType, Param1Ptr.c_str(), Param2);
+   }
+
+#if M_MIL_USE_SAFE_TYPE
+inline MIL_INT MFTYPE MseqInquireSafeType(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_STRING       &UserVarPtr)
+   {
+#if MIL_COMPILE_VERSION >= MIL_COMPILE_TRUNK_VERSION && M_MIL_USE_SAFE_TYPE
+   if((InquireType & M_CLIENT_ENCODING) != M_CLIENT_ENCODING)
+      {
+      SafeTypeError(MIL_TEXT("MseqInquire"), MIL_TEXT("Inquire type not supported with MIL_STRING."));
+      }
+#endif
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MseqInquireSafeType(ContextSeqId, SequenceIndex, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MseqInquireSafeTypeExecute(ContextSeqId, SequenceIndex, InquireType, &UserVarPtr[0], M_TYPE_TEXT_CHAR);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#else
+inline MIL_INT MFTYPE MseqInquire(MIL_ID ContextSeqId, MIL_INT SequenceIndex, MIL_INT64 InquireType, MIL_STRING       &UserVarPtr)
+   {
+   MIL_INT RetValue = 0;
+   MIL_INT InternalStringSize = 0;
+
+   MseqInquire(ContextSeqId, SequenceIndex, InquireType + M_STRING_SIZE, &InternalStringSize);
+
+   if(InternalStringSize > 0)
+      {
+      UserVarPtr.assign(InternalStringSize, MIL_TEXT('\0'));
+      RetValue = MseqInquire(ContextSeqId, SequenceIndex, InquireType, &UserVarPtr[0]);
+      UserVarPtr.resize(InternalStringSize - 1);
+
+      }
+
+   return RetValue;
+   }
+
+#endif
+
+//Undefined MOs_UseDeprecatedStrLength
+#ifdef  MOs_UseDeprecatedStrLength
+#undef  MOs_UseDeprecatedStrLength
+#endif
+
+
+#endif //#!M_MIL_USE_LINUX
+#endif /* M_MIL_USE_STRING */
+#endif /* __MILSTRING_H__ */	
+#endif /* __MILPROTO_H */
diff --git a/Lib/Matrox/Include/miluniqueid.h b/Lib/Matrox/Include/miluniqueid.h
new file mode 100644
index 0000000..0d25982
--- /dev/null
+++ b/Lib/Matrox/Include/miluniqueid.h
@@ -0,0 +1,554 @@
+锘�/************************************************************************/
+/*
+*
+* Filename     :  miluniqueid.h
+* Revision     :  10.40.0640
+* Content      :  MIL_UNIQUE_ID C++ RAII class for a MIL_ID
+*
+* Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+* All Rights Reserved
+*************************************************************************/
+#ifndef __UNIQUE_MIL_ID_H
+#define __UNIQUE_MIL_ID_H
+
+#ifndef M_MIL_USE_MIL_UNIQUE_ID
+   #if defined(__cplusplus) && (!defined(M_COMPILING_MILDLL) || !M_COMPILING_MILDLL) && (!defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL) && (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE)
+      #define M_MIL_USE_MIL_UNIQUE_ID 1
+   #else
+      #define M_MIL_USE_MIL_UNIQUE_ID 0
+   #endif
+#endif
+
+#if M_MIL_USE_MIL_UNIQUE_ID
+
+typedef void (MFTYPE MilFreeFuncType)(MIL_ID Id);
+
+#if M_MIL_USE_SAFE_TYPE
+
+template <MilFreeFuncType FreeFunc>
+inline bool MilIsCorrectObjectType(MIL_INT64 ObjectType);
+
+// Functions used in debug to report an error if a MIL object ends up in the wrong
+// MIL_UNIQUE_ID type.
+
+template <> inline bool MilIsCorrectObjectType<&MappFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_APPLICATION;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MappCloseConnection>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_APPLICATION;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MbufFree>(MIL_INT64 ObjectType)
+   {
+   return M_IS_BUFFER_TYPE(ObjectType) || ObjectType == M_CONTAINER;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MdigFree>(MIL_INT64 ObjectType)
+   {
+   return M_IS_DIGITIZER_TYPE(ObjectType);
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MgraFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_GRAPHIC_CONTEXT || ObjectType == M_GRAPHIC_LIST;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MobjFree>(MIL_INT64 ObjectType)
+   {
+   return (ObjectType == M_MESSAGE_MAILBOX) ||
+          (ObjectType == M_HOOK_CONTEXT) ||
+          (ObjectType == M_OPAQUE_HOOK_CONTEXT) ||
+          (ObjectType == M_HTTP_SERVER);
+   }
+
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+template <> inline bool MilIsCorrectObjectType<&MseqFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_SEQUENCE_CONTEXT;
+   }
+#endif
+template <> inline bool MilIsCorrectObjectType<&MsysFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_SYSTEM;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MsysIoFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_SYS_IO_CONTEXT;
+   }
+
+template <> inline bool MilIsCorrectObjectType<&MthrFree>(MIL_INT64 ObjectType)
+   {
+   return ObjectType == M_EVENT || ObjectType == M_SYSTEM_THREAD || ObjectType == M_MUTEX;
+   }
+
+template <MilFreeFuncType FreeFunc>
+inline void MilCheckObjectType(MIL_ID Id)
+   {
+   if (!M_ID_IS_VIRTUAL_OR_NULL(Id))
+      {
+      MIL_INT64 ObjectType;
+      MobjInquire(Id, M_OBJECT_TYPE, &ObjectType);
+      if (!MilIsCorrectObjectType<FreeFunc>(ObjectType))
+         SafeTypeError(MIL_TEXT("allocation function"), MIL_TEXT("Mismatch between object type and MIL_UNIQUE_ID type."));
+      }
+   }
+
+#define MIL_CHECK_OBJECT_TYPE(Id, FreeFunc) MilCheckObjectType<FreeFunc>(Id)
+
+#else
+
+// In release, there is no check at ID acquisition. When the free function is called,
+// a MIL error is reported if the object type is incorrect.
+#define MIL_CHECK_OBJECT_TYPE(Id, FreeFunc)
+
+#endif
+
+// MIL_ID wrapper that manages its lifetime by calling the corresponding free function
+// in the destructor. Interface similar to std::unique_ptr.
+template <MilFreeFuncType FreeFunc>
+class MIL_UNIQUE_ID
+   {
+   public:
+      explicit MIL_UNIQUE_ID(MIL_ID Id = M_NULL) MIL_NOEXCEPT
+         : m_Id(Id)
+         {
+         MIL_CHECK_OBJECT_TYPE(m_Id, FreeFunc);
+         }
+
+      ~MIL_UNIQUE_ID() MIL_NOEXCEPT
+         {
+         free_id();
+         }
+
+#if M_MIL_USE_MOVE_SEMANTICS
+      MIL_UNIQUE_ID(MIL_UNIQUE_ID&& Other) MIL_NOEXCEPT
+         : m_Id(Other.m_Id)
+         {
+         Other.m_Id = M_NULL;
+         }
+
+      MIL_UNIQUE_ID& operator=(MIL_UNIQUE_ID&& Other) MIL_NOEXCEPT
+         {
+         if (&Other != this)
+            {
+            free_id();
+            m_Id = Other.m_Id;
+            Other.m_Id = M_NULL;
+            }
+         return *this;
+         }
+
+      // Forbid construction from MIL_UNIQUE_ID of a different type.
+      // (Could happen because of implicit conversion to MIL_ID)
+      template <MilFreeFuncType FreeFunc2>
+      MIL_UNIQUE_ID(const MIL_UNIQUE_ID<FreeFunc2>&) = delete;
+#endif
+
+#if M_MIL_USE_NULLPTR
+      MIL_UNIQUE_ID& operator=(std::nullptr_t) MIL_NOEXCEPT
+         {
+         reset();
+         return *this;
+         }
+#endif
+
+      MIL_ID release() MIL_NOEXCEPT
+         {
+         MIL_ID Id = m_Id;
+         m_Id = M_NULL;
+         return Id;
+         }
+
+      void reset(MIL_ID NewId = M_NULL) MIL_NOEXCEPT
+         {
+         if (NewId != m_Id)
+            {
+            free_id();
+            m_Id = NewId;
+            }
+         MIL_CHECK_OBJECT_TYPE(m_Id, FreeFunc);
+         }
+
+      MIL_ID get() const MIL_NOEXCEPT
+         {
+         return m_Id;
+         }
+
+#if M_MIL_USE_REF_QUALIFIERS
+      // Allow implicit conversion to MIL_ID only on non-temporary MIL_UNIQUE_IDs.
+      operator MIL_ID() const & MIL_NOEXCEPT
+         {
+         return m_Id;
+         }
+      operator MIL_ID() && = delete;
+#else
+      operator MIL_ID() const MIL_NOEXCEPT
+         {
+         return m_Id;
+         }
+#endif
+
+      friend void swap(MIL_UNIQUE_ID& lhs, MIL_UNIQUE_ID& rhs) MIL_NOEXCEPT
+         {
+         MIL_ID lhsId = lhs.m_Id;
+         lhs.m_Id = rhs.m_Id;
+         rhs.m_Id = lhsId;
+         }
+
+   private:
+#ifndef M_MIL_USE_MOVE_SEMANTICS
+      // Copy is forbidden
+      MIL_UNIQUE_ID(const MIL_UNIQUE_ID&);
+      MIL_UNIQUE_ID& operator=(const MIL_UNIQUE_ID&);
+#endif
+
+      void free_id() MIL_NOEXCEPT
+         {
+         if (!M_ID_IS_VIRTUAL_OR_NULL(m_Id))
+            FreeFunc(m_Id);
+         }
+
+      MIL_ID m_Id;
+   };
+
+// Specific MIL_UNIQUE_ID instantiations for each free function.
+typedef MIL_UNIQUE_ID<&MappFree  > MIL_UNIQUE_APP_ID;
+typedef MIL_UNIQUE_ID<&MappCloseConnection> MIL_UNIQUE_CONNECTION_ID;
+typedef MIL_UNIQUE_ID<&MbufFree  > MIL_UNIQUE_BUF_ID;
+typedef MIL_UNIQUE_ID<&MdigFree  > MIL_UNIQUE_DIG_ID;
+typedef MIL_UNIQUE_ID<&MgraFree  > MIL_UNIQUE_GRA_ID;
+typedef MIL_UNIQUE_ID<&MobjFree  > MIL_UNIQUE_OBJ_ID;
+typedef MIL_UNIQUE_ID<&MsysFree  > MIL_UNIQUE_SYS_ID;
+typedef MIL_UNIQUE_ID<&MsysIoFree> MIL_UNIQUE_SYSIO_ID;
+typedef MIL_UNIQUE_ID<&MthrFree  > MIL_UNIQUE_THR_ID;
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+typedef MIL_UNIQUE_ID<&MseqFree  > MIL_UNIQUE_SEQ_ID;
+#endif
+
+// Factory functions that wrap all MIL allocation functions to return a MIL_UNIQUE_ID
+// instead of a MIL_ID. To use the factory function, simply replace the last
+// MIL_ID* parameter with M_UNIQUE_ID.
+
+#if M_MIL_USE_MOVE_SEMANTICS
+
+// Structure used for tag dispatching in the C++ overloads below.
+struct MIL_UNIQUE_ID_TAG {};
+#define M_UNIQUE_ID  MIL_UNIQUE_ID_TAG()
+
+// Structure used to accept an array of either MIL_UNIQUE_IDs or MIL_IDs.
+struct MilConstArrayIdParam
+   {
+   const MIL_ID* m_IdArrayPtr;
+
+   inline MilConstArrayIdParam(const MIL_ID* p) : m_IdArrayPtr(p) {}
+
+   template <MilFreeFuncType FreeFunc>
+   inline MilConstArrayIdParam(const MIL_UNIQUE_ID<FreeFunc>* p)
+      : m_IdArrayPtr(reinterpret_cast<const MIL_ID*>(p))
+      {
+      static_assert(sizeof(MIL_UNIQUE_ID<FreeFunc>[2]) == sizeof(MIL_ID[2]),
+                    "cannot cast const MIL_UNIQUE_ID<FreeFunc>* to const MIL_ID*");
+      }
+   };
+
+// Generic implementation of MxxxStream C++ overloads for MIL_UNIQUE_IDs.
+template <MilFreeFuncType FreeFunc>
+inline void MxxxStreamForMilUniqueId(MilStreamParam         MemPtrOrFileName,
+                                     MIL_ID                 SysId           ,
+                                     MIL_INT64              Operation       ,
+                                     MIL_INT64              StreamType      ,
+                                     MIL_DOUBLE             Version         ,
+                                     MIL_INT64              ControlFlag     ,
+                                     MIL_UNIQUE_ID<FreeFunc>* UniqueIdPtr     ,
+                                     MIL_INT*               SizeByteVarPtr  ,
+                                     M_XXX_STREAM_FUNCTION  MxxxStream      )
+   {
+   MIL_ID TempId = UniqueIdPtr->get();
+   (*MxxxStream)(MemPtrOrFileName, SysId, Operation, StreamType, Version, ControlFlag, &TempId, SizeByteVarPtr);
+   if (Operation & M_RESTORE)
+      UniqueIdPtr->reset(TempId);
+   }
+
+
+// APP
+inline MIL_UNIQUE_APP_ID MappAlloc(MIL_CONST_TEXT_PTR ServerDescription, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_APP_ID(MappAlloc(ServerDescription, InitFlag, M_NULL));
+   }
+inline MIL_UNIQUE_CONNECTION_ID MappOpenConnection(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   MIL_ID RemoteContextAppId = M_NULL;
+   MappOpenConnection(ConnectionDescriptor, InitFlag, ControlFlag, &RemoteContextAppId);
+   return MIL_UNIQUE_CONNECTION_ID(RemoteContextAppId);
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_APP_ID MappAlloc(const MIL_STRING& ServerDescription, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_APP_ID(MappAlloc(ServerDescription, InitFlag, M_NULL));
+   }
+inline MIL_UNIQUE_CONNECTION_ID MappOpenConnection(const MIL_STRING& ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   MIL_ID RemoteContextAppId = M_NULL;
+   MappOpenConnection(ConnectionDescriptor, InitFlag, ControlFlag, &RemoteContextAppId);
+   return MIL_UNIQUE_CONNECTION_ID(RemoteContextAppId);
+   }
+#endif
+template <MilFreeFuncType FreeFunc> inline void MappFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+template <MilFreeFuncType FreeFunc> inline void MappCloseConnection(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// BUF
+inline MIL_UNIQUE_BUF_ID MbufAlloc1d(MIL_ID SystemId, MIL_INT SizeX, MIL_INT Type, MIL_INT64 Attribute, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAlloc1d(SystemId, SizeX, Type, Attribute, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufAlloc2d(MIL_ID SystemId, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAlloc2d(SystemId, SizeX, SizeY, Type, Attribute, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufAllocColor(MIL_ID SystemId, MIL_INT SizeBand, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAllocColor(SystemId, SizeBand, SizeX, SizeY, Type, Attribute, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufAllocDefault(MIL_ID SysId, MIL_ID RefMilObjectId, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_INT64 ControlValue, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAllocDefault(SysId, RefMilObjectId, Attribute, ControlFlag, ControlValue, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufAllocContainer(MIL_ID SysId, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufAllocContainer(SysId, Attribute, ControlFlag, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChild1d(MIL_ID ParentBufId, MIL_INT OffX, MIL_INT SizeX, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChild1d(ParentBufId, OffX, SizeX, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChild2d(MIL_ID ParentBufId, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChild2d(ParentBufId, OffX, OffY, SizeX, SizeY, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChildColor2d(MIL_ID ParentBufId, MIL_INT Band, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChildColor2d(ParentBufId, Band, OffX, OffY, SizeX, SizeY, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChildColor2dClip(MIL_ID ParentBufId, MIL_INT Band, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, MIL_INT* StatusPtr, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChildColor2dClip(ParentBufId, Band, OffX, OffY, SizeX, SizeY, StatusPtr, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChildColor(MIL_ID ParentBufId, MIL_INT Band, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChildColor(ParentBufId, Band, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufChildContainer(MIL_ID ContId, MIL_INT ComponentCriteriaSize, const MIL_INT64* ComponentCriteriaArrayPtr, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufChildContainer(ContId, ComponentCriteriaSize, ComponentCriteriaArrayPtr, ControlFlag, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufClone(MIL_ID SrcBufId, MIL_ID SysId, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufClone(SrcBufId, SysId, SizeX, SizeY, Type, Attribute, ControlFlag, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufCreate2dFunc(MIL_ID SystemId, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_INT Pitch, MIL_DATA_PTR DataPtr, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufCreate2dFunc(SystemId, SizeX, SizeY, Type, Attribute, ControlFlag, Pitch, DataPtr, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufCreateColor(MIL_ID SystemId, MIL_INT SizeBand, MIL_INT SizeX, MIL_INT SizeY, MIL_INT Type, MIL_INT64 Attribute, MIL_INT64 ControlFlag, MIL_INT Pitch, void** ArrayOfDataPtr, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufCreateColor(SystemId, SizeBand, SizeX, SizeY, Type, Attribute, ControlFlag, Pitch, ArrayOfDataPtr, M_NULL));
+   }
+inline MIL_UNIQUE_BUF_ID MbufRestore(MIL_CONST_TEXT_PTR FileName, MIL_ID SystemId, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufRestore(FileName, SystemId, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_BUF_ID MbufRestore(const MIL_STRING& FileName, MIL_ID SystemId, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_BUF_ID(MbufRestore(FileName, SystemId, M_NULL));
+   }
+#endif
+template <MilFreeFuncType FreeFunc> inline void MbufFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+inline void MbufExportSequence(
+      MIL_CONST_TEXT_PTR   FileName                ,
+      MIL_INT64            FileFormat              ,
+      MilConstArrayIdParam BufArrayPtrOrSystemIdPtr,
+      MIL_INT              NumOfIds                ,
+      MIL_DOUBLE           FrameRate               ,
+      MIL_INT64            ControlFlag             )
+   {
+   MbufExportSequence(FileName, FileFormat, BufArrayPtrOrSystemIdPtr.m_IdArrayPtr,
+                      NumOfIds, FrameRate, ControlFlag);
+   }
+inline MIL_ID MbufImport(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, int)
+   {
+   return MbufImport(FileName, FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+   }
+#if M_MIL_USE_NULLPTR
+inline MIL_ID MbufImport(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, std::nullptr_t)
+   {
+   return MbufImport(FileName, FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+   }
+#endif 
+inline MIL_ID MbufImport(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_UNIQUE_BUF_ID* BufIdPtr)
+   {
+   if (BufIdPtr)
+      {
+      MIL_ID TempBufId = BufIdPtr->get();
+      MIL_ID ReturnValue = MbufImport(FileName, FileFormat, Operation, SystemId, &TempBufId);
+      if (Operation & M_RESTORE)
+         BufIdPtr->reset(TempBufId);
+      return ReturnValue;
+      }
+   else
+      {
+      return MbufImport(FileName, FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+      }
+   }
+inline  MIL_UNIQUE_BUF_ID MbufImport(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_UNIQUE_ID_TAG)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if ((Operation & M_RESTORE) != M_RESTORE)
+      SafeTypeError(MIL_TEXT("MbufImport"), MIL_TEXT("This overload only supports the M_RESTORE operation."));
+#endif
+   return MIL_UNIQUE_BUF_ID(MbufImport(FileName, FileFormat, Operation, SystemId, M_NULL));
+   }
+
+#if M_MIL_USE_STRING
+inline void MbufExportSequence(
+      const MIL_STRING&    FileName                ,
+      MIL_INT64            FileFormat              ,
+      MilConstArrayIdParam BufArrayPtrOrSystemIdPtr,
+      MIL_INT              NumOfIds                ,
+      MIL_DOUBLE           FrameRate               ,
+      MIL_INT64            ControlFlag             )
+   {
+   MbufExportSequence(FileName.c_str(), FileFormat, BufArrayPtrOrSystemIdPtr.m_IdArrayPtr,
+                      NumOfIds, FrameRate, ControlFlag);
+   }
+inline MIL_ID MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, int)
+   {
+   return MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+   }
+#if M_MIL_USE_NULLPTR
+inline MIL_ID MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, std::nullptr_t)
+   {
+   return MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, static_cast<MIL_ID*>(0));
+   }
+#endif
+inline MIL_ID MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_UNIQUE_BUF_ID* BufIdPtr)
+   {
+   return MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, BufIdPtr);
+   }
+inline  MIL_UNIQUE_BUF_ID MbufImport(const MIL_STRING& FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, MIL_UNIQUE_ID_TAG)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(Operation != M_RESTORE)
+      SafeTypeError(MIL_TEXT("MbufImport"), MIL_TEXT("This overload only supports the M_RESTORE operation."));
+#endif
+   return MIL_UNIQUE_BUF_ID(MbufImport(FileName.c_str(), FileFormat, Operation, SystemId, M_NULL));
+   }
+#endif
+
+inline void MbufStream(MilStreamParam     MemPtrOrFileName,
+                       MIL_ID             SysId,
+                       MIL_INT64          Operation,
+                       MIL_INT64          StreamType,
+                       MIL_DOUBLE         Version,
+                       MIL_INT64          ControlFlag,
+                       MIL_UNIQUE_BUF_ID* MbufIdPtr,
+                       MIL_INT*           SizeByteVarPtr)
+   {
+   MxxxStreamForMilUniqueId(MemPtrOrFileName, SysId, Operation, StreamType, Version, ControlFlag, MbufIdPtr, SizeByteVarPtr, MbufStream);
+   }
+
+// DIG
+inline MIL_UNIQUE_DIG_ID MdigAlloc(MIL_ID SystemId, MIL_INT DigNum, MIL_CONST_TEXT_PTR DataFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_DIG_ID(MdigAlloc(SystemId, DigNum, DataFormat, InitFlag, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_DIG_ID MdigAlloc(MIL_ID SystemId, MIL_INT DigNum, const MIL_STRING& DataFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_DIG_ID(MdigAlloc(SystemId, DigNum, DataFormat, InitFlag, M_NULL));
+   }
+#endif
+template <MilFreeFuncType FreeFunc> inline void MdigFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+inline void MdigProcess(
+   MIL_ID                    DigId,
+   MilConstArrayIdParam      DestImageArrayPtr,
+   MIL_INT                   ImageCount,
+   MIL_INT64                 Operation,
+   MIL_INT64                 OperationFlag,
+   MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr,
+   void*                     UserDataPtr)
+   {
+   MdigProcess(DigId, DestImageArrayPtr.m_IdArrayPtr, ImageCount,
+               Operation, OperationFlag, HookHandlerPtr, UserDataPtr);
+   }
+
+// GRA
+inline MIL_UNIQUE_GRA_ID MgraAlloc(MIL_ID SysId, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_GRA_ID(MgraAlloc(SysId, M_NULL));
+   }
+inline MIL_UNIQUE_GRA_ID MgraAllocList(MIL_ID SysId, MIL_INT ListGraType, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_GRA_ID(MgraAllocList(SysId, ListGraType, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MgraFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// OBJ
+inline MIL_UNIQUE_OBJ_ID MobjAlloc(MIL_ID SysId, MIL_INT64 ObjectType, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_OBJ_ID(MobjAlloc(SysId, ObjectType, InitFlag, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MobjFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// SEQ
+#if !M_MIL_USE_LINUX || M_MIL_USE_64BIT
+inline MIL_UNIQUE_SEQ_ID MseqAlloc(MIL_ID SystemId, MIL_INT64 SequenceType, MIL_INT64 Operation, MIL_UINT32 OutputFormat, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_SEQ_ID(MseqAlloc(SystemId, SequenceType, Operation, OutputFormat, InitFlag, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MseqFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+#endif
+
+// SYS
+inline MIL_UNIQUE_SYS_ID MsysAlloc(MIL_ID ContextAppId, MIL_CONST_TEXT_PTR SystemDescriptor, MIL_INT SystemNum, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_SYS_ID(MsysAlloc(ContextAppId, SystemDescriptor, SystemNum, InitFlag, M_NULL));
+   }
+#if M_MIL_USE_STRING
+inline MIL_UNIQUE_SYS_ID MsysAlloc(MIL_ID ContextAppId, const MIL_STRING& SystemDescriptor, MIL_INT SystemNum, MIL_INT64 InitFlag, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_SYS_ID(MsysAlloc(ContextAppId, SystemDescriptor, SystemNum, InitFlag, M_NULL));
+   }
+#endif
+template <MilFreeFuncType FreeFunc> inline void MsysFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// SYSIO
+inline MIL_UNIQUE_SYSIO_ID MsysIoAlloc(MIL_ID SysId, MIL_INT64 IoCmdListNum, MIL_INT64 Type, MIL_INT64 CounterSrc, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_SYSIO_ID(MsysIoAlloc(SysId, IoCmdListNum, Type, CounterSrc, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MsysIoFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+// THR
+inline MIL_UNIQUE_THR_ID MthrAlloc(MIL_ID SystemId, MIL_INT64 ObjectType, MIL_INT64 ControlFlag, MIL_THREAD_FUNCTION_PTR ThreadFctPtr, void *UserDataPtr, MIL_UNIQUE_ID_TAG)
+   {
+   return MIL_UNIQUE_THR_ID(MthrAlloc(SystemId, ObjectType, ControlFlag, ThreadFctPtr, UserDataPtr, M_NULL));
+   }
+template <MilFreeFuncType FreeFunc> inline void MthrFree(const MIL_UNIQUE_ID<FreeFunc>&) = delete;
+
+inline MIL_INT MthrWaitMultiple(MilConstArrayIdParam EventArrayIdPtr, MIL_INT EventArraySize, MIL_INT64 WaitOption, MIL_INT *StatePtr)
+   {
+   return MthrWaitMultiple(EventArrayIdPtr.m_IdArrayPtr, EventArraySize, WaitOption, StatePtr);
+   }
+
+#endif // #if M_MIL_USE_MOVE_SEMANTICS
+
+#endif // #if M_MIL_USE_MIL_UNIQUE_ID
+
+#endif // #ifndef __UNIQUE_MIL_ID_H
diff --git a/Lib/Matrox/Include/milvector.h b/Lib/Matrox/Include/milvector.h
new file mode 100644
index 0000000..ca0ee6d
--- /dev/null
+++ b/Lib/Matrox/Include/milvector.h
@@ -0,0 +1,2279 @@
+锘�/***************************************************************************/
+/*
+
+    Filename:  MILVECTOR.H
+    Owner   :  Matrox Imaging
+    Revision:  10.40.0640
+    Content :  This file contains the std::vector overload for the Matrox
+    Imaging Library (MIL)
+
+    Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+    All Rights Reserved
+    */
+/***************************************************************************/
+#ifndef __MILPROTO_H
+#error milproto.h required
+#else
+
+#ifndef __MILVECTOR_H__
+#define __MILVECTOR_H__
+
+/************************************************************************/
+/* SUPPORT FOR std::vector                                              */
+/************************************************************************/
+#ifndef M_MIL_USE_VECTOR
+#if (!defined(M_LINUX_KERNEL) || !M_LINUX_KERNEL) && (!defined(M_WINDOWS_NT_KERNEL_MODE) || !M_WINDOWS_NT_KERNEL_MODE) && (!defined(M_WINDOWS_CE_KERNEL_MODE) || !M_WINDOWS_CE_KERNEL_MODE) &&  defined(__cplusplus)
+#define M_MIL_USE_VECTOR 1
+#else
+#define M_MIL_USE_VECTOR 0
+#endif
+#endif
+
+/************************************************************************/
+/* SUPPORT FOR std::vector                                              */
+/************************************************************************/
+#if M_MIL_USE_VECTOR
+#include <vector>
+
+// Struct used for getting the MIL data type flag of a data type.
+template <typename UserType>
+struct MilTraits;
+
+#define DECLARE_MIL_TRAITS(Type, MilDataTypeFlag, MilBufferTypeFlag)       \
+template <>                                                                \
+struct MilTraits<Type>                                                     \
+   {                                                                       \
+   static const MIL_INT64 TypeFlag = MilDataTypeFlag;                      \
+   static const MIL_INT64 BufferTypeFlag = MilBufferTypeFlag;              \
+   }
+
+#define RUN_BUFINQUIRE_RETURNIFFAIL(MacroBufId, MacroInquireType, MacroUserVarptr)   \
+   MbufInquire(MacroBufId, MacroInquireType, MacroUserVarptr);                       \
+   if(*MacroUserVarptr == 0) {                                                        \
+      return;                                                                        \
+      }                                                                              
+
+DECLARE_MIL_TRAITS(MIL_INT8  , M_TYPE_CHAR      , M_SIGNED   + 8 );
+DECLARE_MIL_TRAITS(MIL_UINT8 , M_TYPE_MIL_UINT8 , M_UNSIGNED + 8 );
+DECLARE_MIL_TRAITS(MIL_UINT16, M_DEFAULT        , M_UNSIGNED + 16);
+DECLARE_MIL_TRAITS(MIL_UINT32, M_DEFAULT        , M_UNSIGNED + 32);
+DECLARE_MIL_TRAITS(MIL_INT16 , M_TYPE_MIL_INT16 , M_SIGNED   + 16);
+DECLARE_MIL_TRAITS(MIL_INT32 , M_TYPE_MIL_INT32 , M_SIGNED   + 32);
+DECLARE_MIL_TRAITS(MIL_INT64 , M_TYPE_MIL_INT64 , M_SIGNED   + 64);
+DECLARE_MIL_TRAITS(MIL_FLOAT , M_TYPE_MIL_FLOAT , M_FLOAT    + 32);
+DECLARE_MIL_TRAITS(MIL_DOUBLE, M_TYPE_MIL_DOUBLE, M_FLOAT    + 64);
+DECLARE_MIL_TRAITS(MIL_UUID  , M_TYPE_MIL_UUID  , M_INVALID      );
+
+// Class used as any array parameter in C++ overloads of any functions that takes std::vector.
+class CMilArrayParamOut
+   {
+   public:
+      inline CMilArrayParamOut(int Value): m_pParamVector(M_NULL), m_ParamValue(Value), m_MilDataType(M_NULL) {}
+#if M_MIL_USE_NULLPTR
+      inline CMilArrayParamOut(std::nullptr_t) : m_pParamVector(M_NULL), m_ParamValue(M_NULL), m_MilDataType(M_NULL) {}
+#endif
+      inline CMilArrayParamOut(std::vector<MIL_INT8  >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT8  >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_UINT8 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT8 >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_UINT16>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT16>::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_UINT32>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT32>::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_INT16 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT16 >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_INT32 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT32 >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_INT64 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT64 >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_FLOAT >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_FLOAT >::TypeFlag) {}
+      inline CMilArrayParamOut(std::vector<MIL_DOUBLE>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_DOUBLE>::TypeFlag) {}
+
+      template <typename UserType>
+      inline void Resize(const MIL_INT& Size) { if(m_pParamVector) { (reinterpret_cast<std::vector<UserType>*>(m_pParamVector))->resize(Size); } }
+
+      template <typename UserType>
+      inline UserType* GetData() { return m_pParamVector ? &(*reinterpret_cast<std::vector<UserType>*>(m_pParamVector))[0] : M_NULL; }
+
+      inline bool IsValidParam() { return m_pParamVector ? true : m_ParamValue ? false : true; }
+
+      // For debug purpose.
+      inline bool IsNullPtr() { return m_pParamVector ? false : true; }
+
+      inline MIL_INT64 GetMilDataType() { return m_MilDataType; }
+
+   private:
+      void* m_pParamVector;
+      int m_ParamValue;
+      MIL_INT64 m_MilDataType;
+   };
+
+class CMilArrayParamIn
+   {
+   public:
+      inline CMilArrayParamIn(int Value): m_pParamVector(M_NULL), m_ParamValue(Value), m_MilDataType(M_NULL) {}
+#if M_MIL_USE_NULLPTR
+      inline CMilArrayParamIn(std::nullptr_t) : m_pParamVector(M_NULL), m_ParamValue(M_NULL), m_MilDataType(M_NULL) {}
+#endif
+      inline CMilArrayParamIn(const std::vector<MIL_INT8  >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT8  >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_UINT8 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT8 >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_UINT16>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_UINT16>::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_INT16 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT16 >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_INT32 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT32 >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_INT64 >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_INT64 >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_FLOAT >& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_FLOAT >::TypeFlag) {}
+      inline CMilArrayParamIn(const std::vector<MIL_DOUBLE>& Vec) : m_pParamVector(&Vec), m_ParamValue(M_NULL), m_MilDataType(MilTraits<MIL_DOUBLE>::TypeFlag) {}
+
+      template <typename UserType>
+      inline MIL_INT Size() { return m_pParamVector ? (MIL_INT)((reinterpret_cast<const std::vector<UserType>*>(m_pParamVector))->size()) : 0; }
+
+      template <typename UserType>
+      inline const UserType* GetData() { return m_pParamVector ? &(*reinterpret_cast<const std::vector<UserType>*>(m_pParamVector))[0] : M_NULL; }
+
+      inline bool IsValidParam() { return m_pParamVector ? true : m_ParamValue ? false : true; }
+
+      // For debug purpose.
+      inline bool IsNullPtr() { return m_pParamVector ? false : true; }
+
+      inline MIL_INT64 GetMilDataType() { return m_MilDataType; }
+
+      template <typename UserType>
+      inline bool IsEmpty() { return m_pParamVector ? (reinterpret_cast<const std::vector<UserType>*>(m_pParamVector))->empty() : false; }
+
+   private:
+      const void* m_pParamVector;
+      int m_ParamValue;
+      MIL_INT64 m_MilDataType;
+   };
+
+#define M_INQUIRE_SIZE_BYTE      2L // Used in the MxxxStreamForStdVector function defined in milproto.h
+
+/***************************************************************************/
+/* MxxxStream function PROTOTYPE                                           */
+/***************************************************************************/
+typedef void(MFTYPE* M_XXX_STREAM_FUNCTION)(MilStreamParam MemPtrOrFileName,
+                                            MIL_ID         SysId,
+                                            MIL_INT64      Operation,
+                                            MIL_INT64      StreamType,
+                                            MIL_DOUBLE     Version,
+                                            MIL_INT64      ControlFlag,
+                                            MIL_ID*        MxxxIdPtr,
+                                            MIL_INT*       SizeByteVarPtr);
+// ----------------------------------------------------------
+// Overloads for std::vector in MxxxStream.
+inline void MFTYPE MxxxStreamForStdVector(std::vector<MIL_UINT8> &MemPtrOrFileName,
+                                          MIL_ID                 SysId,
+                                          MIL_INT64              Operation,
+                                          MIL_INT64              StreamType,
+                                          MIL_DOUBLE             Version,
+                                          MIL_INT64              ControlFlag,
+                                          MIL_ID*                MxxxIdPtr,
+                                          MIL_INT*               SizeByteVarPtr,
+                                          M_XXX_STREAM_FUNCTION  MxxxStream)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(StreamType != M_MEMORY)
+      {
+      SafeTypeError(MIL_TEXT("MxxxStream"), MIL_TEXT("StreamType parameter must be set to M_MEMORY with the std::vector overloads."));
+      }
+#endif
+
+   switch(Operation)
+      {
+      case M_LOAD:
+      case M_RESTORE:
+      {
+#if M_MIL_USE_SAFE_TYPE
+      if(MemPtrOrFileName.empty())
+         {
+         SafeTypeError(MIL_TEXT("MxxxStream"), MIL_TEXT("The Mem vector cannot be empty with M_LOAD or M_RESTORE operation."));
+         }
+#endif
+      (*MxxxStream)(&MemPtrOrFileName[0],
+                    SysId,
+                    Operation,
+                    StreamType,
+                    Version,
+                    ControlFlag,
+                    MxxxIdPtr,
+                    SizeByteVarPtr);
+      }
+      break;
+      case M_SAVE:
+      {
+      MIL_INT NumberOfBytes = -1;
+      (*MxxxStream)(M_NULL, M_NULL, M_INQUIRE_SIZE_BYTE, StreamType, Version, ControlFlag, MxxxIdPtr, &NumberOfBytes);
+
+      if(NumberOfBytes > 0)
+         {
+         MemPtrOrFileName.resize(NumberOfBytes);
+
+         (*MxxxStream)(&MemPtrOrFileName[0],
+                       SysId,
+                       Operation,
+                       StreamType,
+                       Version,
+                       ControlFlag,
+                       MxxxIdPtr,
+                       SizeByteVarPtr);
+         }
+      }
+      break;
+      default:
+#if M_MIL_USE_SAFE_TYPE
+      {
+      SafeTypeError(MIL_TEXT("MxxxStream"), MIL_TEXT("Invalid Operation with the std::vector overloads."));
+      }
+#endif
+      break;
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MgraCopy.
+inline void MFTYPE MgraCopy(MIL_ID                     SrcListGraId,
+                            MIL_ID                     DstListGraId,
+                            MIL_INT64                  Operation,
+                            MIL_INT                    InsertLocation,
+                            MIL_INT                    NumGraphics,
+                            CMilArrayParamIn           SrcIndexOrLabelArrayPtr,
+                            CMilArrayParamOut          DstLabelArrayPtr,
+                            MIL_INT64                  ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumGraphics <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("NumGraphics parameter must be greater than zero."));
+      }
+   if(!DstLabelArrayPtr.IsValidParam() || !SrcIndexOrLabelArrayPtr.IsValidParam())
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("SrcIndexOrLabelArrayPtr or DstLabelArrayPtr cannot be an non zero integer."));
+      }
+   if(SrcIndexOrLabelArrayPtr.IsEmpty<MIL_INT>())
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("The input vector cannot be empty."));
+      }
+   if(!SrcIndexOrLabelArrayPtr.IsNullPtr() && SrcIndexOrLabelArrayPtr.GetMilDataType() != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("The data type of SrcIndexOrLabelArrayPtr must be MIL_INT."));
+      }
+   if(!DstLabelArrayPtr.IsNullPtr() && DstLabelArrayPtr.GetMilDataType() != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("The data type of DstLabelArrayPtr must be MIL_INT."));
+      }
+   if(!SrcIndexOrLabelArrayPtr.IsNullPtr() && NumGraphics > (MIL_INT)SrcIndexOrLabelArrayPtr.Size<MIL_INT>() && NumGraphics != M_DEFAULT && NumGraphics != M_ALL)
+      {
+      SafeTypeError(MIL_TEXT("MgraCopy"), MIL_TEXT("NumGraphics parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(!SrcIndexOrLabelArrayPtr.IsNullPtr() && NumGraphics != M_ALL && (NumGraphics == M_DEFAULT || NumGraphics > (MIL_INT)SrcIndexOrLabelArrayPtr.Size<MIL_INT>()))
+      {
+      NumGraphics = (MIL_INT)SrcIndexOrLabelArrayPtr.Size<MIL_INT>();
+      }
+
+   if(NumGraphics == M_ALL)
+      {
+      MIL_INT InternalNumGraphicsForStdVector = 0;
+
+      MgraInquireList(SrcListGraId, M_LIST, M_DEFAULT, M_NUMBER_OF_GRAPHICS + M_TYPE_MIL_INT, &InternalNumGraphicsForStdVector);
+
+      DstLabelArrayPtr.Resize<MIL_INT>(InternalNumGraphicsForStdVector);
+
+      if(InternalNumGraphicsForStdVector <= 0)
+         {
+         return;
+         }
+      }
+   else
+      {
+      DstLabelArrayPtr.Resize<MIL_INT>(NumGraphics);
+      }
+
+   MgraCopy(SrcListGraId,
+            DstListGraId,
+            Operation,
+            InsertLocation,
+            NumGraphics,
+            SrcIndexOrLabelArrayPtr.GetData<MIL_INT>(),
+            DstLabelArrayPtr.GetData<MIL_INT>(),
+            ControlFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MgraDots.
+template <typename UserType>
+inline void MgraDots(MIL_ID                      ContextGraId,
+                     MIL_ID                      DstImageBufOrListGraId,
+                     MIL_INT                     NumberOfDots,
+                     const std::vector<UserType> &PosXArrayPtr,
+                     const std::vector<UserType> &PosYArrayPtr,
+                     MIL_INT64                   ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumberOfDots <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MgraDots"), MIL_TEXT("NumberOfDots parameter must be greater than zero."));
+      }
+   if(PosXArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MgraDots"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(PosXArrayPtr.size() != PosYArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MgraDots"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumberOfDots > (MIL_INT)PosXArrayPtr.size() && NumberOfDots != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MgraDots"), MIL_TEXT("NumberOfDots parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumberOfDots == M_DEFAULT || NumberOfDots > (MIL_INT)PosXArrayPtr.size())
+      {
+      NumberOfDots = (MIL_INT)PosXArrayPtr.size();
+      }
+
+   MgraDots(ContextGraId,
+            DstImageBufOrListGraId,
+            NumberOfDots,
+            &PosXArrayPtr[0],
+            &PosYArrayPtr[0],
+            ControlFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MgraLines.
+template <typename UserType>
+inline void MgraLines(MIL_ID                      ContextGraId,
+                      MIL_ID                      DstImageBufOrListGraId,
+                      MIL_INT                     NumberOfLinesOrVertices,
+                      const std::vector<UserType> &XPtr,
+                      const std::vector<UserType> &YPtr,
+                      CMilArrayParamIn            X2Ptr,
+                      CMilArrayParamIn            Y2Ptr,
+                      MIL_INT64                   ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(!X2Ptr.IsValidParam() || !Y2Ptr.IsValidParam())
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("X2Ptr or Y2Ptr cannot be an non zero integer!"));
+      }
+   if(XPtr.size() != YPtr.size() ||
+      ((MIL_INT)XPtr.size() != X2Ptr.Size<UserType>() && !X2Ptr.IsNullPtr()) ||
+      ((MIL_INT)XPtr.size() != Y2Ptr.Size<UserType>() && !Y2Ptr.IsNullPtr()) ||
+      ((MIL_INT)YPtr.size() != X2Ptr.Size<UserType>() && !X2Ptr.IsNullPtr()) ||
+      ((MIL_INT)YPtr.size() != Y2Ptr.Size<UserType>() && !Y2Ptr.IsNullPtr()) ||
+      (X2Ptr.Size<UserType>() != Y2Ptr.Size<UserType>() && !X2Ptr.IsNullPtr() && !Y2Ptr.IsNullPtr()))
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("The input vectors must have the same size!"));
+      }
+   if(XPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(NumberOfLinesOrVertices <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("NumberOfLinesOrVertices parameter must be greater than zero."));
+      }
+   if((!X2Ptr.IsNullPtr() && X2Ptr.GetMilDataType() != MilTraits<UserType>::TypeFlag) ||
+      (!Y2Ptr.IsNullPtr() && Y2Ptr.GetMilDataType() != MilTraits<UserType>::TypeFlag))
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("The data type of X2Ptr or Y2Ptr must be the same as XPtr or YPtr."));
+      }
+   if(NumberOfLinesOrVertices > (MIL_INT)XPtr.size() && NumberOfLinesOrVertices != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MgraLines"), MIL_TEXT("NumberOfLinesOrVertices parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumberOfLinesOrVertices == M_DEFAULT || NumberOfLinesOrVertices > (MIL_INT)XPtr.size())
+      {
+      NumberOfLinesOrVertices = (MIL_INT)XPtr.size();
+      }
+
+   MgraLines(ContextGraId,
+             DstImageBufOrListGraId,
+             NumberOfLinesOrVertices,
+             &XPtr[0],
+             &YPtr[0],
+             X2Ptr.GetData<UserType>(),
+             Y2Ptr.GetData<UserType>(),
+             ControlFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MgraVectors.
+template <typename UserType>
+inline void MFTYPE MgraVectors(MIL_ID                       ContextGraId,
+                               MIL_ID                       DstImageBufOrListGraId,
+                               MIL_INT                      NumVectors,
+                               const std::vector<UserType>& XArrayPtr,
+                               const std::vector<UserType>& YArrayPtr,
+                               const std::vector<UserType>& UArrayPtr,
+                               const std::vector<UserType>& VArrayPtr,
+                               MIL_INT64                    ScaleMode,
+                               MIL_DOUBLE                   ScaleValue,
+                               MIL_INT64                    ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumVectors <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MgraVectors"), MIL_TEXT("NumVectors parameter must be greater than zero."));
+      }
+   if(XArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MgraVectors"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(XArrayPtr.size() != YArrayPtr.size() ||
+      XArrayPtr.size() != UArrayPtr.size() ||
+      XArrayPtr.size() != VArrayPtr.size() ||
+      YArrayPtr.size() != UArrayPtr.size() ||
+      YArrayPtr.size() != VArrayPtr.size() ||
+      UArrayPtr.size() != VArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MgraVectors"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumVectors > (MIL_INT)XArrayPtr.size() && NumVectors != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MgraVectors"), MIL_TEXT("NumVectors parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumVectors == M_DEFAULT || NumVectors > (MIL_INT)XArrayPtr.size())
+      {
+      NumVectors = (MIL_INT)XArrayPtr.size();
+      }
+
+   MgraVectors(ContextGraId,
+               DstImageBufOrListGraId,
+               NumVectors,
+               &XArrayPtr[0],
+               &YArrayPtr[0],
+               &UArrayPtr[0],
+               &VArrayPtr[0],
+               ScaleMode,
+               ScaleValue,
+               ControlFlag);
+   }
+
+#if !M_MIL_USE_LINUX || M_COMPILING_MILDLL
+// ----------------------------------------------------------
+// Overloads for std::vector in MseqDefine.
+inline void MFTYPE MseqDefine(MIL_ID                     ContextSeqId,
+                              MIL_INT                    SequenceIndex,
+                              MIL_INT64                  SequenceType,
+                              const std::vector<MIL_ID>& Param1Ptr,
+                              MIL_DOUBLE                 Param2)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(Param2 <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MseqDefine"), MIL_TEXT("Param2 parameter must be greater than zero."));
+      }
+   if(Param1Ptr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MseqDefine"), MIL_TEXT("The input vector cannot be empty."));
+      }
+   if(SequenceType != M_BUFFER_LIST)
+      {
+      SafeTypeError(MIL_TEXT("MseqDefine"), MIL_TEXT("Invalid SequenceType with the std::vector overload."));
+      }
+   if(Param2 > (MIL_INT)Param1Ptr.size() && Param2 != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MseqDefine"), MIL_TEXT("Param2 parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(Param2 == M_DEFAULT || Param2 > (MIL_INT)Param1Ptr.size())
+      {
+      Param2 = (MIL_DOUBLE)Param1Ptr.size();
+      }
+
+   MseqDefine(ContextSeqId,
+              SequenceIndex,
+              SequenceType,
+              &Param1Ptr[0],
+              Param2);
+   }
+#endif // !M_MIL_USE_LINUX || M_COMPILING_MILDLL
+
+//Overload for MbufGet to support vector inquire type
+template <typename UserType>
+inline void MFTYPE  MbufGet(MIL_ID SrcBufId, std::vector<UserType> &UserArrayPtr)
+   {
+   MIL_INT InternalBufSizeX = 0;
+   MIL_INT InternalBufSizeY = 0; 
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_X, &InternalBufSizeX);
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_Y, &InternalBufSizeY);
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = (InternalBufSizeX*InternalBufSizeY);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that SizeByteRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   if(InternalNbElementRequired > 0)
+      {
+      MbufGet(SrcBufId, &UserArrayPtr[0]);
+      }
+   }
+
+//Overload for MbufImportSequence to support vector
+inline void MFTYPE  MbufImportSequence(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, std::vector<MIL_ID> &BufArrayPtr, MIL_INT StartImage, MIL_INT NumberOfImages, MIL_INT64 ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumberOfImages <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MbufImportSequence"), MIL_TEXT("NumberOfImages must be greater than zero."));
+      }
+   if(NumberOfImages > (MIL_INT64)BufArrayPtr.size() && NumberOfImages != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufImportSequence"), MIL_TEXT("NumberOfImages parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(NumberOfImages == M_DEFAULT || NumberOfImages > (MIL_INT64)BufArrayPtr.size())
+      {
+      NumberOfImages = (MIL_INT64)BufArrayPtr.size();
+      }
+
+   BufArrayPtr.resize(NumberOfImages);
+
+   if(NumberOfImages > 0)
+      {
+      MbufImportSequence(FileName, FileFormat, Operation, SystemId, &BufArrayPtr[0], StartImage, NumberOfImages, ControlFlag);
+      }
+   }
+
+//MIL_STRING and vector Overload for MbufImportSequence to support vector 
+#if M_MIL_USE_STRING
+inline void MFTYPE  MbufImportSequence(const MIL_STRING &FileName, MIL_INT64 FileFormat, MIL_INT64 Operation, MIL_ID SystemId, std::vector<MIL_ID> &BufArrayPtr, MIL_INT StartImage, MIL_INT NumberOfImages, MIL_INT64 ControlFlag)
+   {
+   MbufImportSequence(FileName.c_str(), FileFormat, Operation, SystemId, BufArrayPtr, StartImage, NumberOfImages, ControlFlag);
+   }
+#endif
+
+//Overload for MbufExportSequence to support vector 
+inline void MFTYPE  MbufExportSequence(MIL_CONST_TEXT_PTR FileName, MIL_INT64 FileFormat, const std::vector<MIL_ID> &BufArrayPtrOrSystemIdPtr, MIL_INT NumOfIds, MIL_DOUBLE FrameRate, MIL_INT64 ControlFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(NumOfIds <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MbufExportSequence"), MIL_TEXT("NumOfIds must be greater than zero."));
+      }
+   if(NumOfIds > (MIL_INT64)BufArrayPtrOrSystemIdPtr.size() && NumOfIds != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufExportSequence"), MIL_TEXT("NumOfIds parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(NumOfIds == M_DEFAULT || NumOfIds > (MIL_INT64)BufArrayPtrOrSystemIdPtr.size())
+      {
+      NumOfIds = (MIL_INT64)BufArrayPtrOrSystemIdPtr.size();
+      }
+
+   if(NumOfIds > 0)
+      {
+      MbufExportSequence(FileName, FileFormat, &BufArrayPtrOrSystemIdPtr[0], NumOfIds, FrameRate, ControlFlag);
+      }
+   }
+
+//MIL_STRING and vector Overload for MbufExportSequence to support vector 
+#if M_MIL_USE_STRING
+inline void MFTYPE  MbufExportSequence(const MIL_STRING &FileName, MIL_INT64 FileFormat, const std::vector<MIL_ID> &BufArrayPtrOrSystemIdPtr, MIL_INT NumOfIds, MIL_DOUBLE FrameRate, MIL_INT64 ControlFlag)
+   {
+   MbufExportSequence(FileName.c_str(), FileFormat, BufArrayPtrOrSystemIdPtr, NumOfIds, FrameRate, ControlFlag);
+   }
+#endif
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGet1d.
+template <typename UserType>
+inline void MFTYPE  MbufGet1d(MIL_ID SrcBufId, MIL_INT OffX, MIL_INT SizeX, std::vector<UserType> &UserArrayPtr)
+   {
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = SizeX;
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet1d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet1d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that SizeByteRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   // In case if SizeX = 0, call the original function which will pop an MIL error.
+   if(InternalNbElementRequired > 0 || SizeX == 0)
+      {
+      MbufGet1d(SrcBufId, OffX, SizeX, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGet2d.
+template <typename UserType>
+inline void MFTYPE  MbufGet2d(MIL_ID SrcBufId, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, std::vector<UserType> &UserArrayPtr)
+   {
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = (SizeX*SizeY);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet2d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGet2d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   // In case if SizeX or SizeY = 0, call the original function which will pop an MIL error.
+   if(InternalNbElementRequired > 0 || SizeX == 0 || SizeY == 0)
+      {
+      MbufGet2d(SrcBufId, OffX, OffY, SizeX, SizeY, &UserArrayPtr[0]);
+      }
+   }
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetArc.
+template <typename UserType>
+inline MIL_INT MFTYPE MbufGetArc(MIL_ID ImageBufId,
+                                 MIL_INT XCenter,
+                                 MIL_INT YCenter,
+                                 MIL_INT XRad,
+                                 MIL_INT YRad,
+                                 MIL_DOUBLE StartAngle,
+                                 MIL_DOUBLE EndAngle,
+                                 MIL_INT64 Mode,
+                                 MIL_INT *NbPixelsPtr,
+                                 std::vector<UserType> &ValueArrayPtr,
+                                 CMilArrayParamOut     PosXArrayPtr,
+                                 CMilArrayParamOut     PosYArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(!PosXArrayPtr.IsValidParam() || !PosYArrayPtr.IsValidParam())
+      {
+      SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("PosXArrayPtr and PosYArrayPtr cannot be an non zero integer."));
+      }
+   if(!PosXArrayPtr.IsNullPtr() && PosXArrayPtr.GetMilDataType() != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("The data type of PosXArrayPtr must be MIL_INT."));
+      }
+   if(!PosYArrayPtr.IsNullPtr() && PosYArrayPtr.GetMilDataType() != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("The data type of PosYArrayPtr must be MIL_INT."));
+      }
+#endif
+
+   MIL_INT InternalNbElementRequired = 0;
+   MbufGetArc(ImageBufId, XCenter, YCenter, XRad, YRad, StartAngle, EndAngle, Mode, &InternalNbElementRequired, M_NULL, M_NULL, M_NULL);
+
+   if(InternalNbElementRequired == 0)
+      {
+      return 0;
+      }
+
+   MIL_INT InternalBufferType = 0;
+   MbufInquire(ImageBufId, M_TYPE, &InternalBufferType);
+   
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetArc"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   ValueArrayPtr.resize(InternalNbElementRequired);
+   PosXArrayPtr.Resize<MIL_INT>(InternalNbElementRequired);
+   PosYArrayPtr.Resize<MIL_INT>(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   if(InternalNbElementRequired > 0)
+      {
+      MbufGetArc(ImageBufId,
+                 XCenter,
+                 YCenter,
+                 XRad,
+                 YRad,
+                 StartAngle,
+                 EndAngle,
+                 Mode,
+                 NbPixelsPtr,
+                 &ValueArrayPtr[0],
+                 PosXArrayPtr.GetData<MIL_INT>(),
+                 PosYArrayPtr.GetData<MIL_INT>());
+      }
+   
+   return InternalNbElementRequired;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetColor.
+template <typename UserType>
+inline void MFTYPE MbufGetColor(MIL_ID SrcBufId, MIL_INT64 DataFormat, MIL_INT Band, std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      case M_PACKED + M_BGR32:
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetColor"), MIL_TEXT("When the data format is M_PACKED, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+      break;
+      default:
+      break;
+      }
+#endif
+
+   MIL_INT InternalBufSizeX    = 0;
+   MIL_INT InternalBufSizeY    = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_X, &InternalBufSizeX);
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_Y, &InternalBufSizeY);
+   
+   MIL_INT InternalNbElementRequired = (InternalBufSizeX*InternalBufSizeY);
+
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      {
+      InternalNbElementRequired *= 2;
+      }
+      break;
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      {
+      InternalNbElementRequired *= 3;
+      }
+      break;
+      case M_PACKED + M_BGR32:
+      {
+      InternalNbElementRequired *= 4;
+      }
+      break;
+      default:
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+#if M_MIL_USE_SAFE_TYPE
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetColor"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetColor"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+#endif
+
+      MIL_INT InternalSizeBand = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+      InternalSizeBand = (Band == M_ALL_BANDS) ? InternalSizeBand : 1;
+
+      InternalNbElementRequired *= InternalSizeBand;
+      }
+      break;
+      }
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   if(InternalNbElementRequired > 0)
+      {
+      MbufGetColor(SrcBufId, DataFormat, Band, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetColor2d.
+template <typename UserType>
+inline void MFTYPE  MbufGetColor2d(MIL_ID SrcBufId, MIL_INT64 DataFormat, MIL_INT Band, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      case M_PACKED + M_BGR32:
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetColor2d"), MIL_TEXT("When the data format is M_PACKED, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+      break;
+      default:
+      break;
+      }
+#endif
+
+   MIL_INT InternalNbElementRequired = (SizeX*SizeY);
+
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      {
+      InternalNbElementRequired *= 2;
+      }
+      break;
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      {
+      InternalNbElementRequired *= 3;
+      }
+      break;
+      case M_PACKED + M_BGR32:
+      {
+      InternalNbElementRequired *= 4;
+      }
+      break;
+      default:
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+#if M_MIL_USE_SAFE_TYPE
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetColor2d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetColor2d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+#endif
+
+      MIL_INT InternalSizeBand = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+      InternalSizeBand = (Band == M_ALL_BANDS) ? InternalSizeBand : 1;
+
+      InternalNbElementRequired *= InternalSizeBand;
+      }
+      break;
+      }
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   // In case if SizeX or SizeY = 0, call the original function which will pop an MIL error.
+   if(InternalNbElementRequired > 0 || SizeX == 0 || SizeY == 0)
+      {
+      MbufGetColor2d(SrcBufId, DataFormat, Band, OffX, OffY, SizeX, SizeY, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetLine.
+template <typename UserType>
+inline void MFTYPE MbufGetLine(MIL_ID ImageBufId, MIL_INT StartX, MIL_INT StartY, MIL_INT EndX, MIL_INT EndY, MIL_INT64 Mode, MIL_INT *NbPixelsPtr, std::vector<UserType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(Mode != M_DEFAULT && MilTraits<UserType>::TypeFlag != MilTraits<MIL_INT>::TypeFlag)
+      {
+      SafeTypeError(MIL_TEXT("MbufGetLine"), MIL_TEXT("When Mode is not M_DEFAULT, the data type of UserArrayPtr must be MIL_INT."));
+      }
+#endif
+
+   MIL_INT InternalNbElementRequired = 0;
+   MbufGetLine(ImageBufId, StartX, StartY, EndX, EndY, Mode, &InternalNbElementRequired, NULL);
+
+   if(Mode == M_DEFAULT)
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(ImageBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+#if M_MIL_USE_SAFE_TYPE
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetLine"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufGetLine"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+#endif
+      }
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   if(InternalNbElementRequired > 0)
+      {
+      MbufGetLine(ImageBufId, StartX, StartY, EndX, EndY, Mode, NbPixelsPtr, &UserArrayPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufGetList.
+template<typename PosType, typename ValType>
+inline void MFTYPE MbufGetList(MIL_ID SrcBufId,
+                               MIL_INT NumPixels,
+                               const std::vector<PosType>& PixXArrayPtr,
+                               const std::vector<PosType>& PixYArrayPtr,
+                               MIL_INT64 InterpolationMode,
+                               std::vector<ValType> &UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(PixXArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(PixXArrayPtr.size() != PixYArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumPixels > (MIL_INT)PixXArrayPtr.size() && NumPixels != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("NumPixels parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumPixels == M_DEFAULT || NumPixels > (MIL_INT)PixXArrayPtr.size())
+      {
+      NumPixels = (MIL_INT)PixXArrayPtr.size();
+      }
+
+   MIL_INT InternalSizeBand = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = NumPixels;
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(SrcBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+#if M_MIL_USE_SAFE_TYPE
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<ValType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<ValType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufGetList"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+#endif
+
+   UserArrayPtr.resize(InternalNbElementRequired);
+
+   //ensure that InternalNbElementRequired > 0 to avoid crash in case one of the MbufInquire returns an invalid data.
+   // In case if NumPixels = 0, call the original function which will pop an MIL error.
+   if(InternalNbElementRequired > 0 || NumPixels == 0)
+      {
+      MbufGetList(SrcBufId, NumPixels, &PixXArrayPtr[0], &PixYArrayPtr[0], InterpolationMode, &UserArrayPtr[0]);   
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPut.
+template<typename UserType>
+inline void MFTYPE MbufPut(MIL_ID DestBufId, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalBufSizeX = 0;
+   MIL_INT InternalBufSizeY = 0;
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_X, &InternalBufSizeX);
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_Y, &InternalBufSizeY);
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = (InternalBufSizeX*InternalBufSizeY);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPut"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPut(DestBufId, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPut1d.
+template<typename UserType>
+inline void MFTYPE MbufPut1d(MIL_ID DestBufId, MIL_INT OffX, MIL_INT SizeX, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalSizeBand = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = SizeX;
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut1d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut1d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPut1d"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPut1d(DestBufId, OffX, SizeX, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPut2d
+template<typename UserType>
+inline void MFTYPE MbufPut2d(MIL_ID DestBufId, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalSizeBand = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = (SizeX*SizeY);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut2d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPut2d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPut2d"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPut2d(DestBufId, OffX, OffY, SizeX, SizeY, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPutColor
+template<typename UserType>
+inline void MFTYPE MbufPutColor(MIL_ID DestBufId, MIL_INT64 DataFormat, MIL_INT Band, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      case M_PACKED + M_BGR32:
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutColor"), MIL_TEXT("When the data format is M_PACKED, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+      break;
+      default:
+      break;
+      }
+
+   MIL_INT InternalBufSizeX = 0;
+   MIL_INT InternalBufSizeY = 0;
+
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_X, &InternalBufSizeX);
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_Y, &InternalBufSizeY);
+
+   MIL_INT InternalNbElementRequired = (InternalBufSizeX*InternalBufSizeY);
+
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      {
+      InternalNbElementRequired *= 2;
+      }
+      break;
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      {
+      InternalNbElementRequired *= 3;
+      }
+      break;
+      case M_PACKED + M_BGR32:
+      {
+      InternalNbElementRequired *= 4;
+      }
+      break;
+      default:
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufPutColor"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufPutColor"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+
+      MIL_INT InternalSizeBand = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+      InternalSizeBand = (Band == M_ALL_BANDS) ? InternalSizeBand : 1;
+
+      InternalNbElementRequired *= InternalSizeBand;
+      }
+      break;
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutColor"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPutColor(DestBufId, DataFormat, Band, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPutColor2d
+template<typename UserType>
+inline void MFTYPE MbufPutColor2d(MIL_ID DestBufId, MIL_INT64 DataFormat, MIL_INT Band, MIL_INT OffX, MIL_INT OffY, MIL_INT SizeX, MIL_INT SizeY, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      case M_PACKED + M_BGR32:
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutColor2d"), MIL_TEXT("When the data format is M_PACKED, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+      break;
+      default:
+         break;
+      }
+
+   MIL_INT InternalNbElementRequired = (SizeX*SizeY);
+
+   switch(DataFormat)
+      {
+      case M_PACKED + M_RGB15:
+      case M_PACKED + M_RGB16:
+      {
+      InternalNbElementRequired *= 2;
+      }
+      break;
+      case M_PACKED + M_BGR24:
+      case M_PACKED + M_RGB24:
+      {
+      InternalNbElementRequired *= 3;
+      }
+      break;
+      case M_PACKED + M_BGR32:
+      {
+      InternalNbElementRequired *= 4;
+      }
+      break;
+      default:
+      {
+      MIL_INT InternalBufferType = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+      if(InternalBufferType == 1)
+         {
+         InternalNbElementRequired += 7;
+         InternalNbElementRequired /= 8;
+         }
+
+      if(InternalBufferType == 1)
+         {
+         bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+         if(InternalBufferTypeNotEqual)
+            {
+            SafeTypeError(MIL_TEXT("MbufPutColor2d"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+            }
+         }
+      else
+         {
+         if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+            {
+            SafeTypeError(MIL_TEXT("MbufPutColor2d"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+            }
+         }
+
+      MIL_INT InternalSizeBand = 0;
+      RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+      InternalSizeBand = (Band == M_ALL_BANDS) ? InternalSizeBand : 1;
+
+      InternalNbElementRequired *= InternalSizeBand;
+      }
+      break;
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutColor2d"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPutColor2d(DestBufId, DataFormat, Band, OffX, OffY, SizeX, SizeY, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector MbufPutLine
+template<typename UserType>
+inline void MFTYPE MbufPutLine(MIL_ID ImageBufId, MIL_INT StartX, MIL_INT StartY, MIL_INT EndX, MIL_INT EndY, MIL_INT64 Mode, MIL_INT *NbPixelsPtr, const std::vector<UserType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalNbElementRequired = 0;
+   MbufPutLine(ImageBufId, StartX, StartY, EndX, EndY, Mode, &InternalNbElementRequired, NULL);
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(ImageBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<UserType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutLine"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<UserType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutLine"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutLine"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPutLine(ImageBufId, StartX, StartY, EndX, EndY, Mode, NbPixelsPtr, &UserArrayPtr[0]);
+   }
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufPutList.
+template<typename PosType, typename ValType>
+inline void MFTYPE MbufPutList(MIL_ID                      DestBufId,
+                               MIL_INT                     NumPixels,
+                               const std::vector<PosType>& PixXArrayPtr,
+                               const std::vector<PosType>& PixYArrayPtr,
+                               MIL_INT64                   OverscanMode,
+                               const std::vector<ValType>& UserArrayPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(PixXArrayPtr.empty())
+      {
+      SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("The input vectors cannot be empty."));
+      }
+   if(PixXArrayPtr.size() != PixYArrayPtr.size())
+      {
+      SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("The input vectors must have the same size."));
+      }
+   if(NumPixels > (MIL_INT)PixXArrayPtr.size() && NumPixels != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("NumPixels parameter must be smaller or equal (M_DEFAULT) to the size of input vectors."));
+      }
+#endif
+
+   if(NumPixels == M_DEFAULT || NumPixels > (MIL_INT)PixXArrayPtr.size())
+      {
+      NumPixels = (MIL_INT)PixXArrayPtr.size();
+      }
+
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT InternalSizeBand = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_SIZE_BAND, &InternalSizeBand);
+
+   MIL_INT InternalNbElementRequired = NumPixels;
+
+   MIL_INT InternalBufferType = 0;
+   RUN_BUFINQUIRE_RETURNIFFAIL(DestBufId, M_TYPE, &InternalBufferType);
+
+   if(InternalBufferType == 1)
+      {
+      InternalNbElementRequired += 7;
+      InternalNbElementRequired /= 8;
+      }
+
+   InternalNbElementRequired *= InternalSizeBand;
+
+   if(InternalBufferType == 1)
+      {
+      bool InternalBufferTypeNotEqual = MilTraits<ValType>::BufferTypeFlag != MilTraits<MIL_UINT8>::BufferTypeFlag;
+      if(InternalBufferTypeNotEqual)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("When the buffer type of the image is 1, the data type of UserArrayPtr must be MIL_UINT8."));
+         }
+      }
+   else
+      {
+      if(InternalBufferType != MilTraits<ValType>::BufferTypeFlag)
+         {
+         SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("Vector data type does not match the buffer data type. Please try again with the right data type."));
+         }
+      }
+
+   if((MIL_INT)UserArrayPtr.size() < InternalNbElementRequired)
+      {
+      SafeTypeError(MIL_TEXT("MbufPutList"), MIL_TEXT("Vector size is not big enough for the required size."));
+      }
+#endif
+
+   MbufPutList(DestBufId, NumPixels, &PixXArrayPtr[0], &PixYArrayPtr[0], OverscanMode, &UserArrayPtr[0]);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MobjMessageWrite.
+inline void MFTYPE MobjMessageWrite(MIL_ID MessageId, const std::vector<MIL_UINT8>& MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64 OperationFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(MessageSize <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MobjMessageWrite"), MIL_TEXT("MessageSize must be greater than zero."));
+      }
+   if(MessageSize > (MIL_INT64)MessagePtr.size() && MessageSize != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MobjMessageWrite"), MIL_TEXT("MessageSize parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(MessageSize == M_DEFAULT || MessageSize > (MIL_INT64)MessagePtr.size())
+      {
+      MessageSize = (MIL_INT64)MessagePtr.size();
+      }
+
+   MobjMessageWrite(MessageId, &MessagePtr[0], MessageSize, MessageTag, OperationFlag);
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MobjMessageRead.
+inline MIL_INT64 MFTYPE MobjMessageRead(MIL_ID MessageId, std::vector<MIL_UINT8> &MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 *MessageOutSizePtr, MIL_INT64 *MessageTagPtr, MIL_INT64 *StatusPtr, MIL_INT64  OperationFlag)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(MessageInSize <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MobjMessageRead"), MIL_TEXT("MessageInSize must be greater than zero."));
+      }
+#endif
+
+   if(MessageInSize == M_DEFAULT)
+      {
+      MessageInSize = 0;
+      MessageInSize = MobjMessageRead(MessageId, M_NULL, M_NULL, M_NULL, M_NULL, StatusPtr, OperationFlag);
+      }
+
+   MessagePtr.resize((MIL_INT)MessageInSize);
+
+   if(MessageInSize > 0)
+      {
+      MIL_INT64 InternalNeededSizeForStdVector = MobjMessageRead(MessageId, &MessagePtr[0], MessageInSize, MessageOutSizePtr, MessageTagPtr, StatusPtr, OperationFlag);
+
+      if(InternalNeededSizeForStdVector < MessageInSize)
+         {
+         MessagePtr.resize((MIL_INT)InternalNeededSizeForStdVector);
+         }
+      return InternalNeededSizeForStdVector;
+      }
+   return 0;
+   }
+//Overloads for std::overload MthrWaitMultiple
+inline MIL_INT MthrWaitMultiple(const std::vector<MIL_ID> &EventArrayIdPtr, MIL_INT EventArraySize, MIL_INT64 WaitOption, MIL_INT *StatePtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(EventArraySize == M_DEFAULT || EventArraySize > (MIL_INT64)EventArrayIdPtr.size())
+      {
+      EventArraySize = (MIL_INT64)EventArrayIdPtr.size();
+      }
+
+   RetVal = MthrWaitMultiple(&EventArrayIdPtr[0], EventArraySize, WaitOption, StatePtr);
+
+   return RetVal;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MthrInquireMp.
+inline MIL_INT MFTYPE MthrInquireMp(MIL_ID ThrId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::vector<MIL_UINT64> &ResultPtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(InquireType == M_CORE_AFFINITY_MASK)
+      {
+      MIL_INT MaskArraySz = MthrInquireMp(ThrId, M_CORE_AFFINITY_MASK_ARRAY_SIZE, M_DEFAULT, M_DEFAULT, M_NULL);
+      ResultPtr.resize(MaskArraySz);
+      RetVal = MthrInquireMp(ThrId, InquireType, TypeFlag, TypeValue, &ResultPtr[0]);
+      }
+   else
+      {
+      ResultPtr.resize(1);
+      RetVal = MthrInquireMp(ThrId, InquireType, TypeFlag, TypeValue, &ResultPtr[0]);
+      }
+   return RetVal;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MthrControlMp.
+inline void MFTYPE MthrControlMp(MIL_ID ThrId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, const std::vector<MIL_UINT64> &ValuePtr)
+   {
+   if(ControlType == M_CORE_AFFINITY_MASK)
+      {
+      MIL_INT AffinityMaskSz = MthrInquireMp(ThrId, M_CORE_AFFINITY_MASK_ARRAY_SIZE, M_DEFAULT, M_DEFAULT, M_NULL);
+      if(AffinityMaskSz > (MIL_INT)ValuePtr.size())
+         {
+#if M_MIL_USE_SAFE_TYPE
+         SafeTypeError(MIL_TEXT("MthrControlMp"), MIL_TEXT("ValuePtr size has to be bigger than the M_CORE_AFFINITY_MASK_ARRAY_SIZE."));
+#endif
+         }
+      else
+         {
+         MthrControlMp(ThrId, ControlType, TypeFlag, TypeValue, (MIL_UINT64*)&ValuePtr[0]);
+         }
+      }
+   else
+      {
+      MthrControlMp(ThrId, ControlType, TypeFlag, TypeValue, (MIL_UINT64*)&ValuePtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MappControlMp.
+inline void MFTYPE MappControlMp(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, const std::vector<MIL_UINT64> &ValuePtr)
+   {
+   if(ControlType == M_CORE_AFFINITY_MASK)
+      {
+      MIL_INT AffinityMaskSz = MappInquireMp(ContextAppId, M_CORE_AFFINITY_MASK_ARRAY_SIZE, M_DEFAULT, M_DEFAULT, M_NULL);
+      if(AffinityMaskSz > (MIL_INT)ValuePtr.size())
+         {
+#if M_MIL_USE_SAFE_TYPE
+         SafeTypeError(MIL_TEXT("MappControlMp"), MIL_TEXT("ValuePtr size has to be bigger than the M_CORE_AFFINITY_MASK_ARRAY_SIZE."));
+#endif
+         }
+      else
+         {
+         MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, (MIL_UINT64*)&ValuePtr[0]);
+         }
+      }
+   else
+      {
+      MappControlMp(ContextAppId, ControlType, TypeFlag, TypeValue, (MIL_UINT64*)&ValuePtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MappInquireConnection.
+inline MIL_INT MFTYPE MappInquireConnection(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, std::vector<MIL_ID> &UserVarPtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(InquireType == M_DMIL_PUBLISHED_LIST)
+      {
+      MIL_INT PublishListSz = MappInquireConnection(ContextAppId, M_DMIL_PUBLISHED_LIST_SIZE, ControlFlag, ExtraFlag, M_NULL);
+      UserVarPtr.resize(PublishListSz);
+      if(PublishListSz > 0)
+         {
+         RetVal = MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, &UserVarPtr[0]);
+         }
+      }
+   else
+      {
+      UserVarPtr.resize(1);
+      RetVal = MappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, &UserVarPtr[0]);
+      }
+   return RetVal;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MappInquireMp.
+inline MIL_INT MFTYPE MappInquireMp(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 TypeFlag, MIL_INT64 TypeValue, std::vector<MIL_UINT64> &UserVarPtr)
+   {
+   MIL_INT RetVal = 0;
+   if((InquireType == M_CORE_AFFINITY_MASK) || (InquireType == M_CORE_AFFINITY_MASK_PROCESS) || (InquireType == M_MEMORY_BANK_AFFINITY_MASK) || (InquireType == M_MEMORY_BANK_CORE_AFFINITY_MASK))
+      {
+      MIL_INT64 MaskSizeInquireType = 0;
+      if((InquireType == M_CORE_AFFINITY_MASK) || (InquireType == M_CORE_AFFINITY_MASK_PROCESS))
+         {
+         MaskSizeInquireType = M_CORE_AFFINITY_MASK_ARRAY_SIZE;
+         }
+      else
+         {
+         MaskSizeInquireType = M_MEMORY_BANK_AFFINITY_MASK_ARRAY_SIZE;
+         }
+      MIL_INT AffinityMaskArraySize = MappInquireMp(ContextAppId, MaskSizeInquireType, TypeFlag, TypeValue, M_NULL);
+      if(AffinityMaskArraySize > 0)
+         {
+         UserVarPtr.resize(AffinityMaskArraySize);
+         RetVal = MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, &UserVarPtr[0]);
+         }
+      }
+   else
+      {
+      UserVarPtr.resize(1);
+      RetVal = MappInquireMp(ContextAppId, InquireType, TypeFlag, TypeValue, &UserVarPtr[0]);
+      }
+   return RetVal;
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MsysInquireFeature.
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_STRING> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DISPLAY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_TOOLTIP ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DESCRIPTION)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MsysInquireFeature(SysId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_STRING> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_STRING>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MsysInquireFeature(SysId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_NAME)
+      {
+      MsysInquireFeature(SysId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_FEATURE_SELECTOR_NAME)
+      {
+      MsysInquireFeature(SysId, M_FEATURE_SELECTOR_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MsysInquireFeature(SysId, InquireType + i, FeatureName, M_TYPE_STRING, UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_INT64> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_VALUE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_ACCESS_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_VISIBILITY ||
+       InquireType == M_FEATURE_ENUM_ENTRY_CACHING_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_STREAMABLE)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MsysInquireFeature(SysId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("InquireType type not compatible with std::vector<MIL_INT64> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_INT64>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MsysInquireFeature(SysId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_TYPE)
+      {
+      MsysInquireFeature(SysId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MsysInquireFeature(SysId, InquireType + i, FeatureName.c_str(), M_TYPE_INT64, &UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MsysInquireFeature(MIL_ID SysId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MsysInquireFeature(SysId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MsysInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   MIL_INT Size = 0;
+   if (InquireType == M_FEATURE_VALUE)
+      {
+      MsysInquireFeature(SysId, M_FEATURE_SIZE, FeatureName.c_str(), M_TYPE_INT64, &Size);
+      UserVarPtr.resize(Size);
+      MsysInquireFeature(SysId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(Size), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MsysControlFeature.
+inline void MFTYPE MsysControlFeature(MIL_ID SysId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MsysInquireFeature(SysId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MsysControlFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MsysControlFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   if (ControlType == M_FEATURE_VALUE)
+      {
+      MsysControlFeature(SysId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(UserVarPtr.size()), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MdigInquireFeature.
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_STRING> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DISPLAY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_TOOLTIP ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DESCRIPTION)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MdigInquireFeature(DigId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_STRING> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_STRING>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MdigInquireFeature(DigId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_NAME)
+      {
+      MdigInquireFeature(DigId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_FEATURE_SELECTOR_NAME)
+      {
+      MdigInquireFeature(DigId, M_FEATURE_SELECTOR_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MdigInquireFeature(DigId, InquireType + i, FeatureName, M_TYPE_STRING, UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_INT64> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_VALUE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_ACCESS_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_VISIBILITY ||
+       InquireType == M_FEATURE_ENUM_ENTRY_CACHING_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_STREAMABLE)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MdigInquireFeature(DigId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("InquireType type not compatible with std::vector<MIL_INT64> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_INT64>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MdigInquireFeature(DigId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_TYPE)
+      {
+      MdigInquireFeature(DigId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MdigInquireFeature(DigId, InquireType + i, FeatureName.c_str(), M_TYPE_INT64, &UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MdigInquireFeature(MIL_ID DigId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MdigInquireFeature(DigId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MdigInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   MIL_INT Size = 0;
+   if (InquireType == M_FEATURE_VALUE)
+      {
+      MdigInquireFeature(DigId, M_FEATURE_SIZE, FeatureName.c_str(), M_TYPE_INT64, &Size);
+      UserVarPtr.resize(Size);
+      MdigInquireFeature(DigId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(Size), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MdigControlFeature.
+inline void MFTYPE MdigControlFeature(MIL_ID DigId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MdigInquireFeature(DigId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MdigControlFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MdigControlFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   if (ControlType == M_FEATURE_VALUE)
+      {
+      MdigControlFeature(DigId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(UserVarPtr.size()), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufInquireFeature.
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_STRING> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DISPLAY_NAME ||
+       InquireType == M_FEATURE_ENUM_ENTRY_TOOLTIP ||
+       InquireType == M_FEATURE_ENUM_ENTRY_DESCRIPTION)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MbufInquireFeature(BufId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_STRING> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_STRING>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MbufInquireFeature(BufId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_NAME)
+      {
+      MbufInquireFeature(BufId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_FEATURE_SELECTOR_NAME)
+      {
+      MbufInquireFeature(BufId, M_FEATURE_SELECTOR_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MbufInquireFeature(BufId, InquireType + i, FeatureName, M_TYPE_STRING, UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_INT64> &UserVarPtr)
+   {
+   MIL_INT Count = 0;
+   if (InquireType == M_FEATURE_ENUM_ENTRY_VALUE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_ACCESS_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_VISIBILITY ||
+       InquireType == M_FEATURE_ENUM_ENTRY_CACHING_MODE ||
+       InquireType == M_FEATURE_ENUM_ENTRY_STREAMABLE)
+      {
+#if M_MIL_USE_SAFE_TYPE
+      MIL_INT64 Type = 0;
+      MbufInquireFeature(BufId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+      if (Type != M_TYPE_ENUMERATION)
+         {
+         SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("InquireType type not compatible with std::vector<MIL_INT64> overload."));
+         }
+      else if (UserVarType != M_DEFAULT)
+         {
+         SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_INT64>."));
+         }
+#else
+      UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+      MbufInquireFeature(BufId, M_FEATURE_ENUM_ENTRY_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else if (InquireType == M_SUBFEATURE_TYPE)
+      {
+      MbufInquireFeature(BufId, M_SUBFEATURE_COUNT, FeatureName.c_str(), M_TYPE_MIL_INT, &Count);
+      }
+   else
+      {
+      Count = 1;
+      }
+
+   UserVarPtr.resize(Count);
+   for (MIL_INT i = 0; i < Count; i++)
+      {
+      MbufInquireFeature(BufId, InquireType + i, FeatureName.c_str(), M_TYPE_INT64, &UserVarPtr[i]);
+      }
+   }
+
+inline void MFTYPE MbufInquireFeature(MIL_ID BufId, MIL_INT64 InquireType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MbufInquireFeature(BufId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufInquireFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   MIL_INT Size = 0;
+   if (InquireType == M_FEATURE_VALUE)
+      {
+      MbufInquireFeature(BufId, M_FEATURE_SIZE, FeatureName.c_str(), M_TYPE_INT64, &Size);
+      UserVarPtr.resize(Size);
+      MbufInquireFeature(BufId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(Size), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufControlFeature.
+inline void MFTYPE MbufControlFeature(MIL_ID BufId, MIL_INT64 ControlType, const MIL_STRING& FeatureName, MIL_INT64 UserVarType, const std::vector<MIL_UINT8> &UserVarPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   MIL_INT64 Type = 0;
+   MbufInquireFeature(BufId, M_FEATURE_TYPE, FeatureName.c_str(), M_TYPE_INT64, &Type);
+   if (Type != M_TYPE_REGISTER)
+      {
+      SafeTypeError(MIL_TEXT("MbufControlFeature"), MIL_TEXT("Feature type not compatible with std::vector<MIL_UINT8> overload."));
+      }
+   else if (UserVarType != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MbufControlFeature"), MIL_TEXT("UserVarType parameter must be M_DEFAULT with std::vector<MIL_UINT8>."));
+      }
+#else
+   UNREFERENCED_PARAMETER(UserVarType);
+#endif
+
+   if (ControlType == M_FEATURE_VALUE)
+      {
+      MbufControlFeature(BufId, M_FEATURE_VALUE, FeatureName.c_str(), M_TYPE_UINT8 + M_FEATURE_USER_ARRAY_SIZE(UserVarPtr.size()), &UserVarPtr[0]);
+      }
+   }
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MbufInquireContainer.
+#if !M_MIL_USE_64BIT
+inline MIL_INT MFTYPE MbufInquireContainer(MIL_ID ContainerId, MIL_INT64 Component, MIL_INT64 InquireType, std::vector<MIL_ID> &UserVarPtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(M_IS_BUINQ_CONT_ID_ARRAY(InquireType))
+      {
+      MIL_INT ComponentListSz = MbufInquireContainer(ContainerId, Component, InquireType + M_NB_ELEMENTS, M_NULL);
+      UserVarPtr.resize(ComponentListSz);
+      if(ComponentListSz > 0)
+         {
+         RetVal = MbufInquireContainer(ContainerId, Component, InquireType + M_ARRAY_ID_SIZE(ComponentListSz), &UserVarPtr[0]);
+         }
+      }
+   else
+      {
+      UserVarPtr.resize(1);
+      RetVal = MbufInquireContainer(ContainerId, Component, InquireType, &UserVarPtr[0]);
+      }
+   return RetVal;
+   }
+#endif
+
+inline MIL_INT MFTYPE MbufInquireContainer(MIL_ID ContainerId, MIL_INT64 Component, MIL_INT64 InquireType, std::vector<MIL_INT64> &UserVarPtr)
+   {
+   MIL_INT RetVal = 0;
+
+   if(M_IS_BUINQ_CONT_INT64_ARRAY(InquireType))
+      {
+      MIL_INT ComponentListSz = MbufInquireContainer(ContainerId, Component, InquireType + M_NB_ELEMENTS, M_NULL);
+      UserVarPtr.resize(ComponentListSz);
+      if(ComponentListSz > 0)
+         {
+         RetVal = MbufInquireContainer(ContainerId, Component, InquireType + M_ARRAY_ID_SIZE(ComponentListSz), &UserVarPtr[0]);
+         }
+      }
+   else
+      {
+      UserVarPtr.resize(1);
+      RetVal = MbufInquireContainer(ContainerId, Component, InquireType, &UserVarPtr[0]);
+      }
+   return RetVal;
+   }
+
+
+// ----------------------------------------------------------
+// Overloads for std::vector in MxxxStream.
+inline void MFTYPE MbufStream(std::vector<MIL_UINT8>  &MemPtrOrFileName,
+   MIL_ID                 SysId,
+   MIL_INT64              Operation,
+   MIL_INT64              StreamType,
+   MIL_DOUBLE             Version,
+   MIL_INT64              ControlFlag,
+   MIL_ID*                McontextIdPtr,
+   MIL_INT*               SizeByteVarPtr)
+   {
+   MxxxStreamForStdVector(MemPtrOrFileName,
+      SysId,
+      Operation,
+      StreamType,
+      Version,
+      ControlFlag,
+      McontextIdPtr,
+      SizeByteVarPtr,
+      MbufStream);
+   }
+// ----------------------------------------------------------
+// Overloads for std::vector in MdigProcess.
+inline void MFTYPE MdigProcess(MIL_ID DigId, const std::vector<MIL_ID>& DestImageArrayPtr, MIL_INT ImageCount, MIL_INT64 Operation, MIL_INT64 OperationFlag, MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr, void *UserDataPtr)
+   {
+#if M_MIL_USE_SAFE_TYPE
+   if(ImageCount <= 0)
+      {
+      SafeTypeError(MIL_TEXT("MdigProcess"), MIL_TEXT("ImageCount must be greater than zero."));
+      }
+   if(ImageCount > (MIL_INT)DestImageArrayPtr.size() && ImageCount != M_DEFAULT)
+      {
+      SafeTypeError(MIL_TEXT("MdigProcess"), MIL_TEXT("ImageCount parameter must be smaller or equal (M_DEFAULT) to the size of input vector."));
+      }
+#endif
+
+   if(ImageCount == M_DEFAULT || ImageCount > (MIL_INT)DestImageArrayPtr.size())
+      {
+      ImageCount = (MIL_INT)DestImageArrayPtr.size();
+      }
+
+   MdigProcess(DigId, &DestImageArrayPtr[0], ImageCount, Operation, OperationFlag, HookHandlerPtr, UserDataPtr);
+   }   
+
+#endif // M_MIL_USE_VECTOR
+
+#endif /* __MILVECTOR_H__ */	
+#endif /* __MILPROTO_H */
diff --git a/Lib/Matrox/Include/milweb.h b/Lib/Matrox/Include/milweb.h
new file mode 100644
index 0000000..724cfa6
--- /dev/null
+++ b/Lib/Matrox/Include/milweb.h
@@ -0,0 +1,735 @@
+锘�/////////////////////////////////////////////////////////////////
+//
+// Filename          :  milweb.h
+// Revision          : 10.40.0640
+// Content           :  This file contains the defines necessary to use the milwebclient
+//
+// Copyright 漏 Matrox Electronic Systems Ltd., 1992-2020.
+// All Rights Reserved
+//
+/////////////////////////////////////////////////////////////////
+#ifndef __MIL_WEB_CLIENT_H
+#define __MIL_WEB_CLIENT_H
+
+#include <stddef.h>
+
+#if !defined(MIL_COMPILE_VERSION_HEX) || (MIL_COMPILE_VERSION_HEX== 0)
+#ifdef MIL_COMPILE_VERSION_HEX
+#undef MIL_COMPILE_VERSION_HEX
+#endif
+#define MIL_COMPILE_VERSION_HEX 0x1040
+#endif
+
+// Let's put the hex value in decimal.
+#define MIL_COMPILE_VERSION ((((MIL_COMPILE_VERSION_HEX >> 12) & 0xf) * 1000) + (((MIL_COMPILE_VERSION_HEX >> 8) & 0xf) * 100) + (((MIL_COMPILE_VERSION_HEX >> 4) & 0xf) * 10) + (((MIL_COMPILE_VERSION_HEX) & 0xf) ))
+#define MIL_COMPILE_TRUNK_VERSION         1060
+#define MIL_COMPILE_NEXT_MAJOR_VERSION    1100
+
+
+#define WEB_CLIENT 1
+#define M_CLIENT_VERSION         0x1000000
+
+#if defined(__linux__)
+#if defined(__arm__) || defined(__aarch64__)
+         #define M_MIL_USE_ARM        1
+      #else
+         #define M_MIL_USE_ARM        0
+#endif
+#define M_MIL_USE_LINUX         1
+#define M_MIL_USE_WINDOWS       0
+#if defined(__x86_64__) || defined(__aarch64__)
+   #define M_MIL_USE_64BIT      1
+#else
+   #define M_MIL_USE_64BIT      0
+#endif
+#else
+#define M_MIL_USE_LINUX         0
+#define M_MIL_USE_WINDOWS       1
+#if defined(_WIN64) || defined(WIN64)
+   #define M_MIL_USE_64BIT      1
+#else
+   #define M_MIL_USE_64BIT      0
+#endif
+#endif
+#define M_NULL                                           0
+
+#if !defined(M_MIL_USE_UNICODE) && !M_MIL_USE_LINUX
+   #define M_MIL_USE_UNICODE 1
+#elif !defined (M_MIL_USE_UNICODE)
+   #define M_MIL_USE_UNICODE 0
+#endif
+
+#if  M_MIL_USE_UNICODE
+   #if defined(UNICODE)
+      #define M_MIL_UNICODE_API 1
+   #else
+      #define M_MIL_UNICODE_API 0
+   #endif
+#endif
+
+#if M_MIL_USE_UNICODE && M_MIL_UNICODE_API
+   #define MIL_TEXT(quote)        L##quote
+   typedef wchar_t                MIL_TEXT_CHAR;
+#elif M_MIL_USE_WINDOWS || M_MIL_USE_LINUX
+   #define MIL_TEXT(quote)        quote
+   typedef char                   MIL_TEXT_CHAR;
+#else
+   #error Operating system not supported !
+#endif
+typedef MIL_TEXT_CHAR*               MIL_TEXT_PTR;
+typedef const MIL_TEXT_CHAR*         MIL_CONST_TEXT_PTR;
+
+
+#if M_MIL_USE_WINDOWS
+   #define MFTYPE        _stdcall         // Exported Function type
+#elif M_MIL_USE_LINUX
+   #define MFTYPE                         // Exported Function type
+#else
+   #error Operating system not supported in Mil.h!
+#endif
+
+/************************************************************************/
+/* MIL TYPE DEFINITIONS                                                 */
+/************************************************************************/
+/* GENERAL RELATED DEFINES */
+/***************************/
+#if M_MIL_USE_WINDOWS
+      #if M_MIL_USE_64BIT
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+         typedef  __int64              MIL_INT;
+         typedef  unsigned __int64     MIL_UINT;
+#else
+         typedef  long long            MIL_INT;
+         typedef  unsigned long long   MIL_UINT;
+#endif
+
+         #define  MIL_UINT_MIN      0ULL
+         #define  MIL_UINT_MAX      18446744073709551615ULL
+         #define  MIL_INT_MIN       (-9223372036854775807LL - 1)
+         #define  MIL_INT_MAX       9223372036854775807LL
+      #else
+         #if (_MSC_VER < 1400) // Visual Studio 2003
+            typedef  long           MIL_INT;
+            typedef  unsigned long  MIL_UINT;
+         #else                 // Visual Studio 2005
+            // _W64 Lets you mark variables, such that when you compile
+            // with /Wp64 the compiler will report any warnings that would
+            // be reported if you were compiling with a 64-bit compiler.
+            typedef _W64          long MIL_INT;
+            typedef _W64 unsigned long MIL_UINT;
+         #endif
+         #define  MIL_UINT_MIN   0UL
+         #define  MIL_UINT_MAX   4294967295UL
+         #define  MIL_INT_MIN    (-2147483647L-1L)
+         #define  MIL_INT_MAX    2147483647L
+      #endif
+
+   typedef                long         MIL_INT32;
+   typedef const          long         MIL_CINT32;
+   typedef       unsigned long         MIL_UINT32;
+   typedef const unsigned long         MIL_CUINT32;
+   #define  MIL_UINT32_MIN             0UL
+   #define  MIL_UINT32_MAX             4294967295UL
+   #define  MIL_INT32_MIN              (-2147483647L-1L)
+   #define  MIL_INT32_MAX              2147483647L
+   #define  MIL_UINT32_MIN_FLT         0UL               //Min precise value in 32-bit floating point.
+   #define  MIL_UINT32_MAX_FLT         0xFFFFFF00UL      //Max precise value in 32-bit floating point.
+   #define  MIL_INT32_MIN_FLT          (-2147483647L-1L) //Min precise value in 32-bit floating point.
+   #define  MIL_INT32_MAX_FLT          0x7FFFFF80L       //Max precise value in 32-bit floating point.
+
+#if defined(_MSC_VER) && (_MSC_VER < 1310)
+   typedef                __int64      MIL_INT64;
+   typedef const          __int64      MIL_CINT64;
+   typedef       unsigned __int64      MIL_UINT64;
+   typedef const unsigned __int64      MIL_CUINT64;
+#else
+   typedef                long long    MIL_INT64;
+   typedef const          long long    MIL_CINT64;
+   typedef       unsigned long long    MIL_UINT64;
+   typedef const unsigned long long    MIL_CUINT64;
+#endif
+   #define  MIL_UINT64_MIN             0ULL
+   #define  MIL_UINT64_MAX             18446744073709551615ULL
+   #define  MIL_INT64_MIN              (-9223372036854775807LL - 1)
+   #define  MIL_INT64_MAX              9223372036854775807LL
+   #define  MIL_UINT64_MIN_DBL         0ULL                    //Min precise value in 64-bit floating point.
+   #define  MIL_UINT64_MAX_DBL         0xFFFFFFFFFFFFF800ULL   //Max precise value in 64-bit floating point.
+   #define  MIL_INT64_MIN_DBL          (-9223372036854775807LL - 1LL)  //Min precise value in 64-bit floating point.
+   #define  MIL_INT64_MAX_DBL          0x7FFFFFFFFFFFFC00LL    //Max precise value in 64-bit floating point.
+
+   typedef                double       MIL_DOUBLE;
+   typedef                float        MIL_FLOAT;
+   typedef                char         MIL_INT8;
+   typedef const          char         MIL_CINT8;
+   typedef       unsigned char         MIL_UINT8;
+   typedef const unsigned char         MIL_CUINT8;
+   typedef                short        MIL_INT16;
+   typedef const          short        MIL_CINT16;
+   typedef       unsigned short        MIL_UINT16;
+   typedef const unsigned short        MIL_CUINT16;
+   typedef MIL_INT32                   MIL_BOOL;
+   typedef const MIL_INT32             MIL_CBOOL;
+
+   #define  MIL_UINT8_MIN              0UL
+   #define  MIL_UINT8_MAX              255UL
+   #define  MIL_INT8_MIN               -128L
+   #define  MIL_INT8_MAX               127L
+   #define  MIL_UINT16_MIN             0UL
+   #define  MIL_UINT16_MAX             65535UL
+   #define  MIL_INT16_MIN              -32768L
+   #define  MIL_INT16_MAX              32767L
+   #define  MIL_DOUBLE_MIN             DBL_MIN
+   #define  MIL_DOUBLE_MAX             DBL_MAX
+   #define  MIL_FLOAT_MIN              FLT_MIN
+   #define  MIL_FLOAT_MAX              FLT_MAX
+   #define  MIL_BOOL_MIN               0UL
+   #define  MIL_BOOL_MAX               1UL
+
+#if M_MIL_USE_UNICODE && M_MIL_UNICODE_API
+   typedef       wchar_t               MIL_WCHAR;
+#else
+   typedef       unsigned short        MIL_WCHAR;
+#endif
+
+#elif M_MIL_USE_LINUX
+   typedef               long          MIL_INT;
+   typedef      unsigned long          MIL_UINT;
+
+   #if M_MIL_USE_64BIT
+   typedef                int          MIL_INT32;
+   typedef const          int          MIL_CINT32;
+   typedef       unsigned int          MIL_UINT32;
+   typedef const unsigned int          MIL_CUINT32;
+
+   #define  MIL_UINT_MIN               MIL_UINT64_MIN
+   #define  MIL_UINT_MAX               MIL_UINT64_MAX
+   #define  MIL_INT_MIN                MIL_INT64_MIN
+   #define  MIL_INT_MAX                MIL_INT64_MAX
+   #else // M_MIL_USE_64BIT
+   typedef                long         MIL_INT32;
+   typedef const          long         MIL_CINT32;
+   typedef       unsigned long         MIL_UINT32;
+   typedef const unsigned long         MIL_CUINT32;
+
+   #define  MIL_UINT_MIN               MIL_UINT32_MIN
+   #define  MIL_UINT_MAX               MIL_UINT32_MAX
+   #define  MIL_INT_MIN                MIL_INT32_MIN
+   #define  MIL_INT_MAX                MIL_INT32_MAX
+   #endif
+
+   #define  MIL_UINT32_MIN             0
+   #define  MIL_UINT32_MAX             4294967295U
+   #define  MIL_INT32_MIN              (-MIL_INT32_MAX - 1) // -2147483648L does not yield the right value
+   #define  MIL_INT32_MAX              2147483647
+   #define  MIL_UINT32_MIN_FLT         0U                //Min precise value in 32-bit floating point.
+   #define  MIL_UINT32_MAX_FLT         0xFFFFFF00U       //Max precise value in 32-bit floating point.
+   #define  MIL_INT32_MIN_FLT          (-2147483647-1)   //Min precise value in 32-bit floating point.
+   #define  MIL_INT32_MAX_FLT          0x7FFFFF80       //Max precise value in 32-bit floating point.
+
+   #if M_MIL_USE_64BIT
+      typedef                long       MIL_INT64;
+      typedef const          long       MIL_CINT64;
+      typedef       unsigned long       MIL_UINT64;
+      typedef const unsigned long       MIL_CUINT64;
+   #else
+      typedef                long long MIL_INT64;
+      typedef const          long long MIL_CINT64;
+      typedef       unsigned long long MIL_UINT64;
+      typedef const unsigned long long MIL_CUINT64;
+   #endif
+   #define  MIL_UINT64_MIN             0ULL
+   #define  MIL_UINT64_MAX             18446744073709551615ULL
+   #define  MIL_INT64_MAX              9223372036854775807LL
+   #define  MIL_INT64_MIN              (-MIL_INT64_MAX - 1LL) // Using -9223372036854775808LL directly causes weird warnings.
+   #define  MIL_UINT64_MIN_DBL         0ULL                    //Min precise value in 64-bit floating point.
+   #define  MIL_UINT64_MAX_DBL         0xFFFFFFFFFFFFF800ULL   //Max precise value in 64-bit floating point.
+   #define  MIL_INT64_MIN_DBL          (-9223372036854775807LL - 1LL)  //Min precise value in 64-bit floating point.
+   #define  MIL_INT64_MAX_DBL          0x7FFFFFFFFFFFFC00LL    //Max precise value in 64-bit floating point.
+
+   typedef                double       MIL_DOUBLE;
+   typedef                float        MIL_FLOAT;
+   typedef                char         MIL_INT8;
+   typedef const          char         MIL_CINT8;
+   typedef       unsigned char         MIL_UINT8;
+   typedef const unsigned char         MIL_CUINT8;
+   typedef                short        MIL_INT16;
+   typedef const          short        MIL_CINT16;
+   typedef       unsigned short        MIL_UINT16;
+   typedef const unsigned short        MIL_CUINT16;
+   typedef MIL_INT32                   MIL_BOOL;
+   typedef const MIL_INT32             MIL_CBOOL;
+
+   #define  MIL_UINT8_MIN              0UL
+   #define  MIL_UINT8_MAX              255UL
+   #define  MIL_INT8_MIN               -128L
+   #define  MIL_INT8_MAX               127L
+   #define  MIL_UINT16_MIN             0UL
+   #define  MIL_UINT16_MAX             65535UL
+   #define  MIL_INT16_MIN              -32768L
+   #define  MIL_INT16_MAX              32767L
+   #define  MIL_DOUBLE_MIN             DBL_MIN
+   #define  MIL_DOUBLE_MAX             DBL_MAX
+   #define  MIL_FLOAT_MIN              FLT_MIN
+   #define  MIL_FLOAT_MAX              FLT_MAX
+   #define  MIL_BOOL_MIN               0UL
+   #define  MIL_BOOL_MAX               1UL
+
+   typedef       unsigned short        MIL_WCHAR;
+
+#else
+   #error Operating system not supported!
+#endif
+
+typedef MIL_UINT64               MIL_DATA_PTR;
+
+typedef MIL_DATA_PTR             MIL_PHYS_DATA_PTR;
+typedef void*                    MIL_HOST_DATA_PTR;
+typedef const void*              MIL_CONST_HOST_DATA_PTR;
+
+typedef MIL_UINT                 MIL_ADDR;   // this type is used to cast a pointer to an integer type for arithmetic conversion
+                                             // for example void *NewPtr = (void*)((MIL_ADDR)OldPtr + Offset);
+
+typedef unsigned char            MIL_BYTE;
+
+#if M_MIL_USE_64BIT
+#define M_MIL_USE_INT64_ID 1
+#endif
+
+#if defined(M_MIL_USE_INT64_ID) && M_MIL_USE_INT64_ID
+   typedef  MIL_INT64  MIL_ID;
+#else
+   typedef  MIL_INT32  MIL_ID;
+#endif
+
+#if M_MIL_USE_LINUX && M_MIL_USE_64BIT
+   #define MAKE_INT64(I)        (I ## L)
+   #define MAKE_UINT64(I)       (I ## LU)
+#elif M_MIL_USE_LINUX || (defined(__GNUC__) && __GNUC__)
+   #define MAKE_INT64(I)        (I ## LL)
+   #define MAKE_UINT64(I)       (I ## LLU)
+#elif M_MIL_USE_WINDOWS
+   #define MAKE_INT64(I)        (I##I64)
+   #define MAKE_UINT64(I)       (I##Ui64)
+#else
+   #define MAKE_INT64(I)        (I)
+   #define MAKE_UINT64(I)       (I)
+#endif
+
+#if !M_MIL_USE_64BIT
+#define M_PTR_TO_DOUBLE(ptr)            ((double) MPtrToInt((void*)(ptr)))
+#define M_STRING_TO_DOUBLE(ptr)         M_PTR_TO_DOUBLE((ptr))
+#define M_PTR_TO_MIL_INT(val)           ((MIL_INT)MPtrToInt((void*)(val)))
+#else
+#define M_PTR_TO_DOUBLE(ptr)            (MIL_INT64)(ptr)
+#define M_STRING_TO_DOUBLE(ptr)         M_PTR_TO_DOUBLE(ptr)
+#define M_PTR_TO_MIL_INT(val)           ((MIL_INT)((MIL_UINT)val))
+#endif //!M_MIL_USE_64BIT
+#define M_DOUBLE_TO_PTR(val)            ((void *)((MIL_UINT)val))
+#define M_CLIENT_ASCII_ENCODING                           MAKE_INT64(0x0001000000000000)
+#define M_CLIENT_TEXT_ENCODING                        MAKE_INT64(0x0001000000000000)
+
+#if M_MIL_USE_UNICODE && !M_MIL_UNICODE_API
+#define     M_CLIENT_ENCODING       M_CLIENT_ASCII_ENCODING
+#else
+#define     M_CLIENT_ENCODING       0
+#endif
+
+#define M_CLIENT_ASCII_ENCODING_SET(X)                ((((X) & M_CLIENT_TEXT_ENCODING) == M_CLIENT_ASCII_ENCODING) ? true : false)
+#define M_STRIP_CLIENT_TEXT_ENCODING(X)               ((X) & ~M_CLIENT_TEXT_ENCODING)
+
+#define M_STRING_SIZE                                 MAKE_INT64(0x0000050000000000)
+#define M_FUNC_INQUIRE_STRING_START                   47
+#define M_APP_INQUIRE_OBJ_STRING_STA               M_FUNC_INQUIRE_STRING_START // 47
+   #define M_OBJECT_NAME                           ((M_FUNC_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING) //47
+
+   #define M_OBJECT_NAME_SIZE                         (M_STRING_SIZE + M_OBJECT_NAME)
+
+#define M_OBJ_HOOK_RANGE_START                                   0x000000800L
+#define M_INVALID                                                         -1
+#define M_DEFAULT                                                 0x10000000L
+#define M_UNHOOK                                                  0x04000000L
+#define M_NULL_ERROR                                              0L
+#define M_NO_ERROR                                                0L
+
+#define M_NO_TIMEOUT                                              0x00000800
+#define M_BUFFER_TOO_SMALL                                                 1
+#define M_SUCCESS                                                 0x00000000L // Already defined in milreg.h, milcolor.h
+
+#define M_CURRENT                                                 0x00000002L
+#define M_CURRENT_FCT                                             0x00030000L
+#define M_CURRENT_SUB_NB                                          0x00000004L
+#define M_CURRENT_SUB                                             0x00050000L
+#define M_CURRENT_SUB_1                                           0x00050000L
+#define M_CURRENT_SUB_2                                           0x00060000L
+#define M_CURRENT_SUB_3                                           0x00070000L
+#define M_GLOBAL                                                  0x00000008L
+#define M_GLOBAL_FCT                                              0x00090000L
+#define M_GLOBAL_SUB_NB                                           0x000A0000L
+#define M_GLOBAL_SUB                                              0x000B0000L
+#define M_GLOBAL_SUB_1                                            0x000B0000L
+#define M_GLOBAL_SUB_2                                            0x000C0000L
+#define M_GLOBAL_SUB_3                                            0x000D0000L
+#define M_PARAM_NB                                                0x00140000L
+#define M_BUFFER_ID                                               0x00160000L
+#define M_REGION_OFFSET_X                                         0x00410000L
+#define M_REGION_OFFSET_Y                                         0x00420000L
+#define M_REGION_SIZE_X                                           0x00430000L
+#define M_REGION_SIZE_Y                                           0x00480000L
+#define M_OBJECT_ID                                               0x001B0000L
+#define M_PARAM_VALUE                                             0x08000000L
+#define M_EXTENDED_PARAM_TYPE                                     0x10000000L
+#define M_PARAM_ATTRIBUTES                                        0x04000000L
+#define M_PARAM_SIZE                                              0x01000000L
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#if (M_MIL_USE_UNICODE && !M_MIL_UNICODE_API )
+#define M_MESSAGE                                     (0x20000000L|M_CLIENT_ERROR_ASCII_MODE)
+#else
+#define M_MESSAGE                                                 0x20000000L
+#endif
+#else
+#define M_MESSAGE                                                 (0x20000000L | M_CLIENT_ENCODING)
+#endif
+
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_OBJECT_PUBLISH_WEB                                   34L
+#endif
+
+#define M_SILENT                                                  0x00000100L
+
+#define M_ERROR                                                   0x40000000L
+#define M_ERROR_CURRENT                                   (M_ERROR|M_CURRENT)
+#define M_CONNECTING                                                       1L
+#define M_DISCONNECT                                                       2L
+#define M_CONNECT                                                          3L
+#define M_TIMEOUT                                                       2077L
+#define M_UPDATE_WEB                                                    3187L
+#define M_UPDATE_END                                M_OBJ_HOOK_RANGE_START+8L
+#define M_OBJECT_FREE                                             0x00010000L
+#define M_OBJECT_PUBLISH_WEB                                              38L
+#define M_COMPONENT_ADD                                           0x00040000
+#define M_COMPONENT_REMOVE                         M_OBJ_HOOK_RANGE_START+10L
+#define M_GET_END                                                         32L
+#define M_READ_END                                                        11L
+#define M_UPDATE_INTERACTIVE_STATE                                        84L
+
+#define M_ERROR_MESSAGE_SIZE                                              320L
+
+#define M_INTERNAL_FORMAT                                          0x00003F00L
+#define M_INTERNAL_FORMAT_SHIFT                                    8L
+#define M_INTERNAL_COMPLETE_FORMAT                                 0x7FFFFF80L
+#define M_ANY_INTERNAL_FORMAT                                      (0   << M_INTERNAL_FORMAT_SHIFT)
+#define M_BGRX32                                                       (17  << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color BGRX  8.8.8.8  format
+#define M_BGR32                                                        M_BGRX32
+
+#define M_APP_INQUIRE_SYS_START                                        15000L
+#define M_CLOSE_CONNECTION                     (M_APP_INQUIRE_SYS_START+504L)
+#define M_WEB_PUBLISHED_FORMAT                                          3206L
+
+// Inquires
+#if MIL_COMPILE_VERSION < MIL_COMPILE_TRUNK_VERSION
+#define M_OLD_WEB_PUBLISH                                  14L
+#define M_OLD_WEB_PUBLISHED_LIST                            4
+#define M_OLD_WEB_PUBLISHED_LIST_SIZE                       5
+#define M_OLD_WEB_PUBLISHED_NAME                    (6 | M_CLIENT_ENCODING)
+#endif
+#define M_WEB_PUBLISH                                  244
+#define M_WEB_PUBLISHED_LIST                            12
+#define M_WEB_PUBLISHED_LIST_SIZE                       17
+#define M_WEB_PUBLISHED_NAME                    (7 | M_CLIENT_ENCODING)
+
+#define M_TYPE                                        1008L
+#define M_SIZE_X                                      1536L
+#define M_SIZE_Y                                      1537L
+#define M_SIZE_BYTE                                   5061L
+#define M_MESSAGE_LENGTH                                16L
+#define M_INTERACTIVE                                M_NULL
+
+// Object Type
+#define M_APPLICATION                                 0x00000200L
+#define M_DISPLAY                                     0x00200000L
+#define M_LUT                                         0x00040000L
+#define M_KERNEL                                      0x00400000L
+#define M_EVENT                                       0x00000080L
+#define M_STRUCT_ELEMENT                              0x08000000L
+#define M_ARRAY                                       0x00000040L
+#define M_GROUP                                       MAKE_INT64(0x0000400000000000)
+#define M_IMAGE                                       0x00000004L
+#define M_MODIFIED_BUFFER                             0x40000000L
+#define M_BUFFER_ID                                   0x00160000L
+#define M_OBJECT_ID                                   0x001B0000L
+#define M_GROUP_ID                                            18L
+#define M_MESSAGE_MAILBOX                             MAKE_INT64(0x0000800000000000)
+#define M_FUNC_INQUIRE_STRING_START                   47
+
+#define M_OBJECT_NAME                           ((M_FUNC_INQUIRE_STRING_START+0)|M_CLIENT_ENCODING)
+#define M_OBJECT_NAME_SIZE                         (M_STRING_SIZE + M_OBJECT_NAME)
+#define M_OBJECT_TYPE                                         136
+#define M_COMPONENT_COUNT                                      17L
+#define M_WEB_CLIENT_INDEX                                    219L
+#define M_WEB_CLIENT_TYPE                                     220L
+#define M_READ_WRITE                                    0x00000010L
+#define M_READ_ONLY                                     0x00000020L
+#define M_NO                                                     0L
+
+#define M_COMPONENT_ID_LIST                           M_COMPONENT_LIST
+#define M_COMPONENT_LIST                              0x00100000
+#define M_ARRAY_ID_MASK                               0x000FFFFF
+#define M_ARRAY_ID_SIZE(N)                            (N & M_ARRAY_ID_MASK)
+#define M_EXTRACT_ARRAY_ID_SIZE(N)                    ((MIL_INT)(N & M_ARRAY_ID_MASK))
+
+#define M_HOST_ADDRESS                                   0x00010000L
+#define M_IMAGE_HOST_ADDRESS                             0x00010000L
+// DataType
+#define M_SIGN                                                 1014L
+#define M_SIZE_BAND                                            1005L
+#define M_UNSIGNED                                       0x00000000L
+#define M_SIGNED                                         0x08000000L
+#define M_FLOAT                             (0x40000000L | M_SIGNED)
+#define M_USER_DATA_PTR                                   0x00000001
+
+#define M_MESSAGE_PTR                                            101
+
+#define M_MOUSE_LEFT_BUTTON_DOWN                                 56L
+#define M_MOUSE_RIGHT_BUTTON_DOWN                                57L
+#define M_MOUSE_LEFT_BUTTON_UP                                   58L
+#define M_MOUSE_RIGHT_BUTTON_UP                                  59L
+#define M_MOUSE_MOVE                                             64L
+#define M_MOUSE_WHEEL                                            65L
+#define M_MOUSE_MIDDLE_BUTTON_DOWN                               66L
+#define M_MOUSE_MIDDLE_BUTTON_UP                                 67L
+#define M_KEY_DOWN                                               68L
+#define M_KEY_UP                                                 69L
+#define M_MOUSE_LEAVE                                            85L
+
+#define M_KEY_SHIFT                                       0x00010000
+#define M_KEY_CTRL                                        0x00020000
+#define M_KEY_ALT                                         0x00040000
+#define M_MOUSE_LEFT_BUTTON                               0x00080000
+#define M_MOUSE_MIDDLE_BUTTON                             0x00100000
+#define M_MOUSE_RIGHT_BUTTON                              0x00200000
+#define M_KEY_WIN                                         0x00400000
+
+#define M_MOUSE_POSITION_X                                         1L
+#define M_MOUSE_POSITION_Y                                         2L
+#define M_ANNOTATIONS_DC                                           3L
+#define M_COMBINATION_KEYS                                         7L
+#define M_EVENT_VALUE                                              8L
+
+#define M_MOUSE_WHEEL_VALUE                              M_EVENT_VALUE
+#define M_KEY_VALUE                                      M_EVENT_VALUE
+
+
+
+#define M_FRAMES_PER_SECOND_DEFAULT                               10
+
+#define M_ENABLE                                               -9997L
+#define M_DISABLE                                              -9999L
+#define M_NOW                                                     29L
+
+#define M_PRINT_DISABLE                                            0L
+#define M_PRINT_ENABLE                                             1L
+
+#define M_FRAME_RATE                                            6002L
+
+#define M_PIXEL_FORMAT                                          3032L //M_LOCAL_DISPLAY_CONTROL
+#define M_DATA_FORMAT                                           1041L
+#define M_PITCH                                            0x20000000L
+#define M_PITCH_BYTE                                      0x08000000L
+#define M_INTERNAL_FORMAT_SHIFT                                    8L
+#define M_MONO8                           (2   << M_INTERNAL_FORMAT_SHIFT)   // Force  8 bits pixels in monochrome format
+#define M_RGBX32                          (9   << M_INTERNAL_FORMAT_SHIFT)   // Force 32 bits pixels in color RGBX  8.8.8.8  format
+#define M_RGB32                                             M_RGBX32
+
+#define WEB_TIMEOUT                                             100
+#define WEB_MAX_LOOP_WAIT                                        20
+
+// MIL Web application Type
+#define M_WEB_APPLICATION                                        1L
+#define M_STANDALONE_APPLICATION                                 2L
+
+typedef MIL_INT (MFTYPE* MIL_HOOK_FUNCTION_PTR)(MIL_INT HookType,
+                                                MIL_ID EventId,
+                                                void* UserData);
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#if M_MIL_USE_UNICODE
+void MFTYPE MilWebMappOpenConnectionW(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr);
+void MFTYPE MilWebMappOpenConnectionA(const char* ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr);
+#if M_MIL_UNICODE_API
+#define MilWebMappOpenConnection MilWebMappOpenConnectionW
+#else
+#define MilWebMappOpenConnection MilWebMappOpenConnectionA
+#endif
+#else
+void MFTYPE MilWebMappOpenConnection(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr);
+#endif
+void MFTYPE MilWebMappCloseConnection(MIL_ID AppId);
+MIL_INT MFTYPE MilWebMappInquireConnection(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void* UserVarPtr);
+MIL_INT MFTYPE MilWebMappInquire(MIL_ID AppId, MIL_INT64 InquireType, void* ResultPtr);
+void MFTYPE MilWebMappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT ControlFlag);
+void MFTYPE MilWebMappHookFunction(MIL_ID AppId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandlerPtr, void* UserDataPtr);
+MIL_INT MFTYPE MilWebMappGetHookInfo(MIL_ID AppId, MIL_ID EventId, MIL_INT64 InfoType, void* UserPtr);
+
+MIL_INT MFTYPE MilWebMdispInquire(MIL_ID DisplayId, MIL_INT64 InquireType, void* ResultPtr);
+void MFTYPE MilWebMdispControl(MIL_ID DisplayId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag);
+void MFTYPE  MilWebMdispMessage(  MIL_ID  DisplayId, MIL_INT EventType, MIL_INT MousePositionX,MIL_INT MousePositionY, MIL_INT EventValue, MIL_INT CombinationKeys, MIL_INT UserValue);
+void MFTYPE MilWebMdispHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandler, void *UserDataPtr);
+MIL_INT MFTYPE MilWebMdispGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+void MFTYPE MilWebMdispZoom(MIL_ID DisplayId, MIL_DOUBLE XFactor, MIL_DOUBLE YFactor);
+
+MIL_INT MFTYPE MilWebMbufInquire(MIL_ID BufId, MIL_INT64 InquireType, void* ResultPtr);
+void MFTYPE MilWebMbufControl(MIL_ID BufId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag);
+MIL_INT MFTYPE MilWebMbufGetHookInfo(MIL_ID EventId,  MIL_INT64 InfoType, void* UserPtr);
+void MFTYPE MilWebMbufGet(MIL_ID SrcBufId, void* BufferPtr);
+
+MIL_INT MFTYPE MilWebMobjInquire(MIL_ID ObjectId, MIL_INT64 InquireType, void* ResultPtr);
+void MFTYPE MilWebMobjControl(MIL_ID ObjId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag);
+void MFTYPE MilWebMobjHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandler, void *UserDataPtr);
+MIL_INT MFTYPE MilWebMobjGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr);
+
+
+MIL_INT64 MFTYPE MilWebMobjMessageRead(MIL_ID MessageId, void* MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 *MessageOutSizePtr, MIL_INT64 *MessageTagPtr, MIL_INT64 *StatusPtr, MIL_INT64  OperationFlag);
+void MFTYPE MilWebMobjMessageWrite(MIL_ID MessageId, const void* MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64  OperationFlag);
+
+MIL_UINT MFTYPE MPtrToInt(void *pPtr);
+#ifdef __cplusplus
+}
+#endif
+
+
+#ifdef __cplusplus
+namespace MilWeb
+   {
+#if M_MIL_USE_UNICODE
+#if M_MIL_UNICODE_API
+      inline void MappOpenConnection(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr)
+         {
+         MilWebMappOpenConnectionW(ConnectionDescriptor, InitFlag, ControlFlag, RemoteContextAppIdPtr);
+         }
+#else
+      inline void MappOpenConnection(const char* ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr)
+         {
+         MilWebMappOpenConnectionA(ConnectionDescriptor, InitFlag, ControlFlag, RemoteContextAppIdPtr);
+         }
+#endif
+#else
+      inline void MappOpenConnection(MIL_CONST_TEXT_PTR ConnectionDescriptor, MIL_INT64 InitFlag, MIL_INT64 ControlFlag, MIL_ID* RemoteContextAppIdPtr)
+         {
+         MilWebMappOpenConnection(ConnectionDescriptor, InitFlag, ControlFlag, RemoteContextAppIdPtr);
+         }
+#endif
+      inline void  MappCloseConnection(MIL_ID AppId)
+         {
+         MilWebMappCloseConnection(AppId);
+         }
+
+      inline MIL_INT MappInquireConnection(MIL_ID ContextAppId, MIL_INT64 InquireType, MIL_INT64 ControlFlag, MIL_INT64 ExtraFlag, void* UserVarPtr)
+         {
+         return MilWebMappInquireConnection(ContextAppId, InquireType, ControlFlag, ExtraFlag, UserVarPtr);
+         }
+
+      inline MIL_INT MappInquire(MIL_ID AppId, MIL_INT64 InquireType, void* ResultPtr)
+         {
+         return MilWebMappInquire(AppId, InquireType, ResultPtr);
+         }
+
+      inline void MappControl(MIL_ID ContextAppId, MIL_INT64 ControlType, MIL_INT ControlFlag)
+         {
+         MilWebMappControl(ContextAppId, ControlType, ControlFlag);
+         }
+
+      inline void MappHookFunction(MIL_ID AppId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandlerPtr, void* UserDataPtr)
+         {
+         MilWebMappHookFunction(AppId, HookType, HookHandlerPtr, UserDataPtr);
+         }
+
+      inline MIL_INT MappGetHookInfo(MIL_ID AppId, MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr)
+         {
+         return MilWebMappGetHookInfo(AppId,EventId, InfoType, UserVarPtr);
+         }
+
+      inline MIL_INT MdispInquire(MIL_ID DisplayId, MIL_INT64 InquireType, void* ResultPtr)
+         {
+         return MilWebMdispInquire(DisplayId, InquireType, ResultPtr);
+         }
+
+      inline void MdispControl(MIL_ID DisplayId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag)
+         {
+         MilWebMdispControl(DisplayId, ControlType, ControlFlag);
+         }
+
+      inline void MdispMessage(  MIL_ID  DisplayId, MIL_INT EventType, MIL_INT MousePositionX,MIL_INT MousePositionY, MIL_INT EventValue, MIL_INT CombinationKeys, MIL_INT UserValue)
+         {
+         MilWebMdispMessage(DisplayId, EventType, MousePositionX, MousePositionY, EventValue, CombinationKeys, UserValue);
+         }
+
+      inline void MdispHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandler, void *UserDataPtr)
+         {
+         MilWebMdispHookFunction(ObjectId, HookType, HookHandler, UserDataPtr);
+         }
+
+      inline MIL_INT MdispGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr)
+         {
+         return MilWebMdispGetHookInfo(EventId, InfoType, UserVarPtr);
+         }
+
+      inline void MdispZoom(MIL_ID DisplayId, MIL_DOUBLE XFactor, MIL_DOUBLE YFactor)
+         {
+         MilWebMdispZoom(DisplayId, XFactor, YFactor);
+         }
+
+      inline MIL_INT MbufInquire(MIL_ID BufId, MIL_INT64 InquireType, void* ResultPtr)
+         {
+         return  MilWebMbufInquire(BufId, InquireType, ResultPtr);
+         }
+
+      inline MIL_INT MbufGetHookInfo(MIL_ID EventId,  MIL_INT64 InfoType, void* UserPtr)
+         {
+         return MilWebMbufGetHookInfo(EventId,  InfoType, UserPtr);
+         }
+
+      inline void MbufGet(MIL_ID SrcBufId, void* BufferPtr)
+         {
+         MilWebMbufGet(SrcBufId, BufferPtr);
+         }
+
+      inline void MbufControl(MIL_ID BufId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag)
+         {
+         MilWebMbufControl(BufId, ControlType, ControlFlag);
+         }
+
+      inline MIL_INT MobjInquire(MIL_ID ObjId, MIL_INT64 InquireType, void* ResultPtr)
+         {
+         return MilWebMobjInquire(ObjId, InquireType, ResultPtr);
+         }
+
+      inline void MobjControl(MIL_ID ObjectId, MIL_INT64 ControlType, MIL_DOUBLE ControlFlag)
+         {
+         MilWebMobjControl(ObjectId, ControlType, ControlFlag);
+         }
+
+      inline void MobjHookFunction(MIL_ID ObjectId, MIL_INT HookType, MIL_HOOK_FUNCTION_PTR HookHandler, void *UserDataPtr)
+         {
+         MilWebMobjHookFunction(ObjectId, HookType, HookHandler, UserDataPtr);
+         }
+
+      inline MIL_INT MobjGetHookInfo(MIL_ID EventId, MIL_INT64 InfoType, void* UserVarPtr)
+         {
+         return MilWebMobjGetHookInfo(EventId, InfoType, UserVarPtr);
+         }
+
+
+      inline MIL_INT64 MobjMessageRead(MIL_ID MessageId, void* MessagePtr, MIL_INT64 MessageInSize, MIL_INT64 *MessageOutSizePtr, MIL_INT64 *MessageTagPtr, MIL_INT64 *StatusPtr, MIL_INT64  OperationFlag)
+         {
+         return MilWebMobjMessageRead(MessageId, MessagePtr, MessageInSize, MessageOutSizePtr, MessageTagPtr, StatusPtr, OperationFlag);
+         }
+
+      inline void MobjMessageWrite(MIL_ID MessageId, const void* MessagePtr, MIL_INT64 MessageSize, MIL_INT64 MessageTag, MIL_INT64  OperationFlag)
+         {
+         MilWebMobjMessageWrite(MessageId, MessagePtr, MessageSize, MessageTag, OperationFlag);
+         }
+   }
+#endif // __cplusplus
+#endif //__MIL_WEB_CLIENT_H
diff --git a/Lib/Matrox/dll/DigitizerController.dll b/Lib/Matrox/dll/DigitizerController.dll
new file mode 100644
index 0000000..dcd5ca2
--- /dev/null
+++ b/Lib/Matrox/dll/DigitizerController.dll
Binary files differ
diff --git a/Lib/Matrox/dll/Liberatus.dll b/Lib/Matrox/dll/Liberatus.dll
new file mode 100644
index 0000000..5102b1c
--- /dev/null
+++ b/Lib/Matrox/dll/Liberatus.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MILIrisGTRFocusDelay.dll b/Lib/Matrox/dll/MILIrisGTRFocusDelay.dll
new file mode 100644
index 0000000..cf76040
--- /dev/null
+++ b/Lib/Matrox/dll/MILIrisGTRFocusDelay.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MILPerf.dll b/Lib/Matrox/dll/MILPerf.dll
new file mode 100644
index 0000000..98ef923
--- /dev/null
+++ b/Lib/Matrox/dll/MILPerf.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MILQSVEngine.dll b/Lib/Matrox/dll/MILQSVEngine.dll
new file mode 100644
index 0000000..eaca889
--- /dev/null
+++ b/Lib/Matrox/dll/MILQSVEngine.dll
Binary files differ
diff --git a/Lib/Matrox/dll/McomController.dll b/Lib/Matrox/dll/McomController.dll
new file mode 100644
index 0000000..2627d8d
--- /dev/null
+++ b/Lib/Matrox/dll/McomController.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilAux.dll b/Lib/Matrox/dll/MilAux.dll
new file mode 100644
index 0000000..92e3980
--- /dev/null
+++ b/Lib/Matrox/dll/MilAux.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilClarityUHD.dll b/Lib/Matrox/dll/MilClarityUHD.dll
new file mode 100644
index 0000000..6e7fb65
--- /dev/null
+++ b/Lib/Matrox/dll/MilClarityUHD.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilClarityUHDUI.dll b/Lib/Matrox/dll/MilClarityUHDUI.dll
new file mode 100644
index 0000000..07ec4bf
--- /dev/null
+++ b/Lib/Matrox/dll/MilClarityUHDUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilCodec.dll b/Lib/Matrox/dll/MilCodec.dll
new file mode 100644
index 0000000..5047ab1
--- /dev/null
+++ b/Lib/Matrox/dll/MilCodec.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilConcordPoE.dll b/Lib/Matrox/dll/MilConcordPoE.dll
new file mode 100644
index 0000000..0a59512
--- /dev/null
+++ b/Lib/Matrox/dll/MilConcordPoE.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilConcordPoEUI.dll b/Lib/Matrox/dll/MilConcordPoEUI.dll
new file mode 100644
index 0000000..979747b
--- /dev/null
+++ b/Lib/Matrox/dll/MilConcordPoEUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilDSFCapture.dll b/Lib/Matrox/dll/MilDSFCapture.dll
new file mode 100644
index 0000000..55b8c2c
--- /dev/null
+++ b/Lib/Matrox/dll/MilDSFCapture.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilDSFCommon.dll b/Lib/Matrox/dll/MilDSFCommon.dll
new file mode 100644
index 0000000..b6342df
--- /dev/null
+++ b/Lib/Matrox/dll/MilDSFCommon.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilDSFSequence.dll b/Lib/Matrox/dll/MilDSFSequence.dll
new file mode 100644
index 0000000..d85343b
--- /dev/null
+++ b/Lib/Matrox/dll/MilDSFSequence.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilDirectX.dll b/Lib/Matrox/dll/MilDirectX.dll
new file mode 100644
index 0000000..18e6bc5
--- /dev/null
+++ b/Lib/Matrox/dll/MilDirectX.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilDisplay.dll b/Lib/Matrox/dll/MilDisplay.dll
new file mode 100644
index 0000000..f5945af
--- /dev/null
+++ b/Lib/Matrox/dll/MilDisplay.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilGPU.dll b/Lib/Matrox/dll/MilGPU.dll
new file mode 100644
index 0000000..50848ae
--- /dev/null
+++ b/Lib/Matrox/dll/MilGPU.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilGPUd3d10.dll b/Lib/Matrox/dll/MilGPUd3d10.dll
new file mode 100644
index 0000000..3e132ef
--- /dev/null
+++ b/Lib/Matrox/dll/MilGPUd3d10.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilGPUd3d11.dll b/Lib/Matrox/dll/MilGPUd3d11.dll
new file mode 100644
index 0000000..5b51eac
--- /dev/null
+++ b/Lib/Matrox/dll/MilGPUd3d11.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilGPUd3d9.dll b/Lib/Matrox/dll/MilGPUd3d9.dll
new file mode 100644
index 0000000..bdc4ef4
--- /dev/null
+++ b/Lib/Matrox/dll/MilGPUd3d9.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilGenTL.dll b/Lib/Matrox/dll/MilGenTL.dll
new file mode 100644
index 0000000..ae61066
--- /dev/null
+++ b/Lib/Matrox/dll/MilGenTL.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilGenTLUI.dll b/Lib/Matrox/dll/MilGenTLUI.dll
new file mode 100644
index 0000000..96a06fe
--- /dev/null
+++ b/Lib/Matrox/dll/MilGenTLUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilGigEVision.dll b/Lib/Matrox/dll/MilGigEVision.dll
new file mode 100644
index 0000000..798a99c
--- /dev/null
+++ b/Lib/Matrox/dll/MilGigEVision.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilGrabc.dll b/Lib/Matrox/dll/MilGrabc.dll
new file mode 100644
index 0000000..90cdf11
--- /dev/null
+++ b/Lib/Matrox/dll/MilGrabc.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilIrisGTRUI.dll b/Lib/Matrox/dll/MilIrisGTRUI.dll
new file mode 100644
index 0000000..284db21
--- /dev/null
+++ b/Lib/Matrox/dll/MilIrisGTRUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilMorphis.dll b/Lib/Matrox/dll/MilMorphis.dll
new file mode 100644
index 0000000..2039675
--- /dev/null
+++ b/Lib/Matrox/dll/MilMorphis.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilMorphisQxt.dll b/Lib/Matrox/dll/MilMorphisQxt.dll
new file mode 100644
index 0000000..eadde9f
--- /dev/null
+++ b/Lib/Matrox/dll/MilMorphisQxt.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilNetwork.dll b/Lib/Matrox/dll/MilNetwork.dll
new file mode 100644
index 0000000..aead836
--- /dev/null
+++ b/Lib/Matrox/dll/MilNetwork.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilNetworkSlave.dll b/Lib/Matrox/dll/MilNetworkSlave.dll
new file mode 100644
index 0000000..2ce569e
--- /dev/null
+++ b/Lib/Matrox/dll/MilNetworkSlave.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilOrionHd.dll b/Lib/Matrox/dll/MilOrionHd.dll
new file mode 100644
index 0000000..078e48d
--- /dev/null
+++ b/Lib/Matrox/dll/MilOrionHd.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRadient.dll b/Lib/Matrox/dll/MilRadient.dll
new file mode 100644
index 0000000..74f7275
--- /dev/null
+++ b/Lib/Matrox/dll/MilRadient.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRadientCXP.dll b/Lib/Matrox/dll/MilRadientCXP.dll
new file mode 100644
index 0000000..992461d
--- /dev/null
+++ b/Lib/Matrox/dll/MilRadientCXP.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRadientCXPUI.dll b/Lib/Matrox/dll/MilRadientCXPUI.dll
new file mode 100644
index 0000000..e2ed335
--- /dev/null
+++ b/Lib/Matrox/dll/MilRadientCXPUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRadientPro.dll b/Lib/Matrox/dll/MilRadientPro.dll
new file mode 100644
index 0000000..457c06c
--- /dev/null
+++ b/Lib/Matrox/dll/MilRadientPro.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRadientProUI.dll b/Lib/Matrox/dll/MilRadientProUI.dll
new file mode 100644
index 0000000..93eb2e1
--- /dev/null
+++ b/Lib/Matrox/dll/MilRadientProUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRadientUI.dll b/Lib/Matrox/dll/MilRadientUI.dll
new file mode 100644
index 0000000..bbf8ddc
--- /dev/null
+++ b/Lib/Matrox/dll/MilRadientUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRadientevcl.dll b/Lib/Matrox/dll/MilRadientevcl.dll
new file mode 100644
index 0000000..1ea331c
--- /dev/null
+++ b/Lib/Matrox/dll/MilRadientevcl.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRadientevclUI.dll b/Lib/Matrox/dll/MilRadientevclUI.dll
new file mode 100644
index 0000000..f237e85
--- /dev/null
+++ b/Lib/Matrox/dll/MilRadientevclUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRapixoCXP.dll b/Lib/Matrox/dll/MilRapixoCXP.dll
new file mode 100644
index 0000000..51675e2
--- /dev/null
+++ b/Lib/Matrox/dll/MilRapixoCXP.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilRapixoCXPUI.dll b/Lib/Matrox/dll/MilRapixoCXPUI.dll
new file mode 100644
index 0000000..3ff49e6
--- /dev/null
+++ b/Lib/Matrox/dll/MilRapixoCXPUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilSoliosUI.dll b/Lib/Matrox/dll/MilSoliosUI.dll
new file mode 100644
index 0000000..f0818e3
--- /dev/null
+++ b/Lib/Matrox/dll/MilSoliosUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/MilgigevisionUI.dll b/Lib/Matrox/dll/MilgigevisionUI.dll
new file mode 100644
index 0000000..864b07b
--- /dev/null
+++ b/Lib/Matrox/dll/MilgigevisionUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/Milim.dll b/Lib/Matrox/dll/Milim.dll
new file mode 100644
index 0000000..2d91b17
--- /dev/null
+++ b/Lib/Matrox/dll/Milim.dll
Binary files differ
diff --git a/Lib/Matrox/dll/Milnetworkinfo.dll b/Lib/Matrox/dll/Milnetworkinfo.dll
new file mode 100644
index 0000000..774a58c
--- /dev/null
+++ b/Lib/Matrox/dll/Milnetworkinfo.dll
Binary files differ
diff --git a/Lib/Matrox/dll/Milsolios.dll b/Lib/Matrox/dll/Milsolios.dll
new file mode 100644
index 0000000..d602daf
--- /dev/null
+++ b/Lib/Matrox/dll/Milsolios.dll
Binary files differ
diff --git a/Lib/Matrox/dll/Milusb3visionUI.dll b/Lib/Matrox/dll/Milusb3visionUI.dll
new file mode 100644
index 0000000..96efff9
--- /dev/null
+++ b/Lib/Matrox/dll/Milusb3visionUI.dll
Binary files differ
diff --git a/Lib/Matrox/dll/RadientPfpga.dll b/Lib/Matrox/dll/RadientPfpga.dll
new file mode 100644
index 0000000..50e77cf
--- /dev/null
+++ b/Lib/Matrox/dll/RadientPfpga.dll
Binary files differ
diff --git a/Lib/Matrox/dll/SoliosPFpga.dll b/Lib/Matrox/dll/SoliosPFpga.dll
new file mode 100644
index 0000000..fe85004
--- /dev/null
+++ b/Lib/Matrox/dll/SoliosPFpga.dll
Binary files differ
diff --git a/Lib/Matrox/dll/libmfxsw64.dll b/Lib/Matrox/dll/libmfxsw64.dll
new file mode 100644
index 0000000..b20bcb4
--- /dev/null
+++ b/Lib/Matrox/dll/libmfxsw64.dll
Binary files differ
diff --git a/Lib/Matrox/dll/mil.dll b/Lib/Matrox/dll/mil.dll
new file mode 100644
index 0000000..28ae3ba
--- /dev/null
+++ b/Lib/Matrox/dll/mil.dll
Binary files differ
diff --git a/Lib/Matrox/dll/mil3d.dll b/Lib/Matrox/dll/mil3d.dll
new file mode 100644
index 0000000..c82710c
--- /dev/null
+++ b/Lib/Matrox/dll/mil3d.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milcacheinfo.dll b/Lib/Matrox/dll/milcacheinfo.dll
new file mode 100644
index 0000000..d53152e
--- /dev/null
+++ b/Lib/Matrox/dll/milcacheinfo.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milcom.dll b/Lib/Matrox/dll/milcom.dll
new file mode 100644
index 0000000..be284fa
--- /dev/null
+++ b/Lib/Matrox/dll/milcom.dll
Binary files differ
diff --git a/Lib/Matrox/dll/mildig.dll b/Lib/Matrox/dll/mildig.dll
new file mode 100644
index 0000000..4c76ad0
--- /dev/null
+++ b/Lib/Matrox/dll/mildig.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milfpga.dll b/Lib/Matrox/dll/milfpga.dll
new file mode 100644
index 0000000..6f59e6f
--- /dev/null
+++ b/Lib/Matrox/dll/milfpga.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milhttpserver.dll b/Lib/Matrox/dll/milhttpserver.dll
new file mode 100644
index 0000000..9c6c779
--- /dev/null
+++ b/Lib/Matrox/dll/milhttpserver.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milirisgtr.dll b/Lib/Matrox/dll/milirisgtr.dll
new file mode 100644
index 0000000..ccd7bc8
--- /dev/null
+++ b/Lib/Matrox/dll/milirisgtr.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milmp.dll b/Lib/Matrox/dll/milmp.dll
new file mode 100644
index 0000000..39789b4
--- /dev/null
+++ b/Lib/Matrox/dll/milmp.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milnetworkserver.dll b/Lib/Matrox/dll/milnetworkserver.dll
new file mode 100644
index 0000000..12ae5dc
--- /dev/null
+++ b/Lib/Matrox/dll/milnetworkserver.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milpcie.dll b/Lib/Matrox/dll/milpcie.dll
new file mode 100644
index 0000000..04e71ba
--- /dev/null
+++ b/Lib/Matrox/dll/milpcie.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milshm.dll b/Lib/Matrox/dll/milshm.dll
new file mode 100644
index 0000000..77290d3
--- /dev/null
+++ b/Lib/Matrox/dll/milshm.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milusb3vision.dll b/Lib/Matrox/dll/milusb3vision.dll
new file mode 100644
index 0000000..9670310
--- /dev/null
+++ b/Lib/Matrox/dll/milusb3vision.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milwebclient.dll b/Lib/Matrox/dll/milwebclient.dll
new file mode 100644
index 0000000..dc9de18
--- /dev/null
+++ b/Lib/Matrox/dll/milwebclient.dll
Binary files differ
diff --git a/Lib/Matrox/dll/milwebserver.dll b/Lib/Matrox/dll/milwebserver.dll
new file mode 100644
index 0000000..c46c2f8
--- /dev/null
+++ b/Lib/Matrox/dll/milwebserver.dll
Binary files differ
diff --git a/Lib/Matrox/lib/Mil3d.lib b/Lib/Matrox/lib/Mil3d.lib
new file mode 100644
index 0000000..18d27f6
--- /dev/null
+++ b/Lib/Matrox/lib/Mil3d.lib
Binary files differ
diff --git a/Lib/Matrox/lib/Milim.lib b/Lib/Matrox/lib/Milim.lib
new file mode 100644
index 0000000..642479f
--- /dev/null
+++ b/Lib/Matrox/lib/Milim.lib
Binary files differ
diff --git a/Lib/Matrox/lib/mil.lib b/Lib/Matrox/lib/mil.lib
new file mode 100644
index 0000000..053db2c
--- /dev/null
+++ b/Lib/Matrox/lib/mil.lib
Binary files differ
diff --git a/Lib/Matrox/lib/milcom.lib b/Lib/Matrox/lib/milcom.lib
new file mode 100644
index 0000000..4b2c7aa
--- /dev/null
+++ b/Lib/Matrox/lib/milcom.lib
Binary files differ
diff --git a/Lib/Matrox/lib/milfpga.lib b/Lib/Matrox/lib/milfpga.lib
new file mode 100644
index 0000000..2eb263c
--- /dev/null
+++ b/Lib/Matrox/lib/milfpga.lib
Binary files differ
diff --git a/Lib/Matrox/lib/milwebclient.lib b/Lib/Matrox/lib/milwebclient.lib
new file mode 100644
index 0000000..aad6152
--- /dev/null
+++ b/Lib/Matrox/lib/milwebclient.lib
Binary files differ
diff --git a/Lib/MegaLock/lib/l_mega64.lib b/Lib/MegaLock/lib/l_mega64.lib
new file mode 100644
index 0000000..d53675e
--- /dev/null
+++ b/Lib/MegaLock/lib/l_mega64.lib
Binary files differ
diff --git a/Lib/MegaLock/lib/l_mega64__.lib b/Lib/MegaLock/lib/l_mega64__.lib
new file mode 100644
index 0000000..a439cc6
--- /dev/null
+++ b/Lib/MegaLock/lib/l_mega64__.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cv.h b/Lib/OpenCV/opencv_3.1/include/opencv/cv.h
new file mode 100644
index 0000000..0aefc6d
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cv.h
@@ -0,0 +1,73 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_CV_H__
+#define __OPENCV_OLD_CV_H__
+
+#if defined(_MSC_VER)
+    #define CV_DO_PRAGMA(x) __pragma(x)
+    #define __CVSTR2__(x) #x
+    #define __CVSTR1__(x) __CVSTR2__(x)
+    #define __CVMSVCLOC__ __FILE__ "("__CVSTR1__(__LINE__)") : "
+    #define CV_MSG_PRAGMA(_msg) CV_DO_PRAGMA(message (__CVMSVCLOC__ _msg))
+#elif defined(__GNUC__)
+    #define CV_DO_PRAGMA(x) _Pragma (#x)
+    #define CV_MSG_PRAGMA(_msg) CV_DO_PRAGMA(message (_msg))
+#else
+    #define CV_DO_PRAGMA(x)
+    #define CV_MSG_PRAGMA(_msg)
+#endif
+#define CV_WARNING(x) CV_MSG_PRAGMA("Warning: " #x)
+
+//CV_WARNING("This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module")
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/imgproc/imgproc_c.h"
+#include "opencv2/photo/photo_c.h"
+#include "opencv2/video/tracking_c.h"
+#include "opencv2/objdetect/objdetect_c.h"
+
+#if !defined(CV_IMPL)
+#define CV_IMPL extern "C"
+#endif //CV_IMPL
+
+#endif // __OPENCV_OLD_CV_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cv.hpp b/Lib/OpenCV/opencv_3.1/include/opencv/cv.hpp
new file mode 100644
index 0000000..e498d7a
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cv.hpp
@@ -0,0 +1,60 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_CV_HPP__
+#define __OPENCV_OLD_CV_HPP__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "cv.h"
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/photo.hpp"
+#include "opencv2/video.hpp"
+#include "opencv2/highgui.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/calib3d.hpp"
+#include "opencv2/objdetect.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cvaux.h b/Lib/OpenCV/opencv_3.1/include/opencv/cvaux.h
new file mode 100644
index 0000000..fe86c5d
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cvaux.h
@@ -0,0 +1,57 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_OLD_AUX_H__
+#define __OPENCV_OLD_AUX_H__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/imgproc/imgproc_c.h"
+#include "opencv2/photo/photo_c.h"
+#include "opencv2/video/tracking_c.h"
+#include "opencv2/objdetect/objdetect_c.h"
+
+#endif
+
+/* End of file. */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cvaux.hpp b/Lib/OpenCV/opencv_3.1/include/opencv/cvaux.hpp
new file mode 100644
index 0000000..b0e60a3
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cvaux.hpp
@@ -0,0 +1,52 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_OLD_AUX_HPP__
+#define __OPENCV_OLD_AUX_HPP__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "cvaux.h"
+#include "opencv2/core/utility.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cvwimage.h b/Lib/OpenCV/opencv_3.1/include/opencv/cvwimage.h
new file mode 100644
index 0000000..de89c92
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cvwimage.h
@@ -0,0 +1,46 @@
+///////////////////////////////////////////////////////////////////////////////
+//  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) 2008, Google, 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 Intel Corporation or contributors 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.
+
+
+#ifndef __OPENCV_OLD_WIMAGE_HPP__
+#define __OPENCV_OLD_WIMAGE_HPP__
+
+#include "opencv2/core/wimage.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cxcore.h b/Lib/OpenCV/opencv_3.1/include/opencv/cxcore.h
new file mode 100644
index 0000000..0982bd7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cxcore.h
@@ -0,0 +1,52 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_CXCORE_H__
+#define __OPENCV_OLD_CXCORE_H__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "opencv2/core/core_c.h"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cxcore.hpp b/Lib/OpenCV/opencv_3.1/include/opencv/cxcore.hpp
new file mode 100644
index 0000000..9af4ac7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cxcore.hpp
@@ -0,0 +1,53 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_CXCORE_HPP__
+#define __OPENCV_OLD_CXCORE_HPP__
+
+//#if defined(__GNUC__)
+//#warning "This is a deprecated opencv header provided for compatibility. Please include a header from a corresponding opencv module"
+//#endif
+
+#include "cxcore.h"
+#include "opencv2/core.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp b/Lib/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp
new file mode 100644
index 0000000..1f04d1a
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cxeigen.hpp
@@ -0,0 +1,48 @@
+/*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*/
+
+#ifndef __OPENCV_OLD_EIGEN_HPP__
+#define __OPENCV_OLD_EIGEN_HPP__
+
+#include "opencv2/core/eigen.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/cxmisc.h b/Lib/OpenCV/opencv_3.1/include/opencv/cxmisc.h
new file mode 100644
index 0000000..6c93a0c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/cxmisc.h
@@ -0,0 +1,8 @@
+#ifndef __OPENCV_OLD_CXMISC_H__
+#define __OPENCV_OLD_CXMISC_H__
+
+#ifdef __cplusplus
+#  include "opencv2/core/utility.hpp"
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/highgui.h b/Lib/OpenCV/opencv_3.1/include/opencv/highgui.h
new file mode 100644
index 0000000..0261029
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/highgui.h
@@ -0,0 +1,48 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_OLD_HIGHGUI_H__
+#define __OPENCV_OLD_HIGHGUI_H__
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/highgui/highgui_c.h"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv/ml.h b/Lib/OpenCV/opencv_3.1/include/opencv/ml.h
new file mode 100644
index 0000000..d8e967f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv/ml.h
@@ -0,0 +1,47 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_OLD_ML_H__
+#define __OPENCV_OLD_ML_H__
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/ml.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp
new file mode 100644
index 0000000..ddffffe
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d.hpp
@@ -0,0 +1,2001 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CALIB3D_HPP__
+#define __OPENCV_CALIB3D_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/core/affine.hpp"
+
+/**
+  @defgroup calib3d Camera Calibration and 3D Reconstruction
+
+The functions in this section use a so-called pinhole camera model. In this model, a scene view is
+formed by projecting 3D points into the image plane using a perspective transformation.
+
+\f[s  \; m' = A [R|t] M'\f]
+
+or
+
+\f[s  \vecthree{u}{v}{1} = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}
+\begin{bmatrix}
+r_{11} & r_{12} & r_{13} & t_1  \\
+r_{21} & r_{22} & r_{23} & t_2  \\
+r_{31} & r_{32} & r_{33} & t_3
+\end{bmatrix}
+\begin{bmatrix}
+X \\
+Y \\
+Z \\
+1
+\end{bmatrix}\f]
+
+where:
+
+-   \f$(X, Y, Z)\f$ are the coordinates of a 3D point in the world coordinate space
+-   \f$(u, v)\f$ are the coordinates of the projection point in pixels
+-   \f$A\f$ is a camera matrix, or a matrix of intrinsic parameters
+-   \f$(cx, cy)\f$ is a principal point that is usually at the image center
+-   \f$fx, fy\f$ are the focal lengths expressed in pixel units.
+
+Thus, if an image from the camera is scaled by a factor, all of these parameters should be scaled
+(multiplied/divided, respectively) by the same factor. The matrix of intrinsic parameters does not
+depend on the scene viewed. So, once estimated, it can be re-used as long as the focal length is
+fixed (in case of zoom lens). The joint rotation-translation matrix \f$[R|t]\f$ is called a matrix of
+extrinsic parameters. It is used to describe the camera motion around a static scene, or vice versa,
+rigid motion of an object in front of a still camera. That is, \f$[R|t]\f$ translates coordinates of a
+point \f$(X, Y, Z)\f$ to a coordinate system, fixed with respect to the camera. The transformation above
+is equivalent to the following (when \f$z \ne 0\f$ ):
+
+\f[\begin{array}{l}
+\vecthree{x}{y}{z} = R  \vecthree{X}{Y}{Z} + t \\
+x' = x/z \\
+y' = y/z \\
+u = f_x*x' + c_x \\
+v = f_y*y' + c_y
+\end{array}\f]
+
+Real lenses usually have some distortion, mostly radial distortion and slight tangential distortion.
+So, the above model is extended as:
+
+\f[\begin{array}{l}
+\vecthree{x}{y}{z} = R  \vecthree{X}{Y}{Z} + t \\
+x' = x/z \\
+y' = y/z \\
+x'' = x'  \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + 2 p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4 \\
+y'' = y'  \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\
+\text{where} \quad r^2 = x'^2 + y'^2  \\
+u = f_x*x'' + c_x \\
+v = f_y*y'' + c_y
+\end{array}\f]
+
+\f$k_1\f$, \f$k_2\f$, \f$k_3\f$, \f$k_4\f$, \f$k_5\f$, and \f$k_6\f$ are radial distortion coefficients. \f$p_1\f$ and \f$p_2\f$ are
+tangential distortion coefficients. \f$s_1\f$, \f$s_2\f$, \f$s_3\f$, and \f$s_4\f$, are the thin prism distortion
+coefficients. Higher-order coefficients are not considered in OpenCV.
+
+In some cases the image sensor may be tilted in order to focus an oblique plane in front of the
+camera (Scheimpfug condition). This can be useful for particle image velocimetry (PIV) or
+triangulation with a laser fan. The tilt causes a perspective distortion of \f$x''\f$ and
+\f$y''\f$. This distortion can be modelled in the following way, see e.g. @cite Louhichi07.
+
+\f[\begin{array}{l}
+s\vecthree{x'''}{y'''}{1} =
+\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}(\tau_x, \tau_y)}
+{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)}
+{0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\
+u = f_x*x''' + c_x \\
+v = f_y*y''' + c_y
+\end{array}\f]
+
+where the matrix \f$R(\tau_x, \tau_y)\f$ is defined by two rotations with angular parameter \f$\tau_x\f$
+and \f$\tau_y\f$, respectively,
+
+\f[
+R(\tau_x, \tau_y) =
+\vecthreethree{\cos(\tau_y)}{0}{-\sin(\tau_y)}{0}{1}{0}{\sin(\tau_y)}{0}{\cos(\tau_y)}
+\vecthreethree{1}{0}{0}{0}{\cos(\tau_x)}{\sin(\tau_x)}{0}{-\sin(\tau_x)}{\cos(\tau_x)} =
+\vecthreethree{\cos(\tau_y)}{\sin(\tau_y)\sin(\tau_x)}{-\sin(\tau_y)\cos(\tau_x)}
+{0}{\cos(\tau_x)}{\sin(\tau_x)}
+{\sin(\tau_y)}{-\cos(\tau_y)\sin(\tau_x)}{\cos(\tau_y)\cos(\tau_x)}.
+\f]
+
+In the functions below the coefficients are passed or returned as
+
+\f[(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f]
+
+vector. That is, if the vector contains four elements, it means that \f$k_3=0\f$ . The distortion
+coefficients do not depend on the scene viewed. Thus, they also belong to the intrinsic camera
+parameters. And they remain the same regardless of the captured image resolution. If, for example, a
+camera has been calibrated on images of 320 x 240 resolution, absolutely the same distortion
+coefficients can be used for 640 x 480 images from the same camera while \f$f_x\f$, \f$f_y\f$, \f$c_x\f$, and
+\f$c_y\f$ need to be scaled appropriately.
+
+The functions below use the above model to do the following:
+
+-   Project 3D points to the image plane given intrinsic and extrinsic parameters.
+-   Compute extrinsic parameters given intrinsic parameters, a few 3D points, and their
+projections.
+-   Estimate intrinsic and extrinsic camera parameters from several views of a known calibration
+pattern (every view is described by several 3D-2D point correspondences).
+-   Estimate the relative position and orientation of the stereo camera "heads" and compute the
+*rectification* transformation that makes the camera optical axes parallel.
+
+@note
+   -   A calibration sample for 3 cameras in horizontal position can be found at
+        opencv_source_code/samples/cpp/3calibration.cpp
+    -   A calibration sample based on a sequence of images can be found at
+        opencv_source_code/samples/cpp/calibration.cpp
+    -   A calibration sample in order to do 3D reconstruction can be found at
+        opencv_source_code/samples/cpp/build3dmodel.cpp
+    -   A calibration sample of an artificially generated camera and chessboard patterns can be
+        found at opencv_source_code/samples/cpp/calibration_artificial.cpp
+    -   A calibration example on stereo calibration can be found at
+        opencv_source_code/samples/cpp/stereo_calib.cpp
+    -   A calibration example on stereo matching can be found at
+        opencv_source_code/samples/cpp/stereo_match.cpp
+    -   (Python) A camera calibration sample can be found at
+        opencv_source_code/samples/python/calibrate.py
+
+  @{
+    @defgroup calib3d_fisheye Fisheye camera model
+
+    Definitions: Let P be a point in 3D of coordinates X in the world reference frame (stored in the
+    matrix X) The coordinate vector of P in the camera reference frame is:
+
+    \f[Xc = R X + T\f]
+
+    where R is the rotation matrix corresponding to the rotation vector om: R = rodrigues(om); call x, y
+    and z the 3 coordinates of Xc:
+
+    \f[x = Xc_1 \\ y = Xc_2 \\ z = Xc_3\f]
+
+    The pinehole projection coordinates of P is [a; b] where
+
+    \f[a = x / z \ and \ b = y / z \\ r^2 = a^2 + b^2 \\ \theta = atan(r)\f]
+
+    Fisheye distortion:
+
+    \f[\theta_d = \theta (1 + k_1 \theta^2 + k_2 \theta^4 + k_3 \theta^6 + k_4 \theta^8)\f]
+
+    The distorted point coordinates are [x'; y'] where
+
+    \f[x' = (\theta_d / r) x \\ y' = (\theta_d / r) y \f]
+
+    Finally, conversion into pixel coordinates: The final pixel coordinates vector [u; v] where:
+
+    \f[u = f_x (x' + \alpha y') + c_x \\
+    v = f_y yy + c_y\f]
+
+    @defgroup calib3d_c C API
+
+  @}
+ */
+
+namespace cv
+{
+
+//! @addtogroup calib3d
+//! @{
+
+//! type of the robust estimation algorithm
+enum { LMEDS  = 4, //!< least-median algorithm
+       RANSAC = 8, //!< RANSAC algorithm
+       RHO    = 16 //!< RHO algorithm
+     };
+
+enum { SOLVEPNP_ITERATIVE = 0,
+       SOLVEPNP_EPNP      = 1, //!< EPnP: Efficient Perspective-n-Point Camera Pose Estimation @cite lepetit2009epnp
+       SOLVEPNP_P3P       = 2, //!< Complete Solution Classification for the Perspective-Three-Point Problem @cite gao2003complete
+       SOLVEPNP_DLS       = 3, //!< A Direct Least-Squares (DLS) Method for PnP  @cite hesch2011direct
+       SOLVEPNP_UPNP      = 4  //!< Exhaustive Linearization for Robust Camera Pose and Focal Length Estimation @cite penate2013exhaustive
+
+};
+
+enum { CALIB_CB_ADAPTIVE_THRESH = 1,
+       CALIB_CB_NORMALIZE_IMAGE = 2,
+       CALIB_CB_FILTER_QUADS    = 4,
+       CALIB_CB_FAST_CHECK      = 8
+     };
+
+enum { CALIB_CB_SYMMETRIC_GRID  = 1,
+       CALIB_CB_ASYMMETRIC_GRID = 2,
+       CALIB_CB_CLUSTERING      = 4
+     };
+
+enum { CALIB_USE_INTRINSIC_GUESS = 0x00001,
+       CALIB_FIX_ASPECT_RATIO    = 0x00002,
+       CALIB_FIX_PRINCIPAL_POINT = 0x00004,
+       CALIB_ZERO_TANGENT_DIST   = 0x00008,
+       CALIB_FIX_FOCAL_LENGTH    = 0x00010,
+       CALIB_FIX_K1              = 0x00020,
+       CALIB_FIX_K2              = 0x00040,
+       CALIB_FIX_K3              = 0x00080,
+       CALIB_FIX_K4              = 0x00800,
+       CALIB_FIX_K5              = 0x01000,
+       CALIB_FIX_K6              = 0x02000,
+       CALIB_RATIONAL_MODEL      = 0x04000,
+       CALIB_THIN_PRISM_MODEL    = 0x08000,
+       CALIB_FIX_S1_S2_S3_S4     = 0x10000,
+       CALIB_TILTED_MODEL        = 0x40000,
+       CALIB_FIX_TAUX_TAUY       = 0x80000,
+       // only for stereo
+       CALIB_FIX_INTRINSIC       = 0x00100,
+       CALIB_SAME_FOCAL_LENGTH   = 0x00200,
+       // for stereo rectification
+       CALIB_ZERO_DISPARITY      = 0x00400,
+       CALIB_USE_LU              = (1 << 17), //!< use LU instead of SVD decomposition for solving. much faster but potentially less precise
+     };
+
+//! the algorithm for finding fundamental matrix
+enum { FM_7POINT = 1, //!< 7-point algorithm
+       FM_8POINT = 2, //!< 8-point algorithm
+       FM_LMEDS  = 4, //!< least-median algorithm
+       FM_RANSAC = 8  //!< RANSAC algorithm
+     };
+
+
+
+/** @brief Converts a rotation matrix to a rotation vector or vice versa.
+
+@param src Input rotation vector (3x1 or 1x3) or rotation matrix (3x3).
+@param dst Output rotation matrix (3x3) or rotation vector (3x1 or 1x3), respectively.
+@param jacobian Optional output Jacobian matrix, 3x9 or 9x3, which is a matrix of partial
+derivatives of the output array components with respect to the input array components.
+
+\f[\begin{array}{l} \theta \leftarrow norm(r) \\ r  \leftarrow r/ \theta \\ R =  \cos{\theta} I + (1- \cos{\theta} ) r r^T +  \sin{\theta} \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} \end{array}\f]
+
+Inverse transformation can be also done easily, since
+
+\f[\sin ( \theta ) \vecthreethree{0}{-r_z}{r_y}{r_z}{0}{-r_x}{-r_y}{r_x}{0} = \frac{R - R^T}{2}\f]
+
+A rotation vector is a convenient and most compact representation of a rotation matrix (since any
+rotation matrix has just 3 degrees of freedom). The representation is used in the global 3D geometry
+optimization procedures like calibrateCamera, stereoCalibrate, or solvePnP .
+ */
+CV_EXPORTS_W void Rodrigues( InputArray src, OutputArray dst, OutputArray jacobian = noArray() );
+
+/** @brief Finds a perspective transformation between two planes.
+
+@param srcPoints Coordinates of the points in the original plane, a matrix of the type CV_32FC2
+or vector\<Point2f\> .
+@param dstPoints Coordinates of the points in the target plane, a matrix of the type CV_32FC2 or
+a vector\<Point2f\> .
+@param method Method used to computed a homography matrix. The following methods are possible:
+-   **0** - a regular method using all the points
+-   **RANSAC** - RANSAC-based robust method
+-   **LMEDS** - Least-Median robust method
+-   **RHO**    - PROSAC-based robust method
+@param ransacReprojThreshold Maximum allowed reprojection error to treat a point pair as an inlier
+(used in the RANSAC and RHO methods only). That is, if
+\f[\| \texttt{dstPoints} _i -  \texttt{convertPointsHomogeneous} ( \texttt{H} * \texttt{srcPoints} _i) \|  >  \texttt{ransacReprojThreshold}\f]
+then the point \f$i\f$ is considered an outlier. If srcPoints and dstPoints are measured in pixels,
+it usually makes sense to set this parameter somewhere in the range of 1 to 10.
+@param mask Optional output mask set by a robust method ( RANSAC or LMEDS ). Note that the input
+mask values are ignored.
+@param maxIters The maximum number of RANSAC iterations, 2000 is the maximum it can be.
+@param confidence Confidence level, between 0 and 1.
+
+The functions find and return the perspective transformation \f$H\f$ between the source and the
+destination planes:
+
+\f[s_i  \vecthree{x'_i}{y'_i}{1} \sim H  \vecthree{x_i}{y_i}{1}\f]
+
+so that the back-projection error
+
+\f[\sum _i \left ( x'_i- \frac{h_{11} x_i + h_{12} y_i + h_{13}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2+ \left ( y'_i- \frac{h_{21} x_i + h_{22} y_i + h_{23}}{h_{31} x_i + h_{32} y_i + h_{33}} \right )^2\f]
+
+is minimized. If the parameter method is set to the default value 0, the function uses all the point
+pairs to compute an initial homography estimate with a simple least-squares scheme.
+
+However, if not all of the point pairs ( \f$srcPoints_i\f$, \f$dstPoints_i\f$ ) fit the rigid perspective
+transformation (that is, there are some outliers), this initial estimate will be poor. In this case,
+you can use one of the three robust methods. The methods RANSAC, LMeDS and RHO try many different
+random subsets of the corresponding point pairs (of four pairs each), estimate the homography matrix
+using this subset and a simple least-square algorithm, and then compute the quality/goodness of the
+computed homography (which is the number of inliers for RANSAC or the median re-projection error for
+LMeDs). The best subset is then used to produce the initial estimate of the homography matrix and
+the mask of inliers/outliers.
+
+Regardless of the method, robust or not, the computed homography matrix is refined further (using
+inliers only in case of a robust method) with the Levenberg-Marquardt method to reduce the
+re-projection error even more.
+
+The methods RANSAC and RHO can handle practically any ratio of outliers but need a threshold to
+distinguish inliers from outliers. The method LMeDS does not need any threshold but it works
+correctly only when there are more than 50% of inliers. Finally, if there are no outliers and the
+noise is rather small, use the default method (method=0).
+
+The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is
+determined up to a scale. Thus, it is normalized so that \f$h_{33}=1\f$. Note that whenever an H matrix
+cannot be estimated, an empty one will be returned.
+
+@sa
+   getAffineTransform, getPerspectiveTransform, estimateRigidTransform, warpPerspective,
+    perspectiveTransform
+
+@note
+   -   A example on calculating a homography for image matching can be found at
+        opencv_source_code/samples/cpp/video_homography.cpp
+
+ */
+CV_EXPORTS_W Mat findHomography( InputArray srcPoints, InputArray dstPoints,
+                                 int method = 0, double ransacReprojThreshold = 3,
+                                 OutputArray mask=noArray(), const int maxIters = 2000,
+                                 const double confidence = 0.995);
+
+/** @overload */
+CV_EXPORTS Mat findHomography( InputArray srcPoints, InputArray dstPoints,
+                               OutputArray mask, int method = 0, double ransacReprojThreshold = 3 );
+
+/** @brief Computes an RQ decomposition of 3x3 matrices.
+
+@param src 3x3 input matrix.
+@param mtxR Output 3x3 upper-triangular matrix.
+@param mtxQ Output 3x3 orthogonal matrix.
+@param Qx Optional output 3x3 rotation matrix around x-axis.
+@param Qy Optional output 3x3 rotation matrix around y-axis.
+@param Qz Optional output 3x3 rotation matrix around z-axis.
+
+The function computes a RQ decomposition using the given rotations. This function is used in
+decomposeProjectionMatrix to decompose the left 3x3 submatrix of a projection matrix into a camera
+and a rotation matrix.
+
+It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
+degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
+sequence of rotations about the three principle axes that results in the same orientation of an
+object, eg. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angules
+are only one of the possible solutions.
+ */
+CV_EXPORTS_W Vec3d RQDecomp3x3( InputArray src, OutputArray mtxR, OutputArray mtxQ,
+                                OutputArray Qx = noArray(),
+                                OutputArray Qy = noArray(),
+                                OutputArray Qz = noArray());
+
+/** @brief Decomposes a projection matrix into a rotation matrix and a camera matrix.
+
+@param projMatrix 3x4 input projection matrix P.
+@param cameraMatrix Output 3x3 camera matrix K.
+@param rotMatrix Output 3x3 external rotation matrix R.
+@param transVect Output 4x1 translation vector T.
+@param rotMatrixX Optional 3x3 rotation matrix around x-axis.
+@param rotMatrixY Optional 3x3 rotation matrix around y-axis.
+@param rotMatrixZ Optional 3x3 rotation matrix around z-axis.
+@param eulerAngles Optional three-element vector containing three Euler angles of rotation in
+degrees.
+
+The function computes a decomposition of a projection matrix into a calibration and a rotation
+matrix and the position of a camera.
+
+It optionally returns three rotation matrices, one for each axis, and three Euler angles that could
+be used in OpenGL. Note, there is always more than one sequence of rotations about the three
+principle axes that results in the same orientation of an object, eg. see @cite Slabaugh . Returned
+tree rotation matrices and corresponding three Euler angules are only one of the possible solutions.
+
+The function is based on RQDecomp3x3 .
+ */
+CV_EXPORTS_W void decomposeProjectionMatrix( InputArray projMatrix, OutputArray cameraMatrix,
+                                             OutputArray rotMatrix, OutputArray transVect,
+                                             OutputArray rotMatrixX = noArray(),
+                                             OutputArray rotMatrixY = noArray(),
+                                             OutputArray rotMatrixZ = noArray(),
+                                             OutputArray eulerAngles =noArray() );
+
+/** @brief Computes partial derivatives of the matrix product for each multiplied matrix.
+
+@param A First multiplied matrix.
+@param B Second multiplied matrix.
+@param dABdA First output derivative matrix d(A\*B)/dA of size
+\f$\texttt{A.rows*B.cols} \times {A.rows*A.cols}\f$ .
+@param dABdB Second output derivative matrix d(A\*B)/dB of size
+\f$\texttt{A.rows*B.cols} \times {B.rows*B.cols}\f$ .
+
+The function computes partial derivatives of the elements of the matrix product \f$A*B\f$ with regard to
+the elements of each of the two input matrices. The function is used to compute the Jacobian
+matrices in stereoCalibrate but can also be used in any other similar optimization function.
+ */
+CV_EXPORTS_W void matMulDeriv( InputArray A, InputArray B, OutputArray dABdA, OutputArray dABdB );
+
+/** @brief Combines two rotation-and-shift transformations.
+
+@param rvec1 First rotation vector.
+@param tvec1 First translation vector.
+@param rvec2 Second rotation vector.
+@param tvec2 Second translation vector.
+@param rvec3 Output rotation vector of the superposition.
+@param tvec3 Output translation vector of the superposition.
+@param dr3dr1
+@param dr3dt1
+@param dr3dr2
+@param dr3dt2
+@param dt3dr1
+@param dt3dt1
+@param dt3dr2
+@param dt3dt2 Optional output derivatives of rvec3 or tvec3 with regard to rvec1, rvec2, tvec1 and
+tvec2, respectively.
+
+The functions compute:
+
+\f[\begin{array}{l} \texttt{rvec3} =  \mathrm{rodrigues} ^{-1} \left ( \mathrm{rodrigues} ( \texttt{rvec2} )  \cdot \mathrm{rodrigues} ( \texttt{rvec1} ) \right )  \\ \texttt{tvec3} =  \mathrm{rodrigues} ( \texttt{rvec2} )  \cdot \texttt{tvec1} +  \texttt{tvec2} \end{array} ,\f]
+
+where \f$\mathrm{rodrigues}\f$ denotes a rotation vector to a rotation matrix transformation, and
+\f$\mathrm{rodrigues}^{-1}\f$ denotes the inverse transformation. See Rodrigues for details.
+
+Also, the functions can compute the derivatives of the output vectors with regards to the input
+vectors (see matMulDeriv ). The functions are used inside stereoCalibrate but can also be used in
+your own code where Levenberg-Marquardt or another gradient-based solver is used to optimize a
+function that contains a matrix multiplication.
+ */
+CV_EXPORTS_W void composeRT( InputArray rvec1, InputArray tvec1,
+                             InputArray rvec2, InputArray tvec2,
+                             OutputArray rvec3, OutputArray tvec3,
+                             OutputArray dr3dr1 = noArray(), OutputArray dr3dt1 = noArray(),
+                             OutputArray dr3dr2 = noArray(), OutputArray dr3dt2 = noArray(),
+                             OutputArray dt3dr1 = noArray(), OutputArray dt3dt1 = noArray(),
+                             OutputArray dt3dr2 = noArray(), OutputArray dt3dt2 = noArray() );
+
+/** @brief Projects 3D points to an image plane.
+
+@param objectPoints Array of object points, 3xN/Nx3 1-channel or 1xN/Nx1 3-channel (or
+vector\<Point3f\> ), where N is the number of points in the view.
+@param rvec Rotation vector. See Rodrigues for details.
+@param tvec Translation vector.
+@param cameraMatrix Camera matrix \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. If the vector is empty, the zero distortion coefficients are assumed.
+@param imagePoints Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, or
+vector\<Point2f\> .
+@param jacobian Optional output 2Nx(10+\<numDistCoeffs\>) jacobian matrix of derivatives of image
+points with respect to components of the rotation vector, translation vector, focal lengths,
+coordinates of the principal point and the distortion coefficients. In the old interface different
+components of the jacobian are returned via different output parameters.
+@param aspectRatio Optional "fixed aspect ratio" parameter. If the parameter is not 0, the
+function assumes that the aspect ratio (*fx/fy*) is fixed and correspondingly adjusts the jacobian
+matrix.
+
+The function computes projections of 3D points to the image plane given intrinsic and extrinsic
+camera parameters. Optionally, the function computes Jacobians - matrices of partial derivatives of
+image points coordinates (as functions of all the input parameters) with respect to the particular
+parameters, intrinsic and/or extrinsic. The Jacobians are used during the global optimization in
+calibrateCamera, solvePnP, and stereoCalibrate . The function itself can also be used to compute a
+re-projection error given the current intrinsic and extrinsic parameters.
+
+@note By setting rvec=tvec=(0,0,0) or by setting cameraMatrix to a 3x3 identity matrix, or by
+passing zero distortion coefficients, you can get various useful partial cases of the function. This
+means that you can compute the distorted coordinates for a sparse set of points or apply a
+perspective transformation (and also compute the derivatives) in the ideal zero-distortion setup.
+ */
+CV_EXPORTS_W void projectPoints( InputArray objectPoints,
+                                 InputArray rvec, InputArray tvec,
+                                 InputArray cameraMatrix, InputArray distCoeffs,
+                                 OutputArray imagePoints,
+                                 OutputArray jacobian = noArray(),
+                                 double aspectRatio = 0 );
+
+/** @brief Finds an object pose from 3D-2D point correspondences.
+
+@param objectPoints Array of object points in the object coordinate space, 3xN/Nx3 1-channel or
+1xN/Nx1 3-channel, where N is the number of points. vector\<Point3f\> can be also passed here.
+@param imagePoints Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel,
+where N is the number of points. vector\<Point2f\> can be also passed here.
+@param cameraMatrix Input camera matrix \f$A = \vecthreethree{fx}{0}{cx}{0}{fy}{cy}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are
+assumed.
+@param rvec Output rotation vector (see Rodrigues ) that, together with tvec , brings points from
+the model coordinate system to the camera coordinate system.
+@param tvec Output translation vector.
+@param useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses
+the provided rvec and tvec values as initial approximations of the rotation and translation
+vectors, respectively, and further optimizes them.
+@param flags Method for solving a PnP problem:
+-   **SOLVEPNP_ITERATIVE** Iterative method is based on Levenberg-Marquardt optimization. In
+this case the function finds such a pose that minimizes reprojection error, that is the sum
+of squared distances between the observed projections imagePoints and the projected (using
+projectPoints ) objectPoints .
+-   **SOLVEPNP_P3P** Method is based on the paper of X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang
+"Complete Solution Classification for the Perspective-Three-Point Problem". In this case the
+function requires exactly four object and image points.
+-   **SOLVEPNP_EPNP** Method has been introduced by F.Moreno-Noguer, V.Lepetit and P.Fua in the
+paper "EPnP: Efficient Perspective-n-Point Camera Pose Estimation".
+-   **SOLVEPNP_DLS** Method is based on the paper of Joel A. Hesch and Stergios I. Roumeliotis.
+"A Direct Least-Squares (DLS) Method for PnP".
+-   **SOLVEPNP_UPNP** Method is based on the paper of A.Penate-Sanchez, J.Andrade-Cetto,
+F.Moreno-Noguer. "Exhaustive Linearization for Robust Camera Pose and Focal Length
+Estimation". In this case the function also estimates the parameters \f$f_x\f$ and \f$f_y\f$
+assuming that both have the same value. Then the cameraMatrix is updated with the estimated
+focal length.
+
+The function estimates the object pose given a set of object points, their corresponding image
+projections, as well as the camera matrix and the distortion coefficients.
+
+@note
+   -   An example of how to use solvePnP for planar augmented reality can be found at
+        opencv_source_code/samples/python/plane_ar.py
+   -   If you are using Python:
+        - Numpy array slices won't work as input because solvePnP requires contiguous
+        arrays (enforced by the assertion using cv::Mat::checkVector() around line 55 of
+        modules/calib3d/src/solvepnp.cpp version 2.4.9)
+        - The P3P algorithm requires image points to be in an array of shape (N,1,2) due
+        to its calling of cv::undistortPoints (around line 75 of modules/calib3d/src/solvepnp.cpp version 2.4.9)
+        which requires 2-channel information.
+        - Thus, given some data D = np.array(...) where D.shape = (N,M), in order to use a subset of
+        it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
+        np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
+ */
+CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints,
+                            InputArray cameraMatrix, InputArray distCoeffs,
+                            OutputArray rvec, OutputArray tvec,
+                            bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE );
+
+/** @brief Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
+
+@param objectPoints Array of object points in the object coordinate space, 3xN/Nx3 1-channel or
+1xN/Nx1 3-channel, where N is the number of points. vector\<Point3f\> can be also passed here.
+@param imagePoints Array of corresponding image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel,
+where N is the number of points. vector\<Point2f\> can be also passed here.
+@param cameraMatrix Input camera matrix \f$A = \vecthreethree{fx}{0}{cx}{0}{fy}{cy}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are
+assumed.
+@param rvec Output rotation vector (see Rodrigues ) that, together with tvec , brings points from
+the model coordinate system to the camera coordinate system.
+@param tvec Output translation vector.
+@param useExtrinsicGuess Parameter used for SOLVEPNP_ITERATIVE. If true (1), the function uses
+the provided rvec and tvec values as initial approximations of the rotation and translation
+vectors, respectively, and further optimizes them.
+@param iterationsCount Number of iterations.
+@param reprojectionError Inlier threshold value used by the RANSAC procedure. The parameter value
+is the maximum allowed distance between the observed and computed point projections to consider it
+an inlier.
+@param confidence The probability that the algorithm produces a useful result.
+@param inliers Output vector that contains indices of inliers in objectPoints and imagePoints .
+@param flags Method for solving a PnP problem (see solvePnP ).
+
+The function estimates an object pose given a set of object points, their corresponding image
+projections, as well as the camera matrix and the distortion coefficients. This function finds such
+a pose that minimizes reprojection error, that is, the sum of squared distances between the observed
+projections imagePoints and the projected (using projectPoints ) objectPoints. The use of RANSAC
+makes the function resistant to outliers.
+
+@note
+   -   An example of how to use solvePNPRansac for object detection can be found at
+        opencv_source_code/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/
+ */
+CV_EXPORTS_W bool solvePnPRansac( InputArray objectPoints, InputArray imagePoints,
+                                  InputArray cameraMatrix, InputArray distCoeffs,
+                                  OutputArray rvec, OutputArray tvec,
+                                  bool useExtrinsicGuess = false, int iterationsCount = 100,
+                                  float reprojectionError = 8.0, double confidence = 0.99,
+                                  OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE );
+
+/** @brief Finds an initial camera matrix from 3D-2D point correspondences.
+
+@param objectPoints Vector of vectors of the calibration pattern points in the calibration pattern
+coordinate space. In the old interface all the per-view vectors are concatenated. See
+calibrateCamera for details.
+@param imagePoints Vector of vectors of the projections of the calibration pattern points. In the
+old interface all the per-view vectors are concatenated.
+@param imageSize Image size in pixels used to initialize the principal point.
+@param aspectRatio If it is zero or negative, both \f$f_x\f$ and \f$f_y\f$ are estimated independently.
+Otherwise, \f$f_x = f_y * \texttt{aspectRatio}\f$ .
+
+The function estimates and returns an initial camera matrix for the camera calibration process.
+Currently, the function only supports planar calibration patterns, which are patterns where each
+object point has z-coordinate =0.
+ */
+CV_EXPORTS_W Mat initCameraMatrix2D( InputArrayOfArrays objectPoints,
+                                     InputArrayOfArrays imagePoints,
+                                     Size imageSize, double aspectRatio = 1.0 );
+
+/** @brief Finds the positions of internal corners of the chessboard.
+
+@param image Source chessboard view. It must be an 8-bit grayscale or color image.
+@param patternSize Number of inner corners per a chessboard row and column
+( patternSize = cvSize(points_per_row,points_per_colum) = cvSize(columns,rows) ).
+@param corners Output array of detected corners.
+@param flags Various operation flags that can be zero or a combination of the following values:
+-   **CV_CALIB_CB_ADAPTIVE_THRESH** Use adaptive thresholding to convert the image to black
+and white, rather than a fixed threshold level (computed from the average image brightness).
+-   **CV_CALIB_CB_NORMALIZE_IMAGE** Normalize the image gamma with equalizeHist before
+applying fixed or adaptive thresholding.
+-   **CV_CALIB_CB_FILTER_QUADS** Use additional criteria (like contour area, perimeter,
+square-like shape) to filter out false quads extracted at the contour retrieval stage.
+-   **CALIB_CB_FAST_CHECK** Run a fast check on the image that looks for chessboard corners,
+and shortcut the call if none is found. This can drastically speed up the call in the
+degenerate condition when no chessboard is observed.
+
+The function attempts to determine whether the input image is a view of the chessboard pattern and
+locate the internal chessboard corners. The function returns a non-zero value if all of the corners
+are found and they are placed in a certain order (row by row, left to right in every row).
+Otherwise, if the function fails to find all the corners or reorder them, it returns 0. For example,
+a regular chessboard has 8 x 8 squares and 7 x 7 internal corners, that is, points where the black
+squares touch each other. The detected coordinates are approximate, and to determine their positions
+more accurately, the function calls cornerSubPix. You also may use the function cornerSubPix with
+different parameters if returned coordinates are not accurate enough.
+
+Sample usage of detecting and drawing chessboard corners: :
+@code
+    Size patternsize(8,6); //interior number of corners
+    Mat gray = ....; //source image
+    vector<Point2f> corners; //this will be filled by the detected corners
+
+    //CALIB_CB_FAST_CHECK saves a lot of time on images
+    //that do not contain any chessboard corners
+    bool patternfound = findChessboardCorners(gray, patternsize, corners,
+            CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE
+            + CALIB_CB_FAST_CHECK);
+
+    if(patternfound)
+      cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1),
+        TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
+
+    drawChessboardCorners(img, patternsize, Mat(corners), patternfound);
+@endcode
+@note The function requires white space (like a square-thick border, the wider the better) around
+the board to make the detection more robust in various environments. Otherwise, if there is no
+border and the background is dark, the outer black squares cannot be segmented properly and so the
+square grouping and ordering algorithm fails.
+ */
+CV_EXPORTS_W bool findChessboardCorners( InputArray image, Size patternSize, OutputArray corners,
+                                         int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE );
+
+//! finds subpixel-accurate positions of the chessboard corners
+CV_EXPORTS bool find4QuadCornerSubpix( InputArray img, InputOutputArray corners, Size region_size );
+
+/** @brief Renders the detected chessboard corners.
+
+@param image Destination image. It must be an 8-bit color image.
+@param patternSize Number of inner corners per a chessboard row and column
+(patternSize = cv::Size(points_per_row,points_per_column)).
+@param corners Array of detected corners, the output of findChessboardCorners.
+@param patternWasFound Parameter indicating whether the complete board was found or not. The
+return value of findChessboardCorners should be passed here.
+
+The function draws individual chessboard corners detected either as red circles if the board was not
+found, or as colored corners connected with lines if the board was found.
+ */
+CV_EXPORTS_W void drawChessboardCorners( InputOutputArray image, Size patternSize,
+                                         InputArray corners, bool patternWasFound );
+
+/** @brief Finds centers in the grid of circles.
+
+@param image grid view of input circles; it must be an 8-bit grayscale or color image.
+@param patternSize number of circles per row and column
+( patternSize = Size(points_per_row, points_per_colum) ).
+@param centers output array of detected centers.
+@param flags various operation flags that can be one of the following values:
+-   **CALIB_CB_SYMMETRIC_GRID** uses symmetric pattern of circles.
+-   **CALIB_CB_ASYMMETRIC_GRID** uses asymmetric pattern of circles.
+-   **CALIB_CB_CLUSTERING** uses a special algorithm for grid detection. It is more robust to
+perspective distortions but much more sensitive to background clutter.
+@param blobDetector feature detector that finds blobs like dark circles on light background.
+
+The function attempts to determine whether the input image contains a grid of circles. If it is, the
+function locates centers of the circles. The function returns a non-zero value if all of the centers
+have been found and they have been placed in a certain order (row by row, left to right in every
+row). Otherwise, if the function fails to find all the corners or reorder them, it returns 0.
+
+Sample usage of detecting and drawing the centers of circles: :
+@code
+    Size patternsize(7,7); //number of centers
+    Mat gray = ....; //source image
+    vector<Point2f> centers; //this will be filled by the detected centers
+
+    bool patternfound = findCirclesGrid(gray, patternsize, centers);
+
+    drawChessboardCorners(img, patternsize, Mat(centers), patternfound);
+@endcode
+@note The function requires white space (like a square-thick border, the wider the better) around
+the board to make the detection more robust in various environments.
+ */
+CV_EXPORTS_W bool findCirclesGrid( InputArray image, Size patternSize,
+                                   OutputArray centers, int flags = CALIB_CB_SYMMETRIC_GRID,
+                                   const Ptr<FeatureDetector> &blobDetector = SimpleBlobDetector::create());
+
+/** @brief Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
+
+@param objectPoints In the new interface it is a vector of vectors of calibration pattern points in
+the calibration pattern coordinate space (e.g. std::vector<std::vector<cv::Vec3f>>). The outer
+vector contains as many elements as the number of the pattern views. If the same calibration pattern
+is shown in each view and it is fully visible, all the vectors will be the same. Although, it is
+possible to use partially occluded patterns, or even different patterns in different views. Then,
+the vectors will be different. The points are 3D, but since they are in a pattern coordinate system,
+then, if the rig is planar, it may make sense to put the model to a XY coordinate plane so that
+Z-coordinate of each input object point is 0.
+In the old interface all the vectors of object points from different views are concatenated
+together.
+@param imagePoints In the new interface it is a vector of vectors of the projections of calibration
+pattern points (e.g. std::vector<std::vector<cv::Vec2f>>). imagePoints.size() and
+objectPoints.size() and imagePoints[i].size() must be equal to objectPoints[i].size() for each i.
+In the old interface all the vectors of object points from different views are concatenated
+together.
+@param imageSize Size of the image used only to initialize the intrinsic camera matrix.
+@param cameraMatrix Output 3x3 floating-point camera matrix
+\f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . If CV\_CALIB\_USE\_INTRINSIC\_GUESS
+and/or CV_CALIB_FIX_ASPECT_RATIO are specified, some or all of fx, fy, cx, cy must be
+initialized before calling the function.
+@param distCoeffs Output vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements.
+@param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view
+(e.g. std::vector<cv::Mat>>). That is, each k-th rotation vector together with the corresponding
+k-th translation vector (see the next output parameter description) brings the calibration pattern
+from the model coordinate space (in which object points are specified) to the world coordinate
+space, that is, a real position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
+@param tvecs Output vector of translation vectors estimated for each pattern view.
+@param flags Different flags that may be zero or a combination of the following values:
+-   **CV_CALIB_USE_INTRINSIC_GUESS** cameraMatrix contains valid initial values of
+fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+Note, that if intrinsic parameters are known, there is no need to use this function just to
+estimate extrinsic parameters. Use solvePnP instead.
+-   **CV_CALIB_FIX_PRINCIPAL_POINT** The principal point is not changed during the global
+optimization. It stays at the center or at a different location specified when
+CV_CALIB_USE_INTRINSIC_GUESS is set too.
+-   **CV_CALIB_FIX_ASPECT_RATIO** The functions considers only fy as a free parameter. The
+ratio fx/fy stays the same as in the input cameraMatrix . When
+CV_CALIB_USE_INTRINSIC_GUESS is not set, the actual input values of fx and fy are
+ignored, only their ratio is computed and used further.
+-   **CV_CALIB_ZERO_TANGENT_DIST** Tangential distortion coefficients \f$(p_1, p_2)\f$ are set
+to zeros and stay zero.
+-   **CV_CALIB_FIX_K1,...,CV_CALIB_FIX_K6** The corresponding radial distortion
+coefficient is not changed during the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is
+set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+-   **CV_CALIB_RATIONAL_MODEL** Coefficients k4, k5, and k6 are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the rational model and return 8 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_THIN_PRISM_MODEL** Coefficients s1, s2, s3 and s4 are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the thin prism model and return 12 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_FIX_S1_S2_S3_S4** The thin prism distortion coefficients are not changed during
+the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+-   **CALIB_TILTED_MODEL** Coefficients tauX and tauY are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_FIX_TAUX_TAUY** The coefficients of the tilted sensor model are not changed during
+the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+@param criteria Termination criteria for the iterative optimization algorithm.
+
+The function estimates the intrinsic camera parameters and extrinsic parameters for each of the
+views. The algorithm is based on @cite Zhang2000 and @cite BouguetMCT . The coordinates of 3D object
+points and their corresponding 2D projections in each view must be specified. That may be achieved
+by using an object with a known geometry and easily detectable feature points. Such an object is
+called a calibration rig or calibration pattern, and OpenCV has built-in support for a chessboard as
+a calibration rig (see findChessboardCorners ). Currently, initialization of intrinsic parameters
+(when CV_CALIB_USE_INTRINSIC_GUESS is not set) is only implemented for planar calibration
+patterns (where Z-coordinates of the object points must be all zeros). 3D calibration rigs can also
+be used as long as initial cameraMatrix is provided.
+
+The algorithm performs the following steps:
+
+-   Compute the initial intrinsic parameters (the option only available for planar calibration
+    patterns) or read them from the input parameters. The distortion coefficients are all set to
+    zeros initially unless some of CV_CALIB_FIX_K? are specified.
+
+-   Estimate the initial camera pose as if the intrinsic parameters have been already known. This is
+    done using solvePnP .
+
+-   Run the global Levenberg-Marquardt optimization algorithm to minimize the reprojection error,
+    that is, the total sum of squared distances between the observed feature points imagePoints and
+    the projected (using the current estimates for camera parameters and the poses) object points
+    objectPoints. See projectPoints for details.
+
+The function returns the final re-projection error.
+
+@note
+   If you use a non-square (=non-NxN) grid and findChessboardCorners for calibration, and
+    calibrateCamera returns bad values (zero distortion coefficients, an image center very far from
+    (w/2-0.5,h/2-0.5), and/or large differences between \f$f_x\f$ and \f$f_y\f$ (ratios of 10:1 or more)),
+    then you have probably used patternSize=cvSize(rows,cols) instead of using
+    patternSize=cvSize(cols,rows) in findChessboardCorners .
+
+@sa
+   findChessboardCorners, solvePnP, initCameraMatrix2D, stereoCalibrate, undistort
+ */
+CV_EXPORTS_W double calibrateCamera( InputArrayOfArrays objectPoints,
+                                     InputArrayOfArrays imagePoints, Size imageSize,
+                                     InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
+                                     OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs,
+                                     int flags = 0, TermCriteria criteria = TermCriteria(
+                                        TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON) );
+
+/** @brief Computes useful camera characteristics from the camera matrix.
+
+@param cameraMatrix Input camera matrix that can be estimated by calibrateCamera or
+stereoCalibrate .
+@param imageSize Input image size in pixels.
+@param apertureWidth Physical width in mm of the sensor.
+@param apertureHeight Physical height in mm of the sensor.
+@param fovx Output field of view in degrees along the horizontal sensor axis.
+@param fovy Output field of view in degrees along the vertical sensor axis.
+@param focalLength Focal length of the lens in mm.
+@param principalPoint Principal point in mm.
+@param aspectRatio \f$f_y/f_x\f$
+
+The function computes various useful camera characteristics from the previously estimated camera
+matrix.
+
+@note
+   Do keep in mind that the unity measure 'mm' stands for whatever unit of measure one chooses for
+    the chessboard pitch (it can thus be any value).
+ */
+CV_EXPORTS_W void calibrationMatrixValues( InputArray cameraMatrix, Size imageSize,
+                                           double apertureWidth, double apertureHeight,
+                                           CV_OUT double& fovx, CV_OUT double& fovy,
+                                           CV_OUT double& focalLength, CV_OUT Point2d& principalPoint,
+                                           CV_OUT double& aspectRatio );
+
+/** @brief Calibrates the stereo camera.
+
+@param objectPoints Vector of vectors of the calibration pattern points.
+@param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+observed by the first camera.
+@param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+observed by the second camera.
+@param cameraMatrix1 Input/output first camera matrix:
+\f$\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\f$ , \f$j = 0,\, 1\f$ . If
+any of CV_CALIB_USE_INTRINSIC_GUESS , CV_CALIB_FIX_ASPECT_RATIO ,
+CV_CALIB_FIX_INTRINSIC , or CV_CALIB_FIX_FOCAL_LENGTH are specified, some or all of the
+matrix components must be initialized. See the flags description for details.
+@param distCoeffs1 Input/output vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. The output vector length depends on the flags.
+@param cameraMatrix2 Input/output second camera matrix. The parameter is similar to cameraMatrix1
+@param distCoeffs2 Input/output lens distortion coefficients for the second camera. The parameter
+is similar to distCoeffs1 .
+@param imageSize Size of the image used only to initialize intrinsic camera matrix.
+@param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
+@param T Output translation vector between the coordinate systems of the cameras.
+@param E Output essential matrix.
+@param F Output fundamental matrix.
+@param flags Different flags that may be zero or a combination of the following values:
+-   **CV_CALIB_FIX_INTRINSIC** Fix cameraMatrix? and distCoeffs? so that only R, T, E , and F
+matrices are estimated.
+-   **CV_CALIB_USE_INTRINSIC_GUESS** Optimize some or all of the intrinsic parameters
+according to the specified flags. Initial values are provided by the user.
+-   **CV_CALIB_FIX_PRINCIPAL_POINT** Fix the principal points during the optimization.
+-   **CV_CALIB_FIX_FOCAL_LENGTH** Fix \f$f^{(j)}_x\f$ and \f$f^{(j)}_y\f$ .
+-   **CV_CALIB_FIX_ASPECT_RATIO** Optimize \f$f^{(j)}_y\f$ . Fix the ratio \f$f^{(j)}_x/f^{(j)}_y\f$
+.
+-   **CV_CALIB_SAME_FOCAL_LENGTH** Enforce \f$f^{(0)}_x=f^{(1)}_x\f$ and \f$f^{(0)}_y=f^{(1)}_y\f$ .
+-   **CV_CALIB_ZERO_TANGENT_DIST** Set tangential distortion coefficients for each camera to
+zeros and fix there.
+-   **CV_CALIB_FIX_K1,...,CV_CALIB_FIX_K6** Do not change the corresponding radial
+distortion coefficient during the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set,
+the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+-   **CV_CALIB_RATIONAL_MODEL** Enable coefficients k4, k5, and k6. To provide the backward
+compatibility, this extra flag should be explicitly specified to make the calibration
+function use the rational model and return 8 coefficients. If the flag is not set, the
+function computes and returns only 5 distortion coefficients.
+-   **CALIB_THIN_PRISM_MODEL** Coefficients s1, s2, s3 and s4 are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the thin prism model and return 12 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_FIX_S1_S2_S3_S4** The thin prism distortion coefficients are not changed during
+the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+-   **CALIB_TILTED_MODEL** Coefficients tauX and tauY are enabled. To provide the
+backward compatibility, this extra flag should be explicitly specified to make the
+calibration function use the tilted sensor model and return 14 coefficients. If the flag is not
+set, the function computes and returns only 5 distortion coefficients.
+-   **CALIB_FIX_TAUX_TAUY** The coefficients of the tilted sensor model are not changed during
+the optimization. If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the
+supplied distCoeffs matrix is used. Otherwise, it is set to 0.
+@param criteria Termination criteria for the iterative optimization algorithm.
+
+The function estimates transformation between two cameras making a stereo pair. If you have a stereo
+camera where the relative position and orientation of two cameras is fixed, and if you computed
+poses of an object relative to the first camera and to the second camera, (R1, T1) and (R2, T2),
+respectively (this can be done with solvePnP ), then those poses definitely relate to each other.
+This means that, given ( \f$R_1\f$,\f$T_1\f$ ), it should be possible to compute ( \f$R_2\f$,\f$T_2\f$ ). You only
+need to know the position and orientation of the second camera relative to the first camera. This is
+what the described function does. It computes ( \f$R\f$,\f$T\f$ ) so that:
+
+\f[R_2=R*R_1
+T_2=R*T_1 + T,\f]
+
+Optionally, it computes the essential matrix E:
+
+\f[E= \vecthreethree{0}{-T_2}{T_1}{T_2}{0}{-T_0}{-T_1}{T_0}{0} *R\f]
+
+where \f$T_i\f$ are components of the translation vector \f$T\f$ : \f$T=[T_0, T_1, T_2]^T\f$ . And the function
+can also compute the fundamental matrix F:
+
+\f[F = cameraMatrix2^{-T} E cameraMatrix1^{-1}\f]
+
+Besides the stereo-related information, the function can also perform a full calibration of each of
+two cameras. However, due to the high dimensionality of the parameter space and noise in the input
+data, the function can diverge from the correct solution. If the intrinsic parameters can be
+estimated with high accuracy for each of the cameras individually (for example, using
+calibrateCamera ), you are recommended to do so and then pass CV_CALIB_FIX_INTRINSIC flag to the
+function along with the computed intrinsic parameters. Otherwise, if all the parameters are
+estimated at once, it makes sense to restrict some parameters, for example, pass
+CV_CALIB_SAME_FOCAL_LENGTH and CV_CALIB_ZERO_TANGENT_DIST flags, which is usually a
+reasonable assumption.
+
+Similarly to calibrateCamera , the function minimizes the total re-projection error for all the
+points in all the available views from both cameras. The function returns the final value of the
+re-projection error.
+ */
+CV_EXPORTS_W double stereoCalibrate( InputArrayOfArrays objectPoints,
+                                     InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
+                                     InputOutputArray cameraMatrix1, InputOutputArray distCoeffs1,
+                                     InputOutputArray cameraMatrix2, InputOutputArray distCoeffs2,
+                                     Size imageSize, OutputArray R,OutputArray T, OutputArray E, OutputArray F,
+                                     int flags = CALIB_FIX_INTRINSIC,
+                                     TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6) );
+
+
+/** @brief Computes rectification transforms for each head of a calibrated stereo camera.
+
+@param cameraMatrix1 First camera matrix.
+@param distCoeffs1 First camera distortion parameters.
+@param cameraMatrix2 Second camera matrix.
+@param distCoeffs2 Second camera distortion parameters.
+@param imageSize Size of the image used for stereo calibration.
+@param R Rotation matrix between the coordinate systems of the first and the second cameras.
+@param T Translation vector between coordinate systems of the cameras.
+@param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
+@param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
+@param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+camera.
+@param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+camera.
+@param Q Output \f$4 \times 4\f$ disparity-to-depth mapping matrix (see reprojectImageTo3D ).
+@param flags Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY . If the flag is set,
+the function makes the principal points of each camera have the same pixel coordinates in the
+rectified views. And if the flag is not set, the function may still shift the images in the
+horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+useful image area.
+@param alpha Free scaling parameter. If it is -1 or absent, the function performs the default
+scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified
+images are zoomed and shifted so that only valid pixels are visible (no black areas after
+rectification). alpha=1 means that the rectified image is decimated and shifted so that all the
+pixels from the original images from the cameras are retained in the rectified images (no source
+image pixels are lost). Obviously, any intermediate value yields an intermediate result between
+those two extreme cases.
+@param newImageSize New image resolution after rectification. The same size should be passed to
+initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+is passed (default), it is set to the original imageSize . Setting it to larger value can help you
+preserve details in the original image, especially when there is a big radial distortion.
+@param validPixROI1 Optional output rectangles inside the rectified images where all the pixels
+are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+(see the picture below).
+@param validPixROI2 Optional output rectangles inside the rectified images where all the pixels
+are valid. If alpha=0 , the ROIs cover the whole images. Otherwise, they are likely to be smaller
+(see the picture below).
+
+The function computes the rotation matrices for each camera that (virtually) make both camera image
+planes the same plane. Consequently, this makes all the epipolar lines parallel and thus simplifies
+the dense stereo correspondence problem. The function takes the matrices computed by stereoCalibrate
+as input. As output, it provides two rotation matrices and also two projection matrices in the new
+coordinates. The function distinguishes the following two cases:
+
+-   **Horizontal stereo**: the first and the second camera views are shifted relative to each other
+    mainly along the x axis (with possible small vertical shift). In the rectified images, the
+    corresponding epipolar lines in the left and right cameras are horizontal and have the same
+    y-coordinate. P1 and P2 look like:
+
+    \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx_1 & 0 \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f]
+
+    \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx_2 & T_x*f \\ 0 & f & cy & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix} ,\f]
+
+    where \f$T_x\f$ is a horizontal shift between the cameras and \f$cx_1=cx_2\f$ if
+    CV_CALIB_ZERO_DISPARITY is set.
+
+-   **Vertical stereo**: the first and the second camera views are shifted relative to each other
+    mainly in vertical direction (and probably a bit in the horizontal direction too). The epipolar
+    lines in the rectified images are vertical and have the same x-coordinate. P1 and P2 look like:
+
+    \f[\texttt{P1} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_1 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix}\f]
+
+    \f[\texttt{P2} = \begin{bmatrix} f & 0 & cx & 0 \\ 0 & f & cy_2 & T_y*f \\ 0 & 0 & 1 & 0 \end{bmatrix} ,\f]
+
+    where \f$T_y\f$ is a vertical shift between the cameras and \f$cy_1=cy_2\f$ if CALIB_ZERO_DISPARITY is
+    set.
+
+As you can see, the first three columns of P1 and P2 will effectively be the new "rectified" camera
+matrices. The matrices, together with R1 and R2 , can then be passed to initUndistortRectifyMap to
+initialize the rectification map for each camera.
+
+See below the screenshot from the stereo_calib.cpp sample. Some red horizontal lines pass through
+the corresponding image regions. This means that the images are well rectified, which is what most
+stereo correspondence algorithms rely on. The green rectangles are roi1 and roi2 . You see that
+their interiors are all valid pixels.
+
+![image](pics/stereo_undistort.jpg)
+ */
+CV_EXPORTS_W void stereoRectify( InputArray cameraMatrix1, InputArray distCoeffs1,
+                                 InputArray cameraMatrix2, InputArray distCoeffs2,
+                                 Size imageSize, InputArray R, InputArray T,
+                                 OutputArray R1, OutputArray R2,
+                                 OutputArray P1, OutputArray P2,
+                                 OutputArray Q, int flags = CALIB_ZERO_DISPARITY,
+                                 double alpha = -1, Size newImageSize = Size(),
+                                 CV_OUT Rect* validPixROI1 = 0, CV_OUT Rect* validPixROI2 = 0 );
+
+/** @brief Computes a rectification transform for an uncalibrated stereo camera.
+
+@param points1 Array of feature points in the first image.
+@param points2 The corresponding points in the second image. The same formats as in
+findFundamentalMat are supported.
+@param F Input fundamental matrix. It can be computed from the same set of point pairs using
+findFundamentalMat .
+@param imgSize Size of the image.
+@param H1 Output rectification homography matrix for the first image.
+@param H2 Output rectification homography matrix for the second image.
+@param threshold Optional threshold used to filter out the outliers. If the parameter is greater
+than zero, all the point pairs that do not comply with the epipolar geometry (that is, the points
+for which \f$|\texttt{points2[i]}^T*\texttt{F}*\texttt{points1[i]}|>\texttt{threshold}\f$ ) are
+rejected prior to computing the homographies. Otherwise,all the points are considered inliers.
+
+The function computes the rectification transformations without knowing intrinsic parameters of the
+cameras and their relative position in the space, which explains the suffix "uncalibrated". Another
+related difference from stereoRectify is that the function outputs not the rectification
+transformations in the object (3D) space, but the planar perspective transformations encoded by the
+homography matrices H1 and H2 . The function implements the algorithm @cite Hartley99 .
+
+@note
+   While the algorithm does not need to know the intrinsic parameters of the cameras, it heavily
+    depends on the epipolar geometry. Therefore, if the camera lenses have a significant distortion,
+    it would be better to correct it before computing the fundamental matrix and calling this
+    function. For example, distortion coefficients can be estimated for each head of stereo camera
+    separately by using calibrateCamera . Then, the images can be corrected using undistort , or
+    just the point coordinates can be corrected with undistortPoints .
+ */
+CV_EXPORTS_W bool stereoRectifyUncalibrated( InputArray points1, InputArray points2,
+                                             InputArray F, Size imgSize,
+                                             OutputArray H1, OutputArray H2,
+                                             double threshold = 5 );
+
+//! computes the rectification transformations for 3-head camera, where all the heads are on the same line.
+CV_EXPORTS_W float rectify3Collinear( InputArray cameraMatrix1, InputArray distCoeffs1,
+                                      InputArray cameraMatrix2, InputArray distCoeffs2,
+                                      InputArray cameraMatrix3, InputArray distCoeffs3,
+                                      InputArrayOfArrays imgpt1, InputArrayOfArrays imgpt3,
+                                      Size imageSize, InputArray R12, InputArray T12,
+                                      InputArray R13, InputArray T13,
+                                      OutputArray R1, OutputArray R2, OutputArray R3,
+                                      OutputArray P1, OutputArray P2, OutputArray P3,
+                                      OutputArray Q, double alpha, Size newImgSize,
+                                      CV_OUT Rect* roi1, CV_OUT Rect* roi2, int flags );
+
+/** @brief Returns the new camera matrix based on the free scaling parameter.
+
+@param cameraMatrix Input camera matrix.
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ of
+4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are
+assumed.
+@param imageSize Original image size.
+@param alpha Free scaling parameter between 0 (when all the pixels in the undistorted image are
+valid) and 1 (when all the source image pixels are retained in the undistorted image). See
+stereoRectify for details.
+@param newImgSize Image size after rectification. By default,it is set to imageSize .
+@param validPixROI Optional output rectangle that outlines all-good-pixels region in the
+undistorted image. See roi1, roi2 description in stereoRectify .
+@param centerPrincipalPoint Optional flag that indicates whether in the new camera matrix the
+principal point should be at the image center or not. By default, the principal point is chosen to
+best fit a subset of the source image (determined by alpha) to the corrected image.
+@return new_camera_matrix Output new camera matrix.
+
+The function computes and returns the optimal new camera matrix based on the free scaling parameter.
+By varying this parameter, you may retrieve only sensible pixels alpha=0 , keep all the original
+image pixels if there is valuable information in the corners alpha=1 , or get something in between.
+When alpha\>0 , the undistortion result is likely to have some black pixels corresponding to
+"virtual" pixels outside of the captured distorted image. The original camera matrix, distortion
+coefficients, the computed new camera matrix, and newImageSize should be passed to
+initUndistortRectifyMap to produce the maps for remap .
+ */
+CV_EXPORTS_W Mat getOptimalNewCameraMatrix( InputArray cameraMatrix, InputArray distCoeffs,
+                                            Size imageSize, double alpha, Size newImgSize = Size(),
+                                            CV_OUT Rect* validPixROI = 0,
+                                            bool centerPrincipalPoint = false);
+
+/** @brief Converts points from Euclidean to homogeneous space.
+
+@param src Input vector of N-dimensional points.
+@param dst Output vector of N+1-dimensional points.
+
+The function converts points from Euclidean to homogeneous space by appending 1's to the tuple of
+point coordinates. That is, each point (x1, x2, ..., xn) is converted to (x1, x2, ..., xn, 1).
+ */
+CV_EXPORTS_W void convertPointsToHomogeneous( InputArray src, OutputArray dst );
+
+/** @brief Converts points from homogeneous to Euclidean space.
+
+@param src Input vector of N-dimensional points.
+@param dst Output vector of N-1-dimensional points.
+
+The function converts points homogeneous to Euclidean space using perspective projection. That is,
+each point (x1, x2, ... x(n-1), xn) is converted to (x1/xn, x2/xn, ..., x(n-1)/xn). When xn=0, the
+output point coordinates will be (0,0,0,...).
+ */
+CV_EXPORTS_W void convertPointsFromHomogeneous( InputArray src, OutputArray dst );
+
+/** @brief Converts points to/from homogeneous coordinates.
+
+@param src Input array or vector of 2D, 3D, or 4D points.
+@param dst Output vector of 2D, 3D, or 4D points.
+
+The function converts 2D or 3D points from/to homogeneous coordinates by calling either
+convertPointsToHomogeneous or convertPointsFromHomogeneous.
+
+@note The function is obsolete. Use one of the previous two functions instead.
+ */
+CV_EXPORTS void convertPointsHomogeneous( InputArray src, OutputArray dst );
+
+/** @brief Calculates a fundamental matrix from the corresponding points in two images.
+
+@param points1 Array of N points from the first image. The point coordinates should be
+floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param method Method for computing a fundamental matrix.
+-   **CV_FM_7POINT** for a 7-point algorithm. \f$N = 7\f$
+-   **CV_FM_8POINT** for an 8-point algorithm. \f$N \ge 8\f$
+-   **CV_FM_RANSAC** for the RANSAC algorithm. \f$N \ge 8\f$
+-   **CV_FM_LMEDS** for the LMedS algorithm. \f$N \ge 8\f$
+@param param1 Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+line in pixels, beyond which the point is considered an outlier and is not used for computing the
+final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+point localization, image resolution, and the image noise.
+@param param2 Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level
+of confidence (probability) that the estimated matrix is correct.
+@param mask
+
+The epipolar geometry is described by the following equation:
+
+\f[[p_2; 1]^T F [p_1; 1] = 0\f]
+
+where \f$F\f$ is a fundamental matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the
+second images, respectively.
+
+The function calculates the fundamental matrix using one of four methods listed above and returns
+the found fundamental matrix. Normally just one matrix is found. But in case of the 7-point
+algorithm, the function may return up to 3 solutions ( \f$9 \times 3\f$ matrix that stores all 3
+matrices sequentially).
+
+The calculated fundamental matrix may be passed further to computeCorrespondEpilines that finds the
+epipolar lines corresponding to the specified points. It can also be passed to
+stereoRectifyUncalibrated to compute the rectification transformation. :
+@code
+    // Example. Estimation of fundamental matrix using the RANSAC algorithm
+    int point_count = 100;
+    vector<Point2f> points1(point_count);
+    vector<Point2f> points2(point_count);
+
+    // initialize the points here ...
+    for( int i = 0; i < point_count; i++ )
+    {
+        points1[i] = ...;
+        points2[i] = ...;
+    }
+
+    Mat fundamental_matrix =
+     findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);
+@endcode
+ */
+CV_EXPORTS_W Mat findFundamentalMat( InputArray points1, InputArray points2,
+                                     int method = FM_RANSAC,
+                                     double param1 = 3., double param2 = 0.99,
+                                     OutputArray mask = noArray() );
+
+/** @overload */
+CV_EXPORTS Mat findFundamentalMat( InputArray points1, InputArray points2,
+                                   OutputArray mask, int method = FM_RANSAC,
+                                   double param1 = 3., double param2 = 0.99 );
+
+/** @brief Calculates an essential matrix from the corresponding points in two images.
+
+@param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
+be floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+Note that this function assumes that points1 and points2 are feature points from cameras with the
+same camera matrix.
+@param method Method for computing a fundamental matrix.
+-   **RANSAC** for the RANSAC algorithm.
+-   **MEDS** for the LMedS algorithm.
+@param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+line in pixels, beyond which the point is considered an outlier and is not used for computing the
+final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+point localization, image resolution, and the image noise.
+@param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+confidence (probability) that the estimated matrix is correct.
+@param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
+for the other points. The array is computed only in the RANSAC and LMedS methods.
+
+This function estimates essential matrix based on the five-point algorithm solver in @cite Nister03 .
+@cite SteweniusCFS is also a related. The epipolar geometry is described by the following equation:
+
+\f[[p_2; 1]^T K^{-T} E K^{-1} [p_1; 1] = 0\f]
+
+where \f$E\f$ is an essential matrix, \f$p_1\f$ and \f$p_2\f$ are corresponding points in the first and the
+second images, respectively. The result of this function may be passed further to
+decomposeEssentialMat or recoverPose to recover the relative pose between cameras.
+ */
+CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
+                                 InputArray cameraMatrix, int method = RANSAC,
+                                 double prob = 0.999, double threshold = 1.0,
+                                 OutputArray mask = noArray() );
+
+/** @overload
+@param points1 Array of N (N \>= 5) 2D points from the first image. The point coordinates should
+be floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param focal focal length of the camera. Note that this function assumes that points1 and points2
+are feature points from cameras with same focal length and principle point.
+@param pp principle point of the camera.
+@param method Method for computing a fundamental matrix.
+-   **RANSAC** for the RANSAC algorithm.
+-   **LMEDS** for the LMedS algorithm.
+@param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
+line in pixels, beyond which the point is considered an outlier and is not used for computing the
+final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the
+point localization, image resolution, and the image noise.
+@param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
+confidence (probability) that the estimated matrix is correct.
+@param mask Output array of N elements, every element of which is set to 0 for outliers and to 1
+for the other points. The array is computed only in the RANSAC and LMedS methods.
+
+This function differs from the one above that it computes camera matrix from focal length and
+principal point:
+
+\f[K =
+\begin{bmatrix}
+f & 0 & x_{pp}  \\
+0 & f & y_{pp}  \\
+0 & 0 & 1
+\end{bmatrix}\f]
+ */
+CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
+                                 double focal = 1.0, Point2d pp = Point2d(0, 0),
+                                 int method = RANSAC, double prob = 0.999,
+                                 double threshold = 1.0, OutputArray mask = noArray() );
+
+/** @brief Decompose an essential matrix to possible rotations and translation.
+
+@param E The input essential matrix.
+@param R1 One possible rotation matrix.
+@param R2 Another possible rotation matrix.
+@param t One possible translation.
+
+This function decompose an essential matrix E using svd decomposition @cite HartleyZ00 . Generally 4
+possible poses exists for a given E. They are \f$[R_1, t]\f$, \f$[R_1, -t]\f$, \f$[R_2, t]\f$, \f$[R_2, -t]\f$. By
+decomposing E, you can only get the direction of the translation, so the function returns unit t.
+ */
+CV_EXPORTS_W void decomposeEssentialMat( InputArray E, OutputArray R1, OutputArray R2, OutputArray t );
+
+/** @brief Recover relative camera rotation and translation from an estimated essential matrix and the
+corresponding points in two images, using cheirality check. Returns the number of inliers which pass
+the check.
+
+@param E The input essential matrix.
+@param points1 Array of N 2D points from the first image. The point coordinates should be
+floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+Note that this function assumes that points1 and points2 are feature points from cameras with the
+same camera matrix.
+@param R Recovered relative rotation.
+@param t Recoverd relative translation.
+@param mask Input/output mask for inliers in points1 and points2.
+:   If it is not empty, then it marks inliers in points1 and points2 for then given essential
+matrix E. Only these inliers will be used to recover pose. In the output mask only inliers
+which pass the cheirality check.
+This function decomposes an essential matrix using decomposeEssentialMat and then verifies possible
+pose hypotheses by doing cheirality check. The cheirality check basically means that the
+triangulated 3D points should have positive depth. Some details can be found in @cite Nister03 .
+
+This function can be used to process output E and mask from findEssentialMat. In this scenario,
+points1 and points2 are the same input for findEssentialMat. :
+@code
+    // Example. Estimation of fundamental matrix using the RANSAC algorithm
+    int point_count = 100;
+    vector<Point2f> points1(point_count);
+    vector<Point2f> points2(point_count);
+
+    // initialize the points here ...
+    for( int i = 0; i < point_count; i++ )
+    {
+        points1[i] = ...;
+        points2[i] = ...;
+    }
+
+    // cametra matrix with both focal lengths = 1, and principal point = (0, 0)
+    Mat cameraMatrix = Mat::eye(3, 3, CV_64F);
+
+    Mat E, R, t, mask;
+
+    E = findEssentialMat(points1, points2, cameraMatrix, RANSAC, 0.999, 1.0, mask);
+    recoverPose(E, points1, points2, cameraMatrix, R, t, mask);
+@endcode
+ */
+CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray points2,
+                            InputArray cameraMatrix, OutputArray R, OutputArray t,
+                            InputOutputArray mask = noArray() );
+
+/** @overload
+@param E The input essential matrix.
+@param points1 Array of N 2D points from the first image. The point coordinates should be
+floating-point (single or double precision).
+@param points2 Array of the second image points of the same size and format as points1 .
+@param R Recovered relative rotation.
+@param t Recoverd relative translation.
+@param focal Focal length of the camera. Note that this function assumes that points1 and points2
+are feature points from cameras with same focal length and principle point.
+@param pp Principle point of the camera.
+@param mask Input/output mask for inliers in points1 and points2.
+:   If it is not empty, then it marks inliers in points1 and points2 for then given essential
+matrix E. Only these inliers will be used to recover pose. In the output mask only inliers
+which pass the cheirality check.
+
+This function differs from the one above that it computes camera matrix from focal length and
+principal point:
+
+\f[K =
+\begin{bmatrix}
+f & 0 & x_{pp}  \\
+0 & f & y_{pp}  \\
+0 & 0 & 1
+\end{bmatrix}\f]
+ */
+CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray points2,
+                            OutputArray R, OutputArray t,
+                            double focal = 1.0, Point2d pp = Point2d(0, 0),
+                            InputOutputArray mask = noArray() );
+
+/** @brief For points in an image of a stereo pair, computes the corresponding epilines in the other image.
+
+@param points Input points. \f$N \times 1\f$ or \f$1 \times N\f$ matrix of type CV_32FC2 or
+vector\<Point2f\> .
+@param whichImage Index of the image (1 or 2) that contains the points .
+@param F Fundamental matrix that can be estimated using findFundamentalMat or stereoRectify .
+@param lines Output vector of the epipolar lines corresponding to the points in the other image.
+Each line \f$ax + by + c=0\f$ is encoded by 3 numbers \f$(a, b, c)\f$ .
+
+For every point in one of the two images of a stereo pair, the function finds the equation of the
+corresponding epipolar line in the other image.
+
+From the fundamental matrix definition (see findFundamentalMat ), line \f$l^{(2)}_i\f$ in the second
+image for the point \f$p^{(1)}_i\f$ in the first image (when whichImage=1 ) is computed as:
+
+\f[l^{(2)}_i = F p^{(1)}_i\f]
+
+And vice versa, when whichImage=2, \f$l^{(1)}_i\f$ is computed from \f$p^{(2)}_i\f$ as:
+
+\f[l^{(1)}_i = F^T p^{(2)}_i\f]
+
+Line coefficients are defined up to a scale. They are normalized so that \f$a_i^2+b_i^2=1\f$ .
+ */
+CV_EXPORTS_W void computeCorrespondEpilines( InputArray points, int whichImage,
+                                             InputArray F, OutputArray lines );
+
+/** @brief Reconstructs points by triangulation.
+
+@param projMatr1 3x4 projection matrix of the first camera.
+@param projMatr2 3x4 projection matrix of the second camera.
+@param projPoints1 2xN array of feature points in the first image. In case of c++ version it can
+be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
+@param projPoints2 2xN array of corresponding points in the second image. In case of c++ version
+it can be also a vector of feature points or two-channel matrix of size 1xN or Nx1.
+@param points4D 4xN array of reconstructed points in homogeneous coordinates.
+
+The function reconstructs 3-dimensional points (in homogeneous coordinates) by using their
+observations with a stereo camera. Projections matrices can be obtained from stereoRectify.
+
+@note
+   Keep in mind that all input data should be of float type in order for this function to work.
+
+@sa
+   reprojectImageTo3D
+ */
+CV_EXPORTS_W void triangulatePoints( InputArray projMatr1, InputArray projMatr2,
+                                     InputArray projPoints1, InputArray projPoints2,
+                                     OutputArray points4D );
+
+/** @brief Refines coordinates of corresponding points.
+
+@param F 3x3 fundamental matrix.
+@param points1 1xN array containing the first set of points.
+@param points2 1xN array containing the second set of points.
+@param newPoints1 The optimized points1.
+@param newPoints2 The optimized points2.
+
+The function implements the Optimal Triangulation Method (see Multiple View Geometry for details).
+For each given point correspondence points1[i] \<-\> points2[i], and a fundamental matrix F, it
+computes the corrected correspondences newPoints1[i] \<-\> newPoints2[i] that minimize the geometric
+error \f$d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2\f$ (where \f$d(a,b)\f$ is the
+geometric distance between points \f$a\f$ and \f$b\f$ ) subject to the epipolar constraint
+\f$newPoints2^T * F * newPoints1 = 0\f$ .
+ */
+CV_EXPORTS_W void correctMatches( InputArray F, InputArray points1, InputArray points2,
+                                  OutputArray newPoints1, OutputArray newPoints2 );
+
+/** @brief Filters off small noise blobs (speckles) in the disparity map
+
+@param img The input 16-bit signed disparity image
+@param newVal The disparity value used to paint-off the speckles
+@param maxSpeckleSize The maximum speckle size to consider it a speckle. Larger blobs are not
+affected by the algorithm
+@param maxDiff Maximum difference between neighbor disparity pixels to put them into the same
+blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point
+disparity map, where disparity values are multiplied by 16, this scale factor should be taken into
+account when specifying this parameter value.
+@param buf The optional temporary buffer to avoid memory allocation within the function.
+ */
+CV_EXPORTS_W void filterSpeckles( InputOutputArray img, double newVal,
+                                  int maxSpeckleSize, double maxDiff,
+                                  InputOutputArray buf = noArray() );
+
+//! computes valid disparity ROI from the valid ROIs of the rectified images (that are returned by cv::stereoRectify())
+CV_EXPORTS_W Rect getValidDisparityROI( Rect roi1, Rect roi2,
+                                        int minDisparity, int numberOfDisparities,
+                                        int SADWindowSize );
+
+//! validates disparity using the left-right check. The matrix "cost" should be computed by the stereo correspondence algorithm
+CV_EXPORTS_W void validateDisparity( InputOutputArray disparity, InputArray cost,
+                                     int minDisparity, int numberOfDisparities,
+                                     int disp12MaxDisp = 1 );
+
+/** @brief Reprojects a disparity image to 3D space.
+
+@param disparity Input single-channel 8-bit unsigned, 16-bit signed, 32-bit signed or 32-bit
+floating-point disparity image. If 16-bit signed format is used, the values are assumed to have no
+fractional bits.
+@param _3dImage Output 3-channel floating-point image of the same size as disparity . Each
+element of _3dImage(x,y) contains 3D coordinates of the point (x,y) computed from the disparity
+map.
+@param Q \f$4 \times 4\f$ perspective transformation matrix that can be obtained with stereoRectify.
+@param handleMissingValues Indicates, whether the function should handle missing values (i.e.
+points where the disparity was not computed). If handleMissingValues=true, then pixels with the
+minimal disparity that corresponds to the outliers (see StereoMatcher::compute ) are transformed
+to 3D points with a very large Z value (currently set to 10000).
+@param ddepth The optional output array depth. If it is -1, the output image will have CV_32F
+depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
+
+The function transforms a single-channel disparity map to a 3-channel image representing a 3D
+surface. That is, for each pixel (x,y) andthe corresponding disparity d=disparity(x,y) , it
+computes:
+
+\f[\begin{array}{l} [X \; Y \; Z \; W]^T =  \texttt{Q} *[x \; y \; \texttt{disparity} (x,y) \; 1]^T  \\ \texttt{\_3dImage} (x,y) = (X/W, \; Y/W, \; Z/W) \end{array}\f]
+
+The matrix Q can be an arbitrary \f$4 \times 4\f$ matrix (for example, the one computed by
+stereoRectify). To reproject a sparse set of points {(x,y,d),...} to 3D space, use
+perspectiveTransform .
+ */
+CV_EXPORTS_W void reprojectImageTo3D( InputArray disparity,
+                                      OutputArray _3dImage, InputArray Q,
+                                      bool handleMissingValues = false,
+                                      int ddepth = -1 );
+
+/** @brief Calculates the Sampson Distance between two points.
+
+The function sampsonDistance calculates and returns the first order approximation of the geometric error as:
+\f[sd( \texttt{pt1} , \texttt{pt2} )= \frac{(\texttt{pt2}^t \cdot \texttt{F} \cdot \texttt{pt1})^2}{(\texttt{F} \cdot \texttt{pt1})(0) + (\texttt{F} \cdot \texttt{pt1})(1) + (\texttt{F}^t \cdot \texttt{pt2})(0) + (\texttt{F}^t \cdot \texttt{pt2})(1)}\f]
+The fundamental matrix may be calculated using the cv::findFundamentalMat function. See HZ 11.4.3 for details.
+@param pt1 first homogeneous 2d point
+@param pt2 second homogeneous 2d point
+@param F fundamental matrix
+*/
+CV_EXPORTS_W double sampsonDistance(InputArray pt1, InputArray pt2, InputArray F);
+
+/** @brief Computes an optimal affine transformation between two 3D point sets.
+
+@param src First input 3D point set.
+@param dst Second input 3D point set.
+@param out Output 3D affine transformation matrix \f$3 \times 4\f$ .
+@param inliers Output vector indicating which points are inliers.
+@param ransacThreshold Maximum reprojection error in the RANSAC algorithm to consider a point as
+an inlier.
+@param confidence Confidence level, between 0 and 1, for the estimated transformation. Anything
+between 0.95 and 0.99 is usually good enough. Values too close to 1 can slow down the estimation
+significantly. Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.
+
+The function estimates an optimal 3D affine transformation between two 3D point sets using the
+RANSAC algorithm.
+ */
+CV_EXPORTS_W  int estimateAffine3D(InputArray src, InputArray dst,
+                                   OutputArray out, OutputArray inliers,
+                                   double ransacThreshold = 3, double confidence = 0.99);
+
+/** @brief Decompose a homography matrix to rotation(s), translation(s) and plane normal(s).
+
+@param H The input homography matrix between two images.
+@param K The input intrinsic camera calibration matrix.
+@param rotations Array of rotation matrices.
+@param translations Array of translation matrices.
+@param normals Array of plane normal matrices.
+
+This function extracts relative camera motion between two views observing a planar object from the
+homography H induced by the plane. The intrinsic camera matrix K must also be provided. The function
+may return up to four mathematical solution sets. At least two of the solutions may further be
+invalidated if point correspondences are available by applying positive depth constraint (all points
+must be in front of the camera). The decomposition method is described in detail in @cite Malis .
+ */
+CV_EXPORTS_W int decomposeHomographyMat(InputArray H,
+                                        InputArray K,
+                                        OutputArrayOfArrays rotations,
+                                        OutputArrayOfArrays translations,
+                                        OutputArrayOfArrays normals);
+
+/** @brief The base class for stereo correspondence algorithms.
+ */
+class CV_EXPORTS_W StereoMatcher : public Algorithm
+{
+public:
+    enum { DISP_SHIFT = 4,
+           DISP_SCALE = (1 << DISP_SHIFT)
+         };
+
+    /** @brief Computes disparity map for the specified stereo pair
+
+    @param left Left 8-bit single-channel image.
+    @param right Right image of the same size and the same type as the left one.
+    @param disparity Output disparity map. It has the same size as the input images. Some algorithms,
+    like StereoBM or StereoSGBM compute 16-bit fixed-point disparity map (where each disparity value
+    has 4 fractional bits), whereas other algorithms output 32-bit floating-point disparity map.
+     */
+    CV_WRAP virtual void compute( InputArray left, InputArray right,
+                                  OutputArray disparity ) = 0;
+
+    CV_WRAP virtual int getMinDisparity() const = 0;
+    CV_WRAP virtual void setMinDisparity(int minDisparity) = 0;
+
+    CV_WRAP virtual int getNumDisparities() const = 0;
+    CV_WRAP virtual void setNumDisparities(int numDisparities) = 0;
+
+    CV_WRAP virtual int getBlockSize() const = 0;
+    CV_WRAP virtual void setBlockSize(int blockSize) = 0;
+
+    CV_WRAP virtual int getSpeckleWindowSize() const = 0;
+    CV_WRAP virtual void setSpeckleWindowSize(int speckleWindowSize) = 0;
+
+    CV_WRAP virtual int getSpeckleRange() const = 0;
+    CV_WRAP virtual void setSpeckleRange(int speckleRange) = 0;
+
+    CV_WRAP virtual int getDisp12MaxDiff() const = 0;
+    CV_WRAP virtual void setDisp12MaxDiff(int disp12MaxDiff) = 0;
+};
+
+
+/** @brief Class for computing stereo correspondence using the block matching algorithm, introduced and
+contributed to OpenCV by K. Konolige.
+ */
+class CV_EXPORTS_W StereoBM : public StereoMatcher
+{
+public:
+    enum { PREFILTER_NORMALIZED_RESPONSE = 0,
+           PREFILTER_XSOBEL              = 1
+         };
+
+    CV_WRAP virtual int getPreFilterType() const = 0;
+    CV_WRAP virtual void setPreFilterType(int preFilterType) = 0;
+
+    CV_WRAP virtual int getPreFilterSize() const = 0;
+    CV_WRAP virtual void setPreFilterSize(int preFilterSize) = 0;
+
+    CV_WRAP virtual int getPreFilterCap() const = 0;
+    CV_WRAP virtual void setPreFilterCap(int preFilterCap) = 0;
+
+    CV_WRAP virtual int getTextureThreshold() const = 0;
+    CV_WRAP virtual void setTextureThreshold(int textureThreshold) = 0;
+
+    CV_WRAP virtual int getUniquenessRatio() const = 0;
+    CV_WRAP virtual void setUniquenessRatio(int uniquenessRatio) = 0;
+
+    CV_WRAP virtual int getSmallerBlockSize() const = 0;
+    CV_WRAP virtual void setSmallerBlockSize(int blockSize) = 0;
+
+    CV_WRAP virtual Rect getROI1() const = 0;
+    CV_WRAP virtual void setROI1(Rect roi1) = 0;
+
+    CV_WRAP virtual Rect getROI2() const = 0;
+    CV_WRAP virtual void setROI2(Rect roi2) = 0;
+
+    /** @brief Creates StereoBM object
+
+    @param numDisparities the disparity search range. For each pixel algorithm will find the best
+    disparity from 0 (default minimum disparity) to numDisparities. The search range can then be
+    shifted by changing the minimum disparity.
+    @param blockSize the linear size of the blocks compared by the algorithm. The size should be odd
+    (as the block is centered at the current pixel). Larger block size implies smoother, though less
+    accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher
+    chance for algorithm to find a wrong correspondence.
+
+    The function create StereoBM object. You can then call StereoBM::compute() to compute disparity for
+    a specific stereo pair.
+     */
+    CV_WRAP static Ptr<StereoBM> create(int numDisparities = 0, int blockSize = 21);
+};
+
+/** @brief The class implements the modified H. Hirschmuller algorithm @cite HH08 that differs from the original
+one as follows:
+
+-   By default, the algorithm is single-pass, which means that you consider only 5 directions
+instead of 8. Set mode=StereoSGBM::MODE_HH in createStereoSGBM to run the full variant of the
+algorithm but beware that it may consume a lot of memory.
+-   The algorithm matches blocks, not individual pixels. Though, setting blockSize=1 reduces the
+blocks to single pixels.
+-   Mutual information cost function is not implemented. Instead, a simpler Birchfield-Tomasi
+sub-pixel metric from @cite BT98 is used. Though, the color images are supported as well.
+-   Some pre- and post- processing steps from K. Konolige algorithm StereoBM are included, for
+example: pre-filtering (StereoBM::PREFILTER_XSOBEL type) and post-filtering (uniqueness
+check, quadratic interpolation and speckle filtering).
+
+@note
+   -   (Python) An example illustrating the use of the StereoSGBM matching algorithm can be found
+        at opencv_source_code/samples/python/stereo_match.py
+ */
+class CV_EXPORTS_W StereoSGBM : public StereoMatcher
+{
+public:
+    enum
+    {
+        MODE_SGBM = 0,
+        MODE_HH   = 1,
+        MODE_SGBM_3WAY = 2
+    };
+
+    CV_WRAP virtual int getPreFilterCap() const = 0;
+    CV_WRAP virtual void setPreFilterCap(int preFilterCap) = 0;
+
+    CV_WRAP virtual int getUniquenessRatio() const = 0;
+    CV_WRAP virtual void setUniquenessRatio(int uniquenessRatio) = 0;
+
+    CV_WRAP virtual int getP1() const = 0;
+    CV_WRAP virtual void setP1(int P1) = 0;
+
+    CV_WRAP virtual int getP2() const = 0;
+    CV_WRAP virtual void setP2(int P2) = 0;
+
+    CV_WRAP virtual int getMode() const = 0;
+    CV_WRAP virtual void setMode(int mode) = 0;
+
+    /** @brief Creates StereoSGBM object
+
+    @param minDisparity Minimum possible disparity value. Normally, it is zero but sometimes
+    rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
+    @param numDisparities Maximum disparity minus minimum disparity. The value is always greater than
+    zero. In the current implementation, this parameter must be divisible by 16.
+    @param blockSize Matched block size. It must be an odd number \>=1 . Normally, it should be
+    somewhere in the 3..11 range.
+    @param P1 The first parameter controlling the disparity smoothness. See below.
+    @param P2 The second parameter controlling the disparity smoothness. The larger the values are,
+    the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1
+    between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor
+    pixels. The algorithm requires P2 \> P1 . See stereo_match.cpp sample where some reasonably good
+    P1 and P2 values are shown (like 8\*number_of_image_channels\*SADWindowSize\*SADWindowSize and
+    32\*number_of_image_channels\*SADWindowSize\*SADWindowSize , respectively).
+    @param disp12MaxDiff Maximum allowed difference (in integer pixel units) in the left-right
+    disparity check. Set it to a non-positive value to disable the check.
+    @param preFilterCap Truncation value for the prefiltered image pixels. The algorithm first
+    computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval.
+    The result values are passed to the Birchfield-Tomasi pixel cost function.
+    @param uniquenessRatio Margin in percentage by which the best (minimum) computed cost function
+    value should "win" the second best value to consider the found match correct. Normally, a value
+    within the 5-15 range is good enough.
+    @param speckleWindowSize Maximum size of smooth disparity regions to consider their noise speckles
+    and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the
+    50-200 range.
+    @param speckleRange Maximum disparity variation within each connected component. If you do speckle
+    filtering, set the parameter to a positive value, it will be implicitly multiplied by 16.
+    Normally, 1 or 2 is good enough.
+    @param mode Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming
+    algorithm. It will consume O(W\*H\*numDisparities) bytes, which is large for 640x480 stereo and
+    huge for HD-size pictures. By default, it is set to false .
+
+    The first constructor initializes StereoSGBM with all the default parameters. So, you only have to
+    set StereoSGBM::numDisparities at minimum. The second constructor enables you to set each parameter
+    to a custom value.
+     */
+    CV_WRAP static Ptr<StereoSGBM> create(int minDisparity, int numDisparities, int blockSize,
+                                          int P1 = 0, int P2 = 0, int disp12MaxDiff = 0,
+                                          int preFilterCap = 0, int uniquenessRatio = 0,
+                                          int speckleWindowSize = 0, int speckleRange = 0,
+                                          int mode = StereoSGBM::MODE_SGBM);
+};
+
+//! @} calib3d
+
+/** @brief The methods in this namespace use a so-called fisheye camera model.
+  @ingroup calib3d_fisheye
+*/
+namespace fisheye
+{
+//! @addtogroup calib3d_fisheye
+//! @{
+
+    enum{
+        CALIB_USE_INTRINSIC_GUESS   = 1,
+        CALIB_RECOMPUTE_EXTRINSIC   = 2,
+        CALIB_CHECK_COND            = 4,
+        CALIB_FIX_SKEW              = 8,
+        CALIB_FIX_K1                = 16,
+        CALIB_FIX_K2                = 32,
+        CALIB_FIX_K3                = 64,
+        CALIB_FIX_K4                = 128,
+        CALIB_FIX_INTRINSIC         = 256
+    };
+
+    /** @brief Projects points using fisheye model
+
+    @param objectPoints Array of object points, 1xN/Nx1 3-channel (or vector\<Point3f\> ), where N is
+    the number of points in the view.
+    @param imagePoints Output array of image points, 2xN/Nx2 1-channel or 1xN/Nx1 2-channel, or
+    vector\<Point2f\>.
+    @param affine
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param alpha The skew coefficient.
+    @param jacobian Optional output 2Nx15 jacobian matrix of derivatives of image points with respect
+    to components of the focal lengths, coordinates of the principal point, distortion coefficients,
+    rotation vector, translation vector, and the skew. In the old interface different components of
+    the jacobian are returned via different output parameters.
+
+    The function computes projections of 3D points to the image plane given intrinsic and extrinsic
+    camera parameters. Optionally, the function computes Jacobians - matrices of partial derivatives of
+    image points coordinates (as functions of all the input parameters) with respect to the particular
+    parameters, intrinsic and/or extrinsic.
+     */
+    CV_EXPORTS void projectPoints(InputArray objectPoints, OutputArray imagePoints, const Affine3d& affine,
+        InputArray K, InputArray D, double alpha = 0, OutputArray jacobian = noArray());
+
+    /** @overload */
+    CV_EXPORTS_W void projectPoints(InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec,
+        InputArray K, InputArray D, double alpha = 0, OutputArray jacobian = noArray());
+
+    /** @brief Distorts 2D points using fisheye model.
+
+    @param undistorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is
+    the number of points in the view.
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param alpha The skew coefficient.
+    @param distorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
+     */
+    CV_EXPORTS_W void distortPoints(InputArray undistorted, OutputArray distorted, InputArray K, InputArray D, double alpha = 0);
+
+    /** @brief Undistorts 2D points using fisheye model
+
+    @param distorted Array of object points, 1xN/Nx1 2-channel (or vector\<Point2f\> ), where N is the
+    number of points in the view.
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+    1-channel or 1x1 3-channel
+    @param P New camera matrix (3x3) or new projection matrix (3x4)
+    @param undistorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
+     */
+    CV_EXPORTS_W void undistortPoints(InputArray distorted, OutputArray undistorted,
+        InputArray K, InputArray D, InputArray R = noArray(), InputArray P  = noArray());
+
+    /** @brief Computes undistortion and rectification maps for image transform by cv::remap(). If D is empty zero
+    distortion is used, if R or P is empty identity matrixes are used.
+
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+    1-channel or 1x1 3-channel
+    @param P New camera matrix (3x3) or new projection matrix (3x4)
+    @param size Undistorted image size.
+    @param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2 . See convertMaps()
+    for details.
+    @param map1 The first output map.
+    @param map2 The second output map.
+     */
+    CV_EXPORTS_W void initUndistortRectifyMap(InputArray K, InputArray D, InputArray R, InputArray P,
+        const cv::Size& size, int m1type, OutputArray map1, OutputArray map2);
+
+    /** @brief Transforms an image to compensate for fisheye lens distortion.
+
+    @param distorted image with fisheye lens distortion.
+    @param undistorted Output image with compensated fisheye lens distortion.
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param Knew Camera matrix of the distorted image. By default, it is the identity matrix but you
+    may additionally scale and shift the result by using a different matrix.
+    @param new_size
+
+    The function transforms an image to compensate radial and tangential lens distortion.
+
+    The function is simply a combination of fisheye::initUndistortRectifyMap (with unity R ) and remap
+    (with bilinear interpolation). See the former function for details of the transformation being
+    performed.
+
+    See below the results of undistortImage.
+       -   a\) result of undistort of perspective camera model (all possible coefficients (k_1, k_2, k_3,
+            k_4, k_5, k_6) of distortion were optimized under calibration)
+        -   b\) result of fisheye::undistortImage of fisheye camera model (all possible coefficients (k_1, k_2,
+            k_3, k_4) of fisheye distortion were optimized under calibration)
+        -   c\) original image was captured with fisheye lens
+
+    Pictures a) and b) almost the same. But if we consider points of image located far from the center
+    of image, we can notice that on image a) these points are distorted.
+
+    ![image](pics/fisheye_undistorted.jpg)
+     */
+    CV_EXPORTS_W void undistortImage(InputArray distorted, OutputArray undistorted,
+        InputArray K, InputArray D, InputArray Knew = cv::noArray(), const Size& new_size = Size());
+
+    /** @brief Estimates new camera matrix for undistortion or rectification.
+
+    @param K Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\f$.
+    @param image_size
+    @param D Input vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param R Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3
+    1-channel or 1x1 3-channel
+    @param P New camera matrix (3x3) or new projection matrix (3x4)
+    @param balance Sets the new focal length in range between the min focal length and the max focal
+    length. Balance is in range of [0, 1].
+    @param new_size
+    @param fov_scale Divisor for new focal length.
+     */
+    CV_EXPORTS_W void estimateNewCameraMatrixForUndistortRectify(InputArray K, InputArray D, const Size &image_size, InputArray R,
+        OutputArray P, double balance = 0.0, const Size& new_size = Size(), double fov_scale = 1.0);
+
+    /** @brief Performs camera calibaration
+
+    @param objectPoints vector of vectors of calibration pattern points in the calibration pattern
+    coordinate space.
+    @param imagePoints vector of vectors of the projections of calibration pattern points.
+    imagePoints.size() and objectPoints.size() and imagePoints[i].size() must be equal to
+    objectPoints[i].size() for each i.
+    @param image_size Size of the image used only to initialize the intrinsic camera matrix.
+    @param K Output 3x3 floating-point camera matrix
+    \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . If
+    fisheye::CALIB_USE_INTRINSIC_GUESS/ is specified, some or all of fx, fy, cx, cy must be
+    initialized before calling the function.
+    @param D Output vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$.
+    @param rvecs Output vector of rotation vectors (see Rodrigues ) estimated for each pattern view.
+    That is, each k-th rotation vector together with the corresponding k-th translation vector (see
+    the next output parameter description) brings the calibration pattern from the model coordinate
+    space (in which object points are specified) to the world coordinate space, that is, a real
+    position of the calibration pattern in the k-th pattern view (k=0.. *M* -1).
+    @param tvecs Output vector of translation vectors estimated for each pattern view.
+    @param flags Different flags that may be zero or a combination of the following values:
+    -   **fisheye::CALIB_USE_INTRINSIC_GUESS** cameraMatrix contains valid initial values of
+    fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+    center ( imageSize is used), and focal distances are computed in a least-squares fashion.
+    -   **fisheye::CALIB_RECOMPUTE_EXTRINSIC** Extrinsic will be recomputed after each iteration
+    of intrinsic optimization.
+    -   **fisheye::CALIB_CHECK_COND** The functions will check validity of condition number.
+    -   **fisheye::CALIB_FIX_SKEW** Skew coefficient (alpha) is set to zero and stay zero.
+    -   **fisheye::CALIB_FIX_K1..4** Selected distortion coefficients are set to zeros and stay
+    zero.
+    @param criteria Termination criteria for the iterative optimization algorithm.
+     */
+    CV_EXPORTS_W double calibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, const Size& image_size,
+        InputOutputArray K, InputOutputArray D, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags = 0,
+            TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
+
+    /** @brief Stereo rectification for fisheye camera model
+
+    @param K1 First camera matrix.
+    @param D1 First camera distortion parameters.
+    @param K2 Second camera matrix.
+    @param D2 Second camera distortion parameters.
+    @param imageSize Size of the image used for stereo calibration.
+    @param R Rotation matrix between the coordinate systems of the first and the second
+    cameras.
+    @param tvec Translation vector between coordinate systems of the cameras.
+    @param R1 Output 3x3 rectification transform (rotation matrix) for the first camera.
+    @param R2 Output 3x3 rectification transform (rotation matrix) for the second camera.
+    @param P1 Output 3x4 projection matrix in the new (rectified) coordinate systems for the first
+    camera.
+    @param P2 Output 3x4 projection matrix in the new (rectified) coordinate systems for the second
+    camera.
+    @param Q Output \f$4 \times 4\f$ disparity-to-depth mapping matrix (see reprojectImageTo3D ).
+    @param flags Operation flags that may be zero or CV_CALIB_ZERO_DISPARITY . If the flag is set,
+    the function makes the principal points of each camera have the same pixel coordinates in the
+    rectified views. And if the flag is not set, the function may still shift the images in the
+    horizontal or vertical direction (depending on the orientation of epipolar lines) to maximize the
+    useful image area.
+    @param newImageSize New image resolution after rectification. The same size should be passed to
+    initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0)
+    is passed (default), it is set to the original imageSize . Setting it to larger value can help you
+    preserve details in the original image, especially when there is a big radial distortion.
+    @param balance Sets the new focal length in range between the min focal length and the max focal
+    length. Balance is in range of [0, 1].
+    @param fov_scale Divisor for new focal length.
+     */
+    CV_EXPORTS_W void stereoRectify(InputArray K1, InputArray D1, InputArray K2, InputArray D2, const Size &imageSize, InputArray R, InputArray tvec,
+        OutputArray R1, OutputArray R2, OutputArray P1, OutputArray P2, OutputArray Q, int flags, const Size &newImageSize = Size(),
+        double balance = 0.0, double fov_scale = 1.0);
+
+    /** @brief Performs stereo calibration
+
+    @param objectPoints Vector of vectors of the calibration pattern points.
+    @param imagePoints1 Vector of vectors of the projections of the calibration pattern points,
+    observed by the first camera.
+    @param imagePoints2 Vector of vectors of the projections of the calibration pattern points,
+    observed by the second camera.
+    @param K1 Input/output first camera matrix:
+    \f$\vecthreethree{f_x^{(j)}}{0}{c_x^{(j)}}{0}{f_y^{(j)}}{c_y^{(j)}}{0}{0}{1}\f$ , \f$j = 0,\, 1\f$ . If
+    any of fisheye::CALIB_USE_INTRINSIC_GUESS , fisheye::CV_CALIB_FIX_INTRINSIC are specified,
+    some or all of the matrix components must be initialized.
+    @param D1 Input/output vector of distortion coefficients \f$(k_1, k_2, k_3, k_4)\f$ of 4 elements.
+    @param K2 Input/output second camera matrix. The parameter is similar to K1 .
+    @param D2 Input/output lens distortion coefficients for the second camera. The parameter is
+    similar to D1 .
+    @param imageSize Size of the image used only to initialize intrinsic camera matrix.
+    @param R Output rotation matrix between the 1st and the 2nd camera coordinate systems.
+    @param T Output translation vector between the coordinate systems of the cameras.
+    @param flags Different flags that may be zero or a combination of the following values:
+    -   **fisheye::CV_CALIB_FIX_INTRINSIC** Fix K1, K2? and D1, D2? so that only R, T matrices
+    are estimated.
+    -   **fisheye::CALIB_USE_INTRINSIC_GUESS** K1, K2 contains valid initial values of
+    fx, fy, cx, cy that are optimized further. Otherwise, (cx, cy) is initially set to the image
+    center (imageSize is used), and focal distances are computed in a least-squares fashion.
+    -   **fisheye::CALIB_RECOMPUTE_EXTRINSIC** Extrinsic will be recomputed after each iteration
+    of intrinsic optimization.
+    -   **fisheye::CALIB_CHECK_COND** The functions will check validity of condition number.
+    -   **fisheye::CALIB_FIX_SKEW** Skew coefficient (alpha) is set to zero and stay zero.
+    -   **fisheye::CALIB_FIX_K1..4** Selected distortion coefficients are set to zeros and stay
+    zero.
+    @param criteria Termination criteria for the iterative optimization algorithm.
+     */
+    CV_EXPORTS_W double stereoCalibrate(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints1, InputArrayOfArrays imagePoints2,
+                                  InputOutputArray K1, InputOutputArray D1, InputOutputArray K2, InputOutputArray D2, Size imageSize,
+                                  OutputArray R, OutputArray T, int flags = fisheye::CALIB_FIX_INTRINSIC,
+                                  TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
+
+//! @} calib3d_fisheye
+}
+
+} // cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/calib3d/calib3d_c.h"
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp
new file mode 100644
index 0000000..b3da45e
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/calib3d.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h
new file mode 100644
index 0000000..0e77aa8
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/calib3d/calib3d_c.h
@@ -0,0 +1,425 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CALIB3D_C_H__
+#define __OPENCV_CALIB3D_C_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup calib3d_c
+  @{
+  */
+
+/****************************************************************************************\
+*                      Camera Calibration, Pose Estimation and Stereo                    *
+\****************************************************************************************/
+
+typedef struct CvPOSITObject CvPOSITObject;
+
+/* Allocates and initializes CvPOSITObject structure before doing cvPOSIT */
+CVAPI(CvPOSITObject*)  cvCreatePOSITObject( CvPoint3D32f* points, int point_count );
+
+
+/* Runs POSIT (POSe from ITeration) algorithm for determining 3d position of
+   an object given its model and projection in a weak-perspective case */
+CVAPI(void)  cvPOSIT(  CvPOSITObject* posit_object, CvPoint2D32f* image_points,
+                       double focal_length, CvTermCriteria criteria,
+                       float* rotation_matrix, float* translation_vector);
+
+/* Releases CvPOSITObject structure */
+CVAPI(void)  cvReleasePOSITObject( CvPOSITObject**  posit_object );
+
+/* updates the number of RANSAC iterations */
+CVAPI(int) cvRANSACUpdateNumIters( double p, double err_prob,
+                                   int model_points, int max_iters );
+
+CVAPI(void) cvConvertPointsHomogeneous( const CvMat* src, CvMat* dst );
+
+/* Calculates fundamental matrix given a set of corresponding points */
+#define CV_FM_7POINT 1
+#define CV_FM_8POINT 2
+
+#define CV_LMEDS 4
+#define CV_RANSAC 8
+
+#define CV_FM_LMEDS_ONLY  CV_LMEDS
+#define CV_FM_RANSAC_ONLY CV_RANSAC
+#define CV_FM_LMEDS CV_LMEDS
+#define CV_FM_RANSAC CV_RANSAC
+
+enum
+{
+    CV_ITERATIVE = 0,
+    CV_EPNP = 1, // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation"
+    CV_P3P = 2, // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem"
+    CV_DLS = 3 // Joel A. Hesch and Stergios I. Roumeliotis. "A Direct Least-Squares (DLS) Method for PnP"
+};
+
+CVAPI(int) cvFindFundamentalMat( const CvMat* points1, const CvMat* points2,
+                                 CvMat* fundamental_matrix,
+                                 int method CV_DEFAULT(CV_FM_RANSAC),
+                                 double param1 CV_DEFAULT(3.), double param2 CV_DEFAULT(0.99),
+                                 CvMat* status CV_DEFAULT(NULL) );
+
+/* For each input point on one of images
+   computes parameters of the corresponding
+   epipolar line on the other image */
+CVAPI(void) cvComputeCorrespondEpilines( const CvMat* points,
+                                         int which_image,
+                                         const CvMat* fundamental_matrix,
+                                         CvMat* correspondent_lines );
+
+/* Triangulation functions */
+
+CVAPI(void) cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2,
+                                CvMat* projPoints1, CvMat* projPoints2,
+                                CvMat* points4D);
+
+CVAPI(void) cvCorrectMatches(CvMat* F, CvMat* points1, CvMat* points2,
+                             CvMat* new_points1, CvMat* new_points2);
+
+
+/* Computes the optimal new camera matrix according to the free scaling parameter alpha:
+   alpha=0 - only valid pixels will be retained in the undistorted image
+   alpha=1 - all the source image pixels will be retained in the undistorted image
+*/
+CVAPI(void) cvGetOptimalNewCameraMatrix( const CvMat* camera_matrix,
+                                         const CvMat* dist_coeffs,
+                                         CvSize image_size, double alpha,
+                                         CvMat* new_camera_matrix,
+                                         CvSize new_imag_size CV_DEFAULT(cvSize(0,0)),
+                                         CvRect* valid_pixel_ROI CV_DEFAULT(0),
+                                         int center_principal_point CV_DEFAULT(0));
+
+/* Converts rotation vector to rotation matrix or vice versa */
+CVAPI(int) cvRodrigues2( const CvMat* src, CvMat* dst,
+                         CvMat* jacobian CV_DEFAULT(0) );
+
+/* Finds perspective transformation between the object plane and image (view) plane */
+CVAPI(int) cvFindHomography( const CvMat* src_points,
+                             const CvMat* dst_points,
+                             CvMat* homography,
+                             int method CV_DEFAULT(0),
+                             double ransacReprojThreshold CV_DEFAULT(3),
+                             CvMat* mask CV_DEFAULT(0),
+                             int maxIters CV_DEFAULT(2000),
+                             double confidence CV_DEFAULT(0.995));
+
+/* Computes RQ decomposition for 3x3 matrices */
+CVAPI(void) cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
+                           CvMat *matrixQx CV_DEFAULT(NULL),
+                           CvMat *matrixQy CV_DEFAULT(NULL),
+                           CvMat *matrixQz CV_DEFAULT(NULL),
+                           CvPoint3D64f *eulerAngles CV_DEFAULT(NULL));
+
+/* Computes projection matrix decomposition */
+CVAPI(void) cvDecomposeProjectionMatrix( const CvMat *projMatr, CvMat *calibMatr,
+                                         CvMat *rotMatr, CvMat *posVect,
+                                         CvMat *rotMatrX CV_DEFAULT(NULL),
+                                         CvMat *rotMatrY CV_DEFAULT(NULL),
+                                         CvMat *rotMatrZ CV_DEFAULT(NULL),
+                                         CvPoint3D64f *eulerAngles CV_DEFAULT(NULL));
+
+/* Computes d(AB)/dA and d(AB)/dB */
+CVAPI(void) cvCalcMatMulDeriv( const CvMat* A, const CvMat* B, CvMat* dABdA, CvMat* dABdB );
+
+/* Computes r3 = rodrigues(rodrigues(r2)*rodrigues(r1)),
+   t3 = rodrigues(r2)*t1 + t2 and the respective derivatives */
+CVAPI(void) cvComposeRT( const CvMat* _rvec1, const CvMat* _tvec1,
+                         const CvMat* _rvec2, const CvMat* _tvec2,
+                         CvMat* _rvec3, CvMat* _tvec3,
+                         CvMat* dr3dr1 CV_DEFAULT(0), CvMat* dr3dt1 CV_DEFAULT(0),
+                         CvMat* dr3dr2 CV_DEFAULT(0), CvMat* dr3dt2 CV_DEFAULT(0),
+                         CvMat* dt3dr1 CV_DEFAULT(0), CvMat* dt3dt1 CV_DEFAULT(0),
+                         CvMat* dt3dr2 CV_DEFAULT(0), CvMat* dt3dt2 CV_DEFAULT(0) );
+
+/* Projects object points to the view plane using
+   the specified extrinsic and intrinsic camera parameters */
+CVAPI(void) cvProjectPoints2( const CvMat* object_points, const CvMat* rotation_vector,
+                              const CvMat* translation_vector, const CvMat* camera_matrix,
+                              const CvMat* distortion_coeffs, CvMat* image_points,
+                              CvMat* dpdrot CV_DEFAULT(NULL), CvMat* dpdt CV_DEFAULT(NULL),
+                              CvMat* dpdf CV_DEFAULT(NULL), CvMat* dpdc CV_DEFAULT(NULL),
+                              CvMat* dpddist CV_DEFAULT(NULL),
+                              double aspect_ratio CV_DEFAULT(0));
+
+/* Finds extrinsic camera parameters from
+   a few known corresponding point pairs and intrinsic parameters */
+CVAPI(void) cvFindExtrinsicCameraParams2( const CvMat* object_points,
+                                          const CvMat* image_points,
+                                          const CvMat* camera_matrix,
+                                          const CvMat* distortion_coeffs,
+                                          CvMat* rotation_vector,
+                                          CvMat* translation_vector,
+                                          int use_extrinsic_guess CV_DEFAULT(0) );
+
+/* Computes initial estimate of the intrinsic camera parameters
+   in case of planar calibration target (e.g. chessboard) */
+CVAPI(void) cvInitIntrinsicParams2D( const CvMat* object_points,
+                                     const CvMat* image_points,
+                                     const CvMat* npoints, CvSize image_size,
+                                     CvMat* camera_matrix,
+                                     double aspect_ratio CV_DEFAULT(1.) );
+
+#define CV_CALIB_CB_ADAPTIVE_THRESH  1
+#define CV_CALIB_CB_NORMALIZE_IMAGE  2
+#define CV_CALIB_CB_FILTER_QUADS     4
+#define CV_CALIB_CB_FAST_CHECK       8
+
+// Performs a fast check if a chessboard is in the input image. This is a workaround to
+// a problem of cvFindChessboardCorners being slow on images with no chessboard
+// - src: input image
+// - size: chessboard size
+// Returns 1 if a chessboard can be in this image and findChessboardCorners should be called,
+// 0 if there is no chessboard, -1 in case of error
+CVAPI(int) cvCheckChessboard(IplImage* src, CvSize size);
+
+    /* Detects corners on a chessboard calibration pattern */
+CVAPI(int) cvFindChessboardCorners( const void* image, CvSize pattern_size,
+                                    CvPoint2D32f* corners,
+                                    int* corner_count CV_DEFAULT(NULL),
+                                    int flags CV_DEFAULT(CV_CALIB_CB_ADAPTIVE_THRESH+CV_CALIB_CB_NORMALIZE_IMAGE) );
+
+/* Draws individual chessboard corners or the whole chessboard detected */
+CVAPI(void) cvDrawChessboardCorners( CvArr* image, CvSize pattern_size,
+                                     CvPoint2D32f* corners,
+                                     int count, int pattern_was_found );
+
+#define CV_CALIB_USE_INTRINSIC_GUESS  1
+#define CV_CALIB_FIX_ASPECT_RATIO     2
+#define CV_CALIB_FIX_PRINCIPAL_POINT  4
+#define CV_CALIB_ZERO_TANGENT_DIST    8
+#define CV_CALIB_FIX_FOCAL_LENGTH 16
+#define CV_CALIB_FIX_K1  32
+#define CV_CALIB_FIX_K2  64
+#define CV_CALIB_FIX_K3  128
+#define CV_CALIB_FIX_K4  2048
+#define CV_CALIB_FIX_K5  4096
+#define CV_CALIB_FIX_K6  8192
+#define CV_CALIB_RATIONAL_MODEL 16384
+#define CV_CALIB_THIN_PRISM_MODEL 32768
+#define CV_CALIB_FIX_S1_S2_S3_S4  65536
+#define CV_CALIB_TILTED_MODEL  262144
+#define CV_CALIB_FIX_TAUX_TAUY  524288
+
+
+/* Finds intrinsic and extrinsic camera parameters
+   from a few views of known calibration pattern */
+CVAPI(double) cvCalibrateCamera2( const CvMat* object_points,
+                                const CvMat* image_points,
+                                const CvMat* point_counts,
+                                CvSize image_size,
+                                CvMat* camera_matrix,
+                                CvMat* distortion_coeffs,
+                                CvMat* rotation_vectors CV_DEFAULT(NULL),
+                                CvMat* translation_vectors CV_DEFAULT(NULL),
+                                int flags CV_DEFAULT(0),
+                                CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
+                                    CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON)) );
+
+/* Computes various useful characteristics of the camera from the data computed by
+   cvCalibrateCamera2 */
+CVAPI(void) cvCalibrationMatrixValues( const CvMat *camera_matrix,
+                                CvSize image_size,
+                                double aperture_width CV_DEFAULT(0),
+                                double aperture_height CV_DEFAULT(0),
+                                double *fovx CV_DEFAULT(NULL),
+                                double *fovy CV_DEFAULT(NULL),
+                                double *focal_length CV_DEFAULT(NULL),
+                                CvPoint2D64f *principal_point CV_DEFAULT(NULL),
+                                double *pixel_aspect_ratio CV_DEFAULT(NULL));
+
+#define CV_CALIB_FIX_INTRINSIC  256
+#define CV_CALIB_SAME_FOCAL_LENGTH 512
+
+/* Computes the transformation from one camera coordinate system to another one
+   from a few correspondent views of the same calibration target. Optionally, calibrates
+   both cameras */
+CVAPI(double) cvStereoCalibrate( const CvMat* object_points, const CvMat* image_points1,
+                               const CvMat* image_points2, const CvMat* npoints,
+                               CvMat* camera_matrix1, CvMat* dist_coeffs1,
+                               CvMat* camera_matrix2, CvMat* dist_coeffs2,
+                               CvSize image_size, CvMat* R, CvMat* T,
+                               CvMat* E CV_DEFAULT(0), CvMat* F CV_DEFAULT(0),
+                               int flags CV_DEFAULT(CV_CALIB_FIX_INTRINSIC),
+                               CvTermCriteria term_crit CV_DEFAULT(cvTermCriteria(
+                                   CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,1e-6)) );
+
+#define CV_CALIB_ZERO_DISPARITY 1024
+
+/* Computes 3D rotations (+ optional shift) for each camera coordinate system to make both
+   views parallel (=> to make all the epipolar lines horizontal or vertical) */
+CVAPI(void) cvStereoRectify( const CvMat* camera_matrix1, const CvMat* camera_matrix2,
+                             const CvMat* dist_coeffs1, const CvMat* dist_coeffs2,
+                             CvSize image_size, const CvMat* R, const CvMat* T,
+                             CvMat* R1, CvMat* R2, CvMat* P1, CvMat* P2,
+                             CvMat* Q CV_DEFAULT(0),
+                             int flags CV_DEFAULT(CV_CALIB_ZERO_DISPARITY),
+                             double alpha CV_DEFAULT(-1),
+                             CvSize new_image_size CV_DEFAULT(cvSize(0,0)),
+                             CvRect* valid_pix_ROI1 CV_DEFAULT(0),
+                             CvRect* valid_pix_ROI2 CV_DEFAULT(0));
+
+/* Computes rectification transformations for uncalibrated pair of images using a set
+   of point correspondences */
+CVAPI(int) cvStereoRectifyUncalibrated( const CvMat* points1, const CvMat* points2,
+                                        const CvMat* F, CvSize img_size,
+                                        CvMat* H1, CvMat* H2,
+                                        double threshold CV_DEFAULT(5));
+
+
+
+/* stereo correspondence parameters and functions */
+
+#define CV_STEREO_BM_NORMALIZED_RESPONSE  0
+#define CV_STEREO_BM_XSOBEL               1
+
+/* Block matching algorithm structure */
+typedef struct CvStereoBMState
+{
+    // pre-filtering (normalization of input images)
+    int preFilterType; // =CV_STEREO_BM_NORMALIZED_RESPONSE now
+    int preFilterSize; // averaging window size: ~5x5..21x21
+    int preFilterCap; // the output of pre-filtering is clipped by [-preFilterCap,preFilterCap]
+
+    // correspondence using Sum of Absolute Difference (SAD)
+    int SADWindowSize; // ~5x5..21x21
+    int minDisparity;  // minimum disparity (can be negative)
+    int numberOfDisparities; // maximum disparity - minimum disparity (> 0)
+
+    // post-filtering
+    int textureThreshold;  // the disparity is only computed for pixels
+                           // with textured enough neighborhood
+    int uniquenessRatio;   // accept the computed disparity d* only if
+                           // SAD(d) >= SAD(d*)*(1 + uniquenessRatio/100.)
+                           // for any d != d*+/-1 within the search range.
+    int speckleWindowSize; // disparity variation window
+    int speckleRange; // acceptable range of variation in window
+
+    int trySmallerWindows; // if 1, the results may be more accurate,
+                           // at the expense of slower processing
+    CvRect roi1, roi2;
+    int disp12MaxDiff;
+
+    // temporary buffers
+    CvMat* preFilteredImg0;
+    CvMat* preFilteredImg1;
+    CvMat* slidingSumBuf;
+    CvMat* cost;
+    CvMat* disp;
+} CvStereoBMState;
+
+#define CV_STEREO_BM_BASIC 0
+#define CV_STEREO_BM_FISH_EYE 1
+#define CV_STEREO_BM_NARROW 2
+
+CVAPI(CvStereoBMState*) cvCreateStereoBMState(int preset CV_DEFAULT(CV_STEREO_BM_BASIC),
+                                              int numberOfDisparities CV_DEFAULT(0));
+
+CVAPI(void) cvReleaseStereoBMState( CvStereoBMState** state );
+
+CVAPI(void) cvFindStereoCorrespondenceBM( const CvArr* left, const CvArr* right,
+                                          CvArr* disparity, CvStereoBMState* state );
+
+CVAPI(CvRect) cvGetValidDisparityROI( CvRect roi1, CvRect roi2, int minDisparity,
+                                      int numberOfDisparities, int SADWindowSize );
+
+CVAPI(void) cvValidateDisparity( CvArr* disparity, const CvArr* cost,
+                                 int minDisparity, int numberOfDisparities,
+                                 int disp12MaxDiff CV_DEFAULT(1) );
+
+/* Reprojects the computed disparity image to the 3D space using the specified 4x4 matrix */
+CVAPI(void)  cvReprojectImageTo3D( const CvArr* disparityImage,
+                                   CvArr* _3dImage, const CvMat* Q,
+                                   int handleMissingValues CV_DEFAULT(0) );
+
+/** @} calib3d_c */
+
+#ifdef __cplusplus
+} // extern "C"
+
+//////////////////////////////////////////////////////////////////////////////////////////
+class CV_EXPORTS CvLevMarq
+{
+public:
+    CvLevMarq();
+    CvLevMarq( int nparams, int nerrs, CvTermCriteria criteria=
+              cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
+              bool completeSymmFlag=false );
+    ~CvLevMarq();
+    void init( int nparams, int nerrs, CvTermCriteria criteria=
+              cvTermCriteria(CV_TERMCRIT_EPS+CV_TERMCRIT_ITER,30,DBL_EPSILON),
+              bool completeSymmFlag=false );
+    bool update( const CvMat*& param, CvMat*& J, CvMat*& err );
+    bool updateAlt( const CvMat*& param, CvMat*& JtJ, CvMat*& JtErr, double*& errNorm );
+
+    void clear();
+    void step();
+    enum { DONE=0, STARTED=1, CALC_J=2, CHECK_ERR=3 };
+
+    cv::Ptr<CvMat> mask;
+    cv::Ptr<CvMat> prevParam;
+    cv::Ptr<CvMat> param;
+    cv::Ptr<CvMat> J;
+    cv::Ptr<CvMat> err;
+    cv::Ptr<CvMat> JtJ;
+    cv::Ptr<CvMat> JtJN;
+    cv::Ptr<CvMat> JtErr;
+    cv::Ptr<CvMat> JtJV;
+    cv::Ptr<CvMat> JtJW;
+    double prevErrNorm, errNorm;
+    int lambdaLg10;
+    CvTermCriteria criteria;
+    int state;
+    int iters;
+    bool completeSymmFlag;
+    int solveMethod;
+};
+
+#endif
+
+#endif /* __OPENCV_CALIB3D_C_H__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core.hpp
new file mode 100644
index 0000000..5592260
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core.hpp
@@ -0,0 +1,3168 @@
+/*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-2015, Intel Corporation, all rights reserved.
+// Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
+// Copyright (C) 2015, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_HPP__
+#define __OPENCV_CORE_HPP__
+
+#ifndef __cplusplus
+#  error core.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/version.hpp"
+#include "opencv2/core/base.hpp"
+#include "opencv2/core/cvstd.hpp"
+#include "opencv2/core/traits.hpp"
+#include "opencv2/core/matx.hpp"
+#include "opencv2/core/types.hpp"
+#include "opencv2/core/mat.hpp"
+#include "opencv2/core/persistence.hpp"
+
+/**
+@defgroup core Core functionality
+@{
+    @defgroup core_basic Basic structures
+    @defgroup core_c C structures and operations
+    @{
+        @defgroup core_c_glue Connections with C++
+    @}
+    @defgroup core_array Operations on arrays
+    @defgroup core_xml XML/YAML Persistence
+    @defgroup core_cluster Clustering
+    @defgroup core_utils Utility and system functions and macros
+    @{
+        @defgroup core_utils_sse SSE utilities
+        @defgroup core_utils_neon NEON utilities
+    @}
+    @defgroup core_opengl OpenGL interoperability
+    @defgroup core_ipp Intel IPP Asynchronous C/C++ Converters
+    @defgroup core_optim Optimization Algorithms
+    @defgroup core_directx DirectX interoperability
+    @defgroup core_eigen Eigen support
+    @defgroup core_opencl OpenCL support
+    @defgroup core_va_intel Intel VA-API/OpenCL (CL-VA) interoperability
+    @defgroup core_hal Hardware Acceleration Layer
+    @{
+        @defgroup core_hal_functions Functions
+        @defgroup core_hal_interface Interface
+        @defgroup core_hal_intrin Universal intrinsics
+        @{
+            @defgroup core_hal_intrin_impl Private implementation helpers
+        @}
+    @}
+@}
+ */
+
+namespace cv {
+
+//! @addtogroup core_utils
+//! @{
+
+/*! @brief Class passed to an error.
+
+This class encapsulates all or almost all necessary
+information about the error happened in the program. The exception is
+usually constructed and thrown implicitly via CV_Error and CV_Error_ macros.
+@see error
+ */
+class CV_EXPORTS Exception : public std::exception
+{
+public:
+    /*!
+     Default constructor
+     */
+    Exception();
+    /*!
+     Full constructor. Normally the constuctor is not called explicitly.
+     Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used.
+    */
+    Exception(int _code, const String& _err, const String& _func, const String& _file, int _line);
+    virtual ~Exception() throw();
+
+    /*!
+     \return the error description and the context as a text string.
+    */
+    virtual const char *what() const throw();
+    void formatMessage();
+
+    String msg; ///< the formatted error message
+
+    int code; ///< error code @see CVStatus
+    String err; ///< error description
+    String func; ///< function name. Available only when the compiler supports getting it
+    String file; ///< source file name where the error has occured
+    int line; ///< line number in the source file where the error has occured
+};
+
+/*! @brief Signals an error and raises the exception.
+
+By default the function prints information about the error to stderr,
+then it either stops if cv::setBreakOnError() had been called before or raises the exception.
+It is possible to alternate error processing by using cv::redirectError().
+@param exc the exception raisen.
+@deprecated drop this version
+ */
+CV_EXPORTS void error( const Exception& exc );
+
+enum SortFlags { SORT_EVERY_ROW    = 0, //!< each matrix row is sorted independently
+                 SORT_EVERY_COLUMN = 1, //!< each matrix column is sorted
+                                        //!< independently; this flag and the previous one are
+                                        //!< mutually exclusive.
+                 SORT_ASCENDING    = 0, //!< each matrix row is sorted in the ascending
+                                        //!< order.
+                 SORT_DESCENDING   = 16 //!< each matrix row is sorted in the
+                                        //!< descending order; this flag and the previous one are also
+                                        //!< mutually exclusive.
+               };
+
+//! @} core_utils
+
+//! @addtogroup core
+//! @{
+
+//! Covariation flags
+enum CovarFlags {
+    /** The output covariance matrix is calculated as:
+       \f[\texttt{scale}   \cdot  [  \texttt{vects}  [0]-  \texttt{mean}  , \texttt{vects}  [1]-  \texttt{mean}  ,...]^T  \cdot  [ \texttt{vects}  [0]- \texttt{mean}  , \texttt{vects}  [1]- \texttt{mean}  ,...],\f]
+       The covariance matrix will be nsamples x nsamples. Such an unusual covariance matrix is used
+       for fast PCA of a set of very large vectors (see, for example, the EigenFaces technique for
+       face recognition). Eigenvalues of this "scrambled" matrix match the eigenvalues of the true
+       covariance matrix. The "true" eigenvectors can be easily calculated from the eigenvectors of
+       the "scrambled" covariance matrix. */
+    COVAR_SCRAMBLED = 0,
+    /**The output covariance matrix is calculated as:
+        \f[\texttt{scale}   \cdot  [  \texttt{vects}  [0]-  \texttt{mean}  , \texttt{vects}  [1]-  \texttt{mean}  ,...]  \cdot  [ \texttt{vects}  [0]- \texttt{mean}  , \texttt{vects}  [1]- \texttt{mean}  ,...]^T,\f]
+        covar will be a square matrix of the same size as the total number of elements in each input
+        vector. One and only one of COVAR_SCRAMBLED and COVAR_NORMAL must be specified.*/
+    COVAR_NORMAL    = 1,
+    /** If the flag is specified, the function does not calculate mean from
+        the input vectors but, instead, uses the passed mean vector. This is useful if mean has been
+        pre-calculated or known in advance, or if the covariance matrix is calculated by parts. In
+        this case, mean is not a mean vector of the input sub-set of vectors but rather the mean
+        vector of the whole set.*/
+    COVAR_USE_AVG   = 2,
+    /** If the flag is specified, the covariance matrix is scaled. In the
+        "normal" mode, scale is 1./nsamples . In the "scrambled" mode, scale is the reciprocal of the
+        total number of elements in each input vector. By default (if the flag is not specified), the
+        covariance matrix is not scaled ( scale=1 ).*/
+    COVAR_SCALE     = 4,
+    /** If the flag is
+        specified, all the input vectors are stored as rows of the samples matrix. mean should be a
+        single-row vector in this case.*/
+    COVAR_ROWS      = 8,
+    /** If the flag is
+        specified, all the input vectors are stored as columns of the samples matrix. mean should be a
+        single-column vector in this case.*/
+    COVAR_COLS      = 16
+};
+
+//! k-Means flags
+enum KmeansFlags {
+    /** Select random initial centers in each attempt.*/
+    KMEANS_RANDOM_CENTERS     = 0,
+    /** Use kmeans++ center initialization by Arthur and Vassilvitskii [Arthur2007].*/
+    KMEANS_PP_CENTERS         = 2,
+    /** During the first (and possibly the only) attempt, use the
+        user-supplied labels instead of computing them from the initial centers. For the second and
+        further attempts, use the random or semi-random centers. Use one of KMEANS_\*_CENTERS flag
+        to specify the exact method.*/
+    KMEANS_USE_INITIAL_LABELS = 1
+};
+
+//! type of line
+enum LineTypes {
+    FILLED  = -1,
+    LINE_4  = 4, //!< 4-connected line
+    LINE_8  = 8, //!< 8-connected line
+    LINE_AA = 16 //!< antialiased line
+};
+
+//! Only a subset of Hershey fonts
+//! <http://sources.isc.org/utils/misc/hershey-font.txt> are supported
+enum HersheyFonts {
+    FONT_HERSHEY_SIMPLEX        = 0, //!< normal size sans-serif font
+    FONT_HERSHEY_PLAIN          = 1, //!< small size sans-serif font
+    FONT_HERSHEY_DUPLEX         = 2, //!< normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)
+    FONT_HERSHEY_COMPLEX        = 3, //!< normal size serif font
+    FONT_HERSHEY_TRIPLEX        = 4, //!< normal size serif font (more complex than FONT_HERSHEY_COMPLEX)
+    FONT_HERSHEY_COMPLEX_SMALL  = 5, //!< smaller version of FONT_HERSHEY_COMPLEX
+    FONT_HERSHEY_SCRIPT_SIMPLEX = 6, //!< hand-writing style font
+    FONT_HERSHEY_SCRIPT_COMPLEX = 7, //!< more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX
+    FONT_ITALIC                 = 16 //!< flag for italic font
+};
+
+enum ReduceTypes { REDUCE_SUM = 0, //!< the output is the sum of all rows/columns of the matrix.
+                   REDUCE_AVG = 1, //!< the output is the mean vector of all rows/columns of the matrix.
+                   REDUCE_MAX = 2, //!< the output is the maximum (column/row-wise) of all rows/columns of the matrix.
+                   REDUCE_MIN = 3  //!< the output is the minimum (column/row-wise) of all rows/columns of the matrix.
+                 };
+
+
+/** @brief Swaps two matrices
+*/
+CV_EXPORTS void swap(Mat& a, Mat& b);
+/** @overload */
+CV_EXPORTS void swap( UMat& a, UMat& b );
+
+//! @} core
+
+//! @addtogroup core_array
+//! @{
+
+/** @brief Computes the source location of an extrapolated pixel.
+
+The function computes and returns the coordinate of a donor pixel corresponding to the specified
+extrapolated pixel when using the specified extrapolation border mode. For example, if you use
+cv::BORDER_WRAP mode in the horizontal direction, cv::BORDER_REFLECT_101 in the vertical direction and
+want to compute value of the "virtual" pixel Point(-5, 100) in a floating-point image img , it
+looks like:
+@code{.cpp}
+    float val = img.at<float>(borderInterpolate(100, img.rows, cv::BORDER_REFLECT_101),
+                              borderInterpolate(-5, img.cols, cv::BORDER_WRAP));
+@endcode
+Normally, the function is not called directly. It is used inside filtering functions and also in
+copyMakeBorder.
+@param p 0-based coordinate of the extrapolated pixel along one of the axes, likely \<0 or \>= len
+@param len Length of the array along the corresponding axis.
+@param borderType Border type, one of the cv::BorderTypes, except for cv::BORDER_TRANSPARENT and
+cv::BORDER_ISOLATED . When borderType==cv::BORDER_CONSTANT , the function always returns -1, regardless
+of p and len.
+
+@sa copyMakeBorder
+*/
+CV_EXPORTS_W int borderInterpolate(int p, int len, int borderType);
+
+/** @brief Forms a border around an image.
+
+The function copies the source image into the middle of the destination image. The areas to the
+left, to the right, above and below the copied source image will be filled with extrapolated
+pixels. This is not what filtering functions based on it do (they extrapolate pixels on-fly), but
+what other more complex functions, including your own, may do to simplify image boundary handling.
+
+The function supports the mode when src is already in the middle of dst . In this case, the
+function does not copy src itself but simply constructs the border, for example:
+
+@code{.cpp}
+    // let border be the same in all directions
+    int border=2;
+    // constructs a larger image to fit both the image and the border
+    Mat gray_buf(rgb.rows + border*2, rgb.cols + border*2, rgb.depth());
+    // select the middle part of it w/o copying data
+    Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
+    // convert image from RGB to grayscale
+    cvtColor(rgb, gray, COLOR_RGB2GRAY);
+    // form a border in-place
+    copyMakeBorder(gray, gray_buf, border, border,
+                   border, border, BORDER_REPLICATE);
+    // now do some custom filtering ...
+    ...
+@endcode
+@note When the source image is a part (ROI) of a bigger image, the function will try to use the
+pixels outside of the ROI to form a border. To disable this feature and always do extrapolation, as
+if src was not a ROI, use borderType | BORDER_ISOLATED.
+
+@param src Source image.
+@param dst Destination image of the same type as src and the size Size(src.cols+left+right,
+src.rows+top+bottom) .
+@param top
+@param bottom
+@param left
+@param right Parameter specifying how many pixels in each direction from the source image rectangle
+to extrapolate. For example, top=1, bottom=1, left=1, right=1 mean that 1 pixel-wide border needs
+to be built.
+@param borderType Border type. See borderInterpolate for details.
+@param value Border value if borderType==BORDER_CONSTANT .
+
+@sa  borderInterpolate
+*/
+CV_EXPORTS_W void copyMakeBorder(InputArray src, OutputArray dst,
+                                 int top, int bottom, int left, int right,
+                                 int borderType, const Scalar& value = Scalar() );
+
+/** @brief Calculates the per-element sum of two arrays or an array and a scalar.
+
+The function add calculates:
+- Sum of two arrays when both input arrays have the same size and the same number of channels:
+\f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
+- Sum of an array and a scalar when src2 is constructed from Scalar or has the same number of
+elements as `src1.channels()`:
+\f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) +  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]
+- Sum of a scalar and an array when src1 is constructed from Scalar or has the same number of
+elements as `src2.channels()`:
+\f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} +  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f]
+where `I` is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+channel is processed independently.
+
+The first function in the list above can be replaced with matrix expressions:
+@code{.cpp}
+    dst = src1 + src2;
+    dst += src1; // equivalent to add(dst, src1, dst);
+@endcode
+The input arrays and the output array can all have the same or different depths. For example, you
+can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit
+floating-point array. Depth of the output array is determined by the dtype parameter. In the second
+and third cases above, as well as in the first case, when src1.depth() == src2.depth(), dtype can
+be set to the default -1. In this case, the output array will have the same depth as the input
+array, be it src1, src2 or both.
+@note Saturation is not applied when the output array has the depth CV_32S. You may even get
+result of an incorrect sign in the case of overflow.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and number of channels as the input array(s); the
+depth is defined by dtype or src1/src2.
+@param mask optional operation mask - 8-bit single channel array, that specifies elements of the
+output array to be changed.
+@param dtype optional depth of the output array (see the discussion below).
+@sa subtract, addWeighted, scaleAdd, Mat::convertTo
+*/
+CV_EXPORTS_W void add(InputArray src1, InputArray src2, OutputArray dst,
+                      InputArray mask = noArray(), int dtype = -1);
+
+/** @brief Calculates the per-element difference between two arrays or array and a scalar.
+
+The function subtract calculates:
+- Difference between two arrays, when both input arrays have the same size and the same number of
+channels:
+    \f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2}(I)) \quad \texttt{if mask}(I) \ne0\f]
+- Difference between an array and a scalar, when src2 is constructed from Scalar or has the same
+number of elements as `src1.channels()`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1}(I) -  \texttt{src2} ) \quad \texttt{if mask}(I) \ne0\f]
+- Difference between a scalar and an array, when src1 is constructed from Scalar or has the same
+number of elements as `src2.channels()`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src1} -  \texttt{src2}(I) ) \quad \texttt{if mask}(I) \ne0\f]
+- The reverse difference between a scalar and an array in the case of `SubRS`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} ( \texttt{src2} -  \texttt{src1}(I) ) \quad \texttt{if mask}(I) \ne0\f]
+where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+channel is processed independently.
+
+The first function in the list above can be replaced with matrix expressions:
+@code{.cpp}
+    dst = src1 - src2;
+    dst -= src1; // equivalent to subtract(dst, src1, dst);
+@endcode
+The input arrays and the output array can all have the same or different depths. For example, you
+can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of
+the output array is determined by dtype parameter. In the second and third cases above, as well as
+in the first case, when src1.depth() == src2.depth(), dtype can be set to the default -1. In this
+case the output array will have the same depth as the input array, be it src1, src2 or both.
+@note Saturation is not applied when the output array has the depth CV_32S. You may even get
+result of an incorrect sign in the case of overflow.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array of the same size and the same number of channels as the input array.
+@param mask optional operation mask; this is an 8-bit single channel array that specifies elements
+of the output array to be changed.
+@param dtype optional depth of the output array
+@sa  add, addWeighted, scaleAdd, Mat::convertTo
+  */
+CV_EXPORTS_W void subtract(InputArray src1, InputArray src2, OutputArray dst,
+                           InputArray mask = noArray(), int dtype = -1);
+
+
+/** @brief Calculates the per-element scaled product of two arrays.
+
+The function multiply calculates the per-element product of two arrays:
+
+\f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{scale} \cdot \texttt{src1} (I)  \cdot \texttt{src2} (I))\f]
+
+There is also a @ref MatrixExpressions -friendly variant of the first function. See Mat::mul .
+
+For a not-per-element matrix product, see gemm .
+
+@note Saturation is not applied when the output array has the depth
+CV_32S. You may even get result of an incorrect sign in the case of
+overflow.
+@param src1 first input array.
+@param src2 second input array of the same size and the same type as src1.
+@param dst output array of the same size and type as src1.
+@param scale optional scale factor.
+@param dtype optional depth of the output array
+@sa add, subtract, divide, scaleAdd, addWeighted, accumulate, accumulateProduct, accumulateSquare,
+Mat::convertTo
+*/
+CV_EXPORTS_W void multiply(InputArray src1, InputArray src2,
+                           OutputArray dst, double scale = 1, int dtype = -1);
+
+/** @brief Performs per-element division of two arrays or a scalar by an array.
+
+The functions divide divide one array by another:
+\f[\texttt{dst(I) = saturate(src1(I)*scale/src2(I))}\f]
+or a scalar by an array when there is no src1 :
+\f[\texttt{dst(I) = saturate(scale/src2(I))}\f]
+
+When src2(I) is zero, dst(I) will also be zero. Different channels of
+multi-channel arrays are processed independently.
+
+@note Saturation is not applied when the output array has the depth CV_32S. You may even get
+result of an incorrect sign in the case of overflow.
+@param src1 first input array.
+@param src2 second input array of the same size and type as src1.
+@param scale scalar factor.
+@param dst output array of the same size and type as src2.
+@param dtype optional depth of the output array; if -1, dst will have depth src2.depth(), but in
+case of an array-by-array division, you can only pass -1 when src1.depth()==src2.depth().
+@sa  multiply, add, subtract
+*/
+CV_EXPORTS_W void divide(InputArray src1, InputArray src2, OutputArray dst,
+                         double scale = 1, int dtype = -1);
+
+/** @overload */
+CV_EXPORTS_W void divide(double scale, InputArray src2,
+                         OutputArray dst, int dtype = -1);
+
+/** @brief Calculates the sum of a scaled array and another array.
+
+The function scaleAdd is one of the classical primitive linear algebra operations, known as DAXPY
+or SAXPY in [BLAS](http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms). It calculates
+the sum of a scaled array and another array:
+\f[\texttt{dst} (I)= \texttt{scale} \cdot \texttt{src1} (I) +  \texttt{src2} (I)\f]
+The function can also be emulated with a matrix expression, for example:
+@code{.cpp}
+    Mat A(3, 3, CV_64F);
+    ...
+    A.row(0) = A.row(1)*2 + A.row(2);
+@endcode
+@param src1 first input array.
+@param alpha scale factor for the first array.
+@param src2 second input array of the same size and type as src1.
+@param dst output array of the same size and type as src1.
+@sa add, addWeighted, subtract, Mat::dot, Mat::convertTo
+*/
+CV_EXPORTS_W void scaleAdd(InputArray src1, double alpha, InputArray src2, OutputArray dst);
+
+/** @brief Calculates the weighted sum of two arrays.
+
+The function addWeighted calculates the weighted sum of two arrays as follows:
+\f[\texttt{dst} (I)= \texttt{saturate} ( \texttt{src1} (I)* \texttt{alpha} +  \texttt{src2} (I)* \texttt{beta} +  \texttt{gamma} )\f]
+where I is a multi-dimensional index of array elements. In case of multi-channel arrays, each
+channel is processed independently.
+The function can be replaced with a matrix expression:
+@code{.cpp}
+    dst = src1*alpha + src2*beta + gamma;
+@endcode
+@note Saturation is not applied when the output array has the depth CV_32S. You may even get
+result of an incorrect sign in the case of overflow.
+@param src1 first input array.
+@param alpha weight of the first array elements.
+@param src2 second input array of the same size and channel number as src1.
+@param beta weight of the second array elements.
+@param gamma scalar added to each sum.
+@param dst output array that has the same size and number of channels as the input arrays.
+@param dtype optional depth of the output array; when both input arrays have the same depth, dtype
+can be set to -1, which will be equivalent to src1.depth().
+@sa  add, subtract, scaleAdd, Mat::convertTo
+*/
+CV_EXPORTS_W void addWeighted(InputArray src1, double alpha, InputArray src2,
+                              double beta, double gamma, OutputArray dst, int dtype = -1);
+
+/** @brief Scales, calculates absolute values, and converts the result to 8-bit.
+
+On each element of the input array, the function convertScaleAbs
+performs three operations sequentially: scaling, taking an absolute
+value, conversion to an unsigned 8-bit type:
+\f[\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} +  \texttt{beta} |)\f]
+In case of multi-channel arrays, the function processes each channel
+independently. When the output is not 8-bit, the operation can be
+emulated by calling the Mat::convertTo method (or by using matrix
+expressions) and then by calculating an absolute value of the result.
+For example:
+@code{.cpp}
+    Mat_<float> A(30,30);
+    randu(A, Scalar(-100), Scalar(100));
+    Mat_<float> B = A*5 + 3;
+    B = abs(B);
+    // Mat_<float> B = abs(A*5+3) will also do the job,
+    // but it will allocate a temporary matrix
+@endcode
+@param src input array.
+@param dst output array.
+@param alpha optional scale factor.
+@param beta optional delta added to the scaled values.
+@sa  Mat::convertTo, cv::abs(const Mat&)
+*/
+CV_EXPORTS_W void convertScaleAbs(InputArray src, OutputArray dst,
+                                  double alpha = 1, double beta = 0);
+
+/** @brief Performs a look-up table transform of an array.
+
+The function LUT fills the output array with values from the look-up table. Indices of the entries
+are taken from the input array. That is, the function processes each element of src as follows:
+\f[\texttt{dst} (I)  \leftarrow \texttt{lut(src(I) + d)}\f]
+where
+\f[d =  \fork{0}{if \(\texttt{src}\) has depth \(\texttt{CV_8U}\)}{128}{if \(\texttt{src}\) has depth \(\texttt{CV_8S}\)}\f]
+@param src input array of 8-bit elements.
+@param lut look-up table of 256 elements; in case of multi-channel input array, the table should
+either have a single channel (in this case the same table is used for all channels) or the same
+number of channels as in the input array.
+@param dst output array of the same size and number of channels as src, and the same depth as lut.
+@sa  convertScaleAbs, Mat::convertTo
+*/
+CV_EXPORTS_W void LUT(InputArray src, InputArray lut, OutputArray dst);
+
+/** @brief Calculates the sum of array elements.
+
+The functions sum calculate and return the sum of array elements,
+independently for each channel.
+@param src input array that must have from 1 to 4 channels.
+@sa  countNonZero, mean, meanStdDev, norm, minMaxLoc, reduce
+*/
+CV_EXPORTS_AS(sumElems) Scalar sum(InputArray src);
+
+/** @brief Counts non-zero array elements.
+
+The function returns the number of non-zero elements in src :
+\f[\sum _{I: \; \texttt{src} (I) \ne0 } 1\f]
+@param src single-channel array.
+@sa  mean, meanStdDev, norm, minMaxLoc, calcCovarMatrix
+*/
+CV_EXPORTS_W int countNonZero( InputArray src );
+
+/** @brief Returns the list of locations of non-zero pixels
+
+Given a binary matrix (likely returned from an operation such
+as threshold(), compare(), >, ==, etc, return all of
+the non-zero indices as a cv::Mat or std::vector<cv::Point> (x,y)
+For example:
+@code{.cpp}
+    cv::Mat binaryImage; // input, binary image
+    cv::Mat locations;   // output, locations of non-zero pixels
+    cv::findNonZero(binaryImage, locations);
+
+    // access pixel coordinates
+    Point pnt = locations.at<Point>(i);
+@endcode
+or
+@code{.cpp}
+    cv::Mat binaryImage; // input, binary image
+    vector<Point> locations;   // output, locations of non-zero pixels
+    cv::findNonZero(binaryImage, locations);
+
+    // access pixel coordinates
+    Point pnt = locations[i];
+@endcode
+@param src single-channel array (type CV_8UC1)
+@param idx the output array, type of cv::Mat or std::vector<Point>, corresponding to non-zero indices in the input
+*/
+CV_EXPORTS_W void findNonZero( InputArray src, OutputArray idx );
+
+/** @brief Calculates an average (mean) of array elements.
+
+The function mean calculates the mean value M of array elements,
+independently for each channel, and return it:
+\f[\begin{array}{l} N =  \sum _{I: \; \texttt{mask} (I) \ne 0} 1 \\ M_c =  \left ( \sum _{I: \; \texttt{mask} (I) \ne 0}{ \texttt{mtx} (I)_c} \right )/N \end{array}\f]
+When all the mask elements are 0's, the functions return Scalar::all(0)
+@param src input array that should have from 1 to 4 channels so that the result can be stored in
+Scalar_ .
+@param mask optional operation mask.
+@sa  countNonZero, meanStdDev, norm, minMaxLoc
+*/
+CV_EXPORTS_W Scalar mean(InputArray src, InputArray mask = noArray());
+
+/** Calculates a mean and standard deviation of array elements.
+
+The function meanStdDev calculates the mean and the standard deviation M
+of array elements independently for each channel and returns it via the
+output parameters:
+\f[\begin{array}{l} N =  \sum _{I, \texttt{mask} (I)  \ne 0} 1 \\ \texttt{mean} _c =  \frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \texttt{src} (I)_c}{N} \\ \texttt{stddev} _c =  \sqrt{\frac{\sum_{ I: \; \texttt{mask}(I) \ne 0} \left ( \texttt{src} (I)_c -  \texttt{mean} _c \right )^2}{N}} \end{array}\f]
+When all the mask elements are 0's, the functions return
+mean=stddev=Scalar::all(0).
+@note The calculated standard deviation is only the diagonal of the
+complete normalized covariance matrix. If the full matrix is needed, you
+can reshape the multi-channel array M x N to the single-channel array
+M\*N x mtx.channels() (only possible when the matrix is continuous) and
+then pass the matrix to calcCovarMatrix .
+@param src input array that should have from 1 to 4 channels so that the results can be stored in
+Scalar_ 's.
+@param mean output parameter: calculated mean value.
+@param stddev output parameter: calculateded standard deviation.
+@param mask optional operation mask.
+@sa  countNonZero, mean, norm, minMaxLoc, calcCovarMatrix
+*/
+CV_EXPORTS_W void meanStdDev(InputArray src, OutputArray mean, OutputArray stddev,
+                             InputArray mask=noArray());
+
+/** @brief Calculates an absolute array norm, an absolute difference norm, or a
+relative difference norm.
+
+The functions norm calculate an absolute norm of src1 (when there is no
+src2 ):
+
+\f[norm =  \forkthree{\|\texttt{src1}\|_{L_{\infty}} =  \max _I | \texttt{src1} (I)|}{if  \(\texttt{normType} = \texttt{NORM_INF}\) }
+{ \| \texttt{src1} \| _{L_1} =  \sum _I | \texttt{src1} (I)|}{if  \(\texttt{normType} = \texttt{NORM_L1}\) }
+{ \| \texttt{src1} \| _{L_2} =  \sqrt{\sum_I \texttt{src1}(I)^2} }{if  \(\texttt{normType} = \texttt{NORM_L2}\) }\f]
+
+or an absolute or relative difference norm if src2 is there:
+
+\f[norm =  \forkthree{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} =  \max _I | \texttt{src1} (I) -  \texttt{src2} (I)|}{if  \(\texttt{normType} = \texttt{NORM_INF}\) }
+{ \| \texttt{src1} - \texttt{src2} \| _{L_1} =  \sum _I | \texttt{src1} (I) -  \texttt{src2} (I)|}{if  \(\texttt{normType} = \texttt{NORM_L1}\) }
+{ \| \texttt{src1} - \texttt{src2} \| _{L_2} =  \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if  \(\texttt{normType} = \texttt{NORM_L2}\) }\f]
+
+or
+
+\f[norm =  \forkthree{\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}}    }{\|\texttt{src2}\|_{L_{\infty}} }}{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_INF}\) }
+{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_L1}\) }
+{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_L2}\) }\f]
+
+The functions norm return the calculated norm.
+
+When the mask parameter is specified and it is not empty, the norm is
+calculated only over the region specified by the mask.
+
+A multi-channel input arrays are treated as a single-channel, that is,
+the results for all channels are combined.
+
+@param src1 first input array.
+@param normType type of the norm (see cv::NormTypes).
+@param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type.
+*/
+CV_EXPORTS_W double norm(InputArray src1, int normType = NORM_L2, InputArray mask = noArray());
+
+/** @overload
+@param src1 first input array.
+@param src2 second input array of the same size and the same type as src1.
+@param normType type of the norm (cv::NormTypes).
+@param mask optional operation mask; it must have the same size as src1 and CV_8UC1 type.
+*/
+CV_EXPORTS_W double norm(InputArray src1, InputArray src2,
+                         int normType = NORM_L2, InputArray mask = noArray());
+/** @overload
+@param src first input array.
+@param normType type of the norm (see cv::NormTypes).
+*/
+CV_EXPORTS double norm( const SparseMat& src, int normType );
+
+/** @brief computes PSNR image/video quality metric
+
+see http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio for details
+@todo document
+  */
+CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2);
+
+/** @brief naive nearest neighbor finder
+
+see http://en.wikipedia.org/wiki/Nearest_neighbor_search
+@todo document
+  */
+CV_EXPORTS_W void batchDistance(InputArray src1, InputArray src2,
+                                OutputArray dist, int dtype, OutputArray nidx,
+                                int normType = NORM_L2, int K = 0,
+                                InputArray mask = noArray(), int update = 0,
+                                bool crosscheck = false);
+
+/** @brief Normalizes the norm or value range of an array.
+
+The functions normalize scale and shift the input array elements so that
+\f[\| \texttt{dst} \| _{L_p}= \texttt{alpha}\f]
+(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that
+\f[\min _I  \texttt{dst} (I)= \texttt{alpha} , \, \, \max _I  \texttt{dst} (I)= \texttt{beta}\f]
+
+when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be
+normalized. This means that the norm or min-n-max are calculated over the sub-array, and then this
+sub-array is modified to be normalized. If you want to only use the mask to calculate the norm or
+min-max but modify the whole array, you can use norm and Mat::convertTo.
+
+In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this,
+the range transformation for sparse matrices is not allowed since it can shift the zero level.
+
+Possible usage with some positive example data:
+@code{.cpp}
+    vector<double> positiveData = { 2.0, 8.0, 10.0 };
+    vector<double> normalizedData_l1, normalizedData_l2, normalizedData_inf, normalizedData_minmax;
+
+    // Norm to probability (total count)
+    // sum(numbers) = 20.0
+    // 2.0      0.1     (2.0/20.0)
+    // 8.0      0.4     (8.0/20.0)
+    // 10.0     0.5     (10.0/20.0)
+    normalize(positiveData, normalizedData_l1, 1.0, 0.0, NORM_L1);
+
+    // Norm to unit vector: ||positiveData|| = 1.0
+    // 2.0      0.15
+    // 8.0      0.62
+    // 10.0     0.77
+    normalize(positiveData, normalizedData_l2, 1.0, 0.0, NORM_L2);
+
+    // Norm to max element
+    // 2.0      0.2     (2.0/10.0)
+    // 8.0      0.8     (8.0/10.0)
+    // 10.0     1.0     (10.0/10.0)
+    normalize(positiveData, normalizedData_inf, 1.0, 0.0, NORM_INF);
+
+    // Norm to range [0.0;1.0]
+    // 2.0      0.0     (shift to left border)
+    // 8.0      0.75    (6.0/8.0)
+    // 10.0     1.0     (shift to right border)
+    normalize(positiveData, normalizedData_minmax, 1.0, 0.0, NORM_MINMAX);
+@endcode
+
+@param src input array.
+@param dst output array of the same size as src .
+@param alpha norm value to normalize to or the lower range boundary in case of the range
+normalization.
+@param beta upper range boundary in case of the range normalization; it is not used for the norm
+normalization.
+@param norm_type normalization type (see cv::NormTypes).
+@param dtype when negative, the output array has the same type as src; otherwise, it has the same
+number of channels as src and the depth =CV_MAT_DEPTH(dtype).
+@param mask optional operation mask.
+@sa norm, Mat::convertTo, SparseMat::convertTo
+*/
+CV_EXPORTS_W void normalize( InputArray src, InputOutputArray dst, double alpha = 1, double beta = 0,
+                             int norm_type = NORM_L2, int dtype = -1, InputArray mask = noArray());
+
+/** @overload
+@param src input array.
+@param dst output array of the same size as src .
+@param alpha norm value to normalize to or the lower range boundary in case of the range
+normalization.
+@param normType normalization type (see cv::NormTypes).
+*/
+CV_EXPORTS void normalize( const SparseMat& src, SparseMat& dst, double alpha, int normType );
+
+/** @brief Finds the global minimum and maximum in an array.
+
+The functions minMaxLoc find the minimum and maximum element values and their positions. The
+extremums are searched across the whole array or, if mask is not an empty array, in the specified
+array region.
+
+The functions do not work with multi-channel arrays. If you need to find minimum or maximum
+elements across all the channels, use Mat::reshape first to reinterpret the array as
+single-channel. Or you may extract the particular channel using either extractImageCOI , or
+mixChannels , or split .
+@param src input single-channel array.
+@param minVal pointer to the returned minimum value; NULL is used if not required.
+@param maxVal pointer to the returned maximum value; NULL is used if not required.
+@param minLoc pointer to the returned minimum location (in 2D case); NULL is used if not required.
+@param maxLoc pointer to the returned maximum location (in 2D case); NULL is used if not required.
+@param mask optional mask used to select a sub-array.
+@sa max, min, compare, inRange, extractImageCOI, mixChannels, split, Mat::reshape
+*/
+CV_EXPORTS_W void minMaxLoc(InputArray src, CV_OUT double* minVal,
+                            CV_OUT double* maxVal = 0, CV_OUT Point* minLoc = 0,
+                            CV_OUT Point* maxLoc = 0, InputArray mask = noArray());
+
+
+/** @brief Finds the global minimum and maximum in an array
+
+The function minMaxIdx finds the minimum and maximum element values and their positions. The
+extremums are searched across the whole array or, if mask is not an empty array, in the specified
+array region. The function does not work with multi-channel arrays. If you need to find minimum or
+maximum elements across all the channels, use Mat::reshape first to reinterpret the array as
+single-channel. Or you may extract the particular channel using either extractImageCOI , or
+mixChannels , or split . In case of a sparse matrix, the minimum is found among non-zero elements
+only.
+@note When minIdx is not NULL, it must have at least 2 elements (as well as maxIdx), even if src is
+a single-row or single-column matrix. In OpenCV (following MATLAB) each array has at least 2
+dimensions, i.e. single-column matrix is Mx1 matrix (and therefore minIdx/maxIdx will be
+(i1,0)/(i2,0)) and single-row matrix is 1xN matrix (and therefore minIdx/maxIdx will be
+(0,j1)/(0,j2)).
+@param src input single-channel array.
+@param minVal pointer to the returned minimum value; NULL is used if not required.
+@param maxVal pointer to the returned maximum value; NULL is used if not required.
+@param minIdx pointer to the returned minimum location (in nD case); NULL is used if not required;
+Otherwise, it must point to an array of src.dims elements, the coordinates of the minimum element
+in each dimension are stored there sequentially.
+@param maxIdx pointer to the returned maximum location (in nD case). NULL is used if not required.
+@param mask specified array region
+*/
+CV_EXPORTS void minMaxIdx(InputArray src, double* minVal, double* maxVal = 0,
+                          int* minIdx = 0, int* maxIdx = 0, InputArray mask = noArray());
+
+/** @overload
+@param a input single-channel array.
+@param minVal pointer to the returned minimum value; NULL is used if not required.
+@param maxVal pointer to the returned maximum value; NULL is used if not required.
+@param minIdx pointer to the returned minimum location (in nD case); NULL is used if not required;
+Otherwise, it must point to an array of src.dims elements, the coordinates of the minimum element
+in each dimension are stored there sequentially.
+@param maxIdx pointer to the returned maximum location (in nD case). NULL is used if not required.
+*/
+CV_EXPORTS void minMaxLoc(const SparseMat& a, double* minVal,
+                          double* maxVal, int* minIdx = 0, int* maxIdx = 0);
+
+/** @brief Reduces a matrix to a vector.
+
+The function reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of
+1D vectors and performing the specified operation on the vectors until a single row/column is
+obtained. For example, the function can be used to compute horizontal and vertical projections of a
+raster image. In case of REDUCE_SUM and REDUCE_AVG , the output may have a larger element
+bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction
+modes.
+@param src input 2D matrix.
+@param dst output vector. Its size and type is defined by dim and dtype parameters.
+@param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to
+a single row. 1 means that the matrix is reduced to a single column.
+@param rtype reduction operation that could be one of cv::ReduceTypes
+@param dtype when negative, the output vector will have the same type as the input matrix,
+otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).
+@sa repeat
+*/
+CV_EXPORTS_W void reduce(InputArray src, OutputArray dst, int dim, int rtype, int dtype = -1);
+
+/** @brief Creates one multi-channel array out of several single-channel ones.
+
+The function merge merges several arrays to make a single multi-channel array. That is, each
+element of the output array will be a concatenation of the elements of the input arrays, where
+elements of i-th input array are treated as mv[i].channels()-element vectors.
+
+The function cv::split does the reverse operation. If you need to shuffle channels in some other
+advanced way, use cv::mixChannels.
+@param mv input array of matrices to be merged; all the matrices in mv must have the same
+size and the same depth.
+@param count number of input matrices when mv is a plain C array; it must be greater than zero.
+@param dst output array of the same size and the same depth as mv[0]; The number of channels will
+be equal to the parameter count.
+@sa  mixChannels, split, Mat::reshape
+*/
+CV_EXPORTS void merge(const Mat* mv, size_t count, OutputArray dst);
+
+/** @overload
+@param mv input vector of matrices to be merged; all the matrices in mv must have the same
+size and the same depth.
+@param dst output array of the same size and the same depth as mv[0]; The number of channels will
+be the total number of channels in the matrix array.
+  */
+CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst);
+
+/** @brief Divides a multi-channel array into several single-channel arrays.
+
+The functions split split a multi-channel array into separate single-channel arrays:
+\f[\texttt{mv} [c](I) =  \texttt{src} (I)_c\f]
+If you need to extract a single channel or do some other sophisticated channel permutation, use
+mixChannels .
+@param src input multi-channel array.
+@param mvbegin output array; the number of arrays must match src.channels(); the arrays themselves are
+reallocated, if needed.
+@sa merge, mixChannels, cvtColor
+*/
+CV_EXPORTS void split(const Mat& src, Mat* mvbegin);
+
+/** @overload
+@param m input multi-channel array.
+@param mv output vector of arrays; the arrays themselves are reallocated, if needed.
+*/
+CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv);
+
+/** @brief Copies specified channels from input arrays to the specified channels of
+output arrays.
+
+The function cv::mixChannels provides an advanced mechanism for shuffling image channels.
+
+cv::split and cv::merge and some forms of cv::cvtColor are partial cases of cv::mixChannels .
+
+In the example below, the code splits a 4-channel BGRA image into a 3-channel BGR (with B and R
+channels swapped) and a separate alpha-channel image:
+@code{.cpp}
+    Mat bgra( 100, 100, CV_8UC4, Scalar(255,0,0,255) );
+    Mat bgr( bgra.rows, bgra.cols, CV_8UC3 );
+    Mat alpha( bgra.rows, bgra.cols, CV_8UC1 );
+
+    // forming an array of matrices is a quite efficient operation,
+    // because the matrix data is not copied, only the headers
+    Mat out[] = { bgr, alpha };
+    // bgra[0] -> bgr[2], bgra[1] -> bgr[1],
+    // bgra[2] -> bgr[0], bgra[3] -> alpha[0]
+    int from_to[] = { 0,2, 1,1, 2,0, 3,3 };
+    mixChannels( &bgra, 1, out, 2, from_to, 4 );
+@endcode
+@note Unlike many other new-style C++ functions in OpenCV (see the introduction section and
+Mat::create ), cv::mixChannels requires the output arrays to be pre-allocated before calling the
+function.
+@param src input array or vector of matrices; all of the matrices must have the same size and the
+same depth.
+@param nsrcs number of matrices in `src`.
+@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and
+depth must be the same as in `src[0]`.
+@param ndsts number of matrices in `dst`.
+@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is
+a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
+dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
+src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
+src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
+channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
+filled with zero .
+@param npairs number of index pairs in `fromTo`.
+@sa cv::split, cv::merge, cv::cvtColor
+*/
+CV_EXPORTS void mixChannels(const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts,
+                            const int* fromTo, size_t npairs);
+
+/** @overload
+@param src input array or vector of matrices; all of the matrices must have the same size and the
+same depth.
+@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and
+depth must be the same as in src[0].
+@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is
+a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
+dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
+src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
+src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
+channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
+filled with zero .
+@param npairs number of index pairs in fromTo.
+*/
+CV_EXPORTS void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
+                            const int* fromTo, size_t npairs);
+
+/** @overload
+@param src input array or vector of matrices; all of the matrices must have the same size and the
+same depth.
+@param dst output array or vector of matrices; all the matrices **must be allocated**; their size and
+depth must be the same as in src[0].
+@param fromTo array of index pairs specifying which channels are copied and where; fromTo[k\*2] is
+a 0-based index of the input channel in src, fromTo[k\*2+1] is an index of the output channel in
+dst; the continuous channel numbering is used: the first input image channels are indexed from 0 to
+src[0].channels()-1, the second input image channels are indexed from src[0].channels() to
+src[0].channels() + src[1].channels()-1, and so on, the same scheme is used for the output image
+channels; as a special case, when fromTo[k\*2] is negative, the corresponding output channel is
+filled with zero .
+*/
+CV_EXPORTS_W void mixChannels(InputArrayOfArrays src, InputOutputArrayOfArrays dst,
+                              const std::vector<int>& fromTo);
+
+/** @brief extracts a single channel from src (coi is 0-based index)
+@todo document
+*/
+CV_EXPORTS_W void extractChannel(InputArray src, OutputArray dst, int coi);
+
+/** @brief inserts a single channel to dst (coi is 0-based index)
+@todo document
+*/
+CV_EXPORTS_W void insertChannel(InputArray src, InputOutputArray dst, int coi);
+
+/** @brief Flips a 2D array around vertical, horizontal, or both axes.
+
+The function flip flips the array in one of three different ways (row
+and column indices are 0-based):
+\f[\texttt{dst} _{ij} =
+\left\{
+\begin{array}{l l}
+\texttt{src} _{\texttt{src.rows}-i-1,j} & if\;  \texttt{flipCode} = 0 \\
+\texttt{src} _{i, \texttt{src.cols} -j-1} & if\;  \texttt{flipCode} > 0 \\
+\texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\
+\end{array}
+\right.\f]
+The example scenarios of using the function are the following:
+*   Vertical flipping of the image (flipCode == 0) to switch between
+    top-left and bottom-left image origin. This is a typical operation
+    in video processing on Microsoft Windows\* OS.
+*   Horizontal flipping of the image with the subsequent horizontal
+    shift and absolute difference calculation to check for a
+    vertical-axis symmetry (flipCode \> 0).
+*   Simultaneous horizontal and vertical flipping of the image with
+    the subsequent shift and absolute difference calculation to check
+    for a central symmetry (flipCode \< 0).
+*   Reversing the order of point arrays (flipCode \> 0 or
+    flipCode == 0).
+@param src input array.
+@param dst output array of the same size and type as src.
+@param flipCode a flag to specify how to flip the array; 0 means
+flipping around the x-axis and positive value (for example, 1) means
+flipping around y-axis. Negative value (for example, -1) means flipping
+around both axes.
+@sa transpose , repeat , completeSymm
+*/
+CV_EXPORTS_W void flip(InputArray src, OutputArray dst, int flipCode);
+
+/** @brief Fills the output array with repeated copies of the input array.
+
+The functions repeat duplicate the input array one or more times along each of the two axes:
+\f[\texttt{dst} _{ij}= \texttt{src} _{i\mod src.rows, \; j\mod src.cols }\f]
+The second variant of the function is more convenient to use with @ref MatrixExpressions.
+@param src input array to replicate.
+@param dst output array of the same type as src.
+@param ny Flag to specify how many times the src is repeated along the
+vertical axis.
+@param nx Flag to specify how many times the src is repeated along the
+horizontal axis.
+@sa reduce
+*/
+CV_EXPORTS_W void repeat(InputArray src, int ny, int nx, OutputArray dst);
+
+/** @overload
+@param src input array to replicate.
+@param ny Flag to specify how many times the src is repeated along the
+vertical axis.
+@param nx Flag to specify how many times the src is repeated along the
+horizontal axis.
+  */
+CV_EXPORTS Mat repeat(const Mat& src, int ny, int nx);
+
+/** @brief Applies horizontal concatenation to given matrices.
+
+The function horizontally concatenates two or more cv::Mat matrices (with the same number of rows).
+@code{.cpp}
+    cv::Mat matArray[] = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
+                           cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
+                           cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
+
+    cv::Mat out;
+    cv::hconcat( matArray, 3, out );
+    //out:
+    //[1, 2, 3;
+    // 1, 2, 3;
+    // 1, 2, 3;
+    // 1, 2, 3]
+@endcode
+@param src input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.
+@param nsrc number of matrices in src.
+@param dst output array. It has the same number of rows and depth as the src, and the sum of cols of the src.
+@sa cv::vconcat(const Mat*, size_t, OutputArray), @sa cv::vconcat(InputArrayOfArrays, OutputArray) and @sa cv::vconcat(InputArray, InputArray, OutputArray)
+*/
+CV_EXPORTS void hconcat(const Mat* src, size_t nsrc, OutputArray dst);
+/** @overload
+ @code{.cpp}
+    cv::Mat_<float> A = (cv::Mat_<float>(3, 2) << 1, 4,
+                                                  2, 5,
+                                                  3, 6);
+    cv::Mat_<float> B = (cv::Mat_<float>(3, 2) << 7, 10,
+                                                  8, 11,
+                                                  9, 12);
+
+    cv::Mat C;
+    cv::hconcat(A, B, C);
+    //C:
+    //[1, 4, 7, 10;
+    // 2, 5, 8, 11;
+    // 3, 6, 9, 12]
+ @endcode
+ @param src1 first input array to be considered for horizontal concatenation.
+ @param src2 second input array to be considered for horizontal concatenation.
+ @param dst output array. It has the same number of rows and depth as the src1 and src2, and the sum of cols of the src1 and src2.
+ */
+CV_EXPORTS void hconcat(InputArray src1, InputArray src2, OutputArray dst);
+/** @overload
+ @code{.cpp}
+    std::vector<cv::Mat> matrices = { cv::Mat(4, 1, CV_8UC1, cv::Scalar(1)),
+                                      cv::Mat(4, 1, CV_8UC1, cv::Scalar(2)),
+                                      cv::Mat(4, 1, CV_8UC1, cv::Scalar(3)),};
+
+    cv::Mat out;
+    cv::hconcat( matrices, out );
+    //out:
+    //[1, 2, 3;
+    // 1, 2, 3;
+    // 1, 2, 3;
+    // 1, 2, 3]
+ @endcode
+ @param src input array or vector of matrices. all of the matrices must have the same number of rows and the same depth.
+ @param dst output array. It has the same number of rows and depth as the src, and the sum of cols of the src.
+same depth.
+ */
+CV_EXPORTS_W void hconcat(InputArrayOfArrays src, OutputArray dst);
+
+/** @brief Applies vertical concatenation to given matrices.
+
+The function vertically concatenates two or more cv::Mat matrices (with the same number of cols).
+@code{.cpp}
+    cv::Mat matArray[] = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)),
+                           cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)),
+                           cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),};
+
+    cv::Mat out;
+    cv::vconcat( matArray, 3, out );
+    //out:
+    //[1,   1,   1,   1;
+    // 2,   2,   2,   2;
+    // 3,   3,   3,   3]
+@endcode
+@param src input array or vector of matrices. all of the matrices must have the same number of cols and the same depth.
+@param nsrc number of matrices in src.
+@param dst output array. It has the same number of cols and depth as the src, and the sum of rows of the src.
+@sa cv::hconcat(const Mat*, size_t, OutputArray), @sa cv::hconcat(InputArrayOfArrays, OutputArray) and @sa cv::hconcat(InputArray, InputArray, OutputArray)
+*/
+CV_EXPORTS void vconcat(const Mat* src, size_t nsrc, OutputArray dst);
+/** @overload
+ @code{.cpp}
+    cv::Mat_<float> A = (cv::Mat_<float>(3, 2) << 1, 7,
+                                                  2, 8,
+                                                  3, 9);
+    cv::Mat_<float> B = (cv::Mat_<float>(3, 2) << 4, 10,
+                                                  5, 11,
+                                                  6, 12);
+
+    cv::Mat C;
+    cv::vconcat(A, B, C);
+    //C:
+    //[1, 7;
+    // 2, 8;
+    // 3, 9;
+    // 4, 10;
+    // 5, 11;
+    // 6, 12]
+ @endcode
+ @param src1 first input array to be considered for vertical concatenation.
+ @param src2 second input array to be considered for vertical concatenation.
+ @param dst output array. It has the same number of cols and depth as the src1 and src2, and the sum of rows of the src1 and src2.
+ */
+CV_EXPORTS void vconcat(InputArray src1, InputArray src2, OutputArray dst);
+/** @overload
+ @code{.cpp}
+    std::vector<cv::Mat> matrices = { cv::Mat(1, 4, CV_8UC1, cv::Scalar(1)),
+                                      cv::Mat(1, 4, CV_8UC1, cv::Scalar(2)),
+                                      cv::Mat(1, 4, CV_8UC1, cv::Scalar(3)),};
+
+    cv::Mat out;
+    cv::vconcat( matrices, out );
+    //out:
+    //[1,   1,   1,   1;
+    // 2,   2,   2,   2;
+    // 3,   3,   3,   3]
+ @endcode
+ @param src input array or vector of matrices. all of the matrices must have the same number of cols and the same depth
+ @param dst output array. It has the same number of cols and depth as the src, and the sum of rows of the src.
+same depth.
+ */
+CV_EXPORTS_W void vconcat(InputArrayOfArrays src, OutputArray dst);
+
+/** @brief computes bitwise conjunction of the two arrays (dst = src1 & src2)
+Calculates the per-element bit-wise conjunction of two arrays or an
+array and a scalar.
+
+The function calculates the per-element bit-wise logical conjunction for:
+*   Two arrays when src1 and src2 have the same size:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+*   An array and a scalar when src2 is constructed from Scalar or has
+    the same number of elements as `src1.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \wedge \texttt{src2} \quad \texttt{if mask} (I) \ne0\f]
+*   A scalar and an array when src1 is constructed from Scalar or has
+    the same number of elements as `src2.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1}  \wedge \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+In case of floating-point arrays, their machine-specific bit
+representations (usually IEEE754-compliant) are used for the operation.
+In case of multi-channel arrays, each channel is processed
+independently. In the second and third cases above, the scalar is first
+converted to the array type.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and type as the input
+arrays.
+@param mask optional operation mask, 8-bit single channel array, that
+specifies elements of the output array to be changed.
+*/
+CV_EXPORTS_W void bitwise_and(InputArray src1, InputArray src2,
+                              OutputArray dst, InputArray mask = noArray());
+
+/** @brief Calculates the per-element bit-wise disjunction of two arrays or an
+array and a scalar.
+
+The function calculates the per-element bit-wise logical disjunction for:
+*   Two arrays when src1 and src2 have the same size:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+*   An array and a scalar when src2 is constructed from Scalar or has
+    the same number of elements as `src1.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \vee \texttt{src2} \quad \texttt{if mask} (I) \ne0\f]
+*   A scalar and an array when src1 is constructed from Scalar or has
+    the same number of elements as `src2.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1}  \vee \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+In case of floating-point arrays, their machine-specific bit
+representations (usually IEEE754-compliant) are used for the operation.
+In case of multi-channel arrays, each channel is processed
+independently. In the second and third cases above, the scalar is first
+converted to the array type.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and type as the input
+arrays.
+@param mask optional operation mask, 8-bit single channel array, that
+specifies elements of the output array to be changed.
+*/
+CV_EXPORTS_W void bitwise_or(InputArray src1, InputArray src2,
+                             OutputArray dst, InputArray mask = noArray());
+
+/** @brief Calculates the per-element bit-wise "exclusive or" operation on two
+arrays or an array and a scalar.
+
+The function calculates the per-element bit-wise logical "exclusive-or"
+operation for:
+*   Two arrays when src1 and src2 have the same size:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+*   An array and a scalar when src2 is constructed from Scalar or has
+    the same number of elements as `src1.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \oplus \texttt{src2} \quad \texttt{if mask} (I) \ne0\f]
+*   A scalar and an array when src1 is constructed from Scalar or has
+    the same number of elements as `src2.channels()`:
+    \f[\texttt{dst} (I) =  \texttt{src1}  \oplus \texttt{src2} (I) \quad \texttt{if mask} (I) \ne0\f]
+In case of floating-point arrays, their machine-specific bit
+representations (usually IEEE754-compliant) are used for the operation.
+In case of multi-channel arrays, each channel is processed
+independently. In the 2nd and 3rd cases above, the scalar is first
+converted to the array type.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and type as the input
+arrays.
+@param mask optional operation mask, 8-bit single channel array, that
+specifies elements of the output array to be changed.
+*/
+CV_EXPORTS_W void bitwise_xor(InputArray src1, InputArray src2,
+                              OutputArray dst, InputArray mask = noArray());
+
+/** @brief  Inverts every bit of an array.
+
+The function calculates per-element bit-wise inversion of the input
+array:
+\f[\texttt{dst} (I) =  \neg \texttt{src} (I)\f]
+In case of a floating-point input array, its machine-specific bit
+representation (usually IEEE754-compliant) is used for the operation. In
+case of multi-channel arrays, each channel is processed independently.
+@param src input array.
+@param dst output array that has the same size and type as the input
+array.
+@param mask optional operation mask, 8-bit single channel array, that
+specifies elements of the output array to be changed.
+*/
+CV_EXPORTS_W void bitwise_not(InputArray src, OutputArray dst,
+                              InputArray mask = noArray());
+
+/** @brief Calculates the per-element absolute difference between two arrays or between an array and a scalar.
+
+The function absdiff calculates:
+*   Absolute difference between two arrays when they have the same
+    size and type:
+    \f[\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1}(I) -  \texttt{src2}(I)|)\f]
+*   Absolute difference between an array and a scalar when the second
+    array is constructed from Scalar or has as many elements as the
+    number of channels in `src1`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1}(I) -  \texttt{src2} |)\f]
+*   Absolute difference between a scalar and an array when the first
+    array is constructed from Scalar or has as many elements as the
+    number of channels in `src2`:
+    \f[\texttt{dst}(I) =  \texttt{saturate} (| \texttt{src1} -  \texttt{src2}(I) |)\f]
+    where I is a multi-dimensional index of array elements. In case of
+    multi-channel arrays, each channel is processed independently.
+@note Saturation is not applied when the arrays have the depth CV_32S.
+You may even get a negative value in the case of overflow.
+@param src1 first input array or a scalar.
+@param src2 second input array or a scalar.
+@param dst output array that has the same size and type as input arrays.
+@sa cv::abs(const Mat&)
+*/
+CV_EXPORTS_W void absdiff(InputArray src1, InputArray src2, OutputArray dst);
+
+/** @brief  Checks if array elements lie between the elements of two other arrays.
+
+The function checks the range as follows:
+-   For every element of a single-channel input array:
+    \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0  \leq \texttt{src} (I)_0 \leq  \texttt{upperb} (I)_0\f]
+-   For two-channel arrays:
+    \f[\texttt{dst} (I)= \texttt{lowerb} (I)_0  \leq \texttt{src} (I)_0 \leq  \texttt{upperb} (I)_0  \land \texttt{lowerb} (I)_1  \leq \texttt{src} (I)_1 \leq  \texttt{upperb} (I)_1\f]
+-   and so forth.
+
+That is, dst (I) is set to 255 (all 1 -bits) if src (I) is within the
+specified 1D, 2D, 3D, ... box and 0 otherwise.
+
+When the lower and/or upper boundary parameters are scalars, the indexes
+(I) at lowerb and upperb in the above formulas should be omitted.
+@param src first input array.
+@param lowerb inclusive lower boundary array or a scalar.
+@param upperb inclusive upper boundary array or a scalar.
+@param dst output array of the same size as src and CV_8U type.
+*/
+CV_EXPORTS_W void inRange(InputArray src, InputArray lowerb,
+                          InputArray upperb, OutputArray dst);
+
+/** @brief Performs the per-element comparison of two arrays or an array and scalar value.
+
+The function compares:
+*   Elements of two arrays when src1 and src2 have the same size:
+    \f[\texttt{dst} (I) =  \texttt{src1} (I)  \,\texttt{cmpop}\, \texttt{src2} (I)\f]
+*   Elements of src1 with a scalar src2 when src2 is constructed from
+    Scalar or has a single element:
+    \f[\texttt{dst} (I) =  \texttt{src1}(I) \,\texttt{cmpop}\,  \texttt{src2}\f]
+*   src1 with elements of src2 when src1 is constructed from Scalar or
+    has a single element:
+    \f[\texttt{dst} (I) =  \texttt{src1}  \,\texttt{cmpop}\, \texttt{src2} (I)\f]
+When the comparison result is true, the corresponding element of output
+array is set to 255. The comparison operations can be replaced with the
+equivalent matrix expressions:
+@code{.cpp}
+    Mat dst1 = src1 >= src2;
+    Mat dst2 = src1 < 8;
+    ...
+@endcode
+@param src1 first input array or a scalar; when it is an array, it must have a single channel.
+@param src2 second input array or a scalar; when it is an array, it must have a single channel.
+@param dst output array of type ref CV_8U that has the same size and the same number of channels as
+    the input arrays.
+@param cmpop a flag, that specifies correspondence between the arrays (cv::CmpTypes)
+@sa checkRange, min, max, threshold
+*/
+CV_EXPORTS_W void compare(InputArray src1, InputArray src2, OutputArray dst, int cmpop);
+
+/** @brief Calculates per-element minimum of two arrays or an array and a scalar.
+
+The functions min calculate the per-element minimum of two arrays:
+\f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{src2} (I))\f]
+or array and a scalar:
+\f[\texttt{dst} (I)= \min ( \texttt{src1} (I), \texttt{value} )\f]
+@param src1 first input array.
+@param src2 second input array of the same size and type as src1.
+@param dst output array of the same size and type as src1.
+@sa max, compare, inRange, minMaxLoc
+*/
+CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray dst);
+/** @overload
+needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
+*/
+CV_EXPORTS void min(const Mat& src1, const Mat& src2, Mat& dst);
+/** @overload
+needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
+*/
+CV_EXPORTS void min(const UMat& src1, const UMat& src2, UMat& dst);
+
+/** @brief Calculates per-element maximum of two arrays or an array and a scalar.
+
+The functions max calculate the per-element maximum of two arrays:
+\f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{src2} (I))\f]
+or array and a scalar:
+\f[\texttt{dst} (I)= \max ( \texttt{src1} (I), \texttt{value} )\f]
+@param src1 first input array.
+@param src2 second input array of the same size and type as src1 .
+@param dst output array of the same size and type as src1.
+@sa  min, compare, inRange, minMaxLoc, @ref MatrixExpressions
+*/
+CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst);
+/** @overload
+needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
+*/
+CV_EXPORTS void max(const Mat& src1, const Mat& src2, Mat& dst);
+/** @overload
+needed to avoid conflicts with const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
+*/
+CV_EXPORTS void max(const UMat& src1, const UMat& src2, UMat& dst);
+
+/** @brief Calculates a square root of array elements.
+
+The functions sqrt calculate a square root of each input array element.
+In case of multi-channel arrays, each channel is processed
+independently. The accuracy is approximately the same as of the built-in
+std::sqrt .
+@param src input floating-point array.
+@param dst output array of the same size and type as src.
+*/
+CV_EXPORTS_W void sqrt(InputArray src, OutputArray dst);
+
+/** @brief Raises every array element to a power.
+
+The function pow raises every element of the input array to power :
+\f[\texttt{dst} (I) =  \fork{\texttt{src}(I)^{power}}{if \(\texttt{power}\) is integer}{|\texttt{src}(I)|^{power}}{otherwise}\f]
+
+So, for a non-integer power exponent, the absolute values of input array
+elements are used. However, it is possible to get true values for
+negative values using some extra operations. In the example below,
+computing the 5th root of array src shows:
+@code{.cpp}
+    Mat mask = src < 0;
+    pow(src, 1./5, dst);
+    subtract(Scalar::all(0), dst, dst, mask);
+@endcode
+For some values of power, such as integer values, 0.5 and -0.5,
+specialized faster algorithms are used.
+
+Special values (NaN, Inf) are not handled.
+@param src input array.
+@param power exponent of power.
+@param dst output array of the same size and type as src.
+@sa sqrt, exp, log, cartToPolar, polarToCart
+*/
+CV_EXPORTS_W void pow(InputArray src, double power, OutputArray dst);
+
+/** @brief Calculates the exponent of every array element.
+
+The function exp calculates the exponent of every element of the input
+array:
+\f[\texttt{dst} [I] = e^{ src(I) }\f]
+
+The maximum relative error is about 7e-6 for single-precision input and
+less than 1e-10 for double-precision input. Currently, the function
+converts denormalized values to zeros on output. Special values (NaN,
+Inf) are not handled.
+@param src input array.
+@param dst output array of the same size and type as src.
+@sa log , cartToPolar , polarToCart , phase , pow , sqrt , magnitude
+*/
+CV_EXPORTS_W void exp(InputArray src, OutputArray dst);
+
+/** @brief Calculates the natural logarithm of every array element.
+
+The function log calculates the natural logarithm of the absolute value
+of every element of the input array:
+\f[\texttt{dst} (I) =  \fork{\log |\texttt{src}(I)|}{if \(\texttt{src}(I) \ne 0\) }{\texttt{C}}{otherwise}\f]
+
+where C is a large negative number (about -700 in the current
+implementation). The maximum relative error is about 7e-6 for
+single-precision input and less than 1e-10 for double-precision input.
+Special values (NaN, Inf) are not handled.
+@param src input array.
+@param dst output array of the same size and type as src .
+@sa exp, cartToPolar, polarToCart, phase, pow, sqrt, magnitude
+*/
+CV_EXPORTS_W void log(InputArray src, OutputArray dst);
+
+/** @brief Calculates x and y coordinates of 2D vectors from their magnitude and angle.
+
+The function polarToCart calculates the Cartesian coordinates of each 2D
+vector represented by the corresponding elements of magnitude and angle:
+\f[\begin{array}{l} \texttt{x} (I) =  \texttt{magnitude} (I) \cos ( \texttt{angle} (I)) \\ \texttt{y} (I) =  \texttt{magnitude} (I) \sin ( \texttt{angle} (I)) \\ \end{array}\f]
+
+The relative accuracy of the estimated coordinates is about 1e-6.
+@param magnitude input floating-point array of magnitudes of 2D vectors;
+it can be an empty matrix (=Mat()), in this case, the function assumes
+that all the magnitudes are =1; if it is not empty, it must have the
+same size and type as angle.
+@param angle input floating-point array of angles of 2D vectors.
+@param x output array of x-coordinates of 2D vectors; it has the same
+size and type as angle.
+@param y output array of y-coordinates of 2D vectors; it has the same
+size and type as angle.
+@param angleInDegrees when true, the input angles are measured in
+degrees, otherwise, they are measured in radians.
+@sa cartToPolar, magnitude, phase, exp, log, pow, sqrt
+*/
+CV_EXPORTS_W void polarToCart(InputArray magnitude, InputArray angle,
+                              OutputArray x, OutputArray y, bool angleInDegrees = false);
+
+/** @brief Calculates the magnitude and angle of 2D vectors.
+
+The function cartToPolar calculates either the magnitude, angle, or both
+for every 2D vector (x(I),y(I)):
+\f[\begin{array}{l} \texttt{magnitude} (I)= \sqrt{\texttt{x}(I)^2+\texttt{y}(I)^2} , \\ \texttt{angle} (I)= \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))[ \cdot180 / \pi ] \end{array}\f]
+
+The angles are calculated with accuracy about 0.3 degrees. For the point
+(0,0), the angle is set to 0.
+@param x array of x-coordinates; this must be a single-precision or
+double-precision floating-point array.
+@param y array of y-coordinates, that must have the same size and same type as x.
+@param magnitude output array of magnitudes of the same size and type as x.
+@param angle output array of angles that has the same size and type as
+x; the angles are measured in radians (from 0 to 2\*Pi) or in degrees (0 to 360 degrees).
+@param angleInDegrees a flag, indicating whether the angles are measured
+in radians (which is by default), or in degrees.
+@sa Sobel, Scharr
+*/
+CV_EXPORTS_W void cartToPolar(InputArray x, InputArray y,
+                              OutputArray magnitude, OutputArray angle,
+                              bool angleInDegrees = false);
+
+/** @brief Calculates the rotation angle of 2D vectors.
+
+The function phase calculates the rotation angle of each 2D vector that
+is formed from the corresponding elements of x and y :
+\f[\texttt{angle} (I) =  \texttt{atan2} ( \texttt{y} (I), \texttt{x} (I))\f]
+
+The angle estimation accuracy is about 0.3 degrees. When x(I)=y(I)=0 ,
+the corresponding angle(I) is set to 0.
+@param x input floating-point array of x-coordinates of 2D vectors.
+@param y input array of y-coordinates of 2D vectors; it must have the
+same size and the same type as x.
+@param angle output array of vector angles; it has the same size and
+same type as x .
+@param angleInDegrees when true, the function calculates the angle in
+degrees, otherwise, they are measured in radians.
+*/
+CV_EXPORTS_W void phase(InputArray x, InputArray y, OutputArray angle,
+                        bool angleInDegrees = false);
+
+/** @brief Calculates the magnitude of 2D vectors.
+
+The function magnitude calculates the magnitude of 2D vectors formed
+from the corresponding elements of x and y arrays:
+\f[\texttt{dst} (I) =  \sqrt{\texttt{x}(I)^2 + \texttt{y}(I)^2}\f]
+@param x floating-point array of x-coordinates of the vectors.
+@param y floating-point array of y-coordinates of the vectors; it must
+have the same size as x.
+@param magnitude output array of the same size and type as x.
+@sa cartToPolar, polarToCart, phase, sqrt
+*/
+CV_EXPORTS_W void magnitude(InputArray x, InputArray y, OutputArray magnitude);
+
+/** @brief Checks every element of an input array for invalid values.
+
+The functions checkRange check that every array element is neither NaN nor infinite. When minVal \>
+-DBL_MAX and maxVal \< DBL_MAX, the functions also check that each value is between minVal and
+maxVal. In case of multi-channel arrays, each channel is processed independently. If some values
+are out of range, position of the first outlier is stored in pos (when pos != NULL). Then, the
+functions either return false (when quiet=true) or throw an exception.
+@param a input array.
+@param quiet a flag, indicating whether the functions quietly return false when the array elements
+are out of range or they throw an exception.
+@param pos optional output parameter, when not NULL, must be a pointer to array of src.dims
+elements.
+@param minVal inclusive lower boundary of valid values range.
+@param maxVal exclusive upper boundary of valid values range.
+*/
+CV_EXPORTS_W bool checkRange(InputArray a, bool quiet = true, CV_OUT Point* pos = 0,
+                            double minVal = -DBL_MAX, double maxVal = DBL_MAX);
+
+/** @brief converts NaN's to the given number
+*/
+CV_EXPORTS_W void patchNaNs(InputOutputArray a, double val = 0);
+
+/** @brief Performs generalized matrix multiplication.
+
+The function performs generalized matrix multiplication similar to the
+gemm functions in BLAS level 3. For example,
+`gemm(src1, src2, alpha, src3, beta, dst, GEMM_1_T + GEMM_3_T)`
+corresponds to
+\f[\texttt{dst} =  \texttt{alpha} \cdot \texttt{src1} ^T  \cdot \texttt{src2} +  \texttt{beta} \cdot \texttt{src3} ^T\f]
+
+In case of complex (two-channel) data, performed a complex matrix
+multiplication.
+
+The function can be replaced with a matrix expression. For example, the
+above call can be replaced with:
+@code{.cpp}
+    dst = alpha*src1.t()*src2 + beta*src3.t();
+@endcode
+@param src1 first multiplied input matrix that could be real(CV_32FC1,
+CV_64FC1) or complex(CV_32FC2, CV_64FC2).
+@param src2 second multiplied input matrix of the same type as src1.
+@param alpha weight of the matrix product.
+@param src3 third optional delta matrix added to the matrix product; it
+should have the same type as src1 and src2.
+@param beta weight of src3.
+@param dst output matrix; it has the proper size and the same type as
+input matrices.
+@param flags operation flags (cv::GemmFlags)
+@sa mulTransposed , transform
+*/
+CV_EXPORTS_W void gemm(InputArray src1, InputArray src2, double alpha,
+                       InputArray src3, double beta, OutputArray dst, int flags = 0);
+
+/** @brief Calculates the product of a matrix and its transposition.
+
+The function mulTransposed calculates the product of src and its
+transposition:
+\f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} )^T ( \texttt{src} - \texttt{delta} )\f]
+if aTa=true , and
+\f[\texttt{dst} = \texttt{scale} ( \texttt{src} - \texttt{delta} ) ( \texttt{src} - \texttt{delta} )^T\f]
+otherwise. The function is used to calculate the covariance matrix. With
+zero delta, it can be used as a faster substitute for general matrix
+product A\*B when B=A'
+@param src input single-channel matrix. Note that unlike gemm, the
+function can multiply not only floating-point matrices.
+@param dst output square matrix.
+@param aTa Flag specifying the multiplication ordering. See the
+description below.
+@param delta Optional delta matrix subtracted from src before the
+multiplication. When the matrix is empty ( delta=noArray() ), it is
+assumed to be zero, that is, nothing is subtracted. If it has the same
+size as src , it is simply subtracted. Otherwise, it is "repeated" (see
+repeat ) to cover the full src and then subtracted. Type of the delta
+matrix, when it is not empty, must be the same as the type of created
+output matrix. See the dtype parameter description below.
+@param scale Optional scale factor for the matrix product.
+@param dtype Optional type of the output matrix. When it is negative,
+the output matrix will have the same type as src . Otherwise, it will be
+type=CV_MAT_DEPTH(dtype) that should be either CV_32F or CV_64F .
+@sa calcCovarMatrix, gemm, repeat, reduce
+*/
+CV_EXPORTS_W void mulTransposed( InputArray src, OutputArray dst, bool aTa,
+                                 InputArray delta = noArray(),
+                                 double scale = 1, int dtype = -1 );
+
+/** @brief Transposes a matrix.
+
+The function transpose transposes the matrix src :
+\f[\texttt{dst} (i,j) =  \texttt{src} (j,i)\f]
+@note No complex conjugation is done in case of a complex matrix. It it
+should be done separately if needed.
+@param src input array.
+@param dst output array of the same type as src.
+*/
+CV_EXPORTS_W void transpose(InputArray src, OutputArray dst);
+
+/** @brief Performs the matrix transformation of every array element.
+
+The function transform performs the matrix transformation of every
+element of the array src and stores the results in dst :
+\f[\texttt{dst} (I) =  \texttt{m} \cdot \texttt{src} (I)\f]
+(when m.cols=src.channels() ), or
+\f[\texttt{dst} (I) =  \texttt{m} \cdot [ \texttt{src} (I); 1]\f]
+(when m.cols=src.channels()+1 )
+
+Every element of the N -channel array src is interpreted as N -element
+vector that is transformed using the M x N or M x (N+1) matrix m to
+M-element vector - the corresponding element of the output array dst .
+
+The function may be used for geometrical transformation of
+N -dimensional points, arbitrary linear color space transformation (such
+as various kinds of RGB to YUV transforms), shuffling the image
+channels, and so forth.
+@param src input array that must have as many channels (1 to 4) as
+m.cols or m.cols-1.
+@param dst output array of the same size and depth as src; it has as
+many channels as m.rows.
+@param m transformation 2x2 or 2x3 floating-point matrix.
+@sa perspectiveTransform, getAffineTransform, estimateRigidTransform, warpAffine, warpPerspective
+*/
+CV_EXPORTS_W void transform(InputArray src, OutputArray dst, InputArray m );
+
+/** @brief Performs the perspective matrix transformation of vectors.
+
+The function perspectiveTransform transforms every element of src by
+treating it as a 2D or 3D vector, in the following way:
+\f[(x, y, z)  \rightarrow (x'/w, y'/w, z'/w)\f]
+where
+\f[(x', y', z', w') =  \texttt{mat} \cdot \begin{bmatrix} x & y & z & 1  \end{bmatrix}\f]
+and
+\f[w =  \fork{w'}{if \(w' \ne 0\)}{\infty}{otherwise}\f]
+
+Here a 3D vector transformation is shown. In case of a 2D vector
+transformation, the z component is omitted.
+
+@note The function transforms a sparse set of 2D or 3D vectors. If you
+want to transform an image using perspective transformation, use
+warpPerspective . If you have an inverse problem, that is, you want to
+compute the most probable perspective transformation out of several
+pairs of corresponding points, you can use getPerspectiveTransform or
+findHomography .
+@param src input two-channel or three-channel floating-point array; each
+element is a 2D/3D vector to be transformed.
+@param dst output array of the same size and type as src.
+@param m 3x3 or 4x4 floating-point transformation matrix.
+@sa  transform, warpPerspective, getPerspectiveTransform, findHomography
+*/
+CV_EXPORTS_W void perspectiveTransform(InputArray src, OutputArray dst, InputArray m );
+
+/** @brief Copies the lower or the upper half of a square matrix to another half.
+
+The function completeSymm copies the lower half of a square matrix to
+its another half. The matrix diagonal remains unchanged:
+*   \f$\texttt{mtx}_{ij}=\texttt{mtx}_{ji}\f$ for \f$i > j\f$ if
+    lowerToUpper=false
+*   \f$\texttt{mtx}_{ij}=\texttt{mtx}_{ji}\f$ for \f$i < j\f$ if
+    lowerToUpper=true
+@param mtx input-output floating-point square matrix.
+@param lowerToUpper operation flag; if true, the lower half is copied to
+the upper half. Otherwise, the upper half is copied to the lower half.
+@sa flip, transpose
+*/
+CV_EXPORTS_W void completeSymm(InputOutputArray mtx, bool lowerToUpper = false);
+
+/** @brief Initializes a scaled identity matrix.
+
+The function setIdentity initializes a scaled identity matrix:
+\f[\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if \(i=j\)}{0}{otherwise}\f]
+
+The function can also be emulated using the matrix initializers and the
+matrix expressions:
+@code
+    Mat A = Mat::eye(4, 3, CV_32F)*5;
+    // A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]
+@endcode
+@param mtx matrix to initialize (not necessarily square).
+@param s value to assign to diagonal elements.
+@sa Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=
+*/
+CV_EXPORTS_W void setIdentity(InputOutputArray mtx, const Scalar& s = Scalar(1));
+
+/** @brief Returns the determinant of a square floating-point matrix.
+
+The function determinant calculates and returns the determinant of the
+specified matrix. For small matrices ( mtx.cols=mtx.rows\<=3 ), the
+direct method is used. For larger matrices, the function uses LU
+factorization with partial pivoting.
+
+For symmetric positively-determined matrices, it is also possible to use
+eigen decomposition to calculate the determinant.
+@param mtx input matrix that must have CV_32FC1 or CV_64FC1 type and
+square size.
+@sa trace, invert, solve, eigen, @ref MatrixExpressions
+*/
+CV_EXPORTS_W double determinant(InputArray mtx);
+
+/** @brief Returns the trace of a matrix.
+
+The function trace returns the sum of the diagonal elements of the
+matrix mtx .
+\f[\mathrm{tr} ( \texttt{mtx} ) =  \sum _i  \texttt{mtx} (i,i)\f]
+@param mtx input matrix.
+*/
+CV_EXPORTS_W Scalar trace(InputArray mtx);
+
+/** @brief Finds the inverse or pseudo-inverse of a matrix.
+
+The function invert inverts the matrix src and stores the result in dst
+. When the matrix src is singular or non-square, the function calculates
+the pseudo-inverse matrix (the dst matrix) so that norm(src\*dst - I) is
+minimal, where I is an identity matrix.
+
+In case of the DECOMP_LU method, the function returns non-zero value if
+the inverse has been successfully calculated and 0 if src is singular.
+
+In case of the DECOMP_SVD method, the function returns the inverse
+condition number of src (the ratio of the smallest singular value to the
+largest singular value) and 0 if src is singular. The SVD method
+calculates a pseudo-inverse matrix if src is singular.
+
+Similarly to DECOMP_LU, the method DECOMP_CHOLESKY works only with
+non-singular square matrices that should also be symmetrical and
+positively defined. In this case, the function stores the inverted
+matrix in dst and returns non-zero. Otherwise, it returns 0.
+
+@param src input floating-point M x N matrix.
+@param dst output matrix of N x M size and the same type as src.
+@param flags inversion method (cv::DecompTypes)
+@sa solve, SVD
+*/
+CV_EXPORTS_W double invert(InputArray src, OutputArray dst, int flags = DECOMP_LU);
+
+/** @brief Solves one or more linear systems or least-squares problems.
+
+The function solve solves a linear system or least-squares problem (the
+latter is possible with SVD or QR methods, or by specifying the flag
+DECOMP_NORMAL ):
+\f[\texttt{dst} =  \arg \min _X \| \texttt{src1} \cdot \texttt{X} -  \texttt{src2} \|\f]
+
+If DECOMP_LU or DECOMP_CHOLESKY method is used, the function returns 1
+if src1 (or \f$\texttt{src1}^T\texttt{src1}\f$ ) is non-singular. Otherwise,
+it returns 0. In the latter case, dst is not valid. Other methods find a
+pseudo-solution in case of a singular left-hand side part.
+
+@note If you want to find a unity-norm solution of an under-defined
+singular system \f$\texttt{src1}\cdot\texttt{dst}=0\f$ , the function solve
+will not do the work. Use SVD::solveZ instead.
+
+@param src1 input matrix on the left-hand side of the system.
+@param src2 input matrix on the right-hand side of the system.
+@param dst output solution.
+@param flags solution (matrix inversion) method (cv::DecompTypes)
+@sa invert, SVD, eigen
+*/
+CV_EXPORTS_W bool solve(InputArray src1, InputArray src2,
+                        OutputArray dst, int flags = DECOMP_LU);
+
+/** @brief Sorts each row or each column of a matrix.
+
+The function sort sorts each matrix row or each matrix column in
+ascending or descending order. So you should pass two operation flags to
+get desired behaviour. If you want to sort matrix rows or columns
+lexicographically, you can use STL std::sort generic function with the
+proper comparison predicate.
+
+@param src input single-channel array.
+@param dst output array of the same size and type as src.
+@param flags operation flags, a combination of cv::SortFlags
+@sa sortIdx, randShuffle
+*/
+CV_EXPORTS_W void sort(InputArray src, OutputArray dst, int flags);
+
+/** @brief Sorts each row or each column of a matrix.
+
+The function sortIdx sorts each matrix row or each matrix column in the
+ascending or descending order. So you should pass two operation flags to
+get desired behaviour. Instead of reordering the elements themselves, it
+stores the indices of sorted elements in the output array. For example:
+@code
+    Mat A = Mat::eye(3,3,CV_32F), B;
+    sortIdx(A, B, SORT_EVERY_ROW + SORT_ASCENDING);
+    // B will probably contain
+    // (because of equal elements in A some permutations are possible):
+    // [[1, 2, 0], [0, 2, 1], [0, 1, 2]]
+@endcode
+@param src input single-channel array.
+@param dst output integer array of the same size as src.
+@param flags operation flags that could be a combination of cv::SortFlags
+@sa sort, randShuffle
+*/
+CV_EXPORTS_W void sortIdx(InputArray src, OutputArray dst, int flags);
+
+/** @brief Finds the real roots of a cubic equation.
+
+The function solveCubic finds the real roots of a cubic equation:
+-   if coeffs is a 4-element vector:
+\f[\texttt{coeffs} [0] x^3 +  \texttt{coeffs} [1] x^2 +  \texttt{coeffs} [2] x +  \texttt{coeffs} [3] = 0\f]
+-   if coeffs is a 3-element vector:
+\f[x^3 +  \texttt{coeffs} [0] x^2 +  \texttt{coeffs} [1] x +  \texttt{coeffs} [2] = 0\f]
+
+The roots are stored in the roots array.
+@param coeffs equation coefficients, an array of 3 or 4 elements.
+@param roots output array of real roots that has 1 or 3 elements.
+*/
+CV_EXPORTS_W int solveCubic(InputArray coeffs, OutputArray roots);
+
+/** @brief Finds the real or complex roots of a polynomial equation.
+
+The function solvePoly finds real and complex roots of a polynomial equation:
+\f[\texttt{coeffs} [n] x^{n} +  \texttt{coeffs} [n-1] x^{n-1} + ... +  \texttt{coeffs} [1] x +  \texttt{coeffs} [0] = 0\f]
+@param coeffs array of polynomial coefficients.
+@param roots output (complex) array of roots.
+@param maxIters maximum number of iterations the algorithm does.
+*/
+CV_EXPORTS_W double solvePoly(InputArray coeffs, OutputArray roots, int maxIters = 300);
+
+/** @brief Calculates eigenvalues and eigenvectors of a symmetric matrix.
+
+The functions eigen calculate just eigenvalues, or eigenvalues and eigenvectors of the symmetric
+matrix src:
+@code
+    src*eigenvectors.row(i).t() = eigenvalues.at<srcType>(i)*eigenvectors.row(i).t()
+@endcode
+@note in the new and the old interfaces different ordering of eigenvalues and eigenvectors
+parameters is used.
+@param src input matrix that must have CV_32FC1 or CV_64FC1 type, square size and be symmetrical
+(src ^T^ == src).
+@param eigenvalues output vector of eigenvalues of the same type as src; the eigenvalues are stored
+in the descending order.
+@param eigenvectors output matrix of eigenvectors; it has the same size and type as src; the
+eigenvectors are stored as subsequent matrix rows, in the same order as the corresponding
+eigenvalues.
+@sa completeSymm , PCA
+*/
+CV_EXPORTS_W bool eigen(InputArray src, OutputArray eigenvalues,
+                        OutputArray eigenvectors = noArray());
+
+/** @brief Calculates the covariance matrix of a set of vectors.
+
+The functions calcCovarMatrix calculate the covariance matrix and, optionally, the mean vector of
+the set of input vectors.
+@param samples samples stored as separate matrices
+@param nsamples number of samples
+@param covar output covariance matrix of the type ctype and square size.
+@param mean input or output (depending on the flags) array as the average value of the input vectors.
+@param flags operation flags as a combination of cv::CovarFlags
+@param ctype type of the matrixl; it equals 'CV_64F' by default.
+@sa PCA, mulTransposed, Mahalanobis
+@todo InputArrayOfArrays
+*/
+CV_EXPORTS void calcCovarMatrix( const Mat* samples, int nsamples, Mat& covar, Mat& mean,
+                                 int flags, int ctype = CV_64F);
+
+/** @overload
+@note use cv::COVAR_ROWS or cv::COVAR_COLS flag
+@param samples samples stored as rows/columns of a single matrix.
+@param covar output covariance matrix of the type ctype and square size.
+@param mean input or output (depending on the flags) array as the average value of the input vectors.
+@param flags operation flags as a combination of cv::CovarFlags
+@param ctype type of the matrixl; it equals 'CV_64F' by default.
+*/
+CV_EXPORTS_W void calcCovarMatrix( InputArray samples, OutputArray covar,
+                                   InputOutputArray mean, int flags, int ctype = CV_64F);
+
+/** wrap PCA::operator() */
+CV_EXPORTS_W void PCACompute(InputArray data, InputOutputArray mean,
+                             OutputArray eigenvectors, int maxComponents = 0);
+
+/** wrap PCA::operator() */
+CV_EXPORTS_W void PCACompute(InputArray data, InputOutputArray mean,
+                             OutputArray eigenvectors, double retainedVariance);
+
+/** wrap PCA::project */
+CV_EXPORTS_W void PCAProject(InputArray data, InputArray mean,
+                             InputArray eigenvectors, OutputArray result);
+
+/** wrap PCA::backProject */
+CV_EXPORTS_W void PCABackProject(InputArray data, InputArray mean,
+                                 InputArray eigenvectors, OutputArray result);
+
+/** wrap SVD::compute */
+CV_EXPORTS_W void SVDecomp( InputArray src, OutputArray w, OutputArray u, OutputArray vt, int flags = 0 );
+
+/** wrap SVD::backSubst */
+CV_EXPORTS_W void SVBackSubst( InputArray w, InputArray u, InputArray vt,
+                               InputArray rhs, OutputArray dst );
+
+/** @brief Calculates the Mahalanobis distance between two vectors.
+
+The function Mahalanobis calculates and returns the weighted distance between two vectors:
+\f[d( \texttt{vec1} , \texttt{vec2} )= \sqrt{\sum_{i,j}{\texttt{icovar(i,j)}\cdot(\texttt{vec1}(I)-\texttt{vec2}(I))\cdot(\texttt{vec1(j)}-\texttt{vec2(j)})} }\f]
+The covariance matrix may be calculated using the cv::calcCovarMatrix function and then inverted using
+the invert function (preferably using the cv::DECOMP_SVD method, as the most accurate).
+@param v1 first 1D input vector.
+@param v2 second 1D input vector.
+@param icovar inverse covariance matrix.
+*/
+CV_EXPORTS_W double Mahalanobis(InputArray v1, InputArray v2, InputArray icovar);
+
+/** @brief Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-point array.
+
+The function performs one of the following:
+-   Forward the Fourier transform of a 1D vector of N elements:
+    \f[Y = F^{(N)}  \cdot X,\f]
+    where \f$F^{(N)}_{jk}=\exp(-2\pi i j k/N)\f$ and \f$i=\sqrt{-1}\f$
+-   Inverse the Fourier transform of a 1D vector of N elements:
+    \f[\begin{array}{l} X'=  \left (F^{(N)} \right )^{-1}  \cdot Y =  \left (F^{(N)} \right )^*  \cdot y  \\ X = (1/N)  \cdot X, \end{array}\f]
+    where \f$F^*=\left(\textrm{Re}(F^{(N)})-\textrm{Im}(F^{(N)})\right)^T\f$
+-   Forward the 2D Fourier transform of a M x N matrix:
+    \f[Y = F^{(M)}  \cdot X  \cdot F^{(N)}\f]
+-   Inverse the 2D Fourier transform of a M x N matrix:
+    \f[\begin{array}{l} X'=  \left (F^{(M)} \right )^*  \cdot Y  \cdot \left (F^{(N)} \right )^* \\ X =  \frac{1}{M \cdot N} \cdot X' \end{array}\f]
+
+In case of real (single-channel) data, the output spectrum of the forward Fourier transform or input
+spectrum of the inverse Fourier transform can be represented in a packed format called *CCS*
+(complex-conjugate-symmetrical). It was borrowed from IPL (Intel\* Image Processing Library). Here
+is how 2D *CCS* spectrum looks:
+\f[\begin{bmatrix} Re Y_{0,0} & Re Y_{0,1} & Im Y_{0,1} & Re Y_{0,2} & Im Y_{0,2} &  \cdots & Re Y_{0,N/2-1} & Im Y_{0,N/2-1} & Re Y_{0,N/2}  \\ Re Y_{1,0} & Re Y_{1,1} & Im Y_{1,1} & Re Y_{1,2} & Im Y_{1,2} &  \cdots & Re Y_{1,N/2-1} & Im Y_{1,N/2-1} & Re Y_{1,N/2}  \\ Im Y_{1,0} & Re Y_{2,1} & Im Y_{2,1} & Re Y_{2,2} & Im Y_{2,2} &  \cdots & Re Y_{2,N/2-1} & Im Y_{2,N/2-1} & Im Y_{1,N/2}  \\ \hdotsfor{9} \\ Re Y_{M/2-1,0} &  Re Y_{M-3,1}  & Im Y_{M-3,1} &  \hdotsfor{3} & Re Y_{M-3,N/2-1} & Im Y_{M-3,N/2-1}& Re Y_{M/2-1,N/2}  \\ Im Y_{M/2-1,0} &  Re Y_{M-2,1}  & Im Y_{M-2,1} &  \hdotsfor{3} & Re Y_{M-2,N/2-1} & Im Y_{M-2,N/2-1}& Im Y_{M/2-1,N/2}  \\ Re Y_{M/2,0}  &  Re Y_{M-1,1} &  Im Y_{M-1,1} &  \hdotsfor{3} & Re Y_{M-1,N/2-1} & Im Y_{M-1,N/2-1}& Re Y_{M/2,N/2} \end{bmatrix}\f]
+
+In case of 1D transform of a real vector, the output looks like the first row of the matrix above.
+
+So, the function chooses an operation mode depending on the flags and size of the input array:
+-   If DFT_ROWS is set or the input array has a single row or single column, the function
+    performs a 1D forward or inverse transform of each row of a matrix when DFT_ROWS is set.
+    Otherwise, it performs a 2D transform.
+-   If the input array is real and DFT_INVERSE is not set, the function performs a forward 1D or
+    2D transform:
+    -   When DFT_COMPLEX_OUTPUT is set, the output is a complex matrix of the same size as
+        input.
+    -   When DFT_COMPLEX_OUTPUT is not set, the output is a real matrix of the same size as
+        input. In case of 2D transform, it uses the packed format as shown above. In case of a
+        single 1D transform, it looks like the first row of the matrix above. In case of
+        multiple 1D transforms (when using the DFT_ROWS flag), each row of the output matrix
+        looks like the first row of the matrix above.
+-   If the input array is complex and either DFT_INVERSE or DFT_REAL_OUTPUT are not set, the
+    output is a complex array of the same size as input. The function performs a forward or
+    inverse 1D or 2D transform of the whole input array or each row of the input array
+    independently, depending on the flags DFT_INVERSE and DFT_ROWS.
+-   When DFT_INVERSE is set and the input array is real, or it is complex but DFT_REAL_OUTPUT
+    is set, the output is a real array of the same size as input. The function performs a 1D or 2D
+    inverse transformation of the whole input array or each individual row, depending on the flags
+    DFT_INVERSE and DFT_ROWS.
+
+If DFT_SCALE is set, the scaling is done after the transformation.
+
+Unlike dct , the function supports arrays of arbitrary size. But only those arrays are processed
+efficiently, whose sizes can be factorized in a product of small prime numbers (2, 3, and 5 in the
+current implementation). Such an efficient DFT size can be calculated using the getOptimalDFTSize
+method.
+
+The sample below illustrates how to calculate a DFT-based convolution of two 2D real arrays:
+@code
+    void convolveDFT(InputArray A, InputArray B, OutputArray C)
+    {
+        // reallocate the output array if needed
+        C.create(abs(A.rows - B.rows)+1, abs(A.cols - B.cols)+1, A.type());
+        Size dftSize;
+        // calculate the size of DFT transform
+        dftSize.width = getOptimalDFTSize(A.cols + B.cols - 1);
+        dftSize.height = getOptimalDFTSize(A.rows + B.rows - 1);
+
+        // allocate temporary buffers and initialize them with 0's
+        Mat tempA(dftSize, A.type(), Scalar::all(0));
+        Mat tempB(dftSize, B.type(), Scalar::all(0));
+
+        // copy A and B to the top-left corners of tempA and tempB, respectively
+        Mat roiA(tempA, Rect(0,0,A.cols,A.rows));
+        A.copyTo(roiA);
+        Mat roiB(tempB, Rect(0,0,B.cols,B.rows));
+        B.copyTo(roiB);
+
+        // now transform the padded A & B in-place;
+        // use "nonzeroRows" hint for faster processing
+        dft(tempA, tempA, 0, A.rows);
+        dft(tempB, tempB, 0, B.rows);
+
+        // multiply the spectrums;
+        // the function handles packed spectrum representations well
+        mulSpectrums(tempA, tempB, tempA);
+
+        // transform the product back from the frequency domain.
+        // Even though all the result rows will be non-zero,
+        // you need only the first C.rows of them, and thus you
+        // pass nonzeroRows == C.rows
+        dft(tempA, tempA, DFT_INVERSE + DFT_SCALE, C.rows);
+
+        // now copy the result back to C.
+        tempA(Rect(0, 0, C.cols, C.rows)).copyTo(C);
+
+        // all the temporary buffers will be deallocated automatically
+    }
+@endcode
+To optimize this sample, consider the following approaches:
+-   Since nonzeroRows != 0 is passed to the forward transform calls and since A and B are copied to
+    the top-left corners of tempA and tempB, respectively, it is not necessary to clear the whole
+    tempA and tempB. It is only necessary to clear the tempA.cols - A.cols ( tempB.cols - B.cols)
+    rightmost columns of the matrices.
+-   This DFT-based convolution does not have to be applied to the whole big arrays, especially if B
+    is significantly smaller than A or vice versa. Instead, you can calculate convolution by parts.
+    To do this, you need to split the output array C into multiple tiles. For each tile, estimate
+    which parts of A and B are required to calculate convolution in this tile. If the tiles in C are
+    too small, the speed will decrease a lot because of repeated work. In the ultimate case, when
+    each tile in C is a single pixel, the algorithm becomes equivalent to the naive convolution
+    algorithm. If the tiles are too big, the temporary arrays tempA and tempB become too big and
+    there is also a slowdown because of bad cache locality. So, there is an optimal tile size
+    somewhere in the middle.
+-   If different tiles in C can be calculated in parallel and, thus, the convolution is done by
+    parts, the loop can be threaded.
+
+All of the above improvements have been implemented in matchTemplate and filter2D . Therefore, by
+using them, you can get the performance even better than with the above theoretically optimal
+implementation. Though, those two functions actually calculate cross-correlation, not convolution,
+so you need to "flip" the second convolution operand B vertically and horizontally using flip .
+@note
+-   An example using the discrete fourier transform can be found at
+    opencv_source_code/samples/cpp/dft.cpp
+-   (Python) An example using the dft functionality to perform Wiener deconvolution can be found
+    at opencv_source/samples/python/deconvolution.py
+-   (Python) An example rearranging the quadrants of a Fourier image can be found at
+    opencv_source/samples/python/dft.py
+@param src input array that could be real or complex.
+@param dst output array whose size and type depends on the flags .
+@param flags transformation flags, representing a combination of the cv::DftFlags
+@param nonzeroRows when the parameter is not zero, the function assumes that only the first
+nonzeroRows rows of the input array (DFT_INVERSE is not set) or only the first nonzeroRows of the
+output array (DFT_INVERSE is set) contain non-zeros, thus, the function can handle the rest of the
+rows more efficiently and save some time; this technique is very useful for calculating array
+cross-correlation or convolution using DFT.
+@sa dct , getOptimalDFTSize , mulSpectrums, filter2D , matchTemplate , flip , cartToPolar ,
+magnitude , phase
+*/
+CV_EXPORTS_W void dft(InputArray src, OutputArray dst, int flags = 0, int nonzeroRows = 0);
+
+/** @brief Calculates the inverse Discrete Fourier Transform of a 1D or 2D array.
+
+idft(src, dst, flags) is equivalent to dft(src, dst, flags | DFT_INVERSE) .
+@note None of dft and idft scales the result by default. So, you should pass DFT_SCALE to one of
+dft or idft explicitly to make these transforms mutually inverse.
+@sa dft, dct, idct, mulSpectrums, getOptimalDFTSize
+@param src input floating-point real or complex array.
+@param dst output array whose size and type depend on the flags.
+@param flags operation flags (see dft and cv::DftFlags).
+@param nonzeroRows number of dst rows to process; the rest of the rows have undefined content (see
+the convolution sample in dft description.
+*/
+CV_EXPORTS_W void idft(InputArray src, OutputArray dst, int flags = 0, int nonzeroRows = 0);
+
+/** @brief Performs a forward or inverse discrete Cosine transform of 1D or 2D array.
+
+The function dct performs a forward or inverse discrete Cosine transform (DCT) of a 1D or 2D
+floating-point array:
+-   Forward Cosine transform of a 1D vector of N elements:
+    \f[Y = C^{(N)}  \cdot X\f]
+    where
+    \f[C^{(N)}_{jk}= \sqrt{\alpha_j/N} \cos \left ( \frac{\pi(2k+1)j}{2N} \right )\f]
+    and
+    \f$\alpha_0=1\f$, \f$\alpha_j=2\f$ for *j \> 0*.
+-   Inverse Cosine transform of a 1D vector of N elements:
+    \f[X =  \left (C^{(N)} \right )^{-1}  \cdot Y =  \left (C^{(N)} \right )^T  \cdot Y\f]
+    (since \f$C^{(N)}\f$ is an orthogonal matrix, \f$C^{(N)} \cdot \left(C^{(N)}\right)^T = I\f$ )
+-   Forward 2D Cosine transform of M x N matrix:
+    \f[Y = C^{(N)}  \cdot X  \cdot \left (C^{(N)} \right )^T\f]
+-   Inverse 2D Cosine transform of M x N matrix:
+    \f[X =  \left (C^{(N)} \right )^T  \cdot X  \cdot C^{(N)}\f]
+
+The function chooses the mode of operation by looking at the flags and size of the input array:
+-   If (flags & DCT_INVERSE) == 0 , the function does a forward 1D or 2D transform. Otherwise, it
+    is an inverse 1D or 2D transform.
+-   If (flags & DCT_ROWS) != 0 , the function performs a 1D transform of each row.
+-   If the array is a single column or a single row, the function performs a 1D transform.
+-   If none of the above is true, the function performs a 2D transform.
+
+@note Currently dct supports even-size arrays (2, 4, 6 ...). For data analysis and approximation, you
+can pad the array when necessary.
+Also, the function performance depends very much, and not monotonically, on the array size (see
+getOptimalDFTSize ). In the current implementation DCT of a vector of size N is calculated via DFT
+of a vector of size N/2 . Thus, the optimal DCT size N1 \>= N can be calculated as:
+@code
+    size_t getOptimalDCTSize(size_t N) { return 2*getOptimalDFTSize((N+1)/2); }
+    N1 = getOptimalDCTSize(N);
+@endcode
+@param src input floating-point array.
+@param dst output array of the same size and type as src .
+@param flags transformation flags as a combination of cv::DftFlags (DCT_*)
+@sa dft , getOptimalDFTSize , idct
+*/
+CV_EXPORTS_W void dct(InputArray src, OutputArray dst, int flags = 0);
+
+/** @brief Calculates the inverse Discrete Cosine Transform of a 1D or 2D array.
+
+idct(src, dst, flags) is equivalent to dct(src, dst, flags | DCT_INVERSE).
+@param src input floating-point single-channel array.
+@param dst output array of the same size and type as src.
+@param flags operation flags.
+@sa  dct, dft, idft, getOptimalDFTSize
+*/
+CV_EXPORTS_W void idct(InputArray src, OutputArray dst, int flags = 0);
+
+/** @brief Performs the per-element multiplication of two Fourier spectrums.
+
+The function mulSpectrums performs the per-element multiplication of the two CCS-packed or complex
+matrices that are results of a real or complex Fourier transform.
+
+The function, together with dft and idft , may be used to calculate convolution (pass conjB=false )
+or correlation (pass conjB=true ) of two arrays rapidly. When the arrays are complex, they are
+simply multiplied (per element) with an optional conjugation of the second-array elements. When the
+arrays are real, they are assumed to be CCS-packed (see dft for details).
+@param a first input array.
+@param b second input array of the same size and type as src1 .
+@param c output array of the same size and type as src1 .
+@param flags operation flags; currently, the only supported flag is cv::DFT_ROWS, which indicates that
+each row of src1 and src2 is an independent 1D Fourier spectrum. If you do not want to use this flag, then simply add a `0` as value.
+@param conjB optional flag that conjugates the second input array before the multiplication (true)
+or not (false).
+*/
+CV_EXPORTS_W void mulSpectrums(InputArray a, InputArray b, OutputArray c,
+                               int flags, bool conjB = false);
+
+/** @brief Returns the optimal DFT size for a given vector size.
+
+DFT performance is not a monotonic function of a vector size. Therefore, when you calculate
+convolution of two arrays or perform the spectral analysis of an array, it usually makes sense to
+pad the input data with zeros to get a bit larger array that can be transformed much faster than the
+original one. Arrays whose size is a power-of-two (2, 4, 8, 16, 32, ...) are the fastest to process.
+Though, the arrays whose size is a product of 2's, 3's, and 5's (for example, 300 = 5\*5\*3\*2\*2)
+are also processed quite efficiently.
+
+The function getOptimalDFTSize returns the minimum number N that is greater than or equal to vecsize
+so that the DFT of a vector of size N can be processed efficiently. In the current implementation N
+= 2 ^p^ \* 3 ^q^ \* 5 ^r^ for some integer p, q, r.
+
+The function returns a negative number if vecsize is too large (very close to INT_MAX ).
+
+While the function cannot be used directly to estimate the optimal vector size for DCT transform
+(since the current DCT implementation supports only even-size vectors), it can be easily processed
+as getOptimalDFTSize((vecsize+1)/2)\*2.
+@param vecsize vector size.
+@sa dft , dct , idft , idct , mulSpectrums
+*/
+CV_EXPORTS_W int getOptimalDFTSize(int vecsize);
+
+/** @brief Returns the default random number generator.
+
+The function theRNG returns the default random number generator. For each thread, there is a
+separate random number generator, so you can use the function safely in multi-thread environments.
+If you just need to get a single random number using this generator or initialize an array, you can
+use randu or randn instead. But if you are going to generate many random numbers inside a loop, it
+is much faster to use this function to retrieve the generator and then use RNG::operator _Tp() .
+@sa RNG, randu, randn
+*/
+CV_EXPORTS RNG& theRNG();
+
+/** @brief Generates a single uniformly-distributed random number or an array of random numbers.
+
+Non-template variant of the function fills the matrix dst with uniformly-distributed
+random numbers from the specified range:
+\f[\texttt{low} _c  \leq \texttt{dst} (I)_c <  \texttt{high} _c\f]
+@param dst output array of random numbers; the array must be pre-allocated.
+@param low inclusive lower boundary of the generated random numbers.
+@param high exclusive upper boundary of the generated random numbers.
+@sa RNG, randn, theRNG
+*/
+CV_EXPORTS_W void randu(InputOutputArray dst, InputArray low, InputArray high);
+
+/** @brief Fills the array with normally distributed random numbers.
+
+The function randn fills the matrix dst with normally distributed random numbers with the specified
+mean vector and the standard deviation matrix. The generated random numbers are clipped to fit the
+value range of the output array data type.
+@param dst output array of random numbers; the array must be pre-allocated and have 1 to 4 channels.
+@param mean mean value (expectation) of the generated random numbers.
+@param stddev standard deviation of the generated random numbers; it can be either a vector (in
+which case a diagonal standard deviation matrix is assumed) or a square matrix.
+@sa RNG, randu
+*/
+CV_EXPORTS_W void randn(InputOutputArray dst, InputArray mean, InputArray stddev);
+
+/** @brief Shuffles the array elements randomly.
+
+The function randShuffle shuffles the specified 1D array by randomly choosing pairs of elements and
+swapping them. The number of such swap operations will be dst.rows\*dst.cols\*iterFactor .
+@param dst input/output numerical 1D array.
+@param iterFactor scale factor that determines the number of random swap operations (see the details
+below).
+@param rng optional random number generator used for shuffling; if it is zero, theRNG () is used
+instead.
+@sa RNG, sort
+*/
+CV_EXPORTS_W void randShuffle(InputOutputArray dst, double iterFactor = 1., RNG* rng = 0);
+
+/** @brief Principal Component Analysis
+
+The class is used to calculate a special basis for a set of vectors. The
+basis will consist of eigenvectors of the covariance matrix calculated
+from the input set of vectors. The class %PCA can also transform
+vectors to/from the new coordinate space defined by the basis. Usually,
+in this new coordinate system, each vector from the original set (and
+any linear combination of such vectors) can be quite accurately
+approximated by taking its first few components, corresponding to the
+eigenvectors of the largest eigenvalues of the covariance matrix.
+Geometrically it means that you calculate a projection of the vector to
+a subspace formed by a few eigenvectors corresponding to the dominant
+eigenvalues of the covariance matrix. And usually such a projection is
+very close to the original vector. So, you can represent the original
+vector from a high-dimensional space with a much shorter vector
+consisting of the projected vector's coordinates in the subspace. Such a
+transformation is also known as Karhunen-Loeve Transform, or KLT.
+See http://en.wikipedia.org/wiki/Principal_component_analysis
+
+The sample below is the function that takes two matrices. The first
+function stores a set of vectors (a row per vector) that is used to
+calculate PCA. The second function stores another "test" set of vectors
+(a row per vector). First, these vectors are compressed with PCA, then
+reconstructed back, and then the reconstruction error norm is computed
+and printed for each vector. :
+
+@code{.cpp}
+using namespace cv;
+
+PCA compressPCA(const Mat& pcaset, int maxComponents,
+                const Mat& testset, Mat& compressed)
+{
+    PCA pca(pcaset, // pass the data
+            Mat(), // we do not have a pre-computed mean vector,
+                   // so let the PCA engine to compute it
+            PCA::DATA_AS_ROW, // indicate that the vectors
+                                // are stored as matrix rows
+                                // (use PCA::DATA_AS_COL if the vectors are
+                                // the matrix columns)
+            maxComponents // specify, how many principal components to retain
+            );
+    // if there is no test data, just return the computed basis, ready-to-use
+    if( !testset.data )
+        return pca;
+    CV_Assert( testset.cols == pcaset.cols );
+
+    compressed.create(testset.rows, maxComponents, testset.type());
+
+    Mat reconstructed;
+    for( int i = 0; i < testset.rows; i++ )
+    {
+        Mat vec = testset.row(i), coeffs = compressed.row(i), reconstructed;
+        // compress the vector, the result will be stored
+        // in the i-th row of the output matrix
+        pca.project(vec, coeffs);
+        // and then reconstruct it
+        pca.backProject(coeffs, reconstructed);
+        // and measure the error
+        printf("%d. diff = %g\n", i, norm(vec, reconstructed, NORM_L2));
+    }
+    return pca;
+}
+@endcode
+@sa calcCovarMatrix, mulTransposed, SVD, dft, dct
+*/
+class CV_EXPORTS PCA
+{
+public:
+    enum Flags { DATA_AS_ROW = 0, //!< indicates that the input samples are stored as matrix rows
+                 DATA_AS_COL = 1, //!< indicates that the input samples are stored as matrix columns
+                 USE_AVG     = 2  //!
+               };
+
+    /** @brief default constructor
+
+    The default constructor initializes an empty %PCA structure. The other
+    constructors initialize the structure and call PCA::operator()().
+    */
+    PCA();
+
+    /** @overload
+    @param data input samples stored as matrix rows or matrix columns.
+    @param mean optional mean value; if the matrix is empty (@c noArray()),
+    the mean is computed from the data.
+    @param flags operation flags; currently the parameter is only used to
+    specify the data layout (PCA::Flags)
+    @param maxComponents maximum number of components that %PCA should
+    retain; by default, all the components are retained.
+    */
+    PCA(InputArray data, InputArray mean, int flags, int maxComponents = 0);
+
+    /** @overload
+    @param data input samples stored as matrix rows or matrix columns.
+    @param mean optional mean value; if the matrix is empty (noArray()),
+    the mean is computed from the data.
+    @param flags operation flags; currently the parameter is only used to
+    specify the data layout (PCA::Flags)
+    @param retainedVariance Percentage of variance that PCA should retain.
+    Using this parameter will let the PCA decided how many components to
+    retain but it will always keep at least 2.
+    */
+    PCA(InputArray data, InputArray mean, int flags, double retainedVariance);
+
+    /** @brief performs %PCA
+
+    The operator performs %PCA of the supplied dataset. It is safe to reuse
+    the same PCA structure for multiple datasets. That is, if the structure
+    has been previously used with another dataset, the existing internal
+    data is reclaimed and the new eigenvalues, @ref eigenvectors , and @ref
+    mean are allocated and computed.
+
+    The computed eigenvalues are sorted from the largest to the smallest and
+    the corresponding eigenvectors are stored as eigenvectors rows.
+
+    @param data input samples stored as the matrix rows or as the matrix
+    columns.
+    @param mean optional mean value; if the matrix is empty (noArray()),
+    the mean is computed from the data.
+    @param flags operation flags; currently the parameter is only used to
+    specify the data layout. (Flags)
+    @param maxComponents maximum number of components that PCA should
+    retain; by default, all the components are retained.
+    */
+    PCA& operator()(InputArray data, InputArray mean, int flags, int maxComponents = 0);
+
+    /** @overload
+    @param data input samples stored as the matrix rows or as the matrix
+    columns.
+    @param mean optional mean value; if the matrix is empty (noArray()),
+    the mean is computed from the data.
+    @param flags operation flags; currently the parameter is only used to
+    specify the data layout. (PCA::Flags)
+    @param retainedVariance Percentage of variance that %PCA should retain.
+    Using this parameter will let the %PCA decided how many components to
+    retain but it will always keep at least 2.
+     */
+    PCA& operator()(InputArray data, InputArray mean, int flags, double retainedVariance);
+
+    /** @brief Projects vector(s) to the principal component subspace.
+
+    The methods project one or more vectors to the principal component
+    subspace, where each vector projection is represented by coefficients in
+    the principal component basis. The first form of the method returns the
+    matrix that the second form writes to the result. So the first form can
+    be used as a part of expression while the second form can be more
+    efficient in a processing loop.
+    @param vec input vector(s); must have the same dimensionality and the
+    same layout as the input data used at %PCA phase, that is, if
+    DATA_AS_ROW are specified, then `vec.cols==data.cols`
+    (vector dimensionality) and `vec.rows` is the number of vectors to
+    project, and the same is true for the PCA::DATA_AS_COL case.
+    */
+    Mat project(InputArray vec) const;
+
+    /** @overload
+    @param vec input vector(s); must have the same dimensionality and the
+    same layout as the input data used at PCA phase, that is, if
+    DATA_AS_ROW are specified, then `vec.cols==data.cols`
+    (vector dimensionality) and `vec.rows` is the number of vectors to
+    project, and the same is true for the PCA::DATA_AS_COL case.
+    @param result output vectors; in case of PCA::DATA_AS_COL, the
+    output matrix has as many columns as the number of input vectors, this
+    means that `result.cols==vec.cols` and the number of rows match the
+    number of principal components (for example, `maxComponents` parameter
+    passed to the constructor).
+     */
+    void project(InputArray vec, OutputArray result) const;
+
+    /** @brief Reconstructs vectors from their PC projections.
+
+    The methods are inverse operations to PCA::project. They take PC
+    coordinates of projected vectors and reconstruct the original vectors.
+    Unless all the principal components have been retained, the
+    reconstructed vectors are different from the originals. But typically,
+    the difference is small if the number of components is large enough (but
+    still much smaller than the original vector dimensionality). As a
+    result, PCA is used.
+    @param vec coordinates of the vectors in the principal component
+    subspace, the layout and size are the same as of PCA::project output
+    vectors.
+     */
+    Mat backProject(InputArray vec) const;
+
+    /** @overload
+    @param vec coordinates of the vectors in the principal component
+    subspace, the layout and size are the same as of PCA::project output
+    vectors.
+    @param result reconstructed vectors; the layout and size are the same as
+    of PCA::project input vectors.
+     */
+    void backProject(InputArray vec, OutputArray result) const;
+
+    /** @brief write and load PCA matrix
+
+*/
+    void write(FileStorage& fs ) const;
+    void read(const FileNode& fs);
+
+    Mat eigenvectors; //!< eigenvectors of the covariation matrix
+    Mat eigenvalues; //!< eigenvalues of the covariation matrix
+    Mat mean; //!< mean value subtracted before the projection and added after the back projection
+};
+
+/** @example pca.cpp
+  An example using %PCA for dimensionality reduction while maintaining an amount of variance
+ */
+
+/**
+   @brief Linear Discriminant Analysis
+   @todo document this class
+ */
+class CV_EXPORTS LDA
+{
+public:
+    /** @brief constructor
+    Initializes a LDA with num_components (default 0).
+    */
+    explicit LDA(int num_components = 0);
+
+    /** Initializes and performs a Discriminant Analysis with Fisher's
+     Optimization Criterion on given data in src and corresponding labels
+     in labels. If 0 (or less) number of components are given, they are
+     automatically determined for given data in computation.
+    */
+    LDA(InputArrayOfArrays src, InputArray labels, int num_components = 0);
+
+    /** Serializes this object to a given filename.
+      */
+    void save(const String& filename) const;
+
+    /** Deserializes this object from a given filename.
+      */
+    void load(const String& filename);
+
+    /** Serializes this object to a given cv::FileStorage.
+      */
+    void save(FileStorage& fs) const;
+
+    /** Deserializes this object from a given cv::FileStorage.
+      */
+    void load(const FileStorage& node);
+
+    /** destructor
+      */
+    ~LDA();
+
+    /** Compute the discriminants for data in src (row aligned) and labels.
+      */
+    void compute(InputArrayOfArrays src, InputArray labels);
+
+    /** Projects samples into the LDA subspace.
+        src may be one or more row aligned samples.
+      */
+    Mat project(InputArray src);
+
+    /** Reconstructs projections from the LDA subspace.
+        src may be one or more row aligned projections.
+      */
+    Mat reconstruct(InputArray src);
+
+    /** Returns the eigenvectors of this LDA.
+      */
+    Mat eigenvectors() const { return _eigenvectors; }
+
+    /** Returns the eigenvalues of this LDA.
+      */
+    Mat eigenvalues() const { return _eigenvalues; }
+
+    static Mat subspaceProject(InputArray W, InputArray mean, InputArray src);
+    static Mat subspaceReconstruct(InputArray W, InputArray mean, InputArray src);
+
+protected:
+    bool _dataAsRow; // unused, but needed for 3.0 ABI compatibility.
+    int _num_components;
+    Mat _eigenvectors;
+    Mat _eigenvalues;
+    void lda(InputArrayOfArrays src, InputArray labels);
+};
+
+/** @brief Singular Value Decomposition
+
+Class for computing Singular Value Decomposition of a floating-point
+matrix. The Singular Value Decomposition is used to solve least-square
+problems, under-determined linear systems, invert matrices, compute
+condition numbers, and so on.
+
+If you want to compute a condition number of a matrix or an absolute value of
+its determinant, you do not need `u` and `vt`. You can pass
+flags=SVD::NO_UV|... . Another flag SVD::FULL_UV indicates that full-size u
+and vt must be computed, which is not necessary most of the time.
+
+@sa invert, solve, eigen, determinant
+*/
+class CV_EXPORTS SVD
+{
+public:
+    enum Flags {
+        /** allow the algorithm to modify the decomposed matrix; it can save space and speed up
+            processing. currently ignored. */
+        MODIFY_A = 1,
+        /** indicates that only a vector of singular values `w` is to be processed, while u and vt
+            will be set to empty matrices */
+        NO_UV    = 2,
+        /** when the matrix is not square, by default the algorithm produces u and vt matrices of
+            sufficiently large size for the further A reconstruction; if, however, FULL_UV flag is
+            specified, u and vt will be full-size square orthogonal matrices.*/
+        FULL_UV  = 4
+    };
+
+    /** @brief the default constructor
+
+    initializes an empty SVD structure
+      */
+    SVD();
+
+    /** @overload
+    initializes an empty SVD structure and then calls SVD::operator()
+    @param src decomposed matrix.
+    @param flags operation flags (SVD::Flags)
+      */
+    SVD( InputArray src, int flags = 0 );
+
+    /** @brief the operator that performs SVD. The previously allocated u, w and vt are released.
+
+    The operator performs the singular value decomposition of the supplied
+    matrix. The u,`vt` , and the vector of singular values w are stored in
+    the structure. The same SVD structure can be reused many times with
+    different matrices. Each time, if needed, the previous u,`vt` , and w
+    are reclaimed and the new matrices are created, which is all handled by
+    Mat::create.
+    @param src decomposed matrix.
+    @param flags operation flags (SVD::Flags)
+      */
+    SVD& operator ()( InputArray src, int flags = 0 );
+
+    /** @brief decomposes matrix and stores the results to user-provided matrices
+
+    The methods/functions perform SVD of matrix. Unlike SVD::SVD constructor
+    and SVD::operator(), they store the results to the user-provided
+    matrices:
+
+    @code{.cpp}
+    Mat A, w, u, vt;
+    SVD::compute(A, w, u, vt);
+    @endcode
+
+    @param src decomposed matrix
+    @param w calculated singular values
+    @param u calculated left singular vectors
+    @param vt transposed matrix of right singular values
+    @param flags operation flags - see SVD::SVD.
+      */
+    static void compute( InputArray src, OutputArray w,
+                         OutputArray u, OutputArray vt, int flags = 0 );
+
+    /** @overload
+    computes singular values of a matrix
+    @param src decomposed matrix
+    @param w calculated singular values
+    @param flags operation flags - see SVD::Flags.
+      */
+    static void compute( InputArray src, OutputArray w, int flags = 0 );
+
+    /** @brief performs back substitution
+      */
+    static void backSubst( InputArray w, InputArray u,
+                           InputArray vt, InputArray rhs,
+                           OutputArray dst );
+
+    /** @brief solves an under-determined singular linear system
+
+    The method finds a unit-length solution x of a singular linear system
+    A\*x = 0. Depending on the rank of A, there can be no solutions, a
+    single solution or an infinite number of solutions. In general, the
+    algorithm solves the following problem:
+    \f[dst =  \arg \min _{x:  \| x \| =1}  \| src  \cdot x  \|\f]
+    @param src left-hand-side matrix.
+    @param dst found solution.
+      */
+    static void solveZ( InputArray src, OutputArray dst );
+
+    /** @brief performs a singular value back substitution.
+
+    The method calculates a back substitution for the specified right-hand
+    side:
+
+    \f[\texttt{x} =  \texttt{vt} ^T  \cdot diag( \texttt{w} )^{-1}  \cdot \texttt{u} ^T  \cdot \texttt{rhs} \sim \texttt{A} ^{-1}  \cdot \texttt{rhs}\f]
+
+    Using this technique you can either get a very accurate solution of the
+    convenient linear system, or the best (in the least-squares terms)
+    pseudo-solution of an overdetermined linear system.
+
+    @param rhs right-hand side of a linear system (u\*w\*v')\*dst = rhs to
+    be solved, where A has been previously decomposed.
+
+    @param dst found solution of the system.
+
+    @note Explicit SVD with the further back substitution only makes sense
+    if you need to solve many linear systems with the same left-hand side
+    (for example, src ). If all you need is to solve a single system
+    (possibly with multiple rhs immediately available), simply call solve
+    add pass DECOMP_SVD there. It does absolutely the same thing.
+      */
+    void backSubst( InputArray rhs, OutputArray dst ) const;
+
+    /** @todo document */
+    template<typename _Tp, int m, int n, int nm> static
+    void compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w, Matx<_Tp, m, nm>& u, Matx<_Tp, n, nm>& vt );
+
+    /** @todo document */
+    template<typename _Tp, int m, int n, int nm> static
+    void compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w );
+
+    /** @todo document */
+    template<typename _Tp, int m, int n, int nm, int nb> static
+    void backSubst( const Matx<_Tp, nm, 1>& w, const Matx<_Tp, m, nm>& u, const Matx<_Tp, n, nm>& vt, const Matx<_Tp, m, nb>& rhs, Matx<_Tp, n, nb>& dst );
+
+    Mat u, w, vt;
+};
+
+/** @brief Random Number Generator
+
+Random number generator. It encapsulates the state (currently, a 64-bit
+integer) and has methods to return scalar random values and to fill
+arrays with random values. Currently it supports uniform and Gaussian
+(normal) distributions. The generator uses Multiply-With-Carry
+algorithm, introduced by G. Marsaglia (
+<http://en.wikipedia.org/wiki/Multiply-with-carry> ).
+Gaussian-distribution random numbers are generated using the Ziggurat
+algorithm ( <http://en.wikipedia.org/wiki/Ziggurat_algorithm> ),
+introduced by G. Marsaglia and W. W. Tsang.
+*/
+class CV_EXPORTS RNG
+{
+public:
+    enum { UNIFORM = 0,
+           NORMAL  = 1
+         };
+
+    /** @brief constructor
+
+    These are the RNG constructors. The first form sets the state to some
+    pre-defined value, equal to 2\*\*32-1 in the current implementation. The
+    second form sets the state to the specified value. If you passed state=0
+    , the constructor uses the above default value instead to avoid the
+    singular random number sequence, consisting of all zeros.
+    */
+    RNG();
+    /** @overload
+    @param state 64-bit value used to initialize the RNG.
+    */
+    RNG(uint64 state);
+    /**The method updates the state using the MWC algorithm and returns the
+    next 32-bit random number.*/
+    unsigned next();
+
+    /**Each of the methods updates the state using the MWC algorithm and
+    returns the next random number of the specified type. In case of integer
+    types, the returned number is from the available value range for the
+    specified type. In case of floating-point types, the returned value is
+    from [0,1) range.
+    */
+    operator uchar();
+    /** @overload */
+    operator schar();
+    /** @overload */
+    operator ushort();
+    /** @overload */
+    operator short();
+    /** @overload */
+    operator unsigned();
+    /** @overload */
+    operator int();
+    /** @overload */
+    operator float();
+    /** @overload */
+    operator double();
+
+    /** @brief returns a random integer sampled uniformly from [0, N).
+
+    The methods transform the state using the MWC algorithm and return the
+    next random number. The first form is equivalent to RNG::next . The
+    second form returns the random number modulo N , which means that the
+    result is in the range [0, N) .
+    */
+    unsigned operator ()();
+    /** @overload
+    @param N upper non-inclusive boundary of the returned random number.
+    */
+    unsigned operator ()(unsigned N);
+
+    /** @brief returns uniformly distributed integer random number from [a,b) range
+
+    The methods transform the state using the MWC algorithm and return the
+    next uniformly-distributed random number of the specified type, deduced
+    from the input parameter type, from the range [a, b) . There is a nuance
+    illustrated by the following sample:
+
+    @code{.cpp}
+    RNG rng;
+
+    // always produces 0
+    double a = rng.uniform(0, 1);
+
+    // produces double from [0, 1)
+    double a1 = rng.uniform((double)0, (double)1);
+
+    // produces float from [0, 1)
+    double b = rng.uniform(0.f, 1.f);
+
+    // produces double from [0, 1)
+    double c = rng.uniform(0., 1.);
+
+    // may cause compiler error because of ambiguity:
+    //  RNG::uniform(0, (int)0.999999)? or RNG::uniform((double)0, 0.99999)?
+    double d = rng.uniform(0, 0.999999);
+    @endcode
+
+    The compiler does not take into account the type of the variable to
+    which you assign the result of RNG::uniform . The only thing that
+    matters to the compiler is the type of a and b parameters. So, if you
+    want a floating-point random number, but the range boundaries are
+    integer numbers, either put dots in the end, if they are constants, or
+    use explicit type cast operators, as in the a1 initialization above.
+    @param a lower inclusive boundary of the returned random numbers.
+    @param b upper non-inclusive boundary of the returned random numbers.
+      */
+    int uniform(int a, int b);
+    /** @overload */
+    float uniform(float a, float b);
+    /** @overload */
+    double uniform(double a, double b);
+
+    /** @brief Fills arrays with random numbers.
+
+    @param mat 2D or N-dimensional matrix; currently matrices with more than
+    4 channels are not supported by the methods, use Mat::reshape as a
+    possible workaround.
+    @param distType distribution type, RNG::UNIFORM or RNG::NORMAL.
+    @param a first distribution parameter; in case of the uniform
+    distribution, this is an inclusive lower boundary, in case of the normal
+    distribution, this is a mean value.
+    @param b second distribution parameter; in case of the uniform
+    distribution, this is a non-inclusive upper boundary, in case of the
+    normal distribution, this is a standard deviation (diagonal of the
+    standard deviation matrix or the full standard deviation matrix).
+    @param saturateRange pre-saturation flag; for uniform distribution only;
+    if true, the method will first convert a and b to the acceptable value
+    range (according to the mat datatype) and then will generate uniformly
+    distributed random numbers within the range [saturate(a), saturate(b)),
+    if saturateRange=false, the method will generate uniformly distributed
+    random numbers in the original range [a, b) and then will saturate them,
+    it means, for example, that
+    <tt>theRNG().fill(mat_8u, RNG::UNIFORM, -DBL_MAX, DBL_MAX)</tt> will likely
+    produce array mostly filled with 0's and 255's, since the range (0, 255)
+    is significantly smaller than [-DBL_MAX, DBL_MAX).
+
+    Each of the methods fills the matrix with the random values from the
+    specified distribution. As the new numbers are generated, the RNG state
+    is updated accordingly. In case of multiple-channel images, every
+    channel is filled independently, which means that RNG cannot generate
+    samples from the multi-dimensional Gaussian distribution with
+    non-diagonal covariance matrix directly. To do that, the method
+    generates samples from multi-dimensional standard Gaussian distribution
+    with zero mean and identity covariation matrix, and then transforms them
+    using transform to get samples from the specified Gaussian distribution.
+    */
+    void fill( InputOutputArray mat, int distType, InputArray a, InputArray b, bool saturateRange = false );
+
+    /** @brief Returns the next random number sampled from the Gaussian distribution
+    @param sigma standard deviation of the distribution.
+
+    The method transforms the state using the MWC algorithm and returns the
+    next random number from the Gaussian distribution N(0,sigma) . That is,
+    the mean value of the returned random numbers is zero and the standard
+    deviation is the specified sigma .
+    */
+    double gaussian(double sigma);
+
+    uint64 state;
+};
+
+/** @brief Mersenne Twister random number generator
+
+Inspired by http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c
+@todo document
+ */
+class CV_EXPORTS RNG_MT19937
+{
+public:
+    RNG_MT19937();
+    RNG_MT19937(unsigned s);
+    void seed(unsigned s);
+
+    unsigned next();
+
+    operator int();
+    operator unsigned();
+    operator float();
+    operator double();
+
+    unsigned operator ()(unsigned N);
+    unsigned operator ()();
+
+    /** @brief returns uniformly distributed integer random number from [a,b) range
+
+*/
+    int uniform(int a, int b);
+    /** @brief returns uniformly distributed floating-point random number from [a,b) range
+
+*/
+    float uniform(float a, float b);
+    /** @brief returns uniformly distributed double-precision floating-point random number from [a,b) range
+
+*/
+    double uniform(double a, double b);
+
+private:
+    enum PeriodParameters {N = 624, M = 397};
+    unsigned state[N];
+    int mti;
+};
+
+//! @} core_array
+
+//! @addtogroup core_cluster
+//!  @{
+
+/** @example kmeans.cpp
+  An example on K-means clustering
+*/
+
+/** @brief Finds centers of clusters and groups input samples around the clusters.
+
+The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
+and groups the input samples around the clusters. As an output, \f$\texttt{labels}_i\f$ contains a
+0-based cluster index for the sample stored in the \f$i^{th}\f$ row of the samples matrix.
+
+@note
+-   (Python) An example on K-means clustering can be found at
+    opencv_source_code/samples/python/kmeans.py
+@param data Data for clustering. An array of N-Dimensional points with float coordinates is needed.
+Examples of this array can be:
+-   Mat points(count, 2, CV_32F);
+-   Mat points(count, 1, CV_32FC2);
+-   Mat points(1, count, CV_32FC2);
+-   std::vector\<cv::Point2f\> points(sampleCount);
+@param K Number of clusters to split the set by.
+@param bestLabels Input/output integer array that stores the cluster indices for every sample.
+@param criteria The algorithm termination criteria, that is, the maximum number of iterations and/or
+the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster
+centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
+@param attempts Flag to specify the number of times the algorithm is executed using different
+initial labellings. The algorithm returns the labels that yield the best compactness (see the last
+function parameter).
+@param flags Flag that can take values of cv::KmeansFlags
+@param centers Output matrix of the cluster centers, one row per each cluster center.
+@return The function returns the compactness measure that is computed as
+\f[\sum _i  \| \texttt{samples} _i -  \texttt{centers} _{ \texttt{labels} _i} \| ^2\f]
+after every attempt. The best (minimum) value is chosen and the corresponding labels and the
+compactness value are returned by the function. Basically, you can use only the core of the
+function, set the number of attempts to 1, initialize labels each time using a custom algorithm,
+pass them with the ( flags = KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best
+(most-compact) clustering.
+*/
+CV_EXPORTS_W double kmeans( InputArray data, int K, InputOutputArray bestLabels,
+                            TermCriteria criteria, int attempts,
+                            int flags, OutputArray centers = noArray() );
+
+//! @} core_cluster
+
+//! @addtogroup core_basic
+//! @{
+
+/////////////////////////////// Formatted output of cv::Mat ///////////////////////////
+
+/** @todo document */
+class CV_EXPORTS Formatted
+{
+public:
+    virtual const char* next() = 0;
+    virtual void reset() = 0;
+    virtual ~Formatted();
+};
+
+/** @todo document */
+class CV_EXPORTS Formatter
+{
+public:
+    enum { FMT_DEFAULT = 0,
+           FMT_MATLAB  = 1,
+           FMT_CSV     = 2,
+           FMT_PYTHON  = 3,
+           FMT_NUMPY   = 4,
+           FMT_C       = 5
+         };
+
+    virtual ~Formatter();
+
+    virtual Ptr<Formatted> format(const Mat& mtx) const = 0;
+
+    virtual void set32fPrecision(int p = 8) = 0;
+    virtual void set64fPrecision(int p = 16) = 0;
+    virtual void setMultiline(bool ml = true) = 0;
+
+    static Ptr<Formatter> get(int fmt = FMT_DEFAULT);
+
+};
+
+static inline
+String& operator << (String& out, Ptr<Formatted> fmtd)
+{
+    fmtd->reset();
+    for(const char* str = fmtd->next(); str; str = fmtd->next())
+        out += cv::String(str);
+    return out;
+}
+
+static inline
+String& operator << (String& out, const Mat& mtx)
+{
+    return out << Formatter::get()->format(mtx);
+}
+
+//////////////////////////////////////// Algorithm ////////////////////////////////////
+
+class CV_EXPORTS Algorithm;
+
+template<typename _Tp> struct ParamType {};
+
+
+/** @brief This is a base class for all more or less complex algorithms in OpenCV
+
+especially for classes of algorithms, for which there can be multiple implementations. The examples
+are stereo correspondence (for which there are algorithms like block matching, semi-global block
+matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians
+models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck
+etc.).
+
+Here is example of SIFT use in your application via Algorithm interface:
+@code
+    #include "opencv2/opencv.hpp"
+    #include "opencv2/xfeatures2d.hpp"
+    using namespace cv::xfeatures2d;
+
+    Ptr<Feature2D> sift = SIFT::create();
+    FileStorage fs("sift_params.xml", FileStorage::READ);
+    if( fs.isOpened() ) // if we have file with parameters, read them
+    {
+        sift->read(fs["sift_params"]);
+        fs.release();
+    }
+    else // else modify the parameters and store them; user can later edit the file to use different parameters
+    {
+        sift->setContrastThreshold(0.01f); // lower the contrast threshold, compared to the default value
+        {
+            WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
+            sift->write(fs);
+        }
+    }
+    Mat image = imread("myimage.png", 0), descriptors;
+    vector<KeyPoint> keypoints;
+    sift->detectAndCompute(image, noArray(), keypoints, descriptors);
+@endcode
+ */
+class CV_EXPORTS_W Algorithm
+{
+public:
+    Algorithm();
+    virtual ~Algorithm();
+
+    /** @brief Clears the algorithm state
+    */
+    CV_WRAP virtual void clear() {}
+
+    /** @brief Stores algorithm parameters in a file storage
+    */
+    virtual void write(FileStorage& fs) const { (void)fs; }
+
+    /** @brief Reads algorithm parameters from a file storage
+    */
+    virtual void read(const FileNode& fn) { (void)fn; }
+
+    /** @brief Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
+     */
+    virtual bool empty() const { return false; }
+
+    /** @brief Reads algorithm from the file node
+
+     This is static template method of Algorithm. It's usage is following (in the case of SVM):
+     @code
+     Ptr<SVM> svm = Algorithm::read<SVM>(fn);
+     @endcode
+     In order to make this method work, the derived class must overwrite Algorithm::read(const
+     FileNode& fn) and also have static create() method without parameters
+     (or with all the optional parameters)
+     */
+    template<typename _Tp> static Ptr<_Tp> read(const FileNode& fn)
+    {
+        Ptr<_Tp> obj = _Tp::create();
+        obj->read(fn);
+        return !obj->empty() ? obj : Ptr<_Tp>();
+    }
+
+    /** @brief Loads algorithm from the file
+
+     @param filename Name of the file to read.
+     @param objname The optional name of the node to read (if empty, the first top-level node will be used)
+
+     This is static template method of Algorithm. It's usage is following (in the case of SVM):
+     @code
+     Ptr<SVM> svm = Algorithm::load<SVM>("my_svm_model.xml");
+     @endcode
+     In order to make this method work, the derived class must overwrite Algorithm::read(const
+     FileNode& fn).
+     */
+    template<typename _Tp> static Ptr<_Tp> load(const String& filename, const String& objname=String())
+    {
+        FileStorage fs(filename, FileStorage::READ);
+        FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
+        Ptr<_Tp> obj = _Tp::create();
+        obj->read(fn);
+        return !obj->empty() ? obj : Ptr<_Tp>();
+    }
+
+    /** @brief Loads algorithm from a String
+
+     @param strModel The string variable containing the model you want to load.
+     @param objname The optional name of the node to read (if empty, the first top-level node will be used)
+
+     This is static template method of Algorithm. It's usage is following (in the case of SVM):
+     @code
+     Ptr<SVM> svm = Algorithm::loadFromString<SVM>(myStringModel);
+     @endcode
+     */
+    template<typename _Tp> static Ptr<_Tp> loadFromString(const String& strModel, const String& objname=String())
+    {
+        FileStorage fs(strModel, FileStorage::READ + FileStorage::MEMORY);
+        FileNode fn = objname.empty() ? fs.getFirstTopLevelNode() : fs[objname];
+        Ptr<_Tp> obj = _Tp::create();
+        obj->read(fn);
+        return !obj->empty() ? obj : Ptr<_Tp>();
+    }
+
+    /** Saves the algorithm to a file.
+     In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs). */
+    CV_WRAP virtual void save(const String& filename) const;
+
+    /** Returns the algorithm string identifier.
+     This string is used as top level xml/yml node tag when the object is saved to a file or string. */
+    CV_WRAP virtual String getDefaultName() const;
+};
+
+struct Param {
+    enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7,
+           UNSIGNED_INT=8, UINT64=9, UCHAR=11 };
+};
+
+
+
+template<> struct ParamType<bool>
+{
+    typedef bool const_param_type;
+    typedef bool member_type;
+
+    enum { type = Param::BOOLEAN };
+};
+
+template<> struct ParamType<int>
+{
+    typedef int const_param_type;
+    typedef int member_type;
+
+    enum { type = Param::INT };
+};
+
+template<> struct ParamType<double>
+{
+    typedef double const_param_type;
+    typedef double member_type;
+
+    enum { type = Param::REAL };
+};
+
+template<> struct ParamType<String>
+{
+    typedef const String& const_param_type;
+    typedef String member_type;
+
+    enum { type = Param::STRING };
+};
+
+template<> struct ParamType<Mat>
+{
+    typedef const Mat& const_param_type;
+    typedef Mat member_type;
+
+    enum { type = Param::MAT };
+};
+
+template<> struct ParamType<std::vector<Mat> >
+{
+    typedef const std::vector<Mat>& const_param_type;
+    typedef std::vector<Mat> member_type;
+
+    enum { type = Param::MAT_VECTOR };
+};
+
+template<> struct ParamType<Algorithm>
+{
+    typedef const Ptr<Algorithm>& const_param_type;
+    typedef Ptr<Algorithm> member_type;
+
+    enum { type = Param::ALGORITHM };
+};
+
+template<> struct ParamType<float>
+{
+    typedef float const_param_type;
+    typedef float member_type;
+
+    enum { type = Param::FLOAT };
+};
+
+template<> struct ParamType<unsigned>
+{
+    typedef unsigned const_param_type;
+    typedef unsigned member_type;
+
+    enum { type = Param::UNSIGNED_INT };
+};
+
+template<> struct ParamType<uint64>
+{
+    typedef uint64 const_param_type;
+    typedef uint64 member_type;
+
+    enum { type = Param::UINT64 };
+};
+
+template<> struct ParamType<uchar>
+{
+    typedef uchar const_param_type;
+    typedef uchar member_type;
+
+    enum { type = Param::UCHAR };
+};
+
+//! @} core_basic
+
+} //namespace cv
+
+#include "opencv2/core/operations.hpp"
+#include "opencv2/core/cvstd.inl.hpp"
+#include "opencv2/core/utility.hpp"
+#include "opencv2/core/optim.hpp"
+
+#endif /*__OPENCV_CORE_HPP__*/
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp
new file mode 100644
index 0000000..2bce5b9
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/affine.hpp
@@ -0,0 +1,522 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_AFFINE3_HPP__
+#define __OPENCV_CORE_AFFINE3_HPP__
+
+#ifdef __cplusplus
+
+#include <opencv2/core.hpp>
+
+namespace cv
+{
+
+//! @addtogroup core
+//! @{
+
+    /** @brief Affine transform
+      @todo document
+     */
+    template<typename T>
+    class Affine3
+    {
+    public:
+        typedef T float_type;
+        typedef Matx<float_type, 3, 3> Mat3;
+        typedef Matx<float_type, 4, 4> Mat4;
+        typedef Vec<float_type, 3> Vec3;
+
+        Affine3();
+
+        //! Augmented affine matrix
+        Affine3(const Mat4& affine);
+
+        //! Rotation matrix
+        Affine3(const Mat3& R, const Vec3& t = Vec3::all(0));
+
+        //! Rodrigues vector
+        Affine3(const Vec3& rvec, const Vec3& t = Vec3::all(0));
+
+        //! Combines all contructors above. Supports 4x4, 4x3, 3x3, 1x3, 3x1 sizes of data matrix
+        explicit Affine3(const Mat& data, const Vec3& t = Vec3::all(0));
+
+        //! From 16th element array
+        explicit Affine3(const float_type* vals);
+
+        //! Create identity transform
+        static Affine3 Identity();
+
+        //! Rotation matrix
+        void rotation(const Mat3& R);
+
+        //! Rodrigues vector
+        void rotation(const Vec3& rvec);
+
+        //! Combines rotation methods above. Suports 3x3, 1x3, 3x1 sizes of data matrix;
+        void rotation(const Mat& data);
+
+        void linear(const Mat3& L);
+        void translation(const Vec3& t);
+
+        Mat3 rotation() const;
+        Mat3 linear() const;
+        Vec3 translation() const;
+
+        //! Rodrigues vector
+        Vec3 rvec() const;
+
+        Affine3 inv(int method = cv::DECOMP_SVD) const;
+
+        //! a.rotate(R) is equivalent to Affine(R, 0) * a;
+        Affine3 rotate(const Mat3& R) const;
+
+        //! a.rotate(rvec) is equivalent to Affine(rvec, 0) * a;
+        Affine3 rotate(const Vec3& rvec) const;
+
+        //! a.translate(t) is equivalent to Affine(E, t) * a;
+        Affine3 translate(const Vec3& t) const;
+
+        //! a.concatenate(affine) is equivalent to affine * a;
+        Affine3 concatenate(const Affine3& affine) const;
+
+        template <typename Y> operator Affine3<Y>() const;
+
+        template <typename Y> Affine3<Y> cast() const;
+
+        Mat4 matrix;
+
+#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
+        Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine);
+        Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine);
+        operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const;
+        operator Eigen::Transform<T, 3, Eigen::Affine>() const;
+#endif
+    };
+
+    template<typename T> static
+    Affine3<T> operator*(const Affine3<T>& affine1, const Affine3<T>& affine2);
+
+    template<typename T, typename V> static
+    V operator*(const Affine3<T>& affine, const V& vector);
+
+    typedef Affine3<float> Affine3f;
+    typedef Affine3<double> Affine3d;
+
+    static Vec3f operator*(const Affine3f& affine, const Vec3f& vector);
+    static Vec3d operator*(const Affine3d& affine, const Vec3d& vector);
+
+    template<typename _Tp> class DataType< Affine3<_Tp> >
+    {
+    public:
+        typedef Affine3<_Tp>                               value_type;
+        typedef Affine3<typename DataType<_Tp>::work_type> work_type;
+        typedef _Tp                                        channel_type;
+
+        enum { generic_type = 0,
+               depth        = DataType<channel_type>::depth,
+               channels     = 16,
+               fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+               type         = CV_MAKETYPE(depth, channels)
+             };
+
+        typedef Vec<channel_type, channels> vec_type;
+    };
+
+//! @} core
+
+}
+
+//! @cond IGNORED
+
+///////////////////////////////////////////////////////////////////////////////////
+// Implementaiton
+
+template<typename T> inline
+cv::Affine3<T>::Affine3()
+    : matrix(Mat4::eye())
+{}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Mat4& affine)
+    : matrix(affine)
+{}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Mat3& R, const Vec3& t)
+{
+    rotation(R);
+    translation(t);
+    matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
+    matrix.val[15] = 1;
+}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Vec3& _rvec, const Vec3& t)
+{
+    rotation(_rvec);
+    translation(t);
+    matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
+    matrix.val[15] = 1;
+}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
+{
+    CV_Assert(data.type() == cv::DataType<T>::type);
+
+    if (data.cols == 4 && data.rows == 4)
+    {
+        data.copyTo(matrix);
+        return;
+    }
+    else if (data.cols == 4 && data.rows == 3)
+    {
+        rotation(data(Rect(0, 0, 3, 3)));
+        translation(data(Rect(3, 0, 1, 3)));
+        return;
+    }
+
+    rotation(data);
+    translation(t);
+    matrix.val[12] = matrix.val[13] = matrix.val[14] = 0;
+    matrix.val[15] = 1;
+}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const float_type* vals) : matrix(vals)
+{}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::Identity()
+{
+    return Affine3<T>(cv::Affine3<T>::Mat4::eye());
+}
+
+template<typename T> inline
+void cv::Affine3<T>::rotation(const Mat3& R)
+{
+    linear(R);
+}
+
+template<typename T> inline
+void cv::Affine3<T>::rotation(const Vec3& _rvec)
+{
+    double rx = _rvec[0], ry = _rvec[1], rz = _rvec[2];
+    double theta = std::sqrt(rx*rx + ry*ry + rz*rz);
+
+    if (theta < DBL_EPSILON)
+        rotation(Mat3::eye());
+    else
+    {
+        const double I[] = { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
+
+        double c = std::cos(theta);
+        double s = std::sin(theta);
+        double c1 = 1. - c;
+        double itheta = (theta != 0) ? 1./theta : 0.;
+
+        rx *= itheta; ry *= itheta; rz *= itheta;
+
+        double rrt[] = { rx*rx, rx*ry, rx*rz, rx*ry, ry*ry, ry*rz, rx*rz, ry*rz, rz*rz };
+        double _r_x_[] = { 0, -rz, ry, rz, 0, -rx, -ry, rx, 0 };
+        Mat3 R;
+
+        // R = cos(theta)*I + (1 - cos(theta))*r*rT + sin(theta)*[r_x]
+        // where [r_x] is [0 -rz ry; rz 0 -rx; -ry rx 0]
+        for(int k = 0; k < 9; ++k)
+            R.val[k] = static_cast<float_type>(c*I[k] + c1*rrt[k] + s*_r_x_[k]);
+
+        rotation(R);
+    }
+}
+
+//Combines rotation methods above. Suports 3x3, 1x3, 3x1 sizes of data matrix;
+template<typename T> inline
+void cv::Affine3<T>::rotation(const cv::Mat& data)
+{
+    CV_Assert(data.type() == cv::DataType<T>::type);
+
+    if (data.cols == 3 && data.rows == 3)
+    {
+        Mat3 R;
+        data.copyTo(R);
+        rotation(R);
+    }
+    else if ((data.cols == 3 && data.rows == 1) || (data.cols == 1 && data.rows == 3))
+    {
+        Vec3 _rvec;
+        data.reshape(1, 3).copyTo(_rvec);
+        rotation(_rvec);
+    }
+    else
+        CV_Assert(!"Input marix can be 3x3, 1x3 or 3x1");
+}
+
+template<typename T> inline
+void cv::Affine3<T>::linear(const Mat3& L)
+{
+    matrix.val[0] = L.val[0]; matrix.val[1] = L.val[1];  matrix.val[ 2] = L.val[2];
+    matrix.val[4] = L.val[3]; matrix.val[5] = L.val[4];  matrix.val[ 6] = L.val[5];
+    matrix.val[8] = L.val[6]; matrix.val[9] = L.val[7];  matrix.val[10] = L.val[8];
+}
+
+template<typename T> inline
+void cv::Affine3<T>::translation(const Vec3& t)
+{
+    matrix.val[3] = t[0]; matrix.val[7] = t[1]; matrix.val[11] = t[2];
+}
+
+template<typename T> inline
+typename cv::Affine3<T>::Mat3 cv::Affine3<T>::rotation() const
+{
+    return linear();
+}
+
+template<typename T> inline
+typename cv::Affine3<T>::Mat3 cv::Affine3<T>::linear() const
+{
+    typename cv::Affine3<T>::Mat3 R;
+    R.val[0] = matrix.val[0];  R.val[1] = matrix.val[1];  R.val[2] = matrix.val[ 2];
+    R.val[3] = matrix.val[4];  R.val[4] = matrix.val[5];  R.val[5] = matrix.val[ 6];
+    R.val[6] = matrix.val[8];  R.val[7] = matrix.val[9];  R.val[8] = matrix.val[10];
+    return R;
+}
+
+template<typename T> inline
+typename cv::Affine3<T>::Vec3 cv::Affine3<T>::translation() const
+{
+    return Vec3(matrix.val[3], matrix.val[7], matrix.val[11]);
+}
+
+template<typename T> inline
+typename cv::Affine3<T>::Vec3 cv::Affine3<T>::rvec() const
+{
+    cv::Vec3d w;
+    cv::Matx33d u, vt, R = rotation();
+    cv::SVD::compute(R, w, u, vt, cv::SVD::FULL_UV + cv::SVD::MODIFY_A);
+    R = u * vt;
+
+    double rx = R.val[7] - R.val[5];
+    double ry = R.val[2] - R.val[6];
+    double rz = R.val[3] - R.val[1];
+
+    double s = std::sqrt((rx*rx + ry*ry + rz*rz)*0.25);
+    double c = (R.val[0] + R.val[4] + R.val[8] - 1) * 0.5;
+    c = c > 1.0 ? 1.0 : c < -1.0 ? -1.0 : c;
+    double theta = acos(c);
+
+    if( s < 1e-5 )
+    {
+        if( c > 0 )
+            rx = ry = rz = 0;
+        else
+        {
+            double t;
+            t = (R.val[0] + 1) * 0.5;
+            rx = std::sqrt(std::max(t, 0.0));
+            t = (R.val[4] + 1) * 0.5;
+            ry = std::sqrt(std::max(t, 0.0)) * (R.val[1] < 0 ? -1.0 : 1.0);
+            t = (R.val[8] + 1) * 0.5;
+            rz = std::sqrt(std::max(t, 0.0)) * (R.val[2] < 0 ? -1.0 : 1.0);
+
+            if( fabs(rx) < fabs(ry) && fabs(rx) < fabs(rz) && (R.val[5] > 0) != (ry*rz > 0) )
+                rz = -rz;
+            theta /= std::sqrt(rx*rx + ry*ry + rz*rz);
+            rx *= theta;
+            ry *= theta;
+            rz *= theta;
+        }
+    }
+    else
+    {
+        double vth = 1/(2*s);
+        vth *= theta;
+        rx *= vth; ry *= vth; rz *= vth;
+    }
+
+    return cv::Vec3d(rx, ry, rz);
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::inv(int method) const
+{
+    return matrix.inv(method);
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::rotate(const Mat3& R) const
+{
+    Mat3 Lc = linear();
+    Vec3 tc = translation();
+    Mat4 result;
+    result.val[12] = result.val[13] = result.val[14] = 0;
+    result.val[15] = 1;
+
+    for(int j = 0; j < 3; ++j)
+    {
+        for(int i = 0; i < 3; ++i)
+        {
+            float_type value = 0;
+            for(int k = 0; k < 3; ++k)
+                value += R(j, k) * Lc(k, i);
+            result(j, i) = value;
+        }
+
+        result(j, 3) = R.row(j).dot(tc.t());
+    }
+    return result;
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::rotate(const Vec3& _rvec) const
+{
+    return rotate(Affine3f(_rvec).rotation());
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::translate(const Vec3& t) const
+{
+    Mat4 m = matrix;
+    m.val[ 3] += t[0];
+    m.val[ 7] += t[1];
+    m.val[11] += t[2];
+    return m;
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::Affine3<T>::concatenate(const Affine3<T>& affine) const
+{
+    return (*this).rotate(affine.rotation()).translate(affine.translation());
+}
+
+template<typename T> template <typename Y> inline
+cv::Affine3<T>::operator Affine3<Y>() const
+{
+    return Affine3<Y>(matrix);
+}
+
+template<typename T> template <typename Y> inline
+cv::Affine3<Y> cv::Affine3<T>::cast() const
+{
+    return Affine3<Y>(matrix);
+}
+
+template<typename T> inline
+cv::Affine3<T> cv::operator*(const cv::Affine3<T>& affine1, const cv::Affine3<T>& affine2)
+{
+    return affine2.concatenate(affine1);
+}
+
+template<typename T, typename V> inline
+V cv::operator*(const cv::Affine3<T>& affine, const V& v)
+{
+    const typename Affine3<T>::Mat4& m = affine.matrix;
+
+    V r;
+    r.x = m.val[0] * v.x + m.val[1] * v.y + m.val[ 2] * v.z + m.val[ 3];
+    r.y = m.val[4] * v.x + m.val[5] * v.y + m.val[ 6] * v.z + m.val[ 7];
+    r.z = m.val[8] * v.x + m.val[9] * v.y + m.val[10] * v.z + m.val[11];
+    return r;
+}
+
+static inline
+cv::Vec3f cv::operator*(const cv::Affine3f& affine, const cv::Vec3f& v)
+{
+    const cv::Matx44f& m = affine.matrix;
+    cv::Vec3f r;
+    r.val[0] = m.val[0] * v[0] + m.val[1] * v[1] + m.val[ 2] * v[2] + m.val[ 3];
+    r.val[1] = m.val[4] * v[0] + m.val[5] * v[1] + m.val[ 6] * v[2] + m.val[ 7];
+    r.val[2] = m.val[8] * v[0] + m.val[9] * v[1] + m.val[10] * v[2] + m.val[11];
+    return r;
+}
+
+static inline
+cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
+{
+    const cv::Matx44d& m = affine.matrix;
+    cv::Vec3d r;
+    r.val[0] = m.val[0] * v[0] + m.val[1] * v[1] + m.val[ 2] * v[2] + m.val[ 3];
+    r.val[1] = m.val[4] * v[0] + m.val[5] * v[1] + m.val[ 6] * v[2] + m.val[ 7];
+    r.val[2] = m.val[8] * v[0] + m.val[9] * v[1] + m.val[10] * v[2] + m.val[11];
+    return r;
+}
+
+
+
+#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine)
+{
+    cv::Mat(4, 4, cv::DataType<T>::type, affine.matrix().data()).copyTo(matrix);
+}
+
+template<typename T> inline
+cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine)
+{
+    Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> a = affine;
+    cv::Mat(4, 4, cv::DataType<T>::type, a.matrix().data()).copyTo(matrix);
+}
+
+template<typename T> inline
+cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const
+{
+    Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> r;
+    cv::Mat hdr(4, 4, cv::DataType<T>::type, r.matrix().data());
+    cv::Mat(matrix, false).copyTo(hdr);
+    return r;
+}
+
+template<typename T> inline
+cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine>() const
+{
+    return this->operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>();
+}
+
+#endif /* defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H */
+
+//! @endcond
+
+#endif /* __cplusplus */
+
+#endif /* __OPENCV_CORE_AFFINE3_HPP__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/base.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/base.hpp
new file mode 100644
index 0000000..ed633f5
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/base.hpp
@@ -0,0 +1,689 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2014, Itseez 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*/
+
+#ifndef __OPENCV_CORE_BASE_HPP__
+#define __OPENCV_CORE_BASE_HPP__
+
+#ifndef __cplusplus
+#  error base.hpp header must be compiled as C++
+#endif
+
+#include <climits>
+#include <algorithm>
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/cvstd.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_utils
+//! @{
+
+namespace Error {
+//! error codes
+enum Code {
+    StsOk=                       0,  //!< everithing is ok
+    StsBackTrace=               -1,  //!< pseudo error for back trace
+    StsError=                   -2,  //!< unknown /unspecified error
+    StsInternal=                -3,  //!< internal error (bad state)
+    StsNoMem=                   -4,  //!< insufficient memory
+    StsBadArg=                  -5,  //!< function arg/param is bad
+    StsBadFunc=                 -6,  //!< unsupported function
+    StsNoConv=                  -7,  //!< iter. didn't converge
+    StsAutoTrace=               -8,  //!< tracing
+    HeaderIsNull=               -9,  //!< image header is NULL
+    BadImageSize=              -10,  //!< image size is invalid
+    BadOffset=                 -11,  //!< offset is invalid
+    BadDataPtr=                -12,  //!<
+    BadStep=                   -13,  //!<
+    BadModelOrChSeq=           -14,  //!<
+    BadNumChannels=            -15,  //!<
+    BadNumChannel1U=           -16,  //!<
+    BadDepth=                  -17,  //!<
+    BadAlphaChannel=           -18,  //!<
+    BadOrder=                  -19,  //!<
+    BadOrigin=                 -20,  //!<
+    BadAlign=                  -21,  //!<
+    BadCallBack=               -22,  //!<
+    BadTileSize=               -23,  //!<
+    BadCOI=                    -24,  //!<
+    BadROISize=                -25,  //!<
+    MaskIsTiled=               -26,  //!<
+    StsNullPtr=                -27,  //!< null pointer
+    StsVecLengthErr=           -28,  //!< incorrect vector length
+    StsFilterStructContentErr= -29,  //!< incorr. filter structure content
+    StsKernelStructContentErr= -30,  //!< incorr. transform kernel content
+    StsFilterOffsetErr=        -31,  //!< incorrect filter ofset value
+    StsBadSize=                -201, //!< the input/output structure size is incorrect
+    StsDivByZero=              -202, //!< division by zero
+    StsInplaceNotSupported=    -203, //!< in-place operation is not supported
+    StsObjectNotFound=         -204, //!< request can't be completed
+    StsUnmatchedFormats=       -205, //!< formats of input/output arrays differ
+    StsBadFlag=                -206, //!< flag is wrong or not supported
+    StsBadPoint=               -207, //!< bad CvPoint
+    StsBadMask=                -208, //!< bad format of mask (neither 8uC1 nor 8sC1)
+    StsUnmatchedSizes=         -209, //!< sizes of input/output structures do not match
+    StsUnsupportedFormat=      -210, //!< the data format/type is not supported by the function
+    StsOutOfRange=             -211, //!< some of parameters are out of range
+    StsParseError=             -212, //!< invalid syntax/structure of the parsed file
+    StsNotImplemented=         -213, //!< the requested function/feature is not implemented
+    StsBadMemBlock=            -214, //!< an allocated block has been corrupted
+    StsAssert=                 -215, //!< assertion failed
+    GpuNotSupported=           -216,
+    GpuApiCallError=           -217,
+    OpenGlNotSupported=        -218,
+    OpenGlApiCallError=        -219,
+    OpenCLApiCallError=        -220,
+    OpenCLDoubleNotSupported=  -221,
+    OpenCLInitError=           -222,
+    OpenCLNoAMDBlasFft=        -223
+};
+} //Error
+
+//! @} core_utils
+
+//! @addtogroup core_array
+//! @{
+
+//! matrix decomposition types
+enum DecompTypes {
+    /** Gaussian elimination with the optimal pivot element chosen. */
+    DECOMP_LU       = 0,
+    /** singular value decomposition (SVD) method; the system can be over-defined and/or the matrix
+    src1 can be singular */
+    DECOMP_SVD      = 1,
+    /** eigenvalue decomposition; the matrix src1 must be symmetrical */
+    DECOMP_EIG      = 2,
+    /** Cholesky \f$LL^T\f$ factorization; the matrix src1 must be symmetrical and positively
+    defined */
+    DECOMP_CHOLESKY = 3,
+    /** QR factorization; the system can be over-defined and/or the matrix src1 can be singular */
+    DECOMP_QR       = 4,
+    /** while all the previous flags are mutually exclusive, this flag can be used together with
+    any of the previous; it means that the normal equations
+    \f$\texttt{src1}^T\cdot\texttt{src1}\cdot\texttt{dst}=\texttt{src1}^T\texttt{src2}\f$ are
+    solved instead of the original system
+    \f$\texttt{src1}\cdot\texttt{dst}=\texttt{src2}\f$ */
+    DECOMP_NORMAL   = 16
+};
+
+/** norm types
+- For one array:
+\f[norm =  \forkthree{\|\texttt{src1}\|_{L_{\infty}} =  \max _I | \texttt{src1} (I)|}{if  \(\texttt{normType} = \texttt{NORM_INF}\) }
+{ \| \texttt{src1} \| _{L_1} =  \sum _I | \texttt{src1} (I)|}{if  \(\texttt{normType} = \texttt{NORM_L1}\) }
+{ \| \texttt{src1} \| _{L_2} =  \sqrt{\sum_I \texttt{src1}(I)^2} }{if  \(\texttt{normType} = \texttt{NORM_L2}\) }\f]
+
+- Absolute norm for two arrays
+\f[norm =  \forkthree{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}} =  \max _I | \texttt{src1} (I) -  \texttt{src2} (I)|}{if  \(\texttt{normType} = \texttt{NORM_INF}\) }
+{ \| \texttt{src1} - \texttt{src2} \| _{L_1} =  \sum _I | \texttt{src1} (I) -  \texttt{src2} (I)|}{if  \(\texttt{normType} = \texttt{NORM_L1}\) }
+{ \| \texttt{src1} - \texttt{src2} \| _{L_2} =  \sqrt{\sum_I (\texttt{src1}(I) - \texttt{src2}(I))^2} }{if  \(\texttt{normType} = \texttt{NORM_L2}\) }\f]
+
+- Relative norm for two arrays
+\f[norm =  \forkthree{\frac{\|\texttt{src1}-\texttt{src2}\|_{L_{\infty}}    }{\|\texttt{src2}\|_{L_{\infty}} }}{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_INF}\) }
+{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_1} }{\|\texttt{src2}\|_{L_1}} }{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_L1}\) }
+{ \frac{\|\texttt{src1}-\texttt{src2}\|_{L_2} }{\|\texttt{src2}\|_{L_2}} }{if  \(\texttt{normType} = \texttt{NORM_RELATIVE_L2}\) }\f]
+
+As example for one array consider the function \f$r(x)= \begin{pmatrix} x \\ 1-x \end{pmatrix}, x \in [-1;1]\f$.
+The \f$ L_{1}, L_{2} \f$ and \f$ L_{\infty} \f$ norm for the sample value \f$r(-1) = \begin{pmatrix} -1 \\ 2 \end{pmatrix}\f$
+is calculated as follows
+\f{align*}
+    \| r(-1) \|_{L_1} &= |-1| + |2| = 3 \\
+    \| r(-1) \|_{L_2} &= \sqrt{(-1)^{2} + (2)^{2}} = \sqrt{5} \\
+    \| r(-1) \|_{L_\infty} &= \max(|-1|,|2|) = 2
+\f}
+and for \f$r(0.5) = \begin{pmatrix} 0.5 \\ 0.5 \end{pmatrix}\f$ the calculation is
+\f{align*}
+    \| r(0.5) \|_{L_1} &= |0.5| + |0.5| = 1 \\
+    \| r(0.5) \|_{L_2} &= \sqrt{(0.5)^{2} + (0.5)^{2}} = \sqrt{0.5} \\
+    \| r(0.5) \|_{L_\infty} &= \max(|0.5|,|0.5|) = 0.5.
+\f}
+The following graphic shows all values for the three norm functions \f$\| r(x) \|_{L_1}, \| r(x) \|_{L_2}\f$ and \f$\| r(x) \|_{L_\infty}\f$.
+It is notable that the \f$ L_{1} \f$ norm forms the upper and the \f$ L_{\infty} \f$ norm forms the lower border for the example function \f$ r(x) \f$.
+![Graphs for the different norm functions from the above example](pics/NormTypes_OneArray_1-2-INF.png)
+ */
+enum NormTypes { NORM_INF       = 1,
+                 NORM_L1        = 2,
+                 NORM_L2        = 4,
+                 NORM_L2SQR     = 5,
+                 NORM_HAMMING   = 6,
+                 NORM_HAMMING2  = 7,
+                 NORM_TYPE_MASK = 7,
+                 NORM_RELATIVE  = 8, //!< flag
+                 NORM_MINMAX    = 32 //!< flag
+               };
+
+//! comparison types
+enum CmpTypes { CMP_EQ = 0, //!< src1 is equal to src2.
+                CMP_GT = 1, //!< src1 is greater than src2.
+                CMP_GE = 2, //!< src1 is greater than or equal to src2.
+                CMP_LT = 3, //!< src1 is less than src2.
+                CMP_LE = 4, //!< src1 is less than or equal to src2.
+                CMP_NE = 5  //!< src1 is unequal to src2.
+              };
+
+//! generalized matrix multiplication flags
+enum GemmFlags { GEMM_1_T = 1, //!< transposes src1
+                 GEMM_2_T = 2, //!< transposes src2
+                 GEMM_3_T = 4 //!< transposes src3
+               };
+
+enum DftFlags {
+    /** performs an inverse 1D or 2D transform instead of the default forward
+        transform. */
+    DFT_INVERSE        = 1,
+    /** scales the result: divide it by the number of array elements. Normally, it is
+        combined with DFT_INVERSE. */
+    DFT_SCALE          = 2,
+    /** performs a forward or inverse transform of every individual row of the input
+        matrix; this flag enables you to transform multiple vectors simultaneously and can be used to
+        decrease the overhead (which is sometimes several times larger than the processing itself) to
+        perform 3D and higher-dimensional transformations and so forth.*/
+    DFT_ROWS           = 4,
+    /** performs a forward transformation of 1D or 2D real array; the result,
+        though being a complex array, has complex-conjugate symmetry (*CCS*, see the function
+        description below for details), and such an array can be packed into a real array of the same
+        size as input, which is the fastest option and which is what the function does by default;
+        however, you may wish to get a full complex array (for simpler spectrum analysis, and so on) -
+        pass the flag to enable the function to produce a full-size complex output array. */
+    DFT_COMPLEX_OUTPUT = 16,
+    /** performs an inverse transformation of a 1D or 2D complex array; the
+        result is normally a complex array of the same size, however, if the input array has
+        conjugate-complex symmetry (for example, it is a result of forward transformation with
+        DFT_COMPLEX_OUTPUT flag), the output is a real array; while the function itself does not
+        check whether the input is symmetrical or not, you can pass the flag and then the function
+        will assume the symmetry and produce the real output array (note that when the input is packed
+        into a real array and inverse transformation is executed, the function treats the input as a
+        packed complex-conjugate symmetrical array, and the output will also be a real array). */
+    DFT_REAL_OUTPUT    = 32,
+    /** performs an inverse 1D or 2D transform instead of the default forward transform. */
+    DCT_INVERSE        = DFT_INVERSE,
+    /** performs a forward or inverse transform of every individual row of the input
+        matrix. This flag enables you to transform multiple vectors simultaneously and can be used to
+        decrease the overhead (which is sometimes several times larger than the processing itself) to
+        perform 3D and higher-dimensional transforms and so forth.*/
+    DCT_ROWS           = DFT_ROWS
+};
+
+//! Various border types, image boundaries are denoted with `|`
+//! @see borderInterpolate, copyMakeBorder
+enum BorderTypes {
+    BORDER_CONSTANT    = 0, //!< `iiiiii|abcdefgh|iiiiiii`  with some specified `i`
+    BORDER_REPLICATE   = 1, //!< `aaaaaa|abcdefgh|hhhhhhh`
+    BORDER_REFLECT     = 2, //!< `fedcba|abcdefgh|hgfedcb`
+    BORDER_WRAP        = 3, //!< `cdefgh|abcdefgh|abcdefg`
+    BORDER_REFLECT_101 = 4, //!< `gfedcb|abcdefgh|gfedcba`
+    BORDER_TRANSPARENT = 5, //!< `uvwxyz|absdefgh|ijklmno`
+
+    BORDER_REFLECT101  = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101
+    BORDER_DEFAULT     = BORDER_REFLECT_101, //!< same as BORDER_REFLECT_101
+    BORDER_ISOLATED    = 16 //!< do not look outside of ROI
+};
+
+//! @} core_array
+
+//! @addtogroup core_utils
+//! @{
+
+//! @cond IGNORED
+
+//////////////// static assert /////////////////
+#define CVAUX_CONCAT_EXP(a, b) a##b
+#define CVAUX_CONCAT(a, b) CVAUX_CONCAT_EXP(a,b)
+
+#if defined(__clang__)
+#  ifndef __has_extension
+#    define __has_extension __has_feature /* compatibility, for older versions of clang */
+#  endif
+#  if __has_extension(cxx_static_assert)
+#    define CV_StaticAssert(condition, reason)    static_assert((condition), reason " " #condition)
+#  elif __has_extension(c_static_assert)
+#    define CV_StaticAssert(condition, reason)    _Static_assert((condition), reason " " #condition)
+#  endif
+#elif defined(__GNUC__)
+#  if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
+#    define CV_StaticAssert(condition, reason)    static_assert((condition), reason " " #condition)
+#  endif
+#elif defined(_MSC_VER)
+#  if _MSC_VER >= 1600 /* MSVC 10 */
+#    define CV_StaticAssert(condition, reason)    static_assert((condition), reason " " #condition)
+#  endif
+#endif
+#ifndef CV_StaticAssert
+#  if !defined(__clang__) && defined(__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 302)
+#    define CV_StaticAssert(condition, reason) ({ extern int __attribute__((error("CV_StaticAssert: " reason " " #condition))) CV_StaticAssert(); ((condition) ? 0 : CV_StaticAssert()); })
+#  else
+     template <bool x> struct CV_StaticAssert_failed;
+     template <> struct CV_StaticAssert_failed<true> { enum { val = 1 }; };
+     template<int x> struct CV_StaticAssert_test {};
+#    define CV_StaticAssert(condition, reason)\
+       typedef cv::CV_StaticAssert_test< sizeof(cv::CV_StaticAssert_failed< static_cast<bool>(condition) >) > CVAUX_CONCAT(CV_StaticAssert_failed_at_, __LINE__)
+#  endif
+#endif
+
+// Suppress warning "-Wdeprecated-declarations" / C4996
+#if defined(_MSC_VER)
+    #define CV_DO_PRAGMA(x) __pragma(x)
+#elif defined(__GNUC__)
+    #define CV_DO_PRAGMA(x) _Pragma (#x)
+#else
+    #define CV_DO_PRAGMA(x)
+#endif
+
+#ifdef _MSC_VER
+#define CV_SUPPRESS_DEPRECATED_START \
+    CV_DO_PRAGMA(warning(push)) \
+    CV_DO_PRAGMA(warning(disable: 4996))
+#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(warning(pop))
+#elif defined (__clang__) || ((__GNUC__)  && (__GNUC__*100 + __GNUC_MINOR__ > 405))
+#define CV_SUPPRESS_DEPRECATED_START \
+    CV_DO_PRAGMA(GCC diagnostic push) \
+    CV_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
+#define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA(GCC diagnostic pop)
+#else
+#define CV_SUPPRESS_DEPRECATED_START
+#define CV_SUPPRESS_DEPRECATED_END
+#endif
+#define CV_UNUSED(name) (void)name
+//! @endcond
+
+/*! @brief Signals an error and raises the exception.
+
+By default the function prints information about the error to stderr,
+then it either stops if setBreakOnError() had been called before or raises the exception.
+It is possible to alternate error processing by using redirectError().
+@param _code - error code (Error::Code)
+@param _err - error description
+@param _func - function name. Available only when the compiler supports getting it
+@param _file - source file name where the error has occured
+@param _line - line number in the source file where the error has occured
+@see CV_Error, CV_Error_, CV_ErrorNoReturn, CV_ErrorNoReturn_, CV_Assert, CV_DbgAssert
+ */
+CV_EXPORTS void error(int _code, const String& _err, const char* _func, const char* _file, int _line);
+
+#ifdef __GNUC__
+# if defined __clang__ || defined __APPLE__
+#   pragma GCC diagnostic push
+#   pragma GCC diagnostic ignored "-Winvalid-noreturn"
+# endif
+#endif
+
+/** same as cv::error, but does not return */
+CV_INLINE CV_NORETURN void errorNoReturn(int _code, const String& _err, const char* _func, const char* _file, int _line)
+{
+    error(_code, _err, _func, _file, _line);
+#ifdef __GNUC__
+# if !defined __clang__ && !defined __APPLE__
+    // this suppresses this warning: "noreturn" function does return [enabled by default]
+    __builtin_trap();
+    // or use infinite loop: for (;;) {}
+# endif
+#endif
+}
+#ifdef __GNUC__
+# if defined __clang__ || defined __APPLE__
+#   pragma GCC diagnostic pop
+# endif
+#endif
+
+#if defined __GNUC__
+#define CV_Func __func__
+#elif defined _MSC_VER
+#define CV_Func __FUNCTION__
+#else
+#define CV_Func ""
+#endif
+
+/** @brief Call the error handler.
+
+Currently, the error handler prints the error code and the error message to the standard
+error stream `stderr`. In the Debug configuration, it then provokes memory access violation, so that
+the execution stack and all the parameters can be analyzed by the debugger. In the Release
+configuration, the exception is thrown.
+
+@param code one of Error::Code
+@param msg error message
+*/
+#define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
+
+/**  @brief Call the error handler.
+
+This macro can be used to construct an error message on-fly to include some dynamic information,
+for example:
+@code
+    // note the extra parentheses around the formatted text message
+    CV_Error_( CV_StsOutOfRange,
+    ("the value at (%d, %d)=%g is out of range", badPt.x, badPt.y, badValue));
+@endcode
+@param code one of Error::Code
+@param args printf-like formatted error message in parentheses
+*/
+#define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ )
+
+/** @brief Checks a condition at runtime and throws exception if it fails
+
+The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression. If it is 0, the macros
+raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release
+configurations while CV_DbgAssert is only retained in the Debug configuration.
+*/
+#define CV_Assert( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
+
+/** same as CV_Error(code,msg), but does not return */
+#define CV_ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
+
+/** same as CV_Error_(code,args), but does not return */
+#define CV_ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
+
+/** replaced with CV_Assert(expr) in Debug configuration */
+#ifdef _DEBUG
+#  define CV_DbgAssert(expr) CV_Assert(expr)
+#else
+#  define CV_DbgAssert(expr)
+#endif
+
+/*
+ * Hamming distance functor - counts the bit differences between two strings - useful for the Brief descriptor
+ * bit count of A exclusive XOR'ed with B
+ */
+struct CV_EXPORTS Hamming
+{
+    enum { normType = NORM_HAMMING };
+    typedef unsigned char ValueType;
+    typedef int ResultType;
+
+    /** this will count the bits in a ^ b
+     */
+    ResultType operator()( const unsigned char* a, const unsigned char* b, int size ) const;
+};
+
+typedef Hamming HammingLUT;
+
+/////////////////////////////////// inline norms ////////////////////////////////////
+
+template<typename _Tp> inline _Tp cv_abs(_Tp x) { return std::abs(x); }
+inline int cv_abs(uchar x) { return x; }
+inline int cv_abs(schar x) { return std::abs(x); }
+inline int cv_abs(ushort x) { return x; }
+inline int cv_abs(short x) { return std::abs(x); }
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normL2Sqr(const _Tp* a, int n)
+{
+    _AccTp s = 0;
+    int i=0;
+#if CV_ENABLE_UNROLLED
+    for( ; i <= n - 4; i += 4 )
+    {
+        _AccTp v0 = a[i], v1 = a[i+1], v2 = a[i+2], v3 = a[i+3];
+        s += v0*v0 + v1*v1 + v2*v2 + v3*v3;
+    }
+#endif
+    for( ; i < n; i++ )
+    {
+        _AccTp v = a[i];
+        s += v*v;
+    }
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normL1(const _Tp* a, int n)
+{
+    _AccTp s = 0;
+    int i = 0;
+#if CV_ENABLE_UNROLLED
+    for(; i <= n - 4; i += 4 )
+    {
+        s += (_AccTp)cv_abs(a[i]) + (_AccTp)cv_abs(a[i+1]) +
+            (_AccTp)cv_abs(a[i+2]) + (_AccTp)cv_abs(a[i+3]);
+    }
+#endif
+    for( ; i < n; i++ )
+        s += cv_abs(a[i]);
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normInf(const _Tp* a, int n)
+{
+    _AccTp s = 0;
+    for( int i = 0; i < n; i++ )
+        s = std::max(s, (_AccTp)cv_abs(a[i]));
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normL2Sqr(const _Tp* a, const _Tp* b, int n)
+{
+    _AccTp s = 0;
+    int i= 0;
+#if CV_ENABLE_UNROLLED
+    for(; i <= n - 4; i += 4 )
+    {
+        _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]);
+        s += v0*v0 + v1*v1 + v2*v2 + v3*v3;
+    }
+#endif
+    for( ; i < n; i++ )
+    {
+        _AccTp v = _AccTp(a[i] - b[i]);
+        s += v*v;
+    }
+    return s;
+}
+
+static inline float normL2Sqr(const float* a, const float* b, int n)
+{
+    float s = 0.f;
+    for( int i = 0; i < n; i++ )
+    {
+        float v = a[i] - b[i];
+        s += v*v;
+    }
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normL1(const _Tp* a, const _Tp* b, int n)
+{
+    _AccTp s = 0;
+    int i= 0;
+#if CV_ENABLE_UNROLLED
+    for(; i <= n - 4; i += 4 )
+    {
+        _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]);
+        s += std::abs(v0) + std::abs(v1) + std::abs(v2) + std::abs(v3);
+    }
+#endif
+    for( ; i < n; i++ )
+    {
+        _AccTp v = _AccTp(a[i] - b[i]);
+        s += std::abs(v);
+    }
+    return s;
+}
+
+inline float normL1(const float* a, const float* b, int n)
+{
+    float s = 0.f;
+    for( int i = 0; i < n; i++ )
+    {
+        s += std::abs(a[i] - b[i]);
+    }
+    return s;
+}
+
+inline int normL1(const uchar* a, const uchar* b, int n)
+{
+    int s = 0;
+    for( int i = 0; i < n; i++ )
+    {
+        s += std::abs(a[i] - b[i]);
+    }
+    return s;
+}
+
+template<typename _Tp, typename _AccTp> static inline
+_AccTp normInf(const _Tp* a, const _Tp* b, int n)
+{
+    _AccTp s = 0;
+    for( int i = 0; i < n; i++ )
+    {
+        _AccTp v0 = a[i] - b[i];
+        s = std::max(s, std::abs(v0));
+    }
+    return s;
+}
+
+/** @brief Computes the cube root of an argument.
+
+ The function cubeRoot computes \f$\sqrt[3]{\texttt{val}}\f$. Negative arguments are handled correctly.
+ NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for
+ single-precision data.
+ @param val A function argument.
+ */
+CV_EXPORTS_W float cubeRoot(float val);
+
+/** @brief Calculates the angle of a 2D vector in degrees.
+
+ The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured
+ in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees.
+ @param x x-coordinate of the vector.
+ @param y y-coordinate of the vector.
+ */
+CV_EXPORTS_W float fastAtan2(float y, float x);
+
+/** proxy for hal::LU */
+CV_EXPORTS int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+/** proxy for hal::LU */
+CV_EXPORTS int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+/** proxy for hal::Cholesky */
+CV_EXPORTS bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+/** proxy for hal::Cholesky */
+CV_EXPORTS bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+
+////////////////// forward declarations for important OpenCV types //////////////////
+
+//! @cond IGNORED
+
+template<typename _Tp, int cn> class Vec;
+template<typename _Tp, int m, int n> class Matx;
+
+template<typename _Tp> class Complex;
+template<typename _Tp> class Point_;
+template<typename _Tp> class Point3_;
+template<typename _Tp> class Size_;
+template<typename _Tp> class Rect_;
+template<typename _Tp> class Scalar_;
+
+class CV_EXPORTS RotatedRect;
+class CV_EXPORTS Range;
+class CV_EXPORTS TermCriteria;
+class CV_EXPORTS KeyPoint;
+class CV_EXPORTS DMatch;
+class CV_EXPORTS RNG;
+
+class CV_EXPORTS Mat;
+class CV_EXPORTS MatExpr;
+
+class CV_EXPORTS UMat;
+
+class CV_EXPORTS SparseMat;
+typedef Mat MatND;
+
+template<typename _Tp> class Mat_;
+template<typename _Tp> class SparseMat_;
+
+class CV_EXPORTS MatConstIterator;
+class CV_EXPORTS SparseMatIterator;
+class CV_EXPORTS SparseMatConstIterator;
+template<typename _Tp> class MatIterator_;
+template<typename _Tp> class MatConstIterator_;
+template<typename _Tp> class SparseMatIterator_;
+template<typename _Tp> class SparseMatConstIterator_;
+
+namespace ogl
+{
+    class CV_EXPORTS Buffer;
+    class CV_EXPORTS Texture2D;
+    class CV_EXPORTS Arrays;
+}
+
+namespace cuda
+{
+    class CV_EXPORTS GpuMat;
+    class CV_EXPORTS HostMem;
+    class CV_EXPORTS Stream;
+    class CV_EXPORTS Event;
+}
+
+namespace cudev
+{
+    template <typename _Tp> class GpuMat_;
+}
+
+namespace ipp
+{
+CV_EXPORTS int getIppFeatures();
+CV_EXPORTS void setIppStatus(int status, const char * const funcname = NULL, const char * const filename = NULL,
+                             int line = 0);
+CV_EXPORTS int getIppStatus();
+CV_EXPORTS String getIppErrorLocation();
+CV_EXPORTS bool useIPP();
+CV_EXPORTS void setUseIPP(bool flag);
+
+} // ipp
+
+//! @endcond
+
+//! @} core_utils
+
+
+
+
+} // cv
+
+#include "opencv2/core/neon_utils.hpp"
+
+#endif //__OPENCV_CORE_BASE_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp
new file mode 100644
index 0000000..76df2d2
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/bufferpool.hpp
@@ -0,0 +1,31 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved.
+
+#ifndef __OPENCV_CORE_BUFFER_POOL_HPP__
+#define __OPENCV_CORE_BUFFER_POOL_HPP__
+
+namespace cv
+{
+
+//! @addtogroup core
+//! @{
+
+class BufferPoolController
+{
+protected:
+    ~BufferPoolController() { }
+public:
+    virtual size_t getReservedSize() const = 0;
+    virtual size_t getMaxReservedSize() const = 0;
+    virtual void setMaxReservedSize(size_t size) = 0;
+    virtual void freeAllReservedBuffers() = 0;
+};
+
+//! @}
+
+}
+
+#endif // __OPENCV_CORE_BUFFER_POOL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/core.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/core.hpp
new file mode 100644
index 0000000..4389183
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/core.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/core.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/core_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/core/core_c.h
new file mode 100644
index 0000000..a0ed632
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/core_c.h
@@ -0,0 +1,3152 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+
+#ifndef __OPENCV_CORE_C_H__
+#define __OPENCV_CORE_C_H__
+
+#include "opencv2/core/types_c.h"
+
+#ifdef __cplusplus
+#  ifdef _MSC_VER
+/* disable warning C4190: 'function' has C-linkage specified, but returns UDT 'typename'
+                          which is incompatible with C
+
+   It is OK to disable it because we only extend few plain structures with
+   C++ construrtors for simpler interoperability with C++ API of the library
+*/
+#    pragma warning(disable:4190)
+#  elif defined __clang__ && __clang_major__ >= 3
+#    pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup core_c
+    @{
+*/
+
+/****************************************************************************************\
+*          Array allocation, deallocation, initialization and access to elements         *
+\****************************************************************************************/
+
+/** `malloc` wrapper.
+   If there is no enough memory, the function
+   (as well as other OpenCV functions that call cvAlloc)
+   raises an error. */
+CVAPI(void*)  cvAlloc( size_t size );
+
+/** `free` wrapper.
+   Here and further all the memory releasing functions
+   (that all call cvFree) take double pointer in order to
+   to clear pointer to the data after releasing it.
+   Passing pointer to NULL pointer is Ok: nothing happens in this case
+*/
+CVAPI(void)   cvFree_( void* ptr );
+#define cvFree(ptr) (cvFree_(*(ptr)), *(ptr)=0)
+
+/** @brief Creates an image header but does not allocate the image data.
+
+@param size Image width and height
+@param depth Image depth (see cvCreateImage )
+@param channels Number of channels (see cvCreateImage )
+ */
+CVAPI(IplImage*)  cvCreateImageHeader( CvSize size, int depth, int channels );
+
+/** @brief Initializes an image header that was previously allocated.
+
+The returned IplImage\* points to the initialized header.
+@param image Image header to initialize
+@param size Image width and height
+@param depth Image depth (see cvCreateImage )
+@param channels Number of channels (see cvCreateImage )
+@param origin Top-left IPL_ORIGIN_TL or bottom-left IPL_ORIGIN_BL
+@param align Alignment for image rows, typically 4 or 8 bytes
+ */
+CVAPI(IplImage*) cvInitImageHeader( IplImage* image, CvSize size, int depth,
+                                   int channels, int origin CV_DEFAULT(0),
+                                   int align CV_DEFAULT(4));
+
+/** @brief Creates an image header and allocates the image data.
+
+This function call is equivalent to the following code:
+@code
+    header = cvCreateImageHeader(size, depth, channels);
+    cvCreateData(header);
+@endcode
+@param size Image width and height
+@param depth Bit depth of image elements. See IplImage for valid depths.
+@param channels Number of channels per pixel. See IplImage for details. This function only creates
+images with interleaved channels.
+ */
+CVAPI(IplImage*)  cvCreateImage( CvSize size, int depth, int channels );
+
+/** @brief Deallocates an image header.
+
+This call is an analogue of :
+@code
+    if(image )
+    {
+        iplDeallocate(*image, IPL_IMAGE_HEADER | IPL_IMAGE_ROI);
+        *image = 0;
+    }
+@endcode
+but it does not use IPL functions by default (see the CV_TURN_ON_IPL_COMPATIBILITY macro).
+@param image Double pointer to the image header
+ */
+CVAPI(void)  cvReleaseImageHeader( IplImage** image );
+
+/** @brief Deallocates the image header and the image data.
+
+This call is a shortened form of :
+@code
+    if(*image )
+    {
+        cvReleaseData(*image);
+        cvReleaseImageHeader(image);
+    }
+@endcode
+@param image Double pointer to the image header
+*/
+CVAPI(void)  cvReleaseImage( IplImage** image );
+
+/** Creates a copy of IPL image (widthStep may differ) */
+CVAPI(IplImage*) cvCloneImage( const IplImage* image );
+
+/** @brief Sets the channel of interest in an IplImage.
+
+If the ROI is set to NULL and the coi is *not* 0, the ROI is allocated. Most OpenCV functions do
+*not* support the COI setting, so to process an individual image/matrix channel one may copy (via
+cvCopy or cvSplit) the channel to a separate image/matrix, process it and then copy the result
+back (via cvCopy or cvMerge) if needed.
+@param image A pointer to the image header
+@param coi The channel of interest. 0 - all channels are selected, 1 - first channel is selected,
+etc. Note that the channel indices become 1-based.
+ */
+CVAPI(void)  cvSetImageCOI( IplImage* image, int coi );
+
+/** @brief Returns the index of the channel of interest.
+
+Returns the channel of interest of in an IplImage. Returned values correspond to the coi in
+cvSetImageCOI.
+@param image A pointer to the image header
+ */
+CVAPI(int)  cvGetImageCOI( const IplImage* image );
+
+/** @brief Sets an image Region Of Interest (ROI) for a given rectangle.
+
+If the original image ROI was NULL and the rect is not the whole image, the ROI structure is
+allocated.
+
+Most OpenCV functions support the use of ROI and treat the image rectangle as a separate image. For
+example, all of the pixel coordinates are counted from the top-left (or bottom-left) corner of the
+ROI, not the original image.
+@param image A pointer to the image header
+@param rect The ROI rectangle
+ */
+CVAPI(void)  cvSetImageROI( IplImage* image, CvRect rect );
+
+/** @brief Resets the image ROI to include the entire image and releases the ROI structure.
+
+This produces a similar result to the following, but in addition it releases the ROI structure. :
+@code
+    cvSetImageROI(image, cvRect(0, 0, image->width, image->height ));
+    cvSetImageCOI(image, 0);
+@endcode
+@param image A pointer to the image header
+ */
+CVAPI(void)  cvResetImageROI( IplImage* image );
+
+/** @brief Returns the image ROI.
+
+If there is no ROI set, cvRect(0,0,image-\>width,image-\>height) is returned.
+@param image A pointer to the image header
+ */
+CVAPI(CvRect) cvGetImageROI( const IplImage* image );
+
+/** @brief Creates a matrix header but does not allocate the matrix data.
+
+The function allocates a new matrix header and returns a pointer to it. The matrix data can then be
+allocated using cvCreateData or set explicitly to user-allocated data via cvSetData.
+@param rows Number of rows in the matrix
+@param cols Number of columns in the matrix
+@param type Type of the matrix elements, see cvCreateMat
+ */
+CVAPI(CvMat*)  cvCreateMatHeader( int rows, int cols, int type );
+
+#define CV_AUTOSTEP  0x7fffffff
+
+/** @brief Initializes a pre-allocated matrix header.
+
+This function is often used to process raw data with OpenCV matrix functions. For example, the
+following code computes the matrix product of two matrices, stored as ordinary arrays:
+@code
+    double a[] = { 1, 2, 3, 4,
+                   5, 6, 7, 8,
+                   9, 10, 11, 12 };
+
+    double b[] = { 1, 5, 9,
+                   2, 6, 10,
+                   3, 7, 11,
+                   4, 8, 12 };
+
+    double c[9];
+    CvMat Ma, Mb, Mc ;
+
+    cvInitMatHeader(&Ma, 3, 4, CV_64FC1, a);
+    cvInitMatHeader(&Mb, 4, 3, CV_64FC1, b);
+    cvInitMatHeader(&Mc, 3, 3, CV_64FC1, c);
+
+    cvMatMulAdd(&Ma, &Mb, 0, &Mc);
+    // the c array now contains the product of a (3x4) and b (4x3)
+@endcode
+@param mat A pointer to the matrix header to be initialized
+@param rows Number of rows in the matrix
+@param cols Number of columns in the matrix
+@param type Type of the matrix elements, see cvCreateMat .
+@param data Optional: data pointer assigned to the matrix header
+@param step Optional: full row width in bytes of the assigned data. By default, the minimal
+possible step is used which assumes there are no gaps between subsequent rows of the matrix.
+ */
+CVAPI(CvMat*) cvInitMatHeader( CvMat* mat, int rows, int cols,
+                              int type, void* data CV_DEFAULT(NULL),
+                              int step CV_DEFAULT(CV_AUTOSTEP) );
+
+/** @brief Creates a matrix header and allocates the matrix data.
+
+The function call is equivalent to the following code:
+@code
+    CvMat* mat = cvCreateMatHeader(rows, cols, type);
+    cvCreateData(mat);
+@endcode
+@param rows Number of rows in the matrix
+@param cols Number of columns in the matrix
+@param type The type of the matrix elements in the form
+CV_\<bit depth\>\<S|U|F\>C\<number of channels\> , where S=signed, U=unsigned, F=float. For
+example, CV _ 8UC1 means the elements are 8-bit unsigned and the there is 1 channel, and CV _
+32SC2 means the elements are 32-bit signed and there are 2 channels.
+ */
+CVAPI(CvMat*)  cvCreateMat( int rows, int cols, int type );
+
+/** @brief Deallocates a matrix.
+
+The function decrements the matrix data reference counter and deallocates matrix header. If the data
+reference counter is 0, it also deallocates the data. :
+@code
+    if(*mat )
+        cvDecRefData(*mat);
+    cvFree((void**)mat);
+@endcode
+@param mat Double pointer to the matrix
+ */
+CVAPI(void)  cvReleaseMat( CvMat** mat );
+
+/** @brief Decrements an array data reference counter.
+
+The function decrements the data reference counter in a CvMat or CvMatND if the reference counter
+
+pointer is not NULL. If the counter reaches zero, the data is deallocated. In the current
+implementation the reference counter is not NULL only if the data was allocated using the
+cvCreateData function. The counter will be NULL in other cases such as: external data was assigned
+to the header using cvSetData, header is part of a larger matrix or image, or the header was
+converted from an image or n-dimensional matrix header.
+@param arr Pointer to an array header
+ */
+CV_INLINE  void  cvDecRefData( CvArr* arr )
+{
+    if( CV_IS_MAT( arr ))
+    {
+        CvMat* mat = (CvMat*)arr;
+        mat->data.ptr = NULL;
+        if( mat->refcount != NULL && --*mat->refcount == 0 )
+            cvFree( &mat->refcount );
+        mat->refcount = NULL;
+    }
+    else if( CV_IS_MATND( arr ))
+    {
+        CvMatND* mat = (CvMatND*)arr;
+        mat->data.ptr = NULL;
+        if( mat->refcount != NULL && --*mat->refcount == 0 )
+            cvFree( &mat->refcount );
+        mat->refcount = NULL;
+    }
+}
+
+/** @brief Increments array data reference counter.
+
+The function increments CvMat or CvMatND data reference counter and returns the new counter value if
+the reference counter pointer is not NULL, otherwise it returns zero.
+@param arr Array header
+ */
+CV_INLINE  int  cvIncRefData( CvArr* arr )
+{
+    int refcount = 0;
+    if( CV_IS_MAT( arr ))
+    {
+        CvMat* mat = (CvMat*)arr;
+        if( mat->refcount != NULL )
+            refcount = ++*mat->refcount;
+    }
+    else if( CV_IS_MATND( arr ))
+    {
+        CvMatND* mat = (CvMatND*)arr;
+        if( mat->refcount != NULL )
+            refcount = ++*mat->refcount;
+    }
+    return refcount;
+}
+
+
+/** Creates an exact copy of the input matrix (except, may be, step value) */
+CVAPI(CvMat*) cvCloneMat( const CvMat* mat );
+
+
+/** @brief Returns matrix header corresponding to the rectangular sub-array of input image or matrix.
+
+The function returns header, corresponding to a specified rectangle of the input array. In other
+
+words, it allows the user to treat a rectangular part of input array as a stand-alone array. ROI is
+taken into account by the function so the sub-array of ROI is actually extracted.
+@param arr Input array
+@param submat Pointer to the resultant sub-array header
+@param rect Zero-based coordinates of the rectangle of interest
+ */
+CVAPI(CvMat*) cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect );
+#define cvGetSubArr cvGetSubRect
+
+/** @brief Returns array row or row span.
+
+The functions return the header, corresponding to a specified row/row span of the input array.
+cvGetRow(arr, submat, row) is a shortcut for cvGetRows(arr, submat, row, row+1).
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param start_row Zero-based index of the starting row (inclusive) of the span
+@param end_row Zero-based index of the ending row (exclusive) of the span
+@param delta_row Index step in the row span. That is, the function extracts every delta_row -th
+row from start_row and up to (but not including) end_row .
+ */
+CVAPI(CvMat*) cvGetRows( const CvArr* arr, CvMat* submat,
+                        int start_row, int end_row,
+                        int delta_row CV_DEFAULT(1));
+
+/** @overload
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param row Zero-based index of the selected row
+*/
+CV_INLINE  CvMat*  cvGetRow( const CvArr* arr, CvMat* submat, int row )
+{
+    return cvGetRows( arr, submat, row, row + 1, 1 );
+}
+
+
+/** @brief Returns one of more array columns.
+
+The functions return the header, corresponding to a specified column span of the input array. That
+
+is, no data is copied. Therefore, any modifications of the submatrix will affect the original array.
+If you need to copy the columns, use cvCloneMat. cvGetCol(arr, submat, col) is a shortcut for
+cvGetCols(arr, submat, col, col+1).
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param start_col Zero-based index of the starting column (inclusive) of the span
+@param end_col Zero-based index of the ending column (exclusive) of the span
+ */
+CVAPI(CvMat*) cvGetCols( const CvArr* arr, CvMat* submat,
+                        int start_col, int end_col );
+
+/** @overload
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param col Zero-based index of the selected column
+*/
+CV_INLINE  CvMat*  cvGetCol( const CvArr* arr, CvMat* submat, int col )
+{
+    return cvGetCols( arr, submat, col, col + 1 );
+}
+
+/** @brief Returns one of array diagonals.
+
+The function returns the header, corresponding to a specified diagonal of the input array.
+@param arr Input array
+@param submat Pointer to the resulting sub-array header
+@param diag Index of the array diagonal. Zero value corresponds to the main diagonal, -1
+corresponds to the diagonal above the main, 1 corresponds to the diagonal below the main, and so
+forth.
+ */
+CVAPI(CvMat*) cvGetDiag( const CvArr* arr, CvMat* submat,
+                            int diag CV_DEFAULT(0));
+
+/** low-level scalar <-> raw data conversion functions */
+CVAPI(void) cvScalarToRawData( const CvScalar* scalar, void* data, int type,
+                              int extend_to_12 CV_DEFAULT(0) );
+
+CVAPI(void) cvRawDataToScalar( const void* data, int type, CvScalar* scalar );
+
+/** @brief Creates a new matrix header but does not allocate the matrix data.
+
+The function allocates a header for a multi-dimensional dense array. The array data can further be
+allocated using cvCreateData or set explicitly to user-allocated data via cvSetData.
+@param dims Number of array dimensions
+@param sizes Array of dimension sizes
+@param type Type of array elements, see cvCreateMat
+ */
+CVAPI(CvMatND*)  cvCreateMatNDHeader( int dims, const int* sizes, int type );
+
+/** @brief Creates the header and allocates the data for a multi-dimensional dense array.
+
+This function call is equivalent to the following code:
+@code
+    CvMatND* mat = cvCreateMatNDHeader(dims, sizes, type);
+    cvCreateData(mat);
+@endcode
+@param dims Number of array dimensions. This must not exceed CV_MAX_DIM (32 by default, but can be
+changed at build time).
+@param sizes Array of dimension sizes.
+@param type Type of array elements, see cvCreateMat .
+ */
+CVAPI(CvMatND*)  cvCreateMatND( int dims, const int* sizes, int type );
+
+/** @brief Initializes a pre-allocated multi-dimensional array header.
+
+@param mat A pointer to the array header to be initialized
+@param dims The number of array dimensions
+@param sizes An array of dimension sizes
+@param type Type of array elements, see cvCreateMat
+@param data Optional data pointer assigned to the matrix header
+ */
+CVAPI(CvMatND*)  cvInitMatNDHeader( CvMatND* mat, int dims, const int* sizes,
+                                    int type, void* data CV_DEFAULT(NULL) );
+
+/** @brief Deallocates a multi-dimensional array.
+
+The function decrements the array data reference counter and releases the array header. If the
+reference counter reaches 0, it also deallocates the data. :
+@code
+    if(*mat )
+        cvDecRefData(*mat);
+    cvFree((void**)mat);
+@endcode
+@param mat Double pointer to the array
+ */
+CV_INLINE  void  cvReleaseMatND( CvMatND** mat )
+{
+    cvReleaseMat( (CvMat**)mat );
+}
+
+/** Creates a copy of CvMatND (except, may be, steps) */
+CVAPI(CvMatND*) cvCloneMatND( const CvMatND* mat );
+
+/** @brief Creates sparse array.
+
+The function allocates a multi-dimensional sparse array. Initially the array contain no elements,
+that is PtrND and other related functions will return 0 for every index.
+@param dims Number of array dimensions. In contrast to the dense matrix, the number of dimensions is
+practically unlimited (up to \f$2^{16}\f$ ).
+@param sizes Array of dimension sizes
+@param type Type of array elements. The same as for CvMat
+ */
+CVAPI(CvSparseMat*)  cvCreateSparseMat( int dims, const int* sizes, int type );
+
+/** @brief Deallocates sparse array.
+
+The function releases the sparse array and clears the array pointer upon exit.
+@param mat Double pointer to the array
+ */
+CVAPI(void)  cvReleaseSparseMat( CvSparseMat** mat );
+
+/** Creates a copy of CvSparseMat (except, may be, zero items) */
+CVAPI(CvSparseMat*) cvCloneSparseMat( const CvSparseMat* mat );
+
+/** @brief Initializes sparse array elements iterator.
+
+The function initializes iterator of sparse array elements and returns pointer to the first element,
+or NULL if the array is empty.
+@param mat Input array
+@param mat_iterator Initialized iterator
+ */
+CVAPI(CvSparseNode*) cvInitSparseMatIterator( const CvSparseMat* mat,
+                                              CvSparseMatIterator* mat_iterator );
+
+/** @brief Returns the next sparse matrix element
+
+The function moves iterator to the next sparse matrix element and returns pointer to it. In the
+current version there is no any particular order of the elements, because they are stored in the
+hash table. The sample below demonstrates how to iterate through the sparse matrix:
+@code
+    // print all the non-zero sparse matrix elements and compute their sum
+    double sum = 0;
+    int i, dims = cvGetDims(sparsemat);
+    CvSparseMatIterator it;
+    CvSparseNode* node = cvInitSparseMatIterator(sparsemat, &it);
+
+    for(; node != 0; node = cvGetNextSparseNode(&it))
+    {
+        int* idx = CV_NODE_IDX(array, node);
+        float val = *(float*)CV_NODE_VAL(array, node);
+        printf("M");
+        for(i = 0; i < dims; i++ )
+            printf("[%d]", idx[i]);
+        printf("=%g\n", val);
+
+        sum += val;
+    }
+
+    printf("nTotal sum = %g\n", sum);
+@endcode
+@param mat_iterator Sparse array iterator
+ */
+CV_INLINE CvSparseNode* cvGetNextSparseNode( CvSparseMatIterator* mat_iterator )
+{
+    if( mat_iterator->node->next )
+        return mat_iterator->node = mat_iterator->node->next;
+    else
+    {
+        int idx;
+        for( idx = ++mat_iterator->curidx; idx < mat_iterator->mat->hashsize; idx++ )
+        {
+            CvSparseNode* node = (CvSparseNode*)mat_iterator->mat->hashtable[idx];
+            if( node )
+            {
+                mat_iterator->curidx = idx;
+                return mat_iterator->node = node;
+            }
+        }
+        return NULL;
+    }
+}
+
+
+#define CV_MAX_ARR 10
+
+/** matrix iterator: used for n-ary operations on dense arrays */
+typedef struct CvNArrayIterator
+{
+    int count; /**< number of arrays */
+    int dims; /**< number of dimensions to iterate */
+    CvSize size; /**< maximal common linear size: { width = size, height = 1 } */
+    uchar* ptr[CV_MAX_ARR]; /**< pointers to the array slices */
+    int stack[CV_MAX_DIM]; /**< for internal use */
+    CvMatND* hdr[CV_MAX_ARR]; /**< pointers to the headers of the
+                                 matrices that are processed */
+}
+CvNArrayIterator;
+
+#define CV_NO_DEPTH_CHECK     1
+#define CV_NO_CN_CHECK        2
+#define CV_NO_SIZE_CHECK      4
+
+/** initializes iterator that traverses through several arrays simulteneously
+   (the function together with cvNextArraySlice is used for
+    N-ari element-wise operations) */
+CVAPI(int) cvInitNArrayIterator( int count, CvArr** arrs,
+                                 const CvArr* mask, CvMatND* stubs,
+                                 CvNArrayIterator* array_iterator,
+                                 int flags CV_DEFAULT(0) );
+
+/** returns zero value if iteration is finished, non-zero (slice length) otherwise */
+CVAPI(int) cvNextNArraySlice( CvNArrayIterator* array_iterator );
+
+
+/** @brief Returns type of array elements.
+
+The function returns type of the array elements. In the case of IplImage the type is converted to
+CvMat-like representation. For example, if the image has been created as:
+@code
+    IplImage* img = cvCreateImage(cvSize(640, 480), IPL_DEPTH_8U, 3);
+@endcode
+The code cvGetElemType(img) will return CV_8UC3.
+@param arr Input array
+ */
+CVAPI(int) cvGetElemType( const CvArr* arr );
+
+/** @brief Return number of array dimensions
+
+The function returns the array dimensionality and the array of dimension sizes. In the case of
+IplImage or CvMat it always returns 2 regardless of number of image/matrix rows. For example, the
+following code calculates total number of array elements:
+@code
+    int sizes[CV_MAX_DIM];
+    int i, total = 1;
+    int dims = cvGetDims(arr, size);
+    for(i = 0; i < dims; i++ )
+        total *= sizes[i];
+@endcode
+@param arr Input array
+@param sizes Optional output vector of the array dimension sizes. For 2d arrays the number of rows
+(height) goes first, number of columns (width) next.
+ */
+CVAPI(int) cvGetDims( const CvArr* arr, int* sizes CV_DEFAULT(NULL) );
+
+
+/** @brief Returns array size along the specified dimension.
+
+@param arr Input array
+@param index Zero-based dimension index (for matrices 0 means number of rows, 1 means number of
+columns; for images 0 means height, 1 means width)
+ */
+CVAPI(int) cvGetDimSize( const CvArr* arr, int index );
+
+
+/** @brief Return pointer to a particular array element.
+
+The functions return a pointer to a specific array element. Number of array dimension should match
+to the number of indices passed to the function except for cvPtr1D function that can be used for
+sequential access to 1D, 2D or nD dense arrays.
+
+The functions can be used for sparse arrays as well - if the requested node does not exist they
+create it and set it to zero.
+
+All these as well as other functions accessing array elements ( cvGetND , cvGetRealND , cvSet
+, cvSetND , cvSetRealND ) raise an error in case if the element index is out of range.
+@param arr Input array
+@param idx0 The first zero-based component of the element index
+@param type Optional output parameter: type of matrix elements
+ */
+CVAPI(uchar*) cvPtr1D( const CvArr* arr, int idx0, int* type CV_DEFAULT(NULL));
+/** @overload */
+CVAPI(uchar*) cvPtr2D( const CvArr* arr, int idx0, int idx1, int* type CV_DEFAULT(NULL) );
+/** @overload */
+CVAPI(uchar*) cvPtr3D( const CvArr* arr, int idx0, int idx1, int idx2,
+                      int* type CV_DEFAULT(NULL));
+/** @overload
+@param arr Input array
+@param idx Array of the element indices
+@param type Optional output parameter: type of matrix elements
+@param create_node Optional input parameter for sparse matrices. Non-zero value of the parameter
+means that the requested element is created if it does not exist already.
+@param precalc_hashval Optional input parameter for sparse matrices. If the pointer is not NULL,
+the function does not recalculate the node hash value, but takes it from the specified location.
+It is useful for speeding up pair-wise operations (TODO: provide an example)
+*/
+CVAPI(uchar*) cvPtrND( const CvArr* arr, const int* idx, int* type CV_DEFAULT(NULL),
+                      int create_node CV_DEFAULT(1),
+                      unsigned* precalc_hashval CV_DEFAULT(NULL));
+
+/** @brief Return a specific array element.
+
+The functions return a specific array element. In the case of a sparse array the functions return 0
+if the requested node does not exist (no new node is created by the functions).
+@param arr Input array
+@param idx0 The first zero-based component of the element index
+ */
+CVAPI(CvScalar) cvGet1D( const CvArr* arr, int idx0 );
+/** @overload */
+CVAPI(CvScalar) cvGet2D( const CvArr* arr, int idx0, int idx1 );
+/** @overload */
+CVAPI(CvScalar) cvGet3D( const CvArr* arr, int idx0, int idx1, int idx2 );
+/** @overload
+@param arr Input array
+@param idx Array of the element indices
+*/
+CVAPI(CvScalar) cvGetND( const CvArr* arr, const int* idx );
+
+/** @brief Return a specific element of single-channel 1D, 2D, 3D or nD array.
+
+Returns a specific element of a single-channel array. If the array has multiple channels, a runtime
+error is raised. Note that Get?D functions can be used safely for both single-channel and
+multiple-channel arrays though they are a bit slower.
+
+In the case of a sparse array the functions return 0 if the requested node does not exist (no new
+node is created by the functions).
+@param arr Input array. Must have a single channel.
+@param idx0 The first zero-based component of the element index
+ */
+CVAPI(double) cvGetReal1D( const CvArr* arr, int idx0 );
+/** @overload */
+CVAPI(double) cvGetReal2D( const CvArr* arr, int idx0, int idx1 );
+/** @overload */
+CVAPI(double) cvGetReal3D( const CvArr* arr, int idx0, int idx1, int idx2 );
+/** @overload
+@param arr Input array. Must have a single channel.
+@param idx Array of the element indices
+*/
+CVAPI(double) cvGetRealND( const CvArr* arr, const int* idx );
+
+/** @brief Change the particular array element.
+
+The functions assign the new value to a particular array element. In the case of a sparse array the
+functions create the node if it does not exist yet.
+@param arr Input array
+@param idx0 The first zero-based component of the element index
+@param value The assigned value
+ */
+CVAPI(void) cvSet1D( CvArr* arr, int idx0, CvScalar value );
+/** @overload */
+CVAPI(void) cvSet2D( CvArr* arr, int idx0, int idx1, CvScalar value );
+/** @overload */
+CVAPI(void) cvSet3D( CvArr* arr, int idx0, int idx1, int idx2, CvScalar value );
+/** @overload
+@param arr Input array
+@param idx Array of the element indices
+@param value The assigned value
+*/
+CVAPI(void) cvSetND( CvArr* arr, const int* idx, CvScalar value );
+
+/** @brief Change a specific array element.
+
+The functions assign a new value to a specific element of a single-channel array. If the array has
+multiple channels, a runtime error is raised. Note that the Set\*D function can be used safely for
+both single-channel and multiple-channel arrays, though they are a bit slower.
+
+In the case of a sparse array the functions create the node if it does not yet exist.
+@param arr Input array
+@param idx0 The first zero-based component of the element index
+@param value The assigned value
+ */
+CVAPI(void) cvSetReal1D( CvArr* arr, int idx0, double value );
+/** @overload */
+CVAPI(void) cvSetReal2D( CvArr* arr, int idx0, int idx1, double value );
+/** @overload */
+CVAPI(void) cvSetReal3D( CvArr* arr, int idx0,
+                        int idx1, int idx2, double value );
+/** @overload
+@param arr Input array
+@param idx Array of the element indices
+@param value The assigned value
+*/
+CVAPI(void) cvSetRealND( CvArr* arr, const int* idx, double value );
+
+/** clears element of ND dense array,
+   in case of sparse arrays it deletes the specified node */
+CVAPI(void) cvClearND( CvArr* arr, const int* idx );
+
+/** @brief Returns matrix header for arbitrary array.
+
+The function returns a matrix header for the input array that can be a matrix - CvMat, an image -
+IplImage, or a multi-dimensional dense array - CvMatND (the third option is allowed only if
+allowND != 0) . In the case of matrix the function simply returns the input pointer. In the case of
+IplImage\* or CvMatND it initializes the header structure with parameters of the current image ROI
+and returns &header. Because COI is not supported by CvMat, it is returned separately.
+
+The function provides an easy way to handle both types of arrays - IplImage and CvMat using the same
+code. Input array must have non-zero data pointer, otherwise the function will report an error.
+
+@note If the input array is IplImage with planar data layout and COI set, the function returns the
+pointer to the selected plane and COI == 0. This feature allows user to process IplImage structures
+with planar data layout, even though OpenCV does not support such images.
+@param arr Input array
+@param header Pointer to CvMat structure used as a temporary buffer
+@param coi Optional output parameter for storing COI
+@param allowND If non-zero, the function accepts multi-dimensional dense arrays (CvMatND\*) and
+returns 2D matrix (if CvMatND has two dimensions) or 1D matrix (when CvMatND has 1 dimension or
+more than 2 dimensions). The CvMatND array must be continuous.
+@sa cvGetImage, cvarrToMat.
+ */
+CVAPI(CvMat*) cvGetMat( const CvArr* arr, CvMat* header,
+                       int* coi CV_DEFAULT(NULL),
+                       int allowND CV_DEFAULT(0));
+
+/** @brief Returns image header for arbitrary array.
+
+The function returns the image header for the input array that can be a matrix (CvMat) or image
+(IplImage). In the case of an image the function simply returns the input pointer. In the case of
+CvMat it initializes an image_header structure with the parameters of the input matrix. Note that
+if we transform IplImage to CvMat using cvGetMat and then transform CvMat back to IplImage using
+this function, we will get different headers if the ROI is set in the original image.
+@param arr Input array
+@param image_header Pointer to IplImage structure used as a temporary buffer
+ */
+CVAPI(IplImage*) cvGetImage( const CvArr* arr, IplImage* image_header );
+
+
+/** @brief Changes the shape of a multi-dimensional array without copying the data.
+
+The function is an advanced version of cvReshape that can work with multi-dimensional arrays as
+well (though it can work with ordinary images and matrices) and change the number of dimensions.
+
+Below are the two samples from the cvReshape description rewritten using cvReshapeMatND:
+@code
+    IplImage* color_img = cvCreateImage(cvSize(320,240), IPL_DEPTH_8U, 3);
+    IplImage gray_img_hdr, *gray_img;
+    gray_img = (IplImage*)cvReshapeMatND(color_img, sizeof(gray_img_hdr), &gray_img_hdr, 1, 0, 0);
+    ...
+    int size[] = { 2, 2, 2 };
+    CvMatND* mat = cvCreateMatND(3, size, CV_32F);
+    CvMat row_header, *row;
+    row = (CvMat*)cvReshapeMatND(mat, sizeof(row_header), &row_header, 0, 1, 0);
+@endcode
+In C, the header file for this function includes a convenient macro cvReshapeND that does away with
+the sizeof_header parameter. So, the lines containing the call to cvReshapeMatND in the examples
+may be replaced as follow:
+@code
+    gray_img = (IplImage*)cvReshapeND(color_img, &gray_img_hdr, 1, 0, 0);
+    ...
+    row = (CvMat*)cvReshapeND(mat, &row_header, 0, 1, 0);
+@endcode
+@param arr Input array
+@param sizeof_header Size of output header to distinguish between IplImage, CvMat and CvMatND
+output headers
+@param header Output header to be filled
+@param new_cn New number of channels. new_cn = 0 means that the number of channels remains
+unchanged.
+@param new_dims New number of dimensions. new_dims = 0 means that the number of dimensions
+remains the same.
+@param new_sizes Array of new dimension sizes. Only new_dims-1 values are used, because the
+total number of elements must remain the same. Thus, if new_dims = 1, new_sizes array is not
+used.
+ */
+CVAPI(CvArr*) cvReshapeMatND( const CvArr* arr,
+                             int sizeof_header, CvArr* header,
+                             int new_cn, int new_dims, int* new_sizes );
+
+#define cvReshapeND( arr, header, new_cn, new_dims, new_sizes )   \
+      cvReshapeMatND( (arr), sizeof(*(header)), (header),         \
+                      (new_cn), (new_dims), (new_sizes))
+
+/** @brief Changes shape of matrix/image without copying data.
+
+The function initializes the CvMat header so that it points to the same data as the original array
+but has a different shape - different number of channels, different number of rows, or both.
+
+The following example code creates one image buffer and two image headers, the first is for a
+320x240x3 image and the second is for a 960x240x1 image:
+@code
+    IplImage* color_img = cvCreateImage(cvSize(320,240), IPL_DEPTH_8U, 3);
+    CvMat gray_mat_hdr;
+    IplImage gray_img_hdr, *gray_img;
+    cvReshape(color_img, &gray_mat_hdr, 1);
+    gray_img = cvGetImage(&gray_mat_hdr, &gray_img_hdr);
+@endcode
+And the next example converts a 3x3 matrix to a single 1x9 vector:
+@code
+    CvMat* mat = cvCreateMat(3, 3, CV_32F);
+    CvMat row_header, *row;
+    row = cvReshape(mat, &row_header, 0, 1);
+@endcode
+@param arr Input array
+@param header Output header to be filled
+@param new_cn New number of channels. 'new_cn = 0' means that the number of channels remains
+unchanged.
+@param new_rows New number of rows. 'new_rows = 0' means that the number of rows remains
+unchanged unless it needs to be changed according to new_cn value.
+*/
+CVAPI(CvMat*) cvReshape( const CvArr* arr, CvMat* header,
+                        int new_cn, int new_rows CV_DEFAULT(0) );
+
+/** Repeats source 2d array several times in both horizontal and
+   vertical direction to fill destination array */
+CVAPI(void) cvRepeat( const CvArr* src, CvArr* dst );
+
+/** @brief Allocates array data
+
+The function allocates image, matrix or multi-dimensional dense array data. Note that in the case of
+matrix types OpenCV allocation functions are used. In the case of IplImage they are used unless
+CV_TURN_ON_IPL_COMPATIBILITY() has been called before. In the latter case IPL functions are used
+to allocate the data.
+@param arr Array header
+ */
+CVAPI(void)  cvCreateData( CvArr* arr );
+
+/** @brief Releases array data.
+
+The function releases the array data. In the case of CvMat or CvMatND it simply calls
+cvDecRefData(), that is the function can not deallocate external data. See also the note to
+cvCreateData .
+@param arr Array header
+ */
+CVAPI(void)  cvReleaseData( CvArr* arr );
+
+/** @brief Assigns user data to the array header.
+
+The function assigns user data to the array header. Header should be initialized before using
+cvCreateMatHeader, cvCreateImageHeader, cvCreateMatNDHeader, cvInitMatHeader,
+cvInitImageHeader or cvInitMatNDHeader.
+@param arr Array header
+@param data User data
+@param step Full row length in bytes
+ */
+CVAPI(void)  cvSetData( CvArr* arr, void* data, int step );
+
+/** @brief Retrieves low-level information about the array.
+
+The function fills output variables with low-level information about the array data. All output
+
+parameters are optional, so some of the pointers may be set to NULL. If the array is IplImage with
+ROI set, the parameters of ROI are returned.
+
+The following example shows how to get access to array elements. It computes absolute values of the
+array elements :
+@code
+    float* data;
+    int step;
+    CvSize size;
+
+    cvGetRawData(array, (uchar**)&data, &step, &size);
+    step /= sizeof(data[0]);
+
+    for(int y = 0; y < size.height; y++, data += step )
+        for(int x = 0; x < size.width; x++ )
+            data[x] = (float)fabs(data[x]);
+@endcode
+@param arr Array header
+@param data Output pointer to the whole image origin or ROI origin if ROI is set
+@param step Output full row length in bytes
+@param roi_size Output ROI size
+ */
+CVAPI(void) cvGetRawData( const CvArr* arr, uchar** data,
+                         int* step CV_DEFAULT(NULL),
+                         CvSize* roi_size CV_DEFAULT(NULL));
+
+/** @brief Returns size of matrix or image ROI.
+
+The function returns number of rows (CvSize::height) and number of columns (CvSize::width) of the
+input matrix or image. In the case of image the size of ROI is returned.
+@param arr array header
+ */
+CVAPI(CvSize) cvGetSize( const CvArr* arr );
+
+/** @brief Copies one array to another.
+
+The function copies selected elements from an input array to an output array:
+
+\f[\texttt{dst} (I)= \texttt{src} (I)  \quad \text{if} \quad \texttt{mask} (I)  \ne 0.\f]
+
+If any of the passed arrays is of IplImage type, then its ROI and COI fields are used. Both arrays
+must have the same type, the same number of dimensions, and the same size. The function can also
+copy sparse arrays (mask is not supported in this case).
+@param src The source array
+@param dst The destination array
+@param mask Operation mask, 8-bit single channel array; specifies elements of the destination array
+to be changed
+ */
+CVAPI(void)  cvCopy( const CvArr* src, CvArr* dst,
+                     const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Sets every element of an array to a given value.
+
+The function copies the scalar value to every selected element of the destination array:
+\f[\texttt{arr} (I)= \texttt{value} \quad \text{if} \quad \texttt{mask} (I)  \ne 0\f]
+If array arr is of IplImage type, then is ROI used, but COI must not be set.
+@param arr The destination array
+@param value Fill value
+@param mask Operation mask, 8-bit single channel array; specifies elements of the destination
+array to be changed
+ */
+CVAPI(void)  cvSet( CvArr* arr, CvScalar value,
+                    const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Clears the array.
+
+The function clears the array. In the case of dense arrays (CvMat, CvMatND or IplImage),
+cvZero(array) is equivalent to cvSet(array,cvScalarAll(0),0). In the case of sparse arrays all the
+elements are removed.
+@param arr Array to be cleared
+ */
+CVAPI(void)  cvSetZero( CvArr* arr );
+#define cvZero  cvSetZero
+
+
+/** Splits a multi-channel array into the set of single-channel arrays or
+   extracts particular [color] plane */
+CVAPI(void)  cvSplit( const CvArr* src, CvArr* dst0, CvArr* dst1,
+                      CvArr* dst2, CvArr* dst3 );
+
+/** Merges a set of single-channel arrays into the single multi-channel array
+   or inserts one particular [color] plane to the array */
+CVAPI(void)  cvMerge( const CvArr* src0, const CvArr* src1,
+                      const CvArr* src2, const CvArr* src3,
+                      CvArr* dst );
+
+/** Copies several channels from input arrays to
+   certain channels of output arrays */
+CVAPI(void)  cvMixChannels( const CvArr** src, int src_count,
+                            CvArr** dst, int dst_count,
+                            const int* from_to, int pair_count );
+
+/** @brief Converts one array to another with optional linear transformation.
+
+The function has several different purposes, and thus has several different names. It copies one
+array to another with optional scaling, which is performed first, and/or optional type conversion,
+performed after:
+
+\f[\texttt{dst} (I) =  \texttt{scale} \texttt{src} (I) + ( \texttt{shift} _0, \texttt{shift} _1,...)\f]
+
+All the channels of multi-channel arrays are processed independently.
+
+The type of conversion is done with rounding and saturation, that is if the result of scaling +
+conversion can not be represented exactly by a value of the destination array element type, it is
+set to the nearest representable value on the real axis.
+@param src Source array
+@param dst Destination array
+@param scale Scale factor
+@param shift Value added to the scaled source array elements
+ */
+CVAPI(void)  cvConvertScale( const CvArr* src, CvArr* dst,
+                             double scale CV_DEFAULT(1),
+                             double shift CV_DEFAULT(0) );
+#define cvCvtScale cvConvertScale
+#define cvScale  cvConvertScale
+#define cvConvert( src, dst )  cvConvertScale( (src), (dst), 1, 0 )
+
+
+/** Performs linear transformation on every source array element,
+   stores absolute value of the result:
+   dst(x,y,c) = abs(scale*src(x,y,c)+shift).
+   destination array must have 8u type.
+   In other cases one may use cvConvertScale + cvAbsDiffS */
+CVAPI(void)  cvConvertScaleAbs( const CvArr* src, CvArr* dst,
+                                double scale CV_DEFAULT(1),
+                                double shift CV_DEFAULT(0) );
+#define cvCvtScaleAbs  cvConvertScaleAbs
+
+
+/** checks termination criteria validity and
+   sets eps to default_eps (if it is not set),
+   max_iter to default_max_iters (if it is not set)
+*/
+CVAPI(CvTermCriteria) cvCheckTermCriteria( CvTermCriteria criteria,
+                                           double default_eps,
+                                           int default_max_iters );
+
+/****************************************************************************************\
+*                   Arithmetic, logic and comparison operations                          *
+\****************************************************************************************/
+
+/** dst(mask) = src1(mask) + src2(mask) */
+CVAPI(void)  cvAdd( const CvArr* src1, const CvArr* src2, CvArr* dst,
+                    const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(mask) = src(mask) + value */
+CVAPI(void)  cvAddS( const CvArr* src, CvScalar value, CvArr* dst,
+                     const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(mask) = src1(mask) - src2(mask) */
+CVAPI(void)  cvSub( const CvArr* src1, const CvArr* src2, CvArr* dst,
+                    const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(mask) = src(mask) - value = src(mask) + (-value) */
+CV_INLINE  void  cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
+                         const CvArr* mask CV_DEFAULT(NULL))
+{
+    cvAddS( src, cvScalar( -value.val[0], -value.val[1], -value.val[2], -value.val[3]),
+            dst, mask );
+}
+
+/** dst(mask) = value - src(mask) */
+CVAPI(void)  cvSubRS( const CvArr* src, CvScalar value, CvArr* dst,
+                      const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src1(idx) * src2(idx) * scale
+   (scaled element-wise multiplication of 2 arrays) */
+CVAPI(void)  cvMul( const CvArr* src1, const CvArr* src2,
+                    CvArr* dst, double scale CV_DEFAULT(1) );
+
+/** element-wise division/inversion with scaling:
+    dst(idx) = src1(idx) * scale / src2(idx)
+    or dst(idx) = scale / src2(idx) if src1 == 0 */
+CVAPI(void)  cvDiv( const CvArr* src1, const CvArr* src2,
+                    CvArr* dst, double scale CV_DEFAULT(1));
+
+/** dst = src1 * scale + src2 */
+CVAPI(void)  cvScaleAdd( const CvArr* src1, CvScalar scale,
+                         const CvArr* src2, CvArr* dst );
+#define cvAXPY( A, real_scalar, B, C ) cvScaleAdd(A, cvRealScalar(real_scalar), B, C)
+
+/** dst = src1 * alpha + src2 * beta + gamma */
+CVAPI(void)  cvAddWeighted( const CvArr* src1, double alpha,
+                            const CvArr* src2, double beta,
+                            double gamma, CvArr* dst );
+
+/** @brief Calculates the dot product of two arrays in Euclidean metrics.
+
+The function calculates and returns the Euclidean dot product of two arrays.
+
+\f[src1  \bullet src2 =  \sum _I ( \texttt{src1} (I)  \texttt{src2} (I))\f]
+
+In the case of multiple channel arrays, the results for all channels are accumulated. In particular,
+cvDotProduct(a,a) where a is a complex vector, will return \f$||\texttt{a}||^2\f$. The function can
+process multi-dimensional arrays, row by row, layer by layer, and so on.
+@param src1 The first source array
+@param src2 The second source array
+ */
+CVAPI(double)  cvDotProduct( const CvArr* src1, const CvArr* src2 );
+
+/** dst(idx) = src1(idx) & src2(idx) */
+CVAPI(void) cvAnd( const CvArr* src1, const CvArr* src2,
+                  CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src(idx) & value */
+CVAPI(void) cvAndS( const CvArr* src, CvScalar value,
+                   CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src1(idx) | src2(idx) */
+CVAPI(void) cvOr( const CvArr* src1, const CvArr* src2,
+                 CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src(idx) | value */
+CVAPI(void) cvOrS( const CvArr* src, CvScalar value,
+                  CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src1(idx) ^ src2(idx) */
+CVAPI(void) cvXor( const CvArr* src1, const CvArr* src2,
+                  CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = src(idx) ^ value */
+CVAPI(void) cvXorS( const CvArr* src, CvScalar value,
+                   CvArr* dst, const CvArr* mask CV_DEFAULT(NULL));
+
+/** dst(idx) = ~src(idx) */
+CVAPI(void) cvNot( const CvArr* src, CvArr* dst );
+
+/** dst(idx) = lower(idx) <= src(idx) < upper(idx) */
+CVAPI(void) cvInRange( const CvArr* src, const CvArr* lower,
+                      const CvArr* upper, CvArr* dst );
+
+/** dst(idx) = lower <= src(idx) < upper */
+CVAPI(void) cvInRangeS( const CvArr* src, CvScalar lower,
+                       CvScalar upper, CvArr* dst );
+
+#define CV_CMP_EQ   0
+#define CV_CMP_GT   1
+#define CV_CMP_GE   2
+#define CV_CMP_LT   3
+#define CV_CMP_LE   4
+#define CV_CMP_NE   5
+
+/** The comparison operation support single-channel arrays only.
+   Destination image should be 8uC1 or 8sC1 */
+
+/** dst(idx) = src1(idx) _cmp_op_ src2(idx) */
+CVAPI(void) cvCmp( const CvArr* src1, const CvArr* src2, CvArr* dst, int cmp_op );
+
+/** dst(idx) = src1(idx) _cmp_op_ value */
+CVAPI(void) cvCmpS( const CvArr* src, double value, CvArr* dst, int cmp_op );
+
+/** dst(idx) = min(src1(idx),src2(idx)) */
+CVAPI(void) cvMin( const CvArr* src1, const CvArr* src2, CvArr* dst );
+
+/** dst(idx) = max(src1(idx),src2(idx)) */
+CVAPI(void) cvMax( const CvArr* src1, const CvArr* src2, CvArr* dst );
+
+/** dst(idx) = min(src(idx),value) */
+CVAPI(void) cvMinS( const CvArr* src, double value, CvArr* dst );
+
+/** dst(idx) = max(src(idx),value) */
+CVAPI(void) cvMaxS( const CvArr* src, double value, CvArr* dst );
+
+/** dst(x,y,c) = abs(src1(x,y,c) - src2(x,y,c)) */
+CVAPI(void) cvAbsDiff( const CvArr* src1, const CvArr* src2, CvArr* dst );
+
+/** dst(x,y,c) = abs(src(x,y,c) - value(c)) */
+CVAPI(void) cvAbsDiffS( const CvArr* src, CvArr* dst, CvScalar value );
+#define cvAbs( src, dst ) cvAbsDiffS( (src), (dst), cvScalarAll(0))
+
+/****************************************************************************************\
+*                                Math operations                                         *
+\****************************************************************************************/
+
+/** Does cartesian->polar coordinates conversion.
+   Either of output components (magnitude or angle) is optional */
+CVAPI(void)  cvCartToPolar( const CvArr* x, const CvArr* y,
+                            CvArr* magnitude, CvArr* angle CV_DEFAULT(NULL),
+                            int angle_in_degrees CV_DEFAULT(0));
+
+/** Does polar->cartesian coordinates conversion.
+   Either of output components (magnitude or angle) is optional.
+   If magnitude is missing it is assumed to be all 1's */
+CVAPI(void)  cvPolarToCart( const CvArr* magnitude, const CvArr* angle,
+                            CvArr* x, CvArr* y,
+                            int angle_in_degrees CV_DEFAULT(0));
+
+/** Does powering: dst(idx) = src(idx)^power */
+CVAPI(void)  cvPow( const CvArr* src, CvArr* dst, double power );
+
+/** Does exponention: dst(idx) = exp(src(idx)).
+   Overflow is not handled yet. Underflow is handled.
+   Maximal relative error is ~7e-6 for single-precision input */
+CVAPI(void)  cvExp( const CvArr* src, CvArr* dst );
+
+/** Calculates natural logarithms: dst(idx) = log(abs(src(idx))).
+   Logarithm of 0 gives large negative number(~-700)
+   Maximal relative error is ~3e-7 for single-precision output
+*/
+CVAPI(void)  cvLog( const CvArr* src, CvArr* dst );
+
+/** Fast arctangent calculation */
+CVAPI(float) cvFastArctan( float y, float x );
+
+/** Fast cubic root calculation */
+CVAPI(float)  cvCbrt( float value );
+
+#define  CV_CHECK_RANGE    1
+#define  CV_CHECK_QUIET    2
+/** Checks array values for NaNs, Infs or simply for too large numbers
+   (if CV_CHECK_RANGE is set). If CV_CHECK_QUIET is set,
+   no runtime errors is raised (function returns zero value in case of "bad" values).
+   Otherwise cvError is called */
+CVAPI(int)  cvCheckArr( const CvArr* arr, int flags CV_DEFAULT(0),
+                        double min_val CV_DEFAULT(0), double max_val CV_DEFAULT(0));
+#define cvCheckArray cvCheckArr
+
+#define CV_RAND_UNI      0
+#define CV_RAND_NORMAL   1
+
+/** @brief Fills an array with random numbers and updates the RNG state.
+
+The function fills the destination array with uniformly or normally distributed random numbers.
+@param rng CvRNG state initialized by cvRNG
+@param arr The destination array
+@param dist_type Distribution type
+> -   **CV_RAND_UNI** uniform distribution
+> -   **CV_RAND_NORMAL** normal or Gaussian distribution
+@param param1 The first parameter of the distribution. In the case of a uniform distribution it is
+the inclusive lower boundary of the random numbers range. In the case of a normal distribution it
+is the mean value of the random numbers.
+@param param2 The second parameter of the distribution. In the case of a uniform distribution it
+is the exclusive upper boundary of the random numbers range. In the case of a normal distribution
+it is the standard deviation of the random numbers.
+@sa randu, randn, RNG::fill.
+ */
+CVAPI(void) cvRandArr( CvRNG* rng, CvArr* arr, int dist_type,
+                      CvScalar param1, CvScalar param2 );
+
+CVAPI(void) cvRandShuffle( CvArr* mat, CvRNG* rng,
+                           double iter_factor CV_DEFAULT(1.));
+
+#define CV_SORT_EVERY_ROW 0
+#define CV_SORT_EVERY_COLUMN 1
+#define CV_SORT_ASCENDING 0
+#define CV_SORT_DESCENDING 16
+
+CVAPI(void) cvSort( const CvArr* src, CvArr* dst CV_DEFAULT(NULL),
+                    CvArr* idxmat CV_DEFAULT(NULL),
+                    int flags CV_DEFAULT(0));
+
+/** Finds real roots of a cubic equation */
+CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots );
+
+/** Finds all real and complex roots of a polynomial equation */
+CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots2,
+      int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100));
+
+/****************************************************************************************\
+*                                Matrix operations                                       *
+\****************************************************************************************/
+
+/** @brief Calculates the cross product of two 3D vectors.
+
+The function calculates the cross product of two 3D vectors:
+\f[\texttt{dst} =  \texttt{src1} \times \texttt{src2}\f]
+or:
+\f[\begin{array}{l} \texttt{dst} _1 =  \texttt{src1} _2  \texttt{src2} _3 -  \texttt{src1} _3  \texttt{src2} _2 \\ \texttt{dst} _2 =  \texttt{src1} _3  \texttt{src2} _1 -  \texttt{src1} _1  \texttt{src2} _3 \\ \texttt{dst} _3 =  \texttt{src1} _1  \texttt{src2} _2 -  \texttt{src1} _2  \texttt{src2} _1 \end{array}\f]
+@param src1 The first source vector
+@param src2 The second source vector
+@param dst The destination vector
+ */
+CVAPI(void)  cvCrossProduct( const CvArr* src1, const CvArr* src2, CvArr* dst );
+
+/** Matrix transform: dst = A*B + C, C is optional */
+#define cvMatMulAdd( src1, src2, src3, dst ) cvGEMM( (src1), (src2), 1., (src3), 1., (dst), 0 )
+#define cvMatMul( src1, src2, dst )  cvMatMulAdd( (src1), (src2), NULL, (dst))
+
+#define CV_GEMM_A_T 1
+#define CV_GEMM_B_T 2
+#define CV_GEMM_C_T 4
+/** Extended matrix transform:
+   dst = alpha*op(A)*op(B) + beta*op(C), where op(X) is X or X^T */
+CVAPI(void)  cvGEMM( const CvArr* src1, const CvArr* src2, double alpha,
+                     const CvArr* src3, double beta, CvArr* dst,
+                     int tABC CV_DEFAULT(0));
+#define cvMatMulAddEx cvGEMM
+
+/** Transforms each element of source array and stores
+   resultant vectors in destination array */
+CVAPI(void)  cvTransform( const CvArr* src, CvArr* dst,
+                          const CvMat* transmat,
+                          const CvMat* shiftvec CV_DEFAULT(NULL));
+#define cvMatMulAddS cvTransform
+
+/** Does perspective transform on every element of input array */
+CVAPI(void)  cvPerspectiveTransform( const CvArr* src, CvArr* dst,
+                                     const CvMat* mat );
+
+/** Calculates (A-delta)*(A-delta)^T (order=0) or (A-delta)^T*(A-delta) (order=1) */
+CVAPI(void) cvMulTransposed( const CvArr* src, CvArr* dst, int order,
+                             const CvArr* delta CV_DEFAULT(NULL),
+                             double scale CV_DEFAULT(1.) );
+
+/** Tranposes matrix. Square matrices can be transposed in-place */
+CVAPI(void)  cvTranspose( const CvArr* src, CvArr* dst );
+#define cvT cvTranspose
+
+/** Completes the symmetric matrix from the lower (LtoR=0) or from the upper (LtoR!=0) part */
+CVAPI(void)  cvCompleteSymm( CvMat* matrix, int LtoR CV_DEFAULT(0) );
+
+/** Mirror array data around horizontal (flip=0),
+   vertical (flip=1) or both(flip=-1) axises:
+   cvFlip(src) flips images vertically and sequences horizontally (inplace) */
+CVAPI(void)  cvFlip( const CvArr* src, CvArr* dst CV_DEFAULT(NULL),
+                     int flip_mode CV_DEFAULT(0));
+#define cvMirror cvFlip
+
+
+#define CV_SVD_MODIFY_A   1
+#define CV_SVD_U_T        2
+#define CV_SVD_V_T        4
+
+/** Performs Singular Value Decomposition of a matrix */
+CVAPI(void)   cvSVD( CvArr* A, CvArr* W, CvArr* U CV_DEFAULT(NULL),
+                     CvArr* V CV_DEFAULT(NULL), int flags CV_DEFAULT(0));
+
+/** Performs Singular Value Back Substitution (solves A*X = B):
+   flags must be the same as in cvSVD */
+CVAPI(void)   cvSVBkSb( const CvArr* W, const CvArr* U,
+                        const CvArr* V, const CvArr* B,
+                        CvArr* X, int flags );
+
+#define CV_LU  0
+#define CV_SVD 1
+#define CV_SVD_SYM 2
+#define CV_CHOLESKY 3
+#define CV_QR  4
+#define CV_NORMAL 16
+
+/** Inverts matrix */
+CVAPI(double)  cvInvert( const CvArr* src, CvArr* dst,
+                         int method CV_DEFAULT(CV_LU));
+#define cvInv cvInvert
+
+/** Solves linear system (src1)*(dst) = (src2)
+   (returns 0 if src1 is a singular and CV_LU method is used) */
+CVAPI(int)  cvSolve( const CvArr* src1, const CvArr* src2, CvArr* dst,
+                     int method CV_DEFAULT(CV_LU));
+
+/** Calculates determinant of input matrix */
+CVAPI(double) cvDet( const CvArr* mat );
+
+/** Calculates trace of the matrix (sum of elements on the main diagonal) */
+CVAPI(CvScalar) cvTrace( const CvArr* mat );
+
+/** Finds eigen values and vectors of a symmetric matrix */
+CVAPI(void)  cvEigenVV( CvArr* mat, CvArr* evects, CvArr* evals,
+                        double eps CV_DEFAULT(0),
+                        int lowindex CV_DEFAULT(-1),
+                        int highindex CV_DEFAULT(-1));
+
+///* Finds selected eigen values and vectors of a symmetric matrix */
+//CVAPI(void)  cvSelectedEigenVV( CvArr* mat, CvArr* evects, CvArr* evals,
+//                                int lowindex, int highindex );
+
+/** Makes an identity matrix (mat_ij = i == j) */
+CVAPI(void)  cvSetIdentity( CvArr* mat, CvScalar value CV_DEFAULT(cvRealScalar(1)) );
+
+/** Fills matrix with given range of numbers */
+CVAPI(CvArr*)  cvRange( CvArr* mat, double start, double end );
+
+/**   @anchor core_c_CovarFlags
+@name Flags for cvCalcCovarMatrix
+@see cvCalcCovarMatrix
+  @{
+*/
+
+/** flag for cvCalcCovarMatrix, transpose([v1-avg, v2-avg,...]) * [v1-avg,v2-avg,...] */
+#define CV_COVAR_SCRAMBLED 0
+
+/** flag for cvCalcCovarMatrix, [v1-avg, v2-avg,...] * transpose([v1-avg,v2-avg,...]) */
+#define CV_COVAR_NORMAL    1
+
+/** flag for cvCalcCovarMatrix, do not calc average (i.e. mean vector) - use the input vector instead
+   (useful for calculating covariance matrix by parts) */
+#define CV_COVAR_USE_AVG   2
+
+/** flag for cvCalcCovarMatrix, scale the covariance matrix coefficients by number of the vectors */
+#define CV_COVAR_SCALE     4
+
+/** flag for cvCalcCovarMatrix, all the input vectors are stored in a single matrix, as its rows */
+#define CV_COVAR_ROWS      8
+
+/** flag for cvCalcCovarMatrix, all the input vectors are stored in a single matrix, as its columns */
+#define CV_COVAR_COLS     16
+
+/** @} */
+
+/** Calculates covariation matrix for a set of vectors
+@see @ref core_c_CovarFlags "flags"
+*/
+CVAPI(void)  cvCalcCovarMatrix( const CvArr** vects, int count,
+                                CvArr* cov_mat, CvArr* avg, int flags );
+
+#define CV_PCA_DATA_AS_ROW 0
+#define CV_PCA_DATA_AS_COL 1
+#define CV_PCA_USE_AVG 2
+CVAPI(void)  cvCalcPCA( const CvArr* data, CvArr* mean,
+                        CvArr* eigenvals, CvArr* eigenvects, int flags );
+
+CVAPI(void)  cvProjectPCA( const CvArr* data, const CvArr* mean,
+                           const CvArr* eigenvects, CvArr* result );
+
+CVAPI(void)  cvBackProjectPCA( const CvArr* proj, const CvArr* mean,
+                               const CvArr* eigenvects, CvArr* result );
+
+/** Calculates Mahalanobis(weighted) distance */
+CVAPI(double)  cvMahalanobis( const CvArr* vec1, const CvArr* vec2, const CvArr* mat );
+#define cvMahalonobis  cvMahalanobis
+
+/****************************************************************************************\
+*                                    Array Statistics                                    *
+\****************************************************************************************/
+
+/** Finds sum of array elements */
+CVAPI(CvScalar)  cvSum( const CvArr* arr );
+
+/** Calculates number of non-zero pixels */
+CVAPI(int)  cvCountNonZero( const CvArr* arr );
+
+/** Calculates mean value of array elements */
+CVAPI(CvScalar)  cvAvg( const CvArr* arr, const CvArr* mask CV_DEFAULT(NULL) );
+
+/** Calculates mean and standard deviation of pixel values */
+CVAPI(void)  cvAvgSdv( const CvArr* arr, CvScalar* mean, CvScalar* std_dev,
+                       const CvArr* mask CV_DEFAULT(NULL) );
+
+/** Finds global minimum, maximum and their positions */
+CVAPI(void)  cvMinMaxLoc( const CvArr* arr, double* min_val, double* max_val,
+                          CvPoint* min_loc CV_DEFAULT(NULL),
+                          CvPoint* max_loc CV_DEFAULT(NULL),
+                          const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @anchor core_c_NormFlags
+  @name Flags for cvNorm and cvNormalize
+  @{
+*/
+#define CV_C            1
+#define CV_L1           2
+#define CV_L2           4
+#define CV_NORM_MASK    7
+#define CV_RELATIVE     8
+#define CV_DIFF         16
+#define CV_MINMAX       32
+
+#define CV_DIFF_C       (CV_DIFF | CV_C)
+#define CV_DIFF_L1      (CV_DIFF | CV_L1)
+#define CV_DIFF_L2      (CV_DIFF | CV_L2)
+#define CV_RELATIVE_C   (CV_RELATIVE | CV_C)
+#define CV_RELATIVE_L1  (CV_RELATIVE | CV_L1)
+#define CV_RELATIVE_L2  (CV_RELATIVE | CV_L2)
+/** @} */
+
+/** Finds norm, difference norm or relative difference norm for an array (or two arrays)
+@see ref core_c_NormFlags "flags"
+*/
+CVAPI(double)  cvNorm( const CvArr* arr1, const CvArr* arr2 CV_DEFAULT(NULL),
+                       int norm_type CV_DEFAULT(CV_L2),
+                       const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @see ref core_c_NormFlags "flags" */
+CVAPI(void)  cvNormalize( const CvArr* src, CvArr* dst,
+                          double a CV_DEFAULT(1.), double b CV_DEFAULT(0.),
+                          int norm_type CV_DEFAULT(CV_L2),
+                          const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @anchor core_c_ReduceFlags
+  @name Flags for cvReduce
+  @{
+*/
+#define CV_REDUCE_SUM 0
+#define CV_REDUCE_AVG 1
+#define CV_REDUCE_MAX 2
+#define CV_REDUCE_MIN 3
+/** @} */
+
+/** @see @ref core_c_ReduceFlags "flags" */
+CVAPI(void)  cvReduce( const CvArr* src, CvArr* dst, int dim CV_DEFAULT(-1),
+                       int op CV_DEFAULT(CV_REDUCE_SUM) );
+
+/****************************************************************************************\
+*                      Discrete Linear Transforms and Related Functions                  *
+\****************************************************************************************/
+
+/** @anchor core_c_DftFlags
+  @name Flags for cvDFT, cvDCT and cvMulSpectrums
+  @{
+  */
+#define CV_DXT_FORWARD  0
+#define CV_DXT_INVERSE  1
+#define CV_DXT_SCALE    2 /**< divide result by size of array */
+#define CV_DXT_INV_SCALE (CV_DXT_INVERSE + CV_DXT_SCALE)
+#define CV_DXT_INVERSE_SCALE CV_DXT_INV_SCALE
+#define CV_DXT_ROWS     4 /**< transform each row individually */
+#define CV_DXT_MUL_CONJ 8 /**< conjugate the second argument of cvMulSpectrums */
+/** @} */
+
+/** Discrete Fourier Transform:
+    complex->complex,
+    real->ccs (forward),
+    ccs->real (inverse)
+@see core_c_DftFlags "flags"
+*/
+CVAPI(void)  cvDFT( const CvArr* src, CvArr* dst, int flags,
+                    int nonzero_rows CV_DEFAULT(0) );
+#define cvFFT cvDFT
+
+/** Multiply results of DFTs: DFT(X)*DFT(Y) or DFT(X)*conj(DFT(Y))
+@see core_c_DftFlags "flags"
+*/
+CVAPI(void)  cvMulSpectrums( const CvArr* src1, const CvArr* src2,
+                             CvArr* dst, int flags );
+
+/** Finds optimal DFT vector size >= size0 */
+CVAPI(int)  cvGetOptimalDFTSize( int size0 );
+
+/** Discrete Cosine Transform
+@see core_c_DftFlags "flags"
+*/
+CVAPI(void)  cvDCT( const CvArr* src, CvArr* dst, int flags );
+
+/****************************************************************************************\
+*                              Dynamic data structures                                   *
+\****************************************************************************************/
+
+/** Calculates length of sequence slice (with support of negative indices). */
+CVAPI(int) cvSliceLength( CvSlice slice, const CvSeq* seq );
+
+
+/** Creates new memory storage.
+   block_size == 0 means that default,
+   somewhat optimal size, is used (currently, it is 64K) */
+CVAPI(CvMemStorage*)  cvCreateMemStorage( int block_size CV_DEFAULT(0));
+
+
+/** Creates a memory storage that will borrow memory blocks from parent storage */
+CVAPI(CvMemStorage*)  cvCreateChildMemStorage( CvMemStorage* parent );
+
+
+/** Releases memory storage. All the children of a parent must be released before
+   the parent. A child storage returns all the blocks to parent when it is released */
+CVAPI(void)  cvReleaseMemStorage( CvMemStorage** storage );
+
+
+/** Clears memory storage. This is the only way(!!!) (besides cvRestoreMemStoragePos)
+   to reuse memory allocated for the storage - cvClearSeq,cvClearSet ...
+   do not free any memory.
+   A child storage returns all the blocks to the parent when it is cleared */
+CVAPI(void)  cvClearMemStorage( CvMemStorage* storage );
+
+/** Remember a storage "free memory" position */
+CVAPI(void)  cvSaveMemStoragePos( const CvMemStorage* storage, CvMemStoragePos* pos );
+
+/** Restore a storage "free memory" position */
+CVAPI(void)  cvRestoreMemStoragePos( CvMemStorage* storage, CvMemStoragePos* pos );
+
+/** Allocates continuous buffer of the specified size in the storage */
+CVAPI(void*) cvMemStorageAlloc( CvMemStorage* storage, size_t size );
+
+/** Allocates string in memory storage */
+CVAPI(CvString) cvMemStorageAllocString( CvMemStorage* storage, const char* ptr,
+                                         int len CV_DEFAULT(-1) );
+
+/** Creates new empty sequence that will reside in the specified storage */
+CVAPI(CvSeq*)  cvCreateSeq( int seq_flags, size_t header_size,
+                            size_t elem_size, CvMemStorage* storage );
+
+/** Changes default size (granularity) of sequence blocks.
+   The default size is ~1Kbyte */
+CVAPI(void)  cvSetSeqBlockSize( CvSeq* seq, int delta_elems );
+
+
+/** Adds new element to the end of sequence. Returns pointer to the element */
+CVAPI(schar*)  cvSeqPush( CvSeq* seq, const void* element CV_DEFAULT(NULL));
+
+
+/** Adds new element to the beginning of sequence. Returns pointer to it */
+CVAPI(schar*)  cvSeqPushFront( CvSeq* seq, const void* element CV_DEFAULT(NULL));
+
+
+/** Removes the last element from sequence and optionally saves it */
+CVAPI(void)  cvSeqPop( CvSeq* seq, void* element CV_DEFAULT(NULL));
+
+
+/** Removes the first element from sequence and optioanally saves it */
+CVAPI(void)  cvSeqPopFront( CvSeq* seq, void* element CV_DEFAULT(NULL));
+
+
+#define CV_FRONT 1
+#define CV_BACK 0
+/** Adds several new elements to the end of sequence */
+CVAPI(void)  cvSeqPushMulti( CvSeq* seq, const void* elements,
+                             int count, int in_front CV_DEFAULT(0) );
+
+/** Removes several elements from the end of sequence and optionally saves them */
+CVAPI(void)  cvSeqPopMulti( CvSeq* seq, void* elements,
+                            int count, int in_front CV_DEFAULT(0) );
+
+/** Inserts a new element in the middle of sequence.
+   cvSeqInsert(seq,0,elem) == cvSeqPushFront(seq,elem) */
+CVAPI(schar*)  cvSeqInsert( CvSeq* seq, int before_index,
+                            const void* element CV_DEFAULT(NULL));
+
+/** Removes specified sequence element */
+CVAPI(void)  cvSeqRemove( CvSeq* seq, int index );
+
+
+/** Removes all the elements from the sequence. The freed memory
+   can be reused later only by the same sequence unless cvClearMemStorage
+   or cvRestoreMemStoragePos is called */
+CVAPI(void)  cvClearSeq( CvSeq* seq );
+
+
+/** Retrieves pointer to specified sequence element.
+   Negative indices are supported and mean counting from the end
+   (e.g -1 means the last sequence element) */
+CVAPI(schar*)  cvGetSeqElem( const CvSeq* seq, int index );
+
+/** Calculates index of the specified sequence element.
+   Returns -1 if element does not belong to the sequence */
+CVAPI(int)  cvSeqElemIdx( const CvSeq* seq, const void* element,
+                         CvSeqBlock** block CV_DEFAULT(NULL) );
+
+/** Initializes sequence writer. The new elements will be added to the end of sequence */
+CVAPI(void)  cvStartAppendToSeq( CvSeq* seq, CvSeqWriter* writer );
+
+
+/** Combination of cvCreateSeq and cvStartAppendToSeq */
+CVAPI(void)  cvStartWriteSeq( int seq_flags, int header_size,
+                              int elem_size, CvMemStorage* storage,
+                              CvSeqWriter* writer );
+
+/** Closes sequence writer, updates sequence header and returns pointer
+   to the resultant sequence
+   (which may be useful if the sequence was created using cvStartWriteSeq))
+*/
+CVAPI(CvSeq*)  cvEndWriteSeq( CvSeqWriter* writer );
+
+
+/** Updates sequence header. May be useful to get access to some of previously
+   written elements via cvGetSeqElem or sequence reader */
+CVAPI(void)   cvFlushSeqWriter( CvSeqWriter* writer );
+
+
+/** Initializes sequence reader.
+   The sequence can be read in forward or backward direction */
+CVAPI(void) cvStartReadSeq( const CvSeq* seq, CvSeqReader* reader,
+                           int reverse CV_DEFAULT(0) );
+
+
+/** Returns current sequence reader position (currently observed sequence element) */
+CVAPI(int)  cvGetSeqReaderPos( CvSeqReader* reader );
+
+
+/** Changes sequence reader position. It may seek to an absolute or
+   to relative to the current position */
+CVAPI(void)   cvSetSeqReaderPos( CvSeqReader* reader, int index,
+                                 int is_relative CV_DEFAULT(0));
+
+/** Copies sequence content to a continuous piece of memory */
+CVAPI(void*)  cvCvtSeqToArray( const CvSeq* seq, void* elements,
+                               CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ) );
+
+/** Creates sequence header for array.
+   After that all the operations on sequences that do not alter the content
+   can be applied to the resultant sequence */
+CVAPI(CvSeq*) cvMakeSeqHeaderForArray( int seq_type, int header_size,
+                                       int elem_size, void* elements, int total,
+                                       CvSeq* seq, CvSeqBlock* block );
+
+/** Extracts sequence slice (with or without copying sequence elements) */
+CVAPI(CvSeq*) cvSeqSlice( const CvSeq* seq, CvSlice slice,
+                         CvMemStorage* storage CV_DEFAULT(NULL),
+                         int copy_data CV_DEFAULT(0));
+
+CV_INLINE CvSeq* cvCloneSeq( const CvSeq* seq, CvMemStorage* storage CV_DEFAULT(NULL))
+{
+    return cvSeqSlice( seq, CV_WHOLE_SEQ, storage, 1 );
+}
+
+/** Removes sequence slice */
+CVAPI(void)  cvSeqRemoveSlice( CvSeq* seq, CvSlice slice );
+
+/** Inserts a sequence or array into another sequence */
+CVAPI(void)  cvSeqInsertSlice( CvSeq* seq, int before_index, const CvArr* from_arr );
+
+/** a < b ? -1 : a > b ? 1 : 0 */
+typedef int (CV_CDECL* CvCmpFunc)(const void* a, const void* b, void* userdata );
+
+/** Sorts sequence in-place given element comparison function */
+CVAPI(void) cvSeqSort( CvSeq* seq, CvCmpFunc func, void* userdata CV_DEFAULT(NULL) );
+
+/** Finds element in a [sorted] sequence */
+CVAPI(schar*) cvSeqSearch( CvSeq* seq, const void* elem, CvCmpFunc func,
+                           int is_sorted, int* elem_idx,
+                           void* userdata CV_DEFAULT(NULL) );
+
+/** Reverses order of sequence elements in-place */
+CVAPI(void) cvSeqInvert( CvSeq* seq );
+
+/** Splits sequence into one or more equivalence classes using the specified criteria */
+CVAPI(int)  cvSeqPartition( const CvSeq* seq, CvMemStorage* storage,
+                            CvSeq** labels, CvCmpFunc is_equal, void* userdata );
+
+/************ Internal sequence functions ************/
+CVAPI(void)  cvChangeSeqBlock( void* reader, int direction );
+CVAPI(void)  cvCreateSeqBlock( CvSeqWriter* writer );
+
+
+/** Creates a new set */
+CVAPI(CvSet*)  cvCreateSet( int set_flags, int header_size,
+                            int elem_size, CvMemStorage* storage );
+
+/** Adds new element to the set and returns pointer to it */
+CVAPI(int)  cvSetAdd( CvSet* set_header, CvSetElem* elem CV_DEFAULT(NULL),
+                      CvSetElem** inserted_elem CV_DEFAULT(NULL) );
+
+/** Fast variant of cvSetAdd */
+CV_INLINE  CvSetElem* cvSetNew( CvSet* set_header )
+{
+    CvSetElem* elem = set_header->free_elems;
+    if( elem )
+    {
+        set_header->free_elems = elem->next_free;
+        elem->flags = elem->flags & CV_SET_ELEM_IDX_MASK;
+        set_header->active_count++;
+    }
+    else
+        cvSetAdd( set_header, NULL, &elem );
+    return elem;
+}
+
+/** Removes set element given its pointer */
+CV_INLINE  void cvSetRemoveByPtr( CvSet* set_header, void* elem )
+{
+    CvSetElem* _elem = (CvSetElem*)elem;
+    assert( _elem->flags >= 0 /*&& (elem->flags & CV_SET_ELEM_IDX_MASK) < set_header->total*/ );
+    _elem->next_free = set_header->free_elems;
+    _elem->flags = (_elem->flags & CV_SET_ELEM_IDX_MASK) | CV_SET_ELEM_FREE_FLAG;
+    set_header->free_elems = _elem;
+    set_header->active_count--;
+}
+
+/** Removes element from the set by its index  */
+CVAPI(void)   cvSetRemove( CvSet* set_header, int index );
+
+/** Returns a set element by index. If the element doesn't belong to the set,
+   NULL is returned */
+CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int idx )
+{
+    CvSetElem* elem = (CvSetElem*)(void *)cvGetSeqElem( (CvSeq*)set_header, idx );
+    return elem && CV_IS_SET_ELEM( elem ) ? elem : 0;
+}
+
+/** Removes all the elements from the set */
+CVAPI(void)  cvClearSet( CvSet* set_header );
+
+/** Creates new graph */
+CVAPI(CvGraph*)  cvCreateGraph( int graph_flags, int header_size,
+                                int vtx_size, int edge_size,
+                                CvMemStorage* storage );
+
+/** Adds new vertex to the graph */
+CVAPI(int)  cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* vtx CV_DEFAULT(NULL),
+                           CvGraphVtx** inserted_vtx CV_DEFAULT(NULL) );
+
+
+/** Removes vertex from the graph together with all incident edges */
+CVAPI(int)  cvGraphRemoveVtx( CvGraph* graph, int index );
+CVAPI(int)  cvGraphRemoveVtxByPtr( CvGraph* graph, CvGraphVtx* vtx );
+
+
+/** Link two vertices specifed by indices or pointers if they
+   are not connected or return pointer to already existing edge
+   connecting the vertices.
+   Functions return 1 if a new edge was created, 0 otherwise */
+CVAPI(int)  cvGraphAddEdge( CvGraph* graph,
+                            int start_idx, int end_idx,
+                            const CvGraphEdge* edge CV_DEFAULT(NULL),
+                            CvGraphEdge** inserted_edge CV_DEFAULT(NULL) );
+
+CVAPI(int)  cvGraphAddEdgeByPtr( CvGraph* graph,
+                               CvGraphVtx* start_vtx, CvGraphVtx* end_vtx,
+                               const CvGraphEdge* edge CV_DEFAULT(NULL),
+                               CvGraphEdge** inserted_edge CV_DEFAULT(NULL) );
+
+/** Remove edge connecting two vertices */
+CVAPI(void)  cvGraphRemoveEdge( CvGraph* graph, int start_idx, int end_idx );
+CVAPI(void)  cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx,
+                                     CvGraphVtx* end_vtx );
+
+/** Find edge connecting two vertices */
+CVAPI(CvGraphEdge*)  cvFindGraphEdge( const CvGraph* graph, int start_idx, int end_idx );
+CVAPI(CvGraphEdge*)  cvFindGraphEdgeByPtr( const CvGraph* graph,
+                                           const CvGraphVtx* start_vtx,
+                                           const CvGraphVtx* end_vtx );
+#define cvGraphFindEdge cvFindGraphEdge
+#define cvGraphFindEdgeByPtr cvFindGraphEdgeByPtr
+
+/** Remove all vertices and edges from the graph */
+CVAPI(void)  cvClearGraph( CvGraph* graph );
+
+
+/** Count number of edges incident to the vertex */
+CVAPI(int)  cvGraphVtxDegree( const CvGraph* graph, int vtx_idx );
+CVAPI(int)  cvGraphVtxDegreeByPtr( const CvGraph* graph, const CvGraphVtx* vtx );
+
+
+/** Retrieves graph vertex by given index */
+#define cvGetGraphVtx( graph, idx ) (CvGraphVtx*)cvGetSetElem((CvSet*)(graph), (idx))
+
+/** Retrieves index of a graph vertex given its pointer */
+#define cvGraphVtxIdx( graph, vtx ) ((vtx)->flags & CV_SET_ELEM_IDX_MASK)
+
+/** Retrieves index of a graph edge given its pointer */
+#define cvGraphEdgeIdx( graph, edge ) ((edge)->flags & CV_SET_ELEM_IDX_MASK)
+
+#define cvGraphGetVtxCount( graph ) ((graph)->active_count)
+#define cvGraphGetEdgeCount( graph ) ((graph)->edges->active_count)
+
+#define  CV_GRAPH_VERTEX        1
+#define  CV_GRAPH_TREE_EDGE     2
+#define  CV_GRAPH_BACK_EDGE     4
+#define  CV_GRAPH_FORWARD_EDGE  8
+#define  CV_GRAPH_CROSS_EDGE    16
+#define  CV_GRAPH_ANY_EDGE      30
+#define  CV_GRAPH_NEW_TREE      32
+#define  CV_GRAPH_BACKTRACKING  64
+#define  CV_GRAPH_OVER          -1
+
+#define  CV_GRAPH_ALL_ITEMS    -1
+
+/** flags for graph vertices and edges */
+#define  CV_GRAPH_ITEM_VISITED_FLAG  (1 << 30)
+#define  CV_IS_GRAPH_VERTEX_VISITED(vtx) \
+    (((CvGraphVtx*)(vtx))->flags & CV_GRAPH_ITEM_VISITED_FLAG)
+#define  CV_IS_GRAPH_EDGE_VISITED(edge) \
+    (((CvGraphEdge*)(edge))->flags & CV_GRAPH_ITEM_VISITED_FLAG)
+#define  CV_GRAPH_SEARCH_TREE_NODE_FLAG   (1 << 29)
+#define  CV_GRAPH_FORWARD_EDGE_FLAG       (1 << 28)
+
+typedef struct CvGraphScanner
+{
+    CvGraphVtx* vtx;       /* current graph vertex (or current edge origin) */
+    CvGraphVtx* dst;       /* current graph edge destination vertex */
+    CvGraphEdge* edge;     /* current edge */
+
+    CvGraph* graph;        /* the graph */
+    CvSeq*   stack;        /* the graph vertex stack */
+    int      index;        /* the lower bound of certainly visited vertices */
+    int      mask;         /* event mask */
+}
+CvGraphScanner;
+
+/** Creates new graph scanner. */
+CVAPI(CvGraphScanner*)  cvCreateGraphScanner( CvGraph* graph,
+                                             CvGraphVtx* vtx CV_DEFAULT(NULL),
+                                             int mask CV_DEFAULT(CV_GRAPH_ALL_ITEMS));
+
+/** Releases graph scanner. */
+CVAPI(void) cvReleaseGraphScanner( CvGraphScanner** scanner );
+
+/** Get next graph element */
+CVAPI(int)  cvNextGraphItem( CvGraphScanner* scanner );
+
+/** Creates a copy of graph */
+CVAPI(CvGraph*) cvCloneGraph( const CvGraph* graph, CvMemStorage* storage );
+
+
+/** Does look-up transformation. Elements of the source array
+   (that should be 8uC1 or 8sC1) are used as indexes in lutarr 256-element table */
+CVAPI(void) cvLUT( const CvArr* src, CvArr* dst, const CvArr* lut );
+
+
+/******************* Iteration through the sequence tree *****************/
+typedef struct CvTreeNodeIterator
+{
+    const void* node;
+    int level;
+    int max_level;
+}
+CvTreeNodeIterator;
+
+CVAPI(void) cvInitTreeNodeIterator( CvTreeNodeIterator* tree_iterator,
+                                   const void* first, int max_level );
+CVAPI(void*) cvNextTreeNode( CvTreeNodeIterator* tree_iterator );
+CVAPI(void*) cvPrevTreeNode( CvTreeNodeIterator* tree_iterator );
+
+/** Inserts sequence into tree with specified "parent" sequence.
+   If parent is equal to frame (e.g. the most external contour),
+   then added contour will have null pointer to parent. */
+CVAPI(void) cvInsertNodeIntoTree( void* node, void* parent, void* frame );
+
+/** Removes contour from tree (together with the contour children). */
+CVAPI(void) cvRemoveNodeFromTree( void* node, void* frame );
+
+/** Gathers pointers to all the sequences,
+   accessible from the `first`, to the single sequence */
+CVAPI(CvSeq*) cvTreeToNodeSeq( const void* first, int header_size,
+                              CvMemStorage* storage );
+
+/** The function implements the K-means algorithm for clustering an array of sample
+   vectors in a specified number of classes */
+#define CV_KMEANS_USE_INITIAL_LABELS    1
+CVAPI(int) cvKMeans2( const CvArr* samples, int cluster_count, CvArr* labels,
+                      CvTermCriteria termcrit, int attempts CV_DEFAULT(1),
+                      CvRNG* rng CV_DEFAULT(0), int flags CV_DEFAULT(0),
+                      CvArr* _centers CV_DEFAULT(0), double* compactness CV_DEFAULT(0) );
+
+/****************************************************************************************\
+*                                    System functions                                    *
+\****************************************************************************************/
+
+/** Loads optimized functions from IPP, MKL etc. or switches back to pure C code */
+CVAPI(int)  cvUseOptimized( int on_off );
+
+typedef IplImage* (CV_STDCALL* Cv_iplCreateImageHeader)
+                            (int,int,int,char*,char*,int,int,int,int,int,
+                            IplROI*,IplImage*,void*,IplTileInfo*);
+typedef void (CV_STDCALL* Cv_iplAllocateImageData)(IplImage*,int,int);
+typedef void (CV_STDCALL* Cv_iplDeallocate)(IplImage*,int);
+typedef IplROI* (CV_STDCALL* Cv_iplCreateROI)(int,int,int,int,int);
+typedef IplImage* (CV_STDCALL* Cv_iplCloneImage)(const IplImage*);
+
+/** @brief Makes OpenCV use IPL functions for allocating IplImage and IplROI structures.
+
+Normally, the function is not called directly. Instead, a simple macro
+CV_TURN_ON_IPL_COMPATIBILITY() is used that calls cvSetIPLAllocators and passes there pointers
+to IPL allocation functions. :
+@code
+    ...
+    CV_TURN_ON_IPL_COMPATIBILITY()
+    ...
+@endcode
+@param create_header pointer to a function, creating IPL image header.
+@param allocate_data pointer to a function, allocating IPL image data.
+@param deallocate pointer to a function, deallocating IPL image.
+@param create_roi pointer to a function, creating IPL image ROI (i.e. Region of Interest).
+@param clone_image pointer to a function, cloning an IPL image.
+ */
+CVAPI(void) cvSetIPLAllocators( Cv_iplCreateImageHeader create_header,
+                               Cv_iplAllocateImageData allocate_data,
+                               Cv_iplDeallocate deallocate,
+                               Cv_iplCreateROI create_roi,
+                               Cv_iplCloneImage clone_image );
+
+#define CV_TURN_ON_IPL_COMPATIBILITY()                                  \
+    cvSetIPLAllocators( iplCreateImageHeader, iplAllocateImage,         \
+                        iplDeallocate, iplCreateROI, iplCloneImage )
+
+/****************************************************************************************\
+*                                    Data Persistence                                    *
+\****************************************************************************************/
+
+/********************************** High-level functions ********************************/
+
+/** @brief Opens file storage for reading or writing data.
+
+The function opens file storage for reading or writing data. In the latter case, a new file is
+created or an existing file is rewritten. The type of the read or written file is determined by the
+filename extension: .xml for XML and .yml or .yaml for YAML. The function returns a pointer to the
+CvFileStorage structure. If the file cannot be opened then the function returns NULL.
+@param filename Name of the file associated with the storage
+@param memstorage Memory storage used for temporary data and for
+:   storing dynamic structures, such as CvSeq or CvGraph . If it is NULL, a temporary memory
+    storage is created and used.
+@param flags Can be one of the following:
+> -   **CV_STORAGE_READ** the storage is open for reading
+> -   **CV_STORAGE_WRITE** the storage is open for writing
+@param encoding
+ */
+CVAPI(CvFileStorage*)  cvOpenFileStorage( const char* filename, CvMemStorage* memstorage,
+                                          int flags, const char* encoding CV_DEFAULT(NULL) );
+
+/** @brief Releases file storage.
+
+The function closes the file associated with the storage and releases all the temporary structures.
+It must be called after all I/O operations with the storage are finished.
+@param fs Double pointer to the released file storage
+ */
+CVAPI(void) cvReleaseFileStorage( CvFileStorage** fs );
+
+/** returns attribute value or 0 (NULL) if there is no such attribute */
+CVAPI(const char*) cvAttrValue( const CvAttrList* attr, const char* attr_name );
+
+/** @brief Starts writing a new structure.
+
+The function starts writing a compound structure (collection) that can be a sequence or a map. After
+all the structure fields, which can be scalars or structures, are written, cvEndWriteStruct should
+be called. The function can be used to group some objects or to implement the write function for a
+some user object (see CvTypeInfo).
+@param fs File storage
+@param name Name of the written structure. The structure can be accessed by this name when the
+storage is read.
+@param struct_flags A combination one of the following values:
+-   **CV_NODE_SEQ** the written structure is a sequence (see discussion of CvFileStorage ),
+    that is, its elements do not have a name.
+-   **CV_NODE_MAP** the written structure is a map (see discussion of CvFileStorage ), that
+    is, all its elements have names.
+One and only one of the two above flags must be specified
+-   **CV_NODE_FLOW** the optional flag that makes sense only for YAML streams. It means that
+     the structure is written as a flow (not as a block), which is more compact. It is
+     recommended to use this flag for structures or arrays whose elements are all scalars.
+@param type_name Optional parameter - the object type name. In
+    case of XML it is written as a type_id attribute of the structure opening tag. In the case of
+    YAML it is written after a colon following the structure name (see the example in
+    CvFileStorage description). Mainly it is used with user objects. When the storage is read, the
+    encoded type name is used to determine the object type (see CvTypeInfo and cvFindType ).
+@param attributes This parameter is not used in the current implementation
+ */
+CVAPI(void) cvStartWriteStruct( CvFileStorage* fs, const char* name,
+                                int struct_flags, const char* type_name CV_DEFAULT(NULL),
+                                CvAttrList attributes CV_DEFAULT(cvAttrList()));
+
+/** @brief Finishes writing to a file node collection.
+@param fs File storage
+@sa cvStartWriteStruct.
+ */
+CVAPI(void) cvEndWriteStruct( CvFileStorage* fs );
+
+/** @brief Writes an integer value.
+
+The function writes a single integer value (with or without a name) to the file storage.
+@param fs File storage
+@param name Name of the written value. Should be NULL if and only if the parent structure is a
+sequence.
+@param value The written value
+ */
+CVAPI(void) cvWriteInt( CvFileStorage* fs, const char* name, int value );
+
+/** @brief Writes a floating-point value.
+
+The function writes a single floating-point value (with or without a name) to file storage. Special
+values are encoded as follows: NaN (Not A Number) as .NaN, infinity as +.Inf or -.Inf.
+
+The following example shows how to use the low-level writing functions to store custom structures,
+such as termination criteria, without registering a new type. :
+@code
+    void write_termcriteria( CvFileStorage* fs, const char* struct_name,
+                             CvTermCriteria* termcrit )
+    {
+        cvStartWriteStruct( fs, struct_name, CV_NODE_MAP, NULL, cvAttrList(0,0));
+        cvWriteComment( fs, "termination criteria", 1 ); // just a description
+        if( termcrit->type & CV_TERMCRIT_ITER )
+            cvWriteInteger( fs, "max_iterations", termcrit->max_iter );
+        if( termcrit->type & CV_TERMCRIT_EPS )
+            cvWriteReal( fs, "accuracy", termcrit->epsilon );
+        cvEndWriteStruct( fs );
+    }
+@endcode
+@param fs File storage
+@param name Name of the written value. Should be NULL if and only if the parent structure is a
+sequence.
+@param value The written value
+*/
+CVAPI(void) cvWriteReal( CvFileStorage* fs, const char* name, double value );
+
+/** @brief Writes a text string.
+
+The function writes a text string to file storage.
+@param fs File storage
+@param name Name of the written string . Should be NULL if and only if the parent structure is a
+sequence.
+@param str The written text string
+@param quote If non-zero, the written string is put in quotes, regardless of whether they are
+required. Otherwise, if the flag is zero, quotes are used only when they are required (e.g. when
+the string starts with a digit or contains spaces).
+ */
+CVAPI(void) cvWriteString( CvFileStorage* fs, const char* name,
+                           const char* str, int quote CV_DEFAULT(0) );
+
+/** @brief Writes a comment.
+
+The function writes a comment into file storage. The comments are skipped when the storage is read.
+@param fs File storage
+@param comment The written comment, single-line or multi-line
+@param eol_comment If non-zero, the function tries to put the comment at the end of current line.
+If the flag is zero, if the comment is multi-line, or if it does not fit at the end of the current
+line, the comment starts a new line.
+ */
+CVAPI(void) cvWriteComment( CvFileStorage* fs, const char* comment,
+                            int eol_comment );
+
+/** @brief Writes an object to file storage.
+
+The function writes an object to file storage. First, the appropriate type info is found using
+cvTypeOf. Then, the write method associated with the type info is called.
+
+Attributes are used to customize the writing procedure. The standard types support the following
+attributes (all the dt attributes have the same format as in cvWriteRawData):
+
+-# CvSeq
+    -   **header_dt** description of user fields of the sequence header that follow CvSeq, or
+        CvChain (if the sequence is a Freeman chain) or CvContour (if the sequence is a contour or
+        point sequence)
+    -   **dt** description of the sequence elements.
+    -   **recursive** if the attribute is present and is not equal to "0" or "false", the whole
+        tree of sequences (contours) is stored.
+-# CvGraph
+    -   **header_dt** description of user fields of the graph header that follows CvGraph;
+    -   **vertex_dt** description of user fields of graph vertices
+    -   **edge_dt** description of user fields of graph edges (note that the edge weight is
+        always written, so there is no need to specify it explicitly)
+
+Below is the code that creates the YAML file shown in the CvFileStorage description:
+@code
+    #include "cxcore.h"
+
+    int main( int argc, char** argv )
+    {
+        CvMat* mat = cvCreateMat( 3, 3, CV_32F );
+        CvFileStorage* fs = cvOpenFileStorage( "example.yml", 0, CV_STORAGE_WRITE );
+
+        cvSetIdentity( mat );
+        cvWrite( fs, "A", mat, cvAttrList(0,0) );
+
+        cvReleaseFileStorage( &fs );
+        cvReleaseMat( &mat );
+        return 0;
+    }
+@endcode
+@param fs File storage
+@param name Name of the written object. Should be NULL if and only if the parent structure is a
+sequence.
+@param ptr Pointer to the object
+@param attributes The attributes of the object. They are specific for each particular type (see
+the discussion below).
+ */
+CVAPI(void) cvWrite( CvFileStorage* fs, const char* name, const void* ptr,
+                         CvAttrList attributes CV_DEFAULT(cvAttrList()));
+
+/** @brief Starts the next stream.
+
+The function finishes the currently written stream and starts the next stream. In the case of XML
+the file with multiple streams looks like this:
+@code{.xml}
+    <opencv_storage>
+    <!-- stream #1 data -->
+    </opencv_storage>
+    <opencv_storage>
+    <!-- stream #2 data -->
+    </opencv_storage>
+    ...
+@endcode
+The YAML file will look like this:
+@code{.yaml}
+    %YAML:1.0
+    # stream #1 data
+    ...
+    ---
+    # stream #2 data
+@endcode
+This is useful for concatenating files or for resuming the writing process.
+@param fs File storage
+ */
+CVAPI(void) cvStartNextStream( CvFileStorage* fs );
+
+/** @brief Writes multiple numbers.
+
+The function writes an array, whose elements consist of single or multiple numbers. The function
+call can be replaced with a loop containing a few cvWriteInt and cvWriteReal calls, but a single
+call is more efficient. Note that because none of the elements have a name, they should be written
+to a sequence rather than a map.
+@param fs File storage
+@param src Pointer to the written array
+@param len Number of the array elements to write
+@param dt Specification of each array element, see @ref format_spec "format specification"
+ */
+CVAPI(void) cvWriteRawData( CvFileStorage* fs, const void* src,
+                                int len, const char* dt );
+
+/** @brief Returns a unique pointer for a given name.
+
+The function returns a unique pointer for each particular file node name. This pointer can be then
+passed to the cvGetFileNode function that is faster than cvGetFileNodeByName because it compares
+text strings by comparing pointers rather than the strings' content.
+
+Consider the following example where an array of points is encoded as a sequence of 2-entry maps:
+@code
+    points:
+      - { x: 10, y: 10 }
+      - { x: 20, y: 20 }
+      - { x: 30, y: 30 }
+      # ...
+@endcode
+Then, it is possible to get hashed "x" and "y" pointers to speed up decoding of the points. :
+@code
+    #include "cxcore.h"
+
+    int main( int argc, char** argv )
+    {
+        CvFileStorage* fs = cvOpenFileStorage( "points.yml", 0, CV_STORAGE_READ );
+        CvStringHashNode* x_key = cvGetHashedNode( fs, "x", -1, 1 );
+        CvStringHashNode* y_key = cvGetHashedNode( fs, "y", -1, 1 );
+        CvFileNode* points = cvGetFileNodeByName( fs, 0, "points" );
+
+        if( CV_NODE_IS_SEQ(points->tag) )
+        {
+            CvSeq* seq = points->data.seq;
+            int i, total = seq->total;
+            CvSeqReader reader;
+            cvStartReadSeq( seq, &reader, 0 );
+            for( i = 0; i < total; i++ )
+            {
+                CvFileNode* pt = (CvFileNode*)reader.ptr;
+    #if 1 // faster variant
+                CvFileNode* xnode = cvGetFileNode( fs, pt, x_key, 0 );
+                CvFileNode* ynode = cvGetFileNode( fs, pt, y_key, 0 );
+                assert( xnode && CV_NODE_IS_INT(xnode->tag) &&
+                        ynode && CV_NODE_IS_INT(ynode->tag));
+                int x = xnode->data.i; // or x = cvReadInt( xnode, 0 );
+                int y = ynode->data.i; // or y = cvReadInt( ynode, 0 );
+    #elif 1 // slower variant; does not use x_key & y_key
+                CvFileNode* xnode = cvGetFileNodeByName( fs, pt, "x" );
+                CvFileNode* ynode = cvGetFileNodeByName( fs, pt, "y" );
+                assert( xnode && CV_NODE_IS_INT(xnode->tag) &&
+                        ynode && CV_NODE_IS_INT(ynode->tag));
+                int x = xnode->data.i; // or x = cvReadInt( xnode, 0 );
+                int y = ynode->data.i; // or y = cvReadInt( ynode, 0 );
+    #else // the slowest yet the easiest to use variant
+                int x = cvReadIntByName( fs, pt, "x", 0 );
+                int y = cvReadIntByName( fs, pt, "y", 0 );
+    #endif
+                CV_NEXT_SEQ_ELEM( seq->elem_size, reader );
+                printf("
+            }
+        }
+        cvReleaseFileStorage( &fs );
+        return 0;
+    }
+@endcode
+Please note that whatever method of accessing a map you are using, it is still much slower than
+using plain sequences; for example, in the above example, it is more efficient to encode the points
+as pairs of integers in a single numeric sequence.
+@param fs File storage
+@param name Literal node name
+@param len Length of the name (if it is known apriori), or -1 if it needs to be calculated
+@param create_missing Flag that specifies, whether an absent key should be added into the hash table
+*/
+CVAPI(CvStringHashNode*) cvGetHashedKey( CvFileStorage* fs, const char* name,
+                                        int len CV_DEFAULT(-1),
+                                        int create_missing CV_DEFAULT(0));
+
+/** @brief Retrieves one of the top-level nodes of the file storage.
+
+The function returns one of the top-level file nodes. The top-level nodes do not have a name, they
+correspond to the streams that are stored one after another in the file storage. If the index is out
+of range, the function returns a NULL pointer, so all the top-level nodes can be iterated by
+subsequent calls to the function with stream_index=0,1,..., until the NULL pointer is returned.
+This function can be used as a base for recursive traversal of the file storage.
+@param fs File storage
+@param stream_index Zero-based index of the stream. See cvStartNextStream . In most cases,
+there is only one stream in the file; however, there can be several.
+ */
+CVAPI(CvFileNode*) cvGetRootFileNode( const CvFileStorage* fs,
+                                     int stream_index CV_DEFAULT(0) );
+
+/** @brief Finds a node in a map or file storage.
+
+The function finds a file node. It is a faster version of cvGetFileNodeByName (see
+cvGetHashedKey discussion). Also, the function can insert a new node, if it is not in the map yet.
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node. If both map and
+key are NULLs, the function returns the root file node - a map that contains top-level nodes.
+@param key Unique pointer to the node name, retrieved with cvGetHashedKey
+@param create_missing Flag that specifies whether an absent node should be added to the map
+ */
+CVAPI(CvFileNode*) cvGetFileNode( CvFileStorage* fs, CvFileNode* map,
+                                 const CvStringHashNode* key,
+                                 int create_missing CV_DEFAULT(0) );
+
+/** @brief Finds a node in a map or file storage.
+
+The function finds a file node by name. The node is searched either in map or, if the pointer is
+NULL, among the top-level file storage nodes. Using this function for maps and cvGetSeqElem (or
+sequence reader) for sequences, it is possible to navigate through the file storage. To speed up
+multiple queries for a certain key (e.g., in the case of an array of structures) one may use a
+combination of cvGetHashedKey and cvGetFileNode.
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches in all the top-level nodes
+(streams), starting with the first one.
+@param name The file node name
+ */
+CVAPI(CvFileNode*) cvGetFileNodeByName( const CvFileStorage* fs,
+                                       const CvFileNode* map,
+                                       const char* name );
+
+/** @brief Retrieves an integer value from a file node.
+
+The function returns an integer that is represented by the file node. If the file node is NULL, the
+default_value is returned (thus, it is convenient to call the function right after cvGetFileNode
+without checking for a NULL pointer). If the file node has type CV_NODE_INT, then node-\>data.i is
+returned. If the file node has type CV_NODE_REAL, then node-\>data.f is converted to an integer
+and returned. Otherwise the error is reported.
+@param node File node
+@param default_value The value that is returned if node is NULL
+ */
+CV_INLINE int cvReadInt( const CvFileNode* node, int default_value CV_DEFAULT(0) )
+{
+    return !node ? default_value :
+        CV_NODE_IS_INT(node->tag) ? node->data.i :
+        CV_NODE_IS_REAL(node->tag) ? cvRound(node->data.f) : 0x7fffffff;
+}
+
+/** @brief Finds a file node and returns its value.
+
+The function is a simple superposition of cvGetFileNodeByName and cvReadInt.
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node.
+@param name The node name
+@param default_value The value that is returned if the file node is not found
+ */
+CV_INLINE int cvReadIntByName( const CvFileStorage* fs, const CvFileNode* map,
+                         const char* name, int default_value CV_DEFAULT(0) )
+{
+    return cvReadInt( cvGetFileNodeByName( fs, map, name ), default_value );
+}
+
+/** @brief Retrieves a floating-point value from a file node.
+
+The function returns a floating-point value that is represented by the file node. If the file node
+is NULL, the default_value is returned (thus, it is convenient to call the function right after
+cvGetFileNode without checking for a NULL pointer). If the file node has type CV_NODE_REAL ,
+then node-\>data.f is returned. If the file node has type CV_NODE_INT , then node-:math:\>data.f
+is converted to floating-point and returned. Otherwise the result is not determined.
+@param node File node
+@param default_value The value that is returned if node is NULL
+ */
+CV_INLINE double cvReadReal( const CvFileNode* node, double default_value CV_DEFAULT(0.) )
+{
+    return !node ? default_value :
+        CV_NODE_IS_INT(node->tag) ? (double)node->data.i :
+        CV_NODE_IS_REAL(node->tag) ? node->data.f : 1e300;
+}
+
+/** @brief Finds a file node and returns its value.
+
+The function is a simple superposition of cvGetFileNodeByName and cvReadReal .
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node.
+@param name The node name
+@param default_value The value that is returned if the file node is not found
+ */
+CV_INLINE double cvReadRealByName( const CvFileStorage* fs, const CvFileNode* map,
+                        const char* name, double default_value CV_DEFAULT(0.) )
+{
+    return cvReadReal( cvGetFileNodeByName( fs, map, name ), default_value );
+}
+
+/** @brief Retrieves a text string from a file node.
+
+The function returns a text string that is represented by the file node. If the file node is NULL,
+the default_value is returned (thus, it is convenient to call the function right after
+cvGetFileNode without checking for a NULL pointer). If the file node has type CV_NODE_STR , then
+node-:math:\>data.str.ptr is returned. Otherwise the result is not determined.
+@param node File node
+@param default_value The value that is returned if node is NULL
+ */
+CV_INLINE const char* cvReadString( const CvFileNode* node,
+                        const char* default_value CV_DEFAULT(NULL) )
+{
+    return !node ? default_value : CV_NODE_IS_STRING(node->tag) ? node->data.str.ptr : 0;
+}
+
+/** @brief Finds a file node by its name and returns its value.
+
+The function is a simple superposition of cvGetFileNodeByName and cvReadString .
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node.
+@param name The node name
+@param default_value The value that is returned if the file node is not found
+ */
+CV_INLINE const char* cvReadStringByName( const CvFileStorage* fs, const CvFileNode* map,
+                        const char* name, const char* default_value CV_DEFAULT(NULL) )
+{
+    return cvReadString( cvGetFileNodeByName( fs, map, name ), default_value );
+}
+
+
+/** @brief Decodes an object and returns a pointer to it.
+
+The function decodes a user object (creates an object in a native representation from the file
+storage subtree) and returns it. The object to be decoded must be an instance of a registered type
+that supports the read method (see CvTypeInfo). The type of the object is determined by the type
+name that is encoded in the file. If the object is a dynamic structure, it is created either in
+memory storage and passed to cvOpenFileStorage or, if a NULL pointer was passed, in temporary
+memory storage, which is released when cvReleaseFileStorage is called. Otherwise, if the object is
+not a dynamic structure, it is created in a heap and should be released with a specialized function
+or by using the generic cvRelease.
+@param fs File storage
+@param node The root object node
+@param attributes Unused parameter
+ */
+CVAPI(void*) cvRead( CvFileStorage* fs, CvFileNode* node,
+                        CvAttrList* attributes CV_DEFAULT(NULL));
+
+/** @brief Finds an object by name and decodes it.
+
+The function is a simple superposition of cvGetFileNodeByName and cvRead.
+@param fs File storage
+@param map The parent map. If it is NULL, the function searches a top-level node.
+@param name The node name
+@param attributes Unused parameter
+ */
+CV_INLINE void* cvReadByName( CvFileStorage* fs, const CvFileNode* map,
+                              const char* name, CvAttrList* attributes CV_DEFAULT(NULL) )
+{
+    return cvRead( fs, cvGetFileNodeByName( fs, map, name ), attributes );
+}
+
+
+/** @brief Initializes the file node sequence reader.
+
+The function initializes the sequence reader to read data from a file node. The initialized reader
+can be then passed to cvReadRawDataSlice.
+@param fs File storage
+@param src The file node (a sequence) to read numbers from
+@param reader Pointer to the sequence reader
+ */
+CVAPI(void) cvStartReadRawData( const CvFileStorage* fs, const CvFileNode* src,
+                               CvSeqReader* reader );
+
+/** @brief Initializes file node sequence reader.
+
+The function reads one or more elements from the file node, representing a sequence, to a
+user-specified array. The total number of read sequence elements is a product of total and the
+number of components in each array element. For example, if dt=2if, the function will read total\*3
+sequence elements. As with any sequence, some parts of the file node sequence can be skipped or read
+repeatedly by repositioning the reader using cvSetSeqReaderPos.
+@param fs File storage
+@param reader The sequence reader. Initialize it with cvStartReadRawData .
+@param count The number of elements to read
+@param dst Pointer to the destination array
+@param dt Specification of each array element. It has the same format as in cvWriteRawData .
+ */
+CVAPI(void) cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader,
+                               int count, void* dst, const char* dt );
+
+/** @brief Reads multiple numbers.
+
+The function reads elements from a file node that represents a sequence of scalars.
+@param fs File storage
+@param src The file node (a sequence) to read numbers from
+@param dst Pointer to the destination array
+@param dt Specification of each array element. It has the same format as in cvWriteRawData .
+ */
+CVAPI(void) cvReadRawData( const CvFileStorage* fs, const CvFileNode* src,
+                          void* dst, const char* dt );
+
+/** @brief Writes a file node to another file storage.
+
+The function writes a copy of a file node to file storage. Possible applications of the function are
+merging several file storages into one and conversion between XML and YAML formats.
+@param fs Destination file storage
+@param new_node_name New name of the file node in the destination file storage. To keep the
+existing name, use cvcvGetFileNodeName
+@param node The written node
+@param embed If the written node is a collection and this parameter is not zero, no extra level of
+hierarchy is created. Instead, all the elements of node are written into the currently written
+structure. Of course, map elements can only be embedded into another map, and sequence elements
+can only be embedded into another sequence.
+ */
+CVAPI(void) cvWriteFileNode( CvFileStorage* fs, const char* new_node_name,
+                            const CvFileNode* node, int embed );
+
+/** @brief Returns the name of a file node.
+
+The function returns the name of a file node or NULL, if the file node does not have a name or if
+node is NULL.
+@param node File node
+ */
+CVAPI(const char*) cvGetFileNodeName( const CvFileNode* node );
+
+/*********************************** Adding own types ***********************************/
+
+/** @brief Registers a new type.
+
+The function registers a new type, which is described by info . The function creates a copy of the
+structure, so the user should delete it after calling the function.
+@param info Type info structure
+ */
+CVAPI(void) cvRegisterType( const CvTypeInfo* info );
+
+/** @brief Unregisters the type.
+
+The function unregisters a type with a specified name. If the name is unknown, it is possible to
+locate the type info by an instance of the type using cvTypeOf or by iterating the type list,
+starting from cvFirstType, and then calling cvUnregisterType(info-\>typeName).
+@param type_name Name of an unregistered type
+ */
+CVAPI(void) cvUnregisterType( const char* type_name );
+
+/** @brief Returns the beginning of a type list.
+
+The function returns the first type in the list of registered types. Navigation through the list can
+be done via the prev and next fields of the CvTypeInfo structure.
+ */
+CVAPI(CvTypeInfo*) cvFirstType(void);
+
+/** @brief Finds a type by its name.
+
+The function finds a registered type by its name. It returns NULL if there is no type with the
+specified name.
+@param type_name Type name
+ */
+CVAPI(CvTypeInfo*) cvFindType( const char* type_name );
+
+/** @brief Returns the type of an object.
+
+The function finds the type of a given object. It iterates through the list of registered types and
+calls the is_instance function/method for every type info structure with that object until one of
+them returns non-zero or until the whole list has been traversed. In the latter case, the function
+returns NULL.
+@param struct_ptr The object pointer
+ */
+CVAPI(CvTypeInfo*) cvTypeOf( const void* struct_ptr );
+
+/** @brief Releases an object.
+
+The function finds the type of a given object and calls release with the double pointer.
+@param struct_ptr Double pointer to the object
+ */
+CVAPI(void) cvRelease( void** struct_ptr );
+
+/** @brief Makes a clone of an object.
+
+The function finds the type of a given object and calls clone with the passed object. Of course, if
+you know the object type, for example, struct_ptr is CvMat\*, it is faster to call the specific
+function, like cvCloneMat.
+@param struct_ptr The object to clone
+ */
+CVAPI(void*) cvClone( const void* struct_ptr );
+
+/** @brief Saves an object to a file.
+
+The function saves an object to a file. It provides a simple interface to cvWrite .
+@param filename File name
+@param struct_ptr Object to save
+@param name Optional object name. If it is NULL, the name will be formed from filename .
+@param comment Optional comment to put in the beginning of the file
+@param attributes Optional attributes passed to cvWrite
+ */
+CVAPI(void) cvSave( const char* filename, const void* struct_ptr,
+                    const char* name CV_DEFAULT(NULL),
+                    const char* comment CV_DEFAULT(NULL),
+                    CvAttrList attributes CV_DEFAULT(cvAttrList()));
+
+/** @brief Loads an object from a file.
+
+The function loads an object from a file. It basically reads the specified file, find the first
+top-level node and calls cvRead for that node. If the file node does not have type information or
+the type information can not be found by the type name, the function returns NULL. After the object
+is loaded, the file storage is closed and all the temporary buffers are deleted. Thus, to load a
+dynamic structure, such as a sequence, contour, or graph, one should pass a valid memory storage
+destination to the function.
+@param filename File name
+@param memstorage Memory storage for dynamic structures, such as CvSeq or CvGraph . It is not used
+for matrices or images.
+@param name Optional object name. If it is NULL, the first top-level object in the storage will be
+loaded.
+@param real_name Optional output parameter that will contain the name of the loaded object
+(useful if name=NULL )
+ */
+CVAPI(void*) cvLoad( const char* filename,
+                     CvMemStorage* memstorage CV_DEFAULT(NULL),
+                     const char* name CV_DEFAULT(NULL),
+                     const char** real_name CV_DEFAULT(NULL) );
+
+/*********************************** Measuring Execution Time ***************************/
+
+/** helper functions for RNG initialization and accurate time measurement:
+   uses internal clock counter on x86 */
+CVAPI(int64)  cvGetTickCount( void );
+CVAPI(double) cvGetTickFrequency( void );
+
+/*********************************** CPU capabilities ***********************************/
+
+CVAPI(int) cvCheckHardwareSupport(int feature);
+
+/*********************************** Multi-Threading ************************************/
+
+/** retrieve/set the number of threads used in OpenMP implementations */
+CVAPI(int)  cvGetNumThreads( void );
+CVAPI(void) cvSetNumThreads( int threads CV_DEFAULT(0) );
+/** get index of the thread being executed */
+CVAPI(int)  cvGetThreadNum( void );
+
+
+/********************************** Error Handling **************************************/
+
+/** Get current OpenCV error status */
+CVAPI(int) cvGetErrStatus( void );
+
+/** Sets error status silently */
+CVAPI(void) cvSetErrStatus( int status );
+
+#define CV_ErrModeLeaf     0   /* Print error and exit program */
+#define CV_ErrModeParent   1   /* Print error and continue */
+#define CV_ErrModeSilent   2   /* Don't print and continue */
+
+/** Retrives current error processing mode */
+CVAPI(int)  cvGetErrMode( void );
+
+/** Sets error processing mode, returns previously used mode */
+CVAPI(int) cvSetErrMode( int mode );
+
+/** Sets error status and performs some additonal actions (displaying message box,
+ writing message to stderr, terminating application etc.)
+ depending on the current error mode */
+CVAPI(void) cvError( int status, const char* func_name,
+                    const char* err_msg, const char* file_name, int line );
+
+/** Retrieves textual description of the error given its code */
+CVAPI(const char*) cvErrorStr( int status );
+
+/** Retrieves detailed information about the last error occured */
+CVAPI(int) cvGetErrInfo( const char** errcode_desc, const char** description,
+                        const char** filename, int* line );
+
+/** Maps IPP error codes to the counterparts from OpenCV */
+CVAPI(int) cvErrorFromIppStatus( int ipp_status );
+
+typedef int (CV_CDECL *CvErrorCallback)( int status, const char* func_name,
+                                        const char* err_msg, const char* file_name, int line, void* userdata );
+
+/** Assigns a new error-handling function */
+CVAPI(CvErrorCallback) cvRedirectError( CvErrorCallback error_handler,
+                                       void* userdata CV_DEFAULT(NULL),
+                                       void** prev_userdata CV_DEFAULT(NULL) );
+
+/** Output nothing */
+CVAPI(int) cvNulDevReport( int status, const char* func_name, const char* err_msg,
+                          const char* file_name, int line, void* userdata );
+
+/** Output to console(fprintf(stderr,...)) */
+CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_msg,
+                          const char* file_name, int line, void* userdata );
+
+/** Output to MessageBox(WIN32) */
+CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg,
+                          const char* file_name, int line, void* userdata );
+
+#define OPENCV_ERROR(status,func,context)                           \
+cvError((status),(func),(context),__FILE__,__LINE__)
+
+#define OPENCV_ASSERT(expr,func,context)                            \
+{if (! (expr))                                      \
+{OPENCV_ERROR(CV_StsInternal,(func),(context));}}
+
+#define OPENCV_CALL( Func )                                         \
+{                                                                   \
+Func;                                                           \
+}
+
+
+/** CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
+#ifdef CV_NO_FUNC_NAMES
+#define CV_FUNCNAME( Name )
+#define cvFuncName ""
+#else
+#define CV_FUNCNAME( Name )  \
+static char cvFuncName[] = Name
+#endif
+
+
+/**
+ CV_ERROR macro unconditionally raises error with passed code and message.
+ After raising error, control will be transferred to the exit label.
+ */
+#define CV_ERROR( Code, Msg )                                       \
+{                                                                   \
+    cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ );        \
+    __CV_EXIT__;                                                   \
+}
+
+/**
+ CV_CHECK macro checks error status after CV (or IPL)
+ function call. If error detected, control will be transferred to the exit
+ label.
+ */
+#define CV_CHECK()                                                  \
+{                                                                   \
+    if( cvGetErrStatus() < 0 )                                      \
+        CV_ERROR( CV_StsBackTrace, "Inner function failed." );      \
+}
+
+
+/**
+ CV_CALL macro calls CV (or IPL) function, checks error status and
+ signals a error if the function failed. Useful in "parent node"
+ error procesing mode
+ */
+#define CV_CALL( Func )                                             \
+{                                                                   \
+    Func;                                                           \
+    CV_CHECK();                                                     \
+}
+
+
+/** Runtime assertion macro */
+#define CV_ASSERT( Condition )                                          \
+{                                                                       \
+    if( !(Condition) )                                                  \
+        CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \
+}
+
+#define __CV_BEGIN__       {
+#define __CV_END__         goto exit; exit: ; }
+#define __CV_EXIT__        goto exit
+
+/** @} core_c */
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#ifdef __cplusplus
+
+//! @addtogroup core_c_glue
+//! @{
+
+//! class for automatic module/RTTI data registration/unregistration
+struct CV_EXPORTS CvType
+{
+    CvType( const char* type_name,
+            CvIsInstanceFunc is_instance, CvReleaseFunc release=0,
+            CvReadFunc read=0, CvWriteFunc write=0, CvCloneFunc clone=0 );
+    ~CvType();
+    CvTypeInfo* info;
+
+    static CvTypeInfo* first;
+    static CvTypeInfo* last;
+};
+
+//! @}
+
+#include "opencv2/core/utility.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_c_glue
+//! @{
+
+/////////////////////////////////////////// glue ///////////////////////////////////////////
+
+//! converts array (CvMat or IplImage) to cv::Mat
+CV_EXPORTS Mat cvarrToMat(const CvArr* arr, bool copyData=false,
+                          bool allowND=true, int coiMode=0,
+                          AutoBuffer<double>* buf=0);
+
+static inline Mat cvarrToMatND(const CvArr* arr, bool copyData=false, int coiMode=0)
+{
+    return cvarrToMat(arr, copyData, true, coiMode);
+}
+
+
+//! extracts Channel of Interest from CvMat or IplImage and makes cv::Mat out of it.
+CV_EXPORTS void extractImageCOI(const CvArr* arr, OutputArray coiimg, int coi=-1);
+//! inserts single-channel cv::Mat into a multi-channel CvMat or IplImage
+CV_EXPORTS void insertImageCOI(InputArray coiimg, CvArr* arr, int coi=-1);
+
+
+
+////// specialized implementations of DefaultDeleter::operator() for classic OpenCV types //////
+
+template<> CV_EXPORTS void DefaultDeleter<CvMat>::operator ()(CvMat* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<IplImage>::operator ()(IplImage* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<CvMatND>::operator ()(CvMatND* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<CvSparseMat>::operator ()(CvSparseMat* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<CvMemStorage>::operator ()(CvMemStorage* obj) const;
+
+////////////// convenient wrappers for operating old-style dynamic structures //////////////
+
+template<typename _Tp> class SeqIterator;
+
+typedef Ptr<CvMemStorage> MemStorage;
+
+/*!
+ Template Sequence Class derived from CvSeq
+
+ The class provides more convenient access to sequence elements,
+ STL-style operations and iterators.
+
+ \note The class is targeted for simple data types,
+    i.e. no constructors or destructors
+    are called for the sequence elements.
+*/
+template<typename _Tp> class Seq
+{
+public:
+    typedef SeqIterator<_Tp> iterator;
+    typedef SeqIterator<_Tp> const_iterator;
+
+    //! the default constructor
+    Seq();
+    //! the constructor for wrapping CvSeq structure. The real element type in CvSeq should match _Tp.
+    Seq(const CvSeq* seq);
+    //! creates the empty sequence that resides in the specified storage
+    Seq(MemStorage& storage, int headerSize = sizeof(CvSeq));
+    //! returns read-write reference to the specified element
+    _Tp& operator [](int idx);
+    //! returns read-only reference to the specified element
+    const _Tp& operator[](int idx) const;
+    //! returns iterator pointing to the beginning of the sequence
+    SeqIterator<_Tp> begin() const;
+    //! returns iterator pointing to the element following the last sequence element
+    SeqIterator<_Tp> end() const;
+    //! returns the number of elements in the sequence
+    size_t size() const;
+    //! returns the type of sequence elements (CV_8UC1 ... CV_64FC(CV_CN_MAX) ...)
+    int type() const;
+    //! returns the depth of sequence elements (CV_8U ... CV_64F)
+    int depth() const;
+    //! returns the number of channels in each sequence element
+    int channels() const;
+    //! returns the size of each sequence element
+    size_t elemSize() const;
+    //! returns index of the specified sequence element
+    size_t index(const _Tp& elem) const;
+    //! appends the specified element to the end of the sequence
+    void push_back(const _Tp& elem);
+    //! appends the specified element to the front of the sequence
+    void push_front(const _Tp& elem);
+    //! appends zero or more elements to the end of the sequence
+    void push_back(const _Tp* elems, size_t count);
+    //! appends zero or more elements to the front of the sequence
+    void push_front(const _Tp* elems, size_t count);
+    //! inserts the specified element to the specified position
+    void insert(int idx, const _Tp& elem);
+    //! inserts zero or more elements to the specified position
+    void insert(int idx, const _Tp* elems, size_t count);
+    //! removes element at the specified position
+    void remove(int idx);
+    //! removes the specified subsequence
+    void remove(const Range& r);
+
+    //! returns reference to the first sequence element
+    _Tp& front();
+    //! returns read-only reference to the first sequence element
+    const _Tp& front() const;
+    //! returns reference to the last sequence element
+    _Tp& back();
+    //! returns read-only reference to the last sequence element
+    const _Tp& back() const;
+    //! returns true iff the sequence contains no elements
+    bool empty() const;
+
+    //! removes all the elements from the sequence
+    void clear();
+    //! removes the first element from the sequence
+    void pop_front();
+    //! removes the last element from the sequence
+    void pop_back();
+    //! removes zero or more elements from the beginning of the sequence
+    void pop_front(_Tp* elems, size_t count);
+    //! removes zero or more elements from the end of the sequence
+    void pop_back(_Tp* elems, size_t count);
+
+    //! copies the whole sequence or the sequence slice to the specified vector
+    void copyTo(std::vector<_Tp>& vec, const Range& range=Range::all()) const;
+    //! returns the vector containing all the sequence elements
+    operator std::vector<_Tp>() const;
+
+    CvSeq* seq;
+};
+
+
+/*!
+ STL-style Sequence Iterator inherited from the CvSeqReader structure
+*/
+template<typename _Tp> class SeqIterator : public CvSeqReader
+{
+public:
+    //! the default constructor
+    SeqIterator();
+    //! the constructor setting the iterator to the beginning or to the end of the sequence
+    SeqIterator(const Seq<_Tp>& seq, bool seekEnd=false);
+    //! positions the iterator within the sequence
+    void seek(size_t pos);
+    //! reports the current iterator position
+    size_t tell() const;
+    //! returns reference to the current sequence element
+    _Tp& operator *();
+    //! returns read-only reference to the current sequence element
+    const _Tp& operator *() const;
+    //! moves iterator to the next sequence element
+    SeqIterator& operator ++();
+    //! moves iterator to the next sequence element
+    SeqIterator operator ++(int) const;
+    //! moves iterator to the previous sequence element
+    SeqIterator& operator --();
+    //! moves iterator to the previous sequence element
+    SeqIterator operator --(int) const;
+
+    //! moves iterator forward by the specified offset (possibly negative)
+    SeqIterator& operator +=(int);
+    //! moves iterator backward by the specified offset (possibly negative)
+    SeqIterator& operator -=(int);
+
+    // this is index of the current element module seq->total*2
+    // (to distinguish between 0 and seq->total)
+    int index;
+};
+
+
+
+// bridge C++ => C Seq API
+CV_EXPORTS schar*  seqPush( CvSeq* seq, const void* element=0);
+CV_EXPORTS schar*  seqPushFront( CvSeq* seq, const void* element=0);
+CV_EXPORTS void  seqPop( CvSeq* seq, void* element=0);
+CV_EXPORTS void  seqPopFront( CvSeq* seq, void* element=0);
+CV_EXPORTS void  seqPopMulti( CvSeq* seq, void* elements,
+                              int count, int in_front=0 );
+CV_EXPORTS void  seqRemove( CvSeq* seq, int index );
+CV_EXPORTS void  clearSeq( CvSeq* seq );
+CV_EXPORTS schar*  getSeqElem( const CvSeq* seq, int index );
+CV_EXPORTS void  seqRemoveSlice( CvSeq* seq, CvSlice slice );
+CV_EXPORTS void  seqInsertSlice( CvSeq* seq, int before_index, const CvArr* from_arr );
+
+template<typename _Tp> inline Seq<_Tp>::Seq() : seq(0) {}
+template<typename _Tp> inline Seq<_Tp>::Seq( const CvSeq* _seq ) : seq((CvSeq*)_seq)
+{
+    CV_Assert(!_seq || _seq->elem_size == sizeof(_Tp));
+}
+
+template<typename _Tp> inline Seq<_Tp>::Seq( MemStorage& storage,
+                                             int headerSize )
+{
+    CV_Assert(headerSize >= (int)sizeof(CvSeq));
+    seq = cvCreateSeq(DataType<_Tp>::type, headerSize, sizeof(_Tp), storage);
+}
+
+template<typename _Tp> inline _Tp& Seq<_Tp>::operator [](int idx)
+{ return *(_Tp*)getSeqElem(seq, idx); }
+
+template<typename _Tp> inline const _Tp& Seq<_Tp>::operator [](int idx) const
+{ return *(_Tp*)getSeqElem(seq, idx); }
+
+template<typename _Tp> inline SeqIterator<_Tp> Seq<_Tp>::begin() const
+{ return SeqIterator<_Tp>(*this); }
+
+template<typename _Tp> inline SeqIterator<_Tp> Seq<_Tp>::end() const
+{ return SeqIterator<_Tp>(*this, true); }
+
+template<typename _Tp> inline size_t Seq<_Tp>::size() const
+{ return seq ? seq->total : 0; }
+
+template<typename _Tp> inline int Seq<_Tp>::type() const
+{ return seq ? CV_MAT_TYPE(seq->flags) : 0; }
+
+template<typename _Tp> inline int Seq<_Tp>::depth() const
+{ return seq ? CV_MAT_DEPTH(seq->flags) : 0; }
+
+template<typename _Tp> inline int Seq<_Tp>::channels() const
+{ return seq ? CV_MAT_CN(seq->flags) : 0; }
+
+template<typename _Tp> inline size_t Seq<_Tp>::elemSize() const
+{ return seq ? seq->elem_size : 0; }
+
+template<typename _Tp> inline size_t Seq<_Tp>::index(const _Tp& elem) const
+{ return cvSeqElemIdx(seq, &elem); }
+
+template<typename _Tp> inline void Seq<_Tp>::push_back(const _Tp& elem)
+{ cvSeqPush(seq, &elem); }
+
+template<typename _Tp> inline void Seq<_Tp>::push_front(const _Tp& elem)
+{ cvSeqPushFront(seq, &elem); }
+
+template<typename _Tp> inline void Seq<_Tp>::push_back(const _Tp* elem, size_t count)
+{ cvSeqPushMulti(seq, elem, (int)count, 0); }
+
+template<typename _Tp> inline void Seq<_Tp>::push_front(const _Tp* elem, size_t count)
+{ cvSeqPushMulti(seq, elem, (int)count, 1); }
+
+template<typename _Tp> inline _Tp& Seq<_Tp>::back()
+{ return *(_Tp*)getSeqElem(seq, -1); }
+
+template<typename _Tp> inline const _Tp& Seq<_Tp>::back() const
+{ return *(const _Tp*)getSeqElem(seq, -1); }
+
+template<typename _Tp> inline _Tp& Seq<_Tp>::front()
+{ return *(_Tp*)getSeqElem(seq, 0); }
+
+template<typename _Tp> inline const _Tp& Seq<_Tp>::front() const
+{ return *(const _Tp*)getSeqElem(seq, 0); }
+
+template<typename _Tp> inline bool Seq<_Tp>::empty() const
+{ return !seq || seq->total == 0; }
+
+template<typename _Tp> inline void Seq<_Tp>::clear()
+{ if(seq) clearSeq(seq); }
+
+template<typename _Tp> inline void Seq<_Tp>::pop_back()
+{ seqPop(seq); }
+
+template<typename _Tp> inline void Seq<_Tp>::pop_front()
+{ seqPopFront(seq); }
+
+template<typename _Tp> inline void Seq<_Tp>::pop_back(_Tp* elem, size_t count)
+{ seqPopMulti(seq, elem, (int)count, 0); }
+
+template<typename _Tp> inline void Seq<_Tp>::pop_front(_Tp* elem, size_t count)
+{ seqPopMulti(seq, elem, (int)count, 1); }
+
+template<typename _Tp> inline void Seq<_Tp>::insert(int idx, const _Tp& elem)
+{ seqInsert(seq, idx, &elem); }
+
+template<typename _Tp> inline void Seq<_Tp>::insert(int idx, const _Tp* elems, size_t count)
+{
+    CvMat m = cvMat(1, count, DataType<_Tp>::type, elems);
+    seqInsertSlice(seq, idx, &m);
+}
+
+template<typename _Tp> inline void Seq<_Tp>::remove(int idx)
+{ seqRemove(seq, idx); }
+
+template<typename _Tp> inline void Seq<_Tp>::remove(const Range& r)
+{ seqRemoveSlice(seq, cvSlice(r.start, r.end)); }
+
+template<typename _Tp> inline void Seq<_Tp>::copyTo(std::vector<_Tp>& vec, const Range& range) const
+{
+    size_t len = !seq ? 0 : range == Range::all() ? seq->total : range.end - range.start;
+    vec.resize(len);
+    if( seq && len )
+        cvCvtSeqToArray(seq, &vec[0], range);
+}
+
+template<typename _Tp> inline Seq<_Tp>::operator std::vector<_Tp>() const
+{
+    std::vector<_Tp> vec;
+    copyTo(vec);
+    return vec;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp>::SeqIterator()
+{ memset(this, 0, sizeof(*this)); }
+
+template<typename _Tp> inline SeqIterator<_Tp>::SeqIterator(const Seq<_Tp>& _seq, bool seekEnd)
+{
+    cvStartReadSeq(_seq.seq, this);
+    index = seekEnd ? _seq.seq->total : 0;
+}
+
+template<typename _Tp> inline void SeqIterator<_Tp>::seek(size_t pos)
+{
+    cvSetSeqReaderPos(this, (int)pos, false);
+    index = pos;
+}
+
+template<typename _Tp> inline size_t SeqIterator<_Tp>::tell() const
+{ return index; }
+
+template<typename _Tp> inline _Tp& SeqIterator<_Tp>::operator *()
+{ return *(_Tp*)ptr; }
+
+template<typename _Tp> inline const _Tp& SeqIterator<_Tp>::operator *() const
+{ return *(const _Tp*)ptr; }
+
+template<typename _Tp> inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator ++()
+{
+    CV_NEXT_SEQ_ELEM(sizeof(_Tp), *this);
+    if( ++index >= seq->total*2 )
+        index = 0;
+    return *this;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp> SeqIterator<_Tp>::operator ++(int) const
+{
+    SeqIterator<_Tp> it = *this;
+    ++*this;
+    return it;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator --()
+{
+    CV_PREV_SEQ_ELEM(sizeof(_Tp), *this);
+    if( --index < 0 )
+        index = seq->total*2-1;
+    return *this;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp> SeqIterator<_Tp>::operator --(int) const
+{
+    SeqIterator<_Tp> it = *this;
+    --*this;
+    return it;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator +=(int delta)
+{
+    cvSetSeqReaderPos(this, delta, 1);
+    index += delta;
+    int n = seq->total*2;
+    if( index < 0 )
+        index += n;
+    if( index >= n )
+        index -= n;
+    return *this;
+}
+
+template<typename _Tp> inline SeqIterator<_Tp>& SeqIterator<_Tp>::operator -=(int delta)
+{
+    return (*this += -delta);
+}
+
+template<typename _Tp> inline ptrdiff_t operator - (const SeqIterator<_Tp>& a,
+                                                    const SeqIterator<_Tp>& b)
+{
+    ptrdiff_t delta = a.index - b.index, n = a.seq->total;
+    if( delta > n || delta < -n )
+        delta += delta < 0 ? n : -n;
+    return delta;
+}
+
+template<typename _Tp> inline bool operator == (const SeqIterator<_Tp>& a,
+                                                const SeqIterator<_Tp>& b)
+{
+    return a.seq == b.seq && a.index == b.index;
+}
+
+template<typename _Tp> inline bool operator != (const SeqIterator<_Tp>& a,
+                                                const SeqIterator<_Tp>& b)
+{
+    return !(a == b);
+}
+
+//! @}
+
+} // cv
+
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp
new file mode 100644
index 0000000..64bc53e
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda.hpp
@@ -0,0 +1,846 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_CUDA_HPP__
+#define __OPENCV_CORE_CUDA_HPP__
+
+#ifndef __cplusplus
+#  error cuda.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core.hpp"
+#include "opencv2/core/cuda_types.hpp"
+
+/**
+  @defgroup cuda CUDA-accelerated Computer Vision
+  @{
+    @defgroup cudacore Core part
+    @{
+      @defgroup cudacore_init Initalization and Information
+      @defgroup cudacore_struct Data Structures
+    @}
+  @}
+ */
+
+namespace cv { namespace cuda {
+
+//! @addtogroup cudacore_struct
+//! @{
+
+//===================================================================================
+// GpuMat
+//===================================================================================
+
+/** @brief Base storage class for GPU memory with reference counting.
+
+Its interface matches the Mat interface with the following limitations:
+
+-   no arbitrary dimensions support (only 2D)
+-   no functions that return references to their data (because references on GPU are not valid for
+    CPU)
+-   no expression templates technique support
+
+Beware that the latter limitation may lead to overloaded matrix operators that cause memory
+allocations. The GpuMat class is convertible to cuda::PtrStepSz and cuda::PtrStep so it can be
+passed directly to the kernel.
+
+@note In contrast with Mat, in most cases GpuMat::isContinuous() == false . This means that rows are
+aligned to a size depending on the hardware. Single-row GpuMat is always a continuous matrix.
+
+@note You are not recommended to leave static or global GpuMat variables allocated, that is, to rely
+on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory
+release function returns error if the CUDA context has been destroyed before.
+
+@sa Mat
+ */
+class CV_EXPORTS GpuMat
+{
+public:
+    class CV_EXPORTS Allocator
+    {
+    public:
+        virtual ~Allocator() {}
+
+        // allocator must fill data, step and refcount fields
+        virtual bool allocate(GpuMat* mat, int rows, int cols, size_t elemSize) = 0;
+        virtual void free(GpuMat* mat) = 0;
+    };
+
+    //! default allocator
+    static Allocator* defaultAllocator();
+    static void setDefaultAllocator(Allocator* allocator);
+
+    //! default constructor
+    explicit GpuMat(Allocator* allocator = defaultAllocator());
+
+    //! constructs GpuMat of the specified size and type
+    GpuMat(int rows, int cols, int type, Allocator* allocator = defaultAllocator());
+    GpuMat(Size size, int type, Allocator* allocator = defaultAllocator());
+
+    //! constucts GpuMat and fills it with the specified value _s
+    GpuMat(int rows, int cols, int type, Scalar s, Allocator* allocator = defaultAllocator());
+    GpuMat(Size size, int type, Scalar s, Allocator* allocator = defaultAllocator());
+
+    //! copy constructor
+    GpuMat(const GpuMat& m);
+
+    //! constructor for GpuMat headers pointing to user-allocated data
+    GpuMat(int rows, int cols, int type, void* data, size_t step = Mat::AUTO_STEP);
+    GpuMat(Size size, int type, void* data, size_t step = Mat::AUTO_STEP);
+
+    //! creates a GpuMat header for a part of the bigger matrix
+    GpuMat(const GpuMat& m, Range rowRange, Range colRange);
+    GpuMat(const GpuMat& m, Rect roi);
+
+    //! builds GpuMat from host memory (Blocking call)
+    explicit GpuMat(InputArray arr, Allocator* allocator = defaultAllocator());
+
+    //! destructor - calls release()
+    ~GpuMat();
+
+    //! assignment operators
+    GpuMat& operator =(const GpuMat& m);
+
+    //! allocates new GpuMat data unless the GpuMat already has specified size and type
+    void create(int rows, int cols, int type);
+    void create(Size size, int type);
+
+    //! decreases reference counter, deallocate the data when reference counter reaches 0
+    void release();
+
+    //! swaps with other smart pointer
+    void swap(GpuMat& mat);
+
+    //! pefroms upload data to GpuMat (Blocking call)
+    void upload(InputArray arr);
+
+    //! pefroms upload data to GpuMat (Non-Blocking call)
+    void upload(InputArray arr, Stream& stream);
+
+    //! pefroms download data from device to host memory (Blocking call)
+    void download(OutputArray dst) const;
+
+    //! pefroms download data from device to host memory (Non-Blocking call)
+    void download(OutputArray dst, Stream& stream) const;
+
+    //! returns deep copy of the GpuMat, i.e. the data is copied
+    GpuMat clone() const;
+
+    //! copies the GpuMat content to device memory (Blocking call)
+    void copyTo(OutputArray dst) const;
+
+    //! copies the GpuMat content to device memory (Non-Blocking call)
+    void copyTo(OutputArray dst, Stream& stream) const;
+
+    //! copies those GpuMat elements to "m" that are marked with non-zero mask elements (Blocking call)
+    void copyTo(OutputArray dst, InputArray mask) const;
+
+    //! copies those GpuMat elements to "m" that are marked with non-zero mask elements (Non-Blocking call)
+    void copyTo(OutputArray dst, InputArray mask, Stream& stream) const;
+
+    //! sets some of the GpuMat elements to s (Blocking call)
+    GpuMat& setTo(Scalar s);
+
+    //! sets some of the GpuMat elements to s (Non-Blocking call)
+    GpuMat& setTo(Scalar s, Stream& stream);
+
+    //! sets some of the GpuMat elements to s, according to the mask (Blocking call)
+    GpuMat& setTo(Scalar s, InputArray mask);
+
+    //! sets some of the GpuMat elements to s, according to the mask (Non-Blocking call)
+    GpuMat& setTo(Scalar s, InputArray mask, Stream& stream);
+
+    //! converts GpuMat to another datatype (Blocking call)
+    void convertTo(OutputArray dst, int rtype) const;
+
+    //! converts GpuMat to another datatype (Non-Blocking call)
+    void convertTo(OutputArray dst, int rtype, Stream& stream) const;
+
+    //! converts GpuMat to another datatype with scaling (Blocking call)
+    void convertTo(OutputArray dst, int rtype, double alpha, double beta = 0.0) const;
+
+    //! converts GpuMat to another datatype with scaling (Non-Blocking call)
+    void convertTo(OutputArray dst, int rtype, double alpha, Stream& stream) const;
+
+    //! converts GpuMat to another datatype with scaling (Non-Blocking call)
+    void convertTo(OutputArray dst, int rtype, double alpha, double beta, Stream& stream) const;
+
+    void assignTo(GpuMat& m, int type=-1) const;
+
+    //! returns pointer to y-th row
+    uchar* ptr(int y = 0);
+    const uchar* ptr(int y = 0) const;
+
+    //! template version of the above method
+    template<typename _Tp> _Tp* ptr(int y = 0);
+    template<typename _Tp> const _Tp* ptr(int y = 0) const;
+
+    template <typename _Tp> operator PtrStepSz<_Tp>() const;
+    template <typename _Tp> operator PtrStep<_Tp>() const;
+
+    //! returns a new GpuMat header for the specified row
+    GpuMat row(int y) const;
+
+    //! returns a new GpuMat header for the specified column
+    GpuMat col(int x) const;
+
+    //! ... for the specified row span
+    GpuMat rowRange(int startrow, int endrow) const;
+    GpuMat rowRange(Range r) const;
+
+    //! ... for the specified column span
+    GpuMat colRange(int startcol, int endcol) const;
+    GpuMat colRange(Range r) const;
+
+    //! extracts a rectangular sub-GpuMat (this is a generalized form of row, rowRange etc.)
+    GpuMat operator ()(Range rowRange, Range colRange) const;
+    GpuMat operator ()(Rect roi) const;
+
+    //! creates alternative GpuMat header for the same data, with different
+    //! number of channels and/or different number of rows
+    GpuMat reshape(int cn, int rows = 0) const;
+
+    //! locates GpuMat header within a parent GpuMat
+    void locateROI(Size& wholeSize, Point& ofs) const;
+
+    //! moves/resizes the current GpuMat ROI inside the parent GpuMat
+    GpuMat& adjustROI(int dtop, int dbottom, int dleft, int dright);
+
+    //! returns true iff the GpuMat data is continuous
+    //! (i.e. when there are no gaps between successive rows)
+    bool isContinuous() const;
+
+    //! returns element size in bytes
+    size_t elemSize() const;
+
+    //! returns the size of element channel in bytes
+    size_t elemSize1() const;
+
+    //! returns element type
+    int type() const;
+
+    //! returns element type
+    int depth() const;
+
+    //! returns number of channels
+    int channels() const;
+
+    //! returns step/elemSize1()
+    size_t step1() const;
+
+    //! returns GpuMat size : width == number of columns, height == number of rows
+    Size size() const;
+
+    //! returns true if GpuMat data is NULL
+    bool empty() const;
+
+    /*! includes several bit-fields:
+    - the magic signature
+    - continuity flag
+    - depth
+    - number of channels
+    */
+    int flags;
+
+    //! the number of rows and columns
+    int rows, cols;
+
+    //! a distance between successive rows in bytes; includes the gap if any
+    size_t step;
+
+    //! pointer to the data
+    uchar* data;
+
+    //! pointer to the reference counter;
+    //! when GpuMat points to user-allocated data, the pointer is NULL
+    int* refcount;
+
+    //! helper fields used in locateROI and adjustROI
+    uchar* datastart;
+    const uchar* dataend;
+
+    //! allocator
+    Allocator* allocator;
+};
+
+/** @brief Creates a continuous matrix.
+
+@param rows Row count.
+@param cols Column count.
+@param type Type of the matrix.
+@param arr Destination matrix. This parameter changes only if it has a proper type and area (
+\f$\texttt{rows} \times \texttt{cols}\f$ ).
+
+Matrix is called continuous if its elements are stored continuously, that is, without gaps at the
+end of each row.
+ */
+CV_EXPORTS void createContinuous(int rows, int cols, int type, OutputArray arr);
+
+/** @brief Ensures that the size of a matrix is big enough and the matrix has a proper type.
+
+@param rows Minimum desired number of rows.
+@param cols Minimum desired number of columns.
+@param type Desired matrix type.
+@param arr Destination matrix.
+
+The function does not reallocate memory if the matrix has proper attributes already.
+ */
+CV_EXPORTS void ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr);
+
+//! BufferPool management (must be called before Stream creation)
+CV_EXPORTS void setBufferPoolUsage(bool on);
+CV_EXPORTS void setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount);
+
+//===================================================================================
+// HostMem
+//===================================================================================
+
+/** @brief Class with reference counting wrapping special memory type allocation functions from CUDA.
+
+Its interface is also Mat-like but with additional memory type parameters.
+
+-   **PAGE_LOCKED** sets a page locked memory type used commonly for fast and asynchronous
+    uploading/downloading data from/to GPU.
+-   **SHARED** specifies a zero copy memory allocation that enables mapping the host memory to GPU
+    address space, if supported.
+-   **WRITE_COMBINED** sets the write combined buffer that is not cached by CPU. Such buffers are
+    used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache
+    utilization.
+
+@note Allocation size of such memory types is usually limited. For more details, see *CUDA 2.2
+Pinned Memory APIs* document or *CUDA C Programming Guide*.
+ */
+class CV_EXPORTS HostMem
+{
+public:
+    enum AllocType { PAGE_LOCKED = 1, SHARED = 2, WRITE_COMBINED = 4 };
+
+    static MatAllocator* getAllocator(AllocType alloc_type = PAGE_LOCKED);
+
+    explicit HostMem(AllocType alloc_type = PAGE_LOCKED);
+
+    HostMem(const HostMem& m);
+
+    HostMem(int rows, int cols, int type, AllocType alloc_type = PAGE_LOCKED);
+    HostMem(Size size, int type, AllocType alloc_type = PAGE_LOCKED);
+
+    //! creates from host memory with coping data
+    explicit HostMem(InputArray arr, AllocType alloc_type = PAGE_LOCKED);
+
+    ~HostMem();
+
+    HostMem& operator =(const HostMem& m);
+
+    //! swaps with other smart pointer
+    void swap(HostMem& b);
+
+    //! returns deep copy of the matrix, i.e. the data is copied
+    HostMem clone() const;
+
+    //! allocates new matrix data unless the matrix already has specified size and type.
+    void create(int rows, int cols, int type);
+    void create(Size size, int type);
+
+    //! creates alternative HostMem header for the same data, with different
+    //! number of channels and/or different number of rows
+    HostMem reshape(int cn, int rows = 0) const;
+
+    //! decrements reference counter and released memory if needed.
+    void release();
+
+    //! returns matrix header with disabled reference counting for HostMem data.
+    Mat createMatHeader() const;
+
+    /** @brief Maps CPU memory to GPU address space and creates the cuda::GpuMat header without reference counting
+    for it.
+
+    This can be done only if memory was allocated with the SHARED flag and if it is supported by the
+    hardware. Laptops often share video and CPU memory, so address spaces can be mapped, which
+    eliminates an extra copy.
+     */
+    GpuMat createGpuMatHeader() const;
+
+    // Please see cv::Mat for descriptions
+    bool isContinuous() const;
+    size_t elemSize() const;
+    size_t elemSize1() const;
+    int type() const;
+    int depth() const;
+    int channels() const;
+    size_t step1() const;
+    Size size() const;
+    bool empty() const;
+
+    // Please see cv::Mat for descriptions
+    int flags;
+    int rows, cols;
+    size_t step;
+
+    uchar* data;
+    int* refcount;
+
+    uchar* datastart;
+    const uchar* dataend;
+
+    AllocType alloc_type;
+};
+
+/** @brief Page-locks the memory of matrix and maps it for the device(s).
+
+@param m Input matrix.
+ */
+CV_EXPORTS void registerPageLocked(Mat& m);
+
+/** @brief Unmaps the memory of matrix and makes it pageable again.
+
+@param m Input matrix.
+ */
+CV_EXPORTS void unregisterPageLocked(Mat& m);
+
+//===================================================================================
+// Stream
+//===================================================================================
+
+/** @brief This class encapsulates a queue of asynchronous calls.
+
+@note Currently, you may face problems if an operation is enqueued twice with different data. Some
+functions use the constant GPU memory, and next call may update the memory before the previous one
+has been finished. But calling different operations asynchronously is safe because each operation
+has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are
+also safe. :
+ */
+class CV_EXPORTS Stream
+{
+    typedef void (Stream::*bool_type)() const;
+    void this_type_does_not_support_comparisons() const {}
+
+public:
+    typedef void (*StreamCallback)(int status, void* userData);
+
+    //! creates a new asynchronous stream
+    Stream();
+
+    /** @brief Returns true if the current stream queue is finished. Otherwise, it returns false.
+    */
+    bool queryIfComplete() const;
+
+    /** @brief Blocks the current CPU thread until all operations in the stream are complete.
+    */
+    void waitForCompletion();
+
+    /** @brief Makes a compute stream wait on an event.
+    */
+    void waitEvent(const Event& event);
+
+    /** @brief Adds a callback to be called on the host after all currently enqueued items in the stream have
+    completed.
+
+    @note Callbacks must not make any CUDA API calls. Callbacks must not perform any synchronization
+    that may depend on outstanding device work or other callbacks that are not mandated to run earlier.
+    Callbacks without a mandated order (in independent streams) execute in undefined order and may be
+    serialized.
+     */
+    void enqueueHostCallback(StreamCallback callback, void* userData);
+
+    //! return Stream object for default CUDA stream
+    static Stream& Null();
+
+    //! returns true if stream object is not default (!= 0)
+    operator bool_type() const;
+
+    class Impl;
+
+private:
+    Ptr<Impl> impl_;
+    Stream(const Ptr<Impl>& impl);
+
+    friend struct StreamAccessor;
+    friend class BufferPool;
+    friend class DefaultDeviceInitializer;
+};
+
+class CV_EXPORTS Event
+{
+public:
+    enum CreateFlags
+    {
+        DEFAULT        = 0x00,  /**< Default event flag */
+        BLOCKING_SYNC  = 0x01,  /**< Event uses blocking synchronization */
+        DISABLE_TIMING = 0x02,  /**< Event will not record timing data */
+        INTERPROCESS   = 0x04   /**< Event is suitable for interprocess use. DisableTiming must be set */
+    };
+
+    explicit Event(CreateFlags flags = DEFAULT);
+
+    //! records an event
+    void record(Stream& stream = Stream::Null());
+
+    //! queries an event's status
+    bool queryIfComplete() const;
+
+    //! waits for an event to complete
+    void waitForCompletion();
+
+    //! computes the elapsed time between events
+    static float elapsedTime(const Event& start, const Event& end);
+
+    class Impl;
+
+private:
+    Ptr<Impl> impl_;
+    Event(const Ptr<Impl>& impl);
+
+    friend struct EventAccessor;
+};
+
+//! @} cudacore_struct
+
+//===================================================================================
+// Initialization & Info
+//===================================================================================
+
+//! @addtogroup cudacore_init
+//! @{
+
+/** @brief Returns the number of installed CUDA-enabled devices.
+
+Use this function before any other CUDA functions calls. If OpenCV is compiled without CUDA support,
+this function returns 0.
+ */
+CV_EXPORTS int getCudaEnabledDeviceCount();
+
+/** @brief Sets a device and initializes it for the current thread.
+
+@param device System index of a CUDA device starting with 0.
+
+If the call of this function is omitted, a default device is initialized at the fist CUDA usage.
+ */
+CV_EXPORTS void setDevice(int device);
+
+/** @brief Returns the current device index set by cuda::setDevice or initialized by default.
+ */
+CV_EXPORTS int getDevice();
+
+/** @brief Explicitly destroys and cleans up all resources associated with the current device in the current
+process.
+
+Any subsequent API call to this device will reinitialize the device.
+ */
+CV_EXPORTS void resetDevice();
+
+/** @brief Enumeration providing CUDA computing features.
+ */
+enum FeatureSet
+{
+    FEATURE_SET_COMPUTE_10 = 10,
+    FEATURE_SET_COMPUTE_11 = 11,
+    FEATURE_SET_COMPUTE_12 = 12,
+    FEATURE_SET_COMPUTE_13 = 13,
+    FEATURE_SET_COMPUTE_20 = 20,
+    FEATURE_SET_COMPUTE_21 = 21,
+    FEATURE_SET_COMPUTE_30 = 30,
+    FEATURE_SET_COMPUTE_32 = 32,
+    FEATURE_SET_COMPUTE_35 = 35,
+    FEATURE_SET_COMPUTE_50 = 50,
+
+    GLOBAL_ATOMICS = FEATURE_SET_COMPUTE_11,
+    SHARED_ATOMICS = FEATURE_SET_COMPUTE_12,
+    NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13,
+    WARP_SHUFFLE_FUNCTIONS = FEATURE_SET_COMPUTE_30,
+    DYNAMIC_PARALLELISM = FEATURE_SET_COMPUTE_35
+};
+
+//! checks whether current device supports the given feature
+CV_EXPORTS bool deviceSupports(FeatureSet feature_set);
+
+/** @brief Class providing a set of static methods to check what NVIDIA\* card architecture the CUDA module was
+built for.
+
+According to the CUDA C Programming Guide Version 3.2: "PTX code produced for some specific compute
+capability can always be compiled to binary code of greater or equal compute capability".
+ */
+class CV_EXPORTS TargetArchs
+{
+public:
+    /** @brief The following method checks whether the module was built with the support of the given feature:
+
+    @param feature_set Features to be checked. See :ocvcuda::FeatureSet.
+     */
+    static bool builtWith(FeatureSet feature_set);
+
+    /** @brief There is a set of methods to check whether the module contains intermediate (PTX) or binary CUDA
+    code for the given architecture(s):
+
+    @param major Major compute capability version.
+    @param minor Minor compute capability version.
+     */
+    static bool has(int major, int minor);
+    static bool hasPtx(int major, int minor);
+    static bool hasBin(int major, int minor);
+
+    static bool hasEqualOrLessPtx(int major, int minor);
+    static bool hasEqualOrGreater(int major, int minor);
+    static bool hasEqualOrGreaterPtx(int major, int minor);
+    static bool hasEqualOrGreaterBin(int major, int minor);
+};
+
+/** @brief Class providing functionality for querying the specified GPU properties.
+ */
+class CV_EXPORTS DeviceInfo
+{
+public:
+    //! creates DeviceInfo object for the current GPU
+    DeviceInfo();
+
+    /** @brief The constructors.
+
+    @param device_id System index of the CUDA device starting with 0.
+
+    Constructs the DeviceInfo object for the specified device. If device_id parameter is missed, it
+    constructs an object for the current device.
+     */
+    DeviceInfo(int device_id);
+
+    /** @brief Returns system index of the CUDA device starting with 0.
+    */
+    int deviceID() const;
+
+    //! ASCII string identifying device
+    const char* name() const;
+
+    //! global memory available on device in bytes
+    size_t totalGlobalMem() const;
+
+    //! shared memory available per block in bytes
+    size_t sharedMemPerBlock() const;
+
+    //! 32-bit registers available per block
+    int regsPerBlock() const;
+
+    //! warp size in threads
+    int warpSize() const;
+
+    //! maximum pitch in bytes allowed by memory copies
+    size_t memPitch() const;
+
+    //! maximum number of threads per block
+    int maxThreadsPerBlock() const;
+
+    //! maximum size of each dimension of a block
+    Vec3i maxThreadsDim() const;
+
+    //! maximum size of each dimension of a grid
+    Vec3i maxGridSize() const;
+
+    //! clock frequency in kilohertz
+    int clockRate() const;
+
+    //! constant memory available on device in bytes
+    size_t totalConstMem() const;
+
+    //! major compute capability
+    int majorVersion() const;
+
+    //! minor compute capability
+    int minorVersion() const;
+
+    //! alignment requirement for textures
+    size_t textureAlignment() const;
+
+    //! pitch alignment requirement for texture references bound to pitched memory
+    size_t texturePitchAlignment() const;
+
+    //! number of multiprocessors on device
+    int multiProcessorCount() const;
+
+    //! specified whether there is a run time limit on kernels
+    bool kernelExecTimeoutEnabled() const;
+
+    //! device is integrated as opposed to discrete
+    bool integrated() const;
+
+    //! device can map host memory with cudaHostAlloc/cudaHostGetDevicePointer
+    bool canMapHostMemory() const;
+
+    enum ComputeMode
+    {
+        ComputeModeDefault,         /**< default compute mode (Multiple threads can use cudaSetDevice with this device) */
+        ComputeModeExclusive,       /**< compute-exclusive-thread mode (Only one thread in one process will be able to use cudaSetDevice with this device) */
+        ComputeModeProhibited,      /**< compute-prohibited mode (No threads can use cudaSetDevice with this device) */
+        ComputeModeExclusiveProcess /**< compute-exclusive-process mode (Many threads in one process will be able to use cudaSetDevice with this device) */
+    };
+
+    //! compute mode
+    ComputeMode computeMode() const;
+
+    //! maximum 1D texture size
+    int maxTexture1D() const;
+
+    //! maximum 1D mipmapped texture size
+    int maxTexture1DMipmap() const;
+
+    //! maximum size for 1D textures bound to linear memory
+    int maxTexture1DLinear() const;
+
+    //! maximum 2D texture dimensions
+    Vec2i maxTexture2D() const;
+
+    //! maximum 2D mipmapped texture dimensions
+    Vec2i maxTexture2DMipmap() const;
+
+    //! maximum dimensions (width, height, pitch) for 2D textures bound to pitched memory
+    Vec3i maxTexture2DLinear() const;
+
+    //! maximum 2D texture dimensions if texture gather operations have to be performed
+    Vec2i maxTexture2DGather() const;
+
+    //! maximum 3D texture dimensions
+    Vec3i maxTexture3D() const;
+
+    //! maximum Cubemap texture dimensions
+    int maxTextureCubemap() const;
+
+    //! maximum 1D layered texture dimensions
+    Vec2i maxTexture1DLayered() const;
+
+    //! maximum 2D layered texture dimensions
+    Vec3i maxTexture2DLayered() const;
+
+    //! maximum Cubemap layered texture dimensions
+    Vec2i maxTextureCubemapLayered() const;
+
+    //! maximum 1D surface size
+    int maxSurface1D() const;
+
+    //! maximum 2D surface dimensions
+    Vec2i maxSurface2D() const;
+
+    //! maximum 3D surface dimensions
+    Vec3i maxSurface3D() const;
+
+    //! maximum 1D layered surface dimensions
+    Vec2i maxSurface1DLayered() const;
+
+    //! maximum 2D layered surface dimensions
+    Vec3i maxSurface2DLayered() const;
+
+    //! maximum Cubemap surface dimensions
+    int maxSurfaceCubemap() const;
+
+    //! maximum Cubemap layered surface dimensions
+    Vec2i maxSurfaceCubemapLayered() const;
+
+    //! alignment requirements for surfaces
+    size_t surfaceAlignment() const;
+
+    //! device can possibly execute multiple kernels concurrently
+    bool concurrentKernels() const;
+
+    //! device has ECC support enabled
+    bool ECCEnabled() const;
+
+    //! PCI bus ID of the device
+    int pciBusID() const;
+
+    //! PCI device ID of the device
+    int pciDeviceID() const;
+
+    //! PCI domain ID of the device
+    int pciDomainID() const;
+
+    //! true if device is a Tesla device using TCC driver, false otherwise
+    bool tccDriver() const;
+
+    //! number of asynchronous engines
+    int asyncEngineCount() const;
+
+    //! device shares a unified address space with the host
+    bool unifiedAddressing() const;
+
+    //! peak memory clock frequency in kilohertz
+    int memoryClockRate() const;
+
+    //! global memory bus width in bits
+    int memoryBusWidth() const;
+
+    //! size of L2 cache in bytes
+    int l2CacheSize() const;
+
+    //! maximum resident threads per multiprocessor
+    int maxThreadsPerMultiProcessor() const;
+
+    //! gets free and total device memory
+    void queryMemory(size_t& totalMemory, size_t& freeMemory) const;
+    size_t freeMemory() const;
+    size_t totalMemory() const;
+
+    /** @brief Provides information on CUDA feature support.
+
+    @param feature_set Features to be checked. See cuda::FeatureSet.
+
+    This function returns true if the device has the specified CUDA feature. Otherwise, it returns false
+     */
+    bool supports(FeatureSet feature_set) const;
+
+    /** @brief Checks the CUDA module and device compatibility.
+
+    This function returns true if the CUDA module can be run on the specified device. Otherwise, it
+    returns false .
+     */
+    bool isCompatible() const;
+
+private:
+    int device_id_;
+};
+
+CV_EXPORTS void printCudaDeviceInfo(int device);
+CV_EXPORTS void printShortCudaDeviceInfo(int device);
+
+//! @} cudacore_init
+
+}} // namespace cv { namespace cuda {
+
+
+#include "opencv2/core/cuda.inl.hpp"
+
+#endif /* __OPENCV_CORE_CUDA_HPP__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp
new file mode 100644
index 0000000..01dc6d7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda.inl.hpp
@@ -0,0 +1,631 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_CUDAINL_HPP__
+#define __OPENCV_CORE_CUDAINL_HPP__
+
+#include "opencv2/core/cuda.hpp"
+
+//! @cond IGNORED
+
+namespace cv { namespace cuda {
+
+//===================================================================================
+// GpuMat
+//===================================================================================
+
+inline
+GpuMat::GpuMat(Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{}
+
+inline
+GpuMat::GpuMat(int rows_, int cols_, int type_, Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    if (rows_ > 0 && cols_ > 0)
+        create(rows_, cols_, type_);
+}
+
+inline
+GpuMat::GpuMat(Size size_, int type_, Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    if (size_.height > 0 && size_.width > 0)
+        create(size_.height, size_.width, type_);
+}
+
+inline
+GpuMat::GpuMat(int rows_, int cols_, int type_, Scalar s_, Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    if (rows_ > 0 && cols_ > 0)
+    {
+        create(rows_, cols_, type_);
+        setTo(s_);
+    }
+}
+
+inline
+GpuMat::GpuMat(Size size_, int type_, Scalar s_, Allocator* allocator_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    if (size_.height > 0 && size_.width > 0)
+    {
+        create(size_.height, size_.width, type_);
+        setTo(s_);
+    }
+}
+
+inline
+GpuMat::GpuMat(const GpuMat& m)
+    : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount), datastart(m.datastart), dataend(m.dataend), allocator(m.allocator)
+{
+    if (refcount)
+        CV_XADD(refcount, 1);
+}
+
+inline
+GpuMat::GpuMat(InputArray arr, Allocator* allocator_) :
+    flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
+{
+    upload(arr);
+}
+
+inline
+GpuMat::~GpuMat()
+{
+    release();
+}
+
+inline
+GpuMat& GpuMat::operator =(const GpuMat& m)
+{
+    if (this != &m)
+    {
+        GpuMat temp(m);
+        swap(temp);
+    }
+
+    return *this;
+}
+
+inline
+void GpuMat::create(Size size_, int type_)
+{
+    create(size_.height, size_.width, type_);
+}
+
+inline
+void GpuMat::swap(GpuMat& b)
+{
+    std::swap(flags, b.flags);
+    std::swap(rows, b.rows);
+    std::swap(cols, b.cols);
+    std::swap(step, b.step);
+    std::swap(data, b.data);
+    std::swap(datastart, b.datastart);
+    std::swap(dataend, b.dataend);
+    std::swap(refcount, b.refcount);
+    std::swap(allocator, b.allocator);
+}
+
+inline
+GpuMat GpuMat::clone() const
+{
+    GpuMat m;
+    copyTo(m);
+    return m;
+}
+
+inline
+void GpuMat::copyTo(OutputArray dst, InputArray mask) const
+{
+    copyTo(dst, mask, Stream::Null());
+}
+
+inline
+GpuMat& GpuMat::setTo(Scalar s)
+{
+    return setTo(s, Stream::Null());
+}
+
+inline
+GpuMat& GpuMat::setTo(Scalar s, InputArray mask)
+{
+    return setTo(s, mask, Stream::Null());
+}
+
+inline
+void GpuMat::convertTo(OutputArray dst, int rtype) const
+{
+    convertTo(dst, rtype, Stream::Null());
+}
+
+inline
+void GpuMat::convertTo(OutputArray dst, int rtype, double alpha, double beta) const
+{
+    convertTo(dst, rtype, alpha, beta, Stream::Null());
+}
+
+inline
+void GpuMat::convertTo(OutputArray dst, int rtype, double alpha, Stream& stream) const
+{
+    convertTo(dst, rtype, alpha, 0.0, stream);
+}
+
+inline
+void GpuMat::assignTo(GpuMat& m, int _type) const
+{
+    if (_type < 0)
+        m = *this;
+    else
+        convertTo(m, _type);
+}
+
+inline
+uchar* GpuMat::ptr(int y)
+{
+    CV_DbgAssert( (unsigned)y < (unsigned)rows );
+    return data + step * y;
+}
+
+inline
+const uchar* GpuMat::ptr(int y) const
+{
+    CV_DbgAssert( (unsigned)y < (unsigned)rows );
+    return data + step * y;
+}
+
+template<typename _Tp> inline
+_Tp* GpuMat::ptr(int y)
+{
+    return (_Tp*)ptr(y);
+}
+
+template<typename _Tp> inline
+const _Tp* GpuMat::ptr(int y) const
+{
+    return (const _Tp*)ptr(y);
+}
+
+template <class T> inline
+GpuMat::operator PtrStepSz<T>() const
+{
+    return PtrStepSz<T>(rows, cols, (T*)data, step);
+}
+
+template <class T> inline
+GpuMat::operator PtrStep<T>() const
+{
+    return PtrStep<T>((T*)data, step);
+}
+
+inline
+GpuMat GpuMat::row(int y) const
+{
+    return GpuMat(*this, Range(y, y+1), Range::all());
+}
+
+inline
+GpuMat GpuMat::col(int x) const
+{
+    return GpuMat(*this, Range::all(), Range(x, x+1));
+}
+
+inline
+GpuMat GpuMat::rowRange(int startrow, int endrow) const
+{
+    return GpuMat(*this, Range(startrow, endrow), Range::all());
+}
+
+inline
+GpuMat GpuMat::rowRange(Range r) const
+{
+    return GpuMat(*this, r, Range::all());
+}
+
+inline
+GpuMat GpuMat::colRange(int startcol, int endcol) const
+{
+    return GpuMat(*this, Range::all(), Range(startcol, endcol));
+}
+
+inline
+GpuMat GpuMat::colRange(Range r) const
+{
+    return GpuMat(*this, Range::all(), r);
+}
+
+inline
+GpuMat GpuMat::operator ()(Range rowRange_, Range colRange_) const
+{
+    return GpuMat(*this, rowRange_, colRange_);
+}
+
+inline
+GpuMat GpuMat::operator ()(Rect roi) const
+{
+    return GpuMat(*this, roi);
+}
+
+inline
+bool GpuMat::isContinuous() const
+{
+    return (flags & Mat::CONTINUOUS_FLAG) != 0;
+}
+
+inline
+size_t GpuMat::elemSize() const
+{
+    return CV_ELEM_SIZE(flags);
+}
+
+inline
+size_t GpuMat::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int GpuMat::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int GpuMat::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int GpuMat::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+size_t GpuMat::step1() const
+{
+    return step / elemSize1();
+}
+
+inline
+Size GpuMat::size() const
+{
+    return Size(cols, rows);
+}
+
+inline
+bool GpuMat::empty() const
+{
+    return data == 0;
+}
+
+static inline
+GpuMat createContinuous(int rows, int cols, int type)
+{
+    GpuMat m;
+    createContinuous(rows, cols, type, m);
+    return m;
+}
+
+static inline
+void createContinuous(Size size, int type, OutputArray arr)
+{
+    createContinuous(size.height, size.width, type, arr);
+}
+
+static inline
+GpuMat createContinuous(Size size, int type)
+{
+    GpuMat m;
+    createContinuous(size, type, m);
+    return m;
+}
+
+static inline
+void ensureSizeIsEnough(Size size, int type, OutputArray arr)
+{
+    ensureSizeIsEnough(size.height, size.width, type, arr);
+}
+
+static inline
+void swap(GpuMat& a, GpuMat& b)
+{
+    a.swap(b);
+}
+
+//===================================================================================
+// HostMem
+//===================================================================================
+
+inline
+HostMem::HostMem(AllocType alloc_type_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
+{
+}
+
+inline
+HostMem::HostMem(const HostMem& m)
+    : flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount), datastart(m.datastart), dataend(m.dataend), alloc_type(m.alloc_type)
+{
+    if( refcount )
+        CV_XADD(refcount, 1);
+}
+
+inline
+HostMem::HostMem(int rows_, int cols_, int type_, AllocType alloc_type_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
+{
+    if (rows_ > 0 && cols_ > 0)
+        create(rows_, cols_, type_);
+}
+
+inline
+HostMem::HostMem(Size size_, int type_, AllocType alloc_type_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
+{
+    if (size_.height > 0 && size_.width > 0)
+        create(size_.height, size_.width, type_);
+}
+
+inline
+HostMem::HostMem(InputArray arr, AllocType alloc_type_)
+    : flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), alloc_type(alloc_type_)
+{
+    arr.getMat().copyTo(*this);
+}
+
+inline
+HostMem::~HostMem()
+{
+    release();
+}
+
+inline
+HostMem& HostMem::operator =(const HostMem& m)
+{
+    if (this != &m)
+    {
+        HostMem temp(m);
+        swap(temp);
+    }
+
+    return *this;
+}
+
+inline
+void HostMem::swap(HostMem& b)
+{
+    std::swap(flags, b.flags);
+    std::swap(rows, b.rows);
+    std::swap(cols, b.cols);
+    std::swap(step, b.step);
+    std::swap(data, b.data);
+    std::swap(datastart, b.datastart);
+    std::swap(dataend, b.dataend);
+    std::swap(refcount, b.refcount);
+    std::swap(alloc_type, b.alloc_type);
+}
+
+inline
+HostMem HostMem::clone() const
+{
+    HostMem m(size(), type(), alloc_type);
+    createMatHeader().copyTo(m);
+    return m;
+}
+
+inline
+void HostMem::create(Size size_, int type_)
+{
+    create(size_.height, size_.width, type_);
+}
+
+inline
+Mat HostMem::createMatHeader() const
+{
+    return Mat(size(), type(), data, step);
+}
+
+inline
+bool HostMem::isContinuous() const
+{
+    return (flags & Mat::CONTINUOUS_FLAG) != 0;
+}
+
+inline
+size_t HostMem::elemSize() const
+{
+    return CV_ELEM_SIZE(flags);
+}
+
+inline
+size_t HostMem::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int HostMem::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int HostMem::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int HostMem::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+size_t HostMem::step1() const
+{
+    return step / elemSize1();
+}
+
+inline
+Size HostMem::size() const
+{
+    return Size(cols, rows);
+}
+
+inline
+bool HostMem::empty() const
+{
+    return data == 0;
+}
+
+static inline
+void swap(HostMem& a, HostMem& b)
+{
+    a.swap(b);
+}
+
+//===================================================================================
+// Stream
+//===================================================================================
+
+inline
+Stream::Stream(const Ptr<Impl>& impl)
+    : impl_(impl)
+{
+}
+
+//===================================================================================
+// Event
+//===================================================================================
+
+inline
+Event::Event(const Ptr<Impl>& impl)
+    : impl_(impl)
+{
+}
+
+//===================================================================================
+// Initialization & Info
+//===================================================================================
+
+inline
+bool TargetArchs::has(int major, int minor)
+{
+    return hasPtx(major, minor) || hasBin(major, minor);
+}
+
+inline
+bool TargetArchs::hasEqualOrGreater(int major, int minor)
+{
+    return hasEqualOrGreaterPtx(major, minor) || hasEqualOrGreaterBin(major, minor);
+}
+
+inline
+DeviceInfo::DeviceInfo()
+{
+    device_id_ = getDevice();
+}
+
+inline
+DeviceInfo::DeviceInfo(int device_id)
+{
+    CV_Assert( device_id >= 0 && device_id < getCudaEnabledDeviceCount() );
+    device_id_ = device_id;
+}
+
+inline
+int DeviceInfo::deviceID() const
+{
+    return device_id_;
+}
+
+inline
+size_t DeviceInfo::freeMemory() const
+{
+    size_t _totalMemory = 0, _freeMemory = 0;
+    queryMemory(_totalMemory, _freeMemory);
+    return _freeMemory;
+}
+
+inline
+size_t DeviceInfo::totalMemory() const
+{
+    size_t _totalMemory = 0, _freeMemory = 0;
+    queryMemory(_totalMemory, _freeMemory);
+    return _totalMemory;
+}
+
+inline
+bool DeviceInfo::supports(FeatureSet feature_set) const
+{
+    int version = majorVersion() * 10 + minorVersion();
+    return version >= feature_set;
+}
+
+
+}} // namespace cv { namespace cuda {
+
+//===================================================================================
+// Mat
+//===================================================================================
+
+namespace cv {
+
+inline
+Mat::Mat(const cuda::GpuMat& m)
+    : flags(0), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0), datalimit(0), allocator(0), u(0), size(&rows)
+{
+    m.download(*this);
+}
+
+}
+
+//! @endcond
+
+#endif // __OPENCV_CORE_CUDAINL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp
new file mode 100644
index 0000000..0f8ee9b
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda_stream_accessor.hpp
@@ -0,0 +1,86 @@
+/*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*/
+
+#ifndef __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__
+#define __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__
+
+#ifndef __cplusplus
+#  error cuda_stream_accessor.hpp header must be compiled as C++
+#endif
+
+/** @file cuda_stream_accessor.hpp
+ * This is only header file that depends on CUDA Runtime API. All other headers are independent.
+ */
+
+#include <cuda_runtime.h>
+#include "opencv2/core/cuda.hpp"
+
+namespace cv
+{
+    namespace cuda
+    {
+
+//! @addtogroup cudacore_struct
+//! @{
+
+        /** @brief Class that enables getting cudaStream_t from cuda::Stream
+         */
+        struct StreamAccessor
+        {
+            CV_EXPORTS static cudaStream_t getStream(const Stream& stream);
+            CV_EXPORTS static Stream wrapStream(cudaStream_t stream);
+        };
+
+        /** @brief Class that enables getting cudaEvent_t from cuda::Event
+         */
+        struct EventAccessor
+        {
+            CV_EXPORTS static cudaEvent_t getEvent(const Event& event);
+            CV_EXPORTS static Event wrapEvent(cudaEvent_t event);
+        };
+
+//! @}
+
+    }
+}
+
+#endif /* __OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp
new file mode 100644
index 0000000..8df816e
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cuda_types.hpp
@@ -0,0 +1,135 @@
+/*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*/
+
+#ifndef __OPENCV_CORE_CUDA_TYPES_HPP__
+#define __OPENCV_CORE_CUDA_TYPES_HPP__
+
+#ifndef __cplusplus
+#  error cuda_types.hpp header must be compiled as C++
+#endif
+
+/** @file
+ * @deprecated Use @ref cudev instead.
+ */
+
+//! @cond IGNORED
+
+#ifdef __CUDACC__
+    #define __CV_CUDA_HOST_DEVICE__ __host__ __device__ __forceinline__
+#else
+    #define __CV_CUDA_HOST_DEVICE__
+#endif
+
+namespace cv
+{
+    namespace cuda
+    {
+
+        // Simple lightweight structures that encapsulates information about an image on device.
+        // It is intended to pass to nvcc-compiled code. GpuMat depends on headers that nvcc can't compile
+
+        template <typename T> struct DevPtr
+        {
+            typedef T elem_type;
+            typedef int index_type;
+
+            enum { elem_size = sizeof(elem_type) };
+
+            T* data;
+
+            __CV_CUDA_HOST_DEVICE__ DevPtr() : data(0) {}
+            __CV_CUDA_HOST_DEVICE__ DevPtr(T* data_) : data(data_) {}
+
+            __CV_CUDA_HOST_DEVICE__ size_t elemSize() const { return elem_size; }
+            __CV_CUDA_HOST_DEVICE__ operator       T*()       { return data; }
+            __CV_CUDA_HOST_DEVICE__ operator const T*() const { return data; }
+        };
+
+        template <typename T> struct PtrSz : public DevPtr<T>
+        {
+            __CV_CUDA_HOST_DEVICE__ PtrSz() : size(0) {}
+            __CV_CUDA_HOST_DEVICE__ PtrSz(T* data_, size_t size_) : DevPtr<T>(data_), size(size_) {}
+
+            size_t size;
+        };
+
+        template <typename T> struct PtrStep : public DevPtr<T>
+        {
+            __CV_CUDA_HOST_DEVICE__ PtrStep() : step(0) {}
+            __CV_CUDA_HOST_DEVICE__ PtrStep(T* data_, size_t step_) : DevPtr<T>(data_), step(step_) {}
+
+            size_t step;
+
+            __CV_CUDA_HOST_DEVICE__       T* ptr(int y = 0)       { return (      T*)( (      char*)DevPtr<T>::data + y * step); }
+            __CV_CUDA_HOST_DEVICE__ const T* ptr(int y = 0) const { return (const T*)( (const char*)DevPtr<T>::data + y * step); }
+
+            __CV_CUDA_HOST_DEVICE__       T& operator ()(int y, int x)       { return ptr(y)[x]; }
+            __CV_CUDA_HOST_DEVICE__ const T& operator ()(int y, int x) const { return ptr(y)[x]; }
+        };
+
+        template <typename T> struct PtrStepSz : public PtrStep<T>
+        {
+            __CV_CUDA_HOST_DEVICE__ PtrStepSz() : cols(0), rows(0) {}
+            __CV_CUDA_HOST_DEVICE__ PtrStepSz(int rows_, int cols_, T* data_, size_t step_)
+                : PtrStep<T>(data_, step_), cols(cols_), rows(rows_) {}
+
+            template <typename U>
+            explicit PtrStepSz(const PtrStepSz<U>& d) : PtrStep<T>((T*)d.data, d.step), cols(d.cols), rows(d.rows){}
+
+            int cols;
+            int rows;
+        };
+
+        typedef PtrStepSz<unsigned char> PtrStepSzb;
+        typedef PtrStepSz<float> PtrStepSzf;
+        typedef PtrStepSz<int> PtrStepSzi;
+
+        typedef PtrStep<unsigned char> PtrStepb;
+        typedef PtrStep<float> PtrStepf;
+        typedef PtrStep<int> PtrStepi;
+
+    }
+}
+
+//! @endcond
+
+#endif /* __OPENCV_CORE_CUDA_TYPES_HPP__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h
new file mode 100644
index 0000000..af2abfb
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvdef.h
@@ -0,0 +1,515 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_CVDEF_H__
+#define __OPENCV_CORE_CVDEF_H__
+
+//! @addtogroup core_utils
+//! @{
+
+#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER && _MSC_VER > 1300
+#  define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio warnings */
+#endif
+
+// undef problematic defines sometimes defined by system headers (windows.h in particular)
+#undef small
+#undef min
+#undef max
+#undef abs
+#undef Complex
+
+#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER && _MSC_VER > 1300
+#  define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio warnings */
+#endif
+
+#include <limits.h>
+#include "opencv2/core/hal/interface.h"
+
+#if defined __ICL
+#  define CV_ICC   __ICL
+#elif defined __ICC
+#  define CV_ICC   __ICC
+#elif defined __ECL
+#  define CV_ICC   __ECL
+#elif defined __ECC
+#  define CV_ICC   __ECC
+#elif defined __INTEL_COMPILER
+#  define CV_ICC   __INTEL_COMPILER
+#endif
+
+#ifndef CV_INLINE
+#  if defined __cplusplus
+#    define CV_INLINE static inline
+#  elif defined _MSC_VER
+#    define CV_INLINE __inline
+#  else
+#    define CV_INLINE static
+#  endif
+#endif
+
+#if defined CV_ICC && !defined CV_ENABLE_UNROLLED
+#  define CV_ENABLE_UNROLLED 0
+#else
+#  define CV_ENABLE_UNROLLED 1
+#endif
+
+#ifdef __GNUC__
+#  define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
+#elif defined _MSC_VER
+#  define CV_DECL_ALIGNED(x) __declspec(align(x))
+#else
+#  define CV_DECL_ALIGNED(x)
+#endif
+
+/* CPU features and intrinsics support */
+#define CV_CPU_NONE             0
+#define CV_CPU_MMX              1
+#define CV_CPU_SSE              2
+#define CV_CPU_SSE2             3
+#define CV_CPU_SSE3             4
+#define CV_CPU_SSSE3            5
+#define CV_CPU_SSE4_1           6
+#define CV_CPU_SSE4_2           7
+#define CV_CPU_POPCNT           8
+
+#define CV_CPU_AVX              10
+#define CV_CPU_AVX2             11
+#define CV_CPU_FMA3             12
+
+#define CV_CPU_AVX_512F         13
+#define CV_CPU_AVX_512BW        14
+#define CV_CPU_AVX_512CD        15
+#define CV_CPU_AVX_512DQ        16
+#define CV_CPU_AVX_512ER        17
+#define CV_CPU_AVX_512IFMA512   18
+#define CV_CPU_AVX_512PF        19
+#define CV_CPU_AVX_512VBMI      20
+#define CV_CPU_AVX_512VL        21
+
+#define CV_CPU_NEON   100
+
+// when adding to this list remember to update the following enum
+#define CV_HARDWARE_MAX_FEATURE 255
+
+/** @brief Available CPU features.
+*/
+enum CpuFeatures {
+    CPU_MMX             = 1,
+    CPU_SSE             = 2,
+    CPU_SSE2            = 3,
+    CPU_SSE3            = 4,
+    CPU_SSSE3           = 5,
+    CPU_SSE4_1          = 6,
+    CPU_SSE4_2          = 7,
+    CPU_POPCNT          = 8,
+
+    CPU_AVX             = 10,
+    CPU_AVX2            = 11,
+    CPU_FMA3            = 12,
+
+    CPU_AVX_512F        = 13,
+    CPU_AVX_512BW       = 14,
+    CPU_AVX_512CD       = 15,
+    CPU_AVX_512DQ       = 16,
+    CPU_AVX_512ER       = 17,
+    CPU_AVX_512IFMA512  = 18,
+    CPU_AVX_512PF       = 19,
+    CPU_AVX_512VBMI     = 20,
+    CPU_AVX_512VL       = 21,
+
+    CPU_NEON            = 100
+};
+
+// do not include SSE/AVX/NEON headers for NVCC compiler
+#ifndef __CUDACC__
+
+#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
+#  include <emmintrin.h>
+#  define CV_MMX 1
+#  define CV_SSE 1
+#  define CV_SSE2 1
+#  if defined __SSE3__ || (defined _MSC_VER && _MSC_VER >= 1500)
+#    include <pmmintrin.h>
+#    define CV_SSE3 1
+#  endif
+#  if defined __SSSE3__  || (defined _MSC_VER && _MSC_VER >= 1500)
+#    include <tmmintrin.h>
+#    define CV_SSSE3 1
+#  endif
+#  if defined __SSE4_1__ || (defined _MSC_VER && _MSC_VER >= 1500)
+#    include <smmintrin.h>
+#    define CV_SSE4_1 1
+#  endif
+#  if defined __SSE4_2__ || (defined _MSC_VER && _MSC_VER >= 1500)
+#    include <nmmintrin.h>
+#    define CV_SSE4_2 1
+#  endif
+#  if defined __POPCNT__ || (defined _MSC_VER && _MSC_VER >= 1500)
+#    ifdef _MSC_VER
+#      include <nmmintrin.h>
+#    else
+#      include <popcntintrin.h>
+#    endif
+#    define CV_POPCNT 1
+#  endif
+#  if defined __AVX__ || (defined _MSC_VER && _MSC_VER >= 1600 && 0)
+// MS Visual Studio 2010 (2012?) has no macro pre-defined to identify the use of /arch:AVX
+// See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32
+#    include <immintrin.h>
+#    define CV_AVX 1
+#    if defined(_XCR_XFEATURE_ENABLED_MASK)
+#      define __xgetbv() _xgetbv(_XCR_XFEATURE_ENABLED_MASK)
+#    else
+#      define __xgetbv() 0
+#    endif
+#  endif
+#  if defined __AVX2__ || (defined _MSC_VER && _MSC_VER >= 1800 && 0)
+#    include <immintrin.h>
+#    define CV_AVX2 1
+#    if defined __FMA__
+#      define CV_FMA3 1
+#    endif
+#  endif
+#endif
+
+#if (defined WIN32 || defined _WIN32) && defined(_M_ARM)
+# include <Intrin.h>
+# include "arm_neon.h"
+# define CV_NEON 1
+# define CPU_HAS_NEON_FEATURE (true)
+#elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__))
+#  include <arm_neon.h>
+#  define CV_NEON 1
+#endif
+
+#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__ || defined __ARM_NEON__) && !defined __SOFTFP__
+#  define CV_VFP 1
+#endif
+
+#endif // __CUDACC__
+
+#ifndef CV_POPCNT
+#define CV_POPCNT 0
+#endif
+#ifndef CV_MMX
+#  define CV_MMX 0
+#endif
+#ifndef CV_SSE
+#  define CV_SSE 0
+#endif
+#ifndef CV_SSE2
+#  define CV_SSE2 0
+#endif
+#ifndef CV_SSE3
+#  define CV_SSE3 0
+#endif
+#ifndef CV_SSSE3
+#  define CV_SSSE3 0
+#endif
+#ifndef CV_SSE4_1
+#  define CV_SSE4_1 0
+#endif
+#ifndef CV_SSE4_2
+#  define CV_SSE4_2 0
+#endif
+#ifndef CV_AVX
+#  define CV_AVX 0
+#endif
+#ifndef CV_AVX2
+#  define CV_AVX2 0
+#endif
+#ifndef CV_FMA3
+#  define CV_FMA3 0
+#endif
+#ifndef CV_AVX_512F
+#  define CV_AVX_512F 0
+#endif
+#ifndef CV_AVX_512BW
+#  define CV_AVX_512BW 0
+#endif
+#ifndef CV_AVX_512CD
+#  define CV_AVX_512CD 0
+#endif
+#ifndef CV_AVX_512DQ
+#  define CV_AVX_512DQ 0
+#endif
+#ifndef CV_AVX_512ER
+#  define CV_AVX_512ER 0
+#endif
+#ifndef CV_AVX_512IFMA512
+#  define CV_AVX_512IFMA512 0
+#endif
+#ifndef CV_AVX_512PF
+#  define CV_AVX_512PF 0
+#endif
+#ifndef CV_AVX_512VBMI
+#  define CV_AVX_512VBMI 0
+#endif
+#ifndef CV_AVX_512VL
+#  define CV_AVX_512VL 0
+#endif
+
+#ifndef CV_NEON
+#  define CV_NEON 0
+#endif
+
+#ifndef CV_VFP
+#  define CV_VFP 0
+#endif
+
+/* fundamental constants */
+#define CV_PI   3.1415926535897932384626433832795
+#define CV_2PI 6.283185307179586476925286766559
+#define CV_LOG2 0.69314718055994530941723212145818
+
+typedef union Cv32suf
+{
+    int i;
+    unsigned u;
+    float f;
+}
+Cv32suf;
+
+typedef union Cv64suf
+{
+    int64 i;
+    uint64 u;
+    double f;
+}
+Cv64suf;
+
+#define OPENCV_ABI_COMPATIBILITY 300
+
+#ifdef __OPENCV_BUILD
+#  define DISABLE_OPENCV_24_COMPATIBILITY
+#endif
+
+#if (defined WIN32 || defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined CVAPI_EXPORTS
+#  define CV_EXPORTS __declspec(dllexport)
+#elif defined __GNUC__ && __GNUC__ >= 4
+#  define CV_EXPORTS __attribute__ ((visibility ("default")))
+#else
+#  define CV_EXPORTS
+#endif
+
+#ifndef CV_EXTERN_C
+#  ifdef __cplusplus
+#    define CV_EXTERN_C extern "C"
+#  else
+#    define CV_EXTERN_C
+#  endif
+#endif
+
+/* special informative macros for wrapper generators */
+#define CV_EXPORTS_W CV_EXPORTS
+#define CV_EXPORTS_W_SIMPLE CV_EXPORTS
+#define CV_EXPORTS_AS(synonym) CV_EXPORTS
+#define CV_EXPORTS_W_MAP CV_EXPORTS
+#define CV_IN_OUT
+#define CV_OUT
+#define CV_PROP
+#define CV_PROP_RW
+#define CV_WRAP
+#define CV_WRAP_AS(synonym)
+
+/****************************************************************************************\
+*                                  Matrix type (Mat)                                     *
+\****************************************************************************************/
+
+#define CV_CN_MAX     512
+#define CV_CN_SHIFT   3
+#define CV_DEPTH_MAX  (1 << CV_CN_SHIFT)
+
+#define CV_8U   0
+#define CV_8S   1
+#define CV_16U  2
+#define CV_16S  3
+#define CV_32S  4
+#define CV_32F  5
+#define CV_64F  6
+#define CV_USRTYPE1 7
+
+#define CV_MAT_DEPTH_MASK       (CV_DEPTH_MAX - 1)
+#define CV_MAT_DEPTH(flags)     ((flags) & CV_MAT_DEPTH_MASK)
+
+#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
+#define CV_MAKE_TYPE CV_MAKETYPE
+
+#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
+#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
+#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
+#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
+#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
+
+#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
+#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
+#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
+#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
+#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
+
+#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
+#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
+#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
+#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
+#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
+
+#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
+#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
+#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
+#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
+#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
+
+#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
+#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
+#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
+#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
+#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
+
+#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
+#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
+#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
+#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
+#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
+
+#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
+#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
+#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
+#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
+#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
+
+#define CV_MAT_CN_MASK          ((CV_CN_MAX - 1) << CV_CN_SHIFT)
+#define CV_MAT_CN(flags)        ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
+#define CV_MAT_TYPE_MASK        (CV_DEPTH_MAX*CV_CN_MAX - 1)
+#define CV_MAT_TYPE(flags)      ((flags) & CV_MAT_TYPE_MASK)
+#define CV_MAT_CONT_FLAG_SHIFT  14
+#define CV_MAT_CONT_FLAG        (1 << CV_MAT_CONT_FLAG_SHIFT)
+#define CV_IS_MAT_CONT(flags)   ((flags) & CV_MAT_CONT_FLAG)
+#define CV_IS_CONT_MAT          CV_IS_MAT_CONT
+#define CV_SUBMAT_FLAG_SHIFT    15
+#define CV_SUBMAT_FLAG          (1 << CV_SUBMAT_FLAG_SHIFT)
+#define CV_IS_SUBMAT(flags)     ((flags) & CV_MAT_SUBMAT_FLAG)
+
+/** Size of each channel item,
+   0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
+#define CV_ELEM_SIZE1(type) \
+    ((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15)
+
+/** 0x3a50 = 11 10 10 01 01 00 00 ~ array of log2(sizeof(arr_type_elem)) */
+#define CV_ELEM_SIZE(type) \
+    (CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
+
+#ifndef MIN
+#  define MIN(a,b)  ((a) > (b) ? (b) : (a))
+#endif
+
+#ifndef MAX
+#  define MAX(a,b)  ((a) < (b) ? (b) : (a))
+#endif
+
+/****************************************************************************************\
+*          exchange-add operation for atomic operations on reference counters            *
+\****************************************************************************************/
+
+#if defined __INTEL_COMPILER && !(defined WIN32 || defined _WIN32)
+   // atomic increment on the linux version of the Intel(tm) compiler
+#  define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(addr)), delta)
+#elif defined __GNUC__
+#  if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined(__CUDACC__)
+#    ifdef __ATOMIC_ACQ_REL
+#      define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), delta, __ATOMIC_ACQ_REL)
+#    else
+#      define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int)*)(addr), delta, 4)
+#    endif
+#  else
+#    if defined __ATOMIC_ACQ_REL && !defined __clang__
+       // version for gcc >= 4.7
+#      define CV_XADD(addr, delta) (int)__atomic_fetch_add((unsigned*)(addr), (unsigned)(delta), __ATOMIC_ACQ_REL)
+#    else
+#      define CV_XADD(addr, delta) (int)__sync_fetch_and_add((unsigned*)(addr), (unsigned)(delta))
+#    endif
+#  endif
+#elif defined _MSC_VER && !defined RC_INVOKED
+#  include <intrin.h>
+#  define CV_XADD(addr, delta) (int)_InterlockedExchangeAdd((long volatile*)addr, delta)
+#else
+   CV_INLINE CV_XADD(int* addr, int delta) { int tmp = *addr; *addr += delta; return tmp; }
+#endif
+
+
+/****************************************************************************************\
+*                                  CV_NORETURN attribute                                 *
+\****************************************************************************************/
+
+#ifndef CV_NORETURN
+#  if defined(__GNUC__)
+#    define CV_NORETURN __attribute__((__noreturn__))
+#  elif defined(_MSC_VER) && (_MSC_VER >= 1300)
+#    define CV_NORETURN __declspec(noreturn)
+#  else
+#    define CV_NORETURN /* nothing by default */
+#  endif
+#endif
+
+
+/****************************************************************************************\
+*                                    C++ Move semantics                                  *
+\****************************************************************************************/
+
+#ifndef CV_CXX_MOVE_SEMANTICS
+#  if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(_MSC_VER) && _MSC_VER >= 1600
+#    define CV_CXX_MOVE_SEMANTICS 1
+#  elif defined(__clang)
+#    if __has_feature(cxx_rvalue_references)
+#      define CV_CXX_MOVE_SEMANTICS 1
+#    endif
+#  endif
+#else
+#  if CV_CXX_MOVE_SEMANTICS == 0
+#    undef CV_CXX_MOVE_SEMANTICS
+#  endif
+#endif
+
+//! @}
+
+#endif // __OPENCV_CORE_CVDEF_H__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp
new file mode 100644
index 0000000..edae954
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvstd.hpp
@@ -0,0 +1,1069 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_CVSTD_HPP__
+#define __OPENCV_CORE_CVSTD_HPP__
+
+#ifndef __cplusplus
+#  error cvstd.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/cvdef.h"
+
+#include <cstddef>
+#include <cstring>
+#include <cctype>
+
+#ifndef OPENCV_NOSTL
+#  include <string>
+#endif
+
+// import useful primitives from stl
+#ifndef OPENCV_NOSTL_TRANSITIONAL
+#  include <algorithm>
+#  include <utility>
+#  include <cstdlib> //for abs(int)
+#  include <cmath>
+
+namespace cv
+{
+    using std::min;
+    using std::max;
+    using std::abs;
+    using std::swap;
+    using std::sqrt;
+    using std::exp;
+    using std::pow;
+    using std::log;
+}
+
+namespace std
+{
+    static inline uchar abs(uchar a) { return a; }
+    static inline ushort abs(ushort a) { return a; }
+    static inline unsigned abs(unsigned a) { return a; }
+    static inline uint64 abs(uint64 a) { return a; }
+}
+
+#else
+namespace cv
+{
+    template<typename T> static inline T min(T a, T b) { return a < b ? a : b; }
+    template<typename T> static inline T max(T a, T b) { return a > b ? a : b; }
+    template<typename T> static inline T abs(T a) { return a < 0 ? -a : a; }
+    template<typename T> static inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
+
+    template<> inline uchar abs(uchar a) { return a; }
+    template<> inline ushort abs(ushort a) { return a; }
+    template<> inline unsigned abs(unsigned a) { return a; }
+    template<> inline uint64 abs(uint64 a) { return a; }
+}
+#endif
+
+namespace cv {
+
+//! @addtogroup core_utils
+//! @{
+
+//////////////////////////// memory management functions ////////////////////////////
+
+/** @brief Allocates an aligned memory buffer.
+
+The function allocates the buffer of the specified size and returns it. When the buffer size is 16
+bytes or more, the returned buffer is aligned to 16 bytes.
+@param bufSize Allocated buffer size.
+ */
+CV_EXPORTS void* fastMalloc(size_t bufSize);
+
+/** @brief Deallocates a memory buffer.
+
+The function deallocates the buffer allocated with fastMalloc . If NULL pointer is passed, the
+function does nothing. C version of the function clears the pointer *pptr* to avoid problems with
+double memory deallocation.
+@param ptr Pointer to the allocated buffer.
+ */
+CV_EXPORTS void fastFree(void* ptr);
+
+/*!
+  The STL-compilant memory Allocator based on cv::fastMalloc() and cv::fastFree()
+*/
+template<typename _Tp> class Allocator
+{
+public:
+    typedef _Tp value_type;
+    typedef value_type* pointer;
+    typedef const value_type* const_pointer;
+    typedef value_type& reference;
+    typedef const value_type& const_reference;
+    typedef size_t size_type;
+    typedef ptrdiff_t difference_type;
+    template<typename U> class rebind { typedef Allocator<U> other; };
+
+    explicit Allocator() {}
+    ~Allocator() {}
+    explicit Allocator(Allocator const&) {}
+    template<typename U>
+    explicit Allocator(Allocator<U> const&) {}
+
+    // address
+    pointer address(reference r) { return &r; }
+    const_pointer address(const_reference r) { return &r; }
+
+    pointer allocate(size_type count, const void* =0) { return reinterpret_cast<pointer>(fastMalloc(count * sizeof (_Tp))); }
+    void deallocate(pointer p, size_type) { fastFree(p); }
+
+    void construct(pointer p, const _Tp& v) { new(static_cast<void*>(p)) _Tp(v); }
+    void destroy(pointer p) { p->~_Tp(); }
+
+    size_type max_size() const { return cv::max(static_cast<_Tp>(-1)/sizeof(_Tp), 1); }
+};
+
+//! @} core_utils
+
+//! @cond IGNORED
+
+namespace detail
+{
+
+// Metafunction to avoid taking a reference to void.
+template<typename T>
+struct RefOrVoid { typedef T& type; };
+
+template<>
+struct RefOrVoid<void>{ typedef void type; };
+
+template<>
+struct RefOrVoid<const void>{ typedef const void type; };
+
+template<>
+struct RefOrVoid<volatile void>{ typedef volatile void type; };
+
+template<>
+struct RefOrVoid<const volatile void>{ typedef const volatile void type; };
+
+// This class would be private to Ptr, if it didn't have to be a non-template.
+struct PtrOwner;
+
+}
+
+template<typename Y>
+struct DefaultDeleter
+{
+    void operator () (Y* p) const;
+};
+
+//! @endcond
+
+//! @addtogroup core_basic
+//! @{
+
+/** @brief Template class for smart pointers with shared ownership
+
+A Ptr\<T\> pretends to be a pointer to an object of type T. Unlike an ordinary pointer, however, the
+object will be automatically cleaned up once all Ptr instances pointing to it are destroyed.
+
+Ptr is similar to boost::shared_ptr that is part of the Boost library
+(<http://www.boost.org/doc/libs/release/libs/smart_ptr/shared_ptr.htm>) and std::shared_ptr from
+the [C++11](http://en.wikipedia.org/wiki/C++11) standard.
+
+This class provides the following advantages:
+-   Default constructor, copy constructor, and assignment operator for an arbitrary C++ class or C
+    structure. For some objects, like files, windows, mutexes, sockets, and others, a copy
+    constructor or an assignment operator are difficult to define. For some other objects, like
+    complex classifiers in OpenCV, copy constructors are absent and not easy to implement. Finally,
+    some of complex OpenCV and your own data structures may be written in C. However, copy
+    constructors and default constructors can simplify programming a lot. Besides, they are often
+    required (for example, by STL containers). By using a Ptr to such an object instead of the
+    object itself, you automatically get all of the necessary constructors and the assignment
+    operator.
+-   *O(1)* complexity of the above-mentioned operations. While some structures, like std::vector,
+    provide a copy constructor and an assignment operator, the operations may take a considerable
+    amount of time if the data structures are large. But if the structures are put into a Ptr, the
+    overhead is small and independent of the data size.
+-   Automatic and customizable cleanup, even for C structures. See the example below with FILE\*.
+-   Heterogeneous collections of objects. The standard STL and most other C++ and OpenCV containers
+    can store only objects of the same type and the same size. The classical solution to store
+    objects of different types in the same container is to store pointers to the base class (Base\*)
+    instead but then you lose the automatic memory management. Again, by using Ptr\<Base\> instead
+    of raw pointers, you can solve the problem.
+
+A Ptr is said to *own* a pointer - that is, for each Ptr there is a pointer that will be deleted
+once all Ptr instances that own it are destroyed. The owned pointer may be null, in which case
+nothing is deleted. Each Ptr also *stores* a pointer. The stored pointer is the pointer the Ptr
+pretends to be; that is, the one you get when you use Ptr::get or the conversion to T\*. It's
+usually the same as the owned pointer, but if you use casts or the general shared-ownership
+constructor, the two may diverge: the Ptr will still own the original pointer, but will itself point
+to something else.
+
+The owned pointer is treated as a black box. The only thing Ptr needs to know about it is how to
+delete it. This knowledge is encapsulated in the *deleter* - an auxiliary object that is associated
+with the owned pointer and shared between all Ptr instances that own it. The default deleter is an
+instance of DefaultDeleter, which uses the standard C++ delete operator; as such it will work with
+any pointer allocated with the standard new operator.
+
+However, if the pointer must be deleted in a different way, you must specify a custom deleter upon
+Ptr construction. A deleter is simply a callable object that accepts the pointer as its sole
+argument. For example, if you want to wrap FILE, you may do so as follows:
+@code
+    Ptr<FILE> f(fopen("myfile.txt", "w"), fclose);
+    if(!f) throw ...;
+    fprintf(f, ....);
+    ...
+    // the file will be closed automatically by f's destructor.
+@endcode
+Alternatively, if you want all pointers of a particular type to be deleted the same way, you can
+specialize DefaultDeleter<T>::operator() for that type, like this:
+@code
+    namespace cv {
+    template<> void DefaultDeleter<FILE>::operator ()(FILE * obj) const
+    {
+        fclose(obj);
+    }
+    }
+@endcode
+For convenience, the following types from the OpenCV C API already have such a specialization that
+calls the appropriate release function:
+-   CvCapture
+-   CvFileStorage
+-   CvHaarClassifierCascade
+-   CvMat
+-   CvMatND
+-   CvMemStorage
+-   CvSparseMat
+-   CvVideoWriter
+-   IplImage
+@note The shared ownership mechanism is implemented with reference counting. As such, cyclic
+ownership (e.g. when object a contains a Ptr to object b, which contains a Ptr to object a) will
+lead to all involved objects never being cleaned up. Avoid such situations.
+@note It is safe to concurrently read (but not write) a Ptr instance from multiple threads and
+therefore it is normally safe to use it in multi-threaded applications. The same is true for Mat and
+other C++ OpenCV classes that use internal reference counts.
+*/
+template<typename T>
+struct Ptr
+{
+    /** Generic programming support. */
+    typedef T element_type;
+
+    /** The default constructor creates a null Ptr - one that owns and stores a null pointer.
+    */
+    Ptr();
+
+    /**
+    If p is null, these are equivalent to the default constructor.
+    Otherwise, these constructors assume ownership of p - that is, the created Ptr owns and stores p
+    and assumes it is the sole owner of it. Don't use them if p is already owned by another Ptr, or
+    else p will get deleted twice.
+    With the first constructor, DefaultDeleter\<Y\>() becomes the associated deleter (so p will
+    eventually be deleted with the standard delete operator). Y must be a complete type at the point
+    of invocation.
+    With the second constructor, d becomes the associated deleter.
+    Y\* must be convertible to T\*.
+    @param p Pointer to own.
+    @note It is often easier to use makePtr instead.
+     */
+    template<typename Y>
+#ifdef DISABLE_OPENCV_24_COMPATIBILITY
+    explicit
+#endif
+    Ptr(Y* p);
+
+    /** @overload
+    @param d Deleter to use for the owned pointer.
+    @param p Pointer to own.
+    */
+    template<typename Y, typename D>
+    Ptr(Y* p, D d);
+
+    /**
+    These constructors create a Ptr that shares ownership with another Ptr - that is, own the same
+    pointer as o.
+    With the first two, the same pointer is stored, as well; for the second, Y\* must be convertible
+    to T\*.
+    With the third, p is stored, and Y may be any type. This constructor allows to have completely
+    unrelated owned and stored pointers, and should be used with care to avoid confusion. A relatively
+    benign use is to create a non-owning Ptr, like this:
+    @code
+        ptr = Ptr<T>(Ptr<T>(), dont_delete_me); // owns nothing; will not delete the pointer.
+    @endcode
+    @param o Ptr to share ownership with.
+    */
+    Ptr(const Ptr& o);
+
+    /** @overload
+    @param o Ptr to share ownership with.
+    */
+    template<typename Y>
+    Ptr(const Ptr<Y>& o);
+
+    /** @overload
+    @param o Ptr to share ownership with.
+    @param p Pointer to store.
+    */
+    template<typename Y>
+    Ptr(const Ptr<Y>& o, T* p);
+
+    /** The destructor is equivalent to calling Ptr::release. */
+    ~Ptr();
+
+    /**
+    Assignment replaces the current Ptr instance with one that owns and stores same pointers as o and
+    then destroys the old instance.
+    @param o Ptr to share ownership with.
+     */
+    Ptr& operator = (const Ptr& o);
+
+    /** @overload */
+    template<typename Y>
+    Ptr& operator = (const Ptr<Y>& o);
+
+    /** If no other Ptr instance owns the owned pointer, deletes it with the associated deleter. Then sets
+    both the owned and the stored pointers to NULL.
+    */
+    void release();
+
+    /**
+    `ptr.reset(...)` is equivalent to `ptr = Ptr<T>(...)`.
+    @param p Pointer to own.
+    */
+    template<typename Y>
+    void reset(Y* p);
+
+    /** @overload
+    @param d Deleter to use for the owned pointer.
+    @param p Pointer to own.
+    */
+    template<typename Y, typename D>
+    void reset(Y* p, D d);
+
+    /**
+    Swaps the owned and stored pointers (and deleters, if any) of this and o.
+    @param o Ptr to swap with.
+    */
+    void swap(Ptr& o);
+
+    /** Returns the stored pointer. */
+    T* get() const;
+
+    /** Ordinary pointer emulation. */
+    typename detail::RefOrVoid<T>::type operator * () const;
+
+    /** Ordinary pointer emulation. */
+    T* operator -> () const;
+
+    /** Equivalent to get(). */
+    operator T* () const;
+
+    /** ptr.empty() is equivalent to `!ptr.get()`. */
+    bool empty() const;
+
+    /** Returns a Ptr that owns the same pointer as this, and stores the same
+       pointer as this, except converted via static_cast to Y*.
+    */
+    template<typename Y>
+    Ptr<Y> staticCast() const;
+
+    /** Ditto for const_cast. */
+    template<typename Y>
+    Ptr<Y> constCast() const;
+
+    /** Ditto for dynamic_cast. */
+    template<typename Y>
+    Ptr<Y> dynamicCast() const;
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+    Ptr(Ptr&& o);
+    Ptr& operator = (Ptr&& o);
+#endif
+
+private:
+    detail::PtrOwner* owner;
+    T* stored;
+
+    template<typename Y>
+    friend struct Ptr; // have to do this for the cross-type copy constructor
+};
+
+/** Equivalent to ptr1.swap(ptr2). Provided to help write generic algorithms. */
+template<typename T>
+void swap(Ptr<T>& ptr1, Ptr<T>& ptr2);
+
+/** Return whether ptr1.get() and ptr2.get() are equal and not equal, respectively. */
+template<typename T>
+bool operator == (const Ptr<T>& ptr1, const Ptr<T>& ptr2);
+template<typename T>
+bool operator != (const Ptr<T>& ptr1, const Ptr<T>& ptr2);
+
+/** `makePtr<T>(...)` is equivalent to `Ptr<T>(new T(...))`. It is shorter than the latter, and it's
+marginally safer than using a constructor or Ptr::reset, since it ensures that the owned pointer
+is new and thus not owned by any other Ptr instance.
+Unfortunately, perfect forwarding is impossible to implement in C++03, and so makePtr is limited
+to constructors of T that have up to 10 arguments, none of which are non-const references.
+ */
+template<typename T>
+Ptr<T> makePtr();
+/** @overload */
+template<typename T, typename A1>
+Ptr<T> makePtr(const A1& a1);
+/** @overload */
+template<typename T, typename A1, typename A2>
+Ptr<T> makePtr(const A1& a1, const A2& a2);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9);
+/** @overload */
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10);
+
+//////////////////////////////// string class ////////////////////////////////
+
+class CV_EXPORTS FileNode; //for string constructor from FileNode
+
+class CV_EXPORTS String
+{
+public:
+    typedef char value_type;
+    typedef char& reference;
+    typedef const char& const_reference;
+    typedef char* pointer;
+    typedef const char* const_pointer;
+    typedef ptrdiff_t difference_type;
+    typedef size_t size_type;
+    typedef char* iterator;
+    typedef const char* const_iterator;
+
+    static const size_t npos = size_t(-1);
+
+    explicit String();
+    String(const String& str);
+    String(const String& str, size_t pos, size_t len = npos);
+    String(const char* s);
+    String(const char* s, size_t n);
+    String(size_t n, char c);
+    String(const char* first, const char* last);
+    template<typename Iterator> String(Iterator first, Iterator last);
+    explicit String(const FileNode& fn);
+    ~String();
+
+    String& operator=(const String& str);
+    String& operator=(const char* s);
+    String& operator=(char c);
+
+    String& operator+=(const String& str);
+    String& operator+=(const char* s);
+    String& operator+=(char c);
+
+    size_t size() const;
+    size_t length() const;
+
+    char operator[](size_t idx) const;
+    char operator[](int idx) const;
+
+    const char* begin() const;
+    const char* end() const;
+
+    const char* c_str() const;
+
+    bool empty() const;
+    void clear();
+
+    int compare(const char* s) const;
+    int compare(const String& str) const;
+
+    void swap(String& str);
+    String substr(size_t pos = 0, size_t len = npos) const;
+
+    size_t find(const char* s, size_t pos, size_t n) const;
+    size_t find(char c, size_t pos = 0) const;
+    size_t find(const String& str, size_t pos = 0) const;
+    size_t find(const char* s, size_t pos = 0) const;
+
+    size_t rfind(const char* s, size_t pos, size_t n) const;
+    size_t rfind(char c, size_t pos = npos) const;
+    size_t rfind(const String& str, size_t pos = npos) const;
+    size_t rfind(const char* s, size_t pos = npos) const;
+
+    size_t find_first_of(const char* s, size_t pos, size_t n) const;
+    size_t find_first_of(char c, size_t pos = 0) const;
+    size_t find_first_of(const String& str, size_t pos = 0) const;
+    size_t find_first_of(const char* s, size_t pos = 0) const;
+
+    size_t find_last_of(const char* s, size_t pos, size_t n) const;
+    size_t find_last_of(char c, size_t pos = npos) const;
+    size_t find_last_of(const String& str, size_t pos = npos) const;
+    size_t find_last_of(const char* s, size_t pos = npos) const;
+
+    friend String operator+ (const String& lhs, const String& rhs);
+    friend String operator+ (const String& lhs, const char*   rhs);
+    friend String operator+ (const char*   lhs, const String& rhs);
+    friend String operator+ (const String& lhs, char          rhs);
+    friend String operator+ (char          lhs, const String& rhs);
+
+    String toLowerCase() const;
+
+#ifndef OPENCV_NOSTL
+    String(const std::string& str);
+    String(const std::string& str, size_t pos, size_t len = npos);
+    String& operator=(const std::string& str);
+    String& operator+=(const std::string& str);
+    operator std::string() const;
+
+    friend String operator+ (const String& lhs, const std::string& rhs);
+    friend String operator+ (const std::string& lhs, const String& rhs);
+#endif
+
+private:
+    char*  cstr_;
+    size_t len_;
+
+    char* allocate(size_t len); // len without trailing 0
+    void deallocate();
+
+    String(int); // disabled and invalid. Catch invalid usages like, commandLineParser.has(0) problem
+};
+
+//! @} core_basic
+
+////////////////////////// cv::String implementation /////////////////////////
+
+//! @cond IGNORED
+
+inline
+String::String()
+    : cstr_(0), len_(0)
+{}
+
+inline
+String::String(const String& str)
+    : cstr_(str.cstr_), len_(str.len_)
+{
+    if (cstr_)
+        CV_XADD(((int*)cstr_)-1, 1);
+}
+
+inline
+String::String(const String& str, size_t pos, size_t len)
+    : cstr_(0), len_(0)
+{
+    pos = min(pos, str.len_);
+    len = min(str.len_ - pos, len);
+    if (!len) return;
+    if (len == str.len_)
+    {
+        CV_XADD(((int*)str.cstr_)-1, 1);
+        cstr_ = str.cstr_;
+        len_ = str.len_;
+        return;
+    }
+    memcpy(allocate(len), str.cstr_ + pos, len);
+}
+
+inline
+String::String(const char* s)
+    : cstr_(0), len_(0)
+{
+    if (!s) return;
+    size_t len = strlen(s);
+    memcpy(allocate(len), s, len);
+}
+
+inline
+String::String(const char* s, size_t n)
+    : cstr_(0), len_(0)
+{
+    if (!n) return;
+    memcpy(allocate(n), s, n);
+}
+
+inline
+String::String(size_t n, char c)
+    : cstr_(0), len_(0)
+{
+    memset(allocate(n), c, n);
+}
+
+inline
+String::String(const char* first, const char* last)
+    : cstr_(0), len_(0)
+{
+    size_t len = (size_t)(last - first);
+    memcpy(allocate(len), first, len);
+}
+
+template<typename Iterator> inline
+String::String(Iterator first, Iterator last)
+    : cstr_(0), len_(0)
+{
+    size_t len = (size_t)(last - first);
+    char* str = allocate(len);
+    while (first != last)
+    {
+        *str++ = *first;
+        ++first;
+    }
+}
+
+inline
+String::~String()
+{
+    deallocate();
+}
+
+inline
+String& String::operator=(const String& str)
+{
+    if (&str == this) return *this;
+
+    deallocate();
+    if (str.cstr_) CV_XADD(((int*)str.cstr_)-1, 1);
+    cstr_ = str.cstr_;
+    len_ = str.len_;
+    return *this;
+}
+
+inline
+String& String::operator=(const char* s)
+{
+    deallocate();
+    if (!s) return *this;
+    size_t len = strlen(s);
+    memcpy(allocate(len), s, len);
+    return *this;
+}
+
+inline
+String& String::operator=(char c)
+{
+    deallocate();
+    allocate(1)[0] = c;
+    return *this;
+}
+
+inline
+String& String::operator+=(const String& str)
+{
+    *this = *this + str;
+    return *this;
+}
+
+inline
+String& String::operator+=(const char* s)
+{
+    *this = *this + s;
+    return *this;
+}
+
+inline
+String& String::operator+=(char c)
+{
+    *this = *this + c;
+    return *this;
+}
+
+inline
+size_t String::size() const
+{
+    return len_;
+}
+
+inline
+size_t String::length() const
+{
+    return len_;
+}
+
+inline
+char String::operator[](size_t idx) const
+{
+    return cstr_[idx];
+}
+
+inline
+char String::operator[](int idx) const
+{
+    return cstr_[idx];
+}
+
+inline
+const char* String::begin() const
+{
+    return cstr_;
+}
+
+inline
+const char* String::end() const
+{
+    return len_ ? cstr_ + 1 : 0;
+}
+
+inline
+bool String::empty() const
+{
+    return len_ == 0;
+}
+
+inline
+const char* String::c_str() const
+{
+    return cstr_ ? cstr_ : "";
+}
+
+inline
+void String::swap(String& str)
+{
+    cv::swap(cstr_, str.cstr_);
+    cv::swap(len_, str.len_);
+}
+
+inline
+void String::clear()
+{
+    deallocate();
+}
+
+inline
+int String::compare(const char* s) const
+{
+    if (cstr_ == s) return 0;
+    return strcmp(c_str(), s);
+}
+
+inline
+int String::compare(const String& str) const
+{
+    if (cstr_ == str.cstr_) return 0;
+    return strcmp(c_str(), str.c_str());
+}
+
+inline
+String String::substr(size_t pos, size_t len) const
+{
+    return String(*this, pos, len);
+}
+
+inline
+size_t String::find(const char* s, size_t pos, size_t n) const
+{
+    if (n == 0 || pos + n > len_) return npos;
+    const char* lmax = cstr_ + len_ - n;
+    for (const char* i = cstr_ + pos; i <= lmax; ++i)
+    {
+        size_t j = 0;
+        while (j < n && s[j] == i[j]) ++j;
+        if (j == n) return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::find(char c, size_t pos) const
+{
+    return find(&c, pos, 1);
+}
+
+inline
+size_t String::find(const String& str, size_t pos) const
+{
+    return find(str.c_str(), pos, str.len_);
+}
+
+inline
+size_t String::find(const char* s, size_t pos) const
+{
+    if (pos >= len_ || !s[0]) return npos;
+    const char* lmax = cstr_ + len_;
+    for (const char* i = cstr_ + pos; i < lmax; ++i)
+    {
+        size_t j = 0;
+        while (s[j] && s[j] == i[j])
+        {   if(i + j >= lmax) return npos;
+            ++j;
+        }
+        if (!s[j]) return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::rfind(const char* s, size_t pos, size_t n) const
+{
+    if (n > len_) return npos;
+    if (pos > len_ - n) pos = len_ - n;
+    for (const char* i = cstr_ + pos; i >= cstr_; --i)
+    {
+        size_t j = 0;
+        while (j < n && s[j] == i[j]) ++j;
+        if (j == n) return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::rfind(char c, size_t pos) const
+{
+    return rfind(&c, pos, 1);
+}
+
+inline
+size_t String::rfind(const String& str, size_t pos) const
+{
+    return rfind(str.c_str(), pos, str.len_);
+}
+
+inline
+size_t String::rfind(const char* s, size_t pos) const
+{
+    return rfind(s, pos, strlen(s));
+}
+
+inline
+size_t String::find_first_of(const char* s, size_t pos, size_t n) const
+{
+    if (n == 0 || pos + n > len_) return npos;
+    const char* lmax = cstr_ + len_;
+    for (const char* i = cstr_ + pos; i < lmax; ++i)
+    {
+        for (size_t j = 0; j < n; ++j)
+            if (s[j] == *i)
+                return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::find_first_of(char c, size_t pos) const
+{
+    return find_first_of(&c, pos, 1);
+}
+
+inline
+size_t String::find_first_of(const String& str, size_t pos) const
+{
+    return find_first_of(str.c_str(), pos, str.len_);
+}
+
+inline
+size_t String::find_first_of(const char* s, size_t pos) const
+{
+    if (len_ == 0) return npos;
+    if (pos >= len_ || !s[0]) return npos;
+    const char* lmax = cstr_ + len_;
+    for (const char* i = cstr_ + pos; i < lmax; ++i)
+    {
+        for (size_t j = 0; s[j]; ++j)
+            if (s[j] == *i)
+                return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::find_last_of(const char* s, size_t pos, size_t n) const
+{
+    if (len_ == 0) return npos;
+    if (pos >= len_) pos = len_ - 1;
+    for (const char* i = cstr_ + pos; i >= cstr_; --i)
+    {
+        for (size_t j = 0; j < n; ++j)
+            if (s[j] == *i)
+                return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+size_t String::find_last_of(char c, size_t pos) const
+{
+    return find_last_of(&c, pos, 1);
+}
+
+inline
+size_t String::find_last_of(const String& str, size_t pos) const
+{
+    return find_last_of(str.c_str(), pos, str.len_);
+}
+
+inline
+size_t String::find_last_of(const char* s, size_t pos) const
+{
+    if (len_ == 0) return npos;
+    if (pos >= len_) pos = len_ - 1;
+    for (const char* i = cstr_ + pos; i >= cstr_; --i)
+    {
+        for (size_t j = 0; s[j]; ++j)
+            if (s[j] == *i)
+                return (size_t)(i - cstr_);
+    }
+    return npos;
+}
+
+inline
+String String::toLowerCase() const
+{
+    String res(cstr_, len_);
+
+    for (size_t i = 0; i < len_; ++i)
+        res.cstr_[i] = (char) ::tolower(cstr_[i]);
+
+    return res;
+}
+
+//! @endcond
+
+// ************************* cv::String non-member functions *************************
+
+//! @relates cv::String
+//! @{
+
+inline
+String operator + (const String& lhs, const String& rhs)
+{
+    String s;
+    s.allocate(lhs.len_ + rhs.len_);
+    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
+    memcpy(s.cstr_ + lhs.len_, rhs.cstr_, rhs.len_);
+    return s;
+}
+
+inline
+String operator + (const String& lhs, const char* rhs)
+{
+    String s;
+    size_t rhslen = strlen(rhs);
+    s.allocate(lhs.len_ + rhslen);
+    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
+    memcpy(s.cstr_ + lhs.len_, rhs, rhslen);
+    return s;
+}
+
+inline
+String operator + (const char* lhs, const String& rhs)
+{
+    String s;
+    size_t lhslen = strlen(lhs);
+    s.allocate(lhslen + rhs.len_);
+    memcpy(s.cstr_, lhs, lhslen);
+    memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
+    return s;
+}
+
+inline
+String operator + (const String& lhs, char rhs)
+{
+    String s;
+    s.allocate(lhs.len_ + 1);
+    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
+    s.cstr_[lhs.len_] = rhs;
+    return s;
+}
+
+inline
+String operator + (char lhs, const String& rhs)
+{
+    String s;
+    s.allocate(rhs.len_ + 1);
+    s.cstr_[0] = lhs;
+    memcpy(s.cstr_ + 1, rhs.cstr_, rhs.len_);
+    return s;
+}
+
+static inline bool operator== (const String& lhs, const String& rhs) { return 0 == lhs.compare(rhs); }
+static inline bool operator== (const char*   lhs, const String& rhs) { return 0 == rhs.compare(lhs); }
+static inline bool operator== (const String& lhs, const char*   rhs) { return 0 == lhs.compare(rhs); }
+static inline bool operator!= (const String& lhs, const String& rhs) { return 0 != lhs.compare(rhs); }
+static inline bool operator!= (const char*   lhs, const String& rhs) { return 0 != rhs.compare(lhs); }
+static inline bool operator!= (const String& lhs, const char*   rhs) { return 0 != lhs.compare(rhs); }
+static inline bool operator<  (const String& lhs, const String& rhs) { return lhs.compare(rhs) <  0; }
+static inline bool operator<  (const char*   lhs, const String& rhs) { return rhs.compare(lhs) >  0; }
+static inline bool operator<  (const String& lhs, const char*   rhs) { return lhs.compare(rhs) <  0; }
+static inline bool operator<= (const String& lhs, const String& rhs) { return lhs.compare(rhs) <= 0; }
+static inline bool operator<= (const char*   lhs, const String& rhs) { return rhs.compare(lhs) >= 0; }
+static inline bool operator<= (const String& lhs, const char*   rhs) { return lhs.compare(rhs) <= 0; }
+static inline bool operator>  (const String& lhs, const String& rhs) { return lhs.compare(rhs) >  0; }
+static inline bool operator>  (const char*   lhs, const String& rhs) { return rhs.compare(lhs) <  0; }
+static inline bool operator>  (const String& lhs, const char*   rhs) { return lhs.compare(rhs) >  0; }
+static inline bool operator>= (const String& lhs, const String& rhs) { return lhs.compare(rhs) >= 0; }
+static inline bool operator>= (const char*   lhs, const String& rhs) { return rhs.compare(lhs) <= 0; }
+static inline bool operator>= (const String& lhs, const char*   rhs) { return lhs.compare(rhs) >= 0; }
+
+//! @} relates cv::String
+
+} // cv
+
+#ifndef OPENCV_NOSTL_TRANSITIONAL
+namespace std
+{
+    static inline void swap(cv::String& a, cv::String& b) { a.swap(b); }
+}
+#else
+namespace cv
+{
+    template<> inline
+    void swap<cv::String>(cv::String& a, cv::String& b)
+    {
+        a.swap(b);
+    }
+}
+#endif
+
+#include "opencv2/core/ptr.inl.hpp"
+
+#endif //__OPENCV_CORE_CVSTD_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp
new file mode 100644
index 0000000..ad15406
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/cvstd.inl.hpp
@@ -0,0 +1,267 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_CVSTDINL_HPP__
+#define __OPENCV_CORE_CVSTDINL_HPP__
+
+#ifndef OPENCV_NOSTL
+#  include <complex>
+#  include <ostream>
+#endif
+
+//! @cond IGNORED
+
+namespace cv
+{
+#ifndef OPENCV_NOSTL
+
+template<typename _Tp> class DataType< std::complex<_Tp> >
+{
+public:
+    typedef std::complex<_Tp>  value_type;
+    typedef value_type         work_type;
+    typedef _Tp                channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels) };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+inline
+String::String(const std::string& str)
+    : cstr_(0), len_(0)
+{
+    if (!str.empty())
+    {
+        size_t len = str.size();
+        memcpy(allocate(len), str.c_str(), len);
+    }
+}
+
+inline
+String::String(const std::string& str, size_t pos, size_t len)
+    : cstr_(0), len_(0)
+{
+    size_t strlen = str.size();
+    pos = min(pos, strlen);
+    len = min(strlen - pos, len);
+    if (!len) return;
+    memcpy(allocate(len), str.c_str() + pos, len);
+}
+
+inline
+String& String::operator = (const std::string& str)
+{
+    deallocate();
+    if (!str.empty())
+    {
+        size_t len = str.size();
+        memcpy(allocate(len), str.c_str(), len);
+    }
+    return *this;
+}
+
+inline
+String& String::operator += (const std::string& str)
+{
+    *this = *this + str;
+    return *this;
+}
+
+inline
+String::operator std::string() const
+{
+    return std::string(cstr_, len_);
+}
+
+inline
+String operator + (const String& lhs, const std::string& rhs)
+{
+    String s;
+    size_t rhslen = rhs.size();
+    s.allocate(lhs.len_ + rhslen);
+    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
+    memcpy(s.cstr_ + lhs.len_, rhs.c_str(), rhslen);
+    return s;
+}
+
+inline
+String operator + (const std::string& lhs, const String& rhs)
+{
+    String s;
+    size_t lhslen = lhs.size();
+    s.allocate(lhslen + rhs.len_);
+    memcpy(s.cstr_, lhs.c_str(), lhslen);
+    memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
+    return s;
+}
+
+inline
+FileNode::operator std::string() const
+{
+    String value;
+    read(*this, value, value);
+    return value;
+}
+
+template<> inline
+void operator >> (const FileNode& n, std::string& value)
+{
+    String val;
+    read(n, val, val);
+    value = val;
+}
+
+template<> inline
+FileStorage& operator << (FileStorage& fs, const std::string& value)
+{
+    return fs << cv::String(value);
+}
+
+static inline
+std::ostream& operator << (std::ostream& os, const String& str)
+{
+    return os << str.c_str();
+}
+
+static inline
+std::ostream& operator << (std::ostream& out, Ptr<Formatted> fmtd)
+{
+    fmtd->reset();
+    for(const char* str = fmtd->next(); str; str = fmtd->next())
+        out << str;
+    return out;
+}
+
+static inline
+std::ostream& operator << (std::ostream& out, const Mat& mtx)
+{
+    return out << Formatter::get()->format(mtx);
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const std::vector<Point_<_Tp> >& vec)
+{
+    return out << Formatter::get()->format(Mat(vec));
+}
+
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const std::vector<Point3_<_Tp> >& vec)
+{
+    return out << Formatter::get()->format(Mat(vec));
+}
+
+
+template<typename _Tp, int m, int n> static inline
+std::ostream& operator << (std::ostream& out, const Matx<_Tp, m, n>& matx)
+{
+    return out << Formatter::get()->format(Mat(matx));
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Point_<_Tp>& p)
+{
+    out << "[" << p.x << ", " << p.y << "]";
+    return out;
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Point3_<_Tp>& p)
+{
+    out << "[" << p.x << ", " << p.y << ", " << p.z << "]";
+    return out;
+}
+
+template<typename _Tp, int n> static inline
+std::ostream& operator << (std::ostream& out, const Vec<_Tp, n>& vec)
+{
+    out << "[";
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable: 4127 )
+#endif
+    if(Vec<_Tp, n>::depth < CV_32F)
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+    {
+        for (int i = 0; i < n - 1; ++i) {
+            out << (int)vec[i] << ", ";
+        }
+        out << (int)vec[n-1] << "]";
+    }
+    else
+    {
+        for (int i = 0; i < n - 1; ++i) {
+            out << vec[i] << ", ";
+        }
+        out << vec[n-1] << "]";
+    }
+
+    return out;
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Size_<_Tp>& size)
+{
+    return out << "[" << size.width << " x " << size.height << "]";
+}
+
+template<typename _Tp> static inline
+std::ostream& operator << (std::ostream& out, const Rect_<_Tp>& rect)
+{
+    return out << "[" << rect.width << " x " << rect.height << " from (" << rect.x << ", " << rect.y << ")]";
+}
+
+
+#endif // OPENCV_NOSTL
+} // cv
+
+//! @endcond
+
+#endif // __OPENCV_CORE_CVSTDINL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp
new file mode 100644
index 0000000..764af74
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/directx.hpp
@@ -0,0 +1,184 @@
+/*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) 2010-2013, Advanced Micro Devices, 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 copyright holders 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*/
+
+#ifndef __OPENCV_CORE_DIRECTX_HPP__
+#define __OPENCV_CORE_DIRECTX_HPP__
+
+#include "mat.hpp"
+#include "ocl.hpp"
+
+#if !defined(__d3d11_h__)
+struct ID3D11Device;
+struct ID3D11Texture2D;
+#endif
+
+#if !defined(__d3d10_h__)
+struct ID3D10Device;
+struct ID3D10Texture2D;
+#endif
+
+#if !defined(_D3D9_H_)
+struct IDirect3DDevice9;
+struct IDirect3DDevice9Ex;
+struct IDirect3DSurface9;
+#endif
+
+
+namespace cv { namespace directx {
+
+namespace ocl {
+using namespace cv::ocl;
+
+//! @addtogroup core_directx
+// This section describes OpenCL and DirectX interoperability.
+//
+// To enable DirectX support, configure OpenCV using CMake with WITH_DIRECTX=ON . Note, DirectX is
+// supported only on Windows.
+//
+// To use OpenCL functionality you should first initialize OpenCL context from DirectX resource.
+//
+//! @{
+
+// TODO static functions in the Context class
+//! @brief Creates OpenCL context from D3D11 device
+//
+//! @param pD3D11Device - pointer to D3D11 device
+//! @return Returns reference to OpenCL Context
+CV_EXPORTS Context& initializeContextFromD3D11Device(ID3D11Device* pD3D11Device);
+
+//! @brief Creates OpenCL context from D3D10 device
+//
+//! @param pD3D10Device - pointer to D3D10 device
+//! @return Returns reference to OpenCL Context
+CV_EXPORTS Context& initializeContextFromD3D10Device(ID3D10Device* pD3D10Device);
+
+//! @brief Creates OpenCL context from Direct3DDevice9Ex device
+//
+//! @param pDirect3DDevice9Ex - pointer to Direct3DDevice9Ex device
+//! @return Returns reference to OpenCL Context
+CV_EXPORTS Context& initializeContextFromDirect3DDevice9Ex(IDirect3DDevice9Ex* pDirect3DDevice9Ex);
+
+//! @brief Creates OpenCL context from Direct3DDevice9 device
+//
+//! @param pDirect3DDevice9 - pointer to Direct3Device9 device
+//! @return Returns reference to OpenCL Context
+CV_EXPORTS Context& initializeContextFromDirect3DDevice9(IDirect3DDevice9* pDirect3DDevice9);
+
+//! @}
+
+} // namespace cv::directx::ocl
+
+//! @addtogroup core_directx
+//! @{
+
+//! @brief Converts InputArray to ID3D11Texture2D. If destination texture format is DXGI_FORMAT_NV12 then
+//!        input UMat expected to be in BGR format and data will be downsampled and color-converted to NV12.
+//
+//! @note Note: Destination texture must be allocated by application. Function does memory copy from src to
+//!             pD3D11Texture2D
+//
+//! @param src - source InputArray
+//! @param pD3D11Texture2D - destination D3D11 texture
+CV_EXPORTS void convertToD3D11Texture2D(InputArray src, ID3D11Texture2D* pD3D11Texture2D);
+
+//! @brief Converts ID3D11Texture2D to OutputArray. If input texture format is DXGI_FORMAT_NV12 then
+//!        data will be upsampled and color-converted to BGR format.
+//
+//! @note Note: Destination matrix will be re-allocated if it has not enough memory to match texture size.
+//!             function does memory copy from pD3D11Texture2D to dst
+//
+//! @param pD3D11Texture2D - source D3D11 texture
+//! @param dst             - destination OutputArray
+CV_EXPORTS void convertFromD3D11Texture2D(ID3D11Texture2D* pD3D11Texture2D, OutputArray dst);
+
+//! @brief Converts InputArray to ID3D10Texture2D
+//
+//! @note Note: function does memory copy from src to
+//!             pD3D10Texture2D
+//
+//! @param src             - source InputArray
+//! @param pD3D10Texture2D - destination D3D10 texture
+CV_EXPORTS void convertToD3D10Texture2D(InputArray src, ID3D10Texture2D* pD3D10Texture2D);
+
+//! @brief Converts ID3D10Texture2D to OutputArray
+//
+//! @note Note: function does memory copy from pD3D10Texture2D
+//!             to dst
+//
+//! @param pD3D10Texture2D - source D3D10 texture
+//! @param dst             - destination OutputArray
+CV_EXPORTS void convertFromD3D10Texture2D(ID3D10Texture2D* pD3D10Texture2D, OutputArray dst);
+
+//! @brief Converts InputArray to IDirect3DSurface9
+//
+//! @note Note: function does memory copy from src to
+//!             pDirect3DSurface9
+//
+//! @param src                 - source InputArray
+//! @param pDirect3DSurface9   - destination D3D10 texture
+//! @param surfaceSharedHandle - shared handle
+CV_EXPORTS void convertToDirect3DSurface9(InputArray src, IDirect3DSurface9* pDirect3DSurface9, void* surfaceSharedHandle = NULL);
+
+//! @brief Converts IDirect3DSurface9 to OutputArray
+//
+//! @note Note: function does memory copy from pDirect3DSurface9
+//!             to dst
+//
+//! @param pDirect3DSurface9   - source D3D10 texture
+//! @param dst                 - destination OutputArray
+//! @param surfaceSharedHandle - shared handle
+CV_EXPORTS void convertFromDirect3DSurface9(IDirect3DSurface9* pDirect3DSurface9, OutputArray dst, void* surfaceSharedHandle = NULL);
+
+//! @brief Get OpenCV type from DirectX type
+//! @param iDXGI_FORMAT - enum DXGI_FORMAT for D3D10/D3D11
+//! @return OpenCV type or -1 if there is no equivalent
+CV_EXPORTS int getTypeFromDXGI_FORMAT(const int iDXGI_FORMAT); // enum DXGI_FORMAT for D3D10/D3D11
+
+//! @brief Get OpenCV type from DirectX type
+//! @param iD3DFORMAT - enum D3DTYPE for D3D9
+//! @return OpenCV type or -1 if there is no equivalent
+CV_EXPORTS int getTypeFromD3DFORMAT(const int iD3DFORMAT); // enum D3DTYPE for D3D9
+
+//! @}
+
+} } // namespace cv::directx
+
+#endif // __OPENCV_CORE_DIRECTX_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp
new file mode 100644
index 0000000..44df04c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/eigen.hpp
@@ -0,0 +1,280 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+
+#ifndef __OPENCV_CORE_EIGEN_HPP__
+#define __OPENCV_CORE_EIGEN_HPP__
+
+#include "opencv2/core.hpp"
+
+#if defined _MSC_VER && _MSC_VER >= 1200
+#pragma warning( disable: 4714 ) //__forceinline is not inlined
+#pragma warning( disable: 4127 ) //conditional expression is constant
+#pragma warning( disable: 4244 ) //conversion from '__int64' to 'int', possible loss of data
+#endif
+
+namespace cv
+{
+
+//! @addtogroup core_eigen
+//! @{
+
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
+void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, Mat& dst )
+{
+    if( !(src.Flags & Eigen::RowMajorBit) )
+    {
+        Mat _src(src.cols(), src.rows(), DataType<_Tp>::type,
+              (void*)src.data(), src.stride()*sizeof(_Tp));
+        transpose(_src, dst);
+    }
+    else
+    {
+        Mat _src(src.rows(), src.cols(), DataType<_Tp>::type,
+                 (void*)src.data(), src.stride()*sizeof(_Tp));
+        _src.copyTo(dst);
+    }
+}
+
+// Matx case
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
+void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
+               Matx<_Tp, _rows, _cols>& dst )
+{
+    if( !(src.Flags & Eigen::RowMajorBit) )
+    {
+        dst = Matx<_Tp, _cols, _rows>(static_cast<const _Tp*>(src.data())).t();
+    }
+    else
+    {
+        dst = Matx<_Tp, _rows, _cols>(static_cast<const _Tp*>(src.data()));
+    }
+}
+
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
+void cv2eigen( const Mat& src,
+               Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
+{
+    CV_DbgAssert(src.rows == _rows && src.cols == _cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        if( src.type() == _dst.type() )
+            transpose(src, _dst);
+        else if( src.cols == src.rows )
+        {
+            src.convertTo(_dst, _dst.type());
+            transpose(_dst, _dst);
+        }
+        else
+            Mat(src.t()).convertTo(_dst, _dst.type());
+    }
+    else
+    {
+        const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.convertTo(_dst, _dst.type());
+    }
+}
+
+// Matx case
+template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
+void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
+               Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
+{
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(_cols, _rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        transpose(src, _dst);
+    }
+    else
+    {
+        const Mat _dst(_rows, _cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        Mat(src).copyTo(_dst);
+    }
+}
+
+template<typename _Tp>  static inline
+void cv2eigen( const Mat& src,
+               Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
+{
+    dst.resize(src.rows, src.cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
+             dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        if( src.type() == _dst.type() )
+            transpose(src, _dst);
+        else if( src.cols == src.rows )
+        {
+            src.convertTo(_dst, _dst.type());
+            transpose(_dst, _dst);
+        }
+        else
+            Mat(src.t()).convertTo(_dst, _dst.type());
+    }
+    else
+    {
+        const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.convertTo(_dst, _dst.type());
+    }
+}
+
+// Matx case
+template<typename _Tp, int _rows, int _cols> static inline
+void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
+               Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
+{
+    dst.resize(_rows, _cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(_cols, _rows, DataType<_Tp>::type,
+             dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        transpose(src, _dst);
+    }
+    else
+    {
+        const Mat _dst(_rows, _cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        Mat(src).copyTo(_dst);
+    }
+}
+
+template<typename _Tp> static inline
+void cv2eigen( const Mat& src,
+               Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
+{
+    CV_Assert(src.cols == 1);
+    dst.resize(src.rows);
+
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        if( src.type() == _dst.type() )
+            transpose(src, _dst);
+        else
+            Mat(src.t()).convertTo(_dst, _dst.type());
+    }
+    else
+    {
+        const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.convertTo(_dst, _dst.type());
+    }
+}
+
+// Matx case
+template<typename _Tp, int _rows> static inline
+void cv2eigen( const Matx<_Tp, _rows, 1>& src,
+               Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
+{
+    dst.resize(_rows);
+
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(1, _rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        transpose(src, _dst);
+    }
+    else
+    {
+        const Mat _dst(_rows, 1, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.copyTo(_dst);
+    }
+}
+
+
+template<typename _Tp> static inline
+void cv2eigen( const Mat& src,
+               Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
+{
+    CV_Assert(src.rows == 1);
+    dst.resize(src.cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        if( src.type() == _dst.type() )
+            transpose(src, _dst);
+        else
+            Mat(src.t()).convertTo(_dst, _dst.type());
+    }
+    else
+    {
+        const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        src.convertTo(_dst, _dst.type());
+    }
+}
+
+//Matx
+template<typename _Tp, int _cols> static inline
+void cv2eigen( const Matx<_Tp, 1, _cols>& src,
+               Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
+{
+    dst.resize(_cols);
+    if( !(dst.Flags & Eigen::RowMajorBit) )
+    {
+        const Mat _dst(_cols, 1, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        transpose(src, _dst);
+    }
+    else
+    {
+        const Mat _dst(1, _cols, DataType<_Tp>::type,
+                 dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
+        Mat(src).copyTo(_dst);
+    }
+}
+
+//! @}
+
+} // cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp
new file mode 100644
index 0000000..b8b241b
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/fast_math.hpp
@@ -0,0 +1,302 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_FAST_MATH_HPP__
+#define __OPENCV_CORE_FAST_MATH_HPP__
+
+#include "opencv2/core/cvdef.h"
+
+//! @addtogroup core_utils
+//! @{
+
+/****************************************************************************************\
+*                                      fast math                                         *
+\****************************************************************************************/
+
+#if defined __BORLANDC__
+#  include <fastmath.h>
+#elif defined __cplusplus
+#  include <cmath>
+#else
+#  include <math.h>
+#endif
+
+#ifdef HAVE_TEGRA_OPTIMIZATION
+#  include "tegra_round.hpp"
+#endif
+
+#if CV_VFP
+    // 1. general scheme
+    #define ARM_ROUND(_value, _asm_string) \
+        int res; \
+        float temp; \
+        asm(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \
+        return res
+    // 2. version for double
+    #ifdef __clang__
+        #define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]")
+    #else
+        #define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]")
+    #endif
+    // 3. version for float
+    #define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]")
+#endif // CV_VFP
+
+/** @brief Rounds floating-point number to the nearest integer
+
+ @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
+ result is not defined.
+ */
+CV_INLINE int
+cvRound( double value )
+{
+#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ \
+    && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128d t = _mm_set_sd( value );
+    return _mm_cvtsd_si32(t);
+#elif defined _MSC_VER && defined _M_IX86
+    int t;
+    __asm
+    {
+        fld value;
+        fistp t;
+    }
+    return t;
+#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \
+        defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
+    TEGRA_ROUND_DBL(value);
+#elif defined CV_ICC || defined __GNUC__
+# if CV_VFP
+    ARM_ROUND_DBL(value);
+# else
+    return (int)lrint(value);
+# endif
+#else
+    /* it's ok if round does not comply with IEEE754 standard;
+       the tests should allow +/-1 difference when the tested functions use round */
+    return (int)(value + (value >= 0 ? 0.5 : -0.5));
+#endif
+}
+
+
+/** @brief Rounds floating-point number to the nearest integer not larger than the original.
+
+ The function computes an integer i such that:
+ \f[i \le \texttt{value} < i+1\f]
+ @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
+ result is not defined.
+ */
+CV_INLINE int cvFloor( double value )
+{
+#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128d t = _mm_set_sd( value );
+    int i = _mm_cvtsd_si32(t);
+    return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i)));
+#elif defined __GNUC__
+    int i = (int)value;
+    return i - (i > value);
+#else
+    int i = cvRound(value);
+    float diff = (float)(value - i);
+    return i - (diff < 0);
+#endif
+}
+
+/** @brief Rounds floating-point number to the nearest integer not smaller than the original.
+
+ The function computes an integer i such that:
+ \f[i \le \texttt{value} < i+1\f]
+ @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
+ result is not defined.
+ */
+CV_INLINE int cvCeil( double value )
+{
+#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128d t = _mm_set_sd( value );
+    int i = _mm_cvtsd_si32(t);
+    return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t));
+#elif defined __GNUC__
+    int i = (int)value;
+    return i + (i < value);
+#else
+    int i = cvRound(value);
+    float diff = (float)(i - value);
+    return i + (diff < 0);
+#endif
+}
+
+/** @brief Determines if the argument is Not A Number.
+
+ @param value The input floating-point value
+
+ The function returns 1 if the argument is Not A Number (as defined by IEEE754 standard), 0
+ otherwise. */
+CV_INLINE int cvIsNaN( double value )
+{
+    Cv64suf ieee754;
+    ieee754.f = value;
+    return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) +
+           ((unsigned)ieee754.u != 0) > 0x7ff00000;
+}
+
+/** @brief Determines if the argument is Infinity.
+
+ @param value The input floating-point value
+
+ The function returns 1 if the argument is a plus or minus infinity (as defined by IEEE754 standard)
+ and 0 otherwise. */
+CV_INLINE int cvIsInf( double value )
+{
+    Cv64suf ieee754;
+    ieee754.f = value;
+    return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 &&
+            (unsigned)ieee754.u == 0;
+}
+
+#ifdef __cplusplus
+
+/** @overload */
+CV_INLINE int cvRound(float value)
+{
+#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && \
+      defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128 t = _mm_set_ss( value );
+    return _mm_cvtss_si32(t);
+#elif defined _MSC_VER && defined _M_IX86
+    int t;
+    __asm
+    {
+        fld value;
+        fistp t;
+    }
+    return t;
+#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \
+        defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
+    TEGRA_ROUND_FLT(value);
+#elif defined CV_ICC || defined __GNUC__
+# if CV_VFP
+    ARM_ROUND_FLT(value);
+# else
+    return (int)lrintf(value);
+# endif
+#else
+    /* it's ok if round does not comply with IEEE754 standard;
+     the tests should allow +/-1 difference when the tested functions use round */
+    return (int)(value + (value >= 0 ? 0.5f : -0.5f));
+#endif
+}
+
+/** @overload */
+CV_INLINE int cvRound( int value )
+{
+    return value;
+}
+
+/** @overload */
+CV_INLINE int cvFloor( float value )
+{
+#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128 t = _mm_set_ss( value );
+    int i = _mm_cvtss_si32(t);
+    return i - _mm_movemask_ps(_mm_cmplt_ss(t, _mm_cvtsi32_ss(t,i)));
+#elif defined __GNUC__
+    int i = (int)value;
+    return i - (i > value);
+#else
+    int i = cvRound(value);
+    float diff = (float)(value - i);
+    return i - (diff < 0);
+#endif
+}
+
+/** @overload */
+CV_INLINE int cvFloor( int value )
+{
+    return value;
+}
+
+/** @overload */
+CV_INLINE int cvCeil( float value )
+{
+#if (defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__&& !defined __APPLE__)) && !defined(__CUDACC__)
+    __m128 t = _mm_set_ss( value );
+    int i = _mm_cvtss_si32(t);
+    return i + _mm_movemask_ps(_mm_cmplt_ss(_mm_cvtsi32_ss(t,i), t));
+#elif defined __GNUC__
+    int i = (int)value;
+    return i + (i < value);
+#else
+    int i = cvRound(value);
+    float diff = (float)(i - value);
+    return i + (diff < 0);
+#endif
+}
+
+/** @overload */
+CV_INLINE int cvCeil( int value )
+{
+    return value;
+}
+
+/** @overload */
+CV_INLINE int cvIsNaN( float value )
+{
+    Cv32suf ieee754;
+    ieee754.f = value;
+    return (ieee754.u & 0x7fffffff) > 0x7f800000;
+}
+
+/** @overload */
+CV_INLINE int cvIsInf( float value )
+{
+    Cv32suf ieee754;
+    ieee754.f = value;
+    return (ieee754.u & 0x7fffffff) == 0x7f800000;
+}
+
+#endif // __cplusplus
+
+//! @} core_utils
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp
new file mode 100644
index 0000000..118913e
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/hal.hpp
@@ -0,0 +1,218 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_HPP__
+#define __OPENCV_HAL_HPP__
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/hal/interface.h"
+
+//! @cond IGNORED
+#define CALL_HAL(name, fun, ...) \
+    int res = fun(__VA_ARGS__); \
+    if (res == CV_HAL_ERROR_OK) \
+        return; \
+    else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) \
+        CV_Error_(cv::Error::StsInternal, \
+            ("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res));
+//! @endcond
+
+
+namespace cv { namespace hal {
+
+//! @addtogroup core_hal_functions
+//! @{
+
+CV_EXPORTS int normHamming(const uchar* a, int n);
+CV_EXPORTS int normHamming(const uchar* a, const uchar* b, int n);
+
+CV_EXPORTS int normHamming(const uchar* a, int n, int cellSize);
+CV_EXPORTS int normHamming(const uchar* a, const uchar* b, int n, int cellSize);
+
+CV_EXPORTS int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+CV_EXPORTS int LU64f(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+CV_EXPORTS bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+CV_EXPORTS bool Cholesky64f(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+
+CV_EXPORTS int normL1_(const uchar* a, const uchar* b, int n);
+CV_EXPORTS float normL1_(const float* a, const float* b, int n);
+CV_EXPORTS float normL2Sqr_(const float* a, const float* b, int n);
+
+CV_EXPORTS void exp32f(const float* src, float* dst, int n);
+CV_EXPORTS void exp64f(const double* src, double* dst, int n);
+CV_EXPORTS void log32f(const float* src, float* dst, int n);
+CV_EXPORTS void log64f(const double* src, double* dst, int n);
+
+CV_EXPORTS void fastAtan2(const float* y, const float* x, float* dst, int n, bool angleInDegrees);
+CV_EXPORTS void magnitude32f(const float* x, const float* y, float* dst, int n);
+CV_EXPORTS void magnitude64f(const double* x, const double* y, double* dst, int n);
+CV_EXPORTS void sqrt32f(const float* src, float* dst, int len);
+CV_EXPORTS void sqrt64f(const double* src, double* dst, int len);
+CV_EXPORTS void invSqrt32f(const float* src, float* dst, int len);
+CV_EXPORTS void invSqrt64f(const double* src, double* dst, int len);
+
+CV_EXPORTS void split8u(const uchar* src, uchar** dst, int len, int cn );
+CV_EXPORTS void split16u(const ushort* src, ushort** dst, int len, int cn );
+CV_EXPORTS void split32s(const int* src, int** dst, int len, int cn );
+CV_EXPORTS void split64s(const int64* src, int64** dst, int len, int cn );
+
+CV_EXPORTS void merge8u(const uchar** src, uchar* dst, int len, int cn );
+CV_EXPORTS void merge16u(const ushort** src, ushort* dst, int len, int cn );
+CV_EXPORTS void merge32s(const int** src, int* dst, int len, int cn );
+CV_EXPORTS void merge64s(const int64** src, int64* dst, int len, int cn );
+
+CV_EXPORTS void add8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void add64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void sub8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void sub64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void max8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void max64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void min8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void min64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void absdiff8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void absdiff64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void and8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void or8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void xor8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+CV_EXPORTS void not8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* );
+
+CV_EXPORTS void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp8s(const schar* src1, size_t step1, const schar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp16u(const ushort* src1, size_t step1, const ushort* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp16s(const short* src1, size_t step1, const short* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp32s(const int* src1, size_t step1, const int* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp32f(const float* src1, size_t step1, const float* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+CV_EXPORTS void cmp64f(const double* src1, size_t step1, const double* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _cmpop);
+
+CV_EXPORTS void mul8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void mul64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale);
+
+CV_EXPORTS void div8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void div64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale);
+
+CV_EXPORTS void recip8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
+CV_EXPORTS void recip64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale);
+
+CV_EXPORTS void addWeighted8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _scalars );
+CV_EXPORTS void addWeighted8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scalars );
+CV_EXPORTS void addWeighted64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scalars );
+
+//! @} core_hal
+
+//=============================================================================
+// for binary compatibility with 3.0
+
+//! @cond IGNORED
+
+CV_EXPORTS int LU(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+CV_EXPORTS int LU(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+CV_EXPORTS bool Cholesky(float* A, size_t astep, int m, float* b, size_t bstep, int n);
+CV_EXPORTS bool Cholesky(double* A, size_t astep, int m, double* b, size_t bstep, int n);
+
+CV_EXPORTS void exp(const float* src, float* dst, int n);
+CV_EXPORTS void exp(const double* src, double* dst, int n);
+CV_EXPORTS void log(const float* src, float* dst, int n);
+CV_EXPORTS void log(const double* src, double* dst, int n);
+
+CV_EXPORTS void magnitude(const float* x, const float* y, float* dst, int n);
+CV_EXPORTS void magnitude(const double* x, const double* y, double* dst, int n);
+CV_EXPORTS void sqrt(const float* src, float* dst, int len);
+CV_EXPORTS void sqrt(const double* src, double* dst, int len);
+CV_EXPORTS void invSqrt(const float* src, float* dst, int len);
+CV_EXPORTS void invSqrt(const double* src, double* dst, int len);
+
+//! @endcond
+
+}} //cv::hal
+
+#endif //__OPENCV_HAL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h
new file mode 100644
index 0000000..51f7606
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/interface.h
@@ -0,0 +1,69 @@
+#ifndef _HAL_INTERFACE_HPP_INCLUDED_
+#define _HAL_INTERFACE_HPP_INCLUDED_
+
+//! @addtogroup core_hal_interface
+//! @{
+
+#define CV_HAL_ERROR_OK 0
+#define CV_HAL_ERROR_NOT_IMPLEMENTED 1
+#define CV_HAL_ERROR_UNKNOWN -1
+
+#define CV_HAL_CMP_EQ 0
+#define CV_HAL_CMP_GT 1
+#define CV_HAL_CMP_GE 2
+#define CV_HAL_CMP_LT 3
+#define CV_HAL_CMP_LE 4
+#define CV_HAL_CMP_NE 5
+
+#ifdef __cplusplus
+#include <cstddef>
+#else
+#include <stddef.h>
+#endif
+
+/* primitive types */
+/*
+  schar  - signed 1 byte integer
+  uchar  - unsigned 1 byte integer
+  short  - signed 2 byte integer
+  ushort - unsigned 2 byte integer
+  int    - signed 4 byte integer
+  uint   - unsigned 4 byte integer
+  int64  - signed 8 byte integer
+  uint64 - unsigned 8 byte integer
+*/
+
+#if !defined _MSC_VER && !defined __BORLANDC__
+#  if defined __cplusplus && __cplusplus >= 201103L && !defined __APPLE__
+#    include <cstdint>
+     typedef std::uint32_t uint;
+#  else
+#    include <stdint.h>
+     typedef uint32_t uint;
+#  endif
+#else
+   typedef unsigned uint;
+#endif
+
+typedef signed char schar;
+
+#ifndef __IPL_H__
+   typedef unsigned char uchar;
+   typedef unsigned short ushort;
+#endif
+
+#if defined _MSC_VER || defined __BORLANDC__
+   typedef __int64 int64;
+   typedef unsigned __int64 uint64;
+#  define CV_BIG_INT(n)   n##I64
+#  define CV_BIG_UINT(n)  n##UI64
+#else
+   typedef int64_t int64;
+   typedef uint64_t uint64;
+#  define CV_BIG_INT(n)   n##LL
+#  define CV_BIG_UINT(n)  n##ULL
+#endif
+
+//! @}
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp
new file mode 100644
index 0000000..33e14b4
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin.hpp
@@ -0,0 +1,320 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_INTRIN_HPP__
+#define __OPENCV_HAL_INTRIN_HPP__
+
+#include <cmath>
+#include <float.h>
+#include <stdlib.h>
+#include "opencv2/core/cvdef.h"
+
+#define OPENCV_HAL_ADD(a, b) ((a) + (b))
+#define OPENCV_HAL_AND(a, b) ((a) & (b))
+#define OPENCV_HAL_NOP(a) (a)
+#define OPENCV_HAL_1ST(a, b) (a)
+
+// unlike HAL API, which is in cv::hal,
+// we put intrinsics into cv namespace to make its
+// access from within opencv code more accessible
+namespace cv {
+
+//! @addtogroup core_hal_intrin
+//! @{
+
+//! @cond IGNORED
+template<typename _Tp> struct V_TypeTraits
+{
+    typedef _Tp int_type;
+    typedef _Tp uint_type;
+    typedef _Tp abs_type;
+    typedef _Tp sum_type;
+
+    enum { delta = 0, shift = 0 };
+
+    static int_type reinterpret_int(_Tp x) { return x; }
+    static uint_type reinterpet_uint(_Tp x) { return x; }
+    static _Tp reinterpret_from_int(int_type x) { return (_Tp)x; }
+};
+
+template<> struct V_TypeTraits<uchar>
+{
+    typedef uchar value_type;
+    typedef schar int_type;
+    typedef uchar uint_type;
+    typedef uchar abs_type;
+    typedef int sum_type;
+
+    typedef ushort w_type;
+    typedef unsigned q_type;
+
+    enum { delta = 128, shift = 8 };
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<schar>
+{
+    typedef schar value_type;
+    typedef schar int_type;
+    typedef uchar uint_type;
+    typedef uchar abs_type;
+    typedef int sum_type;
+
+    typedef short w_type;
+    typedef int q_type;
+
+    enum { delta = 128, shift = 8 };
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<ushort>
+{
+    typedef ushort value_type;
+    typedef short int_type;
+    typedef ushort uint_type;
+    typedef ushort abs_type;
+    typedef int sum_type;
+
+    typedef unsigned w_type;
+    typedef uchar nu_type;
+
+    enum { delta = 32768, shift = 16 };
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<short>
+{
+    typedef short value_type;
+    typedef short int_type;
+    typedef ushort uint_type;
+    typedef ushort abs_type;
+    typedef int sum_type;
+
+    typedef int w_type;
+    typedef uchar nu_type;
+    typedef schar n_type;
+
+    enum { delta = 128, shift = 8 };
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<unsigned>
+{
+    typedef unsigned value_type;
+    typedef int int_type;
+    typedef unsigned uint_type;
+    typedef unsigned abs_type;
+    typedef unsigned sum_type;
+
+    typedef uint64 w_type;
+    typedef ushort nu_type;
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<int>
+{
+    typedef int value_type;
+    typedef int int_type;
+    typedef unsigned uint_type;
+    typedef unsigned abs_type;
+    typedef int sum_type;
+
+    typedef int64 w_type;
+    typedef short n_type;
+    typedef ushort nu_type;
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<uint64>
+{
+    typedef uint64 value_type;
+    typedef int64 int_type;
+    typedef uint64 uint_type;
+    typedef uint64 abs_type;
+    typedef uint64 sum_type;
+
+    typedef unsigned nu_type;
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+template<> struct V_TypeTraits<int64>
+{
+    typedef int64 value_type;
+    typedef int64 int_type;
+    typedef uint64 uint_type;
+    typedef uint64 abs_type;
+    typedef int64 sum_type;
+
+    typedef int nu_type;
+
+    static int_type reinterpret_int(value_type x) { return (int_type)x; }
+    static uint_type reinterpret_uint(value_type x) { return (uint_type)x; }
+    static value_type reinterpret_from_int(int_type x) { return (value_type)x; }
+};
+
+
+template<> struct V_TypeTraits<float>
+{
+    typedef float value_type;
+    typedef int int_type;
+    typedef unsigned uint_type;
+    typedef float abs_type;
+    typedef float sum_type;
+
+    typedef double w_type;
+
+    static int_type reinterpret_int(value_type x)
+    {
+        Cv32suf u;
+        u.f = x;
+        return u.i;
+    }
+    static uint_type reinterpet_uint(value_type x)
+    {
+        Cv32suf u;
+        u.f = x;
+        return u.u;
+    }
+    static value_type reinterpret_from_int(int_type x)
+    {
+        Cv32suf u;
+        u.i = x;
+        return u.f;
+    }
+};
+
+template<> struct V_TypeTraits<double>
+{
+    typedef double value_type;
+    typedef int64 int_type;
+    typedef uint64 uint_type;
+    typedef double abs_type;
+    typedef double sum_type;
+    static int_type reinterpret_int(value_type x)
+    {
+        Cv64suf u;
+        u.f = x;
+        return u.i;
+    }
+    static uint_type reinterpet_uint(value_type x)
+    {
+        Cv64suf u;
+        u.f = x;
+        return u.u;
+    }
+    static value_type reinterpret_from_int(int_type x)
+    {
+        Cv64suf u;
+        u.i = x;
+        return u.f;
+    }
+};
+
+template <typename T> struct V_SIMD128Traits
+{
+    enum { nlanes = 16 / sizeof(T) };
+};
+
+//! @endcond
+
+//! @}
+
+}
+
+#ifdef CV_DOXYGEN
+#   undef CV_SSE2
+#   undef CV_NEON
+#endif
+
+#if CV_SSE2
+
+#include "opencv2/core/hal/intrin_sse.hpp"
+
+#elif CV_NEON
+
+#include "opencv2/core/hal/intrin_neon.hpp"
+
+#else
+
+#include "opencv2/core/hal/intrin_cpp.hpp"
+
+#endif
+
+//! @addtogroup core_hal_intrin
+//! @{
+
+#ifndef CV_SIMD128
+//! Set to 1 if current compiler supports vector extensions (NEON or SSE is enabled)
+#define CV_SIMD128 0
+#endif
+
+#ifndef CV_SIMD128_64F
+//! Set to 1 if current intrinsics implementation supports 64-bit float vectors
+#define CV_SIMD128_64F 0
+#endif
+
+//! @}
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp
new file mode 100644
index 0000000..3929e0d
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_cpp.hpp
@@ -0,0 +1,1738 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_INTRIN_CPP_HPP__
+#define __OPENCV_HAL_INTRIN_CPP_HPP__
+
+#include <limits>
+#include <cstring>
+#include <algorithm>
+#include "opencv2/core/saturate.hpp"
+
+namespace cv
+{
+
+/** @addtogroup core_hal_intrin
+
+"Universal intrinsics" is a types and functions set intended to simplify vectorization of code on
+different platforms. Currently there are two supported SIMD extensions: __SSE/SSE2__ on x86
+architectures and __NEON__ on ARM architectures, both allow working with 128 bit registers
+containing packed values of different types. In case when there is no SIMD extension available
+during compilation, fallback C++ implementation of intrinsics will be chosen and code will work as
+expected although it could be slower.
+
+### Types
+
+There are several types representing 128-bit register as a vector of packed values, each type is
+implemented as a structure based on a one SIMD register.
+
+- cv::v_uint8x16 and cv::v_int8x16: sixteen 8-bit integer values (unsigned/signed) - char
+- cv::v_uint16x8 and cv::v_int16x8: eight 16-bit integer values (unsigned/signed) - short
+- cv::v_uint32x4 and cv::v_int32x4: four 32-bit integer values (unsgined/signed) - int
+- cv::v_uint64x2 and cv::v_int64x2: two 64-bit integer values (unsigned/signed) - int64
+- cv::v_float32x4: four 32-bit floating point values (signed) - float
+- cv::v_float64x2: two 64-bit floating point valies (signed) - double
+
+@note
+cv::v_float64x2 is not implemented in NEON variant, if you want to use this type, don't forget to
+check the CV_SIMD128_64F preprocessor definition:
+@code
+#if CV_SIMD128_64F
+//...
+#endif
+@endcode
+
+### Load and store operations
+
+These operations allow to set contents of the register explicitly or by loading it from some memory
+block and to save contents of the register to memory block.
+
+- Constructors:
+@ref v_reg::v_reg(const _Tp *ptr) "from memory",
+@ref v_reg::v_reg(_Tp s0, _Tp s1) "from two values", ...
+- Other create methods:
+@ref v_setall_s8, @ref v_setall_u8, ...,
+@ref v_setzero_u8, @ref v_setzero_s8, ...
+- Memory operations:
+@ref v_load, @ref v_load_aligned, @ref v_load_halves,
+@ref v_store, @ref v_store_aligned,
+@ref v_store_high, @ref v_store_low
+
+### Value reordering
+
+These operations allow to reorder or recombine elements in one or multiple vectors.
+
+- Interleave, deinterleave (3 and 4 channels): @ref v_load_deinterleave, @ref v_store_interleave
+- Expand: @ref v_load_expand, @ref v_load_expand_q, @ref v_expand
+- Pack: @ref v_pack, @ref v_pack_u, @ref v_rshr_pack, @ref v_rshr_pack_u,
+@ref v_pack_store, @ref v_pack_u_store, @ref v_rshr_pack_store, @ref v_rshr_pack_u_store
+- Recombine: @ref v_zip, @ref v_recombine, @ref v_combine_low, @ref v_combine_high
+- Extract: @ref v_extract
+
+
+### Arithmetic, bitwise and comparison operations
+
+Element-wise binary and unary operations.
+
+- Arithmetics:
+@ref operator+(const v_reg &a, const v_reg &b) "+",
+@ref operator-(const v_reg &a, const v_reg &b) "-",
+@ref operator*(const v_reg &a, const v_reg &b) "*",
+@ref operator/(const v_reg &a, const v_reg &b) "/",
+@ref v_mul_expand
+
+- Non-saturating arithmetics: @ref v_add_wrap, @ref v_sub_wrap
+
+- Bitwise shifts:
+@ref operator<<(const v_reg &a, int s) "<<",
+@ref operator>>(const v_reg &a, int s) ">>",
+@ref v_shl, @ref v_shr
+
+- Bitwise logic:
+@ref operator&(const v_reg &a, const v_reg &b) "&",
+@ref operator|(const v_reg &a, const v_reg &b) "|",
+@ref operator^(const v_reg &a, const v_reg &b) "^",
+@ref operator~(const v_reg &a) "~"
+
+- Comparison:
+@ref operator>(const v_reg &a, const v_reg &b) ">",
+@ref operator>=(const v_reg &a, const v_reg &b) ">=",
+@ref operator<(const v_reg &a, const v_reg &b) "<",
+@ref operator<=(const v_reg &a, const v_reg &b) "<=",
+@ref operator==(const v_reg &a, const v_reg &b) "==",
+@ref operator!=(const v_reg &a, const v_reg &b) "!="
+
+- min/max: @ref v_min, @ref v_max
+
+### Reduce and mask
+
+Most of these operations return only one value.
+
+- Reduce: @ref v_reduce_min, @ref v_reduce_max, @ref v_reduce_sum
+- Mask: @ref v_signmask, @ref v_check_all, @ref v_check_any, @ref v_select
+
+### Other math
+
+- Some frequent operations: @ref v_sqrt, @ref v_invsqrt, @ref v_magnitude, @ref v_sqr_magnitude
+- Absolute values: @ref v_abs, @ref v_absdiff
+
+### Conversions
+
+Different type conversions and casts:
+
+- Rounding: @ref v_round, @ref v_floor, @ref v_ceil, @ref v_trunc,
+- To float: @ref v_cvt_f32, @ref v_cvt_f64
+- Reinterpret: @ref v_reinterpret_as_u8, @ref v_reinterpret_as_s8, ...
+
+### Matrix operations
+
+In these operations vectors represent matrix rows/columns: @ref v_dotprod, @ref v_matmul, @ref v_transpose4x4
+
+### Usability
+
+Most operations are implemented only for some subset of the available types, following matrices
+shows the applicability of different operations to the types.
+
+Regular integers:
+
+| Operations\\Types | uint 8x16 | int 8x16 | uint 16x8 | int 16x8 | uint 32x4 | int 32x4 |
+|-------------------|:-:|:-:|:-:|:-:|:-:|:-:|
+|load, store        | x | x | x | x | x | x |
+|interleave         | x | x | x | x | x | x |
+|expand             | x | x | x | x | x | x |
+|expand_q           | x | x |   |   |   |   |
+|add, sub           | x | x | x | x | x | x |
+|add_wrap, sub_wrap | x | x | x | x |   |   |
+|mul                |   |   | x | x | x | x |
+|mul_expand         |   |   | x | x | x |   |
+|compare            | x | x | x | x | x | x |
+|shift              |   |   | x | x | x | x |
+|dotprod            |   |   |   | x |   |   |
+|logical            | x | x | x | x | x | x |
+|min, max           | x | x | x | x | x | x |
+|absdiff            | x | x | x | x | x | x |
+|reduce             |   |   |   |   | x | x |
+|mask               | x | x | x | x | x | x |
+|pack               | x | x | x | x | x | x |
+|pack_u             | x |   | x |   |   |   |
+|unpack             | x | x | x | x | x | x |
+|extract            | x | x | x | x | x | x |
+|cvt_flt32          |   |   |   |   |   | x |
+|cvt_flt64          |   |   |   |   |   | x |
+|transpose4x4       |   |   |   |   | x | x |
+
+Big integers:
+
+| Operations\\Types | uint 64x2 | int 64x2 |
+|-------------------|:-:|:-:|
+|load, store        | x | x |
+|add, sub           | x | x |
+|shift              | x | x |
+|logical            | x | x |
+|extract            | x | x |
+
+Floating point:
+
+| Operations\\Types | float 32x4 | float 64x2 |
+|-------------------|:-:|:-:|
+|load, store        | x | x |
+|interleave         | x |   |
+|add, sub           | x | x |
+|mul                | x | x |
+|div                | x | x |
+|compare            | x | x |
+|min, max           | x | x |
+|absdiff            | x | x |
+|reduce             | x |   |
+|mask               | x | x |
+|unpack             | x | x |
+|cvt_flt32          |   | x |
+|cvt_flt64          | x |   |
+|sqrt, abs          | x | x |
+|float math         | x | x |
+|transpose4x4       | x |   |
+
+
+ @{ */
+
+template<typename _Tp, int n> struct v_reg
+{
+//! @cond IGNORED
+    typedef _Tp lane_type;
+    typedef v_reg<typename V_TypeTraits<_Tp>::int_type, n> int_vec;
+    typedef v_reg<typename V_TypeTraits<_Tp>::abs_type, n> abs_vec;
+    enum { nlanes = n };
+// !@endcond
+
+    /** @brief Constructor
+
+    Initializes register with data from memory
+    @param ptr pointer to memory block with data for register */
+    explicit v_reg(const _Tp* ptr) { for( int i = 0; i < n; i++ ) s[i] = ptr[i]; }
+
+    /** @brief Constructor
+
+    Initializes register with two 64-bit values */
+    v_reg(_Tp s0, _Tp s1) { s[0] = s0; s[1] = s1; }
+
+    /** @brief Constructor
+
+    Initializes register with four 32-bit values */
+    v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3) { s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3; }
+
+    /** @brief Constructor
+
+    Initializes register with eight 16-bit values */
+    v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3,
+           _Tp s4, _Tp s5, _Tp s6, _Tp s7)
+    {
+        s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3;
+        s[4] = s4; s[5] = s5; s[6] = s6; s[7] = s7;
+    }
+
+    /** @brief Constructor
+
+    Initializes register with sixteen 8-bit values */
+    v_reg(_Tp s0, _Tp s1, _Tp s2, _Tp s3,
+           _Tp s4, _Tp s5, _Tp s6, _Tp s7,
+           _Tp s8, _Tp s9, _Tp s10, _Tp s11,
+           _Tp s12, _Tp s13, _Tp s14, _Tp s15)
+    {
+        s[0] = s0; s[1] = s1; s[2] = s2; s[3] = s3;
+        s[4] = s4; s[5] = s5; s[6] = s6; s[7] = s7;
+        s[8] = s8; s[9] = s9; s[10] = s10; s[11] = s11;
+        s[12] = s12; s[13] = s13; s[14] = s14; s[15] = s15;
+    }
+
+    /** @brief Default constructor
+
+    Does not initialize anything*/
+    v_reg() {}
+
+    /** @brief Copy constructor */
+    v_reg(const v_reg<_Tp, n> & r)
+    {
+        for( int i = 0; i < n; i++ )
+            s[i] = r.s[i];
+    }
+    /** @brief Access first value
+
+    Returns value of the first lane according to register type, for example:
+    @code{.cpp}
+    v_int32x4 r(1, 2, 3, 4);
+    int v = r.get0(); // returns 1
+    v_uint64x2 r(1, 2);
+    uint64_t v = r.get0(); // returns 1
+    @endcode
+    */
+    _Tp get0() const { return s[0]; }
+
+//! @cond IGNORED
+    _Tp get(const int i) const { return s[i]; }
+    v_reg<_Tp, n> high() const
+    {
+        v_reg<_Tp, n> c;
+        int i;
+        for( i = 0; i < n/2; i++ )
+        {
+            c.s[i] = s[i+(n/2)];
+            c.s[i+(n/2)] = 0;
+        }
+        return c;
+    }
+
+    static v_reg<_Tp, n> zero()
+    {
+        v_reg<_Tp, n> c;
+        for( int i = 0; i < n; i++ )
+            c.s[i] = (_Tp)0;
+        return c;
+    }
+
+    static v_reg<_Tp, n> all(_Tp s)
+    {
+        v_reg<_Tp, n> c;
+        for( int i = 0; i < n; i++ )
+            c.s[i] = s;
+        return c;
+    }
+
+    template<typename _Tp2, int n2> v_reg<_Tp2, n2> reinterpret_as() const
+    {
+        size_t bytes = std::min(sizeof(_Tp2)*n2, sizeof(_Tp)*n);
+        v_reg<_Tp2, n2> c;
+        std::memcpy(&c.s[0], &s[0], bytes);
+        return c;
+    }
+
+    _Tp s[n];
+//! @endcond
+};
+
+/** @brief Sixteen 8-bit unsigned integer values */
+typedef v_reg<uchar, 16> v_uint8x16;
+/** @brief Sixteen 8-bit signed integer values */
+typedef v_reg<schar, 16> v_int8x16;
+/** @brief Eight 16-bit unsigned integer values */
+typedef v_reg<ushort, 8> v_uint16x8;
+/** @brief Eight 16-bit signed integer values */
+typedef v_reg<short, 8> v_int16x8;
+/** @brief Four 32-bit unsigned integer values */
+typedef v_reg<unsigned, 4> v_uint32x4;
+/** @brief Four 32-bit signed integer values */
+typedef v_reg<int, 4> v_int32x4;
+/** @brief Four 32-bit floating point values (single precision) */
+typedef v_reg<float, 4> v_float32x4;
+/** @brief Two 64-bit floating point values (double precision) */
+typedef v_reg<double, 2> v_float64x2;
+/** @brief Two 64-bit unsigned integer values */
+typedef v_reg<uint64, 2> v_uint64x2;
+/** @brief Two 64-bit signed integer values */
+typedef v_reg<int64, 2> v_int64x2;
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_BIN_OP(bin_op) \
+template<typename _Tp, int n> inline v_reg<_Tp, n> \
+    operator bin_op (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    v_reg<_Tp, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = saturate_cast<_Tp>(a.s[i] bin_op b.s[i]); \
+    return c; \
+} \
+template<typename _Tp, int n> inline v_reg<_Tp, n>& \
+    operator bin_op##= (v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    for( int i = 0; i < n; i++ ) \
+        a.s[i] = saturate_cast<_Tp>(a.s[i] bin_op b.s[i]); \
+    return a; \
+}
+
+/** @brief Add values
+
+For all types. */
+OPENCV_HAL_IMPL_BIN_OP(+)
+
+/** @brief Subtract values
+
+For all types. */
+OPENCV_HAL_IMPL_BIN_OP(-)
+
+/** @brief Multiply values
+
+For 16- and 32-bit integer types and floating types. */
+OPENCV_HAL_IMPL_BIN_OP(*)
+
+/** @brief Divide values
+
+For floating types only. */
+OPENCV_HAL_IMPL_BIN_OP(/)
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_BIT_OP(bit_op) \
+template<typename _Tp, int n> inline v_reg<_Tp, n> operator bit_op \
+    (const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    v_reg<_Tp, n> c; \
+    typedef typename V_TypeTraits<_Tp>::int_type itype; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)(V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) bit_op \
+                                                        V_TypeTraits<_Tp>::reinterpret_int(b.s[i]))); \
+    return c; \
+} \
+template<typename _Tp, int n> inline v_reg<_Tp, n>& operator \
+    bit_op##= (v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    typedef typename V_TypeTraits<_Tp>::int_type itype; \
+    for( int i = 0; i < n; i++ ) \
+        a.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)(V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) bit_op \
+                                                        V_TypeTraits<_Tp>::reinterpret_int(b.s[i]))); \
+    return a; \
+}
+
+/** @brief Bitwise AND
+
+Only for integer types. */
+OPENCV_HAL_IMPL_BIT_OP(&)
+
+/** @brief Bitwise OR
+
+Only for integer types. */
+OPENCV_HAL_IMPL_BIT_OP(|)
+
+/** @brief Bitwise XOR
+
+Only for integer types.*/
+OPENCV_HAL_IMPL_BIT_OP(^)
+
+/** @brief Bitwise NOT
+
+Only for integer types.*/
+template<typename _Tp, int n> inline v_reg<_Tp, n> operator ~ (const v_reg<_Tp, n>& a)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int(~V_TypeTraits<_Tp>::reinterpret_int(a.s[i]));
+        return c;
+}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_MATH_FUNC(func, cfunc, _Tp2) \
+template<typename _Tp, int n> inline v_reg<_Tp2, n> func(const v_reg<_Tp, n>& a) \
+{ \
+    v_reg<_Tp2, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = cfunc(a.s[i]); \
+    return c; \
+}
+
+/** @brief Square root of elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_sqrt, std::sqrt, _Tp)
+
+//! @cond IGNORED
+OPENCV_HAL_IMPL_MATH_FUNC(v_sin, std::sin, _Tp)
+OPENCV_HAL_IMPL_MATH_FUNC(v_cos, std::cos, _Tp)
+OPENCV_HAL_IMPL_MATH_FUNC(v_exp, std::exp, _Tp)
+OPENCV_HAL_IMPL_MATH_FUNC(v_log, std::log, _Tp)
+//! @endcond
+
+/** @brief Absolute value of elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_abs, (typename V_TypeTraits<_Tp>::abs_type)std::abs,
+                          typename V_TypeTraits<_Tp>::abs_type)
+
+/** @brief Round elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_round, cvRound, int)
+
+/** @brief Floor elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_floor, cvFloor, int)
+
+/** @brief Ceil elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_ceil, cvCeil, int)
+
+/** @brief Truncate elements
+
+Only for floating point types.*/
+OPENCV_HAL_IMPL_MATH_FUNC(v_trunc, int, int)
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_MINMAX_FUNC(func, cfunc) \
+template<typename _Tp, int n> inline v_reg<_Tp, n> func(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    v_reg<_Tp, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = cfunc(a.s[i], b.s[i]); \
+    return c; \
+}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(func, cfunc) \
+template<typename _Tp, int n> inline _Tp func(const v_reg<_Tp, n>& a) \
+{ \
+    _Tp c = a.s[0]; \
+    for( int i = 1; i < n; i++ ) \
+        c = cfunc(c, a.s[i]); \
+    return c; \
+}
+
+/** @brief Choose min values for each pair
+
+Scheme:
+@code
+{A1 A2 ...}
+{B1 B2 ...}
+--------------
+{min(A1,B1) min(A2,B2) ...}
+@endcode
+For all types except 64-bit integer. */
+OPENCV_HAL_IMPL_MINMAX_FUNC(v_min, std::min)
+
+/** @brief Choose max values for each pair
+
+Scheme:
+@code
+{A1 A2 ...}
+{B1 B2 ...}
+--------------
+{max(A1,B1) max(A2,B2) ...}
+@endcode
+For all types except 64-bit integer. */
+OPENCV_HAL_IMPL_MINMAX_FUNC(v_max, std::max)
+
+/** @brief Find one min value
+
+Scheme:
+@code
+{A1 A2 A3 ...} => min(A1,A2,A3,...)
+@endcode
+For 32-bit integer and 32-bit floating point types. */
+OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(v_reduce_min, std::min)
+
+/** @brief Find one max value
+
+Scheme:
+@code
+{A1 A2 A3 ...} => max(A1,A2,A3,...)
+@endcode
+For 32-bit integer and 32-bit floating point types. */
+OPENCV_HAL_IMPL_REDUCE_MINMAX_FUNC(v_reduce_max, std::max)
+
+//! @cond IGNORED
+template<typename _Tp, int n>
+inline void v_minmax( const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
+                      v_reg<_Tp, n>& minval, v_reg<_Tp, n>& maxval )
+{
+    for( int i = 0; i < n; i++ )
+    {
+        minval.s[i] = std::min(a.s[i], b.s[i]);
+        maxval.s[i] = std::max(a.s[i], b.s[i]);
+    }
+}
+//! @endcond
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_CMP_OP(cmp_op) \
+template<typename _Tp, int n> \
+inline v_reg<_Tp, n> operator cmp_op(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    typedef typename V_TypeTraits<_Tp>::int_type itype; \
+    v_reg<_Tp, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_from_int((itype)-(int)(a.s[i] cmp_op b.s[i])); \
+    return c; \
+}
+
+/** @brief Less-than comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(<)
+
+/** @brief Greater-than comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(>)
+
+/** @brief Less-than or equal comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(<=)
+
+/** @brief Greater-than or equal comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(>=)
+
+/** @brief Equal comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(==)
+
+/** @brief Not equal comparison
+
+For all types except 64-bit integer values. */
+OPENCV_HAL_IMPL_CMP_OP(!=)
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_ADD_SUB_OP(func, bin_op, cast_op, _Tp2) \
+template<typename _Tp, int n> \
+inline v_reg<_Tp2, n> func(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b) \
+{ \
+    typedef _Tp2 rtype; \
+    v_reg<rtype, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = cast_op(a.s[i] bin_op b.s[i]); \
+    return c; \
+}
+
+/** @brief Add values without saturation
+
+For 8- and 16-bit integer values. */
+OPENCV_HAL_IMPL_ADD_SUB_OP(v_add_wrap, +, (_Tp), _Tp)
+
+/** @brief Subtract values without saturation
+
+For 8- and 16-bit integer values. */
+OPENCV_HAL_IMPL_ADD_SUB_OP(v_sub_wrap, -, (_Tp), _Tp)
+
+//! @cond IGNORED
+template<typename T> inline T _absdiff(T a, T b)
+{
+    return a > b ? a - b : b - a;
+}
+//! @endcond
+
+/** @brief Absolute difference
+
+Returns \f$ |a - b| \f$ converted to corresponding unsigned type.
+Example:
+@code{.cpp}
+v_int32x4 a, b; // {1, 2, 3, 4} and {4, 3, 2, 1}
+v_uint32x4 c = v_absdiff(a, b); // result is {3, 1, 1, 3}
+@endcode
+For 8-, 16-, 32-bit integer source types. */
+template<typename _Tp, int n>
+inline v_reg<typename V_TypeTraits<_Tp>::abs_type, n> v_absdiff(const v_reg<_Tp, n>& a, const v_reg<_Tp, n> & b)
+{
+    typedef typename V_TypeTraits<_Tp>::abs_type rtype;
+    v_reg<rtype, n> c;
+    const rtype mask = std::numeric_limits<_Tp>::is_signed ? (1 << (sizeof(rtype)*8 - 1)) : 0;
+    for( int i = 0; i < n; i++ )
+    {
+        rtype ua = a.s[i] ^ mask;
+        rtype ub = b.s[i] ^ mask;
+        c.s[i] = _absdiff(ua, ub);
+    }
+    return c;
+}
+
+/** @overload
+
+For 32-bit floating point values */
+inline v_float32x4 v_absdiff(const v_float32x4& a, const v_float32x4& b)
+{
+    v_float32x4 c;
+    for( int i = 0; i < c.nlanes; i++ )
+        c.s[i] = _absdiff(a.s[i], b.s[i]);
+    return c;
+}
+
+/** @overload
+
+For 64-bit floating point values */
+inline v_float64x2 v_absdiff(const v_float64x2& a, const v_float64x2& b)
+{
+    v_float64x2 c;
+    for( int i = 0; i < c.nlanes; i++ )
+        c.s[i] = _absdiff(a.s[i], b.s[i]);
+    return c;
+}
+
+/** @brief Inversed square root
+
+Returns \f$ 1/sqrt(a) \f$
+For floating point types only. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_invsqrt(const v_reg<_Tp, n>& a)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = 1.f/std::sqrt(a.s[i]);
+    return c;
+}
+
+/** @brief Magnitude
+
+Returns \f$ sqrt(a^2 + b^2) \f$
+For floating point types only. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_magnitude(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = std::sqrt(a.s[i]*a.s[i] + b.s[i]*b.s[i]);
+    return c;
+}
+
+/** @brief Square of the magnitude
+
+Returns \f$ a^2 + b^2 \f$
+For floating point types only. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_sqr_magnitude(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = a.s[i]*a.s[i] + b.s[i]*b.s[i];
+    return c;
+}
+
+/** @brief Multiply and add
+
+Returns \f$ a*b + c \f$
+For floating point types only. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_muladd(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
+                              const v_reg<_Tp, n>& c)
+{
+    v_reg<_Tp, n> d;
+    for( int i = 0; i < n; i++ )
+        d.s[i] = a.s[i]*b.s[i] + c.s[i];
+    return d;
+}
+
+/** @brief Dot product of elements
+
+Multiply values in two registers and sum adjacent result pairs.
+Scheme:
+@code
+  {A1 A2 ...} // 16-bit
+x {B1 B2 ...} // 16-bit
+-------------
+{A1B1+A2B2 ...} // 32-bit
+@endcode
+Implemented only for 16-bit signed source type (v_int16x8).
+*/
+template<typename _Tp, int n> inline v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>
+    v_dotprod(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    typedef typename V_TypeTraits<_Tp>::w_type w_type;
+    v_reg<w_type, n/2> c;
+    for( int i = 0; i < (n/2); i++ )
+        c.s[i] = (w_type)a.s[i*2]*b.s[i*2] + (w_type)a.s[i*2+1]*b.s[i*2+1];
+    return c;
+}
+
+/** @brief Multiply and expand
+
+Multiply values two registers and store results in two registers with wider pack type.
+Scheme:
+@code
+  {A B C D} // 32-bit
+x {E F G H} // 32-bit
+---------------
+{AE BF}         // 64-bit
+        {CG DH} // 64-bit
+@endcode
+Example:
+@code{.cpp}
+v_uint32x4 a, b; // {1,2,3,4} and {2,2,2,2}
+v_uint64x2 c, d; // results
+v_mul_expand(a, b, c, d); // c, d = {2,4}, {6, 8}
+@endcode
+Implemented only for 16- and unsigned 32-bit source types (v_int16x8, v_uint16x8, v_uint32x4).
+*/
+template<typename _Tp, int n> inline void v_mul_expand(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
+                                                       v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& c,
+                                                       v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& d)
+{
+    typedef typename V_TypeTraits<_Tp>::w_type w_type;
+    for( int i = 0; i < (n/2); i++ )
+    {
+        c.s[i] = (w_type)a.s[i]*b.s[i];
+        d.s[i] = (w_type)a.s[i+(n/2)]*b.s[i+(n/2)];
+    }
+}
+
+//! @cond IGNORED
+template<typename _Tp, int n> inline void v_hsum(const v_reg<_Tp, n>& a,
+                                                 v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& c)
+{
+    typedef typename V_TypeTraits<_Tp>::w_type w_type;
+    for( int i = 0; i < (n/2); i++ )
+    {
+        c.s[i] = (w_type)a.s[i*2] + a.s[i*2+1];
+    }
+}
+//! @endcond
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_SHIFT_OP(shift_op) \
+template<typename _Tp, int n> inline v_reg<_Tp, n> operator shift_op(const v_reg<_Tp, n>& a, int imm) \
+{ \
+    v_reg<_Tp, n> c; \
+    for( int i = 0; i < n; i++ ) \
+        c.s[i] = (_Tp)(a.s[i] shift_op imm); \
+    return c; \
+}
+
+/** @brief Bitwise shift left
+
+For 16-, 32- and 64-bit integer values. */
+OPENCV_HAL_IMPL_SHIFT_OP(<<)
+
+/** @brief Bitwise shift right
+
+For 16-, 32- and 64-bit integer values. */
+OPENCV_HAL_IMPL_SHIFT_OP(>>)
+
+/** @brief Sum packed values
+
+Scheme:
+@code
+{A1 A2 A3 ...} => sum{A1,A2,A3,...}
+@endcode
+For 32-bit integer and 32-bit floating point types.*/
+template<typename _Tp, int n> inline typename V_TypeTraits<_Tp>::sum_type v_reduce_sum(const v_reg<_Tp, n>& a)
+{
+    typename V_TypeTraits<_Tp>::sum_type c = a.s[0];
+    for( int i = 1; i < n; i++ )
+        c += a.s[i];
+    return c;
+}
+
+/** @brief Get negative values mask
+
+Returned value is a bit mask with bits set to 1 on places corresponding to negative packed values indexes.
+Example:
+@code{.cpp}
+v_int32x4 r; // set to {-1, -1, 1, 1}
+int mask = v_signmask(r); // mask = 3 <== 00000000 00000000 00000000 00000011
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n> inline int v_signmask(const v_reg<_Tp, n>& a)
+{
+    int mask = 0;
+    for( int i = 0; i < n; i++ )
+        mask |= (V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) < 0) << i;
+    return mask;
+}
+
+/** @brief Check if all packed values are less than zero
+
+Unsigned values will be casted to signed: `uchar 254 => char -2`.
+For all types except 64-bit. */
+template<typename _Tp, int n> inline bool v_check_all(const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < n; i++ )
+        if( V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) >= 0 )
+            return false;
+    return true;
+}
+
+/** @brief Check if any of packed values is less than zero
+
+Unsigned values will be casted to signed: `uchar 254 => char -2`.
+For all types except 64-bit. */
+template<typename _Tp, int n> inline bool v_check_any(const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < n; i++ )
+        if( V_TypeTraits<_Tp>::reinterpret_int(a.s[i]) < 0 )
+            return true;
+    return false;
+}
+
+/** @brief Bitwise select
+
+Return value will be built by combining values a and b using the following scheme:
+If the i-th bit in _mask_ is 1
+    select i-th bit from _a_
+else
+    select i-th bit from _b_ */
+template<typename _Tp, int n> inline v_reg<_Tp, n> v_select(const v_reg<_Tp, n>& mask,
+                                                           const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    typedef V_TypeTraits<_Tp> Traits;
+    typedef typename Traits::int_type int_type;
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < n; i++ )
+    {
+        int_type m = Traits::reinterpret_int(mask.s[i]);
+        c.s[i] =  Traits::reinterpret_from_int((Traits::reinterpret_int(a.s[i]) & m)
+                                             | (Traits::reinterpret_int(b.s[i]) & ~m));
+    }
+    return c;
+}
+
+/** @brief Expand values to the wider pack type
+
+Copy contents of register to two registers with 2x wider pack type.
+Scheme:
+@code
+ int32x4     int64x2 int64x2
+{A B C D} ==> {A B} , {C D}
+@endcode */
+template<typename _Tp, int n> inline void v_expand(const v_reg<_Tp, n>& a,
+                            v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& b0,
+                            v_reg<typename V_TypeTraits<_Tp>::w_type, n/2>& b1)
+{
+    for( int i = 0; i < (n/2); i++ )
+    {
+        b0.s[i] = a.s[i];
+        b1.s[i] = a.s[i+(n/2)];
+    }
+}
+
+//! @cond IGNORED
+template<typename _Tp, int n> inline v_reg<typename V_TypeTraits<_Tp>::int_type, n>
+    v_reinterpret_as_int(const v_reg<_Tp, n>& a)
+{
+    v_reg<typename V_TypeTraits<_Tp>::int_type, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_int(a.s[i]);
+    return c;
+}
+
+template<typename _Tp, int n> inline v_reg<typename V_TypeTraits<_Tp>::uint_type, n>
+    v_reinterpret_as_uint(const v_reg<_Tp, n>& a)
+{
+    v_reg<typename V_TypeTraits<_Tp>::uint_type, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = V_TypeTraits<_Tp>::reinterpret_uint(a.s[i]);
+    return c;
+}
+//! @endcond
+
+/** @brief Interleave two vectors
+
+Scheme:
+@code
+  {A1 A2 A3 A4}
+  {B1 B2 B3 B4}
+---------------
+  {A1 B1 A2 B2} and {A3 B3 A4 B4}
+@endcode
+For all types except 64-bit.
+*/
+template<typename _Tp, int n> inline void v_zip( const v_reg<_Tp, n>& a0, const v_reg<_Tp, n>& a1,
+                                               v_reg<_Tp, n>& b0, v_reg<_Tp, n>& b1 )
+{
+    int i;
+    for( i = 0; i < n/2; i++ )
+    {
+        b0.s[i*2] = a0.s[i];
+        b0.s[i*2+1] = a1.s[i];
+    }
+    for( ; i < n; i++ )
+    {
+        b1.s[i*2-n] = a0.s[i];
+        b1.s[i*2-n+1] = a1.s[i];
+    }
+}
+
+/** @brief Load register contents from memory
+
+@param ptr pointer to memory block with data
+@return register object
+
+@note Returned type will be detected from passed pointer type, for example uchar ==> cv::v_uint8x16, int ==> cv::v_int32x4, etc.
+ */
+template<typename _Tp>
+inline v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes> v_load(const _Tp* ptr)
+{
+    return v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes>(ptr);
+}
+
+/** @brief Load register contents from memory (aligned)
+
+similar to cv::v_load, but source memory block should be aligned (to 16-byte boundary)
+ */
+template<typename _Tp>
+inline v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes> v_load_aligned(const _Tp* ptr)
+{
+    return v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes>(ptr);
+}
+
+/** @brief Load register contents from two memory blocks
+
+@param loptr memory block containing data for first half (0..n/2)
+@param hiptr memory block containing data for second half (n/2..n)
+
+@code{.cpp}
+int lo[2] = { 1, 2 }, hi[2] = { 3, 4 };
+v_int32x4 r = v_load_halves(lo, hi);
+@endcode
+ */
+template<typename _Tp>
+inline v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes> v_load_halves(const _Tp* loptr, const _Tp* hiptr)
+{
+    v_reg<_Tp, V_SIMD128Traits<_Tp>::nlanes> c;
+    for( int i = 0; i < c.nlanes/2; i++ )
+    {
+        c.s[i] = loptr[i];
+        c.s[i+c.nlanes/2] = hiptr[i];
+    }
+    return c;
+}
+
+/** @brief Load register contents from memory with double expand
+
+Same as cv::v_load, but result pack type will be 2x wider than memory type.
+
+@code{.cpp}
+short buf[4] = {1, 2, 3, 4}; // type is int16
+v_int32x4 r = v_load_expand(buf); // r = {1, 2, 3, 4} - type is int32
+@endcode
+For 8-, 16-, 32-bit integer source types. */
+template<typename _Tp>
+inline v_reg<typename V_TypeTraits<_Tp>::w_type, V_SIMD128Traits<_Tp>::nlanes / 2>
+v_load_expand(const _Tp* ptr)
+{
+    typedef typename V_TypeTraits<_Tp>::w_type w_type;
+    v_reg<w_type, V_SIMD128Traits<w_type>::nlanes> c;
+    for( int i = 0; i < c.nlanes; i++ )
+    {
+        c.s[i] = ptr[i];
+    }
+    return c;
+}
+
+/** @brief Load register contents from memory with quad expand
+
+Same as cv::v_load_expand, but result type is 4 times wider than source.
+@code{.cpp}
+char buf[4] = {1, 2, 3, 4}; // type is int8
+v_int32x4 r = v_load_q(buf); // r = {1, 2, 3, 4} - type is int32
+@endcode
+For 8-bit integer source types. */
+template<typename _Tp>
+inline v_reg<typename V_TypeTraits<_Tp>::q_type, V_SIMD128Traits<_Tp>::nlanes / 4>
+v_load_expand_q(const _Tp* ptr)
+{
+    typedef typename V_TypeTraits<_Tp>::q_type q_type;
+    v_reg<q_type, V_SIMD128Traits<q_type>::nlanes> c;
+    for( int i = 0; i < c.nlanes; i++ )
+    {
+        c.s[i] = ptr[i];
+    }
+    return c;
+}
+
+/** @brief Load and deinterleave (4 channels)
+
+Load data from memory deinterleave and store to 4 registers.
+Scheme:
+@code
+{A1 B1 C1 D1 A2 B2 C2 D2 ...} ==> {A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n> inline void v_load_deinterleave(const _Tp* ptr, v_reg<_Tp, n>& a,
+                                                            v_reg<_Tp, n>& b, v_reg<_Tp, n>& c)
+{
+    int i, i3;
+    for( i = i3 = 0; i < n; i++, i3 += 3 )
+    {
+        a.s[i] = ptr[i3];
+        b.s[i] = ptr[i3+1];
+        c.s[i] = ptr[i3+2];
+    }
+}
+
+/** @brief Load and deinterleave (3 channels)
+
+Load data from memory deinterleave and store to 3 registers.
+Scheme:
+@code
+{A1 B1 C1 A2 B2 C2 ...} ==> {A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n>
+inline void v_load_deinterleave(const _Tp* ptr, v_reg<_Tp, n>& a,
+                                v_reg<_Tp, n>& b, v_reg<_Tp, n>& c,
+                                v_reg<_Tp, n>& d)
+{
+    int i, i4;
+    for( i = i4 = 0; i < n; i++, i4 += 4 )
+    {
+        a.s[i] = ptr[i4];
+        b.s[i] = ptr[i4+1];
+        c.s[i] = ptr[i4+2];
+        d.s[i] = ptr[i4+3];
+    }
+}
+
+/** @brief Interleave and store (3 channels)
+
+Interleave and store data from 3 registers to memory.
+Scheme:
+@code
+{A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...} ==> {A1 B1 C1 D1 A2 B2 C2 D2 ...}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n>
+inline void v_store_interleave( _Tp* ptr, const v_reg<_Tp, n>& a,
+                                const v_reg<_Tp, n>& b, const v_reg<_Tp, n>& c)
+{
+    int i, i3;
+    for( i = i3 = 0; i < n; i++, i3 += 3 )
+    {
+        ptr[i3] = a.s[i];
+        ptr[i3+1] = b.s[i];
+        ptr[i3+2] = c.s[i];
+    }
+}
+
+/** @brief Interleave and store (4 channels)
+
+Interleave and store data from 4 registers to memory.
+Scheme:
+@code
+{A1 A2 ...}, {B1 B2 ...}, {C1 C2 ...}, {D1 D2 ...} ==> {A1 B1 C1 D1 A2 B2 C2 D2 ...}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n> inline void v_store_interleave( _Tp* ptr, const v_reg<_Tp, n>& a,
+                                                            const v_reg<_Tp, n>& b, const v_reg<_Tp, n>& c,
+                                                            const v_reg<_Tp, n>& d)
+{
+    int i, i4;
+    for( i = i4 = 0; i < n; i++, i4 += 4 )
+    {
+        ptr[i4] = a.s[i];
+        ptr[i4+1] = b.s[i];
+        ptr[i4+2] = c.s[i];
+        ptr[i4+3] = d.s[i];
+    }
+}
+
+/** @brief Store data to memory
+
+Store register contents to memory.
+Scheme:
+@code
+  REG {A B C D} ==> MEM {A B C D}
+@endcode
+Pointer can be unaligned. */
+template<typename _Tp, int n>
+inline void v_store(_Tp* ptr, const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < n; i++ )
+        ptr[i] = a.s[i];
+}
+
+/** @brief Store data to memory (lower half)
+
+Store lower half of register contents to memory.
+Scheme:
+@code
+  REG {A B C D} ==> MEM {A B}
+@endcode */
+template<typename _Tp, int n>
+inline void v_store_low(_Tp* ptr, const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < (n/2); i++ )
+        ptr[i] = a.s[i];
+}
+
+/** @brief Store data to memory (higher half)
+
+Store higher half of register contents to memory.
+Scheme:
+@code
+  REG {A B C D} ==> MEM {C D}
+@endcode */
+template<typename _Tp, int n>
+inline void v_store_high(_Tp* ptr, const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < (n/2); i++ )
+        ptr[i] = a.s[i+(n/2)];
+}
+
+/** @brief Store data to memory (aligned)
+
+Store register contents to memory.
+Scheme:
+@code
+  REG {A B C D} ==> MEM {A B C D}
+@endcode
+Pointer __should__ be aligned by 16-byte boundary. */
+template<typename _Tp, int n>
+inline void v_store_aligned(_Tp* ptr, const v_reg<_Tp, n>& a)
+{
+    for( int i = 0; i < n; i++ )
+        ptr[i] = a.s[i];
+}
+
+/** @brief Combine vector from first elements of two vectors
+
+Scheme:
+@code
+  {A1 A2 A3 A4}
+  {B1 B2 B3 B4}
+---------------
+  {A1 A2 B1 B2}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_combine_low(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < (n/2); i++ )
+    {
+        c.s[i] = a.s[i];
+        c.s[i+(n/2)] = b.s[i];
+    }
+    return c;
+}
+
+/** @brief Combine vector from last elements of two vectors
+
+Scheme:
+@code
+  {A1 A2 A3 A4}
+  {B1 B2 B3 B4}
+---------------
+  {A3 A4 B3 B4}
+@endcode
+For all types except 64-bit. */
+template<typename _Tp, int n>
+inline v_reg<_Tp, n> v_combine_high(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> c;
+    for( int i = 0; i < (n/2); i++ )
+    {
+        c.s[i] = a.s[i+(n/2)];
+        c.s[i+(n/2)] = b.s[i+(n/2)];
+    }
+    return c;
+}
+
+/** @brief Combine two vectors from lower and higher parts of two other vectors
+
+@code{.cpp}
+low = cv::v_combine_low(a, b);
+high = cv::v_combine_high(a, b);
+@endcode */
+template<typename _Tp, int n>
+inline void v_recombine(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b,
+                        v_reg<_Tp, n>& low, v_reg<_Tp, n>& high)
+{
+    for( int i = 0; i < (n/2); i++ )
+    {
+        low.s[i] = a.s[i];
+        low.s[i+(n/2)] = b.s[i];
+        high.s[i] = a.s[i+(n/2)];
+        high.s[i+(n/2)] = b.s[i+(n/2)];
+    }
+}
+
+/** @brief Vector extract
+
+Scheme:
+@code
+  {A1 A2 A3 A4}
+  {B1 B2 B3 B4}
+========================
+shift = 1  {A2 A3 A4 B1}
+shift = 2  {A3 A4 B1 B2}
+shift = 3  {A4 B1 B2 B3}
+@endcode
+Restriction: 0 <= shift < nlanes
+
+Usage:
+@code
+v_int32x4 a, b, c;
+c = v_extract<2>(a, b);
+@endcode
+For integer types only. */
+template<int s, typename _Tp, int n>
+inline v_reg<_Tp, n> v_extract(const v_reg<_Tp, n>& a, const v_reg<_Tp, n>& b)
+{
+    v_reg<_Tp, n> r;
+    const int shift = n - s;
+    int i = 0;
+    for (; i < shift; ++i)
+        r.s[i] = a.s[i+s];
+    for (; i < n; ++i)
+        r.s[i] = b.s[i-shift];
+    return r;
+}
+
+/** @brief Round
+
+Rounds each value. Input type is float vector ==> output type is int vector.*/
+template<int n> inline v_reg<int, n> v_round(const v_reg<float, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = cvRound(a.s[i]);
+    return c;
+}
+
+/** @brief Floor
+
+Floor each value. Input type is float vector ==> output type is int vector.*/
+template<int n> inline v_reg<int, n> v_floor(const v_reg<float, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = cvFloor(a.s[i]);
+    return c;
+}
+
+/** @brief Ceil
+
+Ceil each value. Input type is float vector ==> output type is int vector.*/
+template<int n> inline v_reg<int, n> v_ceil(const v_reg<float, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = cvCeil(a.s[i]);
+    return c;
+}
+
+/** @brief Trunc
+
+Truncate each value. Input type is float vector ==> output type is int vector.*/
+template<int n> inline v_reg<int, n> v_trunc(const v_reg<float, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = (int)(a.s[i]);
+    return c;
+}
+
+/** @overload */
+template<int n> inline v_reg<int, n*2> v_round(const v_reg<double, n>& a)
+{
+    v_reg<int, n*2> c;
+    for( int i = 0; i < n; i++ )
+    {
+        c.s[i] = cvRound(a.s[i]);
+        c.s[i+n] = 0;
+    }
+    return c;
+}
+
+/** @overload */
+template<int n> inline v_reg<int, n*2> v_floor(const v_reg<double, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+    {
+        c.s[i] = cvFloor(a.s[i]);
+        c.s[i+n] = 0;
+    }
+    return c;
+}
+
+/** @overload */
+template<int n> inline v_reg<int, n*2> v_ceil(const v_reg<double, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+    {
+        c.s[i] = cvCeil(a.s[i]);
+        c.s[i+n] = 0;
+    }
+    return c;
+}
+
+/** @overload */
+template<int n> inline v_reg<int, n*2> v_trunc(const v_reg<double, n>& a)
+{
+    v_reg<int, n> c;
+    for( int i = 0; i < n; i++ )
+    {
+        c.s[i] = cvCeil(a.s[i]);
+        c.s[i+n] = 0;
+    }
+    return c;
+}
+
+/** @brief Convert to float
+
+Supported input type is cv::v_int32x4. */
+template<int n> inline v_reg<float, n> v_cvt_f32(const v_reg<int, n>& a)
+{
+    v_reg<float, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = (float)a.s[i];
+    return c;
+}
+
+/** @brief Convert to double
+
+Supported input type is cv::v_int32x4. */
+template<int n> inline v_reg<double, n> v_cvt_f64(const v_reg<int, n*2>& a)
+{
+    v_reg<double, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = (double)a.s[i];
+    return c;
+}
+
+/** @brief Convert to double
+
+Supported input type is cv::v_float32x4. */
+template<int n> inline v_reg<double, n> v_cvt_f64(const v_reg<float, n*2>& a)
+{
+    v_reg<double, n> c;
+    for( int i = 0; i < n; i++ )
+        c.s[i] = (double)a.s[i];
+    return c;
+}
+
+/** @brief Transpose 4x4 matrix
+
+Scheme:
+@code
+a0  {A1 A2 A3 A4}
+a1  {B1 B2 B3 B4}
+a2  {C1 C2 C3 C4}
+a3  {D1 D2 D3 D4}
+===============
+b0  {A1 B1 C1 D1}
+b1  {A2 B2 C2 D2}
+b2  {A3 B3 C3 D3}
+b3  {A4 B4 C4 D4}
+@endcode
+*/
+template<typename _Tp>
+inline void v_transpose4x4( v_reg<_Tp, 4>& a0, const v_reg<_Tp, 4>& a1,
+                            const v_reg<_Tp, 4>& a2, const v_reg<_Tp, 4>& a3,
+                            v_reg<_Tp, 4>& b0, v_reg<_Tp, 4>& b1,
+                            v_reg<_Tp, 4>& b2, v_reg<_Tp, 4>& b3 )
+{
+    b0 = v_reg<_Tp, 4>(a0.s[0], a1.s[0], a2.s[0], a3.s[0]);
+    b1 = v_reg<_Tp, 4>(a0.s[1], a1.s[1], a2.s[1], a3.s[1]);
+    b2 = v_reg<_Tp, 4>(a0.s[2], a1.s[2], a2.s[2], a3.s[2]);
+    b3 = v_reg<_Tp, 4>(a0.s[3], a1.s[3], a2.s[3], a3.s[3]);
+}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_INIT_ZERO(_Tpvec, _Tp, suffix) \
+inline _Tpvec v_setzero_##suffix() { return _Tpvec::zero(); }
+
+//! @name Init with zero
+//! @{
+//! @brief Create new vector with zero elements
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_int8x16, schar, s8)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_int16x8, short, s16)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_int32x4, int, s32)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_float32x4, float, f32)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_float64x2, double, f64)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_C_INIT_ZERO(v_int64x2, int64, s64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_INIT_VAL(_Tpvec, _Tp, suffix) \
+inline _Tpvec v_setall_##suffix(_Tp val) { return _Tpvec::all(val); }
+
+//! @name Init with value
+//! @{
+//! @brief Create new vector with elements set to a specific value
+OPENCV_HAL_IMPL_C_INIT_VAL(v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_int8x16, schar, s8)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_int16x8, short, s16)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_int32x4, int, s32)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_float32x4, float, f32)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_float64x2, double, f64)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_C_INIT_VAL(v_int64x2, int64, s64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_REINTERPRET(_Tpvec, _Tp, suffix) \
+template<typename _Tp0, int n0> inline _Tpvec \
+    v_reinterpret_as_##suffix(const v_reg<_Tp0, n0>& a) \
+{ return a.template reinterpret_as<_Tp, _Tpvec::nlanes>(); }
+
+//! @name Reinterpret
+//! @{
+//! @brief Convert vector to different type without modifying underlying data.
+OPENCV_HAL_IMPL_C_REINTERPRET(v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_int8x16, schar, s8)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_int16x8, short, s16)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_int32x4, int, s32)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_float32x4, float, f32)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_float64x2, double, f64)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_C_REINTERPRET(v_int64x2, int64, s64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_SHIFTL(_Tpvec, _Tp) \
+template<int n> inline _Tpvec v_shl(const _Tpvec& a) \
+{ return a << n; }
+
+//! @name Left shift
+//! @{
+//! @brief Shift left
+OPENCV_HAL_IMPL_C_SHIFTL(v_uint16x8, ushort)
+OPENCV_HAL_IMPL_C_SHIFTL(v_int16x8, short)
+OPENCV_HAL_IMPL_C_SHIFTL(v_uint32x4, unsigned)
+OPENCV_HAL_IMPL_C_SHIFTL(v_int32x4, int)
+OPENCV_HAL_IMPL_C_SHIFTL(v_uint64x2, uint64)
+OPENCV_HAL_IMPL_C_SHIFTL(v_int64x2, int64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_SHIFTR(_Tpvec, _Tp) \
+template<int n> inline _Tpvec v_shr(const _Tpvec& a) \
+{ return a >> n; }
+
+//! @name Right shift
+//! @{
+//! @brief Shift right
+OPENCV_HAL_IMPL_C_SHIFTR(v_uint16x8, ushort)
+OPENCV_HAL_IMPL_C_SHIFTR(v_int16x8, short)
+OPENCV_HAL_IMPL_C_SHIFTR(v_uint32x4, unsigned)
+OPENCV_HAL_IMPL_C_SHIFTR(v_int32x4, int)
+OPENCV_HAL_IMPL_C_SHIFTR(v_uint64x2, uint64)
+OPENCV_HAL_IMPL_C_SHIFTR(v_int64x2, int64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_RSHIFTR(_Tpvec, _Tp) \
+template<int n> inline _Tpvec v_rshr(const _Tpvec& a) \
+{ \
+    _Tpvec c; \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+        c.s[i] = (_Tp)((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \
+    return c; \
+}
+
+//! @name Rounding shift
+//! @{
+//! @brief Rounding shift right
+OPENCV_HAL_IMPL_C_RSHIFTR(v_uint16x8, ushort)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_int16x8, short)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_uint32x4, unsigned)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_int32x4, int)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_uint64x2, uint64)
+OPENCV_HAL_IMPL_C_RSHIFTR(v_int64x2, int64)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_PACK(_Tpvec, _Tpnvec, _Tpn, pack_suffix) \
+inline _Tpnvec v_##pack_suffix(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpnvec c; \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+    { \
+        c.s[i] = saturate_cast<_Tpn>(a.s[i]); \
+        c.s[i+_Tpvec::nlanes] = saturate_cast<_Tpn>(b.s[i]); \
+    } \
+    return c; \
+}
+
+//! @name Pack
+//! @{
+//! @brief Pack values from two vectors to one
+//!
+//! Return vector type have twice more elements than input vector types. Variant with _u_ suffix also
+//! converts to corresponding unsigned type.
+//!
+//! - pack: for 16-, 32- and 64-bit integer input types
+//! - pack_u: for 16- and 32-bit signed integer input types
+OPENCV_HAL_IMPL_C_PACK(v_uint16x8, v_uint8x16, uchar, pack)
+OPENCV_HAL_IMPL_C_PACK(v_int16x8, v_int8x16, schar, pack)
+OPENCV_HAL_IMPL_C_PACK(v_uint32x4, v_uint16x8, ushort, pack)
+OPENCV_HAL_IMPL_C_PACK(v_int32x4, v_int16x8, short, pack)
+OPENCV_HAL_IMPL_C_PACK(v_uint64x2, v_uint32x4, unsigned, pack)
+OPENCV_HAL_IMPL_C_PACK(v_int64x2, v_int32x4, int, pack)
+OPENCV_HAL_IMPL_C_PACK(v_int16x8, v_uint8x16, uchar, pack_u)
+OPENCV_HAL_IMPL_C_PACK(v_int32x4, v_uint16x8, ushort, pack_u)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_RSHR_PACK(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix) \
+template<int n> inline _Tpnvec v_rshr_##pack_suffix(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpnvec c; \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+    { \
+        c.s[i] = saturate_cast<_Tpn>((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \
+        c.s[i+_Tpvec::nlanes] = saturate_cast<_Tpn>((b.s[i] + ((_Tp)1 << (n - 1))) >> n); \
+    } \
+    return c; \
+}
+
+//! @name Pack with rounding shift
+//! @{
+//! @brief Pack values from two vectors to one with rounding shift
+//!
+//! Values from the input vectors will be shifted right by _n_ bits with rounding, converted to narrower
+//! type and returned in the result vector. Variant with _u_ suffix converts to unsigned type.
+//!
+//! - pack: for 16-, 32- and 64-bit integer input types
+//! - pack_u: for 16- and 32-bit signed integer input types
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint16x8, ushort, v_uint8x16, uchar, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int16x8, short, v_int8x16, schar, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint32x4, unsigned, v_uint16x8, ushort, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int32x4, int, v_int16x8, short, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_uint64x2, uint64, v_uint32x4, unsigned, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int64x2, int64, v_int32x4, int, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int16x8, short, v_uint8x16, uchar, pack_u)
+OPENCV_HAL_IMPL_C_RSHR_PACK(v_int32x4, int, v_uint16x8, ushort, pack_u)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_PACK_STORE(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix) \
+inline void v_##pack_suffix##_store(_Tpn* ptr, const _Tpvec& a) \
+{ \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+        ptr[i] = saturate_cast<_Tpn>(a.s[i]); \
+}
+
+//! @name Pack and store
+//! @{
+//! @brief Store values from the input vector into memory with pack
+//!
+//! Values will be stored into memory with saturating conversion to narrower type.
+//! Variant with _u_ suffix converts to corresponding unsigned type.
+//!
+//! - pack: for 16-, 32- and 64-bit integer input types
+//! - pack_u: for 16- and 32-bit signed integer input types
+OPENCV_HAL_IMPL_C_PACK_STORE(v_uint16x8, ushort, v_uint8x16, uchar, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int16x8, short, v_int8x16, schar, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_uint32x4, unsigned, v_uint16x8, ushort, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int32x4, int, v_int16x8, short, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_uint64x2, uint64, v_uint32x4, unsigned, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int64x2, int64, v_int32x4, int, pack)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int16x8, short, v_uint8x16, uchar, pack_u)
+OPENCV_HAL_IMPL_C_PACK_STORE(v_int32x4, int, v_uint16x8, ushort, pack_u)
+//! @}
+
+//! @brief Helper macro
+//! @ingroup core_hal_intrin_impl
+#define OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(_Tpvec, _Tp, _Tpnvec, _Tpn, pack_suffix) \
+template<int n> inline void v_rshr_##pack_suffix##_store(_Tpn* ptr, const _Tpvec& a) \
+{ \
+    for( int i = 0; i < _Tpvec::nlanes; i++ ) \
+        ptr[i] = saturate_cast<_Tpn>((a.s[i] + ((_Tp)1 << (n - 1))) >> n); \
+}
+
+//! @name Pack and store with rounding shift
+//! @{
+//! @brief Store values from the input vector into memory with pack
+//!
+//! Values will be shifted _n_ bits right with rounding, converted to narrower type and stored into
+//! memory. Variant with _u_ suffix converts to unsigned type.
+//!
+//! - pack: for 16-, 32- and 64-bit integer input types
+//! - pack_u: for 16- and 32-bit signed integer input types
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint16x8, ushort, v_uint8x16, uchar, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int16x8, short, v_int8x16, schar, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint32x4, unsigned, v_uint16x8, ushort, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int32x4, int, v_int16x8, short, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_uint64x2, uint64, v_uint32x4, unsigned, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int64x2, int64, v_int32x4, int, pack)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int16x8, short, v_uint8x16, uchar, pack_u)
+OPENCV_HAL_IMPL_C_RSHR_PACK_STORE(v_int32x4, int, v_uint16x8, ushort, pack_u)
+//! @}
+
+/** @brief Matrix multiplication
+
+Scheme:
+@code
+{A0 A1 A2 A3}   |V0|
+{B0 B1 B2 B3}   |V1|
+{C0 C1 C2 C3}   |V2|
+{D0 D1 D2 D3} x |V3|
+====================
+{R0 R1 R2 R3}, where:
+R0 = A0V0 + A1V1 + A2V2 + A3V3,
+R1 = B0V0 + B1V1 + B2V2 + B3V3
+...
+@endcode
+*/
+inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0,
+                            const v_float32x4& m1, const v_float32x4& m2,
+                            const v_float32x4& m3)
+{
+    return v_float32x4(v.s[0]*m0.s[0] + v.s[1]*m1.s[0] + v.s[2]*m2.s[0] + v.s[3]*m3.s[0],
+                       v.s[0]*m0.s[1] + v.s[1]*m1.s[1] + v.s[2]*m2.s[1] + v.s[3]*m3.s[1],
+                       v.s[0]*m0.s[2] + v.s[1]*m1.s[2] + v.s[2]*m2.s[2] + v.s[3]*m3.s[2],
+                       v.s[0]*m0.s[3] + v.s[1]*m1.s[3] + v.s[2]*m2.s[3] + v.s[3]*m3.s[3]);
+}
+
+//! @}
+
+}
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp
new file mode 100644
index 0000000..f3e47ca
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_neon.hpp
@@ -0,0 +1,864 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_INTRIN_NEON_HPP__
+#define __OPENCV_HAL_INTRIN_NEON_HPP__
+
+#include <algorithm>
+
+namespace cv
+{
+
+//! @cond IGNORED
+
+#define CV_SIMD128 1
+
+struct v_uint8x16
+{
+    typedef uchar lane_type;
+    enum { nlanes = 16 };
+
+    v_uint8x16() {}
+    explicit v_uint8x16(uint8x16_t v) : val(v) {}
+    v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7,
+               uchar v8, uchar v9, uchar v10, uchar v11, uchar v12, uchar v13, uchar v14, uchar v15)
+    {
+        uchar v[] = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15};
+        val = vld1q_u8(v);
+    }
+    uchar get0() const
+    {
+        return vgetq_lane_u8(val, 0);
+    }
+
+    uint8x16_t val;
+};
+
+struct v_int8x16
+{
+    typedef schar lane_type;
+    enum { nlanes = 16 };
+
+    v_int8x16() {}
+    explicit v_int8x16(int8x16_t v) : val(v) {}
+    v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7,
+               schar v8, schar v9, schar v10, schar v11, schar v12, schar v13, schar v14, schar v15)
+    {
+        schar v[] = {v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15};
+        val = vld1q_s8(v);
+    }
+    schar get0() const
+    {
+        return vgetq_lane_s8(val, 0);
+    }
+
+    int8x16_t val;
+};
+
+struct v_uint16x8
+{
+    typedef ushort lane_type;
+    enum { nlanes = 8 };
+
+    v_uint16x8() {}
+    explicit v_uint16x8(uint16x8_t v) : val(v) {}
+    v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7)
+    {
+        ushort v[] = {v0, v1, v2, v3, v4, v5, v6, v7};
+        val = vld1q_u16(v);
+    }
+    ushort get0() const
+    {
+        return vgetq_lane_u16(val, 0);
+    }
+
+    uint16x8_t val;
+};
+
+struct v_int16x8
+{
+    typedef short lane_type;
+    enum { nlanes = 8 };
+
+    v_int16x8() {}
+    explicit v_int16x8(int16x8_t v) : val(v) {}
+    v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7)
+    {
+        short v[] = {v0, v1, v2, v3, v4, v5, v6, v7};
+        val = vld1q_s16(v);
+    }
+    short get0() const
+    {
+        return vgetq_lane_s16(val, 0);
+    }
+
+    int16x8_t val;
+};
+
+struct v_uint32x4
+{
+    typedef unsigned lane_type;
+    enum { nlanes = 4 };
+
+    v_uint32x4() {}
+    explicit v_uint32x4(uint32x4_t v) : val(v) {}
+    v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3)
+    {
+        unsigned v[] = {v0, v1, v2, v3};
+        val = vld1q_u32(v);
+    }
+    unsigned get0() const
+    {
+        return vgetq_lane_u32(val, 0);
+    }
+
+    uint32x4_t val;
+};
+
+struct v_int32x4
+{
+    typedef int lane_type;
+    enum { nlanes = 4 };
+
+    v_int32x4() {}
+    explicit v_int32x4(int32x4_t v) : val(v) {}
+    v_int32x4(int v0, int v1, int v2, int v3)
+    {
+        int v[] = {v0, v1, v2, v3};
+        val = vld1q_s32(v);
+    }
+    int get0() const
+    {
+        return vgetq_lane_s32(val, 0);
+    }
+    int32x4_t val;
+};
+
+struct v_float32x4
+{
+    typedef float lane_type;
+    enum { nlanes = 4 };
+
+    v_float32x4() {}
+    explicit v_float32x4(float32x4_t v) : val(v) {}
+    v_float32x4(float v0, float v1, float v2, float v3)
+    {
+        float v[] = {v0, v1, v2, v3};
+        val = vld1q_f32(v);
+    }
+    float get0() const
+    {
+        return vgetq_lane_f32(val, 0);
+    }
+    float32x4_t val;
+};
+
+struct v_uint64x2
+{
+    typedef uint64 lane_type;
+    enum { nlanes = 2 };
+
+    v_uint64x2() {}
+    explicit v_uint64x2(uint64x2_t v) : val(v) {}
+    v_uint64x2(unsigned v0, unsigned v1)
+    {
+        uint64 v[] = {v0, v1};
+        val = vld1q_u64(v);
+    }
+    uint64 get0() const
+    {
+        return vgetq_lane_u64(val, 0);
+    }
+    uint64x2_t val;
+};
+
+struct v_int64x2
+{
+    typedef int64 lane_type;
+    enum { nlanes = 2 };
+
+    v_int64x2() {}
+    explicit v_int64x2(int64x2_t v) : val(v) {}
+    v_int64x2(int v0, int v1)
+    {
+        int64 v[] = {v0, v1};
+        val = vld1q_s64(v);
+    }
+    int64 get0() const
+    {
+        return vgetq_lane_s64(val, 0);
+    }
+    int64x2_t val;
+};
+
+#define OPENCV_HAL_IMPL_NEON_INIT(_Tpv, _Tp, suffix) \
+inline v_##_Tpv v_setzero_##suffix() { return v_##_Tpv(vdupq_n_##suffix((_Tp)0)); } \
+inline v_##_Tpv v_setall_##suffix(_Tp v) { return v_##_Tpv(vdupq_n_##suffix(v)); } \
+inline _Tpv##_t vreinterpretq_##suffix##_##suffix(_Tpv##_t v) { return v; } \
+inline v_uint8x16 v_reinterpret_as_u8(const v_##_Tpv& v) { return v_uint8x16(vreinterpretq_u8_##suffix(v.val)); } \
+inline v_int8x16 v_reinterpret_as_s8(const v_##_Tpv& v) { return v_int8x16(vreinterpretq_s8_##suffix(v.val)); } \
+inline v_uint16x8 v_reinterpret_as_u16(const v_##_Tpv& v) { return v_uint16x8(vreinterpretq_u16_##suffix(v.val)); } \
+inline v_int16x8 v_reinterpret_as_s16(const v_##_Tpv& v) { return v_int16x8(vreinterpretq_s16_##suffix(v.val)); } \
+inline v_uint32x4 v_reinterpret_as_u32(const v_##_Tpv& v) { return v_uint32x4(vreinterpretq_u32_##suffix(v.val)); } \
+inline v_int32x4 v_reinterpret_as_s32(const v_##_Tpv& v) { return v_int32x4(vreinterpretq_s32_##suffix(v.val)); } \
+inline v_uint64x2 v_reinterpret_as_u64(const v_##_Tpv& v) { return v_uint64x2(vreinterpretq_u64_##suffix(v.val)); } \
+inline v_int64x2 v_reinterpret_as_s64(const v_##_Tpv& v) { return v_int64x2(vreinterpretq_s64_##suffix(v.val)); } \
+inline v_float32x4 v_reinterpret_as_f32(const v_##_Tpv& v) { return v_float32x4(vreinterpretq_f32_##suffix(v.val)); }
+
+OPENCV_HAL_IMPL_NEON_INIT(uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_NEON_INIT(int8x16, schar, s8)
+OPENCV_HAL_IMPL_NEON_INIT(uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_NEON_INIT(int16x8, short, s16)
+OPENCV_HAL_IMPL_NEON_INIT(uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_NEON_INIT(int32x4, int, s32)
+OPENCV_HAL_IMPL_NEON_INIT(uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_NEON_INIT(int64x2, int64, s64)
+OPENCV_HAL_IMPL_NEON_INIT(float32x4, float, f32)
+
+#define OPENCV_HAL_IMPL_NEON_PACK(_Tpvec, _Tp, hreg, suffix, _Tpwvec, wsuffix, pack, op) \
+inline _Tpvec v_##pack(const _Tpwvec& a, const _Tpwvec& b) \
+{ \
+    hreg a1 = vqmov##op##_##wsuffix(a.val), b1 = vqmov##op##_##wsuffix(b.val); \
+    return _Tpvec(vcombine_##suffix(a1, b1)); \
+} \
+inline void v_##pack##_store(_Tp* ptr, const _Tpwvec& a) \
+{ \
+    hreg a1 = vqmov##op##_##wsuffix(a.val); \
+    vst1_##suffix(ptr, a1); \
+} \
+template<int n> inline \
+_Tpvec v_rshr_##pack(const _Tpwvec& a, const _Tpwvec& b) \
+{ \
+    hreg a1 = vqrshr##op##_n_##wsuffix(a.val, n); \
+    hreg b1 = vqrshr##op##_n_##wsuffix(b.val, n); \
+    return _Tpvec(vcombine_##suffix(a1, b1)); \
+} \
+template<int n> inline \
+void v_rshr_##pack##_store(_Tp* ptr, const _Tpwvec& a) \
+{ \
+    hreg a1 = vqrshr##op##_n_##wsuffix(a.val, n); \
+    vst1_##suffix(ptr, a1); \
+}
+
+OPENCV_HAL_IMPL_NEON_PACK(v_uint8x16, uchar, uint8x8_t, u8, v_uint16x8, u16, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_int8x16, schar, int8x8_t, s8, v_int16x8, s16, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_uint16x8, ushort, uint16x4_t, u16, v_uint32x4, u32, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_int16x8, short, int16x4_t, s16, v_int32x4, s32, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_uint32x4, unsigned, uint32x2_t, u32, v_uint64x2, u64, pack, n)
+OPENCV_HAL_IMPL_NEON_PACK(v_int32x4, int, int32x2_t, s32, v_int64x2, s64, pack, n)
+
+OPENCV_HAL_IMPL_NEON_PACK(v_uint8x16, uchar, uint8x8_t, u8, v_int16x8, s16, pack_u, un)
+OPENCV_HAL_IMPL_NEON_PACK(v_uint16x8, ushort, uint16x4_t, u16, v_int32x4, s32, pack_u, un)
+
+inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0,
+                            const v_float32x4& m1, const v_float32x4& m2,
+                            const v_float32x4& m3)
+{
+    float32x2_t vl = vget_low_f32(v.val), vh = vget_high_f32(v.val);
+    float32x4_t res = vmulq_lane_f32(m0.val, vl, 0);
+    res = vmlaq_lane_f32(res, m1.val, vl, 1);
+    res = vmlaq_lane_f32(res, m2.val, vh, 0);
+    res = vmlaq_lane_f32(res, m3.val, vh, 1);
+    return v_float32x4(res);
+}
+
+#define OPENCV_HAL_IMPL_NEON_BIN_OP(bin_op, _Tpvec, intrin) \
+inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(intrin(a.val, b.val)); \
+} \
+inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \
+{ \
+    a.val = intrin(a.val, b.val); \
+    return a; \
+}
+
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint8x16, vqaddq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint8x16, vqsubq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int8x16, vqaddq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int8x16, vqsubq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint16x8, vqaddq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint16x8, vqsubq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_uint16x8, vmulq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int16x8, vqaddq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int16x8, vqsubq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_int16x8, vmulq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int32x4, vaddq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int32x4, vsubq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_int32x4, vmulq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint32x4, vaddq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint32x4, vsubq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_uint32x4, vmulq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_float32x4, vaddq_f32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_float32x4, vsubq_f32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(*, v_float32x4, vmulq_f32)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_int64x2, vaddq_s64)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_int64x2, vsubq_s64)
+OPENCV_HAL_IMPL_NEON_BIN_OP(+, v_uint64x2, vaddq_u64)
+OPENCV_HAL_IMPL_NEON_BIN_OP(-, v_uint64x2, vsubq_u64)
+
+inline v_float32x4 operator / (const v_float32x4& a, const v_float32x4& b)
+{
+    float32x4_t reciprocal = vrecpeq_f32(b.val);
+    reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
+    reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
+    return v_float32x4(vmulq_f32(a.val, reciprocal));
+}
+inline v_float32x4& operator /= (v_float32x4& a, const v_float32x4& b)
+{
+    float32x4_t reciprocal = vrecpeq_f32(b.val);
+    reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
+    reciprocal = vmulq_f32(vrecpsq_f32(b.val, reciprocal), reciprocal);
+    a.val = vmulq_f32(a.val, reciprocal);
+    return a;
+}
+
+inline void v_mul_expand(const v_int16x8& a, const v_int16x8& b,
+                         v_int32x4& c, v_int32x4& d)
+{
+    c.val = vmull_s16(vget_low_s16(a.val), vget_low_s16(b.val));
+    d.val = vmull_s16(vget_high_s16(a.val), vget_high_s16(b.val));
+}
+
+inline void v_mul_expand(const v_uint16x8& a, const v_uint16x8& b,
+                         v_uint32x4& c, v_uint32x4& d)
+{
+    c.val = vmull_u16(vget_low_u16(a.val), vget_low_u16(b.val));
+    d.val = vmull_u16(vget_high_u16(a.val), vget_high_u16(b.val));
+}
+
+inline void v_mul_expand(const v_uint32x4& a, const v_uint32x4& b,
+                         v_uint64x2& c, v_uint64x2& d)
+{
+    c.val = vmull_u32(vget_low_u32(a.val), vget_low_u32(b.val));
+    d.val = vmull_u32(vget_high_u32(a.val), vget_high_u32(b.val));
+}
+
+inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b)
+{
+    int32x4_t c = vmull_s16(vget_low_s16(a.val), vget_low_s16(b.val));
+    int32x4_t d = vmull_s16(vget_high_s16(a.val), vget_high_s16(b.val));
+    int32x4x2_t cd = vuzpq_s32(c, d);
+    return v_int32x4(vaddq_s32(cd.val[0], cd.val[1]));
+}
+
+#define OPENCV_HAL_IMPL_NEON_LOGIC_OP(_Tpvec, suffix) \
+    OPENCV_HAL_IMPL_NEON_BIN_OP(&, _Tpvec, vandq_##suffix) \
+    OPENCV_HAL_IMPL_NEON_BIN_OP(|, _Tpvec, vorrq_##suffix) \
+    OPENCV_HAL_IMPL_NEON_BIN_OP(^, _Tpvec, veorq_##suffix) \
+    inline _Tpvec operator ~ (const _Tpvec& a) \
+    { \
+        return _Tpvec(vreinterpretq_##suffix##_u8(vmvnq_u8(vreinterpretq_u8_##suffix(a.val)))); \
+    }
+
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint8x16, u8)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int8x16, s8)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint16x8, u16)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int16x8, s16)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint32x4, u32)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int32x4, s32)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_uint64x2, u64)
+OPENCV_HAL_IMPL_NEON_LOGIC_OP(v_int64x2, s64)
+
+#define OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(bin_op, intrin) \
+inline v_float32x4 operator bin_op (const v_float32x4& a, const v_float32x4& b) \
+{ \
+    return v_float32x4(vreinterpretq_f32_s32(intrin(vreinterpretq_s32_f32(a.val), vreinterpretq_s32_f32(b.val)))); \
+} \
+inline v_float32x4& operator bin_op##= (v_float32x4& a, const v_float32x4& b) \
+{ \
+    a.val = vreinterpretq_f32_s32(intrin(vreinterpretq_s32_f32(a.val), vreinterpretq_s32_f32(b.val))); \
+    return a; \
+}
+
+OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(&, vandq_s32)
+OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(|, vorrq_s32)
+OPENCV_HAL_IMPL_NEON_FLT_BIT_OP(^, veorq_s32)
+
+inline v_float32x4 operator ~ (const v_float32x4& a)
+{
+    return v_float32x4(vreinterpretq_f32_s32(vmvnq_s32(vreinterpretq_s32_f32(a.val))));
+}
+
+inline v_float32x4 v_sqrt(const v_float32x4& x)
+{
+    float32x4_t x1 = vmaxq_f32(x.val, vdupq_n_f32(FLT_MIN));
+    float32x4_t e = vrsqrteq_f32(x1);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x1, e), e), e);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x1, e), e), e);
+    return v_float32x4(vmulq_f32(x.val, e));
+}
+
+inline v_float32x4 v_invsqrt(const v_float32x4& x)
+{
+    float32x4_t e = vrsqrteq_f32(x.val);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x.val, e), e), e);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x.val, e), e), e);
+    return v_float32x4(e);
+}
+
+inline v_float32x4 v_abs(v_float32x4 x)
+{ return v_float32x4(vabsq_f32(x.val)); }
+
+// TODO: exp, log, sin, cos
+
+#define OPENCV_HAL_IMPL_NEON_BIN_FUNC(_Tpvec, func, intrin) \
+inline _Tpvec func(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(intrin(a.val, b.val)); \
+}
+
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_min, vminq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_max, vmaxq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_min, vminq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_max, vmaxq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_min, vminq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_max, vmaxq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_min, vminq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_max, vmaxq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_min, vminq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_max, vmaxq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int32x4, v_min, vminq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int32x4, v_max, vmaxq_s32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_min, vminq_f32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_max, vmaxq_f32)
+
+
+#define OPENCV_HAL_IMPL_NEON_INT_CMP_OP(_Tpvec, cast, suffix, not_suffix) \
+inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vceqq_##suffix(a.val, b.val))); } \
+inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vmvnq_##not_suffix(vceqq_##suffix(a.val, b.val)))); } \
+inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vcltq_##suffix(a.val, b.val))); } \
+inline _Tpvec operator > (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vcgtq_##suffix(a.val, b.val))); } \
+inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vcleq_##suffix(a.val, b.val))); } \
+inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(cast(vcgeq_##suffix(a.val, b.val))); }
+
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint8x16, OPENCV_HAL_NOP, u8, u8)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int8x16, vreinterpretq_s8_u8, s8, u8)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint16x8, OPENCV_HAL_NOP, u16, u16)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int16x8, vreinterpretq_s16_u16, s16, u16)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_uint32x4, OPENCV_HAL_NOP, u32, u32)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_int32x4, vreinterpretq_s32_u32, s32, u32)
+OPENCV_HAL_IMPL_NEON_INT_CMP_OP(v_float32x4, vreinterpretq_f32_u32, f32, u32)
+
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_add_wrap, vaddq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_add_wrap, vaddq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_add_wrap, vaddq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_add_wrap, vaddq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_sub_wrap, vsubq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int8x16, v_sub_wrap, vsubq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_sub_wrap, vsubq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_int16x8, v_sub_wrap, vsubq_s16)
+
+// TODO: absdiff for signed integers
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint8x16, v_absdiff, vabdq_u8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint16x8, v_absdiff, vabdq_u16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_uint32x4, v_absdiff, vabdq_u32)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC(v_float32x4, v_absdiff, vabdq_f32)
+
+#define OPENCV_HAL_IMPL_NEON_BIN_FUNC2(_Tpvec, _Tpvec2, cast, func, intrin) \
+inline _Tpvec2 func(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec2(cast(intrin(a.val, b.val))); \
+}
+
+OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int8x16, v_uint8x16, vreinterpretq_u8_s8, v_absdiff, vabdq_s8)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int16x8, v_uint16x8, vreinterpretq_u16_s16, v_absdiff, vabdq_s16)
+OPENCV_HAL_IMPL_NEON_BIN_FUNC2(v_int32x4, v_uint32x4, vreinterpretq_u32_s32, v_absdiff, vabdq_s32)
+
+inline v_float32x4 v_magnitude(const v_float32x4& a, const v_float32x4& b)
+{
+    v_float32x4 x(vmlaq_f32(vmulq_f32(a.val, a.val), b.val, b.val));
+    return v_sqrt(x);
+}
+
+inline v_float32x4 v_sqr_magnitude(const v_float32x4& a, const v_float32x4& b)
+{
+    return v_float32x4(vmlaq_f32(vmulq_f32(a.val, a.val), b.val, b.val));
+}
+
+inline v_float32x4 v_muladd(const v_float32x4& a, const v_float32x4& b, const v_float32x4& c)
+{
+    return v_float32x4(vmlaq_f32(c.val, a.val, b.val));
+}
+
+// trade efficiency for convenience
+#define OPENCV_HAL_IMPL_NEON_SHIFT_OP(_Tpvec, suffix, _Tps, ssuffix) \
+inline _Tpvec operator << (const _Tpvec& a, int n) \
+{ return _Tpvec(vshlq_##suffix(a.val, vdupq_n_##ssuffix((_Tps)n))); } \
+inline _Tpvec operator >> (const _Tpvec& a, int n) \
+{ return _Tpvec(vshlq_##suffix(a.val, vdupq_n_##ssuffix((_Tps)-n))); } \
+template<int n> inline _Tpvec v_shl(const _Tpvec& a) \
+{ return _Tpvec(vshlq_n_##suffix(a.val, n)); } \
+template<int n> inline _Tpvec v_shr(const _Tpvec& a) \
+{ return _Tpvec(vshrq_n_##suffix(a.val, n)); } \
+template<int n> inline _Tpvec v_rshr(const _Tpvec& a) \
+{ return _Tpvec(vrshrq_n_##suffix(a.val, n)); }
+
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint8x16, u8, schar, s8)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int8x16, s8, schar, s8)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint16x8, u16, short, s16)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int16x8, s16, short, s16)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint32x4, u32, int, s32)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int32x4, s32, int, s32)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_uint64x2, u64, int64, s64)
+OPENCV_HAL_IMPL_NEON_SHIFT_OP(v_int64x2, s64, int64, s64)
+
+#define OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(_Tpvec, _Tp, suffix) \
+inline _Tpvec v_load(const _Tp* ptr) \
+{ return _Tpvec(vld1q_##suffix(ptr)); } \
+inline _Tpvec v_load_aligned(const _Tp* ptr) \
+{ return _Tpvec(vld1q_##suffix(ptr)); } \
+inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \
+{ return _Tpvec(vcombine_##suffix(vld1_##suffix(ptr0), vld1_##suffix(ptr1))); } \
+inline void v_store(_Tp* ptr, const _Tpvec& a) \
+{ vst1q_##suffix(ptr, a.val); } \
+inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \
+{ vst1q_##suffix(ptr, a.val); } \
+inline void v_store_low(_Tp* ptr, const _Tpvec& a) \
+{ vst1_##suffix(ptr, vget_low_##suffix(a.val)); } \
+inline void v_store_high(_Tp* ptr, const _Tpvec& a) \
+{ vst1_##suffix(ptr, vget_high_##suffix(a.val)); }
+
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int8x16, schar, s8)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int16x8, short, s16)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int32x4, int, s32)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_uint64x2, uint64, u64)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_int64x2, int64, s64)
+OPENCV_HAL_IMPL_NEON_LOADSTORE_OP(v_float32x4, float, f32)
+
+#define OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(_Tpvec, scalartype, func, scalar_func) \
+inline scalartype v_reduce_##func(const _Tpvec& a) \
+{ \
+    scalartype CV_DECL_ALIGNED(16) buf[4]; \
+    v_store_aligned(buf, a); \
+    scalartype s0 = scalar_func(buf[0], buf[1]); \
+    scalartype s1 = scalar_func(buf[2], buf[3]); \
+    return scalar_func(s0, s1); \
+}
+
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, unsigned, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, unsigned, max, std::max)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_uint32x4, unsigned, min, std::min)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int, max, std::max)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_int32x4, int, min, std::min)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float, max, std::max)
+OPENCV_HAL_IMPL_NEON_REDUCE_OP_4(v_float32x4, float, min, std::min)
+
+inline int v_signmask(const v_uint8x16& a)
+{
+    int8x8_t m0 = vcreate_s8(CV_BIG_UINT(0x0706050403020100));
+    uint8x16_t v0 = vshlq_u8(vshrq_n_u8(a.val, 7), vcombine_s8(m0, m0));
+    uint64x2_t v1 = vpaddlq_u32(vpaddlq_u16(vpaddlq_u8(v0)));
+    return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 8);
+}
+inline int v_signmask(const v_int8x16& a)
+{ return v_signmask(v_reinterpret_as_u8(a)); }
+
+inline int v_signmask(const v_uint16x8& a)
+{
+    int16x4_t m0 = vcreate_s16(CV_BIG_UINT(0x0003000200010000));
+    uint16x8_t v0 = vshlq_u16(vshrq_n_u16(a.val, 15), vcombine_s16(m0, m0));
+    uint64x2_t v1 = vpaddlq_u32(vpaddlq_u16(v0));
+    return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 4);
+}
+inline int v_signmask(const v_int16x8& a)
+{ return v_signmask(v_reinterpret_as_u16(a)); }
+
+inline int v_signmask(const v_uint32x4& a)
+{
+    int32x2_t m0 = vcreate_s32(CV_BIG_UINT(0x0000000100000000));
+    uint32x4_t v0 = vshlq_u32(vshrq_n_u32(a.val, 31), vcombine_s32(m0, m0));
+    uint64x2_t v1 = vpaddlq_u32(v0);
+    return (int)vgetq_lane_u64(v1, 0) + ((int)vgetq_lane_u64(v1, 1) << 2);
+}
+inline int v_signmask(const v_int32x4& a)
+{ return v_signmask(v_reinterpret_as_u32(a)); }
+inline int v_signmask(const v_float32x4& a)
+{ return v_signmask(v_reinterpret_as_u32(a)); }
+
+#define OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(_Tpvec, suffix, shift) \
+inline bool v_check_all(const v_##_Tpvec& a) \
+{ \
+    _Tpvec##_t v0 = vshrq_n_##suffix(vmvnq_##suffix(a.val), shift); \
+    uint64x2_t v1 = vreinterpretq_u64_##suffix(v0); \
+    return (vgetq_lane_u64(v1, 0) | vgetq_lane_u64(v1, 1)) == 0; \
+} \
+inline bool v_check_any(const v_##_Tpvec& a) \
+{ \
+    _Tpvec##_t v0 = vshrq_n_##suffix(a.val, shift); \
+    uint64x2_t v1 = vreinterpretq_u64_##suffix(v0); \
+    return (vgetq_lane_u64(v1, 0) | vgetq_lane_u64(v1, 1)) != 0; \
+}
+
+OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint8x16, u8, 7)
+OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint16x8, u16, 15)
+OPENCV_HAL_IMPL_NEON_CHECK_ALLANY(uint32x4, u32, 31)
+
+inline bool v_check_all(const v_int8x16& a)
+{ return v_check_all(v_reinterpret_as_u8(a)); }
+inline bool v_check_all(const v_int16x8& a)
+{ return v_check_all(v_reinterpret_as_u16(a)); }
+inline bool v_check_all(const v_int32x4& a)
+{ return v_check_all(v_reinterpret_as_u32(a)); }
+inline bool v_check_all(const v_float32x4& a)
+{ return v_check_all(v_reinterpret_as_u32(a)); }
+
+inline bool v_check_any(const v_int8x16& a)
+{ return v_check_any(v_reinterpret_as_u8(a)); }
+inline bool v_check_any(const v_int16x8& a)
+{ return v_check_any(v_reinterpret_as_u16(a)); }
+inline bool v_check_any(const v_int32x4& a)
+{ return v_check_any(v_reinterpret_as_u32(a)); }
+inline bool v_check_any(const v_float32x4& a)
+{ return v_check_any(v_reinterpret_as_u32(a)); }
+
+#define OPENCV_HAL_IMPL_NEON_SELECT(_Tpvec, suffix, usuffix) \
+inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(vbslq_##suffix(vreinterpretq_##usuffix##_##suffix(mask.val), a.val, b.val)); \
+}
+
+OPENCV_HAL_IMPL_NEON_SELECT(v_uint8x16, u8, u8)
+OPENCV_HAL_IMPL_NEON_SELECT(v_int8x16, s8, u8)
+OPENCV_HAL_IMPL_NEON_SELECT(v_uint16x8, u16, u16)
+OPENCV_HAL_IMPL_NEON_SELECT(v_int16x8, s16, u16)
+OPENCV_HAL_IMPL_NEON_SELECT(v_uint32x4, u32, u32)
+OPENCV_HAL_IMPL_NEON_SELECT(v_int32x4, s32, u32)
+OPENCV_HAL_IMPL_NEON_SELECT(v_float32x4, f32, u32)
+
+#define OPENCV_HAL_IMPL_NEON_EXPAND(_Tpvec, _Tpwvec, _Tp, suffix) \
+inline void v_expand(const _Tpvec& a, _Tpwvec& b0, _Tpwvec& b1) \
+{ \
+    b0.val = vmovl_##suffix(vget_low_##suffix(a.val)); \
+    b1.val = vmovl_##suffix(vget_high_##suffix(a.val)); \
+} \
+inline _Tpwvec v_load_expand(const _Tp* ptr) \
+{ \
+    return _Tpwvec(vmovl_##suffix(vld1_##suffix(ptr))); \
+}
+
+OPENCV_HAL_IMPL_NEON_EXPAND(v_uint8x16, v_uint16x8, uchar, u8)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_int8x16, v_int16x8, schar, s8)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_uint16x8, v_uint32x4, ushort, u16)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_int16x8, v_int32x4, short, s16)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_uint32x4, v_uint64x2, uint, u32)
+OPENCV_HAL_IMPL_NEON_EXPAND(v_int32x4, v_int64x2, int, s32)
+
+inline v_uint32x4 v_load_expand_q(const uchar* ptr)
+{
+    uint8x8_t v0 = vcreate_u8(*(unsigned*)ptr);
+    uint16x4_t v1 = vget_low_u16(vmovl_u8(v0));
+    return v_uint32x4(vmovl_u16(v1));
+}
+
+inline v_int32x4 v_load_expand_q(const schar* ptr)
+{
+    int8x8_t v0 = vcreate_s8(*(unsigned*)ptr);
+    int16x4_t v1 = vget_low_s16(vmovl_s8(v0));
+    return v_int32x4(vmovl_s16(v1));
+}
+
+#define OPENCV_HAL_IMPL_NEON_UNPACKS(_Tpvec, suffix) \
+inline void v_zip(const v_##_Tpvec& a0, const v_##_Tpvec& a1, v_##_Tpvec& b0, v_##_Tpvec& b1) \
+{ \
+    _Tpvec##x2_t p = vzipq_##suffix(a0.val, a1.val); \
+    b0.val = p.val[0]; \
+    b1.val = p.val[1]; \
+} \
+inline v_##_Tpvec v_combine_low(const v_##_Tpvec& a, const v_##_Tpvec& b) \
+{ \
+    return v_##_Tpvec(vcombine_##suffix(vget_low_##suffix(a.val), vget_low_##suffix(b.val))); \
+} \
+inline v_##_Tpvec v_combine_high(const v_##_Tpvec& a, const v_##_Tpvec& b) \
+{ \
+    return v_##_Tpvec(vcombine_##suffix(vget_high_##suffix(a.val), vget_high_##suffix(b.val))); \
+} \
+inline void v_recombine(const v_##_Tpvec& a, const v_##_Tpvec& b, v_##_Tpvec& c, v_##_Tpvec& d) \
+{ \
+    c.val = vcombine_##suffix(vget_low_##suffix(a.val), vget_low_##suffix(b.val)); \
+    d.val = vcombine_##suffix(vget_high_##suffix(a.val), vget_high_##suffix(b.val)); \
+}
+
+OPENCV_HAL_IMPL_NEON_UNPACKS(uint8x16, u8)
+OPENCV_HAL_IMPL_NEON_UNPACKS(int8x16, s8)
+OPENCV_HAL_IMPL_NEON_UNPACKS(uint16x8, u16)
+OPENCV_HAL_IMPL_NEON_UNPACKS(int16x8, s16)
+OPENCV_HAL_IMPL_NEON_UNPACKS(uint32x4, u32)
+OPENCV_HAL_IMPL_NEON_UNPACKS(int32x4, s32)
+OPENCV_HAL_IMPL_NEON_UNPACKS(float32x4, f32)
+
+#define OPENCV_HAL_IMPL_NEON_EXTRACT(_Tpvec, suffix) \
+template <int s> \
+inline v_##_Tpvec v_extract(const v_##_Tpvec& a, const v_##_Tpvec& b) \
+{ \
+    return v_##_Tpvec(vextq_##suffix(a.val, b.val, s)); \
+}
+
+OPENCV_HAL_IMPL_NEON_EXTRACT(uint8x16, u8)
+OPENCV_HAL_IMPL_NEON_EXTRACT(int8x16, s8)
+OPENCV_HAL_IMPL_NEON_EXTRACT(uint16x8, u16)
+OPENCV_HAL_IMPL_NEON_EXTRACT(int16x8, s16)
+OPENCV_HAL_IMPL_NEON_EXTRACT(uint32x4, u32)
+OPENCV_HAL_IMPL_NEON_EXTRACT(int32x4, s32)
+OPENCV_HAL_IMPL_NEON_EXTRACT(uint64x2, u64)
+OPENCV_HAL_IMPL_NEON_EXTRACT(int64x2, s64)
+OPENCV_HAL_IMPL_NEON_EXTRACT(float32x4, f32)
+
+inline v_int32x4 v_round(const v_float32x4& a)
+{
+    static const int32x4_t v_sign = vdupq_n_s32(1 << 31),
+        v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f));
+
+    int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(a.val)));
+    return v_int32x4(vcvtq_s32_f32(vaddq_f32(a.val, vreinterpretq_f32_s32(v_addition))));
+}
+
+inline v_int32x4 v_floor(const v_float32x4& a)
+{
+    int32x4_t a1 = vcvtq_s32_f32(a.val);
+    uint32x4_t mask = vcgtq_f32(vcvtq_f32_s32(a1), a.val);
+    return v_int32x4(vaddq_s32(a1, vreinterpretq_s32_u32(mask)));
+}
+
+inline v_int32x4 v_ceil(const v_float32x4& a)
+{
+    int32x4_t a1 = vcvtq_s32_f32(a.val);
+    uint32x4_t mask = vcgtq_f32(a.val, vcvtq_f32_s32(a1));
+    return v_int32x4(vsubq_s32(a1, vreinterpretq_s32_u32(mask)));
+}
+
+inline v_int32x4 v_trunc(const v_float32x4& a)
+{ return v_int32x4(vcvtq_s32_f32(a.val)); }
+
+#define OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(_Tpvec, suffix) \
+inline void v_transpose4x4(const v_##_Tpvec& a0, const v_##_Tpvec& a1, \
+                         const v_##_Tpvec& a2, const v_##_Tpvec& a3, \
+                         v_##_Tpvec& b0, v_##_Tpvec& b1, \
+                         v_##_Tpvec& b2, v_##_Tpvec& b3) \
+{ \
+    /* m00 m01 m02 m03 */ \
+    /* m10 m11 m12 m13 */ \
+    /* m20 m21 m22 m23 */ \
+    /* m30 m31 m32 m33 */ \
+    _Tpvec##x2_t t0 = vtrnq_##suffix(a0.val, a1.val); \
+    _Tpvec##x2_t t1 = vtrnq_##suffix(a2.val, a3.val); \
+    /* m00 m10 m02 m12 */ \
+    /* m01 m11 m03 m13 */ \
+    /* m20 m30 m22 m32 */ \
+    /* m21 m31 m23 m33 */ \
+    b0.val = vcombine_##suffix(vget_low_##suffix(t0.val[0]), vget_low_##suffix(t1.val[0])); \
+    b1.val = vcombine_##suffix(vget_low_##suffix(t0.val[1]), vget_low_##suffix(t1.val[1])); \
+    b2.val = vcombine_##suffix(vget_high_##suffix(t0.val[0]), vget_high_##suffix(t1.val[0])); \
+    b3.val = vcombine_##suffix(vget_high_##suffix(t0.val[1]), vget_high_##suffix(t1.val[1])); \
+}
+
+OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(uint32x4, u32)
+OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(int32x4, s32)
+OPENCV_HAL_IMPL_NEON_TRANSPOSE4x4(float32x4, f32)
+
+#define OPENCV_HAL_IMPL_NEON_INTERLEAVED(_Tpvec, _Tp, suffix) \
+inline void v_load_deinterleave(const _Tp* ptr, v_##_Tpvec& a, v_##_Tpvec& b, v_##_Tpvec& c) \
+{ \
+    _Tpvec##x3_t v = vld3q_##suffix(ptr); \
+    a.val = v.val[0]; \
+    b.val = v.val[1]; \
+    c.val = v.val[2]; \
+} \
+inline void v_load_deinterleave(const _Tp* ptr, v_##_Tpvec& a, v_##_Tpvec& b, \
+                                v_##_Tpvec& c, v_##_Tpvec& d) \
+{ \
+    _Tpvec##x4_t v = vld4q_##suffix(ptr); \
+    a.val = v.val[0]; \
+    b.val = v.val[1]; \
+    c.val = v.val[2]; \
+    d.val = v.val[3]; \
+} \
+inline void v_store_interleave( _Tp* ptr, const v_##_Tpvec& a, const v_##_Tpvec& b, const v_##_Tpvec& c) \
+{ \
+    _Tpvec##x3_t v; \
+    v.val[0] = a.val; \
+    v.val[1] = b.val; \
+    v.val[2] = c.val; \
+    vst3q_##suffix(ptr, v); \
+} \
+inline void v_store_interleave( _Tp* ptr, const v_##_Tpvec& a, const v_##_Tpvec& b, \
+                               const v_##_Tpvec& c, const v_##_Tpvec& d) \
+{ \
+    _Tpvec##x4_t v; \
+    v.val[0] = a.val; \
+    v.val[1] = b.val; \
+    v.val[2] = c.val; \
+    v.val[3] = d.val; \
+    vst4q_##suffix(ptr, v); \
+}
+
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(int8x16, schar, s8)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(int16x8, short, s16)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(int32x4, int, s32)
+OPENCV_HAL_IMPL_NEON_INTERLEAVED(float32x4, float, f32)
+
+inline v_float32x4 v_cvt_f32(const v_int32x4& a)
+{
+    return v_float32x4(vcvtq_f32_s32(a.val));
+}
+
+//! @endcond
+
+}
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp
new file mode 100644
index 0000000..1840e03
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/hal/intrin_sse.hpp
@@ -0,0 +1,1599 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_SSE_HPP__
+#define __OPENCV_HAL_SSE_HPP__
+
+#include <algorithm>
+
+#define CV_SIMD128 1
+#define CV_SIMD128_64F 1
+
+namespace cv
+{
+
+//! @cond IGNORED
+
+struct v_uint8x16
+{
+    typedef uchar lane_type;
+    enum { nlanes = 16 };
+
+    v_uint8x16() {}
+    explicit v_uint8x16(__m128i v) : val(v) {}
+    v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7,
+               uchar v8, uchar v9, uchar v10, uchar v11, uchar v12, uchar v13, uchar v14, uchar v15)
+    {
+        val = _mm_setr_epi8((char)v0, (char)v1, (char)v2, (char)v3,
+                            (char)v4, (char)v5, (char)v6, (char)v7,
+                            (char)v8, (char)v9, (char)v10, (char)v11,
+                            (char)v12, (char)v13, (char)v14, (char)v15);
+    }
+    uchar get0() const
+    {
+        return (uchar)_mm_cvtsi128_si32(val);
+    }
+
+    __m128i val;
+};
+
+struct v_int8x16
+{
+    typedef schar lane_type;
+    enum { nlanes = 16 };
+
+    v_int8x16() {}
+    explicit v_int8x16(__m128i v) : val(v) {}
+    v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7,
+              schar v8, schar v9, schar v10, schar v11, schar v12, schar v13, schar v14, schar v15)
+    {
+        val = _mm_setr_epi8((char)v0, (char)v1, (char)v2, (char)v3,
+                            (char)v4, (char)v5, (char)v6, (char)v7,
+                            (char)v8, (char)v9, (char)v10, (char)v11,
+                            (char)v12, (char)v13, (char)v14, (char)v15);
+    }
+    schar get0() const
+    {
+        return (schar)_mm_cvtsi128_si32(val);
+    }
+
+    __m128i val;
+};
+
+struct v_uint16x8
+{
+    typedef ushort lane_type;
+    enum { nlanes = 8 };
+
+    v_uint16x8() {}
+    explicit v_uint16x8(__m128i v) : val(v) {}
+    v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7)
+    {
+        val = _mm_setr_epi16((short)v0, (short)v1, (short)v2, (short)v3,
+                             (short)v4, (short)v5, (short)v6, (short)v7);
+    }
+    ushort get0() const
+    {
+        return (ushort)_mm_cvtsi128_si32(val);
+    }
+
+    __m128i val;
+};
+
+struct v_int16x8
+{
+    typedef short lane_type;
+    enum { nlanes = 8 };
+
+    v_int16x8() {}
+    explicit v_int16x8(__m128i v) : val(v) {}
+    v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7)
+    {
+        val = _mm_setr_epi16((short)v0, (short)v1, (short)v2, (short)v3,
+                             (short)v4, (short)v5, (short)v6, (short)v7);
+    }
+    short get0() const
+    {
+        return (short)_mm_cvtsi128_si32(val);
+    }
+    __m128i val;
+};
+
+struct v_uint32x4
+{
+    typedef unsigned lane_type;
+    enum { nlanes = 4 };
+
+    v_uint32x4() {}
+    explicit v_uint32x4(__m128i v) : val(v) {}
+    v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3)
+    {
+        val = _mm_setr_epi32((int)v0, (int)v1, (int)v2, (int)v3);
+    }
+    unsigned get0() const
+    {
+        return (unsigned)_mm_cvtsi128_si32(val);
+    }
+    __m128i val;
+};
+
+struct v_int32x4
+{
+    typedef int lane_type;
+    enum { nlanes = 4 };
+
+    v_int32x4() {}
+    explicit v_int32x4(__m128i v) : val(v) {}
+    v_int32x4(int v0, int v1, int v2, int v3)
+    {
+        val = _mm_setr_epi32(v0, v1, v2, v3);
+    }
+    int get0() const
+    {
+        return _mm_cvtsi128_si32(val);
+    }
+    __m128i val;
+};
+
+struct v_float32x4
+{
+    typedef float lane_type;
+    enum { nlanes = 4 };
+
+    v_float32x4() {}
+    explicit v_float32x4(__m128 v) : val(v) {}
+    v_float32x4(float v0, float v1, float v2, float v3)
+    {
+        val = _mm_setr_ps(v0, v1, v2, v3);
+    }
+    float get0() const
+    {
+        return _mm_cvtss_f32(val);
+    }
+    __m128 val;
+};
+
+struct v_uint64x2
+{
+    typedef uint64 lane_type;
+    enum { nlanes = 2 };
+
+    v_uint64x2() {}
+    explicit v_uint64x2(__m128i v) : val(v) {}
+    v_uint64x2(uint64 v0, uint64 v1)
+    {
+        val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32));
+    }
+    uint64 get0() const
+    {
+        int a = _mm_cvtsi128_si32(val);
+        int b = _mm_cvtsi128_si32(_mm_srli_epi64(val, 32));
+        return (unsigned)a | ((uint64)(unsigned)b << 32);
+    }
+    __m128i val;
+};
+
+struct v_int64x2
+{
+    typedef int64 lane_type;
+    enum { nlanes = 2 };
+
+    v_int64x2() {}
+    explicit v_int64x2(__m128i v) : val(v) {}
+    v_int64x2(int64 v0, int64 v1)
+    {
+        val = _mm_setr_epi32((int)v0, (int)(v0 >> 32), (int)v1, (int)(v1 >> 32));
+    }
+    int64 get0() const
+    {
+        int a = _mm_cvtsi128_si32(val);
+        int b = _mm_cvtsi128_si32(_mm_srli_epi64(val, 32));
+        return (int64)((unsigned)a | ((uint64)(unsigned)b << 32));
+    }
+    __m128i val;
+};
+
+struct v_float64x2
+{
+    typedef double lane_type;
+    enum { nlanes = 2 };
+
+    v_float64x2() {}
+    explicit v_float64x2(__m128d v) : val(v) {}
+    v_float64x2(double v0, double v1)
+    {
+        val = _mm_setr_pd(v0, v1);
+    }
+    double get0() const
+    {
+        return _mm_cvtsd_f64(val);
+    }
+    __m128d val;
+};
+
+#define OPENCV_HAL_IMPL_SSE_INITVEC(_Tpvec, _Tp, suffix, zsuffix, ssuffix, _Tps, cast) \
+inline _Tpvec v_setzero_##suffix() { return _Tpvec(_mm_setzero_##zsuffix()); } \
+inline _Tpvec v_setall_##suffix(_Tp v) { return _Tpvec(_mm_set1_##ssuffix((_Tps)v)); } \
+template<typename _Tpvec0> inline _Tpvec v_reinterpret_as_##suffix(const _Tpvec0& a) \
+{ return _Tpvec(cast(a.val)); }
+
+OPENCV_HAL_IMPL_SSE_INITVEC(v_uint8x16, uchar, u8, si128, epi8, char, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_int8x16, schar, s8, si128, epi8, char, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_uint16x8, ushort, u16, si128, epi16, short, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_int16x8, short, s16, si128, epi16, short, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_uint32x4, unsigned, u32, si128, epi32, int, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_int32x4, int, s32, si128, epi32, int, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_float32x4, float, f32, ps, ps, float, _mm_castsi128_ps)
+OPENCV_HAL_IMPL_SSE_INITVEC(v_float64x2, double, f64, pd, pd, double, _mm_castsi128_pd)
+
+inline v_uint64x2 v_setzero_u64() { return v_uint64x2(_mm_setzero_si128()); }
+inline v_int64x2 v_setzero_s64() { return v_int64x2(_mm_setzero_si128()); }
+inline v_uint64x2 v_setall_u64(uint64 val) { return v_uint64x2(val, val); }
+inline v_int64x2 v_setall_s64(int64 val) { return v_int64x2(val, val); }
+
+template<typename _Tpvec> inline
+v_uint64x2 v_reinterpret_as_u64(const _Tpvec& a) { return v_uint64x2(a.val); }
+template<typename _Tpvec> inline
+v_int64x2 v_reinterpret_as_s64(const _Tpvec& a) { return v_int64x2(a.val); }
+inline v_float32x4 v_reinterpret_as_f32(const v_uint64x2& a)
+{ return v_float32x4(_mm_castsi128_ps(a.val)); }
+inline v_float32x4 v_reinterpret_as_f32(const v_int64x2& a)
+{ return v_float32x4(_mm_castsi128_ps(a.val)); }
+inline v_float64x2 v_reinterpret_as_f64(const v_uint64x2& a)
+{ return v_float64x2(_mm_castsi128_pd(a.val)); }
+inline v_float64x2 v_reinterpret_as_f64(const v_int64x2& a)
+{ return v_float64x2(_mm_castsi128_pd(a.val)); }
+
+#define OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(_Tpvec, suffix) \
+inline _Tpvec v_reinterpret_as_##suffix(const v_float32x4& a) \
+{ return _Tpvec(_mm_castps_si128(a.val)); } \
+inline _Tpvec v_reinterpret_as_##suffix(const v_float64x2& a) \
+{ return _Tpvec(_mm_castpd_si128(a.val)); }
+
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint8x16, u8)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int8x16, s8)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint16x8, u16)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int16x8, s16)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint32x4, u32)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int32x4, s32)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_uint64x2, u64)
+OPENCV_HAL_IMPL_SSE_INIT_FROM_FLT(v_int64x2, s64)
+
+inline v_float32x4 v_reinterpret_as_f32(const v_float32x4& a) {return a; }
+inline v_float64x2 v_reinterpret_as_f64(const v_float64x2& a) {return a; }
+inline v_float32x4 v_reinterpret_as_f32(const v_float64x2& a) {return v_float32x4(_mm_castpd_ps(a.val)); }
+inline v_float64x2 v_reinterpret_as_f64(const v_float32x4& a) {return v_float64x2(_mm_castps_pd(a.val)); }
+
+//////////////// PACK ///////////////
+inline v_uint8x16 v_pack(const v_uint16x8& a, const v_uint16x8& b)
+{
+    __m128i delta = _mm_set1_epi16(255);
+    return v_uint8x16(_mm_packus_epi16(_mm_subs_epu16(a.val, _mm_subs_epu16(a.val, delta)),
+                                       _mm_subs_epu16(b.val, _mm_subs_epu16(b.val, delta))));
+}
+
+inline void v_pack_store(uchar* ptr, const v_uint16x8& a)
+{
+    __m128i delta = _mm_set1_epi16(255);
+    __m128i a1 = _mm_subs_epu16(a.val, _mm_subs_epu16(a.val, delta));
+    _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1));
+}
+
+inline v_uint8x16 v_pack_u(const v_int16x8& a, const v_int16x8& b)
+{ return v_uint8x16(_mm_packus_epi16(a.val, b.val)); }
+
+inline void v_pack_u_store(uchar* ptr, const v_int16x8& a)
+{ _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a.val, a.val)); }
+
+template<int n> inline
+v_uint8x16 v_rshr_pack(const v_uint16x8& a, const v_uint16x8& b)
+{
+    // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers.
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    return v_uint8x16(_mm_packus_epi16(_mm_srli_epi16(_mm_adds_epu16(a.val, delta), n),
+                                       _mm_srli_epi16(_mm_adds_epu16(b.val, delta), n)));
+}
+
+template<int n> inline
+void v_rshr_pack_store(uchar* ptr, const v_uint16x8& a)
+{
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    __m128i a1 = _mm_srli_epi16(_mm_adds_epu16(a.val, delta), n);
+    _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1));
+}
+
+template<int n> inline
+v_uint8x16 v_rshr_pack_u(const v_int16x8& a, const v_int16x8& b)
+{
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    return v_uint8x16(_mm_packus_epi16(_mm_srai_epi16(_mm_adds_epi16(a.val, delta), n),
+                                       _mm_srai_epi16(_mm_adds_epi16(b.val, delta), n)));
+}
+
+template<int n> inline
+void v_rshr_pack_u_store(uchar* ptr, const v_int16x8& a)
+{
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    __m128i a1 = _mm_srai_epi16(_mm_adds_epi16(a.val, delta), n);
+    _mm_storel_epi64((__m128i*)ptr, _mm_packus_epi16(a1, a1));
+}
+
+inline v_int8x16 v_pack(const v_int16x8& a, const v_int16x8& b)
+{ return v_int8x16(_mm_packs_epi16(a.val, b.val)); }
+
+inline void v_pack_store(schar* ptr, v_int16x8& a)
+{ _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi16(a.val, a.val)); }
+
+template<int n> inline
+v_int8x16 v_rshr_pack(const v_int16x8& a, const v_int16x8& b)
+{
+    // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers.
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    return v_int8x16(_mm_packs_epi16(_mm_srai_epi16(_mm_adds_epi16(a.val, delta), n),
+                                     _mm_srai_epi16(_mm_adds_epi16(b.val, delta), n)));
+}
+template<int n> inline
+void v_rshr_pack_store(schar* ptr, const v_int16x8& a)
+{
+    // we assume that n > 0, and so the shifted 16-bit values can be treated as signed numbers.
+    __m128i delta = _mm_set1_epi16((short)(1 << (n-1)));
+    __m128i a1 = _mm_srai_epi16(_mm_adds_epi16(a.val, delta), n);
+    _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi16(a1, a1));
+}
+
+
+// bit-wise "mask ? a : b"
+inline __m128i v_select_si128(__m128i mask, __m128i a, __m128i b)
+{
+    return _mm_xor_si128(b, _mm_and_si128(_mm_xor_si128(a, b), mask));
+}
+
+inline v_uint16x8 v_pack(const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i z = _mm_setzero_si128(), maxval32 = _mm_set1_epi32(65535), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(v_select_si128(_mm_cmpgt_epi32(z, a.val), maxval32, a.val), delta32);
+    __m128i b1 = _mm_sub_epi32(v_select_si128(_mm_cmpgt_epi32(z, b.val), maxval32, b.val), delta32);
+    __m128i r = _mm_packs_epi32(a1, b1);
+    return v_uint16x8(_mm_sub_epi16(r, _mm_set1_epi16(-32768)));
+}
+
+inline void v_pack_store(ushort* ptr, const v_uint32x4& a)
+{
+    __m128i z = _mm_setzero_si128(), maxval32 = _mm_set1_epi32(65535), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(v_select_si128(_mm_cmpgt_epi32(z, a.val), maxval32, a.val), delta32);
+    __m128i r = _mm_packs_epi32(a1, a1);
+    _mm_storel_epi64((__m128i*)ptr, _mm_sub_epi16(r, _mm_set1_epi16(-32768)));
+}
+
+template<int n> inline
+v_uint16x8 v_rshr_pack(const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(a.val, delta), n), delta32);
+    __m128i b1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(b.val, delta), n), delta32);
+    return v_uint16x8(_mm_sub_epi16(_mm_packs_epi32(a1, b1), _mm_set1_epi16(-32768)));
+}
+
+template<int n> inline
+void v_rshr_pack_store(ushort* ptr, const v_uint32x4& a)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(_mm_srli_epi32(_mm_add_epi32(a.val, delta), n), delta32);
+    __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768));
+    _mm_storel_epi64((__m128i*)ptr, a2);
+}
+
+inline v_uint16x8 v_pack_u(const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i delta32 = _mm_set1_epi32(32768);
+    __m128i r = _mm_packs_epi32(_mm_sub_epi32(a.val, delta32), _mm_sub_epi32(b.val, delta32));
+    return v_uint16x8(_mm_sub_epi16(r, _mm_set1_epi16(-32768)));
+}
+
+inline void v_pack_u_store(ushort* ptr, const v_int32x4& a)
+{
+    __m128i delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(a.val, delta32);
+    __m128i r = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768));
+    _mm_storel_epi64((__m128i*)ptr, r);
+}
+
+template<int n> inline
+v_uint16x8 v_rshr_pack_u(const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n), delta32);
+    __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768));
+    __m128i b1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(b.val, delta), n), delta32);
+    __m128i b2 = _mm_sub_epi16(_mm_packs_epi32(b1, b1), _mm_set1_epi16(-32768));
+    return v_uint16x8(_mm_unpacklo_epi64(a2, b2));
+}
+
+template<int n> inline
+void v_rshr_pack_u_store(ushort* ptr, const v_int32x4& a)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1)), delta32 = _mm_set1_epi32(32768);
+    __m128i a1 = _mm_sub_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n), delta32);
+    __m128i a2 = _mm_sub_epi16(_mm_packs_epi32(a1, a1), _mm_set1_epi16(-32768));
+    _mm_storel_epi64((__m128i*)ptr, a2);
+}
+
+inline v_int16x8 v_pack(const v_int32x4& a, const v_int32x4& b)
+{ return v_int16x8(_mm_packs_epi32(a.val, b.val)); }
+
+inline void v_pack_store(short* ptr, const v_int32x4& a)
+{
+    _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi32(a.val, a.val));
+}
+
+template<int n> inline
+v_int16x8 v_rshr_pack(const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1));
+    return v_int16x8(_mm_packs_epi32(_mm_srai_epi32(_mm_add_epi32(a.val, delta), n),
+                                     _mm_srai_epi32(_mm_add_epi32(b.val, delta), n)));
+}
+
+template<int n> inline
+void v_rshr_pack_store(short* ptr, const v_int32x4& a)
+{
+    __m128i delta = _mm_set1_epi32(1 << (n-1));
+    __m128i a1 = _mm_srai_epi32(_mm_add_epi32(a.val, delta), n);
+    _mm_storel_epi64((__m128i*)ptr, _mm_packs_epi32(a1, a1));
+}
+
+
+// [a0 0 | b0 0]  [a1 0 | b1 0]
+inline v_uint32x4 v_pack(const v_uint64x2& a, const v_uint64x2& b)
+{
+    __m128i v0 = _mm_unpacklo_epi32(a.val, b.val); // a0 a1 0 0
+    __m128i v1 = _mm_unpackhi_epi32(a.val, b.val); // b0 b1 0 0
+    return v_uint32x4(_mm_unpacklo_epi32(v0, v1));
+}
+
+inline void v_pack_store(unsigned* ptr, const v_uint64x2& a)
+{
+    __m128i a1 = _mm_shuffle_epi32(a.val, _MM_SHUFFLE(0, 2, 2, 0));
+    _mm_storel_epi64((__m128i*)ptr, a1);
+}
+
+// [a0 0 | b0 0]  [a1 0 | b1 0]
+inline v_int32x4 v_pack(const v_int64x2& a, const v_int64x2& b)
+{
+    __m128i v0 = _mm_unpacklo_epi32(a.val, b.val); // a0 a1 0 0
+    __m128i v1 = _mm_unpackhi_epi32(a.val, b.val); // b0 b1 0 0
+    return v_int32x4(_mm_unpacklo_epi32(v0, v1));
+}
+
+inline void v_pack_store(int* ptr, const v_int64x2& a)
+{
+    __m128i a1 = _mm_shuffle_epi32(a.val, _MM_SHUFFLE(0, 2, 2, 0));
+    _mm_storel_epi64((__m128i*)ptr, a1);
+}
+
+template<int n> inline
+v_uint32x4 v_rshr_pack(const v_uint64x2& a, const v_uint64x2& b)
+{
+    uint64 delta = (uint64)1 << (n-1);
+    v_uint64x2 delta2(delta, delta);
+    __m128i a1 = _mm_srli_epi64(_mm_add_epi64(a.val, delta2.val), n);
+    __m128i b1 = _mm_srli_epi64(_mm_add_epi64(b.val, delta2.val), n);
+    __m128i v0 = _mm_unpacklo_epi32(a1, b1); // a0 a1 0 0
+    __m128i v1 = _mm_unpackhi_epi32(a1, b1); // b0 b1 0 0
+    return v_uint32x4(_mm_unpacklo_epi32(v0, v1));
+}
+
+template<int n> inline
+void v_rshr_pack_store(unsigned* ptr, const v_uint64x2& a)
+{
+    uint64 delta = (uint64)1 << (n-1);
+    v_uint64x2 delta2(delta, delta);
+    __m128i a1 = _mm_srli_epi64(_mm_add_epi64(a.val, delta2.val), n);
+    __m128i a2 = _mm_shuffle_epi32(a1, _MM_SHUFFLE(0, 2, 2, 0));
+    _mm_storel_epi64((__m128i*)ptr, a2);
+}
+
+inline __m128i v_sign_epi64(__m128i a)
+{
+    return _mm_shuffle_epi32(_mm_srai_epi32(a, 31), _MM_SHUFFLE(3, 3, 1, 1)); // x m0 | x m1
+}
+
+inline __m128i v_srai_epi64(__m128i a, int imm)
+{
+    __m128i smask = v_sign_epi64(a);
+    return _mm_xor_si128(_mm_srli_epi64(_mm_xor_si128(a, smask), imm), smask);
+}
+
+template<int n> inline
+v_int32x4 v_rshr_pack(const v_int64x2& a, const v_int64x2& b)
+{
+    int64 delta = (int64)1 << (n-1);
+    v_int64x2 delta2(delta, delta);
+    __m128i a1 = v_srai_epi64(_mm_add_epi64(a.val, delta2.val), n);
+    __m128i b1 = v_srai_epi64(_mm_add_epi64(b.val, delta2.val), n);
+    __m128i v0 = _mm_unpacklo_epi32(a1, b1); // a0 a1 0 0
+    __m128i v1 = _mm_unpackhi_epi32(a1, b1); // b0 b1 0 0
+    return v_int32x4(_mm_unpacklo_epi32(v0, v1));
+}
+
+template<int n> inline
+void v_rshr_pack_store(int* ptr, const v_int64x2& a)
+{
+    int64 delta = (int64)1 << (n-1);
+    v_int64x2 delta2(delta, delta);
+    __m128i a1 = v_srai_epi64(_mm_add_epi64(a.val, delta2.val), n);
+    __m128i a2 = _mm_shuffle_epi32(a1, _MM_SHUFFLE(0, 2, 2, 0));
+    _mm_storel_epi64((__m128i*)ptr, a2);
+}
+
+inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0,
+                            const v_float32x4& m1, const v_float32x4& m2,
+                            const v_float32x4& m3)
+{
+    __m128 v0 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(0, 0, 0, 0)), m0.val);
+    __m128 v1 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(1, 1, 1, 1)), m1.val);
+    __m128 v2 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(2, 2, 2, 2)), m2.val);
+    __m128 v3 = _mm_mul_ps(_mm_shuffle_ps(v.val, v.val, _MM_SHUFFLE(3, 3, 3, 3)), m3.val);
+
+    return v_float32x4(_mm_add_ps(_mm_add_ps(v0, v1), _mm_add_ps(v2, v3)));
+}
+
+
+#define OPENCV_HAL_IMPL_SSE_BIN_OP(bin_op, _Tpvec, intrin) \
+    inline _Tpvec operator bin_op (const _Tpvec& a, const _Tpvec& b) \
+    { \
+        return _Tpvec(intrin(a.val, b.val)); \
+    } \
+    inline _Tpvec& operator bin_op##= (_Tpvec& a, const _Tpvec& b) \
+    { \
+        a.val = intrin(a.val, b.val); \
+        return a; \
+    }
+
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint8x16, _mm_adds_epu8)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint8x16, _mm_subs_epu8)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int8x16, _mm_adds_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int8x16, _mm_subs_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint16x8, _mm_adds_epu16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint16x8, _mm_subs_epu16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_uint16x8, _mm_mullo_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int16x8, _mm_adds_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int16x8, _mm_subs_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_int16x8, _mm_mullo_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint32x4, _mm_add_epi32)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint32x4, _mm_sub_epi32)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int32x4, _mm_add_epi32)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int32x4, _mm_sub_epi32)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_float32x4, _mm_add_ps)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_float32x4, _mm_sub_ps)
+OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_float32x4, _mm_mul_ps)
+OPENCV_HAL_IMPL_SSE_BIN_OP(/, v_float32x4, _mm_div_ps)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_float64x2, _mm_add_pd)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_float64x2, _mm_sub_pd)
+OPENCV_HAL_IMPL_SSE_BIN_OP(*, v_float64x2, _mm_mul_pd)
+OPENCV_HAL_IMPL_SSE_BIN_OP(/, v_float64x2, _mm_div_pd)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_uint64x2, _mm_add_epi64)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_uint64x2, _mm_sub_epi64)
+OPENCV_HAL_IMPL_SSE_BIN_OP(+, v_int64x2, _mm_add_epi64)
+OPENCV_HAL_IMPL_SSE_BIN_OP(-, v_int64x2, _mm_sub_epi64)
+
+inline v_uint32x4 operator * (const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i c0 = _mm_mul_epu32(a.val, b.val);
+    __m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a.val, 32), _mm_srli_epi64(b.val, 32));
+    __m128i d0 = _mm_unpacklo_epi32(c0, c1);
+    __m128i d1 = _mm_unpackhi_epi32(c0, c1);
+    return v_uint32x4(_mm_unpacklo_epi64(d0, d1));
+}
+inline v_int32x4 operator * (const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i c0 = _mm_mul_epu32(a.val, b.val);
+    __m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a.val, 32), _mm_srli_epi64(b.val, 32));
+    __m128i d0 = _mm_unpacklo_epi32(c0, c1);
+    __m128i d1 = _mm_unpackhi_epi32(c0, c1);
+    return v_int32x4(_mm_unpacklo_epi64(d0, d1));
+}
+inline v_uint32x4& operator *= (v_uint32x4& a, const v_uint32x4& b)
+{
+    a = a * b;
+    return a;
+}
+inline v_int32x4& operator *= (v_int32x4& a, const v_int32x4& b)
+{
+    a = a * b;
+    return a;
+}
+
+inline void v_mul_expand(const v_int16x8& a, const v_int16x8& b,
+                         v_int32x4& c, v_int32x4& d)
+{
+    __m128i v0 = _mm_mullo_epi16(a.val, b.val);
+    __m128i v1 = _mm_mulhi_epi16(a.val, b.val);
+    c.val = _mm_unpacklo_epi16(v0, v1);
+    d.val = _mm_unpackhi_epi16(v0, v1);
+}
+
+inline void v_mul_expand(const v_uint16x8& a, const v_uint16x8& b,
+                         v_uint32x4& c, v_uint32x4& d)
+{
+    __m128i v0 = _mm_mullo_epi16(a.val, b.val);
+    __m128i v1 = _mm_mulhi_epu16(a.val, b.val);
+    c.val = _mm_unpacklo_epi16(v0, v1);
+    d.val = _mm_unpackhi_epi16(v0, v1);
+}
+
+inline void v_mul_expand(const v_uint32x4& a, const v_uint32x4& b,
+                         v_uint64x2& c, v_uint64x2& d)
+{
+    __m128i c0 = _mm_mul_epu32(a.val, b.val);
+    __m128i c1 = _mm_mul_epu32(_mm_srli_epi64(a.val, 32), _mm_srli_epi64(b.val, 32));
+    c.val = _mm_unpacklo_epi64(c0, c1);
+    d.val = _mm_unpackhi_epi64(c0, c1);
+}
+
+inline v_int32x4 v_dotprod(const v_int16x8& a, const v_int16x8& b)
+{
+    return v_int32x4(_mm_madd_epi16(a.val, b.val));
+}
+
+#define OPENCV_HAL_IMPL_SSE_LOGIC_OP(_Tpvec, suffix, not_const) \
+    OPENCV_HAL_IMPL_SSE_BIN_OP(&, _Tpvec, _mm_and_##suffix) \
+    OPENCV_HAL_IMPL_SSE_BIN_OP(|, _Tpvec, _mm_or_##suffix) \
+    OPENCV_HAL_IMPL_SSE_BIN_OP(^, _Tpvec, _mm_xor_##suffix) \
+    inline _Tpvec operator ~ (const _Tpvec& a) \
+    { \
+        return _Tpvec(_mm_xor_##suffix(a.val, not_const)); \
+    }
+
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint8x16, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int8x16, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint16x8, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int16x8, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint32x4, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int32x4, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_uint64x2, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_int64x2, si128, _mm_set1_epi32(-1))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_float32x4, ps, _mm_castsi128_ps(_mm_set1_epi32(-1)))
+OPENCV_HAL_IMPL_SSE_LOGIC_OP(v_float64x2, pd, _mm_castsi128_pd(_mm_set1_epi32(-1)))
+
+inline v_float32x4 v_sqrt(const v_float32x4& x)
+{ return v_float32x4(_mm_sqrt_ps(x.val)); }
+
+inline v_float32x4 v_invsqrt(const v_float32x4& x)
+{
+    static const __m128 _0_5 = _mm_set1_ps(0.5f), _1_5 = _mm_set1_ps(1.5f);
+    __m128 t = x.val;
+    __m128 h = _mm_mul_ps(t, _0_5);
+    t = _mm_rsqrt_ps(t);
+    t = _mm_mul_ps(t, _mm_sub_ps(_1_5, _mm_mul_ps(_mm_mul_ps(t, t), h)));
+    return v_float32x4(t);
+}
+
+inline v_float64x2 v_sqrt(const v_float64x2& x)
+{ return v_float64x2(_mm_sqrt_pd(x.val)); }
+
+inline v_float64x2 v_invsqrt(const v_float64x2& x)
+{
+    static const __m128d v_1 = _mm_set1_pd(1.);
+    return v_float64x2(_mm_div_pd(v_1, _mm_sqrt_pd(x.val)));
+}
+
+inline v_float32x4 v_abs(const v_float32x4& x)
+{ return v_float32x4(_mm_and_ps(x.val, _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff)))); }
+inline v_float64x2 v_abs(const v_float64x2& x)
+{
+    return v_float64x2(_mm_and_pd(x.val,
+        _mm_castsi128_pd(_mm_srli_epi64(_mm_set1_epi32(-1), 1))));
+}
+
+// TODO: exp, log, sin, cos
+
+#define OPENCV_HAL_IMPL_SSE_BIN_FUNC(_Tpvec, func, intrin) \
+inline _Tpvec func(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(intrin(a.val, b.val)); \
+}
+
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_min, _mm_min_epu8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_max, _mm_max_epu8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_min, _mm_min_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_max, _mm_max_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float32x4, v_min, _mm_min_ps)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float32x4, v_max, _mm_max_ps)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float64x2, v_min, _mm_min_pd)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_float64x2, v_max, _mm_max_pd)
+
+inline v_int8x16 v_min(const v_int8x16& a, const v_int8x16& b)
+{
+    __m128i delta = _mm_set1_epi8((char)-128);
+    return v_int8x16(_mm_xor_si128(delta, _mm_min_epu8(_mm_xor_si128(a.val, delta),
+                                                       _mm_xor_si128(b.val, delta))));
+}
+inline v_int8x16 v_max(const v_int8x16& a, const v_int8x16& b)
+{
+    __m128i delta = _mm_set1_epi8((char)-128);
+    return v_int8x16(_mm_xor_si128(delta, _mm_max_epu8(_mm_xor_si128(a.val, delta),
+                                                       _mm_xor_si128(b.val, delta))));
+}
+inline v_uint16x8 v_min(const v_uint16x8& a, const v_uint16x8& b)
+{
+    return v_uint16x8(_mm_subs_epu16(a.val, _mm_subs_epu16(a.val, b.val)));
+}
+inline v_uint16x8 v_max(const v_uint16x8& a, const v_uint16x8& b)
+{
+    return v_uint16x8(_mm_adds_epu16(_mm_subs_epu16(a.val, b.val), b.val));
+}
+inline v_uint32x4 v_min(const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i delta = _mm_set1_epi32((int)0x80000000);
+    __m128i mask = _mm_cmpgt_epi32(_mm_xor_si128(a.val, delta), _mm_xor_si128(b.val, delta));
+    return v_uint32x4(v_select_si128(mask, b.val, a.val));
+}
+inline v_uint32x4 v_max(const v_uint32x4& a, const v_uint32x4& b)
+{
+    __m128i delta = _mm_set1_epi32((int)0x80000000);
+    __m128i mask = _mm_cmpgt_epi32(_mm_xor_si128(a.val, delta), _mm_xor_si128(b.val, delta));
+    return v_uint32x4(v_select_si128(mask, a.val, b.val));
+}
+inline v_int32x4 v_min(const v_int32x4& a, const v_int32x4& b)
+{
+    return v_int32x4(v_select_si128(_mm_cmpgt_epi32(a.val, b.val), b.val, a.val));
+}
+inline v_int32x4 v_max(const v_int32x4& a, const v_int32x4& b)
+{
+    return v_int32x4(v_select_si128(_mm_cmpgt_epi32(a.val, b.val), a.val, b.val));
+}
+
+#define OPENCV_HAL_IMPL_SSE_INT_CMP_OP(_Tpuvec, _Tpsvec, suffix, sbit) \
+inline _Tpuvec operator == (const _Tpuvec& a, const _Tpuvec& b) \
+{ return _Tpuvec(_mm_cmpeq_##suffix(a.val, b.val)); } \
+inline _Tpuvec operator != (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    return _Tpuvec(_mm_xor_si128(_mm_cmpeq_##suffix(a.val, b.val), not_mask)); \
+} \
+inline _Tpsvec operator == (const _Tpsvec& a, const _Tpsvec& b) \
+{ return _Tpsvec(_mm_cmpeq_##suffix(a.val, b.val)); } \
+inline _Tpsvec operator != (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    return _Tpsvec(_mm_xor_si128(_mm_cmpeq_##suffix(a.val, b.val), not_mask)); \
+} \
+inline _Tpuvec operator < (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i smask = _mm_set1_##suffix(sbit); \
+    return _Tpuvec(_mm_cmpgt_##suffix(_mm_xor_si128(b.val, smask), _mm_xor_si128(a.val, smask))); \
+} \
+inline _Tpuvec operator > (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i smask = _mm_set1_##suffix(sbit); \
+    return _Tpuvec(_mm_cmpgt_##suffix(_mm_xor_si128(a.val, smask), _mm_xor_si128(b.val, smask))); \
+} \
+inline _Tpuvec operator <= (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i smask = _mm_set1_##suffix(sbit); \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    __m128i res = _mm_cmpgt_##suffix(_mm_xor_si128(a.val, smask), _mm_xor_si128(b.val, smask)); \
+    return _Tpuvec(_mm_xor_si128(res, not_mask)); \
+} \
+inline _Tpuvec operator >= (const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    __m128i smask = _mm_set1_##suffix(sbit); \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    __m128i res = _mm_cmpgt_##suffix(_mm_xor_si128(b.val, smask), _mm_xor_si128(a.val, smask)); \
+    return _Tpuvec(_mm_xor_si128(res, not_mask)); \
+} \
+inline _Tpsvec operator < (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    return _Tpsvec(_mm_cmpgt_##suffix(b.val, a.val)); \
+} \
+inline _Tpsvec operator > (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    return _Tpsvec(_mm_cmpgt_##suffix(a.val, b.val)); \
+} \
+inline _Tpsvec operator <= (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    return _Tpsvec(_mm_xor_si128(_mm_cmpgt_##suffix(a.val, b.val), not_mask)); \
+} \
+inline _Tpsvec operator >= (const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    __m128i not_mask = _mm_set1_epi32(-1); \
+    return _Tpsvec(_mm_xor_si128(_mm_cmpgt_##suffix(b.val, a.val), not_mask)); \
+}
+
+OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint8x16, v_int8x16, epi8, (char)-128)
+OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint16x8, v_int16x8, epi16, (short)-32768)
+OPENCV_HAL_IMPL_SSE_INT_CMP_OP(v_uint32x4, v_int32x4, epi32, (int)0x80000000)
+
+#define OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(_Tpvec, suffix) \
+inline _Tpvec operator == (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmpeq_##suffix(a.val, b.val)); } \
+inline _Tpvec operator != (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmpneq_##suffix(a.val, b.val)); } \
+inline _Tpvec operator < (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmplt_##suffix(a.val, b.val)); } \
+inline _Tpvec operator > (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmpgt_##suffix(a.val, b.val)); } \
+inline _Tpvec operator <= (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmple_##suffix(a.val, b.val)); } \
+inline _Tpvec operator >= (const _Tpvec& a, const _Tpvec& b) \
+{ return _Tpvec(_mm_cmpge_##suffix(a.val, b.val)); }
+
+OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(v_float32x4, ps)
+OPENCV_HAL_IMPL_SSE_FLT_CMP_OP(v_float64x2, pd)
+
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_add_wrap, _mm_add_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int8x16, v_add_wrap, _mm_add_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint16x8, v_add_wrap, _mm_add_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_add_wrap, _mm_add_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint8x16, v_sub_wrap, _mm_sub_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int8x16, v_sub_wrap, _mm_sub_epi8)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_uint16x8, v_sub_wrap, _mm_sub_epi16)
+OPENCV_HAL_IMPL_SSE_BIN_FUNC(v_int16x8, v_sub_wrap, _mm_sub_epi16)
+
+#define OPENCV_HAL_IMPL_SSE_ABSDIFF_8_16(_Tpuvec, _Tpsvec, bits, smask32) \
+inline _Tpuvec v_absdiff(const _Tpuvec& a, const _Tpuvec& b) \
+{ \
+    return _Tpuvec(_mm_add_epi##bits(_mm_subs_epu##bits(a.val, b.val), _mm_subs_epu##bits(b.val, a.val))); \
+} \
+inline _Tpuvec v_absdiff(const _Tpsvec& a, const _Tpsvec& b) \
+{ \
+    __m128i smask = _mm_set1_epi32(smask32); \
+    __m128i a1 = _mm_xor_si128(a.val, smask); \
+    __m128i b1 = _mm_xor_si128(b.val, smask); \
+    return _Tpuvec(_mm_add_epi##bits(_mm_subs_epu##bits(a1, b1), _mm_subs_epu##bits(b1, a1))); \
+}
+
+OPENCV_HAL_IMPL_SSE_ABSDIFF_8_16(v_uint8x16, v_int8x16, 8, (int)0x80808080)
+OPENCV_HAL_IMPL_SSE_ABSDIFF_8_16(v_uint16x8, v_int16x8, 16, (int)0x80008000)
+
+inline v_uint32x4 v_absdiff(const v_uint32x4& a, const v_uint32x4& b)
+{
+    return v_max(a, b) - v_min(a, b);
+}
+
+inline v_uint32x4 v_absdiff(const v_int32x4& a, const v_int32x4& b)
+{
+    __m128i d = _mm_sub_epi32(a.val, b.val);
+    __m128i m = _mm_cmpgt_epi32(b.val, a.val);
+    return v_uint32x4(_mm_sub_epi32(_mm_xor_si128(d, m), m));
+}
+
+#define OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(_Tpvec, _Tp, _Tpreg, suffix, absmask_vec) \
+inline _Tpvec v_absdiff(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpreg absmask = _mm_castsi128_##suffix(absmask_vec); \
+    return _Tpvec(_mm_and_##suffix(_mm_sub_##suffix(a.val, b.val), absmask)); \
+} \
+inline _Tpvec v_magnitude(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpreg res = _mm_add_##suffix(_mm_mul_##suffix(a.val, a.val), _mm_mul_##suffix(b.val, b.val)); \
+    return _Tpvec(_mm_sqrt_##suffix(res)); \
+} \
+inline _Tpvec v_sqr_magnitude(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    _Tpreg res = _mm_add_##suffix(_mm_mul_##suffix(a.val, a.val), _mm_mul_##suffix(b.val, b.val)); \
+    return _Tpvec(res); \
+} \
+inline _Tpvec v_muladd(const _Tpvec& a, const _Tpvec& b, const _Tpvec& c) \
+{ \
+    return _Tpvec(_mm_add_##suffix(_mm_mul_##suffix(a.val, b.val), c.val)); \
+}
+
+OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(v_float32x4, float, __m128, ps, _mm_set1_epi32((int)0x7fffffff))
+OPENCV_HAL_IMPL_SSE_MISC_FLT_OP(v_float64x2, double, __m128d, pd, _mm_srli_epi64(_mm_set1_epi32(-1), 1))
+
+#define OPENCV_HAL_IMPL_SSE_SHIFT_OP(_Tpuvec, _Tpsvec, suffix, srai) \
+inline _Tpuvec operator << (const _Tpuvec& a, int imm) \
+{ \
+    return _Tpuvec(_mm_slli_##suffix(a.val, imm)); \
+} \
+inline _Tpsvec operator << (const _Tpsvec& a, int imm) \
+{ \
+    return _Tpsvec(_mm_slli_##suffix(a.val, imm)); \
+} \
+inline _Tpuvec operator >> (const _Tpuvec& a, int imm) \
+{ \
+    return _Tpuvec(_mm_srli_##suffix(a.val, imm)); \
+} \
+inline _Tpsvec operator >> (const _Tpsvec& a, int imm) \
+{ \
+    return _Tpsvec(srai(a.val, imm)); \
+} \
+template<int imm> \
+inline _Tpuvec v_shl(const _Tpuvec& a) \
+{ \
+    return _Tpuvec(_mm_slli_##suffix(a.val, imm)); \
+} \
+template<int imm> \
+inline _Tpsvec v_shl(const _Tpsvec& a) \
+{ \
+    return _Tpsvec(_mm_slli_##suffix(a.val, imm)); \
+} \
+template<int imm> \
+inline _Tpuvec v_shr(const _Tpuvec& a) \
+{ \
+    return _Tpuvec(_mm_srli_##suffix(a.val, imm)); \
+} \
+template<int imm> \
+inline _Tpsvec v_shr(const _Tpsvec& a) \
+{ \
+    return _Tpsvec(srai(a.val, imm)); \
+}
+
+OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint16x8, v_int16x8, epi16, _mm_srai_epi16)
+OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint32x4, v_int32x4, epi32, _mm_srai_epi32)
+OPENCV_HAL_IMPL_SSE_SHIFT_OP(v_uint64x2, v_int64x2, epi64, v_srai_epi64)
+
+#define OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(_Tpvec, _Tp) \
+inline _Tpvec v_load(const _Tp* ptr) \
+{ return _Tpvec(_mm_loadu_si128((const __m128i*)ptr)); } \
+inline _Tpvec v_load_aligned(const _Tp* ptr) \
+{ return _Tpvec(_mm_load_si128((const __m128i*)ptr)); } \
+inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \
+{ \
+    return _Tpvec(_mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i*)ptr0), \
+                                     _mm_loadl_epi64((const __m128i*)ptr1))); \
+} \
+inline void v_store(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storeu_si128((__m128i*)ptr, a.val); } \
+inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \
+{ _mm_store_si128((__m128i*)ptr, a.val); } \
+inline void v_store_low(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storel_epi64((__m128i*)ptr, a.val); } \
+inline void v_store_high(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storel_epi64((__m128i*)ptr, _mm_unpackhi_epi64(a.val, a.val)); }
+
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint8x16, uchar)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int8x16, schar)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint16x8, ushort)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int16x8, short)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint32x4, unsigned)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int32x4, int)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_uint64x2, uint64)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INT_OP(v_int64x2, int64)
+
+#define OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(_Tpvec, _Tp, suffix) \
+inline _Tpvec v_load(const _Tp* ptr) \
+{ return _Tpvec(_mm_loadu_##suffix(ptr)); } \
+inline _Tpvec v_load_aligned(const _Tp* ptr) \
+{ return _Tpvec(_mm_load_##suffix(ptr)); } \
+inline _Tpvec v_load_halves(const _Tp* ptr0, const _Tp* ptr1) \
+{ \
+    return _Tpvec(_mm_castsi128_##suffix( \
+        _mm_unpacklo_epi64(_mm_loadl_epi64((const __m128i*)ptr0), \
+                           _mm_loadl_epi64((const __m128i*)ptr1)))); \
+} \
+inline void v_store(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storeu_##suffix(ptr, a.val); } \
+inline void v_store_aligned(_Tp* ptr, const _Tpvec& a) \
+{ _mm_store_##suffix(ptr, a.val); } \
+inline void v_store_low(_Tp* ptr, const _Tpvec& a) \
+{ _mm_storel_epi64((__m128i*)ptr, _mm_cast##suffix##_si128(a.val)); } \
+inline void v_store_high(_Tp* ptr, const _Tpvec& a) \
+{ \
+    __m128i a1 = _mm_cast##suffix##_si128(a.val); \
+    _mm_storel_epi64((__m128i*)ptr, _mm_unpackhi_epi64(a1, a1)); \
+}
+
+OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(v_float32x4, float, ps)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_FLT_OP(v_float64x2, double, pd)
+
+#define OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(_Tpvec, scalartype, func, scalar_func) \
+inline scalartype v_reduce_##func(const _Tpvec& a) \
+{ \
+    scalartype CV_DECL_ALIGNED(16) buf[4]; \
+    v_store_aligned(buf, a); \
+    scalartype s0 = scalar_func(buf[0], buf[1]); \
+    scalartype s1 = scalar_func(buf[2], buf[3]); \
+    return scalar_func(s0, s1); \
+}
+
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_uint32x4, unsigned, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_uint32x4, unsigned, max, std::max)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_uint32x4, unsigned, min, std::min)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_int32x4, int, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_int32x4, int, max, std::max)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_int32x4, int, min, std::min)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_float32x4, float, sum, OPENCV_HAL_ADD)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_float32x4, float, max, std::max)
+OPENCV_HAL_IMPL_SSE_REDUCE_OP_4(v_float32x4, float, min, std::min)
+
+#define OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(_Tpvec, suffix, pack_op, and_op, signmask, allmask) \
+inline int v_signmask(const _Tpvec& a) \
+{ \
+    return and_op(_mm_movemask_##suffix(pack_op(a.val)), signmask); \
+} \
+inline bool v_check_all(const _Tpvec& a) \
+{ return and_op(_mm_movemask_##suffix(a.val), allmask) == allmask; } \
+inline bool v_check_any(const _Tpvec& a) \
+{ return and_op(_mm_movemask_##suffix(a.val), allmask) != 0; }
+
+#define OPENCV_HAL_PACKS(a) _mm_packs_epi16(a, a)
+inline __m128i v_packq_epi32(__m128i a)
+{
+    __m128i b = _mm_packs_epi32(a, a);
+    return _mm_packs_epi16(b, b);
+}
+
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 65535, 65535)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 65535, 65535)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint16x8, epi8, OPENCV_HAL_PACKS, OPENCV_HAL_AND, 255, (int)0xaaaa)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int16x8, epi8, OPENCV_HAL_PACKS, OPENCV_HAL_AND, 255, (int)0xaaaa)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_uint32x4, epi8, v_packq_epi32, OPENCV_HAL_AND, 15, (int)0x8888)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_int32x4, epi8, v_packq_epi32, OPENCV_HAL_AND, 15, (int)0x8888)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_float32x4, ps, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 15, 15)
+OPENCV_HAL_IMPL_SSE_CHECK_SIGNS(v_float64x2, pd, OPENCV_HAL_NOP, OPENCV_HAL_1ST, 3, 3)
+
+#define OPENCV_HAL_IMPL_SSE_SELECT(_Tpvec, suffix) \
+inline _Tpvec v_select(const _Tpvec& mask, const _Tpvec& a, const _Tpvec& b) \
+{ \
+    return _Tpvec(_mm_xor_##suffix(b.val, _mm_and_##suffix(_mm_xor_##suffix(b.val, a.val), mask.val))); \
+}
+
+OPENCV_HAL_IMPL_SSE_SELECT(v_uint8x16, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_int8x16, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_uint16x8, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_int16x8, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_uint32x4, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_int32x4, si128)
+// OPENCV_HAL_IMPL_SSE_SELECT(v_uint64x2, si128)
+// OPENCV_HAL_IMPL_SSE_SELECT(v_int64x2, si128)
+OPENCV_HAL_IMPL_SSE_SELECT(v_float32x4, ps)
+OPENCV_HAL_IMPL_SSE_SELECT(v_float64x2, pd)
+
+#define OPENCV_HAL_IMPL_SSE_EXPAND(_Tpuvec, _Tpwuvec, _Tpu, _Tpsvec, _Tpwsvec, _Tps, suffix, wsuffix, shift) \
+inline void v_expand(const _Tpuvec& a, _Tpwuvec& b0, _Tpwuvec& b1) \
+{ \
+    __m128i z = _mm_setzero_si128(); \
+    b0.val = _mm_unpacklo_##suffix(a.val, z); \
+    b1.val = _mm_unpackhi_##suffix(a.val, z); \
+} \
+inline _Tpwuvec v_load_expand(const _Tpu* ptr) \
+{ \
+    __m128i z = _mm_setzero_si128(); \
+    return _Tpwuvec(_mm_unpacklo_##suffix(_mm_loadl_epi64((const __m128i*)ptr), z)); \
+} \
+inline void v_expand(const _Tpsvec& a, _Tpwsvec& b0, _Tpwsvec& b1) \
+{ \
+    b0.val = _mm_srai_##wsuffix(_mm_unpacklo_##suffix(a.val, a.val), shift); \
+    b1.val = _mm_srai_##wsuffix(_mm_unpackhi_##suffix(a.val, a.val), shift); \
+} \
+inline _Tpwsvec v_load_expand(const _Tps* ptr) \
+{ \
+    __m128i a = _mm_loadl_epi64((const __m128i*)ptr); \
+    return _Tpwsvec(_mm_srai_##wsuffix(_mm_unpacklo_##suffix(a, a), shift)); \
+}
+
+OPENCV_HAL_IMPL_SSE_EXPAND(v_uint8x16, v_uint16x8, uchar, v_int8x16, v_int16x8, schar, epi8, epi16, 8)
+OPENCV_HAL_IMPL_SSE_EXPAND(v_uint16x8, v_uint32x4, ushort, v_int16x8, v_int32x4, short, epi16, epi32, 16)
+
+inline void v_expand(const v_uint32x4& a, v_uint64x2& b0, v_uint64x2& b1)
+{
+    __m128i z = _mm_setzero_si128();
+    b0.val = _mm_unpacklo_epi32(a.val, z);
+    b1.val = _mm_unpackhi_epi32(a.val, z);
+}
+inline v_uint64x2 v_load_expand(const unsigned* ptr)
+{
+    __m128i z = _mm_setzero_si128();
+    return v_uint64x2(_mm_unpacklo_epi32(_mm_loadl_epi64((const __m128i*)ptr), z));
+}
+inline void v_expand(const v_int32x4& a, v_int64x2& b0, v_int64x2& b1)
+{
+    __m128i s = _mm_srai_epi32(a.val, 31);
+    b0.val = _mm_unpacklo_epi32(a.val, s);
+    b1.val = _mm_unpackhi_epi32(a.val, s);
+}
+inline v_int64x2 v_load_expand(const int* ptr)
+{
+    __m128i a = _mm_loadl_epi64((const __m128i*)ptr);
+    __m128i s = _mm_srai_epi32(a, 31);
+    return v_int64x2(_mm_unpacklo_epi32(a, s));
+}
+
+inline v_uint32x4 v_load_expand_q(const uchar* ptr)
+{
+    __m128i z = _mm_setzero_si128();
+    __m128i a = _mm_cvtsi32_si128(*(const int*)ptr);
+    return v_uint32x4(_mm_unpacklo_epi16(_mm_unpacklo_epi8(a, z), z));
+}
+
+inline v_int32x4 v_load_expand_q(const schar* ptr)
+{
+    __m128i a = _mm_cvtsi32_si128(*(const int*)ptr);
+    a = _mm_unpacklo_epi8(a, a);
+    a = _mm_unpacklo_epi8(a, a);
+    return v_int32x4(_mm_srai_epi32(a, 24));
+}
+
+#define OPENCV_HAL_IMPL_SSE_UNPACKS(_Tpvec, suffix, cast_from, cast_to) \
+inline void v_zip(const _Tpvec& a0, const _Tpvec& a1, _Tpvec& b0, _Tpvec& b1) \
+{ \
+    b0.val = _mm_unpacklo_##suffix(a0.val, a1.val); \
+    b1.val = _mm_unpackhi_##suffix(a0.val, a1.val); \
+} \
+inline _Tpvec v_combine_low(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \
+    return _Tpvec(cast_to(_mm_unpacklo_epi64(a1, b1))); \
+} \
+inline _Tpvec v_combine_high(const _Tpvec& a, const _Tpvec& b) \
+{ \
+    __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \
+    return _Tpvec(cast_to(_mm_unpackhi_epi64(a1, b1))); \
+} \
+inline void v_recombine(const _Tpvec& a, const _Tpvec& b, _Tpvec& c, _Tpvec& d) \
+{ \
+    __m128i a1 = cast_from(a.val), b1 = cast_from(b.val); \
+    c.val = cast_to(_mm_unpacklo_epi64(a1, b1)); \
+    d.val = cast_to(_mm_unpackhi_epi64(a1, b1)); \
+}
+
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_int8x16, epi8, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint16x8, epi16, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_int16x8, epi16, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_uint32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_int32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_float32x4, ps, _mm_castps_si128, _mm_castsi128_ps)
+OPENCV_HAL_IMPL_SSE_UNPACKS(v_float64x2, pd, _mm_castpd_si128, _mm_castsi128_pd)
+
+template<int s, typename _Tpvec>
+inline _Tpvec v_extract(const _Tpvec& a, const _Tpvec& b)
+{
+    const int w = sizeof(typename _Tpvec::lane_type);
+    const int n = _Tpvec::nlanes;
+    __m128i ra, rb;
+    ra = _mm_srli_si128(a.val, s*w);
+    rb = _mm_slli_si128(b.val, (n-s)*w);
+    return _Tpvec(_mm_or_si128(ra, rb));
+}
+
+inline v_int32x4 v_round(const v_float32x4& a)
+{ return v_int32x4(_mm_cvtps_epi32(a.val)); }
+
+inline v_int32x4 v_floor(const v_float32x4& a)
+{
+    __m128i a1 = _mm_cvtps_epi32(a.val);
+    __m128i mask = _mm_castps_si128(_mm_cmpgt_ps(_mm_cvtepi32_ps(a1), a.val));
+    return v_int32x4(_mm_add_epi32(a1, mask));
+}
+
+inline v_int32x4 v_ceil(const v_float32x4& a)
+{
+    __m128i a1 = _mm_cvtps_epi32(a.val);
+    __m128i mask = _mm_castps_si128(_mm_cmpgt_ps(a.val, _mm_cvtepi32_ps(a1)));
+    return v_int32x4(_mm_sub_epi32(a1, mask));
+}
+
+inline v_int32x4 v_trunc(const v_float32x4& a)
+{ return v_int32x4(_mm_cvttps_epi32(a.val)); }
+
+inline v_int32x4 v_round(const v_float64x2& a)
+{ return v_int32x4(_mm_cvtpd_epi32(a.val)); }
+
+inline v_int32x4 v_floor(const v_float64x2& a)
+{
+    __m128i a1 = _mm_cvtpd_epi32(a.val);
+    __m128i mask = _mm_castpd_si128(_mm_cmpgt_pd(_mm_cvtepi32_pd(a1), a.val));
+    mask = _mm_srli_si128(_mm_slli_si128(mask, 4), 8); // m0 m0 m1 m1 => m0 m1 0 0
+    return v_int32x4(_mm_add_epi32(a1, mask));
+}
+
+inline v_int32x4 v_ceil(const v_float64x2& a)
+{
+    __m128i a1 = _mm_cvtpd_epi32(a.val);
+    __m128i mask = _mm_castpd_si128(_mm_cmpgt_pd(a.val, _mm_cvtepi32_pd(a1)));
+    mask = _mm_srli_si128(_mm_slli_si128(mask, 4), 8); // m0 m0 m1 m1 => m0 m1 0 0
+    return v_int32x4(_mm_sub_epi32(a1, mask));
+}
+
+inline v_int32x4 v_trunc(const v_float64x2& a)
+{ return v_int32x4(_mm_cvttpd_epi32(a.val)); }
+
+#define OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(_Tpvec, suffix, cast_from, cast_to) \
+inline void v_transpose4x4(const _Tpvec& a0, const _Tpvec& a1, \
+                           const _Tpvec& a2, const _Tpvec& a3, \
+                           _Tpvec& b0, _Tpvec& b1, \
+                           _Tpvec& b2, _Tpvec& b3) \
+{ \
+    __m128i t0 = cast_from(_mm_unpacklo_##suffix(a0.val, a1.val)); \
+    __m128i t1 = cast_from(_mm_unpacklo_##suffix(a2.val, a3.val)); \
+    __m128i t2 = cast_from(_mm_unpackhi_##suffix(a0.val, a1.val)); \
+    __m128i t3 = cast_from(_mm_unpackhi_##suffix(a2.val, a3.val)); \
+\
+    b0.val = cast_to(_mm_unpacklo_epi64(t0, t1)); \
+    b1.val = cast_to(_mm_unpackhi_epi64(t0, t1)); \
+    b2.val = cast_to(_mm_unpacklo_epi64(t2, t3)); \
+    b3.val = cast_to(_mm_unpackhi_epi64(t2, t3)); \
+}
+
+OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_uint32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_int32x4, epi32, OPENCV_HAL_NOP, OPENCV_HAL_NOP)
+OPENCV_HAL_IMPL_SSE_TRANSPOSE4x4(v_float32x4, ps, _mm_castps_si128, _mm_castsi128_ps)
+
+// adopted from sse_utils.hpp
+inline void v_load_deinterleave(const uchar* ptr, v_uint8x16& a, v_uint8x16& b, v_uint8x16& c)
+{
+    __m128i t00 = _mm_loadu_si128((const __m128i*)ptr);
+    __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 16));
+    __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 32));
+
+    __m128i t10 = _mm_unpacklo_epi8(t00, _mm_unpackhi_epi64(t01, t01));
+    __m128i t11 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t00, t00), t02);
+    __m128i t12 = _mm_unpacklo_epi8(t01, _mm_unpackhi_epi64(t02, t02));
+
+    __m128i t20 = _mm_unpacklo_epi8(t10, _mm_unpackhi_epi64(t11, t11));
+    __m128i t21 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t10, t10), t12);
+    __m128i t22 = _mm_unpacklo_epi8(t11, _mm_unpackhi_epi64(t12, t12));
+
+    __m128i t30 = _mm_unpacklo_epi8(t20, _mm_unpackhi_epi64(t21, t21));
+    __m128i t31 = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t20, t20), t22);
+    __m128i t32 = _mm_unpacklo_epi8(t21, _mm_unpackhi_epi64(t22, t22));
+
+    a.val = _mm_unpacklo_epi8(t30, _mm_unpackhi_epi64(t31, t31));
+    b.val = _mm_unpacklo_epi8(_mm_unpackhi_epi64(t30, t30), t32);
+    c.val = _mm_unpacklo_epi8(t31, _mm_unpackhi_epi64(t32, t32));
+}
+
+inline void v_load_deinterleave(const uchar* ptr, v_uint8x16& a, v_uint8x16& b, v_uint8x16& c, v_uint8x16& d)
+{
+    __m128i u0 = _mm_loadu_si128((const __m128i*)ptr); // a0 b0 c0 d0 a1 b1 c1 d1 ...
+    __m128i u1 = _mm_loadu_si128((const __m128i*)(ptr + 16)); // a4 b4 c4 d4 ...
+    __m128i u2 = _mm_loadu_si128((const __m128i*)(ptr + 32)); // a8 b8 c8 d8 ...
+    __m128i u3 = _mm_loadu_si128((const __m128i*)(ptr + 48)); // a12 b12 c12 d12 ...
+
+    __m128i v0 = _mm_unpacklo_epi8(u0, u2); // a0 a8 b0 b8 ...
+    __m128i v1 = _mm_unpackhi_epi8(u0, u2); // a2 a10 b2 b10 ...
+    __m128i v2 = _mm_unpacklo_epi8(u1, u3); // a4 a12 b4 b12 ...
+    __m128i v3 = _mm_unpackhi_epi8(u1, u3); // a6 a14 b6 b14 ...
+
+    u0 = _mm_unpacklo_epi8(v0, v2); // a0 a4 a8 a12 ...
+    u1 = _mm_unpacklo_epi8(v1, v3); // a2 a6 a10 a14 ...
+    u2 = _mm_unpackhi_epi8(v0, v2); // a1 a5 a9 a13 ...
+    u3 = _mm_unpackhi_epi8(v1, v3); // a3 a7 a11 a15 ...
+
+    v0 = _mm_unpacklo_epi8(u0, u1); // a0 a2 a4 a6 ...
+    v1 = _mm_unpacklo_epi8(u2, u3); // a1 a3 a5 a7 ...
+    v2 = _mm_unpackhi_epi8(u0, u1); // c0 c2 c4 c6 ...
+    v3 = _mm_unpackhi_epi8(u2, u3); // c1 c3 c5 c7 ...
+
+    a.val = _mm_unpacklo_epi8(v0, v1);
+    b.val = _mm_unpackhi_epi8(v0, v1);
+    c.val = _mm_unpacklo_epi8(v2, v3);
+    d.val = _mm_unpackhi_epi8(v2, v3);
+}
+
+inline void v_load_deinterleave(const ushort* ptr, v_uint16x8& a, v_uint16x8& b, v_uint16x8& c)
+{
+    __m128i t00 = _mm_loadu_si128((const __m128i*)ptr);
+    __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 8));
+    __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 16));
+
+    __m128i t10 = _mm_unpacklo_epi16(t00, _mm_unpackhi_epi64(t01, t01));
+    __m128i t11 = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t00, t00), t02);
+    __m128i t12 = _mm_unpacklo_epi16(t01, _mm_unpackhi_epi64(t02, t02));
+
+    __m128i t20 = _mm_unpacklo_epi16(t10, _mm_unpackhi_epi64(t11, t11));
+    __m128i t21 = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t10, t10), t12);
+    __m128i t22 = _mm_unpacklo_epi16(t11, _mm_unpackhi_epi64(t12, t12));
+
+    a.val = _mm_unpacklo_epi16(t20, _mm_unpackhi_epi64(t21, t21));
+    b.val = _mm_unpacklo_epi16(_mm_unpackhi_epi64(t20, t20), t22);
+    c.val = _mm_unpacklo_epi16(t21, _mm_unpackhi_epi64(t22, t22));
+}
+
+inline void v_load_deinterleave(const ushort* ptr, v_uint16x8& a, v_uint16x8& b, v_uint16x8& c, v_uint16x8& d)
+{
+    __m128i u0 = _mm_loadu_si128((const __m128i*)ptr); // a0 b0 c0 d0 a1 b1 c1 d1
+    __m128i u1 = _mm_loadu_si128((const __m128i*)(ptr + 8)); // a2 b2 c2 d2 ...
+    __m128i u2 = _mm_loadu_si128((const __m128i*)(ptr + 16)); // a4 b4 c4 d4 ...
+    __m128i u3 = _mm_loadu_si128((const __m128i*)(ptr + 24)); // a6 b6 c6 d6 ...
+
+    __m128i v0 = _mm_unpacklo_epi16(u0, u2); // a0 a4 b0 b4 ...
+    __m128i v1 = _mm_unpackhi_epi16(u0, u2); // a1 a5 b1 b5 ...
+    __m128i v2 = _mm_unpacklo_epi16(u1, u3); // a2 a6 b2 b6 ...
+    __m128i v3 = _mm_unpackhi_epi16(u1, u3); // a3 a7 b3 b7 ...
+
+    u0 = _mm_unpacklo_epi16(v0, v2); // a0 a2 a4 a6 ...
+    u1 = _mm_unpacklo_epi16(v1, v3); // a1 a3 a5 a7 ...
+    u2 = _mm_unpackhi_epi16(v0, v2); // c0 c2 c4 c6 ...
+    u3 = _mm_unpackhi_epi16(v1, v3); // c1 c3 c5 c7 ...
+
+    a.val = _mm_unpacklo_epi16(u0, u1);
+    b.val = _mm_unpackhi_epi16(u0, u1);
+    c.val = _mm_unpacklo_epi16(u2, u3);
+    d.val = _mm_unpackhi_epi16(u2, u3);
+}
+
+inline void v_load_deinterleave(const unsigned* ptr, v_uint32x4& a, v_uint32x4& b, v_uint32x4& c)
+{
+    __m128i t00 = _mm_loadu_si128((const __m128i*)ptr);
+    __m128i t01 = _mm_loadu_si128((const __m128i*)(ptr + 4));
+    __m128i t02 = _mm_loadu_si128((const __m128i*)(ptr + 8));
+
+    __m128i t10 = _mm_unpacklo_epi32(t00, _mm_unpackhi_epi64(t01, t01));
+    __m128i t11 = _mm_unpacklo_epi32(_mm_unpackhi_epi64(t00, t00), t02);
+    __m128i t12 = _mm_unpacklo_epi32(t01, _mm_unpackhi_epi64(t02, t02));
+
+    a.val = _mm_unpacklo_epi32(t10, _mm_unpackhi_epi64(t11, t11));
+    b.val = _mm_unpacklo_epi32(_mm_unpackhi_epi64(t10, t10), t12);
+    c.val = _mm_unpacklo_epi32(t11, _mm_unpackhi_epi64(t12, t12));
+}
+
+inline void v_load_deinterleave(const unsigned* ptr, v_uint32x4& a, v_uint32x4& b, v_uint32x4& c, v_uint32x4& d)
+{
+    v_uint32x4 u0(_mm_loadu_si128((const __m128i*)ptr));        // a0 b0 c0 d0
+    v_uint32x4 u1(_mm_loadu_si128((const __m128i*)(ptr + 4))); // a1 b1 c1 d1
+    v_uint32x4 u2(_mm_loadu_si128((const __m128i*)(ptr + 8))); // a2 b2 c2 d2
+    v_uint32x4 u3(_mm_loadu_si128((const __m128i*)(ptr + 12))); // a3 b3 c3 d3
+
+    v_transpose4x4(u0, u1, u2, u3, a, b, c, d);
+}
+
+inline void v_store_interleave( uchar* ptr, const v_uint8x16& a, const v_uint8x16& b,
+                                const v_uint8x16& c )
+{
+    __m128i z = _mm_setzero_si128();
+    __m128i ab0 = _mm_unpacklo_epi8(a.val, b.val);
+    __m128i ab1 = _mm_unpackhi_epi8(a.val, b.val);
+    __m128i c0 = _mm_unpacklo_epi8(c.val, z);
+    __m128i c1 = _mm_unpackhi_epi8(c.val, z);
+
+    __m128i p00 = _mm_unpacklo_epi16(ab0, c0);
+    __m128i p01 = _mm_unpackhi_epi16(ab0, c0);
+    __m128i p02 = _mm_unpacklo_epi16(ab1, c1);
+    __m128i p03 = _mm_unpackhi_epi16(ab1, c1);
+
+    __m128i p10 = _mm_unpacklo_epi32(p00, p01);
+    __m128i p11 = _mm_unpackhi_epi32(p00, p01);
+    __m128i p12 = _mm_unpacklo_epi32(p02, p03);
+    __m128i p13 = _mm_unpackhi_epi32(p02, p03);
+
+    __m128i p20 = _mm_unpacklo_epi64(p10, p11);
+    __m128i p21 = _mm_unpackhi_epi64(p10, p11);
+    __m128i p22 = _mm_unpacklo_epi64(p12, p13);
+    __m128i p23 = _mm_unpackhi_epi64(p12, p13);
+
+    p20 = _mm_slli_si128(p20, 1);
+    p22 = _mm_slli_si128(p22, 1);
+
+    __m128i p30 = _mm_slli_epi64(_mm_unpacklo_epi32(p20, p21), 8);
+    __m128i p31 = _mm_srli_epi64(_mm_unpackhi_epi32(p20, p21), 8);
+    __m128i p32 = _mm_slli_epi64(_mm_unpacklo_epi32(p22, p23), 8);
+    __m128i p33 = _mm_srli_epi64(_mm_unpackhi_epi32(p22, p23), 8);
+
+    __m128i p40 = _mm_unpacklo_epi64(p30, p31);
+    __m128i p41 = _mm_unpackhi_epi64(p30, p31);
+    __m128i p42 = _mm_unpacklo_epi64(p32, p33);
+    __m128i p43 = _mm_unpackhi_epi64(p32, p33);
+
+    __m128i v0 = _mm_or_si128(_mm_srli_si128(p40, 2), _mm_slli_si128(p41, 10));
+    __m128i v1 = _mm_or_si128(_mm_srli_si128(p41, 6), _mm_slli_si128(p42, 6));
+    __m128i v2 = _mm_or_si128(_mm_srli_si128(p42, 10), _mm_slli_si128(p43, 2));
+
+    _mm_storeu_si128((__m128i*)(ptr), v0);
+    _mm_storeu_si128((__m128i*)(ptr + 16), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 32), v2);
+}
+
+inline void v_store_interleave( uchar* ptr, const v_uint8x16& a, const v_uint8x16& b,
+                                const v_uint8x16& c, const v_uint8x16& d)
+{
+    // a0 a1 a2 a3 ....
+    // b0 b1 b2 b3 ....
+    // c0 c1 c2 c3 ....
+    // d0 d1 d2 d3 ....
+    __m128i u0 = _mm_unpacklo_epi8(a.val, c.val); // a0 c0 a1 c1 ...
+    __m128i u1 = _mm_unpackhi_epi8(a.val, c.val); // a8 c8 a9 c9 ...
+    __m128i u2 = _mm_unpacklo_epi8(b.val, d.val); // b0 d0 b1 d1 ...
+    __m128i u3 = _mm_unpackhi_epi8(b.val, d.val); // b8 d8 b9 d9 ...
+
+    __m128i v0 = _mm_unpacklo_epi8(u0, u2); // a0 b0 c0 d0 ...
+    __m128i v1 = _mm_unpacklo_epi8(u1, u3); // a8 b8 c8 d8 ...
+    __m128i v2 = _mm_unpackhi_epi8(u0, u2); // a4 b4 c4 d4 ...
+    __m128i v3 = _mm_unpackhi_epi8(u1, u3); // a12 b12 c12 d12 ...
+
+    _mm_storeu_si128((__m128i*)ptr, v0);
+    _mm_storeu_si128((__m128i*)(ptr + 16), v2);
+    _mm_storeu_si128((__m128i*)(ptr + 32), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 48), v3);
+}
+
+inline void v_store_interleave( ushort* ptr, const v_uint16x8& a,
+                                const v_uint16x8& b,
+                                const v_uint16x8& c )
+{
+    __m128i z = _mm_setzero_si128();
+    __m128i ab0 = _mm_unpacklo_epi16(a.val, b.val);
+    __m128i ab1 = _mm_unpackhi_epi16(a.val, b.val);
+    __m128i c0 = _mm_unpacklo_epi16(c.val, z);
+    __m128i c1 = _mm_unpackhi_epi16(c.val, z);
+
+    __m128i p10 = _mm_unpacklo_epi32(ab0, c0);
+    __m128i p11 = _mm_unpackhi_epi32(ab0, c0);
+    __m128i p12 = _mm_unpacklo_epi32(ab1, c1);
+    __m128i p13 = _mm_unpackhi_epi32(ab1, c1);
+
+    __m128i p20 = _mm_unpacklo_epi64(p10, p11);
+    __m128i p21 = _mm_unpackhi_epi64(p10, p11);
+    __m128i p22 = _mm_unpacklo_epi64(p12, p13);
+    __m128i p23 = _mm_unpackhi_epi64(p12, p13);
+
+    p20 = _mm_slli_si128(p20, 2);
+    p22 = _mm_slli_si128(p22, 2);
+
+    __m128i p30 = _mm_unpacklo_epi64(p20, p21);
+    __m128i p31 = _mm_unpackhi_epi64(p20, p21);
+    __m128i p32 = _mm_unpacklo_epi64(p22, p23);
+    __m128i p33 = _mm_unpackhi_epi64(p22, p23);
+
+    __m128i v0 = _mm_or_si128(_mm_srli_si128(p30, 2), _mm_slli_si128(p31, 10));
+    __m128i v1 = _mm_or_si128(_mm_srli_si128(p31, 6), _mm_slli_si128(p32, 6));
+    __m128i v2 = _mm_or_si128(_mm_srli_si128(p32, 10), _mm_slli_si128(p33, 2));
+
+    _mm_storeu_si128((__m128i*)(ptr), v0);
+    _mm_storeu_si128((__m128i*)(ptr + 8), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 16), v2);
+}
+
+inline void v_store_interleave( ushort* ptr, const v_uint16x8& a, const v_uint16x8& b,
+                                const v_uint16x8& c, const v_uint16x8& d)
+{
+    // a0 a1 a2 a3 ....
+    // b0 b1 b2 b3 ....
+    // c0 c1 c2 c3 ....
+    // d0 d1 d2 d3 ....
+    __m128i u0 = _mm_unpacklo_epi16(a.val, c.val); // a0 c0 a1 c1 ...
+    __m128i u1 = _mm_unpackhi_epi16(a.val, c.val); // a4 c4 a5 c5 ...
+    __m128i u2 = _mm_unpacklo_epi16(b.val, d.val); // b0 d0 b1 d1 ...
+    __m128i u3 = _mm_unpackhi_epi16(b.val, d.val); // b4 d4 b5 d5 ...
+
+    __m128i v0 = _mm_unpacklo_epi16(u0, u2); // a0 b0 c0 d0 ...
+    __m128i v1 = _mm_unpacklo_epi16(u1, u3); // a4 b4 c4 d4 ...
+    __m128i v2 = _mm_unpackhi_epi16(u0, u2); // a2 b2 c2 d2 ...
+    __m128i v3 = _mm_unpackhi_epi16(u1, u3); // a6 b6 c6 d6 ...
+
+    _mm_storeu_si128((__m128i*)ptr, v0);
+    _mm_storeu_si128((__m128i*)(ptr + 8), v2);
+    _mm_storeu_si128((__m128i*)(ptr + 16), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 24), v3);
+}
+
+inline void v_store_interleave( unsigned* ptr, const v_uint32x4& a, const v_uint32x4& b,
+                                const v_uint32x4& c )
+{
+    v_uint32x4 z = v_setzero_u32(), u0, u1, u2, u3;
+    v_transpose4x4(a, b, c, z, u0, u1, u2, u3);
+
+    __m128i v0 = _mm_or_si128(u0.val, _mm_slli_si128(u1.val, 12));
+    __m128i v1 = _mm_or_si128(_mm_srli_si128(u1.val, 4), _mm_slli_si128(u2.val, 8));
+    __m128i v2 = _mm_or_si128(_mm_srli_si128(u2.val, 8), _mm_slli_si128(u3.val, 4));
+
+    _mm_storeu_si128((__m128i*)ptr, v0);
+    _mm_storeu_si128((__m128i*)(ptr + 4), v1);
+    _mm_storeu_si128((__m128i*)(ptr + 8), v2);
+}
+
+inline void v_store_interleave(unsigned* ptr, const v_uint32x4& a, const v_uint32x4& b,
+                               const v_uint32x4& c, const v_uint32x4& d)
+{
+    v_uint32x4 t0, t1, t2, t3;
+    v_transpose4x4(a, b, c, d, t0, t1, t2, t3);
+    v_store(ptr, t0);
+    v_store(ptr + 4, t1);
+    v_store(ptr + 8, t2);
+    v_store(ptr + 12, t3);
+}
+
+#define OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(_Tpvec, _Tp, suffix, _Tpuvec, _Tpu, usuffix) \
+inline void v_load_deinterleave( const _Tp* ptr, _Tpvec& a0, \
+                                 _Tpvec& b0, _Tpvec& c0 ) \
+{ \
+    _Tpuvec a1, b1, c1; \
+    v_load_deinterleave((const _Tpu*)ptr, a1, b1, c1); \
+    a0 = v_reinterpret_as_##suffix(a1); \
+    b0 = v_reinterpret_as_##suffix(b1); \
+    c0 = v_reinterpret_as_##suffix(c1); \
+} \
+inline void v_load_deinterleave( const _Tp* ptr, _Tpvec& a0, \
+                                 _Tpvec& b0, _Tpvec& c0, _Tpvec& d0 ) \
+{ \
+    _Tpuvec a1, b1, c1, d1; \
+    v_load_deinterleave((const _Tpu*)ptr, a1, b1, c1, d1); \
+    a0 = v_reinterpret_as_##suffix(a1); \
+    b0 = v_reinterpret_as_##suffix(b1); \
+    c0 = v_reinterpret_as_##suffix(c1); \
+    d0 = v_reinterpret_as_##suffix(d1); \
+} \
+inline void v_store_interleave( _Tp* ptr, const _Tpvec& a0, \
+                               const _Tpvec& b0, const _Tpvec& c0 ) \
+{ \
+    _Tpuvec a1 = v_reinterpret_as_##usuffix(a0); \
+    _Tpuvec b1 = v_reinterpret_as_##usuffix(b0); \
+    _Tpuvec c1 = v_reinterpret_as_##usuffix(c0); \
+    v_store_interleave((_Tpu*)ptr, a1, b1, c1); \
+} \
+inline void v_store_interleave( _Tp* ptr, const _Tpvec& a0, const _Tpvec& b0, \
+                               const _Tpvec& c0, const _Tpvec& d0 ) \
+{ \
+    _Tpuvec a1 = v_reinterpret_as_##usuffix(a0); \
+    _Tpuvec b1 = v_reinterpret_as_##usuffix(b0); \
+    _Tpuvec c1 = v_reinterpret_as_##usuffix(c0); \
+    _Tpuvec d1 = v_reinterpret_as_##usuffix(d0); \
+    v_store_interleave((_Tpu*)ptr, a1, b1, c1, d1); \
+}
+
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int8x16, schar, s8, v_uint8x16, uchar, u8)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int16x8, short, s16, v_uint16x8, ushort, u16)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_int32x4, int, s32, v_uint32x4, unsigned, u32)
+OPENCV_HAL_IMPL_SSE_LOADSTORE_INTERLEAVE(v_float32x4, float, f32, v_uint32x4, unsigned, u32)
+
+inline v_float32x4 v_cvt_f32(const v_int32x4& a)
+{
+    return v_float32x4(_mm_cvtepi32_ps(a.val));
+}
+
+inline v_float32x4 v_cvt_f32(const v_float64x2& a)
+{
+    return v_float32x4(_mm_cvtpd_ps(a.val));
+}
+
+inline v_float64x2 v_cvt_f64(const v_int32x4& a)
+{
+    return v_float64x2(_mm_cvtepi32_pd(a.val));
+}
+
+inline v_float64x2 v_cvt_f64(const v_float32x4& a)
+{
+    return v_float64x2(_mm_cvtps_pd(a.val));
+}
+
+//! @endcond
+
+}
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp
new file mode 100644
index 0000000..4de8611
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/ippasync.hpp
@@ -0,0 +1,195 @@
+/*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-2015, Intel Corporation, all rights reserved.
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_IPPASYNC_HPP__
+#define __OPENCV_CORE_IPPASYNC_HPP__
+
+#ifdef HAVE_IPP_A
+
+#include "opencv2/core.hpp"
+#include <ipp_async_op.h>
+#include <ipp_async_accel.h>
+
+namespace cv
+{
+
+namespace hpp
+{
+
+/** @addtogroup core_ipp
+This section describes conversion between OpenCV and [Intel&reg; IPP Asynchronous
+C/C++](http://software.intel.com/en-us/intel-ipp-preview) library. [Getting Started
+Guide](http://registrationcenter.intel.com/irc_nas/3727/ipp_async_get_started.htm) help you to
+install the library, configure header and library build paths.
+ */
+//! @{
+
+    //! convert OpenCV data type to hppDataType
+    inline int toHppType(const int cvType)
+    {
+        int depth = CV_MAT_DEPTH(cvType);
+        int hppType = depth == CV_8U ? HPP_DATA_TYPE_8U :
+                     depth == CV_16U ? HPP_DATA_TYPE_16U :
+                     depth == CV_16S ? HPP_DATA_TYPE_16S :
+                     depth == CV_32S ? HPP_DATA_TYPE_32S :
+                     depth == CV_32F ? HPP_DATA_TYPE_32F :
+                     depth == CV_64F ? HPP_DATA_TYPE_64F : -1;
+        CV_Assert( hppType >= 0 );
+        return hppType;
+    }
+
+    //! convert hppDataType to OpenCV data type
+    inline int toCvType(const int hppType)
+    {
+        int cvType = hppType == HPP_DATA_TYPE_8U ? CV_8U :
+                    hppType == HPP_DATA_TYPE_16U ? CV_16U :
+                    hppType == HPP_DATA_TYPE_16S ? CV_16S :
+                    hppType == HPP_DATA_TYPE_32S ? CV_32S :
+                    hppType == HPP_DATA_TYPE_32F ? CV_32F :
+                    hppType == HPP_DATA_TYPE_64F ? CV_64F : -1;
+        CV_Assert( cvType >= 0 );
+        return cvType;
+    }
+
+    /** @brief Convert hppiMatrix to Mat.
+
+    This function allocates and initializes new matrix (if needed) that has the same size and type as
+    input matrix. Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F.
+    @param src input hppiMatrix.
+    @param dst output matrix.
+    @param accel accelerator instance (see hpp::getHpp for the list of acceleration framework types).
+    @param cn number of channels.
+     */
+    inline void copyHppToMat(hppiMatrix* src, Mat& dst, hppAccel accel, int cn)
+    {
+        hppDataType type;
+        hpp32u width, height;
+        hppStatus sts;
+
+        if (src == NULL)
+            return dst.release();
+
+        sts = hppiInquireMatrix(src, &type, &width, &height);
+
+        CV_Assert( sts == HPP_STATUS_NO_ERROR);
+
+        int matType = CV_MAKETYPE(toCvType(type), cn);
+
+        CV_Assert(width%cn == 0);
+
+        width /= cn;
+
+        dst.create((int)height, (int)width, (int)matType);
+
+        size_t newSize = (size_t)(height*(hpp32u)(dst.step));
+
+        sts = hppiGetMatrixData(accel,src,(hpp32u)(dst.step),dst.data,&newSize);
+
+        CV_Assert( sts == HPP_STATUS_NO_ERROR);
+    }
+
+    /** @brief Create Mat from hppiMatrix.
+
+    This function allocates and initializes the Mat that has the same size and type as input matrix.
+    Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F.
+    @param src input hppiMatrix.
+    @param accel accelerator instance (see hpp::getHpp for the list of acceleration framework types).
+    @param cn number of channels.
+    @sa howToUseIPPAconversion, hpp::copyHppToMat, hpp::getHpp.
+     */
+    inline Mat getMat(hppiMatrix* src, hppAccel accel, int cn)
+    {
+        Mat dst;
+        copyHppToMat(src, dst, accel, cn);
+        return dst;
+    }
+
+    /** @brief Create hppiMatrix from Mat.
+
+    This function allocates and initializes the hppiMatrix that has the same size and type as input
+    matrix, returns the hppiMatrix*.
+
+    If you want to use zero-copy for GPU you should to have 4KB aligned matrix data. See details
+    [hppiCreateSharedMatrix](http://software.intel.com/ru-ru/node/501697).
+
+    Supports CV_8U, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F.
+
+    @note The hppiMatrix pointer to the image buffer in system memory refers to the src.data. Control
+    the lifetime of the matrix and don't change its data, if there is no special need.
+    @param src input matrix.
+    @param accel accelerator instance. Supports type:
+    -   **HPP_ACCEL_TYPE_CPU** - accelerated by optimized CPU instructions.
+    -   **HPP_ACCEL_TYPE_GPU** - accelerated by GPU programmable units or fixed-function
+        accelerators.
+    -   **HPP_ACCEL_TYPE_ANY** - any acceleration or no acceleration available.
+    @sa howToUseIPPAconversion, hpp::getMat
+     */
+    inline hppiMatrix* getHpp(const Mat& src, hppAccel accel)
+    {
+        int htype = toHppType(src.type());
+        int cn = src.channels();
+
+        CV_Assert(src.data);
+        hppAccelType accelType = hppQueryAccelType(accel);
+
+        if (accelType!=HPP_ACCEL_TYPE_CPU)
+        {
+            hpp32u pitch, size;
+            hppQueryMatrixAllocParams(accel, src.cols*cn, src.rows, htype, &pitch, &size);
+            if (pitch!=0 && size!=0)
+                if ((int)(src.data)%4096==0 && pitch==(hpp32u)(src.step))
+                {
+                    return hppiCreateSharedMatrix(htype, src.cols*cn, src.rows, src.data, pitch, size);
+                }
+        }
+
+        return hppiCreateMatrix(htype, src.cols*cn, src.rows, src.data, (hpp32s)(src.step));;
+    }
+
+//! @}
+}}
+
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp
new file mode 100644
index 0000000..ffec538
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/mat.hpp
@@ -0,0 +1,3431 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_MAT_HPP__
+#define __OPENCV_CORE_MAT_HPP__
+
+#ifndef __cplusplus
+#  error mat.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/matx.hpp"
+#include "opencv2/core/types.hpp"
+
+#include "opencv2/core/bufferpool.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_basic
+//! @{
+
+enum { ACCESS_READ=1<<24, ACCESS_WRITE=1<<25,
+    ACCESS_RW=3<<24, ACCESS_MASK=ACCESS_RW, ACCESS_FAST=1<<26 };
+
+class CV_EXPORTS _OutputArray;
+
+//////////////////////// Input/Output Array Arguments /////////////////////////////////
+
+/** @brief This is the proxy class for passing read-only input arrays into OpenCV functions.
+
+It is defined as:
+@code
+    typedef const _InputArray& InputArray;
+@endcode
+where _InputArray is a class that can be constructed from `Mat`, `Mat_<T>`, `Matx<T, m, n>`,
+`std::vector<T>`, `std::vector<std::vector<T> >` or `std::vector<Mat>`. It can also be constructed
+from a matrix expression.
+
+Since this is mostly implementation-level class, and its interface may change in future versions, we
+do not describe it in details. There are a few key things, though, that should be kept in mind:
+
+-   When you see in the reference manual or in OpenCV source code a function that takes
+    InputArray, it means that you can actually pass `Mat`, `Matx`, `vector<T>` etc. (see above the
+    complete list).
+-   Optional input arguments: If some of the input arrays may be empty, pass cv::noArray() (or
+    simply cv::Mat() as you probably did before).
+-   The class is designed solely for passing parameters. That is, normally you *should not*
+    declare class members, local and global variables of this type.
+-   If you want to design your own function or a class method that can operate of arrays of
+    multiple types, you can use InputArray (or OutputArray) for the respective parameters. Inside
+    a function you should use _InputArray::getMat() method to construct a matrix header for the
+    array (without copying data). _InputArray::kind() can be used to distinguish Mat from
+    `vector<>` etc., but normally it is not needed.
+
+Here is how you can use a function that takes InputArray :
+@code
+    std::vector<Point2f> vec;
+    // points or a circle
+    for( int i = 0; i < 30; i++ )
+        vec.push_back(Point2f((float)(100 + 30*cos(i*CV_PI*2/5)),
+                              (float)(100 - 30*sin(i*CV_PI*2/5))));
+    cv::transform(vec, vec, cv::Matx23f(0.707, -0.707, 10, 0.707, 0.707, 20));
+@endcode
+That is, we form an STL vector containing points, and apply in-place affine transformation to the
+vector using the 2x3 matrix created inline as `Matx<float, 2, 3>` instance.
+
+Here is how such a function can be implemented (for simplicity, we implement a very specific case of
+it, according to the assertion statement inside) :
+@code
+    void myAffineTransform(InputArray _src, OutputArray _dst, InputArray _m)
+    {
+        // get Mat headers for input arrays. This is O(1) operation,
+        // unless _src and/or _m are matrix expressions.
+        Mat src = _src.getMat(), m = _m.getMat();
+        CV_Assert( src.type() == CV_32FC2 && m.type() == CV_32F && m.size() == Size(3, 2) );
+
+        // [re]create the output array so that it has the proper size and type.
+        // In case of Mat it calls Mat::create, in case of STL vector it calls vector::resize.
+        _dst.create(src.size(), src.type());
+        Mat dst = _dst.getMat();
+
+        for( int i = 0; i < src.rows; i++ )
+            for( int j = 0; j < src.cols; j++ )
+            {
+                Point2f pt = src.at<Point2f>(i, j);
+                dst.at<Point2f>(i, j) = Point2f(m.at<float>(0, 0)*pt.x +
+                                                m.at<float>(0, 1)*pt.y +
+                                                m.at<float>(0, 2),
+                                                m.at<float>(1, 0)*pt.x +
+                                                m.at<float>(1, 1)*pt.y +
+                                                m.at<float>(1, 2));
+            }
+    }
+@endcode
+There is another related type, InputArrayOfArrays, which is currently defined as a synonym for
+InputArray:
+@code
+    typedef InputArray InputArrayOfArrays;
+@endcode
+It denotes function arguments that are either vectors of vectors or vectors of matrices. A separate
+synonym is needed to generate Python/Java etc. wrappers properly. At the function implementation
+level their use is similar, but _InputArray::getMat(idx) should be used to get header for the
+idx-th component of the outer vector and _InputArray::size().area() should be used to find the
+number of components (vectors/matrices) of the outer vector.
+ */
+class CV_EXPORTS _InputArray
+{
+public:
+    enum {
+        KIND_SHIFT = 16,
+        FIXED_TYPE = 0x8000 << KIND_SHIFT,
+        FIXED_SIZE = 0x4000 << KIND_SHIFT,
+        KIND_MASK = 31 << KIND_SHIFT,
+
+        NONE              = 0 << KIND_SHIFT,
+        MAT               = 1 << KIND_SHIFT,
+        MATX              = 2 << KIND_SHIFT,
+        STD_VECTOR        = 3 << KIND_SHIFT,
+        STD_VECTOR_VECTOR = 4 << KIND_SHIFT,
+        STD_VECTOR_MAT    = 5 << KIND_SHIFT,
+        EXPR              = 6 << KIND_SHIFT,
+        OPENGL_BUFFER     = 7 << KIND_SHIFT,
+        CUDA_HOST_MEM     = 8 << KIND_SHIFT,
+        CUDA_GPU_MAT      = 9 << KIND_SHIFT,
+        UMAT              =10 << KIND_SHIFT,
+        STD_VECTOR_UMAT   =11 << KIND_SHIFT,
+        STD_BOOL_VECTOR   =12 << KIND_SHIFT,
+        STD_VECTOR_CUDA_GPU_MAT = 13 << KIND_SHIFT
+    };
+
+    _InputArray();
+    _InputArray(int _flags, void* _obj);
+    _InputArray(const Mat& m);
+    _InputArray(const MatExpr& expr);
+    _InputArray(const std::vector<Mat>& vec);
+    template<typename _Tp> _InputArray(const Mat_<_Tp>& m);
+    template<typename _Tp> _InputArray(const std::vector<_Tp>& vec);
+    _InputArray(const std::vector<bool>& vec);
+    template<typename _Tp> _InputArray(const std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _InputArray(const std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _InputArray(const _Tp* vec, int n);
+    template<typename _Tp, int m, int n> _InputArray(const Matx<_Tp, m, n>& matx);
+    _InputArray(const double& val);
+    _InputArray(const cuda::GpuMat& d_mat);
+    _InputArray(const std::vector<cuda::GpuMat>& d_mat_array);
+    _InputArray(const ogl::Buffer& buf);
+    _InputArray(const cuda::HostMem& cuda_mem);
+    template<typename _Tp> _InputArray(const cudev::GpuMat_<_Tp>& m);
+    _InputArray(const UMat& um);
+    _InputArray(const std::vector<UMat>& umv);
+
+    Mat getMat(int idx=-1) const;
+    Mat getMat_(int idx=-1) const;
+    UMat getUMat(int idx=-1) const;
+    void getMatVector(std::vector<Mat>& mv) const;
+    void getUMatVector(std::vector<UMat>& umv) const;
+    void getGpuMatVector(std::vector<cuda::GpuMat>& gpumv) const;
+    cuda::GpuMat getGpuMat() const;
+    ogl::Buffer getOGlBuffer() const;
+
+    int getFlags() const;
+    void* getObj() const;
+    Size getSz() const;
+
+    int kind() const;
+    int dims(int i=-1) const;
+    int cols(int i=-1) const;
+    int rows(int i=-1) const;
+    Size size(int i=-1) const;
+    int sizend(int* sz, int i=-1) const;
+    bool sameSize(const _InputArray& arr) const;
+    size_t total(int i=-1) const;
+    int type(int i=-1) const;
+    int depth(int i=-1) const;
+    int channels(int i=-1) const;
+    bool isContinuous(int i=-1) const;
+    bool isSubmatrix(int i=-1) const;
+    bool empty() const;
+    void copyTo(const _OutputArray& arr) const;
+    void copyTo(const _OutputArray& arr, const _InputArray & mask) const;
+    size_t offset(int i=-1) const;
+    size_t step(int i=-1) const;
+    bool isMat() const;
+    bool isUMat() const;
+    bool isMatVector() const;
+    bool isUMatVector() const;
+    bool isMatx() const;
+    bool isVector() const;
+    bool isGpuMatVector() const;
+    ~_InputArray();
+
+protected:
+    int flags;
+    void* obj;
+    Size sz;
+
+    void init(int _flags, const void* _obj);
+    void init(int _flags, const void* _obj, Size _sz);
+};
+
+
+/** @brief This type is very similar to InputArray except that it is used for input/output and output function
+parameters.
+
+Just like with InputArray, OpenCV users should not care about OutputArray, they just pass `Mat`,
+`vector<T>` etc. to the functions. The same limitation as for `InputArray`: *Do not explicitly
+create OutputArray instances* applies here too.
+
+If you want to make your function polymorphic (i.e. accept different arrays as output parameters),
+it is also not very difficult. Take the sample above as the reference. Note that
+_OutputArray::create() needs to be called before _OutputArray::getMat(). This way you guarantee
+that the output array is properly allocated.
+
+Optional output parameters. If you do not need certain output array to be computed and returned to
+you, pass cv::noArray(), just like you would in the case of optional input array. At the
+implementation level, use _OutputArray::needed() to check if certain output array needs to be
+computed or not.
+
+There are several synonyms for OutputArray that are used to assist automatic Python/Java/... wrapper
+generators:
+@code
+    typedef OutputArray OutputArrayOfArrays;
+    typedef OutputArray InputOutputArray;
+    typedef OutputArray InputOutputArrayOfArrays;
+@endcode
+ */
+class CV_EXPORTS _OutputArray : public _InputArray
+{
+public:
+    enum
+    {
+        DEPTH_MASK_8U = 1 << CV_8U,
+        DEPTH_MASK_8S = 1 << CV_8S,
+        DEPTH_MASK_16U = 1 << CV_16U,
+        DEPTH_MASK_16S = 1 << CV_16S,
+        DEPTH_MASK_32S = 1 << CV_32S,
+        DEPTH_MASK_32F = 1 << CV_32F,
+        DEPTH_MASK_64F = 1 << CV_64F,
+        DEPTH_MASK_ALL = (DEPTH_MASK_64F<<1)-1,
+        DEPTH_MASK_ALL_BUT_8S = DEPTH_MASK_ALL & ~DEPTH_MASK_8S,
+        DEPTH_MASK_FLT = DEPTH_MASK_32F + DEPTH_MASK_64F
+    };
+
+    _OutputArray();
+    _OutputArray(int _flags, void* _obj);
+    _OutputArray(Mat& m);
+    _OutputArray(std::vector<Mat>& vec);
+    _OutputArray(cuda::GpuMat& d_mat);
+    _OutputArray(std::vector<cuda::GpuMat>& d_mat);
+    _OutputArray(ogl::Buffer& buf);
+    _OutputArray(cuda::HostMem& cuda_mem);
+    template<typename _Tp> _OutputArray(cudev::GpuMat_<_Tp>& m);
+    template<typename _Tp> _OutputArray(std::vector<_Tp>& vec);
+    _OutputArray(std::vector<bool>& vec);
+    template<typename _Tp> _OutputArray(std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _OutputArray(std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _OutputArray(Mat_<_Tp>& m);
+    template<typename _Tp> _OutputArray(_Tp* vec, int n);
+    template<typename _Tp, int m, int n> _OutputArray(Matx<_Tp, m, n>& matx);
+    _OutputArray(UMat& m);
+    _OutputArray(std::vector<UMat>& vec);
+
+    _OutputArray(const Mat& m);
+    _OutputArray(const std::vector<Mat>& vec);
+    _OutputArray(const cuda::GpuMat& d_mat);
+    _OutputArray(const std::vector<cuda::GpuMat>& d_mat);
+    _OutputArray(const ogl::Buffer& buf);
+    _OutputArray(const cuda::HostMem& cuda_mem);
+    template<typename _Tp> _OutputArray(const cudev::GpuMat_<_Tp>& m);
+    template<typename _Tp> _OutputArray(const std::vector<_Tp>& vec);
+    template<typename _Tp> _OutputArray(const std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _OutputArray(const std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _OutputArray(const Mat_<_Tp>& m);
+    template<typename _Tp> _OutputArray(const _Tp* vec, int n);
+    template<typename _Tp, int m, int n> _OutputArray(const Matx<_Tp, m, n>& matx);
+    _OutputArray(const UMat& m);
+    _OutputArray(const std::vector<UMat>& vec);
+
+    bool fixedSize() const;
+    bool fixedType() const;
+    bool needed() const;
+    Mat& getMatRef(int i=-1) const;
+    UMat& getUMatRef(int i=-1) const;
+    cuda::GpuMat& getGpuMatRef() const;
+    std::vector<cuda::GpuMat>& getGpuMatVecRef() const;
+    ogl::Buffer& getOGlBufferRef() const;
+    cuda::HostMem& getHostMemRef() const;
+    void create(Size sz, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
+    void create(int rows, int cols, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
+    void create(int dims, const int* size, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
+    void createSameSize(const _InputArray& arr, int mtype) const;
+    void release() const;
+    void clear() const;
+    void setTo(const _InputArray& value, const _InputArray & mask = _InputArray()) const;
+
+    void assign(const UMat& u) const;
+    void assign(const Mat& m) const;
+};
+
+
+class CV_EXPORTS _InputOutputArray : public _OutputArray
+{
+public:
+    _InputOutputArray();
+    _InputOutputArray(int _flags, void* _obj);
+    _InputOutputArray(Mat& m);
+    _InputOutputArray(std::vector<Mat>& vec);
+    _InputOutputArray(cuda::GpuMat& d_mat);
+    _InputOutputArray(ogl::Buffer& buf);
+    _InputOutputArray(cuda::HostMem& cuda_mem);
+    template<typename _Tp> _InputOutputArray(cudev::GpuMat_<_Tp>& m);
+    template<typename _Tp> _InputOutputArray(std::vector<_Tp>& vec);
+    _InputOutputArray(std::vector<bool>& vec);
+    template<typename _Tp> _InputOutputArray(std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _InputOutputArray(std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _InputOutputArray(Mat_<_Tp>& m);
+    template<typename _Tp> _InputOutputArray(_Tp* vec, int n);
+    template<typename _Tp, int m, int n> _InputOutputArray(Matx<_Tp, m, n>& matx);
+    _InputOutputArray(UMat& m);
+    _InputOutputArray(std::vector<UMat>& vec);
+
+    _InputOutputArray(const Mat& m);
+    _InputOutputArray(const std::vector<Mat>& vec);
+    _InputOutputArray(const cuda::GpuMat& d_mat);
+    _InputOutputArray(const std::vector<cuda::GpuMat>& d_mat);
+    _InputOutputArray(const ogl::Buffer& buf);
+    _InputOutputArray(const cuda::HostMem& cuda_mem);
+    template<typename _Tp> _InputOutputArray(const cudev::GpuMat_<_Tp>& m);
+    template<typename _Tp> _InputOutputArray(const std::vector<_Tp>& vec);
+    template<typename _Tp> _InputOutputArray(const std::vector<std::vector<_Tp> >& vec);
+    template<typename _Tp> _InputOutputArray(const std::vector<Mat_<_Tp> >& vec);
+    template<typename _Tp> _InputOutputArray(const Mat_<_Tp>& m);
+    template<typename _Tp> _InputOutputArray(const _Tp* vec, int n);
+    template<typename _Tp, int m, int n> _InputOutputArray(const Matx<_Tp, m, n>& matx);
+    _InputOutputArray(const UMat& m);
+    _InputOutputArray(const std::vector<UMat>& vec);
+};
+
+typedef const _InputArray& InputArray;
+typedef InputArray InputArrayOfArrays;
+typedef const _OutputArray& OutputArray;
+typedef OutputArray OutputArrayOfArrays;
+typedef const _InputOutputArray& InputOutputArray;
+typedef InputOutputArray InputOutputArrayOfArrays;
+
+CV_EXPORTS InputOutputArray noArray();
+
+/////////////////////////////////// MatAllocator //////////////////////////////////////
+
+//! Usage flags for allocator
+enum UMatUsageFlags
+{
+    USAGE_DEFAULT = 0,
+
+    // buffer allocation policy is platform and usage specific
+    USAGE_ALLOCATE_HOST_MEMORY = 1 << 0,
+    USAGE_ALLOCATE_DEVICE_MEMORY = 1 << 1,
+    USAGE_ALLOCATE_SHARED_MEMORY = 1 << 2, // It is not equal to: USAGE_ALLOCATE_HOST_MEMORY | USAGE_ALLOCATE_DEVICE_MEMORY
+
+    __UMAT_USAGE_FLAGS_32BIT = 0x7fffffff // Binary compatibility hint
+};
+
+struct CV_EXPORTS UMatData;
+
+/** @brief  Custom array allocator
+*/
+class CV_EXPORTS MatAllocator
+{
+public:
+    MatAllocator() {}
+    virtual ~MatAllocator() {}
+
+    // let's comment it off for now to detect and fix all the uses of allocator
+    //virtual void allocate(int dims, const int* sizes, int type, int*& refcount,
+    //                      uchar*& datastart, uchar*& data, size_t* step) = 0;
+    //virtual void deallocate(int* refcount, uchar* datastart, uchar* data) = 0;
+    virtual UMatData* allocate(int dims, const int* sizes, int type,
+                               void* data, size_t* step, int flags, UMatUsageFlags usageFlags) const = 0;
+    virtual bool allocate(UMatData* data, int accessflags, UMatUsageFlags usageFlags) const = 0;
+    virtual void deallocate(UMatData* data) const = 0;
+    virtual void map(UMatData* data, int accessflags) const;
+    virtual void unmap(UMatData* data) const;
+    virtual void download(UMatData* data, void* dst, int dims, const size_t sz[],
+                          const size_t srcofs[], const size_t srcstep[],
+                          const size_t dststep[]) const;
+    virtual void upload(UMatData* data, const void* src, int dims, const size_t sz[],
+                        const size_t dstofs[], const size_t dststep[],
+                        const size_t srcstep[]) const;
+    virtual void copy(UMatData* srcdata, UMatData* dstdata, int dims, const size_t sz[],
+                      const size_t srcofs[], const size_t srcstep[],
+                      const size_t dstofs[], const size_t dststep[], bool sync) const;
+
+    // default implementation returns DummyBufferPoolController
+    virtual BufferPoolController* getBufferPoolController(const char* id = NULL) const;
+};
+
+
+//////////////////////////////// MatCommaInitializer //////////////////////////////////
+
+/** @brief  Comma-separated Matrix Initializer
+
+ The class instances are usually not created explicitly.
+ Instead, they are created on "matrix << firstValue" operator.
+
+ The sample below initializes 2x2 rotation matrix:
+
+ \code
+ double angle = 30, a = cos(angle*CV_PI/180), b = sin(angle*CV_PI/180);
+ Mat R = (Mat_<double>(2,2) << a, -b, b, a);
+ \endcode
+*/
+template<typename _Tp> class MatCommaInitializer_
+{
+public:
+    //! the constructor, created by "matrix << firstValue" operator, where matrix is cv::Mat
+    MatCommaInitializer_(Mat_<_Tp>* _m);
+    //! the operator that takes the next value and put it to the matrix
+    template<typename T2> MatCommaInitializer_<_Tp>& operator , (T2 v);
+    //! another form of conversion operator
+    operator Mat_<_Tp>() const;
+protected:
+    MatIterator_<_Tp> it;
+};
+
+
+/////////////////////////////////////// Mat ///////////////////////////////////////////
+
+// note that umatdata might be allocated together
+// with the matrix data, not as a separate object.
+// therefore, it does not have constructor or destructor;
+// it should be explicitly initialized using init().
+struct CV_EXPORTS UMatData
+{
+    enum { COPY_ON_MAP=1, HOST_COPY_OBSOLETE=2,
+        DEVICE_COPY_OBSOLETE=4, TEMP_UMAT=8, TEMP_COPIED_UMAT=24,
+        USER_ALLOCATED=32, DEVICE_MEM_MAPPED=64};
+    UMatData(const MatAllocator* allocator);
+    ~UMatData();
+
+    // provide atomic access to the structure
+    void lock();
+    void unlock();
+
+    bool hostCopyObsolete() const;
+    bool deviceCopyObsolete() const;
+    bool deviceMemMapped() const;
+    bool copyOnMap() const;
+    bool tempUMat() const;
+    bool tempCopiedUMat() const;
+    void markHostCopyObsolete(bool flag);
+    void markDeviceCopyObsolete(bool flag);
+    void markDeviceMemMapped(bool flag);
+
+    const MatAllocator* prevAllocator;
+    const MatAllocator* currAllocator;
+    int urefcount;
+    int refcount;
+    uchar* data;
+    uchar* origdata;
+    size_t size;
+
+    int flags;
+    void* handle;
+    void* userdata;
+    int allocatorFlags_;
+    int mapcount;
+    UMatData* originalUMatData;
+};
+
+
+struct CV_EXPORTS UMatDataAutoLock
+{
+    explicit UMatDataAutoLock(UMatData* u);
+    ~UMatDataAutoLock();
+    UMatData* u;
+};
+
+
+struct CV_EXPORTS MatSize
+{
+    explicit MatSize(int* _p);
+    Size operator()() const;
+    const int& operator[](int i) const;
+    int& operator[](int i);
+    operator const int*() const;
+    bool operator == (const MatSize& sz) const;
+    bool operator != (const MatSize& sz) const;
+
+    int* p;
+};
+
+struct CV_EXPORTS MatStep
+{
+    MatStep();
+    explicit MatStep(size_t s);
+    const size_t& operator[](int i) const;
+    size_t& operator[](int i);
+    operator size_t() const;
+    MatStep& operator = (size_t s);
+
+    size_t* p;
+    size_t buf[2];
+protected:
+    MatStep& operator = (const MatStep&);
+};
+
+/** @example cout_mat.cpp
+An example demonstrating the serial out capabilities of cv::Mat
+*/
+
+ /** @brief n-dimensional dense array class
+
+The class Mat represents an n-dimensional dense numerical single-channel or multi-channel array. It
+can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel
+volumes, vector fields, point clouds, tensors, histograms (though, very high-dimensional histograms
+may be better stored in a SparseMat ). The data layout of the array `M` is defined by the array
+`M.step[]`, so that the address of element \f$(i_0,...,i_{M.dims-1})\f$, where \f$0\leq i_k<M.size[k]\f$, is
+computed as:
+\f[addr(M_{i_0,...,i_{M.dims-1}}) = M.data + M.step[0]*i_0 + M.step[1]*i_1 + ... + M.step[M.dims-1]*i_{M.dims-1}\f]
+In case of a 2-dimensional array, the above formula is reduced to:
+\f[addr(M_{i,j}) = M.data + M.step[0]*i + M.step[1]*j\f]
+Note that `M.step[i] >= M.step[i+1]` (in fact, `M.step[i] >= M.step[i+1]*M.size[i+1]` ). This means
+that 2-dimensional matrices are stored row-by-row, 3-dimensional matrices are stored plane-by-plane,
+and so on. M.step[M.dims-1] is minimal and always equal to the element size M.elemSize() .
+
+So, the data layout in Mat is fully compatible with CvMat, IplImage, and CvMatND types from OpenCV
+1.x. It is also compatible with the majority of dense array types from the standard toolkits and
+SDKs, such as Numpy (ndarray), Win32 (independent device bitmaps), and others, that is, with any
+array that uses *steps* (or *strides*) to compute the position of a pixel. Due to this
+compatibility, it is possible to make a Mat header for user-allocated data and process it in-place
+using OpenCV functions.
+
+There are many different ways to create a Mat object. The most popular options are listed below:
+
+- Use the create(nrows, ncols, type) method or the similar Mat(nrows, ncols, type[, fillValue])
+constructor. A new array of the specified size and type is allocated. type has the same meaning as
+in the cvCreateMat method. For example, CV_8UC1 means a 8-bit single-channel array, CV_32FC2
+means a 2-channel (complex) floating-point array, and so on.
+@code
+    // make a 7x7 complex matrix filled with 1+3j.
+    Mat M(7,7,CV_32FC2,Scalar(1,3));
+    // and now turn M to a 100x60 15-channel 8-bit matrix.
+    // The old content will be deallocated
+    M.create(100,60,CV_8UC(15));
+@endcode
+As noted in the introduction to this chapter, create() allocates only a new array when the shape
+or type of the current array are different from the specified ones.
+
+- Create a multi-dimensional array:
+@code
+    // create a 100x100x100 8-bit array
+    int sz[] = {100, 100, 100};
+    Mat bigCube(3, sz, CV_8U, Scalar::all(0));
+@endcode
+It passes the number of dimensions =1 to the Mat constructor but the created array will be
+2-dimensional with the number of columns set to 1. So, Mat::dims is always \>= 2 (can also be 0
+when the array is empty).
+
+- Use a copy constructor or assignment operator where there can be an array or expression on the
+right side (see below). As noted in the introduction, the array assignment is an O(1) operation
+because it only copies the header and increases the reference counter. The Mat::clone() method can
+be used to get a full (deep) copy of the array when you need it.
+
+- Construct a header for a part of another array. It can be a single row, single column, several
+rows, several columns, rectangular region in the array (called a *minor* in algebra) or a
+diagonal. Such operations are also O(1) because the new header references the same data. You can
+actually modify a part of the array using this feature, for example:
+@code
+    // add the 5-th row, multiplied by 3 to the 3rd row
+    M.row(3) = M.row(3) + M.row(5)*3;
+    // now copy the 7-th column to the 1-st column
+    // M.col(1) = M.col(7); // this will not work
+    Mat M1 = M.col(1);
+    M.col(7).copyTo(M1);
+    // create a new 320x240 image
+    Mat img(Size(320,240),CV_8UC3);
+    // select a ROI
+    Mat roi(img, Rect(10,10,100,100));
+    // fill the ROI with (0,255,0) (which is green in RGB space);
+    // the original 320x240 image will be modified
+    roi = Scalar(0,255,0);
+@endcode
+Due to the additional datastart and dataend members, it is possible to compute a relative
+sub-array position in the main *container* array using locateROI():
+@code
+    Mat A = Mat::eye(10, 10, CV_32S);
+    // extracts A columns, 1 (inclusive) to 3 (exclusive).
+    Mat B = A(Range::all(), Range(1, 3));
+    // extracts B rows, 5 (inclusive) to 9 (exclusive).
+    // that is, C \~ A(Range(5, 9), Range(1, 3))
+    Mat C = B(Range(5, 9), Range::all());
+    Size size; Point ofs;
+    C.locateROI(size, ofs);
+    // size will be (width=10,height=10) and the ofs will be (x=1, y=5)
+@endcode
+As in case of whole matrices, if you need a deep copy, use the `clone()` method of the extracted
+sub-matrices.
+
+- Make a header for user-allocated data. It can be useful to do the following:
+    -# Process "foreign" data using OpenCV (for example, when you implement a DirectShow\* filter or
+    a processing module for gstreamer, and so on). For example:
+    @code
+        void process_video_frame(const unsigned char* pixels,
+                                 int width, int height, int step)
+        {
+            Mat img(height, width, CV_8UC3, pixels, step);
+            GaussianBlur(img, img, Size(7,7), 1.5, 1.5);
+        }
+    @endcode
+    -# Quickly initialize small matrices and/or get a super-fast element access.
+    @code
+        double m[3][3] = {{a, b, c}, {d, e, f}, {g, h, i}};
+        Mat M = Mat(3, 3, CV_64F, m).inv();
+    @endcode
+    .
+    Partial yet very common cases of this *user-allocated data* case are conversions from CvMat and
+    IplImage to Mat. For this purpose, there is function cv::cvarrToMat taking pointers to CvMat or
+    IplImage and the optional flag indicating whether to copy the data or not.
+    @snippet samples/cpp/image.cpp iplimage
+
+- Use MATLAB-style array initializers, zeros(), ones(), eye(), for example:
+@code
+    // create a double-precision identity martix and add it to M.
+    M += Mat::eye(M.rows, M.cols, CV_64F);
+@endcode
+
+- Use a comma-separated initializer:
+@code
+    // create a 3x3 double-precision identity matrix
+    Mat M = (Mat_<double>(3,3) << 1, 0, 0, 0, 1, 0, 0, 0, 1);
+@endcode
+With this approach, you first call a constructor of the Mat class with the proper parameters, and
+then you just put `<< operator` followed by comma-separated values that can be constants,
+variables, expressions, and so on. Also, note the extra parentheses required to avoid compilation
+errors.
+
+Once the array is created, it is automatically managed via a reference-counting mechanism. If the
+array header is built on top of user-allocated data, you should handle the data by yourself. The
+array data is deallocated when no one points to it. If you want to release the data pointed by a
+array header before the array destructor is called, use Mat::release().
+
+The next important thing to learn about the array class is element access. This manual already
+described how to compute an address of each array element. Normally, you are not required to use the
+formula directly in the code. If you know the array element type (which can be retrieved using the
+method Mat::type() ), you can access the element \f$M_{ij}\f$ of a 2-dimensional array as:
+@code
+    M.at<double>(i,j) += 1.f;
+@endcode
+assuming that `M` is a double-precision floating-point array. There are several variants of the method
+at for a different number of dimensions.
+
+If you need to process a whole row of a 2D array, the most efficient way is to get the pointer to
+the row first, and then just use the plain C operator [] :
+@code
+    // compute sum of positive matrix elements
+    // (assuming that M isa double-precision matrix)
+    double sum=0;
+    for(int i = 0; i < M.rows; i++)
+    {
+        const double* Mi = M.ptr<double>(i);
+        for(int j = 0; j < M.cols; j++)
+            sum += std::max(Mi[j], 0.);
+    }
+@endcode
+Some operations, like the one above, do not actually depend on the array shape. They just process
+elements of an array one by one (or elements from multiple arrays that have the same coordinates,
+for example, array addition). Such operations are called *element-wise*. It makes sense to check
+whether all the input/output arrays are continuous, namely, have no gaps at the end of each row. If
+yes, process them as a long single row:
+@code
+    // compute the sum of positive matrix elements, optimized variant
+    double sum=0;
+    int cols = M.cols, rows = M.rows;
+    if(M.isContinuous())
+    {
+        cols *= rows;
+        rows = 1;
+    }
+    for(int i = 0; i < rows; i++)
+    {
+        const double* Mi = M.ptr<double>(i);
+        for(int j = 0; j < cols; j++)
+            sum += std::max(Mi[j], 0.);
+    }
+@endcode
+In case of the continuous matrix, the outer loop body is executed just once. So, the overhead is
+smaller, which is especially noticeable in case of small matrices.
+
+Finally, there are STL-style iterators that are smart enough to skip gaps between successive rows:
+@code
+    // compute sum of positive matrix elements, iterator-based variant
+    double sum=0;
+    MatConstIterator_<double> it = M.begin<double>(), it_end = M.end<double>();
+    for(; it != it_end; ++it)
+        sum += std::max(*it, 0.);
+@endcode
+The matrix iterators are random-access iterators, so they can be passed to any STL algorithm,
+including std::sort().
+*/
+class CV_EXPORTS Mat
+{
+public:
+    /**
+    These are various constructors that form a matrix. As noted in the AutomaticAllocation, often
+    the default constructor is enough, and the proper matrix will be allocated by an OpenCV function.
+    The constructed matrix can further be assigned to another matrix or matrix expression or can be
+    allocated with Mat::create . In the former case, the old content is de-referenced.
+     */
+    Mat();
+
+    /** @overload
+    @param rows Number of rows in a 2D array.
+    @param cols Number of columns in a 2D array.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    */
+    Mat(int rows, int cols, int type);
+
+    /** @overload
+    @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the
+    number of columns go in the reverse order.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+      */
+    Mat(Size size, int type);
+
+    /** @overload
+    @param rows Number of rows in a 2D array.
+    @param cols Number of columns in a 2D array.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param s An optional value to initialize each matrix element with. To set all the matrix elements to
+    the particular value after the construction, use the assignment operator
+    Mat::operator=(const Scalar& value) .
+    */
+    Mat(int rows, int cols, int type, const Scalar& s);
+
+    /** @overload
+    @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the
+    number of columns go in the reverse order.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param s An optional value to initialize each matrix element with. To set all the matrix elements to
+    the particular value after the construction, use the assignment operator
+    Mat::operator=(const Scalar& value) .
+      */
+    Mat(Size size, int type, const Scalar& s);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sizes Array of integers specifying an n-dimensional array shape.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    */
+    Mat(int ndims, const int* sizes, int type);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sizes Array of integers specifying an n-dimensional array shape.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param s An optional value to initialize each matrix element with. To set all the matrix elements to
+    the particular value after the construction, use the assignment operator
+    Mat::operator=(const Scalar& value) .
+    */
+    Mat(int ndims, const int* sizes, int type, const Scalar& s);
+
+    /** @overload
+    @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied
+    by these constructors. Instead, the header pointing to m data or its sub-array is constructed and
+    associated with it. The reference counter, if any, is incremented. So, when you modify the matrix
+    formed using such a constructor, you also modify the corresponding elements of m . If you want to
+    have an independent copy of the sub-array, use Mat::clone() .
+    */
+    Mat(const Mat& m);
+
+    /** @overload
+    @param rows Number of rows in a 2D array.
+    @param cols Number of columns in a 2D array.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param data Pointer to the user data. Matrix constructors that take data and step parameters do not
+    allocate matrix data. Instead, they just initialize the matrix header that points to the specified
+    data, which means that no data is copied. This operation is very efficient and can be used to
+    process external data using OpenCV functions. The external data is not automatically deallocated, so
+    you should take care of it.
+    @param step Number of bytes each matrix row occupies. The value should include the padding bytes at
+    the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed
+    and the actual step is calculated as cols*elemSize(). See Mat::elemSize.
+    */
+    Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP);
+
+    /** @overload
+    @param size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the
+    number of columns go in the reverse order.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param data Pointer to the user data. Matrix constructors that take data and step parameters do not
+    allocate matrix data. Instead, they just initialize the matrix header that points to the specified
+    data, which means that no data is copied. This operation is very efficient and can be used to
+    process external data using OpenCV functions. The external data is not automatically deallocated, so
+    you should take care of it.
+    @param step Number of bytes each matrix row occupies. The value should include the padding bytes at
+    the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed
+    and the actual step is calculated as cols*elemSize(). See Mat::elemSize.
+    */
+    Mat(Size size, int type, void* data, size_t step=AUTO_STEP);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sizes Array of integers specifying an n-dimensional array shape.
+    @param type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or
+    CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.
+    @param data Pointer to the user data. Matrix constructors that take data and step parameters do not
+    allocate matrix data. Instead, they just initialize the matrix header that points to the specified
+    data, which means that no data is copied. This operation is very efficient and can be used to
+    process external data using OpenCV functions. The external data is not automatically deallocated, so
+    you should take care of it.
+    @param steps Array of ndims-1 steps in case of a multi-dimensional array (the last step is always
+    set to the element size). If not specified, the matrix is assumed to be continuous.
+    */
+    Mat(int ndims, const int* sizes, int type, void* data, const size_t* steps=0);
+
+    /** @overload
+    @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied
+    by these constructors. Instead, the header pointing to m data or its sub-array is constructed and
+    associated with it. The reference counter, if any, is incremented. So, when you modify the matrix
+    formed using such a constructor, you also modify the corresponding elements of m . If you want to
+    have an independent copy of the sub-array, use Mat::clone() .
+    @param rowRange Range of the m rows to take. As usual, the range start is inclusive and the range
+    end is exclusive. Use Range::all() to take all the rows.
+    @param colRange Range of the m columns to take. Use Range::all() to take all the columns.
+    */
+    Mat(const Mat& m, const Range& rowRange, const Range& colRange=Range::all());
+
+    /** @overload
+    @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied
+    by these constructors. Instead, the header pointing to m data or its sub-array is constructed and
+    associated with it. The reference counter, if any, is incremented. So, when you modify the matrix
+    formed using such a constructor, you also modify the corresponding elements of m . If you want to
+    have an independent copy of the sub-array, use Mat::clone() .
+    @param roi Region of interest.
+    */
+    Mat(const Mat& m, const Rect& roi);
+
+    /** @overload
+    @param m Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied
+    by these constructors. Instead, the header pointing to m data or its sub-array is constructed and
+    associated with it. The reference counter, if any, is incremented. So, when you modify the matrix
+    formed using such a constructor, you also modify the corresponding elements of m . If you want to
+    have an independent copy of the sub-array, use Mat::clone() .
+    @param ranges Array of selected ranges of m along each dimensionality.
+    */
+    Mat(const Mat& m, const Range* ranges);
+
+    /** @overload
+    @param vec STL vector whose elements form the matrix. The matrix has a single column and the number
+    of rows equal to the number of vector elements. Type of the matrix matches the type of vector
+    elements. The constructor can handle arbitrary types, for which there is a properly declared
+    DataType . This means that the vector elements must be primitive numbers or uni-type numerical
+    tuples of numbers. Mixed-type structures are not supported. The corresponding constructor is
+    explicit. Since STL vectors are not automatically converted to Mat instances, you should write
+    Mat(vec) explicitly. Unless you copy the data into the matrix ( copyData=true ), no new elements
+    will be added to the vector because it can potentially yield vector data reallocation, and, thus,
+    the matrix data pointer will be invalid.
+    @param copyData Flag to specify whether the underlying data of the STL vector should be copied
+    to (true) or shared with (false) the newly constructed matrix. When the data is copied, the
+    allocated buffer is managed using Mat reference counting mechanism. While the data is shared,
+    the reference counter is NULL, and you should not deallocate the data until the matrix is not
+    destructed.
+    */
+    template<typename _Tp> explicit Mat(const std::vector<_Tp>& vec, bool copyData=false);
+
+    /** @overload
+    */
+    template<typename _Tp, int n> explicit Mat(const Vec<_Tp, n>& vec, bool copyData=true);
+
+    /** @overload
+    */
+    template<typename _Tp, int m, int n> explicit Mat(const Matx<_Tp, m, n>& mtx, bool copyData=true);
+
+    /** @overload
+    */
+    template<typename _Tp> explicit Mat(const Point_<_Tp>& pt, bool copyData=true);
+
+    /** @overload
+    */
+    template<typename _Tp> explicit Mat(const Point3_<_Tp>& pt, bool copyData=true);
+
+    /** @overload
+    */
+    template<typename _Tp> explicit Mat(const MatCommaInitializer_<_Tp>& commaInitializer);
+
+    //! download data from GpuMat
+    explicit Mat(const cuda::GpuMat& m);
+
+    //! destructor - calls release()
+    ~Mat();
+
+    /** @brief assignment operators
+
+    These are available assignment operators. Since they all are very different, make sure to read the
+    operator parameters description.
+    @param m Assigned, right-hand-side matrix. Matrix assignment is an O(1) operation. This means that
+    no data is copied but the data is shared and the reference counter, if any, is incremented. Before
+    assigning new data, the old data is de-referenced via Mat::release .
+     */
+    Mat& operator = (const Mat& m);
+
+    /** @overload
+    @param expr Assigned matrix expression object. As opposite to the first form of the assignment
+    operation, the second form can reuse already allocated matrix if it has the right size and type to
+    fit the matrix expression result. It is automatically handled by the real function that the matrix
+    expressions is expanded to. For example, C=A+B is expanded to add(A, B, C), and add takes care of
+    automatic C reallocation.
+    */
+    Mat& operator = (const MatExpr& expr);
+
+    //! retrieve UMat from Mat
+    UMat getUMat(int accessFlags, UMatUsageFlags usageFlags = USAGE_DEFAULT) const;
+
+    /** @brief Creates a matrix header for the specified matrix row.
+
+    The method makes a new header for the specified matrix row and returns it. This is an O(1)
+    operation, regardless of the matrix size. The underlying data of the new matrix is shared with the
+    original matrix. Here is the example of one of the classical basic matrix processing operations,
+    axpy, used by LU and many other algorithms:
+    @code
+        inline void matrix_axpy(Mat& A, int i, int j, double alpha)
+        {
+            A.row(i) += A.row(j)*alpha;
+        }
+    @endcode
+    @note In the current implementation, the following code does not work as expected:
+    @code
+        Mat A;
+        ...
+        A.row(i) = A.row(j); // will not work
+    @endcode
+    This happens because A.row(i) forms a temporary header that is further assigned to another header.
+    Remember that each of these operations is O(1), that is, no data is copied. Thus, the above
+    assignment is not true if you may have expected the j-th row to be copied to the i-th row. To
+    achieve that, you should either turn this simple assignment into an expression or use the
+    Mat::copyTo method:
+    @code
+        Mat A;
+        ...
+        // works, but looks a bit obscure.
+        A.row(i) = A.row(j) + 0;
+        // this is a bit longer, but the recommended method.
+        A.row(j).copyTo(A.row(i));
+    @endcode
+    @param y A 0-based row index.
+     */
+    Mat row(int y) const;
+
+    /** @brief Creates a matrix header for the specified matrix column.
+
+    The method makes a new header for the specified matrix column and returns it. This is an O(1)
+    operation, regardless of the matrix size. The underlying data of the new matrix is shared with the
+    original matrix. See also the Mat::row description.
+    @param x A 0-based column index.
+     */
+    Mat col(int x) const;
+
+    /** @brief Creates a matrix header for the specified row span.
+
+    The method makes a new header for the specified row span of the matrix. Similarly to Mat::row and
+    Mat::col , this is an O(1) operation.
+    @param startrow An inclusive 0-based start index of the row span.
+    @param endrow An exclusive 0-based ending index of the row span.
+     */
+    Mat rowRange(int startrow, int endrow) const;
+
+    /** @overload
+    @param r Range structure containing both the start and the end indices.
+    */
+    Mat rowRange(const Range& r) const;
+
+    /** @brief Creates a matrix header for the specified column span.
+
+    The method makes a new header for the specified column span of the matrix. Similarly to Mat::row and
+    Mat::col , this is an O(1) operation.
+    @param startcol An inclusive 0-based start index of the column span.
+    @param endcol An exclusive 0-based ending index of the column span.
+     */
+    Mat colRange(int startcol, int endcol) const;
+
+    /** @overload
+    @param r Range structure containing both the start and the end indices.
+    */
+    Mat colRange(const Range& r) const;
+
+    /** @brief Extracts a diagonal from a matrix
+
+    The method makes a new header for the specified matrix diagonal. The new matrix is represented as a
+    single-column matrix. Similarly to Mat::row and Mat::col, this is an O(1) operation.
+    @param d index of the diagonal, with the following values:
+    - `d=0` is the main diagonal.
+    - `d>0` is a diagonal from the lower half. For example, d=1 means the diagonal is set
+      immediately below the main one.
+    - `d<0` is a diagonal from the upper half. For example, d=-1 means the diagonal is set
+      immediately above the main one.
+     */
+    Mat diag(int d=0) const;
+
+    /** @brief creates a diagonal matrix
+
+    The method makes a new header for the specified matrix diagonal. The new matrix is represented as a
+    single-column matrix. Similarly to Mat::row and Mat::col, this is an O(1) operation.
+    @param d Single-column matrix that forms a diagonal matrix
+     */
+    static Mat diag(const Mat& d);
+
+    /** @brief Creates a full copy of the array and the underlying data.
+
+    The method creates a full copy of the array. The original step[] is not taken into account. So, the
+    array copy is a continuous array occupying total()*elemSize() bytes.
+     */
+    Mat clone() const;
+
+    /** @brief Copies the matrix to another one.
+
+    The method copies the matrix data to another matrix. Before copying the data, the method invokes :
+    @code
+        m.create(this->size(), this->type());
+    @endcode
+    so that the destination matrix is reallocated if needed. While m.copyTo(m); works flawlessly, the
+    function does not handle the case of a partial overlap between the source and the destination
+    matrices.
+
+    When the operation mask is specified, if the Mat::create call shown above reallocates the matrix,
+    the newly allocated matrix is initialized with all zeros before copying the data.
+    @param m Destination matrix. If it does not have a proper size or type before the operation, it is
+    reallocated.
+     */
+    void copyTo( OutputArray m ) const;
+
+    /** @overload
+    @param m Destination matrix. If it does not have a proper size or type before the operation, it is
+    reallocated.
+    @param mask Operation mask. Its non-zero elements indicate which matrix elements need to be copied.
+    The mask has to be of type CV_8U and can have 1 or multiple channels.
+    */
+    void copyTo( OutputArray m, InputArray mask ) const;
+
+    /** @brief Converts an array to another data type with optional scaling.
+
+    The method converts source pixel values to the target data type. saturate_cast\<\> is applied at
+    the end to avoid possible overflows:
+
+    \f[m(x,y) = saturate \_ cast<rType>( \alpha (*this)(x,y) +  \beta )\f]
+    @param m output matrix; if it does not have a proper size or type before the operation, it is
+    reallocated.
+    @param rtype desired output matrix type or, rather, the depth since the number of channels are the
+    same as the input has; if rtype is negative, the output matrix will have the same type as the input.
+    @param alpha optional scale factor.
+    @param beta optional delta added to the scaled values.
+     */
+    void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;
+
+    /** @brief Provides a functional form of convertTo.
+
+    This is an internally used method called by the @ref MatrixExpressions engine.
+    @param m Destination array.
+    @param type Desired destination array depth (or -1 if it should be the same as the source type).
+     */
+    void assignTo( Mat& m, int type=-1 ) const;
+
+    /** @brief Sets all or some of the array elements to the specified value.
+    @param s Assigned scalar converted to the actual array type.
+    */
+    Mat& operator = (const Scalar& s);
+
+    /** @brief Sets all or some of the array elements to the specified value.
+
+    This is an advanced variant of the Mat::operator=(const Scalar& s) operator.
+    @param value Assigned scalar converted to the actual array type.
+    @param mask Operation mask of the same size as \*this.
+     */
+    Mat& setTo(InputArray value, InputArray mask=noArray());
+
+    /** @brief Changes the shape and/or the number of channels of a 2D matrix without copying the data.
+
+    The method makes a new matrix header for \*this elements. The new matrix may have a different size
+    and/or different number of channels. Any combination is possible if:
+    -   No extra elements are included into the new matrix and no elements are excluded. Consequently,
+        the product rows\*cols\*channels() must stay the same after the transformation.
+    -   No data is copied. That is, this is an O(1) operation. Consequently, if you change the number of
+        rows, or the operation changes the indices of elements row in some other way, the matrix must be
+        continuous. See Mat::isContinuous .
+
+    For example, if there is a set of 3D points stored as an STL vector, and you want to represent the
+    points as a 3xN matrix, do the following:
+    @code
+        std::vector<Point3f> vec;
+        ...
+        Mat pointMat = Mat(vec). // convert vector to Mat, O(1) operation
+                          reshape(1). // make Nx3 1-channel matrix out of Nx1 3-channel.
+                                      // Also, an O(1) operation
+                             t(); // finally, transpose the Nx3 matrix.
+                                  // This involves copying all the elements
+    @endcode
+    @param cn New number of channels. If the parameter is 0, the number of channels remains the same.
+    @param rows New number of rows. If the parameter is 0, the number of rows remains the same.
+     */
+    Mat reshape(int cn, int rows=0) const;
+
+    /** @overload */
+    Mat reshape(int cn, int newndims, const int* newsz) const;
+
+    /** @brief Transposes a matrix.
+
+    The method performs matrix transposition by means of matrix expressions. It does not perform the
+    actual transposition but returns a temporary matrix transposition object that can be further used as
+    a part of more complex matrix expressions or can be assigned to a matrix:
+    @code
+        Mat A1 = A + Mat::eye(A.size(), A.type())*lambda;
+        Mat C = A1.t()*A1; // compute (A + lambda*I)^t * (A + lamda*I)
+    @endcode
+     */
+    MatExpr t() const;
+
+    /** @brief Inverses a matrix.
+
+    The method performs a matrix inversion by means of matrix expressions. This means that a temporary
+    matrix inversion object is returned by the method and can be used further as a part of more complex
+    matrix expressions or can be assigned to a matrix.
+    @param method Matrix inversion method. One of cv::DecompTypes
+     */
+    MatExpr inv(int method=DECOMP_LU) const;
+
+    /** @brief Performs an element-wise multiplication or division of the two matrices.
+
+    The method returns a temporary object encoding per-element array multiplication, with optional
+    scale. Note that this is not a matrix multiplication that corresponds to a simpler "\*" operator.
+
+    Example:
+    @code
+        Mat C = A.mul(5/B); // equivalent to divide(A, B, C, 5)
+    @endcode
+    @param m Another array of the same type and the same size as \*this, or a matrix expression.
+    @param scale Optional scale factor.
+     */
+    MatExpr mul(InputArray m, double scale=1) const;
+
+    /** @brief Computes a cross-product of two 3-element vectors.
+
+    The method computes a cross-product of two 3-element vectors. The vectors must be 3-element
+    floating-point vectors of the same shape and size. The result is another 3-element vector of the
+    same shape and type as operands.
+    @param m Another cross-product operand.
+     */
+    Mat cross(InputArray m) const;
+
+    /** @brief Computes a dot-product of two vectors.
+
+    The method computes a dot-product of two matrices. If the matrices are not single-column or
+    single-row vectors, the top-to-bottom left-to-right scan ordering is used to treat them as 1D
+    vectors. The vectors must have the same size and type. If the matrices have more than one channel,
+    the dot products from all the channels are summed together.
+    @param m another dot-product operand.
+     */
+    double dot(InputArray m) const;
+
+    /** @brief Returns a zero array of the specified size and type.
+
+    The method returns a Matlab-style zero array initializer. It can be used to quickly form a constant
+    array as a function parameter, part of a matrix expression, or as a matrix initializer. :
+    @code
+        Mat A;
+        A = Mat::zeros(3, 3, CV_32F);
+    @endcode
+    In the example above, a new matrix is allocated only if A is not a 3x3 floating-point matrix.
+    Otherwise, the existing matrix A is filled with zeros.
+    @param rows Number of rows.
+    @param cols Number of columns.
+    @param type Created matrix type.
+     */
+    static MatExpr zeros(int rows, int cols, int type);
+
+    /** @overload
+    @param size Alternative to the matrix size specification Size(cols, rows) .
+    @param type Created matrix type.
+    */
+    static MatExpr zeros(Size size, int type);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sz Array of integers specifying the array shape.
+    @param type Created matrix type.
+    */
+    static MatExpr zeros(int ndims, const int* sz, int type);
+
+    /** @brief Returns an array of all 1's of the specified size and type.
+
+    The method returns a Matlab-style 1's array initializer, similarly to Mat::zeros. Note that using
+    this method you can initialize an array with an arbitrary value, using the following Matlab idiom:
+    @code
+        Mat A = Mat::ones(100, 100, CV_8U)*3; // make 100x100 matrix filled with 3.
+    @endcode
+    The above operation does not form a 100x100 matrix of 1's and then multiply it by 3. Instead, it
+    just remembers the scale factor (3 in this case) and use it when actually invoking the matrix
+    initializer.
+    @param rows Number of rows.
+    @param cols Number of columns.
+    @param type Created matrix type.
+     */
+    static MatExpr ones(int rows, int cols, int type);
+
+    /** @overload
+    @param size Alternative to the matrix size specification Size(cols, rows) .
+    @param type Created matrix type.
+    */
+    static MatExpr ones(Size size, int type);
+
+    /** @overload
+    @param ndims Array dimensionality.
+    @param sz Array of integers specifying the array shape.
+    @param type Created matrix type.
+    */
+    static MatExpr ones(int ndims, const int* sz, int type);
+
+    /** @brief Returns an identity matrix of the specified size and type.
+
+    The method returns a Matlab-style identity matrix initializer, similarly to Mat::zeros. Similarly to
+    Mat::ones, you can use a scale operation to create a scaled identity matrix efficiently:
+    @code
+        // make a 4x4 diagonal matrix with 0.1's on the diagonal.
+        Mat A = Mat::eye(4, 4, CV_32F)*0.1;
+    @endcode
+    @param rows Number of rows.
+    @param cols Number of columns.
+    @param type Created matrix type.
+     */
+    static MatExpr eye(int rows, int cols, int type);
+
+    /** @overload
+    @param size Alternative matrix size specification as Size(cols, rows) .
+    @param type Created matrix type.
+    */
+    static MatExpr eye(Size size, int type);
+
+    /** @brief Allocates new array data if needed.
+
+    This is one of the key Mat methods. Most new-style OpenCV functions and methods that produce arrays
+    call this method for each output array. The method uses the following algorithm:
+
+    -# If the current array shape and the type match the new ones, return immediately. Otherwise,
+       de-reference the previous data by calling Mat::release.
+    -# Initialize the new header.
+    -# Allocate the new data of total()\*elemSize() bytes.
+    -# Allocate the new, associated with the data, reference counter and set it to 1.
+
+    Such a scheme makes the memory management robust and efficient at the same time and helps avoid
+    extra typing for you. This means that usually there is no need to explicitly allocate output arrays.
+    That is, instead of writing:
+    @code
+        Mat color;
+        ...
+        Mat gray(color.rows, color.cols, color.depth());
+        cvtColor(color, gray, COLOR_BGR2GRAY);
+    @endcode
+    you can simply write:
+    @code
+        Mat color;
+        ...
+        Mat gray;
+        cvtColor(color, gray, COLOR_BGR2GRAY);
+    @endcode
+    because cvtColor, as well as the most of OpenCV functions, calls Mat::create() for the output array
+    internally.
+    @param rows New number of rows.
+    @param cols New number of columns.
+    @param type New matrix type.
+     */
+    void create(int rows, int cols, int type);
+
+    /** @overload
+    @param size Alternative new matrix size specification: Size(cols, rows)
+    @param type New matrix type.
+    */
+    void create(Size size, int type);
+
+    /** @overload
+    @param ndims New array dimensionality.
+    @param sizes Array of integers specifying a new array shape.
+    @param type New matrix type.
+    */
+    void create(int ndims, const int* sizes, int type);
+
+    /** @brief Increments the reference counter.
+
+    The method increments the reference counter associated with the matrix data. If the matrix header
+    points to an external data set (see Mat::Mat ), the reference counter is NULL, and the method has no
+    effect in this case. Normally, to avoid memory leaks, the method should not be called explicitly. It
+    is called implicitly by the matrix assignment operator. The reference counter increment is an atomic
+    operation on the platforms that support it. Thus, it is safe to operate on the same matrices
+    asynchronously in different threads.
+     */
+    void addref();
+
+    /** @brief Decrements the reference counter and deallocates the matrix if needed.
+
+    The method decrements the reference counter associated with the matrix data. When the reference
+    counter reaches 0, the matrix data is deallocated and the data and the reference counter pointers
+    are set to NULL's. If the matrix header points to an external data set (see Mat::Mat ), the
+    reference counter is NULL, and the method has no effect in this case.
+
+    This method can be called manually to force the matrix data deallocation. But since this method is
+    automatically called in the destructor, or by any other method that changes the data pointer, it is
+    usually not needed. The reference counter decrement and check for 0 is an atomic operation on the
+    platforms that support it. Thus, it is safe to operate on the same matrices asynchronously in
+    different threads.
+     */
+    void release();
+
+    //! deallocates the matrix data
+    void deallocate();
+    //! internal use function; properly re-allocates _size, _step arrays
+    void copySize(const Mat& m);
+
+    /** @brief Reserves space for the certain number of rows.
+
+    The method reserves space for sz rows. If the matrix already has enough space to store sz rows,
+    nothing happens. If the matrix is reallocated, the first Mat::rows rows are preserved. The method
+    emulates the corresponding method of the STL vector class.
+    @param sz Number of rows.
+     */
+    void reserve(size_t sz);
+
+    /** @brief Changes the number of matrix rows.
+
+    The methods change the number of matrix rows. If the matrix is reallocated, the first
+    min(Mat::rows, sz) rows are preserved. The methods emulate the corresponding methods of the STL
+    vector class.
+    @param sz New number of rows.
+     */
+    void resize(size_t sz);
+
+    /** @overload
+    @param sz New number of rows.
+    @param s Value assigned to the newly added elements.
+     */
+    void resize(size_t sz, const Scalar& s);
+
+    //! internal function
+    void push_back_(const void* elem);
+
+    /** @brief Adds elements to the bottom of the matrix.
+
+    The methods add one or more elements to the bottom of the matrix. They emulate the corresponding
+    method of the STL vector class. When elem is Mat , its type and the number of columns must be the
+    same as in the container matrix.
+    @param elem Added element(s).
+     */
+    template<typename _Tp> void push_back(const _Tp& elem);
+
+    /** @overload
+    @param elem Added element(s).
+    */
+    template<typename _Tp> void push_back(const Mat_<_Tp>& elem);
+
+    /** @overload
+    @param m Added line(s).
+    */
+    void push_back(const Mat& m);
+
+    /** @brief Removes elements from the bottom of the matrix.
+
+    The method removes one or more rows from the bottom of the matrix.
+    @param nelems Number of removed rows. If it is greater than the total number of rows, an exception
+    is thrown.
+     */
+    void pop_back(size_t nelems=1);
+
+    /** @brief Locates the matrix header within a parent matrix.
+
+    After you extracted a submatrix from a matrix using Mat::row, Mat::col, Mat::rowRange,
+    Mat::colRange, and others, the resultant submatrix points just to the part of the original big
+    matrix. However, each submatrix contains information (represented by datastart and dataend
+    fields) that helps reconstruct the original matrix size and the position of the extracted
+    submatrix within the original matrix. The method locateROI does exactly that.
+    @param wholeSize Output parameter that contains the size of the whole matrix containing *this*
+    as a part.
+    @param ofs Output parameter that contains an offset of *this* inside the whole matrix.
+     */
+    void locateROI( Size& wholeSize, Point& ofs ) const;
+
+    /** @brief Adjusts a submatrix size and position within the parent matrix.
+
+    The method is complimentary to Mat::locateROI . The typical use of these functions is to determine
+    the submatrix position within the parent matrix and then shift the position somehow. Typically, it
+    can be required for filtering operations when pixels outside of the ROI should be taken into
+    account. When all the method parameters are positive, the ROI needs to grow in all directions by the
+    specified amount, for example:
+    @code
+        A.adjustROI(2, 2, 2, 2);
+    @endcode
+    In this example, the matrix size is increased by 4 elements in each direction. The matrix is shifted
+    by 2 elements to the left and 2 elements up, which brings in all the necessary pixels for the
+    filtering with the 5x5 kernel.
+
+    adjustROI forces the adjusted ROI to be inside of the parent matrix that is boundaries of the
+    adjusted ROI are constrained by boundaries of the parent matrix. For example, if the submatrix A is
+    located in the first row of a parent matrix and you called A.adjustROI(2, 2, 2, 2) then A will not
+    be increased in the upward direction.
+
+    The function is used internally by the OpenCV filtering functions, like filter2D , morphological
+    operations, and so on.
+    @param dtop Shift of the top submatrix boundary upwards.
+    @param dbottom Shift of the bottom submatrix boundary downwards.
+    @param dleft Shift of the left submatrix boundary to the left.
+    @param dright Shift of the right submatrix boundary to the right.
+    @sa copyMakeBorder
+     */
+    Mat& adjustROI( int dtop, int dbottom, int dleft, int dright );
+
+    /** @brief Extracts a rectangular submatrix.
+
+    The operators make a new header for the specified sub-array of \*this . They are the most
+    generalized forms of Mat::row, Mat::col, Mat::rowRange, and Mat::colRange . For example,
+    `A(Range(0, 10), Range::all())` is equivalent to `A.rowRange(0, 10)`. Similarly to all of the above,
+    the operators are O(1) operations, that is, no matrix data is copied.
+    @param rowRange Start and end row of the extracted submatrix. The upper boundary is not included. To
+    select all the rows, use Range::all().
+    @param colRange Start and end column of the extracted submatrix. The upper boundary is not included.
+    To select all the columns, use Range::all().
+     */
+    Mat operator()( Range rowRange, Range colRange ) const;
+
+    /** @overload
+    @param roi Extracted submatrix specified as a rectangle.
+    */
+    Mat operator()( const Rect& roi ) const;
+
+    /** @overload
+    @param ranges Array of selected ranges along each array dimension.
+    */
+    Mat operator()( const Range* ranges ) const;
+
+    // //! converts header to CvMat; no data is copied
+    // operator CvMat() const;
+    // //! converts header to CvMatND; no data is copied
+    // operator CvMatND() const;
+    // //! converts header to IplImage; no data is copied
+    // operator IplImage() const;
+
+    template<typename _Tp> operator std::vector<_Tp>() const;
+    template<typename _Tp, int n> operator Vec<_Tp, n>() const;
+    template<typename _Tp, int m, int n> operator Matx<_Tp, m, n>() const;
+
+    /** @brief Reports whether the matrix is continuous or not.
+
+    The method returns true if the matrix elements are stored continuously without gaps at the end of
+    each row. Otherwise, it returns false. Obviously, 1x1 or 1xN matrices are always continuous.
+    Matrices created with Mat::create are always continuous. But if you extract a part of the matrix
+    using Mat::col, Mat::diag, and so on, or constructed a matrix header for externally allocated data,
+    such matrices may no longer have this property.
+
+    The continuity flag is stored as a bit in the Mat::flags field and is computed automatically when
+    you construct a matrix header. Thus, the continuity check is a very fast operation, though
+    theoretically it could be done as follows:
+    @code
+        // alternative implementation of Mat::isContinuous()
+        bool myCheckMatContinuity(const Mat& m)
+        {
+            //return (m.flags & Mat::CONTINUOUS_FLAG) != 0;
+            return m.rows == 1 || m.step == m.cols*m.elemSize();
+        }
+    @endcode
+    The method is used in quite a few of OpenCV functions. The point is that element-wise operations
+    (such as arithmetic and logical operations, math functions, alpha blending, color space
+    transformations, and others) do not depend on the image geometry. Thus, if all the input and output
+    arrays are continuous, the functions can process them as very long single-row vectors. The example
+    below illustrates how an alpha-blending function can be implemented:
+    @code
+        template<typename T>
+        void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst)
+        {
+            const float alpha_scale = (float)std::numeric_limits<T>::max(),
+                        inv_scale = 1.f/alpha_scale;
+
+            CV_Assert( src1.type() == src2.type() &&
+                       src1.type() == CV_MAKETYPE(DataType<T>::depth, 4) &&
+                       src1.size() == src2.size());
+            Size size = src1.size();
+            dst.create(size, src1.type());
+
+            // here is the idiom: check the arrays for continuity and,
+            // if this is the case,
+            // treat the arrays as 1D vectors
+            if( src1.isContinuous() && src2.isContinuous() && dst.isContinuous() )
+            {
+                size.width *= size.height;
+                size.height = 1;
+            }
+            size.width *= 4;
+
+            for( int i = 0; i < size.height; i++ )
+            {
+                // when the arrays are continuous,
+                // the outer loop is executed only once
+                const T* ptr1 = src1.ptr<T>(i);
+                const T* ptr2 = src2.ptr<T>(i);
+                T* dptr = dst.ptr<T>(i);
+
+                for( int j = 0; j < size.width; j += 4 )
+                {
+                    float alpha = ptr1[j+3]*inv_scale, beta = ptr2[j+3]*inv_scale;
+                    dptr[j] = saturate_cast<T>(ptr1[j]*alpha + ptr2[j]*beta);
+                    dptr[j+1] = saturate_cast<T>(ptr1[j+1]*alpha + ptr2[j+1]*beta);
+                    dptr[j+2] = saturate_cast<T>(ptr1[j+2]*alpha + ptr2[j+2]*beta);
+                    dptr[j+3] = saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale);
+                }
+            }
+        }
+    @endcode
+    This approach, while being very simple, can boost the performance of a simple element-operation by
+    10-20 percents, especially if the image is rather small and the operation is quite simple.
+
+    Another OpenCV idiom in this function, a call of Mat::create for the destination array, that
+    allocates the destination array unless it already has the proper size and type. And while the newly
+    allocated arrays are always continuous, you still need to check the destination array because
+    Mat::create does not always allocate a new matrix.
+     */
+    bool isContinuous() const;
+
+    //! returns true if the matrix is a submatrix of another matrix
+    bool isSubmatrix() const;
+
+    /** @brief Returns the matrix element size in bytes.
+
+    The method returns the matrix element size in bytes. For example, if the matrix type is CV_16SC3 ,
+    the method returns 3\*sizeof(short) or 6.
+     */
+    size_t elemSize() const;
+
+    /** @brief Returns the size of each matrix element channel in bytes.
+
+    The method returns the matrix element channel size in bytes, that is, it ignores the number of
+    channels. For example, if the matrix type is CV_16SC3 , the method returns sizeof(short) or 2.
+     */
+    size_t elemSize1() const;
+
+    /** @brief Returns the type of a matrix element.
+
+    The method returns a matrix element type. This is an identifier compatible with the CvMat type
+    system, like CV_16SC3 or 16-bit signed 3-channel array, and so on.
+     */
+    int type() const;
+
+    /** @brief Returns the depth of a matrix element.
+
+    The method returns the identifier of the matrix element depth (the type of each individual channel).
+    For example, for a 16-bit signed element array, the method returns CV_16S . A complete list of
+    matrix types contains the following values:
+    -   CV_8U - 8-bit unsigned integers ( 0..255 )
+    -   CV_8S - 8-bit signed integers ( -128..127 )
+    -   CV_16U - 16-bit unsigned integers ( 0..65535 )
+    -   CV_16S - 16-bit signed integers ( -32768..32767 )
+    -   CV_32S - 32-bit signed integers ( -2147483648..2147483647 )
+    -   CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )
+    -   CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )
+     */
+    int depth() const;
+
+    /** @brief Returns the number of matrix channels.
+
+    The method returns the number of matrix channels.
+     */
+    int channels() const;
+
+    /** @brief Returns a normalized step.
+
+    The method returns a matrix step divided by Mat::elemSize1() . It can be useful to quickly access an
+    arbitrary matrix element.
+     */
+    size_t step1(int i=0) const;
+
+    /** @brief Returns true if the array has no elements.
+
+    The method returns true if Mat::total() is 0 or if Mat::data is NULL. Because of pop_back() and
+    resize() methods `M.total() == 0` does not imply that `M.data == NULL`.
+     */
+    bool empty() const;
+
+    /** @brief Returns the total number of array elements.
+
+    The method returns the number of array elements (a number of pixels if the array represents an
+    image).
+     */
+    size_t total() const;
+
+    //! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise
+    int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const;
+
+    /** @brief Returns a pointer to the specified matrix row.
+
+    The methods return `uchar*` or typed pointer to the specified matrix row. See the sample in
+    Mat::isContinuous to know how to use these methods.
+    @param i0 A 0-based row index.
+     */
+    uchar* ptr(int i0=0);
+    /** @overload */
+    const uchar* ptr(int i0=0) const;
+
+    /** @overload */
+    uchar* ptr(int i0, int i1);
+    /** @overload */
+    const uchar* ptr(int i0, int i1) const;
+
+    /** @overload */
+    uchar* ptr(int i0, int i1, int i2);
+    /** @overload */
+    const uchar* ptr(int i0, int i1, int i2) const;
+
+    /** @overload */
+    uchar* ptr(const int* idx);
+    /** @overload */
+    const uchar* ptr(const int* idx) const;
+    /** @overload */
+    template<int n> uchar* ptr(const Vec<int, n>& idx);
+    /** @overload */
+    template<int n> const uchar* ptr(const Vec<int, n>& idx) const;
+
+    /** @overload */
+    template<typename _Tp> _Tp* ptr(int i0=0);
+    /** @overload */
+    template<typename _Tp> const _Tp* ptr(int i0=0) const;
+    /** @overload */
+    template<typename _Tp> _Tp* ptr(int i0, int i1);
+    /** @overload */
+    template<typename _Tp> const _Tp* ptr(int i0, int i1) const;
+    /** @overload */
+    template<typename _Tp> _Tp* ptr(int i0, int i1, int i2);
+    /** @overload */
+    template<typename _Tp> const _Tp* ptr(int i0, int i1, int i2) const;
+    /** @overload */
+    template<typename _Tp> _Tp* ptr(const int* idx);
+    /** @overload */
+    template<typename _Tp> const _Tp* ptr(const int* idx) const;
+    /** @overload */
+    template<typename _Tp, int n> _Tp* ptr(const Vec<int, n>& idx);
+    /** @overload */
+    template<typename _Tp, int n> const _Tp* ptr(const Vec<int, n>& idx) const;
+
+    /** @brief Returns a reference to the specified array element.
+
+    The template methods return a reference to the specified array element. For the sake of higher
+    performance, the index range checks are only performed in the Debug configuration.
+
+    Note that the variants with a single index (i) can be used to access elements of single-row or
+    single-column 2-dimensional arrays. That is, if, for example, A is a 1 x N floating-point matrix and
+    B is an M x 1 integer matrix, you can simply write `A.at<float>(k+4)` and `B.at<int>(2*i+1)`
+    instead of `A.at<float>(0,k+4)` and `B.at<int>(2*i+1,0)`, respectively.
+
+    The example below initializes a Hilbert matrix:
+    @code
+        Mat H(100, 100, CV_64F);
+        for(int i = 0; i < H.rows; i++)
+            for(int j = 0; j < H.cols; j++)
+                H.at<double>(i,j)=1./(i+j+1);
+    @endcode
+    @param i0 Index along the dimension 0
+     */
+    template<typename _Tp> _Tp& at(int i0=0);
+    /** @overload
+    @param i0 Index along the dimension 0
+    */
+    template<typename _Tp> const _Tp& at(int i0=0) const;
+    /** @overload
+    @param i0 Index along the dimension 0
+    @param i1 Index along the dimension 1
+    */
+    template<typename _Tp> _Tp& at(int i0, int i1);
+    /** @overload
+    @param i0 Index along the dimension 0
+    @param i1 Index along the dimension 1
+    */
+    template<typename _Tp> const _Tp& at(int i0, int i1) const;
+
+    /** @overload
+    @param i0 Index along the dimension 0
+    @param i1 Index along the dimension 1
+    @param i2 Index along the dimension 2
+    */
+    template<typename _Tp> _Tp& at(int i0, int i1, int i2);
+    /** @overload
+    @param i0 Index along the dimension 0
+    @param i1 Index along the dimension 1
+    @param i2 Index along the dimension 2
+    */
+    template<typename _Tp> const _Tp& at(int i0, int i1, int i2) const;
+
+    /** @overload
+    @param idx Array of Mat::dims indices.
+    */
+    template<typename _Tp> _Tp& at(const int* idx);
+    /** @overload
+    @param idx Array of Mat::dims indices.
+    */
+    template<typename _Tp> const _Tp& at(const int* idx) const;
+
+    /** @overload */
+    template<typename _Tp, int n> _Tp& at(const Vec<int, n>& idx);
+    /** @overload */
+    template<typename _Tp, int n> const _Tp& at(const Vec<int, n>& idx) const;
+
+    /** @overload
+    special versions for 2D arrays (especially convenient for referencing image pixels)
+    @param pt Element position specified as Point(j,i) .
+    */
+    template<typename _Tp> _Tp& at(Point pt);
+    /** @overload
+    special versions for 2D arrays (especially convenient for referencing image pixels)
+    @param pt Element position specified as Point(j,i) .
+    */
+    template<typename _Tp> const _Tp& at(Point pt) const;
+
+    /** @brief Returns the matrix iterator and sets it to the first matrix element.
+
+    The methods return the matrix read-only or read-write iterators. The use of matrix iterators is very
+    similar to the use of bi-directional STL iterators. In the example below, the alpha blending
+    function is rewritten using the matrix iterators:
+    @code
+        template<typename T>
+        void alphaBlendRGBA(const Mat& src1, const Mat& src2, Mat& dst)
+        {
+            typedef Vec<T, 4> VT;
+
+            const float alpha_scale = (float)std::numeric_limits<T>::max(),
+                        inv_scale = 1.f/alpha_scale;
+
+            CV_Assert( src1.type() == src2.type() &&
+                       src1.type() == DataType<VT>::type &&
+                       src1.size() == src2.size());
+            Size size = src1.size();
+            dst.create(size, src1.type());
+
+            MatConstIterator_<VT> it1 = src1.begin<VT>(), it1_end = src1.end<VT>();
+            MatConstIterator_<VT> it2 = src2.begin<VT>();
+            MatIterator_<VT> dst_it = dst.begin<VT>();
+
+            for( ; it1 != it1_end; ++it1, ++it2, ++dst_it )
+            {
+                VT pix1 = *it1, pix2 = *it2;
+                float alpha = pix1[3]*inv_scale, beta = pix2[3]*inv_scale;
+                *dst_it = VT(saturate_cast<T>(pix1[0]*alpha + pix2[0]*beta),
+                             saturate_cast<T>(pix1[1]*alpha + pix2[1]*beta),
+                             saturate_cast<T>(pix1[2]*alpha + pix2[2]*beta),
+                             saturate_cast<T>((1 - (1-alpha)*(1-beta))*alpha_scale));
+            }
+        }
+    @endcode
+     */
+    template<typename _Tp> MatIterator_<_Tp> begin();
+    template<typename _Tp> MatConstIterator_<_Tp> begin() const;
+
+    /** @brief Returns the matrix iterator and sets it to the after-last matrix element.
+
+    The methods return the matrix read-only or read-write iterators, set to the point following the last
+    matrix element.
+     */
+    template<typename _Tp> MatIterator_<_Tp> end();
+    template<typename _Tp> MatConstIterator_<_Tp> end() const;
+
+    /** @brief Invoke with arguments functor, and runs the functor over all matrix element.
+
+    The methods runs operation in parallel. Operation is passed by arguments. Operation have to be a
+    function pointer, a function object or a lambda(C++11).
+
+    All of below operation is equal. Put 0xFF to first channel of all matrix elements:
+    @code
+        Mat image(1920, 1080, CV_8UC3);
+        typedef cv::Point3_<uint8_t> Pixel;
+
+        // first. raw pointer access.
+        for (int r = 0; r < image.rows; ++r) {
+            Pixel* ptr = image.ptr<Pixel>(0, r);
+            const Pixel* ptr_end = ptr + image.cols;
+            for (; ptr != ptr_end; ++ptr) {
+                ptr->x = 255;
+            }
+        }
+
+        // Using MatIterator. (Simple but there are a Iterator's overhead)
+        for (Pixel &p : cv::Mat_<Pixel>(image)) {
+            p.x = 255;
+        }
+
+        // Parallel execution with function object.
+        struct Operator {
+            void operator ()(Pixel &pixel, const int * position) {
+                pixel.x = 255;
+            }
+        };
+        image.forEach<Pixel>(Operator());
+
+        // Parallel execution using C++11 lambda.
+        image.forEach<Pixel>([](Pixel &p, const int * position) -> void {
+            p.x = 255;
+        });
+    @endcode
+    position parameter is index of current pixel:
+    @code
+        // Creating 3D matrix (255 x 255 x 255) typed uint8_t,
+        //  and initialize all elements by the value which equals elements position.
+        //  i.e. pixels (x,y,z) = (1,2,3) is (b,g,r) = (1,2,3).
+
+        int sizes[] = { 255, 255, 255 };
+        typedef cv::Point3_<uint8_t> Pixel;
+
+        Mat_<Pixel> image = Mat::zeros(3, sizes, CV_8UC3);
+
+        image.forEachWithPosition([&](Pixel& pixel, const int position[]) -> void{
+            pixel.x = position[0];
+            pixel.y = position[1];
+            pixel.z = position[2];
+        });
+    @endcode
+     */
+    template<typename _Tp, typename Functor> void forEach(const Functor& operation);
+    /** @overload */
+    template<typename _Tp, typename Functor> void forEach(const Functor& operation) const;
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+    Mat(Mat&& m);
+    Mat& operator = (Mat&& m);
+#endif
+
+    enum { MAGIC_VAL  = 0x42FF0000, AUTO_STEP = 0, CONTINUOUS_FLAG = CV_MAT_CONT_FLAG, SUBMATRIX_FLAG = CV_SUBMAT_FLAG };
+    enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 };
+
+    /*! includes several bit-fields:
+         - the magic signature
+         - continuity flag
+         - depth
+         - number of channels
+     */
+    int flags;
+    //! the matrix dimensionality, >= 2
+    int dims;
+    //! the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
+    int rows, cols;
+    //! pointer to the data
+    uchar* data;
+
+    //! helper fields used in locateROI and adjustROI
+    const uchar* datastart;
+    const uchar* dataend;
+    const uchar* datalimit;
+
+    //! custom allocator
+    MatAllocator* allocator;
+    //! and the standard allocator
+    static MatAllocator* getStdAllocator();
+    static MatAllocator* getDefaultAllocator();
+    static void setDefaultAllocator(MatAllocator* allocator);
+
+    //! interaction with UMat
+    UMatData* u;
+
+    MatSize size;
+    MatStep step;
+
+protected:
+    template<typename _Tp, typename Functor> void forEach_impl(const Functor& operation);
+};
+
+
+///////////////////////////////// Mat_<_Tp> ////////////////////////////////////
+
+/** @brief Template matrix class derived from Mat
+
+@code
+    template<typename _Tp> class Mat_ : public Mat
+    {
+    public:
+        // ... some specific methods
+        //         and
+        // no new extra fields
+    };
+@endcode
+The class `Mat_<_Tp>` is a *thin* template wrapper on top of the Mat class. It does not have any
+extra data fields. Nor this class nor Mat has any virtual methods. Thus, references or pointers to
+these two classes can be freely but carefully converted one to another. For example:
+@code
+    // create a 100x100 8-bit matrix
+    Mat M(100,100,CV_8U);
+    // this will be compiled fine. no any data conversion will be done.
+    Mat_<float>& M1 = (Mat_<float>&)M;
+    // the program is likely to crash at the statement below
+    M1(99,99) = 1.f;
+@endcode
+While Mat is sufficient in most cases, Mat_ can be more convenient if you use a lot of element
+access operations and if you know matrix type at the compilation time. Note that
+`Mat::at(int y,int x)` and `Mat_::operator()(int y,int x)` do absolutely the same
+and run at the same speed, but the latter is certainly shorter:
+@code
+    Mat_<double> M(20,20);
+    for(int i = 0; i < M.rows; i++)
+        for(int j = 0; j < M.cols; j++)
+            M(i,j) = 1./(i+j+1);
+    Mat E, V;
+    eigen(M,E,V);
+    cout << E.at<double>(0,0)/E.at<double>(M.rows-1,0);
+@endcode
+To use Mat_ for multi-channel images/matrices, pass Vec as a Mat_ parameter:
+@code
+    // allocate a 320x240 color image and fill it with green (in RGB space)
+    Mat_<Vec3b> img(240, 320, Vec3b(0,255,0));
+    // now draw a diagonal white line
+    for(int i = 0; i < 100; i++)
+        img(i,i)=Vec3b(255,255,255);
+    // and now scramble the 2nd (red) channel of each pixel
+    for(int i = 0; i < img.rows; i++)
+        for(int j = 0; j < img.cols; j++)
+            img(i,j)[2] ^= (uchar)(i ^ j);
+@endcode
+ */
+template<typename _Tp> class Mat_ : public Mat
+{
+public:
+    typedef _Tp value_type;
+    typedef typename DataType<_Tp>::channel_type channel_type;
+    typedef MatIterator_<_Tp> iterator;
+    typedef MatConstIterator_<_Tp> const_iterator;
+
+    //! default constructor
+    Mat_();
+    //! equivalent to Mat(_rows, _cols, DataType<_Tp>::type)
+    Mat_(int _rows, int _cols);
+    //! constructor that sets each matrix element to specified value
+    Mat_(int _rows, int _cols, const _Tp& value);
+    //! equivalent to Mat(_size, DataType<_Tp>::type)
+    explicit Mat_(Size _size);
+    //! constructor that sets each matrix element to specified value
+    Mat_(Size _size, const _Tp& value);
+    //! n-dim array constructor
+    Mat_(int _ndims, const int* _sizes);
+    //! n-dim array constructor that sets each matrix element to specified value
+    Mat_(int _ndims, const int* _sizes, const _Tp& value);
+    //! copy/conversion contructor. If m is of different type, it's converted
+    Mat_(const Mat& m);
+    //! copy constructor
+    Mat_(const Mat_& m);
+    //! constructs a matrix on top of user-allocated data. step is in bytes(!!!), regardless of the type
+    Mat_(int _rows, int _cols, _Tp* _data, size_t _step=AUTO_STEP);
+    //! constructs n-dim matrix on top of user-allocated data. steps are in bytes(!!!), regardless of the type
+    Mat_(int _ndims, const int* _sizes, _Tp* _data, const size_t* _steps=0);
+    //! selects a submatrix
+    Mat_(const Mat_& m, const Range& rowRange, const Range& colRange=Range::all());
+    //! selects a submatrix
+    Mat_(const Mat_& m, const Rect& roi);
+    //! selects a submatrix, n-dim version
+    Mat_(const Mat_& m, const Range* ranges);
+    //! from a matrix expression
+    explicit Mat_(const MatExpr& e);
+    //! makes a matrix out of Vec, std::vector, Point_ or Point3_. The matrix will have a single column
+    explicit Mat_(const std::vector<_Tp>& vec, bool copyData=false);
+    template<int n> explicit Mat_(const Vec<typename DataType<_Tp>::channel_type, n>& vec, bool copyData=true);
+    template<int m, int n> explicit Mat_(const Matx<typename DataType<_Tp>::channel_type, m, n>& mtx, bool copyData=true);
+    explicit Mat_(const Point_<typename DataType<_Tp>::channel_type>& pt, bool copyData=true);
+    explicit Mat_(const Point3_<typename DataType<_Tp>::channel_type>& pt, bool copyData=true);
+    explicit Mat_(const MatCommaInitializer_<_Tp>& commaInitializer);
+
+    Mat_& operator = (const Mat& m);
+    Mat_& operator = (const Mat_& m);
+    //! set all the elements to s.
+    Mat_& operator = (const _Tp& s);
+    //! assign a matrix expression
+    Mat_& operator = (const MatExpr& e);
+
+    //! iterators; they are smart enough to skip gaps in the end of rows
+    iterator begin();
+    iterator end();
+    const_iterator begin() const;
+    const_iterator end() const;
+
+    //! template methods for for operation over all matrix elements.
+    // the operations take care of skipping gaps in the end of rows (if any)
+    template<typename Functor> void forEach(const Functor& operation);
+    template<typename Functor> void forEach(const Functor& operation) const;
+
+    //! equivalent to Mat::create(_rows, _cols, DataType<_Tp>::type)
+    void create(int _rows, int _cols);
+    //! equivalent to Mat::create(_size, DataType<_Tp>::type)
+    void create(Size _size);
+    //! equivalent to Mat::create(_ndims, _sizes, DatType<_Tp>::type)
+    void create(int _ndims, const int* _sizes);
+    //! cross-product
+    Mat_ cross(const Mat_& m) const;
+    //! data type conversion
+    template<typename T2> operator Mat_<T2>() const;
+    //! overridden forms of Mat::row() etc.
+    Mat_ row(int y) const;
+    Mat_ col(int x) const;
+    Mat_ diag(int d=0) const;
+    Mat_ clone() const;
+
+    //! overridden forms of Mat::elemSize() etc.
+    size_t elemSize() const;
+    size_t elemSize1() const;
+    int type() const;
+    int depth() const;
+    int channels() const;
+    size_t step1(int i=0) const;
+    //! returns step()/sizeof(_Tp)
+    size_t stepT(int i=0) const;
+
+    //! overridden forms of Mat::zeros() etc. Data type is omitted, of course
+    static MatExpr zeros(int rows, int cols);
+    static MatExpr zeros(Size size);
+    static MatExpr zeros(int _ndims, const int* _sizes);
+    static MatExpr ones(int rows, int cols);
+    static MatExpr ones(Size size);
+    static MatExpr ones(int _ndims, const int* _sizes);
+    static MatExpr eye(int rows, int cols);
+    static MatExpr eye(Size size);
+
+    //! some more overriden methods
+    Mat_& adjustROI( int dtop, int dbottom, int dleft, int dright );
+    Mat_ operator()( const Range& rowRange, const Range& colRange ) const;
+    Mat_ operator()( const Rect& roi ) const;
+    Mat_ operator()( const Range* ranges ) const;
+
+    //! more convenient forms of row and element access operators
+    _Tp* operator [](int y);
+    const _Tp* operator [](int y) const;
+
+    //! returns reference to the specified element
+    _Tp& operator ()(const int* idx);
+    //! returns read-only reference to the specified element
+    const _Tp& operator ()(const int* idx) const;
+
+    //! returns reference to the specified element
+    template<int n> _Tp& operator ()(const Vec<int, n>& idx);
+    //! returns read-only reference to the specified element
+    template<int n> const _Tp& operator ()(const Vec<int, n>& idx) const;
+
+    //! returns reference to the specified element (1D case)
+    _Tp& operator ()(int idx0);
+    //! returns read-only reference to the specified element (1D case)
+    const _Tp& operator ()(int idx0) const;
+    //! returns reference to the specified element (2D case)
+    _Tp& operator ()(int idx0, int idx1);
+    //! returns read-only reference to the specified element (2D case)
+    const _Tp& operator ()(int idx0, int idx1) const;
+    //! returns reference to the specified element (3D case)
+    _Tp& operator ()(int idx0, int idx1, int idx2);
+    //! returns read-only reference to the specified element (3D case)
+    const _Tp& operator ()(int idx0, int idx1, int idx2) const;
+
+    _Tp& operator ()(Point pt);
+    const _Tp& operator ()(Point pt) const;
+
+    //! conversion to vector.
+    operator std::vector<_Tp>() const;
+    //! conversion to Vec
+    template<int n> operator Vec<typename DataType<_Tp>::channel_type, n>() const;
+    //! conversion to Matx
+    template<int m, int n> operator Matx<typename DataType<_Tp>::channel_type, m, n>() const;
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+    Mat_(Mat_&& m);
+    Mat_& operator = (Mat_&& m);
+
+    Mat_(Mat&& m);
+    Mat_& operator = (Mat&& m);
+
+    Mat_(MatExpr&& e);
+#endif
+};
+
+typedef Mat_<uchar> Mat1b;
+typedef Mat_<Vec2b> Mat2b;
+typedef Mat_<Vec3b> Mat3b;
+typedef Mat_<Vec4b> Mat4b;
+
+typedef Mat_<short> Mat1s;
+typedef Mat_<Vec2s> Mat2s;
+typedef Mat_<Vec3s> Mat3s;
+typedef Mat_<Vec4s> Mat4s;
+
+typedef Mat_<ushort> Mat1w;
+typedef Mat_<Vec2w> Mat2w;
+typedef Mat_<Vec3w> Mat3w;
+typedef Mat_<Vec4w> Mat4w;
+
+typedef Mat_<int>   Mat1i;
+typedef Mat_<Vec2i> Mat2i;
+typedef Mat_<Vec3i> Mat3i;
+typedef Mat_<Vec4i> Mat4i;
+
+typedef Mat_<float> Mat1f;
+typedef Mat_<Vec2f> Mat2f;
+typedef Mat_<Vec3f> Mat3f;
+typedef Mat_<Vec4f> Mat4f;
+
+typedef Mat_<double> Mat1d;
+typedef Mat_<Vec2d> Mat2d;
+typedef Mat_<Vec3d> Mat3d;
+typedef Mat_<Vec4d> Mat4d;
+
+/** @todo document */
+class CV_EXPORTS UMat
+{
+public:
+    //! default constructor
+    UMat(UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    //! constructs 2D matrix of the specified size and type
+    // (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
+    UMat(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    UMat(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    //! constucts 2D matrix and fills it with the specified value _s.
+    UMat(int rows, int cols, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    UMat(Size size, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+
+    //! constructs n-dimensional matrix
+    UMat(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    UMat(int ndims, const int* sizes, int type, const Scalar& s, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+
+    //! copy constructor
+    UMat(const UMat& m);
+
+    //! creates a matrix header for a part of the bigger matrix
+    UMat(const UMat& m, const Range& rowRange, const Range& colRange=Range::all());
+    UMat(const UMat& m, const Rect& roi);
+    UMat(const UMat& m, const Range* ranges);
+    //! builds matrix from std::vector with or without copying the data
+    template<typename _Tp> explicit UMat(const std::vector<_Tp>& vec, bool copyData=false);
+    //! builds matrix from cv::Vec; the data is copied by default
+    template<typename _Tp, int n> explicit UMat(const Vec<_Tp, n>& vec, bool copyData=true);
+    //! builds matrix from cv::Matx; the data is copied by default
+    template<typename _Tp, int m, int n> explicit UMat(const Matx<_Tp, m, n>& mtx, bool copyData=true);
+    //! builds matrix from a 2D point
+    template<typename _Tp> explicit UMat(const Point_<_Tp>& pt, bool copyData=true);
+    //! builds matrix from a 3D point
+    template<typename _Tp> explicit UMat(const Point3_<_Tp>& pt, bool copyData=true);
+    //! builds matrix from comma initializer
+    template<typename _Tp> explicit UMat(const MatCommaInitializer_<_Tp>& commaInitializer);
+
+    //! destructor - calls release()
+    ~UMat();
+    //! assignment operators
+    UMat& operator = (const UMat& m);
+
+    Mat getMat(int flags) const;
+
+    //! returns a new matrix header for the specified row
+    UMat row(int y) const;
+    //! returns a new matrix header for the specified column
+    UMat col(int x) const;
+    //! ... for the specified row span
+    UMat rowRange(int startrow, int endrow) const;
+    UMat rowRange(const Range& r) const;
+    //! ... for the specified column span
+    UMat colRange(int startcol, int endcol) const;
+    UMat colRange(const Range& r) const;
+    //! ... for the specified diagonal
+    // (d=0 - the main diagonal,
+    //  >0 - a diagonal from the lower half,
+    //  <0 - a diagonal from the upper half)
+    UMat diag(int d=0) const;
+    //! constructs a square diagonal matrix which main diagonal is vector "d"
+    static UMat diag(const UMat& d);
+
+    //! returns deep copy of the matrix, i.e. the data is copied
+    UMat clone() const;
+    //! copies the matrix content to "m".
+    // It calls m.create(this->size(), this->type()).
+    void copyTo( OutputArray m ) const;
+    //! copies those matrix elements to "m" that are marked with non-zero mask elements.
+    void copyTo( OutputArray m, InputArray mask ) const;
+    //! converts matrix to another datatype with optional scalng. See cvConvertScale.
+    void convertTo( OutputArray m, int rtype, double alpha=1, double beta=0 ) const;
+
+    void assignTo( UMat& m, int type=-1 ) const;
+
+    //! sets every matrix element to s
+    UMat& operator = (const Scalar& s);
+    //! sets some of the matrix elements to s, according to the mask
+    UMat& setTo(InputArray value, InputArray mask=noArray());
+    //! creates alternative matrix header for the same data, with different
+    // number of channels and/or different number of rows. see cvReshape.
+    UMat reshape(int cn, int rows=0) const;
+    UMat reshape(int cn, int newndims, const int* newsz) const;
+
+    //! matrix transposition by means of matrix expressions
+    UMat t() const;
+    //! matrix inversion by means of matrix expressions
+    UMat inv(int method=DECOMP_LU) const;
+    //! per-element matrix multiplication by means of matrix expressions
+    UMat mul(InputArray m, double scale=1) const;
+
+    //! computes dot-product
+    double dot(InputArray m) const;
+
+    //! Matlab-style matrix initialization
+    static UMat zeros(int rows, int cols, int type);
+    static UMat zeros(Size size, int type);
+    static UMat zeros(int ndims, const int* sz, int type);
+    static UMat ones(int rows, int cols, int type);
+    static UMat ones(Size size, int type);
+    static UMat ones(int ndims, const int* sz, int type);
+    static UMat eye(int rows, int cols, int type);
+    static UMat eye(Size size, int type);
+
+    //! allocates new matrix data unless the matrix already has specified size and type.
+    // previous data is unreferenced if needed.
+    void create(int rows, int cols, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    void create(Size size, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+    void create(int ndims, const int* sizes, int type, UMatUsageFlags usageFlags = USAGE_DEFAULT);
+
+    //! increases the reference counter; use with care to avoid memleaks
+    void addref();
+    //! decreases reference counter;
+    // deallocates the data when reference counter reaches 0.
+    void release();
+
+    //! deallocates the matrix data
+    void deallocate();
+    //! internal use function; properly re-allocates _size, _step arrays
+    void copySize(const UMat& m);
+
+    //! locates matrix header within a parent matrix. See below
+    void locateROI( Size& wholeSize, Point& ofs ) const;
+    //! moves/resizes the current matrix ROI inside the parent matrix.
+    UMat& adjustROI( int dtop, int dbottom, int dleft, int dright );
+    //! extracts a rectangular sub-matrix
+    // (this is a generalized form of row, rowRange etc.)
+    UMat operator()( Range rowRange, Range colRange ) const;
+    UMat operator()( const Rect& roi ) const;
+    UMat operator()( const Range* ranges ) const;
+
+    //! returns true iff the matrix data is continuous
+    // (i.e. when there are no gaps between successive rows).
+    // similar to CV_IS_MAT_CONT(cvmat->type)
+    bool isContinuous() const;
+
+    //! returns true if the matrix is a submatrix of another matrix
+    bool isSubmatrix() const;
+
+    //! returns element size in bytes,
+    // similar to CV_ELEM_SIZE(cvmat->type)
+    size_t elemSize() const;
+    //! returns the size of element channel in bytes.
+    size_t elemSize1() const;
+    //! returns element type, similar to CV_MAT_TYPE(cvmat->type)
+    int type() const;
+    //! returns element type, similar to CV_MAT_DEPTH(cvmat->type)
+    int depth() const;
+    //! returns element type, similar to CV_MAT_CN(cvmat->type)
+    int channels() const;
+    //! returns step/elemSize1()
+    size_t step1(int i=0) const;
+    //! returns true if matrix data is NULL
+    bool empty() const;
+    //! returns the total number of matrix elements
+    size_t total() const;
+
+    //! returns N if the matrix is 1-channel (N x ptdim) or ptdim-channel (1 x N) or (N x 1); negative number otherwise
+    int checkVector(int elemChannels, int depth=-1, bool requireContinuous=true) const;
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+    UMat(UMat&& m);
+    UMat& operator = (UMat&& m);
+#endif
+
+    void* handle(int accessFlags) const;
+    void ndoffset(size_t* ofs) const;
+
+    enum { MAGIC_VAL  = 0x42FF0000, AUTO_STEP = 0, CONTINUOUS_FLAG = CV_MAT_CONT_FLAG, SUBMATRIX_FLAG = CV_SUBMAT_FLAG };
+    enum { MAGIC_MASK = 0xFFFF0000, TYPE_MASK = 0x00000FFF, DEPTH_MASK = 7 };
+
+    /*! includes several bit-fields:
+         - the magic signature
+         - continuity flag
+         - depth
+         - number of channels
+     */
+    int flags;
+    //! the matrix dimensionality, >= 2
+    int dims;
+    //! the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
+    int rows, cols;
+
+    //! custom allocator
+    MatAllocator* allocator;
+    UMatUsageFlags usageFlags; // usage flags for allocator
+    //! and the standard allocator
+    static MatAllocator* getStdAllocator();
+
+    // black-box container of UMat data
+    UMatData* u;
+
+    // offset of the submatrix (or 0)
+    size_t offset;
+
+    MatSize size;
+    MatStep step;
+
+protected:
+};
+
+
+/////////////////////////// multi-dimensional sparse matrix //////////////////////////
+
+/** @brief The class SparseMat represents multi-dimensional sparse numerical arrays.
+
+Such a sparse array can store elements of any type that Mat can store. *Sparse* means that only
+non-zero elements are stored (though, as a result of operations on a sparse matrix, some of its
+stored elements can actually become 0. It is up to you to detect such elements and delete them
+using SparseMat::erase ). The non-zero elements are stored in a hash table that grows when it is
+filled so that the search time is O(1) in average (regardless of whether element is there or not).
+Elements can be accessed using the following methods:
+-   Query operations (SparseMat::ptr and the higher-level SparseMat::ref, SparseMat::value and
+    SparseMat::find), for example:
+    @code
+        const int dims = 5;
+        int size[] = {10, 10, 10, 10, 10};
+        SparseMat sparse_mat(dims, size, CV_32F);
+        for(int i = 0; i < 1000; i++)
+        {
+            int idx[dims];
+            for(int k = 0; k < dims; k++)
+                idx[k] = rand()
+            sparse_mat.ref<float>(idx) += 1.f;
+        }
+    @endcode
+-   Sparse matrix iterators. They are similar to MatIterator but different from NAryMatIterator.
+    That is, the iteration loop is familiar to STL users:
+    @code
+        // prints elements of a sparse floating-point matrix
+        // and the sum of elements.
+        SparseMatConstIterator_<float>
+            it = sparse_mat.begin<float>(),
+            it_end = sparse_mat.end<float>();
+        double s = 0;
+        int dims = sparse_mat.dims();
+        for(; it != it_end; ++it)
+        {
+            // print element indices and the element value
+            const SparseMat::Node* n = it.node();
+            printf("(");
+            for(int i = 0; i < dims; i++)
+                printf("%d%s", n->idx[i], i < dims-1 ? ", " : ")");
+            printf(": %g\n", it.value<float>());
+            s += *it;
+        }
+        printf("Element sum is %g\n", s);
+    @endcode
+    If you run this loop, you will notice that elements are not enumerated in a logical order
+    (lexicographical, and so on). They come in the same order as they are stored in the hash table
+    (semi-randomly). You may collect pointers to the nodes and sort them to get the proper ordering.
+    Note, however, that pointers to the nodes may become invalid when you add more elements to the
+    matrix. This may happen due to possible buffer reallocation.
+-   Combination of the above 2 methods when you need to process 2 or more sparse matrices
+    simultaneously. For example, this is how you can compute unnormalized cross-correlation of the 2
+    floating-point sparse matrices:
+    @code
+        double cross_corr(const SparseMat& a, const SparseMat& b)
+        {
+            const SparseMat *_a = &a, *_b = &b;
+            // if b contains less elements than a,
+            // it is faster to iterate through b
+            if(_a->nzcount() > _b->nzcount())
+                std::swap(_a, _b);
+            SparseMatConstIterator_<float> it = _a->begin<float>(),
+                                           it_end = _a->end<float>();
+            double ccorr = 0;
+            for(; it != it_end; ++it)
+            {
+                // take the next element from the first matrix
+                float avalue = *it;
+                const Node* anode = it.node();
+                // and try to find an element with the same index in the second matrix.
+                // since the hash value depends only on the element index,
+                // reuse the hash value stored in the node
+                float bvalue = _b->value<float>(anode->idx,&anode->hashval);
+                ccorr += avalue*bvalue;
+            }
+            return ccorr;
+        }
+    @endcode
+ */
+class CV_EXPORTS SparseMat
+{
+public:
+    typedef SparseMatIterator iterator;
+    typedef SparseMatConstIterator const_iterator;
+
+    enum { MAGIC_VAL=0x42FD0000, MAX_DIM=32, HASH_SCALE=0x5bd1e995, HASH_BIT=0x80000000 };
+
+    //! the sparse matrix header
+    struct CV_EXPORTS Hdr
+    {
+        Hdr(int _dims, const int* _sizes, int _type);
+        void clear();
+        int refcount;
+        int dims;
+        int valueOffset;
+        size_t nodeSize;
+        size_t nodeCount;
+        size_t freeList;
+        std::vector<uchar> pool;
+        std::vector<size_t> hashtab;
+        int size[MAX_DIM];
+    };
+
+    //! sparse matrix node - element of a hash table
+    struct CV_EXPORTS Node
+    {
+        //! hash value
+        size_t hashval;
+        //! index of the next node in the same hash table entry
+        size_t next;
+        //! index of the matrix element
+        int idx[MAX_DIM];
+    };
+
+    /** @brief Various SparseMat constructors.
+     */
+    SparseMat();
+
+    /** @overload
+    @param dims Array dimensionality.
+    @param _sizes Sparce matrix size on all dementions.
+    @param _type Sparse matrix data type.
+    */
+    SparseMat(int dims, const int* _sizes, int _type);
+
+    /** @overload
+    @param m Source matrix for copy constructor. If m is dense matrix (ocvMat) then it will be converted
+    to sparse representation.
+    */
+    SparseMat(const SparseMat& m);
+
+    /** @overload
+    @param m Source matrix for copy constructor. If m is dense matrix (ocvMat) then it will be converted
+    to sparse representation.
+    */
+    explicit SparseMat(const Mat& m);
+
+    //! the destructor
+    ~SparseMat();
+
+    //! assignment operator. This is O(1) operation, i.e. no data is copied
+    SparseMat& operator = (const SparseMat& m);
+    //! equivalent to the corresponding constructor
+    SparseMat& operator = (const Mat& m);
+
+    //! creates full copy of the matrix
+    SparseMat clone() const;
+
+    //! copies all the data to the destination matrix. All the previous content of m is erased
+    void copyTo( SparseMat& m ) const;
+    //! converts sparse matrix to dense matrix.
+    void copyTo( Mat& m ) const;
+    //! multiplies all the matrix elements by the specified scale factor alpha and converts the results to the specified data type
+    void convertTo( SparseMat& m, int rtype, double alpha=1 ) const;
+    //! converts sparse matrix to dense n-dim matrix with optional type conversion and scaling.
+    /*!
+        @param [out] m - output matrix; if it does not have a proper size or type before the operation,
+            it is reallocated
+        @param [in] rtype 鈥� desired output matrix type or, rather, the depth since the number of channels
+            are the same as the input has; if rtype is negative, the output matrix will have the
+            same type as the input.
+        @param [in] alpha 鈥� optional scale factor
+        @param [in] beta 鈥� optional delta added to the scaled values
+    */
+    void convertTo( Mat& m, int rtype, double alpha=1, double beta=0 ) const;
+
+    // not used now
+    void assignTo( SparseMat& m, int type=-1 ) const;
+
+    //! reallocates sparse matrix.
+    /*!
+        If the matrix already had the proper size and type,
+        it is simply cleared with clear(), otherwise,
+        the old matrix is released (using release()) and the new one is allocated.
+    */
+    void create(int dims, const int* _sizes, int _type);
+    //! sets all the sparse matrix elements to 0, which means clearing the hash table.
+    void clear();
+    //! manually increments the reference counter to the header.
+    void addref();
+    // decrements the header reference counter. When the counter reaches 0, the header and all the underlying data are deallocated.
+    void release();
+
+    //! converts sparse matrix to the old-style representation; all the elements are copied.
+    //operator CvSparseMat*() const;
+    //! returns the size of each element in bytes (not including the overhead - the space occupied by SparseMat::Node elements)
+    size_t elemSize() const;
+    //! returns elemSize()/channels()
+    size_t elemSize1() const;
+
+    //! returns type of sparse matrix elements
+    int type() const;
+    //! returns the depth of sparse matrix elements
+    int depth() const;
+    //! returns the number of channels
+    int channels() const;
+
+    //! returns the array of sizes, or NULL if the matrix is not allocated
+    const int* size() const;
+    //! returns the size of i-th matrix dimension (or 0)
+    int size(int i) const;
+    //! returns the matrix dimensionality
+    int dims() const;
+    //! returns the number of non-zero elements (=the number of hash table nodes)
+    size_t nzcount() const;
+
+    //! computes the element hash value (1D case)
+    size_t hash(int i0) const;
+    //! computes the element hash value (2D case)
+    size_t hash(int i0, int i1) const;
+    //! computes the element hash value (3D case)
+    size_t hash(int i0, int i1, int i2) const;
+    //! computes the element hash value (nD case)
+    size_t hash(const int* idx) const;
+
+    //!@{
+    /*!
+     specialized variants for 1D, 2D, 3D cases and the generic_type one for n-D case.
+     return pointer to the matrix element.
+      - if the element is there (it's non-zero), the pointer to it is returned
+      - if it's not there and createMissing=false, NULL pointer is returned
+      - if it's not there and createMissing=true, then the new element
+        is created and initialized with 0. Pointer to it is returned
+      - if the optional hashval pointer is not NULL, the element hash value is
+        not computed, but *hashval is taken instead.
+    */
+    //! returns pointer to the specified element (1D case)
+    uchar* ptr(int i0, bool createMissing, size_t* hashval=0);
+    //! returns pointer to the specified element (2D case)
+    uchar* ptr(int i0, int i1, bool createMissing, size_t* hashval=0);
+    //! returns pointer to the specified element (3D case)
+    uchar* ptr(int i0, int i1, int i2, bool createMissing, size_t* hashval=0);
+    //! returns pointer to the specified element (nD case)
+    uchar* ptr(const int* idx, bool createMissing, size_t* hashval=0);
+    //!@}
+
+    //!@{
+    /*!
+     return read-write reference to the specified sparse matrix element.
+
+     `ref<_Tp>(i0,...[,hashval])` is equivalent to `*(_Tp*)ptr(i0,...,true[,hashval])`.
+     The methods always return a valid reference.
+     If the element did not exist, it is created and initialiazed with 0.
+    */
+    //! returns reference to the specified element (1D case)
+    template<typename _Tp> _Tp& ref(int i0, size_t* hashval=0);
+    //! returns reference to the specified element (2D case)
+    template<typename _Tp> _Tp& ref(int i0, int i1, size_t* hashval=0);
+    //! returns reference to the specified element (3D case)
+    template<typename _Tp> _Tp& ref(int i0, int i1, int i2, size_t* hashval=0);
+    //! returns reference to the specified element (nD case)
+    template<typename _Tp> _Tp& ref(const int* idx, size_t* hashval=0);
+    //!@}
+
+    //!@{
+    /*!
+     return value of the specified sparse matrix element.
+
+     `value<_Tp>(i0,...[,hashval])` is equivalent to
+     @code
+     { const _Tp* p = find<_Tp>(i0,...[,hashval]); return p ? *p : _Tp(); }
+     @endcode
+
+     That is, if the element did not exist, the methods return 0.
+     */
+    //! returns value of the specified element (1D case)
+    template<typename _Tp> _Tp value(int i0, size_t* hashval=0) const;
+    //! returns value of the specified element (2D case)
+    template<typename _Tp> _Tp value(int i0, int i1, size_t* hashval=0) const;
+    //! returns value of the specified element (3D case)
+    template<typename _Tp> _Tp value(int i0, int i1, int i2, size_t* hashval=0) const;
+    //! returns value of the specified element (nD case)
+    template<typename _Tp> _Tp value(const int* idx, size_t* hashval=0) const;
+    //!@}
+
+    //!@{
+    /*!
+     Return pointer to the specified sparse matrix element if it exists
+
+     `find<_Tp>(i0,...[,hashval])` is equivalent to `(_const Tp*)ptr(i0,...false[,hashval])`.
+
+     If the specified element does not exist, the methods return NULL.
+    */
+    //! returns pointer to the specified element (1D case)
+    template<typename _Tp> const _Tp* find(int i0, size_t* hashval=0) const;
+    //! returns pointer to the specified element (2D case)
+    template<typename _Tp> const _Tp* find(int i0, int i1, size_t* hashval=0) const;
+    //! returns pointer to the specified element (3D case)
+    template<typename _Tp> const _Tp* find(int i0, int i1, int i2, size_t* hashval=0) const;
+    //! returns pointer to the specified element (nD case)
+    template<typename _Tp> const _Tp* find(const int* idx, size_t* hashval=0) const;
+    //!@}
+
+    //! erases the specified element (2D case)
+    void erase(int i0, int i1, size_t* hashval=0);
+    //! erases the specified element (3D case)
+    void erase(int i0, int i1, int i2, size_t* hashval=0);
+    //! erases the specified element (nD case)
+    void erase(const int* idx, size_t* hashval=0);
+
+    //!@{
+    /*!
+       return the sparse matrix iterator pointing to the first sparse matrix element
+    */
+    //! returns the sparse matrix iterator at the matrix beginning
+    SparseMatIterator begin();
+    //! returns the sparse matrix iterator at the matrix beginning
+    template<typename _Tp> SparseMatIterator_<_Tp> begin();
+    //! returns the read-only sparse matrix iterator at the matrix beginning
+    SparseMatConstIterator begin() const;
+    //! returns the read-only sparse matrix iterator at the matrix beginning
+    template<typename _Tp> SparseMatConstIterator_<_Tp> begin() const;
+    //!@}
+    /*!
+       return the sparse matrix iterator pointing to the element following the last sparse matrix element
+    */
+    //! returns the sparse matrix iterator at the matrix end
+    SparseMatIterator end();
+    //! returns the read-only sparse matrix iterator at the matrix end
+    SparseMatConstIterator end() const;
+    //! returns the typed sparse matrix iterator at the matrix end
+    template<typename _Tp> SparseMatIterator_<_Tp> end();
+    //! returns the typed read-only sparse matrix iterator at the matrix end
+    template<typename _Tp> SparseMatConstIterator_<_Tp> end() const;
+
+    //! returns the value stored in the sparse martix node
+    template<typename _Tp> _Tp& value(Node* n);
+    //! returns the value stored in the sparse martix node
+    template<typename _Tp> const _Tp& value(const Node* n) const;
+
+    ////////////// some internal-use methods ///////////////
+    Node* node(size_t nidx);
+    const Node* node(size_t nidx) const;
+
+    uchar* newNode(const int* idx, size_t hashval);
+    void removeNode(size_t hidx, size_t nidx, size_t previdx);
+    void resizeHashTab(size_t newsize);
+
+    int flags;
+    Hdr* hdr;
+};
+
+
+
+///////////////////////////////// SparseMat_<_Tp> ////////////////////////////////////
+
+/** @brief Template sparse n-dimensional array class derived from SparseMat
+
+SparseMat_ is a thin wrapper on top of SparseMat created in the same way as Mat_ . It simplifies
+notation of some operations:
+@code
+    int sz[] = {10, 20, 30};
+    SparseMat_<double> M(3, sz);
+    ...
+    M.ref(1, 2, 3) = M(4, 5, 6) + M(7, 8, 9);
+@endcode
+ */
+template<typename _Tp> class SparseMat_ : public SparseMat
+{
+public:
+    typedef SparseMatIterator_<_Tp> iterator;
+    typedef SparseMatConstIterator_<_Tp> const_iterator;
+
+    //! the default constructor
+    SparseMat_();
+    //! the full constructor equivelent to SparseMat(dims, _sizes, DataType<_Tp>::type)
+    SparseMat_(int dims, const int* _sizes);
+    //! the copy constructor. If DataType<_Tp>.type != m.type(), the m elements are converted
+    SparseMat_(const SparseMat& m);
+    //! the copy constructor. This is O(1) operation - no data is copied
+    SparseMat_(const SparseMat_& m);
+    //! converts dense matrix to the sparse form
+    SparseMat_(const Mat& m);
+    //! converts the old-style sparse matrix to the C++ class. All the elements are copied
+    //SparseMat_(const CvSparseMat* m);
+    //! the assignment operator. If DataType<_Tp>.type != m.type(), the m elements are converted
+    SparseMat_& operator = (const SparseMat& m);
+    //! the assignment operator. This is O(1) operation - no data is copied
+    SparseMat_& operator = (const SparseMat_& m);
+    //! converts dense matrix to the sparse form
+    SparseMat_& operator = (const Mat& m);
+
+    //! makes full copy of the matrix. All the elements are duplicated
+    SparseMat_ clone() const;
+    //! equivalent to cv::SparseMat::create(dims, _sizes, DataType<_Tp>::type)
+    void create(int dims, const int* _sizes);
+    //! converts sparse matrix to the old-style CvSparseMat. All the elements are copied
+    //operator CvSparseMat*() const;
+
+    //! returns type of the matrix elements
+    int type() const;
+    //! returns depth of the matrix elements
+    int depth() const;
+    //! returns the number of channels in each matrix element
+    int channels() const;
+
+    //! equivalent to SparseMat::ref<_Tp>(i0, hashval)
+    _Tp& ref(int i0, size_t* hashval=0);
+    //! equivalent to SparseMat::ref<_Tp>(i0, i1, hashval)
+    _Tp& ref(int i0, int i1, size_t* hashval=0);
+    //! equivalent to SparseMat::ref<_Tp>(i0, i1, i2, hashval)
+    _Tp& ref(int i0, int i1, int i2, size_t* hashval=0);
+    //! equivalent to SparseMat::ref<_Tp>(idx, hashval)
+    _Tp& ref(const int* idx, size_t* hashval=0);
+
+    //! equivalent to SparseMat::value<_Tp>(i0, hashval)
+    _Tp operator()(int i0, size_t* hashval=0) const;
+    //! equivalent to SparseMat::value<_Tp>(i0, i1, hashval)
+    _Tp operator()(int i0, int i1, size_t* hashval=0) const;
+    //! equivalent to SparseMat::value<_Tp>(i0, i1, i2, hashval)
+    _Tp operator()(int i0, int i1, int i2, size_t* hashval=0) const;
+    //! equivalent to SparseMat::value<_Tp>(idx, hashval)
+    _Tp operator()(const int* idx, size_t* hashval=0) const;
+
+    //! returns sparse matrix iterator pointing to the first sparse matrix element
+    SparseMatIterator_<_Tp> begin();
+    //! returns read-only sparse matrix iterator pointing to the first sparse matrix element
+    SparseMatConstIterator_<_Tp> begin() const;
+    //! returns sparse matrix iterator pointing to the element following the last sparse matrix element
+    SparseMatIterator_<_Tp> end();
+    //! returns read-only sparse matrix iterator pointing to the element following the last sparse matrix element
+    SparseMatConstIterator_<_Tp> end() const;
+};
+
+
+
+////////////////////////////////// MatConstIterator //////////////////////////////////
+
+class CV_EXPORTS MatConstIterator
+{
+public:
+    typedef uchar* value_type;
+    typedef ptrdiff_t difference_type;
+    typedef const uchar** pointer;
+    typedef uchar* reference;
+
+#ifndef OPENCV_NOSTL
+    typedef std::random_access_iterator_tag iterator_category;
+#endif
+
+    //! default constructor
+    MatConstIterator();
+    //! constructor that sets the iterator to the beginning of the matrix
+    MatConstIterator(const Mat* _m);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator(const Mat* _m, int _row, int _col=0);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator(const Mat* _m, Point _pt);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator(const Mat* _m, const int* _idx);
+    //! copy constructor
+    MatConstIterator(const MatConstIterator& it);
+
+    //! copy operator
+    MatConstIterator& operator = (const MatConstIterator& it);
+    //! returns the current matrix element
+    const uchar* operator *() const;
+    //! returns the i-th matrix element, relative to the current
+    const uchar* operator [](ptrdiff_t i) const;
+
+    //! shifts the iterator forward by the specified number of elements
+    MatConstIterator& operator += (ptrdiff_t ofs);
+    //! shifts the iterator backward by the specified number of elements
+    MatConstIterator& operator -= (ptrdiff_t ofs);
+    //! decrements the iterator
+    MatConstIterator& operator --();
+    //! decrements the iterator
+    MatConstIterator operator --(int);
+    //! increments the iterator
+    MatConstIterator& operator ++();
+    //! increments the iterator
+    MatConstIterator operator ++(int);
+    //! returns the current iterator position
+    Point pos() const;
+    //! returns the current iterator position
+    void pos(int* _idx) const;
+
+    ptrdiff_t lpos() const;
+    void seek(ptrdiff_t ofs, bool relative = false);
+    void seek(const int* _idx, bool relative = false);
+
+    const Mat* m;
+    size_t elemSize;
+    const uchar* ptr;
+    const uchar* sliceStart;
+    const uchar* sliceEnd;
+};
+
+
+
+////////////////////////////////// MatConstIterator_ /////////////////////////////////
+
+/** @brief Matrix read-only iterator
+ */
+template<typename _Tp>
+class MatConstIterator_ : public MatConstIterator
+{
+public:
+    typedef _Tp value_type;
+    typedef ptrdiff_t difference_type;
+    typedef const _Tp* pointer;
+    typedef const _Tp& reference;
+
+#ifndef OPENCV_NOSTL
+    typedef std::random_access_iterator_tag iterator_category;
+#endif
+
+    //! default constructor
+    MatConstIterator_();
+    //! constructor that sets the iterator to the beginning of the matrix
+    MatConstIterator_(const Mat_<_Tp>* _m);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator_(const Mat_<_Tp>* _m, int _row, int _col=0);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator_(const Mat_<_Tp>* _m, Point _pt);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatConstIterator_(const Mat_<_Tp>* _m, const int* _idx);
+    //! copy constructor
+    MatConstIterator_(const MatConstIterator_& it);
+
+    //! copy operator
+    MatConstIterator_& operator = (const MatConstIterator_& it);
+    //! returns the current matrix element
+    _Tp operator *() const;
+    //! returns the i-th matrix element, relative to the current
+    _Tp operator [](ptrdiff_t i) const;
+
+    //! shifts the iterator forward by the specified number of elements
+    MatConstIterator_& operator += (ptrdiff_t ofs);
+    //! shifts the iterator backward by the specified number of elements
+    MatConstIterator_& operator -= (ptrdiff_t ofs);
+    //! decrements the iterator
+    MatConstIterator_& operator --();
+    //! decrements the iterator
+    MatConstIterator_ operator --(int);
+    //! increments the iterator
+    MatConstIterator_& operator ++();
+    //! increments the iterator
+    MatConstIterator_ operator ++(int);
+    //! returns the current iterator position
+    Point pos() const;
+};
+
+
+
+//////////////////////////////////// MatIterator_ ////////////////////////////////////
+
+/** @brief Matrix read-write iterator
+*/
+template<typename _Tp>
+class MatIterator_ : public MatConstIterator_<_Tp>
+{
+public:
+    typedef _Tp* pointer;
+    typedef _Tp& reference;
+
+#ifndef OPENCV_NOSTL
+    typedef std::random_access_iterator_tag iterator_category;
+#endif
+
+    //! the default constructor
+    MatIterator_();
+    //! constructor that sets the iterator to the beginning of the matrix
+    MatIterator_(Mat_<_Tp>* _m);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatIterator_(Mat_<_Tp>* _m, int _row, int _col=0);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatIterator_(Mat_<_Tp>* _m, Point _pt);
+    //! constructor that sets the iterator to the specified element of the matrix
+    MatIterator_(Mat_<_Tp>* _m, const int* _idx);
+    //! copy constructor
+    MatIterator_(const MatIterator_& it);
+    //! copy operator
+    MatIterator_& operator = (const MatIterator_<_Tp>& it );
+
+    //! returns the current matrix element
+    _Tp& operator *() const;
+    //! returns the i-th matrix element, relative to the current
+    _Tp& operator [](ptrdiff_t i) const;
+
+    //! shifts the iterator forward by the specified number of elements
+    MatIterator_& operator += (ptrdiff_t ofs);
+    //! shifts the iterator backward by the specified number of elements
+    MatIterator_& operator -= (ptrdiff_t ofs);
+    //! decrements the iterator
+    MatIterator_& operator --();
+    //! decrements the iterator
+    MatIterator_ operator --(int);
+    //! increments the iterator
+    MatIterator_& operator ++();
+    //! increments the iterator
+    MatIterator_ operator ++(int);
+};
+
+
+
+/////////////////////////////// SparseMatConstIterator ///////////////////////////////
+
+/**  @brief Read-Only Sparse Matrix Iterator.
+
+ Here is how to use the iterator to compute the sum of floating-point sparse matrix elements:
+
+ \code
+ SparseMatConstIterator it = m.begin(), it_end = m.end();
+ double s = 0;
+ CV_Assert( m.type() == CV_32F );
+ for( ; it != it_end; ++it )
+    s += it.value<float>();
+ \endcode
+*/
+class CV_EXPORTS SparseMatConstIterator
+{
+public:
+    //! the default constructor
+    SparseMatConstIterator();
+    //! the full constructor setting the iterator to the first sparse matrix element
+    SparseMatConstIterator(const SparseMat* _m);
+    //! the copy constructor
+    SparseMatConstIterator(const SparseMatConstIterator& it);
+
+    //! the assignment operator
+    SparseMatConstIterator& operator = (const SparseMatConstIterator& it);
+
+    //! template method returning the current matrix element
+    template<typename _Tp> const _Tp& value() const;
+    //! returns the current node of the sparse matrix. it.node->idx is the current element index
+    const SparseMat::Node* node() const;
+
+    //! moves iterator to the previous element
+    SparseMatConstIterator& operator --();
+    //! moves iterator to the previous element
+    SparseMatConstIterator operator --(int);
+    //! moves iterator to the next element
+    SparseMatConstIterator& operator ++();
+    //! moves iterator to the next element
+    SparseMatConstIterator operator ++(int);
+
+    //! moves iterator to the element after the last element
+    void seekEnd();
+
+    const SparseMat* m;
+    size_t hashidx;
+    uchar* ptr;
+};
+
+
+
+////////////////////////////////// SparseMatIterator /////////////////////////////////
+
+/** @brief  Read-write Sparse Matrix Iterator
+
+ The class is similar to cv::SparseMatConstIterator,
+ but can be used for in-place modification of the matrix elements.
+*/
+class CV_EXPORTS SparseMatIterator : public SparseMatConstIterator
+{
+public:
+    //! the default constructor
+    SparseMatIterator();
+    //! the full constructor setting the iterator to the first sparse matrix element
+    SparseMatIterator(SparseMat* _m);
+    //! the full constructor setting the iterator to the specified sparse matrix element
+    SparseMatIterator(SparseMat* _m, const int* idx);
+    //! the copy constructor
+    SparseMatIterator(const SparseMatIterator& it);
+
+    //! the assignment operator
+    SparseMatIterator& operator = (const SparseMatIterator& it);
+    //! returns read-write reference to the current sparse matrix element
+    template<typename _Tp> _Tp& value() const;
+    //! returns pointer to the current sparse matrix node. it.node->idx is the index of the current element (do not modify it!)
+    SparseMat::Node* node() const;
+
+    //! moves iterator to the next element
+    SparseMatIterator& operator ++();
+    //! moves iterator to the next element
+    SparseMatIterator operator ++(int);
+};
+
+
+
+/////////////////////////////// SparseMatConstIterator_ //////////////////////////////
+
+/** @brief  Template Read-Only Sparse Matrix Iterator Class.
+
+ This is the derived from SparseMatConstIterator class that
+ introduces more convenient operator *() for accessing the current element.
+*/
+template<typename _Tp> class SparseMatConstIterator_ : public SparseMatConstIterator
+{
+public:
+
+#ifndef OPENCV_NOSTL
+    typedef std::forward_iterator_tag iterator_category;
+#endif
+
+    //! the default constructor
+    SparseMatConstIterator_();
+    //! the full constructor setting the iterator to the first sparse matrix element
+    SparseMatConstIterator_(const SparseMat_<_Tp>* _m);
+    SparseMatConstIterator_(const SparseMat* _m);
+    //! the copy constructor
+    SparseMatConstIterator_(const SparseMatConstIterator_& it);
+
+    //! the assignment operator
+    SparseMatConstIterator_& operator = (const SparseMatConstIterator_& it);
+    //! the element access operator
+    const _Tp& operator *() const;
+
+    //! moves iterator to the next element
+    SparseMatConstIterator_& operator ++();
+    //! moves iterator to the next element
+    SparseMatConstIterator_ operator ++(int);
+};
+
+
+
+///////////////////////////////// SparseMatIterator_ /////////////////////////////////
+
+/** @brief  Template Read-Write Sparse Matrix Iterator Class.
+
+ This is the derived from cv::SparseMatConstIterator_ class that
+ introduces more convenient operator *() for accessing the current element.
+*/
+template<typename _Tp> class SparseMatIterator_ : public SparseMatConstIterator_<_Tp>
+{
+public:
+
+#ifndef OPENCV_NOSTL
+    typedef std::forward_iterator_tag iterator_category;
+#endif
+
+    //! the default constructor
+    SparseMatIterator_();
+    //! the full constructor setting the iterator to the first sparse matrix element
+    SparseMatIterator_(SparseMat_<_Tp>* _m);
+    SparseMatIterator_(SparseMat* _m);
+    //! the copy constructor
+    SparseMatIterator_(const SparseMatIterator_& it);
+
+    //! the assignment operator
+    SparseMatIterator_& operator = (const SparseMatIterator_& it);
+    //! returns the reference to the current element
+    _Tp& operator *() const;
+
+    //! moves the iterator to the next element
+    SparseMatIterator_& operator ++();
+    //! moves the iterator to the next element
+    SparseMatIterator_ operator ++(int);
+};
+
+
+
+/////////////////////////////////// NAryMatIterator //////////////////////////////////
+
+/** @brief n-ary multi-dimensional array iterator.
+
+Use the class to implement unary, binary, and, generally, n-ary element-wise operations on
+multi-dimensional arrays. Some of the arguments of an n-ary function may be continuous arrays, some
+may be not. It is possible to use conventional MatIterator 's for each array but incrementing all of
+the iterators after each small operations may be a big overhead. In this case consider using
+NAryMatIterator to iterate through several matrices simultaneously as long as they have the same
+geometry (dimensionality and all the dimension sizes are the same). On each iteration `it.planes[0]`,
+`it.planes[1]`,... will be the slices of the corresponding matrices.
+
+The example below illustrates how you can compute a normalized and threshold 3D color histogram:
+@code
+    void computeNormalizedColorHist(const Mat& image, Mat& hist, int N, double minProb)
+    {
+        const int histSize[] = {N, N, N};
+
+        // make sure that the histogram has a proper size and type
+        hist.create(3, histSize, CV_32F);
+
+        // and clear it
+        hist = Scalar(0);
+
+        // the loop below assumes that the image
+        // is a 8-bit 3-channel. check it.
+        CV_Assert(image.type() == CV_8UC3);
+        MatConstIterator_<Vec3b> it = image.begin<Vec3b>(),
+                                 it_end = image.end<Vec3b>();
+        for( ; it != it_end; ++it )
+        {
+            const Vec3b& pix = *it;
+            hist.at<float>(pix[0]*N/256, pix[1]*N/256, pix[2]*N/256) += 1.f;
+        }
+
+        minProb *= image.rows*image.cols;
+        Mat plane;
+        NAryMatIterator it(&hist, &plane, 1);
+        double s = 0;
+        // iterate through the matrix. on each iteration
+        // it.planes[*] (of type Mat) will be set to the current plane.
+        for(int p = 0; p < it.nplanes; p++, ++it)
+        {
+            threshold(it.planes[0], it.planes[0], minProb, 0, THRESH_TOZERO);
+            s += sum(it.planes[0])[0];
+        }
+
+        s = 1./s;
+        it = NAryMatIterator(&hist, &plane, 1);
+        for(int p = 0; p < it.nplanes; p++, ++it)
+            it.planes[0] *= s;
+    }
+@endcode
+ */
+class CV_EXPORTS NAryMatIterator
+{
+public:
+    //! the default constructor
+    NAryMatIterator();
+    //! the full constructor taking arbitrary number of n-dim matrices
+    NAryMatIterator(const Mat** arrays, uchar** ptrs, int narrays=-1);
+    //! the full constructor taking arbitrary number of n-dim matrices
+    NAryMatIterator(const Mat** arrays, Mat* planes, int narrays=-1);
+    //! the separate iterator initialization method
+    void init(const Mat** arrays, Mat* planes, uchar** ptrs, int narrays=-1);
+
+    //! proceeds to the next plane of every iterated matrix
+    NAryMatIterator& operator ++();
+    //! proceeds to the next plane of every iterated matrix (postfix increment operator)
+    NAryMatIterator operator ++(int);
+
+    //! the iterated arrays
+    const Mat** arrays;
+    //! the current planes
+    Mat* planes;
+    //! data pointers
+    uchar** ptrs;
+    //! the number of arrays
+    int narrays;
+    //! the number of hyper-planes that the iterator steps through
+    size_t nplanes;
+    //! the size of each segment (in elements)
+    size_t size;
+protected:
+    int iterdepth;
+    size_t idx;
+};
+
+
+
+///////////////////////////////// Matrix Expressions /////////////////////////////////
+
+class CV_EXPORTS MatOp
+{
+public:
+    MatOp();
+    virtual ~MatOp();
+
+    virtual bool elementWise(const MatExpr& expr) const;
+    virtual void assign(const MatExpr& expr, Mat& m, int type=-1) const = 0;
+    virtual void roi(const MatExpr& expr, const Range& rowRange,
+                     const Range& colRange, MatExpr& res) const;
+    virtual void diag(const MatExpr& expr, int d, MatExpr& res) const;
+    virtual void augAssignAdd(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignSubtract(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignMultiply(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignDivide(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignAnd(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignOr(const MatExpr& expr, Mat& m) const;
+    virtual void augAssignXor(const MatExpr& expr, Mat& m) const;
+
+    virtual void add(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
+    virtual void add(const MatExpr& expr1, const Scalar& s, MatExpr& res) const;
+
+    virtual void subtract(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
+    virtual void subtract(const Scalar& s, const MatExpr& expr, MatExpr& res) const;
+
+    virtual void multiply(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res, double scale=1) const;
+    virtual void multiply(const MatExpr& expr1, double s, MatExpr& res) const;
+
+    virtual void divide(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res, double scale=1) const;
+    virtual void divide(double s, const MatExpr& expr, MatExpr& res) const;
+
+    virtual void abs(const MatExpr& expr, MatExpr& res) const;
+
+    virtual void transpose(const MatExpr& expr, MatExpr& res) const;
+    virtual void matmul(const MatExpr& expr1, const MatExpr& expr2, MatExpr& res) const;
+    virtual void invert(const MatExpr& expr, int method, MatExpr& res) const;
+
+    virtual Size size(const MatExpr& expr) const;
+    virtual int type(const MatExpr& expr) const;
+};
+
+/** @brief Matrix expression representation
+@anchor MatrixExpressions
+This is a list of implemented matrix operations that can be combined in arbitrary complex
+expressions (here A, B stand for matrices ( Mat ), s for a scalar ( Scalar ), alpha for a
+real-valued scalar ( double )):
+-   Addition, subtraction, negation: `A+B`, `A-B`, `A+s`, `A-s`, `s+A`, `s-A`, `-A`
+-   Scaling: `A*alpha`
+-   Per-element multiplication and division: `A.mul(B)`, `A/B`, `alpha/A`
+-   Matrix multiplication: `A*B`
+-   Transposition: `A.t()` (means A<sup>T</sup>)
+-   Matrix inversion and pseudo-inversion, solving linear systems and least-squares problems:
+    `A.inv([method]) (~ A<sup>-1</sup>)`,   `A.inv([method])*B (~ X: AX=B)`
+-   Comparison: `A cmpop B`, `A cmpop alpha`, `alpha cmpop A`, where *cmpop* is one of
+  `>`, `>=`, `==`, `!=`, `<=`, `<`. The result of comparison is an 8-bit single channel mask whose
+    elements are set to 255 (if the particular element or pair of elements satisfy the condition) or
+    0.
+-   Bitwise logical operations: `A logicop B`, `A logicop s`, `s logicop A`, `~A`, where *logicop* is one of
+  `&`, `|`, `^`.
+-   Element-wise minimum and maximum: `min(A, B)`, `min(A, alpha)`, `max(A, B)`, `max(A, alpha)`
+-   Element-wise absolute value: `abs(A)`
+-   Cross-product, dot-product: `A.cross(B)`, `A.dot(B)`
+-   Any function of matrix or matrices and scalars that returns a matrix or a scalar, such as norm,
+    mean, sum, countNonZero, trace, determinant, repeat, and others.
+-   Matrix initializers ( Mat::eye(), Mat::zeros(), Mat::ones() ), matrix comma-separated
+    initializers, matrix constructors and operators that extract sub-matrices (see Mat description).
+-   Mat_<destination_type>() constructors to cast the result to the proper type.
+@note Comma-separated initializers and probably some other operations may require additional
+explicit Mat() or Mat_<T>() constructor calls to resolve a possible ambiguity.
+
+Here are examples of matrix expressions:
+@code
+    // compute pseudo-inverse of A, equivalent to A.inv(DECOMP_SVD)
+    SVD svd(A);
+    Mat pinvA = svd.vt.t()*Mat::diag(1./svd.w)*svd.u.t();
+
+    // compute the new vector of parameters in the Levenberg-Marquardt algorithm
+    x -= (A.t()*A + lambda*Mat::eye(A.cols,A.cols,A.type())).inv(DECOMP_CHOLESKY)*(A.t()*err);
+
+    // sharpen image using "unsharp mask" algorithm
+    Mat blurred; double sigma = 1, threshold = 5, amount = 1;
+    GaussianBlur(img, blurred, Size(), sigma, sigma);
+    Mat lowContrastMask = abs(img - blurred) < threshold;
+    Mat sharpened = img*(1+amount) + blurred*(-amount);
+    img.copyTo(sharpened, lowContrastMask);
+@endcode
+*/
+class CV_EXPORTS MatExpr
+{
+public:
+    MatExpr();
+    explicit MatExpr(const Mat& m);
+
+    MatExpr(const MatOp* _op, int _flags, const Mat& _a = Mat(), const Mat& _b = Mat(),
+            const Mat& _c = Mat(), double _alpha = 1, double _beta = 1, const Scalar& _s = Scalar());
+
+    operator Mat() const;
+    template<typename _Tp> operator Mat_<_Tp>() const;
+
+    Size size() const;
+    int type() const;
+
+    MatExpr row(int y) const;
+    MatExpr col(int x) const;
+    MatExpr diag(int d = 0) const;
+    MatExpr operator()( const Range& rowRange, const Range& colRange ) const;
+    MatExpr operator()( const Rect& roi ) const;
+
+    MatExpr t() const;
+    MatExpr inv(int method = DECOMP_LU) const;
+    MatExpr mul(const MatExpr& e, double scale=1) const;
+    MatExpr mul(const Mat& m, double scale=1) const;
+
+    Mat cross(const Mat& m) const;
+    double dot(const Mat& m) const;
+
+    const MatOp* op;
+    int flags;
+
+    Mat a, b, c;
+    double alpha, beta;
+    Scalar s;
+};
+
+//! @} core_basic
+
+//! @relates cv::MatExpr
+//! @{
+CV_EXPORTS MatExpr operator + (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator + (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator + (const Scalar& s, const Mat& a);
+CV_EXPORTS MatExpr operator + (const MatExpr& e, const Mat& m);
+CV_EXPORTS MatExpr operator + (const Mat& m, const MatExpr& e);
+CV_EXPORTS MatExpr operator + (const MatExpr& e, const Scalar& s);
+CV_EXPORTS MatExpr operator + (const Scalar& s, const MatExpr& e);
+CV_EXPORTS MatExpr operator + (const MatExpr& e1, const MatExpr& e2);
+
+CV_EXPORTS MatExpr operator - (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator - (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator - (const Scalar& s, const Mat& a);
+CV_EXPORTS MatExpr operator - (const MatExpr& e, const Mat& m);
+CV_EXPORTS MatExpr operator - (const Mat& m, const MatExpr& e);
+CV_EXPORTS MatExpr operator - (const MatExpr& e, const Scalar& s);
+CV_EXPORTS MatExpr operator - (const Scalar& s, const MatExpr& e);
+CV_EXPORTS MatExpr operator - (const MatExpr& e1, const MatExpr& e2);
+
+CV_EXPORTS MatExpr operator - (const Mat& m);
+CV_EXPORTS MatExpr operator - (const MatExpr& e);
+
+CV_EXPORTS MatExpr operator * (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator * (const Mat& a, double s);
+CV_EXPORTS MatExpr operator * (double s, const Mat& a);
+CV_EXPORTS MatExpr operator * (const MatExpr& e, const Mat& m);
+CV_EXPORTS MatExpr operator * (const Mat& m, const MatExpr& e);
+CV_EXPORTS MatExpr operator * (const MatExpr& e, double s);
+CV_EXPORTS MatExpr operator * (double s, const MatExpr& e);
+CV_EXPORTS MatExpr operator * (const MatExpr& e1, const MatExpr& e2);
+
+CV_EXPORTS MatExpr operator / (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator / (const Mat& a, double s);
+CV_EXPORTS MatExpr operator / (double s, const Mat& a);
+CV_EXPORTS MatExpr operator / (const MatExpr& e, const Mat& m);
+CV_EXPORTS MatExpr operator / (const Mat& m, const MatExpr& e);
+CV_EXPORTS MatExpr operator / (const MatExpr& e, double s);
+CV_EXPORTS MatExpr operator / (double s, const MatExpr& e);
+CV_EXPORTS MatExpr operator / (const MatExpr& e1, const MatExpr& e2);
+
+CV_EXPORTS MatExpr operator < (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator < (const Mat& a, double s);
+CV_EXPORTS MatExpr operator < (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator <= (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator <= (const Mat& a, double s);
+CV_EXPORTS MatExpr operator <= (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator == (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator == (const Mat& a, double s);
+CV_EXPORTS MatExpr operator == (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator != (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator != (const Mat& a, double s);
+CV_EXPORTS MatExpr operator != (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator >= (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator >= (const Mat& a, double s);
+CV_EXPORTS MatExpr operator >= (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator > (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator > (const Mat& a, double s);
+CV_EXPORTS MatExpr operator > (double s, const Mat& a);
+
+CV_EXPORTS MatExpr operator & (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator & (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator & (const Scalar& s, const Mat& a);
+
+CV_EXPORTS MatExpr operator | (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator | (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator | (const Scalar& s, const Mat& a);
+
+CV_EXPORTS MatExpr operator ^ (const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr operator ^ (const Mat& a, const Scalar& s);
+CV_EXPORTS MatExpr operator ^ (const Scalar& s, const Mat& a);
+
+CV_EXPORTS MatExpr operator ~(const Mat& m);
+
+CV_EXPORTS MatExpr min(const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr min(const Mat& a, double s);
+CV_EXPORTS MatExpr min(double s, const Mat& a);
+
+CV_EXPORTS MatExpr max(const Mat& a, const Mat& b);
+CV_EXPORTS MatExpr max(const Mat& a, double s);
+CV_EXPORTS MatExpr max(double s, const Mat& a);
+
+/** @brief Calculates an absolute value of each matrix element.
+
+abs is a meta-function that is expanded to one of absdiff or convertScaleAbs forms:
+- C = abs(A-B) is equivalent to `absdiff(A, B, C)`
+- C = abs(A) is equivalent to `absdiff(A, Scalar::all(0), C)`
+- C = `Mat_<Vec<uchar,n> >(abs(A*alpha + beta))` is equivalent to `convertScaleAbs(A, C, alpha,
+beta)`
+
+The output matrix has the same size and the same type as the input one except for the last case,
+where C is depth=CV_8U .
+@param m matrix.
+@sa @ref MatrixExpressions, absdiff, convertScaleAbs
+ */
+CV_EXPORTS MatExpr abs(const Mat& m);
+/** @overload
+@param e matrix expression.
+*/
+CV_EXPORTS MatExpr abs(const MatExpr& e);
+//! @} relates cv::MatExpr
+
+} // cv
+
+#include "opencv2/core/mat.inl.hpp"
+
+#endif // __OPENCV_CORE_MAT_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp
new file mode 100644
index 0000000..5410340
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/mat.inl.hpp
@@ -0,0 +1,3668 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_MATRIX_OPERATIONS_HPP__
+#define __OPENCV_CORE_MATRIX_OPERATIONS_HPP__
+
+#ifndef __cplusplus
+#  error mat.inl.hpp header must be compiled as C++
+#endif
+
+namespace cv
+{
+
+//! @cond IGNORED
+
+//////////////////////// Input/Output Arrays ////////////////////////
+
+inline void _InputArray::init(int _flags, const void* _obj)
+{ flags = _flags; obj = (void*)_obj; }
+
+inline void _InputArray::init(int _flags, const void* _obj, Size _sz)
+{ flags = _flags; obj = (void*)_obj; sz = _sz; }
+
+inline void* _InputArray::getObj() const { return obj; }
+inline int _InputArray::getFlags() const { return flags; }
+inline Size _InputArray::getSz() const { return sz; }
+
+inline _InputArray::_InputArray() { init(NONE, 0); }
+inline _InputArray::_InputArray(int _flags, void* _obj) { init(_flags, _obj); }
+inline _InputArray::_InputArray(const Mat& m) { init(MAT+ACCESS_READ, &m); }
+inline _InputArray::_InputArray(const std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_READ, &vec); }
+inline _InputArray::_InputArray(const UMat& m) { init(UMAT+ACCESS_READ, &m); }
+inline _InputArray::_InputArray(const std::vector<UMat>& vec) { init(STD_VECTOR_UMAT+ACCESS_READ, &vec); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + STD_VECTOR + DataType<_Tp>::type + ACCESS_READ, &vec); }
+
+inline
+_InputArray::_InputArray(const std::vector<bool>& vec)
+{ init(FIXED_TYPE + STD_BOOL_VECTOR + DataType<bool>::type + ACCESS_READ, &vec); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_READ, &vec); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_READ, &vec); }
+
+template<typename _Tp, int m, int n> inline
+_InputArray::_InputArray(const Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_READ, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const _Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_READ, vec, Size(n, 1)); }
+
+template<typename _Tp> inline
+_InputArray::_InputArray(const Mat_<_Tp>& m)
+{ init(FIXED_TYPE + MAT + DataType<_Tp>::type + ACCESS_READ, &m); }
+
+inline _InputArray::_InputArray(const double& val)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + CV_64F + ACCESS_READ, &val, Size(1,1)); }
+
+inline _InputArray::_InputArray(const MatExpr& expr)
+{ init(FIXED_TYPE + FIXED_SIZE + EXPR + ACCESS_READ, &expr); }
+
+inline _InputArray::_InputArray(const cuda::GpuMat& d_mat)
+{ init(CUDA_GPU_MAT + ACCESS_READ, &d_mat); }
+
+inline _InputArray::_InputArray(const std::vector<cuda::GpuMat>& d_mat)
+{	init(STD_VECTOR_CUDA_GPU_MAT + ACCESS_READ, &d_mat);}
+
+inline _InputArray::_InputArray(const ogl::Buffer& buf)
+{ init(OPENGL_BUFFER + ACCESS_READ, &buf); }
+
+inline _InputArray::_InputArray(const cuda::HostMem& cuda_mem)
+{ init(CUDA_HOST_MEM + ACCESS_READ, &cuda_mem); }
+
+inline _InputArray::~_InputArray() {}
+
+inline Mat _InputArray::getMat(int i) const
+{
+    if( kind() == MAT && i < 0 )
+        return *(const Mat*)obj;
+    return getMat_(i);
+}
+
+inline bool _InputArray::isMat() const { return kind() == _InputArray::MAT; }
+inline bool _InputArray::isUMat() const  { return kind() == _InputArray::UMAT; }
+inline bool _InputArray::isMatVector() const { return kind() == _InputArray::STD_VECTOR_MAT; }
+inline bool _InputArray::isUMatVector() const  { return kind() == _InputArray::STD_VECTOR_UMAT; }
+inline bool _InputArray::isMatx() const { return kind() == _InputArray::MATX; }
+inline bool _InputArray::isVector() const { return kind() == _InputArray::STD_VECTOR || kind() == _InputArray::STD_BOOL_VECTOR; }
+inline bool _InputArray::isGpuMatVector() const { return kind() == _InputArray::STD_VECTOR_CUDA_GPU_MAT; }
+
+////////////////////////////////////////////////////////////////////////////////////////
+
+inline _OutputArray::_OutputArray() { init(ACCESS_WRITE, 0); }
+inline _OutputArray::_OutputArray(int _flags, void* _obj) { init(_flags|ACCESS_WRITE, _obj); }
+inline _OutputArray::_OutputArray(Mat& m) { init(MAT+ACCESS_WRITE, &m); }
+inline _OutputArray::_OutputArray(std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_WRITE, &vec); }
+inline _OutputArray::_OutputArray(UMat& m) { init(UMAT+ACCESS_WRITE, &m); }
+inline _OutputArray::_OutputArray(std::vector<UMat>& vec) { init(STD_VECTOR_UMAT+ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + STD_VECTOR + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+inline
+_OutputArray::_OutputArray(std::vector<bool>&)
+{ CV_Error(Error::StsUnsupportedFormat, "std::vector<bool> cannot be an output array\n"); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(Mat_<_Tp>& m)
+{ init(FIXED_TYPE + MAT + DataType<_Tp>::type + ACCESS_WRITE, &m); }
+
+template<typename _Tp, int m, int n> inline
+_OutputArray::_OutputArray(Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_WRITE, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(_Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_WRITE, vec, Size(n, 1)); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_WRITE, &vec); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const Mat_<_Tp>& m)
+{ init(FIXED_TYPE + FIXED_SIZE + MAT + DataType<_Tp>::type + ACCESS_WRITE, &m); }
+
+template<typename _Tp, int m, int n> inline
+_OutputArray::_OutputArray(const Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_WRITE, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_OutputArray::_OutputArray(const _Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_WRITE, vec, Size(n, 1)); }
+
+inline _OutputArray::_OutputArray(cuda::GpuMat& d_mat)
+{ init(CUDA_GPU_MAT + ACCESS_WRITE, &d_mat); }
+
+inline _OutputArray::_OutputArray(std::vector<cuda::GpuMat>& d_mat)
+{	init(STD_VECTOR_CUDA_GPU_MAT + ACCESS_WRITE, &d_mat);}
+
+inline _OutputArray::_OutputArray(ogl::Buffer& buf)
+{ init(OPENGL_BUFFER + ACCESS_WRITE, &buf); }
+
+inline _OutputArray::_OutputArray(cuda::HostMem& cuda_mem)
+{ init(CUDA_HOST_MEM + ACCESS_WRITE, &cuda_mem); }
+
+inline _OutputArray::_OutputArray(const Mat& m)
+{ init(FIXED_TYPE + FIXED_SIZE + MAT + ACCESS_WRITE, &m); }
+
+inline _OutputArray::_OutputArray(const std::vector<Mat>& vec)
+{ init(FIXED_SIZE + STD_VECTOR_MAT + ACCESS_WRITE, &vec); }
+
+inline _OutputArray::_OutputArray(const UMat& m)
+{ init(FIXED_TYPE + FIXED_SIZE + UMAT + ACCESS_WRITE, &m); }
+
+inline _OutputArray::_OutputArray(const std::vector<UMat>& vec)
+{ init(FIXED_SIZE + STD_VECTOR_UMAT + ACCESS_WRITE, &vec); }
+
+inline _OutputArray::_OutputArray(const cuda::GpuMat& d_mat)
+{ init(FIXED_TYPE + FIXED_SIZE + CUDA_GPU_MAT + ACCESS_WRITE, &d_mat); }
+
+
+inline _OutputArray::_OutputArray(const ogl::Buffer& buf)
+{ init(FIXED_TYPE + FIXED_SIZE + OPENGL_BUFFER + ACCESS_WRITE, &buf); }
+
+inline _OutputArray::_OutputArray(const cuda::HostMem& cuda_mem)
+{ init(FIXED_TYPE + FIXED_SIZE + CUDA_HOST_MEM + ACCESS_WRITE, &cuda_mem); }
+
+///////////////////////////////////////////////////////////////////////////////////////////
+
+inline _InputOutputArray::_InputOutputArray() { init(ACCESS_RW, 0); }
+inline _InputOutputArray::_InputOutputArray(int _flags, void* _obj) { init(_flags|ACCESS_RW, _obj); }
+inline _InputOutputArray::_InputOutputArray(Mat& m) { init(MAT+ACCESS_RW, &m); }
+inline _InputOutputArray::_InputOutputArray(std::vector<Mat>& vec) { init(STD_VECTOR_MAT+ACCESS_RW, &vec); }
+inline _InputOutputArray::_InputOutputArray(UMat& m) { init(UMAT+ACCESS_RW, &m); }
+inline _InputOutputArray::_InputOutputArray(std::vector<UMat>& vec) { init(STD_VECTOR_UMAT+ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + STD_VECTOR + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+inline _InputOutputArray::_InputOutputArray(std::vector<bool>&)
+{ CV_Error(Error::StsUnsupportedFormat, "std::vector<bool> cannot be an input/output array\n"); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(Mat_<_Tp>& m)
+{ init(FIXED_TYPE + MAT + DataType<_Tp>::type + ACCESS_RW, &m); }
+
+template<typename _Tp, int m, int n> inline
+_InputOutputArray::_InputOutputArray(Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_RW, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(_Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_RW, vec, Size(n, 1)); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const std::vector<_Tp>& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const std::vector<std::vector<_Tp> >& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_VECTOR + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const std::vector<Mat_<_Tp> >& vec)
+{ init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_MAT + DataType<_Tp>::type + ACCESS_RW, &vec); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const Mat_<_Tp>& m)
+{ init(FIXED_TYPE + FIXED_SIZE + MAT + DataType<_Tp>::type + ACCESS_RW, &m); }
+
+template<typename _Tp, int m, int n> inline
+_InputOutputArray::_InputOutputArray(const Matx<_Tp, m, n>& mtx)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_RW, &mtx, Size(n, m)); }
+
+template<typename _Tp> inline
+_InputOutputArray::_InputOutputArray(const _Tp* vec, int n)
+{ init(FIXED_TYPE + FIXED_SIZE + MATX + DataType<_Tp>::type + ACCESS_RW, vec, Size(n, 1)); }
+
+inline _InputOutputArray::_InputOutputArray(cuda::GpuMat& d_mat)
+{ init(CUDA_GPU_MAT + ACCESS_RW, &d_mat); }
+
+inline _InputOutputArray::_InputOutputArray(ogl::Buffer& buf)
+{ init(OPENGL_BUFFER + ACCESS_RW, &buf); }
+
+inline _InputOutputArray::_InputOutputArray(cuda::HostMem& cuda_mem)
+{ init(CUDA_HOST_MEM + ACCESS_RW, &cuda_mem); }
+
+inline _InputOutputArray::_InputOutputArray(const Mat& m)
+{ init(FIXED_TYPE + FIXED_SIZE + MAT + ACCESS_RW, &m); }
+
+inline _InputOutputArray::_InputOutputArray(const std::vector<Mat>& vec)
+{ init(FIXED_SIZE + STD_VECTOR_MAT + ACCESS_RW, &vec); }
+
+inline _InputOutputArray::_InputOutputArray(const UMat& m)
+{ init(FIXED_TYPE + FIXED_SIZE + UMAT + ACCESS_RW, &m); }
+
+inline _InputOutputArray::_InputOutputArray(const std::vector<UMat>& vec)
+{ init(FIXED_SIZE + STD_VECTOR_UMAT + ACCESS_RW, &vec); }
+
+inline _InputOutputArray::_InputOutputArray(const cuda::GpuMat& d_mat)
+{ init(FIXED_TYPE + FIXED_SIZE + CUDA_GPU_MAT + ACCESS_RW, &d_mat); }
+inline _InputOutputArray::_InputOutputArray(const std::vector<cuda::GpuMat>& d_mat)
+{	init(FIXED_TYPE + FIXED_SIZE + STD_VECTOR_CUDA_GPU_MAT + ACCESS_RW, &d_mat);}
+
+inline _InputOutputArray::_InputOutputArray(const ogl::Buffer& buf)
+{ init(FIXED_TYPE + FIXED_SIZE + OPENGL_BUFFER + ACCESS_RW, &buf); }
+
+inline _InputOutputArray::_InputOutputArray(const cuda::HostMem& cuda_mem)
+{ init(FIXED_TYPE + FIXED_SIZE + CUDA_HOST_MEM + ACCESS_RW, &cuda_mem); }
+
+//////////////////////////////////////////// Mat //////////////////////////////////////////
+
+inline
+Mat::Mat()
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{}
+
+inline
+Mat::Mat(int _rows, int _cols, int _type)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_rows, _cols, _type);
+}
+
+inline
+Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_rows, _cols, _type);
+    *this = _s;
+}
+
+inline
+Mat::Mat(Size _sz, int _type)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create( _sz.height, _sz.width, _type );
+}
+
+inline
+Mat::Mat(Size _sz, int _type, const Scalar& _s)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_sz.height, _sz.width, _type);
+    *this = _s;
+}
+
+inline
+Mat::Mat(int _dims, const int* _sz, int _type)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_dims, _sz, _type);
+}
+
+inline
+Mat::Mat(int _dims, const int* _sz, int _type, const Scalar& _s)
+    : flags(MAGIC_VAL), dims(0), rows(0), cols(0), data(0), datastart(0), dataend(0),
+      datalimit(0), allocator(0), u(0), size(&rows)
+{
+    create(_dims, _sz, _type);
+    *this = _s;
+}
+
+inline
+Mat::Mat(const Mat& m)
+    : flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), data(m.data),
+      datastart(m.datastart), dataend(m.dataend), datalimit(m.datalimit), allocator(m.allocator),
+      u(m.u), size(&rows)
+{
+    if( u )
+        CV_XADD(&u->refcount, 1);
+    if( m.dims <= 2 )
+    {
+        step[0] = m.step[0]; step[1] = m.step[1];
+    }
+    else
+    {
+        dims = 0;
+        copySize(m);
+    }
+}
+
+inline
+Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
+    : flags(MAGIC_VAL + (_type & TYPE_MASK)), dims(2), rows(_rows), cols(_cols),
+      data((uchar*)_data), datastart((uchar*)_data), dataend(0), datalimit(0),
+      allocator(0), u(0), size(&rows)
+{
+    CV_Assert(total() == 0 || data != NULL);
+
+    size_t esz = CV_ELEM_SIZE(_type), esz1 = CV_ELEM_SIZE1(_type);
+    size_t minstep = cols * esz;
+    if( _step == AUTO_STEP )
+    {
+        _step = minstep;
+        flags |= CONTINUOUS_FLAG;
+    }
+    else
+    {
+        if( rows == 1 ) _step = minstep;
+        CV_DbgAssert( _step >= minstep );
+
+        if (_step % esz1 != 0)
+        {
+            CV_Error(Error::BadStep, "Step must be a multiple of esz1");
+        }
+
+        flags |= _step == minstep ? CONTINUOUS_FLAG : 0;
+    }
+    step[0] = _step;
+    step[1] = esz;
+    datalimit = datastart + _step * rows;
+    dataend = datalimit - _step + minstep;
+}
+
+inline
+Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
+    : flags(MAGIC_VAL + (_type & TYPE_MASK)), dims(2), rows(_sz.height), cols(_sz.width),
+      data((uchar*)_data), datastart((uchar*)_data), dataend(0), datalimit(0),
+      allocator(0), u(0), size(&rows)
+{
+    CV_Assert(total() == 0 || data != NULL);
+
+    size_t esz = CV_ELEM_SIZE(_type), esz1 = CV_ELEM_SIZE1(_type);
+    size_t minstep = cols*esz;
+    if( _step == AUTO_STEP )
+    {
+        _step = minstep;
+        flags |= CONTINUOUS_FLAG;
+    }
+    else
+    {
+        if( rows == 1 ) _step = minstep;
+        CV_DbgAssert( _step >= minstep );
+
+        if (_step % esz1 != 0)
+        {
+            CV_Error(Error::BadStep, "Step must be a multiple of esz1");
+        }
+
+        flags |= _step == minstep ? CONTINUOUS_FLAG : 0;
+    }
+    step[0] = _step;
+    step[1] = esz;
+    datalimit = datastart + _step*rows;
+    dataend = datalimit - _step + minstep;
+}
+
+template<typename _Tp> inline
+Mat::Mat(const std::vector<_Tp>& vec, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows((int)vec.size()),
+      cols(1), data(0), datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if(vec.empty())
+        return;
+    if( !copyData )
+    {
+        step[0] = step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)&vec[0];
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+        Mat((int)vec.size(), 1, DataType<_Tp>::type, (uchar*)&vec[0]).copyTo(*this);
+}
+
+template<typename _Tp, int n> inline
+Mat::Mat(const Vec<_Tp, n>& vec, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows(n), cols(1), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if( !copyData )
+    {
+        step[0] = step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)vec.val;
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+        Mat(n, 1, DataType<_Tp>::type, (void*)vec.val).copyTo(*this);
+}
+
+
+template<typename _Tp, int m, int n> inline
+Mat::Mat(const Matx<_Tp,m,n>& M, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows(m), cols(n), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if( !copyData )
+    {
+        step[0] = cols * sizeof(_Tp);
+        step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)M.val;
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+        Mat(m, n, DataType<_Tp>::type, (uchar*)M.val).copyTo(*this);
+}
+
+template<typename _Tp> inline
+Mat::Mat(const Point_<_Tp>& pt, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows(2), cols(1), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if( !copyData )
+    {
+        step[0] = step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)&pt.x;
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+    {
+        create(2, 1, DataType<_Tp>::type);
+        ((_Tp*)data)[0] = pt.x;
+        ((_Tp*)data)[1] = pt.y;
+    }
+}
+
+template<typename _Tp> inline
+Mat::Mat(const Point3_<_Tp>& pt, bool copyData)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows(3), cols(1), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    if( !copyData )
+    {
+        step[0] = step[1] = sizeof(_Tp);
+        datastart = data = (uchar*)&pt.x;
+        datalimit = dataend = datastart + rows * step[0];
+    }
+    else
+    {
+        create(3, 1, DataType<_Tp>::type);
+        ((_Tp*)data)[0] = pt.x;
+        ((_Tp*)data)[1] = pt.y;
+        ((_Tp*)data)[2] = pt.z;
+    }
+}
+
+template<typename _Tp> inline
+Mat::Mat(const MatCommaInitializer_<_Tp>& commaInitializer)
+    : flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(0), rows(0), cols(0), data(0),
+      datastart(0), dataend(0), allocator(0), u(0), size(&rows)
+{
+    *this = commaInitializer.operator Mat_<_Tp>();
+}
+
+inline
+Mat::~Mat()
+{
+    release();
+    if( step.p != step.buf )
+        fastFree(step.p);
+}
+
+inline
+Mat& Mat::operator = (const Mat& m)
+{
+    if( this != &m )
+    {
+        if( m.u )
+            CV_XADD(&m.u->refcount, 1);
+        release();
+        flags = m.flags;
+        if( dims <= 2 && m.dims <= 2 )
+        {
+            dims = m.dims;
+            rows = m.rows;
+            cols = m.cols;
+            step[0] = m.step[0];
+            step[1] = m.step[1];
+        }
+        else
+            copySize(m);
+        data = m.data;
+        datastart = m.datastart;
+        dataend = m.dataend;
+        datalimit = m.datalimit;
+        allocator = m.allocator;
+        u = m.u;
+    }
+    return *this;
+}
+
+inline
+Mat Mat::row(int y) const
+{
+    return Mat(*this, Range(y, y + 1), Range::all());
+}
+
+inline
+Mat Mat::col(int x) const
+{
+    return Mat(*this, Range::all(), Range(x, x + 1));
+}
+
+inline
+Mat Mat::rowRange(int startrow, int endrow) const
+{
+    return Mat(*this, Range(startrow, endrow), Range::all());
+}
+
+inline
+Mat Mat::rowRange(const Range& r) const
+{
+    return Mat(*this, r, Range::all());
+}
+
+inline
+Mat Mat::colRange(int startcol, int endcol) const
+{
+    return Mat(*this, Range::all(), Range(startcol, endcol));
+}
+
+inline
+Mat Mat::colRange(const Range& r) const
+{
+    return Mat(*this, Range::all(), r);
+}
+
+inline
+Mat Mat::clone() const
+{
+    Mat m;
+    copyTo(m);
+    return m;
+}
+
+inline
+void Mat::assignTo( Mat& m, int _type ) const
+{
+    if( _type < 0 )
+        m = *this;
+    else
+        convertTo(m, _type);
+}
+
+inline
+void Mat::create(int _rows, int _cols, int _type)
+{
+    _type &= TYPE_MASK;
+    if( dims <= 2 && rows == _rows && cols == _cols && type() == _type && data )
+        return;
+    int sz[] = {_rows, _cols};
+    create(2, sz, _type);
+}
+
+inline
+void Mat::create(Size _sz, int _type)
+{
+    create(_sz.height, _sz.width, _type);
+}
+
+inline
+void Mat::addref()
+{
+    if( u )
+        CV_XADD(&u->refcount, 1);
+}
+
+inline void Mat::release()
+{
+    if( u && CV_XADD(&u->refcount, -1) == 1 )
+        deallocate();
+    u = NULL;
+    datastart = dataend = datalimit = data = 0;
+    for(int i = 0; i < dims; i++)
+        size.p[i] = 0;
+}
+
+inline
+Mat Mat::operator()( Range _rowRange, Range _colRange ) const
+{
+    return Mat(*this, _rowRange, _colRange);
+}
+
+inline
+Mat Mat::operator()( const Rect& roi ) const
+{
+    return Mat(*this, roi);
+}
+
+inline
+Mat Mat::operator()(const Range* ranges) const
+{
+    return Mat(*this, ranges);
+}
+
+inline
+bool Mat::isContinuous() const
+{
+    return (flags & CONTINUOUS_FLAG) != 0;
+}
+
+inline
+bool Mat::isSubmatrix() const
+{
+    return (flags & SUBMATRIX_FLAG) != 0;
+}
+
+inline
+size_t Mat::elemSize() const
+{
+    return dims > 0 ? step.p[dims - 1] : 0;
+}
+
+inline
+size_t Mat::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int Mat::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int Mat::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int Mat::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+size_t Mat::step1(int i) const
+{
+    return step.p[i] / elemSize1();
+}
+
+inline
+bool Mat::empty() const
+{
+    return data == 0 || total() == 0;
+}
+
+inline
+size_t Mat::total() const
+{
+    if( dims <= 2 )
+        return (size_t)rows * cols;
+    size_t p = 1;
+    for( int i = 0; i < dims; i++ )
+        p *= size[i];
+    return p;
+}
+
+inline
+uchar* Mat::ptr(int y)
+{
+    CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
+    return data + step.p[0] * y;
+}
+
+inline
+const uchar* Mat::ptr(int y) const
+{
+    CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
+    return data + step.p[0] * y;
+}
+
+template<typename _Tp> inline
+_Tp* Mat::ptr(int y)
+{
+    CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
+    return (_Tp*)(data + step.p[0] * y);
+}
+
+template<typename _Tp> inline
+const _Tp* Mat::ptr(int y) const
+{
+    CV_DbgAssert( y == 0 || (data && dims >= 1 && data && (unsigned)y < (unsigned)size.p[0]) );
+    return (const _Tp*)(data + step.p[0] * y);
+}
+
+inline
+uchar* Mat::ptr(int i0, int i1)
+{
+    CV_DbgAssert(dims >= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    return data + i0 * step.p[0] + i1 * step.p[1];
+}
+
+inline
+const uchar* Mat::ptr(int i0, int i1) const
+{
+    CV_DbgAssert(dims >= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    return data + i0 * step.p[0] + i1 * step.p[1];
+}
+
+template<typename _Tp> inline
+_Tp* Mat::ptr(int i0, int i1)
+{
+    CV_DbgAssert(dims >= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    return (_Tp*)(data + i0 * step.p[0] + i1 * step.p[1]);
+}
+
+template<typename _Tp> inline
+const _Tp* Mat::ptr(int i0, int i1) const
+{
+    CV_DbgAssert(dims >= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    return (const _Tp*)(data + i0 * step.p[0] + i1 * step.p[1]);
+}
+
+inline
+uchar* Mat::ptr(int i0, int i1, int i2)
+{
+    CV_DbgAssert(dims >= 3);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
+    return data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2];
+}
+
+inline
+const uchar* Mat::ptr(int i0, int i1, int i2) const
+{
+    CV_DbgAssert(dims >= 3);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
+    return data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2];
+}
+
+template<typename _Tp> inline
+_Tp* Mat::ptr(int i0, int i1, int i2)
+{
+    CV_DbgAssert(dims >= 3);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
+    return (_Tp*)(data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]);
+}
+
+template<typename _Tp> inline
+const _Tp* Mat::ptr(int i0, int i1, int i2) const
+{
+    CV_DbgAssert(dims >= 3);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert((unsigned)i2 < (unsigned)size.p[2]);
+    return (const _Tp*)(data + i0 * step.p[0] + i1 * step.p[1] + i2 * step.p[2]);
+}
+
+inline
+uchar* Mat::ptr(const int* idx)
+{
+    int i, d = dims;
+    uchar* p = data;
+    CV_DbgAssert( d >= 1 && p );
+    for( i = 0; i < d; i++ )
+    {
+        CV_DbgAssert( (unsigned)idx[i] < (unsigned)size.p[i] );
+        p += idx[i] * step.p[i];
+    }
+    return p;
+}
+
+inline
+const uchar* Mat::ptr(const int* idx) const
+{
+    int i, d = dims;
+    uchar* p = data;
+    CV_DbgAssert( d >= 1 && p );
+    for( i = 0; i < d; i++ )
+    {
+        CV_DbgAssert( (unsigned)idx[i] < (unsigned)size.p[i] );
+        p += idx[i] * step.p[i];
+    }
+    return p;
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(int i0, int i1)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
+    CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
+    return ((_Tp*)(data + step.p[0] * i0))[i1];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(int i0, int i1) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
+    CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
+    return ((const _Tp*)(data + step.p[0] * i0))[i1];
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(Point pt)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
+    CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
+    return ((_Tp*)(data + step.p[0] * pt.y))[pt.x];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(Point pt) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()));
+    CV_DbgAssert(CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
+    return ((const _Tp*)(data + step.p[0] * pt.y))[pt.x];
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(int i0)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)(size.p[0] * size.p[1]));
+    CV_DbgAssert(elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type));
+    if( isContinuous() || size.p[0] == 1 )
+        return ((_Tp*)data)[i0];
+    if( size.p[1] == 1 )
+        return *(_Tp*)(data + step.p[0] * i0);
+    int i = i0 / cols, j = i0 - i * cols;
+    return ((_Tp*)(data + step.p[0] * i))[j];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(int i0) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)(size.p[0] * size.p[1]));
+    CV_DbgAssert(elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type));
+    if( isContinuous() || size.p[0] == 1 )
+        return ((const _Tp*)data)[i0];
+    if( size.p[1] == 1 )
+        return *(const _Tp*)(data + step.p[0] * i0);
+    int i = i0 / cols, j = i0 - i * cols;
+    return ((const _Tp*)(data + step.p[0] * i))[j];
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(int i0, int i1, int i2)
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(_Tp*)ptr(i0, i1, i2);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(int i0, int i1, int i2) const
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(const _Tp*)ptr(i0, i1, i2);
+}
+
+template<typename _Tp> inline
+_Tp& Mat::at(const int* idx)
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(_Tp*)ptr(idx);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat::at(const int* idx) const
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(const _Tp*)ptr(idx);
+}
+
+template<typename _Tp, int n> inline
+_Tp& Mat::at(const Vec<int, n>& idx)
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(_Tp*)ptr(idx.val);
+}
+
+template<typename _Tp, int n> inline
+const _Tp& Mat::at(const Vec<int, n>& idx) const
+{
+    CV_DbgAssert( elemSize() == CV_ELEM_SIZE(DataType<_Tp>::type) );
+    return *(const _Tp*)ptr(idx.val);
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> Mat::begin() const
+{
+    CV_DbgAssert( elemSize() == sizeof(_Tp) );
+    return MatConstIterator_<_Tp>((const Mat_<_Tp>*)this);
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> Mat::end() const
+{
+    CV_DbgAssert( elemSize() == sizeof(_Tp) );
+    MatConstIterator_<_Tp> it((const Mat_<_Tp>*)this);
+    it += total();
+    return it;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> Mat::begin()
+{
+    CV_DbgAssert( elemSize() == sizeof(_Tp) );
+    return MatIterator_<_Tp>((Mat_<_Tp>*)this);
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> Mat::end()
+{
+    CV_DbgAssert( elemSize() == sizeof(_Tp) );
+    MatIterator_<_Tp> it((Mat_<_Tp>*)this);
+    it += total();
+    return it;
+}
+
+template<typename _Tp, typename Functor> inline
+void Mat::forEach(const Functor& operation) {
+    this->forEach_impl<_Tp>(operation);
+}
+
+template<typename _Tp, typename Functor> inline
+void Mat::forEach(const Functor& operation) const {
+    // call as not const
+    (const_cast<Mat*>(this))->forEach<const _Tp>(operation);
+}
+
+template<typename _Tp> inline
+Mat::operator std::vector<_Tp>() const
+{
+    std::vector<_Tp> v;
+    copyTo(v);
+    return v;
+}
+
+template<typename _Tp, int n> inline
+Mat::operator Vec<_Tp, n>() const
+{
+    CV_Assert( data && dims <= 2 && (rows == 1 || cols == 1) &&
+               rows + cols - 1 == n && channels() == 1 );
+
+    if( isContinuous() && type() == DataType<_Tp>::type )
+        return Vec<_Tp, n>((_Tp*)data);
+    Vec<_Tp, n> v;
+    Mat tmp(rows, cols, DataType<_Tp>::type, v.val);
+    convertTo(tmp, tmp.type());
+    return v;
+}
+
+template<typename _Tp, int m, int n> inline
+Mat::operator Matx<_Tp, m, n>() const
+{
+    CV_Assert( data && dims <= 2 && rows == m && cols == n && channels() == 1 );
+
+    if( isContinuous() && type() == DataType<_Tp>::type )
+        return Matx<_Tp, m, n>((_Tp*)data);
+    Matx<_Tp, m, n> mtx;
+    Mat tmp(rows, cols, DataType<_Tp>::type, mtx.val);
+    convertTo(tmp, tmp.type());
+    return mtx;
+}
+
+template<typename _Tp> inline
+void Mat::push_back(const _Tp& elem)
+{
+    if( !data )
+    {
+        *this = Mat(1, 1, DataType<_Tp>::type, (void*)&elem).clone();
+        return;
+    }
+    CV_Assert(DataType<_Tp>::type == type() && cols == 1
+              /* && dims == 2 (cols == 1 implies dims == 2) */);
+    const uchar* tmp = dataend + step[0];
+    if( !isSubmatrix() && isContinuous() && tmp <= datalimit )
+    {
+        *(_Tp*)(data + (size.p[0]++) * step.p[0]) = elem;
+        dataend = tmp;
+    }
+    else
+        push_back_(&elem);
+}
+
+template<typename _Tp> inline
+void Mat::push_back(const Mat_<_Tp>& m)
+{
+    push_back((const Mat&)m);
+}
+
+template<> inline
+void Mat::push_back(const MatExpr& expr)
+{
+    push_back(static_cast<Mat>(expr));
+}
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+
+inline
+Mat::Mat(Mat&& m)
+    : flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), data(m.data),
+      datastart(m.datastart), dataend(m.dataend), datalimit(m.datalimit), allocator(m.allocator),
+      u(m.u), size(&rows)
+{
+    if (m.dims <= 2)  // move new step/size info
+    {
+        step[0] = m.step[0];
+        step[1] = m.step[1];
+    }
+    else
+    {
+        CV_DbgAssert(m.step.p != m.step.buf);
+        step.p = m.step.p;
+        size.p = m.size.p;
+        m.step.p = m.step.buf;
+        m.size.p = &m.rows;
+    }
+    m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0;
+    m.data = NULL; m.datastart = NULL; m.dataend = NULL; m.datalimit = NULL;
+    m.allocator = NULL;
+    m.u = NULL;
+}
+
+inline
+Mat& Mat::operator = (Mat&& m)
+{
+    release();
+    flags = m.flags; dims = m.dims; rows = m.rows; cols = m.cols; data = m.data;
+    datastart = m.datastart; dataend = m.dataend; datalimit = m.datalimit; allocator = m.allocator;
+    u = m.u;
+    if (step.p != step.buf) // release self step/size
+    {
+        fastFree(step.p);
+        step.p = step.buf;
+        size.p = &rows;
+    }
+    if (m.dims <= 2) // move new step/size info
+    {
+        step[0] = m.step[0];
+        step[1] = m.step[1];
+    }
+    else
+    {
+        CV_DbgAssert(m.step.p != m.step.buf);
+        step.p = m.step.p;
+        size.p = m.size.p;
+        m.step.p = m.step.buf;
+        m.size.p = &m.rows;
+    }
+    m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0;
+    m.data = NULL; m.datastart = NULL; m.dataend = NULL; m.datalimit = NULL;
+    m.allocator = NULL;
+    m.u = NULL;
+    return *this;
+}
+
+#endif
+
+
+///////////////////////////// MatSize ////////////////////////////
+
+inline
+MatSize::MatSize(int* _p)
+    : p(_p) {}
+
+inline
+Size MatSize::operator()() const
+{
+    CV_DbgAssert(p[-1] <= 2);
+    return Size(p[1], p[0]);
+}
+
+inline
+const int& MatSize::operator[](int i) const
+{
+    return p[i];
+}
+
+inline
+int& MatSize::operator[](int i)
+{
+    return p[i];
+}
+
+inline
+MatSize::operator const int*() const
+{
+    return p;
+}
+
+inline
+bool MatSize::operator == (const MatSize& sz) const
+{
+    int d = p[-1];
+    int dsz = sz.p[-1];
+    if( d != dsz )
+        return false;
+    if( d == 2 )
+        return p[0] == sz.p[0] && p[1] == sz.p[1];
+
+    for( int i = 0; i < d; i++ )
+        if( p[i] != sz.p[i] )
+            return false;
+    return true;
+}
+
+inline
+bool MatSize::operator != (const MatSize& sz) const
+{
+    return !(*this == sz);
+}
+
+
+
+///////////////////////////// MatStep ////////////////////////////
+
+inline
+MatStep::MatStep()
+{
+    p = buf; p[0] = p[1] = 0;
+}
+
+inline
+MatStep::MatStep(size_t s)
+{
+    p = buf; p[0] = s; p[1] = 0;
+}
+
+inline
+const size_t& MatStep::operator[](int i) const
+{
+    return p[i];
+}
+
+inline
+size_t& MatStep::operator[](int i)
+{
+    return p[i];
+}
+
+inline MatStep::operator size_t() const
+{
+    CV_DbgAssert( p == buf );
+    return buf[0];
+}
+
+inline MatStep& MatStep::operator = (size_t s)
+{
+    CV_DbgAssert( p == buf );
+    buf[0] = s;
+    return *this;
+}
+
+
+
+////////////////////////////// Mat_<_Tp> ////////////////////////////
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_()
+    : Mat()
+{
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _rows, int _cols)
+    : Mat(_rows, _cols, DataType<_Tp>::type)
+{
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _rows, int _cols, const _Tp& value)
+    : Mat(_rows, _cols, DataType<_Tp>::type)
+{
+    *this = value;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(Size _sz)
+    : Mat(_sz.height, _sz.width, DataType<_Tp>::type)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(Size _sz, const _Tp& value)
+    : Mat(_sz.height, _sz.width, DataType<_Tp>::type)
+{
+    *this = value;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _dims, const int* _sz)
+    : Mat(_dims, _sz, DataType<_Tp>::type)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _dims, const int* _sz, const _Tp& _s)
+    : Mat(_dims, _sz, DataType<_Tp>::type, Scalar(_s))
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat_<_Tp>& m, const Range* ranges)
+    : Mat(m, ranges)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat& m)
+    : Mat()
+{
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+    *this = m;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat_& m)
+    : Mat(m)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(int _rows, int _cols, _Tp* _data, size_t steps)
+    : Mat(_rows, _cols, DataType<_Tp>::type, _data, steps)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat_& m, const Range& _rowRange, const Range& _colRange)
+    : Mat(m, _rowRange, _colRange)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Mat_& m, const Rect& roi)
+    : Mat(m, roi)
+{}
+
+template<typename _Tp> template<int n> inline
+Mat_<_Tp>::Mat_(const Vec<typename DataType<_Tp>::channel_type, n>& vec, bool copyData)
+    : Mat(n / DataType<_Tp>::channels, 1, DataType<_Tp>::type, (void*)&vec)
+{
+    CV_Assert(n%DataType<_Tp>::channels == 0);
+    if( copyData )
+        *this = clone();
+}
+
+template<typename _Tp> template<int m, int n> inline
+Mat_<_Tp>::Mat_(const Matx<typename DataType<_Tp>::channel_type, m, n>& M, bool copyData)
+    : Mat(m, n / DataType<_Tp>::channels, DataType<_Tp>::type, (void*)&M)
+{
+    CV_Assert(n % DataType<_Tp>::channels == 0);
+    if( copyData )
+        *this = clone();
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Point_<typename DataType<_Tp>::channel_type>& pt, bool copyData)
+    : Mat(2 / DataType<_Tp>::channels, 1, DataType<_Tp>::type, (void*)&pt)
+{
+    CV_Assert(2 % DataType<_Tp>::channels == 0);
+    if( copyData )
+        *this = clone();
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const Point3_<typename DataType<_Tp>::channel_type>& pt, bool copyData)
+    : Mat(3 / DataType<_Tp>::channels, 1, DataType<_Tp>::type, (void*)&pt)
+{
+    CV_Assert(3 % DataType<_Tp>::channels == 0);
+    if( copyData )
+        *this = clone();
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const MatCommaInitializer_<_Tp>& commaInitializer)
+    : Mat(commaInitializer)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const std::vector<_Tp>& vec, bool copyData)
+    : Mat(vec, copyData)
+{}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat& m)
+{
+    if( DataType<_Tp>::type == m.type() )
+    {
+        Mat::operator = (m);
+        return *this;
+    }
+    if( DataType<_Tp>::depth == m.depth() )
+    {
+        return (*this = m.reshape(DataType<_Tp>::channels, m.dims, 0));
+    }
+    CV_DbgAssert(DataType<_Tp>::channels == m.channels());
+    m.convertTo(*this, type());
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (const Mat_& m)
+{
+    Mat::operator=(m);
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (const _Tp& s)
+{
+    typedef typename DataType<_Tp>::vec_type VT;
+    Mat::operator=(Scalar((const VT&)s));
+    return *this;
+}
+
+template<typename _Tp> inline
+void Mat_<_Tp>::create(int _rows, int _cols)
+{
+    Mat::create(_rows, _cols, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+void Mat_<_Tp>::create(Size _sz)
+{
+    Mat::create(_sz, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+void Mat_<_Tp>::create(int _dims, const int* _sz)
+{
+    Mat::create(_dims, _sz, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::cross(const Mat_& m) const
+{
+    return Mat_<_Tp>(Mat::cross(m));
+}
+
+template<typename _Tp> template<typename T2> inline
+Mat_<_Tp>::operator Mat_<T2>() const
+{
+    return Mat_<T2>(*this);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::row(int y) const
+{
+    return Mat_(*this, Range(y, y+1), Range::all());
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::col(int x) const
+{
+    return Mat_(*this, Range::all(), Range(x, x+1));
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::diag(int d) const
+{
+    return Mat_(Mat::diag(d));
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::clone() const
+{
+    return Mat_(Mat::clone());
+}
+
+template<typename _Tp> inline
+size_t Mat_<_Tp>::elemSize() const
+{
+    CV_DbgAssert( Mat::elemSize() == sizeof(_Tp) );
+    return sizeof(_Tp);
+}
+
+template<typename _Tp> inline
+size_t Mat_<_Tp>::elemSize1() const
+{
+    CV_DbgAssert( Mat::elemSize1() == sizeof(_Tp) / DataType<_Tp>::channels );
+    return sizeof(_Tp) / DataType<_Tp>::channels;
+}
+
+template<typename _Tp> inline
+int Mat_<_Tp>::type() const
+{
+    CV_DbgAssert( Mat::type() == DataType<_Tp>::type );
+    return DataType<_Tp>::type;
+}
+
+template<typename _Tp> inline
+int Mat_<_Tp>::depth() const
+{
+    CV_DbgAssert( Mat::depth() == DataType<_Tp>::depth );
+    return DataType<_Tp>::depth;
+}
+
+template<typename _Tp> inline
+int Mat_<_Tp>::channels() const
+{
+    CV_DbgAssert( Mat::channels() == DataType<_Tp>::channels );
+    return DataType<_Tp>::channels;
+}
+
+template<typename _Tp> inline
+size_t Mat_<_Tp>::stepT(int i) const
+{
+    return step.p[i] / elemSize();
+}
+
+template<typename _Tp> inline
+size_t Mat_<_Tp>::step1(int i) const
+{
+    return step.p[i] / elemSize1();
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::adjustROI( int dtop, int dbottom, int dleft, int dright )
+{
+    return (Mat_<_Tp>&)(Mat::adjustROI(dtop, dbottom, dleft, dright));
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::operator()( const Range& _rowRange, const Range& _colRange ) const
+{
+    return Mat_<_Tp>(*this, _rowRange, _colRange);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::operator()( const Rect& roi ) const
+{
+    return Mat_<_Tp>(*this, roi);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp> Mat_<_Tp>::operator()( const Range* ranges ) const
+{
+    return Mat_<_Tp>(*this, ranges);
+}
+
+template<typename _Tp> inline
+_Tp* Mat_<_Tp>::operator [](int y)
+{
+    CV_DbgAssert( 0 <= y && y < rows );
+    return (_Tp*)(data + y*step.p[0]);
+}
+
+template<typename _Tp> inline
+const _Tp* Mat_<_Tp>::operator [](int y) const
+{
+    CV_DbgAssert( 0 <= y && y < rows );
+    return (const _Tp*)(data + y*step.p[0]);
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(int i0, int i1)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert(type() == DataType<_Tp>::type);
+    return ((_Tp*)(data + step.p[0] * i0))[i1];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(int i0, int i1) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)i0 < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)i1 < (unsigned)size.p[1]);
+    CV_DbgAssert(type() == DataType<_Tp>::type);
+    return ((const _Tp*)(data + step.p[0] * i0))[i1];
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(Point pt)
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)pt.x < (unsigned)size.p[1]);
+    CV_DbgAssert(type() == DataType<_Tp>::type);
+    return ((_Tp*)(data + step.p[0] * pt.y))[pt.x];
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(Point pt) const
+{
+    CV_DbgAssert(dims <= 2);
+    CV_DbgAssert(data);
+    CV_DbgAssert((unsigned)pt.y < (unsigned)size.p[0]);
+    CV_DbgAssert((unsigned)pt.x < (unsigned)size.p[1]);
+    CV_DbgAssert(type() == DataType<_Tp>::type);
+    return ((const _Tp*)(data + step.p[0] * pt.y))[pt.x];
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(const int* idx)
+{
+    return Mat::at<_Tp>(idx);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(const int* idx) const
+{
+    return Mat::at<_Tp>(idx);
+}
+
+template<typename _Tp> template<int n> inline
+_Tp& Mat_<_Tp>::operator ()(const Vec<int, n>& idx)
+{
+    return Mat::at<_Tp>(idx);
+}
+
+template<typename _Tp> template<int n> inline
+const _Tp& Mat_<_Tp>::operator ()(const Vec<int, n>& idx) const
+{
+    return Mat::at<_Tp>(idx);
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(int i0)
+{
+    return this->at<_Tp>(i0);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(int i0) const
+{
+    return this->at<_Tp>(i0);
+}
+
+template<typename _Tp> inline
+_Tp& Mat_<_Tp>::operator ()(int i0, int i1, int i2)
+{
+    return this->at<_Tp>(i0, i1, i2);
+}
+
+template<typename _Tp> inline
+const _Tp& Mat_<_Tp>::operator ()(int i0, int i1, int i2) const
+{
+    return this->at<_Tp>(i0, i1, i2);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::operator std::vector<_Tp>() const
+{
+    std::vector<_Tp> v;
+    copyTo(v);
+    return v;
+}
+
+template<typename _Tp> template<int n> inline
+Mat_<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const
+{
+    CV_Assert(n % DataType<_Tp>::channels == 0);
+
+#if defined _MSC_VER
+    const Mat* pMat = (const Mat*)this; // workaround for MSVS <= 2012 compiler bugs (but GCC 4.6 dislikes this workaround)
+    return pMat->operator Vec<typename DataType<_Tp>::channel_type, n>();
+#else
+    return this->Mat::operator Vec<typename DataType<_Tp>::channel_type, n>();
+#endif
+}
+
+template<typename _Tp> template<int m, int n> inline
+Mat_<_Tp>::operator Matx<typename DataType<_Tp>::channel_type, m, n>() const
+{
+    CV_Assert(n % DataType<_Tp>::channels == 0);
+
+#if defined _MSC_VER
+    const Mat* pMat = (const Mat*)this; // workaround for MSVS <= 2012 compiler bugs (but GCC 4.6 dislikes this workaround)
+    Matx<typename DataType<_Tp>::channel_type, m, n> res = pMat->operator Matx<typename DataType<_Tp>::channel_type, m, n>();
+    return res;
+#else
+    Matx<typename DataType<_Tp>::channel_type, m, n> res = this->Mat::operator Matx<typename DataType<_Tp>::channel_type, m, n>();
+    return res;
+#endif
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> Mat_<_Tp>::begin() const
+{
+    return Mat::begin<_Tp>();
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> Mat_<_Tp>::end() const
+{
+    return Mat::end<_Tp>();
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> Mat_<_Tp>::begin()
+{
+    return Mat::begin<_Tp>();
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> Mat_<_Tp>::end()
+{
+    return Mat::end<_Tp>();
+}
+
+template<typename _Tp> template<typename Functor> inline
+void Mat_<_Tp>::forEach(const Functor& operation) {
+    Mat::forEach<_Tp, Functor>(operation);
+}
+
+template<typename _Tp> template<typename Functor> inline
+void Mat_<_Tp>::forEach(const Functor& operation) const {
+    Mat::forEach<_Tp, Functor>(operation);
+}
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(Mat_&& m)
+    : Mat(m)
+{
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (Mat_&& m)
+{
+    Mat::operator = (m);
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(Mat&& m)
+    : Mat()
+{
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+    *this = m;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (Mat&& m)
+{
+    if( DataType<_Tp>::type == m.type() )
+    {
+        Mat::operator = ((Mat&&)m);
+        return *this;
+    }
+    if( DataType<_Tp>::depth == m.depth() )
+    {
+        Mat::operator = ((Mat&&)m.reshape(DataType<_Tp>::channels, m.dims, 0));
+        return *this;
+    }
+    CV_DbgAssert(DataType<_Tp>::channels == m.channels());
+    m.convertTo(*this, type());
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(MatExpr&& e)
+    : Mat()
+{
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+    *this = Mat(e);
+}
+
+#endif
+
+///////////////////////////// SparseMat /////////////////////////////
+
+inline
+SparseMat::SparseMat()
+    : flags(MAGIC_VAL), hdr(0)
+{}
+
+inline
+SparseMat::SparseMat(int _dims, const int* _sizes, int _type)
+    : flags(MAGIC_VAL), hdr(0)
+{
+    create(_dims, _sizes, _type);
+}
+
+inline
+SparseMat::SparseMat(const SparseMat& m)
+    : flags(m.flags), hdr(m.hdr)
+{
+    addref();
+}
+
+inline
+SparseMat::~SparseMat()
+{
+    release();
+}
+
+inline
+SparseMat& SparseMat::operator = (const SparseMat& m)
+{
+    if( this != &m )
+    {
+        if( m.hdr )
+            CV_XADD(&m.hdr->refcount, 1);
+        release();
+        flags = m.flags;
+        hdr = m.hdr;
+    }
+    return *this;
+}
+
+inline
+SparseMat& SparseMat::operator = (const Mat& m)
+{
+    return (*this = SparseMat(m));
+}
+
+inline
+SparseMat SparseMat::clone() const
+{
+    SparseMat temp;
+    this->copyTo(temp);
+    return temp;
+}
+
+inline
+void SparseMat::assignTo( SparseMat& m, int _type ) const
+{
+    if( _type < 0 )
+        m = *this;
+    else
+        convertTo(m, _type);
+}
+
+inline
+void SparseMat::addref()
+{
+    if( hdr )
+        CV_XADD(&hdr->refcount, 1);
+}
+
+inline
+void SparseMat::release()
+{
+    if( hdr && CV_XADD(&hdr->refcount, -1) == 1 )
+        delete hdr;
+    hdr = 0;
+}
+
+inline
+size_t SparseMat::elemSize() const
+{
+    return CV_ELEM_SIZE(flags);
+}
+
+inline
+size_t SparseMat::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int SparseMat::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int SparseMat::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int SparseMat::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+const int* SparseMat::size() const
+{
+    return hdr ? hdr->size : 0;
+}
+
+inline
+int SparseMat::size(int i) const
+{
+    if( hdr )
+    {
+        CV_DbgAssert((unsigned)i < (unsigned)hdr->dims);
+        return hdr->size[i];
+    }
+    return 0;
+}
+
+inline
+int SparseMat::dims() const
+{
+    return hdr ? hdr->dims : 0;
+}
+
+inline
+size_t SparseMat::nzcount() const
+{
+    return hdr ? hdr->nodeCount : 0;
+}
+
+inline
+size_t SparseMat::hash(int i0) const
+{
+    return (size_t)i0;
+}
+
+inline
+size_t SparseMat::hash(int i0, int i1) const
+{
+    return (size_t)(unsigned)i0 * HASH_SCALE + (unsigned)i1;
+}
+
+inline
+size_t SparseMat::hash(int i0, int i1, int i2) const
+{
+    return ((size_t)(unsigned)i0 * HASH_SCALE + (unsigned)i1) * HASH_SCALE + (unsigned)i2;
+}
+
+inline
+size_t SparseMat::hash(const int* idx) const
+{
+    size_t h = (unsigned)idx[0];
+    if( !hdr )
+        return 0;
+    int d = hdr->dims;
+    for(int i = 1; i < d; i++ )
+        h = h * HASH_SCALE + (unsigned)idx[i];
+    return h;
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::ref(int i0, size_t* hashval)
+{
+    return *(_Tp*)((SparseMat*)this)->ptr(i0, true, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::ref(int i0, int i1, size_t* hashval)
+{
+    return *(_Tp*)((SparseMat*)this)->ptr(i0, i1, true, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::ref(int i0, int i1, int i2, size_t* hashval)
+{
+    return *(_Tp*)((SparseMat*)this)->ptr(i0, i1, i2, true, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::ref(const int* idx, size_t* hashval)
+{
+    return *(_Tp*)((SparseMat*)this)->ptr(idx, true, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat::value(int i0, size_t* hashval) const
+{
+    const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, false, hashval);
+    return p ? *p : _Tp();
+}
+
+template<typename _Tp> inline
+_Tp SparseMat::value(int i0, int i1, size_t* hashval) const
+{
+    const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, i1, false, hashval);
+    return p ? *p : _Tp();
+}
+
+template<typename _Tp> inline
+_Tp SparseMat::value(int i0, int i1, int i2, size_t* hashval) const
+{
+    const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(i0, i1, i2, false, hashval);
+    return p ? *p : _Tp();
+}
+
+template<typename _Tp> inline
+_Tp SparseMat::value(const int* idx, size_t* hashval) const
+{
+    const _Tp* p = (const _Tp*)((SparseMat*)this)->ptr(idx, false, hashval);
+    return p ? *p : _Tp();
+}
+
+template<typename _Tp> inline
+const _Tp* SparseMat::find(int i0, size_t* hashval) const
+{
+    return (const _Tp*)((SparseMat*)this)->ptr(i0, false, hashval);
+}
+
+template<typename _Tp> inline
+const _Tp* SparseMat::find(int i0, int i1, size_t* hashval) const
+{
+    return (const _Tp*)((SparseMat*)this)->ptr(i0, i1, false, hashval);
+}
+
+template<typename _Tp> inline
+const _Tp* SparseMat::find(int i0, int i1, int i2, size_t* hashval) const
+{
+    return (const _Tp*)((SparseMat*)this)->ptr(i0, i1, i2, false, hashval);
+}
+
+template<typename _Tp> inline
+const _Tp* SparseMat::find(const int* idx, size_t* hashval) const
+{
+    return (const _Tp*)((SparseMat*)this)->ptr(idx, false, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat::value(Node* n)
+{
+    return *(_Tp*)((uchar*)n + hdr->valueOffset);
+}
+
+template<typename _Tp> inline
+const _Tp& SparseMat::value(const Node* n) const
+{
+    return *(const _Tp*)((const uchar*)n + hdr->valueOffset);
+}
+
+inline
+SparseMat::Node* SparseMat::node(size_t nidx)
+{
+    return (Node*)(void*)&hdr->pool[nidx];
+}
+
+inline
+const SparseMat::Node* SparseMat::node(size_t nidx) const
+{
+    return (const Node*)(const void*)&hdr->pool[nidx];
+}
+
+inline
+SparseMatIterator SparseMat::begin()
+{
+    return SparseMatIterator(this);
+}
+
+inline
+SparseMatConstIterator SparseMat::begin() const
+{
+    return SparseMatConstIterator(this);
+}
+
+inline
+SparseMatIterator SparseMat::end()
+{
+    SparseMatIterator it(this);
+    it.seekEnd();
+    return it;
+}
+
+inline
+SparseMatConstIterator SparseMat::end() const
+{
+    SparseMatConstIterator it(this);
+    it.seekEnd();
+    return it;
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMat::begin()
+{
+    return SparseMatIterator_<_Tp>(this);
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMat::begin() const
+{
+    return SparseMatConstIterator_<_Tp>(this);
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMat::end()
+{
+    SparseMatIterator_<_Tp> it(this);
+    it.seekEnd();
+    return it;
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMat::end() const
+{
+    SparseMatConstIterator_<_Tp> it(this);
+    it.seekEnd();
+    return it;
+}
+
+
+
+///////////////////////////// SparseMat_ ////////////////////////////
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_()
+{
+    flags = MAGIC_VAL | DataType<_Tp>::type;
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_(int _dims, const int* _sizes)
+    : SparseMat(_dims, _sizes, DataType<_Tp>::type)
+{}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_(const SparseMat& m)
+{
+    if( m.type() == DataType<_Tp>::type )
+        *this = (const SparseMat_<_Tp>&)m;
+    else
+        m.convertTo(*this, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_(const SparseMat_<_Tp>& m)
+{
+    this->flags = m.flags;
+    this->hdr = m.hdr;
+    if( this->hdr )
+        CV_XADD(&this->hdr->refcount, 1);
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>::SparseMat_(const Mat& m)
+{
+    SparseMat sm(m);
+    *this = sm;
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const SparseMat_<_Tp>& m)
+{
+    if( this != &m )
+    {
+        if( m.hdr ) CV_XADD(&m.hdr->refcount, 1);
+        release();
+        flags = m.flags;
+        hdr = m.hdr;
+    }
+    return *this;
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const SparseMat& m)
+{
+    if( m.type() == DataType<_Tp>::type )
+        return (*this = (const SparseMat_<_Tp>&)m);
+    m.convertTo(*this, DataType<_Tp>::type);
+    return *this;
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp>& SparseMat_<_Tp>::operator = (const Mat& m)
+{
+    return (*this = SparseMat(m));
+}
+
+template<typename _Tp> inline
+SparseMat_<_Tp> SparseMat_<_Tp>::clone() const
+{
+    SparseMat_<_Tp> m;
+    this->copyTo(m);
+    return m;
+}
+
+template<typename _Tp> inline
+void SparseMat_<_Tp>::create(int _dims, const int* _sizes)
+{
+    SparseMat::create(_dims, _sizes, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+int SparseMat_<_Tp>::type() const
+{
+    return DataType<_Tp>::type;
+}
+
+template<typename _Tp> inline
+int SparseMat_<_Tp>::depth() const
+{
+    return DataType<_Tp>::depth;
+}
+
+template<typename _Tp> inline
+int SparseMat_<_Tp>::channels() const
+{
+    return DataType<_Tp>::channels;
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat_<_Tp>::ref(int i0, size_t* hashval)
+{
+    return SparseMat::ref<_Tp>(i0, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat_<_Tp>::operator()(int i0, size_t* hashval) const
+{
+    return SparseMat::value<_Tp>(i0, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat_<_Tp>::ref(int i0, int i1, size_t* hashval)
+{
+    return SparseMat::ref<_Tp>(i0, i1, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat_<_Tp>::operator()(int i0, int i1, size_t* hashval) const
+{
+    return SparseMat::value<_Tp>(i0, i1, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat_<_Tp>::ref(int i0, int i1, int i2, size_t* hashval)
+{
+    return SparseMat::ref<_Tp>(i0, i1, i2, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat_<_Tp>::operator()(int i0, int i1, int i2, size_t* hashval) const
+{
+    return SparseMat::value<_Tp>(i0, i1, i2, hashval);
+}
+
+template<typename _Tp> inline
+_Tp& SparseMat_<_Tp>::ref(const int* idx, size_t* hashval)
+{
+    return SparseMat::ref<_Tp>(idx, hashval);
+}
+
+template<typename _Tp> inline
+_Tp SparseMat_<_Tp>::operator()(const int* idx, size_t* hashval) const
+{
+    return SparseMat::value<_Tp>(idx, hashval);
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMat_<_Tp>::begin()
+{
+    return SparseMatIterator_<_Tp>(this);
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMat_<_Tp>::begin() const
+{
+    return SparseMatConstIterator_<_Tp>(this);
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMat_<_Tp>::end()
+{
+    SparseMatIterator_<_Tp> it(this);
+    it.seekEnd();
+    return it;
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMat_<_Tp>::end() const
+{
+    SparseMatConstIterator_<_Tp> it(this);
+    it.seekEnd();
+    return it;
+}
+
+
+
+////////////////////////// MatConstIterator /////////////////////////
+
+inline
+MatConstIterator::MatConstIterator()
+    : m(0), elemSize(0), ptr(0), sliceStart(0), sliceEnd(0)
+{}
+
+inline
+MatConstIterator::MatConstIterator(const Mat* _m)
+    : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0)
+{
+    if( m && m->isContinuous() )
+    {
+        sliceStart = m->ptr();
+        sliceEnd = sliceStart + m->total()*elemSize;
+    }
+    seek((const int*)0);
+}
+
+inline
+MatConstIterator::MatConstIterator(const Mat* _m, int _row, int _col)
+    : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0)
+{
+    CV_Assert(m && m->dims <= 2);
+    if( m->isContinuous() )
+    {
+        sliceStart = m->ptr();
+        sliceEnd = sliceStart + m->total()*elemSize;
+    }
+    int idx[] = {_row, _col};
+    seek(idx);
+}
+
+inline
+MatConstIterator::MatConstIterator(const Mat* _m, Point _pt)
+    : m(_m), elemSize(_m->elemSize()), ptr(0), sliceStart(0), sliceEnd(0)
+{
+    CV_Assert(m && m->dims <= 2);
+    if( m->isContinuous() )
+    {
+        sliceStart = m->ptr();
+        sliceEnd = sliceStart + m->total()*elemSize;
+    }
+    int idx[] = {_pt.y, _pt.x};
+    seek(idx);
+}
+
+inline
+MatConstIterator::MatConstIterator(const MatConstIterator& it)
+    : m(it.m), elemSize(it.elemSize), ptr(it.ptr), sliceStart(it.sliceStart), sliceEnd(it.sliceEnd)
+{}
+
+inline
+MatConstIterator& MatConstIterator::operator = (const MatConstIterator& it )
+{
+    m = it.m; elemSize = it.elemSize; ptr = it.ptr;
+    sliceStart = it.sliceStart; sliceEnd = it.sliceEnd;
+    return *this;
+}
+
+inline
+const uchar* MatConstIterator::operator *() const
+{
+    return ptr;
+}
+
+inline MatConstIterator& MatConstIterator::operator += (ptrdiff_t ofs)
+{
+    if( !m || ofs == 0 )
+        return *this;
+    ptrdiff_t ofsb = ofs*elemSize;
+    ptr += ofsb;
+    if( ptr < sliceStart || sliceEnd <= ptr )
+    {
+        ptr -= ofsb;
+        seek(ofs, true);
+    }
+    return *this;
+}
+
+inline
+MatConstIterator& MatConstIterator::operator -= (ptrdiff_t ofs)
+{
+    return (*this += -ofs);
+}
+
+inline
+MatConstIterator& MatConstIterator::operator --()
+{
+    if( m && (ptr -= elemSize) < sliceStart )
+    {
+        ptr += elemSize;
+        seek(-1, true);
+    }
+    return *this;
+}
+
+inline
+MatConstIterator MatConstIterator::operator --(int)
+{
+    MatConstIterator b = *this;
+    *this += -1;
+    return b;
+}
+
+inline
+MatConstIterator& MatConstIterator::operator ++()
+{
+    if( m && (ptr += elemSize) >= sliceEnd )
+    {
+        ptr -= elemSize;
+        seek(1, true);
+    }
+    return *this;
+}
+
+inline MatConstIterator MatConstIterator::operator ++(int)
+{
+    MatConstIterator b = *this;
+    *this += 1;
+    return b;
+}
+
+
+static inline
+bool operator == (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.m == b.m && a.ptr == b.ptr;
+}
+
+static inline
+bool operator != (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return !(a == b);
+}
+
+static inline
+bool operator < (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.ptr < b.ptr;
+}
+
+static inline
+bool operator > (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.ptr > b.ptr;
+}
+
+static inline
+bool operator <= (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.ptr <= b.ptr;
+}
+
+static inline
+bool operator >= (const MatConstIterator& a, const MatConstIterator& b)
+{
+    return a.ptr >= b.ptr;
+}
+
+static inline
+ptrdiff_t operator - (const MatConstIterator& b, const MatConstIterator& a)
+{
+    if( a.m != b.m )
+        return ((size_t)(-1) >> 1);
+    if( a.sliceEnd == b.sliceEnd )
+        return (b.ptr - a.ptr)/b.elemSize;
+
+    return b.lpos() - a.lpos();
+}
+
+static inline
+MatConstIterator operator + (const MatConstIterator& a, ptrdiff_t ofs)
+{
+    MatConstIterator b = a;
+    return b += ofs;
+}
+
+static inline
+MatConstIterator operator + (ptrdiff_t ofs, const MatConstIterator& a)
+{
+    MatConstIterator b = a;
+    return b += ofs;
+}
+
+static inline
+MatConstIterator operator - (const MatConstIterator& a, ptrdiff_t ofs)
+{
+    MatConstIterator b = a;
+    return b += -ofs;
+}
+
+
+inline
+const uchar* MatConstIterator::operator [](ptrdiff_t i) const
+{
+    return *(*this + i);
+}
+
+
+
+///////////////////////// MatConstIterator_ /////////////////////////
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_()
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m)
+    : MatConstIterator(_m)
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m, int _row, int _col)
+    : MatConstIterator(_m, _row, _col)
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_(const Mat_<_Tp>* _m, Point _pt)
+    : MatConstIterator(_m, _pt)
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>::MatConstIterator_(const MatConstIterator_& it)
+    : MatConstIterator(it)
+{}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator = (const MatConstIterator_& it )
+{
+    MatConstIterator::operator = (it);
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp MatConstIterator_<_Tp>::operator *() const
+{
+    return *(_Tp*)(this->ptr);
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator += (ptrdiff_t ofs)
+{
+    MatConstIterator::operator += (ofs);
+    return *this;
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator -= (ptrdiff_t ofs)
+{
+    return (*this += -ofs);
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator --()
+{
+    MatConstIterator::operator --();
+    return *this;
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> MatConstIterator_<_Tp>::operator --(int)
+{
+    MatConstIterator_ b = *this;
+    MatConstIterator::operator --();
+    return b;
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp>& MatConstIterator_<_Tp>::operator ++()
+{
+    MatConstIterator::operator ++();
+    return *this;
+}
+
+template<typename _Tp> inline
+MatConstIterator_<_Tp> MatConstIterator_<_Tp>::operator ++(int)
+{
+    MatConstIterator_ b = *this;
+    MatConstIterator::operator ++();
+    return b;
+}
+
+
+template<typename _Tp> inline
+Point MatConstIterator_<_Tp>::pos() const
+{
+    if( !m )
+        return Point();
+    CV_DbgAssert( m->dims <= 2 );
+    if( m->isContinuous() )
+    {
+        ptrdiff_t ofs = (const _Tp*)ptr - (const _Tp*)m->data;
+        int y = (int)(ofs / m->cols);
+        int x = (int)(ofs - (ptrdiff_t)y * m->cols);
+        return Point(x, y);
+    }
+    else
+    {
+        ptrdiff_t ofs = (uchar*)ptr - m->data;
+        int y = (int)(ofs / m->step);
+        int x = (int)((ofs - y * m->step)/sizeof(_Tp));
+        return Point(x, y);
+    }
+}
+
+
+template<typename _Tp> static inline
+bool operator == (const MatConstIterator_<_Tp>& a, const MatConstIterator_<_Tp>& b)
+{
+    return a.m == b.m && a.ptr == b.ptr;
+}
+
+template<typename _Tp> static inline
+bool operator != (const MatConstIterator_<_Tp>& a, const MatConstIterator_<_Tp>& b)
+{
+    return a.m != b.m || a.ptr != b.ptr;
+}
+
+template<typename _Tp> static inline
+MatConstIterator_<_Tp> operator + (const MatConstIterator_<_Tp>& a, ptrdiff_t ofs)
+{
+    MatConstIterator t = (const MatConstIterator&)a + ofs;
+    return (MatConstIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> static inline
+MatConstIterator_<_Tp> operator + (ptrdiff_t ofs, const MatConstIterator_<_Tp>& a)
+{
+    MatConstIterator t = (const MatConstIterator&)a + ofs;
+    return (MatConstIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> static inline
+MatConstIterator_<_Tp> operator - (const MatConstIterator_<_Tp>& a, ptrdiff_t ofs)
+{
+    MatConstIterator t = (const MatConstIterator&)a - ofs;
+    return (MatConstIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> inline
+_Tp MatConstIterator_<_Tp>::operator [](ptrdiff_t i) const
+{
+    return *(_Tp*)MatConstIterator::operator [](i);
+}
+
+
+
+//////////////////////////// MatIterator_ ///////////////////////////
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_()
+    : MatConstIterator_<_Tp>()
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m)
+    : MatConstIterator_<_Tp>(_m)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, int _row, int _col)
+    : MatConstIterator_<_Tp>(_m, _row, _col)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, Point _pt)
+    : MatConstIterator_<_Tp>(_m, _pt)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(Mat_<_Tp>* _m, const int* _idx)
+    : MatConstIterator_<_Tp>(_m, _idx)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>::MatIterator_(const MatIterator_& it)
+    : MatConstIterator_<_Tp>(it)
+{}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator = (const MatIterator_<_Tp>& it )
+{
+    MatConstIterator::operator = (it);
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp& MatIterator_<_Tp>::operator *() const
+{
+    return *(_Tp*)(this->ptr);
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator += (ptrdiff_t ofs)
+{
+    MatConstIterator::operator += (ofs);
+    return *this;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator -= (ptrdiff_t ofs)
+{
+    MatConstIterator::operator += (-ofs);
+    return *this;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator --()
+{
+    MatConstIterator::operator --();
+    return *this;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> MatIterator_<_Tp>::operator --(int)
+{
+    MatIterator_ b = *this;
+    MatConstIterator::operator --();
+    return b;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp>& MatIterator_<_Tp>::operator ++()
+{
+    MatConstIterator::operator ++();
+    return *this;
+}
+
+template<typename _Tp> inline
+MatIterator_<_Tp> MatIterator_<_Tp>::operator ++(int)
+{
+    MatIterator_ b = *this;
+    MatConstIterator::operator ++();
+    return b;
+}
+
+template<typename _Tp> inline
+_Tp& MatIterator_<_Tp>::operator [](ptrdiff_t i) const
+{
+    return *(*this + i);
+}
+
+
+template<typename _Tp> static inline
+bool operator == (const MatIterator_<_Tp>& a, const MatIterator_<_Tp>& b)
+{
+    return a.m == b.m && a.ptr == b.ptr;
+}
+
+template<typename _Tp> static inline
+bool operator != (const MatIterator_<_Tp>& a, const MatIterator_<_Tp>& b)
+{
+    return a.m != b.m || a.ptr != b.ptr;
+}
+
+template<typename _Tp> static inline
+MatIterator_<_Tp> operator + (const MatIterator_<_Tp>& a, ptrdiff_t ofs)
+{
+    MatConstIterator t = (const MatConstIterator&)a + ofs;
+    return (MatIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> static inline
+MatIterator_<_Tp> operator + (ptrdiff_t ofs, const MatIterator_<_Tp>& a)
+{
+    MatConstIterator t = (const MatConstIterator&)a + ofs;
+    return (MatIterator_<_Tp>&)t;
+}
+
+template<typename _Tp> static inline
+MatIterator_<_Tp> operator - (const MatIterator_<_Tp>& a, ptrdiff_t ofs)
+{
+    MatConstIterator t = (const MatConstIterator&)a - ofs;
+    return (MatIterator_<_Tp>&)t;
+}
+
+
+
+/////////////////////// SparseMatConstIterator //////////////////////
+
+inline
+SparseMatConstIterator::SparseMatConstIterator()
+    : m(0), hashidx(0), ptr(0)
+{}
+
+inline
+SparseMatConstIterator::SparseMatConstIterator(const SparseMatConstIterator& it)
+    : m(it.m), hashidx(it.hashidx), ptr(it.ptr)
+{}
+
+inline SparseMatConstIterator& SparseMatConstIterator::operator = (const SparseMatConstIterator& it)
+{
+    if( this != &it )
+    {
+        m = it.m;
+        hashidx = it.hashidx;
+        ptr = it.ptr;
+    }
+    return *this;
+}
+
+template<typename _Tp> inline
+const _Tp& SparseMatConstIterator::value() const
+{
+    return *(const _Tp*)ptr;
+}
+
+inline
+const SparseMat::Node* SparseMatConstIterator::node() const
+{
+    return (ptr && m && m->hdr) ? (const SparseMat::Node*)(const void*)(ptr - m->hdr->valueOffset) : 0;
+}
+
+inline
+SparseMatConstIterator SparseMatConstIterator::operator ++(int)
+{
+    SparseMatConstIterator it = *this;
+    ++*this;
+    return it;
+}
+
+inline
+void SparseMatConstIterator::seekEnd()
+{
+    if( m && m->hdr )
+    {
+        hashidx = m->hdr->hashtab.size();
+        ptr = 0;
+    }
+}
+
+
+static inline
+bool operator == (const SparseMatConstIterator& it1, const SparseMatConstIterator& it2)
+{
+    return it1.m == it2.m && it1.ptr == it2.ptr;
+}
+
+static inline
+bool operator != (const SparseMatConstIterator& it1, const SparseMatConstIterator& it2)
+{
+    return !(it1 == it2);
+}
+
+
+
+///////////////////////// SparseMatIterator /////////////////////////
+
+inline
+SparseMatIterator::SparseMatIterator()
+{}
+
+inline
+SparseMatIterator::SparseMatIterator(SparseMat* _m)
+    : SparseMatConstIterator(_m)
+{}
+
+inline
+SparseMatIterator::SparseMatIterator(const SparseMatIterator& it)
+    : SparseMatConstIterator(it)
+{}
+
+inline
+SparseMatIterator& SparseMatIterator::operator = (const SparseMatIterator& it)
+{
+    (SparseMatConstIterator&)*this = it;
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp& SparseMatIterator::value() const
+{
+    return *(_Tp*)ptr;
+}
+
+inline
+SparseMat::Node* SparseMatIterator::node() const
+{
+    return (SparseMat::Node*)SparseMatConstIterator::node();
+}
+
+inline
+SparseMatIterator& SparseMatIterator::operator ++()
+{
+    SparseMatConstIterator::operator ++();
+    return *this;
+}
+
+inline
+SparseMatIterator SparseMatIterator::operator ++(int)
+{
+    SparseMatIterator it = *this;
+    ++*this;
+    return it;
+}
+
+
+
+////////////////////// SparseMatConstIterator_ //////////////////////
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>::SparseMatConstIterator_()
+{}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMat_<_Tp>* _m)
+    : SparseMatConstIterator(_m)
+{}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMat* _m)
+    : SparseMatConstIterator(_m)
+{
+    CV_Assert( _m->type() == DataType<_Tp>::type );
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMatConstIterator_<_Tp>& it)
+    : SparseMatConstIterator(it)
+{}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>& SparseMatConstIterator_<_Tp>::operator = (const SparseMatConstIterator_<_Tp>& it)
+{
+    return reinterpret_cast<SparseMatConstIterator_<_Tp>&>
+         (*reinterpret_cast<SparseMatConstIterator*>(this) =
+           reinterpret_cast<const SparseMatConstIterator&>(it));
+}
+
+template<typename _Tp> inline
+const _Tp& SparseMatConstIterator_<_Tp>::operator *() const
+{
+    return *(const _Tp*)this->ptr;
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp>& SparseMatConstIterator_<_Tp>::operator ++()
+{
+    SparseMatConstIterator::operator ++();
+    return *this;
+}
+
+template<typename _Tp> inline
+SparseMatConstIterator_<_Tp> SparseMatConstIterator_<_Tp>::operator ++(int)
+{
+    SparseMatConstIterator_<_Tp> it = *this;
+    SparseMatConstIterator::operator ++();
+    return it;
+}
+
+
+
+///////////////////////// SparseMatIterator_ ////////////////////////
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>::SparseMatIterator_()
+{}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat_<_Tp>* _m)
+    : SparseMatConstIterator_<_Tp>(_m)
+{}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat* _m)
+    : SparseMatConstIterator_<_Tp>(_m)
+{}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>::SparseMatIterator_(const SparseMatIterator_<_Tp>& it)
+    : SparseMatConstIterator_<_Tp>(it)
+{}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>& SparseMatIterator_<_Tp>::operator = (const SparseMatIterator_<_Tp>& it)
+{
+    return reinterpret_cast<SparseMatIterator_<_Tp>&>
+         (*reinterpret_cast<SparseMatConstIterator*>(this) =
+           reinterpret_cast<const SparseMatConstIterator&>(it));
+}
+
+template<typename _Tp> inline
+_Tp& SparseMatIterator_<_Tp>::operator *() const
+{
+    return *(_Tp*)this->ptr;
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp>& SparseMatIterator_<_Tp>::operator ++()
+{
+    SparseMatConstIterator::operator ++();
+    return *this;
+}
+
+template<typename _Tp> inline
+SparseMatIterator_<_Tp> SparseMatIterator_<_Tp>::operator ++(int)
+{
+    SparseMatIterator_<_Tp> it = *this;
+    SparseMatConstIterator::operator ++();
+    return it;
+}
+
+
+
+//////////////////////// MatCommaInitializer_ ///////////////////////
+
+template<typename _Tp> inline
+MatCommaInitializer_<_Tp>::MatCommaInitializer_(Mat_<_Tp>* _m)
+    : it(_m)
+{}
+
+template<typename _Tp> template<typename T2> inline
+MatCommaInitializer_<_Tp>& MatCommaInitializer_<_Tp>::operator , (T2 v)
+{
+    CV_DbgAssert( this->it < ((const Mat_<_Tp>*)this->it.m)->end() );
+    *this->it = _Tp(v);
+    ++this->it;
+    return *this;
+}
+
+template<typename _Tp> inline
+MatCommaInitializer_<_Tp>::operator Mat_<_Tp>() const
+{
+    CV_DbgAssert( this->it == ((const Mat_<_Tp>*)this->it.m)->end() );
+    return Mat_<_Tp>(*this->it.m);
+}
+
+
+template<typename _Tp, typename T2> static inline
+MatCommaInitializer_<_Tp> operator << (const Mat_<_Tp>& m, T2 val)
+{
+    MatCommaInitializer_<_Tp> commaInitializer((Mat_<_Tp>*)&m);
+    return (commaInitializer, val);
+}
+
+
+
+///////////////////////// Matrix Expressions ////////////////////////
+
+inline
+Mat& Mat::operator = (const MatExpr& e)
+{
+    e.op->assign(e, *this);
+    return *this;
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>::Mat_(const MatExpr& e)
+{
+    e.op->assign(e, *this, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+Mat_<_Tp>& Mat_<_Tp>::operator = (const MatExpr& e)
+{
+    e.op->assign(e, *this, DataType<_Tp>::type);
+    return *this;
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::zeros(int rows, int cols)
+{
+    return Mat::zeros(rows, cols, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::zeros(Size sz)
+{
+    return Mat::zeros(sz, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::ones(int rows, int cols)
+{
+    return Mat::ones(rows, cols, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::ones(Size sz)
+{
+    return Mat::ones(sz, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::eye(int rows, int cols)
+{
+    return Mat::eye(rows, cols, DataType<_Tp>::type);
+}
+
+template<typename _Tp> inline
+MatExpr Mat_<_Tp>::eye(Size sz)
+{
+    return Mat::eye(sz, DataType<_Tp>::type);
+}
+
+inline
+MatExpr::MatExpr()
+    : op(0), flags(0), a(Mat()), b(Mat()), c(Mat()), alpha(0), beta(0), s()
+{}
+
+inline
+MatExpr::MatExpr(const MatOp* _op, int _flags, const Mat& _a, const Mat& _b,
+                 const Mat& _c, double _alpha, double _beta, const Scalar& _s)
+    : op(_op), flags(_flags), a(_a), b(_b), c(_c), alpha(_alpha), beta(_beta), s(_s)
+{}
+
+inline
+MatExpr::operator Mat() const
+{
+    Mat m;
+    op->assign(*this, m);
+    return m;
+}
+
+template<typename _Tp> inline
+MatExpr::operator Mat_<_Tp>() const
+{
+    Mat_<_Tp> m;
+    op->assign(*this, m, DataType<_Tp>::type);
+    return m;
+}
+
+
+template<typename _Tp> static inline
+MatExpr min(const Mat_<_Tp>& a, const Mat_<_Tp>& b)
+{
+    return cv::min((const Mat&)a, (const Mat&)b);
+}
+
+template<typename _Tp> static inline
+MatExpr min(const Mat_<_Tp>& a, double s)
+{
+    return cv::min((const Mat&)a, s);
+}
+
+template<typename _Tp> static inline
+MatExpr min(double s, const Mat_<_Tp>& a)
+{
+    return cv::min((const Mat&)a, s);
+}
+
+template<typename _Tp> static inline
+MatExpr max(const Mat_<_Tp>& a, const Mat_<_Tp>& b)
+{
+    return cv::max((const Mat&)a, (const Mat&)b);
+}
+
+template<typename _Tp> static inline
+MatExpr max(const Mat_<_Tp>& a, double s)
+{
+    return cv::max((const Mat&)a, s);
+}
+
+template<typename _Tp> static inline
+MatExpr max(double s, const Mat_<_Tp>& a)
+{
+    return cv::max((const Mat&)a, s);
+}
+
+template<typename _Tp> static inline
+MatExpr abs(const Mat_<_Tp>& m)
+{
+    return cv::abs((const Mat&)m);
+}
+
+
+static inline
+Mat& operator += (Mat& a, const MatExpr& b)
+{
+    b.op->augAssignAdd(b, a);
+    return a;
+}
+
+static inline
+const Mat& operator += (const Mat& a, const MatExpr& b)
+{
+    b.op->augAssignAdd(b, (Mat&)a);
+    return a;
+}
+
+template<typename _Tp> static inline
+Mat_<_Tp>& operator += (Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignAdd(b, a);
+    return a;
+}
+
+template<typename _Tp> static inline
+const Mat_<_Tp>& operator += (const Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignAdd(b, (Mat&)a);
+    return a;
+}
+
+static inline
+Mat& operator -= (Mat& a, const MatExpr& b)
+{
+    b.op->augAssignSubtract(b, a);
+    return a;
+}
+
+static inline
+const Mat& operator -= (const Mat& a, const MatExpr& b)
+{
+    b.op->augAssignSubtract(b, (Mat&)a);
+    return a;
+}
+
+template<typename _Tp> static inline
+Mat_<_Tp>& operator -= (Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignSubtract(b, a);
+    return a;
+}
+
+template<typename _Tp> static inline
+const Mat_<_Tp>& operator -= (const Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignSubtract(b, (Mat&)a);
+    return a;
+}
+
+static inline
+Mat& operator *= (Mat& a, const MatExpr& b)
+{
+    b.op->augAssignMultiply(b, a);
+    return a;
+}
+
+static inline
+const Mat& operator *= (const Mat& a, const MatExpr& b)
+{
+    b.op->augAssignMultiply(b, (Mat&)a);
+    return a;
+}
+
+template<typename _Tp> static inline
+Mat_<_Tp>& operator *= (Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignMultiply(b, a);
+    return a;
+}
+
+template<typename _Tp> static inline
+const Mat_<_Tp>& operator *= (const Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignMultiply(b, (Mat&)a);
+    return a;
+}
+
+static inline
+Mat& operator /= (Mat& a, const MatExpr& b)
+{
+    b.op->augAssignDivide(b, a);
+    return a;
+}
+
+static inline
+const Mat& operator /= (const Mat& a, const MatExpr& b)
+{
+    b.op->augAssignDivide(b, (Mat&)a);
+    return a;
+}
+
+template<typename _Tp> static inline
+Mat_<_Tp>& operator /= (Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignDivide(b, a);
+    return a;
+}
+
+template<typename _Tp> static inline
+const Mat_<_Tp>& operator /= (const Mat_<_Tp>& a, const MatExpr& b)
+{
+    b.op->augAssignDivide(b, (Mat&)a);
+    return a;
+}
+
+
+//////////////////////////////// UMat ////////////////////////////////
+
+inline
+UMat::UMat(UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{}
+
+inline
+UMat::UMat(int _rows, int _cols, int _type, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_rows, _cols, _type);
+}
+
+inline
+UMat::UMat(int _rows, int _cols, int _type, const Scalar& _s, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_rows, _cols, _type);
+    *this = _s;
+}
+
+inline
+UMat::UMat(Size _sz, int _type, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create( _sz.height, _sz.width, _type );
+}
+
+inline
+UMat::UMat(Size _sz, int _type, const Scalar& _s, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_sz.height, _sz.width, _type);
+    *this = _s;
+}
+
+inline
+UMat::UMat(int _dims, const int* _sz, int _type, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_dims, _sz, _type);
+}
+
+inline
+UMat::UMat(int _dims, const int* _sz, int _type, const Scalar& _s, UMatUsageFlags _usageFlags)
+: flags(MAGIC_VAL), dims(0), rows(0), cols(0), allocator(0), usageFlags(_usageFlags), u(0), offset(0), size(&rows)
+{
+    create(_dims, _sz, _type);
+    *this = _s;
+}
+
+inline
+UMat::UMat(const UMat& m)
+: flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), allocator(m.allocator),
+  usageFlags(m.usageFlags), u(m.u), offset(m.offset), size(&rows)
+{
+    addref();
+    if( m.dims <= 2 )
+    {
+        step[0] = m.step[0]; step[1] = m.step[1];
+    }
+    else
+    {
+        dims = 0;
+        copySize(m);
+    }
+}
+
+
+template<typename _Tp> inline
+UMat::UMat(const std::vector<_Tp>& vec, bool copyData)
+: flags(MAGIC_VAL | DataType<_Tp>::type | CV_MAT_CONT_FLAG), dims(2), rows((int)vec.size()),
+cols(1), allocator(0), usageFlags(USAGE_DEFAULT), u(0), offset(0), size(&rows)
+{
+    if(vec.empty())
+        return;
+    if( !copyData )
+    {
+        // !!!TODO!!!
+        CV_Error(Error::StsNotImplemented, "");
+    }
+    else
+        Mat((int)vec.size(), 1, DataType<_Tp>::type, (uchar*)&vec[0]).copyTo(*this);
+}
+
+
+inline
+UMat& UMat::operator = (const UMat& m)
+{
+    if( this != &m )
+    {
+        const_cast<UMat&>(m).addref();
+        release();
+        flags = m.flags;
+        if( dims <= 2 && m.dims <= 2 )
+        {
+            dims = m.dims;
+            rows = m.rows;
+            cols = m.cols;
+            step[0] = m.step[0];
+            step[1] = m.step[1];
+        }
+        else
+            copySize(m);
+        allocator = m.allocator;
+        if (usageFlags == USAGE_DEFAULT)
+            usageFlags = m.usageFlags;
+        u = m.u;
+        offset = m.offset;
+    }
+    return *this;
+}
+
+inline
+UMat UMat::row(int y) const
+{
+    return UMat(*this, Range(y, y + 1), Range::all());
+}
+
+inline
+UMat UMat::col(int x) const
+{
+    return UMat(*this, Range::all(), Range(x, x + 1));
+}
+
+inline
+UMat UMat::rowRange(int startrow, int endrow) const
+{
+    return UMat(*this, Range(startrow, endrow), Range::all());
+}
+
+inline
+UMat UMat::rowRange(const Range& r) const
+{
+    return UMat(*this, r, Range::all());
+}
+
+inline
+UMat UMat::colRange(int startcol, int endcol) const
+{
+    return UMat(*this, Range::all(), Range(startcol, endcol));
+}
+
+inline
+UMat UMat::colRange(const Range& r) const
+{
+    return UMat(*this, Range::all(), r);
+}
+
+inline
+UMat UMat::clone() const
+{
+    UMat m;
+    copyTo(m);
+    return m;
+}
+
+inline
+void UMat::assignTo( UMat& m, int _type ) const
+{
+    if( _type < 0 )
+        m = *this;
+    else
+        convertTo(m, _type);
+}
+
+inline
+void UMat::create(int _rows, int _cols, int _type, UMatUsageFlags _usageFlags)
+{
+    _type &= TYPE_MASK;
+    if( dims <= 2 && rows == _rows && cols == _cols && type() == _type && u )
+        return;
+    int sz[] = {_rows, _cols};
+    create(2, sz, _type, _usageFlags);
+}
+
+inline
+void UMat::create(Size _sz, int _type, UMatUsageFlags _usageFlags)
+{
+    create(_sz.height, _sz.width, _type, _usageFlags);
+}
+
+inline
+void UMat::addref()
+{
+    if( u )
+        CV_XADD(&(u->urefcount), 1);
+}
+
+inline void UMat::release()
+{
+    if( u && CV_XADD(&(u->urefcount), -1) == 1 )
+        deallocate();
+    for(int i = 0; i < dims; i++)
+        size.p[i] = 0;
+    u = 0;
+}
+
+inline
+UMat UMat::operator()( Range _rowRange, Range _colRange ) const
+{
+    return UMat(*this, _rowRange, _colRange);
+}
+
+inline
+UMat UMat::operator()( const Rect& roi ) const
+{
+    return UMat(*this, roi);
+}
+
+inline
+UMat UMat::operator()(const Range* ranges) const
+{
+    return UMat(*this, ranges);
+}
+
+inline
+bool UMat::isContinuous() const
+{
+    return (flags & CONTINUOUS_FLAG) != 0;
+}
+
+inline
+bool UMat::isSubmatrix() const
+{
+    return (flags & SUBMATRIX_FLAG) != 0;
+}
+
+inline
+size_t UMat::elemSize() const
+{
+    return dims > 0 ? step.p[dims - 1] : 0;
+}
+
+inline
+size_t UMat::elemSize1() const
+{
+    return CV_ELEM_SIZE1(flags);
+}
+
+inline
+int UMat::type() const
+{
+    return CV_MAT_TYPE(flags);
+}
+
+inline
+int UMat::depth() const
+{
+    return CV_MAT_DEPTH(flags);
+}
+
+inline
+int UMat::channels() const
+{
+    return CV_MAT_CN(flags);
+}
+
+inline
+size_t UMat::step1(int i) const
+{
+    return step.p[i] / elemSize1();
+}
+
+inline
+bool UMat::empty() const
+{
+    return u == 0 || total() == 0;
+}
+
+inline
+size_t UMat::total() const
+{
+    if( dims <= 2 )
+        return (size_t)rows * cols;
+    size_t p = 1;
+    for( int i = 0; i < dims; i++ )
+        p *= size[i];
+    return p;
+}
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+
+inline
+UMat::UMat(UMat&& m)
+: flags(m.flags), dims(m.dims), rows(m.rows), cols(m.cols), allocator(m.allocator),
+  usageFlags(m.usageFlags), u(m.u), offset(m.offset), size(&rows)
+{
+    if (m.dims <= 2)  // move new step/size info
+    {
+        step[0] = m.step[0];
+        step[1] = m.step[1];
+    }
+    else
+    {
+        CV_DbgAssert(m.step.p != m.step.buf);
+        step.p = m.step.p;
+        size.p = m.size.p;
+        m.step.p = m.step.buf;
+        m.size.p = &m.rows;
+    }
+    m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0;
+    m.allocator = NULL;
+    m.u = NULL;
+    m.offset = 0;
+}
+
+inline
+UMat& UMat::operator = (UMat&& m)
+{
+    release();
+    flags = m.flags; dims = m.dims; rows = m.rows; cols = m.cols;
+    allocator = m.allocator; usageFlags = m.usageFlags;
+    u = m.u;
+    offset = m.offset;
+    if (step.p != step.buf) // release self step/size
+    {
+        fastFree(step.p);
+        step.p = step.buf;
+        size.p = &rows;
+    }
+    if (m.dims <= 2) // move new step/size info
+    {
+        step[0] = m.step[0];
+        step[1] = m.step[1];
+    }
+    else
+    {
+        CV_DbgAssert(m.step.p != m.step.buf);
+        step.p = m.step.p;
+        size.p = m.size.p;
+        m.step.p = m.step.buf;
+        m.size.p = &m.rows;
+    }
+    m.flags = MAGIC_VAL; m.dims = m.rows = m.cols = 0;
+    m.allocator = NULL;
+    m.u = NULL;
+    m.offset = 0;
+    return *this;
+}
+
+#endif
+
+
+inline bool UMatData::hostCopyObsolete() const { return (flags & HOST_COPY_OBSOLETE) != 0; }
+inline bool UMatData::deviceCopyObsolete() const { return (flags & DEVICE_COPY_OBSOLETE) != 0; }
+inline bool UMatData::deviceMemMapped() const { return (flags & DEVICE_MEM_MAPPED) != 0; }
+inline bool UMatData::copyOnMap() const { return (flags & COPY_ON_MAP) != 0; }
+inline bool UMatData::tempUMat() const { return (flags & TEMP_UMAT) != 0; }
+inline bool UMatData::tempCopiedUMat() const { return (flags & TEMP_COPIED_UMAT) == TEMP_COPIED_UMAT; }
+
+inline void UMatData::markDeviceMemMapped(bool flag)
+{
+  if(flag)
+    flags |= DEVICE_MEM_MAPPED;
+  else
+    flags &= ~DEVICE_MEM_MAPPED;
+}
+
+inline void UMatData::markHostCopyObsolete(bool flag)
+{
+    if(flag)
+        flags |= HOST_COPY_OBSOLETE;
+    else
+        flags &= ~HOST_COPY_OBSOLETE;
+}
+inline void UMatData::markDeviceCopyObsolete(bool flag)
+{
+    if(flag)
+        flags |= DEVICE_COPY_OBSOLETE;
+    else
+        flags &= ~DEVICE_COPY_OBSOLETE;
+}
+
+inline UMatDataAutoLock::UMatDataAutoLock(UMatData* _u) : u(_u) { u->lock(); }
+inline UMatDataAutoLock::~UMatDataAutoLock() { u->unlock(); }
+
+//! @endcond
+
+} //cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp
new file mode 100644
index 0000000..ca5f261
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/matx.hpp
@@ -0,0 +1,1407 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_MATX_HPP__
+#define __OPENCV_CORE_MATX_HPP__
+
+#ifndef __cplusplus
+#  error matx.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/base.hpp"
+#include "opencv2/core/traits.hpp"
+#include "opencv2/core/saturate.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_basic
+//! @{
+
+////////////////////////////// Small Matrix ///////////////////////////
+
+//! @cond IGNORED
+struct CV_EXPORTS Matx_AddOp {};
+struct CV_EXPORTS Matx_SubOp {};
+struct CV_EXPORTS Matx_ScaleOp {};
+struct CV_EXPORTS Matx_MulOp {};
+struct CV_EXPORTS Matx_DivOp {};
+struct CV_EXPORTS Matx_MatMulOp {};
+struct CV_EXPORTS Matx_TOp {};
+//! @endcond
+
+/** @brief Template class for small matrices whose type and size are known at compilation time
+
+If you need a more flexible type, use Mat . The elements of the matrix M are accessible using the
+M(i,j) notation. Most of the common matrix operations (see also @ref MatrixExpressions ) are
+available. To do an operation on Matx that is not implemented, you can easily convert the matrix to
+Mat and backwards:
+@code
+    Matx33f m(1, 2, 3,
+              4, 5, 6,
+              7, 8, 9);
+    cout << sum(Mat(m*m.t())) << endl;
+ @endcode
+ */
+template<typename _Tp, int m, int n> class Matx
+{
+public:
+    enum { depth    = DataType<_Tp>::depth,
+           rows     = m,
+           cols     = n,
+           channels = rows*cols,
+           type     = CV_MAKETYPE(depth, channels),
+           shortdim = (m < n ? m : n)
+         };
+
+    typedef _Tp                           value_type;
+    typedef Matx<_Tp, m, n>               mat_type;
+    typedef Matx<_Tp, shortdim, 1> diag_type;
+
+    //! default constructor
+    Matx();
+
+    Matx(_Tp v0); //!< 1x1 matrix
+    Matx(_Tp v0, _Tp v1); //!< 1x2 or 2x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2); //!< 1x3 or 3x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3); //!< 1x4, 2x2 or 4x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4); //!< 1x5 or 5x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5); //!< 1x6, 2x3, 3x2 or 6x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6); //!< 1x7 or 7x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7); //!< 1x8, 2x4, 4x2 or 8x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8); //!< 1x9, 3x3 or 9x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9); //!< 1x10, 2x5 or 5x2 or 10x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
+         _Tp v4, _Tp v5, _Tp v6, _Tp v7,
+         _Tp v8, _Tp v9, _Tp v10, _Tp v11); //!< 1x12, 2x6, 3x4, 4x3, 6x2 or 12x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
+         _Tp v4, _Tp v5, _Tp v6, _Tp v7,
+         _Tp v8, _Tp v9, _Tp v10, _Tp v11,
+         _Tp v12, _Tp v13); //!< 1x14, 2x7, 7x2 or 14x1 matrix
+    Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3,
+         _Tp v4, _Tp v5, _Tp v6, _Tp v7,
+         _Tp v8, _Tp v9, _Tp v10, _Tp v11,
+         _Tp v12, _Tp v13, _Tp v14, _Tp v15); //!< 1x16, 4x4 or 16x1 matrix
+    explicit Matx(const _Tp* vals); //!< initialize from a plain array
+
+    static Matx all(_Tp alpha);
+    static Matx zeros();
+    static Matx ones();
+    static Matx eye();
+    static Matx diag(const diag_type& d);
+    static Matx randu(_Tp a, _Tp b);
+    static Matx randn(_Tp a, _Tp b);
+
+    //! dot product computed with the default precision
+    _Tp dot(const Matx<_Tp, m, n>& v) const;
+
+    //! dot product computed in double-precision arithmetics
+    double ddot(const Matx<_Tp, m, n>& v) const;
+
+    //! conversion to another data type
+    template<typename T2> operator Matx<T2, m, n>() const;
+
+    //! change the matrix shape
+    template<int m1, int n1> Matx<_Tp, m1, n1> reshape() const;
+
+    //! extract part of the matrix
+    template<int m1, int n1> Matx<_Tp, m1, n1> get_minor(int i, int j) const;
+
+    //! extract the matrix row
+    Matx<_Tp, 1, n> row(int i) const;
+
+    //! extract the matrix column
+    Matx<_Tp, m, 1> col(int i) const;
+
+    //! extract the matrix diagonal
+    diag_type diag() const;
+
+    //! transpose the matrix
+    Matx<_Tp, n, m> t() const;
+
+    //! invert the matrix
+    Matx<_Tp, n, m> inv(int method=DECOMP_LU, bool *p_is_ok = NULL) const;
+
+    //! solve linear system
+    template<int l> Matx<_Tp, n, l> solve(const Matx<_Tp, m, l>& rhs, int flags=DECOMP_LU) const;
+    Vec<_Tp, n> solve(const Vec<_Tp, m>& rhs, int method) const;
+
+    //! multiply two matrices element-wise
+    Matx<_Tp, m, n> mul(const Matx<_Tp, m, n>& a) const;
+
+    //! divide two matrices element-wise
+    Matx<_Tp, m, n> div(const Matx<_Tp, m, n>& a) const;
+
+    //! element access
+    const _Tp& operator ()(int i, int j) const;
+    _Tp& operator ()(int i, int j);
+
+    //! 1D element access
+    const _Tp& operator ()(int i) const;
+    _Tp& operator ()(int i);
+
+    Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_AddOp);
+    Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_SubOp);
+    template<typename _T2> Matx(const Matx<_Tp, m, n>& a, _T2 alpha, Matx_ScaleOp);
+    Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_MulOp);
+    Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_DivOp);
+    template<int l> Matx(const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b, Matx_MatMulOp);
+    Matx(const Matx<_Tp, n, m>& a, Matx_TOp);
+
+    _Tp val[m*n]; //< matrix elements
+};
+
+typedef Matx<float, 1, 2> Matx12f;
+typedef Matx<double, 1, 2> Matx12d;
+typedef Matx<float, 1, 3> Matx13f;
+typedef Matx<double, 1, 3> Matx13d;
+typedef Matx<float, 1, 4> Matx14f;
+typedef Matx<double, 1, 4> Matx14d;
+typedef Matx<float, 1, 6> Matx16f;
+typedef Matx<double, 1, 6> Matx16d;
+
+typedef Matx<float, 2, 1> Matx21f;
+typedef Matx<double, 2, 1> Matx21d;
+typedef Matx<float, 3, 1> Matx31f;
+typedef Matx<double, 3, 1> Matx31d;
+typedef Matx<float, 4, 1> Matx41f;
+typedef Matx<double, 4, 1> Matx41d;
+typedef Matx<float, 6, 1> Matx61f;
+typedef Matx<double, 6, 1> Matx61d;
+
+typedef Matx<float, 2, 2> Matx22f;
+typedef Matx<double, 2, 2> Matx22d;
+typedef Matx<float, 2, 3> Matx23f;
+typedef Matx<double, 2, 3> Matx23d;
+typedef Matx<float, 3, 2> Matx32f;
+typedef Matx<double, 3, 2> Matx32d;
+
+typedef Matx<float, 3, 3> Matx33f;
+typedef Matx<double, 3, 3> Matx33d;
+
+typedef Matx<float, 3, 4> Matx34f;
+typedef Matx<double, 3, 4> Matx34d;
+typedef Matx<float, 4, 3> Matx43f;
+typedef Matx<double, 4, 3> Matx43d;
+
+typedef Matx<float, 4, 4> Matx44f;
+typedef Matx<double, 4, 4> Matx44d;
+typedef Matx<float, 6, 6> Matx66f;
+typedef Matx<double, 6, 6> Matx66d;
+
+/*!
+  traits
+*/
+template<typename _Tp, int m, int n> class DataType< Matx<_Tp, m, n> >
+{
+public:
+    typedef Matx<_Tp, m, n>                               value_type;
+    typedef Matx<typename DataType<_Tp>::work_type, m, n> work_type;
+    typedef _Tp                                           channel_type;
+    typedef value_type                                    vec_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = m * n,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+/** @brief  Comma-separated Matrix Initializer
+*/
+template<typename _Tp, int m, int n> class MatxCommaInitializer
+{
+public:
+    MatxCommaInitializer(Matx<_Tp, m, n>* _mtx);
+    template<typename T2> MatxCommaInitializer<_Tp, m, n>& operator , (T2 val);
+    Matx<_Tp, m, n> operator *() const;
+
+    Matx<_Tp, m, n>* dst;
+    int idx;
+};
+
+/*
+ Utility methods
+*/
+template<typename _Tp, int m> static double determinant(const Matx<_Tp, m, m>& a);
+template<typename _Tp, int m, int n> static double trace(const Matx<_Tp, m, n>& a);
+template<typename _Tp, int m, int n> static double norm(const Matx<_Tp, m, n>& M);
+template<typename _Tp, int m, int n> static double norm(const Matx<_Tp, m, n>& M, int normType);
+
+
+
+/////////////////////// Vec (used as element of multi-channel images /////////////////////
+
+/** @brief Template class for short numerical vectors, a partial case of Matx
+
+This template class represents short numerical vectors (of 1, 2, 3, 4 ... elements) on which you
+can perform basic arithmetical operations, access individual elements using [] operator etc. The
+vectors are allocated on stack, as opposite to std::valarray, std::vector, cv::Mat etc., which
+elements are dynamically allocated in the heap.
+
+The template takes 2 parameters:
+@tparam _Tp element type
+@tparam cn the number of elements
+
+In addition to the universal notation like Vec<float, 3>, you can use shorter aliases
+for the most popular specialized variants of Vec, e.g. Vec3f ~ Vec<float, 3>.
+
+It is possible to convert Vec\<T,2\> to/from Point_, Vec\<T,3\> to/from Point3_ , and Vec\<T,4\>
+to CvScalar or Scalar_. Use operator[] to access the elements of Vec.
+
+All the expected vector operations are also implemented:
+-   v1 = v2 + v3
+-   v1 = v2 - v3
+-   v1 = v2 \* scale
+-   v1 = scale \* v2
+-   v1 = -v2
+-   v1 += v2 and other augmenting operations
+-   v1 == v2, v1 != v2
+-   norm(v1) (euclidean norm)
+The Vec class is commonly used to describe pixel types of multi-channel arrays. See Mat for details.
+*/
+template<typename _Tp, int cn> class Vec : public Matx<_Tp, cn, 1>
+{
+public:
+    typedef _Tp value_type;
+    enum { depth    = Matx<_Tp, cn, 1>::depth,
+           channels = cn,
+           type     = CV_MAKETYPE(depth, channels)
+         };
+
+    //! default constructor
+    Vec();
+
+    Vec(_Tp v0); //!< 1-element vector constructor
+    Vec(_Tp v0, _Tp v1); //!< 2-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2); //!< 3-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3); //!< 4-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4); //!< 5-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5); //!< 6-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6); //!< 7-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7); //!< 8-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8); //!< 9-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9); //!< 10-element vector constructor
+    Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13); //!< 14-element vector constructor
+    explicit Vec(const _Tp* values);
+
+    Vec(const Vec<_Tp, cn>& v);
+
+    static Vec all(_Tp alpha);
+
+    //! per-element multiplication
+    Vec mul(const Vec<_Tp, cn>& v) const;
+
+    //! conjugation (makes sense for complex numbers and quaternions)
+    Vec conj() const;
+
+    /*!
+      cross product of the two 3D vectors.
+
+      For other dimensionalities the exception is raised
+    */
+    Vec cross(const Vec& v) const;
+    //! conversion to another data type
+    template<typename T2> operator Vec<T2, cn>() const;
+
+    /*! element access */
+    const _Tp& operator [](int i) const;
+    _Tp& operator[](int i);
+    const _Tp& operator ()(int i) const;
+    _Tp& operator ()(int i);
+
+    Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_AddOp);
+    Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_SubOp);
+    template<typename _T2> Vec(const Matx<_Tp, cn, 1>& a, _T2 alpha, Matx_ScaleOp);
+};
+
+/** @name Shorter aliases for the most popular specializations of Vec<T,n>
+  @{
+*/
+typedef Vec<uchar, 2> Vec2b;
+typedef Vec<uchar, 3> Vec3b;
+typedef Vec<uchar, 4> Vec4b;
+
+typedef Vec<short, 2> Vec2s;
+typedef Vec<short, 3> Vec3s;
+typedef Vec<short, 4> Vec4s;
+
+typedef Vec<ushort, 2> Vec2w;
+typedef Vec<ushort, 3> Vec3w;
+typedef Vec<ushort, 4> Vec4w;
+
+typedef Vec<int, 2> Vec2i;
+typedef Vec<int, 3> Vec3i;
+typedef Vec<int, 4> Vec4i;
+typedef Vec<int, 6> Vec6i;
+typedef Vec<int, 8> Vec8i;
+
+typedef Vec<float, 2> Vec2f;
+typedef Vec<float, 3> Vec3f;
+typedef Vec<float, 4> Vec4f;
+typedef Vec<float, 6> Vec6f;
+
+typedef Vec<double, 2> Vec2d;
+typedef Vec<double, 3> Vec3d;
+typedef Vec<double, 4> Vec4d;
+typedef Vec<double, 6> Vec6d;
+/** @} */
+
+/*!
+  traits
+*/
+template<typename _Tp, int cn> class DataType< Vec<_Tp, cn> >
+{
+public:
+    typedef Vec<_Tp, cn>                               value_type;
+    typedef Vec<typename DataType<_Tp>::work_type, cn> work_type;
+    typedef _Tp                                        channel_type;
+    typedef value_type                                 vec_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = cn,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+/** @brief  Comma-separated Vec Initializer
+*/
+template<typename _Tp, int m> class VecCommaInitializer : public MatxCommaInitializer<_Tp, m, 1>
+{
+public:
+    VecCommaInitializer(Vec<_Tp, m>* _vec);
+    template<typename T2> VecCommaInitializer<_Tp, m>& operator , (T2 val);
+    Vec<_Tp, m> operator *() const;
+};
+
+template<typename _Tp, int cn> static Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v);
+
+//! @} core_basic
+
+//! @cond IGNORED
+
+///////////////////////////////////// helper classes /////////////////////////////////////
+namespace internal
+{
+
+template<typename _Tp, int m> struct Matx_DetOp
+{
+    double operator ()(const Matx<_Tp, m, m>& a) const
+    {
+        Matx<_Tp, m, m> temp = a;
+        double p = LU(temp.val, m*sizeof(_Tp), m, 0, 0, 0);
+        if( p == 0 )
+            return p;
+        for( int i = 0; i < m; i++ )
+            p *= temp(i, i);
+        return 1./p;
+    }
+};
+
+template<typename _Tp> struct Matx_DetOp<_Tp, 1>
+{
+    double operator ()(const Matx<_Tp, 1, 1>& a) const
+    {
+        return a(0,0);
+    }
+};
+
+template<typename _Tp> struct Matx_DetOp<_Tp, 2>
+{
+    double operator ()(const Matx<_Tp, 2, 2>& a) const
+    {
+        return a(0,0)*a(1,1) - a(0,1)*a(1,0);
+    }
+};
+
+template<typename _Tp> struct Matx_DetOp<_Tp, 3>
+{
+    double operator ()(const Matx<_Tp, 3, 3>& a) const
+    {
+        return a(0,0)*(a(1,1)*a(2,2) - a(2,1)*a(1,2)) -
+            a(0,1)*(a(1,0)*a(2,2) - a(2,0)*a(1,2)) +
+            a(0,2)*(a(1,0)*a(2,1) - a(2,0)*a(1,1));
+    }
+};
+
+template<typename _Tp> Vec<_Tp, 2> inline conjugate(const Vec<_Tp, 2>& v)
+{
+    return Vec<_Tp, 2>(v[0], -v[1]);
+}
+
+template<typename _Tp> Vec<_Tp, 4> inline conjugate(const Vec<_Tp, 4>& v)
+{
+    return Vec<_Tp, 4>(v[0], -v[1], -v[2], -v[3]);
+}
+
+} // internal
+
+
+
+////////////////////////////////// Matx Implementation ///////////////////////////////////
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx()
+{
+    for(int i = 0; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0)
+{
+    val[0] = v0;
+    for(int i = 1; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1)
+{
+    CV_StaticAssert(channels >= 2, "Matx should have at least 2 elements.");
+    val[0] = v0; val[1] = v1;
+    for(int i = 2; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2)
+{
+    CV_StaticAssert(channels >= 3, "Matx should have at least 3 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2;
+    for(int i = 3; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3)
+{
+    CV_StaticAssert(channels >= 4, "Matx should have at least 4 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    for(int i = 4; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4)
+{
+    CV_StaticAssert(channels >= 5, "Matx should have at least 5 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3; val[4] = v4;
+    for(int i = 5; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5)
+{
+    CV_StaticAssert(channels >= 6, "Matx should have at least 6 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5;
+    for(int i = 6; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6)
+{
+    CV_StaticAssert(channels >= 7, "Matx should have at least 7 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6;
+    for(int i = 7; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7)
+{
+    CV_StaticAssert(channels >= 8, "Matx should have at least 8 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    for(int i = 8; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8)
+{
+    CV_StaticAssert(channels >= 9, "Matx should have at least 9 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8;
+    for(int i = 9; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9)
+{
+    CV_StaticAssert(channels >= 10, "Matx should have at least 10 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8; val[9] = v9;
+    for(int i = 10; i < channels; i++) val[i] = _Tp(0);
+}
+
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11)
+{
+    CV_StaticAssert(channels >= 12, "Matx should have at least 12 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
+    for(int i = 12; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13)
+{
+    CV_StaticAssert(channels == 14, "Matx should have at least 14 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
+    val[12] = v12; val[13] = v13;
+}
+
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13, _Tp v14, _Tp v15)
+{
+    CV_StaticAssert(channels >= 16, "Matx should have at least 16 elements.");
+    val[0] = v0; val[1] = v1; val[2] = v2; val[3] = v3;
+    val[4] = v4; val[5] = v5; val[6] = v6; val[7] = v7;
+    val[8] = v8; val[9] = v9; val[10] = v10; val[11] = v11;
+    val[12] = v12; val[13] = v13; val[14] = v14; val[15] = v15;
+    for(int i = 16; i < channels; i++) val[i] = _Tp(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n>::Matx(const _Tp* values)
+{
+    for( int i = 0; i < channels; i++ ) val[i] = values[i];
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n> Matx<_Tp, m, n>::all(_Tp alpha)
+{
+    Matx<_Tp, m, n> M;
+    for( int i = 0; i < m*n; i++ ) M.val[i] = alpha;
+    return M;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::zeros()
+{
+    return all(0);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::ones()
+{
+    return all(1);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::eye()
+{
+    Matx<_Tp,m,n> M;
+    for(int i = 0; i < shortdim; i++)
+        M(i,i) = 1;
+    return M;
+}
+
+template<typename _Tp, int m, int n> inline
+_Tp Matx<_Tp, m, n>::dot(const Matx<_Tp, m, n>& M) const
+{
+    _Tp s = 0;
+    for( int i = 0; i < channels; i++ ) s += val[i]*M.val[i];
+    return s;
+}
+
+template<typename _Tp, int m, int n> inline
+double Matx<_Tp, m, n>::ddot(const Matx<_Tp, m, n>& M) const
+{
+    double s = 0;
+    for( int i = 0; i < channels; i++ ) s += (double)val[i]*M.val[i];
+    return s;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const typename Matx<_Tp,m,n>::diag_type& d)
+{
+    Matx<_Tp,m,n> M;
+    for(int i = 0; i < shortdim; i++)
+        M(i,i) = d(i, 0);
+    return M;
+}
+
+template<typename _Tp, int m, int n> template<typename T2>
+inline Matx<_Tp, m, n>::operator Matx<T2, m, n>() const
+{
+    Matx<T2, m, n> M;
+    for( int i = 0; i < m*n; i++ ) M.val[i] = saturate_cast<T2>(val[i]);
+    return M;
+}
+
+template<typename _Tp, int m, int n> template<int m1, int n1> inline
+Matx<_Tp, m1, n1> Matx<_Tp, m, n>::reshape() const
+{
+    CV_StaticAssert(m1*n1 == m*n, "Input and destnarion matrices must have the same number of elements");
+    return (const Matx<_Tp, m1, n1>&)*this;
+}
+
+template<typename _Tp, int m, int n>
+template<int m1, int n1> inline
+Matx<_Tp, m1, n1> Matx<_Tp, m, n>::get_minor(int i, int j) const
+{
+    CV_DbgAssert(0 <= i && i+m1 <= m && 0 <= j && j+n1 <= n);
+    Matx<_Tp, m1, n1> s;
+    for( int di = 0; di < m1; di++ )
+        for( int dj = 0; dj < n1; dj++ )
+            s(di, dj) = (*this)(i+di, j+dj);
+    return s;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, 1, n> Matx<_Tp, m, n>::row(int i) const
+{
+    CV_DbgAssert((unsigned)i < (unsigned)m);
+    return Matx<_Tp, 1, n>(&val[i*n]);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, 1> Matx<_Tp, m, n>::col(int j) const
+{
+    CV_DbgAssert((unsigned)j < (unsigned)n);
+    Matx<_Tp, m, 1> v;
+    for( int i = 0; i < m; i++ )
+        v.val[i] = val[i*n + j];
+    return v;
+}
+
+template<typename _Tp, int m, int n> inline
+typename Matx<_Tp, m, n>::diag_type Matx<_Tp, m, n>::diag() const
+{
+    diag_type d;
+    for( int i = 0; i < shortdim; i++ )
+        d.val[i] = val[i*n + i];
+    return d;
+}
+
+template<typename _Tp, int m, int n> inline
+const _Tp& Matx<_Tp, m, n>::operator()(int i, int j) const
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)m && (unsigned)j < (unsigned)n );
+    return this->val[i*n + j];
+}
+
+template<typename _Tp, int m, int n> inline
+_Tp& Matx<_Tp, m, n>::operator ()(int i, int j)
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)m && (unsigned)j < (unsigned)n );
+    return val[i*n + j];
+}
+
+template<typename _Tp, int m, int n> inline
+const _Tp& Matx<_Tp, m, n>::operator ()(int i) const
+{
+    CV_StaticAssert(m == 1 || n == 1, "Single index indexation requires matrix to be a column or a row");
+    CV_DbgAssert( (unsigned)i < (unsigned)(m+n-1) );
+    return val[i];
+}
+
+template<typename _Tp, int m, int n> inline
+_Tp& Matx<_Tp, m, n>::operator ()(int i)
+{
+    CV_StaticAssert(m == 1 || n == 1, "Single index indexation requires matrix to be a column or a row");
+    CV_DbgAssert( (unsigned)i < (unsigned)(m+n-1) );
+    return val[i];
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_AddOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] + b.val[i]);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_SubOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] - b.val[i]);
+}
+
+template<typename _Tp, int m, int n> template<typename _T2> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, _T2 alpha, Matx_ScaleOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] * alpha);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_MulOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] * b.val[i]);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b, Matx_DivOp)
+{
+    for( int i = 0; i < channels; i++ )
+        val[i] = saturate_cast<_Tp>(a.val[i] / b.val[i]);
+}
+
+template<typename _Tp, int m, int n> template<int l> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b, Matx_MatMulOp)
+{
+    for( int i = 0; i < m; i++ )
+        for( int j = 0; j < n; j++ )
+        {
+            _Tp s = 0;
+            for( int k = 0; k < l; k++ )
+                s += a(i, k) * b(k, j);
+            val[i*n + j] = s;
+        }
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n>::Matx(const Matx<_Tp, n, m>& a, Matx_TOp)
+{
+    for( int i = 0; i < m; i++ )
+        for( int j = 0; j < n; j++ )
+            val[i*n + j] = a(j, i);
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n> Matx<_Tp, m, n>::mul(const Matx<_Tp, m, n>& a) const
+{
+    return Matx<_Tp, m, n>(*this, a, Matx_MulOp());
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n> Matx<_Tp, m, n>::div(const Matx<_Tp, m, n>& a) const
+{
+    return Matx<_Tp, m, n>(*this, a, Matx_DivOp());
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, n, m> Matx<_Tp, m, n>::t() const
+{
+    return Matx<_Tp, n, m>(*this, Matx_TOp());
+}
+
+template<typename _Tp, int m, int n> inline
+Vec<_Tp, n> Matx<_Tp, m, n>::solve(const Vec<_Tp, m>& rhs, int method) const
+{
+    Matx<_Tp, n, 1> x = solve((const Matx<_Tp, m, 1>&)(rhs), method);
+    return (Vec<_Tp, n>&)(x);
+}
+
+template<typename _Tp, int m> static inline
+double determinant(const Matx<_Tp, m, m>& a)
+{
+    return cv::internal::Matx_DetOp<_Tp, m>()(a);
+}
+
+template<typename _Tp, int m, int n> static inline
+double trace(const Matx<_Tp, m, n>& a)
+{
+    _Tp s = 0;
+    for( int i = 0; i < std::min(m, n); i++ )
+        s += a(i,i);
+    return s;
+}
+
+template<typename _Tp, int m, int n> static inline
+double norm(const Matx<_Tp, m, n>& M)
+{
+    return std::sqrt(normL2Sqr<_Tp, double>(M.val, m*n));
+}
+
+template<typename _Tp, int m, int n> static inline
+double norm(const Matx<_Tp, m, n>& M, int normType)
+{
+    switch(normType) {
+    case NORM_INF:
+        return (double)normInf<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
+    case NORM_L1:
+        return (double)normL1<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
+    case NORM_L2SQR:
+        return (double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n);
+    default:
+    case NORM_L2:
+        return std::sqrt((double)normL2Sqr<_Tp, typename DataType<_Tp>::work_type>(M.val, m*n));
+    }
+}
+
+
+
+//////////////////////////////// matx comma initializer //////////////////////////////////
+
+template<typename _Tp, typename _T2, int m, int n> static inline
+MatxCommaInitializer<_Tp, m, n> operator << (const Matx<_Tp, m, n>& mtx, _T2 val)
+{
+    MatxCommaInitializer<_Tp, m, n> commaInitializer((Matx<_Tp, m, n>*)&mtx);
+    return (commaInitializer, val);
+}
+
+template<typename _Tp, int m, int n> inline
+MatxCommaInitializer<_Tp, m, n>::MatxCommaInitializer(Matx<_Tp, m, n>* _mtx)
+    : dst(_mtx), idx(0)
+{}
+
+template<typename _Tp, int m, int n> template<typename _T2> inline
+MatxCommaInitializer<_Tp, m, n>& MatxCommaInitializer<_Tp, m, n>::operator , (_T2 value)
+{
+    CV_DbgAssert( idx < m*n );
+    dst->val[idx++] = saturate_cast<_Tp>(value);
+    return *this;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, m, n> MatxCommaInitializer<_Tp, m, n>::operator *() const
+{
+    CV_DbgAssert( idx == n*m );
+    return *dst;
+}
+
+
+
+/////////////////////////////////// Vec Implementation ///////////////////////////////////
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec() {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0)
+    : Matx<_Tp, cn, 1>(v0) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1)
+    : Matx<_Tp, cn, 1>(v0, v1) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2)
+    : Matx<_Tp, cn, 1>(v0, v1, v2) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(_Tp v0, _Tp v1, _Tp v2, _Tp v3, _Tp v4, _Tp v5, _Tp v6, _Tp v7, _Tp v8, _Tp v9, _Tp v10, _Tp v11, _Tp v12, _Tp v13)
+    : Matx<_Tp, cn, 1>(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(const _Tp* values)
+    : Matx<_Tp, cn, 1>(values) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(const Vec<_Tp, cn>& m)
+    : Matx<_Tp, cn, 1>(m.val) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_AddOp op)
+    : Matx<_Tp, cn, 1>(a, b, op) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, const Matx<_Tp, cn, 1>& b, Matx_SubOp op)
+    : Matx<_Tp, cn, 1>(a, b, op) {}
+
+template<typename _Tp, int cn> template<typename _T2> inline
+Vec<_Tp, cn>::Vec(const Matx<_Tp, cn, 1>& a, _T2 alpha, Matx_ScaleOp op)
+    : Matx<_Tp, cn, 1>(a, alpha, op) {}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> Vec<_Tp, cn>::all(_Tp alpha)
+{
+    Vec v;
+    for( int i = 0; i < cn; i++ ) v.val[i] = alpha;
+    return v;
+}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> Vec<_Tp, cn>::mul(const Vec<_Tp, cn>& v) const
+{
+    Vec<_Tp, cn> w;
+    for( int i = 0; i < cn; i++ ) w.val[i] = saturate_cast<_Tp>(this->val[i]*v.val[i]);
+    return w;
+}
+
+template<> inline
+Vec<float, 2> Vec<float, 2>::conj() const
+{
+    return cv::internal::conjugate(*this);
+}
+
+template<> inline
+Vec<double, 2> Vec<double, 2>::conj() const
+{
+    return cv::internal::conjugate(*this);
+}
+
+template<> inline
+Vec<float, 4> Vec<float, 4>::conj() const
+{
+    return cv::internal::conjugate(*this);
+}
+
+template<> inline
+Vec<double, 4> Vec<double, 4>::conj() const
+{
+    return cv::internal::conjugate(*this);
+}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> Vec<_Tp, cn>::cross(const Vec<_Tp, cn>&) const
+{
+    CV_StaticAssert(cn == 3, "for arbitrary-size vector there is no cross-product defined");
+    return Vec<_Tp, cn>();
+}
+
+template<> inline
+Vec<float, 3> Vec<float, 3>::cross(const Vec<float, 3>& v) const
+{
+    return Vec<float,3>(val[1]*v.val[2] - val[2]*v.val[1],
+                     val[2]*v.val[0] - val[0]*v.val[2],
+                     val[0]*v.val[1] - val[1]*v.val[0]);
+}
+
+template<> inline
+Vec<double, 3> Vec<double, 3>::cross(const Vec<double, 3>& v) const
+{
+    return Vec<double,3>(val[1]*v.val[2] - val[2]*v.val[1],
+                     val[2]*v.val[0] - val[0]*v.val[2],
+                     val[0]*v.val[1] - val[1]*v.val[0]);
+}
+
+template<typename _Tp, int cn> template<typename T2> inline
+Vec<_Tp, cn>::operator Vec<T2, cn>() const
+{
+    Vec<T2, cn> v;
+    for( int i = 0; i < cn; i++ ) v.val[i] = saturate_cast<T2>(this->val[i]);
+    return v;
+}
+
+template<typename _Tp, int cn> inline
+const _Tp& Vec<_Tp, cn>::operator [](int i) const
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)cn );
+    return this->val[i];
+}
+
+template<typename _Tp, int cn> inline
+_Tp& Vec<_Tp, cn>::operator [](int i)
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)cn );
+    return this->val[i];
+}
+
+template<typename _Tp, int cn> inline
+const _Tp& Vec<_Tp, cn>::operator ()(int i) const
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)cn );
+    return this->val[i];
+}
+
+template<typename _Tp, int cn> inline
+_Tp& Vec<_Tp, cn>::operator ()(int i)
+{
+    CV_DbgAssert( (unsigned)i < (unsigned)cn );
+    return this->val[i];
+}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> normalize(const Vec<_Tp, cn>& v)
+{
+    double nv = norm(v);
+    return v * (nv ? 1./nv : 0.);
+}
+
+
+
+//////////////////////////////// matx comma initializer //////////////////////////////////
+
+
+template<typename _Tp, typename _T2, int cn> static inline
+VecCommaInitializer<_Tp, cn> operator << (const Vec<_Tp, cn>& vec, _T2 val)
+{
+    VecCommaInitializer<_Tp, cn> commaInitializer((Vec<_Tp, cn>*)&vec);
+    return (commaInitializer, val);
+}
+
+template<typename _Tp, int cn> inline
+VecCommaInitializer<_Tp, cn>::VecCommaInitializer(Vec<_Tp, cn>* _vec)
+    : MatxCommaInitializer<_Tp, cn, 1>(_vec)
+{}
+
+template<typename _Tp, int cn> template<typename _T2> inline
+VecCommaInitializer<_Tp, cn>& VecCommaInitializer<_Tp, cn>::operator , (_T2 value)
+{
+    CV_DbgAssert( this->idx < cn );
+    this->dst->val[this->idx++] = saturate_cast<_Tp>(value);
+    return *this;
+}
+
+template<typename _Tp, int cn> inline
+Vec<_Tp, cn> VecCommaInitializer<_Tp, cn>::operator *() const
+{
+    CV_DbgAssert( this->idx == cn );
+    return *this->dst;
+}
+
+//! @endcond
+
+///////////////////////////// Matx out-of-class operators ////////////////////////////////
+
+//! @relates cv::Matx
+//! @{
+
+template<typename _Tp1, typename _Tp2, int m, int n> static inline
+Matx<_Tp1, m, n>& operator += (Matx<_Tp1, m, n>& a, const Matx<_Tp2, m, n>& b)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp1>(a.val[i] + b.val[i]);
+    return a;
+}
+
+template<typename _Tp1, typename _Tp2, int m, int n> static inline
+Matx<_Tp1, m, n>& operator -= (Matx<_Tp1, m, n>& a, const Matx<_Tp2, m, n>& b)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp1>(a.val[i] - b.val[i]);
+    return a;
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator + (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b)
+{
+    return Matx<_Tp, m, n>(a, b, Matx_AddOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator - (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b)
+{
+    return Matx<_Tp, m, n>(a, b, Matx_SubOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, int alpha)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha);
+    return a;
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, float alpha)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha);
+    return a;
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n>& operator *= (Matx<_Tp, m, n>& a, double alpha)
+{
+    for( int i = 0; i < m*n; i++ )
+        a.val[i] = saturate_cast<_Tp>(a.val[i] * alpha);
+    return a;
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, int alpha)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, float alpha)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (const Matx<_Tp, m, n>& a, double alpha)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (int alpha, const Matx<_Tp, m, n>& a)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (float alpha, const Matx<_Tp, m, n>& a)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator * (double alpha, const Matx<_Tp, m, n>& a)
+{
+    return Matx<_Tp, m, n>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Matx<_Tp, m, n> operator - (const Matx<_Tp, m, n>& a)
+{
+    return Matx<_Tp, m, n>(a, -1, Matx_ScaleOp());
+}
+
+template<typename _Tp, int m, int n, int l> static inline
+Matx<_Tp, m, n> operator * (const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b)
+{
+    return Matx<_Tp, m, n>(a, b, Matx_MatMulOp());
+}
+
+template<typename _Tp, int m, int n> static inline
+Vec<_Tp, m> operator * (const Matx<_Tp, m, n>& a, const Vec<_Tp, n>& b)
+{
+    Matx<_Tp, m, 1> c(a, b, Matx_MatMulOp());
+    return (const Vec<_Tp, m>&)(c);
+}
+
+template<typename _Tp, int m, int n> static inline
+bool operator == (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b)
+{
+    for( int i = 0; i < m*n; i++ )
+        if( a.val[i] != b.val[i] ) return false;
+    return true;
+}
+
+template<typename _Tp, int m, int n> static inline
+bool operator != (const Matx<_Tp, m, n>& a, const Matx<_Tp, m, n>& b)
+{
+    return !(a == b);
+}
+
+//! @}
+
+////////////////////////////// Vec out-of-class operators ////////////////////////////////
+
+//! @relates cv::Vec
+//! @{
+
+template<typename _Tp1, typename _Tp2, int cn> static inline
+Vec<_Tp1, cn>& operator += (Vec<_Tp1, cn>& a, const Vec<_Tp2, cn>& b)
+{
+    for( int i = 0; i < cn; i++ )
+        a.val[i] = saturate_cast<_Tp1>(a.val[i] + b.val[i]);
+    return a;
+}
+
+template<typename _Tp1, typename _Tp2, int cn> static inline
+Vec<_Tp1, cn>& operator -= (Vec<_Tp1, cn>& a, const Vec<_Tp2, cn>& b)
+{
+    for( int i = 0; i < cn; i++ )
+        a.val[i] = saturate_cast<_Tp1>(a.val[i] - b.val[i]);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator + (const Vec<_Tp, cn>& a, const Vec<_Tp, cn>& b)
+{
+    return Vec<_Tp, cn>(a, b, Matx_AddOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator - (const Vec<_Tp, cn>& a, const Vec<_Tp, cn>& b)
+{
+    return Vec<_Tp, cn>(a, b, Matx_SubOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, int alpha)
+{
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*alpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, float alpha)
+{
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*alpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator *= (Vec<_Tp, cn>& a, double alpha)
+{
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*alpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, int alpha)
+{
+    double ialpha = 1./alpha;
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*ialpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, float alpha)
+{
+    float ialpha = 1.f/alpha;
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*ialpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn>& operator /= (Vec<_Tp, cn>& a, double alpha)
+{
+    double ialpha = 1./alpha;
+    for( int i = 0; i < cn; i++ )
+        a[i] = saturate_cast<_Tp>(a[i]*ialpha);
+    return a;
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, int alpha)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (int alpha, const Vec<_Tp, cn>& a)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, float alpha)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (float alpha, const Vec<_Tp, cn>& a)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (const Vec<_Tp, cn>& a, double alpha)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator * (double alpha, const Vec<_Tp, cn>& a)
+{
+    return Vec<_Tp, cn>(a, alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, int alpha)
+{
+    return Vec<_Tp, cn>(a, 1./alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, float alpha)
+{
+    return Vec<_Tp, cn>(a, 1.f/alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator / (const Vec<_Tp, cn>& a, double alpha)
+{
+    return Vec<_Tp, cn>(a, 1./alpha, Matx_ScaleOp());
+}
+
+template<typename _Tp, int cn> static inline
+Vec<_Tp, cn> operator - (const Vec<_Tp, cn>& a)
+{
+    Vec<_Tp,cn> t;
+    for( int i = 0; i < cn; i++ ) t.val[i] = saturate_cast<_Tp>(-a.val[i]);
+    return t;
+}
+
+template<typename _Tp> inline Vec<_Tp, 4> operator * (const Vec<_Tp, 4>& v1, const Vec<_Tp, 4>& v2)
+{
+    return Vec<_Tp, 4>(saturate_cast<_Tp>(v1[0]*v2[0] - v1[1]*v2[1] - v1[2]*v2[2] - v1[3]*v2[3]),
+                       saturate_cast<_Tp>(v1[0]*v2[1] + v1[1]*v2[0] + v1[2]*v2[3] - v1[3]*v2[2]),
+                       saturate_cast<_Tp>(v1[0]*v2[2] - v1[1]*v2[3] + v1[2]*v2[0] + v1[3]*v2[1]),
+                       saturate_cast<_Tp>(v1[0]*v2[3] + v1[1]*v2[2] - v1[2]*v2[1] + v1[3]*v2[0]));
+}
+
+template<typename _Tp> inline Vec<_Tp, 4>& operator *= (Vec<_Tp, 4>& v1, const Vec<_Tp, 4>& v2)
+{
+    v1 = v1 * v2;
+    return v1;
+}
+
+//! @}
+
+} // cv
+
+#endif // __OPENCV_CORE_MATX_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp
new file mode 100644
index 0000000..adb750f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/neon_utils.hpp
@@ -0,0 +1,128 @@
+/*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) 2015, Itseez 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*/
+
+#ifndef __OPENCV_HAL_NEON_UTILS_HPP__
+#define __OPENCV_HAL_NEON_UTILS_HPP__
+
+#include "opencv2/core/cvdef.h"
+
+//! @addtogroup core_utils_neon
+//! @{
+
+#if CV_NEON
+
+inline int32x2_t cv_vrnd_s32_f32(float32x2_t v)
+{
+    static int32x2_t v_sign = vdup_n_s32(1 << 31),
+        v_05 = vreinterpret_s32_f32(vdup_n_f32(0.5f));
+
+    int32x2_t v_addition = vorr_s32(v_05, vand_s32(v_sign, vreinterpret_s32_f32(v)));
+    return vcvt_s32_f32(vadd_f32(v, vreinterpret_f32_s32(v_addition)));
+}
+
+inline int32x4_t cv_vrndq_s32_f32(float32x4_t v)
+{
+    static int32x4_t v_sign = vdupq_n_s32(1 << 31),
+        v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f));
+
+    int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(v)));
+    return vcvtq_s32_f32(vaddq_f32(v, vreinterpretq_f32_s32(v_addition)));
+}
+
+inline uint32x2_t cv_vrnd_u32_f32(float32x2_t v)
+{
+    static float32x2_t v_05 = vdup_n_f32(0.5f);
+    return vcvt_u32_f32(vadd_f32(v, v_05));
+}
+
+inline uint32x4_t cv_vrndq_u32_f32(float32x4_t v)
+{
+    static float32x4_t v_05 = vdupq_n_f32(0.5f);
+    return vcvtq_u32_f32(vaddq_f32(v, v_05));
+}
+
+inline float32x4_t cv_vrecpq_f32(float32x4_t val)
+{
+    float32x4_t reciprocal = vrecpeq_f32(val);
+    reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal);
+    reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal);
+    return reciprocal;
+}
+
+inline float32x2_t cv_vrecp_f32(float32x2_t val)
+{
+    float32x2_t reciprocal = vrecpe_f32(val);
+    reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal);
+    reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal);
+    return reciprocal;
+}
+
+inline float32x4_t cv_vrsqrtq_f32(float32x4_t val)
+{
+    float32x4_t e = vrsqrteq_f32(val);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e);
+    e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e);
+    return e;
+}
+
+inline float32x2_t cv_vrsqrt_f32(float32x2_t val)
+{
+    float32x2_t e = vrsqrte_f32(val);
+    e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e);
+    e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e);
+    return e;
+}
+
+inline float32x4_t cv_vsqrtq_f32(float32x4_t val)
+{
+    return cv_vrecpq_f32(cv_vrsqrtq_f32(val));
+}
+
+inline float32x2_t cv_vsqrt_f32(float32x2_t val)
+{
+    return cv_vrecp_f32(cv_vrsqrt_f32(val));
+}
+
+#endif
+
+//! @}
+
+#endif // __OPENCV_HAL_NEON_UTILS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp
new file mode 100644
index 0000000..bc989a3
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/ocl.hpp
@@ -0,0 +1,743 @@
+/*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) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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 OpenCV Foundation 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*/
+
+#ifndef __OPENCV_OPENCL_HPP__
+#define __OPENCV_OPENCL_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv { namespace ocl {
+
+//! @addtogroup core_opencl
+//! @{
+
+CV_EXPORTS_W bool haveOpenCL();
+CV_EXPORTS_W bool useOpenCL();
+CV_EXPORTS_W bool haveAmdBlas();
+CV_EXPORTS_W bool haveAmdFft();
+CV_EXPORTS_W void setUseOpenCL(bool flag);
+CV_EXPORTS_W void finish();
+
+CV_EXPORTS bool haveSVM();
+
+class CV_EXPORTS Context;
+class CV_EXPORTS Device;
+class CV_EXPORTS Kernel;
+class CV_EXPORTS Program;
+class CV_EXPORTS ProgramSource;
+class CV_EXPORTS Queue;
+class CV_EXPORTS PlatformInfo;
+class CV_EXPORTS Image2D;
+
+class CV_EXPORTS Device
+{
+public:
+    Device();
+    explicit Device(void* d);
+    Device(const Device& d);
+    Device& operator = (const Device& d);
+    ~Device();
+
+    void set(void* d);
+
+    enum
+    {
+        TYPE_DEFAULT     = (1 << 0),
+        TYPE_CPU         = (1 << 1),
+        TYPE_GPU         = (1 << 2),
+        TYPE_ACCELERATOR = (1 << 3),
+        TYPE_DGPU        = TYPE_GPU + (1 << 16),
+        TYPE_IGPU        = TYPE_GPU + (1 << 17),
+        TYPE_ALL         = 0xFFFFFFFF
+    };
+
+    String name() const;
+    String extensions() const;
+    String version() const;
+    String vendorName() const;
+    String OpenCL_C_Version() const;
+    String OpenCLVersion() const;
+    int deviceVersionMajor() const;
+    int deviceVersionMinor() const;
+    String driverVersion() const;
+    void* ptr() const;
+
+    int type() const;
+
+    int addressBits() const;
+    bool available() const;
+    bool compilerAvailable() const;
+    bool linkerAvailable() const;
+
+    enum
+    {
+        FP_DENORM=(1 << 0),
+        FP_INF_NAN=(1 << 1),
+        FP_ROUND_TO_NEAREST=(1 << 2),
+        FP_ROUND_TO_ZERO=(1 << 3),
+        FP_ROUND_TO_INF=(1 << 4),
+        FP_FMA=(1 << 5),
+        FP_SOFT_FLOAT=(1 << 6),
+        FP_CORRECTLY_ROUNDED_DIVIDE_SQRT=(1 << 7)
+    };
+    int doubleFPConfig() const;
+    int singleFPConfig() const;
+    int halfFPConfig() const;
+
+    bool endianLittle() const;
+    bool errorCorrectionSupport() const;
+
+    enum
+    {
+        EXEC_KERNEL=(1 << 0),
+        EXEC_NATIVE_KERNEL=(1 << 1)
+    };
+    int executionCapabilities() const;
+
+    size_t globalMemCacheSize() const;
+
+    enum
+    {
+        NO_CACHE=0,
+        READ_ONLY_CACHE=1,
+        READ_WRITE_CACHE=2
+    };
+    int globalMemCacheType() const;
+    int globalMemCacheLineSize() const;
+    size_t globalMemSize() const;
+
+    size_t localMemSize() const;
+    enum
+    {
+        NO_LOCAL_MEM=0,
+        LOCAL_IS_LOCAL=1,
+        LOCAL_IS_GLOBAL=2
+    };
+    int localMemType() const;
+    bool hostUnifiedMemory() const;
+
+    bool imageSupport() const;
+
+    bool imageFromBufferSupport() const;
+    uint imagePitchAlignment() const;
+    uint imageBaseAddressAlignment() const;
+
+    size_t image2DMaxWidth() const;
+    size_t image2DMaxHeight() const;
+
+    size_t image3DMaxWidth() const;
+    size_t image3DMaxHeight() const;
+    size_t image3DMaxDepth() const;
+
+    size_t imageMaxBufferSize() const;
+    size_t imageMaxArraySize() const;
+
+    enum
+    {
+        UNKNOWN_VENDOR=0,
+        VENDOR_AMD=1,
+        VENDOR_INTEL=2,
+        VENDOR_NVIDIA=3
+    };
+    int vendorID() const;
+    // FIXIT
+    // dev.isAMD() doesn't work for OpenCL CPU devices from AMD OpenCL platform.
+    // This method should use platform name instead of vendor name.
+    // After fix restore code in arithm.cpp: ocl_compare()
+    inline bool isAMD() const { return vendorID() == VENDOR_AMD; }
+    inline bool isIntel() const { return vendorID() == VENDOR_INTEL; }
+    inline bool isNVidia() const { return vendorID() == VENDOR_NVIDIA; }
+
+    int maxClockFrequency() const;
+    int maxComputeUnits() const;
+    int maxConstantArgs() const;
+    size_t maxConstantBufferSize() const;
+
+    size_t maxMemAllocSize() const;
+    size_t maxParameterSize() const;
+
+    int maxReadImageArgs() const;
+    int maxWriteImageArgs() const;
+    int maxSamplers() const;
+
+    size_t maxWorkGroupSize() const;
+    int maxWorkItemDims() const;
+    void maxWorkItemSizes(size_t*) const;
+
+    int memBaseAddrAlign() const;
+
+    int nativeVectorWidthChar() const;
+    int nativeVectorWidthShort() const;
+    int nativeVectorWidthInt() const;
+    int nativeVectorWidthLong() const;
+    int nativeVectorWidthFloat() const;
+    int nativeVectorWidthDouble() const;
+    int nativeVectorWidthHalf() const;
+
+    int preferredVectorWidthChar() const;
+    int preferredVectorWidthShort() const;
+    int preferredVectorWidthInt() const;
+    int preferredVectorWidthLong() const;
+    int preferredVectorWidthFloat() const;
+    int preferredVectorWidthDouble() const;
+    int preferredVectorWidthHalf() const;
+
+    size_t printfBufferSize() const;
+    size_t profilingTimerResolution() const;
+
+    static const Device& getDefault();
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+
+class CV_EXPORTS Context
+{
+public:
+    Context();
+    explicit Context(int dtype);
+    ~Context();
+    Context(const Context& c);
+    Context& operator = (const Context& c);
+
+    bool create();
+    bool create(int dtype);
+    size_t ndevices() const;
+    const Device& device(size_t idx) const;
+    Program getProg(const ProgramSource& prog,
+                    const String& buildopt, String& errmsg);
+
+    static Context& getDefault(bool initialize = true);
+    void* ptr() const;
+
+    friend void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device);
+
+    bool useSVM() const;
+    void setUseSVM(bool enabled);
+
+    struct Impl;
+    Impl* p;
+};
+
+class CV_EXPORTS Platform
+{
+public:
+    Platform();
+    ~Platform();
+    Platform(const Platform& p);
+    Platform& operator = (const Platform& p);
+
+    void* ptr() const;
+    static Platform& getDefault();
+
+    friend void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device);
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+/*
+//! @brief Attaches OpenCL context to OpenCV
+//
+//! @note Note:
+//    OpenCV will check if available OpenCL platform has platformName name,
+//    then assign context to OpenCV and call clRetainContext function.
+//    The deviceID device will be used as target device and new command queue
+//    will be created.
+//
+// Params:
+//! @param platformName - name of OpenCL platform to attach,
+//!                       this string is used to check if platform is available
+//!                       to OpenCV at runtime
+//! @param platfromID   - ID of platform attached context was created for
+//! @param context      - OpenCL context to be attached to OpenCV
+//! @param deviceID     - ID of device, must be created from attached context
+*/
+CV_EXPORTS void attachContext(const String& platformName, void* platformID, void* context, void* deviceID);
+
+/*
+//! @brief Convert OpenCL buffer to UMat
+//
+//! @note Note:
+//   OpenCL buffer (cl_mem_buffer) should contain 2D image data, compatible with OpenCV.
+//   Memory content is not copied from clBuffer to UMat. Instead, buffer handle assigned
+//   to UMat and clRetainMemObject is called.
+//
+// Params:
+//! @param  cl_mem_buffer - source clBuffer handle
+//! @param  step          - num of bytes in single row
+//! @param  rows          - number of rows
+//! @param  cols          - number of cols
+//! @param  type          - OpenCV type of image
+//! @param  dst           - destination UMat
+*/
+CV_EXPORTS void convertFromBuffer(void* cl_mem_buffer, size_t step, int rows, int cols, int type, UMat& dst);
+
+/*
+//! @brief Convert OpenCL image2d_t to UMat
+//
+//! @note Note:
+//   OpenCL image2d_t (cl_mem_image), should be compatible with OpenCV
+//   UMat formats.
+//   Memory content is copied from image to UMat with
+//   clEnqueueCopyImageToBuffer function.
+//
+// Params:
+//! @param  cl_mem_image - source image2d_t handle
+//! @param  dst          - destination UMat
+*/
+CV_EXPORTS void convertFromImage(void* cl_mem_image, UMat& dst);
+
+// TODO Move to internal header
+void initializeContextFromHandle(Context& ctx, void* platform, void* context, void* device);
+
+class CV_EXPORTS Queue
+{
+public:
+    Queue();
+    explicit Queue(const Context& c, const Device& d=Device());
+    ~Queue();
+    Queue(const Queue& q);
+    Queue& operator = (const Queue& q);
+
+    bool create(const Context& c=Context(), const Device& d=Device());
+    void finish();
+    void* ptr() const;
+    static Queue& getDefault();
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+
+class CV_EXPORTS KernelArg
+{
+public:
+    enum { LOCAL=1, READ_ONLY=2, WRITE_ONLY=4, READ_WRITE=6, CONSTANT=8, PTR_ONLY = 16, NO_SIZE=256 };
+    KernelArg(int _flags, UMat* _m, int wscale=1, int iwscale=1, const void* _obj=0, size_t _sz=0);
+    KernelArg();
+
+    static KernelArg Local() { return KernelArg(LOCAL, 0); }
+    static KernelArg PtrWriteOnly(const UMat& m)
+    { return KernelArg(PTR_ONLY+WRITE_ONLY, (UMat*)&m); }
+    static KernelArg PtrReadOnly(const UMat& m)
+    { return KernelArg(PTR_ONLY+READ_ONLY, (UMat*)&m); }
+    static KernelArg PtrReadWrite(const UMat& m)
+    { return KernelArg(PTR_ONLY+READ_WRITE, (UMat*)&m); }
+    static KernelArg ReadWrite(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(READ_WRITE, (UMat*)&m, wscale, iwscale); }
+    static KernelArg ReadWriteNoSize(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(READ_WRITE+NO_SIZE, (UMat*)&m, wscale, iwscale); }
+    static KernelArg ReadOnly(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(READ_ONLY, (UMat*)&m, wscale, iwscale); }
+    static KernelArg WriteOnly(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(WRITE_ONLY, (UMat*)&m, wscale, iwscale); }
+    static KernelArg ReadOnlyNoSize(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(READ_ONLY+NO_SIZE, (UMat*)&m, wscale, iwscale); }
+    static KernelArg WriteOnlyNoSize(const UMat& m, int wscale=1, int iwscale=1)
+    { return KernelArg(WRITE_ONLY+NO_SIZE, (UMat*)&m, wscale, iwscale); }
+    static KernelArg Constant(const Mat& m);
+    template<typename _Tp> static KernelArg Constant(const _Tp* arr, size_t n)
+    { return KernelArg(CONSTANT, 0, 1, 1, (void*)arr, n); }
+
+    int flags;
+    UMat* m;
+    const void* obj;
+    size_t sz;
+    int wscale, iwscale;
+};
+
+
+class CV_EXPORTS Kernel
+{
+public:
+    Kernel();
+    Kernel(const char* kname, const Program& prog);
+    Kernel(const char* kname, const ProgramSource& prog,
+           const String& buildopts = String(), String* errmsg=0);
+    ~Kernel();
+    Kernel(const Kernel& k);
+    Kernel& operator = (const Kernel& k);
+
+    bool empty() const;
+    bool create(const char* kname, const Program& prog);
+    bool create(const char* kname, const ProgramSource& prog,
+                const String& buildopts, String* errmsg=0);
+
+    int set(int i, const void* value, size_t sz);
+    int set(int i, const Image2D& image2D);
+    int set(int i, const UMat& m);
+    int set(int i, const KernelArg& arg);
+    template<typename _Tp> int set(int i, const _Tp& value)
+    { return set(i, &value, sizeof(value)); }
+
+    template<typename _Tp0>
+    Kernel& args(const _Tp0& a0)
+    {
+        set(0, a0); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1)
+    {
+        int i = set(0, a0); set(i, a1); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2)
+    {
+        int i = set(0, a0); i = set(i, a1); set(i, a2); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2,
+                 const _Tp3& a3, const _Tp4& a4)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2);
+        i = set(i, a3); set(i, a4); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2,
+             typename _Tp3, typename _Tp4, typename _Tp5>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2,
+                 const _Tp3& a3, const _Tp4& a4, const _Tp5& a5)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2);
+        i = set(i, a3); i = set(i, a4); set(i, a5); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3);
+        i = set(i, a4); i = set(i, a5); set(i, a6); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3);
+        i = set(i, a4); i = set(i, a5); i = set(i, a6); set(i, a7); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4,
+             typename _Tp5, typename _Tp6, typename _Tp7, typename _Tp8>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4);
+        i = set(i, a5); i = set(i, a6); i = set(i, a7); set(i, a8); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4,
+             typename _Tp5, typename _Tp6, typename _Tp7, typename _Tp8, typename _Tp9>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); set(i, a9); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); set(i, a10); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); set(i, a11); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11, typename _Tp12>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11,
+                 const _Tp12& a12)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
+        set(i, a12); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11, typename _Tp12,
+             typename _Tp13>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11,
+                 const _Tp12& a12, const _Tp13& a13)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
+        i = set(i, a12); set(i, a13); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11, typename _Tp12,
+             typename _Tp13, typename _Tp14>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11,
+                 const _Tp12& a12, const _Tp13& a13, const _Tp14& a14)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
+        i = set(i, a12); i = set(i, a13); set(i, a14); return *this;
+    }
+
+    template<typename _Tp0, typename _Tp1, typename _Tp2, typename _Tp3,
+             typename _Tp4, typename _Tp5, typename _Tp6, typename _Tp7,
+             typename _Tp8, typename _Tp9, typename _Tp10, typename _Tp11, typename _Tp12,
+             typename _Tp13, typename _Tp14, typename _Tp15>
+    Kernel& args(const _Tp0& a0, const _Tp1& a1, const _Tp2& a2, const _Tp3& a3,
+                 const _Tp4& a4, const _Tp5& a5, const _Tp6& a6, const _Tp7& a7,
+                 const _Tp8& a8, const _Tp9& a9, const _Tp10& a10, const _Tp11& a11,
+                 const _Tp12& a12, const _Tp13& a13, const _Tp14& a14, const _Tp15& a15)
+    {
+        int i = set(0, a0); i = set(i, a1); i = set(i, a2); i = set(i, a3); i = set(i, a4); i = set(i, a5);
+        i = set(i, a6); i = set(i, a7); i = set(i, a8); i = set(i, a9); i = set(i, a10); i = set(i, a11);
+        i = set(i, a12); i = set(i, a13); i = set(i, a14); set(i, a15); return *this;
+    }
+
+    bool run(int dims, size_t globalsize[],
+             size_t localsize[], bool sync, const Queue& q=Queue());
+    bool runTask(bool sync, const Queue& q=Queue());
+
+    size_t workGroupSize() const;
+    size_t preferedWorkGroupSizeMultiple() const;
+    bool compileWorkGroupSize(size_t wsz[]) const;
+    size_t localMemSize() const;
+
+    void* ptr() const;
+    struct Impl;
+
+protected:
+    Impl* p;
+};
+
+class CV_EXPORTS Program
+{
+public:
+    Program();
+    Program(const ProgramSource& src,
+            const String& buildflags, String& errmsg);
+    explicit Program(const String& buf);
+    Program(const Program& prog);
+
+    Program& operator = (const Program& prog);
+    ~Program();
+
+    bool create(const ProgramSource& src,
+                const String& buildflags, String& errmsg);
+    bool read(const String& buf, const String& buildflags);
+    bool write(String& buf) const;
+
+    const ProgramSource& source() const;
+    void* ptr() const;
+
+    String getPrefix() const;
+    static String getPrefix(const String& buildflags);
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+
+class CV_EXPORTS ProgramSource
+{
+public:
+    typedef uint64 hash_t;
+
+    ProgramSource();
+    explicit ProgramSource(const String& prog);
+    explicit ProgramSource(const char* prog);
+    ~ProgramSource();
+    ProgramSource(const ProgramSource& prog);
+    ProgramSource& operator = (const ProgramSource& prog);
+
+    const String& source() const;
+    hash_t hash() const;
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+class CV_EXPORTS PlatformInfo
+{
+public:
+    PlatformInfo();
+    explicit PlatformInfo(void* id);
+    ~PlatformInfo();
+
+    PlatformInfo(const PlatformInfo& i);
+    PlatformInfo& operator =(const PlatformInfo& i);
+
+    String name() const;
+    String vendor() const;
+    String version() const;
+    int deviceNumber() const;
+    void getDevice(Device& device, int d) const;
+
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+CV_EXPORTS const char* convertTypeStr(int sdepth, int ddepth, int cn, char* buf);
+CV_EXPORTS const char* typeToStr(int t);
+CV_EXPORTS const char* memopTypeToStr(int t);
+CV_EXPORTS const char* vecopTypeToStr(int t);
+CV_EXPORTS String kernelToStr(InputArray _kernel, int ddepth = -1, const char * name = NULL);
+CV_EXPORTS void getPlatfomsInfo(std::vector<PlatformInfo>& platform_info);
+
+
+enum OclVectorStrategy
+{
+    // all matrices have its own vector width
+    OCL_VECTOR_OWN = 0,
+    // all matrices have maximal vector width among all matrices
+    // (useful for cases when matrices have different data types)
+    OCL_VECTOR_MAX = 1,
+
+    // default strategy
+    OCL_VECTOR_DEFAULT = OCL_VECTOR_OWN
+};
+
+CV_EXPORTS int predictOptimalVectorWidth(InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(),
+                                         InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
+                                         InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray(),
+                                         OclVectorStrategy strat = OCL_VECTOR_DEFAULT);
+
+CV_EXPORTS int checkOptimalVectorWidth(const int *vectorWidths,
+                                       InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(),
+                                       InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
+                                       InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray(),
+                                       OclVectorStrategy strat = OCL_VECTOR_DEFAULT);
+
+// with OCL_VECTOR_MAX strategy
+CV_EXPORTS int predictOptimalVectorWidthMax(InputArray src1, InputArray src2 = noArray(), InputArray src3 = noArray(),
+                                            InputArray src4 = noArray(), InputArray src5 = noArray(), InputArray src6 = noArray(),
+                                            InputArray src7 = noArray(), InputArray src8 = noArray(), InputArray src9 = noArray());
+
+CV_EXPORTS void buildOptionsAddMatrixDescription(String& buildOptions, const String& name, InputArray _m);
+
+class CV_EXPORTS Image2D
+{
+public:
+    Image2D();
+
+    // src:     The UMat from which to get image properties and data
+    // norm:    Flag to enable the use of normalized channel data types
+    // alias:   Flag indicating that the image should alias the src UMat.
+    //          If true, changes to the image or src will be reflected in
+    //          both objects.
+    explicit Image2D(const UMat &src, bool norm = false, bool alias = false);
+    Image2D(const Image2D & i);
+    ~Image2D();
+
+    Image2D & operator = (const Image2D & i);
+
+    // Indicates if creating an aliased image should succeed.  Depends on the
+    // underlying platform and the dimensions of the UMat.
+    static bool canCreateAlias(const UMat &u);
+
+    // Indicates if the image format is supported.
+    static bool isFormatSupported(int depth, int cn, bool norm);
+
+    void* ptr() const;
+protected:
+    struct Impl;
+    Impl* p;
+};
+
+
+CV_EXPORTS MatAllocator* getOpenCLAllocator();
+
+
+#ifdef __OPENCV_BUILD
+namespace internal {
+
+CV_EXPORTS bool isPerformanceCheckBypassed();
+#define OCL_PERFORMANCE_CHECK(condition) (cv::ocl::internal::isPerformanceCheckBypassed() || (condition))
+
+CV_EXPORTS bool isCLBuffer(UMat& u);
+
+} // namespace internal
+#endif
+
+//! @}
+
+}}
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp
new file mode 100644
index 0000000..d53bc1a
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/ocl_genbase.hpp
@@ -0,0 +1,64 @@
+/*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) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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 OpenCV Foundation 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*/
+
+#ifndef __OPENCV_OPENCL_GENBASE_HPP__
+#define __OPENCV_OPENCL_GENBASE_HPP__
+
+namespace cv
+{
+namespace ocl
+{
+
+//! @cond IGNORED
+
+struct ProgramEntry
+{
+    const char* name;
+    const char* programStr;
+    const char* programHash;
+};
+
+//! @endcond
+
+}
+}
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp
new file mode 100644
index 0000000..fd47c52
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/opengl.hpp
@@ -0,0 +1,729 @@
+/*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*/
+
+#ifndef __OPENCV_CORE_OPENGL_HPP__
+#define __OPENCV_CORE_OPENGL_HPP__
+
+#ifndef __cplusplus
+#  error opengl.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core.hpp"
+#include "ocl.hpp"
+
+namespace cv { namespace ogl {
+
+/** @addtogroup core_opengl
+This section describes OpenGL interoperability.
+
+To enable OpenGL support, configure OpenCV using CMake with WITH_OPENGL=ON . Currently OpenGL is
+supported only with WIN32, GTK and Qt backends on Windows and Linux (MacOS and Android are not
+supported). For GTK backend gtkglext-1.0 library is required.
+
+To use OpenGL functionality you should first create OpenGL context (window or frame buffer). You can
+do this with namedWindow function or with other OpenGL toolkit (GLUT, for example).
+*/
+//! @{
+
+/////////////////// OpenGL Objects ///////////////////
+
+/** @brief Smart pointer for OpenGL buffer object with reference counting.
+
+Buffer Objects are OpenGL objects that store an array of unformatted memory allocated by the OpenGL
+context. These can be used to store vertex data, pixel data retrieved from images or the
+framebuffer, and a variety of other things.
+
+ogl::Buffer has interface similar with Mat interface and represents 2D array memory.
+
+ogl::Buffer supports memory transfers between host and device and also can be mapped to CUDA memory.
+ */
+class CV_EXPORTS Buffer
+{
+public:
+    /** @brief The target defines how you intend to use the buffer object.
+    */
+    enum Target
+    {
+        ARRAY_BUFFER         = 0x8892, //!< The buffer will be used as a source for vertex data
+        ELEMENT_ARRAY_BUFFER = 0x8893, //!< The buffer will be used for indices (in glDrawElements, for example)
+        PIXEL_PACK_BUFFER    = 0x88EB, //!< The buffer will be used for reading from OpenGL textures
+        PIXEL_UNPACK_BUFFER  = 0x88EC  //!< The buffer will be used for writing to OpenGL textures
+    };
+
+    enum Access
+    {
+        READ_ONLY  = 0x88B8,
+        WRITE_ONLY = 0x88B9,
+        READ_WRITE = 0x88BA
+    };
+
+    /** @brief The constructors.
+
+    Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId
+    parameter), allocates memory for ogl::Buffer object or copies from host/device memory.
+     */
+    Buffer();
+
+    /** @overload
+    @param arows Number of rows in a 2D array.
+    @param acols Number of columns in a 2D array.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param abufId Buffer object name.
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Buffer(int arows, int acols, int atype, unsigned int abufId, bool autoRelease = false);
+
+    /** @overload
+    @param asize 2D array size.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param abufId Buffer object name.
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Buffer(Size asize, int atype, unsigned int abufId, bool autoRelease = false);
+
+    /** @overload
+    @param arows Number of rows in a 2D array.
+    @param acols Number of columns in a 2D array.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Buffer(int arows, int acols, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @overload
+    @param asize 2D array size.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Buffer(Size asize, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @overload
+    @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ).
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    explicit Buffer(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @brief Allocates memory for ogl::Buffer object.
+
+    @param arows Number of rows in a 2D array.
+    @param acols Number of columns in a 2D array.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+     */
+    void create(int arows, int acols, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @overload
+    @param asize 2D array size.
+    @param atype Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details.
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    void create(Size asize, int atype, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @brief Decrements the reference counter and destroys the buffer object if needed.
+
+    The function will call setAutoRelease(true) .
+     */
+    void release();
+
+    /** @brief Sets auto release mode.
+
+    The lifetime of the OpenGL object is tied to the lifetime of the context. If OpenGL context was
+    bound to a window it could be released at any time (user can close a window). If object's destructor
+    is called after destruction of the context it will cause an error. Thus ogl::Buffer doesn't destroy
+    OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL context).
+    This function can force ogl::Buffer destructor to destroy OpenGL object.
+    @param flag Auto release mode (if true, release will be called in object's destructor).
+     */
+    void setAutoRelease(bool flag);
+
+    /** @brief Copies from host/device memory to OpenGL buffer.
+    @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ).
+    @param target Buffer usage. See cv::ogl::Buffer::Target .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+     */
+    void copyFrom(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @overload */
+    void copyFrom(InputArray arr, cuda::Stream& stream, Target target = ARRAY_BUFFER, bool autoRelease = false);
+
+    /** @brief Copies from OpenGL buffer to host/device memory or another OpenGL buffer object.
+
+    @param arr Destination array (host or device memory, can be Mat , cuda::GpuMat , std::vector or
+    ogl::Buffer ).
+     */
+    void copyTo(OutputArray arr) const;
+
+    /** @overload */
+    void copyTo(OutputArray arr, cuda::Stream& stream) const;
+
+    /** @brief Creates a full copy of the buffer object and the underlying data.
+
+    @param target Buffer usage for destination buffer.
+    @param autoRelease Auto release mode for destination buffer.
+     */
+    Buffer clone(Target target = ARRAY_BUFFER, bool autoRelease = false) const;
+
+    /** @brief Binds OpenGL buffer to the specified buffer binding point.
+
+    @param target Binding point. See cv::ogl::Buffer::Target .
+     */
+    void bind(Target target) const;
+
+    /** @brief Unbind any buffers from the specified binding point.
+
+    @param target Binding point. See cv::ogl::Buffer::Target .
+     */
+    static void unbind(Target target);
+
+    /** @brief Maps OpenGL buffer to host memory.
+
+    mapHost maps to the client's address space the entire data store of the buffer object. The data can
+    then be directly read and/or written relative to the returned pointer, depending on the specified
+    access policy.
+
+    A mapped data store must be unmapped with ogl::Buffer::unmapHost before its buffer object is used.
+
+    This operation can lead to memory transfers between host and device.
+
+    Only one buffer object can be mapped at a time.
+    @param access Access policy, indicating whether it will be possible to read from, write to, or both
+    read from and write to the buffer object's mapped data store. The symbolic constant must be
+    ogl::Buffer::READ_ONLY , ogl::Buffer::WRITE_ONLY or ogl::Buffer::READ_WRITE .
+     */
+    Mat mapHost(Access access);
+
+    /** @brief Unmaps OpenGL buffer.
+    */
+    void unmapHost();
+
+    //! map to device memory (blocking)
+    cuda::GpuMat mapDevice();
+    void unmapDevice();
+
+    /** @brief Maps OpenGL buffer to CUDA device memory.
+
+    This operatation doesn't copy data. Several buffer objects can be mapped to CUDA memory at a time.
+
+    A mapped data store must be unmapped with ogl::Buffer::unmapDevice before its buffer object is used.
+     */
+    cuda::GpuMat mapDevice(cuda::Stream& stream);
+
+    /** @brief Unmaps OpenGL buffer.
+    */
+    void unmapDevice(cuda::Stream& stream);
+
+    int rows() const;
+    int cols() const;
+    Size size() const;
+    bool empty() const;
+
+    int type() const;
+    int depth() const;
+    int channels() const;
+    int elemSize() const;
+    int elemSize1() const;
+
+    //! get OpenGL opject id
+    unsigned int bufId() const;
+
+    class Impl;
+
+private:
+    Ptr<Impl> impl_;
+    int rows_;
+    int cols_;
+    int type_;
+};
+
+/** @brief Smart pointer for OpenGL 2D texture memory with reference counting.
+ */
+class CV_EXPORTS Texture2D
+{
+public:
+    /** @brief An Image Format describes the way that the images in Textures store their data.
+    */
+    enum Format
+    {
+        NONE            = 0,
+        DEPTH_COMPONENT = 0x1902, //!< Depth
+        RGB             = 0x1907, //!< Red, Green, Blue
+        RGBA            = 0x1908  //!< Red, Green, Blue, Alpha
+    };
+
+    /** @brief The constructors.
+
+    Creates empty ogl::Texture2D object, allocates memory for ogl::Texture2D object or copies from
+    host/device memory.
+     */
+    Texture2D();
+
+    /** @overload */
+    Texture2D(int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease = false);
+
+    /** @overload */
+    Texture2D(Size asize, Format aformat, unsigned int atexId, bool autoRelease = false);
+
+    /** @overload
+    @param arows Number of rows.
+    @param acols Number of columns.
+    @param aformat Image format. See cv::ogl::Texture2D::Format .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Texture2D(int arows, int acols, Format aformat, bool autoRelease = false);
+
+    /** @overload
+    @param asize 2D array size.
+    @param aformat Image format. See cv::ogl::Texture2D::Format .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    Texture2D(Size asize, Format aformat, bool autoRelease = false);
+
+    /** @overload
+    @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or ogl::Buffer ).
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    explicit Texture2D(InputArray arr, bool autoRelease = false);
+
+    /** @brief Allocates memory for ogl::Texture2D object.
+
+    @param arows Number of rows.
+    @param acols Number of columns.
+    @param aformat Image format. See cv::ogl::Texture2D::Format .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+     */
+    void create(int arows, int acols, Format aformat, bool autoRelease = false);
+    /** @overload
+    @param asize 2D array size.
+    @param aformat Image format. See cv::ogl::Texture2D::Format .
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+    */
+    void create(Size asize, Format aformat, bool autoRelease = false);
+
+    /** @brief Decrements the reference counter and destroys the texture object if needed.
+
+    The function will call setAutoRelease(true) .
+     */
+    void release();
+
+    /** @brief Sets auto release mode.
+
+    @param flag Auto release mode (if true, release will be called in object's destructor).
+
+    The lifetime of the OpenGL object is tied to the lifetime of the context. If OpenGL context was
+    bound to a window it could be released at any time (user can close a window). If object's destructor
+    is called after destruction of the context it will cause an error. Thus ogl::Texture2D doesn't
+    destroy OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL
+    context). This function can force ogl::Texture2D destructor to destroy OpenGL object.
+     */
+    void setAutoRelease(bool flag);
+
+    /** @brief Copies from host/device memory to OpenGL texture.
+
+    @param arr Input array (host or device memory, it can be Mat , cuda::GpuMat or ogl::Buffer ).
+    @param autoRelease Auto release mode (if true, release will be called in object's destructor).
+     */
+    void copyFrom(InputArray arr, bool autoRelease = false);
+
+    /** @brief Copies from OpenGL texture to host/device memory or another OpenGL texture object.
+
+    @param arr Destination array (host or device memory, can be Mat , cuda::GpuMat , ogl::Buffer or
+    ogl::Texture2D ).
+    @param ddepth Destination depth.
+    @param autoRelease Auto release mode for destination buffer (if arr is OpenGL buffer or texture).
+     */
+    void copyTo(OutputArray arr, int ddepth = CV_32F, bool autoRelease = false) const;
+
+    /** @brief Binds texture to current active texture unit for GL_TEXTURE_2D target.
+    */
+    void bind() const;
+
+    int rows() const;
+    int cols() const;
+    Size size() const;
+    bool empty() const;
+
+    Format format() const;
+
+    //! get OpenGL opject id
+    unsigned int texId() const;
+
+    class Impl;
+
+private:
+    Ptr<Impl> impl_;
+    int rows_;
+    int cols_;
+    Format format_;
+};
+
+/** @brief Wrapper for OpenGL Client-Side Vertex arrays.
+
+ogl::Arrays stores vertex data in ogl::Buffer objects.
+ */
+class CV_EXPORTS Arrays
+{
+public:
+    /** @brief Default constructor
+     */
+    Arrays();
+
+    /** @brief Sets an array of vertex coordinates.
+    @param vertex array with vertex coordinates, can be both host and device memory.
+    */
+    void setVertexArray(InputArray vertex);
+
+    /** @brief Resets vertex coordinates.
+    */
+    void resetVertexArray();
+
+    /** @brief Sets an array of vertex colors.
+    @param color array with vertex colors, can be both host and device memory.
+     */
+    void setColorArray(InputArray color);
+
+    /** @brief Resets vertex colors.
+    */
+    void resetColorArray();
+
+    /** @brief Sets an array of vertex normals.
+    @param normal array with vertex normals, can be both host and device memory.
+     */
+    void setNormalArray(InputArray normal);
+
+    /** @brief Resets vertex normals.
+    */
+    void resetNormalArray();
+
+    /** @brief Sets an array of vertex texture coordinates.
+    @param texCoord array with vertex texture coordinates, can be both host and device memory.
+     */
+    void setTexCoordArray(InputArray texCoord);
+
+    /** @brief Resets vertex texture coordinates.
+    */
+    void resetTexCoordArray();
+
+    /** @brief Releases all inner buffers.
+    */
+    void release();
+
+    /** @brief Sets auto release mode all inner buffers.
+    @param flag Auto release mode.
+     */
+    void setAutoRelease(bool flag);
+
+    /** @brief Binds all vertex arrays.
+    */
+    void bind() const;
+
+    /** @brief Returns the vertex count.
+    */
+    int size() const;
+    bool empty() const;
+
+private:
+    int size_;
+    Buffer vertex_;
+    Buffer color_;
+    Buffer normal_;
+    Buffer texCoord_;
+};
+
+/////////////////// Render Functions ///////////////////
+
+//! render mode
+enum RenderModes {
+    POINTS         = 0x0000,
+    LINES          = 0x0001,
+    LINE_LOOP      = 0x0002,
+    LINE_STRIP     = 0x0003,
+    TRIANGLES      = 0x0004,
+    TRIANGLE_STRIP = 0x0005,
+    TRIANGLE_FAN   = 0x0006,
+    QUADS          = 0x0007,
+    QUAD_STRIP     = 0x0008,
+    POLYGON        = 0x0009
+};
+
+/** @brief Render OpenGL texture or primitives.
+@param tex Texture to draw.
+@param wndRect Region of window, where to draw a texture (normalized coordinates).
+@param texRect Region of texture to draw (normalized coordinates).
+ */
+CV_EXPORTS void render(const Texture2D& tex,
+    Rect_<double> wndRect = Rect_<double>(0.0, 0.0, 1.0, 1.0),
+    Rect_<double> texRect = Rect_<double>(0.0, 0.0, 1.0, 1.0));
+
+/** @overload
+@param arr Array of privitives vertices.
+@param mode Render mode. One of cv::ogl::RenderModes
+@param color Color for all vertices. Will be used if arr doesn't contain color array.
+*/
+CV_EXPORTS void render(const Arrays& arr, int mode = POINTS, Scalar color = Scalar::all(255));
+
+/** @overload
+@param arr Array of privitives vertices.
+@param indices Array of vertices indices (host or device memory).
+@param mode Render mode. One of cv::ogl::RenderModes
+@param color Color for all vertices. Will be used if arr doesn't contain color array.
+*/
+CV_EXPORTS void render(const Arrays& arr, InputArray indices, int mode = POINTS, Scalar color = Scalar::all(255));
+
+/////////////////// CL-GL Interoperability Functions ///////////////////
+
+namespace ocl {
+using namespace cv::ocl;
+
+// TODO static functions in the Context class
+/** @brief Creates OpenCL context from GL.
+@return Returns reference to OpenCL Context
+ */
+CV_EXPORTS Context& initializeContextFromGL();
+
+} // namespace cv::ogl::ocl
+
+/** @brief Converts InputArray to Texture2D object.
+@param src     - source InputArray.
+@param texture - destination Texture2D object.
+ */
+CV_EXPORTS void convertToGLTexture2D(InputArray src, Texture2D& texture);
+
+/** @brief Converts Texture2D object to OutputArray.
+@param texture - source Texture2D object.
+@param dst     - destination OutputArray.
+ */
+CV_EXPORTS void convertFromGLTexture2D(const Texture2D& texture, OutputArray dst);
+
+/** @brief Maps Buffer object to process on CL side (convert to UMat).
+
+Function creates CL buffer from GL one, and then constructs UMat that can be used
+to process buffer data with OpenCV functions. Note that in current implementation
+UMat constructed this way doesn't own corresponding GL buffer object, so it is
+the user responsibility to close down CL/GL buffers relationships by explicitly
+calling unmapGLBuffer() function.
+@param buffer      - source Buffer object.
+@param accessFlags - data access flags (ACCESS_READ|ACCESS_WRITE).
+@return Returns UMat object
+ */
+CV_EXPORTS UMat mapGLBuffer(const Buffer& buffer, int accessFlags = ACCESS_READ|ACCESS_WRITE);
+
+/** @brief Unmaps Buffer object (releases UMat, previously mapped from Buffer).
+
+Function must be called explicitly by the user for each UMat previously constructed
+by the call to mapGLBuffer() function.
+@param u           - source UMat, created by mapGLBuffer().
+ */
+CV_EXPORTS void unmapGLBuffer(UMat& u);
+
+}} // namespace cv::ogl
+
+namespace cv { namespace cuda {
+
+//! @addtogroup cuda
+//! @{
+
+/** @brief Sets a CUDA device and initializes it for the current thread with OpenGL interoperability.
+
+This function should be explicitly called after OpenGL context creation and before any CUDA calls.
+@param device System index of a CUDA device starting with 0.
+@ingroup core_opengl
+ */
+CV_EXPORTS void setGlDevice(int device = 0);
+
+//! @}
+
+}}
+
+//! @cond IGNORED
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+inline
+cv::ogl::Buffer::Buffer(int arows, int acols, int atype, Target target, bool autoRelease) : rows_(0), cols_(0), type_(0)
+{
+    create(arows, acols, atype, target, autoRelease);
+}
+
+inline
+cv::ogl::Buffer::Buffer(Size asize, int atype, Target target, bool autoRelease) : rows_(0), cols_(0), type_(0)
+{
+    create(asize, atype, target, autoRelease);
+}
+
+inline
+void cv::ogl::Buffer::create(Size asize, int atype, Target target, bool autoRelease)
+{
+    create(asize.height, asize.width, atype, target, autoRelease);
+}
+
+inline
+int cv::ogl::Buffer::rows() const
+{
+    return rows_;
+}
+
+inline
+int cv::ogl::Buffer::cols() const
+{
+    return cols_;
+}
+
+inline
+cv::Size cv::ogl::Buffer::size() const
+{
+    return Size(cols_, rows_);
+}
+
+inline
+bool cv::ogl::Buffer::empty() const
+{
+    return rows_ == 0 || cols_ == 0;
+}
+
+inline
+int cv::ogl::Buffer::type() const
+{
+    return type_;
+}
+
+inline
+int cv::ogl::Buffer::depth() const
+{
+    return CV_MAT_DEPTH(type_);
+}
+
+inline
+int cv::ogl::Buffer::channels() const
+{
+    return CV_MAT_CN(type_);
+}
+
+inline
+int cv::ogl::Buffer::elemSize() const
+{
+    return CV_ELEM_SIZE(type_);
+}
+
+inline
+int cv::ogl::Buffer::elemSize1() const
+{
+    return CV_ELEM_SIZE1(type_);
+}
+
+///////
+
+inline
+cv::ogl::Texture2D::Texture2D(int arows, int acols, Format aformat, bool autoRelease) : rows_(0), cols_(0), format_(NONE)
+{
+    create(arows, acols, aformat, autoRelease);
+}
+
+inline
+cv::ogl::Texture2D::Texture2D(Size asize, Format aformat, bool autoRelease) : rows_(0), cols_(0), format_(NONE)
+{
+    create(asize, aformat, autoRelease);
+}
+
+inline
+void cv::ogl::Texture2D::create(Size asize, Format aformat, bool autoRelease)
+{
+    create(asize.height, asize.width, aformat, autoRelease);
+}
+
+inline
+int cv::ogl::Texture2D::rows() const
+{
+    return rows_;
+}
+
+inline
+int cv::ogl::Texture2D::cols() const
+{
+    return cols_;
+}
+
+inline
+cv::Size cv::ogl::Texture2D::size() const
+{
+    return Size(cols_, rows_);
+}
+
+inline
+bool cv::ogl::Texture2D::empty() const
+{
+    return rows_ == 0 || cols_ == 0;
+}
+
+inline
+cv::ogl::Texture2D::Format cv::ogl::Texture2D::format() const
+{
+    return format_;
+}
+
+///////
+
+inline
+cv::ogl::Arrays::Arrays() : size_(0)
+{
+}
+
+inline
+int cv::ogl::Arrays::size() const
+{
+    return size_;
+}
+
+inline
+bool cv::ogl::Arrays::empty() const
+{
+    return size_ == 0;
+}
+
+//! @endcond
+
+#endif /* __OPENCV_CORE_OPENGL_HPP__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp
new file mode 100644
index 0000000..bced1a7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/operations.hpp
@@ -0,0 +1,530 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_OPERATIONS_HPP__
+#define __OPENCV_CORE_OPERATIONS_HPP__
+
+#ifndef __cplusplus
+#  error operations.hpp header must be compiled as C++
+#endif
+
+#include <cstdio>
+
+//! @cond IGNORED
+
+namespace cv
+{
+
+////////////////////////////// Matx methods depending on core API /////////////////////////////
+
+namespace internal
+{
+
+template<typename _Tp, int m> struct Matx_FastInvOp
+{
+    bool operator()(const Matx<_Tp, m, m>& a, Matx<_Tp, m, m>& b, int method) const
+    {
+        Matx<_Tp, m, m> temp = a;
+
+        // assume that b is all 0's on input => make it a unity matrix
+        for( int i = 0; i < m; i++ )
+            b(i, i) = (_Tp)1;
+
+        if( method == DECOMP_CHOLESKY )
+            return Cholesky(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m);
+
+        return LU(temp.val, m*sizeof(_Tp), m, b.val, m*sizeof(_Tp), m) != 0;
+    }
+};
+
+template<typename _Tp> struct Matx_FastInvOp<_Tp, 2>
+{
+    bool operator()(const Matx<_Tp, 2, 2>& a, Matx<_Tp, 2, 2>& b, int) const
+    {
+        _Tp d = determinant(a);
+        if( d == 0 )
+            return false;
+        d = 1/d;
+        b(1,1) = a(0,0)*d;
+        b(0,0) = a(1,1)*d;
+        b(0,1) = -a(0,1)*d;
+        b(1,0) = -a(1,0)*d;
+        return true;
+    }
+};
+
+template<typename _Tp> struct Matx_FastInvOp<_Tp, 3>
+{
+    bool operator()(const Matx<_Tp, 3, 3>& a, Matx<_Tp, 3, 3>& b, int) const
+    {
+        _Tp d = (_Tp)determinant(a);
+        if( d == 0 )
+            return false;
+        d = 1/d;
+        b(0,0) = (a(1,1) * a(2,2) - a(1,2) * a(2,1)) * d;
+        b(0,1) = (a(0,2) * a(2,1) - a(0,1) * a(2,2)) * d;
+        b(0,2) = (a(0,1) * a(1,2) - a(0,2) * a(1,1)) * d;
+
+        b(1,0) = (a(1,2) * a(2,0) - a(1,0) * a(2,2)) * d;
+        b(1,1) = (a(0,0) * a(2,2) - a(0,2) * a(2,0)) * d;
+        b(1,2) = (a(0,2) * a(1,0) - a(0,0) * a(1,2)) * d;
+
+        b(2,0) = (a(1,0) * a(2,1) - a(1,1) * a(2,0)) * d;
+        b(2,1) = (a(0,1) * a(2,0) - a(0,0) * a(2,1)) * d;
+        b(2,2) = (a(0,0) * a(1,1) - a(0,1) * a(1,0)) * d;
+        return true;
+    }
+};
+
+
+template<typename _Tp, int m, int n> struct Matx_FastSolveOp
+{
+    bool operator()(const Matx<_Tp, m, m>& a, const Matx<_Tp, m, n>& b,
+                    Matx<_Tp, m, n>& x, int method) const
+    {
+        Matx<_Tp, m, m> temp = a;
+        x = b;
+        if( method == DECOMP_CHOLESKY )
+            return Cholesky(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n);
+
+        return LU(temp.val, m*sizeof(_Tp), m, x.val, n*sizeof(_Tp), n) != 0;
+    }
+};
+
+template<typename _Tp> struct Matx_FastSolveOp<_Tp, 2, 1>
+{
+    bool operator()(const Matx<_Tp, 2, 2>& a, const Matx<_Tp, 2, 1>& b,
+                    Matx<_Tp, 2, 1>& x, int) const
+    {
+        _Tp d = determinant(a);
+        if( d == 0 )
+            return false;
+        d = 1/d;
+        x(0) = (b(0)*a(1,1) - b(1)*a(0,1))*d;
+        x(1) = (b(1)*a(0,0) - b(0)*a(1,0))*d;
+        return true;
+    }
+};
+
+template<typename _Tp> struct Matx_FastSolveOp<_Tp, 3, 1>
+{
+    bool operator()(const Matx<_Tp, 3, 3>& a, const Matx<_Tp, 3, 1>& b,
+                    Matx<_Tp, 3, 1>& x, int) const
+    {
+        _Tp d = (_Tp)determinant(a);
+        if( d == 0 )
+            return false;
+        d = 1/d;
+        x(0) = d*(b(0)*(a(1,1)*a(2,2) - a(1,2)*a(2,1)) -
+                a(0,1)*(b(1)*a(2,2) - a(1,2)*b(2)) +
+                a(0,2)*(b(1)*a(2,1) - a(1,1)*b(2)));
+
+        x(1) = d*(a(0,0)*(b(1)*a(2,2) - a(1,2)*b(2)) -
+                b(0)*(a(1,0)*a(2,2) - a(1,2)*a(2,0)) +
+                a(0,2)*(a(1,0)*b(2) - b(1)*a(2,0)));
+
+        x(2) = d*(a(0,0)*(a(1,1)*b(2) - b(1)*a(2,1)) -
+                a(0,1)*(a(1,0)*b(2) - b(1)*a(2,0)) +
+                b(0)*(a(1,0)*a(2,1) - a(1,1)*a(2,0)));
+        return true;
+    }
+};
+
+} // internal
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::randu(_Tp a, _Tp b)
+{
+    Matx<_Tp,m,n> M;
+    cv::randu(M, Scalar(a), Scalar(b));
+    return M;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp,m,n> Matx<_Tp,m,n>::randn(_Tp a, _Tp b)
+{
+    Matx<_Tp,m,n> M;
+    cv::randn(M, Scalar(a), Scalar(b));
+    return M;
+}
+
+template<typename _Tp, int m, int n> inline
+Matx<_Tp, n, m> Matx<_Tp, m, n>::inv(int method, bool *p_is_ok /*= NULL*/) const
+{
+    Matx<_Tp, n, m> b;
+    bool ok;
+    if( method == DECOMP_LU || method == DECOMP_CHOLESKY )
+        ok = cv::internal::Matx_FastInvOp<_Tp, m>()(*this, b, method);
+    else
+    {
+        Mat A(*this, false), B(b, false);
+        ok = (invert(A, B, method) != 0);
+    }
+    if( NULL != p_is_ok ) { *p_is_ok = ok; }
+    return ok ? b : Matx<_Tp, n, m>::zeros();
+}
+
+template<typename _Tp, int m, int n> template<int l> inline
+Matx<_Tp, n, l> Matx<_Tp, m, n>::solve(const Matx<_Tp, m, l>& rhs, int method) const
+{
+    Matx<_Tp, n, l> x;
+    bool ok;
+    if( method == DECOMP_LU || method == DECOMP_CHOLESKY )
+        ok = cv::internal::Matx_FastSolveOp<_Tp, m, l>()(*this, rhs, x, method);
+    else
+    {
+        Mat A(*this, false), B(rhs, false), X(x, false);
+        ok = cv::solve(A, B, X, method);
+    }
+
+    return ok ? x : Matx<_Tp, n, l>::zeros();
+}
+
+
+
+////////////////////////// Augmenting algebraic & logical operations //////////////////////////
+
+#define CV_MAT_AUG_OPERATOR1(op, cvop, A, B) \
+    static inline A& operator op (A& a, const B& b) { cvop; return a; }
+
+#define CV_MAT_AUG_OPERATOR(op, cvop, A, B)   \
+    CV_MAT_AUG_OPERATOR1(op, cvop, A, B)      \
+    CV_MAT_AUG_OPERATOR1(op, cvop, const A, B)
+
+#define CV_MAT_AUG_OPERATOR_T(op, cvop, A, B)                   \
+    template<typename _Tp> CV_MAT_AUG_OPERATOR1(op, cvop, A, B) \
+    template<typename _Tp> CV_MAT_AUG_OPERATOR1(op, cvop, const A, B)
+
+CV_MAT_AUG_OPERATOR  (+=, cv::add(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (+=, cv::add(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(+=, cv::add(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+CV_MAT_AUG_OPERATOR  (-=, cv::subtract(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (-=, cv::subtract(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(-=, cv::subtract(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+CV_MAT_AUG_OPERATOR  (*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat, Mat)
+CV_MAT_AUG_OPERATOR_T(*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(*=, cv::gemm(a, b, 1, Mat(), 0, a, 0), Mat_<_Tp>, Mat_<_Tp>)
+CV_MAT_AUG_OPERATOR  (*=, a.convertTo(a, -1, b), Mat, double)
+CV_MAT_AUG_OPERATOR_T(*=, a.convertTo(a, -1, b), Mat_<_Tp>, double)
+
+CV_MAT_AUG_OPERATOR  (/=, cv::divide(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR_T(/=, cv::divide(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(/=, cv::divide(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+CV_MAT_AUG_OPERATOR  (/=, a.convertTo((Mat&)a, -1, 1./b), Mat, double)
+CV_MAT_AUG_OPERATOR_T(/=, a.convertTo((Mat&)a, -1, 1./b), Mat_<_Tp>, double)
+
+CV_MAT_AUG_OPERATOR  (&=, cv::bitwise_and(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (&=, cv::bitwise_and(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(&=, cv::bitwise_and(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+CV_MAT_AUG_OPERATOR  (|=, cv::bitwise_or(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (|=, cv::bitwise_or(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(|=, cv::bitwise_or(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+CV_MAT_AUG_OPERATOR  (^=, cv::bitwise_xor(a,b,a), Mat, Mat)
+CV_MAT_AUG_OPERATOR  (^=, cv::bitwise_xor(a,b,a), Mat, Scalar)
+CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Mat)
+CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Scalar)
+CV_MAT_AUG_OPERATOR_T(^=, cv::bitwise_xor(a,b,a), Mat_<_Tp>, Mat_<_Tp>)
+
+#undef CV_MAT_AUG_OPERATOR_T
+#undef CV_MAT_AUG_OPERATOR
+#undef CV_MAT_AUG_OPERATOR1
+
+
+
+///////////////////////////////////////////// SVD /////////////////////////////////////////////
+
+inline SVD::SVD() {}
+inline SVD::SVD( InputArray m, int flags ) { operator ()(m, flags); }
+inline void SVD::solveZ( InputArray m, OutputArray _dst )
+{
+    Mat mtx = m.getMat();
+    SVD svd(mtx, (mtx.rows >= mtx.cols ? 0 : SVD::FULL_UV));
+    _dst.create(svd.vt.cols, 1, svd.vt.type());
+    Mat dst = _dst.getMat();
+    svd.vt.row(svd.vt.rows-1).reshape(1,svd.vt.cols).copyTo(dst);
+}
+
+template<typename _Tp, int m, int n, int nm> inline void
+    SVD::compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w, Matx<_Tp, m, nm>& u, Matx<_Tp, n, nm>& vt )
+{
+    CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector.");
+    Mat _a(a, false), _u(u, false), _w(w, false), _vt(vt, false);
+    SVD::compute(_a, _w, _u, _vt);
+    CV_Assert(_w.data == (uchar*)&w.val[0] && _u.data == (uchar*)&u.val[0] && _vt.data == (uchar*)&vt.val[0]);
+}
+
+template<typename _Tp, int m, int n, int nm> inline void
+SVD::compute( const Matx<_Tp, m, n>& a, Matx<_Tp, nm, 1>& w )
+{
+    CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector.");
+    Mat _a(a, false), _w(w, false);
+    SVD::compute(_a, _w);
+    CV_Assert(_w.data == (uchar*)&w.val[0]);
+}
+
+template<typename _Tp, int m, int n, int nm, int nb> inline void
+SVD::backSubst( const Matx<_Tp, nm, 1>& w, const Matx<_Tp, m, nm>& u,
+                const Matx<_Tp, n, nm>& vt, const Matx<_Tp, m, nb>& rhs,
+                Matx<_Tp, n, nb>& dst )
+{
+    CV_StaticAssert( nm == MIN(m, n), "Invalid size of output vector.");
+    Mat _u(u, false), _w(w, false), _vt(vt, false), _rhs(rhs, false), _dst(dst, false);
+    SVD::backSubst(_w, _u, _vt, _rhs, _dst);
+    CV_Assert(_dst.data == (uchar*)&dst.val[0]);
+}
+
+
+
+/////////////////////////////////// Multiply-with-Carry RNG ///////////////////////////////////
+
+inline RNG::RNG()              { state = 0xffffffff; }
+inline RNG::RNG(uint64 _state) { state = _state ? _state : 0xffffffff; }
+
+inline RNG::operator uchar()    { return (uchar)next(); }
+inline RNG::operator schar()    { return (schar)next(); }
+inline RNG::operator ushort()   { return (ushort)next(); }
+inline RNG::operator short()    { return (short)next(); }
+inline RNG::operator int()      { return (int)next(); }
+inline RNG::operator unsigned() { return next(); }
+inline RNG::operator float()    { return next()*2.3283064365386962890625e-10f; }
+inline RNG::operator double()   { unsigned t = next(); return (((uint64)t << 32) | next()) * 5.4210108624275221700372640043497e-20; }
+
+inline unsigned RNG::operator ()(unsigned N) { return (unsigned)uniform(0,N); }
+inline unsigned RNG::operator ()()           { return next(); }
+
+inline int    RNG::uniform(int a, int b)       { return a == b ? a : (int)(next() % (b - a) + a); }
+inline float  RNG::uniform(float a, float b)   { return ((float)*this)*(b - a) + a; }
+inline double RNG::uniform(double a, double b) { return ((double)*this)*(b - a) + a; }
+
+inline unsigned RNG::next()
+{
+    state = (uint64)(unsigned)state* /*CV_RNG_COEFF*/ 4164903690U + (unsigned)(state >> 32);
+    return (unsigned)state;
+}
+
+//! returns the next unifomly-distributed random number of the specified type
+template<typename _Tp> static inline _Tp randu()
+{
+  return (_Tp)theRNG();
+}
+
+///////////////////////////////// Formatted string generation /////////////////////////////////
+
+CV_EXPORTS String format( const char* fmt, ... );
+
+///////////////////////////////// Formatted output of cv::Mat /////////////////////////////////
+
+static inline
+Ptr<Formatted> format(InputArray mtx, int fmt)
+{
+    return Formatter::get(fmt)->format(mtx.getMat());
+}
+
+static inline
+int print(Ptr<Formatted> fmtd, FILE* stream = stdout)
+{
+    int written = 0;
+    fmtd->reset();
+    for(const char* str = fmtd->next(); str; str = fmtd->next())
+        written += fputs(str, stream);
+
+    return written;
+}
+
+static inline
+int print(const Mat& mtx, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(mtx), stream);
+}
+
+static inline
+int print(const UMat& mtx, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(mtx.getMat(ACCESS_READ)), stream);
+}
+
+template<typename _Tp> static inline
+int print(const std::vector<Point_<_Tp> >& vec, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(Mat(vec)), stream);
+}
+
+template<typename _Tp> static inline
+int print(const std::vector<Point3_<_Tp> >& vec, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(Mat(vec)), stream);
+}
+
+template<typename _Tp, int m, int n> static inline
+int print(const Matx<_Tp, m, n>& matx, FILE* stream = stdout)
+{
+    return print(Formatter::get()->format(cv::Mat(matx)), stream);
+}
+
+//! @endcond
+
+/****************************************************************************************\
+*                                  Auxiliary algorithms                                  *
+\****************************************************************************************/
+
+/** @brief Splits an element set into equivalency classes.
+
+The generic function partition implements an \f$O(N^2)\f$ algorithm for splitting a set of \f$N\f$ elements
+into one or more equivalency classes, as described in
+<http://en.wikipedia.org/wiki/Disjoint-set_data_structure> . The function returns the number of
+equivalency classes.
+@param _vec Set of elements stored as a vector.
+@param labels Output vector of labels. It contains as many elements as vec. Each label labels[i] is
+a 0-based cluster index of `vec[i]`.
+@param predicate Equivalence predicate (pointer to a boolean function of two arguments or an
+instance of the class that has the method bool operator()(const _Tp& a, const _Tp& b) ). The
+predicate returns true when the elements are certainly in the same class, and returns false if they
+may or may not be in the same class.
+@ingroup core_cluster
+*/
+template<typename _Tp, class _EqPredicate> int
+partition( const std::vector<_Tp>& _vec, std::vector<int>& labels,
+          _EqPredicate predicate=_EqPredicate())
+{
+    int i, j, N = (int)_vec.size();
+    const _Tp* vec = &_vec[0];
+
+    const int PARENT=0;
+    const int RANK=1;
+
+    std::vector<int> _nodes(N*2);
+    int (*nodes)[2] = (int(*)[2])&_nodes[0];
+
+    // The first O(N) pass: create N single-vertex trees
+    for(i = 0; i < N; i++)
+    {
+        nodes[i][PARENT]=-1;
+        nodes[i][RANK] = 0;
+    }
+
+    // The main O(N^2) pass: merge connected components
+    for( i = 0; i < N; i++ )
+    {
+        int root = i;
+
+        // find root
+        while( nodes[root][PARENT] >= 0 )
+            root = nodes[root][PARENT];
+
+        for( j = 0; j < N; j++ )
+        {
+            if( i == j || !predicate(vec[i], vec[j]))
+                continue;
+            int root2 = j;
+
+            while( nodes[root2][PARENT] >= 0 )
+                root2 = nodes[root2][PARENT];
+
+            if( root2 != root )
+            {
+                // unite both trees
+                int rank = nodes[root][RANK], rank2 = nodes[root2][RANK];
+                if( rank > rank2 )
+                    nodes[root2][PARENT] = root;
+                else
+                {
+                    nodes[root][PARENT] = root2;
+                    nodes[root2][RANK] += rank == rank2;
+                    root = root2;
+                }
+                CV_Assert( nodes[root][PARENT] < 0 );
+
+                int k = j, parent;
+
+                // compress the path from node2 to root
+                while( (parent = nodes[k][PARENT]) >= 0 )
+                {
+                    nodes[k][PARENT] = root;
+                    k = parent;
+                }
+
+                // compress the path from node to root
+                k = i;
+                while( (parent = nodes[k][PARENT]) >= 0 )
+                {
+                    nodes[k][PARENT] = root;
+                    k = parent;
+                }
+            }
+        }
+    }
+
+    // Final O(N) pass: enumerate classes
+    labels.resize(N);
+    int nclasses = 0;
+
+    for( i = 0; i < N; i++ )
+    {
+        int root = i;
+        while( nodes[root][PARENT] >= 0 )
+            root = nodes[root][PARENT];
+        // re-use the rank as the class label
+        if( nodes[root][RANK] >= 0 )
+            nodes[root][RANK] = ~nclasses++;
+        labels[i] = ~nodes[root][RANK];
+    }
+
+    return nclasses;
+}
+
+} // cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp
new file mode 100644
index 0000000..23e2155
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/optim.hpp
@@ -0,0 +1,302 @@
+/*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) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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 OpenCV Foundation 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*/
+
+#ifndef __OPENCV_OPTIM_HPP__
+#define __OPENCV_OPTIM_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+
+/** @addtogroup core_optim
+The algorithms in this section minimize or maximize function value within specified constraints or
+without any constraints.
+@{
+*/
+
+/** @brief Basic interface for all solvers
+ */
+class CV_EXPORTS MinProblemSolver : public Algorithm
+{
+public:
+    /** @brief Represents function being optimized
+     */
+    class CV_EXPORTS Function
+    {
+    public:
+        virtual ~Function() {}
+        virtual int getDims() const = 0;
+        virtual double getGradientEps() const;
+        virtual double calc(const double* x) const = 0;
+        virtual void getGradient(const double* x,double* grad);
+    };
+
+    /** @brief Getter for the optimized function.
+
+    The optimized function is represented by Function interface, which requires derivatives to
+    implement the sole method calc(double*) to evaluate the function.
+
+    @return Smart-pointer to an object that implements Function interface - it represents the
+    function that is being optimized. It can be empty, if no function was given so far.
+     */
+    virtual Ptr<Function> getFunction() const = 0;
+
+    /** @brief Setter for the optimized function.
+
+    *It should be called at least once before the call to* minimize(), as default value is not usable.
+
+    @param f The new function to optimize.
+     */
+    virtual void setFunction(const Ptr<Function>& f) = 0;
+
+    /** @brief Getter for the previously set terminal criteria for this algorithm.
+
+    @return Deep copy of the terminal criteria used at the moment.
+     */
+    virtual TermCriteria getTermCriteria() const = 0;
+
+    /** @brief Set terminal criteria for solver.
+
+    This method *is not necessary* to be called before the first call to minimize(), as the default
+    value is sensible.
+
+    Algorithm stops when the number of function evaluations done exceeds termcrit.maxCount, when
+    the function values at the vertices of simplex are within termcrit.epsilon range or simplex
+    becomes so small that it can enclosed in a box with termcrit.epsilon sides, whatever comes
+    first.
+    @param termcrit Terminal criteria to be used, represented as cv::TermCriteria structure.
+     */
+    virtual void setTermCriteria(const TermCriteria& termcrit) = 0;
+
+    /** @brief actually runs the algorithm and performs the minimization.
+
+    The sole input parameter determines the centroid of the starting simplex (roughly, it tells
+    where to start), all the others (terminal criteria, initial step, function to be minimized) are
+    supposed to be set via the setters before the call to this method or the default values (not
+    always sensible) will be used.
+
+    @param x The initial point, that will become a centroid of an initial simplex. After the algorithm
+    will terminate, it will be setted to the point where the algorithm stops, the point of possible
+    minimum.
+    @return The value of a function at the point found.
+     */
+    virtual double minimize(InputOutputArray x) = 0;
+};
+
+/** @brief This class is used to perform the non-linear non-constrained minimization of a function,
+
+defined on an `n`-dimensional Euclidean space, using the **Nelder-Mead method**, also known as
+**downhill simplex method**. The basic idea about the method can be obtained from
+<http://en.wikipedia.org/wiki/Nelder-Mead_method>.
+
+It should be noted, that this method, although deterministic, is rather a heuristic and therefore
+may converge to a local minima, not necessary a global one. It is iterative optimization technique,
+which at each step uses an information about the values of a function evaluated only at `n+1`
+points, arranged as a *simplex* in `n`-dimensional space (hence the second name of the method). At
+each step new point is chosen to evaluate function at, obtained value is compared with previous
+ones and based on this information simplex changes it's shape , slowly moving to the local minimum.
+Thus this method is using *only* function values to make decision, on contrary to, say, Nonlinear
+Conjugate Gradient method (which is also implemented in optim).
+
+Algorithm stops when the number of function evaluations done exceeds termcrit.maxCount, when the
+function values at the vertices of simplex are within termcrit.epsilon range or simplex becomes so
+small that it can enclosed in a box with termcrit.epsilon sides, whatever comes first, for some
+defined by user positive integer termcrit.maxCount and positive non-integer termcrit.epsilon.
+
+@note DownhillSolver is a derivative of the abstract interface
+cv::MinProblemSolver, which in turn is derived from the Algorithm interface and is used to
+encapsulate the functionality, common to all non-linear optimization algorithms in the optim
+module.
+
+@note term criteria should meet following condition:
+@code
+    termcrit.type == (TermCriteria::MAX_ITER + TermCriteria::EPS) && termcrit.epsilon > 0 && termcrit.maxCount > 0
+@endcode
+ */
+class CV_EXPORTS DownhillSolver : public MinProblemSolver
+{
+public:
+    /** @brief Returns the initial step that will be used in downhill simplex algorithm.
+
+    @param step Initial step that will be used in algorithm. Note, that although corresponding setter
+    accepts column-vectors as well as row-vectors, this method will return a row-vector.
+    @see DownhillSolver::setInitStep
+     */
+    virtual void getInitStep(OutputArray step) const=0;
+
+    /** @brief Sets the initial step that will be used in downhill simplex algorithm.
+
+    Step, together with initial point (givin in DownhillSolver::minimize) are two `n`-dimensional
+    vectors that are used to determine the shape of initial simplex. Roughly said, initial point
+    determines the position of a simplex (it will become simplex's centroid), while step determines the
+    spread (size in each dimension) of a simplex. To be more precise, if \f$s,x_0\in\mathbb{R}^n\f$ are
+    the initial step and initial point respectively, the vertices of a simplex will be:
+    \f$v_0:=x_0-\frac{1}{2} s\f$ and \f$v_i:=x_0+s_i\f$ for \f$i=1,2,\dots,n\f$ where \f$s_i\f$ denotes
+    projections of the initial step of *n*-th coordinate (the result of projection is treated to be
+    vector given by \f$s_i:=e_i\cdot\left<e_i\cdot s\right>\f$, where \f$e_i\f$ form canonical basis)
+
+    @param step Initial step that will be used in algorithm. Roughly said, it determines the spread
+    (size in each dimension) of an initial simplex.
+     */
+    virtual void setInitStep(InputArray step)=0;
+
+    /** @brief This function returns the reference to the ready-to-use DownhillSolver object.
+
+    All the parameters are optional, so this procedure can be called even without parameters at
+    all. In this case, the default values will be used. As default value for terminal criteria are
+    the only sensible ones, MinProblemSolver::setFunction() and DownhillSolver::setInitStep()
+    should be called upon the obtained object, if the respective parameters were not given to
+    create(). Otherwise, the two ways (give parameters to createDownhillSolver() or miss them out
+    and call the MinProblemSolver::setFunction() and DownhillSolver::setInitStep()) are absolutely
+    equivalent (and will drop the same errors in the same way, should invalid input be detected).
+    @param f Pointer to the function that will be minimized, similarly to the one you submit via
+    MinProblemSolver::setFunction.
+    @param initStep Initial step, that will be used to construct the initial simplex, similarly to the one
+    you submit via MinProblemSolver::setInitStep.
+    @param termcrit Terminal criteria to the algorithm, similarly to the one you submit via
+    MinProblemSolver::setTermCriteria.
+     */
+    static Ptr<DownhillSolver> create(const Ptr<MinProblemSolver::Function>& f=Ptr<MinProblemSolver::Function>(),
+                                      InputArray initStep=Mat_<double>(1,1,0.0),
+                                      TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001));
+};
+
+/** @brief This class is used to perform the non-linear non-constrained minimization of a function
+with known gradient,
+
+defined on an *n*-dimensional Euclidean space, using the **Nonlinear Conjugate Gradient method**.
+The implementation was done based on the beautifully clear explanatory article [An Introduction to
+the Conjugate Gradient Method Without the Agonizing
+Pain](http://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf) by Jonathan Richard
+Shewchuk. The method can be seen as an adaptation of a standard Conjugate Gradient method (see, for
+example <http://en.wikipedia.org/wiki/Conjugate_gradient_method>) for numerically solving the
+systems of linear equations.
+
+It should be noted, that this method, although deterministic, is rather a heuristic method and
+therefore may converge to a local minima, not necessary a global one. What is even more disastrous,
+most of its behaviour is ruled by gradient, therefore it essentially cannot distinguish between
+local minima and maxima. Therefore, if it starts sufficiently near to the local maximum, it may
+converge to it. Another obvious restriction is that it should be possible to compute the gradient of
+a function at any point, thus it is preferable to have analytic expression for gradient and
+computational burden should be born by the user.
+
+The latter responsibility is accompilished via the getGradient method of a
+MinProblemSolver::Function interface (which represents function being optimized). This method takes
+point a point in *n*-dimensional space (first argument represents the array of coordinates of that
+point) and comput its gradient (it should be stored in the second argument as an array).
+
+@note class ConjGradSolver thus does not add any new methods to the basic MinProblemSolver interface.
+
+@note term criteria should meet following condition:
+@code
+    termcrit.type == (TermCriteria::MAX_ITER + TermCriteria::EPS) && termcrit.epsilon > 0 && termcrit.maxCount > 0
+    // or
+    termcrit.type == TermCriteria::MAX_ITER) && termcrit.maxCount > 0
+@endcode
+ */
+class CV_EXPORTS ConjGradSolver : public MinProblemSolver
+{
+public:
+    /** @brief This function returns the reference to the ready-to-use ConjGradSolver object.
+
+    All the parameters are optional, so this procedure can be called even without parameters at
+    all. In this case, the default values will be used. As default value for terminal criteria are
+    the only sensible ones, MinProblemSolver::setFunction() should be called upon the obtained
+    object, if the function was not given to create(). Otherwise, the two ways (submit it to
+    create() or miss it out and call the MinProblemSolver::setFunction()) are absolutely equivalent
+    (and will drop the same errors in the same way, should invalid input be detected).
+    @param f Pointer to the function that will be minimized, similarly to the one you submit via
+    MinProblemSolver::setFunction.
+    @param termcrit Terminal criteria to the algorithm, similarly to the one you submit via
+    MinProblemSolver::setTermCriteria.
+    */
+    static Ptr<ConjGradSolver> create(const Ptr<MinProblemSolver::Function>& f=Ptr<ConjGradSolver::Function>(),
+                                      TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001));
+};
+
+//! return codes for cv::solveLP() function
+enum SolveLPResult
+{
+    SOLVELP_UNBOUNDED    = -2, //!< problem is unbounded (target function can achieve arbitrary high values)
+    SOLVELP_UNFEASIBLE    = -1, //!< problem is unfeasible (there are no points that satisfy all the constraints imposed)
+    SOLVELP_SINGLE    = 0, //!< there is only one maximum for target function
+    SOLVELP_MULTI    = 1 //!< there are multiple maxima for target function - the arbitrary one is returned
+};
+
+/** @brief Solve given (non-integer) linear programming problem using the Simplex Algorithm (Simplex Method).
+
+What we mean here by "linear programming problem" (or LP problem, for short) can be formulated as:
+
+\f[\mbox{Maximize } c\cdot x\\
+ \mbox{Subject to:}\\
+ Ax\leq b\\
+ x\geq 0\f]
+
+Where \f$c\f$ is fixed `1`-by-`n` row-vector, \f$A\f$ is fixed `m`-by-`n` matrix, \f$b\f$ is fixed `m`-by-`1`
+column vector and \f$x\f$ is an arbitrary `n`-by-`1` column vector, which satisfies the constraints.
+
+Simplex algorithm is one of many algorithms that are designed to handle this sort of problems
+efficiently. Although it is not optimal in theoretical sense (there exist algorithms that can solve
+any problem written as above in polynomial time, while simplex method degenerates to exponential
+time for some special cases), it is well-studied, easy to implement and is shown to work well for
+real-life purposes.
+
+The particular implementation is taken almost verbatim from **Introduction to Algorithms, third
+edition** by T. H. Cormen, C. E. Leiserson, R. L. Rivest and Clifford Stein. In particular, the
+Bland's rule <http://en.wikipedia.org/wiki/Bland%27s_rule> is used to prevent cycling.
+
+@param Func This row-vector corresponds to \f$c\f$ in the LP problem formulation (see above). It should
+contain 32- or 64-bit floating point numbers. As a convenience, column-vector may be also submitted,
+in the latter case it is understood to correspond to \f$c^T\f$.
+@param Constr `m`-by-`n+1` matrix, whose rightmost column corresponds to \f$b\f$ in formulation above
+and the remaining to \f$A\f$. It should containt 32- or 64-bit floating point numbers.
+@param z The solution will be returned here as a column-vector - it corresponds to \f$c\f$ in the
+formulation above. It will contain 64-bit floating point numbers.
+@return One of cv::SolveLPResult
+ */
+CV_EXPORTS_W int solveLP(const Mat& Func, const Mat& Constr, Mat& z);
+
+//! @}
+
+}// cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp
new file mode 100644
index 0000000..17686dd
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/persistence.hpp
@@ -0,0 +1,1195 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_PERSISTENCE_HPP__
+#define __OPENCV_CORE_PERSISTENCE_HPP__
+
+#ifndef __cplusplus
+#  error persistence.hpp header must be compiled as C++
+#endif
+
+//! @addtogroup core_c
+//! @{
+
+/** @brief "black box" representation of the file storage associated with a file on disk.
+
+Several functions that are described below take CvFileStorage\* as inputs and allow the user to
+save or to load hierarchical collections that consist of scalar values, standard CXCore objects
+(such as matrices, sequences, graphs), and user-defined objects.
+
+OpenCV can read and write data in XML (<http://www.w3c.org/XML>) or YAML (<http://www.yaml.org>)
+formats. Below is an example of 3x3 floating-point identity matrix A, stored in XML and YAML files
+using CXCore functions:
+XML:
+@code{.xml}
+    <?xml version="1.0">
+    <opencv_storage>
+    <A type_id="opencv-matrix">
+      <rows>3</rows>
+      <cols>3</cols>
+      <dt>f</dt>
+      <data>1. 0. 0. 0. 1. 0. 0. 0. 1.</data>
+    </A>
+    </opencv_storage>
+@endcode
+YAML:
+@code{.yaml}
+    %YAML:1.0
+    A: !!opencv-matrix
+      rows: 3
+      cols: 3
+      dt: f
+      data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1.]
+@endcode
+As it can be seen from the examples, XML uses nested tags to represent hierarchy, while YAML uses
+indentation for that purpose (similar to the Python programming language).
+
+The same functions can read and write data in both formats; the particular format is determined by
+the extension of the opened file, ".xml" for XML files and ".yml" or ".yaml" for YAML.
+ */
+typedef struct CvFileStorage CvFileStorage;
+typedef struct CvFileNode CvFileNode;
+
+//! @} core_c
+
+#include "opencv2/core/types.hpp"
+#include "opencv2/core/mat.hpp"
+
+namespace cv {
+
+/** @addtogroup core_xml
+
+XML/YAML file storages.     {#xml_storage}
+=======================
+Writing to a file storage.
+--------------------------
+You can store and then restore various OpenCV data structures to/from XML (<http://www.w3c.org/XML>)
+or YAML (<http://www.yaml.org>) formats. Also, it is possible store and load arbitrarily complex
+data structures, which include OpenCV data structures, as well as primitive data types (integer and
+floating-point numbers and text strings) as their elements.
+
+Use the following procedure to write something to XML or YAML:
+-# Create new FileStorage and open it for writing. It can be done with a single call to
+FileStorage::FileStorage constructor that takes a filename, or you can use the default constructor
+and then call FileStorage::open. Format of the file (XML or YAML) is determined from the filename
+extension (".xml" and ".yml"/".yaml", respectively)
+-# Write all the data you want using the streaming operator `<<`, just like in the case of STL
+streams.
+-# Close the file using FileStorage::release. FileStorage destructor also closes the file.
+
+Here is an example:
+@code
+    #include "opencv2/opencv.hpp"
+    #include <time.h>
+
+    using namespace cv;
+
+    int main(int, char** argv)
+    {
+        FileStorage fs("test.yml", FileStorage::WRITE);
+
+        fs << "frameCount" << 5;
+        time_t rawtime; time(&rawtime);
+        fs << "calibrationDate" << asctime(localtime(&rawtime));
+        Mat cameraMatrix = (Mat_<double>(3,3) << 1000, 0, 320, 0, 1000, 240, 0, 0, 1);
+        Mat distCoeffs = (Mat_<double>(5,1) << 0.1, 0.01, -0.001, 0, 0);
+        fs << "cameraMatrix" << cameraMatrix << "distCoeffs" << distCoeffs;
+        fs << "features" << "[";
+        for( int i = 0; i < 3; i++ )
+        {
+            int x = rand() % 640;
+            int y = rand() % 480;
+            uchar lbp = rand() % 256;
+
+            fs << "{:" << "x" << x << "y" << y << "lbp" << "[:";
+            for( int j = 0; j < 8; j++ )
+                fs << ((lbp >> j) & 1);
+            fs << "]" << "}";
+        }
+        fs << "]";
+        fs.release();
+        return 0;
+    }
+@endcode
+The sample above stores to XML and integer, text string (calibration date), 2 matrices, and a custom
+structure "feature", which includes feature coordinates and LBP (local binary pattern) value. Here
+is output of the sample:
+@code{.yaml}
+%YAML:1.0
+frameCount: 5
+calibrationDate: "Fri Jun 17 14:09:29 2011\n"
+cameraMatrix: !!opencv-matrix
+   rows: 3
+   cols: 3
+   dt: d
+   data: [ 1000., 0., 320., 0., 1000., 240., 0., 0., 1. ]
+distCoeffs: !!opencv-matrix
+   rows: 5
+   cols: 1
+   dt: d
+   data: [ 1.0000000000000001e-01, 1.0000000000000000e-02,
+       -1.0000000000000000e-03, 0., 0. ]
+features:
+   - { x:167, y:49, lbp:[ 1, 0, 0, 1, 1, 0, 1, 1 ] }
+   - { x:298, y:130, lbp:[ 0, 0, 0, 1, 0, 0, 1, 1 ] }
+   - { x:344, y:158, lbp:[ 1, 1, 0, 0, 0, 0, 1, 0 ] }
+@endcode
+
+As an exercise, you can replace ".yml" with ".xml" in the sample above and see, how the
+corresponding XML file will look like.
+
+Several things can be noted by looking at the sample code and the output:
+
+-   The produced YAML (and XML) consists of heterogeneous collections that can be nested. There are 2
+    types of collections: named collections (mappings) and unnamed collections (sequences). In mappings
+    each element has a name and is accessed by name. This is similar to structures and std::map in
+    C/C++ and dictionaries in Python. In sequences elements do not have names, they are accessed by
+    indices. This is similar to arrays and std::vector in C/C++ and lists, tuples in Python.
+    "Heterogeneous" means that elements of each single collection can have different types.
+
+    Top-level collection in YAML/XML is a mapping. Each matrix is stored as a mapping, and the matrix
+    elements are stored as a sequence. Then, there is a sequence of features, where each feature is
+    represented a mapping, and lbp value in a nested sequence.
+
+-   When you write to a mapping (a structure), you write element name followed by its value. When you
+    write to a sequence, you simply write the elements one by one. OpenCV data structures (such as
+    cv::Mat) are written in absolutely the same way as simple C data structures - using `<<`
+    operator.
+
+-   To write a mapping, you first write the special string `{` to the storage, then write the
+    elements as pairs (`fs << <element_name> << <element_value>`) and then write the closing
+    `}`.
+
+-   To write a sequence, you first write the special string `[`, then write the elements, then
+    write the closing `]`.
+
+-   In YAML (but not XML), mappings and sequences can be written in a compact Python-like inline
+    form. In the sample above matrix elements, as well as each feature, including its lbp value, is
+    stored in such inline form. To store a mapping/sequence in a compact form, put `:` after the
+    opening character, e.g. use `{:` instead of `{` and `[:` instead of `[`. When the
+    data is written to XML, those extra `:` are ignored.
+
+Reading data from a file storage.
+---------------------------------
+To read the previously written XML or YAML file, do the following:
+-#  Open the file storage using FileStorage::FileStorage constructor or FileStorage::open method.
+    In the current implementation the whole file is parsed and the whole representation of file
+    storage is built in memory as a hierarchy of file nodes (see FileNode)
+
+-#  Read the data you are interested in. Use FileStorage::operator [], FileNode::operator []
+    and/or FileNodeIterator.
+
+-#  Close the storage using FileStorage::release.
+
+Here is how to read the file created by the code sample above:
+@code
+    FileStorage fs2("test.yml", FileStorage::READ);
+
+    // first method: use (type) operator on FileNode.
+    int frameCount = (int)fs2["frameCount"];
+
+    String date;
+    // second method: use FileNode::operator >>
+    fs2["calibrationDate"] >> date;
+
+    Mat cameraMatrix2, distCoeffs2;
+    fs2["cameraMatrix"] >> cameraMatrix2;
+    fs2["distCoeffs"] >> distCoeffs2;
+
+    cout << "frameCount: " << frameCount << endl
+         << "calibration date: " << date << endl
+         << "camera matrix: " << cameraMatrix2 << endl
+         << "distortion coeffs: " << distCoeffs2 << endl;
+
+    FileNode features = fs2["features"];
+    FileNodeIterator it = features.begin(), it_end = features.end();
+    int idx = 0;
+    std::vector<uchar> lbpval;
+
+    // iterate through a sequence using FileNodeIterator
+    for( ; it != it_end; ++it, idx++ )
+    {
+        cout << "feature #" << idx << ": ";
+        cout << "x=" << (int)(*it)["x"] << ", y=" << (int)(*it)["y"] << ", lbp: (";
+        // you can also easily read numerical arrays using FileNode >> std::vector operator.
+        (*it)["lbp"] >> lbpval;
+        for( int i = 0; i < (int)lbpval.size(); i++ )
+            cout << " " << (int)lbpval[i];
+        cout << ")" << endl;
+    }
+    fs2.release();
+@endcode
+
+Format specification    {#format_spec}
+--------------------
+`([count]{u|c|w|s|i|f|d})`... where the characters correspond to fundamental C++ types:
+-   `u` 8-bit unsigned number
+-   `c` 8-bit signed number
+-   `w` 16-bit unsigned number
+-   `s` 16-bit signed number
+-   `i` 32-bit signed number
+-   `f` single precision floating-point number
+-   `d` double precision floating-point number
+-   `r` pointer, 32 lower bits of which are written as a signed integer. The type can be used to
+    store structures with links between the elements.
+
+`count` is the optional counter of values of a given type. For example, `2if` means that each array
+element is a structure of 2 integers, followed by a single-precision floating-point number. The
+equivalent notations of the above specification are `iif`, `2i1f` and so forth. Other examples: `u`
+means that the array consists of bytes, and `2d` means the array consists of pairs of doubles.
+
+@see @ref filestorage.cpp
+*/
+
+//! @{
+
+/** @example filestorage.cpp
+A complete example using the FileStorage interface
+*/
+
+////////////////////////// XML & YAML I/O //////////////////////////
+
+class CV_EXPORTS FileNode;
+class CV_EXPORTS FileNodeIterator;
+
+/** @brief XML/YAML file storage class that encapsulates all the information necessary for writing or reading
+data to/from a file.
+ */
+class CV_EXPORTS_W FileStorage
+{
+public:
+    //! file storage mode
+    enum Mode
+    {
+        READ        = 0, //!< value, open the file for reading
+        WRITE       = 1, //!< value, open the file for writing
+        APPEND      = 2, //!< value, open the file for appending
+        MEMORY      = 4, //!< flag, read data from source or write data to the internal buffer (which is
+                         //!< returned by FileStorage::release)
+        FORMAT_MASK = (7<<3), //!< mask for format flags
+        FORMAT_AUTO = 0,      //!< flag, auto format
+        FORMAT_XML  = (1<<3), //!< flag, XML format
+        FORMAT_YAML = (2<<3)  //!< flag, YAML format
+    };
+    enum
+    {
+        UNDEFINED      = 0,
+        VALUE_EXPECTED = 1,
+        NAME_EXPECTED  = 2,
+        INSIDE_MAP     = 4
+    };
+
+    /** @brief The constructors.
+
+    The full constructor opens the file. Alternatively you can use the default constructor and then
+    call FileStorage::open.
+     */
+    CV_WRAP FileStorage();
+
+    /** @overload
+    @param source Name of the file to open or the text string to read the data from. Extension of the
+    file (.xml or .yml/.yaml) determines its format (XML or YAML respectively). Also you can append .gz
+    to work with compressed files, for example myHugeMatrix.xml.gz. If both FileStorage::WRITE and
+    FileStorage::MEMORY flags are specified, source is used just to specify the output file format (e.g.
+    mydata.xml, .yml etc.).
+    @param flags Mode of operation. See  FileStorage::Mode
+    @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.
+    */
+    CV_WRAP FileStorage(const String& source, int flags, const String& encoding=String());
+
+    /** @overload */
+    FileStorage(CvFileStorage* fs, bool owning=true);
+
+    //! the destructor. calls release()
+    virtual ~FileStorage();
+
+    /** @brief Opens a file.
+
+    See description of parameters in FileStorage::FileStorage. The method calls FileStorage::release
+    before opening the file.
+    @param filename Name of the file to open or the text string to read the data from.
+       Extension of the file (.xml or .yml/.yaml) determines its format (XML or YAML respectively).
+        Also you can append .gz to work with compressed files, for example myHugeMatrix.xml.gz. If both
+        FileStorage::WRITE and FileStorage::MEMORY flags are specified, source is used just to specify
+        the output file format (e.g. mydata.xml, .yml etc.).
+    @param flags Mode of operation. One of FileStorage::Mode
+    @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.
+     */
+    CV_WRAP virtual bool open(const String& filename, int flags, const String& encoding=String());
+
+    /** @brief Checks whether the file is opened.
+
+    @returns true if the object is associated with the current file and false otherwise. It is a
+    good practice to call this method after you tried to open a file.
+     */
+    CV_WRAP virtual bool isOpened() const;
+
+    /** @brief Closes the file and releases all the memory buffers.
+
+    Call this method after all I/O operations with the storage are finished.
+     */
+    CV_WRAP virtual void release();
+
+    /** @brief Closes the file and releases all the memory buffers.
+
+    Call this method after all I/O operations with the storage are finished. If the storage was
+    opened for writing data and FileStorage::WRITE was specified
+     */
+    CV_WRAP virtual String releaseAndGetString();
+
+    /** @brief Returns the first element of the top-level mapping.
+    @returns The first element of the top-level mapping.
+     */
+    CV_WRAP FileNode getFirstTopLevelNode() const;
+
+    /** @brief Returns the top-level mapping
+    @param streamidx Zero-based index of the stream. In most cases there is only one stream in the file.
+    However, YAML supports multiple streams and so there can be several.
+    @returns The top-level mapping.
+     */
+    CV_WRAP FileNode root(int streamidx=0) const;
+
+    /** @brief Returns the specified element of the top-level mapping.
+    @param nodename Name of the file node.
+    @returns Node with the given name.
+     */
+    FileNode operator[](const String& nodename) const;
+
+    /** @overload */
+    CV_WRAP FileNode operator[](const char* nodename) const;
+
+    /** @brief Returns the obsolete C FileStorage structure.
+    @returns Pointer to the underlying C FileStorage structure
+     */
+    CvFileStorage* operator *() { return fs.get(); }
+
+    /** @overload */
+    const CvFileStorage* operator *() const { return fs.get(); }
+
+    /** @brief Writes multiple numbers.
+
+    Writes one or more numbers of the specified format to the currently written structure. Usually it is
+    more convenient to use operator `<<` instead of this method.
+    @param fmt Specification of each array element, see @ref format_spec "format specification"
+    @param vec Pointer to the written array.
+    @param len Number of the uchar elements to write.
+     */
+    void writeRaw( const String& fmt, const uchar* vec, size_t len );
+
+    /** @brief Writes the registered C structure (CvMat, CvMatND, CvSeq).
+    @param name Name of the written object.
+    @param obj Pointer to the object.
+    @see ocvWrite for details.
+     */
+    void writeObj( const String& name, const void* obj );
+
+    /** @brief Returns the normalized object name for the specified name of a file.
+    @param filename Name of a file
+    @returns The normalized object name.
+     */
+    static String getDefaultObjectName(const String& filename);
+
+    Ptr<CvFileStorage> fs; //!< the underlying C FileStorage structure
+    String elname; //!< the currently written element
+    std::vector<char> structs; //!< the stack of written structures
+    int state; //!< the writer state
+};
+
+template<> CV_EXPORTS void DefaultDeleter<CvFileStorage>::operator ()(CvFileStorage* obj) const;
+
+/** @brief File Storage Node class.
+
+The node is used to store each and every element of the file storage opened for reading. When
+XML/YAML file is read, it is first parsed and stored in the memory as a hierarchical collection of
+nodes. Each node can be a 鈥渓eaf鈥� that is contain a single number or a string, or be a collection of
+other nodes. There can be named collections (mappings) where each element has a name and it is
+accessed by a name, and ordered collections (sequences) where elements do not have names but rather
+accessed by index. Type of the file node can be determined using FileNode::type method.
+
+Note that file nodes are only used for navigating file storages opened for reading. When a file
+storage is opened for writing, no data is stored in memory after it is written.
+ */
+class CV_EXPORTS_W_SIMPLE FileNode
+{
+public:
+    //! type of the file storage node
+    enum Type
+    {
+        NONE      = 0, //!< empty node
+        INT       = 1, //!< an integer
+        REAL      = 2, //!< floating-point number
+        FLOAT     = REAL, //!< synonym or REAL
+        STR       = 3, //!< text string in UTF-8 encoding
+        STRING    = STR, //!< synonym for STR
+        REF       = 4, //!< integer of size size_t. Typically used for storing complex dynamic structures where some elements reference the others
+        SEQ       = 5, //!< sequence
+        MAP       = 6, //!< mapping
+        TYPE_MASK = 7,
+        FLOW      = 8,  //!< compact representation of a sequence or mapping. Used only by YAML writer
+        USER      = 16, //!< a registered object (e.g. a matrix)
+        EMPTY     = 32, //!< empty structure (sequence or mapping)
+        NAMED     = 64  //!< the node has a name (i.e. it is element of a mapping)
+    };
+    /** @brief The constructors.
+
+    These constructors are used to create a default file node, construct it from obsolete structures or
+    from the another file node.
+     */
+    CV_WRAP FileNode();
+
+    /** @overload
+    @param fs Pointer to the obsolete file storage structure.
+    @param node File node to be used as initialization for the created file node.
+    */
+    FileNode(const CvFileStorage* fs, const CvFileNode* node);
+
+    /** @overload
+    @param node File node to be used as initialization for the created file node.
+    */
+    FileNode(const FileNode& node);
+
+    /** @brief Returns element of a mapping node or a sequence node.
+    @param nodename Name of an element in the mapping node.
+    @returns Returns the element with the given identifier.
+     */
+    FileNode operator[](const String& nodename) const;
+
+    /** @overload
+    @param nodename Name of an element in the mapping node.
+    */
+    CV_WRAP FileNode operator[](const char* nodename) const;
+
+    /** @overload
+    @param i Index of an element in the sequence node.
+    */
+    CV_WRAP FileNode operator[](int i) const;
+
+    /** @brief Returns type of the node.
+    @returns Type of the node. See FileNode::Type
+     */
+    CV_WRAP int type() const;
+
+    //! returns true if the node is empty
+    CV_WRAP bool empty() const;
+    //! returns true if the node is a "none" object
+    CV_WRAP bool isNone() const;
+    //! returns true if the node is a sequence
+    CV_WRAP bool isSeq() const;
+    //! returns true if the node is a mapping
+    CV_WRAP bool isMap() const;
+    //! returns true if the node is an integer
+    CV_WRAP bool isInt() const;
+    //! returns true if the node is a floating-point number
+    CV_WRAP bool isReal() const;
+    //! returns true if the node is a text string
+    CV_WRAP bool isString() const;
+    //! returns true if the node has a name
+    CV_WRAP bool isNamed() const;
+    //! returns the node name or an empty string if the node is nameless
+    CV_WRAP String name() const;
+    //! returns the number of elements in the node, if it is a sequence or mapping, or 1 otherwise.
+    CV_WRAP size_t size() const;
+    //! returns the node content as an integer. If the node stores floating-point number, it is rounded.
+    operator int() const;
+    //! returns the node content as float
+    operator float() const;
+    //! returns the node content as double
+    operator double() const;
+    //! returns the node content as text string
+    operator String() const;
+#ifndef OPENCV_NOSTL
+    operator std::string() const;
+#endif
+
+    //! returns pointer to the underlying file node
+    CvFileNode* operator *();
+    //! returns pointer to the underlying file node
+    const CvFileNode* operator* () const;
+
+    //! returns iterator pointing to the first node element
+    FileNodeIterator begin() const;
+    //! returns iterator pointing to the element following the last node element
+    FileNodeIterator end() const;
+
+    /** @brief Reads node elements to the buffer with the specified format.
+
+    Usually it is more convenient to use operator `>>` instead of this method.
+    @param fmt Specification of each array element. See @ref format_spec "format specification"
+    @param vec Pointer to the destination array.
+    @param len Number of elements to read. If it is greater than number of remaining elements then all
+    of them will be read.
+     */
+    void readRaw( const String& fmt, uchar* vec, size_t len ) const;
+
+    //! reads the registered object and returns pointer to it
+    void* readObj() const;
+
+    // do not use wrapper pointer classes for better efficiency
+    const CvFileStorage* fs;
+    const CvFileNode* node;
+};
+
+
+/** @brief used to iterate through sequences and mappings.
+
+A standard STL notation, with node.begin(), node.end() denoting the beginning and the end of a
+sequence, stored in node. See the data reading sample in the beginning of the section.
+ */
+class CV_EXPORTS FileNodeIterator
+{
+public:
+    /** @brief The constructors.
+
+    These constructors are used to create a default iterator, set it to specific element in a file node
+    or construct it from another iterator.
+     */
+    FileNodeIterator();
+
+    /** @overload
+    @param fs File storage for the iterator.
+    @param node File node for the iterator.
+    @param ofs Index of the element in the node. The created iterator will point to this element.
+    */
+    FileNodeIterator(const CvFileStorage* fs, const CvFileNode* node, size_t ofs=0);
+
+    /** @overload
+    @param it Iterator to be used as initialization for the created iterator.
+    */
+    FileNodeIterator(const FileNodeIterator& it);
+
+    //! returns the currently observed element
+    FileNode operator *() const;
+    //! accesses the currently observed element methods
+    FileNode operator ->() const;
+
+    //! moves iterator to the next node
+    FileNodeIterator& operator ++ ();
+    //! moves iterator to the next node
+    FileNodeIterator operator ++ (int);
+    //! moves iterator to the previous node
+    FileNodeIterator& operator -- ();
+    //! moves iterator to the previous node
+    FileNodeIterator operator -- (int);
+    //! moves iterator forward by the specified offset (possibly negative)
+    FileNodeIterator& operator += (int ofs);
+    //! moves iterator backward by the specified offset (possibly negative)
+    FileNodeIterator& operator -= (int ofs);
+
+    /** @brief Reads node elements to the buffer with the specified format.
+
+    Usually it is more convenient to use operator `>>` instead of this method.
+    @param fmt Specification of each array element. See @ref format_spec "format specification"
+    @param vec Pointer to the destination array.
+    @param maxCount Number of elements to read. If it is greater than number of remaining elements then
+    all of them will be read.
+     */
+    FileNodeIterator& readRaw( const String& fmt, uchar* vec,
+                               size_t maxCount=(size_t)INT_MAX );
+
+    struct SeqReader
+    {
+      int          header_size;
+      void*        seq;        /* sequence, beign read; CvSeq      */
+      void*        block;      /* current block;        CvSeqBlock */
+      schar*       ptr;        /* pointer to element be read next */
+      schar*       block_min;  /* pointer to the beginning of block */
+      schar*       block_max;  /* pointer to the end of block */
+      int          delta_index;/* = seq->first->start_index   */
+      schar*       prev_elem;  /* pointer to previous element */
+    };
+
+    const CvFileStorage* fs;
+    const CvFileNode* container;
+    SeqReader reader;
+    size_t remaining;
+};
+
+//! @} core_xml
+
+/////////////////// XML & YAML I/O implementation //////////////////
+
+//! @relates cv::FileStorage
+//! @{
+
+CV_EXPORTS void write( FileStorage& fs, const String& name, int value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, float value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, double value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, const String& value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, const Mat& value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, const SparseMat& value );
+CV_EXPORTS void write( FileStorage& fs, const String& name, const std::vector<KeyPoint>& value);
+CV_EXPORTS void write( FileStorage& fs, const String& name, const std::vector<DMatch>& value);
+
+CV_EXPORTS void writeScalar( FileStorage& fs, int value );
+CV_EXPORTS void writeScalar( FileStorage& fs, float value );
+CV_EXPORTS void writeScalar( FileStorage& fs, double value );
+CV_EXPORTS void writeScalar( FileStorage& fs, const String& value );
+
+//! @}
+
+//! @relates cv::FileNode
+//! @{
+
+CV_EXPORTS void read(const FileNode& node, int& value, int default_value);
+CV_EXPORTS void read(const FileNode& node, float& value, float default_value);
+CV_EXPORTS void read(const FileNode& node, double& value, double default_value);
+CV_EXPORTS void read(const FileNode& node, String& value, const String& default_value);
+CV_EXPORTS void read(const FileNode& node, Mat& mat, const Mat& default_mat = Mat() );
+CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat = SparseMat() );
+CV_EXPORTS void read(const FileNode& node, std::vector<KeyPoint>& keypoints);
+CV_EXPORTS void read(const FileNode& node, std::vector<DMatch>& matches);
+
+template<typename _Tp> static inline void read(const FileNode& node, Point_<_Tp>& value, const Point_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 2 ? default_value : Point_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Point3_<_Tp>& value, const Point3_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 3 ? default_value : Point3_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
+                                                            saturate_cast<_Tp>(temp[2]));
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Size_<_Tp>& value, const Size_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 2 ? default_value : Size_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Complex<_Tp>& value, const Complex<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 2 ? default_value : Complex<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Rect_<_Tp>& value, const Rect_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 4 ? default_value : Rect_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
+                                                          saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
+}
+
+template<typename _Tp, int cn> static inline void read(const FileNode& node, Vec<_Tp, cn>& value, const Vec<_Tp, cn>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != cn ? default_value : Vec<_Tp, cn>(&temp[0]);
+}
+
+template<typename _Tp> static inline void read(const FileNode& node, Scalar_<_Tp>& value, const Scalar_<_Tp>& default_value)
+{
+    std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
+    value = temp.size() != 4 ? default_value : Scalar_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
+                                                            saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
+}
+
+static inline void read(const FileNode& node, Range& value, const Range& default_value)
+{
+    Point2i temp(value.start, value.end); const Point2i default_temp = Point2i(default_value.start, default_value.end);
+    read(node, temp, default_temp);
+    value.start = temp.x; value.end = temp.y;
+}
+
+//! @}
+
+/** @brief Writes string to a file storage.
+@relates cv::FileStorage
+ */
+CV_EXPORTS FileStorage& operator << (FileStorage& fs, const String& str);
+
+//! @cond IGNORED
+
+namespace internal
+{
+    class CV_EXPORTS WriteStructContext
+    {
+    public:
+        WriteStructContext(FileStorage& _fs, const String& name, int flags, const String& typeName = String());
+        ~WriteStructContext();
+    private:
+        FileStorage* fs;
+    };
+
+    template<typename _Tp, int numflag> class VecWriterProxy
+    {
+    public:
+        VecWriterProxy( FileStorage* _fs ) : fs(_fs) {}
+        void operator()(const std::vector<_Tp>& vec) const
+        {
+            size_t count = vec.size();
+            for (size_t i = 0; i < count; i++)
+                write(*fs, vec[i]);
+        }
+    private:
+        FileStorage* fs;
+    };
+
+    template<typename _Tp> class VecWriterProxy<_Tp, 1>
+    {
+    public:
+        VecWriterProxy( FileStorage* _fs ) : fs(_fs) {}
+        void operator()(const std::vector<_Tp>& vec) const
+        {
+            int _fmt = DataType<_Tp>::fmt;
+            char fmt[] = { (char)((_fmt >> 8) + '1'), (char)_fmt, '\0' };
+            fs->writeRaw(fmt, !vec.empty() ? (uchar*)&vec[0] : 0, vec.size() * sizeof(_Tp));
+        }
+    private:
+        FileStorage* fs;
+    };
+
+    template<typename _Tp, int numflag> class VecReaderProxy
+    {
+    public:
+        VecReaderProxy( FileNodeIterator* _it ) : it(_it) {}
+        void operator()(std::vector<_Tp>& vec, size_t count) const
+        {
+            count = std::min(count, it->remaining);
+            vec.resize(count);
+            for (size_t i = 0; i < count; i++, ++(*it))
+                read(**it, vec[i], _Tp());
+        }
+    private:
+        FileNodeIterator* it;
+    };
+
+    template<typename _Tp> class VecReaderProxy<_Tp, 1>
+    {
+    public:
+        VecReaderProxy( FileNodeIterator* _it ) : it(_it) {}
+        void operator()(std::vector<_Tp>& vec, size_t count) const
+        {
+            size_t remaining = it->remaining;
+            size_t cn = DataType<_Tp>::channels;
+            int _fmt = DataType<_Tp>::fmt;
+            char fmt[] = { (char)((_fmt >> 8)+'1'), (char)_fmt, '\0' };
+            size_t remaining1 = remaining / cn;
+            count = count < remaining1 ? count : remaining1;
+            vec.resize(count);
+            it->readRaw(fmt, !vec.empty() ? (uchar*)&vec[0] : 0, count*sizeof(_Tp));
+        }
+    private:
+        FileNodeIterator* it;
+    };
+
+} // internal
+
+//! @endcond
+
+//! @relates cv::FileStorage
+//! @{
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const _Tp& value)
+{
+    write(fs, String(), value);
+}
+
+template<> inline
+void write( FileStorage& fs, const int& value )
+{
+    writeScalar(fs, value);
+}
+
+template<> inline
+void write( FileStorage& fs, const float& value )
+{
+    writeScalar(fs, value);
+}
+
+template<> inline
+void write( FileStorage& fs, const double& value )
+{
+    writeScalar(fs, value);
+}
+
+template<> inline
+void write( FileStorage& fs, const String& value )
+{
+    writeScalar(fs, value);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Point_<_Tp>& pt )
+{
+    write(fs, pt.x);
+    write(fs, pt.y);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Point3_<_Tp>& pt )
+{
+    write(fs, pt.x);
+    write(fs, pt.y);
+    write(fs, pt.z);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Size_<_Tp>& sz )
+{
+    write(fs, sz.width);
+    write(fs, sz.height);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Complex<_Tp>& c )
+{
+    write(fs, c.re);
+    write(fs, c.im);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Rect_<_Tp>& r )
+{
+    write(fs, r.x);
+    write(fs, r.y);
+    write(fs, r.width);
+    write(fs, r.height);
+}
+
+template<typename _Tp, int cn> static inline
+void write(FileStorage& fs, const Vec<_Tp, cn>& v )
+{
+    for(int i = 0; i < cn; i++)
+        write(fs, v.val[i]);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const Scalar_<_Tp>& s )
+{
+    write(fs, s.val[0]);
+    write(fs, s.val[1]);
+    write(fs, s.val[2]);
+    write(fs, s.val[3]);
+}
+
+static inline
+void write(FileStorage& fs, const Range& r )
+{
+    write(fs, r.start);
+    write(fs, r.end);
+}
+
+template<typename _Tp> static inline
+void write( FileStorage& fs, const std::vector<_Tp>& vec )
+{
+    cv::internal::VecWriterProxy<_Tp, DataType<_Tp>::fmt != 0> w(&fs);
+    w(vec);
+}
+
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Point_<_Tp>& pt )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, pt);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Point3_<_Tp>& pt )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, pt);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Size_<_Tp>& sz )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, sz);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Complex<_Tp>& c )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, c);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Rect_<_Tp>& r )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, r);
+}
+
+template<typename _Tp, int cn> static inline
+void write(FileStorage& fs, const String& name, const Vec<_Tp, cn>& v )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, v);
+}
+
+template<typename _Tp> static inline
+void write(FileStorage& fs, const String& name, const Scalar_<_Tp>& s )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, s);
+}
+
+static inline
+void write(FileStorage& fs, const String& name, const Range& r )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+FileNode::FLOW);
+    write(fs, r);
+}
+
+template<typename _Tp> static inline
+void write( FileStorage& fs, const String& name, const std::vector<_Tp>& vec )
+{
+    cv::internal::WriteStructContext ws(fs, name, FileNode::SEQ+(DataType<_Tp>::fmt != 0 ? FileNode::FLOW : 0));
+    write(fs, vec);
+}
+
+//! @} FileStorage
+
+//! @relates cv::FileNode
+//! @{
+
+static inline
+void read(const FileNode& node, bool& value, bool default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = temp != 0;
+}
+
+static inline
+void read(const FileNode& node, uchar& value, uchar default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = saturate_cast<uchar>(temp);
+}
+
+static inline
+void read(const FileNode& node, schar& value, schar default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = saturate_cast<schar>(temp);
+}
+
+static inline
+void read(const FileNode& node, ushort& value, ushort default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = saturate_cast<ushort>(temp);
+}
+
+static inline
+void read(const FileNode& node, short& value, short default_value)
+{
+    int temp;
+    read(node, temp, (int)default_value);
+    value = saturate_cast<short>(temp);
+}
+
+template<typename _Tp> static inline
+void read( FileNodeIterator& it, std::vector<_Tp>& vec, size_t maxCount = (size_t)INT_MAX )
+{
+    cv::internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
+    r(vec, maxCount);
+}
+
+template<typename _Tp> static inline
+void read( const FileNode& node, std::vector<_Tp>& vec, const std::vector<_Tp>& default_value = std::vector<_Tp>() )
+{
+    if(!node.node)
+        vec = default_value;
+    else
+    {
+        FileNodeIterator it = node.begin();
+        read( it, vec );
+    }
+}
+
+//! @} FileNode
+
+//! @relates cv::FileStorage
+//! @{
+
+/** @brief Writes data to a file storage.
+ */
+template<typename _Tp> static inline
+FileStorage& operator << (FileStorage& fs, const _Tp& value)
+{
+    if( !fs.isOpened() )
+        return fs;
+    if( fs.state == FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP )
+        CV_Error( Error::StsError, "No element name has been given" );
+    write( fs, fs.elname, value );
+    if( fs.state & FileStorage::INSIDE_MAP )
+        fs.state = FileStorage::NAME_EXPECTED + FileStorage::INSIDE_MAP;
+    return fs;
+}
+
+/** @brief Writes data to a file storage.
+ */
+static inline
+FileStorage& operator << (FileStorage& fs, const char* str)
+{
+    return (fs << String(str));
+}
+
+/** @brief Writes data to a file storage.
+ */
+static inline
+FileStorage& operator << (FileStorage& fs, char* value)
+{
+    return (fs << String(value));
+}
+
+//! @} FileStorage
+
+//! @relates cv::FileNodeIterator
+//! @{
+
+/** @brief Reads data from a file storage.
+ */
+template<typename _Tp> static inline
+FileNodeIterator& operator >> (FileNodeIterator& it, _Tp& value)
+{
+    read( *it, value, _Tp());
+    return ++it;
+}
+
+/** @brief Reads data from a file storage.
+ */
+template<typename _Tp> static inline
+FileNodeIterator& operator >> (FileNodeIterator& it, std::vector<_Tp>& vec)
+{
+    cv::internal::VecReaderProxy<_Tp, DataType<_Tp>::fmt != 0> r(&it);
+    r(vec, (size_t)INT_MAX);
+    return it;
+}
+
+//! @} FileNodeIterator
+
+//! @relates cv::FileNode
+//! @{
+
+/** @brief Reads data from a file storage.
+ */
+template<typename _Tp> static inline
+void operator >> (const FileNode& n, _Tp& value)
+{
+    read( n, value, _Tp());
+}
+
+/** @brief Reads data from a file storage.
+ */
+template<typename _Tp> static inline
+void operator >> (const FileNode& n, std::vector<_Tp>& vec)
+{
+    FileNodeIterator it = n.begin();
+    it >> vec;
+}
+
+//! @} FileNode
+
+//! @relates cv::FileNodeIterator
+//! @{
+
+static inline
+bool operator == (const FileNodeIterator& it1, const FileNodeIterator& it2)
+{
+    return it1.fs == it2.fs && it1.container == it2.container &&
+        it1.reader.ptr == it2.reader.ptr && it1.remaining == it2.remaining;
+}
+
+static inline
+bool operator != (const FileNodeIterator& it1, const FileNodeIterator& it2)
+{
+    return !(it1 == it2);
+}
+
+static inline
+ptrdiff_t operator - (const FileNodeIterator& it1, const FileNodeIterator& it2)
+{
+    return it2.remaining - it1.remaining;
+}
+
+static inline
+bool operator < (const FileNodeIterator& it1, const FileNodeIterator& it2)
+{
+    return it1.remaining > it2.remaining;
+}
+
+//! @} FileNodeIterator
+
+//! @cond IGNORED
+
+inline FileNode FileStorage::getFirstTopLevelNode() const { FileNode r = root(); FileNodeIterator it = r.begin(); return it != r.end() ? *it : FileNode(); }
+inline FileNode::FileNode() : fs(0), node(0) {}
+inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node) : fs(_fs), node(_node) {}
+inline FileNode::FileNode(const FileNode& _node) : fs(_node.fs), node(_node.node) {}
+inline bool FileNode::empty() const    { return node   == 0;    }
+inline bool FileNode::isNone() const   { return type() == NONE; }
+inline bool FileNode::isSeq() const    { return type() == SEQ;  }
+inline bool FileNode::isMap() const    { return type() == MAP;  }
+inline bool FileNode::isInt() const    { return type() == INT;  }
+inline bool FileNode::isReal() const   { return type() == REAL; }
+inline bool FileNode::isString() const { return type() == STR;  }
+inline CvFileNode* FileNode::operator *() { return (CvFileNode*)node; }
+inline const CvFileNode* FileNode::operator* () const { return node; }
+inline FileNode::operator int() const    { int value;    read(*this, value, 0);     return value; }
+inline FileNode::operator float() const  { float value;  read(*this, value, 0.f);   return value; }
+inline FileNode::operator double() const { double value; read(*this, value, 0.);    return value; }
+inline FileNode::operator String() const { String value; read(*this, value, value); return value; }
+inline FileNodeIterator FileNode::begin() const { return FileNodeIterator(fs, node); }
+inline FileNodeIterator FileNode::end() const   { return FileNodeIterator(fs, node, size()); }
+inline void FileNode::readRaw( const String& fmt, uchar* vec, size_t len ) const { begin().readRaw( fmt, vec, len ); }
+inline FileNode FileNodeIterator::operator *() const  { return FileNode(fs, (const CvFileNode*)(const void*)reader.ptr); }
+inline FileNode FileNodeIterator::operator ->() const { return FileNode(fs, (const CvFileNode*)(const void*)reader.ptr); }
+inline String::String(const FileNode& fn): cstr_(0), len_(0) { read(fn, *this, *this); }
+
+//! @endcond
+
+} // cv
+
+#endif // __OPENCV_CORE_PERSISTENCE_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp
new file mode 100644
index 0000000..d676ce8
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/private.cuda.hpp
@@ -0,0 +1,172 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_PRIVATE_CUDA_HPP__
+#define __OPENCV_CORE_PRIVATE_CUDA_HPP__
+
+#ifndef __OPENCV_BUILD
+#  error this is a private header which should not be used from outside of the OpenCV library
+#endif
+
+#include "cvconfig.h"
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/base.hpp"
+
+#include "opencv2/core/cuda.hpp"
+
+#ifdef HAVE_CUDA
+#  include <cuda.h>
+#  include <cuda_runtime.h>
+#  include <npp.h>
+#  include "opencv2/core/cuda_stream_accessor.hpp"
+#  include "opencv2/core/cuda/common.hpp"
+
+#  define NPP_VERSION (NPP_VERSION_MAJOR * 1000 + NPP_VERSION_MINOR * 100 + NPP_VERSION_BUILD)
+
+#  define CUDART_MINIMUM_REQUIRED_VERSION 4020
+
+#  if (CUDART_VERSION < CUDART_MINIMUM_REQUIRED_VERSION)
+#    error "Insufficient Cuda Runtime library version, please update it."
+#  endif
+
+#  if defined(CUDA_ARCH_BIN_OR_PTX_10)
+#    error "OpenCV CUDA module doesn't support NVIDIA compute capability 1.0"
+#  endif
+#endif
+
+//! @cond IGNORED
+
+namespace cv { namespace cuda {
+    CV_EXPORTS cv::String getNppErrorMessage(int code);
+    CV_EXPORTS cv::String getCudaDriverApiErrorMessage(int code);
+
+    CV_EXPORTS GpuMat getInputMat(InputArray _src, Stream& stream);
+
+    CV_EXPORTS GpuMat getOutputMat(OutputArray _dst, int rows, int cols, int type, Stream& stream);
+    static inline GpuMat getOutputMat(OutputArray _dst, Size size, int type, Stream& stream)
+    {
+        return getOutputMat(_dst, size.height, size.width, type, stream);
+    }
+
+    CV_EXPORTS void syncOutput(const GpuMat& dst, OutputArray _dst, Stream& stream);
+}}
+
+#ifndef HAVE_CUDA
+
+static inline void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The library is compiled without CUDA support"); }
+
+#else // HAVE_CUDA
+
+static inline void throw_no_cuda() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); }
+
+namespace cv { namespace cuda
+{
+    class CV_EXPORTS BufferPool
+    {
+    public:
+        explicit BufferPool(Stream& stream);
+
+        GpuMat getBuffer(int rows, int cols, int type);
+        GpuMat getBuffer(Size size, int type) { return getBuffer(size.height, size.width, type); }
+
+        GpuMat::Allocator* getAllocator() const { return allocator_; }
+
+    private:
+        GpuMat::Allocator* allocator_;
+    };
+
+    static inline void checkNppError(int code, const char* file, const int line, const char* func)
+    {
+        if (code < 0)
+            cv::error(cv::Error::GpuApiCallError, getNppErrorMessage(code), func, file, line);
+    }
+
+    static inline void checkCudaDriverApiError(int code, const char* file, const int line, const char* func)
+    {
+        if (code != CUDA_SUCCESS)
+            cv::error(cv::Error::GpuApiCallError, getCudaDriverApiErrorMessage(code), func, file, line);
+    }
+
+    template<int n> struct NPPTypeTraits;
+    template<> struct NPPTypeTraits<CV_8U>  { typedef Npp8u npp_type; };
+    template<> struct NPPTypeTraits<CV_8S>  { typedef Npp8s npp_type; };
+    template<> struct NPPTypeTraits<CV_16U> { typedef Npp16u npp_type; };
+    template<> struct NPPTypeTraits<CV_16S> { typedef Npp16s npp_type; };
+    template<> struct NPPTypeTraits<CV_32S> { typedef Npp32s npp_type; };
+    template<> struct NPPTypeTraits<CV_32F> { typedef Npp32f npp_type; };
+    template<> struct NPPTypeTraits<CV_64F> { typedef Npp64f npp_type; };
+
+    class NppStreamHandler
+    {
+    public:
+        inline explicit NppStreamHandler(Stream& newStream)
+        {
+            oldStream = nppGetStream();
+            nppSetStream(StreamAccessor::getStream(newStream));
+        }
+
+        inline explicit NppStreamHandler(cudaStream_t newStream)
+        {
+            oldStream = nppGetStream();
+            nppSetStream(newStream);
+        }
+
+        inline ~NppStreamHandler()
+        {
+            nppSetStream(oldStream);
+        }
+
+    private:
+        cudaStream_t oldStream;
+    };
+}}
+
+#define nppSafeCall(expr)  cv::cuda::checkNppError(expr, __FILE__, __LINE__, CV_Func)
+#define cuSafeCall(expr)  cv::cuda::checkCudaDriverApiError(expr, __FILE__, __LINE__, CV_Func)
+
+#endif // HAVE_CUDA
+
+//! @endcond
+
+#endif // __OPENCV_CORE_CUDA_PRIVATE_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/private.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/private.hpp
new file mode 100644
index 0000000..c71ec62
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/private.hpp
@@ -0,0 +1,425 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_PRIVATE_HPP__
+#define __OPENCV_CORE_PRIVATE_HPP__
+
+#ifndef __OPENCV_BUILD
+#  error this is a private header which should not be used from outside of the OpenCV library
+#endif
+
+#include "opencv2/core.hpp"
+#include "cvconfig.h"
+
+#ifdef HAVE_EIGEN
+#  if defined __GNUC__ && defined __APPLE__
+#    pragma GCC diagnostic ignored "-Wshadow"
+#  endif
+#  include <Eigen/Core>
+#  include "opencv2/core/eigen.hpp"
+#endif
+
+#ifdef HAVE_TBB
+#  include "tbb/tbb_stddef.h"
+#  if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
+#    include "tbb/tbb.h"
+#    include "tbb/task.h"
+#    undef min
+#    undef max
+#  else
+#    undef HAVE_TBB
+#  endif
+#endif
+
+//! @cond IGNORED
+
+namespace cv
+{
+#ifdef HAVE_TBB
+
+    typedef tbb::blocked_range<int> BlockedRange;
+
+    template<typename Body> static inline
+    void parallel_for( const BlockedRange& range, const Body& body )
+    {
+        tbb::parallel_for(range, body);
+    }
+
+    typedef tbb::split Split;
+
+    template<typename Body> static inline
+    void parallel_reduce( const BlockedRange& range, Body& body )
+    {
+        tbb::parallel_reduce(range, body);
+    }
+
+    typedef tbb::concurrent_vector<Rect> ConcurrentRectVector;
+#else
+    class BlockedRange
+    {
+    public:
+        BlockedRange() : _begin(0), _end(0), _grainsize(0) {}
+        BlockedRange(int b, int e, int g=1) : _begin(b), _end(e), _grainsize(g) {}
+        int begin() const { return _begin; }
+        int end() const { return _end; }
+        int grainsize() const { return _grainsize; }
+
+    protected:
+        int _begin, _end, _grainsize;
+    };
+
+    template<typename Body> static inline
+    void parallel_for( const BlockedRange& range, const Body& body )
+    {
+        body(range);
+    }
+    typedef std::vector<Rect> ConcurrentRectVector;
+
+    class Split {};
+
+    template<typename Body> static inline
+    void parallel_reduce( const BlockedRange& range, Body& body )
+    {
+        body(range);
+    }
+#endif
+
+    // Returns a static string if there is a parallel framework,
+    // NULL otherwise.
+    CV_EXPORTS const char* currentParallelFramework();
+} //namespace cv
+
+/****************************************************************************************\
+*                                  Common declarations                                   *
+\****************************************************************************************/
+
+/* the alignment of all the allocated buffers */
+#define  CV_MALLOC_ALIGN    16
+
+/* IEEE754 constants and macros */
+#define  CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
+#define  CV_TOGGLE_DBL(x) ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
+
+static inline void* cvAlignPtr( const void* ptr, int align = 32 )
+{
+    CV_DbgAssert ( (align & (align-1)) == 0 );
+    return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
+}
+
+static inline int cvAlign( int size, int align )
+{
+    CV_DbgAssert( (align & (align-1)) == 0 && size < INT_MAX );
+    return (size + align - 1) & -align;
+}
+
+#ifdef IPL_DEPTH_8U
+static inline cv::Size cvGetMatSize( const CvMat* mat )
+{
+    return cv::Size(mat->cols, mat->rows);
+}
+#endif
+
+namespace cv
+{
+CV_EXPORTS void scalarToRawData(const cv::Scalar& s, void* buf, int type, int unroll_to = 0);
+}
+
+// property implementation macros
+
+#define CV_IMPL_PROPERTY_RO(type, name, member) \
+    inline type get##name() const { return member; }
+
+#define CV_HELP_IMPL_PROPERTY(r_type, w_type, name, member) \
+    CV_IMPL_PROPERTY_RO(r_type, name, member) \
+    inline void set##name(w_type val) { member = val; }
+
+#define CV_HELP_WRAP_PROPERTY(r_type, w_type, name, internal_name, internal_obj) \
+    r_type get##name() const { return internal_obj.get##internal_name(); } \
+    void set##name(w_type val) { internal_obj.set##internal_name(val); }
+
+#define CV_IMPL_PROPERTY(type, name, member) CV_HELP_IMPL_PROPERTY(type, type, name, member)
+#define CV_IMPL_PROPERTY_S(type, name, member) CV_HELP_IMPL_PROPERTY(type, const type &, name, member)
+
+#define CV_WRAP_PROPERTY(type, name, internal_name, internal_obj)  CV_HELP_WRAP_PROPERTY(type, type, name, internal_name, internal_obj)
+#define CV_WRAP_PROPERTY_S(type, name, internal_name, internal_obj) CV_HELP_WRAP_PROPERTY(type, const type &, name, internal_name, internal_obj)
+
+#define CV_WRAP_SAME_PROPERTY(type, name, internal_obj) CV_WRAP_PROPERTY(type, name, name, internal_obj)
+#define CV_WRAP_SAME_PROPERTY_S(type, name, internal_obj) CV_WRAP_PROPERTY_S(type, name, name, internal_obj)
+
+/****************************************************************************************\
+*                     Structures and macros for integration with IPP                     *
+\****************************************************************************************/
+
+#ifdef HAVE_IPP
+#include "ipp.h"
+
+#ifndef IPP_VERSION_UPDATE // prior to 7.1
+#define IPP_VERSION_UPDATE 0
+#endif
+
+#define IPP_VERSION_X100 (IPP_VERSION_MAJOR * 100 + IPP_VERSION_MINOR*10 + IPP_VERSION_UPDATE)
+
+// General define for ipp function disabling
+#define IPP_DISABLE_BLOCK 0
+
+#ifdef CV_MALLOC_ALIGN
+#undef CV_MALLOC_ALIGN
+#endif
+#define CV_MALLOC_ALIGN 32 // required for AVX optimization
+
+#define setIppErrorStatus() cv::ipp::setIppStatus(-1, CV_Func, __FILE__, __LINE__)
+
+static inline IppiSize ippiSize(int width, int height)
+{
+    IppiSize size = { width, height };
+    return size;
+}
+
+static inline IppiSize ippiSize(const cv::Size & _size)
+{
+    IppiSize size = { _size.width, _size.height };
+    return size;
+}
+
+static inline IppiBorderType ippiGetBorderType(int borderTypeNI)
+{
+    return borderTypeNI == cv::BORDER_CONSTANT ? ippBorderConst :
+        borderTypeNI == cv::BORDER_WRAP ? ippBorderWrap :
+        borderTypeNI == cv::BORDER_REPLICATE ? ippBorderRepl :
+        borderTypeNI == cv::BORDER_REFLECT_101 ? ippBorderMirror :
+        borderTypeNI == cv::BORDER_REFLECT ? ippBorderMirrorR : (IppiBorderType)-1;
+}
+
+static inline IppDataType ippiGetDataType(int depth)
+{
+    return depth == CV_8U ? ipp8u :
+        depth == CV_8S ? ipp8s :
+        depth == CV_16U ? ipp16u :
+        depth == CV_16S ? ipp16s :
+        depth == CV_32S ? ipp32s :
+        depth == CV_32F ? ipp32f :
+        depth == CV_64F ? ipp64f : (IppDataType)-1;
+}
+
+// IPP temporary buffer hepler
+template<typename T>
+class IppAutoBuffer
+{
+public:
+    IppAutoBuffer() { m_pBuffer = NULL; }
+    IppAutoBuffer(int size) { Alloc(size); }
+    ~IppAutoBuffer() { Release(); }
+    T* Alloc(int size) { m_pBuffer = (T*)ippMalloc(size); return m_pBuffer; }
+    void Release() { if(m_pBuffer) ippFree(m_pBuffer); }
+    inline operator T* () { return (T*)m_pBuffer;}
+    inline operator const T* () const { return (const T*)m_pBuffer;}
+private:
+    // Disable copy operations
+    IppAutoBuffer(IppAutoBuffer &) {};
+    IppAutoBuffer& operator =(const IppAutoBuffer &) {return *this;};
+
+    T* m_pBuffer;
+};
+
+#else
+#define IPP_VERSION_X100 0
+#endif
+
+// There shoud be no API difference in OpenCV between ICV and IPP since 9.0
+#if (defined HAVE_IPP_ICV_ONLY) && IPP_VERSION_X100 >= 900
+#undef HAVE_IPP_ICV_ONLY
+#endif
+
+#ifdef HAVE_IPP_ICV_ONLY
+#define HAVE_ICV 1
+#else
+#define HAVE_ICV 0
+#endif
+
+#if defined HAVE_IPP
+#if IPP_VERSION_X100 >= 900
+#define IPP_INITIALIZER(FEAT)                           \
+{                                                       \
+    if(FEAT)                                            \
+        ippSetCpuFeatures(FEAT);                        \
+    else                                                \
+        ippInit();                                      \
+}
+#elif IPP_VERSION_X100 >= 800
+#define IPP_INITIALIZER(FEAT)                           \
+{                                                       \
+    ippInit();                                          \
+}
+#else
+#define IPP_INITIALIZER(FEAT)                           \
+{                                                       \
+    ippStaticInit();                                    \
+}
+#endif
+
+#ifdef CVAPI_EXPORTS
+#define IPP_INITIALIZER_AUTO                            \
+struct __IppInitializer__                               \
+{                                                       \
+    __IppInitializer__()                                \
+    {IPP_INITIALIZER(cv::ipp::getIppFeatures())}        \
+};                                                      \
+static struct __IppInitializer__ __ipp_initializer__;
+#else
+#define IPP_INITIALIZER_AUTO
+#endif
+#else
+#define IPP_INITIALIZER
+#define IPP_INITIALIZER_AUTO
+#endif
+
+#define CV_IPP_CHECK_COND (cv::ipp::useIPP())
+#define CV_IPP_CHECK() if(CV_IPP_CHECK_COND)
+
+#ifdef HAVE_IPP
+
+#ifdef CV_IPP_RUN_VERBOSE
+#define CV_IPP_RUN_(condition, func, ...)                                   \
+    {                                                                       \
+        if (cv::ipp::useIPP() && (condition) && func)                       \
+        {                                                                   \
+            printf("%s: IPP implementation is running\n", CV_Func);         \
+            fflush(stdout);                                                 \
+            CV_IMPL_ADD(CV_IMPL_IPP);                                       \
+            return __VA_ARGS__;                                             \
+        }                                                                   \
+        else                                                                \
+        {                                                                   \
+            printf("%s: Plain implementation is running\n", CV_Func);       \
+            fflush(stdout);                                                 \
+        }                                                                   \
+    }
+#elif defined CV_IPP_RUN_ASSERT
+#define CV_IPP_RUN_(condition, func, ...)                                   \
+    {                                                                       \
+        if (cv::ipp::useIPP() && (condition))                               \
+        {                                                                   \
+            if(func)                                                        \
+            {                                                               \
+                CV_IMPL_ADD(CV_IMPL_IPP);                                   \
+            }                                                               \
+            else                                                            \
+            {                                                               \
+                setIppErrorStatus();                                        \
+                CV_Error(cv::Error::StsAssert, #func);                      \
+            }                                                               \
+            return __VA_ARGS__;                                             \
+        }                                                                   \
+    }
+#else
+#define CV_IPP_RUN_(condition, func, ...)                                   \
+    if (cv::ipp::useIPP() && (condition) && func)                           \
+    {                                                                       \
+        CV_IMPL_ADD(CV_IMPL_IPP);                                           \
+        return __VA_ARGS__;                                                 \
+    }
+#endif
+
+#else
+#define CV_IPP_RUN_(condition, func, ...)
+#endif
+
+#define CV_IPP_RUN(condition, func, ...) CV_IPP_RUN_(condition, func, __VA_ARGS__)
+
+
+#ifndef IPPI_CALL
+#  define IPPI_CALL(func) CV_Assert((func) >= 0)
+#endif
+
+/* IPP-compatible return codes */
+typedef enum CvStatus
+{
+    CV_BADMEMBLOCK_ERR          = -113,
+    CV_INPLACE_NOT_SUPPORTED_ERR= -112,
+    CV_UNMATCHED_ROI_ERR        = -111,
+    CV_NOTFOUND_ERR             = -110,
+    CV_BADCONVERGENCE_ERR       = -109,
+
+    CV_BADDEPTH_ERR             = -107,
+    CV_BADROI_ERR               = -106,
+    CV_BADHEADER_ERR            = -105,
+    CV_UNMATCHED_FORMATS_ERR    = -104,
+    CV_UNSUPPORTED_COI_ERR      = -103,
+    CV_UNSUPPORTED_CHANNELS_ERR = -102,
+    CV_UNSUPPORTED_DEPTH_ERR    = -101,
+    CV_UNSUPPORTED_FORMAT_ERR   = -100,
+
+    CV_BADARG_ERR               = -49,  //ipp comp
+    CV_NOTDEFINED_ERR           = -48,  //ipp comp
+
+    CV_BADCHANNELS_ERR          = -47,  //ipp comp
+    CV_BADRANGE_ERR             = -44,  //ipp comp
+    CV_BADSTEP_ERR              = -29,  //ipp comp
+
+    CV_BADFLAG_ERR              =  -12,
+    CV_DIV_BY_ZERO_ERR          =  -11, //ipp comp
+    CV_BADCOEF_ERR              =  -10,
+
+    CV_BADFACTOR_ERR            =  -7,
+    CV_BADPOINT_ERR             =  -6,
+    CV_BADSCALE_ERR             =  -4,
+    CV_OUTOFMEM_ERR             =  -3,
+    CV_NULLPTR_ERR              =  -2,
+    CV_BADSIZE_ERR              =  -1,
+    CV_NO_ERR                   =   0,
+    CV_OK                       =   CV_NO_ERR
+}
+CvStatus;
+
+#ifdef HAVE_TEGRA_OPTIMIZATION
+namespace tegra {
+
+CV_EXPORTS bool useTegra();
+CV_EXPORTS void setUseTegra(bool flag);
+
+}
+#endif
+
+//! @endcond
+
+#endif // __OPENCV_CORE_PRIVATE_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp
new file mode 100644
index 0000000..3f6f214
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/ptr.inl.hpp
@@ -0,0 +1,365 @@
+/*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) 2013, NVIDIA Corporation, 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 copyright holders 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*/
+
+#ifndef __OPENCV_CORE_PTR_INL_HPP__
+#define __OPENCV_CORE_PTR_INL_HPP__
+
+#include <algorithm>
+
+//! @cond IGNORED
+
+namespace cv {
+
+template<typename Y>
+void DefaultDeleter<Y>::operator () (Y* p) const
+{
+    delete p;
+}
+
+namespace detail
+{
+
+struct PtrOwner
+{
+    PtrOwner() : refCount(1)
+    {}
+
+    void incRef()
+    {
+        CV_XADD(&refCount, 1);
+    }
+
+    void decRef()
+    {
+        if (CV_XADD(&refCount, -1) == 1) deleteSelf();
+    }
+
+protected:
+    /* This doesn't really need to be virtual, since PtrOwner is never deleted
+       directly, but it doesn't hurt and it helps avoid warnings. */
+    virtual ~PtrOwner()
+    {}
+
+    virtual void deleteSelf() = 0;
+
+private:
+    unsigned int refCount;
+
+    // noncopyable
+    PtrOwner(const PtrOwner&);
+    PtrOwner& operator = (const PtrOwner&);
+};
+
+template<typename Y, typename D>
+struct PtrOwnerImpl : PtrOwner
+{
+    PtrOwnerImpl(Y* p, D d) : owned(p), deleter(d)
+    {}
+
+    void deleteSelf()
+    {
+        deleter(owned);
+        delete this;
+    }
+
+private:
+    Y* owned;
+    D deleter;
+};
+
+
+}
+
+template<typename T>
+Ptr<T>::Ptr() : owner(NULL), stored(NULL)
+{}
+
+template<typename T>
+template<typename Y>
+Ptr<T>::Ptr(Y* p)
+  : owner(p
+      ? new detail::PtrOwnerImpl<Y, DefaultDeleter<Y> >(p, DefaultDeleter<Y>())
+      : NULL),
+    stored(p)
+{}
+
+template<typename T>
+template<typename Y, typename D>
+Ptr<T>::Ptr(Y* p, D d)
+  : owner(p
+      ? new detail::PtrOwnerImpl<Y, D>(p, d)
+      : NULL),
+    stored(p)
+{}
+
+template<typename T>
+Ptr<T>::Ptr(const Ptr& o) : owner(o.owner), stored(o.stored)
+{
+    if (owner) owner->incRef();
+}
+
+template<typename T>
+template<typename Y>
+Ptr<T>::Ptr(const Ptr<Y>& o) : owner(o.owner), stored(o.stored)
+{
+    if (owner) owner->incRef();
+}
+
+template<typename T>
+template<typename Y>
+Ptr<T>::Ptr(const Ptr<Y>& o, T* p) : owner(o.owner), stored(p)
+{
+    if (owner) owner->incRef();
+}
+
+template<typename T>
+Ptr<T>::~Ptr()
+{
+    release();
+}
+
+template<typename T>
+Ptr<T>& Ptr<T>::operator = (const Ptr<T>& o)
+{
+    Ptr(o).swap(*this);
+    return *this;
+}
+
+template<typename T>
+template<typename Y>
+Ptr<T>& Ptr<T>::operator = (const Ptr<Y>& o)
+{
+    Ptr(o).swap(*this);
+    return *this;
+}
+
+template<typename T>
+void Ptr<T>::release()
+{
+    if (owner) owner->decRef();
+    owner = NULL;
+    stored = NULL;
+}
+
+template<typename T>
+template<typename Y>
+void Ptr<T>::reset(Y* p)
+{
+    Ptr(p).swap(*this);
+}
+
+template<typename T>
+template<typename Y, typename D>
+void Ptr<T>::reset(Y* p, D d)
+{
+    Ptr(p, d).swap(*this);
+}
+
+template<typename T>
+void Ptr<T>::swap(Ptr<T>& o)
+{
+    std::swap(owner, o.owner);
+    std::swap(stored, o.stored);
+}
+
+template<typename T>
+T* Ptr<T>::get() const
+{
+    return stored;
+}
+
+template<typename T>
+typename detail::RefOrVoid<T>::type Ptr<T>::operator * () const
+{
+    return *stored;
+}
+
+template<typename T>
+T* Ptr<T>::operator -> () const
+{
+    return stored;
+}
+
+template<typename T>
+Ptr<T>::operator T* () const
+{
+    return stored;
+}
+
+
+template<typename T>
+bool Ptr<T>::empty() const
+{
+    return !stored;
+}
+
+template<typename T>
+template<typename Y>
+Ptr<Y> Ptr<T>::staticCast() const
+{
+    return Ptr<Y>(*this, static_cast<Y*>(stored));
+}
+
+template<typename T>
+template<typename Y>
+Ptr<Y> Ptr<T>::constCast() const
+{
+    return Ptr<Y>(*this, const_cast<Y*>(stored));
+}
+
+template<typename T>
+template<typename Y>
+Ptr<Y> Ptr<T>::dynamicCast() const
+{
+    return Ptr<Y>(*this, dynamic_cast<Y*>(stored));
+}
+
+#ifdef CV_CXX_MOVE_SEMANTICS
+
+template<typename T>
+Ptr<T>::Ptr(Ptr&& o) : owner(o.owner), stored(o.stored)
+{
+    o.owner = NULL;
+    o.stored = NULL;
+}
+
+template<typename T>
+Ptr<T>& Ptr<T>::operator = (Ptr<T>&& o)
+{
+    release();
+    owner = o.owner;
+    stored = o.stored;
+    o.owner = NULL;
+    o.stored = NULL;
+    return *this;
+}
+
+#endif
+
+
+template<typename T>
+void swap(Ptr<T>& ptr1, Ptr<T>& ptr2){
+    ptr1.swap(ptr2);
+}
+
+template<typename T>
+bool operator == (const Ptr<T>& ptr1, const Ptr<T>& ptr2)
+{
+    return ptr1.get() == ptr2.get();
+}
+
+template<typename T>
+bool operator != (const Ptr<T>& ptr1, const Ptr<T>& ptr2)
+{
+    return ptr1.get() != ptr2.get();
+}
+
+template<typename T>
+Ptr<T> makePtr()
+{
+    return Ptr<T>(new T());
+}
+
+template<typename T, typename A1>
+Ptr<T> makePtr(const A1& a1)
+{
+    return Ptr<T>(new T(a1));
+}
+
+template<typename T, typename A1, typename A2>
+Ptr<T> makePtr(const A1& a1, const A2& a2)
+{
+    return Ptr<T>(new T(a1, a2));
+}
+
+template<typename T, typename A1, typename A2, typename A3>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3)
+{
+    return Ptr<T>(new T(a1, a2, a3));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9));
+}
+
+template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
+Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10)
+{
+    return Ptr<T>(new T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10));
+}
+
+} // namespace cv
+
+//! @endcond
+
+#endif // __OPENCV_CORE_PTR_INL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp
new file mode 100644
index 0000000..1442eab
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/saturate.hpp
@@ -0,0 +1,150 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2014, Itseez 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*/
+
+#ifndef __OPENCV_CORE_SATURATE_HPP__
+#define __OPENCV_CORE_SATURATE_HPP__
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/fast_math.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_utils
+//! @{
+
+/////////////// saturate_cast (used in image & signal processing) ///////////////////
+
+/** @brief Template function for accurate conversion from one primitive type to another.
+
+ The functions saturate_cast resemble the standard C++ cast operations, such as static_cast\<T\>()
+ and others. They perform an efficient and accurate conversion from one primitive type to another
+ (see the introduction chapter). saturate in the name means that when the input value v is out of the
+ range of the target type, the result is not formed just by taking low bits of the input, but instead
+ the value is clipped. For example:
+ @code
+ uchar a = saturate_cast<uchar>(-100); // a = 0 (UCHAR_MIN)
+ short b = saturate_cast<short>(33333.33333); // b = 32767 (SHRT_MAX)
+ @endcode
+ Such clipping is done when the target type is unsigned char , signed char , unsigned short or
+ signed short . For 32-bit integers, no clipping is done.
+
+ When the parameter is a floating-point value and the target type is an integer (8-, 16- or 32-bit),
+ the floating-point value is first rounded to the nearest integer and then clipped if needed (when
+ the target type is 8- or 16-bit).
+
+ This operation is used in the simplest or most complex image processing functions in OpenCV.
+
+ @param v Function parameter.
+ @sa add, subtract, multiply, divide, Mat::convertTo
+ */
+template<typename _Tp> static inline _Tp saturate_cast(uchar v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(schar v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(ushort v)   { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(short v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(unsigned v) { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(int v)      { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(float v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(double v)   { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(int64 v)    { return _Tp(v); }
+/** @overload */
+template<typename _Tp> static inline _Tp saturate_cast(uint64 v)   { return _Tp(v); }
+
+template<> inline uchar saturate_cast<uchar>(schar v)        { return (uchar)std::max((int)v, 0); }
+template<> inline uchar saturate_cast<uchar>(ushort v)       { return (uchar)std::min((unsigned)v, (unsigned)UCHAR_MAX); }
+template<> inline uchar saturate_cast<uchar>(int v)          { return (uchar)((unsigned)v <= UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); }
+template<> inline uchar saturate_cast<uchar>(short v)        { return saturate_cast<uchar>((int)v); }
+template<> inline uchar saturate_cast<uchar>(unsigned v)     { return (uchar)std::min(v, (unsigned)UCHAR_MAX); }
+template<> inline uchar saturate_cast<uchar>(float v)        { int iv = cvRound(v); return saturate_cast<uchar>(iv); }
+template<> inline uchar saturate_cast<uchar>(double v)       { int iv = cvRound(v); return saturate_cast<uchar>(iv); }
+template<> inline uchar saturate_cast<uchar>(int64 v)        { return (uchar)((uint64)v <= (uint64)UCHAR_MAX ? v : v > 0 ? UCHAR_MAX : 0); }
+template<> inline uchar saturate_cast<uchar>(uint64 v)       { return (uchar)std::min(v, (uint64)UCHAR_MAX); }
+
+template<> inline schar saturate_cast<schar>(uchar v)        { return (schar)std::min((int)v, SCHAR_MAX); }
+template<> inline schar saturate_cast<schar>(ushort v)       { return (schar)std::min((unsigned)v, (unsigned)SCHAR_MAX); }
+template<> inline schar saturate_cast<schar>(int v)          { return (schar)((unsigned)(v-SCHAR_MIN) <= (unsigned)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); }
+template<> inline schar saturate_cast<schar>(short v)        { return saturate_cast<schar>((int)v); }
+template<> inline schar saturate_cast<schar>(unsigned v)     { return (schar)std::min(v, (unsigned)SCHAR_MAX); }
+template<> inline schar saturate_cast<schar>(float v)        { int iv = cvRound(v); return saturate_cast<schar>(iv); }
+template<> inline schar saturate_cast<schar>(double v)       { int iv = cvRound(v); return saturate_cast<schar>(iv); }
+template<> inline schar saturate_cast<schar>(int64 v)        { return (schar)((uint64)((int64)v-SCHAR_MIN) <= (uint64)UCHAR_MAX ? v : v > 0 ? SCHAR_MAX : SCHAR_MIN); }
+template<> inline schar saturate_cast<schar>(uint64 v)       { return (schar)std::min(v, (uint64)SCHAR_MAX); }
+
+template<> inline ushort saturate_cast<ushort>(schar v)      { return (ushort)std::max((int)v, 0); }
+template<> inline ushort saturate_cast<ushort>(short v)      { return (ushort)std::max((int)v, 0); }
+template<> inline ushort saturate_cast<ushort>(int v)        { return (ushort)((unsigned)v <= (unsigned)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); }
+template<> inline ushort saturate_cast<ushort>(unsigned v)   { return (ushort)std::min(v, (unsigned)USHRT_MAX); }
+template<> inline ushort saturate_cast<ushort>(float v)      { int iv = cvRound(v); return saturate_cast<ushort>(iv); }
+template<> inline ushort saturate_cast<ushort>(double v)     { int iv = cvRound(v); return saturate_cast<ushort>(iv); }
+template<> inline ushort saturate_cast<ushort>(int64 v)      { return (ushort)((uint64)v <= (uint64)USHRT_MAX ? v : v > 0 ? USHRT_MAX : 0); }
+template<> inline ushort saturate_cast<ushort>(uint64 v)     { return (ushort)std::min(v, (uint64)USHRT_MAX); }
+
+template<> inline short saturate_cast<short>(ushort v)       { return (short)std::min((int)v, SHRT_MAX); }
+template<> inline short saturate_cast<short>(int v)          { return (short)((unsigned)(v - SHRT_MIN) <= (unsigned)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); }
+template<> inline short saturate_cast<short>(unsigned v)     { return (short)std::min(v, (unsigned)SHRT_MAX); }
+template<> inline short saturate_cast<short>(float v)        { int iv = cvRound(v); return saturate_cast<short>(iv); }
+template<> inline short saturate_cast<short>(double v)       { int iv = cvRound(v); return saturate_cast<short>(iv); }
+template<> inline short saturate_cast<short>(int64 v)        { return (short)((uint64)((int64)v - SHRT_MIN) <= (uint64)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); }
+template<> inline short saturate_cast<short>(uint64 v)       { return (short)std::min(v, (uint64)SHRT_MAX); }
+
+template<> inline int saturate_cast<int>(float v)            { return cvRound(v); }
+template<> inline int saturate_cast<int>(double v)           { return cvRound(v); }
+
+// we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
+template<> inline unsigned saturate_cast<unsigned>(float v)  { return cvRound(v); }
+template<> inline unsigned saturate_cast<unsigned>(double v) { return cvRound(v); }
+
+//! @}
+
+} // cv
+
+#endif // __OPENCV_CORE_SATURATE_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp
new file mode 100644
index 0000000..c87b029
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/sse_utils.hpp
@@ -0,0 +1,652 @@
+/*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) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_SSE_UTILS_HPP__
+#define __OPENCV_CORE_SSE_UTILS_HPP__
+
+#ifndef __cplusplus
+#  error sse_utils.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core/cvdef.h"
+
+//! @addtogroup core_utils_sse
+//! @{
+
+#if CV_SSE2
+
+inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_g0);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_g0);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_g1);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_g1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk2);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk2);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk3);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk3);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk2);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk2);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk3);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk3);
+
+    __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk2);
+    __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk2);
+    __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk3);
+    __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk3);
+
+    v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk2);
+    v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk2);
+    v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk3);
+    v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk3);
+}
+
+inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0,
+                                  __m128i & v_g1, __m128i & v_b0, __m128i & v_b1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_g1);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_g1);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_b0);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_b0);
+    __m128i layer1_chunk4 = _mm_unpacklo_epi8(v_g0, v_b1);
+    __m128i layer1_chunk5 = _mm_unpackhi_epi8(v_g0, v_b1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk3);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk3);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk4);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk4);
+    __m128i layer2_chunk4 = _mm_unpacklo_epi8(layer1_chunk2, layer1_chunk5);
+    __m128i layer2_chunk5 = _mm_unpackhi_epi8(layer1_chunk2, layer1_chunk5);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk3);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk3);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk4);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk4);
+    __m128i layer3_chunk4 = _mm_unpacklo_epi8(layer2_chunk2, layer2_chunk5);
+    __m128i layer3_chunk5 = _mm_unpackhi_epi8(layer2_chunk2, layer2_chunk5);
+
+    __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk3);
+    __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk3);
+    __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk4);
+    __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk4);
+    __m128i layer4_chunk4 = _mm_unpacklo_epi8(layer3_chunk2, layer3_chunk5);
+    __m128i layer4_chunk5 = _mm_unpackhi_epi8(layer3_chunk2, layer3_chunk5);
+
+    v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk3);
+    v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk3);
+    v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk4);
+    v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk4);
+    v_b0 = _mm_unpacklo_epi8(layer4_chunk2, layer4_chunk5);
+    v_b1 = _mm_unpackhi_epi8(layer4_chunk2, layer4_chunk5);
+}
+
+inline void _mm_deinterleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1,
+                                  __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi8(v_r0, v_b0);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi8(v_r0, v_b0);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi8(v_r1, v_b1);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi8(v_r1, v_b1);
+    __m128i layer1_chunk4 = _mm_unpacklo_epi8(v_g0, v_a0);
+    __m128i layer1_chunk5 = _mm_unpackhi_epi8(v_g0, v_a0);
+    __m128i layer1_chunk6 = _mm_unpacklo_epi8(v_g1, v_a1);
+    __m128i layer1_chunk7 = _mm_unpackhi_epi8(v_g1, v_a1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi8(layer1_chunk0, layer1_chunk4);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi8(layer1_chunk0, layer1_chunk4);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi8(layer1_chunk1, layer1_chunk5);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi8(layer1_chunk1, layer1_chunk5);
+    __m128i layer2_chunk4 = _mm_unpacklo_epi8(layer1_chunk2, layer1_chunk6);
+    __m128i layer2_chunk5 = _mm_unpackhi_epi8(layer1_chunk2, layer1_chunk6);
+    __m128i layer2_chunk6 = _mm_unpacklo_epi8(layer1_chunk3, layer1_chunk7);
+    __m128i layer2_chunk7 = _mm_unpackhi_epi8(layer1_chunk3, layer1_chunk7);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi8(layer2_chunk0, layer2_chunk4);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi8(layer2_chunk0, layer2_chunk4);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi8(layer2_chunk1, layer2_chunk5);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi8(layer2_chunk1, layer2_chunk5);
+    __m128i layer3_chunk4 = _mm_unpacklo_epi8(layer2_chunk2, layer2_chunk6);
+    __m128i layer3_chunk5 = _mm_unpackhi_epi8(layer2_chunk2, layer2_chunk6);
+    __m128i layer3_chunk6 = _mm_unpacklo_epi8(layer2_chunk3, layer2_chunk7);
+    __m128i layer3_chunk7 = _mm_unpackhi_epi8(layer2_chunk3, layer2_chunk7);
+
+    __m128i layer4_chunk0 = _mm_unpacklo_epi8(layer3_chunk0, layer3_chunk4);
+    __m128i layer4_chunk1 = _mm_unpackhi_epi8(layer3_chunk0, layer3_chunk4);
+    __m128i layer4_chunk2 = _mm_unpacklo_epi8(layer3_chunk1, layer3_chunk5);
+    __m128i layer4_chunk3 = _mm_unpackhi_epi8(layer3_chunk1, layer3_chunk5);
+    __m128i layer4_chunk4 = _mm_unpacklo_epi8(layer3_chunk2, layer3_chunk6);
+    __m128i layer4_chunk5 = _mm_unpackhi_epi8(layer3_chunk2, layer3_chunk6);
+    __m128i layer4_chunk6 = _mm_unpacklo_epi8(layer3_chunk3, layer3_chunk7);
+    __m128i layer4_chunk7 = _mm_unpackhi_epi8(layer3_chunk3, layer3_chunk7);
+
+    v_r0 = _mm_unpacklo_epi8(layer4_chunk0, layer4_chunk4);
+    v_r1 = _mm_unpackhi_epi8(layer4_chunk0, layer4_chunk4);
+    v_g0 = _mm_unpacklo_epi8(layer4_chunk1, layer4_chunk5);
+    v_g1 = _mm_unpackhi_epi8(layer4_chunk1, layer4_chunk5);
+    v_b0 = _mm_unpacklo_epi8(layer4_chunk2, layer4_chunk6);
+    v_b1 = _mm_unpackhi_epi8(layer4_chunk2, layer4_chunk6);
+    v_a0 = _mm_unpacklo_epi8(layer4_chunk3, layer4_chunk7);
+    v_a1 = _mm_unpackhi_epi8(layer4_chunk3, layer4_chunk7);
+}
+
+inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
+{
+    __m128i v_mask = _mm_set1_epi16(0x00ff);
+
+    __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer4_chunk2 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8));
+    __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer4_chunk3 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8));
+
+    __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask));
+    __m128i layer3_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8));
+    __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask));
+    __m128i layer3_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8));
+
+    __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8));
+    __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8));
+
+    __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk2 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8));
+    __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8));
+
+    v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_g0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8));
+    v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_g1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8));
+}
+
+inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0,
+                                __m128i & v_g1, __m128i & v_b0, __m128i & v_b1)
+{
+    __m128i v_mask = _mm_set1_epi16(0x00ff);
+
+    __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer4_chunk3 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8));
+    __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer4_chunk4 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8));
+    __m128i layer4_chunk2 = _mm_packus_epi16(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask));
+    __m128i layer4_chunk5 = _mm_packus_epi16(_mm_srli_epi16(v_b0, 8), _mm_srli_epi16(v_b1, 8));
+
+    __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask));
+    __m128i layer3_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8));
+    __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask));
+    __m128i layer3_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8));
+    __m128i layer3_chunk2 = _mm_packus_epi16(_mm_and_si128(layer4_chunk4, v_mask), _mm_and_si128(layer4_chunk5, v_mask));
+    __m128i layer3_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk4, 8), _mm_srli_epi16(layer4_chunk5, 8));
+
+    __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8));
+    __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8));
+    __m128i layer2_chunk2 = _mm_packus_epi16(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask));
+    __m128i layer2_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk4, 8), _mm_srli_epi16(layer3_chunk5, 8));
+
+    __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk3 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8));
+    __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8));
+    __m128i layer1_chunk2 = _mm_packus_epi16(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask));
+    __m128i layer1_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk4, 8), _mm_srli_epi16(layer2_chunk5, 8));
+
+    v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_g1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8));
+    v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_b0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8));
+    v_g0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask));
+    v_b1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk4, 8), _mm_srli_epi16(layer1_chunk5, 8));
+}
+
+inline void _mm_interleave_epi8(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1,
+                                __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1)
+{
+    __m128i v_mask = _mm_set1_epi16(0x00ff);
+
+    __m128i layer4_chunk0 = _mm_packus_epi16(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer4_chunk4 = _mm_packus_epi16(_mm_srli_epi16(v_r0, 8), _mm_srli_epi16(v_r1, 8));
+    __m128i layer4_chunk1 = _mm_packus_epi16(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer4_chunk5 = _mm_packus_epi16(_mm_srli_epi16(v_g0, 8), _mm_srli_epi16(v_g1, 8));
+    __m128i layer4_chunk2 = _mm_packus_epi16(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask));
+    __m128i layer4_chunk6 = _mm_packus_epi16(_mm_srli_epi16(v_b0, 8), _mm_srli_epi16(v_b1, 8));
+    __m128i layer4_chunk3 = _mm_packus_epi16(_mm_and_si128(v_a0, v_mask), _mm_and_si128(v_a1, v_mask));
+    __m128i layer4_chunk7 = _mm_packus_epi16(_mm_srli_epi16(v_a0, 8), _mm_srli_epi16(v_a1, 8));
+
+    __m128i layer3_chunk0 = _mm_packus_epi16(_mm_and_si128(layer4_chunk0, v_mask), _mm_and_si128(layer4_chunk1, v_mask));
+    __m128i layer3_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk0, 8), _mm_srli_epi16(layer4_chunk1, 8));
+    __m128i layer3_chunk1 = _mm_packus_epi16(_mm_and_si128(layer4_chunk2, v_mask), _mm_and_si128(layer4_chunk3, v_mask));
+    __m128i layer3_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk2, 8), _mm_srli_epi16(layer4_chunk3, 8));
+    __m128i layer3_chunk2 = _mm_packus_epi16(_mm_and_si128(layer4_chunk4, v_mask), _mm_and_si128(layer4_chunk5, v_mask));
+    __m128i layer3_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk4, 8), _mm_srli_epi16(layer4_chunk5, 8));
+    __m128i layer3_chunk3 = _mm_packus_epi16(_mm_and_si128(layer4_chunk6, v_mask), _mm_and_si128(layer4_chunk7, v_mask));
+    __m128i layer3_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer4_chunk6, 8), _mm_srli_epi16(layer4_chunk7, 8));
+
+    __m128i layer2_chunk0 = _mm_packus_epi16(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk0, 8), _mm_srli_epi16(layer3_chunk1, 8));
+    __m128i layer2_chunk1 = _mm_packus_epi16(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk2, 8), _mm_srli_epi16(layer3_chunk3, 8));
+    __m128i layer2_chunk2 = _mm_packus_epi16(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask));
+    __m128i layer2_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk4, 8), _mm_srli_epi16(layer3_chunk5, 8));
+    __m128i layer2_chunk3 = _mm_packus_epi16(_mm_and_si128(layer3_chunk6, v_mask), _mm_and_si128(layer3_chunk7, v_mask));
+    __m128i layer2_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer3_chunk6, 8), _mm_srli_epi16(layer3_chunk7, 8));
+
+    __m128i layer1_chunk0 = _mm_packus_epi16(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk4 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk0, 8), _mm_srli_epi16(layer2_chunk1, 8));
+    __m128i layer1_chunk1 = _mm_packus_epi16(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk5 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk2, 8), _mm_srli_epi16(layer2_chunk3, 8));
+    __m128i layer1_chunk2 = _mm_packus_epi16(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask));
+    __m128i layer1_chunk6 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk4, 8), _mm_srli_epi16(layer2_chunk5, 8));
+    __m128i layer1_chunk3 = _mm_packus_epi16(_mm_and_si128(layer2_chunk6, v_mask), _mm_and_si128(layer2_chunk7, v_mask));
+    __m128i layer1_chunk7 = _mm_packus_epi16(_mm_srli_epi16(layer2_chunk6, 8), _mm_srli_epi16(layer2_chunk7, 8));
+
+    v_r0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_b0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk0, 8), _mm_srli_epi16(layer1_chunk1, 8));
+    v_r1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_b1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk2, 8), _mm_srli_epi16(layer1_chunk3, 8));
+    v_g0 = _mm_packus_epi16(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask));
+    v_a0 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk4, 8), _mm_srli_epi16(layer1_chunk5, 8));
+    v_g1 = _mm_packus_epi16(_mm_and_si128(layer1_chunk6, v_mask), _mm_and_si128(layer1_chunk7, v_mask));
+    v_a1 = _mm_packus_epi16(_mm_srli_epi16(layer1_chunk6, 8), _mm_srli_epi16(layer1_chunk7, 8));
+}
+
+inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_g0);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_g0);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_g1);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_g1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk2);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk2);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk3);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk3);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk2);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk2);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk3);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk3);
+
+    v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk2);
+    v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk2);
+    v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk3);
+    v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk3);
+}
+
+inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0,
+                                   __m128i & v_g1, __m128i & v_b0, __m128i & v_b1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_g1);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_g1);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_b0);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_b0);
+    __m128i layer1_chunk4 = _mm_unpacklo_epi16(v_g0, v_b1);
+    __m128i layer1_chunk5 = _mm_unpackhi_epi16(v_g0, v_b1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk3);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk3);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk4);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk4);
+    __m128i layer2_chunk4 = _mm_unpacklo_epi16(layer1_chunk2, layer1_chunk5);
+    __m128i layer2_chunk5 = _mm_unpackhi_epi16(layer1_chunk2, layer1_chunk5);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk3);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk3);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk4);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk4);
+    __m128i layer3_chunk4 = _mm_unpacklo_epi16(layer2_chunk2, layer2_chunk5);
+    __m128i layer3_chunk5 = _mm_unpackhi_epi16(layer2_chunk2, layer2_chunk5);
+
+    v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk3);
+    v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk3);
+    v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk4);
+    v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk4);
+    v_b0 = _mm_unpacklo_epi16(layer3_chunk2, layer3_chunk5);
+    v_b1 = _mm_unpackhi_epi16(layer3_chunk2, layer3_chunk5);
+}
+
+inline void _mm_deinterleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1,
+                                   __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1)
+{
+    __m128i layer1_chunk0 = _mm_unpacklo_epi16(v_r0, v_b0);
+    __m128i layer1_chunk1 = _mm_unpackhi_epi16(v_r0, v_b0);
+    __m128i layer1_chunk2 = _mm_unpacklo_epi16(v_r1, v_b1);
+    __m128i layer1_chunk3 = _mm_unpackhi_epi16(v_r1, v_b1);
+    __m128i layer1_chunk4 = _mm_unpacklo_epi16(v_g0, v_a0);
+    __m128i layer1_chunk5 = _mm_unpackhi_epi16(v_g0, v_a0);
+    __m128i layer1_chunk6 = _mm_unpacklo_epi16(v_g1, v_a1);
+    __m128i layer1_chunk7 = _mm_unpackhi_epi16(v_g1, v_a1);
+
+    __m128i layer2_chunk0 = _mm_unpacklo_epi16(layer1_chunk0, layer1_chunk4);
+    __m128i layer2_chunk1 = _mm_unpackhi_epi16(layer1_chunk0, layer1_chunk4);
+    __m128i layer2_chunk2 = _mm_unpacklo_epi16(layer1_chunk1, layer1_chunk5);
+    __m128i layer2_chunk3 = _mm_unpackhi_epi16(layer1_chunk1, layer1_chunk5);
+    __m128i layer2_chunk4 = _mm_unpacklo_epi16(layer1_chunk2, layer1_chunk6);
+    __m128i layer2_chunk5 = _mm_unpackhi_epi16(layer1_chunk2, layer1_chunk6);
+    __m128i layer2_chunk6 = _mm_unpacklo_epi16(layer1_chunk3, layer1_chunk7);
+    __m128i layer2_chunk7 = _mm_unpackhi_epi16(layer1_chunk3, layer1_chunk7);
+
+    __m128i layer3_chunk0 = _mm_unpacklo_epi16(layer2_chunk0, layer2_chunk4);
+    __m128i layer3_chunk1 = _mm_unpackhi_epi16(layer2_chunk0, layer2_chunk4);
+    __m128i layer3_chunk2 = _mm_unpacklo_epi16(layer2_chunk1, layer2_chunk5);
+    __m128i layer3_chunk3 = _mm_unpackhi_epi16(layer2_chunk1, layer2_chunk5);
+    __m128i layer3_chunk4 = _mm_unpacklo_epi16(layer2_chunk2, layer2_chunk6);
+    __m128i layer3_chunk5 = _mm_unpackhi_epi16(layer2_chunk2, layer2_chunk6);
+    __m128i layer3_chunk6 = _mm_unpacklo_epi16(layer2_chunk3, layer2_chunk7);
+    __m128i layer3_chunk7 = _mm_unpackhi_epi16(layer2_chunk3, layer2_chunk7);
+
+    v_r0 = _mm_unpacklo_epi16(layer3_chunk0, layer3_chunk4);
+    v_r1 = _mm_unpackhi_epi16(layer3_chunk0, layer3_chunk4);
+    v_g0 = _mm_unpacklo_epi16(layer3_chunk1, layer3_chunk5);
+    v_g1 = _mm_unpackhi_epi16(layer3_chunk1, layer3_chunk5);
+    v_b0 = _mm_unpacklo_epi16(layer3_chunk2, layer3_chunk6);
+    v_b1 = _mm_unpackhi_epi16(layer3_chunk2, layer3_chunk6);
+    v_a0 = _mm_unpacklo_epi16(layer3_chunk3, layer3_chunk7);
+    v_a1 = _mm_unpackhi_epi16(layer3_chunk3, layer3_chunk7);
+}
+
+#if CV_SSE4_1
+
+inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1)
+{
+    __m128i v_mask = _mm_set1_epi32(0x0000ffff);
+
+    __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer3_chunk2 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16));
+    __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer3_chunk3 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16));
+
+    __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk2 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16));
+    __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16));
+
+    __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk2 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16));
+    __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16));
+
+    v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_g0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16));
+    v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_g1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16));
+}
+
+inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0,
+                                 __m128i & v_g1, __m128i & v_b0, __m128i & v_b1)
+{
+    __m128i v_mask = _mm_set1_epi32(0x0000ffff);
+
+    __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer3_chunk3 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16));
+    __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer3_chunk4 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16));
+    __m128i layer3_chunk2 = _mm_packus_epi32(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask));
+    __m128i layer3_chunk5 = _mm_packus_epi32(_mm_srli_epi32(v_b0, 16), _mm_srli_epi32(v_b1, 16));
+
+    __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16));
+    __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16));
+    __m128i layer2_chunk2 = _mm_packus_epi32(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask));
+    __m128i layer2_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk4, 16), _mm_srli_epi32(layer3_chunk5, 16));
+
+    __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk3 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16));
+    __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16));
+    __m128i layer1_chunk2 = _mm_packus_epi32(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask));
+    __m128i layer1_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk4, 16), _mm_srli_epi32(layer2_chunk5, 16));
+
+    v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_g1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16));
+    v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_b0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16));
+    v_g0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask));
+    v_b1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk4, 16), _mm_srli_epi32(layer1_chunk5, 16));
+}
+
+inline void _mm_interleave_epi16(__m128i & v_r0, __m128i & v_r1, __m128i & v_g0, __m128i & v_g1,
+                                 __m128i & v_b0, __m128i & v_b1, __m128i & v_a0, __m128i & v_a1)
+{
+    __m128i v_mask = _mm_set1_epi32(0x0000ffff);
+
+    __m128i layer3_chunk0 = _mm_packus_epi32(_mm_and_si128(v_r0, v_mask), _mm_and_si128(v_r1, v_mask));
+    __m128i layer3_chunk4 = _mm_packus_epi32(_mm_srli_epi32(v_r0, 16), _mm_srli_epi32(v_r1, 16));
+    __m128i layer3_chunk1 = _mm_packus_epi32(_mm_and_si128(v_g0, v_mask), _mm_and_si128(v_g1, v_mask));
+    __m128i layer3_chunk5 = _mm_packus_epi32(_mm_srli_epi32(v_g0, 16), _mm_srli_epi32(v_g1, 16));
+    __m128i layer3_chunk2 = _mm_packus_epi32(_mm_and_si128(v_b0, v_mask), _mm_and_si128(v_b1, v_mask));
+    __m128i layer3_chunk6 = _mm_packus_epi32(_mm_srli_epi32(v_b0, 16), _mm_srli_epi32(v_b1, 16));
+    __m128i layer3_chunk3 = _mm_packus_epi32(_mm_and_si128(v_a0, v_mask), _mm_and_si128(v_a1, v_mask));
+    __m128i layer3_chunk7 = _mm_packus_epi32(_mm_srli_epi32(v_a0, 16), _mm_srli_epi32(v_a1, 16));
+
+    __m128i layer2_chunk0 = _mm_packus_epi32(_mm_and_si128(layer3_chunk0, v_mask), _mm_and_si128(layer3_chunk1, v_mask));
+    __m128i layer2_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk0, 16), _mm_srli_epi32(layer3_chunk1, 16));
+    __m128i layer2_chunk1 = _mm_packus_epi32(_mm_and_si128(layer3_chunk2, v_mask), _mm_and_si128(layer3_chunk3, v_mask));
+    __m128i layer2_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk2, 16), _mm_srli_epi32(layer3_chunk3, 16));
+    __m128i layer2_chunk2 = _mm_packus_epi32(_mm_and_si128(layer3_chunk4, v_mask), _mm_and_si128(layer3_chunk5, v_mask));
+    __m128i layer2_chunk6 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk4, 16), _mm_srli_epi32(layer3_chunk5, 16));
+    __m128i layer2_chunk3 = _mm_packus_epi32(_mm_and_si128(layer3_chunk6, v_mask), _mm_and_si128(layer3_chunk7, v_mask));
+    __m128i layer2_chunk7 = _mm_packus_epi32(_mm_srli_epi32(layer3_chunk6, 16), _mm_srli_epi32(layer3_chunk7, 16));
+
+    __m128i layer1_chunk0 = _mm_packus_epi32(_mm_and_si128(layer2_chunk0, v_mask), _mm_and_si128(layer2_chunk1, v_mask));
+    __m128i layer1_chunk4 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk0, 16), _mm_srli_epi32(layer2_chunk1, 16));
+    __m128i layer1_chunk1 = _mm_packus_epi32(_mm_and_si128(layer2_chunk2, v_mask), _mm_and_si128(layer2_chunk3, v_mask));
+    __m128i layer1_chunk5 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk2, 16), _mm_srli_epi32(layer2_chunk3, 16));
+    __m128i layer1_chunk2 = _mm_packus_epi32(_mm_and_si128(layer2_chunk4, v_mask), _mm_and_si128(layer2_chunk5, v_mask));
+    __m128i layer1_chunk6 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk4, 16), _mm_srli_epi32(layer2_chunk5, 16));
+    __m128i layer1_chunk3 = _mm_packus_epi32(_mm_and_si128(layer2_chunk6, v_mask), _mm_and_si128(layer2_chunk7, v_mask));
+    __m128i layer1_chunk7 = _mm_packus_epi32(_mm_srli_epi32(layer2_chunk6, 16), _mm_srli_epi32(layer2_chunk7, 16));
+
+    v_r0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk0, v_mask), _mm_and_si128(layer1_chunk1, v_mask));
+    v_b0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk0, 16), _mm_srli_epi32(layer1_chunk1, 16));
+    v_r1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk2, v_mask), _mm_and_si128(layer1_chunk3, v_mask));
+    v_b1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk2, 16), _mm_srli_epi32(layer1_chunk3, 16));
+    v_g0 = _mm_packus_epi32(_mm_and_si128(layer1_chunk4, v_mask), _mm_and_si128(layer1_chunk5, v_mask));
+    v_a0 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk4, 16), _mm_srli_epi32(layer1_chunk5, 16));
+    v_g1 = _mm_packus_epi32(_mm_and_si128(layer1_chunk6, v_mask), _mm_and_si128(layer1_chunk7, v_mask));
+    v_a1 = _mm_packus_epi32(_mm_srli_epi32(layer1_chunk6, 16), _mm_srli_epi32(layer1_chunk7, 16));
+}
+
+#endif // CV_SSE4_1
+
+inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1)
+{
+    __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_g0);
+    __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_g0);
+    __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_g1);
+    __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_g1);
+
+    __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk2);
+    __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk2);
+    __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk3);
+    __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk3);
+
+    v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk2);
+    v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk2);
+    v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk3);
+    v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk3);
+}
+
+inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0,
+                                __m128 & v_g1, __m128 & v_b0, __m128 & v_b1)
+{
+    __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_g1);
+    __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_g1);
+    __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_b0);
+    __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_b0);
+    __m128 layer1_chunk4 = _mm_unpacklo_ps(v_g0, v_b1);
+    __m128 layer1_chunk5 = _mm_unpackhi_ps(v_g0, v_b1);
+
+    __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk3);
+    __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk3);
+    __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk4);
+    __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk4);
+    __m128 layer2_chunk4 = _mm_unpacklo_ps(layer1_chunk2, layer1_chunk5);
+    __m128 layer2_chunk5 = _mm_unpackhi_ps(layer1_chunk2, layer1_chunk5);
+
+    v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk3);
+    v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk3);
+    v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk4);
+    v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk4);
+    v_b0 = _mm_unpacklo_ps(layer2_chunk2, layer2_chunk5);
+    v_b1 = _mm_unpackhi_ps(layer2_chunk2, layer2_chunk5);
+}
+
+inline void _mm_deinterleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1,
+                                __m128 & v_b0, __m128 & v_b1, __m128 & v_a0, __m128 & v_a1)
+{
+    __m128 layer1_chunk0 = _mm_unpacklo_ps(v_r0, v_b0);
+    __m128 layer1_chunk1 = _mm_unpackhi_ps(v_r0, v_b0);
+    __m128 layer1_chunk2 = _mm_unpacklo_ps(v_r1, v_b1);
+    __m128 layer1_chunk3 = _mm_unpackhi_ps(v_r1, v_b1);
+    __m128 layer1_chunk4 = _mm_unpacklo_ps(v_g0, v_a0);
+    __m128 layer1_chunk5 = _mm_unpackhi_ps(v_g0, v_a0);
+    __m128 layer1_chunk6 = _mm_unpacklo_ps(v_g1, v_a1);
+    __m128 layer1_chunk7 = _mm_unpackhi_ps(v_g1, v_a1);
+
+    __m128 layer2_chunk0 = _mm_unpacklo_ps(layer1_chunk0, layer1_chunk4);
+    __m128 layer2_chunk1 = _mm_unpackhi_ps(layer1_chunk0, layer1_chunk4);
+    __m128 layer2_chunk2 = _mm_unpacklo_ps(layer1_chunk1, layer1_chunk5);
+    __m128 layer2_chunk3 = _mm_unpackhi_ps(layer1_chunk1, layer1_chunk5);
+    __m128 layer2_chunk4 = _mm_unpacklo_ps(layer1_chunk2, layer1_chunk6);
+    __m128 layer2_chunk5 = _mm_unpackhi_ps(layer1_chunk2, layer1_chunk6);
+    __m128 layer2_chunk6 = _mm_unpacklo_ps(layer1_chunk3, layer1_chunk7);
+    __m128 layer2_chunk7 = _mm_unpackhi_ps(layer1_chunk3, layer1_chunk7);
+
+    v_r0 = _mm_unpacklo_ps(layer2_chunk0, layer2_chunk4);
+    v_r1 = _mm_unpackhi_ps(layer2_chunk0, layer2_chunk4);
+    v_g0 = _mm_unpacklo_ps(layer2_chunk1, layer2_chunk5);
+    v_g1 = _mm_unpackhi_ps(layer2_chunk1, layer2_chunk5);
+    v_b0 = _mm_unpacklo_ps(layer2_chunk2, layer2_chunk6);
+    v_b1 = _mm_unpackhi_ps(layer2_chunk2, layer2_chunk6);
+    v_a0 = _mm_unpacklo_ps(layer2_chunk3, layer2_chunk7);
+    v_a1 = _mm_unpackhi_ps(layer2_chunk3, layer2_chunk7);
+}
+
+inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1)
+{
+    const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
+
+    __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
+    __m128 layer2_chunk2 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
+    __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo);
+    __m128 layer2_chunk3 = _mm_shuffle_ps(v_g0, v_g1, mask_hi);
+
+    __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo);
+    __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi);
+    __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo);
+    __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi);
+
+    v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo);
+    v_g0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi);
+    v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo);
+    v_g1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi);
+}
+
+inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0,
+                              __m128 & v_g1, __m128 & v_b0, __m128 & v_b1)
+{
+    const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
+
+    __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
+    __m128 layer2_chunk3 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
+    __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo);
+    __m128 layer2_chunk4 = _mm_shuffle_ps(v_g0, v_g1, mask_hi);
+    __m128 layer2_chunk2 = _mm_shuffle_ps(v_b0, v_b1, mask_lo);
+    __m128 layer2_chunk5 = _mm_shuffle_ps(v_b0, v_b1, mask_hi);
+
+    __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo);
+    __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi);
+    __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo);
+    __m128 layer1_chunk4 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi);
+    __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_lo);
+    __m128 layer1_chunk5 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_hi);
+
+    v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo);
+    v_g1 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi);
+    v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo);
+    v_b0 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi);
+    v_g0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_lo);
+    v_b1 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_hi);
+}
+
+inline void _mm_interleave_ps(__m128 & v_r0, __m128 & v_r1, __m128 & v_g0, __m128 & v_g1,
+                              __m128 & v_b0, __m128 & v_b1, __m128 & v_a0, __m128 & v_a1)
+{
+    const int mask_lo = _MM_SHUFFLE(2, 0, 2, 0), mask_hi = _MM_SHUFFLE(3, 1, 3, 1);
+
+    __m128 layer2_chunk0 = _mm_shuffle_ps(v_r0, v_r1, mask_lo);
+    __m128 layer2_chunk4 = _mm_shuffle_ps(v_r0, v_r1, mask_hi);
+    __m128 layer2_chunk1 = _mm_shuffle_ps(v_g0, v_g1, mask_lo);
+    __m128 layer2_chunk5 = _mm_shuffle_ps(v_g0, v_g1, mask_hi);
+    __m128 layer2_chunk2 = _mm_shuffle_ps(v_b0, v_b1, mask_lo);
+    __m128 layer2_chunk6 = _mm_shuffle_ps(v_b0, v_b1, mask_hi);
+    __m128 layer2_chunk3 = _mm_shuffle_ps(v_a0, v_a1, mask_lo);
+    __m128 layer2_chunk7 = _mm_shuffle_ps(v_a0, v_a1, mask_hi);
+
+    __m128 layer1_chunk0 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_lo);
+    __m128 layer1_chunk4 = _mm_shuffle_ps(layer2_chunk0, layer2_chunk1, mask_hi);
+    __m128 layer1_chunk1 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_lo);
+    __m128 layer1_chunk5 = _mm_shuffle_ps(layer2_chunk2, layer2_chunk3, mask_hi);
+    __m128 layer1_chunk2 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_lo);
+    __m128 layer1_chunk6 = _mm_shuffle_ps(layer2_chunk4, layer2_chunk5, mask_hi);
+    __m128 layer1_chunk3 = _mm_shuffle_ps(layer2_chunk6, layer2_chunk7, mask_lo);
+    __m128 layer1_chunk7 = _mm_shuffle_ps(layer2_chunk6, layer2_chunk7, mask_hi);
+
+    v_r0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_lo);
+    v_b0 = _mm_shuffle_ps(layer1_chunk0, layer1_chunk1, mask_hi);
+    v_r1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_lo);
+    v_b1 = _mm_shuffle_ps(layer1_chunk2, layer1_chunk3, mask_hi);
+    v_g0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_lo);
+    v_a0 = _mm_shuffle_ps(layer1_chunk4, layer1_chunk5, mask_hi);
+    v_g1 = _mm_shuffle_ps(layer1_chunk6, layer1_chunk7, mask_lo);
+    v_a1 = _mm_shuffle_ps(layer1_chunk6, layer1_chunk7, mask_hi);
+}
+
+#endif // CV_SSE2
+
+//! @}
+
+#endif //__OPENCV_CORE_SSE_UTILS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp
new file mode 100644
index 0000000..49bc844
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/traits.hpp
@@ -0,0 +1,326 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_TRAITS_HPP__
+#define __OPENCV_CORE_TRAITS_HPP__
+
+#include "opencv2/core/cvdef.h"
+
+namespace cv
+{
+
+//! @addtogroup core_basic
+//! @{
+
+/** @brief Template "trait" class for OpenCV primitive data types.
+
+A primitive OpenCV data type is one of unsigned char, bool, signed char, unsigned short, signed
+short, int, float, double, or a tuple of values of one of these types, where all the values in the
+tuple have the same type. Any primitive type from the list can be defined by an identifier in the
+form CV_\<bit-depth\>{U|S|F}C(\<number_of_channels\>), for example: uchar \~ CV_8UC1, 3-element
+floating-point tuple \~ CV_32FC3, and so on. A universal OpenCV structure that is able to store a
+single instance of such a primitive data type is Vec. Multiple instances of such a type can be
+stored in a std::vector, Mat, Mat_, SparseMat, SparseMat_, or any other container that is able to
+store Vec instances.
+
+The DataType class is basically used to provide a description of such primitive data types without
+adding any fields or methods to the corresponding classes (and it is actually impossible to add
+anything to primitive C/C++ data types). This technique is known in C++ as class traits. It is not
+DataType itself that is used but its specialized versions, such as:
+@code
+    template<> class DataType<uchar>
+    {
+        typedef uchar value_type;
+        typedef int work_type;
+        typedef uchar channel_type;
+        enum { channel_type = CV_8U, channels = 1, fmt='u', type = CV_8U };
+    };
+    ...
+    template<typename _Tp> DataType<std::complex<_Tp> >
+    {
+        typedef std::complex<_Tp> value_type;
+        typedef std::complex<_Tp> work_type;
+        typedef _Tp channel_type;
+        // DataDepth is another helper trait class
+        enum { depth = DataDepth<_Tp>::value, channels=2,
+            fmt=(channels-1)*256+DataDepth<_Tp>::fmt,
+            type=CV_MAKETYPE(depth, channels) };
+    };
+    ...
+@endcode
+The main purpose of this class is to convert compilation-time type information to an
+OpenCV-compatible data type identifier, for example:
+@code
+    // allocates a 30x40 floating-point matrix
+    Mat A(30, 40, DataType<float>::type);
+
+    Mat B = Mat_<std::complex<double> >(3, 3);
+    // the statement below will print 6, 2 , that is depth == CV_64F, channels == 2
+    cout << B.depth() << ", " << B.channels() << endl;
+@endcode
+So, such traits are used to tell OpenCV which data type you are working with, even if such a type is
+not native to OpenCV. For example, the matrix B initialization above is compiled because OpenCV
+defines the proper specialized template class DataType\<complex\<_Tp\> \> . This mechanism is also
+useful (and used in OpenCV this way) for generic algorithms implementations.
+*/
+template<typename _Tp> class DataType
+{
+public:
+    typedef _Tp         value_type;
+    typedef value_type  work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 1,
+           depth        = -1,
+           channels     = 1,
+           fmt          = 0,
+           type = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<bool>
+{
+public:
+    typedef bool        value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_8U,
+           channels     = 1,
+           fmt          = (int)'u',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<uchar>
+{
+public:
+    typedef uchar       value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_8U,
+           channels     = 1,
+           fmt          = (int)'u',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<schar>
+{
+public:
+    typedef schar       value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_8S,
+           channels     = 1,
+           fmt          = (int)'c',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<char>
+{
+public:
+    typedef schar       value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_8S,
+           channels     = 1,
+           fmt          = (int)'c',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<ushort>
+{
+public:
+    typedef ushort      value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_16U,
+           channels     = 1,
+           fmt          = (int)'w',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<short>
+{
+public:
+    typedef short       value_type;
+    typedef int         work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_16S,
+           channels     = 1,
+           fmt          = (int)'s',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<int>
+{
+public:
+    typedef int         value_type;
+    typedef value_type  work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_32S,
+           channels     = 1,
+           fmt          = (int)'i',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<float>
+{
+public:
+    typedef float       value_type;
+    typedef value_type  work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_32F,
+           channels     = 1,
+           fmt          = (int)'f',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+template<> class DataType<double>
+{
+public:
+    typedef double      value_type;
+    typedef value_type  work_type;
+    typedef value_type  channel_type;
+    typedef value_type  vec_type;
+    enum { generic_type = 0,
+           depth        = CV_64F,
+           channels     = 1,
+           fmt          = (int)'d',
+           type         = CV_MAKETYPE(depth, channels)
+         };
+};
+
+
+/** @brief A helper class for cv::DataType
+
+The class is specialized for each fundamental numerical data type supported by OpenCV. It provides
+DataDepth<T>::value constant.
+*/
+template<typename _Tp> class DataDepth
+{
+public:
+    enum
+    {
+        value = DataType<_Tp>::depth,
+        fmt   = DataType<_Tp>::fmt
+    };
+};
+
+
+
+template<int _depth> class TypeDepth
+{
+    enum { depth = CV_USRTYPE1 };
+    typedef void value_type;
+};
+
+template<> class TypeDepth<CV_8U>
+{
+    enum { depth = CV_8U };
+    typedef uchar value_type;
+};
+
+template<> class TypeDepth<CV_8S>
+{
+    enum { depth = CV_8S };
+    typedef schar value_type;
+};
+
+template<> class TypeDepth<CV_16U>
+{
+    enum { depth = CV_16U };
+    typedef ushort value_type;
+};
+
+template<> class TypeDepth<CV_16S>
+{
+    enum { depth = CV_16S };
+    typedef short value_type;
+};
+
+template<> class TypeDepth<CV_32S>
+{
+    enum { depth = CV_32S };
+    typedef int value_type;
+};
+
+template<> class TypeDepth<CV_32F>
+{
+    enum { depth = CV_32F };
+    typedef float value_type;
+};
+
+template<> class TypeDepth<CV_64F>
+{
+    enum { depth = CV_64F };
+    typedef double value_type;
+};
+
+//! @}
+
+} // cv
+
+#endif // __OPENCV_CORE_TRAITS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/types.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/types.hpp
new file mode 100644
index 0000000..e166556
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/types.hpp
@@ -0,0 +1,2228 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_TYPES_HPP__
+#define __OPENCV_CORE_TYPES_HPP__
+
+#ifndef __cplusplus
+#  error types.hpp header must be compiled as C++
+#endif
+
+#include <climits>
+#include <cfloat>
+#include <vector>
+
+#include "opencv2/core/cvdef.h"
+#include "opencv2/core/cvstd.hpp"
+#include "opencv2/core/matx.hpp"
+
+namespace cv
+{
+
+//! @addtogroup core_basic
+//! @{
+
+//////////////////////////////// Complex //////////////////////////////
+
+/** @brief  A complex number class.
+
+  The template class is similar and compatible with std::complex, however it provides slightly
+  more convenient access to the real and imaginary parts using through the simple field access, as opposite
+  to std::complex::real() and std::complex::imag().
+*/
+template<typename _Tp> class Complex
+{
+public:
+
+    //! constructors
+    Complex();
+    Complex( _Tp _re, _Tp _im = 0 );
+
+    //! conversion to another data type
+    template<typename T2> operator Complex<T2>() const;
+    //! conjugation
+    Complex conj() const;
+
+    _Tp re, im; //< the real and the imaginary parts
+};
+
+typedef Complex<float> Complexf;
+typedef Complex<double> Complexd;
+
+template<typename _Tp> class DataType< Complex<_Tp> >
+{
+public:
+    typedef Complex<_Tp> value_type;
+    typedef value_type   work_type;
+    typedef _Tp          channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels) };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Point_ ////////////////////////////////
+
+/** @brief Template class for 2D points specified by its coordinates `x` and `y`.
+
+An instance of the class is interchangeable with C structures, CvPoint and CvPoint2D32f . There is
+also a cast operator to convert point coordinates to the specified type. The conversion from
+floating-point coordinates to integer coordinates is done by rounding. Commonly, the conversion
+uses this operation for each of the coordinates. Besides the class members listed in the
+declaration above, the following operations on points are implemented:
+@code
+    pt1 = pt2 + pt3;
+    pt1 = pt2 - pt3;
+    pt1 = pt2 * a;
+    pt1 = a * pt2;
+    pt1 = pt2 / a;
+    pt1 += pt2;
+    pt1 -= pt2;
+    pt1 *= a;
+    pt1 /= a;
+    double value = norm(pt); // L2 norm
+    pt1 == pt2;
+    pt1 != pt2;
+@endcode
+For your convenience, the following type aliases are defined:
+@code
+    typedef Point_<int> Point2i;
+    typedef Point2i Point;
+    typedef Point_<float> Point2f;
+    typedef Point_<double> Point2d;
+@endcode
+Example:
+@code
+    Point2f a(0.3f, 0.f), b(0.f, 0.4f);
+    Point pt = (a + b)*10.f;
+    cout << pt.x << ", " << pt.y << endl;
+@endcode
+*/
+template<typename _Tp> class Point_
+{
+public:
+    typedef _Tp value_type;
+
+    // various constructors
+    Point_();
+    Point_(_Tp _x, _Tp _y);
+    Point_(const Point_& pt);
+    Point_(const Size_<_Tp>& sz);
+    Point_(const Vec<_Tp, 2>& v);
+
+    Point_& operator = (const Point_& pt);
+    //! conversion to another data type
+    template<typename _Tp2> operator Point_<_Tp2>() const;
+
+    //! conversion to the old-style C structures
+    operator Vec<_Tp, 2>() const;
+
+    //! dot product
+    _Tp dot(const Point_& pt) const;
+    //! dot product computed in double-precision arithmetics
+    double ddot(const Point_& pt) const;
+    //! cross-product
+    double cross(const Point_& pt) const;
+    //! checks whether the point is inside the specified rectangle
+    bool inside(const Rect_<_Tp>& r) const;
+
+    _Tp x, y; //< the point coordinates
+};
+
+typedef Point_<int> Point2i;
+typedef Point_<float> Point2f;
+typedef Point_<double> Point2d;
+typedef Point2i Point;
+
+template<typename _Tp> class DataType< Point_<_Tp> >
+{
+public:
+    typedef Point_<_Tp>                               value_type;
+    typedef Point_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                       channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Point3_ ////////////////////////////////
+
+/** @brief Template class for 3D points specified by its coordinates `x`, `y` and `z`.
+
+An instance of the class is interchangeable with the C structure CvPoint2D32f . Similarly to
+Point_ , the coordinates of 3D points can be converted to another type. The vector arithmetic and
+comparison operations are also supported.
+
+The following Point3_\<\> aliases are available:
+@code
+    typedef Point3_<int> Point3i;
+    typedef Point3_<float> Point3f;
+    typedef Point3_<double> Point3d;
+@endcode
+@see cv::Point3i, cv::Point3f and cv::Point3d
+*/
+template<typename _Tp> class Point3_
+{
+public:
+    typedef _Tp value_type;
+
+    // various constructors
+    Point3_();
+    Point3_(_Tp _x, _Tp _y, _Tp _z);
+    Point3_(const Point3_& pt);
+    explicit Point3_(const Point_<_Tp>& pt);
+    Point3_(const Vec<_Tp, 3>& v);
+
+    Point3_& operator = (const Point3_& pt);
+    //! conversion to another data type
+    template<typename _Tp2> operator Point3_<_Tp2>() const;
+    //! conversion to cv::Vec<>
+    operator Vec<_Tp, 3>() const;
+
+    //! dot product
+    _Tp dot(const Point3_& pt) const;
+    //! dot product computed in double-precision arithmetics
+    double ddot(const Point3_& pt) const;
+    //! cross product of the 2 3D points
+    Point3_ cross(const Point3_& pt) const;
+
+    _Tp x, y, z; //< the point coordinates
+};
+
+typedef Point3_<int> Point3i;
+typedef Point3_<float> Point3f;
+typedef Point3_<double> Point3d;
+
+template<typename _Tp> class DataType< Point3_<_Tp> >
+{
+public:
+    typedef Point3_<_Tp>                               value_type;
+    typedef Point3_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                        channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 3,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Size_ ////////////////////////////////
+
+/** @brief Template class for specifying the size of an image or rectangle.
+
+The class includes two members called width and height. The structure can be converted to and from
+the old OpenCV structures CvSize and CvSize2D32f . The same set of arithmetic and comparison
+operations as for Point_ is available.
+
+OpenCV defines the following Size_\<\> aliases:
+@code
+    typedef Size_<int> Size2i;
+    typedef Size2i Size;
+    typedef Size_<float> Size2f;
+@endcode
+*/
+template<typename _Tp> class Size_
+{
+public:
+    typedef _Tp value_type;
+
+    //! various constructors
+    Size_();
+    Size_(_Tp _width, _Tp _height);
+    Size_(const Size_& sz);
+    Size_(const Point_<_Tp>& pt);
+
+    Size_& operator = (const Size_& sz);
+    //! the area (width*height)
+    _Tp area() const;
+
+    //! conversion of another data type.
+    template<typename _Tp2> operator Size_<_Tp2>() const;
+
+    _Tp width, height; // the width and the height
+};
+
+typedef Size_<int> Size2i;
+typedef Size_<float> Size2f;
+typedef Size_<double> Size2d;
+typedef Size2i Size;
+
+template<typename _Tp> class DataType< Size_<_Tp> >
+{
+public:
+    typedef Size_<_Tp>                               value_type;
+    typedef Size_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                      channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Rect_ ////////////////////////////////
+
+/** @brief Template class for 2D rectangles
+
+described by the following parameters:
+-   Coordinates of the top-left corner. This is a default interpretation of Rect_::x and Rect_::y
+    in OpenCV. Though, in your algorithms you may count x and y from the bottom-left corner.
+-   Rectangle width and height.
+
+OpenCV typically assumes that the top and left boundary of the rectangle are inclusive, while the
+right and bottom boundaries are not. For example, the method Rect_::contains returns true if
+
+\f[x  \leq pt.x < x+width,
+      y  \leq pt.y < y+height\f]
+
+Virtually every loop over an image ROI in OpenCV (where ROI is specified by Rect_\<int\> ) is
+implemented as:
+@code
+    for(int y = roi.y; y < roi.y + roi.height; y++)
+        for(int x = roi.x; x < roi.x + roi.width; x++)
+        {
+            // ...
+        }
+@endcode
+In addition to the class members, the following operations on rectangles are implemented:
+-   \f$\texttt{rect} = \texttt{rect} \pm \texttt{point}\f$ (shifting a rectangle by a certain offset)
+-   \f$\texttt{rect} = \texttt{rect} \pm \texttt{size}\f$ (expanding or shrinking a rectangle by a
+    certain amount)
+-   rect += point, rect -= point, rect += size, rect -= size (augmenting operations)
+-   rect = rect1 & rect2 (rectangle intersection)
+-   rect = rect1 | rect2 (minimum area rectangle containing rect1 and rect2 )
+-   rect &= rect1, rect |= rect1 (and the corresponding augmenting operations)
+-   rect == rect1, rect != rect1 (rectangle comparison)
+
+This is an example how the partial ordering on rectangles can be established (rect1 \f$\subseteq\f$
+rect2):
+@code
+    template<typename _Tp> inline bool
+    operator <= (const Rect_<_Tp>& r1, const Rect_<_Tp>& r2)
+    {
+        return (r1 & r2) == r1;
+    }
+@endcode
+For your convenience, the Rect_\<\> alias is available: cv::Rect
+*/
+template<typename _Tp> class Rect_
+{
+public:
+    typedef _Tp value_type;
+
+    //! various constructors
+    Rect_();
+    Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height);
+    Rect_(const Rect_& r);
+    Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz);
+    Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2);
+
+    Rect_& operator = ( const Rect_& r );
+    //! the top-left corner
+    Point_<_Tp> tl() const;
+    //! the bottom-right corner
+    Point_<_Tp> br() const;
+
+    //! size (width, height) of the rectangle
+    Size_<_Tp> size() const;
+    //! area (width*height) of the rectangle
+    _Tp area() const;
+
+    //! conversion to another data type
+    template<typename _Tp2> operator Rect_<_Tp2>() const;
+
+    //! checks whether the rectangle contains the point
+    bool contains(const Point_<_Tp>& pt) const;
+
+    _Tp x, y, width, height; //< the top-left corner, as well as width and height of the rectangle
+};
+
+typedef Rect_<int> Rect2i;
+typedef Rect_<float> Rect2f;
+typedef Rect_<double> Rect2d;
+typedef Rect2i Rect;
+
+template<typename _Tp> class DataType< Rect_<_Tp> >
+{
+public:
+    typedef Rect_<_Tp>                               value_type;
+    typedef Rect_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                      channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 4,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+///////////////////////////// RotatedRect /////////////////////////////
+
+/** @brief The class represents rotated (i.e. not up-right) rectangles on a plane.
+
+Each rectangle is specified by the center point (mass center), length of each side (represented by
+cv::Size2f structure) and the rotation angle in degrees.
+
+The sample below demonstrates how to use RotatedRect:
+@code
+    Mat image(200, 200, CV_8UC3, Scalar(0));
+    RotatedRect rRect = RotatedRect(Point2f(100,100), Size2f(100,50), 30);
+
+    Point2f vertices[4];
+    rRect.points(vertices);
+    for (int i = 0; i < 4; i++)
+        line(image, vertices[i], vertices[(i+1)%4], Scalar(0,255,0));
+
+    Rect brect = rRect.boundingRect();
+    rectangle(image, brect, Scalar(255,0,0));
+
+    imshow("rectangles", image);
+    waitKey(0);
+@endcode
+![image](pics/rotatedrect.png)
+
+@sa CamShift, fitEllipse, minAreaRect, CvBox2D
+*/
+class CV_EXPORTS RotatedRect
+{
+public:
+    //! various constructors
+    RotatedRect();
+    /**
+    @param center The rectangle mass center.
+    @param size Width and height of the rectangle.
+    @param angle The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc.,
+    the rectangle becomes an up-right rectangle.
+    */
+    RotatedRect(const Point2f& center, const Size2f& size, float angle);
+    /**
+    Any 3 end points of the RotatedRect. They must be given in order (either clockwise or
+    anticlockwise).
+     */
+    RotatedRect(const Point2f& point1, const Point2f& point2, const Point2f& point3);
+
+    /** returns 4 vertices of the rectangle
+    @param pts The points array for storing rectangle vertices.
+    */
+    void points(Point2f pts[]) const;
+    //! returns the minimal up-right rectangle containing the rotated rectangle
+    Rect boundingRect() const;
+
+    Point2f center; //< the rectangle mass center
+    Size2f size;    //< width and height of the rectangle
+    float angle;    //< the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
+};
+
+template<> class DataType< RotatedRect >
+{
+public:
+    typedef RotatedRect  value_type;
+    typedef value_type   work_type;
+    typedef float        channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = (int)sizeof(value_type)/sizeof(channel_type), // 5
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Range /////////////////////////////////
+
+/** @brief Template class specifying a continuous subsequence (slice) of a sequence.
+
+The class is used to specify a row or a column span in a matrix ( Mat ) and for many other purposes.
+Range(a,b) is basically the same as a:b in Matlab or a..b in Python. As in Python, start is an
+inclusive left boundary of the range and end is an exclusive right boundary of the range. Such a
+half-opened interval is usually denoted as \f$[start,end)\f$ .
+
+The static method Range::all() returns a special variable that means "the whole sequence" or "the
+whole range", just like " : " in Matlab or " ... " in Python. All the methods and functions in
+OpenCV that take Range support this special Range::all() value. But, of course, in case of your own
+custom processing, you will probably have to check and handle it explicitly:
+@code
+    void my_function(..., const Range& r, ....)
+    {
+        if(r == Range::all()) {
+            // process all the data
+        }
+        else {
+            // process [r.start, r.end)
+        }
+    }
+@endcode
+*/
+class CV_EXPORTS Range
+{
+public:
+    Range();
+    Range(int _start, int _end);
+    int size() const;
+    bool empty() const;
+    static Range all();
+
+    int start, end;
+};
+
+template<> class DataType<Range>
+{
+public:
+    typedef Range      value_type;
+    typedef value_type work_type;
+    typedef int        channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 2,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// Scalar_ ///////////////////////////////
+
+/** @brief Template class for a 4-element vector derived from Vec.
+
+Being derived from Vec\<_Tp, 4\> , Scalar_ and Scalar can be used just as typical 4-element
+vectors. In addition, they can be converted to/from CvScalar . The type Scalar is widely used in
+OpenCV to pass pixel values.
+*/
+template<typename _Tp> class Scalar_ : public Vec<_Tp, 4>
+{
+public:
+    //! various constructors
+    Scalar_();
+    Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
+    Scalar_(_Tp v0);
+
+    template<typename _Tp2, int cn>
+    Scalar_(const Vec<_Tp2, cn>& v);
+
+    //! returns a scalar with all elements set to v0
+    static Scalar_<_Tp> all(_Tp v0);
+
+    //! conversion to another data type
+    template<typename T2> operator Scalar_<T2>() const;
+
+    //! per-element product
+    Scalar_<_Tp> mul(const Scalar_<_Tp>& a, double scale=1 ) const;
+
+    // returns (v0, -v1, -v2, -v3)
+    Scalar_<_Tp> conj() const;
+
+    // returns true iff v1 == v2 == v3 == 0
+    bool isReal() const;
+};
+
+typedef Scalar_<double> Scalar;
+
+template<typename _Tp> class DataType< Scalar_<_Tp> >
+{
+public:
+    typedef Scalar_<_Tp>                               value_type;
+    typedef Scalar_<typename DataType<_Tp>::work_type> work_type;
+    typedef _Tp                                        channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = 4,
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+/////////////////////////////// KeyPoint ////////////////////////////////
+
+/** @brief Data structure for salient point detectors.
+
+The class instance stores a keypoint, i.e. a point feature found by one of many available keypoint
+detectors, such as Harris corner detector, cv::FAST, cv::StarDetector, cv::SURF, cv::SIFT,
+cv::LDetector etc.
+
+The keypoint is characterized by the 2D position, scale (proportional to the diameter of the
+neighborhood that needs to be taken into account), orientation and some other parameters. The
+keypoint neighborhood is then analyzed by another algorithm that builds a descriptor (usually
+represented as a feature vector). The keypoints representing the same object in different images
+can then be matched using cv::KDTree or another method.
+*/
+class CV_EXPORTS_W_SIMPLE KeyPoint
+{
+public:
+    //! the default constructor
+    CV_WRAP KeyPoint();
+    /**
+    @param _pt x & y coordinates of the keypoint
+    @param _size keypoint diameter
+    @param _angle keypoint orientation
+    @param _response keypoint detector response on the keypoint (that is, strength of the keypoint)
+    @param _octave pyramid octave in which the keypoint has been detected
+    @param _class_id object id
+     */
+    KeyPoint(Point2f _pt, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1);
+    /**
+    @param x x-coordinate of the keypoint
+    @param y y-coordinate of the keypoint
+    @param _size keypoint diameter
+    @param _angle keypoint orientation
+    @param _response keypoint detector response on the keypoint (that is, strength of the keypoint)
+    @param _octave pyramid octave in which the keypoint has been detected
+    @param _class_id object id
+     */
+    CV_WRAP KeyPoint(float x, float y, float _size, float _angle=-1, float _response=0, int _octave=0, int _class_id=-1);
+
+    size_t hash() const;
+
+    /**
+    This method converts vector of keypoints to vector of points or the reverse, where each keypoint is
+    assigned the same size and the same orientation.
+
+    @param keypoints Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
+    @param points2f Array of (x,y) coordinates of each keypoint
+    @param keypointIndexes Array of indexes of keypoints to be converted to points. (Acts like a mask to
+    convert only specified keypoints)
+    */
+    CV_WRAP static void convert(const std::vector<KeyPoint>& keypoints,
+                                CV_OUT std::vector<Point2f>& points2f,
+                                const std::vector<int>& keypointIndexes=std::vector<int>());
+    /** @overload
+    @param points2f Array of (x,y) coordinates of each keypoint
+    @param keypoints Keypoints obtained from any feature detection algorithm like SIFT/SURF/ORB
+    @param size keypoint diameter
+    @param response keypoint detector response on the keypoint (that is, strength of the keypoint)
+    @param octave pyramid octave in which the keypoint has been detected
+    @param class_id object id
+    */
+    CV_WRAP static void convert(const std::vector<Point2f>& points2f,
+                                CV_OUT std::vector<KeyPoint>& keypoints,
+                                float size=1, float response=1, int octave=0, int class_id=-1);
+
+    /**
+    This method computes overlap for pair of keypoints. Overlap is the ratio between area of keypoint
+    regions' intersection and area of keypoint regions' union (considering keypoint region as circle).
+    If they don't overlap, we get zero. If they coincide at same location with same size, we get 1.
+    @param kp1 First keypoint
+    @param kp2 Second keypoint
+    */
+    CV_WRAP static float overlap(const KeyPoint& kp1, const KeyPoint& kp2);
+
+    CV_PROP_RW Point2f pt; //!< coordinates of the keypoints
+    CV_PROP_RW float size; //!< diameter of the meaningful keypoint neighborhood
+    CV_PROP_RW float angle; //!< computed orientation of the keypoint (-1 if not applicable);
+                            //!< it's in [0,360) degrees and measured relative to
+                            //!< image coordinate system, ie in clockwise.
+    CV_PROP_RW float response; //!< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
+    CV_PROP_RW int octave; //!< octave (pyramid layer) from which the keypoint has been extracted
+    CV_PROP_RW int class_id; //!< object class (if the keypoints need to be clustered by an object they belong to)
+};
+
+template<> class DataType<KeyPoint>
+{
+public:
+    typedef KeyPoint      value_type;
+    typedef float         work_type;
+    typedef float         channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = (int)(sizeof(value_type)/sizeof(channel_type)), // 7
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+//////////////////////////////// DMatch /////////////////////////////////
+
+/** @brief Class for matching keypoint descriptors
+
+query descriptor index, train descriptor index, train image index, and distance between
+descriptors.
+*/
+class CV_EXPORTS_W_SIMPLE DMatch
+{
+public:
+    CV_WRAP DMatch();
+    CV_WRAP DMatch(int _queryIdx, int _trainIdx, float _distance);
+    CV_WRAP DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance);
+
+    CV_PROP_RW int queryIdx; // query descriptor index
+    CV_PROP_RW int trainIdx; // train descriptor index
+    CV_PROP_RW int imgIdx;   // train image index
+
+    CV_PROP_RW float distance;
+
+    // less is better
+    bool operator<(const DMatch &m) const;
+};
+
+template<> class DataType<DMatch>
+{
+public:
+    typedef DMatch      value_type;
+    typedef int         work_type;
+    typedef int         channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = (int)(sizeof(value_type)/sizeof(channel_type)), // 4
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+
+
+///////////////////////////// TermCriteria //////////////////////////////
+
+/** @brief The class defining termination criteria for iterative algorithms.
+
+You can initialize it by default constructor and then override any parameters, or the structure may
+be fully initialized using the advanced variant of the constructor.
+*/
+class CV_EXPORTS TermCriteria
+{
+public:
+    /**
+      Criteria type, can be one of: COUNT, EPS or COUNT + EPS
+    */
+    enum Type
+    {
+        COUNT=1, //!< the maximum number of iterations or elements to compute
+        MAX_ITER=COUNT, //!< ditto
+        EPS=2 //!< the desired accuracy or change in parameters at which the iterative algorithm stops
+    };
+
+    //! default constructor
+    TermCriteria();
+    /**
+    @param type The type of termination criteria, one of TermCriteria::Type
+    @param maxCount The maximum number of iterations or elements to compute.
+    @param epsilon The desired accuracy or change in parameters at which the iterative algorithm stops.
+    */
+    TermCriteria(int type, int maxCount, double epsilon);
+
+    int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPS
+    int maxCount; // the maximum number of iterations/elements
+    double epsilon; // the desired accuracy
+};
+
+
+//! @} core_basic
+
+///////////////////////// raster image moments //////////////////////////
+
+//! @addtogroup imgproc_shape
+//! @{
+
+/** @brief struct returned by cv::moments
+
+The spatial moments \f$\texttt{Moments::m}_{ji}\f$ are computed as:
+
+\f[\texttt{m} _{ji}= \sum _{x,y}  \left ( \texttt{array} (x,y)  \cdot x^j  \cdot y^i \right )\f]
+
+The central moments \f$\texttt{Moments::mu}_{ji}\f$ are computed as:
+
+\f[\texttt{mu} _{ji}= \sum _{x,y}  \left ( \texttt{array} (x,y)  \cdot (x -  \bar{x} )^j  \cdot (y -  \bar{y} )^i \right )\f]
+
+where \f$(\bar{x}, \bar{y})\f$ is the mass center:
+
+\f[\bar{x} = \frac{\texttt{m}_{10}}{\texttt{m}_{00}} , \; \bar{y} = \frac{\texttt{m}_{01}}{\texttt{m}_{00}}\f]
+
+The normalized central moments \f$\texttt{Moments::nu}_{ij}\f$ are computed as:
+
+\f[\texttt{nu} _{ji}= \frac{\texttt{mu}_{ji}}{\texttt{m}_{00}^{(i+j)/2+1}} .\f]
+
+@note
+\f$\texttt{mu}_{00}=\texttt{m}_{00}\f$, \f$\texttt{nu}_{00}=1\f$
+\f$\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\f$ , hence the values are not
+stored.
+
+The moments of a contour are defined in the same way but computed using the Green's formula (see
+<http://en.wikipedia.org/wiki/Green_theorem>). So, due to a limited raster resolution, the moments
+computed for a contour are slightly different from the moments computed for the same rasterized
+contour.
+
+@note
+Since the contour moments are computed using Green formula, you may get seemingly odd results for
+contours with self-intersections, e.g. a zero area (m00) for butterfly-shaped contours.
+ */
+class CV_EXPORTS_W_MAP Moments
+{
+public:
+    //! the default constructor
+    Moments();
+    //! the full constructor
+    Moments(double m00, double m10, double m01, double m20, double m11,
+            double m02, double m30, double m21, double m12, double m03 );
+    ////! the conversion from CvMoments
+    //Moments( const CvMoments& moments );
+    ////! the conversion to CvMoments
+    //operator CvMoments() const;
+
+    //! @name spatial moments
+    //! @{
+    CV_PROP_RW double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
+    //! @}
+
+    //! @name central moments
+    //! @{
+    CV_PROP_RW double  mu20, mu11, mu02, mu30, mu21, mu12, mu03;
+    //! @}
+
+    //! @name central normalized moments
+    //! @{
+    CV_PROP_RW double  nu20, nu11, nu02, nu30, nu21, nu12, nu03;
+    //! @}
+};
+
+template<> class DataType<Moments>
+{
+public:
+    typedef Moments     value_type;
+    typedef double      work_type;
+    typedef double      channel_type;
+
+    enum { generic_type = 0,
+           depth        = DataType<channel_type>::depth,
+           channels     = (int)(sizeof(value_type)/sizeof(channel_type)), // 24
+           fmt          = DataType<channel_type>::fmt + ((channels - 1) << 8),
+           type         = CV_MAKETYPE(depth, channels)
+         };
+
+    typedef Vec<channel_type, channels> vec_type;
+};
+
+//! @} imgproc_shape
+
+//! @cond IGNORED
+
+/////////////////////////////////////////////////////////////////////////
+///////////////////////////// Implementation ////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////// Complex ////////////////////////////////
+
+template<typename _Tp> inline
+Complex<_Tp>::Complex()
+    : re(0), im(0) {}
+
+template<typename _Tp> inline
+Complex<_Tp>::Complex( _Tp _re, _Tp _im )
+    : re(_re), im(_im) {}
+
+template<typename _Tp> template<typename T2> inline
+Complex<_Tp>::operator Complex<T2>() const
+{
+    return Complex<T2>(saturate_cast<T2>(re), saturate_cast<T2>(im));
+}
+
+template<typename _Tp> inline
+Complex<_Tp> Complex<_Tp>::conj() const
+{
+    return Complex<_Tp>(re, -im);
+}
+
+
+template<typename _Tp> static inline
+bool operator == (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return a.re == b.re && a.im == b.im;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return a.re != b.re || a.im != b.im;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator + (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return Complex<_Tp>( a.re + b.re, a.im + b.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator += (Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    a.re += b.re; a.im += b.im;
+    return a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator - (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return Complex<_Tp>( a.re - b.re, a.im - b.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator -= (Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    a.re -= b.re; a.im -= b.im;
+    return a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator - (const Complex<_Tp>& a)
+{
+    return Complex<_Tp>(-a.re, -a.im);
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator * (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return Complex<_Tp>( a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator * (const Complex<_Tp>& a, _Tp b)
+{
+    return Complex<_Tp>( a.re*b, a.im*b );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator * (_Tp b, const Complex<_Tp>& a)
+{
+    return Complex<_Tp>( a.re*b, a.im*b );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator + (const Complex<_Tp>& a, _Tp b)
+{
+    return Complex<_Tp>( a.re + b, a.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator - (const Complex<_Tp>& a, _Tp b)
+{ return Complex<_Tp>( a.re - b, a.im ); }
+
+template<typename _Tp> static inline
+Complex<_Tp> operator + (_Tp b, const Complex<_Tp>& a)
+{
+    return Complex<_Tp>( a.re + b, a.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator - (_Tp b, const Complex<_Tp>& a)
+{
+    return Complex<_Tp>( b - a.re, -a.im );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator += (Complex<_Tp>& a, _Tp b)
+{
+    a.re += b; return a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator -= (Complex<_Tp>& a, _Tp b)
+{
+    a.re -= b; return a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator *= (Complex<_Tp>& a, _Tp b)
+{
+    a.re *= b; a.im *= b; return a;
+}
+
+template<typename _Tp> static inline
+double abs(const Complex<_Tp>& a)
+{
+    return std::sqrt( (double)a.re*a.re + (double)a.im*a.im);
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator / (const Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    double t = 1./((double)b.re*b.re + (double)b.im*b.im);
+    return Complex<_Tp>( (_Tp)((a.re*b.re + a.im*b.im)*t),
+                        (_Tp)((-a.re*b.im + a.im*b.re)*t) );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp>& operator /= (Complex<_Tp>& a, const Complex<_Tp>& b)
+{
+    return (a = a / b);
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator / (const Complex<_Tp>& a, _Tp b)
+{
+    _Tp t = (_Tp)1/b;
+    return Complex<_Tp>( a.re*t, a.im*t );
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator / (_Tp b, const Complex<_Tp>& a)
+{
+    return Complex<_Tp>(b)/a;
+}
+
+template<typename _Tp> static inline
+Complex<_Tp> operator /= (const Complex<_Tp>& a, _Tp b)
+{
+    _Tp t = (_Tp)1/b;
+    a.re *= t; a.im *= t; return a;
+}
+
+
+
+//////////////////////////////// 2D Point ///////////////////////////////
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_()
+    : x(0), y(0) {}
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_(_Tp _x, _Tp _y)
+    : x(_x), y(_y) {}
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_(const Point_& pt)
+    : x(pt.x), y(pt.y) {}
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_(const Size_<_Tp>& sz)
+    : x(sz.width), y(sz.height) {}
+
+template<typename _Tp> inline
+Point_<_Tp>::Point_(const Vec<_Tp,2>& v)
+    : x(v[0]), y(v[1]) {}
+
+template<typename _Tp> inline
+Point_<_Tp>& Point_<_Tp>::operator = (const Point_& pt)
+{
+    x = pt.x; y = pt.y;
+    return *this;
+}
+
+template<typename _Tp> template<typename _Tp2> inline
+Point_<_Tp>::operator Point_<_Tp2>() const
+{
+    return Point_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y));
+}
+
+template<typename _Tp> inline
+Point_<_Tp>::operator Vec<_Tp, 2>() const
+{
+    return Vec<_Tp, 2>(x, y);
+}
+
+template<typename _Tp> inline
+_Tp Point_<_Tp>::dot(const Point_& pt) const
+{
+    return saturate_cast<_Tp>(x*pt.x + y*pt.y);
+}
+
+template<typename _Tp> inline
+double Point_<_Tp>::ddot(const Point_& pt) const
+{
+    return (double)x*pt.x + (double)y*pt.y;
+}
+
+template<typename _Tp> inline
+double Point_<_Tp>::cross(const Point_& pt) const
+{
+    return (double)x*pt.y - (double)y*pt.x;
+}
+
+template<typename _Tp> inline bool
+Point_<_Tp>::inside( const Rect_<_Tp>& r ) const
+{
+    return r.contains(*this);
+}
+
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator += (Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    a.x += b.x;
+    a.y += b.y;
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator -= (Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    a.x -= b.x;
+    a.y -= b.y;
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator *= (Point_<_Tp>& a, int b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator *= (Point_<_Tp>& a, float b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator *= (Point_<_Tp>& a, double b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator /= (Point_<_Tp>& a, int b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator /= (Point_<_Tp>& a, float b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp>& operator /= (Point_<_Tp>& a, double b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+double norm(const Point_<_Tp>& pt)
+{
+    return std::sqrt((double)pt.x*pt.x + (double)pt.y*pt.y);
+}
+
+template<typename _Tp> static inline
+bool operator == (const Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return a.x == b.x && a.y == b.y;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return a.x != b.x || a.y != b.y;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator + (const Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x + b.x), saturate_cast<_Tp>(a.y + b.y) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator - (const Point_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x - b.x), saturate_cast<_Tp>(a.y - b.y) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator - (const Point_<_Tp>& a)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(-a.x), saturate_cast<_Tp>(-a.y) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (const Point_<_Tp>& a, int b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (int a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (const Point_<_Tp>& a, float b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (float a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (const Point_<_Tp>& a, double b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (double a, const Point_<_Tp>& b)
+{
+    return Point_<_Tp>( saturate_cast<_Tp>(b.x*a), saturate_cast<_Tp>(b.y*a) );
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator * (const Matx<_Tp, 2, 2>& a, const Point_<_Tp>& b)
+{
+    Matx<_Tp, 2, 1> tmp = a * Vec<_Tp,2>(b.x, b.y);
+    return Point_<_Tp>(tmp.val[0], tmp.val[1]);
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Matx<_Tp, 3, 3>& a, const Point_<_Tp>& b)
+{
+    Matx<_Tp, 3, 1> tmp = a * Vec<_Tp,3>(b.x, b.y, 1);
+    return Point3_<_Tp>(tmp.val[0], tmp.val[1], tmp.val[2]);
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator / (const Point_<_Tp>& a, int b)
+{
+    Point_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator / (const Point_<_Tp>& a, float b)
+{
+    Point_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Point_<_Tp> operator / (const Point_<_Tp>& a, double b)
+{
+    Point_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+
+
+//////////////////////////////// 3D Point ///////////////////////////////
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_()
+    : x(0), y(0), z(0) {}
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_(_Tp _x, _Tp _y, _Tp _z)
+    : x(_x), y(_y), z(_z) {}
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_(const Point3_& pt)
+    : x(pt.x), y(pt.y), z(pt.z) {}
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_(const Point_<_Tp>& pt)
+    : x(pt.x), y(pt.y), z(_Tp()) {}
+
+template<typename _Tp> inline
+Point3_<_Tp>::Point3_(const Vec<_Tp, 3>& v)
+    : x(v[0]), y(v[1]), z(v[2]) {}
+
+template<typename _Tp> template<typename _Tp2> inline
+Point3_<_Tp>::operator Point3_<_Tp2>() const
+{
+    return Point3_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y), saturate_cast<_Tp2>(z));
+}
+
+template<typename _Tp> inline
+Point3_<_Tp>::operator Vec<_Tp, 3>() const
+{
+    return Vec<_Tp, 3>(x, y, z);
+}
+
+template<typename _Tp> inline
+Point3_<_Tp>& Point3_<_Tp>::operator = (const Point3_& pt)
+{
+    x = pt.x; y = pt.y; z = pt.z;
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp Point3_<_Tp>::dot(const Point3_& pt) const
+{
+    return saturate_cast<_Tp>(x*pt.x + y*pt.y + z*pt.z);
+}
+
+template<typename _Tp> inline
+double Point3_<_Tp>::ddot(const Point3_& pt) const
+{
+    return (double)x*pt.x + (double)y*pt.y + (double)z*pt.z;
+}
+
+template<typename _Tp> inline
+Point3_<_Tp> Point3_<_Tp>::cross(const Point3_<_Tp>& pt) const
+{
+    return Point3_<_Tp>(y*pt.z - z*pt.y, z*pt.x - x*pt.z, x*pt.y - y*pt.x);
+}
+
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator += (Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    a.x += b.x;
+    a.y += b.y;
+    a.z += b.z;
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator -= (Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    a.x -= b.x;
+    a.y -= b.y;
+    a.z -= b.z;
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator *= (Point3_<_Tp>& a, int b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    a.z = saturate_cast<_Tp>(a.z * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator *= (Point3_<_Tp>& a, float b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    a.z = saturate_cast<_Tp>(a.z * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator *= (Point3_<_Tp>& a, double b)
+{
+    a.x = saturate_cast<_Tp>(a.x * b);
+    a.y = saturate_cast<_Tp>(a.y * b);
+    a.z = saturate_cast<_Tp>(a.z * b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator /= (Point3_<_Tp>& a, int b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    a.z = saturate_cast<_Tp>(a.z / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator /= (Point3_<_Tp>& a, float b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    a.z = saturate_cast<_Tp>(a.z / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp>& operator /= (Point3_<_Tp>& a, double b)
+{
+    a.x = saturate_cast<_Tp>(a.x / b);
+    a.y = saturate_cast<_Tp>(a.y / b);
+    a.z = saturate_cast<_Tp>(a.z / b);
+    return a;
+}
+
+template<typename _Tp> static inline
+double norm(const Point3_<_Tp>& pt)
+{
+    return std::sqrt((double)pt.x*pt.x + (double)pt.y*pt.y + (double)pt.z*pt.z);
+}
+
+template<typename _Tp> static inline
+bool operator == (const Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    return a.x == b.x && a.y == b.y && a.z == b.z;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    return a.x != b.x || a.y != b.y || a.z != b.z;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator + (const Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x + b.x), saturate_cast<_Tp>(a.y + b.y), saturate_cast<_Tp>(a.z + b.z));
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator - (const Point3_<_Tp>& a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x - b.x), saturate_cast<_Tp>(a.y - b.y), saturate_cast<_Tp>(a.z - b.z));
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator - (const Point3_<_Tp>& a)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(-a.x), saturate_cast<_Tp>(-a.y), saturate_cast<_Tp>(-a.z) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Point3_<_Tp>& a, int b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x*b), saturate_cast<_Tp>(a.y*b), saturate_cast<_Tp>(a.z*b) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (int a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Point3_<_Tp>& a, float b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x * b), saturate_cast<_Tp>(a.y * b), saturate_cast<_Tp>(a.z * b) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (float a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Point3_<_Tp>& a, double b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(a.x * b), saturate_cast<_Tp>(a.y * b), saturate_cast<_Tp>(a.z * b) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (double a, const Point3_<_Tp>& b)
+{
+    return Point3_<_Tp>( saturate_cast<_Tp>(b.x * a), saturate_cast<_Tp>(b.y * a), saturate_cast<_Tp>(b.z * a) );
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator * (const Matx<_Tp, 3, 3>& a, const Point3_<_Tp>& b)
+{
+    Matx<_Tp, 3, 1> tmp = a * Vec<_Tp,3>(b.x, b.y, b.z);
+    return Point3_<_Tp>(tmp.val[0], tmp.val[1], tmp.val[2]);
+}
+
+template<typename _Tp> static inline
+Matx<_Tp, 4, 1> operator * (const Matx<_Tp, 4, 4>& a, const Point3_<_Tp>& b)
+{
+    return a * Matx<_Tp, 4, 1>(b.x, b.y, b.z, 1);
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator / (const Point3_<_Tp>& a, int b)
+{
+    Point3_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator / (const Point3_<_Tp>& a, float b)
+{
+    Point3_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Point3_<_Tp> operator / (const Point3_<_Tp>& a, double b)
+{
+    Point3_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+
+
+////////////////////////////////// Size /////////////////////////////////
+
+template<typename _Tp> inline
+Size_<_Tp>::Size_()
+    : width(0), height(0) {}
+
+template<typename _Tp> inline
+Size_<_Tp>::Size_(_Tp _width, _Tp _height)
+    : width(_width), height(_height) {}
+
+template<typename _Tp> inline
+Size_<_Tp>::Size_(const Size_& sz)
+    : width(sz.width), height(sz.height) {}
+
+template<typename _Tp> inline
+Size_<_Tp>::Size_(const Point_<_Tp>& pt)
+    : width(pt.x), height(pt.y) {}
+
+template<typename _Tp> template<typename _Tp2> inline
+Size_<_Tp>::operator Size_<_Tp2>() const
+{
+    return Size_<_Tp2>(saturate_cast<_Tp2>(width), saturate_cast<_Tp2>(height));
+}
+
+template<typename _Tp> inline
+Size_<_Tp>& Size_<_Tp>::operator = (const Size_<_Tp>& sz)
+{
+    width = sz.width; height = sz.height;
+    return *this;
+}
+
+template<typename _Tp> inline
+_Tp Size_<_Tp>::area() const
+{
+    return width * height;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp>& operator *= (Size_<_Tp>& a, _Tp b)
+{
+    a.width *= b;
+    a.height *= b;
+    return a;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp> operator * (const Size_<_Tp>& a, _Tp b)
+{
+    Size_<_Tp> tmp(a);
+    tmp *= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp>& operator /= (Size_<_Tp>& a, _Tp b)
+{
+    a.width /= b;
+    a.height /= b;
+    return a;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp> operator / (const Size_<_Tp>& a, _Tp b)
+{
+    Size_<_Tp> tmp(a);
+    tmp /= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp>& operator += (Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    a.width += b.width;
+    a.height += b.height;
+    return a;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp> operator + (const Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    Size_<_Tp> tmp(a);
+    tmp += b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp>& operator -= (Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    a.width -= b.width;
+    a.height -= b.height;
+    return a;
+}
+
+template<typename _Tp> static inline
+Size_<_Tp> operator - (const Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    Size_<_Tp> tmp(a);
+    tmp -= b;
+    return tmp;
+}
+
+template<typename _Tp> static inline
+bool operator == (const Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    return a.width == b.width && a.height == b.height;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Size_<_Tp>& a, const Size_<_Tp>& b)
+{
+    return !(a == b);
+}
+
+
+
+////////////////////////////////// Rect /////////////////////////////////
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_()
+    : x(0), y(0), width(0), height(0) {}
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height)
+    : x(_x), y(_y), width(_width), height(_height) {}
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_(const Rect_<_Tp>& r)
+    : x(r.x), y(r.y), width(r.width), height(r.height) {}
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz)
+    : x(org.x), y(org.y), width(sz.width), height(sz.height) {}
+
+template<typename _Tp> inline
+Rect_<_Tp>::Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2)
+{
+    x = std::min(pt1.x, pt2.x);
+    y = std::min(pt1.y, pt2.y);
+    width = std::max(pt1.x, pt2.x) - x;
+    height = std::max(pt1.y, pt2.y) - y;
+}
+
+template<typename _Tp> inline
+Rect_<_Tp>& Rect_<_Tp>::operator = ( const Rect_<_Tp>& r )
+{
+    x = r.x;
+    y = r.y;
+    width = r.width;
+    height = r.height;
+    return *this;
+}
+
+template<typename _Tp> inline
+Point_<_Tp> Rect_<_Tp>::tl() const
+{
+    return Point_<_Tp>(x,y);
+}
+
+template<typename _Tp> inline
+Point_<_Tp> Rect_<_Tp>::br() const
+{
+    return Point_<_Tp>(x + width, y + height);
+}
+
+template<typename _Tp> inline
+Size_<_Tp> Rect_<_Tp>::size() const
+{
+    return Size_<_Tp>(width, height);
+}
+
+template<typename _Tp> inline
+_Tp Rect_<_Tp>::area() const
+{
+    return width * height;
+}
+
+template<typename _Tp> template<typename _Tp2> inline
+Rect_<_Tp>::operator Rect_<_Tp2>() const
+{
+    return Rect_<_Tp2>(saturate_cast<_Tp2>(x), saturate_cast<_Tp2>(y), saturate_cast<_Tp2>(width), saturate_cast<_Tp2>(height));
+}
+
+template<typename _Tp> inline
+bool Rect_<_Tp>::contains(const Point_<_Tp>& pt) const
+{
+    return x <= pt.x && pt.x < x + width && y <= pt.y && pt.y < y + height;
+}
+
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator += ( Rect_<_Tp>& a, const Point_<_Tp>& b )
+{
+    a.x += b.x;
+    a.y += b.y;
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator -= ( Rect_<_Tp>& a, const Point_<_Tp>& b )
+{
+    a.x -= b.x;
+    a.y -= b.y;
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator += ( Rect_<_Tp>& a, const Size_<_Tp>& b )
+{
+    a.width += b.width;
+    a.height += b.height;
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator -= ( Rect_<_Tp>& a, const Size_<_Tp>& b )
+{
+    a.width -= b.width;
+    a.height -= b.height;
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator &= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
+{
+    _Tp x1 = std::max(a.x, b.x);
+    _Tp y1 = std::max(a.y, b.y);
+    a.width = std::min(a.x + a.width, b.x + b.width) - x1;
+    a.height = std::min(a.y + a.height, b.y + b.height) - y1;
+    a.x = x1;
+    a.y = y1;
+    if( a.width <= 0 || a.height <= 0 )
+        a = Rect();
+    return a;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp>& operator |= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
+{
+    _Tp x1 = std::min(a.x, b.x);
+    _Tp y1 = std::min(a.y, b.y);
+    a.width = std::max(a.x + a.width, b.x + b.width) - x1;
+    a.height = std::max(a.y + a.height, b.y + b.height) - y1;
+    a.x = x1;
+    a.y = y1;
+    return a;
+}
+
+template<typename _Tp> static inline
+bool operator == (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
+{
+    return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height;
+}
+
+template<typename _Tp> static inline
+bool operator != (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
+{
+    return a.x != b.x || a.y != b.y || a.width != b.width || a.height != b.height;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator + (const Rect_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return Rect_<_Tp>( a.x + b.x, a.y + b.y, a.width, a.height );
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator - (const Rect_<_Tp>& a, const Point_<_Tp>& b)
+{
+    return Rect_<_Tp>( a.x - b.x, a.y - b.y, a.width, a.height );
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator + (const Rect_<_Tp>& a, const Size_<_Tp>& b)
+{
+    return Rect_<_Tp>( a.x, a.y, a.width + b.width, a.height + b.height );
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator & (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
+{
+    Rect_<_Tp> c = a;
+    return c &= b;
+}
+
+template<typename _Tp> static inline
+Rect_<_Tp> operator | (const Rect_<_Tp>& a, const Rect_<_Tp>& b)
+{
+    Rect_<_Tp> c = a;
+    return c |= b;
+}
+
+
+
+////////////////////////////// RotatedRect //////////////////////////////
+
+inline
+RotatedRect::RotatedRect()
+    : center(), size(), angle(0) {}
+
+inline
+RotatedRect::RotatedRect(const Point2f& _center, const Size2f& _size, float _angle)
+    : center(_center), size(_size), angle(_angle) {}
+
+
+
+///////////////////////////////// Range /////////////////////////////////
+
+inline
+Range::Range()
+    : start(0), end(0) {}
+
+inline
+Range::Range(int _start, int _end)
+    : start(_start), end(_end) {}
+
+inline
+int Range::size() const
+{
+    return end - start;
+}
+
+inline
+bool Range::empty() const
+{
+    return start == end;
+}
+
+inline
+Range Range::all()
+{
+    return Range(INT_MIN, INT_MAX);
+}
+
+
+static inline
+bool operator == (const Range& r1, const Range& r2)
+{
+    return r1.start == r2.start && r1.end == r2.end;
+}
+
+static inline
+bool operator != (const Range& r1, const Range& r2)
+{
+    return !(r1 == r2);
+}
+
+static inline
+bool operator !(const Range& r)
+{
+    return r.start == r.end;
+}
+
+static inline
+Range operator & (const Range& r1, const Range& r2)
+{
+    Range r(std::max(r1.start, r2.start), std::min(r1.end, r2.end));
+    r.end = std::max(r.end, r.start);
+    return r;
+}
+
+static inline
+Range& operator &= (Range& r1, const Range& r2)
+{
+    r1 = r1 & r2;
+    return r1;
+}
+
+static inline
+Range operator + (const Range& r1, int delta)
+{
+    return Range(r1.start + delta, r1.end + delta);
+}
+
+static inline
+Range operator + (int delta, const Range& r1)
+{
+    return Range(r1.start + delta, r1.end + delta);
+}
+
+static inline
+Range operator - (const Range& r1, int delta)
+{
+    return r1 + (-delta);
+}
+
+
+
+///////////////////////////////// Scalar ////////////////////////////////
+
+template<typename _Tp> inline
+Scalar_<_Tp>::Scalar_()
+{
+    this->val[0] = this->val[1] = this->val[2] = this->val[3] = 0;
+}
+
+template<typename _Tp> inline
+Scalar_<_Tp>::Scalar_(_Tp v0, _Tp v1, _Tp v2, _Tp v3)
+{
+    this->val[0] = v0;
+    this->val[1] = v1;
+    this->val[2] = v2;
+    this->val[3] = v3;
+}
+
+template<typename _Tp> template<typename _Tp2, int cn> inline
+Scalar_<_Tp>::Scalar_(const Vec<_Tp2, cn>& v)
+{
+    int i;
+    for( i = 0; i < (cn < 4 ? cn : 4); i++ )
+        this->val[i] = cv::saturate_cast<_Tp>(v.val[i]);
+    for( ; i < 4; i++ )
+        this->val[i] = 0;
+}
+
+template<typename _Tp> inline
+Scalar_<_Tp>::Scalar_(_Tp v0)
+{
+    this->val[0] = v0;
+    this->val[1] = this->val[2] = this->val[3] = 0;
+}
+
+template<typename _Tp> inline
+Scalar_<_Tp> Scalar_<_Tp>::all(_Tp v0)
+{
+    return Scalar_<_Tp>(v0, v0, v0, v0);
+}
+
+
+template<typename _Tp> inline
+Scalar_<_Tp> Scalar_<_Tp>::mul(const Scalar_<_Tp>& a, double scale ) const
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>(this->val[0] * a.val[0] * scale),
+                        saturate_cast<_Tp>(this->val[1] * a.val[1] * scale),
+                        saturate_cast<_Tp>(this->val[2] * a.val[2] * scale),
+                        saturate_cast<_Tp>(this->val[3] * a.val[3] * scale));
+}
+
+template<typename _Tp> inline
+Scalar_<_Tp> Scalar_<_Tp>::conj() const
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>( this->val[0]),
+                        saturate_cast<_Tp>(-this->val[1]),
+                        saturate_cast<_Tp>(-this->val[2]),
+                        saturate_cast<_Tp>(-this->val[3]));
+}
+
+template<typename _Tp> inline
+bool Scalar_<_Tp>::isReal() const
+{
+    return this->val[1] == 0 && this->val[2] == 0 && this->val[3] == 0;
+}
+
+
+template<typename _Tp> template<typename T2> inline
+Scalar_<_Tp>::operator Scalar_<T2>() const
+{
+    return Scalar_<T2>(saturate_cast<T2>(this->val[0]),
+                       saturate_cast<T2>(this->val[1]),
+                       saturate_cast<T2>(this->val[2]),
+                       saturate_cast<T2>(this->val[3]));
+}
+
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator += (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    a.val[0] += b.val[0];
+    a.val[1] += b.val[1];
+    a.val[2] += b.val[2];
+    a.val[3] += b.val[3];
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator -= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    a.val[0] -= b.val[0];
+    a.val[1] -= b.val[1];
+    a.val[2] -= b.val[2];
+    a.val[3] -= b.val[3];
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator *= ( Scalar_<_Tp>& a, _Tp v )
+{
+    a.val[0] *= v;
+    a.val[1] *= v;
+    a.val[2] *= v;
+    a.val[3] *= v;
+    return a;
+}
+
+template<typename _Tp> static inline
+bool operator == ( const Scalar_<_Tp>& a, const Scalar_<_Tp>& b )
+{
+    return a.val[0] == b.val[0] && a.val[1] == b.val[1] &&
+           a.val[2] == b.val[2] && a.val[3] == b.val[3];
+}
+
+template<typename _Tp> static inline
+bool operator != ( const Scalar_<_Tp>& a, const Scalar_<_Tp>& b )
+{
+    return a.val[0] != b.val[0] || a.val[1] != b.val[1] ||
+           a.val[2] != b.val[2] || a.val[3] != b.val[3];
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator + (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    return Scalar_<_Tp>(a.val[0] + b.val[0],
+                        a.val[1] + b.val[1],
+                        a.val[2] + b.val[2],
+                        a.val[3] + b.val[3]);
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator - (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>(a.val[0] - b.val[0]),
+                        saturate_cast<_Tp>(a.val[1] - b.val[1]),
+                        saturate_cast<_Tp>(a.val[2] - b.val[2]),
+                        saturate_cast<_Tp>(a.val[3] - b.val[3]));
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator * (const Scalar_<_Tp>& a, _Tp alpha)
+{
+    return Scalar_<_Tp>(a.val[0] * alpha,
+                        a.val[1] * alpha,
+                        a.val[2] * alpha,
+                        a.val[3] * alpha);
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator * (_Tp alpha, const Scalar_<_Tp>& a)
+{
+    return a*alpha;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator - (const Scalar_<_Tp>& a)
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>(-a.val[0]),
+                        saturate_cast<_Tp>(-a.val[1]),
+                        saturate_cast<_Tp>(-a.val[2]),
+                        saturate_cast<_Tp>(-a.val[3]));
+}
+
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator * (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    return Scalar_<_Tp>(saturate_cast<_Tp>(a[0]*b[0] - a[1]*b[1] - a[2]*b[2] - a[3]*b[3]),
+                        saturate_cast<_Tp>(a[0]*b[1] + a[1]*b[0] + a[2]*b[3] - a[3]*b[2]),
+                        saturate_cast<_Tp>(a[0]*b[2] - a[1]*b[3] + a[2]*b[0] + a[3]*b[1]),
+                        saturate_cast<_Tp>(a[0]*b[3] + a[1]*b[2] - a[2]*b[1] + a[3]*b[0]));
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator *= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    a = a * b;
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator / (const Scalar_<_Tp>& a, _Tp alpha)
+{
+    return Scalar_<_Tp>(a.val[0] / alpha,
+                        a.val[1] / alpha,
+                        a.val[2] / alpha,
+                        a.val[3] / alpha);
+}
+
+template<typename _Tp> static inline
+Scalar_<float> operator / (const Scalar_<float>& a, float alpha)
+{
+    float s = 1 / alpha;
+    return Scalar_<float>(a.val[0] * s, a.val[1] * s, a.val[2] * s, a.val[3] * s);
+}
+
+template<typename _Tp> static inline
+Scalar_<double> operator / (const Scalar_<double>& a, double alpha)
+{
+    double s = 1 / alpha;
+    return Scalar_<double>(a.val[0] * s, a.val[1] * s, a.val[2] * s, a.val[3] * s);
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator /= (Scalar_<_Tp>& a, _Tp alpha)
+{
+    a = a / alpha;
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator / (_Tp a, const Scalar_<_Tp>& b)
+{
+    _Tp s = a / (b[0]*b[0] + b[1]*b[1] + b[2]*b[2] + b[3]*b[3]);
+    return b.conj() * s;
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp> operator / (const Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    return a * ((_Tp)1 / b);
+}
+
+template<typename _Tp> static inline
+Scalar_<_Tp>& operator /= (Scalar_<_Tp>& a, const Scalar_<_Tp>& b)
+{
+    a = a / b;
+    return a;
+}
+
+template<typename _Tp> static inline
+Scalar operator * (const Matx<_Tp, 4, 4>& a, const Scalar& b)
+{
+    Matx<double, 4, 1> c((Matx<double, 4, 4>)a, b, Matx_MatMulOp());
+    return reinterpret_cast<const Scalar&>(c);
+}
+
+template<> inline
+Scalar operator * (const Matx<double, 4, 4>& a, const Scalar& b)
+{
+    Matx<double, 4, 1> c(a, b, Matx_MatMulOp());
+    return reinterpret_cast<const Scalar&>(c);
+}
+
+
+
+//////////////////////////////// KeyPoint ///////////////////////////////
+
+inline
+KeyPoint::KeyPoint()
+    : pt(0,0), size(0), angle(-1), response(0), octave(0), class_id(-1) {}
+
+inline
+KeyPoint::KeyPoint(Point2f _pt, float _size, float _angle, float _response, int _octave, int _class_id)
+    : pt(_pt), size(_size), angle(_angle), response(_response), octave(_octave), class_id(_class_id) {}
+
+inline
+KeyPoint::KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id)
+    : pt(x, y), size(_size), angle(_angle), response(_response), octave(_octave), class_id(_class_id) {}
+
+
+
+///////////////////////////////// DMatch ////////////////////////////////
+
+inline
+DMatch::DMatch()
+    : queryIdx(-1), trainIdx(-1), imgIdx(-1), distance(FLT_MAX) {}
+
+inline
+DMatch::DMatch(int _queryIdx, int _trainIdx, float _distance)
+    : queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(-1), distance(_distance) {}
+
+inline
+DMatch::DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance)
+    : queryIdx(_queryIdx), trainIdx(_trainIdx), imgIdx(_imgIdx), distance(_distance) {}
+
+inline
+bool DMatch::operator < (const DMatch &m) const
+{
+    return distance < m.distance;
+}
+
+
+
+////////////////////////////// TermCriteria /////////////////////////////
+
+inline
+TermCriteria::TermCriteria()
+    : type(0), maxCount(0), epsilon(0) {}
+
+inline
+TermCriteria::TermCriteria(int _type, int _maxCount, double _epsilon)
+    : type(_type), maxCount(_maxCount), epsilon(_epsilon) {}
+
+//! @endcond
+
+} // cv
+
+#endif //__OPENCV_CORE_TYPES_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/types_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/core/types_c.h
new file mode 100644
index 0000000..cb39587
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/types_c.h
@@ -0,0 +1,1834 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_CORE_TYPES_H__
+#define __OPENCV_CORE_TYPES_H__
+
+#ifdef HAVE_IPL
+#  ifndef __IPL_H__
+#    if defined WIN32 || defined _WIN32
+#      include <ipl.h>
+#    else
+#      include <ipl/ipl.h>
+#    endif
+#  endif
+#elif defined __IPL_H__
+#  define HAVE_IPL
+#endif
+
+#include "opencv2/core/cvdef.h"
+
+#ifndef SKIP_INCLUDES
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <float.h>
+#endif // SKIP_INCLUDES
+
+#if defined WIN32 || defined _WIN32
+#  define CV_CDECL __cdecl
+#  define CV_STDCALL __stdcall
+#else
+#  define CV_CDECL
+#  define CV_STDCALL
+#endif
+
+#ifndef CV_DEFAULT
+#  ifdef __cplusplus
+#    define CV_DEFAULT(val) = val
+#  else
+#    define CV_DEFAULT(val)
+#  endif
+#endif
+
+#ifndef CV_EXTERN_C_FUNCPTR
+#  ifdef __cplusplus
+#    define CV_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; }
+#  else
+#    define CV_EXTERN_C_FUNCPTR(x) typedef x
+#  endif
+#endif
+
+#ifndef CVAPI
+#  define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
+#endif
+
+#ifndef CV_IMPL
+#  define CV_IMPL CV_EXTERN_C
+#endif
+
+#ifdef __cplusplus
+#  include "opencv2/core.hpp"
+#endif
+
+/** @addtogroup core_c
+    @{
+*/
+
+/** @brief This is the "metatype" used *only* as a function parameter.
+
+It denotes that the function accepts arrays of multiple types, such as IplImage*, CvMat* or even
+CvSeq* sometimes. The particular array type is determined at runtime by analyzing the first 4
+bytes of the header. In C++ interface the role of CvArr is played by InputArray and OutputArray.
+ */
+typedef void CvArr;
+
+typedef int CVStatus;
+
+/** @see cv::Error::Code */
+enum {
+ CV_StsOk=                       0,  /**< everything is ok                */
+ CV_StsBackTrace=               -1,  /**< pseudo error for back trace     */
+ CV_StsError=                   -2,  /**< unknown /unspecified error      */
+ CV_StsInternal=                -3,  /**< internal error (bad state)      */
+ CV_StsNoMem=                   -4,  /**< insufficient memory             */
+ CV_StsBadArg=                  -5,  /**< function arg/param is bad       */
+ CV_StsBadFunc=                 -6,  /**< unsupported function            */
+ CV_StsNoConv=                  -7,  /**< iter. didn't converge           */
+ CV_StsAutoTrace=               -8,  /**< tracing                         */
+ CV_HeaderIsNull=               -9,  /**< image header is NULL            */
+ CV_BadImageSize=              -10,  /**< image size is invalid           */
+ CV_BadOffset=                 -11,  /**< offset is invalid               */
+ CV_BadDataPtr=                -12,  /**/
+ CV_BadStep=                   -13,  /**/
+ CV_BadModelOrChSeq=           -14,  /**/
+ CV_BadNumChannels=            -15,  /**/
+ CV_BadNumChannel1U=           -16,  /**/
+ CV_BadDepth=                  -17,  /**/
+ CV_BadAlphaChannel=           -18,  /**/
+ CV_BadOrder=                  -19,  /**/
+ CV_BadOrigin=                 -20,  /**/
+ CV_BadAlign=                  -21,  /**/
+ CV_BadCallBack=               -22,  /**/
+ CV_BadTileSize=               -23,  /**/
+ CV_BadCOI=                    -24,  /**/
+ CV_BadROISize=                -25,  /**/
+ CV_MaskIsTiled=               -26,  /**/
+ CV_StsNullPtr=                -27,  /**< null pointer */
+ CV_StsVecLengthErr=           -28,  /**< incorrect vector length */
+ CV_StsFilterStructContentErr= -29,  /**< incorr. filter structure content */
+ CV_StsKernelStructContentErr= -30,  /**< incorr. transform kernel content */
+ CV_StsFilterOffsetErr=        -31,  /**< incorrect filter offset value */
+ CV_StsBadSize=                -201, /**< the input/output structure size is incorrect  */
+ CV_StsDivByZero=              -202, /**< division by zero */
+ CV_StsInplaceNotSupported=    -203, /**< in-place operation is not supported */
+ CV_StsObjectNotFound=         -204, /**< request can't be completed */
+ CV_StsUnmatchedFormats=       -205, /**< formats of input/output arrays differ */
+ CV_StsBadFlag=                -206, /**< flag is wrong or not supported */
+ CV_StsBadPoint=               -207, /**< bad CvPoint */
+ CV_StsBadMask=                -208, /**< bad format of mask (neither 8uC1 nor 8sC1)*/
+ CV_StsUnmatchedSizes=         -209, /**< sizes of input/output structures do not match */
+ CV_StsUnsupportedFormat=      -210, /**< the data format/type is not supported by the function*/
+ CV_StsOutOfRange=             -211, /**< some of parameters are out of range */
+ CV_StsParseError=             -212, /**< invalid syntax/structure of the parsed file */
+ CV_StsNotImplemented=         -213, /**< the requested function/feature is not implemented */
+ CV_StsBadMemBlock=            -214, /**< an allocated block has been corrupted */
+ CV_StsAssert=                 -215, /**< assertion failed */
+ CV_GpuNotSupported=           -216,
+ CV_GpuApiCallError=           -217,
+ CV_OpenGlNotSupported=        -218,
+ CV_OpenGlApiCallError=        -219,
+ CV_OpenCLApiCallError=        -220,
+ CV_OpenCLDoubleNotSupported=  -221,
+ CV_OpenCLInitError=           -222,
+ CV_OpenCLNoAMDBlasFft=        -223
+};
+
+/****************************************************************************************\
+*                             Common macros and inline functions                         *
+\****************************************************************************************/
+
+#define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t))
+
+/** min & max without jumps */
+#define  CV_IMIN(a, b)  ((a) ^ (((a)^(b)) & (((a) < (b)) - 1)))
+
+#define  CV_IMAX(a, b)  ((a) ^ (((a)^(b)) & (((a) > (b)) - 1)))
+
+/** absolute value without jumps */
+#ifndef __cplusplus
+#  define  CV_IABS(a)     (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
+#else
+#  define  CV_IABS(a)     abs(a)
+#endif
+#define  CV_CMP(a,b)    (((a) > (b)) - ((a) < (b)))
+#define  CV_SIGN(a)     CV_CMP((a),0)
+
+#define cvInvSqrt(value) ((float)(1./sqrt(value)))
+#define cvSqrt(value)  ((float)sqrt(value))
+
+
+/*************** Random number generation *******************/
+
+typedef uint64 CvRNG;
+
+#define CV_RNG_COEFF 4164903690U
+
+/** @brief Initializes a random number generator state.
+
+The function initializes a random number generator and returns the state. The pointer to the state
+can be then passed to the cvRandInt, cvRandReal and cvRandArr functions. In the current
+implementation a multiply-with-carry generator is used.
+@param seed 64-bit value used to initiate a random sequence
+@sa the C++ class RNG replaced CvRNG.
+ */
+CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1))
+{
+    CvRNG rng = seed ? (uint64)seed : (uint64)(int64)-1;
+    return rng;
+}
+
+/** @brief Returns a 32-bit unsigned integer and updates RNG.
+
+The function returns a uniformly-distributed random 32-bit unsigned integer and updates the RNG
+state. It is similar to the rand() function from the C runtime library, except that OpenCV functions
+always generates a 32-bit random number, regardless of the platform.
+@param rng CvRNG state initialized by cvRNG.
+ */
+CV_INLINE unsigned cvRandInt( CvRNG* rng )
+{
+    uint64 temp = *rng;
+    temp = (uint64)(unsigned)temp*CV_RNG_COEFF + (temp >> 32);
+    *rng = temp;
+    return (unsigned)temp;
+}
+
+/** @brief Returns a floating-point random number and updates RNG.
+
+The function returns a uniformly-distributed random floating-point number between 0 and 1 (1 is not
+included).
+@param rng RNG state initialized by cvRNG
+ */
+CV_INLINE double cvRandReal( CvRNG* rng )
+{
+    return cvRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */;
+}
+
+/****************************************************************************************\
+*                                  Image type (IplImage)                                 *
+\****************************************************************************************/
+
+#ifndef HAVE_IPL
+
+/*
+ * The following definitions (until #endif)
+ * is an extract from IPL headers.
+ * Copyright (c) 1995 Intel Corporation.
+ */
+#define IPL_DEPTH_SIGN 0x80000000
+
+#define IPL_DEPTH_1U     1
+#define IPL_DEPTH_8U     8
+#define IPL_DEPTH_16U   16
+#define IPL_DEPTH_32F   32
+
+#define IPL_DEPTH_8S  (IPL_DEPTH_SIGN| 8)
+#define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16)
+#define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32)
+
+#define IPL_DATA_ORDER_PIXEL  0
+#define IPL_DATA_ORDER_PLANE  1
+
+#define IPL_ORIGIN_TL 0
+#define IPL_ORIGIN_BL 1
+
+#define IPL_ALIGN_4BYTES   4
+#define IPL_ALIGN_8BYTES   8
+#define IPL_ALIGN_16BYTES 16
+#define IPL_ALIGN_32BYTES 32
+
+#define IPL_ALIGN_DWORD   IPL_ALIGN_4BYTES
+#define IPL_ALIGN_QWORD   IPL_ALIGN_8BYTES
+
+#define IPL_BORDER_CONSTANT   0
+#define IPL_BORDER_REPLICATE  1
+#define IPL_BORDER_REFLECT    2
+#define IPL_BORDER_WRAP       3
+
+/** The IplImage is taken from the Intel Image Processing Library, in which the format is native. OpenCV
+only supports a subset of possible IplImage formats, as outlined in the parameter list above.
+
+In addition to the above restrictions, OpenCV handles ROIs differently. OpenCV functions require
+that the image size or ROI size of all source and destination images match exactly. On the other
+hand, the Intel Image Processing Library processes the area of intersection between the source and
+destination images (or ROIs), allowing them to vary independently.
+*/
+typedef struct
+#ifdef __cplusplus
+  CV_EXPORTS
+#endif
+_IplImage
+{
+    int  nSize;             /**< sizeof(IplImage) */
+    int  ID;                /**< version (=0)*/
+    int  nChannels;         /**< Most of OpenCV functions support 1,2,3 or 4 channels */
+    int  alphaChannel;      /**< Ignored by OpenCV */
+    int  depth;             /**< Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
+                               IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported.  */
+    char colorModel[4];     /**< Ignored by OpenCV */
+    char channelSeq[4];     /**< ditto */
+    int  dataOrder;         /**< 0 - interleaved color channels, 1 - separate color channels.
+                               cvCreateImage can only create interleaved images */
+    int  origin;            /**< 0 - top-left origin,
+                               1 - bottom-left origin (Windows bitmaps style).  */
+    int  align;             /**< Alignment of image rows (4 or 8).
+                               OpenCV ignores it and uses widthStep instead.    */
+    int  width;             /**< Image width in pixels.                           */
+    int  height;            /**< Image height in pixels.                          */
+    struct _IplROI *roi;    /**< Image ROI. If NULL, the whole image is selected. */
+    struct _IplImage *maskROI;      /**< Must be NULL. */
+    void  *imageId;                 /**< "           " */
+    struct _IplTileInfo *tileInfo;  /**< "           " */
+    int  imageSize;         /**< Image data size in bytes
+                               (==image->height*image->widthStep
+                               in case of interleaved data)*/
+    char *imageData;        /**< Pointer to aligned image data.         */
+    int  widthStep;         /**< Size of aligned image row in bytes.    */
+    int  BorderMode[4];     /**< Ignored by OpenCV.                     */
+    int  BorderConst[4];    /**< Ditto.                                 */
+    char *imageDataOrigin;  /**< Pointer to very origin of image data
+                               (not necessarily aligned) -
+                               needed for correct deallocation */
+
+#ifdef __cplusplus
+    _IplImage() {}
+    _IplImage(const cv::Mat& m);
+#endif
+}
+IplImage;
+
+typedef struct _IplTileInfo IplTileInfo;
+
+typedef struct _IplROI
+{
+    int  coi; /**< 0 - no COI (all channels are selected), 1 - 0th channel is selected ...*/
+    int  xOffset;
+    int  yOffset;
+    int  width;
+    int  height;
+}
+IplROI;
+
+typedef struct _IplConvKernel
+{
+    int  nCols;
+    int  nRows;
+    int  anchorX;
+    int  anchorY;
+    int *values;
+    int  nShiftR;
+}
+IplConvKernel;
+
+typedef struct _IplConvKernelFP
+{
+    int  nCols;
+    int  nRows;
+    int  anchorX;
+    int  anchorY;
+    float *values;
+}
+IplConvKernelFP;
+
+#define IPL_IMAGE_HEADER 1
+#define IPL_IMAGE_DATA   2
+#define IPL_IMAGE_ROI    4
+
+#endif/*HAVE_IPL*/
+
+/** extra border mode */
+#define IPL_BORDER_REFLECT_101    4
+#define IPL_BORDER_TRANSPARENT    5
+
+#define IPL_IMAGE_MAGIC_VAL  ((int)sizeof(IplImage))
+#define CV_TYPE_NAME_IMAGE "opencv-image"
+
+#define CV_IS_IMAGE_HDR(img) \
+    ((img) != NULL && ((const IplImage*)(img))->nSize == sizeof(IplImage))
+
+#define CV_IS_IMAGE(img) \
+    (CV_IS_IMAGE_HDR(img) && ((IplImage*)img)->imageData != NULL)
+
+/** for storing double-precision
+   floating point data in IplImage's */
+#define IPL_DEPTH_64F  64
+
+/** get reference to pixel at (col,row),
+   for multi-channel images (col) should be multiplied by number of channels */
+#define CV_IMAGE_ELEM( image, elemtype, row, col )       \
+    (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)])
+
+/****************************************************************************************\
+*                                  Matrix type (CvMat)                                   *
+\****************************************************************************************/
+
+#define CV_AUTO_STEP  0x7fffffff
+#define CV_WHOLE_ARR  cvSlice( 0, 0x3fffffff )
+
+#define CV_MAGIC_MASK       0xFFFF0000
+#define CV_MAT_MAGIC_VAL    0x42420000
+#define CV_TYPE_NAME_MAT    "opencv-matrix"
+
+/** Matrix elements are stored row by row. Element (i, j) (i - 0-based row index, j - 0-based column
+index) of a matrix can be retrieved or modified using CV_MAT_ELEM macro:
+
+    uchar pixval = CV_MAT_ELEM(grayimg, uchar, i, j)
+    CV_MAT_ELEM(cameraMatrix, float, 0, 2) = image.width*0.5f;
+
+To access multiple-channel matrices, you can use
+CV_MAT_ELEM(matrix, type, i, j\*nchannels + channel_idx).
+
+@deprecated CvMat is now obsolete; consider using Mat instead.
+ */
+typedef struct CvMat
+{
+    int type;
+    int step;
+
+    /* for internal use only */
+    int* refcount;
+    int hdr_refcount;
+
+    union
+    {
+        uchar* ptr;
+        short* s;
+        int* i;
+        float* fl;
+        double* db;
+    } data;
+
+#ifdef __cplusplus
+    union
+    {
+        int rows;
+        int height;
+    };
+
+    union
+    {
+        int cols;
+        int width;
+    };
+#else
+    int rows;
+    int cols;
+#endif
+
+
+#ifdef __cplusplus
+    CvMat() {}
+    CvMat(const CvMat& m) { memcpy(this, &m, sizeof(CvMat));}
+    CvMat(const cv::Mat& m);
+#endif
+
+}
+CvMat;
+
+
+#define CV_IS_MAT_HDR(mat) \
+    ((mat) != NULL && \
+    (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
+    ((const CvMat*)(mat))->cols > 0 && ((const CvMat*)(mat))->rows > 0)
+
+#define CV_IS_MAT_HDR_Z(mat) \
+    ((mat) != NULL && \
+    (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
+    ((const CvMat*)(mat))->cols >= 0 && ((const CvMat*)(mat))->rows >= 0)
+
+#define CV_IS_MAT(mat) \
+    (CV_IS_MAT_HDR(mat) && ((const CvMat*)(mat))->data.ptr != NULL)
+
+#define CV_IS_MASK_ARR(mat) \
+    (((mat)->type & (CV_MAT_TYPE_MASK & ~CV_8SC1)) == 0)
+
+#define CV_ARE_TYPES_EQ(mat1, mat2) \
+    ((((mat1)->type ^ (mat2)->type) & CV_MAT_TYPE_MASK) == 0)
+
+#define CV_ARE_CNS_EQ(mat1, mat2) \
+    ((((mat1)->type ^ (mat2)->type) & CV_MAT_CN_MASK) == 0)
+
+#define CV_ARE_DEPTHS_EQ(mat1, mat2) \
+    ((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0)
+
+#define CV_ARE_SIZES_EQ(mat1, mat2) \
+    ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols)
+
+#define CV_IS_MAT_CONST(mat)  \
+    (((mat)->rows|(mat)->cols) == 1)
+
+#define IPL2CV_DEPTH(depth) \
+    ((((CV_8U)+(CV_16U<<4)+(CV_32F<<8)+(CV_64F<<16)+(CV_8S<<20)+ \
+    (CV_16S<<24)+(CV_32S<<28)) >> ((((depth) & 0xF0) >> 2) + \
+    (((depth) & IPL_DEPTH_SIGN) ? 20 : 0))) & 15)
+
+/** Inline constructor. No data is allocated internally!!!
+ * (Use together with cvCreateData, or use cvCreateMat instead to
+ * get a matrix with allocated data):
+ */
+CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL))
+{
+    CvMat m;
+
+    assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F );
+    type = CV_MAT_TYPE(type);
+    m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type;
+    m.cols = cols;
+    m.rows = rows;
+    m.step = m.cols*CV_ELEM_SIZE(type);
+    m.data.ptr = (uchar*)data;
+    m.refcount = NULL;
+    m.hdr_refcount = 0;
+
+    return m;
+}
+
+#ifdef __cplusplus
+inline CvMat::CvMat(const cv::Mat& m)
+{
+    CV_DbgAssert(m.dims <= 2);
+    *this = cvMat(m.rows, m.dims == 1 ? 1 : m.cols, m.type(), m.data);
+    step = (int)m.step[0];
+    type = (type & ~cv::Mat::CONTINUOUS_FLAG) | (m.flags & cv::Mat::CONTINUOUS_FLAG);
+}
+#endif
+
+
+#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size )  \
+    (assert( (unsigned)(row) < (unsigned)(mat).rows &&   \
+             (unsigned)(col) < (unsigned)(mat).cols ),   \
+     (mat).data.ptr + (size_t)(mat).step*(row) + (pix_size)*(col))
+
+#define CV_MAT_ELEM_PTR( mat, row, col )                 \
+    CV_MAT_ELEM_PTR_FAST( mat, row, col, CV_ELEM_SIZE((mat).type) )
+
+#define CV_MAT_ELEM( mat, elemtype, row, col )           \
+    (*(elemtype*)CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype)))
+
+/** @brief Returns the particular element of single-channel floating-point matrix.
+
+The function is a fast replacement for cvGetReal2D in the case of single-channel floating-point
+matrices. It is faster because it is inline, it does fewer checks for array type and array element
+type, and it checks for the row and column ranges only in debug mode.
+@param mat Input matrix
+@param row The zero-based index of row
+@param col The zero-based index of column
+ */
+CV_INLINE  double  cvmGet( const CvMat* mat, int row, int col )
+{
+    int type;
+
+    type = CV_MAT_TYPE(mat->type);
+    assert( (unsigned)row < (unsigned)mat->rows &&
+            (unsigned)col < (unsigned)mat->cols );
+
+    if( type == CV_32FC1 )
+        return ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col];
+    else
+    {
+        assert( type == CV_64FC1 );
+        return ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col];
+    }
+}
+
+/** @brief Sets a specific element of a single-channel floating-point matrix.
+
+The function is a fast replacement for cvSetReal2D in the case of single-channel floating-point
+matrices. It is faster because it is inline, it does fewer checks for array type and array element
+type, and it checks for the row and column ranges only in debug mode.
+@param mat The matrix
+@param row The zero-based index of row
+@param col The zero-based index of column
+@param value The new value of the matrix element
+ */
+CV_INLINE  void  cvmSet( CvMat* mat, int row, int col, double value )
+{
+    int type;
+    type = CV_MAT_TYPE(mat->type);
+    assert( (unsigned)row < (unsigned)mat->rows &&
+            (unsigned)col < (unsigned)mat->cols );
+
+    if( type == CV_32FC1 )
+        ((float*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = (float)value;
+    else
+    {
+        assert( type == CV_64FC1 );
+        ((double*)(void*)(mat->data.ptr + (size_t)mat->step*row))[col] = value;
+    }
+}
+
+
+CV_INLINE int cvIplDepth( int type )
+{
+    int depth = CV_MAT_DEPTH(type);
+    return CV_ELEM_SIZE1(depth)*8 | (depth == CV_8S || depth == CV_16S ||
+           depth == CV_32S ? IPL_DEPTH_SIGN : 0);
+}
+
+
+/****************************************************************************************\
+*                       Multi-dimensional dense array (CvMatND)                          *
+\****************************************************************************************/
+
+#define CV_MATND_MAGIC_VAL    0x42430000
+#define CV_TYPE_NAME_MATND    "opencv-nd-matrix"
+
+#define CV_MAX_DIM            32
+#define CV_MAX_DIM_HEAP       1024
+
+/**
+  @deprecated consider using cv::Mat instead
+  */
+typedef struct
+#ifdef __cplusplus
+  CV_EXPORTS
+#endif
+CvMatND
+{
+    int type;
+    int dims;
+
+    int* refcount;
+    int hdr_refcount;
+
+    union
+    {
+        uchar* ptr;
+        float* fl;
+        double* db;
+        int* i;
+        short* s;
+    } data;
+
+    struct
+    {
+        int size;
+        int step;
+    }
+    dim[CV_MAX_DIM];
+
+#ifdef __cplusplus
+    CvMatND() {}
+    CvMatND(const cv::Mat& m);
+#endif
+}
+CvMatND;
+
+#define CV_IS_MATND_HDR(mat) \
+    ((mat) != NULL && (((const CvMatND*)(mat))->type & CV_MAGIC_MASK) == CV_MATND_MAGIC_VAL)
+
+#define CV_IS_MATND(mat) \
+    (CV_IS_MATND_HDR(mat) && ((const CvMatND*)(mat))->data.ptr != NULL)
+
+
+/****************************************************************************************\
+*                      Multi-dimensional sparse array (CvSparseMat)                      *
+\****************************************************************************************/
+
+#define CV_SPARSE_MAT_MAGIC_VAL    0x42440000
+#define CV_TYPE_NAME_SPARSE_MAT    "opencv-sparse-matrix"
+
+struct CvSet;
+
+typedef struct
+#ifdef __cplusplus
+  CV_EXPORTS
+#endif
+CvSparseMat
+{
+    int type;
+    int dims;
+    int* refcount;
+    int hdr_refcount;
+
+    struct CvSet* heap;
+    void** hashtable;
+    int hashsize;
+    int valoffset;
+    int idxoffset;
+    int size[CV_MAX_DIM];
+
+#ifdef __cplusplus
+    void copyToSparseMat(cv::SparseMat& m) const;
+#endif
+}
+CvSparseMat;
+
+#ifdef __cplusplus
+    CV_EXPORTS CvSparseMat* cvCreateSparseMat(const cv::SparseMat& m);
+#endif
+
+#define CV_IS_SPARSE_MAT_HDR(mat) \
+    ((mat) != NULL && \
+    (((const CvSparseMat*)(mat))->type & CV_MAGIC_MASK) == CV_SPARSE_MAT_MAGIC_VAL)
+
+#define CV_IS_SPARSE_MAT(mat) \
+    CV_IS_SPARSE_MAT_HDR(mat)
+
+/**************** iteration through a sparse array *****************/
+
+typedef struct CvSparseNode
+{
+    unsigned hashval;
+    struct CvSparseNode* next;
+}
+CvSparseNode;
+
+typedef struct CvSparseMatIterator
+{
+    CvSparseMat* mat;
+    CvSparseNode* node;
+    int curidx;
+}
+CvSparseMatIterator;
+
+#define CV_NODE_VAL(mat,node)   ((void*)((uchar*)(node) + (mat)->valoffset))
+#define CV_NODE_IDX(mat,node)   ((int*)((uchar*)(node) + (mat)->idxoffset))
+
+/****************************************************************************************\
+*                                         Histogram                                      *
+\****************************************************************************************/
+
+typedef int CvHistType;
+
+#define CV_HIST_MAGIC_VAL     0x42450000
+#define CV_HIST_UNIFORM_FLAG  (1 << 10)
+
+/** indicates whether bin ranges are set already or not */
+#define CV_HIST_RANGES_FLAG   (1 << 11)
+
+#define CV_HIST_ARRAY         0
+#define CV_HIST_SPARSE        1
+#define CV_HIST_TREE          CV_HIST_SPARSE
+
+/** should be used as a parameter only,
+   it turns to CV_HIST_UNIFORM_FLAG of hist->type */
+#define CV_HIST_UNIFORM       1
+
+typedef struct CvHistogram
+{
+    int     type;
+    CvArr*  bins;
+    float   thresh[CV_MAX_DIM][2];  /**< For uniform histograms.                      */
+    float** thresh2;                /**< For non-uniform histograms.                  */
+    CvMatND mat;                    /**< Embedded matrix header for array histograms. */
+}
+CvHistogram;
+
+#define CV_IS_HIST( hist ) \
+    ((hist) != NULL  && \
+     (((CvHistogram*)(hist))->type & CV_MAGIC_MASK) == CV_HIST_MAGIC_VAL && \
+     (hist)->bins != NULL)
+
+#define CV_IS_UNIFORM_HIST( hist ) \
+    (((hist)->type & CV_HIST_UNIFORM_FLAG) != 0)
+
+#define CV_IS_SPARSE_HIST( hist ) \
+    CV_IS_SPARSE_MAT((hist)->bins)
+
+#define CV_HIST_HAS_RANGES( hist ) \
+    (((hist)->type & CV_HIST_RANGES_FLAG) != 0)
+
+/****************************************************************************************\
+*                      Other supplementary data type definitions                         *
+\****************************************************************************************/
+
+/*************************************** CvRect *****************************************/
+/** @sa Rect_ */
+typedef struct CvRect
+{
+    int x;
+    int y;
+    int width;
+    int height;
+
+#ifdef __cplusplus
+    CvRect(int _x = 0, int _y = 0, int w = 0, int h = 0): x(_x), y(_y), width(w), height(h) {}
+    template<typename _Tp>
+    CvRect(const cv::Rect_<_Tp>& r): x(cv::saturate_cast<int>(r.x)), y(cv::saturate_cast<int>(r.y)), width(cv::saturate_cast<int>(r.width)), height(cv::saturate_cast<int>(r.height)) {}
+    template<typename _Tp>
+    operator cv::Rect_<_Tp>() const { return cv::Rect_<_Tp>((_Tp)x, (_Tp)y, (_Tp)width, (_Tp)height); }
+#endif
+}
+CvRect;
+
+/** constructs CvRect structure. */
+CV_INLINE  CvRect  cvRect( int x, int y, int width, int height )
+{
+    CvRect r;
+
+    r.x = x;
+    r.y = y;
+    r.width = width;
+    r.height = height;
+
+    return r;
+}
+
+
+CV_INLINE  IplROI  cvRectToROI( CvRect rect, int coi )
+{
+    IplROI roi;
+    roi.xOffset = rect.x;
+    roi.yOffset = rect.y;
+    roi.width = rect.width;
+    roi.height = rect.height;
+    roi.coi = coi;
+
+    return roi;
+}
+
+
+CV_INLINE  CvRect  cvROIToRect( IplROI roi )
+{
+    return cvRect( roi.xOffset, roi.yOffset, roi.width, roi.height );
+}
+
+/*********************************** CvTermCriteria *************************************/
+
+#define CV_TERMCRIT_ITER    1
+#define CV_TERMCRIT_NUMBER  CV_TERMCRIT_ITER
+#define CV_TERMCRIT_EPS     2
+
+/** @sa TermCriteria
+ */
+typedef struct CvTermCriteria
+{
+    int    type;  /**< may be combination of
+                     CV_TERMCRIT_ITER
+                     CV_TERMCRIT_EPS */
+    int    max_iter;
+    double epsilon;
+
+#ifdef __cplusplus
+    CvTermCriteria(int _type = 0, int _iter = 0, double _eps = 0) : type(_type), max_iter(_iter), epsilon(_eps)  {}
+    CvTermCriteria(const cv::TermCriteria& t) : type(t.type), max_iter(t.maxCount), epsilon(t.epsilon)  {}
+    operator cv::TermCriteria() const { return cv::TermCriteria(type, max_iter, epsilon); }
+#endif
+
+}
+CvTermCriteria;
+
+CV_INLINE  CvTermCriteria  cvTermCriteria( int type, int max_iter, double epsilon )
+{
+    CvTermCriteria t;
+
+    t.type = type;
+    t.max_iter = max_iter;
+    t.epsilon = (float)epsilon;
+
+    return t;
+}
+
+
+/******************************* CvPoint and variants ***********************************/
+
+typedef struct CvPoint
+{
+    int x;
+    int y;
+
+#ifdef __cplusplus
+    CvPoint(int _x = 0, int _y = 0): x(_x), y(_y) {}
+    template<typename _Tp>
+    CvPoint(const cv::Point_<_Tp>& pt): x((int)pt.x), y((int)pt.y) {}
+    template<typename _Tp>
+    operator cv::Point_<_Tp>() const { return cv::Point_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y)); }
+#endif
+}
+CvPoint;
+
+/** constructs CvPoint structure. */
+CV_INLINE  CvPoint  cvPoint( int x, int y )
+{
+    CvPoint p;
+
+    p.x = x;
+    p.y = y;
+
+    return p;
+}
+
+
+typedef struct CvPoint2D32f
+{
+    float x;
+    float y;
+
+#ifdef __cplusplus
+    CvPoint2D32f(float _x = 0, float _y = 0): x(_x), y(_y) {}
+    template<typename _Tp>
+    CvPoint2D32f(const cv::Point_<_Tp>& pt): x((float)pt.x), y((float)pt.y) {}
+    template<typename _Tp>
+    operator cv::Point_<_Tp>() const { return cv::Point_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y)); }
+#endif
+}
+CvPoint2D32f;
+
+/** constructs CvPoint2D32f structure. */
+CV_INLINE  CvPoint2D32f  cvPoint2D32f( double x, double y )
+{
+    CvPoint2D32f p;
+
+    p.x = (float)x;
+    p.y = (float)y;
+
+    return p;
+}
+
+/** converts CvPoint to CvPoint2D32f. */
+CV_INLINE  CvPoint2D32f  cvPointTo32f( CvPoint point )
+{
+    return cvPoint2D32f( (float)point.x, (float)point.y );
+}
+
+/** converts CvPoint2D32f to CvPoint. */
+CV_INLINE  CvPoint  cvPointFrom32f( CvPoint2D32f point )
+{
+    CvPoint ipt;
+    ipt.x = cvRound(point.x);
+    ipt.y = cvRound(point.y);
+
+    return ipt;
+}
+
+
+typedef struct CvPoint3D32f
+{
+    float x;
+    float y;
+    float z;
+
+#ifdef __cplusplus
+    CvPoint3D32f(float _x = 0, float _y = 0, float _z = 0): x(_x), y(_y), z(_z) {}
+    template<typename _Tp>
+    CvPoint3D32f(const cv::Point3_<_Tp>& pt): x((float)pt.x), y((float)pt.y), z((float)pt.z) {}
+    template<typename _Tp>
+    operator cv::Point3_<_Tp>() const { return cv::Point3_<_Tp>(cv::saturate_cast<_Tp>(x), cv::saturate_cast<_Tp>(y), cv::saturate_cast<_Tp>(z)); }
+#endif
+}
+CvPoint3D32f;
+
+/** constructs CvPoint3D32f structure. */
+CV_INLINE  CvPoint3D32f  cvPoint3D32f( double x, double y, double z )
+{
+    CvPoint3D32f p;
+
+    p.x = (float)x;
+    p.y = (float)y;
+    p.z = (float)z;
+
+    return p;
+}
+
+
+typedef struct CvPoint2D64f
+{
+    double x;
+    double y;
+}
+CvPoint2D64f;
+
+/** constructs CvPoint2D64f structure.*/
+CV_INLINE  CvPoint2D64f  cvPoint2D64f( double x, double y )
+{
+    CvPoint2D64f p;
+
+    p.x = x;
+    p.y = y;
+
+    return p;
+}
+
+
+typedef struct CvPoint3D64f
+{
+    double x;
+    double y;
+    double z;
+}
+CvPoint3D64f;
+
+/** constructs CvPoint3D64f structure. */
+CV_INLINE  CvPoint3D64f  cvPoint3D64f( double x, double y, double z )
+{
+    CvPoint3D64f p;
+
+    p.x = x;
+    p.y = y;
+    p.z = z;
+
+    return p;
+}
+
+
+/******************************** CvSize's & CvBox **************************************/
+
+typedef struct CvSize
+{
+    int width;
+    int height;
+
+#ifdef __cplusplus
+    CvSize(int w = 0, int h = 0): width(w), height(h) {}
+    template<typename _Tp>
+    CvSize(const cv::Size_<_Tp>& sz): width(cv::saturate_cast<int>(sz.width)), height(cv::saturate_cast<int>(sz.height)) {}
+    template<typename _Tp>
+    operator cv::Size_<_Tp>() const { return cv::Size_<_Tp>(cv::saturate_cast<_Tp>(width), cv::saturate_cast<_Tp>(height)); }
+#endif
+}
+CvSize;
+
+/** constructs CvSize structure. */
+CV_INLINE  CvSize  cvSize( int width, int height )
+{
+    CvSize s;
+
+    s.width = width;
+    s.height = height;
+
+    return s;
+}
+
+typedef struct CvSize2D32f
+{
+    float width;
+    float height;
+
+#ifdef __cplusplus
+    CvSize2D32f(float w = 0, float h = 0): width(w), height(h) {}
+    template<typename _Tp>
+    CvSize2D32f(const cv::Size_<_Tp>& sz): width(cv::saturate_cast<float>(sz.width)), height(cv::saturate_cast<float>(sz.height)) {}
+    template<typename _Tp>
+    operator cv::Size_<_Tp>() const { return cv::Size_<_Tp>(cv::saturate_cast<_Tp>(width), cv::saturate_cast<_Tp>(height)); }
+#endif
+}
+CvSize2D32f;
+
+/** constructs CvSize2D32f structure. */
+CV_INLINE  CvSize2D32f  cvSize2D32f( double width, double height )
+{
+    CvSize2D32f s;
+
+    s.width = (float)width;
+    s.height = (float)height;
+
+    return s;
+}
+
+/** @sa RotatedRect
+ */
+typedef struct CvBox2D
+{
+    CvPoint2D32f center;  /**< Center of the box.                          */
+    CvSize2D32f  size;    /**< Box width and length.                       */
+    float angle;          /**< Angle between the horizontal axis           */
+                          /**< and the first side (i.e. length) in degrees */
+
+#ifdef __cplusplus
+    CvBox2D(CvPoint2D32f c = CvPoint2D32f(), CvSize2D32f s = CvSize2D32f(), float a = 0) : center(c), size(s), angle(a) {}
+    CvBox2D(const cv::RotatedRect& rr) : center(rr.center), size(rr.size), angle(rr.angle) {}
+    operator cv::RotatedRect() const { return cv::RotatedRect(center, size, angle); }
+#endif
+}
+CvBox2D;
+
+
+/** Line iterator state: */
+typedef struct CvLineIterator
+{
+    /** Pointer to the current point: */
+    uchar* ptr;
+
+    /* Bresenham algorithm state: */
+    int  err;
+    int  plus_delta;
+    int  minus_delta;
+    int  plus_step;
+    int  minus_step;
+}
+CvLineIterator;
+
+
+
+/************************************* CvSlice ******************************************/
+#define CV_WHOLE_SEQ_END_INDEX 0x3fffffff
+#define CV_WHOLE_SEQ  cvSlice(0, CV_WHOLE_SEQ_END_INDEX)
+
+typedef struct CvSlice
+{
+    int  start_index, end_index;
+
+#if defined(__cplusplus) && !defined(__CUDACC__)
+    CvSlice(int start = 0, int end = 0) : start_index(start), end_index(end) {}
+    CvSlice(const cv::Range& r) { *this = (r.start != INT_MIN && r.end != INT_MAX) ? CvSlice(r.start, r.end) : CvSlice(0, CV_WHOLE_SEQ_END_INDEX); }
+    operator cv::Range() const { return (start_index == 0 && end_index == CV_WHOLE_SEQ_END_INDEX ) ? cv::Range::all() : cv::Range(start_index, end_index); }
+#endif
+}
+CvSlice;
+
+CV_INLINE  CvSlice  cvSlice( int start, int end )
+{
+    CvSlice slice;
+    slice.start_index = start;
+    slice.end_index = end;
+
+    return slice;
+}
+
+
+
+/************************************* CvScalar *****************************************/
+/** @sa Scalar_
+ */
+typedef struct CvScalar
+{
+    double val[4];
+
+#ifdef __cplusplus
+    CvScalar() {}
+    CvScalar(double d0, double d1 = 0, double d2 = 0, double d3 = 0) { val[0] = d0; val[1] = d1; val[2] = d2; val[3] = d3; }
+    template<typename _Tp>
+    CvScalar(const cv::Scalar_<_Tp>& s) { val[0] = s.val[0]; val[1] = s.val[1]; val[2] = s.val[2]; val[3] = s.val[3]; }
+    template<typename _Tp>
+    operator cv::Scalar_<_Tp>() const { return cv::Scalar_<_Tp>(cv::saturate_cast<_Tp>(val[0]), cv::saturate_cast<_Tp>(val[1]), cv::saturate_cast<_Tp>(val[2]), cv::saturate_cast<_Tp>(val[3])); }
+    template<typename _Tp, int cn>
+    CvScalar(const cv::Vec<_Tp, cn>& v)
+    {
+        int i;
+        for( i = 0; i < (cn < 4 ? cn : 4); i++ ) val[i] = v.val[i];
+        for( ; i < 4; i++ ) val[i] = 0;
+    }
+#endif
+}
+CvScalar;
+
+CV_INLINE  CvScalar  cvScalar( double val0, double val1 CV_DEFAULT(0),
+                               double val2 CV_DEFAULT(0), double val3 CV_DEFAULT(0))
+{
+    CvScalar scalar;
+    scalar.val[0] = val0; scalar.val[1] = val1;
+    scalar.val[2] = val2; scalar.val[3] = val3;
+    return scalar;
+}
+
+
+CV_INLINE  CvScalar  cvRealScalar( double val0 )
+{
+    CvScalar scalar;
+    scalar.val[0] = val0;
+    scalar.val[1] = scalar.val[2] = scalar.val[3] = 0;
+    return scalar;
+}
+
+CV_INLINE  CvScalar  cvScalarAll( double val0123 )
+{
+    CvScalar scalar;
+    scalar.val[0] = val0123;
+    scalar.val[1] = val0123;
+    scalar.val[2] = val0123;
+    scalar.val[3] = val0123;
+    return scalar;
+}
+
+/****************************************************************************************\
+*                                   Dynamic Data structures                              *
+\****************************************************************************************/
+
+/******************************** Memory storage ****************************************/
+
+typedef struct CvMemBlock
+{
+    struct CvMemBlock*  prev;
+    struct CvMemBlock*  next;
+}
+CvMemBlock;
+
+#define CV_STORAGE_MAGIC_VAL    0x42890000
+
+typedef struct CvMemStorage
+{
+    int signature;
+    CvMemBlock* bottom;           /**< First allocated block.                   */
+    CvMemBlock* top;              /**< Current memory block - top of the stack. */
+    struct  CvMemStorage* parent; /**< We get new blocks from parent as needed. */
+    int block_size;               /**< Block size.                              */
+    int free_space;               /**< Remaining free space in current block.   */
+}
+CvMemStorage;
+
+#define CV_IS_STORAGE(storage)  \
+    ((storage) != NULL &&       \
+    (((CvMemStorage*)(storage))->signature & CV_MAGIC_MASK) == CV_STORAGE_MAGIC_VAL)
+
+
+typedef struct CvMemStoragePos
+{
+    CvMemBlock* top;
+    int free_space;
+}
+CvMemStoragePos;
+
+
+/*********************************** Sequence *******************************************/
+
+typedef struct CvSeqBlock
+{
+    struct CvSeqBlock*  prev; /**< Previous sequence block.                   */
+    struct CvSeqBlock*  next; /**< Next sequence block.                       */
+  int    start_index;         /**< Index of the first element in the block +  */
+                              /**< sequence->first->start_index.              */
+    int    count;             /**< Number of elements in the block.           */
+    schar* data;              /**< Pointer to the first element of the block. */
+}
+CvSeqBlock;
+
+
+#define CV_TREE_NODE_FIELDS(node_type)                               \
+    int       flags;             /**< Miscellaneous flags.     */      \
+    int       header_size;       /**< Size of sequence header. */      \
+    struct    node_type* h_prev; /**< Previous sequence.       */      \
+    struct    node_type* h_next; /**< Next sequence.           */      \
+    struct    node_type* v_prev; /**< 2nd previous sequence.   */      \
+    struct    node_type* v_next  /**< 2nd next sequence.       */
+
+/**
+   Read/Write sequence.
+   Elements can be dynamically inserted to or deleted from the sequence.
+*/
+#define CV_SEQUENCE_FIELDS()                                              \
+    CV_TREE_NODE_FIELDS(CvSeq);                                           \
+    int       total;          /**< Total number of elements.            */  \
+    int       elem_size;      /**< Size of sequence element in bytes.   */  \
+    schar*    block_max;      /**< Maximal bound of the last block.     */  \
+    schar*    ptr;            /**< Current write pointer.               */  \
+    int       delta_elems;    /**< Grow seq this many at a time.        */  \
+    CvMemStorage* storage;    /**< Where the seq is stored.             */  \
+    CvSeqBlock* free_blocks;  /**< Free blocks list.                    */  \
+    CvSeqBlock* first;        /**< Pointer to the first sequence block. */
+
+typedef struct CvSeq
+{
+    CV_SEQUENCE_FIELDS()
+}
+CvSeq;
+
+#define CV_TYPE_NAME_SEQ             "opencv-sequence"
+#define CV_TYPE_NAME_SEQ_TREE        "opencv-sequence-tree"
+
+/*************************************** Set ********************************************/
+/** @brief Set
+  Order is not preserved. There can be gaps between sequence elements.
+  After the element has been inserted it stays in the same place all the time.
+  The MSB(most-significant or sign bit) of the first field (flags) is 0 iff the element exists.
+*/
+#define CV_SET_ELEM_FIELDS(elem_type)   \
+    int  flags;                         \
+    struct elem_type* next_free;
+
+typedef struct CvSetElem
+{
+    CV_SET_ELEM_FIELDS(CvSetElem)
+}
+CvSetElem;
+
+#define CV_SET_FIELDS()      \
+    CV_SEQUENCE_FIELDS()     \
+    CvSetElem* free_elems;   \
+    int active_count;
+
+typedef struct CvSet
+{
+    CV_SET_FIELDS()
+}
+CvSet;
+
+
+#define CV_SET_ELEM_IDX_MASK   ((1 << 26) - 1)
+#define CV_SET_ELEM_FREE_FLAG  (1 << (sizeof(int)*8-1))
+
+/** Checks whether the element pointed by ptr belongs to a set or not */
+#define CV_IS_SET_ELEM( ptr )  (((CvSetElem*)(ptr))->flags >= 0)
+
+/************************************* Graph ********************************************/
+
+/** @name Graph
+
+We represent a graph as a set of vertices. Vertices contain their adjacency lists (more exactly,
+pointers to first incoming or outcoming edge (or 0 if isolated vertex)). Edges are stored in
+another set. There is a singly-linked list of incoming/outcoming edges for each vertex.
+
+Each edge consists of:
+
+- Two pointers to the starting and ending vertices (vtx[0] and vtx[1] respectively).
+
+    A graph may be oriented or not. In the latter case, edges between vertex i to vertex j are not
+distinguished during search operations.
+
+- Two pointers to next edges for the starting and ending vertices, where next[0] points to the
+next edge in the vtx[0] adjacency list and next[1] points to the next edge in the vtx[1]
+adjacency list.
+
+@see CvGraphEdge, CvGraphVtx, CvGraphVtx2D, CvGraph
+@{
+*/
+#define CV_GRAPH_EDGE_FIELDS()      \
+    int flags;                      \
+    float weight;                   \
+    struct CvGraphEdge* next[2];    \
+    struct CvGraphVtx* vtx[2];
+
+
+#define CV_GRAPH_VERTEX_FIELDS()    \
+    int flags;                      \
+    struct CvGraphEdge* first;
+
+
+typedef struct CvGraphEdge
+{
+    CV_GRAPH_EDGE_FIELDS()
+}
+CvGraphEdge;
+
+typedef struct CvGraphVtx
+{
+    CV_GRAPH_VERTEX_FIELDS()
+}
+CvGraphVtx;
+
+typedef struct CvGraphVtx2D
+{
+    CV_GRAPH_VERTEX_FIELDS()
+    CvPoint2D32f* ptr;
+}
+CvGraphVtx2D;
+
+/**
+   Graph is "derived" from the set (this is set a of vertices)
+   and includes another set (edges)
+*/
+#define  CV_GRAPH_FIELDS()   \
+    CV_SET_FIELDS()          \
+    CvSet* edges;
+
+typedef struct CvGraph
+{
+    CV_GRAPH_FIELDS()
+}
+CvGraph;
+
+#define CV_TYPE_NAME_GRAPH "opencv-graph"
+
+/** @} */
+
+/*********************************** Chain/Countour *************************************/
+
+typedef struct CvChain
+{
+    CV_SEQUENCE_FIELDS()
+    CvPoint  origin;
+}
+CvChain;
+
+#define CV_CONTOUR_FIELDS()  \
+    CV_SEQUENCE_FIELDS()     \
+    CvRect rect;             \
+    int color;               \
+    int reserved[3];
+
+typedef struct CvContour
+{
+    CV_CONTOUR_FIELDS()
+}
+CvContour;
+
+typedef CvContour CvPoint2DSeq;
+
+/****************************************************************************************\
+*                                    Sequence types                                      *
+\****************************************************************************************/
+
+#define CV_SEQ_MAGIC_VAL             0x42990000
+
+#define CV_IS_SEQ(seq) \
+    ((seq) != NULL && (((CvSeq*)(seq))->flags & CV_MAGIC_MASK) == CV_SEQ_MAGIC_VAL)
+
+#define CV_SET_MAGIC_VAL             0x42980000
+#define CV_IS_SET(set) \
+    ((set) != NULL && (((CvSeq*)(set))->flags & CV_MAGIC_MASK) == CV_SET_MAGIC_VAL)
+
+#define CV_SEQ_ELTYPE_BITS           12
+#define CV_SEQ_ELTYPE_MASK           ((1 << CV_SEQ_ELTYPE_BITS) - 1)
+
+#define CV_SEQ_ELTYPE_POINT          CV_32SC2  /**< (x,y) */
+#define CV_SEQ_ELTYPE_CODE           CV_8UC1   /**< freeman code: 0..7 */
+#define CV_SEQ_ELTYPE_GENERIC        0
+#define CV_SEQ_ELTYPE_PTR            CV_USRTYPE1
+#define CV_SEQ_ELTYPE_PPOINT         CV_SEQ_ELTYPE_PTR  /**< &(x,y) */
+#define CV_SEQ_ELTYPE_INDEX          CV_32SC1  /**< #(x,y) */
+#define CV_SEQ_ELTYPE_GRAPH_EDGE     0  /**< &next_o, &next_d, &vtx_o, &vtx_d */
+#define CV_SEQ_ELTYPE_GRAPH_VERTEX   0  /**< first_edge, &(x,y) */
+#define CV_SEQ_ELTYPE_TRIAN_ATR      0  /**< vertex of the binary tree   */
+#define CV_SEQ_ELTYPE_CONNECTED_COMP 0  /**< connected component  */
+#define CV_SEQ_ELTYPE_POINT3D        CV_32FC3  /**< (x,y,z)  */
+
+#define CV_SEQ_KIND_BITS        2
+#define CV_SEQ_KIND_MASK        (((1 << CV_SEQ_KIND_BITS) - 1)<<CV_SEQ_ELTYPE_BITS)
+
+/** types of sequences */
+#define CV_SEQ_KIND_GENERIC     (0 << CV_SEQ_ELTYPE_BITS)
+#define CV_SEQ_KIND_CURVE       (1 << CV_SEQ_ELTYPE_BITS)
+#define CV_SEQ_KIND_BIN_TREE    (2 << CV_SEQ_ELTYPE_BITS)
+
+/** types of sparse sequences (sets) */
+#define CV_SEQ_KIND_GRAPH       (1 << CV_SEQ_ELTYPE_BITS)
+#define CV_SEQ_KIND_SUBDIV2D    (2 << CV_SEQ_ELTYPE_BITS)
+
+#define CV_SEQ_FLAG_SHIFT       (CV_SEQ_KIND_BITS + CV_SEQ_ELTYPE_BITS)
+
+/** flags for curves */
+#define CV_SEQ_FLAG_CLOSED     (1 << CV_SEQ_FLAG_SHIFT)
+#define CV_SEQ_FLAG_SIMPLE     (0 << CV_SEQ_FLAG_SHIFT)
+#define CV_SEQ_FLAG_CONVEX     (0 << CV_SEQ_FLAG_SHIFT)
+#define CV_SEQ_FLAG_HOLE       (2 << CV_SEQ_FLAG_SHIFT)
+
+/** flags for graphs */
+#define CV_GRAPH_FLAG_ORIENTED (1 << CV_SEQ_FLAG_SHIFT)
+
+#define CV_GRAPH               CV_SEQ_KIND_GRAPH
+#define CV_ORIENTED_GRAPH      (CV_SEQ_KIND_GRAPH|CV_GRAPH_FLAG_ORIENTED)
+
+/** point sets */
+#define CV_SEQ_POINT_SET       (CV_SEQ_KIND_GENERIC| CV_SEQ_ELTYPE_POINT)
+#define CV_SEQ_POINT3D_SET     (CV_SEQ_KIND_GENERIC| CV_SEQ_ELTYPE_POINT3D)
+#define CV_SEQ_POLYLINE        (CV_SEQ_KIND_CURVE  | CV_SEQ_ELTYPE_POINT)
+#define CV_SEQ_POLYGON         (CV_SEQ_FLAG_CLOSED | CV_SEQ_POLYLINE )
+#define CV_SEQ_CONTOUR         CV_SEQ_POLYGON
+#define CV_SEQ_SIMPLE_POLYGON  (CV_SEQ_FLAG_SIMPLE | CV_SEQ_POLYGON  )
+
+/** chain-coded curves */
+#define CV_SEQ_CHAIN           (CV_SEQ_KIND_CURVE  | CV_SEQ_ELTYPE_CODE)
+#define CV_SEQ_CHAIN_CONTOUR   (CV_SEQ_FLAG_CLOSED | CV_SEQ_CHAIN)
+
+/** binary tree for the contour */
+#define CV_SEQ_POLYGON_TREE    (CV_SEQ_KIND_BIN_TREE  | CV_SEQ_ELTYPE_TRIAN_ATR)
+
+/** sequence of the connected components */
+#define CV_SEQ_CONNECTED_COMP  (CV_SEQ_KIND_GENERIC  | CV_SEQ_ELTYPE_CONNECTED_COMP)
+
+/** sequence of the integer numbers */
+#define CV_SEQ_INDEX           (CV_SEQ_KIND_GENERIC  | CV_SEQ_ELTYPE_INDEX)
+
+#define CV_SEQ_ELTYPE( seq )   ((seq)->flags & CV_SEQ_ELTYPE_MASK)
+#define CV_SEQ_KIND( seq )     ((seq)->flags & CV_SEQ_KIND_MASK )
+
+/** flag checking */
+#define CV_IS_SEQ_INDEX( seq )      ((CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_INDEX) && \
+                                     (CV_SEQ_KIND(seq) == CV_SEQ_KIND_GENERIC))
+
+#define CV_IS_SEQ_CURVE( seq )      (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE)
+#define CV_IS_SEQ_CLOSED( seq )     (((seq)->flags & CV_SEQ_FLAG_CLOSED) != 0)
+#define CV_IS_SEQ_CONVEX( seq )     0
+#define CV_IS_SEQ_HOLE( seq )       (((seq)->flags & CV_SEQ_FLAG_HOLE) != 0)
+#define CV_IS_SEQ_SIMPLE( seq )     1
+
+/** type checking macros */
+#define CV_IS_SEQ_POINT_SET( seq ) \
+    ((CV_SEQ_ELTYPE(seq) == CV_32SC2 || CV_SEQ_ELTYPE(seq) == CV_32FC2))
+
+#define CV_IS_SEQ_POINT_SUBSET( seq ) \
+    (CV_IS_SEQ_INDEX( seq ) || CV_SEQ_ELTYPE(seq) == CV_SEQ_ELTYPE_PPOINT)
+
+#define CV_IS_SEQ_POLYLINE( seq )   \
+    (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && CV_IS_SEQ_POINT_SET(seq))
+
+#define CV_IS_SEQ_POLYGON( seq )   \
+    (CV_IS_SEQ_POLYLINE(seq) && CV_IS_SEQ_CLOSED(seq))
+
+#define CV_IS_SEQ_CHAIN( seq )   \
+    (CV_SEQ_KIND(seq) == CV_SEQ_KIND_CURVE && (seq)->elem_size == 1)
+
+#define CV_IS_SEQ_CONTOUR( seq )   \
+    (CV_IS_SEQ_CLOSED(seq) && (CV_IS_SEQ_POLYLINE(seq) || CV_IS_SEQ_CHAIN(seq)))
+
+#define CV_IS_SEQ_CHAIN_CONTOUR( seq ) \
+    (CV_IS_SEQ_CHAIN( seq ) && CV_IS_SEQ_CLOSED( seq ))
+
+#define CV_IS_SEQ_POLYGON_TREE( seq ) \
+    (CV_SEQ_ELTYPE (seq) ==  CV_SEQ_ELTYPE_TRIAN_ATR &&    \
+    CV_SEQ_KIND( seq ) ==  CV_SEQ_KIND_BIN_TREE )
+
+#define CV_IS_GRAPH( seq )    \
+    (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_GRAPH)
+
+#define CV_IS_GRAPH_ORIENTED( seq )   \
+    (((seq)->flags & CV_GRAPH_FLAG_ORIENTED) != 0)
+
+#define CV_IS_SUBDIV2D( seq )  \
+    (CV_IS_SET(seq) && CV_SEQ_KIND((CvSet*)(seq)) == CV_SEQ_KIND_SUBDIV2D)
+
+/****************************************************************************************/
+/*                            Sequence writer & reader                                  */
+/****************************************************************************************/
+
+#define CV_SEQ_WRITER_FIELDS()                                     \
+    int          header_size;                                      \
+    CvSeq*       seq;        /**< the sequence written */            \
+    CvSeqBlock*  block;      /**< current block */                   \
+    schar*       ptr;        /**< pointer to free space */           \
+    schar*       block_min;  /**< pointer to the beginning of block*/\
+    schar*       block_max;  /**< pointer to the end of block */
+
+typedef struct CvSeqWriter
+{
+    CV_SEQ_WRITER_FIELDS()
+}
+CvSeqWriter;
+
+
+#define CV_SEQ_READER_FIELDS()                                      \
+    int          header_size;                                       \
+    CvSeq*       seq;        /**< sequence, beign read */             \
+    CvSeqBlock*  block;      /**< current block */                    \
+    schar*       ptr;        /**< pointer to element be read next */  \
+    schar*       block_min;  /**< pointer to the beginning of block */\
+    schar*       block_max;  /**< pointer to the end of block */      \
+    int          delta_index;/**< = seq->first->start_index   */      \
+    schar*       prev_elem;  /**< pointer to previous element */
+
+typedef struct CvSeqReader
+{
+    CV_SEQ_READER_FIELDS()
+}
+CvSeqReader;
+
+/****************************************************************************************/
+/*                                Operations on sequences                               */
+/****************************************************************************************/
+
+#define  CV_SEQ_ELEM( seq, elem_type, index )                    \
+/** assert gives some guarantee that <seq> parameter is valid */  \
+(   assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) &&      \
+    (seq)->elem_size == sizeof(elem_type)),                      \
+    (elem_type*)((seq)->first && (unsigned)index <               \
+    (unsigned)((seq)->first->count) ?                            \
+    (seq)->first->data + (index) * sizeof(elem_type) :           \
+    cvGetSeqElem( (CvSeq*)(seq), (index) )))
+#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )
+
+/** Add element to sequence: */
+#define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer )     \
+{                                                     \
+    if( (writer).ptr >= (writer).block_max )          \
+    {                                                 \
+        cvCreateSeqBlock( &writer);                   \
+    }                                                 \
+    memcpy((writer).ptr, elem_ptr, (writer).seq->elem_size);\
+    (writer).ptr += (writer).seq->elem_size;          \
+}
+
+#define CV_WRITE_SEQ_ELEM( elem, writer )             \
+{                                                     \
+    assert( (writer).seq->elem_size == sizeof(elem)); \
+    if( (writer).ptr >= (writer).block_max )          \
+    {                                                 \
+        cvCreateSeqBlock( &writer);                   \
+    }                                                 \
+    assert( (writer).ptr <= (writer).block_max - sizeof(elem));\
+    memcpy((writer).ptr, &(elem), sizeof(elem));      \
+    (writer).ptr += sizeof(elem);                     \
+}
+
+
+/** Move reader position forward: */
+#define CV_NEXT_SEQ_ELEM( elem_size, reader )                 \
+{                                                             \
+    if( ((reader).ptr += (elem_size)) >= (reader).block_max ) \
+    {                                                         \
+        cvChangeSeqBlock( &(reader), 1 );                     \
+    }                                                         \
+}
+
+
+/** Move reader position backward: */
+#define CV_PREV_SEQ_ELEM( elem_size, reader )                \
+{                                                            \
+    if( ((reader).ptr -= (elem_size)) < (reader).block_min ) \
+    {                                                        \
+        cvChangeSeqBlock( &(reader), -1 );                   \
+    }                                                        \
+}
+
+/** Read element and move read position forward: */
+#define CV_READ_SEQ_ELEM( elem, reader )                       \
+{                                                              \
+    assert( (reader).seq->elem_size == sizeof(elem));          \
+    memcpy( &(elem), (reader).ptr, sizeof((elem)));            \
+    CV_NEXT_SEQ_ELEM( sizeof(elem), reader )                   \
+}
+
+/** Read element and move read position backward: */
+#define CV_REV_READ_SEQ_ELEM( elem, reader )                     \
+{                                                                \
+    assert( (reader).seq->elem_size == sizeof(elem));            \
+    memcpy(&(elem), (reader).ptr, sizeof((elem)));               \
+    CV_PREV_SEQ_ELEM( sizeof(elem), reader )                     \
+}
+
+
+#define CV_READ_CHAIN_POINT( _pt, reader )                              \
+{                                                                       \
+    (_pt) = (reader).pt;                                                \
+    if( (reader).ptr )                                                  \
+    {                                                                   \
+        CV_READ_SEQ_ELEM( (reader).code, (reader));                     \
+        assert( ((reader).code & ~7) == 0 );                            \
+        (reader).pt.x += (reader).deltas[(int)(reader).code][0];        \
+        (reader).pt.y += (reader).deltas[(int)(reader).code][1];        \
+    }                                                                   \
+}
+
+#define CV_CURRENT_POINT( reader )  (*((CvPoint*)((reader).ptr)))
+#define CV_PREV_POINT( reader )     (*((CvPoint*)((reader).prev_elem)))
+
+#define CV_READ_EDGE( pt1, pt2, reader )               \
+{                                                      \
+    assert( sizeof(pt1) == sizeof(CvPoint) &&          \
+            sizeof(pt2) == sizeof(CvPoint) &&          \
+            reader.seq->elem_size == sizeof(CvPoint)); \
+    (pt1) = CV_PREV_POINT( reader );                   \
+    (pt2) = CV_CURRENT_POINT( reader );                \
+    (reader).prev_elem = (reader).ptr;                 \
+    CV_NEXT_SEQ_ELEM( sizeof(CvPoint), (reader));      \
+}
+
+/************ Graph macros ************/
+
+/** Return next graph edge for given vertex: */
+#define  CV_NEXT_GRAPH_EDGE( edge, vertex )                              \
+     (assert((edge)->vtx[0] == (vertex) || (edge)->vtx[1] == (vertex)),  \
+      (edge)->next[(edge)->vtx[1] == (vertex)])
+
+
+
+/****************************************************************************************\
+*             Data structures for persistence (a.k.a serialization) functionality        *
+\****************************************************************************************/
+
+/** "black box" file storage */
+typedef struct CvFileStorage CvFileStorage;
+
+/** Storage flags: */
+#define CV_STORAGE_READ          0
+#define CV_STORAGE_WRITE         1
+#define CV_STORAGE_WRITE_TEXT    CV_STORAGE_WRITE
+#define CV_STORAGE_WRITE_BINARY  CV_STORAGE_WRITE
+#define CV_STORAGE_APPEND        2
+#define CV_STORAGE_MEMORY        4
+#define CV_STORAGE_FORMAT_MASK   (7<<3)
+#define CV_STORAGE_FORMAT_AUTO   0
+#define CV_STORAGE_FORMAT_XML    8
+#define CV_STORAGE_FORMAT_YAML  16
+
+/** @brief List of attributes. :
+
+In the current implementation, attributes are used to pass extra parameters when writing user
+objects (see cvWrite). XML attributes inside tags are not supported, aside from the object type
+specification (type_id attribute).
+@see cvAttrList, cvAttrValue
+ */
+typedef struct CvAttrList
+{
+    const char** attr;         /**< NULL-terminated array of (attribute_name,attribute_value) pairs. */
+    struct CvAttrList* next;   /**< Pointer to next chunk of the attributes list.                    */
+}
+CvAttrList;
+
+/** initializes CvAttrList structure */
+CV_INLINE CvAttrList cvAttrList( const char** attr CV_DEFAULT(NULL),
+                                 CvAttrList* next CV_DEFAULT(NULL) )
+{
+    CvAttrList l;
+    l.attr = attr;
+    l.next = next;
+
+    return l;
+}
+
+struct CvTypeInfo;
+
+#define CV_NODE_NONE        0
+#define CV_NODE_INT         1
+#define CV_NODE_INTEGER     CV_NODE_INT
+#define CV_NODE_REAL        2
+#define CV_NODE_FLOAT       CV_NODE_REAL
+#define CV_NODE_STR         3
+#define CV_NODE_STRING      CV_NODE_STR
+#define CV_NODE_REF         4 /**< not used */
+#define CV_NODE_SEQ         5
+#define CV_NODE_MAP         6
+#define CV_NODE_TYPE_MASK   7
+
+#define CV_NODE_TYPE(flags)  ((flags) & CV_NODE_TYPE_MASK)
+
+/** file node flags */
+#define CV_NODE_FLOW        8 /**<Used only for writing structures in YAML format. */
+#define CV_NODE_USER        16
+#define CV_NODE_EMPTY       32
+#define CV_NODE_NAMED       64
+
+#define CV_NODE_IS_INT(flags)        (CV_NODE_TYPE(flags) == CV_NODE_INT)
+#define CV_NODE_IS_REAL(flags)       (CV_NODE_TYPE(flags) == CV_NODE_REAL)
+#define CV_NODE_IS_STRING(flags)     (CV_NODE_TYPE(flags) == CV_NODE_STRING)
+#define CV_NODE_IS_SEQ(flags)        (CV_NODE_TYPE(flags) == CV_NODE_SEQ)
+#define CV_NODE_IS_MAP(flags)        (CV_NODE_TYPE(flags) == CV_NODE_MAP)
+#define CV_NODE_IS_COLLECTION(flags) (CV_NODE_TYPE(flags) >= CV_NODE_SEQ)
+#define CV_NODE_IS_FLOW(flags)       (((flags) & CV_NODE_FLOW) != 0)
+#define CV_NODE_IS_EMPTY(flags)      (((flags) & CV_NODE_EMPTY) != 0)
+#define CV_NODE_IS_USER(flags)       (((flags) & CV_NODE_USER) != 0)
+#define CV_NODE_HAS_NAME(flags)      (((flags) & CV_NODE_NAMED) != 0)
+
+#define CV_NODE_SEQ_SIMPLE 256
+#define CV_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags & CV_NODE_SEQ_SIMPLE) != 0)
+
+typedef struct CvString
+{
+    int len;
+    char* ptr;
+}
+CvString;
+
+/** All the keys (names) of elements in the readed file storage
+   are stored in the hash to speed up the lookup operations: */
+typedef struct CvStringHashNode
+{
+    unsigned hashval;
+    CvString str;
+    struct CvStringHashNode* next;
+}
+CvStringHashNode;
+
+typedef struct CvGenericHash CvFileNodeHash;
+
+/** Basic element of the file storage - scalar or collection: */
+typedef struct CvFileNode
+{
+    int tag;
+    struct CvTypeInfo* info; /**< type information
+            (only for user-defined object, for others it is 0) */
+    union
+    {
+        double f; /**< scalar floating-point number */
+        int i;    /**< scalar integer number */
+        CvString str; /**< text string */
+        CvSeq* seq; /**< sequence (ordered collection of file nodes) */
+        CvFileNodeHash* map; /**< map (collection of named file nodes) */
+    } data;
+}
+CvFileNode;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CV_CDECL *CvIsInstanceFunc)( const void* struct_ptr );
+typedef void (CV_CDECL *CvReleaseFunc)( void** struct_dblptr );
+typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage, CvFileNode* node );
+typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage, const char* name,
+                                      const void* struct_ptr, CvAttrList attributes );
+typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr );
+#ifdef __cplusplus
+}
+#endif
+
+/** @brief Type information
+
+The structure contains information about one of the standard or user-defined types. Instances of the
+type may or may not contain a pointer to the corresponding CvTypeInfo structure. In any case, there
+is a way to find the type info structure for a given object using the cvTypeOf function.
+Alternatively, type info can be found by type name using cvFindType, which is used when an object
+is read from file storage. The user can register a new type with cvRegisterType that adds the type
+information structure into the beginning of the type list. Thus, it is possible to create
+specialized types from generic standard types and override the basic methods.
+ */
+typedef struct CvTypeInfo
+{
+    int flags; /**< not used */
+    int header_size; /**< sizeof(CvTypeInfo) */
+    struct CvTypeInfo* prev; /**< previous registered type in the list */
+    struct CvTypeInfo* next; /**< next registered type in the list */
+    const char* type_name; /**< type name, written to file storage */
+    CvIsInstanceFunc is_instance; /**< checks if the passed object belongs to the type */
+    CvReleaseFunc release; /**< releases object (memory etc.) */
+    CvReadFunc read; /**< reads object from file storage */
+    CvWriteFunc write; /**< writes object to file storage */
+    CvCloneFunc clone; /**< creates a copy of the object */
+}
+CvTypeInfo;
+
+
+/**** System data types ******/
+
+typedef struct CvPluginFuncInfo
+{
+    void** func_addr;
+    void* default_func_addr;
+    const char* func_names;
+    int search_modules;
+    int loaded_from;
+}
+CvPluginFuncInfo;
+
+typedef struct CvModuleInfo
+{
+    struct CvModuleInfo* next;
+    const char* name;
+    const char* version;
+    CvPluginFuncInfo* func_tab;
+}
+CvModuleInfo;
+
+/** @} */
+
+#endif /*__OPENCV_CORE_TYPES_H__*/
+
+/* End of file. */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp
new file mode 100644
index 0000000..b66ade5
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/utility.hpp
@@ -0,0 +1,889 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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*/
+
+#ifndef __OPENCV_CORE_UTILITY_H__
+#define __OPENCV_CORE_UTILITY_H__
+
+#ifndef __cplusplus
+#  error utility.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+
+#ifdef CV_COLLECT_IMPL_DATA
+CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays
+CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays
+// Get stored implementation flags and fucntions names arrays
+// Each implementation entry correspond to function name entry, so you can find which implementation was executed in which fucntion
+CV_EXPORTS int getImpl(std::vector<int> &impl, std::vector<String> &funName);
+
+CV_EXPORTS bool useCollection(); // return implementation collection state
+CV_EXPORTS void setUseCollection(bool flag); // set implementation collection state
+
+#define CV_IMPL_PLAIN  0x01 // native CPU OpenCV implementation
+#define CV_IMPL_OCL    0x02 // OpenCL implementation
+#define CV_IMPL_IPP    0x04 // IPP implementation
+#define CV_IMPL_MT     0x10 // multithreaded implementation
+
+#define CV_IMPL_ADD(impl)                                                   \
+    if(cv::useCollection())                                                 \
+    {                                                                       \
+        cv::addImpl(impl, CV_Func);                                         \
+    }
+#else
+#define CV_IMPL_ADD(impl)
+#endif
+
+//! @addtogroup core_utils
+//! @{
+
+/** @brief  Automatically Allocated Buffer Class
+
+ The class is used for temporary buffers in functions and methods.
+ If a temporary buffer is usually small (a few K's of memory),
+ but its size depends on the parameters, it makes sense to create a small
+ fixed-size array on stack and use it if it's large enough. If the required buffer size
+ is larger than the fixed size, another buffer of sufficient size is allocated dynamically
+ and released after the processing. Therefore, in typical cases, when the buffer size is small,
+ there is no overhead associated with malloc()/free().
+ At the same time, there is no limit on the size of processed data.
+
+ This is what AutoBuffer does. The template takes 2 parameters - type of the buffer elements and
+ the number of stack-allocated elements. Here is how the class is used:
+
+ \code
+ void my_func(const cv::Mat& m)
+ {
+    cv::AutoBuffer<float> buf; // create automatic buffer containing 1000 floats
+
+    buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used,
+                          // otherwise the buffer of "m.rows" floats will be allocated
+                          // dynamically and deallocated in cv::AutoBuffer destructor
+    ...
+ }
+ \endcode
+*/
+template<typename _Tp, size_t fixed_size = 1024/sizeof(_Tp)+8> class AutoBuffer
+{
+public:
+    typedef _Tp value_type;
+
+    //! the default constructor
+    AutoBuffer();
+    //! constructor taking the real buffer size
+    AutoBuffer(size_t _size);
+
+    //! the copy constructor
+    AutoBuffer(const AutoBuffer<_Tp, fixed_size>& buf);
+    //! the assignment operator
+    AutoBuffer<_Tp, fixed_size>& operator = (const AutoBuffer<_Tp, fixed_size>& buf);
+
+    //! destructor. calls deallocate()
+    ~AutoBuffer();
+
+    //! allocates the new buffer of size _size. if the _size is small enough, stack-allocated buffer is used
+    void allocate(size_t _size);
+    //! deallocates the buffer if it was dynamically allocated
+    void deallocate();
+    //! resizes the buffer and preserves the content
+    void resize(size_t _size);
+    //! returns the current buffer size
+    size_t size() const;
+    //! returns pointer to the real buffer, stack-allocated or head-allocated
+    operator _Tp* ();
+    //! returns read-only pointer to the real buffer, stack-allocated or head-allocated
+    operator const _Tp* () const;
+
+protected:
+    //! pointer to the real buffer, can point to buf if the buffer is small enough
+    _Tp* ptr;
+    //! size of the real buffer
+    size_t sz;
+    //! pre-allocated buffer. At least 1 element to confirm C++ standard reqirements
+    _Tp buf[(fixed_size > 0) ? fixed_size : 1];
+};
+
+/**  @brief Sets/resets the break-on-error mode.
+
+When the break-on-error mode is set, the default error handler issues a hardware exception, which
+can make debugging more convenient.
+
+\return the previous state
+ */
+CV_EXPORTS bool setBreakOnError(bool flag);
+
+extern "C" typedef int (*ErrorCallback)( int status, const char* func_name,
+                                       const char* err_msg, const char* file_name,
+                                       int line, void* userdata );
+
+
+/** @brief Sets the new error handler and the optional user data.
+
+  The function sets the new error handler, called from cv::error().
+
+  \param errCallback the new error handler. If NULL, the default error handler is used.
+  \param userdata the optional user data pointer, passed to the callback.
+  \param prevUserdata the optional output parameter where the previous user data pointer is stored
+
+  \return the previous error handler
+*/
+CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback, void* userdata=0, void** prevUserdata=0);
+
+/** @brief Returns a text string formatted using the printf-like expression.
+
+The function acts like sprintf but forms and returns an STL string. It can be used to form an error
+message in the Exception constructor.
+@param fmt printf-compatible formatting specifiers.
+ */
+CV_EXPORTS String format( const char* fmt, ... );
+CV_EXPORTS String tempfile( const char* suffix = 0);
+CV_EXPORTS void glob(String pattern, std::vector<String>& result, bool recursive = false);
+
+/** @brief OpenCV will try to set the number of threads for the next parallel region.
+
+If threads == 0, OpenCV will disable threading optimizations and run all it's functions
+sequentially. Passing threads \< 0 will reset threads number to system default. This function must
+be called outside of parallel region.
+
+OpenCV will try to run it's functions with specified threads number, but some behaviour differs from
+framework:
+-   `TBB` 鈥� User-defined parallel constructions will run with the same threads number, if
+    another does not specified. If late on user creates own scheduler, OpenCV will be use it.
+-   `OpenMP` 鈥� No special defined behaviour.
+-   `Concurrency` 鈥� If threads == 1, OpenCV will disable threading optimizations and run it's
+    functions sequentially.
+-   `GCD` 鈥� Supports only values \<= 0.
+-   `C=` 鈥� No special defined behaviour.
+@param nthreads Number of threads used by OpenCV.
+@sa getNumThreads, getThreadNum
+ */
+CV_EXPORTS_W void setNumThreads(int nthreads);
+
+/** @brief Returns the number of threads used by OpenCV for parallel regions.
+
+Always returns 1 if OpenCV is built without threading support.
+
+The exact meaning of return value depends on the threading framework used by OpenCV library:
+- `TBB` 鈥� The number of threads, that OpenCV will try to use for parallel regions. If there is
+  any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns
+  default number of threads used by TBB library.
+- `OpenMP` 鈥� An upper bound on the number of threads that could be used to form a new team.
+- `Concurrency` 鈥� The number of threads, that OpenCV will try to use for parallel regions.
+- `GCD` 鈥� Unsupported; returns the GCD thread pool limit (512) for compatibility.
+- `C=` 鈥� The number of threads, that OpenCV will try to use for parallel regions, if before
+  called setNumThreads with threads \> 0, otherwise returns the number of logical CPUs,
+  available for the process.
+@sa setNumThreads, getThreadNum
+ */
+CV_EXPORTS_W int getNumThreads();
+
+/** @brief Returns the index of the currently executed thread within the current parallel region. Always
+returns 0 if called outside of parallel region.
+
+The exact meaning of return value depends on the threading framework used by OpenCV library:
+- `TBB` 鈥� Unsupported with current 4.1 TBB release. May be will be supported in future.
+- `OpenMP` 鈥� The thread number, within the current team, of the calling thread.
+- `Concurrency` 鈥� An ID for the virtual processor that the current context is executing on (0
+  for master thread and unique number for others, but not necessary 1,2,3,...).
+- `GCD` 鈥� System calling thread's ID. Never returns 0 inside parallel region.
+- `C=` 鈥� The index of the current parallel task.
+@sa setNumThreads, getNumThreads
+ */
+CV_EXPORTS_W int getThreadNum();
+
+/** @brief Returns full configuration time cmake output.
+
+Returned value is raw cmake output including version control system revision, compiler version,
+compiler flags, enabled modules and third party libraries, etc. Output format depends on target
+architecture.
+ */
+CV_EXPORTS_W const String& getBuildInformation();
+
+/** @brief Returns the number of ticks.
+
+The function returns the number of ticks after the certain event (for example, when the machine was
+turned on). It can be used to initialize RNG or to measure a function execution time by reading the
+tick count before and after the function call. See also the tick frequency.
+ */
+CV_EXPORTS_W int64 getTickCount();
+
+/** @brief Returns the number of ticks per second.
+
+The function returns the number of ticks per second. That is, the following code computes the
+execution time in seconds:
+@code
+    double t = (double)getTickCount();
+    // do something ...
+    t = ((double)getTickCount() - t)/getTickFrequency();
+@endcode
+ */
+CV_EXPORTS_W double getTickFrequency();
+
+/** @brief Returns the number of CPU ticks.
+
+The function returns the current number of CPU ticks on some architectures (such as x86, x64,
+PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for
+very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU
+systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU
+with its own counter. So, theoretically (and practically) the subsequent calls to the function do
+not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU
+frequency depending on the load, the number of CPU clocks spent in some code cannot be directly
+converted to time units. Therefore, getTickCount is generally a preferable solution for measuring
+execution time.
+ */
+CV_EXPORTS_W int64 getCPUTickCount();
+
+/** @brief Returns true if the specified feature is supported by the host hardware.
+
+The function returns true if the host hardware supports the specified feature. When user calls
+setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until
+setUseOptimized(true) is called. This way user can dynamically switch on and off the optimized code
+in OpenCV.
+@param feature The feature of interest, one of cv::CpuFeatures
+ */
+CV_EXPORTS_W bool checkHardwareSupport(int feature);
+
+/** @brief Returns the number of logical CPUs available for the process.
+ */
+CV_EXPORTS_W int getNumberOfCPUs();
+
+
+/** @brief Aligns a pointer to the specified number of bytes.
+
+The function returns the aligned pointer of the same type as the input pointer:
+\f[\texttt{(_Tp*)(((size_t)ptr + n-1) & -n)}\f]
+@param ptr Aligned pointer.
+@param n Alignment size that must be a power of two.
+ */
+template<typename _Tp> static inline _Tp* alignPtr(_Tp* ptr, int n=(int)sizeof(_Tp))
+{
+    return (_Tp*)(((size_t)ptr + n-1) & -n);
+}
+
+/** @brief Aligns a buffer size to the specified number of bytes.
+
+The function returns the minimum number that is greater or equal to sz and is divisible by n :
+\f[\texttt{(sz + n-1) & -n}\f]
+@param sz Buffer size to align.
+@param n Alignment size that must be a power of two.
+ */
+static inline size_t alignSize(size_t sz, int n)
+{
+    CV_DbgAssert((n & (n - 1)) == 0); // n is a power of 2
+    return (sz + n-1) & -n;
+}
+
+/** @brief Enables or disables the optimized code.
+
+The function can be used to dynamically turn on and off optimized code (code that uses SSE2, AVX,
+and other instructions on the platforms that support it). It sets a global flag that is further
+checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only
+safe to call the function on the very top level in your application where you can be sure that no
+other OpenCV function is currently executed.
+
+By default, the optimized code is enabled unless you disable it in CMake. The current status can be
+retrieved using useOptimized.
+@param onoff The boolean flag specifying whether the optimized code should be used (onoff=true)
+or not (onoff=false).
+ */
+CV_EXPORTS_W void setUseOptimized(bool onoff);
+
+/** @brief Returns the status of optimized code usage.
+
+The function returns true if the optimized code is enabled. Otherwise, it returns false.
+ */
+CV_EXPORTS_W bool useOptimized();
+
+static inline size_t getElemSize(int type) { return CV_ELEM_SIZE(type); }
+
+/////////////////////////////// Parallel Primitives //////////////////////////////////
+
+/** @brief Base class for parallel data processors
+*/
+class CV_EXPORTS ParallelLoopBody
+{
+public:
+    virtual ~ParallelLoopBody();
+    virtual void operator() (const Range& range) const = 0;
+};
+
+/** @brief Parallel data processor
+*/
+CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body, double nstripes=-1.);
+
+/////////////////////////////// forEach method of cv::Mat ////////////////////////////
+template<typename _Tp, typename Functor> inline
+void Mat::forEach_impl(const Functor& operation) {
+    if (false) {
+        operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(NULL));
+        // If your compiler fail in this line.
+        // Please check that your functor signature is
+        //     (_Tp&, const int*)   <- multidimential
+        //  or (_Tp&, void*)        <- in case of you don't need current idx.
+    }
+
+    CV_Assert(this->total() / this->size[this->dims - 1] <= INT_MAX);
+    const int LINES = static_cast<int>(this->total() / this->size[this->dims - 1]);
+
+    class PixelOperationWrapper :public ParallelLoopBody
+    {
+    public:
+        PixelOperationWrapper(Mat_<_Tp>* const frame, const Functor& _operation)
+            : mat(frame), op(_operation) {};
+        virtual ~PixelOperationWrapper(){};
+        // ! Overloaded virtual operator
+        // convert range call to row call.
+        virtual void operator()(const Range &range) const {
+            const int DIMS = mat->dims;
+            const int COLS = mat->size[DIMS - 1];
+            if (DIMS <= 2) {
+                for (int row = range.start; row < range.end; ++row) {
+                    this->rowCall2(row, COLS);
+                }
+            } else {
+                std::vector<int> idx(COLS); /// idx is modified in this->rowCall
+                idx[DIMS - 2] = range.start - 1;
+
+                for (int line_num = range.start; line_num < range.end; ++line_num) {
+                    idx[DIMS - 2]++;
+                    for (int i = DIMS - 2; i >= 0; --i) {
+                        if (idx[i] >= mat->size[i]) {
+                            idx[i - 1] += idx[i] / mat->size[i];
+                            idx[i] %= mat->size[i];
+                            continue; // carry-over;
+                        }
+                        else {
+                            break;
+                        }
+                    }
+                    this->rowCall(&idx[0], COLS, DIMS);
+                }
+            }
+        };
+    private:
+        Mat_<_Tp>* const mat;
+        const Functor op;
+        // ! Call operator for each elements in this row.
+        inline void rowCall(int* const idx, const int COLS, const int DIMS) const {
+            int &col = idx[DIMS - 1];
+            col = 0;
+            _Tp* pixel = &(mat->template at<_Tp>(idx));
+
+            while (col < COLS) {
+                op(*pixel, const_cast<const int*>(idx));
+                pixel++; col++;
+            }
+            col = 0;
+        }
+        // ! Call operator for each elements in this row. 2d mat special version.
+        inline void rowCall2(const int row, const int COLS) const {
+            union Index{
+                int body[2];
+                operator const int*() const {
+                    return reinterpret_cast<const int*>(this);
+                }
+                int& operator[](const int i) {
+                    return body[i];
+                }
+            } idx = {{row, 0}};
+            // Special union is needed to avoid
+            // "error: array subscript is above array bounds [-Werror=array-bounds]"
+            // when call the functor `op` such that access idx[3].
+
+            _Tp* pixel = &(mat->template at<_Tp>(idx));
+            const _Tp* const pixel_end = pixel + COLS;
+            while(pixel < pixel_end) {
+                op(*pixel++, static_cast<const int*>(idx));
+                idx[1]++;
+            }
+        };
+        PixelOperationWrapper& operator=(const PixelOperationWrapper &) {
+            CV_Assert(false);
+            // We can not remove this implementation because Visual Studio warning C4822.
+            return *this;
+        };
+    };
+
+    parallel_for_(cv::Range(0, LINES), PixelOperationWrapper(reinterpret_cast<Mat_<_Tp>*>(this), operation));
+}
+
+/////////////////////////// Synchronization Primitives ///////////////////////////////
+
+class CV_EXPORTS Mutex
+{
+public:
+    Mutex();
+    ~Mutex();
+    Mutex(const Mutex& m);
+    Mutex& operator = (const Mutex& m);
+
+    void lock();
+    bool trylock();
+    void unlock();
+
+    struct Impl;
+protected:
+    Impl* impl;
+};
+
+class CV_EXPORTS AutoLock
+{
+public:
+    AutoLock(Mutex& m) : mutex(&m) { mutex->lock(); }
+    ~AutoLock() { mutex->unlock(); }
+protected:
+    Mutex* mutex;
+private:
+    AutoLock(const AutoLock&);
+    AutoLock& operator = (const AutoLock&);
+};
+
+// TLS interface
+class CV_EXPORTS TLSDataContainer
+{
+protected:
+    TLSDataContainer();
+    virtual ~TLSDataContainer();
+
+    void  gatherData(std::vector<void*> &data) const;
+#if OPENCV_ABI_COMPATIBILITY > 300
+    void* getData() const;
+    void  release();
+
+private:
+#else
+    void  release();
+
+public:
+    void* getData() const;
+#endif
+    virtual void* createDataInstance() const = 0;
+    virtual void  deleteDataInstance(void* pData) const = 0;
+
+    int key_;
+};
+
+// Main TLS data class
+template <typename T>
+class TLSData : protected TLSDataContainer
+{
+public:
+    inline TLSData()        {}
+    inline ~TLSData()       { release();            } // Release key and delete associated data
+    inline T* get() const   { return (T*)getData(); } // Get data assosiated with key
+
+     // Get data from all threads
+    inline void gather(std::vector<T*> &data) const
+    {
+        std::vector<void*> &dataVoid = reinterpret_cast<std::vector<void*>&>(data);
+        gatherData(dataVoid);
+    }
+
+private:
+    virtual void* createDataInstance() const {return new T;}                // Wrapper to allocate data by template
+    virtual void  deleteDataInstance(void* pData) const {delete (T*)pData;} // Wrapper to release data by template
+
+    // Disable TLS copy operations
+    TLSData(TLSData &) {};
+    TLSData& operator =(const TLSData &) {return *this;};
+};
+
+/** @brief Designed for command line parsing
+
+The sample below demonstrates how to use CommandLineParser:
+@code
+    CommandLineParser parser(argc, argv, keys);
+    parser.about("Application name v1.0.0");
+
+    if (parser.has("help"))
+    {
+        parser.printMessage();
+        return 0;
+    }
+
+    int N = parser.get<int>("N");
+    double fps = parser.get<double>("fps");
+    String path = parser.get<String>("path");
+
+    use_time_stamp = parser.has("timestamp");
+
+    String img1 = parser.get<String>(0);
+    String img2 = parser.get<String>(1);
+
+    int repeat = parser.get<int>(2);
+
+    if (!parser.check())
+    {
+        parser.printErrors();
+        return 0;
+    }
+@endcode
+
+### Keys syntax
+
+The keys parameter is a string containing several blocks, each one is enclosed in curley braces and
+describes one argument. Each argument contains three parts separated by the `|` symbol:
+
+-# argument names is a space-separated list of option synonyms (to mark argument as positional, prefix it with the `@` symbol)
+-# default value will be used if the argument was not provided (can be empty)
+-# help message (can be empty)
+
+For example:
+
+@code{.cpp}
+    const String keys =
+        "{help h usage ? |      | print this message   }"
+        "{@image1        |      | image1 for compare   }"
+        "{@image2        |<none>| image2 for compare   }"
+        "{@repeat        |1     | number               }"
+        "{path           |.     | path to file         }"
+        "{fps            | -1.0 | fps for output video }"
+        "{N count        |100   | count of objects     }"
+        "{ts timestamp   |      | use time stamp       }"
+        ;
+}
+@endcode
+
+Note that there are no default values for `help` and `timestamp` so we can check their presence using the `has()` method.
+Arguments with default values are considered to be always present. Use the `get()` method in these cases to check their
+actual value instead.
+
+String keys like `get<String>("@image1")` return the empty string `""` by default - even with an empty default value.
+Use the special `<none>` default value to enforce that the returned string must not be empty. (like in `get<String>("@image2")`)
+
+### Usage
+
+For the described keys:
+
+@code{.sh}
+    # Good call (3 positional parameters: image1, image2 and repeat; N is 200, ts is true)
+    $ ./app -N=200 1.png 2.jpg 19 -ts
+
+    # Bad call
+    $ ./app -fps=aaa
+    ERRORS:
+    Parameter 'fps': can not convert: [aaa] to [double]
+@endcode
+ */
+class CV_EXPORTS CommandLineParser
+{
+public:
+
+    /** @brief Constructor
+
+    Initializes command line parser object
+
+    @param argc number of command line arguments (from main())
+    @param argv array of command line arguments (from main())
+    @param keys string describing acceptable command line parameters (see class description for syntax)
+    */
+    CommandLineParser(int argc, const char* const argv[], const String& keys);
+
+    /** @brief Copy constructor */
+    CommandLineParser(const CommandLineParser& parser);
+
+    /** @brief Assignment operator */
+    CommandLineParser& operator = (const CommandLineParser& parser);
+
+    /** @brief Destructor */
+    ~CommandLineParser();
+
+    /** @brief Returns application path
+
+    This method returns the path to the executable from the command line (`argv[0]`).
+
+    For example, if the application has been started with such command:
+    @code{.sh}
+    $ ./bin/my-executable
+    @endcode
+    this method will return `./bin`.
+    */
+    String getPathToApplication() const;
+
+    /** @brief Access arguments by name
+
+    Returns argument converted to selected type. If the argument is not known or can not be
+    converted to selected type, the error flag is set (can be checked with @ref check).
+
+    For example, define:
+    @code{.cpp}
+    String keys = "{N count||}";
+    @endcode
+
+    Call:
+    @code{.sh}
+    $ ./my-app -N=20
+    # or
+    $ ./my-app --count=20
+    @endcode
+
+    Access:
+    @code{.cpp}
+    int N = parser.get<int>("N");
+    @endcode
+
+    @param name name of the argument
+    @param space_delete remove spaces from the left and right of the string
+    @tparam T the argument will be converted to this type if possible
+
+    @note You can access positional arguments by their `@`-prefixed name:
+    @code{.cpp}
+    parser.get<String>("@image");
+    @endcode
+     */
+    template <typename T>
+    T get(const String& name, bool space_delete = true) const
+    {
+        T val = T();
+        getByName(name, space_delete, ParamType<T>::type, (void*)&val);
+        return val;
+    }
+
+    /** @brief Access positional arguments by index
+
+    Returns argument converted to selected type. Indexes are counted from zero.
+
+    For example, define:
+    @code{.cpp}
+    String keys = "{@arg1||}{@arg2||}"
+    @endcode
+
+    Call:
+    @code{.sh}
+    ./my-app abc qwe
+    @endcode
+
+    Access arguments:
+    @code{.cpp}
+    String val_1 = parser.get<String>(0); // returns "abc", arg1
+    String val_2 = parser.get<String>(1); // returns "qwe", arg2
+    @endcode
+
+    @param index index of the argument
+    @param space_delete remove spaces from the left and right of the string
+    @tparam T the argument will be converted to this type if possible
+     */
+    template <typename T>
+    T get(int index, bool space_delete = true) const
+    {
+        T val = T();
+        getByIndex(index, space_delete, ParamType<T>::type, (void*)&val);
+        return val;
+    }
+
+    /** @brief Check if field was provided in the command line
+
+    @param name argument name to check
+    */
+    bool has(const String& name) const;
+
+    /** @brief Check for parsing errors
+
+    Returns true if error occured while accessing the parameters (bad conversion, missing arguments,
+    etc.). Call @ref printErrors to print error messages list.
+     */
+    bool check() const;
+
+    /** @brief Set the about message
+
+    The about message will be shown when @ref printMessage is called, right before arguments table.
+     */
+    void about(const String& message);
+
+    /** @brief Print help message
+
+    This method will print standard help message containing the about message and arguments description.
+
+    @sa about
+    */
+    void printMessage() const;
+
+    /** @brief Print list of errors occured
+
+    @sa check
+    */
+    void printErrors() const;
+
+protected:
+    void getByName(const String& name, bool space_delete, int type, void* dst) const;
+    void getByIndex(int index, bool space_delete, int type, void* dst) const;
+
+    struct Impl;
+    Impl* impl;
+};
+
+//! @} core_utils
+
+//! @cond IGNORED
+
+/////////////////////////////// AutoBuffer implementation ////////////////////////////////////////
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::AutoBuffer()
+{
+    ptr = buf;
+    sz = fixed_size;
+}
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::AutoBuffer(size_t _size)
+{
+    ptr = buf;
+    sz = fixed_size;
+    allocate(_size);
+}
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::AutoBuffer(const AutoBuffer<_Tp, fixed_size>& abuf )
+{
+    ptr = buf;
+    sz = fixed_size;
+    allocate(abuf.size());
+    for( size_t i = 0; i < sz; i++ )
+        ptr[i] = abuf.ptr[i];
+}
+
+template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>&
+AutoBuffer<_Tp, fixed_size>::operator = (const AutoBuffer<_Tp, fixed_size>& abuf)
+{
+    if( this != &abuf )
+    {
+        deallocate();
+        allocate(abuf.size());
+        for( size_t i = 0; i < sz; i++ )
+            ptr[i] = abuf.ptr[i];
+    }
+    return *this;
+}
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::~AutoBuffer()
+{ deallocate(); }
+
+template<typename _Tp, size_t fixed_size> inline void
+AutoBuffer<_Tp, fixed_size>::allocate(size_t _size)
+{
+    if(_size <= sz)
+    {
+        sz = _size;
+        return;
+    }
+    deallocate();
+    if(_size > fixed_size)
+    {
+        ptr = new _Tp[_size];
+        sz = _size;
+    }
+}
+
+template<typename _Tp, size_t fixed_size> inline void
+AutoBuffer<_Tp, fixed_size>::deallocate()
+{
+    if( ptr != buf )
+    {
+        delete[] ptr;
+        ptr = buf;
+        sz = fixed_size;
+    }
+}
+
+template<typename _Tp, size_t fixed_size> inline void
+AutoBuffer<_Tp, fixed_size>::resize(size_t _size)
+{
+    if(_size <= sz)
+    {
+        sz = _size;
+        return;
+    }
+    size_t i, prevsize = sz, minsize = MIN(prevsize, _size);
+    _Tp* prevptr = ptr;
+
+    ptr = _size > fixed_size ? new _Tp[_size] : buf;
+    sz = _size;
+
+    if( ptr != prevptr )
+        for( i = 0; i < minsize; i++ )
+            ptr[i] = prevptr[i];
+    for( i = prevsize; i < _size; i++ )
+        ptr[i] = _Tp();
+
+    if( prevptr != buf )
+        delete[] prevptr;
+}
+
+template<typename _Tp, size_t fixed_size> inline size_t
+AutoBuffer<_Tp, fixed_size>::size() const
+{ return sz; }
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::operator _Tp* ()
+{ return ptr; }
+
+template<typename _Tp, size_t fixed_size> inline
+AutoBuffer<_Tp, fixed_size>::operator const _Tp* () const
+{ return ptr; }
+
+#ifndef OPENCV_NOSTL
+template<> inline std::string CommandLineParser::get<std::string>(int index, bool space_delete) const
+{
+    return get<String>(index, space_delete);
+}
+template<> inline std::string CommandLineParser::get<std::string>(const String& name, bool space_delete) const
+{
+    return get<String>(name, space_delete);
+}
+#endif // OPENCV_NOSTL
+
+//! @endcond
+
+} //namespace cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/core/core_c.h"
+#endif
+
+#endif //__OPENCV_CORE_UTILITY_H__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp
new file mode 100644
index 0000000..f4bb8a6
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/va_intel.hpp
@@ -0,0 +1,77 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// Copyright (C) 2015, Itseez, Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#ifndef __OPENCV_CORE_VA_INTEL_HPP__
+#define __OPENCV_CORE_VA_INTEL_HPP__
+
+#ifndef __cplusplus
+#  error va_intel.hpp header must be compiled as C++
+#endif
+
+#include "opencv2/core.hpp"
+#include "ocl.hpp"
+
+#if defined(HAVE_VA)
+# include "va/va.h"
+#else  // HAVE_VA
+# if !defined(_VA_H_)
+    typedef void* VADisplay;
+    typedef unsigned int VASurfaceID;
+# endif // !_VA_H_
+#endif // HAVE_VA
+
+namespace cv { namespace va_intel {
+
+/** @addtogroup core_va_intel
+This section describes Intel VA-API/OpenCL (CL-VA) interoperability.
+
+To enable CL-VA interoperability support, configure OpenCV using CMake with WITH_VA_INTEL=ON . Currently VA-API is
+supported on Linux only. You should also install Intel Media Server Studio (MSS) to use this feature. You may
+have to specify the path(s) to MSS components for cmake in environment variables: VA_INTEL_MSDK_ROOT for Media SDK
+(default is "/opt/intel/mediasdk"), and VA_INTEL_IOCL_ROOT for Intel OpenCL (default is "/opt/intel/opencl").
+
+To use CL-VA interoperability you should first create VADisplay (libva), and then call initializeContextFromVA()
+function to create OpenCL context and set up interoperability.
+*/
+//! @{
+
+/////////////////// CL-VA Interoperability Functions ///////////////////
+
+namespace ocl {
+using namespace cv::ocl;
+
+// TODO static functions in the Context class
+/** @brief Creates OpenCL context from VA.
+@param display    - VADisplay for which CL interop should be established.
+@param tryInterop - try to set up for interoperability, if true; set up for use slow copy if false.
+@return Returns reference to OpenCL Context
+ */
+CV_EXPORTS Context& initializeContextFromVA(VADisplay display, bool tryInterop = true);
+
+} // namespace cv::va_intel::ocl
+
+/** @brief Converts InputArray to VASurfaceID object.
+@param display - VADisplay object.
+@param src     - source InputArray.
+@param surface - destination VASurfaceID object.
+@param size    - size of image represented by VASurfaceID object.
+ */
+CV_EXPORTS void convertToVASurface(VADisplay display, InputArray src, VASurfaceID surface, Size size);
+
+/** @brief Converts VASurfaceID object to OutputArray.
+@param display - VADisplay object.
+@param surface - source VASurfaceID object.
+@param size    - size of image represented by VASurfaceID object.
+@param dst     - destination OutputArray.
+ */
+CV_EXPORTS void convertFromVASurface(VADisplay display, VASurfaceID surface, Size size, OutputArray dst);
+
+//! @}
+
+}} // namespace cv::va_intel
+
+#endif /* __OPENCV_CORE_VA_INTEL_HPP__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/version.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/version.hpp
new file mode 100644
index 0000000..cf1442b
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/version.hpp
@@ -0,0 +1,71 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright( C) 2000-2015, Intel Corporation, all rights reserved.
+// Copyright (C) 2011-2013, NVIDIA Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2015, Itseez 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 Intel Corporation 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*/
+
+/*
+  definition of the current version of OpenCV
+  Usefull to test in user programs
+*/
+
+#ifndef __OPENCV_VERSION_HPP__
+#define __OPENCV_VERSION_HPP__
+
+#define CV_VERSION_MAJOR    3
+#define CV_VERSION_MINOR    1
+#define CV_VERSION_REVISION 0
+#define CV_VERSION_STATUS   ""
+
+#define CVAUX_STR_EXP(__A)  #__A
+#define CVAUX_STR(__A)      CVAUX_STR_EXP(__A)
+
+#define CVAUX_STRW_EXP(__A)  L#__A
+#define CVAUX_STRW(__A)      CVAUX_STRW_EXP(__A)
+
+#define CV_VERSION          CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS
+
+/* old  style version constants*/
+#define CV_MAJOR_VERSION    CV_VERSION_MAJOR
+#define CV_MINOR_VERSION    CV_VERSION_MINOR
+#define CV_SUBMINOR_VERSION CV_VERSION_REVISION
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp
new file mode 100644
index 0000000..ef9d398
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/core/wimage.hpp
@@ -0,0 +1,603 @@
+/*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) 2008, Google, 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 Intel Corporation or contributors 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*/
+
+#ifndef __OPENCV_CORE_WIMAGE_HPP__
+#define __OPENCV_CORE_WIMAGE_HPP__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+
+namespace cv {
+
+//! @addtogroup core
+//! @{
+
+template <typename T> class WImage;
+template <typename T> class WImageBuffer;
+template <typename T> class WImageView;
+
+template<typename T, int C> class WImageC;
+template<typename T, int C> class WImageBufferC;
+template<typename T, int C> class WImageViewC;
+
+// Commonly used typedefs.
+typedef WImage<uchar>            WImage_b;
+typedef WImageView<uchar>        WImageView_b;
+typedef WImageBuffer<uchar>      WImageBuffer_b;
+
+typedef WImageC<uchar, 1>        WImage1_b;
+typedef WImageViewC<uchar, 1>    WImageView1_b;
+typedef WImageBufferC<uchar, 1>  WImageBuffer1_b;
+
+typedef WImageC<uchar, 3>        WImage3_b;
+typedef WImageViewC<uchar, 3>    WImageView3_b;
+typedef WImageBufferC<uchar, 3>  WImageBuffer3_b;
+
+typedef WImage<float>            WImage_f;
+typedef WImageView<float>        WImageView_f;
+typedef WImageBuffer<float>      WImageBuffer_f;
+
+typedef WImageC<float, 1>        WImage1_f;
+typedef WImageViewC<float, 1>    WImageView1_f;
+typedef WImageBufferC<float, 1>  WImageBuffer1_f;
+
+typedef WImageC<float, 3>        WImage3_f;
+typedef WImageViewC<float, 3>    WImageView3_f;
+typedef WImageBufferC<float, 3>  WImageBuffer3_f;
+
+// There isn't a standard for signed and unsigned short so be more
+// explicit in the typename for these cases.
+typedef WImage<short>            WImage_16s;
+typedef WImageView<short>        WImageView_16s;
+typedef WImageBuffer<short>      WImageBuffer_16s;
+
+typedef WImageC<short, 1>        WImage1_16s;
+typedef WImageViewC<short, 1>    WImageView1_16s;
+typedef WImageBufferC<short, 1>  WImageBuffer1_16s;
+
+typedef WImageC<short, 3>        WImage3_16s;
+typedef WImageViewC<short, 3>    WImageView3_16s;
+typedef WImageBufferC<short, 3>  WImageBuffer3_16s;
+
+typedef WImage<ushort>            WImage_16u;
+typedef WImageView<ushort>        WImageView_16u;
+typedef WImageBuffer<ushort>      WImageBuffer_16u;
+
+typedef WImageC<ushort, 1>        WImage1_16u;
+typedef WImageViewC<ushort, 1>    WImageView1_16u;
+typedef WImageBufferC<ushort, 1>  WImageBuffer1_16u;
+
+typedef WImageC<ushort, 3>        WImage3_16u;
+typedef WImageViewC<ushort, 3>    WImageView3_16u;
+typedef WImageBufferC<ushort, 3>  WImageBuffer3_16u;
+
+/** @brief Image class which provides a thin layer around an IplImage.
+
+The goals of the class design are:
+
+    -# All the data has explicit ownership to avoid memory leaks
+    -# No hidden allocations or copies for performance.
+    -# Easy access to OpenCV methods (which will access IPP if available)
+    -# Can easily treat external data as an image
+    -# Easy to create images which are subsets of other images
+    -# Fast pixel access which can take advantage of number of channels if known at compile time.
+
+The WImage class is the image class which provides the data accessors. The 'W' comes from the fact
+that it is also a wrapper around the popular but inconvenient IplImage class. A WImage can be
+constructed either using a WImageBuffer class which allocates and frees the data, or using a
+WImageView class which constructs a subimage or a view into external data. The view class does no
+memory management. Each class actually has two versions, one when the number of channels is known
+at compile time and one when it isn't. Using the one with the number of channels specified can
+provide some compile time optimizations by using the fact that the number of channels is a
+constant.
+
+We use the convention (c,r) to refer to column c and row r with (0,0) being the upper left corner.
+This is similar to standard Euclidean coordinates with the first coordinate varying in the
+horizontal direction and the second coordinate varying in the vertical direction. Thus (c,r) is
+usually in the domain [0, width) X [0, height)
+
+Example usage:
+@code
+WImageBuffer3_b  im(5,7);  // Make a 5X7 3 channel image of type uchar
+WImageView3_b  sub_im(im, 2,2, 3,3); // 3X3 submatrix
+vector<float> vec(10, 3.0f);
+WImageView1_f user_im(&vec[0], 2, 5);  // 2X5 image w/ supplied data
+
+im.SetZero();  // same as cvSetZero(im.Ipl())
+*im(2, 3) = 15;  // Modify the element at column 2, row 3
+MySetRand(&sub_im);
+
+// Copy the second row into the first.  This can be done with no memory
+// allocation and will use SSE if IPP is available.
+int w = im.Width();
+im.View(0,0, w,1).CopyFrom(im.View(0,1, w,1));
+
+// Doesn't care about source of data since using WImage
+void MySetRand(WImage_b* im) { // Works with any number of channels
+for (int r = 0; r < im->Height(); ++r) {
+ float* row = im->Row(r);
+ for (int c = 0; c < im->Width(); ++c) {
+    for (int ch = 0; ch < im->Channels(); ++ch, ++row) {
+      *row = uchar(rand() & 255);
+    }
+ }
+}
+}
+@endcode
+
+Functions that are not part of the basic image allocation, viewing, and access should come from
+OpenCV, except some useful functions that are not part of OpenCV can be found in wimage_util.h
+*/
+template<typename T>
+class WImage
+{
+public:
+    typedef T BaseType;
+
+    // WImage is an abstract class with no other virtual methods so make the
+    // destructor virtual.
+    virtual ~WImage() = 0;
+
+    // Accessors
+    IplImage* Ipl() {return image_; }
+    const IplImage* Ipl() const {return image_; }
+    T* ImageData() { return reinterpret_cast<T*>(image_->imageData); }
+    const T* ImageData() const {
+        return reinterpret_cast<const T*>(image_->imageData);
+    }
+
+    int Width() const {return image_->width; }
+    int Height() const {return image_->height; }
+
+    // WidthStep is the number of bytes to go to the pixel with the next y coord
+    int WidthStep() const {return image_->widthStep; }
+
+    int Channels() const {return image_->nChannels; }
+    int ChannelSize() const {return sizeof(T); }  // number of bytes per channel
+
+    // Number of bytes per pixel
+    int PixelSize() const {return Channels() * ChannelSize(); }
+
+    // Return depth type (e.g. IPL_DEPTH_8U, IPL_DEPTH_32F) which is the number
+    // of bits per channel and with the signed bit set.
+    // This is known at compile time using specializations.
+    int Depth() const;
+
+    inline const T* Row(int r) const {
+        return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep);
+    }
+
+    inline T* Row(int r) {
+        return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep);
+    }
+
+    // Pixel accessors which returns a pointer to the start of the channel
+    inline T* operator() (int c, int r)  {
+        return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep) +
+            c*Channels();
+    }
+
+    inline const T* operator() (int c, int r) const  {
+        return reinterpret_cast<T*>(image_->imageData + r*image_->widthStep) +
+            c*Channels();
+    }
+
+    // Copy the contents from another image which is just a convenience to cvCopy
+    void CopyFrom(const WImage<T>& src) { cvCopy(src.Ipl(), image_); }
+
+    // Set contents to zero which is just a convenient to cvSetZero
+    void SetZero() { cvSetZero(image_); }
+
+    // Construct a view into a region of this image
+    WImageView<T> View(int c, int r, int width, int height);
+
+protected:
+    // Disallow copy and assignment
+    WImage(const WImage&);
+    void operator=(const WImage&);
+
+    explicit WImage(IplImage* img) : image_(img) {
+        assert(!img || img->depth == Depth());
+    }
+
+    void SetIpl(IplImage* image) {
+        assert(!image || image->depth == Depth());
+        image_ = image;
+    }
+
+    IplImage* image_;
+};
+
+
+/** Image class when both the pixel type and number of channels
+are known at compile time.  This wrapper will speed up some of the operations
+like accessing individual pixels using the () operator.
+*/
+template<typename T, int C>
+class WImageC : public WImage<T>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+    enum { kChannels = C };
+
+    explicit WImageC(IplImage* img) : WImage<T>(img) {
+        assert(!img || img->nChannels == Channels());
+    }
+
+    // Construct a view into a region of this image
+    WImageViewC<T, C> View(int c, int r, int width, int height);
+
+    // Copy the contents from another image which is just a convenience to cvCopy
+    void CopyFrom(const WImageC<T, C>& src) {
+        cvCopy(src.Ipl(), WImage<T>::image_);
+    }
+
+    // WImageC is an abstract class with no other virtual methods so make the
+    // destructor virtual.
+    virtual ~WImageC() = 0;
+
+    int Channels() const {return C; }
+
+protected:
+    // Disallow copy and assignment
+    WImageC(const WImageC&);
+    void operator=(const WImageC&);
+
+    void SetIpl(IplImage* image) {
+        assert(!image || image->depth == WImage<T>::Depth());
+        WImage<T>::SetIpl(image);
+    }
+};
+
+/** Image class which owns the data, so it can be allocated and is always
+freed.  It cannot be copied but can be explicity cloned.
+*/
+template<typename T>
+class WImageBuffer : public WImage<T>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+
+    // Default constructor which creates an object that can be
+    WImageBuffer() : WImage<T>(0) {}
+
+    WImageBuffer(int width, int height, int nchannels) : WImage<T>(0) {
+        Allocate(width, height, nchannels);
+    }
+
+    // Constructor which takes ownership of a given IplImage so releases
+    // the image on destruction.
+    explicit WImageBuffer(IplImage* img) : WImage<T>(img) {}
+
+    // Allocate an image.  Does nothing if current size is the same as
+    // the new size.
+    void Allocate(int width, int height, int nchannels);
+
+    // Set the data to point to an image, releasing the old data
+    void SetIpl(IplImage* img) {
+        ReleaseImage();
+        WImage<T>::SetIpl(img);
+    }
+
+    // Clone an image which reallocates the image if of a different dimension.
+    void CloneFrom(const WImage<T>& src) {
+        Allocate(src.Width(), src.Height(), src.Channels());
+        CopyFrom(src);
+    }
+
+    ~WImageBuffer() {
+        ReleaseImage();
+    }
+
+    // Release the image if it isn't null.
+    void ReleaseImage() {
+        if (WImage<T>::image_) {
+            IplImage* image = WImage<T>::image_;
+            cvReleaseImage(&image);
+            WImage<T>::SetIpl(0);
+        }
+    }
+
+    bool IsNull() const {return WImage<T>::image_ == NULL; }
+
+private:
+    // Disallow copy and assignment
+    WImageBuffer(const WImageBuffer&);
+    void operator=(const WImageBuffer&);
+};
+
+/** Like a WImageBuffer class but when the number of channels is known at compile time.
+*/
+template<typename T, int C>
+class WImageBufferC : public WImageC<T, C>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+    enum { kChannels = C };
+
+    // Default constructor which creates an object that can be
+    WImageBufferC() : WImageC<T, C>(0) {}
+
+    WImageBufferC(int width, int height) : WImageC<T, C>(0) {
+        Allocate(width, height);
+    }
+
+    // Constructor which takes ownership of a given IplImage so releases
+    // the image on destruction.
+    explicit WImageBufferC(IplImage* img) : WImageC<T, C>(img) {}
+
+    // Allocate an image.  Does nothing if current size is the same as
+    // the new size.
+    void Allocate(int width, int height);
+
+    // Set the data to point to an image, releasing the old data
+    void SetIpl(IplImage* img) {
+        ReleaseImage();
+        WImageC<T, C>::SetIpl(img);
+    }
+
+    // Clone an image which reallocates the image if of a different dimension.
+    void CloneFrom(const WImageC<T, C>& src) {
+        Allocate(src.Width(), src.Height());
+        CopyFrom(src);
+    }
+
+    ~WImageBufferC() {
+        ReleaseImage();
+    }
+
+    // Release the image if it isn't null.
+    void ReleaseImage() {
+        if (WImage<T>::image_) {
+            IplImage* image = WImage<T>::image_;
+            cvReleaseImage(&image);
+            WImageC<T, C>::SetIpl(0);
+        }
+    }
+
+    bool IsNull() const {return WImage<T>::image_ == NULL; }
+
+private:
+    // Disallow copy and assignment
+    WImageBufferC(const WImageBufferC&);
+    void operator=(const WImageBufferC&);
+};
+
+/** View into an image class which allows treating a subimage as an image or treating external data
+as an image
+*/
+template<typename T> class WImageView : public WImage<T>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+
+    // Construct a subimage.  No checks are done that the subimage lies
+    // completely inside the original image.
+    WImageView(WImage<T>* img, int c, int r, int width, int height);
+
+    // Refer to external data.
+    // If not given width_step assumed to be same as width.
+    WImageView(T* data, int width, int height, int channels, int width_step = -1);
+
+    // Refer to external data.  This does NOT take ownership
+    // of the supplied IplImage.
+    WImageView(IplImage* img) : WImage<T>(img) {}
+
+    // Copy constructor
+    WImageView(const WImage<T>& img) : WImage<T>(0) {
+        header_ = *(img.Ipl());
+        WImage<T>::SetIpl(&header_);
+    }
+
+    WImageView& operator=(const WImage<T>& img) {
+        header_ = *(img.Ipl());
+        WImage<T>::SetIpl(&header_);
+        return *this;
+    }
+
+protected:
+    IplImage header_;
+};
+
+
+template<typename T, int C>
+class WImageViewC : public WImageC<T, C>
+{
+public:
+    typedef typename WImage<T>::BaseType BaseType;
+    enum { kChannels = C };
+
+    // Default constructor needed for vectors of views.
+    WImageViewC();
+
+    virtual ~WImageViewC() {}
+
+    // Construct a subimage.  No checks are done that the subimage lies
+    // completely inside the original image.
+    WImageViewC(WImageC<T, C>* img,
+        int c, int r, int width, int height);
+
+    // Refer to external data
+    WImageViewC(T* data, int width, int height, int width_step = -1);
+
+    // Refer to external data.  This does NOT take ownership
+    // of the supplied IplImage.
+    WImageViewC(IplImage* img) : WImageC<T, C>(img) {}
+
+    // Copy constructor which does a shallow copy to allow multiple views
+    // of same data.  gcc-4.1.1 gets confused if both versions of
+    // the constructor and assignment operator are not provided.
+    WImageViewC(const WImageC<T, C>& img) : WImageC<T, C>(0) {
+        header_ = *(img.Ipl());
+        WImageC<T, C>::SetIpl(&header_);
+    }
+    WImageViewC(const WImageViewC<T, C>& img) : WImageC<T, C>(0) {
+        header_ = *(img.Ipl());
+        WImageC<T, C>::SetIpl(&header_);
+    }
+
+    WImageViewC& operator=(const WImageC<T, C>& img) {
+        header_ = *(img.Ipl());
+        WImageC<T, C>::SetIpl(&header_);
+        return *this;
+    }
+    WImageViewC& operator=(const WImageViewC<T, C>& img) {
+        header_ = *(img.Ipl());
+        WImageC<T, C>::SetIpl(&header_);
+        return *this;
+    }
+
+protected:
+    IplImage header_;
+};
+
+
+// Specializations for depth
+template<>
+inline int WImage<uchar>::Depth() const {return IPL_DEPTH_8U; }
+template<>
+inline int WImage<signed char>::Depth() const {return IPL_DEPTH_8S; }
+template<>
+inline int WImage<short>::Depth() const {return IPL_DEPTH_16S; }
+template<>
+inline int WImage<ushort>::Depth() const {return IPL_DEPTH_16U; }
+template<>
+inline int WImage<int>::Depth() const {return IPL_DEPTH_32S; }
+template<>
+inline int WImage<float>::Depth() const {return IPL_DEPTH_32F; }
+template<>
+inline int WImage<double>::Depth() const {return IPL_DEPTH_64F; }
+
+template<typename T> inline WImage<T>::~WImage() {}
+template<typename T, int C> inline WImageC<T, C>::~WImageC() {}
+
+template<typename T>
+inline void WImageBuffer<T>::Allocate(int width, int height, int nchannels)
+{
+    if (IsNull() || WImage<T>::Width() != width ||
+        WImage<T>::Height() != height || WImage<T>::Channels() != nchannels) {
+        ReleaseImage();
+        WImage<T>::image_ = cvCreateImage(cvSize(width, height),
+            WImage<T>::Depth(), nchannels);
+    }
+}
+
+template<typename T, int C>
+inline void WImageBufferC<T, C>::Allocate(int width, int height)
+{
+    if (IsNull() || WImage<T>::Width() != width || WImage<T>::Height() != height) {
+        ReleaseImage();
+        WImageC<T, C>::SetIpl(cvCreateImage(cvSize(width, height),WImage<T>::Depth(), C));
+    }
+}
+
+template<typename T>
+WImageView<T>::WImageView(WImage<T>* img, int c, int r, int width, int height)
+        : WImage<T>(0)
+{
+    header_ = *(img->Ipl());
+    header_.imageData = reinterpret_cast<char*>((*img)(c, r));
+    header_.width = width;
+    header_.height = height;
+    WImage<T>::SetIpl(&header_);
+}
+
+template<typename T>
+WImageView<T>::WImageView(T* data, int width, int height, int nchannels, int width_step)
+          : WImage<T>(0)
+{
+    cvInitImageHeader(&header_, cvSize(width, height), WImage<T>::Depth(), nchannels);
+    header_.imageData = reinterpret_cast<char*>(data);
+    if (width_step > 0) {
+        header_.widthStep = width_step;
+    }
+    WImage<T>::SetIpl(&header_);
+}
+
+template<typename T, int C>
+WImageViewC<T, C>::WImageViewC(WImageC<T, C>* img, int c, int r, int width, int height)
+        : WImageC<T, C>(0)
+{
+    header_ = *(img->Ipl());
+    header_.imageData = reinterpret_cast<char*>((*img)(c, r));
+    header_.width = width;
+    header_.height = height;
+    WImageC<T, C>::SetIpl(&header_);
+}
+
+template<typename T, int C>
+WImageViewC<T, C>::WImageViewC() : WImageC<T, C>(0) {
+    cvInitImageHeader(&header_, cvSize(0, 0), WImage<T>::Depth(), C);
+    header_.imageData = reinterpret_cast<char*>(0);
+    WImageC<T, C>::SetIpl(&header_);
+}
+
+template<typename T, int C>
+WImageViewC<T, C>::WImageViewC(T* data, int width, int height, int width_step)
+    : WImageC<T, C>(0)
+{
+    cvInitImageHeader(&header_, cvSize(width, height), WImage<T>::Depth(), C);
+    header_.imageData = reinterpret_cast<char*>(data);
+    if (width_step > 0) {
+        header_.widthStep = width_step;
+    }
+    WImageC<T, C>::SetIpl(&header_);
+}
+
+// Construct a view into a region of an image
+template<typename T>
+WImageView<T> WImage<T>::View(int c, int r, int width, int height) {
+    return WImageView<T>(this, c, r, width, height);
+}
+
+template<typename T, int C>
+WImageViewC<T, C> WImageC<T, C>::View(int c, int r, int width, int height) {
+    return WImageViewC<T, C>(this, c, r, width, height);
+}
+
+//! @} core
+
+}  // end of namespace
+
+#endif // __cplusplus
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/cvconfig.h b/Lib/OpenCV/opencv_3.1/include/opencv2/cvconfig.h
new file mode 100644
index 0000000..da75317
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/cvconfig.h
@@ -0,0 +1,196 @@
+/* OpenCV compiled as static or dynamic libs */
+#define BUILD_SHARED_LIBS
+
+/* Compile for 'real' NVIDIA GPU architectures */
+#define CUDA_ARCH_BIN ""
+
+/* Create PTX or BIN for 1.0 compute capability */
+/* #undef CUDA_ARCH_BIN_OR_PTX_10 */
+
+/* NVIDIA GPU features are used */
+#define CUDA_ARCH_FEATURES ""
+
+/* Compile for 'virtual' NVIDIA PTX architectures */
+#define CUDA_ARCH_PTX ""
+
+/* AVFoundation video libraries */
+/* #undef HAVE_AVFOUNDATION */
+
+/* V4L capturing support */
+/* #undef HAVE_CAMV4L */
+
+/* V4L2 capturing support */
+/* #undef HAVE_CAMV4L2 */
+
+/* Carbon windowing environment */
+/* #undef HAVE_CARBON */
+
+/* AMD's Basic Linear Algebra Subprograms Library*/
+#define HAVE_CLAMDBLAS
+
+/* AMD's OpenCL Fast Fourier Transform Library*/
+#define HAVE_CLAMDFFT
+
+/* Clp support */
+/* #undef HAVE_CLP */
+
+/* Cocoa API */
+/* #undef HAVE_COCOA */
+
+/* C= */
+/* #undef HAVE_CSTRIPES */
+
+/* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/
+/* #undef HAVE_CUBLAS */
+
+/* NVidia Cuda Runtime API*/
+/* #undef HAVE_CUDA */
+
+/* NVidia Cuda Fast Fourier Transform (FFT) API*/
+/* #undef HAVE_CUFFT */
+
+/* IEEE1394 capturing support */
+/* #undef HAVE_DC1394 */
+
+/* IEEE1394 capturing support - libdc1394 v2.x */
+/* #undef HAVE_DC1394_2 */
+
+/* DirectX */
+#define HAVE_DIRECTX
+#define HAVE_DIRECTX_NV12
+#define HAVE_D3D11
+#define HAVE_D3D10
+#define HAVE_D3D9
+
+/* DirectShow Video Capture library */
+#define HAVE_DSHOW
+
+/* Eigen Matrix & Linear Algebra Library */
+/* #undef HAVE_EIGEN */
+
+/* FFMpeg video library */
+#define HAVE_FFMPEG
+
+/* ffmpeg's libswscale */
+#define HAVE_FFMPEG_SWSCALE
+
+/* ffmpeg in Gentoo */
+#define HAVE_GENTOO_FFMPEG
+
+/* Geospatial Data Abstraction Library */
+/* #undef HAVE_GDAL */
+
+/* GStreamer multimedia framework */
+/* #undef HAVE_GSTREAMER */
+
+/* GTK+ 2.0 Thread support */
+/* #undef HAVE_GTHREAD */
+
+/* GTK+ 2.x toolkit */
+/* #undef HAVE_GTK */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Intel Perceptual Computing SDK library */
+/* #undef HAVE_INTELPERC */
+
+/* Intel Integrated Performance Primitives */
+#define HAVE_IPP
+#define HAVE_IPP_ICV_ONLY
+
+/* Intel IPP Async */
+/* #undef HAVE_IPP_A */
+
+/* JPEG-2000 codec */
+#define HAVE_JASPER
+
+/* IJG JPEG codec */
+#define HAVE_JPEG
+
+/* libpng/png.h needs to be included */
+/* #undef HAVE_LIBPNG_PNG_H */
+
+/* V4L/V4L2 capturing support via libv4l */
+/* #undef HAVE_LIBV4L */
+
+/* Microsoft Media Foundation Capture library */
+/* #undef HAVE_MSMF */
+
+/* NVidia Video Decoding API*/
+/* #undef HAVE_NVCUVID */
+
+/* OpenCL Support */
+#define HAVE_OPENCL
+/* #undef HAVE_OPENCL_STATIC */
+/* #undef HAVE_OPENCL_SVM */
+
+/* OpenEXR codec */
+#define HAVE_OPENEXR
+
+/* OpenGL support*/
+/* #undef HAVE_OPENGL */
+
+/* OpenNI library */
+/* #undef HAVE_OPENNI */
+
+/* OpenNI library */
+/* #undef HAVE_OPENNI2 */
+
+/* PNG codec */
+#define HAVE_PNG
+
+/* Posix threads (pthreads) */
+/* #undef HAVE_PTHREADS */
+
+/* parallel_for with pthreads */
+/* #undef HAVE_PTHREADS_PF */
+
+/* Qt support */
+/* #undef HAVE_QT */
+
+/* Qt OpenGL support */
+/* #undef HAVE_QT_OPENGL */
+
+/* QuickTime video libraries */
+/* #undef HAVE_QUICKTIME */
+
+/* QTKit video libraries */
+/* #undef HAVE_QTKIT */
+
+/* Intel Threading Building Blocks */
+/* #undef HAVE_TBB */
+
+/* TIFF codec */
+#define HAVE_TIFF
+
+/* Unicap video capture library */
+/* #undef HAVE_UNICAP */
+
+/* Video for Windows support */
+#define HAVE_VFW
+
+/* V4L2 capturing support in videoio.h */
+/* #undef HAVE_VIDEOIO */
+
+/* Win32 UI */
+#define HAVE_WIN32UI
+
+/* XIMEA camera support */
+/* #undef HAVE_XIMEA */
+
+/* Xine video library */
+/* #undef HAVE_XINE */
+
+/* Define if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* gPhoto2 library */
+/* #undef HAVE_GPHOTO2 */
+
+/* VA library (libva) */
+/* #undef HAVE_VA */
+
+/* Intel VA-API/OpenCL */
+/* #undef HAVE_VA_INTEL */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/features2d.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/features2d.hpp
new file mode 100644
index 0000000..692d3d9
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/features2d.hpp
@@ -0,0 +1,1325 @@
+/*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*/
+
+#ifndef __OPENCV_FEATURES_2D_HPP__
+#define __OPENCV_FEATURES_2D_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/flann/miniflann.hpp"
+
+/**
+  @defgroup features2d 2D Features Framework
+  @{
+    @defgroup features2d_main Feature Detection and Description
+    @defgroup features2d_match Descriptor Matchers
+
+Matchers of keypoint descriptors in OpenCV have wrappers with a common interface that enables you to
+easily switch between different algorithms solving the same problem. This section is devoted to
+matching descriptors that are represented as vectors in a multidimensional space. All objects that
+implement vector descriptor matchers inherit the DescriptorMatcher interface.
+
+@note
+   -   An example explaining keypoint matching can be found at
+        opencv_source_code/samples/cpp/descriptor_extractor_matcher.cpp
+    -   An example on descriptor matching evaluation can be found at
+        opencv_source_code/samples/cpp/detector_descriptor_matcher_evaluation.cpp
+    -   An example on one to many image matching can be found at
+        opencv_source_code/samples/cpp/matching_to_many_images.cpp
+
+    @defgroup features2d_draw Drawing Function of Keypoints and Matches
+    @defgroup features2d_category Object Categorization
+
+This section describes approaches based on local 2D features and used to categorize objects.
+
+@note
+   -   A complete Bag-Of-Words sample can be found at
+        opencv_source_code/samples/cpp/bagofwords_classification.cpp
+    -   (Python) An example using the features2D framework to perform object categorization can be
+        found at opencv_source_code/samples/python/find_obj.py
+
+  @}
+ */
+
+namespace cv
+{
+
+//! @addtogroup features2d
+//! @{
+
+// //! writes vector of keypoints to the file storage
+// CV_EXPORTS void write(FileStorage& fs, const String& name, const std::vector<KeyPoint>& keypoints);
+// //! reads vector of keypoints from the specified file storage node
+// CV_EXPORTS void read(const FileNode& node, CV_OUT std::vector<KeyPoint>& keypoints);
+
+/** @brief A class filters a vector of keypoints.
+
+ Because now it is difficult to provide a convenient interface for all usage scenarios of the
+ keypoints filter class, it has only several needed by now static methods.
+ */
+class CV_EXPORTS KeyPointsFilter
+{
+public:
+    KeyPointsFilter(){}
+
+    /*
+     * Remove keypoints within borderPixels of an image edge.
+     */
+    static void runByImageBorder( std::vector<KeyPoint>& keypoints, Size imageSize, int borderSize );
+    /*
+     * Remove keypoints of sizes out of range.
+     */
+    static void runByKeypointSize( std::vector<KeyPoint>& keypoints, float minSize,
+                                   float maxSize=FLT_MAX );
+    /*
+     * Remove keypoints from some image by mask for pixels of this image.
+     */
+    static void runByPixelsMask( std::vector<KeyPoint>& keypoints, const Mat& mask );
+    /*
+     * Remove duplicated keypoints.
+     */
+    static void removeDuplicated( std::vector<KeyPoint>& keypoints );
+
+    /*
+     * Retain the specified number of the best keypoints (according to the response)
+     */
+    static void retainBest( std::vector<KeyPoint>& keypoints, int npoints );
+};
+
+
+/************************************ Base Classes ************************************/
+
+/** @brief Abstract base class for 2D image feature detectors and descriptor extractors
+*/
+class CV_EXPORTS_W Feature2D : public virtual Algorithm
+{
+public:
+    virtual ~Feature2D();
+
+    /** @brief Detects keypoints in an image (first variant) or image set (second variant).
+
+    @param image Image.
+    @param keypoints The detected keypoints. In the second variant of the method keypoints[i] is a set
+    of keypoints detected in images[i] .
+    @param mask Mask specifying where to look for keypoints (optional). It must be a 8-bit integer
+    matrix with non-zero values in the region of interest.
+     */
+    CV_WRAP virtual void detect( InputArray image,
+                                 CV_OUT std::vector<KeyPoint>& keypoints,
+                                 InputArray mask=noArray() );
+
+    /** @overload
+    @param images Image set.
+    @param keypoints The detected keypoints. In the second variant of the method keypoints[i] is a set
+    of keypoints detected in images[i] .
+    @param masks Masks for each input image specifying where to look for keypoints (optional).
+    masks[i] is a mask for images[i].
+    */
+    virtual void detect( InputArrayOfArrays images,
+                         std::vector<std::vector<KeyPoint> >& keypoints,
+                         InputArrayOfArrays masks=noArray() );
+
+    /** @brief Computes the descriptors for a set of keypoints detected in an image (first variant) or image set
+    (second variant).
+
+    @param image Image.
+    @param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be
+    computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint
+    with several dominant orientations (for each orientation).
+    @param descriptors Computed descriptors. In the second variant of the method descriptors[i] are
+    descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the
+    descriptor for keypoint j-th keypoint.
+     */
+    CV_WRAP virtual void compute( InputArray image,
+                                  CV_OUT CV_IN_OUT std::vector<KeyPoint>& keypoints,
+                                  OutputArray descriptors );
+
+    /** @overload
+
+    @param images Image set.
+    @param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot be
+    computed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint
+    with several dominant orientations (for each orientation).
+    @param descriptors Computed descriptors. In the second variant of the method descriptors[i] are
+    descriptors computed for a keypoints[i]. Row j is the keypoints (or keypoints[i]) is the
+    descriptor for keypoint j-th keypoint.
+    */
+    virtual void compute( InputArrayOfArrays images,
+                          std::vector<std::vector<KeyPoint> >& keypoints,
+                          OutputArrayOfArrays descriptors );
+
+    /** Detects keypoints and computes the descriptors */
+    CV_WRAP virtual void detectAndCompute( InputArray image, InputArray mask,
+                                           CV_OUT std::vector<KeyPoint>& keypoints,
+                                           OutputArray descriptors,
+                                           bool useProvidedKeypoints=false );
+
+    CV_WRAP virtual int descriptorSize() const;
+    CV_WRAP virtual int descriptorType() const;
+    CV_WRAP virtual int defaultNorm() const;
+
+    //! Return true if detector object is empty
+    CV_WRAP virtual bool empty() const;
+};
+
+/** Feature detectors in OpenCV have wrappers with a common interface that enables you to easily switch
+between different algorithms solving the same problem. All objects that implement keypoint detectors
+inherit the FeatureDetector interface. */
+typedef Feature2D FeatureDetector;
+
+/** Extractors of keypoint descriptors in OpenCV have wrappers with a common interface that enables you
+to easily switch between different algorithms solving the same problem. This section is devoted to
+computing descriptors represented as vectors in a multidimensional space. All objects that implement
+the vector descriptor extractors inherit the DescriptorExtractor interface.
+ */
+typedef Feature2D DescriptorExtractor;
+
+//! @addtogroup features2d_main
+//! @{
+
+/** @brief Class implementing the BRISK keypoint detector and descriptor extractor, described in @cite LCS11 .
+ */
+class CV_EXPORTS_W BRISK : public Feature2D
+{
+public:
+    /** @brief The BRISK constructor
+
+    @param thresh AGAST detection threshold score.
+    @param octaves detection octaves. Use 0 to do single scale.
+    @param patternScale apply this scale to the pattern used for sampling the neighbourhood of a
+    keypoint.
+     */
+    CV_WRAP static Ptr<BRISK> create(int thresh=30, int octaves=3, float patternScale=1.0f);
+
+    /** @brief The BRISK constructor for a custom pattern
+
+    @param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
+    keypoint scale 1).
+    @param numberList defines the number of sampling points on the sampling circle. Must be the same
+    size as radiusList..
+    @param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
+    scale 1).
+    @param dMin threshold for the long pairings used for orientation determination (in pixels for
+    keypoint scale 1).
+    @param indexChange index remapping of the bits. */
+    CV_WRAP static Ptr<BRISK> create(const std::vector<float> &radiusList, const std::vector<int> &numberList,
+        float dMax=5.85f, float dMin=8.2f, const std::vector<int>& indexChange=std::vector<int>());
+};
+
+/** @brief Class implementing the ORB (*oriented BRIEF*) keypoint detector and descriptor extractor
+
+described in @cite RRKB11 . The algorithm uses FAST in pyramids to detect stable keypoints, selects
+the strongest features using FAST or Harris response, finds their orientation using first-order
+moments and computes the descriptors using BRIEF (where the coordinates of random point pairs (or
+k-tuples) are rotated according to the measured orientation).
+ */
+class CV_EXPORTS_W ORB : public Feature2D
+{
+public:
+    enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };
+
+    /** @brief The ORB constructor
+
+    @param nfeatures The maximum number of features to retain.
+    @param scaleFactor Pyramid decimation ratio, greater than 1. scaleFactor==2 means the classical
+    pyramid, where each next level has 4x less pixels than the previous, but such a big scale factor
+    will degrade feature matching scores dramatically. On the other hand, too close to 1 scale factor
+    will mean that to cover certain scale range you will need more pyramid levels and so the speed
+    will suffer.
+    @param nlevels The number of pyramid levels. The smallest level will have linear size equal to
+    input_image_linear_size/pow(scaleFactor, nlevels).
+    @param edgeThreshold This is size of the border where the features are not detected. It should
+    roughly match the patchSize parameter.
+    @param firstLevel It should be 0 in the current implementation.
+    @param WTA_K The number of points that produce each element of the oriented BRIEF descriptor. The
+    default value 2 means the BRIEF where we take a random point pair and compare their brightnesses,
+    so we get 0/1 response. Other possible values are 3 and 4. For example, 3 means that we take 3
+    random points (of course, those point coordinates are random, but they are generated from the
+    pre-defined seed, so each element of BRIEF descriptor is computed deterministically from the pixel
+    rectangle), find point of maximum brightness and output index of the winner (0, 1 or 2). Such
+    output will occupy 2 bits, and therefore it will need a special variant of Hamming distance,
+    denoted as NORM_HAMMING2 (2 bits per bin). When WTA_K=4, we take 4 random points to compute each
+    bin (that will also occupy 2 bits with possible values 0, 1, 2 or 3).
+    @param scoreType The default HARRIS_SCORE means that Harris algorithm is used to rank features
+    (the score is written to KeyPoint::score and is used to retain best nfeatures features);
+    FAST_SCORE is alternative value of the parameter that produces slightly less stable keypoints,
+    but it is a little faster to compute.
+    @param patchSize size of the patch used by the oriented BRIEF descriptor. Of course, on smaller
+    pyramid layers the perceived image area covered by a feature will be larger.
+    @param fastThreshold
+     */
+    CV_WRAP static Ptr<ORB> create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31,
+        int firstLevel=0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20);
+
+    CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
+    CV_WRAP virtual int getMaxFeatures() const = 0;
+
+    CV_WRAP virtual void setScaleFactor(double scaleFactor) = 0;
+    CV_WRAP virtual double getScaleFactor() const = 0;
+
+    CV_WRAP virtual void setNLevels(int nlevels) = 0;
+    CV_WRAP virtual int getNLevels() const = 0;
+
+    CV_WRAP virtual void setEdgeThreshold(int edgeThreshold) = 0;
+    CV_WRAP virtual int getEdgeThreshold() const = 0;
+
+    CV_WRAP virtual void setFirstLevel(int firstLevel) = 0;
+    CV_WRAP virtual int getFirstLevel() const = 0;
+
+    CV_WRAP virtual void setWTA_K(int wta_k) = 0;
+    CV_WRAP virtual int getWTA_K() const = 0;
+
+    CV_WRAP virtual void setScoreType(int scoreType) = 0;
+    CV_WRAP virtual int getScoreType() const = 0;
+
+    CV_WRAP virtual void setPatchSize(int patchSize) = 0;
+    CV_WRAP virtual int getPatchSize() const = 0;
+
+    CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0;
+    CV_WRAP virtual int getFastThreshold() const = 0;
+};
+
+/** @brief Maximally stable extremal region extractor
+
+The class encapsulates all the parameters of the %MSER extraction algorithm (see [wiki
+article](http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions)).
+
+- there are two different implementation of %MSER: one for grey image, one for color image
+
+- the grey image algorithm is taken from: @cite nister2008linear ;  the paper claims to be faster
+than union-find method; it actually get 1.5~2m/s on my centrino L7200 1.2GHz laptop.
+
+- the color image algorithm is taken from: @cite forssen2007maximally ; it should be much slower
+than grey image method ( 3~4 times ); the chi_table.h file is taken directly from paper's source
+code which is distributed under GPL.
+
+- (Python) A complete example showing the use of the %MSER detector can be found at samples/python/mser.py
+*/
+class CV_EXPORTS_W MSER : public Feature2D
+{
+public:
+    /** @brief Full consturctor for %MSER detector
+
+    @param _delta it compares \f$(size_{i}-size_{i-delta})/size_{i-delta}\f$
+    @param _min_area prune the area which smaller than minArea
+    @param _max_area prune the area which bigger than maxArea
+    @param _max_variation prune the area have simliar size to its children
+    @param _min_diversity for color image, trace back to cut off mser with diversity less than min_diversity
+    @param _max_evolution  for color image, the evolution steps
+    @param _area_threshold for color image, the area threshold to cause re-initialize
+    @param _min_margin for color image, ignore too small margin
+    @param _edge_blur_size for color image, the aperture size for edge blur
+     */
+    CV_WRAP static Ptr<MSER> create( int _delta=5, int _min_area=60, int _max_area=14400,
+          double _max_variation=0.25, double _min_diversity=.2,
+          int _max_evolution=200, double _area_threshold=1.01,
+          double _min_margin=0.003, int _edge_blur_size=5 );
+
+    /** @brief Detect %MSER regions
+
+    @param image input image (8UC1, 8UC3 or 8UC4)
+    @param msers resulting list of point sets
+    @param bboxes resulting bounding boxes
+    */
+    CV_WRAP virtual void detectRegions( InputArray image,
+                                        CV_OUT std::vector<std::vector<Point> >& msers,
+                                        std::vector<Rect>& bboxes ) = 0;
+
+    CV_WRAP virtual void setDelta(int delta) = 0;
+    CV_WRAP virtual int getDelta() const = 0;
+
+    CV_WRAP virtual void setMinArea(int minArea) = 0;
+    CV_WRAP virtual int getMinArea() const = 0;
+
+    CV_WRAP virtual void setMaxArea(int maxArea) = 0;
+    CV_WRAP virtual int getMaxArea() const = 0;
+
+    CV_WRAP virtual void setPass2Only(bool f) = 0;
+    CV_WRAP virtual bool getPass2Only() const = 0;
+};
+
+/** @overload */
+CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
+                      int threshold, bool nonmaxSuppression=true );
+
+/** @brief Detects corners using the FAST algorithm
+
+@param image grayscale image where keypoints (corners) are detected.
+@param keypoints keypoints detected on the image.
+@param threshold threshold on difference between intensity of the central pixel and pixels of a
+circle around this pixel.
+@param nonmaxSuppression if true, non-maximum suppression is applied to detected corners
+(keypoints).
+@param type one of the three neighborhoods as defined in the paper:
+FastFeatureDetector::TYPE_9_16, FastFeatureDetector::TYPE_7_12,
+FastFeatureDetector::TYPE_5_8
+
+Detects corners using the FAST algorithm by @cite Rosten06 .
+
+@note In Python API, types are given as cv2.FAST_FEATURE_DETECTOR_TYPE_5_8,
+cv2.FAST_FEATURE_DETECTOR_TYPE_7_12 and cv2.FAST_FEATURE_DETECTOR_TYPE_9_16. For corner
+detection, use cv2.FAST.detect() method.
+ */
+CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
+                      int threshold, bool nonmaxSuppression, int type );
+
+//! @} features2d_main
+
+//! @addtogroup features2d_main
+//! @{
+
+/** @brief Wrapping class for feature detection using the FAST method. :
+ */
+class CV_EXPORTS_W FastFeatureDetector : public Feature2D
+{
+public:
+    enum
+    {
+        TYPE_5_8 = 0, TYPE_7_12 = 1, TYPE_9_16 = 2,
+        THRESHOLD = 10000, NONMAX_SUPPRESSION=10001, FAST_N=10002,
+    };
+
+    CV_WRAP static Ptr<FastFeatureDetector> create( int threshold=10,
+                                                    bool nonmaxSuppression=true,
+                                                    int type=FastFeatureDetector::TYPE_9_16 );
+
+    CV_WRAP virtual void setThreshold(int threshold) = 0;
+    CV_WRAP virtual int getThreshold() const = 0;
+
+    CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
+    CV_WRAP virtual bool getNonmaxSuppression() const = 0;
+
+    CV_WRAP virtual void setType(int type) = 0;
+    CV_WRAP virtual int getType() const = 0;
+};
+
+/** @overload */
+CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
+                      int threshold, bool nonmaxSuppression=true );
+
+/** @brief Detects corners using the AGAST algorithm
+
+@param image grayscale image where keypoints (corners) are detected.
+@param keypoints keypoints detected on the image.
+@param threshold threshold on difference between intensity of the central pixel and pixels of a
+circle around this pixel.
+@param nonmaxSuppression if true, non-maximum suppression is applied to detected corners
+(keypoints).
+@param type one of the four neighborhoods as defined in the paper:
+AgastFeatureDetector::AGAST_5_8, AgastFeatureDetector::AGAST_7_12d,
+AgastFeatureDetector::AGAST_7_12s, AgastFeatureDetector::OAST_9_16
+
+For non-Intel platforms, there is a tree optimised variant of AGAST with same numerical results.
+The 32-bit binary tree tables were generated automatically from original code using perl script.
+The perl script and examples of tree generation are placed in features2d/doc folder.
+Detects corners using the AGAST algorithm by @cite mair2010_agast .
+
+ */
+CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
+                      int threshold, bool nonmaxSuppression, int type );
+//! @} features2d_main
+
+//! @addtogroup features2d_main
+//! @{
+
+/** @brief Wrapping class for feature detection using the AGAST method. :
+ */
+class CV_EXPORTS_W AgastFeatureDetector : public Feature2D
+{
+public:
+    enum
+    {
+        AGAST_5_8 = 0, AGAST_7_12d = 1, AGAST_7_12s = 2, OAST_9_16 = 3,
+        THRESHOLD = 10000, NONMAX_SUPPRESSION = 10001,
+    };
+
+    CV_WRAP static Ptr<AgastFeatureDetector> create( int threshold=10,
+                                                     bool nonmaxSuppression=true,
+                                                     int type=AgastFeatureDetector::OAST_9_16 );
+
+    CV_WRAP virtual void setThreshold(int threshold) = 0;
+    CV_WRAP virtual int getThreshold() const = 0;
+
+    CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
+    CV_WRAP virtual bool getNonmaxSuppression() const = 0;
+
+    CV_WRAP virtual void setType(int type) = 0;
+    CV_WRAP virtual int getType() const = 0;
+};
+
+/** @brief Wrapping class for feature detection using the goodFeaturesToTrack function. :
+ */
+class CV_EXPORTS_W GFTTDetector : public Feature2D
+{
+public:
+    CV_WRAP static Ptr<GFTTDetector> create( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
+                                             int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
+    CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
+    CV_WRAP virtual int getMaxFeatures() const = 0;
+
+    CV_WRAP virtual void setQualityLevel(double qlevel) = 0;
+    CV_WRAP virtual double getQualityLevel() const = 0;
+
+    CV_WRAP virtual void setMinDistance(double minDistance) = 0;
+    CV_WRAP virtual double getMinDistance() const = 0;
+
+    CV_WRAP virtual void setBlockSize(int blockSize) = 0;
+    CV_WRAP virtual int getBlockSize() const = 0;
+
+    CV_WRAP virtual void setHarrisDetector(bool val) = 0;
+    CV_WRAP virtual bool getHarrisDetector() const = 0;
+
+    CV_WRAP virtual void setK(double k) = 0;
+    CV_WRAP virtual double getK() const = 0;
+};
+
+/** @brief Class for extracting blobs from an image. :
+
+The class implements a simple algorithm for extracting blobs from an image:
+
+1.  Convert the source image to binary images by applying thresholding with several thresholds from
+    minThreshold (inclusive) to maxThreshold (exclusive) with distance thresholdStep between
+    neighboring thresholds.
+2.  Extract connected components from every binary image by findContours and calculate their
+    centers.
+3.  Group centers from several binary images by their coordinates. Close centers form one group that
+    corresponds to one blob, which is controlled by the minDistBetweenBlobs parameter.
+4.  From the groups, estimate final centers of blobs and their radiuses and return as locations and
+    sizes of keypoints.
+
+This class performs several filtrations of returned blobs. You should set filterBy\* to true/false
+to turn on/off corresponding filtration. Available filtrations:
+
+-   **By color**. This filter compares the intensity of a binary image at the center of a blob to
+blobColor. If they differ, the blob is filtered out. Use blobColor = 0 to extract dark blobs
+and blobColor = 255 to extract light blobs.
+-   **By area**. Extracted blobs have an area between minArea (inclusive) and maxArea (exclusive).
+-   **By circularity**. Extracted blobs have circularity
+(\f$\frac{4*\pi*Area}{perimeter * perimeter}\f$) between minCircularity (inclusive) and
+maxCircularity (exclusive).
+-   **By ratio of the minimum inertia to maximum inertia**. Extracted blobs have this ratio
+between minInertiaRatio (inclusive) and maxInertiaRatio (exclusive).
+-   **By convexity**. Extracted blobs have convexity (area / area of blob convex hull) between
+minConvexity (inclusive) and maxConvexity (exclusive).
+
+Default values of parameters are tuned to extract dark circular blobs.
+ */
+class CV_EXPORTS_W SimpleBlobDetector : public Feature2D
+{
+public:
+  struct CV_EXPORTS_W_SIMPLE Params
+  {
+      CV_WRAP Params();
+      CV_PROP_RW float thresholdStep;
+      CV_PROP_RW float minThreshold;
+      CV_PROP_RW float maxThreshold;
+      CV_PROP_RW size_t minRepeatability;
+      CV_PROP_RW float minDistBetweenBlobs;
+
+      CV_PROP_RW bool filterByColor;
+      CV_PROP_RW uchar blobColor;
+
+      CV_PROP_RW bool filterByArea;
+      CV_PROP_RW float minArea, maxArea;
+
+      CV_PROP_RW bool filterByCircularity;
+      CV_PROP_RW float minCircularity, maxCircularity;
+
+      CV_PROP_RW bool filterByInertia;
+      CV_PROP_RW float minInertiaRatio, maxInertiaRatio;
+
+      CV_PROP_RW bool filterByConvexity;
+      CV_PROP_RW float minConvexity, maxConvexity;
+
+      void read( const FileNode& fn );
+      void write( FileStorage& fs ) const;
+  };
+
+  CV_WRAP static Ptr<SimpleBlobDetector>
+    create(const SimpleBlobDetector::Params &parameters = SimpleBlobDetector::Params());
+};
+
+//! @} features2d_main
+
+//! @addtogroup features2d_main
+//! @{
+
+/** @brief Class implementing the KAZE keypoint detector and descriptor extractor, described in @cite ABD12 .
+
+@note AKAZE descriptor can only be used with KAZE or AKAZE keypoints .. [ABD12] KAZE Features. Pablo
+F. Alcantarilla, Adrien Bartoli and Andrew J. Davison. In European Conference on Computer Vision
+(ECCV), Fiorenze, Italy, October 2012.
+*/
+class CV_EXPORTS_W KAZE : public Feature2D
+{
+public:
+    enum
+    {
+        DIFF_PM_G1 = 0,
+        DIFF_PM_G2 = 1,
+        DIFF_WEICKERT = 2,
+        DIFF_CHARBONNIER = 3
+    };
+
+    /** @brief The KAZE constructor
+
+    @param extended Set to enable extraction of extended (128-byte) descriptor.
+    @param upright Set to enable use of upright descriptors (non rotation-invariant).
+    @param threshold Detector response threshold to accept point
+    @param nOctaves Maximum octave evolution of the image
+    @param nOctaveLayers Default number of sublevels per scale level
+    @param diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or
+    DIFF_CHARBONNIER
+     */
+    CV_WRAP static Ptr<KAZE> create(bool extended=false, bool upright=false,
+                                    float threshold = 0.001f,
+                                    int nOctaves = 4, int nOctaveLayers = 4,
+                                    int diffusivity = KAZE::DIFF_PM_G2);
+
+    CV_WRAP virtual void setExtended(bool extended) = 0;
+    CV_WRAP virtual bool getExtended() const = 0;
+
+    CV_WRAP virtual void setUpright(bool upright) = 0;
+    CV_WRAP virtual bool getUpright() const = 0;
+
+    CV_WRAP virtual void setThreshold(double threshold) = 0;
+    CV_WRAP virtual double getThreshold() const = 0;
+
+    CV_WRAP virtual void setNOctaves(int octaves) = 0;
+    CV_WRAP virtual int getNOctaves() const = 0;
+
+    CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
+    CV_WRAP virtual int getNOctaveLayers() const = 0;
+
+    CV_WRAP virtual void setDiffusivity(int diff) = 0;
+    CV_WRAP virtual int getDiffusivity() const = 0;
+};
+
+/** @brief Class implementing the AKAZE keypoint detector and descriptor extractor, described in @cite ANB13 . :
+
+@note AKAZE descriptors can only be used with KAZE or AKAZE keypoints. Try to avoid using *extract*
+and *detect* instead of *operator()* due to performance reasons. .. [ANB13] Fast Explicit Diffusion
+for Accelerated Features in Nonlinear Scale Spaces. Pablo F. Alcantarilla, Jes煤s Nuevo and Adrien
+Bartoli. In British Machine Vision Conference (BMVC), Bristol, UK, September 2013.
+ */
+class CV_EXPORTS_W AKAZE : public Feature2D
+{
+public:
+    // AKAZE descriptor type
+    enum
+    {
+        DESCRIPTOR_KAZE_UPRIGHT = 2, ///< Upright descriptors, not invariant to rotation
+        DESCRIPTOR_KAZE = 3,
+        DESCRIPTOR_MLDB_UPRIGHT = 4, ///< Upright descriptors, not invariant to rotation
+        DESCRIPTOR_MLDB = 5
+    };
+
+    /** @brief The AKAZE constructor
+
+    @param descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
+    DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
+    @param descriptor_size Size of the descriptor in bits. 0 -\> Full size
+    @param descriptor_channels Number of channels in the descriptor (1, 2, 3)
+    @param threshold Detector response threshold to accept point
+    @param nOctaves Maximum octave evolution of the image
+    @param nOctaveLayers Default number of sublevels per scale level
+    @param diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or
+    DIFF_CHARBONNIER
+     */
+    CV_WRAP static Ptr<AKAZE> create(int descriptor_type=AKAZE::DESCRIPTOR_MLDB,
+                                     int descriptor_size = 0, int descriptor_channels = 3,
+                                     float threshold = 0.001f, int nOctaves = 4,
+                                     int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2);
+
+    CV_WRAP virtual void setDescriptorType(int dtype) = 0;
+    CV_WRAP virtual int getDescriptorType() const = 0;
+
+    CV_WRAP virtual void setDescriptorSize(int dsize) = 0;
+    CV_WRAP virtual int getDescriptorSize() const = 0;
+
+    CV_WRAP virtual void setDescriptorChannels(int dch) = 0;
+    CV_WRAP virtual int getDescriptorChannels() const = 0;
+
+    CV_WRAP virtual void setThreshold(double threshold) = 0;
+    CV_WRAP virtual double getThreshold() const = 0;
+
+    CV_WRAP virtual void setNOctaves(int octaves) = 0;
+    CV_WRAP virtual int getNOctaves() const = 0;
+
+    CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
+    CV_WRAP virtual int getNOctaveLayers() const = 0;
+
+    CV_WRAP virtual void setDiffusivity(int diff) = 0;
+    CV_WRAP virtual int getDiffusivity() const = 0;
+};
+
+//! @} features2d_main
+
+/****************************************************************************************\
+*                                      Distance                                          *
+\****************************************************************************************/
+
+template<typename T>
+struct CV_EXPORTS Accumulator
+{
+    typedef T Type;
+};
+
+template<> struct Accumulator<unsigned char>  { typedef float Type; };
+template<> struct Accumulator<unsigned short> { typedef float Type; };
+template<> struct Accumulator<char>   { typedef float Type; };
+template<> struct Accumulator<short>  { typedef float Type; };
+
+/*
+ * Squared Euclidean distance functor
+ */
+template<class T>
+struct CV_EXPORTS SL2
+{
+    enum { normType = NORM_L2SQR };
+    typedef T ValueType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    ResultType operator()( const T* a, const T* b, int size ) const
+    {
+        return normL2Sqr<ValueType, ResultType>(a, b, size);
+    }
+};
+
+/*
+ * Euclidean distance functor
+ */
+template<class T>
+struct CV_EXPORTS L2
+{
+    enum { normType = NORM_L2 };
+    typedef T ValueType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    ResultType operator()( const T* a, const T* b, int size ) const
+    {
+        return (ResultType)std::sqrt((double)normL2Sqr<ValueType, ResultType>(a, b, size));
+    }
+};
+
+/*
+ * Manhattan distance (city block distance) functor
+ */
+template<class T>
+struct CV_EXPORTS L1
+{
+    enum { normType = NORM_L1 };
+    typedef T ValueType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    ResultType operator()( const T* a, const T* b, int size ) const
+    {
+        return normL1<ValueType, ResultType>(a, b, size);
+    }
+};
+
+/****************************************************************************************\
+*                                  DescriptorMatcher                                     *
+\****************************************************************************************/
+
+//! @addtogroup features2d_match
+//! @{
+
+/** @brief Abstract base class for matching keypoint descriptors.
+
+It has two groups of match methods: for matching descriptors of an image with another image or with
+an image set.
+ */
+class CV_EXPORTS_W DescriptorMatcher : public Algorithm
+{
+public:
+    virtual ~DescriptorMatcher();
+
+    /** @brief Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor
+    collection.
+
+    If the collection is not empty, the new descriptors are added to existing train descriptors.
+
+    @param descriptors Descriptors to add. Each descriptors[i] is a set of descriptors from the same
+    train image.
+     */
+    CV_WRAP virtual void add( InputArrayOfArrays descriptors );
+
+    /** @brief Returns a constant link to the train descriptor collection trainDescCollection .
+     */
+    CV_WRAP const std::vector<Mat>& getTrainDescriptors() const;
+
+    /** @brief Clears the train descriptor collections.
+     */
+    CV_WRAP virtual void clear();
+
+    /** @brief Returns true if there are no train descriptors in the both collections.
+     */
+    CV_WRAP virtual bool empty() const;
+
+    /** @brief Returns true if the descriptor matcher supports masking permissible matches.
+     */
+    CV_WRAP virtual bool isMaskSupported() const = 0;
+
+    /** @brief Trains a descriptor matcher
+
+    Trains a descriptor matcher (for example, the flann index). In all methods to match, the method
+    train() is run every time before matching. Some descriptor matchers (for example, BruteForceMatcher)
+    have an empty implementation of this method. Other matchers really train their inner structures (for
+    example, FlannBasedMatcher trains flann::Index ).
+     */
+    CV_WRAP virtual void train();
+
+    /** @brief Finds the best match for each descriptor from a query set.
+
+    @param queryDescriptors Query set of descriptors.
+    @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+    collection stored in the class object.
+    @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
+    descriptor. So, matches size may be smaller than the query descriptors count.
+    @param mask Mask specifying permissible matches between an input query and train matrices of
+    descriptors.
+
+    In the first variant of this method, the train descriptors are passed as an input argument. In the
+    second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is
+    used. Optional mask (or masks) can be passed to specify which query and training descriptors can be
+    matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if
+    mask.at\<uchar\>(i,j) is non-zero.
+     */
+    CV_WRAP void match( InputArray queryDescriptors, InputArray trainDescriptors,
+                CV_OUT std::vector<DMatch>& matches, InputArray mask=noArray() ) const;
+
+    /** @brief Finds the k best matches for each descriptor from a query set.
+
+    @param queryDescriptors Query set of descriptors.
+    @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+    collection stored in the class object.
+    @param mask Mask specifying permissible matches between an input query and train matrices of
+    descriptors.
+    @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+    @param k Count of best matches found per each query descriptor or less if a query descriptor has
+    less than k possible matches in total.
+    @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+    false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+    the matches vector does not contain matches for fully masked-out query descriptors.
+
+    These extended variants of DescriptorMatcher::match methods find several best matches for each query
+    descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match
+    for the details about query and train descriptors.
+     */
+    CV_WRAP void knnMatch( InputArray queryDescriptors, InputArray trainDescriptors,
+                   CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
+                   InputArray mask=noArray(), bool compactResult=false ) const;
+
+    /** @brief For each query descriptor, finds the training descriptors not farther than the specified distance.
+
+    @param queryDescriptors Query set of descriptors.
+    @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
+    collection stored in the class object.
+    @param matches Found matches.
+    @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+    false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+    the matches vector does not contain matches for fully masked-out query descriptors.
+    @param maxDistance Threshold for the distance between matched descriptors. Distance means here
+    metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured
+    in Pixels)!
+    @param mask Mask specifying permissible matches between an input query and train matrices of
+    descriptors.
+
+    For each query descriptor, the methods find such training descriptors that the distance between the
+    query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are
+    returned in the distance increasing order.
+     */
+    void radiusMatch( InputArray queryDescriptors, InputArray trainDescriptors,
+                      std::vector<std::vector<DMatch> >& matches, float maxDistance,
+                      InputArray mask=noArray(), bool compactResult=false ) const;
+
+    /** @overload
+    @param queryDescriptors Query set of descriptors.
+    @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
+    descriptor. So, matches size may be smaller than the query descriptors count.
+    @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+    descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+    */
+    CV_WRAP void match( InputArray queryDescriptors, CV_OUT std::vector<DMatch>& matches,
+                        InputArrayOfArrays masks=noArray() );
+    /** @overload
+    @param queryDescriptors Query set of descriptors.
+    @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
+    @param k Count of best matches found per each query descriptor or less if a query descriptor has
+    less than k possible matches in total.
+    @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+    descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+    @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+    false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+    the matches vector does not contain matches for fully masked-out query descriptors.
+    */
+    CV_WRAP void knnMatch( InputArray queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
+                           InputArrayOfArrays masks=noArray(), bool compactResult=false );
+    /** @overload
+    @param queryDescriptors Query set of descriptors.
+    @param matches Found matches.
+    @param maxDistance Threshold for the distance between matched descriptors. Distance means here
+    metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured
+    in Pixels)!
+    @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
+    descriptors and stored train descriptors from the i-th image trainDescCollection[i].
+    @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
+    false, the matches vector has the same size as queryDescriptors rows. If compactResult is true,
+    the matches vector does not contain matches for fully masked-out query descriptors.
+    */
+    void radiusMatch( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
+                      InputArrayOfArrays masks=noArray(), bool compactResult=false );
+
+    // Reads matcher object from a file node
+    virtual void read( const FileNode& );
+    // Writes matcher object to a file storage
+    virtual void write( FileStorage& ) const;
+
+    /** @brief Clones the matcher.
+
+    @param emptyTrainData If emptyTrainData is false, the method creates a deep copy of the object,
+    that is, copies both parameters and train data. If emptyTrainData is true, the method creates an
+    object copy with the current parameters but with empty train data.
+     */
+    virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const = 0;
+
+    /** @brief Creates a descriptor matcher of a given type with the default parameters (using default
+    constructor).
+
+    @param descriptorMatcherType Descriptor matcher type. Now the following matcher types are
+    supported:
+    -   `BruteForce` (it uses L2 )
+    -   `BruteForce-L1`
+    -   `BruteForce-Hamming`
+    -   `BruteForce-Hamming(2)`
+    -   `FlannBased`
+     */
+    CV_WRAP static Ptr<DescriptorMatcher> create( const String& descriptorMatcherType );
+protected:
+    /**
+     * Class to work with descriptors from several images as with one merged matrix.
+     * It is used e.g. in FlannBasedMatcher.
+     */
+    class CV_EXPORTS DescriptorCollection
+    {
+    public:
+        DescriptorCollection();
+        DescriptorCollection( const DescriptorCollection& collection );
+        virtual ~DescriptorCollection();
+
+        // Vector of matrices "descriptors" will be merged to one matrix "mergedDescriptors" here.
+        void set( const std::vector<Mat>& descriptors );
+        virtual void clear();
+
+        const Mat& getDescriptors() const;
+        const Mat getDescriptor( int imgIdx, int localDescIdx ) const;
+        const Mat getDescriptor( int globalDescIdx ) const;
+        void getLocalIdx( int globalDescIdx, int& imgIdx, int& localDescIdx ) const;
+
+        int size() const;
+
+    protected:
+        Mat mergedDescriptors;
+        std::vector<int> startIdxs;
+    };
+
+    //! In fact the matching is implemented only by the following two methods. These methods suppose
+    //! that the class object has been trained already. Public match methods call these methods
+    //! after calling train().
+    virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
+    virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
+
+    static bool isPossibleMatch( InputArray mask, int queryIdx, int trainIdx );
+    static bool isMaskedOut( InputArrayOfArrays masks, int queryIdx );
+
+    static Mat clone_op( Mat m ) { return m.clone(); }
+    void checkMasks( InputArrayOfArrays masks, int queryDescriptorsCount ) const;
+
+    //! Collection of descriptors from train images.
+    std::vector<Mat> trainDescCollection;
+    std::vector<UMat> utrainDescCollection;
+};
+
+/** @brief Brute-force descriptor matcher.
+
+For each descriptor in the first set, this matcher finds the closest descriptor in the second set
+by trying each one. This descriptor matcher supports masking permissible matches of descriptor
+sets.
+ */
+class CV_EXPORTS_W BFMatcher : public DescriptorMatcher
+{
+public:
+    /** @brief Brute-force matcher constructor.
+
+    @param normType One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are
+    preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and
+    BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor
+    description).
+    @param crossCheck If it is false, this is will be default BFMatcher behaviour when it finds the k
+    nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with
+    k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the
+    matcher's collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent
+    pairs. Such technique usually produces best results with minimal number of outliers when there are
+    enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
+     */
+    CV_WRAP BFMatcher( int normType=NORM_L2, bool crossCheck=false );
+    virtual ~BFMatcher() {}
+
+    virtual bool isMaskSupported() const { return true; }
+
+    virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
+protected:
+    virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false );
+    virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false );
+
+    int normType;
+    bool crossCheck;
+};
+
+
+/** @brief Flann-based descriptor matcher.
+
+This matcher trains flann::Index_ on a train descriptor collection and calls its nearest search
+methods to find the best matches. So, this matcher may be faster when matching a large train
+collection than the brute force matcher. FlannBasedMatcher does not support masking permissible
+matches of descriptor sets because flann::Index does not support this. :
+ */
+class CV_EXPORTS_W FlannBasedMatcher : public DescriptorMatcher
+{
+public:
+    CV_WRAP FlannBasedMatcher( const Ptr<flann::IndexParams>& indexParams=makePtr<flann::KDTreeIndexParams>(),
+                       const Ptr<flann::SearchParams>& searchParams=makePtr<flann::SearchParams>() );
+
+    virtual void add( InputArrayOfArrays descriptors );
+    virtual void clear();
+
+    // Reads matcher object from a file node
+    virtual void read( const FileNode& );
+    // Writes matcher object to a file storage
+    virtual void write( FileStorage& ) const;
+
+    virtual void train();
+    virtual bool isMaskSupported() const;
+
+    virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
+protected:
+    static void convertToDMatches( const DescriptorCollection& descriptors,
+                                   const Mat& indices, const Mat& distances,
+                                   std::vector<std::vector<DMatch> >& matches );
+
+    virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false );
+    virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
+        InputArrayOfArrays masks=noArray(), bool compactResult=false );
+
+    Ptr<flann::IndexParams> indexParams;
+    Ptr<flann::SearchParams> searchParams;
+    Ptr<flann::Index> flannIndex;
+
+    DescriptorCollection mergedDescriptors;
+    int addedDescCount;
+};
+
+//! @} features2d_match
+
+/****************************************************************************************\
+*                                   Drawing functions                                    *
+\****************************************************************************************/
+
+//! @addtogroup features2d_draw
+//! @{
+
+struct CV_EXPORTS DrawMatchesFlags
+{
+    enum{ DEFAULT = 0, //!< Output image matrix will be created (Mat::create),
+                       //!< i.e. existing memory of output image may be reused.
+                       //!< Two source image, matches and single keypoints will be drawn.
+                       //!< For each keypoint only the center point will be drawn (without
+                       //!< the circle around keypoint with keypoint size and orientation).
+          DRAW_OVER_OUTIMG = 1, //!< Output image matrix will not be created (Mat::create).
+                                //!< Matches will be drawn on existing content of output image.
+          NOT_DRAW_SINGLE_POINTS = 2, //!< Single keypoints will not be drawn.
+          DRAW_RICH_KEYPOINTS = 4 //!< For each keypoint the circle around keypoint with keypoint size and
+                                  //!< orientation will be drawn.
+        };
+};
+
+/** @brief Draws keypoints.
+
+@param image Source image.
+@param keypoints Keypoints from the source image.
+@param outImage Output image. Its content depends on the flags value defining what is drawn in the
+output image. See possible flags bit values below.
+@param color Color of keypoints.
+@param flags Flags setting drawing features. Possible flags bit values are defined by
+DrawMatchesFlags. See details above in drawMatches .
+
+@note
+For Python API, flags are modified as cv2.DRAW_MATCHES_FLAGS_DEFAULT,
+cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv2.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG,
+cv2.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS
+ */
+CV_EXPORTS_W void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,
+                               const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT );
+
+/** @brief Draws the found matches of keypoints from two images.
+
+@param img1 First source image.
+@param keypoints1 Keypoints from the first source image.
+@param img2 Second source image.
+@param keypoints2 Keypoints from the second source image.
+@param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
+has a corresponding point in keypoints2[matches[i]] .
+@param outImg Output image. Its content depends on the flags value defining what is drawn in the
+output image. See possible flags bit values below.
+@param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1)
+, the color is generated randomly.
+@param singlePointColor Color of single keypoints (circles), which means that keypoints do not
+have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
+@param matchesMask Mask determining which matches are drawn. If the mask is empty, all matches are
+drawn.
+@param flags Flags setting drawing features. Possible flags bit values are defined by
+DrawMatchesFlags.
+
+This function draws matches of keypoints from two images in the output image. Match is a line
+connecting two keypoints (circles). See cv::DrawMatchesFlags.
+ */
+CV_EXPORTS_W void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
+                             InputArray img2, const std::vector<KeyPoint>& keypoints2,
+                             const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
+                             const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
+                             const std::vector<char>& matchesMask=std::vector<char>(), int flags=DrawMatchesFlags::DEFAULT );
+
+/** @overload */
+CV_EXPORTS_AS(drawMatchesKnn) void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
+                             InputArray img2, const std::vector<KeyPoint>& keypoints2,
+                             const std::vector<std::vector<DMatch> >& matches1to2, InputOutputArray outImg,
+                             const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
+                             const std::vector<std::vector<char> >& matchesMask=std::vector<std::vector<char> >(), int flags=DrawMatchesFlags::DEFAULT );
+
+//! @} features2d_draw
+
+/****************************************************************************************\
+*   Functions to evaluate the feature detectors and [generic] descriptor extractors      *
+\****************************************************************************************/
+
+CV_EXPORTS void evaluateFeatureDetector( const Mat& img1, const Mat& img2, const Mat& H1to2,
+                                         std::vector<KeyPoint>* keypoints1, std::vector<KeyPoint>* keypoints2,
+                                         float& repeatability, int& correspCount,
+                                         const Ptr<FeatureDetector>& fdetector=Ptr<FeatureDetector>() );
+
+CV_EXPORTS void computeRecallPrecisionCurve( const std::vector<std::vector<DMatch> >& matches1to2,
+                                             const std::vector<std::vector<uchar> >& correctMatches1to2Mask,
+                                             std::vector<Point2f>& recallPrecisionCurve );
+
+CV_EXPORTS float getRecall( const std::vector<Point2f>& recallPrecisionCurve, float l_precision );
+CV_EXPORTS int getNearestPoint( const std::vector<Point2f>& recallPrecisionCurve, float l_precision );
+
+/****************************************************************************************\
+*                                     Bag of visual words                                *
+\****************************************************************************************/
+
+//! @addtogroup features2d_category
+//! @{
+
+/** @brief Abstract base class for training the *bag of visual words* vocabulary from a set of descriptors.
+
+For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka,
+Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :
+ */
+class CV_EXPORTS_W BOWTrainer
+{
+public:
+    BOWTrainer();
+    virtual ~BOWTrainer();
+
+    /** @brief Adds descriptors to a training set.
+
+    @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a
+    descriptor.
+
+    The training set is clustered using clustermethod to construct the vocabulary.
+     */
+    CV_WRAP void add( const Mat& descriptors );
+
+    /** @brief Returns a training set of descriptors.
+    */
+    CV_WRAP const std::vector<Mat>& getDescriptors() const;
+
+    /** @brief Returns the count of all descriptors stored in the training set.
+    */
+    CV_WRAP int descriptorsCount() const;
+
+    CV_WRAP virtual void clear();
+
+    /** @overload */
+    CV_WRAP virtual Mat cluster() const = 0;
+
+    /** @brief Clusters train descriptors.
+
+    @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor.
+    Descriptors are not added to the inner train descriptor set.
+
+    The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first
+    variant of the method, train descriptors stored in the object are clustered. In the second variant,
+    input descriptors are clustered.
+     */
+    CV_WRAP virtual Mat cluster( const Mat& descriptors ) const = 0;
+
+protected:
+    std::vector<Mat> descriptors;
+    int size;
+};
+
+/** @brief kmeans -based class to train visual vocabulary using the *bag of visual words* approach. :
+ */
+class CV_EXPORTS_W BOWKMeansTrainer : public BOWTrainer
+{
+public:
+    /** @brief The constructor.
+
+    @see cv::kmeans
+    */
+    CV_WRAP BOWKMeansTrainer( int clusterCount, const TermCriteria& termcrit=TermCriteria(),
+                      int attempts=3, int flags=KMEANS_PP_CENTERS );
+    virtual ~BOWKMeansTrainer();
+
+    // Returns trained vocabulary (i.e. cluster centers).
+    CV_WRAP virtual Mat cluster() const;
+    CV_WRAP virtual Mat cluster( const Mat& descriptors ) const;
+
+protected:
+
+    int clusterCount;
+    TermCriteria termcrit;
+    int attempts;
+    int flags;
+};
+
+/** @brief Class to compute an image descriptor using the *bag of visual words*.
+
+Such a computation consists of the following steps:
+
+1.  Compute descriptors for a given image and its keypoints set.
+2.  Find the nearest visual words from the vocabulary for each keypoint descriptor.
+3.  Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words
+encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the
+vocabulary in the given image.
+ */
+class CV_EXPORTS_W BOWImgDescriptorExtractor
+{
+public:
+    /** @brief The constructor.
+
+    @param dextractor Descriptor extractor that is used to compute descriptors for an input image and
+    its keypoints.
+    @param dmatcher Descriptor matcher that is used to find the nearest word of the trained vocabulary
+    for each keypoint descriptor of the image.
+     */
+    CV_WRAP BOWImgDescriptorExtractor( const Ptr<DescriptorExtractor>& dextractor,
+                               const Ptr<DescriptorMatcher>& dmatcher );
+    /** @overload */
+    BOWImgDescriptorExtractor( const Ptr<DescriptorMatcher>& dmatcher );
+    virtual ~BOWImgDescriptorExtractor();
+
+    /** @brief Sets a visual vocabulary.
+
+    @param vocabulary Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the
+    vocabulary is a visual word (cluster center).
+     */
+    CV_WRAP void setVocabulary( const Mat& vocabulary );
+
+    /** @brief Returns the set vocabulary.
+    */
+    CV_WRAP const Mat& getVocabulary() const;
+
+    /** @brief Computes an image descriptor using the set visual vocabulary.
+
+    @param image Image, for which the descriptor is computed.
+    @param keypoints Keypoints detected in the input image.
+    @param imgDescriptor Computed output image descriptor.
+    @param pointIdxsOfClusters Indices of keypoints that belong to the cluster. This means that
+    pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary)
+    returned if it is non-zero.
+    @param descriptors Descriptors of the image keypoints that are returned if they are non-zero.
+     */
+    void compute( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray imgDescriptor,
+                  std::vector<std::vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 );
+    /** @overload
+    @param keypointDescriptors Computed descriptors to match with vocabulary.
+    @param imgDescriptor Computed output image descriptor.
+    @param pointIdxsOfClusters Indices of keypoints that belong to the cluster. This means that
+    pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary)
+    returned if it is non-zero.
+    */
+    void compute( InputArray keypointDescriptors, OutputArray imgDescriptor,
+                  std::vector<std::vector<int> >* pointIdxsOfClusters=0 );
+    // compute() is not constant because DescriptorMatcher::match is not constant
+
+    CV_WRAP_AS(compute) void compute2( const Mat& image, std::vector<KeyPoint>& keypoints, CV_OUT Mat& imgDescriptor )
+    { compute(image,keypoints,imgDescriptor); }
+
+    /** @brief Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.
+    */
+    CV_WRAP int descriptorSize() const;
+
+    /** @brief Returns an image descriptor type.
+     */
+    CV_WRAP int descriptorType() const;
+
+protected:
+    Mat vocabulary;
+    Ptr<DescriptorExtractor> dextractor;
+    Ptr<DescriptorMatcher> dmatcher;
+};
+
+//! @} features2d_category
+
+//! @} features2d
+
+} /* namespace cv */
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp
new file mode 100644
index 0000000..e81df0a
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/features2d/features2d.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/features2d.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/flann.hpp
new file mode 100644
index 0000000..4f92d57
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann.hpp
@@ -0,0 +1,561 @@
+/*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*/
+
+#ifndef _OPENCV_FLANN_HPP_
+#define _OPENCV_FLANN_HPP_
+
+#include "opencv2/core.hpp"
+#include "opencv2/flann/miniflann.hpp"
+#include "opencv2/flann/flann_base.hpp"
+
+/**
+@defgroup flann Clustering and Search in Multi-Dimensional Spaces
+
+This section documents OpenCV's interface to the FLANN library. FLANN (Fast Library for Approximate
+Nearest Neighbors) is a library that contains a collection of algorithms optimized for fast nearest
+neighbor search in large datasets and for high dimensional features. More information about FLANN
+can be found in @cite Muja2009 .
+*/
+
+namespace cvflann
+{
+    CV_EXPORTS flann_distance_t flann_distance_type();
+    FLANN_DEPRECATED CV_EXPORTS void set_distance_type(flann_distance_t distance_type, int order);
+}
+
+
+namespace cv
+{
+namespace flann
+{
+
+
+//! @addtogroup flann
+//! @{
+
+template <typename T> struct CvType {};
+template <> struct CvType<unsigned char> { static int type() { return CV_8U; } };
+template <> struct CvType<char> { static int type() { return CV_8S; } };
+template <> struct CvType<unsigned short> { static int type() { return CV_16U; } };
+template <> struct CvType<short> { static int type() { return CV_16S; } };
+template <> struct CvType<int> { static int type() { return CV_32S; } };
+template <> struct CvType<float> { static int type() { return CV_32F; } };
+template <> struct CvType<double> { static int type() { return CV_64F; } };
+
+
+// bring the flann parameters into this namespace
+using ::cvflann::get_param;
+using ::cvflann::print_params;
+
+// bring the flann distances into this namespace
+using ::cvflann::L2_Simple;
+using ::cvflann::L2;
+using ::cvflann::L1;
+using ::cvflann::MinkowskiDistance;
+using ::cvflann::MaxDistance;
+using ::cvflann::HammingLUT;
+using ::cvflann::Hamming;
+using ::cvflann::Hamming2;
+using ::cvflann::HistIntersectionDistance;
+using ::cvflann::HellingerDistance;
+using ::cvflann::ChiSquareDistance;
+using ::cvflann::KL_Divergence;
+
+
+/** @brief The FLANN nearest neighbor index class. This class is templated with the type of elements for which
+the index is built.
+ */
+template <typename Distance>
+class GenericIndex
+{
+public:
+        typedef typename Distance::ElementType ElementType;
+        typedef typename Distance::ResultType DistanceType;
+
+        /** @brief Constructs a nearest neighbor search index for a given dataset.
+
+        @param features Matrix of containing the features(points) to index. The size of the matrix is
+        num_features x feature_dimensionality and the data type of the elements in the matrix must
+        coincide with the type of the index.
+        @param params Structure containing the index parameters. The type of index that will be
+        constructed depends on the type of this parameter. See the description.
+        @param distance
+
+        The method constructs a fast search structure from a set of features using the specified algorithm
+        with specified parameters, as defined by params. params is a reference to one of the following class
+        IndexParams descendants:
+
+        - **LinearIndexParams** When passing an object of this type, the index will perform a linear,
+        brute-force search. :
+        @code
+        struct LinearIndexParams : public IndexParams
+        {
+        };
+        @endcode
+        - **KDTreeIndexParams** When passing an object of this type the index constructed will consist of
+        a set of randomized kd-trees which will be searched in parallel. :
+        @code
+        struct KDTreeIndexParams : public IndexParams
+        {
+            KDTreeIndexParams( int trees = 4 );
+        };
+        @endcode
+        - **KMeansIndexParams** When passing an object of this type the index constructed will be a
+        hierarchical k-means tree. :
+        @code
+        struct KMeansIndexParams : public IndexParams
+        {
+            KMeansIndexParams(
+                int branching = 32,
+                int iterations = 11,
+                flann_centers_init_t centers_init = CENTERS_RANDOM,
+                float cb_index = 0.2 );
+        };
+        @endcode
+        - **CompositeIndexParams** When using a parameters object of this type the index created
+        combines the randomized kd-trees and the hierarchical k-means tree. :
+        @code
+        struct CompositeIndexParams : public IndexParams
+        {
+            CompositeIndexParams(
+                int trees = 4,
+                int branching = 32,
+                int iterations = 11,
+                flann_centers_init_t centers_init = CENTERS_RANDOM,
+                float cb_index = 0.2 );
+        };
+        @endcode
+        - **LshIndexParams** When using a parameters object of this type the index created uses
+        multi-probe LSH (by Multi-Probe LSH: Efficient Indexing for High-Dimensional Similarity Search
+        by Qin Lv, William Josephson, Zhe Wang, Moses Charikar, Kai Li., Proceedings of the 33rd
+        International Conference on Very Large Data Bases (VLDB). Vienna, Austria. September 2007) :
+        @code
+        struct LshIndexParams : public IndexParams
+        {
+            LshIndexParams(
+                unsigned int table_number,
+                unsigned int key_size,
+                unsigned int multi_probe_level );
+        };
+        @endcode
+        - **AutotunedIndexParams** When passing an object of this type the index created is
+        automatically tuned to offer the best performance, by choosing the optimal index type
+        (randomized kd-trees, hierarchical kmeans, linear) and parameters for the dataset provided. :
+        @code
+        struct AutotunedIndexParams : public IndexParams
+        {
+            AutotunedIndexParams(
+                float target_precision = 0.9,
+                float build_weight = 0.01,
+                float memory_weight = 0,
+                float sample_fraction = 0.1 );
+        };
+        @endcode
+        - **SavedIndexParams** This object type is used for loading a previously saved index from the
+        disk. :
+        @code
+        struct SavedIndexParams : public IndexParams
+        {
+            SavedIndexParams( String filename );
+        };
+        @endcode
+         */
+        GenericIndex(const Mat& features, const ::cvflann::IndexParams& params, Distance distance = Distance());
+
+        ~GenericIndex();
+
+        /** @brief Performs a K-nearest neighbor search for a given query point using the index.
+
+        @param query The query point
+        @param indices Vector that will contain the indices of the K-nearest neighbors found. It must have
+        at least knn size.
+        @param dists Vector that will contain the distances to the K-nearest neighbors found. It must have
+        at least knn size.
+        @param knn Number of nearest neighbors to search for.
+        @param params SearchParams
+         */
+        void knnSearch(const std::vector<ElementType>& query, std::vector<int>& indices,
+                       std::vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& params);
+        void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& params);
+
+        int radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices,
+                         std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params);
+        int radiusSearch(const Mat& query, Mat& indices, Mat& dists,
+                         DistanceType radius, const ::cvflann::SearchParams& params);
+
+        void save(String filename) { nnIndex->save(filename); }
+
+        int veclen() const { return nnIndex->veclen(); }
+
+        int size() const { return nnIndex->size(); }
+
+        ::cvflann::IndexParams getParameters() { return nnIndex->getParameters(); }
+
+        FLANN_DEPRECATED const ::cvflann::IndexParams* getIndexParameters() { return nnIndex->getIndexParameters(); }
+
+private:
+        ::cvflann::Index<Distance>* nnIndex;
+};
+
+//! @cond IGNORED
+
+#define FLANN_DISTANCE_CHECK \
+    if ( ::cvflann::flann_distance_type() != cvflann::FLANN_DIST_L2) { \
+        printf("[WARNING] You are using cv::flann::Index (or cv::flann::GenericIndex) and have also changed "\
+        "the distance using cvflann::set_distance_type. This is no longer working as expected "\
+        "(cv::flann::Index always uses L2). You should create the index templated on the distance, "\
+        "for example for L1 distance use: GenericIndex< L1<float> > \n"); \
+    }
+
+
+template <typename Distance>
+GenericIndex<Distance>::GenericIndex(const Mat& dataset, const ::cvflann::IndexParams& params, Distance distance)
+{
+    CV_Assert(dataset.type() == CvType<ElementType>::type());
+    CV_Assert(dataset.isContinuous());
+    ::cvflann::Matrix<ElementType> m_dataset((ElementType*)dataset.ptr<ElementType>(0), dataset.rows, dataset.cols);
+
+    nnIndex = new ::cvflann::Index<Distance>(m_dataset, params, distance);
+
+    FLANN_DISTANCE_CHECK
+
+    nnIndex->buildIndex();
+}
+
+template <typename Distance>
+GenericIndex<Distance>::~GenericIndex()
+{
+    delete nnIndex;
+}
+
+template <typename Distance>
+void GenericIndex<Distance>::knnSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& searchParams)
+{
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)&query[0], 1, query.size());
+    ::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
+    ::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
+
+    FLANN_DISTANCE_CHECK
+
+    nnIndex->knnSearch(m_query,m_indices,m_dists,knn,searchParams);
+}
+
+
+template <typename Distance>
+void GenericIndex<Distance>::knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& searchParams)
+{
+    CV_Assert(queries.type() == CvType<ElementType>::type());
+    CV_Assert(queries.isContinuous());
+    ::cvflann::Matrix<ElementType> m_queries((ElementType*)queries.ptr<ElementType>(0), queries.rows, queries.cols);
+
+    CV_Assert(indices.type() == CV_32S);
+    CV_Assert(indices.isContinuous());
+    ::cvflann::Matrix<int> m_indices((int*)indices.ptr<int>(0), indices.rows, indices.cols);
+
+    CV_Assert(dists.type() == CvType<DistanceType>::type());
+    CV_Assert(dists.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
+
+    FLANN_DISTANCE_CHECK
+
+    nnIndex->knnSearch(m_queries,m_indices,m_dists,knn, searchParams);
+}
+
+template <typename Distance>
+int GenericIndex<Distance>::radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
+{
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)&query[0], 1, query.size());
+    ::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
+    ::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
+
+    FLANN_DISTANCE_CHECK
+
+    return nnIndex->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+}
+
+template <typename Distance>
+int GenericIndex<Distance>::radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
+{
+    CV_Assert(query.type() == CvType<ElementType>::type());
+    CV_Assert(query.isContinuous());
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)query.ptr<ElementType>(0), query.rows, query.cols);
+
+    CV_Assert(indices.type() == CV_32S);
+    CV_Assert(indices.isContinuous());
+    ::cvflann::Matrix<int> m_indices((int*)indices.ptr<int>(0), indices.rows, indices.cols);
+
+    CV_Assert(dists.type() == CvType<DistanceType>::type());
+    CV_Assert(dists.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
+
+    FLANN_DISTANCE_CHECK
+
+    return nnIndex->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+}
+
+//! @endcond
+
+/**
+ * @deprecated Use GenericIndex class instead
+ */
+template <typename T>
+class
+#ifndef _MSC_VER
+ FLANN_DEPRECATED
+#endif
+ Index_ {
+public:
+        typedef typename L2<T>::ElementType ElementType;
+        typedef typename L2<T>::ResultType DistanceType;
+
+    Index_(const Mat& features, const ::cvflann::IndexParams& params);
+
+    ~Index_();
+
+    void knnSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& params);
+    void knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& params);
+
+    int radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& params);
+    int radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& params);
+
+    void save(String filename)
+        {
+            if (nnIndex_L1) nnIndex_L1->save(filename);
+            if (nnIndex_L2) nnIndex_L2->save(filename);
+        }
+
+    int veclen() const
+    {
+            if (nnIndex_L1) return nnIndex_L1->veclen();
+            if (nnIndex_L2) return nnIndex_L2->veclen();
+        }
+
+    int size() const
+    {
+            if (nnIndex_L1) return nnIndex_L1->size();
+            if (nnIndex_L2) return nnIndex_L2->size();
+        }
+
+        ::cvflann::IndexParams getParameters()
+        {
+            if (nnIndex_L1) return nnIndex_L1->getParameters();
+            if (nnIndex_L2) return nnIndex_L2->getParameters();
+
+        }
+
+        FLANN_DEPRECATED const ::cvflann::IndexParams* getIndexParameters()
+        {
+            if (nnIndex_L1) return nnIndex_L1->getIndexParameters();
+            if (nnIndex_L2) return nnIndex_L2->getIndexParameters();
+        }
+
+private:
+        // providing backwards compatibility for L2 and L1 distances (most common)
+        ::cvflann::Index< L2<ElementType> >* nnIndex_L2;
+        ::cvflann::Index< L1<ElementType> >* nnIndex_L1;
+};
+
+#ifdef _MSC_VER
+template <typename T>
+class FLANN_DEPRECATED Index_;
+#endif
+
+//! @cond IGNORED
+
+template <typename T>
+Index_<T>::Index_(const Mat& dataset, const ::cvflann::IndexParams& params)
+{
+    printf("[WARNING] The cv::flann::Index_<T> class is deperecated, use cv::flann::GenericIndex<Distance> instead\n");
+
+    CV_Assert(dataset.type() == CvType<ElementType>::type());
+    CV_Assert(dataset.isContinuous());
+    ::cvflann::Matrix<ElementType> m_dataset((ElementType*)dataset.ptr<ElementType>(0), dataset.rows, dataset.cols);
+
+    if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L2 ) {
+        nnIndex_L1 = NULL;
+        nnIndex_L2 = new ::cvflann::Index< L2<ElementType> >(m_dataset, params);
+    }
+    else if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L1 ) {
+        nnIndex_L1 = new ::cvflann::Index< L1<ElementType> >(m_dataset, params);
+        nnIndex_L2 = NULL;
+    }
+    else {
+        printf("[ERROR] cv::flann::Index_<T> only provides backwards compatibility for the L1 and L2 distances. "
+        "For other distance types you must use cv::flann::GenericIndex<Distance>\n");
+        CV_Assert(0);
+    }
+    if (nnIndex_L1) nnIndex_L1->buildIndex();
+    if (nnIndex_L2) nnIndex_L2->buildIndex();
+}
+
+template <typename T>
+Index_<T>::~Index_()
+{
+    if (nnIndex_L1) delete nnIndex_L1;
+    if (nnIndex_L2) delete nnIndex_L2;
+}
+
+template <typename T>
+void Index_<T>::knnSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, int knn, const ::cvflann::SearchParams& searchParams)
+{
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)&query[0], 1, query.size());
+    ::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
+    ::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
+
+    if (nnIndex_L1) nnIndex_L1->knnSearch(m_query,m_indices,m_dists,knn,searchParams);
+    if (nnIndex_L2) nnIndex_L2->knnSearch(m_query,m_indices,m_dists,knn,searchParams);
+}
+
+
+template <typename T>
+void Index_<T>::knnSearch(const Mat& queries, Mat& indices, Mat& dists, int knn, const ::cvflann::SearchParams& searchParams)
+{
+    CV_Assert(queries.type() == CvType<ElementType>::type());
+    CV_Assert(queries.isContinuous());
+    ::cvflann::Matrix<ElementType> m_queries((ElementType*)queries.ptr<ElementType>(0), queries.rows, queries.cols);
+
+    CV_Assert(indices.type() == CV_32S);
+    CV_Assert(indices.isContinuous());
+    ::cvflann::Matrix<int> m_indices((int*)indices.ptr<int>(0), indices.rows, indices.cols);
+
+    CV_Assert(dists.type() == CvType<DistanceType>::type());
+    CV_Assert(dists.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
+
+    if (nnIndex_L1) nnIndex_L1->knnSearch(m_queries,m_indices,m_dists,knn, searchParams);
+    if (nnIndex_L2) nnIndex_L2->knnSearch(m_queries,m_indices,m_dists,knn, searchParams);
+}
+
+template <typename T>
+int Index_<T>::radiusSearch(const std::vector<ElementType>& query, std::vector<int>& indices, std::vector<DistanceType>& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
+{
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)&query[0], 1, query.size());
+    ::cvflann::Matrix<int> m_indices(&indices[0], 1, indices.size());
+    ::cvflann::Matrix<DistanceType> m_dists(&dists[0], 1, dists.size());
+
+    if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+    if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+}
+
+template <typename T>
+int Index_<T>::radiusSearch(const Mat& query, Mat& indices, Mat& dists, DistanceType radius, const ::cvflann::SearchParams& searchParams)
+{
+    CV_Assert(query.type() == CvType<ElementType>::type());
+    CV_Assert(query.isContinuous());
+    ::cvflann::Matrix<ElementType> m_query((ElementType*)query.ptr<ElementType>(0), query.rows, query.cols);
+
+    CV_Assert(indices.type() == CV_32S);
+    CV_Assert(indices.isContinuous());
+    ::cvflann::Matrix<int> m_indices((int*)indices.ptr<int>(0), indices.rows, indices.cols);
+
+    CV_Assert(dists.type() == CvType<DistanceType>::type());
+    CV_Assert(dists.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_dists((DistanceType*)dists.ptr<DistanceType>(0), dists.rows, dists.cols);
+
+    if (nnIndex_L1) return nnIndex_L1->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+    if (nnIndex_L2) return nnIndex_L2->radiusSearch(m_query,m_indices,m_dists,radius,searchParams);
+}
+
+//! @endcond
+
+/** @brief Clusters features using hierarchical k-means algorithm.
+
+@param features The points to be clustered. The matrix must have elements of type
+Distance::ElementType.
+@param centers The centers of the clusters obtained. The matrix must have type
+Distance::ResultType. The number of rows in this matrix represents the number of clusters desired,
+however, because of the way the cut in the hierarchical tree is chosen, the number of clusters
+computed will be the highest number of the form (branching-1)\*k+1 that's lower than the number of
+clusters desired, where branching is the tree's branching factor (see description of the
+KMeansIndexParams).
+@param params Parameters used in the construction of the hierarchical k-means tree.
+@param d Distance to be used for clustering.
+
+The method clusters the given feature vectors by constructing a hierarchical k-means tree and
+choosing a cut in the tree that minimizes the cluster's variance. It returns the number of clusters
+found.
+ */
+template <typename Distance>
+int hierarchicalClustering(const Mat& features, Mat& centers, const ::cvflann::KMeansIndexParams& params,
+                           Distance d = Distance())
+{
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    CV_Assert(features.type() == CvType<ElementType>::type());
+    CV_Assert(features.isContinuous());
+    ::cvflann::Matrix<ElementType> m_features((ElementType*)features.ptr<ElementType>(0), features.rows, features.cols);
+
+    CV_Assert(centers.type() == CvType<DistanceType>::type());
+    CV_Assert(centers.isContinuous());
+    ::cvflann::Matrix<DistanceType> m_centers((DistanceType*)centers.ptr<DistanceType>(0), centers.rows, centers.cols);
+
+    return ::cvflann::hierarchicalClustering<Distance>(m_features, m_centers, params, d);
+}
+
+/** @deprecated
+*/
+template <typename ELEM_TYPE, typename DIST_TYPE>
+FLANN_DEPRECATED int hierarchicalClustering(const Mat& features, Mat& centers, const ::cvflann::KMeansIndexParams& params)
+{
+    printf("[WARNING] cv::flann::hierarchicalClustering<ELEM_TYPE,DIST_TYPE> is deprecated, use "
+        "cv::flann::hierarchicalClustering<Distance> instead\n");
+
+    if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L2 ) {
+        return hierarchicalClustering< L2<ELEM_TYPE> >(features, centers, params);
+    }
+    else if ( ::cvflann::flann_distance_type() == cvflann::FLANN_DIST_L1 ) {
+        return hierarchicalClustering< L1<ELEM_TYPE> >(features, centers, params);
+    }
+    else {
+        printf("[ERROR] cv::flann::hierarchicalClustering<ELEM_TYPE,DIST_TYPE> only provides backwards "
+        "compatibility for the L1 and L2 distances. "
+        "For other distance types you must use cv::flann::hierarchicalClustering<Distance>\n");
+        CV_Assert(0);
+    }
+}
+
+//! @} flann
+
+} } // namespace cv::flann
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h
new file mode 100644
index 0000000..ff53fd8
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/all_indices.h
@@ -0,0 +1,155 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_ALL_INDICES_H_
+#define OPENCV_FLANN_ALL_INDICES_H_
+
+#include "general.h"
+
+#include "nn_index.h"
+#include "kdtree_index.h"
+#include "kdtree_single_index.h"
+#include "kmeans_index.h"
+#include "composite_index.h"
+#include "linear_index.h"
+#include "hierarchical_clustering_index.h"
+#include "lsh_index.h"
+#include "autotuned_index.h"
+
+
+namespace cvflann
+{
+
+template<typename KDTreeCapability, typename VectorSpace, typename Distance>
+struct index_creator
+{
+    static NNIndex<Distance>* create(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance)
+    {
+        flann_algorithm_t index_type = get_param<flann_algorithm_t>(params, "algorithm");
+
+        NNIndex<Distance>* nnIndex;
+        switch (index_type) {
+        case FLANN_INDEX_LINEAR:
+            nnIndex = new LinearIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_KDTREE_SINGLE:
+            nnIndex = new KDTreeSingleIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_KDTREE:
+            nnIndex = new KDTreeIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_KMEANS:
+            nnIndex = new KMeansIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_COMPOSITE:
+            nnIndex = new CompositeIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_AUTOTUNED:
+            nnIndex = new AutotunedIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_HIERARCHICAL:
+            nnIndex = new HierarchicalClusteringIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_LSH:
+            nnIndex = new LshIndex<Distance>(dataset, params, distance);
+            break;
+        default:
+            throw FLANNException("Unknown index type");
+        }
+
+        return nnIndex;
+    }
+};
+
+template<typename VectorSpace, typename Distance>
+struct index_creator<False,VectorSpace,Distance>
+{
+    static NNIndex<Distance>* create(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance)
+    {
+        flann_algorithm_t index_type = get_param<flann_algorithm_t>(params, "algorithm");
+
+        NNIndex<Distance>* nnIndex;
+        switch (index_type) {
+        case FLANN_INDEX_LINEAR:
+            nnIndex = new LinearIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_KMEANS:
+            nnIndex = new KMeansIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_HIERARCHICAL:
+            nnIndex = new HierarchicalClusteringIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_LSH:
+            nnIndex = new LshIndex<Distance>(dataset, params, distance);
+            break;
+        default:
+            throw FLANNException("Unknown index type");
+        }
+
+        return nnIndex;
+    }
+};
+
+template<typename Distance>
+struct index_creator<False,False,Distance>
+{
+    static NNIndex<Distance>* create(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance)
+    {
+        flann_algorithm_t index_type = get_param<flann_algorithm_t>(params, "algorithm");
+
+        NNIndex<Distance>* nnIndex;
+        switch (index_type) {
+        case FLANN_INDEX_LINEAR:
+            nnIndex = new LinearIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_HIERARCHICAL:
+            nnIndex = new HierarchicalClusteringIndex<Distance>(dataset, params, distance);
+            break;
+        case FLANN_INDEX_LSH:
+            nnIndex = new LshIndex<Distance>(dataset, params, distance);
+            break;
+        default:
+            throw FLANNException("Unknown index type");
+        }
+
+        return nnIndex;
+    }
+};
+
+template<typename Distance>
+NNIndex<Distance>* create_index_by_type(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance)
+{
+    return index_creator<typename Distance::is_kdtree_distance,
+                         typename Distance::is_vector_space_distance,
+                         Distance>::create(dataset, params,distance);
+}
+
+}
+
+#endif /* OPENCV_FLANN_ALL_INDICES_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h
new file mode 100644
index 0000000..26091d0
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/allocator.h
@@ -0,0 +1,188 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_ALLOCATOR_H_
+#define OPENCV_FLANN_ALLOCATOR_H_
+
+#include <stdlib.h>
+#include <stdio.h>
+
+
+namespace cvflann
+{
+
+/**
+ * Allocates (using C's malloc) a generic type T.
+ *
+ * Params:
+ *     count = number of instances to allocate.
+ * Returns: pointer (of type T*) to memory buffer
+ */
+template <typename T>
+T* allocate(size_t count = 1)
+{
+    T* mem = (T*) ::malloc(sizeof(T)*count);
+    return mem;
+}
+
+
+/**
+ * Pooled storage allocator
+ *
+ * The following routines allow for the efficient allocation of storage in
+ * small chunks from a specified pool.  Rather than allowing each structure
+ * to be freed individually, an entire pool of storage is freed at once.
+ * This method has two advantages over just using malloc() and free().  First,
+ * it is far more efficient for allocating small objects, as there is
+ * no overhead for remembering all the information needed to free each
+ * object or consolidating fragmented memory.  Second, the decision about
+ * how long to keep an object is made at the time of allocation, and there
+ * is no need to track down all the objects to free them.
+ *
+ */
+
+const size_t     WORDSIZE=16;
+const  size_t     BLOCKSIZE=8192;
+
+class PooledAllocator
+{
+    /* We maintain memory alignment to word boundaries by requiring that all
+        allocations be in multiples of the machine wordsize.  */
+    /* Size of machine word in bytes.  Must be power of 2. */
+    /* Minimum number of bytes requested at a time from	the system.  Must be multiple of WORDSIZE. */
+
+
+    int     remaining;  /* Number of bytes left in current block of storage. */
+    void*   base;     /* Pointer to base of current block of storage. */
+    void*   loc;      /* Current location in block to next allocate memory. */
+    int     blocksize;
+
+
+public:
+    int     usedMemory;
+    int     wastedMemory;
+
+    /**
+        Default constructor. Initializes a new pool.
+     */
+    PooledAllocator(int blockSize = BLOCKSIZE)
+    {
+        blocksize = blockSize;
+        remaining = 0;
+        base = NULL;
+
+        usedMemory = 0;
+        wastedMemory = 0;
+    }
+
+    /**
+     * Destructor. Frees all the memory allocated in this pool.
+     */
+    ~PooledAllocator()
+    {
+        void* prev;
+
+        while (base != NULL) {
+            prev = *((void**) base); /* Get pointer to prev block. */
+            ::free(base);
+            base = prev;
+        }
+    }
+
+    /**
+     * Returns a pointer to a piece of new memory of the given size in bytes
+     * allocated from the pool.
+     */
+    void* allocateMemory(int size)
+    {
+        int blockSize;
+
+        /* Round size up to a multiple of wordsize.  The following expression
+            only works for WORDSIZE that is a power of 2, by masking last bits of
+            incremented size to zero.
+         */
+        size = (size + (WORDSIZE - 1)) & ~(WORDSIZE - 1);
+
+        /* Check whether a new block must be allocated.  Note that the first word
+            of a block is reserved for a pointer to the previous block.
+         */
+        if (size > remaining) {
+
+            wastedMemory += remaining;
+
+            /* Allocate new storage. */
+            blockSize = (size + sizeof(void*) + (WORDSIZE-1) > BLOCKSIZE) ?
+                        size + sizeof(void*) + (WORDSIZE-1) : BLOCKSIZE;
+
+            // use the standard C malloc to allocate memory
+            void* m = ::malloc(blockSize);
+            if (!m) {
+                fprintf(stderr,"Failed to allocate memory.\n");
+                return NULL;
+            }
+
+            /* Fill first word of new block with pointer to previous block. */
+            ((void**) m)[0] = base;
+            base = m;
+
+            int shift = 0;
+            //int shift = (WORDSIZE - ( (((size_t)m) + sizeof(void*)) & (WORDSIZE-1))) & (WORDSIZE-1);
+
+            remaining = blockSize - sizeof(void*) - shift;
+            loc = ((char*)m + sizeof(void*) + shift);
+        }
+        void* rloc = loc;
+        loc = (char*)loc + size;
+        remaining -= size;
+
+        usedMemory += size;
+
+        return rloc;
+    }
+
+    /**
+     * Allocates (using this pool) a generic type T.
+     *
+     * Params:
+     *     count = number of instances to allocate.
+     * Returns: pointer (of type T*) to memory buffer
+     */
+    template <typename T>
+    T* allocate(size_t count = 1)
+    {
+        T* mem = (T*) this->allocateMemory((int)(sizeof(T)*count));
+        return mem;
+    }
+
+};
+
+}
+
+#endif //OPENCV_FLANN_ALLOCATOR_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/any.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/any.h
new file mode 100644
index 0000000..8c2edaa
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/any.h
@@ -0,0 +1,323 @@
+#ifndef OPENCV_FLANN_ANY_H_
+#define OPENCV_FLANN_ANY_H_
+/*
+ * (C) Copyright Christopher Diggins 2005-2011
+ * (C) Copyright Pablo Aguilar 2005
+ * (C) Copyright Kevlin Henney 2001
+ *
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt
+ *
+ * Adapted for FLANN by Marius Muja
+ */
+
+#include "defines.h"
+#include <stdexcept>
+#include <ostream>
+#include <typeinfo>
+
+namespace cvflann
+{
+
+namespace anyimpl
+{
+
+struct bad_any_cast
+{
+};
+
+struct empty_any
+{
+};
+
+inline std::ostream& operator <<(std::ostream& out, const empty_any&)
+{
+    out << "[empty_any]";
+    return out;
+}
+
+struct base_any_policy
+{
+    virtual void static_delete(void** x) = 0;
+    virtual void copy_from_value(void const* src, void** dest) = 0;
+    virtual void clone(void* const* src, void** dest) = 0;
+    virtual void move(void* const* src, void** dest) = 0;
+    virtual void* get_value(void** src) = 0;
+    virtual const void* get_value(void* const * src) = 0;
+    virtual ::size_t get_size() = 0;
+    virtual const std::type_info& type() = 0;
+    virtual void print(std::ostream& out, void* const* src) = 0;
+    virtual ~base_any_policy() {}
+};
+
+template<typename T>
+struct typed_base_any_policy : base_any_policy
+{
+    virtual ::size_t get_size() { return sizeof(T); }
+    virtual const std::type_info& type() { return typeid(T); }
+
+};
+
+template<typename T>
+struct small_any_policy : typed_base_any_policy<T>
+{
+    virtual void static_delete(void**) { }
+    virtual void copy_from_value(void const* src, void** dest)
+    {
+        new (dest) T(* reinterpret_cast<T const*>(src));
+    }
+    virtual void clone(void* const* src, void** dest) { *dest = *src; }
+    virtual void move(void* const* src, void** dest) { *dest = *src; }
+    virtual void* get_value(void** src) { return reinterpret_cast<void*>(src); }
+    virtual const void* get_value(void* const * src) { return reinterpret_cast<const void*>(src); }
+    virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(src); }
+};
+
+template<typename T>
+struct big_any_policy : typed_base_any_policy<T>
+{
+    virtual void static_delete(void** x)
+    {
+        if (* x) delete (* reinterpret_cast<T**>(x)); *x = NULL;
+    }
+    virtual void copy_from_value(void const* src, void** dest)
+    {
+        *dest = new T(*reinterpret_cast<T const*>(src));
+    }
+    virtual void clone(void* const* src, void** dest)
+    {
+        *dest = new T(**reinterpret_cast<T* const*>(src));
+    }
+    virtual void move(void* const* src, void** dest)
+    {
+        (*reinterpret_cast<T**>(dest))->~T();
+        **reinterpret_cast<T**>(dest) = **reinterpret_cast<T* const*>(src);
+    }
+    virtual void* get_value(void** src) { return *src; }
+    virtual const void* get_value(void* const * src) { return *src; }
+    virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(*src); }
+};
+
+template<> inline void big_any_policy<flann_centers_init_t>::print(std::ostream& out, void* const* src)
+{
+    out << int(*reinterpret_cast<flann_centers_init_t const*>(*src));
+}
+
+template<> inline void big_any_policy<flann_algorithm_t>::print(std::ostream& out, void* const* src)
+{
+    out << int(*reinterpret_cast<flann_algorithm_t const*>(*src));
+}
+
+template<> inline void big_any_policy<cv::String>::print(std::ostream& out, void* const* src)
+{
+    out << (*reinterpret_cast<cv::String const*>(*src)).c_str();
+}
+
+template<typename T>
+struct choose_policy
+{
+    typedef big_any_policy<T> type;
+};
+
+template<typename T>
+struct choose_policy<T*>
+{
+    typedef small_any_policy<T*> type;
+};
+
+struct any;
+
+/// Choosing the policy for an any type is illegal, but should never happen.
+/// This is designed to throw a compiler error.
+template<>
+struct choose_policy<any>
+{
+    typedef void type;
+};
+
+/// Specializations for small types.
+#define SMALL_POLICY(TYPE) \
+    template<> \
+    struct choose_policy<TYPE> { typedef small_any_policy<TYPE> type; \
+    }
+
+SMALL_POLICY(signed char);
+SMALL_POLICY(unsigned char);
+SMALL_POLICY(signed short);
+SMALL_POLICY(unsigned short);
+SMALL_POLICY(signed int);
+SMALL_POLICY(unsigned int);
+SMALL_POLICY(signed long);
+SMALL_POLICY(unsigned long);
+SMALL_POLICY(float);
+SMALL_POLICY(bool);
+
+#undef SMALL_POLICY
+
+template <typename T>
+class SinglePolicy
+{
+    SinglePolicy();
+    SinglePolicy(const SinglePolicy& other);
+    SinglePolicy& operator=(const SinglePolicy& other);
+
+public:
+    static base_any_policy* get_policy();
+
+private:
+    static typename choose_policy<T>::type policy;
+};
+
+template <typename T>
+typename choose_policy<T>::type SinglePolicy<T>::policy;
+
+/// This function will return a different policy for each type.
+template <typename T>
+inline base_any_policy* SinglePolicy<T>::get_policy() { return &policy; }
+
+} // namespace anyimpl
+
+struct any
+{
+private:
+    // fields
+    anyimpl::base_any_policy* policy;
+    void* object;
+
+public:
+    /// Initializing constructor.
+    template <typename T>
+    any(const T& x)
+        : policy(anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy()), object(NULL)
+    {
+        assign(x);
+    }
+
+    /// Empty constructor.
+    any()
+        : policy(anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy()), object(NULL)
+    { }
+
+    /// Special initializing constructor for string literals.
+    any(const char* x)
+        : policy(anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy()), object(NULL)
+    {
+        assign(x);
+    }
+
+    /// Copy constructor.
+    any(const any& x)
+        : policy(anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy()), object(NULL)
+    {
+        assign(x);
+    }
+
+    /// Destructor.
+    ~any()
+    {
+        policy->static_delete(&object);
+    }
+
+    /// Assignment function from another any.
+    any& assign(const any& x)
+    {
+        reset();
+        policy = x.policy;
+        policy->clone(&x.object, &object);
+        return *this;
+    }
+
+    /// Assignment function.
+    template <typename T>
+    any& assign(const T& x)
+    {
+        reset();
+        policy = anyimpl::SinglePolicy<T>::get_policy();
+        policy->copy_from_value(&x, &object);
+        return *this;
+    }
+
+    /// Assignment operator.
+    template<typename T>
+    any& operator=(const T& x)
+    {
+        return assign(x);
+    }
+
+    /// Assignment operator, specialed for literal strings.
+    /// They have types like const char [6] which don't work as expected.
+    any& operator=(const char* x)
+    {
+        return assign(x);
+    }
+
+    /// Utility functions
+    any& swap(any& x)
+    {
+        std::swap(policy, x.policy);
+        std::swap(object, x.object);
+        return *this;
+    }
+
+    /// Cast operator. You can only cast to the original type.
+    template<typename T>
+    T& cast()
+    {
+        if (policy->type() != typeid(T)) throw anyimpl::bad_any_cast();
+        T* r = reinterpret_cast<T*>(policy->get_value(&object));
+        return *r;
+    }
+
+    /// Cast operator. You can only cast to the original type.
+    template<typename T>
+    const T& cast() const
+    {
+        if (policy->type() != typeid(T)) throw anyimpl::bad_any_cast();
+        const T* r = reinterpret_cast<const T*>(policy->get_value(&object));
+        return *r;
+    }
+
+    /// Returns true if the any contains no value.
+    bool empty() const
+    {
+        return policy->type() == typeid(anyimpl::empty_any);
+    }
+
+    /// Frees any allocated memory, and sets the value to NULL.
+    void reset()
+    {
+        policy->static_delete(&object);
+        policy = anyimpl::SinglePolicy<anyimpl::empty_any>::get_policy();
+    }
+
+    /// Returns true if the two types are the same.
+    bool compatible(const any& x) const
+    {
+        return policy->type() == x.policy->type();
+    }
+
+    /// Returns if the type is compatible with the policy
+    template<typename T>
+    bool has_type()
+    {
+        return policy->type() == typeid(T);
+    }
+
+    const std::type_info& type() const
+    {
+        return policy->type();
+    }
+
+    friend std::ostream& operator <<(std::ostream& out, const any& any_val);
+};
+
+inline std::ostream& operator <<(std::ostream& out, const any& any_val)
+{
+    any_val.policy->print(out,&any_val.object);
+    return out;
+}
+
+}
+
+#endif // OPENCV_FLANN_ANY_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h
new file mode 100644
index 0000000..6ffb929
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/autotuned_index.h
@@ -0,0 +1,588 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+#ifndef OPENCV_FLANN_AUTOTUNED_INDEX_H_
+#define OPENCV_FLANN_AUTOTUNED_INDEX_H_
+
+#include "general.h"
+#include "nn_index.h"
+#include "ground_truth.h"
+#include "index_testing.h"
+#include "sampling.h"
+#include "kdtree_index.h"
+#include "kdtree_single_index.h"
+#include "kmeans_index.h"
+#include "composite_index.h"
+#include "linear_index.h"
+#include "logger.h"
+
+namespace cvflann
+{
+
+template<typename Distance>
+NNIndex<Distance>* create_index_by_type(const Matrix<typename Distance::ElementType>& dataset, const IndexParams& params, const Distance& distance);
+
+
+struct AutotunedIndexParams : public IndexParams
+{
+    AutotunedIndexParams(float target_precision = 0.8, float build_weight = 0.01, float memory_weight = 0, float sample_fraction = 0.1)
+    {
+        (*this)["algorithm"] = FLANN_INDEX_AUTOTUNED;
+        // precision desired (used for autotuning, -1 otherwise)
+        (*this)["target_precision"] = target_precision;
+        // build tree time weighting factor
+        (*this)["build_weight"] = build_weight;
+        // index memory weighting factor
+        (*this)["memory_weight"] = memory_weight;
+        // what fraction of the dataset to use for autotuning
+        (*this)["sample_fraction"] = sample_fraction;
+    }
+};
+
+
+template <typename Distance>
+class AutotunedIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    AutotunedIndex(const Matrix<ElementType>& inputData, const IndexParams& params = AutotunedIndexParams(), Distance d = Distance()) :
+        dataset_(inputData), distance_(d)
+    {
+        target_precision_ = get_param(params, "target_precision",0.8f);
+        build_weight_ =  get_param(params,"build_weight", 0.01f);
+        memory_weight_ = get_param(params, "memory_weight", 0.0f);
+        sample_fraction_ = get_param(params,"sample_fraction", 0.1f);
+        bestIndex_ = NULL;
+    }
+
+    AutotunedIndex(const AutotunedIndex&);
+    AutotunedIndex& operator=(const AutotunedIndex&);
+
+    virtual ~AutotunedIndex()
+    {
+        if (bestIndex_ != NULL) {
+            delete bestIndex_;
+            bestIndex_ = NULL;
+        }
+    }
+
+    /**
+     *          Method responsible with building the index.
+     */
+    virtual void buildIndex()
+    {
+        std::ostringstream stream;
+        bestParams_ = estimateBuildParams();
+        print_params(bestParams_, stream);
+        Logger::info("----------------------------------------------------\n");
+        Logger::info("Autotuned parameters:\n");
+        Logger::info("%s", stream.str().c_str());
+        Logger::info("----------------------------------------------------\n");
+
+        bestIndex_ = create_index_by_type(dataset_, bestParams_, distance_);
+        bestIndex_->buildIndex();
+        speedup_ = estimateSearchParams(bestSearchParams_);
+        stream.str(std::string());
+        print_params(bestSearchParams_, stream);
+        Logger::info("----------------------------------------------------\n");
+        Logger::info("Search parameters:\n");
+        Logger::info("%s", stream.str().c_str());
+        Logger::info("----------------------------------------------------\n");
+    }
+
+    /**
+     *  Saves the index to a stream
+     */
+    virtual void saveIndex(FILE* stream)
+    {
+        save_value(stream, (int)bestIndex_->getType());
+        bestIndex_->saveIndex(stream);
+        save_value(stream, get_param<int>(bestSearchParams_, "checks"));
+    }
+
+    /**
+     *  Loads the index from a stream
+     */
+    virtual void loadIndex(FILE* stream)
+    {
+        int index_type;
+
+        load_value(stream, index_type);
+        IndexParams params;
+        params["algorithm"] = (flann_algorithm_t)index_type;
+        bestIndex_ = create_index_by_type<Distance>(dataset_, params, distance_);
+        bestIndex_->loadIndex(stream);
+        int checks;
+        load_value(stream, checks);
+        bestSearchParams_["checks"] = checks;
+    }
+
+    /**
+     *      Method that searches for nearest-neighbors
+     */
+    virtual void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        int checks = get_param<int>(searchParams,"checks",FLANN_CHECKS_AUTOTUNED);
+        if (checks == FLANN_CHECKS_AUTOTUNED) {
+            bestIndex_->findNeighbors(result, vec, bestSearchParams_);
+        }
+        else {
+            bestIndex_->findNeighbors(result, vec, searchParams);
+        }
+    }
+
+
+    IndexParams getParameters() const
+    {
+        return bestIndex_->getParameters();
+    }
+
+    SearchParams getSearchParameters() const
+    {
+        return bestSearchParams_;
+    }
+
+    float getSpeedup() const
+    {
+        return speedup_;
+    }
+
+
+    /**
+     *      Number of features in this index.
+     */
+    virtual size_t size() const
+    {
+        return bestIndex_->size();
+    }
+
+    /**
+     *  The length of each vector in this index.
+     */
+    virtual size_t veclen() const
+    {
+        return bestIndex_->veclen();
+    }
+
+    /**
+     * The amount of memory (in bytes) this index uses.
+     */
+    virtual int usedMemory() const
+    {
+        return bestIndex_->usedMemory();
+    }
+
+    /**
+     * Algorithm name
+     */
+    virtual flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_AUTOTUNED;
+    }
+
+private:
+
+    struct CostData
+    {
+        float searchTimeCost;
+        float buildTimeCost;
+        float memoryCost;
+        float totalCost;
+        IndexParams params;
+    };
+
+    void evaluate_kmeans(CostData& cost)
+    {
+        StartStopTimer t;
+        int checks;
+        const int nn = 1;
+
+        Logger::info("KMeansTree using params: max_iterations=%d, branching=%d\n",
+                     get_param<int>(cost.params,"iterations"),
+                     get_param<int>(cost.params,"branching"));
+        KMeansIndex<Distance> kmeans(sampledDataset_, cost.params, distance_);
+        // measure index build time
+        t.start();
+        kmeans.buildIndex();
+        t.stop();
+        float buildTime = (float)t.value;
+
+        // measure search time
+        float searchTime = test_index_precision(kmeans, sampledDataset_, testDataset_, gt_matches_, target_precision_, checks, distance_, nn);
+
+        float datasetMemory = float(sampledDataset_.rows * sampledDataset_.cols * sizeof(float));
+        cost.memoryCost = (kmeans.usedMemory() + datasetMemory) / datasetMemory;
+        cost.searchTimeCost = searchTime;
+        cost.buildTimeCost = buildTime;
+        Logger::info("KMeansTree buildTime=%g, searchTime=%g, build_weight=%g\n", buildTime, searchTime, build_weight_);
+    }
+
+
+    void evaluate_kdtree(CostData& cost)
+    {
+        StartStopTimer t;
+        int checks;
+        const int nn = 1;
+
+        Logger::info("KDTree using params: trees=%d\n", get_param<int>(cost.params,"trees"));
+        KDTreeIndex<Distance> kdtree(sampledDataset_, cost.params, distance_);
+
+        t.start();
+        kdtree.buildIndex();
+        t.stop();
+        float buildTime = (float)t.value;
+
+        //measure search time
+        float searchTime = test_index_precision(kdtree, sampledDataset_, testDataset_, gt_matches_, target_precision_, checks, distance_, nn);
+
+        float datasetMemory = float(sampledDataset_.rows * sampledDataset_.cols * sizeof(float));
+        cost.memoryCost = (kdtree.usedMemory() + datasetMemory) / datasetMemory;
+        cost.searchTimeCost = searchTime;
+        cost.buildTimeCost = buildTime;
+        Logger::info("KDTree buildTime=%g, searchTime=%g\n", buildTime, searchTime);
+    }
+
+
+    //    struct KMeansSimpleDownhillFunctor {
+    //
+    //        Autotune& autotuner;
+    //        KMeansSimpleDownhillFunctor(Autotune& autotuner_) : autotuner(autotuner_) {}
+    //
+    //        float operator()(int* params) {
+    //
+    //            float maxFloat = numeric_limits<float>::max();
+    //
+    //            if (params[0]<2) return maxFloat;
+    //            if (params[1]<0) return maxFloat;
+    //
+    //            CostData c;
+    //            c.params["algorithm"] = KMEANS;
+    //            c.params["centers-init"] = CENTERS_RANDOM;
+    //            c.params["branching"] = params[0];
+    //            c.params["max-iterations"] = params[1];
+    //
+    //            autotuner.evaluate_kmeans(c);
+    //
+    //            return c.timeCost;
+    //
+    //        }
+    //    };
+    //
+    //    struct KDTreeSimpleDownhillFunctor {
+    //
+    //        Autotune& autotuner;
+    //        KDTreeSimpleDownhillFunctor(Autotune& autotuner_) : autotuner(autotuner_) {}
+    //
+    //        float operator()(int* params) {
+    //            float maxFloat = numeric_limits<float>::max();
+    //
+    //            if (params[0]<1) return maxFloat;
+    //
+    //            CostData c;
+    //            c.params["algorithm"] = KDTREE;
+    //            c.params["trees"] = params[0];
+    //
+    //            autotuner.evaluate_kdtree(c);
+    //
+    //            return c.timeCost;
+    //
+    //        }
+    //    };
+
+
+
+    void optimizeKMeans(std::vector<CostData>& costs)
+    {
+        Logger::info("KMEANS, Step 1: Exploring parameter space\n");
+
+        // explore kmeans parameters space using combinations of the parameters below
+        int maxIterations[] = { 1, 5, 10, 15 };
+        int branchingFactors[] = { 16, 32, 64, 128, 256 };
+
+        int kmeansParamSpaceSize = FLANN_ARRAY_LEN(maxIterations) * FLANN_ARRAY_LEN(branchingFactors);
+        costs.reserve(costs.size() + kmeansParamSpaceSize);
+
+        // evaluate kmeans for all parameter combinations
+        for (size_t i = 0; i < FLANN_ARRAY_LEN(maxIterations); ++i) {
+            for (size_t j = 0; j < FLANN_ARRAY_LEN(branchingFactors); ++j) {
+                CostData cost;
+                cost.params["algorithm"] = FLANN_INDEX_KMEANS;
+                cost.params["centers_init"] = FLANN_CENTERS_RANDOM;
+                cost.params["iterations"] = maxIterations[i];
+                cost.params["branching"] = branchingFactors[j];
+
+                evaluate_kmeans(cost);
+                costs.push_back(cost);
+            }
+        }
+
+        //         Logger::info("KMEANS, Step 2: simplex-downhill optimization\n");
+        //
+        //         const int n = 2;
+        //         // choose initial simplex points as the best parameters so far
+        //         int kmeansNMPoints[n*(n+1)];
+        //         float kmeansVals[n+1];
+        //         for (int i=0;i<n+1;++i) {
+        //             kmeansNMPoints[i*n] = (int)kmeansCosts[i].params["branching"];
+        //             kmeansNMPoints[i*n+1] = (int)kmeansCosts[i].params["max-iterations"];
+        //             kmeansVals[i] = kmeansCosts[i].timeCost;
+        //         }
+        //         KMeansSimpleDownhillFunctor kmeans_cost_func(*this);
+        //         // run optimization
+        //         optimizeSimplexDownhill(kmeansNMPoints,n,kmeans_cost_func,kmeansVals);
+        //         // store results
+        //         for (int i=0;i<n+1;++i) {
+        //             kmeansCosts[i].params["branching"] = kmeansNMPoints[i*2];
+        //             kmeansCosts[i].params["max-iterations"] = kmeansNMPoints[i*2+1];
+        //             kmeansCosts[i].timeCost = kmeansVals[i];
+        //         }
+    }
+
+
+    void optimizeKDTree(std::vector<CostData>& costs)
+    {
+        Logger::info("KD-TREE, Step 1: Exploring parameter space\n");
+
+        // explore kd-tree parameters space using the parameters below
+        int testTrees[] = { 1, 4, 8, 16, 32 };
+
+        // evaluate kdtree for all parameter combinations
+        for (size_t i = 0; i < FLANN_ARRAY_LEN(testTrees); ++i) {
+            CostData cost;
+            cost.params["algorithm"] = FLANN_INDEX_KDTREE;
+            cost.params["trees"] = testTrees[i];
+
+            evaluate_kdtree(cost);
+            costs.push_back(cost);
+        }
+
+        //         Logger::info("KD-TREE, Step 2: simplex-downhill optimization\n");
+        //
+        //         const int n = 1;
+        //         // choose initial simplex points as the best parameters so far
+        //         int kdtreeNMPoints[n*(n+1)];
+        //         float kdtreeVals[n+1];
+        //         for (int i=0;i<n+1;++i) {
+        //             kdtreeNMPoints[i] = (int)kdtreeCosts[i].params["trees"];
+        //             kdtreeVals[i] = kdtreeCosts[i].timeCost;
+        //         }
+        //         KDTreeSimpleDownhillFunctor kdtree_cost_func(*this);
+        //         // run optimization
+        //         optimizeSimplexDownhill(kdtreeNMPoints,n,kdtree_cost_func,kdtreeVals);
+        //         // store results
+        //         for (int i=0;i<n+1;++i) {
+        //             kdtreeCosts[i].params["trees"] = kdtreeNMPoints[i];
+        //             kdtreeCosts[i].timeCost = kdtreeVals[i];
+        //         }
+    }
+
+    /**
+     *  Chooses the best nearest-neighbor algorithm and estimates the optimal
+     *  parameters to use when building the index (for a given precision).
+     *  Returns a dictionary with the optimal parameters.
+     */
+    IndexParams estimateBuildParams()
+    {
+        std::vector<CostData> costs;
+
+        int sampleSize = int(sample_fraction_ * dataset_.rows);
+        int testSampleSize = std::min(sampleSize / 10, 1000);
+
+        Logger::info("Entering autotuning, dataset size: %d, sampleSize: %d, testSampleSize: %d, target precision: %g\n", dataset_.rows, sampleSize, testSampleSize, target_precision_);
+
+        // For a very small dataset, it makes no sense to build any fancy index, just
+        // use linear search
+        if (testSampleSize < 10) {
+            Logger::info("Choosing linear, dataset too small\n");
+            return LinearIndexParams();
+        }
+
+        // We use a fraction of the original dataset to speedup the autotune algorithm
+        sampledDataset_ = random_sample(dataset_, sampleSize);
+        // We use a cross-validation approach, first we sample a testset from the dataset
+        testDataset_ = random_sample(sampledDataset_, testSampleSize, true);
+
+        // We compute the ground truth using linear search
+        Logger::info("Computing ground truth... \n");
+        gt_matches_ = Matrix<int>(new int[testDataset_.rows], testDataset_.rows, 1);
+        StartStopTimer t;
+        t.start();
+        compute_ground_truth<Distance>(sampledDataset_, testDataset_, gt_matches_, 0, distance_);
+        t.stop();
+
+        CostData linear_cost;
+        linear_cost.searchTimeCost = (float)t.value;
+        linear_cost.buildTimeCost = 0;
+        linear_cost.memoryCost = 0;
+        linear_cost.params["algorithm"] = FLANN_INDEX_LINEAR;
+
+        costs.push_back(linear_cost);
+
+        // Start parameter autotune process
+        Logger::info("Autotuning parameters...\n");
+
+        optimizeKMeans(costs);
+        optimizeKDTree(costs);
+
+        float bestTimeCost = costs[0].searchTimeCost;
+        for (size_t i = 0; i < costs.size(); ++i) {
+            float timeCost = costs[i].buildTimeCost * build_weight_ + costs[i].searchTimeCost;
+            if (timeCost < bestTimeCost) {
+                bestTimeCost = timeCost;
+            }
+        }
+
+        float bestCost = costs[0].searchTimeCost / bestTimeCost;
+        IndexParams bestParams = costs[0].params;
+        if (bestTimeCost > 0) {
+            for (size_t i = 0; i < costs.size(); ++i) {
+                float crtCost = (costs[i].buildTimeCost * build_weight_ + costs[i].searchTimeCost) / bestTimeCost +
+                                memory_weight_ * costs[i].memoryCost;
+                if (crtCost < bestCost) {
+                    bestCost = crtCost;
+                    bestParams = costs[i].params;
+                }
+            }
+        }
+
+        delete[] gt_matches_.data;
+        delete[] testDataset_.data;
+        delete[] sampledDataset_.data;
+
+        return bestParams;
+    }
+
+
+
+    /**
+     *  Estimates the search time parameters needed to get the desired precision.
+     *  Precondition: the index is built
+     *  Postcondition: the searchParams will have the optimum params set, also the speedup obtained over linear search.
+     */
+    float estimateSearchParams(SearchParams& searchParams)
+    {
+        const int nn = 1;
+        const size_t SAMPLE_COUNT = 1000;
+
+        assert(bestIndex_ != NULL); // must have a valid index
+
+        float speedup = 0;
+
+        int samples = (int)std::min(dataset_.rows / 10, SAMPLE_COUNT);
+        if (samples > 0) {
+            Matrix<ElementType> testDataset = random_sample(dataset_, samples);
+
+            Logger::info("Computing ground truth\n");
+
+            // we need to compute the ground truth first
+            Matrix<int> gt_matches(new int[testDataset.rows], testDataset.rows, 1);
+            StartStopTimer t;
+            t.start();
+            compute_ground_truth<Distance>(dataset_, testDataset, gt_matches, 1, distance_);
+            t.stop();
+            float linear = (float)t.value;
+
+            int checks;
+            Logger::info("Estimating number of checks\n");
+
+            float searchTime;
+            float cb_index;
+            if (bestIndex_->getType() == FLANN_INDEX_KMEANS) {
+                Logger::info("KMeans algorithm, estimating cluster border factor\n");
+                KMeansIndex<Distance>* kmeans = (KMeansIndex<Distance>*)bestIndex_;
+                float bestSearchTime = -1;
+                float best_cb_index = -1;
+                int best_checks = -1;
+                for (cb_index = 0; cb_index < 1.1f; cb_index += 0.2f) {
+                    kmeans->set_cb_index(cb_index);
+                    searchTime = test_index_precision(*kmeans, dataset_, testDataset, gt_matches, target_precision_, checks, distance_, nn, 1);
+                    if ((searchTime < bestSearchTime) || (bestSearchTime == -1)) {
+                        bestSearchTime = searchTime;
+                        best_cb_index = cb_index;
+                        best_checks = checks;
+                    }
+                }
+                searchTime = bestSearchTime;
+                cb_index = best_cb_index;
+                checks = best_checks;
+
+                kmeans->set_cb_index(best_cb_index);
+                Logger::info("Optimum cb_index: %g\n", cb_index);
+                bestParams_["cb_index"] = cb_index;
+            }
+            else {
+                searchTime = test_index_precision(*bestIndex_, dataset_, testDataset, gt_matches, target_precision_, checks, distance_, nn, 1);
+            }
+
+            Logger::info("Required number of checks: %d \n", checks);
+            searchParams["checks"] = checks;
+
+            speedup = linear / searchTime;
+
+            delete[] gt_matches.data;
+            delete[] testDataset.data;
+        }
+
+        return speedup;
+    }
+
+private:
+    NNIndex<Distance>* bestIndex_;
+
+    IndexParams bestParams_;
+    SearchParams bestSearchParams_;
+
+    Matrix<ElementType> sampledDataset_;
+    Matrix<ElementType> testDataset_;
+    Matrix<int> gt_matches_;
+
+    float speedup_;
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset_;
+
+    /**
+     * Index parameters
+     */
+    float target_precision_;
+    float build_weight_;
+    float memory_weight_;
+    float sample_fraction_;
+
+    Distance distance_;
+
+
+};
+}
+
+#endif /* OPENCV_FLANN_AUTOTUNED_INDEX_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h
new file mode 100644
index 0000000..527ca1a
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/composite_index.h
@@ -0,0 +1,194 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_COMPOSITE_INDEX_H_
+#define OPENCV_FLANN_COMPOSITE_INDEX_H_
+
+#include "general.h"
+#include "nn_index.h"
+#include "kdtree_index.h"
+#include "kmeans_index.h"
+
+namespace cvflann
+{
+
+/**
+ * Index parameters for the CompositeIndex.
+ */
+struct CompositeIndexParams : public IndexParams
+{
+    CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11,
+                         flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, float cb_index = 0.2 )
+    {
+        (*this)["algorithm"] = FLANN_INDEX_KMEANS;
+        // number of randomized trees to use (for kdtree)
+        (*this)["trees"] = trees;
+        // branching factor
+        (*this)["branching"] = branching;
+        // max iterations to perform in one kmeans clustering (kmeans tree)
+        (*this)["iterations"] = iterations;
+        // algorithm used for picking the initial cluster centers for kmeans tree
+        (*this)["centers_init"] = centers_init;
+        // cluster boundary index. Used when searching the kmeans tree
+        (*this)["cb_index"] = cb_index;
+    }
+};
+
+
+/**
+ * This index builds a kd-tree index and a k-means index and performs nearest
+ * neighbour search both indexes. This gives a slight boost in search performance
+ * as some of the neighbours that are missed by one index are found by the other.
+ */
+template <typename Distance>
+class CompositeIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    /**
+     * Index constructor
+     * @param inputData dataset containing the points to index
+     * @param params Index parameters
+     * @param d Distance functor
+     * @return
+     */
+    CompositeIndex(const Matrix<ElementType>& inputData, const IndexParams& params = CompositeIndexParams(),
+                   Distance d = Distance()) : index_params_(params)
+    {
+        kdtree_index_ = new KDTreeIndex<Distance>(inputData, params, d);
+        kmeans_index_ = new KMeansIndex<Distance>(inputData, params, d);
+
+    }
+
+    CompositeIndex(const CompositeIndex&);
+    CompositeIndex& operator=(const CompositeIndex&);
+
+    virtual ~CompositeIndex()
+    {
+        delete kdtree_index_;
+        delete kmeans_index_;
+    }
+
+    /**
+     * @return The index type
+     */
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_COMPOSITE;
+    }
+
+    /**
+     * @return Size of the index
+     */
+    size_t size() const
+    {
+        return kdtree_index_->size();
+    }
+
+    /**
+     * \returns The dimensionality of the features in this index.
+     */
+    size_t veclen() const
+    {
+        return kdtree_index_->veclen();
+    }
+
+    /**
+     * \returns The amount of memory (in bytes) used by the index.
+     */
+    int usedMemory() const
+    {
+        return kmeans_index_->usedMemory() + kdtree_index_->usedMemory();
+    }
+
+    /**
+     * \brief Builds the index
+     */
+    void buildIndex()
+    {
+        Logger::info("Building kmeans tree...\n");
+        kmeans_index_->buildIndex();
+        Logger::info("Building kdtree tree...\n");
+        kdtree_index_->buildIndex();
+    }
+
+    /**
+     * \brief Saves the index to a stream
+     * \param stream The stream to save the index to
+     */
+    void saveIndex(FILE* stream)
+    {
+        kmeans_index_->saveIndex(stream);
+        kdtree_index_->saveIndex(stream);
+    }
+
+    /**
+     * \brief Loads the index from a stream
+     * \param stream The stream from which the index is loaded
+     */
+    void loadIndex(FILE* stream)
+    {
+        kmeans_index_->loadIndex(stream);
+        kdtree_index_->loadIndex(stream);
+    }
+
+    /**
+     * \returns The index parameters
+     */
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+    /**
+     * \brief Method that searches for nearest-neighbours
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        kmeans_index_->findNeighbors(result, vec, searchParams);
+        kdtree_index_->findNeighbors(result, vec, searchParams);
+    }
+
+private:
+    /** The k-means index */
+    KMeansIndex<Distance>* kmeans_index_;
+
+    /** The kd-tree index */
+    KDTreeIndex<Distance>* kdtree_index_;
+
+    /** The index parameters */
+    const IndexParams index_params_;
+};
+
+}
+
+#endif //OPENCV_FLANN_COMPOSITE_INDEX_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/config.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/config.h
new file mode 100644
index 0000000..56832fd
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/config.h
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2011  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2011  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_CONFIG_H_
+#define OPENCV_FLANN_CONFIG_H_
+
+#ifdef FLANN_VERSION_
+#undef FLANN_VERSION_
+#endif
+#define FLANN_VERSION_ "1.6.10"
+
+#endif /* OPENCV_FLANN_CONFIG_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/defines.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/defines.h
new file mode 100644
index 0000000..f0264f7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/defines.h
@@ -0,0 +1,177 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2011  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2011  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_DEFINES_H_
+#define OPENCV_FLANN_DEFINES_H_
+
+#include "config.h"
+
+#ifdef FLANN_EXPORT
+#undef FLANN_EXPORT
+#endif
+#ifdef WIN32
+/* win32 dll export/import directives */
+ #ifdef FLANN_EXPORTS
+  #define FLANN_EXPORT __declspec(dllexport)
+ #elif defined(FLANN_STATIC)
+  #define FLANN_EXPORT
+ #else
+  #define FLANN_EXPORT __declspec(dllimport)
+ #endif
+#else
+/* unix needs nothing */
+ #define FLANN_EXPORT
+#endif
+
+
+#ifdef FLANN_DEPRECATED
+#undef FLANN_DEPRECATED
+#endif
+#ifdef __GNUC__
+#define FLANN_DEPRECATED __attribute__ ((deprecated))
+#elif defined(_MSC_VER)
+#define FLANN_DEPRECATED __declspec(deprecated)
+#else
+#pragma message("WARNING: You need to implement FLANN_DEPRECATED for this compiler")
+#define FLANN_DEPRECATED
+#endif
+
+
+#undef FLANN_PLATFORM_32_BIT
+#undef FLANN_PLATFORM_64_BIT
+#if defined __amd64__ || defined __x86_64__ || defined _WIN64 || defined _M_X64
+#define FLANN_PLATFORM_64_BIT
+#else
+#define FLANN_PLATFORM_32_BIT
+#endif
+
+
+#undef FLANN_ARRAY_LEN
+#define FLANN_ARRAY_LEN(a) (sizeof(a)/sizeof(a[0]))
+
+namespace cvflann {
+
+/* Nearest neighbour index algorithms */
+enum flann_algorithm_t
+{
+    FLANN_INDEX_LINEAR = 0,
+    FLANN_INDEX_KDTREE = 1,
+    FLANN_INDEX_KMEANS = 2,
+    FLANN_INDEX_COMPOSITE = 3,
+    FLANN_INDEX_KDTREE_SINGLE = 4,
+    FLANN_INDEX_HIERARCHICAL = 5,
+    FLANN_INDEX_LSH = 6,
+    FLANN_INDEX_SAVED = 254,
+    FLANN_INDEX_AUTOTUNED = 255,
+
+    // deprecated constants, should use the FLANN_INDEX_* ones instead
+    LINEAR = 0,
+    KDTREE = 1,
+    KMEANS = 2,
+    COMPOSITE = 3,
+    KDTREE_SINGLE = 4,
+    SAVED = 254,
+    AUTOTUNED = 255
+};
+
+
+
+enum flann_centers_init_t
+{
+    FLANN_CENTERS_RANDOM = 0,
+    FLANN_CENTERS_GONZALES = 1,
+    FLANN_CENTERS_KMEANSPP = 2,
+    FLANN_CENTERS_GROUPWISE = 3,
+
+    // deprecated constants, should use the FLANN_CENTERS_* ones instead
+    CENTERS_RANDOM = 0,
+    CENTERS_GONZALES = 1,
+    CENTERS_KMEANSPP = 2
+};
+
+enum flann_log_level_t
+{
+    FLANN_LOG_NONE = 0,
+    FLANN_LOG_FATAL = 1,
+    FLANN_LOG_ERROR = 2,
+    FLANN_LOG_WARN = 3,
+    FLANN_LOG_INFO = 4
+};
+
+enum flann_distance_t
+{
+    FLANN_DIST_EUCLIDEAN = 1,
+    FLANN_DIST_L2 = 1,
+    FLANN_DIST_MANHATTAN = 2,
+    FLANN_DIST_L1 = 2,
+    FLANN_DIST_MINKOWSKI = 3,
+    FLANN_DIST_MAX   = 4,
+    FLANN_DIST_HIST_INTERSECT   = 5,
+    FLANN_DIST_HELLINGER = 6,
+    FLANN_DIST_CHI_SQUARE = 7,
+    FLANN_DIST_CS         = 7,
+    FLANN_DIST_KULLBACK_LEIBLER  = 8,
+    FLANN_DIST_KL                = 8,
+    FLANN_DIST_HAMMING          = 9,
+
+    // deprecated constants, should use the FLANN_DIST_* ones instead
+    EUCLIDEAN = 1,
+    MANHATTAN = 2,
+    MINKOWSKI = 3,
+    MAX_DIST   = 4,
+    HIST_INTERSECT   = 5,
+    HELLINGER = 6,
+    CS         = 7,
+    KL         = 8,
+    KULLBACK_LEIBLER  = 8
+};
+
+enum flann_datatype_t
+{
+    FLANN_INT8 = 0,
+    FLANN_INT16 = 1,
+    FLANN_INT32 = 2,
+    FLANN_INT64 = 3,
+    FLANN_UINT8 = 4,
+    FLANN_UINT16 = 5,
+    FLANN_UINT32 = 6,
+    FLANN_UINT64 = 7,
+    FLANN_FLOAT32 = 8,
+    FLANN_FLOAT64 = 9
+};
+
+enum
+{
+    FLANN_CHECKS_UNLIMITED = -1,
+    FLANN_CHECKS_AUTOTUNED = -2
+};
+
+}
+
+#endif /* OPENCV_FLANN_DEFINES_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dist.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dist.h
new file mode 100644
index 0000000..9dbe527
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dist.h
@@ -0,0 +1,905 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_DIST_H_
+#define OPENCV_FLANN_DIST_H_
+
+#include <cmath>
+#include <cstdlib>
+#include <string.h>
+#ifdef _MSC_VER
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int64 uint64_t;
+#else
+#include <stdint.h>
+#endif
+
+#include "defines.h"
+
+#if (defined WIN32 || defined _WIN32) && defined(_M_ARM)
+# include <Intrin.h>
+#endif
+
+#ifdef __ARM_NEON__
+# include "arm_neon.h"
+#endif
+
+namespace cvflann
+{
+
+template<typename T>
+inline T abs(T x) { return (x<0) ? -x : x; }
+
+template<>
+inline int abs<int>(int x) { return ::abs(x); }
+
+template<>
+inline float abs<float>(float x) { return fabsf(x); }
+
+template<>
+inline double abs<double>(double x) { return fabs(x); }
+
+template<typename T>
+struct Accumulator { typedef T Type; };
+template<>
+struct Accumulator<unsigned char>  { typedef float Type; };
+template<>
+struct Accumulator<unsigned short> { typedef float Type; };
+template<>
+struct Accumulator<unsigned int> { typedef float Type; };
+template<>
+struct Accumulator<char>   { typedef float Type; };
+template<>
+struct Accumulator<short>  { typedef float Type; };
+template<>
+struct Accumulator<int> { typedef float Type; };
+
+#undef True
+#undef False
+
+class True
+{
+};
+
+class False
+{
+};
+
+
+/**
+ * Squared Euclidean distance functor.
+ *
+ * This is the simpler, unrolled version. This is preferable for
+ * very low dimensionality data (eg 3D points)
+ */
+template<class T>
+struct L2_Simple
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff;
+        for(size_t i = 0; i < size; ++i ) {
+            diff = *a++ - *b++;
+            result += diff*diff;
+        }
+        return result;
+    }
+
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return (a-b)*(a-b);
+    }
+};
+
+
+
+/**
+ * Squared Euclidean distance functor, optimized version
+ */
+template<class T>
+struct L2
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the squared Euclidean distance between two vectors.
+     *
+     *	This is highly optimised, with loop unrolling, as it is one
+     *	of the most expensive inner loops.
+     *
+     *	The computation of squared root at the end is omitted for
+     *	efficiency.
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = (ResultType)(a[0] - b[0]);
+            diff1 = (ResultType)(a[1] - b[1]);
+            diff2 = (ResultType)(a[2] - b[2]);
+            diff3 = (ResultType)(a[3] - b[3]);
+            result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3;
+            a += 4;
+            b += 4;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            diff0 = (ResultType)(*a++ - *b++);
+            result += diff0 * diff0;
+        }
+        return result;
+    }
+
+    /**
+     *	Partial euclidean distance, using just one dimension. This is used by the
+     *	kd-tree when computing partial distances while traversing the tree.
+     *
+     *	Squared root is omitted for efficiency.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return (a-b)*(a-b);
+    }
+};
+
+
+/*
+ * Manhattan distance functor, optimized version
+ */
+template<class T>
+struct L1
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the Manhattan (L_1) distance between two vectors.
+     *
+     *	This is highly optimised, with loop unrolling, as it is one
+     *	of the most expensive inner loops.
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = (ResultType)abs(a[0] - b[0]);
+            diff1 = (ResultType)abs(a[1] - b[1]);
+            diff2 = (ResultType)abs(a[2] - b[2]);
+            diff3 = (ResultType)abs(a[3] - b[3]);
+            result += diff0 + diff1 + diff2 + diff3;
+            a += 4;
+            b += 4;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            diff0 = (ResultType)abs(*a++ - *b++);
+            result += diff0;
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return abs(a-b);
+    }
+};
+
+
+
+template<class T>
+struct MinkowskiDistance
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    int order;
+
+    MinkowskiDistance(int order_) : order(order_) {}
+
+    /**
+     *  Compute the Minkowsky (L_p) distance between two vectors.
+     *
+     *	This is highly optimised, with loop unrolling, as it is one
+     *	of the most expensive inner loops.
+     *
+     *	The computation of squared root at the end is omitted for
+     *	efficiency.
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = (ResultType)abs(a[0] - b[0]);
+            diff1 = (ResultType)abs(a[1] - b[1]);
+            diff2 = (ResultType)abs(a[2] - b[2]);
+            diff3 = (ResultType)abs(a[3] - b[3]);
+            result += pow(diff0,order) + pow(diff1,order) + pow(diff2,order) + pow(diff3,order);
+            a += 4;
+            b += 4;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            diff0 = (ResultType)abs(*a++ - *b++);
+            result += pow(diff0,order);
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return pow(static_cast<ResultType>(abs(a-b)),order);
+    }
+};
+
+
+
+template<class T>
+struct MaxDistance
+{
+    typedef False is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the max distance (L_infinity) between two vectors.
+     *
+     *  This distance is not a valid kdtree distance, it's not dimensionwise additive.
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = abs(a[0] - b[0]);
+            diff1 = abs(a[1] - b[1]);
+            diff2 = abs(a[2] - b[2]);
+            diff3 = abs(a[3] - b[3]);
+            if (diff0>result) {result = diff0; }
+            if (diff1>result) {result = diff1; }
+            if (diff2>result) {result = diff2; }
+            if (diff3>result) {result = diff3; }
+            a += 4;
+            b += 4;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            diff0 = abs(*a++ - *b++);
+            result = (diff0>result) ? diff0 : result;
+        }
+        return result;
+    }
+
+    /* This distance functor is not dimension-wise additive, which
+     * makes it an invalid kd-tree distance, not implementing the accum_dist method */
+
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Hamming distance functor - counts the bit differences between two strings - useful for the Brief descriptor
+ * bit count of A exclusive XOR'ed with B
+ */
+struct HammingLUT
+{
+    typedef False is_kdtree_distance;
+    typedef False is_vector_space_distance;
+
+    typedef unsigned char ElementType;
+    typedef int ResultType;
+
+    /** this will count the bits in a ^ b
+     */
+    ResultType operator()(const unsigned char* a, const unsigned char* b, size_t size) const
+    {
+        static const uchar popCountTable[] =
+        {
+            0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+            1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+            1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+            2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+            1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+            2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+            2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+            3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
+        };
+        ResultType result = 0;
+        for (size_t i = 0; i < size; i++) {
+            result += popCountTable[a[i] ^ b[i]];
+        }
+        return result;
+    }
+};
+
+/**
+ * Hamming distance functor (pop count between two binary vectors, i.e. xor them and count the number of bits set)
+ * That code was taken from brief.cpp in OpenCV
+ */
+template<class T>
+struct Hamming
+{
+    typedef False is_kdtree_distance;
+    typedef False is_vector_space_distance;
+
+
+    typedef T ElementType;
+    typedef int ResultType;
+
+    template<typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
+    {
+        ResultType result = 0;
+#ifdef __ARM_NEON__
+        {
+            uint32x4_t bits = vmovq_n_u32(0);
+            for (size_t i = 0; i < size; i += 16) {
+                uint8x16_t A_vec = vld1q_u8 (a + i);
+                uint8x16_t B_vec = vld1q_u8 (b + i);
+                uint8x16_t AxorB = veorq_u8 (A_vec, B_vec);
+                uint8x16_t bitsSet = vcntq_u8 (AxorB);
+                uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet);
+                uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8);
+                bits = vaddq_u32(bits, bitSet4);
+            }
+            uint64x2_t bitSet2 = vpaddlq_u32 (bits);
+            result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
+            result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
+        }
+#elif __GNUC__
+        {
+            //for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll)
+            typedef unsigned long long pop_t;
+            const size_t modulo = size % sizeof(pop_t);
+            const pop_t* a2 = reinterpret_cast<const pop_t*> (a);
+            const pop_t* b2 = reinterpret_cast<const pop_t*> (b);
+            const pop_t* a2_end = a2 + (size / sizeof(pop_t));
+
+            for (; a2 != a2_end; ++a2, ++b2) result += __builtin_popcountll((*a2) ^ (*b2));
+
+            if (modulo) {
+                //in the case where size is not dividable by sizeof(size_t)
+                //need to mask off the bits at the end
+                pop_t a_final = 0, b_final = 0;
+                memcpy(&a_final, a2, modulo);
+                memcpy(&b_final, b2, modulo);
+                result += __builtin_popcountll(a_final ^ b_final);
+            }
+        }
+#else // NO NEON and NOT GNUC
+        typedef unsigned long long pop_t;
+        HammingLUT lut;
+        result = lut(reinterpret_cast<const unsigned char*> (a),
+                     reinterpret_cast<const unsigned char*> (b), size * sizeof(pop_t));
+#endif
+        return result;
+    }
+};
+
+template<typename T>
+struct Hamming2
+{
+    typedef False is_kdtree_distance;
+    typedef False is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef int ResultType;
+
+    /** This is popcount_3() from:
+     * http://en.wikipedia.org/wiki/Hamming_weight */
+    unsigned int popcnt32(uint32_t n) const
+    {
+        n -= ((n >> 1) & 0x55555555);
+        n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
+        return (((n + (n >> 4))& 0xF0F0F0F)* 0x1010101) >> 24;
+    }
+
+#ifdef FLANN_PLATFORM_64_BIT
+    unsigned int popcnt64(uint64_t n) const
+    {
+        n -= ((n >> 1) & 0x5555555555555555);
+        n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333);
+        return (((n + (n >> 4))& 0x0f0f0f0f0f0f0f0f)* 0x0101010101010101) >> 56;
+    }
+#endif
+
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
+    {
+#ifdef FLANN_PLATFORM_64_BIT
+        const uint64_t* pa = reinterpret_cast<const uint64_t*>(a);
+        const uint64_t* pb = reinterpret_cast<const uint64_t*>(b);
+        ResultType result = 0;
+        size /= (sizeof(uint64_t)/sizeof(unsigned char));
+        for(size_t i = 0; i < size; ++i ) {
+            result += popcnt64(*pa ^ *pb);
+            ++pa;
+            ++pb;
+        }
+#else
+        const uint32_t* pa = reinterpret_cast<const uint32_t*>(a);
+        const uint32_t* pb = reinterpret_cast<const uint32_t*>(b);
+        ResultType result = 0;
+        size /= (sizeof(uint32_t)/sizeof(unsigned char));
+        for(size_t i = 0; i < size; ++i ) {
+            result += popcnt32(*pa ^ *pb);
+            ++pa;
+            ++pb;
+        }
+#endif
+        return result;
+    }
+};
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+template<class T>
+struct HistIntersectionDistance
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the histogram intersection distance
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType min0, min1, min2, min3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            min0 = (ResultType)(a[0] < b[0] ? a[0] : b[0]);
+            min1 = (ResultType)(a[1] < b[1] ? a[1] : b[1]);
+            min2 = (ResultType)(a[2] < b[2] ? a[2] : b[2]);
+            min3 = (ResultType)(a[3] < b[3] ? a[3] : b[3]);
+            result += min0 + min1 + min2 + min3;
+            a += 4;
+            b += 4;
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        /* Process last 0-3 pixels.  Not needed for standard vector lengths. */
+        while (a < last) {
+            min0 = (ResultType)(*a < *b ? *a : *b);
+            result += min0;
+            ++a;
+            ++b;
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        return a<b ? a : b;
+    }
+};
+
+
+
+template<class T>
+struct HellingerDistance
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the Hellinger distance
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType diff0, diff1, diff2, diff3;
+        Iterator1 last = a + size;
+        Iterator1 lastgroup = last - 3;
+
+        /* Process 4 items with each loop for efficiency. */
+        while (a < lastgroup) {
+            diff0 = sqrt(static_cast<ResultType>(a[0])) - sqrt(static_cast<ResultType>(b[0]));
+            diff1 = sqrt(static_cast<ResultType>(a[1])) - sqrt(static_cast<ResultType>(b[1]));
+            diff2 = sqrt(static_cast<ResultType>(a[2])) - sqrt(static_cast<ResultType>(b[2]));
+            diff3 = sqrt(static_cast<ResultType>(a[3])) - sqrt(static_cast<ResultType>(b[3]));
+            result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3;
+            a += 4;
+            b += 4;
+        }
+        while (a < last) {
+            diff0 = sqrt(static_cast<ResultType>(*a++)) - sqrt(static_cast<ResultType>(*b++));
+            result += diff0 * diff0;
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        ResultType diff = sqrt(static_cast<ResultType>(a)) - sqrt(static_cast<ResultType>(b));
+        return diff * diff;
+    }
+};
+
+
+template<class T>
+struct ChiSquareDistance
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the chi-square distance
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        ResultType sum, diff;
+        Iterator1 last = a + size;
+
+        while (a < last) {
+            sum = (ResultType)(*a + *b);
+            if (sum>0) {
+                diff = (ResultType)(*a - *b);
+                result += diff*diff/sum;
+            }
+            ++a;
+            ++b;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        ResultType result = ResultType();
+        ResultType sum, diff;
+
+        sum = (ResultType)(a+b);
+        if (sum>0) {
+            diff = (ResultType)(a-b);
+            result = diff*diff/sum;
+        }
+        return result;
+    }
+};
+
+
+template<class T>
+struct KL_Divergence
+{
+    typedef True is_kdtree_distance;
+    typedef True is_vector_space_distance;
+
+    typedef T ElementType;
+    typedef typename Accumulator<T>::Type ResultType;
+
+    /**
+     *  Compute the Kullback鈥揕eibler divergence
+     */
+    template <typename Iterator1, typename Iterator2>
+    ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const
+    {
+        ResultType result = ResultType();
+        Iterator1 last = a + size;
+
+        while (a < last) {
+            if (* b != 0) {
+                ResultType ratio = (ResultType)(*a / *b);
+                if (ratio>0) {
+                    result += *a * log(ratio);
+                }
+            }
+            ++a;
+            ++b;
+
+            if ((worst_dist>0)&&(result>worst_dist)) {
+                return result;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Partial distance, used by the kd-tree.
+     */
+    template <typename U, typename V>
+    inline ResultType accum_dist(const U& a, const V& b, int) const
+    {
+        ResultType result = ResultType();
+        if( *b != 0 ) {
+            ResultType ratio = (ResultType)(a / b);
+            if (ratio>0) {
+                result = a * log(ratio);
+            }
+        }
+        return result;
+    }
+};
+
+
+
+/*
+ * This is a "zero iterator". It basically behaves like a zero filled
+ * array to all algorithms that use arrays as iterators (STL style).
+ * It's useful when there's a need to compute the distance between feature
+ * and origin it and allows for better compiler optimisation than using a
+ * zero-filled array.
+ */
+template <typename T>
+struct ZeroIterator
+{
+
+    T operator*()
+    {
+        return 0;
+    }
+
+    T operator[](int)
+    {
+        return 0;
+    }
+
+    const ZeroIterator<T>& operator ++()
+    {
+        return *this;
+    }
+
+    ZeroIterator<T> operator ++(int)
+    {
+        return *this;
+    }
+
+    ZeroIterator<T>& operator+=(int)
+    {
+        return *this;
+    }
+
+};
+
+
+/*
+ * Depending on processed distances, some of them are already squared (e.g. L2)
+ * and some are not (e.g.Hamming). In KMeans++ for instance we want to be sure
+ * we are working on ^2 distances, thus following templates to ensure that.
+ */
+template <typename Distance, typename ElementType>
+struct squareDistance
+{
+    typedef typename Distance::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist*dist; }
+};
+
+
+template <typename ElementType>
+struct squareDistance<L2_Simple<ElementType>, ElementType>
+{
+    typedef typename L2_Simple<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+template <typename ElementType>
+struct squareDistance<L2<ElementType>, ElementType>
+{
+    typedef typename L2<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+
+template <typename ElementType>
+struct squareDistance<MinkowskiDistance<ElementType>, ElementType>
+{
+    typedef typename MinkowskiDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+template <typename ElementType>
+struct squareDistance<HellingerDistance<ElementType>, ElementType>
+{
+    typedef typename HellingerDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+template <typename ElementType>
+struct squareDistance<ChiSquareDistance<ElementType>, ElementType>
+{
+    typedef typename ChiSquareDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+
+template <typename Distance>
+typename Distance::ResultType ensureSquareDistance( typename Distance::ResultType dist )
+{
+    typedef typename Distance::ElementType ElementType;
+
+    squareDistance<Distance, ElementType> dummy;
+    return dummy( dist );
+}
+
+
+/*
+ * ...and a template to ensure the user that he will process the normal distance,
+ * and not squared distance, without loosing processing time calling sqrt(ensureSquareDistance)
+ * that will result in doing actually sqrt(dist*dist) for L1 distance for instance.
+ */
+template <typename Distance, typename ElementType>
+struct simpleDistance
+{
+    typedef typename Distance::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return dist; }
+};
+
+
+template <typename ElementType>
+struct simpleDistance<L2_Simple<ElementType>, ElementType>
+{
+    typedef typename L2_Simple<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+template <typename ElementType>
+struct simpleDistance<L2<ElementType>, ElementType>
+{
+    typedef typename L2<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+
+template <typename ElementType>
+struct simpleDistance<MinkowskiDistance<ElementType>, ElementType>
+{
+    typedef typename MinkowskiDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+template <typename ElementType>
+struct simpleDistance<HellingerDistance<ElementType>, ElementType>
+{
+    typedef typename HellingerDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+template <typename ElementType>
+struct simpleDistance<ChiSquareDistance<ElementType>, ElementType>
+{
+    typedef typename ChiSquareDistance<ElementType>::ResultType ResultType;
+    ResultType operator()( ResultType dist ) { return sqrt(dist); }
+};
+
+
+template <typename Distance>
+typename Distance::ResultType ensureSimpleDistance( typename Distance::ResultType dist )
+{
+    typedef typename Distance::ElementType ElementType;
+
+    simpleDistance<Distance, ElementType> dummy;
+    return dummy( dist );
+}
+
+}
+
+#endif //OPENCV_FLANN_DIST_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h
new file mode 100644
index 0000000..26bd3fa
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dummy.h
@@ -0,0 +1,16 @@
+
+#ifndef OPENCV_FLANN_DUMMY_H_
+#define OPENCV_FLANN_DUMMY_H_
+
+namespace cvflann
+{
+
+#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS
+__declspec(dllexport)
+#endif
+void dummyfunc();
+
+}
+
+
+#endif  /* OPENCV_FLANN_DUMMY_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h
new file mode 100644
index 0000000..d795b5d
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/dynamic_bitset.h
@@ -0,0 +1,159 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+/***********************************************************************
+ * Author: Vincent Rabaud
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_DYNAMIC_BITSET_H_
+#define OPENCV_FLANN_DYNAMIC_BITSET_H_
+
+#ifndef FLANN_USE_BOOST
+#  define FLANN_USE_BOOST 0
+#endif
+//#define FLANN_USE_BOOST 1
+#if FLANN_USE_BOOST
+#include <boost/dynamic_bitset.hpp>
+typedef boost::dynamic_bitset<> DynamicBitset;
+#else
+
+#include <limits.h>
+
+#include "dist.h"
+
+namespace cvflann {
+
+/** Class re-implementing the boost version of it
+ * This helps not depending on boost, it also does not do the bound checks
+ * and has a way to reset a block for speed
+ */
+class DynamicBitset
+{
+public:
+    /** default constructor
+     */
+    DynamicBitset()
+    {
+    }
+
+    /** only constructor we use in our code
+     * @param sz the size of the bitset (in bits)
+     */
+    DynamicBitset(size_t sz)
+    {
+        resize(sz);
+        reset();
+    }
+
+    /** Sets all the bits to 0
+     */
+    void clear()
+    {
+        std::fill(bitset_.begin(), bitset_.end(), 0);
+    }
+
+    /** @brief checks if the bitset is empty
+     * @return true if the bitset is empty
+     */
+    bool empty() const
+    {
+        return bitset_.empty();
+    }
+
+    /** set all the bits to 0
+     */
+    void reset()
+    {
+        std::fill(bitset_.begin(), bitset_.end(), 0);
+    }
+
+    /** @brief set one bit to 0
+     * @param index
+     */
+    void reset(size_t index)
+    {
+        bitset_[index / cell_bit_size_] &= ~(size_t(1) << (index % cell_bit_size_));
+    }
+
+    /** @brief sets a specific bit to 0, and more bits too
+     * This function is useful when resetting a given set of bits so that the
+     * whole bitset ends up being 0: if that's the case, we don't care about setting
+     * other bits to 0
+     * @param index
+     */
+    void reset_block(size_t index)
+    {
+        bitset_[index / cell_bit_size_] = 0;
+    }
+
+    /** resize the bitset so that it contains at least sz bits
+     * @param sz
+     */
+    void resize(size_t sz)
+    {
+        size_ = sz;
+        bitset_.resize(sz / cell_bit_size_ + 1);
+    }
+
+    /** set a bit to true
+     * @param index the index of the bit to set to 1
+     */
+    void set(size_t index)
+    {
+        bitset_[index / cell_bit_size_] |= size_t(1) << (index % cell_bit_size_);
+    }
+
+    /** gives the number of contained bits
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /** check if a bit is set
+     * @param index the index of the bit to check
+     * @return true if the bit is set
+     */
+    bool test(size_t index) const
+    {
+        return (bitset_[index / cell_bit_size_] & (size_t(1) << (index % cell_bit_size_))) != 0;
+    }
+
+private:
+    std::vector<size_t> bitset_;
+    size_t size_;
+    static const unsigned int cell_bit_size_ = CHAR_BIT * sizeof(size_t);
+};
+
+} // namespace cvflann
+
+#endif
+
+#endif // OPENCV_FLANN_DYNAMIC_BITSET_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp
new file mode 100644
index 0000000..227683f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/flann.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/flann.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp
new file mode 100644
index 0000000..98c33cf
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/flann_base.hpp
@@ -0,0 +1,290 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_BASE_HPP_
+#define OPENCV_FLANN_BASE_HPP_
+
+#include <vector>
+#include <cassert>
+#include <cstdio>
+
+#include "general.h"
+#include "matrix.h"
+#include "params.h"
+#include "saving.h"
+
+#include "all_indices.h"
+
+namespace cvflann
+{
+
+/**
+ * Sets the log level used for all flann functions
+ * @param level Verbosity level
+ */
+inline void log_verbosity(int level)
+{
+    if (level >= 0) {
+        Logger::setLevel(level);
+    }
+}
+
+/**
+ * (Deprecated) Index parameters for creating a saved index.
+ */
+struct SavedIndexParams : public IndexParams
+{
+    SavedIndexParams(cv::String filename)
+    {
+        (* this)["algorithm"] = FLANN_INDEX_SAVED;
+        (*this)["filename"] = filename;
+    }
+};
+
+
+template<typename Distance>
+NNIndex<Distance>* load_saved_index(const Matrix<typename Distance::ElementType>& dataset, const cv::String& filename, Distance distance)
+{
+    typedef typename Distance::ElementType ElementType;
+
+    FILE* fin = fopen(filename.c_str(), "rb");
+    if (fin == NULL) {
+        return NULL;
+    }
+    IndexHeader header = load_header(fin);
+    if (header.data_type != Datatype<ElementType>::type()) {
+        throw FLANNException("Datatype of saved index is different than of the one to be created.");
+    }
+    if ((size_t(header.rows) != dataset.rows)||(size_t(header.cols) != dataset.cols)) {
+        throw FLANNException("The index saved belongs to a different dataset");
+    }
+
+    IndexParams params;
+    params["algorithm"] = header.index_type;
+    NNIndex<Distance>* nnIndex = create_index_by_type<Distance>(dataset, params, distance);
+    nnIndex->loadIndex(fin);
+    fclose(fin);
+
+    return nnIndex;
+}
+
+
+template<typename Distance>
+class Index : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    Index(const Matrix<ElementType>& features, const IndexParams& params, Distance distance = Distance() )
+        : index_params_(params)
+    {
+        flann_algorithm_t index_type = get_param<flann_algorithm_t>(params,"algorithm");
+        loaded_ = false;
+
+        if (index_type == FLANN_INDEX_SAVED) {
+            nnIndex_ = load_saved_index<Distance>(features, get_param<cv::String>(params,"filename"), distance);
+            loaded_ = true;
+        }
+        else {
+            nnIndex_ = create_index_by_type<Distance>(features, params, distance);
+        }
+    }
+
+    ~Index()
+    {
+        delete nnIndex_;
+    }
+
+    /**
+     * Builds the index.
+     */
+    void buildIndex()
+    {
+        if (!loaded_) {
+            nnIndex_->buildIndex();
+        }
+    }
+
+    void save(cv::String filename)
+    {
+        FILE* fout = fopen(filename.c_str(), "wb");
+        if (fout == NULL) {
+            throw FLANNException("Cannot open file");
+        }
+        save_header(fout, *nnIndex_);
+        saveIndex(fout);
+        fclose(fout);
+    }
+
+    /**
+     * \brief Saves the index to a stream
+     * \param stream The stream to save the index to
+     */
+    virtual void saveIndex(FILE* stream)
+    {
+        nnIndex_->saveIndex(stream);
+    }
+
+    /**
+     * \brief Loads the index from a stream
+     * \param stream The stream from which the index is loaded
+     */
+    virtual void loadIndex(FILE* stream)
+    {
+        nnIndex_->loadIndex(stream);
+    }
+
+    /**
+     * \returns number of features in this index.
+     */
+    size_t veclen() const
+    {
+        return nnIndex_->veclen();
+    }
+
+    /**
+     * \returns The dimensionality of the features in this index.
+     */
+    size_t size() const
+    {
+        return nnIndex_->size();
+    }
+
+    /**
+     * \returns The index type (kdtree, kmeans,...)
+     */
+    flann_algorithm_t getType() const
+    {
+        return nnIndex_->getType();
+    }
+
+    /**
+     * \returns The amount of memory (in bytes) used by the index.
+     */
+    virtual int usedMemory() const
+    {
+        return nnIndex_->usedMemory();
+    }
+
+
+    /**
+     * \returns The index parameters
+     */
+    IndexParams getParameters() const
+    {
+        return nnIndex_->getParameters();
+    }
+
+    /**
+     * \brief Perform k-nearest neighbor search
+     * \param[in] queries The query points for which to find the nearest neighbors
+     * \param[out] indices The indices of the nearest neighbors found
+     * \param[out] dists Distances to the nearest neighbors found
+     * \param[in] knn Number of nearest neighbors to return
+     * \param[in] params Search parameters
+     */
+    void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
+    {
+        nnIndex_->knnSearch(queries, indices, dists, knn, params);
+    }
+
+    /**
+     * \brief Perform radius search
+     * \param[in] query The query point
+     * \param[out] indices The indinces of the neighbors found within the given radius
+     * \param[out] dists The distances to the nearest neighbors found
+     * \param[in] radius The radius used for search
+     * \param[in] params Search parameters
+     * \returns Number of neighbors found
+     */
+    int radiusSearch(const Matrix<ElementType>& query, Matrix<int>& indices, Matrix<DistanceType>& dists, float radius, const SearchParams& params)
+    {
+        return nnIndex_->radiusSearch(query, indices, dists, radius, params);
+    }
+
+    /**
+     * \brief Method that searches for nearest-neighbours
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        nnIndex_->findNeighbors(result, vec, searchParams);
+    }
+
+    /**
+     * \brief Returns actual index
+     */
+    FLANN_DEPRECATED NNIndex<Distance>* getIndex()
+    {
+        return nnIndex_;
+    }
+
+    /**
+     * \brief Returns index parameters.
+     * \deprecated use getParameters() instead.
+     */
+    FLANN_DEPRECATED  const IndexParams* getIndexParameters()
+    {
+        return &index_params_;
+    }
+
+private:
+    /** Pointer to actual index class */
+    NNIndex<Distance>* nnIndex_;
+    /** Indices if the index was loaded from a file */
+    bool loaded_;
+    /** Parameters passed to the index */
+    IndexParams index_params_;
+};
+
+/**
+ * Performs a hierarchical clustering of the points passed as argument and then takes a cut in the
+ * the clustering tree to return a flat clustering.
+ * @param[in] points Points to be clustered
+ * @param centers The computed cluster centres. Matrix should be preallocated and centers.rows is the
+ *  number of clusters requested.
+ * @param params Clustering parameters (The same as for cvflann::KMeansIndex)
+ * @param d Distance to be used for clustering (eg: cvflann::L2)
+ * @return number of clusters computed (can be different than clusters.rows and is the highest number
+ * of the form (branching-1)*K+1 smaller than clusters.rows).
+ */
+template <typename Distance>
+int hierarchicalClustering(const Matrix<typename Distance::ElementType>& points, Matrix<typename Distance::ResultType>& centers,
+                           const KMeansIndexParams& params, Distance d = Distance())
+{
+    KMeansIndex<Distance> kmeans(points, params, d);
+    kmeans.buildIndex();
+
+    int clusterNum = kmeans.getClusterCenters(centers);
+    return clusterNum;
+}
+
+}
+#endif /* OPENCV_FLANN_BASE_HPP_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/general.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/general.h
new file mode 100644
index 0000000..9d5402a
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/general.h
@@ -0,0 +1,50 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_GENERAL_H_
+#define OPENCV_FLANN_GENERAL_H_
+
+#include "opencv2/core.hpp"
+
+namespace cvflann
+{
+
+class FLANNException : public cv::Exception
+{
+public:
+    FLANNException(const char* message) : cv::Exception(0, message, "", __FILE__, __LINE__) { }
+
+    FLANNException(const cv::String& message) : cv::Exception(0, message, "", __FILE__, __LINE__) { }
+};
+
+}
+
+
+#endif  /* OPENCV_FLANN_GENERAL_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h
new file mode 100644
index 0000000..fd8f3ae
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/ground_truth.h
@@ -0,0 +1,94 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_GROUND_TRUTH_H_
+#define OPENCV_FLANN_GROUND_TRUTH_H_
+
+#include "dist.h"
+#include "matrix.h"
+
+
+namespace cvflann
+{
+
+template <typename Distance>
+void find_nearest(const Matrix<typename Distance::ElementType>& dataset, typename Distance::ElementType* query, int* matches, int nn,
+                  int skip = 0, Distance distance = Distance())
+{
+    typedef typename Distance::ResultType DistanceType;
+    int n = nn + skip;
+
+    std::vector<int> match(n);
+    std::vector<DistanceType> dists(n);
+
+    dists[0] = distance(dataset[0], query, dataset.cols);
+    match[0] = 0;
+    int dcnt = 1;
+
+    for (size_t i=1; i<dataset.rows; ++i) {
+        DistanceType tmp = distance(dataset[i], query, dataset.cols);
+
+        if (dcnt<n) {
+            match[dcnt] = (int)i;
+            dists[dcnt++] = tmp;
+        }
+        else if (tmp < dists[dcnt-1]) {
+            dists[dcnt-1] = tmp;
+            match[dcnt-1] = (int)i;
+        }
+
+        int j = dcnt-1;
+        // bubble up
+        while (j>=1 && dists[j]<dists[j-1]) {
+            std::swap(dists[j],dists[j-1]);
+            std::swap(match[j],match[j-1]);
+            j--;
+        }
+    }
+
+    for (int i=0; i<nn; ++i) {
+        matches[i] = match[i+skip];
+    }
+}
+
+
+template <typename Distance>
+void compute_ground_truth(const Matrix<typename Distance::ElementType>& dataset, const Matrix<typename Distance::ElementType>& testset, Matrix<int>& matches,
+                          int skip=0, Distance d = Distance())
+{
+    for (size_t i=0; i<testset.rows; ++i) {
+        find_nearest<Distance>(dataset, testset[i], matches[i], (int)matches.cols, skip, d);
+    }
+}
+
+
+}
+
+#endif //OPENCV_FLANN_GROUND_TRUTH_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h
new file mode 100644
index 0000000..80d23b9
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/hdf5.h
@@ -0,0 +1,231 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_HDF5_H_
+#define OPENCV_FLANN_HDF5_H_
+
+#include <hdf5.h>
+
+#include "matrix.h"
+
+
+namespace cvflann
+{
+
+namespace
+{
+
+template<typename T>
+hid_t get_hdf5_type()
+{
+    throw FLANNException("Unsupported type for IO operations");
+}
+
+template<>
+hid_t get_hdf5_type<char>() { return H5T_NATIVE_CHAR; }
+template<>
+hid_t get_hdf5_type<unsigned char>() { return H5T_NATIVE_UCHAR; }
+template<>
+hid_t get_hdf5_type<short int>() { return H5T_NATIVE_SHORT; }
+template<>
+hid_t get_hdf5_type<unsigned short int>() { return H5T_NATIVE_USHORT; }
+template<>
+hid_t get_hdf5_type<int>() { return H5T_NATIVE_INT; }
+template<>
+hid_t get_hdf5_type<unsigned int>() { return H5T_NATIVE_UINT; }
+template<>
+hid_t get_hdf5_type<long>() { return H5T_NATIVE_LONG; }
+template<>
+hid_t get_hdf5_type<unsigned long>() { return H5T_NATIVE_ULONG; }
+template<>
+hid_t get_hdf5_type<float>() { return H5T_NATIVE_FLOAT; }
+template<>
+hid_t get_hdf5_type<double>() { return H5T_NATIVE_DOUBLE; }
+}
+
+
+#define CHECK_ERROR(x,y) if ((x)<0) throw FLANNException((y));
+
+template<typename T>
+void save_to_file(const cvflann::Matrix<T>& dataset, const String& filename, const String& name)
+{
+
+#if H5Eset_auto_vers == 2
+    H5Eset_auto( H5E_DEFAULT, NULL, NULL );
+#else
+    H5Eset_auto( NULL, NULL );
+#endif
+
+    herr_t status;
+    hid_t file_id;
+    file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
+    if (file_id < 0) {
+        file_id = H5Fcreate(filename.c_str(), H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
+    }
+    CHECK_ERROR(file_id,"Error creating hdf5 file.");
+
+    hsize_t     dimsf[2];              // dataset dimensions
+    dimsf[0] = dataset.rows;
+    dimsf[1] = dataset.cols;
+
+    hid_t space_id = H5Screate_simple(2, dimsf, NULL);
+    hid_t memspace_id = H5Screate_simple(2, dimsf, NULL);
+
+    hid_t dataset_id;
+#if H5Dcreate_vers == 2
+    dataset_id = H5Dcreate2(file_id, name.c_str(), get_hdf5_type<T>(), space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
+    dataset_id = H5Dcreate(file_id, name.c_str(), get_hdf5_type<T>(), space_id, H5P_DEFAULT);
+#endif
+
+    if (dataset_id<0) {
+#if H5Dopen_vers == 2
+        dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
+#else
+        dataset_id = H5Dopen(file_id, name.c_str());
+#endif
+    }
+    CHECK_ERROR(dataset_id,"Error creating or opening dataset in file.");
+
+    status = H5Dwrite(dataset_id, get_hdf5_type<T>(), memspace_id, space_id, H5P_DEFAULT, dataset.data );
+    CHECK_ERROR(status, "Error writing to dataset");
+
+    H5Sclose(memspace_id);
+    H5Sclose(space_id);
+    H5Dclose(dataset_id);
+    H5Fclose(file_id);
+
+}
+
+
+template<typename T>
+void load_from_file(cvflann::Matrix<T>& dataset, const String& filename, const String& name)
+{
+    herr_t status;
+    hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
+    CHECK_ERROR(file_id,"Error opening hdf5 file.");
+
+    hid_t dataset_id;
+#if H5Dopen_vers == 2
+    dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
+#else
+    dataset_id = H5Dopen(file_id, name.c_str());
+#endif
+    CHECK_ERROR(dataset_id,"Error opening dataset in file.");
+
+    hid_t space_id = H5Dget_space(dataset_id);
+
+    hsize_t dims_out[2];
+    H5Sget_simple_extent_dims(space_id, dims_out, NULL);
+
+    dataset = cvflann::Matrix<T>(new T[dims_out[0]*dims_out[1]], dims_out[0], dims_out[1]);
+
+    status = H5Dread(dataset_id, get_hdf5_type<T>(), H5S_ALL, H5S_ALL, H5P_DEFAULT, dataset[0]);
+    CHECK_ERROR(status, "Error reading dataset");
+
+    H5Sclose(space_id);
+    H5Dclose(dataset_id);
+    H5Fclose(file_id);
+}
+
+
+#ifdef HAVE_MPI
+
+namespace mpi
+{
+/**
+ * Loads a the hyperslice corresponding to this processor from a hdf5 file.
+ * @param flann_dataset Dataset where the data is loaded
+ * @param filename HDF5 file name
+ * @param name Name of dataset inside file
+ */
+template<typename T>
+void load_from_file(cvflann::Matrix<T>& dataset, const String& filename, const String& name)
+{
+    MPI_Comm comm  = MPI_COMM_WORLD;
+    MPI_Info info  = MPI_INFO_NULL;
+
+    int mpi_size, mpi_rank;
+    MPI_Comm_size(comm, &mpi_size);
+    MPI_Comm_rank(comm, &mpi_rank);
+
+    herr_t status;
+
+    hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS);
+    H5Pset_fapl_mpio(plist_id, comm, info);
+    hid_t file_id = H5Fopen(filename.c_str(), H5F_ACC_RDWR, plist_id);
+    CHECK_ERROR(file_id,"Error opening hdf5 file.");
+    H5Pclose(plist_id);
+    hid_t dataset_id;
+#if H5Dopen_vers == 2
+    dataset_id = H5Dopen2(file_id, name.c_str(), H5P_DEFAULT);
+#else
+    dataset_id = H5Dopen(file_id, name.c_str());
+#endif
+    CHECK_ERROR(dataset_id,"Error opening dataset in file.");
+
+    hid_t space_id = H5Dget_space(dataset_id);
+    hsize_t dims[2];
+    H5Sget_simple_extent_dims(space_id, dims, NULL);
+
+    hsize_t count[2];
+    hsize_t offset[2];
+
+    hsize_t item_cnt = dims[0]/mpi_size+(dims[0]%mpi_size==0 ? 0 : 1);
+    hsize_t cnt = (mpi_rank<mpi_size-1 ? item_cnt : dims[0]-item_cnt*(mpi_size-1));
+
+    count[0] = cnt;
+    count[1] = dims[1];
+    offset[0] = mpi_rank*item_cnt;
+    offset[1] = 0;
+
+    hid_t memspace_id = H5Screate_simple(2,count,NULL);
+
+    H5Sselect_hyperslab(space_id, H5S_SELECT_SET, offset, NULL, count, NULL);
+
+    dataset.rows = count[0];
+    dataset.cols = count[1];
+    dataset.data = new T[dataset.rows*dataset.cols];
+
+    plist_id = H5Pcreate(H5P_DATASET_XFER);
+    H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
+    status = H5Dread(dataset_id, get_hdf5_type<T>(), memspace_id, space_id, plist_id, dataset.data);
+    CHECK_ERROR(status, "Error reading dataset");
+
+    H5Pclose(plist_id);
+    H5Sclose(space_id);
+    H5Sclose(memspace_id);
+    H5Dclose(dataset_id);
+    H5Fclose(file_id);
+}
+}
+#endif // HAVE_MPI
+} // namespace cvflann::mpi
+
+#endif /* OPENCV_FLANN_HDF5_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/heap.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/heap.h
new file mode 100644
index 0000000..92a6ea6
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/heap.h
@@ -0,0 +1,165 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_HEAP_H_
+#define OPENCV_FLANN_HEAP_H_
+
+#include <algorithm>
+#include <vector>
+
+namespace cvflann
+{
+
+/**
+ * Priority Queue Implementation
+ *
+ * The priority queue is implemented with a heap.  A heap is a complete
+ * (full) binary tree in which each parent is less than both of its
+ * children, but the order of the children is unspecified.
+ */
+template <typename T>
+class Heap
+{
+
+    /**
+     * Storage array for the heap.
+     * Type T must be comparable.
+     */
+    std::vector<T> heap;
+    int length;
+
+    /**
+     * Number of element in the heap
+     */
+    int count;
+
+
+
+public:
+    /**
+     * Constructor.
+     *
+     * Params:
+     *     sz = heap size
+     */
+
+    Heap(int sz)
+    {
+        length = sz;
+        heap.reserve(length);
+        count = 0;
+    }
+
+    /**
+     *
+     * Returns: heap size
+     */
+    int size()
+    {
+        return count;
+    }
+
+    /**
+     * Tests if the heap is empty
+     *
+     * Returns: true is heap empty, false otherwise
+     */
+    bool empty()
+    {
+        return size()==0;
+    }
+
+    /**
+     * Clears the heap.
+     */
+    void clear()
+    {
+        heap.clear();
+        count = 0;
+    }
+
+    struct CompareT
+    {
+        bool operator()(const T& t_1, const T& t_2) const
+        {
+            return t_2 < t_1;
+        }
+    };
+
+    /**
+     * Insert a new element in the heap.
+     *
+     * We select the next empty leaf node, and then keep moving any larger
+     * parents down until the right location is found to store this element.
+     *
+     * Params:
+     *     value = the new element to be inserted in the heap
+     */
+    void insert(T value)
+    {
+        /* If heap is full, then return without adding this element. */
+        if (count == length) {
+            return;
+        }
+
+        heap.push_back(value);
+        static CompareT compareT;
+        std::push_heap(heap.begin(), heap.end(), compareT);
+        ++count;
+    }
+
+
+
+    /**
+     * Returns the node of minimum value from the heap (top of the heap).
+     *
+     * Params:
+     *     value = out parameter used to return the min element
+     * Returns: false if heap empty
+     */
+    bool popMin(T& value)
+    {
+        if (count == 0) {
+            return false;
+        }
+
+        value = heap[0];
+        static CompareT compareT;
+        std::pop_heap(heap.begin(), heap.end(), compareT);
+        heap.pop_back();
+        --count;
+
+        return true;  /* Return old last node. */
+    }
+};
+
+}
+
+#endif //OPENCV_FLANN_HEAP_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h
new file mode 100644
index 0000000..9d890d4
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/hierarchical_clustering_index.h
@@ -0,0 +1,848 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2011  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2011  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_
+#define OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_
+
+#include <algorithm>
+#include <map>
+#include <cassert>
+#include <limits>
+#include <cmath>
+
+#include "general.h"
+#include "nn_index.h"
+#include "dist.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+
+
+namespace cvflann
+{
+
+struct HierarchicalClusteringIndexParams : public IndexParams
+{
+    HierarchicalClusteringIndexParams(int branching = 32,
+                                      flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM,
+                                      int trees = 4, int leaf_size = 100)
+    {
+        (*this)["algorithm"] = FLANN_INDEX_HIERARCHICAL;
+        // The branching factor used in the hierarchical clustering
+        (*this)["branching"] = branching;
+        // Algorithm used for picking the initial cluster centers
+        (*this)["centers_init"] = centers_init;
+        // number of parallel trees to build
+        (*this)["trees"] = trees;
+        // maximum leaf size
+        (*this)["leaf_size"] = leaf_size;
+    }
+};
+
+
+/**
+ * Hierarchical index
+ *
+ * Contains a tree constructed through a hierarchical clustering
+ * and other information for indexing a set of points for nearest-neighbour matching.
+ */
+template <typename Distance>
+class HierarchicalClusteringIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+private:
+
+
+    typedef void (HierarchicalClusteringIndex::* centersAlgFunction)(int, int*, int, int*, int&);
+
+    /**
+     * The function used for choosing the cluster centers.
+     */
+    centersAlgFunction chooseCenters;
+
+
+
+    /**
+     * Chooses the initial centers in the k-means clustering in a random manner.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     *     indices_length = length of indices vector
+     *
+     */
+    void chooseCentersRandom(int k, int* dsindices, int indices_length, int* centers, int& centers_length)
+    {
+        UniqueRandom r(indices_length);
+
+        int index;
+        for (index=0; index<k; ++index) {
+            bool duplicate = true;
+            int rnd;
+            while (duplicate) {
+                duplicate = false;
+                rnd = r.next();
+                if (rnd<0) {
+                    centers_length = index;
+                    return;
+                }
+
+                centers[index] = dsindices[rnd];
+
+                for (int j=0; j<index; ++j) {
+                    DistanceType sq = distance(dataset[centers[index]], dataset[centers[j]], dataset.cols);
+                    if (sq<1e-16) {
+                        duplicate = true;
+                    }
+                }
+            }
+        }
+
+        centers_length = index;
+    }
+
+
+    /**
+     * Chooses the initial centers in the k-means using Gonzales' algorithm
+     * so that the centers are spaced apart from each other.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void chooseCentersGonzales(int k, int* dsindices, int indices_length, int* centers, int& centers_length)
+    {
+        int n = indices_length;
+
+        int rnd = rand_int(n);
+        assert(rnd >=0 && rnd < n);
+
+        centers[0] = dsindices[rnd];
+
+        int index;
+        for (index=1; index<k; ++index) {
+
+            int best_index = -1;
+            DistanceType best_val = 0;
+            for (int j=0; j<n; ++j) {
+                DistanceType dist = distance(dataset[centers[0]],dataset[dsindices[j]],dataset.cols);
+                for (int i=1; i<index; ++i) {
+                    DistanceType tmp_dist = distance(dataset[centers[i]],dataset[dsindices[j]],dataset.cols);
+                    if (tmp_dist<dist) {
+                        dist = tmp_dist;
+                    }
+                }
+                if (dist>best_val) {
+                    best_val = dist;
+                    best_index = j;
+                }
+            }
+            if (best_index!=-1) {
+                centers[index] = dsindices[best_index];
+            }
+            else {
+                break;
+            }
+        }
+        centers_length = index;
+    }
+
+
+    /**
+     * Chooses the initial centers in the k-means using the algorithm
+     * proposed in the KMeans++ paper:
+     * Arthur, David; Vassilvitskii, Sergei - k-means++: The Advantages of Careful Seeding
+     *
+     * Implementation of this function was converted from the one provided in Arthur's code.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void chooseCentersKMeanspp(int k, int* dsindices, int indices_length, int* centers, int& centers_length)
+    {
+        int n = indices_length;
+
+        double currentPot = 0;
+        DistanceType* closestDistSq = new DistanceType[n];
+
+        // Choose one random center and set the closestDistSq values
+        int index = rand_int(n);
+        assert(index >=0 && index < n);
+        centers[0] = dsindices[index];
+
+        // Computing distance^2 will have the advantage of even higher probability further to pick new centers
+        // far from previous centers (and this complies to "k-means++: the advantages of careful seeding" article)
+        for (int i = 0; i < n; i++) {
+            closestDistSq[i] = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols);
+            closestDistSq[i] = ensureSquareDistance<Distance>( closestDistSq[i] );
+            currentPot += closestDistSq[i];
+        }
+
+
+        const int numLocalTries = 1;
+
+        // Choose each center
+        int centerCount;
+        for (centerCount = 1; centerCount < k; centerCount++) {
+
+            // Repeat several trials
+            double bestNewPot = -1;
+            int bestNewIndex = 0;
+            for (int localTrial = 0; localTrial < numLocalTries; localTrial++) {
+
+                // Choose our center - have to be slightly careful to return a valid answer even accounting
+                // for possible rounding errors
+                double randVal = rand_double(currentPot);
+                for (index = 0; index < n-1; index++) {
+                    if (randVal <= closestDistSq[index]) break;
+                    else randVal -= closestDistSq[index];
+                }
+
+                // Compute the new potential
+                double newPot = 0;
+                for (int i = 0; i < n; i++) {
+                    DistanceType dist = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols);
+                    newPot += std::min( ensureSquareDistance<Distance>(dist), closestDistSq[i] );
+                }
+
+                // Store the best result
+                if ((bestNewPot < 0)||(newPot < bestNewPot)) {
+                    bestNewPot = newPot;
+                    bestNewIndex = index;
+                }
+            }
+
+            // Add the appropriate center
+            centers[centerCount] = dsindices[bestNewIndex];
+            currentPot = bestNewPot;
+            for (int i = 0; i < n; i++) {
+                DistanceType dist = distance(dataset[dsindices[i]], dataset[dsindices[bestNewIndex]], dataset.cols);
+                closestDistSq[i] = std::min( ensureSquareDistance<Distance>(dist), closestDistSq[i] );
+            }
+        }
+
+        centers_length = centerCount;
+
+        delete[] closestDistSq;
+    }
+
+
+    /**
+     * Chooses the initial centers in a way inspired by Gonzales (by Pierre-Emmanuel Viel):
+     * select the first point of the list as a candidate, then parse the points list. If another
+     * point is further than current candidate from the other centers, test if it is a good center
+     * of a local aggregation. If it is, replace current candidate by this point. And so on...
+     *
+     * Used with KMeansIndex that computes centers coordinates by averaging positions of clusters points,
+     * this doesn't make a real difference with previous methods. But used with HierarchicalClusteringIndex
+     * class that pick centers among existing points instead of computing the barycenters, there is a real
+     * improvement.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void GroupWiseCenterChooser(int k, int* dsindices, int indices_length, int* centers, int& centers_length)
+    {
+        const float kSpeedUpFactor = 1.3f;
+
+        int n = indices_length;
+
+        DistanceType* closestDistSq = new DistanceType[n];
+
+        // Choose one random center and set the closestDistSq values
+        int index = rand_int(n);
+        assert(index >=0 && index < n);
+        centers[0] = dsindices[index];
+
+        for (int i = 0; i < n; i++) {
+            closestDistSq[i] = distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols);
+        }
+
+
+        // Choose each center
+        int centerCount;
+        for (centerCount = 1; centerCount < k; centerCount++) {
+
+            // Repeat several trials
+            double bestNewPot = -1;
+            int bestNewIndex = 0;
+            DistanceType furthest = 0;
+            for (index = 0; index < n; index++) {
+
+                // We will test only the potential of the points further than current candidate
+                if( closestDistSq[index] > kSpeedUpFactor * (float)furthest ) {
+
+                    // Compute the new potential
+                    double newPot = 0;
+                    for (int i = 0; i < n; i++) {
+                        newPot += std::min( distance(dataset[dsindices[i]], dataset[dsindices[index]], dataset.cols)
+                                            , closestDistSq[i] );
+                    }
+
+                    // Store the best result
+                    if ((bestNewPot < 0)||(newPot <= bestNewPot)) {
+                        bestNewPot = newPot;
+                        bestNewIndex = index;
+                        furthest = closestDistSq[index];
+                    }
+                }
+            }
+
+            // Add the appropriate center
+            centers[centerCount] = dsindices[bestNewIndex];
+            for (int i = 0; i < n; i++) {
+                closestDistSq[i] = std::min( distance(dataset[dsindices[i]], dataset[dsindices[bestNewIndex]], dataset.cols)
+                                             , closestDistSq[i] );
+            }
+        }
+
+        centers_length = centerCount;
+
+        delete[] closestDistSq;
+    }
+
+
+public:
+
+
+    /**
+     * Index constructor
+     *
+     * Params:
+     *          inputData = dataset with the input features
+     *          params = parameters passed to the hierarchical k-means algorithm
+     */
+    HierarchicalClusteringIndex(const Matrix<ElementType>& inputData, const IndexParams& index_params = HierarchicalClusteringIndexParams(),
+                                Distance d = Distance())
+        : dataset(inputData), params(index_params), root(NULL), indices(NULL), distance(d)
+    {
+        memoryCounter = 0;
+
+        size_ = dataset.rows;
+        veclen_ = dataset.cols;
+
+        branching_ = get_param(params,"branching",32);
+        centers_init_ = get_param(params,"centers_init", FLANN_CENTERS_RANDOM);
+        trees_ = get_param(params,"trees",4);
+        leaf_size_ = get_param(params,"leaf_size",100);
+
+        if (centers_init_==FLANN_CENTERS_RANDOM) {
+            chooseCenters = &HierarchicalClusteringIndex::chooseCentersRandom;
+        }
+        else if (centers_init_==FLANN_CENTERS_GONZALES) {
+            chooseCenters = &HierarchicalClusteringIndex::chooseCentersGonzales;
+        }
+        else if (centers_init_==FLANN_CENTERS_KMEANSPP) {
+            chooseCenters = &HierarchicalClusteringIndex::chooseCentersKMeanspp;
+        }
+        else if (centers_init_==FLANN_CENTERS_GROUPWISE) {
+            chooseCenters = &HierarchicalClusteringIndex::GroupWiseCenterChooser;
+        }
+        else {
+            throw FLANNException("Unknown algorithm for choosing initial centers.");
+        }
+
+        trees_ = get_param(params,"trees",4);
+        root = new NodePtr[trees_];
+        indices = new int*[trees_];
+
+        for (int i=0; i<trees_; ++i) {
+            root[i] = NULL;
+            indices[i] = NULL;
+        }
+    }
+
+    HierarchicalClusteringIndex(const HierarchicalClusteringIndex&);
+    HierarchicalClusteringIndex& operator=(const HierarchicalClusteringIndex&);
+
+    /**
+     * Index destructor.
+     *
+     * Release the memory used by the index.
+     */
+    virtual ~HierarchicalClusteringIndex()
+    {
+        free_elements();
+
+        if (root!=NULL) {
+            delete[] root;
+        }
+
+        if (indices!=NULL) {
+            delete[] indices;
+        }
+    }
+
+
+    /**
+     * Release the inner elements of indices[]
+     */
+    void free_elements()
+    {
+        if (indices!=NULL) {
+            for(int i=0; i<trees_; ++i) {
+                if (indices[i]!=NULL) {
+                    delete[] indices[i];
+                    indices[i] = NULL;
+                }
+            }
+        }
+    }
+
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return veclen_;
+    }
+
+
+    /**
+     * Computes the inde memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return pool.usedMemory+pool.wastedMemory+memoryCounter;
+    }
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        if (branching_<2) {
+            throw FLANNException("Branching factor must be at least 2");
+        }
+
+        free_elements();
+
+        for (int i=0; i<trees_; ++i) {
+            indices[i] = new int[size_];
+            for (size_t j=0; j<size_; ++j) {
+                indices[i][j] = (int)j;
+            }
+            root[i] = pool.allocate<Node>();
+            computeClustering(root[i], indices[i], (int)size_, branching_,0);
+        }
+    }
+
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_HIERARCHICAL;
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream, branching_);
+        save_value(stream, trees_);
+        save_value(stream, centers_init_);
+        save_value(stream, leaf_size_);
+        save_value(stream, memoryCounter);
+        for (int i=0; i<trees_; ++i) {
+            save_value(stream, *indices[i], size_);
+            save_tree(stream, root[i], i);
+        }
+
+    }
+
+
+    void loadIndex(FILE* stream)
+    {
+        free_elements();
+
+        if (root!=NULL) {
+            delete[] root;
+        }
+
+        if (indices!=NULL) {
+            delete[] indices;
+        }
+
+        load_value(stream, branching_);
+        load_value(stream, trees_);
+        load_value(stream, centers_init_);
+        load_value(stream, leaf_size_);
+        load_value(stream, memoryCounter);
+
+        indices = new int*[trees_];
+        root = new NodePtr[trees_];
+        for (int i=0; i<trees_; ++i) {
+            indices[i] = new int[size_];
+            load_value(stream, *indices[i], size_);
+            load_tree(stream, root[i], i);
+        }
+
+        params["algorithm"] = getType();
+        params["branching"] = branching_;
+        params["trees"] = trees_;
+        params["centers_init"] = centers_init_;
+        params["leaf_size"] = leaf_size_;
+    }
+
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     searchParams = parameters that influence the search algorithm (checks)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+
+        int maxChecks = get_param(searchParams,"checks",32);
+
+        // Priority queue storing intermediate branches in the best-bin-first search
+        Heap<BranchSt>* heap = new Heap<BranchSt>((int)size_);
+
+        std::vector<bool> checked(size_,false);
+        int checks = 0;
+        for (int i=0; i<trees_; ++i) {
+            findNN(root[i], result, vec, checks, maxChecks, heap, checked);
+        }
+
+        BranchSt branch;
+        while (heap->popMin(branch) && (checks<maxChecks || !result.full())) {
+            NodePtr node = branch.node;
+            findNN(node, result, vec, checks, maxChecks, heap, checked);
+        }
+        assert(result.full());
+
+        delete heap;
+
+    }
+
+    IndexParams getParameters() const
+    {
+        return params;
+    }
+
+
+private:
+
+    /**
+     * Struture representing a node in the hierarchical k-means tree.
+     */
+    struct Node
+    {
+        /**
+         * The cluster center index
+         */
+        int pivot;
+        /**
+         * The cluster size (number of points in the cluster)
+         */
+        int size;
+        /**
+         * Child nodes (only for non-terminal nodes)
+         */
+        Node** childs;
+        /**
+         * Node points (only for terminal nodes)
+         */
+        int* indices;
+        /**
+         * Level
+         */
+        int level;
+    };
+    typedef Node* NodePtr;
+
+
+
+    /**
+     * Alias definition for a nicer syntax.
+     */
+    typedef BranchStruct<NodePtr, DistanceType> BranchSt;
+
+
+
+    void save_tree(FILE* stream, NodePtr node, int num)
+    {
+        save_value(stream, *node);
+        if (node->childs==NULL) {
+            int indices_offset = (int)(node->indices - indices[num]);
+            save_value(stream, indices_offset);
+        }
+        else {
+            for(int i=0; i<branching_; ++i) {
+                save_tree(stream, node->childs[i], num);
+            }
+        }
+    }
+
+
+    void load_tree(FILE* stream, NodePtr& node, int num)
+    {
+        node = pool.allocate<Node>();
+        load_value(stream, *node);
+        if (node->childs==NULL) {
+            int indices_offset;
+            load_value(stream, indices_offset);
+            node->indices = indices[num] + indices_offset;
+        }
+        else {
+            node->childs = pool.allocate<NodePtr>(branching_);
+            for(int i=0; i<branching_; ++i) {
+                load_tree(stream, node->childs[i], num);
+            }
+        }
+    }
+
+
+
+
+    void computeLabels(int* dsindices, int indices_length,  int* centers, int centers_length, int* labels, DistanceType& cost)
+    {
+        cost = 0;
+        for (int i=0; i<indices_length; ++i) {
+            ElementType* point = dataset[dsindices[i]];
+            DistanceType dist = distance(point, dataset[centers[0]], veclen_);
+            labels[i] = 0;
+            for (int j=1; j<centers_length; ++j) {
+                DistanceType new_dist = distance(point, dataset[centers[j]], veclen_);
+                if (dist>new_dist) {
+                    labels[i] = j;
+                    dist = new_dist;
+                }
+            }
+            cost += dist;
+        }
+    }
+
+    /**
+     * The method responsible with actually doing the recursive hierarchical
+     * clustering
+     *
+     * Params:
+     *     node = the node to cluster
+     *     indices = indices of the points belonging to the current node
+     *     branching = the branching factor to use in the clustering
+     *
+     * TODO: for 1-sized clusters don't store a cluster center (it's the same as the single cluster point)
+     */
+    void computeClustering(NodePtr node, int* dsindices, int indices_length, int branching, int level)
+    {
+        node->size = indices_length;
+        node->level = level;
+
+        if (indices_length < leaf_size_) { // leaf node
+            node->indices = dsindices;
+            std::sort(node->indices,node->indices+indices_length);
+            node->childs = NULL;
+            return;
+        }
+
+        std::vector<int> centers(branching);
+        std::vector<int> labels(indices_length);
+
+        int centers_length;
+        (this->*chooseCenters)(branching, dsindices, indices_length, &centers[0], centers_length);
+
+        if (centers_length<branching) {
+            node->indices = dsindices;
+            std::sort(node->indices,node->indices+indices_length);
+            node->childs = NULL;
+            return;
+        }
+
+
+        //	assign points to clusters
+        DistanceType cost;
+        computeLabels(dsindices, indices_length, &centers[0], centers_length, &labels[0], cost);
+
+        node->childs = pool.allocate<NodePtr>(branching);
+        int start = 0;
+        int end = start;
+        for (int i=0; i<branching; ++i) {
+            for (int j=0; j<indices_length; ++j) {
+                if (labels[j]==i) {
+                    std::swap(dsindices[j],dsindices[end]);
+                    std::swap(labels[j],labels[end]);
+                    end++;
+                }
+            }
+
+            node->childs[i] = pool.allocate<Node>();
+            node->childs[i]->pivot = centers[i];
+            node->childs[i]->indices = NULL;
+            computeClustering(node->childs[i],dsindices+start, end-start, branching, level+1);
+            start=end;
+        }
+    }
+
+
+
+    /**
+     * Performs one descent in the hierarchical k-means tree. The branches not
+     * visited are stored in a priority queue.
+     *
+     * Params:
+     *      node = node to explore
+     *      result = container for the k-nearest neighbors found
+     *      vec = query points
+     *      checks = how many points in the dataset have been checked so far
+     *      maxChecks = maximum dataset points to checks
+     */
+
+
+    void findNN(NodePtr node, ResultSet<DistanceType>& result, const ElementType* vec, int& checks, int maxChecks,
+                Heap<BranchSt>* heap, std::vector<bool>& checked)
+    {
+        if (node->childs==NULL) {
+            if (checks>=maxChecks) {
+                if (result.full()) return;
+            }
+            for (int i=0; i<node->size; ++i) {
+                int index = node->indices[i];
+                if (!checked[index]) {
+                    DistanceType dist = distance(dataset[index], vec, veclen_);
+                    result.addPoint(dist, index);
+                    checked[index] = true;
+                    ++checks;
+                }
+            }
+        }
+        else {
+            DistanceType* domain_distances = new DistanceType[branching_];
+            int best_index = 0;
+            domain_distances[best_index] = distance(vec, dataset[node->childs[best_index]->pivot], veclen_);
+            for (int i=1; i<branching_; ++i) {
+                domain_distances[i] = distance(vec, dataset[node->childs[i]->pivot], veclen_);
+                if (domain_distances[i]<domain_distances[best_index]) {
+                    best_index = i;
+                }
+            }
+            for (int i=0; i<branching_; ++i) {
+                if (i!=best_index) {
+                    heap->insert(BranchSt(node->childs[i],domain_distances[i]));
+                }
+            }
+            delete[] domain_distances;
+            findNN(node->childs[best_index],result,vec, checks, maxChecks, heap, checked);
+        }
+    }
+
+private:
+
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset;
+
+    /**
+     * Parameters used by this index
+     */
+    IndexParams params;
+
+
+    /**
+     * Number of features in the dataset.
+     */
+    size_t size_;
+
+    /**
+     * Length of each feature.
+     */
+    size_t veclen_;
+
+    /**
+     * The root node in the tree.
+     */
+    NodePtr* root;
+
+    /**
+     *  Array of indices to vectors in the dataset.
+     */
+    int** indices;
+
+
+    /**
+     * The distance
+     */
+    Distance distance;
+
+    /**
+     * Pooled memory allocator.
+     *
+     * Using a pooled memory allocator is more efficient
+     * than allocating memory directly when there is a large
+     * number small of memory allocations.
+     */
+    PooledAllocator pool;
+
+    /**
+     * Memory occupied by the index.
+     */
+    int memoryCounter;
+
+    /** index parameters */
+    int branching_;
+    int trees_;
+    flann_centers_init_t centers_init_;
+    int leaf_size_;
+
+
+};
+
+}
+
+#endif /* OPENCV_FLANN_HIERARCHICAL_CLUSTERING_INDEX_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h
new file mode 100644
index 0000000..d764004
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/index_testing.h
@@ -0,0 +1,318 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_INDEX_TESTING_H_
+#define OPENCV_FLANN_INDEX_TESTING_H_
+
+#include <cstring>
+#include <cassert>
+#include <cmath>
+
+#include "matrix.h"
+#include "nn_index.h"
+#include "result_set.h"
+#include "logger.h"
+#include "timer.h"
+
+
+namespace cvflann
+{
+
+inline int countCorrectMatches(int* neighbors, int* groundTruth, int n)
+{
+    int count = 0;
+    for (int i=0; i<n; ++i) {
+        for (int k=0; k<n; ++k) {
+            if (neighbors[i]==groundTruth[k]) {
+                count++;
+                break;
+            }
+        }
+    }
+    return count;
+}
+
+
+template <typename Distance>
+typename Distance::ResultType computeDistanceRaport(const Matrix<typename Distance::ElementType>& inputData, typename Distance::ElementType* target,
+                                                    int* neighbors, int* groundTruth, int veclen, int n, const Distance& distance)
+{
+    typedef typename Distance::ResultType DistanceType;
+
+    DistanceType ret = 0;
+    for (int i=0; i<n; ++i) {
+        DistanceType den = distance(inputData[groundTruth[i]], target, veclen);
+        DistanceType num = distance(inputData[neighbors[i]], target, veclen);
+
+        if ((den==0)&&(num==0)) {
+            ret += 1;
+        }
+        else {
+            ret += num/den;
+        }
+    }
+
+    return ret;
+}
+
+template <typename Distance>
+float search_with_ground_truth(NNIndex<Distance>& index, const Matrix<typename Distance::ElementType>& inputData,
+                               const Matrix<typename Distance::ElementType>& testData, const Matrix<int>& matches, int nn, int checks,
+                               float& time, typename Distance::ResultType& dist, const Distance& distance, int skipMatches)
+{
+    typedef typename Distance::ResultType DistanceType;
+
+    if (matches.cols<size_t(nn)) {
+        Logger::info("matches.cols=%d, nn=%d\n",matches.cols,nn);
+
+        throw FLANNException("Ground truth is not computed for as many neighbors as requested");
+    }
+
+    KNNResultSet<DistanceType> resultSet(nn+skipMatches);
+    SearchParams searchParams(checks);
+
+    std::vector<int> indices(nn+skipMatches);
+    std::vector<DistanceType> dists(nn+skipMatches);
+    int* neighbors = &indices[skipMatches];
+
+    int correct = 0;
+    DistanceType distR = 0;
+    StartStopTimer t;
+    int repeats = 0;
+    while (t.value<0.2) {
+        repeats++;
+        t.start();
+        correct = 0;
+        distR = 0;
+        for (size_t i = 0; i < testData.rows; i++) {
+            resultSet.init(&indices[0], &dists[0]);
+            index.findNeighbors(resultSet, testData[i], searchParams);
+
+            correct += countCorrectMatches(neighbors,matches[i], nn);
+            distR += computeDistanceRaport<Distance>(inputData, testData[i], neighbors, matches[i], (int)testData.cols, nn, distance);
+        }
+        t.stop();
+    }
+    time = float(t.value/repeats);
+
+    float precicion = (float)correct/(nn*testData.rows);
+
+    dist = distR/(testData.rows*nn);
+
+    Logger::info("%8d %10.4g %10.5g %10.5g %10.5g\n",
+                 checks, precicion, time, 1000.0 * time / testData.rows, dist);
+
+    return precicion;
+}
+
+
+template <typename Distance>
+float test_index_checks(NNIndex<Distance>& index, const Matrix<typename Distance::ElementType>& inputData,
+                        const Matrix<typename Distance::ElementType>& testData, const Matrix<int>& matches,
+                        int checks, float& precision, const Distance& distance, int nn = 1, int skipMatches = 0)
+{
+    typedef typename Distance::ResultType DistanceType;
+
+    Logger::info("  Nodes  Precision(%)   Time(s)   Time/vec(ms)  Mean dist\n");
+    Logger::info("---------------------------------------------------------\n");
+
+    float time = 0;
+    DistanceType dist = 0;
+    precision = search_with_ground_truth(index, inputData, testData, matches, nn, checks, time, dist, distance, skipMatches);
+
+    return time;
+}
+
+template <typename Distance>
+float test_index_precision(NNIndex<Distance>& index, const Matrix<typename Distance::ElementType>& inputData,
+                           const Matrix<typename Distance::ElementType>& testData, const Matrix<int>& matches,
+                           float precision, int& checks, const Distance& distance, int nn = 1, int skipMatches = 0)
+{
+    typedef typename Distance::ResultType DistanceType;
+    const float SEARCH_EPS = 0.001f;
+
+    Logger::info("  Nodes  Precision(%)   Time(s)   Time/vec(ms)  Mean dist\n");
+    Logger::info("---------------------------------------------------------\n");
+
+    int c2 = 1;
+    float p2;
+    int c1 = 1;
+    //float p1;
+    float time;
+    DistanceType dist;
+
+    p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
+
+    if (p2>precision) {
+        Logger::info("Got as close as I can\n");
+        checks = c2;
+        return time;
+    }
+
+    while (p2<precision) {
+        c1 = c2;
+        //p1 = p2;
+        c2 *=2;
+        p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
+    }
+
+    int cx;
+    float realPrecision;
+    if (fabs(p2-precision)>SEARCH_EPS) {
+        Logger::info("Start linear estimation\n");
+        // after we got to values in the vecinity of the desired precision
+        // use linear approximation get a better estimation
+
+        cx = (c1+c2)/2;
+        realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches);
+        while (fabs(realPrecision-precision)>SEARCH_EPS) {
+
+            if (realPrecision<precision) {
+                c1 = cx;
+            }
+            else {
+                c2 = cx;
+            }
+            cx = (c1+c2)/2;
+            if (cx==c1) {
+                Logger::info("Got as close as I can\n");
+                break;
+            }
+            realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches);
+        }
+
+        c2 = cx;
+        p2 = realPrecision;
+
+    }
+    else {
+        Logger::info("No need for linear estimation\n");
+        cx = c2;
+        realPrecision = p2;
+    }
+
+    checks = cx;
+    return time;
+}
+
+
+template <typename Distance>
+void test_index_precisions(NNIndex<Distance>& index, const Matrix<typename Distance::ElementType>& inputData,
+                           const Matrix<typename Distance::ElementType>& testData, const Matrix<int>& matches,
+                           float* precisions, int precisions_length, const Distance& distance, int nn = 1, int skipMatches = 0, float maxTime = 0)
+{
+    typedef typename Distance::ResultType DistanceType;
+
+    const float SEARCH_EPS = 0.001;
+
+    // make sure precisions array is sorted
+    std::sort(precisions, precisions+precisions_length);
+
+    int pindex = 0;
+    float precision = precisions[pindex];
+
+    Logger::info("  Nodes  Precision(%)   Time(s)   Time/vec(ms)  Mean dist\n");
+    Logger::info("---------------------------------------------------------\n");
+
+    int c2 = 1;
+    float p2;
+
+    int c1 = 1;
+    float p1;
+
+    float time;
+    DistanceType dist;
+
+    p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
+
+    // if precision for 1 run down the tree is already
+    // better then some of the requested precisions, then
+    // skip those
+    while (precisions[pindex]<p2 && pindex<precisions_length) {
+        pindex++;
+    }
+
+    if (pindex==precisions_length) {
+        Logger::info("Got as close as I can\n");
+        return;
+    }
+
+    for (int i=pindex; i<precisions_length; ++i) {
+
+        precision = precisions[i];
+        while (p2<precision) {
+            c1 = c2;
+            p1 = p2;
+            c2 *=2;
+            p2 = search_with_ground_truth(index, inputData, testData, matches, nn, c2, time, dist, distance, skipMatches);
+            if ((maxTime> 0)&&(time > maxTime)&&(p2<precision)) return;
+        }
+
+        int cx;
+        float realPrecision;
+        if (fabs(p2-precision)>SEARCH_EPS) {
+            Logger::info("Start linear estimation\n");
+            // after we got to values in the vecinity of the desired precision
+            // use linear approximation get a better estimation
+
+            cx = (c1+c2)/2;
+            realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches);
+            while (fabs(realPrecision-precision)>SEARCH_EPS) {
+
+                if (realPrecision<precision) {
+                    c1 = cx;
+                }
+                else {
+                    c2 = cx;
+                }
+                cx = (c1+c2)/2;
+                if (cx==c1) {
+                    Logger::info("Got as close as I can\n");
+                    break;
+                }
+                realPrecision = search_with_ground_truth(index, inputData, testData, matches, nn, cx, time, dist, distance, skipMatches);
+            }
+
+            c2 = cx;
+            p2 = realPrecision;
+
+        }
+        else {
+            Logger::info("No need for linear estimation\n");
+            cx = c2;
+            realPrecision = p2;
+        }
+
+    }
+}
+
+}
+
+#endif //OPENCV_FLANN_INDEX_TESTING_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h
new file mode 100644
index 0000000..dc0971c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_index.h
@@ -0,0 +1,621 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_KDTREE_INDEX_H_
+#define OPENCV_FLANN_KDTREE_INDEX_H_
+
+#include <algorithm>
+#include <map>
+#include <cassert>
+#include <cstring>
+
+#include "general.h"
+#include "nn_index.h"
+#include "dynamic_bitset.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+
+
+namespace cvflann
+{
+
+struct KDTreeIndexParams : public IndexParams
+{
+    KDTreeIndexParams(int trees = 4)
+    {
+        (*this)["algorithm"] = FLANN_INDEX_KDTREE;
+        (*this)["trees"] = trees;
+    }
+};
+
+
+/**
+ * Randomized kd-tree index
+ *
+ * Contains the k-d trees and other information for indexing a set of points
+ * for nearest-neighbor matching.
+ */
+template <typename Distance>
+class KDTreeIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+
+    /**
+     * KDTree constructor
+     *
+     * Params:
+     *          inputData = dataset with the input features
+     *          params = parameters passed to the kdtree algorithm
+     */
+    KDTreeIndex(const Matrix<ElementType>& inputData, const IndexParams& params = KDTreeIndexParams(),
+                Distance d = Distance() ) :
+        dataset_(inputData), index_params_(params), distance_(d)
+    {
+        size_ = dataset_.rows;
+        veclen_ = dataset_.cols;
+
+        trees_ = get_param(index_params_,"trees",4);
+        tree_roots_ = new NodePtr[trees_];
+
+        // Create a permutable array of indices to the input vectors.
+        vind_.resize(size_);
+        for (size_t i = 0; i < size_; ++i) {
+            vind_[i] = int(i);
+        }
+
+        mean_ = new DistanceType[veclen_];
+        var_ = new DistanceType[veclen_];
+    }
+
+
+    KDTreeIndex(const KDTreeIndex&);
+    KDTreeIndex& operator=(const KDTreeIndex&);
+
+    /**
+     * Standard destructor
+     */
+    ~KDTreeIndex()
+    {
+        if (tree_roots_!=NULL) {
+            delete[] tree_roots_;
+        }
+        delete[] mean_;
+        delete[] var_;
+    }
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        /* Construct the randomized trees. */
+        for (int i = 0; i < trees_; i++) {
+            /* Randomize the order of vectors to allow for unbiased sampling. */
+            std::random_shuffle(vind_.begin(), vind_.end());
+            tree_roots_[i] = divideTree(&vind_[0], int(size_) );
+        }
+    }
+
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_KDTREE;
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream, trees_);
+        for (int i=0; i<trees_; ++i) {
+            save_tree(stream, tree_roots_[i]);
+        }
+    }
+
+
+
+    void loadIndex(FILE* stream)
+    {
+        load_value(stream, trees_);
+        if (tree_roots_!=NULL) {
+            delete[] tree_roots_;
+        }
+        tree_roots_ = new NodePtr[trees_];
+        for (int i=0; i<trees_; ++i) {
+            load_tree(stream,tree_roots_[i]);
+        }
+
+        index_params_["algorithm"] = getType();
+        index_params_["trees"] = tree_roots_;
+    }
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return veclen_;
+    }
+
+    /**
+     * Computes the inde memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return int(pool_.usedMemory+pool_.wastedMemory+dataset_.rows*sizeof(int));  // pool memory and vind array memory
+    }
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     maxCheck = the maximum number of restarts (in a best-bin-first manner)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        int maxChecks = get_param(searchParams,"checks", 32);
+        float epsError = 1+get_param(searchParams,"eps",0.0f);
+
+        if (maxChecks==FLANN_CHECKS_UNLIMITED) {
+            getExactNeighbors(result, vec, epsError);
+        }
+        else {
+            getNeighbors(result, vec, maxChecks, epsError);
+        }
+    }
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+private:
+
+
+    /*--------------------- Internal Data Structures --------------------------*/
+    struct Node
+    {
+        /**
+         * Dimension used for subdivision.
+         */
+        int divfeat;
+        /**
+         * The values used for subdivision.
+         */
+        DistanceType divval;
+        /**
+         * The child nodes.
+         */
+        Node* child1, * child2;
+    };
+    typedef Node* NodePtr;
+    typedef BranchStruct<NodePtr, DistanceType> BranchSt;
+    typedef BranchSt* Branch;
+
+
+
+    void save_tree(FILE* stream, NodePtr tree)
+    {
+        save_value(stream, *tree);
+        if (tree->child1!=NULL) {
+            save_tree(stream, tree->child1);
+        }
+        if (tree->child2!=NULL) {
+            save_tree(stream, tree->child2);
+        }
+    }
+
+
+    void load_tree(FILE* stream, NodePtr& tree)
+    {
+        tree = pool_.allocate<Node>();
+        load_value(stream, *tree);
+        if (tree->child1!=NULL) {
+            load_tree(stream, tree->child1);
+        }
+        if (tree->child2!=NULL) {
+            load_tree(stream, tree->child2);
+        }
+    }
+
+
+    /**
+     * Create a tree node that subdivides the list of vecs from vind[first]
+     * to vind[last].  The routine is called recursively on each sublist.
+     * Place a pointer to this new tree node in the location pTree.
+     *
+     * Params: pTree = the new node to create
+     *                  first = index of the first vector
+     *                  last = index of the last vector
+     */
+    NodePtr divideTree(int* ind, int count)
+    {
+        NodePtr node = pool_.allocate<Node>(); // allocate memory
+
+        /* If too few exemplars remain, then make this a leaf node. */
+        if ( count == 1) {
+            node->child1 = node->child2 = NULL;    /* Mark as leaf node. */
+            node->divfeat = *ind;    /* Store index of this vec. */
+        }
+        else {
+            int idx;
+            int cutfeat;
+            DistanceType cutval;
+            meanSplit(ind, count, idx, cutfeat, cutval);
+
+            node->divfeat = cutfeat;
+            node->divval = cutval;
+            node->child1 = divideTree(ind, idx);
+            node->child2 = divideTree(ind+idx, count-idx);
+        }
+
+        return node;
+    }
+
+
+    /**
+     * Choose which feature to use in order to subdivide this set of vectors.
+     * Make a random choice among those with the highest variance, and use
+     * its variance as the threshold value.
+     */
+    void meanSplit(int* ind, int count, int& index, int& cutfeat, DistanceType& cutval)
+    {
+        memset(mean_,0,veclen_*sizeof(DistanceType));
+        memset(var_,0,veclen_*sizeof(DistanceType));
+
+        /* Compute mean values.  Only the first SAMPLE_MEAN values need to be
+            sampled to get a good estimate.
+         */
+        int cnt = std::min((int)SAMPLE_MEAN+1, count);
+        for (int j = 0; j < cnt; ++j) {
+            ElementType* v = dataset_[ind[j]];
+            for (size_t k=0; k<veclen_; ++k) {
+                mean_[k] += v[k];
+            }
+        }
+        for (size_t k=0; k<veclen_; ++k) {
+            mean_[k] /= cnt;
+        }
+
+        /* Compute variances (no need to divide by count). */
+        for (int j = 0; j < cnt; ++j) {
+            ElementType* v = dataset_[ind[j]];
+            for (size_t k=0; k<veclen_; ++k) {
+                DistanceType dist = v[k] - mean_[k];
+                var_[k] += dist * dist;
+            }
+        }
+        /* Select one of the highest variance indices at random. */
+        cutfeat = selectDivision(var_);
+        cutval = mean_[cutfeat];
+
+        int lim1, lim2;
+        planeSplit(ind, count, cutfeat, cutval, lim1, lim2);
+
+        if (lim1>count/2) index = lim1;
+        else if (lim2<count/2) index = lim2;
+        else index = count/2;
+
+        /* If either list is empty, it means that all remaining features
+         * are identical. Split in the middle to maintain a balanced tree.
+         */
+        if ((lim1==count)||(lim2==0)) index = count/2;
+    }
+
+
+    /**
+     * Select the top RAND_DIM largest values from v and return the index of
+     * one of these selected at random.
+     */
+    int selectDivision(DistanceType* v)
+    {
+        int num = 0;
+        size_t topind[RAND_DIM];
+
+        /* Create a list of the indices of the top RAND_DIM values. */
+        for (size_t i = 0; i < veclen_; ++i) {
+            if ((num < RAND_DIM)||(v[i] > v[topind[num-1]])) {
+                /* Put this element at end of topind. */
+                if (num < RAND_DIM) {
+                    topind[num++] = i;            /* Add to list. */
+                }
+                else {
+                    topind[num-1] = i;         /* Replace last element. */
+                }
+                /* Bubble end value down to right location by repeated swapping. */
+                int j = num - 1;
+                while (j > 0  &&  v[topind[j]] > v[topind[j-1]]) {
+                    std::swap(topind[j], topind[j-1]);
+                    --j;
+                }
+            }
+        }
+        /* Select a random integer in range [0,num-1], and return that index. */
+        int rnd = rand_int(num);
+        return (int)topind[rnd];
+    }
+
+
+    /**
+     *  Subdivide the list of points by a plane perpendicular on axe corresponding
+     *  to the 'cutfeat' dimension at 'cutval' position.
+     *
+     *  On return:
+     *  dataset[ind[0..lim1-1]][cutfeat]<cutval
+     *  dataset[ind[lim1..lim2-1]][cutfeat]==cutval
+     *  dataset[ind[lim2..count]][cutfeat]>cutval
+     */
+    void planeSplit(int* ind, int count, int cutfeat, DistanceType cutval, int& lim1, int& lim2)
+    {
+        /* Move vector indices for left subtree to front of list. */
+        int left = 0;
+        int right = count-1;
+        for (;; ) {
+            while (left<=right && dataset_[ind[left]][cutfeat]<cutval) ++left;
+            while (left<=right && dataset_[ind[right]][cutfeat]>=cutval) --right;
+            if (left>right) break;
+            std::swap(ind[left], ind[right]); ++left; --right;
+        }
+        lim1 = left;
+        right = count-1;
+        for (;; ) {
+            while (left<=right && dataset_[ind[left]][cutfeat]<=cutval) ++left;
+            while (left<=right && dataset_[ind[right]][cutfeat]>cutval) --right;
+            if (left>right) break;
+            std::swap(ind[left], ind[right]); ++left; --right;
+        }
+        lim2 = left;
+    }
+
+    /**
+     * Performs an exact nearest neighbor search. The exact search performs a full
+     * traversal of the tree.
+     */
+    void getExactNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, float epsError)
+    {
+        //		checkID -= 1;  /* Set a different unique ID for each search. */
+
+        if (trees_ > 1) {
+            fprintf(stderr,"It doesn't make any sense to use more than one tree for exact search");
+        }
+        if (trees_>0) {
+            searchLevelExact(result, vec, tree_roots_[0], 0.0, epsError);
+        }
+        assert(result.full());
+    }
+
+    /**
+     * Performs the approximate nearest-neighbor search. The search is approximate
+     * because the tree traversal is abandoned after a given number of descends in
+     * the tree.
+     */
+    void getNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, int maxCheck, float epsError)
+    {
+        int i;
+        BranchSt branch;
+
+        int checkCount = 0;
+        Heap<BranchSt>* heap = new Heap<BranchSt>((int)size_);
+        DynamicBitset checked(size_);
+
+        /* Search once through each tree down to root. */
+        for (i = 0; i < trees_; ++i) {
+            searchLevel(result, vec, tree_roots_[i], 0, checkCount, maxCheck, epsError, heap, checked);
+        }
+
+        /* Keep searching other branches from heap until finished. */
+        while ( heap->popMin(branch) && (checkCount < maxCheck || !result.full() )) {
+            searchLevel(result, vec, branch.node, branch.mindist, checkCount, maxCheck, epsError, heap, checked);
+        }
+
+        delete heap;
+
+        assert(result.full());
+    }
+
+
+    /**
+     *  Search starting from a given node of the tree.  Based on any mismatches at
+     *  higher levels, all exemplars below this level must have a distance of
+     *  at least "mindistsq".
+     */
+    void searchLevel(ResultSet<DistanceType>& result_set, const ElementType* vec, NodePtr node, DistanceType mindist, int& checkCount, int maxCheck,
+                     float epsError, Heap<BranchSt>* heap, DynamicBitset& checked)
+    {
+        if (result_set.worstDist()<mindist) {
+            //			printf("Ignoring branch, too far\n");
+            return;
+        }
+
+        /* If this is a leaf node, then do check and return. */
+        if ((node->child1 == NULL)&&(node->child2 == NULL)) {
+            /*  Do not check same node more than once when searching multiple trees.
+                Once a vector is checked, we set its location in vind to the
+                current checkID.
+             */
+            int index = node->divfeat;
+            if ( checked.test(index) || ((checkCount>=maxCheck)&& result_set.full()) ) return;
+            checked.set(index);
+            checkCount++;
+
+            DistanceType dist = distance_(dataset_[index], vec, veclen_);
+            result_set.addPoint(dist,index);
+
+            return;
+        }
+
+        /* Which child branch should be taken first? */
+        ElementType val = vec[node->divfeat];
+        DistanceType diff = val - node->divval;
+        NodePtr bestChild = (diff < 0) ? node->child1 : node->child2;
+        NodePtr otherChild = (diff < 0) ? node->child2 : node->child1;
+
+        /* Create a branch record for the branch not taken.  Add distance
+            of this feature boundary (we don't attempt to correct for any
+            use of this feature in a parent node, which is unlikely to
+            happen and would have only a small effect).  Don't bother
+            adding more branches to heap after halfway point, as cost of
+            adding exceeds their value.
+         */
+
+        DistanceType new_distsq = mindist + distance_.accum_dist(val, node->divval, node->divfeat);
+        //		if (2 * checkCount < maxCheck  ||  !result.full()) {
+        if ((new_distsq*epsError < result_set.worstDist())||  !result_set.full()) {
+            heap->insert( BranchSt(otherChild, new_distsq) );
+        }
+
+        /* Call recursively to search next level down. */
+        searchLevel(result_set, vec, bestChild, mindist, checkCount, maxCheck, epsError, heap, checked);
+    }
+
+    /**
+     * Performs an exact search in the tree starting from a node.
+     */
+    void searchLevelExact(ResultSet<DistanceType>& result_set, const ElementType* vec, const NodePtr node, DistanceType mindist, const float epsError)
+    {
+        /* If this is a leaf node, then do check and return. */
+        if ((node->child1 == NULL)&&(node->child2 == NULL)) {
+            int index = node->divfeat;
+            DistanceType dist = distance_(dataset_[index], vec, veclen_);
+            result_set.addPoint(dist,index);
+            return;
+        }
+
+        /* Which child branch should be taken first? */
+        ElementType val = vec[node->divfeat];
+        DistanceType diff = val - node->divval;
+        NodePtr bestChild = (diff < 0) ? node->child1 : node->child2;
+        NodePtr otherChild = (diff < 0) ? node->child2 : node->child1;
+
+        /* Create a branch record for the branch not taken.  Add distance
+            of this feature boundary (we don't attempt to correct for any
+            use of this feature in a parent node, which is unlikely to
+            happen and would have only a small effect).  Don't bother
+            adding more branches to heap after halfway point, as cost of
+            adding exceeds their value.
+         */
+
+        DistanceType new_distsq = mindist + distance_.accum_dist(val, node->divval, node->divfeat);
+
+        /* Call recursively to search next level down. */
+        searchLevelExact(result_set, vec, bestChild, mindist, epsError);
+
+        if (new_distsq*epsError<=result_set.worstDist()) {
+            searchLevelExact(result_set, vec, otherChild, new_distsq, epsError);
+        }
+    }
+
+
+private:
+
+    enum
+    {
+        /**
+         * To improve efficiency, only SAMPLE_MEAN random values are used to
+         * compute the mean and variance at each level when building a tree.
+         * A value of 100 seems to perform as well as using all values.
+         */
+        SAMPLE_MEAN = 100,
+        /**
+         * Top random dimensions to consider
+         *
+         * When creating random trees, the dimension on which to subdivide is
+         * selected at random from among the top RAND_DIM dimensions with the
+         * highest variance.  A value of 5 works well.
+         */
+        RAND_DIM=5
+    };
+
+
+    /**
+     * Number of randomized trees that are used
+     */
+    int trees_;
+
+    /**
+     *  Array of indices to vectors in the dataset.
+     */
+    std::vector<int> vind_;
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset_;
+
+    IndexParams index_params_;
+
+    size_t size_;
+    size_t veclen_;
+
+
+    DistanceType* mean_;
+    DistanceType* var_;
+
+
+    /**
+     * Array of k-d trees used to find neighbours.
+     */
+    NodePtr* tree_roots_;
+
+    /**
+     * Pooled memory allocator.
+     *
+     * Using a pooled memory allocator is more efficient
+     * than allocating memory directly when there is a large
+     * number small of memory allocations.
+     */
+    PooledAllocator pool_;
+
+    Distance distance_;
+
+
+};   // class KDTreeForest
+
+}
+
+#endif //OPENCV_FLANN_KDTREE_INDEX_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h
new file mode 100644
index 0000000..30488ad
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kdtree_single_index.h
@@ -0,0 +1,634 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_
+#define OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_
+
+#include <algorithm>
+#include <map>
+#include <cassert>
+#include <cstring>
+
+#include "general.h"
+#include "nn_index.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+
+namespace cvflann
+{
+
+struct KDTreeSingleIndexParams : public IndexParams
+{
+    KDTreeSingleIndexParams(int leaf_max_size = 10, bool reorder = true, int dim = -1)
+    {
+        (*this)["algorithm"] = FLANN_INDEX_KDTREE_SINGLE;
+        (*this)["leaf_max_size"] = leaf_max_size;
+        (*this)["reorder"] = reorder;
+        (*this)["dim"] = dim;
+    }
+};
+
+
+/**
+ * Randomized kd-tree index
+ *
+ * Contains the k-d trees and other information for indexing a set of points
+ * for nearest-neighbor matching.
+ */
+template <typename Distance>
+class KDTreeSingleIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+
+    /**
+     * KDTree constructor
+     *
+     * Params:
+     *          inputData = dataset with the input features
+     *          params = parameters passed to the kdtree algorithm
+     */
+    KDTreeSingleIndex(const Matrix<ElementType>& inputData, const IndexParams& params = KDTreeSingleIndexParams(),
+                      Distance d = Distance() ) :
+        dataset_(inputData), index_params_(params), distance_(d)
+    {
+        size_ = dataset_.rows;
+        dim_ = dataset_.cols;
+        int dim_param = get_param(params,"dim",-1);
+        if (dim_param>0) dim_ = dim_param;
+        leaf_max_size_ = get_param(params,"leaf_max_size",10);
+        reorder_ = get_param(params,"reorder",true);
+
+        // Create a permutable array of indices to the input vectors.
+        vind_.resize(size_);
+        for (size_t i = 0; i < size_; i++) {
+            vind_[i] = (int)i;
+        }
+    }
+
+    KDTreeSingleIndex(const KDTreeSingleIndex&);
+    KDTreeSingleIndex& operator=(const KDTreeSingleIndex&);
+
+    /**
+     * Standard destructor
+     */
+    ~KDTreeSingleIndex()
+    {
+        if (reorder_) delete[] data_.data;
+    }
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        computeBoundingBox(root_bbox_);
+        root_node_ = divideTree(0, (int)size_, root_bbox_ );   // construct the tree
+
+        if (reorder_) {
+            delete[] data_.data;
+            data_ = cvflann::Matrix<ElementType>(new ElementType[size_*dim_], size_, dim_);
+            for (size_t i=0; i<size_; ++i) {
+                for (size_t j=0; j<dim_; ++j) {
+                    data_[i][j] = dataset_[vind_[i]][j];
+                }
+            }
+        }
+        else {
+            data_ = dataset_;
+        }
+    }
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_KDTREE_SINGLE;
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream, size_);
+        save_value(stream, dim_);
+        save_value(stream, root_bbox_);
+        save_value(stream, reorder_);
+        save_value(stream, leaf_max_size_);
+        save_value(stream, vind_);
+        if (reorder_) {
+            save_value(stream, data_);
+        }
+        save_tree(stream, root_node_);
+    }
+
+
+    void loadIndex(FILE* stream)
+    {
+        load_value(stream, size_);
+        load_value(stream, dim_);
+        load_value(stream, root_bbox_);
+        load_value(stream, reorder_);
+        load_value(stream, leaf_max_size_);
+        load_value(stream, vind_);
+        if (reorder_) {
+            load_value(stream, data_);
+        }
+        else {
+            data_ = dataset_;
+        }
+        load_tree(stream, root_node_);
+
+
+        index_params_["algorithm"] = getType();
+        index_params_["leaf_max_size"] = leaf_max_size_;
+        index_params_["reorder"] = reorder_;
+    }
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return dim_;
+    }
+
+    /**
+     * Computes the inde memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return (int)(pool_.usedMemory+pool_.wastedMemory+dataset_.rows*sizeof(int));  // pool memory and vind array memory
+    }
+
+
+    /**
+     * \brief Perform k-nearest neighbor search
+     * \param[in] queries The query points for which to find the nearest neighbors
+     * \param[out] indices The indices of the nearest neighbors found
+     * \param[out] dists Distances to the nearest neighbors found
+     * \param[in] knn Number of nearest neighbors to return
+     * \param[in] params Search parameters
+     */
+    void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
+    {
+        assert(queries.cols == veclen());
+        assert(indices.rows >= queries.rows);
+        assert(dists.rows >= queries.rows);
+        assert(int(indices.cols) >= knn);
+        assert(int(dists.cols) >= knn);
+
+        KNNSimpleResultSet<DistanceType> resultSet(knn);
+        for (size_t i = 0; i < queries.rows; i++) {
+            resultSet.init(indices[i], dists[i]);
+            findNeighbors(resultSet, queries[i], params);
+        }
+    }
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     maxCheck = the maximum number of restarts (in a best-bin-first manner)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+        float epsError = 1+get_param(searchParams,"eps",0.0f);
+
+        std::vector<DistanceType> dists(dim_,0);
+        DistanceType distsq = computeInitialDistances(vec, dists);
+        searchLevel(result, vec, root_node_, distsq, dists, epsError);
+    }
+
+private:
+
+
+    /*--------------------- Internal Data Structures --------------------------*/
+    struct Node
+    {
+        /**
+         * Indices of points in leaf node
+         */
+        int left, right;
+        /**
+         * Dimension used for subdivision.
+         */
+        int divfeat;
+        /**
+         * The values used for subdivision.
+         */
+        DistanceType divlow, divhigh;
+        /**
+         * The child nodes.
+         */
+        Node* child1, * child2;
+    };
+    typedef Node* NodePtr;
+
+
+    struct Interval
+    {
+        DistanceType low, high;
+    };
+
+    typedef std::vector<Interval> BoundingBox;
+
+    typedef BranchStruct<NodePtr, DistanceType> BranchSt;
+    typedef BranchSt* Branch;
+
+
+
+
+    void save_tree(FILE* stream, NodePtr tree)
+    {
+        save_value(stream, *tree);
+        if (tree->child1!=NULL) {
+            save_tree(stream, tree->child1);
+        }
+        if (tree->child2!=NULL) {
+            save_tree(stream, tree->child2);
+        }
+    }
+
+
+    void load_tree(FILE* stream, NodePtr& tree)
+    {
+        tree = pool_.allocate<Node>();
+        load_value(stream, *tree);
+        if (tree->child1!=NULL) {
+            load_tree(stream, tree->child1);
+        }
+        if (tree->child2!=NULL) {
+            load_tree(stream, tree->child2);
+        }
+    }
+
+
+    void computeBoundingBox(BoundingBox& bbox)
+    {
+        bbox.resize(dim_);
+        for (size_t i=0; i<dim_; ++i) {
+            bbox[i].low = (DistanceType)dataset_[0][i];
+            bbox[i].high = (DistanceType)dataset_[0][i];
+        }
+        for (size_t k=1; k<dataset_.rows; ++k) {
+            for (size_t i=0; i<dim_; ++i) {
+                if (dataset_[k][i]<bbox[i].low) bbox[i].low = (DistanceType)dataset_[k][i];
+                if (dataset_[k][i]>bbox[i].high) bbox[i].high = (DistanceType)dataset_[k][i];
+            }
+        }
+    }
+
+
+    /**
+     * Create a tree node that subdivides the list of vecs from vind[first]
+     * to vind[last].  The routine is called recursively on each sublist.
+     * Place a pointer to this new tree node in the location pTree.
+     *
+     * Params: pTree = the new node to create
+     *                  first = index of the first vector
+     *                  last = index of the last vector
+     */
+    NodePtr divideTree(int left, int right, BoundingBox& bbox)
+    {
+        NodePtr node = pool_.allocate<Node>(); // allocate memory
+
+        /* If too few exemplars remain, then make this a leaf node. */
+        if ( (right-left) <= leaf_max_size_) {
+            node->child1 = node->child2 = NULL;    /* Mark as leaf node. */
+            node->left = left;
+            node->right = right;
+
+            // compute bounding-box of leaf points
+            for (size_t i=0; i<dim_; ++i) {
+                bbox[i].low = (DistanceType)dataset_[vind_[left]][i];
+                bbox[i].high = (DistanceType)dataset_[vind_[left]][i];
+            }
+            for (int k=left+1; k<right; ++k) {
+                for (size_t i=0; i<dim_; ++i) {
+                    if (bbox[i].low>dataset_[vind_[k]][i]) bbox[i].low=(DistanceType)dataset_[vind_[k]][i];
+                    if (bbox[i].high<dataset_[vind_[k]][i]) bbox[i].high=(DistanceType)dataset_[vind_[k]][i];
+                }
+            }
+        }
+        else {
+            int idx;
+            int cutfeat;
+            DistanceType cutval;
+            middleSplit_(&vind_[0]+left, right-left, idx, cutfeat, cutval, bbox);
+
+            node->divfeat = cutfeat;
+
+            BoundingBox left_bbox(bbox);
+            left_bbox[cutfeat].high = cutval;
+            node->child1 = divideTree(left, left+idx, left_bbox);
+
+            BoundingBox right_bbox(bbox);
+            right_bbox[cutfeat].low = cutval;
+            node->child2 = divideTree(left+idx, right, right_bbox);
+
+            node->divlow = left_bbox[cutfeat].high;
+            node->divhigh = right_bbox[cutfeat].low;
+
+            for (size_t i=0; i<dim_; ++i) {
+                bbox[i].low = std::min(left_bbox[i].low, right_bbox[i].low);
+                bbox[i].high = std::max(left_bbox[i].high, right_bbox[i].high);
+            }
+        }
+
+        return node;
+    }
+
+    void computeMinMax(int* ind, int count, int dim, ElementType& min_elem, ElementType& max_elem)
+    {
+        min_elem = dataset_[ind[0]][dim];
+        max_elem = dataset_[ind[0]][dim];
+        for (int i=1; i<count; ++i) {
+            ElementType val = dataset_[ind[i]][dim];
+            if (val<min_elem) min_elem = val;
+            if (val>max_elem) max_elem = val;
+        }
+    }
+
+    void middleSplit(int* ind, int count, int& index, int& cutfeat, DistanceType& cutval, const BoundingBox& bbox)
+    {
+        // find the largest span from the approximate bounding box
+        ElementType max_span = bbox[0].high-bbox[0].low;
+        cutfeat = 0;
+        cutval = (bbox[0].high+bbox[0].low)/2;
+        for (size_t i=1; i<dim_; ++i) {
+            ElementType span = bbox[i].high-bbox[i].low;
+            if (span>max_span) {
+                max_span = span;
+                cutfeat = i;
+                cutval = (bbox[i].high+bbox[i].low)/2;
+            }
+        }
+
+        // compute exact span on the found dimension
+        ElementType min_elem, max_elem;
+        computeMinMax(ind, count, cutfeat, min_elem, max_elem);
+        cutval = (min_elem+max_elem)/2;
+        max_span = max_elem - min_elem;
+
+        // check if a dimension of a largest span exists
+        size_t k = cutfeat;
+        for (size_t i=0; i<dim_; ++i) {
+            if (i==k) continue;
+            ElementType span = bbox[i].high-bbox[i].low;
+            if (span>max_span) {
+                computeMinMax(ind, count, i, min_elem, max_elem);
+                span = max_elem - min_elem;
+                if (span>max_span) {
+                    max_span = span;
+                    cutfeat = i;
+                    cutval = (min_elem+max_elem)/2;
+                }
+            }
+        }
+        int lim1, lim2;
+        planeSplit(ind, count, cutfeat, cutval, lim1, lim2);
+
+        if (lim1>count/2) index = lim1;
+        else if (lim2<count/2) index = lim2;
+        else index = count/2;
+    }
+
+
+    void middleSplit_(int* ind, int count, int& index, int& cutfeat, DistanceType& cutval, const BoundingBox& bbox)
+    {
+        const float EPS=0.00001f;
+        DistanceType max_span = bbox[0].high-bbox[0].low;
+        for (size_t i=1; i<dim_; ++i) {
+            DistanceType span = bbox[i].high-bbox[i].low;
+            if (span>max_span) {
+                max_span = span;
+            }
+        }
+        DistanceType max_spread = -1;
+        cutfeat = 0;
+        for (size_t i=0; i<dim_; ++i) {
+            DistanceType span = bbox[i].high-bbox[i].low;
+            if (span>(DistanceType)((1-EPS)*max_span)) {
+                ElementType min_elem, max_elem;
+                computeMinMax(ind, count, cutfeat, min_elem, max_elem);
+                DistanceType spread = (DistanceType)(max_elem-min_elem);
+                if (spread>max_spread) {
+                    cutfeat = (int)i;
+                    max_spread = spread;
+                }
+            }
+        }
+        // split in the middle
+        DistanceType split_val = (bbox[cutfeat].low+bbox[cutfeat].high)/2;
+        ElementType min_elem, max_elem;
+        computeMinMax(ind, count, cutfeat, min_elem, max_elem);
+
+        if (split_val<min_elem) cutval = (DistanceType)min_elem;
+        else if (split_val>max_elem) cutval = (DistanceType)max_elem;
+        else cutval = split_val;
+
+        int lim1, lim2;
+        planeSplit(ind, count, cutfeat, cutval, lim1, lim2);
+
+        if (lim1>count/2) index = lim1;
+        else if (lim2<count/2) index = lim2;
+        else index = count/2;
+    }
+
+
+    /**
+     *  Subdivide the list of points by a plane perpendicular on axe corresponding
+     *  to the 'cutfeat' dimension at 'cutval' position.
+     *
+     *  On return:
+     *  dataset[ind[0..lim1-1]][cutfeat]<cutval
+     *  dataset[ind[lim1..lim2-1]][cutfeat]==cutval
+     *  dataset[ind[lim2..count]][cutfeat]>cutval
+     */
+    void planeSplit(int* ind, int count, int cutfeat, DistanceType cutval, int& lim1, int& lim2)
+    {
+        /* Move vector indices for left subtree to front of list. */
+        int left = 0;
+        int right = count-1;
+        for (;; ) {
+            while (left<=right && dataset_[ind[left]][cutfeat]<cutval) ++left;
+            while (left<=right && dataset_[ind[right]][cutfeat]>=cutval) --right;
+            if (left>right) break;
+            std::swap(ind[left], ind[right]); ++left; --right;
+        }
+        /* If either list is empty, it means that all remaining features
+         * are identical. Split in the middle to maintain a balanced tree.
+         */
+        lim1 = left;
+        right = count-1;
+        for (;; ) {
+            while (left<=right && dataset_[ind[left]][cutfeat]<=cutval) ++left;
+            while (left<=right && dataset_[ind[right]][cutfeat]>cutval) --right;
+            if (left>right) break;
+            std::swap(ind[left], ind[right]); ++left; --right;
+        }
+        lim2 = left;
+    }
+
+    DistanceType computeInitialDistances(const ElementType* vec, std::vector<DistanceType>& dists)
+    {
+        DistanceType distsq = 0.0;
+
+        for (size_t i = 0; i < dim_; ++i) {
+            if (vec[i] < root_bbox_[i].low) {
+                dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].low, (int)i);
+                distsq += dists[i];
+            }
+            if (vec[i] > root_bbox_[i].high) {
+                dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].high, (int)i);
+                distsq += dists[i];
+            }
+        }
+
+        return distsq;
+    }
+
+    /**
+     * Performs an exact search in the tree starting from a node.
+     */
+    void searchLevel(ResultSet<DistanceType>& result_set, const ElementType* vec, const NodePtr node, DistanceType mindistsq,
+                     std::vector<DistanceType>& dists, const float epsError)
+    {
+        /* If this is a leaf node, then do check and return. */
+        if ((node->child1 == NULL)&&(node->child2 == NULL)) {
+            DistanceType worst_dist = result_set.worstDist();
+            for (int i=node->left; i<node->right; ++i) {
+                int index = reorder_ ? i : vind_[i];
+                DistanceType dist = distance_(vec, data_[index], dim_, worst_dist);
+                if (dist<worst_dist) {
+                    result_set.addPoint(dist,vind_[i]);
+                }
+            }
+            return;
+        }
+
+        /* Which child branch should be taken first? */
+        int idx = node->divfeat;
+        ElementType val = vec[idx];
+        DistanceType diff1 = val - node->divlow;
+        DistanceType diff2 = val - node->divhigh;
+
+        NodePtr bestChild;
+        NodePtr otherChild;
+        DistanceType cut_dist;
+        if ((diff1+diff2)<0) {
+            bestChild = node->child1;
+            otherChild = node->child2;
+            cut_dist = distance_.accum_dist(val, node->divhigh, idx);
+        }
+        else {
+            bestChild = node->child2;
+            otherChild = node->child1;
+            cut_dist = distance_.accum_dist( val, node->divlow, idx);
+        }
+
+        /* Call recursively to search next level down. */
+        searchLevel(result_set, vec, bestChild, mindistsq, dists, epsError);
+
+        DistanceType dst = dists[idx];
+        mindistsq = mindistsq + cut_dist - dst;
+        dists[idx] = cut_dist;
+        if (mindistsq*epsError<=result_set.worstDist()) {
+            searchLevel(result_set, vec, otherChild, mindistsq, dists, epsError);
+        }
+        dists[idx] = dst;
+    }
+
+private:
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset_;
+
+    IndexParams index_params_;
+
+    int leaf_max_size_;
+    bool reorder_;
+
+
+    /**
+     *  Array of indices to vectors in the dataset.
+     */
+    std::vector<int> vind_;
+
+    Matrix<ElementType> data_;
+
+    size_t size_;
+    size_t dim_;
+
+    /**
+     * Array of k-d trees used to find neighbours.
+     */
+    NodePtr root_node_;
+
+    BoundingBox root_bbox_;
+
+    /**
+     * Pooled memory allocator.
+     *
+     * Using a pooled memory allocator is more efficient
+     * than allocating memory directly when there is a large
+     * number small of memory allocations.
+     */
+    PooledAllocator pool_;
+
+    Distance distance_;
+};   // class KDTree
+
+}
+
+#endif //OPENCV_FLANN_KDTREE_SINGLE_INDEX_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h
new file mode 100644
index 0000000..226fc71
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/kmeans_index.h
@@ -0,0 +1,1169 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_KMEANS_INDEX_H_
+#define OPENCV_FLANN_KMEANS_INDEX_H_
+
+#include <algorithm>
+#include <map>
+#include <cassert>
+#include <limits>
+#include <cmath>
+
+#include "general.h"
+#include "nn_index.h"
+#include "dist.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+#include "logger.h"
+
+
+namespace cvflann
+{
+
+struct KMeansIndexParams : public IndexParams
+{
+    KMeansIndexParams(int branching = 32, int iterations = 11,
+                      flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, float cb_index = 0.2 )
+    {
+        (*this)["algorithm"] = FLANN_INDEX_KMEANS;
+        // branching factor
+        (*this)["branching"] = branching;
+        // max iterations to perform in one kmeans clustering (kmeans tree)
+        (*this)["iterations"] = iterations;
+        // algorithm used for picking the initial cluster centers for kmeans tree
+        (*this)["centers_init"] = centers_init;
+        // cluster boundary index. Used when searching the kmeans tree
+        (*this)["cb_index"] = cb_index;
+    }
+};
+
+
+/**
+ * Hierarchical kmeans index
+ *
+ * Contains a tree constructed through a hierarchical kmeans clustering
+ * and other information for indexing a set of points for nearest-neighbour matching.
+ */
+template <typename Distance>
+class KMeansIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+
+
+    typedef void (KMeansIndex::* centersAlgFunction)(int, int*, int, int*, int&);
+
+    /**
+     * The function used for choosing the cluster centers.
+     */
+    centersAlgFunction chooseCenters;
+
+
+
+    /**
+     * Chooses the initial centers in the k-means clustering in a random manner.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     *     indices_length = length of indices vector
+     *
+     */
+    void chooseCentersRandom(int k, int* indices, int indices_length, int* centers, int& centers_length)
+    {
+        UniqueRandom r(indices_length);
+
+        int index;
+        for (index=0; index<k; ++index) {
+            bool duplicate = true;
+            int rnd;
+            while (duplicate) {
+                duplicate = false;
+                rnd = r.next();
+                if (rnd<0) {
+                    centers_length = index;
+                    return;
+                }
+
+                centers[index] = indices[rnd];
+
+                for (int j=0; j<index; ++j) {
+                    DistanceType sq = distance_(dataset_[centers[index]], dataset_[centers[j]], dataset_.cols);
+                    if (sq<1e-16) {
+                        duplicate = true;
+                    }
+                }
+            }
+        }
+
+        centers_length = index;
+    }
+
+
+    /**
+     * Chooses the initial centers in the k-means using Gonzales' algorithm
+     * so that the centers are spaced apart from each other.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void chooseCentersGonzales(int k, int* indices, int indices_length, int* centers, int& centers_length)
+    {
+        int n = indices_length;
+
+        int rnd = rand_int(n);
+        assert(rnd >=0 && rnd < n);
+
+        centers[0] = indices[rnd];
+
+        int index;
+        for (index=1; index<k; ++index) {
+
+            int best_index = -1;
+            DistanceType best_val = 0;
+            for (int j=0; j<n; ++j) {
+                DistanceType dist = distance_(dataset_[centers[0]],dataset_[indices[j]],dataset_.cols);
+                for (int i=1; i<index; ++i) {
+                    DistanceType tmp_dist = distance_(dataset_[centers[i]],dataset_[indices[j]],dataset_.cols);
+                    if (tmp_dist<dist) {
+                        dist = tmp_dist;
+                    }
+                }
+                if (dist>best_val) {
+                    best_val = dist;
+                    best_index = j;
+                }
+            }
+            if (best_index!=-1) {
+                centers[index] = indices[best_index];
+            }
+            else {
+                break;
+            }
+        }
+        centers_length = index;
+    }
+
+
+    /**
+     * Chooses the initial centers in the k-means using the algorithm
+     * proposed in the KMeans++ paper:
+     * Arthur, David; Vassilvitskii, Sergei - k-means++: The Advantages of Careful Seeding
+     *
+     * Implementation of this function was converted from the one provided in Arthur's code.
+     *
+     * Params:
+     *     k = number of centers
+     *     vecs = the dataset of points
+     *     indices = indices in the dataset
+     * Returns:
+     */
+    void chooseCentersKMeanspp(int k, int* indices, int indices_length, int* centers, int& centers_length)
+    {
+        int n = indices_length;
+
+        double currentPot = 0;
+        DistanceType* closestDistSq = new DistanceType[n];
+
+        // Choose one random center and set the closestDistSq values
+        int index = rand_int(n);
+        assert(index >=0 && index < n);
+        centers[0] = indices[index];
+
+        for (int i = 0; i < n; i++) {
+            closestDistSq[i] = distance_(dataset_[indices[i]], dataset_[indices[index]], dataset_.cols);
+            closestDistSq[i] = ensureSquareDistance<Distance>( closestDistSq[i] );
+            currentPot += closestDistSq[i];
+        }
+
+
+        const int numLocalTries = 1;
+
+        // Choose each center
+        int centerCount;
+        for (centerCount = 1; centerCount < k; centerCount++) {
+
+            // Repeat several trials
+            double bestNewPot = -1;
+            int bestNewIndex = -1;
+            for (int localTrial = 0; localTrial < numLocalTries; localTrial++) {
+
+                // Choose our center - have to be slightly careful to return a valid answer even accounting
+                // for possible rounding errors
+                double randVal = rand_double(currentPot);
+                for (index = 0; index < n-1; index++) {
+                    if (randVal <= closestDistSq[index]) break;
+                    else randVal -= closestDistSq[index];
+                }
+
+                // Compute the new potential
+                double newPot = 0;
+                for (int i = 0; i < n; i++) {
+                    DistanceType dist = distance_(dataset_[indices[i]], dataset_[indices[index]], dataset_.cols);
+                    newPot += std::min( ensureSquareDistance<Distance>(dist), closestDistSq[i] );
+                }
+
+                // Store the best result
+                if ((bestNewPot < 0)||(newPot < bestNewPot)) {
+                    bestNewPot = newPot;
+                    bestNewIndex = index;
+                }
+            }
+
+            // Add the appropriate center
+            centers[centerCount] = indices[bestNewIndex];
+            currentPot = bestNewPot;
+            for (int i = 0; i < n; i++) {
+                DistanceType dist = distance_(dataset_[indices[i]], dataset_[indices[bestNewIndex]], dataset_.cols);
+                closestDistSq[i] = std::min( ensureSquareDistance<Distance>(dist), closestDistSq[i] );
+            }
+        }
+
+        centers_length = centerCount;
+
+        delete[] closestDistSq;
+    }
+
+
+
+public:
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_KMEANS;
+    }
+
+    class KMeansDistanceComputer : public cv::ParallelLoopBody
+    {
+    public:
+        KMeansDistanceComputer(Distance _distance, const Matrix<ElementType>& _dataset,
+            const int _branching, const int* _indices, const Matrix<double>& _dcenters, const size_t _veclen,
+            int* _count, int* _belongs_to, std::vector<DistanceType>& _radiuses, bool& _converged, cv::Mutex& _mtx)
+            : distance(_distance)
+            , dataset(_dataset)
+            , branching(_branching)
+            , indices(_indices)
+            , dcenters(_dcenters)
+            , veclen(_veclen)
+            , count(_count)
+            , belongs_to(_belongs_to)
+            , radiuses(_radiuses)
+            , converged(_converged)
+            , mtx(_mtx)
+        {
+        }
+
+        void operator()(const cv::Range& range) const
+        {
+            const int begin = range.start;
+            const int end = range.end;
+
+            for( int i = begin; i<end; ++i)
+            {
+                DistanceType sq_dist = distance(dataset[indices[i]], dcenters[0], veclen);
+                int new_centroid = 0;
+                for (int j=1; j<branching; ++j) {
+                    DistanceType new_sq_dist = distance(dataset[indices[i]], dcenters[j], veclen);
+                    if (sq_dist>new_sq_dist) {
+                        new_centroid = j;
+                        sq_dist = new_sq_dist;
+                    }
+                }
+                if (sq_dist > radiuses[new_centroid]) {
+                    radiuses[new_centroid] = sq_dist;
+                }
+                if (new_centroid != belongs_to[i]) {
+                    count[belongs_to[i]]--;
+                    count[new_centroid]++;
+                    belongs_to[i] = new_centroid;
+                    mtx.lock();
+                    converged = false;
+                    mtx.unlock();
+                }
+            }
+        }
+
+    private:
+        Distance distance;
+        const Matrix<ElementType>& dataset;
+        const int branching;
+        const int* indices;
+        const Matrix<double>& dcenters;
+        const size_t veclen;
+        int* count;
+        int* belongs_to;
+        std::vector<DistanceType>& radiuses;
+        bool& converged;
+        cv::Mutex& mtx;
+        KMeansDistanceComputer& operator=( const KMeansDistanceComputer & ) { return *this; }
+    };
+
+    /**
+     * Index constructor
+     *
+     * Params:
+     *          inputData = dataset with the input features
+     *          params = parameters passed to the hierarchical k-means algorithm
+     */
+    KMeansIndex(const Matrix<ElementType>& inputData, const IndexParams& params = KMeansIndexParams(),
+                Distance d = Distance())
+        : dataset_(inputData), index_params_(params), root_(NULL), indices_(NULL), distance_(d)
+    {
+        memoryCounter_ = 0;
+
+        size_ = dataset_.rows;
+        veclen_ = dataset_.cols;
+
+        branching_ = get_param(params,"branching",32);
+        iterations_ = get_param(params,"iterations",11);
+        if (iterations_<0) {
+            iterations_ = (std::numeric_limits<int>::max)();
+        }
+        centers_init_  = get_param(params,"centers_init",FLANN_CENTERS_RANDOM);
+
+        if (centers_init_==FLANN_CENTERS_RANDOM) {
+            chooseCenters = &KMeansIndex::chooseCentersRandom;
+        }
+        else if (centers_init_==FLANN_CENTERS_GONZALES) {
+            chooseCenters = &KMeansIndex::chooseCentersGonzales;
+        }
+        else if (centers_init_==FLANN_CENTERS_KMEANSPP) {
+            chooseCenters = &KMeansIndex::chooseCentersKMeanspp;
+        }
+        else {
+            throw FLANNException("Unknown algorithm for choosing initial centers.");
+        }
+        cb_index_ = 0.4f;
+
+    }
+
+
+    KMeansIndex(const KMeansIndex&);
+    KMeansIndex& operator=(const KMeansIndex&);
+
+
+    /**
+     * Index destructor.
+     *
+     * Release the memory used by the index.
+     */
+    virtual ~KMeansIndex()
+    {
+        if (root_ != NULL) {
+            free_centers(root_);
+        }
+        if (indices_!=NULL) {
+            delete[] indices_;
+        }
+    }
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return size_;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return veclen_;
+    }
+
+
+    void set_cb_index( float index)
+    {
+        cb_index_ = index;
+    }
+
+    /**
+     * Computes the inde memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return pool_.usedMemory+pool_.wastedMemory+memoryCounter_;
+    }
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        if (branching_<2) {
+            throw FLANNException("Branching factor must be at least 2");
+        }
+
+        indices_ = new int[size_];
+        for (size_t i=0; i<size_; ++i) {
+            indices_[i] = int(i);
+        }
+
+        root_ = pool_.allocate<KMeansNode>();
+        std::memset(root_, 0, sizeof(KMeansNode));
+
+        computeNodeStatistics(root_, indices_, (int)size_);
+        computeClustering(root_, indices_, (int)size_, branching_,0);
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream, branching_);
+        save_value(stream, iterations_);
+        save_value(stream, memoryCounter_);
+        save_value(stream, cb_index_);
+        save_value(stream, *indices_, (int)size_);
+
+        save_tree(stream, root_);
+    }
+
+
+    void loadIndex(FILE* stream)
+    {
+        load_value(stream, branching_);
+        load_value(stream, iterations_);
+        load_value(stream, memoryCounter_);
+        load_value(stream, cb_index_);
+        if (indices_!=NULL) {
+            delete[] indices_;
+        }
+        indices_ = new int[size_];
+        load_value(stream, *indices_, size_);
+
+        if (root_!=NULL) {
+            free_centers(root_);
+        }
+        load_tree(stream, root_);
+
+        index_params_["algorithm"] = getType();
+        index_params_["branching"] = branching_;
+        index_params_["iterations"] = iterations_;
+        index_params_["centers_init"] = centers_init_;
+        index_params_["cb_index"] = cb_index_;
+
+    }
+
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     searchParams = parameters that influence the search algorithm (checks, cb_index)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
+    {
+
+        int maxChecks = get_param(searchParams,"checks",32);
+
+        if (maxChecks==FLANN_CHECKS_UNLIMITED) {
+            findExactNN(root_, result, vec);
+        }
+        else {
+            // Priority queue storing intermediate branches in the best-bin-first search
+            Heap<BranchSt>* heap = new Heap<BranchSt>((int)size_);
+
+            int checks = 0;
+            findNN(root_, result, vec, checks, maxChecks, heap);
+
+            BranchSt branch;
+            while (heap->popMin(branch) && (checks<maxChecks || !result.full())) {
+                KMeansNodePtr node = branch.node;
+                findNN(node, result, vec, checks, maxChecks, heap);
+            }
+            assert(result.full());
+
+            delete heap;
+        }
+
+    }
+
+    /**
+     * Clustering function that takes a cut in the hierarchical k-means
+     * tree and return the clusters centers of that clustering.
+     * Params:
+     *     numClusters = number of clusters to have in the clustering computed
+     * Returns: number of cluster centers
+     */
+    int getClusterCenters(Matrix<DistanceType>& centers)
+    {
+        int numClusters = centers.rows;
+        if (numClusters<1) {
+            throw FLANNException("Number of clusters must be at least 1");
+        }
+
+        DistanceType variance;
+        KMeansNodePtr* clusters = new KMeansNodePtr[numClusters];
+
+        int clusterCount = getMinVarianceClusters(root_, clusters, numClusters, variance);
+
+        Logger::info("Clusters requested: %d, returning %d\n",numClusters, clusterCount);
+
+        for (int i=0; i<clusterCount; ++i) {
+            DistanceType* center = clusters[i]->pivot;
+            for (size_t j=0; j<veclen_; ++j) {
+                centers[i][j] = center[j];
+            }
+        }
+        delete[] clusters;
+
+        return clusterCount;
+    }
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+
+private:
+    /**
+     * Struture representing a node in the hierarchical k-means tree.
+     */
+    struct KMeansNode
+    {
+        /**
+         * The cluster center.
+         */
+        DistanceType* pivot;
+        /**
+         * The cluster radius.
+         */
+        DistanceType radius;
+        /**
+         * The cluster mean radius.
+         */
+        DistanceType mean_radius;
+        /**
+         * The cluster variance.
+         */
+        DistanceType variance;
+        /**
+         * The cluster size (number of points in the cluster)
+         */
+        int size;
+        /**
+         * Child nodes (only for non-terminal nodes)
+         */
+        KMeansNode** childs;
+        /**
+         * Node points (only for terminal nodes)
+         */
+        int* indices;
+        /**
+         * Level
+         */
+        int level;
+    };
+    typedef KMeansNode* KMeansNodePtr;
+
+    /**
+     * Alias definition for a nicer syntax.
+     */
+    typedef BranchStruct<KMeansNodePtr, DistanceType> BranchSt;
+
+
+
+
+    void save_tree(FILE* stream, KMeansNodePtr node)
+    {
+        save_value(stream, *node);
+        save_value(stream, *(node->pivot), (int)veclen_);
+        if (node->childs==NULL) {
+            int indices_offset = (int)(node->indices - indices_);
+            save_value(stream, indices_offset);
+        }
+        else {
+            for(int i=0; i<branching_; ++i) {
+                save_tree(stream, node->childs[i]);
+            }
+        }
+    }
+
+
+    void load_tree(FILE* stream, KMeansNodePtr& node)
+    {
+        node = pool_.allocate<KMeansNode>();
+        load_value(stream, *node);
+        node->pivot = new DistanceType[veclen_];
+        load_value(stream, *(node->pivot), (int)veclen_);
+        if (node->childs==NULL) {
+            int indices_offset;
+            load_value(stream, indices_offset);
+            node->indices = indices_ + indices_offset;
+        }
+        else {
+            node->childs = pool_.allocate<KMeansNodePtr>(branching_);
+            for(int i=0; i<branching_; ++i) {
+                load_tree(stream, node->childs[i]);
+            }
+        }
+    }
+
+
+    /**
+     * Helper function
+     */
+    void free_centers(KMeansNodePtr node)
+    {
+        delete[] node->pivot;
+        if (node->childs!=NULL) {
+            for (int k=0; k<branching_; ++k) {
+                free_centers(node->childs[k]);
+            }
+        }
+    }
+
+    /**
+     * Computes the statistics of a node (mean, radius, variance).
+     *
+     * Params:
+     *     node = the node to use
+     *     indices = the indices of the points belonging to the node
+     */
+    void computeNodeStatistics(KMeansNodePtr node, int* indices, int indices_length)
+    {
+
+        DistanceType radius = 0;
+        DistanceType variance = 0;
+        DistanceType* mean = new DistanceType[veclen_];
+        memoryCounter_ += int(veclen_*sizeof(DistanceType));
+
+        memset(mean,0,veclen_*sizeof(DistanceType));
+
+        for (size_t i=0; i<size_; ++i) {
+            ElementType* vec = dataset_[indices[i]];
+            for (size_t j=0; j<veclen_; ++j) {
+                mean[j] += vec[j];
+            }
+            variance += distance_(vec, ZeroIterator<ElementType>(), veclen_);
+        }
+        for (size_t j=0; j<veclen_; ++j) {
+            mean[j] /= size_;
+        }
+        variance /= size_;
+        variance -= distance_(mean, ZeroIterator<ElementType>(), veclen_);
+
+        DistanceType tmp = 0;
+        for (int i=0; i<indices_length; ++i) {
+            tmp = distance_(mean, dataset_[indices[i]], veclen_);
+            if (tmp>radius) {
+                radius = tmp;
+            }
+        }
+
+        node->variance = variance;
+        node->radius = radius;
+        node->pivot = mean;
+    }
+
+
+    /**
+     * The method responsible with actually doing the recursive hierarchical
+     * clustering
+     *
+     * Params:
+     *     node = the node to cluster
+     *     indices = indices of the points belonging to the current node
+     *     branching = the branching factor to use in the clustering
+     *
+     * TODO: for 1-sized clusters don't store a cluster center (it's the same as the single cluster point)
+     */
+    void computeClustering(KMeansNodePtr node, int* indices, int indices_length, int branching, int level)
+    {
+        node->size = indices_length;
+        node->level = level;
+
+        if (indices_length < branching) {
+            node->indices = indices;
+            std::sort(node->indices,node->indices+indices_length);
+            node->childs = NULL;
+            return;
+        }
+
+        cv::AutoBuffer<int> centers_idx_buf(branching);
+        int* centers_idx = (int*)centers_idx_buf;
+        int centers_length;
+        (this->*chooseCenters)(branching, indices, indices_length, centers_idx, centers_length);
+
+        if (centers_length<branching) {
+            node->indices = indices;
+            std::sort(node->indices,node->indices+indices_length);
+            node->childs = NULL;
+            return;
+        }
+
+
+        cv::AutoBuffer<double> dcenters_buf(branching*veclen_);
+        Matrix<double> dcenters((double*)dcenters_buf,branching,veclen_);
+        for (int i=0; i<centers_length; ++i) {
+            ElementType* vec = dataset_[centers_idx[i]];
+            for (size_t k=0; k<veclen_; ++k) {
+                dcenters[i][k] = double(vec[k]);
+            }
+        }
+
+        std::vector<DistanceType> radiuses(branching);
+        cv::AutoBuffer<int> count_buf(branching);
+        int* count = (int*)count_buf;
+        for (int i=0; i<branching; ++i) {
+            radiuses[i] = 0;
+            count[i] = 0;
+        }
+
+        //	assign points to clusters
+        cv::AutoBuffer<int> belongs_to_buf(indices_length);
+        int* belongs_to = (int*)belongs_to_buf;
+        for (int i=0; i<indices_length; ++i) {
+
+            DistanceType sq_dist = distance_(dataset_[indices[i]], dcenters[0], veclen_);
+            belongs_to[i] = 0;
+            for (int j=1; j<branching; ++j) {
+                DistanceType new_sq_dist = distance_(dataset_[indices[i]], dcenters[j], veclen_);
+                if (sq_dist>new_sq_dist) {
+                    belongs_to[i] = j;
+                    sq_dist = new_sq_dist;
+                }
+            }
+            if (sq_dist>radiuses[belongs_to[i]]) {
+                radiuses[belongs_to[i]] = sq_dist;
+            }
+            count[belongs_to[i]]++;
+        }
+
+        bool converged = false;
+        int iteration = 0;
+        while (!converged && iteration<iterations_) {
+            converged = true;
+            iteration++;
+
+            // compute the new cluster centers
+            for (int i=0; i<branching; ++i) {
+                memset(dcenters[i],0,sizeof(double)*veclen_);
+                radiuses[i] = 0;
+            }
+            for (int i=0; i<indices_length; ++i) {
+                ElementType* vec = dataset_[indices[i]];
+                double* center = dcenters[belongs_to[i]];
+                for (size_t k=0; k<veclen_; ++k) {
+                    center[k] += vec[k];
+                }
+            }
+            for (int i=0; i<branching; ++i) {
+                int cnt = count[i];
+                for (size_t k=0; k<veclen_; ++k) {
+                    dcenters[i][k] /= cnt;
+                }
+            }
+
+            // reassign points to clusters
+            cv::Mutex mtx;
+            KMeansDistanceComputer invoker(distance_, dataset_, branching, indices, dcenters, veclen_, count, belongs_to, radiuses, converged, mtx);
+            parallel_for_(cv::Range(0, (int)indices_length), invoker);
+
+            for (int i=0; i<branching; ++i) {
+                // if one cluster converges to an empty cluster,
+                // move an element into that cluster
+                if (count[i]==0) {
+                    int j = (i+1)%branching;
+                    while (count[j]<=1) {
+                        j = (j+1)%branching;
+                    }
+
+                    for (int k=0; k<indices_length; ++k) {
+                        if (belongs_to[k]==j) {
+                            // for cluster j, we move the furthest element from the center to the empty cluster i
+                            if ( distance_(dataset_[indices[k]], dcenters[j], veclen_) == radiuses[j] ) {
+                                belongs_to[k] = i;
+                                count[j]--;
+                                count[i]++;
+                                break;
+                            }
+                        }
+                    }
+                    converged = false;
+                }
+            }
+
+        }
+
+        DistanceType** centers = new DistanceType*[branching];
+
+        for (int i=0; i<branching; ++i) {
+            centers[i] = new DistanceType[veclen_];
+            memoryCounter_ += (int)(veclen_*sizeof(DistanceType));
+            for (size_t k=0; k<veclen_; ++k) {
+                centers[i][k] = (DistanceType)dcenters[i][k];
+            }
+        }
+
+
+        // compute kmeans clustering for each of the resulting clusters
+        node->childs = pool_.allocate<KMeansNodePtr>(branching);
+        int start = 0;
+        int end = start;
+        for (int c=0; c<branching; ++c) {
+            int s = count[c];
+
+            DistanceType variance = 0;
+            DistanceType mean_radius =0;
+            for (int i=0; i<indices_length; ++i) {
+                if (belongs_to[i]==c) {
+                    DistanceType d = distance_(dataset_[indices[i]], ZeroIterator<ElementType>(), veclen_);
+                    variance += d;
+                    mean_radius += sqrt(d);
+                    std::swap(indices[i],indices[end]);
+                    std::swap(belongs_to[i],belongs_to[end]);
+                    end++;
+                }
+            }
+            variance /= s;
+            mean_radius /= s;
+            variance -= distance_(centers[c], ZeroIterator<ElementType>(), veclen_);
+
+            node->childs[c] = pool_.allocate<KMeansNode>();
+            std::memset(node->childs[c], 0, sizeof(KMeansNode));
+            node->childs[c]->radius = radiuses[c];
+            node->childs[c]->pivot = centers[c];
+            node->childs[c]->variance = variance;
+            node->childs[c]->mean_radius = mean_radius;
+            computeClustering(node->childs[c],indices+start, end-start, branching, level+1);
+            start=end;
+        }
+    }
+
+
+
+    /**
+     * Performs one descent in the hierarchical k-means tree. The branches not
+     * visited are stored in a priority queue.
+     *
+     * Params:
+     *      node = node to explore
+     *      result = container for the k-nearest neighbors found
+     *      vec = query points
+     *      checks = how many points in the dataset have been checked so far
+     *      maxChecks = maximum dataset points to checks
+     */
+
+
+    void findNN(KMeansNodePtr node, ResultSet<DistanceType>& result, const ElementType* vec, int& checks, int maxChecks,
+                Heap<BranchSt>* heap)
+    {
+        // Ignore those clusters that are too far away
+        {
+            DistanceType bsq = distance_(vec, node->pivot, veclen_);
+            DistanceType rsq = node->radius;
+            DistanceType wsq = result.worstDist();
+
+            DistanceType val = bsq-rsq-wsq;
+            DistanceType val2 = val*val-4*rsq*wsq;
+
+            //if (val>0) {
+            if ((val>0)&&(val2>0)) {
+                return;
+            }
+        }
+
+        if (node->childs==NULL) {
+            if (checks>=maxChecks) {
+                if (result.full()) return;
+            }
+            checks += node->size;
+            for (int i=0; i<node->size; ++i) {
+                int index = node->indices[i];
+                DistanceType dist = distance_(dataset_[index], vec, veclen_);
+                result.addPoint(dist, index);
+            }
+        }
+        else {
+            DistanceType* domain_distances = new DistanceType[branching_];
+            int closest_center = exploreNodeBranches(node, vec, domain_distances, heap);
+            delete[] domain_distances;
+            findNN(node->childs[closest_center],result,vec, checks, maxChecks, heap);
+        }
+    }
+
+    /**
+     * Helper function that computes the nearest childs of a node to a given query point.
+     * Params:
+     *     node = the node
+     *     q = the query point
+     *     distances = array with the distances to each child node.
+     * Returns:
+     */
+    int exploreNodeBranches(KMeansNodePtr node, const ElementType* q, DistanceType* domain_distances, Heap<BranchSt>* heap)
+    {
+
+        int best_index = 0;
+        domain_distances[best_index] = distance_(q, node->childs[best_index]->pivot, veclen_);
+        for (int i=1; i<branching_; ++i) {
+            domain_distances[i] = distance_(q, node->childs[i]->pivot, veclen_);
+            if (domain_distances[i]<domain_distances[best_index]) {
+                best_index = i;
+            }
+        }
+
+        //		float* best_center = node->childs[best_index]->pivot;
+        for (int i=0; i<branching_; ++i) {
+            if (i != best_index) {
+                domain_distances[i] -= cb_index_*node->childs[i]->variance;
+
+                //				float dist_to_border = getDistanceToBorder(node.childs[i].pivot,best_center,q);
+                //				if (domain_distances[i]<dist_to_border) {
+                //					domain_distances[i] = dist_to_border;
+                //				}
+                heap->insert(BranchSt(node->childs[i],domain_distances[i]));
+            }
+        }
+
+        return best_index;
+    }
+
+
+    /**
+     * Function the performs exact nearest neighbor search by traversing the entire tree.
+     */
+    void findExactNN(KMeansNodePtr node, ResultSet<DistanceType>& result, const ElementType* vec)
+    {
+        // Ignore those clusters that are too far away
+        {
+            DistanceType bsq = distance_(vec, node->pivot, veclen_);
+            DistanceType rsq = node->radius;
+            DistanceType wsq = result.worstDist();
+
+            DistanceType val = bsq-rsq-wsq;
+            DistanceType val2 = val*val-4*rsq*wsq;
+
+            //                  if (val>0) {
+            if ((val>0)&&(val2>0)) {
+                return;
+            }
+        }
+
+
+        if (node->childs==NULL) {
+            for (int i=0; i<node->size; ++i) {
+                int index = node->indices[i];
+                DistanceType dist = distance_(dataset_[index], vec, veclen_);
+                result.addPoint(dist, index);
+            }
+        }
+        else {
+            int* sort_indices = new int[branching_];
+
+            getCenterOrdering(node, vec, sort_indices);
+
+            for (int i=0; i<branching_; ++i) {
+                findExactNN(node->childs[sort_indices[i]],result,vec);
+            }
+
+            delete[] sort_indices;
+        }
+    }
+
+
+    /**
+     * Helper function.
+     *
+     * I computes the order in which to traverse the child nodes of a particular node.
+     */
+    void getCenterOrdering(KMeansNodePtr node, const ElementType* q, int* sort_indices)
+    {
+        DistanceType* domain_distances = new DistanceType[branching_];
+        for (int i=0; i<branching_; ++i) {
+            DistanceType dist = distance_(q, node->childs[i]->pivot, veclen_);
+
+            int j=0;
+            while (domain_distances[j]<dist && j<i) j++;
+            for (int k=i; k>j; --k) {
+                domain_distances[k] = domain_distances[k-1];
+                sort_indices[k] = sort_indices[k-1];
+            }
+            domain_distances[j] = dist;
+            sort_indices[j] = i;
+        }
+        delete[] domain_distances;
+    }
+
+    /**
+     * Method that computes the squared distance from the query point q
+     * from inside region with center c to the border between this
+     * region and the region with center p
+     */
+    DistanceType getDistanceToBorder(DistanceType* p, DistanceType* c, DistanceType* q)
+    {
+        DistanceType sum = 0;
+        DistanceType sum2 = 0;
+
+        for (int i=0; i<veclen_; ++i) {
+            DistanceType t = c[i]-p[i];
+            sum += t*(q[i]-(c[i]+p[i])/2);
+            sum2 += t*t;
+        }
+
+        return sum*sum/sum2;
+    }
+
+
+    /**
+     * Helper function the descends in the hierarchical k-means tree by spliting those clusters that minimize
+     * the overall variance of the clustering.
+     * Params:
+     *     root = root node
+     *     clusters = array with clusters centers (return value)
+     *     varianceValue = variance of the clustering (return value)
+     * Returns:
+     */
+    int getMinVarianceClusters(KMeansNodePtr root, KMeansNodePtr* clusters, int clusters_length, DistanceType& varianceValue)
+    {
+        int clusterCount = 1;
+        clusters[0] = root;
+
+        DistanceType meanVariance = root->variance*root->size;
+
+        while (clusterCount<clusters_length) {
+            DistanceType minVariance = (std::numeric_limits<DistanceType>::max)();
+            int splitIndex = -1;
+
+            for (int i=0; i<clusterCount; ++i) {
+                if (clusters[i]->childs != NULL) {
+
+                    DistanceType variance = meanVariance - clusters[i]->variance*clusters[i]->size;
+
+                    for (int j=0; j<branching_; ++j) {
+                        variance += clusters[i]->childs[j]->variance*clusters[i]->childs[j]->size;
+                    }
+                    if (variance<minVariance) {
+                        minVariance = variance;
+                        splitIndex = i;
+                    }
+                }
+            }
+
+            if (splitIndex==-1) break;
+            if ( (branching_+clusterCount-1) > clusters_length) break;
+
+            meanVariance = minVariance;
+
+            // split node
+            KMeansNodePtr toSplit = clusters[splitIndex];
+            clusters[splitIndex] = toSplit->childs[0];
+            for (int i=1; i<branching_; ++i) {
+                clusters[clusterCount++] = toSplit->childs[i];
+            }
+        }
+
+        varianceValue = meanVariance/root->size;
+        return clusterCount;
+    }
+
+private:
+    /** The branching factor used in the hierarchical k-means clustering */
+    int branching_;
+
+    /** Maximum number of iterations to use when performing k-means clustering */
+    int iterations_;
+
+    /** Algorithm for choosing the cluster centers */
+    flann_centers_init_t centers_init_;
+
+    /**
+     * Cluster border index. This is used in the tree search phase when determining
+     * the closest cluster to explore next. A zero value takes into account only
+     * the cluster centres, a value greater then zero also take into account the size
+     * of the cluster.
+     */
+    float cb_index_;
+
+    /**
+     * The dataset used by this index
+     */
+    const Matrix<ElementType> dataset_;
+
+    /** Index parameters */
+    IndexParams index_params_;
+
+    /**
+     * Number of features in the dataset.
+     */
+    size_t size_;
+
+    /**
+     * Length of each feature.
+     */
+    size_t veclen_;
+
+    /**
+     * The root node in the tree.
+     */
+    KMeansNodePtr root_;
+
+    /**
+     *  Array of indices to vectors in the dataset.
+     */
+    int* indices_;
+
+    /**
+     * The distance
+     */
+    Distance distance_;
+
+    /**
+     * Pooled memory allocator.
+     */
+    PooledAllocator pool_;
+
+    /**
+     * Memory occupied by the index.
+     */
+    int memoryCounter_;
+};
+
+}
+
+#endif //OPENCV_FLANN_KMEANS_INDEX_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h
new file mode 100644
index 0000000..5aa7a5c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/linear_index.h
@@ -0,0 +1,132 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_LINEAR_INDEX_H_
+#define OPENCV_FLANN_LINEAR_INDEX_H_
+
+#include "general.h"
+#include "nn_index.h"
+
+namespace cvflann
+{
+
+struct LinearIndexParams : public IndexParams
+{
+    LinearIndexParams()
+    {
+        (* this)["algorithm"] = FLANN_INDEX_LINEAR;
+    }
+};
+
+template <typename Distance>
+class LinearIndex : public NNIndex<Distance>
+{
+public:
+
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+
+    LinearIndex(const Matrix<ElementType>& inputData, const IndexParams& params = LinearIndexParams(),
+                Distance d = Distance()) :
+        dataset_(inputData), index_params_(params), distance_(d)
+    {
+    }
+
+    LinearIndex(const LinearIndex&);
+    LinearIndex& operator=(const LinearIndex&);
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_LINEAR;
+    }
+
+
+    size_t size() const
+    {
+        return dataset_.rows;
+    }
+
+    size_t veclen() const
+    {
+        return dataset_.cols;
+    }
+
+
+    int usedMemory() const
+    {
+        return 0;
+    }
+
+    void buildIndex()
+    {
+        /* nothing to do here for linear search */
+    }
+
+    void saveIndex(FILE*)
+    {
+        /* nothing to do here for linear search */
+    }
+
+
+    void loadIndex(FILE*)
+    {
+        /* nothing to do here for linear search */
+
+        index_params_["algorithm"] = getType();
+    }
+
+    void findNeighbors(ResultSet<DistanceType>& resultSet, const ElementType* vec, const SearchParams& /*searchParams*/)
+    {
+        ElementType* data = dataset_.data;
+        for (size_t i = 0; i < dataset_.rows; ++i, data += dataset_.cols) {
+            DistanceType dist = distance_(data, vec, dataset_.cols);
+            resultSet.addPoint(dist, (int)i);
+        }
+    }
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+private:
+    /** The dataset */
+    const Matrix<ElementType> dataset_;
+    /** Index parameters */
+    IndexParams index_params_;
+    /** Index distance */
+    Distance distance_;
+
+};
+
+}
+
+#endif // OPENCV_FLANN_LINEAR_INDEX_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/logger.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/logger.h
new file mode 100644
index 0000000..24f3fb6
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/logger.h
@@ -0,0 +1,130 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_LOGGER_H
+#define OPENCV_FLANN_LOGGER_H
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "defines.h"
+
+
+namespace cvflann
+{
+
+class Logger
+{
+    Logger() : stream(stdout), logLevel(FLANN_LOG_WARN) {}
+
+    ~Logger()
+    {
+        if ((stream!=NULL)&&(stream!=stdout)) {
+            fclose(stream);
+        }
+    }
+
+    static Logger& instance()
+    {
+        static Logger logger;
+        return logger;
+    }
+
+    void _setDestination(const char* name)
+    {
+        if (name==NULL) {
+            stream = stdout;
+        }
+        else {
+            stream = fopen(name,"w");
+            if (stream == NULL) {
+                stream = stdout;
+            }
+        }
+    }
+
+    int _log(int level, const char* fmt, va_list arglist)
+    {
+        if (level > logLevel ) return -1;
+        int ret = vfprintf(stream, fmt, arglist);
+        return ret;
+    }
+
+public:
+    /**
+     * Sets the logging level. All messages with lower priority will be ignored.
+     * @param level Logging level
+     */
+    static void setLevel(int level) { instance().logLevel = level; }
+
+    /**
+     * Sets the logging destination
+     * @param name Filename or NULL for console
+     */
+    static void setDestination(const char* name) { instance()._setDestination(name); }
+
+    /**
+     * Print log message
+     * @param level Log level
+     * @param fmt Message format
+     * @return
+     */
+    static int log(int level, const char* fmt, ...)
+    {
+        va_list arglist;
+        va_start(arglist, fmt);
+        int ret = instance()._log(level,fmt,arglist);
+        va_end(arglist);
+        return ret;
+    }
+
+#define LOG_METHOD(NAME,LEVEL) \
+    static int NAME(const char* fmt, ...) \
+    { \
+        va_list ap; \
+        va_start(ap, fmt); \
+        int ret = instance()._log(LEVEL, fmt, ap); \
+        va_end(ap); \
+        return ret; \
+    }
+
+    LOG_METHOD(fatal, FLANN_LOG_FATAL)
+    LOG_METHOD(error, FLANN_LOG_ERROR)
+    LOG_METHOD(warn, FLANN_LOG_WARN)
+    LOG_METHOD(info, FLANN_LOG_INFO)
+
+private:
+    FILE* stream;
+    int logLevel;
+};
+
+}
+
+#endif //OPENCV_FLANN_LOGGER_H
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h
new file mode 100644
index 0000000..4d4670e
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/lsh_index.h
@@ -0,0 +1,392 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+/***********************************************************************
+ * Author: Vincent Rabaud
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_LSH_INDEX_H_
+#define OPENCV_FLANN_LSH_INDEX_H_
+
+#include <algorithm>
+#include <cassert>
+#include <cstring>
+#include <map>
+#include <vector>
+
+#include "general.h"
+#include "nn_index.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "heap.h"
+#include "lsh_table.h"
+#include "allocator.h"
+#include "random.h"
+#include "saving.h"
+
+namespace cvflann
+{
+
+struct LshIndexParams : public IndexParams
+{
+    LshIndexParams(unsigned int table_number = 12, unsigned int key_size = 20, unsigned int multi_probe_level = 2)
+    {
+        (* this)["algorithm"] = FLANN_INDEX_LSH;
+        // The number of hash tables to use
+        (*this)["table_number"] = table_number;
+        // The length of the key in the hash tables
+        (*this)["key_size"] = key_size;
+        // Number of levels to use in multi-probe (0 for standard LSH)
+        (*this)["multi_probe_level"] = multi_probe_level;
+    }
+};
+
+/**
+ * Randomized kd-tree index
+ *
+ * Contains the k-d trees and other information for indexing a set of points
+ * for nearest-neighbor matching.
+ */
+template<typename Distance>
+class LshIndex : public NNIndex<Distance>
+{
+public:
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+    /** Constructor
+     * @param input_data dataset with the input features
+     * @param params parameters passed to the LSH algorithm
+     * @param d the distance used
+     */
+    LshIndex(const Matrix<ElementType>& input_data, const IndexParams& params = LshIndexParams(),
+             Distance d = Distance()) :
+        dataset_(input_data), index_params_(params), distance_(d)
+    {
+        // cv::flann::IndexParams sets integer params as 'int', so it is used with get_param
+        // in place of 'unsigned int'
+        table_number_ = (unsigned int)get_param<int>(index_params_,"table_number",12);
+        key_size_ = (unsigned int)get_param<int>(index_params_,"key_size",20);
+        multi_probe_level_ = (unsigned int)get_param<int>(index_params_,"multi_probe_level",2);
+
+        feature_size_ = (unsigned)dataset_.cols;
+        fill_xor_mask(0, key_size_, multi_probe_level_, xor_masks_);
+    }
+
+
+    LshIndex(const LshIndex&);
+    LshIndex& operator=(const LshIndex&);
+
+    /**
+     * Builds the index
+     */
+    void buildIndex()
+    {
+        tables_.resize(table_number_);
+        for (unsigned int i = 0; i < table_number_; ++i) {
+            lsh::LshTable<ElementType>& table = tables_[i];
+            table = lsh::LshTable<ElementType>(feature_size_, key_size_);
+
+            // Add the features to the table
+            table.add(dataset_);
+        }
+    }
+
+    flann_algorithm_t getType() const
+    {
+        return FLANN_INDEX_LSH;
+    }
+
+
+    void saveIndex(FILE* stream)
+    {
+        save_value(stream,table_number_);
+        save_value(stream,key_size_);
+        save_value(stream,multi_probe_level_);
+        save_value(stream, dataset_);
+    }
+
+    void loadIndex(FILE* stream)
+    {
+        load_value(stream, table_number_);
+        load_value(stream, key_size_);
+        load_value(stream, multi_probe_level_);
+        load_value(stream, dataset_);
+        // Building the index is so fast we can afford not storing it
+        buildIndex();
+
+        index_params_["algorithm"] = getType();
+        index_params_["table_number"] = table_number_;
+        index_params_["key_size"] = key_size_;
+        index_params_["multi_probe_level"] = multi_probe_level_;
+    }
+
+    /**
+     *  Returns size of index.
+     */
+    size_t size() const
+    {
+        return dataset_.rows;
+    }
+
+    /**
+     * Returns the length of an index feature.
+     */
+    size_t veclen() const
+    {
+        return feature_size_;
+    }
+
+    /**
+     * Computes the index memory usage
+     * Returns: memory used by the index
+     */
+    int usedMemory() const
+    {
+        return (int)(dataset_.rows * sizeof(int));
+    }
+
+
+    IndexParams getParameters() const
+    {
+        return index_params_;
+    }
+
+    /**
+     * \brief Perform k-nearest neighbor search
+     * \param[in] queries The query points for which to find the nearest neighbors
+     * \param[out] indices The indices of the nearest neighbors found
+     * \param[out] dists Distances to the nearest neighbors found
+     * \param[in] knn Number of nearest neighbors to return
+     * \param[in] params Search parameters
+     */
+    virtual void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
+    {
+        assert(queries.cols == veclen());
+        assert(indices.rows >= queries.rows);
+        assert(dists.rows >= queries.rows);
+        assert(int(indices.cols) >= knn);
+        assert(int(dists.cols) >= knn);
+
+
+        KNNUniqueResultSet<DistanceType> resultSet(knn);
+        for (size_t i = 0; i < queries.rows; i++) {
+            resultSet.clear();
+            std::fill_n(indices[i], knn, -1);
+            std::fill_n(dists[i], knn, std::numeric_limits<DistanceType>::max());
+            findNeighbors(resultSet, queries[i], params);
+            if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices[i], dists[i], knn);
+            else resultSet.copy(indices[i], dists[i], knn);
+        }
+    }
+
+
+    /**
+     * Find set of nearest neighbors to vec. Their indices are stored inside
+     * the result object.
+     *
+     * Params:
+     *     result = the result object in which the indices of the nearest-neighbors are stored
+     *     vec = the vector for which to search the nearest neighbors
+     *     maxCheck = the maximum number of restarts (in a best-bin-first manner)
+     */
+    void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& /*searchParams*/)
+    {
+        getNeighbors(vec, result);
+    }
+
+private:
+    /** Defines the comparator on score and index
+     */
+    typedef std::pair<float, unsigned int> ScoreIndexPair;
+    struct SortScoreIndexPairOnSecond
+    {
+        bool operator()(const ScoreIndexPair& left, const ScoreIndexPair& right) const
+        {
+            return left.second < right.second;
+        }
+    };
+
+    /** Fills the different xor masks to use when getting the neighbors in multi-probe LSH
+     * @param key the key we build neighbors from
+     * @param lowest_index the lowest index of the bit set
+     * @param level the multi-probe level we are at
+     * @param xor_masks all the xor mask
+     */
+    void fill_xor_mask(lsh::BucketKey key, int lowest_index, unsigned int level,
+                       std::vector<lsh::BucketKey>& xor_masks)
+    {
+        xor_masks.push_back(key);
+        if (level == 0) return;
+        for (int index = lowest_index - 1; index >= 0; --index) {
+            // Create a new key
+            lsh::BucketKey new_key = key | (1 << index);
+            fill_xor_mask(new_key, index, level - 1, xor_masks);
+        }
+    }
+
+    /** Performs the approximate nearest-neighbor search.
+     * @param vec the feature to analyze
+     * @param do_radius flag indicating if we check the radius too
+     * @param radius the radius if it is a radius search
+     * @param do_k flag indicating if we limit the number of nn
+     * @param k_nn the number of nearest neighbors
+     * @param checked_average used for debugging
+     */
+    void getNeighbors(const ElementType* vec, bool /*do_radius*/, float radius, bool do_k, unsigned int k_nn,
+                      float& /*checked_average*/)
+    {
+        static std::vector<ScoreIndexPair> score_index_heap;
+
+        if (do_k) {
+            unsigned int worst_score = std::numeric_limits<unsigned int>::max();
+            typename std::vector<lsh::LshTable<ElementType> >::const_iterator table = tables_.begin();
+            typename std::vector<lsh::LshTable<ElementType> >::const_iterator table_end = tables_.end();
+            for (; table != table_end; ++table) {
+                size_t key = table->getKey(vec);
+                std::vector<lsh::BucketKey>::const_iterator xor_mask = xor_masks_.begin();
+                std::vector<lsh::BucketKey>::const_iterator xor_mask_end = xor_masks_.end();
+                for (; xor_mask != xor_mask_end; ++xor_mask) {
+                    size_t sub_key = key ^ (*xor_mask);
+                    const lsh::Bucket* bucket = table->getBucketFromKey(sub_key);
+                    if (bucket == 0) continue;
+
+                    // Go over each descriptor index
+                    std::vector<lsh::FeatureIndex>::const_iterator training_index = bucket->begin();
+                    std::vector<lsh::FeatureIndex>::const_iterator last_training_index = bucket->end();
+                    DistanceType hamming_distance;
+
+                    // Process the rest of the candidates
+                    for (; training_index < last_training_index; ++training_index) {
+                        hamming_distance = distance_(vec, dataset_[*training_index], dataset_.cols);
+
+                        if (hamming_distance < worst_score) {
+                            // Insert the new element
+                            score_index_heap.push_back(ScoreIndexPair(hamming_distance, training_index));
+                            std::push_heap(score_index_heap.begin(), score_index_heap.end());
+
+                            if (score_index_heap.size() > (unsigned int)k_nn) {
+                                // Remove the highest distance value as we have too many elements
+                                std::pop_heap(score_index_heap.begin(), score_index_heap.end());
+                                score_index_heap.pop_back();
+                                // Keep track of the worst score
+                                worst_score = score_index_heap.front().first;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        else {
+            typename std::vector<lsh::LshTable<ElementType> >::const_iterator table = tables_.begin();
+            typename std::vector<lsh::LshTable<ElementType> >::const_iterator table_end = tables_.end();
+            for (; table != table_end; ++table) {
+                size_t key = table->getKey(vec);
+                std::vector<lsh::BucketKey>::const_iterator xor_mask = xor_masks_.begin();
+                std::vector<lsh::BucketKey>::const_iterator xor_mask_end = xor_masks_.end();
+                for (; xor_mask != xor_mask_end; ++xor_mask) {
+                    size_t sub_key = key ^ (*xor_mask);
+                    const lsh::Bucket* bucket = table->getBucketFromKey(sub_key);
+                    if (bucket == 0) continue;
+
+                    // Go over each descriptor index
+                    std::vector<lsh::FeatureIndex>::const_iterator training_index = bucket->begin();
+                    std::vector<lsh::FeatureIndex>::const_iterator last_training_index = bucket->end();
+                    DistanceType hamming_distance;
+
+                    // Process the rest of the candidates
+                    for (; training_index < last_training_index; ++training_index) {
+                        // Compute the Hamming distance
+                        hamming_distance = distance_(vec, dataset_[*training_index], dataset_.cols);
+                        if (hamming_distance < radius) score_index_heap.push_back(ScoreIndexPair(hamming_distance, training_index));
+                    }
+                }
+            }
+        }
+    }
+
+    /** Performs the approximate nearest-neighbor search.
+     * This is a slower version than the above as it uses the ResultSet
+     * @param vec the feature to analyze
+     */
+    void getNeighbors(const ElementType* vec, ResultSet<DistanceType>& result)
+    {
+        typename std::vector<lsh::LshTable<ElementType> >::const_iterator table = tables_.begin();
+        typename std::vector<lsh::LshTable<ElementType> >::const_iterator table_end = tables_.end();
+        for (; table != table_end; ++table) {
+            size_t key = table->getKey(vec);
+            std::vector<lsh::BucketKey>::const_iterator xor_mask = xor_masks_.begin();
+            std::vector<lsh::BucketKey>::const_iterator xor_mask_end = xor_masks_.end();
+            for (; xor_mask != xor_mask_end; ++xor_mask) {
+                size_t sub_key = key ^ (*xor_mask);
+                const lsh::Bucket* bucket = table->getBucketFromKey((lsh::BucketKey)sub_key);
+                if (bucket == 0) continue;
+
+                // Go over each descriptor index
+                std::vector<lsh::FeatureIndex>::const_iterator training_index = bucket->begin();
+                std::vector<lsh::FeatureIndex>::const_iterator last_training_index = bucket->end();
+                DistanceType hamming_distance;
+
+                // Process the rest of the candidates
+                for (; training_index < last_training_index; ++training_index) {
+                    // Compute the Hamming distance
+                    hamming_distance = distance_(vec, dataset_[*training_index], (int)dataset_.cols);
+                    result.addPoint(hamming_distance, *training_index);
+                }
+            }
+        }
+    }
+
+    /** The different hash tables */
+    std::vector<lsh::LshTable<ElementType> > tables_;
+
+    /** The data the LSH tables where built from */
+    Matrix<ElementType> dataset_;
+
+    /** The size of the features (as ElementType[]) */
+    unsigned int feature_size_;
+
+    IndexParams index_params_;
+
+    /** table number */
+    unsigned int table_number_;
+    /** key size */
+    unsigned int key_size_;
+    /** How far should we look for neighbors in multi-probe LSH */
+    unsigned int multi_probe_level_;
+
+    /** The XOR masks to apply to a key to get the neighboring buckets */
+    std::vector<lsh::BucketKey> xor_masks_;
+
+    Distance distance_;
+};
+}
+
+#endif //OPENCV_FLANN_LSH_INDEX_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h
new file mode 100644
index 0000000..582dcdb
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/lsh_table.h
@@ -0,0 +1,492 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+/***********************************************************************
+ * Author: Vincent Rabaud
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_LSH_TABLE_H_
+#define OPENCV_FLANN_LSH_TABLE_H_
+
+#include <algorithm>
+#include <iostream>
+#include <iomanip>
+#include <limits.h>
+// TODO as soon as we use C++0x, use the code in USE_UNORDERED_MAP
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#  define USE_UNORDERED_MAP 1
+#else
+#  define USE_UNORDERED_MAP 0
+#endif
+#if USE_UNORDERED_MAP
+#include <unordered_map>
+#else
+#include <map>
+#endif
+#include <math.h>
+#include <stddef.h>
+
+#include "dynamic_bitset.h"
+#include "matrix.h"
+
+namespace cvflann
+{
+
+namespace lsh
+{
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** What is stored in an LSH bucket
+ */
+typedef uint32_t FeatureIndex;
+/** The id from which we can get a bucket back in an LSH table
+ */
+typedef unsigned int BucketKey;
+
+/** A bucket in an LSH table
+ */
+typedef std::vector<FeatureIndex> Bucket;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** POD for stats about an LSH table
+ */
+struct LshStats
+{
+    std::vector<unsigned int> bucket_sizes_;
+    size_t n_buckets_;
+    size_t bucket_size_mean_;
+    size_t bucket_size_median_;
+    size_t bucket_size_min_;
+    size_t bucket_size_max_;
+    size_t bucket_size_std_dev;
+    /** Each contained vector contains three value: beginning/end for interval, number of elements in the bin
+     */
+    std::vector<std::vector<unsigned int> > size_histogram_;
+};
+
+/** Overload the << operator for LshStats
+ * @param out the streams
+ * @param stats the stats to display
+ * @return the streams
+ */
+inline std::ostream& operator <<(std::ostream& out, const LshStats& stats)
+{
+    int w = 20;
+    out << "Lsh Table Stats:\n" << std::setw(w) << std::setiosflags(std::ios::right) << "N buckets : "
+    << stats.n_buckets_ << "\n" << std::setw(w) << std::setiosflags(std::ios::right) << "mean size : "
+    << std::setiosflags(std::ios::left) << stats.bucket_size_mean_ << "\n" << std::setw(w)
+    << std::setiosflags(std::ios::right) << "median size : " << stats.bucket_size_median_ << "\n" << std::setw(w)
+    << std::setiosflags(std::ios::right) << "min size : " << std::setiosflags(std::ios::left)
+    << stats.bucket_size_min_ << "\n" << std::setw(w) << std::setiosflags(std::ios::right) << "max size : "
+    << std::setiosflags(std::ios::left) << stats.bucket_size_max_;
+
+    // Display the histogram
+    out << std::endl << std::setw(w) << std::setiosflags(std::ios::right) << "histogram : "
+    << std::setiosflags(std::ios::left);
+    for (std::vector<std::vector<unsigned int> >::const_iterator iterator = stats.size_histogram_.begin(), end =
+             stats.size_histogram_.end(); iterator != end; ++iterator) out << (*iterator)[0] << "-" << (*iterator)[1] << ": " << (*iterator)[2] << ",  ";
+
+    return out;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Lsh hash table. As its key is a sub-feature, and as usually
+ * the size of it is pretty small, we keep it as a continuous memory array.
+ * The value is an index in the corpus of features (we keep it as an unsigned
+ * int for pure memory reasons, it could be a size_t)
+ */
+template<typename ElementType>
+class LshTable
+{
+public:
+    /** A container of all the feature indices. Optimized for space
+     */
+#if USE_UNORDERED_MAP
+    typedef std::unordered_map<BucketKey, Bucket> BucketsSpace;
+#else
+    typedef std::map<BucketKey, Bucket> BucketsSpace;
+#endif
+
+    /** A container of all the feature indices. Optimized for speed
+     */
+    typedef std::vector<Bucket> BucketsSpeed;
+
+    /** Default constructor
+     */
+    LshTable()
+    {
+    }
+
+    /** Default constructor
+     * Create the mask and allocate the memory
+     * @param feature_size is the size of the feature (considered as a ElementType[])
+     * @param key_size is the number of bits that are turned on in the feature
+     */
+    LshTable(unsigned int feature_size, unsigned int key_size)
+    {
+        (void)feature_size;
+        (void)key_size;
+        std::cerr << "LSH is not implemented for that type" << std::endl;
+        assert(0);
+    }
+
+    /** Add a feature to the table
+     * @param value the value to store for that feature
+     * @param feature the feature itself
+     */
+    void add(unsigned int value, const ElementType* feature)
+    {
+        // Add the value to the corresponding bucket
+        BucketKey key = (lsh::BucketKey)getKey(feature);
+
+        switch (speed_level_) {
+        case kArray:
+            // That means we get the buckets from an array
+            buckets_speed_[key].push_back(value);
+            break;
+        case kBitsetHash:
+            // That means we can check the bitset for the presence of a key
+            key_bitset_.set(key);
+            buckets_space_[key].push_back(value);
+            break;
+        case kHash:
+        {
+            // That means we have to check for the hash table for the presence of a key
+            buckets_space_[key].push_back(value);
+            break;
+        }
+        }
+    }
+
+    /** Add a set of features to the table
+     * @param dataset the values to store
+     */
+    void add(Matrix<ElementType> dataset)
+    {
+#if USE_UNORDERED_MAP
+        buckets_space_.rehash((buckets_space_.size() + dataset.rows) * 1.2);
+#endif
+        // Add the features to the table
+        for (unsigned int i = 0; i < dataset.rows; ++i) add(i, dataset[i]);
+        // Now that the table is full, optimize it for speed/space
+        optimize();
+    }
+
+    /** Get a bucket given the key
+     * @param key
+     * @return
+     */
+    inline const Bucket* getBucketFromKey(BucketKey key) const
+    {
+        // Generate other buckets
+        switch (speed_level_) {
+        case kArray:
+            // That means we get the buckets from an array
+            return &buckets_speed_[key];
+            break;
+        case kBitsetHash:
+            // That means we can check the bitset for the presence of a key
+            if (key_bitset_.test(key)) return &buckets_space_.find(key)->second;
+            else return 0;
+            break;
+        case kHash:
+        {
+            // That means we have to check for the hash table for the presence of a key
+            BucketsSpace::const_iterator bucket_it, bucket_end = buckets_space_.end();
+            bucket_it = buckets_space_.find(key);
+            // Stop here if that bucket does not exist
+            if (bucket_it == bucket_end) return 0;
+            else return &bucket_it->second;
+            break;
+        }
+        }
+        return 0;
+    }
+
+    /** Compute the sub-signature of a feature
+     */
+    size_t getKey(const ElementType* /*feature*/) const
+    {
+        std::cerr << "LSH is not implemented for that type" << std::endl;
+        assert(0);
+        return 1;
+    }
+
+    /** Get statistics about the table
+     * @return
+     */
+    LshStats getStats() const;
+
+private:
+    /** defines the speed fo the implementation
+     * kArray uses a vector for storing data
+     * kBitsetHash uses a hash map but checks for the validity of a key with a bitset
+     * kHash uses a hash map only
+     */
+    enum SpeedLevel
+    {
+        kArray, kBitsetHash, kHash
+    };
+
+    /** Initialize some variables
+     */
+    void initialize(size_t key_size)
+    {
+        const size_t key_size_lower_bound = 1;
+        //a value (size_t(1) << key_size) must fit the size_t type so key_size has to be strictly less than size of size_t
+        const size_t key_size_upper_bound = std::min(sizeof(BucketKey) * CHAR_BIT + 1, sizeof(size_t) * CHAR_BIT);
+        if (key_size < key_size_lower_bound || key_size >= key_size_upper_bound)
+        {
+            CV_Error(cv::Error::StsBadArg, cv::format("Invalid key_size (=%d). Valid values for your system are %d <= key_size < %d.", (int)key_size, (int)key_size_lower_bound, (int)key_size_upper_bound));
+        }
+
+        speed_level_ = kHash;
+        key_size_ = (unsigned)key_size;
+    }
+
+    /** Optimize the table for speed/space
+     */
+    void optimize()
+    {
+        // If we are already using the fast storage, no need to do anything
+        if (speed_level_ == kArray) return;
+
+        // Use an array if it will be more than half full
+        if (buckets_space_.size() > ((size_t(1) << key_size_) / 2)) {
+            speed_level_ = kArray;
+            // Fill the array version of it
+            buckets_speed_.resize(size_t(1) << key_size_);
+            for (BucketsSpace::const_iterator key_bucket = buckets_space_.begin(); key_bucket != buckets_space_.end(); ++key_bucket) buckets_speed_[key_bucket->first] = key_bucket->second;
+
+            // Empty the hash table
+            buckets_space_.clear();
+            return;
+        }
+
+        // If the bitset is going to use less than 10% of the RAM of the hash map (at least 1 size_t for the key and two
+        // for the vector) or less than 512MB (key_size_ <= 30)
+        if (((std::max(buckets_space_.size(), buckets_speed_.size()) * CHAR_BIT * 3 * sizeof(BucketKey)) / 10
+             >= (size_t(1) << key_size_)) || (key_size_ <= 32)) {
+            speed_level_ = kBitsetHash;
+            key_bitset_.resize(size_t(1) << key_size_);
+            key_bitset_.reset();
+            // Try with the BucketsSpace
+            for (BucketsSpace::const_iterator key_bucket = buckets_space_.begin(); key_bucket != buckets_space_.end(); ++key_bucket) key_bitset_.set(key_bucket->first);
+        }
+        else {
+            speed_level_ = kHash;
+            key_bitset_.clear();
+        }
+    }
+
+    /** The vector of all the buckets if they are held for speed
+     */
+    BucketsSpeed buckets_speed_;
+
+    /** The hash table of all the buckets in case we cannot use the speed version
+     */
+    BucketsSpace buckets_space_;
+
+    /** What is used to store the data */
+    SpeedLevel speed_level_;
+
+    /** If the subkey is small enough, it will keep track of which subkeys are set through that bitset
+     * That is just a speedup so that we don't look in the hash table (which can be mush slower that checking a bitset)
+     */
+    DynamicBitset key_bitset_;
+
+    /** The size of the sub-signature in bits
+     */
+    unsigned int key_size_;
+
+    // Members only used for the unsigned char specialization
+    /** The mask to apply to a feature to get the hash key
+     * Only used in the unsigned char case
+     */
+    std::vector<size_t> mask_;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Specialization for unsigned char
+
+template<>
+inline LshTable<unsigned char>::LshTable(unsigned int feature_size, unsigned int subsignature_size)
+{
+    initialize(subsignature_size);
+    // Allocate the mask
+    mask_ = std::vector<size_t>((size_t)ceil((float)(feature_size * sizeof(char)) / (float)sizeof(size_t)), 0);
+
+    // A bit brutal but fast to code
+    std::vector<size_t> indices(feature_size * CHAR_BIT);
+    for (size_t i = 0; i < feature_size * CHAR_BIT; ++i) indices[i] = i;
+    std::random_shuffle(indices.begin(), indices.end());
+
+    // Generate a random set of order of subsignature_size_ bits
+    for (unsigned int i = 0; i < key_size_; ++i) {
+        size_t index = indices[i];
+
+        // Set that bit in the mask
+        size_t divisor = CHAR_BIT * sizeof(size_t);
+        size_t idx = index / divisor; //pick the right size_t index
+        mask_[idx] |= size_t(1) << (index % divisor); //use modulo to find the bit offset
+    }
+
+    // Set to 1 if you want to display the mask for debug
+#if 0
+    {
+        size_t bcount = 0;
+        BOOST_FOREACH(size_t mask_block, mask_){
+            out << std::setw(sizeof(size_t) * CHAR_BIT / 4) << std::setfill('0') << std::hex << mask_block
+                << std::endl;
+            bcount += __builtin_popcountll(mask_block);
+        }
+        out << "bit count : " << std::dec << bcount << std::endl;
+        out << "mask size : " << mask_.size() << std::endl;
+        return out;
+    }
+#endif
+}
+
+/** Return the Subsignature of a feature
+ * @param feature the feature to analyze
+ */
+template<>
+inline size_t LshTable<unsigned char>::getKey(const unsigned char* feature) const
+{
+    // no need to check if T is dividable by sizeof(size_t) like in the Hamming
+    // distance computation as we have a mask
+    const size_t* feature_block_ptr = reinterpret_cast<const size_t*> ((const void*)feature);
+
+    // Figure out the subsignature of the feature
+    // Given the feature ABCDEF, and the mask 001011, the output will be
+    // 000CEF
+    size_t subsignature = 0;
+    size_t bit_index = 1;
+
+    for (std::vector<size_t>::const_iterator pmask_block = mask_.begin(); pmask_block != mask_.end(); ++pmask_block) {
+        // get the mask and signature blocks
+        size_t feature_block = *feature_block_ptr;
+        size_t mask_block = *pmask_block;
+        while (mask_block) {
+            // Get the lowest set bit in the mask block
+            size_t lowest_bit = mask_block & (-(ptrdiff_t)mask_block);
+            // Add it to the current subsignature if necessary
+            subsignature += (feature_block & lowest_bit) ? bit_index : 0;
+            // Reset the bit in the mask block
+            mask_block ^= lowest_bit;
+            // increment the bit index for the subsignature
+            bit_index <<= 1;
+        }
+        // Check the next feature block
+        ++feature_block_ptr;
+    }
+    return subsignature;
+}
+
+template<>
+inline LshStats LshTable<unsigned char>::getStats() const
+{
+    LshStats stats;
+    stats.bucket_size_mean_ = 0;
+    if ((buckets_speed_.empty()) && (buckets_space_.empty())) {
+        stats.n_buckets_ = 0;
+        stats.bucket_size_median_ = 0;
+        stats.bucket_size_min_ = 0;
+        stats.bucket_size_max_ = 0;
+        return stats;
+    }
+
+    if (!buckets_speed_.empty()) {
+        for (BucketsSpeed::const_iterator pbucket = buckets_speed_.begin(); pbucket != buckets_speed_.end(); ++pbucket) {
+            stats.bucket_sizes_.push_back((lsh::FeatureIndex)pbucket->size());
+            stats.bucket_size_mean_ += pbucket->size();
+        }
+        stats.bucket_size_mean_ /= buckets_speed_.size();
+        stats.n_buckets_ = buckets_speed_.size();
+    }
+    else {
+        for (BucketsSpace::const_iterator x = buckets_space_.begin(); x != buckets_space_.end(); ++x) {
+            stats.bucket_sizes_.push_back((lsh::FeatureIndex)x->second.size());
+            stats.bucket_size_mean_ += x->second.size();
+        }
+        stats.bucket_size_mean_ /= buckets_space_.size();
+        stats.n_buckets_ = buckets_space_.size();
+    }
+
+    std::sort(stats.bucket_sizes_.begin(), stats.bucket_sizes_.end());
+
+    //  BOOST_FOREACH(int size, stats.bucket_sizes_)
+    //          std::cout << size << " ";
+    //  std::cout << std::endl;
+    stats.bucket_size_median_ = stats.bucket_sizes_[stats.bucket_sizes_.size() / 2];
+    stats.bucket_size_min_ = stats.bucket_sizes_.front();
+    stats.bucket_size_max_ = stats.bucket_sizes_.back();
+
+    // TODO compute mean and std
+    /*float mean, stddev;
+       stats.bucket_size_mean_ = mean;
+       stats.bucket_size_std_dev = stddev;*/
+
+    // Include a histogram of the buckets
+    unsigned int bin_start = 0;
+    unsigned int bin_end = 20;
+    bool is_new_bin = true;
+    for (std::vector<unsigned int>::iterator iterator = stats.bucket_sizes_.begin(), end = stats.bucket_sizes_.end(); iterator
+         != end; )
+        if (*iterator < bin_end) {
+            if (is_new_bin) {
+                stats.size_histogram_.push_back(std::vector<unsigned int>(3, 0));
+                stats.size_histogram_.back()[0] = bin_start;
+                stats.size_histogram_.back()[1] = bin_end - 1;
+                is_new_bin = false;
+            }
+            ++stats.size_histogram_.back()[2];
+            ++iterator;
+        }
+        else {
+            bin_start += 20;
+            bin_end += 20;
+            is_new_bin = true;
+        }
+
+    return stats;
+}
+
+// End the two namespaces
+}
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif /* OPENCV_FLANN_LSH_TABLE_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h
new file mode 100644
index 0000000..51b6c63
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/matrix.h
@@ -0,0 +1,116 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_DATASET_H_
+#define OPENCV_FLANN_DATASET_H_
+
+#include <stdio.h>
+
+#include "general.h"
+
+namespace cvflann
+{
+
+/**
+ * Class that implements a simple rectangular matrix stored in a memory buffer and
+ * provides convenient matrix-like access using the [] operators.
+ */
+template <typename T>
+class Matrix
+{
+public:
+    typedef T type;
+
+    size_t rows;
+    size_t cols;
+    size_t stride;
+    T* data;
+
+    Matrix() : rows(0), cols(0), stride(0), data(NULL)
+    {
+    }
+
+    Matrix(T* data_, size_t rows_, size_t cols_, size_t stride_ = 0) :
+        rows(rows_), cols(cols_),  stride(stride_), data(data_)
+    {
+        if (stride==0) stride = cols;
+    }
+
+    /**
+     * Convenience function for deallocating the storage data.
+     */
+    FLANN_DEPRECATED void free()
+    {
+        fprintf(stderr, "The cvflann::Matrix<T>::free() method is deprecated "
+                "and it does not do any memory deallocation any more.  You are"
+                "responsible for deallocating the matrix memory (by doing"
+                "'delete[] matrix.data' for example)");
+    }
+
+    /**
+     * Operator that return a (pointer to a) row of the data.
+     */
+    T* operator[](size_t index) const
+    {
+        return data+index*stride;
+    }
+};
+
+
+class UntypedMatrix
+{
+public:
+    size_t rows;
+    size_t cols;
+    void* data;
+    flann_datatype_t type;
+
+    UntypedMatrix(void* data_, long rows_, long cols_) :
+        rows(rows_), cols(cols_), data(data_)
+    {
+    }
+
+    ~UntypedMatrix()
+    {
+    }
+
+
+    template<typename T>
+    Matrix<T> as()
+    {
+        return Matrix<T>((T*)data, rows, cols);
+    }
+};
+
+
+
+}
+
+#endif //OPENCV_FLANN_DATASET_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp
new file mode 100644
index 0000000..02fa236
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/miniflann.hpp
@@ -0,0 +1,158 @@
+/*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*/
+
+#ifndef _OPENCV_MINIFLANN_HPP_
+#define _OPENCV_MINIFLANN_HPP_
+
+#include "opencv2/core.hpp"
+#include "opencv2/flann/defines.h"
+
+namespace cv
+{
+
+namespace flann
+{
+
+struct CV_EXPORTS IndexParams
+{
+    IndexParams();
+    ~IndexParams();
+
+    String getString(const String& key, const String& defaultVal=String()) const;
+    int getInt(const String& key, int defaultVal=-1) const;
+    double getDouble(const String& key, double defaultVal=-1) const;
+
+    void setString(const String& key, const String& value);
+    void setInt(const String& key, int value);
+    void setDouble(const String& key, double value);
+    void setFloat(const String& key, float value);
+    void setBool(const String& key, bool value);
+    void setAlgorithm(int value);
+
+    void getAll(std::vector<String>& names,
+                std::vector<int>& types,
+                std::vector<String>& strValues,
+                std::vector<double>& numValues) const;
+
+    void* params;
+};
+
+struct CV_EXPORTS KDTreeIndexParams : public IndexParams
+{
+    KDTreeIndexParams(int trees=4);
+};
+
+struct CV_EXPORTS LinearIndexParams : public IndexParams
+{
+    LinearIndexParams();
+};
+
+struct CV_EXPORTS CompositeIndexParams : public IndexParams
+{
+    CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11,
+                         cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2f );
+};
+
+struct CV_EXPORTS AutotunedIndexParams : public IndexParams
+{
+    AutotunedIndexParams(float target_precision = 0.8f, float build_weight = 0.01f,
+                         float memory_weight = 0, float sample_fraction = 0.1f);
+};
+
+struct CV_EXPORTS HierarchicalClusteringIndexParams : public IndexParams
+{
+    HierarchicalClusteringIndexParams(int branching = 32,
+                      cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, int trees = 4, int leaf_size = 100 );
+};
+
+struct CV_EXPORTS KMeansIndexParams : public IndexParams
+{
+    KMeansIndexParams(int branching = 32, int iterations = 11,
+                      cvflann::flann_centers_init_t centers_init = cvflann::FLANN_CENTERS_RANDOM, float cb_index = 0.2f );
+};
+
+struct CV_EXPORTS LshIndexParams : public IndexParams
+{
+    LshIndexParams(int table_number, int key_size, int multi_probe_level);
+};
+
+struct CV_EXPORTS SavedIndexParams : public IndexParams
+{
+    SavedIndexParams(const String& filename);
+};
+
+struct CV_EXPORTS SearchParams : public IndexParams
+{
+    SearchParams( int checks = 32, float eps = 0, bool sorted = true );
+};
+
+class CV_EXPORTS_W Index
+{
+public:
+    CV_WRAP Index();
+    CV_WRAP Index(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2);
+    virtual ~Index();
+
+    CV_WRAP virtual void build(InputArray features, const IndexParams& params, cvflann::flann_distance_t distType=cvflann::FLANN_DIST_L2);
+    CV_WRAP virtual void knnSearch(InputArray query, OutputArray indices,
+                   OutputArray dists, int knn, const SearchParams& params=SearchParams());
+
+    CV_WRAP virtual int radiusSearch(InputArray query, OutputArray indices,
+                             OutputArray dists, double radius, int maxResults,
+                             const SearchParams& params=SearchParams());
+
+    CV_WRAP virtual void save(const String& filename) const;
+    CV_WRAP virtual bool load(InputArray features, const String& filename);
+    CV_WRAP virtual void release();
+    CV_WRAP cvflann::flann_distance_t getDistance() const;
+    CV_WRAP cvflann::flann_algorithm_t getAlgorithm() const;
+
+protected:
+    cvflann::flann_distance_t distType;
+    cvflann::flann_algorithm_t algo;
+    int featureType;
+    void* index;
+};
+
+} } // namespace cv::flann
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h
new file mode 100644
index 0000000..381d4bc
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/nn_index.h
@@ -0,0 +1,177 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_NNINDEX_H
+#define OPENCV_FLANN_NNINDEX_H
+
+#include "general.h"
+#include "matrix.h"
+#include "result_set.h"
+#include "params.h"
+
+namespace cvflann
+{
+
+/**
+ * Nearest-neighbour index base class
+ */
+template <typename Distance>
+class NNIndex
+{
+    typedef typename Distance::ElementType ElementType;
+    typedef typename Distance::ResultType DistanceType;
+
+public:
+
+    virtual ~NNIndex() {}
+
+    /**
+     * \brief Builds the index
+     */
+    virtual void buildIndex() = 0;
+
+    /**
+     * \brief Perform k-nearest neighbor search
+     * \param[in] queries The query points for which to find the nearest neighbors
+     * \param[out] indices The indices of the nearest neighbors found
+     * \param[out] dists Distances to the nearest neighbors found
+     * \param[in] knn Number of nearest neighbors to return
+     * \param[in] params Search parameters
+     */
+    virtual void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
+    {
+        assert(queries.cols == veclen());
+        assert(indices.rows >= queries.rows);
+        assert(dists.rows >= queries.rows);
+        assert(int(indices.cols) >= knn);
+        assert(int(dists.cols) >= knn);
+
+#if 0
+        KNNResultSet<DistanceType> resultSet(knn);
+        for (size_t i = 0; i < queries.rows; i++) {
+            resultSet.init(indices[i], dists[i]);
+            findNeighbors(resultSet, queries[i], params);
+        }
+#else
+        KNNUniqueResultSet<DistanceType> resultSet(knn);
+        for (size_t i = 0; i < queries.rows; i++) {
+            resultSet.clear();
+            findNeighbors(resultSet, queries[i], params);
+            if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices[i], dists[i], knn);
+            else resultSet.copy(indices[i], dists[i], knn);
+        }
+#endif
+    }
+
+    /**
+     * \brief Perform radius search
+     * \param[in] query The query point
+     * \param[out] indices The indinces of the neighbors found within the given radius
+     * \param[out] dists The distances to the nearest neighbors found
+     * \param[in] radius The radius used for search
+     * \param[in] params Search parameters
+     * \returns Number of neighbors found
+     */
+    virtual int radiusSearch(const Matrix<ElementType>& query, Matrix<int>& indices, Matrix<DistanceType>& dists, float radius, const SearchParams& params)
+    {
+        if (query.rows != 1) {
+            fprintf(stderr, "I can only search one feature at a time for range search\n");
+            return -1;
+        }
+        assert(query.cols == veclen());
+        assert(indices.cols == dists.cols);
+
+        int n = 0;
+        int* indices_ptr = NULL;
+        DistanceType* dists_ptr = NULL;
+        if (indices.cols > 0) {
+            n = (int)indices.cols;
+            indices_ptr = indices[0];
+            dists_ptr = dists[0];
+        }
+
+        RadiusUniqueResultSet<DistanceType> resultSet((DistanceType)radius);
+        resultSet.clear();
+        findNeighbors(resultSet, query[0], params);
+        if (n>0) {
+            if (get_param(params,"sorted",true)) resultSet.sortAndCopy(indices_ptr, dists_ptr, n);
+            else resultSet.copy(indices_ptr, dists_ptr, n);
+        }
+
+        return (int)resultSet.size();
+    }
+
+    /**
+     * \brief Saves the index to a stream
+     * \param stream The stream to save the index to
+     */
+    virtual void saveIndex(FILE* stream) = 0;
+
+    /**
+     * \brief Loads the index from a stream
+     * \param stream The stream from which the index is loaded
+     */
+    virtual void loadIndex(FILE* stream) = 0;
+
+    /**
+     * \returns number of features in this index.
+     */
+    virtual size_t size() const = 0;
+
+    /**
+     * \returns The dimensionality of the features in this index.
+     */
+    virtual size_t veclen() const = 0;
+
+    /**
+     * \returns The amount of memory (in bytes) used by the index.
+     */
+    virtual int usedMemory() const = 0;
+
+    /**
+     * \returns The index type (kdtree, kmeans,...)
+     */
+    virtual flann_algorithm_t getType() const = 0;
+
+    /**
+     * \returns The index parameters
+     */
+    virtual IndexParams getParameters() const = 0;
+
+
+    /**
+     * \brief Method that searches for nearest-neighbours
+     */
+    virtual void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) = 0;
+};
+
+}
+
+#endif //OPENCV_FLANN_NNINDEX_H
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h
new file mode 100644
index 0000000..7f971c5
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/object_factory.h
@@ -0,0 +1,91 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_OBJECT_FACTORY_H_
+#define OPENCV_FLANN_OBJECT_FACTORY_H_
+
+#include <map>
+
+namespace cvflann
+{
+
+class CreatorNotFound
+{
+};
+
+template<typename BaseClass,
+         typename UniqueIdType,
+         typename ObjectCreator = BaseClass* (*)()>
+class ObjectFactory
+{
+    typedef ObjectFactory<BaseClass,UniqueIdType,ObjectCreator> ThisClass;
+    typedef std::map<UniqueIdType, ObjectCreator> ObjectRegistry;
+
+    // singleton class, private constructor
+    ObjectFactory() {}
+
+public:
+
+    bool subscribe(UniqueIdType id, ObjectCreator creator)
+    {
+        if (object_registry.find(id) != object_registry.end()) return false;
+
+        object_registry[id] = creator;
+        return true;
+    }
+
+    bool unregister(UniqueIdType id)
+    {
+        return object_registry.erase(id) == 1;
+    }
+
+    ObjectCreator create(UniqueIdType id)
+    {
+        typename ObjectRegistry::const_iterator iter = object_registry.find(id);
+
+        if (iter == object_registry.end()) {
+            throw CreatorNotFound();
+        }
+
+        return iter->second;
+    }
+
+    static ThisClass& instance()
+    {
+        static ThisClass the_factory;
+        return the_factory;
+    }
+private:
+    ObjectRegistry object_registry;
+};
+
+}
+
+#endif /* OPENCV_FLANN_OBJECT_FACTORY_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/params.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/params.h
new file mode 100644
index 0000000..95ef4cd
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/params.h
@@ -0,0 +1,99 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2011  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2011  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_PARAMS_H_
+#define OPENCV_FLANN_PARAMS_H_
+
+#include "any.h"
+#include "general.h"
+#include <iostream>
+#include <map>
+
+
+namespace cvflann
+{
+
+typedef std::map<cv::String, any> IndexParams;
+
+struct SearchParams : public IndexParams
+{
+    SearchParams(int checks = 32, float eps = 0, bool sorted = true )
+    {
+        // how many leafs to visit when searching for neighbours (-1 for unlimited)
+        (*this)["checks"] = checks;
+        // search for eps-approximate neighbours (default: 0)
+        (*this)["eps"] = eps;
+        // only for radius search, require neighbours sorted by distance (default: true)
+        (*this)["sorted"] = sorted;
+    }
+};
+
+
+template<typename T>
+T get_param(const IndexParams& params, cv::String name, const T& default_value)
+{
+    IndexParams::const_iterator it = params.find(name);
+    if (it != params.end()) {
+        return it->second.cast<T>();
+    }
+    else {
+        return default_value;
+    }
+}
+
+template<typename T>
+T get_param(const IndexParams& params, cv::String name)
+{
+    IndexParams::const_iterator it = params.find(name);
+    if (it != params.end()) {
+        return it->second.cast<T>();
+    }
+    else {
+        throw FLANNException(cv::String("Missing parameter '")+name+cv::String("' in the parameters given"));
+    }
+}
+
+inline void print_params(const IndexParams& params, std::ostream& stream)
+{
+    IndexParams::const_iterator it;
+
+    for(it=params.begin(); it!=params.end(); ++it) {
+        stream << it->first << " : " << it->second << std::endl;
+    }
+}
+
+inline void print_params(const IndexParams& params)
+{
+    print_params(params, std::cout);
+}
+
+}
+
+
+#endif /* OPENCV_FLANN_PARAMS_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/random.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/random.h
new file mode 100644
index 0000000..a3cf5ec
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/random.h
@@ -0,0 +1,133 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_RANDOM_H
+#define OPENCV_FLANN_RANDOM_H
+
+#include <algorithm>
+#include <cstdlib>
+#include <vector>
+
+#include "general.h"
+
+namespace cvflann
+{
+
+/**
+ * Seeds the random number generator
+ *  @param seed Random seed
+ */
+inline void seed_random(unsigned int seed)
+{
+    srand(seed);
+}
+
+/*
+ * Generates a random double value.
+ */
+/**
+ * Generates a random double value.
+ * @param high Upper limit
+ * @param low Lower limit
+ * @return Random double value
+ */
+inline double rand_double(double high = 1.0, double low = 0)
+{
+    return low + ((high-low) * (std::rand() / (RAND_MAX + 1.0)));
+}
+
+/**
+ * Generates a random integer value.
+ * @param high Upper limit
+ * @param low Lower limit
+ * @return Random integer value
+ */
+inline int rand_int(int high = RAND_MAX, int low = 0)
+{
+    return low + (int) ( double(high-low) * (std::rand() / (RAND_MAX + 1.0)));
+}
+
+/**
+ * Random number generator that returns a distinct number from
+ * the [0,n) interval each time.
+ */
+class UniqueRandom
+{
+    std::vector<int> vals_;
+    int size_;
+    int counter_;
+
+public:
+    /**
+     * Constructor.
+     * @param n Size of the interval from which to generate
+     * @return
+     */
+    UniqueRandom(int n)
+    {
+        init(n);
+    }
+
+    /**
+     * Initializes the number generator.
+     * @param n the size of the interval from which to generate random numbers.
+     */
+    void init(int n)
+    {
+        // create and initialize an array of size n
+        vals_.resize(n);
+        size_ = n;
+        for (int i = 0; i < size_; ++i) vals_[i] = i;
+
+        // shuffle the elements in the array
+        std::random_shuffle(vals_.begin(), vals_.end());
+
+        counter_ = 0;
+    }
+
+    /**
+     * Return a distinct random integer in greater or equal to 0 and less
+     * than 'n' on each call. It should be called maximum 'n' times.
+     * Returns: a random integer
+     */
+    int next()
+    {
+        if (counter_ == size_) {
+            return -1;
+        }
+        else {
+            return vals_[counter_++];
+        }
+    }
+};
+
+}
+
+#endif //OPENCV_FLANN_RANDOM_H
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h
new file mode 100644
index 0000000..9750019
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/result_set.h
@@ -0,0 +1,543 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_RESULTSET_H
+#define OPENCV_FLANN_RESULTSET_H
+
+#include <algorithm>
+#include <cstring>
+#include <iostream>
+#include <limits>
+#include <set>
+#include <vector>
+
+namespace cvflann
+{
+
+/* This record represents a branch point when finding neighbors in
+    the tree.  It contains a record of the minimum distance to the query
+    point, as well as the node at which the search resumes.
+ */
+
+template <typename T, typename DistanceType>
+struct BranchStruct
+{
+    T node;           /* Tree node at which search resumes */
+    DistanceType mindist;     /* Minimum distance to query for all nodes below. */
+
+    BranchStruct() {}
+    BranchStruct(const T& aNode, DistanceType dist) : node(aNode), mindist(dist) {}
+
+    bool operator<(const BranchStruct<T, DistanceType>& rhs) const
+    {
+        return mindist<rhs.mindist;
+    }
+};
+
+
+template <typename DistanceType>
+class ResultSet
+{
+public:
+    virtual ~ResultSet() {}
+
+    virtual bool full() const = 0;
+
+    virtual void addPoint(DistanceType dist, int index) = 0;
+
+    virtual DistanceType worstDist() const = 0;
+
+};
+
+/**
+ * KNNSimpleResultSet does not ensure that the element it holds are unique.
+ * Is used in those cases where the nearest neighbour algorithm used does not
+ * attempt to insert the same element multiple times.
+ */
+template <typename DistanceType>
+class KNNSimpleResultSet : public ResultSet<DistanceType>
+{
+    int* indices;
+    DistanceType* dists;
+    int capacity;
+    int count;
+    DistanceType worst_distance_;
+
+public:
+    KNNSimpleResultSet(int capacity_) : capacity(capacity_), count(0)
+    {
+    }
+
+    void init(int* indices_, DistanceType* dists_)
+    {
+        indices = indices_;
+        dists = dists_;
+        count = 0;
+        worst_distance_ = (std::numeric_limits<DistanceType>::max)();
+        dists[capacity-1] = worst_distance_;
+    }
+
+    size_t size() const
+    {
+        return count;
+    }
+
+    bool full() const
+    {
+        return count == capacity;
+    }
+
+
+    void addPoint(DistanceType dist, int index)
+    {
+        if (dist >= worst_distance_) return;
+        int i;
+        for (i=count; i>0; --i) {
+#ifdef FLANN_FIRST_MATCH
+            if ( (dists[i-1]>dist) || ((dist==dists[i-1])&&(indices[i-1]>index)) )
+#else
+            if (dists[i-1]>dist)
+#endif
+            {
+                if (i<capacity) {
+                    dists[i] = dists[i-1];
+                    indices[i] = indices[i-1];
+                }
+            }
+            else break;
+        }
+        if (count < capacity) ++count;
+        dists[i] = dist;
+        indices[i] = index;
+        worst_distance_ = dists[capacity-1];
+    }
+
+    DistanceType worstDist() const
+    {
+        return worst_distance_;
+    }
+};
+
+/**
+ * K-Nearest neighbour result set. Ensures that the elements inserted are unique
+ */
+template <typename DistanceType>
+class KNNResultSet : public ResultSet<DistanceType>
+{
+    int* indices;
+    DistanceType* dists;
+    int capacity;
+    int count;
+    DistanceType worst_distance_;
+
+public:
+    KNNResultSet(int capacity_) : capacity(capacity_), count(0)
+    {
+    }
+
+    void init(int* indices_, DistanceType* dists_)
+    {
+        indices = indices_;
+        dists = dists_;
+        count = 0;
+        worst_distance_ = (std::numeric_limits<DistanceType>::max)();
+        dists[capacity-1] = worst_distance_;
+    }
+
+    size_t size() const
+    {
+        return count;
+    }
+
+    bool full() const
+    {
+        return count == capacity;
+    }
+
+
+    void addPoint(DistanceType dist, int index)
+    {
+        if (dist >= worst_distance_) return;
+        int i;
+        for (i = count; i > 0; --i) {
+#ifdef FLANN_FIRST_MATCH
+            if ( (dists[i-1]<=dist) && ((dist!=dists[i-1])||(indices[i-1]<=index)) )
+#else
+            if (dists[i-1]<=dist)
+#endif
+            {
+                // Check for duplicate indices
+                int j = i - 1;
+                while ((j >= 0) && (dists[j] == dist)) {
+                    if (indices[j] == index) {
+                        return;
+                    }
+                    --j;
+                }
+                break;
+            }
+        }
+
+        if (count < capacity) ++count;
+        for (int j = count-1; j > i; --j) {
+            dists[j] = dists[j-1];
+            indices[j] = indices[j-1];
+        }
+        dists[i] = dist;
+        indices[i] = index;
+        worst_distance_ = dists[capacity-1];
+    }
+
+    DistanceType worstDist() const
+    {
+        return worst_distance_;
+    }
+};
+
+
+/**
+ * A result-set class used when performing a radius based search.
+ */
+template <typename DistanceType>
+class RadiusResultSet : public ResultSet<DistanceType>
+{
+    DistanceType radius;
+    int* indices;
+    DistanceType* dists;
+    size_t capacity;
+    size_t count;
+
+public:
+    RadiusResultSet(DistanceType radius_, int* indices_, DistanceType* dists_, int capacity_) :
+        radius(radius_), indices(indices_), dists(dists_), capacity(capacity_)
+    {
+        init();
+    }
+
+    ~RadiusResultSet()
+    {
+    }
+
+    void init()
+    {
+        count = 0;
+    }
+
+    size_t size() const
+    {
+        return count;
+    }
+
+    bool full() const
+    {
+        return true;
+    }
+
+    void addPoint(DistanceType dist, int index)
+    {
+        if (dist<radius) {
+            if ((capacity>0)&&(count < capacity)) {
+                dists[count] = dist;
+                indices[count] = index;
+            }
+            count++;
+        }
+    }
+
+    DistanceType worstDist() const
+    {
+        return radius;
+    }
+
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Class that holds the k NN neighbors
+ * Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays
+ */
+template<typename DistanceType>
+class UniqueResultSet : public ResultSet<DistanceType>
+{
+public:
+    struct DistIndex
+    {
+        DistIndex(DistanceType dist, unsigned int index) :
+            dist_(dist), index_(index)
+        {
+        }
+        bool operator<(const DistIndex dist_index) const
+        {
+            return (dist_ < dist_index.dist_) || ((dist_ == dist_index.dist_) && index_ < dist_index.index_);
+        }
+        DistanceType dist_;
+        unsigned int index_;
+    };
+
+    /** Default cosntructor */
+    UniqueResultSet() :
+        worst_distance_(std::numeric_limits<DistanceType>::max())
+    {
+    }
+
+    /** Check the status of the set
+     * @return true if we have k NN
+     */
+    inline bool full() const
+    {
+        return is_full_;
+    }
+
+    /** Remove all elements in the set
+     */
+    virtual void clear() = 0;
+
+    /** Copy the set to two C arrays
+     * @param indices pointer to a C array of indices
+     * @param dist pointer to a C array of distances
+     * @param n_neighbors the number of neighbors to copy
+     */
+    virtual void copy(int* indices, DistanceType* dist, int n_neighbors = -1) const
+    {
+        if (n_neighbors < 0) {
+            for (typename std::set<DistIndex>::const_iterator dist_index = dist_indices_.begin(), dist_index_end =
+                     dist_indices_.end(); dist_index != dist_index_end; ++dist_index, ++indices, ++dist) {
+                *indices = dist_index->index_;
+                *dist = dist_index->dist_;
+            }
+        }
+        else {
+            int i = 0;
+            for (typename std::set<DistIndex>::const_iterator dist_index = dist_indices_.begin(), dist_index_end =
+                     dist_indices_.end(); (dist_index != dist_index_end) && (i < n_neighbors); ++dist_index, ++indices, ++dist, ++i) {
+                *indices = dist_index->index_;
+                *dist = dist_index->dist_;
+            }
+        }
+    }
+
+    /** Copy the set to two C arrays but sort it according to the distance first
+     * @param indices pointer to a C array of indices
+     * @param dist pointer to a C array of distances
+     * @param n_neighbors the number of neighbors to copy
+     */
+    virtual void sortAndCopy(int* indices, DistanceType* dist, int n_neighbors = -1) const
+    {
+        copy(indices, dist, n_neighbors);
+    }
+
+    /** The number of neighbors in the set
+     * @return
+     */
+    size_t size() const
+    {
+        return dist_indices_.size();
+    }
+
+    /** The distance of the furthest neighbor
+     * If we don't have enough neighbors, it returns the max possible value
+     * @return
+     */
+    inline DistanceType worstDist() const
+    {
+        return worst_distance_;
+    }
+protected:
+    /** Flag to say if the set is full */
+    bool is_full_;
+
+    /** The worst distance found so far */
+    DistanceType worst_distance_;
+
+    /** The best candidates so far */
+    std::set<DistIndex> dist_indices_;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Class that holds the k NN neighbors
+ * Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays
+ */
+template<typename DistanceType>
+class KNNUniqueResultSet : public UniqueResultSet<DistanceType>
+{
+public:
+    /** Constructor
+     * @param capacity the number of neighbors to store at max
+     */
+    KNNUniqueResultSet(unsigned int capacity) : capacity_(capacity)
+    {
+        this->is_full_ = false;
+        this->clear();
+    }
+
+    /** Add a possible candidate to the best neighbors
+     * @param dist distance for that neighbor
+     * @param index index of that neighbor
+     */
+    inline void addPoint(DistanceType dist, int index)
+    {
+        // Don't do anything if we are worse than the worst
+        if (dist >= worst_distance_) return;
+        dist_indices_.insert(DistIndex(dist, index));
+
+        if (is_full_) {
+            if (dist_indices_.size() > capacity_) {
+                dist_indices_.erase(*dist_indices_.rbegin());
+                worst_distance_ = dist_indices_.rbegin()->dist_;
+            }
+        }
+        else if (dist_indices_.size() == capacity_) {
+            is_full_ = true;
+            worst_distance_ = dist_indices_.rbegin()->dist_;
+        }
+    }
+
+    /** Remove all elements in the set
+     */
+    void clear()
+    {
+        dist_indices_.clear();
+        worst_distance_ = std::numeric_limits<DistanceType>::max();
+        is_full_ = false;
+    }
+
+protected:
+    typedef typename UniqueResultSet<DistanceType>::DistIndex DistIndex;
+    using UniqueResultSet<DistanceType>::is_full_;
+    using UniqueResultSet<DistanceType>::worst_distance_;
+    using UniqueResultSet<DistanceType>::dist_indices_;
+
+    /** The number of neighbors to keep */
+    unsigned int capacity_;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Class that holds the radius nearest neighbors
+ * It is more accurate than RadiusResult as it is not limited in the number of neighbors
+ */
+template<typename DistanceType>
+class RadiusUniqueResultSet : public UniqueResultSet<DistanceType>
+{
+public:
+    /** Constructor
+     * @param radius the maximum distance of a neighbor
+     */
+    RadiusUniqueResultSet(DistanceType radius) :
+        radius_(radius)
+    {
+        is_full_ = true;
+    }
+
+    /** Add a possible candidate to the best neighbors
+     * @param dist distance for that neighbor
+     * @param index index of that neighbor
+     */
+    void addPoint(DistanceType dist, int index)
+    {
+        if (dist <= radius_) dist_indices_.insert(DistIndex(dist, index));
+    }
+
+    /** Remove all elements in the set
+     */
+    inline void clear()
+    {
+        dist_indices_.clear();
+    }
+
+
+    /** Check the status of the set
+     * @return alwys false
+     */
+    inline bool full() const
+    {
+        return true;
+    }
+
+    /** The distance of the furthest neighbor
+     * If we don't have enough neighbors, it returns the max possible value
+     * @return
+     */
+    inline DistanceType worstDist() const
+    {
+        return radius_;
+    }
+private:
+    typedef typename UniqueResultSet<DistanceType>::DistIndex DistIndex;
+    using UniqueResultSet<DistanceType>::dist_indices_;
+    using UniqueResultSet<DistanceType>::is_full_;
+
+    /** The furthest distance a neighbor can be */
+    DistanceType radius_;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/** Class that holds the k NN neighbors within a radius distance
+ */
+template<typename DistanceType>
+class KNNRadiusUniqueResultSet : public KNNUniqueResultSet<DistanceType>
+{
+public:
+    /** Constructor
+     * @param capacity the number of neighbors to store at max
+     * @param radius the maximum distance of a neighbor
+     */
+    KNNRadiusUniqueResultSet(unsigned int capacity, DistanceType radius)
+    {
+        this->capacity_ = capacity;
+        this->radius_ = radius;
+        this->dist_indices_.reserve(capacity_);
+        this->clear();
+    }
+
+    /** Remove all elements in the set
+     */
+    void clear()
+    {
+        dist_indices_.clear();
+        worst_distance_ = radius_;
+        is_full_ = false;
+    }
+private:
+    using KNNUniqueResultSet<DistanceType>::dist_indices_;
+    using KNNUniqueResultSet<DistanceType>::is_full_;
+    using KNNUniqueResultSet<DistanceType>::worst_distance_;
+
+    /** The maximum number of neighbors to consider */
+    unsigned int capacity_;
+
+    /** The maximum distance of a neighbor */
+    DistanceType radius_;
+};
+}
+
+#endif //OPENCV_FLANN_RESULTSET_H
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h
new file mode 100644
index 0000000..396f177
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/sampling.h
@@ -0,0 +1,81 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+
+#ifndef OPENCV_FLANN_SAMPLING_H_
+#define OPENCV_FLANN_SAMPLING_H_
+
+#include "matrix.h"
+#include "random.h"
+
+namespace cvflann
+{
+
+template<typename T>
+Matrix<T> random_sample(Matrix<T>& srcMatrix, long size, bool remove = false)
+{
+    Matrix<T> newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols);
+
+    T* src,* dest;
+    for (long i=0; i<size; ++i) {
+        long r = rand_int((int)(srcMatrix.rows-i));
+        dest = newSet[i];
+        src = srcMatrix[r];
+        std::copy(src, src+srcMatrix.cols, dest);
+        if (remove) {
+            src = srcMatrix[srcMatrix.rows-i-1];
+            dest = srcMatrix[r];
+            std::copy(src, src+srcMatrix.cols, dest);
+        }
+    }
+    if (remove) {
+        srcMatrix.rows -= size;
+    }
+    return newSet;
+}
+
+template<typename T>
+Matrix<T> random_sample(const Matrix<T>& srcMatrix, size_t size)
+{
+    UniqueRandom rand((int)srcMatrix.rows);
+    Matrix<T> newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols);
+
+    T* src,* dest;
+    for (size_t i=0; i<size; ++i) {
+        long r = rand.next();
+        dest = newSet[i];
+        src = srcMatrix[r];
+        std::copy(src, src+srcMatrix.cols, dest);
+    }
+    return newSet;
+}
+
+} // namespace
+
+
+#endif /* OPENCV_FLANN_SAMPLING_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/saving.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/saving.h
new file mode 100644
index 0000000..7e3bea5
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/saving.h
@@ -0,0 +1,187 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE NNIndexGOODS 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_SAVING_H_
+#define OPENCV_FLANN_SAVING_H_
+
+#include <cstring>
+#include <vector>
+
+#include "general.h"
+#include "nn_index.h"
+
+#ifdef FLANN_SIGNATURE_
+#undef FLANN_SIGNATURE_
+#endif
+#define FLANN_SIGNATURE_ "FLANN_INDEX"
+
+namespace cvflann
+{
+
+template <typename T>
+struct Datatype {};
+template<>
+struct Datatype<char> { static flann_datatype_t type() { return FLANN_INT8; } };
+template<>
+struct Datatype<short> { static flann_datatype_t type() { return FLANN_INT16; } };
+template<>
+struct Datatype<int> { static flann_datatype_t type() { return FLANN_INT32; } };
+template<>
+struct Datatype<unsigned char> { static flann_datatype_t type() { return FLANN_UINT8; } };
+template<>
+struct Datatype<unsigned short> { static flann_datatype_t type() { return FLANN_UINT16; } };
+template<>
+struct Datatype<unsigned int> { static flann_datatype_t type() { return FLANN_UINT32; } };
+template<>
+struct Datatype<float> { static flann_datatype_t type() { return FLANN_FLOAT32; } };
+template<>
+struct Datatype<double> { static flann_datatype_t type() { return FLANN_FLOAT64; } };
+
+
+/**
+ * Structure representing the index header.
+ */
+struct IndexHeader
+{
+    char signature[16];
+    char version[16];
+    flann_datatype_t data_type;
+    flann_algorithm_t index_type;
+    size_t rows;
+    size_t cols;
+};
+
+/**
+ * Saves index header to stream
+ *
+ * @param stream - Stream to save to
+ * @param index - The index to save
+ */
+template<typename Distance>
+void save_header(FILE* stream, const NNIndex<Distance>& index)
+{
+    IndexHeader header;
+    memset(header.signature, 0, sizeof(header.signature));
+    strcpy(header.signature, FLANN_SIGNATURE_);
+    memset(header.version, 0, sizeof(header.version));
+    strcpy(header.version, FLANN_VERSION_);
+    header.data_type = Datatype<typename Distance::ElementType>::type();
+    header.index_type = index.getType();
+    header.rows = index.size();
+    header.cols = index.veclen();
+
+    std::fwrite(&header, sizeof(header),1,stream);
+}
+
+
+/**
+ *
+ * @param stream - Stream to load from
+ * @return Index header
+ */
+inline IndexHeader load_header(FILE* stream)
+{
+    IndexHeader header;
+    size_t read_size = fread(&header,sizeof(header),1,stream);
+
+    if (read_size!=(size_t)1) {
+        throw FLANNException("Invalid index file, cannot read");
+    }
+
+    if (strcmp(header.signature,FLANN_SIGNATURE_)!=0) {
+        throw FLANNException("Invalid index file, wrong signature");
+    }
+
+    return header;
+
+}
+
+
+template<typename T>
+void save_value(FILE* stream, const T& value, size_t count = 1)
+{
+    fwrite(&value, sizeof(value),count, stream);
+}
+
+template<typename T>
+void save_value(FILE* stream, const cvflann::Matrix<T>& value)
+{
+    fwrite(&value, sizeof(value),1, stream);
+    fwrite(value.data, sizeof(T),value.rows*value.cols, stream);
+}
+
+template<typename T>
+void save_value(FILE* stream, const std::vector<T>& value)
+{
+    size_t size = value.size();
+    fwrite(&size, sizeof(size_t), 1, stream);
+    fwrite(&value[0], sizeof(T), size, stream);
+}
+
+template<typename T>
+void load_value(FILE* stream, T& value, size_t count = 1)
+{
+    size_t read_cnt = fread(&value, sizeof(value), count, stream);
+    if (read_cnt != count) {
+        throw FLANNException("Cannot read from file");
+    }
+}
+
+template<typename T>
+void load_value(FILE* stream, cvflann::Matrix<T>& value)
+{
+    size_t read_cnt = fread(&value, sizeof(value), 1, stream);
+    if (read_cnt != 1) {
+        throw FLANNException("Cannot read from file");
+    }
+    value.data = new T[value.rows*value.cols];
+    read_cnt = fread(value.data, sizeof(T), value.rows*value.cols, stream);
+    if (read_cnt != (size_t)(value.rows*value.cols)) {
+        throw FLANNException("Cannot read from file");
+    }
+}
+
+
+template<typename T>
+void load_value(FILE* stream, std::vector<T>& value)
+{
+    size_t size;
+    size_t read_cnt = fread(&size, sizeof(size_t), 1, stream);
+    if (read_cnt!=1) {
+        throw FLANNException("Cannot read from file");
+    }
+    value.resize(size);
+    read_cnt = fread(&value[0], sizeof(T), size, stream);
+    if (read_cnt != size) {
+        throw FLANNException("Cannot read from file");
+    }
+}
+
+}
+
+#endif /* OPENCV_FLANN_SAVING_H_ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h
new file mode 100644
index 0000000..145901a
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/simplex_downhill.h
@@ -0,0 +1,186 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_SIMPLEX_DOWNHILL_H_
+#define OPENCV_FLANN_SIMPLEX_DOWNHILL_H_
+
+namespace cvflann
+{
+
+/**
+    Adds val to array vals (and point to array points) and keeping the arrays sorted by vals.
+ */
+template <typename T>
+void addValue(int pos, float val, float* vals, T* point, T* points, int n)
+{
+    vals[pos] = val;
+    for (int i=0; i<n; ++i) {
+        points[pos*n+i] = point[i];
+    }
+
+    // bubble down
+    int j=pos;
+    while (j>0 && vals[j]<vals[j-1]) {
+        swap(vals[j],vals[j-1]);
+        for (int i=0; i<n; ++i) {
+            swap(points[j*n+i],points[(j-1)*n+i]);
+        }
+        --j;
+    }
+}
+
+
+/**
+    Simplex downhill optimization function.
+    Preconditions: points is a 2D mattrix of size (n+1) x n
+                    func is the cost function taking n an array of n params and returning float
+                    vals is the cost function in the n+1 simplex points, if NULL it will be computed
+
+    Postcondition: returns optimum value and points[0..n] are the optimum parameters
+ */
+template <typename T, typename F>
+float optimizeSimplexDownhill(T* points, int n, F func, float* vals = NULL )
+{
+    const int MAX_ITERATIONS = 10;
+
+    assert(n>0);
+
+    T* p_o = new T[n];
+    T* p_r = new T[n];
+    T* p_e = new T[n];
+
+    int alpha = 1;
+
+    int iterations = 0;
+
+    bool ownVals = false;
+    if (vals == NULL) {
+        ownVals = true;
+        vals = new float[n+1];
+        for (int i=0; i<n+1; ++i) {
+            float val = func(points+i*n);
+            addValue(i, val, vals, points+i*n, points, n);
+        }
+    }
+    int nn = n*n;
+
+    while (true) {
+
+        if (iterations++ > MAX_ITERATIONS) break;
+
+        // compute average of simplex points (except the highest point)
+        for (int j=0; j<n; ++j) {
+            p_o[j] = 0;
+            for (int i=0; i<n; ++i) {
+                p_o[i] += points[j*n+i];
+            }
+        }
+        for (int i=0; i<n; ++i) {
+            p_o[i] /= n;
+        }
+
+        bool converged = true;
+        for (int i=0; i<n; ++i) {
+            if (p_o[i] != points[nn+i]) {
+                converged = false;
+            }
+        }
+        if (converged) break;
+
+        // trying a reflection
+        for (int i=0; i<n; ++i) {
+            p_r[i] = p_o[i] + alpha*(p_o[i]-points[nn+i]);
+        }
+        float val_r = func(p_r);
+
+        if ((val_r>=vals[0])&&(val_r<vals[n])) {
+            // reflection between second highest and lowest
+            // add it to the simplex
+            Logger::info("Choosing reflection\n");
+            addValue(n, val_r,vals, p_r, points, n);
+            continue;
+        }
+
+        if (val_r<vals[0]) {
+            // value is smaller than smalest in simplex
+
+            // expand some more to see if it drops further
+            for (int i=0; i<n; ++i) {
+                p_e[i] = 2*p_r[i]-p_o[i];
+            }
+            float val_e = func(p_e);
+
+            if (val_e<val_r) {
+                Logger::info("Choosing reflection and expansion\n");
+                addValue(n, val_e,vals,p_e,points,n);
+            }
+            else {
+                Logger::info("Choosing reflection\n");
+                addValue(n, val_r,vals,p_r,points,n);
+            }
+            continue;
+        }
+        if (val_r>=vals[n]) {
+            for (int i=0; i<n; ++i) {
+                p_e[i] = (p_o[i]+points[nn+i])/2;
+            }
+            float val_e = func(p_e);
+
+            if (val_e<vals[n]) {
+                Logger::info("Choosing contraction\n");
+                addValue(n,val_e,vals,p_e,points,n);
+                continue;
+            }
+        }
+        {
+            Logger::info("Full contraction\n");
+            for (int j=1; j<=n; ++j) {
+                for (int i=0; i<n; ++i) {
+                    points[j*n+i] = (points[j*n+i]+points[i])/2;
+                }
+                float val = func(points+j*n);
+                addValue(j,val,vals,points+j*n,points,n);
+            }
+        }
+    }
+
+    float bestVal = vals[0];
+
+    delete[] p_r;
+    delete[] p_o;
+    delete[] p_e;
+    if (ownVals) delete[] vals;
+
+    return bestVal;
+}
+
+}
+
+#endif //OPENCV_FLANN_SIMPLEX_DOWNHILL_H_
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/flann/timer.h b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/timer.h
new file mode 100644
index 0000000..f771a34
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/flann/timer.h
@@ -0,0 +1,94 @@
+/***********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright 2008-2009  Marius Muja (mariusm@cs.ubc.ca). All rights reserved.
+ * Copyright 2008-2009  David G. Lowe (lowe@cs.ubc.ca). All rights reserved.
+ *
+ * THE BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *************************************************************************/
+
+#ifndef OPENCV_FLANN_TIMER_H
+#define OPENCV_FLANN_TIMER_H
+
+#include <time.h>
+#include "opencv2/core.hpp"
+#include "opencv2/core/utility.hpp"
+
+namespace cvflann
+{
+
+/**
+ * A start-stop timer class.
+ *
+ * Can be used to time portions of code.
+ */
+class StartStopTimer
+{
+    int64 startTime;
+
+public:
+    /**
+     * Value of the timer.
+     */
+    double value;
+
+
+    /**
+     * Constructor.
+     */
+    StartStopTimer()
+    {
+        reset();
+    }
+
+    /**
+     * Starts the timer.
+     */
+    void start()
+    {
+        startTime = cv::getTickCount();
+    }
+
+    /**
+     * Stops the timer and updates timer value.
+     */
+    void stop()
+    {
+        int64 stopTime = cv::getTickCount();
+        value += ( (double)stopTime - startTime) / cv::getTickFrequency();
+    }
+
+    /**
+     * Resets the timer value to 0.
+     */
+    void reset()
+    {
+        value = 0;
+    }
+
+};
+
+}
+
+#endif // FLANN_TIMER_H
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/highgui.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/highgui.hpp
new file mode 100644
index 0000000..41bd8af
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/highgui.hpp
@@ -0,0 +1,754 @@
+/*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*/
+
+#ifndef __OPENCV_HIGHGUI_HPP__
+#define __OPENCV_HIGHGUI_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/imgcodecs.hpp"
+#include "opencv2/videoio.hpp"
+
+/**
+@defgroup highgui High-level GUI
+
+While OpenCV was designed for use in full-scale applications and can be used within functionally
+rich UI frameworks (such as Qt\*, WinForms\*, or Cocoa\*) or without any UI at all, sometimes there
+it is required to try functionality quickly and visualize the results. This is what the HighGUI
+module has been designed for.
+
+It provides easy interface to:
+
+-   Create and manipulate windows that can display images and "remember" their content (no need to
+    handle repaint events from OS).
+-   Add trackbars to the windows, handle simple mouse events as well as keyboard commands.
+
+@{
+    @defgroup highgui_opengl OpenGL support
+    @defgroup highgui_qt Qt New Functions
+
+    ![image](pics/qtgui.png)
+
+    This figure explains new functionality implemented with Qt\* GUI. The new GUI provides a statusbar,
+    a toolbar, and a control panel. The control panel can have trackbars and buttonbars attached to it.
+    If you cannot see the control panel, press Ctrl+P or right-click any Qt window and select **Display
+    properties window**.
+
+    -   To attach a trackbar, the window name parameter must be NULL.
+
+    -   To attach a buttonbar, a button must be created. If the last bar attached to the control panel
+        is a buttonbar, the new button is added to the right of the last button. If the last bar
+        attached to the control panel is a trackbar, or the control panel is empty, a new buttonbar is
+        created. Then, a new button is attached to it.
+
+    See below the example used to generate the figure:
+    @code
+        int main(int argc, char *argv[])
+        {
+
+            int value = 50;
+            int value2 = 0;
+
+
+            namedWindow("main1",WINDOW_NORMAL);
+            namedWindow("main2",WINDOW_AUTOSIZE | CV_GUI_NORMAL);
+            createTrackbar( "track1", "main1", &value, 255,  NULL);
+
+            String nameb1 = "button1";
+            String nameb2 = "button2";
+
+            createButton(nameb1,callbackButton,&nameb1,QT_CHECKBOX,1);
+            createButton(nameb2,callbackButton,NULL,QT_CHECKBOX,0);
+            createTrackbar( "track2", NULL, &value2, 255, NULL);
+            createButton("button5",callbackButton1,NULL,QT_RADIOBOX,0);
+            createButton("button6",callbackButton2,NULL,QT_RADIOBOX,1);
+
+            setMouseCallback( "main2",on_mouse,NULL );
+
+            Mat img1 = imread("files/flower.jpg");
+            VideoCapture video;
+            video.open("files/hockey.avi");
+
+            Mat img2,img3;
+
+            while( waitKey(33) != 27 )
+            {
+                img1.convertTo(img2,-1,1,value);
+                video >> img3;
+
+                imshow("main1",img2);
+                imshow("main2",img3);
+            }
+
+            destroyAllWindows();
+
+            return 0;
+        }
+    @endcode
+
+
+    @defgroup highgui_winrt WinRT support
+
+    This figure explains new functionality implemented with WinRT GUI. The new GUI provides an Image control,
+    and a slider panel. Slider panel holds trackbars attached to it.
+
+    Sliders are attached below the image control. Every new slider is added below the previous one.
+
+    See below the example used to generate the figure:
+    @code
+        void sample_app::MainPage::ShowWindow()
+        {
+            static cv::String windowName("sample");
+            cv::winrt_initContainer(this->cvContainer);
+            cv::namedWindow(windowName); // not required
+
+            cv::Mat image = cv::imread("Assets/sample.jpg");
+            cv::Mat converted = cv::Mat(image.rows, image.cols, CV_8UC4);
+            cv::cvtColor(image, converted, COLOR_BGR2BGRA);
+            cv::imshow(windowName, converted); // this will create window if it hasn't been created before
+
+            int state = 42;
+            cv::TrackbarCallback callback = [](int pos, void* userdata)
+            {
+                if (pos == 0) {
+                    cv::destroyWindow(windowName);
+                }
+            };
+            cv::TrackbarCallback callbackTwin = [](int pos, void* userdata)
+            {
+                if (pos >= 70) {
+                    cv::destroyAllWindows();
+                }
+            };
+            cv::createTrackbar("Sample trackbar", windowName, &state, 100, callback);
+            cv::createTrackbar("Twin brother", windowName, &state, 100, callbackTwin);
+        }
+    @endcode
+
+    @defgroup highgui_c C API
+@}
+*/
+
+///////////////////////// graphical user interface //////////////////////////
+namespace cv
+{
+
+//! @addtogroup highgui
+//! @{
+
+//! Flags for cv::namedWindow
+enum WindowFlags {
+       WINDOW_NORMAL     = 0x00000000, //!< the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size.
+       WINDOW_AUTOSIZE   = 0x00000001, //!< the user cannot resize the window, the size is constrainted by the image displayed.
+       WINDOW_OPENGL     = 0x00001000, //!< window with opengl support.
+
+       WINDOW_FULLSCREEN = 1,          //!< change the window to fullscreen.
+       WINDOW_FREERATIO  = 0x00000100, //!< the image expends as much as it can (no ratio constraint).
+       WINDOW_KEEPRATIO  = 0x00000000  //!< the ratio of the image is respected.
+     };
+
+//! Flags for cv::setWindowProperty / cv::getWindowProperty
+enum WindowPropertyFlags {
+       WND_PROP_FULLSCREEN   = 0, //!< fullscreen property    (can be WINDOW_NORMAL or WINDOW_FULLSCREEN).
+       WND_PROP_AUTOSIZE     = 1, //!< autosize property      (can be WINDOW_NORMAL or WINDOW_AUTOSIZE).
+       WND_PROP_ASPECT_RATIO = 2, //!< window's aspect ration (can be set to WINDOW_FREERATIO or WINDOW_KEEPRATIO).
+       WND_PROP_OPENGL       = 3  //!< opengl support.
+     };
+
+//! Mouse Events see cv::MouseCallback
+enum MouseEventTypes {
+       EVENT_MOUSEMOVE      = 0, //!< indicates that the mouse pointer has moved over the window.
+       EVENT_LBUTTONDOWN    = 1, //!< indicates that the left mouse button is pressed.
+       EVENT_RBUTTONDOWN    = 2, //!< indicates that the right mouse button is pressed.
+       EVENT_MBUTTONDOWN    = 3, //!< indicates that the middle mouse button is pressed.
+       EVENT_LBUTTONUP      = 4, //!< indicates that left mouse button is released.
+       EVENT_RBUTTONUP      = 5, //!< indicates that right mouse button is released.
+       EVENT_MBUTTONUP      = 6, //!< indicates that middle mouse button is released.
+       EVENT_LBUTTONDBLCLK  = 7, //!< indicates that left mouse button is double clicked.
+       EVENT_RBUTTONDBLCLK  = 8, //!< indicates that right mouse button is double clicked.
+       EVENT_MBUTTONDBLCLK  = 9, //!< indicates that middle mouse button is double clicked.
+       EVENT_MOUSEWHEEL     = 10,//!< positive and negative values mean forward and backward scrolling, respectively.
+       EVENT_MOUSEHWHEEL    = 11 //!< positive and negative values mean right and left scrolling, respectively.
+     };
+
+//! Mouse Event Flags see cv::MouseCallback
+enum MouseEventFlags {
+       EVENT_FLAG_LBUTTON   = 1, //!< indicates that the left mouse button is down.
+       EVENT_FLAG_RBUTTON   = 2, //!< indicates that the right mouse button is down.
+       EVENT_FLAG_MBUTTON   = 4, //!< indicates that the middle mouse button is down.
+       EVENT_FLAG_CTRLKEY   = 8, //!< indicates that CTRL Key is pressed.
+       EVENT_FLAG_SHIFTKEY  = 16,//!< indicates that SHIFT Key is pressed.
+       EVENT_FLAG_ALTKEY    = 32 //!< indicates that ALT Key is pressed.
+     };
+
+//! Qt font weight
+enum QtFontWeights {
+        QT_FONT_LIGHT           = 25, //!< Weight of 25
+        QT_FONT_NORMAL          = 50, //!< Weight of 50
+        QT_FONT_DEMIBOLD        = 63, //!< Weight of 63
+        QT_FONT_BOLD            = 75, //!< Weight of 75
+        QT_FONT_BLACK           = 87  //!< Weight of 87
+     };
+
+//! Qt font style
+enum QtFontStyles {
+        QT_STYLE_NORMAL         = 0, //!< Normal font.
+        QT_STYLE_ITALIC         = 1, //!< Italic font.
+        QT_STYLE_OBLIQUE        = 2  //!< Oblique font.
+     };
+
+//! Qt "button" type
+enum QtButtonTypes {
+       QT_PUSH_BUTTON = 0, //!< Push button.
+       QT_CHECKBOX    = 1, //!< Checkbox button.
+       QT_RADIOBOX    = 2  //!< Radiobox button.
+     };
+
+/** @brief Callback function for mouse events. see cv::setMouseCallback
+@param event one of the cv::MouseEventTypes constants.
+@param x The x-coordinate of the mouse event.
+@param y The y-coordinate of the mouse event.
+@param flags one of the cv::MouseEventFlags constants.
+@param userdata The optional parameter.
+ */
+typedef void (*MouseCallback)(int event, int x, int y, int flags, void* userdata);
+
+/** @brief Callback function for Trackbar see cv::createTrackbar
+@param pos current position of the specified trackbar.
+@param userdata The optional parameter.
+ */
+typedef void (*TrackbarCallback)(int pos, void* userdata);
+
+/** @brief Callback function defined to be called every frame. See cv::setOpenGlDrawCallback
+@param userdata The optional parameter.
+ */
+typedef void (*OpenGlDrawCallback)(void* userdata);
+
+/** @brief Callback function for a button created by cv::createButton
+@param state current state of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button.
+@param userdata The optional parameter.
+ */
+typedef void (*ButtonCallback)(int state, void* userdata);
+
+/** @brief Creates a window.
+
+The function namedWindow creates a window that can be used as a placeholder for images and
+trackbars. Created windows are referred to by their names.
+
+If a window with the same name already exists, the function does nothing.
+
+You can call cv::destroyWindow or cv::destroyAllWindows to close the window and de-allocate any associated
+memory usage. For a simple program, you do not really have to call these functions because all the
+resources and windows of the application are closed automatically by the operating system upon exit.
+
+@note
+
+Qt backend supports additional flags:
+ -   **WINDOW_NORMAL or WINDOW_AUTOSIZE:** WINDOW_NORMAL enables you to resize the
+     window, whereas WINDOW_AUTOSIZE adjusts automatically the window size to fit the
+     displayed image (see imshow ), and you cannot change the window size manually.
+ -   **WINDOW_FREERATIO or WINDOW_KEEPRATIO:** WINDOW_FREERATIO adjusts the image
+     with no respect to its ratio, whereas WINDOW_KEEPRATIO keeps the image ratio.
+ -   **CV_GUI_NORMAL or CV_GUI_EXPANDED:** CV_GUI_NORMAL is the old way to draw the window
+     without statusbar and toolbar, whereas CV_GUI_EXPANDED is a new enhanced GUI.
+By default, flags == WINDOW_AUTOSIZE | WINDOW_KEEPRATIO | CV_GUI_EXPANDED
+
+@param winname Name of the window in the window caption that may be used as a window identifier.
+@param flags Flags of the window. The supported flags are: (cv::WindowFlags)
+ */
+CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
+
+/** @brief Destroys the specified window.
+
+The function destroyWindow destroys the window with the given name.
+
+@param winname Name of the window to be destroyed.
+ */
+CV_EXPORTS_W void destroyWindow(const String& winname);
+
+/** @brief Destroys all of the HighGUI windows.
+
+The function destroyAllWindows destroys all of the opened HighGUI windows.
+ */
+CV_EXPORTS_W void destroyAllWindows();
+
+CV_EXPORTS_W int startWindowThread();
+
+/** @brief Waits for a pressed key.
+
+The function waitKey waits for a key event infinitely (when \f$\texttt{delay}\leq 0\f$ ) or for delay
+milliseconds, when it is positive. Since the OS has a minimum time between switching threads, the
+function will not wait exactly delay ms, it will wait at least delay ms, depending on what else is
+running on your computer at that time. It returns the code of the pressed key or -1 if no key was
+pressed before the specified time had elapsed.
+
+@note
+
+This function is the only method in HighGUI that can fetch and handle events, so it needs to be
+called periodically for normal event processing unless HighGUI is used within an environment that
+takes care of event processing.
+
+@note
+
+The function only works if there is at least one HighGUI window created and the window is active.
+If there are several HighGUI windows, any of them can be active.
+
+@param delay Delay in milliseconds. 0 is the special value that means "forever".
+ */
+CV_EXPORTS_W int waitKey(int delay = 0);
+
+/** @brief Displays an image in the specified window.
+
+The function imshow displays an image in the specified window. If the window was created with the
+cv::WINDOW_AUTOSIZE flag, the image is shown with its original size, however it is still limited by the screen resolution.
+Otherwise, the image is scaled to fit the window. The function may scale the image, depending on its depth:
+
+-   If the image is 8-bit unsigned, it is displayed as is.
+-   If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the
+    value range [0,255\*256] is mapped to [0,255].
+-   If the image is 32-bit floating-point, the pixel values are multiplied by 255. That is, the
+    value range [0,1] is mapped to [0,255].
+
+If window was created with OpenGL support, cv::imshow also support ogl::Buffer , ogl::Texture2D and
+cuda::GpuMat as input.
+
+If the window was not created before this function, it is assumed creating a window with cv::WINDOW_AUTOSIZE.
+
+If you need to show an image that is bigger than the screen resolution, you will need to call namedWindow("", WINDOW_NORMAL) before the imshow.
+
+@note This function should be followed by cv::waitKey function which displays the image for specified
+milliseconds. Otherwise, it won't display the image. For example, **waitKey(0)** will display the window
+infinitely until any keypress (it is suitable for image display). **waitKey(25)** will display a frame
+for 25 ms, after which display will be automatically closed. (If you put it in a loop to read
+videos, it will display the video frame-by-frame)
+
+@note
+
+[__Windows Backend Only__] Pressing Ctrl+C will copy the image to the clipboard.
+
+[__Windows Backend Only__] Pressing Ctrl+S will show a dialog to save the image.
+
+@param winname Name of the window.
+@param mat Image to be shown.
+ */
+CV_EXPORTS_W void imshow(const String& winname, InputArray mat);
+
+/** @brief Resizes window to the specified size
+
+@note
+
+-   The specified window size is for the image area. Toolbars are not counted.
+-   Only windows created without cv::WINDOW_AUTOSIZE flag can be resized.
+
+@param winname Window name.
+@param width The new window width.
+@param height The new window height.
+ */
+CV_EXPORTS_W void resizeWindow(const String& winname, int width, int height);
+
+/** @brief Moves window to the specified position
+
+@param winname Name of the window.
+@param x The new x-coordinate of the window.
+@param y The new y-coordinate of the window.
+ */
+CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
+
+/** @brief Changes parameters of a window dynamically.
+
+The function setWindowProperty enables changing properties of a window.
+
+@param winname Name of the window.
+@param prop_id Window property to edit. The supported operation flags are: (cv::WindowPropertyFlags)
+@param prop_value New value of the window property. The supported flags are: (cv::WindowFlags)
+ */
+CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);
+
+/** @brief Updates window title
+@param winname Name of the window.
+@param title New title.
+*/
+CV_EXPORTS_W void setWindowTitle(const String& winname, const String& title);
+
+/** @brief Provides parameters of a window.
+
+The function getWindowProperty returns properties of a window.
+
+@param winname Name of the window.
+@param prop_id Window property to retrieve. The following operation flags are available: (cv::WindowPropertyFlags)
+
+@sa setWindowProperty
+ */
+CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);
+
+/** @brief Sets mouse handler for the specified window
+
+@param winname Name of the window.
+@param onMouse Mouse callback. See OpenCV samples, such as
+<https://github.com/Itseez/opencv/tree/master/samples/cpp/ffilldemo.cpp>, on how to specify and
+use the callback.
+@param userdata The optional parameter passed to the callback.
+ */
+CV_EXPORTS void setMouseCallback(const String& winname, MouseCallback onMouse, void* userdata = 0);
+
+/** @brief Gets the mouse-wheel motion delta, when handling mouse-wheel events cv::EVENT_MOUSEWHEEL and
+cv::EVENT_MOUSEHWHEEL.
+
+For regular mice with a scroll-wheel, delta will be a multiple of 120. The value 120 corresponds to
+a one notch rotation of the wheel or the threshold for action to be taken and one such action should
+occur for each delta. Some high-precision mice with higher-resolution freely-rotating wheels may
+generate smaller values.
+
+For cv::EVENT_MOUSEWHEEL positive and negative values mean forward and backward scrolling,
+respectively. For cv::EVENT_MOUSEHWHEEL, where available, positive and negative values mean right and
+left scrolling, respectively.
+
+With the C API, the macro CV_GET_WHEEL_DELTA(flags) can be used alternatively.
+
+@note
+
+Mouse-wheel events are currently supported only on Windows.
+
+@param flags The mouse callback flags parameter.
+ */
+CV_EXPORTS int getMouseWheelDelta(int flags);
+
+/** @brief Creates a trackbar and attaches it to the specified window.
+
+The function createTrackbar creates a trackbar (a slider or range control) with the specified name
+and range, assigns a variable value to be a position synchronized with the trackbar and specifies
+the callback function onChange to be called on the trackbar position change. The created trackbar is
+displayed in the specified window winname.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar should be attached to the
+control panel.
+
+Clicking the label of each trackbar enables editing the trackbar values manually.
+
+@param trackbarname Name of the created trackbar.
+@param winname Name of the window that will be used as a parent of the created trackbar.
+@param value Optional pointer to an integer variable whose value reflects the position of the
+slider. Upon creation, the slider position is defined by this variable.
+@param count Maximal position of the slider. The minimal position is always 0.
+@param onChange Pointer to the function to be called every time the slider changes position. This
+function should be prototyped as void Foo(int,void\*); , where the first parameter is the trackbar
+position and the second parameter is the user data (see the next parameter). If the callback is
+the NULL pointer, no callbacks are called, but only value is updated.
+@param userdata User data that is passed as is to the callback. It can be used to handle trackbar
+events without using global variables.
+ */
+CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname,
+                              int* value, int count,
+                              TrackbarCallback onChange = 0,
+                              void* userdata = 0);
+
+/** @brief Returns the trackbar position.
+
+The function returns the current position of the specified trackbar.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control
+panel.
+
+@param trackbarname Name of the trackbar.
+@param winname Name of the window that is the parent of the trackbar.
+ */
+CV_EXPORTS_W int getTrackbarPos(const String& trackbarname, const String& winname);
+
+/** @brief Sets the trackbar position.
+
+The function sets the position of the specified trackbar in the specified window.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control
+panel.
+
+@param trackbarname Name of the trackbar.
+@param winname Name of the window that is the parent of trackbar.
+@param pos New position.
+ */
+CV_EXPORTS_W void setTrackbarPos(const String& trackbarname, const String& winname, int pos);
+
+/** @brief Sets the trackbar maximum position.
+
+The function sets the maximum position of the specified trackbar in the specified window.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control
+panel.
+
+@param trackbarname Name of the trackbar.
+@param winname Name of the window that is the parent of trackbar.
+@param maxval New maximum position.
+ */
+CV_EXPORTS_W void setTrackbarMax(const String& trackbarname, const String& winname, int maxval);
+
+/** @brief Sets the trackbar minimum position.
+
+The function sets the minimum position of the specified trackbar in the specified window.
+
+@note
+
+[__Qt Backend Only__] winname can be empty (or NULL) if the trackbar is attached to the control
+panel.
+
+@param trackbarname Name of the trackbar.
+@param winname Name of the window that is the parent of trackbar.
+@param minval New maximum position.
+ */
+CV_EXPORTS_W void setTrackbarMin(const String& trackbarname, const String& winname, int minval);
+
+//! @addtogroup highgui_opengl OpenGL support
+//! @{
+
+/** @brief Displays OpenGL 2D texture in the specified window.
+
+@param winname Name of the window.
+@param tex OpenGL 2D texture data.
+ */
+CV_EXPORTS void imshow(const String& winname, const ogl::Texture2D& tex);
+
+/** @brief Sets a callback function to be called to draw on top of displayed image.
+
+The function setOpenGlDrawCallback can be used to draw 3D data on the window. See the example of
+callback function below:
+@code
+    void on_opengl(void* param)
+    {
+        glLoadIdentity();
+
+        glTranslated(0.0, 0.0, -1.0);
+
+        glRotatef( 55, 1, 0, 0 );
+        glRotatef( 45, 0, 1, 0 );
+        glRotatef( 0, 0, 0, 1 );
+
+        static const int coords[6][4][3] = {
+            { { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } },
+            { { +1, +1, -1 }, { -1, +1, -1 }, { -1, +1, +1 }, { +1, +1, +1 } },
+            { { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } },
+            { { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } },
+            { { +1, -1, +1 }, { -1, -1, +1 }, { -1, -1, -1 }, { +1, -1, -1 } },
+            { { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } }
+        };
+
+        for (int i = 0; i < 6; ++i) {
+                    glColor3ub( i*20, 100+i*10, i*42 );
+                    glBegin(GL_QUADS);
+                    for (int j = 0; j < 4; ++j) {
+                            glVertex3d(0.2 * coords[i][j][0], 0.2 * coords[i][j][1], 0.2 * coords[i][j][2]);
+                    }
+                    glEnd();
+        }
+    }
+@endcode
+
+@param winname Name of the window.
+@param onOpenGlDraw Pointer to the function to be called every frame. This function should be
+prototyped as void Foo(void\*) .
+@param userdata Pointer passed to the callback function.(__Optional__)
+ */
+CV_EXPORTS void setOpenGlDrawCallback(const String& winname, OpenGlDrawCallback onOpenGlDraw, void* userdata = 0);
+
+/** @brief Sets the specified window as current OpenGL context.
+
+@param winname Name of the window.
+ */
+CV_EXPORTS void setOpenGlContext(const String& winname);
+
+/** @brief Force window to redraw its context and call draw callback ( See cv::setOpenGlDrawCallback ).
+
+@param winname Name of the window.
+ */
+CV_EXPORTS void updateWindow(const String& winname);
+
+//! @} highgui_opengl
+
+//! @addtogroup highgui_qt
+//! @{
+
+/** @brief QtFont available only for Qt. See cv::fontQt
+ */
+struct QtFont
+{
+    const char* nameFont;  //!< Name of the font
+    Scalar      color;     //!< Color of the font. Scalar(blue_component, green_component, red_component[, alpha_component])
+    int         font_face; //!< See cv::QtFontStyles
+    const int*  ascii;     //!< font data and metrics
+    const int*  greek;
+    const int*  cyrillic;
+    float       hscale, vscale;
+    float       shear;     //!< slope coefficient: 0 - normal, >0 - italic
+    int         thickness; //!< See cv::QtFontWeights
+    float       dx;        //!< horizontal interval between letters
+    int         line_type; //!< PointSize
+};
+
+/** @brief Creates the font to draw a text on an image.
+
+The function fontQt creates a cv::QtFont object. This cv::QtFont is not compatible with putText .
+
+A basic usage of this function is the following: :
+@code
+    QtFont font = fontQt("Times");
+    addText( img1, "Hello World !", Point(50,50), font);
+@endcode
+
+@param nameFont Name of the font. The name should match the name of a system font (such as
+*Times*). If the font is not found, a default one is used.
+@param pointSize Size of the font. If not specified, equal zero or negative, the point size of the
+font is set to a system-dependent default value. Generally, this is 12 points.
+@param color Color of the font in BGRA where A = 255 is fully transparent. Use the macro CV_RGB
+for simplicity.
+@param weight Font weight. Available operation flags are : cv::QtFontWeights You can also specify a positive integer for better control.
+@param style Font style. Available operation flags are : cv::QtFontStyles
+@param spacing Spacing between characters. It can be negative or positive.
+ */
+CV_EXPORTS QtFont fontQt(const String& nameFont, int pointSize = -1,
+                         Scalar color = Scalar::all(0), int weight = QT_FONT_NORMAL,
+                         int style = QT_STYLE_NORMAL, int spacing = 0);
+
+/** @brief Draws a text on the image.
+
+The function addText draws *text* on the image *img* using a specific font *font* (see example cv::fontQt
+)
+
+@param img 8-bit 3-channel image where the text should be drawn.
+@param text Text to write on an image.
+@param org Point(x,y) where the text should start on an image.
+@param font Font to use to draw a text.
+ */
+CV_EXPORTS void addText( const Mat& img, const String& text, Point org, const QtFont& font);
+
+/** @brief Displays a text on a window image as an overlay for a specified duration.
+
+The function displayOverlay displays useful information/tips on top of the window for a certain
+amount of time *delayms*. The function does not modify the image, displayed in the window, that is,
+after the specified delay the original content of the window is restored.
+
+@param winname Name of the window.
+@param text Overlay text to write on a window image.
+@param delayms The period (in milliseconds), during which the overlay text is displayed. If this
+function is called before the previous overlay text timed out, the timer is restarted and the text
+is updated. If this value is zero, the text never disappears.
+ */
+CV_EXPORTS void displayOverlay(const String& winname, const String& text, int delayms = 0);
+
+/** @brief Displays a text on the window statusbar during the specified period of time.
+
+The function displayStatusBar displays useful information/tips on top of the window for a certain
+amount of time *delayms* . This information is displayed on the window statusbar (the window must be
+created with the CV_GUI_EXPANDED flags).
+
+@param winname Name of the window.
+@param text Text to write on the window statusbar.
+@param delayms Duration (in milliseconds) to display the text. If this function is called before
+the previous text timed out, the timer is restarted and the text is updated. If this value is
+zero, the text never disappears.
+ */
+CV_EXPORTS void displayStatusBar(const String& winname, const String& text, int delayms = 0);
+
+/** @brief Saves parameters of the specified window.
+
+The function saveWindowParameters saves size, location, flags, trackbars value, zoom and panning
+location of the window windowName.
+
+@param windowName Name of the window.
+ */
+CV_EXPORTS void saveWindowParameters(const String& windowName);
+
+/** @brief Loads parameters of the specified window.
+
+The function loadWindowParameters loads size, location, flags, trackbars value, zoom and panning
+location of the window windowName.
+
+@param windowName Name of the window.
+ */
+CV_EXPORTS void loadWindowParameters(const String& windowName);
+
+CV_EXPORTS  int startLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
+
+CV_EXPORTS  void stopLoop();
+
+/** @brief Attaches a button to the control panel.
+
+The function createButton attaches a button to the control panel. Each button is added to a
+buttonbar to the right of the last button. A new buttonbar is created if nothing was attached to the
+control panel before, or if the last element attached to the control panel was a trackbar.
+
+See below various examples of the cv::createButton function call: :
+@code
+    createButton(NULL,callbackButton);//create a push button "button 0", that will call callbackButton.
+    createButton("button2",callbackButton,NULL,QT_CHECKBOX,0);
+    createButton("button3",callbackButton,&value);
+    createButton("button5",callbackButton1,NULL,QT_RADIOBOX);
+    createButton("button6",callbackButton2,NULL,QT_PUSH_BUTTON,1);
+@endcode
+
+@param  bar_name Name of the button.
+@param on_change Pointer to the function to be called every time the button changes its state.
+This function should be prototyped as void Foo(int state,\*void); . *state* is the current state
+of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button.
+@param userdata Pointer passed to the callback function.
+@param type Optional type of the button. Available types are: (cv::QtButtonTypes)
+@param initial_button_state Default state of the button. Use for checkbox and radiobox. Its
+value could be 0 or 1. (__Optional__)
+*/
+CV_EXPORTS int createButton( const String& bar_name, ButtonCallback on_change,
+                             void* userdata = 0, int type = QT_PUSH_BUTTON,
+                             bool initial_button_state = false);
+
+//! @} highgui_qt
+
+//! @} highgui
+
+} // cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/highgui/highgui_c.h"
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp
new file mode 100644
index 0000000..160c9cf
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/highgui/highgui.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/highgui.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h
new file mode 100644
index 0000000..47fdb84
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/highgui/highgui_c.h
@@ -0,0 +1,252 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_HIGHGUI_H__
+#define __OPENCV_HIGHGUI_H__
+
+#include "opencv2/core/core_c.h"
+#include "opencv2/imgproc/imgproc_c.h"
+#include "opencv2/imgcodecs/imgcodecs_c.h"
+#include "opencv2/videoio/videoio_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** @addtogroup highgui_c
+  @{
+  */
+
+/****************************************************************************************\
+*                                  Basic GUI functions                                   *
+\****************************************************************************************/
+//YV
+//-----------New for Qt
+/* For font */
+enum {  CV_FONT_LIGHT           = 25,//QFont::Light,
+        CV_FONT_NORMAL          = 50,//QFont::Normal,
+        CV_FONT_DEMIBOLD        = 63,//QFont::DemiBold,
+        CV_FONT_BOLD            = 75,//QFont::Bold,
+        CV_FONT_BLACK           = 87 //QFont::Black
+};
+
+enum {  CV_STYLE_NORMAL         = 0,//QFont::StyleNormal,
+        CV_STYLE_ITALIC         = 1,//QFont::StyleItalic,
+        CV_STYLE_OBLIQUE        = 2 //QFont::StyleOblique
+};
+/* ---------*/
+
+//for color cvScalar(blue_component, green_component, red_component[, alpha_component])
+//and alpha= 0 <-> 0xFF (not transparent <-> transparent)
+CVAPI(CvFont) cvFontQt(const char* nameFont, int pointSize CV_DEFAULT(-1), CvScalar color CV_DEFAULT(cvScalarAll(0)), int weight CV_DEFAULT(CV_FONT_NORMAL),  int style CV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0));
+
+CVAPI(void) cvAddText(const CvArr* img, const char* text, CvPoint org, CvFont *arg2);
+
+CVAPI(void) cvDisplayOverlay(const char* name, const char* text, int delayms CV_DEFAULT(0));
+CVAPI(void) cvDisplayStatusBar(const char* name, const char* text, int delayms CV_DEFAULT(0));
+
+CVAPI(void) cvSaveWindowParameters(const char* name);
+CVAPI(void) cvLoadWindowParameters(const char* name);
+CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]);
+CVAPI(void) cvStopLoop( void );
+
+typedef void (CV_CDECL *CvButtonCallback)(int state, void* userdata);
+enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2};
+CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0));
+//----------------------
+
+
+/* this function is used to set some external parameters in case of X Window */
+CVAPI(int) cvInitSystem( int argc, char** argv );
+
+CVAPI(int) cvStartWindowThread( void );
+
+// ---------  YV ---------
+enum
+{
+    //These 3 flags are used by cvSet/GetWindowProperty
+    CV_WND_PROP_FULLSCREEN = 0, //to change/get window's fullscreen property
+    CV_WND_PROP_AUTOSIZE   = 1, //to change/get window's autosize property
+    CV_WND_PROP_ASPECTRATIO= 2, //to change/get window's aspectratio property
+    CV_WND_PROP_OPENGL     = 3, //to change/get window's opengl support
+
+    //These 2 flags are used by cvNamedWindow and cvSet/GetWindowProperty
+    CV_WINDOW_NORMAL       = 0x00000000, //the user can resize the window (no constraint)  / also use to switch a fullscreen window to a normal size
+    CV_WINDOW_AUTOSIZE     = 0x00000001, //the user cannot resize the window, the size is constrainted by the image displayed
+    CV_WINDOW_OPENGL       = 0x00001000, //window with opengl support
+
+    //Those flags are only for Qt
+    CV_GUI_EXPANDED         = 0x00000000, //status bar and tool bar
+    CV_GUI_NORMAL           = 0x00000010, //old fashious way
+
+    //These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty
+    CV_WINDOW_FULLSCREEN   = 1,//change the window to fullscreen
+    CV_WINDOW_FREERATIO    = 0x00000100,//the image expends as much as it can (no ratio constraint)
+    CV_WINDOW_KEEPRATIO    = 0x00000000//the ration image is respected.
+};
+
+/* create window */
+CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOSIZE) );
+
+/* Set and Get Property of the window */
+CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
+CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
+
+/* display image within window (highgui windows remember their content) */
+CVAPI(void) cvShowImage( const char* name, const CvArr* image );
+
+/* resize/move window */
+CVAPI(void) cvResizeWindow( const char* name, int width, int height );
+CVAPI(void) cvMoveWindow( const char* name, int x, int y );
+
+
+/* destroy window and all the trackers associated with it */
+CVAPI(void) cvDestroyWindow( const char* name );
+
+CVAPI(void) cvDestroyAllWindows(void);
+
+/* get native window handle (HWND in case of Win32 and Widget in case of X Window) */
+CVAPI(void*) cvGetWindowHandle( const char* name );
+
+/* get name of highgui window given its native handle */
+CVAPI(const char*) cvGetWindowName( void* window_handle );
+
+
+typedef void (CV_CDECL *CvTrackbarCallback)(int pos);
+
+/* create trackbar and display it on top of given window, set callback */
+CVAPI(int) cvCreateTrackbar( const char* trackbar_name, const char* window_name,
+                             int* value, int count, CvTrackbarCallback on_change CV_DEFAULT(NULL));
+
+typedef void (CV_CDECL *CvTrackbarCallback2)(int pos, void* userdata);
+
+CVAPI(int) cvCreateTrackbar2( const char* trackbar_name, const char* window_name,
+                              int* value, int count, CvTrackbarCallback2 on_change,
+                              void* userdata CV_DEFAULT(0));
+
+/* retrieve or set trackbar position */
+CVAPI(int) cvGetTrackbarPos( const char* trackbar_name, const char* window_name );
+CVAPI(void) cvSetTrackbarPos( const char* trackbar_name, const char* window_name, int pos );
+CVAPI(void) cvSetTrackbarMax(const char* trackbar_name, const char* window_name, int maxval);
+CVAPI(void) cvSetTrackbarMin(const char* trackbar_name, const char* window_name, int minval);
+
+enum
+{
+    CV_EVENT_MOUSEMOVE      =0,
+    CV_EVENT_LBUTTONDOWN    =1,
+    CV_EVENT_RBUTTONDOWN    =2,
+    CV_EVENT_MBUTTONDOWN    =3,
+    CV_EVENT_LBUTTONUP      =4,
+    CV_EVENT_RBUTTONUP      =5,
+    CV_EVENT_MBUTTONUP      =6,
+    CV_EVENT_LBUTTONDBLCLK  =7,
+    CV_EVENT_RBUTTONDBLCLK  =8,
+    CV_EVENT_MBUTTONDBLCLK  =9,
+    CV_EVENT_MOUSEWHEEL     =10,
+    CV_EVENT_MOUSEHWHEEL    =11
+};
+
+enum
+{
+    CV_EVENT_FLAG_LBUTTON   =1,
+    CV_EVENT_FLAG_RBUTTON   =2,
+    CV_EVENT_FLAG_MBUTTON   =4,
+    CV_EVENT_FLAG_CTRLKEY   =8,
+    CV_EVENT_FLAG_SHIFTKEY  =16,
+    CV_EVENT_FLAG_ALTKEY    =32
+};
+
+
+#define CV_GET_WHEEL_DELTA(flags) ((short)((flags >> 16) & 0xffff)) // upper 16 bits
+
+typedef void (CV_CDECL *CvMouseCallback )(int event, int x, int y, int flags, void* param);
+
+/* assign callback for mouse events */
+CVAPI(void) cvSetMouseCallback( const char* window_name, CvMouseCallback on_mouse,
+                                void* param CV_DEFAULT(NULL));
+
+/* wait for key event infinitely (delay<=0) or for "delay" milliseconds */
+CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
+
+// OpenGL support
+
+typedef void (CV_CDECL *CvOpenGlDrawCallback)(void* userdata);
+CVAPI(void) cvSetOpenGlDrawCallback(const char* window_name, CvOpenGlDrawCallback callback, void* userdata CV_DEFAULT(NULL));
+
+CVAPI(void) cvSetOpenGlContext(const char* window_name);
+CVAPI(void) cvUpdateWindow(const char* window_name);
+
+
+/****************************************************************************************\
+
+*                              Obsolete functions/synonyms                               *
+\****************************************************************************************/
+
+#define cvAddSearchPath(path)
+#define cvvInitSystem cvInitSystem
+#define cvvNamedWindow cvNamedWindow
+#define cvvShowImage cvShowImage
+#define cvvResizeWindow cvResizeWindow
+#define cvvDestroyWindow cvDestroyWindow
+#define cvvCreateTrackbar cvCreateTrackbar
+#define cvvAddSearchPath cvAddSearchPath
+#define cvvWaitKey(name) cvWaitKey(0)
+#define cvvWaitKeyEx(name,delay) cvWaitKey(delay)
+#define HG_AUTOSIZE CV_WINDOW_AUTOSIZE
+#define set_preprocess_func cvSetPreprocessFuncWin32
+#define set_postprocess_func cvSetPostprocessFuncWin32
+
+#if defined WIN32 || defined _WIN32
+
+CVAPI(void) cvSetPreprocessFuncWin32_(const void* callback);
+CVAPI(void) cvSetPostprocessFuncWin32_(const void* callback);
+#define cvSetPreprocessFuncWin32(callback) cvSetPreprocessFuncWin32_((const void*)(callback))
+#define cvSetPostprocessFuncWin32(callback) cvSetPostprocessFuncWin32_((const void*)(callback))
+
+#endif
+
+/** @} highgui_c */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp
new file mode 100644
index 0000000..ac0fd24
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs.hpp
@@ -0,0 +1,267 @@
+/*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*/
+
+#ifndef __OPENCV_IMGCODECS_HPP__
+#define __OPENCV_IMGCODECS_HPP__
+
+#include "opencv2/core.hpp"
+
+/**
+  @defgroup imgcodecs Image file reading and writing
+  @{
+    @defgroup imgcodecs_c C API
+    @defgroup imgcodecs_ios iOS glue
+  @}
+*/
+
+//////////////////////////////// image codec ////////////////////////////////
+namespace cv
+{
+
+//! @addtogroup imgcodecs
+//! @{
+
+//! Imread flags
+enum ImreadModes {
+       IMREAD_UNCHANGED            = -1, //!< If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).
+       IMREAD_GRAYSCALE            = 0,  //!< If set, always convert image to the single channel grayscale image.
+       IMREAD_COLOR                = 1,  //!< If set, always convert image to the 3 channel BGR color image.
+       IMREAD_ANYDEPTH             = 2,  //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.
+       IMREAD_ANYCOLOR             = 4,  //!< If set, the image is read in any possible color format.
+       IMREAD_LOAD_GDAL            = 8,  //!< If set, use the gdal driver for loading the image.
+       IMREAD_REDUCED_GRAYSCALE_2  = 16, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/2.
+       IMREAD_REDUCED_COLOR_2      = 17, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2.
+       IMREAD_REDUCED_GRAYSCALE_4  = 32, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/4.
+       IMREAD_REDUCED_COLOR_4      = 33, //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4.
+       IMREAD_REDUCED_GRAYSCALE_8  = 64, //!< If set, always convert image to the single channel grayscale image and the image size reduced 1/8.
+       IMREAD_REDUCED_COLOR_8      = 65  //!< If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8.
+     };
+
+//! Imwrite flags
+enum ImwriteFlags {
+       IMWRITE_JPEG_QUALITY        = 1,  //!< For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95.
+       IMWRITE_JPEG_PROGRESSIVE    = 2,  //!< Enable JPEG features, 0 or 1, default is False.
+       IMWRITE_JPEG_OPTIMIZE       = 3,  //!< Enable JPEG features, 0 or 1, default is False.
+       IMWRITE_JPEG_RST_INTERVAL   = 4,  //!< JPEG restart interval, 0 - 65535, default is 0 - no restart.
+       IMWRITE_JPEG_LUMA_QUALITY   = 5,  //!< Separate luma quality level, 0 - 100, default is 0 - don't use.
+       IMWRITE_JPEG_CHROMA_QUALITY = 6,  //!< Separate chroma quality level, 0 - 100, default is 0 - don't use.
+       IMWRITE_PNG_COMPRESSION     = 16, //!< For PNG, it can be the compression level from 0 to 9. A higher value means a smaller size and longer compression time. Default value is 3.
+       IMWRITE_PNG_STRATEGY        = 17, //!< One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_DEFAULT.
+       IMWRITE_PNG_BILEVEL         = 18, //!< Binary level PNG, 0 or 1, default is 0.
+       IMWRITE_PXM_BINARY          = 32, //!< For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1.
+       IMWRITE_WEBP_QUALITY        = 64  //!< For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used.
+     };
+
+//! Imwrite PNG specific flags used to tune the compression algorithm.
+/** These flags will be modify the way of PNG image compression and will be passed to the underlying zlib processing stage.
+
+-   The effect of IMWRITE_PNG_STRATEGY_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between IMWRITE_PNG_STRATEGY_DEFAULT and IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY.
+-   IMWRITE_PNG_STRATEGY_RLE is designed to be almost as fast as IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY, but give better compression for PNG image data.
+-   The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately.
+-   IMWRITE_PNG_STRATEGY_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
+*/
+enum ImwritePNGFlags {
+       IMWRITE_PNG_STRATEGY_DEFAULT      = 0, //!< Use this value for normal data.
+       IMWRITE_PNG_STRATEGY_FILTERED     = 1, //!< Use this value for data produced by a filter (or predictor).Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better.
+       IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2, //!< Use this value to force Huffman encoding only (no string match).
+       IMWRITE_PNG_STRATEGY_RLE          = 3, //!< Use this value to limit match distances to one (run-length encoding).
+       IMWRITE_PNG_STRATEGY_FIXED        = 4  //!< Using this value prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
+     };
+
+/** @brief Loads an image from a file.
+
+@anchor imread
+
+The function imread loads an image from the specified file and returns it. If the image cannot be
+read (because of missing file, improper permissions, unsupported or invalid format), the function
+returns an empty matrix ( Mat::data==NULL ).
+
+Currently, the following file formats are supported:
+
+-   Windows bitmaps - \*.bmp, \*.dib (always supported)
+-   JPEG files - \*.jpeg, \*.jpg, \*.jpe (see the *Notes* section)
+-   JPEG 2000 files - \*.jp2 (see the *Notes* section)
+-   Portable Network Graphics - \*.png (see the *Notes* section)
+-   WebP - \*.webp (see the *Notes* section)
+-   Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported)
+-   Sun rasters - \*.sr, \*.ras (always supported)
+-   TIFF files - \*.tiff, \*.tif (see the *Notes* section)
+-   OpenEXR Image files - \*.exr (see the *Notes* section)
+-   Radiance HDR - \*.hdr, \*.pic (always supported)
+-   Raster and Vector geospatial data supported by Gdal (see the *Notes* section)
+
+@note
+
+-   The function determines the type of an image by the content, not by the file extension.
+-   In the case of color images, the decoded images will have the channels stored in **B G R** order.
+-   On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg,
+    libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs,
+    and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware
+    that currently these native image loaders give images with different pixel values because of
+    the color management embedded into MacOSX.
+-   On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for
+    codecs supplied with an OS image. Install the relevant packages (do not forget the development
+    files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn
+    on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
+-   In the case you set *WITH_GDAL* flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image,
+    then [GDAL](http://www.gdal.org) driver will be used in order to decode the image by supporting
+    the following formats: [Raster](http://www.gdal.org/formats_list.html),
+    [Vector](http://www.gdal.org/ogr_formats.html).
+@param filename Name of file to be loaded.
+@param flags Flag that can take values of cv::ImreadModes
+*/
+CV_EXPORTS_W Mat imread( const String& filename, int flags = IMREAD_COLOR );
+
+/** @brief Loads a multi-page image from a file.
+
+The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects.
+@param filename Name of file to be loaded.
+@param flags Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR.
+@param mats A vector of Mat objects holding each page, if more than one.
+@sa cv::imread
+*/
+CV_EXPORTS_W bool imreadmulti(const String& filename, std::vector<Mat>& mats, int flags = IMREAD_ANYCOLOR);
+
+/** @brief Saves an image to a specified file.
+
+The function imwrite saves the image to the specified file. The image format is chosen based on the
+filename extension (see cv::imread for the list of extensions). Only 8-bit (or 16-bit unsigned (CV_16U)
+in case of PNG, JPEG 2000, and TIFF) single-channel or 3-channel (with 'BGR' channel order) images
+can be saved using this function. If the format, depth or channel order is different, use
+Mat::convertTo , and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O
+functions to save the image to XML or YAML format.
+
+It is possible to store PNG images with an alpha channel using this function. To do this, create
+8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels
+should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535.
+
+The sample below shows how to create such a BGRA image and store to PNG file. It also demonstrates how to set custom
+compression parameters :
+@code
+    #include <opencv2/opencv.hpp>
+
+    using namespace cv;
+    using namespace std;
+
+    void createAlphaMat(Mat &mat)
+    {
+        CV_Assert(mat.channels() == 4);
+        for (int i = 0; i < mat.rows; ++i) {
+            for (int j = 0; j < mat.cols; ++j) {
+                Vec4b& bgra = mat.at<Vec4b>(i, j);
+                bgra[0] = UCHAR_MAX; // Blue
+                bgra[1] = saturate_cast<uchar>((float (mat.cols - j)) / ((float)mat.cols) * UCHAR_MAX); // Green
+                bgra[2] = saturate_cast<uchar>((float (mat.rows - i)) / ((float)mat.rows) * UCHAR_MAX); // Red
+                bgra[3] = saturate_cast<uchar>(0.5 * (bgra[1] + bgra[2])); // Alpha
+            }
+        }
+    }
+
+    int main(int argv, char **argc)
+    {
+        // Create mat with alpha channel
+        Mat mat(480, 640, CV_8UC4);
+        createAlphaMat(mat);
+
+        vector<int> compression_params;
+        compression_params.push_back(IMWRITE_PNG_COMPRESSION);
+        compression_params.push_back(9);
+
+        try {
+            imwrite("alpha.png", mat, compression_params);
+        }
+        catch (cv::Exception& ex) {
+            fprintf(stderr, "Exception converting image to PNG format: %s\n", ex.what());
+            return 1;
+        }
+
+        fprintf(stdout, "Saved PNG file with alpha data.\n");
+        return 0;
+    }
+@endcode
+@param filename Name of the file.
+@param img Image to be saved.
+@param params Format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::ImwriteFlags
+*/
+CV_EXPORTS_W bool imwrite( const String& filename, InputArray img,
+              const std::vector<int>& params = std::vector<int>());
+
+/** @brief Reads an image from a buffer in memory.
+
+The function imdecode reads an image from the specified buffer in the memory. If the buffer is too short or
+contains invalid data, the function returns an empty matrix ( Mat::data==NULL ).
+
+See cv::imread for the list of supported formats and flags description.
+
+@note In the case of color images, the decoded images will have the channels stored in **B G R** order.
+@param buf Input array or vector of bytes.
+@param flags The same flags as in cv::imread, see cv::ImreadModes.
+*/
+CV_EXPORTS_W Mat imdecode( InputArray buf, int flags );
+
+/** @overload
+@param buf
+@param flags
+@param dst The optional output placeholder for the decoded matrix. It can save the image
+reallocations when the function is called repeatedly for images of the same size.
+*/
+CV_EXPORTS Mat imdecode( InputArray buf, int flags, Mat* dst);
+
+/** @brief Encodes an image into a memory buffer.
+
+The function imencode compresses the image and stores it in the memory buffer that is resized to fit the
+result. See cv::imwrite for the list of supported formats and flags description.
+
+@param ext File extension that defines the output format.
+@param img Image to be written.
+@param buf Output buffer resized to fit the compressed image.
+@param params Format-specific parameters. See cv::imwrite and cv::ImwriteFlags.
+*/
+CV_EXPORTS_W bool imencode( const String& ext, InputArray img,
+                            CV_OUT std::vector<uchar>& buf,
+                            const std::vector<int>& params = std::vector<int>());
+
+//! @} imgcodecs
+
+} // cv
+
+#endif //__OPENCV_IMGCODECS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp
new file mode 100644
index 0000000..a3cd232
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/imgcodecs.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h
new file mode 100644
index 0000000..ad793cc
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/imgcodecs_c.h
@@ -0,0 +1,137 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_IMGCODECS_H__
+#define __OPENCV_IMGCODECS_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** @addtogroup imgcodecs_c
+  @{
+  */
+
+enum
+{
+/* 8bit, color or not */
+    CV_LOAD_IMAGE_UNCHANGED  =-1,
+/* 8bit, gray */
+    CV_LOAD_IMAGE_GRAYSCALE  =0,
+/* ?, color */
+    CV_LOAD_IMAGE_COLOR      =1,
+/* any depth, ? */
+    CV_LOAD_IMAGE_ANYDEPTH   =2,
+/* ?, any color */
+    CV_LOAD_IMAGE_ANYCOLOR   =4
+};
+
+/* load image from file
+  iscolor can be a combination of above flags where CV_LOAD_IMAGE_UNCHANGED
+  overrides the other flags
+  using CV_LOAD_IMAGE_ANYCOLOR alone is equivalent to CV_LOAD_IMAGE_UNCHANGED
+  unless CV_LOAD_IMAGE_ANYDEPTH is specified images are converted to 8bit
+*/
+CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
+CVAPI(CvMat*) cvLoadImageM( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
+
+enum
+{
+    CV_IMWRITE_JPEG_QUALITY =1,
+    CV_IMWRITE_JPEG_PROGRESSIVE =2,
+    CV_IMWRITE_JPEG_OPTIMIZE =3,
+    CV_IMWRITE_JPEG_RST_INTERVAL =4,
+    CV_IMWRITE_JPEG_LUMA_QUALITY =5,
+    CV_IMWRITE_JPEG_CHROMA_QUALITY =6,
+    CV_IMWRITE_PNG_COMPRESSION =16,
+    CV_IMWRITE_PNG_STRATEGY =17,
+    CV_IMWRITE_PNG_BILEVEL =18,
+    CV_IMWRITE_PNG_STRATEGY_DEFAULT =0,
+    CV_IMWRITE_PNG_STRATEGY_FILTERED =1,
+    CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2,
+    CV_IMWRITE_PNG_STRATEGY_RLE =3,
+    CV_IMWRITE_PNG_STRATEGY_FIXED =4,
+    CV_IMWRITE_PXM_BINARY =32,
+    CV_IMWRITE_WEBP_QUALITY =64
+};
+
+/* save image to file */
+CVAPI(int) cvSaveImage( const char* filename, const CvArr* image,
+                        const int* params CV_DEFAULT(0) );
+
+/* decode image stored in the buffer */
+CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
+CVAPI(CvMat*) cvDecodeImageM( const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
+
+/* encode image and store the result as a byte vector (single-row 8uC1 matrix) */
+CVAPI(CvMat*) cvEncodeImage( const char* ext, const CvArr* image,
+                             const int* params CV_DEFAULT(0) );
+
+enum
+{
+    CV_CVTIMG_FLIP      =1,
+    CV_CVTIMG_SWAP_RB   =2
+};
+
+/* utility function: convert one image to another with optional vertical flip */
+CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0));
+
+CVAPI(int) cvHaveImageReader(const char* filename);
+CVAPI(int) cvHaveImageWriter(const char* filename);
+
+
+/****************************************************************************************\
+*                              Obsolete functions/synonyms                               *
+\****************************************************************************************/
+
+#define cvvLoadImage(name) cvLoadImage((name),1)
+#define cvvSaveImage cvSaveImage
+#define cvvConvertImage cvConvertImage
+
+/** @} imgcodecs_c */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __OPENCV_IMGCODECS_H__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h b/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h
new file mode 100644
index 0000000..fbd6371
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgcodecs/ios.h
@@ -0,0 +1,57 @@
+
+/*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*/
+
+#import <UIKit/UIKit.h>
+#import <Accelerate/Accelerate.h>
+#import <AVFoundation/AVFoundation.h>
+#import <ImageIO/ImageIO.h>
+#include "opencv2/core/core.hpp"
+
+//! @addtogroup imgcodecs_ios
+//! @{
+
+UIImage* MatToUIImage(const cv::Mat& image);
+void UIImageToMat(const UIImage* image,
+                         cv::Mat& m, bool alphaExist = false);
+
+//! @}
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp
new file mode 100644
index 0000000..717dcf5
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc.hpp
@@ -0,0 +1,4330 @@
+/*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*/
+
+#ifndef __OPENCV_IMGPROC_HPP__
+#define __OPENCV_IMGPROC_HPP__
+
+#include "opencv2/core.hpp"
+
+/**
+  @defgroup imgproc Image processing
+  @{
+    @defgroup imgproc_filter Image Filtering
+
+Functions and classes described in this section are used to perform various linear or non-linear
+filtering operations on 2D images (represented as Mat's). It means that for each pixel location
+\f$(x,y)\f$ in the source image (normally, rectangular), its neighborhood is considered and used to
+compute the response. In case of a linear filter, it is a weighted sum of pixel values. In case of
+morphological operations, it is the minimum or maximum values, and so on. The computed response is
+stored in the destination image at the same location \f$(x,y)\f$. It means that the output image
+will be of the same size as the input image. Normally, the functions support multi-channel arrays,
+in which case every channel is processed independently. Therefore, the output image will also have
+the same number of channels as the input one.
+
+Another common feature of the functions and classes described in this section is that, unlike
+simple arithmetic functions, they need to extrapolate values of some non-existing pixels. For
+example, if you want to smooth an image using a Gaussian \f$3 \times 3\f$ filter, then, when
+processing the left-most pixels in each row, you need pixels to the left of them, that is, outside
+of the image. You can let these pixels be the same as the left-most image pixels ("replicated
+border" extrapolation method), or assume that all the non-existing pixels are zeros ("constant
+border" extrapolation method), and so on. OpenCV enables you to specify the extrapolation method.
+For details, see cv::BorderTypes
+
+@anchor filter_depths
+### Depth combinations
+Input depth (src.depth()) | Output depth (ddepth)
+--------------------------|----------------------
+CV_8U                     | -1/CV_16S/CV_32F/CV_64F
+CV_16U/CV_16S             | -1/CV_32F/CV_64F
+CV_32F                    | -1/CV_32F/CV_64F
+CV_64F                    | -1/CV_64F
+
+@note when ddepth=-1, the output image will have the same depth as the source.
+
+    @defgroup imgproc_transform Geometric Image Transformations
+
+The functions in this section perform various geometrical transformations of 2D images. They do not
+change the image content but deform the pixel grid and map this deformed grid to the destination
+image. In fact, to avoid sampling artifacts, the mapping is done in the reverse order, from
+destination to the source. That is, for each pixel \f$(x, y)\f$ of the destination image, the
+functions compute coordinates of the corresponding "donor" pixel in the source image and copy the
+pixel value:
+
+\f[\texttt{dst} (x,y)= \texttt{src} (f_x(x,y), f_y(x,y))\f]
+
+In case when you specify the forward mapping \f$\left<g_x, g_y\right>: \texttt{src} \rightarrow
+\texttt{dst}\f$, the OpenCV functions first compute the corresponding inverse mapping
+\f$\left<f_x, f_y\right>: \texttt{dst} \rightarrow \texttt{src}\f$ and then use the above formula.
+
+The actual implementations of the geometrical transformations, from the most generic remap and to
+the simplest and the fastest resize, need to solve two main problems with the above formula:
+
+- Extrapolation of non-existing pixels. Similarly to the filtering functions described in the
+previous section, for some \f$(x,y)\f$, either one of \f$f_x(x,y)\f$, or \f$f_y(x,y)\f$, or both
+of them may fall outside of the image. In this case, an extrapolation method needs to be used.
+OpenCV provides the same selection of extrapolation methods as in the filtering functions. In
+addition, it provides the method BORDER_TRANSPARENT. This means that the corresponding pixels in
+the destination image will not be modified at all.
+
+- Interpolation of pixel values. Usually \f$f_x(x,y)\f$ and \f$f_y(x,y)\f$ are floating-point
+numbers. This means that \f$\left<f_x, f_y\right>\f$ can be either an affine or perspective
+transformation, or radial lens distortion correction, and so on. So, a pixel value at fractional
+coordinates needs to be retrieved. In the simplest case, the coordinates can be just rounded to the
+nearest integer coordinates and the corresponding pixel can be used. This is called a
+nearest-neighbor interpolation. However, a better result can be achieved by using more
+sophisticated [interpolation methods](http://en.wikipedia.org/wiki/Multivariate_interpolation) ,
+where a polynomial function is fit into some neighborhood of the computed pixel \f$(f_x(x,y),
+f_y(x,y))\f$, and then the value of the polynomial at \f$(f_x(x,y), f_y(x,y))\f$ is taken as the
+interpolated pixel value. In OpenCV, you can choose between several interpolation methods. See
+resize for details.
+
+    @defgroup imgproc_misc Miscellaneous Image Transformations
+    @defgroup imgproc_draw Drawing Functions
+
+Drawing functions work with matrices/images of arbitrary depth. The boundaries of the shapes can be
+rendered with antialiasing (implemented only for 8-bit images for now). All the functions include
+the parameter color that uses an RGB value (that may be constructed with the Scalar constructor )
+for color images and brightness for grayscale images. For color images, the channel ordering is
+normally *Blue, Green, Red*. This is what imshow, imread, and imwrite expect. So, if you form a
+color using the Scalar constructor, it should look like:
+
+\f[\texttt{Scalar} (blue \_ component, green \_ component, red \_ component[, alpha \_ component])\f]
+
+If you are using your own image rendering and I/O functions, you can use any channel ordering. The
+drawing functions process each channel independently and do not depend on the channel order or even
+on the used color space. The whole image can be converted from BGR to RGB or to a different color
+space using cvtColor .
+
+If a drawn figure is partially or completely outside the image, the drawing functions clip it. Also,
+many drawing functions can handle pixel coordinates specified with sub-pixel accuracy. This means
+that the coordinates can be passed as fixed-point numbers encoded as integers. The number of
+fractional bits is specified by the shift parameter and the real point coordinates are calculated as
+\f$\texttt{Point}(x,y)\rightarrow\texttt{Point2f}(x*2^{-shift},y*2^{-shift})\f$ . This feature is
+especially effective when rendering antialiased shapes.
+
+@note The functions do not support alpha-transparency when the target image is 4-channel. In this
+case, the color[3] is simply copied to the repainted pixels. Thus, if you want to paint
+semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main
+image.
+
+    @defgroup imgproc_colormap ColorMaps in OpenCV
+
+The human perception isn't built for observing fine changes in grayscale images. Human eyes are more
+sensitive to observing changes between colors, so you often need to recolor your grayscale images to
+get a clue about them. OpenCV now comes with various colormaps to enhance the visualization in your
+computer vision application.
+
+In OpenCV you only need applyColorMap to apply a colormap on a given image. The following sample
+code reads the path to an image from command line, applies a Jet colormap on it and shows the
+result:
+
+@code
+#include <opencv2/core.hpp>
+#include <opencv2/imgproc.hpp>
+#include <opencv2/imgcodecs.hpp>
+#include <opencv2/highgui.hpp>
+using namespace cv;
+
+#include <iostream>
+using namespace std;
+
+int main(int argc, const char *argv[])
+{
+    // We need an input image. (can be grayscale or color)
+    if (argc < 2)
+    {
+        cerr << "We need an image to process here. Please run: colorMap [path_to_image]" << endl;
+        return -1;
+    }
+    Mat img_in = imread(argv[1]);
+    if(img_in.empty())
+    {
+        cerr << "Sample image (" << argv[1] << ") is empty. Please adjust your path, so it points to a valid input image!" << endl;
+        return -1;
+    }
+    // Holds the colormap version of the image:
+    Mat img_color;
+    // Apply the colormap:
+    applyColorMap(img_in, img_color, COLORMAP_JET);
+    // Show the result:
+    imshow("colorMap", img_color);
+    waitKey(0);
+    return 0;
+}
+@endcode
+
+@see cv::ColormapTypes
+
+    @defgroup imgproc_hist Histograms
+    @defgroup imgproc_shape Structural Analysis and Shape Descriptors
+    @defgroup imgproc_motion Motion Analysis and Object Tracking
+    @defgroup imgproc_feature Feature Detection
+    @defgroup imgproc_object Object Detection
+    @defgroup imgproc_c C API
+  @}
+*/
+
+namespace cv
+{
+
+/** @addtogroup imgproc
+@{
+*/
+
+//! @addtogroup imgproc_filter
+//! @{
+
+//! type of morphological operation
+enum MorphTypes{
+    MORPH_ERODE    = 0, //!< see cv::erode
+    MORPH_DILATE   = 1, //!< see cv::dilate
+    MORPH_OPEN     = 2, //!< an opening operation
+                        //!< \f[\texttt{dst} = \mathrm{open} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \mathrm{erode} ( \texttt{src} , \texttt{element} ))\f]
+    MORPH_CLOSE    = 3, //!< a closing operation
+                        //!< \f[\texttt{dst} = \mathrm{close} ( \texttt{src} , \texttt{element} )= \mathrm{erode} ( \mathrm{dilate} ( \texttt{src} , \texttt{element} ))\f]
+    MORPH_GRADIENT = 4, //!< a morphological gradient
+                        //!< \f[\texttt{dst} = \mathrm{morph\_grad} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \texttt{src} , \texttt{element} )- \mathrm{erode} ( \texttt{src} , \texttt{element} )\f]
+    MORPH_TOPHAT   = 5, //!< "top hat"
+                        //!< \f[\texttt{dst} = \mathrm{tophat} ( \texttt{src} , \texttt{element} )= \texttt{src} - \mathrm{open} ( \texttt{src} , \texttt{element} )\f]
+    MORPH_BLACKHAT = 6, //!< "black hat"
+                        //!< \f[\texttt{dst} = \mathrm{blackhat} ( \texttt{src} , \texttt{element} )= \mathrm{close} ( \texttt{src} , \texttt{element} )- \texttt{src}\f]
+    MORPH_HITMISS  = 7  //!< "hit and miss"
+                        //!<   .- Only supported for CV_8UC1 binary images. Tutorial can be found in [this page](http://opencv-code.com/tutorials/hit-or-miss-transform-in-opencv/)
+};
+
+//! shape of the structuring element
+enum MorphShapes {
+    MORPH_RECT    = 0, //!< a rectangular structuring element:  \f[E_{ij}=1\f]
+    MORPH_CROSS   = 1, //!< a cross-shaped structuring element:
+                       //!< \f[E_{ij} =  \fork{1}{if i=\texttt{anchor.y} or j=\texttt{anchor.x}}{0}{otherwise}\f]
+    MORPH_ELLIPSE = 2 //!< an elliptic structuring element, that is, a filled ellipse inscribed
+                      //!< into the rectangle Rect(0, 0, esize.width, 0.esize.height)
+};
+
+//! @} imgproc_filter
+
+//! @addtogroup imgproc_transform
+//! @{
+
+//! interpolation algorithm
+enum InterpolationFlags{
+    /** nearest neighbor interpolation */
+    INTER_NEAREST        = 0,
+    /** bilinear interpolation */
+    INTER_LINEAR         = 1,
+    /** bicubic interpolation */
+    INTER_CUBIC          = 2,
+    /** resampling using pixel area relation. It may be a preferred method for image decimation, as
+    it gives moire'-free results. But when the image is zoomed, it is similar to the INTER_NEAREST
+    method. */
+    INTER_AREA           = 3,
+    /** Lanczos interpolation over 8x8 neighborhood */
+    INTER_LANCZOS4       = 4,
+    /** mask for interpolation codes */
+    INTER_MAX            = 7,
+    /** flag, fills all of the destination image pixels. If some of them correspond to outliers in the
+    source image, they are set to zero */
+    WARP_FILL_OUTLIERS   = 8,
+    /** flag, inverse transformation
+
+    For example, polar transforms:
+    - flag is __not__ set: \f$dst( \phi , \rho ) = src(x,y)\f$
+    - flag is set: \f$dst(x,y) = src( \phi , \rho )\f$
+    */
+    WARP_INVERSE_MAP     = 16
+};
+
+enum InterpolationMasks {
+       INTER_BITS      = 5,
+       INTER_BITS2     = INTER_BITS * 2,
+       INTER_TAB_SIZE  = 1 << INTER_BITS,
+       INTER_TAB_SIZE2 = INTER_TAB_SIZE * INTER_TAB_SIZE
+     };
+
+//! @} imgproc_transform
+
+//! @addtogroup imgproc_misc
+//! @{
+
+//! Distance types for Distance Transform and M-estimators
+//! @see cv::distanceTransform, cv::fitLine
+enum DistanceTypes {
+    DIST_USER    = -1,  //!< User defined distance
+    DIST_L1      = 1,   //!< distance = |x1-x2| + |y1-y2|
+    DIST_L2      = 2,   //!< the simple euclidean distance
+    DIST_C       = 3,   //!< distance = max(|x1-x2|,|y1-y2|)
+    DIST_L12     = 4,   //!< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1))
+    DIST_FAIR    = 5,   //!< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998
+    DIST_WELSCH  = 6,   //!< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846
+    DIST_HUBER   = 7    //!< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345
+};
+
+//! Mask size for distance transform
+enum DistanceTransformMasks {
+    DIST_MASK_3       = 3, //!< mask=3
+    DIST_MASK_5       = 5, //!< mask=5
+    DIST_MASK_PRECISE = 0  //!<
+};
+
+//! type of the threshold operation
+//! ![threshold types](pics/threshold.png)
+enum ThresholdTypes {
+    THRESH_BINARY     = 0, //!< \f[\texttt{dst} (x,y) =  \fork{\texttt{maxval}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f]
+    THRESH_BINARY_INV = 1, //!< \f[\texttt{dst} (x,y) =  \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{maxval}}{otherwise}\f]
+    THRESH_TRUNC      = 2, //!< \f[\texttt{dst} (x,y) =  \fork{\texttt{threshold}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f]
+    THRESH_TOZERO     = 3, //!< \f[\texttt{dst} (x,y) =  \fork{\texttt{src}(x,y)}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f]
+    THRESH_TOZERO_INV = 4, //!< \f[\texttt{dst} (x,y) =  \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f]
+    THRESH_MASK       = 7,
+    THRESH_OTSU       = 8, //!< flag, use Otsu algorithm to choose the optimal threshold value
+    THRESH_TRIANGLE   = 16 //!< flag, use Triangle algorithm to choose the optimal threshold value
+};
+
+//! adaptive threshold algorithm
+//! see cv::adaptiveThreshold
+enum AdaptiveThresholdTypes {
+    /** the threshold value \f$T(x,y)\f$ is a mean of the \f$\texttt{blockSize} \times
+    \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$ minus C */
+    ADAPTIVE_THRESH_MEAN_C     = 0,
+    /** the threshold value \f$T(x, y)\f$ is a weighted sum (cross-correlation with a Gaussian
+    window) of the \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$
+    minus C . The default sigma (standard deviation) is used for the specified blockSize . See
+    cv::getGaussianKernel*/
+    ADAPTIVE_THRESH_GAUSSIAN_C = 1
+};
+
+//! cv::undistort mode
+enum UndistortTypes {
+       PROJ_SPHERICAL_ORTHO  = 0,
+       PROJ_SPHERICAL_EQRECT = 1
+     };
+
+//! class of the pixel in GrabCut algorithm
+enum GrabCutClasses {
+    GC_BGD    = 0,  //!< an obvious background pixels
+    GC_FGD    = 1,  //!< an obvious foreground (object) pixel
+    GC_PR_BGD = 2,  //!< a possible background pixel
+    GC_PR_FGD = 3   //!< a possible foreground pixel
+};
+
+//! GrabCut algorithm flags
+enum GrabCutModes {
+    /** The function initializes the state and the mask using the provided rectangle. After that it
+    runs iterCount iterations of the algorithm. */
+    GC_INIT_WITH_RECT  = 0,
+    /** The function initializes the state using the provided mask. Note that GC_INIT_WITH_RECT
+    and GC_INIT_WITH_MASK can be combined. Then, all the pixels outside of the ROI are
+    automatically initialized with GC_BGD .*/
+    GC_INIT_WITH_MASK  = 1,
+    /** The value means that the algorithm should just resume. */
+    GC_EVAL            = 2
+};
+
+//! distanceTransform algorithm flags
+enum DistanceTransformLabelTypes {
+    /** each connected component of zeros in src (as well as all the non-zero pixels closest to the
+    connected component) will be assigned the same label */
+    DIST_LABEL_CCOMP = 0,
+    /** each zero pixel (and all the non-zero pixels closest to it) gets its own label. */
+    DIST_LABEL_PIXEL = 1
+};
+
+//! floodfill algorithm flags
+enum FloodFillFlags {
+    /** If set, the difference between the current pixel and seed pixel is considered. Otherwise,
+    the difference between neighbor pixels is considered (that is, the range is floating). */
+    FLOODFILL_FIXED_RANGE = 1 << 16,
+    /** If set, the function does not change the image ( newVal is ignored), and only fills the
+    mask with the value specified in bits 8-16 of flags as described above. This option only make
+    sense in function variants that have the mask parameter. */
+    FLOODFILL_MASK_ONLY   = 1 << 17
+};
+
+//! @} imgproc_misc
+
+//! @addtogroup imgproc_shape
+//! @{
+
+//! connected components algorithm output formats
+enum ConnectedComponentsTypes {
+    CC_STAT_LEFT   = 0, //!< The leftmost (x) coordinate which is the inclusive start of the bounding
+                        //!< box in the horizontal direction.
+    CC_STAT_TOP    = 1, //!< The topmost (y) coordinate which is the inclusive start of the bounding
+                        //!< box in the vertical direction.
+    CC_STAT_WIDTH  = 2, //!< The horizontal size of the bounding box
+    CC_STAT_HEIGHT = 3, //!< The vertical size of the bounding box
+    CC_STAT_AREA   = 4, //!< The total area (in pixels) of the connected component
+    CC_STAT_MAX    = 5
+};
+
+//! mode of the contour retrieval algorithm
+enum RetrievalModes {
+    /** retrieves only the extreme outer contours. It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for
+    all the contours. */
+    RETR_EXTERNAL  = 0,
+    /** retrieves all of the contours without establishing any hierarchical relationships. */
+    RETR_LIST      = 1,
+    /** retrieves all of the contours and organizes them into a two-level hierarchy. At the top
+    level, there are external boundaries of the components. At the second level, there are
+    boundaries of the holes. If there is another contour inside a hole of a connected component, it
+    is still put at the top level. */
+    RETR_CCOMP     = 2,
+    /** retrieves all of the contours and reconstructs a full hierarchy of nested contours.*/
+    RETR_TREE      = 3,
+    RETR_FLOODFILL = 4 //!<
+};
+
+//! the contour approximation algorithm
+enum ContourApproximationModes {
+    /** stores absolutely all the contour points. That is, any 2 subsequent points (x1,y1) and
+    (x2,y2) of the contour will be either horizontal, vertical or diagonal neighbors, that is,
+    max(abs(x1-x2),abs(y2-y1))==1. */
+    CHAIN_APPROX_NONE      = 1,
+    /** compresses horizontal, vertical, and diagonal segments and leaves only their end points.
+    For example, an up-right rectangular contour is encoded with 4 points. */
+    CHAIN_APPROX_SIMPLE    = 2,
+    /** applies one of the flavors of the Teh-Chin chain approximation algorithm @cite TehChin89 */
+    CHAIN_APPROX_TC89_L1   = 3,
+    /** applies one of the flavors of the Teh-Chin chain approximation algorithm @cite TehChin89 */
+    CHAIN_APPROX_TC89_KCOS = 4
+};
+
+//! @} imgproc_shape
+
+//! Variants of a Hough transform
+enum HoughModes {
+
+    /** classical or standard Hough transform. Every line is represented by two floating-point
+    numbers \f$(\rho, \theta)\f$ , where \f$\rho\f$ is a distance between (0,0) point and the line,
+    and \f$\theta\f$ is the angle between x-axis and the normal to the line. Thus, the matrix must
+    be (the created sequence will be) of CV_32FC2 type */
+    HOUGH_STANDARD      = 0,
+    /** probabilistic Hough transform (more efficient in case if the picture contains a few long
+    linear segments). It returns line segments rather than the whole line. Each segment is
+    represented by starting and ending points, and the matrix must be (the created sequence will
+    be) of the CV_32SC4 type. */
+    HOUGH_PROBABILISTIC = 1,
+    /** multi-scale variant of the classical Hough transform. The lines are encoded the same way as
+    HOUGH_STANDARD. */
+    HOUGH_MULTI_SCALE   = 2,
+    HOUGH_GRADIENT      = 3 //!< basically *21HT*, described in @cite Yuen90
+};
+
+//! Variants of Line Segment %Detector
+//! @ingroup imgproc_feature
+enum LineSegmentDetectorModes {
+    LSD_REFINE_NONE = 0, //!< No refinement applied
+    LSD_REFINE_STD  = 1, //!< Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations.
+    LSD_REFINE_ADV  = 2  //!< Advanced refinement. Number of false alarms is calculated, lines are
+                         //!< refined through increase of precision, decrement in size, etc.
+};
+
+/** Histogram comparison methods
+  @ingroup imgproc_hist
+*/
+enum HistCompMethods {
+    /** Correlation
+    \f[d(H_1,H_2) =  \frac{\sum_I (H_1(I) - \bar{H_1}) (H_2(I) - \bar{H_2})}{\sqrt{\sum_I(H_1(I) - \bar{H_1})^2 \sum_I(H_2(I) - \bar{H_2})^2}}\f]
+    where
+    \f[\bar{H_k} =  \frac{1}{N} \sum _J H_k(J)\f]
+    and \f$N\f$ is a total number of histogram bins. */
+    HISTCMP_CORREL        = 0,
+    /** Chi-Square
+    \f[d(H_1,H_2) =  \sum _I  \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)}\f] */
+    HISTCMP_CHISQR        = 1,
+    /** Intersection
+    \f[d(H_1,H_2) =  \sum _I  \min (H_1(I), H_2(I))\f] */
+    HISTCMP_INTERSECT     = 2,
+    /** Bhattacharyya distance
+    (In fact, OpenCV computes Hellinger distance, which is related to Bhattacharyya coefficient.)
+    \f[d(H_1,H_2) =  \sqrt{1 - \frac{1}{\sqrt{\bar{H_1} \bar{H_2} N^2}} \sum_I \sqrt{H_1(I) \cdot H_2(I)}}\f] */
+    HISTCMP_BHATTACHARYYA = 3,
+    HISTCMP_HELLINGER     = HISTCMP_BHATTACHARYYA, //!< Synonym for HISTCMP_BHATTACHARYYA
+    /** Alternative Chi-Square
+    \f[d(H_1,H_2) =  2 * \sum _I  \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)+H_2(I)}\f]
+    This alternative formula is regularly used for texture comparison. See e.g. @cite Puzicha1997 */
+    HISTCMP_CHISQR_ALT    = 4,
+    /** Kullback-Leibler divergence
+    \f[d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)\f] */
+    HISTCMP_KL_DIV        = 5
+};
+
+/** the color conversion code
+@see @ref imgproc_color_conversions
+@ingroup imgproc_misc
+ */
+enum ColorConversionCodes {
+    COLOR_BGR2BGRA     = 0, //!< add alpha channel to RGB or BGR image
+    COLOR_RGB2RGBA     = COLOR_BGR2BGRA,
+
+    COLOR_BGRA2BGR     = 1, //!< remove alpha channel from RGB or BGR image
+    COLOR_RGBA2RGB     = COLOR_BGRA2BGR,
+
+    COLOR_BGR2RGBA     = 2, //!< convert between RGB and BGR color spaces (with or without alpha channel)
+    COLOR_RGB2BGRA     = COLOR_BGR2RGBA,
+
+    COLOR_RGBA2BGR     = 3,
+    COLOR_BGRA2RGB     = COLOR_RGBA2BGR,
+
+    COLOR_BGR2RGB      = 4,
+    COLOR_RGB2BGR      = COLOR_BGR2RGB,
+
+    COLOR_BGRA2RGBA    = 5,
+    COLOR_RGBA2BGRA    = COLOR_BGRA2RGBA,
+
+    COLOR_BGR2GRAY     = 6, //!< convert between RGB/BGR and grayscale, @ref color_convert_rgb_gray "color conversions"
+    COLOR_RGB2GRAY     = 7,
+    COLOR_GRAY2BGR     = 8,
+    COLOR_GRAY2RGB     = COLOR_GRAY2BGR,
+    COLOR_GRAY2BGRA    = 9,
+    COLOR_GRAY2RGBA    = COLOR_GRAY2BGRA,
+    COLOR_BGRA2GRAY    = 10,
+    COLOR_RGBA2GRAY    = 11,
+
+    COLOR_BGR2BGR565   = 12, //!< convert between RGB/BGR and BGR565 (16-bit images)
+    COLOR_RGB2BGR565   = 13,
+    COLOR_BGR5652BGR   = 14,
+    COLOR_BGR5652RGB   = 15,
+    COLOR_BGRA2BGR565  = 16,
+    COLOR_RGBA2BGR565  = 17,
+    COLOR_BGR5652BGRA  = 18,
+    COLOR_BGR5652RGBA  = 19,
+
+    COLOR_GRAY2BGR565  = 20, //!< convert between grayscale to BGR565 (16-bit images)
+    COLOR_BGR5652GRAY  = 21,
+
+    COLOR_BGR2BGR555   = 22,  //!< convert between RGB/BGR and BGR555 (16-bit images)
+    COLOR_RGB2BGR555   = 23,
+    COLOR_BGR5552BGR   = 24,
+    COLOR_BGR5552RGB   = 25,
+    COLOR_BGRA2BGR555  = 26,
+    COLOR_RGBA2BGR555  = 27,
+    COLOR_BGR5552BGRA  = 28,
+    COLOR_BGR5552RGBA  = 29,
+
+    COLOR_GRAY2BGR555  = 30, //!< convert between grayscale and BGR555 (16-bit images)
+    COLOR_BGR5552GRAY  = 31,
+
+    COLOR_BGR2XYZ      = 32, //!< convert RGB/BGR to CIE XYZ, @ref color_convert_rgb_xyz "color conversions"
+    COLOR_RGB2XYZ      = 33,
+    COLOR_XYZ2BGR      = 34,
+    COLOR_XYZ2RGB      = 35,
+
+    COLOR_BGR2YCrCb    = 36, //!< convert RGB/BGR to luma-chroma (aka YCC), @ref color_convert_rgb_ycrcb "color conversions"
+    COLOR_RGB2YCrCb    = 37,
+    COLOR_YCrCb2BGR    = 38,
+    COLOR_YCrCb2RGB    = 39,
+
+    COLOR_BGR2HSV      = 40, //!< convert RGB/BGR to HSV (hue saturation value), @ref color_convert_rgb_hsv "color conversions"
+    COLOR_RGB2HSV      = 41,
+
+    COLOR_BGR2Lab      = 44, //!< convert RGB/BGR to CIE Lab, @ref color_convert_rgb_lab "color conversions"
+    COLOR_RGB2Lab      = 45,
+
+    COLOR_BGR2Luv      = 50, //!< convert RGB/BGR to CIE Luv, @ref color_convert_rgb_luv "color conversions"
+    COLOR_RGB2Luv      = 51,
+    COLOR_BGR2HLS      = 52, //!< convert RGB/BGR to HLS (hue lightness saturation), @ref color_convert_rgb_hls "color conversions"
+    COLOR_RGB2HLS      = 53,
+
+    COLOR_HSV2BGR      = 54, //!< backward conversions to RGB/BGR
+    COLOR_HSV2RGB      = 55,
+
+    COLOR_Lab2BGR      = 56,
+    COLOR_Lab2RGB      = 57,
+    COLOR_Luv2BGR      = 58,
+    COLOR_Luv2RGB      = 59,
+    COLOR_HLS2BGR      = 60,
+    COLOR_HLS2RGB      = 61,
+
+    COLOR_BGR2HSV_FULL = 66, //!<
+    COLOR_RGB2HSV_FULL = 67,
+    COLOR_BGR2HLS_FULL = 68,
+    COLOR_RGB2HLS_FULL = 69,
+
+    COLOR_HSV2BGR_FULL = 70,
+    COLOR_HSV2RGB_FULL = 71,
+    COLOR_HLS2BGR_FULL = 72,
+    COLOR_HLS2RGB_FULL = 73,
+
+    COLOR_LBGR2Lab     = 74,
+    COLOR_LRGB2Lab     = 75,
+    COLOR_LBGR2Luv     = 76,
+    COLOR_LRGB2Luv     = 77,
+
+    COLOR_Lab2LBGR     = 78,
+    COLOR_Lab2LRGB     = 79,
+    COLOR_Luv2LBGR     = 80,
+    COLOR_Luv2LRGB     = 81,
+
+    COLOR_BGR2YUV      = 82, //!< convert between RGB/BGR and YUV
+    COLOR_RGB2YUV      = 83,
+    COLOR_YUV2BGR      = 84,
+    COLOR_YUV2RGB      = 85,
+
+    //! YUV 4:2:0 family to RGB
+    COLOR_YUV2RGB_NV12  = 90,
+    COLOR_YUV2BGR_NV12  = 91,
+    COLOR_YUV2RGB_NV21  = 92,
+    COLOR_YUV2BGR_NV21  = 93,
+    COLOR_YUV420sp2RGB  = COLOR_YUV2RGB_NV21,
+    COLOR_YUV420sp2BGR  = COLOR_YUV2BGR_NV21,
+
+    COLOR_YUV2RGBA_NV12 = 94,
+    COLOR_YUV2BGRA_NV12 = 95,
+    COLOR_YUV2RGBA_NV21 = 96,
+    COLOR_YUV2BGRA_NV21 = 97,
+    COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21,
+    COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21,
+
+    COLOR_YUV2RGB_YV12  = 98,
+    COLOR_YUV2BGR_YV12  = 99,
+    COLOR_YUV2RGB_IYUV  = 100,
+    COLOR_YUV2BGR_IYUV  = 101,
+    COLOR_YUV2RGB_I420  = COLOR_YUV2RGB_IYUV,
+    COLOR_YUV2BGR_I420  = COLOR_YUV2BGR_IYUV,
+    COLOR_YUV420p2RGB   = COLOR_YUV2RGB_YV12,
+    COLOR_YUV420p2BGR   = COLOR_YUV2BGR_YV12,
+
+    COLOR_YUV2RGBA_YV12 = 102,
+    COLOR_YUV2BGRA_YV12 = 103,
+    COLOR_YUV2RGBA_IYUV = 104,
+    COLOR_YUV2BGRA_IYUV = 105,
+    COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV,
+    COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV,
+    COLOR_YUV420p2RGBA  = COLOR_YUV2RGBA_YV12,
+    COLOR_YUV420p2BGRA  = COLOR_YUV2BGRA_YV12,
+
+    COLOR_YUV2GRAY_420  = 106,
+    COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420,
+    COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420,
+    COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420,
+    COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420,
+    COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420,
+    COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420,
+    COLOR_YUV420p2GRAY  = COLOR_YUV2GRAY_420,
+
+    //! YUV 4:2:2 family to RGB
+    COLOR_YUV2RGB_UYVY = 107,
+    COLOR_YUV2BGR_UYVY = 108,
+    //COLOR_YUV2RGB_VYUY = 109,
+    //COLOR_YUV2BGR_VYUY = 110,
+    COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY,
+    COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY,
+    COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY,
+    COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY,
+
+    COLOR_YUV2RGBA_UYVY = 111,
+    COLOR_YUV2BGRA_UYVY = 112,
+    //COLOR_YUV2RGBA_VYUY = 113,
+    //COLOR_YUV2BGRA_VYUY = 114,
+    COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY,
+    COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY,
+    COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY,
+    COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY,
+
+    COLOR_YUV2RGB_YUY2 = 115,
+    COLOR_YUV2BGR_YUY2 = 116,
+    COLOR_YUV2RGB_YVYU = 117,
+    COLOR_YUV2BGR_YVYU = 118,
+    COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2,
+    COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2,
+    COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2,
+    COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2,
+
+    COLOR_YUV2RGBA_YUY2 = 119,
+    COLOR_YUV2BGRA_YUY2 = 120,
+    COLOR_YUV2RGBA_YVYU = 121,
+    COLOR_YUV2BGRA_YVYU = 122,
+    COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2,
+    COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2,
+    COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2,
+    COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2,
+
+    COLOR_YUV2GRAY_UYVY = 123,
+    COLOR_YUV2GRAY_YUY2 = 124,
+    //CV_YUV2GRAY_VYUY    = CV_YUV2GRAY_UYVY,
+    COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY,
+    COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY,
+    COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2,
+    COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2,
+    COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2,
+
+    //! alpha premultiplication
+    COLOR_RGBA2mRGBA    = 125,
+    COLOR_mRGBA2RGBA    = 126,
+
+    //! RGB to YUV 4:2:0 family
+    COLOR_RGB2YUV_I420  = 127,
+    COLOR_BGR2YUV_I420  = 128,
+    COLOR_RGB2YUV_IYUV  = COLOR_RGB2YUV_I420,
+    COLOR_BGR2YUV_IYUV  = COLOR_BGR2YUV_I420,
+
+    COLOR_RGBA2YUV_I420 = 129,
+    COLOR_BGRA2YUV_I420 = 130,
+    COLOR_RGBA2YUV_IYUV = COLOR_RGBA2YUV_I420,
+    COLOR_BGRA2YUV_IYUV = COLOR_BGRA2YUV_I420,
+    COLOR_RGB2YUV_YV12  = 131,
+    COLOR_BGR2YUV_YV12  = 132,
+    COLOR_RGBA2YUV_YV12 = 133,
+    COLOR_BGRA2YUV_YV12 = 134,
+
+    //! Demosaicing
+    COLOR_BayerBG2BGR = 46,
+    COLOR_BayerGB2BGR = 47,
+    COLOR_BayerRG2BGR = 48,
+    COLOR_BayerGR2BGR = 49,
+
+    COLOR_BayerBG2RGB = COLOR_BayerRG2BGR,
+    COLOR_BayerGB2RGB = COLOR_BayerGR2BGR,
+    COLOR_BayerRG2RGB = COLOR_BayerBG2BGR,
+    COLOR_BayerGR2RGB = COLOR_BayerGB2BGR,
+
+    COLOR_BayerBG2GRAY = 86,
+    COLOR_BayerGB2GRAY = 87,
+    COLOR_BayerRG2GRAY = 88,
+    COLOR_BayerGR2GRAY = 89,
+
+    //! Demosaicing using Variable Number of Gradients
+    COLOR_BayerBG2BGR_VNG = 62,
+    COLOR_BayerGB2BGR_VNG = 63,
+    COLOR_BayerRG2BGR_VNG = 64,
+    COLOR_BayerGR2BGR_VNG = 65,
+
+    COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG,
+    COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG,
+    COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG,
+    COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG,
+
+    //! Edge-Aware Demosaicing
+    COLOR_BayerBG2BGR_EA  = 135,
+    COLOR_BayerGB2BGR_EA  = 136,
+    COLOR_BayerRG2BGR_EA  = 137,
+    COLOR_BayerGR2BGR_EA  = 138,
+
+    COLOR_BayerBG2RGB_EA  = COLOR_BayerRG2BGR_EA,
+    COLOR_BayerGB2RGB_EA  = COLOR_BayerGR2BGR_EA,
+    COLOR_BayerRG2RGB_EA  = COLOR_BayerBG2BGR_EA,
+    COLOR_BayerGR2RGB_EA  = COLOR_BayerGB2BGR_EA,
+
+
+    COLOR_COLORCVT_MAX  = 139
+};
+
+/** types of intersection between rectangles
+@ingroup imgproc_shape
+*/
+enum RectanglesIntersectTypes {
+    INTERSECT_NONE = 0, //!< No intersection
+    INTERSECT_PARTIAL  = 1, //!< There is a partial intersection
+    INTERSECT_FULL  = 2 //!< One of the rectangle is fully enclosed in the other
+};
+
+//! finds arbitrary template in the grayscale image using Generalized Hough Transform
+class CV_EXPORTS GeneralizedHough : public Algorithm
+{
+public:
+    //! set template to search
+    virtual void setTemplate(InputArray templ, Point templCenter = Point(-1, -1)) = 0;
+    virtual void setTemplate(InputArray edges, InputArray dx, InputArray dy, Point templCenter = Point(-1, -1)) = 0;
+
+    //! find template on image
+    virtual void detect(InputArray image, OutputArray positions, OutputArray votes = noArray()) = 0;
+    virtual void detect(InputArray edges, InputArray dx, InputArray dy, OutputArray positions, OutputArray votes = noArray()) = 0;
+
+    //! Canny low threshold.
+    virtual void setCannyLowThresh(int cannyLowThresh) = 0;
+    virtual int getCannyLowThresh() const = 0;
+
+    //! Canny high threshold.
+    virtual void setCannyHighThresh(int cannyHighThresh) = 0;
+    virtual int getCannyHighThresh() const = 0;
+
+    //! Minimum distance between the centers of the detected objects.
+    virtual void setMinDist(double minDist) = 0;
+    virtual double getMinDist() const = 0;
+
+    //! Inverse ratio of the accumulator resolution to the image resolution.
+    virtual void setDp(double dp) = 0;
+    virtual double getDp() const = 0;
+
+    //! Maximal size of inner buffers.
+    virtual void setMaxBufferSize(int maxBufferSize) = 0;
+    virtual int getMaxBufferSize() const = 0;
+};
+
+//! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122.
+//! Detects position only without traslation and rotation
+class CV_EXPORTS GeneralizedHoughBallard : public GeneralizedHough
+{
+public:
+    //! R-Table levels.
+    virtual void setLevels(int levels) = 0;
+    virtual int getLevels() const = 0;
+
+    //! The accumulator threshold for the template centers at the detection stage. The smaller it is, the more false positions may be detected.
+    virtual void setVotesThreshold(int votesThreshold) = 0;
+    virtual int getVotesThreshold() const = 0;
+};
+
+//! Guil, N., Gonz谩lez-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038.
+//! Detects position, traslation and rotation
+class CV_EXPORTS GeneralizedHoughGuil : public GeneralizedHough
+{
+public:
+    //! Angle difference in degrees between two points in feature.
+    virtual void setXi(double xi) = 0;
+    virtual double getXi() const = 0;
+
+    //! Feature table levels.
+    virtual void setLevels(int levels) = 0;
+    virtual int getLevels() const = 0;
+
+    //! Maximal difference between angles that treated as equal.
+    virtual void setAngleEpsilon(double angleEpsilon) = 0;
+    virtual double getAngleEpsilon() const = 0;
+
+    //! Minimal rotation angle to detect in degrees.
+    virtual void setMinAngle(double minAngle) = 0;
+    virtual double getMinAngle() const = 0;
+
+    //! Maximal rotation angle to detect in degrees.
+    virtual void setMaxAngle(double maxAngle) = 0;
+    virtual double getMaxAngle() const = 0;
+
+    //! Angle step in degrees.
+    virtual void setAngleStep(double angleStep) = 0;
+    virtual double getAngleStep() const = 0;
+
+    //! Angle votes threshold.
+    virtual void setAngleThresh(int angleThresh) = 0;
+    virtual int getAngleThresh() const = 0;
+
+    //! Minimal scale to detect.
+    virtual void setMinScale(double minScale) = 0;
+    virtual double getMinScale() const = 0;
+
+    //! Maximal scale to detect.
+    virtual void setMaxScale(double maxScale) = 0;
+    virtual double getMaxScale() const = 0;
+
+    //! Scale step.
+    virtual void setScaleStep(double scaleStep) = 0;
+    virtual double getScaleStep() const = 0;
+
+    //! Scale votes threshold.
+    virtual void setScaleThresh(int scaleThresh) = 0;
+    virtual int getScaleThresh() const = 0;
+
+    //! Position votes threshold.
+    virtual void setPosThresh(int posThresh) = 0;
+    virtual int getPosThresh() const = 0;
+};
+
+
+class CV_EXPORTS_W CLAHE : public Algorithm
+{
+public:
+    CV_WRAP virtual void apply(InputArray src, OutputArray dst) = 0;
+
+    CV_WRAP virtual void setClipLimit(double clipLimit) = 0;
+    CV_WRAP virtual double getClipLimit() const = 0;
+
+    CV_WRAP virtual void setTilesGridSize(Size tileGridSize) = 0;
+    CV_WRAP virtual Size getTilesGridSize() const = 0;
+
+    CV_WRAP virtual void collectGarbage() = 0;
+};
+
+
+class CV_EXPORTS_W Subdiv2D
+{
+public:
+    enum { PTLOC_ERROR        = -2,
+           PTLOC_OUTSIDE_RECT = -1,
+           PTLOC_INSIDE       = 0,
+           PTLOC_VERTEX       = 1,
+           PTLOC_ON_EDGE      = 2
+         };
+
+    enum { NEXT_AROUND_ORG   = 0x00,
+           NEXT_AROUND_DST   = 0x22,
+           PREV_AROUND_ORG   = 0x11,
+           PREV_AROUND_DST   = 0x33,
+           NEXT_AROUND_LEFT  = 0x13,
+           NEXT_AROUND_RIGHT = 0x31,
+           PREV_AROUND_LEFT  = 0x20,
+           PREV_AROUND_RIGHT = 0x02
+         };
+
+    CV_WRAP Subdiv2D();
+    CV_WRAP Subdiv2D(Rect rect);
+    CV_WRAP void initDelaunay(Rect rect);
+
+    CV_WRAP int insert(Point2f pt);
+    CV_WRAP void insert(const std::vector<Point2f>& ptvec);
+    CV_WRAP int locate(Point2f pt, CV_OUT int& edge, CV_OUT int& vertex);
+
+    CV_WRAP int findNearest(Point2f pt, CV_OUT Point2f* nearestPt = 0);
+    CV_WRAP void getEdgeList(CV_OUT std::vector<Vec4f>& edgeList) const;
+    CV_WRAP void getTriangleList(CV_OUT std::vector<Vec6f>& triangleList) const;
+    CV_WRAP void getVoronoiFacetList(const std::vector<int>& idx, CV_OUT std::vector<std::vector<Point2f> >& facetList,
+                                     CV_OUT std::vector<Point2f>& facetCenters);
+
+    CV_WRAP Point2f getVertex(int vertex, CV_OUT int* firstEdge = 0) const;
+
+    CV_WRAP int getEdge( int edge, int nextEdgeType ) const;
+    CV_WRAP int nextEdge(int edge) const;
+    CV_WRAP int rotateEdge(int edge, int rotate) const;
+    CV_WRAP int symEdge(int edge) const;
+    CV_WRAP int edgeOrg(int edge, CV_OUT Point2f* orgpt = 0) const;
+    CV_WRAP int edgeDst(int edge, CV_OUT Point2f* dstpt = 0) const;
+
+protected:
+    int newEdge();
+    void deleteEdge(int edge);
+    int newPoint(Point2f pt, bool isvirtual, int firstEdge = 0);
+    void deletePoint(int vtx);
+    void setEdgePoints( int edge, int orgPt, int dstPt );
+    void splice( int edgeA, int edgeB );
+    int connectEdges( int edgeA, int edgeB );
+    void swapEdges( int edge );
+    int isRightOf(Point2f pt, int edge) const;
+    void calcVoronoi();
+    void clearVoronoi();
+    void checkSubdiv() const;
+
+    struct CV_EXPORTS Vertex
+    {
+        Vertex();
+        Vertex(Point2f pt, bool _isvirtual, int _firstEdge=0);
+        bool isvirtual() const;
+        bool isfree() const;
+
+        int firstEdge;
+        int type;
+        Point2f pt;
+    };
+
+    struct CV_EXPORTS QuadEdge
+    {
+        QuadEdge();
+        QuadEdge(int edgeidx);
+        bool isfree() const;
+
+        int next[4];
+        int pt[4];
+    };
+
+    std::vector<Vertex> vtx;
+    std::vector<QuadEdge> qedges;
+    int freeQEdge;
+    int freePoint;
+    bool validGeometry;
+
+    int recentEdge;
+    Point2f topLeft;
+    Point2f bottomRight;
+};
+
+//! @addtogroup imgproc_feature
+//! @{
+
+/** @example lsd_lines.cpp
+An example using the LineSegmentDetector
+*/
+
+/** @brief Line segment detector class
+
+following the algorithm described at @cite Rafael12 .
+*/
+class CV_EXPORTS_W LineSegmentDetector : public Algorithm
+{
+public:
+
+    /** @brief Finds lines in the input image.
+
+    This is the output of the default parameters of the algorithm on the above shown image.
+
+    ![image](pics/building_lsd.png)
+
+    @param _image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use:
+    `lsd_ptr-\>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);`
+    @param _lines A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where
+    Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly
+    oriented depending on the gradient.
+    @param width Vector of widths of the regions, where the lines are found. E.g. Width of line.
+    @param prec Vector of precisions with which the lines are found.
+    @param nfa Vector containing number of false alarms in the line region, with precision of 10%. The
+    bigger the value, logarithmically better the detection.
+    - -1 corresponds to 10 mean false alarms
+    - 0 corresponds to 1 mean false alarm
+    - 1 corresponds to 0.1 mean false alarms
+    This vector will be calculated only when the objects type is LSD_REFINE_ADV.
+    */
+    CV_WRAP virtual void detect(InputArray _image, OutputArray _lines,
+                        OutputArray width = noArray(), OutputArray prec = noArray(),
+                        OutputArray nfa = noArray()) = 0;
+
+    /** @brief Draws the line segments on a given image.
+    @param _image The image, where the liens will be drawn. Should be bigger or equal to the image,
+    where the lines were found.
+    @param lines A vector of the lines that needed to be drawn.
+     */
+    CV_WRAP virtual void drawSegments(InputOutputArray _image, InputArray lines) = 0;
+
+    /** @brief Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels.
+
+    @param size The size of the image, where lines1 and lines2 were found.
+    @param lines1 The first group of lines that needs to be drawn. It is visualized in blue color.
+    @param lines2 The second group of lines. They visualized in red color.
+    @param _image Optional image, where the lines will be drawn. The image should be color(3-channel)
+    in order for lines1 and lines2 to be drawn in the above mentioned colors.
+     */
+    CV_WRAP virtual int compareSegments(const Size& size, InputArray lines1, InputArray lines2, InputOutputArray _image = noArray()) = 0;
+
+    virtual ~LineSegmentDetector() { }
+};
+
+/** @brief Creates a smart pointer to a LineSegmentDetector object and initializes it.
+
+The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want
+to edit those, as to tailor it for their own application.
+
+@param _refine The way found lines will be refined, see cv::LineSegmentDetectorModes
+@param _scale The scale of the image that will be used to find the lines. Range (0..1].
+@param _sigma_scale Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale.
+@param _quant Bound to the quantization error on the gradient norm.
+@param _ang_th Gradient angle tolerance in degrees.
+@param _log_eps Detection threshold: -log10(NFA) \> log_eps. Used only when advancent refinement
+is chosen.
+@param _density_th Minimal density of aligned region points in the enclosing rectangle.
+@param _n_bins Number of bins in pseudo-ordering of gradient modulus.
+ */
+CV_EXPORTS_W Ptr<LineSegmentDetector> createLineSegmentDetector(
+    int _refine = LSD_REFINE_STD, double _scale = 0.8,
+    double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5,
+    double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024);
+
+//! @} imgproc_feature
+
+//! @addtogroup imgproc_filter
+//! @{
+
+/** @brief Returns Gaussian filter coefficients.
+
+The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter
+coefficients:
+
+\f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f]
+
+where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$.
+
+Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize
+smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly.
+You may also use the higher-level GaussianBlur.
+@param ksize Aperture size. It should be odd ( \f$\texttt{ksize} \mod 2 = 1\f$ ) and positive.
+@param sigma Gaussian standard deviation. If it is non-positive, it is computed from ksize as
+`sigma = 0.3\*((ksize-1)\*0.5 - 1) + 0.8`.
+@param ktype Type of filter coefficients. It can be CV_32F or CV_64F .
+@sa  sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur
+ */
+CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype = CV_64F );
+
+/** @brief Returns filter coefficients for computing spatial image derivatives.
+
+The function computes and returns the filter coefficients for spatial image derivatives. When
+`ksize=CV_SCHARR`, the Scharr \f$3 \times 3\f$ kernels are generated (see cv::Scharr). Otherwise, Sobel
+kernels are generated (see cv::Sobel). The filters are normally passed to sepFilter2D or to
+
+@param kx Output matrix of row filter coefficients. It has the type ktype .
+@param ky Output matrix of column filter coefficients. It has the type ktype .
+@param dx Derivative order in respect of x.
+@param dy Derivative order in respect of y.
+@param ksize Aperture size. It can be CV_SCHARR, 1, 3, 5, or 7.
+@param normalize Flag indicating whether to normalize (scale down) the filter coefficients or not.
+Theoretically, the coefficients should have the denominator \f$=2^{ksize*2-dx-dy-2}\f$. If you are
+going to filter floating-point images, you are likely to use the normalized kernels. But if you
+compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve
+all the fractional bits, you may want to set normalize=false .
+@param ktype Type of filter coefficients. It can be CV_32f or CV_64F .
+ */
+CV_EXPORTS_W void getDerivKernels( OutputArray kx, OutputArray ky,
+                                   int dx, int dy, int ksize,
+                                   bool normalize = false, int ktype = CV_32F );
+
+/** @brief Returns Gabor filter coefficients.
+
+For more details about gabor filter equations and parameters, see: [Gabor
+Filter](http://en.wikipedia.org/wiki/Gabor_filter).
+
+@param ksize Size of the filter returned.
+@param sigma Standard deviation of the gaussian envelope.
+@param theta Orientation of the normal to the parallel stripes of a Gabor function.
+@param lambd Wavelength of the sinusoidal factor.
+@param gamma Spatial aspect ratio.
+@param psi Phase offset.
+@param ktype Type of filter coefficients. It can be CV_32F or CV_64F .
+ */
+CV_EXPORTS_W Mat getGaborKernel( Size ksize, double sigma, double theta, double lambd,
+                                 double gamma, double psi = CV_PI*0.5, int ktype = CV_64F );
+
+//! returns "magic" border value for erosion and dilation. It is automatically transformed to Scalar::all(-DBL_MAX) for dilation.
+static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
+
+/** @brief Returns a structuring element of the specified size and shape for morphological operations.
+
+The function constructs and returns the structuring element that can be further passed to cv::erode,
+cv::dilate or cv::morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as
+the structuring element.
+
+@param shape Element shape that could be one of cv::MorphShapes
+@param ksize Size of the structuring element.
+@param anchor Anchor position within the element. The default value \f$(-1, -1)\f$ means that the
+anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor
+position. In other cases the anchor just regulates how much the result of the morphological
+operation is shifted.
+ */
+CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor = Point(-1,-1));
+
+/** @brief Blurs an image using the median filter.
+
+The function smoothes an image using the median filter with the \f$\texttt{ksize} \times
+\texttt{ksize}\f$ aperture. Each channel of a multi-channel image is processed independently.
+In-place operation is supported.
+
+@param src input 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be
+CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.
+@param dst destination array of the same size and type as src.
+@param ksize aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ...
+@sa  bilateralFilter, blur, boxFilter, GaussianBlur
+ */
+CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize );
+
+/** @brief Blurs an image using a Gaussian filter.
+
+The function convolves the source image with the specified Gaussian kernel. In-place filtering is
+supported.
+
+@param src input image; the image can have any number of channels, which are processed
+independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst output image of the same size and type as src.
+@param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
+positive and odd. Or, they can be zero's and then they are computed from sigma.
+@param sigmaX Gaussian kernel standard deviation in X direction.
+@param sigmaY Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be
+equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
+respectively (see cv::getGaussianKernel for details); to fully control the result regardless of
+possible future modifications of all this semantics, it is recommended to specify all of ksize,
+sigmaX, and sigmaY.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+
+@sa  sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur
+ */
+CV_EXPORTS_W void GaussianBlur( InputArray src, OutputArray dst, Size ksize,
+                                double sigmaX, double sigmaY = 0,
+                                int borderType = BORDER_DEFAULT );
+
+/** @brief Applies the bilateral filter to an image.
+
+The function applies bilateral filtering to the input image, as described in
+http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html
+bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is
+very slow compared to most filters.
+
+_Sigma values_: For simplicity, you can set the 2 sigma values to be the same. If they are small (\<
+10), the filter will not have much effect, whereas if they are large (\> 150), they will have a very
+strong effect, making the image look "cartoonish".
+
+_Filter size_: Large filters (d \> 5) are very slow, so it is recommended to use d=5 for real-time
+applications, and perhaps d=9 for offline applications that need heavy noise filtering.
+
+This filter does not work inplace.
+@param src Source 8-bit or floating-point, 1-channel or 3-channel image.
+@param dst Destination image of the same size and type as src .
+@param d Diameter of each pixel neighborhood that is used during filtering. If it is non-positive,
+it is computed from sigmaSpace.
+@param sigmaColor Filter sigma in the color space. A larger value of the parameter means that
+farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting
+in larger areas of semi-equal color.
+@param sigmaSpace Filter sigma in the coordinate space. A larger value of the parameter means that
+farther pixels will influence each other as long as their colors are close enough (see sigmaColor
+). When d\>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is
+proportional to sigmaSpace.
+@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
+ */
+CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d,
+                                   double sigmaColor, double sigmaSpace,
+                                   int borderType = BORDER_DEFAULT );
+
+/** @brief Blurs an image using the box filter.
+
+The function smoothes an image using the kernel:
+
+\f[\texttt{K} =  \alpha \begin{bmatrix} 1 & 1 & 1 &  \cdots & 1 & 1  \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \hdotsfor{6} \\ 1 & 1 & 1 &  \cdots & 1 & 1 \end{bmatrix}\f]
+
+where
+
+\f[\alpha = \fork{\frac{1}{\texttt{ksize.width*ksize.height}}}{when \texttt{normalize=true}}{1}{otherwise}\f]
+
+Unnormalized box filter is useful for computing various integral characteristics over each pixel
+neighborhood, such as covariance matrices of image derivatives (used in dense optical flow
+algorithms, and so on). If you need to compute pixel sums over variable-size windows, use cv::integral.
+
+@param src input image.
+@param dst output image of the same size and type as src.
+@param ddepth the output image depth (-1 to use src.depth()).
+@param ksize blurring kernel size.
+@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
+center.
+@param normalize flag, specifying whether the kernel is normalized by its area or not.
+@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
+@sa  blur, bilateralFilter, GaussianBlur, medianBlur, integral
+ */
+CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth,
+                             Size ksize, Point anchor = Point(-1,-1),
+                             bool normalize = true,
+                             int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates the normalized sum of squares of the pixel values overlapping the filter.
+
+For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring
+pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$.
+
+The unnormalized square box filter can be useful in computing local image statistics such as the the local
+variance and standard deviation around the neighborhood of a pixel.
+
+@param _src input image
+@param _dst output image of the same size and type as _src
+@param ddepth the output image depth (-1 to use src.depth())
+@param ksize kernel size
+@param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
+center.
+@param normalize flag, specifying whether the kernel is to be normalized by it's area or not.
+@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
+@sa boxFilter
+*/
+CV_EXPORTS_W void sqrBoxFilter( InputArray _src, OutputArray _dst, int ddepth,
+                                Size ksize, Point anchor = Point(-1, -1),
+                                bool normalize = true,
+                                int borderType = BORDER_DEFAULT );
+
+/** @brief Blurs an image using the normalized box filter.
+
+The function smoothes an image using the kernel:
+
+\f[\texttt{K} =  \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 &  \cdots & 1 & 1  \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \hdotsfor{6} \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \end{bmatrix}\f]
+
+The call `blur(src, dst, ksize, anchor, borderType)` is equivalent to `boxFilter(src, dst, src.type(),
+anchor, true, borderType)`.
+
+@param src input image; it can have any number of channels, which are processed independently, but
+the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst output image of the same size and type as src.
+@param ksize blurring kernel size.
+@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
+center.
+@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
+@sa  boxFilter, bilateralFilter, GaussianBlur, medianBlur
+ */
+CV_EXPORTS_W void blur( InputArray src, OutputArray dst,
+                        Size ksize, Point anchor = Point(-1,-1),
+                        int borderType = BORDER_DEFAULT );
+
+/** @brief Convolves an image with the kernel.
+
+The function applies an arbitrary linear filter to an image. In-place operation is supported. When
+the aperture is partially outside the image, the function interpolates outlier pixel values
+according to the specified border mode.
+
+The function does actually compute correlation, not the convolution:
+
+\f[\texttt{dst} (x,y) =  \sum _{ \stackrel{0\leq x' < \texttt{kernel.cols},}{0\leq y' < \texttt{kernel.rows}} }  \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f]
+
+That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip
+the kernel using cv::flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows -
+anchor.y - 1)`.
+
+The function uses the DFT-based algorithm in case of sufficiently large kernels (~`11 x 11` or
+larger) and the direct algorithm for small kernels.
+
+@param src input image.
+@param dst output image of the same size and the same number of channels as src.
+@param ddepth desired depth of the destination image, see @ref filter_depths "combinations"
+@param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
+matrix; if you want to apply different kernels to different channels, split the image into
+separate color planes using split and process them individually.
+@param anchor anchor of the kernel that indicates the relative position of a filtered point within
+the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
+is at the kernel center.
+@param delta optional value added to the filtered pixels before storing them in dst.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@sa  sepFilter2D, dft, matchTemplate
+ */
+CV_EXPORTS_W void filter2D( InputArray src, OutputArray dst, int ddepth,
+                            InputArray kernel, Point anchor = Point(-1,-1),
+                            double delta = 0, int borderType = BORDER_DEFAULT );
+
+/** @brief Applies a separable linear filter to an image.
+
+The function applies a separable linear filter to the image. That is, first, every row of src is
+filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D
+kernel kernelY. The final result shifted by delta is stored in dst .
+
+@param src Source image.
+@param dst Destination image of the same size and the same number of channels as src .
+@param ddepth Destination image depth, see @ref filter_depths "combinations"
+@param kernelX Coefficients for filtering each row.
+@param kernelY Coefficients for filtering each column.
+@param anchor Anchor position within the kernel. The default value \f$(-1,-1)\f$ means that the anchor
+is at the kernel center.
+@param delta Value added to the filtered results before storing them.
+@param borderType Pixel extrapolation method, see cv::BorderTypes
+@sa  filter2D, Sobel, GaussianBlur, boxFilter, blur
+ */
+CV_EXPORTS_W void sepFilter2D( InputArray src, OutputArray dst, int ddepth,
+                               InputArray kernelX, InputArray kernelY,
+                               Point anchor = Point(-1,-1),
+                               double delta = 0, int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
+
+In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to
+calculate the derivative. When \f$\texttt{ksize = 1}\f$, the \f$3 \times 1\f$ or \f$1 \times 3\f$
+kernel is used (that is, no Gaussian smoothing is done). `ksize = 1` can only be used for the first
+or the second x- or y- derivatives.
+
+There is also the special value `ksize = CV_SCHARR (-1)` that corresponds to the \f$3\times3\f$ Scharr
+filter that may give more accurate results than the \f$3\times3\f$ Sobel. The Scharr aperture is
+
+\f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f]
+
+for the x-derivative, or transposed for the y-derivative.
+
+The function calculates an image derivative by convolving the image with the appropriate kernel:
+
+\f[\texttt{dst} =  \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f]
+
+The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less
+resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3)
+or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first
+case corresponds to a kernel of:
+
+\f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f]
+
+The second case corresponds to a kernel of:
+
+\f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f]
+
+@param src input image.
+@param dst output image of the same size and the same number of channels as src .
+@param ddepth output image depth, see @ref filter_depths "combinations"; in the case of
+    8-bit input images it will result in truncated derivatives.
+@param dx order of the derivative x.
+@param dy order of the derivative y.
+@param ksize size of the extended Sobel kernel; it must be 1, 3, 5, or 7.
+@param scale optional scale factor for the computed derivative values; by default, no scaling is
+applied (see cv::getDerivKernels for details).
+@param delta optional delta value that is added to the results prior to storing them in dst.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@sa  Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
+ */
+CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth,
+                         int dx, int dy, int ksize = 3,
+                         double scale = 1, double delta = 0,
+                         int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates the first order image derivative in both x and y using a Sobel operator
+
+Equivalent to calling:
+
+@code
+Sobel( src, dx, CV_16SC1, 1, 0, 3 );
+Sobel( src, dy, CV_16SC1, 0, 1, 3 );
+@endcode
+
+@param src input image.
+@param dx output image with first-order derivative in x.
+@param dy output image with first-order derivative in y.
+@param ksize size of Sobel kernel. It must be 3.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+
+@sa Sobel
+ */
+
+CV_EXPORTS_W void spatialGradient( InputArray src, OutputArray dx,
+                                   OutputArray dy, int ksize = 3,
+                                   int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates the first x- or y- image derivative using Scharr operator.
+
+The function computes the first x- or y- spatial image derivative using the Scharr operator. The
+call
+
+\f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f]
+
+is equivalent to
+
+\f[\texttt{Sobel(src, dst, ddepth, dx, dy, CV\_SCHARR, scale, delta, borderType)} .\f]
+
+@param src input image.
+@param dst output image of the same size and the same number of channels as src.
+@param ddepth output image depth, see @ref filter_depths "combinations"
+@param dx order of the derivative x.
+@param dy order of the derivative y.
+@param scale optional scale factor for the computed derivative values; by default, no scaling is
+applied (see getDerivKernels for details).
+@param delta optional delta value that is added to the results prior to storing them in dst.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@sa  cartToPolar
+ */
+CV_EXPORTS_W void Scharr( InputArray src, OutputArray dst, int ddepth,
+                          int dx, int dy, double scale = 1, double delta = 0,
+                          int borderType = BORDER_DEFAULT );
+
+/** @example laplace.cpp
+  An example using Laplace transformations for edge detection
+*/
+
+/** @brief Calculates the Laplacian of an image.
+
+The function calculates the Laplacian of the source image by adding up the second x and y
+derivatives calculated using the Sobel operator:
+
+\f[\texttt{dst} =  \Delta \texttt{src} =  \frac{\partial^2 \texttt{src}}{\partial x^2} +  \frac{\partial^2 \texttt{src}}{\partial y^2}\f]
+
+This is done when `ksize > 1`. When `ksize == 1`, the Laplacian is computed by filtering the image
+with the following \f$3 \times 3\f$ aperture:
+
+\f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f]
+
+@param src Source image.
+@param dst Destination image of the same size and the same number of channels as src .
+@param ddepth Desired depth of the destination image.
+@param ksize Aperture size used to compute the second-derivative filters. See getDerivKernels for
+details. The size must be positive and odd.
+@param scale Optional scale factor for the computed Laplacian values. By default, no scaling is
+applied. See getDerivKernels for details.
+@param delta Optional delta value that is added to the results prior to storing them in dst .
+@param borderType Pixel extrapolation method, see cv::BorderTypes
+@sa  Sobel, Scharr
+ */
+CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth,
+                             int ksize = 1, double scale = 1, double delta = 0,
+                             int borderType = BORDER_DEFAULT );
+
+//! @} imgproc_filter
+
+//! @addtogroup imgproc_feature
+//! @{
+
+/** @example edge.cpp
+  An example on using the canny edge detector
+*/
+
+/** @brief Finds edges in an image using the Canny algorithm @cite Canny86 .
+
+The function finds edges in the input image image and marks them in the output map edges using the
+Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The
+largest value is used to find initial segments of strong edges. See
+<http://en.wikipedia.org/wiki/Canny_edge_detector>
+
+@param image 8-bit input image.
+@param edges output edge map; single channels 8-bit image, which has the same size as image .
+@param threshold1 first threshold for the hysteresis procedure.
+@param threshold2 second threshold for the hysteresis procedure.
+@param apertureSize aperture size for the Sobel operator.
+@param L2gradient a flag, indicating whether a more accurate \f$L_2\f$ norm
+\f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude (
+L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough (
+L2gradient=false ).
+ */
+CV_EXPORTS_W void Canny( InputArray image, OutputArray edges,
+                         double threshold1, double threshold2,
+                         int apertureSize = 3, bool L2gradient = false );
+
+/** @brief Calculates the minimal eigenvalue of gradient matrices for corner detection.
+
+The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal
+eigenvalue of the covariance matrix of derivatives, that is, \f$\min(\lambda_1, \lambda_2)\f$ in terms
+of the formulae in the cornerEigenValsAndVecs description.
+
+@param src Input single-channel 8-bit or floating-point image.
+@param dst Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as
+src .
+@param blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ).
+@param ksize Aperture parameter for the Sobel operator.
+@param borderType Pixel extrapolation method. See cv::BorderTypes.
+ */
+CV_EXPORTS_W void cornerMinEigenVal( InputArray src, OutputArray dst,
+                                     int blockSize, int ksize = 3,
+                                     int borderType = BORDER_DEFAULT );
+
+/** @brief Harris corner detector.
+
+The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and
+cornerEigenValsAndVecs , for each pixel \f$(x, y)\f$ it calculates a \f$2\times2\f$ gradient covariance
+matrix \f$M^{(x,y)}\f$ over a \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood. Then, it
+computes the following characteristic:
+
+\f[\texttt{dst} (x,y) =  \mathrm{det} M^{(x,y)} - k  \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f]
+
+Corners in the image can be found as the local maxima of this response map.
+
+@param src Input single-channel 8-bit or floating-point image.
+@param dst Image to store the Harris detector responses. It has the type CV_32FC1 and the same
+size as src .
+@param blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ).
+@param ksize Aperture parameter for the Sobel operator.
+@param k Harris detector free parameter. See the formula below.
+@param borderType Pixel extrapolation method. See cv::BorderTypes.
+ */
+CV_EXPORTS_W void cornerHarris( InputArray src, OutputArray dst, int blockSize,
+                                int ksize, double k,
+                                int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates eigenvalues and eigenvectors of image blocks for corner detection.
+
+For every pixel \f$p\f$ , the function cornerEigenValsAndVecs considers a blockSize \f$\times\f$ blockSize
+neighborhood \f$S(p)\f$ . It calculates the covariation matrix of derivatives over the neighborhood as:
+
+\f[M =  \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 &  \sum _{S(p)}dI/dx dI/dy  \\ \sum _{S(p)}dI/dx dI/dy &  \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f]
+
+where the derivatives are computed using the Sobel operator.
+
+After that, it finds eigenvectors and eigenvalues of \f$M\f$ and stores them in the destination image as
+\f$(\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\f$ where
+
+-   \f$\lambda_1, \lambda_2\f$ are the non-sorted eigenvalues of \f$M\f$
+-   \f$x_1, y_1\f$ are the eigenvectors corresponding to \f$\lambda_1\f$
+-   \f$x_2, y_2\f$ are the eigenvectors corresponding to \f$\lambda_2\f$
+
+The output of the function can be used for robust edge or corner detection.
+
+@param src Input single-channel 8-bit or floating-point image.
+@param dst Image to store the results. It has the same size as src and the type CV_32FC(6) .
+@param blockSize Neighborhood size (see details below).
+@param ksize Aperture parameter for the Sobel operator.
+@param borderType Pixel extrapolation method. See cv::BorderTypes.
+
+@sa  cornerMinEigenVal, cornerHarris, preCornerDetect
+ */
+CV_EXPORTS_W void cornerEigenValsAndVecs( InputArray src, OutputArray dst,
+                                          int blockSize, int ksize,
+                                          int borderType = BORDER_DEFAULT );
+
+/** @brief Calculates a feature map for corner detection.
+
+The function calculates the complex spatial derivative-based function of the source image
+
+\f[\texttt{dst} = (D_x  \texttt{src} )^2  \cdot D_{yy}  \texttt{src} + (D_y  \texttt{src} )^2  \cdot D_{xx}  \texttt{src} - 2 D_x  \texttt{src} \cdot D_y  \texttt{src} \cdot D_{xy}  \texttt{src}\f]
+
+where \f$D_x\f$,\f$D_y\f$ are the first image derivatives, \f$D_{xx}\f$,\f$D_{yy}\f$ are the second image
+derivatives, and \f$D_{xy}\f$ is the mixed derivative.
+
+The corners can be found as local maximums of the functions, as shown below:
+@code
+    Mat corners, dilated_corners;
+    preCornerDetect(image, corners, 3);
+    // dilation with 3x3 rectangular structuring element
+    dilate(corners, dilated_corners, Mat(), 1);
+    Mat corner_mask = corners == dilated_corners;
+@endcode
+
+@param src Source single-channel 8-bit of floating-point image.
+@param dst Output image that has the type CV_32F and the same size as src .
+@param ksize %Aperture size of the Sobel .
+@param borderType Pixel extrapolation method. See cv::BorderTypes.
+ */
+CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize,
+                                   int borderType = BORDER_DEFAULT );
+
+/** @brief Refines the corner locations.
+
+The function iterates to find the sub-pixel accurate location of corners or radial saddle points, as
+shown on the figure below.
+
+![image](pics/cornersubpix.png)
+
+Sub-pixel accurate corner locator is based on the observation that every vector from the center \f$q\f$
+to a point \f$p\f$ located within a neighborhood of \f$q\f$ is orthogonal to the image gradient at \f$p\f$
+subject to image and measurement noise. Consider the expression:
+
+\f[\epsilon _i = {DI_{p_i}}^T  \cdot (q - p_i)\f]
+
+where \f${DI_{p_i}}\f$ is an image gradient at one of the points \f$p_i\f$ in a neighborhood of \f$q\f$ . The
+value of \f$q\f$ is to be found so that \f$\epsilon_i\f$ is minimized. A system of equations may be set up
+with \f$\epsilon_i\f$ set to zero:
+
+\f[\sum _i(DI_{p_i}  \cdot {DI_{p_i}}^T) -  \sum _i(DI_{p_i}  \cdot {DI_{p_i}}^T  \cdot p_i)\f]
+
+where the gradients are summed within a neighborhood ("search window") of \f$q\f$ . Calling the first
+gradient term \f$G\f$ and the second gradient term \f$b\f$ gives:
+
+\f[q = G^{-1}  \cdot b\f]
+
+The algorithm sets the center of the neighborhood window at this new center \f$q\f$ and then iterates
+until the center stays within a set threshold.
+
+@param image Input image.
+@param corners Initial coordinates of the input corners and refined coordinates provided for
+output.
+@param winSize Half of the side length of the search window. For example, if winSize=Size(5,5) ,
+then a \f$5*2+1 \times 5*2+1 = 11 \times 11\f$ search window is used.
+@param zeroZone Half of the size of the dead region in the middle of the search zone over which
+the summation in the formula below is not done. It is used sometimes to avoid possible
+singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such
+a size.
+@param criteria Criteria for termination of the iterative process of corner refinement. That is,
+the process of corner position refinement stops either after criteria.maxCount iterations or when
+the corner position moves by less than criteria.epsilon on some iteration.
+ */
+CV_EXPORTS_W void cornerSubPix( InputArray image, InputOutputArray corners,
+                                Size winSize, Size zeroZone,
+                                TermCriteria criteria );
+
+/** @brief Determines strong corners on an image.
+
+The function finds the most prominent corners in the image or in the specified image region, as
+described in @cite Shi94
+
+-   Function calculates the corner quality measure at every source image pixel using the
+    cornerMinEigenVal or cornerHarris .
+-   Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are
+    retained).
+-   The corners with the minimal eigenvalue less than
+    \f$\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\f$ are rejected.
+-   The remaining corners are sorted by the quality measure in the descending order.
+-   Function throws away each corner for which there is a stronger corner at a distance less than
+    maxDistance.
+
+The function can be used to initialize a point-based tracker of an object.
+
+@note If the function is called with different values A and B of the parameter qualityLevel , and
+A \> B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector
+with qualityLevel=B .
+
+@param image Input 8-bit or floating-point 32-bit, single-channel image.
+@param corners Output vector of detected corners.
+@param maxCorners Maximum number of corners to return. If there are more corners than are found,
+the strongest of them is returned.
+@param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
+parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
+(see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the
+quality measure less than the product are rejected. For example, if the best corner has the
+quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure
+less than 15 are rejected.
+@param minDistance Minimum possible Euclidean distance between the returned corners.
+@param mask Optional region of interest. If the image is not empty (it needs to have the type
+CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
+@param blockSize Size of an average block for computing a derivative covariation matrix over each
+pixel neighborhood. See cornerEigenValsAndVecs .
+@param useHarrisDetector Parameter indicating whether to use a Harris detector (see cornerHarris)
+or cornerMinEigenVal.
+@param k Free parameter of the Harris detector.
+
+@sa  cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform,
+ */
+CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners,
+                                     int maxCorners, double qualityLevel, double minDistance,
+                                     InputArray mask = noArray(), int blockSize = 3,
+                                     bool useHarrisDetector = false, double k = 0.04 );
+
+/** @example houghlines.cpp
+An example using the Hough line detector
+*/
+
+/** @brief Finds lines in a binary image using the standard Hough transform.
+
+The function implements the standard or standard multi-scale Hough transform algorithm for line
+detection. See <http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm> for a good explanation of Hough
+transform.
+
+@param image 8-bit, single-channel binary source image. The image may be modified by the function.
+@param lines Output vector of lines. Each line is represented by a two-element vector
+\f$(\rho, \theta)\f$ . \f$\rho\f$ is the distance from the coordinate origin \f$(0,0)\f$ (top-left corner of
+the image). \f$\theta\f$ is the line rotation angle in radians (
+\f$0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\f$ ).
+@param rho Distance resolution of the accumulator in pixels.
+@param theta Angle resolution of the accumulator in radians.
+@param threshold Accumulator threshold parameter. Only those lines are returned that get enough
+votes ( \f$>\texttt{threshold}\f$ ).
+@param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho .
+The coarse accumulator distance resolution is rho and the accurate accumulator resolution is
+rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these
+parameters should be positive.
+@param stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
+@param min_theta For standard and multi-scale Hough transform, minimum angle to check for lines.
+Must fall between 0 and max_theta.
+@param max_theta For standard and multi-scale Hough transform, maximum angle to check for lines.
+Must fall between min_theta and CV_PI.
+ */
+CV_EXPORTS_W void HoughLines( InputArray image, OutputArray lines,
+                              double rho, double theta, int threshold,
+                              double srn = 0, double stn = 0,
+                              double min_theta = 0, double max_theta = CV_PI );
+
+/** @brief Finds line segments in a binary image using the probabilistic Hough transform.
+
+The function implements the probabilistic Hough transform algorithm for line detection, described
+in @cite Matas00
+
+See the line detection example below:
+
+@code
+    #include <opencv2/imgproc.hpp>
+    #include <opencv2/highgui.hpp>
+
+    using namespace cv;
+    using namespace std;
+
+    int main(int argc, char** argv)
+    {
+        Mat src, dst, color_dst;
+        if( argc != 2 || !(src=imread(argv[1], 0)).data)
+            return -1;
+
+        Canny( src, dst, 50, 200, 3 );
+        cvtColor( dst, color_dst, COLOR_GRAY2BGR );
+
+    #if 0
+        vector<Vec2f> lines;
+        HoughLines( dst, lines, 1, CV_PI/180, 100 );
+
+        for( size_t i = 0; i < lines.size(); i++ )
+        {
+            float rho = lines[i][0];
+            float theta = lines[i][1];
+            double a = cos(theta), b = sin(theta);
+            double x0 = a*rho, y0 = b*rho;
+            Point pt1(cvRound(x0 + 1000*(-b)),
+                      cvRound(y0 + 1000*(a)));
+            Point pt2(cvRound(x0 - 1000*(-b)),
+                      cvRound(y0 - 1000*(a)));
+            line( color_dst, pt1, pt2, Scalar(0,0,255), 3, 8 );
+        }
+    #else
+        vector<Vec4i> lines;
+        HoughLinesP( dst, lines, 1, CV_PI/180, 80, 30, 10 );
+        for( size_t i = 0; i < lines.size(); i++ )
+        {
+            line( color_dst, Point(lines[i][0], lines[i][1]),
+                Point(lines[i][2], lines[i][3]), Scalar(0,0,255), 3, 8 );
+        }
+    #endif
+        namedWindow( "Source", 1 );
+        imshow( "Source", src );
+
+        namedWindow( "Detected Lines", 1 );
+        imshow( "Detected Lines", color_dst );
+
+        waitKey(0);
+        return 0;
+    }
+@endcode
+This is a sample picture the function parameters have been tuned for:
+
+![image](pics/building.jpg)
+
+And this is the output of the above program in case of the probabilistic Hough transform:
+
+![image](pics/houghp.png)
+
+@param image 8-bit, single-channel binary source image. The image may be modified by the function.
+@param lines Output vector of lines. Each line is represented by a 4-element vector
+\f$(x_1, y_1, x_2, y_2)\f$ , where \f$(x_1,y_1)\f$ and \f$(x_2, y_2)\f$ are the ending points of each detected
+line segment.
+@param rho Distance resolution of the accumulator in pixels.
+@param theta Angle resolution of the accumulator in radians.
+@param threshold Accumulator threshold parameter. Only those lines are returned that get enough
+votes ( \f$>\texttt{threshold}\f$ ).
+@param minLineLength Minimum line length. Line segments shorter than that are rejected.
+@param maxLineGap Maximum allowed gap between points on the same line to link them.
+
+@sa LineSegmentDetector
+ */
+CV_EXPORTS_W void HoughLinesP( InputArray image, OutputArray lines,
+                               double rho, double theta, int threshold,
+                               double minLineLength = 0, double maxLineGap = 0 );
+
+/** @example houghcircles.cpp
+An example using the Hough circle detector
+*/
+
+/** @brief Finds circles in a grayscale image using the Hough transform.
+
+The function finds circles in a grayscale image using a modification of the Hough transform.
+
+Example: :
+@code
+    #include <opencv2/imgproc.hpp>
+    #include <opencv2/highgui.hpp>
+    #include <math.h>
+
+    using namespace cv;
+    using namespace std;
+
+    int main(int argc, char** argv)
+    {
+        Mat img, gray;
+        if( argc != 2 || !(img=imread(argv[1], 1)).data)
+            return -1;
+        cvtColor(img, gray, COLOR_BGR2GRAY);
+        // smooth it, otherwise a lot of false circles may be detected
+        GaussianBlur( gray, gray, Size(9, 9), 2, 2 );
+        vector<Vec3f> circles;
+        HoughCircles(gray, circles, HOUGH_GRADIENT,
+                     2, gray.rows/4, 200, 100 );
+        for( size_t i = 0; i < circles.size(); i++ )
+        {
+             Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
+             int radius = cvRound(circles[i][2]);
+             // draw the circle center
+             circle( img, center, 3, Scalar(0,255,0), -1, 8, 0 );
+             // draw the circle outline
+             circle( img, center, radius, Scalar(0,0,255), 3, 8, 0 );
+        }
+        namedWindow( "circles", 1 );
+        imshow( "circles", img );
+
+        waitKey(0);
+        return 0;
+    }
+@endcode
+
+@note Usually the function detects the centers of circles well. However, it may fail to find correct
+radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if
+you know it. Or, you may ignore the returned radius, use only the center, and find the correct
+radius using an additional procedure.
+
+@param image 8-bit, single-channel, grayscale input image.
+@param circles Output vector of found circles. Each vector is encoded as a 3-element
+floating-point vector \f$(x, y, radius)\f$ .
+@param method Detection method, see cv::HoughModes. Currently, the only implemented method is HOUGH_GRADIENT
+@param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if
+dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has
+half as big width and height.
+@param minDist Minimum distance between the centers of the detected circles. If the parameter is
+too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is
+too large, some circles may be missed.
+@param param1 First method-specific parameter. In case of CV_HOUGH_GRADIENT , it is the higher
+threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
+@param param2 Second method-specific parameter. In case of CV_HOUGH_GRADIENT , it is the
+accumulator threshold for the circle centers at the detection stage. The smaller it is, the more
+false circles may be detected. Circles, corresponding to the larger accumulator values, will be
+returned first.
+@param minRadius Minimum circle radius.
+@param maxRadius Maximum circle radius.
+
+@sa fitEllipse, minEnclosingCircle
+ */
+CV_EXPORTS_W void HoughCircles( InputArray image, OutputArray circles,
+                               int method, double dp, double minDist,
+                               double param1 = 100, double param2 = 100,
+                               int minRadius = 0, int maxRadius = 0 );
+
+//! @} imgproc_feature
+
+//! @addtogroup imgproc_filter
+//! @{
+
+/** @example morphology2.cpp
+  An example using the morphological operations
+*/
+
+/** @brief Erodes an image by using a specific structuring element.
+
+The function erodes the source image using the specified structuring element that determines the
+shape of a pixel neighborhood over which the minimum is taken:
+
+\f[\texttt{dst} (x,y) =  \min _{(x',y'):  \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f]
+
+The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In
+case of multi-channel images, each channel is processed independently.
+
+@param src input image; the number of channels can be arbitrary, but the depth should be one of
+CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst output image of the same size and type as src.
+@param kernel structuring element used for erosion; if `element=Mat()`, a `3 x 3` rectangular
+structuring element is used. Kernel can be created using getStructuringElement.
+@param anchor position of the anchor within the element; default value (-1, -1) means that the
+anchor is at the element center.
+@param iterations number of times erosion is applied.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@param borderValue border value in case of a constant border
+@sa  dilate, morphologyEx, getStructuringElement
+ */
+CV_EXPORTS_W void erode( InputArray src, OutputArray dst, InputArray kernel,
+                         Point anchor = Point(-1,-1), int iterations = 1,
+                         int borderType = BORDER_CONSTANT,
+                         const Scalar& borderValue = morphologyDefaultBorderValue() );
+
+/** @brief Dilates an image by using a specific structuring element.
+
+The function dilates the source image using the specified structuring element that determines the
+shape of a pixel neighborhood over which the maximum is taken:
+\f[\texttt{dst} (x,y) =  \max _{(x',y'):  \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f]
+
+The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In
+case of multi-channel images, each channel is processed independently.
+
+@param src input image; the number of channels can be arbitrary, but the depth should be one of
+CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst output image of the same size and type as src\`.
+@param kernel structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
+structuring element is used. Kernel can be created using getStructuringElement
+@param anchor position of the anchor within the element; default value (-1, -1) means that the
+anchor is at the element center.
+@param iterations number of times dilation is applied.
+@param borderType pixel extrapolation method, see cv::BorderTypes
+@param borderValue border value in case of a constant border
+@sa  erode, morphologyEx, getStructuringElement
+ */
+CV_EXPORTS_W void dilate( InputArray src, OutputArray dst, InputArray kernel,
+                          Point anchor = Point(-1,-1), int iterations = 1,
+                          int borderType = BORDER_CONSTANT,
+                          const Scalar& borderValue = morphologyDefaultBorderValue() );
+
+/** @brief Performs advanced morphological transformations.
+
+The function morphologyEx can perform advanced morphological transformations using an erosion and dilation as
+basic operations.
+
+Any of the operations can be done in-place. In case of multi-channel images, each channel is
+processed independently.
+
+@param src Source image. The number of channels can be arbitrary. The depth should be one of
+CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
+@param dst Destination image of the same size and type as source image.
+@param op Type of a morphological operation, see cv::MorphTypes
+@param kernel Structuring element. It can be created using cv::getStructuringElement.
+@param anchor Anchor position with the kernel. Negative values mean that the anchor is at the
+kernel center.
+@param iterations Number of times erosion and dilation are applied.
+@param borderType Pixel extrapolation method, see cv::BorderTypes
+@param borderValue Border value in case of a constant border. The default value has a special
+meaning.
+@sa  dilate, erode, getStructuringElement
+ */
+CV_EXPORTS_W void morphologyEx( InputArray src, OutputArray dst,
+                                int op, InputArray kernel,
+                                Point anchor = Point(-1,-1), int iterations = 1,
+                                int borderType = BORDER_CONSTANT,
+                                const Scalar& borderValue = morphologyDefaultBorderValue() );
+
+//! @} imgproc_filter
+
+//! @addtogroup imgproc_transform
+//! @{
+
+/** @brief Resizes an image.
+
+The function resize resizes the image src down to or up to the specified size. Note that the
+initial dst type or size are not taken into account. Instead, the size and type are derived from
+the `src`,`dsize`,`fx`, and `fy`. If you want to resize src so that it fits the pre-created dst,
+you may call the function as follows:
+@code
+    // explicitly specify dsize=dst.size(); fx and fy will be computed from that.
+    resize(src, dst, dst.size(), 0, 0, interpolation);
+@endcode
+If you want to decimate the image by factor of 2 in each direction, you can call the function this
+way:
+@code
+    // specify fx and fy and let the function compute the destination image size.
+    resize(src, dst, Size(), 0.5, 0.5, interpolation);
+@endcode
+To shrink an image, it will generally look best with cv::INTER_AREA interpolation, whereas to
+enlarge an image, it will generally look best with cv::INTER_CUBIC (slow) or cv::INTER_LINEAR
+(faster but still looks OK).
+
+@param src input image.
+@param dst output image; it has the size dsize (when it is non-zero) or the size computed from
+src.size(), fx, and fy; the type of dst is the same as of src.
+@param dsize output image size; if it equals zero, it is computed as:
+ \f[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\f]
+ Either dsize or both fx and fy must be non-zero.
+@param fx scale factor along the horizontal axis; when it equals 0, it is computed as
+\f[\texttt{(double)dsize.width/src.cols}\f]
+@param fy scale factor along the vertical axis; when it equals 0, it is computed as
+\f[\texttt{(double)dsize.height/src.rows}\f]
+@param interpolation interpolation method, see cv::InterpolationFlags
+
+@sa  warpAffine, warpPerspective, remap
+ */
+CV_EXPORTS_W void resize( InputArray src, OutputArray dst,
+                          Size dsize, double fx = 0, double fy = 0,
+                          int interpolation = INTER_LINEAR );
+
+/** @brief Applies an affine transformation to an image.
+
+The function warpAffine transforms the source image using the specified matrix:
+
+\f[\texttt{dst} (x,y) =  \texttt{src} ( \texttt{M} _{11} x +  \texttt{M} _{12} y +  \texttt{M} _{13}, \texttt{M} _{21} x +  \texttt{M} _{22} y +  \texttt{M} _{23})\f]
+
+when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted
+with cv::invertAffineTransform and then put in the formula above instead of M. The function cannot
+operate in-place.
+
+@param src input image.
+@param dst output image that has the size dsize and the same type as src .
+@param M \f$2\times 3\f$ transformation matrix.
+@param dsize size of the output image.
+@param flags combination of interpolation methods (see cv::InterpolationFlags) and the optional
+flag WARP_INVERSE_MAP that means that M is the inverse transformation (
+\f$\texttt{dst}\rightarrow\texttt{src}\f$ ).
+@param borderMode pixel extrapolation method (see cv::BorderTypes); when
+borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to
+the "outliers" in the source image are not modified by the function.
+@param borderValue value used in case of a constant border; by default, it is 0.
+
+@sa  warpPerspective, resize, remap, getRectSubPix, transform
+ */
+CV_EXPORTS_W void warpAffine( InputArray src, OutputArray dst,
+                              InputArray M, Size dsize,
+                              int flags = INTER_LINEAR,
+                              int borderMode = BORDER_CONSTANT,
+                              const Scalar& borderValue = Scalar());
+
+/** @brief Applies a perspective transformation to an image.
+
+The function warpPerspective transforms the source image using the specified matrix:
+
+\f[\texttt{dst} (x,y) =  \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} ,
+     \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f]
+
+when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert
+and then put in the formula above instead of M. The function cannot operate in-place.
+
+@param src input image.
+@param dst output image that has the size dsize and the same type as src .
+@param M \f$3\times 3\f$ transformation matrix.
+@param dsize size of the output image.
+@param flags combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the
+optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (
+\f$\texttt{dst}\rightarrow\texttt{src}\f$ ).
+@param borderMode pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).
+@param borderValue value used in case of a constant border; by default, it equals 0.
+
+@sa  warpAffine, resize, remap, getRectSubPix, perspectiveTransform
+ */
+CV_EXPORTS_W void warpPerspective( InputArray src, OutputArray dst,
+                                   InputArray M, Size dsize,
+                                   int flags = INTER_LINEAR,
+                                   int borderMode = BORDER_CONSTANT,
+                                   const Scalar& borderValue = Scalar());
+
+/** @brief Applies a generic geometrical transformation to an image.
+
+The function remap transforms the source image using the specified map:
+
+\f[\texttt{dst} (x,y) =  \texttt{src} (map_x(x,y),map_y(x,y))\f]
+
+where values of pixels with non-integer coordinates are computed using one of available
+interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps
+in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in
+\f$map_1\f$, or fixed-point maps created by using convertMaps. The reason you might want to
+convert from floating to fixed-point representations of a map is that they can yield much faster
+(\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x),
+cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients.
+
+This function cannot operate in-place.
+
+@param src Source image.
+@param dst Destination image. It has the same size as map1 and the same type as src .
+@param map1 The first map of either (x,y) points or just x values having the type CV_16SC2 ,
+CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point
+representation to fixed-point for speed.
+@param map2 The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map
+if map1 is (x,y) points), respectively.
+@param interpolation Interpolation method (see cv::InterpolationFlags). The method INTER_AREA is
+not supported by this function.
+@param borderMode Pixel extrapolation method (see cv::BorderTypes). When
+borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image that
+corresponds to the "outliers" in the source image are not modified by the function.
+@param borderValue Value used in case of a constant border. By default, it is 0.
+ */
+CV_EXPORTS_W void remap( InputArray src, OutputArray dst,
+                         InputArray map1, InputArray map2,
+                         int interpolation, int borderMode = BORDER_CONSTANT,
+                         const Scalar& borderValue = Scalar());
+
+/** @brief Converts image transformation maps from one representation to another.
+
+The function converts a pair of maps for remap from one representation to another. The following
+options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are
+supported:
+
+- \f$\texttt{(CV\_32FC1, CV\_32FC1)} \rightarrow \texttt{(CV\_16SC2, CV\_16UC1)}\f$. This is the
+most frequently used conversion operation, in which the original floating-point maps (see remap )
+are converted to a more compact and much faster fixed-point representation. The first output array
+contains the rounded coordinates and the second array (created only when nninterpolation=false )
+contains indices in the interpolation tables.
+
+- \f$\texttt{(CV\_32FC2)} \rightarrow \texttt{(CV\_16SC2, CV\_16UC1)}\f$. The same as above but
+the original maps are stored in one 2-channel matrix.
+
+- Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same
+as the originals.
+
+@param map1 The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 .
+@param map2 The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix),
+respectively.
+@param dstmap1 The first output map that has the type dstmap1type and the same size as src .
+@param dstmap2 The second output map.
+@param dstmap1type Type of the first output map that should be CV_16SC2, CV_32FC1, or
+CV_32FC2 .
+@param nninterpolation Flag indicating whether the fixed-point maps are used for the
+nearest-neighbor or for a more complex interpolation.
+
+@sa  remap, undistort, initUndistortRectifyMap
+ */
+CV_EXPORTS_W void convertMaps( InputArray map1, InputArray map2,
+                               OutputArray dstmap1, OutputArray dstmap2,
+                               int dstmap1type, bool nninterpolation = false );
+
+/** @brief Calculates an affine matrix of 2D rotation.
+
+The function calculates the following matrix:
+
+\f[\begin{bmatrix} \alpha &  \beta & (1- \alpha )  \cdot \texttt{center.x} -  \beta \cdot \texttt{center.y} \\ - \beta &  \alpha &  \beta \cdot \texttt{center.x} + (1- \alpha )  \cdot \texttt{center.y} \end{bmatrix}\f]
+
+where
+
+\f[\begin{array}{l} \alpha =  \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta =  \texttt{scale} \cdot \sin \texttt{angle} \end{array}\f]
+
+The transformation maps the rotation center to itself. If this is not the target, adjust the shift.
+
+@param center Center of the rotation in the source image.
+@param angle Rotation angle in degrees. Positive values mean counter-clockwise rotation (the
+coordinate origin is assumed to be the top-left corner).
+@param scale Isotropic scale factor.
+
+@sa  getAffineTransform, warpAffine, transform
+ */
+CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
+
+//! returns 3x3 perspective transformation for the corresponding 4 point pairs.
+CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
+
+/** @brief Calculates an affine transform from three pairs of the corresponding points.
+
+The function calculates the \f$2 \times 3\f$ matrix of an affine transform so that:
+
+\f[\begin{bmatrix} x'_i \\ y'_i \end{bmatrix} = \texttt{map\_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f]
+
+where
+
+\f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2\f]
+
+@param src Coordinates of triangle vertices in the source image.
+@param dst Coordinates of the corresponding triangle vertices in the destination image.
+
+@sa  warpAffine, transform
+ */
+CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
+
+/** @brief Inverts an affine transformation.
+
+The function computes an inverse affine transformation represented by \f$2 \times 3\f$ matrix M:
+
+\f[\begin{bmatrix} a_{11} & a_{12} & b_1  \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f]
+
+The result is also a \f$2 \times 3\f$ matrix of the same type as M.
+
+@param M Original affine transformation.
+@param iM Output reverse affine transformation.
+ */
+CV_EXPORTS_W void invertAffineTransform( InputArray M, OutputArray iM );
+
+/** @brief Calculates a perspective transform from four pairs of the corresponding points.
+
+The function calculates the \f$3 \times 3\f$ matrix of a perspective transform so that:
+
+\f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map\_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f]
+
+where
+
+\f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f]
+
+@param src Coordinates of quadrangle vertices in the source image.
+@param dst Coordinates of the corresponding quadrangle vertices in the destination image.
+
+@sa  findHomography, warpPerspective, perspectiveTransform
+ */
+CV_EXPORTS_W Mat getPerspectiveTransform( InputArray src, InputArray dst );
+
+CV_EXPORTS_W Mat getAffineTransform( InputArray src, InputArray dst );
+
+/** @brief Retrieves a pixel rectangle from an image with sub-pixel accuracy.
+
+The function getRectSubPix extracts pixels from src:
+
+\f[dst(x, y) = src(x +  \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y +  \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f]
+
+where the values of the pixels at non-integer coordinates are retrieved using bilinear
+interpolation. Every channel of multi-channel images is processed independently. While the center of
+the rectangle must be inside the image, parts of the rectangle may be outside. In this case, the
+replication border mode (see cv::BorderTypes) is used to extrapolate the pixel values outside of
+the image.
+
+@param image Source image.
+@param patchSize Size of the extracted patch.
+@param center Floating point coordinates of the center of the extracted rectangle within the
+source image. The center must be inside the image.
+@param patch Extracted patch that has the size patchSize and the same number of channels as src .
+@param patchType Depth of the extracted pixels. By default, they have the same depth as src .
+
+@sa  warpAffine, warpPerspective
+ */
+CV_EXPORTS_W void getRectSubPix( InputArray image, Size patchSize,
+                                 Point2f center, OutputArray patch, int patchType = -1 );
+
+/** @example polar_transforms.cpp
+An example using the cv::linearPolar and cv::logPolar operations
+*/
+
+/** @brief Remaps an image to log-polar space.
+
+transforms the source image using the following transformation:
+\f[dst( \phi , \rho ) = src(x,y)\f]
+where
+\f[\rho = M  \cdot \log{\sqrt{x^2 + y^2}} , \phi =atan(y/x)\f]
+
+The function emulates the human "foveal" vision and can be used for fast scale and
+rotation-invariant template matching, for object tracking and so forth. The function can not operate
+in-place.
+
+@param src Source image
+@param dst Destination image
+@param center The transformation center; where the output precision is maximal
+@param M Magnitude scale parameter.
+@param flags A combination of interpolation methods, see cv::InterpolationFlags
+ */
+CV_EXPORTS_W void logPolar( InputArray src, OutputArray dst,
+                            Point2f center, double M, int flags );
+
+/** @brief Remaps an image to polar space.
+
+transforms the source image using the following transformation:
+\f[dst( \phi , \rho ) = src(x,y)\f]
+where
+\f[\rho = (src.width/maxRadius)  \cdot \sqrt{x^2 + y^2} , \phi =atan(y/x)\f]
+
+The function can not operate in-place.
+
+@param src Source image
+@param dst Destination image
+@param center The transformation center;
+@param maxRadius Inverse magnitude scale parameter
+@param flags A combination of interpolation methods, see cv::InterpolationFlags
+ */
+CV_EXPORTS_W void linearPolar( InputArray src, OutputArray dst,
+                               Point2f center, double maxRadius, int flags );
+
+//! @} imgproc_transform
+
+//! @addtogroup imgproc_misc
+//! @{
+
+/** @overload */
+CV_EXPORTS_W void integral( InputArray src, OutputArray sum, int sdepth = -1 );
+
+/** @overload */
+CV_EXPORTS_AS(integral2) void integral( InputArray src, OutputArray sum,
+                                        OutputArray sqsum, int sdepth = -1, int sqdepth = -1 );
+
+/** @brief Calculates the integral of an image.
+
+The functions calculate one or more integral images for the source image as follows:
+
+\f[\texttt{sum} (X,Y) =  \sum _{x<X,y<Y}  \texttt{image} (x,y)\f]
+
+\f[\texttt{sqsum} (X,Y) =  \sum _{x<X,y<Y}  \texttt{image} (x,y)^2\f]
+
+\f[\texttt{tilted} (X,Y) =  \sum _{y<Y,abs(x-X+1) \leq Y-y-1}  \texttt{image} (x,y)\f]
+
+Using these integral images, you can calculate sum, mean, and standard deviation over a specific
+up-right or rotated rectangular region of the image in a constant time, for example:
+
+\f[\sum _{x_1 \leq x < x_2,  \, y_1  \leq y < y_2}  \texttt{image} (x,y) =  \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\f]
+
+It makes possible to do a fast blurring or fast block correlation with a variable window size, for
+example. In case of multi-channel images, sums for each channel are accumulated independently.
+
+As a practical example, the next figure shows the calculation of the integral of a straight
+rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the
+original image are shown, as well as the relative pixels in the integral images sum and tilted .
+
+![integral calculation example](pics/integral.png)
+
+@param src input image as \f$W \times H\f$, 8-bit or floating-point (32f or 64f).
+@param sum integral image as \f$(W+1)\times (H+1)\f$ , 32-bit integer or floating-point (32f or 64f).
+@param sqsum integral image for squared pixel values; it is \f$(W+1)\times (H+1)\f$, double-precision
+floating-point (64f) array.
+@param tilted integral for the image rotated by 45 degrees; it is \f$(W+1)\times (H+1)\f$ array with
+the same data type as sum.
+@param sdepth desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or
+CV_64F.
+@param sqdepth desired depth of the integral image of squared pixel values, CV_32F or CV_64F.
+ */
+CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum,
+                                        OutputArray sqsum, OutputArray tilted,
+                                        int sdepth = -1, int sqdepth = -1 );
+
+//! @} imgproc_misc
+
+//! @addtogroup imgproc_motion
+//! @{
+
+/** @brief Adds an image to the accumulator.
+
+The function adds src or some of its elements to dst :
+
+\f[\texttt{dst} (x,y)  \leftarrow \texttt{dst} (x,y) +  \texttt{src} (x,y)  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0\f]
+
+The function supports multi-channel images. Each channel is processed independently.
+
+The functions accumulate\* can be used, for example, to collect statistics of a scene background
+viewed by a still camera and for the further foreground-background segmentation.
+
+@param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
+@param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
+floating-point.
+@param mask Optional operation mask.
+
+@sa  accumulateSquare, accumulateProduct, accumulateWeighted
+ */
+CV_EXPORTS_W void accumulate( InputArray src, InputOutputArray dst,
+                              InputArray mask = noArray() );
+
+/** @brief Adds the square of a source image to the accumulator.
+
+The function adds the input image src or its selected region, raised to a power of 2, to the
+accumulator dst :
+
+\f[\texttt{dst} (x,y)  \leftarrow \texttt{dst} (x,y) +  \texttt{src} (x,y)^2  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0\f]
+
+The function supports multi-channel images. Each channel is processed independently.
+
+@param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
+@param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
+floating-point.
+@param mask Optional operation mask.
+
+@sa  accumulateSquare, accumulateProduct, accumulateWeighted
+ */
+CV_EXPORTS_W void accumulateSquare( InputArray src, InputOutputArray dst,
+                                    InputArray mask = noArray() );
+
+/** @brief Adds the per-element product of two input images to the accumulator.
+
+The function adds the product of two images or their selected regions to the accumulator dst :
+
+\f[\texttt{dst} (x,y)  \leftarrow \texttt{dst} (x,y) +  \texttt{src1} (x,y)  \cdot \texttt{src2} (x,y)  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0\f]
+
+The function supports multi-channel images. Each channel is processed independently.
+
+@param src1 First input image, 1- or 3-channel, 8-bit or 32-bit floating point.
+@param src2 Second input image of the same type and the same size as src1 .
+@param dst %Accumulator with the same number of channels as input images, 32-bit or 64-bit
+floating-point.
+@param mask Optional operation mask.
+
+@sa  accumulate, accumulateSquare, accumulateWeighted
+ */
+CV_EXPORTS_W void accumulateProduct( InputArray src1, InputArray src2,
+                                     InputOutputArray dst, InputArray mask=noArray() );
+
+/** @brief Updates a running average.
+
+The function calculates the weighted sum of the input image src and the accumulator dst so that dst
+becomes a running average of a frame sequence:
+
+\f[\texttt{dst} (x,y)  \leftarrow (1- \texttt{alpha} )  \cdot \texttt{dst} (x,y) +  \texttt{alpha} \cdot \texttt{src} (x,y)  \quad \text{if} \quad \texttt{mask} (x,y)  \ne 0\f]
+
+That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images).
+The function supports multi-channel images. Each channel is processed independently.
+
+@param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point.
+@param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit
+floating-point.
+@param alpha Weight of the input image.
+@param mask Optional operation mask.
+
+@sa  accumulate, accumulateSquare, accumulateProduct
+ */
+CV_EXPORTS_W void accumulateWeighted( InputArray src, InputOutputArray dst,
+                                      double alpha, InputArray mask = noArray() );
+
+/** @brief The function is used to detect translational shifts that occur between two images.
+
+The operation takes advantage of the Fourier shift theorem for detecting the translational shift in
+the frequency domain. It can be used for fast image registration as well as motion estimation. For
+more information please see <http://en.wikipedia.org/wiki/Phase_correlation>
+
+Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed
+with getOptimalDFTSize.
+
+The function performs the following equations:
+- First it applies a Hanning window (see <http://en.wikipedia.org/wiki/Hann_function>) to each
+image to remove possible edge effects. This window is cached until the array size changes to speed
+up processing time.
+- Next it computes the forward DFTs of each source array:
+\f[\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\f]
+where \f$\mathcal{F}\f$ is the forward DFT.
+- It then computes the cross-power spectrum of each frequency domain array:
+\f[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\f]
+- Next the cross-correlation is converted back into the time domain via the inverse DFT:
+\f[r = \mathcal{F}^{-1}\{R\}\f]
+- Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to
+achieve sub-pixel accuracy.
+\f[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\f]
+- If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5
+centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single
+peak) and will be smaller when there are multiple peaks.
+
+@param src1 Source floating point array (CV_32FC1 or CV_64FC1)
+@param src2 Source floating point array (CV_32FC1 or CV_64FC1)
+@param window Floating point array with windowing coefficients to reduce edge effects (optional).
+@param response Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional).
+@returns detected phase shift (sub-pixel) between the two arrays.
+
+@sa dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow
+ */
+CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2,
+                                    InputArray window = noArray(), CV_OUT double* response = 0);
+
+/** @brief This function computes a Hanning window coefficients in two dimensions.
+
+See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function)
+for more information.
+
+An example is shown below:
+@code
+    // create hanning window of size 100x100 and type CV_32F
+    Mat hann;
+    createHanningWindow(hann, Size(100, 100), CV_32F);
+@endcode
+@param dst Destination array to place Hann coefficients in
+@param winSize The window size specifications
+@param type Created array type
+ */
+CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type);
+
+//! @} imgproc_motion
+
+//! @addtogroup imgproc_misc
+//! @{
+
+/** @brief Applies a fixed-level threshold to each array element.
+
+The function applies fixed-level thresholding to a single-channel array. The function is typically
+used to get a bi-level (binary) image out of a grayscale image ( cv::compare could be also used for
+this purpose) or for removing a noise, that is, filtering out pixels with too small or too large
+values. There are several types of thresholding supported by the function. They are determined by
+type parameter.
+
+Also, the special values cv::THRESH_OTSU or cv::THRESH_TRIANGLE may be combined with one of the
+above values. In these cases, the function determines the optimal threshold value using the Otsu's
+or Triangle algorithm and uses it instead of the specified thresh . The function returns the
+computed threshold value. Currently, the Otsu's and Triangle methods are implemented only for 8-bit
+images.
+
+@param src input array (single-channel, 8-bit or 32-bit floating point).
+@param dst output array of the same size and type as src.
+@param thresh threshold value.
+@param maxval maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding
+types.
+@param type thresholding type (see the cv::ThresholdTypes).
+
+@sa  adaptiveThreshold, findContours, compare, min, max
+ */
+CV_EXPORTS_W double threshold( InputArray src, OutputArray dst,
+                               double thresh, double maxval, int type );
+
+
+/** @brief Applies an adaptive threshold to an array.
+
+The function transforms a grayscale image to a binary image according to the formulae:
+-   **THRESH_BINARY**
+    \f[dst(x,y) =  \fork{\texttt{maxValue}}{if \(src(x,y) > T(x,y)\)}{0}{otherwise}\f]
+-   **THRESH_BINARY_INV**
+    \f[dst(x,y) =  \fork{0}{if \(src(x,y) > T(x,y)\)}{\texttt{maxValue}}{otherwise}\f]
+where \f$T(x,y)\f$ is a threshold calculated individually for each pixel (see adaptiveMethod parameter).
+
+The function can process the image in-place.
+
+@param src Source 8-bit single-channel image.
+@param dst Destination image of the same size and the same type as src.
+@param maxValue Non-zero value assigned to the pixels for which the condition is satisfied
+@param adaptiveMethod Adaptive thresholding algorithm to use, see cv::AdaptiveThresholdTypes
+@param thresholdType Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV,
+see cv::ThresholdTypes.
+@param blockSize Size of a pixel neighborhood that is used to calculate a threshold value for the
+pixel: 3, 5, 7, and so on.
+@param C Constant subtracted from the mean or weighted mean (see the details below). Normally, it
+is positive but may be zero or negative as well.
+
+@sa  threshold, blur, GaussianBlur
+ */
+CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst,
+                                     double maxValue, int adaptiveMethod,
+                                     int thresholdType, int blockSize, double C );
+
+//! @} imgproc_misc
+
+//! @addtogroup imgproc_filter
+//! @{
+
+/** @brief Blurs an image and downsamples it.
+
+By default, size of the output image is computed as `Size((src.cols+1)/2, (src.rows+1)/2)`, but in
+any case, the following conditions should be satisfied:
+
+\f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f]
+
+The function performs the downsampling step of the Gaussian pyramid construction. First, it
+convolves the source image with the kernel:
+
+\f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1  \\ 4 & 16 & 24 & 16 & 4  \\ 6 & 24 & 36 & 24 & 6  \\ 4 & 16 & 24 & 16 & 4  \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f]
+
+Then, it downsamples the image by rejecting even rows and columns.
+
+@param src input image.
+@param dst output image; it has the specified size and the same type as src.
+@param dstsize size of the output image.
+@param borderType Pixel extrapolation method, see cv::BorderTypes (BORDER_CONSTANT isn't supported)
+ */
+CV_EXPORTS_W void pyrDown( InputArray src, OutputArray dst,
+                           const Size& dstsize = Size(), int borderType = BORDER_DEFAULT );
+
+/** @brief Upsamples an image and then blurs it.
+
+By default, size of the output image is computed as `Size(src.cols\*2, (src.rows\*2)`, but in any
+case, the following conditions should be satisfied:
+
+\f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq  ( \texttt{dstsize.width}   \mod  2)  \\ | \texttt{dstsize.height} -src.rows*2| \leq  ( \texttt{dstsize.height}   \mod  2) \end{array}\f]
+
+The function performs the upsampling step of the Gaussian pyramid construction, though it can
+actually be used to construct the Laplacian pyramid. First, it upsamples the source image by
+injecting even zero rows and columns and then convolves the result with the same kernel as in
+pyrDown multiplied by 4.
+
+@param src input image.
+@param dst output image. It has the specified size and the same type as src .
+@param dstsize size of the output image.
+@param borderType Pixel extrapolation method, see cv::BorderTypes (only BORDER_DEFAULT is supported)
+ */
+CV_EXPORTS_W void pyrUp( InputArray src, OutputArray dst,
+                         const Size& dstsize = Size(), int borderType = BORDER_DEFAULT );
+
+/** @brief Constructs the Gaussian pyramid for an image.
+
+The function constructs a vector of images and builds the Gaussian pyramid by recursively applying
+pyrDown to the previously built pyramid layers, starting from `dst[0]==src`.
+
+@param src Source image. Check pyrDown for the list of supported types.
+@param dst Destination vector of maxlevel+1 images of the same type as src. dst[0] will be the
+same as src. dst[1] is the next pyramid layer, a smoothed and down-sized src, and so on.
+@param maxlevel 0-based index of the last (the smallest) pyramid layer. It must be non-negative.
+@param borderType Pixel extrapolation method, see cv::BorderTypes (BORDER_CONSTANT isn't supported)
+ */
+CV_EXPORTS void buildPyramid( InputArray src, OutputArrayOfArrays dst,
+                              int maxlevel, int borderType = BORDER_DEFAULT );
+
+//! @} imgproc_filter
+
+//! @addtogroup imgproc_transform
+//! @{
+
+/** @brief Transforms an image to compensate for lens distortion.
+
+The function transforms an image to compensate radial and tangential lens distortion.
+
+The function is simply a combination of cv::initUndistortRectifyMap (with unity R ) and cv::remap
+(with bilinear interpolation). See the former function for details of the transformation being
+performed.
+
+Those pixels in the destination image, for which there is no correspondent pixels in the source
+image, are filled with zeros (black color).
+
+A particular subset of the source image that will be visible in the corrected image can be regulated
+by newCameraMatrix. You can use cv::getOptimalNewCameraMatrix to compute the appropriate
+newCameraMatrix depending on your requirements.
+
+The camera matrix and the distortion parameters can be determined using cv::calibrateCamera. If
+the resolution of images is different from the resolution used at the calibration stage, \f$f_x,
+f_y, c_x\f$ and \f$c_y\f$ need to be scaled accordingly, while the distortion coefficients remain
+the same.
+
+@param src Input (distorted) image.
+@param dst Output (corrected) image that has the same size and type as src .
+@param cameraMatrix Input camera matrix \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$
+of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
+@param newCameraMatrix Camera matrix of the distorted image. By default, it is the same as
+cameraMatrix but you may additionally scale and shift the result by using a different matrix.
+ */
+CV_EXPORTS_W void undistort( InputArray src, OutputArray dst,
+                             InputArray cameraMatrix,
+                             InputArray distCoeffs,
+                             InputArray newCameraMatrix = noArray() );
+
+/** @brief Computes the undistortion and rectification transformation map.
+
+The function computes the joint undistortion and rectification transformation and represents the
+result in the form of maps for remap. The undistorted image looks like original, as if it is
+captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a
+monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by
+cv::getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera,
+newCameraMatrix is normally set to P1 or P2 computed by cv::stereoRectify .
+
+Also, this new camera is oriented differently in the coordinate space, according to R. That, for
+example, helps to align two heads of a stereo camera so that the epipolar lines on both images
+become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera).
+
+The function actually builds the maps for the inverse mapping algorithm that is used by remap. That
+is, for each pixel \f$(u, v)\f$ in the destination (corrected and rectified) image, the function
+computes the corresponding coordinates in the source image (that is, in the original image from
+camera). The following process is applied:
+\f[
+\begin{array}{l}
+x  \leftarrow (u - {c'}_x)/{f'}_x  \\
+y  \leftarrow (v - {c'}_y)/{f'}_y  \\
+{[X\,Y\,W]} ^T  \leftarrow R^{-1}*[x \, y \, 1]^T  \\
+x'  \leftarrow X/W  \\
+y'  \leftarrow Y/W  \\
+r^2  \leftarrow x'^2 + y'^2 \\
+x''  \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}
++ 2p_1 x' y' + p_2(r^2 + 2 x'^2)  + s_1 r^2 + s_2 r^4\\
+y''  \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6}
++ p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\
+s\vecthree{x'''}{y'''}{1} =
+\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)}
+{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)}
+{0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\
+map_x(u,v)  \leftarrow x''' f_x + c_x  \\
+map_y(u,v)  \leftarrow y''' f_y + c_y
+\end{array}
+\f]
+where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$
+are the distortion coefficients.
+
+In case of a stereo camera, this function is called twice: once for each camera head, after
+stereoRectify, which in its turn is called after cv::stereoCalibrate. But if the stereo camera
+was not calibrated, it is still possible to compute the rectification transformations directly from
+the fundamental matrix using cv::stereoRectifyUncalibrated. For each camera, the function computes
+homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D
+space. R can be computed from H as
+\f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f]
+where cameraMatrix can be chosen arbitrarily.
+
+@param cameraMatrix Input camera matrix \f$A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$
+of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
+@param R Optional rectification transformation in the object space (3x3 matrix). R1 or R2 ,
+computed by stereoRectify can be passed here. If the matrix is empty, the identity transformation
+is assumed. In cvInitUndistortMap R assumed to be an identity matrix.
+@param newCameraMatrix New camera matrix \f$A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}\f$.
+@param size Undistorted image size.
+@param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2, see cv::convertMaps
+@param map1 The first output map.
+@param map2 The second output map.
+ */
+CV_EXPORTS_W void initUndistortRectifyMap( InputArray cameraMatrix, InputArray distCoeffs,
+                           InputArray R, InputArray newCameraMatrix,
+                           Size size, int m1type, OutputArray map1, OutputArray map2 );
+
+//! initializes maps for cv::remap() for wide-angle
+CV_EXPORTS_W float initWideAngleProjMap( InputArray cameraMatrix, InputArray distCoeffs,
+                                         Size imageSize, int destImageWidth,
+                                         int m1type, OutputArray map1, OutputArray map2,
+                                         int projType = PROJ_SPHERICAL_EQRECT, double alpha = 0);
+
+/** @brief Returns the default new camera matrix.
+
+The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when
+centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true).
+
+In the latter case, the new camera matrix will be:
+
+\f[\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5  \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5  \\ 0 && 0 && 1 \end{bmatrix} ,\f]
+
+where \f$f_x\f$ and \f$f_y\f$ are \f$(0,0)\f$ and \f$(1,1)\f$ elements of cameraMatrix, respectively.
+
+By default, the undistortion functions in OpenCV (see initUndistortRectifyMap, undistort) do not
+move the principal point. However, when you work with stereo, it is important to move the principal
+points in both views to the same y-coordinate (which is required by most of stereo correspondence
+algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for
+each view where the principal points are located at the center.
+
+@param cameraMatrix Input camera matrix.
+@param imgsize Camera view image size in pixels.
+@param centerPrincipalPoint Location of the principal point in the new camera matrix. The
+parameter indicates whether this location should be at the image center or not.
+ */
+CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsize = Size(),
+                                            bool centerPrincipalPoint = false );
+
+/** @brief Computes the ideal point coordinates from the observed point coordinates.
+
+The function is similar to cv::undistort and cv::initUndistortRectifyMap but it operates on a
+sparse set of points instead of a raster image. Also the function performs a reverse transformation
+to projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a
+planar object, it does, up to a translation vector, if the proper R is specified.
+@code
+    // (u,v) is the input point, (u', v') is the output point
+    // camera_matrix=[fx 0 cx; 0 fy cy; 0 0 1]
+    // P=[fx' 0 cx' tx; 0 fy' cy' ty; 0 0 1 tz]
+    x" = (u - cx)/fx
+    y" = (v - cy)/fy
+    (x',y') = undistort(x",y",dist_coeffs)
+    [X,Y,W]T = R*[x' y' 1]T
+    x = X/W, y = Y/W
+    // only performed if P=[fx' 0 cx' [tx]; 0 fy' cy' [ty]; 0 0 1 [tz]] is specified
+    u' = x*fx' + cx'
+    v' = y*fy' + cy',
+@endcode
+where cv::undistort is an approximate iterative algorithm that estimates the normalized original
+point coordinates out of the normalized distorted point coordinates ("normalized" means that the
+coordinates do not depend on the camera matrix).
+
+The function can be used for both a stereo camera head or a monocular camera (when R is empty).
+
+@param src Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2).
+@param dst Output ideal point coordinates after undistortion and reverse perspective
+transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.
+@param cameraMatrix Camera matrix \f$\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
+@param distCoeffs Input vector of distortion coefficients
+\f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$
+of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.
+@param R Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by
+cv::stereoRectify can be passed here. If the matrix is empty, the identity transformation is used.
+@param P New camera matrix (3x3) or new projection matrix (3x4). P1 or P2 computed by
+cv::stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used.
+ */
+CV_EXPORTS_W void undistortPoints( InputArray src, OutputArray dst,
+                                   InputArray cameraMatrix, InputArray distCoeffs,
+                                   InputArray R = noArray(), InputArray P = noArray());
+
+//! @} imgproc_transform
+
+//! @addtogroup imgproc_hist
+//! @{
+
+/** @example demhist.cpp
+An example for creating histograms of an image
+*/
+
+/** @brief Calculates a histogram of a set of arrays.
+
+The functions calcHist calculate the histogram of one or more arrays. The elements of a tuple used
+to increment a histogram bin are taken from the corresponding input arrays at the same location. The
+sample below shows how to compute a 2D Hue-Saturation histogram for a color image. :
+@code
+    #include <opencv2/imgproc.hpp>
+    #include <opencv2/highgui.hpp>
+
+    using namespace cv;
+
+    int main( int argc, char** argv )
+    {
+        Mat src, hsv;
+        if( argc != 2 || !(src=imread(argv[1], 1)).data )
+            return -1;
+
+        cvtColor(src, hsv, COLOR_BGR2HSV);
+
+        // Quantize the hue to 30 levels
+        // and the saturation to 32 levels
+        int hbins = 30, sbins = 32;
+        int histSize[] = {hbins, sbins};
+        // hue varies from 0 to 179, see cvtColor
+        float hranges[] = { 0, 180 };
+        // saturation varies from 0 (black-gray-white) to
+        // 255 (pure spectrum color)
+        float sranges[] = { 0, 256 };
+        const float* ranges[] = { hranges, sranges };
+        MatND hist;
+        // we compute the histogram from the 0-th and 1-st channels
+        int channels[] = {0, 1};
+
+        calcHist( &hsv, 1, channels, Mat(), // do not use mask
+                 hist, 2, histSize, ranges,
+                 true, // the histogram is uniform
+                 false );
+        double maxVal=0;
+        minMaxLoc(hist, 0, &maxVal, 0, 0);
+
+        int scale = 10;
+        Mat histImg = Mat::zeros(sbins*scale, hbins*10, CV_8UC3);
+
+        for( int h = 0; h < hbins; h++ )
+            for( int s = 0; s < sbins; s++ )
+            {
+                float binVal = hist.at<float>(h, s);
+                int intensity = cvRound(binVal*255/maxVal);
+                rectangle( histImg, Point(h*scale, s*scale),
+                            Point( (h+1)*scale - 1, (s+1)*scale - 1),
+                            Scalar::all(intensity),
+                            CV_FILLED );
+            }
+
+        namedWindow( "Source", 1 );
+        imshow( "Source", src );
+
+        namedWindow( "H-S Histogram", 1 );
+        imshow( "H-S Histogram", histImg );
+        waitKey();
+    }
+@endcode
+
+@param images Source arrays. They all should have the same depth, CV_8U or CV_32F , and the same
+size. Each of them can have an arbitrary number of channels.
+@param nimages Number of source images.
+@param channels List of the dims channels used to compute the histogram. The first array channels
+are numerated from 0 to images[0].channels()-1 , the second array channels are counted from
+images[0].channels() to images[0].channels() + images[1].channels()-1, and so on.
+@param mask Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size
+as images[i] . The non-zero mask elements mark the array elements counted in the histogram.
+@param hist Output histogram, which is a dense or sparse dims -dimensional array.
+@param dims Histogram dimensionality that must be positive and not greater than CV_MAX_DIMS
+(equal to 32 in the current OpenCV version).
+@param histSize Array of histogram sizes in each dimension.
+@param ranges Array of the dims arrays of the histogram bin boundaries in each dimension. When the
+histogram is uniform ( uniform =true), then for each dimension i it is enough to specify the lower
+(inclusive) boundary \f$L_0\f$ of the 0-th histogram bin and the upper (exclusive) boundary
+\f$U_{\texttt{histSize}[i]-1}\f$ for the last histogram bin histSize[i]-1 . That is, in case of a
+uniform histogram each of ranges[i] is an array of 2 elements. When the histogram is not uniform (
+uniform=false ), then each of ranges[i] contains histSize[i]+1 elements:
+\f$L_0, U_0=L_1, U_1=L_2, ..., U_{\texttt{histSize[i]}-2}=L_{\texttt{histSize[i]}-1}, U_{\texttt{histSize[i]}-1}\f$
+. The array elements, that are not between \f$L_0\f$ and \f$U_{\texttt{histSize[i]}-1}\f$ , are not
+counted in the histogram.
+@param uniform Flag indicating whether the histogram is uniform or not (see above).
+@param accumulate Accumulation flag. If it is set, the histogram is not cleared in the beginning
+when it is allocated. This feature enables you to compute a single histogram from several sets of
+arrays, or to update the histogram in time.
+*/
+CV_EXPORTS void calcHist( const Mat* images, int nimages,
+                          const int* channels, InputArray mask,
+                          OutputArray hist, int dims, const int* histSize,
+                          const float** ranges, bool uniform = true, bool accumulate = false );
+
+/** @overload
+
+this variant uses cv::SparseMat for output
+*/
+CV_EXPORTS void calcHist( const Mat* images, int nimages,
+                          const int* channels, InputArray mask,
+                          SparseMat& hist, int dims,
+                          const int* histSize, const float** ranges,
+                          bool uniform = true, bool accumulate = false );
+
+/** @overload */
+CV_EXPORTS_W void calcHist( InputArrayOfArrays images,
+                            const std::vector<int>& channels,
+                            InputArray mask, OutputArray hist,
+                            const std::vector<int>& histSize,
+                            const std::vector<float>& ranges,
+                            bool accumulate = false );
+
+/** @brief Calculates the back projection of a histogram.
+
+The functions calcBackProject calculate the back project of the histogram. That is, similarly to
+cv::calcHist , at each location (x, y) the function collects the values from the selected channels
+in the input images and finds the corresponding histogram bin. But instead of incrementing it, the
+function reads the bin value, scales it by scale , and stores in backProject(x,y) . In terms of
+statistics, the function computes probability of each element value in respect with the empirical
+probability distribution represented by the histogram. See how, for example, you can find and track
+a bright-colored object in a scene:
+
+- Before tracking, show the object to the camera so that it covers almost the whole frame.
+Calculate a hue histogram. The histogram may have strong maximums, corresponding to the dominant
+colors in the object.
+
+- When tracking, calculate a back projection of a hue plane of each input video frame using that
+pre-computed histogram. Threshold the back projection to suppress weak colors. It may also make
+sense to suppress pixels with non-sufficient color saturation and too dark or too bright pixels.
+
+- Find connected components in the resulting picture and choose, for example, the largest
+component.
+
+This is an approximate algorithm of the CamShift color object tracker.
+
+@param images Source arrays. They all should have the same depth, CV_8U or CV_32F , and the same
+size. Each of them can have an arbitrary number of channels.
+@param nimages Number of source images.
+@param channels The list of channels used to compute the back projection. The number of channels
+must match the histogram dimensionality. The first array channels are numerated from 0 to
+images[0].channels()-1 , the second array channels are counted from images[0].channels() to
+images[0].channels() + images[1].channels()-1, and so on.
+@param hist Input histogram that can be dense or sparse.
+@param backProject Destination back projection array that is a single-channel array of the same
+size and depth as images[0] .
+@param ranges Array of arrays of the histogram bin boundaries in each dimension. See calcHist .
+@param scale Optional scale factor for the output back projection.
+@param uniform Flag indicating whether the histogram is uniform or not (see above).
+
+@sa cv::calcHist, cv::compareHist
+ */
+CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
+                                 const int* channels, InputArray hist,
+                                 OutputArray backProject, const float** ranges,
+                                 double scale = 1, bool uniform = true );
+
+/** @overload */
+CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
+                                 const int* channels, const SparseMat& hist,
+                                 OutputArray backProject, const float** ranges,
+                                 double scale = 1, bool uniform = true );
+
+/** @overload */
+CV_EXPORTS_W void calcBackProject( InputArrayOfArrays images, const std::vector<int>& channels,
+                                   InputArray hist, OutputArray dst,
+                                   const std::vector<float>& ranges,
+                                   double scale );
+
+/** @brief Compares two histograms.
+
+The function compare two dense or two sparse histograms using the specified method.
+
+The function returns \f$d(H_1, H_2)\f$ .
+
+While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable
+for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling
+problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms
+or more general sparse configurations of weighted points, consider using the cv::EMD function.
+
+@param H1 First compared histogram.
+@param H2 Second compared histogram of the same size as H1 .
+@param method Comparison method, see cv::HistCompMethods
+ */
+CV_EXPORTS_W double compareHist( InputArray H1, InputArray H2, int method );
+
+/** @overload */
+CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
+
+/** @brief Equalizes the histogram of a grayscale image.
+
+The function equalizes the histogram of the input image using the following algorithm:
+
+- Calculate the histogram \f$H\f$ for src .
+- Normalize the histogram so that the sum of histogram bins is 255.
+- Compute the integral of the histogram:
+\f[H'_i =  \sum _{0  \le j < i} H(j)\f]
+- Transform the image using \f$H'\f$ as a look-up table: \f$\texttt{dst}(x,y) = H'(\texttt{src}(x,y))\f$
+
+The algorithm normalizes the brightness and increases the contrast of the image.
+
+@param src Source 8-bit single channel image.
+@param dst Destination image of the same size and type as src .
+ */
+CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
+
+/** @brief Computes the "minimal work" distance between two weighted point configurations.
+
+The function computes the earth mover distance and/or a lower boundary of the distance between the
+two weighted point configurations. One of the applications described in @cite RubnerSept98,
+@cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation
+problem that is solved using some modification of a simplex algorithm, thus the complexity is
+exponential in the worst case, though, on average it is much faster. In the case of a real metric
+the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used
+to determine roughly whether the two signatures are far enough so that they cannot relate to the
+same object.
+
+@param signature1 First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix.
+Each row stores the point weight followed by the point coordinates. The matrix is allowed to have
+a single column (weights only) if the user-defined cost matrix is used.
+@param signature2 Second signature of the same format as signature1 , though the number of rows
+may be different. The total weights may be different. In this case an extra "dummy" point is added
+to either signature1 or signature2 .
+@param distType Used metric. See cv::DistanceTypes.
+@param cost User-defined \f$\texttt{size1}\times \texttt{size2}\f$ cost matrix. Also, if a cost matrix
+is used, lower boundary lowerBound cannot be calculated because it needs a metric function.
+@param lowerBound Optional input/output parameter: lower boundary of a distance between the two
+signatures that is a distance between mass centers. The lower boundary may not be calculated if
+the user-defined cost matrix is used, the total weights of point configurations are not equal, or
+if the signatures consist of weights only (the signature matrices have a single column). You
+**must** initialize \*lowerBound . If the calculated distance between mass centers is greater or
+equal to \*lowerBound (it means that the signatures are far enough), the function does not
+calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on
+return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound
+should be set to 0.
+@param flow Resultant \f$\texttt{size1} \times \texttt{size2}\f$ flow matrix: \f$\texttt{flow}_{i,j}\f$ is
+a flow from \f$i\f$ -th point of signature1 to \f$j\f$ -th point of signature2 .
+ */
+CV_EXPORTS float EMD( InputArray signature1, InputArray signature2,
+                      int distType, InputArray cost=noArray(),
+                      float* lowerBound = 0, OutputArray flow = noArray() );
+
+//! @} imgproc_hist
+
+/** @example watershed.cpp
+An example using the watershed algorithm
+ */
+
+/** @brief Performs a marker-based image segmentation using the watershed algorithm.
+
+The function implements one of the variants of watershed, non-parametric marker-based segmentation
+algorithm, described in @cite Meyer92 .
+
+Before passing the image to the function, you have to roughly outline the desired regions in the
+image markers with positive (\>0) indices. So, every region is represented as one or more connected
+components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary
+mask using findContours and drawContours (see the watershed.cpp demo). The markers are "seeds" of
+the future image regions. All the other pixels in markers , whose relation to the outlined regions
+is not known and should be defined by the algorithm, should be set to 0's. In the function output,
+each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the
+regions.
+
+@note Any two neighbor connected components are not necessarily separated by a watershed boundary
+(-1's pixels); for example, they can touch each other in the initial marker image passed to the
+function.
+
+@param image Input 8-bit 3-channel image.
+@param markers Input/output 32-bit single-channel image (map) of markers. It should have the same
+size as image .
+
+@sa findContours
+
+@ingroup imgproc_misc
+ */
+CV_EXPORTS_W void watershed( InputArray image, InputOutputArray markers );
+
+//! @addtogroup imgproc_filter
+//! @{
+
+/** @brief Performs initial step of meanshift segmentation of an image.
+
+The function implements the filtering stage of meanshift segmentation, that is, the output of the
+function is the filtered "posterized" image with color gradients and fine-grain texture flattened.
+At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes
+meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is
+considered:
+
+\f[(x,y): X- \texttt{sp} \le x  \le X+ \texttt{sp} , Y- \texttt{sp} \le y  \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)||   \le \texttt{sr}\f]
+
+where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively
+(though, the algorithm does not depend on the color space used, so any 3-component color space can
+be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector
+(R',G',B') are found and they act as the neighborhood center on the next iteration:
+
+\f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f]
+
+After the iterations over, the color components of the initial pixel (that is, the pixel from where
+the iterations started) are set to the final value (average color at the last iteration):
+
+\f[I(X,Y) <- (R*,G*,B*)\f]
+
+When maxLevel \> 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is
+run on the smallest layer first. After that, the results are propagated to the larger layer and the
+iterations are run again only on those pixels where the layer colors differ by more than sr from the
+lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the
+results will be actually different from the ones obtained by running the meanshift procedure on the
+whole original image (i.e. when maxLevel==0).
+
+@param src The source 8-bit, 3-channel image.
+@param dst The destination image of the same format and the same size as the source.
+@param sp The spatial window radius.
+@param sr The color window radius.
+@param maxLevel Maximum level of the pyramid for the segmentation.
+@param termcrit Termination criteria: when to stop meanshift iterations.
+ */
+CV_EXPORTS_W void pyrMeanShiftFiltering( InputArray src, OutputArray dst,
+                                         double sp, double sr, int maxLevel = 1,
+                                         TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
+
+//! @}
+
+//! @addtogroup imgproc_misc
+//! @{
+
+/** @example grabcut.cpp
+An example using the GrabCut algorithm
+ */
+
+/** @brief Runs the GrabCut algorithm.
+
+The function implements the [GrabCut image segmentation algorithm](http://en.wikipedia.org/wiki/GrabCut).
+
+@param img Input 8-bit 3-channel image.
+@param mask Input/output 8-bit single-channel mask. The mask is initialized by the function when
+mode is set to GC_INIT_WITH_RECT. Its elements may have one of the cv::GrabCutClasses.
+@param rect ROI containing a segmented object. The pixels outside of the ROI are marked as
+"obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT .
+@param bgdModel Temporary array for the background model. Do not modify it while you are
+processing the same image.
+@param fgdModel Temporary arrays for the foreground model. Do not modify it while you are
+processing the same image.
+@param iterCount Number of iterations the algorithm should make before returning the result. Note
+that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or
+mode==GC_EVAL .
+@param mode Operation mode that could be one of the cv::GrabCutModes
+ */
+CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect,
+                           InputOutputArray bgdModel, InputOutputArray fgdModel,
+                           int iterCount, int mode = GC_EVAL );
+
+/** @example distrans.cpp
+An example on using the distance transform\
+*/
+
+
+/** @brief Calculates the distance to the closest zero pixel for each pixel of the source image.
+
+The functions distanceTransform calculate the approximate or precise distance from every binary
+image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero.
+
+When maskSize == DIST_MASK_PRECISE and distanceType == DIST_L2 , the function runs the
+algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library.
+
+In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function
+finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical,
+diagonal, or knight's move (the latest is available for a \f$5\times 5\f$ mask). The overall
+distance is calculated as a sum of these basic distances. Since the distance function should be
+symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all
+the diagonal shifts must have the same cost (denoted as `b`), and all knight's moves must have the
+same cost (denoted as `c`). For the cv::DIST_C and cv::DIST_L1 types, the distance is calculated
+precisely, whereas for cv::DIST_L2 (Euclidean distance) the distance can be calculated only with a
+relative error (a \f$5\times 5\f$ mask gives more accurate results). For `a`,`b`, and `c`, OpenCV
+uses the values suggested in the original paper:
+- DIST_L1: `a = 1, b = 2`
+- DIST_L2:
+    - `3 x 3`: `a=0.955, b=1.3693`
+    - `5 x 5`: `a=1, b=1.4, c=2.1969`
+- DIST_C: `a = 1, b = 1`
+
+Typically, for a fast, coarse distance estimation DIST_L2, a \f$3\times 3\f$ mask is used. For a
+more accurate distance estimation DIST_L2, a \f$5\times 5\f$ mask or the precise algorithm is used.
+Note that both the precise and the approximate algorithms are linear on the number of pixels.
+
+This variant of the function does not only compute the minimum distance for each pixel \f$(x, y)\f$
+but also identifies the nearest connected component consisting of zero pixels
+(labelType==DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==DIST_LABEL_PIXEL). Index of the
+component/pixel is stored in `labels(x, y)`. When labelType==DIST_LABEL_CCOMP, the function
+automatically finds connected components of zero pixels in the input image and marks them with
+distinct labels. When labelType==DIST_LABEL_CCOMP, the function scans through the input image and
+marks all the zero pixels with distinct labels.
+
+In this mode, the complexity is still linear. That is, the function provides a very fast way to
+compute the Voronoi diagram for a binary image. Currently, the second variant can use only the
+approximate distance transform algorithm, i.e. maskSize=DIST_MASK_PRECISE is not supported
+yet.
+
+@param src 8-bit, single-channel (binary) source image.
+@param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
+single-channel image of the same size as src.
+@param labels Output 2D array of labels (the discrete Voronoi diagram). It has the type
+CV_32SC1 and the same size as src.
+@param distanceType Type of distance, see cv::DistanceTypes
+@param maskSize Size of the distance transform mask, see cv::DistanceTransformMasks.
+DIST_MASK_PRECISE is not supported by this variant. In case of the DIST_L1 or DIST_C distance type,
+the parameter is forced to 3 because a \f$3\times 3\f$ mask gives the same result as \f$5\times
+5\f$ or any larger aperture.
+@param labelType Type of the label array to build, see cv::DistanceTransformLabelTypes.
+ */
+CV_EXPORTS_AS(distanceTransformWithLabels) void distanceTransform( InputArray src, OutputArray dst,
+                                     OutputArray labels, int distanceType, int maskSize,
+                                     int labelType = DIST_LABEL_CCOMP );
+
+/** @overload
+@param src 8-bit, single-channel (binary) source image.
+@param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point,
+single-channel image of the same size as src .
+@param distanceType Type of distance, see cv::DistanceTypes
+@param maskSize Size of the distance transform mask, see cv::DistanceTransformMasks. In case of the
+DIST_L1 or DIST_C distance type, the parameter is forced to 3 because a \f$3\times 3\f$ mask gives
+the same result as \f$5\times 5\f$ or any larger aperture.
+@param dstType Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for
+the first variant of the function and distanceType == DIST_L1.
+*/
+CV_EXPORTS_W void distanceTransform( InputArray src, OutputArray dst,
+                                     int distanceType, int maskSize, int dstType=CV_32F);
+
+/** @example ffilldemo.cpp
+  An example using the FloodFill technique
+*/
+
+/** @overload
+
+variant without `mask` parameter
+*/
+CV_EXPORTS int floodFill( InputOutputArray image,
+                          Point seedPoint, Scalar newVal, CV_OUT Rect* rect = 0,
+                          Scalar loDiff = Scalar(), Scalar upDiff = Scalar(),
+                          int flags = 4 );
+
+/** @brief Fills a connected component with the given color.
+
+The functions floodFill fill a connected component starting from the seed point with the specified
+color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The
+pixel at \f$(x,y)\f$ is considered to belong to the repainted domain if:
+
+- in case of a grayscale image and floating range
+\f[\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y)  \leq \texttt{src} (x',y')+ \texttt{upDiff}\f]
+
+
+- in case of a grayscale image and fixed range
+\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y)  \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\f]
+
+
+- in case of a color image and floating range
+\f[\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\f]
+\f[\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\f]
+and
+\f[\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\f]
+
+
+- in case of a color image and fixed range
+\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\f]
+\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\f]
+and
+\f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\f]
+
+
+where \f$src(x',y')\f$ is the value of one of pixel neighbors that is already known to belong to the
+component. That is, to be added to the connected component, a color/brightness of the pixel should
+be close enough to:
+- Color/brightness of one of its neighbors that already belong to the connected component in case
+of a floating range.
+- Color/brightness of the seed point in case of a fixed range.
+
+Use these functions to either mark a connected component with the specified color in-place, or build
+a mask and then extract the contour, or copy the region to another image, and so on.
+
+@param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the
+function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See
+the details below.
+@param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels
+taller than image. Since this is both an input and output parameter, you must take responsibility
+of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example,
+an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the
+mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags
+as described below. It is therefore possible to use the same mask in multiple calls to the function
+to make sure the filled areas do not overlap.
+@param seedPoint Starting point.
+@param newVal New value of the repainted domain pixels.
+@param loDiff Maximal lower brightness/color difference between the currently observed pixel and
+one of its neighbors belonging to the component, or a seed pixel being added to the component.
+@param upDiff Maximal upper brightness/color difference between the currently observed pixel and
+one of its neighbors belonging to the component, or a seed pixel being added to the component.
+@param rect Optional output parameter set by the function to the minimum bounding rectangle of the
+repainted domain.
+@param flags Operation flags. The first 8 bits contain a connectivity value. The default value of
+4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A
+connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner)
+will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill
+the mask (the default value is 1). For example, 4 | ( 255 \<\< 8 ) will consider 4 nearest
+neighbours and fill the mask with a value of 255. The following additional options occupy higher
+bits and therefore may be further combined with the connectivity and mask fill values using
+bit-wise or (|), see cv::FloodFillFlags.
+
+@note Since the mask is larger than the filled image, a pixel \f$(x, y)\f$ in image corresponds to the
+pixel \f$(x+1, y+1)\f$ in the mask .
+
+@sa findContours
+ */
+CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask,
+                            Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
+                            Scalar loDiff = Scalar(), Scalar upDiff = Scalar(),
+                            int flags = 4 );
+
+/** @brief Converts an image from one color space to another.
+
+The function converts an input image from one color space to another. In case of a transformation
+to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note
+that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the
+bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue
+component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and
+sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on.
+
+The conventional ranges for R, G, and B channel values are:
+-   0 to 255 for CV_8U images
+-   0 to 65535 for CV_16U images
+-   0 to 1 for CV_32F images
+
+In case of linear transformations, the range does not matter. But in case of a non-linear
+transformation, an input RGB image should be normalized to the proper value range to get the correct
+results, for example, for RGB \f$\rightarrow\f$ L\*u\*v\* transformation. For example, if you have a
+32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will
+have the 0..255 value range instead of 0..1 assumed by the function. So, before calling cvtColor ,
+you need first to scale the image down:
+@code
+    img *= 1./255;
+    cvtColor(img, img, COLOR_BGR2Luv);
+@endcode
+If you use cvtColor with 8-bit images, the conversion will have some information lost. For many
+applications, this will not be noticeable but it is recommended to use 32-bit images in applications
+that need the full range of colors or that convert an image before an operation and then convert
+back.
+
+If conversion adds the alpha channel, its value will set to the maximum of corresponding channel
+range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F.
+
+@param src input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision
+floating-point.
+@param dst output image of the same size and depth as src.
+@param code color space conversion code (see cv::ColorConversionCodes).
+@param dstCn number of channels in the destination image; if the parameter is 0, the number of the
+channels is derived automatically from src and code.
+
+@see @ref imgproc_color_conversions
+ */
+CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn = 0 );
+
+//! @} imgproc_misc
+
+// main function for all demosaicing procceses
+CV_EXPORTS_W void demosaicing(InputArray _src, OutputArray _dst, int code, int dcn = 0);
+
+//! @addtogroup imgproc_shape
+//! @{
+
+/** @brief Calculates all of the moments up to the third order of a polygon or rasterized shape.
+
+The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The
+results are returned in the structure cv::Moments.
+
+@param array Raster image (single-channel, 8-bit or floating-point 2D array) or an array (
+\f$1 \times N\f$ or \f$N \times 1\f$ ) of 2D points (Point or Point2f ).
+@param binaryImage If it is true, all non-zero image pixels are treated as 1's. The parameter is
+used for images only.
+@returns moments.
+
+@sa  contourArea, arcLength
+ */
+CV_EXPORTS_W Moments moments( InputArray array, bool binaryImage = false );
+
+/** @brief Calculates seven Hu invariants.
+
+The function calculates seven Hu invariants (introduced in @cite Hu62; see also
+<http://en.wikipedia.org/wiki/Image_moment>) defined as:
+
+\f[\begin{array}{l} hu[0]= \eta _{20}+ \eta _{02} \\ hu[1]=( \eta _{20}- \eta _{02})^{2}+4 \eta _{11}^{2} \\ hu[2]=( \eta _{30}-3 \eta _{12})^{2}+ (3 \eta _{21}- \eta _{03})^{2} \\ hu[3]=( \eta _{30}+ \eta _{12})^{2}+ ( \eta _{21}+ \eta _{03})^{2} \\ hu[4]=( \eta _{30}-3 \eta _{12})( \eta _{30}+ \eta _{12})[( \eta _{30}+ \eta _{12})^{2}-3( \eta _{21}+ \eta _{03})^{2}]+(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ hu[5]=( \eta _{20}- \eta _{02})[( \eta _{30}+ \eta _{12})^{2}- ( \eta _{21}+ \eta _{03})^{2}]+4 \eta _{11}( \eta _{30}+ \eta _{12})( \eta _{21}+ \eta _{03}) \\ hu[6]=(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}]-( \eta _{30}-3 \eta _{12})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ \end{array}\f]
+
+where \f$\eta_{ji}\f$ stands for \f$\texttt{Moments::nu}_{ji}\f$ .
+
+These values are proved to be invariants to the image scale, rotation, and reflection except the
+seventh one, whose sign is changed by reflection. This invariance is proved with the assumption of
+infinite image resolution. In case of raster images, the computed Hu invariants for the original and
+transformed images are a bit different.
+
+@param moments Input moments computed with moments .
+@param hu Output Hu invariants.
+
+@sa matchShapes
+ */
+CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
+
+/** @overload */
+CV_EXPORTS_W void HuMoments( const Moments& m, OutputArray hu );
+
+//! @} imgproc_shape
+
+//! @addtogroup imgproc_object
+//! @{
+
+//! type of the template matching operation
+enum TemplateMatchModes {
+    TM_SQDIFF        = 0, //!< \f[R(x,y)= \sum _{x',y'} (T(x',y')-I(x+x',y+y'))^2\f]
+    TM_SQDIFF_NORMED = 1, //!< \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y')-I(x+x',y+y'))^2}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f]
+    TM_CCORR         = 2, //!< \f[R(x,y)= \sum _{x',y'} (T(x',y')  \cdot I(x+x',y+y'))\f]
+    TM_CCORR_NORMED  = 3, //!< \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f]
+    TM_CCOEFF        = 4, //!< \f[R(x,y)= \sum _{x',y'} (T'(x',y')  \cdot I'(x+x',y+y'))\f]
+                          //!< where
+                          //!< \f[\begin{array}{l} T'(x',y')=T(x',y') - 1/(w  \cdot h)  \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w  \cdot h)  \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array}\f]
+    TM_CCOEFF_NORMED = 5  //!< \f[R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} }\f]
+};
+
+/** @brief Compares a template against overlapped image regions.
+
+The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against
+templ using the specified method and stores the comparison results in result . Here are the formulae
+for the available comparison methods ( \f$I\f$ denotes image, \f$T\f$ template, \f$R\f$ result ). The summation
+is done over template and/or the image patch: \f$x' = 0...w-1, y' = 0...h-1\f$
+
+After the function finishes the comparison, the best matches can be found as global minimums (when
+TM_SQDIFF was used) or maximums (when TM_CCORR or TM_CCOEFF was used) using the
+minMaxLoc function. In case of a color image, template summation in the numerator and each sum in
+the denominator is done over all of the channels and separate mean values are used for each channel.
+That is, the function can take a color template and a color image. The result will still be a
+single-channel image, which is easier to analyze.
+
+@param image Image where the search is running. It must be 8-bit or 32-bit floating-point.
+@param templ Searched template. It must be not greater than the source image and have the same
+data type.
+@param result Map of comparison results. It must be single-channel 32-bit floating-point. If image
+is \f$W \times H\f$ and templ is \f$w \times h\f$ , then result is \f$(W-w+1) \times (H-h+1)\f$ .
+@param method Parameter specifying the comparison method, see cv::TemplateMatchModes
+@param mask Mask of searched template. It must have the same datatype and size with templ. It is
+not set by default.
+ */
+CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ,
+                                 OutputArray result, int method, InputArray mask = noArray() );
+
+//! @}
+
+//! @addtogroup imgproc_shape
+//! @{
+
+/** @brief computes the connected components labeled image of boolean image
+
+image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
+represents the background label. ltype specifies the output label image type, an important
+consideration based on the total number of labels or alternatively the total number of pixels in
+the source image.
+
+@param image the 8-bit single-channel image to be labeled
+@param labels destination labeled image
+@param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
+@param ltype output image label type. Currently CV_32S and CV_16U are supported.
+ */
+CV_EXPORTS_W int connectedComponents(InputArray image, OutputArray labels,
+                                     int connectivity = 8, int ltype = CV_32S);
+
+/** @overload
+@param image the 8-bit single-channel image to be labeled
+@param labels destination labeled image
+@param stats statistics output for each label, including the background label, see below for
+available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of
+cv::ConnectedComponentsTypes. The data type is CV_32S.
+@param centroids centroid output for each label, including the background label. Centroids are
+accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F.
+@param connectivity 8 or 4 for 8-way or 4-way connectivity respectively
+@param ltype output image label type. Currently CV_32S and CV_16U are supported.
+*/
+CV_EXPORTS_W int connectedComponentsWithStats(InputArray image, OutputArray labels,
+                                              OutputArray stats, OutputArray centroids,
+                                              int connectivity = 8, int ltype = CV_32S);
+
+
+/** @brief Finds contours in a binary image.
+
+The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours
+are a useful tool for shape analysis and object detection and recognition. See squares.c in the
+OpenCV sample directory.
+
+@note Source image is modified by this function. Also, the function does not take into account
+1-pixel border of the image (it's filled with 0's and used for neighbor analysis in the algorithm),
+therefore the contours touching the image border will be clipped.
+
+@param image Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero
+pixels remain 0's, so the image is treated as binary . You can use compare , inRange , threshold ,
+adaptiveThreshold , Canny , and others to create a binary image out of a grayscale or color one.
+The function modifies the image while extracting the contours. If mode equals to RETR_CCOMP
+or RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1).
+@param contours Detected contours. Each contour is stored as a vector of points.
+@param hierarchy Optional output vector, containing information about the image topology. It has
+as many elements as the number of contours. For each i-th contour contours[i] , the elements
+hierarchy[i][0] , hiearchy[i][1] , hiearchy[i][2] , and hiearchy[i][3] are set to 0-based indices
+in contours of the next and previous contours at the same hierarchical level, the first child
+contour and the parent contour, respectively. If for the contour i there are no next, previous,
+parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
+@param mode Contour retrieval mode, see cv::RetrievalModes
+@param method Contour approximation method, see cv::ContourApproximationModes
+@param offset Optional offset by which every contour point is shifted. This is useful if the
+contours are extracted from the image ROI and then they should be analyzed in the whole image
+context.
+ */
+CV_EXPORTS_W void findContours( InputOutputArray image, OutputArrayOfArrays contours,
+                              OutputArray hierarchy, int mode,
+                              int method, Point offset = Point());
+
+/** @overload */
+CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours,
+                              int mode, int method, Point offset = Point());
+
+/** @brief Approximates a polygonal curve(s) with the specified precision.
+
+The functions approxPolyDP approximate a curve or a polygon with another curve/polygon with less
+vertices so that the distance between them is less or equal to the specified precision. It uses the
+Douglas-Peucker algorithm <http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm>
+
+@param curve Input vector of a 2D point stored in std::vector or Mat
+@param approxCurve Result of the approximation. The type should match the type of the input curve.
+@param epsilon Parameter specifying the approximation accuracy. This is the maximum distance
+between the original curve and its approximation.
+@param closed If true, the approximated curve is closed (its first and last vertices are
+connected). Otherwise, it is not closed.
+ */
+CV_EXPORTS_W void approxPolyDP( InputArray curve,
+                                OutputArray approxCurve,
+                                double epsilon, bool closed );
+
+/** @brief Calculates a contour perimeter or a curve length.
+
+The function computes a curve length or a closed contour perimeter.
+
+@param curve Input vector of 2D points, stored in std::vector or Mat.
+@param closed Flag indicating whether the curve is closed or not.
+ */
+CV_EXPORTS_W double arcLength( InputArray curve, bool closed );
+
+/** @brief Calculates the up-right bounding rectangle of a point set.
+
+The function calculates and returns the minimal up-right bounding rectangle for the specified point set.
+
+@param points Input 2D point set, stored in std::vector or Mat.
+ */
+CV_EXPORTS_W Rect boundingRect( InputArray points );
+
+/** @brief Calculates a contour area.
+
+The function computes a contour area. Similarly to moments , the area is computed using the Green
+formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using
+drawContours or fillPoly , can be different. Also, the function will most certainly give a wrong
+results for contours with self-intersections.
+
+Example:
+@code
+    vector<Point> contour;
+    contour.push_back(Point2f(0, 0));
+    contour.push_back(Point2f(10, 0));
+    contour.push_back(Point2f(10, 10));
+    contour.push_back(Point2f(5, 4));
+
+    double area0 = contourArea(contour);
+    vector<Point> approx;
+    approxPolyDP(contour, approx, 5, true);
+    double area1 = contourArea(approx);
+
+    cout << "area0 =" << area0 << endl <<
+            "area1 =" << area1 << endl <<
+            "approx poly vertices" << approx.size() << endl;
+@endcode
+@param contour Input vector of 2D points (contour vertices), stored in std::vector or Mat.
+@param oriented Oriented area flag. If it is true, the function returns a signed area value,
+depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can
+determine orientation of a contour by taking the sign of an area. By default, the parameter is
+false, which means that the absolute value is returned.
+ */
+CV_EXPORTS_W double contourArea( InputArray contour, bool oriented = false );
+
+/** @brief Finds a rotated rectangle of the minimum area enclosing the input 2D point set.
+
+The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a
+specified point set. See the OpenCV sample minarea.cpp . Developer should keep in mind that the
+returned rotatedRect can contain negative indices when data is close to the containing Mat element
+boundary.
+
+@param points Input vector of 2D points, stored in std::vector\<\> or Mat
+ */
+CV_EXPORTS_W RotatedRect minAreaRect( InputArray points );
+
+/** @brief Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle.
+
+The function finds the four vertices of a rotated rectangle. This function is useful to draw the
+rectangle. In C++, instead of using this function, you can directly use box.points() method. Please
+visit the [tutorial on bounding
+rectangle](http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html#bounding-rects-circles)
+for more information.
+
+@param box The input rotated rectangle. It may be the output of
+@param points The output array of four vertices of rectangles.
+ */
+CV_EXPORTS_W void boxPoints(RotatedRect box, OutputArray points);
+
+/** @brief Finds a circle of the minimum area enclosing a 2D point set.
+
+The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm. See
+the OpenCV sample minarea.cpp .
+
+@param points Input vector of 2D points, stored in std::vector\<\> or Mat
+@param center Output center of the circle.
+@param radius Output radius of the circle.
+ */
+CV_EXPORTS_W void minEnclosingCircle( InputArray points,
+                                      CV_OUT Point2f& center, CV_OUT float& radius );
+
+/** @example minarea.cpp
+  */
+
+/** @brief Finds a triangle of minimum area enclosing a 2D point set and returns its area.
+
+The function finds a triangle of minimum area enclosing the given set of 2D points and returns its
+area. The output for a given 2D point set is shown in the image below. 2D points are depicted in
+*red* and the enclosing triangle in *yellow*.
+
+![Sample output of the minimum enclosing triangle function](pics/minenclosingtriangle.png)
+
+The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's
+@cite KleeLaskowski85 papers. O'Rourke provides a \f$\theta(n)\f$ algorithm for finding the minimal
+enclosing triangle of a 2D convex polygon with n vertices. Since the minEnclosingTriangle function
+takes a 2D point set as input an additional preprocessing step of computing the convex hull of the
+2D point set is required. The complexity of the convexHull function is \f$O(n log(n))\f$ which is higher
+than \f$\theta(n)\f$. Thus the overall complexity of the function is \f$O(n log(n))\f$.
+
+@param points Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector\<\> or Mat
+@param triangle Output vector of three 2D points defining the vertices of the triangle. The depth
+of the OutputArray must be CV_32F.
+ */
+CV_EXPORTS_W double minEnclosingTriangle( InputArray points, CV_OUT OutputArray triangle );
+
+/** @brief Compares two shapes.
+
+The function compares two shapes. All three implemented methods use the Hu invariants (see cv::HuMoments)
+
+@param contour1 First contour or grayscale image.
+@param contour2 Second contour or grayscale image.
+@param method Comparison method, see ::ShapeMatchModes
+@param parameter Method-specific parameter (not supported now).
+ */
+CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,
+                                 int method, double parameter );
+
+/** @example convexhull.cpp
+An example using the convexHull functionality
+*/
+
+/** @brief Finds the convex hull of a point set.
+
+The functions find the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82
+that has *O(N logN)* complexity in the current implementation. See the OpenCV sample convexhull.cpp
+that demonstrates the usage of different function variants.
+
+@param points Input 2D point set, stored in std::vector or Mat.
+@param hull Output convex hull. It is either an integer vector of indices or vector of points. In
+the first case, the hull elements are 0-based indices of the convex hull points in the original
+array (since the set of convex hull points is a subset of the original point set). In the second
+case, hull elements are the convex hull points themselves.
+@param clockwise Orientation flag. If it is true, the output convex hull is oriented clockwise.
+Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing
+to the right, and its Y axis pointing upwards.
+@param returnPoints Operation flag. In case of a matrix, when the flag is true, the function
+returns convex hull points. Otherwise, it returns indices of the convex hull points. When the
+output array is std::vector, the flag is ignored, and the output depends on the type of the
+vector: std::vector\<int\> implies returnPoints=true, std::vector\<Point\> implies
+returnPoints=false.
+ */
+CV_EXPORTS_W void convexHull( InputArray points, OutputArray hull,
+                              bool clockwise = false, bool returnPoints = true );
+
+/** @brief Finds the convexity defects of a contour.
+
+The figure below displays convexity defects of a hand contour:
+
+![image](pics/defects.png)
+
+@param contour Input contour.
+@param convexhull Convex hull obtained using convexHull that should contain indices of the contour
+points that make the hull.
+@param convexityDefects The output vector of convexity defects. In C++ and the new Python/Java
+interface each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i):
+(start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices
+in the original contour of the convexity defect beginning, end and the farthest point, and
+fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the
+farthest contour point and the hull. That is, to get the floating-point value of the depth will be
+fixpt_depth/256.0.
+ */
+CV_EXPORTS_W void convexityDefects( InputArray contour, InputArray convexhull, OutputArray convexityDefects );
+
+/** @brief Tests a contour convexity.
+
+The function tests whether the input contour is convex or not. The contour must be simple, that is,
+without self-intersections. Otherwise, the function output is undefined.
+
+@param contour Input vector of 2D points, stored in std::vector\<\> or Mat
+ */
+CV_EXPORTS_W bool isContourConvex( InputArray contour );
+
+//! finds intersection of two convex polygons
+CV_EXPORTS_W float intersectConvexConvex( InputArray _p1, InputArray _p2,
+                                          OutputArray _p12, bool handleNested = true );
+
+/** @example fitellipse.cpp
+  An example using the fitEllipse technique
+*/
+
+/** @brief Fits an ellipse around a set of 2D points.
+
+The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of
+all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by @cite Fitzgibbon95
+is used. Developer should keep in mind that it is possible that the returned
+ellipse/rotatedRect data contains negative indices, due to the data points being close to the
+border of the containing Mat element.
+
+@param points Input 2D point set, stored in std::vector\<\> or Mat
+ */
+CV_EXPORTS_W RotatedRect fitEllipse( InputArray points );
+
+/** @brief Fits a line to a 2D or 3D point set.
+
+The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where
+\f$r_i\f$ is a distance between the \f$i^{th}\f$ point, the line and \f$\rho(r)\f$ is a distance function, one
+of the following:
+-  DIST_L2
+\f[\rho (r) = r^2/2  \quad \text{(the simplest and the fastest least-squares method)}\f]
+- DIST_L1
+\f[\rho (r) = r\f]
+- DIST_L12
+\f[\rho (r) = 2  \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\f]
+- DIST_FAIR
+\f[\rho \left (r \right ) = C^2  \cdot \left (  \frac{r}{C} -  \log{\left(1 + \frac{r}{C}\right)} \right )  \quad \text{where} \quad C=1.3998\f]
+- DIST_WELSCH
+\f[\rho \left (r \right ) =  \frac{C^2}{2} \cdot \left ( 1 -  \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right )  \quad \text{where} \quad C=2.9846\f]
+- DIST_HUBER
+\f[\rho (r) =  \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\f]
+
+The algorithm is based on the M-estimator ( <http://en.wikipedia.org/wiki/M-estimator> ) technique
+that iteratively fits the line using the weighted least-squares algorithm. After each iteration the
+weights \f$w_i\f$ are adjusted to be inversely proportional to \f$\rho(r_i)\f$ .
+
+@param points Input vector of 2D or 3D points, stored in std::vector\<\> or Mat.
+@param line Output line parameters. In case of 2D fitting, it should be a vector of 4 elements
+(like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and
+(x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like
+Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line
+and (x0, y0, z0) is a point on the line.
+@param distType Distance used by the M-estimator, see cv::DistanceTypes
+@param param Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value
+is chosen.
+@param reps Sufficient accuracy for the radius (distance between the coordinate origin and the line).
+@param aeps Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.
+ */
+CV_EXPORTS_W void fitLine( InputArray points, OutputArray line, int distType,
+                           double param, double reps, double aeps );
+
+/** @brief Performs a point-in-contour test.
+
+The function determines whether the point is inside a contour, outside, or lies on an edge (or
+coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge)
+value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively.
+Otherwise, the return value is a signed distance between the point and the nearest contour edge.
+
+See below a sample output of the function where each image pixel is tested against the contour:
+
+![sample output](pics/pointpolygon.png)
+
+@param contour Input contour.
+@param pt Point tested against the contour.
+@param measureDist If true, the function estimates the signed distance from the point to the
+nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.
+ */
+CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist );
+
+/** @brief Finds out if there is any intersection between two rotated rectangles.
+
+If there is then the vertices of the interesecting region are returned as well.
+
+Below are some examples of intersection configurations. The hatched pattern indicates the
+intersecting region and the red vertices are returned by the function.
+
+![intersection examples](pics/intersection.png)
+
+@param rect1 First rectangle
+@param rect2 Second rectangle
+@param intersectingRegion The output array of the verticies of the intersecting region. It returns
+at most 8 vertices. Stored as std::vector\<cv::Point2f\> or cv::Mat as Mx1 of type CV_32FC2.
+@returns One of cv::RectanglesIntersectTypes
+ */
+CV_EXPORTS_W int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion  );
+
+//! @} imgproc_shape
+
+CV_EXPORTS_W Ptr<CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
+
+//! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122.
+//! Detects position only without traslation and rotation
+CV_EXPORTS Ptr<GeneralizedHoughBallard> createGeneralizedHoughBallard();
+
+//! Guil, N., Gonz谩lez-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038.
+//! Detects position, traslation and rotation
+CV_EXPORTS Ptr<GeneralizedHoughGuil> createGeneralizedHoughGuil();
+
+//! Performs linear blending of two images
+CV_EXPORTS void blendLinear(InputArray src1, InputArray src2, InputArray weights1, InputArray weights2, OutputArray dst);
+
+//! @addtogroup imgproc_colormap
+//! @{
+
+//! GNU Octave/MATLAB equivalent colormaps
+enum ColormapTypes
+{
+    COLORMAP_AUTUMN = 0, //!< ![autumn](pics/colormaps/colorscale_autumn.jpg)
+    COLORMAP_BONE = 1, //!< ![bone](pics/colormaps/colorscale_bone.jpg)
+    COLORMAP_JET = 2, //!< ![jet](pics/colormaps/colorscale_jet.jpg)
+    COLORMAP_WINTER = 3, //!< ![winter](pics/colormaps/colorscale_winter.jpg)
+    COLORMAP_RAINBOW = 4, //!< ![rainbow](pics/colormaps/colorscale_rainbow.jpg)
+    COLORMAP_OCEAN = 5, //!< ![ocean](pics/colormaps/colorscale_ocean.jpg)
+    COLORMAP_SUMMER = 6, //!< ![summer](pics/colormaps/colorscale_summer.jpg)
+    COLORMAP_SPRING = 7, //!< ![spring](pics/colormaps/colorscale_spring.jpg)
+    COLORMAP_COOL = 8, //!< ![cool](pics/colormaps/colorscale_cool.jpg)
+    COLORMAP_HSV = 9, //!< ![HSV](pics/colormaps/colorscale_hsv.jpg)
+    COLORMAP_PINK = 10, //!< ![pink](pics/colormaps/colorscale_pink.jpg)
+    COLORMAP_HOT = 11, //!< ![hot](pics/colormaps/colorscale_hot.jpg)
+    COLORMAP_PARULA = 12 //!< ![parula](pics/colormaps/colorscale_parula.jpg)
+};
+
+/** @brief Applies a GNU Octave/MATLAB equivalent colormap on a given image.
+
+@param src The source image, grayscale or colored does not matter.
+@param dst The result is the colormapped source image. Note: Mat::create is called on dst.
+@param colormap The colormap to apply, see cv::ColormapTypes
+ */
+CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, int colormap);
+
+//! @} imgproc_colormap
+
+//! @addtogroup imgproc_draw
+//! @{
+
+/** @brief Draws a line segment connecting two points.
+
+The function line draws the line segment between pt1 and pt2 points in the image. The line is
+clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected
+or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased
+lines are drawn using Gaussian filtering.
+
+@param img Image.
+@param pt1 First point of the line segment.
+@param pt2 Second point of the line segment.
+@param color Line color.
+@param thickness Line thickness.
+@param lineType Type of the line, see cv::LineTypes.
+@param shift Number of fractional bits in the point coordinates.
+ */
+CV_EXPORTS_W void line(InputOutputArray img, Point pt1, Point pt2, const Scalar& color,
+                     int thickness = 1, int lineType = LINE_8, int shift = 0);
+
+/** @brief Draws a arrow segment pointing from the first point to the second one.
+
+The function arrowedLine draws an arrow between pt1 and pt2 points in the image. See also cv::line.
+
+@param img Image.
+@param pt1 The point the arrow starts from.
+@param pt2 The point the arrow points to.
+@param color Line color.
+@param thickness Line thickness.
+@param line_type Type of the line, see cv::LineTypes
+@param shift Number of fractional bits in the point coordinates.
+@param tipLength The length of the arrow tip in relation to the arrow length
+ */
+CV_EXPORTS_W void arrowedLine(InputOutputArray img, Point pt1, Point pt2, const Scalar& color,
+                     int thickness=1, int line_type=8, int shift=0, double tipLength=0.1);
+
+/** @brief Draws a simple, thick, or filled up-right rectangle.
+
+The function rectangle draws a rectangle outline or a filled rectangle whose two opposite corners
+are pt1 and pt2.
+
+@param img Image.
+@param pt1 Vertex of the rectangle.
+@param pt2 Vertex of the rectangle opposite to pt1 .
+@param color Rectangle color or brightness (grayscale image).
+@param thickness Thickness of lines that make up the rectangle. Negative values, like CV_FILLED ,
+mean that the function has to draw a filled rectangle.
+@param lineType Type of the line. See the line description.
+@param shift Number of fractional bits in the point coordinates.
+ */
+CV_EXPORTS_W void rectangle(InputOutputArray img, Point pt1, Point pt2,
+                          const Scalar& color, int thickness = 1,
+                          int lineType = LINE_8, int shift = 0);
+
+/** @overload
+
+use `rec` parameter as alternative specification of the drawn rectangle: `r.tl() and
+r.br()-Point(1,1)` are opposite corners
+*/
+CV_EXPORTS void rectangle(CV_IN_OUT Mat& img, Rect rec,
+                          const Scalar& color, int thickness = 1,
+                          int lineType = LINE_8, int shift = 0);
+
+/** @brief Draws a circle.
+
+The function circle draws a simple or filled circle with a given center and radius.
+@param img Image where the circle is drawn.
+@param center Center of the circle.
+@param radius Radius of the circle.
+@param color Circle color.
+@param thickness Thickness of the circle outline, if positive. Negative thickness means that a
+filled circle is to be drawn.
+@param lineType Type of the circle boundary. See the line description.
+@param shift Number of fractional bits in the coordinates of the center and in the radius value.
+ */
+CV_EXPORTS_W void circle(InputOutputArray img, Point center, int radius,
+                       const Scalar& color, int thickness = 1,
+                       int lineType = LINE_8, int shift = 0);
+
+/** @brief Draws a simple or thick elliptic arc or fills an ellipse sector.
+
+The functions ellipse with less parameters draw an ellipse outline, a filled ellipse, an elliptic
+arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc
+boundary. If you need more control of the ellipse rendering, you can retrieve the curve using
+ellipse2Poly and then render it with polylines or fill it with fillPoly . If you use the first
+variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and
+endAngle=360 . The figure below explains the meaning of the parameters.
+
+![Parameters of Elliptic Arc](pics/ellipse.png)
+
+@param img Image.
+@param center Center of the ellipse.
+@param axes Half of the size of the ellipse main axes.
+@param angle Ellipse rotation angle in degrees.
+@param startAngle Starting angle of the elliptic arc in degrees.
+@param endAngle Ending angle of the elliptic arc in degrees.
+@param color Ellipse color.
+@param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
+a filled ellipse sector is to be drawn.
+@param lineType Type of the ellipse boundary. See the line description.
+@param shift Number of fractional bits in the coordinates of the center and values of axes.
+ */
+CV_EXPORTS_W void ellipse(InputOutputArray img, Point center, Size axes,
+                        double angle, double startAngle, double endAngle,
+                        const Scalar& color, int thickness = 1,
+                        int lineType = LINE_8, int shift = 0);
+
+/** @overload
+@param img Image.
+@param box Alternative ellipse representation via RotatedRect. This means that the function draws
+an ellipse inscribed in the rotated rectangle.
+@param color Ellipse color.
+@param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that
+a filled ellipse sector is to be drawn.
+@param lineType Type of the ellipse boundary. See the line description.
+*/
+CV_EXPORTS_W void ellipse(InputOutputArray img, const RotatedRect& box, const Scalar& color,
+                        int thickness = 1, int lineType = LINE_8);
+
+/* ----------------------------------------------------------------------------------------- */
+/* ADDING A SET OF PREDEFINED MARKERS WHICH COULD BE USED TO HIGHLIGHT POSITIONS IN AN IMAGE */
+/* ----------------------------------------------------------------------------------------- */
+
+//! Possible set of marker types used for the cv::drawMarker function
+enum MarkerTypes
+{
+    MARKER_CROSS = 0,           //!< A crosshair marker shape
+    MARKER_TILTED_CROSS = 1,    //!< A 45 degree tilted crosshair marker shape
+    MARKER_STAR = 2,            //!< A star marker shape, combination of cross and tilted cross
+    MARKER_DIAMOND = 3,         //!< A diamond marker shape
+    MARKER_SQUARE = 4,          //!< A square marker shape
+    MARKER_TRIANGLE_UP = 5,     //!< An upwards pointing triangle marker shape
+    MARKER_TRIANGLE_DOWN = 6    //!< A downwards pointing triangle marker shape
+};
+
+/** @brief Draws a marker on a predefined position in an image.
+
+The function drawMarker draws a marker on a given position in the image. For the moment several
+marker types are supported, see cv::MarkerTypes for more information.
+
+@param img Image.
+@param position The point where the crosshair is positioned.
+@param markerType The specific type of marker you want to use, see cv::MarkerTypes
+@param color Line color.
+@param thickness Line thickness.
+@param line_type Type of the line, see cv::LineTypes
+@param markerSize The length of the marker axis [default = 20 pixels]
+ */
+CV_EXPORTS_W void drawMarker(CV_IN_OUT Mat& img, Point position, const Scalar& color,
+                             int markerType = MARKER_CROSS, int markerSize=20, int thickness=1,
+                             int line_type=8);
+
+/* ----------------------------------------------------------------------------------------- */
+/* END OF MARKER SECTION */
+/* ----------------------------------------------------------------------------------------- */
+
+/** @overload */
+CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts,
+                               const Scalar& color, int lineType = LINE_8,
+                               int shift = 0);
+
+/** @brief Fills a convex polygon.
+
+The function fillConvexPoly draws a filled convex polygon. This function is much faster than the
+function cv::fillPoly . It can fill not only convex polygons but any monotonic polygon without
+self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line)
+twice at the most (though, its top-most and/or the bottom edge could be horizontal).
+
+@param img Image.
+@param points Polygon vertices.
+@param color Polygon color.
+@param lineType Type of the polygon boundaries. See the line description.
+@param shift Number of fractional bits in the vertex coordinates.
+ */
+CV_EXPORTS_W void fillConvexPoly(InputOutputArray img, InputArray points,
+                                 const Scalar& color, int lineType = LINE_8,
+                                 int shift = 0);
+
+/** @overload */
+CV_EXPORTS void fillPoly(Mat& img, const Point** pts,
+                         const int* npts, int ncontours,
+                         const Scalar& color, int lineType = LINE_8, int shift = 0,
+                         Point offset = Point() );
+
+/** @brief Fills the area bounded by one or more polygons.
+
+The function fillPoly fills an area bounded by several polygonal contours. The function can fill
+complex areas, for example, areas with holes, contours with self-intersections (some of their
+parts), and so forth.
+
+@param img Image.
+@param pts Array of polygons where each polygon is represented as an array of points.
+@param color Polygon color.
+@param lineType Type of the polygon boundaries. See the line description.
+@param shift Number of fractional bits in the vertex coordinates.
+@param offset Optional offset of all points of the contours.
+ */
+CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts,
+                           const Scalar& color, int lineType = LINE_8, int shift = 0,
+                           Point offset = Point() );
+
+/** @overload */
+CV_EXPORTS void polylines(Mat& img, const Point* const* pts, const int* npts,
+                          int ncontours, bool isClosed, const Scalar& color,
+                          int thickness = 1, int lineType = LINE_8, int shift = 0 );
+
+/** @brief Draws several polygonal curves.
+
+@param img Image.
+@param pts Array of polygonal curves.
+@param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed,
+the function draws a line from the last vertex of each curve to its first vertex.
+@param color Polyline color.
+@param thickness Thickness of the polyline edges.
+@param lineType Type of the line segments. See the line description.
+@param shift Number of fractional bits in the vertex coordinates.
+
+The function polylines draws one or more polygonal curves.
+ */
+CV_EXPORTS_W void polylines(InputOutputArray img, InputArrayOfArrays pts,
+                            bool isClosed, const Scalar& color,
+                            int thickness = 1, int lineType = LINE_8, int shift = 0 );
+
+/** @example contours2.cpp
+  An example using the drawContour functionality
+*/
+
+/** @example segment_objects.cpp
+An example using drawContours to clean up a background segmentation result
+ */
+
+/** @brief Draws contours outlines or filled contours.
+
+The function draws contour outlines in the image if \f$\texttt{thickness} \ge 0\f$ or fills the area
+bounded by the contours if \f$\texttt{thickness}<0\f$ . The example below shows how to retrieve
+connected components from the binary image and label them: :
+@code
+    #include "opencv2/imgproc.hpp"
+    #include "opencv2/highgui.hpp"
+
+    using namespace cv;
+    using namespace std;
+
+    int main( int argc, char** argv )
+    {
+        Mat src;
+        // the first command-line parameter must be a filename of the binary
+        // (black-n-white) image
+        if( argc != 2 || !(src=imread(argv[1], 0)).data)
+            return -1;
+
+        Mat dst = Mat::zeros(src.rows, src.cols, CV_8UC3);
+
+        src = src > 1;
+        namedWindow( "Source", 1 );
+        imshow( "Source", src );
+
+        vector<vector<Point> > contours;
+        vector<Vec4i> hierarchy;
+
+        findContours( src, contours, hierarchy,
+            RETR_CCOMP, CHAIN_APPROX_SIMPLE );
+
+        // iterate through all the top-level contours,
+        // draw each connected component with its own random color
+        int idx = 0;
+        for( ; idx >= 0; idx = hierarchy[idx][0] )
+        {
+            Scalar color( rand()&255, rand()&255, rand()&255 );
+            drawContours( dst, contours, idx, color, FILLED, 8, hierarchy );
+        }
+
+        namedWindow( "Components", 1 );
+        imshow( "Components", dst );
+        waitKey(0);
+    }
+@endcode
+
+@param image Destination image.
+@param contours All the input contours. Each contour is stored as a point vector.
+@param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn.
+@param color Color of the contours.
+@param thickness Thickness of lines the contours are drawn with. If it is negative (for example,
+thickness=CV_FILLED ), the contour interiors are drawn.
+@param lineType Line connectivity. See cv::LineTypes.
+@param hierarchy Optional information about hierarchy. It is only needed if you want to draw only
+some of the contours (see maxLevel ).
+@param maxLevel Maximal level for drawn contours. If it is 0, only the specified contour is drawn.
+If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
+draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
+parameter is only taken into account when there is hierarchy available.
+@param offset Optional contour shift parameter. Shift all the drawn contours by the specified
+\f$\texttt{offset}=(dx,dy)\f$ .
+ */
+CV_EXPORTS_W void drawContours( InputOutputArray image, InputArrayOfArrays contours,
+                              int contourIdx, const Scalar& color,
+                              int thickness = 1, int lineType = LINE_8,
+                              InputArray hierarchy = noArray(),
+                              int maxLevel = INT_MAX, Point offset = Point() );
+
+/** @brief Clips the line against the image rectangle.
+
+The functions clipLine calculate a part of the line segment that is entirely within the specified
+rectangle. They return false if the line segment is completely outside the rectangle. Otherwise,
+they return true .
+@param imgSize Image size. The image rectangle is Rect(0, 0, imgSize.width, imgSize.height) .
+@param pt1 First line point.
+@param pt2 Second line point.
+ */
+CV_EXPORTS bool clipLine(Size imgSize, CV_IN_OUT Point& pt1, CV_IN_OUT Point& pt2);
+
+/** @overload
+@param imgRect Image rectangle.
+@param pt1 First line point.
+@param pt2 Second line point.
+*/
+CV_EXPORTS_W bool clipLine(Rect imgRect, CV_OUT CV_IN_OUT Point& pt1, CV_OUT CV_IN_OUT Point& pt2);
+
+/** @brief Approximates an elliptic arc with a polyline.
+
+The function ellipse2Poly computes the vertices of a polyline that approximates the specified
+elliptic arc. It is used by cv::ellipse.
+
+@param center Center of the arc.
+@param axes Half of the size of the ellipse main axes. See the ellipse for details.
+@param angle Rotation angle of the ellipse in degrees. See the ellipse for details.
+@param arcStart Starting angle of the elliptic arc in degrees.
+@param arcEnd Ending angle of the elliptic arc in degrees.
+@param delta Angle between the subsequent polyline vertices. It defines the approximation
+accuracy.
+@param pts Output vector of polyline vertices.
+ */
+CV_EXPORTS_W void ellipse2Poly( Point center, Size axes, int angle,
+                                int arcStart, int arcEnd, int delta,
+                                CV_OUT std::vector<Point>& pts );
+
+/** @brief Draws a text string.
+
+The function putText renders the specified text string in the image. Symbols that cannot be rendered
+using the specified font are replaced by question marks. See getTextSize for a text rendering code
+example.
+
+@param img Image.
+@param text Text string to be drawn.
+@param org Bottom-left corner of the text string in the image.
+@param fontFace Font type, see cv::HersheyFonts.
+@param fontScale Font scale factor that is multiplied by the font-specific base size.
+@param color Text color.
+@param thickness Thickness of the lines used to draw a text.
+@param lineType Line type. See the line for details.
+@param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise,
+it is at the top-left corner.
+ */
+CV_EXPORTS_W void putText( InputOutputArray img, const String& text, Point org,
+                         int fontFace, double fontScale, Scalar color,
+                         int thickness = 1, int lineType = LINE_8,
+                         bool bottomLeftOrigin = false );
+
+/** @brief Calculates the width and height of a text string.
+
+The function getTextSize calculates and returns the size of a box that contains the specified text.
+That is, the following code renders some text, the tight box surrounding it, and the baseline: :
+@code
+    String text = "Funny text inside the box";
+    int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX;
+    double fontScale = 2;
+    int thickness = 3;
+
+    Mat img(600, 800, CV_8UC3, Scalar::all(0));
+
+    int baseline=0;
+    Size textSize = getTextSize(text, fontFace,
+                                fontScale, thickness, &baseline);
+    baseline += thickness;
+
+    // center the text
+    Point textOrg((img.cols - textSize.width)/2,
+                  (img.rows + textSize.height)/2);
+
+    // draw the box
+    rectangle(img, textOrg + Point(0, baseline),
+              textOrg + Point(textSize.width, -textSize.height),
+              Scalar(0,0,255));
+    // ... and the baseline first
+    line(img, textOrg + Point(0, thickness),
+         textOrg + Point(textSize.width, thickness),
+         Scalar(0, 0, 255));
+
+    // then put the text itself
+    putText(img, text, textOrg, fontFace, fontScale,
+            Scalar::all(255), thickness, 8);
+@endcode
+
+@param text Input text string.
+@param fontFace Font to use, see cv::HersheyFonts.
+@param fontScale Font scale factor that is multiplied by the font-specific base size.
+@param thickness Thickness of lines used to render the text. See putText for details.
+@param[out] baseLine y-coordinate of the baseline relative to the bottom-most text
+point.
+@return The size of a box that contains the specified text.
+
+@see cv::putText
+ */
+CV_EXPORTS_W Size getTextSize(const String& text, int fontFace,
+                            double fontScale, int thickness,
+                            CV_OUT int* baseLine);
+
+/** @brief Line iterator
+
+The class is used to iterate over all the pixels on the raster line
+segment connecting two specified points.
+
+The class LineIterator is used to get each pixel of a raster line. It
+can be treated as versatile implementation of the Bresenham algorithm
+where you can stop at each pixel and do some extra processing, for
+example, grab pixel values along the line or draw a line with an effect
+(for example, with XOR operation).
+
+The number of pixels along the line is stored in LineIterator::count.
+The method LineIterator::pos returns the current position in the image:
+
+@code{.cpp}
+// grabs pixels along the line (pt1, pt2)
+// from 8-bit 3-channel image to the buffer
+LineIterator it(img, pt1, pt2, 8);
+LineIterator it2 = it;
+vector<Vec3b> buf(it.count);
+
+for(int i = 0; i < it.count; i++, ++it)
+    buf[i] = *(const Vec3b)*it;
+
+// alternative way of iterating through the line
+for(int i = 0; i < it2.count; i++, ++it2)
+{
+    Vec3b val = img.at<Vec3b>(it2.pos());
+    CV_Assert(buf[i] == val);
+}
+@endcode
+*/
+class CV_EXPORTS LineIterator
+{
+public:
+    /** @brief intializes the iterator
+
+    creates iterators for the line connecting pt1 and pt2
+    the line will be clipped on the image boundaries
+    the line is 8-connected or 4-connected
+    If leftToRight=true, then the iteration is always done
+    from the left-most point to the right most,
+    not to depend on the ordering of pt1 and pt2 parameters
+    */
+    LineIterator( const Mat& img, Point pt1, Point pt2,
+                  int connectivity = 8, bool leftToRight = false );
+    /** @brief returns pointer to the current pixel
+    */
+    uchar* operator *();
+    /** @brief prefix increment operator (++it). shifts iterator to the next pixel
+    */
+    LineIterator& operator ++();
+    /** @brief postfix increment operator (it++). shifts iterator to the next pixel
+    */
+    LineIterator operator ++(int);
+    /** @brief returns coordinates of the current pixel
+    */
+    Point pos() const;
+
+    uchar* ptr;
+    const uchar* ptr0;
+    int step, elemSize;
+    int err, count;
+    int minusDelta, plusDelta;
+    int minusStep, plusStep;
+};
+
+//! @cond IGNORED
+
+// === LineIterator implementation ===
+
+inline
+uchar* LineIterator::operator *()
+{
+    return ptr;
+}
+
+inline
+LineIterator& LineIterator::operator ++()
+{
+    int mask = err < 0 ? -1 : 0;
+    err += minusDelta + (plusDelta & mask);
+    ptr += minusStep + (plusStep & mask);
+    return *this;
+}
+
+inline
+LineIterator LineIterator::operator ++(int)
+{
+    LineIterator it = *this;
+    ++(*this);
+    return it;
+}
+
+inline
+Point LineIterator::pos() const
+{
+    Point p;
+    p.y = (int)((ptr - ptr0)/step);
+    p.x = (int)(((ptr - ptr0) - p.y*step)/elemSize);
+    return p;
+}
+
+//! @endcond
+
+//! @} imgproc_draw
+
+//! @} imgproc
+
+} // cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/imgproc/imgproc_c.h"
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp
new file mode 100644
index 0000000..ca29304
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/detail/distortion_model.hpp
@@ -0,0 +1,123 @@
+/*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*/
+
+#ifndef __OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP__
+#define __OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP__
+
+//! @cond IGNORED
+
+namespace cv { namespace detail {
+/**
+Computes the matrix for the projection onto a tilted image sensor
+\param tauX angular parameter rotation around x-axis
+\param tauY angular parameter rotation around y-axis
+\param matTilt if not NULL returns the matrix
+\f[
+\vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)}
+{0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)}
+{0}{0}{1} R(\tau_x, \tau_y)
+\f]
+where
+\f[
+R(\tau_x, \tau_y) =
+\vecthreethree{\cos(\tau_y)}{0}{-\sin(\tau_y)}{0}{1}{0}{\sin(\tau_y)}{0}{\cos(\tau_y)}
+\vecthreethree{1}{0}{0}{0}{\cos(\tau_x)}{\sin(\tau_x)}{0}{-\sin(\tau_x)}{\cos(\tau_x)} =
+\vecthreethree{\cos(\tau_y)}{\sin(\tau_y)\sin(\tau_x)}{-\sin(\tau_y)\cos(\tau_x)}
+{0}{\cos(\tau_x)}{\sin(\tau_x)}
+{\sin(\tau_y)}{-\cos(\tau_y)\sin(\tau_x)}{\cos(\tau_y)\cos(\tau_x)}.
+\f]
+\param dMatTiltdTauX if not NULL it returns the derivative of matTilt with
+respect to \f$\tau_x\f$.
+\param dMatTiltdTauY if not NULL it returns the derivative of matTilt with
+respect to \f$\tau_y\f$.
+\param invMatTilt if not NULL it returns the inverse of matTilt
+**/
+template <typename FLOAT>
+void computeTiltProjectionMatrix(FLOAT tauX,
+    FLOAT tauY,
+    Matx<FLOAT, 3, 3>* matTilt = 0,
+    Matx<FLOAT, 3, 3>* dMatTiltdTauX = 0,
+    Matx<FLOAT, 3, 3>* dMatTiltdTauY = 0,
+    Matx<FLOAT, 3, 3>* invMatTilt = 0)
+{
+    FLOAT cTauX = cos(tauX);
+    FLOAT sTauX = sin(tauX);
+    FLOAT cTauY = cos(tauY);
+    FLOAT sTauY = sin(tauY);
+    Matx<FLOAT, 3, 3> matRotX = Matx<FLOAT, 3, 3>(1,0,0,0,cTauX,sTauX,0,-sTauX,cTauX);
+    Matx<FLOAT, 3, 3> matRotY = Matx<FLOAT, 3, 3>(cTauY,0,-sTauY,0,1,0,sTauY,0,cTauY);
+    Matx<FLOAT, 3, 3> matRotXY = matRotY * matRotX;
+    Matx<FLOAT, 3, 3> matProjZ = Matx<FLOAT, 3, 3>(matRotXY(2,2),0,-matRotXY(0,2),0,matRotXY(2,2),-matRotXY(1,2),0,0,1);
+    if (matTilt)
+    {
+        // Matrix for trapezoidal distortion of tilted image sensor
+        *matTilt = matProjZ * matRotXY;
+    }
+    if (dMatTiltdTauX)
+    {
+        // Derivative with respect to tauX
+        Matx<FLOAT, 3, 3> dMatRotXYdTauX = matRotY * Matx<FLOAT, 3, 3>(0,0,0,0,-sTauX,cTauX,0,-cTauX,-sTauX);
+        Matx<FLOAT, 3, 3> dMatProjZdTauX = Matx<FLOAT, 3, 3>(dMatRotXYdTauX(2,2),0,-dMatRotXYdTauX(0,2),
+          0,dMatRotXYdTauX(2,2),-dMatRotXYdTauX(1,2),0,0,0);
+        *dMatTiltdTauX = (matProjZ * dMatRotXYdTauX) + (dMatProjZdTauX * matRotXY);
+    }
+    if (dMatTiltdTauY)
+    {
+        // Derivative with respect to tauY
+        Matx<FLOAT, 3, 3> dMatRotXYdTauY = Matx<FLOAT, 3, 3>(-sTauY,0,-cTauY,0,0,0,cTauY,0,-sTauY) * matRotX;
+        Matx<FLOAT, 3, 3> dMatProjZdTauY = Matx<FLOAT, 3, 3>(dMatRotXYdTauY(2,2),0,-dMatRotXYdTauY(0,2),
+          0,dMatRotXYdTauY(2,2),-dMatRotXYdTauY(1,2),0,0,0);
+        *dMatTiltdTauY = (matProjZ * dMatRotXYdTauY) + (dMatProjZdTauY * matRotXY);
+    }
+    if (invMatTilt)
+    {
+        FLOAT inv = 1./matRotXY(2,2);
+        Matx<FLOAT, 3, 3> invMatProjZ = Matx<FLOAT, 3, 3>(inv,0,inv*matRotXY(0,2),0,inv,inv*matRotXY(1,2),0,0,1);
+        *invMatTilt = matRotXY.t()*invMatProjZ;
+    }
+}
+}} // namespace detail, cv
+
+
+//! @endcond
+
+#endif // __OPENCV_IMGPROC_DETAIL_DISTORTION_MODEL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp
new file mode 100644
index 0000000..4175bd0
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/imgproc.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h
new file mode 100644
index 0000000..87518d7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/imgproc_c.h
@@ -0,0 +1,1210 @@
+/*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*/
+
+#ifndef __OPENCV_IMGPROC_IMGPROC_C_H__
+#define __OPENCV_IMGPROC_IMGPROC_C_H__
+
+#include "opencv2/imgproc/types_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup imgproc_c
+@{
+*/
+
+/*********************** Background statistics accumulation *****************************/
+
+/** @brief Adds image to accumulator
+@see cv::accumulate
+*/
+CVAPI(void)  cvAcc( const CvArr* image, CvArr* sum,
+                   const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Adds squared image to accumulator
+@see cv::accumulateSquare
+*/
+CVAPI(void)  cvSquareAcc( const CvArr* image, CvArr* sqsum,
+                         const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Adds a product of two images to accumulator
+@see cv::accumulateProduct
+*/
+CVAPI(void)  cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc,
+                           const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @brief Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha
+@see cv::accumulateWeighted
+*/
+CVAPI(void)  cvRunningAvg( const CvArr* image, CvArr* acc, double alpha,
+                          const CvArr* mask CV_DEFAULT(NULL) );
+
+/****************************************************************************************\
+*                                    Image Processing                                    *
+\****************************************************************************************/
+
+/** Copies source 2D array inside of the larger destination array and
+   makes a border of the specified type (IPL_BORDER_*) around the copied area. */
+CVAPI(void) cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset,
+                              int bordertype, CvScalar value CV_DEFAULT(cvScalarAll(0)));
+
+/** @brief Smooths the image in one of several ways.
+
+@param src The source image
+@param dst The destination image
+@param smoothtype Type of the smoothing, see SmoothMethod_c
+@param size1 The first parameter of the smoothing operation, the aperture width. Must be a
+positive odd number (1, 3, 5, ...)
+@param size2 The second parameter of the smoothing operation, the aperture height. Ignored by
+CV_MEDIAN and CV_BILATERAL methods. In the case of simple scaled/non-scaled and Gaussian blur if
+size2 is zero, it is set to size1. Otherwise it must be a positive odd number.
+@param sigma1 In the case of a Gaussian parameter this parameter may specify Gaussian \f$\sigma\f$
+(standard deviation). If it is zero, it is calculated from the kernel size:
+\f[\sigma  = 0.3 (n/2 - 1) + 0.8  \quad   \text{where}   \quad  n= \begin{array}{l l} \mbox{\texttt{size1} for horizontal kernel} \\ \mbox{\texttt{size2} for vertical kernel} \end{array}\f]
+Using standard sigma for small kernels ( \f$3\times 3\f$ to \f$7\times 7\f$ ) gives better speed. If
+sigma1 is not zero, while size1 and size2 are zeros, the kernel size is calculated from the
+sigma (to provide accurate enough operation).
+@param sigma2 additional parameter for bilateral filtering
+
+@see cv::GaussianBlur, cv::blur, cv::medianBlur, cv::bilateralFilter.
+ */
+CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst,
+                      int smoothtype CV_DEFAULT(CV_GAUSSIAN),
+                      int size1 CV_DEFAULT(3),
+                      int size2 CV_DEFAULT(0),
+                      double sigma1 CV_DEFAULT(0),
+                      double sigma2 CV_DEFAULT(0));
+
+/** @brief Convolves an image with the kernel.
+
+@param src input image.
+@param dst output image of the same size and the same number of channels as src.
+@param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
+matrix; if you want to apply different kernels to different channels, split the image into
+separate color planes using split and process them individually.
+@param anchor anchor of the kernel that indicates the relative position of a filtered point within
+the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
+is at the kernel center.
+
+@see cv::filter2D
+ */
+CVAPI(void) cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel,
+                        CvPoint anchor CV_DEFAULT(cvPoint(-1,-1)));
+
+/** @brief Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y)
+@see cv::integral
+*/
+CVAPI(void) cvIntegral( const CvArr* image, CvArr* sum,
+                       CvArr* sqsum CV_DEFAULT(NULL),
+                       CvArr* tilted_sum CV_DEFAULT(NULL));
+
+/** @brief Smoothes the input image with gaussian kernel and then down-samples it.
+
+   dst_width = floor(src_width/2)[+1],
+   dst_height = floor(src_height/2)[+1]
+   @see cv::pyrDown
+*/
+CVAPI(void)  cvPyrDown( const CvArr* src, CvArr* dst,
+                        int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
+
+/** @brief Up-samples image and smoothes the result with gaussian kernel.
+
+   dst_width = src_width*2,
+   dst_height = src_height*2
+   @see cv::pyrUp
+*/
+CVAPI(void)  cvPyrUp( const CvArr* src, CvArr* dst,
+                      int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
+
+/** @brief Builds pyramid for an image
+@see buildPyramid
+*/
+CVAPI(CvMat**) cvCreatePyramid( const CvArr* img, int extra_layers, double rate,
+                                const CvSize* layer_sizes CV_DEFAULT(0),
+                                CvArr* bufarr CV_DEFAULT(0),
+                                int calc CV_DEFAULT(1),
+                                int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
+
+/** @brief Releases pyramid */
+CVAPI(void)  cvReleasePyramid( CvMat*** pyramid, int extra_layers );
+
+
+/** @brief Filters image using meanshift algorithm
+@see cv::pyrMeanShiftFiltering
+*/
+CVAPI(void) cvPyrMeanShiftFiltering( const CvArr* src, CvArr* dst,
+    double sp, double sr, int max_level CV_DEFAULT(1),
+    CvTermCriteria termcrit CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,5,1)));
+
+/** @brief Segments image using seed "markers"
+@see cv::watershed
+*/
+CVAPI(void) cvWatershed( const CvArr* image, CvArr* markers );
+
+/** @brief Calculates an image derivative using generalized Sobel
+
+   (aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator.
+   Scharr can be used only for the first dx or dy derivative
+@see cv::Sobel
+*/
+CVAPI(void) cvSobel( const CvArr* src, CvArr* dst,
+                    int xorder, int yorder,
+                    int aperture_size CV_DEFAULT(3));
+
+/** @brief Calculates the image Laplacian: (d2/dx + d2/dy)I
+@see cv::Laplacian
+*/
+CVAPI(void) cvLaplace( const CvArr* src, CvArr* dst,
+                      int aperture_size CV_DEFAULT(3) );
+
+/** @brief Converts input array pixels from one color space to another
+@see cv::cvtColor
+*/
+CVAPI(void)  cvCvtColor( const CvArr* src, CvArr* dst, int code );
+
+
+/** @brief Resizes image (input array is resized to fit the destination array)
+@see cv::resize
+*/
+CVAPI(void)  cvResize( const CvArr* src, CvArr* dst,
+                       int interpolation CV_DEFAULT( CV_INTER_LINEAR ));
+
+/** @brief Warps image with affine transform
+@note ::cvGetQuadrangleSubPix is similar to ::cvWarpAffine, but the outliers are extrapolated using
+replication border mode.
+@see cv::warpAffine
+*/
+CVAPI(void)  cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
+                           int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
+                           CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
+
+/** @brief Computes affine transform matrix for mapping src[i] to dst[i] (i=0,1,2)
+@see cv::getAffineTransform
+*/
+CVAPI(CvMat*) cvGetAffineTransform( const CvPoint2D32f * src,
+                                    const CvPoint2D32f * dst,
+                                    CvMat * map_matrix );
+
+/** @brief Computes rotation_matrix matrix
+@see cv::getRotationMatrix2D
+*/
+CVAPI(CvMat*)  cv2DRotationMatrix( CvPoint2D32f center, double angle,
+                                   double scale, CvMat* map_matrix );
+
+/** @brief Warps image with perspective (projective) transform
+@see cv::warpPerspective
+*/
+CVAPI(void)  cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
+                                int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
+                                CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
+
+/** @brief Computes perspective transform matrix for mapping src[i] to dst[i] (i=0,1,2,3)
+@see cv::getPerspectiveTransform
+*/
+CVAPI(CvMat*) cvGetPerspectiveTransform( const CvPoint2D32f* src,
+                                         const CvPoint2D32f* dst,
+                                         CvMat* map_matrix );
+
+/** @brief Performs generic geometric transformation using the specified coordinate maps
+@see cv::remap
+*/
+CVAPI(void)  cvRemap( const CvArr* src, CvArr* dst,
+                      const CvArr* mapx, const CvArr* mapy,
+                      int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
+                      CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
+
+/** @brief Converts mapx & mapy from floating-point to integer formats for cvRemap
+@see cv::convertMaps
+*/
+CVAPI(void)  cvConvertMaps( const CvArr* mapx, const CvArr* mapy,
+                            CvArr* mapxy, CvArr* mapalpha );
+
+/** @brief Performs forward or inverse log-polar image transform
+@see cv::logPolar
+*/
+CVAPI(void)  cvLogPolar( const CvArr* src, CvArr* dst,
+                         CvPoint2D32f center, double M,
+                         int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
+
+/** Performs forward or inverse linear-polar image transform
+@see cv::linearPolar
+*/
+CVAPI(void)  cvLinearPolar( const CvArr* src, CvArr* dst,
+                         CvPoint2D32f center, double maxRadius,
+                         int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
+
+/** @brief Transforms the input image to compensate lens distortion
+@see cv::undistort
+*/
+CVAPI(void) cvUndistort2( const CvArr* src, CvArr* dst,
+                          const CvMat* camera_matrix,
+                          const CvMat* distortion_coeffs,
+                          const CvMat* new_camera_matrix CV_DEFAULT(0) );
+
+/** @brief Computes transformation map from intrinsic camera parameters
+   that can used by cvRemap
+*/
+CVAPI(void) cvInitUndistortMap( const CvMat* camera_matrix,
+                                const CvMat* distortion_coeffs,
+                                CvArr* mapx, CvArr* mapy );
+
+/** @brief Computes undistortion+rectification map for a head of stereo camera
+@see cv::initUndistortRectifyMap
+*/
+CVAPI(void) cvInitUndistortRectifyMap( const CvMat* camera_matrix,
+                                       const CvMat* dist_coeffs,
+                                       const CvMat *R, const CvMat* new_camera_matrix,
+                                       CvArr* mapx, CvArr* mapy );
+
+/** @brief Computes the original (undistorted) feature coordinates
+   from the observed (distorted) coordinates
+@see cv::undistortPoints
+*/
+CVAPI(void) cvUndistortPoints( const CvMat* src, CvMat* dst,
+                               const CvMat* camera_matrix,
+                               const CvMat* dist_coeffs,
+                               const CvMat* R CV_DEFAULT(0),
+                               const CvMat* P CV_DEFAULT(0));
+
+/** @brief Returns a structuring element of the specified size and shape for morphological operations.
+
+@note the created structuring element IplConvKernel\* element must be released in the end using
+`cvReleaseStructuringElement(&element)`.
+
+@param cols Width of the structuring element
+@param rows Height of the structuring element
+@param anchor_x x-coordinate of the anchor
+@param anchor_y y-coordinate of the anchor
+@param shape element shape that could be one of the cv::MorphShapes_c
+@param values integer array of cols*rows elements that specifies the custom shape of the
+structuring element, when shape=CV_SHAPE_CUSTOM.
+
+@see cv::getStructuringElement
+ */
+ CVAPI(IplConvKernel*)  cvCreateStructuringElementEx(
+            int cols, int  rows, int  anchor_x, int  anchor_y,
+            int shape, int* values CV_DEFAULT(NULL) );
+
+/** @brief releases structuring element
+@see cvCreateStructuringElementEx
+*/
+CVAPI(void)  cvReleaseStructuringElement( IplConvKernel** element );
+
+/** @brief erodes input image (applies minimum filter) one or more times.
+   If element pointer is NULL, 3x3 rectangular element is used
+@see cv::erode
+*/
+CVAPI(void)  cvErode( const CvArr* src, CvArr* dst,
+                      IplConvKernel* element CV_DEFAULT(NULL),
+                      int iterations CV_DEFAULT(1) );
+
+/** @brief dilates input image (applies maximum filter) one or more times.
+
+   If element pointer is NULL, 3x3 rectangular element is used
+@see cv::dilate
+*/
+CVAPI(void)  cvDilate( const CvArr* src, CvArr* dst,
+                       IplConvKernel* element CV_DEFAULT(NULL),
+                       int iterations CV_DEFAULT(1) );
+
+/** @brief Performs complex morphological transformation
+@see cv::morphologyEx
+*/
+CVAPI(void)  cvMorphologyEx( const CvArr* src, CvArr* dst,
+                             CvArr* temp, IplConvKernel* element,
+                             int operation, int iterations CV_DEFAULT(1) );
+
+/** @brief Calculates all spatial and central moments up to the 3rd order
+@see cv::moments
+*/
+CVAPI(void) cvMoments( const CvArr* arr, CvMoments* moments, int binary CV_DEFAULT(0));
+
+/** @brief Retrieve spatial moments */
+CVAPI(double)  cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order );
+/** @brief Retrieve central moments */
+CVAPI(double)  cvGetCentralMoment( CvMoments* moments, int x_order, int y_order );
+/** @brief Retrieve normalized central moments */
+CVAPI(double)  cvGetNormalizedCentralMoment( CvMoments* moments,
+                                             int x_order, int y_order );
+
+/** @brief Calculates 7 Hu's invariants from precalculated spatial and central moments
+@see cv::HuMoments
+*/
+CVAPI(void) cvGetHuMoments( CvMoments*  moments, CvHuMoments*  hu_moments );
+
+/*********************************** data sampling **************************************/
+
+/** @brief Fetches pixels that belong to the specified line segment and stores them to the buffer.
+
+   Returns the number of retrieved points.
+@see cv::LineSegmentDetector
+*/
+CVAPI(int)  cvSampleLine( const CvArr* image, CvPoint pt1, CvPoint pt2, void* buffer,
+                          int connectivity CV_DEFAULT(8));
+
+/** @brief Retrieves the rectangular image region with specified center from the input array.
+
+ dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2).
+ Values of pixels with fractional coordinates are retrieved using bilinear interpolation
+@see cv::getRectSubPix
+*/
+CVAPI(void)  cvGetRectSubPix( const CvArr* src, CvArr* dst, CvPoint2D32f center );
+
+
+/** @brief Retrieves quadrangle from the input array.
+
+    matrixarr = ( a11  a12 | b1 )   dst(x,y) <- src(A[x y]' + b)
+                ( a21  a22 | b2 )   (bilinear interpolation is used to retrieve pixels
+                                     with fractional coordinates)
+@see cvWarpAffine
+*/
+CVAPI(void)  cvGetQuadrangleSubPix( const CvArr* src, CvArr* dst,
+                                    const CvMat* map_matrix );
+
+/** @brief Measures similarity between template and overlapped windows in the source image
+   and fills the resultant image with the measurements
+@see cv::matchTemplate
+*/
+CVAPI(void)  cvMatchTemplate( const CvArr* image, const CvArr* templ,
+                              CvArr* result, int method );
+
+/** @brief Computes earth mover distance between
+   two weighted point sets (called signatures)
+@see cv::EMD
+*/
+CVAPI(float)  cvCalcEMD2( const CvArr* signature1,
+                          const CvArr* signature2,
+                          int distance_type,
+                          CvDistanceFunction distance_func CV_DEFAULT(NULL),
+                          const CvArr* cost_matrix CV_DEFAULT(NULL),
+                          CvArr* flow CV_DEFAULT(NULL),
+                          float* lower_bound CV_DEFAULT(NULL),
+                          void* userdata CV_DEFAULT(NULL));
+
+/****************************************************************************************\
+*                              Contours retrieving                                       *
+\****************************************************************************************/
+
+/** @brief Retrieves outer and optionally inner boundaries of white (non-zero) connected
+   components in the black (zero) background
+@see cv::findContours, cvStartFindContours, cvFindNextContour, cvSubstituteContour, cvEndFindContours
+*/
+CVAPI(int)  cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** first_contour,
+                            int header_size CV_DEFAULT(sizeof(CvContour)),
+                            int mode CV_DEFAULT(CV_RETR_LIST),
+                            int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
+                            CvPoint offset CV_DEFAULT(cvPoint(0,0)));
+
+/** @brief Initializes contour retrieving process.
+
+   Calls cvStartFindContours.
+   Calls cvFindNextContour until null pointer is returned
+   or some other condition becomes true.
+   Calls cvEndFindContours at the end.
+@see cvFindContours
+*/
+CVAPI(CvContourScanner)  cvStartFindContours( CvArr* image, CvMemStorage* storage,
+                            int header_size CV_DEFAULT(sizeof(CvContour)),
+                            int mode CV_DEFAULT(CV_RETR_LIST),
+                            int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
+                            CvPoint offset CV_DEFAULT(cvPoint(0,0)));
+
+/** @brief Retrieves next contour
+@see cvFindContours
+*/
+CVAPI(CvSeq*)  cvFindNextContour( CvContourScanner scanner );
+
+
+/** @brief Substitutes the last retrieved contour with the new one
+
+   (if the substitutor is null, the last retrieved contour is removed from the tree)
+@see cvFindContours
+*/
+CVAPI(void)   cvSubstituteContour( CvContourScanner scanner, CvSeq* new_contour );
+
+
+/** @brief Releases contour scanner and returns pointer to the first outer contour
+@see cvFindContours
+*/
+CVAPI(CvSeq*)  cvEndFindContours( CvContourScanner* scanner );
+
+/** @brief Approximates Freeman chain(s) with a polygonal curve.
+
+This is a standalone contour approximation routine, not represented in the new interface. When
+cvFindContours retrieves contours as Freeman chains, it calls the function to get approximated
+contours, represented as polygons.
+
+@param src_seq Pointer to the approximated Freeman chain that can refer to other chains.
+@param storage Storage location for the resulting polylines.
+@param method Approximation method (see the description of the function :ocvFindContours ).
+@param parameter Method parameter (not used now).
+@param minimal_perimeter Approximates only those contours whose perimeters are not less than
+minimal_perimeter . Other chains are removed from the resulting structure.
+@param recursive Recursion flag. If it is non-zero, the function approximates all chains that can
+be obtained from chain by using the h_next or v_next links. Otherwise, the single input chain is
+approximated.
+@see cvStartReadChainPoints, cvReadChainPoint
+ */
+CVAPI(CvSeq*) cvApproxChains( CvSeq* src_seq, CvMemStorage* storage,
+                            int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
+                            double parameter CV_DEFAULT(0),
+                            int  minimal_perimeter CV_DEFAULT(0),
+                            int  recursive CV_DEFAULT(0));
+
+/** @brief Initializes Freeman chain reader.
+
+   The reader is used to iteratively get coordinates of all the chain points.
+   If the Freeman codes should be read as is, a simple sequence reader should be used
+@see cvApproxChains
+*/
+CVAPI(void) cvStartReadChainPoints( CvChain* chain, CvChainPtReader* reader );
+
+/** @brief Retrieves the next chain point
+@see cvApproxChains
+*/
+CVAPI(CvPoint) cvReadChainPoint( CvChainPtReader* reader );
+
+
+/****************************************************************************************\
+*                            Contour Processing and Shape Analysis                       *
+\****************************************************************************************/
+
+/** @brief Approximates a single polygonal curve (contour) or
+   a tree of polygonal curves (contours)
+@see cv::approxPolyDP
+*/
+CVAPI(CvSeq*)  cvApproxPoly( const void* src_seq,
+                             int header_size, CvMemStorage* storage,
+                             int method, double eps,
+                             int recursive CV_DEFAULT(0));
+
+/** @brief Calculates perimeter of a contour or length of a part of contour
+@see cv::arcLength
+*/
+CVAPI(double)  cvArcLength( const void* curve,
+                            CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
+                            int is_closed CV_DEFAULT(-1));
+
+/** same as cvArcLength for closed contour
+*/
+CV_INLINE double cvContourPerimeter( const void* contour )
+{
+    return cvArcLength( contour, CV_WHOLE_SEQ, 1 );
+}
+
+
+/** @brief Calculates contour bounding rectangle (update=1) or
+   just retrieves pre-calculated rectangle (update=0)
+@see cv::boundingRect
+*/
+CVAPI(CvRect)  cvBoundingRect( CvArr* points, int update CV_DEFAULT(0) );
+
+/** @brief Calculates area of a contour or contour segment
+@see cv::contourArea
+*/
+CVAPI(double)  cvContourArea( const CvArr* contour,
+                              CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
+                              int oriented CV_DEFAULT(0));
+
+/** @brief Finds minimum area rotated rectangle bounding a set of points
+@see cv::minAreaRect
+*/
+CVAPI(CvBox2D)  cvMinAreaRect2( const CvArr* points,
+                                CvMemStorage* storage CV_DEFAULT(NULL));
+
+/** @brief Finds minimum enclosing circle for a set of points
+@see cv::minEnclosingCircle
+*/
+CVAPI(int)  cvMinEnclosingCircle( const CvArr* points,
+                                  CvPoint2D32f* center, float* radius );
+
+/** @brief Compares two contours by matching their moments
+@see cv::matchShapes
+*/
+CVAPI(double)  cvMatchShapes( const void* object1, const void* object2,
+                              int method, double parameter CV_DEFAULT(0));
+
+/** @brief Calculates exact convex hull of 2d point set
+@see cv::convexHull
+*/
+CVAPI(CvSeq*) cvConvexHull2( const CvArr* input,
+                             void* hull_storage CV_DEFAULT(NULL),
+                             int orientation CV_DEFAULT(CV_CLOCKWISE),
+                             int return_points CV_DEFAULT(0));
+
+/** @brief Checks whether the contour is convex or not (returns 1 if convex, 0 if not)
+@see cv::isContourConvex
+*/
+CVAPI(int)  cvCheckContourConvexity( const CvArr* contour );
+
+
+/** @brief Finds convexity defects for the contour
+@see cv::convexityDefects
+*/
+CVAPI(CvSeq*)  cvConvexityDefects( const CvArr* contour, const CvArr* convexhull,
+                                   CvMemStorage* storage CV_DEFAULT(NULL));
+
+/** @brief Fits ellipse into a set of 2d points
+@see cv::fitEllipse
+*/
+CVAPI(CvBox2D) cvFitEllipse2( const CvArr* points );
+
+/** @brief Finds minimum rectangle containing two given rectangles */
+CVAPI(CvRect)  cvMaxRect( const CvRect* rect1, const CvRect* rect2 );
+
+/** @brief Finds coordinates of the box vertices */
+CVAPI(void) cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] );
+
+/** @brief Initializes sequence header for a matrix (column or row vector) of points
+
+   a wrapper for cvMakeSeqHeaderForArray (it does not initialize bounding rectangle!!!) */
+CVAPI(CvSeq*) cvPointSeqFromMat( int seq_kind, const CvArr* mat,
+                                 CvContour* contour_header,
+                                 CvSeqBlock* block );
+
+/** @brief Checks whether the point is inside polygon, outside, on an edge (at a vertex).
+
+   Returns positive, negative or zero value, correspondingly.
+   Optionally, measures a signed distance between
+   the point and the nearest polygon edge (measure_dist=1)
+@see cv::pointPolygonTest
+*/
+CVAPI(double) cvPointPolygonTest( const CvArr* contour,
+                                  CvPoint2D32f pt, int measure_dist );
+
+/****************************************************************************************\
+*                                  Histogram functions                                   *
+\****************************************************************************************/
+
+/** @brief Creates a histogram.
+
+The function creates a histogram of the specified size and returns a pointer to the created
+histogram. If the array ranges is 0, the histogram bin ranges must be specified later via the
+function cvSetHistBinRanges. Though cvCalcHist and cvCalcBackProject may process 8-bit images
+without setting bin ranges, they assume they are equally spaced in 0 to 255 bins.
+
+@param dims Number of histogram dimensions.
+@param sizes Array of the histogram dimension sizes.
+@param type Histogram representation format. CV_HIST_ARRAY means that the histogram data is
+represented as a multi-dimensional dense array CvMatND. CV_HIST_SPARSE means that histogram data
+is represented as a multi-dimensional sparse array CvSparseMat.
+@param ranges Array of ranges for the histogram bins. Its meaning depends on the uniform parameter
+value. The ranges are used when the histogram is calculated or backprojected to determine which
+histogram bin corresponds to which value/tuple of values from the input image(s).
+@param uniform Uniformity flag. If not zero, the histogram has evenly spaced bins and for every
+\f$0<=i<cDims\f$ ranges[i] is an array of two numbers: lower and upper boundaries for the i-th
+histogram dimension. The whole range [lower,upper] is then split into dims[i] equal parts to
+determine the i-th input tuple value ranges for every histogram bin. And if uniform=0 , then the
+i-th element of the ranges array contains dims[i]+1 elements: \f$\texttt{lower}_0,
+\texttt{upper}_0, \texttt{lower}_1, \texttt{upper}_1 = \texttt{lower}_2,
+...
+\texttt{upper}_{dims[i]-1}\f$ where \f$\texttt{lower}_j\f$ and \f$\texttt{upper}_j\f$ are lower
+and upper boundaries of the i-th input tuple value for the j-th bin, respectively. In either
+case, the input values that are beyond the specified range for a histogram bin are not counted
+by cvCalcHist and filled with 0 by cvCalcBackProject.
+ */
+CVAPI(CvHistogram*)  cvCreateHist( int dims, int* sizes, int type,
+                                   float** ranges CV_DEFAULT(NULL),
+                                   int uniform CV_DEFAULT(1));
+
+/** @brief Sets the bounds of the histogram bins.
+
+This is a standalone function for setting bin ranges in the histogram. For a more detailed
+description of the parameters ranges and uniform, see the :ocvCalcHist function that can initialize
+the ranges as well. Ranges for the histogram bins must be set before the histogram is calculated or
+the backproject of the histogram is calculated.
+
+@param hist Histogram.
+@param ranges Array of bin ranges arrays. See :ocvCreateHist for details.
+@param uniform Uniformity flag. See :ocvCreateHist for details.
+ */
+CVAPI(void)  cvSetHistBinRanges( CvHistogram* hist, float** ranges,
+                                int uniform CV_DEFAULT(1));
+
+/** @brief Makes a histogram out of an array.
+
+The function initializes the histogram, whose header and bins are allocated by the user.
+cvReleaseHist does not need to be called afterwards. Only dense histograms can be initialized this
+way. The function returns hist.
+
+@param dims Number of the histogram dimensions.
+@param sizes Array of the histogram dimension sizes.
+@param hist Histogram header initialized by the function.
+@param data Array used to store histogram bins.
+@param ranges Histogram bin ranges. See cvCreateHist for details.
+@param uniform Uniformity flag. See cvCreateHist for details.
+ */
+CVAPI(CvHistogram*)  cvMakeHistHeaderForArray(
+                            int  dims, int* sizes, CvHistogram* hist,
+                            float* data, float** ranges CV_DEFAULT(NULL),
+                            int uniform CV_DEFAULT(1));
+
+/** @brief Releases the histogram.
+
+The function releases the histogram (header and the data). The pointer to the histogram is cleared
+by the function. If \*hist pointer is already NULL, the function does nothing.
+
+@param hist Double pointer to the released histogram.
+ */
+CVAPI(void)  cvReleaseHist( CvHistogram** hist );
+
+/** @brief Clears the histogram.
+
+The function sets all of the histogram bins to 0 in case of a dense histogram and removes all
+histogram bins in case of a sparse array.
+
+@param hist Histogram.
+ */
+CVAPI(void)  cvClearHist( CvHistogram* hist );
+
+/** @brief Finds the minimum and maximum histogram bins.
+
+The function finds the minimum and maximum histogram bins and their positions. All of output
+arguments are optional. Among several extremas with the same value the ones with the minimum index
+(in the lexicographical order) are returned. In case of several maximums or minimums, the earliest
+in the lexicographical order (extrema locations) is returned.
+
+@param hist Histogram.
+@param min_value Pointer to the minimum value of the histogram.
+@param max_value Pointer to the maximum value of the histogram.
+@param min_idx Pointer to the array of coordinates for the minimum.
+@param max_idx Pointer to the array of coordinates for the maximum.
+ */
+CVAPI(void)  cvGetMinMaxHistValue( const CvHistogram* hist,
+                                   float* min_value, float* max_value,
+                                   int* min_idx CV_DEFAULT(NULL),
+                                   int* max_idx CV_DEFAULT(NULL));
+
+
+/** @brief Normalizes the histogram.
+
+The function normalizes the histogram bins by scaling them so that the sum of the bins becomes equal
+to factor.
+
+@param hist Pointer to the histogram.
+@param factor Normalization factor.
+ */
+CVAPI(void)  cvNormalizeHist( CvHistogram* hist, double factor );
+
+
+/** @brief Thresholds the histogram.
+
+The function clears histogram bins that are below the specified threshold.
+
+@param hist Pointer to the histogram.
+@param threshold Threshold level.
+ */
+CVAPI(void)  cvThreshHist( CvHistogram* hist, double threshold );
+
+
+/** Compares two histogram */
+CVAPI(double)  cvCompareHist( const CvHistogram* hist1,
+                              const CvHistogram* hist2,
+                              int method);
+
+/** @brief Copies a histogram.
+
+The function makes a copy of the histogram. If the second histogram pointer \*dst is NULL, a new
+histogram of the same size as src is created. Otherwise, both histograms must have equal types and
+sizes. Then the function copies the bin values of the source histogram to the destination histogram
+and sets the same bin value ranges as in src.
+
+@param src Source histogram.
+@param dst Pointer to the destination histogram.
+ */
+CVAPI(void)  cvCopyHist( const CvHistogram* src, CvHistogram** dst );
+
+
+/** @brief Calculates bayesian probabilistic histograms
+   (each or src and dst is an array of _number_ histograms */
+CVAPI(void)  cvCalcBayesianProb( CvHistogram** src, int number,
+                                CvHistogram** dst);
+
+/** @brief Calculates array histogram
+@see cv::calcHist
+*/
+CVAPI(void)  cvCalcArrHist( CvArr** arr, CvHistogram* hist,
+                            int accumulate CV_DEFAULT(0),
+                            const CvArr* mask CV_DEFAULT(NULL) );
+
+/** @overload */
+CV_INLINE  void  cvCalcHist( IplImage** image, CvHistogram* hist,
+                             int accumulate CV_DEFAULT(0),
+                             const CvArr* mask CV_DEFAULT(NULL) )
+{
+    cvCalcArrHist( (CvArr**)image, hist, accumulate, mask );
+}
+
+/** @brief Calculates back project
+@see cvCalcBackProject, cv::calcBackProject
+*/
+CVAPI(void)  cvCalcArrBackProject( CvArr** image, CvArr* dst,
+                                   const CvHistogram* hist );
+
+#define  cvCalcBackProject(image, dst, hist) cvCalcArrBackProject((CvArr**)image, dst, hist)
+
+
+/** @brief Locates a template within an image by using a histogram comparison.
+
+The function calculates the back projection by comparing histograms of the source image patches with
+the given histogram. The function is similar to matchTemplate, but instead of comparing the raster
+patch with all its possible positions within the search window, the function CalcBackProjectPatch
+compares histograms. See the algorithm diagram below:
+
+![image](pics/backprojectpatch.png)
+
+@param image Source images (though, you may pass CvMat\*\* as well).
+@param dst Destination image.
+@param range
+@param hist Histogram.
+@param method Comparison method passed to cvCompareHist (see the function description).
+@param factor Normalization factor for histograms that affects the normalization scale of the
+destination image. Pass 1 if not sure.
+
+@see cvCalcBackProjectPatch
+ */
+CVAPI(void)  cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range,
+                                        CvHistogram* hist, int method,
+                                        double factor );
+
+#define  cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) \
+     cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor )
+
+
+/** @brief Divides one histogram by another.
+
+The function calculates the object probability density from two histograms as:
+
+\f[\texttt{disthist} (I)= \forkthree{0}{if \(\texttt{hist1}(I)=0\)}{\texttt{scale}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) > \texttt{hist1}(I)\)}{\frac{\texttt{hist2}(I) \cdot \texttt{scale}}{\texttt{hist1}(I)}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) \le \texttt{hist1}(I)\)}\f]
+
+@param hist1 First histogram (the divisor).
+@param hist2 Second histogram.
+@param dst_hist Destination histogram.
+@param scale Scale factor for the destination histogram.
+ */
+CVAPI(void)  cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2,
+                                CvHistogram* dst_hist, double scale CV_DEFAULT(255) );
+
+/** @brief equalizes histogram of 8-bit single-channel image
+@see cv::equalizeHist
+*/
+CVAPI(void)  cvEqualizeHist( const CvArr* src, CvArr* dst );
+
+
+/** @brief Applies distance transform to binary image
+@see cv::distanceTransform
+*/
+CVAPI(void)  cvDistTransform( const CvArr* src, CvArr* dst,
+                              int distance_type CV_DEFAULT(CV_DIST_L2),
+                              int mask_size CV_DEFAULT(3),
+                              const float* mask CV_DEFAULT(NULL),
+                              CvArr* labels CV_DEFAULT(NULL),
+                              int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP));
+
+
+/** @brief Applies fixed-level threshold to grayscale image.
+
+   This is a basic operation applied before retrieving contours
+@see cv::threshold
+*/
+CVAPI(double)  cvThreshold( const CvArr*  src, CvArr*  dst,
+                            double  threshold, double  max_value,
+                            int threshold_type );
+
+/** @brief Applies adaptive threshold to grayscale image.
+
+   The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and
+   CV_ADAPTIVE_THRESH_GAUSSIAN_C are:
+   neighborhood size (3, 5, 7 etc.),
+   and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...)
+@see cv::adaptiveThreshold
+*/
+CVAPI(void)  cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value,
+                                  int adaptive_method CV_DEFAULT(CV_ADAPTIVE_THRESH_MEAN_C),
+                                  int threshold_type CV_DEFAULT(CV_THRESH_BINARY),
+                                  int block_size CV_DEFAULT(3),
+                                  double param1 CV_DEFAULT(5));
+
+/** @brief Fills the connected component until the color difference gets large enough
+@see cv::floodFill
+*/
+CVAPI(void)  cvFloodFill( CvArr* image, CvPoint seed_point,
+                          CvScalar new_val, CvScalar lo_diff CV_DEFAULT(cvScalarAll(0)),
+                          CvScalar up_diff CV_DEFAULT(cvScalarAll(0)),
+                          CvConnectedComp* comp CV_DEFAULT(NULL),
+                          int flags CV_DEFAULT(4),
+                          CvArr* mask CV_DEFAULT(NULL));
+
+/****************************************************************************************\
+*                                  Feature detection                                     *
+\****************************************************************************************/
+
+/** @brief Runs canny edge detector
+@see cv::Canny
+*/
+CVAPI(void)  cvCanny( const CvArr* image, CvArr* edges, double threshold1,
+                      double threshold2, int  aperture_size CV_DEFAULT(3) );
+
+/** @brief Calculates constraint image for corner detection
+
+   Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy.
+   Applying threshold to the result gives coordinates of corners
+@see cv::preCornerDetect
+*/
+CVAPI(void) cvPreCornerDetect( const CvArr* image, CvArr* corners,
+                               int aperture_size CV_DEFAULT(3) );
+
+/** @brief Calculates eigen values and vectors of 2x2
+   gradient covariation matrix at every image pixel
+@see cv::cornerEigenValsAndVecs
+*/
+CVAPI(void)  cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv,
+                                       int block_size, int aperture_size CV_DEFAULT(3) );
+
+/** @brief Calculates minimal eigenvalue for 2x2 gradient covariation matrix at
+   every image pixel
+@see cv::cornerMinEigenVal
+*/
+CVAPI(void)  cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval,
+                                  int block_size, int aperture_size CV_DEFAULT(3) );
+
+/** @brief Harris corner detector:
+
+   Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel
+@see cv::cornerHarris
+*/
+CVAPI(void)  cvCornerHarris( const CvArr* image, CvArr* harris_response,
+                             int block_size, int aperture_size CV_DEFAULT(3),
+                             double k CV_DEFAULT(0.04) );
+
+/** @brief Adjust corner position using some sort of gradient search
+@see cv::cornerSubPix
+*/
+CVAPI(void)  cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners,
+                                 int count, CvSize win, CvSize zero_zone,
+                                 CvTermCriteria  criteria );
+
+/** @brief Finds a sparse set of points within the selected region
+   that seem to be easy to track
+@see cv::goodFeaturesToTrack
+*/
+CVAPI(void)  cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image,
+                                    CvArr* temp_image, CvPoint2D32f* corners,
+                                    int* corner_count, double  quality_level,
+                                    double  min_distance,
+                                    const CvArr* mask CV_DEFAULT(NULL),
+                                    int block_size CV_DEFAULT(3),
+                                    int use_harris CV_DEFAULT(0),
+                                    double k CV_DEFAULT(0.04) );
+
+/** @brief Finds lines on binary image using one of several methods.
+
+   line_storage is either memory storage or 1 x _max number of lines_ CvMat, its
+   number of columns is changed by the function.
+   method is one of CV_HOUGH_*;
+   rho, theta and threshold are used for each of those methods;
+   param1 ~ line length, param2 ~ line gap - for probabilistic,
+   param1 ~ srn, param2 ~ stn - for multi-scale
+@see cv::HoughLines
+*/
+CVAPI(CvSeq*)  cvHoughLines2( CvArr* image, void* line_storage, int method,
+                              double rho, double theta, int threshold,
+                              double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0),
+                              double min_theta CV_DEFAULT(0), double max_theta CV_DEFAULT(CV_PI));
+
+/** @brief Finds circles in the image
+@see cv::HoughCircles
+*/
+CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage,
+                              int method, double dp, double min_dist,
+                              double param1 CV_DEFAULT(100),
+                              double param2 CV_DEFAULT(100),
+                              int min_radius CV_DEFAULT(0),
+                              int max_radius CV_DEFAULT(0));
+
+/** @brief Fits a line into set of 2d or 3d points in a robust way (M-estimator technique)
+@see cv::fitLine
+*/
+CVAPI(void)  cvFitLine( const CvArr* points, int dist_type, double param,
+                        double reps, double aeps, float* line );
+
+/****************************************************************************************\
+*                                     Drawing                                            *
+\****************************************************************************************/
+
+/****************************************************************************************\
+*       Drawing functions work with images/matrices of arbitrary type.                   *
+*       For color images the channel order is BGR[A]                                     *
+*       Antialiasing is supported only for 8-bit image now.                              *
+*       All the functions include parameter color that means rgb value (that may be      *
+*       constructed with CV_RGB macro) for color images and brightness                   *
+*       for grayscale images.                                                            *
+*       If a drawn figure is partially or completely outside of the image, it is clipped.*
+\****************************************************************************************/
+
+#define CV_RGB( r, g, b )  cvScalar( (b), (g), (r), 0 )
+#define CV_FILLED -1
+
+#define CV_AA 16
+
+/** @brief Draws 4-connected, 8-connected or antialiased line segment connecting two points
+@see cv::line
+*/
+CVAPI(void)  cvLine( CvArr* img, CvPoint pt1, CvPoint pt2,
+                     CvScalar color, int thickness CV_DEFAULT(1),
+                     int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
+
+/** @brief Draws a rectangle given two opposite corners of the rectangle (pt1 & pt2)
+
+   if thickness<0 (e.g. thickness == CV_FILLED), the filled box is drawn
+@see cv::rectangle
+*/
+CVAPI(void)  cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2,
+                          CvScalar color, int thickness CV_DEFAULT(1),
+                          int line_type CV_DEFAULT(8),
+                          int shift CV_DEFAULT(0));
+
+/** @brief Draws a rectangle specified by a CvRect structure
+@see cv::rectangle
+*/
+CVAPI(void)  cvRectangleR( CvArr* img, CvRect r,
+                           CvScalar color, int thickness CV_DEFAULT(1),
+                           int line_type CV_DEFAULT(8),
+                           int shift CV_DEFAULT(0));
+
+
+/** @brief Draws a circle with specified center and radius.
+
+   Thickness works in the same way as with cvRectangle
+@see cv::circle
+*/
+CVAPI(void)  cvCircle( CvArr* img, CvPoint center, int radius,
+                       CvScalar color, int thickness CV_DEFAULT(1),
+                       int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
+
+/** @brief Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector
+
+   depending on _thickness_, _start_angle_ and _end_angle_ parameters. The resultant figure
+   is rotated by _angle_. All the angles are in degrees
+@see cv::ellipse
+*/
+CVAPI(void)  cvEllipse( CvArr* img, CvPoint center, CvSize axes,
+                        double angle, double start_angle, double end_angle,
+                        CvScalar color, int thickness CV_DEFAULT(1),
+                        int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
+
+CV_INLINE  void  cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color,
+                               int thickness CV_DEFAULT(1),
+                               int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) )
+{
+    CvSize axes;
+    axes.width = cvRound(box.size.width*0.5);
+    axes.height = cvRound(box.size.height*0.5);
+
+    cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle,
+               0, 360, color, thickness, line_type, shift );
+}
+
+/** @brief Fills convex or monotonous polygon.
+@see cv::fillConvexPoly
+*/
+CVAPI(void)  cvFillConvexPoly( CvArr* img, const CvPoint* pts, int npts, CvScalar color,
+                               int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
+
+/** @brief Fills an area bounded by one or more arbitrary polygons
+@see cv::fillPoly
+*/
+CVAPI(void)  cvFillPoly( CvArr* img, CvPoint** pts, const int* npts,
+                         int contours, CvScalar color,
+                         int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
+
+/** @brief Draws one or more polygonal curves
+@see cv::polylines
+*/
+CVAPI(void)  cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contours,
+                         int is_closed, CvScalar color, int thickness CV_DEFAULT(1),
+                         int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
+
+#define cvDrawRect cvRectangle
+#define cvDrawLine cvLine
+#define cvDrawCircle cvCircle
+#define cvDrawEllipse cvEllipse
+#define cvDrawPolyLine cvPolyLine
+
+/** @brief Clips the line segment connecting *pt1 and *pt2
+   by the rectangular window
+
+   (0<=x<img_size.width, 0<=y<img_size.height).
+@see cv::clipLine
+*/
+CVAPI(int) cvClipLine( CvSize img_size, CvPoint* pt1, CvPoint* pt2 );
+
+/** @brief Initializes line iterator.
+
+Initially, line_iterator->ptr will point to pt1 (or pt2, see left_to_right description) location in
+the image. Returns the number of pixels on the line between the ending points.
+@see cv::LineIterator
+*/
+CVAPI(int)  cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
+                                CvLineIterator* line_iterator,
+                                int connectivity CV_DEFAULT(8),
+                                int left_to_right CV_DEFAULT(0));
+
+#define CV_NEXT_LINE_POINT( line_iterator )                     \
+{                                                               \
+    int _line_iterator_mask = (line_iterator).err < 0 ? -1 : 0; \
+    (line_iterator).err += (line_iterator).minus_delta +        \
+        ((line_iterator).plus_delta & _line_iterator_mask);     \
+    (line_iterator).ptr += (line_iterator).minus_step +         \
+        ((line_iterator).plus_step & _line_iterator_mask);      \
+}
+
+
+#define CV_FONT_HERSHEY_SIMPLEX         0
+#define CV_FONT_HERSHEY_PLAIN           1
+#define CV_FONT_HERSHEY_DUPLEX          2
+#define CV_FONT_HERSHEY_COMPLEX         3
+#define CV_FONT_HERSHEY_TRIPLEX         4
+#define CV_FONT_HERSHEY_COMPLEX_SMALL   5
+#define CV_FONT_HERSHEY_SCRIPT_SIMPLEX  6
+#define CV_FONT_HERSHEY_SCRIPT_COMPLEX  7
+
+#define CV_FONT_ITALIC                 16
+
+#define CV_FONT_VECTOR0    CV_FONT_HERSHEY_SIMPLEX
+
+
+/** Font structure */
+typedef struct CvFont
+{
+  const char* nameFont;   //Qt:nameFont
+  CvScalar color;       //Qt:ColorFont -> cvScalar(blue_component, green_component, red_component[, alpha_component])
+    int         font_face;    //Qt: bool italic         /** =CV_FONT_* */
+    const int*  ascii;      //!< font data and metrics
+    const int*  greek;
+    const int*  cyrillic;
+    float       hscale, vscale;
+    float       shear;      //!< slope coefficient: 0 - normal, >0 - italic
+    int         thickness;    //!< Qt: weight               /** letters thickness */
+    float       dx;       //!< horizontal interval between letters
+    int         line_type;    //!< Qt: PointSize
+}
+CvFont;
+
+/** @brief Initializes font structure (OpenCV 1.x API).
+
+The function initializes the font structure that can be passed to text rendering functions.
+
+@param font Pointer to the font structure initialized by the function
+@param font_face Font name identifier. See cv::HersheyFonts and corresponding old CV_* identifiers.
+@param hscale Horizontal scale. If equal to 1.0f , the characters have the original width
+depending on the font type. If equal to 0.5f , the characters are of half the original width.
+@param vscale Vertical scale. If equal to 1.0f , the characters have the original height depending
+on the font type. If equal to 0.5f , the characters are of half the original height.
+@param shear Approximate tangent of the character slope relative to the vertical line. A zero
+value means a non-italic font, 1.0f means about a 45 degree slope, etc.
+@param thickness Thickness of the text strokes
+@param line_type Type of the strokes, see line description
+
+@sa cvPutText
+ */
+CVAPI(void)  cvInitFont( CvFont* font, int font_face,
+                         double hscale, double vscale,
+                         double shear CV_DEFAULT(0),
+                         int thickness CV_DEFAULT(1),
+                         int line_type CV_DEFAULT(8));
+
+CV_INLINE CvFont cvFont( double scale, int thickness CV_DEFAULT(1) )
+{
+    CvFont font;
+    cvInitFont( &font, CV_FONT_HERSHEY_PLAIN, scale, scale, 0, thickness, CV_AA );
+    return font;
+}
+
+/** @brief Renders text stroke with specified font and color at specified location.
+   CvFont should be initialized with cvInitFont
+@see cvInitFont, cvGetTextSize, cvFont, cv::putText
+*/
+CVAPI(void)  cvPutText( CvArr* img, const char* text, CvPoint org,
+                        const CvFont* font, CvScalar color );
+
+/** @brief Calculates bounding box of text stroke (useful for alignment)
+@see cv::getTextSize
+*/
+CVAPI(void)  cvGetTextSize( const char* text_string, const CvFont* font,
+                            CvSize* text_size, int* baseline );
+
+/** @brief Unpacks color value
+
+if arrtype is CV_8UC?, _color_ is treated as packed color value, otherwise the first channels
+(depending on arrtype) of destination scalar are set to the same value = _color_
+*/
+CVAPI(CvScalar)  cvColorToScalar( double packed_color, int arrtype );
+
+/** @brief Returns the polygon points which make up the given ellipse.
+
+The ellipse is define by the box of size 'axes' rotated 'angle' around the 'center'. A partial
+sweep of the ellipse arc can be done by spcifying arc_start and arc_end to be something other than
+0 and 360, respectively. The input array 'pts' must be large enough to hold the result. The total
+number of points stored into 'pts' is returned by this function.
+@see cv::ellipse2Poly
+*/
+CVAPI(int) cvEllipse2Poly( CvPoint center, CvSize axes,
+                 int angle, int arc_start, int arc_end, CvPoint * pts, int delta );
+
+/** @brief Draws contour outlines or filled interiors on the image
+@see cv::drawContours
+*/
+CVAPI(void)  cvDrawContours( CvArr *img, CvSeq* contour,
+                             CvScalar external_color, CvScalar hole_color,
+                             int max_level, int thickness CV_DEFAULT(1),
+                             int line_type CV_DEFAULT(8),
+                             CvPoint offset CV_DEFAULT(cvPoint(0,0)));
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h
new file mode 100644
index 0000000..5ecb460
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/imgproc/types_c.h
@@ -0,0 +1,626 @@
+/*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*/
+
+#ifndef __OPENCV_IMGPROC_TYPES_C_H__
+#define __OPENCV_IMGPROC_TYPES_C_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup imgproc_c
+  @{
+*/
+
+/** Connected component structure */
+typedef struct CvConnectedComp
+{
+    double area;    /**<area of the connected component  */
+    CvScalar value; /**<average color of the connected component */
+    CvRect rect;    /**<ROI of the component  */
+    CvSeq* contour; /**<optional component boundary
+                      (the contour might have child contours corresponding to the holes)*/
+}
+CvConnectedComp;
+
+/** Image smooth methods */
+enum SmoothMethod_c
+{
+    /** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all 1's). If
+    you want to smooth different pixels with different-size box kernels, you can use the integral
+    image that is computed using integral */
+    CV_BLUR_NO_SCALE =0,
+    /** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all
+    1's) with subsequent scaling by \f$1/(\texttt{size1}\cdot\texttt{size2})\f$ */
+    CV_BLUR  =1,
+    /** linear convolution with a \f$\texttt{size1}\times\texttt{size2}\f$ Gaussian kernel */
+    CV_GAUSSIAN  =2,
+    /** median filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture */
+    CV_MEDIAN =3,
+    /** bilateral filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture, color
+    sigma= sigma1 and spatial sigma= sigma2. If size1=0, the aperture square side is set to
+    cvRound(sigma2\*1.5)\*2+1. See cv::bilateralFilter */
+    CV_BILATERAL =4
+};
+
+/** Filters used in pyramid decomposition */
+enum
+{
+    CV_GAUSSIAN_5x5 = 7
+};
+
+/** Special filters */
+enum
+{
+    CV_SCHARR =-1,
+    CV_MAX_SOBEL_KSIZE =7
+};
+
+/** Constants for color conversion */
+enum
+{
+    CV_BGR2BGRA    =0,
+    CV_RGB2RGBA    =CV_BGR2BGRA,
+
+    CV_BGRA2BGR    =1,
+    CV_RGBA2RGB    =CV_BGRA2BGR,
+
+    CV_BGR2RGBA    =2,
+    CV_RGB2BGRA    =CV_BGR2RGBA,
+
+    CV_RGBA2BGR    =3,
+    CV_BGRA2RGB    =CV_RGBA2BGR,
+
+    CV_BGR2RGB     =4,
+    CV_RGB2BGR     =CV_BGR2RGB,
+
+    CV_BGRA2RGBA   =5,
+    CV_RGBA2BGRA   =CV_BGRA2RGBA,
+
+    CV_BGR2GRAY    =6,
+    CV_RGB2GRAY    =7,
+    CV_GRAY2BGR    =8,
+    CV_GRAY2RGB    =CV_GRAY2BGR,
+    CV_GRAY2BGRA   =9,
+    CV_GRAY2RGBA   =CV_GRAY2BGRA,
+    CV_BGRA2GRAY   =10,
+    CV_RGBA2GRAY   =11,
+
+    CV_BGR2BGR565  =12,
+    CV_RGB2BGR565  =13,
+    CV_BGR5652BGR  =14,
+    CV_BGR5652RGB  =15,
+    CV_BGRA2BGR565 =16,
+    CV_RGBA2BGR565 =17,
+    CV_BGR5652BGRA =18,
+    CV_BGR5652RGBA =19,
+
+    CV_GRAY2BGR565 =20,
+    CV_BGR5652GRAY =21,
+
+    CV_BGR2BGR555  =22,
+    CV_RGB2BGR555  =23,
+    CV_BGR5552BGR  =24,
+    CV_BGR5552RGB  =25,
+    CV_BGRA2BGR555 =26,
+    CV_RGBA2BGR555 =27,
+    CV_BGR5552BGRA =28,
+    CV_BGR5552RGBA =29,
+
+    CV_GRAY2BGR555 =30,
+    CV_BGR5552GRAY =31,
+
+    CV_BGR2XYZ     =32,
+    CV_RGB2XYZ     =33,
+    CV_XYZ2BGR     =34,
+    CV_XYZ2RGB     =35,
+
+    CV_BGR2YCrCb   =36,
+    CV_RGB2YCrCb   =37,
+    CV_YCrCb2BGR   =38,
+    CV_YCrCb2RGB   =39,
+
+    CV_BGR2HSV     =40,
+    CV_RGB2HSV     =41,
+
+    CV_BGR2Lab     =44,
+    CV_RGB2Lab     =45,
+
+    CV_BayerBG2BGR =46,
+    CV_BayerGB2BGR =47,
+    CV_BayerRG2BGR =48,
+    CV_BayerGR2BGR =49,
+
+    CV_BayerBG2RGB =CV_BayerRG2BGR,
+    CV_BayerGB2RGB =CV_BayerGR2BGR,
+    CV_BayerRG2RGB =CV_BayerBG2BGR,
+    CV_BayerGR2RGB =CV_BayerGB2BGR,
+
+    CV_BGR2Luv     =50,
+    CV_RGB2Luv     =51,
+    CV_BGR2HLS     =52,
+    CV_RGB2HLS     =53,
+
+    CV_HSV2BGR     =54,
+    CV_HSV2RGB     =55,
+
+    CV_Lab2BGR     =56,
+    CV_Lab2RGB     =57,
+    CV_Luv2BGR     =58,
+    CV_Luv2RGB     =59,
+    CV_HLS2BGR     =60,
+    CV_HLS2RGB     =61,
+
+    CV_BayerBG2BGR_VNG =62,
+    CV_BayerGB2BGR_VNG =63,
+    CV_BayerRG2BGR_VNG =64,
+    CV_BayerGR2BGR_VNG =65,
+
+    CV_BayerBG2RGB_VNG =CV_BayerRG2BGR_VNG,
+    CV_BayerGB2RGB_VNG =CV_BayerGR2BGR_VNG,
+    CV_BayerRG2RGB_VNG =CV_BayerBG2BGR_VNG,
+    CV_BayerGR2RGB_VNG =CV_BayerGB2BGR_VNG,
+
+    CV_BGR2HSV_FULL = 66,
+    CV_RGB2HSV_FULL = 67,
+    CV_BGR2HLS_FULL = 68,
+    CV_RGB2HLS_FULL = 69,
+
+    CV_HSV2BGR_FULL = 70,
+    CV_HSV2RGB_FULL = 71,
+    CV_HLS2BGR_FULL = 72,
+    CV_HLS2RGB_FULL = 73,
+
+    CV_LBGR2Lab     = 74,
+    CV_LRGB2Lab     = 75,
+    CV_LBGR2Luv     = 76,
+    CV_LRGB2Luv     = 77,
+
+    CV_Lab2LBGR     = 78,
+    CV_Lab2LRGB     = 79,
+    CV_Luv2LBGR     = 80,
+    CV_Luv2LRGB     = 81,
+
+    CV_BGR2YUV      = 82,
+    CV_RGB2YUV      = 83,
+    CV_YUV2BGR      = 84,
+    CV_YUV2RGB      = 85,
+
+    CV_BayerBG2GRAY = 86,
+    CV_BayerGB2GRAY = 87,
+    CV_BayerRG2GRAY = 88,
+    CV_BayerGR2GRAY = 89,
+
+    //YUV 4:2:0 formats family
+    CV_YUV2RGB_NV12 = 90,
+    CV_YUV2BGR_NV12 = 91,
+    CV_YUV2RGB_NV21 = 92,
+    CV_YUV2BGR_NV21 = 93,
+    CV_YUV420sp2RGB = CV_YUV2RGB_NV21,
+    CV_YUV420sp2BGR = CV_YUV2BGR_NV21,
+
+    CV_YUV2RGBA_NV12 = 94,
+    CV_YUV2BGRA_NV12 = 95,
+    CV_YUV2RGBA_NV21 = 96,
+    CV_YUV2BGRA_NV21 = 97,
+    CV_YUV420sp2RGBA = CV_YUV2RGBA_NV21,
+    CV_YUV420sp2BGRA = CV_YUV2BGRA_NV21,
+
+    CV_YUV2RGB_YV12 = 98,
+    CV_YUV2BGR_YV12 = 99,
+    CV_YUV2RGB_IYUV = 100,
+    CV_YUV2BGR_IYUV = 101,
+    CV_YUV2RGB_I420 = CV_YUV2RGB_IYUV,
+    CV_YUV2BGR_I420 = CV_YUV2BGR_IYUV,
+    CV_YUV420p2RGB = CV_YUV2RGB_YV12,
+    CV_YUV420p2BGR = CV_YUV2BGR_YV12,
+
+    CV_YUV2RGBA_YV12 = 102,
+    CV_YUV2BGRA_YV12 = 103,
+    CV_YUV2RGBA_IYUV = 104,
+    CV_YUV2BGRA_IYUV = 105,
+    CV_YUV2RGBA_I420 = CV_YUV2RGBA_IYUV,
+    CV_YUV2BGRA_I420 = CV_YUV2BGRA_IYUV,
+    CV_YUV420p2RGBA = CV_YUV2RGBA_YV12,
+    CV_YUV420p2BGRA = CV_YUV2BGRA_YV12,
+
+    CV_YUV2GRAY_420 = 106,
+    CV_YUV2GRAY_NV21 = CV_YUV2GRAY_420,
+    CV_YUV2GRAY_NV12 = CV_YUV2GRAY_420,
+    CV_YUV2GRAY_YV12 = CV_YUV2GRAY_420,
+    CV_YUV2GRAY_IYUV = CV_YUV2GRAY_420,
+    CV_YUV2GRAY_I420 = CV_YUV2GRAY_420,
+    CV_YUV420sp2GRAY = CV_YUV2GRAY_420,
+    CV_YUV420p2GRAY = CV_YUV2GRAY_420,
+
+    //YUV 4:2:2 formats family
+    CV_YUV2RGB_UYVY = 107,
+    CV_YUV2BGR_UYVY = 108,
+    //CV_YUV2RGB_VYUY = 109,
+    //CV_YUV2BGR_VYUY = 110,
+    CV_YUV2RGB_Y422 = CV_YUV2RGB_UYVY,
+    CV_YUV2BGR_Y422 = CV_YUV2BGR_UYVY,
+    CV_YUV2RGB_UYNV = CV_YUV2RGB_UYVY,
+    CV_YUV2BGR_UYNV = CV_YUV2BGR_UYVY,
+
+    CV_YUV2RGBA_UYVY = 111,
+    CV_YUV2BGRA_UYVY = 112,
+    //CV_YUV2RGBA_VYUY = 113,
+    //CV_YUV2BGRA_VYUY = 114,
+    CV_YUV2RGBA_Y422 = CV_YUV2RGBA_UYVY,
+    CV_YUV2BGRA_Y422 = CV_YUV2BGRA_UYVY,
+    CV_YUV2RGBA_UYNV = CV_YUV2RGBA_UYVY,
+    CV_YUV2BGRA_UYNV = CV_YUV2BGRA_UYVY,
+
+    CV_YUV2RGB_YUY2 = 115,
+    CV_YUV2BGR_YUY2 = 116,
+    CV_YUV2RGB_YVYU = 117,
+    CV_YUV2BGR_YVYU = 118,
+    CV_YUV2RGB_YUYV = CV_YUV2RGB_YUY2,
+    CV_YUV2BGR_YUYV = CV_YUV2BGR_YUY2,
+    CV_YUV2RGB_YUNV = CV_YUV2RGB_YUY2,
+    CV_YUV2BGR_YUNV = CV_YUV2BGR_YUY2,
+
+    CV_YUV2RGBA_YUY2 = 119,
+    CV_YUV2BGRA_YUY2 = 120,
+    CV_YUV2RGBA_YVYU = 121,
+    CV_YUV2BGRA_YVYU = 122,
+    CV_YUV2RGBA_YUYV = CV_YUV2RGBA_YUY2,
+    CV_YUV2BGRA_YUYV = CV_YUV2BGRA_YUY2,
+    CV_YUV2RGBA_YUNV = CV_YUV2RGBA_YUY2,
+    CV_YUV2BGRA_YUNV = CV_YUV2BGRA_YUY2,
+
+    CV_YUV2GRAY_UYVY = 123,
+    CV_YUV2GRAY_YUY2 = 124,
+    //CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY,
+    CV_YUV2GRAY_Y422 = CV_YUV2GRAY_UYVY,
+    CV_YUV2GRAY_UYNV = CV_YUV2GRAY_UYVY,
+    CV_YUV2GRAY_YVYU = CV_YUV2GRAY_YUY2,
+    CV_YUV2GRAY_YUYV = CV_YUV2GRAY_YUY2,
+    CV_YUV2GRAY_YUNV = CV_YUV2GRAY_YUY2,
+
+    // alpha premultiplication
+    CV_RGBA2mRGBA = 125,
+    CV_mRGBA2RGBA = 126,
+
+    CV_RGB2YUV_I420 = 127,
+    CV_BGR2YUV_I420 = 128,
+    CV_RGB2YUV_IYUV = CV_RGB2YUV_I420,
+    CV_BGR2YUV_IYUV = CV_BGR2YUV_I420,
+
+    CV_RGBA2YUV_I420 = 129,
+    CV_BGRA2YUV_I420 = 130,
+    CV_RGBA2YUV_IYUV = CV_RGBA2YUV_I420,
+    CV_BGRA2YUV_IYUV = CV_BGRA2YUV_I420,
+    CV_RGB2YUV_YV12  = 131,
+    CV_BGR2YUV_YV12  = 132,
+    CV_RGBA2YUV_YV12 = 133,
+    CV_BGRA2YUV_YV12 = 134,
+
+    // Edge-Aware Demosaicing
+    CV_BayerBG2BGR_EA = 135,
+    CV_BayerGB2BGR_EA = 136,
+    CV_BayerRG2BGR_EA = 137,
+    CV_BayerGR2BGR_EA = 138,
+
+    CV_BayerBG2RGB_EA = CV_BayerRG2BGR_EA,
+    CV_BayerGB2RGB_EA = CV_BayerGR2BGR_EA,
+    CV_BayerRG2RGB_EA = CV_BayerBG2BGR_EA,
+    CV_BayerGR2RGB_EA = CV_BayerGB2BGR_EA,
+
+    CV_COLORCVT_MAX  = 139
+};
+
+
+/** Sub-pixel interpolation methods */
+enum
+{
+    CV_INTER_NN        =0,
+    CV_INTER_LINEAR    =1,
+    CV_INTER_CUBIC     =2,
+    CV_INTER_AREA      =3,
+    CV_INTER_LANCZOS4  =4
+};
+
+/** ... and other image warping flags */
+enum
+{
+    CV_WARP_FILL_OUTLIERS =8,
+    CV_WARP_INVERSE_MAP  =16
+};
+
+/** Shapes of a structuring element for morphological operations
+@see cv::MorphShapes, cv::getStructuringElement
+*/
+enum MorphShapes_c
+{
+    CV_SHAPE_RECT      =0,
+    CV_SHAPE_CROSS     =1,
+    CV_SHAPE_ELLIPSE   =2,
+    CV_SHAPE_CUSTOM    =100 //!< custom structuring element
+};
+
+/** Morphological operations */
+enum
+{
+    CV_MOP_ERODE        =0,
+    CV_MOP_DILATE       =1,
+    CV_MOP_OPEN         =2,
+    CV_MOP_CLOSE        =3,
+    CV_MOP_GRADIENT     =4,
+    CV_MOP_TOPHAT       =5,
+    CV_MOP_BLACKHAT     =6
+};
+
+/** Spatial and central moments */
+typedef struct CvMoments
+{
+    double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /**< spatial moments */
+    double  mu20, mu11, mu02, mu30, mu21, mu12, mu03; /**< central moments */
+    double  inv_sqrt_m00; /**< m00 != 0 ? 1/sqrt(m00) : 0 */
+
+#ifdef __cplusplus
+    CvMoments(){}
+    CvMoments(const cv::Moments& m)
+    {
+        m00 = m.m00; m10 = m.m10; m01 = m.m01;
+        m20 = m.m20; m11 = m.m11; m02 = m.m02;
+        m30 = m.m30; m21 = m.m21; m12 = m.m12; m03 = m.m03;
+        mu20 = m.mu20; mu11 = m.mu11; mu02 = m.mu02;
+        mu30 = m.mu30; mu21 = m.mu21; mu12 = m.mu12; mu03 = m.mu03;
+        double am00 = std::abs(m.m00);
+        inv_sqrt_m00 = am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0;
+    }
+    operator cv::Moments() const
+    {
+        return cv::Moments(m00, m10, m01, m20, m11, m02, m30, m21, m12, m03);
+    }
+#endif
+}
+CvMoments;
+
+/** Hu invariants */
+typedef struct CvHuMoments
+{
+    double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /**< Hu invariants */
+}
+CvHuMoments;
+
+/** Template matching methods */
+enum
+{
+    CV_TM_SQDIFF        =0,
+    CV_TM_SQDIFF_NORMED =1,
+    CV_TM_CCORR         =2,
+    CV_TM_CCORR_NORMED  =3,
+    CV_TM_CCOEFF        =4,
+    CV_TM_CCOEFF_NORMED =5
+};
+
+typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param );
+
+/** Contour retrieval modes */
+enum
+{
+    CV_RETR_EXTERNAL=0,
+    CV_RETR_LIST=1,
+    CV_RETR_CCOMP=2,
+    CV_RETR_TREE=3,
+    CV_RETR_FLOODFILL=4
+};
+
+/** Contour approximation methods */
+enum
+{
+    CV_CHAIN_CODE=0,
+    CV_CHAIN_APPROX_NONE=1,
+    CV_CHAIN_APPROX_SIMPLE=2,
+    CV_CHAIN_APPROX_TC89_L1=3,
+    CV_CHAIN_APPROX_TC89_KCOS=4,
+    CV_LINK_RUNS=5
+};
+
+/*
+Internal structure that is used for sequential retrieving contours from the image.
+It supports both hierarchical and plane variants of Suzuki algorithm.
+*/
+typedef struct _CvContourScanner* CvContourScanner;
+
+/** Freeman chain reader state */
+typedef struct CvChainPtReader
+{
+    CV_SEQ_READER_FIELDS()
+    char      code;
+    CvPoint   pt;
+    schar     deltas[8][2];
+}
+CvChainPtReader;
+
+/** initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
+#define  CV_INIT_3X3_DELTAS( deltas, step, nch )            \
+    ((deltas)[0] =  (nch),  (deltas)[1] = -(step) + (nch),  \
+     (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch),  \
+     (deltas)[4] = -(nch),  (deltas)[5] =  (step) - (nch),  \
+     (deltas)[6] =  (step), (deltas)[7] =  (step) + (nch))
+
+
+/** Contour approximation algorithms */
+enum
+{
+    CV_POLY_APPROX_DP = 0
+};
+
+/** @brief Shape matching methods
+
+\f$A\f$ denotes object1,\f$B\f$ denotes object2
+
+\f$\begin{array}{l} m^A_i =  \mathrm{sign} (h^A_i)  \cdot \log{h^A_i} \\ m^B_i =  \mathrm{sign} (h^B_i)  \cdot \log{h^B_i} \end{array}\f$
+
+and \f$h^A_i, h^B_i\f$ are the Hu moments of \f$A\f$ and \f$B\f$ , respectively.
+*/
+enum ShapeMatchModes
+{
+    CV_CONTOURS_MATCH_I1  =1, //!< \f[I_1(A,B) =  \sum _{i=1...7}  \left |  \frac{1}{m^A_i} -  \frac{1}{m^B_i} \right |\f]
+    CV_CONTOURS_MATCH_I2  =2, //!< \f[I_2(A,B) =  \sum _{i=1...7}  \left | m^A_i - m^B_i  \right |\f]
+    CV_CONTOURS_MATCH_I3  =3  //!< \f[I_3(A,B) =  \max _{i=1...7}  \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f]
+};
+
+/** Shape orientation */
+enum
+{
+    CV_CLOCKWISE         =1,
+    CV_COUNTER_CLOCKWISE =2
+};
+
+
+/** Convexity defect */
+typedef struct CvConvexityDefect
+{
+    CvPoint* start; /**< point of the contour where the defect begins */
+    CvPoint* end; /**< point of the contour where the defect ends */
+    CvPoint* depth_point; /**< the farthest from the convex hull point within the defect */
+    float depth; /**< distance between the farthest point and the convex hull */
+} CvConvexityDefect;
+
+
+/** Histogram comparison methods */
+enum
+{
+    CV_COMP_CORREL        =0,
+    CV_COMP_CHISQR        =1,
+    CV_COMP_INTERSECT     =2,
+    CV_COMP_BHATTACHARYYA =3,
+    CV_COMP_HELLINGER     =CV_COMP_BHATTACHARYYA,
+    CV_COMP_CHISQR_ALT    =4,
+    CV_COMP_KL_DIV        =5
+};
+
+/** Mask size for distance transform */
+enum
+{
+    CV_DIST_MASK_3   =3,
+    CV_DIST_MASK_5   =5,
+    CV_DIST_MASK_PRECISE =0
+};
+
+/** Content of output label array: connected components or pixels */
+enum
+{
+  CV_DIST_LABEL_CCOMP = 0,
+  CV_DIST_LABEL_PIXEL = 1
+};
+
+/** Distance types for Distance Transform and M-estimators */
+enum
+{
+    CV_DIST_USER    =-1,  /**< User defined distance */
+    CV_DIST_L1      =1,   /**< distance = |x1-x2| + |y1-y2| */
+    CV_DIST_L2      =2,   /**< the simple euclidean distance */
+    CV_DIST_C       =3,   /**< distance = max(|x1-x2|,|y1-y2|) */
+    CV_DIST_L12     =4,   /**< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */
+    CV_DIST_FAIR    =5,   /**< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */
+    CV_DIST_WELSCH  =6,   /**< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */
+    CV_DIST_HUBER   =7    /**< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
+};
+
+
+/** Threshold types */
+enum
+{
+    CV_THRESH_BINARY      =0,  /**< value = value > threshold ? max_value : 0       */
+    CV_THRESH_BINARY_INV  =1,  /**< value = value > threshold ? 0 : max_value       */
+    CV_THRESH_TRUNC       =2,  /**< value = value > threshold ? threshold : value   */
+    CV_THRESH_TOZERO      =3,  /**< value = value > threshold ? value : 0           */
+    CV_THRESH_TOZERO_INV  =4,  /**< value = value > threshold ? 0 : value           */
+    CV_THRESH_MASK        =7,
+    CV_THRESH_OTSU        =8, /**< use Otsu algorithm to choose the optimal threshold value;
+                                 combine the flag with one of the above CV_THRESH_* values */
+    CV_THRESH_TRIANGLE    =16  /**< use Triangle algorithm to choose the optimal threshold value;
+                                 combine the flag with one of the above CV_THRESH_* values, but not
+                                 with CV_THRESH_OTSU */
+};
+
+/** Adaptive threshold methods */
+enum
+{
+    CV_ADAPTIVE_THRESH_MEAN_C  =0,
+    CV_ADAPTIVE_THRESH_GAUSSIAN_C  =1
+};
+
+/** FloodFill flags */
+enum
+{
+    CV_FLOODFILL_FIXED_RANGE =(1 << 16),
+    CV_FLOODFILL_MASK_ONLY   =(1 << 17)
+};
+
+
+/** Canny edge detector flags */
+enum
+{
+    CV_CANNY_L2_GRADIENT  =(1 << 31)
+};
+
+/** Variants of a Hough transform */
+enum
+{
+    CV_HOUGH_STANDARD =0,
+    CV_HOUGH_PROBABILISTIC =1,
+    CV_HOUGH_MULTI_SCALE =2,
+    CV_HOUGH_GRADIENT =3
+};
+
+
+/* Fast search data structures  */
+struct CvFeatureTree;
+struct CvLSH;
+struct CvLSHOperations;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/ml.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/ml.hpp
new file mode 100644
index 0000000..862f3f9
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/ml.hpp
@@ -0,0 +1,1505 @@
+/*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, Intel Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Copyright (C) 2014, Itseez 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*/
+
+#ifndef __OPENCV_ML_HPP__
+#define __OPENCV_ML_HPP__
+
+#ifdef __cplusplus
+#  include "opencv2/core.hpp"
+#endif
+
+#ifdef __cplusplus
+
+#include <float.h>
+#include <map>
+#include <iostream>
+
+/**
+  @defgroup ml Machine Learning
+
+  The Machine Learning Library (MLL) is a set of classes and functions for statistical
+  classification, regression, and clustering of data.
+
+  Most of the classification and regression algorithms are implemented as C++ classes. As the
+  algorithms have different sets of features (like an ability to handle missing measurements or
+  categorical input variables), there is a little common ground between the classes. This common
+  ground is defined by the class cv::ml::StatModel that all the other ML classes are derived from.
+
+  See detailed overview here: @ref ml_intro.
+ */
+
+namespace cv
+{
+
+namespace ml
+{
+
+//! @addtogroup ml
+//! @{
+
+/** @brief Variable types */
+enum VariableTypes
+{
+    VAR_NUMERICAL    =0, //!< same as VAR_ORDERED
+    VAR_ORDERED      =0, //!< ordered variables
+    VAR_CATEGORICAL  =1  //!< categorical variables
+};
+
+/** @brief %Error types */
+enum ErrorTypes
+{
+    TEST_ERROR = 0,
+    TRAIN_ERROR = 1
+};
+
+/** @brief Sample types */
+enum SampleTypes
+{
+    ROW_SAMPLE = 0, //!< each training sample is a row of samples
+    COL_SAMPLE = 1  //!< each training sample occupies a column of samples
+};
+
+/** @brief The structure represents the logarithmic grid range of statmodel parameters.
+
+It is used for optimizing statmodel accuracy by varying model parameters, the accuracy estimate
+being computed by cross-validation.
+ */
+class CV_EXPORTS ParamGrid
+{
+public:
+    /** @brief Default constructor */
+    ParamGrid();
+    /** @brief Constructor with parameters */
+    ParamGrid(double _minVal, double _maxVal, double _logStep);
+
+    double minVal; //!< Minimum value of the statmodel parameter. Default value is 0.
+    double maxVal; //!< Maximum value of the statmodel parameter. Default value is 0.
+    /** @brief Logarithmic step for iterating the statmodel parameter.
+
+    The grid determines the following iteration sequence of the statmodel parameter values:
+    \f[(minVal, minVal*step, minVal*{step}^2, \dots,  minVal*{logStep}^n),\f]
+    where \f$n\f$ is the maximal index satisfying
+    \f[\texttt{minVal} * \texttt{logStep} ^n <  \texttt{maxVal}\f]
+    The grid is logarithmic, so logStep must always be greater then 1. Default value is 1.
+    */
+    double logStep;
+};
+
+/** @brief Class encapsulating training data.
+
+Please note that the class only specifies the interface of training data, but not implementation.
+All the statistical model classes in _ml_ module accepts Ptr\<TrainData\> as parameter. In other
+words, you can create your own class derived from TrainData and pass smart pointer to the instance
+of this class into StatModel::train.
+
+@sa @ref ml_intro_data
+ */
+class CV_EXPORTS_W TrainData
+{
+public:
+    static inline float missingValue() { return FLT_MAX; }
+    virtual ~TrainData();
+
+    CV_WRAP virtual int getLayout() const = 0;
+    CV_WRAP virtual int getNTrainSamples() const = 0;
+    CV_WRAP virtual int getNTestSamples() const = 0;
+    CV_WRAP virtual int getNSamples() const = 0;
+    CV_WRAP virtual int getNVars() const = 0;
+    CV_WRAP virtual int getNAllVars() const = 0;
+
+    CV_WRAP virtual void getSample(InputArray varIdx, int sidx, float* buf) const = 0;
+    CV_WRAP virtual Mat getSamples() const = 0;
+    CV_WRAP virtual Mat getMissing() const = 0;
+
+    /** @brief Returns matrix of train samples
+
+    @param layout The requested layout. If it's different from the initial one, the matrix is
+        transposed. See ml::SampleTypes.
+    @param compressSamples if true, the function returns only the training samples (specified by
+        sampleIdx)
+    @param compressVars if true, the function returns the shorter training samples, containing only
+        the active variables.
+
+    In current implementation the function tries to avoid physical data copying and returns the
+    matrix stored inside TrainData (unless the transposition or compression is needed).
+     */
+    CV_WRAP virtual Mat getTrainSamples(int layout=ROW_SAMPLE,
+                                bool compressSamples=true,
+                                bool compressVars=true) const = 0;
+
+    /** @brief Returns the vector of responses
+
+    The function returns ordered or the original categorical responses. Usually it's used in
+    regression algorithms.
+     */
+    CV_WRAP virtual Mat getTrainResponses() const = 0;
+
+    /** @brief Returns the vector of normalized categorical responses
+
+    The function returns vector of responses. Each response is integer from `0` to `<number of
+    classes>-1`. The actual label value can be retrieved then from the class label vector, see
+    TrainData::getClassLabels.
+     */
+    CV_WRAP virtual Mat getTrainNormCatResponses() const = 0;
+    CV_WRAP virtual Mat getTestResponses() const = 0;
+    CV_WRAP virtual Mat getTestNormCatResponses() const = 0;
+    CV_WRAP virtual Mat getResponses() const = 0;
+    CV_WRAP virtual Mat getNormCatResponses() const = 0;
+    CV_WRAP virtual Mat getSampleWeights() const = 0;
+    CV_WRAP virtual Mat getTrainSampleWeights() const = 0;
+    CV_WRAP virtual Mat getTestSampleWeights() const = 0;
+    CV_WRAP virtual Mat getVarIdx() const = 0;
+    CV_WRAP virtual Mat getVarType() const = 0;
+    CV_WRAP virtual int getResponseType() const = 0;
+    CV_WRAP virtual Mat getTrainSampleIdx() const = 0;
+    CV_WRAP virtual Mat getTestSampleIdx() const = 0;
+    CV_WRAP virtual void getValues(int vi, InputArray sidx, float* values) const = 0;
+    virtual void getNormCatValues(int vi, InputArray sidx, int* values) const = 0;
+    CV_WRAP virtual Mat getDefaultSubstValues() const = 0;
+
+    CV_WRAP virtual int getCatCount(int vi) const = 0;
+
+    /** @brief Returns the vector of class labels
+
+    The function returns vector of unique labels occurred in the responses.
+     */
+    CV_WRAP virtual Mat getClassLabels() const = 0;
+
+    CV_WRAP virtual Mat getCatOfs() const = 0;
+    CV_WRAP virtual Mat getCatMap() const = 0;
+
+    /** @brief Splits the training data into the training and test parts
+    @sa TrainData::setTrainTestSplitRatio
+     */
+    CV_WRAP virtual void setTrainTestSplit(int count, bool shuffle=true) = 0;
+
+    /** @brief Splits the training data into the training and test parts
+
+    The function selects a subset of specified relative size and then returns it as the training
+    set. If the function is not called, all the data is used for training. Please, note that for
+    each of TrainData::getTrain\* there is corresponding TrainData::getTest\*, so that the test
+    subset can be retrieved and processed as well.
+    @sa TrainData::setTrainTestSplit
+     */
+    CV_WRAP virtual void setTrainTestSplitRatio(double ratio, bool shuffle=true) = 0;
+    CV_WRAP virtual void shuffleTrainTest() = 0;
+
+    CV_WRAP static Mat getSubVector(const Mat& vec, const Mat& idx);
+
+    /** @brief Reads the dataset from a .csv file and returns the ready-to-use training data.
+
+    @param filename The input file name
+    @param headerLineCount The number of lines in the beginning to skip; besides the header, the
+        function also skips empty lines and lines staring with `#`
+    @param responseStartIdx Index of the first output variable. If -1, the function considers the
+        last variable as the response
+    @param responseEndIdx Index of the last output variable + 1. If -1, then there is single
+        response variable at responseStartIdx.
+    @param varTypeSpec The optional text string that specifies the variables' types. It has the
+        format `ord[n1-n2,n3,n4-n5,...]cat[n6,n7-n8,...]`. That is, variables from `n1 to n2`
+        (inclusive range), `n3`, `n4 to n5` ... are considered ordered and `n6`, `n7 to n8` ... are
+        considered as categorical. The range `[n1..n2] + [n3] + [n4..n5] + ... + [n6] + [n7..n8]`
+        should cover all the variables. If varTypeSpec is not specified, then algorithm uses the
+        following rules:
+        - all input variables are considered ordered by default. If some column contains has non-
+          numerical values, e.g. 'apple', 'pear', 'apple', 'apple', 'mango', the corresponding
+          variable is considered categorical.
+        - if there are several output variables, they are all considered as ordered. Error is
+          reported when non-numerical values are used.
+        - if there is a single output variable, then if its values are non-numerical or are all
+          integers, then it's considered categorical. Otherwise, it's considered ordered.
+    @param delimiter The character used to separate values in each line.
+    @param missch The character used to specify missing measurements. It should not be a digit.
+        Although it's a non-numerical value, it surely does not affect the decision of whether the
+        variable ordered or categorical.
+    @note If the dataset only contains input variables and no responses, use responseStartIdx = -2
+        and responseEndIdx = 0. The output variables vector will just contain zeros.
+     */
+    static Ptr<TrainData> loadFromCSV(const String& filename,
+                                      int headerLineCount,
+                                      int responseStartIdx=-1,
+                                      int responseEndIdx=-1,
+                                      const String& varTypeSpec=String(),
+                                      char delimiter=',',
+                                      char missch='?');
+
+    /** @brief Creates training data from in-memory arrays.
+
+    @param samples matrix of samples. It should have CV_32F type.
+    @param layout see ml::SampleTypes.
+    @param responses matrix of responses. If the responses are scalar, they should be stored as a
+        single row or as a single column. The matrix should have type CV_32F or CV_32S (in the
+        former case the responses are considered as ordered by default; in the latter case - as
+        categorical)
+    @param varIdx vector specifying which variables to use for training. It can be an integer vector
+        (CV_32S) containing 0-based variable indices or byte vector (CV_8U) containing a mask of
+        active variables.
+    @param sampleIdx vector specifying which samples to use for training. It can be an integer
+        vector (CV_32S) containing 0-based sample indices or byte vector (CV_8U) containing a mask
+        of training samples.
+    @param sampleWeights optional vector with weights for each sample. It should have CV_32F type.
+    @param varType optional vector of type CV_8U and size `<number_of_variables_in_samples> +
+        <number_of_variables_in_responses>`, containing types of each input and output variable. See
+        ml::VariableTypes.
+     */
+    CV_WRAP static Ptr<TrainData> create(InputArray samples, int layout, InputArray responses,
+                                 InputArray varIdx=noArray(), InputArray sampleIdx=noArray(),
+                                 InputArray sampleWeights=noArray(), InputArray varType=noArray());
+};
+
+/** @brief Base class for statistical models in OpenCV ML.
+ */
+class CV_EXPORTS_W StatModel : public Algorithm
+{
+public:
+    /** Predict options */
+    enum Flags {
+        UPDATE_MODEL = 1,
+        RAW_OUTPUT=1, //!< makes the method return the raw results (the sum), not the class label
+        COMPRESSED_INPUT=2,
+        PREPROCESSED_INPUT=4
+    };
+
+    /** @brief Returns the number of variables in training samples */
+    CV_WRAP virtual int getVarCount() const = 0;
+
+    CV_WRAP virtual bool empty() const;
+
+    /** @brief Returns true if the model is trained */
+    CV_WRAP virtual bool isTrained() const = 0;
+    /** @brief Returns true if the model is classifier */
+    CV_WRAP virtual bool isClassifier() const = 0;
+
+    /** @brief Trains the statistical model
+
+    @param trainData training data that can be loaded from file using TrainData::loadFromCSV or
+        created with TrainData::create.
+    @param flags optional flags, depending on the model. Some of the models can be updated with the
+        new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP).
+     */
+    CV_WRAP virtual bool train( const Ptr<TrainData>& trainData, int flags=0 );
+
+    /** @brief Trains the statistical model
+
+    @param samples training samples
+    @param layout See ml::SampleTypes.
+    @param responses vector of responses associated with the training samples.
+    */
+    CV_WRAP virtual bool train( InputArray samples, int layout, InputArray responses );
+
+    /** @brief Computes error on the training or test dataset
+
+    @param data the training data
+    @param test if true, the error is computed over the test subset of the data, otherwise it's
+        computed over the training subset of the data. Please note that if you loaded a completely
+        different dataset to evaluate already trained classifier, you will probably want not to set
+        the test subset at all with TrainData::setTrainTestSplitRatio and specify test=false, so
+        that the error is computed for the whole new set. Yes, this sounds a bit confusing.
+    @param resp the optional output responses.
+
+    The method uses StatModel::predict to compute the error. For regression models the error is
+    computed as RMS, for classifiers - as a percent of missclassified samples (0%-100%).
+     */
+    CV_WRAP virtual float calcError( const Ptr<TrainData>& data, bool test, OutputArray resp ) const;
+
+    /** @brief Predicts response(s) for the provided sample(s)
+
+    @param samples The input samples, floating-point matrix
+    @param results The optional output matrix of results.
+    @param flags The optional flags, model-dependent. See cv::ml::StatModel::Flags.
+     */
+    CV_WRAP virtual float predict( InputArray samples, OutputArray results=noArray(), int flags=0 ) const = 0;
+
+    /** @brief Create and train model with default parameters
+
+    The class must implement static `create()` method with no parameters or with all default parameter values
+    */
+    template<typename _Tp> static Ptr<_Tp> train(const Ptr<TrainData>& data, int flags=0)
+    {
+        Ptr<_Tp> model = _Tp::create();
+        return !model.empty() && model->train(data, flags) ? model : Ptr<_Tp>();
+    }
+};
+
+/****************************************************************************************\
+*                                 Normal Bayes Classifier                                *
+\****************************************************************************************/
+
+/** @brief Bayes classifier for normally distributed data.
+
+@sa @ref ml_intro_bayes
+ */
+class CV_EXPORTS_W NormalBayesClassifier : public StatModel
+{
+public:
+    /** @brief Predicts the response for sample(s).
+
+    The method estimates the most probable classes for input vectors. Input vectors (one or more)
+    are stored as rows of the matrix inputs. In case of multiple input vectors, there should be one
+    output vector outputs. The predicted class for a single input vector is returned by the method.
+    The vector outputProbs contains the output probabilities corresponding to each element of
+    result.
+     */
+    CV_WRAP virtual float predictProb( InputArray inputs, OutputArray outputs,
+                               OutputArray outputProbs, int flags=0 ) const = 0;
+
+    /** Creates empty model
+    Use StatModel::train to train the model after creation. */
+    CV_WRAP static Ptr<NormalBayesClassifier> create();
+};
+
+/****************************************************************************************\
+*                          K-Nearest Neighbour Classifier                                *
+\****************************************************************************************/
+
+/** @brief The class implements K-Nearest Neighbors model
+
+@sa @ref ml_intro_knn
+ */
+class CV_EXPORTS_W KNearest : public StatModel
+{
+public:
+
+    /** Default number of neighbors to use in predict method. */
+    /** @see setDefaultK */
+    CV_WRAP virtual int getDefaultK() const = 0;
+    /** @copybrief getDefaultK @see getDefaultK */
+    CV_WRAP virtual void setDefaultK(int val) = 0;
+
+    /** Whether classification or regression model should be trained. */
+    /** @see setIsClassifier */
+    CV_WRAP virtual bool getIsClassifier() const = 0;
+    /** @copybrief getIsClassifier @see getIsClassifier */
+    CV_WRAP virtual void setIsClassifier(bool val) = 0;
+
+    /** Parameter for KDTree implementation. */
+    /** @see setEmax */
+    CV_WRAP virtual int getEmax() const = 0;
+    /** @copybrief getEmax @see getEmax */
+    CV_WRAP virtual void setEmax(int val) = 0;
+
+    /** %Algorithm type, one of KNearest::Types. */
+    /** @see setAlgorithmType */
+    CV_WRAP virtual int getAlgorithmType() const = 0;
+    /** @copybrief getAlgorithmType @see getAlgorithmType */
+    CV_WRAP virtual void setAlgorithmType(int val) = 0;
+
+    /** @brief Finds the neighbors and predicts responses for input vectors.
+
+    @param samples Input samples stored by rows. It is a single-precision floating-point matrix of
+        `<number_of_samples> * k` size.
+    @param k Number of used nearest neighbors. Should be greater than 1.
+    @param results Vector with results of prediction (regression or classification) for each input
+        sample. It is a single-precision floating-point vector with `<number_of_samples>` elements.
+    @param neighborResponses Optional output values for corresponding neighbors. It is a single-
+        precision floating-point matrix of `<number_of_samples> * k` size.
+    @param dist Optional output distances from the input vectors to the corresponding neighbors. It
+        is a single-precision floating-point matrix of `<number_of_samples> * k` size.
+
+    For each input vector (a row of the matrix samples), the method finds the k nearest neighbors.
+    In case of regression, the predicted result is a mean value of the particular vector's neighbor
+    responses. In case of classification, the class is determined by voting.
+
+    For each input vector, the neighbors are sorted by their distances to the vector.
+
+    In case of C++ interface you can use output pointers to empty matrices and the function will
+    allocate memory itself.
+
+    If only a single input vector is passed, all output matrices are optional and the predicted
+    value is returned by the method.
+
+    The function is parallelized with the TBB library.
+     */
+    CV_WRAP virtual float findNearest( InputArray samples, int k,
+                               OutputArray results,
+                               OutputArray neighborResponses=noArray(),
+                               OutputArray dist=noArray() ) const = 0;
+
+    /** @brief Implementations of KNearest algorithm
+       */
+    enum Types
+    {
+        BRUTE_FORCE=1,
+        KDTREE=2
+    };
+
+    /** @brief Creates the empty model
+
+    The static method creates empty %KNearest classifier. It should be then trained using StatModel::train method.
+     */
+    CV_WRAP static Ptr<KNearest> create();
+};
+
+/****************************************************************************************\
+*                                   Support Vector Machines                              *
+\****************************************************************************************/
+
+/** @brief Support Vector Machines.
+
+@sa @ref ml_intro_svm
+ */
+class CV_EXPORTS_W SVM : public StatModel
+{
+public:
+
+    class CV_EXPORTS Kernel : public Algorithm
+    {
+    public:
+        virtual int getType() const = 0;
+        virtual void calc( int vcount, int n, const float* vecs, const float* another, float* results ) = 0;
+    };
+
+    /** Type of a %SVM formulation.
+    See SVM::Types. Default value is SVM::C_SVC. */
+    /** @see setType */
+    CV_WRAP virtual int getType() const = 0;
+    /** @copybrief getType @see getType */
+    CV_WRAP virtual void setType(int val) = 0;
+
+    /** Parameter \f$\gamma\f$ of a kernel function.
+    For SVM::POLY, SVM::RBF, SVM::SIGMOID or SVM::CHI2. Default value is 1. */
+    /** @see setGamma */
+    CV_WRAP virtual double getGamma() const = 0;
+    /** @copybrief getGamma @see getGamma */
+    CV_WRAP virtual void setGamma(double val) = 0;
+
+    /** Parameter _coef0_ of a kernel function.
+    For SVM::POLY or SVM::SIGMOID. Default value is 0.*/
+    /** @see setCoef0 */
+    CV_WRAP virtual double getCoef0() const = 0;
+    /** @copybrief getCoef0 @see getCoef0 */
+    CV_WRAP virtual void setCoef0(double val) = 0;
+
+    /** Parameter _degree_ of a kernel function.
+    For SVM::POLY. Default value is 0. */
+    /** @see setDegree */
+    CV_WRAP virtual double getDegree() const = 0;
+    /** @copybrief getDegree @see getDegree */
+    CV_WRAP virtual void setDegree(double val) = 0;
+
+    /** Parameter _C_ of a %SVM optimization problem.
+    For SVM::C_SVC, SVM::EPS_SVR or SVM::NU_SVR. Default value is 0. */
+    /** @see setC */
+    CV_WRAP virtual double getC() const = 0;
+    /** @copybrief getC @see getC */
+    CV_WRAP virtual void setC(double val) = 0;
+
+    /** Parameter \f$\nu\f$ of a %SVM optimization problem.
+    For SVM::NU_SVC, SVM::ONE_CLASS or SVM::NU_SVR. Default value is 0. */
+    /** @see setNu */
+    CV_WRAP virtual double getNu() const = 0;
+    /** @copybrief getNu @see getNu */
+    CV_WRAP virtual void setNu(double val) = 0;
+
+    /** Parameter \f$\epsilon\f$ of a %SVM optimization problem.
+    For SVM::EPS_SVR. Default value is 0. */
+    /** @see setP */
+    CV_WRAP virtual double getP() const = 0;
+    /** @copybrief getP @see getP */
+    CV_WRAP virtual void setP(double val) = 0;
+
+    /** Optional weights in the SVM::C_SVC problem, assigned to particular classes.
+    They are multiplied by _C_ so the parameter _C_ of class _i_ becomes `classWeights(i) * C`. Thus
+    these weights affect the misclassification penalty for different classes. The larger weight,
+    the larger penalty on misclassification of data from the corresponding class. Default value is
+    empty Mat. */
+    /** @see setClassWeights */
+    CV_WRAP virtual cv::Mat getClassWeights() const = 0;
+    /** @copybrief getClassWeights @see getClassWeights */
+    CV_WRAP virtual void setClassWeights(const cv::Mat &val) = 0;
+
+    /** Termination criteria of the iterative %SVM training procedure which solves a partial
+    case of constrained quadratic optimization problem.
+    You can specify tolerance and/or the maximum number of iterations. Default value is
+    `TermCriteria( TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, FLT_EPSILON )`; */
+    /** @see setTermCriteria */
+    CV_WRAP virtual cv::TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(const cv::TermCriteria &val) = 0;
+
+    /** Type of a %SVM kernel.
+    See SVM::KernelTypes. Default value is SVM::RBF. */
+    CV_WRAP virtual int getKernelType() const = 0;
+
+    /** Initialize with one of predefined kernels.
+    See SVM::KernelTypes. */
+    CV_WRAP virtual void setKernel(int kernelType) = 0;
+
+    /** Initialize with custom kernel.
+    See SVM::Kernel class for implementation details */
+    virtual void setCustomKernel(const Ptr<Kernel> &_kernel) = 0;
+
+    //! %SVM type
+    enum Types {
+        /** C-Support Vector Classification. n-class classification (n \f$\geq\f$ 2), allows
+        imperfect separation of classes with penalty multiplier C for outliers. */
+        C_SVC=100,
+        /** \f$\nu\f$-Support Vector Classification. n-class classification with possible
+        imperfect separation. Parameter \f$\nu\f$ (in the range 0..1, the larger the value, the smoother
+        the decision boundary) is used instead of C. */
+        NU_SVC=101,
+        /** Distribution Estimation (One-class %SVM). All the training data are from
+        the same class, %SVM builds a boundary that separates the class from the rest of the feature
+        space. */
+        ONE_CLASS=102,
+        /** \f$\epsilon\f$-Support Vector Regression. The distance between feature vectors
+        from the training set and the fitting hyper-plane must be less than p. For outliers the
+        penalty multiplier C is used. */
+        EPS_SVR=103,
+        /** \f$\nu\f$-Support Vector Regression. \f$\nu\f$ is used instead of p.
+        See @cite LibSVM for details. */
+        NU_SVR=104
+    };
+
+    /** @brief %SVM kernel type
+
+    A comparison of different kernels on the following 2D test case with four classes. Four
+    SVM::C_SVC SVMs have been trained (one against rest) with auto_train. Evaluation on three
+    different kernels (SVM::CHI2, SVM::INTER, SVM::RBF). The color depicts the class with max score.
+    Bright means max-score \> 0, dark means max-score \< 0.
+    ![image](pics/SVM_Comparison.png)
+    */
+    enum KernelTypes {
+        /** Returned by SVM::getKernelType in case when custom kernel has been set */
+        CUSTOM=-1,
+        /** Linear kernel. No mapping is done, linear discrimination (or regression) is
+        done in the original feature space. It is the fastest option. \f$K(x_i, x_j) = x_i^T x_j\f$. */
+        LINEAR=0,
+        /** Polynomial kernel:
+        \f$K(x_i, x_j) = (\gamma x_i^T x_j + coef0)^{degree}, \gamma > 0\f$. */
+        POLY=1,
+        /** Radial basis function (RBF), a good choice in most cases.
+        \f$K(x_i, x_j) = e^{-\gamma ||x_i - x_j||^2}, \gamma > 0\f$. */
+        RBF=2,
+        /** Sigmoid kernel: \f$K(x_i, x_j) = \tanh(\gamma x_i^T x_j + coef0)\f$. */
+        SIGMOID=3,
+        /** Exponential Chi2 kernel, similar to the RBF kernel:
+        \f$K(x_i, x_j) = e^{-\gamma \chi^2(x_i,x_j)}, \chi^2(x_i,x_j) = (x_i-x_j)^2/(x_i+x_j), \gamma > 0\f$. */
+        CHI2=4,
+        /** Histogram intersection kernel. A fast kernel. \f$K(x_i, x_j) = min(x_i,x_j)\f$. */
+        INTER=5
+    };
+
+    //! %SVM params type
+    enum ParamTypes {
+        C=0,
+        GAMMA=1,
+        P=2,
+        NU=3,
+        COEF=4,
+        DEGREE=5
+    };
+
+    /** @brief Trains an %SVM with optimal parameters.
+
+    @param data the training data that can be constructed using TrainData::create or
+        TrainData::loadFromCSV.
+    @param kFold Cross-validation parameter. The training set is divided into kFold subsets. One
+        subset is used to test the model, the others form the train set. So, the %SVM algorithm is
+        executed kFold times.
+    @param Cgrid grid for C
+    @param gammaGrid grid for gamma
+    @param pGrid grid for p
+    @param nuGrid grid for nu
+    @param coeffGrid grid for coeff
+    @param degreeGrid grid for degree
+    @param balanced If true and the problem is 2-class classification then the method creates more
+        balanced cross-validation subsets that is proportions between classes in subsets are close
+        to such proportion in the whole train dataset.
+
+    The method trains the %SVM model automatically by choosing the optimal parameters C, gamma, p,
+    nu, coef0, degree. Parameters are considered optimal when the cross-validation
+    estimate of the test set error is minimal.
+
+    If there is no need to optimize a parameter, the corresponding grid step should be set to any
+    value less than or equal to 1. For example, to avoid optimization in gamma, set `gammaGrid.step
+    = 0`, `gammaGrid.minVal`, `gamma_grid.maxVal` as arbitrary numbers. In this case, the value
+    `Gamma` is taken for gamma.
+
+    And, finally, if the optimization in a parameter is required but the corresponding grid is
+    unknown, you may call the function SVM::getDefaultGrid. To generate a grid, for example, for
+    gamma, call `SVM::getDefaultGrid(SVM::GAMMA)`.
+
+    This function works for the classification (SVM::C_SVC or SVM::NU_SVC) as well as for the
+    regression (SVM::EPS_SVR or SVM::NU_SVR). If it is SVM::ONE_CLASS, no optimization is made and
+    the usual %SVM with parameters specified in params is executed.
+     */
+    virtual bool trainAuto( const Ptr<TrainData>& data, int kFold = 10,
+                    ParamGrid Cgrid = SVM::getDefaultGrid(SVM::C),
+                    ParamGrid gammaGrid  = SVM::getDefaultGrid(SVM::GAMMA),
+                    ParamGrid pGrid      = SVM::getDefaultGrid(SVM::P),
+                    ParamGrid nuGrid     = SVM::getDefaultGrid(SVM::NU),
+                    ParamGrid coeffGrid  = SVM::getDefaultGrid(SVM::COEF),
+                    ParamGrid degreeGrid = SVM::getDefaultGrid(SVM::DEGREE),
+                    bool balanced=false) = 0;
+
+    /** @brief Retrieves all the support vectors
+
+    The method returns all the support vectors as a floating-point matrix, where support vectors are
+    stored as matrix rows.
+     */
+    CV_WRAP virtual Mat getSupportVectors() const = 0;
+
+    /** @brief Retrieves all the uncompressed support vectors of a linear %SVM
+
+    The method returns all the uncompressed support vectors of a linear %SVM that the compressed
+    support vector, used for prediction, was derived from. They are returned in a floating-point
+    matrix, where the support vectors are stored as matrix rows.
+     */
+    CV_WRAP Mat getUncompressedSupportVectors() const;
+
+    /** @brief Retrieves the decision function
+
+    @param i the index of the decision function. If the problem solved is regression, 1-class or
+        2-class classification, then there will be just one decision function and the index should
+        always be 0. Otherwise, in the case of N-class classification, there will be \f$N(N-1)/2\f$
+        decision functions.
+    @param alpha the optional output vector for weights, corresponding to different support vectors.
+        In the case of linear %SVM all the alpha's will be 1's.
+    @param svidx the optional output vector of indices of support vectors within the matrix of
+        support vectors (which can be retrieved by SVM::getSupportVectors). In the case of linear
+        %SVM each decision function consists of a single "compressed" support vector.
+
+    The method returns rho parameter of the decision function, a scalar subtracted from the weighted
+    sum of kernel responses.
+     */
+    CV_WRAP virtual double getDecisionFunction(int i, OutputArray alpha, OutputArray svidx) const = 0;
+
+    /** @brief Generates a grid for %SVM parameters.
+
+    @param param_id %SVM parameters IDs that must be one of the SVM::ParamTypes. The grid is
+    generated for the parameter with this ID.
+
+    The function generates a grid for the specified parameter of the %SVM algorithm. The grid may be
+    passed to the function SVM::trainAuto.
+     */
+    static ParamGrid getDefaultGrid( int param_id );
+
+    /** Creates empty model.
+    Use StatModel::train to train the model. Since %SVM has several parameters, you may want to
+    find the best parameters for your problem, it can be done with SVM::trainAuto. */
+    CV_WRAP static Ptr<SVM> create();
+};
+
+/****************************************************************************************\
+*                              Expectation - Maximization                                *
+\****************************************************************************************/
+
+/** @brief The class implements the Expectation Maximization algorithm.
+
+@sa @ref ml_intro_em
+ */
+class CV_EXPORTS_W EM : public StatModel
+{
+public:
+    //! Type of covariation matrices
+    enum Types {
+        /** A scaled identity matrix \f$\mu_k * I\f$. There is the only
+        parameter \f$\mu_k\f$ to be estimated for each matrix. The option may be used in special cases,
+        when the constraint is relevant, or as a first step in the optimization (for example in case
+        when the data is preprocessed with PCA). The results of such preliminary estimation may be
+        passed again to the optimization procedure, this time with
+        covMatType=EM::COV_MAT_DIAGONAL. */
+        COV_MAT_SPHERICAL=0,
+        /** A diagonal matrix with positive diagonal elements. The number of
+        free parameters is d for each matrix. This is most commonly used option yielding good
+        estimation results. */
+        COV_MAT_DIAGONAL=1,
+        /** A symmetric positively defined matrix. The number of free
+        parameters in each matrix is about \f$d^2/2\f$. It is not recommended to use this option, unless
+        there is pretty accurate initial estimation of the parameters and/or a huge number of
+        training samples. */
+        COV_MAT_GENERIC=2,
+        COV_MAT_DEFAULT=COV_MAT_DIAGONAL
+    };
+
+    //! Default parameters
+    enum {DEFAULT_NCLUSTERS=5, DEFAULT_MAX_ITERS=100};
+
+    //! The initial step
+    enum {START_E_STEP=1, START_M_STEP=2, START_AUTO_STEP=0};
+
+    /** The number of mixture components in the Gaussian mixture model.
+    Default value of the parameter is EM::DEFAULT_NCLUSTERS=5. Some of %EM implementation could
+    determine the optimal number of mixtures within a specified value range, but that is not the
+    case in ML yet. */
+    /** @see setClustersNumber */
+    CV_WRAP virtual int getClustersNumber() const = 0;
+    /** @copybrief getClustersNumber @see getClustersNumber */
+    CV_WRAP virtual void setClustersNumber(int val) = 0;
+
+    /** Constraint on covariance matrices which defines type of matrices.
+    See EM::Types. */
+    /** @see setCovarianceMatrixType */
+    CV_WRAP virtual int getCovarianceMatrixType() const = 0;
+    /** @copybrief getCovarianceMatrixType @see getCovarianceMatrixType */
+    CV_WRAP virtual void setCovarianceMatrixType(int val) = 0;
+
+    /** The termination criteria of the %EM algorithm.
+    The %EM algorithm can be terminated by the number of iterations termCrit.maxCount (number of
+    M-steps) or when relative change of likelihood logarithm is less than termCrit.epsilon. Default
+    maximum number of iterations is EM::DEFAULT_MAX_ITERS=100. */
+    /** @see setTermCriteria */
+    CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(const TermCriteria &val) = 0;
+
+    /** @brief Returns weights of the mixtures
+
+    Returns vector with the number of elements equal to the number of mixtures.
+     */
+    CV_WRAP virtual Mat getWeights() const = 0;
+    /** @brief Returns the cluster centers (means of the Gaussian mixture)
+
+    Returns matrix with the number of rows equal to the number of mixtures and number of columns
+    equal to the space dimensionality.
+     */
+    CV_WRAP virtual Mat getMeans() const = 0;
+    /** @brief Returns covariation matrices
+
+    Returns vector of covariation matrices. Number of matrices is the number of gaussian mixtures,
+    each matrix is a square floating-point matrix NxN, where N is the space dimensionality.
+     */
+    CV_WRAP virtual void getCovs(CV_OUT std::vector<Mat>& covs) const = 0;
+
+    /** @brief Returns a likelihood logarithm value and an index of the most probable mixture component
+    for the given sample.
+
+    @param sample A sample for classification. It should be a one-channel matrix of
+        \f$1 \times dims\f$ or \f$dims \times 1\f$ size.
+    @param probs Optional output matrix that contains posterior probabilities of each component
+        given the sample. It has \f$1 \times nclusters\f$ size and CV_64FC1 type.
+
+    The method returns a two-element double vector. Zero element is a likelihood logarithm value for
+    the sample. First element is an index of the most probable mixture component for the given
+    sample.
+     */
+    CV_WRAP virtual Vec2d predict2(InputArray sample, OutputArray probs) const = 0;
+
+    /** @brief Estimate the Gaussian mixture parameters from a samples set.
+
+    This variation starts with Expectation step. Initial values of the model parameters will be
+    estimated by the k-means algorithm.
+
+    Unlike many of the ML models, %EM is an unsupervised learning algorithm and it does not take
+    responses (class labels or function values) as input. Instead, it computes the *Maximum
+    Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the
+    parameters inside the structure: \f$p_{i,k}\f$ in probs, \f$a_k\f$ in means , \f$S_k\f$ in
+    covs[k], \f$\pi_k\f$ in weights , and optionally computes the output "class label" for each
+    sample: \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most
+    probable mixture component for each sample).
+
+    The trained model can be used further for prediction, just like any other classifier. The
+    trained model is similar to the NormalBayesClassifier.
+
+    @param samples Samples from which the Gaussian mixture model will be estimated. It should be a
+        one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
+        it will be converted to the inner matrix of such type for the further computing.
+    @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for
+        each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.
+    @param labels The optional output "class label" for each sample:
+        \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
+        mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.
+    @param probs The optional output matrix that contains posterior probabilities of each Gaussian
+        mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
+        CV_64FC1 type.
+     */
+    CV_WRAP virtual bool trainEM(InputArray samples,
+                         OutputArray logLikelihoods=noArray(),
+                         OutputArray labels=noArray(),
+                         OutputArray probs=noArray()) = 0;
+
+    /** @brief Estimate the Gaussian mixture parameters from a samples set.
+
+    This variation starts with Expectation step. You need to provide initial means \f$a_k\f$ of
+    mixture components. Optionally you can pass initial weights \f$\pi_k\f$ and covariance matrices
+    \f$S_k\f$ of mixture components.
+
+    @param samples Samples from which the Gaussian mixture model will be estimated. It should be a
+        one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
+        it will be converted to the inner matrix of such type for the further computing.
+    @param means0 Initial means \f$a_k\f$ of mixture components. It is a one-channel matrix of
+        \f$nclusters \times dims\f$ size. If the matrix does not have CV_64F type it will be
+        converted to the inner matrix of such type for the further computing.
+    @param covs0 The vector of initial covariance matrices \f$S_k\f$ of mixture components. Each of
+        covariance matrices is a one-channel matrix of \f$dims \times dims\f$ size. If the matrices
+        do not have CV_64F type they will be converted to the inner matrices of such type for the
+        further computing.
+    @param weights0 Initial weights \f$\pi_k\f$ of mixture components. It should be a one-channel
+        floating-point matrix with \f$1 \times nclusters\f$ or \f$nclusters \times 1\f$ size.
+    @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for
+        each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.
+    @param labels The optional output "class label" for each sample:
+        \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
+        mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.
+    @param probs The optional output matrix that contains posterior probabilities of each Gaussian
+        mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
+        CV_64FC1 type.
+    */
+    CV_WRAP virtual bool trainE(InputArray samples, InputArray means0,
+                        InputArray covs0=noArray(),
+                        InputArray weights0=noArray(),
+                        OutputArray logLikelihoods=noArray(),
+                        OutputArray labels=noArray(),
+                        OutputArray probs=noArray()) = 0;
+
+    /** @brief Estimate the Gaussian mixture parameters from a samples set.
+
+    This variation starts with Maximization step. You need to provide initial probabilities
+    \f$p_{i,k}\f$ to use this option.
+
+    @param samples Samples from which the Gaussian mixture model will be estimated. It should be a
+        one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type
+        it will be converted to the inner matrix of such type for the further computing.
+    @param probs0
+    @param logLikelihoods The optional output matrix that contains a likelihood logarithm value for
+        each sample. It has \f$nsamples \times 1\f$ size and CV_64FC1 type.
+    @param labels The optional output "class label" for each sample:
+        \f$\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\f$ (indices of the most probable
+        mixture component for each sample). It has \f$nsamples \times 1\f$ size and CV_32SC1 type.
+    @param probs The optional output matrix that contains posterior probabilities of each Gaussian
+        mixture component given the each sample. It has \f$nsamples \times nclusters\f$ size and
+        CV_64FC1 type.
+    */
+    CV_WRAP virtual bool trainM(InputArray samples, InputArray probs0,
+                        OutputArray logLikelihoods=noArray(),
+                        OutputArray labels=noArray(),
+                        OutputArray probs=noArray()) = 0;
+
+    /** Creates empty %EM model.
+    The model should be trained then using StatModel::train(traindata, flags) method. Alternatively, you
+    can use one of the EM::train\* methods or load it from file using Algorithm::load\<EM\>(filename).
+     */
+    CV_WRAP static Ptr<EM> create();
+};
+
+/****************************************************************************************\
+*                                      Decision Tree                                     *
+\****************************************************************************************/
+
+/** @brief The class represents a single decision tree or a collection of decision trees.
+
+The current public interface of the class allows user to train only a single decision tree, however
+the class is capable of storing multiple decision trees and using them for prediction (by summing
+responses or using a voting schemes), and the derived from DTrees classes (such as RTrees and Boost)
+use this capability to implement decision tree ensembles.
+
+@sa @ref ml_intro_trees
+*/
+class CV_EXPORTS_W DTrees : public StatModel
+{
+public:
+    /** Predict options */
+    enum Flags { PREDICT_AUTO=0, PREDICT_SUM=(1<<8), PREDICT_MAX_VOTE=(2<<8), PREDICT_MASK=(3<<8) };
+
+    /** Cluster possible values of a categorical variable into K\<=maxCategories clusters to
+    find a suboptimal split.
+    If a discrete variable, on which the training procedure tries to make a split, takes more than
+    maxCategories values, the precise best subset estimation may take a very long time because the
+    algorithm is exponential. Instead, many decision trees engines (including our implementation)
+    try to find sub-optimal split in this case by clustering all the samples into maxCategories
+    clusters that is some categories are merged together. The clustering is applied only in n \>
+    2-class classification problems for categorical variables with N \> max_categories possible
+    values. In case of regression and 2-class classification the optimal split can be found
+    efficiently without employing clustering, thus the parameter is not used in these cases.
+    Default value is 10.*/
+    /** @see setMaxCategories */
+    CV_WRAP virtual int getMaxCategories() const = 0;
+    /** @copybrief getMaxCategories @see getMaxCategories */
+    CV_WRAP virtual void setMaxCategories(int val) = 0;
+
+    /** The maximum possible depth of the tree.
+    That is the training algorithms attempts to split a node while its depth is less than maxDepth.
+    The root node has zero depth. The actual depth may be smaller if the other termination criteria
+    are met (see the outline of the training procedure @ref ml_intro_trees "here"), and/or if the
+    tree is pruned. Default value is INT_MAX.*/
+    /** @see setMaxDepth */
+    CV_WRAP virtual int getMaxDepth() const = 0;
+    /** @copybrief getMaxDepth @see getMaxDepth */
+    CV_WRAP virtual void setMaxDepth(int val) = 0;
+
+    /** If the number of samples in a node is less than this parameter then the node will not be split.
+
+    Default value is 10.*/
+    /** @see setMinSampleCount */
+    CV_WRAP virtual int getMinSampleCount() const = 0;
+    /** @copybrief getMinSampleCount @see getMinSampleCount */
+    CV_WRAP virtual void setMinSampleCount(int val) = 0;
+
+    /** If CVFolds \> 1 then algorithms prunes the built decision tree using K-fold
+    cross-validation procedure where K is equal to CVFolds.
+    Default value is 10.*/
+    /** @see setCVFolds */
+    CV_WRAP virtual int getCVFolds() const = 0;
+    /** @copybrief getCVFolds @see getCVFolds */
+    CV_WRAP virtual void setCVFolds(int val) = 0;
+
+    /** If true then surrogate splits will be built.
+    These splits allow to work with missing data and compute variable importance correctly.
+    Default value is false.
+    @note currently it's not implemented.*/
+    /** @see setUseSurrogates */
+    CV_WRAP virtual bool getUseSurrogates() const = 0;
+    /** @copybrief getUseSurrogates @see getUseSurrogates */
+    CV_WRAP virtual void setUseSurrogates(bool val) = 0;
+
+    /** If true then a pruning will be harsher.
+    This will make a tree more compact and more resistant to the training data noise but a bit less
+    accurate. Default value is true.*/
+    /** @see setUse1SERule */
+    CV_WRAP virtual bool getUse1SERule() const = 0;
+    /** @copybrief getUse1SERule @see getUse1SERule */
+    CV_WRAP virtual void setUse1SERule(bool val) = 0;
+
+    /** If true then pruned branches are physically removed from the tree.
+    Otherwise they are retained and it is possible to get results from the original unpruned (or
+    pruned less aggressively) tree. Default value is true.*/
+    /** @see setTruncatePrunedTree */
+    CV_WRAP virtual bool getTruncatePrunedTree() const = 0;
+    /** @copybrief getTruncatePrunedTree @see getTruncatePrunedTree */
+    CV_WRAP virtual void setTruncatePrunedTree(bool val) = 0;
+
+    /** Termination criteria for regression trees.
+    If all absolute differences between an estimated value in a node and values of train samples
+    in this node are less than this parameter then the node will not be split further. Default
+    value is 0.01f*/
+    /** @see setRegressionAccuracy */
+    CV_WRAP virtual float getRegressionAccuracy() const = 0;
+    /** @copybrief getRegressionAccuracy @see getRegressionAccuracy */
+    CV_WRAP virtual void setRegressionAccuracy(float val) = 0;
+
+    /** @brief The array of a priori class probabilities, sorted by the class label value.
+
+    The parameter can be used to tune the decision tree preferences toward a certain class. For
+    example, if you want to detect some rare anomaly occurrence, the training base will likely
+    contain much more normal cases than anomalies, so a very good classification performance
+    will be achieved just by considering every case as normal. To avoid this, the priors can be
+    specified, where the anomaly probability is artificially increased (up to 0.5 or even
+    greater), so the weight of the misclassified anomalies becomes much bigger, and the tree is
+    adjusted properly.
+
+    You can also think about this parameter as weights of prediction categories which determine
+    relative weights that you give to misclassification. That is, if the weight of the first
+    category is 1 and the weight of the second category is 10, then each mistake in predicting
+    the second category is equivalent to making 10 mistakes in predicting the first category.
+    Default value is empty Mat.*/
+    /** @see setPriors */
+    CV_WRAP virtual cv::Mat getPriors() const = 0;
+    /** @copybrief getPriors @see getPriors */
+    CV_WRAP virtual void setPriors(const cv::Mat &val) = 0;
+
+    /** @brief The class represents a decision tree node.
+     */
+    class CV_EXPORTS Node
+    {
+    public:
+        Node();
+        double value; //!< Value at the node: a class label in case of classification or estimated
+                      //!< function value in case of regression.
+        int classIdx; //!< Class index normalized to 0..class_count-1 range and assigned to the
+                      //!< node. It is used internally in classification trees and tree ensembles.
+        int parent; //!< Index of the parent node
+        int left; //!< Index of the left child node
+        int right; //!< Index of right child node
+        int defaultDir; //!< Default direction where to go (-1: left or +1: right). It helps in the
+                        //!< case of missing values.
+        int split; //!< Index of the first split
+    };
+
+    /** @brief The class represents split in a decision tree.
+     */
+    class CV_EXPORTS Split
+    {
+    public:
+        Split();
+        int varIdx; //!< Index of variable on which the split is created.
+        bool inversed; //!< If true, then the inverse split rule is used (i.e. left and right
+                       //!< branches are exchanged in the rule expressions below).
+        float quality; //!< The split quality, a positive number. It is used to choose the best split.
+        int next; //!< Index of the next split in the list of splits for the node
+        float c; /**< The threshold value in case of split on an ordered variable.
+                      The rule is:
+                      @code{.none}
+                      if var_value < c
+                        then next_node <- left
+                        else next_node <- right
+                      @endcode */
+        int subsetOfs; /**< Offset of the bitset used by the split on a categorical variable.
+                            The rule is:
+                            @code{.none}
+                            if bitset[var_value] == 1
+                                then next_node <- left
+                                else next_node <- right
+                            @endcode */
+    };
+
+    /** @brief Returns indices of root nodes
+    */
+    virtual const std::vector<int>& getRoots() const = 0;
+    /** @brief Returns all the nodes
+
+    all the node indices are indices in the returned vector
+     */
+    virtual const std::vector<Node>& getNodes() const = 0;
+    /** @brief Returns all the splits
+
+    all the split indices are indices in the returned vector
+     */
+    virtual const std::vector<Split>& getSplits() const = 0;
+    /** @brief Returns all the bitsets for categorical splits
+
+    Split::subsetOfs is an offset in the returned vector
+     */
+    virtual const std::vector<int>& getSubsets() const = 0;
+
+    /** @brief Creates the empty model
+
+    The static method creates empty decision tree with the specified parameters. It should be then
+    trained using train method (see StatModel::train). Alternatively, you can load the model from
+    file using Algorithm::load\<DTrees\>(filename).
+     */
+    CV_WRAP static Ptr<DTrees> create();
+};
+
+/****************************************************************************************\
+*                                   Random Trees Classifier                              *
+\****************************************************************************************/
+
+/** @brief The class implements the random forest predictor.
+
+@sa @ref ml_intro_rtrees
+ */
+class CV_EXPORTS_W RTrees : public DTrees
+{
+public:
+
+    /** If true then variable importance will be calculated and then it can be retrieved by RTrees::getVarImportance.
+    Default value is false.*/
+    /** @see setCalculateVarImportance */
+    CV_WRAP virtual bool getCalculateVarImportance() const = 0;
+    /** @copybrief getCalculateVarImportance @see getCalculateVarImportance */
+    CV_WRAP virtual void setCalculateVarImportance(bool val) = 0;
+
+    /** The size of the randomly selected subset of features at each tree node and that are used
+    to find the best split(s).
+    If you set it to 0 then the size will be set to the square root of the total number of
+    features. Default value is 0.*/
+    /** @see setActiveVarCount */
+    CV_WRAP virtual int getActiveVarCount() const = 0;
+    /** @copybrief getActiveVarCount @see getActiveVarCount */
+    CV_WRAP virtual void setActiveVarCount(int val) = 0;
+
+    /** The termination criteria that specifies when the training algorithm stops.
+    Either when the specified number of trees is trained and added to the ensemble or when
+    sufficient accuracy (measured as OOB error) is achieved. Typically the more trees you have the
+    better the accuracy. However, the improvement in accuracy generally diminishes and asymptotes
+    pass a certain number of trees. Also to keep in mind, the number of tree increases the
+    prediction time linearly. Default value is TermCriteria(TermCriteria::MAX_ITERS +
+    TermCriteria::EPS, 50, 0.1)*/
+    /** @see setTermCriteria */
+    CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(const TermCriteria &val) = 0;
+
+    /** Returns the variable importance array.
+    The method returns the variable importance vector, computed at the training stage when
+    CalculateVarImportance is set to true. If this flag was set to false, the empty matrix is
+    returned.
+     */
+    CV_WRAP virtual Mat getVarImportance() const = 0;
+
+    /** Creates the empty model.
+    Use StatModel::train to train the model, StatModel::train to create and train the model,
+    Algorithm::load to load the pre-trained model.
+     */
+    CV_WRAP static Ptr<RTrees> create();
+};
+
+/****************************************************************************************\
+*                                   Boosted tree classifier                              *
+\****************************************************************************************/
+
+/** @brief Boosted tree classifier derived from DTrees
+
+@sa @ref ml_intro_boost
+ */
+class CV_EXPORTS_W Boost : public DTrees
+{
+public:
+    /** Type of the boosting algorithm.
+    See Boost::Types. Default value is Boost::REAL. */
+    /** @see setBoostType */
+    CV_WRAP virtual int getBoostType() const = 0;
+    /** @copybrief getBoostType @see getBoostType */
+    CV_WRAP virtual void setBoostType(int val) = 0;
+
+    /** The number of weak classifiers.
+    Default value is 100. */
+    /** @see setWeakCount */
+    CV_WRAP virtual int getWeakCount() const = 0;
+    /** @copybrief getWeakCount @see getWeakCount */
+    CV_WRAP virtual void setWeakCount(int val) = 0;
+
+    /** A threshold between 0 and 1 used to save computational time.
+    Samples with summary weight \f$\leq 1 - weight_trim_rate\f$ do not participate in the *next*
+    iteration of training. Set this parameter to 0 to turn off this functionality. Default value is 0.95.*/
+    /** @see setWeightTrimRate */
+    CV_WRAP virtual double getWeightTrimRate() const = 0;
+    /** @copybrief getWeightTrimRate @see getWeightTrimRate */
+    CV_WRAP virtual void setWeightTrimRate(double val) = 0;
+
+    /** Boosting type.
+    Gentle AdaBoost and Real AdaBoost are often the preferable choices. */
+    enum Types {
+        DISCRETE=0, //!< Discrete AdaBoost.
+        REAL=1, //!< Real AdaBoost. It is a technique that utilizes confidence-rated predictions
+                //!< and works well with categorical data.
+        LOGIT=2, //!< LogitBoost. It can produce good regression fits.
+        GENTLE=3 //!< Gentle AdaBoost. It puts less weight on outlier data points and for that
+                 //!<reason is often good with regression data.
+    };
+
+    /** Creates the empty model.
+    Use StatModel::train to train the model, Algorithm::load\<Boost\>(filename) to load the pre-trained model. */
+    CV_WRAP static Ptr<Boost> create();
+};
+
+/****************************************************************************************\
+*                                   Gradient Boosted Trees                               *
+\****************************************************************************************/
+
+/*class CV_EXPORTS_W GBTrees : public DTrees
+{
+public:
+    struct CV_EXPORTS_W_MAP Params : public DTrees::Params
+    {
+        CV_PROP_RW int weakCount;
+        CV_PROP_RW int lossFunctionType;
+        CV_PROP_RW float subsamplePortion;
+        CV_PROP_RW float shrinkage;
+
+        Params();
+        Params( int lossFunctionType, int weakCount, float shrinkage,
+                float subsamplePortion, int maxDepth, bool useSurrogates );
+    };
+
+    enum {SQUARED_LOSS=0, ABSOLUTE_LOSS, HUBER_LOSS=3, DEVIANCE_LOSS};
+
+    virtual void setK(int k) = 0;
+
+    virtual float predictSerial( InputArray samples,
+                                 OutputArray weakResponses, int flags) const = 0;
+
+    static Ptr<GBTrees> create(const Params& p);
+};*/
+
+/****************************************************************************************\
+*                              Artificial Neural Networks (ANN)                          *
+\****************************************************************************************/
+
+/////////////////////////////////// Multi-Layer Perceptrons //////////////////////////////
+
+/** @brief Artificial Neural Networks - Multi-Layer Perceptrons.
+
+Unlike many other models in ML that are constructed and trained at once, in the MLP model these
+steps are separated. First, a network with the specified topology is created using the non-default
+constructor or the method ANN_MLP::create. All the weights are set to zeros. Then, the network is
+trained using a set of input and output vectors. The training procedure can be repeated more than
+once, that is, the weights can be adjusted based on the new training data.
+
+Additional flags for StatModel::train are available: ANN_MLP::TrainFlags.
+
+@sa @ref ml_intro_ann
+ */
+class CV_EXPORTS_W ANN_MLP : public StatModel
+{
+public:
+    /** Available training methods */
+    enum TrainingMethods {
+        BACKPROP=0, //!< The back-propagation algorithm.
+        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+    };
+
+    /** Sets training method and common parameters.
+    @param method Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods.
+    @param param1 passed to setRpropDW0 for ANN_MLP::RPROP and to setBackpropWeightScale for ANN_MLP::BACKPROP
+    @param param2 passed to setRpropDWMin for ANN_MLP::RPROP and to setBackpropMomentumScale for ANN_MLP::BACKPROP.
+    */
+    CV_WRAP virtual void setTrainMethod(int method, double param1 = 0, double param2 = 0) = 0;
+
+    /** Returns current training method */
+    CV_WRAP virtual int getTrainMethod() const = 0;
+
+    /** Initialize the activation function for each neuron.
+    Currently the default and the only fully supported activation function is ANN_MLP::SIGMOID_SYM.
+    @param type The type of activation function. See ANN_MLP::ActivationFunctions.
+    @param param1 The first parameter of the activation function, \f$\alpha\f$. Default value is 0.
+    @param param2 The second parameter of the activation function, \f$\beta\f$. Default value is 0.
+    */
+    CV_WRAP virtual void setActivationFunction(int type, double param1 = 0, double param2 = 0) = 0;
+
+    /**  Integer vector specifying the number of neurons in each layer including the input and output layers.
+    The very first element specifies the number of elements in the input layer.
+    The last element - number of elements in the output layer. Default value is empty Mat.
+    @sa getLayerSizes */
+    CV_WRAP virtual void setLayerSizes(InputArray _layer_sizes) = 0;
+
+    /**  Integer vector specifying the number of neurons in each layer including the input and output layers.
+    The very first element specifies the number of elements in the input layer.
+    The last element - number of elements in the output layer.
+    @sa setLayerSizes */
+    CV_WRAP virtual cv::Mat getLayerSizes() const = 0;
+
+    /** Termination criteria of the training algorithm.
+    You can specify the maximum number of iterations (maxCount) and/or how much the error could
+    change between the iterations to make the algorithm continue (epsilon). Default value is
+    TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 1000, 0.01).*/
+    /** @see setTermCriteria */
+    CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(TermCriteria val) = 0;
+
+    /** BPROP: Strength of the weight gradient term.
+    The recommended value is about 0.1. Default value is 0.1.*/
+    /** @see setBackpropWeightScale */
+    CV_WRAP virtual double getBackpropWeightScale() const = 0;
+    /** @copybrief getBackpropWeightScale @see getBackpropWeightScale */
+    CV_WRAP virtual void setBackpropWeightScale(double val) = 0;
+
+    /** BPROP: Strength of the momentum term (the difference between weights on the 2 previous iterations).
+    This parameter provides some inertia to smooth the random fluctuations of the weights. It can
+    vary from 0 (the feature is disabled) to 1 and beyond. The value 0.1 or so is good enough.
+    Default value is 0.1.*/
+    /** @see setBackpropMomentumScale */
+    CV_WRAP virtual double getBackpropMomentumScale() const = 0;
+    /** @copybrief getBackpropMomentumScale @see getBackpropMomentumScale */
+    CV_WRAP virtual void setBackpropMomentumScale(double val) = 0;
+
+    /** RPROP: Initial value \f$\Delta_0\f$ of update-values \f$\Delta_{ij}\f$.
+    Default value is 0.1.*/
+    /** @see setRpropDW0 */
+    CV_WRAP virtual double getRpropDW0() const = 0;
+    /** @copybrief getRpropDW0 @see getRpropDW0 */
+    CV_WRAP virtual void setRpropDW0(double val) = 0;
+
+    /** RPROP: Increase factor \f$\eta^+\f$.
+    It must be \>1. Default value is 1.2.*/
+    /** @see setRpropDWPlus */
+    CV_WRAP virtual double getRpropDWPlus() const = 0;
+    /** @copybrief getRpropDWPlus @see getRpropDWPlus */
+    CV_WRAP virtual void setRpropDWPlus(double val) = 0;
+
+    /** RPROP: Decrease factor \f$\eta^-\f$.
+    It must be \<1. Default value is 0.5.*/
+    /** @see setRpropDWMinus */
+    CV_WRAP virtual double getRpropDWMinus() const = 0;
+    /** @copybrief getRpropDWMinus @see getRpropDWMinus */
+    CV_WRAP virtual void setRpropDWMinus(double val) = 0;
+
+    /** RPROP: Update-values lower limit \f$\Delta_{min}\f$.
+    It must be positive. Default value is FLT_EPSILON.*/
+    /** @see setRpropDWMin */
+    CV_WRAP virtual double getRpropDWMin() const = 0;
+    /** @copybrief getRpropDWMin @see getRpropDWMin */
+    CV_WRAP virtual void setRpropDWMin(double val) = 0;
+
+    /** RPROP: Update-values upper limit \f$\Delta_{max}\f$.
+    It must be \>1. Default value is 50.*/
+    /** @see setRpropDWMax */
+    CV_WRAP virtual double getRpropDWMax() const = 0;
+    /** @copybrief getRpropDWMax @see getRpropDWMax */
+    CV_WRAP virtual void setRpropDWMax(double val) = 0;
+
+    /** possible activation functions */
+    enum ActivationFunctions {
+        /** Identity function: \f$f(x)=x\f$ */
+        IDENTITY = 0,
+        /** Symmetrical sigmoid: \f$f(x)=\beta*(1-e^{-\alpha x})/(1+e^{-\alpha x}\f$
+        @note
+        If you are using the default sigmoid activation function with the default parameter values
+        fparam1=0 and fparam2=0 then the function used is y = 1.7159\*tanh(2/3 \* x), so the output
+        will range from [-1.7159, 1.7159], instead of [0,1].*/
+        SIGMOID_SYM = 1,
+        /** Gaussian function: \f$f(x)=\beta e^{-\alpha x*x}\f$ */
+        GAUSSIAN = 2
+    };
+
+    /** Train options */
+    enum TrainFlags {
+        /** Update the network weights, rather than compute them from scratch. In the latter case
+        the weights are initialized using the Nguyen-Widrow algorithm. */
+        UPDATE_WEIGHTS = 1,
+        /** Do not normalize the input vectors. If this flag is not set, the training algorithm
+        normalizes each input feature independently, shifting its mean value to 0 and making the
+        standard deviation equal to 1. If the network is assumed to be updated frequently, the new
+        training data could be much different from original one. In this case, you should take care
+        of proper normalization. */
+        NO_INPUT_SCALE = 2,
+        /** Do not normalize the output vectors. If the flag is not set, the training algorithm
+        normalizes each output feature independently, by transforming it to the certain range
+        depending on the used activation function. */
+        NO_OUTPUT_SCALE = 4
+    };
+
+    CV_WRAP virtual Mat getWeights(int layerIdx) const = 0;
+
+    /** @brief Creates empty model
+
+    Use StatModel::train to train the model, Algorithm::load\<ANN_MLP\>(filename) to load the pre-trained model.
+    Note that the train method has optional flags: ANN_MLP::TrainFlags.
+     */
+    CV_WRAP static Ptr<ANN_MLP> create();
+};
+
+/****************************************************************************************\
+*                           Logistic Regression                                          *
+\****************************************************************************************/
+
+/** @brief Implements Logistic Regression classifier.
+
+@sa @ref ml_intro_lr
+ */
+class CV_EXPORTS_W LogisticRegression : public StatModel
+{
+public:
+
+    /** Learning rate. */
+    /** @see setLearningRate */
+    CV_WRAP virtual double getLearningRate() const = 0;
+    /** @copybrief getLearningRate @see getLearningRate */
+    CV_WRAP virtual void setLearningRate(double val) = 0;
+
+    /** Number of iterations. */
+    /** @see setIterations */
+    CV_WRAP virtual int getIterations() const = 0;
+    /** @copybrief getIterations @see getIterations */
+    CV_WRAP virtual void setIterations(int val) = 0;
+
+    /** Kind of regularization to be applied. See LogisticRegression::RegKinds. */
+    /** @see setRegularization */
+    CV_WRAP virtual int getRegularization() const = 0;
+    /** @copybrief getRegularization @see getRegularization */
+    CV_WRAP virtual void setRegularization(int val) = 0;
+
+    /** Kind of training method used. See LogisticRegression::Methods. */
+    /** @see setTrainMethod */
+    CV_WRAP virtual int getTrainMethod() const = 0;
+    /** @copybrief getTrainMethod @see getTrainMethod */
+    CV_WRAP virtual void setTrainMethod(int val) = 0;
+
+    /** Specifies the number of training samples taken in each step of Mini-Batch Gradient
+    Descent. Will only be used if using LogisticRegression::MINI_BATCH training algorithm. It
+    has to take values less than the total number of training samples. */
+    /** @see setMiniBatchSize */
+    CV_WRAP virtual int getMiniBatchSize() const = 0;
+    /** @copybrief getMiniBatchSize @see getMiniBatchSize */
+    CV_WRAP virtual void setMiniBatchSize(int val) = 0;
+
+    /** Termination criteria of the algorithm. */
+    /** @see setTermCriteria */
+    CV_WRAP virtual TermCriteria getTermCriteria() const = 0;
+    /** @copybrief getTermCriteria @see getTermCriteria */
+    CV_WRAP virtual void setTermCriteria(TermCriteria val) = 0;
+
+    //! Regularization kinds
+    enum RegKinds {
+        REG_DISABLE = -1, //!< Regularization disabled
+        REG_L1 = 0, //!< %L1 norm
+        REG_L2 = 1 //!< %L2 norm
+    };
+
+    //! Training methods
+    enum Methods {
+        BATCH = 0,
+        MINI_BATCH = 1 //!< Set MiniBatchSize to a positive integer when using this method.
+    };
+
+    /** @brief Predicts responses for input samples and returns a float type.
+
+    @param samples The input data for the prediction algorithm. Matrix [m x n], where each row
+        contains variables (features) of one object being classified. Should have data type CV_32F.
+    @param results Predicted labels as a column matrix of type CV_32S.
+    @param flags Not used.
+     */
+    CV_WRAP virtual float predict( InputArray samples, OutputArray results=noArray(), int flags=0 ) const = 0;
+
+    /** @brief This function returns the trained paramters arranged across rows.
+
+    For a two class classifcation problem, it returns a row matrix. It returns learnt paramters of
+    the Logistic Regression as a matrix of type CV_32F.
+     */
+    CV_WRAP virtual Mat get_learnt_thetas() const = 0;
+
+    /** @brief Creates empty model.
+
+    Creates Logistic Regression model with parameters given.
+     */
+    CV_WRAP static Ptr<LogisticRegression> create();
+};
+
+/****************************************************************************************\
+*                           Auxilary functions declarations                              *
+\****************************************************************************************/
+
+/** @brief Generates _sample_ from multivariate normal distribution
+
+@param mean an average row vector
+@param cov symmetric covariation matrix
+@param nsamples returned samples count
+@param samples returned samples array
+*/
+CV_EXPORTS void randMVNormal( InputArray mean, InputArray cov, int nsamples, OutputArray samples);
+
+/** @brief Creates test set */
+CV_EXPORTS void createConcentricSpheresTestSet( int nsamples, int nfeatures, int nclasses,
+                                                OutputArray samples, OutputArray responses);
+
+//! @} ml
+
+}
+}
+
+#endif // __cplusplus
+#endif // __OPENCV_ML_HPP__
+
+/* End of file. */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp
new file mode 100644
index 0000000..f6f9cd8
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/ml/ml.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/ml.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp
new file mode 100644
index 0000000..f2fc211
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect.hpp
@@ -0,0 +1,468 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_OBJDETECT_HPP__
+#define __OPENCV_OBJDETECT_HPP__
+
+#include "opencv2/core.hpp"
+
+/**
+@defgroup objdetect Object Detection
+
+Haar Feature-based Cascade Classifier for Object Detection
+----------------------------------------------------------
+
+The object detector described below has been initially proposed by Paul Viola @cite Viola01 and
+improved by Rainer Lienhart @cite Lienhart02 .
+
+First, a classifier (namely a *cascade of boosted classifiers working with haar-like features*) is
+trained with a few hundred sample views of a particular object (i.e., a face or a car), called
+positive examples, that are scaled to the same size (say, 20x20), and negative examples - arbitrary
+images of the same size.
+
+After a classifier is trained, it can be applied to a region of interest (of the same size as used
+during the training) in an input image. The classifier outputs a "1" if the region is likely to show
+the object (i.e., face/car), and "0" otherwise. To search for the object in the whole image one can
+move the search window across the image and check every location using the classifier. The
+classifier is designed so that it can be easily "resized" in order to be able to find the objects of
+interest at different sizes, which is more efficient than resizing the image itself. So, to find an
+object of an unknown size in the image the scan procedure should be done several times at different
+scales.
+
+The word "cascade" in the classifier name means that the resultant classifier consists of several
+simpler classifiers (*stages*) that are applied subsequently to a region of interest until at some
+stage the candidate is rejected or all the stages are passed. The word "boosted" means that the
+classifiers at every stage of the cascade are complex themselves and they are built out of basic
+classifiers using one of four different boosting techniques (weighted voting). Currently Discrete
+Adaboost, Real Adaboost, Gentle Adaboost and Logitboost are supported. The basic classifiers are
+decision-tree classifiers with at least 2 leaves. Haar-like features are the input to the basic
+classifiers, and are calculated as described below. The current algorithm uses the following
+Haar-like features:
+
+![image](pics/haarfeatures.png)
+
+The feature used in a particular classifier is specified by its shape (1a, 2b etc.), position within
+the region of interest and the scale (this scale is not the same as the scale used at the detection
+stage, though these two scales are multiplied). For example, in the case of the third line feature
+(2c) the response is calculated as the difference between the sum of image pixels under the
+rectangle covering the whole feature (including the two white stripes and the black stripe in the
+middle) and the sum of the image pixels under the black stripe multiplied by 3 in order to
+compensate for the differences in the size of areas. The sums of pixel values over a rectangular
+regions are calculated rapidly using integral images (see below and the integral description).
+
+To see the object detector at work, have a look at the facedetect demo:
+<https://github.com/Itseez/opencv/tree/master/samples/cpp/dbt_face_detection.cpp>
+
+The following reference is for the detection part only. There is a separate application called
+opencv_traincascade that can train a cascade of boosted classifiers from a set of samples.
+
+@note In the new C++ interface it is also possible to use LBP (local binary pattern) features in
+addition to Haar-like features. .. [Viola01] Paul Viola and Michael J. Jones. Rapid Object Detection
+using a Boosted Cascade of Simple Features. IEEE CVPR, 2001. The paper is available online at
+<http://research.microsoft.com/en-us/um/people/viola/Pubs/Detect/violaJones_CVPR2001.pdf>
+
+@{
+    @defgroup objdetect_c C API
+@}
+ */
+
+typedef struct CvHaarClassifierCascade CvHaarClassifierCascade;
+
+namespace cv
+{
+
+//! @addtogroup objdetect
+//! @{
+
+///////////////////////////// Object Detection ////////////////////////////
+
+//! class for grouping object candidates, detected by Cascade Classifier, HOG etc.
+//! instance of the class is to be passed to cv::partition (see cxoperations.hpp)
+class CV_EXPORTS SimilarRects
+{
+public:
+    SimilarRects(double _eps) : eps(_eps) {}
+    inline bool operator()(const Rect& r1, const Rect& r2) const
+    {
+		/*
+        double delta = eps*(std::min(r1.width, r2.width) + std::min(r1.height, r2.height))*0.5;
+        return std::abs(r1.x - r2.x) <= delta &&
+            std::abs(r1.y - r2.y) <= delta &&
+            std::abs(r1.x + r1.width - r2.x - r2.width) <= delta &&
+            std::abs(r1.y + r1.height - r2.y - r2.height) <= delta;
+			*/
+    }
+    double eps;
+};
+
+/** @brief Groups the object candidate rectangles.
+
+@param rectList Input/output vector of rectangles. Output vector includes retained and grouped
+rectangles. (The Python list is not modified in place.)
+@param groupThreshold Minimum possible number of rectangles minus 1. The threshold is used in a
+group of rectangles to retain it.
+@param eps Relative difference between sides of the rectangles to merge them into a group.
+
+The function is a wrapper for the generic function partition . It clusters all the input rectangles
+using the rectangle equivalence criteria that combines rectangles with similar sizes and similar
+locations. The similarity is defined by eps. When eps=0 , no clustering is done at all. If
+\f$\texttt{eps}\rightarrow +\inf\f$ , all the rectangles are put in one cluster. Then, the small
+clusters containing less than or equal to groupThreshold rectangles are rejected. In each other
+cluster, the average rectangle is computed and put into the output rectangle list.
+ */
+CV_EXPORTS   void groupRectangles(std::vector<Rect>& rectList, int groupThreshold, double eps = 0.2);
+/** @overload */
+CV_EXPORTS_W void groupRectangles(CV_IN_OUT std::vector<Rect>& rectList, CV_OUT std::vector<int>& weights,
+                                  int groupThreshold, double eps = 0.2);
+/** @overload */
+CV_EXPORTS   void groupRectangles(std::vector<Rect>& rectList, int groupThreshold,
+                                  double eps, std::vector<int>* weights, std::vector<double>* levelWeights );
+/** @overload */
+CV_EXPORTS   void groupRectangles(std::vector<Rect>& rectList, std::vector<int>& rejectLevels,
+                                  std::vector<double>& levelWeights, int groupThreshold, double eps = 0.2);
+/** @overload */
+CV_EXPORTS   void groupRectangles_meanshift(std::vector<Rect>& rectList, std::vector<double>& foundWeights,
+                                            std::vector<double>& foundScales,
+                                            double detectThreshold = 0.0, Size winDetSize = Size(64, 128));
+
+template<> CV_EXPORTS void DefaultDeleter<CvHaarClassifierCascade>::operator ()(CvHaarClassifierCascade* obj) const;
+
+enum { CASCADE_DO_CANNY_PRUNING    = 1,
+       CASCADE_SCALE_IMAGE         = 2,
+       CASCADE_FIND_BIGGEST_OBJECT = 4,
+       CASCADE_DO_ROUGH_SEARCH     = 8
+     };
+
+class CV_EXPORTS_W BaseCascadeClassifier : public Algorithm
+{
+public:
+    virtual ~BaseCascadeClassifier();
+    virtual bool empty() const = 0;
+    virtual bool load( const String& filename ) = 0;
+    virtual void detectMultiScale( InputArray image,
+                           CV_OUT std::vector<Rect>& objects,
+                           double scaleFactor,
+                           int minNeighbors, int flags,
+                           Size minSize, Size maxSize ) = 0;
+
+    virtual void detectMultiScale( InputArray image,
+                           CV_OUT std::vector<Rect>& objects,
+                           CV_OUT std::vector<int>& numDetections,
+                           double scaleFactor,
+                           int minNeighbors, int flags,
+                           Size minSize, Size maxSize ) = 0;
+
+    virtual void detectMultiScale( InputArray image,
+                                   CV_OUT std::vector<Rect>& objects,
+                                   CV_OUT std::vector<int>& rejectLevels,
+                                   CV_OUT std::vector<double>& levelWeights,
+                                   double scaleFactor,
+                                   int minNeighbors, int flags,
+                                   Size minSize, Size maxSize,
+                                   bool outputRejectLevels ) = 0;
+
+    virtual bool isOldFormatCascade() const = 0;
+    virtual Size getOriginalWindowSize() const = 0;
+    virtual int getFeatureType() const = 0;
+    virtual void* getOldCascade() = 0;
+
+    class CV_EXPORTS MaskGenerator
+    {
+    public:
+        virtual ~MaskGenerator() {}
+        virtual Mat generateMask(const Mat& src)=0;
+        virtual void initializeMask(const Mat& /*src*/) { }
+    };
+    virtual void setMaskGenerator(const Ptr<MaskGenerator>& maskGenerator) = 0;
+    virtual Ptr<MaskGenerator> getMaskGenerator() = 0;
+};
+
+/** @brief Cascade classifier class for object detection.
+ */
+class CV_EXPORTS_W CascadeClassifier
+{
+public:
+    CV_WRAP CascadeClassifier();
+    /** @brief Loads a classifier from a file.
+
+    @param filename Name of the file from which the classifier is loaded.
+     */
+    CV_WRAP CascadeClassifier(const String& filename);
+    ~CascadeClassifier();
+    /** @brief Checks whether the classifier has been loaded.
+    */
+    CV_WRAP bool empty() const;
+    /** @brief Loads a classifier from a file.
+
+    @param filename Name of the file from which the classifier is loaded. The file may contain an old
+    HAAR classifier trained by the haartraining application or a new cascade classifier trained by the
+    traincascade application.
+     */
+    CV_WRAP bool load( const String& filename );
+    /** @brief Reads a classifier from a FileStorage node.
+
+    @note The file may contain a new cascade classifier (trained traincascade application) only.
+     */
+    CV_WRAP bool read( const FileNode& node );
+
+    /** @brief Detects objects of different sizes in the input image. The detected objects are returned as a list
+    of rectangles.
+
+    @param image Matrix of the type CV_8U containing an image where objects are detected.
+    @param objects Vector of rectangles where each rectangle contains the detected object, the
+    rectangles may be partially outside the original image.
+    @param scaleFactor Parameter specifying how much the image size is reduced at each image scale.
+    @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have
+    to retain it.
+    @param flags Parameter with the same meaning for an old cascade as in the function
+    cvHaarDetectObjects. It is not used for a new cascade.
+    @param minSize Minimum possible object size. Objects smaller than that are ignored.
+    @param maxSize Maximum possible object size. Objects larger than that are ignored.
+
+    The function is parallelized with the TBB library.
+
+    @note
+       -   (Python) A face detection example using cascade classifiers can be found at
+            opencv_source_code/samples/python/facedetect.py
+    */
+    CV_WRAP void detectMultiScale( InputArray image,
+                          CV_OUT std::vector<Rect>& objects,
+                          double scaleFactor = 1.1,
+                          int minNeighbors = 3, int flags = 0,
+                          Size minSize = Size(),
+                          Size maxSize = Size() );
+
+    /** @overload
+    @param image Matrix of the type CV_8U containing an image where objects are detected.
+    @param objects Vector of rectangles where each rectangle contains the detected object, the
+    rectangles may be partially outside the original image.
+    @param numDetections Vector of detection numbers for the corresponding objects. An object's number
+    of detections is the number of neighboring positively classified rectangles that were joined
+    together to form the object.
+    @param scaleFactor Parameter specifying how much the image size is reduced at each image scale.
+    @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have
+    to retain it.
+    @param flags Parameter with the same meaning for an old cascade as in the function
+    cvHaarDetectObjects. It is not used for a new cascade.
+    @param minSize Minimum possible object size. Objects smaller than that are ignored.
+    @param maxSize Maximum possible object size. Objects larger than that are ignored.
+    */
+    CV_WRAP_AS(detectMultiScale2) void detectMultiScale( InputArray image,
+                          CV_OUT std::vector<Rect>& objects,
+                          CV_OUT std::vector<int>& numDetections,
+                          double scaleFactor=1.1,
+                          int minNeighbors=3, int flags=0,
+                          Size minSize=Size(),
+                          Size maxSize=Size() );
+
+    /** @overload
+    if `outputRejectLevels` is `true` returns `rejectLevels` and `levelWeights`
+    */
+    CV_WRAP_AS(detectMultiScale3) void detectMultiScale( InputArray image,
+                                  CV_OUT std::vector<Rect>& objects,
+                                  CV_OUT std::vector<int>& rejectLevels,
+                                  CV_OUT std::vector<double>& levelWeights,
+                                  double scaleFactor = 1.1,
+                                  int minNeighbors = 3, int flags = 0,
+                                  Size minSize = Size(),
+                                  Size maxSize = Size(),
+                                  bool outputRejectLevels = false );
+
+    CV_WRAP bool isOldFormatCascade() const;
+    CV_WRAP Size getOriginalWindowSize() const;
+    CV_WRAP int getFeatureType() const;
+    void* getOldCascade();
+
+    CV_WRAP static bool convert(const String& oldcascade, const String& newcascade);
+
+    void setMaskGenerator(const Ptr<BaseCascadeClassifier::MaskGenerator>& maskGenerator);
+    Ptr<BaseCascadeClassifier::MaskGenerator> getMaskGenerator();
+
+    Ptr<BaseCascadeClassifier> cc;
+};
+
+CV_EXPORTS Ptr<BaseCascadeClassifier::MaskGenerator> createFaceDetectionMaskGenerator();
+
+//////////////// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector //////////////
+
+//! struct for detection region of interest (ROI)
+struct DetectionROI
+{
+   //! scale(size) of the bounding box
+   double scale;
+   //! set of requrested locations to be evaluated
+   std::vector<cv::Point> locations;
+   //! vector that will contain confidence values for each location
+   std::vector<double> confidences;
+};
+
+struct CV_EXPORTS_W HOGDescriptor
+{
+public:
+    enum { L2Hys = 0
+         };
+    enum { DEFAULT_NLEVELS = 64
+         };
+
+    CV_WRAP HOGDescriptor() : winSize(64,128), blockSize(16,16), blockStride(8,8),
+        cellSize(8,8), nbins(9), derivAperture(1), winSigma(-1),
+        histogramNormType(HOGDescriptor::L2Hys), L2HysThreshold(0.2), gammaCorrection(true),
+        free_coef(-1.f), nlevels(HOGDescriptor::DEFAULT_NLEVELS), signedGradient(false)
+    {}
+
+    CV_WRAP HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride,
+                  Size _cellSize, int _nbins, int _derivAperture=1, double _winSigma=-1,
+                  int _histogramNormType=HOGDescriptor::L2Hys,
+                  double _L2HysThreshold=0.2, bool _gammaCorrection=false,
+                  int _nlevels=HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient=false)
+    : winSize(_winSize), blockSize(_blockSize), blockStride(_blockStride), cellSize(_cellSize),
+    nbins(_nbins), derivAperture(_derivAperture), winSigma(_winSigma),
+    histogramNormType(_histogramNormType), L2HysThreshold(_L2HysThreshold),
+    gammaCorrection(_gammaCorrection), free_coef(-1.f), nlevels(_nlevels), signedGradient(_signedGradient)
+    {}
+
+    CV_WRAP HOGDescriptor(const String& filename)
+    {
+        load(filename);
+    }
+
+    HOGDescriptor(const HOGDescriptor& d)
+    {
+        d.copyTo(*this);
+    }
+
+    virtual ~HOGDescriptor() {}
+
+    CV_WRAP size_t getDescriptorSize() const;
+    CV_WRAP bool checkDetectorSize() const;
+    CV_WRAP double getWinSigma() const;
+
+    CV_WRAP virtual void setSVMDetector(InputArray _svmdetector);
+
+    virtual bool read(FileNode& fn);
+    virtual void write(FileStorage& fs, const String& objname) const;
+
+    CV_WRAP virtual bool load(const String& filename, const String& objname = String());
+    CV_WRAP virtual void save(const String& filename, const String& objname = String()) const;
+    virtual void copyTo(HOGDescriptor& c) const;
+
+    CV_WRAP virtual void compute(InputArray img,
+                         CV_OUT std::vector<float>& descriptors,
+                         Size winStride = Size(), Size padding = Size(),
+                         const std::vector<Point>& locations = std::vector<Point>()) const;
+
+    //! with found weights output
+    CV_WRAP virtual void detect(const Mat& img, CV_OUT std::vector<Point>& foundLocations,
+                        CV_OUT std::vector<double>& weights,
+                        double hitThreshold = 0, Size winStride = Size(),
+                        Size padding = Size(),
+                        const std::vector<Point>& searchLocations = std::vector<Point>()) const;
+    //! without found weights output
+    virtual void detect(const Mat& img, CV_OUT std::vector<Point>& foundLocations,
+                        double hitThreshold = 0, Size winStride = Size(),
+                        Size padding = Size(),
+                        const std::vector<Point>& searchLocations=std::vector<Point>()) const;
+
+    //! with result weights output
+    CV_WRAP virtual void detectMultiScale(InputArray img, CV_OUT std::vector<Rect>& foundLocations,
+                                  CV_OUT std::vector<double>& foundWeights, double hitThreshold = 0,
+                                  Size winStride = Size(), Size padding = Size(), double scale = 1.05,
+                                  double finalThreshold = 2.0,bool useMeanshiftGrouping = false) const;
+    //! without found weights output
+    virtual void detectMultiScale(InputArray img, CV_OUT std::vector<Rect>& foundLocations,
+                                  double hitThreshold = 0, Size winStride = Size(),
+                                  Size padding = Size(), double scale = 1.05,
+                                  double finalThreshold = 2.0, bool useMeanshiftGrouping = false) const;
+
+    CV_WRAP virtual void computeGradient(const Mat& img, CV_OUT Mat& grad, CV_OUT Mat& angleOfs,
+                                 Size paddingTL = Size(), Size paddingBR = Size()) const;
+
+    CV_WRAP static std::vector<float> getDefaultPeopleDetector();
+    CV_WRAP static std::vector<float> getDaimlerPeopleDetector();
+
+    CV_PROP Size winSize;
+    CV_PROP Size blockSize;
+    CV_PROP Size blockStride;
+    CV_PROP Size cellSize;
+    CV_PROP int nbins;
+    CV_PROP int derivAperture;
+    CV_PROP double winSigma;
+    CV_PROP int histogramNormType;
+    CV_PROP double L2HysThreshold;
+    CV_PROP bool gammaCorrection;
+    CV_PROP std::vector<float> svmDetector;
+    UMat oclSvmDetector;
+    float free_coef;
+    CV_PROP int nlevels;
+    CV_PROP bool signedGradient;
+
+
+    //! evaluate specified ROI and return confidence value for each location
+    virtual void detectROI(const cv::Mat& img, const std::vector<cv::Point> &locations,
+                                   CV_OUT std::vector<cv::Point>& foundLocations, CV_OUT std::vector<double>& confidences,
+                                   double hitThreshold = 0, cv::Size winStride = Size(),
+                                   cv::Size padding = Size()) const;
+
+    //! evaluate specified ROI and return confidence value for each location in multiple scales
+    virtual void detectMultiScaleROI(const cv::Mat& img,
+                                                       CV_OUT std::vector<cv::Rect>& foundLocations,
+                                                       std::vector<DetectionROI>& locations,
+                                                       double hitThreshold = 0,
+                                                       int groupThreshold = 0) const;
+
+    //! read/parse Dalal's alt model file
+    void readALTModel(String modelfile);
+    void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
+};
+
+//! @} objdetect
+
+}
+
+#include "opencv2/objdetect/detection_based_tracker.hpp"
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/objdetect/objdetect_c.h"
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp
new file mode 100644
index 0000000..1f5f1d3
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/detection_based_tracker.hpp
@@ -0,0 +1,225 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_OBJDETECT_DBT_HPP__
+#define __OPENCV_OBJDETECT_DBT_HPP__
+
+// After this condition removal update blacklist for bindings: modules/python/common.cmake
+#if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(__ANDROID__) || \
+  (defined(__cplusplus) &&  __cplusplus > 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1700)
+
+#include <vector>
+
+namespace cv
+{
+
+//! @addtogroup objdetect
+//! @{
+
+class CV_EXPORTS DetectionBasedTracker
+{
+    public:
+        struct Parameters
+        {
+            int maxTrackLifetime;
+            int minDetectionPeriod; //the minimal time between run of the big object detector (on the whole frame) in ms (1000 mean 1 sec), default=0
+
+            Parameters();
+        };
+
+        class IDetector
+        {
+            public:
+                IDetector():
+                    minObjSize(96, 96),
+                    maxObjSize(INT_MAX, INT_MAX),
+                    minNeighbours(2),
+                    scaleFactor(1.1f)
+                {}
+
+                virtual void detect(const cv::Mat& image, std::vector<cv::Rect>& objects) = 0;
+
+                void setMinObjectSize(const cv::Size& min)
+                {
+                    minObjSize = min;
+                }
+                void setMaxObjectSize(const cv::Size& max)
+                {
+                    maxObjSize = max;
+                }
+                cv::Size getMinObjectSize() const
+                {
+                    return minObjSize;
+                }
+                cv::Size getMaxObjectSize() const
+                {
+                    return maxObjSize;
+                }
+                float getScaleFactor()
+                {
+                    return scaleFactor;
+                }
+                void setScaleFactor(float value)
+                {
+                    scaleFactor = value;
+                }
+                int getMinNeighbours()
+                {
+                    return minNeighbours;
+                }
+                void setMinNeighbours(int value)
+                {
+                    minNeighbours = value;
+                }
+                virtual ~IDetector() {}
+
+            protected:
+                cv::Size minObjSize;
+                cv::Size maxObjSize;
+                int minNeighbours;
+                float scaleFactor;
+        };
+
+        DetectionBasedTracker(cv::Ptr<IDetector> mainDetector, cv::Ptr<IDetector> trackingDetector, const Parameters& params);
+        virtual ~DetectionBasedTracker();
+
+        virtual bool run();
+        virtual void stop();
+        virtual void resetTracking();
+
+        virtual void process(const cv::Mat& imageGray);
+
+        bool setParameters(const Parameters& params);
+        const Parameters& getParameters() const;
+
+
+        typedef std::pair<cv::Rect, int> Object;
+        virtual void getObjects(std::vector<cv::Rect>& result) const;
+        virtual void getObjects(std::vector<Object>& result) const;
+
+        enum ObjectStatus
+        {
+            DETECTED_NOT_SHOWN_YET,
+            DETECTED,
+            DETECTED_TEMPORARY_LOST,
+            WRONG_OBJECT
+        };
+        struct ExtObject
+        {
+            int id;
+            cv::Rect location;
+            ObjectStatus status;
+            ExtObject(int _id, cv::Rect _location, ObjectStatus _status)
+                :id(_id), location(_location), status(_status)
+            {
+            }
+        };
+        virtual void getObjects(std::vector<ExtObject>& result) const;
+
+
+        virtual int addObject(const cv::Rect& location); //returns id of the new object
+
+    protected:
+        class SeparateDetectionWork;
+        cv::Ptr<SeparateDetectionWork> separateDetectionWork;
+        friend void* workcycleObjectDetectorFunction(void* p);
+
+        struct InnerParameters
+        {
+            int numLastPositionsToTrack;
+            int numStepsToWaitBeforeFirstShow;
+            int numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown;
+            int numStepsToShowWithoutDetecting;
+
+            float coeffTrackingWindowSize;
+            float coeffObjectSizeToTrack;
+            float coeffObjectSpeedUsingInPrediction;
+
+            InnerParameters();
+        };
+        Parameters parameters;
+        InnerParameters innerParameters;
+
+        struct TrackedObject
+        {
+            typedef std::vector<cv::Rect> PositionsVector;
+
+            PositionsVector lastPositions;
+
+            int numDetectedFrames;
+            int numFramesNotDetected;
+            int id;
+
+            TrackedObject(const cv::Rect& rect):numDetectedFrames(1), numFramesNotDetected(0)
+            {
+                lastPositions.push_back(rect);
+                id=getNextId();
+            };
+
+            static int getNextId()
+            {
+                static int _id=0;
+                return _id++;
+            }
+        };
+
+        int numTrackedSteps;
+        std::vector<TrackedObject> trackedObjects;
+
+        std::vector<float> weightsPositionsSmoothing;
+        std::vector<float> weightsSizesSmoothing;
+
+        cv::Ptr<IDetector> cascadeForTracking;
+
+        void updateTrackedObjects(const std::vector<cv::Rect>& detectedObjects);
+        cv::Rect calcTrackedObjectPositionToShow(int i) const;
+        cv::Rect calcTrackedObjectPositionToShow(int i, ObjectStatus& status) const;
+        void detectInRegion(const cv::Mat& img, const cv::Rect& r, std::vector<cv::Rect>& detectedObjectsInRegions);
+};
+
+//! @} objdetect
+
+} //end of cv namespace
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp
new file mode 100644
index 0000000..3ee284f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/objdetect.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h
new file mode 100644
index 0000000..632a438
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/objdetect/objdetect_c.h
@@ -0,0 +1,165 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_OBJDETECT_C_H__
+#define __OPENCV_OBJDETECT_C_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+#include <deque>
+#include <vector>
+
+extern "C" {
+#endif
+
+/** @addtogroup objdetect_c
+  @{
+  */
+
+/****************************************************************************************\
+*                         Haar-like Object Detection functions                           *
+\****************************************************************************************/
+
+#define CV_HAAR_MAGIC_VAL    0x42500000
+#define CV_TYPE_NAME_HAAR    "opencv-haar-classifier"
+
+#define CV_IS_HAAR_CLASSIFIER( haar )                                                    \
+    ((haar) != NULL &&                                                                   \
+    (((const CvHaarClassifierCascade*)(haar))->flags & CV_MAGIC_MASK)==CV_HAAR_MAGIC_VAL)
+
+#define CV_HAAR_FEATURE_MAX  3
+
+typedef struct CvHaarFeature
+{
+    int tilted;
+    struct
+    {
+        CvRect r;
+        float weight;
+    } rect[CV_HAAR_FEATURE_MAX];
+} CvHaarFeature;
+
+typedef struct CvHaarClassifier
+{
+    int count;
+    CvHaarFeature* haar_feature;
+    float* threshold;
+    int* left;
+    int* right;
+    float* alpha;
+} CvHaarClassifier;
+
+typedef struct CvHaarStageClassifier
+{
+    int  count;
+    float threshold;
+    CvHaarClassifier* classifier;
+
+    int next;
+    int child;
+    int parent;
+} CvHaarStageClassifier;
+
+typedef struct CvHidHaarClassifierCascade CvHidHaarClassifierCascade;
+
+typedef struct CvHaarClassifierCascade
+{
+    int  flags;
+    int  count;
+    CvSize orig_window_size;
+    CvSize real_window_size;
+    double scale;
+    CvHaarStageClassifier* stage_classifier;
+    CvHidHaarClassifierCascade* hid_cascade;
+} CvHaarClassifierCascade;
+
+typedef struct CvAvgComp
+{
+    CvRect rect;
+    int neighbors;
+} CvAvgComp;
+
+/* Loads haar classifier cascade from a directory.
+   It is obsolete: convert your cascade to xml and use cvLoad instead */
+CVAPI(CvHaarClassifierCascade*) cvLoadHaarClassifierCascade(
+                    const char* directory, CvSize orig_window_size);
+
+CVAPI(void) cvReleaseHaarClassifierCascade( CvHaarClassifierCascade** cascade );
+
+#define CV_HAAR_DO_CANNY_PRUNING    1
+#define CV_HAAR_SCALE_IMAGE         2
+#define CV_HAAR_FIND_BIGGEST_OBJECT 4
+#define CV_HAAR_DO_ROUGH_SEARCH     8
+
+CVAPI(CvSeq*) cvHaarDetectObjects( const CvArr* image,
+                     CvHaarClassifierCascade* cascade, CvMemStorage* storage,
+                     double scale_factor CV_DEFAULT(1.1),
+                     int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0),
+                     CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0)));
+
+/* sets images for haar classifier cascade */
+CVAPI(void) cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade,
+                                                const CvArr* sum, const CvArr* sqsum,
+                                                const CvArr* tilted_sum, double scale );
+
+/* runs the cascade on the specified window */
+CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade,
+                                       CvPoint pt, int start_stage CV_DEFAULT(0));
+
+/** @} objdetect_c */
+
+#ifdef __cplusplus
+}
+
+CV_EXPORTS CvSeq* cvHaarDetectObjectsForROC( const CvArr* image,
+                     CvHaarClassifierCascade* cascade, CvMemStorage* storage,
+                     std::vector<int>& rejectLevels, std::vector<double>& levelWeightds,
+                     double scale_factor = 1.1,
+                     int min_neighbors = 3, int flags = 0,
+                     CvSize min_size = cvSize(0, 0), CvSize max_size = cvSize(0, 0),
+                     bool outputRejectLevels = false );
+
+#endif
+
+#endif /* __OPENCV_OBJDETECT_C_H__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/opencv.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/opencv.hpp
new file mode 100644
index 0000000..fd9ca58
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/opencv.hpp
@@ -0,0 +1,58 @@
+/*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-2010, 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*/
+
+#ifndef __OPENCV_ALL_HPP__
+#define __OPENCV_ALL_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/photo.hpp"
+#include "opencv2/video.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/objdetect.hpp"
+#include "opencv2/calib3d.hpp"
+#include "opencv2/imgcodecs.hpp"
+#include "opencv2/videoio.hpp"
+#include "opencv2/highgui.hpp"
+#include "opencv2/ml.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp
new file mode 100644
index 0000000..42dd908
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/opencv_modules.hpp
@@ -0,0 +1,27 @@
+/*
+ *      ** File generated automatically, do not modify **
+ *
+ * This file defines the list of modules available in current build configuration
+ *
+ *
+*/
+
+#define HAVE_OPENCV_CALIB3D
+#define HAVE_OPENCV_CORE
+#define HAVE_OPENCV_FEATURES2D
+#define HAVE_OPENCV_FLANN
+#define HAVE_OPENCV_HIGHGUI
+#define HAVE_OPENCV_IMGCODECS
+#define HAVE_OPENCV_IMGPROC
+#define HAVE_OPENCV_ML
+#define HAVE_OPENCV_OBJDETECT
+#define HAVE_OPENCV_PHOTO
+#define HAVE_OPENCV_SHAPE
+#define HAVE_OPENCV_STITCHING
+#define HAVE_OPENCV_SUPERRES
+#define HAVE_OPENCV_VIDEO
+#define HAVE_OPENCV_VIDEOIO
+#define HAVE_OPENCV_VIDEOSTAB
+#define HAVE_OPENCV_WORLD
+
+
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/photo.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/photo.hpp
new file mode 100644
index 0000000..c093f65
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/photo.hpp
@@ -0,0 +1,870 @@
+/*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) 2008-2012, 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*/
+
+#ifndef __OPENCV_PHOTO_HPP__
+#define __OPENCV_PHOTO_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+
+/**
+@defgroup photo Computational Photography
+@{
+    @defgroup photo_denoise Denoising
+    @defgroup photo_hdr HDR imaging
+
+This section describes high dynamic range imaging algorithms namely tonemapping, exposure alignment,
+camera calibration with multiple exposures and exposure fusion.
+
+    @defgroup photo_clone Seamless Cloning
+    @defgroup photo_render Non-Photorealistic Rendering
+    @defgroup photo_c C API
+@}
+  */
+
+namespace cv
+{
+
+//! @addtogroup photo
+//! @{
+
+//! the inpainting algorithm
+enum
+{
+    INPAINT_NS    = 0, // Navier-Stokes algorithm
+    INPAINT_TELEA = 1 // A. Telea algorithm
+};
+
+enum
+{
+    NORMAL_CLONE = 1,
+    MIXED_CLONE  = 2,
+    MONOCHROME_TRANSFER = 3
+};
+
+enum
+{
+    RECURS_FILTER = 1,
+    NORMCONV_FILTER = 2
+};
+
+/** @brief Restores the selected region in an image using the region neighborhood.
+
+@param src Input 8-bit 1-channel or 3-channel image.
+@param inpaintMask Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that
+needs to be inpainted.
+@param dst Output image with the same size and type as src .
+@param inpaintRadius Radius of a circular neighborhood of each point inpainted that is considered
+by the algorithm.
+@param flags Inpainting method that could be one of the following:
+-   **INPAINT_NS** Navier-Stokes based method [Navier01]
+-   **INPAINT_TELEA** Method by Alexandru Telea @cite Telea04 .
+
+The function reconstructs the selected image area from the pixel near the area boundary. The
+function may be used to remove dust and scratches from a scanned photo, or to remove undesirable
+objects from still images or video. See <http://en.wikipedia.org/wiki/Inpainting> for more details.
+
+@note
+   -   An example using the inpainting technique can be found at
+        opencv_source_code/samples/cpp/inpaint.cpp
+    -   (Python) An example using the inpainting technique can be found at
+        opencv_source_code/samples/python/inpaint.py
+ */
+CV_EXPORTS_W void inpaint( InputArray src, InputArray inpaintMask,
+        OutputArray dst, double inpaintRadius, int flags );
+
+//! @addtogroup photo_denoise
+//! @{
+
+/** @brief Perform image denoising using Non-local Means Denoising algorithm
+<http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/> with several computational
+optimizations. Noise expected to be a gaussian white noise
+
+@param src Input 8-bit 1-channel, 2-channel, 3-channel or 4-channel image.
+@param dst Output image with the same size and type as src .
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Parameter regulating filter strength. Big h value perfectly removes noise but also
+removes image details, smaller h value preserves details but also preserves some noise
+
+This function expected to be applied to grayscale images. For colored images look at
+fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored
+image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting
+image to CIELAB colorspace and then separately denoise L and AB components with different h
+parameter.
+ */
+CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst, float h = 3,
+        int templateWindowSize = 7, int searchWindowSize = 21);
+
+/** @brief Perform image denoising using Non-local Means Denoising algorithm
+<http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/> with several computational
+optimizations. Noise expected to be a gaussian white noise
+
+@param src Input 8-bit or 16-bit (only with NORM_L1) 1-channel,
+2-channel, 3-channel or 4-channel image.
+@param dst Output image with the same size and type as src .
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Array of parameters regulating filter strength, either one
+parameter applied to all channels or one per channel in dst. Big h value
+perfectly removes noise but also removes image details, smaller h
+value preserves details but also preserves some noise
+@param normType Type of norm used for weight calculation. Can be either NORM_L2 or NORM_L1
+
+This function expected to be applied to grayscale images. For colored images look at
+fastNlMeansDenoisingColored. Advanced usage of this functions can be manual denoising of colored
+image in different colorspaces. Such approach is used in fastNlMeansDenoisingColored by converting
+image to CIELAB colorspace and then separately denoise L and AB components with different h
+parameter.
+ */
+CV_EXPORTS_W void fastNlMeansDenoising( InputArray src, OutputArray dst,
+                                        const std::vector<float>& h,
+                                        int templateWindowSize = 7, int searchWindowSize = 21,
+                                        int normType = NORM_L2);
+
+/** @brief Modification of fastNlMeansDenoising function for colored images
+
+@param src Input 8-bit 3-channel image.
+@param dst Output image with the same size and type as src .
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Parameter regulating filter strength for luminance component. Bigger h value perfectly
+removes noise but also removes image details, smaller h value preserves details but also preserves
+some noise
+@param hColor The same as h but for color components. For most images value equals 10
+will be enough to remove colored noise and do not distort colors
+
+The function converts image to CIELAB colorspace and then separately denoise L and AB components
+with given h parameters using fastNlMeansDenoising function.
+ */
+CV_EXPORTS_W void fastNlMeansDenoisingColored( InputArray src, OutputArray dst,
+        float h = 3, float hColor = 3,
+        int templateWindowSize = 7, int searchWindowSize = 21);
+
+/** @brief Modification of fastNlMeansDenoising function for images sequence where consequtive images have been
+captured in small period of time. For example video. This version of the function is for grayscale
+images or for manual manipulation with colorspaces. For more details see
+<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394>
+
+@param srcImgs Input 8-bit 1-channel, 2-channel, 3-channel or
+4-channel images sequence. All images should have the same type and
+size.
+@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence
+@param temporalWindowSize Number of surrounding images to use for target image denoising. Should
+be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
+imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
+srcImgs[imgToDenoiseIndex] image.
+@param dst Output image with the same size and type as srcImgs images.
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Parameter regulating filter strength. Bigger h value
+perfectly removes noise but also removes image details, smaller h
+value preserves details but also preserves some noise
+ */
+CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst,
+        int imgToDenoiseIndex, int temporalWindowSize,
+        float h = 3, int templateWindowSize = 7, int searchWindowSize = 21);
+
+/** @brief Modification of fastNlMeansDenoising function for images sequence where consequtive images have been
+captured in small period of time. For example video. This version of the function is for grayscale
+images or for manual manipulation with colorspaces. For more details see
+<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.6394>
+
+@param srcImgs Input 8-bit or 16-bit (only with NORM_L1) 1-channel,
+2-channel, 3-channel or 4-channel images sequence. All images should
+have the same type and size.
+@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence
+@param temporalWindowSize Number of surrounding images to use for target image denoising. Should
+be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
+imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
+srcImgs[imgToDenoiseIndex] image.
+@param dst Output image with the same size and type as srcImgs images.
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Array of parameters regulating filter strength, either one
+parameter applied to all channels or one per channel in dst. Big h value
+perfectly removes noise but also removes image details, smaller h
+value preserves details but also preserves some noise
+@param normType Type of norm used for weight calculation. Can be either NORM_L2 or NORM_L1
+ */
+CV_EXPORTS_W void fastNlMeansDenoisingMulti( InputArrayOfArrays srcImgs, OutputArray dst,
+                                             int imgToDenoiseIndex, int temporalWindowSize,
+                                             const std::vector<float>& h,
+                                             int templateWindowSize = 7, int searchWindowSize = 21,
+                                             int normType = NORM_L2);
+
+/** @brief Modification of fastNlMeansDenoisingMulti function for colored images sequences
+
+@param srcImgs Input 8-bit 3-channel images sequence. All images should have the same type and
+size.
+@param imgToDenoiseIndex Target image to denoise index in srcImgs sequence
+@param temporalWindowSize Number of surrounding images to use for target image denoising. Should
+be odd. Images from imgToDenoiseIndex - temporalWindowSize / 2 to
+imgToDenoiseIndex - temporalWindowSize / 2 from srcImgs will be used to denoise
+srcImgs[imgToDenoiseIndex] image.
+@param dst Output image with the same size and type as srcImgs images.
+@param templateWindowSize Size in pixels of the template patch that is used to compute weights.
+Should be odd. Recommended value 7 pixels
+@param searchWindowSize Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater searchWindowsSize - greater
+denoising time. Recommended value 21 pixels
+@param h Parameter regulating filter strength for luminance component. Bigger h value perfectly
+removes noise but also removes image details, smaller h value preserves details but also preserves
+some noise.
+@param hColor The same as h but for color components.
+
+The function converts images to CIELAB colorspace and then separately denoise L and AB components
+with given h parameters using fastNlMeansDenoisingMulti function.
+ */
+CV_EXPORTS_W void fastNlMeansDenoisingColoredMulti( InputArrayOfArrays srcImgs, OutputArray dst,
+        int imgToDenoiseIndex, int temporalWindowSize,
+        float h = 3, float hColor = 3,
+        int templateWindowSize = 7, int searchWindowSize = 21);
+
+/** @brief Primal-dual algorithm is an algorithm for solving special types of variational problems (that is,
+finding a function to minimize some functional). As the image denoising, in particular, may be seen
+as the variational problem, primal-dual algorithm then can be used to perform denoising and this is
+exactly what is implemented.
+
+It should be noted, that this implementation was taken from the July 2013 blog entry
+@cite MA13 , which also contained (slightly more general) ready-to-use source code on Python.
+Subsequently, that code was rewritten on C++ with the usage of openCV by Vadim Pisarevsky at the end
+of July 2013 and finally it was slightly adapted by later authors.
+
+Although the thorough discussion and justification of the algorithm involved may be found in
+@cite ChambolleEtAl, it might make sense to skim over it here, following @cite MA13 . To begin
+with, we consider the 1-byte gray-level images as the functions from the rectangular domain of
+pixels (it may be seen as set
+\f$\left\{(x,y)\in\mathbb{N}\times\mathbb{N}\mid 1\leq x\leq n,\;1\leq y\leq m\right\}\f$ for some
+\f$m,\;n\in\mathbb{N}\f$) into \f$\{0,1,\dots,255\}\f$. We shall denote the noised images as \f$f_i\f$ and with
+this view, given some image \f$x\f$ of the same size, we may measure how bad it is by the formula
+
+\f[\left\|\left\|\nabla x\right\|\right\| + \lambda\sum_i\left\|\left\|x-f_i\right\|\right\|\f]
+
+\f$\|\|\cdot\|\|\f$ here denotes \f$L_2\f$-norm and as you see, the first addend states that we want our
+image to be smooth (ideally, having zero gradient, thus being constant) and the second states that
+we want our result to be close to the observations we've got. If we treat \f$x\f$ as a function, this is
+exactly the functional what we seek to minimize and here the Primal-Dual algorithm comes into play.
+
+@param observations This array should contain one or more noised versions of the image that is to
+be restored.
+@param result Here the denoised image will be stored. There is no need to do pre-allocation of
+storage space, as it will be automatically allocated, if necessary.
+@param lambda Corresponds to \f$\lambda\f$ in the formulas above. As it is enlarged, the smooth
+(blurred) images are treated more favorably than detailed (but maybe more noised) ones. Roughly
+speaking, as it becomes smaller, the result will be more blur but more sever outliers will be
+removed.
+@param niters Number of iterations that the algorithm will run. Of course, as more iterations as
+better, but it is hard to quantitatively refine this statement, so just use the default and
+increase it if the results are poor.
+ */
+CV_EXPORTS_W void denoise_TVL1(const std::vector<Mat>& observations,Mat& result, double lambda=1.0, int niters=30);
+
+//! @} photo_denoise
+
+//! @addtogroup photo_hdr
+//! @{
+
+enum { LDR_SIZE = 256 };
+
+/** @brief Base class for tonemapping algorithms - tools that are used to map HDR image to 8-bit range.
+ */
+class CV_EXPORTS_W Tonemap : public Algorithm
+{
+public:
+    /** @brief Tonemaps image
+
+    @param src source image - 32-bit 3-channel Mat
+    @param dst destination image - 32-bit 3-channel Mat with values in [0, 1] range
+     */
+    CV_WRAP virtual void process(InputArray src, OutputArray dst) = 0;
+
+    CV_WRAP virtual float getGamma() const = 0;
+    CV_WRAP virtual void setGamma(float gamma) = 0;
+};
+
+/** @brief Creates simple linear mapper with gamma correction
+
+@param gamma positive value for gamma correction. Gamma value of 1.0 implies no correction, gamma
+equal to 2.2f is suitable for most displays.
+Generally gamma \> 1 brightens the image and gamma \< 1 darkens it.
+ */
+CV_EXPORTS_W Ptr<Tonemap> createTonemap(float gamma = 1.0f);
+
+/** @brief Adaptive logarithmic mapping is a fast global tonemapping algorithm that scales the image in
+logarithmic domain.
+
+Since it's a global operator the same function is applied to all the pixels, it is controlled by the
+bias parameter.
+
+Optional saturation enhancement is possible as described in @cite FL02 .
+
+For more information see @cite DM03 .
+ */
+class CV_EXPORTS_W TonemapDrago : public Tonemap
+{
+public:
+
+    CV_WRAP virtual float getSaturation() const = 0;
+    CV_WRAP virtual void setSaturation(float saturation) = 0;
+
+    CV_WRAP virtual float getBias() const = 0;
+    CV_WRAP virtual void setBias(float bias) = 0;
+};
+
+/** @brief Creates TonemapDrago object
+
+@param gamma gamma value for gamma correction. See createTonemap
+@param saturation positive saturation enhancement value. 1.0 preserves saturation, values greater
+than 1 increase saturation and values less than 1 decrease it.
+@param bias value for bias function in [0, 1] range. Values from 0.7 to 0.9 usually give best
+results, default value is 0.85.
+ */
+CV_EXPORTS_W Ptr<TonemapDrago> createTonemapDrago(float gamma = 1.0f, float saturation = 1.0f, float bias = 0.85f);
+
+/** @brief This algorithm decomposes image into two layers: base layer and detail layer using bilateral filter
+and compresses contrast of the base layer thus preserving all the details.
+
+This implementation uses regular bilateral filter from opencv.
+
+Saturation enhancement is possible as in ocvTonemapDrago.
+
+For more information see @cite DD02 .
+ */
+class CV_EXPORTS_W TonemapDurand : public Tonemap
+{
+public:
+
+    CV_WRAP virtual float getSaturation() const = 0;
+    CV_WRAP virtual void setSaturation(float saturation) = 0;
+
+    CV_WRAP virtual float getContrast() const = 0;
+    CV_WRAP virtual void setContrast(float contrast) = 0;
+
+    CV_WRAP virtual float getSigmaSpace() const = 0;
+    CV_WRAP virtual void setSigmaSpace(float sigma_space) = 0;
+
+    CV_WRAP virtual float getSigmaColor() const = 0;
+    CV_WRAP virtual void setSigmaColor(float sigma_color) = 0;
+};
+
+/** @brief Creates TonemapDurand object
+
+@param gamma gamma value for gamma correction. See createTonemap
+@param contrast resulting contrast on logarithmic scale, i. e. log(max / min), where max and min
+are maximum and minimum luminance values of the resulting image.
+@param saturation saturation enhancement value. See createTonemapDrago
+@param sigma_space bilateral filter sigma in color space
+@param sigma_color bilateral filter sigma in coordinate space
+ */
+CV_EXPORTS_W Ptr<TonemapDurand>
+createTonemapDurand(float gamma = 1.0f, float contrast = 4.0f, float saturation = 1.0f, float sigma_space = 2.0f, float sigma_color = 2.0f);
+
+/** @brief This is a global tonemapping operator that models human visual system.
+
+Mapping function is controlled by adaptation parameter, that is computed using light adaptation and
+color adaptation.
+
+For more information see @cite RD05 .
+ */
+class CV_EXPORTS_W TonemapReinhard : public Tonemap
+{
+public:
+    CV_WRAP virtual float getIntensity() const = 0;
+    CV_WRAP virtual void setIntensity(float intensity) = 0;
+
+    CV_WRAP virtual float getLightAdaptation() const = 0;
+    CV_WRAP virtual void setLightAdaptation(float light_adapt) = 0;
+
+    CV_WRAP virtual float getColorAdaptation() const = 0;
+    CV_WRAP virtual void setColorAdaptation(float color_adapt) = 0;
+};
+
+/** @brief Creates TonemapReinhard object
+
+@param gamma gamma value for gamma correction. See createTonemap
+@param intensity result intensity in [-8, 8] range. Greater intensity produces brighter results.
+@param light_adapt light adaptation in [0, 1] range. If 1 adaptation is based only on pixel
+value, if 0 it's global, otherwise it's a weighted mean of this two cases.
+@param color_adapt chromatic adaptation in [0, 1] range. If 1 channels are treated independently,
+if 0 adaptation level is the same for each channel.
+ */
+CV_EXPORTS_W Ptr<TonemapReinhard>
+createTonemapReinhard(float gamma = 1.0f, float intensity = 0.0f, float light_adapt = 1.0f, float color_adapt = 0.0f);
+
+/** @brief This algorithm transforms image to contrast using gradients on all levels of gaussian pyramid,
+transforms contrast values to HVS response and scales the response. After this the image is
+reconstructed from new contrast values.
+
+For more information see @cite MM06 .
+ */
+class CV_EXPORTS_W TonemapMantiuk : public Tonemap
+{
+public:
+    CV_WRAP virtual float getScale() const = 0;
+    CV_WRAP virtual void setScale(float scale) = 0;
+
+    CV_WRAP virtual float getSaturation() const = 0;
+    CV_WRAP virtual void setSaturation(float saturation) = 0;
+};
+
+/** @brief Creates TonemapMantiuk object
+
+@param gamma gamma value for gamma correction. See createTonemap
+@param scale contrast scale factor. HVS response is multiplied by this parameter, thus compressing
+dynamic range. Values from 0.6 to 0.9 produce best results.
+@param saturation saturation enhancement value. See createTonemapDrago
+ */
+CV_EXPORTS_W Ptr<TonemapMantiuk>
+createTonemapMantiuk(float gamma = 1.0f, float scale = 0.7f, float saturation = 1.0f);
+
+/** @brief The base class for algorithms that align images of the same scene with different exposures
+ */
+class CV_EXPORTS_W AlignExposures : public Algorithm
+{
+public:
+    /** @brief Aligns images
+
+    @param src vector of input images
+    @param dst vector of aligned images
+    @param times vector of exposure time values for each image
+    @param response 256x1 matrix with inverse camera response function for each pixel value, it should
+    have the same number of channels as images.
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst,
+                                 InputArray times, InputArray response) = 0;
+};
+
+/** @brief This algorithm converts images to median threshold bitmaps (1 for pixels brighter than median
+luminance and 0 otherwise) and than aligns the resulting bitmaps using bit operations.
+
+It is invariant to exposure, so exposure values and camera response are not necessary.
+
+In this implementation new image regions are filled with zeros.
+
+For more information see @cite GW03 .
+ */
+class CV_EXPORTS_W AlignMTB : public AlignExposures
+{
+public:
+    CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst,
+                                 InputArray times, InputArray response) = 0;
+
+    /** @brief Short version of process, that doesn't take extra arguments.
+
+    @param src vector of input images
+    @param dst vector of aligned images
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, std::vector<Mat>& dst) = 0;
+
+    /** @brief Calculates shift between two images, i. e. how to shift the second image to correspond it with the
+    first.
+
+    @param img0 first image
+    @param img1 second image
+     */
+    CV_WRAP virtual Point calculateShift(InputArray img0, InputArray img1) = 0;
+    /** @brief Helper function, that shift Mat filling new regions with zeros.
+
+    @param src input image
+    @param dst result image
+    @param shift shift value
+     */
+    CV_WRAP virtual void shiftMat(InputArray src, OutputArray dst, const Point shift) = 0;
+    /** @brief Computes median threshold and exclude bitmaps of given image.
+
+    @param img input image
+    @param tb median threshold bitmap
+    @param eb exclude bitmap
+     */
+    CV_WRAP virtual void computeBitmaps(InputArray img, OutputArray tb, OutputArray eb) = 0;
+
+    CV_WRAP virtual int getMaxBits() const = 0;
+    CV_WRAP virtual void setMaxBits(int max_bits) = 0;
+
+    CV_WRAP virtual int getExcludeRange() const = 0;
+    CV_WRAP virtual void setExcludeRange(int exclude_range) = 0;
+
+    CV_WRAP virtual bool getCut() const = 0;
+    CV_WRAP virtual void setCut(bool value) = 0;
+};
+
+/** @brief Creates AlignMTB object
+
+@param max_bits logarithm to the base 2 of maximal shift in each dimension. Values of 5 and 6 are
+usually good enough (31 and 63 pixels shift respectively).
+@param exclude_range range for exclusion bitmap that is constructed to suppress noise around the
+median value.
+@param cut if true cuts images, otherwise fills the new regions with zeros.
+ */
+CV_EXPORTS_W Ptr<AlignMTB> createAlignMTB(int max_bits = 6, int exclude_range = 4, bool cut = true);
+
+/** @brief The base class for camera response calibration algorithms.
+ */
+class CV_EXPORTS_W CalibrateCRF : public Algorithm
+{
+public:
+    /** @brief Recovers inverse camera response.
+
+    @param src vector of input images
+    @param dst 256x1 matrix with inverse camera response function
+    @param times vector of exposure time values for each image
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0;
+};
+
+/** @brief Inverse camera response function is extracted for each brightness value by minimizing an objective
+function as linear system. Objective function is constructed using pixel values on the same position
+in all images, extra term is added to make the result smoother.
+
+For more information see @cite DM97 .
+ */
+class CV_EXPORTS_W CalibrateDebevec : public CalibrateCRF
+{
+public:
+    CV_WRAP virtual float getLambda() const = 0;
+    CV_WRAP virtual void setLambda(float lambda) = 0;
+
+    CV_WRAP virtual int getSamples() const = 0;
+    CV_WRAP virtual void setSamples(int samples) = 0;
+
+    CV_WRAP virtual bool getRandom() const = 0;
+    CV_WRAP virtual void setRandom(bool random) = 0;
+};
+
+/** @brief Creates CalibrateDebevec object
+
+@param samples number of pixel locations to use
+@param lambda smoothness term weight. Greater values produce smoother results, but can alter the
+response.
+@param random if true sample pixel locations are chosen at random, otherwise the form a
+rectangular grid.
+ */
+CV_EXPORTS_W Ptr<CalibrateDebevec> createCalibrateDebevec(int samples = 70, float lambda = 10.0f, bool random = false);
+
+/** @brief Inverse camera response function is extracted for each brightness value by minimizing an objective
+function as linear system. This algorithm uses all image pixels.
+
+For more information see @cite RB99 .
+ */
+class CV_EXPORTS_W CalibrateRobertson : public CalibrateCRF
+{
+public:
+    CV_WRAP virtual int getMaxIter() const = 0;
+    CV_WRAP virtual void setMaxIter(int max_iter) = 0;
+
+    CV_WRAP virtual float getThreshold() const = 0;
+    CV_WRAP virtual void setThreshold(float threshold) = 0;
+
+    CV_WRAP virtual Mat getRadiance() const = 0;
+};
+
+/** @brief Creates CalibrateRobertson object
+
+@param max_iter maximal number of Gauss-Seidel solver iterations.
+@param threshold target difference between results of two successive steps of the minimization.
+ */
+CV_EXPORTS_W Ptr<CalibrateRobertson> createCalibrateRobertson(int max_iter = 30, float threshold = 0.01f);
+
+/** @brief The base class algorithms that can merge exposure sequence to a single image.
+ */
+class CV_EXPORTS_W MergeExposures : public Algorithm
+{
+public:
+    /** @brief Merges images.
+
+    @param src vector of input images
+    @param dst result image
+    @param times vector of exposure time values for each image
+    @param response 256x1 matrix with inverse camera response function for each pixel value, it should
+    have the same number of channels as images.
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
+                                 InputArray times, InputArray response) = 0;
+};
+
+/** @brief The resulting HDR image is calculated as weighted average of the exposures considering exposure
+values and camera response.
+
+For more information see @cite DM97 .
+ */
+class CV_EXPORTS_W MergeDebevec : public MergeExposures
+{
+public:
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
+                                 InputArray times, InputArray response) = 0;
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0;
+};
+
+/** @brief Creates MergeDebevec object
+ */
+CV_EXPORTS_W Ptr<MergeDebevec> createMergeDebevec();
+
+/** @brief Pixels are weighted using contrast, saturation and well-exposedness measures, than images are
+combined using laplacian pyramids.
+
+The resulting image weight is constructed as weighted average of contrast, saturation and
+well-exposedness measures.
+
+The resulting image doesn't require tonemapping and can be converted to 8-bit image by multiplying
+by 255, but it's recommended to apply gamma correction and/or linear tonemapping.
+
+For more information see @cite MK07 .
+ */
+class CV_EXPORTS_W MergeMertens : public MergeExposures
+{
+public:
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
+                                 InputArray times, InputArray response) = 0;
+    /** @brief Short version of process, that doesn't take extra arguments.
+
+    @param src vector of input images
+    @param dst result image
+     */
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst) = 0;
+
+    CV_WRAP virtual float getContrastWeight() const = 0;
+    CV_WRAP virtual void setContrastWeight(float contrast_weiht) = 0;
+
+    CV_WRAP virtual float getSaturationWeight() const = 0;
+    CV_WRAP virtual void setSaturationWeight(float saturation_weight) = 0;
+
+    CV_WRAP virtual float getExposureWeight() const = 0;
+    CV_WRAP virtual void setExposureWeight(float exposure_weight) = 0;
+};
+
+/** @brief Creates MergeMertens object
+
+@param contrast_weight contrast measure weight. See MergeMertens.
+@param saturation_weight saturation measure weight
+@param exposure_weight well-exposedness measure weight
+ */
+CV_EXPORTS_W Ptr<MergeMertens>
+createMergeMertens(float contrast_weight = 1.0f, float saturation_weight = 1.0f, float exposure_weight = 0.0f);
+
+/** @brief The resulting HDR image is calculated as weighted average of the exposures considering exposure
+values and camera response.
+
+For more information see @cite RB99 .
+ */
+class CV_EXPORTS_W MergeRobertson : public MergeExposures
+{
+public:
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst,
+                                 InputArray times, InputArray response) = 0;
+    CV_WRAP virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times) = 0;
+};
+
+/** @brief Creates MergeRobertson object
+ */
+CV_EXPORTS_W Ptr<MergeRobertson> createMergeRobertson();
+
+//! @} photo_hdr
+
+/** @brief Transforms a color image to a grayscale image. It is a basic tool in digital printing, stylized
+black-and-white photograph rendering, and in many single channel image processing applications
+@cite CL12 .
+
+@param src Input 8-bit 3-channel image.
+@param grayscale Output 8-bit 1-channel image.
+@param color_boost Output 8-bit 3-channel image.
+
+This function is to be applied on color images.
+ */
+CV_EXPORTS_W void decolor( InputArray src, OutputArray grayscale, OutputArray color_boost);
+
+//! @addtogroup photo_clone
+//! @{
+
+/** @brief Image editing tasks concern either global changes (color/intensity corrections, filters,
+deformations) or local changes concerned to a selection. Here we are interested in achieving local
+changes, ones that are restricted to a region manually selected (ROI), in a seamless and effortless
+manner. The extent of the changes ranges from slight distortions to complete replacement by novel
+content @cite PM03 .
+
+@param src Input 8-bit 3-channel image.
+@param dst Input 8-bit 3-channel image.
+@param mask Input 8-bit 1 or 3-channel image.
+@param p Point in dst image where object is placed.
+@param blend Output image with the same size and type as dst.
+@param flags Cloning method that could be one of the following:
+-   **NORMAL_CLONE** The power of the method is fully expressed when inserting objects with
+complex outlines into a new background
+-   **MIXED_CLONE** The classic method, color-based selection and alpha masking might be time
+consuming and often leaves an undesirable halo. Seamless cloning, even averaged with the
+original image, is not effective. Mixed seamless cloning based on a loose selection proves
+effective.
+-   **FEATURE_EXCHANGE** Feature exchange allows the user to easily replace certain features of
+one object by alternative features.
+ */
+CV_EXPORTS_W void seamlessClone( InputArray src, InputArray dst, InputArray mask, Point p,
+        OutputArray blend, int flags);
+
+/** @brief Given an original color image, two differently colored versions of this image can be mixed
+seamlessly.
+
+@param src Input 8-bit 3-channel image.
+@param mask Input 8-bit 1 or 3-channel image.
+@param dst Output image with the same size and type as src .
+@param red_mul R-channel multiply factor.
+@param green_mul G-channel multiply factor.
+@param blue_mul B-channel multiply factor.
+
+Multiplication factor is between .5 to 2.5.
+ */
+CV_EXPORTS_W void colorChange(InputArray src, InputArray mask, OutputArray dst, float red_mul = 1.0f,
+        float green_mul = 1.0f, float blue_mul = 1.0f);
+
+/** @brief Applying an appropriate non-linear transformation to the gradient field inside the selection and
+then integrating back with a Poisson solver, modifies locally the apparent illumination of an image.
+
+@param src Input 8-bit 3-channel image.
+@param mask Input 8-bit 1 or 3-channel image.
+@param dst Output image with the same size and type as src.
+@param alpha Value ranges between 0-2.
+@param beta Value ranges between 0-2.
+
+This is useful to highlight under-exposed foreground objects or to reduce specular reflections.
+ */
+CV_EXPORTS_W void illuminationChange(InputArray src, InputArray mask, OutputArray dst,
+        float alpha = 0.2f, float beta = 0.4f);
+
+/** @brief By retaining only the gradients at edge locations, before integrating with the Poisson solver, one
+washes out the texture of the selected region, giving its contents a flat aspect. Here Canny Edge
+Detector is used.
+
+@param src Input 8-bit 3-channel image.
+@param mask Input 8-bit 1 or 3-channel image.
+@param dst Output image with the same size and type as src.
+@param low_threshold Range from 0 to 100.
+@param high_threshold Value \> 100.
+@param kernel_size The size of the Sobel kernel to be used.
+
+**NOTE:**
+
+The algorithm assumes that the color of the source image is close to that of the destination. This
+assumption means that when the colors don't match, the source image color gets tinted toward the
+color of the destination image.
+ */
+CV_EXPORTS_W void textureFlattening(InputArray src, InputArray mask, OutputArray dst,
+        float low_threshold = 30, float high_threshold = 45,
+        int kernel_size = 3);
+
+//! @} photo_clone
+
+//! @addtogroup photo_render
+//! @{
+
+/** @brief Filtering is the fundamental operation in image and video processing. Edge-preserving smoothing
+filters are used in many different applications @cite EM11 .
+
+@param src Input 8-bit 3-channel image.
+@param dst Output 8-bit 3-channel image.
+@param flags Edge preserving filters:
+-   **RECURS_FILTER** = 1
+-   **NORMCONV_FILTER** = 2
+@param sigma_s Range between 0 to 200.
+@param sigma_r Range between 0 to 1.
+ */
+CV_EXPORTS_W void edgePreservingFilter(InputArray src, OutputArray dst, int flags = 1,
+        float sigma_s = 60, float sigma_r = 0.4f);
+
+/** @brief This filter enhances the details of a particular image.
+
+@param src Input 8-bit 3-channel image.
+@param dst Output image with the same size and type as src.
+@param sigma_s Range between 0 to 200.
+@param sigma_r Range between 0 to 1.
+ */
+CV_EXPORTS_W void detailEnhance(InputArray src, OutputArray dst, float sigma_s = 10,
+        float sigma_r = 0.15f);
+
+/** @brief Pencil-like non-photorealistic line drawing
+
+@param src Input 8-bit 3-channel image.
+@param dst1 Output 8-bit 1-channel image.
+@param dst2 Output image with the same size and type as src.
+@param sigma_s Range between 0 to 200.
+@param sigma_r Range between 0 to 1.
+@param shade_factor Range between 0 to 0.1.
+ */
+CV_EXPORTS_W void pencilSketch(InputArray src, OutputArray dst1, OutputArray dst2,
+        float sigma_s = 60, float sigma_r = 0.07f, float shade_factor = 0.02f);
+
+/** @brief Stylization aims to produce digital imagery with a wide variety of effects not focused on
+photorealism. Edge-aware filters are ideal for stylization, as they can abstract regions of low
+contrast while preserving, or enhancing, high-contrast features.
+
+@param src Input 8-bit 3-channel image.
+@param dst Output image with the same size and type as src.
+@param sigma_s Range between 0 to 200.
+@param sigma_r Range between 0 to 1.
+ */
+CV_EXPORTS_W void stylization(InputArray src, OutputArray dst, float sigma_s = 60,
+        float sigma_r = 0.45f);
+
+//! @} photo_render
+
+//! @} photo
+
+} // cv
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/photo/photo_c.h"
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp
new file mode 100644
index 0000000..aeac1fa
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/photo/cuda.hpp
@@ -0,0 +1,132 @@
+/*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) 2008-2012, 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*/
+
+#ifndef __OPENCV_PHOTO_CUDA_HPP__
+#define __OPENCV_PHOTO_CUDA_HPP__
+
+#include "opencv2/core/cuda.hpp"
+
+namespace cv { namespace cuda {
+
+//! @addtogroup photo_denoise
+//! @{
+
+/** @brief Performs pure non local means denoising without any simplification, and thus it is not fast.
+
+@param src Source image. Supports only CV_8UC1, CV_8UC2 and CV_8UC3.
+@param dst Destination image.
+@param h Filter sigma regulating filter strength for color.
+@param search_window Size of search window.
+@param block_size Size of block used for computing weights.
+@param borderMode Border type. See borderInterpolate for details. BORDER_REFLECT101 ,
+BORDER_REPLICATE , BORDER_CONSTANT , BORDER_REFLECT and BORDER_WRAP are supported for now.
+@param stream Stream for the asynchronous version.
+
+@sa
+   fastNlMeansDenoising
+ */
+CV_EXPORTS void nonLocalMeans(InputArray src, OutputArray dst,
+                              float h,
+                              int search_window = 21,
+                              int block_size = 7,
+                              int borderMode = BORDER_DEFAULT,
+                              Stream& stream = Stream::Null());
+
+/** @brief Perform image denoising using Non-local Means Denoising algorithm
+<http://www.ipol.im/pub/algo/bcm_non_local_means_denoising> with several computational
+optimizations. Noise expected to be a gaussian white noise
+
+@param src Input 8-bit 1-channel, 2-channel or 3-channel image.
+@param dst Output image with the same size and type as src .
+@param h Parameter regulating filter strength. Big h value perfectly removes noise but also
+removes image details, smaller h value preserves details but also preserves some noise
+@param search_window Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater search_window - greater
+denoising time. Recommended value 21 pixels
+@param block_size Size in pixels of the template patch that is used to compute weights. Should be
+odd. Recommended value 7 pixels
+@param stream Stream for the asynchronous invocations.
+
+This function expected to be applied to grayscale images. For colored images look at
+FastNonLocalMeansDenoising::labMethod.
+
+@sa
+   fastNlMeansDenoising
+ */
+CV_EXPORTS void fastNlMeansDenoising(InputArray src, OutputArray dst,
+                                     float h,
+                                     int search_window = 21,
+                                     int block_size = 7,
+                                     Stream& stream = Stream::Null());
+
+/** @brief Modification of fastNlMeansDenoising function for colored images
+
+@param src Input 8-bit 3-channel image.
+@param dst Output image with the same size and type as src .
+@param h_luminance Parameter regulating filter strength. Big h value perfectly removes noise but
+also removes image details, smaller h value preserves details but also preserves some noise
+@param photo_render float The same as h but for color components. For most images value equals 10 will be
+enough to remove colored noise and do not distort colors
+@param search_window Size in pixels of the window that is used to compute weighted average for
+given pixel. Should be odd. Affect performance linearly: greater search_window - greater
+denoising time. Recommended value 21 pixels
+@param block_size Size in pixels of the template patch that is used to compute weights. Should be
+odd. Recommended value 7 pixels
+@param stream Stream for the asynchronous invocations.
+
+The function converts image to CIELAB colorspace and then separately denoise L and AB components
+with given h parameters using FastNonLocalMeansDenoising::simpleMethod function.
+
+@sa
+   fastNlMeansDenoisingColored
+ */
+CV_EXPORTS void fastNlMeansDenoisingColored(InputArray src, OutputArray dst,
+                                            float h_luminance, float photo_render,
+                                            int search_window = 21,
+                                            int block_size = 7,
+                                            Stream& stream = Stream::Null());
+
+//! @} photo
+
+}} // namespace cv { namespace cuda {
+
+#endif /* __OPENCV_PHOTO_CUDA_HPP__ */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp
new file mode 100644
index 0000000..8af5e9f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/photo/photo.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/photo.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h
new file mode 100644
index 0000000..07ca9b3
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/photo/photo_c.h
@@ -0,0 +1,74 @@
+/*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) 2008-2012, 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*/
+
+#ifndef __OPENCV_PHOTO_C_H__
+#define __OPENCV_PHOTO_C_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup photo_c
+  @{
+  */
+
+/* Inpainting algorithms */
+enum InpaintingModes
+{
+    CV_INPAINT_NS      =0,
+    CV_INPAINT_TELEA   =1
+};
+
+
+/* Inpaints the selected region in the image */
+CVAPI(void) cvInpaint( const CvArr* src, const CvArr* inpaint_mask,
+                       CvArr* dst, double inpaintRange, int flags );
+
+/** @} */
+
+#ifdef __cplusplus
+} //extern "C"
+#endif
+
+#endif //__OPENCV_PHOTO_C_H__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/shape.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/shape.hpp
new file mode 100644
index 0000000..6999476
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/shape.hpp
@@ -0,0 +1,57 @@
+/*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-2012, 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*/
+
+#ifndef __OPENCV_SHAPE_HPP__
+#define __OPENCV_SHAPE_HPP__
+
+#include "opencv2/shape/emdL1.hpp"
+#include "opencv2/shape/shape_transformer.hpp"
+#include "opencv2/shape/hist_cost.hpp"
+#include "opencv2/shape/shape_distance.hpp"
+
+/**
+  @defgroup shape Shape Distance and Matching
+ */
+
+#endif
+
+/* End of file. */
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp
new file mode 100644
index 0000000..1dfa758
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/emdL1.hpp
@@ -0,0 +1,72 @@
+/*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-2012, 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*/
+
+#ifndef __OPENCV_EMD_L1_HPP__
+#define __OPENCV_EMD_L1_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+/****************************************************************************************\
+*                                   EMDL1 Function                                      *
+\****************************************************************************************/
+
+//! @addtogroup shape
+//! @{
+
+/** @brief Computes the "minimal work" distance between two weighted point configurations base on the papers
+"EMD-L1: An efficient and Robust Algorithm for comparing histogram-based descriptors", by Haibin
+Ling and Kazunori Okuda; and "The Earth Mover's Distance is the Mallows Distance: Some Insights from
+Statistics", by Elizaveta Levina and Peter Bickel.
+
+@param signature1 First signature, a single column floating-point matrix. Each row is the value of
+the histogram in each bin.
+@param signature2 Second signature of the same format and size as signature1.
+ */
+CV_EXPORTS float EMDL1(InputArray signature1, InputArray signature2);
+
+//! @}
+
+}//namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp
new file mode 100644
index 0000000..15c0a87
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/hist_cost.hpp
@@ -0,0 +1,111 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_HIST_COST_HPP__
+#define __OPENCV_HIST_COST_HPP__
+
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+
+//! @addtogroup shape
+//! @{
+
+/** @brief Abstract base class for histogram cost algorithms.
+ */
+class CV_EXPORTS_W HistogramCostExtractor : public Algorithm
+{
+public:
+    CV_WRAP virtual void buildCostMatrix(InputArray descriptors1, InputArray descriptors2, OutputArray costMatrix) = 0;
+
+    CV_WRAP virtual void setNDummies(int nDummies) = 0;
+    CV_WRAP virtual int getNDummies() const = 0;
+
+    CV_WRAP virtual void setDefaultCost(float defaultCost) = 0;
+    CV_WRAP virtual float getDefaultCost() const = 0;
+};
+
+/** @brief A norm based cost extraction. :
+ */
+class CV_EXPORTS_W NormHistogramCostExtractor : public HistogramCostExtractor
+{
+public:
+    CV_WRAP virtual void setNormFlag(int flag) = 0;
+    CV_WRAP virtual int getNormFlag() const = 0;
+};
+
+CV_EXPORTS_W Ptr<HistogramCostExtractor>
+    createNormHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f);
+
+/** @brief An EMD based cost extraction. :
+ */
+class CV_EXPORTS_W EMDHistogramCostExtractor : public HistogramCostExtractor
+{
+public:
+    CV_WRAP virtual void setNormFlag(int flag) = 0;
+    CV_WRAP virtual int getNormFlag() const = 0;
+};
+
+CV_EXPORTS_W Ptr<HistogramCostExtractor>
+    createEMDHistogramCostExtractor(int flag=DIST_L2, int nDummies=25, float defaultCost=0.2f);
+
+/** @brief An Chi based cost extraction. :
+ */
+class CV_EXPORTS_W ChiHistogramCostExtractor : public HistogramCostExtractor
+{};
+
+CV_EXPORTS_W Ptr<HistogramCostExtractor> createChiHistogramCostExtractor(int nDummies=25, float defaultCost=0.2f);
+
+/** @brief An EMD-L1 based cost extraction. :
+ */
+class CV_EXPORTS_W EMDL1HistogramCostExtractor : public HistogramCostExtractor
+{};
+
+CV_EXPORTS_W Ptr<HistogramCostExtractor>
+    createEMDL1HistogramCostExtractor(int nDummies=25, float defaultCost=0.2f);
+
+//! @}
+
+} // cv
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp
new file mode 100644
index 0000000..5c4da3c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/shape.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp
new file mode 100644
index 0000000..4b0c3b5
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape_distance.hpp
@@ -0,0 +1,224 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_SHAPE_SHAPE_DISTANCE_HPP__
+#define __OPENCV_SHAPE_SHAPE_DISTANCE_HPP__
+#include "opencv2/core.hpp"
+#include "opencv2/shape/hist_cost.hpp"
+#include "opencv2/shape/shape_transformer.hpp"
+
+namespace cv
+{
+
+//! @addtogroup shape
+//! @{
+
+/** @brief Abstract base class for shape distance algorithms.
+ */
+class CV_EXPORTS_W ShapeDistanceExtractor : public Algorithm
+{
+public:
+    /** @brief Compute the shape distance between two shapes defined by its contours.
+
+    @param contour1 Contour defining first shape.
+    @param contour2 Contour defining second shape.
+     */
+    CV_WRAP virtual float computeDistance(InputArray contour1, InputArray contour2) = 0;
+};
+
+/***********************************************************************************/
+/***********************************************************************************/
+/***********************************************************************************/
+/** @brief Implementation of the Shape Context descriptor and matching algorithm
+
+proposed by Belongie et al. in "Shape Matching and Object Recognition Using Shape Contexts" (PAMI
+2002). This implementation is packaged in a generic scheme, in order to allow you the
+implementation of the common variations of the original pipeline.
+*/
+class CV_EXPORTS_W ShapeContextDistanceExtractor : public ShapeDistanceExtractor
+{
+public:
+    /** @brief Establish the number of angular bins for the Shape Context Descriptor used in the shape matching
+    pipeline.
+
+    @param nAngularBins The number of angular bins in the shape context descriptor.
+     */
+    CV_WRAP virtual void setAngularBins(int nAngularBins) = 0;
+    CV_WRAP virtual int getAngularBins() const = 0;
+
+    /** @brief Establish the number of radial bins for the Shape Context Descriptor used in the shape matching
+    pipeline.
+
+    @param nRadialBins The number of radial bins in the shape context descriptor.
+     */
+    CV_WRAP virtual void setRadialBins(int nRadialBins) = 0;
+    CV_WRAP virtual int getRadialBins() const = 0;
+
+    /** @brief Set the inner radius of the shape context descriptor.
+
+    @param innerRadius The value of the inner radius.
+     */
+    CV_WRAP virtual void setInnerRadius(float innerRadius) = 0;
+    CV_WRAP virtual float getInnerRadius() const = 0;
+
+    /** @brief Set the outer radius of the shape context descriptor.
+
+    @param outerRadius The value of the outer radius.
+     */
+    CV_WRAP virtual void setOuterRadius(float outerRadius) = 0;
+    CV_WRAP virtual float getOuterRadius() const = 0;
+
+    CV_WRAP virtual void setRotationInvariant(bool rotationInvariant) = 0;
+    CV_WRAP virtual bool getRotationInvariant() const = 0;
+
+    /** @brief Set the weight of the shape context distance in the final value of the shape distance. The shape
+    context distance between two shapes is defined as the symmetric sum of shape context matching costs
+    over best matching points. The final value of the shape distance is a user-defined linear
+    combination of the shape context distance, an image appearance distance, and a bending energy.
+
+    @param shapeContextWeight The weight of the shape context distance in the final distance value.
+     */
+    CV_WRAP virtual void setShapeContextWeight(float shapeContextWeight) = 0;
+    CV_WRAP virtual float getShapeContextWeight() const = 0;
+
+    /** @brief Set the weight of the Image Appearance cost in the final value of the shape distance. The image
+    appearance cost is defined as the sum of squared brightness differences in Gaussian windows around
+    corresponding image points. The final value of the shape distance is a user-defined linear
+    combination of the shape context distance, an image appearance distance, and a bending energy. If
+    this value is set to a number different from 0, is mandatory to set the images that correspond to
+    each shape.
+
+    @param imageAppearanceWeight The weight of the appearance cost in the final distance value.
+     */
+    CV_WRAP virtual void setImageAppearanceWeight(float imageAppearanceWeight) = 0;
+    CV_WRAP virtual float getImageAppearanceWeight() const = 0;
+
+    /** @brief Set the weight of the Bending Energy in the final value of the shape distance. The bending energy
+    definition depends on what transformation is being used to align the shapes. The final value of the
+    shape distance is a user-defined linear combination of the shape context distance, an image
+    appearance distance, and a bending energy.
+
+    @param bendingEnergyWeight The weight of the Bending Energy in the final distance value.
+     */
+    CV_WRAP virtual void setBendingEnergyWeight(float bendingEnergyWeight) = 0;
+    CV_WRAP virtual float getBendingEnergyWeight() const = 0;
+
+    /** @brief Set the images that correspond to each shape. This images are used in the calculation of the Image
+    Appearance cost.
+
+    @param image1 Image corresponding to the shape defined by contours1.
+    @param image2 Image corresponding to the shape defined by contours2.
+     */
+    CV_WRAP virtual void setImages(InputArray image1, InputArray image2) = 0;
+    CV_WRAP virtual void getImages(OutputArray image1, OutputArray image2) const = 0;
+
+    CV_WRAP virtual void setIterations(int iterations) = 0;
+    CV_WRAP virtual int getIterations() const = 0;
+
+    /** @brief Set the algorithm used for building the shape context descriptor cost matrix.
+
+    @param comparer Smart pointer to a HistogramCostExtractor, an algorithm that defines the cost
+    matrix between descriptors.
+     */
+    CV_WRAP virtual void setCostExtractor(Ptr<HistogramCostExtractor> comparer) = 0;
+    CV_WRAP virtual Ptr<HistogramCostExtractor> getCostExtractor() const = 0;
+
+    /** @brief Set the value of the standard deviation for the Gaussian window for the image appearance cost.
+
+    @param sigma Standard Deviation.
+     */
+    CV_WRAP virtual void setStdDev(float sigma) = 0;
+    CV_WRAP virtual float getStdDev() const = 0;
+
+    /** @brief Set the algorithm used for aligning the shapes.
+
+    @param transformer Smart pointer to a ShapeTransformer, an algorithm that defines the aligning
+    transformation.
+     */
+    CV_WRAP virtual void setTransformAlgorithm(Ptr<ShapeTransformer> transformer) = 0;
+    CV_WRAP virtual Ptr<ShapeTransformer> getTransformAlgorithm() const = 0;
+};
+
+/* Complete constructor */
+CV_EXPORTS_W Ptr<ShapeContextDistanceExtractor>
+    createShapeContextDistanceExtractor(int nAngularBins=12, int nRadialBins=4,
+                                        float innerRadius=0.2f, float outerRadius=2, int iterations=3,
+                                        const Ptr<HistogramCostExtractor> &comparer = createChiHistogramCostExtractor(),
+                                        const Ptr<ShapeTransformer> &transformer = createThinPlateSplineShapeTransformer());
+
+/***********************************************************************************/
+/***********************************************************************************/
+/***********************************************************************************/
+/** @brief A simple Hausdorff distance measure between shapes defined by contours
+
+according to the paper "Comparing Images using the Hausdorff distance." by D.P. Huttenlocher, G.A.
+Klanderman, and W.J. Rucklidge. (PAMI 1993). :
+ */
+class CV_EXPORTS_W HausdorffDistanceExtractor : public ShapeDistanceExtractor
+{
+public:
+    /** @brief Set the norm used to compute the Hausdorff value between two shapes. It can be L1 or L2 norm.
+
+    @param distanceFlag Flag indicating which norm is used to compute the Hausdorff distance
+    (NORM_L1, NORM_L2).
+     */
+    CV_WRAP virtual void setDistanceFlag(int distanceFlag) = 0;
+    CV_WRAP virtual int getDistanceFlag() const = 0;
+
+    /** @brief This method sets the rank proportion (or fractional value) that establish the Kth ranked value of
+    the partial Hausdorff distance. Experimentally had been shown that 0.6 is a good value to compare
+    shapes.
+
+    @param rankProportion fractional value (between 0 and 1).
+     */
+    CV_WRAP virtual void setRankProportion(float rankProportion) = 0;
+    CV_WRAP virtual float getRankProportion() const = 0;
+};
+
+/* Constructor */
+CV_EXPORTS_W Ptr<HausdorffDistanceExtractor> createHausdorffDistanceExtractor(int distanceFlag=cv::NORM_L2, float rankProp=0.6f);
+
+//! @}
+
+} // cv
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp
new file mode 100644
index 0000000..2180613
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/shape/shape_transformer.hpp
@@ -0,0 +1,132 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_SHAPE_SHAPE_TRANSFORM_HPP__
+#define __OPENCV_SHAPE_SHAPE_TRANSFORM_HPP__
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+
+//! @addtogroup shape
+//! @{
+
+/** @brief Abstract base class for shape transformation algorithms.
+ */
+class CV_EXPORTS_W ShapeTransformer : public Algorithm
+{
+public:
+    /** @brief Estimate the transformation parameters of the current transformer algorithm, based on point matches.
+
+    @param transformingShape Contour defining first shape.
+    @param targetShape Contour defining second shape (Target).
+    @param matches Standard vector of Matches between points.
+     */
+    CV_WRAP virtual void estimateTransformation(InputArray transformingShape, InputArray targetShape,
+                                                 std::vector<DMatch>& matches) = 0;
+
+    /** @brief Apply a transformation, given a pre-estimated transformation parameters.
+
+    @param input Contour (set of points) to apply the transformation.
+    @param output Output contour.
+     */
+    CV_WRAP virtual float applyTransformation(InputArray input, OutputArray output=noArray()) = 0;
+
+    /** @brief Apply a transformation, given a pre-estimated transformation parameters, to an Image.
+
+    @param transformingImage Input image.
+    @param output Output image.
+    @param flags Image interpolation method.
+    @param borderMode border style.
+    @param borderValue border value.
+     */
+    CV_WRAP virtual void warpImage(InputArray transformingImage, OutputArray output,
+                                   int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT,
+                                   const Scalar& borderValue=Scalar()) const = 0;
+};
+
+/***********************************************************************************/
+/***********************************************************************************/
+
+/** @brief Definition of the transformation
+
+ocupied in the paper "Principal Warps: Thin-Plate Splines and Decomposition of Deformations", by
+F.L. Bookstein (PAMI 1989). :
+ */
+class CV_EXPORTS_W ThinPlateSplineShapeTransformer : public ShapeTransformer
+{
+public:
+    /** @brief Set the regularization parameter for relaxing the exact interpolation requirements of the TPS
+    algorithm.
+
+    @param beta value of the regularization parameter.
+     */
+    CV_WRAP virtual void setRegularizationParameter(double beta) = 0;
+    CV_WRAP virtual double getRegularizationParameter() const = 0;
+};
+
+/** Complete constructor */
+CV_EXPORTS_W Ptr<ThinPlateSplineShapeTransformer>
+    createThinPlateSplineShapeTransformer(double regularizationParameter=0);
+
+/***********************************************************************************/
+/***********************************************************************************/
+
+/** @brief Wrapper class for the OpenCV Affine Transformation algorithm. :
+ */
+class CV_EXPORTS_W AffineTransformer : public ShapeTransformer
+{
+public:
+    CV_WRAP virtual void setFullAffine(bool fullAffine) = 0;
+    CV_WRAP virtual bool getFullAffine() const = 0;
+};
+
+/** Complete constructor */
+CV_EXPORTS_W Ptr<AffineTransformer> createAffineTransformer(bool fullAffine);
+
+//! @}
+
+} // cv
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching.hpp
new file mode 100644
index 0000000..96cde14
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching.hpp
@@ -0,0 +1,257 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_STITCHER_HPP__
+#define __OPENCV_STITCHING_STITCHER_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/stitching/warpers.hpp"
+#include "opencv2/stitching/detail/matchers.hpp"
+#include "opencv2/stitching/detail/motion_estimators.hpp"
+#include "opencv2/stitching/detail/exposure_compensate.hpp"
+#include "opencv2/stitching/detail/seam_finders.hpp"
+#include "opencv2/stitching/detail/blenders.hpp"
+#include "opencv2/stitching/detail/camera.hpp"
+
+/**
+@defgroup stitching Images stitching
+
+This figure illustrates the stitching module pipeline implemented in the Stitcher class. Using that
+class it's possible to configure/remove some steps, i.e. adjust the stitching pipeline according to
+the particular needs. All building blocks from the pipeline are available in the detail namespace,
+one can combine and use them separately.
+
+The implemented stitching pipeline is very similar to the one proposed in @cite BL07 .
+
+![image](StitchingPipeline.jpg)
+
+@{
+    @defgroup stitching_match Features Finding and Images Matching
+    @defgroup stitching_rotation Rotation Estimation
+    @defgroup stitching_autocalib Autocalibration
+    @defgroup stitching_warp Images Warping
+    @defgroup stitching_seam Seam Estimation
+    @defgroup stitching_exposure Exposure Compensation
+    @defgroup stitching_blend Image Blenders
+@}
+  */
+
+namespace cv {
+
+//! @addtogroup stitching
+//! @{
+
+/** @brief High level image stitcher.
+
+It's possible to use this class without being aware of the entire stitching pipeline. However, to
+be able to achieve higher stitching stability and quality of the final images at least being
+familiar with the theory is recommended.
+
+@note
+   -   A basic example on image stitching can be found at
+        opencv_source_code/samples/cpp/stitching.cpp
+    -   A detailed example on image stitching can be found at
+        opencv_source_code/samples/cpp/stitching_detailed.cpp
+ */
+class CV_EXPORTS_W Stitcher
+{
+public:
+    enum { ORIG_RESOL = -1 };
+    enum Status
+    {
+        OK = 0,
+        ERR_NEED_MORE_IMGS = 1,
+        ERR_HOMOGRAPHY_EST_FAIL = 2,
+        ERR_CAMERA_PARAMS_ADJUST_FAIL = 3
+    };
+
+   // Stitcher() {}
+    /** @brief Creates a stitcher with the default parameters.
+
+    @param try_use_gpu Flag indicating whether GPU should be used whenever it's possible.
+    @return Stitcher class instance.
+     */
+    static Stitcher createDefault(bool try_use_gpu = false);
+
+    CV_WRAP double registrationResol() const { return registr_resol_; }
+    CV_WRAP void setRegistrationResol(double resol_mpx) { registr_resol_ = resol_mpx; }
+
+    CV_WRAP double seamEstimationResol() const { return seam_est_resol_; }
+    CV_WRAP void setSeamEstimationResol(double resol_mpx) { seam_est_resol_ = resol_mpx; }
+
+    CV_WRAP double compositingResol() const { return compose_resol_; }
+    CV_WRAP void setCompositingResol(double resol_mpx) { compose_resol_ = resol_mpx; }
+
+    CV_WRAP double panoConfidenceThresh() const { return conf_thresh_; }
+    CV_WRAP void setPanoConfidenceThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }
+
+    CV_WRAP bool waveCorrection() const { return do_wave_correct_; }
+    CV_WRAP void setWaveCorrection(bool flag) { do_wave_correct_ = flag; }
+
+    detail::WaveCorrectKind waveCorrectKind() const { return wave_correct_kind_; }
+    void setWaveCorrectKind(detail::WaveCorrectKind kind) { wave_correct_kind_ = kind; }
+
+    Ptr<detail::FeaturesFinder> featuresFinder() { return features_finder_; }
+    const Ptr<detail::FeaturesFinder> featuresFinder() const { return features_finder_; }
+    void setFeaturesFinder(Ptr<detail::FeaturesFinder> features_finder)
+        { features_finder_ = features_finder; }
+
+    Ptr<detail::FeaturesMatcher> featuresMatcher() { return features_matcher_; }
+    const Ptr<detail::FeaturesMatcher> featuresMatcher() const { return features_matcher_; }
+    void setFeaturesMatcher(Ptr<detail::FeaturesMatcher> features_matcher)
+        { features_matcher_ = features_matcher; }
+
+    const cv::UMat& matchingMask() const { return matching_mask_; }
+    void setMatchingMask(const cv::UMat &mask)
+    {
+        CV_Assert(mask.type() == CV_8U && mask.cols == mask.rows);
+        matching_mask_ = mask.clone();
+    }
+
+    Ptr<detail::BundleAdjusterBase> bundleAdjuster() { return bundle_adjuster_; }
+    const Ptr<detail::BundleAdjusterBase> bundleAdjuster() const { return bundle_adjuster_; }
+    void setBundleAdjuster(Ptr<detail::BundleAdjusterBase> bundle_adjuster)
+        { bundle_adjuster_ = bundle_adjuster; }
+
+    Ptr<WarperCreator> warper() { return warper_; }
+    const Ptr<WarperCreator> warper() const { return warper_; }
+    void setWarper(Ptr<WarperCreator> creator) { warper_ = creator; }
+
+    Ptr<detail::ExposureCompensator> exposureCompensator() { return exposure_comp_; }
+    const Ptr<detail::ExposureCompensator> exposureCompensator() const { return exposure_comp_; }
+    void setExposureCompensator(Ptr<detail::ExposureCompensator> exposure_comp)
+        { exposure_comp_ = exposure_comp; }
+
+    Ptr<detail::SeamFinder> seamFinder() { return seam_finder_; }
+    const Ptr<detail::SeamFinder> seamFinder() const { return seam_finder_; }
+    void setSeamFinder(Ptr<detail::SeamFinder> seam_finder) { seam_finder_ = seam_finder; }
+
+    Ptr<detail::Blender> blender() { return blender_; }
+    const Ptr<detail::Blender> blender() const { return blender_; }
+    void setBlender(Ptr<detail::Blender> b) { blender_ = b; }
+
+    /** @overload */
+    CV_WRAP Status estimateTransform(InputArrayOfArrays images);
+    /** @brief These functions try to match the given images and to estimate rotations of each camera.
+
+    @note Use the functions only if you're aware of the stitching pipeline, otherwise use
+    Stitcher::stitch.
+
+    @param images Input images.
+    @param rois Region of interest rectangles.
+    @return Status code.
+     */
+    Status estimateTransform(InputArrayOfArrays images, const std::vector<std::vector<Rect> > &rois);
+
+    /** @overload */
+    CV_WRAP Status composePanorama(OutputArray pano);
+    /** @brief These functions try to compose the given images (or images stored internally from the other function
+    calls) into the final pano under the assumption that the image transformations were estimated
+    before.
+
+    @note Use the functions only if you're aware of the stitching pipeline, otherwise use
+    Stitcher::stitch.
+
+    @param images Input images.
+    @param pano Final pano.
+    @return Status code.
+     */
+    Status composePanorama(InputArrayOfArrays images, OutputArray pano);
+
+    /** @overload */
+    CV_WRAP Status stitch(InputArrayOfArrays images, OutputArray pano);
+    /** @brief These functions try to stitch the given images.
+
+    @param images Input images.
+    @param rois Region of interest rectangles.
+    @param pano Final pano.
+    @return Status code.
+     */
+    Status stitch(InputArrayOfArrays images, const std::vector<std::vector<Rect> > &rois, OutputArray pano);
+
+    std::vector<int> component() const { return indices_; }
+    std::vector<detail::CameraParams> cameras() const { return cameras_; }
+    CV_WRAP double workScale() const { return work_scale_; }
+
+private:
+    //Stitcher() {}
+
+    Status matchImages();
+    Status estimateCameraParams();
+
+    double registr_resol_;
+    double seam_est_resol_;
+    double compose_resol_;
+    double conf_thresh_;
+    Ptr<detail::FeaturesFinder> features_finder_;
+    Ptr<detail::FeaturesMatcher> features_matcher_;
+    cv::UMat matching_mask_;
+    Ptr<detail::BundleAdjusterBase> bundle_adjuster_;
+    bool do_wave_correct_;
+    detail::WaveCorrectKind wave_correct_kind_;
+    Ptr<WarperCreator> warper_;
+    Ptr<detail::ExposureCompensator> exposure_comp_;
+    Ptr<detail::SeamFinder> seam_finder_;
+    Ptr<detail::Blender> blender_;
+
+    std::vector<cv::UMat> imgs_;
+    std::vector<std::vector<cv::Rect> > rois_;
+    std::vector<cv::Size> full_img_sizes_;
+    std::vector<detail::ImageFeatures> features_;
+    std::vector<detail::MatchesInfo> pairwise_matches_;
+    std::vector<cv::UMat> seam_est_imgs_;
+    std::vector<int> indices_;
+    std::vector<detail::CameraParams> cameras_;
+    double work_scale_;
+    double seam_scale_;
+    double seam_work_aspect_;
+    double warped_image_scale_;
+};
+
+CV_EXPORTS_W Ptr<Stitcher> createStitcher(bool try_use_gpu = false);
+
+//! @} stitching
+
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_STITCHER_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp
new file mode 100644
index 0000000..ccc0aa1
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/autocalib.hpp
@@ -0,0 +1,86 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_AUTOCALIB_HPP__
+#define __OPENCV_STITCHING_AUTOCALIB_HPP__
+
+#include "opencv2/core.hpp"
+#include "matchers.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_autocalib
+//! @{
+
+/** @brief Tries to estimate focal lengths from the given homography under the assumption that the camera
+undergoes rotations around its centre only.
+
+@param H Homography.
+@param f0 Estimated focal length along X axis.
+@param f1 Estimated focal length along Y axis.
+@param f0_ok True, if f0 was estimated successfully, false otherwise.
+@param f1_ok True, if f1 was estimated successfully, false otherwise.
+
+See "Construction of Panoramic Image Mosaics with Global and Local Alignment"
+by Heung-Yeung Shum and Richard Szeliski.
+ */
+void CV_EXPORTS focalsFromHomography(const Mat &H, double &f0, double &f1, bool &f0_ok, bool &f1_ok);
+
+/** @brief Estimates focal lengths for each given camera.
+
+@param features Features of images.
+@param pairwise_matches Matches between all image pairs.
+@param focals Estimated focal lengths for each camera.
+ */
+void CV_EXPORTS estimateFocal(const std::vector<ImageFeatures> &features,
+                              const std::vector<MatchesInfo> &pairwise_matches,
+                              std::vector<double> &focals);
+
+bool CV_EXPORTS calibrateRotatingCamera(const std::vector<Mat> &Hs, Mat &K);
+
+//! @} stitching_autocalib
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_AUTOCALIB_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp
new file mode 100644
index 0000000..0e60725
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/blenders.hpp
@@ -0,0 +1,163 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_BLENDERS_HPP__
+#define __OPENCV_STITCHING_BLENDERS_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_blend
+//! @{
+
+/** @brief Base class for all blenders.
+
+Simple blender which puts one image over another
+*/
+class CV_EXPORTS Blender
+{
+public:
+    virtual ~Blender() {}
+
+    enum { NO, FEATHER, MULTI_BAND };
+    static Ptr<Blender> createDefault(int type, bool try_gpu = false);
+
+    /** @brief Prepares the blender for blending.
+
+    @param corners Source images top-left corners
+    @param sizes Source image sizes
+     */
+    void prepare(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+    /** @overload */
+    virtual void prepare(Rect dst_roi);
+    /** @brief Processes the image.
+
+    @param img Source image
+    @param mask Source image mask
+    @param tl Source image top-left corners
+     */
+    virtual void feed(InputArray img, InputArray mask, Point tl);
+    /** @brief Blends and returns the final pano.
+
+    @param dst Final pano
+    @param dst_mask Final pano mask
+     */
+    virtual void blend(InputOutputArray dst, InputOutputArray dst_mask);
+
+protected:
+    UMat dst_, dst_mask_;
+    Rect dst_roi_;
+};
+
+/** @brief Simple blender which mixes images at its borders.
+ */
+class CV_EXPORTS FeatherBlender : public Blender
+{
+public:
+    FeatherBlender(float sharpness = 0.02f);
+
+    float sharpness() const { return sharpness_; }
+    void setSharpness(float val) { sharpness_ = val; }
+
+    void prepare(Rect dst_roi);
+    void feed(InputArray img, InputArray mask, Point tl);
+    void blend(InputOutputArray dst, InputOutputArray dst_mask);
+
+    //! Creates weight maps for fixed set of source images by their masks and top-left corners.
+    //! Final image can be obtained by simple weighting of the source images.
+    Rect createWeightMaps(const std::vector<UMat> &masks, const std::vector<Point> &corners,
+                          std::vector<UMat> &weight_maps);
+
+private:
+    float sharpness_;
+    UMat weight_map_;
+    UMat dst_weight_map_;
+};
+
+inline FeatherBlender::FeatherBlender(float _sharpness) { setSharpness(_sharpness); }
+
+/** @brief Blender which uses multi-band blending algorithm (see @cite BA83).
+ */
+class CV_EXPORTS MultiBandBlender : public Blender
+{
+public:
+    MultiBandBlender(int try_gpu = false, int num_bands = 5, int weight_type = CV_32F);
+
+    int numBands() const { return actual_num_bands_; }
+    void setNumBands(int val) { actual_num_bands_ = val; }
+
+    void prepare(Rect dst_roi);
+    void feed(InputArray img, InputArray mask, Point tl);
+    void blend(InputOutputArray dst, InputOutputArray dst_mask);
+
+private:
+    int actual_num_bands_, num_bands_;
+    std::vector<UMat> dst_pyr_laplace_;
+    std::vector<UMat> dst_band_weights_;
+    Rect dst_roi_final_;
+    bool can_use_gpu_;
+    int weight_type_; //CV_32F or CV_16S
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Auxiliary functions
+
+void CV_EXPORTS normalizeUsingWeightMap(InputArray weight, InputOutputArray src);
+
+void CV_EXPORTS createWeightMap(InputArray mask, float sharpness, InputOutputArray weight);
+
+void CV_EXPORTS createLaplacePyr(InputArray img, int num_levels, std::vector<UMat>& pyr);
+void CV_EXPORTS createLaplacePyrGpu(InputArray img, int num_levels, std::vector<UMat>& pyr);
+
+// Restores source image
+void CV_EXPORTS restoreImageFromLaplacePyr(std::vector<UMat>& pyr);
+void CV_EXPORTS restoreImageFromLaplacePyrGpu(std::vector<UMat>& pyr);
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_BLENDERS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp
new file mode 100644
index 0000000..c231ba5
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/camera.hpp
@@ -0,0 +1,78 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_CAMERA_HPP__
+#define __OPENCV_STITCHING_CAMERA_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching
+//! @{
+
+/** @brief Describes camera parameters.
+
+@note Translation is assumed to be zero during the whole stitching pipeline. :
+ */
+struct CV_EXPORTS CameraParams
+{
+    CameraParams();
+    CameraParams(const CameraParams& other);
+    const CameraParams& operator =(const CameraParams& other);
+    Mat K() const;
+
+    double focal; // Focal length
+    double aspect; // Aspect ratio
+    double ppx; // Principal point X
+    double ppy; // Principal point Y
+    Mat R; // Rotation
+    Mat t; // Translation
+};
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // #ifndef __OPENCV_STITCHING_CAMERA_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp
new file mode 100644
index 0000000..ef64e12
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/exposure_compensate.hpp
@@ -0,0 +1,132 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP__
+#define __OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_exposure
+//! @{
+
+/** @brief Base class for all exposure compensators.
+ */
+class CV_EXPORTS ExposureCompensator
+{
+public:
+    virtual ~ExposureCompensator() {}
+
+    enum { NO, GAIN, GAIN_BLOCKS };
+    static Ptr<ExposureCompensator> createDefault(int type);
+
+    /**
+    @param corners Source image top-left corners
+    @param images Source images
+    @param masks Image masks to update (second value in pair specifies the value which should be used
+    to detect where image is)
+     */
+    void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
+              const std::vector<UMat> &masks);
+    /** @overload */
+    virtual void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
+                      const std::vector<std::pair<UMat,uchar> > &masks) = 0;
+    /** @brief Compensate exposure in the specified image.
+
+    @param index Image index
+    @param corner Image top-left corner
+    @param image Image to process
+    @param mask Image mask
+     */
+    virtual void apply(int index, Point corner, InputOutputArray image, InputArray mask) = 0;
+};
+
+/** @brief Stub exposure compensator which does nothing.
+ */
+class CV_EXPORTS NoExposureCompensator : public ExposureCompensator
+{
+public:
+    void feed(const std::vector<Point> &/*corners*/, const std::vector<UMat> &/*images*/,
+              const std::vector<std::pair<UMat,uchar> > &/*masks*/) { }
+    void apply(int /*index*/, Point /*corner*/, InputOutputArray /*image*/, InputArray /*mask*/) { }
+};
+
+/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image
+intensities, see @cite BL07 and @cite WJ10 for details.
+ */
+class CV_EXPORTS GainCompensator : public ExposureCompensator
+{
+public:
+    void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
+              const std::vector<std::pair<UMat,uchar> > &masks);
+    void apply(int index, Point corner, InputOutputArray image, InputArray mask);
+    std::vector<double> gains() const;
+
+private:
+    Mat_<double> gains_;
+};
+
+/** @brief Exposure compensator which tries to remove exposure related artifacts by adjusting image block
+intensities, see @cite UES01 for details.
+ */
+class CV_EXPORTS BlocksGainCompensator : public ExposureCompensator
+{
+public:
+    BlocksGainCompensator(int bl_width = 32, int bl_height = 32)
+            : bl_width_(bl_width), bl_height_(bl_height) {}
+    void feed(const std::vector<Point> &corners, const std::vector<UMat> &images,
+              const std::vector<std::pair<UMat,uchar> > &masks);
+    void apply(int index, Point corner, InputOutputArray image, InputArray mask);
+
+private:
+    int bl_width_, bl_height_;
+    std::vector<UMat> gain_maps_;
+};
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_EXPOSURE_COMPENSATE_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp
new file mode 100644
index 0000000..8f34bd2
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/matchers.hpp
@@ -0,0 +1,275 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_MATCHERS_HPP__
+#define __OPENCV_STITCHING_MATCHERS_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+
+#include "opencv2/opencv_modules.hpp"
+
+#ifdef HAVE_OPENCV_XFEATURES2D
+#  include "opencv2/xfeatures2d/cuda.hpp"
+#endif
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_match
+//! @{
+
+/** @brief Structure containing image keypoints and descriptors. */
+struct CV_EXPORTS ImageFeatures
+{
+    int img_idx;
+    Size img_size;
+    std::vector<KeyPoint> keypoints;
+    UMat descriptors;
+};
+
+/** @brief Feature finders base class */
+class CV_EXPORTS FeaturesFinder
+{
+public:
+    virtual ~FeaturesFinder() {}
+    /** @overload */
+    void operator ()(InputArray image, ImageFeatures &features);
+    /** @brief Finds features in the given image.
+
+    @param image Source image
+    @param features Found features
+    @param rois Regions of interest
+
+    @sa detail::ImageFeatures, Rect_
+    */
+    void operator ()(InputArray image, ImageFeatures &features, const std::vector<cv::Rect> &rois);
+    /** @brief Frees unused memory allocated before if there is any. */
+    virtual void collectGarbage() {}
+
+protected:
+    /** @brief This method must implement features finding logic in order to make the wrappers
+    detail::FeaturesFinder::operator()_ work.
+
+    @param image Source image
+    @param features Found features
+
+    @sa detail::ImageFeatures */
+    virtual void find(InputArray image, ImageFeatures &features) = 0;
+};
+
+/** @brief SURF features finder.
+
+@sa detail::FeaturesFinder, SURF
+*/
+class CV_EXPORTS SurfFeaturesFinder : public FeaturesFinder
+{
+public:
+    SurfFeaturesFinder(double hess_thresh = 300., int num_octaves = 3, int num_layers = 4,
+                       int num_octaves_descr = /*4*/3, int num_layers_descr = /*2*/4);
+
+private:
+    void find(InputArray image, ImageFeatures &features);
+
+    Ptr<FeatureDetector> detector_;
+    Ptr<DescriptorExtractor> extractor_;
+    Ptr<Feature2D> surf;
+};
+
+/** @brief ORB features finder. :
+
+@sa detail::FeaturesFinder, ORB
+*/
+class CV_EXPORTS OrbFeaturesFinder : public FeaturesFinder
+{
+public:
+    OrbFeaturesFinder(Size _grid_size = Size(3,1), int nfeatures=1500, float scaleFactor=1.3f, int nlevels=5);
+
+private:
+    void find(InputArray image, ImageFeatures &features);
+
+    Ptr<ORB> orb;
+    Size grid_size;
+};
+
+
+#ifdef HAVE_OPENCV_XFEATURES2D
+class CV_EXPORTS SurfFeaturesFinderGpu : public FeaturesFinder
+{
+public:
+    SurfFeaturesFinderGpu(double hess_thresh = 300., int num_octaves = 3, int num_layers = 4,
+                          int num_octaves_descr = 4, int num_layers_descr = 2);
+
+    void collectGarbage();
+
+private:
+    void find(InputArray image, ImageFeatures &features);
+
+    cuda::GpuMat image_;
+    cuda::GpuMat gray_image_;
+    cuda::SURF_CUDA surf_;
+    cuda::GpuMat keypoints_;
+    cuda::GpuMat descriptors_;
+    int num_octaves_, num_layers_;
+    int num_octaves_descr_, num_layers_descr_;
+};
+#endif
+
+/** @brief Structure containing information about matches between two images.
+
+It's assumed that there is a homography between those images.
+*/
+struct CV_EXPORTS MatchesInfo
+{
+    MatchesInfo();
+    MatchesInfo(const MatchesInfo &other);
+    const MatchesInfo& operator =(const MatchesInfo &other);
+
+    int src_img_idx, dst_img_idx;       //!< Images indices (optional)
+    std::vector<DMatch> matches;
+    std::vector<uchar> inliers_mask;    //!< Geometrically consistent matches mask
+    int num_inliers;                    //!< Number of geometrically consistent matches
+    Mat H;                              //!< Estimated homography
+    double confidence;                  //!< Confidence two images are from the same panorama
+};
+
+/** @brief Feature matchers base class. */
+class CV_EXPORTS FeaturesMatcher
+{
+public:
+    virtual ~FeaturesMatcher() {}
+
+    /** @overload
+    @param features1 First image features
+    @param features2 Second image features
+    @param matches_info Found matches
+    */
+    void operator ()(const ImageFeatures &features1, const ImageFeatures &features2,
+                     MatchesInfo& matches_info) { match(features1, features2, matches_info); }
+
+    /** @brief Performs images matching.
+
+    @param features Features of the source images
+    @param pairwise_matches Found pairwise matches
+    @param mask Mask indicating which image pairs must be matched
+
+    The function is parallelized with the TBB library.
+
+    @sa detail::MatchesInfo
+    */
+    void operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
+                     const cv::UMat &mask = cv::UMat());
+
+    /** @return True, if it's possible to use the same matcher instance in parallel, false otherwise
+    */
+    bool isThreadSafe() const { return is_thread_safe_; }
+
+    /** @brief Frees unused memory allocated before if there is any.
+    */
+    virtual void collectGarbage() {}
+
+protected:
+    FeaturesMatcher(bool is_thread_safe = false) : is_thread_safe_(is_thread_safe) {}
+
+    /** @brief This method must implement matching logic in order to make the wrappers
+    detail::FeaturesMatcher::operator()_ work.
+
+    @param features1 first image features
+    @param features2 second image features
+    @param matches_info found matches
+     */
+    virtual void match(const ImageFeatures &features1, const ImageFeatures &features2,
+                       MatchesInfo& matches_info) = 0;
+
+    bool is_thread_safe_;
+};
+
+/** @brief Features matcher which finds two best matches for each feature and leaves the best one only if the
+ratio between descriptor distances is greater than the threshold match_conf
+
+@sa detail::FeaturesMatcher
+ */
+class CV_EXPORTS BestOf2NearestMatcher : public FeaturesMatcher
+{
+public:
+    /** @brief Constructs a "best of 2 nearest" matcher.
+
+    @param try_use_gpu Should try to use GPU or not
+    @param match_conf Match distances ration threshold
+    @param num_matches_thresh1 Minimum number of matches required for the 2D projective transform
+    estimation used in the inliers classification step
+    @param num_matches_thresh2 Minimum number of matches required for the 2D projective transform
+    re-estimation on inliers
+     */
+    BestOf2NearestMatcher(bool try_use_gpu = false, float match_conf = 0.3f, int num_matches_thresh1 = 6,
+                          int num_matches_thresh2 = 6);
+
+    void collectGarbage();
+
+protected:
+    void match(const ImageFeatures &features1, const ImageFeatures &features2, MatchesInfo &matches_info);
+
+    int num_matches_thresh1_;
+    int num_matches_thresh2_;
+    Ptr<FeaturesMatcher> impl_;
+};
+
+class CV_EXPORTS BestOf2NearestRangeMatcher : public BestOf2NearestMatcher
+{
+public:
+    BestOf2NearestRangeMatcher(int range_width = 5, bool try_use_gpu = false, float match_conf = 0.3f,
+                            int num_matches_thresh1 = 6, int num_matches_thresh2 = 6);
+
+    void operator ()(const std::vector<ImageFeatures> &features, std::vector<MatchesInfo> &pairwise_matches,
+                     const cv::UMat &mask = cv::UMat());
+
+
+protected:
+    int range_width_;
+};
+
+//! @} stitching_match
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_MATCHERS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp
new file mode 100644
index 0000000..2c86e63
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/motion_estimators.hpp
@@ -0,0 +1,274 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_MOTION_ESTIMATORS_HPP__
+#define __OPENCV_STITCHING_MOTION_ESTIMATORS_HPP__
+
+#include "opencv2/core.hpp"
+#include "matchers.hpp"
+#include "util.hpp"
+#include "camera.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_rotation
+//! @{
+
+/** @brief Rotation estimator base class.
+
+It takes features of all images, pairwise matches between all images and estimates rotations of all
+cameras.
+
+@note The coordinate system origin is implementation-dependent, but you can always normalize the
+rotations in respect to the first camera, for instance. :
+ */
+class CV_EXPORTS Estimator
+{
+public:
+    virtual ~Estimator() {}
+
+    /** @brief Estimates camera parameters.
+
+    @param features Features of images
+    @param pairwise_matches Pairwise matches of images
+    @param cameras Estimated camera parameters
+    @return True in case of success, false otherwise
+     */
+    bool operator ()(const std::vector<ImageFeatures> &features,
+                     const std::vector<MatchesInfo> &pairwise_matches,
+                     std::vector<CameraParams> &cameras)
+        { return estimate(features, pairwise_matches, cameras); }
+
+protected:
+    /** @brief This method must implement camera parameters estimation logic in order to make the wrapper
+    detail::Estimator::operator()_ work.
+
+    @param features Features of images
+    @param pairwise_matches Pairwise matches of images
+    @param cameras Estimated camera parameters
+    @return True in case of success, false otherwise
+     */
+    virtual bool estimate(const std::vector<ImageFeatures> &features,
+                          const std::vector<MatchesInfo> &pairwise_matches,
+                          std::vector<CameraParams> &cameras) = 0;
+};
+
+/** @brief Homography based rotation estimator.
+ */
+class CV_EXPORTS HomographyBasedEstimator : public Estimator
+{
+public:
+    HomographyBasedEstimator(bool is_focals_estimated = false)
+        : is_focals_estimated_(is_focals_estimated) {}
+
+private:
+    virtual bool estimate(const std::vector<ImageFeatures> &features,
+                          const std::vector<MatchesInfo> &pairwise_matches,
+                          std::vector<CameraParams> &cameras);
+
+    bool is_focals_estimated_;
+};
+
+/** @brief Base class for all camera parameters refinement methods.
+ */
+class CV_EXPORTS BundleAdjusterBase : public Estimator
+{
+public:
+    const Mat refinementMask() const { return refinement_mask_.clone(); }
+    void setRefinementMask(const Mat &mask)
+    {
+        CV_Assert(mask.type() == CV_8U && mask.size() == Size(3, 3));
+        refinement_mask_ = mask.clone();
+    }
+
+    double confThresh() const { return conf_thresh_; }
+    void setConfThresh(double conf_thresh) { conf_thresh_ = conf_thresh; }
+
+    TermCriteria termCriteria() { return term_criteria_; }
+    void setTermCriteria(const TermCriteria& term_criteria) { term_criteria_ = term_criteria; }
+
+protected:
+    /** @brief Construct a bundle adjuster base instance.
+
+    @param num_params_per_cam Number of parameters per camera
+    @param num_errs_per_measurement Number of error terms (components) per match
+     */
+    BundleAdjusterBase(int num_params_per_cam, int num_errs_per_measurement)
+        : num_params_per_cam_(num_params_per_cam),
+          num_errs_per_measurement_(num_errs_per_measurement)
+    {
+        setRefinementMask(Mat::ones(3, 3, CV_8U));
+        setConfThresh(1.);
+        setTermCriteria(TermCriteria(TermCriteria::EPS + TermCriteria::COUNT, 1000, DBL_EPSILON));
+    }
+
+    // Runs bundle adjustment
+    virtual bool estimate(const std::vector<ImageFeatures> &features,
+                          const std::vector<MatchesInfo> &pairwise_matches,
+                          std::vector<CameraParams> &cameras);
+
+    /** @brief Sets initial camera parameter to refine.
+
+    @param cameras Camera parameters
+     */
+    virtual void setUpInitialCameraParams(const std::vector<CameraParams> &cameras) = 0;
+    /** @brief Gets the refined camera parameters.
+
+    @param cameras Refined camera parameters
+     */
+    virtual void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) const = 0;
+    /** @brief Calculates error vector.
+
+    @param err Error column-vector of length total_num_matches \* num_errs_per_measurement
+     */
+    virtual void calcError(Mat &err) = 0;
+    /** @brief Calculates the cost function jacobian.
+
+    @param jac Jacobian matrix of dimensions
+    (total_num_matches \* num_errs_per_measurement) x (num_images \* num_params_per_cam)
+     */
+    virtual void calcJacobian(Mat &jac) = 0;
+
+    // 3x3 8U mask, where 0 means don't refine respective parameter, != 0 means refine
+    Mat refinement_mask_;
+
+    int num_images_;
+    int total_num_matches_;
+
+    int num_params_per_cam_;
+    int num_errs_per_measurement_;
+
+    const ImageFeatures *features_;
+    const MatchesInfo *pairwise_matches_;
+
+    // Threshold to filter out poorly matched image pairs
+    double conf_thresh_;
+
+    //Levenberg鈥揗arquardt algorithm termination criteria
+    TermCriteria term_criteria_;
+
+    // Camera parameters matrix (CV_64F)
+    Mat cam_params_;
+
+    // Connected images pairs
+    std::vector<std::pair<int,int> > edges_;
+};
+
+
+/** @brief Implementation of the camera parameters refinement algorithm which minimizes sum of the reprojection
+error squares
+
+It can estimate focal length, aspect ratio, principal point.
+You can affect only on them via the refinement mask.
+ */
+class CV_EXPORTS BundleAdjusterReproj : public BundleAdjusterBase
+{
+public:
+    BundleAdjusterReproj() : BundleAdjusterBase(7, 2) {}
+
+private:
+    void setUpInitialCameraParams(const std::vector<CameraParams> &cameras);
+    void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) const;
+    void calcError(Mat &err);
+    void calcJacobian(Mat &jac);
+
+    Mat err1_, err2_;
+};
+
+
+/** @brief Implementation of the camera parameters refinement algorithm which minimizes sum of the distances
+between the rays passing through the camera center and a feature. :
+
+It can estimate focal length. It ignores the refinement mask for now.
+ */
+class CV_EXPORTS BundleAdjusterRay : public BundleAdjusterBase
+{
+public:
+    BundleAdjusterRay() : BundleAdjusterBase(4, 3) {}
+
+private:
+    void setUpInitialCameraParams(const std::vector<CameraParams> &cameras);
+    void obtainRefinedCameraParams(std::vector<CameraParams> &cameras) const;
+    void calcError(Mat &err);
+    void calcJacobian(Mat &jac);
+
+    Mat err1_, err2_;
+};
+
+
+enum WaveCorrectKind
+{
+    WAVE_CORRECT_HORIZ,
+    WAVE_CORRECT_VERT
+};
+
+/** @brief Tries to make panorama more horizontal (or vertical).
+
+@param rmats Camera rotation matrices.
+@param kind Correction kind, see detail::WaveCorrectKind.
+ */
+void CV_EXPORTS waveCorrect(std::vector<Mat> &rmats, WaveCorrectKind kind);
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Auxiliary functions
+
+// Returns matches graph representation in DOT language
+String CV_EXPORTS matchesGraphAsString(std::vector<String> &pathes, std::vector<MatchesInfo> &pairwise_matches,
+                                            float conf_threshold);
+
+std::vector<int> CV_EXPORTS leaveBiggestComponent(
+        std::vector<ImageFeatures> &features,
+        std::vector<MatchesInfo> &pairwise_matches,
+        float conf_threshold);
+
+void CV_EXPORTS findMaxSpanningTree(
+        int num_images, const std::vector<MatchesInfo> &pairwise_matches,
+        Graph &span_tree, std::vector<int> &centers);
+
+//! @} stitching_rotation
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_MOTION_ESTIMATORS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp
new file mode 100644
index 0000000..4ff22c4
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/seam_finders.hpp
@@ -0,0 +1,285 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_SEAM_FINDERS_HPP__
+#define __OPENCV_STITCHING_SEAM_FINDERS_HPP__
+
+#include <set>
+#include "opencv2/core.hpp"
+#include "opencv2/opencv_modules.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_seam
+//! @{
+
+/** @brief Base class for a seam estimator.
+ */
+class CV_EXPORTS SeamFinder
+{
+public:
+    virtual ~SeamFinder() {}
+    /** @brief Estimates seams.
+
+    @param src Source images
+    @param corners Source image top-left corners
+    @param masks Source image masks to update
+     */
+    virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks) = 0;
+};
+
+/** @brief Stub seam estimator which does nothing.
+ */
+class CV_EXPORTS NoSeamFinder : public SeamFinder
+{
+public:
+    void find(const std::vector<UMat>&, const std::vector<Point>&, std::vector<UMat>&) {}
+};
+
+/** @brief Base class for all pairwise seam estimators.
+ */
+class CV_EXPORTS PairwiseSeamFinder : public SeamFinder
+{
+public:
+    virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks);
+
+protected:
+    void run();
+    /** @brief Resolves masks intersection of two specified images in the given ROI.
+
+    @param first First image index
+    @param second Second image index
+    @param roi Region of interest
+     */
+    virtual void findInPair(size_t first, size_t second, Rect roi) = 0;
+
+    std::vector<UMat> images_;
+    std::vector<Size> sizes_;
+    std::vector<Point> corners_;
+    std::vector<UMat> masks_;
+};
+
+/** @brief Voronoi diagram-based seam estimator.
+ */
+class CV_EXPORTS VoronoiSeamFinder : public PairwiseSeamFinder
+{
+public:
+    virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks);
+    virtual void find(const std::vector<Size> &size, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks);
+private:
+    void findInPair(size_t first, size_t second, Rect roi);
+};
+
+
+class CV_EXPORTS DpSeamFinder : public SeamFinder
+{
+public:
+    enum CostFunction { COLOR, COLOR_GRAD };
+
+    DpSeamFinder(CostFunction costFunc = COLOR);
+
+    CostFunction costFunction() const { return costFunc_; }
+    void setCostFunction(CostFunction val) { costFunc_ = val; }
+
+    virtual void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+                      std::vector<UMat> &masks);
+
+private:
+    enum ComponentState
+    {
+        FIRST = 1, SECOND = 2, INTERS = 4,
+        INTERS_FIRST = INTERS | FIRST,
+        INTERS_SECOND = INTERS | SECOND
+    };
+
+    class ImagePairLess
+    {
+    public:
+        ImagePairLess(const std::vector<Mat> &images, const std::vector<Point> &corners)
+            : src_(&images[0]), corners_(&corners[0]) {}
+
+        bool operator() (const std::pair<size_t, size_t> &l, const std::pair<size_t, size_t> &r) const
+        {
+            Point c1 = corners_[l.first] + Point(src_[l.first].cols / 2, src_[l.first].rows / 2);
+            Point c2 = corners_[l.second] + Point(src_[l.second].cols / 2, src_[l.second].rows / 2);
+            int d1 = (c1 - c2).dot(c1 - c2);
+
+            c1 = corners_[r.first] + Point(src_[r.first].cols / 2, src_[r.first].rows / 2);
+            c2 = corners_[r.second] + Point(src_[r.second].cols / 2, src_[r.second].rows / 2);
+            int d2 = (c1 - c2).dot(c1 - c2);
+
+            return d1 < d2;
+        }
+
+    private:
+        const Mat *src_;
+        const Point *corners_;
+    };
+
+    class ClosePoints
+    {
+    public:
+        ClosePoints(int minDist) : minDist_(minDist) {}
+
+        bool operator() (const Point &p1, const Point &p2) const
+        {
+            int dist2 = (p1.x-p2.x) * (p1.x-p2.x) + (p1.y-p2.y) * (p1.y-p2.y);
+            return dist2 < minDist_ * minDist_;
+        }
+
+    private:
+        int minDist_;
+    };
+
+    void process(
+            const Mat &image1, const Mat &image2, Point tl1, Point tl2,  Mat &mask1, Mat &mask2);
+
+    void findComponents();
+
+    void findEdges();
+
+    void resolveConflicts(
+            const Mat &image1, const Mat &image2, Point tl1, Point tl2, Mat &mask1, Mat &mask2);
+
+    void computeGradients(const Mat &image1, const Mat &image2);
+
+    bool hasOnlyOneNeighbor(int comp);
+
+    bool closeToContour(int y, int x, const Mat_<uchar> &contourMask);
+
+    bool getSeamTips(int comp1, int comp2, Point &p1, Point &p2);
+
+    void computeCosts(
+            const Mat &image1, const Mat &image2, Point tl1, Point tl2,
+            int comp, Mat_<float> &costV, Mat_<float> &costH);
+
+    bool estimateSeam(
+            const Mat &image1, const Mat &image2, Point tl1, Point tl2, int comp,
+            Point p1, Point p2, std::vector<Point> &seam, bool &isHorizontal);
+
+    void updateLabelsUsingSeam(
+            int comp1, int comp2, const std::vector<Point> &seam, bool isHorizontalSeam);
+
+    CostFunction costFunc_;
+
+    // processing images pair data
+    Point unionTl_, unionBr_;
+    Size unionSize_;
+    Mat_<uchar> mask1_, mask2_;
+    Mat_<uchar> contour1mask_, contour2mask_;
+    Mat_<float> gradx1_, grady1_;
+    Mat_<float> gradx2_, grady2_;
+
+    // components data
+    int ncomps_;
+    Mat_<int> labels_;
+    std::vector<ComponentState> states_;
+    std::vector<Point> tls_, brs_;
+    std::vector<std::vector<Point> > contours_;
+    std::set<std::pair<int, int> > edges_;
+};
+
+/** @brief Base class for all minimum graph-cut-based seam estimators.
+ */
+class CV_EXPORTS GraphCutSeamFinderBase
+{
+public:
+    enum CostType { COST_COLOR, COST_COLOR_GRAD };
+};
+
+/** @brief Minimum graph cut-based seam estimator. See details in @cite V03 .
+ */
+class CV_EXPORTS GraphCutSeamFinder : public GraphCutSeamFinderBase, public SeamFinder
+{
+public:
+    GraphCutSeamFinder(int cost_type = COST_COLOR_GRAD, float terminal_cost = 10000.f,
+                       float bad_region_penalty = 1000.f);
+
+    ~GraphCutSeamFinder();
+
+    void find(const std::vector<UMat> &src, const std::vector<Point> &corners,
+              std::vector<UMat> &masks);
+
+private:
+    // To avoid GCGraph dependency
+    class Impl;
+    Ptr<PairwiseSeamFinder> impl_;
+};
+
+
+#ifdef HAVE_OPENCV_CUDALEGACY
+class CV_EXPORTS GraphCutSeamFinderGpu : public GraphCutSeamFinderBase, public PairwiseSeamFinder
+{
+public:
+    GraphCutSeamFinderGpu(int cost_type = COST_COLOR_GRAD, float terminal_cost = 10000.f,
+                          float bad_region_penalty = 1000.f)
+                          : cost_type_(cost_type), terminal_cost_(terminal_cost),
+                            bad_region_penalty_(bad_region_penalty) {}
+
+    void find(const std::vector<cv::UMat> &src, const std::vector<cv::Point> &corners,
+              std::vector<cv::UMat> &masks);
+    void findInPair(size_t first, size_t second, Rect roi);
+
+private:
+    void setGraphWeightsColor(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &mask1, const cv::Mat &mask2,
+                              cv::Mat &terminals, cv::Mat &leftT, cv::Mat &rightT, cv::Mat &top, cv::Mat &bottom);
+    void setGraphWeightsColorGrad(const cv::Mat &img1, const cv::Mat &img2, const cv::Mat &dx1, const cv::Mat &dx2,
+                                  const cv::Mat &dy1, const cv::Mat &dy2, const cv::Mat &mask1, const cv::Mat &mask2,
+                                  cv::Mat &terminals, cv::Mat &leftT, cv::Mat &rightT, cv::Mat &top, cv::Mat &bottom);
+    std::vector<Mat> dx_, dy_;
+    int cost_type_;
+    float terminal_cost_;
+    float bad_region_penalty_;
+};
+#endif
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_SEAM_FINDERS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp
new file mode 100644
index 0000000..d64c03c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/timelapsers.hpp
@@ -0,0 +1,91 @@
+/*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*/
+
+
+#ifndef __OPENCV_STITCHING_TIMELAPSERS_HPP__
+#define __OPENCV_STITCHING_TIMELAPSERS_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching
+//! @{
+
+//  Base Timelapser class, takes a sequence of images, applies appropriate shift, stores result in dst_.
+
+class CV_EXPORTS Timelapser
+{
+public:
+
+    enum {AS_IS, CROP};
+
+    virtual ~Timelapser() {}
+
+    static Ptr<Timelapser> createDefault(int type);
+
+    virtual void initialize(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+    virtual void process(InputArray img, InputArray mask, Point tl);
+    virtual const UMat& getDst() {return dst_;}
+
+protected:
+
+    virtual bool test_point(Point pt);
+
+    UMat dst_;
+    Rect dst_roi_;
+};
+
+
+class CV_EXPORTS TimelapserCrop : public Timelapser
+{
+public:
+    virtual void initialize(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+};
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_TIMELAPSERS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp
new file mode 100644
index 0000000..3845ba5
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util.hpp
@@ -0,0 +1,171 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_UTIL_HPP__
+#define __OPENCV_STITCHING_UTIL_HPP__
+
+#include <list>
+#include "opencv2/core.hpp"
+
+#ifndef ENABLE_LOG
+#define ENABLE_LOG 0
+#endif
+
+// TODO remove LOG macros, add logging class
+#if ENABLE_LOG
+#ifdef ANDROID
+  #include <iostream>
+  #include <sstream>
+  #include <android/log.h>
+  #define LOG_STITCHING_MSG(msg) \
+    do { \
+        Stringstream _os; \
+        _os << msg; \
+       __android_log_print(ANDROID_LOG_DEBUG, "STITCHING", "%s", _os.str().c_str()); \
+    } while(0);
+#else
+  #include <iostream>
+  #define LOG_STITCHING_MSG(msg) for(;;) { std::cout << msg; std::cout.flush(); break; }
+#endif
+#else
+  #define LOG_STITCHING_MSG(msg)
+#endif
+
+#define LOG_(_level, _msg)                     \
+    for(;;)                                    \
+    {                                          \
+        using namespace std;                   \
+        if ((_level) >= ::cv::detail::stitchingLogLevel()) \
+        {                                      \
+            LOG_STITCHING_MSG(_msg);           \
+        }                                      \
+    break;                                 \
+    }
+
+
+#define LOG(msg) LOG_(1, msg)
+#define LOG_CHAT(msg) LOG_(0, msg)
+
+#define LOGLN(msg) LOG(msg << std::endl)
+#define LOGLN_CHAT(msg) LOG_CHAT(msg << std::endl)
+
+//#if DEBUG_LOG_CHAT
+//  #define LOG_CHAT(msg) LOG(msg)
+//  #define LOGLN_CHAT(msg) LOGLN(msg)
+//#else
+//  #define LOG_CHAT(msg) do{}while(0)
+//  #define LOGLN_CHAT(msg) do{}while(0)
+//#endif
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching
+//! @{
+
+class CV_EXPORTS DisjointSets
+{
+public:
+    DisjointSets(int elem_count = 0) { createOneElemSets(elem_count); }
+
+    void createOneElemSets(int elem_count);
+    int findSetByElem(int elem);
+    int mergeSets(int set1, int set2);
+
+    std::vector<int> parent;
+    std::vector<int> size;
+
+private:
+    std::vector<int> rank_;
+};
+
+
+struct CV_EXPORTS GraphEdge
+{
+    GraphEdge(int from, int to, float weight);
+    bool operator <(const GraphEdge& other) const { return weight < other.weight; }
+    bool operator >(const GraphEdge& other) const { return weight > other.weight; }
+
+    int from, to;
+    float weight;
+};
+
+inline GraphEdge::GraphEdge(int _from, int _to, float _weight) : from(_from), to(_to), weight(_weight) {}
+
+
+class CV_EXPORTS Graph
+{
+public:
+    Graph(int num_vertices = 0) { create(num_vertices); }
+    void create(int num_vertices) { edges_.assign(num_vertices, std::list<GraphEdge>()); }
+    int numVertices() const { return static_cast<int>(edges_.size()); }
+    void addEdge(int from, int to, float weight);
+    template <typename B> B forEach(B body) const;
+    template <typename B> B walkBreadthFirst(int from, B body) const;
+
+private:
+    std::vector< std::list<GraphEdge> > edges_;
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Auxiliary functions
+
+CV_EXPORTS bool overlapRoi(Point tl1, Point tl2, Size sz1, Size sz2, Rect &roi);
+CV_EXPORTS Rect resultRoi(const std::vector<Point> &corners, const std::vector<UMat> &images);
+CV_EXPORTS Rect resultRoi(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+CV_EXPORTS Rect resultRoiIntersection(const std::vector<Point> &corners, const std::vector<Size> &sizes);
+CV_EXPORTS Point resultTl(const std::vector<Point> &corners);
+
+// Returns random 'count' element subset of the {0,1,...,size-1} set
+CV_EXPORTS void selectRandomSubset(int count, int size, std::vector<int> &subset);
+
+CV_EXPORTS int& stitchingLogLevel();
+
+//! @}
+
+} // namespace detail
+} // namespace cv
+
+#include "util_inl.hpp"
+
+#endif // __OPENCV_STITCHING_UTIL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp
new file mode 100644
index 0000000..6ac6f8e
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/util_inl.hpp
@@ -0,0 +1,131 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_UTIL_INL_HPP__
+#define __OPENCV_STITCHING_UTIL_INL_HPP__
+
+#include <queue>
+#include "opencv2/core.hpp"
+#include "util.hpp" // Make your IDE see declarations
+
+//! @cond IGNORED
+
+namespace cv {
+namespace detail {
+
+template <typename B>
+B Graph::forEach(B body) const
+{
+    for (int i = 0; i < numVertices(); ++i)
+    {
+        std::list<GraphEdge>::const_iterator edge = edges_[i].begin();
+        for (; edge != edges_[i].end(); ++edge)
+            body(*edge);
+    }
+    return body;
+}
+
+
+template <typename B>
+B Graph::walkBreadthFirst(int from, B body) const
+{
+    std::vector<bool> was(numVertices(), false);
+    std::queue<int> vertices;
+
+    was[from] = true;
+    vertices.push(from);
+
+    while (!vertices.empty())
+    {
+        int vertex = vertices.front();
+        vertices.pop();
+
+        std::list<GraphEdge>::const_iterator edge = edges_[vertex].begin();
+        for (; edge != edges_[vertex].end(); ++edge)
+        {
+            if (!was[edge->to])
+            {
+                body(*edge);
+                was[edge->to] = true;
+                vertices.push(edge->to);
+            }
+        }
+    }
+
+    return body;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Some auxiliary math functions
+
+static inline
+float normL2(const Point3f& a)
+{
+    return a.x * a.x + a.y * a.y + a.z * a.z;
+}
+
+
+static inline
+float normL2(const Point3f& a, const Point3f& b)
+{
+    return normL2(a - b);
+}
+
+
+static inline
+double normL2sq(const Mat &r)
+{
+    return r.dot(r);
+}
+
+
+static inline int sqr(int x) { return x * x; }
+static inline float sqr(float x) { return x * x; }
+static inline double sqr(double x) { return x * x; }
+
+} // namespace detail
+} // namespace cv
+
+//! @endcond
+
+#endif // __OPENCV_STITCHING_UTIL_INL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp
new file mode 100644
index 0000000..ee8e824
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers.hpp
@@ -0,0 +1,586 @@
+ /*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*/
+
+#ifndef __OPENCV_STITCHING_WARPERS_HPP__
+#define __OPENCV_STITCHING_WARPERS_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/core/cuda.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/opencv_modules.hpp"
+
+namespace cv {
+namespace detail {
+
+//! @addtogroup stitching_warp
+//! @{
+
+/** @brief Rotation-only model image warper interface.
+ */
+class CV_EXPORTS RotationWarper
+{
+public:
+    virtual ~RotationWarper() {}
+
+    /** @brief Projects the image point.
+
+    @param pt Source point
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @return Projected point
+     */
+    virtual Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R) = 0;
+
+    /** @brief Builds the projection maps according to the given camera data.
+
+    @param src_size Source image size
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @param xmap Projection map for the x axis
+    @param ymap Projection map for the y axis
+    @return Projected image minimum bounding box
+     */
+    virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap) = 0;
+
+    /** @brief Projects the image.
+
+    @param src Source image
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @param interp_mode Interpolation mode
+    @param border_mode Border extrapolation mode
+    @param dst Projected image
+    @return Project image top-left corner
+     */
+    virtual Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                       OutputArray dst) = 0;
+
+    /** @brief Projects the image backward.
+
+    @param src Projected image
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @param interp_mode Interpolation mode
+    @param border_mode Border extrapolation mode
+    @param dst_size Backward-projected image size
+    @param dst Backward-projected image
+     */
+    virtual void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                              Size dst_size, OutputArray dst) = 0;
+
+    /**
+    @param src_size Source image bounding box
+    @param K Camera intrinsic parameters
+    @param R Camera rotation matrix
+    @return Projected image minimum bounding box
+     */
+    virtual Rect warpRoi(Size src_size, InputArray K, InputArray R) = 0;
+
+    virtual float getScale() const { return 1.f; }
+    virtual void setScale(float) {}
+};
+
+/** @brief Base class for warping logic implementation.
+ */
+struct CV_EXPORTS ProjectorBase
+{
+    void setCameraParams(InputArray K = Mat::eye(3, 3, CV_32F),
+                         InputArray R = Mat::eye(3, 3, CV_32F),
+                         InputArray T = Mat::zeros(3, 1, CV_32F));
+
+    float scale;
+    float k[9];
+    float rinv[9];
+    float r_kinv[9];
+    float k_rinv[9];
+    float t[3];
+};
+
+/** @brief Base class for rotation-based warper using a detail::ProjectorBase_ derived class.
+ */
+template <class P>
+class CV_EXPORTS RotationWarperBase : public RotationWarper
+{
+public:
+    Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
+
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               OutputArray dst);
+
+    void warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                      Size dst_size, OutputArray dst);
+
+    Rect warpRoi(Size src_size, InputArray K, InputArray R);
+
+    float getScale() const { return projector_.scale; }
+    void setScale(float val) { projector_.scale = val; }
+
+protected:
+
+    // Detects ROI of the destination image. It's correct for any projection.
+    virtual void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
+
+    // Detects ROI of the destination image by walking over image border.
+    // Correctness for any projection isn't guaranteed.
+    void detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br);
+
+    P projector_;
+};
+
+
+struct CV_EXPORTS PlaneProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+/** @brief Warper that maps an image onto the z = 1 plane.
+ */
+class CV_EXPORTS PlaneWarper : public RotationWarperBase<PlaneProjector>
+{
+public:
+    /** @brief Construct an instance of the plane warper class.
+
+    @param scale Projected image scale multiplier
+     */
+    PlaneWarper(float scale = 1.f) { projector_.scale = scale; }
+
+    Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R);
+    Point2f warpPoint(const Point2f &pt, InputArray K, InputArray R, InputArray T);
+
+    virtual Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap);
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
+
+    Point warp(InputArray src, InputArray K, InputArray R,
+               int interp_mode, int border_mode, OutputArray dst);
+    virtual Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
+               OutputArray dst);
+
+    Rect warpRoi(Size src_size, InputArray K, InputArray R);
+    Rect warpRoi(Size src_size, InputArray K, InputArray R, InputArray T);
+
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
+};
+
+
+struct CV_EXPORTS SphericalProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+/** @brief Warper that maps an image onto the unit sphere located at the origin.
+
+ Projects image onto unit sphere with origin at (0, 0, 0).
+ Poles are located at (0, -1, 0) and (0, 1, 0) points.
+*/
+class CV_EXPORTS SphericalWarper : public RotationWarperBase<SphericalProjector>
+{
+public:
+    /** @brief Construct an instance of the spherical warper class.
+
+    @param scale Projected image scale multiplier
+     */
+    SphericalWarper(float scale) { projector_.scale = scale; }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst);
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
+};
+
+
+struct CV_EXPORTS CylindricalProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+/** @brief Warper that maps an image onto the x\*x + z\*z = 1 cylinder.
+ */
+class CV_EXPORTS CylindricalWarper : public RotationWarperBase<CylindricalProjector>
+{
+public:
+    /** @brief Construct an instance of the cylindrical warper class.
+
+    @param scale Projected image scale multiplier
+     */
+    CylindricalWarper(float scale) { projector_.scale = scale; }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap);
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode, OutputArray dst);
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
+    {
+        RotationWarperBase<CylindricalProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
+    }
+};
+
+
+struct CV_EXPORTS FisheyeProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS FisheyeWarper : public RotationWarperBase<FisheyeProjector>
+{
+public:
+    FisheyeWarper(float scale) { projector_.scale = scale; }
+};
+
+
+struct CV_EXPORTS StereographicProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS StereographicWarper : public RotationWarperBase<StereographicProjector>
+{
+public:
+    StereographicWarper(float scale) { projector_.scale = scale; }
+};
+
+
+struct CV_EXPORTS CompressedRectilinearProjector : ProjectorBase
+{
+    float a, b;
+
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS CompressedRectilinearWarper : public RotationWarperBase<CompressedRectilinearProjector>
+{
+public:
+    CompressedRectilinearWarper(float scale, float A = 1, float B = 1)
+    {
+        projector_.a = A;
+        projector_.b = B;
+        projector_.scale = scale;
+    }
+};
+
+
+struct CV_EXPORTS CompressedRectilinearPortraitProjector : ProjectorBase
+{
+    float a, b;
+
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS CompressedRectilinearPortraitWarper : public RotationWarperBase<CompressedRectilinearPortraitProjector>
+{
+public:
+   CompressedRectilinearPortraitWarper(float scale, float A = 1, float B = 1)
+   {
+       projector_.a = A;
+       projector_.b = B;
+       projector_.scale = scale;
+   }
+};
+
+
+struct CV_EXPORTS PaniniProjector : ProjectorBase
+{
+    float a, b;
+
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS PaniniWarper : public RotationWarperBase<PaniniProjector>
+{
+public:
+   PaniniWarper(float scale, float A = 1, float B = 1)
+   {
+       projector_.a = A;
+       projector_.b = B;
+       projector_.scale = scale;
+   }
+};
+
+
+struct CV_EXPORTS PaniniPortraitProjector : ProjectorBase
+{
+    float a, b;
+
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS PaniniPortraitWarper : public RotationWarperBase<PaniniPortraitProjector>
+{
+public:
+   PaniniPortraitWarper(float scale, float A = 1, float B = 1)
+   {
+       projector_.a = A;
+       projector_.b = B;
+       projector_.scale = scale;
+   }
+
+};
+
+
+struct CV_EXPORTS MercatorProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS MercatorWarper : public RotationWarperBase<MercatorProjector>
+{
+public:
+    MercatorWarper(float scale) { projector_.scale = scale; }
+};
+
+
+struct CV_EXPORTS TransverseMercatorProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS TransverseMercatorWarper : public RotationWarperBase<TransverseMercatorProjector>
+{
+public:
+    TransverseMercatorWarper(float scale) { projector_.scale = scale; }
+};
+
+
+class CV_EXPORTS PlaneWarperGpu : public PlaneWarper
+{
+public:
+    PlaneWarperGpu(float scale = 1.f) : PlaneWarper(scale) {}
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
+    {
+        Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
+        d_xmap_.download(xmap);
+        d_ymap_.download(ymap);
+        return result;
+    }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, OutputArray xmap, OutputArray ymap)
+    {
+        Rect result = buildMaps(src_size, K, R, T, d_xmap_, d_ymap_);
+        d_xmap_.download(xmap);
+        d_ymap_.download(ymap);
+        return result;
+    }
+
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               OutputArray dst)
+    {
+        d_src_.upload(src);
+        Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
+        d_dst_.download(dst);
+        return result;
+    }
+
+    Point warp(InputArray src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
+               OutputArray dst)
+    {
+        d_src_.upload(src);
+        Point result = warp(d_src_, K, R, T, interp_mode, border_mode, d_dst_);
+        d_dst_.download(dst);
+        return result;
+    }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, InputArray T, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
+
+    Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               cuda::GpuMat & dst);
+
+    Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, InputArray T, int interp_mode, int border_mode,
+               cuda::GpuMat & dst);
+
+private:
+    cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
+};
+
+
+class CV_EXPORTS SphericalWarperGpu : public SphericalWarper
+{
+public:
+    SphericalWarperGpu(float scale) : SphericalWarper(scale) {}
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
+    {
+        Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
+        d_xmap_.download(xmap);
+        d_ymap_.download(ymap);
+        return result;
+    }
+
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               OutputArray dst)
+    {
+        d_src_.upload(src);
+        Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
+        d_dst_.download(dst);
+        return result;
+    }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
+
+    Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               cuda::GpuMat & dst);
+
+private:
+    cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
+};
+
+
+class CV_EXPORTS CylindricalWarperGpu : public CylindricalWarper
+{
+public:
+    CylindricalWarperGpu(float scale) : CylindricalWarper(scale) {}
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, OutputArray xmap, OutputArray ymap)
+    {
+        Rect result = buildMaps(src_size, K, R, d_xmap_, d_ymap_);
+        d_xmap_.download(xmap);
+        d_ymap_.download(ymap);
+        return result;
+    }
+
+    Point warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               OutputArray dst)
+    {
+        d_src_.upload(src);
+        Point result = warp(d_src_, K, R, interp_mode, border_mode, d_dst_);
+        d_dst_.download(dst);
+        return result;
+    }
+
+    Rect buildMaps(Size src_size, InputArray K, InputArray R, cuda::GpuMat & xmap, cuda::GpuMat & ymap);
+
+    Point warp(const cuda::GpuMat & src, InputArray K, InputArray R, int interp_mode, int border_mode,
+               cuda::GpuMat & dst);
+
+private:
+    cuda::GpuMat d_xmap_, d_ymap_, d_src_, d_dst_;
+};
+
+
+struct SphericalPortraitProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+// Projects image onto unit sphere with origin at (0, 0, 0).
+// Poles are located NOT at (0, -1, 0) and (0, 1, 0) points, BUT at (1, 0, 0) and (-1, 0, 0) points.
+class CV_EXPORTS SphericalPortraitWarper : public RotationWarperBase<SphericalPortraitProjector>
+{
+public:
+    SphericalPortraitWarper(float scale) { projector_.scale = scale; }
+
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br);
+};
+
+struct CylindricalPortraitProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS CylindricalPortraitWarper : public RotationWarperBase<CylindricalPortraitProjector>
+{
+public:
+    CylindricalPortraitWarper(float scale) { projector_.scale = scale; }
+
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
+    {
+        RotationWarperBase<CylindricalPortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
+    }
+};
+
+struct PlanePortraitProjector : ProjectorBase
+{
+    void mapForward(float x, float y, float &u, float &v);
+    void mapBackward(float u, float v, float &x, float &y);
+};
+
+
+class CV_EXPORTS PlanePortraitWarper : public RotationWarperBase<PlanePortraitProjector>
+{
+public:
+    PlanePortraitWarper(float scale) { projector_.scale = scale; }
+
+protected:
+    void detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
+    {
+        RotationWarperBase<PlanePortraitProjector>::detectResultRoiByBorder(src_size, dst_tl, dst_br);
+    }
+};
+
+//! @} stitching_warp
+
+} // namespace detail
+} // namespace cv
+
+#include "warpers_inl.hpp"
+
+#endif // __OPENCV_STITCHING_WARPERS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp
new file mode 100644
index 0000000..0416ecb
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/detail/warpers_inl.hpp
@@ -0,0 +1,774 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_WARPERS_INL_HPP__
+#define __OPENCV_STITCHING_WARPERS_INL_HPP__
+
+#include "opencv2/core.hpp"
+#include "warpers.hpp" // Make your IDE see declarations
+#include <limits>
+
+//! @cond IGNORED
+
+namespace cv {
+namespace detail {
+
+template <class P>
+Point2f RotationWarperBase<P>::warpPoint(const Point2f &pt, InputArray K, InputArray R)
+{
+    projector_.setCameraParams(K, R);
+    Point2f uv;
+    projector_.mapForward(pt.x, pt.y, uv.x, uv.y);
+    return uv;
+}
+
+
+template <class P>
+Rect RotationWarperBase<P>::buildMaps(Size src_size, InputArray K, InputArray R, OutputArray _xmap, OutputArray _ymap)
+{
+    projector_.setCameraParams(K, R);
+
+    Point dst_tl, dst_br;
+    detectResultRoi(src_size, dst_tl, dst_br);
+
+    _xmap.create(dst_br.y - dst_tl.y + 1, dst_br.x - dst_tl.x + 1, CV_32F);
+    _ymap.create(dst_br.y - dst_tl.y + 1, dst_br.x - dst_tl.x + 1, CV_32F);
+
+    Mat xmap = _xmap.getMat(), ymap = _ymap.getMat();
+
+    float x, y;
+    for (int v = dst_tl.y; v <= dst_br.y; ++v)
+    {
+        for (int u = dst_tl.x; u <= dst_br.x; ++u)
+        {
+            projector_.mapBackward(static_cast<float>(u), static_cast<float>(v), x, y);
+            xmap.at<float>(v - dst_tl.y, u - dst_tl.x) = x;
+            ymap.at<float>(v - dst_tl.y, u - dst_tl.x) = y;
+        }
+    }
+
+    return Rect(dst_tl, dst_br);
+}
+
+
+template <class P>
+Point RotationWarperBase<P>::warp(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                                  OutputArray dst)
+{
+    UMat xmap, ymap;
+    Rect dst_roi = buildMaps(src.size(), K, R, xmap, ymap);
+
+    dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type());
+    remap(src, dst, xmap, ymap, interp_mode, border_mode);
+
+    return dst_roi.tl();
+}
+
+
+template <class P>
+void RotationWarperBase<P>::warpBackward(InputArray src, InputArray K, InputArray R, int interp_mode, int border_mode,
+                                         Size dst_size, OutputArray dst)
+{
+    projector_.setCameraParams(K, R);
+
+    Point src_tl, src_br;
+    detectResultRoi(dst_size, src_tl, src_br);
+
+    Size size = src.size();
+    CV_Assert(src_br.x - src_tl.x + 1 == size.width && src_br.y - src_tl.y + 1 == size.height);
+
+    Mat xmap(dst_size, CV_32F);
+    Mat ymap(dst_size, CV_32F);
+
+    float u, v;
+    for (int y = 0; y < dst_size.height; ++y)
+    {
+        for (int x = 0; x < dst_size.width; ++x)
+        {
+            projector_.mapForward(static_cast<float>(x), static_cast<float>(y), u, v);
+            xmap.at<float>(y, x) = u - src_tl.x;
+            ymap.at<float>(y, x) = v - src_tl.y;
+        }
+    }
+
+    dst.create(dst_size, src.type());
+    remap(src, dst, xmap, ymap, interp_mode, border_mode);
+}
+
+
+template <class P>
+Rect RotationWarperBase<P>::warpRoi(Size src_size, InputArray K, InputArray R)
+{
+    projector_.setCameraParams(K, R);
+
+    Point dst_tl, dst_br;
+    detectResultRoi(src_size, dst_tl, dst_br);
+
+    return Rect(dst_tl, Point(dst_br.x + 1, dst_br.y + 1));
+}
+
+
+template <class P>
+void RotationWarperBase<P>::detectResultRoi(Size src_size, Point &dst_tl, Point &dst_br)
+{
+    float tl_uf = std::numeric_limits<float>::max();
+    float tl_vf = std::numeric_limits<float>::max();
+    float br_uf = -std::numeric_limits<float>::max();
+    float br_vf = -std::numeric_limits<float>::max();
+
+    float u, v;
+    for (int y = 0; y < src_size.height; ++y)
+    {
+        for (int x = 0; x < src_size.width; ++x)
+        {
+            projector_.mapForward(static_cast<float>(x), static_cast<float>(y), u, v);
+            tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+            br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+        }
+    }
+
+    dst_tl.x = static_cast<int>(tl_uf);
+    dst_tl.y = static_cast<int>(tl_vf);
+    dst_br.x = static_cast<int>(br_uf);
+    dst_br.y = static_cast<int>(br_vf);
+}
+
+
+template <class P>
+void RotationWarperBase<P>::detectResultRoiByBorder(Size src_size, Point &dst_tl, Point &dst_br)
+{
+    float tl_uf = std::numeric_limits<float>::max();
+    float tl_vf = std::numeric_limits<float>::max();
+    float br_uf = -std::numeric_limits<float>::max();
+    float br_vf = -std::numeric_limits<float>::max();
+
+    float u, v;
+    for (float x = 0; x < src_size.width; ++x)
+    {
+        projector_.mapForward(static_cast<float>(x), 0, u, v);
+        tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+        br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+
+        projector_.mapForward(static_cast<float>(x), static_cast<float>(src_size.height - 1), u, v);
+        tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+        br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+    }
+    for (int y = 0; y < src_size.height; ++y)
+    {
+        projector_.mapForward(0, static_cast<float>(y), u, v);
+        tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+        br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+
+        projector_.mapForward(static_cast<float>(src_size.width - 1), static_cast<float>(y), u, v);
+        tl_uf = std::min(tl_uf, u); tl_vf = std::min(tl_vf, v);
+        br_uf = std::max(br_uf, u); br_vf = std::max(br_vf, v);
+    }
+
+    dst_tl.x = static_cast<int>(tl_uf);
+    dst_tl.y = static_cast<int>(tl_vf);
+    dst_br.x = static_cast<int>(br_uf);
+    dst_br.y = static_cast<int>(br_vf);
+}
+
+
+inline
+void PlaneProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    x_ = t[0] + x_ / z_ * (1 - t[2]);
+    y_ = t[1] + y_ / z_ * (1 - t[2]);
+
+    u = scale * x_;
+    v = scale * y_;
+}
+
+
+inline
+void PlaneProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u = u / scale - t[0];
+    v = v / scale - t[1];
+
+    float z;
+    x = k_rinv[0] * u + k_rinv[1] * v + k_rinv[2] * (1 - t[2]);
+    y = k_rinv[3] * u + k_rinv[4] * v + k_rinv[5] * (1 - t[2]);
+    z = k_rinv[6] * u + k_rinv[7] * v + k_rinv[8] * (1 - t[2]);
+
+    x /= z;
+    y /= z;
+}
+
+
+inline
+void SphericalProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    u = scale * atan2f(x_, z_);
+    float w = y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_);
+    v = scale * (static_cast<float>(CV_PI) - acosf(w == w ? w : 0));
+}
+
+
+inline
+void SphericalProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float sinv = sinf(static_cast<float>(CV_PI) - v);
+    float x_ = sinv * sinf(u);
+    float y_ = cosf(static_cast<float>(CV_PI) - v);
+    float z_ = sinv * cosf(u);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+
+inline
+void CylindricalProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    u = scale * atan2f(x_, z_);
+    v = scale * y_ / sqrtf(x_ * x_ + z_ * z_);
+}
+
+
+inline
+void CylindricalProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float x_ = sinf(u);
+    float y_ = v;
+    float z_ = cosf(u);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void FisheyeProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = (float)CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    u = scale * v_ * cosf(u_);
+    v = scale * v_ * sinf(u_);
+}
+
+inline
+void FisheyeProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float u_ = atan2f(v, u);
+    float v_ = sqrtf(u*u + v*v);
+
+    float sinv = sinf((float)CV_PI - v_);
+    float x_ = sinv * sinf(u_);
+    float y_ = cosf((float)CV_PI - v_);
+    float z_ = sinv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void StereographicProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = (float)CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    float r = sinf(v_) / (1 - cosf(v_));
+
+    u = scale * r * cos(u_);
+    v = scale * r * sin(u_);
+}
+
+inline
+void StereographicProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float u_ = atan2f(v, u);
+    float r = sqrtf(u*u + v*v);
+    float v_ = 2 * atanf(1.f / r);
+
+    float sinv = sinf((float)CV_PI - v_);
+    float x_ = sinv * sinf(u_);
+    float y_ = cosf((float)CV_PI - v_);
+    float z_ = sinv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void CompressedRectilinearProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    u = scale * a * tanf(u_ / a);
+    v = scale * b * tanf(v_) / cosf(u_);
+}
+
+inline
+void CompressedRectilinearProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float aatg = a * atanf(u / a);
+    float u_ = aatg;
+    float v_ = atanf(v * cosf(aatg) / b);
+
+    float cosv = cosf(v_);
+    float x_ = cosv * sinf(u_);
+    float y_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void CompressedRectilinearPortraitProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float y_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float x_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    u = - scale * a * tanf(u_ / a);
+    v = scale * b * tanf(v_) / cosf(u_);
+}
+
+inline
+void CompressedRectilinearPortraitProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= - scale;
+    v /= scale;
+
+    float aatg = a * atanf(u / a);
+    float u_ = aatg;
+    float v_ = atanf(v * cosf( aatg ) / b);
+
+    float cosv = cosf(v_);
+    float y_ = cosv * sinf(u_);
+    float x_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void PaniniProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    float tg = a * tanf(u_ / a);
+    u = scale * tg;
+
+    float sinu = sinf(u_);
+    if ( fabs(sinu) < 1E-7 )
+        v = scale * b * tanf(v_);
+    else
+        v = scale * b * tg * tanf(v_) / sinu;
+}
+
+inline
+void PaniniProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float lamda = a * atanf(u / a);
+    float u_ = lamda;
+
+    float v_;
+    if ( fabs(lamda) > 1E-7)
+        v_ = atanf(v * sinf(lamda) / (b * a * tanf(lamda / a)));
+    else
+        v_ = atanf(v / b);
+
+    float cosv = cosf(v_);
+    float x_ = cosv * sinf(u_);
+    float y_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void PaniniPortraitProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float y_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float x_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    float tg = a * tanf(u_ / a);
+    u = - scale * tg;
+
+    float sinu = sinf( u_ );
+    if ( fabs(sinu) < 1E-7 )
+        v = scale * b * tanf(v_);
+    else
+        v = scale * b * tg * tanf(v_) / sinu;
+}
+
+inline
+void PaniniPortraitProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= - scale;
+    v /= scale;
+
+    float lamda = a * atanf(u / a);
+    float u_ = lamda;
+
+    float v_;
+    if ( fabs(lamda) > 1E-7)
+        v_ = atanf(v * sinf(lamda) / (b * a * tanf(lamda/a)));
+    else
+        v_ = atanf(v / b);
+
+    float cosv = cosf(v_);
+    float y_ = cosv * sinf(u_);
+    float x_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void MercatorProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    u = scale * u_;
+    v = scale * logf( tanf( (float)(CV_PI/4) + v_/2 ) );
+}
+
+inline
+void MercatorProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float v_ = atanf( sinhf(v) );
+    float u_ = u;
+
+    float cosv = cosf(v_);
+    float x_ = cosv * sinf(u_);
+    float y_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void TransverseMercatorProjector::mapForward(float x, float y, float &u, float &v)
+{
+    float x_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float u_ = atan2f(x_, z_);
+    float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
+
+    float B = cosf(v_) * sinf(u_);
+
+    u = scale / 2 * logf( (1+B) / (1-B) );
+    v = scale * atan2f(tanf(v_), cosf(u_));
+}
+
+inline
+void TransverseMercatorProjector::mapBackward(float u, float v, float &x, float &y)
+{
+    u /= scale;
+    v /= scale;
+
+    float v_ = asinf( sinf(v) / coshf(u) );
+    float u_ = atan2f( sinhf(u), cos(v) );
+
+    float cosv = cosf(v_);
+    float x_ = cosv * sinf(u_);
+    float y_ = sinf(v_);
+    float z_ = cosv * cosf(u_);
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void SphericalPortraitProjector::mapForward(float x, float y, float &u0, float &v0)
+{
+    float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float x_ = y0_;
+    float y_ = x0_;
+    float u, v;
+
+    u = scale * atan2f(x_, z_);
+    v = scale * (static_cast<float>(CV_PI) - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_)));
+
+    u0 = -u;//v;
+    v0 = v;//u;
+}
+
+
+inline
+void SphericalPortraitProjector::mapBackward(float u0, float v0, float &x, float &y)
+{
+    float u, v;
+    u = -u0;//v0;
+    v = v0;//u0;
+
+    u /= scale;
+    v /= scale;
+
+    float sinv = sinf(static_cast<float>(CV_PI) - v);
+    float x0_ = sinv * sinf(u);
+    float y0_ = cosf(static_cast<float>(CV_PI) - v);
+    float z_ = sinv * cosf(u);
+
+    float x_ = y0_;
+    float y_ = x0_;
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void CylindricalPortraitProjector::mapForward(float x, float y, float &u0, float &v0)
+{
+    float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_  = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float x_ = y0_;
+    float y_ = x0_;
+    float u, v;
+
+    u = scale * atan2f(x_, z_);
+    v = scale * y_ / sqrtf(x_ * x_ + z_ * z_);
+
+    u0 = -u;//v;
+    v0 = v;//u;
+}
+
+
+inline
+void CylindricalPortraitProjector::mapBackward(float u0, float v0, float &x, float &y)
+{
+    float u, v;
+    u = -u0;//v0;
+    v = v0;//u0;
+
+    u /= scale;
+    v /= scale;
+
+    float x0_ = sinf(u);
+    float y0_ = v;
+    float z_  = cosf(u);
+
+    float x_ = y0_;
+    float y_ = x0_;
+
+    float z;
+    x = k_rinv[0] * x_ + k_rinv[1] * y_ + k_rinv[2] * z_;
+    y = k_rinv[3] * x_ + k_rinv[4] * y_ + k_rinv[5] * z_;
+    z = k_rinv[6] * x_ + k_rinv[7] * y_ + k_rinv[8] * z_;
+
+    if (z > 0) { x /= z; y /= z; }
+    else x = y = -1;
+}
+
+inline
+void PlanePortraitProjector::mapForward(float x, float y, float &u0, float &v0)
+{
+    float x0_ = r_kinv[0] * x + r_kinv[1] * y + r_kinv[2];
+    float y0_ = r_kinv[3] * x + r_kinv[4] * y + r_kinv[5];
+    float z_  = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
+
+    float x_ = y0_;
+    float y_ = x0_;
+
+    x_ = t[0] + x_ / z_ * (1 - t[2]);
+    y_ = t[1] + y_ / z_ * (1 - t[2]);
+
+    float u,v;
+    u = scale * x_;
+    v = scale * y_;
+
+    u0 = -u;
+    v0 = v;
+}
+
+
+inline
+void PlanePortraitProjector::mapBackward(float u0, float v0, float &x, float &y)
+{
+    float u, v;
+    u = -u0;
+    v = v0;
+
+    u = u / scale - t[0];
+    v = v / scale - t[1];
+
+    float z;
+    x = k_rinv[0] * v + k_rinv[1] * u + k_rinv[2] * (1 - t[2]);
+    y = k_rinv[3] * v + k_rinv[4] * u + k_rinv[5] * (1 - t[2]);
+    z = k_rinv[6] * v + k_rinv[7] * u + k_rinv[8] * (1 - t[2]);
+
+    x /= z;
+    y /= z;
+}
+
+
+} // namespace detail
+} // namespace cv
+
+//! @endcond
+
+#endif // __OPENCV_STITCHING_WARPERS_INL_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp
new file mode 100644
index 0000000..7e570d3
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/stitching/warpers.hpp
@@ -0,0 +1,183 @@
+/*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*/
+
+#ifndef __OPENCV_STITCHING_WARPER_CREATORS_HPP__
+#define __OPENCV_STITCHING_WARPER_CREATORS_HPP__
+
+#include "opencv2/stitching/detail/warpers.hpp"
+
+namespace cv {
+
+//! @addtogroup stitching_warp
+//! @{
+
+/** @brief Image warper factories base class.
+ */
+class WarperCreator
+{
+public:
+    virtual ~WarperCreator() {}
+    virtual Ptr<detail::RotationWarper> create(float scale) const = 0;
+};
+
+/** @brief Plane warper factory class.
+  @sa detail::PlaneWarper
+ */
+class PlaneWarper : public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PlaneWarper>(scale); }
+};
+
+/** @brief Cylindrical warper factory class.
+@sa detail::CylindricalWarper
+*/
+class CylindricalWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarper>(scale); }
+};
+
+/** @brief Spherical warper factory class */
+class SphericalWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarper>(scale); }
+};
+
+class FisheyeWarper : public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::FisheyeWarper>(scale); }
+};
+
+class StereographicWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::StereographicWarper>(scale); }
+};
+
+class CompressedRectilinearWarper: public WarperCreator
+{
+    float a, b;
+public:
+    CompressedRectilinearWarper(float A = 1, float B = 1)
+    {
+        a = A; b = B;
+    }
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CompressedRectilinearWarper>(scale, a, b); }
+};
+
+class CompressedRectilinearPortraitWarper: public WarperCreator
+{
+    float a, b;
+public:
+    CompressedRectilinearPortraitWarper(float A = 1, float B = 1)
+    {
+        a = A; b = B;
+    }
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CompressedRectilinearPortraitWarper>(scale, a, b); }
+};
+
+class PaniniWarper: public WarperCreator
+{
+    float a, b;
+public:
+    PaniniWarper(float A = 1, float B = 1)
+    {
+        a = A; b = B;
+    }
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PaniniWarper>(scale, a, b); }
+};
+
+class PaniniPortraitWarper: public WarperCreator
+{
+    float a, b;
+public:
+    PaniniPortraitWarper(float A = 1, float B = 1)
+    {
+        a = A; b = B;
+    }
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PaniniPortraitWarper>(scale, a, b); }
+};
+
+class MercatorWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::MercatorWarper>(scale); }
+};
+
+class TransverseMercatorWarper: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::TransverseMercatorWarper>(scale); }
+};
+
+
+
+#ifdef HAVE_OPENCV_CUDAWARPING
+class PlaneWarperGpu: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::PlaneWarperGpu>(scale); }
+};
+
+
+class CylindricalWarperGpu: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::CylindricalWarperGpu>(scale); }
+};
+
+
+class SphericalWarperGpu: public WarperCreator
+{
+public:
+    Ptr<detail::RotationWarper> create(float scale) const { return makePtr<detail::SphericalWarperGpu>(scale); }
+};
+#endif
+
+//! @} stitching_warp
+
+} // namespace cv
+
+#endif // __OPENCV_STITCHING_WARPER_CREATORS_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/superres.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/superres.hpp
new file mode 100644
index 0000000..dec8e4e
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/superres.hpp
@@ -0,0 +1,207 @@
+/*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*/
+
+#ifndef __OPENCV_SUPERRES_HPP__
+#define __OPENCV_SUPERRES_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/superres/optical_flow.hpp"
+
+/**
+  @defgroup superres Super Resolution
+
+The Super Resolution module contains a set of functions and classes that can be used to solve the
+problem of resolution enhancement. There are a few methods implemented, most of them are descibed in
+the papers @cite Farsiu03 and @cite Mitzel09 .
+
+ */
+
+namespace cv
+{
+    namespace superres
+    {
+
+//! @addtogroup superres
+//! @{
+
+        class CV_EXPORTS FrameSource
+        {
+        public:
+            virtual ~FrameSource();
+
+            virtual void nextFrame(OutputArray frame) = 0;
+            virtual void reset() = 0;
+        };
+
+        CV_EXPORTS Ptr<FrameSource> createFrameSource_Empty();
+
+        CV_EXPORTS Ptr<FrameSource> createFrameSource_Video(const String& fileName);
+        CV_EXPORTS Ptr<FrameSource> createFrameSource_Video_CUDA(const String& fileName);
+
+        CV_EXPORTS Ptr<FrameSource> createFrameSource_Camera(int deviceId = 0);
+
+        /** @brief Base class for Super Resolution algorithms.
+
+        The class is only used to define the common interface for the whole family of Super Resolution
+        algorithms.
+         */
+        class CV_EXPORTS SuperResolution : public cv::Algorithm, public FrameSource
+        {
+        public:
+            /** @brief Set input frame source for Super Resolution algorithm.
+
+            @param frameSource Input frame source
+             */
+            void setInput(const Ptr<FrameSource>& frameSource);
+
+            /** @brief Process next frame from input and return output result.
+
+            @param frame Output result
+             */
+            void nextFrame(OutputArray frame);
+            void reset();
+
+            /** @brief Clear all inner buffers.
+            */
+            virtual void collectGarbage();
+
+            //! @brief Scale factor
+            /** @see setScale */
+            virtual int getScale() const = 0;
+            /** @copybrief getScale @see getScale */
+            virtual void setScale(int val) = 0;
+
+            //! @brief Iterations count
+            /** @see setIterations */
+            virtual int getIterations() const = 0;
+            /** @copybrief getIterations @see getIterations */
+            virtual void setIterations(int val) = 0;
+
+            //! @brief Asymptotic value of steepest descent method
+            /** @see setTau */
+            virtual double getTau() const = 0;
+            /** @copybrief getTau @see getTau */
+            virtual void setTau(double val) = 0;
+
+            //! @brief Weight parameter to balance data term and smoothness term
+            /** @see setLabmda */
+            virtual double getLabmda() const = 0;
+            /** @copybrief getLabmda @see getLabmda */
+            virtual void setLabmda(double val) = 0;
+
+            //! @brief Parameter of spacial distribution in Bilateral-TV
+            /** @see setAlpha */
+            virtual double getAlpha() const = 0;
+            /** @copybrief getAlpha @see getAlpha */
+            virtual void setAlpha(double val) = 0;
+
+            //! @brief Kernel size of Bilateral-TV filter
+            /** @see setKernelSize */
+            virtual int getKernelSize() const = 0;
+            /** @copybrief getKernelSize @see getKernelSize */
+            virtual void setKernelSize(int val) = 0;
+
+            //! @brief Gaussian blur kernel size
+            /** @see setBlurKernelSize */
+            virtual int getBlurKernelSize() const = 0;
+            /** @copybrief getBlurKernelSize @see getBlurKernelSize */
+            virtual void setBlurKernelSize(int val) = 0;
+
+            //! @brief Gaussian blur sigma
+            /** @see setBlurSigma */
+            virtual double getBlurSigma() const = 0;
+            /** @copybrief getBlurSigma @see getBlurSigma */
+            virtual void setBlurSigma(double val) = 0;
+
+            //! @brief Radius of the temporal search area
+            /** @see setTemporalAreaRadius */
+            virtual int getTemporalAreaRadius() const = 0;
+            /** @copybrief getTemporalAreaRadius @see getTemporalAreaRadius */
+            virtual void setTemporalAreaRadius(int val) = 0;
+
+            //! @brief Dense optical flow algorithm
+            /** @see setOpticalFlow */
+            virtual Ptr<cv::superres::DenseOpticalFlowExt> getOpticalFlow() const = 0;
+            /** @copybrief getOpticalFlow @see getOpticalFlow */
+            virtual void setOpticalFlow(const Ptr<cv::superres::DenseOpticalFlowExt> &val) = 0;
+
+        protected:
+            SuperResolution();
+
+            virtual void initImpl(Ptr<FrameSource>& frameSource) = 0;
+            virtual void processImpl(Ptr<FrameSource>& frameSource, OutputArray output) = 0;
+
+            bool isUmat_;
+
+        private:
+            Ptr<FrameSource> frameSource_;
+            bool firstCall_;
+        };
+
+        /** @brief Create Bilateral TV-L1 Super Resolution.
+
+        This class implements Super Resolution algorithm described in the papers @cite Farsiu03 and
+        @cite Mitzel09 .
+
+        Here are important members of the class that control the algorithm, which you can set after
+        constructing the class instance:
+
+        -   **int scale** Scale factor.
+        -   **int iterations** Iteration count.
+        -   **double tau** Asymptotic value of steepest descent method.
+        -   **double lambda** Weight parameter to balance data term and smoothness term.
+        -   **double alpha** Parameter of spacial distribution in Bilateral-TV.
+        -   **int btvKernelSize** Kernel size of Bilateral-TV filter.
+        -   **int blurKernelSize** Gaussian blur kernel size.
+        -   **double blurSigma** Gaussian blur sigma.
+        -   **int temporalAreaRadius** Radius of the temporal search area.
+        -   **Ptr\<DenseOpticalFlowExt\> opticalFlow** Dense optical flow algorithm.
+         */
+        CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1();
+        CV_EXPORTS Ptr<SuperResolution> createSuperResolution_BTVL1_CUDA();
+
+//! @} superres
+
+    }
+}
+
+#endif // __OPENCV_SUPERRES_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp
new file mode 100644
index 0000000..d2f29a3
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/superres/optical_flow.hpp
@@ -0,0 +1,203 @@
+/*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*/
+
+#ifndef __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
+#define __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+    namespace superres
+    {
+
+//! @addtogroup superres
+//! @{
+
+        class CV_EXPORTS DenseOpticalFlowExt : public cv::Algorithm
+        {
+        public:
+            virtual void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2 = noArray()) = 0;
+            virtual void collectGarbage() = 0;
+        };
+
+
+        class CV_EXPORTS FarnebackOpticalFlow : public virtual DenseOpticalFlowExt
+        {
+        public:
+            /** @see setPyrScale */
+            virtual double getPyrScale() const = 0;
+            /** @copybrief getPyrScale @see getPyrScale */
+            virtual void setPyrScale(double val) = 0;
+            /** @see setLevelsNumber */
+            virtual int getLevelsNumber() const = 0;
+            /** @copybrief getLevelsNumber @see getLevelsNumber */
+            virtual void setLevelsNumber(int val) = 0;
+            /** @see setWindowSize */
+            virtual int getWindowSize() const = 0;
+            /** @copybrief getWindowSize @see getWindowSize */
+            virtual void setWindowSize(int val) = 0;
+            /** @see setIterations */
+            virtual int getIterations() const = 0;
+            /** @copybrief getIterations @see getIterations */
+            virtual void setIterations(int val) = 0;
+            /** @see setPolyN */
+            virtual int getPolyN() const = 0;
+            /** @copybrief getPolyN @see getPolyN */
+            virtual void setPolyN(int val) = 0;
+            /** @see setPolySigma */
+            virtual double getPolySigma() const = 0;
+            /** @copybrief getPolySigma @see getPolySigma */
+            virtual void setPolySigma(double val) = 0;
+            /** @see setFlags */
+            virtual int getFlags() const = 0;
+            /** @copybrief getFlags @see getFlags */
+            virtual void setFlags(int val) = 0;
+        };
+        CV_EXPORTS Ptr<FarnebackOpticalFlow> createOptFlow_Farneback();
+        CV_EXPORTS Ptr<FarnebackOpticalFlow> createOptFlow_Farneback_CUDA();
+
+
+//        CV_EXPORTS Ptr<DenseOpticalFlowExt> createOptFlow_Simple();
+
+
+        class CV_EXPORTS DualTVL1OpticalFlow : public virtual DenseOpticalFlowExt
+        {
+        public:
+            /** @see setTau */
+            virtual double getTau() const = 0;
+            /** @copybrief getTau @see getTau */
+            virtual void setTau(double val) = 0;
+            /** @see setLambda */
+            virtual double getLambda() const = 0;
+            /** @copybrief getLambda @see getLambda */
+            virtual void setLambda(double val) = 0;
+            /** @see setTheta */
+            virtual double getTheta() const = 0;
+            /** @copybrief getTheta @see getTheta */
+            virtual void setTheta(double val) = 0;
+            /** @see setScalesNumber */
+            virtual int getScalesNumber() const = 0;
+            /** @copybrief getScalesNumber @see getScalesNumber */
+            virtual void setScalesNumber(int val) = 0;
+            /** @see setWarpingsNumber */
+            virtual int getWarpingsNumber() const = 0;
+            /** @copybrief getWarpingsNumber @see getWarpingsNumber */
+            virtual void setWarpingsNumber(int val) = 0;
+            /** @see setEpsilon */
+            virtual double getEpsilon() const = 0;
+            /** @copybrief getEpsilon @see getEpsilon */
+            virtual void setEpsilon(double val) = 0;
+            /** @see setIterations */
+            virtual int getIterations() const = 0;
+            /** @copybrief getIterations @see getIterations */
+            virtual void setIterations(int val) = 0;
+            /** @see setUseInitialFlow */
+            virtual bool getUseInitialFlow() const = 0;
+            /** @copybrief getUseInitialFlow @see getUseInitialFlow */
+            virtual void setUseInitialFlow(bool val) = 0;
+        };
+        CV_EXPORTS Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1();
+        CV_EXPORTS Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1_CUDA();
+
+
+        class CV_EXPORTS BroxOpticalFlow : public virtual DenseOpticalFlowExt
+        {
+        public:
+            //! @brief Flow smoothness
+            /** @see setAlpha */
+            virtual double getAlpha() const = 0;
+            /** @copybrief getAlpha @see getAlpha */
+            virtual void setAlpha(double val) = 0;
+            //! @brief Gradient constancy importance
+            /** @see setGamma */
+            virtual double getGamma() const = 0;
+            /** @copybrief getGamma @see getGamma */
+            virtual void setGamma(double val) = 0;
+            //! @brief Pyramid scale factor
+            /** @see setScaleFactor */
+            virtual double getScaleFactor() const = 0;
+            /** @copybrief getScaleFactor @see getScaleFactor */
+            virtual void setScaleFactor(double val) = 0;
+            //! @brief Number of lagged non-linearity iterations (inner loop)
+            /** @see setInnerIterations */
+            virtual int getInnerIterations() const = 0;
+            /** @copybrief getInnerIterations @see getInnerIterations */
+            virtual void setInnerIterations(int val) = 0;
+            //! @brief Number of warping iterations (number of pyramid levels)
+            /** @see setOuterIterations */
+            virtual int getOuterIterations() const = 0;
+            /** @copybrief getOuterIterations @see getOuterIterations */
+            virtual void setOuterIterations(int val) = 0;
+            //! @brief Number of linear system solver iterations
+            /** @see setSolverIterations */
+            virtual int getSolverIterations() const = 0;
+            /** @copybrief getSolverIterations @see getSolverIterations */
+            virtual void setSolverIterations(int val) = 0;
+        };
+        CV_EXPORTS Ptr<BroxOpticalFlow> createOptFlow_Brox_CUDA();
+
+
+        class PyrLKOpticalFlow : public virtual DenseOpticalFlowExt
+        {
+        public:
+            /** @see setWindowSize */
+            virtual int getWindowSize() const = 0;
+            /** @copybrief getWindowSize @see getWindowSize */
+            virtual void setWindowSize(int val) = 0;
+            /** @see setMaxLevel */
+            virtual int getMaxLevel() const = 0;
+            /** @copybrief getMaxLevel @see getMaxLevel */
+            virtual void setMaxLevel(int val) = 0;
+            /** @see setIterations */
+            virtual int getIterations() const = 0;
+            /** @copybrief getIterations @see getIterations */
+            virtual void setIterations(int val) = 0;
+        };
+        CV_EXPORTS Ptr<PyrLKOpticalFlow> createOptFlow_PyrLK_CUDA();
+
+//! @}
+
+    }
+}
+
+#endif // __OPENCV_SUPERRES_OPTICAL_FLOW_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/video.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/video.hpp
new file mode 100644
index 0000000..a593815
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/video.hpp
@@ -0,0 +1,63 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_VIDEO_HPP__
+#define __OPENCV_VIDEO_HPP__
+
+/**
+  @defgroup video Video Analysis
+  @{
+    @defgroup video_motion Motion Analysis
+    @defgroup video_track Object Tracking
+    @defgroup video_c C API
+  @}
+*/
+
+#include "opencv2/video/tracking.hpp"
+#include "opencv2/video/background_segm.hpp"
+
+#ifndef DISABLE_OPENCV_24_COMPATIBILITY
+#include "opencv2/video/tracking_c.h"
+#endif
+
+#endif //__OPENCV_VIDEO_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp
new file mode 100644
index 0000000..dbeccbd
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/video/background_segm.hpp
@@ -0,0 +1,306 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_BACKGROUND_SEGM_HPP__
+#define __OPENCV_BACKGROUND_SEGM_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+
+//! @addtogroup video_motion
+//! @{
+
+/** @brief Base class for background/foreground segmentation. :
+
+The class is only used to define the common interface for the whole family of background/foreground
+segmentation algorithms.
+ */
+class CV_EXPORTS_W BackgroundSubtractor : public Algorithm
+{
+public:
+    /** @brief Computes a foreground mask.
+
+    @param image Next video frame.
+    @param fgmask The output foreground mask as an 8-bit binary image.
+    @param learningRate The value between 0 and 1 that indicates how fast the background model is
+    learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
+    rate. 0 means that the background model is not updated at all, 1 means that the background model
+    is completely reinitialized from the last frame.
+     */
+    CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0;
+
+    /** @brief Computes a background image.
+
+    @param backgroundImage The output background image.
+
+    @note Sometimes the background image can be very blurry, as it contain the average background
+    statistics.
+     */
+    CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0;
+};
+
+
+/** @brief Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
+
+The class implements the Gaussian mixture model background subtraction described in @cite Zivkovic2004
+and @cite Zivkovic2006 .
+ */
+class CV_EXPORTS_W BackgroundSubtractorMOG2 : public BackgroundSubtractor
+{
+public:
+    /** @brief Returns the number of last frames that affect the background model
+    */
+    CV_WRAP virtual int getHistory() const = 0;
+    /** @brief Sets the number of last frames that affect the background model
+    */
+    CV_WRAP virtual void setHistory(int history) = 0;
+
+    /** @brief Returns the number of gaussian components in the background model
+    */
+    CV_WRAP virtual int getNMixtures() const = 0;
+    /** @brief Sets the number of gaussian components in the background model.
+
+    The model needs to be reinitalized to reserve memory.
+    */
+    CV_WRAP virtual void setNMixtures(int nmixtures) = 0;//needs reinitialization!
+
+    /** @brief Returns the "background ratio" parameter of the algorithm
+
+    If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's
+    considered background and added to the model as a center of a new component. It corresponds to TB
+    parameter in the paper.
+     */
+    CV_WRAP virtual double getBackgroundRatio() const = 0;
+    /** @brief Sets the "background ratio" parameter of the algorithm
+    */
+    CV_WRAP virtual void setBackgroundRatio(double ratio) = 0;
+
+    /** @brief Returns the variance threshold for the pixel-model match
+
+    The main threshold on the squared Mahalanobis distance to decide if the sample is well described by
+    the background model or not. Related to Cthr from the paper.
+     */
+    CV_WRAP virtual double getVarThreshold() const = 0;
+    /** @brief Sets the variance threshold for the pixel-model match
+    */
+    CV_WRAP virtual void setVarThreshold(double varThreshold) = 0;
+
+    /** @brief Returns the variance threshold for the pixel-model match used for new mixture component generation
+
+    Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the
+    existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it
+    is considered foreground or added as a new component. 3 sigma =\> Tg=3\*3=9 is default. A smaller Tg
+    value generates more components. A higher Tg value may result in a small number of components but
+    they can grow too large.
+     */
+    CV_WRAP virtual double getVarThresholdGen() const = 0;
+    /** @brief Sets the variance threshold for the pixel-model match used for new mixture component generation
+    */
+    CV_WRAP virtual void setVarThresholdGen(double varThresholdGen) = 0;
+
+    /** @brief Returns the initial variance of each gaussian component
+    */
+    CV_WRAP virtual double getVarInit() const = 0;
+    /** @brief Sets the initial variance of each gaussian component
+    */
+    CV_WRAP virtual void setVarInit(double varInit) = 0;
+
+    CV_WRAP virtual double getVarMin() const = 0;
+    CV_WRAP virtual void setVarMin(double varMin) = 0;
+
+    CV_WRAP virtual double getVarMax() const = 0;
+    CV_WRAP virtual void setVarMax(double varMax) = 0;
+
+    /** @brief Returns the complexity reduction threshold
+
+    This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05
+    is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the
+    standard Stauffer&Grimson algorithm.
+     */
+    CV_WRAP virtual double getComplexityReductionThreshold() const = 0;
+    /** @brief Sets the complexity reduction threshold
+    */
+    CV_WRAP virtual void setComplexityReductionThreshold(double ct) = 0;
+
+    /** @brief Returns the shadow detection flag
+
+    If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 for
+    details.
+     */
+    CV_WRAP virtual bool getDetectShadows() const = 0;
+    /** @brief Enables or disables shadow detection
+    */
+    CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0;
+
+    /** @brief Returns the shadow value
+
+    Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
+    in the mask always means background, 255 means foreground.
+     */
+    CV_WRAP virtual int getShadowValue() const = 0;
+    /** @brief Sets the shadow value
+    */
+    CV_WRAP virtual void setShadowValue(int value) = 0;
+
+    /** @brief Returns the shadow threshold
+
+    A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
+    the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
+    is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiarra,
+    *Detecting Moving Shadows...*, IEEE PAMI,2003.
+     */
+    CV_WRAP virtual double getShadowThreshold() const = 0;
+    /** @brief Sets the shadow threshold
+    */
+    CV_WRAP virtual void setShadowThreshold(double threshold) = 0;
+};
+
+/** @brief Creates MOG2 Background Subtractor
+
+@param history Length of the history.
+@param varThreshold Threshold on the squared Mahalanobis distance between the pixel and the model
+to decide whether a pixel is well described by the background model. This parameter does not
+affect the background update.
+@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
+speed a bit, so if you do not need this feature, set the parameter to false.
+ */
+CV_EXPORTS_W Ptr<BackgroundSubtractorMOG2>
+    createBackgroundSubtractorMOG2(int history=500, double varThreshold=16,
+                                   bool detectShadows=true);
+
+/** @brief K-nearest neigbours - based Background/Foreground Segmentation Algorithm.
+
+The class implements the K-nearest neigbours background subtraction described in @cite Zivkovic2006 .
+Very efficient if number of foreground pixels is low.
+ */
+class CV_EXPORTS_W BackgroundSubtractorKNN : public BackgroundSubtractor
+{
+public:
+    /** @brief Returns the number of last frames that affect the background model
+    */
+    CV_WRAP virtual int getHistory() const = 0;
+    /** @brief Sets the number of last frames that affect the background model
+    */
+    CV_WRAP virtual void setHistory(int history) = 0;
+
+    /** @brief Returns the number of data samples in the background model
+    */
+    CV_WRAP virtual int getNSamples() const = 0;
+    /** @brief Sets the number of data samples in the background model.
+
+    The model needs to be reinitalized to reserve memory.
+    */
+    CV_WRAP virtual void setNSamples(int _nN) = 0;//needs reinitialization!
+
+    /** @brief Returns the threshold on the squared distance between the pixel and the sample
+
+    The threshold on the squared distance between the pixel and the sample to decide whether a pixel is
+    close to a data sample.
+     */
+    CV_WRAP virtual double getDist2Threshold() const = 0;
+    /** @brief Sets the threshold on the squared distance
+    */
+    CV_WRAP virtual void setDist2Threshold(double _dist2Threshold) = 0;
+
+    /** @brief Returns the number of neighbours, the k in the kNN.
+
+    K is the number of samples that need to be within dist2Threshold in order to decide that that
+    pixel is matching the kNN background model.
+     */
+    CV_WRAP virtual int getkNNSamples() const = 0;
+    /** @brief Sets the k in the kNN. How many nearest neigbours need to match.
+    */
+    CV_WRAP virtual void setkNNSamples(int _nkNN) = 0;
+
+    /** @brief Returns the shadow detection flag
+
+    If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorKNN for
+    details.
+     */
+    CV_WRAP virtual bool getDetectShadows() const = 0;
+    /** @brief Enables or disables shadow detection
+    */
+    CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0;
+
+    /** @brief Returns the shadow value
+
+    Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
+    in the mask always means background, 255 means foreground.
+     */
+    CV_WRAP virtual int getShadowValue() const = 0;
+    /** @brief Sets the shadow value
+    */
+    CV_WRAP virtual void setShadowValue(int value) = 0;
+
+    /** @brief Returns the shadow threshold
+
+    A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
+    the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
+    is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiarra,
+    *Detecting Moving Shadows...*, IEEE PAMI,2003.
+     */
+    CV_WRAP virtual double getShadowThreshold() const = 0;
+    /** @brief Sets the shadow threshold
+     */
+    CV_WRAP virtual void setShadowThreshold(double threshold) = 0;
+};
+
+/** @brief Creates KNN Background Subtractor
+
+@param history Length of the history.
+@param dist2Threshold Threshold on the squared distance between the pixel and the sample to decide
+whether a pixel is close to that sample. This parameter does not affect the background update.
+@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
+speed a bit, so if you do not need this feature, set the parameter to false.
+ */
+CV_EXPORTS_W Ptr<BackgroundSubtractorKNN>
+    createBackgroundSubtractorKNN(int history=500, double dist2Threshold=400.0,
+                                   bool detectShadows=true);
+
+//! @} video_motion
+
+} // cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp
new file mode 100644
index 0000000..d6954fe
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/video/tracking.hpp
@@ -0,0 +1,515 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_TRACKING_HPP__
+#define __OPENCV_TRACKING_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+
+//! @addtogroup video_track
+//! @{
+
+enum { OPTFLOW_USE_INITIAL_FLOW     = 4,
+       OPTFLOW_LK_GET_MIN_EIGENVALS = 8,
+       OPTFLOW_FARNEBACK_GAUSSIAN   = 256
+     };
+
+/** @brief Finds an object center, size, and orientation.
+
+@param probImage Back projection of the object histogram. See calcBackProject.
+@param window Initial search window.
+@param criteria Stop criteria for the underlying meanShift.
+returns
+(in old interfaces) Number of iterations CAMSHIFT took to converge
+The function implements the CAMSHIFT object tracking algorithm @cite Bradski98 . First, it finds an
+object center using meanShift and then adjusts the window size and finds the optimal rotation. The
+function returns the rotated rectangle structure that includes the object position, size, and
+orientation. The next position of the search window can be obtained with RotatedRect::boundingRect()
+
+See the OpenCV sample camshiftdemo.c that tracks colored objects.
+
+@note
+-   (Python) A sample explaining the camshift tracking algorithm can be found at
+    opencv_source_code/samples/python/camshift.py
+ */
+CV_EXPORTS_W RotatedRect CamShift( InputArray probImage, CV_IN_OUT Rect& window,
+                                   TermCriteria criteria );
+
+/** @brief Finds an object on a back projection image.
+
+@param probImage Back projection of the object histogram. See calcBackProject for details.
+@param window Initial search window.
+@param criteria Stop criteria for the iterative search algorithm.
+returns
+:   Number of iterations CAMSHIFT took to converge.
+The function implements the iterative object search algorithm. It takes the input back projection of
+an object and the initial position. The mass center in window of the back projection image is
+computed and the search window center shifts to the mass center. The procedure is repeated until the
+specified number of iterations criteria.maxCount is done or until the window center shifts by less
+than criteria.epsilon. The algorithm is used inside CamShift and, unlike CamShift , the search
+window size or orientation do not change during the search. You can simply pass the output of
+calcBackProject to this function. But better results can be obtained if you pre-filter the back
+projection and remove the noise. For example, you can do this by retrieving connected components
+with findContours , throwing away contours with small area ( contourArea ), and rendering the
+remaining contours with drawContours.
+
+@note
+-   A mean-shift tracking sample can be found at opencv_source_code/samples/cpp/camshiftdemo.cpp
+ */
+CV_EXPORTS_W int meanShift( InputArray probImage, CV_IN_OUT Rect& window, TermCriteria criteria );
+
+/** @brief Constructs the image pyramid which can be passed to calcOpticalFlowPyrLK.
+
+@param img 8-bit input image.
+@param pyramid output pyramid.
+@param winSize window size of optical flow algorithm. Must be not less than winSize argument of
+calcOpticalFlowPyrLK. It is needed to calculate required padding for pyramid levels.
+@param maxLevel 0-based maximal pyramid level number.
+@param withDerivatives set to precompute gradients for the every pyramid level. If pyramid is
+constructed without the gradients then calcOpticalFlowPyrLK will calculate them internally.
+@param pyrBorder the border mode for pyramid layers.
+@param derivBorder the border mode for gradients.
+@param tryReuseInputImage put ROI of input image into the pyramid if possible. You can pass false
+to force data copying.
+@return number of levels in constructed pyramid. Can be less than maxLevel.
+ */
+CV_EXPORTS_W int buildOpticalFlowPyramid( InputArray img, OutputArrayOfArrays pyramid,
+                                          Size winSize, int maxLevel, bool withDerivatives = true,
+                                          int pyrBorder = BORDER_REFLECT_101,
+                                          int derivBorder = BORDER_CONSTANT,
+                                          bool tryReuseInputImage = true );
+
+/** @brief Calculates an optical flow for a sparse feature set using the iterative Lucas-Kanade method with
+pyramids.
+
+@param prevImg first 8-bit input image or pyramid constructed by buildOpticalFlowPyramid.
+@param nextImg second input image or pyramid of the same size and the same type as prevImg.
+@param prevPts vector of 2D points for which the flow needs to be found; point coordinates must be
+single-precision floating-point numbers.
+@param nextPts output vector of 2D points (with single-precision floating-point coordinates)
+containing the calculated new positions of input features in the second image; when
+OPTFLOW_USE_INITIAL_FLOW flag is passed, the vector must have the same size as in the input.
+@param status output status vector (of unsigned chars); each element of the vector is set to 1 if
+the flow for the corresponding features has been found, otherwise, it is set to 0.
+@param err output vector of errors; each element of the vector is set to an error for the
+corresponding feature, type of the error measure can be set in flags parameter; if the flow wasn't
+found then the error is not defined (use the status parameter to find such cases).
+@param winSize size of the search window at each pyramid level.
+@param maxLevel 0-based maximal pyramid level number; if set to 0, pyramids are not used (single
+level), if set to 1, two levels are used, and so on; if pyramids are passed to input then
+algorithm will use as many levels as pyramids have but no more than maxLevel.
+@param criteria parameter, specifying the termination criteria of the iterative search algorithm
+(after the specified maximum number of iterations criteria.maxCount or when the search window
+moves by less than criteria.epsilon.
+@param flags operation flags:
+ -   **OPTFLOW_USE_INITIAL_FLOW** uses initial estimations, stored in nextPts; if the flag is
+     not set, then prevPts is copied to nextPts and is considered the initial estimate.
+ -   **OPTFLOW_LK_GET_MIN_EIGENVALS** use minimum eigen values as an error measure (see
+     minEigThreshold description); if the flag is not set, then L1 distance between patches
+     around the original and a moved point, divided by number of pixels in a window, is used as a
+     error measure.
+@param minEigThreshold the algorithm calculates the minimum eigen value of a 2x2 normal matrix of
+optical flow equations (this matrix is called a spatial gradient matrix in @cite Bouguet00), divided
+by number of pixels in a window; if this value is less than minEigThreshold, then a corresponding
+feature is filtered out and its flow is not processed, so it allows to remove bad points and get a
+performance boost.
+
+The function implements a sparse iterative version of the Lucas-Kanade optical flow in pyramids. See
+@cite Bouguet00 . The function is parallelized with the TBB library.
+
+@note
+
+-   An example using the Lucas-Kanade optical flow algorithm can be found at
+    opencv_source_code/samples/cpp/lkdemo.cpp
+-   (Python) An example using the Lucas-Kanade optical flow algorithm can be found at
+    opencv_source_code/samples/python/lk_track.py
+-   (Python) An example using the Lucas-Kanade tracker for homography matching can be found at
+    opencv_source_code/samples/python/lk_homography.py
+ */
+CV_EXPORTS_W void calcOpticalFlowPyrLK( InputArray prevImg, InputArray nextImg,
+                                        InputArray prevPts, InputOutputArray nextPts,
+                                        OutputArray status, OutputArray err,
+                                        Size winSize = Size(21,21), int maxLevel = 3,
+                                        TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01),
+                                        int flags = 0, double minEigThreshold = 1e-4 );
+
+/** @brief Computes a dense optical flow using the Gunnar Farneback's algorithm.
+
+@param prev first 8-bit single-channel input image.
+@param next second input image of the same size and the same type as prev.
+@param flow computed flow image that has the same size as prev and type CV_32FC2.
+@param pyr_scale parameter, specifying the image scale (\<1) to build pyramids for each image;
+pyr_scale=0.5 means a classical pyramid, where each next layer is twice smaller than the previous
+one.
+@param levels number of pyramid layers including the initial image; levels=1 means that no extra
+layers are created and only the original images are used.
+@param winsize averaging window size; larger values increase the algorithm robustness to image
+noise and give more chances for fast motion detection, but yield more blurred motion field.
+@param iterations number of iterations the algorithm does at each pyramid level.
+@param poly_n size of the pixel neighborhood used to find polynomial expansion in each pixel;
+larger values mean that the image will be approximated with smoother surfaces, yielding more
+robust algorithm and more blurred motion field, typically poly_n =5 or 7.
+@param poly_sigma standard deviation of the Gaussian that is used to smooth derivatives used as a
+basis for the polynomial expansion; for poly_n=5, you can set poly_sigma=1.1, for poly_n=7, a
+good value would be poly_sigma=1.5.
+@param flags operation flags that can be a combination of the following:
+ -   **OPTFLOW_USE_INITIAL_FLOW** uses the input flow as an initial flow approximation.
+ -   **OPTFLOW_FARNEBACK_GAUSSIAN** uses the Gaussian \f$\texttt{winsize}\times\texttt{winsize}\f$
+     filter instead of a box filter of the same size for optical flow estimation; usually, this
+     option gives z more accurate flow than with a box filter, at the cost of lower speed;
+     normally, winsize for a Gaussian window should be set to a larger value to achieve the same
+     level of robustness.
+
+The function finds an optical flow for each prev pixel using the @cite Farneback2003 algorithm so that
+
+\f[\texttt{prev} (y,x)  \sim \texttt{next} ( y + \texttt{flow} (y,x)[1],  x + \texttt{flow} (y,x)[0])\f]
+
+@note
+
+-   An example using the optical flow algorithm described by Gunnar Farneback can be found at
+    opencv_source_code/samples/cpp/fback.cpp
+-   (Python) An example using the optical flow algorithm described by Gunnar Farneback can be
+    found at opencv_source_code/samples/python/opt_flow.py
+ */
+CV_EXPORTS_W void calcOpticalFlowFarneback( InputArray prev, InputArray next, InputOutputArray flow,
+                                            double pyr_scale, int levels, int winsize,
+                                            int iterations, int poly_n, double poly_sigma,
+                                            int flags );
+
+/** @brief Computes an optimal affine transformation between two 2D point sets.
+
+@param src First input 2D point set stored in std::vector or Mat, or an image stored in Mat.
+@param dst Second input 2D point set of the same size and the same type as A, or another image.
+@param fullAffine If true, the function finds an optimal affine transformation with no additional
+restrictions (6 degrees of freedom). Otherwise, the class of transformations to choose from is
+limited to combinations of translation, rotation, and uniform scaling (5 degrees of freedom).
+
+The function finds an optimal affine transform *[A|b]* (a 2 x 3 floating-point matrix) that
+approximates best the affine transformation between:
+
+*   Two point sets
+*   Two raster images. In this case, the function first finds some features in the src image and
+    finds the corresponding features in dst image. After that, the problem is reduced to the first
+    case.
+In case of point sets, the problem is formulated as follows: you need to find a 2x2 matrix *A* and
+2x1 vector *b* so that:
+
+\f[[A^*|b^*] = arg  \min _{[A|b]}  \sum _i  \| \texttt{dst}[i] - A { \texttt{src}[i]}^T - b  \| ^2\f]
+where src[i] and dst[i] are the i-th points in src and dst, respectively
+\f$[A|b]\f$ can be either arbitrary (when fullAffine=true ) or have a form of
+\f[\begin{bmatrix} a_{11} & a_{12} & b_1  \\ -a_{12} & a_{11} & b_2  \end{bmatrix}\f]
+when fullAffine=false.
+
+@sa
+getAffineTransform, getPerspectiveTransform, findHomography
+ */
+CV_EXPORTS_W Mat estimateRigidTransform( InputArray src, InputArray dst, bool fullAffine );
+
+
+enum
+{
+    MOTION_TRANSLATION = 0,
+    MOTION_EUCLIDEAN   = 1,
+    MOTION_AFFINE      = 2,
+    MOTION_HOMOGRAPHY  = 3
+};
+
+/** @brief Finds the geometric transform (warp) between two images in terms of the ECC criterion @cite EP08 .
+
+@param templateImage single-channel template image; CV_8U or CV_32F array.
+@param inputImage single-channel input image which should be warped with the final warpMatrix in
+order to provide an image similar to templateImage, same type as temlateImage.
+@param warpMatrix floating-point \f$2\times 3\f$ or \f$3\times 3\f$ mapping matrix (warp).
+@param motionType parameter, specifying the type of motion:
+ -   **MOTION_TRANSLATION** sets a translational motion model; warpMatrix is \f$2\times 3\f$ with
+     the first \f$2\times 2\f$ part being the unity matrix and the rest two parameters being
+     estimated.
+ -   **MOTION_EUCLIDEAN** sets a Euclidean (rigid) transformation as motion model; three
+     parameters are estimated; warpMatrix is \f$2\times 3\f$.
+ -   **MOTION_AFFINE** sets an affine motion model (DEFAULT); six parameters are estimated;
+     warpMatrix is \f$2\times 3\f$.
+ -   **MOTION_HOMOGRAPHY** sets a homography as a motion model; eight parameters are
+     estimated;\`warpMatrix\` is \f$3\times 3\f$.
+@param criteria parameter, specifying the termination criteria of the ECC algorithm;
+criteria.epsilon defines the threshold of the increment in the correlation coefficient between two
+iterations (a negative criteria.epsilon makes criteria.maxcount the only termination criterion).
+Default values are shown in the declaration above.
+@param inputMask An optional mask to indicate valid values of inputImage.
+
+The function estimates the optimum transformation (warpMatrix) with respect to ECC criterion
+(@cite EP08), that is
+
+\f[\texttt{warpMatrix} = \texttt{warpMatrix} = \arg\max_{W} \texttt{ECC}(\texttt{templateImage}(x,y),\texttt{inputImage}(x',y'))\f]
+
+where
+
+\f[\begin{bmatrix} x' \\ y' \end{bmatrix} = W \cdot \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}\f]
+
+(the equation holds with homogeneous coordinates for homography). It returns the final enhanced
+correlation coefficient, that is the correlation coefficient between the template image and the
+final warped input image. When a \f$3\times 3\f$ matrix is given with motionType =0, 1 or 2, the third
+row is ignored.
+
+Unlike findHomography and estimateRigidTransform, the function findTransformECC implements an
+area-based alignment that builds on intensity similarities. In essence, the function updates the
+initial transformation that roughly aligns the images. If this information is missing, the identity
+warp (unity matrix) should be given as input. Note that if images undergo strong
+displacements/rotations, an initial transformation that roughly aligns the images is necessary
+(e.g., a simple euclidean/similarity transform that allows for the images showing the same image
+content approximately). Use inverse warping in the second image to take an image close to the first
+one, i.e. use the flag WARP_INVERSE_MAP with warpAffine or warpPerspective. See also the OpenCV
+sample image_alignment.cpp that demonstrates the use of the function. Note that the function throws
+an exception if algorithm does not converges.
+
+@sa
+estimateRigidTransform, findHomography
+ */
+CV_EXPORTS_W double findTransformECC( InputArray templateImage, InputArray inputImage,
+                                      InputOutputArray warpMatrix, int motionType = MOTION_AFFINE,
+                                      TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 50, 0.001),
+                                      InputArray inputMask = noArray());
+
+/** @brief Kalman filter class.
+
+The class implements a standard Kalman filter <http://en.wikipedia.org/wiki/Kalman_filter>,
+@cite Welch95 . However, you can modify transitionMatrix, controlMatrix, and measurementMatrix to get
+an extended Kalman filter functionality. See the OpenCV sample kalman.cpp.
+
+@note
+
+-   An example using the standard Kalman filter can be found at
+    opencv_source_code/samples/cpp/kalman.cpp
+ */
+class CV_EXPORTS_W KalmanFilter
+{
+public:
+    /** @brief The constructors.
+
+    @note In C API when CvKalman\* kalmanFilter structure is not needed anymore, it should be released
+    with cvReleaseKalman(&kalmanFilter)
+     */
+    CV_WRAP KalmanFilter();
+    /** @overload
+    @param dynamParams Dimensionality of the state.
+    @param measureParams Dimensionality of the measurement.
+    @param controlParams Dimensionality of the control vector.
+    @param type Type of the created matrices that should be CV_32F or CV_64F.
+    */
+    CV_WRAP KalmanFilter( int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F );
+
+    /** @brief Re-initializes Kalman filter. The previous content is destroyed.
+
+    @param dynamParams Dimensionality of the state.
+    @param measureParams Dimensionality of the measurement.
+    @param controlParams Dimensionality of the control vector.
+    @param type Type of the created matrices that should be CV_32F or CV_64F.
+     */
+    void init( int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F );
+
+    /** @brief Computes a predicted state.
+
+    @param control The optional input control
+     */
+    CV_WRAP const Mat& predict( const Mat& control = Mat() );
+
+    /** @brief Updates the predicted state from the measurement.
+
+    @param measurement The measured system parameters
+     */
+    CV_WRAP const Mat& correct( const Mat& measurement );
+
+    CV_PROP_RW Mat statePre;           //!< predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k)
+    CV_PROP_RW Mat statePost;          //!< corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k))
+    CV_PROP_RW Mat transitionMatrix;   //!< state transition matrix (A)
+    CV_PROP_RW Mat controlMatrix;      //!< control matrix (B) (not used if there is no control)
+    CV_PROP_RW Mat measurementMatrix;  //!< measurement matrix (H)
+    CV_PROP_RW Mat processNoiseCov;    //!< process noise covariance matrix (Q)
+    CV_PROP_RW Mat measurementNoiseCov;//!< measurement noise covariance matrix (R)
+    CV_PROP_RW Mat errorCovPre;        //!< priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/
+    CV_PROP_RW Mat gain;               //!< Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)
+    CV_PROP_RW Mat errorCovPost;       //!< posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k)
+
+    // temporary matrices
+    Mat temp1;
+    Mat temp2;
+    Mat temp3;
+    Mat temp4;
+    Mat temp5;
+};
+
+
+class CV_EXPORTS_W DenseOpticalFlow : public Algorithm
+{
+public:
+    /** @brief Calculates an optical flow.
+
+    @param I0 first 8-bit single-channel input image.
+    @param I1 second input image of the same size and the same type as prev.
+    @param flow computed flow image that has the same size as prev and type CV_32FC2.
+     */
+    CV_WRAP virtual void calc( InputArray I0, InputArray I1, InputOutputArray flow ) = 0;
+    /** @brief Releases all inner buffers.
+    */
+    CV_WRAP virtual void collectGarbage() = 0;
+};
+
+/** @brief "Dual TV L1" Optical Flow Algorithm.
+
+The class implements the "Dual TV L1" optical flow algorithm described in @cite Zach2007 and
+@cite Javier2012 .
+Here are important members of the class that control the algorithm, which you can set after
+constructing the class instance:
+
+-   member double tau
+    Time step of the numerical scheme.
+
+-   member double lambda
+    Weight parameter for the data term, attachment parameter. This is the most relevant
+    parameter, which determines the smoothness of the output. The smaller this parameter is,
+    the smoother the solutions we obtain. It depends on the range of motions of the images, so
+    its value should be adapted to each image sequence.
+
+-   member double theta
+    Weight parameter for (u - v)\^2, tightness parameter. It serves as a link between the
+    attachment and the regularization terms. In theory, it should have a small value in order
+    to maintain both parts in correspondence. The method is stable for a large range of values
+    of this parameter.
+
+-   member int nscales
+    Number of scales used to create the pyramid of images.
+
+-   member int warps
+    Number of warpings per scale. Represents the number of times that I1(x+u0) and grad(
+    I1(x+u0) ) are computed per scale. This is a parameter that assures the stability of the
+    method. It also affects the running time, so it is a compromise between speed and
+    accuracy.
+
+-   member double epsilon
+    Stopping criterion threshold used in the numerical scheme, which is a trade-off between
+    precision and running time. A small value will yield more accurate solutions at the
+    expense of a slower convergence.
+
+-   member int iterations
+    Stopping criterion iterations number used in the numerical scheme.
+
+C. Zach, T. Pock and H. Bischof, "A Duality Based Approach for Realtime TV-L1 Optical Flow".
+Javier Sanchez, Enric Meinhardt-Llopis and Gabriele Facciolo. "TV-L1 Optical Flow Estimation".
+*/
+class CV_EXPORTS_W DualTVL1OpticalFlow : public DenseOpticalFlow
+{
+public:
+    //! @brief Time step of the numerical scheme
+    /** @see setTau */
+    virtual double getTau() const = 0;
+    /** @copybrief getTau @see getTau */
+    virtual void setTau(double val) = 0;
+    //! @brief Weight parameter for the data term, attachment parameter
+    /** @see setLambda */
+    virtual double getLambda() const = 0;
+    /** @copybrief getLambda @see getLambda */
+    virtual void setLambda(double val) = 0;
+    //! @brief Weight parameter for (u - v)^2, tightness parameter
+    /** @see setTheta */
+    virtual double getTheta() const = 0;
+    /** @copybrief getTheta @see getTheta */
+    virtual void setTheta(double val) = 0;
+    //! @brief coefficient for additional illumination variation term
+    /** @see setGamma */
+    virtual double getGamma() const = 0;
+    /** @copybrief getGamma @see getGamma */
+    virtual void setGamma(double val) = 0;
+    //! @brief Number of scales used to create the pyramid of images
+    /** @see setScalesNumber */
+    virtual int getScalesNumber() const = 0;
+    /** @copybrief getScalesNumber @see getScalesNumber */
+    virtual void setScalesNumber(int val) = 0;
+    //! @brief Number of warpings per scale
+    /** @see setWarpingsNumber */
+    virtual int getWarpingsNumber() const = 0;
+    /** @copybrief getWarpingsNumber @see getWarpingsNumber */
+    virtual void setWarpingsNumber(int val) = 0;
+    //! @brief Stopping criterion threshold used in the numerical scheme, which is a trade-off between precision and running time
+    /** @see setEpsilon */
+    virtual double getEpsilon() const = 0;
+    /** @copybrief getEpsilon @see getEpsilon */
+    virtual void setEpsilon(double val) = 0;
+    //! @brief Inner iterations (between outlier filtering) used in the numerical scheme
+    /** @see setInnerIterations */
+    virtual int getInnerIterations() const = 0;
+    /** @copybrief getInnerIterations @see getInnerIterations */
+    virtual void setInnerIterations(int val) = 0;
+    //! @brief Outer iterations (number of inner loops) used in the numerical scheme
+    /** @see setOuterIterations */
+    virtual int getOuterIterations() const = 0;
+    /** @copybrief getOuterIterations @see getOuterIterations */
+    virtual void setOuterIterations(int val) = 0;
+    //! @brief Use initial flow
+    /** @see setUseInitialFlow */
+    virtual bool getUseInitialFlow() const = 0;
+    /** @copybrief getUseInitialFlow @see getUseInitialFlow */
+    virtual void setUseInitialFlow(bool val) = 0;
+    //! @brief Step between scales (<1)
+    /** @see setScaleStep */
+    virtual double getScaleStep() const = 0;
+    /** @copybrief getScaleStep @see getScaleStep */
+    virtual void setScaleStep(double val) = 0;
+    //! @brief Median filter kernel size (1 = no filter) (3 or 5)
+    /** @see setMedianFiltering */
+    virtual int getMedianFiltering() const = 0;
+    /** @copybrief getMedianFiltering @see getMedianFiltering */
+    virtual void setMedianFiltering(int val) = 0;
+};
+
+/** @brief Creates instance of cv::DenseOpticalFlow
+*/
+CV_EXPORTS_W Ptr<DualTVL1OpticalFlow> createOptFlow_DualTVL1();
+
+//! @} video_track
+
+} // cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h
new file mode 100644
index 0000000..b355352
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/video/tracking_c.h
@@ -0,0 +1,232 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifndef __OPENCV_TRACKING_C_H__
+#define __OPENCV_TRACKING_C_H__
+
+#include "opencv2/imgproc/types_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup video_c
+  @{
+*/
+
+/****************************************************************************************\
+*                                  Motion Analysis                                       *
+\****************************************************************************************/
+
+/************************************ optical flow ***************************************/
+
+#define CV_LKFLOW_PYR_A_READY       1
+#define CV_LKFLOW_PYR_B_READY       2
+#define CV_LKFLOW_INITIAL_GUESSES   4
+#define CV_LKFLOW_GET_MIN_EIGENVALS 8
+
+/* It is Lucas & Kanade method, modified to use pyramids.
+   Also it does several iterations to get optical flow for
+   every point at every pyramid level.
+   Calculates optical flow between two images for certain set of points (i.e.
+   it is a "sparse" optical flow, which is opposite to the previous 3 methods) */
+CVAPI(void)  cvCalcOpticalFlowPyrLK( const CvArr*  prev, const CvArr*  curr,
+                                     CvArr*  prev_pyr, CvArr*  curr_pyr,
+                                     const CvPoint2D32f* prev_features,
+                                     CvPoint2D32f* curr_features,
+                                     int       count,
+                                     CvSize    win_size,
+                                     int       level,
+                                     char*     status,
+                                     float*    track_error,
+                                     CvTermCriteria criteria,
+                                     int       flags );
+
+
+/* Modification of a previous sparse optical flow algorithm to calculate
+   affine flow */
+CVAPI(void)  cvCalcAffineFlowPyrLK( const CvArr*  prev, const CvArr*  curr,
+                                    CvArr*  prev_pyr, CvArr*  curr_pyr,
+                                    const CvPoint2D32f* prev_features,
+                                    CvPoint2D32f* curr_features,
+                                    float* matrices, int  count,
+                                    CvSize win_size, int  level,
+                                    char* status, float* track_error,
+                                    CvTermCriteria criteria, int flags );
+
+/* Estimate rigid transformation between 2 images or 2 point sets */
+CVAPI(int)  cvEstimateRigidTransform( const CvArr* A, const CvArr* B,
+                                      CvMat* M, int full_affine );
+
+/* Estimate optical flow for each pixel using the two-frame G. Farneback algorithm */
+CVAPI(void) cvCalcOpticalFlowFarneback( const CvArr* prev, const CvArr* next,
+                                        CvArr* flow, double pyr_scale, int levels,
+                                        int winsize, int iterations, int poly_n,
+                                        double poly_sigma, int flags );
+
+/********************************* motion templates *************************************/
+
+/****************************************************************************************\
+*        All the motion template functions work only with single channel images.         *
+*        Silhouette image must have depth IPL_DEPTH_8U or IPL_DEPTH_8S                   *
+*        Motion history image must have depth IPL_DEPTH_32F,                             *
+*        Gradient mask - IPL_DEPTH_8U or IPL_DEPTH_8S,                                   *
+*        Motion orientation image - IPL_DEPTH_32F                                        *
+*        Segmentation mask - IPL_DEPTH_32F                                               *
+*        All the angles are in degrees, all the times are in milliseconds                *
+\****************************************************************************************/
+
+/* Updates motion history image given motion silhouette */
+CVAPI(void)    cvUpdateMotionHistory( const CvArr* silhouette, CvArr* mhi,
+                                      double timestamp, double duration );
+
+/* Calculates gradient of the motion history image and fills
+   a mask indicating where the gradient is valid */
+CVAPI(void)    cvCalcMotionGradient( const CvArr* mhi, CvArr* mask, CvArr* orientation,
+                                     double delta1, double delta2,
+                                     int aperture_size CV_DEFAULT(3));
+
+/* Calculates average motion direction within a selected motion region
+   (region can be selected by setting ROIs and/or by composing a valid gradient mask
+   with the region mask) */
+CVAPI(double)  cvCalcGlobalOrientation( const CvArr* orientation, const CvArr* mask,
+                                        const CvArr* mhi, double timestamp,
+                                        double duration );
+
+/* Splits a motion history image into a few parts corresponding to separate independent motions
+   (e.g. left hand, right hand) */
+CVAPI(CvSeq*)  cvSegmentMotion( const CvArr* mhi, CvArr* seg_mask,
+                                CvMemStorage* storage,
+                                double timestamp, double seg_thresh );
+
+/****************************************************************************************\
+*                                       Tracking                                         *
+\****************************************************************************************/
+
+/* Implements CAMSHIFT algorithm - determines object position, size and orientation
+   from the object histogram back project (extension of meanshift) */
+CVAPI(int)  cvCamShift( const CvArr* prob_image, CvRect  window,
+                        CvTermCriteria criteria, CvConnectedComp* comp,
+                        CvBox2D* box CV_DEFAULT(NULL) );
+
+/* Implements MeanShift algorithm - determines object position
+   from the object histogram back project */
+CVAPI(int)  cvMeanShift( const CvArr* prob_image, CvRect  window,
+                         CvTermCriteria criteria, CvConnectedComp* comp );
+
+/*
+standard Kalman filter (in G. Welch' and G. Bishop's notation):
+
+  x(k)=A*x(k-1)+B*u(k)+w(k)  p(w)~N(0,Q)
+  z(k)=H*x(k)+v(k),   p(v)~N(0,R)
+*/
+typedef struct CvKalman
+{
+    int MP;                     /* number of measurement vector dimensions */
+    int DP;                     /* number of state vector dimensions */
+    int CP;                     /* number of control vector dimensions */
+
+    /* backward compatibility fields */
+#if 1
+    float* PosterState;         /* =state_pre->data.fl */
+    float* PriorState;          /* =state_post->data.fl */
+    float* DynamMatr;           /* =transition_matrix->data.fl */
+    float* MeasurementMatr;     /* =measurement_matrix->data.fl */
+    float* MNCovariance;        /* =measurement_noise_cov->data.fl */
+    float* PNCovariance;        /* =process_noise_cov->data.fl */
+    float* KalmGainMatr;        /* =gain->data.fl */
+    float* PriorErrorCovariance;/* =error_cov_pre->data.fl */
+    float* PosterErrorCovariance;/* =error_cov_post->data.fl */
+    float* Temp1;               /* temp1->data.fl */
+    float* Temp2;               /* temp2->data.fl */
+#endif
+
+    CvMat* state_pre;           /* predicted state (x'(k)):
+                                    x(k)=A*x(k-1)+B*u(k) */
+    CvMat* state_post;          /* corrected state (x(k)):
+                                    x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) */
+    CvMat* transition_matrix;   /* state transition matrix (A) */
+    CvMat* control_matrix;      /* control matrix (B)
+                                   (it is not used if there is no control)*/
+    CvMat* measurement_matrix;  /* measurement matrix (H) */
+    CvMat* process_noise_cov;   /* process noise covariance matrix (Q) */
+    CvMat* measurement_noise_cov; /* measurement noise covariance matrix (R) */
+    CvMat* error_cov_pre;       /* priori error estimate covariance matrix (P'(k)):
+                                    P'(k)=A*P(k-1)*At + Q)*/
+    CvMat* gain;                /* Kalman gain matrix (K(k)):
+                                    K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)*/
+    CvMat* error_cov_post;      /* posteriori error estimate covariance matrix (P(k)):
+                                    P(k)=(I-K(k)*H)*P'(k) */
+    CvMat* temp1;               /* temporary matrices */
+    CvMat* temp2;
+    CvMat* temp3;
+    CvMat* temp4;
+    CvMat* temp5;
+} CvKalman;
+
+/* Creates Kalman filter and sets A, B, Q, R and state to some initial values */
+CVAPI(CvKalman*) cvCreateKalman( int dynam_params, int measure_params,
+                                 int control_params CV_DEFAULT(0));
+
+/* Releases Kalman filter state */
+CVAPI(void)  cvReleaseKalman( CvKalman** kalman);
+
+/* Updates Kalman filter by time (predicts future state of the system) */
+CVAPI(const CvMat*)  cvKalmanPredict( CvKalman* kalman,
+                                      const CvMat* control CV_DEFAULT(NULL));
+
+/* Updates Kalman filter by measurement
+   (corrects state of the system and internal matrices) */
+CVAPI(const CvMat*)  cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement );
+
+#define cvKalmanUpdateByTime  cvKalmanPredict
+#define cvKalmanUpdateByMeasurement cvKalmanCorrect
+
+/** @} video_c */
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+
+#endif // __OPENCV_TRACKING_C_H__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/video/video.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/video/video.hpp
new file mode 100644
index 0000000..8267b85
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/video/video.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/video.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videoio.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videoio.hpp
new file mode 100644
index 0000000..ccd6c06
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videoio.hpp
@@ -0,0 +1,680 @@
+/*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*/
+
+#ifndef __OPENCV_VIDEOIO_HPP__
+#define __OPENCV_VIDEOIO_HPP__
+
+#include "opencv2/core.hpp"
+
+/**
+  @defgroup videoio Media I/O
+  @{
+    @defgroup videoio_c C API
+    @defgroup videoio_ios iOS glue
+    @defgroup videoio_winrt WinRT glue
+  @}
+*/
+
+////////////////////////////////// video io /////////////////////////////////
+
+typedef struct CvCapture CvCapture;
+typedef struct CvVideoWriter CvVideoWriter;
+
+namespace cv
+{
+
+//! @addtogroup videoio
+//! @{
+
+// Camera API
+enum { CAP_ANY          = 0,     // autodetect
+       CAP_VFW          = 200,   // platform native
+       CAP_V4L          = 200,
+       CAP_V4L2         = CAP_V4L,
+       CAP_FIREWARE     = 300,   // IEEE 1394 drivers
+       CAP_FIREWIRE     = CAP_FIREWARE,
+       CAP_IEEE1394     = CAP_FIREWARE,
+       CAP_DC1394       = CAP_FIREWARE,
+       CAP_CMU1394      = CAP_FIREWARE,
+       CAP_QT           = 500,   // QuickTime
+       CAP_UNICAP       = 600,   // Unicap drivers
+       CAP_DSHOW        = 700,   // DirectShow (via videoInput)
+       CAP_PVAPI        = 800,   // PvAPI, Prosilica GigE SDK
+       CAP_OPENNI       = 900,   // OpenNI (for Kinect)
+       CAP_OPENNI_ASUS  = 910,   // OpenNI (for Asus Xtion)
+       CAP_ANDROID      = 1000,  // Android - not used
+       CAP_XIAPI        = 1100,  // XIMEA Camera API
+       CAP_AVFOUNDATION = 1200,  // AVFoundation framework for iOS (OS X Lion will have the same API)
+       CAP_GIGANETIX    = 1300,  // Smartek Giganetix GigEVisionSDK
+       CAP_MSMF         = 1400,  // Microsoft Media Foundation (via videoInput)
+       CAP_WINRT        = 1410,  // Microsoft Windows Runtime using Media Foundation
+       CAP_INTELPERC    = 1500,  // Intel Perceptual Computing SDK
+       CAP_OPENNI2      = 1600,  // OpenNI2 (for Kinect)
+       CAP_OPENNI2_ASUS = 1610,  // OpenNI2 (for Asus Xtion and Occipital Structure sensors)
+       CAP_GPHOTO2      = 1700,  // gPhoto2 connection
+       CAP_GSTREAMER    = 1800,  // GStreamer
+       CAP_FFMPEG       = 1900,  // FFMPEG
+       CAP_IMAGES       = 2000   // OpenCV Image Sequence (e.g. img_%02d.jpg)
+     };
+
+// generic properties (based on DC1394 properties)
+enum { CAP_PROP_POS_MSEC       =0,
+       CAP_PROP_POS_FRAMES     =1,
+       CAP_PROP_POS_AVI_RATIO  =2,
+       CAP_PROP_FRAME_WIDTH    =3,
+       CAP_PROP_FRAME_HEIGHT   =4,
+       CAP_PROP_FPS            =5,
+       CAP_PROP_FOURCC         =6,
+       CAP_PROP_FRAME_COUNT    =7,
+       CAP_PROP_FORMAT         =8,
+       CAP_PROP_MODE           =9,
+       CAP_PROP_BRIGHTNESS    =10,
+       CAP_PROP_CONTRAST      =11,
+       CAP_PROP_SATURATION    =12,
+       CAP_PROP_HUE           =13,
+       CAP_PROP_GAIN          =14,
+       CAP_PROP_EXPOSURE      =15,
+       CAP_PROP_CONVERT_RGB   =16,
+       CAP_PROP_WHITE_BALANCE_BLUE_U =17,
+       CAP_PROP_RECTIFICATION =18,
+       CAP_PROP_MONOCHROME    =19,
+       CAP_PROP_SHARPNESS     =20,
+       CAP_PROP_AUTO_EXPOSURE =21, // DC1394: exposure control done by camera, user can adjust refernce level using this feature
+       CAP_PROP_GAMMA         =22,
+       CAP_PROP_TEMPERATURE   =23,
+       CAP_PROP_TRIGGER       =24,
+       CAP_PROP_TRIGGER_DELAY =25,
+       CAP_PROP_WHITE_BALANCE_RED_V =26,
+       CAP_PROP_ZOOM          =27,
+       CAP_PROP_FOCUS         =28,
+       CAP_PROP_GUID          =29,
+       CAP_PROP_ISO_SPEED     =30,
+       CAP_PROP_BACKLIGHT     =32,
+       CAP_PROP_PAN           =33,
+       CAP_PROP_TILT          =34,
+       CAP_PROP_ROLL          =35,
+       CAP_PROP_IRIS          =36,
+       CAP_PROP_SETTINGS      =37,
+       CAP_PROP_BUFFERSIZE    =38,
+       CAP_PROP_AUTOFOCUS     =39
+     };
+
+
+// Generic camera output modes.
+// Currently, these are supported through the libv4l interface only.
+enum { CAP_MODE_BGR  = 0, // BGR24 (default)
+       CAP_MODE_RGB  = 1, // RGB24
+       CAP_MODE_GRAY = 2, // Y8
+       CAP_MODE_YUYV = 3  // YUYV
+     };
+
+
+// DC1394 only
+// modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode)
+// every feature can have only one mode turned on at a time
+enum { CAP_PROP_DC1394_OFF                = -4, //turn the feature off (not controlled manually nor automatically)
+       CAP_PROP_DC1394_MODE_MANUAL        = -3, //set automatically when a value of the feature is set by the user
+       CAP_PROP_DC1394_MODE_AUTO          = -2,
+       CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
+       CAP_PROP_DC1394_MAX                = 31
+     };
+
+
+// OpenNI map generators
+enum { CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
+       CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
+       CAP_OPENNI_GENERATORS_MASK = CAP_OPENNI_DEPTH_GENERATOR + CAP_OPENNI_IMAGE_GENERATOR
+     };
+
+// Properties of cameras available through OpenNI interfaces
+enum { CAP_PROP_OPENNI_OUTPUT_MODE       = 100,
+       CAP_PROP_OPENNI_FRAME_MAX_DEPTH   = 101, // in mm
+       CAP_PROP_OPENNI_BASELINE          = 102, // in mm
+       CAP_PROP_OPENNI_FOCAL_LENGTH      = 103, // in pixels
+       CAP_PROP_OPENNI_REGISTRATION      = 104, // flag that synchronizes the remapping depth map to image map
+                                                // by changing depth generator's view point (if the flag is "on") or
+                                                // sets this view point to its normal one (if the flag is "off").
+       CAP_PROP_OPENNI_REGISTRATION_ON   = CAP_PROP_OPENNI_REGISTRATION,
+       CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
+       CAP_PROP_OPENNI_MAX_BUFFER_SIZE   = 106,
+       CAP_PROP_OPENNI_CIRCLE_BUFFER     = 107,
+       CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
+       CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
+       CAP_PROP_OPENNI2_SYNC             = 110,
+       CAP_PROP_OPENNI2_MIRROR           = 111
+     };
+
+// OpenNI shortcats
+enum { CAP_OPENNI_IMAGE_GENERATOR_PRESENT         = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_GENERATOR_PRESENT,
+       CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE     = CAP_OPENNI_IMAGE_GENERATOR + CAP_PROP_OPENNI_OUTPUT_MODE,
+       CAP_OPENNI_DEPTH_GENERATOR_BASELINE        = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_BASELINE,
+       CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH    = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_FOCAL_LENGTH,
+       CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION    = CAP_OPENNI_DEPTH_GENERATOR + CAP_PROP_OPENNI_REGISTRATION,
+       CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
+     };
+
+// OpenNI data given from depth generator
+enum { CAP_OPENNI_DEPTH_MAP         = 0, // Depth values in mm (CV_16UC1)
+       CAP_OPENNI_POINT_CLOUD_MAP   = 1, // XYZ in meters (CV_32FC3)
+       CAP_OPENNI_DISPARITY_MAP     = 2, // Disparity in pixels (CV_8UC1)
+       CAP_OPENNI_DISPARITY_MAP_32F = 3, // Disparity in pixels (CV_32FC1)
+       CAP_OPENNI_VALID_DEPTH_MASK  = 4, // CV_8UC1
+
+       // Data given from RGB image generator
+       CAP_OPENNI_BGR_IMAGE         = 5,
+       CAP_OPENNI_GRAY_IMAGE        = 6
+     };
+
+// Supported output modes of OpenNI image generator
+enum { CAP_OPENNI_VGA_30HZ  = 0,
+       CAP_OPENNI_SXGA_15HZ = 1,
+       CAP_OPENNI_SXGA_30HZ = 2,
+       CAP_OPENNI_QVGA_30HZ = 3,
+       CAP_OPENNI_QVGA_60HZ = 4
+     };
+
+
+// GStreamer
+enum { CAP_PROP_GSTREAMER_QUEUE_LENGTH = 200 // default is 1
+     };
+
+
+// PVAPI
+enum { CAP_PROP_PVAPI_MULTICASTIP           = 300, // ip for anable multicast master mode. 0 for disable multicast
+       CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, // FrameStartTriggerMode: Determines how a frame is initiated
+       CAP_PROP_PVAPI_DECIMATIONHORIZONTAL  = 302, // Horizontal sub-sampling of the image
+       CAP_PROP_PVAPI_DECIMATIONVERTICAL    = 303, // Vertical sub-sampling of the image
+       CAP_PROP_PVAPI_BINNINGX              = 304, // Horizontal binning factor
+       CAP_PROP_PVAPI_BINNINGY              = 305, // Vertical binning factor
+       CAP_PROP_PVAPI_PIXELFORMAT           = 306  // Pixel format
+     };
+
+// PVAPI: FrameStartTriggerMode
+enum { CAP_PVAPI_FSTRIGMODE_FREERUN     = 0,    // Freerun
+       CAP_PVAPI_FSTRIGMODE_SYNCIN1     = 1,    // SyncIn1
+       CAP_PVAPI_FSTRIGMODE_SYNCIN2     = 2,    // SyncIn2
+       CAP_PVAPI_FSTRIGMODE_FIXEDRATE   = 3,    // FixedRate
+       CAP_PVAPI_FSTRIGMODE_SOFTWARE    = 4     // Software
+     };
+
+// PVAPI: DecimationHorizontal, DecimationVertical
+enum { CAP_PVAPI_DECIMATION_OFF       = 1,    // Off
+       CAP_PVAPI_DECIMATION_2OUTOF4   = 2,    // 2 out of 4 decimation
+       CAP_PVAPI_DECIMATION_2OUTOF8   = 4,    // 2 out of 8 decimation
+       CAP_PVAPI_DECIMATION_2OUTOF16  = 8     // 2 out of 16 decimation
+     };
+
+// PVAPI: PixelFormat
+enum { CAP_PVAPI_PIXELFORMAT_MONO8    = 1,    // Mono8
+       CAP_PVAPI_PIXELFORMAT_MONO16   = 2,    // Mono16
+       CAP_PVAPI_PIXELFORMAT_BAYER8   = 3,    // Bayer8
+       CAP_PVAPI_PIXELFORMAT_BAYER16  = 4,    // Bayer16
+       CAP_PVAPI_PIXELFORMAT_RGB24    = 5,    // Rgb24
+       CAP_PVAPI_PIXELFORMAT_BGR24    = 6,    // Bgr24
+       CAP_PVAPI_PIXELFORMAT_RGBA32   = 7,    // Rgba32
+       CAP_PVAPI_PIXELFORMAT_BGRA32   = 8,    // Bgra32
+     };
+
+// Properties of cameras available through XIMEA SDK interface
+enum { CAP_PROP_XI_DOWNSAMPLING  = 400, // Change image resolution by binning or skipping.
+       CAP_PROP_XI_DATA_FORMAT   = 401, // Output data format.
+       CAP_PROP_XI_OFFSET_X      = 402, // Horizontal offset from the origin to the area of interest (in pixels).
+       CAP_PROP_XI_OFFSET_Y      = 403, // Vertical offset from the origin to the area of interest (in pixels).
+       CAP_PROP_XI_TRG_SOURCE    = 404, // Defines source of trigger.
+       CAP_PROP_XI_TRG_SOFTWARE  = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.
+       CAP_PROP_XI_GPI_SELECTOR  = 406, // Selects general purpose input
+       CAP_PROP_XI_GPI_MODE      = 407, // Set general purpose input mode
+       CAP_PROP_XI_GPI_LEVEL     = 408, // Get general purpose level
+       CAP_PROP_XI_GPO_SELECTOR  = 409, // Selects general purpose output
+       CAP_PROP_XI_GPO_MODE      = 410, // Set general purpose output mode
+       CAP_PROP_XI_LED_SELECTOR  = 411, // Selects camera signalling LED
+       CAP_PROP_XI_LED_MODE      = 412, // Define camera signalling LED functionality
+       CAP_PROP_XI_MANUAL_WB     = 413, // Calculates White Balance(must be called during acquisition)
+       CAP_PROP_XI_AUTO_WB       = 414, // Automatic white balance
+       CAP_PROP_XI_AEAG          = 415, // Automatic exposure/gain
+       CAP_PROP_XI_EXP_PRIORITY  = 416, // Exposure priority (0.5 - exposure 50%, gain 50%).
+       CAP_PROP_XI_AE_MAX_LIMIT  = 417, // Maximum limit of exposure in AEAG procedure
+       CAP_PROP_XI_AG_MAX_LIMIT  = 418, // Maximum limit of gain in AEAG procedure
+       CAP_PROP_XI_AEAG_LEVEL    = 419, // Average intensity of output signal AEAG should achieve(in %)
+       CAP_PROP_XI_TIMEOUT       = 420  // Image capture timeout in milliseconds
+     };
+
+// Properties of cameras available through AVFOUNDATION interface
+enum { CAP_PROP_IOS_DEVICE_FOCUS        = 9001,
+       CAP_PROP_IOS_DEVICE_EXPOSURE     = 9002,
+       CAP_PROP_IOS_DEVICE_FLASH        = 9003,
+       CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
+       CAP_PROP_IOS_DEVICE_TORCH        = 9005
+     };
+
+
+// Properties of cameras available through Smartek Giganetix Ethernet Vision interface
+/* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */
+enum { CAP_PROP_GIGA_FRAME_OFFSET_X   = 10001,
+       CAP_PROP_GIGA_FRAME_OFFSET_Y   = 10002,
+       CAP_PROP_GIGA_FRAME_WIDTH_MAX  = 10003,
+       CAP_PROP_GIGA_FRAME_HEIGH_MAX  = 10004,
+       CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
+       CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006
+     };
+
+enum { CAP_PROP_INTELPERC_PROFILE_COUNT               = 11001,
+       CAP_PROP_INTELPERC_PROFILE_IDX                 = 11002,
+       CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE  = 11003,
+       CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE      = 11004,
+       CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD  = 11005,
+       CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ     = 11006,
+       CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT     = 11007
+     };
+
+// Intel PerC streams
+enum { CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,
+       CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,
+       CAP_INTELPERC_GENERATORS_MASK = CAP_INTELPERC_DEPTH_GENERATOR + CAP_INTELPERC_IMAGE_GENERATOR
+     };
+
+enum { CAP_INTELPERC_DEPTH_MAP              = 0, // Each pixel is a 16-bit integer. The value indicates the distance from an object to the camera's XY plane or the Cartesian depth.
+       CAP_INTELPERC_UVDEPTH_MAP            = 1, // Each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates.
+       CAP_INTELPERC_IR_MAP                 = 2, // Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam.
+       CAP_INTELPERC_IMAGE                  = 3
+     };
+
+enum { VIDEOWRITER_PROP_QUALITY = 1,    // Quality (0..100%) of the videostream encoded
+       VIDEOWRITER_PROP_FRAMEBYTES = 2, // (Read-only): Size of just encoded video frame
+       VIDEOWRITER_PROP_NSTRIPES = 3    // Number of stripes for parallel encoding. -1 for auto detection
+     };
+
+// gPhoto2 properties, if propertyId is less than 0 then work on widget with that __additive inversed__ camera setting ID
+// Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE.
+// @see CvCaptureCAM_GPHOTO2 for more info
+enum { CAP_PROP_GPHOTO2_PREVIEW           = 17001, // Capture only preview from liveview mode.
+       CAP_PROP_GPHOTO2_WIDGET_ENUMERATE  = 17002, // Readonly, returns (const char *).
+       CAP_PROP_GPHOTO2_RELOAD_CONFIG     = 17003, // Trigger, only by set. Reload camera settings.
+       CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE  = 17004, // Reload all settings on set.
+       CAP_PROP_GPHOTO2_COLLECT_MSGS      = 17005, // Collect messages with details.
+       CAP_PROP_GPHOTO2_FLUSH_MSGS        = 17006, // Readonly, returns (const char *).
+       CAP_PROP_SPEED                     = 17007, // Exposure speed. Can be readonly, depends on camera program.
+       CAP_PROP_APERTURE                  = 17008, // Aperture. Can be readonly, depends on camera program.
+       CAP_PROP_EXPOSUREPROGRAM           = 17009, // Camera exposure program.
+       CAP_PROP_VIEWFINDER                = 17010  // Enter liveview mode.
+     };
+
+//enum {
+
+class IVideoCapture;
+
+/** @brief Class for video capturing from video files, image sequences or cameras. The class provides C++ API
+for capturing video from cameras or for reading video files and image sequences. Here is how the
+class can be used: :
+@code
+    #include "opencv2/opencv.hpp"
+
+    using namespace cv;
+
+    int main(int, char**)
+    {
+        VideoCapture cap(0); // open the default camera
+        if(!cap.isOpened())  // check if we succeeded
+            return -1;
+
+        Mat edges;
+        namedWindow("edges",1);
+        for(;;)
+        {
+            Mat frame;
+            cap >> frame; // get a new frame from camera
+            cvtColor(frame, edges, COLOR_BGR2GRAY);
+            GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
+            Canny(edges, edges, 0, 30, 3);
+            imshow("edges", edges);
+            if(waitKey(30) >= 0) break;
+        }
+        // the camera will be deinitialized automatically in VideoCapture destructor
+        return 0;
+    }
+@endcode
+@note In C API the black-box structure CvCapture is used instead of VideoCapture.
+
+@note
+-   A basic sample on using the VideoCapture interface can be found at
+    opencv_source_code/samples/cpp/starter_video.cpp
+-   Another basic video processing sample can be found at
+    opencv_source_code/samples/cpp/video_dmtx.cpp
+-   (Python) A basic sample on using the VideoCapture interface can be found at
+    opencv_source_code/samples/python/video.py
+-   (Python) Another basic video processing sample can be found at
+    opencv_source_code/samples/python/video_dmtx.py
+-   (Python) A multi threaded video processing sample can be found at
+    opencv_source_code/samples/python/video_threaded.py
+ */
+class CV_EXPORTS_W VideoCapture
+{
+public:
+    /** @brief
+    @note In C API, when you finished working with video, release CvCapture structure with
+    cvReleaseCapture(), or use Ptr\<CvCapture\> that calls cvReleaseCapture() automatically in the
+    destructor.
+     */
+    CV_WRAP VideoCapture();
+
+    /** @overload
+    @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
+    img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
+    */
+    CV_WRAP VideoCapture(const String& filename);
+
+    /** @overload
+    @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
+    img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
+
+    @param apiPreference preferred Capture API to use. Can be used to enforce a specific reader
+    implementation if multiple are available: e.g. CAP_FFMPEG or CAP_IMAGES
+    */
+    CV_WRAP VideoCapture(const String& filename, int apiPreference);
+
+    /** @overload
+    @param index = camera_id + domain_offset (CAP_*). id of the video capturing device to open. If there is a single
+    camera connected, just pass 0. Advanced Usage: to open Camera 1 using the MS Media Foundation API: index = 1 + CAP_MSMF
+    */
+    CV_WRAP VideoCapture(int index);
+
+    virtual ~VideoCapture();
+
+    /** @brief Open video file or a capturing device for video capturing
+
+    @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
+    img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
+
+    The methods first call VideoCapture::release to close the already opened file or camera.
+     */
+    CV_WRAP virtual bool open(const String& filename);
+
+    /** @overload
+    @param index = camera_id + domain_offset (CAP_*). id of the video capturing device to open. If there is a single
+    camera connected, just pass 0. Advanced Usage: to open Camera 1 using the MS Media Foundation API: index = 1 + CAP_MSMF
+    */
+    CV_WRAP virtual bool open(int index);
+
+    /** @brief Returns true if video capturing has been initialized already.
+
+    If the previous call to VideoCapture constructor or VideoCapture::open succeeded, the method returns
+    true.
+     */
+    CV_WRAP virtual bool isOpened() const;
+
+    /** @brief Closes video file or capturing device.
+
+    The methods are automatically called by subsequent VideoCapture::open and by VideoCapture
+    destructor.
+
+    The C function also deallocates memory and clears \*capture pointer.
+     */
+    CV_WRAP virtual void release();
+
+    /** @brief Grabs the next frame from video file or capturing device.
+
+    The methods/functions grab the next frame from video file or camera and return true (non-zero) in
+    the case of success.
+
+    The primary use of the function is in multi-camera environments, especially when the cameras do not
+    have hardware synchronization. That is, you call VideoCapture::grab() for each camera and after that
+    call the slower method VideoCapture::retrieve() to decode and get frame from each camera. This way
+    the overhead on demosaicing or motion jpeg decompression etc. is eliminated and the retrieved frames
+    from different cameras will be closer in time.
+
+    Also, when a connected camera is multi-head (for example, a stereo camera or a Kinect device), the
+    correct way of retrieving data from it is to call VideoCapture::grab first and then call
+    VideoCapture::retrieve one or more times with different values of the channel parameter. See
+    <https://github.com/Itseez/opencv/tree/master/samples/cpp/openni_capture.cpp>
+     */
+    CV_WRAP virtual bool grab();
+
+    /** @brief Decodes and returns the grabbed video frame.
+
+    The methods/functions decode and return the just grabbed frame. If no frames has been grabbed
+    (camera has been disconnected, or there are no more frames in video file), the methods return false
+    and the functions return NULL pointer.
+
+    @note OpenCV 1.x functions cvRetrieveFrame and cv.RetrieveFrame return image stored inside the video
+    capturing structure. It is not allowed to modify or release the image! You can copy the frame using
+    :ocvcvCloneImage and then do whatever you want with the copy.
+     */
+    CV_WRAP virtual bool retrieve(OutputArray image, int flag = 0);
+    virtual VideoCapture& operator >> (CV_OUT Mat& image);
+    virtual VideoCapture& operator >> (CV_OUT UMat& image);
+
+    /** @brief Grabs, decodes and returns the next video frame.
+
+    The methods/functions combine VideoCapture::grab and VideoCapture::retrieve in one call. This is the
+    most convenient method for reading video files or capturing data from decode and return the just
+    grabbed frame. If no frames has been grabbed (camera has been disconnected, or there are no more
+    frames in video file), the methods return false and the functions return NULL pointer.
+
+    @note OpenCV 1.x functions cvRetrieveFrame and cv.RetrieveFrame return image stored inside the video
+    capturing structure. It is not allowed to modify or release the image! You can copy the frame using
+    :ocvcvCloneImage and then do whatever you want with the copy.
+     */
+    CV_WRAP virtual bool read(OutputArray image);
+
+    /** @brief Sets a property in the VideoCapture.
+
+    @param propId Property identifier. It can be one of the following:
+     -   **CAP_PROP_POS_MSEC** Current position of the video file in milliseconds.
+     -   **CAP_PROP_POS_FRAMES** 0-based index of the frame to be decoded/captured next.
+     -   **CAP_PROP_POS_AVI_RATIO** Relative position of the video file: 0 - start of the
+         film, 1 - end of the film.
+     -   **CAP_PROP_FRAME_WIDTH** Width of the frames in the video stream.
+     -   **CAP_PROP_FRAME_HEIGHT** Height of the frames in the video stream.
+     -   **CAP_PROP_FPS** Frame rate.
+     -   **CAP_PROP_FOURCC** 4-character code of codec.
+     -   **CAP_PROP_FRAME_COUNT** Number of frames in the video file.
+     -   **CAP_PROP_FORMAT** Format of the Mat objects returned by retrieve() .
+     -   **CAP_PROP_MODE** Backend-specific value indicating the current capture mode.
+     -   **CAP_PROP_BRIGHTNESS** Brightness of the image (only for cameras).
+     -   **CAP_PROP_CONTRAST** Contrast of the image (only for cameras).
+     -   **CAP_PROP_SATURATION** Saturation of the image (only for cameras).
+     -   **CAP_PROP_HUE** Hue of the image (only for cameras).
+     -   **CAP_PROP_GAIN** Gain of the image (only for cameras).
+     -   **CAP_PROP_EXPOSURE** Exposure (only for cameras).
+     -   **CAP_PROP_CONVERT_RGB** Boolean flags indicating whether images should be converted
+         to RGB.
+     -   **CAP_PROP_WHITE_BALANCE** Currently unsupported
+     -   **CAP_PROP_RECTIFICATION** Rectification flag for stereo cameras (note: only supported
+         by DC1394 v 2.x backend currently)
+    @param value Value of the property.
+     */
+    CV_WRAP virtual bool set(int propId, double value);
+
+    /** @brief Returns the specified VideoCapture property
+
+    @param propId Property identifier. It can be one of the following:
+     -   **CAP_PROP_POS_MSEC** Current position of the video file in milliseconds or video
+         capture timestamp.
+     -   **CAP_PROP_POS_FRAMES** 0-based index of the frame to be decoded/captured next.
+     -   **CAP_PROP_POS_AVI_RATIO** Relative position of the video file: 0 - start of the
+         film, 1 - end of the film.
+     -   **CAP_PROP_FRAME_WIDTH** Width of the frames in the video stream.
+     -   **CAP_PROP_FRAME_HEIGHT** Height of the frames in the video stream.
+     -   **CAP_PROP_FPS** Frame rate.
+     -   **CAP_PROP_FOURCC** 4-character code of codec.
+     -   **CAP_PROP_FRAME_COUNT** Number of frames in the video file.
+     -   **CAP_PROP_FORMAT** Format of the Mat objects returned by retrieve() .
+     -   **CAP_PROP_MODE** Backend-specific value indicating the current capture mode.
+     -   **CAP_PROP_BRIGHTNESS** Brightness of the image (only for cameras).
+     -   **CAP_PROP_CONTRAST** Contrast of the image (only for cameras).
+     -   **CAP_PROP_SATURATION** Saturation of the image (only for cameras).
+     -   **CAP_PROP_HUE** Hue of the image (only for cameras).
+     -   **CAP_PROP_GAIN** Gain of the image (only for cameras).
+     -   **CAP_PROP_EXPOSURE** Exposure (only for cameras).
+     -   **CAP_PROP_CONVERT_RGB** Boolean flags indicating whether images should be converted
+         to RGB.
+     -   **CAP_PROP_WHITE_BALANCE** Currently not supported
+     -   **CAP_PROP_RECTIFICATION** Rectification flag for stereo cameras (note: only supported
+         by DC1394 v 2.x backend currently)
+
+    @note When querying a property that is not supported by the backend used by the VideoCapture
+    class, value 0 is returned.
+     */
+    CV_WRAP virtual double get(int propId) const;
+
+    /** @overload
+
+    @param filename name of the opened video file (eg. video.avi) or image sequence (eg.
+    img_%02d.jpg, which will read samples like img_00.jpg, img_01.jpg, img_02.jpg, ...)
+
+    @param apiPreference preferred Capture API to use. Can be used to enforce a specific reader
+    implementation if multiple are available: e.g. CAP_FFMPEG or CAP_IMAGES
+
+    The methods first call VideoCapture::release to close the already opened file or camera.
+     */
+    CV_WRAP virtual bool open(const String& filename, int apiPreference);
+
+protected:
+    Ptr<CvCapture> cap;
+    Ptr<IVideoCapture> icap;
+};
+
+class IVideoWriter;
+
+/** @brief Video writer class.
+ */
+class CV_EXPORTS_W VideoWriter
+{
+public:
+    /** @brief VideoWriter constructors
+
+    The constructors/functions initialize video writers. On Linux FFMPEG is used to write videos; on
+    Windows FFMPEG or VFW is used; on MacOSX QTKit is used.
+     */
+    CV_WRAP VideoWriter();
+
+    /** @overload
+    @param filename Name of the output video file.
+    @param fourcc 4-character code of codec used to compress the frames. For example,
+    VideoWriter::fourcc('P','I','M','1') is a MPEG-1 codec, VideoWriter::fourcc('M','J','P','G') is a
+    motion-jpeg codec etc. List of codes can be obtained at [Video Codecs by
+    FOURCC](http://www.fourcc.org/codecs.php) page. FFMPEG backend with MP4 container natively uses
+    other values as fourcc code: see [ObjectType](http://www.mp4ra.org/codecs.html),
+    so you may receive a warning message from OpenCV about fourcc code conversion.
+    @param fps Framerate of the created video stream.
+    @param frameSize Size of the video frames.
+    @param isColor If it is not zero, the encoder will expect and encode color frames, otherwise it
+    will work with grayscale frames (the flag is currently supported on Windows only).
+    */
+    CV_WRAP VideoWriter(const String& filename, int fourcc, double fps,
+                Size frameSize, bool isColor = true);
+
+    virtual ~VideoWriter();
+
+    /** @brief Initializes or reinitializes video writer.
+
+    The method opens video writer. Parameters are the same as in the constructor
+    VideoWriter::VideoWriter.
+     */
+    CV_WRAP virtual bool open(const String& filename, int fourcc, double fps,
+                      Size frameSize, bool isColor = true);
+
+    /** @brief Returns true if video writer has been successfully initialized.
+    */
+    CV_WRAP virtual bool isOpened() const;
+
+    /** @brief Closes the video writer.
+
+    The methods are automatically called by subsequent VideoWriter::open and by the VideoWriter
+    destructor.
+     */
+    CV_WRAP virtual void release();
+    virtual VideoWriter& operator << (const Mat& image);
+
+    /** @brief Writes the next video frame
+
+    @param image The written frame
+
+    The functions/methods write the specified image to video file. It must have the same size as has
+    been specified when opening the video writer.
+     */
+    CV_WRAP virtual void write(const Mat& image);
+
+    /** @brief Sets a property in the VideoWriter.
+
+     @param propId Property identifier. It can be one of the following:
+     -   **VIDEOWRITER_PROP_QUALITY** Quality (0..100%) of the videostream encoded. Can be adjusted dynamically in some codecs.
+     -   **VIDEOWRITER_PROP_NSTRIPES** Number of stripes for parallel encoding
+     @param value Value of the property.
+     */
+    CV_WRAP virtual bool set(int propId, double value);
+
+    /** @brief Returns the specified VideoWriter property
+
+     @param propId Property identifier. It can be one of the following:
+     -   **VIDEOWRITER_PROP_QUALITY** Current quality of the encoded videostream.
+     -   **VIDEOWRITER_PROP_FRAMEBYTES** (Read-only) Size of just encoded video frame; note that the encoding order may be different from representation order.
+     -   **VIDEOWRITER_PROP_NSTRIPES** Number of stripes for parallel encoding
+
+     @note When querying a property that is not supported by the backend used by the VideoWriter
+     class, value 0 is returned.
+     */
+    CV_WRAP virtual double get(int propId) const;
+
+    /** @brief Concatenates 4 chars to a fourcc code
+
+    This static method constructs the fourcc code of the codec to be used in the constructor
+    VideoWriter::VideoWriter or VideoWriter::open.
+     */
+    CV_WRAP static int fourcc(char c1, char c2, char c3, char c4);
+
+protected:
+    Ptr<CvVideoWriter> writer;
+    Ptr<IVideoWriter> iwriter;
+
+    static Ptr<IVideoWriter> create(const String& filename, int fourcc, double fps,
+                                    Size frameSize, bool isColor = true);
+};
+
+template<> CV_EXPORTS void DefaultDeleter<CvCapture>::operator ()(CvCapture* obj) const;
+template<> CV_EXPORTS void DefaultDeleter<CvVideoWriter>::operator ()(CvVideoWriter* obj) const;
+
+//! @} videoio
+
+} // cv
+
+#endif //__OPENCV_VIDEOIO_HPP__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h b/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h
new file mode 100644
index 0000000..1a9875b
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/cap_ios.h
@@ -0,0 +1,176 @@
+/*  For iOS video I/O
+ *  by Eduard Feicho on 29/07/12
+ *  Copyright 2012. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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.
+ *
+ */
+
+#import <UIKit/UIKit.h>
+#import <Accelerate/Accelerate.h>
+#import <AVFoundation/AVFoundation.h>
+#import <ImageIO/ImageIO.h>
+#include "opencv2/core.hpp"
+
+//! @addtogroup videoio_ios
+//! @{
+
+/////////////////////////////////////// CvAbstractCamera /////////////////////////////////////
+
+@class CvAbstractCamera;
+
+@interface CvAbstractCamera : NSObject
+{
+    AVCaptureSession* captureSession;
+    AVCaptureConnection* videoCaptureConnection;
+    AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
+
+    UIDeviceOrientation currentDeviceOrientation;
+
+    BOOL cameraAvailable;
+    BOOL captureSessionLoaded;
+    BOOL running;
+    BOOL useAVCaptureVideoPreviewLayer;
+
+    AVCaptureDevicePosition defaultAVCaptureDevicePosition;
+    AVCaptureVideoOrientation defaultAVCaptureVideoOrientation;
+    NSString *const defaultAVCaptureSessionPreset;
+
+    int defaultFPS;
+
+    UIView* parentView;
+
+    int imageWidth;
+    int imageHeight;
+}
+
+@property (nonatomic, retain) AVCaptureSession* captureSession;
+@property (nonatomic, retain) AVCaptureConnection* videoCaptureConnection;
+
+@property (nonatomic, readonly) BOOL running;
+@property (nonatomic, readonly) BOOL captureSessionLoaded;
+
+@property (nonatomic, assign) int defaultFPS;
+@property (nonatomic, readonly) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;
+@property (nonatomic, assign) AVCaptureDevicePosition defaultAVCaptureDevicePosition;
+@property (nonatomic, assign) AVCaptureVideoOrientation defaultAVCaptureVideoOrientation;
+@property (nonatomic, assign) BOOL useAVCaptureVideoPreviewLayer;
+@property (nonatomic, strong) NSString *const defaultAVCaptureSessionPreset;
+
+@property (nonatomic, assign) int imageWidth;
+@property (nonatomic, assign) int imageHeight;
+
+@property (nonatomic, retain) UIView* parentView;
+
+- (void)start;
+- (void)stop;
+- (void)switchCameras;
+
+- (id)initWithParentView:(UIView*)parent;
+
+- (void)createCaptureOutput;
+- (void)createVideoPreviewLayer;
+- (void)updateOrientation;
+
+- (void)lockFocus;
+- (void)unlockFocus;
+- (void)lockExposure;
+- (void)unlockExposure;
+- (void)lockBalance;
+- (void)unlockBalance;
+
+@end
+
+///////////////////////////////// CvVideoCamera ///////////////////////////////////////////
+
+@class CvVideoCamera;
+
+@protocol CvVideoCameraDelegate <NSObject>
+
+#ifdef __cplusplus
+// delegate method for processing image frames
+- (void)processImage:(cv::Mat&)image;
+#endif
+
+@end
+
+@interface CvVideoCamera : CvAbstractCamera<AVCaptureVideoDataOutputSampleBufferDelegate>
+{
+    AVCaptureVideoDataOutput *videoDataOutput;
+
+    dispatch_queue_t videoDataOutputQueue;
+    CALayer *customPreviewLayer;
+
+    BOOL grayscaleMode;
+
+    BOOL recordVideo;
+    BOOL rotateVideo;
+    AVAssetWriterInput* recordAssetWriterInput;
+    AVAssetWriterInputPixelBufferAdaptor* recordPixelBufferAdaptor;
+    AVAssetWriter* recordAssetWriter;
+
+    CMTime lastSampleTime;
+
+}
+
+@property (nonatomic, assign) id<CvVideoCameraDelegate> delegate;
+@property (nonatomic, assign) BOOL grayscaleMode;
+
+@property (nonatomic, assign) BOOL recordVideo;
+@property (nonatomic, assign) BOOL rotateVideo;
+@property (nonatomic, retain) AVAssetWriterInput* recordAssetWriterInput;
+@property (nonatomic, retain) AVAssetWriterInputPixelBufferAdaptor* recordPixelBufferAdaptor;
+@property (nonatomic, retain) AVAssetWriter* recordAssetWriter;
+
+- (void)adjustLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
+- (void)layoutPreviewLayer;
+- (void)saveVideo;
+- (NSURL *)videoFileURL;
+- (NSString *)videoFileString;
+
+
+@end
+
+///////////////////////////////// CvPhotoCamera ///////////////////////////////////////////
+
+@class CvPhotoCamera;
+
+@protocol CvPhotoCameraDelegate <NSObject>
+
+- (void)photoCamera:(CvPhotoCamera*)photoCamera capturedImage:(UIImage *)image;
+- (void)photoCameraCancel:(CvPhotoCamera*)photoCamera;
+
+@end
+
+@interface CvPhotoCamera : CvAbstractCamera
+{
+    AVCaptureStillImageOutput *stillImageOutput;
+}
+
+@property (nonatomic, assign) id<CvPhotoCameraDelegate> delegate;
+
+- (void)takePicture;
+
+@end
+
+//! @} videoio_ios
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp
new file mode 100644
index 0000000..ec84cf7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/videoio.hpp
@@ -0,0 +1,48 @@
+/*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.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// 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*/
+
+#ifdef __OPENCV_BUILD
+#error this is a compatibility header which should not be used inside the OpenCV library
+#endif
+
+#include "opencv2/videoio.hpp"
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h b/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h
new file mode 100644
index 0000000..47f46fa
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videoio/videoio_c.h
@@ -0,0 +1,533 @@
+/*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.
+//
+//
+//                        Intel License Agreement
+//                For Open Source Computer Vision Library
+//
+// Copyright (C) 2000, Intel Corporation, 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 Intel Corporation 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*/
+
+#ifndef __OPENCV_VIDEOIO_H__
+#define __OPENCV_VIDEOIO_H__
+
+#include "opencv2/core/core_c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+  @addtogroup videoio_c
+  @{
+*/
+
+/****************************************************************************************\
+*                         Working with Video Files and Cameras                           *
+\****************************************************************************************/
+
+/* "black box" capture structure */
+typedef struct CvCapture CvCapture;
+
+/* start capturing frames from video file */
+CVAPI(CvCapture*) cvCreateFileCapture( const char* filename );
+
+/* start capturing frames from video file. allows specifying a preferred API to use */
+CVAPI(CvCapture*) cvCreateFileCaptureWithPreference( const char* filename , int apiPreference);
+
+enum
+{
+    CV_CAP_ANY      =0,     // autodetect
+
+    CV_CAP_MIL      =100,   // MIL proprietary drivers
+
+    CV_CAP_VFW      =200,   // platform native
+    CV_CAP_V4L      =200,
+    CV_CAP_V4L2     =200,
+
+    CV_CAP_FIREWARE =300,   // IEEE 1394 drivers
+    CV_CAP_FIREWIRE =300,
+    CV_CAP_IEEE1394 =300,
+    CV_CAP_DC1394   =300,
+    CV_CAP_CMU1394  =300,
+
+    CV_CAP_STEREO   =400,   // TYZX proprietary drivers
+    CV_CAP_TYZX     =400,
+    CV_TYZX_LEFT    =400,
+    CV_TYZX_RIGHT   =401,
+    CV_TYZX_COLOR   =402,
+    CV_TYZX_Z       =403,
+
+    CV_CAP_QT       =500,   // QuickTime
+
+    CV_CAP_UNICAP   =600,   // Unicap drivers
+
+    CV_CAP_DSHOW    =700,   // DirectShow (via videoInput)
+    CV_CAP_MSMF     =1400,  // Microsoft Media Foundation (via videoInput)
+
+    CV_CAP_PVAPI    =800,   // PvAPI, Prosilica GigE SDK
+
+    CV_CAP_OPENNI   =900,   // OpenNI (for Kinect)
+    CV_CAP_OPENNI_ASUS =910,   // OpenNI (for Asus Xtion)
+
+    CV_CAP_ANDROID  =1000,  // Android - not used
+    CV_CAP_ANDROID_BACK =CV_CAP_ANDROID+99, // Android back camera - not used
+    CV_CAP_ANDROID_FRONT =CV_CAP_ANDROID+98, // Android front camera - not used
+
+    CV_CAP_XIAPI    =1100,   // XIMEA Camera API
+
+    CV_CAP_AVFOUNDATION = 1200,  // AVFoundation framework for iOS (OS X Lion will have the same API)
+
+    CV_CAP_GIGANETIX = 1300,  // Smartek Giganetix GigEVisionSDK
+
+    CV_CAP_INTELPERC = 1500, // Intel Perceptual Computing
+
+    CV_CAP_OPENNI2 = 1600,   // OpenNI2 (for Kinect)
+    CV_CAP_GPHOTO2 = 1700,
+    CV_CAP_GSTREAMER = 1800, // GStreamer
+    CV_CAP_FFMPEG = 1900,    // FFMPEG
+    CV_CAP_IMAGES = 2000     // OpenCV Image Sequence (e.g. img_%02d.jpg)
+};
+
+/* start capturing frames from camera: index = camera_index + domain_offset (CV_CAP_*) */
+CVAPI(CvCapture*) cvCreateCameraCapture( int index );
+
+/* grab a frame, return 1 on success, 0 on fail.
+  this function is thought to be fast               */
+CVAPI(int) cvGrabFrame( CvCapture* capture );
+
+/* get the frame grabbed with cvGrabFrame(..)
+  This function may apply some frame processing like
+  frame decompression, flipping etc.
+  !!!DO NOT RELEASE or MODIFY the retrieved frame!!! */
+CVAPI(IplImage*) cvRetrieveFrame( CvCapture* capture, int streamIdx CV_DEFAULT(0) );
+
+/* Just a combination of cvGrabFrame and cvRetrieveFrame
+   !!!DO NOT RELEASE or MODIFY the retrieved frame!!!      */
+CVAPI(IplImage*) cvQueryFrame( CvCapture* capture );
+
+/* stop capturing/reading and free resources */
+CVAPI(void) cvReleaseCapture( CvCapture** capture );
+
+enum
+{
+    // modes of the controlling registers (can be: auto, manual, auto single push, absolute Latter allowed with any other mode)
+    // every feature can have only one mode turned on at a time
+    CV_CAP_PROP_DC1394_OFF         = -4,  //turn the feature off (not controlled manually nor automatically)
+    CV_CAP_PROP_DC1394_MODE_MANUAL = -3, //set automatically when a value of the feature is set by the user
+    CV_CAP_PROP_DC1394_MODE_AUTO = -2,
+    CV_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1,
+    CV_CAP_PROP_POS_MSEC       =0,
+    CV_CAP_PROP_POS_FRAMES     =1,
+    CV_CAP_PROP_POS_AVI_RATIO  =2,
+    CV_CAP_PROP_FRAME_WIDTH    =3,
+    CV_CAP_PROP_FRAME_HEIGHT   =4,
+    CV_CAP_PROP_FPS            =5,
+    CV_CAP_PROP_FOURCC         =6,
+    CV_CAP_PROP_FRAME_COUNT    =7,
+    CV_CAP_PROP_FORMAT         =8,
+    CV_CAP_PROP_MODE           =9,
+    CV_CAP_PROP_BRIGHTNESS    =10,
+    CV_CAP_PROP_CONTRAST      =11,
+    CV_CAP_PROP_SATURATION    =12,
+    CV_CAP_PROP_HUE           =13,
+    CV_CAP_PROP_GAIN          =14,
+    CV_CAP_PROP_EXPOSURE      =15,
+    CV_CAP_PROP_CONVERT_RGB   =16,
+    CV_CAP_PROP_WHITE_BALANCE_BLUE_U =17,
+    CV_CAP_PROP_RECTIFICATION =18,
+    CV_CAP_PROP_MONOCHROME    =19,
+    CV_CAP_PROP_SHARPNESS     =20,
+    CV_CAP_PROP_AUTO_EXPOSURE =21, // exposure control done by camera,
+                                   // user can adjust refernce level
+                                   // using this feature
+    CV_CAP_PROP_GAMMA         =22,
+    CV_CAP_PROP_TEMPERATURE   =23,
+    CV_CAP_PROP_TRIGGER       =24,
+    CV_CAP_PROP_TRIGGER_DELAY =25,
+    CV_CAP_PROP_WHITE_BALANCE_RED_V =26,
+    CV_CAP_PROP_ZOOM          =27,
+    CV_CAP_PROP_FOCUS         =28,
+    CV_CAP_PROP_GUID          =29,
+    CV_CAP_PROP_ISO_SPEED     =30,
+    CV_CAP_PROP_MAX_DC1394    =31,
+    CV_CAP_PROP_BACKLIGHT     =32,
+    CV_CAP_PROP_PAN           =33,
+    CV_CAP_PROP_TILT          =34,
+    CV_CAP_PROP_ROLL          =35,
+    CV_CAP_PROP_IRIS          =36,
+    CV_CAP_PROP_SETTINGS      =37,
+    CV_CAP_PROP_BUFFERSIZE    =38,
+    CV_CAP_PROP_AUTOFOCUS     =39,
+    CV_CAP_PROP_SAR_NUM       =40,
+    CV_CAP_PROP_SAR_DEN       =41,
+
+    CV_CAP_PROP_AUTOGRAB      =1024, // property for videoio class CvCapture_Android only
+    CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING=1025, // readonly, tricky property, returns cpnst char* indeed
+    CV_CAP_PROP_PREVIEW_FORMAT=1026, // readonly, tricky property, returns cpnst char* indeed
+
+    // OpenNI map generators
+    CV_CAP_OPENNI_DEPTH_GENERATOR = 1 << 31,
+    CV_CAP_OPENNI_IMAGE_GENERATOR = 1 << 30,
+    CV_CAP_OPENNI_GENERATORS_MASK = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_OPENNI_IMAGE_GENERATOR,
+
+    // Properties of cameras available through OpenNI interfaces
+    CV_CAP_PROP_OPENNI_OUTPUT_MODE     = 100,
+    CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101, // in mm
+    CV_CAP_PROP_OPENNI_BASELINE        = 102, // in mm
+    CV_CAP_PROP_OPENNI_FOCAL_LENGTH    = 103, // in pixels
+    CV_CAP_PROP_OPENNI_REGISTRATION    = 104, // flag
+    CV_CAP_PROP_OPENNI_REGISTRATION_ON = CV_CAP_PROP_OPENNI_REGISTRATION, // flag that synchronizes the remapping depth map to image map
+                                                                          // by changing depth generator's view point (if the flag is "on") or
+                                                                          // sets this view point to its normal one (if the flag is "off").
+    CV_CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105,
+    CV_CAP_PROP_OPENNI_MAX_BUFFER_SIZE   = 106,
+    CV_CAP_PROP_OPENNI_CIRCLE_BUFFER     = 107,
+    CV_CAP_PROP_OPENNI_MAX_TIME_DURATION = 108,
+
+    CV_CAP_PROP_OPENNI_GENERATOR_PRESENT = 109,
+    CV_CAP_PROP_OPENNI2_SYNC = 110,
+    CV_CAP_PROP_OPENNI2_MIRROR = 111,
+
+    CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT         = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT,
+    CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE     = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE,
+    CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE        = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE,
+    CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH    = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH,
+    CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION    = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION,
+    CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION,
+
+    // Properties of cameras available through GStreamer interface
+    CV_CAP_GSTREAMER_QUEUE_LENGTH           = 200, // default is 1
+
+    // PVAPI
+    CV_CAP_PROP_PVAPI_MULTICASTIP           = 300, // ip for anable multicast master mode. 0 for disable multicast
+    CV_CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE = 301, // FrameStartTriggerMode: Determines how a frame is initiated
+    CV_CAP_PROP_PVAPI_DECIMATIONHORIZONTAL  = 302, // Horizontal sub-sampling of the image
+    CV_CAP_PROP_PVAPI_DECIMATIONVERTICAL    = 303, // Vertical sub-sampling of the image
+    CV_CAP_PROP_PVAPI_BINNINGX              = 304, // Horizontal binning factor
+    CV_CAP_PROP_PVAPI_BINNINGY              = 305, // Vertical binning factor
+    CV_CAP_PROP_PVAPI_PIXELFORMAT           = 306, // Pixel format
+
+    // Properties of cameras available through XIMEA SDK interface
+    CV_CAP_PROP_XI_DOWNSAMPLING                                 = 400, // Change image resolution by binning or skipping.
+    CV_CAP_PROP_XI_DATA_FORMAT                                  = 401, // Output data format.
+    CV_CAP_PROP_XI_OFFSET_X                                     = 402, // Horizontal offset from the origin to the area of interest (in pixels).
+    CV_CAP_PROP_XI_OFFSET_Y                                     = 403, // Vertical offset from the origin to the area of interest (in pixels).
+    CV_CAP_PROP_XI_TRG_SOURCE                                   = 404, // Defines source of trigger.
+    CV_CAP_PROP_XI_TRG_SOFTWARE                                 = 405, // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE.
+    CV_CAP_PROP_XI_GPI_SELECTOR                                 = 406, // Selects general purpose input
+    CV_CAP_PROP_XI_GPI_MODE                                     = 407, // Set general purpose input mode
+    CV_CAP_PROP_XI_GPI_LEVEL                                    = 408, // Get general purpose level
+    CV_CAP_PROP_XI_GPO_SELECTOR                                 = 409, // Selects general purpose output
+    CV_CAP_PROP_XI_GPO_MODE                                     = 410, // Set general purpose output mode
+    CV_CAP_PROP_XI_LED_SELECTOR                                 = 411, // Selects camera signalling LED
+    CV_CAP_PROP_XI_LED_MODE                                     = 412, // Define camera signalling LED functionality
+    CV_CAP_PROP_XI_MANUAL_WB                                    = 413, // Calculates White Balance(must be called during acquisition)
+    CV_CAP_PROP_XI_AUTO_WB                                      = 414, // Automatic white balance
+    CV_CAP_PROP_XI_AEAG                                         = 415, // Automatic exposure/gain
+    CV_CAP_PROP_XI_EXP_PRIORITY                                 = 416, // Exposure priority (0.5 - exposure 50%, gain 50%).
+    CV_CAP_PROP_XI_AE_MAX_LIMIT                                 = 417, // Maximum limit of exposure in AEAG procedure
+    CV_CAP_PROP_XI_AG_MAX_LIMIT                                 = 418,  // Maximum limit of gain in AEAG procedure
+    CV_CAP_PROP_XI_AEAG_LEVEL                                   = 419, // Average intensity of output signal AEAG should achieve(in %)
+    CV_CAP_PROP_XI_TIMEOUT                                      = 420, // Image capture timeout in milliseconds
+    CV_CAP_PROP_XI_EXPOSURE                                     = 421, // Exposure time in microseconds
+    CV_CAP_PROP_XI_EXPOSURE_BURST_COUNT                         = 422, // Sets the number of times of exposure in one frame.
+    CV_CAP_PROP_XI_GAIN_SELECTOR                                = 423, // Gain selector for parameter Gain allows to select different type of gains.
+    CV_CAP_PROP_XI_GAIN                                         = 424, // Gain in dB
+    CV_CAP_PROP_XI_DOWNSAMPLING_TYPE                            = 426, // Change image downsampling type.
+    CV_CAP_PROP_XI_BINNING_SELECTOR                             = 427, // Binning engine selector.
+    CV_CAP_PROP_XI_BINNING_VERTICAL                             = 428, // Vertical Binning - number of vertical photo-sensitive cells to combine together.
+    CV_CAP_PROP_XI_BINNING_HORIZONTAL                           = 429, // Horizontal Binning - number of horizontal photo-sensitive cells to combine together.
+    CV_CAP_PROP_XI_BINNING_PATTERN                              = 430, // Binning pattern type.
+    CV_CAP_PROP_XI_DECIMATION_SELECTOR                          = 431, // Decimation engine selector.
+    CV_CAP_PROP_XI_DECIMATION_VERTICAL                          = 432, // Vertical Decimation - vertical sub-sampling of the image - reduces the vertical resolution of the image by the specified vertical decimation factor.
+    CV_CAP_PROP_XI_DECIMATION_HORIZONTAL                        = 433, // Horizontal Decimation - horizontal sub-sampling of the image - reduces the horizontal resolution of the image by the specified vertical decimation factor.
+    CV_CAP_PROP_XI_DECIMATION_PATTERN                           = 434, // Decimation pattern type.
+    CV_CAP_PROP_XI_IMAGE_DATA_FORMAT                            = 435, // Output data format.
+    CV_CAP_PROP_XI_SHUTTER_TYPE                                 = 436, // Change sensor shutter type(CMOS sensor).
+    CV_CAP_PROP_XI_SENSOR_TAPS                                  = 437, // Number of taps
+    CV_CAP_PROP_XI_AEAG_ROI_OFFSET_X                            = 439, // Automatic exposure/gain ROI offset X
+    CV_CAP_PROP_XI_AEAG_ROI_OFFSET_Y                            = 440, // Automatic exposure/gain ROI offset Y
+    CV_CAP_PROP_XI_AEAG_ROI_WIDTH                               = 441, // Automatic exposure/gain ROI Width
+    CV_CAP_PROP_XI_AEAG_ROI_HEIGHT                              = 442, // Automatic exposure/gain ROI Height
+    CV_CAP_PROP_XI_BPC                                          = 445, // Correction of bad pixels
+    CV_CAP_PROP_XI_WB_KR                                        = 448, // White balance red coefficient
+    CV_CAP_PROP_XI_WB_KG                                        = 449, // White balance green coefficient
+    CV_CAP_PROP_XI_WB_KB                                        = 450, // White balance blue coefficient
+    CV_CAP_PROP_XI_WIDTH                                        = 451, // Width of the Image provided by the device (in pixels).
+    CV_CAP_PROP_XI_HEIGHT                                       = 452, // Height of the Image provided by the device (in pixels).
+    CV_CAP_PROP_XI_LIMIT_BANDWIDTH                              = 459, // Set/get bandwidth(datarate)(in Megabits)
+    CV_CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH                        = 460, // Sensor output data bit depth.
+    CV_CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH                        = 461, // Device output data bit depth.
+    CV_CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH                         = 462, // bitdepth of data returned by function xiGetImage
+    CV_CAP_PROP_XI_OUTPUT_DATA_PACKING                          = 463, // Device output data packing (or grouping) enabled. Packing could be enabled if output_data_bit_depth > 8 and packing capability is available.
+    CV_CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE                     = 464, // Data packing type. Some cameras supports only specific packing type.
+    CV_CAP_PROP_XI_IS_COOLED                                    = 465, // Returns 1 for cameras that support cooling.
+    CV_CAP_PROP_XI_COOLING                                      = 466, // Start camera cooling.
+    CV_CAP_PROP_XI_TARGET_TEMP                                  = 467, // Set sensor target temperature for cooling.
+    CV_CAP_PROP_XI_CHIP_TEMP                                    = 468, // Camera sensor temperature
+    CV_CAP_PROP_XI_HOUS_TEMP                                    = 469, // Camera housing tepmerature
+    CV_CAP_PROP_XI_CMS                                          = 470, // Mode of color management system.
+    CV_CAP_PROP_XI_APPLY_CMS                                    = 471, // Enable applying of CMS profiles to xiGetImage (see XI_PRM_INPUT_CMS_PROFILE, XI_PRM_OUTPUT_CMS_PROFILE).
+    CV_CAP_PROP_XI_IMAGE_IS_COLOR                               = 474, // Returns 1 for color cameras.
+    CV_CAP_PROP_XI_COLOR_FILTER_ARRAY                           = 475, // Returns color filter array type of RAW data.
+    CV_CAP_PROP_XI_GAMMAY                                       = 476, // Luminosity gamma
+    CV_CAP_PROP_XI_GAMMAC                                       = 477, // Chromaticity gamma
+    CV_CAP_PROP_XI_SHARPNESS                                    = 478, // Sharpness Strenght
+    CV_CAP_PROP_XI_CC_MATRIX_00                                 = 479, // Color Correction Matrix element [0][0]
+    CV_CAP_PROP_XI_CC_MATRIX_01                                 = 480, // Color Correction Matrix element [0][1]
+    CV_CAP_PROP_XI_CC_MATRIX_02                                 = 481, // Color Correction Matrix element [0][2]
+    CV_CAP_PROP_XI_CC_MATRIX_03                                 = 482, // Color Correction Matrix element [0][3]
+    CV_CAP_PROP_XI_CC_MATRIX_10                                 = 483, // Color Correction Matrix element [1][0]
+    CV_CAP_PROP_XI_CC_MATRIX_11                                 = 484, // Color Correction Matrix element [1][1]
+    CV_CAP_PROP_XI_CC_MATRIX_12                                 = 485, // Color Correction Matrix element [1][2]
+    CV_CAP_PROP_XI_CC_MATRIX_13                                 = 486, // Color Correction Matrix element [1][3]
+    CV_CAP_PROP_XI_CC_MATRIX_20                                 = 487, // Color Correction Matrix element [2][0]
+    CV_CAP_PROP_XI_CC_MATRIX_21                                 = 488, // Color Correction Matrix element [2][1]
+    CV_CAP_PROP_XI_CC_MATRIX_22                                 = 489, // Color Correction Matrix element [2][2]
+    CV_CAP_PROP_XI_CC_MATRIX_23                                 = 490, // Color Correction Matrix element [2][3]
+    CV_CAP_PROP_XI_CC_MATRIX_30                                 = 491, // Color Correction Matrix element [3][0]
+    CV_CAP_PROP_XI_CC_MATRIX_31                                 = 492, // Color Correction Matrix element [3][1]
+    CV_CAP_PROP_XI_CC_MATRIX_32                                 = 493, // Color Correction Matrix element [3][2]
+    CV_CAP_PROP_XI_CC_MATRIX_33                                 = 494, // Color Correction Matrix element [3][3]
+    CV_CAP_PROP_XI_DEFAULT_CC_MATRIX                            = 495, // Set default Color Correction Matrix
+    CV_CAP_PROP_XI_TRG_SELECTOR                                 = 498, // Selects the type of trigger.
+    CV_CAP_PROP_XI_ACQ_FRAME_BURST_COUNT                        = 499, // Sets number of frames acquired by burst. This burst is used only if trigger is set to FrameBurstStart
+    CV_CAP_PROP_XI_DEBOUNCE_EN                                  = 507, // Enable/Disable debounce to selected GPI
+    CV_CAP_PROP_XI_DEBOUNCE_T0                                  = 508, // Debounce time (x * 10us)
+    CV_CAP_PROP_XI_DEBOUNCE_T1                                  = 509, // Debounce time (x * 10us)
+    CV_CAP_PROP_XI_DEBOUNCE_POL                                 = 510, // Debounce polarity (pol = 1 t0 - falling edge, t1 - rising edge)
+    CV_CAP_PROP_XI_LENS_MODE                                    = 511, // Status of lens control interface. This shall be set to XI_ON before any Lens operations.
+    CV_CAP_PROP_XI_LENS_APERTURE_VALUE                          = 512, // Current lens aperture value in stops. Examples: 2.8, 4, 5.6, 8, 11
+    CV_CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE                    = 513, // Lens current focus movement value to be used by XI_PRM_LENS_FOCUS_MOVE in motor steps.
+    CV_CAP_PROP_XI_LENS_FOCUS_MOVE                              = 514, // Moves lens focus motor by steps set in XI_PRM_LENS_FOCUS_MOVEMENT_VALUE.
+    CV_CAP_PROP_XI_LENS_FOCUS_DISTANCE                          = 515, // Lens focus distance in cm.
+    CV_CAP_PROP_XI_LENS_FOCAL_LENGTH                            = 516, // Lens focal distance in mm.
+    CV_CAP_PROP_XI_LENS_FEATURE_SELECTOR                        = 517, // Selects the current feature which is accessible by XI_PRM_LENS_FEATURE.
+    CV_CAP_PROP_XI_LENS_FEATURE                                 = 518, // Allows access to lens feature value currently selected by XI_PRM_LENS_FEATURE_SELECTOR.
+    CV_CAP_PROP_XI_DEVICE_MODEL_ID                              = 521, // Return device model id
+    CV_CAP_PROP_XI_DEVICE_SN                                    = 522, // Return device serial number
+    CV_CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA                = 529, // The alpha channel of RGB32 output image format.
+    CV_CAP_PROP_XI_IMAGE_PAYLOAD_SIZE                           = 530, // Buffer size in bytes sufficient for output image returned by xiGetImage
+    CV_CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT                       = 531, // Current format of pixels on transport layer.
+    CV_CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ                         = 532, // Sensor clock frequency in Hz.
+    CV_CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX                      = 533, // Sensor clock frequency index. Sensor with selected frequencies have possibility to set the frequency only by this index.
+    CV_CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT                  = 534, // Number of output channels from sensor used for data transfer.
+    CV_CAP_PROP_XI_FRAMERATE                                    = 535, // Define framerate in Hz
+    CV_CAP_PROP_XI_COUNTER_SELECTOR                             = 536, // Select counter
+    CV_CAP_PROP_XI_COUNTER_VALUE                                = 537, // Counter status
+    CV_CAP_PROP_XI_ACQ_TIMING_MODE                              = 538, // Type of sensor frames timing.
+    CV_CAP_PROP_XI_AVAILABLE_BANDWIDTH                          = 539, // Calculate and return available interface bandwidth(int Megabits)
+    CV_CAP_PROP_XI_BUFFER_POLICY                                = 540, // Data move policy
+    CV_CAP_PROP_XI_LUT_EN                                       = 541, // Activates LUT.
+    CV_CAP_PROP_XI_LUT_INDEX                                    = 542, // Control the index (offset) of the coefficient to access in the LUT.
+    CV_CAP_PROP_XI_LUT_VALUE                                    = 543, // Value at entry LUTIndex of the LUT
+    CV_CAP_PROP_XI_TRG_DELAY                                    = 544, // Specifies the delay in microseconds (us) to apply after the trigger reception before activating it.
+    CV_CAP_PROP_XI_TS_RST_MODE                                  = 545, // Defines how time stamp reset engine will be armed
+    CV_CAP_PROP_XI_TS_RST_SOURCE                                = 546, // Defines which source will be used for timestamp reset. Writing this parameter will trigger settings of engine (arming)
+    CV_CAP_PROP_XI_IS_DEVICE_EXIST                              = 547, // Returns 1 if camera connected and works properly.
+    CV_CAP_PROP_XI_ACQ_BUFFER_SIZE                              = 548, // Acquisition buffer size in buffer_size_unit. Default bytes.
+    CV_CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT                         = 549, // Acquisition buffer size unit in bytes. Default 1. E.g. Value 1024 means that buffer_size is in KiBytes
+    CV_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE                    = 550, // Acquisition transport buffer size in bytes
+    CV_CAP_PROP_XI_BUFFERS_QUEUE_SIZE                           = 551, // Queue of field/frame buffers
+    CV_CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT                  = 552, // Number of buffers to commit to low level
+    CV_CAP_PROP_XI_RECENT_FRAME                                 = 553, // GetImage returns most recent frame
+    CV_CAP_PROP_XI_DEVICE_RESET                                 = 554, // Resets the camera to default state.
+    CV_CAP_PROP_XI_COLUMN_FPN_CORRECTION                        = 555, // Correction of column FPN
+    CV_CAP_PROP_XI_SENSOR_MODE                                  = 558, // Current sensor mode. Allows to select sensor mode by one integer. Setting of this parameter affects: image dimensions and downsampling.
+    CV_CAP_PROP_XI_HDR                                          = 559, // Enable High Dynamic Range feature.
+    CV_CAP_PROP_XI_HDR_KNEEPOINT_COUNT                          = 560, // The number of kneepoints in the PWLR.
+    CV_CAP_PROP_XI_HDR_T1                                       = 561, // position of first kneepoint(in % of XI_PRM_EXPOSURE)
+    CV_CAP_PROP_XI_HDR_T2                                       = 562, // position of second kneepoint (in % of XI_PRM_EXPOSURE)
+    CV_CAP_PROP_XI_KNEEPOINT1                                   = 563, // value of first kneepoint (% of sensor saturation)
+    CV_CAP_PROP_XI_KNEEPOINT2                                   = 564, // value of second kneepoint (% of sensor saturation)
+    CV_CAP_PROP_XI_IMAGE_BLACK_LEVEL                            = 565, // Last image black level counts. Can be used for Offline processing to recall it.
+    CV_CAP_PROP_XI_HW_REVISION                                  = 571, // Returns hardware revision number.
+    CV_CAP_PROP_XI_DEBUG_LEVEL                                  = 572, // Set debug level
+    CV_CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION                   = 573, // Automatic bandwidth calculation,
+    CV_CAP_PROP_XI_FREE_FFS_SIZE                                = 581, // Size of free camera FFS.
+    CV_CAP_PROP_XI_USED_FFS_SIZE                                = 582, // Size of used camera FFS.
+    CV_CAP_PROP_XI_FFS_ACCESS_KEY                               = 583, // Setting of key enables file operations on some cameras.
+    CV_CAP_PROP_XI_SENSOR_FEATURE_SELECTOR                      = 585, // Selects the current feature which is accessible by XI_PRM_SENSOR_FEATURE_VALUE.
+    CV_CAP_PROP_XI_SENSOR_FEATURE_VALUE                         = 586, // Allows access to sensor feature value currently selected by XI_PRM_SENSOR_FEATURE_SELECTOR.
+
+    // Properties for Android cameras
+    CV_CAP_PROP_ANDROID_FLASH_MODE = 8001,
+    CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002,
+    CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003,
+    CV_CAP_PROP_ANDROID_ANTIBANDING = 8004,
+    CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005,
+    CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006,
+    CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007,
+    CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008,
+    CV_CAP_PROP_ANDROID_EXPOSE_LOCK = 8009,
+    CV_CAP_PROP_ANDROID_WHITEBALANCE_LOCK = 8010,
+
+    // Properties of cameras available through AVFOUNDATION interface
+    CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001,
+    CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002,
+    CV_CAP_PROP_IOS_DEVICE_FLASH = 9003,
+    CV_CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004,
+    CV_CAP_PROP_IOS_DEVICE_TORCH = 9005,
+
+    // Properties of cameras available through Smartek Giganetix Ethernet Vision interface
+    /* --- Vladimir Litvinenko (litvinenko.vladimir@gmail.com) --- */
+    CV_CAP_PROP_GIGA_FRAME_OFFSET_X = 10001,
+    CV_CAP_PROP_GIGA_FRAME_OFFSET_Y = 10002,
+    CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX = 10003,
+    CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX = 10004,
+    CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH = 10005,
+    CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH = 10006,
+
+    CV_CAP_PROP_INTELPERC_PROFILE_COUNT               = 11001,
+    CV_CAP_PROP_INTELPERC_PROFILE_IDX                 = 11002,
+    CV_CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE  = 11003,
+    CV_CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE      = 11004,
+    CV_CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD  = 11005,
+    CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ     = 11006,
+    CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT     = 11007,
+
+    // Intel PerC streams
+    CV_CAP_INTELPERC_DEPTH_GENERATOR = 1 << 29,
+    CV_CAP_INTELPERC_IMAGE_GENERATOR = 1 << 28,
+    CV_CAP_INTELPERC_GENERATORS_MASK = CV_CAP_INTELPERC_DEPTH_GENERATOR + CV_CAP_INTELPERC_IMAGE_GENERATOR
+};
+
+// Generic camera output modes.
+// Currently, these are supported through the libv4l interface only.
+enum
+{
+    CV_CAP_MODE_BGR  = 0, // BGR24 (default)
+    CV_CAP_MODE_RGB  = 1, // RGB24
+    CV_CAP_MODE_GRAY = 2, // Y8
+    CV_CAP_MODE_YUYV = 3  // YUYV
+};
+
+enum
+{
+    // Data given from depth generator.
+    CV_CAP_OPENNI_DEPTH_MAP                 = 0, // Depth values in mm (CV_16UC1)
+    CV_CAP_OPENNI_POINT_CLOUD_MAP           = 1, // XYZ in meters (CV_32FC3)
+    CV_CAP_OPENNI_DISPARITY_MAP             = 2, // Disparity in pixels (CV_8UC1)
+    CV_CAP_OPENNI_DISPARITY_MAP_32F         = 3, // Disparity in pixels (CV_32FC1)
+    CV_CAP_OPENNI_VALID_DEPTH_MASK          = 4, // CV_8UC1
+
+    // Data given from RGB image generator.
+    CV_CAP_OPENNI_BGR_IMAGE                 = 5,
+    CV_CAP_OPENNI_GRAY_IMAGE                = 6
+};
+
+// Supported output modes of OpenNI image generator
+enum
+{
+    CV_CAP_OPENNI_VGA_30HZ     = 0,
+    CV_CAP_OPENNI_SXGA_15HZ    = 1,
+    CV_CAP_OPENNI_SXGA_30HZ    = 2,
+    CV_CAP_OPENNI_QVGA_30HZ    = 3,
+    CV_CAP_OPENNI_QVGA_60HZ    = 4
+};
+
+enum
+{
+    CV_CAP_INTELPERC_DEPTH_MAP              = 0, // Each pixel is a 16-bit integer. The value indicates the distance from an object to the camera's XY plane or the Cartesian depth.
+    CV_CAP_INTELPERC_UVDEPTH_MAP            = 1, // Each pixel contains two 32-bit floating point values in the range of 0-1, representing the mapping of depth coordinates to the color coordinates.
+    CV_CAP_INTELPERC_IR_MAP                 = 2, // Each pixel is a 16-bit integer. The value indicates the intensity of the reflected laser beam.
+    CV_CAP_INTELPERC_IMAGE                  = 3
+};
+
+// gPhoto2 properties, if propertyId is less than 0 then work on widget with that __additive inversed__ camera setting ID
+// Get IDs by using CAP_PROP_GPHOTO2_WIDGET_ENUMERATE.
+// @see CvCaptureCAM_GPHOTO2 for more info
+enum
+{
+    CV_CAP_PROP_GPHOTO2_PREVIEW           = 17001, // Capture only preview from liveview mode.
+    CV_CAP_PROP_GPHOTO2_WIDGET_ENUMERATE  = 17002, // Readonly, returns (const char *).
+    CV_CAP_PROP_GPHOTO2_RELOAD_CONFIG     = 17003, // Trigger, only by set. Reload camera settings.
+    CV_CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE  = 17004, // Reload all settings on set.
+    CV_CAP_PROP_GPHOTO2_COLLECT_MSGS      = 17005, // Collect messages with details.
+    CV_CAP_PROP_GPHOTO2_FLUSH_MSGS        = 17006, // Readonly, returns (const char *).
+    CV_CAP_PROP_SPEED                     = 17007, // Exposure speed. Can be readonly, depends on camera program.
+    CV_CAP_PROP_APERTURE                  = 17008, // Aperture. Can be readonly, depends on camera program.
+    CV_CAP_PROP_EXPOSUREPROGRAM           = 17009, // Camera exposure program.
+    CV_CAP_PROP_VIEWFINDER                = 17010  // Enter liveview mode.
+};
+
+/* retrieve or set capture properties */
+CVAPI(double) cvGetCaptureProperty( CvCapture* capture, int property_id );
+CVAPI(int)    cvSetCaptureProperty( CvCapture* capture, int property_id, double value );
+
+// Return the type of the capturer (eg, CV_CAP_V4W, CV_CAP_UNICAP), which is unknown if created with CV_CAP_ANY
+CVAPI(int)    cvGetCaptureDomain( CvCapture* capture);
+
+/* "black box" video file writer structure */
+typedef struct CvVideoWriter CvVideoWriter;
+
+#define CV_FOURCC_MACRO(c1, c2, c3, c4) (((c1) & 255) + (((c2) & 255) << 8) + (((c3) & 255) << 16) + (((c4) & 255) << 24))
+
+CV_INLINE int CV_FOURCC(char c1, char c2, char c3, char c4)
+{
+    return CV_FOURCC_MACRO(c1, c2, c3, c4);
+}
+
+#define CV_FOURCC_PROMPT -1  /* Open Codec Selection Dialog (Windows only) */
+#define CV_FOURCC_DEFAULT CV_FOURCC('I', 'Y', 'U', 'V') /* Use default codec for specified filename (Linux only) */
+
+/* initialize video file writer */
+CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc,
+                                           double fps, CvSize frame_size,
+                                           int is_color CV_DEFAULT(1));
+
+/* write frame to video file */
+CVAPI(int) cvWriteFrame( CvVideoWriter* writer, const IplImage* image );
+
+/* close video file writer */
+CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer );
+
+/****************************************************************************************\
+*                              Obsolete functions/synonyms                               *
+\****************************************************************************************/
+
+#define cvCaptureFromFile cvCreateFileCapture
+#define cvCaptureFromCAM cvCreateCameraCapture
+#define cvCaptureFromAVI cvCaptureFromFile
+#define cvCreateAVIWriter cvCreateVideoWriter
+#define cvWriteToAVI cvWriteFrame
+
+/** @} videoio_c */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__OPENCV_VIDEOIO_H__
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab.hpp
new file mode 100644
index 0000000..17b061f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab.hpp
@@ -0,0 +1,81 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_HPP__
+#define __OPENCV_VIDEOSTAB_HPP__
+
+/**
+  @defgroup videostab Video Stabilization
+
+The video stabilization module contains a set of functions and classes that can be used to solve the
+problem of video stabilization. There are a few methods implemented, most of them are descibed in
+the papers @cite OF06 and @cite G11 . However, there are some extensions and deviations from the orginal
+paper methods.
+
+### References
+
+ 1. "Full-Frame Video Stabilization with Motion Inpainting"
+     Yasuyuki Matsushita, Eyal Ofek, Weina Ge, Xiaoou Tang, Senior Member, and Heung-Yeung Shum
+ 2. "Auto-Directed Video Stabilization with Robust L1 Optimal Camera Paths"
+     Matthias Grundmann, Vivek Kwatra, Irfan Essa
+
+     @{
+         @defgroup videostab_motion Global Motion Estimation
+
+The video stabilization module contains a set of functions and classes for global motion estimation
+between point clouds or between images. In the last case features are extracted and matched
+internally. For the sake of convenience the motion estimation functions are wrapped into classes.
+Both the functions and the classes are available.
+
+         @defgroup videostab_marching Fast Marching Method
+
+The Fast Marching Method @cite Telea04 is used in of the video stabilization routines to do motion and
+color inpainting. The method is implemented is a flexible way and it's made public for other users.
+
+     @}
+
+*/
+
+#include "opencv2/videostab/stabilizer.hpp"
+#include "opencv2/videostab/ring_buffer.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp
new file mode 100644
index 0000000..8028c1d
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/deblurring.hpp
@@ -0,0 +1,116 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_DEBLURRING_HPP__
+#define __OPENCV_VIDEOSTAB_DEBLURRING_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+CV_EXPORTS float calcBlurriness(const Mat &frame);
+
+class CV_EXPORTS DeblurerBase
+{
+public:
+    DeblurerBase() : radius_(0), frames_(0), motions_(0), blurrinessRates_(0) {}
+
+    virtual ~DeblurerBase() {}
+
+    virtual void setRadius(int val) { radius_ = val; }
+    virtual int radius() const { return radius_; }
+
+    virtual void deblur(int idx, Mat &frame) = 0;
+
+
+    // data from stabilizer
+
+    virtual void setFrames(const std::vector<Mat> &val) { frames_ = &val; }
+    virtual const std::vector<Mat>& frames() const { return *frames_; }
+
+    virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+    virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+    virtual void setBlurrinessRates(const std::vector<float> &val) { blurrinessRates_ = &val; }
+    virtual const std::vector<float>& blurrinessRates() const { return *blurrinessRates_; }
+
+protected:
+    int radius_;
+    const std::vector<Mat> *frames_;
+    const std::vector<Mat> *motions_;
+    const std::vector<float> *blurrinessRates_;
+};
+
+class CV_EXPORTS NullDeblurer : public DeblurerBase
+{
+public:
+    virtual void deblur(int /*idx*/, Mat &/*frame*/) {}
+};
+
+class CV_EXPORTS WeightingDeblurer : public DeblurerBase
+{
+public:
+    WeightingDeblurer();
+
+    void setSensitivity(float val) { sensitivity_ = val; }
+    float sensitivity() const { return sensitivity_; }
+
+    virtual void deblur(int idx, Mat &frame);
+
+private:
+    float sensitivity_;
+    Mat_<float> bSum_, gSum_, rSum_, wSum_;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp
new file mode 100644
index 0000000..c0c7985
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching.hpp
@@ -0,0 +1,121 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_FAST_MARCHING_HPP__
+#define __OPENCV_VIDEOSTAB_FAST_MARCHING_HPP__
+
+#include <cmath>
+#include <queue>
+#include <algorithm>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_marching
+//! @{
+
+/** @brief Describes the Fast Marching Method implementation.
+
+  See http://iwi.eldoc.ub.rug.nl/FILES/root/2004/JGraphToolsTelea/2004JGraphToolsTelea.pdf
+ */
+class CV_EXPORTS FastMarchingMethod
+{
+public:
+    FastMarchingMethod() : inf_(1e6f) {}
+
+    /** @brief Template method that runs the Fast Marching Method.
+
+    @param mask Image mask. 0 value indicates that the pixel value must be inpainted, 255 indicates
+    that the pixel value is known, other values aren't acceptable.
+    @param inpaint Inpainting functor that overloads void operator ()(int x, int y).
+    @return Inpainting functor.
+     */
+    template <typename Inpaint>
+    Inpaint run(const Mat &mask, Inpaint inpaint);
+
+    /**
+    @return Distance map that's created during working of the method.
+    */
+    Mat distanceMap() const { return dist_; }
+
+private:
+    enum { INSIDE = 0, BAND = 1, KNOWN = 255 };
+
+    struct DXY
+    {
+        float dist;
+        int x, y;
+
+        DXY() : dist(0), x(0), y(0) {}
+        DXY(float _dist, int _x, int _y) : dist(_dist), x(_x), y(_y) {}
+        bool operator <(const DXY &dxy) const { return dist < dxy.dist; }
+    };
+
+    float solve(int x1, int y1, int x2, int y2) const;
+    int& indexOf(const DXY &dxy) { return index_(dxy.y, dxy.x); }
+
+    void heapUp(int idx);
+    void heapDown(int idx);
+    void heapAdd(const DXY &dxy);
+    void heapRemoveMin();
+
+    float inf_;
+
+    cv::Mat_<uchar> flag_; // flag map
+    cv::Mat_<float> dist_; // distance map
+
+    cv::Mat_<int> index_; // index of point in the narrow band
+    std::vector<DXY> narrowBand_; // narrow band heap
+    int size_; // narrow band size
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#include "fast_marching_inl.hpp"
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp
new file mode 100644
index 0000000..6388e69
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/fast_marching_inl.hpp
@@ -0,0 +1,165 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_FAST_MARCHING_INL_HPP__
+#define __OPENCV_VIDEOSTAB_FAST_MARCHING_INL_HPP__
+
+#include "opencv2/videostab/fast_marching.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+template <typename Inpaint>
+Inpaint FastMarchingMethod::run(const cv::Mat &mask, Inpaint inpaint)
+{
+    using namespace cv;
+
+    CV_Assert(mask.type() == CV_8U);
+
+    static const int lut[4][2] = {{-1,0}, {0,-1}, {1,0}, {0,1}};
+
+    mask.copyTo(flag_);
+    flag_.create(mask.size());
+    dist_.create(mask.size());
+    index_.create(mask.size());
+    narrowBand_.clear();
+    size_ = 0;
+
+    // init
+    for (int y = 0; y < flag_.rows; ++y)
+    {
+        for (int x = 0; x < flag_.cols; ++x)
+        {
+            if (flag_(y,x) == KNOWN)
+                dist_(y,x) = 0.f;
+            else
+            {
+                int n = 0;
+                int nunknown = 0;
+
+                for (int i = 0; i < 4; ++i)
+                {
+                    int xn = x + lut[i][0];
+                    int yn = y + lut[i][1];
+
+                    if (xn >= 0 && xn < flag_.cols && yn >= 0 && yn < flag_.rows)
+                    {
+                        n++;
+                        if (flag_(yn,xn) != KNOWN)
+                            nunknown++;
+                    }
+                }
+
+                if (n>0 && nunknown == n)
+                {
+                    dist_(y,x) = inf_;
+                    flag_(y,x) = INSIDE;
+                }
+                else
+                {
+                    dist_(y,x) = 0.f;
+                    flag_(y,x) = BAND;
+                    inpaint(x, y);
+
+                    narrowBand_.push_back(DXY(0.f,x,y));
+                    index_(y,x) = size_++;
+                }
+            }
+        }
+    }
+
+    // make heap
+    for (int i = size_/2-1; i >= 0; --i)
+        heapDown(i);
+
+    // main cycle
+    while (size_ > 0)
+    {
+        int x = narrowBand_[0].x;
+        int y = narrowBand_[0].y;
+        heapRemoveMin();
+
+        flag_(y,x) = KNOWN;
+        for (int n = 0; n < 4; ++n)
+        {
+            int xn = x + lut[n][0];
+            int yn = y + lut[n][1];
+
+            if (xn >= 0 && xn < flag_.cols && yn >= 0 && yn < flag_.rows && flag_(yn,xn) != KNOWN)
+            {
+                dist_(yn,xn) = std::min(std::min(solve(xn-1, yn, xn, yn-1), solve(xn+1, yn, xn, yn-1)),
+                                        std::min(solve(xn-1, yn, xn, yn+1), solve(xn+1, yn, xn, yn+1)));
+
+                if (flag_(yn,xn) == INSIDE)
+                {
+                    flag_(yn,xn) = BAND;
+                    inpaint(xn, yn);
+                    heapAdd(DXY(dist_(yn,xn),xn,yn));
+                }
+                else
+                {
+                    int i = index_(yn,xn);
+                    if (dist_(yn,xn) < narrowBand_[i].dist)
+                    {
+                        narrowBand_[i].dist = dist_(yn,xn);
+                        heapUp(i);
+                    }
+                    // works better if it's commented out
+                    /*else if (dist(yn,xn) > narrowBand[i].dist)
+                    {
+                        narrowBand[i].dist = dist(yn,xn);
+                        heapDown(i);
+                    }*/
+                }
+            }
+        }
+    }
+
+    return inpaint;
+}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp
new file mode 100644
index 0000000..612fbdb
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/frame_source.hpp
@@ -0,0 +1,94 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP__
+#define __OPENCV_VIDEOSTAB_FRAME_SOURCE_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS IFrameSource
+{
+public:
+    virtual ~IFrameSource() {}
+    virtual void reset() = 0;
+    virtual Mat nextFrame() = 0;
+};
+
+class CV_EXPORTS NullFrameSource : public IFrameSource
+{
+public:
+    virtual void reset() {}
+    virtual Mat nextFrame() { return Mat(); }
+};
+
+class CV_EXPORTS VideoFileSource : public IFrameSource
+{
+public:
+    VideoFileSource(const String &path, bool volatileFrame = false);
+
+    virtual void reset();
+    virtual Mat nextFrame();
+
+    int width();
+    int height();
+    int count();
+    double fps();
+
+private:
+    Ptr<IFrameSource> impl;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp
new file mode 100644
index 0000000..5d51e42
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/global_motion.hpp
@@ -0,0 +1,299 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_GLOBAL_MOTION_HPP__
+#define __OPENCV_VIDEOSTAB_GLOBAL_MOTION_HPP__
+
+#include <vector>
+#include <fstream>
+#include "opencv2/core.hpp"
+#include "opencv2/features2d.hpp"
+#include "opencv2/opencv_modules.hpp"
+#include "opencv2/videostab/optical_flow.hpp"
+#include "opencv2/videostab/motion_core.hpp"
+#include "opencv2/videostab/outlier_rejection.hpp"
+
+#ifdef HAVE_OPENCV_CUDAIMGPROC
+#  include "opencv2/cudaimgproc.hpp"
+#endif
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+/** @brief Estimates best global motion between two 2D point clouds in the least-squares sense.
+
+@note Works in-place and changes input point arrays.
+
+@param points0 Source set of 2D points (32F).
+@param points1 Destination set of 2D points (32F).
+@param model Motion model (up to MM_AFFINE).
+@param rmse Final root-mean-square error.
+@return 3x3 2D transformation matrix (32F).
+ */
+CV_EXPORTS Mat estimateGlobalMotionLeastSquares(
+        InputOutputArray points0, InputOutputArray points1, int model = MM_AFFINE,
+        float *rmse = 0);
+
+/** @brief Estimates best global motion between two 2D point clouds robustly (using RANSAC method).
+
+@param points0 Source set of 2D points (32F).
+@param points1 Destination set of 2D points (32F).
+@param model Motion model. See cv::videostab::MotionModel.
+@param params RANSAC method parameters. See videostab::RansacParams.
+@param rmse Final root-mean-square error.
+@param ninliers Final number of inliers.
+ */
+CV_EXPORTS Mat estimateGlobalMotionRansac(
+        InputArray points0, InputArray points1, int model = MM_AFFINE,
+        const RansacParams &params = RansacParams::default2dMotion(MM_AFFINE),
+        float *rmse = 0, int *ninliers = 0);
+
+/** @brief Base class for all global motion estimation methods.
+ */
+class CV_EXPORTS MotionEstimatorBase
+{
+public:
+    virtual ~MotionEstimatorBase() {}
+
+    /** @brief Sets motion model.
+
+    @param val Motion model. See cv::videostab::MotionModel.
+     */
+    virtual void setMotionModel(MotionModel val) { motionModel_ = val; }
+
+    /**
+    @return Motion model. See cv::videostab::MotionModel.
+    */
+    virtual MotionModel motionModel() const { return motionModel_; }
+
+    /** @brief Estimates global motion between two 2D point clouds.
+
+    @param points0 Source set of 2D points (32F).
+    @param points1 Destination set of 2D points (32F).
+    @param ok Indicates whether motion was estimated successfully.
+    @return 3x3 2D transformation matrix (32F).
+     */
+    virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0) = 0;
+
+protected:
+    MotionEstimatorBase(MotionModel model) { setMotionModel(model); }
+
+private:
+    MotionModel motionModel_;
+};
+
+/** @brief Describes a robust RANSAC-based global 2D motion estimation method which minimizes L2 error.
+ */
+class CV_EXPORTS MotionEstimatorRansacL2 : public MotionEstimatorBase
+{
+public:
+    MotionEstimatorRansacL2(MotionModel model = MM_AFFINE);
+
+    void setRansacParams(const RansacParams &val) { ransacParams_ = val; }
+    RansacParams ransacParams() const { return ransacParams_; }
+
+    void setMinInlierRatio(float val) { minInlierRatio_ = val; }
+    float minInlierRatio() const { return minInlierRatio_; }
+
+    virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0);
+
+private:
+    RansacParams ransacParams_;
+    float minInlierRatio_;
+};
+
+/** @brief Describes a global 2D motion estimation method which minimizes L1 error.
+
+@note To be able to use this method you must build OpenCV with CLP library support. :
+ */
+class CV_EXPORTS MotionEstimatorL1 : public MotionEstimatorBase
+{
+public:
+    MotionEstimatorL1(MotionModel model = MM_AFFINE);
+
+    virtual Mat estimate(InputArray points0, InputArray points1, bool *ok = 0);
+
+private:
+    std::vector<double> obj_, collb_, colub_;
+    std::vector<double> elems_, rowlb_, rowub_;
+    std::vector<int> rows_, cols_;
+
+    void set(int row, int col, double coef)
+    {
+        rows_.push_back(row);
+        cols_.push_back(col);
+        elems_.push_back(coef);
+    }
+};
+
+/** @brief Base class for global 2D motion estimation methods which take frames as input.
+ */
+class CV_EXPORTS ImageMotionEstimatorBase
+{
+public:
+    virtual ~ImageMotionEstimatorBase() {}
+
+    virtual void setMotionModel(MotionModel val) { motionModel_ = val; }
+    virtual MotionModel motionModel() const { return motionModel_; }
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0) = 0;
+
+protected:
+    ImageMotionEstimatorBase(MotionModel model) { setMotionModel(model); }
+
+private:
+    MotionModel motionModel_;
+};
+
+class CV_EXPORTS FromFileMotionReader : public ImageMotionEstimatorBase
+{
+public:
+    FromFileMotionReader(const String &path);
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+    std::ifstream file_;
+};
+
+class CV_EXPORTS ToFileMotionWriter : public ImageMotionEstimatorBase
+{
+public:
+    ToFileMotionWriter(const String &path, Ptr<ImageMotionEstimatorBase> estimator);
+
+    virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+    virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+    std::ofstream file_;
+    Ptr<ImageMotionEstimatorBase> motionEstimator_;
+};
+
+/** @brief Describes a global 2D motion estimation method which uses keypoints detection and optical flow for
+matching.
+ */
+class CV_EXPORTS KeypointBasedMotionEstimator : public ImageMotionEstimatorBase
+{
+public:
+    KeypointBasedMotionEstimator(Ptr<MotionEstimatorBase> estimator);
+
+    virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+    virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+    void setDetector(Ptr<FeatureDetector> val) { detector_ = val; }
+    Ptr<FeatureDetector> detector() const { return detector_; }
+
+    void setOpticalFlowEstimator(Ptr<ISparseOptFlowEstimator> val) { optFlowEstimator_ = val; }
+    Ptr<ISparseOptFlowEstimator> opticalFlowEstimator() const { return optFlowEstimator_; }
+
+    void setOutlierRejector(Ptr<IOutlierRejector> val) { outlierRejector_ = val; }
+    Ptr<IOutlierRejector> outlierRejector() const { return outlierRejector_; }
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+
+private:
+    Ptr<MotionEstimatorBase> motionEstimator_;
+    Ptr<FeatureDetector> detector_;
+    Ptr<ISparseOptFlowEstimator> optFlowEstimator_;
+    Ptr<IOutlierRejector> outlierRejector_;
+
+    std::vector<uchar> status_;
+    std::vector<KeyPoint> keypointsPrev_;
+    std::vector<Point2f> pointsPrev_, points_;
+    std::vector<Point2f> pointsPrevGood_, pointsGood_;
+};
+
+#if defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW)
+
+class CV_EXPORTS KeypointBasedMotionEstimatorGpu : public ImageMotionEstimatorBase
+{
+public:
+    KeypointBasedMotionEstimatorGpu(Ptr<MotionEstimatorBase> estimator);
+
+    virtual void setMotionModel(MotionModel val) { motionEstimator_->setMotionModel(val); }
+    virtual MotionModel motionModel() const { return motionEstimator_->motionModel(); }
+
+    void setOutlierRejector(Ptr<IOutlierRejector> val) { outlierRejector_ = val; }
+    Ptr<IOutlierRejector> outlierRejector() const { return outlierRejector_; }
+
+    virtual Mat estimate(const Mat &frame0, const Mat &frame1, bool *ok = 0);
+    Mat estimate(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, bool *ok = 0);
+
+private:
+    Ptr<MotionEstimatorBase> motionEstimator_;
+    Ptr<cuda::CornersDetector> detector_;
+    SparsePyrLkOptFlowEstimatorGpu optFlowEstimator_;
+    Ptr<IOutlierRejector> outlierRejector_;
+
+    cuda::GpuMat frame0_, grayFrame0_, frame1_;
+    cuda::GpuMat pointsPrev_, points_;
+    cuda::GpuMat status_;
+
+    Mat hostPointsPrev_, hostPoints_;
+    std::vector<Point2f> hostPointsPrevTmp_, hostPointsTmp_;
+    std::vector<uchar> rejectionStatus_;
+};
+
+#endif // defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW)
+
+/** @brief Computes motion between two frames assuming that all the intermediate motions are known.
+
+@param from Source frame index.
+@param to Destination frame index.
+@param motions Pair-wise motions. motions[i] denotes motion from the frame i to the frame i+1
+@return Motion from the frame from to the frame to.
+ */
+CV_EXPORTS Mat getMotion(int from, int to, const std::vector<Mat> &motions);
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp
new file mode 100644
index 0000000..844c68c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/inpainting.hpp
@@ -0,0 +1,212 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_INPAINTINT_HPP__
+#define __OPENCV_VIDEOSTAB_INPAINTINT_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/videostab/optical_flow.hpp"
+#include "opencv2/videostab/fast_marching.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/photo.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS InpainterBase
+{
+public:
+    InpainterBase()
+        : radius_(0), motionModel_(MM_UNKNOWN), frames_(0), motions_(0),
+          stabilizedFrames_(0), stabilizationMotions_(0) {}
+
+    virtual ~InpainterBase() {}
+
+    virtual void setRadius(int val) { radius_ = val; }
+    virtual int radius() const { return radius_; }
+
+    virtual void setMotionModel(MotionModel val) { motionModel_ = val; }
+    virtual MotionModel motionModel() const { return motionModel_; }
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask) = 0;
+
+
+    // data from stabilizer
+
+    virtual void setFrames(const std::vector<Mat> &val) { frames_ = &val; }
+    virtual const std::vector<Mat>& frames() const { return *frames_; }
+
+    virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+    virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+    virtual void setStabilizedFrames(const std::vector<Mat> &val) { stabilizedFrames_ = &val; }
+    virtual const std::vector<Mat>& stabilizedFrames() const { return *stabilizedFrames_; }
+
+    virtual void setStabilizationMotions(const std::vector<Mat> &val) { stabilizationMotions_ = &val; }
+    virtual const std::vector<Mat>& stabilizationMotions() const { return *stabilizationMotions_; }
+
+protected:
+    int radius_;
+    MotionModel motionModel_;
+    const std::vector<Mat> *frames_;
+    const std::vector<Mat> *motions_;
+    const std::vector<Mat> *stabilizedFrames_;
+    const std::vector<Mat> *stabilizationMotions_;
+};
+
+class CV_EXPORTS NullInpainter : public InpainterBase
+{
+public:
+    virtual void inpaint(int /*idx*/, Mat &/*frame*/, Mat &/*mask*/) {}
+};
+
+class CV_EXPORTS InpaintingPipeline : public InpainterBase
+{
+public:
+    void pushBack(Ptr<InpainterBase> inpainter) { inpainters_.push_back(inpainter); }
+    bool empty() const { return inpainters_.empty(); }
+
+    virtual void setRadius(int val);
+    virtual void setMotionModel(MotionModel val);
+    virtual void setFrames(const std::vector<Mat> &val);
+    virtual void setMotions(const std::vector<Mat> &val);
+    virtual void setStabilizedFrames(const std::vector<Mat> &val);
+    virtual void setStabilizationMotions(const std::vector<Mat> &val);
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    std::vector<Ptr<InpainterBase> > inpainters_;
+};
+
+class CV_EXPORTS ConsistentMosaicInpainter : public InpainterBase
+{
+public:
+    ConsistentMosaicInpainter();
+
+    void setStdevThresh(float val) { stdevThresh_ = val; }
+    float stdevThresh() const { return stdevThresh_; }
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    float stdevThresh_;
+};
+
+class CV_EXPORTS MotionInpainter : public InpainterBase
+{
+public:
+    MotionInpainter();
+
+    void setOptFlowEstimator(Ptr<IDenseOptFlowEstimator> val) { optFlowEstimator_ = val; }
+    Ptr<IDenseOptFlowEstimator> optFlowEstimator() const { return optFlowEstimator_; }
+
+    void setFlowErrorThreshold(float val) { flowErrorThreshold_ = val; }
+    float flowErrorThreshold() const { return flowErrorThreshold_; }
+
+    void setDistThreshold(float val) { distThresh_ = val; }
+    float distThresh() const { return distThresh_; }
+
+    void setBorderMode(int val) { borderMode_ = val; }
+    int borderMode() const { return borderMode_; }
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    FastMarchingMethod fmm_;
+    Ptr<IDenseOptFlowEstimator> optFlowEstimator_;
+    float flowErrorThreshold_;
+    float distThresh_;
+    int borderMode_;
+
+    Mat frame1_, transformedFrame1_;
+    Mat_<uchar> grayFrame_, transformedGrayFrame1_;
+    Mat_<uchar> mask1_, transformedMask1_;
+    Mat_<float> flowX_, flowY_, flowErrors_;
+    Mat_<uchar> flowMask_;
+};
+
+class CV_EXPORTS ColorAverageInpainter : public InpainterBase
+{
+public:
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    FastMarchingMethod fmm_;
+};
+
+class CV_EXPORTS ColorInpainter : public InpainterBase
+{
+public:
+    ColorInpainter(int method = INPAINT_TELEA, double radius = 2.);
+
+    virtual void inpaint(int idx, Mat &frame, Mat &mask);
+
+private:
+    int method_;
+    double radius_;
+    Mat invMask_;
+};
+
+inline ColorInpainter::ColorInpainter(int _method, double _radius)
+        : method_(_method), radius_(_radius) {}
+
+CV_EXPORTS void calcFlowMask(
+        const Mat &flowX, const Mat &flowY, const Mat &errors, float maxError,
+        const Mat &mask0, const Mat &mask1, Mat &flowMask);
+
+CV_EXPORTS void completeFrameAccordingToFlow(
+        const Mat &flowMask, const Mat &flowX, const Mat &flowY, const Mat &frame1, const Mat &mask1,
+        float distThresh, Mat& frame0, Mat &mask0);
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp
new file mode 100644
index 0000000..28625ed
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/log.hpp
@@ -0,0 +1,80 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_LOG_HPP__
+#define __OPENCV_VIDEOSTAB_LOG_HPP__
+
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS ILog
+{
+public:
+    virtual ~ILog() {}
+    virtual void print(const char *format, ...) = 0;
+};
+
+class CV_EXPORTS NullLog : public ILog
+{
+public:
+    virtual void print(const char * /*format*/, ...) {}
+};
+
+class CV_EXPORTS LogToStdout : public ILog
+{
+public:
+    virtual void print(const char *format, ...);
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp
new file mode 100644
index 0000000..17448e3
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/motion_core.hpp
@@ -0,0 +1,129 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_MOTION_CORE_HPP__
+#define __OPENCV_VIDEOSTAB_MOTION_CORE_HPP__
+
+#include <cmath>
+#include "opencv2/core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+/** @brief Describes motion model between two point clouds.
+ */
+enum MotionModel
+{
+    MM_TRANSLATION = 0,
+    MM_TRANSLATION_AND_SCALE = 1,
+    MM_ROTATION = 2,
+    MM_RIGID = 3,
+    MM_SIMILARITY = 4,
+    MM_AFFINE = 5,
+    MM_HOMOGRAPHY = 6,
+    MM_UNKNOWN = 7
+};
+
+/** @brief Describes RANSAC method parameters.
+ */
+struct CV_EXPORTS RansacParams
+{
+    int size; //!< subset size
+    float thresh; //!< max error to classify as inlier
+    float eps; //!< max outliers ratio
+    float prob; //!< probability of success
+
+    RansacParams() : size(0), thresh(0), eps(0), prob(0) {}
+    /** @brief Constructor
+    @param size Subset size.
+    @param thresh Maximum re-projection error value to classify as inlier.
+    @param eps Maximum ratio of incorrect correspondences.
+    @param prob Required success probability.
+     */
+    RansacParams(int size, float thresh, float eps, float prob);
+
+    /**
+    @return Number of iterations that'll be performed by RANSAC method.
+    */
+    int niters() const
+    {
+        return static_cast<int>(
+                std::ceil(std::log(1 - prob) / std::log(1 - std::pow(1 - eps, size))));
+    }
+
+    /**
+    @param model Motion model. See cv::videostab::MotionModel.
+    @return Default RANSAC method parameters for the given motion model.
+    */
+    static RansacParams default2dMotion(MotionModel model)
+    {
+        CV_Assert(model < MM_UNKNOWN);
+        if (model == MM_TRANSLATION)
+            return RansacParams(1, 0.5f, 0.5f, 0.99f);
+        if (model == MM_TRANSLATION_AND_SCALE)
+            return RansacParams(2, 0.5f, 0.5f, 0.99f);
+        if (model == MM_ROTATION)
+            return RansacParams(1, 0.5f, 0.5f, 0.99f);
+        if (model == MM_RIGID)
+            return RansacParams(2, 0.5f, 0.5f, 0.99f);
+        if (model == MM_SIMILARITY)
+            return RansacParams(2, 0.5f, 0.5f, 0.99f);
+        if (model == MM_AFFINE)
+            return RansacParams(3, 0.5f, 0.5f, 0.99f);
+        return RansacParams(4, 0.5f, 0.5f, 0.99f);
+    }
+};
+
+inline RansacParams::RansacParams(int _size, float _thresh, float _eps, float _prob)
+    : size(_size), thresh(_thresh), eps(_eps), prob(_prob) {}
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp
new file mode 100644
index 0000000..3bdbfbd
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/motion_stabilizing.hpp
@@ -0,0 +1,174 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_MOTION_STABILIZING_HPP__
+#define __OPENCV_VIDEOSTAB_MOTION_STABILIZING_HPP__
+
+#include <vector>
+#include <utility>
+#include "opencv2/core.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab_motion
+//! @{
+
+class CV_EXPORTS IMotionStabilizer
+{
+public:
+    virtual ~IMotionStabilizer() {}
+
+    //! assumes that [0, size-1) is in or equals to [range.first, range.second)
+    virtual void stabilize(
+            int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+            Mat *stabilizationMotions) = 0;
+};
+
+class CV_EXPORTS MotionStabilizationPipeline : public IMotionStabilizer
+{
+public:
+    void pushBack(Ptr<IMotionStabilizer> stabilizer) { stabilizers_.push_back(stabilizer); }
+    bool empty() const { return stabilizers_.empty(); }
+
+    virtual void stabilize(
+            int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+            Mat *stabilizationMotions);
+
+private:
+    std::vector<Ptr<IMotionStabilizer> > stabilizers_;
+};
+
+class CV_EXPORTS MotionFilterBase : public IMotionStabilizer
+{
+public:
+    virtual ~MotionFilterBase() {}
+
+    virtual Mat stabilize(
+            int idx, const std::vector<Mat> &motions, std::pair<int,int> range) = 0;
+
+    virtual void stabilize(
+            int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+            Mat *stabilizationMotions);
+};
+
+class CV_EXPORTS GaussianMotionFilter : public MotionFilterBase
+{
+public:
+    GaussianMotionFilter(int radius = 15, float stdev = -1.f);
+
+    void setParams(int radius, float stdev = -1.f);
+    int radius() const { return radius_; }
+    float stdev() const { return stdev_; }
+
+    virtual Mat stabilize(
+            int idx, const std::vector<Mat> &motions, std::pair<int,int> range);
+
+private:
+    int radius_;
+    float stdev_;
+    std::vector<float> weight_;
+};
+
+inline GaussianMotionFilter::GaussianMotionFilter(int _radius, float _stdev) { setParams(_radius, _stdev); }
+
+class CV_EXPORTS LpMotionStabilizer : public IMotionStabilizer
+{
+public:
+    LpMotionStabilizer(MotionModel model = MM_SIMILARITY);
+
+    void setMotionModel(MotionModel val) { model_ = val; }
+    MotionModel motionModel() const { return model_; }
+
+    void setFrameSize(Size val) { frameSize_ = val; }
+    Size frameSize() const { return frameSize_; }
+
+    void setTrimRatio(float val) { trimRatio_ = val; }
+    float trimRatio() const { return trimRatio_; }
+
+    void setWeight1(float val) { w1_ = val; }
+    float weight1() const { return w1_; }
+
+    void setWeight2(float val) { w2_ = val; }
+    float weight2() const { return w2_; }
+
+    void setWeight3(float val) { w3_ = val; }
+    float weight3() const { return w3_; }
+
+    void setWeight4(float val) { w4_ = val; }
+    float weight4() const { return w4_; }
+
+    virtual void stabilize(
+            int size, const std::vector<Mat> &motions, std::pair<int,int> range,
+            Mat *stabilizationMotions);
+
+private:
+    MotionModel model_;
+    Size frameSize_;
+    float trimRatio_;
+    float w1_, w2_, w3_, w4_;
+
+    std::vector<double> obj_, collb_, colub_;
+    std::vector<int> rows_, cols_;
+    std::vector<double> elems_, rowlb_, rowub_;
+
+    void set(int row, int col, double coef)
+    {
+        rows_.push_back(row);
+        cols_.push_back(col);
+        elems_.push_back(coef);
+    }
+};
+
+CV_EXPORTS Mat ensureInclusionConstraint(const Mat &M, Size size, float trimRatio);
+
+CV_EXPORTS float estimateOptimalTrimRatio(const Mat &M, Size size);
+
+//! @}
+
+} // namespace videostab
+} // namespace
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp
new file mode 100644
index 0000000..41d1953
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/optical_flow.hpp
@@ -0,0 +1,150 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
+#define __OPENCV_VIDEOSTAB_OPTICAL_FLOW_HPP__
+
+#include "opencv2/core.hpp"
+#include "opencv2/opencv_modules.hpp"
+
+#ifdef HAVE_OPENCV_CUDAOPTFLOW
+  #include "opencv2/cudaoptflow.hpp"
+#endif
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS ISparseOptFlowEstimator
+{
+public:
+    virtual ~ISparseOptFlowEstimator() {}
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+            OutputArray status, OutputArray errors) = 0;
+};
+
+class CV_EXPORTS IDenseOptFlowEstimator
+{
+public:
+    virtual ~IDenseOptFlowEstimator() {}
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
+            OutputArray errors) = 0;
+};
+
+class CV_EXPORTS PyrLkOptFlowEstimatorBase
+{
+public:
+    PyrLkOptFlowEstimatorBase() { setWinSize(Size(21, 21)); setMaxLevel(3); }
+
+    virtual void setWinSize(Size val) { winSize_ = val; }
+    virtual Size winSize() const { return winSize_; }
+
+    virtual void setMaxLevel(int val) { maxLevel_ = val; }
+    virtual int maxLevel() const { return maxLevel_; }
+    virtual ~PyrLkOptFlowEstimatorBase() {}
+
+protected:
+    Size winSize_;
+    int maxLevel_;
+};
+
+class CV_EXPORTS SparsePyrLkOptFlowEstimator
+        : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator
+{
+public:
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+            OutputArray status, OutputArray errors);
+};
+
+#ifdef HAVE_OPENCV_CUDAOPTFLOW
+
+class CV_EXPORTS SparsePyrLkOptFlowEstimatorGpu
+        : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator
+{
+public:
+    SparsePyrLkOptFlowEstimatorGpu();
+
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputArray points0, InputOutputArray points1,
+            OutputArray status, OutputArray errors);
+
+    void run(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, const cuda::GpuMat &points0, cuda::GpuMat &points1,
+             cuda::GpuMat &status, cuda::GpuMat &errors);
+
+    void run(const cuda::GpuMat &frame0, const cuda::GpuMat &frame1, const cuda::GpuMat &points0, cuda::GpuMat &points1,
+             cuda::GpuMat &status);
+
+private:
+    Ptr<cuda::SparsePyrLKOpticalFlow> optFlowEstimator_;
+    cuda::GpuMat frame0_, frame1_, points0_, points1_, status_, errors_;
+};
+
+class CV_EXPORTS DensePyrLkOptFlowEstimatorGpu
+        : public PyrLkOptFlowEstimatorBase, public IDenseOptFlowEstimator
+{
+public:
+    DensePyrLkOptFlowEstimatorGpu();
+
+    virtual void run(
+            InputArray frame0, InputArray frame1, InputOutputArray flowX, InputOutputArray flowY,
+            OutputArray errors);
+
+private:
+    Ptr<cuda::DensePyrLKOpticalFlow> optFlowEstimator_;
+    cuda::GpuMat frame0_, frame1_, flowX_, flowY_, errors_;
+};
+
+#endif
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp
new file mode 100644
index 0000000..9e40f85
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/outlier_rejection.hpp
@@ -0,0 +1,101 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_OUTLIER_REJECTION_HPP__
+#define __OPENCV_VIDEOSTAB_OUTLIER_REJECTION_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/videostab/motion_core.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS IOutlierRejector
+{
+public:
+    virtual ~IOutlierRejector() {}
+
+    virtual void process(
+            Size frameSize, InputArray points0, InputArray points1, OutputArray mask) = 0;
+};
+
+class CV_EXPORTS NullOutlierRejector : public IOutlierRejector
+{
+public:
+    virtual void process(
+            Size frameSize, InputArray points0, InputArray points1, OutputArray mask);
+};
+
+class CV_EXPORTS TranslationBasedLocalOutlierRejector : public IOutlierRejector
+{
+public:
+    TranslationBasedLocalOutlierRejector();
+
+    void setCellSize(Size val) { cellSize_ = val; }
+    Size cellSize() const { return cellSize_; }
+
+    void setRansacParams(RansacParams val) { ransacParams_ = val; }
+    RansacParams ransacParams() const { return ransacParams_; }
+
+    virtual void process(
+            Size frameSize, InputArray points0, InputArray points1, OutputArray mask);
+
+private:
+    Size cellSize_;
+    RansacParams ransacParams_;
+
+    typedef std::vector<int> Cell;
+    std::vector<Cell> grid_;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp
new file mode 100644
index 0000000..7cc3f03
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/ring_buffer.hpp
@@ -0,0 +1,72 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_RING_BUFFER_HPP__
+#define __OPENCV_VIDEOSTAB_RING_BUFFER_HPP__
+
+#include <vector>
+#include "opencv2/imgproc.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+template <typename T> inline T& at(int idx, std::vector<T> &items)
+{
+    return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
+}
+
+template <typename T> inline const T& at(int idx, const std::vector<T> &items)
+{
+    return items[cv::borderInterpolate(idx, static_cast<int>(items.size()), cv::BORDER_WRAP)];
+}
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp
new file mode 100644
index 0000000..c18d314
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/stabilizer.hpp
@@ -0,0 +1,200 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_STABILIZER_HPP__
+#define __OPENCV_VIDEOSTAB_STABILIZER_HPP__
+
+#include <vector>
+#include <ctime>
+#include "opencv2/core.hpp"
+#include "opencv2/imgproc.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/videostab/motion_stabilizing.hpp"
+#include "opencv2/videostab/frame_source.hpp"
+#include "opencv2/videostab/log.hpp"
+#include "opencv2/videostab/inpainting.hpp"
+#include "opencv2/videostab/deblurring.hpp"
+#include "opencv2/videostab/wobble_suppression.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS StabilizerBase
+{
+public:
+    virtual ~StabilizerBase() {}
+
+    void setLog(Ptr<ILog> ilog) { log_ = ilog; }
+    Ptr<ILog> log() const { return log_; }
+
+    void setRadius(int val) { radius_ = val; }
+    int radius() const { return radius_; }
+
+    void setFrameSource(Ptr<IFrameSource> val) { frameSource_ = val; }
+    Ptr<IFrameSource> frameSource() const { return frameSource_; }
+
+    void setMotionEstimator(Ptr<ImageMotionEstimatorBase> val) { motionEstimator_ = val; }
+    Ptr<ImageMotionEstimatorBase> motionEstimator() const { return motionEstimator_; }
+
+    void setDeblurer(Ptr<DeblurerBase> val) { deblurer_ = val; }
+    Ptr<DeblurerBase> deblurrer() const { return deblurer_; }
+
+    void setTrimRatio(float val) { trimRatio_ = val; }
+    float trimRatio() const { return trimRatio_; }
+
+    void setCorrectionForInclusion(bool val) { doCorrectionForInclusion_ = val; }
+    bool doCorrectionForInclusion() const { return doCorrectionForInclusion_; }
+
+    void setBorderMode(int val) { borderMode_ = val; }
+    int borderMode() const { return borderMode_; }
+
+    void setInpainter(Ptr<InpainterBase> val) { inpainter_ = val; }
+    Ptr<InpainterBase> inpainter() const { return inpainter_; }
+
+protected:
+    StabilizerBase();
+
+    void reset();
+    Mat nextStabilizedFrame();
+    bool doOneIteration();
+    virtual void setUp(const Mat &firstFrame);
+    virtual Mat estimateMotion() = 0;
+    virtual Mat estimateStabilizationMotion() = 0;
+    void stabilizeFrame();
+    virtual Mat postProcessFrame(const Mat &frame);
+    void logProcessingTime();
+
+    Ptr<ILog> log_;
+    Ptr<IFrameSource> frameSource_;
+    Ptr<ImageMotionEstimatorBase> motionEstimator_;
+    Ptr<DeblurerBase> deblurer_;
+    Ptr<InpainterBase> inpainter_;
+    int radius_;
+    float trimRatio_;
+    bool doCorrectionForInclusion_;
+    int borderMode_;
+
+    Size frameSize_;
+    Mat frameMask_;
+    int curPos_;
+    int curStabilizedPos_;
+    bool doDeblurring_;
+    Mat preProcessedFrame_;
+    bool doInpainting_;
+    Mat inpaintingMask_;
+    Mat finalFrame_;
+    std::vector<Mat> frames_;
+    std::vector<Mat> motions_; // motions_[i] is the motion from i-th to i+1-th frame
+    std::vector<float> blurrinessRates_;
+    std::vector<Mat> stabilizedFrames_;
+    std::vector<Mat> stabilizedMasks_;
+    std::vector<Mat> stabilizationMotions_;
+    clock_t processingStartTime_;
+};
+
+class CV_EXPORTS OnePassStabilizer : public StabilizerBase, public IFrameSource
+{
+public:
+    OnePassStabilizer();
+
+    void setMotionFilter(Ptr<MotionFilterBase> val) { motionFilter_ = val; }
+    Ptr<MotionFilterBase> motionFilter() const { return motionFilter_; }
+
+    virtual void reset();
+    virtual Mat nextFrame() { return nextStabilizedFrame(); }
+
+protected:
+    virtual void setUp(const Mat &firstFrame);
+    virtual Mat estimateMotion();
+    virtual Mat estimateStabilizationMotion();
+    virtual Mat postProcessFrame(const Mat &frame);
+
+    Ptr<MotionFilterBase> motionFilter_;
+};
+
+class CV_EXPORTS TwoPassStabilizer : public StabilizerBase, public IFrameSource
+{
+public:
+    TwoPassStabilizer();
+
+    void setMotionStabilizer(Ptr<IMotionStabilizer> val) { motionStabilizer_ = val; }
+    Ptr<IMotionStabilizer> motionStabilizer() const { return motionStabilizer_; }
+
+    void setWobbleSuppressor(Ptr<WobbleSuppressorBase> val) { wobbleSuppressor_ = val; }
+    Ptr<WobbleSuppressorBase> wobbleSuppressor() const { return wobbleSuppressor_; }
+
+    void setEstimateTrimRatio(bool val) { mustEstTrimRatio_ = val; }
+    bool mustEstimateTrimaRatio() const { return mustEstTrimRatio_; }
+
+    virtual void reset();
+    virtual Mat nextFrame();
+
+protected:
+    void runPrePassIfNecessary();
+
+    virtual void setUp(const Mat &firstFrame);
+    virtual Mat estimateMotion();
+    virtual Mat estimateStabilizationMotion();
+    virtual Mat postProcessFrame(const Mat &frame);
+
+    Ptr<IMotionStabilizer> motionStabilizer_;
+    Ptr<WobbleSuppressorBase> wobbleSuppressor_;
+    bool mustEstTrimRatio_;
+
+    int frameCount_;
+    bool isPrePassDone_;
+    bool doWobbleSuppression_;
+    std::vector<Mat> motions2_;
+    Mat suppressedFrame_;
+};
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp
new file mode 100644
index 0000000..3f0a943
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/videostab/wobble_suppression.hpp
@@ -0,0 +1,140 @@
+/*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-2011, 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*/
+
+#ifndef __OPENCV_VIDEOSTAB_WOBBLE_SUPPRESSION_HPP__
+#define __OPENCV_VIDEOSTAB_WOBBLE_SUPPRESSION_HPP__
+
+#include <vector>
+#include "opencv2/core.hpp"
+#include "opencv2/core/cuda.hpp"
+#include "opencv2/videostab/global_motion.hpp"
+#include "opencv2/videostab/log.hpp"
+
+namespace cv
+{
+namespace videostab
+{
+
+//! @addtogroup videostab
+//! @{
+
+class CV_EXPORTS WobbleSuppressorBase
+{
+public:
+    WobbleSuppressorBase();
+
+    virtual ~WobbleSuppressorBase() {}
+
+    void setMotionEstimator(Ptr<ImageMotionEstimatorBase> val) { motionEstimator_ = val; }
+    Ptr<ImageMotionEstimatorBase> motionEstimator() const { return motionEstimator_; }
+
+    virtual void suppress(int idx, const Mat &frame, Mat &result) = 0;
+
+
+    // data from stabilizer
+
+    virtual void setFrameCount(int val) { frameCount_ = val; }
+    virtual int frameCount() const { return frameCount_; }
+
+    virtual void setMotions(const std::vector<Mat> &val) { motions_ = &val; }
+    virtual const std::vector<Mat>& motions() const { return *motions_; }
+
+    virtual void setMotions2(const std::vector<Mat> &val) { motions2_ = &val; }
+    virtual const std::vector<Mat>& motions2() const { return *motions2_; }
+
+    virtual void setStabilizationMotions(const std::vector<Mat> &val) { stabilizationMotions_ = &val; }
+    virtual const std::vector<Mat>& stabilizationMotions() const { return *stabilizationMotions_; }
+
+protected:
+    Ptr<ImageMotionEstimatorBase> motionEstimator_;
+    int frameCount_;
+    const std::vector<Mat> *motions_;
+    const std::vector<Mat> *motions2_;
+    const std::vector<Mat> *stabilizationMotions_;
+};
+
+class CV_EXPORTS NullWobbleSuppressor : public WobbleSuppressorBase
+{
+public:
+    virtual void suppress(int idx, const Mat &frame, Mat &result);
+};
+
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressorBase : public WobbleSuppressorBase
+{
+public:
+    virtual void setPeriod(int val) { period_ = val; }
+    virtual int period() const { return period_; }
+
+protected:
+    MoreAccurateMotionWobbleSuppressorBase() { setPeriod(30); }
+
+    int period_;
+};
+
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressor : public MoreAccurateMotionWobbleSuppressorBase
+{
+public:
+    virtual void suppress(int idx, const Mat &frame, Mat &result);
+
+private:
+    Mat_<float> mapx_, mapy_;
+};
+
+#if defined(HAVE_OPENCV_CUDAWARPING)
+class CV_EXPORTS MoreAccurateMotionWobbleSuppressorGpu : public MoreAccurateMotionWobbleSuppressorBase
+{
+public:
+    void suppress(int idx, const cuda::GpuMat &frame, cuda::GpuMat &result);
+    virtual void suppress(int idx, const Mat &frame, Mat &result);
+
+private:
+    cuda::GpuMat frameDevice_, resultDevice_;
+    cuda::GpuMat mapx_, mapy_;
+};
+#endif
+
+//! @}
+
+} // namespace videostab
+} // namespace cv
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/include/opencv2/world.hpp b/Lib/OpenCV/opencv_3.1/include/opencv2/world.hpp
new file mode 100644
index 0000000..2442f2c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/include/opencv2/world.hpp
@@ -0,0 +1,58 @@
+/*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-2010, 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*/
+
+#ifndef __OPENCV_WORLD_HPP__
+#define __OPENCV_WORLD_HPP__
+
+#include "opencv2/core.hpp"
+
+#ifdef __cplusplus
+namespace cv
+{
+
+CV_EXPORTS_W bool initAll();
+
+}
+
+#endif
+
+#endif
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib
new file mode 100644
index 0000000..1557bb0
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_calib3d310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_calib3d310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_calib3d310d.lib
new file mode 100644
index 0000000..879c5cd
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_calib3d310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_core310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_core310.lib
new file mode 100644
index 0000000..de74d11
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_core310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_core310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_core310d.lib
new file mode 100644
index 0000000..f1e2a47
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_core310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_features2d310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_features2d310.lib
new file mode 100644
index 0000000..dc16896
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_features2d310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_features2d310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_features2d310d.lib
new file mode 100644
index 0000000..20d5bc8
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_features2d310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_flann310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_flann310.lib
new file mode 100644
index 0000000..319460a
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_flann310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_flann310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_flann310d.lib
new file mode 100644
index 0000000..da1c75f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_flann310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_highgui310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_highgui310.lib
new file mode 100644
index 0000000..c629b04
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_highgui310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_highgui310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_highgui310d.lib
new file mode 100644
index 0000000..14736ff
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_highgui310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib
new file mode 100644
index 0000000..ee4a374
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310d.lib
new file mode 100644
index 0000000..29a27fa
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_imgcodecs310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib
new file mode 100644
index 0000000..1d60ed2
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310d.lib
new file mode 100644
index 0000000..d3bc4af
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_imgproc310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_ml310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_ml310.lib
new file mode 100644
index 0000000..164030c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_ml310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_ml310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_ml310d.lib
new file mode 100644
index 0000000..7519f83
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_ml310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib
new file mode 100644
index 0000000..11ff06c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_objdetect310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_objdetect310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_objdetect310d.lib
new file mode 100644
index 0000000..942a34f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_objdetect310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_photo310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_photo310.lib
new file mode 100644
index 0000000..4fca666
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_photo310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_photo310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_photo310d.lib
new file mode 100644
index 0000000..0a5c27e
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_photo310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_shape310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_shape310.lib
new file mode 100644
index 0000000..f9ca7e7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_shape310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_shape310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_shape310d.lib
new file mode 100644
index 0000000..60e63bd
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_shape310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_stitching310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_stitching310.lib
new file mode 100644
index 0000000..7bc2497
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_stitching310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_stitching310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_stitching310d.lib
new file mode 100644
index 0000000..fefd0c6
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_stitching310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_superres310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_superres310.lib
new file mode 100644
index 0000000..f9c6035
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_superres310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_superres310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_superres310d.lib
new file mode 100644
index 0000000..9fad7f7
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_superres310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_ts310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_ts310.lib
new file mode 100644
index 0000000..e8894f8
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_ts310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_ts310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_ts310d.lib
new file mode 100644
index 0000000..493474f
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_ts310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_video310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_video310.lib
new file mode 100644
index 0000000..dfce359
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_video310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_video310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_video310d.lib
new file mode 100644
index 0000000..15315bf
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_video310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_videoio310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_videoio310.lib
new file mode 100644
index 0000000..5e2a3e2
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_videoio310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_videoio310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_videoio310d.lib
new file mode 100644
index 0000000..637244c
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_videoio310d.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_videostab310.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_videostab310.lib
new file mode 100644
index 0000000..c62d1f3
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_videostab310.lib
Binary files differ
diff --git a/Lib/OpenCV/opencv_3.1/lib/opencv_videostab310d.lib b/Lib/OpenCV/opencv_3.1/lib/opencv_videostab310d.lib
new file mode 100644
index 0000000..03bcdf6
--- /dev/null
+++ b/Lib/OpenCV/opencv_3.1/lib/opencv_videostab310d.lib
Binary files differ
diff --git a/Lib/SISAssem/include/ASGInspection.h b/Lib/SISAssem/include/ASGInspection.h
new file mode 100644
index 0000000..c5764a2
--- /dev/null
+++ b/Lib/SISAssem/include/ASGInspection.h
@@ -0,0 +1,43 @@
+#if !defined(__ASGINSPECTION_INCLUDED__)
+#define __ASGINSPECTION_INCLUDED__
+
+#include "AssemParam.h"
+#include "AssemDefect.h"
+
+class AFX_EXT_CLASS CASGInspection
+{
+	// Construction
+public:
+	CASGInspection();
+	virtual ~CASGInspection();
+
+public:
+	void			SetPixelBuf(int *pPixelX,int *pPixelY,short *pPixelType,short *pPixelValue,int *nPixelCnt)
+	{
+		m_pPixelX = pPixelX,m_pPixelY = pPixelY,m_pPixelType = pPixelType,m_pPixelValue = pPixelValue,m_nPixelCnt = nPixelCnt;
+	}
+	void			SetParingBuf(CDefectPair *pDefectPair,int nParingCnt)
+	{
+		m_pDefectParing = pDefectPair,m_nDefectParingCnt=nParingCnt;
+	}
+	int				GetParingCnt(){return m_nDefectParingCnt;}
+
+	void			VConvolutionConvC(CConvParam *pParam);
+
+protected:
+	BOOL			GetBufferCheck();
+	void			SetPixelData(int x, int y, int sub, int threshold);
+	BOOL			InsertPairing(int x, int y, int sub, int threshold, int graySrc, int grayRef);
+	CRITICAL_SECTION	m_csDefect;
+protected:
+	int				*m_pPixelX;
+	int				*m_pPixelY;
+	short			*m_pPixelType;
+	short			*m_pPixelValue;
+	int				*m_nPixelCnt;
+	CDefectPair		*m_pDefectParing;
+	int				m_nDefectParingCnt;
+
+};
+
+#endif
\ No newline at end of file
diff --git a/Lib/SISAssem/include/AssemDefect.h b/Lib/SISAssem/include/AssemDefect.h
new file mode 100644
index 0000000..5d59c87
--- /dev/null
+++ b/Lib/SISAssem/include/AssemDefect.h
@@ -0,0 +1,467 @@
+#pragma once
+
+enum DefectKind {DK_BM, DK_PATTERN};
+enum DefectType {DEFTYPE_BLACK = 0, DEFTYPE_WHITE, DEFTYPE_MIXED, DEFTYPE_NODEFECT, DEFTYPE_DELETE};
+enum DefectPos	{DEFPOS_NONE = 0, DEFPOS_LEFT, DEFPOS_CENTER, DEFPOS_RIGHT, CRACKPOS_EDGELINE,CRACKPOS_SPOTLINE};
+enum DefectPair	{DEFPAIR_NOTDEFINE = 0, DEFPAIR_PPAIR, DEFPAIR_MPAIR, DEFPAIR_SIDE, DEFPAIR_LARGE, DEFPAIR_UNPAIR };
+
+
+typedef		int		DIT_RESULT;
+#define		DIT_CONV_SUCCESS			0x01		// 沥惑 荐青.
+#define		DIT_CONV_CALLINGVIOLATION	0x02		// 窃荐 龋免 例瞒啊 肋给登菌促.
+#define		DIT_CONV_PARAMMODEFAIL		0x04
+#define		DIT_CONV_INVALIDPARAM		0x08		// 棵官福瘤 臼篮 窃荐 Parameter.
+#define		DIT_CONV_FRAMEOVERFLOW		0x10		// 茄 Frame俊 搬窃捞 10000 Pixel 捞惑捞促.
+#define		DIT_CONV_GLASSOVERFLOW		0x20		// 茄 Thread啊 Blob茄 搬窃捞 10000 俺 捞惑捞促.
+#define		DIT_CONV_RSLT_RECT_SMALL	0x40		// 八荤康开(Rect)啊 乔摹 3硅焊促 累促.剧规氢葛滴
+#define		DIT_CONV_USER				0x80		// Not_Defined...
+#define		DIT_CONV_RESULT_COUNT		8			// 搬苞 辆幅狼 俺荐, 亲惑 弥措 荐啊 登绢具 茄促.
+
+//////////////////////////////////////////////////////////////////////////
+// Processing Option (急琶等 亲格俊 蝶扼 Processing 咯何甫 眉农茄促.)
+#define		DIT_CONV_CONVOLUTION		1
+#define		DIT_CONV_PPAIRING			2
+#define		DIT_CONV_MPAIRING			4
+#define		DIT_CONV_BLOBING			8
+#define		DIT_CONV_CLASSIFY			16
+#define		DIT_CONV_MERGE_DIVISION		32
+#define		DIT_CONV_MERGE_MIX			64
+#define		DIT_CONV_UNPAIRBLOB			128
+
+#define		DIT_CONV_ALL_SKIPMERGE		31
+#define		DIT_CONV_ALL_MERGEDIVISION	63
+#define		DIT_CONV_ALL_MERGEMIX		95
+
+//////////////////////////////////////////////////////////////////////////
+// 弥措 倾侩 搬窃 荐.
+#define		MAX_DEFECTPIX_NUM			10000
+#define		MAX_DEFECTBLOB_NUM			10000
+#define		MAX_ZONE_NUM				16
+
+#define		VERT_CELLCENTER			0
+#define		VERT_CELLSTART			1
+#define		VERT_CELLEND			2
+
+
+
+
+class AFX_EXT_CLASS CConvResult
+{
+public:
+	int			m_nThreadDefectPixelNum;
+	int			m_nThreadDefectNum;
+	int			m_nSkipUnpaired;
+	int			m_nSkipClassify;
+	int			m_nMoveClassify;
+	int			m_nSkipMerged;
+
+	CConvResult()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		m_nThreadDefectPixelNum	= 0;
+		m_nThreadDefectNum		= 0;
+		m_nSkipUnpaired			= 0;
+		m_nSkipClassify			= 0;
+		m_nMoveClassify			= 0;
+		m_nSkipMerged			= 0;
+	}
+};
+
+class AFX_EXT_CLASS CDefectPair
+{
+public:
+	DefectPos	s_DefectPos;
+	DefectPair	s_DefectPair;
+	DefectType	s_DefectType;
+	int			s_fDefectPeak;
+	int			s_nDefectX;
+	int			s_nDefectY;
+	int			s_nGraySrc;
+	int			s_nGrayRef;
+	int			s_nZone;
+	int			s_nThresold;
+
+	CDefectPair()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		s_DefectPos = DEFPOS_NONE;
+		s_DefectPair = DEFPAIR_NOTDEFINE;
+		s_DefectType = DEFTYPE_NODEFECT;
+		s_fDefectPeak = 0;
+		s_nDefectX = 0;
+		s_nDefectY = 0;
+		s_nGraySrc = 0;
+		s_nGrayRef = 0;
+		s_nZone= 0;
+		s_nThresold= 0;
+	}
+	void SetPeak(int nPeak, int nKernelThres, int nCalcPixel)
+	{
+		s_fDefectPeak= (abs(nPeak));
+		s_fDefectPeak -= (nKernelThres);
+		s_fDefectPeak /= (nCalcPixel);
+	}
+
+	// 汗荤 积己磊.
+	CDefectPair(const CDefectPair& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_DefectPos			= rhs.s_DefectPos;
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_fDefectPeak		= rhs.s_fDefectPeak;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nGraySrc			= rhs.s_nGraySrc;
+			s_nGrayRef			= rhs.s_nGrayRef;
+			s_nZone				= rhs.s_nZone;
+			s_nThresold			= rhs.s_nThresold;
+		}
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+	CDefectPair& operator=(const CDefectPair& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_DefectPos			= rhs.s_DefectPos;
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_fDefectPeak		= rhs.s_fDefectPeak;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nGraySrc			= rhs.s_nGraySrc;
+			s_nGrayRef			= rhs.s_nGrayRef;
+			s_nZone				= rhs.s_nZone;
+			s_nThresold			= rhs.s_nThresold;
+		}
+		return *this;
+	}
+
+};
+
+class AFX_EXT_CLASS CDefectBlob
+{
+public:
+	DefectPos	s_DefectPos;
+	DefectPair	s_DefectPair;
+	DefectType	s_DefectType;
+	int			s_nIndex;
+	int			s_nDefectArea;
+	int			s_nPadRegionIdx;
+	int			s_nDefectX;
+	int			s_nDefectY;
+	int			s_xMaxPeak;
+	int			s_yMaxPeak;
+	int			s_xLevelSrcMax;
+	int			s_yLevelSrcMax;
+	int			s_nDefectRScale;
+	CRect		s_DefectRect;
+	short		s_sDefectPeak;
+
+	short		s_sLevelSrcMin;
+	short		s_sLevelSrcMax;
+	short		s_sLevelSrcAvg;
+	short		s_sLevelRefMin;
+	short		s_sLevelRefMax;
+	short		s_sLevelRefAvg;
+	short		s_sLevelDiffMin;
+	short		s_sLevelDiffMax;
+	short		s_sLevelDiffAvg;
+	int			s_nLevelSrcSum;
+	int			s_nLevelRefSum;
+	int			s_nLevelDiffSum;
+	//公霸吝缴狼 Gray 沥焊 -辣沥刮-
+	short		s_sCMSrcMin;
+	short		s_sCMSrcMax;
+	short		s_sCMSrcAvg;
+	short		s_sCMRefMin;
+	short		s_sCMRefMax;
+	short		s_sCMRefAvg;
+
+	short		s_sThreshold;
+	short		s_sThresholdAvg;
+	int			s_nThresholdSum;
+
+	short		s_sZonePixelCount[MAX_ZONE_NUM];
+	short		s_sZoneValueMin[MAX_ZONE_NUM];
+	BYTE		s_sZoneValueMax[MAX_ZONE_NUM];
+	int			s_sZoneValueSum[MAX_ZONE_NUM];
+
+	int			s_nRegionType;
+	BOOL		s_bRemoved;
+
+
+	CPoint		s_ptVertex[8];
+
+	CDefectBlob()
+	{
+		Reset();
+	}
+	void ResetReuse()
+	{
+		s_DefectRect.SetRect(INT_MAX, INT_MAX, 0, 0);
+		for (int i = 0; i < MAX_ZONE_NUM; i++)
+		{
+			s_sZonePixelCount[i] = 0;
+			s_sZoneValueMin[i] = 256;
+			s_sZoneValueMax[i] = 0;
+			s_sZoneValueSum[i] = 0;
+		}
+		s_ptVertex[0]		= MAKELONG(32760, 32760);
+		s_ptVertex[1]		= MAKELONG(32760, 0);
+		s_ptVertex[2]		= MAKELONG(32760, 32760);
+		s_ptVertex[3]		= MAKELONG(0, 32760);
+		s_ptVertex[4]		= MAKELONG(0, 32760);
+		s_ptVertex[5]		= MAKELONG(0, 0);
+		s_ptVertex[6]		= MAKELONG(32760, 0);
+		s_ptVertex[7]		= MAKELONG(0, 0);
+
+		s_bRemoved			= FALSE;
+	}
+	void Reset()
+	{
+		s_DefectPos			= DEFPOS_NONE;
+		s_DefectPair		= DEFPAIR_NOTDEFINE;
+		s_DefectType		= DEFTYPE_NODEFECT;
+		s_nIndex			= 0;
+		s_nDefectArea		= 0;
+		s_nPadRegionIdx		= -1;
+		s_nDefectX			= 0;
+		s_nDefectY			= 0;
+		s_nDefectRScale		= 0;
+		// 20080525 捞霖锐
+		s_DefectRect.SetRect(INT_MAX, INT_MAX, 0, 0);
+		s_sDefectPeak		= 0;
+
+		s_sLevelSrcMin		= 2048;
+		s_xMaxPeak			= -1;
+		s_yMaxPeak			= -1;
+		s_sLevelSrcMax		= 0;
+		s_xLevelSrcMax		= 0;
+		s_yLevelSrcMax		= 0;
+		s_sLevelSrcAvg		= 0;
+		s_sLevelRefMin		= 2048;
+		s_sLevelRefMax		= 0;
+		s_sLevelRefAvg		= 0;
+		s_sLevelDiffMin		= 2048;
+		s_sLevelDiffMax		= 0;
+		s_sLevelDiffAvg		= 0;
+		s_nLevelSrcSum		= 0;
+		s_nLevelRefSum		= 0;
+		s_nLevelDiffSum		= 0;
+
+		s_sThreshold		= 0;
+		s_sThresholdAvg		= 0;
+		s_nThresholdSum		= 0;
+
+		for (int i = 0; i < MAX_ZONE_NUM; i++)
+		{
+			s_sZonePixelCount[i] = 0;
+			s_sZoneValueMin[i] = 256;
+			s_sZoneValueMax[i] = 0;
+			s_sZoneValueSum[i] = 0;
+		}
+
+		s_nRegionType		= -1;
+
+		// 20080525 捞霖锐
+		s_ptVertex[0]		= MAKELONG(32760, 32760);
+		s_ptVertex[1]		= MAKELONG(32760, 0);
+		s_ptVertex[2]		= MAKELONG(32760, 32760);
+		s_ptVertex[3]		= MAKELONG(0, 32760);
+		s_ptVertex[4]		= MAKELONG(0, 32760);
+		s_ptVertex[5]		= MAKELONG(0, 0);
+		s_ptVertex[6]		= MAKELONG(32760, 0);
+		s_ptVertex[7]		= MAKELONG(0, 0);
+
+		s_bRemoved			= FALSE;
+	}
+	void SetDefectPos(DefectPos	DP)
+	{
+		// 2012.1.26 : Center 搬窃 快急. 
+		if (s_DefectPos == DEFPOS_NONE)
+			s_DefectPos = DP;
+		else if (s_DefectPos == DEFPOS_CENTER)//DP == DEFPOS_LEFT || DP == DEFPOS_RIGHT)
+			return;
+		s_DefectPos = DP;
+	}
+
+	void SetDefectPair(DefectPair DP)
+	{
+		// 2012.1.26 : Pair 搬窃 快急栏肺 荐沥. mosis
+		if (s_DefectPair > DP)
+			s_DefectPair = DP;
+	}
+
+
+	// 措涝楷魂磊 坷滚肺爹.
+	CDefectBlob& operator=(const CDefectBlob& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_DefectPos			= rhs.s_DefectPos;
+			s_DefectPair		= rhs.s_DefectPair;
+			s_DefectType		= rhs.s_DefectType;
+			s_nIndex			= rhs.s_nIndex;
+			s_nDefectArea		= rhs.s_nDefectArea;
+			s_nPadRegionIdx		= rhs.s_nPadRegionIdx;
+			s_nDefectX			= rhs.s_nDefectX;
+			s_nDefectY			= rhs.s_nDefectY;
+			s_nDefectRScale		= rhs.s_nDefectRScale;
+			s_DefectRect		= rhs.s_DefectRect;
+			s_sDefectPeak		= rhs.s_sDefectPeak;
+
+			s_sLevelSrcMin		= rhs.s_sLevelSrcMin;
+			s_sLevelSrcMax		= rhs.s_sLevelSrcMax;
+			s_xMaxPeak			= rhs.s_xMaxPeak;
+			s_yMaxPeak			= rhs.s_yMaxPeak;
+			s_xLevelSrcMax		= rhs.s_xLevelSrcMax;
+			s_yLevelSrcMax		= rhs.s_yLevelSrcMax;
+			s_sLevelSrcAvg		= rhs.s_sLevelSrcAvg;
+			s_sLevelRefMin		= rhs.s_sLevelRefMin;
+			s_sLevelRefMax		= rhs.s_sLevelRefMax;
+			s_sLevelRefAvg		= rhs.s_sLevelRefAvg;
+			s_sLevelDiffMin		= rhs.s_sLevelDiffMin;
+			s_sLevelDiffMax		= rhs.s_sLevelDiffMax;
+			s_sLevelDiffAvg		= rhs.s_sLevelDiffAvg;
+			s_nLevelSrcSum		= rhs.s_nLevelSrcSum;
+			s_nLevelRefSum		= rhs.s_nLevelRefSum;
+			s_nLevelDiffSum		= rhs.s_nLevelDiffSum;
+
+			s_sThreshold		= rhs.s_sThreshold;
+			s_sThresholdAvg		= rhs.s_sThresholdAvg;
+
+			int i;
+#define MOSIS_EDIT_VERTEX
+			for(i= 0; i< 8; i++)
+			{
+				s_ptVertex[i]= rhs.s_ptVertex[i];
+			}
+
+			for (i = 0; i < MAX_ZONE_NUM; i++)
+			{
+				s_sZonePixelCount[i] = rhs.s_sZonePixelCount[i];
+				s_sZoneValueMin[i] = rhs.s_sZoneValueMin[i];
+				s_sZoneValueMax[i] = rhs.s_sZoneValueMax[i];
+				s_sZoneValueSum[i] = rhs.s_sZoneValueSum[i];
+			}
+			s_nRegionType		= rhs.s_nRegionType;
+			s_bRemoved			= rhs.s_bRemoved;
+		}
+		return *this;
+	}
+
+	void MergeBlob(const CDefectBlob& rhs)
+	{
+		if (s_DefectPos == DEFPOS_NONE)
+			s_DefectPos = rhs.s_DefectPos;
+		else if (rhs.s_DefectPos == DEFPOS_LEFT || rhs.s_DefectPos == DEFPOS_RIGHT)
+			s_DefectPos = rhs.s_DefectPos;
+
+		if (s_DefectPair < rhs.s_DefectPair)
+			s_DefectPair = rhs.s_DefectPair;
+
+		//公霸吝缴栏肺 搬窃谅钎 魂免 20140207 lmk
+		s_nDefectX = (s_nDefectX * s_nDefectArea + rhs.s_nDefectX * rhs.s_nDefectArea);
+		s_nDefectY = (s_nDefectY * s_nDefectArea + rhs.s_nDefectY * rhs.s_nDefectArea);
+		s_nDefectArea += rhs.s_nDefectArea;
+		s_nDefectX /= s_nDefectArea;
+		s_nDefectY /= s_nDefectArea;
+
+		//扁粮搬窃谅钎
+		//滚弊, 角钠 公霸吝缴 备秦初绊 付瘤阜俊 泛飘肺 搬窃谅钎甫 备茄促.
+		//窍瘤父 弊付历档 钦摹扁 傈狼 泛飘狼 吝缴谅钎肺 备窍扁 锭巩俊 钧蹲茄 镑捞 搬窃谅钎啊 等促.
+		//s_nDefectArea += rhs.s_nDefectArea;
+		//s_nDefectX = (s_DefectRect.right + s_DefectRect.left) / 2;
+		//s_nDefectY = (s_DefectRect.bottom + s_DefectRect.top) / 2;
+
+		if (s_ptVertex[0].x >= rhs.s_ptVertex[0].x)	// LT
+			s_ptVertex[0] = rhs.s_ptVertex[0];
+		if (s_ptVertex[1].x >= rhs.s_ptVertex[1].x)	// LB
+			s_ptVertex[1] = rhs.s_ptVertex[1];
+		if (s_ptVertex[2].y >= rhs.s_ptVertex[2].y)	// TL
+			s_ptVertex[2] = rhs.s_ptVertex[2];
+		if (s_ptVertex[3].y >= rhs.s_ptVertex[3].y)	// TR
+			s_ptVertex[3] = rhs.s_ptVertex[3];
+		if (s_ptVertex[4].x <= rhs.s_ptVertex[4].x)	// RT
+			s_ptVertex[4] = rhs.s_ptVertex[4];
+		if (s_ptVertex[5].x <= rhs.s_ptVertex[5].x)	// RB
+			s_ptVertex[5] = rhs.s_ptVertex[5];
+		if (s_ptVertex[6].y <= rhs.s_ptVertex[6].y)	// BL
+			s_ptVertex[6] = rhs.s_ptVertex[6];
+		if (s_ptVertex[7].y <= rhs.s_ptVertex[7].y)	// BR
+			s_ptVertex[7] = rhs.s_ptVertex[7];
+
+		s_nDefectRScale = (s_nDefectRScale + rhs.s_nDefectRScale);
+		if (s_DefectRect.left > rhs.s_DefectRect.left)
+			s_DefectRect.left = rhs.s_DefectRect.left;
+		if (s_DefectRect.top > rhs.s_DefectRect.top)
+			s_DefectRect.top = rhs.s_DefectRect.top;
+		if (s_DefectRect.right < rhs.s_DefectRect.right)
+			s_DefectRect.right = rhs.s_DefectRect.right;
+		if (s_DefectRect.bottom < rhs.s_DefectRect.bottom)
+			s_DefectRect.bottom = rhs.s_DefectRect.bottom;
+
+		//公霸吝缴捞 酒囱 搬窃泛飘狼 吝缴栏肺 搬窃谅钎甫 魂免且妨搁 咯扁林籍阑钱磊
+		//s_nDefectX = (s_DefectRect.right + s_DefectRect.left) / 2;
+		//s_nDefectY = (s_DefectRect.bottom + s_DefectRect.top) / 2;
+
+		if (s_sDefectPeak < rhs.s_sDefectPeak)
+		{
+			s_sDefectPeak		= rhs.s_sDefectPeak;
+			s_xMaxPeak			= rhs.s_xMaxPeak;
+			s_yMaxPeak			= rhs.s_yMaxPeak;
+		}
+
+		if (s_sLevelSrcMin > rhs.s_sLevelSrcMin)
+			s_sLevelSrcMin		= rhs.s_sLevelSrcMin;
+		if (s_sLevelSrcMax < rhs.s_sLevelSrcMax)
+		{
+			s_sLevelSrcMax		= rhs.s_sLevelSrcMax;
+			s_xLevelSrcMax		= rhs.s_xLevelSrcMax;
+			s_yLevelSrcMax		= rhs.s_yLevelSrcMax;
+		}
+		if (s_sLevelRefMin > rhs.s_sLevelRefMin)
+			s_sLevelRefMin		= rhs.s_sLevelRefMin;
+		if (s_sLevelRefMax < rhs.s_sLevelRefMax)
+			s_sLevelRefMax		= rhs.s_sLevelRefMax;
+		if (s_sLevelDiffMin > rhs.s_sLevelDiffMin)
+			s_sLevelDiffMin		= rhs.s_sLevelDiffMin;
+		if (s_sLevelDiffMax < rhs.s_sLevelDiffMax)
+			s_sLevelDiffMax		= rhs.s_sLevelDiffMax;
+
+		s_nLevelSrcSum		+= rhs.s_nLevelSrcSum;
+		s_nLevelRefSum		+= rhs.s_nLevelRefSum;
+		s_nLevelDiffSum		+= rhs.s_nLevelDiffSum;
+		s_nThresholdSum		+= rhs.s_nThresholdSum;
+
+		s_sLevelSrcAvg			= s_nLevelSrcSum / s_nDefectArea;
+		s_sLevelRefAvg			= s_nLevelRefSum / s_nDefectArea;
+		s_sLevelDiffAvg			= s_nLevelDiffSum / s_nDefectArea;
+		s_sThresholdAvg			= s_nThresholdSum / s_nDefectArea;
+
+		if (s_sThreshold < rhs.s_sThreshold)
+			s_sThreshold		= rhs.s_sThreshold;
+
+		for (int i = 0; i < MAX_ZONE_NUM; i++)
+		{
+			s_sZonePixelCount[i] = s_sZonePixelCount[i] + rhs.s_sZonePixelCount[i];
+			s_sZoneValueMin[i] = min(s_sZoneValueMin[i],rhs.s_sZoneValueMin[i]);
+			s_sZoneValueMax[i] = max(s_sZoneValueMax[i],rhs.s_sZoneValueMax[i]);
+			s_sZoneValueSum[i] = (s_sZoneValueSum[i]+rhs.s_sZoneValueSum[i]);
+		}
+
+	}
+	void CreateBlob(CDefectPair *pPair, int id);
+	void IncludePair(CDefectPair *pPair);
+	void CheckDefectRect(int nX, int nY);
+};
+
diff --git a/Lib/SISAssem/include/AssemParam.h b/Lib/SISAssem/include/AssemParam.h
new file mode 100644
index 0000000..4676b8a
--- /dev/null
+++ b/Lib/SISAssem/include/AssemParam.h
@@ -0,0 +1,319 @@
+#pragma once
+
+#include "Pad.h"
+#include "AssemDefect.h"
+
+
+enum ConvMode		{ ConvMode_Float = 0, ConvMode_Pixel, ConvMode_Binalize };
+enum ConvDir		{ ConvDir_Hori= 0, ConvDir_Vert= 1, ConvDir_Double= 2};
+
+#define		MAX_DEAD_ZONE_COUNT		10
+
+class AFX_EXT_CLASS CConvParam
+{
+public:
+	virtual ~CConvParam() {}
+
+public:
+	// 1.1. 八荤 规过 包访
+	ConvMode	m_ConvMode;		// 0 = ConvFloat(2*2), 1 = ConvPixel(1*1)
+	int			m_ConvDir;		// 0 = Horizontal, 1= Vertical, 2, Hori and Vert
+	int			m_ReinspectCount;		// Frame Overflow矫 犁八荤 雀荐
+	BOOL		m_bZone2B2;				// Zone 2 By 2 八荤
+	BOOL		m_bIntrinsic;
+	BOOL		m_bSkipBlock;			// 捞屈伎.
+
+	// 1.2. 八荤 捞固瘤 沥焊
+	LPBYTE		s_lpBuffer;				// * 八荤且 滚欺
+	int			s_nFrameWidth;			// * 八荤 捞固瘤 承捞
+	int			s_nFrameHeight;			// * 八荤 捞固瘤 臭捞.
+
+	// 1.3. 八荤 康开 沥焊.
+	CTrapezium	m_Trapezium;			// 荤促府裁 八荤 康开
+	CRect		s_RectConv;				// * 滚欺俊辑 楷魂且 荤阿屈
+	CRect		s_RectFilter;			// * 滚欺俊辑 鞘磐傅俊 静老 荐 乐绰 荤阿屈(盔贰 伎农扁 殿 啊瓷)
+	CRect		s_RectDeadZone[MAX_DEAD_ZONE_COUNT];
+
+	// 1.5. Convolution 沥焊.
+	int			s_nConvWidth;			// * 八荤 窜困 承捞
+	int			s_nConvHeight;			// * 八荤 窜困 臭捞
+
+	double		s_dPitchConvReal;		// * 八荤 乔摹
+	int			s_nPitchCycleConv;		// 茄 伎狼 乔摹
+	double		s_dPitchScanReal;		// * 八荤 乔摹
+	int			s_nPitchCycleScan;		// 茄 伎狼 乔摹
+
+	float		m_fTilt;				// tilt 蔼. 
+
+	// 1.6. 巩盼蔼 沥焊.
+	int			s_nThreshold;			// * 皋牢 巩盼蔼
+	int			s_nDThSlide;		// Dynamic Threshold 扁匡扁
+	int			s_nThresholdSupress;	// Suppress 巩盼蔼.
+	int			s_nSideThreshold;		// 谅/快/Unpair 八荤 巩盼蔼
+	int			s_nBWB_Main;		// Black 搬窃 绢祭俊辑狼 鞘磐傅 DTh(ConvPixel VertSBW, VTDSBW父 备泅), 0捞搁 救靖.
+	int			s_nBWB_Slide;		// Black 搬窃 绢祭俊辑狼 鞘磐傅 DTh(ConvPixel VertSBW, VTDSBW父 备泅)
+
+	// 1.7. 八荤 Process 沥焊.
+	BOOL		m_bEchoConvolution;	// 楷魂 加档 何练栏肺 绢祭 郴何俊辑 Thread 盒且 八荤 咯何.
+	BOOL		m_bVertSpeedup;		// Pixel苞 Zone 加档 何练栏肺 八荤 风凭狼 皋葛府 犁秦籍 咯何
+	BOOL		m_bSelectiveDir;	// 楷魂 规氢俊辑 3乔摹 何练矫 楷魂规氢阑 cross 规氢栏肺 函版饶 八荤 且瘤 咯何.
+	BOOL		m_bUseUnpair;			// Left客 Right狼 Unpair 搬窃阑 Assem狼 Pairing 窜拌俊辑 惶酒 晨(TRUE) or 滚覆(FALSE). 扁夯 TRUE;
+	BOOL		s_bReverseFilter;		// ReverseFilter 荤侩 咯何
+	int			m_EdgeFilterTh;			// 伎 Edge 康开俊辑 窜林扁 鞘磐 利侩且 荐 绝绰 备埃阑 困茄 眠啊 Th
+
+	// 1.8. Dynamic Pitch 沥焊
+	int			*m_pPitch16;	// pitch甫 16硅 秦辑 subpixel鳖瘤 钎泅, Trapezium捞寇狼 Rect俊辑绰 Vertical 规氢捞促.
+	short		*m_pPitch;		// Dynamic Pitch. Horizontal 规氢捞绊
+	short		*m_pfSPR;		// Dynamic Pitch. Horizontal 规氢捞绊, Sub Pixel
+	short		*m_psSPR;		// Dynamic Pitch. Horizontal 规氢捞绊, Sub Pixel
+	BOOL		m_bUseDPC;
+
+	// 1.7. Zone Threshold 八荤 沥焊
+	BOOL		m_bZoneMulti;			// Zone Multi Threshold 八荤 利侩 急琶.
+	short*		s_psZoneTable;				// Zone喊 Thresholding阑 困茄 Index Table
+	short*		s_psZoneThTable;			// Zone喊 Thresholding阑 困茄 Threshold Table
+	short*		s_psZoneAddTable;			// Zone喊 Thresholding阑 困茄 DynamicThreshold Table
+	short*		s_psZoneMThTable;		// 2吝 ZoneThreshold狼 滴锅掳 Base Threshold
+	short*		s_psZoneMAddTable;		// 2吝 ZoneThreshold狼 滴锅掳 Threshold Slope
+	short*		s_psZoneMMinTable;			// 2吝 ZoneThreshold狼 2锅掳 流急阑 困茄 烙拌摹(侨伎 灌扁), 2吝 ZoneThreshold利侩 咯何狼 备盒磊 开且档 扳窃.
+	int			s_nThresTableWidth;		// Threshold Table 承捞
+	int			s_nThresTableHeight;	// Threshold Table 臭捞
+	int			s_nThresTableStartX;	// X绵 矫累 Offset
+	int			s_nThresTableStartY;	// Y绵 矫累 Offset
+	void*		m_pGammaTable;			// Zone Threshold 滴锅掳 滚傈栏肺 概莫 抛捞喉 沥焊 焊包.
+	int			m_nGammaXCount;			// Gamma Table狼 X, Y 硅凯狼 X绵 概莫器捞飘 墨款飘(俺荐)
+	int			s_nZoneCycleConv;		// Zone Reference 捞固瘤狼 扁夯林扁 硅荐
+	int			s_nZoneCycleScan;		// Zone Reference 捞固瘤狼 扁夯林扁 硅荐
+	int*		m_pFilterThBlack;
+	int*		m_pFilterThBlack2;
+	int*		m_pFilterThWhite;
+	int*		m_pFilterThWhite2;
+	int*		m_pSpeedZoneTh;
+	int*		m_pSpeedZoneThSlide;
+
+
+	int			GetFilterThreshold(int iZone, int pixel, DefectType Type)
+	{
+		if(Type == DEFTYPE_WHITE)
+			return ((m_pFilterThWhite2[iZone]*pixel)>>8)+ m_pFilterThWhite[iZone];
+
+		return ((m_pFilterThBlack2[iZone]*pixel)>>8)+ m_pFilterThBlack[iZone];
+	}
+
+
+	//==================================
+	// Assem 捞 场抄 饶贸府客 包访等 沥焊.
+
+	// 2.1.  搬窃 包府 沥焊.
+	int			s_nFrameDefPixLimit;	// 茄 Frame俊辑狼 弥措 搬窃 侨伎 荐
+	int			s_nFrameDefBlobLimit;	// 茄 Frame俊辑狼 弥措 搬窃 荐
+
+	// 2.2. 侨伎 窜拌 鞘磐傅 沥焊.
+	BOOL		m_bUsePixelFilter;		// Pixel窜拌俊辑 鞘磐傅阑 且 巴牢啊 富 巴牢啊?
+	BOOL		m_bUseMarginFilter;		//
+	BOOL		m_bOnlyJumpFilter;		// 八荤 绵狼 Cross 规氢栏肺 鞘磐傅 绝捞 JumpFiltering父 且 巴牢啊 .or. CrossFilter甫 且 巴牢啊.
+	BOOL		m_bPairFilter;			// Pair 搬窃俊档 Cross&Jump 鞘磐 利侩.
+	
+	// 2.2 Zone Measure Filter // 漂沥 粮俊 措秦 固技 康开 犁 概莫饶 促矫 八荤 鞘磐 利侩.
+	BOOL		m_bTiltFilter;
+ 
+	// 2.3. 饶贸府 沥焊.
+	int			m_nDefectMergePixel;	// 叼棋 赣瘤 荤捞令
+
+	// 2.4. Zone Sorting, Thresholding
+	BYTE*		s_pZoneData;			// Zone Sort Table
+	BYTE*		s_pZoneThreshold;		// Zone Threshold Table
+	int			s_nZoneDataWidth;		// Zone Sort Table 承捞
+	int			s_nZoneBufferWidth;		// Zone Data 滚欺狼 捞固瘤 滚欺 农扁.
+	int			s_nZoneDataHeight;		// Zone Sort Table 臭捞
+
+	// 2.5. 搬窃 沥焊 啊傍 沥焊.
+	double		s_dScanResolution;		// Scan Resolution
+	double		s_dConvResolution;		// Conv Resolution
+
+
+
+	//======================================
+	// 99. 救 静瘤父 俺充惑 瘤快瘤 臼阑 巴甸.
+	short		s_sSkipSave;			// 八荤 饶 捞固瘤 历厘 咯何
+	UINT		s_uiProcessing;			// * 八荤 规过
+	int			s_nRegionType;			// 康开 - 汲沥等 蔼阑 搬窃俊 静扁 困窃
+
+	// 技牧八荤 Param
+	BOOL		s_bUse2ndInspection;
+	int			s_n2ndThres;
+	int			s_n2ndThresSlide;
+	double		s_d2ndPitch;
+
+
+	// Add by PJH
+	int			s_nASGDynamicHi;
+	int			s_nASGDynamicLow;
+
+	// 99. 扁鸥 棱促备府
+	// 200090612 size choigudal
+	BOOL		s_bUseTrimmer;
+	int			s_nTrimmerWidth;
+	int			s_nTrimmerHeight;
+
+
+   // 20150811 芭措 CS
+	int			m_nCSThres[MAX_ZONE_NUM];
+	int			m_nOriThres[MAX_ZONE_NUM];
+
+	CConvParam()
+	{
+		Reset();
+	}
+
+	double	GetRealConvPitch(){return s_dPitchConvReal*s_nPitchCycleConv;}
+	double	GetRealScanPitch(){return s_dPitchScanReal*s_nPitchCycleScan;}
+	double	GetZoneConvPitch(){return s_dPitchConvReal*s_nZoneCycleConv;}
+	double	GetZoneScanPitch(){return s_dPitchScanReal*s_nZoneCycleScan;}
+
+	void Reset()
+	{
+		// 1.1. 八荤 规过 包访
+		m_ConvMode					= ConvMode_Float;
+		m_ConvDir					= 0;
+		m_ReinspectCount			= 3;
+		m_bZone2B2					= FALSE;
+		m_bIntrinsic				= FALSE;
+		m_bSkipBlock				= FALSE;
+
+		// 1.2. 八荤 捞固瘤 沥焊
+		s_lpBuffer					= NULL;
+		s_nFrameWidth				= 0;
+		s_nFrameHeight				= 0;
+
+		// 1.3. 八荤 康开 沥焊.
+		s_RectConv.SetRect(0, 0, 0, 0);
+		s_RectFilter= s_RectConv;
+		for(int i = 0 ; i < MAX_DEAD_ZONE_COUNT; i++)
+			s_RectDeadZone[i].SetRectEmpty();
+
+		// 1.5. Convolution 沥焊.
+		s_nConvWidth				= 0;
+		s_nConvHeight				= 0;
+
+		s_dPitchConvReal			= 0.0;
+		s_nPitchCycleConv			= 0;
+		s_dPitchScanReal			= 0.0;
+		s_nPitchCycleScan			= 0;
+
+		m_fTilt						= 0.0;
+
+		// 1.6. 巩盼蔼 沥焊.
+		s_nThreshold				= 10;
+		s_nDThSlide					= 20;
+		s_nThresholdSupress			= 255;
+		s_nSideThreshold			= 0;
+		s_nBWB_Main					= 0;
+		s_nBWB_Slide				= 0;
+
+		// 1.7. 八荤 Process 沥焊.
+		m_bEchoConvolution			= TRUE;
+		m_bVertSpeedup				= TRUE;
+		m_bSelectiveDir				= FALSE;
+		m_bUseUnpair				= TRUE;
+		s_bReverseFilter			= FALSE;
+		m_EdgeFilterTh				= 0;
+
+		// 1.8. Dynamic Pitch 沥焊
+		m_pPitch16					= NULL;
+		m_pPitch					= NULL;
+		m_pfSPR						= NULL;
+		m_psSPR						= NULL;
+		m_bUseDPC					= TRUE;
+
+
+		// 1.9. Zone Threshold 八荤 沥焊
+		m_bZoneMulti				= FALSE;
+		s_psZoneTable				= NULL;	//0617 眠啊
+		s_psZoneThTable				= NULL;
+		s_psZoneAddTable			= NULL;
+		s_psZoneMThTable			= NULL;
+		s_psZoneMAddTable			= NULL;
+		s_psZoneMMinTable			= NULL;
+		s_nThresTableWidth			= 12000;
+		s_nThresTableHeight			= 1024;
+		s_nThresTableStartX			= 0;
+		s_nThresTableStartY			= 0;
+		m_pGammaTable				= NULL;
+		m_nGammaXCount				= 300;
+		s_nZoneCycleConv			= 1;
+		s_nZoneCycleScan			= 1;
+		m_pFilterThBlack			= NULL;
+		m_pFilterThBlack2			= NULL;
+		m_pFilterThWhite			= NULL;
+		m_pFilterThWhite2			= NULL;
+		m_pSpeedZoneTh				= NULL;
+		m_pSpeedZoneThSlide			= NULL;
+
+		//==================================
+		// Assem 捞 场抄 饶贸府客 包访等 沥焊.
+
+		// 2.1.  搬窃 包府 沥焊.
+		s_nFrameDefPixLimit			= 10000;//MAX_DEFECTPIX_NUM;
+		s_nFrameDefBlobLimit		= 10000;//MAX_DEFECTBLOB_NUM;
+
+		// 2.2. 鞘磐傅 沥焊.
+		m_bUsePixelFilter			= TRUE;
+		m_bOnlyJumpFilter			= FALSE;
+		m_bPairFilter				= FALSE;
+		m_bUseMarginFilter			= TRUE;
+
+		// 2.2. Zone Measure Filter // 漂沥 粮俊 措秦 固技 康开 犁 概莫饶 促矫 八荤 鞘磐 利侩.
+		m_bTiltFilter				= FALSE;
+
+		// 2.3. 饶贸府 沥焊.
+		m_nDefectMergePixel			= 4;// 赣瘤 4 侨伎
+
+		// 2.4. Zone Sorting, Thresholding, Zone Thresholding老 锭狼 Zone 沥焊, RSCale 眠免阑 困茄 蔼甸
+		s_pZoneData					= NULL;
+		s_pZoneThreshold			= NULL;
+		s_nZoneDataWidth			= 0;
+		s_nZoneBufferWidth			= 0;
+		s_nZoneDataHeight			= 0;
+
+		// 2.5. 搬窃 沥焊 啊傍 沥焊.
+		s_dScanResolution			= 0.0;
+		s_dConvResolution			= 0.0;
+
+		//======================================
+		// 99. 静绰瘤 救 静绰 瘤 葛福绰 巴.
+		s_sSkipSave					= 0;
+		s_uiProcessing				= 0;
+		s_nRegionType				= -1;
+
+		//技牧靛 八荤
+		s_bUse2ndInspection			= FALSE;
+		s_n2ndThres					= 255;;
+		s_n2ndThresSlide			= 0;
+		s_d2ndPitch					= 0;
+
+		// Add by PJH
+		s_nASGDynamicHi				= 0;
+		s_nASGDynamicLow			= 0;
+
+		// 200090612 size choigudal
+		s_bUseTrimmer				= FALSE;
+		s_nTrimmerWidth				= 0;
+		s_nTrimmerHeight			= 0;
+//.
+      // 20150811 芭措 CS
+		for(int i = 0; i < MAX_ZONE_NUM; i++)
+		{
+			m_nCSThres[i] = 0;
+			m_nOriThres[i] = 0;
+		}
+
+	}
+
+	BOOL IsAllInspected(int endLine)
+	{
+		if(m_ConvDir == ConvDir_Hori)
+			return s_RectConv.bottom - endLine < 16;
+		return s_RectConv.right - endLine < 16;
+	}
+};
diff --git a/Lib/SISAssem/include/AssemUtil.h b/Lib/SISAssem/include/AssemUtil.h
new file mode 100644
index 0000000..fbe46fb
--- /dev/null
+++ b/Lib/SISAssem/include/AssemUtil.h
@@ -0,0 +1,35 @@
+#pragma once
+
+class AFX_EXT_CLASS CAssemUtil
+{
+public:
+	// Assem阑 静绰 辫俊 咯扁促 父电促.
+	static void ByteToShort( unsigned char* pSrc, short* pDest, int nSize);
+	// 乔摹 备窍扁, 函荐甫 谅快 沤祸 俺充栏肺 犁祈
+	static void CheckPitchSmall16(__int64 pitch16, int searchCount, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &findPitch16, int &iPitch, int &spr);
+	static void CheckPitchSmallVert16(__int64 pitch16, int searchCount, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &findPitch16, int &iPitch, int &spr);
+
+	// 厘林扁 贾风记 : Vertical 捞搁辑 Tilt等 捞固瘤俊辑 Dynamic 乔摹 备窍扁
+	// 1. Vertical Pitch & Tilt 备窍扁
+	static void CheckPitchSmallVPT16(int pitchStart16, int pitchEnd16, int tiltStart16, int tiltEnd16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16, int &findTilt16);
+	// 2. Vertical Pitch俊辑 Tilt 备窍扁
+	static void CheckPitchSmallVP_T16(int pitch16, int tiltStart16, int tiltEnd16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findTilt16);
+	// 3. Tilt 俊辑 Vertical Pitch 备窍扁
+	static void CheckPitchSmallVT_P16(int pitchStart16, int pitchEnd16, int Tilt16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16);
+	// 4. Tilt 俊辑 Vertical Pitch 备窍扁 + Error Check(ImageBuffer)
+	static int CheckPitchSmallVT_P16_BOE(int pitchStart16, int pitchEnd16, int Tilt16, int left, int right, int top, int bottom, BYTE *pData, int buffWidth, int buffHeight, int Dpc_suppress, short* conBuff, short* conBuff2, int &findPitch16);
+
+
+
+
+	// start 客 end啊 integer肺 登绢 乐促. 3.0阑 八荤窍妨搁 48锅(3*16)狼 八荤甫 荐青茄促.
+	// sub pixel狼 扁夯窜困绰 1/16 捞促.
+	static void CheckPitch(int StartPitch, int EndPitch, int Spr, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &rPitch, int &rfSpr);
+	// 弥檬 pitch绰 start~end鳖瘤 八荤窍唱, 乔摹 函拳啊 鞭拜窍瘤 臼扁锭巩俊 促澜 困摹狼 乔摹绰 1/16 窜困肺 乔摹 八荤 荐青
+	static void CheckPitchSmall(int StartPitch, int EndPitch, int Spr, int fSpr, int sSpr, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &rPitch, int &rfSpr);
+	// 弥檬 pitch何磐 count甫 临咯 唱埃促. 涝仿等乔摹绰 16硅茄 int蔼捞促.
+	static void CheckPitchPixel(int startPitch, int endPitch, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &iPitch);
+	static void CheckPitchEcho(int StartPitch, int EndPitch, int Spr, int left, int top, int width, int height, BYTE *pData, int buffWidth, int Dpc_suppress, int &rPitch, int &rfSpr);
+
+
+};
diff --git a/Lib/SISAssem/include/BlobStorage.h b/Lib/SISAssem/include/BlobStorage.h
new file mode 100644
index 0000000..3157ff7
--- /dev/null
+++ b/Lib/SISAssem/include/BlobStorage.h
@@ -0,0 +1,67 @@
+#pragma once
+
+#include "AssemDefect.h"
+#include "PairStorage.h"
+
+
+class AFX_EXT_CLASS CBlobStorage : public CPairStorage
+{
+public:
+	CBlobStorage(void);
+	~CBlobStorage(void);
+	int				m_nBlob;
+	CDefectBlob		*m_pBlobDefect;
+
+	int				m_maxBlob;
+	int				m_nBlobSpace;
+	double			m_BlobTime;;
+
+
+public:
+	int		InitBlobStorage(int maxBlob= 10000);
+	void	ResetBlobStorage()	;
+	void	TotalResetBlobStorage()	;// 檬扁拳 矫埃 窜绵阑 困秦 TotalReset 拌凯 窃荐 眠啊.
+	int		GetBlobCount() {return m_nBlob;}
+	CDefectBlob* GetBlobDefect(int i){return m_pBlobDefect+ i;}
+
+
+
+public:	// Blobing 扁夯 牢磐其捞胶
+	DIT_RESULT	BlobDefect();
+	DIT_RESULT	BlobDefectVert();
+	DIT_RESULT	BlobDefectVert(CPairStorage *pPairStrg);
+
+	// Filtering 包访.
+
+	void		ShadowFilter(int nStart, double xPitch);
+	void		ShadowFilterVert(int nStart, double yPitch);
+
+	int		GetConvolutionValue(int nX, int nY, double dDist, int nSuppress = 255);
+	int		GetConvolutionValueVert(int nX, int nY, double dDist, int nSuppress = 255);
+	int		GetAreaValue(int nXStart, int nYStart, int nWidth, int nHeight, double dDist, int nSuppress = 255);
+	int		GetAreaValueVert(int nXStart, int nYStart, int nWidth, int nHeight, double dDist, int nSuppress = 255);
+
+	// PostProcess 包访.
+	void		CheckDefectRect(CDefectBlob& Defect, int nX, int nY);
+	int			CalcRScale(CPoint* pVertex);
+
+	BOOL		ReadBlob(CBlobStorage *pBlobStrg);
+	BOOL		AddBlob(CDefectBlob *pBlob);
+
+	// 促 瘤况扼.
+	DIT_RESULT	BlobDefect2();
+	DIT_RESULT	BlobDefect_old();
+	DIT_RESULT	BlobUnpairDefect();
+
+	DIT_RESULT	MergeDivision(int nStart, int nMergePixel);
+	DIT_RESULT	MergeMix(int nStart, int nMergePixel);
+	DIT_RESULT	ClassificationDefect(int nStart);
+	BOOL		ClassifyVertical(int nPairedIdx, int nThreshold);
+	DIT_RESULT	ClassificationDefectVert(int nStart);
+
+	long				m_nSkipUnpaired;
+	long				m_nSkipClassify;
+	long				m_nMoveClassify;
+	long				m_nSkipMerged;
+
+};
diff --git a/Lib/SISAssem/include/Pad.h b/Lib/SISAssem/include/Pad.h
new file mode 100644
index 0000000..d8b435c
--- /dev/null
+++ b/Lib/SISAssem/include/Pad.h
@@ -0,0 +1,145 @@
+#pragma once
+
+
+class AFX_EXT_CLASS CPadPoint
+{
+public:
+	int x, y;
+
+	void SetPoint(int px, int py)	{ x= px; y= py;	}
+	void VectorTo(CPadPoint &point)	{	x= point.x- x;	y= point.y- y;	}
+
+	BOOL FindCrossX(CPadPoint &point, int cy, int &tx);// 烙狼狼 cy俊 秦寸窍绰 x 蔼 备窍扁
+	BOOL FindCrossY(CPadPoint &point, int cx, int &ty);// 烙狼狼 cx俊 秦寸窍绰 y 蔼 备窍扁
+
+	BOOL ChangeCrossHori(CPadPoint &point, int cy);// 烙狼狼 cy俊 秦寸窍绰 x, y 肺 point 蔼 官操扁
+	BOOL ChangeCrossVert(CPadPoint &point, int cx);// 烙狼狼 cx俊 秦寸窍绰 x, y 肺 point 蔼 官操扁
+};
+
+class AFX_EXT_CLASS CTrapezium
+{
+public:
+	CPadPoint	m_TrapPoint[4];
+
+public:
+	CTrapezium*	GetSelfTrapezium()	{return this;}
+	int		GetTop()	{return m_TrapPoint->y;}
+	int		GetBottom()	{return m_TrapPoint[3].y;}
+	void	OffsetPlus(int x, int y)
+	{
+		for(int i= 0; i< 4; i++)
+		{
+			m_TrapPoint[i].x+= x;
+			m_TrapPoint[i].y+= y;
+		}
+	}
+	void	ChangeAxis()
+	{
+		int temp;
+		for(int i= 0; i< 4; i++)
+		{
+			temp= m_TrapPoint[i].x;
+			m_TrapPoint[i].x= m_TrapPoint[i].y;
+			m_TrapPoint[i].y= temp;
+		}
+	}
+};
+class AFX_EXT_CLASS CTrapeziumStorage
+{
+protected:
+	int m_nTrapSpace;
+	int m_nTrap;
+	CTrapezium	m_Trapeziums[10];
+	
+public:
+	CTrapeziumStorage(){m_nTrapSpace= 10; ResetTrapeziumCount();}
+
+public:
+	void ResetTrapeziumCount(){m_nTrap= 0;}
+	CTrapezium*	GetTrapezium(int i){	return m_Trapeziums+ i;}
+	int	GetTrapeziumCount(){return m_nTrap;}
+
+	BOOL OpenTrap(CPadPoint &TopLeft, CPadPoint &TopRight)
+	{
+		if(m_nTrap >= m_nTrapSpace)
+			return FALSE;
+		m_Trapeziums[m_nTrap].m_TrapPoint[0]= TopLeft;
+		m_Trapeziums[m_nTrap].m_TrapPoint[1]= TopRight;
+		return TRUE;
+	}
+	BOOL CloseTrap(CPadPoint &BotLeft, CPadPoint &BotRight)
+	{
+		if(m_nTrap >= m_nTrapSpace)
+			return FALSE;
+		m_Trapeziums[m_nTrap].m_TrapPoint[2]= BotLeft;
+		m_Trapeziums[m_nTrap].m_TrapPoint[3]= BotRight;
+		m_nTrap++;
+		return TRUE;
+	}
+};
+
+class AFX_EXT_CLASS CPadPoligon
+{
+	int			m_nPadPoint;	// 蜡瓤 器牢飘 荐
+	BOOL		m_bHorizontal;	// 八荤 规氢
+public:
+	int			m_iTopLeft, m_iTopRight;	// m_iTopLeft = 0 捞绢具 茄促.
+	int			m_iBottomRight, m_iBottomLeft;		// 
+
+//	int			m_iLeftBottom, m_iLeftTop;	// vertical 捞搁 Top捞 Left肺 官差绰 巴捞瘤氛..
+//	int			m_iRightTop, m_iRightBottom;
+
+	CPadPoint	m_PadPoints[10];
+	CRect		m_OutRect;
+	float		m_PitchMin;
+	float		m_PitchMax;
+
+public:
+	int		GetPointCount(){return m_nPadPoint;}
+	CPadPoint* GetPadPoint(int i){ return m_PadPoints+ i;}
+	CPadPoint* GetPadPoint_Round(int i){ return m_PadPoints+ GetRoundIndex(i);}
+
+	int		GetRoundIndex(int id){return id%m_nPadPoint;}
+	int		GetNextIndex(int id){ return (id+ 1)%m_nPadPoint;}
+	int		GetPreIndex(int id){ return (id+ m_nPadPoint- 1)%m_nPadPoint;}
+	void	CalOutRect();
+
+public:
+	CPadPoligon()	{		ResetPoligon();	}
+	CPadPoligon* GetSelfPoligon(){return this;}
+	/////------- test debug
+	void Test();
+	void OffsetPlusIndex(int start);
+	void OffsetPlus(int dx, int dy);
+	void ReverseIndex(int start);
+	/////======= test debug
+	BOOL IsClockwise();
+
+	void ResetPoligon(){m_nPadPoint= 0;}
+	void AddPoint(int x, int y)
+	{
+		m_PadPoints[m_nPadPoint].x= x;
+		m_PadPoints[m_nPadPoint].y= y;
+		m_nPadPoint++;
+	}
+	void AddPoint(CPadPoint& point)
+	{
+		m_PadPoints[m_nPadPoint]= point;
+		m_nPadPoint++;
+	}
+
+	void Cut_Margin(int left, int right, CPadPoligon &PadPoligon);
+	void Cut_3Pitch(float fPitch);
+	void Find_Corner();
+
+	BOOL Cut_TrapeziumHori(CTrapeziumStorage	*pTrapeziums);
+	BOOL Cut_TrapeziumVert(CTrapeziumStorage	*pTrapeziums);
+};
+
+class AFX_EXT_CLASS CPoligonStorage
+{
+	int			m_nPadPoligon;
+	CPadPoligon	m_PadPoligons[10];
+public:
+	CPadPoligon* GetPadPoligon(int i){ return m_PadPoligons+ i;}
+};
diff --git a/Lib/SISAssem/include/PairStorage.h b/Lib/SISAssem/include/PairStorage.h
new file mode 100644
index 0000000..f71eb7d
--- /dev/null
+++ b/Lib/SISAssem/include/PairStorage.h
@@ -0,0 +1,59 @@
+#pragma once
+
+
+#include "AssemParam.h"
+#include "AssemDefect.h"
+#include "PixelStorage.h"
+
+class AFX_EXT_CLASS CPairStorage : public CPixelStorage
+{
+public:
+	CPairStorage(void);
+	~CPairStorage(void);
+	int				m_nPair;
+	CDefectPair		*m_pPairDefect;
+
+	int				m_maxPair;
+	int				m_nPairSpace;
+
+	long				*m_lFirstIndex;//[MAX_DEFECTPIX_NUM];
+	BOOL				*m_bMerged;//[MAX_DEFECTPIX_NUM];
+	BOOL				*m_bTemp;//[MAX_DEFECTPIX_NUM];
+
+	int		InitPairStorage(int maxPair= 10000);
+	void	ResetPairStorage();
+	void	TotalResetPairStorage();// 檬扁拳 矫埃 窜绵阑 困秦 TotalReset 拌凯 窃荐 眠啊.
+	int		GetPairCount() {return m_nPair;}
+	CDefectPair*	GetPairDefect(int i){return m_pPairDefect+ i;}
+
+	int		FalseFilter_Vert();
+	int		FalseFilter_Hori();
+
+
+	void	ShadowFly();	// UnpairDefect吝 ShadowDefect阑 葛滴 朝赴促.
+	void	CorrectDefGray();			// 叼棋 pixel狼 灌扁 蔼 恐邦 焊沥(恐邦捞蜡:辑宏侨伎, m*n 楷魂)
+
+	// Filtering  dfdf Interface.
+	void	Filtering_Vert();
+	void	Filtering_Vert_Temp();
+	void	Filtering_Hori();
+
+
+	BOOL		CrossFilter_Hori(CDefectPair *pPair);
+	BOOL		CrossFilter_Vert(CDefectPair *pPair);
+
+	BOOL		JumpFilter_Hori(CDefectPair *pPair);
+	BOOL		JumpFilter_Vert(CDefectPair *pPair);
+
+	BOOL		MarginFilter_Hori(CDefectPair *pPair);
+	BOOL		OneFilter_Vert(CDefectPair *pPair);
+
+	DIT_RESULT	PairingPlus_Pixel(double dPitchSize);
+	DIT_RESULT	PairingMinus_Pixel(double dPitchsize);
+
+	DIT_RESULT	PairingPlus_Float(double dPitchSize);
+	DIT_RESULT	PairingMinus_Float(double dPitchsize);
+
+	DIT_RESULT	PairingPlus_Vert(double dPitchSize);
+	DIT_RESULT	PairingMinus_Vert(double dPitchsize);
+};
diff --git a/Lib/SISAssem/include/PixelStorage.h b/Lib/SISAssem/include/PixelStorage.h
new file mode 100644
index 0000000..2bc693c
--- /dev/null
+++ b/Lib/SISAssem/include/PixelStorage.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#include "AssemParam.h"
+
+class AFX_EXT_CLASS CPixelStorage
+{
+protected:
+	CConvParam	m_Param;
+public:
+	int		m_nPixel;
+
+	int		*m_pPixelX;
+	int		*m_pPixelY;
+	short	*m_pPixelType;
+	short	*m_pPixelValue;
+
+	int		*m_pGraySrc;
+	int		*m_pGrayCmp;
+	int		*m_pZoneID;
+	int		*m_pZoneTh;
+
+public:
+	int		m_nPixelSpace;
+	int		m_maxPixel;
+
+public:
+	CPixelStorage();
+	virtual ~CPixelStorage();
+
+public:
+	int		InitPixelStorage(int maxPixel= 10000);
+	void	SetConvParam(CConvParam *pParam);
+	void	ResetPixelStorage();
+	int		GetPixelCount(){return m_nPixel;}
+
+	int		GetThreadDefectPixelNum()		{ return m_nPixel; }
+	int		GetOverflowedPixelY()			{ return m_pPixelY[m_nPixel - 1]; }
+
+
+	int	GetPixelX(int i){return m_pPixelX[i];}
+	int	GetPixelY(int i){return m_pPixelY[i];}
+	int	GetPixelType(int i){return m_pPixelType[i];}
+	int	GetPixelValue(int i){return m_pPixelValue[i];}
+	int	GetPeak(int i){return m_pPixelValue[i];}
+	int	GetThreshold(int i){return m_pZoneTh[i];}
+	int	GetSrcGray(int i){return m_pGraySrc[i];}
+	int	GetCmpGray(int i){return m_pGrayCmp[i];}
+};
+
diff --git a/Lib/SISAssem/include/SISAssem.h b/Lib/SISAssem/include/SISAssem.h
new file mode 100644
index 0000000..b61e755
--- /dev/null
+++ b/Lib/SISAssem/include/SISAssem.h
@@ -0,0 +1,233 @@
+#pragma once
+
+#include "AssemParam.h"
+#include "BlobStorage.h"
+#include "AssemUtil.h"
+#include "SISStrg.h"
+#define ASSEM_CONVBUFFER_SIZE	1024*1024
+
+class CBlobStorage;
+class CSISAssem;
+
+
+
+class AFX_EXT_CLASS CAssemControl
+{
+	int				m_nThread;
+	int				m_nSpace;
+	CSISAssem		*m_pSISAssem;
+
+public:
+	CAssemControl();
+	~CAssemControl();
+
+public:
+	int				InitAssemControl(int nThread, int maxDefect= 10000);
+	void			ResetReinspectCount();
+
+public:
+	DIT_RESULT		Inspect_Rect(int iThread, CConvParam *pParam, BOOL bAsg= FALSE);//, class CDefectStorage *pDefectStorage, int iFrame, int iScan, int iModel, BOOL bCosmicFiler);
+	DIT_RESULT		Inspect_Trapezium(int iThread, CConvParam *pParam);//, class CDefectStorage *pDefectStorage, int iFrame, int iScan, int iModel, BOOL bCosmicFiler);
+	DIT_RESULT		Inspect_ASG(int iThread, CConvParam *pParam);
+	DIT_RESULT		ASGVertConvolution(int iThread, CConvParam *pParam);
+
+public:
+	CSISAssem*	GetSISAssem(int iThread);
+};
+
+// CSISAssem 郴俊辑 林绢柳 八荤 康开阑 盒且秦 Thread 盒且 八荤甫 角矫茄促.
+class CAssemThreadControl
+{
+	int				m_nThread;
+	int				m_nSpace;
+	CSISAssem		*m_pSISAssem;
+
+public:
+	CAssemThreadControl();
+	~CAssemThreadControl();
+	int				GetThreadCount(){return m_nThread;}
+	BOOL			InitAssemThreadControl(int nThread, int maxDefect);
+	DIT_RESULT		Inspect_RectThread(int iThread, CConvParam *pParam);//, class CDefectStorage *pDefectStorage, int iFrame, int iScan, int iModel, BOOL bCosmicFiler);
+
+	CSISAssem*	GetSISAssemThread(int iThread);
+};
+
+class AFX_EXT_CLASS CSISAssem	 : public CBlobStorage
+{
+public:
+	CAssemThreadControl	*m_pAssemControl;
+	int		m_iThread;
+	//	BOOL	m_bNowInspect;
+
+	double	m_ConvTime;
+	int		m_cReinspect;
+
+
+protected:
+	CSISBlock<short>	m_ConvBlock;
+	CSISBlock<short>	m_ConvBlock2;
+
+public:
+	CSISAssem(void);
+	~CSISAssem(void);
+
+public:
+
+	BOOL		InitAssem(int iThread, int maxDefect);
+	void		ResetReinspectCount()	{m_cReinspect= 0;}
+	void		ResetSISAssem();	// Inspect_Pre(); 甫 ResetSISAssem()栏肺 疙狼函版茄促.
+	void		InspectPAD_Clear();
+
+	BOOL		EnableInternalThread(int nThrea, int maxDefect);
+
+public:		// 寇何俊辑 八荤矫 龋免窍绰 角力 牢磐其捞胶[老访狼 八荤 苞沥(Reset, Check Validity, Inspect, PostProcess..]阑 郴何俊辑 器窃茄促]
+	DIT_RESULT	Inspect_Rect(CConvParam *pParam);
+	DIT_RESULT	Inspect_RectThread(CConvParam *pParam);
+	DIT_RESULT	Inspect_Trapezium(CConvParam *pParam);
+	DIT_RESULT	Inspect_ASG(CConvParam *pParam);	// Asg俊 Zone 八荤啊 眠啊登搁辑 Inspect 拌凯俊 Inspect_ASG() 眠啊
+
+public:
+	void		CountReinspect()	{m_cReinspect++;}
+
+public:
+	DIT_RESULT	CheckParameter(BOOL &bNoInspect);
+	DIT_RESULT	CheckParameter_Vert(BOOL &bNoInspect);
+
+public:// Assem 龋免阑 烹秦 角力 八荤 Control窍绰 窃荐甸. Assem殿 角力 八荤 风凭阑 眠啊 窍妨芭电 捞率 拌凯肺 荤侩茄促.
+	int			Compare_Float();
+	int			Compare_Pixel();
+	void		Compare_Zone();			// Compare_Zone2(); 肺 措眉
+	int			Compare_Zone2();		//  Zone 喊 促捞唱雇 Threshold 眠啊等 滚傈.
+	void		Compare_Trapezium();
+	int			Compare_ASGZone();
+	int			BinalizeInspection();
+
+
+protected:// 八荤俊 荤侩瞪 捞固瘤甫 困茄 吝埃 滚欺 Control
+	void		ResetConBuff(int &InspSize);			// 技肺规氢 厚背甫 困秦 16硅狼 傍埃 荤侩
+	short*		GetConBuffComp(){return m_ConvBlock.GetDataAddr();};
+	short*		GetConBuffComp2(){return m_ConvBlock2.GetDataAddr();};
+
+public:
+	DIT_RESULT		ASGVertConvolution(CConvParam *pParam);
+
+public:
+	int				BinalizeInspection(BYTE *pSrc, int nThresS, int nThresE, CRect rtROI
+									,int nWidth, CDefectPair *pDefectdPair, int nStartPair, int nMaxPair
+									,int &nEndLine);
+
+	int				ConvFloatVert_BOE_Intrin(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+									, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 i2Pitch16, __int64 bReverseFilter, __int64 ThresholdSlide, int* endLine
+									);
+	int				ConvFloatVTD_BOE_Intrin(BYTE* pImgBuff, short* pConBuff, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectType, short* DefectValue
+									, CDefectPair *pDefectdPair, __int64 nPair, __int64 MaxPair, __int64 PairSize
+									, __int64 frameWidth, __int64 iPitch16, __int64 Threshold, __int64 Suppress
+									, short*  i2Pitch16, __int64 tilt16, int* PitchBuff, __int64 ThresholdSlide
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, int* endLine
+									);
+	int				ConvZoneVert2S_BOE_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+									, __int64 ExTh, __int64 Suppress
+									);
+	int				ConvZoneVert2S_TSP_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+									, __int64 ExTh, __int64 Suppress
+									);
+	int				ConvZoneVert2S_BlackFilter(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, short* ZoneAddTable, short* pConBuff, __int64 bUseUnpair, int* endLine
+									, __int64 ExTh, __int64 Suppress
+									);
+	int				ConvZoneVTD_BOE_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, int* piPitch16, __int64 iPitch16, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, short* ZoneAddTable, __int64 Tilt16, __int64 bUseUnpair, int* endLine
+									, __int64 ExTh, __int64 Suppress
+									);
+	int				ConvPixelVertS_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+									, int* endLine, __int64 ExTh);
+	int				ConvPixelVTDS_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, int* piPitch16, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+									, int* endLine, __int64 ExTh
+									);
+	int				ConvPixel_Intrin(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, int* endLine
+									);
+	int				ConvPixel_Intrin_Twice(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte,  __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, int* endLine
+									, __int64 iPitch2, __int64 Threshold2, __int64 ThresholdSlide2);
+	int				ConvPixelVertS_Intrin_Twice(BYTE *pImgBuff, __int64 Threshold, __int64 maxDefect, __int64 nDefect
+									, __int64 left, __int64 right, __int64 top, __int64 bottom
+									, int* DefectX, int* DefectY, short* DefectT, short* DefectValue
+									, int* pGraySrc, int* pGrayCmp, int* pZoneID, int* pZoneTh
+									, __int64 frameWidth, __int64 iPitch16, __int64 fSPR, __int64 sSPR
+									, short* ZoneThTable, short* ZoneIdTable, __int64 ZoneTableWidth, void* pMatchTable
+									, CDefectPair *pDefectdPair, __int64 StartPair, __int64 MaxPair, __int64 PairSize
+									, __int64 dxPattern, __int64 dyPattern, __int64 yZoneByte, __int64 bReverseFilter
+									, __int64 ThresholdSlide, __int64 ThresholdSuppress, __int64 bUseUnpair, short* pConBuff
+									, int* endLine, __int64 ExTh, __int64 iPitch2, __int64 Threshold2
+									, __int64 ThresholdSlide2);
+};
+
diff --git a/Lib/SISAssem/include/SISStrg.h b/Lib/SISAssem/include/SISStrg.h
new file mode 100644
index 0000000..b2f54ee
--- /dev/null
+++ b/Lib/SISAssem/include/SISStrg.h
@@ -0,0 +1,163 @@
+#pragma once
+
+
+
+template<typename T>
+class CSISStrg
+{
+	int m_nSpace;
+	int	m_Width, m_Height;
+	T*	m_pData;
+public:
+	CSISStrg()
+	{
+		m_pData= NULL;
+		m_Width= m_Height= m_nSpace= 0;
+	}
+	~CSISStrg()
+	{
+		if(m_pData)
+			delete[] m_pData;
+	}
+	BOOL	SetStrgSize(int w, int h)
+	{
+		if(w < 1) w= 1;
+		if(h < 1) h= 1;
+
+		int size= w*h;
+		if(size <= m_nSpace)
+		{
+			m_Width= w;
+			m_Height= h;
+			return TRUE;
+		}
+		if(m_pData)
+			delete[] m_pData;
+
+		m_pData= new T[size];
+		m_nSpace= m_Width= m_Height= 0;
+		if(! m_pData)	return FALSE;
+
+		m_nSpace= size;
+		m_Width= w;
+		m_Height= h;
+		return TRUE;
+	}
+};
+
+template<typename T>
+class CSISBlock
+{
+public:
+	CSISBlock()
+	{
+		m_pData= NULL;
+		m_nData= m_nSpace= 0;
+		ResetBlock();
+	}
+	~CSISBlock()
+	{
+		if(m_pData)
+			delete[] m_pData;
+	}
+
+public:
+	int	m_iData;
+	int m_nSpace;
+	int m_nData;
+	T	*m_pData;
+public:
+	BOOL	SetBlockSize(int size)
+	{
+		if(size <= 1)
+			size= 1;
+
+		if(size <= m_nSpace)
+		{
+			m_nData= size;
+			return TRUE;
+		}
+		if(m_pData)
+			delete[] m_pData;
+
+		m_pData= new T[size];
+		m_nSpace= m_nData= 0;
+		if(! m_pData)	return FALSE;
+
+		m_nSpace= size;
+		m_nData= size;
+		return TRUE;
+	}
+	void	ResetBlock()	{ m_iData= 0;	}
+	T*	GetData(int i)	{return (m_pData+ i);}
+	T*	GetDataAddr()	{return m_pData;}
+	int GetDataCount()	{return m_iData;}
+	int GetValidDataSpace()	{return m_nData;}
+	int GetDataSpace()	{return m_nSpace;}
+	int GetDataIndex()	{return m_iData;}
+
+	T*	GeCurData()		{return m_pData+ m_iData;}
+	int	AddDataCount()	{if(m_iData< m_nData-1) ++m_iData; return m_iData;}
+	void	AddBlock(T &data)
+	{
+		if(m_iData < m_nData)
+		{
+			m_pData[m_iData++]= data;
+		}
+	}
+};
+
+template<typename T>
+class CSISStack
+{
+public:
+	CSISStack()
+	{
+		m_pData= NULL;
+		m_nData= m_nSpace= 0;
+	}
+	~CSISStack()
+	{
+		if(m_pData)
+			delete[] m_pData;
+	}
+
+protected:
+	int m_nSpace;
+	int m_nData;
+	T	*m_pData;
+
+public:
+	BOOL	SetStackSize(int size)
+	{
+		if(size <= 1)
+			size= 1;
+
+		if(size <= m_nSpace)
+		{
+			m_nData= size;
+			return TRUE;
+		}
+		if(m_pData)
+			delete[] m_pData;
+
+		m_pData= new T[size];
+		m_nSpace= m_nData= 0;
+		if(! m_pData)	return FALSE;
+
+		m_nSpace= size;
+		m_nData= size;
+		return TRUE;
+	}
+	T*	GetStackData(int i)	{return (m_pData+ i);}
+	T*	GetStackDataAddr()	{return m_pData;}
+	int	GetStackDataCount()	{return m_nData;}
+
+};
+
+
+template<typename T>
+class CPointerBox
+{
+
+};
\ No newline at end of file
diff --git a/Lib/SISBuffer/include/Broadcast.h b/Lib/SISBuffer/include/Broadcast.h
new file mode 100644
index 0000000..fa15c59
--- /dev/null
+++ b/Lib/SISBuffer/include/Broadcast.h
@@ -0,0 +1,41 @@
+#if !defined(AFX_BROADCAST_H__180A3328_BAE3_4BA3_92F8_4F7C54938BC1__INCLUDED_)
+#define AFX_BROADCAST_H__180A3328_BAE3_4BA3_92F8_4F7C54938BC1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// Broadcast.h : header file
+//
+
+#include <vector>
+
+class CAudience
+{
+public:
+	virtual void OnAir(int channel, int program, void* pContent)= 0;
+};
+
+class CBroadcast
+{
+	std::vector<CAudience*> audiences;
+public:
+	void Register(CAudience* pAucience)
+	{
+		audiences.push_back(pAucience);
+	}
+
+	int Broadcast(int channel, int program, void* pContent)
+	{
+		std::vector<CAudience*>::iterator iter;
+		iter= audiences.begin();
+		while(iter != audiences.end())
+		{
+			(*iter)->OnAir(channel, program, pContent);
+			iter++;
+		}
+		return audiences.size();
+	}
+};
+
+
+#endif // !defined(AFX_BROADCAST_H__180A3328_BAE3_4BA3_92F8_4F7C54938BC1__INCLUDED_)
diff --git a/Lib/SISBuffer/include/InspectionBuffer.h b/Lib/SISBuffer/include/InspectionBuffer.h
new file mode 100644
index 0000000..6a474ec
--- /dev/null
+++ b/Lib/SISBuffer/include/InspectionBuffer.h
@@ -0,0 +1,498 @@
+// InspectionBuffer.h: interface for the CSISBuffer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_INSPECTIONBUFFER_H__16133B59_E7ED_46D2_9FCE_FF4D0A62B052__INCLUDED_)
+#define AFX_INSPECTIONBUFFER_H__16133B59_E7ED_46D2_9FCE_FF4D0A62B052__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+struct stBufferSize;
+class CSISBuffer;
+class CShiftBuffer;
+class CCropBuffer;
+class CCopyBuffer;
+class CFileBuffer;
+class COwnerBuffer;
+struct stImageFileHeader;
+class CBufferAttach;
+class CFrameSave;
+class CFrameSave_OneFile;
+class CSISImageBuffer;
+
+
+// 滚欺狼 荤捞令 包访 沥焊 备炼眉.
+struct AFX_EXT_CLASS stBufferSize
+{
+	int		m_Width, m_Height;
+	int		m_DataWidth;
+public:
+	stBufferSize(int width= 0, int height= 0)
+	{
+		SetSize(width, height);
+	}
+	stBufferSize(stBufferSize& size)
+	{
+		SetSize(size.GetWidth(), size.GetHeight());
+	}
+	stBufferSize(stBufferSize* pSize)
+	{
+		SetSize(pSize->GetWidth(), pSize->GetHeight());
+	}
+
+public:
+	int GetWidth(){return m_Width;}
+	int GetHeight(){return m_Height;}
+	int GetDataWidth(){return m_DataWidth;}
+	UINT GetDataSize(){return (UINT)GetDataWidth()*GetHeight();}
+
+public:
+	static int ChangeDataWidth(int width){return (width+ 3)/4*4;}
+	void SetSize(int width, int height)
+	{
+		m_Width= width;
+		m_Height= height;
+		m_DataWidth= ChangeDataWidth(width);//(width+ 3)/4*4 ;
+	}
+};
+
+
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 八荤 滚欺 漂己惑 boundary甫 逞绰 单捞磐 立辟档 啊瓷窍档废 汲拌凳. 付捞呈胶 x, y, 棺 width, height甫 逞绢辑绰 x, y 侨伎肺狼 立辟捞 啊瓷窍促.
+// 拱沸 皋葛府俊 粮犁窍瘤 臼栏搁 桓绢滚府摆瘤.. 滚欺俊辑 肋 炼例秦辑 荤侩秦具 茄促.
+
+class  AFX_EXT_CLASS  CSISBuffer
+{
+protected:
+	BYTE * m_pData;
+	int m_Width, m_DataWidth;
+	int m_Height;
+
+public:
+	CSISBuffer()
+		:m_pData(NULL)
+	{SetSize(0, 0);}
+	CSISBuffer(BYTE* pData_, int w, int h)
+		: m_pData(pData_)
+	{		SetSize(w, h);	}
+	virtual ~CSISBuffer()
+	{	};
+
+
+	virtual BOOL SetSize(int w, int h)
+	{
+		m_Width= w;
+		m_Height= h;
+		m_DataWidth= CSISBuffer::ChangeDataWidth(w);//(m_Width+ 3)/4*4;
+		return TRUE;
+	}
+	void ChangeData(BYTE* pd)	{ m_pData= pd;	}
+	void SetBuffer(BYTE* pData_, int w, int h)
+	{
+		ChangeData(pData_);
+		SetSize(w, h);
+	}
+	void MemSet(BYTE val);
+	void RotateImage();
+public:
+	BYTE * GetDataAddress(){return m_pData;}
+	BYTE* GetDataAddress(int x, int y){return m_pData+ GetDataWidth()*y+ x;};
+
+	virtual CRect GetAvailableInspectRect(CRect requestRect)
+	{
+		CRect rect;
+		rect.SetRect(1, 1, GetWidth()- 1, GetHeight()- 1);
+		rect.IntersectRect(rect, requestRect);
+		return rect;
+	}
+	CRect IntersectRect(CRect &rect);// RECT甫 滚欺 农扁俊 嘎霸 犁 汲沥. Return Value绰 rect啊 滚欺甫 哈绢车栏搁 false, 酒聪搁 true
+	int GetSize(){return GetWidth()*GetHeight();}
+	int GetDataSize(){return GetDataWidth()*GetHeight();}
+	int GetWidth(){ return m_Width;}
+	int GetDataWidth(){ return m_DataWidth;}
+	int GetHeight(){return m_Height;}
+	BYTE GetPixel(int idx){return GetPixel(idx%GetDataWidth(), idx/GetDataWidth());};
+	BYTE GetPixel(int x, int y){ return *(m_pData+ x+ y*GetDataWidth());}
+	BYTE GetPixel(double fx, int y);
+	BYTE GetPixel(int x, double fy);
+	void SetPixel(int x, int y, BYTE value){*(GetDataAddress(x, y))= value;}
+	BOOL SetValidPixel(int x, int y, BYTE value){if(! IsValidPixel(x, y)) return FALSE; SetPixel(x, y, value); return TRUE;}
+
+	int GetDiff32(int x, int y, double xPitch);
+	int	GetDiff23(int x, int y, double yPitch);
+
+	int GetXDiff22(int x, int y, double xPitch);
+	int GetYDiff22(int x, int y, double yPitch);
+
+	int GetVar(int x, int y, int min);
+
+	float GetMeanBright();
+	void AdjustBright(CSISBuffer &buffer);
+	void FlipUpDown();
+	BOOL IsValidBuffer();
+	virtual BOOL IsValidPixel(int x, int y)
+	{
+		return x >= 0 && y >= 0 && x < m_Width && y < m_Height;
+	}
+
+	static BOOL CopyBtoA(CSISBuffer &aBuffer, int x, int y, CSISBuffer &bBuffer, CRect &rectFrom);
+	static int ChangeDataWidth(int width){return (width+ 3)/4*4;}
+
+	BOOL Contains(CRect &rect)
+	{
+		if(rect.left < 0)	return FALSE;
+		if(rect.top < 0)	return FALSE;
+		if(rect.right > GetWidth())		return FALSE;
+		if(rect.bottom > GetHeight())	return FALSE;
+
+		return TRUE;
+	}
+};
+
+
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 盔贰 林家 甫 滚府绊 x, y父怒 滚欺甫 shift秦辑 荤侩且 荐 乐霸 秦霖促.
+// 盔贰 林家 眉拌啊 秦寸 滚欺 客 shift x, y 焊促绰 农促绰 啊沥窍俊 荤侩啊瓷.
+class  AFX_EXT_CLASS  CShiftBuffer : public CSISBuffer
+{
+	int x, y;// x客 y绰 pitch 父怒 捞悼茄 芭瘤..
+public:
+	CShiftBuffer(CSISBuffer& iBuffer, int x_, int y_)
+		: CSISBuffer(iBuffer.GetDataAddress(), iBuffer.GetWidth(), iBuffer.GetHeight()), x(x_), y(y_)
+	{
+		m_pData = GetDataAddress(x, y);
+
+		CRect	rect(0, 0, GetWidth(), GetHeight());
+		CRect	rectShift = rect;
+		rectShift.OffsetRect(x, y);
+		
+		rect.IntersectRect(rectShift, rect);
+	}
+	virtual CRect GetAvailableInspectRect(CRect requestRect)
+	{
+		CRect rect;
+		rect.SetRect(1, 1, GetWidth()- x- 1, GetHeight()- y- 1);
+		rect.IntersectRect(rect, requestRect);
+		return rect;
+	}
+	virtual BOOL IsValidPixel(int xx, int yy)
+	{
+		xx= xx- x;
+		yy= yy- y;
+		return CSISBuffer::IsValidPixel(xx, yy);
+	}
+
+};
+
+// 2008-08-28, miniont, begin
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 盔贰 林家, width, height 甫 滚府绊 rectROI 农扁狼 滚欺牢巴 贸烦 悼累窍霸 茄促.
+// 奴 滚欺甫 付摹 累篮 滚欺牢剧 悼累窍霸 窍绰 滚欺.
+class  AFX_EXT_CLASS  CCropBuffer : public CSISBuffer
+{
+	int x, y;// x客 y绰 pitch 父怒 捞悼茄 芭瘤..
+public:
+	CCropBuffer() : CSISBuffer(NULL, 0, 0){};
+	CCropBuffer(CSISBuffer& iBuffer, CRect &rectROI)
+		: CSISBuffer(iBuffer.GetDataAddress(rectROI.left, rectROI.top), rectROI.Width(), rectROI.Height()), x(rectROI.left), y(rectROI.top)
+	{
+		CRect	rectImage(0, 0, iBuffer.GetWidth(), iBuffer.GetHeight());
+
+		CRect	rectBoundaryChecked;
+		rectBoundaryChecked.IntersectRect(rectROI, rectImage);
+
+		m_Width = rectBoundaryChecked.Width();		
+		m_Height = rectBoundaryChecked.Height();	
+		m_DataWidth = iBuffer.GetDataWidth();
+		x = rectROI.left;
+		y = rectROI.top;
+	}
+	void DoCrop(CSISBuffer& iBuffer, CRect &rectROI)
+	{
+		SetBuffer(iBuffer.GetDataAddress(rectROI.left, rectROI.top), rectROI.Width(), rectROI.Height());
+		x= rectROI.left;
+		y= rectROI.top;
+		CRect	rectImage(0, 0, iBuffer.GetWidth(), iBuffer.GetHeight());
+		CRect	rectBoundaryChecked;
+		rectBoundaryChecked.IntersectRect(rectROI, rectImage);
+		m_Width = rectBoundaryChecked.Width();		
+		m_Height = rectBoundaryChecked.Height();	
+		m_DataWidth = iBuffer.GetDataWidth();
+	}
+	int GetX(){return x;}
+	int GetY(){return y;}
+	virtual BOOL IsValidPixel(int xx, int yy)
+	{
+		xx= xx- x;
+		yy= yy- y;
+		return CSISBuffer::IsValidPixel(xx, yy);
+	}
+};
+
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 促弗 滚欺俊辑 单捞磐甫 啊廉客辑 夯 滚欺俊 墨乔茄促.
+class  AFX_EXT_CLASS CCopyBuffer : public CSISBuffer
+{
+public:
+	CCopyBuffer(CSISBuffer& buffer)
+		: CSISBuffer(buffer.GetDataAddress(), buffer.GetWidth(), buffer.GetHeight())
+	{
+		m_DataWidth= buffer.GetDataWidth();
+	}
+	CCopyBuffer(unsigned char *pData_, int width, int height)
+		: CSISBuffer(pData_, width, height)
+	{
+	}
+	CCopyBuffer(int width, int height)
+		: CSISBuffer(NULL, width, height)
+	{
+	}
+	CCopyBuffer()
+		: CSISBuffer(NULL, 0, 0)
+	{
+	}
+
+public:
+	BOOL FillBufferCenter(CSISBuffer &buffer, double xx, double yy)
+	{
+		return FillBuffer(buffer, xx- GetWidth()/2, yy- GetHeight()/2);
+	}
+	BOOL FillBuffer(CSISBuffer &buffer, double xx, double yy);
+	BOOL FillBufferCenter(CSISBuffer& buffer, int x, int y)
+	{
+		return FillBuffer(buffer, x- GetWidth()/2, y- GetHeight()/2);
+	}
+	BOOL FillBuffer(CSISBuffer& buffer, int x, int y);
+};
+
+
+// 林家, width, height 父阑 啊瘤绊 促剧茄 贸府甫 窍扁困茄 扁瓷 努贰胶捞促. 单捞磐甫 角力 家蜡窍瘤 臼绰促.
+// 颇老俊辑 单捞磐甫 啊廉客辑 夯 滚欺俊 墨乔茄促.
+class  AFX_EXT_CLASS  CFileBuffer : public CSISBuffer
+{
+public:
+	CFileBuffer(CSISBuffer &buffer)
+		:CSISBuffer(buffer.GetDataAddress(), buffer.GetWidth(), buffer.GetHeight())
+	{
+		m_DataWidth= buffer.GetDataWidth();
+	}
+	CFileBuffer(int width, int height)
+		: CSISBuffer(NULL, width, height)
+	{
+	}
+
+	CFileBuffer(unsigned char *pData_, int width, int height)
+		: CSISBuffer(pData_, width, height)
+	{
+	}
+
+	// miniont, 2008-8-28, end
+public:
+	void FillBuffer(CFile &file, int x, int y, int oWidth, int oHeight);
+	void FillBufferReverse(CFile &file, int x, int y, int oWidth, int oHeight);		// miniont, 2008-09-10
+	void FillBufferFromTwoFile(CFile &file1, CFile &file2, int x, int y, int FirstHeight, int SecondHeight, int oWidth, int oHeight);		// miniont, 2008-09-29
+	void SaveBufferToTwoFile(CFile &file1, CFile &file2, int x, int y, int FirstHeight, int SecondHeight, int oWidth, int oHeight);		// miniont, 2008-11-24
+
+	const int GetContentWidth(CFile &file);															// miniont, 2008-09-04
+	const int GetContentHeight(CFile &file);
+	
+	static BITMAPINFOHEADER GetBitmapInfoHeader(CFile &file);
+	// miniont, 2008-09-04
+
+public:
+// 	CFile m_File;
+// 	BITMAPINFOHEADER m_InfoHeader;
+// 	BOOL ReadBuffer(CSISBuffer &buffer, int x, int y, int width, int height);
+// 	BOOL WriteBuffer(CSISBuffer &buffer, int x, int y, int width, int height);
+};
+
+
+// 蜡老窍霸 磊脚狼 单捞磐甫 皋葛府俊 父甸绢 郴绰 扁瓷阑 茄促.
+// 促弗 滚欺 贸府 扁瓷阑 窍扁 困秦辑 夯滚欺甫 copy滚欺唱 shift滚欺, file滚欺殿俊 积己磊肺 逞败林搁 等促.
+class AFX_EXT_CLASS COwnerBuffer : public CSISBuffer
+{
+	int m_DataSpace;
+public:
+	COwnerBuffer(int ww= 0, int hh= 0);
+	virtual ~COwnerBuffer();
+	virtual BOOL SetSize(int ww, int hh);
+	void ReleaseSpace();
+};
+
+
+#include <pshpack2.h>
+
+struct AFX_EXT_CLASS stImageFileHeader
+{
+#define DIB_HEADER_MARKER   ((WORD) ('M' << 8) | 'B')
+	BITMAPFILEHEADER	fileHeader;
+	BITMAPINFOHEADER	infoHeader;
+	RGBQUAD				quad[256];
+
+	stImageFileHeader()
+	{
+		fileHeader.bfType = DIB_HEADER_MARKER;  // "BM"
+		fileHeader.bfReserved1 = 0;
+		fileHeader.bfReserved2 = 0;
+		
+		infoHeader.biSize = 40;// sizeof(BITMAPINFOHEADER)
+		infoHeader.biWidth = 0;
+		infoHeader.biHeight = 0;
+		infoHeader.biPlanes = 1;
+		infoHeader.biBitCount = 8;
+		infoHeader.biCompression = 0;
+		infoHeader.biSizeImage = 0;
+		infoHeader.biXPelsPerMeter = 2923;
+		infoHeader.biYPelsPerMeter = 2923;
+		infoHeader.biClrUsed = 0;
+		infoHeader.biClrImportant = 0;
+
+
+		fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256;
+		fileHeader.bfSize = fileHeader.bfOffBits + infoHeader.biSizeImage;
+
+		int i;
+		for(i= 0; i< 256; i++)
+		{
+			quad[i].rgbRed= i;
+			quad[i].rgbGreen= i;
+			quad[i].rgbBlue= i;
+			quad[i].rgbReserved= 0;
+		}
+	}
+
+public:
+	BOOL IsValidHeader()	{	return infoHeader.biWidth > 0;	}// IsValid()
+	int GetWidth()	{	return infoHeader.biWidth;	}
+	int GetHeight()	{	return infoHeader.biHeight;	}
+	UINT GetDataOffset(){	return fileHeader.bfOffBits;}
+	UINT GetDataSize(){	return infoHeader.biSizeImage;}
+
+	void ChangeSize(int width, int height)// void ChangeHeader(int width, int height)
+	{
+		infoHeader.biWidth = width;
+		infoHeader.biHeight = height;
+		stBufferSize bufferSize(width, height);
+		infoHeader.biSizeImage = bufferSize.GetDataSize();//width*height*1;
+
+//		fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256;
+		fileHeader.bfSize = fileHeader.bfOffBits + infoHeader.biSizeImage;
+	}
+
+	void ReadFromFile(CString &fileName)
+	{
+		CFile file;
+		file.Open(fileName, CFile::modeCreate | CFile::typeBinary);
+		ReadFromFile(file);
+		file.Close();
+	}
+	void ReadFromFile(CFile &file)
+	{
+		file.Seek(0, SEEK_SET);
+		file.Read(&fileHeader, sizeof(BITMAPFILEHEADER));
+		file.Read(&infoHeader, sizeof(BITMAPINFOHEADER));
+		file.Read(quad, sizeof(RGBQUAD)*256);
+		ChangeSize(infoHeader.biWidth, infoHeader.biHeight);
+	}
+	BITMAPINFO* GetBitmapInfo(){return (BITMAPINFO*) &infoHeader;}
+};
+#include <poppack.h>
+
+
+// 林绢柳 捞抚狼 颇老阑 瘤快绊 货肺 积己茄促.
+// 积己磊 龋免且锭 林狼 秦扼...せせせ.
+// AttachToFile 窃荐啊 龋免瞪锭付促 捞固瘤甫 眠啊茄促.
+class  AFX_EXT_CLASS CBufferAttach
+{
+	CString m_FileName;
+	stImageFileHeader *m_pImageFileHeader;
+	int		m_bFileMade;
+public:
+	CBufferAttach(CString &name);
+	~CBufferAttach();
+public:
+	void	AttachToFile(CSISBuffer &buffer);
+protected:
+	BOOL	MakeFile();
+};
+
+
+
+// 橇饭烙 窜困肺 捞固瘤甫 历厘窍扁 困茄 努贰胶.
+class AFX_EXT_CLASS CFrameSave
+{
+	int iStartFrame;
+	stImageFileHeader *pImageFileHeader;
+	CString strDir;
+	
+public:
+	CFrameSave(CString &strDir_, int startFrame, int width= 8192, int height= 1024);
+	~CFrameSave();
+	
+public:
+	void SaveFrame(BYTE *m_pData, int iFrame);
+	void SaveFrame(BYTE *m_pData, int iScan, int iFrame, int cell, int bottom);
+};
+
+
+// 滚欺甫 鉴瞒利栏肺 颇老俊 历厘窍扁 困茄 努贰胶.
+class AFX_EXT_CLASS  CFrameSave_OneFile
+{
+	CBufferAttach *pBufferAttach;
+	int width, height;
+	
+	// 历厘阑 矫累窍妨绊 窍绰 滚欺 牢郸胶.
+	int	idStartFrame;
+	
+	// 历厘且 橇饭烙 荐 棺 历厘茄 橇饭烙 荐.
+	int nSaveFrame;
+	int iSaveFrame;
+	
+	
+public:
+	CFrameSave_OneFile(CString &fileName_, int startFrame, int saveFrame, int width_= 8192, int height_= 1024);
+	~CFrameSave_OneFile();
+public:
+	void SaveFrame(int iFrame, CSISBuffer &frameBuffer);
+};
+
+
+
+class AFX_EXT_CLASS  CDynamicBuffer : public COwnerBuffer
+{
+	
+public:
+	void FillBuffer(CSISBuffer &buffer, CRect &rect);
+};
+
+
+// width, height 父怒狼 滚欺甫 悼利栏肺 积己 茄促.
+class  AFX_EXT_CLASS  CSISImageBuffer : public CSISBuffer
+{
+// 	BYTE * m_pData;
+// 	int	m_Width, m_Height;
+	int m_DataSpace;
+	stImageFileHeader *m_pFileHeader;
+
+public:
+	CSISImageBuffer();
+	~CSISImageBuffer();
+public:
+	stImageFileHeader* GetFileHeader()	{		return m_pFileHeader;	}
+	
+public:
+//	stBufferSize GetSize(){return stBufferSize(m_Width, m_Height);}
+//	int GetWidth(){return m_Width;}
+//	int GetHeight(){return m_Height;}
+
+	virtual BOOL SetSize(int ww, int hh);
+
+	void ReleaseImage();
+	BOOL ReadFromFile(CString &fileName);
+};
+
+
+
+#endif // !defined(AFX_INSPECTIONBUFFER_H__16133B59_E7ED_46D2_9FCE_FF4D0A62B052__INCLUDED_)
diff --git a/Lib/SISBuffer/include/NoiseLevel.h b/Lib/SISBuffer/include/NoiseLevel.h
new file mode 100644
index 0000000..1fc3b4f
--- /dev/null
+++ b/Lib/SISBuffer/include/NoiseLevel.h
@@ -0,0 +1,148 @@
+// NoiseLevel.h: interface for the CNoiseLevel class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_NOISELEVEL_H__5D3B57CE_14F1_4CD6_8D25_25471A55B874__INCLUDED_)
+#define AFX_NOISELEVEL_H__5D3B57CE_14F1_4CD6_8D25_25471A55B874__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+class CSISBuffer;
+typedef unsigned char BYTE;
+
+// 1. FindXNoiseLevel 拌凯肺 Noise甫 单捞磐 犬焊.
+// 2. RecommendThreshold(1, 2, 3) 3啊瘤 规过栏肺 Threshold 档免.
+
+
+class AFX_EXT_CLASS CNoiseLevel  
+{
+public:
+	int m_TotalCount;
+	int	m_OverCount;
+	double	m_Ratio;
+	int	m_LimitCount;
+	int m_pnNoisePixel[256];
+	int m_FoundThreshold;
+	int	m_Width, m_Height;
+
+	void ResetCount()
+	{
+		for(int i= 0; i< 256; i++)
+		{
+			m_pnNoisePixel[i]= 0;
+		}
+		m_TotalCount= 0;
+		m_FoundThreshold= -1;
+	}
+	int GetNoiseCount(int level)
+	{
+		if(level < 0)
+			level= -level;
+		ASSERT(level < 256);
+		return m_pnNoisePixel[level];
+	}
+	int CountNoise(int level)
+	{
+		if(level < 0)
+			level= -level;
+		ASSERT(level < 256);
+		m_pnNoisePixel[level]++;
+		m_TotalCount++;
+		return m_pnNoisePixel[level];
+	}
+
+
+public:
+	// 1. 畴捞令啊 奴 巴何磐 沤祸秦 limitCount 焊促 臭篮 痢捞 惯积窍搁 Threshold肺 眠玫.. 柄昌茄 捞固瘤俊 利钦.
+	int RecommendThreshold1(double fNoiseLimit= 0.001)
+	{
+		m_LimitCount= (int)(m_TotalCount*fNoiseLimit);
+		if(m_LimitCount < 1)
+			m_LimitCount= 1;
+		return RecommendThreshold(m_LimitCount);
+	}
+	int RecommendThreshold(int nLimitCount)
+	{
+		m_OverCount= 0;
+		for(int i= 255; i>= 0; i--)
+		{
+			m_OverCount+= m_pnNoisePixel[i];
+			if(m_pnNoisePixel[i] >= nLimitCount)
+			{
+				m_OverCount-= m_pnNoisePixel[i];
+				m_FoundThreshold= i;
+				return m_FoundThreshold;
+			}
+		}
+		m_FoundThreshold= 0;
+		return 0;
+	}
+
+	// 2. 畴捞令啊 累篮 巴何磐 矫累秦 limitcount捞窍肺 冻绢瘤扁 矫累窍绰 痢阑 茫绰促... 畴捞令 腹篮 捞固瘤俊 利钦.
+	int RecommendThreshold2(double fNoiseLimit= 0.001)
+	{
+		m_OverCount= m_TotalCount;
+		m_LimitCount= (int)(m_TotalCount*fNoiseLimit);
+		if(m_LimitCount < 1)
+			m_LimitCount= 1;
+		for(int i= 0; i< 256; i++)
+		{
+			m_OverCount-= m_pnNoisePixel[i];
+			if(m_pnNoisePixel[i] <= m_LimitCount)
+			{
+				m_FoundThreshold= i;
+				return i;
+			}
+		}
+		m_FoundThreshold= 0;
+		return 0;
+	}
+
+	// 3. 畴捞令啊 臭篮 率俊辑 何磐 穿利利栏风促啊 拌魂秦辑 limitcount甫 逞绰 仇阑 Threshold肺 眠玫. 救傈户俊 利钦.
+	int RecommendThreshold3(double fNoiseLimit= 0.001)
+	{
+		m_LimitCount= (int)(m_TotalCount*fNoiseLimit);
+		if(m_LimitCount < 1)
+			m_LimitCount= 1;
+		return RecommendThresholdAccumulative(m_LimitCount);
+	}
+	// Threshold甫 撤苗啊搁 nNoiseLimet 俺荐 捞惑狼 搬窃 侨伎捞 惯积窍搁 弊 急阑 Threshold肺 茄促.
+	int RecommendThresholdAccumulative(int nLimitCount)
+	{
+		int nCount= 0;
+		for(int i= 255; i>= 0; i--)
+		{
+			nCount+= m_pnNoisePixel[i];
+			if(nCount >= nLimitCount)
+			{
+				m_OverCount= nCount-  m_pnNoisePixel[i];
+				m_FoundThreshold= i;
+				return i;
+			}
+		}
+		m_FoundThreshold= 0;
+		return 0;
+	}
+
+public:
+	CNoiseLevel()			{ResetCount();}
+
+	BOOL FindXNoiseLevel(CSISBuffer &buffer, double xPitch, BOOL b32= TRUE);
+	BOOL FindYNoiseLevel(CSISBuffer &buffer, double yPitch, BOOL b23= TRUE);
+
+	BOOL DrawNoisePixel2Left(CSISBuffer &buffer, CSISBuffer &buffer2, double pitch, int threshold, BYTE color, BOOL b32= TRUE);
+	BOOL DrawNoisePixel2Right(CSISBuffer &buffer, CSISBuffer &buffer2, double pitch, int threshold, BYTE color, BOOL b32= TRUE);
+	BOOL DrawNoisePixel2Top(CSISBuffer &buffer, CSISBuffer &buffer2, double pitch, int threshold, BYTE color, BOOL b23= TRUE);
+	BOOL DrawNoisePixel2Bottom(CSISBuffer &buffer, CSISBuffer &buffer2, double pitch, int threshold, BYTE color, BOOL b23= TRUE);
+	void DrawNoiseLevel(CDC *pDC);
+
+	//////////////////////////////////////////////////////////////////////////
+	// Focus Value
+	int	CalFocusValue(CSISBuffer &buffer);
+
+};
+
+#endif // !defined(AFX_NOISELEVEL_H__5D3B57CE_14F1_4CD6_8D25_25471A55B874__INCLUDED_)
diff --git a/Lib/SISBuffer/include/SISMatch.h b/Lib/SISBuffer/include/SISMatch.h
new file mode 100644
index 0000000..883616e
--- /dev/null
+++ b/Lib/SISBuffer/include/SISMatch.h
@@ -0,0 +1,99 @@
+// SISMatch.h: interface for the CSISMatch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MOSISMATCH_H__CB8CE1CD_6F94_4C2E_858D_8182CEF9A453__INCLUDED_)
+#define AFX_MOSISMATCH_H__CB8CE1CD_6F94_4C2E_858D_8182CEF9A453__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "InspectionBuffer.h"
+
+
+
+typedef struct stSISMatchResult
+{
+	double m_X, m_Y, m_Score;
+	stSISMatchResult()	{	Invalidate();	}
+	void Invalidate()		{ m_X= 0, m_Y= 0; m_Score= 0;}
+	BOOL IsValid()			{	return m_Score != 0;	}
+	BOOL MatchBetterThan(stSISMatchResult &result)	{	return m_Score > result.m_Score;}
+
+	void OffsetBig(CRect &rect)		{	m_X += rect.left;	m_Y	+= rect.top;}	// BigBuffer 谅钎肺 函券.
+	void OffsetSmall(CRect &rect)	{	m_X -= rect.left;	m_Y -= rect.top;}	// SmallBuffer狼 盔痢捞 概莫等 痢阑 茫绊磊 茄促.
+	void Offset(double x, double y)	{	m_X+= x;	m_Y+= y;}
+
+	void CenterOrigin(CRect &rect)
+	{// width, height 啊 圈荐 老 版快.. 0.5啊 吝缴痢烙阑 疙缴 肚 疙缴.
+		double dx= (double)rect.Width()/2;
+		double dy= (double)rect.Height()/2;
+		Offset(-dx, -dy);
+	}
+}CMatchPt;
+
+
+typedef struct stSISMatchParam
+{
+
+	// 袍敲复 皋家靛.
+	enum{CV_TM_SQDIFF= 0, CV_TM_SQDIFF_NORMED= 1, CV_TM_CCORR= 2, CV_TM_CCORR_NORMED= 3, CV_TM_CCOEFF= 4, CV_TM_CCOEFF_NORMED= 5};
+
+	int			m_Method;// 0, 1, 2, 3, 4, 5
+	int			m_Pyramid;
+	double		m_Acceptance;// 0~ 1
+	BOOL		m_bInterpol;
+
+	stSISMatchParam(int pyramid= 2, double acceptance= 0.3, BOOL bUseInterpolate= TRUE, int method= CV_TM_CCOEFF_NORMED)
+		: m_Pyramid(pyramid), m_Acceptance(acceptance), m_bInterpol(bUseInterpolate),  m_Method(method)
+	{	}
+	int			GetMulti(){return 1<<m_Pyramid;}
+	void		ValidateParam()
+	{
+		if(m_Pyramid < 0)
+			m_Pyramid= 0;
+		if(m_Pyramid > 4)
+			m_Pyramid= 4;
+
+		if(m_Acceptance > 0.99)
+			m_Acceptance= 0.99;
+	}
+}CMatchParam;
+
+
+class AFX_EXT_CLASS CSISMatch  
+{
+	CSISBuffer	m_BigBuffer, m_SmallBuffer;// 盔夯 滚欺(措府滚欺)
+
+	CRect m_BigRect, m_SmallRect;// 概莫 roi.
+	stSISMatchParam m_MatchParam;// 概莫 颇扼固磐.
+	class CMatchImpl *m_pMatchImpl;
+
+/*
+	struct _IplImage *m_pBigImage, *m_pSmallImage, *m_pResultImage;// 乔扼固靛 概莫侩 捞固瘤.
+ 	struct _IplImage *m_pBigImage2, *m_pSmallImage2, *m_pResultImage2;// 惑技 概莫侩 捞固瘤.
+*/
+public:
+	CSISMatch();
+	virtual ~CSISMatch();
+
+public:
+	BOOL DoTemplateMatch(stSISMatchResult &result, stSISMatchParam &matchParam);
+private:
+	BOOL DoTemplateMatch2(stSISMatchResult &result);
+	
+public:
+	BOOL SetBigImage(CSISBuffer buffer, CRect &roi);// 菩畔阑 茫阑 菩畔 捞固瘤.
+	BOOL SetSmallImage(CSISBuffer buffer, CRect &roi);// 概莫侩 袍敲复 捞固瘤.
+	BOOL SetBigImage2(CSISBuffer buffer, CRect &roi);// 菩畔阑 茫阑 菩畔 捞固瘤.
+	BOOL SetSmallImage2(CSISBuffer buffer, CRect &roi);// 概莫侩 袍敲复 捞固瘤.
+public:
+	void NormalizeMatchRect(CRect &rect);// 概莫俊 嘎霸 荐流,荐乞 剧规氢 4byte 倔扼牢 荤捞令甫 嘎冕促.
+	BOOL SetImage32f(struct _IplImage **pImage, CSISBuffer *buffer, CRect &roi);// 捞固瘤甫 32bit float屈怕狼 summation滚欺肺 积己茄促.
+	BOOL MakeImage(struct _IplImage **pImage, int width, int height);
+	BOOL SetImage(struct _IplImage **pImage, CSISBuffer *buffer, CRect &roi);// 捞固瘤甫 8bit(1byte) 捞固瘤 弊措肺 概莫俊 嘎霸 父电促.
+	
+};
+
+#endif // !defined(AFX_MOSISMATCH_H__CB8CE1CD_6F94_4C2E_858D_8182CEF9A453__INCLUDED_)
diff --git a/Lib/SISBuffer/include/SISMath.h b/Lib/SISBuffer/include/SISMath.h
new file mode 100644
index 0000000..992abbd
--- /dev/null
+++ b/Lib/SISBuffer/include/SISMath.h
@@ -0,0 +1,169 @@
+// SISMath.h: interface for the CSISMath class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MOSISMATH_H__00204741_878C_42AB_8757_3EE86C292EFD__INCLUDED_)
+#define AFX_MOSISMATH_H__00204741_878C_42AB_8757_3EE86C292EFD__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "InspectionBuffer.h"
+
+typedef __int64 int64;
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+
+
+/*
+
+// defect count 扁馆栏肺 cutoff point 甫 茫酒 霖促.
+// AddCountData甫 烹茄 规过苞 FindCutoff_Continue甫 烹茄 规过 滴啊瘤啊 乐促.
+class AFX_EXT_CLASS CCutoffFind
+{
+	int m_nContinuousCutoff;
+	int *m_pCountData;
+public:
+	int m_nCountData;
+	CCutoffFind()
+	{
+		m_nCountData= 0;
+		m_pCountData= NULL;
+	}
+	~CCutoffFind()
+	{
+		if(m_pCountData)
+			delete m_pCountData;
+	}
+	BOOL SetSize(int nData)
+	{
+		m_nCountData= nData;
+		if(m_pCountData)
+			delete m_pCountData;
+		m_pCountData= new int[nData];
+		return TRUE;
+	}
+	
+	// 鉴瞒利栏肺 龋免登搁 cutoff牢瘤甫 魄喊秦 楷加 cutoff count甫 府畔秦 霖促.
+	int AddCountData(int data, int nCutoff)
+	{
+		if(data < nCutoff)
+		{
+			m_nContinuousCutoff++;
+			return m_nContinuousCutoff;
+		}
+		m_nContinuousCutoff= 0;
+		return 0;
+	}
+	
+	
+	void SetCountData(int iData, int data)
+	{
+		m_pCountData[iData]= data;
+	}
+	// 沥,开规氢栏肺 line by line 八荤窍哥 Cutoff_Continuous甫 茫酒 辰促.  Cutoff_Continuous啊 绝栏搁 false, Cutoff 困摹绰 沥规氢 扁霖狼 index捞促.
+	// nContinue俺荐 捞惑 瘤加利栏肺 cutoff啊 积败具 Cutoff_Continuous肺 埃林茄促.
+	BOOL FindCutoff_Continuous(BOOL bForwardScan, int nCutoff, int nContinue, int &iForwardResult)
+	{
+		int i;
+		int nOccur= 0;
+		
+		if(bForwardScan)
+		{
+			for(i= 0; i< m_nCountData; i++)
+			{
+				if(m_pCountData[i] > nCutoff)
+				{
+					nOccur++;
+					if(nOccur >= nContinue)
+					{
+						iForwardResult= i- nContinue+ 1;
+						return TRUE;
+					}
+				}else
+				{
+					nOccur= 0;
+				}
+			}
+			return FALSE;
+		}
+		
+		for(i= m_nCountData-1; i >= 0; i--)
+		{
+			if(m_pCountData[i] > nCutoff)
+			{
+				nOccur++;
+				if(nOccur >= nContinue)
+				{
+					iForwardResult= i+ nContinue- 1;
+					return TRUE;
+				}else
+				{
+					nOccur= 0;
+				}
+			}
+		}
+		return FALSE;
+	}
+};
+*/
+
+// 1. Sum of Absolute Differences
+// 2. Cross-Correlation Values.
+// 3. Minimum or Maximum on a certain curve.
+class AFX_EXT_CLASS CSISMath
+{
+public:
+
+	// 1. Get Sum of Absolute Differences on the specific area(Rect).
+	static INT64	GetAbsDiff(CSISBuffer buffer, CRect rect, CSISBuffer buffer2, int x2, int y2)
+	{
+		return GetAbsDiff(buffer, rect.left, rect.top, rect.Width(), rect.Height(), buffer2, x2, y2);
+	}
+	static INT64	GetAbsDiff(CSISBuffer buffer, int x1, int y1, int width, int height, CSISBuffer buffer2, int x2, int y2);
+	static INT64	GetAbsDiff(BYTE* pData, BYTE* pData2, int len);
+
+	// 2. Get Cross Correlation Value on the specific area(Rect).
+	static int64	Get_CCU8( CSISBuffer buffer1, int x1, int y1, int width, int height, CSISBuffer buffer2, int x2, int y2);
+	static int64	Get_CCU8_A( const uchar * vec1, int len );
+	static int64	Get_CCU8_AUA( const uchar * vec1, const uchar * vec2, int len );
+	static int64	Get_CCU8_UA( const uchar * vec1, const uchar * vec2, int len );
+	static int64	Get_CCU8_UA( const uchar * vec1, int len );
+	static int64	Get_CCU16_A( const ushort * vec1, int len );
+	static int64	Get_CCU16_AUA( const ushort * vec1, const ushort * vec2, int len );
+	static int64	Get_CCU16_UA( const ushort * vec1, const ushort * vec2, int len );
+	static int64	Get_CCU16_UA( const ushort * vec1, int len );
+
+	static int64	SumPixels_8u( const uchar * vec, int len );
+	static int64	SumPixels_16u( const ushort * vec, int len );
+
+
+	// 3. y= -a(x+ b)^2+ c => 弥家蔼阑 啊瘤绰 器拱急俊辑 弥家蔼阑 茫绰促.
+	static double	SearchMinimum(int64 *pData, int nData);
+	// 3. y= a(x+ b)^2+ c => 弥措蔼阑 啊瘤绰 器拱急俊辑 弥措蔼阑 茫绰促.
+	static double	SearchMaximum(int64 *pData, int nData);
+
+	// 4. 
+	static double	GetAverage(CSISBuffer buffer);
+	static INT64	GetSum(CSISBuffer buffer);
+
+	// 5.
+//	static void		CountLineDefect(CSISBuffer bufer, double xPitch, double yPitch, CCutoffFind &find);
+
+public: // useless
+	static int64	Get_CCU16_A( const ushort * vec1, const ushort * vec2, int len );
+	static int64	Get_CCU8_A( const uchar * vec1, const uchar * vec2, int len );
+
+public: // for omp
+	static int64	OMP_CCU8_A(const uchar * vec1, int len);
+	static int64	OMP_CCU8_UA(const uchar *vec1, int len);
+	static int64	OMP_CCU8_AUA( const uchar * vec1, const uchar * vec2, int len );
+
+	
+	static int64	OMP_CCU16_A( const ushort * vec1, int len );
+	static int64	OMP_CCU16_UA( const ushort * vec1, int len );
+	static int64	OMP_CCU16_AUA( const ushort * vec1, const ushort * vec2, int len );
+};
+
+#endif // !defined(AFX_MOSISMATH_H__00204741_878C_42AB_8757_3EE86C292EFD__INCLUDED_)
diff --git a/Lib/SISBuffer/include/SISPitch.h b/Lib/SISBuffer/include/SISPitch.h
new file mode 100644
index 0000000..c5c77ae
--- /dev/null
+++ b/Lib/SISBuffer/include/SISPitch.h
@@ -0,0 +1,167 @@
+// SISPitch.h: interface for the CSISPitch class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_MOSISPITCH_H__CA80B4A7_F0BD_4AEA_A81B_CF86C09EC7C1__INCLUDED_)
+#define AFX_MOSISPITCH_H__CA80B4A7_F0BD_4AEA_A81B_CF86C09EC7C1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+#include "InspectionBuffer.h"
+
+
+// type T俊 措茄 历厘家 俺充(hive=国烹) 盔夯 : SISRecipe 俊 粮犁.
+// 硅凯 屈侥栏肺 instance T甫 历厘窍哥 SetSize甫 烹秦 Size甫 疵副 荐 乐促.
+// 梨篮 皋葛府 累诀阑 弥家拳 棺 Mem free 救沥己阑 犬焊 窍扁 困秦 荤侩茄促.
+typedef __int64 int64;
+
+template<typename T>
+class CSISHive1B
+{
+protected:
+	int		m_Size;
+	int		m_Space;
+	T*		m_Pointers;
+public:
+	CSISHive1B()
+	{
+		m_Pointers= NULL;
+		m_Space= m_Size= 0;
+	}
+	~CSISHive1B()
+	{
+		if(m_Pointers)
+			delete[] m_Pointers;
+	}
+
+	CSISHive1B& operator =(CSISHive1B& Hive)
+	{
+		if( SetSize(Hive.m_Size, FALSE))
+			memcpy(m_Pointers, Hive.m_Pointers, sizeof(T)*Hive.GetSize());
+		return *this;
+	}
+
+	int		GetSize(){return m_Size;}
+	BOOL	SetSize(int size, BOOL bAppend)
+	{
+		ASSERT(size > 0);
+		
+		if(m_Pointers == NULL)
+		{
+			m_Pointers= new T[size];
+			if(m_Pointers == NULL)
+				return FALSE;
+			m_Space= m_Size= size;
+			return TRUE;
+		}
+		if(m_Space < size)
+		{
+			T *pOld= m_Pointers;
+			m_Pointers= new T[size];
+			if(m_Pointers == NULL)
+			{
+				m_Pointers= pOld;
+				m_Size= 0;
+				return FALSE;
+			}
+			
+			if(bAppend)
+				memcpy(m_Pointers, pOld, sizeof(T)*m_Size);
+			
+			delete[] pOld;
+			
+			m_Space= m_Size= size;
+			return TRUE;
+		}
+		m_Size= size;
+		return TRUE;
+	}
+
+	void	Delete(int i)
+	{
+		T* pData= GetData(i);
+		if(pData == NULL)
+			return;
+		int size= GetSize()- 1- i;
+		if(size > 0)
+			memcpy(GetData(i), GetData(i+1), sizeof(T)*size);
+		SetSize(GetSize()- 1, FALSE);
+	}
+
+	T*		Add()
+	{
+		int iAdd= m_Size;
+		SetSize(m_Size+ 1, TRUE);
+		return GetData(iAdd);
+	}
+
+	BOOL	Swap(int a, int b)
+	{
+		T* pa= GetData(a);
+		T* pb= GetData(b);
+		if(pa == NULL || pb == NULL)
+			return FALSE;
+
+		T temp= *pa;
+		*pa= *pb;
+		*pb= temp;
+		return TRUE;
+	}
+
+	T*		GetData(int i)
+	{
+		if(i < 0 || i > GetSize()- 1)
+			return NULL;
+		return m_Pointers+ i;
+	}
+};
+
+
+
+
+class AFX_EXT_CLASS CSISPitch
+{
+public:
+	double	m_xPitch;			// 拌魂等 乔摹.
+	double	m_yPitch;
+
+	CRect	m_Rect;				// 八荤 康开.
+	
+	double	m_xPitchOrigin;		// 扁霖 乔摹 - 林绢柳 乔摹. 
+	double	m_yPitchOrigin;
+	long	m_CheckWidth;		// 乔摹 乞啊且 康开 width
+	long	m_CheckHeight;
+	long	m_xSearchRange;		// 扁霖 乔摹 +- Range 康开 父怒 八荤.
+	long	m_ySearchRange;
+	
+//	CSISHive1B<int64>	m_DifferenceHive;
+	
+	CSISPitch(double xPitch, double yPitch, long CheckWidth, long CheckHeight, long xSearchRange= 4, long ySearchRange= 4)
+	{
+		m_xPitchOrigin= xPitch;
+		m_yPitchOrigin= yPitch;
+		m_CheckWidth= CheckWidth;
+		m_CheckHeight= CheckHeight;
+		m_xSearchRange= xSearchRange;
+		m_ySearchRange= ySearchRange;
+		m_xPitch= 0;
+		m_yPitch= 0;
+	}
+	CSISPitch()
+	{
+		m_xPitchOrigin= 100.0;// 100.0 += m_SearchRange 父怒 八刘.
+		m_yPitchOrigin= 100.0;// 100.0 += m_SearchRange 父怒 八刘.
+		m_CheckWidth= 100;// widht 100 呈厚肺 厚背 八刘.
+		m_CheckHeight= 100;// Height 100 呈厚肺 厚背 八刘.
+		m_xSearchRange= 4;// PITCH +- 4 俊辑 八刘.
+		m_ySearchRange= 4;// PITCH +- 4 俊辑 八刘.
+		m_xPitch= 0;
+		m_yPitch= 0;
+	}
+	
+	BOOL CheckPitch(CSISBuffer buffer, CRect rect);
+};
+#endif // !defined(AFX_MOSISPITCH_H__CA80B4A7_F0BD_4AEA_A81B_CF86C09EC7C1__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/CellRange.h b/Lib/SISControls/GridControl/CellRange.h
new file mode 100644
index 0000000..ca429b5
--- /dev/null
+++ b/Lib/SISControls/GridControl/CellRange.h
@@ -0,0 +1,156 @@
+///////////////////////////////////////////////////////////////////////
+// CellRange.h: header file
+//
+// MFC Grid Control - interface for the CCellRange class.
+//
+// Written by Chris Maunder <cmaunder@mail.com>
+// Copyright (c) 1998-2002. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+// The code contained in this file is based on the original
+// WorldCom Grid control written by Joe Willcoxson,
+//      mailto:chinajoe@aol.com
+//      http://users.aol.com/chinajoe
+
+#ifndef max
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+#endif
+
+class AFX_EXT_CLASS CCellID
+{    
+// Attributes
+public:
+    int row, col;
+
+// Operations
+public:
+    explicit CCellID(int nRow = -1, int nCol = -1) : row(nRow), col(nCol) {}
+
+    int IsValid() const { return (row >= 0 && col >= 0); }
+    int operator==(const CCellID& rhs) const { return (row == rhs.row && col == rhs.col); }
+    int operator!=(const CCellID& rhs) const { return !operator==(rhs); }
+};
+
+class CCellRange
+{ 
+public:
+    
+    CCellRange(int nMinRow = -1, int nMinCol = -1, int nMaxRow = -1, int nMaxCol = -1)
+    {
+        Set(nMinRow, nMinCol, nMaxRow, nMaxCol);
+    }
+
+    void Set(int nMinRow = -1, int nMinCol = -1, int nMaxRow = -1, int nMaxCol = -1);
+    
+    int  IsValid() const;
+    int  InRange(int row, int col) const;
+    int  InRange(const CCellID& cellID) const;
+    int  Count() { return (m_nMaxRow - m_nMinRow + 1) * (m_nMaxCol - m_nMinCol + 1); }
+    
+    CCellID  GetTopLeft() const;
+    CCellRange  Intersect(const CCellRange& rhs) const;
+    
+    int GetMinRow() const {return m_nMinRow;}
+    void SetMinRow(int minRow) {m_nMinRow = minRow;}
+    
+    int GetMinCol() const {return m_nMinCol;}
+    void SetMinCol(int minCol) {m_nMinCol = minCol;}
+    
+    int GetMaxRow() const {return m_nMaxRow;}
+    void SetMaxRow(int maxRow) {m_nMaxRow = maxRow;}
+    
+    int GetMaxCol() const {return m_nMaxCol;}
+    void SetMaxCol(int maxCol) {m_nMaxCol = maxCol;}
+
+    int GetRowSpan() const {return m_nMaxRow - m_nMinRow + 1;}
+    int GetColSpan() const {return m_nMaxCol - m_nMinCol + 1;}
+    
+    void operator=(const CCellRange& rhs);
+    int  operator==(const CCellRange& rhs);
+    int  operator!=(const CCellRange& rhs);
+    
+protected:
+    int m_nMinRow;
+    int m_nMinCol;
+    int m_nMaxRow;
+    int m_nMaxCol;
+};
+
+inline void CCellRange::Set(int minRow, int minCol, int maxRow, int maxCol)
+{
+     m_nMinRow = minRow;
+     m_nMinCol = minCol;
+     m_nMaxRow = maxRow;
+     m_nMaxCol = maxCol;
+}
+
+inline void CCellRange::operator=(const CCellRange& rhs)
+{
+    if (this != &rhs) Set(rhs.m_nMinRow, rhs.m_nMinCol, rhs.m_nMaxRow, rhs.m_nMaxCol);
+}
+
+inline int CCellRange::operator==(const CCellRange& rhs)
+{
+     return ((m_nMinRow == rhs.m_nMinRow) && (m_nMinCol == rhs.m_nMinCol) &&
+             (m_nMaxRow == rhs.m_nMaxRow) && (m_nMaxCol == rhs.m_nMaxCol));
+}
+
+inline int CCellRange::operator!=(const CCellRange& rhs)
+{
+     return !operator==(rhs);
+}
+
+inline int CCellRange::IsValid() const
+{
+     return (m_nMinRow >= 0 && m_nMinCol >= 0 && m_nMaxRow >= 0 && m_nMaxCol >= 0 &&
+             m_nMinRow <= m_nMaxRow && m_nMinCol <= m_nMaxCol);
+}
+
+inline int CCellRange::InRange(int row, int col) const
+{
+     return (row >= m_nMinRow && row <= m_nMaxRow && col >= m_nMinCol && col <= m_nMaxCol);
+}
+
+inline int CCellRange::InRange(const CCellID& cellID) const
+{
+     return InRange(cellID.row, cellID.col);
+}
+
+inline CCellID CCellRange::GetTopLeft() const
+{
+     return CCellID(m_nMinRow, m_nMinCol);
+}
+
+inline CCellRange CCellRange::Intersect(const CCellRange& rhs) const
+{
+     return CCellRange(max(m_nMinRow,rhs.m_nMinRow), max(m_nMinCol,rhs.m_nMinCol),
+                       min(m_nMaxRow,rhs.m_nMaxRow), min(m_nMaxCol,rhs.m_nMaxCol));
+}
+
+#endif // !defined(AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/GridCell.h b/Lib/SISControls/GridControl/GridCell.h
new file mode 100644
index 0000000..05a368f
--- /dev/null
+++ b/Lib/SISControls/GridControl/GridCell.h
@@ -0,0 +1,143 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCell.h : header file
+//
+// MFC Grid Control - Grid cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridCtrl;
+#include "GridCellBase.h"
+
+// Each cell contains one of these. Fields "row" and "column" are not stored since we
+// will usually have acces to them in other ways, and they are an extra 8 bytes per
+// cell that is probably unnecessary.
+
+class AFX_EXT_CLASS CGridCell : public CGridCellBase
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCell)
+
+// Construction/Destruction
+public:
+    CGridCell();
+    virtual ~CGridCell();
+
+// Attributes
+public:
+    void operator=(const CGridCell& cell);
+
+    virtual void  SetText(LPCTSTR szText)        { m_strText = szText;  }                       
+    virtual void  SetImage(int nImage)           { m_nImage = nImage;   }                        
+    virtual void  SetData(LPARAM lParam)         { m_lParam = lParam;   }      
+    virtual void  SetGrid(CGridCtrl* pGrid)      { m_pGrid = pGrid;     }                          
+    // virtual void SetState(const DWORD nState);  -  use base class version   
+    virtual void  SetFormat(DWORD nFormat)       { m_nFormat = nFormat; }                      
+    virtual void  SetTextClr(COLORREF clr)       { m_crFgClr = clr;     }                          
+    virtual void  SetBackClr(COLORREF clr)       { m_crBkClr = clr;     }                          
+    virtual void  SetFont(const LOGFONT* plf);
+    virtual void  SetMargin(UINT nMargin)        { m_nMargin = nMargin; }
+    virtual CWnd* GetEditWnd() const             { return m_pEditWnd;   }
+    virtual void  SetCoords(int /*nRow*/, int /*nCol*/) {}  // don't need to know the row and
+                                                            // column for base implementation
+
+    virtual LPCTSTR     GetText() const             { return (m_strText.IsEmpty())? _T("") : LPCTSTR(m_strText); }
+    virtual int         GetImage() const            { return m_nImage;  }
+    virtual LPARAM      GetData() const             { return m_lParam;  }
+    virtual CGridCtrl*  GetGrid() const             { return m_pGrid;   }
+    // virtual DWORD    GetState() const - use base class
+    virtual DWORD       GetFormat() const;
+    virtual COLORREF    GetTextClr() const          { return m_crFgClr; } // TODO: change to use default cell
+    virtual COLORREF    GetBackClr() const          { return m_crBkClr; }
+    virtual LOGFONT*    GetFont() const;
+    virtual CFont*      GetFontObject() const;
+    virtual UINT        GetMargin() const;
+
+    virtual BOOL        IsEditing() const           { return m_bEditing; }
+    virtual BOOL        IsDefaultFont() const       { return (m_plfFont == NULL); }
+    virtual void        Reset();
+
+// editing cells
+public:
+    virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual void EndEdit();
+protected:
+    virtual void OnEndEdit();
+
+protected:
+    CString    m_strText;      // Cell text (or binary data if you wish...)
+    LPARAM     m_lParam;       // 32-bit value to associate with item
+    int        m_nImage;       // Index of the list view item抯 icon
+    DWORD      m_nFormat;
+    COLORREF   m_crFgClr;
+    COLORREF   m_crBkClr;
+    LOGFONT*   m_plfFont;
+    UINT       m_nMargin;
+
+    BOOL       m_bEditing;     // Cell being edited?
+
+    CGridCtrl* m_pGrid;        // Parent grid control
+    CWnd*      m_pEditWnd;
+};
+
+// This class is for storing grid default values. It's a little heavy weight, so
+// don't use it in bulk 
+class CGridDefaultCell : public CGridCell
+{
+    DECLARE_DYNCREATE(CGridDefaultCell)
+
+// Construction/Destruction
+public:
+    CGridDefaultCell();
+    virtual ~CGridDefaultCell();
+
+public:
+    virtual DWORD GetStyle() const                      { return m_dwStyle;      }
+    virtual void  SetStyle(DWORD dwStyle)               { m_dwStyle = dwStyle;   }
+    virtual int   GetWidth() const                      { return m_Size.cx;      }
+    virtual int   GetHeight() const                     { return m_Size.cy;      }
+    virtual void  SetWidth(int nWidth)                  { m_Size.cx = nWidth;    }
+    virtual void  SetHeight(int nHeight)                { m_Size.cy = nHeight;   }
+
+    // Disable these properties
+    virtual void     SetData(LPARAM /*lParam*/)             { ASSERT(FALSE);         }      
+    virtual void     SetState(DWORD /*nState*/)             { ASSERT(FALSE);         }
+    virtual DWORD    GetState() const                       { return CGridCell::GetState()|GVIS_READONLY; }
+    virtual void     SetCoords( int /*row*/, int /*col*/)   { /*ASSERT(FALSE);*/         }
+    virtual void     SetFont(const LOGFONT* /*plf*/);
+    virtual LOGFONT* GetFont() const;   
+    virtual CFont*   GetFontObject() const;
+
+protected:
+    CSize m_Size;       // Default Size
+    CFont m_Font;       // Cached font
+    DWORD m_dwStyle;    // Cell Style - unused
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/GridCellBase.h b/Lib/SISControls/GridControl/GridCellBase.h
new file mode 100644
index 0000000..f7804c2
--- /dev/null
+++ b/Lib/SISControls/GridControl/GridCellBase.h
@@ -0,0 +1,172 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCellBase.h : header file
+//
+// MFC Grid Control - Grid cell base class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridCtrl;
+
+// Cell states
+#define GVIS_FOCUSED            0x0001
+#define GVIS_SELECTED           0x0002
+#define GVIS_DROPHILITED        0x0004
+#define GVIS_READONLY           0x0008
+#define GVIS_FIXED              0x0010
+#define GVIS_FIXEDROW           0x0020
+#define GVIS_FIXEDCOL           0x0040
+#define GVIS_MODIFIED           0x0080
+
+// Cell data mask
+#define GVIF_TEXT               LVIF_TEXT
+#define GVIF_IMAGE              LVIF_IMAGE
+#define GVIF_PARAM              LVIF_PARAM
+#define GVIF_STATE              LVIF_STATE
+#define GVIF_BKCLR              (GVIF_STATE<<1)
+#define GVIF_FGCLR              (GVIF_STATE<<2)
+#define GVIF_FORMAT             (GVIF_STATE<<3)
+#define GVIF_FONT               (GVIF_STATE<<4)
+#define GVIF_MARGIN             (GVIF_STATE<<5)
+#define GVIF_ALL                (GVIF_TEXT|GVIF_IMAGE|GVIF_PARAM|GVIF_STATE|GVIF_BKCLR|GVIF_FGCLR| \
+                                 GVIF_FORMAT|GVIF_FONT|GVIF_MARGIN)
+
+// Used for Get/SetItem calls.
+typedef struct _GV_ITEM {
+    int      row,col;     // Row and Column of item
+    UINT     mask;        // Mask for use in getting/setting cell data
+    UINT     nState;      // cell state (focus/hilighted etc)
+    DWORD    nFormat;     // Format of cell
+    int      iImage;      // index of the list view item抯 icon
+    COLORREF crBkClr;     // Background colour (or CLR_DEFAULT)
+    COLORREF crFgClr;     // Forground colour (or CLR_DEFAULT)
+    LPARAM   lParam;      // 32-bit value to associate with item
+    LOGFONT  lfFont;      // Cell font
+    UINT     nMargin;     // Internal cell margin
+    CString  strText;     // Text in cell
+} GV_ITEM;
+
+
+// Each cell contains one of these. Fields "row" and "column" are not stored since we
+// will usually have acces to them in other ways, and they are an extra 8 bytes per
+// cell that is probably unnecessary.
+
+class AFX_EXT_CLASS CGridCellBase : public CObject
+{
+    friend class CGridCtrl;
+    DECLARE_DYNAMIC(CGridCellBase)
+
+// Construction/Destruction
+public:
+    CGridCellBase();
+    virtual ~CGridCellBase();
+
+// Attributes
+public:
+    virtual void SetText(LPCTSTR /* szText */)              = 0 ;
+    virtual void SetImage(int /* nImage */)                 = 0 ;
+    virtual void SetData(LPARAM /* lParam */)               = 0 ;
+    virtual void SetState(DWORD nState)                     { m_nState = nState; }
+    virtual void SetFormat(DWORD /* nFormat */)             = 0 ;
+    virtual void SetTextClr(COLORREF /* clr */)             = 0 ;
+    virtual void SetBackClr(COLORREF /* clr */)             = 0 ;
+    virtual void SetFont(const LOGFONT* /* plf */)          = 0 ;
+    virtual void SetMargin( UINT /* nMargin */)             = 0 ;
+    virtual void SetGrid(CGridCtrl* /* pGrid */)            = 0 ;
+    virtual void SetCoords( int /* nRow */, int /* nCol */) = 0 ;
+
+    virtual LPCTSTR    GetText()       const                = 0 ;
+    virtual LPCTSTR    GetTipText()    const                { return GetText(); } // may override TitleTip return
+    virtual int        GetImage()      const                = 0 ;
+    virtual LPARAM     GetData()       const                = 0 ;
+    virtual DWORD      GetState()      const                { return m_nState;  }
+    virtual DWORD      GetFormat()     const                = 0 ;
+    virtual COLORREF   GetTextClr()    const                = 0 ;
+    virtual COLORREF   GetBackClr()    const                = 0 ;
+    virtual LOGFONT  * GetFont()       const                = 0 ;
+    virtual CFont    * GetFontObject() const                = 0 ;
+    virtual CGridCtrl* GetGrid()       const                = 0 ;
+    virtual CWnd     * GetEditWnd()    const                = 0 ;
+    virtual UINT       GetMargin()     const                = 0 ;
+
+    virtual CGridCellBase* GetDefaultCell() const;
+
+    virtual BOOL IsDefaultFont()       const                = 0 ;
+    virtual BOOL IsEditing()           const                = 0 ;
+    virtual BOOL IsFocused()           const                { return (m_nState & GVIS_FOCUSED);  }
+    virtual BOOL IsFixed()             const                { return (m_nState & GVIS_FIXED);    }
+    virtual BOOL IsFixedCol()          const                { return (m_nState & GVIS_FIXEDCOL); }
+    virtual BOOL IsFixedRow()          const                { return (m_nState & GVIS_FIXEDROW); }
+    virtual BOOL IsSelected()          const                { return (m_nState & GVIS_SELECTED); }
+    virtual BOOL IsReadOnly()          const                { return (m_nState & GVIS_READONLY); }
+    virtual BOOL IsModified()          const                { return (m_nState & GVIS_MODIFIED); }
+    virtual BOOL IsDropHighlighted()   const                { return (m_nState & GVIS_DROPHILITED); }
+
+// Operators
+public:
+    virtual void operator=(const CGridCellBase& cell);
+
+// Operations
+public:
+    virtual void Reset();
+
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+    virtual BOOL GetTextRect( LPRECT pRect);    // i/o:  i=dims of cell rect; o=dims of text rect
+    virtual BOOL GetTipTextRect( LPRECT pRect) { return GetTextRect( pRect); }  // may override for btns, etc.
+    virtual CSize GetTextExtent(LPCTSTR str, CDC* pDC = NULL);
+    virtual CSize GetCellExtent(CDC* pDC);
+
+    // Editing
+    virtual BOOL Edit( int /* nRow */, int /* nCol */, CRect /* rect */, CPoint /* point */, 
+                       UINT /* nID */, UINT /* nChar */) { return FALSE;}
+	virtual BOOL ValidateEdit(LPCTSTR str);
+    virtual void EndEdit() {}
+
+    // EFW - Added to print cells properly
+    virtual BOOL PrintCell(CDC* pDC, int nRow, int nCol, CRect rect);
+
+    // add additional protected grid members required of cells
+    LRESULT SendMessageToParent(int nRow, int nCol, int nMessage);
+
+protected:
+    virtual void OnEndEdit();
+    virtual void OnMouseEnter();
+    virtual void OnMouseOver();
+    virtual void OnMouseLeave();
+    virtual void OnClick( CPoint PointCellRelative);
+    virtual void OnClickDown( CPoint PointCellRelative);
+    virtual void OnRClick( CPoint PointCellRelative);
+    virtual void OnDblClick( CPoint PointCellRelative);
+    virtual BOOL OnSetCursor();
+
+protected:
+    DWORD    m_nState;      // Cell state (selected/focus etc)
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/GridCellButton.h b/Lib/SISControls/GridControl/GridCellButton.h
new file mode 100644
index 0000000..6b04419
--- /dev/null
+++ b/Lib/SISControls/GridControl/GridCellButton.h
@@ -0,0 +1,28 @@
+#ifndef __GRID_CELL_BUTTON__
+#define __GRID_CELL_BUTTON__
+
+#include "GridCell.h"
+
+class AFX_EXT_CLASS CGridCellButton : public CGridCell
+{
+	friend class CGridCtrl;
+	DECLARE_DYNCREATE(CGridCellButton)
+
+public:
+	CGridCellButton(void);
+	virtual ~CGridCellButton(void);
+
+	void SetPushing(BOOL bPush) {m_bPushing = bPush;}
+
+public:
+	virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+protected:
+	virtual void OnClick(CPoint PointCellRelative);
+	virtual void OnMouseLeave();
+
+protected:
+	CRect m_rect;
+	BOOL m_bPushing;
+};
+#endif
diff --git a/Lib/SISControls/GridControl/GridCtrl.h b/Lib/SISControls/GridControl/GridCtrl.h
new file mode 100644
index 0000000..286c9db
--- /dev/null
+++ b/Lib/SISControls/GridControl/GridCtrl.h
@@ -0,0 +1,1088 @@
+/////////////////////////////////////////////////////////////////////////////
+// GridCtrl.h : header file
+//
+// MFC Grid Control - main header
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.20+
+//
+//////////////////////////////////////////////////////////////////////
+
+// FEATURES BY Mukit, Ataul (2007-11-17):
+// 1. Merge Cell 
+// 2. Ability to do XL Style Freeze Pane
+// 3. The Horizontal Gray Area Removed 
+  
+// FINDINGS:
+// 1. A cell cannot be edited if a tooltip is shown..
+// 2. The InplaceEditCtrl is not multiline even if a cell can contain Multiline Text..
+// 3. If a cell is too small, the InplaceEditCtrl is almost invisible..
+
+#if !defined(AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include "CellRange.h"
+#include "GridCell.h"
+#include <afxtempl.h>
+#include <vector>
+using namespace std;
+
+
+struct CELL_ENABLE
+{
+	CELL_ENABLE()
+	{
+		nEnable = -1;
+	}
+	void SetEnable(BOOL bValue)
+	{
+		nEnable = bValue;
+	}
+	BOOL isEnable()
+	{
+		if (nEnable == 0)
+		{
+			return FALSE;
+		}
+		else if (nEnable > 0)
+		{
+			return TRUE;
+		}
+	}
+	BOOL isActivated()
+	{
+		if (nEnable < 0)
+		{
+			return FALSE;
+		}
+		else
+			return TRUE;
+	}
+	int nEnable;
+};
+
+///////////////////////////////////////////////////////////////////////////////////
+// Defines - these determine the features (and the final size) of the final code
+///////////////////////////////////////////////////////////////////////////////////
+
+//#define GRIDCONTROL_NO_TITLETIPS   // Do not use titletips for cells with large data
+//#define GRIDCONTROL_NO_DRAGDROP    // Do not use OLE drag and drop
+//#define GRIDCONTROL_NO_CLIPBOARD   // Do not use clipboard routines
+
+#ifdef _WIN32_WCE
+#   define GRIDCONTROL_NO_TITLETIPS   // Do not use titletips for cells with large data
+#   define GRIDCONTROL_NO_DRAGDROP    // Do not use OLE drag and drop
+#   define GRIDCONTROL_NO_CLIPBOARD   // Do not use clipboard routines
+#   define GRIDCONTROL_NO_PRINTING    // Do not use printing routines
+#   ifdef WCE_NO_PRINTING			  // Older versions of CE had different #def's
+#       define _WIN32_WCE_NO_PRINTING
+#   endif
+#   ifdef WCE_NO_CURSOR
+#       define _WIN32_WCE_NO_CURSOR
+#   endif
+#endif  // _WIN32_WCE
+
+// Use this as the classname when inserting this control as a custom control
+// in the MSVC++ dialog editor
+#define GRIDCTRL_CLASSNAME    _T("MFCGridCtrl")  // Window class name
+#define IDC_INPLACE_CONTROL   8                  // ID of inplace edit controls
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Conditional includes
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+#   include "TitleTip.h"
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+#   include "GridDropTarget.h"
+#   undef GRIDCONTROL_NO_CLIPBOARD     // Force clipboard functions on
+#endif
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+#   include <afxole.h>
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Helper functions
+///////////////////////////////////////////////////////////////////////////////////
+
+// Handy functions
+#define IsSHIFTpressed() ( (GetKeyState(VK_SHIFT) & (1 << (sizeof(SHORT)*8-1))) != 0   )
+#define IsCTRLpressed()  ( (GetKeyState(VK_CONTROL) & (1 << (sizeof(SHORT)*8-1))) != 0 )
+
+// Backwards compatibility for pre 2.20 grid versions
+#define DDX_GridControl(pDX, nIDC, rControl)  DDX_Control(pDX, nIDC, rControl)     
+
+
+///////////////////////////////////////////////////////////////////////////////////
+// Structures
+///////////////////////////////////////////////////////////////////////////////////
+
+// This structure sent to Grid's parent in a WM_NOTIFY message
+typedef struct tagNM_GRIDVIEW {
+    NMHDR hdr;
+    int   iRow;
+    int   iColumn;
+} NM_GRIDVIEW;
+
+// This is sent to the Grid from child in-place edit controls
+typedef struct tagGV_DISPINFO {
+    NMHDR   hdr;
+    GV_ITEM item;
+} GV_DISPINFO;
+
+// This is sent to the Grid from child in-place edit controls
+typedef struct tagGV_CACHEHINT {
+    NMHDR      hdr;
+    CCellRange range;
+} GV_CACHEHINT;
+
+// storage typedef for each row in the grid
+typedef CTypedPtrArray<CObArray, CGridCellBase*> GRID_ROW;
+
+// For virtual mode callback
+typedef BOOL (CALLBACK* GRIDCALLBACK)(GV_DISPINFO *, LPARAM);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Defines
+///////////////////////////////////////////////////////////////////////////////////
+
+// Grid line/scrollbar selection
+#define GVL_NONE                0L      // Neither
+#define GVL_HORZ                1L      // Horizontal line or scrollbar
+#define GVL_VERT                2L      // Vertical line or scrollbar
+#define GVL_BOTH                3L      // Both
+
+// Autosizing option
+#define GVS_DEFAULT             0
+#define GVS_HEADER              1       // Size using column fixed cells data only
+#define GVS_DATA                2       // Size using column non-fixed cells data only
+#define GVS_BOTH                3       // Size using column fixed and non-fixed
+
+// Cell Searching options
+#define GVNI_FOCUSED            0x0001
+#define GVNI_SELECTED           0x0002
+#define GVNI_DROPHILITED        0x0004
+#define GVNI_READONLY           0x0008
+#define GVNI_FIXED              0x0010
+#define GVNI_MODIFIED           0x0020
+// LUC
+#define GVNI_FREEZED			0x0040
+
+#define GVNI_ABOVE              LVNI_ABOVE
+#define GVNI_BELOW              LVNI_BELOW
+#define GVNI_TOLEFT             LVNI_TOLEFT
+#define GVNI_TORIGHT            LVNI_TORIGHT
+#define GVNI_ALL                (LVNI_BELOW|LVNI_TORIGHT|LVNI_TOLEFT)
+#define GVNI_AREA               (LVNI_BELOW|LVNI_TORIGHT)
+
+// Hit test values (not yet implemented)
+#define GVHT_DATA               0x0000
+#define GVHT_TOPLEFT            0x0001
+#define GVHT_COLHDR             0x0002
+#define GVHT_ROWHDR             0x0004
+#define GVHT_COLSIZER           0x0008
+#define GVHT_ROWSIZER           0x0010
+#define GVHT_LEFT               0x0020
+#define GVHT_RIGHT              0x0040
+#define GVHT_ABOVE              0x0080
+#define GVHT_BELOW              0x0100
+
+// Messages sent to the grid's parent (More will be added in future)
+#define GVN_BEGINDRAG           LVN_BEGINDRAG        // LVN_FIRST-9
+#define GVN_BEGINLABELEDIT      LVN_BEGINLABELEDIT   // LVN_FIRST-5
+#define GVN_BEGINRDRAG          LVN_BEGINRDRAG
+#define GVN_COLUMNCLICK         LVN_COLUMNCLICK
+#define GVN_DELETEITEM          LVN_DELETEITEM
+#define GVN_ENDLABELEDIT        LVN_ENDLABELEDIT     // LVN_FIRST-6
+#define GVN_SELCHANGING         LVN_ITEMCHANGING
+#define GVN_SELCHANGED          LVN_ITEMCHANGED
+#define GVN_GETDISPINFO         LVN_GETDISPINFO 
+#define GVN_ODCACHEHINT         LVN_ODCACHEHINT 
+#define GVN_COMBOSELCHANGE		LVN_FIRST-10
+
+class CGridCtrl;
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridCtrl window
+
+typedef bool (*PVIRTUALCOMPARE)(int, int);
+
+class AFX_EXT_CLASS CGridCtrl : public CWnd
+{
+    DECLARE_DYNCREATE(CGridCtrl)
+    friend class CGridCell;
+    friend class CGridCellBase;
+
+// Construction
+public:
+    CGridCtrl(int nRows = 0, int nCols = 0, int nFixedRows = 0, int nFixedCols = 0);
+
+    BOOL Create(const RECT& rect, CWnd* parent, UINT nID,
+                DWORD dwStyle = WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VISIBLE);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Attributes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+
+///// LUC ///////////////////////////////////////////////////////////////////////
+
+	//// LUC : MergeCell////////
+	
+	INT_PTR MergeCells(CCellRange& mergedCellRange);
+	void SplitCells(INT_PTR nMergeID);
+
+	BOOL IsMergedCell(int row, int col, CCellRange& mergedCellRange);
+	BOOL GetMergedCellRect(int row, int col, CRect& rect);
+	BOOL GetMergedCellRect(CCellRange& mergedCell, CRect& rect);
+	BOOL GetTopLeftMergedCell(int& row, int& col, CRect& mergeRect);
+	BOOL GetBottomRightMergedCell(int& row, int& col, CRect& mergeRect);
+	virtual BOOL IsFocused(CGridCellBase& cell, int nRow, int nCol);
+	virtual BOOL IsSelected(CGridCellBase& cell, int nRow, int nCol);
+
+	BOOL	m_bDrawingMergedCell;
+	INT_PTR	m_nCurrentMergeID;
+
+	static CRect rectNull;		
+	static CCellID cellNull;
+
+	// LUC : Freeze Rows	
+
+	BOOL SetFreezedRowCount(int nFreezedRows)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedRows >= 0) && ((nFreezedRows + m_nFixedRows) <= m_nRows) )
+		{
+			m_nFreezedRows = nFreezedRows;
+			ResetScrollBars();
+			Refresh();
+			bRet = TRUE;
+		}
+	
+		return bRet;
+		
+	}
+	
+	BOOL SetFreezedColumnCount(int nFreezedCols)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedCols >= 0) && ((nFreezedCols + m_nFixedCols) <= m_nCols) )
+		{
+			m_nFreezedCols = nFreezedCols;
+			ResetScrollBars();
+			Refresh();
+			bRet = TRUE;
+		}
+	
+		return bRet;
+	}
+
+	// To avoid calling ResetScrollBars twice you can use SetFreezedFrame
+	BOOL SetFreezedFrame(int nFreezedRows, int nFreezedCols)
+	{
+		BOOL bRet = FALSE;
+		if( (nFreezedRows >= 0) && ((nFreezedRows + m_nFixedRows) <= m_nRows) )
+		{
+			m_nFreezedRows = nFreezedRows;			
+			bRet = TRUE;
+		}
+		if( (nFreezedCols >= 0) && ((nFreezedCols + m_nFixedCols) <= m_nCols) )
+		{
+			m_nFreezedCols = nFreezedCols;
+			bRet = TRUE;
+		}
+		else
+		{
+			bRet = FALSE;
+		}
+
+		ResetScrollBars();
+			
+		return bRet;			
+	}	
+	
+	int  GetFreezedRowCount() const                    { return m_nFreezedRows; }
+    int  GetFreezedColumnCount() const                 { return m_nFreezedCols; }	
+
+	void ShowHorzNonGridArea(BOOL bShow)
+	{
+		m_bShowHorzNonGridArea = bShow;
+	}
+
+	BOOL IsShowingHorzNonGridArea()
+	{
+		return m_bShowHorzNonGridArea;
+	}
+
+///////////////////////////////////////////////////////////////////////////////////////    
+	
+    int  GetRowCount() const                    { return m_nRows; }
+    int  GetColumnCount() const                 { return m_nCols; }
+    int  GetFixedRowCount(BOOL bIncludeFreezedRows = FALSE) const
+	{ 
+		return (bIncludeFreezedRows) ? (m_nFixedRows + m_nFreezedRows) : m_nFixedRows;
+	}
+    int  GetFixedColumnCount(BOOL bIncludeFreezedCols = FALSE) const            
+	{
+		return (bIncludeFreezedCols) ? (m_nFixedCols + m_nFreezedCols) : m_nFixedCols; 
+	}	
+	
+	BOOL SetRowCount(int nRows = 10);
+    BOOL SetColumnCount(int nCols = 10);
+
+	BOOL UpdateCellEditableMask();
+    
+	BOOL SetFixedRowCount(int nFixedRows = 1);
+    BOOL SetFixedColumnCount(int nFixedCols = 1);	
+
+public:
+    int  GetRowHeight(int nRow) const;
+    BOOL SetRowHeight(int row, int height);
+    int  GetColumnWidth(int nCol) const;
+    BOOL SetColumnWidth(int col, int width);
+
+    BOOL GetCellOrigin(int nRow, int nCol, LPPOINT p);
+    BOOL GetCellOrigin(const CCellID& cell, LPPOINT p);
+    BOOL GetCellRect(int nRow, int nCol, LPRECT pRect);
+    BOOL GetCellRect(const CCellID& cell, LPRECT pRect);
+
+    BOOL GetTextRect(const CCellID& cell, LPRECT pRect);
+    BOOL GetTextRect(int nRow, int nCol, LPRECT pRect);
+
+	BOOL SetCellMaskEditable(int nRow, int nCol, BOOL bEditable);
+	BOOL isCellMaskEditable(int nRow, int nCol);
+	BOOL isCellMaskActivated(int nRow, int nCol);
+
+    // LUC
+	// Change for MergeCell
+	CCellID GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck = TRUE, CCellID& cellOriginal = cellNull);
+
+	// LUC
+    //int  GetFixedRowHeight() const;
+    //int  GetFixedColumnWidth() const;	    
+	int	GetFixedRowHeight(BOOL bIncludeFreezedRows = FALSE) const;
+	int GetFixedColumnWidth(BOOL bIncludeFreezedCols = FALSE) const;
+
+    long GetVirtualWidth() const;
+    long GetVirtualHeight() const;
+
+    CSize GetTextExtent(int nRow, int nCol, LPCTSTR str);
+    // EFW - Get extent of current text in cell
+    inline CSize GetCellTextExtent(int nRow, int nCol)  { return GetTextExtent(nRow, nCol, GetItemText(nRow,nCol)); }
+
+    void     SetGridBkColor(COLORREF clr)         { m_crGridBkColour = clr;           }
+    COLORREF GetGridBkColor() const               { return m_crGridBkColour;          }
+    void     SetGridLineColor(COLORREF clr)       { m_crGridLineColour = clr;         }
+    COLORREF GetGridLineColor() const             { return m_crGridLineColour;        }
+
+	void	 SetTitleTipBackClr(COLORREF clr = CLR_DEFAULT) { m_crTTipBackClr = clr;  }
+	COLORREF GetTitleTipBackClr()				            { return m_crTTipBackClr; }
+	void	 SetTitleTipTextClr(COLORREF clr = CLR_DEFAULT) { m_crTTipTextClr = clr;  }
+	COLORREF GetTitleTipTextClr()				            { return m_crTTipTextClr; }
+
+    // ***************************************************************************** //
+    // These have been deprecated. Use GetDefaultCell and then set the colors
+    void     SetTextColor(COLORREF clr)      { m_cellDefault.SetTextClr(clr);        }
+    COLORREF GetTextColor()                  { return m_cellDefault.GetTextClr();    }
+    void     SetTextBkColor(COLORREF clr)    { m_cellDefault.SetBackClr(clr);        }
+    COLORREF GetTextBkColor()                { return m_cellDefault.GetBackClr();    }
+    void     SetFixedTextColor(COLORREF clr) { m_cellFixedRowDef.SetTextClr(clr); 
+                                               m_cellFixedColDef.SetTextClr(clr); 
+                                               m_cellFixedRowColDef.SetTextClr(clr); }
+    COLORREF GetFixedTextColor() const       { return m_cellFixedRowDef.GetTextClr(); }
+    void     SetFixedBkColor(COLORREF clr)   { m_cellFixedRowDef.SetBackClr(clr); 
+                                               m_cellFixedColDef.SetBackClr(clr); 
+                                               m_cellFixedRowColDef.SetBackClr(clr); }
+    COLORREF GetFixedBkColor() const         { return m_cellFixedRowDef.GetBackClr(); }
+    void     SetGridColor(COLORREF clr)      { SetGridLineColor(clr);                }
+    COLORREF GetGridColor()                  { return GetGridLineColor();            }
+    void     SetBkColor(COLORREF clr)        { SetGridBkColor(clr);                  }
+    COLORREF GetBkColor()                    { return GetGridBkColor();              }
+
+    void     SetDefCellMargin( int nMargin)  { m_cellDefault.SetMargin(nMargin); 
+                                               m_cellFixedRowDef.SetMargin(nMargin); 
+                                               m_cellFixedColDef.SetMargin(nMargin); 
+                                               m_cellFixedRowColDef.SetMargin(nMargin); }
+    int      GetDefCellMargin() const        { return m_cellDefault.GetMargin();     }
+
+    int      GetDefCellHeight() const        { return m_cellDefault.GetHeight();     }
+    void     SetDefCellHeight(int nHeight)   { m_cellDefault.SetHeight(nHeight); 
+                                               m_cellFixedRowDef.SetHeight(nHeight); 
+                                               m_cellFixedColDef.SetHeight(nHeight); 
+                                               m_cellFixedRowColDef.SetHeight(nHeight); }
+    int      GetDefCellWidth() const         { return m_cellDefault.GetWidth();     }
+    void     SetDefCellWidth(int nWidth)     { m_cellDefault.SetWidth(nWidth); 
+                                               m_cellFixedRowDef.SetWidth(nWidth); 
+                                               m_cellFixedColDef.SetWidth(nWidth); 
+                                               m_cellFixedRowColDef.SetWidth(nWidth); }
+
+    // ***************************************************************************** //
+
+    int GetSelectedCount() const                  { return (int)m_SelectedCellMap.GetCount(); }
+
+    CCellID SetFocusCell(CCellID cell);
+    CCellID SetFocusCell(int nRow, int nCol);
+    CCellID GetFocusCell() const                  { return m_idCurrentCell;           }
+
+
+    void SetVirtualMode(BOOL bVirtual);
+    BOOL GetVirtualMode() const                   { return m_bVirtualMode;            }
+    void SetCallbackFunc(GRIDCALLBACK pCallback, 
+                         LPARAM lParam)           { m_pfnCallback = pCallback; m_lParam = lParam; }
+    GRIDCALLBACK GetCallbackFunc()                { return m_pfnCallback;             }
+
+
+    void SetImageList(CImageList* pList)          { m_pImageList = pList;             }
+    CImageList* GetImageList() const              { return m_pImageList;              }
+
+    void SetGridLines(int nWhichLines = GVL_BOTH);
+    int  GetGridLines() const                     { return m_nGridLines;              }
+    void SetEditable(BOOL bEditable = TRUE)       { m_bEditable = bEditable;          }
+    BOOL IsEditable() const                       { return m_bEditable;               }
+    void SetListMode(BOOL bEnableListMode = TRUE);
+    BOOL GetListMode() const                      { return m_bListMode;               }
+    void SetSingleRowSelection(BOOL bSing = TRUE) { m_bSingleRowSelection = bSing;    }
+    BOOL GetSingleRowSelection()                  { return m_bSingleRowSelection & m_bListMode; }
+    void SetSingleColSelection(BOOL bSing = TRUE) { m_bSingleColSelection = bSing;    }
+    BOOL GetSingleColSelection()                  { return m_bSingleColSelection;     }
+    void EnableSelection(BOOL bEnable = TRUE)     { ResetSelectedRange(); m_bEnableSelection = bEnable; ResetSelectedRange(); }
+    BOOL IsSelectable() const                     { return m_bEnableSelection;        }
+    void SetFixedColumnSelection(BOOL bSelect)    { m_bFixedColumnSelection = bSelect;}
+    BOOL GetFixedColumnSelection()                { return m_bFixedColumnSelection;   }
+    void SetFixedRowSelection(BOOL bSelect)       { m_bFixedRowSelection = bSelect;   }
+    BOOL GetFixedRowSelection()                   { return m_bFixedRowSelection;      }
+    void EnableDragAndDrop(BOOL bAllow = TRUE)    { m_bAllowDragAndDrop = bAllow;     }
+    BOOL GetDragAndDrop() const                   { return m_bAllowDragAndDrop;       }
+    void SetRowResize(BOOL bResize = TRUE)        { m_bAllowRowResize = bResize;      }
+    BOOL GetRowResize() const                     { return m_bAllowRowResize;         }
+    void SetColumnResize(BOOL bResize = TRUE)     { m_bAllowColumnResize = bResize;   }
+    BOOL GetColumnResize() const                  { return m_bAllowColumnResize;      }
+    void SetHeaderSort(BOOL bSortOnClick = TRUE)  { m_bSortOnClick = bSortOnClick;    }
+    BOOL GetHeaderSort() const                    { return m_bSortOnClick;            }
+    void SetHandleTabKey(BOOL bHandleTab = TRUE)  { m_bHandleTabKey = bHandleTab;     }
+    BOOL GetHandleTabKey() const                  { return m_bHandleTabKey;           }
+    void SetDoubleBuffering(BOOL bBuffer = TRUE)  { m_bDoubleBuffer = bBuffer;        }
+    BOOL GetDoubleBuffering() const               { return m_bDoubleBuffer;           }
+    void EnableTitleTips(BOOL bEnable = TRUE)     { m_bTitleTips = bEnable;           }
+    BOOL GetTitleTips()                           { return m_bTitleTips;              }
+    void SetSortColumn(int nCol);
+    int  GetSortColumn() const                    { return m_nSortColumn;             }
+    void SetSortAscending(BOOL bAscending)        { m_bAscending = bAscending;        }
+    BOOL GetSortAscending() const                 { return m_bAscending;              }
+    void SetTrackFocusCell(BOOL bTrack)           { m_bTrackFocusCell = bTrack;       }
+    BOOL GetTrackFocusCell()                      { return m_bTrackFocusCell;         }
+    void SetFrameFocusCell(BOOL bFrame)           { m_bFrameFocus = bFrame;           }
+    BOOL GetFrameFocusCell()                      { return m_bFrameFocus;             }
+    void SetAutoSizeStyle(int nStyle = GVS_BOTH)  { m_nAutoSizeColumnStyle = nStyle;  }
+    int  GetAutoSizeStyle()                       { return m_nAutoSizeColumnStyle; }
+
+    void EnableHiddenColUnhide(BOOL bEnable = TRUE){ m_bHiddenColUnhide = bEnable;    }
+    BOOL GetHiddenColUnhide()                     { return m_bHiddenColUnhide;        }
+    void EnableHiddenRowUnhide(BOOL bEnable = TRUE){ m_bHiddenRowUnhide = bEnable;    }
+    BOOL GetHiddenRowUnhide()                     { return m_bHiddenRowUnhide;        }
+
+    void EnableColumnHide(BOOL bEnable = TRUE)    { m_bAllowColHide = bEnable;        }
+    BOOL GetColumnHide()                          { return m_bAllowColHide;           }
+    void EnableRowHide(BOOL bEnable = TRUE)       { m_bAllowRowHide = bEnable;        }
+    BOOL GetRowHide()                             { return m_bAllowRowHide;           }
+
+///////////////////////////////////////////////////////////////////////////////////
+// default Grid cells. Use these for setting default values such as colors and fonts
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CGridCellBase* GetDefaultCell(BOOL bFixedRow, BOOL bFixedCol) const;
+
+///////////////////////////////////////////////////////////////////////////////////
+// Grid cell Attributes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CGridCellBase* GetCell(int nRow, int nCol) const;   // Get the actual cell!
+
+    void SetModified(BOOL bModified = TRUE, int nRow = -1, int nCol = -1);
+    BOOL GetModified(int nRow = -1, int nCol = -1);
+    BOOL IsCellFixed(int nRow, int nCol);
+
+    BOOL   SetItem(const GV_ITEM* pItem);
+    BOOL   GetItem(GV_ITEM* pItem);
+    BOOL   SetItemText(int nRow, int nCol, LPCTSTR str);
+    // The following was virtual. If you want to override, use 
+    //  CGridCellBase-derived class's GetText() to accomplish same thing
+    CString GetItemText(int nRow, int nCol) const;
+
+    // EFW - 06/13/99 - Added to support printf-style formatting codes.
+    // Also supports use with a string resource ID
+#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 210)
+    BOOL   SetItemTextFmt(int nRow, int nCol, LPCTSTR szFmt, ...);
+    BOOL   SetItemTextFmtID(int nRow, int nCol, UINT nID, ...);
+#endif
+
+    BOOL   SetItemData(int nRow, int nCol, LPARAM lParam);
+    LPARAM GetItemData(int nRow, int nCol) const;
+    BOOL   SetItemImage(int nRow, int nCol, int iImage);
+    int    GetItemImage(int nRow, int nCol) const;
+    BOOL   SetItemState(int nRow, int nCol, UINT state);
+    UINT   GetItemState(int nRow, int nCol) const;
+    BOOL   SetItemFormat(int nRow, int nCol, UINT nFormat);
+    UINT   GetItemFormat(int nRow, int nCol) const;
+    BOOL   SetItemBkColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
+    COLORREF GetItemBkColour(int nRow, int nCol) const;
+    BOOL   SetItemFgColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
+    COLORREF GetItemFgColour(int nRow, int nCol) const;
+    BOOL SetItemFont(int nRow, int nCol, const LOGFONT* lf);
+    const LOGFONT* GetItemFont(int nRow, int nCol);
+
+    BOOL IsItemEditing(int nRow, int nCol);
+
+    BOOL SetCellType(int nRow, int nCol, CRuntimeClass* pRuntimeClass);
+    BOOL SetDefaultCellType( CRuntimeClass* pRuntimeClass);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Operations
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    int  InsertColumn(LPCTSTR strHeading, UINT nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE,
+                      int nColumn = -1);
+    int  InsertRow(LPCTSTR strHeading, int nRow = -1);
+    BOOL DeleteColumn(int nColumn);
+    BOOL DeleteRow(int nRow);
+    BOOL DeleteNonFixedRows();
+    BOOL DeleteAllItems();
+
+	void ClearCells(CCellRange Selection);
+
+    BOOL AutoSizeRow(int nRow, BOOL bResetScroll = TRUE);
+    BOOL AutoSizeColumn(int nCol, UINT nAutoSizeStyle = GVS_DEFAULT, BOOL bResetScroll = TRUE);
+    void AutoSizeRows();
+    void AutoSizeColumns(UINT nAutoSizeStyle = GVS_DEFAULT);
+    void AutoSize(UINT nAutoSizeStyle = GVS_DEFAULT);
+    void ExpandColumnsToFit(BOOL bExpandFixed = TRUE);
+    void ExpandLastColumn();
+    void ExpandRowsToFit(BOOL bExpandFixed = TRUE);
+    void ExpandToFit(BOOL bExpandFixed = TRUE);
+
+    void Refresh();
+    void AutoFill();   // Fill grid with blank cells
+
+    void EnsureVisible(CCellID &cell)       { EnsureVisible(cell.row, cell.col); }
+    void EnsureVisible(int nRow, int nCol);
+    BOOL IsCellVisible(int nRow, int nCol);
+    BOOL IsCellVisible(CCellID cell);
+    BOOL IsCellEditable(int nRow, int nCol) const;
+    BOOL IsCellEditable(CCellID &cell) const;
+    BOOL IsCellSelected(int nRow, int nCol) const;
+    BOOL IsCellSelected(CCellID &cell) const;
+	
+
+    // SetRedraw stops/starts redraws on things like changing the # rows/columns
+    // and autosizing, but not for user-intervention such as resizes
+    void SetRedraw(BOOL bAllowDraw, BOOL bResetScrollBars = FALSE);
+    BOOL RedrawCell(int nRow, int nCol, CDC* pDC = NULL);
+    BOOL RedrawCell(const CCellID& cell, CDC* pDC = NULL);
+    BOOL RedrawRow(int row);
+    BOOL RedrawColumn(int col);
+
+#ifndef _WIN32_WCE
+    BOOL Save(LPCTSTR filename, TCHAR chSeparator = _T(','));
+    BOOL Load(LPCTSTR filename, TCHAR chSeparator = _T(','));
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////
+// Cell Ranges
+///////////////////////////////////////////////////////////////////////////////////
+ public:
+    CCellRange GetCellRange() const;
+    CCellRange GetSelectedCellRange() const;
+    void SetSelectedRange(const CCellRange& Range, BOOL bForceRepaint = FALSE, BOOL bSelectCells = TRUE);
+    void SetSelectedRange(int nMinRow, int nMinCol, int nMaxRow, int nMaxCol,
+                          BOOL bForceRepaint = FALSE, BOOL bSelectCells = TRUE);
+    BOOL IsValid(int nRow, int nCol) const;
+    BOOL IsValid(const CCellID& cell) const;
+    BOOL IsValid(const CCellRange& range) const;
+
+///////////////////////////////////////////////////////////////////////////////////
+// Clipboard, drag and drop, and cut n' paste operations
+///////////////////////////////////////////////////////////////////////////////////
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    virtual void CutSelectedText();
+    virtual COleDataSource* CopyTextFromGrid();
+    virtual BOOL PasteTextToGrid(CCellID cell, COleDataObject* pDataObject, BOOL bSelectPastedCells=TRUE);
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+ public:
+    virtual void OnBeginDrag();
+    virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    virtual void OnDragLeave();
+    virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+#endif
+
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    virtual void OnEditCut();
+    virtual void OnEditCopy();
+    virtual void OnEditPaste();
+#endif
+    virtual void OnEditSelectAll();
+
+///////////////////////////////////////////////////////////////////////////////////
+// Misc.
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    CCellID GetNextItem(CCellID& cell, int nFlags) const;
+
+	BOOL SortItems(int nCol, BOOL bAscending, LPARAM data = 0);
+    BOOL SortTextItems(int nCol, BOOL bAscending, LPARAM data = 0);
+    BOOL SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data = 0);
+
+	void SetCompareFunction(PFNLVCOMPARE pfnCompare);
+
+	// in-built sort functions
+	static int CALLBACK pfnCellTextCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK pfnCellNumericCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Printing
+///////////////////////////////////////////////////////////////////////////////////
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+public:
+    void Print(CPrintDialog* pPrntDialog = NULL);
+
+    // EFW - New printing support functions
+    void EnableWysiwygPrinting(BOOL bEnable = TRUE) { m_bWysiwygPrinting = bEnable;     }
+    BOOL GetWysiwygPrinting()                       { return m_bWysiwygPrinting;        }
+
+    void SetShadedPrintOut(BOOL bEnable = TRUE)     {   m_bShadedPrintOut = bEnable;    }
+    BOOL GetShadedPrintOut(void)                    {   return m_bShadedPrintOut;       }
+
+    // Use -1 to have it keep the existing value
+    void SetPrintMarginInfo(int nHeaderHeight, int nFooterHeight,
+        int nLeftMargin, int nRightMargin, int nTopMargin,
+        int nBottomMargin, int nGap);
+
+    void GetPrintMarginInfo(int &nHeaderHeight, int &nFooterHeight,
+        int &nLeftMargin, int &nRightMargin, int &nTopMargin,
+        int &nBottomMargin, int &nGap);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Printing overrides for derived classes
+///////////////////////////////////////////////////////////////////////////////////
+public:
+    virtual void OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo);
+    virtual void OnPrint(CDC *pDC, CPrintInfo *pInfo);
+    virtual void OnEndPrinting(CDC *pDC, CPrintInfo *pInfo);
+
+#endif // #if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+
+// Implementation
+public:
+    virtual ~CGridCtrl();
+
+protected:
+    BOOL RegisterWindowClass();
+    BOOL Initialise();
+    void SetupDefaultCells();
+
+    LRESULT SendMessageToParent(int nRow, int nCol, int nMessage) const;
+    LRESULT SendDisplayRequestToParent(GV_DISPINFO* pDisplayInfo) const;
+    LRESULT SendCacheHintToParent(const CCellRange& range) const;
+
+    BOOL InvalidateCellRect(const int row, const int col);
+    BOOL InvalidateCellRect(const CCellID& cell);
+    BOOL InvalidateCellRect(const CCellRange& cellRange);
+    void EraseBkgnd(CDC* pDC);
+
+    BOOL GetCellRangeRect(const CCellRange& cellRange, LPRECT lpRect);
+
+    BOOL SetCell(int nRow, int nCol, CGridCellBase* pCell);
+
+    int  SetMouseMode(int nMode) { int nOldMode = m_MouseMode; m_MouseMode = nMode; return nOldMode; }
+    int  GetMouseMode() const    { return m_MouseMode; }
+
+    BOOL MouseOverRowResizeArea(CPoint& point);
+    BOOL MouseOverColumnResizeArea(CPoint& point);
+
+    CCellID GetTopleftNonFixedCell(BOOL bForceRecalculation = FALSE);
+    CCellRange GetUnobstructedNonFixedCellRange(BOOL bForceRecalculation = FALSE);
+	// LUC
+    CCellRange GetVisibleNonFixedCellRange(LPRECT pRect = NULL, BOOL bForceRecalculation = FALSE);
+    CCellRange GetVisibleFixedCellRange(LPRECT pRect = NULL, BOOL bForceRecalculation = FALSE);
+
+    BOOL IsVisibleVScroll() { return ( (m_nBarState & GVL_VERT) > 0); } 
+    BOOL IsVisibleHScroll() { return ( (m_nBarState & GVL_HORZ) > 0); }
+    void ResetSelectedRange();
+    void ResetScrollBars();
+    void EnableScrollBars(int nBar, BOOL bEnable = TRUE);
+    int  GetScrollPos32(int nBar, BOOL bGetTrackPos = FALSE);
+    BOOL SetScrollPos32(int nBar, int nPos, BOOL bRedraw = TRUE);
+
+    BOOL SortTextItems(int nCol, BOOL bAscending, int low, int high);
+    BOOL SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data,
+                   int low, int high);
+
+    CPoint GetPointClicked(int nRow, int nCol, const CPoint& point);
+
+	void ValidateAndModifyCellContents(int nRow, int nCol, LPCTSTR strText);
+
+// Overrrides
+    // ClassWizard generated virtual function overrides
+    //{{AFX_VIRTUAL(CGridCtrl)
+    protected:
+    virtual void PreSubclassWindow();
+    //}}AFX_VIRTUAL
+
+protected:
+#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING)
+    // Printing
+	virtual void PrintFixedRowCells(int nStartColumn, int nStopColumn, int& row, CRect& rect,
+                                    CDC *pDC, BOOL& bFirst);
+    virtual void PrintColumnHeadings(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintHeader(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintFooter(CDC *pDC, CPrintInfo *pInfo);
+    virtual void PrintRowButtons(CDC *pDC, CPrintInfo* /*pInfo*/);
+#endif
+
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    // Drag n' drop
+    virtual CImageList* CreateDragImage(CPoint *pHotSpot);    // no longer necessary
+#endif
+
+    // Mouse Clicks
+    virtual void  OnFixedColumnClick(CCellID& cell);
+    virtual void  OnFixedRowClick(CCellID& cell);
+
+    // Editing
+    virtual void  OnEditCell(int nRow, int nCol, CPoint point, UINT nChar);
+    virtual void  OnEndEditCell(int nRow, int nCol, CString str);
+	virtual BOOL  ValidateEdit(int nRow, int nCol, LPCTSTR str);
+    virtual void  EndEditing();
+
+    // Drawing
+    virtual void  OnDraw(CDC* pDC);
+
+    // CGridCellBase Creation and Cleanup
+    virtual CGridCellBase* CreateCell(int nRow, int nCol);
+    virtual void DestroyCell(int nRow, int nCol);
+
+// Attributes
+protected:
+    // General attributes
+    COLORREF    m_crFixedTextColour, m_crFixedBkColour;
+    COLORREF    m_crGridBkColour, m_crGridLineColour;
+    COLORREF    m_crWindowText, m_crWindowColour, m_cr3DFace,     // System colours
+                m_crShadow;
+    COLORREF    m_crTTipBackClr, m_crTTipTextClr;                 // Titletip colours - FNA
+    
+    BOOL        m_bVirtualMode;
+    LPARAM      m_lParam;                                           // lParam for callback
+    GRIDCALLBACK m_pfnCallback;                                     // The callback function
+
+    int         m_nGridLines;
+    BOOL        m_bEditable;
+    BOOL        m_bModified;
+    BOOL        m_bAllowDragAndDrop;
+    BOOL        m_bListMode;
+    BOOL        m_bSingleRowSelection;
+    BOOL        m_bSingleColSelection;
+    BOOL        m_bAllowDraw;
+    BOOL        m_bEnableSelection;
+    BOOL        m_bFixedRowSelection, m_bFixedColumnSelection;
+    BOOL        m_bSortOnClick;
+    BOOL        m_bHandleTabKey;
+    BOOL        m_bDoubleBuffer;
+    BOOL        m_bTitleTips;
+    int         m_nBarState;
+    BOOL        m_bWysiwygPrinting;
+    BOOL        m_bHiddenColUnhide, m_bHiddenRowUnhide;
+    BOOL        m_bAllowColHide, m_bAllowRowHide;
+    BOOL        m_bAutoSizeSkipColHdr;
+    BOOL        m_bTrackFocusCell;
+    BOOL        m_bFrameFocus;
+    UINT        m_nAutoSizeColumnStyle;
+
+	// Cell enable
+	vector<vector<CELL_ENABLE>>	m_pCellEnable;
+
+    // Cell size details
+    int         m_nRows, m_nFixedRows, m_nCols, m_nFixedCols;
+	// LUC
+	int			m_nFreezedRows, m_nFreezedCols;
+	BOOL m_bExcludeFreezedRowsFromSelection;
+	BOOL m_bExcludeFreezedColsFromSelection;
+	
+	// LUC
+	CArray<CCellRange, CCellRange&> m_arMergedCells;
+	// LUC
+	BOOL m_bShowHorzNonGridArea;
+	
+    CUIntArray  m_arRowHeights, m_arColWidths;
+    int         m_nVScrollMax, m_nHScrollMax;
+
+    // Fonts and images
+    CRuntimeClass*   m_pRtcDefault; // determines kind of Grid Cell created by default
+    CGridDefaultCell m_cellDefault;  // "default" cell. Contains default colours, font etc.
+    CGridDefaultCell m_cellFixedColDef, m_cellFixedRowDef, m_cellFixedRowColDef;
+    CFont       m_PrinterFont;  // for the printer
+    CImageList* m_pImageList;
+
+    // Cell data
+    CTypedPtrArray<CObArray, GRID_ROW*> m_RowData;
+
+    // Mouse operations such as cell selection
+    int         m_MouseMode;
+    BOOL        m_bLMouseButtonDown, m_bRMouseButtonDown;
+    CPoint      m_LeftClickDownPoint, m_LastMousePoint;
+    CCellID     m_LeftClickDownCell, m_SelectionStartCell;
+    CCellID     m_idCurrentCell, m_idTopLeftCell;
+    INT_PTR     m_nTimerID;
+    int         m_nTimerInterval;
+    int         m_nResizeCaptureRange;
+    BOOL        m_bAllowRowResize, m_bAllowColumnResize;
+    int         m_nRowsPerWheelNotch;
+    CMap<DWORD,DWORD, CCellID, CCellID&> m_SelectedCellMap, m_PrevSelectedCellMap;
+
+#ifndef GRIDCONTROL_NO_TITLETIPS
+    CTitleTip   m_TitleTip;             // Title tips for cells
+#endif
+
+    // Drag and drop
+    CCellID     m_LastDragOverCell;
+#ifndef GRIDCONTROL_NO_DRAGDROP
+    CGridDropTarget m_DropTarget;       // OLE Drop target for the grid
+#endif
+
+    // Printing information
+    CSize       m_CharSize;
+    int         m_nPageHeight;
+    CSize       m_LogicalPageSize,      // Page size in gridctrl units.
+                m_PaperSize;            // Page size in device units.
+    // additional properties to support Wysiwyg printing
+    int         m_nPageWidth;
+    int         m_nPrintColumn;
+    int         m_nCurrPrintRow;
+    int         m_nNumPages;
+    int         m_nPageMultiplier;
+
+    // sorting
+    int          m_bAscending;
+    int          m_nSortColumn;
+	PFNLVCOMPARE m_pfnCompare;
+
+    // EFW - Added to support shaded/unshaded printout.  If true, colored
+    // cells will print as-is.  If false, all text prints as black on white.
+    BOOL        m_bShadedPrintOut;
+
+    // EFW - Added support for user-definable margins.  Top and bottom are in 
+    // lines.  Left, right, and gap are in characters (avg width is used).
+    int         m_nHeaderHeight, m_nFooterHeight, m_nLeftMargin,
+                m_nRightMargin, m_nTopMargin, m_nBottomMargin, m_nGap;
+
+protected:
+    void SelectAllCells();
+    void SelectColumns(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void SelectRows(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void SelectCells(CCellID currentCell, BOOL bForceRedraw=FALSE, BOOL bSelectCells=TRUE);
+    void OnSelecting(const CCellID& currentCell);
+
+    // Generated message map functions
+    //{{AFX_MSG(CGridCtrl)
+    afx_msg void OnPaint();
+    afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+    afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+    afx_msg void OnSize(UINT nType, int cx, int cy);
+    afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+    afx_msg void OnTimer(UINT_PTR nIDEvent);
+    afx_msg UINT OnGetDlgCode();
+    afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+    afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnUpdateEditSelectAll(CCmdUI* pCmdUI);
+    //}}AFX_MSG
+#ifndef _WIN32_WCE_NO_CURSOR
+    afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+#endif
+#ifndef _WIN32_WCE
+    afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+    afx_msg void OnRButtonUp(UINT nFlags, CPoint point);    // EFW - Added
+    afx_msg void OnSysColorChange();
+#endif
+#ifndef _WIN32_WCE_NO_CURSOR
+    afx_msg void OnCaptureChanged(CWnd *pWnd);
+#endif
+#ifndef GRIDCONTROL_NO_CLIPBOARD
+    afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
+    afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
+    afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
+#endif
+#if (_MFC_VER >= 0x0421) || (_WIN32_WCE >= 210)
+    afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
+#endif
+#if !defined(_WIN32_WCE) && (_MFC_VER >= 0x0421)
+    afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+#endif
+    afx_msg LRESULT OnSetFont(WPARAM hFont, LPARAM lParam);
+    afx_msg LRESULT OnGetFont(WPARAM hFont, LPARAM lParam);
+    afx_msg LRESULT OnImeChar(WPARAM wCharCode, LPARAM lParam);
+    afx_msg void OnEndInPlaceEdit(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnComboSelChange(NMHDR* pNMHDR, LRESULT* pResult);
+    DECLARE_MESSAGE_MAP()
+
+    enum eMouseModes { MOUSE_NOTHING, MOUSE_SELECT_ALL, MOUSE_SELECT_COL, MOUSE_SELECT_ROW,
+                       MOUSE_SELECT_CELLS, MOUSE_SCROLLING_CELLS,
+                       MOUSE_OVER_ROW_DIVIDE, MOUSE_SIZING_ROW,
+                       MOUSE_OVER_COL_DIVIDE, MOUSE_SIZING_COL,
+                       MOUSE_PREPARE_EDIT,
+#ifndef GRIDCONTROL_NO_DRAGDROP
+                       MOUSE_PREPARE_DRAG, MOUSE_DRAGGING
+#endif
+    };
+//      for sort in virtual mode, and column order, save and load layer
+public:
+	typedef std::vector<int> intlist;
+	void Reorder(int From, int To);
+	void SetVirtualCompare(PVIRTUALCOMPARE VirtualCompare) { m_pfnVirtualCompare = VirtualCompare;}
+	int m_CurCol;
+	void AllowReorderColumn(bool b=true) { m_AllowReorderColumn = b;}
+	void EnableDragRowMode(bool b=true) { m_bDragRowMode = b; if(b) EnableDragAndDrop(); } // to change row order
+	int GetLayer(int** pLayer); //  gives back the number of ints of the area (do not forget to delete *pLayer)
+	void SetLayer(int* pLayer); // coming from a previous GetLayer (ignored if not same number of column, or the same revision number)
+	void ForceQuitFocusOnTab(bool b=true) { m_QuitFocusOnTab = b;} // use only if GetParent() is a CDialog
+	void AllowSelectRowInFixedCol(bool b=true) { m_AllowSelectRowInFixedCol = b;} // 
+//    allow acces?
+	intlist m_arRowOrder, m_arColOrder;
+	static CGridCtrl* m_This;
+protected:
+	virtual void AddSubVirtualRow(int Num, int Nb);
+	bool m_bDragRowMode;
+	int m_CurRow;
+private:
+	void ResetVirtualOrder();
+	PVIRTUALCOMPARE m_pfnVirtualCompare;
+	static bool NotVirtualCompare(int c1, int c2);
+	bool m_InDestructor;
+	bool m_AllowReorderColumn;
+	bool m_QuitFocusOnTab;
+	bool m_AllowSelectRowInFixedCol;
+
+};
+
+// Returns the default cell implementation for the given grid region
+inline CGridCellBase* CGridCtrl::GetDefaultCell(BOOL bFixedRow, BOOL bFixedCol) const
+{ 
+    if (bFixedRow && bFixedCol) return (CGridCellBase*) &m_cellFixedRowColDef;
+    if (bFixedRow)              return (CGridCellBase*) &m_cellFixedRowDef;
+    if (bFixedCol)              return (CGridCellBase*) &m_cellFixedColDef;
+    return (CGridCellBase*) &m_cellDefault;
+}
+
+inline CGridCellBase* CGridCtrl::GetCell(int nRow, int nCol) const
+{
+	if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols) 
+        return NULL;
+	
+    if (GetVirtualMode())
+    {
+        CGridCellBase* pCell = GetDefaultCell(nRow < m_nFixedRows, nCol < m_nFixedCols);
+        static GV_DISPINFO gvdi;
+        gvdi.item.row     = nRow;
+        gvdi.item.col     = nCol;
+        gvdi.item.mask    = 0xFFFFFFFF;
+        gvdi.item.nState  = 0;
+        gvdi.item.nFormat = pCell->GetFormat();
+        gvdi.item.iImage  = pCell->GetImage();
+        gvdi.item.crBkClr = pCell->GetBackClr();
+        gvdi.item.crFgClr = pCell->GetTextClr();
+        gvdi.item.lParam  = pCell->GetData();
+        memcpy(&gvdi.item.lfFont, pCell->GetFont(), sizeof(LOGFONT));
+        gvdi.item.nMargin = pCell->GetMargin();
+        gvdi.item.strText.Empty();
+
+        // Fix the state bits
+        if (IsCellSelected(nRow, nCol))   gvdi.item.nState |= GVIS_SELECTED;
+        if (nRow < GetFixedRowCount())    gvdi.item.nState |= (GVIS_FIXED | GVIS_FIXEDROW);
+        if (nCol < GetFixedColumnCount()) gvdi.item.nState |= (GVIS_FIXED | GVIS_FIXEDCOL);
+        if (GetFocusCell() == CCellID(nRow, nCol)) gvdi.item.nState |= GVIS_FOCUSED;
+		if(!m_InDestructor)
+		{
+			gvdi.item.row = m_arRowOrder[nRow];
+			gvdi.item.col = m_arColOrder[nCol];
+
+			if (m_pfnCallback)
+				m_pfnCallback(&gvdi, m_lParam);
+			else
+				SendDisplayRequestToParent(&gvdi);
+			gvdi.item.row = nRow;        
+			gvdi.item.col = nCol;
+		}
+        static CGridCell cell;
+        cell.SetState(gvdi.item.nState);
+        cell.SetFormat(gvdi.item.nFormat);
+        cell.SetImage(gvdi.item.iImage);
+        cell.SetBackClr(gvdi.item.crBkClr);
+        cell.SetTextClr(gvdi.item.crFgClr);
+        cell.SetData(gvdi.item.lParam);
+        cell.SetFont(&(gvdi.item.lfFont));
+        cell.SetMargin(gvdi.item.nMargin);
+        cell.SetText(gvdi.item.strText);
+        cell.SetGrid((CGridCtrl*)this);
+
+        return (CGridCellBase*) &cell;
+    }
+
+    GRID_ROW* pRow = m_RowData[nRow];
+    if (!pRow) return NULL;
+	if(pRow->GetData() == NULL)
+		return NULL;
+    return pRow->GetAt(m_arColOrder[nCol]);
+}
+
+inline BOOL CGridCtrl::SetCell(int nRow, int nCol, CGridCellBase* pCell)
+{
+    if (GetVirtualMode())
+        return FALSE;
+
+    if (nRow < 0 || nRow >= m_nRows || nCol < 0 || nCol >= m_nCols) 
+        return FALSE;
+
+    GRID_ROW* pRow = m_RowData[nRow];
+    if (!pRow) return FALSE;
+
+    pCell->SetCoords( nRow, nCol); 
+    pRow->SetAt(nCol, pCell);
+
+    return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCTRL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/GridDropTarget.h b/Lib/SISControls/GridControl/GridDropTarget.h
new file mode 100644
index 0000000..1fe5887
--- /dev/null
+++ b/Lib/SISControls/GridControl/GridDropTarget.h
@@ -0,0 +1,82 @@
+//////////////////////////////////////////////////////////////////////
+// GridDropTarget.h : header file
+//
+// MFC Grid Control - Drag/Drop target implementation
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_)
+#define AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+
+#include <afxole.h>
+
+class CGridCtrl;
+
+/////////////////////////////////////////////////////////////////////////////
+// CGridDropTarget command target
+
+class AFX_EXT_CLASS CGridDropTarget : public COleDropTarget
+{
+public:
+    CGridDropTarget();
+    virtual ~CGridDropTarget();
+
+// Attributes
+public:
+    CGridCtrl* m_pGridCtrl;
+    BOOL       m_bRegistered;
+
+// Operations
+public:
+    BOOL Register(CGridCtrl *pGridCtrl);
+    virtual void Revoke();
+
+    BOOL        OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+    DROPEFFECT  OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    void        OnDragLeave(CWnd* pWnd);
+    DROPEFFECT  OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+    DROPEFFECT  OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point);
+
+// Overrides
+    // ClassWizard generated virtual function overrides
+    //{{AFX_VIRTUAL(CGridDropTarget)
+    //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+    // Generated message map functions
+    //{{AFX_MSG(CGridDropTarget)
+    //}}AFX_MSG
+
+    DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDDROPTARGET_H__5C610981_BD36_11D1_97CD_00A0243D1382__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/GridInPlaceEdit.h b/Lib/SISControls/GridControl/GridInPlaceEdit.h
new file mode 100644
index 0000000..b26b207
--- /dev/null
+++ b/Lib/SISControls/GridControl/GridInPlaceEdit.h
@@ -0,0 +1,83 @@
+//////////////////////////////////////////////////////////////////////
+// InPlaceEdit.h : header file
+//
+// MFC Grid Control - inplace editing class
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+class CGridInPlaceEdit : public CEdit
+{
+// Construction
+public:
+    CGridInPlaceEdit(CWnd* pParent, CRect& rect, DWORD dwStyle, UINT nID,
+                 int nRow, int nColumn, CString sInitText, UINT nFirstChar);
+
+// Attributes
+public:
+ 
+// Operations
+public:
+     void EndEdit();
+ 
+// Overrides
+     // ClassWizard generated virtual function overrides
+     //{{AFX_VIRTUAL(CGridInPlaceEdit)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+ 
+// Implementation
+public:
+     virtual ~CGridInPlaceEdit();
+ 
+// Generated message map functions
+protected:
+    //{{AFX_MSG(CGridInPlaceEdit)
+    afx_msg void OnKillFocus(CWnd* pNewWnd);
+    afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+    afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg UINT OnGetDlgCode();
+	//}}AFX_MSG
+    DECLARE_MESSAGE_MAP()
+
+private:
+    int     m_nRow;
+    int     m_nColumn;
+    CString m_sInitText;
+    UINT    m_nLastChar;
+    BOOL    m_bExitOnArrows;
+    CRect   m_Rect;
+};
+ 
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACEEDIT_H__ECD42821_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/GridMemDC.h b/Lib/SISControls/GridControl/GridMemDC.h
new file mode 100644
index 0000000..f0f4894
--- /dev/null
+++ b/Lib/SISControls/GridControl/GridMemDC.h
@@ -0,0 +1,106 @@
+#if !defined(AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_)
+#define AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// MemDC.h : header file
+//
+
+//////////////////////////////////////////////////
+// CGridMemDC - memory DC
+//
+// Author: Keith Rule
+// Email:  keithr@europa.com
+// Copyright 1996-1997, Keith Rule
+//
+// You may freely use or modify this code provided this
+// Copyright is included in all derived versions.
+//
+// History - 10/3/97 Fixed scrolling bug.
+//                   Added print support.
+//           25 feb 98 - fixed minor assertion bug
+//
+// This class implements a memory Device Context
+
+class CGridMemDC : public CDC
+{
+public:
+
+    // constructor sets up the memory DC
+    CGridMemDC(CDC* pDC) : CDC()
+    {
+//        ASSERT(pDC != NULL);
+
+        m_pDC = pDC;
+        m_pOldBitmap = NULL;
+#ifndef _WIN32_WCE_NO_PRINTING
+        m_bMemDC = !pDC->IsPrinting();
+#else
+        m_bMemDC = FALSE;
+#endif
+
+        if (m_bMemDC)    // Create a Memory DC
+        {
+            pDC->GetClipBox(&m_rect);
+            CreateCompatibleDC(pDC);
+            m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+            m_pOldBitmap = SelectObject(&m_bitmap);
+#ifndef _WIN32_WCE
+            SetWindowOrg(m_rect.left, m_rect.top);
+#endif
+            // EFW - Bug fix - Fill background in case the user has overridden
+            // WM_ERASEBKGND.  We end up with garbage otherwise.
+            // CJM - moved to fix a bug in the fix.
+            FillSolidRect(m_rect, pDC->GetBkColor());
+        }
+        else        // Make a copy of the relevent parts of the current DC for printing
+        {
+#if !defined(_WIN32_WCE) || ((_WIN32_WCE > 201) && !defined(_WIN32_WCE_NO_PRINTING))
+            m_bPrinting = pDC->m_bPrinting;
+#endif
+            m_hDC       = pDC->m_hDC;
+            m_hAttribDC = pDC->m_hAttribDC;
+        }
+
+    }
+
+    // Destructor copies the contents of the mem DC to the original DC
+    ~CGridMemDC()
+    {
+        if (m_bMemDC)
+        {
+            // Copy the offscreen bitmap onto the screen.
+            m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+                          this, m_rect.left, m_rect.top, SRCCOPY);
+
+            //Swap back the original bitmap.
+            SelectObject(m_pOldBitmap);
+        } else {
+            // All we need to do is replace the DC with an illegal value,
+            // this keeps us from accidently deleting the handles associated with
+            // the CDC that was passed to the constructor.
+            m_hDC = m_hAttribDC = NULL;
+        }
+    }
+
+    // Allow usage as a pointer
+    CGridMemDC* operator->() {return this;}
+        
+    // Allow usage as a pointer
+    operator CGridMemDC*() {return this;}
+
+private:
+    CBitmap  m_bitmap;      // Offscreen bitmap
+    CBitmap* m_pOldBitmap;  // bitmap originally found in CGridMemDC
+    CDC*     m_pDC;         // Saves CDC passed in constructor
+    CRect    m_rect;        // Rectangle of drawing area.
+    BOOL     m_bMemDC;      // TRUE if CDC really is a Memory DC.
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_MEMDC_H__CA1D3541_7235_11D1_ABBA_00A0243D1382__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/NewCellTypes/GridCellCheck.h b/Lib/SISControls/GridControl/NewCellTypes/GridCellCheck.h
new file mode 100644
index 0000000..049cb44
--- /dev/null
+++ b/Lib/SISControls/GridControl/NewCellTypes/GridCellCheck.h
@@ -0,0 +1,68 @@
+#if !defined(AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCellCheck.h : header file
+//
+// MFC Grid Control - Grid combo cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+
+#include "..\\GridCell.h"
+
+
+class AFX_EXT_CLASS CGridCellCheck : public CGridCell
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCellCheck)
+
+public:
+    CGridCellCheck();
+
+public:
+	BOOL SetCheck(BOOL bChecked = TRUE);
+	BOOL GetCheck();
+
+// Operations
+	virtual CSize GetCellExtent(CDC* pDC);
+    virtual void OnClick( CPoint PointCellRelative);
+    virtual BOOL GetTextRect( LPRECT pRect);
+
+protected:
+	CRect GetCheckPlacement();
+
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+protected:
+    BOOL  m_bChecked;
+    CRect m_Rect;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLCHECK_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/NewCellTypes/GridCellCombo.h b/Lib/SISControls/GridControl/NewCellTypes/GridCellCombo.h
new file mode 100644
index 0000000..bf436c3
--- /dev/null
+++ b/Lib/SISControls/GridControl/NewCellTypes/GridCellCombo.h
@@ -0,0 +1,178 @@
+#if !defined(AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+/////////////////////////////////////////////////////////////////////////////
+// GridCellCombo.h : header file
+//
+// MFC Grid Control - Grid combo cell class header file
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10
+//
+//////////////////////////////////////////////////////////////////////
+
+
+#include "../GridCell.h"
+
+
+class AFX_EXT_CLASS CGridCellCombo : public CGridCell
+{
+    friend class CGridCtrl;
+    DECLARE_DYNCREATE(CGridCellCombo)
+
+public:
+    CGridCellCombo();
+
+// editing cells
+public:
+    virtual BOOL  Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual CWnd* GetEditWnd() const;
+    virtual void  EndEdit();
+
+// Operations
+public:
+	virtual CSize GetCellExtent(CDC* pDC);
+
+// CGridCellCombo specific calls
+public:
+    void  SetOptions(const CStringArray& ar);
+    void  SetStyle(DWORD dwStyle)           { m_dwStyle = dwStyle; }
+    DWORD GetStyle()                        { return m_dwStyle;    }
+
+protected:
+    virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+
+    CStringArray m_Strings;
+    DWORD        m_dwStyle;
+};
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CComboEdit window
+
+#define IDC_COMBOEDIT 1001
+
+class CComboEdit : public CEdit
+{
+// Construction
+public:
+	CComboEdit();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CComboEdit)
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CComboEdit();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CComboEdit)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceList window
+
+class CInPlaceList : public CComboBox
+{
+    friend class CComboEdit;
+
+// Construction
+public:
+	CInPlaceList(CWnd* pParent,         // parent
+                 CRect& rect,           // dimensions & location
+                 DWORD dwStyle,         // window/combobox style
+                 UINT nID,              // control ID
+                 int nRow, int nColumn, // row and column
+                 COLORREF crFore, COLORREF crBack,  // Foreground, background colour
+				 CStringArray& Items,   // Items in list
+                 CString sInitText,     // initial selection
+				 UINT nFirstChar);      // first character to pass to control
+
+// Attributes
+public:
+   CComboEdit m_edit;  // subclassed edit control
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceList)
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceList();
+    void EndEdit();
+
+protected:
+    int GetCorrectDropWidth();
+
+// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceList)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnDropdown();
+	afx_msg void OnSelChange();
+	afx_msg UINT OnGetDlgCode();
+	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
+	//}}AFX_MSG
+	//afx_msg void OnSelendOK();
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	int		 m_nNumLines;
+	CString  m_sInitText;
+	int		 m_nRow;
+	int		 m_nCol;
+ 	UINT     m_nLastChar; 
+	BOOL	 m_bExitOnArrows; 
+    COLORREF m_crForeClr, m_crBackClr;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_GRIDCELLCOMBO_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h b/Lib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
new file mode 100644
index 0000000..a3d5a76
--- /dev/null
+++ b/Lib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h
@@ -0,0 +1,92 @@
+// GridCellDateTime.h: interface for the CGridCellDateTime class.
+//
+// Provides the implementation for a datetime picker cell type of the
+// grid control.
+//
+// For use with CGridCtrl v2.22+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_)
+#define AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+#include "afxdtctl.h"	// for CDateTimeCtrl
+
+class CGridCellDateTime : public CGridCell  
+{
+  friend class CGridCtrl;
+  DECLARE_DYNCREATE(CGridCellDateTime)
+
+  CTime m_cTime;
+  DWORD m_dwStyle;
+
+public:
+	CGridCellDateTime();
+	CGridCellDateTime(DWORD dwStyle);
+	virtual ~CGridCellDateTime();
+    virtual CSize GetCellExtent(CDC* pDC);
+
+  // editing cells
+public:
+	void Init(DWORD dwStyle);
+	virtual BOOL  Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+	virtual CWnd* GetEditWnd() const;
+	virtual void  EndEdit();
+
+
+	CTime* GetTime() {return &m_cTime;};
+	void   SetTime(CTime time);
+};
+
+class CInPlaceDateTime : public CDateTimeCtrl
+{
+// Construction
+public:
+	CInPlaceDateTime(CWnd* pParent,         // parent
+                   CRect& rect,           // dimensions & location
+                   DWORD dwStyle,         // window/combobox style
+                   UINT nID,              // control ID
+                   int nRow, int nColumn, // row and column
+                   COLORREF crFore, COLORREF crBack,  // Foreground, background colour
+                   CTime* pcTime,
+          		   UINT nFirstChar);      // first character to pass to control
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceList)
+	protected:
+	virtual void PostNcDestroy();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceDateTime();
+    void EndEdit();
+
+// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceList)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg UINT OnGetDlgCode();
+	//}}AFX_MSG
+	//afx_msg void OnSelendOK();
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+    CTime*   m_pcTime;
+	int		 m_nRow;
+	int		 m_nCol;
+ 	UINT     m_nLastChar; 
+	BOOL	 m_bExitOnArrows; 
+    COLORREF m_crForeClr, m_crBackClr;
+};
+
+#endif // !defined(AFX_DATETIMECELL_H__A0B7DA0A_0AFE_4D28_A00E_846C96D7507A__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h b/Lib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
new file mode 100644
index 0000000..4efb7d7
--- /dev/null
+++ b/Lib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h
@@ -0,0 +1,26 @@
+// GridCellNumeric.h: interface for the CGridCellNumeric class.
+//
+// Written by Andrew Truckle [ajtruckle@wsatkins.co.uk]
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_)
+#define AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+
+class AFX_EXT_CLASS CGridCellNumeric : public CGridCell  
+{
+    DECLARE_DYNCREATE(CGridCellNumeric)
+
+public:
+    virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual void EndEdit();
+
+};
+
+#endif // !defined(AFX_GRIDINTEGERCELL_H__3479ED0D_B57D_4940_B83D_9E2296ED75B5__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/NewCellTypes/GridURLCell.h b/Lib/SISControls/GridControl/NewCellTypes/GridURLCell.h
new file mode 100644
index 0000000..c3dffa0
--- /dev/null
+++ b/Lib/SISControls/GridControl/NewCellTypes/GridURLCell.h
@@ -0,0 +1,55 @@
+// GridURLCell.h: interface for the CGridURLCell class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_)
+#define AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "..\\GridCell.h"
+
+typedef struct {
+    LPCTSTR szURLPrefix;
+    size_t  nLength;
+} URLStruct;
+
+
+
+class CGridURLCell : public CGridCell  
+{
+    DECLARE_DYNCREATE(CGridURLCell)
+
+public:
+	CGridURLCell();
+	virtual ~CGridURLCell();
+
+    virtual BOOL     Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE);
+    virtual BOOL     Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar);
+    virtual LPCTSTR  GetTipText() { return NULL; }
+	void SetAutoLaunchUrl(BOOL bLaunch = TRUE) { m_bLaunchUrl = bLaunch;	}
+	BOOL GetAutoLaunchUrl() { return m_bLaunchUrl;	}
+
+protected:
+    virtual BOOL OnSetCursor();
+    virtual void OnClick(CPoint PointCellRelative);
+
+	BOOL HasUrl(CString str);
+    BOOL OverURL(CPoint& pt, CString& strURL);
+
+protected:
+#ifndef _WIN32_WCE
+    static HCURSOR g_hLinkCursor;		// Hyperlink mouse cursor
+	HCURSOR GetHandCursor();
+#endif
+    static URLStruct g_szURIprefixes[];
+
+protected:
+	COLORREF m_clrUrl;
+	BOOL     m_bLaunchUrl;
+    CRect    m_Rect;
+};
+
+#endif // !defined(AFX_GRIDURLCELL_H__9F4A50B4_D773_11D3_A439_F7E60631F563__INCLUDED_)
diff --git a/Lib/SISControls/GridControl/TitleTip.h b/Lib/SISControls/GridControl/TitleTip.h
new file mode 100644
index 0000000..3894a4f
--- /dev/null
+++ b/Lib/SISControls/GridControl/TitleTip.h
@@ -0,0 +1,87 @@
+/////////////////////////////////////////////////////////////////////////////
+// Titletip.h : header file
+//
+// MFC Grid Control - cell titletips
+//
+// Written by Chris Maunder <chris@codeproject.com>
+// Copyright (c) 1998-2005. All Rights Reserved.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name and all copyright 
+// notices remains intact. 
+//
+// An email letting me know how you are using it would be nice as well. 
+//
+// This file is provided "as is" with no expressed or implied warranty.
+// The author accepts no liability for any damage/loss of business that
+// this product may cause.
+//
+// For use with CGridCtrl v2.10+
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_)
+#define AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#define TITLETIP_CLASSNAME _T("ZTitleTip")
+
+/////////////////////////////////////////////////////////////////////////////
+// CTitleTip window
+
+class AFX_EXT_CLASS CTitleTip : public CWnd
+{
+// Construction
+public:
+	CTitleTip();
+	virtual ~CTitleTip();
+	virtual BOOL Create( CWnd *pParentWnd);
+
+// Attributes
+public:
+    void SetParentWnd(CWnd* pParentWnd)  { m_pParentWnd = pParentWnd; }
+    CWnd* GetParentWnd()                 { return m_pParentWnd;       }
+
+// Operations
+public:
+	void Show(CRect rectTitle, LPCTSTR lpszTitleText, 
+              int xoffset = 0, LPRECT lpHoverRect = NULL, 
+              const LOGFONT* lpLogFont = NULL,
+              COLORREF crTextClr = CLR_DEFAULT, COLORREF crBackClr = CLR_DEFAULT);
+    void Hide();
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CTitleTip)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL DestroyWindow();
+	//}}AFX_VIRTUAL
+
+// Implementation
+protected:
+	CWnd  *m_pParentWnd;
+	CRect  m_rectTitle;
+    CRect  m_rectHover;
+    DWORD  m_dwLastLButtonDown;
+    DWORD  m_dwDblClickMsecs;
+    BOOL   m_bCreated;
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CTitleTip)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_TITLETIP_H__C7165DA1_187F_11D1_992F_895E185F9C72__INCLUDED_)
diff --git a/Lib/SISControls/include/CellCtrl.h b/Lib/SISControls/include/CellCtrl.h
new file mode 100644
index 0000000..b8bc378
--- /dev/null
+++ b/Lib/SISControls/include/CellCtrl.h
@@ -0,0 +1,304 @@
+#ifndef _CELLCTRL_H_
+#define _CELLCTRL_H_
+#define _CELLCTRL_LIB_H_
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// CellCtrl.h : header file
+//
+#include "HeadCtrl.h"
+
+#ifndef  __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CCellCtrl window
+#define CCMSG_USE_EDIT			WM_USER+1
+#define CCMSG_MOVE_EDIT			WM_USER+2
+#define CCMSG_RECT_CHANGE		WM_USER+3
+//#define CCMSG_SEL_PRINT		WM_USER+4
+#define CCMSG_LIST_PRINT		WM_USER+5
+#define CCMSG_FONT_CHANGE		WM_USER+6
+#define CCMSG_SAVE_FILE			WM_USER+7
+#define CCMSG_OPEN_EXCEL		WM_USER+8
+#define CCMSG_OPEN_LIST			WM_USER+9
+#define CCMSG_MODIFY_EDIT		WM_USER+10
+#define CCMSG_COPY_CLIPBOARD	WM_USER+11
+#define CCMSG_PASTE_CLIPBOARD	WM_USER+12
+#define CCMSG_CUT_CLIPBOARD		WM_USER+13
+#define CCMSG_SELITEM_DELETE	WM_USER+14
+#define CCMSG_BACK_COLOR		WM_USER+15
+#define CCMSG_TEXT_COLOR		WM_USER+16
+#define CCMSG_LIST				WM_USER-1
+
+const COLORREF clrTEXT=0x00000000;
+const COLORREF clrBACK=0x00FFFFFF;
+
+class AFX_EXT_CLASS CCellCtrl : public CListCtrl
+{
+public:
+	struct LOCATION
+	{
+		int nItem;
+		int nSubItem;
+	};
+
+	struct CELLCOLOR
+	{
+		COLORREF txtclr;
+		COLORREF bkgclr;
+	};
+
+	struct CELLINFO
+	{
+		int nId;			//CONTROL ID
+		int nItem;			//LIST ITEM
+		int nSubItem;		//LIST SUBITEM
+		CELLCOLOR oldClr;	//汲沥傈狼 祸
+		CELLCOLOR newClr;	//汲沥饶狼 祸
+		LPWSTR lpstrOld;	//涝仿傈 巩磊凯
+		LPWSTR lpstrNew;	//涝仿茄 巩磊凯
+	};
+
+	struct CELLDATA
+	{
+		COLORREF txtclr;//臂磊祸
+		COLORREF bkgclr;//硅版祸
+		bool	 bUseCtl;//牧飘费 荤侩
+		bool	 bTurn; //馆娄馆娄
+		DWORD    dwData;
+	};
+
+	class CCellData : public CELLDATA
+	{
+	public:
+		CCellData()
+		{
+			bTurn =false;
+			bUseCtl=false;//牧飘费 荤侩
+			txtclr=clrTEXT;
+			bkgclr=clrBACK;
+			dwData=0;
+		}
+
+		CCellData(COLORREF TextColor, COLORREF BackColor,
+				  bool bTurning, DWORD dwUserData=0)
+		{
+			bTurn =bTurning;
+			bUseCtl=false;//牧飘费 荤侩
+			txtclr=TextColor;
+			bkgclr=BackColor;
+			dwData=dwUserData;
+		}
+		virtual ~CCellData(){;}
+		void operator=(const CELLDATA& cc)
+		{
+			(CELLDATA)*this=cc;	
+		}
+	};
+	typedef CArray<CCellData, CCellData&> CCSArray;
+	virtual void SerializeAllInfo(CArchive& ar);
+
+protected:
+	CBrush m_brush;		//俊叼飘冠胶狼 硅版
+	CEdit  m_edit;		//俊叼飘 冠胶
+	BOOL	m_bCanEdit;
+	CFont* m_pFont;		//府胶飘 迄飘
+
+protected:
+	void Printing(CDC* pDC);//府胶飘甫 橇赴飘肺 免仿茄促.
+	CRect GetLogRect(CDC* pDC, int nItem, int nSubItem);//府胶飘 伎Rect阑 厚啦俊 蝶扼 函券茄促.
+	void SetCrtToPrintRate(CDC* pDC);//拳搁苞 厘钎狼 厚啦阑 备茄促.
+	int  GetCrtWidth();//拳搁(府胶飘)狼 气蔼阑 府畔茄促.
+
+protected:
+	BOOL m_bSort;//Sort Flag
+	BOOL m_bTime;//SetTimer(,,)甫 汲沥沁绰瘤 咯何
+	BOOL m_bTurnDraw;//府胶飘 盎脚矫 伎狼 祸彬捞 函秦具窍绰瘤 咯何
+	UINT  m_nClipOptin;//努赋焊靛 可记
+	CHeadCtrl m_head;//HeaderCtrl
+	LOCATION m_mcLct;//right mouse click
+	LOCATION m_edLct;//edit location
+	UINT m_nStartColEdit;
+	UINT m_nEndColEdit;
+	CMenu m_menu;//府胶飘 皋春 
+	CMenu* m_pUmenu;//荤侩磊 沥狼 皋春
+	CELLINFO* m_pInfo;
+
+	//汲沥等 Item Data甫 昏力茄促.
+	void DeleteItemData(int nItem);
+	void DeleteAllItemData();
+
+	//俊叼飘冠胶狼 Data甫 荐沥沁绰瘤 咯何甫 眉农窍绊 
+	//何葛扩档快肺 皋矫瘤甫 焊辰促.
+	BOOL IsModifyEdit(int nItem, int nSubItem);
+
+	//酒捞袍狼 康开捞 函沁阑 版快俊 俊叼飘冠胶狼 农扁档 函秦具 窍骨肺
+	//促澜窃荐甫 捞侩窍咯 俊叼飘冠胶甫 盎脚茄促.
+	void UpdateEdit(int nItem, int nSubItem);
+
+	//伎狼 康开阑 盎脚茄促.
+	void UpdateCell(int nItem, int nSubItem);
+
+	//伎狼 拿矾啊 函窍档废 汲沥登绢 乐绰瘤 咯何
+	bool IsTurning(int nItem, int nSubItem);
+
+	//府胶飘狼 沥纺 left,right,center 屈侥阑 备茄促.
+	int  GetColumnFmt(int nSubItem);	
+
+public:
+	enum ListOption
+	{
+		//MENU OPTION
+		menuNO		=	0x00000000,
+		menuEXCEL	=	0x00000001,
+		menuLIST	=	0x00000002,
+		menuPRINT	=	0x00000004,
+		menuINPUT	=	0x00000010,
+		menuSAVE	=	0x00000020,
+		menuFONT	=	0x00000040,
+		menuBACKCOLOR=	0x00000100,
+		menuTEXTCOLOR=	0x00000200,
+		menuCOPY	=	0x00010000,
+		menuPASTE	=	0x00020000,
+		menuCUT		=	0x00040000,
+		menuDELETE	=	0x00080000,
+		menuCOMMON	=	0x000000FF,
+		menuCLIP	=	0x000F0000,
+		menuALL		=	0x000FFFFF,
+		menuAceept  =   0x00010000,
+
+		//CLIPBOARD OPTION
+		clipNO		=	0x00000000,
+		clipCOPY	=	0x00000001,
+		clipPASTE	=	0x00000002,
+		clipCUT		=	0x00000004,
+		clipDELETE	=	0x00000008,
+		clipALL		=	0x0000FFFF,
+	};
+	CCellCtrl();
+
+	//Sort function
+	void EnableSort(BOOL bSort=TRUE){m_bSort=bSort;}
+	void EnableEdit(BOOL bCanEdit)	{ m_bCanEdit = bCanEdit; }
+
+	//menu function
+	BOOL CCellCtrl::SetMenu(CMenu* pMenu=NULL){m_pUmenu=pMenu; return TRUE;}
+	void UseMenu( UINT nOption=menuCOMMON/*default=menuCOMMON*/);
+
+	//editbox function
+	BOOL SetEditMovable( int nStartCol, int nEndCol);
+	BOOL UseEdit( int nItem, int nSubItem);
+	void EditCtrl( MSG pMsg );
+
+	//Rect捞 函沁绰瘤 魄窜茄促.
+	BOOL IsSubRectChange();	
+
+	//府胶飘甫 橇赴飘肺 免仿茄促.
+	BOOL ListPrinting(BOOL bDialog, int Orientation=1/*啊肺=1, 技肺=2*/);
+
+	//keystate function 
+	BOOL IsMultiKey();//shift虐, ctrl虐殿捞 喘矾脸绰瘤 check茄促
+
+	//font function
+	void SetLogFont(LOGFONT logfont);//厘钎 迄飘
+	void SetListFont(LOGFONT* logfont);//府胶飘 迄飘
+
+	//
+	int GetSubItemCount();		//拿烦荐甫 备茄促.
+	int GetLeftSubItem();		//谅螟栏肺何磐 劝己拳等 拿烦阑 茫绰促.
+	int GetRightSubItem();		//快螟栏肺何磐 劝己拳等 拿烦阑 茫绰促.
+	
+	//荤侩磊啊 鞘夸茄 蔼阑 历厘窍绊 阂矾棵荐 乐绰 窃荐捞促.
+	BOOL SetCellData(int nItem, int nSubItem, DWORD dwData);
+	DWORD GetCellData(int nItem, int nSubItem);
+
+	//color function
+	BOOL SetItemTextColor(int nItem, COLORREF color);
+	BOOL SetItemTextColor(int nItem, int nSubItem, COLORREF color);
+	BOOL SetItemBkColor(int nItem, COLORREF color, bool bTurn=false);
+	BOOL SetItemBkColor(int nItem, int nSubItem, COLORREF color, bool bTurn=false);
+	BOOL GetItemColor(int nItem, int nSubItem, CELLCOLOR* pCellClr);
+
+	//Clipboard function
+	void UseClipboard( UINT nOption=clipALL/*default=clipALL*/){m_nClipOptin=nOption;}
+	void CopyClipboard();// Ctrl C (select item copy)
+	void PasteClipboard();//Ctrl V (paste)
+	void CutClipboard();//Ctrl V (paste)
+	void SelectItemDelete();
+
+	BOOL DeleteColumn( int nCol );
+	int  InsertColumn(int nCol, LPCTSTR lpstTxt,int nFormat=LVCFMT_LEFT, 
+						int nWidth = -1, int nSubItem = -1);
+
+	//HeaderCtrl function
+	BOOL GetSafeHead();
+	int  GetHeadHeight();
+	int  GetHeadItemCount();
+	void SetHeadItemCount(int nCount);
+	void SetHeadItemText(int nItem, int nSubItem, LPCTSTR lpstTxt);
+	CString GetHeadItemText(int nItem, int nSubItem);
+	void SetHeadItemMerge(int nsItem, int nsSubItem, 
+						  int neItem, int neSubItem);
+
+protected:
+
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CCellCtrl)
+	public:
+	virtual void Serialize(CArchive& ar);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	protected:
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	void SaveFile();
+	virtual ~CCellCtrl();
+
+	// Generated message map functions
+protected:
+
+	//{{AFX_MSG(CCellCtrl)
+//	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
+	afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	afx_msg void OnInsertitem(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnDeleteallitems(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnDestroy();
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+	afx_msg void OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult );
+	afx_msg void OnSaveFile();
+	afx_msg void OnOpenExcel();
+	afx_msg void OnOpenList();
+	afx_msg void OnUseEdit();
+	afx_msg void OnMoveEdit();
+	afx_msg void OnRectchange();
+	afx_msg void OnListPrint();
+	afx_msg void OnFontChange();
+	afx_msg void OnBackColor();
+	afx_msg void OnTextColor();
+
+	afx_msg void OnCopyClipboard()	{	CopyClipboard();	}
+	afx_msg void OnPasteClipboard()	{	PasteClipboard();	}
+	afx_msg void OnCutClipboard()	{	CutClipboard();		}
+	afx_msg void OnSelItemDelete()	{	SelectItemDelete();	}
+
+	DECLARE_MESSAGE_MAP()
+};
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(_CELLCTRL_H_)
diff --git a/Lib/SISControls/include/ColorButton.h b/Lib/SISControls/include/ColorButton.h
new file mode 100644
index 0000000..65c1c8b
--- /dev/null
+++ b/Lib/SISControls/include/ColorButton.h
@@ -0,0 +1,101 @@
+// Written by Marius Bancila (mbancila@yahoo.com)
+// Copyright (c) 2004.
+//
+// This code may be used in compiled form in any way you desire. This
+// file may be redistributed unmodified by any means PROVIDING it is 
+// not sold for profit without the authors written consent, and 
+// providing that this notice and the authors name is included. If 
+// the source code in  this file is used in any commercial application 
+// then acknowledgement must be made to the author of this file 
+// (in whatever form you wish).
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
+// IN THE SOFTWARE.
+// 
+// Please use and enjoy. Please let me know of any bugs/mods/improvements 
+// that you have found/implemented and I will fix/incorporate them into this
+// file. 
+
+
+#if !defined(AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_)
+#define AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// ColorButton.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CColorButton window
+
+class AFX_EXT_CLASS CColorButton : public CButton
+{
+private:
+	enum {	BUTTON_IN			= 0x01,
+			BUTTON_OUT			= 0x02,
+			BUTTON_BLACK_BORDER	= 0x04,};
+	
+// Construction
+public:
+	CColorButton();
+	CColorButton(COLORREF text, COLORREF bkgnd);
+	CColorButton(COLORREF text, COLORREF bkgnd, COLORREF disabled);
+	CColorButton(COLORREF text, COLORREF bkgnd, COLORREF disabled, COLORREF light, COLORREF highlight, COLORREF shadow, COLORREF darkShadow);
+	
+// Attributes
+public:
+
+private:
+	COLORREF m_TextColor;
+	COLORREF m_BkgndColor;
+	COLORREF m_DisabledBkgndColor;
+	COLORREF m_Light;
+	COLORREF m_Highlight;
+	COLORREF m_Shadow;
+	COLORREF m_DarkShadow;
+	
+// Operations
+public:
+	void SetColor(COLORREF text, COLORREF bkgnd);
+	void SetColor(COLORREF text, COLORREF bkgnd, COLORREF disabled);
+	void SetColor(COLORREF text, COLORREF bkgnd, COLORREF disabled, COLORREF light, COLORREF highlight, COLORREF shadow, COLORREF darkShadow);
+	void SetColorToWindowsDefault();
+	
+private:
+	void DrawFrame(CDC *pDC, CRect rc, int state);
+	void DrawFilledRect(CDC *pDC, CRect rc, COLORREF color);
+	void DrawLine(CDC *pDC, long sx, long sy, long ex, long ey, COLORREF color);
+	void DrawButtonText(CDC *pDC, CRect rc, CString strCaption, COLORREF textcolor);
+	
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CColorButton)
+	public:
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CColorButton();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CColorButton)
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_COLORBUTTON_H__EB5FACDB_272F_4883_A997_659DDA42FD38__INCLUDED_)
diff --git a/Lib/SISControls/include/DefectMap.h b/Lib/SISControls/include/DefectMap.h
new file mode 100644
index 0000000..b76f219
--- /dev/null
+++ b/Lib/SISControls/include/DefectMap.h
@@ -0,0 +1,125 @@
+// DefectMap.h: interface for the CDefectMap class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_)
+#define AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define ORIGIN_LEFTTOP		1
+#define ORIGIN_LEFTBOTTOM	0
+#define ORIGIN_RIGHTTOP		2
+#define ORIGIN_RIGHTBOTTOM	3
+
+#define UM_MAP_CHANGED			5573
+
+#include "StaticMap.h"
+//enum OriginDirection		{ OD_LeftTop = 0, OD_RightTop = 1, OD_LeftBottom = 10, OD_RightBottom = 11 };
+
+class AFX_EXT_CLASS CDefectMap  : public CStatic
+{
+public:
+	CDefectMap();
+	virtual ~CDefectMap();
+
+public:
+	void				InitGlass(CWnd* pParent, int nMapWidth, int nMapHeight, int nMapMargin);	// Pixel 窜困 付柳.
+	void				DeinitGlass();
+	int					GetMapTotalWidth()		{ return m_nMapTotalWidth; }
+	int					GetMapTotalHeight()		{ return m_nMapTotalHeight; }
+	int					GetMapWidth()			{ return m_nMapWidth; }
+	int					GetMapHeight()			{ return m_nMapHeight; }
+	
+	void				SetMiniMap(BOOL bIsMiniMap, int nUnitSize)	{ m_bIsMiniMap = bIsMiniMap; m_nUnitSize = nUnitSize; }
+	int					GetUnitSize()			{ return m_nUnitSize; }
+	
+	virtual void		DrawGlass(CDC* pDC)						{ }
+	virtual void		MouseRBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnUp(CPoint& point)				{ }
+	virtual void		MouseLBtnMove(CPoint& point)			{ }
+	virtual void		MouseLBtnDblClk(CPoint& point)			{ }
+	virtual void		Timer(UINT_PTR nIDEvent)					{ }
+	
+	// 犬措/绵家
+	void				IncreaseRatio();
+	void				DecreaseRatio();
+	void				ResetRatio();
+	
+	CPoint&				GetDisplayStart()		{ return m_PointGlassStart; }
+	CPoint&				GetDisplayEnd()			{ return m_PointGlassEnd; }
+	
+	void				SetDisplayRect(CPoint& PointStart, CPoint& PointEnd);
+	void				SetShowShot(BOOL bShow)	{ m_bShowShot = bShow; }
+	
+	void				ConvertGlassToView(CRect &rect);
+	void				ConvertGlassToView(CPoint &pt);
+	CRect				ConvertViewToGlass(CRect &rect);
+	CPoint				ConvertViewToGlass(CPoint &pt);
+
+	// 历厘
+	void				SaveMapToFile(CString strFileName);
+	
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CStaticMap)
+	//}}AFX_VIRTUAL
+
+protected:
+	CWnd*				m_pParentWnd;
+	int					m_nMapTotalWidth;
+	int					m_nMapTotalHeight;
+	int					m_nMapWidth;
+	int					m_nMapHeight;
+	CRect				m_RectWnd;
+	CRect				m_RectMap;
+	
+	//////////////////////////////////////////////////////////////////////////
+	// 弊府扁 沥焊
+	HBITMAP				m_hDrawingSurface;
+	BITMAPINFOHEADER	m_BMIH;
+	CRect				m_RectDrawingSurface;
+	BYTE*				m_pDrawingSurfaceBits;
+	
+	OriginDirection		m_OriginDir;
+	int					m_nUnitSize;
+	
+	// Cell 弊府扁
+	BOOL				m_bShowShot;
+	
+	// 犬措/绵家
+	CRect				m_RectShowWnd;
+	
+	double				m_dWidthRatio;
+	double				m_dHeightRatio;
+	double				m_dRatio;
+	CPoint				m_PointWindowStart;
+	BOOL				m_bDragMove;
+	CPoint				m_PointDragStart;
+	BOOL				m_bIsMiniMap;			// Minimap篮 犬措/绵家甫 救茄促.
+	CPoint				m_PointGlassStart;		// Glass 吝 泅犁 焊咯瘤绰 康开.
+	CPoint				m_PointGlassEnd;
+	
+	CPoint				m_PointCCut[3];			//内呈钠 弊府扁 谅钎
+	int					m_nCCutSize;
+	int					m_nCoordGabX;			// 谅钎甫 谎副 芭府.
+	int					m_nCoordGabY;			// 谅钎甫 谎副 芭府.
+	
+	//{{AFX_MSG(CStaticGlass)
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg long OnUpdateMap(WPARAM wParam, LPARAM lParam);
+	//}}AFX_MSG
+	
+	DECLARE_MESSAGE_MAP()
+};
+
+#endif // !defined(AFX_DEFECTMAP_H__CF34B34E_7A0E_4CBB_880F_4C41FF83A64B__INCLUDED_)
diff --git a/Lib/SISControls/include/FontStatic.h b/Lib/SISControls/include/FontStatic.h
new file mode 100644
index 0000000..35b2a33
--- /dev/null
+++ b/Lib/SISControls/include/FontStatic.h
@@ -0,0 +1,69 @@
+#pragma once
+
+// Defines for the font style
+#define FS_NORMAL			0x00
+#define FS_BOLD				0x01
+#define FS_ITALIC			0x02
+#define FS_UNDERLINED		0x04
+#define FS_STRIKETHROUGH	0x08
+#define FS_ANTIALIAS		0x10
+
+// Defines for horizontal alignment
+#define FS_CENTER			0x20
+#define FS_LEFT				0x40
+#define FS_RIGHT			0x80
+
+// CFontStatic
+
+class AFX_EXT_CLASS CFontStatic : 
+	public CStatic
+{
+	DECLARE_DYNAMIC(CFontStatic)
+
+public:
+	CFontStatic();
+
+	// Attributes
+public:
+	bool m_bBold;
+	bool m_bItalic;
+	bool m_bUnderlined;
+	bool m_bStrikethrough;
+	bool m_bAntialias;
+	bool m_bBgColor;
+
+	bool m_bCenter;
+	bool m_bLeft;
+	bool m_bRight;
+
+	CString m_szText;
+	CString m_szFont;
+	DWORD m_dwColor;
+	DWORD m_dwBgColor;
+	int m_nSize;
+
+	// Operations
+public:
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CFontStatic)
+protected:
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+
+	// Implementation
+public:
+	void SetWindowText(LPCTSTR a_lpstr);
+	void SetFontStyle(DWORD dwStyle);
+	void SetBackground(DWORD dwBgColor);
+	void SetFontStatic(CString szFont, int nSize, DWORD dwColor, DWORD dwStyle);
+	virtual ~CFontStatic();
+
+protected:
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnPaint();
+};
+
+
diff --git a/Lib/SISControls/include/GradientStatic.h b/Lib/SISControls/include/GradientStatic.h
new file mode 100644
index 0000000..d7c72a7
--- /dev/null
+++ b/Lib/SISControls/include/GradientStatic.h
@@ -0,0 +1,149 @@
+#pragma once
+
+
+// CGradientStatic
+typedef UINT (CALLBACK* LPFNDLLFUNC1)(HDC,CONST PTRIVERTEX,DWORD,CONST PVOID,DWORD,DWORD);
+
+class CDoubleBuff : public CDC {
+private:	
+	CBitmap		m_bitmap;		// Offscreen bitmap
+	CBitmap*	m_oldBitmap;	// bitmap originally found in CDoubleBuff
+	CDC*		m_pDC;			// Saves CDC passed in constructor
+	CRect		m_rect;			// Rectangle of drawing area.
+	BOOL		m_bMemDC;		// TRUE if CDC really is a Memory DC.
+public:
+
+	CDoubleBuff(CDC* pDC, const CRect* pRect = NULL) : CDC()
+	{
+		ASSERT(pDC != NULL); 
+
+		// Some initialization
+		m_pDC = pDC;
+		m_oldBitmap = NULL;
+		m_bMemDC = !pDC->IsPrinting();
+
+		// Get the rectangle to draw
+		if (pRect == NULL) {
+			pDC->GetClipBox(&m_rect);
+		} else {
+			m_rect = *pRect;
+		}
+
+		if (m_bMemDC) {
+			// Create a Memory DC
+			CreateCompatibleDC(pDC);
+			pDC->LPtoDP(&m_rect);
+
+			m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
+			m_oldBitmap = SelectObject(&m_bitmap);
+
+			SetMapMode(pDC->GetMapMode());
+
+			SetWindowExt(pDC->GetWindowExt());
+			SetViewportExt(pDC->GetViewportExt());
+
+			pDC->DPtoLP(&m_rect);
+			SetWindowOrg(m_rect.left, m_rect.top);
+		} else {
+			// Make a copy of the relevent parts of the current DC for printing
+			m_bPrinting = pDC->m_bPrinting;
+			m_hDC       = pDC->m_hDC;
+			m_hAttribDC = pDC->m_hAttribDC;
+		}
+
+		// Fill background 
+		FillSolidRect(m_rect, pDC->GetBkColor());
+	}
+
+	virtual ~CDoubleBuff()	
+	{		
+		if (m_bMemDC) {
+			// Copy the offscreen bitmap onto the screen.
+			m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
+				this, m_rect.left, m_rect.top, SRCCOPY);			
+
+			//Swap back the original bitmap.
+			SelectObject(m_oldBitmap);
+		} else {
+			// All we need to do is replace the DC with an illegal value,
+			// this keeps us from accidently deleting the handles associated with
+			// the CDC that was passed to the constructor.			
+			m_hDC = m_hAttribDC = NULL;
+		}	
+	}
+
+	// Allow usage as a pointer	
+	CDoubleBuff* operator->() 
+	{
+		return this;
+	}	
+
+	// Allow usage as a pointer	
+	operator CDoubleBuff*() 
+	{
+		return this;
+	}
+
+	CDC *GetOriginalDC()
+	{
+		return m_pDC;
+	}
+};
+
+class AFX_EXT_CLASS CGradientStatic : public CStatic
+{
+	DECLARE_DYNAMIC(CGradientStatic)
+
+public:
+	enum	EN_ANI_MODE{EN_ANI_NONE=0,EN_ANI_LEFTRIGHT,EN_ANI_LAMP};
+
+	CGradientStatic();
+	virtual ~CGradientStatic();
+	void SetWindowText(LPCTSTR a_lpstr);
+	void SetColor(long cl) {clLeft=cl;};
+	BOOL SetControlFont(int nHeight, int nWidth, int nEscapement,
+		int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline,
+		BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision,
+		BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily,
+		LPCTSTR lpszFacename);
+	void SetGradientColor(long cl) {clRight=cl; SetDrawColor(clLeft, clRight); };
+	void SetTextColor(long cl) {clText=cl;};
+	void SetReverseGradient();
+	void SetLeftSpacing(int iNoOfPixels) { m_iLeftSpacing = iNoOfPixels; };
+	void SetTextAlign(int iAlign ) { m_iAlign = iAlign; }; //0 - left, 1 - center, 2 -right
+	void SetVerticalGradient(BOOL a_bVertical = TRUE) { m_bVertical = a_bVertical; };
+	void SetOulineColor(long cl1, long cl2) { clOut1 = cl1; clOut2 = cl2; m_bDrawOutLine = TRUE; }
+	void SetDrawColor(long cl1, long cl2);
+	void MoveDrawColor();
+	void SetAnimationMode(int nMode, int nTime, int nIndex);
+	static void DrawGradRect(CDC *pDC, CRect r, COLORREF cLeft, COLORREF cRight, BOOL a_bVertical);
+	void DrawGradRect(CDC *pDC, CRect r, BOOL a_bVertical, COLORREF *cl);
+
+protected:
+	CString m_sTEXT;
+	int m_iLeftSpacing;
+	long clLeft;
+	long clRight;
+	long clText;
+	long clOut1;
+	long clOut2;
+	COLORREF clDrawColor[510];
+	int m_iAlign;
+	BOOL m_bDrawOutLine;
+	EN_ANI_MODE m_enAnimation;
+	int m_nAniColorCount;
+	HINSTANCE hinst_msimg32;
+	BOOL m_bCanDoGradientFill;
+	BOOL m_bVertical;
+	LPFNDLLFUNC1 dllfunc_GradientFill;
+
+	CFont m_font;
+
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+
+	DECLARE_MESSAGE_MAP()
+public:
+};
+
+
diff --git a/Lib/SISControls/include/HeadCtrl.h b/Lib/SISControls/include/HeadCtrl.h
new file mode 100644
index 0000000..a273989
--- /dev/null
+++ b/Lib/SISControls/include/HeadCtrl.h
@@ -0,0 +1,104 @@
+#if !defined(AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_)
+#define AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// HeadCtrl.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CHeadCtrl window
+#ifndef __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+class AFX_EXT_CLASS CHeadCtrl : public CHeaderCtrl
+{
+// Construction
+public:
+	struct HEADCELL
+	{
+		DWORD   state;
+		CString string;
+	};
+	class CHeadCell : public HEADCELL
+	{
+	public:
+		CHeadCell()
+		{
+			state=0;
+			string="";
+		}
+		CHeadCell(HEADCELL& hcell)
+		{
+			*this=hcell;
+		}
+		CHeadCell operator=(HEADCELL& hcell)
+		{
+			state=hcell.state;
+			string=hcell.string;
+			return *this;
+		}
+	};
+
+	typedef CArray<CHeadCell,CHeadCell&> CHeadItem;
+	typedef CArray<CHeadItem,CHeadItem&> CHeadInfo;
+
+public:
+	CHeadCtrl();
+	void SetCount(int nCount, CFont* pFont);
+	int  GetCount(){return m_count;}
+	int  GetHeadHeight();
+
+
+	void InsertColumn(int nCol);
+	void DeleteColumn(int nCol);
+	void FontChange(LOGFONT logfont);
+	BOOL SetItemText(int nItem, int nSubItem, LPCSTR lpcstr);
+	CString GetItemText(int nItem, int nSubItem);
+	BOOL SetItemMerge(int nsItem, int nsSubItem, int neItem, int neSubItem); 
+	UINT GetItemState(int nItem, int nSubItem, int& down, int& right);
+	BOOL GetRect(int nItem, int nSubItem, CRect& rect);
+protected:
+	BOOL m_bclick;
+	CPoint m_pnt;
+
+	CFont m_font;
+	int m_count;
+	CHeadInfo m_Info;
+	BOOL IsDraw(CRect rect);
+	BOOL GetTextRect(CDC* pDC, CString strText, CRect& rect);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CHeadCtrl)
+	virtual void OnPaint();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CHeadCtrl();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CHeadCtrl)
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_HEADCTRL_H__E483AE98_F737_4DBF_8508_8E934A8F6988__INCLUDED_)
diff --git a/Lib/SISControls/include/InPlaceComboBox.h b/Lib/SISControls/include/InPlaceComboBox.h
new file mode 100644
index 0000000..a8a1248
--- /dev/null
+++ b/Lib/SISControls/include/InPlaceComboBox.h
@@ -0,0 +1,51 @@
+#if !defined(AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_)
+#define AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// InPlaceComboBox.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceComboBox window
+
+class AFX_EXT_CLASS CInPlaceComboBox : public CComboBox
+{
+// Construction
+public:
+	CInPlaceComboBox(int iItem,int iSubItem);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceComboBox)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CInPlaceComboBox();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceComboBox)
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnSelchange();
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	//}}AFX_MSG
+	int m_iSubItem;
+	int m_iItem;
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACECOMBOBOX_H__2909C5E5_6C2D_42DE_AB56_904A78606462__INCLUDED_)
diff --git a/Lib/SISControls/include/InPlaceEdit.h b/Lib/SISControls/include/InPlaceEdit.h
new file mode 100644
index 0000000..e40b670
--- /dev/null
+++ b/Lib/SISControls/include/InPlaceEdit.h
@@ -0,0 +1,59 @@
+#if !defined(AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_)
+#define AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// InPlaceEdit.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceEdit window
+
+class AFX_EXT_CLASS CInPlaceEdit : public CEdit
+{
+// Construction
+public:
+	CInPlaceEdit(int iItem, int iSubItem, CString sInitText);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CInPlaceEdit)
+	public:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	CString m_strNewValue;
+	virtual ~CInPlaceEdit();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CInPlaceEdit)
+	afx_msg void OnKillFocus(CWnd* pNewWnd);
+	afx_msg void OnNcDestroy();
+	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+private:
+	BOOL m_bESC;
+	CString m_sInitText;
+	int m_iSubItem;
+	int m_iItem;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_INPLACEEDIT_H__89FB99E1_386B_11D3_B257_00104BBB4F35__INCLUDED_)
diff --git a/Lib/SISControls/include/LogCtrl.h b/Lib/SISControls/include/LogCtrl.h
new file mode 100644
index 0000000..bcf41e5
--- /dev/null
+++ b/Lib/SISControls/include/LogCtrl.h
@@ -0,0 +1,213 @@
+//LogCtrl.h
+//LogCtrl.h
+#ifndef __LOGCTRL_H
+#define __LOGCTRL_H
+#define __LOGCTRL_LIB_H
+
+#ifndef __AFXTEMPL_H
+#include <afxtempl.h>
+#endif
+
+//LOG CELL STATE
+//MERGE
+#define LCS_NORML		0x0000
+#define LCS_MERGE		0x0001
+#define LCS_UNUSE		0x0002
+
+//LINE
+#define LCS_TLINE		0x0001	//TOP LINE DRAW
+#define LCS_BLINE		0x0002	//BOTTOM LINE DRAW
+#define LCS_LLINE		0x0004	//LEFT LINE DRAW
+#define LCS_RLINE		0x0008	//RIGHT LINE DRAW
+#define LCS_RECT		LCS_TLINE|LCS_BLINE|LCS_LLINE|LCS_RLINE
+
+//merge state
+#define SetFlag(n)  DWORD(BYTE(n)<<16)
+#define GetFlag(d)  int((d & 0x00FF0000)>>16)
+
+#define SetDown(n)  DWORD(BYTE(n)<<8)
+#define GetDown(d)  int((d & 0x0000FF00)>>8)
+
+#define SetRight(n) DWORD(BYTE(n))
+#define GetRight(d) int((d & 0x000000FF))
+
+#define LOGCHECK(b) if(b){return;}
+#define LOGCHECK0(b) if(b){return 0;}
+#define LOGCHECK1(b) if(b){return -1;}
+
+class CPrintDC;
+class CLogCell;
+class CLogPage;
+class CLogCtrl;
+
+typedef CArray<CLogCell,CLogCell&> CLogItem;
+typedef CArray<CLogItem,CLogItem&> CLogItemArray;
+typedef CArray<CLogPage,CLogPage&> CLogPageArray;
+
+typedef struct tagLOGCELL
+{
+	BYTE		m_nLine; //惑窍谅快 扼牢 
+	UINT		m_nState;//促弗伎苞 捍钦灯绰瘤 ..
+	UINT		m_nFormat;//沥纺葛靛
+	RECT		m_rect;  //伎狼 康开
+	COLORREF	m_txtclr;//臂磊祸
+	COLORREF	m_bkgclr;//硅版祸
+	CString		m_strTxt;//臂磊
+	CFont*		m_pfont; //迄飘
+	CBitmap*	m_pBitmap;//厚飘甘
+}LOGCELL;
+
+//Orientation=啊肺(1), 技肺(2)  bDialog=DoModal()
+class AFX_EXT_CLASS CPrintDC
+{
+public:
+	CPrintDC();
+	virtual ~CPrintDC();
+	CDC* GetPrintDC(int Orientation, BOOL bDialog=FALSE);
+protected:
+	CDC *m_pDC;
+};
+
+class CLogCell : public tagLOGCELL
+{
+public:
+	CLogCell();
+	CLogCell(LPCSTR lpstr,
+			CRect	rect,
+			int nFormat=DT_CENTER,
+			COLORREF textColor=0x00000000,
+			COLORREF backColor=0x00ffffff,
+			CFont* pf=NULL);
+
+	void operator=(const CLogCell& log);
+	void InitCell();
+	void Draw(CDC* pDC);
+};
+
+class AFX_EXT_CLASS CLogPage
+{
+public:
+	CLogPage();
+	CLogPage(CPoint startPnt);
+	virtual ~CLogPage();
+	void RemoveAll();
+	void operator=(CLogPage& page);
+
+	//青,凯 肮荐甫 汲沥茄促.
+	void SetColCount(int nCount);
+	void SetRowCount(int nCount);
+	BOOL RemoveRow(int nRow);
+
+	//厘钎 免仿困摹
+	void SetStartPoint(CPoint startPnt);
+	CPoint GetStartPoint() const;
+
+	//青,凯 肮荐甫 府畔茄促.
+	int GetColCount() const;
+	int GetRowCount() const;
+
+	//气,臭捞甫 汲沥茄促.
+	BOOL SetColWidth(int nCol, int nWidth);
+	BOOL SetRowHeight(int nRow, int nHeight);
+
+	//迄飘甫 汲沥茄促.
+	BOOL SetCellFont(int nRow, int nCol, CFont* pf);
+	BOOL SetCellFont(int nsRow, int nsCol, int neRow, int neCol, CFont* pf);
+	CFont* GetCellFont(int nRow, int nCol);
+
+	//硅版祸阑 汲沥茄促.
+	BOOL SetCellBkgColor(int nRow, int nCol, COLORREF color);
+	COLORREF GetCellBkgColor(int nRow, int nCol);
+
+	//臂磊祸阑 汲沥茄促.
+	BOOL SetCellTxtColor(int nRow, int nCol, COLORREF color);
+	COLORREF GetCellTxtColor(int nRow, int nCol);
+
+	//臂磊困摹 汲沥
+	BOOL SetCellFormat(int nRow, int nCol, int nFormat);
+	int GetCellFormat(int nRow, int nCol);
+
+	//Rect阑 汲沥茄促.
+	BOOL SetCellRect(int nRow, int nCol, CRect rect);
+	BOOL GetCellRect(int nRow, int nCol, CRect& rect);
+
+	//BITMAP阑 汲沥茄促.
+	BOOL SetCellBmp(int nRow, int nCol, CBitmap* pBmp);
+	CBitmap* GetCellBmp(int nRow, int nCol);
+
+	//荤阿屈 弊副锭 绢蠢 困摹甫 弊副 巴牢啊 汲沥茄促. 
+	BOOL SetCellLine(int nRow, int nCol, int nState=LCS_RECT/*LCS_RECT*/);
+	int GetCellLine(int nRow, int nCol);
+
+	//伎俊 臂磊阑 涝仿茄促.
+	BOOL SetItemText(int nRow, int nCol, LPCTSTR lpstr, int nFormat=DT_CENTER|DT_VCENTER|DT_SINGLELINE);
+	CString GetItemText(int nRow, int nCol);
+
+	BOOL SetCell(int nRow, int nCol, CLogCell lc);
+	CLogCell* GetCell(int nRow, int nCol);
+
+	//伎阑 捍钦茄促.
+	BOOL CellMerge(int nsCol, int nsRow, int neCol ,int neRow );
+
+	//免仿茄促.(nPageNO绰 其捞瘤 锅龋捞哥 0老 版快 免仿登瘤 臼绰促.)
+	void Draw(CDC* pDC, int nPageNO=0);
+
+	//SetPageRect(,)窃荐甫 荤侩矫 
+	//Draw(CDC* pDC, int nPageNO=0);窃荐甫 龋免窍扁 官肺傈俊 荤侩秦具窃
+	//侩档: 
+	//   <<page>>                                 <<device>>
+	//  0                               100      0                               1000  
+	//  ΓΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΔ        ΓΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΔ
+	//  Β  (10,10)              (90,10)Β        Β (100,100)           (900,100)Β
+	//  Β  ΓΑΑΑΑΑΑΑΑΑΑΑΔ  Β        Β  ΓΑΑΑΑΑΑΑΑΑΑΑΔ  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  Β                      Β ΜΜΜΜΜΜΜ>Β                      Β  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  Β                      Β  Β        Β  Β                      Β  Β
+	//  Β  ΖΑΑΑΑΑΑΑΑΑΑΑΕ  Β        Β  ΖΑΑΑΑΑΑΑΑΑΑΑΕ  Β
+	//  Β  (10,40)              (90,40)Β        Β (100,400)           (900,400)Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  Β                              Β        Β                              Β
+	//  ΖΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΕ        ΖΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΕ
+	//  200                            100,200    2000                            1000,2000 
+	//  
+	//   CRect page(0,0,100,200);
+	//   CRect device(0,0,1000,2000);
+	//   咯归阑 炼陛 林妨搁: CRect device(100,100,900,1900);
+	//   SetPageRect(pDC, page, device);
+	BOOL SetPageRect(CDC* pDC, CRect page, CRect device);
+protected:
+	bool m_IsViewPort;
+	int m_RowCnt;
+	int m_ColCnt;
+	CPoint		  m_startPnt;
+	CLogItemArray m_liAry;
+};
+
+//厘钎 傈眉甫 包府茄促.
+//厘钎甫 免仿窍扁 困秦 怖 鞘夸窍柳 臼促.
+//CLogPage甫 荤侩秦档 公规窍促.
+class AFX_EXT_CLASS CLogCtrl
+{
+public:
+	CLogCtrl();
+	virtual ~CLogCtrl();
+	int  GetLogPageCount();
+	void AddLogPage(CLogPage& lp);
+	CLogPage* GetLogPage(int nPage);
+	void DelLogPage(int nPage);
+	void Draw(CDC* pDC, DOCINFO* pDocInfo);
+protected:
+	CLogPageArray m_log;
+};
+
+#endif
diff --git a/Lib/SISControls/include/SISButton.h b/Lib/SISControls/include/SISButton.h
new file mode 100644
index 0000000..86f912e
--- /dev/null
+++ b/Lib/SISControls/include/SISButton.h
@@ -0,0 +1,82 @@
+#if !defined(AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_)
+#define AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISButton.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISButton by Niek Albers
+// Thanks to some people for the tooltip.
+// A cool CBitmapButton derived class with 3 states,
+// Up/Down/SIS.
+class AFX_EXT_CLASS CSISButton : public CBitmapButton
+{
+	DECLARE_DYNAMIC(CSISButton);
+
+	// Construction
+public:
+	CSISButton();
+	void SetToolTipText(CString* spText, BOOL bActivate = TRUE);
+	void SetToolTipText(int nId, BOOL bActivate = TRUE);
+	void SetWindowText(CString strText);
+	void SetFontSize(int nSize);
+	void SetTextColor(COLORREF rgbNormal, COLORREF rgbDisable);
+	void SetSISButtonStyle(UINT uID, int nImgCount);
+	void SetSISButtonStyle(UINT uID, int nImgCount, CString spTipText);
+	void SetSISButtonStyle(UINT uID, int nImgCount, CString spTipText, CString spBtnText, int nFontSize);
+
+	CString m_strText;
+	CDC      m_gMemDC;
+
+// Attributes
+protected:
+	void fPaint(CDC* pDC);
+	void ActivateTooltip(BOOL bActivate = TRUE);
+	BOOL m_bSIS;						// indicates if mouse is over the button
+	CSize m_ButtonSize;					// width and height of the button
+	CBitmap m_Bitmap;
+	BOOL m_bTracking;
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISButton)
+	protected:
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	BOOL LoadBitmap(UINT bitmapid, UINT uiImageCount);
+	virtual ~CSISButton();
+
+	// Generated message map functions
+protected:
+	CToolTipCtrl m_ToolTip;
+	void InitToolTip();
+	//{{AFX_MSG(CSISButton)
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg LRESULT OnMouseLeave(WPARAM wparam, LPARAM lparam);
+	afx_msg LRESULT OnMouseHOver(WPARAM wparam, LPARAM lparam) ;
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	UINT m_uiImageCount;
+	CFont	m_Font;
+	LOGFONT		m_lf;
+	COLORREF m_RGBTextNormal;
+	COLORREF m_RGBTextDisable;
+	BOOL m_bIsDisable;	// Disable老 锭绰 臂磊祸阑 官操扁 困秦.
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISBUTTON_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_)
diff --git a/Lib/SISControls/include/SISFolderScheduling.h b/Lib/SISControls/include/SISFolderScheduling.h
new file mode 100644
index 0000000..68d9a52
--- /dev/null
+++ b/Lib/SISControls/include/SISFolderScheduling.h
@@ -0,0 +1,92 @@
+// SISFolderScheduling.h: interface for the CSISFolderScheduling class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_)
+#define AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define TARGETTYPE_FOLDER		1
+#define TARGETTYPE_FILE			2
+
+struct SSubPathInfo
+{
+	CString		s_strItemPath;
+	CString		s_strItemName;
+	long		s_nCreateDate;
+	int			s_nItemType;
+
+	SSubPathInfo()
+	{
+		Reset();
+	}
+	void Reset()
+	{
+		s_strItemPath = _T("");
+		s_strItemName = _T("");
+		s_nCreateDate = 0;
+		s_nItemType = 0;
+	}
+	
+	// 汗荤 积己磊.
+	SSubPathInfo(const SSubPathInfo& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_strItemPath = rhs.s_strItemPath;
+			s_strItemName = rhs.s_strItemName;
+			s_nCreateDate = rhs.s_nCreateDate;
+			s_nItemType = rhs.s_nItemType;
+		}
+	}
+
+	// 措涝楷魂磊 坷滚肺爹.
+    SSubPathInfo& operator=(const SSubPathInfo& rhs)
+	{
+		if(this != &rhs)
+		{
+			s_strItemPath = rhs.s_strItemPath;
+			s_strItemName = rhs.s_strItemName;
+			s_nCreateDate = rhs.s_nCreateDate;
+			s_nItemType = rhs.s_nItemType;
+		}
+		return *this;
+	}
+};
+
+class AFX_EXT_CLASS CSISFolderScheduling  
+{
+public:
+	CSISFolderScheduling();
+	CSISFolderScheduling(CString strPath);
+	CSISFolderScheduling(CString strPath, int nTargetType);
+	virtual ~CSISFolderScheduling();
+
+	BOOL SetRemainDelete(CString strPath, int nTargetType, int nRemainItemCount);
+	BOOL CommitSchedule();
+	void ResetSchedule();
+
+protected:
+	
+	BOOL SearchSubItem(const CString &strMainPath, BOOL bIsAscending);
+	BOOL SortSubItem(BOOL bIsAscending);	// 坷抚瞒鉴 TRUE, 郴覆瞒鉴 FALSE
+	BOOL DeleteFolder(const CString &strFolder);
+
+	// 包府甫 且 弥惑困 版肺.
+	CString				m_strMainPath;
+	BOOL				m_bTargetFolder;
+	BOOL				m_bTargetFile;
+	BOOL				m_bIsAscending;
+
+	// 老何父 巢扁绊 昏力.
+	int					m_nRemainItemCount;
+
+	// 包府 措惑 沥焊
+	SSubPathInfo*		m_pPathInfo;
+	int					m_nSubItemCount;
+};
+
+#endif // !defined(AFX_SISFOLDERSCHEDULING_H__2C8D9E82_222F_41FD_A78D_C17563334CA1__INCLUDED_)
diff --git a/Lib/SISControls/include/SISJogBtn2Parent.h b/Lib/SISControls/include/SISJogBtn2Parent.h
new file mode 100644
index 0000000..16595c0
--- /dev/null
+++ b/Lib/SISControls/include/SISJogBtn2Parent.h
@@ -0,0 +1,12 @@
+// by ChaeSIS
+
+#ifndef SIS_JOG_BTN_2_PARENT_H
+#define SIS_JOG_BTN_2_PARENT_H
+
+typedef struct _SISJOGBTN2PARENT
+{
+	virtual BOOL SendMessageToParent(LPCTSTR message) = 0;
+	virtual BOOL SendMessageToParent(int nMsg) = 0;
+} SISJogBtn2Parent, *pSISJogBtn2Parent;
+
+#endif
\ No newline at end of file
diff --git a/Lib/SISControls/include/SISJogButton.h b/Lib/SISControls/include/SISJogButton.h
new file mode 100644
index 0000000..1f971a1
--- /dev/null
+++ b/Lib/SISControls/include/SISJogButton.h
@@ -0,0 +1,63 @@
+#if !defined(AFX_SISJOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_)
+#define AFX_SISJOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISJogButton.h : header file
+//
+
+#include "SISJogBtn2Parent.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISJogButton window
+
+class AFX_EXT_CLASS CSISJogButton : public CButton
+{
+// Construction
+public:
+	CSISJogButton();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void SetJ2M(pSISJogBtn2Parent pJ2M)			{ m_pJ2M = pJ2M; }
+	void SetStringDown(CString strMsg)			{ m_strMessageDown = strMsg; }
+	void SetStringUp(CString strMsg)			{ m_strMessageUp = strMsg; }
+	void SetIntDown(int nMsg)					{ m_nMessageDown = nMsg; }
+	void SetIntUp(int nMsg)						{ m_nMessageUp = nMsg; }
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISJogButton)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CSISJogButton();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISJogButton)
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+private:
+	pSISJogBtn2Parent	m_pJ2M;
+	CString				m_strMessageDown;
+	CString				m_strMessageUp;
+	int					m_nMessageDown;
+	int					m_nMessageUp;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_JOGBUTTON_H__51BB375B_98EA_4921_B964_90AC2D952D70__INCLUDED_)
diff --git a/Lib/SISControls/include/SISLabel.h b/Lib/SISControls/include/SISLabel.h
new file mode 100644
index 0000000..e6dd533
--- /dev/null
+++ b/Lib/SISControls/include/SISLabel.h
@@ -0,0 +1,77 @@
+#if !defined(AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
+#define AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// Label.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISLabel window
+enum FlashType {None, Text, Background };
+
+class AFX_EXT_CLASS CSISLabel : public CStatic
+{
+// Construction
+public:
+	CSISLabel();
+	CSISLabel& SetBkColor(COLORREF crBkgnd);
+	CSISLabel& SetTextColor(COLORREF crText);
+	CSISLabel& SetText(const CString& strText);
+	CSISLabel& SetFontBold(BOOL bBold);
+	CSISLabel& SetFontName(const CString& strFont);
+	CSISLabel& SetFontUnderline(BOOL bSet);
+	CSISLabel& SetFontItalic(BOOL bSet);
+	CSISLabel& SetFontSize(int nSize);
+	CSISLabel& SetSunken(BOOL bSet);
+	CSISLabel& SetBorder(BOOL bSet);
+	CSISLabel& FlashText(BOOL bActivate);
+	CSISLabel& FlashBackground(BOOL bActivate);
+	CSISLabel& SetLink(BOOL bLink);
+	CSISLabel& SetLinkCursor(HCURSOR hCursor);
+
+// Attributes
+public:
+protected:
+	void ReconstructFont();
+	COLORREF	m_crText;
+	HBRUSH		m_hBrush;
+	HBRUSH		m_hwndBrush;
+	LOGFONT		m_lf;
+	CFont		m_font;
+	CString		m_strText;
+	BOOL		m_bState;
+	BOOL		m_bTimer;
+	BOOL		m_bLink;
+	FlashType	m_Type;
+	HCURSOR		m_hCursor;
+			// Operations
+public:
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISLabel)
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CSISLabel();
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISLabel)
+	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
diff --git a/Lib/SISControls/include/SISListBoxLog.h b/Lib/SISControls/include/SISListBoxLog.h
new file mode 100644
index 0000000..6ad7ea8
--- /dev/null
+++ b/Lib/SISControls/include/SISListBoxLog.h
@@ -0,0 +1,96 @@
+#if !defined(AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_)
+#define AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// cSISListBoxLog.h : header file
+//
+
+#include "SISFolderScheduling.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListBoxLog window
+
+#define LOG_NORMAL		1
+#define LOG_HISTORY		2
+#define LOG_WARNING		3
+#define LOG_ERROR		4
+#define LOG_DEBUG		5
+
+#define STRINGBUFFER_COUNT		200
+class AFX_EXT_CLASS CSISListBoxLog : public CListBox
+{
+// Construction
+public:
+	CSISListBoxLog();
+	virtual ~CSISListBoxLog();
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISListBoxLog)
+	//}}AFX_VIRTUAL
+
+	//////////////////////////////////////////////////////////////////////////
+	// Logging
+	void	SetPath(CString& strPath, CString& strName, BOOL bDelete, int nRemainCount);
+	void	DisplayMessages(BOOL bAddMsgBox, int nLevel, TCHAR *str, ...);
+	void	DisplayMessages(BOOL bAddMsgBox, TCHAR *str, ...);
+	void	DisplayMessage(BOOL bAddMsgBox, int nLevel, TCHAR *str);
+	void	DisplayMessage(BOOL bAddMsgBox, TCHAR *str);
+	void	SetTextColor(long clbg1 = RGB(255,255,255), long clbg2 = RGB(255,255,255), long clText = RGB(0,0,0));
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISListBoxLog)
+	afx_msg LRESULT OnDisplayMessage(WPARAM wParam, LPARAM lParam);
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+	//////////////////////////////////////////////////////////////////////////
+	// Folder Management
+	CSISFolderScheduling	m_FolderSchedule;
+		
+	//////////////////////////////////////////////////////////////////////////
+	// Logging
+	CString				m_strLogDir;
+	CString				m_strFileName;
+
+	CString				m_strLogPath;
+	CString				m_strLogFile;
+	CTime				m_TimeLogFile;
+	CFile*				m_pFileLog;
+
+	TCHAR				m_strBuffer[512];
+
+	BOOL				MakeLogFile();
+	BOOL				WriteToFile(CTime& time, CString& strContents);
+	BOOL				WriteToFile(CTime& time, TCHAR* strContents);
+
+	DWORD				m_dwThreadID;
+
+	CString				m_strArray[STRINGBUFFER_COUNT];
+	BOOL				m_bMustDisplay[STRINGBUFFER_COUNT];
+	int					m_nAddIndex;
+	int					m_nReadIndex;
+	CRITICAL_SECTION	m_csLog;
+
+	long				m_clBG1;
+	long				m_clBG2;
+	long				m_clText;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_)
diff --git a/Lib/SISControls/include/SISListCtrlExt.h b/Lib/SISControls/include/SISListCtrlExt.h
new file mode 100644
index 0000000..c0e712a
--- /dev/null
+++ b/Lib/SISControls/include/SISListCtrlExt.h
@@ -0,0 +1,137 @@
+#if !defined(AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_)
+#define AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// SISListCtrlExt.h : header file
+//
+
+#include <afxtempl.h>
+
+#include "InPlaceEdit.h"
+#include "InPlaceComboBox.h"
+
+#define EDITDISABLE_NONE	0
+#define EDITDISABLE_ROWS	1
+#define EDITDISABLE_COLS	2
+#define EDITDISABLE_ROWCOL	3
+
+#define INPLACECTRL_EDIT	4
+#define INPLACECTRL_COMBO	5
+#define INPLACECTRL_EDIT_COMBO	6
+
+#define EDITDISABLE_ROWS_ARRAY	7
+#define EDITDISABLE_COLS_ARRAY	8
+
+#define COMBODATASTATE_SINGLE 9
+#define COMBODATASTATE_MULTI  10
+
+/////////////////////////////////////////////////////////////////////////////
+// CSISListCtrlExt window
+
+typedef struct _LISTROWCOLOR
+{
+	int			s_nRow;
+	COLORREF	s_Color;
+} ListRowColor, *pListRowColor;
+
+class AFX_EXT_CLASS CSISListCtrlExt : public CListCtrl
+{
+// Construction
+public:
+	CSISListCtrlExt();
+	virtual ~CSISListCtrlExt();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void SetComboCtrlCols(CString strCols,int nLength);
+	void SetEditCtrlCols(CString strCols,int nLength);
+	void SetComboData(TCHAR *pData[],int nState,int nLength);
+	void SetComboData(CStringList *pList, int nState);
+	void EditDisableRows(CString strRows,int nLength);
+	void EditDisableCols(CString strCols,int nLength);
+	BOOL GetEnableSortList();
+	void SetEnableSortList(BOOL nEnable);
+	void SortListCtrl(int nCol);
+	void InitListHeader(TCHAR *colList[],int *widthList,int nLength, int nHeight);
+	void SetInPlaceCtrl(int nCtrl);
+	void SetDefaultEditText(CString strInitText);
+	void SetEditDisableState(int nState);
+	int GetEditDisableCols();
+	int GetEditDisableRows();
+	int GetEditDisableState();
+	void EditDisableRowCol(int nRow,int nCol);
+	void EditDisableCols(int nCols);
+	void EditDisableRows(int nRows);
+	void SetColNum(int nColNum);
+	void AddBlankItem();
+	CImageList* SetImageList(CImageList* pImageList, int nImageListType);
+		
+	void InsertListItemEx(int nRow, int nCol, const CString& strString);
+	void InsertListItemEx(int nRow, int nCol, int nValue);
+	void InsertListItemEx(int nRow, int nCol, double dValue, int nRight = 3);
+
+	void SetTextColor(int nRow, COLORREF clrText);
+	void SetBKColor(int nRow, COLORREF clrBK);
+	void ReleaseTextColor(int nRow);
+	void ReleaseBKColor(int nRow);
+	void ResetTextColor();
+	void ResetBKColor();
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CSISListCtrlExt)
+	//}}AFX_VIRTUAL
+
+protected:
+	CInPlaceEdit *m_pEdit;
+	CInPlaceComboBox *m_pComboBox;
+	int m_nInPlaceCtrl;
+	int m_nColNum;
+	int m_nEditDisableState;
+	int m_nDisableCol;
+	int m_nDisableRow;
+	BOOL m_bSortOrder;
+	CString m_strInitEditText;
+	BOOL m_bEnableSortList;
+	int *m_pEditDisableCols;
+	int *m_pEditDisableRows;
+	// Generated message map functions
+protected:
+	int m_nComboCtrlLength;
+	int m_nEditCtrlLength;
+	int *m_pComboCtrlCols;
+	int *m_pEditCtrlCols;
+	CStringList *m_pComboData;
+	int m_nLength;
+	int m_nComboDataState;
+	BOOL m_bSetImageList;
+
+// Implementation
+public:
+	CList<pListRowColor, pListRowColor>	m_ListColorText;
+	CList<pListRowColor, pListRowColor>	m_ListColorBk;
+
+	// Generated message map functions
+protected:
+	//{{AFX_MSG(CSISListCtrlExt)
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_SISLISTCTRLEXT_H__516D59C3_2F02_47C6_8F4A_D6A78DCDD44A__INCLUDED_)
diff --git a/Lib/SISControls/include/SortClass.h b/Lib/SISControls/include/SortClass.h
new file mode 100644
index 0000000..b6b2d83
--- /dev/null
+++ b/Lib/SISControls/include/SortClass.h
@@ -0,0 +1,40 @@
+
+
+class CSortClass
+{
+public:
+	CSortClass(CListCtrl * _pWnd, const int _iCol, const bool _bIsNumeric);
+	//CSortClass(CListCtrl * _pWnd, const int _iCol, const bool _bIsNumeric, int iStartingItem, int iEndingItem );
+	virtual ~CSortClass();		
+	
+	int iCol;	
+	int m_iStartingItem;
+	int m_iEndingItem;
+
+	CListCtrl * pWnd;	
+	bool bIsNumeric;
+	
+	void Sort(const bool bAsc);	
+	
+	static int CALLBACK CompareAsc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareDes(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareAscI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+	static int CALLBACK CompareDesI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
+
+public:	
+	class CSortItem	
+	{	
+		public:		
+			virtual  ~CSortItem();
+			CSortItem(const DWORD _dw, const CString &_txt);		
+			CString txt;		
+			DWORD dw;	
+	};
+	class CSortItemInt	
+	{	
+		public:
+			CSortItemInt(const DWORD _dw, const CString &_txt);		
+			int iInt ;		
+			DWORD dw;	
+	};
+};
\ No newline at end of file
diff --git a/Lib/SISControls/include/StaticMap.h b/Lib/SISControls/include/StaticMap.h
new file mode 100644
index 0000000..591e458
--- /dev/null
+++ b/Lib/SISControls/include/StaticMap.h
@@ -0,0 +1,149 @@
+#if !defined(AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_)
+#define AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// StaticMap.h : header file
+//
+
+#define ORIGIN_LEFTTOP		1
+#define ORIGIN_LEFTBOTTOM	0
+#define ORIGIN_RIGHTTOP		2
+#define ORIGIN_RIGHTBOTTOM	3
+
+#define UM_MAP_CHANGED			5573
+#define _MENU_DEFECT_LIST_ID_			8000
+/////////////////////////////////////////////////////////////////////////////
+// CStaticMap window
+enum OriginDirection		{ OD_LeftTop = 0, OD_RightTop = 1, OD_LeftBottom = 10, OD_RightBottom = 11 };
+
+class AFX_EXT_CLASS CStaticMap : public CStatic
+{
+	// Construction
+public:
+	CStaticMap();
+
+	// Attributes
+public:
+
+	// Operations
+public:
+	void				InitGlass(CWnd* pParent, int nMapWidth, int nMapHeight, int nMapMargin);	// Pixel 窜困 付柳.
+	void				DeinitGlass();
+	int					GetMapTotalWidth()		{ return m_nMapTotalWidth; }
+	int					GetMapTotalHeight()		{ return m_nMapTotalHeight; }
+	int					GetMapWidth()			{ return m_nMapWidth; }
+	int					GetMapHeight()			{ return m_nMapHeight; }
+
+	void				SetMiniMap(BOOL bIsMiniMap, int nUnitSize)	{ m_bIsMiniMap = bIsMiniMap; m_nUnitSize = nUnitSize; }
+	int					GetUnitSize()			{ return m_nUnitSize; }
+
+	virtual void		DrawGlass(CDC* pDC)						{ }
+	virtual void		MouseLBtnDwn(CPoint& point)				{ }
+	virtual void		MouseLBtnUp(CPoint& point)				{ }
+	virtual void		MouseLBtnMove(CPoint& point)			{ }
+	virtual void		MouseLBtnDblClk(CPoint& point)			{ }
+	virtual void		MouseRBtnDwn(CPoint& point)				{ }
+	virtual void		MouseRBtnUp(CPoint& point)				{ }
+	virtual void		MouseRBtnDblClk(CPoint& point)			{ }
+	virtual void		RegistNoDefect()						{ }
+	virtual void		Timer(UINT nIDEvent)					{ }
+
+	// 犬措/绵家
+	void				IncreaseRatio();
+	void				DecreaseRatio();
+	void				ResetRatio();
+
+	CPoint&				GetDisplayStart()		{ return m_PointGlassStart; }
+	CPoint&				GetDisplayEnd()			{ return m_PointGlassEnd; }
+
+	void				SetDisplayRect(CPoint& PointStart, CPoint& PointEnd);
+	void				SetShowShot(BOOL bShow)	{ m_bShowShot = bShow; }
+
+	// 历厘
+	void				SaveMapToFile(CString strFileName);
+	void				SetBGColor(COLORREF color) { m_clBGColor = color; }
+
+	// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CStaticMap)
+	//}}AFX_VIRTUAL
+
+	// Implementation
+public:
+	virtual ~CStaticMap();
+
+	// Generated message map functions
+protected:
+	void				SetMappingMode(CDC *pDC);
+	CPoint				SetWindowToGlass(CPoint pt);
+	CPoint				SetGlassToWindow(CPoint pt);
+	void				ControlZoom(BOOL bZoomIn, CPoint ptMouse);
+
+	void				PopupMenu(int nBaseID, CPoint point);
+
+	CWnd*				m_pParentWnd;
+	int					m_nMapTotalWidth;
+	int					m_nMapTotalHeight;
+	int					m_nMapWidth;
+	int					m_nMapHeight;
+	int					m_nMapMarginWidth;
+	int					m_nMapMarginHeight;
+	CRect				m_RectWnd;
+	CRect				m_RectMap;
+	long				m_clBGColor;
+	long				m_clPatColor;
+	//////////////////////////////////////////////////////////////////////////
+	// 弊府扁 沥焊
+	HBITMAP				m_hDrawingSurface;
+	BITMAPINFOHEADER	m_BMIH;
+	CRect				m_RectDrawingSurface;
+	BYTE*				m_pDrawingSurfaceBits;
+
+	OriginDirection		m_OriginDir;
+	int					m_nUnitSize;
+
+	// Cell 弊府扁
+	BOOL				m_bShowShot;
+
+	// 犬措/绵家
+	CRect				m_RectShowWnd;
+
+	double				m_dRatio;
+	CPoint				m_PointWindowStart;
+	BOOL				m_bDragMove;
+	CPoint				m_PointDragStart;
+	BOOL				m_bIsMiniMap;			// Minimap篮 犬措/绵家甫 救茄促.
+	CPoint				m_PointGlassStart;		// Glass 吝 泅犁 焊咯瘤绰 康开.
+	CPoint				m_PointGlassEnd;
+
+	POINT				m_PointCCut[3];			//内呈钠 弊府扁 谅钎
+	int					m_nCCutSize;
+	int					m_nCoordGabX;			// 谅钎甫 谎副 芭府.
+	int					m_nCoordGabY;			// 谅钎甫 谎副 芭府.
+
+	//{{AFX_MSG(CStaticGlass)
+	afx_msg void OnPaint();
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
+	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg long OnUpdateMap(WPARAM wParam, LPARAM lParam);
+	afx_msg void OnMenuChangeViewMode(UINT nID);
+	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STATICMAP_H__5A9433C1_E8A9_4393_9E0D_B7A996B9AF3F__INCLUDED_)
diff --git a/Lib/SISControls/include/WKButton.h b/Lib/SISControls/include/WKButton.h
new file mode 100644
index 0000000..6dec8c3
--- /dev/null
+++ b/Lib/SISControls/include/WKButton.h
@@ -0,0 +1,119 @@
+#if !defined(AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_)
+#define AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// WKButton.h : header file
+/******************************< 橇肺弊伐 沥焊 >****************************/
+/*   努 贰 胶 疙 : WKButton                                                */ 
+/*   滚       傈 :                                                         */
+/*   弥辆 荐沥老 : 2006. 05. 28                                            */
+/***************************************************************************/
+
+/////////////////////////////////< 沥  狼 >//////////////////////////////////
+
+// 滚瓢 屈怕
+#define		WK_BUTTON_SHPAE_RECTANGLE				0x0001
+#define		WK_BUTTON_SHAPE_CIRCLE					0x0002
+#define		WK_BUTTON_SHAPE_ROUNDRECT				0x0004
+
+// 滚瓢 祸惑
+#define		WK_BUTTON_COLOR_ONE						0x0001
+#define		WK_BUTTON_COLOR_TWO						0x0002
+#define		WK_BUTTON_COLOR_GRADATION_UP			0x0011
+#define		WK_BUTTON_COLOR_GRADATION_RIGHT			0x0012
+#define		WK_BUTTON_COLOR_GRADATION_DOWN			0x0014
+#define		WK_BUTTON_COLOR_GRADATION_LEFT			0x0018
+
+// 滚瓢 惑怕
+#define		WK_BUTTON_STATUS_MOUSEOVER				0x0001
+#define		WK_BUTTON_STATUS_MOUSELEAVE				0x0002
+#define		WK_BUTTON_STATUS_MOUSECLICK				0x0004
+
+
+///////////////////////////////< 努贰胶 备炼 >///////////////////////////////
+class AFX_EXT_CLASS CWKButton : public CButton
+{
+public://<<<<<<<<<<<<<<<<<<<<<< 寇何 立辟 窃荐 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+	CWKButton();
+	virtual ~CWKButton();
+
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CWKButton)
+	public:
+	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
+	virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+	virtual BOOL DestroyWindow();
+	protected:
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+public:	
+/*****************************< 滚瓢 汲沥 窃荐 >****************************/
+	/* 咆胶飘 葛剧 棺 郴侩 瘤沥 */
+	BOOL SetButtonText(CString strCaption);
+	BOOL SetButtonText(CString strCaption, COLORREF rgbText);
+	BOOL SetButtonText(CString strCaption, CFont *font, COLORREF rgbText);
+	
+	/* 滚瓢 屈怕 棺 祸惑 瘤沥 */
+	BOOL SetButtonStyle(DWORD dShape, COLORREF rgbColor1);
+	BOOL SetButtonStyle(DWORD dShape, DWORD dStyle,	COLORREF rgbColor1,	COLORREF rgbColor2);
+	/***************************************************************************/
+
+protected://<<<<<<<<<<<<<<<< 郴何 贸府 窃荐 棺 函荐 >>>>>>>>>>>>>>>>>>>>>>>>>
+	/* 惑怕喊 滚瓢 捞固瘤 */
+	CBitmap m_bmpImage1;	//乞惑矫
+	CBitmap m_bmpImage2;	//付快胶 坷滚
+	CBitmap m_bmpImage3;	//努腐
+	
+	/* 惑怕喊 滚瓢 捞固瘤 积己 */
+	BOOL CreateButtonImage();
+
+	/* 滚瓢 屈怕 积己 */
+	BOOL DrawFormRectangle();	// 荤阿
+	BOOL DrawFormCircle();		// 盔
+	BOOL DrawFormRoundRect();	// 嫡辟荤阿
+
+	/* 捞固瘤 贸府 */
+	COLORREF LightValueControl(COLORREF rgb, int nValue);						// 祸惑 灌扁 炼例
+	void DrawGradation(CBitmap* bmpImage, COLORREF color1, COLORREF color2);	// 弊扼单捞记 捞固瘤 积己
+	BOOL DrawBorder(CBitmap* pbmpImage, COLORREF color1, COLORREF color2, int nWidth = 2);		// 滚瓢 抛滴府 弊府扁
+	BOOL DrawText(CBitmap* pBitmap, int nStatus);								// 滚瓢俊 臂揪 持扁
+
+	/* 滚瓢 捞固瘤 沥焊 */
+	DWORD m_dShape;			// 滚瓢 屈怕
+	DWORD m_dStyle;			// 拿矾 胶鸥老
+	COLORREF m_rgbColor1;	// 霉锅掳 拿矾
+	COLORREF m_rgbColor2;	// 滴锅掳 拿矾
+	CRect m_rtButton;		// 滚瓢农扁
+	int m_nWidth;			// 滚瓢 呈厚
+	int m_nHeight;			// 滚瓢 臭捞
+
+	/* 咆胶飘 沥焊 */
+	CString m_strCaption;	// 母记 郴侩
+	CFont m_Font;			// 母记 臂裁
+	COLORREF m_rgbText;		// 母记 祸惑
+	BOOL m_bValueChange;	// 母记 函版
+	
+	/* 滚瓢 惑怕 沥焊 */
+	DWORD m_dButtonStatus;
+	
+	//{{AFX_MSG(CWKButton)
+	afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
+	afx_msg void OnPaint();
+	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_WKBUTTON_H__99FB32BE_6D54_4845_BD51_1BC64E774CC6__INCLUDED_)
diff --git a/Lib/SISControls/include/XTabCtrl.h b/Lib/SISControls/include/XTabCtrl.h
new file mode 100644
index 0000000..2d25ef4
--- /dev/null
+++ b/Lib/SISControls/include/XTabCtrl.h
@@ -0,0 +1,90 @@
+#if !defined(AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_)
+#define AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// XTabCtrl.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CXTabCtrl window
+#include <afxtempl.h>
+
+class AFX_EXT_CLASS CXTabCtrl : public CTabCtrl
+{
+// Construction
+public:
+	CXTabCtrl();
+
+// Attributes
+public:
+
+// Operations
+public:
+	void AddTab(CWnd* pWnd, LPTSTR lpszCaption, int iImage =0);
+	void AddTab(CWnd* pWnd, LPTSTR lpszCaption, int Width, int Height, int iImage =0);
+	void EnableTab(int iIndex, BOOL bEnable = TRUE);
+	BOOL SelectTab(int iIndex);
+	void DeleteAllTabs();
+	void DeleteTab(int iIndex);
+	void SetTopLeftCorner(CPoint pt);
+	BOOL IsTabEnabled(int iIndex);
+
+	void SetDisabledColor(COLORREF cr);
+	void SetSelectedColor(COLORREF cr);
+	void SetNormalColor(COLORREF cr);
+	void SetMouseOverColor(COLORREF cr);
+
+	void SetParentWnd(CWnd* pWnd)	{ m_pParentWnd = pWnd; }
+
+// Overrides
+	// ClassWizard generated virtual function overrides
+	//{{AFX_VIRTUAL(CXTabCtrl)
+	protected:
+	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+	virtual void PreSubclassWindow();
+	//}}AFX_VIRTUAL
+
+// Implementation
+public:
+	virtual ~CXTabCtrl();
+
+	// Generated message map functions
+protected:
+	CArray<BOOL, BOOL> m_arrayStatusTab; //** enabled Y\N
+	int m_iSelectedTab;
+	POINT m_ptTabs;
+	COLORREF m_crSelected;
+	COLORREF m_crDisabled;
+	COLORREF m_crNormal;
+	COLORREF m_crMouseOver;
+	COLORREF m_crBKColor;
+
+	int m_iIndexMouseOver;
+	
+	bool m_bMouseOver;
+	bool m_bColorMouseOver;
+	bool m_bColorNormal;
+	bool m_bColorDisabled;
+	bool m_bColorSelected;
+	
+	//{{AFX_MSG(CXTabCtrl)
+	afx_msg void OnSelchange(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
+	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+	//}}AFX_MSG
+
+	DECLARE_MESSAGE_MAP()
+
+	CWnd*		m_pParentWnd;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_XTABCTRL_H__A11951B3_2F95_11D3_A896_00A0C9B6FB28__INCLUDED_)
diff --git a/Lib/SharedMapDll/include/LogManager.h b/Lib/SharedMapDll/include/LogManager.h
new file mode 100644
index 0000000..8a02822
--- /dev/null
+++ b/Lib/SharedMapDll/include/LogManager.h
@@ -0,0 +1,68 @@
+#pragma once
+#include <windows.h>
+
+#define LOG_FILE_PATH _T("C:\\LogFile\\")
+
+#define MAX_STRING_SIZE 256		//UNICODE 扁霖
+
+typedef struct _DITLOG {
+	int nLogID;
+    unsigned int nLevel;
+	unsigned int nProcess;
+    SYSTEMTIME nCurTime;
+    TCHAR logMessage[MAX_STRING_SIZE];
+} DITLOG,*PDITLOG;
+
+
+#define ONE_LOG_SIZE sizeof(DITLOG)	//(level+巩磊凯*2) BYTE 扁霖
+#define SHARED_LOG_COUNT 10000
+#define DIT_MAP_SIZE	1024*64
+
+
+//牢郸胶+疙飞敲贰弊+(level+巩磊凯)*钮肮荐+(甘荤捞令*64)
+#define SHAREDMEM_SIZE	4+4+ONE_LOG_SIZE*SHARED_LOG_COUNT+DIT_MAP_SIZE
+
+class AFX_EXT_CLASS CLogManager
+{
+	unsigned int m_nProcessID;
+	int m_nLogID;
+
+	HANDLE m_hFMap;
+	//牢郸胶客 目盖靛甫 力寇茄 傍蜡皋葛府 矫累 器牢飘
+	char* m_pSharedMem;
+
+	HANDLE m_csMemoryMap;
+	CRITICAL_SECTION m_csLocalLogFile;
+
+	//距 1000老(3斥) 荤侩啊瓷茄 牢郸胶
+	unsigned int* m_nIndex;
+
+	unsigned char* m_Command1;	//map历厘 敲贰弊
+
+	TCHAR m_TempLog[512];
+
+public:
+	unsigned int GetProcessID(){return m_nProcessID;};
+	int GetLogID(){return m_nLogID;};
+	void GetFirstCommand(unsigned char* pCommand);
+	void SetFirstCommand(unsigned char Command);
+	int GetIndex(){ return *m_nIndex;};
+
+	void SetMapData(char* pData)
+		{memcpy(m_pSharedMem+ONE_LOG_SIZE*SHARED_LOG_COUNT,pData,DIT_MAP_SIZE);};
+
+	char* GetMapDataAddress(){ return m_pSharedMem+ONE_LOG_SIZE*SHARED_LOG_COUNT;};
+
+	//傍蜡皋葛府俊 肺弊 累己, 肺弊饭骇苞 肺弊 郴侩 累己
+	void WriteLog( unsigned int Level, TCHAR* str,...);
+	//肺拿 窍靛俊 肺弊 累己
+	void WriteLocalLog(TCHAR* str,...);
+
+	//傍蜡皋葛府狼 肺弊甫 佬绢柯促.
+	void ReadLog(TCHAR* str, unsigned int curIndex, int* curLogID,
+				unsigned int* curLevel,unsigned int* curProcess, PSYSTEMTIME curTime);
+
+	CLogManager(int LogID, TCHAR* NameOfMemoryMap, unsigned int ProcessID = 0);//ProcessID 抗距康开
+	~CLogManager(void);
+	void SaveBinary(TCHAR* FilePath);
+};
diff --git a/ProjectClean.exe b/ProjectClean.exe
new file mode 100644
index 0000000..32cde39
--- /dev/null
+++ b/ProjectClean.exe
Binary files differ
diff --git a/SDK_AND_TEST/IncludeControl.h b/SDK_AND_TEST/IncludeControl.h
new file mode 100644
index 0000000..5a2168e
--- /dev/null
+++ b/SDK_AND_TEST/IncludeControl.h
@@ -0,0 +1,51 @@
+#pragma once
+
+
+//2. 日志模块
+#include "../Lib/LogSDK/include/ILogger.h"
+#include "../Lib/LogSDK/include/LogLib.h"
+#if _DEBUG
+#pragma comment(lib,"../Lib/LogSDK/lib/x64/Debug/Log.lib")
+#else
+#pragma comment(lib,"../Lib/LogSDK/lib/x64/Release/Log.lib")
+#endif
+
+#include "../Lib/SISControls/include/CellCtrl.h"
+#include "../Lib/SISControls/include/ColorButton.h"
+#include "../Lib/SISControls/include/DefectMap.h"
+#include "../Lib/SISControls/include/FontStatic.h"
+#include "../Lib/SISControls/include/GradientStatic.h"
+#include "../Lib/SISControls/include/HeadCtrl.h"
+#include "../Lib/SISControls/include/InPlaceComboBox.h"
+#include "../Lib/SISControls/include/InPlaceEdit.h"
+#include "../Lib/SISControls/include/LogCtrl.h"
+#include "../Lib/SISControls/include/SISButton.h"
+#include "../Lib/SISControls/include/SISFolderScheduling.h"
+#include "../Lib/SISControls/include/SISJogBtn2Parent.h"
+#include "../Lib/SISControls/include/SISJogButton.h"
+#include "../Lib/SISControls/include/SISLabel.h"
+#include "../Lib/SISControls/include/SISListBoxLog.h"
+#include "../Lib/SISControls/include/SISListCtrlExt.h"
+#include "../Lib/SISControls/include/SortClass.h"
+#include "../Lib/SISControls/include/StaticMap.h"
+#include "../Lib/SISControls/include/WKButton.h"
+#include "../Lib/SISControls/include/XTabCtrl.h"
+#include "../Lib/SISControls/GridControl/CellRange.h"
+#include "../Lib/SISControls/GridControl/GridCell.h"
+#include "../Lib/SISControls/GridControl/GridCellBase.h"
+#include "../Lib/SISControls/GridControl/GridCellButton.h"
+#include "../Lib/SISControls/GridControl/GridCtrl.h"
+#include "../Lib/SISControls/GridControl/GridDropTarget.h"
+#include "../Lib/SISControls/GridControl/GridInPlaceEdit.h"
+#include "../Lib/SISControls/GridControl/GridMemDC.h"
+#include "../Lib/SISControls/GridControl/TitleTip.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellCheck.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellCombo.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellDateTime.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridCellNumeric.h"
+#include "../Lib/SISControls/GridControl/NewCellTypes/GridURLCell.h"
+#if _DEBUG
+#pragma comment (lib, "../Lib/SISControls/lib/x64/Debug/SISControlsD.lib")
+#else
+#pragma comment (lib, "../Lib/SISControls/lib/x64/Release/SISControls.lib")
+#endif
diff --git a/SDK_AND_TEST/ReadMe.txt b/SDK_AND_TEST/ReadMe.txt
new file mode 100644
index 0000000..f376735
--- /dev/null
+++ b/SDK_AND_TEST/ReadMe.txt
@@ -0,0 +1,71 @@
+锘�================================================================================
+    MFC 霛检澊敫岆煬毽� : SDK_AND_TEST 頂勲鞝濏姼 臧滌殧
+===============================================================================
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 鞚� SDK_AND_TEST 鞚戩毄 頂勲攴鸽灗鞚� 毵岆摛鞐堨姷雼堧嫟. 鞚� 鞚戩毄 頂勲攴鸽灗鞚� MFC鞚� 旮半掣 靷毄氩曥潉 氤挫棳 欷� 肟愲 鞎勲媹霛� 鞚戩毄 頂勲攴鸽灗鞚� 鞛戩劚頃橁赴 鞙勴暅 旮半掣 甑“毳� 鞝滉车頃╇媹雼�.
+
+SDK_AND_TEST 鞚戩毄 頂勲攴鸽灗鞚� 甑劚頃橂姅 臧� 韺岇澕鞐� 雽�頃�
+鞖旍暯 靹る獏鞚� 韽暔霅橃柎 鞛堨姷雼堧嫟.
+
+SDK_AND_TEST.vcxproj
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靸濎劚頃� VC++ 頂勲鞝濏姼鞚� 旮半掣 頂勲鞝濏姼 韺岇澕鞛呺媹雼�. 韺岇澕鞚� 靸濎劚頃� Visual C++ 氩勳爠鞐� 雽�頃� 鞝曤炒鞕� 鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靹犿儩頃� 頂岆灚韽�, 甑劚 氚� 頂勲鞝濏姼 旮半姤鞐� 雽�頃� 鞝曤炒臧� 韽暔霅橃柎 鞛堨姷雼堧嫟.
+
+SDK_AND_TEST.vcxproj.filters
+    鞚戩毄 頂勲攴鸽灗 毵堧矔靷ゼ 靷毄頃橃棳 靸濎劚霅� VC++ 頂勲鞝濏姼鞚� 頃勴劙 韺岇澕鞛呺媹雼�. 鞚� 韺岇澕鞐愲姅 頂勲鞝濏姼鞚� 韺岇澕瓿� 頃勴劙 臧勳潣 鞐瓣舶 鞝曤炒臧� 霌れ柎 鞛堨姷雼堧嫟. 鞚措煬頃� 鞐瓣舶鞚� 韸轨爼 雲鸽摐鞐愳劀 鞙犾偓頃� 頇曥灔氇呾溂搿� 攴鸽9頇旊悳 韺岇澕鞚� 響滌嫓頃橁赴 鞙勴暣 IDE鞐愳劀 靷毄霅╇媹雼�. 鞓堧ゼ 霌れ柎 ".cpp" 韺岇澕鞚� "靻岇姢 韺岇澕" 頃勴劙鞕� 鞐瓣舶霅橃柎 鞛堨姷雼堧嫟.
+
+SDK_AND_TEST.h
+    頃措嫻 鞚戩毄 頂勲攴鸽灗鞚� 旮半掣 項る崝 韺岇澕鞛呺媹雼�.
+    鞐赴鞐愲姅 resource.h毳� 牍勲’頃� 雼るジ 頂勲鞝濏姼氤� 項る崝臧� 韽暔霅橃柎 鞛堨溂氅� CSDK_AND_TESTApp 鞚戩毄 頂勲攴鸽灗 韥措灅鞀り皜 靹犾柛霅橃柎 鞛堨姷雼堧嫟.
+
+SDK_AND_TEST.cpp
+    鞚措姅 鞚戩毄 頂勲攴鸽灗 韥措灅鞀� CSDK_AND_TESTApp臧� 韽暔霅� 旮半掣 鞚戩毄 頂勲攴鸽灗 靻岇姢 韺岇澕鞛呺媹雼�.
+
+SDK_AND_TEST.rc
+    頂勲攴鸽灗鞐愳劀 靷毄頃橂姅 氇摖 Microsoft Windows 毽唽鞀れ潣 氇╇鞛呺媹雼�. 鞐赴鞐愲姅 RES 頃橃渼 霐旊爥韯半Μ鞐� 鞝�鞛ル悳 鞎勳澊旖�, 牍勴姼毵� 氚� 旎れ劀臧� 韽暔霅╇媹雼�. 鞚� 韺岇澕鞚� Microsoft Visual C++鞐愳劀 歆侅爲 韼胳頃� 靾� 鞛堨姷雼堧嫟. 頂勲鞝濏姼 毽唽鞀る姅 1042鞐� 鞛堨姷雼堧嫟.
+
+res\SDK_AND_TEST.ico
+    鞎勳澊旖� 韺岇澕鞚措┌, 鞚戩毄 頂勲攴鸽灗鞚� 鞎勳澊旖橃溂搿� 靷毄霅╇媹雼�. 鞚� 鞎勳澊旖橃潃 旮半掣 毽唽鞀� 韺岇澕鞚� SDK_AND_TEST.rc鞐� 鞚橅暣 韽暔霅╇媹雼�.
+
+res\SDK_AND_TEST.rc2
+    鞚� 韺岇澕鞐愲姅 Microsoft Visual C++ 鞚挫櫢鞚� 雼るジ 霃勱惮鞐愳劀 韼胳頃� 毽唽鞀り皜 韽暔霅橃柎 鞛堨姷雼堧嫟. 毽唽鞀� 韼胳旮半 韼胳頃� 靾� 鞐嗠姅 氇摖 毽唽鞀る姅 鞚� 韺岇澕鞐� 雱l柎鞎� 頃╇媹雼�.
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 雽�頇� 靸侅瀽 韥措灅鞀� 頃橂倶毳� 毵岆摥雼堧嫟.
+
+SDK_AND_TESTDlg.h, SDK_AND_TESTDlg.cpp - 雽�頇� 靸侅瀽
+    鞚� 韺岇澕鞐愲姅 CSDK_AND_TESTDlg 韥措灅鞀り皜 韽暔霅╇媹雼�. 鞚� 韥措灅鞀る姅 鞚戩毄 頂勲攴鸽灗鞚� 欤� 雽�頇� 靸侅瀽鞐� 雽�頃� 霃欖瀾鞚� 鞝曥潣頃╇媹雼�. 鞚� 雽�頇� 靸侅瀽 韰滍攲毽快潃 SDK_AND_TEST.rc鞐� 鞛堨溂氅�, Microsoft Visual C++鞐愳劀 歆侅爲 韼胳頃� 靾� 鞛堨姷雼堧嫟.
+
+/////////////////////////////////////////////////////////////////////////////
+
+旮绊儉 旮半姤:
+
+ActiveX 旎姼搿�
+    鞚戩毄 頂勲攴鸽灗鞚� Active X 旎姼搿れ潉 歆�鞗愴暕雼堧嫟.
+
+鞚胳噭 氚� 鞚胳噭 氙鸽Μ 氤搓赴 歆�鞗�
+    MFC 霛检澊敫岆煬毽潣 CView 韥措灅鞀れ棎靹� 氅る矂 頃垬毳� 順胳稖頃橃棳 鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 鞚胳噭, 鞚胳噭 靹れ爼 氚� 鞚胳噭 氙鸽Μ 氤搓赴 氇呺牴 旖旊摐毳� 靸濎劚頃� 靾� 鞛堨姷雼堧嫟.
+
+/////////////////////////////////////////////////////////////////////////////
+
+旮绊儉 響滌 韺岇澕:
+
+StdAfx.h, StdAfx.cpp
+    鞚� 韺岇澕鞚� 氙鸽Μ 旎错寣鞚茧悳 項る崝(PCH) 韺岇澕 SDK_AND_TEST.pch鞕� 氙鸽Μ 旎错寣鞚茧悳 順曥嫕(PCT) 韺岇澕 StdAfx.obj毳� 牍岆摐頃橂姅 雿� 靷毄霅╇媹雼�.
+
+Resource.h
+    靸� 毽唽鞀� ID毳� 鞝曥潣頃橂姅 響滌 項る崝 韺岇澕鞛呺媹雼�. Microsoft Visual C++鞐愳劀 鞚� 韺岇澕鞚� 鞚疥碃 鞐呺嵃鞚错姼頃╇媹雼�.
+
+SDK_AND_TEST.manifest
+	鞚戩毄 頂勲攴鸽灗 毵る媹韼橃姢韸� 韺岇澕鞚� Windows XP鞐愳劀 韸轨爼 氩勳爠鞚� Side-by-Side 鞏挫厛敫旊Μ鞐� 雽�頃� 鞚戩毄 頂勲攴鸽灗 膦呾啀靹膘潉 靹る獏頃橂姅 雿� 靷毄霅╇媹雼�. 搿滊崝電� 鞚� 鞝曤炒毳� 韱淀暣 鞏挫厛敫旊Μ 旌愳嫓 霕愲姅 鞚戩毄 頂勲攴鸽灗鞚� private鞐愳劀 鞝侅爤頃� 鞏挫厛敫旊Μ毳� 搿滊摐頃╇媹雼�. 鞚戩毄 頂勲攴鸽灗 毵る媹韼橃姢韸鸽姅 鞚戩毄 頂勲攴鸽灗 鞁ろ枆 韺岇澕瓿� 臧欖潃 韽措崝鞐� 靹れ箻霅� 鞕鸽秬 .manifest 韺岇澕 順曧儨搿滌劀 鞛鞍韽毄鞙茧 韽暔霅橁卑雮�, 毽唽鞀� 順曧儨搿� 霅� 鞁ろ枆 韺岇澕鞐� 韽暔霅� 靾� 鞛堨姷雼堧嫟.
+/////////////////////////////////////////////////////////////////////////////
+
+旮绊儉 彀戈碃:
+
+鞚戩毄 頂勲攴鸽灗 毵堧矔靷棎靹� 靷毄頃橂姅 "TODO:"電� 靷毄鞛愱皜 於旉皜頃橁卑雮� 靷毄鞛� 歆�鞝曧暣鞎� 頃橂姅 靻岇姢 旖旊摐 攵�攵勳潉 雮橅儉雰呺媹雼�.
+
+瓿奠湢霅� DLL鞐愳劀 MFC毳� 靷毄頃橂姅 鞚戩毄 頂勲攴鸽灗鞚� 瓴届毎 MFC DLL鞚� 鞛鞍韽暊 頃勳殧臧� 鞐嗢姷雼堧嫟. 鞚戩毄 頂勲攴鸽灗鞐愳劀 鞖挫榿 觳挫牅鞚� 搿滌簶瓿� 雼るジ 鞏胳柎毳� 靷毄頃橂姅 瓴届毎 鞚挫棎 頃措嫻頃橂姅 歆�鞐檾霅� 毽唽鞀れ澑 mfc110XXX.DLL霃� 鞛鞍韽暣鞎� 頃╇媹雼�.
+鞚措煬頃� 霊� 頃鞐� 雽�頃� 鞛愳劯頃� 雮挫毄鞚� MSDN 靹る獏靹滌棎 鞛堧姅 Visual C++ 鞚戩毄 頂勲攴鸽灗 鞛鞍韽� 靹轨厴鞚� 彀胳“頃橃嫮鞁滌槫.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/SDK_AND_TEST/SDK_AND_TEST.cpp b/SDK_AND_TEST/SDK_AND_TEST.cpp
new file mode 100644
index 0000000..da19289
--- /dev/null
+++ b/SDK_AND_TEST/SDK_AND_TEST.cpp
Binary files differ
diff --git a/SDK_AND_TEST/SDK_AND_TEST.h b/SDK_AND_TEST/SDK_AND_TEST.h
new file mode 100644
index 0000000..445aaf5
--- /dev/null
+++ b/SDK_AND_TEST/SDK_AND_TEST.h
Binary files differ
diff --git a/SDK_AND_TEST/SDK_AND_TEST.rc b/SDK_AND_TEST/SDK_AND_TEST.rc
new file mode 100644
index 0000000..7183421
--- /dev/null
+++ b/SDK_AND_TEST/SDK_AND_TEST.rc
Binary files differ
diff --git a/SDK_AND_TEST/SDK_AND_TEST.vcxproj b/SDK_AND_TEST/SDK_AND_TEST.vcxproj
new file mode 100644
index 0000000..ce74454
--- /dev/null
+++ b/SDK_AND_TEST/SDK_AND_TEST.vcxproj
@@ -0,0 +1,226 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{FC04F3BF-34C4-4D02-80DD-41F61ACE8006}</ProjectGuid>
+    <RootNamespace>SDK_AND_TEST</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+    <Keyword>MFCProj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <SDLCheck>true</SDLCheck>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0412</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="IncludeControl.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="SDK_AND_TEST.h" />
+    <ClInclude Include="SDK_AND_TESTDlg.h" />
+    <ClInclude Include="stdafx.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="SDK_AND_TEST.cpp" />
+    <ClCompile Include="SDK_AND_TESTDlg.cpp" />
+    <ClCompile Include="stdafx.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="SDK_AND_TEST.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\SDK_AND_TEST.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\SDK_AND_TEST.ico" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="SDK_AND_TEST.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/SDK_AND_TEST/SDK_AND_TEST.vcxproj.filters b/SDK_AND_TEST/SDK_AND_TEST.vcxproj.filters
new file mode 100644
index 0000000..955f82e
--- /dev/null
+++ b/SDK_AND_TEST/SDK_AND_TEST.vcxproj.filters
@@ -0,0 +1,66 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="婧愭枃浠�">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="澶存枃浠�">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="璧勬簮鏂囦欢">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <Text Include="ReadMe.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="SDK_AND_TEST.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="SDK_AND_TESTDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="stdafx.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="IncludeControl.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="SDK_AND_TEST.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="SDK_AND_TESTDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="stdafx.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="SDK_AND_TEST.rc">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\SDK_AND_TEST.rc2">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\SDK_AND_TEST.ico">
+      <Filter>璧勬簮鏂囦欢</Filter>
+    </Image>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/SDK_AND_TEST/SDK_AND_TESTDlg.cpp b/SDK_AND_TEST/SDK_AND_TESTDlg.cpp
new file mode 100644
index 0000000..99d987b
--- /dev/null
+++ b/SDK_AND_TEST/SDK_AND_TESTDlg.cpp
Binary files differ
diff --git a/SDK_AND_TEST/SDK_AND_TESTDlg.h b/SDK_AND_TEST/SDK_AND_TESTDlg.h
new file mode 100644
index 0000000..9b42bea
--- /dev/null
+++ b/SDK_AND_TEST/SDK_AND_TESTDlg.h
Binary files differ
diff --git a/SDK_AND_TEST/res/SDK_AND_TEST.ico b/SDK_AND_TEST/res/SDK_AND_TEST.ico
new file mode 100644
index 0000000..d56fbcd
--- /dev/null
+++ b/SDK_AND_TEST/res/SDK_AND_TEST.ico
Binary files differ
diff --git a/SDK_AND_TEST/res/SDK_AND_TEST.rc2 b/SDK_AND_TEST/res/SDK_AND_TEST.rc2
new file mode 100644
index 0000000..69f3cdd
--- /dev/null
+++ b/SDK_AND_TEST/res/SDK_AND_TEST.rc2
Binary files differ
diff --git a/SDK_AND_TEST/resource.h b/SDK_AND_TEST/resource.h
new file mode 100644
index 0000000..78fd444
--- /dev/null
+++ b/SDK_AND_TEST/resource.h
Binary files differ
diff --git a/SDK_AND_TEST/stdafx.cpp b/SDK_AND_TEST/stdafx.cpp
new file mode 100644
index 0000000..32dd285
--- /dev/null
+++ b/SDK_AND_TEST/stdafx.cpp
Binary files differ
diff --git a/SDK_AND_TEST/stdafx.h b/SDK_AND_TEST/stdafx.h
new file mode 100644
index 0000000..92599db
--- /dev/null
+++ b/SDK_AND_TEST/stdafx.h
Binary files differ
diff --git a/SDK_AND_TEST/targetver.h b/SDK_AND_TEST/targetver.h
new file mode 100644
index 0000000..caff8a0
--- /dev/null
+++ b/SDK_AND_TEST/targetver.h
Binary files differ
diff --git a/remove.bat b/remove.bat
new file mode 100644
index 0000000..f18974b
--- /dev/null
+++ b/remove.bat
@@ -0,0 +1,15 @@
+@echo off
+echo ----------------------------------------------------
+echo 橇饭静 局聪 虐 !!!
+echo 鞘夸 绝绰 颇老阑 葛滴 瘤况 谎妨夸...
+echo *.ipch *.exp *.pdb *.aps *.idb *.ncp *.obj *.pch *.sbr *.tmp *.pdb *.bsc *.ilk *.ncb *.opt *.suo *.manifest *.dep *.log *.map *.user *.vcproj *.tlog
+echo made by ssb
+echo ----------------------------------------------------
+pause
+
+del /F /Q /S *.ipch *.exp *.pdb *.idb *.ncp *.obj *.pch *.sbr *.tmp *.bsc *.ilk *.ncb *.opt *.suo *.manifest *.dep *.log *.map *.user *.tlog *.sdf *.unsuccessfulbuild BuildLog.htm *.lastbuildstate *.res *_manifest.rc
+
+
+pause
+
+
diff --git "a/\350\277\220\350\241\214\347\216\257\345\242\203/RCutProject.zip" "b/\350\277\220\350\241\214\347\216\257\345\242\203/RCutProject.zip"
new file mode 100644
index 0000000..03a70fe
--- /dev/null
+++ "b/\350\277\220\350\241\214\347\216\257\345\242\203/RCutProject.zip"
Binary files differ
diff --git "a/\350\277\220\350\241\214\347\216\257\345\242\203/\351\251\261\345\212\250\350\265\204\346\226\231.zip" "b/\350\277\220\350\241\214\347\216\257\345\242\203/\351\251\261\345\212\250\350\265\204\346\226\231.zip"
new file mode 100644
index 0000000..79dd575
--- /dev/null
+++ "b/\350\277\220\350\241\214\347\216\257\345\242\203/\351\251\261\345\212\250\350\265\204\346\226\231.zip"
Binary files differ

--
Gitblit v1.9.3